{ "version": 3, "sources": ["../../../node_modules/rails-ujs/lib/assets/compiled/rails-ujs.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/adapters.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/logger.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/connection_monitor.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/internal.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/connection.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/subscription.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/subscription_guarantor.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/subscriptions.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/consumer.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/index.js", "../../../node_modules/highcharts/highcharts.js", "../../../node_modules/highcharts/modules/accessibility.js", "../../../node_modules/highcharts/modules/annotations.js", "../../../node_modules/highcharts/modules/exporting.js", "../../../node_modules/highcharts/modules/series-label.js", "../../../node_modules/plotly.js-dist/plotly.js", "../../../node_modules/chartkick/dist/chartkick.esm.js", "../../../node_modules/@kurkle/color/dist/color.esm.js", "../../../node_modules/chart.js/src/helpers/helpers.core.ts", "../../../node_modules/chart.js/src/helpers/helpers.math.ts", "../../../node_modules/chart.js/src/helpers/helpers.collection.ts", "../../../node_modules/chart.js/src/helpers/helpers.extras.ts", "../../../node_modules/chart.js/src/helpers/helpers.easing.ts", "../../../node_modules/chart.js/src/helpers/helpers.color.ts", "../../../node_modules/chart.js/src/core/core.animations.defaults.js", "../../../node_modules/chart.js/src/core/core.layouts.defaults.js", "../../../node_modules/chart.js/src/helpers/helpers.intl.ts", "../../../node_modules/chart.js/src/core/core.ticks.js", "../../../node_modules/chart.js/src/core/core.scale.defaults.js", "../../../node_modules/chart.js/src/core/core.defaults.js", "../../../node_modules/chart.js/src/helpers/helpers.canvas.ts", "../../../node_modules/chart.js/src/helpers/helpers.options.ts", "../../../node_modules/chart.js/src/helpers/helpers.config.ts", "../../../node_modules/chart.js/src/helpers/helpers.curve.ts", "../../../node_modules/chart.js/src/helpers/helpers.dom.ts", "../../../node_modules/chart.js/src/helpers/helpers.interpolation.ts", "../../../node_modules/chart.js/src/helpers/helpers.rtl.ts", "../../../node_modules/chart.js/src/helpers/helpers.segment.js", "../../../node_modules/chart.js/src/core/core.animator.js", "../../../node_modules/chart.js/src/core/core.animation.js", "../../../node_modules/chart.js/src/core/core.animations.js", "../../../node_modules/chart.js/src/core/core.datasetController.js", "../../../node_modules/chart.js/src/controllers/controller.bar.js", "../../../node_modules/chart.js/src/controllers/controller.bubble.js", "../../../node_modules/chart.js/src/controllers/controller.doughnut.js", "../../../node_modules/chart.js/src/controllers/controller.line.js", "../../../node_modules/chart.js/src/controllers/controller.polarArea.js", "../../../node_modules/chart.js/src/controllers/controller.pie.js", "../../../node_modules/chart.js/src/controllers/controller.radar.js", "../../../node_modules/chart.js/src/controllers/controller.scatter.js", "../../../node_modules/chart.js/src/core/core.adapters.ts", "../../../node_modules/chart.js/src/core/core.interaction.js", "../../../node_modules/chart.js/src/core/core.layouts.js", "../../../node_modules/chart.js/src/platform/platform.base.js", "../../../node_modules/chart.js/src/platform/platform.basic.js", "../../../node_modules/chart.js/src/platform/platform.dom.js", "../../../node_modules/chart.js/src/platform/index.js", "../../../node_modules/chart.js/src/core/core.element.ts", "../../../node_modules/chart.js/src/core/core.scale.autoskip.js", "../../../node_modules/chart.js/src/core/core.scale.js", "../../../node_modules/chart.js/src/core/core.typedRegistry.js", "../../../node_modules/chart.js/src/core/core.registry.js", "../../../node_modules/chart.js/src/core/core.plugins.js", "../../../node_modules/chart.js/src/core/core.config.js", "../../../node_modules/chart.js/src/core/core.controller.js", "../../../node_modules/chart.js/src/elements/element.arc.ts", "../../../node_modules/chart.js/src/elements/element.line.js", "../../../node_modules/chart.js/src/elements/element.point.ts", "../../../node_modules/chart.js/src/elements/element.bar.js", "../../../node_modules/chart.js/src/plugins/plugin.colors.ts", "../../../node_modules/chart.js/src/plugins/plugin.decimation.js", "../../../node_modules/chart.js/src/plugins/plugin.filler/filler.segment.js", "../../../node_modules/chart.js/src/plugins/plugin.filler/filler.helper.js", "../../../node_modules/chart.js/src/plugins/plugin.filler/filler.options.js", "../../../node_modules/chart.js/src/plugins/plugin.filler/filler.target.stack.js", "../../../node_modules/chart.js/src/plugins/plugin.filler/simpleArc.js", "../../../node_modules/chart.js/src/plugins/plugin.filler/filler.target.js", "../../../node_modules/chart.js/src/plugins/plugin.filler/filler.drawing.js", "../../../node_modules/chart.js/src/plugins/plugin.filler/index.js", "../../../node_modules/chart.js/src/plugins/plugin.legend.js", "../../../node_modules/chart.js/src/plugins/plugin.title.js", "../../../node_modules/chart.js/src/plugins/plugin.subtitle.js", "../../../node_modules/chart.js/src/plugins/plugin.tooltip.js", "../../../node_modules/chart.js/src/scales/scale.category.js", "../../../node_modules/chart.js/src/scales/scale.linearbase.js", "../../../node_modules/chart.js/src/scales/scale.linear.js", "../../../node_modules/chart.js/src/scales/scale.logarithmic.js", "../../../node_modules/chart.js/src/scales/scale.radialLinear.js", "../../../node_modules/chart.js/src/scales/scale.time.js", "../../../node_modules/chart.js/src/scales/scale.timeseries.js", "../../../node_modules/chart.js/src/index.ts", "../../../node_modules/chart.js/auto/auto.js", "../../../node_modules/@babel/runtime/helpers/esm/typeof.js", "../../../node_modules/date-fns/esm/_lib/toInteger/index.js", "../../../node_modules/date-fns/esm/_lib/requiredArgs/index.js", "../../../node_modules/date-fns/esm/toDate/index.js", "../../../node_modules/date-fns/esm/addDays/index.js", "../../../node_modules/date-fns/esm/addMonths/index.js", "../../../node_modules/date-fns/esm/addMilliseconds/index.js", "../../../node_modules/date-fns/esm/addHours/index.js", "../../../node_modules/date-fns/esm/_lib/defaultOptions/index.js", "../../../node_modules/date-fns/esm/startOfWeek/index.js", "../../../node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js", "../../../node_modules/date-fns/esm/startOfDay/index.js", "../../../node_modules/date-fns/esm/differenceInCalendarDays/index.js", "../../../node_modules/date-fns/esm/addMinutes/index.js", "../../../node_modules/date-fns/esm/addQuarters/index.js", "../../../node_modules/date-fns/esm/addSeconds/index.js", "../../../node_modules/date-fns/esm/addWeeks/index.js", "../../../node_modules/date-fns/esm/addYears/index.js", "../../../node_modules/date-fns/esm/compareAsc/index.js", "../../../node_modules/date-fns/esm/constants/index.js", "../../../node_modules/date-fns/esm/isDate/index.js", "../../../node_modules/date-fns/esm/isValid/index.js", "../../../node_modules/date-fns/esm/differenceInCalendarMonths/index.js", "../../../node_modules/date-fns/esm/differenceInCalendarYears/index.js", "../../../node_modules/date-fns/esm/differenceInDays/index.js", "../../../node_modules/date-fns/esm/differenceInMilliseconds/index.js", "../../../node_modules/date-fns/esm/_lib/roundingMethods/index.js", "../../../node_modules/date-fns/esm/differenceInHours/index.js", "../../../node_modules/date-fns/esm/differenceInMinutes/index.js", "../../../node_modules/date-fns/esm/endOfDay/index.js", "../../../node_modules/date-fns/esm/endOfMonth/index.js", "../../../node_modules/date-fns/esm/isLastDayOfMonth/index.js", "../../../node_modules/date-fns/esm/differenceInMonths/index.js", "../../../node_modules/date-fns/esm/differenceInQuarters/index.js", "../../../node_modules/date-fns/esm/differenceInSeconds/index.js", "../../../node_modules/date-fns/esm/differenceInWeeks/index.js", "../../../node_modules/date-fns/esm/differenceInYears/index.js", "../../../node_modules/date-fns/esm/startOfMinute/index.js", "../../../node_modules/date-fns/esm/startOfQuarter/index.js", "../../../node_modules/date-fns/esm/startOfMonth/index.js", "../../../node_modules/date-fns/esm/endOfYear/index.js", "../../../node_modules/date-fns/esm/startOfYear/index.js", "../../../node_modules/date-fns/esm/endOfHour/index.js", "../../../node_modules/date-fns/esm/endOfWeek/index.js", "../../../node_modules/date-fns/esm/endOfMinute/index.js", "../../../node_modules/date-fns/esm/endOfQuarter/index.js", "../../../node_modules/date-fns/esm/endOfSecond/index.js", "../../../node_modules/date-fns/esm/subMilliseconds/index.js", "../../../node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js", "../../../node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js", "../../../node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js", "../../../node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js", "../../../node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js", "../../../node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js", "../../../node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js", "../../../node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js", "../../../node_modules/date-fns/esm/_lib/getUTCWeek/index.js", "../../../node_modules/date-fns/esm/_lib/addLeadingZeros/index.js", "../../../node_modules/date-fns/esm/_lib/format/lightFormatters/index.js", "../../../node_modules/date-fns/esm/_lib/format/formatters/index.js", "../../../node_modules/date-fns/esm/_lib/format/longFormatters/index.js", "../../../node_modules/date-fns/esm/_lib/protectedTokens/index.js", "../../../node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js", "../../../node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js", "../../../node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js", "../../../node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js", "../../../node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js", "../../../node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js", "../../../node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js", "../../../node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js", "../../../node_modules/date-fns/esm/locale/en-US/_lib/match/index.js", "../../../node_modules/date-fns/esm/locale/en-US/index.js", "../../../node_modules/date-fns/esm/_lib/defaultLocale/index.js", "../../../node_modules/date-fns/esm/format/index.js", "../../../node_modules/date-fns/esm/_lib/assign/index.js", "../../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js", "../../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js", "../../../node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js", "../../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js", "../../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js", "../../../node_modules/@babel/runtime/helpers/esm/inherits.js", "../../../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js", "../../../node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js", "../../../node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js", "../../../node_modules/@babel/runtime/helpers/esm/createSuper.js", "../../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js", "../../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js", "../../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js", "../../../node_modules/@babel/runtime/helpers/esm/createClass.js", "../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js", "../../../node_modules/date-fns/esm/parse/_lib/Setter.js", "../../../node_modules/date-fns/esm/parse/_lib/Parser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/EraParser.js", "../../../node_modules/date-fns/esm/parse/_lib/constants.js", "../../../node_modules/date-fns/esm/parse/_lib/utils.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/YearParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekYearParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekYearParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/ExtendedYearParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/QuarterParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/StandAloneQuarterParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/MonthParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/StandAloneMonthParser.js", "../../../node_modules/date-fns/esm/_lib/setUTCWeek/index.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekParser.js", "../../../node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/DateParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/DayOfYearParser.js", "../../../node_modules/date-fns/esm/_lib/setUTCDay/index.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/DayParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/LocalDayParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/StandAloneLocalDayParser.js", "../../../node_modules/date-fns/esm/_lib/setUTCISODay/index.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/ISODayParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/AMPMParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/AMPMMidnightParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/DayPeriodParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/Hour1to12Parser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/Hour0to23Parser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/Hour0To11Parser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/Hour1To24Parser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/MinuteParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/SecondParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/FractionOfSecondParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneWithZParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/TimestampSecondsParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/TimestampMillisecondsParser.js", "../../../node_modules/date-fns/esm/parse/_lib/parsers/index.js", "../../../node_modules/date-fns/esm/parse/index.js", "../../../node_modules/date-fns/esm/startOfHour/index.js", "../../../node_modules/date-fns/esm/startOfSecond/index.js", "../../../node_modules/date-fns/esm/parseISO/index.js", "../../../node_modules/date-fns/esm/index.js", "../../../node_modules/chartjs-adapter-date-fns/dist/chartjs-adapter-date-fns.esm.js", "../../../node_modules/chartkick/chart.js/chart.esm.js", "../../javascript/orgs.js", "../../../node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/snakeize.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable_stream_source_element.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/fetch_requests.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/index.js", "../../../node_modules/local-time/app/assets/javascripts/local-time.es2017-esm.js", "../../javascript/lib/local_time.js", "../../../node_modules/@hotwired/stimulus/dist/stimulus.js", "../../javascript/orgs/application.js", "../../javascript/controllers/application.js", "../../components/highcharts_component_controller.js", "../../components/orgs/modal_component_controller.js", "../../components/orgs/notification_component_controller.js", "../../components/index.js", "../../javascript/orgs/app_navigation_controller.js", "../../javascript/lib/debounce.js", "../../javascript/controllers/automatic_form_submit_controller.js", "../../javascript/orgs/charging_preference_controller.js", "../../javascript/controllers/clipboard_controller.js", "../../javascript/controllers/custom_event_controller.js", "../../javascript/controllers/disable_submit_controller.js", "../../javascript/orgs/fade_out_controller.js", "../../javascript/controllers/google_analytics_controller.js", "../../javascript/controllers/hide_section_controller.js", "../../javascript/orgs/pairing_code_modal_controller.js", "../../javascript/orgs/session_graph_controller.js", "../../javascript/orgs/toggle_controller.js", "../../javascript/orgs/toggle_visibility_controller.js", "../../javascript/orgs/index.js"], "sourcesContent": ["/*\nUnobtrusive JavaScript\nhttps://github.com/rails/rails/blob/master/actionview/app/assets/javascripts\nReleased under the MIT license\n */;\n\n(function() {\n var context = this;\n\n (function() {\n (function() {\n this.Rails = {\n linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',\n buttonClickSelector: {\n selector: 'button[data-remote]:not([form]), button[data-confirm]:not([form])',\n exclude: 'form button'\n },\n inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',\n formSubmitSelector: 'form',\n formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',\n formDisableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled',\n formEnableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled',\n fileInputSelector: 'input[name][type=file]:not([disabled])',\n linkDisableSelector: 'a[data-disable-with], a[data-disable]',\n buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]'\n };\n\n }).call(this);\n }).call(context);\n\n var Rails = context.Rails;\n\n (function() {\n (function() {\n var nonce;\n\n nonce = null;\n\n Rails.loadCSPNonce = function() {\n var ref;\n return nonce = (ref = document.querySelector(\"meta[name=csp-nonce]\")) != null ? ref.content : void 0;\n };\n\n Rails.cspNonce = function() {\n return nonce != null ? nonce : Rails.loadCSPNonce();\n };\n\n }).call(this);\n (function() {\n var expando, m;\n\n m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;\n\n Rails.matches = function(element, selector) {\n if (selector.exclude != null) {\n return m.call(element, selector.selector) && !m.call(element, selector.exclude);\n } else {\n return m.call(element, selector);\n }\n };\n\n expando = '_ujsData';\n\n Rails.getData = function(element, key) {\n var ref;\n return (ref = element[expando]) != null ? ref[key] : void 0;\n };\n\n Rails.setData = function(element, key, value) {\n if (element[expando] == null) {\n element[expando] = {};\n }\n return element[expando][key] = value;\n };\n\n Rails.$ = function(selector) {\n return Array.prototype.slice.call(document.querySelectorAll(selector));\n };\n\n }).call(this);\n (function() {\n var $, csrfParam, csrfToken;\n\n $ = Rails.$;\n\n csrfToken = Rails.csrfToken = function() {\n var meta;\n meta = document.querySelector('meta[name=csrf-token]');\n return meta && meta.content;\n };\n\n csrfParam = Rails.csrfParam = function() {\n var meta;\n meta = document.querySelector('meta[name=csrf-param]');\n return meta && meta.content;\n };\n\n Rails.CSRFProtection = function(xhr) {\n var token;\n token = csrfToken();\n if (token != null) {\n return xhr.setRequestHeader('X-CSRF-Token', token);\n }\n };\n\n Rails.refreshCSRFTokens = function() {\n var param, token;\n token = csrfToken();\n param = csrfParam();\n if ((token != null) && (param != null)) {\n return $('form input[name=\"' + param + '\"]').forEach(function(input) {\n return input.value = token;\n });\n }\n };\n\n }).call(this);\n (function() {\n var CustomEvent, fire, matches, preventDefault;\n\n matches = Rails.matches;\n\n CustomEvent = window.CustomEvent;\n\n if (typeof CustomEvent !== 'function') {\n CustomEvent = function(event, params) {\n var evt;\n evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n };\n CustomEvent.prototype = window.Event.prototype;\n preventDefault = CustomEvent.prototype.preventDefault;\n CustomEvent.prototype.preventDefault = function() {\n var result;\n result = preventDefault.call(this);\n if (this.cancelable && !this.defaultPrevented) {\n Object.defineProperty(this, 'defaultPrevented', {\n get: function() {\n return true;\n }\n });\n }\n return result;\n };\n }\n\n fire = Rails.fire = function(obj, name, data) {\n var event;\n event = new CustomEvent(name, {\n bubbles: true,\n cancelable: true,\n detail: data\n });\n obj.dispatchEvent(event);\n return !event.defaultPrevented;\n };\n\n Rails.stopEverything = function(e) {\n fire(e.target, 'ujs:everythingStopped');\n e.preventDefault();\n e.stopPropagation();\n return e.stopImmediatePropagation();\n };\n\n Rails.delegate = function(element, selector, eventType, handler) {\n return element.addEventListener(eventType, function(e) {\n var target;\n target = e.target;\n while (!(!(target instanceof Element) || matches(target, selector))) {\n target = target.parentNode;\n }\n if (target instanceof Element && handler.call(target, e) === false) {\n e.preventDefault();\n return e.stopPropagation();\n }\n });\n };\n\n }).call(this);\n (function() {\n var AcceptHeaders, CSRFProtection, createXHR, cspNonce, fire, prepareOptions, processResponse;\n\n cspNonce = Rails.cspNonce, CSRFProtection = Rails.CSRFProtection, fire = Rails.fire;\n\n AcceptHeaders = {\n '*': '*/*',\n text: 'text/plain',\n html: 'text/html',\n xml: 'application/xml, text/xml',\n json: 'application/json, text/javascript',\n script: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript'\n };\n\n Rails.ajax = function(options) {\n var xhr;\n options = prepareOptions(options);\n xhr = createXHR(options, function() {\n var ref, response;\n response = processResponse((ref = xhr.response) != null ? ref : xhr.responseText, xhr.getResponseHeader('Content-Type'));\n if (Math.floor(xhr.status / 100) === 2) {\n if (typeof options.success === \"function\") {\n options.success(response, xhr.statusText, xhr);\n }\n } else {\n if (typeof options.error === \"function\") {\n options.error(response, xhr.statusText, xhr);\n }\n }\n return typeof options.complete === \"function\" ? options.complete(xhr, xhr.statusText) : void 0;\n });\n if ((options.beforeSend != null) && !options.beforeSend(xhr, options)) {\n return false;\n }\n if (xhr.readyState === XMLHttpRequest.OPENED) {\n return xhr.send(options.data);\n }\n };\n\n prepareOptions = function(options) {\n options.url = options.url || location.href;\n options.type = options.type.toUpperCase();\n if (options.type === 'GET' && options.data) {\n if (options.url.indexOf('?') < 0) {\n options.url += '?' + options.data;\n } else {\n options.url += '&' + options.data;\n }\n }\n if (AcceptHeaders[options.dataType] == null) {\n options.dataType = '*';\n }\n options.accept = AcceptHeaders[options.dataType];\n if (options.dataType !== '*') {\n options.accept += ', */*; q=0.01';\n }\n return options;\n };\n\n createXHR = function(options, done) {\n var xhr;\n xhr = new XMLHttpRequest();\n xhr.open(options.type, options.url, true);\n xhr.setRequestHeader('Accept', options.accept);\n if (typeof options.data === 'string') {\n xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');\n }\n if (!options.crossDomain) {\n xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n CSRFProtection(xhr);\n }\n xhr.withCredentials = !!options.withCredentials;\n xhr.onreadystatechange = function() {\n if (xhr.readyState === XMLHttpRequest.DONE) {\n return done(xhr);\n }\n };\n return xhr;\n };\n\n processResponse = function(response, type) {\n var parser, script;\n if (typeof response === 'string' && typeof type === 'string') {\n if (type.match(/\\bjson\\b/)) {\n try {\n response = JSON.parse(response);\n } catch (error) {}\n } else if (type.match(/\\b(?:java|ecma)script\\b/)) {\n script = document.createElement('script');\n script.setAttribute('nonce', cspNonce());\n script.text = response;\n document.head.appendChild(script).parentNode.removeChild(script);\n } else if (type.match(/\\b(xml|html|svg)\\b/)) {\n parser = new DOMParser();\n type = type.replace(/;.+/, '');\n try {\n response = parser.parseFromString(response, type);\n } catch (error) {}\n }\n }\n return response;\n };\n\n Rails.href = function(element) {\n return element.href;\n };\n\n Rails.isCrossDomain = function(url) {\n var e, originAnchor, urlAnchor;\n originAnchor = document.createElement('a');\n originAnchor.href = location.href;\n urlAnchor = document.createElement('a');\n try {\n urlAnchor.href = url;\n return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) || (originAnchor.protocol + '//' + originAnchor.host === urlAnchor.protocol + '//' + urlAnchor.host));\n } catch (error) {\n e = error;\n return true;\n }\n };\n\n }).call(this);\n (function() {\n var matches, toArray;\n\n matches = Rails.matches;\n\n toArray = function(e) {\n return Array.prototype.slice.call(e);\n };\n\n Rails.serializeElement = function(element, additionalParam) {\n var inputs, params;\n inputs = [element];\n if (matches(element, 'form')) {\n inputs = toArray(element.elements);\n }\n params = [];\n inputs.forEach(function(input) {\n if (!input.name || input.disabled) {\n return;\n }\n if (matches(input, 'select')) {\n return toArray(input.options).forEach(function(option) {\n if (option.selected) {\n return params.push({\n name: input.name,\n value: option.value\n });\n }\n });\n } else if (input.checked || ['radio', 'checkbox', 'submit'].indexOf(input.type) === -1) {\n return params.push({\n name: input.name,\n value: input.value\n });\n }\n });\n if (additionalParam) {\n params.push(additionalParam);\n }\n return params.map(function(param) {\n if (param.name != null) {\n return (encodeURIComponent(param.name)) + \"=\" + (encodeURIComponent(param.value));\n } else {\n return param;\n }\n }).join('&');\n };\n\n Rails.formElements = function(form, selector) {\n if (matches(form, 'form')) {\n return toArray(form.elements).filter(function(el) {\n return matches(el, selector);\n });\n } else {\n return toArray(form.querySelectorAll(selector));\n }\n };\n\n }).call(this);\n (function() {\n var allowAction, fire, stopEverything;\n\n fire = Rails.fire, stopEverything = Rails.stopEverything;\n\n Rails.handleConfirm = function(e) {\n if (!allowAction(this)) {\n return stopEverything(e);\n }\n };\n\n allowAction = function(element) {\n var answer, callback, message;\n message = element.getAttribute('data-confirm');\n if (!message) {\n return true;\n }\n answer = false;\n if (fire(element, 'confirm')) {\n try {\n answer = confirm(message);\n } catch (error) {}\n callback = fire(element, 'confirm:complete', [answer]);\n }\n return answer && callback;\n };\n\n }).call(this);\n (function() {\n var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, matches, setData, stopEverything;\n\n matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements;\n\n Rails.handleDisabledElement = function(e) {\n var element;\n element = this;\n if (element.disabled) {\n return stopEverything(e);\n }\n };\n\n Rails.enableElement = function(e) {\n var element;\n element = e instanceof Event ? e.target : e;\n if (matches(element, Rails.linkDisableSelector)) {\n return enableLinkElement(element);\n } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formEnableSelector)) {\n return enableFormElement(element);\n } else if (matches(element, Rails.formSubmitSelector)) {\n return enableFormElements(element);\n }\n };\n\n Rails.disableElement = function(e) {\n var element;\n element = e instanceof Event ? e.target : e;\n if (matches(element, Rails.linkDisableSelector)) {\n return disableLinkElement(element);\n } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formDisableSelector)) {\n return disableFormElement(element);\n } else if (matches(element, Rails.formSubmitSelector)) {\n return disableFormElements(element);\n }\n };\n\n disableLinkElement = function(element) {\n var replacement;\n replacement = element.getAttribute('data-disable-with');\n if (replacement != null) {\n setData(element, 'ujs:enable-with', element.innerHTML);\n element.innerHTML = replacement;\n }\n element.addEventListener('click', stopEverything);\n return setData(element, 'ujs:disabled', true);\n };\n\n enableLinkElement = function(element) {\n var originalText;\n originalText = getData(element, 'ujs:enable-with');\n if (originalText != null) {\n element.innerHTML = originalText;\n setData(element, 'ujs:enable-with', null);\n }\n element.removeEventListener('click', stopEverything);\n return setData(element, 'ujs:disabled', null);\n };\n\n disableFormElements = function(form) {\n return formElements(form, Rails.formDisableSelector).forEach(disableFormElement);\n };\n\n disableFormElement = function(element) {\n var replacement;\n replacement = element.getAttribute('data-disable-with');\n if (replacement != null) {\n if (matches(element, 'button')) {\n setData(element, 'ujs:enable-with', element.innerHTML);\n element.innerHTML = replacement;\n } else {\n setData(element, 'ujs:enable-with', element.value);\n element.value = replacement;\n }\n }\n element.disabled = true;\n return setData(element, 'ujs:disabled', true);\n };\n\n enableFormElements = function(form) {\n return formElements(form, Rails.formEnableSelector).forEach(enableFormElement);\n };\n\n enableFormElement = function(element) {\n var originalText;\n originalText = getData(element, 'ujs:enable-with');\n if (originalText != null) {\n if (matches(element, 'button')) {\n element.innerHTML = originalText;\n } else {\n element.value = originalText;\n }\n setData(element, 'ujs:enable-with', null);\n }\n element.disabled = false;\n return setData(element, 'ujs:disabled', null);\n };\n\n }).call(this);\n (function() {\n var stopEverything;\n\n stopEverything = Rails.stopEverything;\n\n Rails.handleMethod = function(e) {\n var csrfParam, csrfToken, form, formContent, href, link, method;\n link = this;\n method = link.getAttribute('data-method');\n if (!method) {\n return;\n }\n href = Rails.href(link);\n csrfToken = Rails.csrfToken();\n csrfParam = Rails.csrfParam();\n form = document.createElement('form');\n formContent = \"\";\n if ((csrfParam != null) && (csrfToken != null) && !Rails.isCrossDomain(href)) {\n formContent += \"\";\n }\n formContent += '';\n form.method = 'post';\n form.action = href;\n form.target = link.target;\n form.innerHTML = formContent;\n form.style.display = 'none';\n document.body.appendChild(form);\n form.querySelector('[type=\"submit\"]').click();\n return stopEverything(e);\n };\n\n }).call(this);\n (function() {\n var ajax, fire, getData, isCrossDomain, isRemote, matches, serializeElement, setData, stopEverything,\n slice = [].slice;\n\n matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, fire = Rails.fire, stopEverything = Rails.stopEverything, ajax = Rails.ajax, isCrossDomain = Rails.isCrossDomain, serializeElement = Rails.serializeElement;\n\n isRemote = function(element) {\n var value;\n value = element.getAttribute('data-remote');\n return (value != null) && value !== 'false';\n };\n\n Rails.handleRemote = function(e) {\n var button, data, dataType, element, method, url, withCredentials;\n element = this;\n if (!isRemote(element)) {\n return true;\n }\n if (!fire(element, 'ajax:before')) {\n fire(element, 'ajax:stopped');\n return false;\n }\n withCredentials = element.getAttribute('data-with-credentials');\n dataType = element.getAttribute('data-type') || 'script';\n if (matches(element, Rails.formSubmitSelector)) {\n button = getData(element, 'ujs:submit-button');\n method = getData(element, 'ujs:submit-button-formmethod') || element.method;\n url = getData(element, 'ujs:submit-button-formaction') || element.getAttribute('action') || location.href;\n if (method.toUpperCase() === 'GET') {\n url = url.replace(/\\?.*$/, '');\n }\n if (element.enctype === 'multipart/form-data') {\n data = new FormData(element);\n if (button != null) {\n data.append(button.name, button.value);\n }\n } else {\n data = serializeElement(element, button);\n }\n setData(element, 'ujs:submit-button', null);\n setData(element, 'ujs:submit-button-formmethod', null);\n setData(element, 'ujs:submit-button-formaction', null);\n } else if (matches(element, Rails.buttonClickSelector) || matches(element, Rails.inputChangeSelector)) {\n method = element.getAttribute('data-method');\n url = element.getAttribute('data-url');\n data = serializeElement(element, element.getAttribute('data-params'));\n } else {\n method = element.getAttribute('data-method');\n url = Rails.href(element);\n data = element.getAttribute('data-params');\n }\n ajax({\n type: method || 'GET',\n url: url,\n data: data,\n dataType: dataType,\n beforeSend: function(xhr, options) {\n if (fire(element, 'ajax:beforeSend', [xhr, options])) {\n return fire(element, 'ajax:send', [xhr]);\n } else {\n fire(element, 'ajax:stopped');\n return false;\n }\n },\n success: function() {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:success', args);\n },\n error: function() {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:error', args);\n },\n complete: function() {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:complete', args);\n },\n crossDomain: isCrossDomain(url),\n withCredentials: (withCredentials != null) && withCredentials !== 'false'\n });\n return stopEverything(e);\n };\n\n Rails.formSubmitButtonClick = function(e) {\n var button, form;\n button = this;\n form = button.form;\n if (!form) {\n return;\n }\n if (button.name) {\n setData(form, 'ujs:submit-button', {\n name: button.name,\n value: button.value\n });\n }\n setData(form, 'ujs:formnovalidate-button', button.formNoValidate);\n setData(form, 'ujs:submit-button-formaction', button.getAttribute('formaction'));\n return setData(form, 'ujs:submit-button-formmethod', button.getAttribute('formmethod'));\n };\n\n Rails.preventInsignificantClick = function(e) {\n var data, insignificantMetaClick, link, metaClick, method, nonPrimaryMouseClick;\n link = this;\n method = (link.getAttribute('data-method') || 'GET').toUpperCase();\n data = link.getAttribute('data-params');\n metaClick = e.metaKey || e.ctrlKey;\n insignificantMetaClick = metaClick && method === 'GET' && !data;\n nonPrimaryMouseClick = (e.button != null) && e.button !== 0;\n if (nonPrimaryMouseClick || insignificantMetaClick) {\n return e.stopImmediatePropagation();\n }\n };\n\n }).call(this);\n (function() {\n var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, loadCSPNonce, preventInsignificantClick, refreshCSRFTokens;\n\n fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, loadCSPNonce = Rails.loadCSPNonce, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, preventInsignificantClick = Rails.preventInsignificantClick, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMethod = Rails.handleMethod;\n\n if ((typeof jQuery !== \"undefined\" && jQuery !== null) && (jQuery.ajax != null)) {\n if (jQuery.rails) {\n throw new Error('If you load both jquery_ujs and rails-ujs, use rails-ujs only.');\n }\n jQuery.rails = Rails;\n jQuery.ajaxPrefilter(function(options, originalOptions, xhr) {\n if (!options.crossDomain) {\n return CSRFProtection(xhr);\n }\n });\n }\n\n Rails.start = function() {\n if (window._rails_loaded) {\n throw new Error('rails-ujs has already been loaded!');\n }\n window.addEventListener('pageshow', function() {\n $(Rails.formEnableSelector).forEach(function(el) {\n if (getData(el, 'ujs:disabled')) {\n return enableElement(el);\n }\n });\n return $(Rails.linkDisableSelector).forEach(function(el) {\n if (getData(el, 'ujs:disabled')) {\n return enableElement(el);\n }\n });\n });\n delegate(document, Rails.linkDisableSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.linkDisableSelector, 'ajax:stopped', enableElement);\n delegate(document, Rails.buttonDisableSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement);\n delegate(document, Rails.linkClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.linkClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.linkClickSelector, 'click', handleConfirm);\n delegate(document, Rails.linkClickSelector, 'click', disableElement);\n delegate(document, Rails.linkClickSelector, 'click', handleRemote);\n delegate(document, Rails.linkClickSelector, 'click', handleMethod);\n delegate(document, Rails.buttonClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.buttonClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.buttonClickSelector, 'click', handleConfirm);\n delegate(document, Rails.buttonClickSelector, 'click', disableElement);\n delegate(document, Rails.buttonClickSelector, 'click', handleRemote);\n delegate(document, Rails.inputChangeSelector, 'change', handleDisabledElement);\n delegate(document, Rails.inputChangeSelector, 'change', handleConfirm);\n delegate(document, Rails.inputChangeSelector, 'change', handleRemote);\n delegate(document, Rails.formSubmitSelector, 'submit', handleDisabledElement);\n delegate(document, Rails.formSubmitSelector, 'submit', handleConfirm);\n delegate(document, Rails.formSubmitSelector, 'submit', handleRemote);\n delegate(document, Rails.formSubmitSelector, 'submit', function(e) {\n return setTimeout((function() {\n return disableElement(e);\n }), 13);\n });\n delegate(document, Rails.formSubmitSelector, 'ajax:send', disableElement);\n delegate(document, Rails.formSubmitSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.formInputClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.formInputClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);\n delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);\n document.addEventListener('DOMContentLoaded', refreshCSRFTokens);\n document.addEventListener('DOMContentLoaded', loadCSPNonce);\n return window._rails_loaded = true;\n };\n\n if (window.Rails === Rails && fire(document, 'rails:attachBindings')) {\n Rails.start();\n }\n\n }).call(this);\n }).call(this);\n\n if (typeof module === \"object\" && module.exports) {\n module.exports = Rails;\n } else if (typeof define === \"function\" && define.amd) {\n define(Rails);\n }\n}).call(this);\n", "export default {\n logger: typeof console !== \"undefined\" ? console : undefined,\n WebSocket: typeof WebSocket !== \"undefined\" ? WebSocket : undefined,\n}\n", "import adapters from \"./adapters\"\n\n// The logger is disabled by default. You can enable it with:\n//\n// ActionCable.logger.enabled = true\n//\n// Example:\n//\n// import * as ActionCable from '@rails/actioncable'\n//\n// ActionCable.logger.enabled = true\n// ActionCable.logger.log('Connection Established.')\n//\n\nexport default {\n log(...messages) {\n if (this.enabled) {\n messages.push(Date.now())\n adapters.logger.log(\"[ActionCable]\", ...messages)\n }\n },\n}\n", "import logger from \"./logger\"\n\n// Responsible for ensuring the cable connection is in good health by validating the heartbeat pings sent from the server, and attempting\n// revival reconnections if things go astray. Internal class, not intended for direct user manipulation.\n\nconst now = () => new Date().getTime()\n\nconst secondsSince = time => (now() - time) / 1000\n\nclass ConnectionMonitor {\n constructor(connection) {\n this.visibilityDidChange = this.visibilityDidChange.bind(this)\n this.connection = connection\n this.reconnectAttempts = 0\n }\n\n start() {\n if (!this.isRunning()) {\n this.startedAt = now()\n delete this.stoppedAt\n this.startPolling()\n addEventListener(\"visibilitychange\", this.visibilityDidChange)\n logger.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`)\n }\n }\n\n stop() {\n if (this.isRunning()) {\n this.stoppedAt = now()\n this.stopPolling()\n removeEventListener(\"visibilitychange\", this.visibilityDidChange)\n logger.log(\"ConnectionMonitor stopped\")\n }\n }\n\n isRunning() {\n return this.startedAt && !this.stoppedAt\n }\n\n recordMessage() {\n this.pingedAt = now()\n }\n\n recordConnect() {\n this.reconnectAttempts = 0\n delete this.disconnectedAt\n logger.log(\"ConnectionMonitor recorded connect\")\n }\n\n recordDisconnect() {\n this.disconnectedAt = now()\n logger.log(\"ConnectionMonitor recorded disconnect\")\n }\n\n // Private\n\n startPolling() {\n this.stopPolling()\n this.poll()\n }\n\n stopPolling() {\n clearTimeout(this.pollTimeout)\n }\n\n poll() {\n this.pollTimeout = setTimeout(() => {\n this.reconnectIfStale()\n this.poll()\n }\n , this.getPollInterval())\n }\n\n getPollInterval() {\n const { staleThreshold, reconnectionBackoffRate } = this.constructor\n const backoff = Math.pow(1 + reconnectionBackoffRate, Math.min(this.reconnectAttempts, 10))\n const jitterMax = this.reconnectAttempts === 0 ? 1.0 : reconnectionBackoffRate\n const jitter = jitterMax * Math.random()\n return staleThreshold * 1000 * backoff * (1 + jitter)\n }\n\n reconnectIfStale() {\n if (this.connectionIsStale()) {\n logger.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${secondsSince(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`)\n this.reconnectAttempts++\n if (this.disconnectedRecently()) {\n logger.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${secondsSince(this.disconnectedAt)} s`)\n } else {\n logger.log(\"ConnectionMonitor reopening\")\n this.connection.reopen()\n }\n }\n }\n\n get refreshedAt() {\n return this.pingedAt ? this.pingedAt : this.startedAt\n }\n\n connectionIsStale() {\n return secondsSince(this.refreshedAt) > this.constructor.staleThreshold\n }\n\n disconnectedRecently() {\n return this.disconnectedAt && (secondsSince(this.disconnectedAt) < this.constructor.staleThreshold)\n }\n\n visibilityDidChange() {\n if (document.visibilityState === \"visible\") {\n setTimeout(() => {\n if (this.connectionIsStale() || !this.connection.isOpen()) {\n logger.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`)\n this.connection.reopen()\n }\n }\n , 200)\n }\n }\n\n}\n\nConnectionMonitor.staleThreshold = 6 // Server::Connections::BEAT_INTERVAL * 2 (missed two pings)\nConnectionMonitor.reconnectionBackoffRate = 0.15\n\nexport default ConnectionMonitor\n", "export default {\n \"message_types\": {\n \"welcome\": \"welcome\",\n \"disconnect\": \"disconnect\",\n \"ping\": \"ping\",\n \"confirmation\": \"confirm_subscription\",\n \"rejection\": \"reject_subscription\"\n },\n \"disconnect_reasons\": {\n \"unauthorized\": \"unauthorized\",\n \"invalid_request\": \"invalid_request\",\n \"server_restart\": \"server_restart\",\n \"remote\": \"remote\"\n },\n \"default_mount_path\": \"/cable\",\n \"protocols\": [\n \"actioncable-v1-json\",\n \"actioncable-unsupported\"\n ]\n}\n", "import adapters from \"./adapters\"\nimport ConnectionMonitor from \"./connection_monitor\"\nimport INTERNAL from \"./internal\"\nimport logger from \"./logger\"\n\n// Encapsulate the cable connection held by the consumer. This is an internal class not intended for direct user manipulation.\n\nconst {message_types, protocols} = INTERNAL\nconst supportedProtocols = protocols.slice(0, protocols.length - 1)\n\nconst indexOf = [].indexOf\n\nclass Connection {\n constructor(consumer) {\n this.open = this.open.bind(this)\n this.consumer = consumer\n this.subscriptions = this.consumer.subscriptions\n this.monitor = new ConnectionMonitor(this)\n this.disconnected = true\n }\n\n send(data) {\n if (this.isOpen()) {\n this.webSocket.send(JSON.stringify(data))\n return true\n } else {\n return false\n }\n }\n\n open() {\n if (this.isActive()) {\n logger.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`)\n return false\n } else {\n const socketProtocols = [...protocols, ...this.consumer.subprotocols || []]\n logger.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${socketProtocols}`)\n if (this.webSocket) { this.uninstallEventHandlers() }\n this.webSocket = new adapters.WebSocket(this.consumer.url, socketProtocols)\n this.installEventHandlers()\n this.monitor.start()\n return true\n }\n }\n\n close({allowReconnect} = {allowReconnect: true}) {\n if (!allowReconnect) { this.monitor.stop() }\n // Avoid closing websockets in a \"connecting\" state due to Safari 15.1+ bug. See: https://github.com/rails/rails/issues/43835#issuecomment-1002288478\n if (this.isOpen()) {\n return this.webSocket.close()\n }\n }\n\n reopen() {\n logger.log(`Reopening WebSocket, current state is ${this.getState()}`)\n if (this.isActive()) {\n try {\n return this.close()\n } catch (error) {\n logger.log(\"Failed to reopen WebSocket\", error)\n }\n finally {\n logger.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`)\n setTimeout(this.open, this.constructor.reopenDelay)\n }\n } else {\n return this.open()\n }\n }\n\n getProtocol() {\n if (this.webSocket) {\n return this.webSocket.protocol\n }\n }\n\n isOpen() {\n return this.isState(\"open\")\n }\n\n isActive() {\n return this.isState(\"open\", \"connecting\")\n }\n\n triedToReconnect() {\n return this.monitor.reconnectAttempts > 0\n }\n\n // Private\n\n isProtocolSupported() {\n return indexOf.call(supportedProtocols, this.getProtocol()) >= 0\n }\n\n isState(...states) {\n return indexOf.call(states, this.getState()) >= 0\n }\n\n getState() {\n if (this.webSocket) {\n for (let state in adapters.WebSocket) {\n if (adapters.WebSocket[state] === this.webSocket.readyState) {\n return state.toLowerCase()\n }\n }\n }\n return null\n }\n\n installEventHandlers() {\n for (let eventName in this.events) {\n const handler = this.events[eventName].bind(this)\n this.webSocket[`on${eventName}`] = handler\n }\n }\n\n uninstallEventHandlers() {\n for (let eventName in this.events) {\n this.webSocket[`on${eventName}`] = function() {}\n }\n }\n\n}\n\nConnection.reopenDelay = 500\n\nConnection.prototype.events = {\n message(event) {\n if (!this.isProtocolSupported()) { return }\n const {identifier, message, reason, reconnect, type} = JSON.parse(event.data)\n this.monitor.recordMessage()\n switch (type) {\n case message_types.welcome:\n if (this.triedToReconnect()) {\n this.reconnectAttempted = true\n }\n this.monitor.recordConnect()\n return this.subscriptions.reload()\n case message_types.disconnect:\n logger.log(`Disconnecting. Reason: ${reason}`)\n return this.close({allowReconnect: reconnect})\n case message_types.ping:\n return null\n case message_types.confirmation:\n this.subscriptions.confirmSubscription(identifier)\n if (this.reconnectAttempted) {\n this.reconnectAttempted = false\n return this.subscriptions.notify(identifier, \"connected\", {reconnected: true})\n } else {\n return this.subscriptions.notify(identifier, \"connected\", {reconnected: false})\n }\n case message_types.rejection:\n return this.subscriptions.reject(identifier)\n default:\n return this.subscriptions.notify(identifier, \"received\", message)\n }\n },\n\n open() {\n logger.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`)\n this.disconnected = false\n if (!this.isProtocolSupported()) {\n logger.log(\"Protocol is unsupported. Stopping monitor and disconnecting.\")\n return this.close({allowReconnect: false})\n }\n },\n\n close(event) {\n logger.log(\"WebSocket onclose event\")\n if (this.disconnected) { return }\n this.disconnected = true\n this.monitor.recordDisconnect()\n return this.subscriptions.notifyAll(\"disconnected\", {willAttemptReconnect: this.monitor.isRunning()})\n },\n\n error() {\n logger.log(\"WebSocket onerror event\")\n }\n}\n\nexport default Connection\n", "// A new subscription is created through the ActionCable.Subscriptions instance available on the consumer.\n// It provides a number of callbacks and a method for calling remote procedure calls on the corresponding\n// Channel instance on the server side.\n//\n// An example demonstrates the basic functionality:\n//\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\", {\n// connected() {\n// // Called once the subscription has been successfully completed\n// },\n//\n// disconnected({ willAttemptReconnect: boolean }) {\n// // Called when the client has disconnected with the server.\n// // The object will have an `willAttemptReconnect` property which\n// // says whether the client has the intention of attempting\n// // to reconnect.\n// },\n//\n// appear() {\n// this.perform('appear', {appearing_on: this.appearingOn()})\n// },\n//\n// away() {\n// this.perform('away')\n// },\n//\n// appearingOn() {\n// $('main').data('appearing-on')\n// }\n// })\n//\n// The methods #appear and #away forward their intent to the remote AppearanceChannel instance on the server\n// by calling the `perform` method with the first parameter being the action (which maps to AppearanceChannel#appear/away).\n// The second parameter is a hash that'll get JSON encoded and made available on the server in the data parameter.\n//\n// This is how the server component would look:\n//\n// class AppearanceChannel < ApplicationActionCable::Channel\n// def subscribed\n// current_user.appear\n// end\n//\n// def unsubscribed\n// current_user.disappear\n// end\n//\n// def appear(data)\n// current_user.appear on: data['appearing_on']\n// end\n//\n// def away\n// current_user.away\n// end\n// end\n//\n// The \"AppearanceChannel\" name is automatically mapped between the client-side subscription creation and the server-side Ruby class name.\n// The AppearanceChannel#appear/away public methods are exposed automatically to client-side invocation through the perform method.\n\nconst extend = function(object, properties) {\n if (properties != null) {\n for (let key in properties) {\n const value = properties[key]\n object[key] = value\n }\n }\n return object\n}\n\nexport default class Subscription {\n constructor(consumer, params = {}, mixin) {\n this.consumer = consumer\n this.identifier = JSON.stringify(params)\n extend(this, mixin)\n }\n\n // Perform a channel action with the optional data passed as an attribute\n perform(action, data = {}) {\n data.action = action\n return this.send(data)\n }\n\n send(data) {\n return this.consumer.send({command: \"message\", identifier: this.identifier, data: JSON.stringify(data)})\n }\n\n unsubscribe() {\n return this.consumer.subscriptions.remove(this)\n }\n}\n", "import logger from \"./logger\"\n\n// Responsible for ensuring channel subscribe command is confirmed, retrying until confirmation is received.\n// Internal class, not intended for direct user manipulation.\n\nclass SubscriptionGuarantor {\n constructor(subscriptions) {\n this.subscriptions = subscriptions\n this.pendingSubscriptions = []\n }\n\n guarantee(subscription) {\n if(this.pendingSubscriptions.indexOf(subscription) == -1){ \n logger.log(`SubscriptionGuarantor guaranteeing ${subscription.identifier}`)\n this.pendingSubscriptions.push(subscription) \n }\n else {\n logger.log(`SubscriptionGuarantor already guaranteeing ${subscription.identifier}`)\n }\n this.startGuaranteeing()\n }\n\n forget(subscription) {\n logger.log(`SubscriptionGuarantor forgetting ${subscription.identifier}`)\n this.pendingSubscriptions = (this.pendingSubscriptions.filter((s) => s !== subscription))\n }\n\n startGuaranteeing() {\n this.stopGuaranteeing()\n this.retrySubscribing()\n }\n \n stopGuaranteeing() {\n clearTimeout(this.retryTimeout)\n }\n\n retrySubscribing() {\n this.retryTimeout = setTimeout(() => {\n if (this.subscriptions && typeof(this.subscriptions.subscribe) === \"function\") {\n this.pendingSubscriptions.map((subscription) => {\n logger.log(`SubscriptionGuarantor resubscribing ${subscription.identifier}`)\n this.subscriptions.subscribe(subscription)\n })\n }\n }\n , 500)\n }\n}\n\nexport default SubscriptionGuarantor", "import Subscription from \"./subscription\"\nimport SubscriptionGuarantor from \"./subscription_guarantor\"\nimport logger from \"./logger\"\n\n// Collection class for creating (and internally managing) channel subscriptions.\n// The only method intended to be triggered by the user is ActionCable.Subscriptions#create,\n// and it should be called through the consumer like so:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n\nexport default class Subscriptions {\n constructor(consumer) {\n this.consumer = consumer\n this.guarantor = new SubscriptionGuarantor(this)\n this.subscriptions = []\n }\n\n create(channelName, mixin) {\n const channel = channelName\n const params = typeof channel === \"object\" ? channel : {channel}\n const subscription = new Subscription(this.consumer, params, mixin)\n return this.add(subscription)\n }\n\n // Private\n\n add(subscription) {\n this.subscriptions.push(subscription)\n this.consumer.ensureActiveConnection()\n this.notify(subscription, \"initialized\")\n this.subscribe(subscription)\n return subscription\n }\n\n remove(subscription) {\n this.forget(subscription)\n if (!this.findAll(subscription.identifier).length) {\n this.sendCommand(subscription, \"unsubscribe\")\n }\n return subscription\n }\n\n reject(identifier) {\n return this.findAll(identifier).map((subscription) => {\n this.forget(subscription)\n this.notify(subscription, \"rejected\")\n return subscription\n })\n }\n\n forget(subscription) {\n this.guarantor.forget(subscription)\n this.subscriptions = (this.subscriptions.filter((s) => s !== subscription))\n return subscription\n }\n\n findAll(identifier) {\n return this.subscriptions.filter((s) => s.identifier === identifier)\n }\n\n reload() {\n return this.subscriptions.map((subscription) =>\n this.subscribe(subscription))\n }\n\n notifyAll(callbackName, ...args) {\n return this.subscriptions.map((subscription) =>\n this.notify(subscription, callbackName, ...args))\n }\n\n notify(subscription, callbackName, ...args) {\n let subscriptions\n if (typeof subscription === \"string\") {\n subscriptions = this.findAll(subscription)\n } else {\n subscriptions = [subscription]\n }\n\n return subscriptions.map((subscription) =>\n (typeof subscription[callbackName] === \"function\" ? subscription[callbackName](...args) : undefined))\n }\n\n subscribe(subscription) {\n if (this.sendCommand(subscription, \"subscribe\")) {\n this.guarantor.guarantee(subscription)\n }\n }\n\n confirmSubscription(identifier) {\n logger.log(`Subscription confirmed ${identifier}`)\n this.findAll(identifier).map((subscription) =>\n this.guarantor.forget(subscription))\n }\n\n sendCommand(subscription, command) {\n const {identifier} = subscription\n return this.consumer.send({command, identifier})\n }\n}\n", "import Connection from \"./connection\"\nimport Subscriptions from \"./subscriptions\"\n\n// The ActionCable.Consumer establishes the connection to a server-side Ruby Connection object. Once established,\n// the ActionCable.ConnectionMonitor will ensure that its properly maintained through heartbeats and checking for stale updates.\n// The Consumer instance is also the gateway to establishing subscriptions to desired channels through the #createSubscription\n// method.\n//\n// The following example shows how this can be set up:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n//\n// When a consumer is created, it automatically connects with the server.\n//\n// To disconnect from the server, call\n//\n// App.cable.disconnect()\n//\n// and to restart the connection:\n//\n// App.cable.connect()\n//\n// Any channel subscriptions which existed prior to disconnecting will\n// automatically resubscribe.\n\nexport default class Consumer {\n constructor(url) {\n this._url = url\n this.subscriptions = new Subscriptions(this)\n this.connection = new Connection(this)\n this.subprotocols = []\n }\n\n get url() {\n return createWebSocketURL(this._url)\n }\n\n send(data) {\n return this.connection.send(data)\n }\n\n connect() {\n return this.connection.open()\n }\n\n disconnect() {\n return this.connection.close({allowReconnect: false})\n }\n\n ensureActiveConnection() {\n if (!this.connection.isActive()) {\n return this.connection.open()\n }\n }\n\n addSubProtocol(subprotocol) {\n this.subprotocols = [...this.subprotocols, subprotocol]\n }\n}\n\nexport function createWebSocketURL(url) {\n if (typeof url === \"function\") {\n url = url()\n }\n\n if (url && !/^wss?:/i.test(url)) {\n const a = document.createElement(\"a\")\n a.href = url\n // Fix populating Location properties in IE. Otherwise, protocol will be blank.\n a.href = a.href\n a.protocol = a.protocol.replace(\"http\", \"ws\")\n return a.href\n } else {\n return url\n }\n}\n", "import Connection from \"./connection\"\nimport ConnectionMonitor from \"./connection_monitor\"\nimport Consumer, { createWebSocketURL } from \"./consumer\"\nimport INTERNAL from \"./internal\"\nimport Subscription from \"./subscription\"\nimport Subscriptions from \"./subscriptions\"\nimport SubscriptionGuarantor from \"./subscription_guarantor\"\nimport adapters from \"./adapters\"\nimport logger from \"./logger\"\n\nexport {\n Connection,\n ConnectionMonitor,\n Consumer,\n INTERNAL,\n Subscription,\n Subscriptions,\n SubscriptionGuarantor,\n adapters,\n createWebSocketURL,\n logger,\n}\n\nexport function createConsumer(url = getConfig(\"url\") || INTERNAL.default_mount_path) {\n return new Consumer(url)\n}\n\nexport function getConfig(name) {\n const element = document.head.querySelector(`meta[name='action-cable-${name}']`)\n if (element) {\n return element.getAttribute(\"content\")\n }\n}\n", "!/**\n * Highcharts JS v12.1.2 (2024-12-21)\n * @module highcharts/highcharts\n *\n * (c) 2009-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n */function(t,e){\"object\"==typeof exports&&\"object\"==typeof module?(t._Highcharts=e(),module.exports=t._Highcharts):\"function\"==typeof define&&define.amd?define(\"highcharts/highcharts\",[],e):\"object\"==typeof exports?(t._Highcharts=e(),exports.highcharts=t._Highcharts):(t.Highcharts&&t.Highcharts.error(16,!0),t.Highcharts=e())}(\"undefined\"==typeof window?this:window,()=>(()=>{\"use strict\";let t,e;var i,s,o,r,a,n,h,l,d,c,p,g,u,f,m,x,y,b={};b.d=(t,e)=>{for(var i in e)b.o(e,i)&&!b.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},b.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var v={};b.d(v,{default:()=>lb}),function(t){t.SVG_NS=\"http://www.w3.org/2000/svg\",t.product=\"Highcharts\",t.version=\"12.1.2\",t.win=\"undefined\"!=typeof window?window:{},t.doc=t.win.document,t.svg=t.doc&&t.doc.createElementNS&&!!t.doc.createElementNS(t.SVG_NS,\"svg\").createSVGRect,t.pageLang=t.doc?.documentElement?.closest(\"[lang]\")?.lang,t.userAgent=t.win.navigator&&t.win.navigator.userAgent||\"\",t.isChrome=t.win.chrome,t.isFirefox=-1!==t.userAgent.indexOf(\"Firefox\"),t.isMS=/(edge|msie|trident)/i.test(t.userAgent)&&!t.win.opera,t.isSafari=!t.isChrome&&-1!==t.userAgent.indexOf(\"Safari\"),t.isTouchDevice=/(Mobile|Android|Windows Phone)/.test(t.userAgent),t.isWebKit=-1!==t.userAgent.indexOf(\"AppleWebKit\"),t.deg2rad=2*Math.PI/360,t.marginNames=[\"plotTop\",\"marginRight\",\"marginBottom\",\"plotLeft\"],t.noop=function(){},t.supportsPassiveEvents=function(){let e=!1;if(!t.isMS){let i=Object.defineProperty({},\"passive\",{get:function(){e=!0}});t.win.addEventListener&&t.win.removeEventListener&&(t.win.addEventListener(\"testPassive\",t.noop,i),t.win.removeEventListener(\"testPassive\",t.noop,i))}return e}(),t.charts=[],t.composed=[],t.dateFormats={},t.seriesTypes={},t.symbolSizes={},t.chartCount=0}(i||(i={}));let k=i,{charts:w,doc:M,win:S}=k;function T(t,e,i,s){let o=e?\"Highcharts error\":\"Highcharts warning\";32===t&&(t=`${o}: Deprecated member`);let r=I(t),a=r?`${o} #${t}: www.highcharts.com/errors/${t}/`:t.toString();if(void 0!==s){let t=\"\";r&&(a+=\"?\"),G(s,function(e,i){t+=`\n - ${i}: ${e}`,r&&(a+=encodeURI(i)+\"=\"+encodeURI(e))}),a+=t}j(k,\"displayError\",{chart:i,code:t,message:a,params:s},function(){if(e)throw Error(a);S.console&&-1===T.messages.indexOf(a)&&console.warn(a)}),T.messages.push(a)}function C(t,e){return parseInt(t,e||10)}function A(t){return\"string\"==typeof t}function P(t){let e=Object.prototype.toString.call(t);return\"[object Array]\"===e||\"[object Array Iterator]\"===e}function L(t,e){return!!t&&\"object\"==typeof t&&(!e||!P(t))}function O(t){return L(t)&&\"number\"==typeof t.nodeType}function E(t){let e=t&&t.constructor;return!!(L(t,!0)&&!O(t)&&e&&e.name&&\"Object\"!==e.name)}function I(t){return\"number\"==typeof t&&!isNaN(t)&&t<1/0&&t>-1/0}function D(t){return null!=t}function B(t,e,i){let s;let o=A(e)&&!D(i),r=(e,i)=>{D(e)?t.setAttribute(i,e):o?(s=t.getAttribute(i))||\"class\"!==i||(s=t.getAttribute(i+\"Name\")):t.removeAttribute(i)};return A(e)?r(i,e):G(e,r),s}function N(t){return P(t)?t:[t]}function z(t,e){let i;for(i in t||(t={}),e)t[i]=e[i];return t}function R(){let t=arguments,e=t.length;for(let i=0;i1e14?t:parseFloat(t.toPrecision(e||14))}(T||(T={})).messages=[],Math.easeInOutSine=function(t){return -.5*(Math.cos(Math.PI*t)-1)};let F=Array.prototype.find?function(t,e){return t.find(e)}:function(t,e){let i;let s=t.length;for(i=0;it.order-e.order),s.forEach(e=>{!1===e.fn.call(t,i)&&i.preventDefault()})}s&&!i.defaultPrevented&&s.call(t,i)}let U=function(){let e=Math.random().toString(36).substring(2,9)+\"-\",i=0;return function(){return\"highcharts-\"+(t?\"\":e)+i++}}();S.jQuery&&(S.jQuery.fn.highcharts=function(){let t=[].slice.call(arguments);if(this[0])return t[0]?(new k[A(t[0])?t.shift():\"Chart\"](this[0],t[0],t[1]),this):w[B(this[0],\"data-highcharts-chart\")]});let $={addEvent:function(t,e,i,s={}){let o=\"function\"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(o,\"hcEvents\")||(o.hcEvents={});let r=o.hcEvents;k.Point&&t instanceof k.Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let a=t.addEventListener;a&&a.call(t,e,i,!!k.supportsPassiveEvents&&{passive:void 0===s.passive?-1!==e.indexOf(\"touch\"):s.passive,capture:!1}),r[e]||(r[e]=[]);let n={fn:i,order:\"number\"==typeof s.order?s.order:1/0};return r[e].push(n),r[e].sort((t,e)=>t.order-e.order),function(){Y(t,e,i)}},arrayMax:function(t){let e=t.length,i=t[0];for(;e--;)t[e]>i&&(i=t[e]);return i},arrayMin:function(t){let e=t.length,i=t[0];for(;e--;)t[e]e?t-1&&o[h]){i=N(i),r[h]=[];for(let e=0;e({center:.5,right:1,middle:.5,bottom:1})[t]||0,getClosestDistance:function(t,e){let i,s,o,r;let a=!e;return t.forEach(t=>{if(t.length>1)for(r=s=t.length-1;r>0;r--)(o=t[r]-t[r-1])<0&&!a?(e?.(),e=void 0):o&&(void 0===i||o=i-1&&(i=Math.floor(s)),Math.max(0,i-(t(e,\"padding-left\",!0)||0)-(t(e,\"padding-right\",!0)||0))}if(\"height\"===i)return Math.max(0,Math.min(e.offsetHeight,e.scrollHeight)-(t(e,\"padding-top\",!0)||0)-(t(e,\"padding-bottom\",!0)||0));let r=S.getComputedStyle(e,void 0);return r&&(o=r.getPropertyValue(i),R(s,\"opacity\"!==i)&&(o=C(o))),o},insertItem:function(t,e){let i;let s=t.options.index,o=e.length;for(i=t.options.isInternal?o:0;i=t))&&(o||!(n<=(e[r]+(e[r+1]||e[r]))/2)));r++);return X(a*i,-Math.round(Math.log(.001)/Math.LN10))},objectEach:G,offset:function(t){let e=M.documentElement,i=t.parentElement||t.parentNode?t.getBoundingClientRect():{top:0,left:0,width:0,height:0};return{top:i.top+(S.pageYOffset||e.scrollTop)-(e.clientTop||0),left:i.left+(S.pageXOffset||e.scrollLeft)-(e.clientLeft||0),width:i.width,height:i.height}},pad:function(t,e,i){return Array((e||2)+1-String(t).replace(\"-\",\"\").length).join(i||\"0\")+t},pick:R,pInt:C,pushUnique:function(t,e){return 0>t.indexOf(e)&&!!t.push(e)},relativeLength:function(t,e,i){return/%$/.test(t)?e*parseFloat(t)/100+(i||0):parseFloat(t)},removeEvent:Y,replaceNested:function(t,...e){let i,s;do for(s of(i=t,e))t=t.replace(s[0],s[1]);while(t!==i);return t},splat:N,stableSort:function(t,e){let i,s;let o=t.length;for(s=0;s0?setTimeout(t,e,i):(t.call(0,i),-1)},timeUnits:{millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5,month:24192e5,year:314496e5},ucfirst:function(t){return A(t)?t.substring(0,1).toUpperCase()+t.substring(1):String(t)},uniqueKey:U,useSerialIds:function(e){return t=R(e,t)},wrap:function(t,e,i){let s=t[e];t[e]=function(){let t=arguments,e=this;return i.apply(this,[function(){return s.apply(e,arguments.length?arguments:t)}].concat([].slice.call(arguments)))}}},{pageLang:V,win:_}=k,{defined:q,error:Z,extend:K,isNumber:J,isObject:Q,isString:tt,merge:te,objectEach:ti,pad:ts,splat:to,timeUnits:tr,ucfirst:ta}=$,tn=k.isSafari&&_.Intl&&!_.Intl.DateTimeFormat.prototype.formatRange,th=t=>void 0===t.main,tl=t=>[\"D\",\"L\",\"M\",\"X\",\"J\",\"V\",\"S\"].indexOf(t),td=class{constructor(t){this.options={timezone:\"UTC\"},this.variableTimezone=!1,this.Date=_.Date,this.update(t)}update(t={}){this.dTLCache={},this.options=t=te(!0,this.options,t);let{timezoneOffset:e,useUTC:i}=t;this.Date=t.Date||_.Date||Date;let s=t.timezone;q(i)&&(s=i?\"UTC\":void 0),e&&e%60==0&&(s=\"Etc/GMT\"+(e>0?\"+\":\"\")+e/60),this.variableTimezone=\"UTC\"!==s&&s?.indexOf(\"Etc/GMT\")!==0,this.timezone=s,[\"months\",\"shortMonths\",\"weekdays\",\"shortWeekdays\"].forEach(t=>{let e=/months/i.test(t),i=/short/.test(t),s={timeZone:\"UTC\"};s[e?\"month\":\"weekday\"]=i?\"short\":\"long\",this[t]=(e?[0,1,2,3,4,5,6,7,8,9,10,11]:[3,4,5,6,7,8,9]).map(t=>this.dateFormat(s,(e?31:1)*24*36e5*t))})}toParts(t){let[e,i,s,o,r,a,n]=this.dateTimeFormat({weekday:\"narrow\",day:\"numeric\",month:\"numeric\",year:\"numeric\",hour:\"numeric\",minute:\"numeric\",second:\"numeric\"},t,\"es\").split(/(?:, |\\/|:)/g);return[o,+s-1,i,r,a,n,Math.floor(Number(t)||0)%1e3,tl(e)].map(Number)}dateTimeFormat(t,e,i=this.options.locale||V){let s=JSON.stringify(t)+i;tt(t)&&(t=this.str2dtf(t));let o=this.dTLCache[s];if(!o){t.timeZone??(t.timeZone=this.timezone);try{o=new Intl.DateTimeFormat(i,t)}catch(e){/Invalid time zone/i.test(e.message)?(Z(34),t.timeZone=\"UTC\",o=new Intl.DateTimeFormat(i,t)):Z(e.message,!1)}}return this.dTLCache[s]=o,o?.format(e)||\"\"}str2dtf(t,e={}){let i={L:{fractionalSecondDigits:3},S:{second:\"2-digit\"},M:{minute:\"numeric\"},H:{hour:\"2-digit\"},k:{hour:\"numeric\"},E:{weekday:\"narrow\"},a:{weekday:\"short\"},A:{weekday:\"long\"},d:{day:\"2-digit\"},e:{day:\"numeric\"},b:{month:\"short\"},B:{month:\"long\"},m:{month:\"2-digit\"},o:{month:\"numeric\"},y:{year:\"2-digit\"},Y:{year:\"numeric\"}};return Object.keys(i).forEach(s=>{-1!==t.indexOf(s)&&K(e,i[s])}),e}makeTime(t,e,i=1,s=0,o,r,a){let n=this.Date.UTC(t,e,i,s,o||0,r||0,a||0);if(\"UTC\"!==this.timezone){let t=this.getTimezoneOffset(n);if(n+=t,-1!==[2,3,8,9,10,11].indexOf(e)&&(s<5||s>20)){let e=this.getTimezoneOffset(n);t!==e?n+=e-t:t-36e5!==this.getTimezoneOffset(n-36e5)||tn||(n-=36e5)}}return n}parse(t){if(!tt(t))return t??void 0;let e=(t=t.replace(/\\//g,\"-\").replace(/(GMT|UTC)/,\"\")).indexOf(\"Z\")>-1||/([+-][0-9]{2}):?[0-9]{2}$/.test(t),i=/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(t);e||i||(t+=\"Z\");let s=Date.parse(t);if(J(s))return s+(!e||i?this.getTimezoneOffset(s):0)}getTimezoneOffset(t){if(\"UTC\"!==this.timezone){let[e,i,s,o,r=0]=this.dateTimeFormat({timeZoneName:\"shortOffset\"},t,\"en\").split(/(GMT|:)/).map(Number),a=-(36e5*(s+r/60));if(J(a))return a}return 0}dateFormat(t,e,i){let s=k.defaultOptions?.lang;if(!q(e)||isNaN(e))return s?.invalidDate||\"\";if(tt(t=t??\"%Y-%m-%d %H:%M:%S\")){let i;let s=/%\\[([a-zA-Z]+)\\]/g;for(;i=s.exec(t);)t=t.replace(i[0],this.dateTimeFormat(i[1],e))}if(tt(t)&&-1!==t.indexOf(\"%\")){let i=this,[o,r,a,n,h,l,d,c]=this.toParts(e),p=s?.weekdays||this.weekdays,g=s?.shortWeekdays||this.shortWeekdays,u=s?.months||this.months,f=s?.shortMonths||this.shortMonths;ti(K({a:g?g[c]:p[c].substr(0,3),A:p[c],d:ts(a),e:ts(a,2,\" \"),w:c,b:f[r],B:u[r],m:ts(r+1),o:r+1,y:o.toString().substr(2,2),Y:o,H:ts(n),k:n,I:ts(n%12||12),l:n%12||12,M:ts(h),p:n<12?\"AM\":\"PM\",P:n<12?\"am\":\"pm\",S:ts(l),L:ts(d,3)},k.dateFormats),function(s,o){if(tt(t))for(;-1!==t.indexOf(\"%\"+o);)t=t.replace(\"%\"+o,\"function\"==typeof s?s.call(i,e):s)})}else if(Q(t)){let i=(this.getTimezoneOffset(e)||0)/36e5,s=this.timezone||\"Etc/GMT\"+(i>=0?\"+\":\"\")+i,{prefix:o=\"\",suffix:r=\"\"}=t;t=o+this.dateTimeFormat(K({timeZone:s},t),e)+r}return i?ta(t):t}resolveDTLFormat(t){return Q(t,!0)?Q(t,!0)&&th(t)?{main:t}:t:{main:(t=to(t))[0],from:t[1],to:t[2]}}getTimeTicks(t,e,i,s){let o=this,r=[],a={},{count:n=1,unitRange:h}=t,[l,d,c,p,g,u]=o.toParts(e),f=(e||0)%1e3,m;if(s??(s=1),q(e)){if(f=h>=tr.second?0:n*Math.floor(f/n),h>=tr.second&&(u=h>=tr.minute?0:n*Math.floor(u/n)),h>=tr.minute&&(g=h>=tr.hour?0:n*Math.floor(g/n)),h>=tr.hour&&(p=h>=tr.day?0:n*Math.floor(p/n)),h>=tr.day&&(c=h>=tr.month?1:Math.max(1,n*Math.floor(c/n))),h>=tr.month&&(d=h>=tr.year?0:n*Math.floor(d/n)),h>=tr.year&&(l-=l%n),h===tr.week){n&&(e=o.makeTime(l,d,c,p,g,u,f));let t=tl(this.dateTimeFormat({timeZone:this.timezone,weekday:\"narrow\"},e,\"es\"));c+=-t+s+(t4*tr.month||o.getTimezoneOffset(e)!==o.getTimezoneOffset(i));let t=e,x=1;for(;t1?t=o.makeTime(l,d,c,p+x*n):t+=h*n,x++;r.push(t),h<=tr.hour&&r.length<1e4&&r.forEach(t=>{t%18e5==0&&\"000000000\"===o.dateFormat(\"%H%M%S%L\",t)&&(a[t]=\"day\")})}return r.info=K(t,{higherRanks:a,totalRange:h*n}),r}getDateFormat(t,e,i,s){let o=this.dateFormat(\"%m-%d %H:%M:%S.%L\",e),r=\"01-01 00:00:00.000\",a={millisecond:15,second:12,minute:9,hour:6,day:3},n=\"millisecond\",h=n;for(n in tr){if(t===tr.week&&+this.dateFormat(\"%w\",e)===i&&o.substr(6)===r.substr(6)){n=\"week\";break}if(tr[n]>t){n=h;break}if(a[n]&&o.substr(a[n])!==r.substr(a[n]))break;\"week\"!==n&&(h=n)}return this.resolveDTLFormat(s[n]).main}},{isTouchDevice:tc}=k,{fireEvent:tp,merge:tg}=$,tu={colors:[\"#2caffe\",\"#544fc5\",\"#00e272\",\"#fe6a35\",\"#6b8abc\",\"#d568fb\",\"#2ee0ca\",\"#fa4b42\",\"#feb56a\",\"#91e8e1\"],symbols:[\"circle\",\"diamond\",\"square\",\"triangle\",\"triangle-down\"],lang:{locale:void 0,loading:\"Loading...\",months:void 0,shortMonths:void 0,weekdays:void 0,numericSymbols:[\"k\",\"M\",\"G\",\"T\",\"P\",\"E\"],resetZoom:\"Reset zoom\",resetZoomTitle:\"Reset zoom level 1:1\"},global:{buttonTheme:{fill:\"#f7f7f7\",padding:8,r:2,stroke:\"#cccccc\",\"stroke-width\":1,style:{color:\"#333333\",cursor:\"pointer\",fontSize:\"0.8em\",fontWeight:\"normal\"},states:{hover:{fill:\"#e6e6e6\"},select:{fill:\"#e6e9ff\",style:{color:\"#000000\",fontWeight:\"bold\"}},disabled:{style:{color:\"#cccccc\"}}}}},time:{Date:void 0,timezone:\"UTC\",timezoneOffset:0,useUTC:void 0},chart:{alignThresholds:!1,panning:{enabled:!1,type:\"x\"},styledMode:!1,borderRadius:0,colorCount:10,allowMutatingData:!0,ignoreHiddenSeries:!0,spacing:[10,10,15,10],resetZoomButton:{theme:{},position:{}},reflow:!0,type:\"line\",zooming:{singleTouch:!1,resetButton:{theme:{zIndex:6},position:{align:\"right\",x:-10,y:10}}},width:null,height:null,borderColor:\"#334eff\",backgroundColor:\"#ffffff\",plotBorderColor:\"#cccccc\"},title:{style:{color:\"#333333\",fontWeight:\"bold\"},text:\"Chart title\",margin:15,minScale:.67},subtitle:{style:{color:\"#666666\",fontSize:\"0.8em\"},text:\"\"},caption:{margin:15,style:{color:\"#666666\",fontSize:\"0.8em\"},text:\"\",align:\"left\",verticalAlign:\"bottom\"},plotOptions:{},legend:{enabled:!0,align:\"center\",alignColumns:!0,className:\"highcharts-no-tooltip\",events:{},layout:\"horizontal\",itemMarginBottom:2,itemMarginTop:2,labelFormatter:function(){return this.name},borderColor:\"#999999\",borderRadius:0,navigation:{style:{fontSize:\"0.8em\"},activeColor:\"#0022ff\",inactiveColor:\"#cccccc\"},itemStyle:{color:\"#333333\",cursor:\"pointer\",fontSize:\"0.8em\",textDecoration:\"none\",textOverflow:\"ellipsis\"},itemHoverStyle:{color:\"#000000\"},itemHiddenStyle:{color:\"#666666\",textDecoration:\"line-through\"},shadow:!1,itemCheckboxStyle:{position:\"absolute\",width:\"13px\",height:\"13px\"},squareSymbol:!0,symbolPadding:5,verticalAlign:\"bottom\",x:0,y:0,title:{style:{fontSize:\"0.8em\",fontWeight:\"bold\"}}},loading:{labelStyle:{fontWeight:\"bold\",position:\"relative\",top:\"45%\"},style:{position:\"absolute\",backgroundColor:\"#ffffff\",opacity:.5,textAlign:\"center\"}},tooltip:{enabled:!0,animation:{duration:300,easing:t=>Math.sqrt(1-Math.pow(t-1,2))},borderRadius:3,dateTimeLabelFormats:{millisecond:\"%[AebHMSL]\",second:\"%[AebHMS]\",minute:\"%[AebHM]\",hour:\"%[AebHM]\",day:\"%[AebY]\",week:\"Week from %[AebY]\",month:\"%[BY]\",year:\"%Y\"},footerFormat:\"\",headerShape:\"callout\",hideDelay:500,padding:8,shape:\"callout\",shared:!1,snap:tc?25:10,headerFormat:'{ucfirst point.key}
',pointFormat:'\u25CF {series.name}: {point.y}
',backgroundColor:\"#ffffff\",borderWidth:void 0,shadow:!0,stickOnContact:!1,style:{color:\"#333333\",cursor:\"default\",fontSize:\"0.8em\"},useHTML:!1},credits:{enabled:!0,href:\"https://www.highcharts.com?credits\",position:{align:\"right\",x:-10,verticalAlign:\"bottom\",y:-5},style:{cursor:\"pointer\",color:\"#999999\",fontSize:\"0.6em\"},text:\"Highcharts.com\"}},tf=new td(tu.time),tm={defaultOptions:tu,defaultTime:tf,getOptions:function(){return tu},setOptions:function(t){return tp(k,\"setOptions\",{options:t}),tg(!0,tu,t),t.time&&tf.update(tu.time),t.lang&&\"locale\"in t.lang&&tf.update({locale:t.lang.locale}),tu}},{isNumber:tx,merge:ty,pInt:tb,defined:tv}=$;class tk{static parse(t){return t?new tk(t):tk.None}constructor(t){let e,i,s,o;this.rgba=[NaN,NaN,NaN,NaN],this.input=t;let r=k.Color;if(r&&r!==tk)return new r(t);if(\"object\"==typeof t&&void 0!==t.stops)this.stops=t.stops.map(t=>new tk(t[1]));else if(\"string\"==typeof t)for(this.input=t=tk.names[t.toLowerCase()]||t,s=tk.parsers.length;s--&&!i;)(e=(o=tk.parsers[s]).regex.exec(t))&&(i=o.parse(e));i&&(this.rgba=i)}get(t){let e=this.input,i=this.rgba;if(\"object\"==typeof e&&void 0!==this.stops){let i=ty(e);return i.stops=[].slice.call(i.stops),this.stops.forEach((e,s)=>{i.stops[s]=[i.stops[s][0],e.get(t)]}),i}return i&&tx(i[0])?\"rgb\"!==t&&(t||1!==i[3])?\"a\"===t?`${i[3]}`:\"rgba(\"+i.join(\",\")+\")\":\"rgb(\"+i[0]+\",\"+i[1]+\",\"+i[2]+\")\":e}brighten(t){let e=this.rgba;if(this.stops)this.stops.forEach(function(e){e.brighten(t)});else if(tx(t)&&0!==t)for(let i=0;i<3;i++)e[i]+=tb(255*t),e[i]<0&&(e[i]=0),e[i]>255&&(e[i]=255);return this}setOpacity(t){return this.rgba[3]=t,this}tweenTo(t,e){let i=this.rgba,s=t.rgba;if(!tx(i[0])||!tx(s[0]))return t.input||\"none\";let o=1!==s[3]||1!==i[3],r=(t,s)=>t+(i[s]-t)*(1-e),a=s.slice(0,3).map(r).map(Math.round);return o&&a.push(r(s[3],3)),(o?\"rgba(\":\"rgb(\")+a.join(\",\")+\")\"}}tk.names={white:\"#ffffff\",black:\"#000000\"},tk.parsers=[{regex:/rgba\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d?(?:\\.\\d+)?)\\s*\\)/,parse:function(t){return[tb(t[1]),tb(t[2]),tb(t[3]),parseFloat(t[4],10)]}},{regex:/rgb\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*\\)/,parse:function(t){return[tb(t[1]),tb(t[2]),tb(t[3]),1]}},{regex:/^#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?$/i,parse:function(t){return[tb(t[1]+t[1],16),tb(t[2]+t[2],16),tb(t[3]+t[3],16),tv(t[4])?tb(t[4]+t[4],16)/255:1]}},{regex:/^#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?$/i,parse:function(t){return[tb(t[1],16),tb(t[2],16),tb(t[3],16),tv(t[4])?tb(t[4],16)/255:1]}}],tk.None=new tk(\"\");let{parse:tw}=tk,{win:tM}=k,{isNumber:tS,objectEach:tT}=$;class tC{constructor(t,e,i){this.pos=NaN,this.options=e,this.elem=t,this.prop=i}dSetter(){let t=this.paths,e=t&&t[0],i=t&&t[1],s=this.now||0,o=[];if(1!==s&&e&&i){if(e.length===i.length&&s<1)for(let t=0;t=n+this.startTime?(this.now=this.end,this.pos=1,this.update(),h[this.prop]=!0,i=!0,tT(h,function(t){!0!==t&&(i=!1)}),i&&a&&a.call(r),e=!1):(this.pos=o.easing((s-this.startTime)/n),this.now=this.start+(this.end-this.start)*this.pos,this.update(),e=!0),e}initPath(t,e,i){let s=t.startX,o=t.endX,r=i.slice(),a=t.isArea,n=a?2:1,h=e&&i.length>e.length&&i.hasStackedCliffs,l,d,c,p,g=e&&e.slice();if(!g||h)return[r,r];function u(t,e){for(;t.length{let i=tN(t.options.animation);r=tE(e)&&tA(e.defer)?s.defer:Math.max(r,i.duration+i.defer),a=Math.min(s.duration,i.duration)}),t.renderer.forExport&&(r=0),{defer:Math.max(0,r-a),duration:Math.min(r,a)}},setAnimation:function(t,e){e.renderer.globalAnimation=tB(t,e.options.chart.animation,!0)},stop:tz},{SVG_NS:tW,win:tH}=k,{attr:tX,createElement:tF,css:tG,error:tY,isFunction:tj,isString:tU,objectEach:t$,splat:tV}=$,{trustedTypes:t_}=tH,tq=t_&&tj(t_.createPolicy)&&t_.createPolicy(\"highcharts\",{createHTML:t=>t}),tZ=tq?tq.createHTML(\"\"):\"\";class tK{static filterUserAttributes(t){return t$(t,(e,i)=>{let s=!0;-1===tK.allowedAttributes.indexOf(i)&&(s=!1),-1!==[\"background\",\"dynsrc\",\"href\",\"lowsrc\",\"src\"].indexOf(i)&&(s=tU(e)&&tK.allowedReferences.some(t=>0===e.indexOf(t))),s||(tY(33,!1,void 0,{\"Invalid attribute in config\":`${i}`}),delete t[i]),tU(e)&&t[i]&&(t[i]=e.replace(/{let i=e.split(\":\").map(t=>t.trim()),s=i.shift();return s&&i.length&&(t[s.replace(/-([a-z])/g,t=>t[1].toUpperCase())]=i.join(\":\")),t},{})}static setElementHTML(t,e){t.innerHTML=tK.emptyHTML,e&&new tK(e).addToDOM(t)}constructor(t){this.nodes=\"string\"==typeof t?this.parseMarkup(t):t}addToDOM(t){return function t(e,i){let s;return tV(e).forEach(function(e){let o;let r=e.tagName,a=e.textContent?k.doc.createTextNode(e.textContent):void 0,n=tK.bypassHTMLFiltering;if(r){if(\"#text\"===r)o=a;else if(-1!==tK.allowedTags.indexOf(r)||n){let s=\"svg\"===r?tW:i.namespaceURI||tW,h=k.doc.createElementNS(s,r),l=e.attributes||{};t$(e,function(t,e){\"tagName\"!==e&&\"attributes\"!==e&&\"children\"!==e&&\"style\"!==e&&\"textContent\"!==e&&(l[e]=t)}),tX(h,n?l:tK.filterUserAttributes(l)),e.style&&tG(h,e.style),a&&h.appendChild(a),t(e.children||[],h),o=h}else tY(33,!1,void 0,{\"Invalid tagName in config\":r})}o&&i.appendChild(o),s=o}),s}(this.nodes,t)}parseMarkup(t){let e;let i=[];t=t.trim().replace(/ style=([\"'])/g,\" data-style=$1\");try{e=new DOMParser().parseFromString(tq?tq.createHTML(t):t,\"text/html\")}catch(t){}if(!e){let i=tF(\"div\");i.innerHTML=t,e={body:i}}let s=(t,e)=>{let i=t.nodeName.toLowerCase(),o={tagName:i};\"#text\"===i&&(o.textContent=t.textContent||\"\");let r=t.attributes;if(r){let t={};[].forEach.call(r,e=>{\"data-style\"===e.name?o.style=tK.parseStyle(e.value):t[e.name]=e.value}),o.attributes=t}if(t.childNodes.length){let e=[];[].forEach.call(t.childNodes,t=>{s(t,e)}),e.length&&(o.children=e)}e.push(o)};return[].forEach.call(e.body.childNodes,t=>s(t,i)),i}}tK.allowedAttributes=[\"alt\",\"aria-controls\",\"aria-describedby\",\"aria-expanded\",\"aria-haspopup\",\"aria-hidden\",\"aria-label\",\"aria-labelledby\",\"aria-live\",\"aria-pressed\",\"aria-readonly\",\"aria-roledescription\",\"aria-selected\",\"class\",\"clip-path\",\"color\",\"colspan\",\"cx\",\"cy\",\"d\",\"dx\",\"dy\",\"disabled\",\"fill\",\"filterUnits\",\"flood-color\",\"flood-opacity\",\"height\",\"href\",\"id\",\"in\",\"in2\",\"markerHeight\",\"markerWidth\",\"offset\",\"opacity\",\"operator\",\"orient\",\"padding\",\"paddingLeft\",\"paddingRight\",\"patternUnits\",\"r\",\"radius\",\"refX\",\"refY\",\"role\",\"scope\",\"slope\",\"src\",\"startOffset\",\"stdDeviation\",\"stroke\",\"stroke-linecap\",\"stroke-width\",\"style\",\"tableValues\",\"result\",\"rowspan\",\"summary\",\"target\",\"tabindex\",\"text-align\",\"text-anchor\",\"textAnchor\",\"textLength\",\"title\",\"type\",\"valign\",\"width\",\"x\",\"x1\",\"x2\",\"xlink:href\",\"y\",\"y1\",\"y2\",\"zIndex\"],tK.allowedReferences=[\"https://\",\"http://\",\"mailto:\",\"/\",\"../\",\"./\",\"#\"],tK.allowedTags=[\"a\",\"abbr\",\"b\",\"br\",\"button\",\"caption\",\"circle\",\"clipPath\",\"code\",\"dd\",\"defs\",\"div\",\"dl\",\"dt\",\"em\",\"feComponentTransfer\",\"feComposite\",\"feDropShadow\",\"feFlood\",\"feFuncA\",\"feFuncB\",\"feFuncG\",\"feFuncR\",\"feGaussianBlur\",\"feMorphology\",\"feOffset\",\"feMerge\",\"feMergeNode\",\"filter\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"hr\",\"i\",\"img\",\"li\",\"linearGradient\",\"marker\",\"ol\",\"p\",\"path\",\"pattern\",\"pre\",\"rect\",\"small\",\"span\",\"stop\",\"strong\",\"style\",\"sub\",\"sup\",\"svg\",\"table\",\"text\",\"textPath\",\"thead\",\"title\",\"tbody\",\"tspan\",\"td\",\"th\",\"tr\",\"u\",\"ul\",\"#text\"],tK.emptyHTML=tZ,tK.bypassHTMLFiltering=!1;let{defaultOptions:tJ,defaultTime:tQ}=tm,{pageLang:t0}=k,{extend:t1,getNestedProperty:t2,isArray:t3,isNumber:t5,isObject:t6,isString:t9,pick:t4,ucfirst:t8}=$,t7={add:(t,e)=>t+e,divide:(t,e)=>0!==e?t/e:\"\",eq:(t,e)=>t==e,each:function(t){let e=arguments[arguments.length-1];return!!t3(t)&&t.map((i,s)=>ei(e.body,t1(t6(i)?i:{\"@this\":i},{\"@index\":s,\"@first\":0===s,\"@last\":s===t.length-1}))).join(\"\")},ge:(t,e)=>t>=e,gt:(t,e)=>t>e,if:t=>!!t,le:(t,e)=>t<=e,lt:(t,e)=>tt*e,ne:(t,e)=>t!=e,subtract:(t,e)=>t-e,ucfirst:t8,unless:t=>!t},et={},ee=t=>/^[\"'].+[\"']$/.test(t);function ei(t=\"\",e,i){let s=/\\{([\\p{L}\\d:\\.,;\\-\\/<>\\[\\]%_@+\"'\u2019= #\\(\\)]+)\\}/gu,o=/\\(([\\p{L}\\d:\\.,;\\-\\/<>\\[\\]%_@+\"'= ]+)\\)/gu,r=[],a=/f$/,n=/\\.(\\d)/,h=i?.options.lang||tJ.lang,l=i&&i.time||tQ,d=i&&i.numberFormatter||es,c=(t=\"\")=>{let i;return\"true\"===t||\"false\"!==t&&((i=Number(t)).toString()===t?i:ee(t)?t.slice(1,-1):t2(t,e))},p,g,u=0,f;for(;null!==(p=s.exec(t));){let i=p,s=o.exec(p[1]);s&&(p=s,f=!0),g&&g.isBlock||(g={ctx:e,expression:p[1],find:p[0],isBlock:\"#\"===p[1].charAt(0),start:p.index,startInner:p.index+p[0].length,length:p[0].length});let a=(g.isBlock?i:p)[1].split(\" \")[0].replace(\"#\",\"\");t7[a]&&(g.isBlock&&a===g.fn&&u++,g.fn||(g.fn=a));let n=\"else\"===p[1];if(g.isBlock&&g.fn&&(p[1]===`/${g.fn}`||n)){if(u)!n&&u--;else{let e=g.startInner,i=t.substr(e,p.index-e);void 0===g.body?(g.body=i,g.startInner=p.index+p[0].length):g.elseBody=i,g.find+=i+p[0],n||(r.push(g),g=void 0)}}else g.isBlock||r.push(g);if(s&&!g?.isBlock)break}return r.forEach(s=>{let r,p;let{body:g,elseBody:u,expression:f,fn:m}=s;if(m){let t=[s],o=[],a=f.length,n=0,h;for(p=0;p<=a;p++){let t=f.charAt(p);h||'\"'!==t&&\"'\"!==t?h===t&&(h=\"\"):h=t,h||\" \"!==t&&p!==a||(o.push(f.substr(n,p-n)),n=p+1)}for(p=t7[m].length;p--;)t.unshift(c(o[p+1]));r=t7[m].apply(e,t),s.isBlock&&\"boolean\"==typeof r&&(r=ei(r?g:u,e,i))}else{let t=ee(f)?[f]:f.split(\":\");if(r=c(t.shift()||\"\"),t.length&&\"number\"==typeof r){let e=t.join(\":\");if(a.test(e)){let t=parseInt((e.match(n)||[\"\",\"-1\"])[1],10);null!==r&&(r=d(r,t,h.decimalPoint,e.indexOf(\",\")>-1?h.thousandsSep:\"\"))}else r=l.dateFormat(e,r)}o.lastIndex=0,o.test(s.find)&&t9(r)&&(r=`\"${r}\"`)}t=t.replace(s.find,t4(r,\"\"))}),f?ei(t,e,i):t}function es(t,e,i,s){e=+e;let o,r,[a,n]=(t=+t||0).toString().split(\"e\").map(Number),h=this?.options?.lang||tJ.lang,l=(t.toString().split(\".\")[1]||\"\").split(\"e\")[0].length,d=e,c={};i??(i=h.decimalPoint),s??(s=h.thousandsSep),-1===e?e=Math.min(l,20):t5(e)?e&&n<0&&((r=e+n)>=0?(a=+a.toExponential(r).split(\"e\")[0],e=r):(a=Math.floor(a),t=e<20?+(a*Math.pow(10,n)).toFixed(e):0,n=0)):e=2,n&&(e??(e=2),t=a),t5(e)&&e>=0&&(c.minimumFractionDigits=e,c.maximumFractionDigits=e),\"\"===s&&(c.useGrouping=!1);let p=s||i,g=p?\"en\":this?.locale||h.locale||t0,u=JSON.stringify(c)+g;return o=(et[u]??(et[u]=new Intl.NumberFormat(g,c))).format(t),p&&(o=o.replace(/([,\\.])/g,\"_$1\").replace(/_\\,/g,s??\",\").replace(\"_.\",i??\".\")),(e||0!=+o)&&(!(n<0)||d)||(o=\"0\"),n&&0!=+o&&(o+=\"e\"+(n<0?\"\":\"+\")+n),o}let eo={dateFormat:function(t,e,i){return tQ.dateFormat(t,e,i)},format:ei,helpers:t7,numberFormat:es};!function(t){let e;t.rendererTypes={},t.getRendererType=function(i=e){return t.rendererTypes[i]||t.rendererTypes[e]},t.registerRendererType=function(i,s,o){t.rendererTypes[i]=s,(!e||o)&&(e=i,k.Renderer=s)}}(s||(s={}));let er=s,{clamp:ea,pick:en,pushUnique:eh,stableSort:el}=$;(o||(o={})).distribute=function t(e,i,s){let o=e,r=o.reducedLen||i,a=(t,e)=>t.target-e.target,n=[],h=e.length,l=[],d=n.push,c,p,g,u=!0,f,m,x=0,y;for(c=h;c--;)x+=e[c].size;if(x>r){for(el(e,(t,e)=>(e.rank||0)-(t.rank||0)),g=(y=e[0].rank===e[e.length-1].rank)?h/2:-1,p=y?g:h-1;g&&x>r;)f=e[c=Math.floor(p)],eh(l,c)&&(x-=f.size),p+=g,y&&p>=e.length&&(g/=2,p=g);l.sort((t,e)=>e-t).forEach(t=>d.apply(n,e.splice(t,1)))}for(el(e,a),e=e.map(t=>({size:t.size,targets:[t.target],align:en(t.align,.5)}));u;){for(c=e.length;c--;)f=e[c],m=(Math.min.apply(0,f.targets)+Math.max.apply(0,f.targets))/2,f.pos=ea(m-f.size*f.align,0,i-f.size);for(c=e.length,u=!1;c--;)c>0&&e[c-1].pos+e[c-1].size>e[c].pos&&(e[c-1].size+=e[c].size,e[c-1].targets=e[c-1].targets.concat(e[c].targets),e[c-1].align=.5,e[c-1].pos+e[c-1].size>i&&(e[c-1].pos=i-e[c-1].size),e.splice(c,1),u=!0)}return d.apply(o,n),c=0,e.some(e=>{let r=0;return(e.targets||[]).some(()=>(o[c].pos=e.pos+r,void 0!==s&&Math.abs(o[c].pos-o[c].target)>s)?(o.slice(0,c+1).forEach(t=>delete t.pos),o.reducedLen=(o.reducedLen||i)-.1*i,o.reducedLen>.1*i&&t(o,i,s),!0):(r+=o[c].size,c++,!1))}),el(o,a),o};let ed=o,{animate:ec,animObject:ep,stop:eg}=tR,{deg2rad:eu,doc:ef,svg:em,SVG_NS:ex,win:ey,isFirefox:eb}=k,{addEvent:ev,attr:ek,createElement:ew,crisp:eM,css:eS,defined:eT,erase:eC,extend:eA,fireEvent:eP,getAlignFactor:eL,isArray:eO,isFunction:eE,isNumber:eI,isObject:eD,isString:eB,merge:eN,objectEach:ez,pick:eR,pInt:eW,pushUnique:eH,replaceNested:eX,syncTimeout:eF,uniqueKey:eG}=$;class eY{_defaultGetter(t){let e=eR(this[t+\"Value\"],this[t],this.element?this.element.getAttribute(t):null,0);return/^-?[\\d\\.]+$/.test(e)&&(e=parseFloat(e)),e}_defaultSetter(t,e,i){i.setAttribute(e,t)}add(t){let e;let i=this.renderer,s=this.element;return t&&(this.parentGroup=t),void 0!==this.textStr&&\"text\"===this.element.nodeName&&i.buildText(this),this.added=!0,(!t||t.handleZ||this.zIndex)&&(e=this.zIndexSetter()),e||(t?t.element:i.box).appendChild(s),this.onAdd&&this.onAdd(),this}addClass(t,e){let i=e?\"\":this.attr(\"class\")||\"\";return(t=(t||\"\").split(/ /g).reduce(function(t,e){return -1===i.indexOf(e)&&t.push(e),t},i?[i]:[]).join(\" \"))!==i&&this.attr(\"class\",t),this}afterSetters(){this.doTransform&&(this.updateTransform(),this.doTransform=!1)}align(t,e,i,s=!0){let o=this.renderer,r=o.alignedObjects,a=!!t;t?(this.alignOptions=t,this.alignByTranslate=e,this.alignTo=i):(t=this.alignOptions||{},e=this.alignByTranslate,i=this.alignTo);let n=!i||eB(i)?i||\"renderer\":void 0;n&&(a&&eH(r,this),i=void 0);let h=eR(i,o[n],o),l=(h.x||0)+(t.x||0)+((h.width||0)-(t.width||0))*eL(t.align),d=(h.y||0)+(t.y||0)+((h.height||0)-(t.height||0))*eL(t.verticalAlign),c={\"text-align\":t?.align};return c[e?\"translateX\":\"x\"]=Math.round(l),c[e?\"translateY\":\"y\"]=Math.round(d),s&&(this[this.placed?\"animate\":\"attr\"](c),this.placed=!0),this.alignAttr=c,this}alignSetter(t){let e={left:\"start\",center:\"middle\",right:\"end\"};e[t]&&(this.alignValue=t,this.element.setAttribute(\"text-anchor\",e[t]))}animate(t,e,i){let s=ep(eR(e,this.renderer.globalAnimation,!0)),o=s.defer;return ef.hidden&&(s.duration=0),0!==s.duration?(i&&(s.complete=i),eF(()=>{this.element&&ec(this,t,s)},o)):(this.attr(t,void 0,i||s.complete),ez(t,function(t,e){s.step&&s.step.call(this,t,{prop:e,pos:1,elem:this})},this)),this}applyTextOutline(t){let e=this.element;-1!==t.indexOf(\"contrast\")&&(t=t.replace(/contrast/g,this.renderer.getContrast(e.style.fill)));let i=t.split(\" \"),s=i[i.length-1],o=i[0];if(o&&\"none\"!==o&&k.svg){this.fakeTS=!0,o=o.replace(/(^[\\d\\.]+)(.*?)$/g,function(t,e,i){return 2*Number(e)+i}),this.removeTextOutline();let t=ef.createElementNS(ex,\"tspan\");ek(t,{class:\"highcharts-text-outline\",fill:s,stroke:s,\"stroke-width\":o,\"stroke-linejoin\":\"round\"});let i=e.querySelector(\"textPath\")||e;[].forEach.call(i.childNodes,e=>{let i=e.cloneNode(!0);i.removeAttribute&&[\"fill\",\"stroke\",\"stroke-width\",\"stroke\"].forEach(t=>i.removeAttribute(t)),t.appendChild(i)});let r=0;[].forEach.call(i.querySelectorAll(\"text tspan\"),t=>{r+=Number(t.getAttribute(\"dy\"))});let a=ef.createElementNS(ex,\"tspan\");a.textContent=\"\u200B\",ek(a,{x:Number(e.getAttribute(\"x\")),dy:-r}),t.appendChild(a),i.insertBefore(t,i.firstChild)}}attr(t,e,i,s){let{element:o}=this,r=eY.symbolCustomAttribs,a,n,h=this,l;return\"string\"==typeof t&&void 0!==e&&(a=t,(t={})[a]=e),\"string\"==typeof t?h=(this[t+\"Getter\"]||this._defaultGetter).call(this,t,o):(ez(t,function(e,i){l=!1,s||eg(this,i),this.symbolName&&-1!==r.indexOf(i)&&(n||(this.symbolAttr(t),n=!0),l=!0),this.rotation&&(\"x\"===i||\"y\"===i)&&(this.doTransform=!0),l||(this[i+\"Setter\"]||this._defaultSetter).call(this,e,i,o)},this),this.afterSetters()),i&&i.call(this),h}clip(t){if(t&&!t.clipPath){let e=eG()+\"-\",i=this.renderer.createElement(\"clipPath\").attr({id:e}).add(this.renderer.defs);eA(t,{clipPath:i,id:e,count:0}),t.add(i)}return this.attr(\"clip-path\",t?`url(${this.renderer.url}#${t.id})`:\"none\")}crisp(t,e){e=Math.round(e||t.strokeWidth||0);let i=t.x||this.x||0,s=t.y||this.y||0,o=(t.width||this.width||0)+i,r=(t.height||this.height||0)+s,a=eM(i,e),n=eM(s,e);return eA(t,{x:a,y:n,width:eM(o,e)-a,height:eM(r,e)-n}),eT(t.strokeWidth)&&(t.strokeWidth=e),t}complexColor(t,e,i){let s=this.renderer,o,r,a,n,h,l,d,c,p,g,u=[],f;eP(this.renderer,\"complexColor\",{args:arguments},function(){if(t.radialGradient?r=\"radialGradient\":t.linearGradient&&(r=\"linearGradient\"),r){if(a=t[r],h=s.gradients,l=t.stops,p=i.radialReference,eO(a)&&(t[r]=a={x1:a[0],y1:a[1],x2:a[2],y2:a[3],gradientUnits:\"userSpaceOnUse\"}),\"radialGradient\"===r&&p&&!eT(a.gradientUnits)&&(n=a,a=eN(a,s.getRadialAttr(p,n),{gradientUnits:\"userSpaceOnUse\"})),ez(a,function(t,e){\"id\"!==e&&u.push(e,t)}),ez(l,function(t){u.push(t)}),h[u=u.join(\",\")])g=h[u].attr(\"id\");else{a.id=g=eG();let t=h[u]=s.createElement(r).attr(a).add(s.defs);t.radAttr=n,t.stops=[],l.forEach(function(e){0===e[1].indexOf(\"rgba\")?(d=(o=tk.parse(e[1])).get(\"rgb\"),c=o.get(\"a\")):(d=e[1],c=1);let i=s.createElement(\"stop\").attr({offset:e[0],\"stop-color\":d,\"stop-opacity\":c}).add(t);t.stops.push(i)})}f=\"url(\"+s.url+\"#\"+g+\")\",i.setAttribute(e,f),i.gradient=u,t.toString=function(){return f}}})}css(t){let e=this.styles,i={},s=this.element,o,r=!e;if(e&&ez(t,function(t,s){e&&e[s]!==t&&(i[s]=t,r=!0)}),r){e&&(t=eA(e,i)),null===t.width||\"auto\"===t.width?delete this.textWidth:\"text\"===s.nodeName.toLowerCase()&&t.width&&(o=this.textWidth=eW(t.width)),eA(this.styles,t),o&&!em&&this.renderer.forExport&&delete t.width;let r=eb&&t.fontSize||null;r&&(eI(r)||/^\\d+$/.test(r))&&(t.fontSize+=\"px\");let a=eN(t);s.namespaceURI===this.SVG_NS&&([\"textOutline\",\"textOverflow\",\"whiteSpace\",\"width\"].forEach(t=>a&&delete a[t]),a.color&&(a.fill=a.color)),eS(s,a)}return this.added&&(\"text\"===this.element.nodeName&&this.renderer.buildText(this),t.textOutline&&this.applyTextOutline(t.textOutline)),this}dashstyleSetter(t){let e,i=this[\"stroke-width\"];if(\"inherit\"===i&&(i=1),t=t&&t.toLowerCase()){let s=t.replace(\"shortdashdotdot\",\"3,1,1,1,1,1,\").replace(\"shortdashdot\",\"3,1,1,1\").replace(\"shortdot\",\"1,1,\").replace(\"shortdash\",\"3,1,\").replace(\"longdash\",\"8,3,\").replace(/dot/g,\"1,3,\").replace(\"dash\",\"4,3,\").replace(/,$/,\"\").split(\",\");for(e=s.length;e--;)s[e]=\"\"+eW(s[e])*eR(i,NaN);t=s.join(\",\").replace(/NaN/g,\"none\"),this.element.setAttribute(\"stroke-dasharray\",t)}}destroy(){let t=this,e=t.element||{},i=t.renderer,s=e.ownerSVGElement,o=\"SPAN\"===e.nodeName&&t.parentGroup||void 0,r,a;if(e.onclick=e.onmouseout=e.onmouseover=e.onmousemove=e.point=null,eg(t),t.clipPath&&s){let e=t.clipPath;[].forEach.call(s.querySelectorAll(\"[clip-path],[CLIP-PATH]\"),function(t){t.getAttribute(\"clip-path\").indexOf(e.element.id)>-1&&t.removeAttribute(\"clip-path\")}),t.clipPath=e.destroy()}if(t.connector=t.connector?.destroy(),t.stops){for(a=0;ae&&e.join?(i?t+\" \":\"\")+e.join(\" \"):(e||\"\").toString(),\"\")),/(NaN| {2}|^$)/.test(t)&&(t=\"M 0 0\"),this[e]!==t&&(i.setAttribute(e,t),this[e]=t)}fillSetter(t,e,i){\"string\"==typeof t?i.setAttribute(e,t):t&&this.complexColor(t,e,i)}hrefSetter(t,e,i){i.setAttributeNS(\"http://www.w3.org/1999/xlink\",e,t)}getBBox(t,e){let i,s,o,r;let{alignValue:a,element:n,renderer:h,styles:l,textStr:d}=this,{cache:c,cacheKeys:p}=h,g=n.namespaceURI===this.SVG_NS,u=eR(e,this.rotation,0),f=h.styledMode?n&&eY.prototype.getStyle.call(n,\"font-size\"):l.fontSize;if(eT(d)&&(-1===(r=d.toString()).indexOf(\"<\")&&(r=r.replace(/\\d/g,\"0\")),r+=[\"\",h.rootFontSize,f,u,this.textWidth,a,l.lineClamp,l.textOverflow,l.fontWeight].join(\",\")),r&&!t&&(i=c[r]),!i||i.polygon){if(g||h.forExport){try{o=this.fakeTS&&function(t){let e=n.querySelector(\".highcharts-text-outline\");e&&eS(e,{display:t})},eE(o)&&o(\"none\"),i=n.getBBox?eA({},n.getBBox()):{width:n.offsetWidth,height:n.offsetHeight,x:0,y:0},eE(o)&&o(\"\")}catch(t){}(!i||i.width<0)&&(i={x:0,y:0,width:0,height:0})}else i=this.htmlGetBBox();s=i.height,g&&(i.height=s=({\"11px,17\":14,\"13px,20\":16})[`${f||\"\"},${Math.round(s)}`]||s),u&&(i=this.getRotatedBox(i,u));let t={bBox:i};eP(this,\"afterGetBBox\",t),i=t.bBox}if(r&&(\"\"===d||i.height>0)){for(;p.length>250;)delete c[p.shift()];c[r]||p.push(r),c[r]=i}return i}getRotatedBox(t,e){let{x:i,y:s,width:o,height:r}=t,{alignValue:a,translateY:n,rotationOriginX:h=0,rotationOriginY:l=0}=this,d=eL(a),c=Number(this.element.getAttribute(\"y\")||0)-(n?0:s),p=e*eu,g=(e-90)*eu,u=Math.cos(p),f=Math.sin(p),m=o*u,x=o*f,y=Math.cos(g),b=Math.sin(g),[[v,k],[w,M]]=[h,l].map(t=>[t-t*u,t*f]),S=i+d*(o-m)+v+M+c*y,T=S+m,C=T-r*y,A=C-m,P=s+c-d*x-k+w+c*b,L=P+x,O=L-r*b,E=O-x,I=Math.min(S,T,C,A),D=Math.min(P,L,O,E),B=Math.max(S,T,C,A)-I,N=Math.max(P,L,O,E)-D;return{x:I,y:D,width:B,height:N,polygon:[[S,P],[T,L],[C,O],[A,E]]}}getStyle(t){return ey.getComputedStyle(this.element||this,\"\").getPropertyValue(t)}hasClass(t){return -1!==(\"\"+this.attr(\"class\")).split(\" \").indexOf(t)}hide(){return this.attr({visibility:\"hidden\"})}htmlGetBBox(){return{height:0,width:0,x:0,y:0}}constructor(t,e){this.onEvents={},this.opacity=1,this.SVG_NS=ex,this.element=\"span\"===e||\"body\"===e?ew(e):ef.createElementNS(this.SVG_NS,e),this.renderer=t,this.styles={},eP(this,\"afterInit\")}on(t,e){let{onEvents:i}=this;return i[t]&&i[t](),i[t]=ev(this.element,t,e),this}opacitySetter(t,e,i){let s=Number(Number(t).toFixed(3));this.opacity=s,i.setAttribute(e,s)}reAlign(){this.alignOptions?.width&&\"left\"!==this.alignOptions.align&&(this.alignOptions.width=this.getBBox().width,this.placed=!1,this.align())}removeClass(t){return this.attr(\"class\",(\"\"+this.attr(\"class\")).replace(eB(t)?RegExp(`(^| )${t}( |$)`):t,\" \").replace(/ +/g,\" \").trim())}removeTextOutline(){let t=this.element.querySelector(\"tspan.highcharts-text-outline\");t&&this.safeRemoveChild(t)}safeRemoveChild(t){let e=t.parentNode;e&&e.removeChild(t)}setRadialReference(t){let e=this.element.gradient&&this.renderer.gradients[this.element.gradient];return this.element.radialReference=t,e&&e.radAttr&&e.animate(this.renderer.getRadialAttr(t,e.radAttr)),this}shadow(t){let{renderer:e}=this,i=eN(this.parentGroup?.rotation===90?{offsetX:-1,offsetY:-1}:{},eD(t)?t:{}),s=e.shadowDefinition(i);return this.attr({filter:t?`url(${e.url}#${s})`:\"none\"})}show(t=!0){return this.attr({visibility:t?\"inherit\":\"visible\"})}\"stroke-widthSetter\"(t,e,i){this[e]=t,i.setAttribute(e,t)}strokeWidth(){if(!this.renderer.styledMode)return this[\"stroke-width\"]||0;let t=this.getStyle(\"stroke-width\"),e=0,i;return/px$/.test(t)?e=eW(t):\"\"!==t&&(ek(i=ef.createElementNS(ex,\"rect\"),{width:t,\"stroke-width\":0}),this.element.parentNode.appendChild(i),e=i.getBBox().width,i.parentNode.removeChild(i)),e}symbolAttr(t){let e=this;eY.symbolCustomAttribs.forEach(function(i){e[i]=eR(t[i],e[i])}),e.attr({d:e.renderer.symbols[e.symbolName](e.x,e.y,e.width,e.height,e)})}textSetter(t){t!==this.textStr&&(delete this.textPxLength,this.textStr=t,this.added&&this.renderer.buildText(this),this.reAlign())}titleSetter(t){let e=this.element,i=e.getElementsByTagName(\"title\")[0]||ef.createElementNS(this.SVG_NS,\"title\");e.insertBefore?e.insertBefore(i,e.firstChild):e.appendChild(i),i.textContent=eX(eR(t,\"\"),[/<[^>]*>/g,\"\"]).replace(/</g,\"<\").replace(/>/g,\">\")}toFront(){let t=this.element;return t.parentNode.appendChild(t),this}translate(t,e){return this.attr({translateX:t,translateY:e})}updateTransform(t=\"transform\"){let{element:e,matrix:i,rotation:s=0,rotationOriginX:o,rotationOriginY:r,scaleX:a,scaleY:n,translateX:h=0,translateY:l=0}=this,d=[\"translate(\"+h+\",\"+l+\")\"];eT(i)&&d.push(\"matrix(\"+i.join(\",\")+\")\"),s&&(d.push(\"rotate(\"+s+\" \"+eR(o,e.getAttribute(\"x\"),0)+\" \"+eR(r,e.getAttribute(\"y\")||0)+\")\"),this.text?.element.tagName===\"SPAN\"&&this.text.attr({rotation:s,rotationOriginX:(o||0)-this.padding,rotationOriginY:(r||0)-this.padding})),(eT(a)||eT(n))&&d.push(\"scale(\"+eR(a,1)+\" \"+eR(n,1)+\")\"),d.length&&!(this.text||this).textPath&&e.setAttribute(t,d.join(\" \"))}visibilitySetter(t,e,i){\"inherit\"===t?i.removeAttribute(e):this[e]!==t&&i.setAttribute(e,t),this[e]=t}xGetter(t){return\"circle\"===this.element.nodeName&&(\"x\"===t?t=\"cx\":\"y\"===t&&(t=\"cy\")),this._defaultGetter(t)}zIndexSetter(t,e){let i=this.renderer,s=this.parentGroup,o=(s||i).element||i.box,r=this.element,a=o===i.box,n,h,l,d=!1,c,p=this.added,g;if(eT(t)?(r.setAttribute(\"data-z-index\",t),t=+t,this[e]===t&&(p=!1)):eT(this[e])&&r.removeAttribute(\"data-z-index\"),this[e]=t,p){for((t=this.zIndex)&&s&&(s.handleZ=!0),g=(n=o.childNodes).length-1;g>=0&&!d;g--)c=!eT(l=(h=n[g]).getAttribute(\"data-z-index\")),h!==r&&(t<0&&c&&!a&&!g?(o.insertBefore(r,n[g]),d=!0):(eW(l)<=t||c&&(!eT(t)||t>=0))&&(o.insertBefore(r,n[g+1]),d=!0));d||(o.insertBefore(r,n[a?3:0]),d=!0)}return d}}eY.symbolCustomAttribs=[\"anchorX\",\"anchorY\",\"clockwise\",\"end\",\"height\",\"innerR\",\"r\",\"start\",\"width\",\"x\",\"y\"],eY.prototype.strokeSetter=eY.prototype.fillSetter,eY.prototype.yGetter=eY.prototype.xGetter,eY.prototype.matrixSetter=eY.prototype.rotationOriginXSetter=eY.prototype.rotationOriginYSetter=eY.prototype.rotationSetter=eY.prototype.scaleXSetter=eY.prototype.scaleYSetter=eY.prototype.translateXSetter=eY.prototype.translateYSetter=eY.prototype.verticalAlignSetter=function(t,e){this[e]=t,this.doTransform=!0};let ej=eY,{defined:eU,extend:e$,getAlignFactor:eV,isNumber:e_,merge:eq,pick:eZ,removeEvent:eK}=$;class eJ extends ej{constructor(t,e,i,s,o,r,a,n,h,l){let d;super(t,\"g\"),this.paddingLeftSetter=this.paddingSetter,this.paddingRightSetter=this.paddingSetter,this.doUpdate=!1,this.textStr=e,this.x=i,this.y=s,this.anchorX=r,this.anchorY=a,this.baseline=h,this.className=l,this.addClass(\"button\"===l?\"highcharts-no-tooltip\":\"highcharts-label\"),l&&this.addClass(\"highcharts-\"+l),this.text=t.text(void 0,0,0,n).attr({zIndex:1}),\"string\"==typeof o&&((d=/^url\\((.*?)\\)$/.test(o))||this.renderer.symbols[o])&&(this.symbolKey=o),this.bBox=eJ.emptyBBox,this.padding=3,this.baselineOffset=0,this.needsBox=t.styledMode||d,this.deferredAttr={},this.alignFactor=0}alignSetter(t){let e=eV(t);this.textAlign=t,e!==this.alignFactor&&(this.alignFactor=e,this.bBox&&e_(this.xSetting)&&this.attr({x:this.xSetting}))}anchorXSetter(t,e){this.anchorX=t,this.boxAttr(e,Math.round(t)-this.getCrispAdjust()-this.xSetting)}anchorYSetter(t,e){this.anchorY=t,this.boxAttr(e,t-this.ySetting)}boxAttr(t,e){this.box?this.box.attr(t,e):this.deferredAttr[t]=e}css(t){if(t){let e={};t=eq(t),eJ.textProps.forEach(i=>{void 0!==t[i]&&(e[i]=t[i],delete t[i])}),this.text.css(e),\"fontSize\"in e||\"fontWeight\"in e?this.updateTextPadding():(\"width\"in e||\"textOverflow\"in e)&&this.updateBoxSize()}return ej.prototype.css.call(this,t)}destroy(){eK(this.element,\"mouseenter\"),eK(this.element,\"mouseleave\"),this.text&&this.text.destroy(),this.box&&(this.box=this.box.destroy()),ej.prototype.destroy.call(this)}fillSetter(t,e){t&&(this.needsBox=!0),this.fill=t,this.boxAttr(e,t)}getBBox(t,e){this.textStr&&0===this.bBox.width&&0===this.bBox.height&&this.updateBoxSize();let{padding:i,height:s=0,translateX:o=0,translateY:r=0,width:a=0}=this,n=eZ(this.paddingLeft,i),h=e??(this.rotation||0),l={width:a,height:s,x:o+this.bBox.x-n,y:r+this.bBox.y-i+this.baselineOffset};return h&&(l=this.getRotatedBox(l,h)),l}getCrispAdjust(){return(this.renderer.styledMode&&this.box?this.box.strokeWidth():this[\"stroke-width\"]?parseInt(this[\"stroke-width\"],10):0)%2/2}heightSetter(t){this.heightSetting=t,this.doUpdate=!0}afterSetters(){super.afterSetters(),this.doUpdate&&(this.updateBoxSize(),this.doUpdate=!1)}onAdd(){this.text.add(this),this.attr({text:eZ(this.textStr,\"\"),x:this.x||0,y:this.y||0}),this.box&&eU(this.anchorX)&&this.attr({anchorX:this.anchorX,anchorY:this.anchorY})}paddingSetter(t,e){e_(t)?t!==this[e]&&(this[e]=t,this.updateTextPadding()):this[e]=void 0}rSetter(t,e){this.boxAttr(e,t)}strokeSetter(t,e){this.stroke=t,this.boxAttr(e,t)}\"stroke-widthSetter\"(t,e){t&&(this.needsBox=!0),this[\"stroke-width\"]=t,this.boxAttr(e,t)}\"text-alignSetter\"(t){this.textAlign=this[\"text-align\"]=t,this.updateTextPadding()}textSetter(t){void 0!==t&&this.text.attr({text:t}),this.updateTextPadding(),this.reAlign()}updateBoxSize(){let t;let e=this.text,i={},s=this.padding,o=this.bBox=(!e_(this.widthSetting)||!e_(this.heightSetting)||this.textAlign)&&eU(e.textStr)?e.getBBox(void 0,0):eJ.emptyBBox;this.width=this.getPaddedWidth(),this.height=(this.heightSetting||o.height||0)+2*s;let r=this.renderer.fontMetrics(e);if(this.baselineOffset=s+Math.min((this.text.firstLineMetrics||r).b,o.height||1/0),this.heightSetting&&(this.baselineOffset+=(this.heightSetting-r.h)/2),this.needsBox&&!e.textPath){if(!this.box){let t=this.box=this.symbolKey?this.renderer.symbol(this.symbolKey):this.renderer.rect();t.addClass((\"button\"===this.className?\"\":\"highcharts-label-box\")+(this.className?\" highcharts-\"+this.className+\"-box\":\"\")),t.add(this)}t=this.getCrispAdjust(),i.x=t,i.y=(this.baseline?-this.baselineOffset:0)+t,i.width=Math.round(this.width),i.height=Math.round(this.height),this.box.attr(e$(i,this.deferredAttr)),this.deferredAttr={}}}updateTextPadding(){let t=this.text,e=t.styles.textAlign||this.textAlign;if(!t.textPath){this.updateBoxSize();let i=this.baseline?0:this.baselineOffset,s=(this.paddingLeft??this.padding)+eV(e)*(this.widthSetting??this.bBox.width);(s!==t.x||i!==t.y)&&(t.attr({align:e,x:s}),void 0!==i&&t.attr(\"y\",i)),t.x=s,t.y=i}}widthSetter(t){this.widthSetting=e_(t)?t:void 0,this.doUpdate=!0}getPaddedWidth(){let t=this.padding,e=eZ(this.paddingLeft,t),i=eZ(this.paddingRight,t);return(this.widthSetting||this.bBox.width||0)+e+i}xSetter(t){this.x=t,this.alignFactor&&(t-=this.alignFactor*this.getPaddedWidth(),this[\"forceAnimate:x\"]=!0),this.xSetting=Math.round(t),this.attr(\"translateX\",this.xSetting)}ySetter(t){this.ySetting=this.y=Math.round(t),this.attr(\"translateY\",this.ySetting)}}eJ.emptyBBox={width:0,height:0,x:0,y:0},eJ.textProps=[\"color\",\"direction\",\"fontFamily\",\"fontSize\",\"fontStyle\",\"fontWeight\",\"lineClamp\",\"lineHeight\",\"textAlign\",\"textDecoration\",\"textOutline\",\"textOverflow\",\"whiteSpace\",\"width\"];let{defined:eQ,isNumber:e0,pick:e1}=$;function e2(t,e,i,s,o){let r=[];if(o){let a=o.start||0,n=e1(o.r,i),h=e1(o.r,s||i),l=2e-4/(o.borderRadius?1:Math.max(n,1)),d=Math.abs((o.end||0)-a-2*Math.PI)0&&h0)return l;if(t+n>i-a){if(h>e+a&&he+a&&h0){let i=hs&&na&&l.splice(1,1,[\"L\",n-6,e],[\"L\",n,e-6],[\"L\",n+6,e],[\"L\",i-r,e]);return l},circle:function(t,e,i,s){return e2(t+i/2,e+s/2,i/2,s/2,{start:.5*Math.PI,end:2.5*Math.PI,open:!1})},diamond:function(t,e,i,s){return[[\"M\",t+i/2,e],[\"L\",t+i,e+s/2],[\"L\",t+i/2,e+s],[\"L\",t,e+s/2],[\"Z\"]]},rect:e3,roundedRect:e5,square:e3,triangle:function(t,e,i,s){return[[\"M\",t+i/2,e],[\"L\",t+i,e+s],[\"L\",t,e+s],[\"Z\"]]},\"triangle-down\":function(t,e,i,s){return[[\"M\",t,e],[\"L\",t+i,e],[\"L\",t+i/2,e+s],[\"Z\"]]}},{doc:e9,SVG_NS:e4,win:e8}=k,{attr:e7,extend:it,fireEvent:ie,isString:ii,objectEach:is,pick:io}=$,ir=(t,e)=>t.substring(0,e)+\"\u2026\",ia=class{constructor(t){let e=t.styles;this.renderer=t.renderer,this.svgElement=t,this.width=t.textWidth,this.textLineHeight=e&&e.lineHeight,this.textOutline=e&&e.textOutline,this.ellipsis=!!(e&&\"ellipsis\"===e.textOverflow),this.lineClamp=e?.lineClamp,this.noWrap=!!(e&&\"nowrap\"===e.whiteSpace)}buildSVG(){let t=this.svgElement,e=t.element,i=t.renderer,s=io(t.textStr,\"\").toString(),o=-1!==s.indexOf(\"<\"),r=e.childNodes,a=!t.added&&i.box,n=[s,this.ellipsis,this.noWrap,this.textLineHeight,this.textOutline,t.getStyle(\"font-size\"),t.styles.lineClamp,this.width].join(\",\");if(n!==t.textCache){t.textCache=n,delete t.actualWidth;for(let t=r.length;t--;)e.removeChild(r[t]);if(o||this.ellipsis||this.width||t.textPath||-1!==s.indexOf(\" \")&&(!this.noWrap||//g.test(s))){if(\"\"!==s){a&&a.appendChild(e);let i=new tK(s);this.modifyTree(i.nodes),i.addToDOM(e),this.modifyDOM(),this.ellipsis&&-1!==(e.textContent||\"\").indexOf(\"\u2026\")&&t.attr(\"title\",this.unescapeEntities(t.textStr||\"\",[\"<\",\">\"])),a&&a.removeChild(e)}}else e.appendChild(e9.createTextNode(this.unescapeEntities(s)));ii(this.textOutline)&&t.applyTextOutline&&t.applyTextOutline(this.textOutline)}}modifyDOM(){let t;let e=this.svgElement,i=e7(e.element,\"x\");for(e.firstLineMetrics=void 0;t=e.element.firstChild;)if(/^[\\s\\u200B]*$/.test(t.textContent||\" \"))e.element.removeChild(t);else break;[].forEach.call(e.element.querySelectorAll(\"tspan.highcharts-br\"),(t,s)=>{t.nextSibling&&t.previousSibling&&(0===s&&1===t.previousSibling.nodeType&&(e.firstLineMetrics=e.renderer.fontMetrics(t.previousSibling)),e7(t,{dy:this.getLineHeight(t.nextSibling),x:i}))});let s=this.width||0;if(!s)return;let o=(t,o)=>{let r=t.textContent||\"\",a=r.replace(/([^\\^])-/g,\"$1- \").split(\" \"),n=!this.noWrap&&(a.length>1||e.element.childNodes.length>1),h=this.getLineHeight(o),l=Math.max(0,s-.8*h),d=0,c=e.actualWidth;if(n){let r=[],n=[];for(;o.firstChild&&o.firstChild!==t;)n.push(o.firstChild),o.removeChild(o.firstChild);for(;a.length;)if(a.length&&!this.noWrap&&d>0&&(r.push(t.textContent||\"\"),t.textContent=a.join(\" \").replace(/- /g,\"-\")),this.truncate(t,void 0,a,0===d&&c||0,s,l,(t,e)=>a.slice(0,e).join(\" \").replace(/- /g,\"-\")),c=e.actualWidth,d++,this.lineClamp&&d>=this.lineClamp){a.length&&(this.truncate(t,t.textContent||\"\",void 0,0,s,l,ir),t.textContent=t.textContent?.replace(\"\u2026\",\"\")+\"\u2026\");break}n.forEach(e=>{o.insertBefore(e,t)}),r.forEach(e=>{o.insertBefore(e9.createTextNode(e),t);let s=e9.createElementNS(e4,\"tspan\");s.textContent=\"\u200B\",e7(s,{dy:h,x:i}),o.insertBefore(s,t)})}else this.ellipsis&&r&&this.truncate(t,r,void 0,0,s,l,ir)},r=t=>{[].slice.call(t.childNodes).forEach(i=>{i.nodeType===e8.Node.TEXT_NODE?o(i,t):(-1!==i.className.baseVal.indexOf(\"highcharts-br\")&&(e.actualWidth=0),r(i))})};r(e.element)}getLineHeight(t){let e=t.nodeType===e8.Node.TEXT_NODE?t.parentElement:t;return this.textLineHeight?parseInt(this.textLineHeight.toString(),10):this.renderer.fontMetrics(e||this.svgElement.element).h}modifyTree(t){let e=(i,s)=>{let{attributes:o={},children:r,style:a={},tagName:n}=i,h=this.renderer.styledMode;if(\"b\"===n||\"strong\"===n?h?o.class=\"highcharts-strong\":a.fontWeight=\"bold\":(\"i\"===n||\"em\"===n)&&(h?o.class=\"highcharts-emphasized\":a.fontStyle=\"italic\"),a&&a.color&&(a.fill=a.color),\"br\"===n){o.class=\"highcharts-br\",i.textContent=\"\u200B\";let e=t[s+1];e&&e.textContent&&(e.textContent=e.textContent.replace(/^ +/gm,\"\"))}else\"a\"===n&&r&&r.some(t=>\"#text\"===t.tagName)&&(i.children=[{children:r,tagName:\"tspan\"}]);\"#text\"!==n&&\"a\"!==n&&(i.tagName=\"tspan\"),it(i,{attributes:o,style:a}),r&&r.filter(t=>\"#text\"!==t.tagName).forEach(e)};t.forEach(e),ie(this.svgElement,\"afterModifyTree\",{nodes:t})}truncate(t,e,i,s,o,r,a){let n,h;let l=this.svgElement,{rotation:d}=l,c=[],p=i&&!s?1:0,g=(e||i||\"\").length,u=g;i||(o=r);let f=function(e,o){let r=o||e,a=t.parentNode;if(a&&void 0===c[r]&&a.getSubStringLength)try{c[r]=s+a.getSubStringLength(0,i?r+1:r)}catch(t){}return c[r]};if(l.rotation=0,s+(h=f(t.textContent.length))>o){for(;p<=g;)u=Math.ceil((p+g)/2),i&&(n=a(i,u)),h=f(u,n&&n.length-1),p===g?p=g+1:h>o?g=u-1:p=u;0===g?t.textContent=\"\":e&&g===e.length-1||(t.textContent=n||a(e||i,u)),this.ellipsis&&h>o&&this.truncate(t,t.textContent||\"\",void 0,0,o,r,ir)}i&&i.splice(0,u),l.actualWidth=h,l.rotation=d}unescapeEntities(t,e){return is(this.renderer.escapes,function(i,s){e&&-1!==e.indexOf(i)||(t=t.toString().replace(RegExp(i,\"g\"),s))}),t}},{defaultOptions:ih}=tm,{charts:il,deg2rad:id,doc:ic,isFirefox:ip,isMS:ig,isWebKit:iu,noop:im,SVG_NS:ix,symbolSizes:iy,win:ib}=k,{addEvent:iv,attr:ik,createElement:iw,crisp:iM,css:iS,defined:iT,destroyObjectProperties:iC,extend:iA,isArray:iP,isNumber:iL,isObject:iO,isString:iE,merge:iI,pick:iD,pInt:iB,replaceNested:iN,uniqueKey:iz}=$;class iR{constructor(t,e,i,s,o,r,a){let n,h;let l=this.createElement(\"svg\").attr({version:\"1.1\",class:\"highcharts-root\"}),d=l.element;a||l.css(this.getStyle(s||{})),t.appendChild(d),ik(t,\"dir\",\"ltr\"),-1===t.innerHTML.indexOf(\"xmlns\")&&ik(d,\"xmlns\",this.SVG_NS),this.box=d,this.boxWrapper=l,this.alignedObjects=[],this.url=this.getReferenceURL(),this.createElement(\"desc\").add().element.appendChild(ic.createTextNode(\"Created with Highcharts 12.1.2\")),this.defs=this.createElement(\"defs\").add(),this.allowHTML=r,this.forExport=o,this.styledMode=a,this.gradients={},this.cache={},this.cacheKeys=[],this.imgCount=0,this.rootFontSize=l.getStyle(\"font-size\"),this.setSize(e,i,!1),ip&&t.getBoundingClientRect&&((n=function(){iS(t,{left:0,top:0}),h=t.getBoundingClientRect(),iS(t,{left:Math.ceil(h.left)-h.left+\"px\",top:Math.ceil(h.top)-h.top+\"px\"})})(),this.unSubPixelFix=iv(ib,\"resize\",n))}definition(t){return new tK([t]).addToDOM(this.defs.element)}getReferenceURL(){if((ip||iu)&&ic.getElementsByTagName(\"base\").length){if(!iT(e)){let t=iz(),i=new tK([{tagName:\"svg\",attributes:{width:8,height:8},children:[{tagName:\"defs\",children:[{tagName:\"clipPath\",attributes:{id:t},children:[{tagName:\"rect\",attributes:{width:4,height:4}}]}]},{tagName:\"rect\",attributes:{id:\"hitme\",width:8,height:8,\"clip-path\":`url(#${t})`,fill:\"rgba(0,0,0,0.001)\"}}]}]).addToDOM(ic.body);iS(i,{position:\"fixed\",top:0,left:0,zIndex:9e5});let s=ic.elementFromPoint(6,6);e=\"hitme\"===(s&&s.id),ic.body.removeChild(i)}if(e)return iN(ib.location.href.split(\"#\")[0],[/<[^>]*>/g,\"\"],[/([\\('\\)])/g,\"\\\\$1\"],[/ /g,\"%20\"])}return\"\"}getStyle(t){return this.style=iA({fontFamily:'-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", sans-serif',fontSize:\"1rem\"},t),this.style}setStyle(t){this.boxWrapper.css(this.getStyle(t))}isHidden(){return!this.boxWrapper.getBBox().width}destroy(){let t=this.defs;return this.box=null,this.boxWrapper=this.boxWrapper.destroy(),iC(this.gradients||{}),this.gradients=null,this.defs=t.destroy(),this.unSubPixelFix&&this.unSubPixelFix(),this.alignedObjects=null,null}createElement(t){return new this.Element(this,t)}getRadialAttr(t,e){return{cx:t[0]-t[2]/2+(e.cx||0)*t[2],cy:t[1]-t[2]/2+(e.cy||0)*t[2],r:(e.r||0)*t[2]}}shadowDefinition(t){let e=[`highcharts-drop-shadow-${this.chartIndex}`,...Object.keys(t).map(e=>`${e}-${t[e]}`)].join(\"-\").toLowerCase().replace(/[^a-z\\d\\-]/g,\"\"),i=iI({color:\"#000000\",offsetX:1,offsetY:1,opacity:.15,width:5},t);return this.defs.element.querySelector(`#${e}`)||this.definition({tagName:\"filter\",attributes:{id:e,filterUnits:i.filterUnits},children:this.getShadowFilterContent(i)}),e}getShadowFilterContent(t){return[{tagName:\"feDropShadow\",attributes:{dx:t.offsetX,dy:t.offsetY,\"flood-color\":t.color,\"flood-opacity\":Math.min(5*t.opacity,1),stdDeviation:t.width/2}}]}buildText(t){new ia(t).buildSVG()}getContrast(t){let e=tk.parse(t).rgba.map(t=>{let e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}),i=.2126*e[0]+.7152*e[1]+.0722*e[2];return 1.05/(i+.05)>(i+.05)/.05?\"#FFFFFF\":\"#000000\"}button(t,e,i,s,o={},r,a,n,h,l){let d=this.label(t,e,i,h,void 0,void 0,l,void 0,\"button\"),c=this.styledMode,p=arguments,g=0;o=iI(ih.global.buttonTheme,o),c&&(delete o.fill,delete o.stroke,delete o[\"stroke-width\"]);let u=o.states||{},f=o.style||{};delete o.states,delete o.style;let m=[tK.filterUserAttributes(o)],x=[f];return c||[\"hover\",\"select\",\"disabled\"].forEach((t,e)=>{m.push(iI(m[0],tK.filterUserAttributes(p[e+5]||u[t]||{}))),x.push(m[e+1].style),delete m[e+1].style}),iv(d.element,ig?\"mouseover\":\"mouseenter\",function(){3!==g&&d.setState(1)}),iv(d.element,ig?\"mouseout\":\"mouseleave\",function(){3!==g&&d.setState(g)}),d.setState=(t=0)=>{if(1!==t&&(d.state=g=t),d.removeClass(/highcharts-button-(normal|hover|pressed|disabled)/).addClass(\"highcharts-button-\"+[\"normal\",\"hover\",\"pressed\",\"disabled\"][t]),!c){d.attr(m[t]);let e=x[t];iO(e)&&d.css(e)}},d.attr(m[0]),!c&&(d.css(iA({cursor:\"default\"},f)),l&&d.text.css({pointerEvents:\"none\"})),d.on(\"touchstart\",t=>t.stopPropagation()).on(\"click\",function(t){3!==g&&s.call(d,t)})}crispLine(t,e){let[i,s]=t;return iT(i[1])&&i[1]===s[1]&&(i[1]=s[1]=iM(i[1],e)),iT(i[2])&&i[2]===s[2]&&(i[2]=s[2]=iM(i[2],e)),t}path(t){let e=this.styledMode?{}:{fill:\"none\"};return iP(t)?e.d=t:iO(t)&&iA(e,t),this.createElement(\"path\").attr(e)}circle(t,e,i){let s=iO(t)?t:void 0===t?{}:{x:t,y:e,r:i},o=this.createElement(\"circle\");return o.xSetter=o.ySetter=function(t,e,i){i.setAttribute(\"c\"+e,t)},o.attr(s)}arc(t,e,i,s,o,r){let a;iO(t)?(e=(a=t).y,i=a.r,s=a.innerR,o=a.start,r=a.end,t=a.x):a={innerR:s,start:o,end:r};let n=this.symbol(\"arc\",t,e,i,i,a);return n.r=i,n}rect(t,e,i,s,o,r){let a=iO(t)?t:void 0===t?{}:{x:t,y:e,r:o,width:Math.max(i||0,0),height:Math.max(s||0,0)},n=this.createElement(\"rect\");return this.styledMode||(void 0!==r&&(a[\"stroke-width\"]=r,iA(a,n.crisp(a))),a.fill=\"none\"),n.rSetter=function(t,e,i){n.r=t,ik(i,{rx:t,ry:t})},n.rGetter=function(){return n.r||0},n.attr(a)}roundedRect(t){return this.symbol(\"roundedRect\").attr(t)}setSize(t,e,i){this.width=t,this.height=e,this.boxWrapper.animate({width:t,height:e},{step:function(){this.attr({viewBox:\"0 0 \"+this.attr(\"width\")+\" \"+this.attr(\"height\")})},duration:iD(i,!0)?void 0:0}),this.alignElements()}g(t){let e=this.createElement(\"g\");return t?e.attr({class:\"highcharts-\"+t}):e}image(t,e,i,s,o,r){let a={preserveAspectRatio:\"none\"};iL(e)&&(a.x=e),iL(i)&&(a.y=i),iL(s)&&(a.width=s),iL(o)&&(a.height=o);let n=this.createElement(\"image\").attr(a),h=function(e){n.attr({href:t}),r.call(n,e)};if(r){n.attr({href:\"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\"});let e=new ib.Image;iv(e,\"load\",h),e.src=t,e.complete&&h({})}else n.attr({href:t});return n}symbol(t,e,i,s,o,r){let a,n,h,l;let d=this,c=/^url\\((.*?)\\)$/,p=c.test(t),g=!p&&(this.symbols[t]?t:\"circle\"),u=g&&this.symbols[g];if(u)\"number\"==typeof e&&(n=u.call(this.symbols,e||0,i||0,s||0,o||0,r)),a=this.path(n),d.styledMode||a.attr(\"fill\",\"none\"),iA(a,{symbolName:g||void 0,x:e,y:i,width:s,height:o}),r&&iA(a,r);else if(p){h=t.match(c)[1];let s=a=this.image(h);s.imgwidth=iD(r&&r.width,iy[h]&&iy[h].width),s.imgheight=iD(r&&r.height,iy[h]&&iy[h].height),l=t=>t.attr({width:t.width,height:t.height}),[\"width\",\"height\"].forEach(t=>{s[`${t}Setter`]=function(t,e){this[e]=t;let{alignByTranslate:i,element:s,width:o,height:a,imgwidth:n,imgheight:h}=this,l=\"width\"===e?n:h,d=1;r&&\"within\"===r.backgroundSize&&o&&a&&n&&h?(d=Math.min(o/n,a/h),ik(s,{width:Math.round(n*d),height:Math.round(h*d)})):s&&l&&s.setAttribute(e,l),!i&&n&&h&&this.translate(((o||0)-n*d)/2,((a||0)-h*d)/2)}}),iT(e)&&s.attr({x:e,y:i}),s.isImg=!0,s.symbolUrl=t,iT(s.imgwidth)&&iT(s.imgheight)?l(s):(s.attr({width:0,height:0}),iw(\"img\",{onload:function(){let t=il[d.chartIndex];0===this.width&&(iS(this,{position:\"absolute\",top:\"-999em\"}),ic.body.appendChild(this)),iy[h]={width:this.width,height:this.height},s.imgwidth=this.width,s.imgheight=this.height,s.element&&l(s),this.parentNode&&this.parentNode.removeChild(this),d.imgCount--,d.imgCount||!t||t.hasLoaded||t.onload()},src:h}),this.imgCount++)}return a}clipRect(t,e,i,s){return this.rect(t,e,i,s,0)}text(t,e,i,s){let o={};if(s&&(this.allowHTML||!this.forExport))return this.html(t,e,i);o.x=Math.round(e||0),i&&(o.y=Math.round(i)),iT(t)&&(o.text=t);let r=this.createElement(\"text\").attr(o);return s&&(!this.forExport||this.allowHTML)||(r.xSetter=function(t,e,i){let s=i.getElementsByTagName(\"tspan\"),o=i.getAttribute(e);for(let i=0,r;it.align())}}iA(iR.prototype,{Element:ej,SVG_NS:ix,escapes:{\"&\":\"&\",\"<\":\"<\",\">\":\">\",\"'\":\"'\",'\"':\""\"},symbols:e6,draw:im}),er.registerRendererType(\"svg\",iR,!0);let{composed:iW}=k,{attr:iH,css:iX,createElement:iF,defined:iG,extend:iY,getAlignFactor:ij,isNumber:iU,pInt:i$,pushUnique:iV}=$;function i_(t,e,i){let s=this.div?.style||i.style;ej.prototype[`${e}Setter`].call(this,t,e,i),s&&(s[e]=t)}let iq=(t,e)=>{if(!t.div){let i=iH(t.element,\"class\"),s=t.css,o=iF(\"div\",i?{className:i}:void 0,{position:\"absolute\",left:`${t.translateX||0}px`,top:`${t.translateY||0}px`,...t.styles,display:t.display,opacity:t.opacity,visibility:t.visibility},t.parentGroup?.div||e);t.classSetter=(t,e,i)=>{i.setAttribute(\"class\",t),o.className=t},t.translateXSetter=t.translateYSetter=(e,i)=>{t[i]=e,o.style[\"translateX\"===i?\"left\":\"top\"]=`${e}px`,t.doTransform=!0},t.opacitySetter=t.visibilitySetter=i_,t.css=e=>(s.call(t,e),e.cursor&&(o.style.cursor=e.cursor),e.pointerEvents&&(o.style.pointerEvents=e.pointerEvents),t),t.on=function(){return ej.prototype.on.apply({element:o,onEvents:t.onEvents},arguments),t},t.div=o}return t.div};class iZ extends ej{static compose(t){iV(iW,this.compose)&&(t.prototype.html=function(t,e,i){return new iZ(this,\"span\").attr({text:t,x:Math.round(e),y:Math.round(i)})})}constructor(t,e){super(t,e),this.css({position:\"absolute\",...t.styledMode?{}:{fontFamily:t.style.fontFamily,fontSize:t.style.fontSize}})}getSpanCorrection(t,e,i){this.xCorr=-t*i,this.yCorr=-e}css(t){let e;let{element:i}=this,s=\"SPAN\"===i.tagName&&t&&\"width\"in t,o=s&&t.width;return s&&(delete t.width,this.textWidth=i$(o)||void 0,e=!0),t?.textOverflow===\"ellipsis\"&&(t.overflow=\"hidden\"),t?.lineClamp&&(t.display=\"-webkit-box\",t.WebkitLineClamp=t.lineClamp,t.WebkitBoxOrient=\"vertical\",t.overflow=\"hidden\"),iU(Number(t?.fontSize))&&(t.fontSize=t.fontSize+\"px\"),iY(this.styles,t),iX(i,t),e&&this.updateTransform(),this}htmlGetBBox(){let{element:t}=this;return{x:t.offsetLeft,y:t.offsetTop,width:t.offsetWidth,height:t.offsetHeight}}updateTransform(){if(!this.added){this.alignOnAdd=!0;return}let{element:t,renderer:e,rotation:i,rotationOriginX:s,rotationOriginY:o,scaleX:r,scaleY:a,styles:n,textAlign:h=\"left\",textWidth:l,translateX:d=0,translateY:c=0,x:p=0,y:g=0}=this,{display:u=\"block\",whiteSpace:f}=n;if(iX(t,{marginLeft:`${d}px`,marginTop:`${c}px`}),\"SPAN\"===t.tagName){let n;let d=[i,h,t.innerHTML,l,this.textAlign].join(\",\"),c=-(this.parentGroup?.padding*1)||0;if(l!==this.oldTextWidth){let e=this.textPxLength?this.textPxLength:(iX(t,{width:\"\",whiteSpace:f||\"nowrap\"}),t.offsetWidth),s=l||0;(s>this.oldTextWidth||e>s)&&(/[ \\-]/.test(t.textContent||t.innerText)||\"ellipsis\"===t.style.textOverflow)&&(iX(t,{width:e>s||i||r?l+\"px\":\"auto\",display:u,whiteSpace:f||\"normal\"}),this.oldTextWidth=l)}d!==this.cTT&&(n=e.fontMetrics(t).b,iG(i)&&(i!==(this.oldRotation||0)||h!==this.oldAlign)&&this.setSpanRotation(i,c,c),this.getSpanCorrection(!iG(i)&&!this.textWidth&&this.textPxLength||t.offsetWidth,n,ij(h)));let{xCorr:m=0,yCorr:x=0}=this,y={left:`${p+m}px`,top:`${g+x}px`,textAlign:h,transformOrigin:`${(s??p)-m-p-c}px ${(o??g)-x-g-c}px`};(r||a)&&(y.transform=`scale(${r??1},${a??1})`),iX(t,y),this.cTT=d,this.oldRotation=i,this.oldAlign=h}}setSpanRotation(t,e,i){iX(this.element,{transform:`rotate(${t}deg)`,transformOrigin:`${e}% ${i}px`})}add(t){let e;let i=this.renderer.box.parentNode,s=[];if(this.parentGroup=t,t&&!(e=t.div)){let o=t;for(;o;)s.push(o),o=o.parentGroup;for(let t of s.reverse())e=iq(t,i)}return(e||i).appendChild(this.element),this.added=!0,this.alignOnAdd&&this.updateTransform(),this}textSetter(t){t!==this.textStr&&(delete this.bBox,delete this.oldTextWidth,tK.setElementHTML(this.element,t??\"\"),this.textStr=t,this.doTransform=!0)}alignSetter(t){this.alignValue=this.textAlign=t,this.doTransform=!0}xSetter(t,e){this[e]=t,this.doTransform=!0}}let iK=iZ.prototype;iK.visibilitySetter=iK.opacitySetter=i_,iK.ySetter=iK.rotationSetter=iK.rotationOriginXSetter=iK.rotationOriginYSetter=iK.xSetter,function(t){t.xAxis={alignTicks:!0,allowDecimals:void 0,panningEnabled:!0,zIndex:2,zoomEnabled:!0,dateTimeLabelFormats:{millisecond:{main:\"%[HMSL]\",range:!1},second:{main:\"%[HMS]\",range:!1},minute:{main:\"%[HM]\",range:!1},hour:{main:\"%[HM]\",range:!1},day:{main:\"%[eb]\"},week:{main:\"%[eb]\"},month:{main:\"%[bY]\"},year:{main:\"%Y\"}},endOnTick:!1,gridLineDashStyle:\"Solid\",gridZIndex:1,labels:{autoRotationLimit:80,distance:15,enabled:!0,indentation:10,overflow:\"justify\",reserveSpace:void 0,rotation:void 0,staggerLines:0,step:0,useHTML:!1,zIndex:7,style:{color:\"#333333\",cursor:\"default\",fontSize:\"0.8em\",textOverflow:\"ellipsis\"}},maxPadding:.01,minorGridLineDashStyle:\"Solid\",minorTickLength:2,minorTickPosition:\"outside\",minorTicksPerMajor:5,minPadding:.01,offset:void 0,reversed:void 0,reversedStacks:!1,showEmpty:!0,showFirstLabel:!0,showLastLabel:!0,startOfWeek:1,startOnTick:!1,tickLength:10,tickPixelInterval:100,tickmarkPlacement:\"between\",tickPosition:\"outside\",title:{align:\"middle\",useHTML:!1,x:0,y:0,style:{color:\"#666666\",fontSize:\"0.8em\"}},visible:!0,minorGridLineColor:\"#f2f2f2\",minorGridLineWidth:1,minorTickColor:\"#999999\",lineColor:\"#333333\",lineWidth:1,gridLineColor:\"#e6e6e6\",gridLineWidth:void 0,tickColor:\"#333333\"},t.yAxis={reversedStacks:!0,endOnTick:!0,maxPadding:.05,minPadding:.05,tickPixelInterval:72,showLastLabel:!0,labels:{x:void 0},startOnTick:!0,title:{text:\"Values\"},stackLabels:{animation:{},allowOverlap:!1,enabled:!1,crop:!0,overflow:\"justify\",formatter:function(){let{numberFormatter:t}=this.axis.chart;return t(this.total||0,-1)},style:{color:\"#000000\",fontSize:\"0.7em\",fontWeight:\"bold\",textOutline:\"1px contrast\"}},gridLineWidth:1,lineWidth:0}}(r||(r={}));let iJ=r,{addEvent:iQ,isFunction:i0,objectEach:i1,removeEvent:i2}=$;(a||(a={})).registerEventOptions=function(t,e){t.eventOptions=t.eventOptions||{},i1(e.events,function(e,i){t.eventOptions[i]!==e&&(t.eventOptions[i]&&(i2(t,i,t.eventOptions[i]),delete t.eventOptions[i]),i0(e)&&(t.eventOptions[i]=e,iQ(t,i,e,{order:0})))})};let i3=a,{deg2rad:i5}=k,{clamp:i6,correctFloat:i9,defined:i4,destroyObjectProperties:i8,extend:i7,fireEvent:st,getAlignFactor:se,isNumber:si,merge:ss,objectEach:so,pick:sr}=$,sa=class{constructor(t,e,i,s,o){this.isNew=!0,this.isNewLabel=!0,this.axis=t,this.pos=e,this.type=i||\"\",this.parameters=o||{},this.tickmarkOffset=this.parameters.tickmarkOffset,this.options=this.parameters.options,st(this,\"init\"),i||s||this.addLabel()}addLabel(){let t=this,e=t.axis,i=e.options,s=e.chart,o=e.categories,r=e.logarithmic,a=e.names,n=t.pos,h=sr(t.options&&t.options.labels,i.labels),l=e.tickPositions,d=n===l[0],c=n===l[l.length-1],p=(!h.step||1===h.step)&&1===e.tickInterval,g=l.info,u=t.label,f,m,x,y=this.parameters.category||(o?sr(o[n],a[n],n):n);r&&si(y)&&(y=i9(r.lin2log(y))),e.dateTime&&(g?f=(m=s.time.resolveDTLFormat(i.dateTimeLabelFormats[!i.grid&&g.higherRanks[n]||g.unitName])).main:si(y)&&(f=e.dateTime.getXDateFormat(y,i.dateTimeLabelFormats||{}))),t.isFirst=d,t.isLast=c;let b={axis:e,chart:s,dateTimeLabelFormat:f,isFirst:d,isLast:c,pos:n,tick:t,tickPositionInfo:g,value:y};st(this,\"labelFormat\",b);let v=t=>h.formatter?h.formatter.call(t,t):h.format?(t.text=e.defaultLabelFormatter.call(t),eo.format(h.format,t,s)):e.defaultLabelFormatter.call(t),k=v.call(b,b),w=m&&m.list;w?t.shortenLabel=function(){for(x=0;x0&&s+d*c>n&&(x=Math.round((o-s)/Math.cos(l*i5))):(f=s-d*c,m=s+(1-d)*c,fn&&(g=n-t.x+g*d,u=-1),(g=Math.min(p,g))g||e.autoRotation&&(h.styles||{}).width)&&(x=g)),x&&h&&(this.shortenLabel?this.shortenLabel():h.css(i7({},{width:Math.floor(x)+\"px\",lineClamp:e.isRadial?0:1})))}moveLabel(t,e){let i=this,s=i.label,o=i.axis,r=!1,a;s&&s.textStr===t?(i.movedLabel=s,r=!0,delete i.label):so(o.ticks,function(e){r||e.isNew||e===i||!e.label||e.label.textStr!==t||(i.movedLabel=e.label,r=!0,e.labelPos=i.movedLabel.xy,delete e.label)}),!r&&(i.labelPos||s)&&(a=i.labelPos||s.xy,i.movedLabel=i.createLabel(t,e,a),i.movedLabel&&i.movedLabel.attr({opacity:0}))}render(t,e,i){let s=this.axis,o=s.horiz,r=this.pos,a=sr(this.tickmarkOffset,s.tickmarkOffset),n=this.getPosition(o,r,a,e),h=n.x,l=n.y,d=s.pos,c=d+s.len,p=o?h:l;!s.chart.polar&&this.isNew&&(i9(p)c)&&(i=0);let g=sr(i,this.label&&this.label.newOpacity,1);i=sr(i,1),this.isActive=!0,this.renderGridLine(e,i),this.renderMark(n,i),this.renderLabel(n,e,g,t),this.isNew=!1,st(this,\"afterRender\")}renderGridLine(t,e){let i=this.axis,s=i.options,o={},r=this.pos,a=this.type,n=sr(this.tickmarkOffset,i.tickmarkOffset),h=i.chart.renderer,l=this.gridLine,d,c=s.gridLineWidth,p=s.gridLineColor,g=s.gridLineDashStyle;\"minor\"===this.type&&(c=s.minorGridLineWidth,p=s.minorGridLineColor,g=s.minorGridLineDashStyle),l||(i.chart.styledMode||(o.stroke=p,o[\"stroke-width\"]=c||0,o.dashstyle=g),a||(o.zIndex=1),t&&(e=0),this.gridLine=l=h.path().attr(o).addClass(\"highcharts-\"+(a?a+\"-\":\"\")+\"grid-line\").add(i.gridGroup)),l&&(d=i.getPlotLinePath({value:r+n,lineWidth:l.strokeWidth(),force:\"pass\",old:t,acrossPanes:!1}))&&l[t||this.isNew?\"attr\":\"animate\"]({d:d,opacity:e})}renderMark(t,e){let i=this.axis,s=i.options,o=i.chart.renderer,r=this.type,a=i.tickSize(r?r+\"Tick\":\"tick\"),n=t.x,h=t.y,l=sr(s[\"minor\"!==r?\"tickWidth\":\"minorTickWidth\"],!r&&i.isXAxis?1:0),d=s[\"minor\"!==r?\"tickColor\":\"minorTickColor\"],c=this.mark,p=!c;a&&(i.opposite&&(a[0]=-a[0]),c||(this.mark=c=o.path().addClass(\"highcharts-\"+(r?r+\"-\":\"\")+\"tick\").add(i.axisGroup),i.chart.styledMode||c.attr({stroke:d,\"stroke-width\":l})),c[p?\"attr\":\"animate\"]({d:this.getMarkPath(n,h,a[0],c.strokeWidth(),i.horiz,o),opacity:e}))}renderLabel(t,e,i,s){let o=this.axis,r=o.horiz,a=o.options,n=this.label,h=a.labels,l=h.step,d=sr(this.tickmarkOffset,o.tickmarkOffset),c=t.x,p=t.y,g=!0;n&&si(c)&&(n.xy=t=this.getLabelPosition(c,p,n,r,h,d,s,l),(!this.isFirst||this.isLast||a.showFirstLabel)&&(!this.isLast||this.isFirst||a.showLastLabel)?!r||h.step||h.rotation||e||0===i||this.handleOverflow(t):g=!1,l&&s%l&&(g=!1),g&&si(t.y)?(t.opacity=i,n[this.isNewLabel?\"attr\":\"animate\"](t).show(!0),this.isNewLabel=!1):(n.hide(),this.isNewLabel=!0))}replaceMovedLabel(){let t=this.label,e=this.axis;t&&!this.isNew&&(t.animate({opacity:0},void 0,t.destroy),delete this.label),e.isDirty=!0,this.label=this.movedLabel,delete this.movedLabel}},{animObject:sn}=tR,{xAxis:sh,yAxis:sl}=iJ,{defaultOptions:sd}=tm,{registerEventOptions:sc}=i3,{deg2rad:sp}=k,{arrayMax:sg,arrayMin:su,clamp:sf,correctFloat:sm,defined:sx,destroyObjectProperties:sy,erase:sb,error:sv,extend:sk,fireEvent:sw,getClosestDistance:sM,insertItem:sS,isArray:sT,isNumber:sC,isString:sA,merge:sP,normalizeTickInterval:sL,objectEach:sO,pick:sE,relativeLength:sI,removeEvent:sD,splat:sB,syncTimeout:sN}=$,sz=(t,e)=>sL(e,void 0,void 0,sE(t.options.allowDecimals,e<.5||void 0!==t.tickAmount),!!t.tickAmount);sk(sd,{xAxis:sh,yAxis:sP(sh,sl)});class sR{constructor(t,e,i){this.init(t,e,i)}init(t,e,i=this.coll){let s=\"xAxis\"===i,o=this.isZAxis||(t.inverted?!s:s);this.chart=t,this.horiz=o,this.isXAxis=s,this.coll=i,sw(this,\"init\",{userOptions:e}),this.opposite=sE(e.opposite,this.opposite),this.side=sE(e.side,this.side,o?this.opposite?0:2:this.opposite?1:3),this.setOptions(e);let r=this.options,a=r.labels;this.type??(this.type=r.type||\"linear\"),this.uniqueNames??(this.uniqueNames=r.uniqueNames??!0),sw(this,\"afterSetType\"),this.userOptions=e,this.minPixelPadding=0,this.reversed=sE(r.reversed,this.reversed),this.visible=r.visible,this.zoomEnabled=r.zoomEnabled,this.hasNames=\"category\"===this.type||!0===r.categories,this.categories=sT(r.categories)&&r.categories||(this.hasNames?[]:void 0),this.names||(this.names=[],this.names.keys={}),this.plotLinesAndBandsGroups={},this.positiveValuesOnly=!!this.logarithmic,this.isLinked=sx(r.linkedTo),this.ticks={},this.labelEdge=[],this.minorTicks={},this.plotLinesAndBands=[],this.alternateBands={},this.len??(this.len=0),this.minRange=this.userMinRange=r.minRange||r.maxZoom,this.range=r.range,this.offset=r.offset||0,this.max=void 0,this.min=void 0;let n=sE(r.crosshair,sB(t.options.tooltip.crosshairs)[s?0:1]);this.crosshair=!0===n?{}:n,-1===t.axes.indexOf(this)&&(s?t.axes.splice(t.xAxis.length,0,this):t.axes.push(this),sS(this,t[this.coll])),t.orderItems(this.coll),this.series=this.series||[],t.inverted&&!this.isZAxis&&s&&!sx(this.reversed)&&(this.reversed=!0),this.labelRotation=sC(a.rotation)?a.rotation:void 0,sc(this,r),sw(this,\"afterInit\")}setOptions(t){let e=this.horiz?{labels:{autoRotation:[-45],padding:3},margin:15}:{labels:{padding:1},title:{rotation:90*this.side}};this.options=sP(e,sd[this.coll],t),sw(this,\"afterSetOptions\",{userOptions:t})}defaultLabelFormatter(){let t=this.axis,{numberFormatter:e}=this.chart,i=sC(this.value)?this.value:NaN,s=t.chart.time,o=t.categories,r=this.dateTimeLabelFormat,a=sd.lang,n=a.numericSymbols,h=a.numericSymbolMagnitude||1e3,l=t.logarithmic?Math.abs(i):t.tickInterval,d=n&&n.length,c,p;if(o)p=`${this.value}`;else if(r)p=s.dateFormat(r,i,!0);else if(d&&n&&l>=1e3)for(;d--&&void 0===p;)l>=(c=Math.pow(h,d+1))&&10*i%c==0&&null!==n[d]&&0!==i&&(p=e(i/c,-1)+n[d]);return void 0===p&&(p=Math.abs(i)>=1e4?e(i,-1):e(i,-1,void 0,\"\")),p}getSeriesExtremes(){let t;let e=this;sw(this,\"getSeriesExtremes\",null,function(){e.hasVisibleSeries=!1,e.dataMin=e.dataMax=e.threshold=void 0,e.softThreshold=!e.isXAxis,e.series.forEach(i=>{if(i.reserveSpace()){let s=i.options,o,r=s.threshold,a,n;if(e.hasVisibleSeries=!0,e.positiveValuesOnly&&0>=(r||0)&&(r=void 0),e.isXAxis)(o=i.getColumn(\"x\")).length&&(o=e.logarithmic?o.filter(t=>t>0):o,a=(t=i.getXExtremes(o)).min,n=t.max,sC(a)||a instanceof Date||(o=o.filter(sC),a=(t=i.getXExtremes(o)).min,n=t.max),o.length&&(e.dataMin=Math.min(sE(e.dataMin,a),a),e.dataMax=Math.max(sE(e.dataMax,n),n)));else{let t=i.applyExtremes();sC(t.dataMin)&&(a=t.dataMin,e.dataMin=Math.min(sE(e.dataMin,a),a)),sC(t.dataMax)&&(n=t.dataMax,e.dataMax=Math.max(sE(e.dataMax,n),n)),sx(r)&&(e.threshold=r),(!s.softThreshold||e.positiveValuesOnly)&&(e.softThreshold=!1)}}})}),sw(this,\"afterGetSeriesExtremes\")}translate(t,e,i,s,o,r){let a=this.linkedParent||this,n=s&&a.old?a.old.min:a.min;if(!sC(n))return NaN;let h=a.minPixelPadding,l=(a.isOrdinal||a.brokenAxis?.hasBreaks||a.logarithmic&&o)&&a.lin2val,d=1,c=0,p=s&&a.old?a.old.transA:a.transA,g=0;return p||(p=a.transA),i&&(d*=-1,c=a.len),a.reversed&&(d*=-1,c-=d*(a.sector||a.len)),e?(g=(t=t*d+c-h)/p+n,l&&(g=a.lin2val(g))):(l&&(t=a.val2lin(t)),g=d*(t-n)*p+c+d*h+(sC(r)?p*r:0),a.isRadial||(g=sm(g))),g}toPixels(t,e){return this.translate(this.chart?.time.parse(t)??NaN,!1,!this.horiz,void 0,!0)+(e?0:this.pos)}toValue(t,e){return this.translate(t-(e?0:this.pos),!0,!this.horiz,void 0,!0)}getPlotLinePath(t){let e=this,i=e.chart,s=e.left,o=e.top,r=t.old,a=t.value,n=t.lineWidth,h=r&&i.oldChartHeight||i.chartHeight,l=r&&i.oldChartWidth||i.chartWidth,d=e.transB,c=t.translatedValue,p=t.force,g,u,f,m,x;function y(t,e,i){return\"pass\"!==p&&(ti)&&(p?t=sf(t,e,i):x=!0),t}let b={value:a,lineWidth:n,old:r,force:p,acrossPanes:t.acrossPanes,translatedValue:c};return sw(this,\"getPlotLinePath\",b,function(t){g=f=(c=sf(c=sE(c,e.translate(a,void 0,void 0,r)),-1e9,1e9))+d,u=m=h-c-d,sC(c)?e.horiz?(u=o,m=h-e.bottom+(e.options.isInternal?0:i.scrollablePixelsY||0),g=f=y(g,s,s+e.width)):(g=s,f=l-e.right+(i.scrollablePixelsX||0),u=m=y(u,o,o+e.height)):(x=!0,p=!1),t.path=x&&!p?void 0:i.renderer.crispLine([[\"M\",g,u],[\"L\",f,m]],n||1)}),b.path}getLinearTickPositions(t,e,i){let s,o,r;let a=sm(Math.floor(e/t)*t),n=sm(Math.ceil(i/t)*t),h=[];if(sm(a+t)===a&&(r=20),this.single)return[e];for(s=a;s<=n&&(h.push(s),(s=sm(s+t,r))!==o);)o=s;return h}getMinorTickInterval(){let{minorTicks:t,minorTickInterval:e}=this.options;return!0===t?sE(e,\"auto\"):!1!==t?e:void 0}getMinorTickPositions(){let t=this.options,e=this.tickPositions,i=this.minorTickInterval,s=this.pointRangePadding||0,o=(this.min||0)-s,r=(this.max||0)+s,a=this.brokenAxis?.hasBreaks?this.brokenAxis.unitLength:r-o,n=[],h;if(a&&a/i{let e=t.getColumn(\"x\");return t.xIncrement?e.slice(0,2):e}))||0),this.dataMax-this.dataMin)),sC(s)&&sC(o)&&sC(r)&&s-o=r,a=(r-s+o)/2,h=[o-a,i.parse(t.min)??o-a],n&&(h[2]=e?e.log2lin(this.dataMin):this.dataMin),l=[(o=sg(h))+r,i.parse(t.max)??o+r],n&&(l[2]=e?e.log2lin(this.dataMax):this.dataMax),(s=su(l))-ot-e),t=sM([i]))}return t&&e?Math.min(t,e):t||e}nameToX(t){let e=sT(this.options.categories),i=e?this.categories:this.names,s=t.options.x,o;return t.series.requireSorting=!1,sx(s)||(s=this.uniqueNames&&i?e?i.indexOf(t.name):sE(i.keys[t.name],-1):t.series.autoIncrement()),-1===s?!e&&i&&(o=i.length):sC(s)&&(o=s),void 0!==o?(this.names[o]=t.name,this.names.keys[t.name]=o):t.x&&(o=t.x),o}updateNames(){let t=this,e=this.names;e.length>0&&(Object.keys(e.keys).forEach(function(t){delete e.keys[t]}),e.length=0,this.minRange=this.userMinRange,(this.series||[]).forEach(e=>{e.xIncrement=null,(!e.points||e.isDirtyData)&&(t.max=Math.max(t.max||0,e.dataTable.rowCount-1),e.processData(),e.generatePoints());let i=e.getColumn(\"x\").slice();e.data.forEach((e,s)=>{let o=i[s];e?.options&&void 0!==e.name&&void 0!==(o=t.nameToX(e))&&o!==e.x&&(i[s]=e.x=o)}),e.dataTable.setColumn(\"x\",i)}))}setAxisTranslation(){let t=this,e=t.max-t.min,i=t.linkedParent,s=!!t.categories,o=t.isXAxis,r=t.axisPointRange||0,a,n=0,h=0,l,d=t.transA;(o||s||r)&&(a=t.getClosest(),i?(n=i.minPointOffset,h=i.pointRangePadding):t.series.forEach(function(e){let i=s?1:o?sE(e.options.pointRange,a,0):t.axisPointRange||0,l=e.options.pointPlacement;if(r=Math.max(r,i),!t.single||s){let t=e.is(\"xrange\")?!o:o;n=Math.max(n,t&&sA(l)?0:i/2),h=Math.max(h,t&&\"on\"===l?0:i)}}),l=t.ordinal&&t.ordinal.slope&&a?t.ordinal.slope/a:1,t.minPointOffset=n*=l,t.pointRangePadding=h*=l,t.pointRange=Math.min(r,t.single&&s?1:e),o&&a&&(t.closestPointRange=a)),t.translationSlope=t.transA=d=t.staticScale||t.len/(e+h||1),t.transB=t.horiz?t.left:t.bottom,t.minPixelPadding=d*n,sw(this,\"afterSetAxisTranslation\")}minFromRange(){let{max:t,min:e}=this;return sC(t)&&sC(e)&&t-e||void 0}setTickInterval(t){let{categories:e,chart:i,dataMax:s,dataMin:o,dateTime:r,isXAxis:a,logarithmic:n,options:h,softThreshold:l}=this,d=i.time,c=sC(this.threshold)?this.threshold:void 0,p=this.minRange||0,{ceiling:g,floor:u,linkedTo:f,softMax:m,softMin:x}=h,y=sC(f)&&i[this.coll]?.[f],b=h.tickPixelInterval,v=h.maxPadding,k=h.minPadding,w=0,M,S=sC(h.tickInterval)&&h.tickInterval>=0?h.tickInterval:void 0,T,C,A,P;if(r||e||y||this.getTickAmount(),A=sE(this.userMin,d.parse(h.min)),P=sE(this.userMax,d.parse(h.max)),y?(this.linkedParent=y,M=y.getExtremes(),this.min=sE(M.min,M.dataMin),this.max=sE(M.max,M.dataMax),this.type!==y.type&&sv(11,!0,i)):(l&&sx(c)&&sC(s)&&sC(o)&&(o>=c?(T=c,k=0):s<=c&&(C=c,v=0)),this.min=sE(A,T,o),this.max=sE(P,C,s)),sC(this.max)&&sC(this.min)&&(n&&(this.positiveValuesOnly&&!t&&0>=Math.min(this.min,sE(o,this.min))&&sv(10,!0,i),this.min=sm(n.log2lin(this.min),16),this.max=sm(n.log2lin(this.max),16)),this.range&&sC(o)&&(this.userMin=this.min=A=Math.max(o,this.minFromRange()||0),this.userMax=P=this.max,this.range=void 0)),sw(this,\"foundExtremes\"),this.adjustForMinRange(),sC(this.min)&&sC(this.max)){if(!sC(this.userMin)&&sC(x)&&xthis.max&&(this.max=P=m),e||this.axisPointRange||this.stacking?.usePercentage||y||!(w=this.max-this.min)||(!sx(A)&&k&&(this.min-=w*k),sx(P)||!v||(this.max+=w*v)),!sC(this.userMin)&&sC(u)&&(this.min=Math.max(this.min,u)),!sC(this.userMax)&&sC(g)&&(this.max=Math.min(this.max,g)),l&&sC(o)&&sC(s)){let t=c||0;!sx(A)&&this.min=t?this.min=h.minRange?Math.min(t,this.max-p):t:!sx(P)&&this.max>t&&s<=t&&(this.max=h.minRange?Math.max(t,this.min+p):t)}!i.polar&&this.min>this.max&&(sx(h.min)?this.max=this.min:sx(h.max)&&(this.min=this.max)),w=this.max-this.min}if(this.min!==this.max&&sC(this.min)&&sC(this.max)?y&&!S&&b===y.options.tickPixelInterval?this.tickInterval=S=y.tickInterval:this.tickInterval=sE(S,this.tickAmount?w/Math.max(this.tickAmount-1,1):void 0,e?1:w*b/Math.max(this.len,b)):this.tickInterval=1,a&&!t){let t=this.min!==this.old?.min||this.max!==this.old?.max;this.series.forEach(function(e){e.forceCrop=e.forceCropping?.(),e.processData(t)}),sw(this,\"postProcessData\",{hasExtremesChanged:t})}this.setAxisTranslation(),sw(this,\"initialAxisTranslation\"),this.pointRange&&!S&&(this.tickInterval=Math.max(this.pointRange,this.tickInterval));let L=sE(h.minTickInterval,r&&!this.series.some(t=>!t.sorted)?this.closestPointRange:0);!S&&this.tickIntervalMath.max(2*this.len,200))n=[this.min,this.max],sv(19,!1,this.chart);else if(this.dateTime)n=this.getTimeTicks(this.dateTime.normalizeTimeTickInterval(this.tickInterval,t.units),this.min,this.max,t.startOfWeek,this.ordinal?.positions,this.closestPointRange,!0);else if(this.logarithmic)n=this.logarithmic.getLogTickPositions(this.tickInterval,this.min,this.max);else{let t=this.tickInterval,e=t;for(;e<=2*t;)if(n=this.getLinearTickPositions(this.tickInterval,this.min,this.max),this.tickAmount&&n.length>this.tickAmount)this.tickInterval=sz(this,e*=1.1);else break}n.length>this.len&&(n=[n[0],n[n.length-1]])[0]===n[1]&&(n.length=1),i&&(this.tickPositions=n,(h=i.apply(this,[this.min,this.max]))&&(n=h))}this.tickPositions=n,this.minorTickInterval=\"auto\"===s&&this.tickInterval?this.tickInterval/t.minorTicksPerMajor:s,this.paddedTicks=n.slice(0),this.trimTicks(n,r,a),!this.isLinked&&sC(this.min)&&sC(this.max)&&(this.single&&n.length<2&&!this.categories&&!this.series.some(t=>t.is(\"heatmap\")&&\"between\"===t.options.pointPlacement)&&(this.min-=.5,this.max+=.5),e||h||this.adjustTickAmount()),sw(this,\"afterSetTickPositions\")}trimTicks(t,e,i){let s=t[0],o=t[t.length-1],r=!this.isOrdinal&&this.minPointOffset||0;if(sw(this,\"trimTicks\"),!this.isLinked){if(e&&s!==-1/0)this.min=s;else for(;this.min-r>t[0];)t.shift();if(i)this.max=o;else for(;this.max+r{let{horiz:e,options:i}=t;return[e?i.left:i.top,i.width,i.height,i.pane].join(\",\")},r=o(this);i[this.coll].forEach(function(i){let{series:a}=i;a.length&&a.some(t=>t.visible)&&i!==e&&o(i)===r&&(t=!0,s.push(i))})}if(t&&a){s.forEach(t=>{let i=t.getThresholdAlignment(e);sC(i)&&n.push(i)});let t=n.length>1?n.reduce((t,e)=>t+=e,0)/n.length:void 0;s.forEach(e=>{e.thresholdAlignment=t})}return t}getThresholdAlignment(t){if((!sC(this.dataMin)||this!==t&&this.series.some(t=>t.isDirty||t.isDirtyData))&&this.getSeriesExtremes(),sC(this.threshold)){let t=sf((this.threshold-(this.dataMin||0))/((this.dataMax||0)-(this.dataMin||0)),0,1);return this.options.reversed&&(t=1-t),t}}getTickAmount(){let t=this.options,e=t.tickPixelInterval,i=t.tickAmount;sx(t.tickInterval)||i||!(this.lenr.push(sm(r[r.length-1]+p)),f=()=>r.unshift(sm(r[0]-p));if(sC(n)&&(g=n<.5?Math.ceil(n*(a-1)):Math.floor(n*(a-1)),o.reversed&&(g=a-1-g)),t.hasData()&&sC(s)&&sC(i)){let n=()=>{t.transA*=(h-1)/(a-1),t.min=o.startOnTick?r[0]:Math.min(s,r[0]),t.max=o.endOnTick?r[r.length-1]:Math.max(i,r[r.length-1])};if(sC(g)&&sC(t.threshold)){for(;r[g]!==l||r.length!==a||r[0]>s||r[r.length-1]t.threshold?f():u();if(p>8*t.tickInterval)break;p*=2}n()}else if(h0&&c{i=i||t.isDirtyData||t.isDirty,s=s||t.xAxis&&t.xAxis.isDirty||!1}),this.setAxisSize();let o=this.len!==(this.old&&this.old.len);o||i||s||this.isLinked||this.forceRedraw||this.userMin!==(this.old&&this.old.userMin)||this.userMax!==(this.old&&this.old.userMax)||this.alignToOthers()?(e&&\"yAxis\"===t&&e.buildStacks(),this.forceRedraw=!1,this.userMinRange||(this.minRange=void 0),this.getSeriesExtremes(),this.setTickInterval(),e&&\"xAxis\"===t&&e.buildStacks(),this.isDirty||(this.isDirty=o||this.min!==this.old?.min||this.max!==this.old?.max)):e&&e.cleanStacks(),i&&delete this.allExtremes,sw(this,\"afterSetScale\")}setExtremes(t,e,i=!0,s,o){let r=this.chart;this.series.forEach(t=>{delete t.kdTree}),t=r.time.parse(t),e=r.time.parse(e),sw(this,\"setExtremes\",o=sk(o,{min:t,max:e}),t=>{this.userMin=t.min,this.userMax=t.max,this.eventArgs=t,i&&r.redraw(s)})}setAxisSize(){let t=this.chart,e=this.options,i=e.offsets||[0,0,0,0],s=this.horiz,o=this.width=Math.round(sI(sE(e.width,t.plotWidth-i[3]+i[1]),t.plotWidth)),r=this.height=Math.round(sI(sE(e.height,t.plotHeight-i[0]+i[2]),t.plotHeight)),a=this.top=Math.round(sI(sE(e.top,t.plotTop+i[0]),t.plotHeight,t.plotTop)),n=this.left=Math.round(sI(sE(e.left,t.plotLeft+i[3]),t.plotWidth,t.plotLeft));this.bottom=t.chartHeight-r-a,this.right=t.chartWidth-o-n,this.len=Math.max(s?o:r,0),this.pos=s?n:a}getExtremes(){let t=this.logarithmic;return{min:t?sm(t.lin2log(this.min)):this.min,max:t?sm(t.lin2log(this.max)):this.max,dataMin:this.dataMin,dataMax:this.dataMax,userMin:this.userMin,userMax:this.userMax}}getThreshold(t){let e=this.logarithmic,i=e?e.lin2log(this.min):this.min,s=e?e.lin2log(this.max):this.max;return null===t||t===-1/0?t=i:t===1/0?t=s:i>t?t=i:s15&&e<165?t.align=\"right\":e>195&&e<345&&(t.align=\"left\")}),i.align}tickSize(t){let e=this.options,i=sE(e[\"tick\"===t?\"tickWidth\":\"minorTickWidth\"],\"tick\"===t&&this.isXAxis&&!this.categories?1:0),s=e[\"tick\"===t?\"tickLength\":\"minorTickLength\"],o;i&&s&&(\"inside\"===e[t+\"Position\"]&&(s=-s),o=[s,i]);let r={tickSize:o};return sw(this,\"afterTickSize\",r),r.tickSize}labelMetrics(){let t=this.chart.renderer,e=this.ticks,i=e[Object.keys(e)[0]]||{};return this.chart.renderer.fontMetrics(i.label||i.movedLabel||t.box)}unsquish(){let t=this.options.labels,e=t.padding||0,i=this.horiz,s=this.tickInterval,o=this.len/(((this.categories?1:0)+this.max-this.min)/s),r=t.rotation,a=sm(.8*this.labelMetrics().h),n=Math.max(this.max-this.min,0),h=function(t){let i=(t+2*e)/(o||1);return(i=i>1?Math.ceil(i):1)*s>n&&t!==1/0&&o!==1/0&&n&&(i=Math.ceil(n/s)),sm(i*s)},l=s,d,c=Number.MAX_VALUE,p;if(i){if(!t.staggerLines&&(sC(r)?p=[r]:o=-90&&i<=90)&&(e=(t=h(Math.abs(a/Math.sin(sp*i))))+Math.abs(i/360))u&&(u=i)}),this.maxLabelLength=u,this.autoRotation?u>h&&u>d.h?l.rotation=this.labelRotation:this.labelRotation=0:n&&(p=h),l.rotation&&(p=u>.5*t.chartHeight?.33*t.chartHeight:u,c||(g=1)),this.labelAlign=o.align||this.autoLabelAlign(this.labelRotation),this.labelAlign&&(l.align=this.labelAlign),i.forEach(function(t){let e=s[t],i=e&&e.label,o=r.width,a={};i&&(i.attr(l),e.shortenLabel?e.shortenLabel():p&&!o&&\"nowrap\"!==r.whiteSpace&&(p<(i.textPxLength||0)||\"SPAN\"===i.element.tagName)?i.css(sk(a,{width:`${p}px`,lineClamp:g})):!i.styles.width||a.width||o||i.css({width:\"auto\"}),e.rotation=l.rotation)},this),this.tickRotCorr=e.rotCorr(d.b,this.labelRotation||0,0!==this.side)}hasData(){return this.series.some(function(t){return t.hasData()})||this.options.showEmpty&&sx(this.min)&&sx(this.max)}addTitle(t){let e;let i=this.chart.renderer,s=this.horiz,o=this.opposite,r=this.options.title,a=this.chart.styledMode;this.axisTitle||((e=r.textAlign)||(e=(s?{low:\"left\",middle:\"center\",high:\"right\"}:{low:o?\"right\":\"left\",middle:\"center\",high:o?\"left\":\"right\"})[r.align]),this.axisTitle=i.text(r.text||\"\",0,0,r.useHTML).attr({zIndex:7,rotation:r.rotation||0,align:e}).addClass(\"highcharts-axis-title\"),a||this.axisTitle.css(sP(r.style)),this.axisTitle.add(this.axisGroup),this.axisTitle.isNew=!0),a||r.style.width||this.isRadial||this.axisTitle.css({width:this.len+\"px\"}),this.axisTitle[t?\"show\":\"hide\"](t)}generateTick(t){let e=this.ticks;e[t]?e[t].addLabel():e[t]=new sa(this,t)}createGroups(){let{axisParent:t,chart:e,coll:i,options:s}=this,o=e.renderer,r=(e,r,a)=>o.g(e).attr({zIndex:a}).addClass(`highcharts-${i.toLowerCase()}${r} `+(this.isRadial?`highcharts-radial-axis${r} `:\"\")+(s.className||\"\")).add(t);this.axisGroup||(this.gridGroup=r(\"grid\",\"-grid\",s.gridZIndex),this.axisGroup=r(\"axis\",\"\",s.zIndex),this.labelGroup=r(\"axis-labels\",\"-labels\",s.labels.zIndex))}getOffset(){let t=this,{chart:e,horiz:i,options:s,side:o,ticks:r,tickPositions:a,coll:n}=t,h=e.inverted&&!t.isZAxis?[1,0,3,2][o]:o,l=t.hasData(),d=s.title,c=s.labels,p=sC(s.crossing),g=e.axisOffset,u=e.clipOffset,f=[-1,1,1,-1][o],m,x=0,y,b=0,v=0,k,w;if(t.showAxis=m=l||s.showEmpty,t.staggerLines=t.horiz&&c.staggerLines||void 0,t.createGroups(),l||t.isLinked?(a.forEach(function(e){t.generateTick(e)}),t.renderUnsquish(),t.reserveSpaceDefault=0===o||2===o||({1:\"left\",3:\"right\"})[o]===t.labelAlign,sE(c.reserveSpace,!p&&null,\"center\"===t.labelAlign||null,t.reserveSpaceDefault)&&a.forEach(function(t){v=Math.max(r[t].getLabelSize(),v)}),t.staggerLines&&(v*=t.staggerLines),t.labelOffset=v*(t.opposite?-1:1)):sO(r,function(t,e){t.destroy(),delete r[e]}),d?.text&&!1!==d.enabled&&(t.addTitle(m),m&&!p&&!1!==d.reserveSpace&&(t.titleOffset=x=t.axisTitle.getBBox()[i?\"height\":\"width\"],b=sx(y=d.offset)?0:sE(d.margin,i?5:10))),t.renderLine(),t.offset=f*sE(s.offset,g[o]?g[o]+(s.margin||0):0),t.tickRotCorr=t.tickRotCorr||{x:0,y:0},w=0===o?-t.labelMetrics().h:2===o?t.tickRotCorr.y:0,k=Math.abs(v)+b,v&&(k-=w,k+=f*(i?sE(c.y,t.tickRotCorr.y+f*c.distance):sE(c.x,f*c.distance))),t.axisTitleMargin=sE(y,k),t.getMaxLabelDimensions&&(t.maxLabelDimensions=t.getMaxLabelDimensions(r,a)),\"colorAxis\"!==n&&u){let e=this.tickSize(\"tick\");g[o]=Math.max(g[o],(t.axisTitleMargin||0)+x+f*t.offset,k,a&&a.length&&e?e[0]+f*t.offset:0);let i=!t.axisLine||s.offset?0:t.axisLine.strokeWidth()/2;u[h]=Math.max(u[h],i)}sw(this,\"afterGetOffset\")}getLinePath(t){let e=this.chart,i=this.opposite,s=this.offset,o=this.horiz,r=this.left+(i?this.width:0)+s,a=e.chartHeight-this.bottom-(i?this.height:0)+s;return i&&(t*=-1),e.renderer.crispLine([[\"M\",o?this.left:r,o?a:this.top],[\"L\",o?e.chartWidth-this.right:r,o?a:e.chartHeight-this.bottom]],t)}renderLine(){this.axisLine||(this.axisLine=this.chart.renderer.path().addClass(\"highcharts-axis-line\").add(this.axisGroup),this.chart.styledMode||this.axisLine.attr({stroke:this.options.lineColor,\"stroke-width\":this.options.lineWidth,zIndex:7}))}getTitlePosition(t){let e=this.horiz,i=this.left,s=this.top,o=this.len,r=this.options.title,a=e?i:s,n=this.opposite,h=this.offset,l=r.x,d=r.y,c=this.chart.renderer.fontMetrics(t),p=t?Math.max(t.getBBox(!1,0).height-c.h-1,0):0,g={low:a+(e?0:o),middle:a+o/2,high:a+(e?o:0)}[r.align],u=(e?s+this.height:i)+(e?1:-1)*(n?-1:1)*(this.axisTitleMargin||0)+[-p,p,c.f,-p][this.side],f={x:e?g+l:u+(n?this.width:0)+h+l,y:e?u+d-(n?this.height:0)+h:g+d};return sw(this,\"afterGetTitlePosition\",{titlePosition:f}),f}renderMinorTick(t,e){let i=this.minorTicks;i[t]||(i[t]=new sa(this,t,\"minor\")),e&&i[t].isNew&&i[t].render(null,!0),i[t].render(null,!1,1)}renderTick(t,e,i){let s=this.isLinked,o=this.ticks;(!s||t>=this.min&&t<=this.max||this.grid&&this.grid.isColumn)&&(o[t]||(o[t]=new sa(this,t)),i&&o[t].isNew&&o[t].render(e,!0,-1),o[t].render(e))}render(){let t,e;let i=this,s=i.chart,o=i.logarithmic,r=s.renderer,a=i.options,n=i.isLinked,h=i.tickPositions,l=i.axisTitle,d=i.ticks,c=i.minorTicks,p=i.alternateBands,g=a.stackLabels,u=a.alternateGridColor,f=a.crossing,m=i.tickmarkOffset,x=i.axisLine,y=i.showAxis,b=sn(r.globalAnimation);if(i.labelEdge.length=0,i.overlap=!1,[d,c,p].forEach(function(t){sO(t,function(t){t.isActive=!1})}),sC(f)){let t=this.isXAxis?s.yAxis[0]:s.xAxis[0],e=[1,-1,-1,1][this.side];if(t){let s=t.toPixels(f,!0);i.horiz&&(s=t.len-s),i.offset=e*s}}if(i.hasData()||n){let r=i.chart.hasRendered&&i.old&&sC(i.old.min);i.minorTickInterval&&!i.categories&&i.getMinorTickPositions().forEach(function(t){i.renderMinorTick(t,r)}),h.length&&(h.forEach(function(t,e){i.renderTick(t,e,r)}),m&&(0===i.min||i.single)&&(d[-1]||(d[-1]=new sa(i,-1,null,!0)),d[-1].render(-1))),u&&h.forEach(function(r,a){e=void 0!==h[a+1]?h[a+1]+m:i.max-m,a%2==0&&r=.5)t=Math.round(t),n=o.getLinearTickPositions(t,e,i);else if(t>=.08){let o,r,a,h,l,d,c;let p=Math.floor(e);for(o=t>.3?[1,2,4]:t>.15?[1,2,4,6,8]:[1,2,3,4,5,6,7,8,9],r=p;re&&(!s||d<=i)&&void 0!==d&&n.push(d),d>i&&(c=!0),d=l}else{let h=this.lin2log(e),l=this.lin2log(i),d=s?o.getMinorTickInterval():a.tickInterval,c=a.tickPixelInterval/(s?5:1),p=s?r/o.tickPositions.length:r;t=sj(t=sU(\"auto\"===d?null:d,this.minorAutoInterval,(l-h)*c/(p||1))),n=o.getLinearTickPositions(t,h,l).map(this.log2lin),s||(this.minorAutoInterval=t/5)}return s||(o.tickInterval=t),n}lin2log(t){return Math.pow(10,t)}log2lin(t){return Math.log(t)/Math.LN10}}t.Additions=s}(h||(h={}));let s$=h,{erase:sV,extend:s_,isNumber:sq}=$;!function(t){let e;function i(t){return this.addPlotBandOrLine(t,\"plotBands\")}function s(t,i){let s=this.userOptions,o=new e(this,t);if(this.visible&&(o=o.render()),o){if(this._addedPlotLB||(this._addedPlotLB=!0,(s.plotLines||[]).concat(s.plotBands||[]).forEach(t=>{this.addPlotBandOrLine(t)})),i){let e=s[i]||[];e.push(t),s[i]=e}this.plotLinesAndBands.push(o)}return o}function o(t){return this.addPlotBandOrLine(t,\"plotLines\")}function r(t,e,i){i=i||this.options;let s=this.getPlotLinePath({value:e,force:!0,acrossPanes:i.acrossPanes}),o=[],r=this.horiz,a=!sq(this.min)||!sq(this.max)||tthis.max&&e>this.max,n=this.getPlotLinePath({value:t,force:!0,acrossPanes:i.acrossPanes}),h,l=1,d;if(n&&s)for(a&&(d=n.toString()===s.toString(),l=0),h=0;h{let t=[];for(let e of this.axes)for(let{label:i,options:s}of e.plotLinesAndBands)i&&!s?.label?.allowOverlap&&t.push(i);return t})}),sZ.compose(s4,e)}constructor(t,e){this.axis=t,this.options=e,this.id=e.id}render(){s3(this,\"render\");let{axis:t,options:e}=this,{horiz:i,logarithmic:s}=t,{color:o,events:r,zIndex:a=0}=e,{renderer:n,time:h}=t.chart,l={},d=h.parse(e.to),c=h.parse(e.from),p=h.parse(e.value),g=e.borderWidth,u=e.label,{label:f,svgElem:m}=this,x=[],y,b=s0(c)&&s0(d),v=s0(p),k=!m,w={class:\"highcharts-plot-\"+(b?\"band \":\"line \")+(e.className||\"\")},M=b?\"bands\":\"lines\";if(!t.chart.styledMode&&(v?(w.stroke=o||\"#999999\",w[\"stroke-width\"]=s9(e.width,1),e.dashStyle&&(w.dashstyle=e.dashStyle)):b&&(w.fill=o||\"#e6e9ff\",g&&(w.stroke=e.borderColor,w[\"stroke-width\"]=g))),l.zIndex=a,M+=\"-\"+a,(y=t.plotLinesAndBandsGroups[M])||(t.plotLinesAndBandsGroups[M]=y=n.g(\"plot-\"+M).attr(l).add()),m||(this.svgElem=m=n.path().attr(w).add(y)),s0(p))x=t.getPlotLinePath({value:s?.log2lin(p)??p,lineWidth:m.strokeWidth(),acrossPanes:e.acrossPanes});else{if(!(s0(c)&&s0(d)))return;x=t.getPlotBandPath(s?.log2lin(c)??c,s?.log2lin(d)??d,e)}return!this.eventsAdded&&r&&(s6(r,(t,e)=>{m?.on(e,t=>{r[e].apply(this,[t])})}),this.eventsAdded=!0),(k||!m.d)&&x?.length?m.attr({d:x}):m&&(x?(m.show(),m.animate({d:x})):m.d&&(m.hide(),f&&(this.label=f=f.destroy()))),u&&(s0(u.text)||s0(u.formatter))&&x?.length&&t.width>0&&t.height>0&&!x.isFlat?(u=s5({align:i&&b?\"center\":void 0,x:i?!b&&4:10,verticalAlign:!i&&b?\"middle\":void 0,y:i?b?16:10:b?6:-4,rotation:i&&!b?90:0,...b?{inside:!0}:{}},u),this.renderLabel(u,x,b,a)):f&&f.hide(),this}renderLabel(t,e,i,s){let o=this.axis,r=o.chart.renderer,a=t.inside,n=this.label;n||(this.label=n=r.text(this.getLabelText(t),0,0,t.useHTML).attr({align:t.textAlign||t.align,rotation:t.rotation,class:\"highcharts-plot-\"+(i?\"band\":\"line\")+\"-label \"+(t.className||\"\"),zIndex:s}),o.chart.styledMode||n.css(s5({fontSize:\"0.8em\",textOverflow:i&&!a?\"\":\"ellipsis\"},t.style)),n.add());let h=e.xBounds||[e[0][1],e[1][1],i?e[2][1]:e[0][1]],l=e.yBounds||[e[0][2],e[1][2],i?e[2][2]:e[0][2]],d=sQ(h),c=sQ(l),p=sJ(h)-d;n.align(t,!1,{x:d,y:c,width:p,height:sJ(l)-c}),(!n.alignValue||\"left\"===n.alignValue||s0(a))&&n.css({width:(t.style?.width||(i&&a?p:90===n.rotation?o.height-(n.alignAttr.y-o.top):(t.clip?o.width:o.chart.chartWidth)-(n.alignAttr.x-o.left)))+\"px\"}),n.show(!0)}getLabelText(t){return s0(t.formatter)?t.formatter.call(this):t.text}destroy(){s2(this.axis.plotLinesAndBands,this),delete this.axis,s1(this)}}let{animObject:s8}=tR,{format:s7}=eo,{composed:ot,dateFormats:oe,doc:oi,isSafari:os}=k,{distribute:oo}=ed,{addEvent:or,clamp:oa,css:on,discardElement:oh,extend:ol,fireEvent:od,isArray:oc,isNumber:op,isObject:og,isString:ou,merge:of,pick:om,pushUnique:ox,splat:oy,syncTimeout:ob}=$;class ov{constructor(t,e,i){this.allowShared=!0,this.crosshairs=[],this.distance=0,this.isHidden=!0,this.isSticky=!1,this.options={},this.outside=!1,this.chart=t,this.init(t,e),this.pointer=i}bodyFormatter(t){return t.map(t=>{let e=t.series.tooltipOptions,i=t.formatPrefix||\"point\";return(e[i+\"Formatter\"]||t.tooltipFormatter).call(t,e[i+\"Format\"]||\"\")})}cleanSplit(t){this.chart.series.forEach(function(e){let i=e&&e.tt;i&&(!i.isActive||t?e.tt=i.destroy():i.isActive=!1)})}defaultFormatter(t){let e;let i=this.points||oy(this);return(e=(e=[t.headerFooterFormatter(i[0])]).concat(t.bodyFormatter(i))).push(t.headerFooterFormatter(i[0],!0)),e}destroy(){this.label&&(this.label=this.label.destroy()),this.split&&(this.cleanSplit(!0),this.tt&&(this.tt=this.tt.destroy())),this.renderer&&(this.renderer=this.renderer.destroy(),oh(this.container)),$.clearTimeout(this.hideTimer)}getAnchor(t,e){let i;let{chart:s,pointer:o}=this,r=s.inverted,a=s.plotTop,n=s.plotLeft;if((t=oy(t))[0].series&&t[0].series.yAxis&&!t[0].series.yAxis.options.reversedStacks&&(t=t.slice().reverse()),this.followPointer&&e)void 0===e.chartX&&(e=o.normalize(e)),i=[e.chartX-n,e.chartY-a];else if(t[0].tooltipPos)i=t[0].tooltipPos;else{let s=0,o=0;t.forEach(function(t){let e=t.pos(!0);e&&(s+=e[0],o+=e[1])}),s/=t.length,o/=t.length,this.shared&&t.length>1&&e&&(r?s=e.chartX:o=e.chartY),i=[s-n,o-a]}return i.map(Math.round)}getClassName(t,e,i){let s=this.options,o=t.series,r=o.options;return[s.className,\"highcharts-label\",i&&\"highcharts-tooltip-header\",e?\"highcharts-tooltip-box\":\"highcharts-tooltip\",!i&&\"highcharts-color-\"+om(t.colorIndex,o.colorIndex),r&&r.className].filter(ou).join(\" \")}getLabel({anchorX:t,anchorY:e}={anchorX:0,anchorY:0}){let i=this,s=this.chart.styledMode,o=this.options,r=this.split&&this.allowShared,a=this.container,n=this.chart.renderer;if(this.label){let t=!this.label.hasClass(\"highcharts-label\");(!r&&t||r&&!t)&&this.destroy()}if(!this.label){if(this.outside){let t=this.chart,e=t.options.chart.style,i=er.getRendererType();this.container=a=k.doc.createElement(\"div\"),a.className=\"highcharts-tooltip-container \"+(t.renderTo.className.match(/(highcharts[a-zA-Z0-9-]+)\\s?/gm)||\"\"),on(a,{position:\"absolute\",top:\"1px\",pointerEvents:\"none\",zIndex:Math.max(this.options.style.zIndex||0,(e&&e.zIndex||0)+3)}),this.renderer=n=new i(a,0,0,e,void 0,void 0,n.styledMode)}if(r?this.label=n.g(\"tooltip\"):(this.label=n.label(\"\",t,e,o.shape,void 0,void 0,o.useHTML,void 0,\"tooltip\").attr({padding:o.padding,r:o.borderRadius}),s||this.label.attr({fill:o.backgroundColor,\"stroke-width\":o.borderWidth||0}).css(o.style).css({pointerEvents:o.style.pointerEvents||(this.shouldStickOnContact()?\"auto\":\"none\")})),i.outside){let t=this.label;[t.xSetter,t.ySetter].forEach((e,s)=>{t[s?\"ySetter\":\"xSetter\"]=o=>{e.call(t,i.distance),t[s?\"y\":\"x\"]=o,a&&(a.style[s?\"top\":\"left\"]=`${o}px`)}})}this.label.attr({zIndex:8}).shadow(o.shadow).add()}return a&&!a.parentElement&&k.doc.body.appendChild(a),this.label}getPlayingField(){let{body:t,documentElement:e}=oi,{chart:i,distance:s,outside:o}=this;return{width:o?Math.max(t.scrollWidth,e.scrollWidth,t.offsetWidth,e.offsetWidth,e.clientWidth)-2*s-2:i.chartWidth,height:o?Math.max(t.scrollHeight,e.scrollHeight,t.offsetHeight,e.offsetHeight,e.clientHeight):i.chartHeight}}getPosition(t,e,i){let{distance:s,chart:o,outside:r,pointer:a}=this,{inverted:n,plotLeft:h,plotTop:l,polar:d}=o,{plotX:c=0,plotY:p=0}=i,g={},u=n&&i.h||0,{height:f,width:m}=this.getPlayingField(),x=a.getChartPosition(),y=t=>t*x.scaleX,b=t=>t*x.scaleY,v=i=>{let a=\"x\"===i;return[i,a?m:f,a?t:e].concat(r?[a?y(t):b(e),a?x.left-s+y(c+h):x.top-s+b(p+l),0,a?m:f]:[a?t:e,a?c+h:p+l,a?h:l,a?h+o.plotWidth:l+o.plotHeight])},k=v(\"y\"),w=v(\"x\"),M,S=!!i.negative;!d&&o.hoverSeries?.yAxis?.reversed&&(S=!S);let T=!this.followPointer&&om(i.ttBelow,!d&&!n===S),C=function(t,e,i,o,a,n,h){let l=r?\"y\"===t?b(s):y(s):s,d=(i-o)/2,c=oe?m:m+u)}},A=function(t,e,i,o,r){if(re-s)return!1;re-o/2?g[t]=e-o-2:g[t]=r-i/2},P=function(t){[k,w]=[w,k],M=t},L=()=>{!1!==C.apply(0,k)?!1!==A.apply(0,w)||M||(P(!0),L()):M?g.x=g.y=0:(P(!0),L())};return(n&&!d||this.len>1)&&P(),L(),g}hide(t){let e=this;$.clearTimeout(this.hideTimer),t=om(t,this.options.hideDelay),this.isHidden||(this.hideTimer=ob(function(){let i=e.getLabel();e.getLabel().animate({opacity:0},{duration:t?150:t,complete:()=>{i.hide(),e.container&&e.container.remove()}}),e.isHidden=!0},t))}init(t,e){this.chart=t,this.options=e,this.crosshairs=[],this.isHidden=!0,this.split=e.split&&!t.inverted&&!t.polar,this.shared=e.shared||this.split,this.outside=om(e.outside,!!(t.scrollablePixelsX||t.scrollablePixelsY))}shouldStickOnContact(t){return!!(!this.followPointer&&this.options.stickOnContact&&(!t||this.pointer.inClass(t.target,\"highcharts-tooltip\")))}move(t,e,i,s){let o=this,r=s8(!o.isHidden&&o.options.animation),a=o.followPointer||(o.len||0)>1,n={x:t,y:e};a||(n.anchorX=i,n.anchorY=s),r.step=()=>o.drawTracker(),o.getLabel().animate(n,r)}refresh(t,e){let{chart:i,options:s,pointer:o,shared:r}=this,a=oy(t),n=a[0],h=s.format,l=s.formatter||this.defaultFormatter,d=i.styledMode,c=this.allowShared;if(!s.enabled||!n.series)return;$.clearTimeout(this.hideTimer),this.allowShared=!(!oc(t)&&t.series&&t.series.noSharedTooltip),c=c&&!this.allowShared,this.followPointer=!this.split&&n.series.tooltipOptions.followPointer;let p=this.getAnchor(t,e),g=p[0],u=p[1];r&&this.allowShared&&(o.applyInactiveState(a),a.forEach(t=>t.setState(\"hover\")),n.points=a),this.len=a.length;let f=ou(h)?s7(h,n,i):l.call(n,this);n.points=void 0;let m=n.series;if(this.distance=om(m.tooltipOptions.distance,16),!1===f)this.hide();else{if(this.split&&this.allowShared)this.renderSplit(f,a);else{let t=g,r=u;if(e&&o.isDirectTouch&&(t=e.chartX-i.plotLeft,r=e.chartY-i.plotTop),i.polar||!1===m.options.clip||a.some(e=>o.isDirectTouch||e.series.shouldShowTooltip(t,r))){let t=this.getLabel(c&&this.tt||{});(!s.style.width||d)&&t.css({width:(this.outside?this.getPlayingField():i.spacingBox).width+\"px\"}),t.attr({class:this.getClassName(n),text:f&&f.join?f.join(\"\"):f}),this.outside&&t.attr({x:oa(t.x||0,0,this.getPlayingField().width-(t.width||0)-1)}),d||t.attr({stroke:s.borderColor||n.color||m.color||\"#666666\"}),this.updatePosition({plotX:g,plotY:u,negative:n.negative,ttBelow:n.ttBelow,h:p[2]||0})}else{this.hide();return}}this.isHidden&&this.label&&this.label.attr({opacity:1}).show(),this.isHidden=!1}od(this,\"refresh\")}renderSplit(t,e){let i=this,{chart:s,chart:{chartWidth:o,chartHeight:r,plotHeight:a,plotLeft:n,plotTop:h,scrollablePixelsY:l=0,scrollablePixelsX:d,styledMode:c},distance:p,options:g,options:{positioner:u},pointer:f}=i,{scrollLeft:m=0,scrollTop:x=0}=s.scrollablePlotArea?.scrollingContainer||{},y=i.outside&&\"number\"!=typeof d?oi.documentElement.getBoundingClientRect():{left:m,right:m+o,top:x,bottom:x+r},b=i.getLabel(),v=this.renderer||s.renderer,k=!!(s.xAxis[0]&&s.xAxis[0].opposite),{left:w,top:M}=f.getChartPosition(),S=h+x,T=0,C=a-l;function A(t,e,s,o,r=!0){let a,n;return s?(a=k?0:C,n=oa(t-o/2,y.left,y.right-o-(i.outside?w:0))):(a=e-S,n=oa(n=r?t-o-p:t+p,r?n:y.left,y.right)),{x:n,y:a}}ou(t)&&(t=[!1,t]);let P=t.slice(0,e.length+1).reduce(function(t,s,o){if(!1!==s&&\"\"!==s){let r=e[o-1]||{isHeader:!0,plotX:e[0].plotX,plotY:a,series:{}},l=r.isHeader,d=l?i:r.series,f=d.tt=function(t,e,s){let o=t,{isHeader:r,series:a}=e;if(!o){let t={padding:g.padding,r:g.borderRadius};c||(t.fill=g.backgroundColor,t[\"stroke-width\"]=g.borderWidth??1),o=v.label(\"\",0,0,g[r?\"headerShape\":\"shape\"],void 0,void 0,g.useHTML).addClass(i.getClassName(e,!0,r)).attr(t).add(b)}return o.isActive=!0,o.attr({text:s}),c||o.css(g.style).attr({stroke:g.borderColor||e.color||a.color||\"#333333\"}),o}(d.tt,r,s.toString()),m=f.getBBox(),x=m.width+f.strokeWidth();l&&(T=m.height,C+=T,k&&(S-=T));let{anchorX:w,anchorY:M}=function(t){let e,i;let{isHeader:s,plotX:o=0,plotY:r=0,series:l}=t;if(s)e=Math.max(n+o,n),i=h+a/2;else{let{xAxis:t,yAxis:s}=l;e=t.pos+oa(o,-p,t.len+p),l.shouldShowTooltip(0,s.pos-h+r,{ignoreX:!0})&&(i=s.pos+r)}return{anchorX:e=oa(e,y.left-p,y.right+p),anchorY:i}}(r);if(\"number\"==typeof M){let e=m.height+1,s=u?u.call(i,x,e,r):A(w,M,l,x);t.push({align:u?0:void 0,anchorX:w,anchorY:M,boxWidth:x,point:r,rank:om(s.rank,l?1:0),size:e,target:s.y,tt:f,x:s.x})}else f.isActive=!1}return t},[]);!u&&P.some(t=>{let{outside:e}=i,s=(e?w:0)+t.anchorX;return ss})&&(P=P.map(t=>{let{x:e,y:i}=A(t.anchorX,t.anchorY,t.point.isHeader,t.boxWidth,!1);return ol(t,{target:i,x:e})})),i.cleanSplit(),oo(P,C);let L={left:w,right:w};P.forEach(function(t){let{x:e,boxWidth:s,isHeader:o}=t;!o&&(i.outside&&w+eL.right&&(L.right=w+e))}),P.forEach(function(t){let{x:e,anchorX:s,anchorY:o,pos:r,point:{isHeader:a}}=t,n={visibility:void 0===r?\"hidden\":\"inherit\",x:e,y:(r||0)+S,anchorX:s,anchorY:o};if(i.outside&&e0&&(a||(n.x=e+t,n.anchorX=s+t),a&&(n.x=(L.right-L.left)/2,n.anchorX=s+t))}t.tt.attr(n)});let{container:O,outside:E,renderer:I}=i;if(E&&O&&I){let{width:t,height:e,x:i,y:s}=b.getBBox();I.setSize(t+i,e+s,!1),O.style.left=L.left+\"px\",O.style.top=M+\"px\"}os&&b.attr({opacity:1===b.opacity?.999:1})}drawTracker(){if(!this.shouldStickOnContact()){this.tracker&&(this.tracker=this.tracker.destroy());return}let t=this.chart,e=this.label,i=this.shared?t.hoverPoints:t.hoverPoint;if(!e||!i)return;let s={x:0,y:0,width:0,height:0},o=this.getAnchor(i),r=e.getBBox();o[0]+=t.plotLeft-(e.translateX||0),o[1]+=t.plotTop-(e.translateY||0),s.x=Math.min(0,o[0]),s.y=Math.min(0,o[1]),s.width=o[0]<0?Math.max(Math.abs(o[0]),r.width-o[0]):Math.max(Math.abs(o[0]),r.width),s.height=o[1]<0?Math.max(Math.abs(o[1]),r.height-Math.abs(o[1])):Math.max(Math.abs(o[1]),r.height),this.tracker?this.tracker.attr(s):(this.tracker=e.renderer.rect(s).addClass(\"highcharts-tracker\").add(e),t.styledMode||this.tracker.attr({fill:\"rgba(0,0,0,0)\"}))}styledModeFormat(t){return t.replace('style=\"font-size: 0.8em\"','class=\"highcharts-header\"').replace(/style=\"color:{(point|series)\\.color}\"/g,'class=\"highcharts-color-{$1.colorIndex} {series.options.className} {point.options.className}\"')}headerFooterFormatter(t,e){let i=t.series,s=i.tooltipOptions,o=i.xAxis,r=o&&o.dateTime,a={isFooter:e,point:t},n=s.xDateFormat||\"\",h=s[e?\"footerFormat\":\"headerFormat\"];return od(this,\"headerFormatter\",a,function(e){if(r&&!n&&op(t.key)&&(n=r.getXDateFormat(t.key,s.dateTimeLabelFormats)),r&&n){if(og(n)){let t=n;oe[0]=e=>i.chart.time.dateFormat(t,e),n=\"%0\"}(t.tooltipDateKeys||[\"key\"]).forEach(t=>{h=h.replace(RegExp(\"point\\\\.\"+t+\"([ \\\\)}])\",\"\"),`(point.${t}:${n})$1`)})}i.chart.styledMode&&(h=this.styledModeFormat(h)),e.text=s7(h,t,this.chart)}),a.text||\"\"}update(t){this.destroy(),this.init(this.chart,of(!0,this.options,t))}updatePosition(t){let{chart:e,container:i,distance:s,options:o,pointer:r,renderer:a}=this,{height:n=0,width:h=0}=this.getLabel(),{left:l,top:d,scaleX:c,scaleY:p}=r.getChartPosition(),g=(o.positioner||this.getPosition).call(this,h,n,t),u=k.doc,f=(t.plotX||0)+e.plotLeft,m=(t.plotY||0)+e.plotTop,x;a&&i&&(o.positioner&&(g.x+=l-s,g.y+=d-s),x=(o.borderWidth||0)+2*s+2,a.setSize(oa(h+x,0,u.documentElement.clientWidth)-1,n+x,!1),(1!==c||1!==p)&&(on(i,{transform:`scale(${c}, ${p})`}),f*=c,m*=p),f+=l-g.x,m+=d-g.y),this.move(Math.round(g.x),Math.round(g.y||0),f,m)}}!function(t){t.compose=function(e){ox(ot,\"Core.Tooltip\")&&or(e,\"afterInit\",function(){let e=this.chart;e.options.tooltip&&(e.tooltip=new t(e,e.options.tooltip,this))})}}(ov||(ov={}));let ok=ov,{animObject:ow}=tR,{defaultOptions:oM}=tm,{format:oS}=eo,{addEvent:oT,crisp:oC,erase:oA,extend:oP,fireEvent:oL,getNestedProperty:oO,isArray:oE,isFunction:oI,isNumber:oD,isObject:oB,merge:oN,pick:oz,syncTimeout:oR,removeEvent:oW,uniqueKey:oH}=$;class oX{animateBeforeDestroy(){let t=this,e={x:t.startXPos,opacity:0},i=t.getGraphicalProps();i.singular.forEach(function(i){t[i]=t[i].animate(\"dataLabel\"===i?{x:t[i].startXPos,y:t[i].startYPos,opacity:0}:e)}),i.plural.forEach(function(e){t[e].forEach(function(e){e.element&&e.animate(oP({x:t.startXPos},e.startYPos?{x:e.startXPos,y:e.startYPos}:{}))})})}applyOptions(t,e){let i=this.series,s=i.options.pointValKey||i.pointValKey;return oP(this,t=oX.prototype.optionsToObject.call(this,t)),this.options=this.options?oP(this.options,t):t,t.group&&delete this.group,t.dataLabels&&delete this.dataLabels,s&&(this.y=oX.prototype.getNestedProperty.call(this,s)),this.selected&&(this.state=\"select\"),\"name\"in this&&void 0===e&&i.xAxis&&i.xAxis.hasNames&&(this.x=i.xAxis.nameToX(this)),void 0===this.x&&i?this.x=e??i.autoIncrement():oD(t.x)&&i.options.relativeXValue?this.x=i.autoIncrement(t.x):\"string\"==typeof this.x&&(e??(e=i.chart.time.parse(this.x)),oD(e)&&(this.x=e)),this.isNull=this.isValid&&!this.isValid(),this.formatPrefix=this.isNull?\"null\":\"point\",this}destroy(){if(!this.destroyed){let t=this,e=t.series,i=e.chart,s=e.options.dataSorting,o=i.hoverPoints,r=ow(t.series.chart.renderer.globalAnimation),a=()=>{for(let e in(t.graphic||t.graphics||t.dataLabel||t.dataLabels)&&(oW(t),t.destroyElements()),t)delete t[e]};t.legendItem&&i.legend.destroyItem(t),o&&(t.setState(),oA(o,t),o.length||(i.hoverPoints=null)),t===i.hoverPoint&&t.onMouseOut(),s&&s.enabled?(this.animateBeforeDestroy(),oR(a,r.duration)):a(),i.pointCount--}this.destroyed=!0}destroyElements(t){let e=this,i=e.getGraphicalProps(t);i.singular.forEach(function(t){e[t]=e[t].destroy()}),i.plural.forEach(function(t){e[t].forEach(function(t){t&&t.element&&t.destroy()}),delete e[t]})}firePointEvent(t,e,i){let s=this,o=this.series.options;s.manageEvent(t),\"click\"===t&&o.allowPointSelect&&(i=function(t){!s.destroyed&&s.select&&s.select(null,t.ctrlKey||t.metaKey||t.shiftKey)}),oL(s,t,e,i)}getClassName(){return\"highcharts-point\"+(this.selected?\" highcharts-point-select\":\"\")+(this.negative?\" highcharts-negative\":\"\")+(this.isNull?\" highcharts-null-point\":\"\")+(void 0!==this.colorIndex?\" highcharts-color-\"+this.colorIndex:\"\")+(this.options.className?\" \"+this.options.className:\"\")+(this.zone&&this.zone.className?\" \"+this.zone.className.replace(\"highcharts-negative\",\"\"):\"\")}getGraphicalProps(t){let e,i;let s=this,o=[],r={singular:[],plural:[]};for((t=t||{graphic:1,dataLabel:1}).graphic&&o.push(\"graphic\",\"connector\"),t.dataLabel&&o.push(\"dataLabel\",\"dataLabelPath\",\"dataLabelUpper\"),i=o.length;i--;)s[e=o[i]]&&r.singular.push(e);return[\"graphic\",\"dataLabel\"].forEach(function(e){let i=e+\"s\";t[e]&&s[i]&&r.plural.push(i)}),r}getNestedProperty(t){return t?0===t.indexOf(\"custom.\")?oO(t,this.options):this[t]:void 0}getZone(){let t=this.series,e=t.zones,i=t.zoneAxis||\"y\",s,o=0;for(s=e[0];this[i]>=s.value;)s=e[++o];return this.nonZonedColor||(this.nonZonedColor=this.color),s&&s.color&&!this.options.color?this.color=s.color:this.color=this.nonZonedColor,s}hasNewShapeType(){return(this.graphic&&(this.graphic.symbolName||this.graphic.element.nodeName))!==this.shapeType}constructor(t,e,i){this.formatPrefix=\"point\",this.visible=!0,this.point=this,this.series=t,this.applyOptions(e,i),this.id??(this.id=oH()),this.resolveColor(),t.chart.pointCount++,oL(this,\"afterInit\")}isValid(){return(oD(this.x)||this.x instanceof Date)&&oD(this.y)}optionsToObject(t){let e=this.series,i=e.options.keys,s=i||e.pointArrayMap||[\"y\"],o=s.length,r={},a,n=0,h=0;if(oD(t)||null===t)r[s[0]]=t;else if(oE(t))for(!i&&t.length>o&&(\"string\"==(a=typeof t[0])?e.xAxis?.dateTime?r.x=e.chart.time.parse(t[0]):r.name=t[0]:\"number\"===a&&(r.x=t[0]),n++);h0?oX.prototype.setNestedProperty(r,t[n],s[h]):r[s[h]]=t[n]),n++,h++;else\"object\"==typeof t&&(r=t,t.dataLabels&&(e.hasDataLabels=()=>!0),t.marker&&(e._hasPointMarkers=!0));return r}pos(t,e=this.plotY){if(!this.destroyed){let{plotX:i,series:s}=this,{chart:o,xAxis:r,yAxis:a}=s,n=0,h=0;if(oD(i)&&oD(e))return t&&(n=r?r.pos:o.plotLeft,h=a?a.pos:o.plotTop),o.inverted&&r&&a?[a.len-e+h,r.len-i+n]:[i+n,e+h]}}resolveColor(){let t=this.series,e=t.chart.options.chart,i=t.chart.styledMode,s,o,r=e.colorCount,a;delete this.nonZonedColor,t.options.colorByPoint?(i||(s=(o=t.options.colors||t.chart.options.colors)[t.colorCounter],r=o.length),a=t.colorCounter,t.colorCounter++,t.colorCounter===r&&(t.colorCounter=0)):(i||(s=t.color),a=t.colorIndex),this.colorIndex=oz(this.options.colorIndex,a),this.color=oz(this.options.color,s)}setNestedProperty(t,e,i){return i.split(\".\").reduce(function(t,i,s,o){let r=o.length-1===s;return t[i]=r?e:oB(t[i],!0)?t[i]:{},t[i]},t),t}shouldDraw(){return!this.isNull}tooltipFormatter(t){let{chart:e,pointArrayMap:i=[\"y\"],tooltipOptions:s}=this.series,{valueDecimals:o=\"\",valuePrefix:r=\"\",valueSuffix:a=\"\"}=s;return e.styledMode&&(t=e.tooltip?.styledModeFormat(t)||t),i.forEach(e=>{e=\"{point.\"+e,(r||a)&&(t=t.replace(RegExp(e+\"}\",\"g\"),r+e+\"}\"+a)),t=t.replace(RegExp(e+\"}\",\"g\"),e+\":,.\"+o+\"f}\")}),oS(t,this,e)}update(t,e,i,s){let o;let r=this,a=r.series,n=r.graphic,h=a.chart,l=a.options;function d(){r.applyOptions(t);let s=n&&r.hasMockGraphic,d=null===r.y?!s:s;n&&d&&(r.graphic=n.destroy(),delete r.hasMockGraphic),oB(t,!0)&&(n&&n.element&&t&&t.marker&&void 0!==t.marker.symbol&&(r.graphic=n.destroy()),t?.dataLabels&&r.dataLabel&&(r.dataLabel=r.dataLabel.destroy())),o=r.index;let c={};for(let t of a.dataColumnKeys())c[t]=r[t];a.dataTable.setRow(c,o),l.data[o]=oB(l.data[o],!0)||oB(t,!0)?r.options:oz(t,l.data[o]),a.isDirty=a.isDirtyData=!0,!a.fixedBox&&a.hasCartesianSeries&&(h.isDirtyBox=!0),\"point\"===l.legendType&&(h.isDirtyLegend=!0),e&&h.redraw(i)}e=oz(e,!0),!1===s?d():r.firePointEvent(\"update\",{options:t},d)}remove(t,e){this.series.removePoint(this.series.data.indexOf(this),t,e)}select(t,e){let i=this,s=i.series,o=s.chart;t=oz(t,!i.selected),this.selectedStaging=t,i.firePointEvent(t?\"select\":\"unselect\",{accumulate:e},function(){i.selected=i.options.selected=t,s.options.data[s.data.indexOf(i)]=i.options,i.setState(t&&\"select\"),e||o.getSelectedPoints().forEach(function(t){let e=t.series;t.selected&&t!==i&&(t.selected=t.options.selected=!1,e.options.data[e.data.indexOf(t)]=t.options,t.setState(o.hoverPoints&&e.options.inactiveOtherPoints?\"inactive\":\"\"),t.firePointEvent(\"unselect\"))})}),delete this.selectedStaging}onMouseOver(t){let{inverted:e,pointer:i}=this.series.chart;i&&(t=t?i.normalize(t):i.getChartCoordinatesFromPoint(this,e),i.runPointActions(t,this))}onMouseOut(){let t=this.series.chart;this.firePointEvent(\"mouseOut\"),this.series.options.inactiveOtherPoints||(t.hoverPoints||[]).forEach(function(t){t.setState()}),t.hoverPoints=t.hoverPoint=null}manageEvent(t){let e=oN(this.series.options.point,this.options),i=e.events?.[t];oI(i)&&(!this.hcEvents?.[t]||this.hcEvents?.[t]?.map(t=>t.fn).indexOf(i)===-1)?(this.importedUserEvent?.(),this.importedUserEvent=oT(this,t,i),this.hcEvents&&(this.hcEvents[t].userEvent=!0)):this.importedUserEvent&&!i&&this.hcEvents?.[t]&&this.hcEvents?.[t].userEvent&&(oW(this,t),delete this.hcEvents[t],Object.keys(this.hcEvents)||delete this.importedUserEvent)}setState(t,e){let i=this.series,s=this.state,o=i.options.states[t||\"normal\"]||{},r=oM.plotOptions[i.type].marker&&i.options.marker,a=r&&!1===r.enabled,n=r&&r.states&&r.states[t||\"normal\"]||{},h=!1===n.enabled,l=this.marker||{},d=i.chart,c=r&&i.markerAttribs,p=i.halo,g,u,f,m=i.stateMarkerGraphic,x;if((t=t||\"\")===this.state&&!e||this.selected&&\"select\"!==t||!1===o.enabled||t&&(h||a&&!1===n.enabled)||t&&l.states&&l.states[t]&&!1===l.states[t].enabled)return;if(this.state=t,c&&(g=i.markerAttribs(this,t)),this.graphic&&!this.hasMockGraphic){if(s&&this.graphic.removeClass(\"highcharts-point-\"+s),t&&this.graphic.addClass(\"highcharts-point-\"+t),!d.styledMode){u=i.pointAttribs(this,t),f=oz(d.options.chart.animation,o.animation);let e=u.opacity;i.options.inactiveOtherPoints&&oD(e)&&(this.dataLabels||[]).forEach(function(t){t&&!t.hasClass(\"highcharts-data-label-hidden\")&&(t.animate({opacity:e},f),t.connector&&t.connector.animate({opacity:e},f))}),this.graphic.animate(u,f)}g&&this.graphic.animate(g,oz(d.options.chart.animation,n.animation,r.animation)),m&&m.hide()}else t&&n&&(x=l.symbol||i.symbol,m&&m.currentSymbol!==x&&(m=m.destroy()),g&&(m?m[e?\"animate\":\"attr\"]({x:g.x,y:g.y}):x&&(i.stateMarkerGraphic=m=d.renderer.symbol(x,g.x,g.y,g.width,g.height,oN(r,n)).add(i.markerGroup),m.currentSymbol=x)),!d.styledMode&&m&&\"inactive\"!==this.state&&m.attr(i.pointAttribs(this,t))),m&&(m[t&&this.isInside?\"show\":\"hide\"](),m.element.point=this,m.addClass(this.getClassName(),!0));let y=o.halo,b=this.graphic||m,v=b&&b.visibility||\"inherit\";y&&y.size&&b&&\"hidden\"!==v&&!this.isCluster?(p||(i.halo=p=d.renderer.path().add(b.parentGroup)),p.show()[e?\"animate\":\"attr\"]({d:this.haloPath(y.size)}),p.attr({class:\"highcharts-halo highcharts-color-\"+oz(this.colorIndex,i.colorIndex)+(this.className?\" \"+this.className:\"\"),visibility:v,zIndex:-1}),p.point=this,d.styledMode||p.attr(oP({fill:this.color||i.color,\"fill-opacity\":y.opacity},tK.filterUserAttributes(y.attributes||{})))):p?.point?.haloPath&&!p.point.destroyed&&p.animate({d:p.point.haloPath(0)},null,p.hide),oL(this,\"afterSetState\",{state:t})}haloPath(t){let e=this.pos();return e?this.series.chart.renderer.symbols.circle(oC(e[0],1)-t,e[1]-t,2*t,2*t):[]}}let oF=oX,{parse:oG}=tk,{charts:oY,composed:oj,isTouchDevice:oU}=k,{addEvent:o$,attr:oV,css:o_,extend:oq,find:oZ,fireEvent:oK,isNumber:oJ,isObject:oQ,objectEach:o0,offset:o1,pick:o2,pushUnique:o3,splat:o5}=$;class o6{applyInactiveState(t){let e=[],i;(t||[]).forEach(function(t){i=t.series,e.push(i),i.linkedParent&&e.push(i.linkedParent),i.linkedSeries&&(e=e.concat(i.linkedSeries)),i.navigatorSeries&&e.push(i.navigatorSeries)}),this.chart.series.forEach(function(t){-1===e.indexOf(t)?t.setState(\"inactive\",!0):t.options.inactiveOtherPoints&&t.setAllPointsToState(\"inactive\")})}destroy(){let t=this;this.eventsToUnbind.forEach(t=>t()),this.eventsToUnbind=[],!k.chartCount&&(o6.unbindDocumentMouseUp.forEach(t=>t.unbind()),o6.unbindDocumentMouseUp.length=0,o6.unbindDocumentTouchEnd&&(o6.unbindDocumentTouchEnd=o6.unbindDocumentTouchEnd())),clearInterval(t.tooltipTimeout),o0(t,function(e,i){t[i]=void 0})}getSelectionMarkerAttrs(t,e){let i={args:{chartX:t,chartY:e},attrs:{},shapeType:\"rect\"};return oK(this,\"getSelectionMarkerAttrs\",i,i=>{let s;let{chart:o,zoomHor:r,zoomVert:a}=this,{mouseDownX:n=0,mouseDownY:h=0}=o,l=i.attrs;l.x=o.plotLeft,l.y=o.plotTop,l.width=r?1:o.plotWidth,l.height=a?1:o.plotHeight,r&&(s=t-n,l.width=Math.max(1,Math.abs(s)),l.x=(s>0?0:s)+n),a&&(s=e-h,l.height=Math.max(1,Math.abs(s)),l.y=(s>0?0:s)+h)}),i}drag(t){let{chart:e}=this,{mouseDownX:i=0,mouseDownY:s=0}=e,{panning:o,panKey:r,selectionMarkerFill:a}=e.options.chart,n=e.plotLeft,h=e.plotTop,l=e.plotWidth,d=e.plotHeight,c=oQ(o)?o.enabled:o,p=r&&t[`${r}Key`],g=t.chartX,u=t.chartY,f,m=this.selectionMarker;if((!m||!m.touch)&&(gn+l&&(g=n+l),uh+d&&(u=h+d),this.hasDragged=Math.sqrt(Math.pow(i-g,2)+Math.pow(s-u,2)),this.hasDragged>10)){f=e.isInsidePlot(i-n,s-h,{visiblePlotOnly:!0});let{shapeType:r,attrs:l}=this.getSelectionMarkerAttrs(g,u);(e.hasCartesianSeries||e.mapView)&&this.hasZoom&&f&&!p&&!m&&(this.selectionMarker=m=e.renderer[r](),m.attr({class:\"highcharts-selection-marker\",zIndex:7}).add(),e.styledMode||m.attr({fill:a||oG(\"#334eff\").setOpacity(.25).get()})),m&&m.attr(l),f&&!m&&c&&e.pan(t,o)}}dragStart(t){let e=this.chart;e.mouseIsDown=t.type,e.cancelClick=!1,e.mouseDownX=t.chartX,e.mouseDownY=t.chartY}getSelectionBox(t){let e={args:{marker:t},result:t.getBBox()};return oK(this,\"getSelectionBox\",e),e.result}drop(t){let e;let{chart:i,selectionMarker:s}=this;for(let t of i.axes)t.isPanning&&(t.isPanning=!1,(t.options.startOnTick||t.options.endOnTick||t.series.some(t=>t.boosted))&&(t.forceRedraw=!0,t.setExtremes(t.userMin,t.userMax,!1),e=!0));if(e&&i.redraw(),s&&t){if(this.hasDragged){let e=this.getSelectionBox(s);i.transform({axes:i.axes.filter(t=>t.zoomEnabled&&(\"xAxis\"===t.coll&&this.zoomX||\"yAxis\"===t.coll&&this.zoomY)),selection:{originalEvent:t,xAxis:[],yAxis:[],...e},from:e})}oJ(i.index)&&(this.selectionMarker=s.destroy())}i&&oJ(i.index)&&(o_(i.container,{cursor:i._cursor}),i.cancelClick=this.hasDragged>10,i.mouseIsDown=!1,this.hasDragged=0,this.pinchDown=[])}findNearestKDPoint(t,e,i){let s;return t.forEach(function(t){let o=!(t.noSharedTooltip&&e)&&0>t.options.findNearestPointBy.indexOf(\"y\"),r=t.searchPoint(i,o);oQ(r,!0)&&r.series&&(!oQ(s,!0)||function(t,i){let s=t.distX-i.distX,o=t.dist-i.dist,r=i.series.group?.zIndex-t.series.group?.zIndex;return 0!==s&&e?s:0!==o?o:0!==r?r:t.series.index>i.series.index?-1:1}(s,r)>0)&&(s=r)}),s}getChartCoordinatesFromPoint(t,e){let{xAxis:i,yAxis:s}=t.series,o=t.shapeArgs;if(i&&s){let r=t.clientX??t.plotX??0,a=t.plotY||0;return t.isNode&&o&&oJ(o.x)&&oJ(o.y)&&(r=o.x,a=o.y),e?{chartX:s.len+s.pos-a,chartY:i.len+i.pos-r}:{chartX:r+i.pos,chartY:a+s.pos}}if(o&&o.x&&o.y)return{chartX:o.x,chartY:o.y}}getChartPosition(){if(this.chartPosition)return this.chartPosition;let{container:t}=this.chart,e=o1(t);this.chartPosition={left:e.left,top:e.top,scaleX:1,scaleY:1};let{offsetHeight:i,offsetWidth:s}=t;return s>2&&i>2&&(this.chartPosition.scaleX=e.width/s,this.chartPosition.scaleY=e.height/i),this.chartPosition}getCoordinates(t){let e={xAxis:[],yAxis:[]};for(let i of this.chart.axes)e[i.isXAxis?\"xAxis\":\"yAxis\"].push({axis:i,value:i.toValue(t[i.horiz?\"chartX\":\"chartY\"])});return e}getHoverData(t,e,i,s,o,r){let a=[],n=function(t){return t.visible&&!(!o&&t.directTouch)&&o2(t.options.enableMouseTracking,!0)},h=e,l,d={chartX:r?r.chartX:void 0,chartY:r?r.chartY:void 0,shared:o};oK(this,\"beforeGetHoverData\",d),l=h&&!h.stickyTracking?[h]:i.filter(t=>t.stickyTracking&&(d.filter||n)(t));let c=s&&t||!r?t:this.findNearestKDPoint(l,o,r);return h=c&&c.series,c&&(o&&!h.noSharedTooltip?(l=i.filter(function(t){return d.filter?d.filter(t):n(t)&&!t.noSharedTooltip})).forEach(function(t){let e=oZ(t.points,function(t){return t.x===c.x&&!t.isNull});oQ(e)&&(t.boosted&&t.boost&&(e=t.boost.getPoint(e)),a.push(e))}):a.push(c)),oK(this,\"afterGetHoverData\",d={hoverPoint:c}),{hoverPoint:d.hoverPoint,hoverSeries:h,hoverPoints:a}}getPointFromEvent(t){let e=t.target,i;for(;e&&!i;)i=e.point,e=e.parentNode;return i}onTrackerMouseOut(t){let e=this.chart,i=t.relatedTarget,s=e.hoverSeries;this.isDirectTouch=!1,!s||!i||s.stickyTracking||this.inClass(i,\"highcharts-tooltip\")||this.inClass(i,\"highcharts-series-\"+s.index)&&this.inClass(i,\"highcharts-tracker\")||s.onMouseOut()}inClass(t,e){let i=t,s;for(;i;){if(s=oV(i,\"class\")){if(-1!==s.indexOf(e))return!0;if(-1!==s.indexOf(\"highcharts-container\"))return!1}i=i.parentElement}}constructor(t,e){this.hasDragged=0,this.pointerCaptureEventsToUnbind=[],this.eventsToUnbind=[],this.options=e,this.chart=t,this.runChartClick=!!e.chart.events?.click,this.pinchDown=[],this.setDOMEvents(),oK(this,\"afterInit\")}normalize(t,e){let i=t.touches,s=i?i.length?i.item(0):o2(i.changedTouches,t.changedTouches)[0]:t;e||(e=this.getChartPosition());let o=s.pageX-e.left,r=s.pageY-e.top;return oq(t,{chartX:Math.round(o/=e.scaleX),chartY:Math.round(r/=e.scaleY)})}onContainerClick(t){let e=this.chart,i=e.hoverPoint,s=this.normalize(t),o=e.plotLeft,r=e.plotTop;!e.cancelClick&&(i&&this.inClass(s.target,\"highcharts-tracker\")?(oK(i.series,\"click\",oq(s,{point:i})),e.hoverPoint&&i.firePointEvent(\"click\",s)):(oq(s,this.getCoordinates(s)),e.isInsidePlot(s.chartX-o,s.chartY-r,{visiblePlotOnly:!0})&&oK(e,\"click\",s)))}onContainerMouseDown(t){let e=(1&(t.buttons||t.button))==1;t=this.normalize(t),k.isFirefox&&0!==t.button&&this.onContainerMouseMove(t),(void 0===t.button||e)&&(this.zoomOption(t),e&&t.preventDefault?.(),this.dragStart(t))}onContainerMouseLeave(t){let{pointer:e}=oY[o2(o6.hoverChartIndex,-1)]||{};t=this.normalize(t),this.onContainerMouseMove(t),e&&!this.inClass(t.relatedTarget,\"highcharts-tooltip\")&&(e.reset(),e.chartPosition=void 0)}onContainerMouseEnter(){delete this.chartPosition}onContainerMouseMove(t){let e=this.chart,i=e.tooltip,s=this.normalize(t);this.setHoverChartIndex(t),(\"mousedown\"===e.mouseIsDown||this.touchSelect(s))&&this.drag(s),!e.openMenu&&(this.inClass(s.target,\"highcharts-tracker\")||e.isInsidePlot(s.chartX-e.plotLeft,s.chartY-e.plotTop,{visiblePlotOnly:!0}))&&!(i&&i.shouldStickOnContact(s))&&(this.inClass(s.target,\"highcharts-no-tooltip\")?this.reset(!1,0):this.runPointActions(s))}onDocumentTouchEnd(t){this.onDocumentMouseUp(t)}onContainerTouchMove(t){this.touchSelect(t)?this.onContainerMouseMove(t):this.touch(t)}onContainerTouchStart(t){this.touchSelect(t)?this.onContainerMouseDown(t):(this.zoomOption(t),this.touch(t,!0))}onDocumentMouseMove(t){let e=this.chart,i=e.tooltip,s=this.chartPosition,o=this.normalize(t,s);!s||e.isInsidePlot(o.chartX-e.plotLeft,o.chartY-e.plotTop,{visiblePlotOnly:!0})||i&&i.shouldStickOnContact(o)||o.target!==e.container.ownerDocument&&this.inClass(o.target,\"highcharts-tracker\")||this.reset()}onDocumentMouseUp(t){oY[o2(o6.hoverChartIndex,-1)]?.pointer?.drop(t)}pinch(t){let e=this,{chart:i,hasZoom:s,lastTouches:o}=e,r=[].map.call(t.touches||[],t=>e.normalize(t)),a=r.length,n=1===a&&(e.inClass(t.target,\"highcharts-tracker\")&&i.runTrackerClick||e.runChartClick),h=i.tooltip,l=1===a&&o2(h?.options.followTouchMove,!0);a>1?e.initiated=!0:l&&(e.initiated=!1),s&&e.initiated&&!n&&!1!==t.cancelable&&t.preventDefault(),\"touchstart\"===t.type?(e.pinchDown=r,e.res=!0,i.mouseDownX=t.chartX):l?this.runPointActions(e.normalize(t)):o&&(oK(i,\"touchpan\",{originalEvent:t,touches:r},()=>{let e=t=>{let e=t[0],i=t[1]||e;return{x:e.chartX,y:e.chartY,width:i.chartX-e.chartX,height:i.chartY-e.chartY}};i.transform({axes:i.axes.filter(t=>t.zoomEnabled&&(this.zoomHor&&t.horiz||this.zoomVert&&!t.horiz)),to:e(r),from:e(o),trigger:t.type})}),e.res&&(e.res=!1,this.reset(!1,0))),e.lastTouches=r}reset(t,e){let i=this.chart,s=i.hoverSeries,o=i.hoverPoint,r=i.hoverPoints,a=i.tooltip,n=a&&a.shared?r:o;t&&n&&o5(n).forEach(function(e){e.series.isCartesian&&void 0===e.plotX&&(t=!1)}),t?a&&n&&o5(n).length&&(a.refresh(n),a.shared&&r?r.forEach(function(t){t.setState(t.state,!0),t.series.isCartesian&&(t.series.xAxis.crosshair&&t.series.xAxis.drawCrosshair(null,t),t.series.yAxis.crosshair&&t.series.yAxis.drawCrosshair(null,t))}):o&&(o.setState(o.state,!0),i.axes.forEach(function(t){t.crosshair&&o.series[t.coll]===t&&t.drawCrosshair(null,o)}))):(o&&o.onMouseOut(),r&&r.forEach(function(t){t.setState()}),s&&s.onMouseOut(),a&&a.hide(e),this.unDocMouseMove&&(this.unDocMouseMove=this.unDocMouseMove()),i.axes.forEach(function(t){t.hideCrosshair()}),i.hoverPoints=i.hoverPoint=void 0)}runPointActions(t,e,i){let s=this.chart,o=s.series,r=s.tooltip&&s.tooltip.options.enabled?s.tooltip:void 0,a=!!r&&r.shared,n=e||s.hoverPoint,h=n&&n.series||s.hoverSeries,l=(!t||\"touchmove\"!==t.type)&&(!!e||h&&h.directTouch&&this.isDirectTouch),d=this.getHoverData(n,h,o,l,a,t);n=d.hoverPoint,h=d.hoverSeries;let c=d.hoverPoints,p=h&&h.tooltipOptions.followPointer&&!h.tooltipOptions.split,g=a&&h&&!h.noSharedTooltip;if(n&&(i||n!==s.hoverPoint||r&&r.isHidden)){if((s.hoverPoints||[]).forEach(function(t){-1===c.indexOf(t)&&t.setState()}),s.hoverSeries!==h&&h.onMouseOver(),this.applyInactiveState(c),(c||[]).forEach(function(t){t.setState(\"hover\")}),s.hoverPoint&&s.hoverPoint.firePointEvent(\"mouseOut\"),!n.series)return;s.hoverPoints=c,s.hoverPoint=n,n.firePointEvent(\"mouseOver\",void 0,()=>{r&&n&&r.refresh(g?c:n,t)})}else if(p&&r&&!r.isHidden){let e=r.getAnchor([{}],t);s.isInsidePlot(e[0],e[1],{visiblePlotOnly:!0})&&r.updatePosition({plotX:e[0],plotY:e[1]})}this.unDocMouseMove||(this.unDocMouseMove=o$(s.container.ownerDocument,\"mousemove\",t=>oY[o6.hoverChartIndex??-1]?.pointer?.onDocumentMouseMove(t)),this.eventsToUnbind.push(this.unDocMouseMove)),s.axes.forEach(function(e){let i;let o=o2((e.crosshair||{}).snap,!0);!o||(i=s.hoverPoint)&&i.series[e.coll]===e||(i=oZ(c,t=>t.series&&t.series[e.coll]===e)),i||!o?e.drawCrosshair(t,i):e.hideCrosshair()})}setDOMEvents(){let t=this.chart.container,e=t.ownerDocument;t.onmousedown=this.onContainerMouseDown.bind(this),t.onmousemove=this.onContainerMouseMove.bind(this),t.onclick=this.onContainerClick.bind(this),this.eventsToUnbind.push(o$(t,\"mouseenter\",this.onContainerMouseEnter.bind(this)),o$(t,\"mouseleave\",this.onContainerMouseLeave.bind(this))),o6.unbindDocumentMouseUp.some(t=>t.doc===e)||o6.unbindDocumentMouseUp.push({doc:e,unbind:o$(e,\"mouseup\",this.onDocumentMouseUp.bind(this))});let i=this.chart.renderTo.parentElement;for(;i&&\"BODY\"!==i.tagName;)this.eventsToUnbind.push(o$(i,\"scroll\",()=>{delete this.chartPosition})),i=i.parentElement;this.eventsToUnbind.push(o$(t,\"touchstart\",this.onContainerTouchStart.bind(this),{passive:!1}),o$(t,\"touchmove\",this.onContainerTouchMove.bind(this),{passive:!1})),o6.unbindDocumentTouchEnd||(o6.unbindDocumentTouchEnd=o$(e,\"touchend\",this.onDocumentTouchEnd.bind(this),{passive:!1})),this.setPointerCapture(),o$(this.chart,\"redraw\",this.setPointerCapture.bind(this))}setPointerCapture(){if(!oU)return;let t=this.pointerCaptureEventsToUnbind,e=this.chart,i=e.container,s=o2(e.options.tooltip?.followTouchMove,!0)&&e.series.some(t=>t.options.findNearestPointBy.indexOf(\"y\")>-1);!this.hasPointerCapture&&s?(t.push(o$(i,\"pointerdown\",t=>{t.target?.hasPointerCapture(t.pointerId)&&t.target?.releasePointerCapture(t.pointerId)}),o$(i,\"pointermove\",t=>{e.pointer?.getPointFromEvent(t)?.onMouseOver(t)})),e.styledMode||o_(i,{\"touch-action\":\"none\"}),i.className+=\" highcharts-no-touch-action\",this.hasPointerCapture=!0):this.hasPointerCapture&&!s&&(t.forEach(t=>t()),t.length=0,e.styledMode||o_(i,{\"touch-action\":o2(e.options.chart.style?.[\"touch-action\"],\"manipulation\")}),i.className=i.className.replace(\" highcharts-no-touch-action\",\"\"),this.hasPointerCapture=!1)}setHoverChartIndex(t){let e=this.chart,i=k.charts[o2(o6.hoverChartIndex,-1)];if(i&&i!==e){let s={relatedTarget:e.container};t&&!t?.relatedTarget&&Object.assign({},t,s),i.pointer?.onContainerMouseLeave(t||s)}i&&i.mouseIsDown||(o6.hoverChartIndex=e.index)}touch(t,e){let i;let{chart:s,pinchDown:o=[]}=this;this.setHoverChartIndex(),1===(t=this.normalize(t)).touches.length?s.isInsidePlot(t.chartX-s.plotLeft,t.chartY-s.plotTop,{visiblePlotOnly:!0})&&!s.openMenu?(e&&this.runPointActions(t),\"touchmove\"===t.type&&(i=!!o[0]&&Math.pow(o[0].chartX-t.chartX,2)+Math.pow(o[0].chartY-t.chartY,2)>=16),o2(i,!0)&&this.pinch(t)):e&&this.reset():2===t.touches.length&&this.pinch(t)}touchSelect(t){return!!(this.chart.zooming.singleTouch&&t.touches&&1===t.touches.length)}zoomOption(t){let e=this.chart,i=e.inverted,s=e.zooming.type||\"\",o,r;/touch/.test(t.type)&&(s=o2(e.zooming.pinchType,s)),this.zoomX=o=/x/.test(s),this.zoomY=r=/y/.test(s),this.zoomHor=o&&!i||r&&i,this.zoomVert=r&&!i||o&&i,this.hasZoom=o||r}}o6.unbindDocumentMouseUp=[],function(t){t.compose=function(e){o3(oj,\"Core.Pointer\")&&o$(e,\"beforeRender\",function(){this.pointer=new t(this,this.options)})}}(o6||(o6={}));let o9=o6,{fireEvent:o4,isArray:o8,objectEach:o7,uniqueKey:rt}=$,re=class{constructor(t={}){this.autoId=!t.id,this.columns={},this.id=t.id||rt(),this.modified=this,this.rowCount=0,this.versionTag=rt();let e=0;o7(t.columns||{},(t,i)=>{this.columns[i]=t.slice(),e=Math.max(e,t.length)}),this.applyRowCount(e)}applyRowCount(t){this.rowCount=t,o7(this.columns,e=>{o8(e)&&(e.length=t)})}getColumn(t,e){return this.columns[t]}getColumns(t,e){return(t||Object.keys(this.columns)).reduce((t,e)=>(t[e]=this.columns[e],t),{})}getRow(t,e){return(e||Object.keys(this.columns)).map(e=>this.columns[e]?.[t])}setColumn(t,e=[],i=0,s){this.setColumns({[t]:e},i,s)}setColumns(t,e,i){let s=this.rowCount;o7(t,(t,e)=>{this.columns[e]=t.slice(),s=t.length}),this.applyRowCount(s),i?.silent||(o4(this,\"afterSetColumns\"),this.versionTag=rt())}setRow(t,e=this.rowCount,i,s){let{columns:o}=this,r=i?this.rowCount+1:e+1;o7(t,(t,a)=>{let n=o[a]||s?.addColumns!==!1&&Array(r);n&&(i?n.splice(e,0,t):n[e]=t,o[a]=n)}),r>this.rowCount&&this.applyRowCount(r),s?.silent||(o4(this,\"afterSetRows\"),this.versionTag=rt())}},{extend:ri,merge:rs,pick:ro}=$;!function(t){function e(t,e,i){let s=this.legendItem=this.legendItem||{},{chart:o,options:r}=this,{baseline:a=0,symbolWidth:n,symbolHeight:h}=t,l=this.symbol||\"circle\",d=h/2,c=o.renderer,p=s.group,g=a-Math.round((t.fontMetrics?.b||h)*(i?.4:.3)),u={},f,m=r.marker,x=0;if(o.styledMode||(u[\"stroke-width\"]=Math.min(r.lineWidth||0,24),r.dashStyle?u.dashstyle=r.dashStyle:\"square\"===r.linecap||(u[\"stroke-linecap\"]=\"round\")),s.line=c.path().addClass(\"highcharts-graph\").attr(u).add(p),i&&(s.area=c.path().addClass(\"highcharts-area\").add(p)),u[\"stroke-linecap\"]&&(x=Math.min(s.line.strokeWidth(),n)/2),n){let t=[[\"M\",x,g],[\"L\",n-x,g]];s.line.attr({d:t}),s.area?.attr({d:[...t,[\"L\",n-x,a],[\"L\",x,a]]})}if(m&&!1!==m.enabled&&n){let t=Math.min(ro(m.radius,d),d);0===l.indexOf(\"url\")&&(m=rs(m,{width:h,height:h}),t=0),s.symbol=f=c.symbol(l,n/2-t,g-t,2*t,2*t,ri({context:\"legend\"},m)).addClass(\"highcharts-point\").add(p),f.isMarker=!0}}t.areaMarker=function(t,i){e.call(this,t,i,!0)},t.lineMarker=e,t.rectangle=function(t,e){let i=e.legendItem||{},s=t.options,o=t.symbolHeight,r=s.squareSymbol,a=r?o:t.symbolWidth;i.symbol=this.chart.renderer.rect(r?(t.symbolWidth-o)/2:0,t.baseline-o+1,a,o,ro(t.options.symbolRadius,o/2)).addClass(\"highcharts-point\").attr({zIndex:3}).add(i.group)}}(d||(d={}));let rr=d,{defaultOptions:ra}=tm,{extend:rn,extendClass:rh,merge:rl}=$;!function(t){function e(e,i){let s=ra.plotOptions||{},o=i.defaultOptions,r=i.prototype;return r.type=e,r.pointClass||(r.pointClass=oF),!t.seriesTypes[e]&&(o&&(s[e]=o),t.seriesTypes[e]=i,!0)}t.seriesTypes=k.seriesTypes,t.registerSeriesType=e,t.seriesType=function(i,s,o,r,a){let n=ra.plotOptions||{};if(s=s||\"\",n[i]=rl(n[s],o),delete t.seriesTypes[i],e(i,rh(t.seriesTypes[s]||function(){},r)),t.seriesTypes[i].prototype.type=i,a){class e extends oF{}rn(e.prototype,a),t.seriesTypes[i].prototype.pointClass=e}return t.seriesTypes[i]}}(c||(c={}));let rd=c,{animObject:rc,setAnimation:rp}=tR,{defaultOptions:rg}=tm,{registerEventOptions:ru}=i3,{svg:rf,win:rm}=k,{seriesTypes:rx}=rd,{arrayMax:ry,arrayMin:rb,clamp:rv,correctFloat:rk,crisp:rw,defined:rM,destroyObjectProperties:rS,diffObjects:rT,erase:rC,error:rA,extend:rP,find:rL,fireEvent:rO,getClosestDistance:rE,getNestedProperty:rI,insertItem:rD,isArray:rB,isNumber:rN,isString:rz,merge:rR,objectEach:rW,pick:rH,removeEvent:rX,syncTimeout:rF}=$;class rG{constructor(){this.zoneAxis=\"y\"}init(t,e){let i;rO(this,\"init\",{options:e}),this.dataTable??(this.dataTable=new re);let s=t.series;this.eventsToUnbind=[],this.chart=t,this.options=this.setOptions(e);let o=this.options,r=!1!==o.visible;this.linkedSeries=[],this.bindAxes(),rP(this,{name:o.name,state:\"\",visible:r,selected:!0===o.selected}),ru(this,o);let a=o.events;(a&&a.click||o.point&&o.point.events&&o.point.events.click||o.allowPointSelect)&&(t.runTrackerClick=!0),this.getColor(),this.getSymbol(),this.isCartesian&&(t.hasCartesianSeries=!0),s.length&&(i=s[s.length-1]),this._i=rH(i&&i._i,-1)+1,this.opacity=this.options.opacity,t.orderItems(\"series\",rD(this,s)),o.dataSorting&&o.dataSorting.enabled?this.setDataSortingOptions():this.points||this.data||this.setData(o.data,!1),rO(this,\"afterInit\")}is(t){return rx[t]&&this instanceof rx[t]}bindAxes(){let t;let e=this,i=e.options,s=e.chart;rO(this,\"bindAxes\",null,function(){(e.axisTypes||[]).forEach(function(o){(s[o]||[]).forEach(function(s){t=s.options,(rH(i[o],0)===s.index||void 0!==i[o]&&i[o]===t.id)&&(rD(e,s.series),e[o]=s,s.isDirty=!0)}),e[o]||e.optionalAxis===o||rA(18,!0,s)})}),rO(this,\"afterBindAxes\")}hasData(){return this.visible&&void 0!==this.dataMax&&void 0!==this.dataMin||this.visible&&this.dataTable.rowCount>0}hasMarkerChanged(t,e){let i=t.marker,s=e.marker||{};return i&&(s.enabled&&!i.enabled||s.symbol!==i.symbol||s.height!==i.height||s.width!==i.width)}autoIncrement(t){let e;let i=this.options,{pointIntervalUnit:s,relativeXValue:o}=this.options,r=this.chart.time,a=this.xIncrement??r.parse(i.pointStart)??0;if(this.pointInterval=e=rH(this.pointInterval,i.pointInterval,1),o&&rN(t)&&(e*=t),s){let t=r.toParts(a);\"day\"===s?t[2]+=e:\"month\"===s?t[1]+=e:\"year\"===s&&(t[0]+=e),e=r.makeTime.apply(r,t)-a}return o&&rN(t)?a+e:(this.xIncrement=a+e,a)}setDataSortingOptions(){let t=this.options;rP(this,{requireSorting:!1,sorted:!1,enabledDataSorting:!0,allowDG:!1}),rM(t.pointRange)||(t.pointRange=1)}setOptions(t){let e;let i=this.chart,s=i.options.plotOptions,o=i.userOptions||{},r=rR(t),a=i.styledMode,n={plotOptions:s,userOptions:r};rO(this,\"setOptions\",n);let h=n.plotOptions[this.type],l=o.plotOptions||{},d=l.series||{},c=rg.plotOptions[this.type]||{},p=l[this.type]||{};this.userOptions=n.userOptions;let g=rR(h,s.series,p,r);this.tooltipOptions=rR(rg.tooltip,rg.plotOptions.series?.tooltip,c?.tooltip,i.userOptions.tooltip,l.series?.tooltip,p.tooltip,r.tooltip),this.stickyTracking=rH(r.stickyTracking,p.stickyTracking,d.stickyTracking,!!this.tooltipOptions.shared&&!this.noSharedTooltip||g.stickyTracking),null===h.marker&&delete g.marker,this.zoneAxis=g.zoneAxis||\"y\";let u=this.zones=(g.zones||[]).map(t=>({...t}));return(g.negativeColor||g.negativeFillColor)&&!g.zones&&(e={value:g[this.zoneAxis+\"Threshold\"]||g.threshold||0,className:\"highcharts-negative\"},a||(e.color=g.negativeColor,e.fillColor=g.negativeFillColor),u.push(e)),u.length&&rM(u[u.length-1].value)&&u.push(a?{}:{color:this.color,fillColor:this.fillColor}),rO(this,\"afterSetOptions\",{options:g}),g}getName(){return rH(this.options.name,\"Series \"+(this.index+1))}getCyclic(t,e,i){let s,o;let r=this.chart,a=`${t}Index`,n=`${t}Counter`,h=i?.length||r.options.chart.colorCount;!e&&(rM(o=rH(\"color\"===t?this.options.colorIndex:void 0,this[a]))?s=o:(r.series.length||(r[n]=0),s=r[n]%h,r[n]+=1),i&&(e=i[s])),void 0!==s&&(this[a]=s),this[t]=e}getColor(){this.chart.styledMode?this.getCyclic(\"color\"):this.options.colorByPoint?this.color=\"#cccccc\":this.getCyclic(\"color\",this.options.color||rg.plotOptions[this.type].color,this.chart.options.colors)}getPointsCollection(){return(this.hasGroupedData?this.points:this.data)||[]}getSymbol(){let t=this.options.marker;this.getCyclic(\"symbol\",t.symbol,this.chart.options.symbols)}getColumn(t,e){return(e?this.dataTable.modified:this.dataTable).getColumn(t,!0)||[]}findPointIndex(t,e){let i,s,o;let r=t.id,a=t.x,n=this.points,h=this.options.dataSorting;if(r){let t=this.chart.get(r);t instanceof oF&&(i=t)}else if(this.linkedParent||this.enabledDataSorting||this.options.relativeXValue){let e=e=>!e.touched&&e.index===t.index;if(h&&h.matchByName?e=e=>!e.touched&&e.name===t.name:this.options.relativeXValue&&(e=e=>!e.touched&&e.options.x===t.x),!(i=rL(n,e)))return}return i&&void 0!==(o=i&&i.index)&&(s=!0),void 0===o&&rN(a)&&(o=this.getColumn(\"x\").indexOf(a,e)),-1!==o&&void 0!==o&&this.cropped&&(o=o>=this.cropStart?o-this.cropStart:o),!s&&rN(o)&&n[o]&&n[o].touched&&(o=void 0),o}updateData(t,e){let i=this.options,s=i.dataSorting,o=this.points,r=[],a=this.requireSorting,n=t.length===o.length,h,l,d,c,p=!0;if(this.xIncrement=null,t.forEach(function(t,e){let l;let d=rM(t)&&this.pointClass.prototype.optionsToObject.call({series:this},t)||{},p=d.x;d.id||rN(p)?(-1===(l=this.findPointIndex(d,c))||void 0===l?r.push(t):o[l]&&t!==i.data[l]?(o[l].update(t,!1,null,!1),o[l].touched=!0,a&&(c=l+1)):o[l]&&(o[l].touched=!0),(!n||e!==l||s&&s.enabled||this.hasDerivedData)&&(h=!0)):r.push(t)},this),h)for(l=o.length;l--;)(d=o[l])&&!d.touched&&d.remove&&d.remove(!1,e);else!n||s&&s.enabled?p=!1:(t.forEach(function(t,e){t===o[e].y||o[e].destroyed||o[e].update(t,!1,null,!1)}),r.length=0);if(o.forEach(function(t){t&&(t.touched=!1)}),!p)return!1;r.forEach(function(t){this.addPoint(t,!1,null,null,!1)},this);let g=this.getColumn(\"x\");return null===this.xIncrement&&g.length&&(this.xIncrement=ry(g),this.autoIncrement()),!0}dataColumnKeys(){return[\"x\",...this.pointArrayMap||[\"y\"]]}setData(t,e=!0,i,s){let o=this.points,r=o&&o.length||0,a=this.options,n=this.chart,h=a.dataSorting,l=this.xAxis,d=a.turboThreshold,c=this.dataTable,p=this.dataColumnKeys(),g=this.pointValKey||\"y\",u=(this.pointArrayMap||[]).length,f=a.keys,m,x,y=0,b=1,v;n.options.chart.allowMutatingData||(a.data&&delete this.options.data,this.userOptions.data&&delete this.userOptions.data,v=rR(!0,t));let k=(t=v||t||[]).length;if(h&&h.enabled&&(t=this.sortData(t)),n.options.chart.allowMutatingData&&!1!==s&&k&&r&&!this.cropped&&!this.hasGroupedData&&this.visible&&!this.boosted&&(x=this.updateData(t,i)),!x){this.xIncrement=null,this.colorCounter=0;let e=d&&k>d;if(e){let i=this.getFirstValidPoint(t),s=this.getFirstValidPoint(t,k-1,-1),o=t=>!!(rB(t)&&(f||rN(t[0])));if(rN(i)&&rN(s)){let e=[],i=[];for(let s of t)e.push(this.autoIncrement()),i.push(s);c.setColumns({x:e,[g]:i})}else if(o(i)&&o(s)){if(u){let e=i.length===u?1:0,s=Array(p.length).fill(0).map(()=>[]);for(let i of t){e&&s[0].push(this.autoIncrement());for(let t=e;t<=u;t++)s[t]?.push(i[t-e])}c.setColumns(p.reduce((t,e,i)=>(t[e]=s[i],t),{}))}else{f&&(y=f.indexOf(\"x\"),b=f.indexOf(\"y\"),y=y>=0?y:0,b=b>=0?b:1),1===i.length&&(b=0);let e=[],s=[];if(y===b)for(let i of t)e.push(this.autoIncrement()),s.push(i[b]);else for(let i of t)e.push(i[y]),s.push(i[b]);c.setColumns({x:e,[g]:s})}}else e=!1}if(!e){let e=p.reduce((t,e)=>(t[e]=[],t),{});for(m=0;m{let s=rI(i,t),o=rI(i,e);return os?1:0}).forEach(function(t,e){t.x=e},this),e.linkedSeries&&e.linkedSeries.forEach(function(e){let i=e.options,o=i.data;i.dataSorting&&i.dataSorting.enabled||!o||(o.forEach(function(i,r){o[r]=s(e,i),t[r]&&(o[r].x=t[r].x,o[r].index=r)}),e.setData(o,!1))}),t}getProcessedData(t){let e=this,{dataTable:i,isCartesian:s,options:o,xAxis:r}=e,a=o.cropThreshold,n=t||e.getExtremesFromAll,h=r?.logarithmic,l=i.rowCount,d,c,p=0,g,u,f,m=e.getColumn(\"x\"),x=i,y=!1;return r&&(u=(g=r.getExtremes()).min,f=g.max,y=!!(r.categories&&!r.names.length),s&&e.sorted&&!n&&(!a||l>a||e.forceCrop)&&(m[l-1]f?x=new re:e.getColumn(e.pointValKey||\"y\").length&&(m[0]f)&&(x=(d=this.cropData(i,u,f)).modified,p=d.start,c=!0))),m=x.getColumn(\"x\")||[],{modified:x,cropped:c,cropStart:p,closestPointRange:rE([h?m.map(h.log2lin):m],()=>e.requireSorting&&!y&&rA(15,!1,e.chart))}}processData(t){let e=this.xAxis,i=this.dataTable;if(this.isCartesian&&!this.isDirty&&!e.isDirty&&!this.yAxis.isDirty&&!t)return!1;let s=this.getProcessedData();i.modified=s.modified,this.cropped=s.cropped,this.cropStart=s.cropStart,this.closestPointRange=this.basePointRange=s.closestPointRange,rO(this,\"afterProcessData\")}cropData(t,e,i){let s=t.getColumn(\"x\",!0)||[],o=s.length,r={},a,n,h=0,l=o;for(a=0;a=e){h=Math.max(0,a-1);break}for(n=a;ni){l=n+1;break}for(let e of this.dataColumnKeys()){let i=t.getColumn(e,!0);i&&(r[e]=i.slice(h,l))}return{modified:new re({columns:r}),start:h,end:l}}generatePoints(){let t=this.options,e=this.processedData||t.data,i=this.dataTable.modified,s=this.getColumn(\"x\",!0),o=this.pointClass,r=i.rowCount,a=this.cropStart||0,n=this.hasGroupedData,h=t.keys,l=[],d=t.dataGrouping&&t.dataGrouping.groupAll?a:0,c=this.xAxis?.categories,p=this.pointArrayMap||[\"y\"],g=this.dataColumnKeys(),u,f,m,x,y=this.data,b;if(!y&&!n){let t=[];t.length=e?.length||0,y=this.data=t}for(h&&n&&(this.options.keys=!1),x=0;xr.getColumn(t,!0)||[])||[],l=this.getColumn(\"x\",!0),d=[],c=this.requireSorting&&!this.is(\"column\")?1:0,p=!!s&&s.positiveValuesOnly,g=o||this.cropped||!i,u,f,m,x=0,y=0;for(i&&(x=(u=i.getExtremes()).min,y=u.max),m=0;m=x&&(l[m-c]||f)<=y)for(let t of h){let e=t[m];rN(e)&&(e>0||!p)&&d.push(e)}let b={activeYData:d,dataMin:rb(d),dataMax:ry(d)};return rO(this,\"afterGetExtremes\",{dataExtremes:b}),b}applyExtremes(){let t=this.getExtremes();return this.dataMin=t.dataMin,this.dataMax=t.dataMax,t}getFirstValidPoint(t,e=0,i=1){let s=t.length,o=e;for(;o>=0&&o1)&&(r.step=function(t,e){i&&i.apply(e,arguments),\"width\"===e.prop&&h?.element&&h.attr(o?\"height\":\"width\",t+99)}),n.addClass(\"highcharts-animating\").animate(t,r)}}afterAnimate(){this.setClip(),rW(this.chart.sharedClips,(t,e,i)=>{t&&!this.chart.container.querySelector(`[clip-path=\"url(#${t.id})\"]`)&&(t.destroy(),delete i[e])}),this.finishedAnimating=!0,rO(this,\"afterAnimate\")}drawPoints(t=this.points){let e,i,s,o,r,a,n;let h=this.chart,l=h.styledMode,{colorAxis:d,options:c}=this,p=c.marker,g=this[this.specialGroup||\"markerGroup\"],u=this.xAxis,f=rH(p.enabled,!u||!!u.isRadial||null,this.closestPointRangePx>=p.enabledThreshold*p.radius);if(!1!==p.enabled||this._hasPointMarkers)for(e=0;e0||i.hasImage)&&(i.graphic=s=h.renderer.symbol(t,n.x,n.y,n.width,n.height,a?r:p).add(g),this.enabledDataSorting&&h.hasRendered&&(s.attr({x:i.startXPos}),o=\"animate\")),s&&\"animate\"===o&&s[e?\"show\":\"hide\"](e).animate(n),s){let t=this.pointAttribs(i,l||!i.selected?void 0:\"select\");l?d&&s.css({fill:t.fill}):s[o](t)}s&&s.addClass(i.getClassName(),!0)}else s&&(i.graphic=s.destroy())}markerAttribs(t,e){let i=this.options,s=i.marker,o=t.marker||{},r=o.symbol||s.symbol,a={},n,h,l=rH(o.radius,s&&s.radius);e&&(n=s.states[e],l=rH((h=o.states&&o.states[e])&&h.radius,n&&n.radius,l&&l+(n&&n.radiusPlus||0))),t.hasImage=r&&0===r.indexOf(\"url\"),t.hasImage&&(l=0);let d=t.pos();return rN(l)&&d&&(i.crisp&&(d[0]=rw(d[0],t.hasImage?0:\"rect\"===r?s?.lineWidth||0:1)),a.x=d[0]-l,a.y=d[1]-l),l&&(a.width=a.height=2*l),a}pointAttribs(t,e){let i=this.options.marker,s=t&&t.options,o=s&&s.marker||{},r=s&&s.color,a=t&&t.color,n=t&&t.zone&&t.zone.color,h,l,d=this.color,c,p,g=rH(o.lineWidth,i.lineWidth),u=1;return d=r||n||a||d,c=o.fillColor||i.fillColor||d,p=o.lineColor||i.lineColor||d,e=e||\"normal\",h=i.states[e]||{},g=rH((l=o.states&&o.states[e]||{}).lineWidth,h.lineWidth,g+rH(l.lineWidthPlus,h.lineWidthPlus,0)),c=l.fillColor||h.fillColor||c,{stroke:p=l.lineColor||h.lineColor||p,\"stroke-width\":g,fill:c,opacity:u=rH(l.opacity,h.opacity,u)}}destroy(t){let e,i,s;let o=this,r=o.chart,a=/AppleWebKit\\/533/.test(rm.navigator.userAgent),n=o.data||[];for(rO(o,\"destroy\",{keepEventsForUpdate:t}),this.removeEvents(t),(o.axisTypes||[]).forEach(function(t){(s=o[t])&&s.series&&(rC(s.series,o),s.isDirty=s.forceRedraw=!0)}),o.legendItem&&o.chart.legend.destroyItem(o),e=n.length;e--;)(i=n[e])&&i.destroy&&i.destroy();for(let t of o.zones)rS(t,void 0,!0);$.clearTimeout(o.animationTimeout),rW(o,function(t,e){t instanceof ej&&!t.survive&&t[a&&\"group\"===e?\"hide\":\"destroy\"]()}),r.hoverSeries===o&&(r.hoverSeries=void 0),rC(r.series,o),r.orderItems(\"series\"),rW(o,function(e,i){t&&\"hcEvents\"===i||delete o[i]})}applyZones(){let{area:t,chart:e,graph:i,zones:s,points:o,xAxis:r,yAxis:a,zoneAxis:n}=this,{inverted:h,renderer:l}=e,d=this[`${n}Axis`],{isXAxis:c,len:p=0,minPointOffset:g=0}=d||{},u=(i?.strokeWidth()||0)/2+1,f=(t,e=0,i=0)=>{h&&(i=p-i);let{translated:s=0,lineClip:o}=t,r=i-s;o?.push([\"L\",e,Math.abs(r){t.forEach((e,i)=>{(\"M\"===e[0]||\"L\"===e[0])&&(t[i]=[e[0],c?p-e[1]:e[1],c?e[2]:p-e[2]])})};if(s.forEach(t=>{t.lineClip=[],t.translated=rv(d.toPixels(rH(t.value,e),!0)||0,0,p)}),i&&!this.showLine&&i.hide(),t&&t.hide(),\"y\"===n&&o.length{let s=e.lineClip||[],o=Math.round(e.translated||0);r.reversed&&s.reverse();let{clip:n,simpleClip:d}=e,p=0,g=0,f=r.len,y=a.len;c?(p=o,f=x):(g=o,y=x);let b=[[\"M\",p,g],[\"L\",f,g],[\"L\",f,y],[\"L\",p,y],[\"Z\"]],v=[b[0],...s,b[1],b[2],...m,b[3],b[4]];m=s.reverse(),x=o,h&&(u(v),t&&u(b)),n?(n.animate({d:v}),d?.animate({d:b})):(n=e.clip=l.path(v),t&&(d=e.simpleClip=l.path(b))),i&&e.graph?.clip(n),t&&e.area?.clip(d)})}else this.visible&&(i&&i.show(),t&&t.show())}plotGroup(t,e,i,s,o){let r=this[t],a=!r,n={visibility:i,zIndex:s||.1};return rM(this.opacity)&&!this.chart.styledMode&&\"inactive\"!==this.state&&(n.opacity=this.opacity),r||(this[t]=r=this.chart.renderer.g().add(o)),r.addClass(\"highcharts-\"+e+\" highcharts-series-\"+this.index+\" highcharts-\"+this.type+\"-series \"+(rM(this.colorIndex)?\"highcharts-color-\"+this.colorIndex+\" \":\"\")+(this.options.className||\"\")+(r.hasClass(\"highcharts-tracker\")?\" highcharts-tracker\":\"\"),!0),r.attr(n)[a?\"attr\":\"animate\"](this.getPlotBox(e)),r}getPlotBox(t){let e=this.xAxis,i=this.yAxis,s=this.chart,o=s.inverted&&!s.polar&&e&&this.invertible&&\"series\"===t;return s.inverted&&(e=i,i=this.xAxis),{translateX:e?e.left:s.plotLeft,translateY:i?i.top:s.plotTop,rotation:o?90:0,rotationOriginX:o?(e.len-i.len)/2:0,rotationOriginY:o?(e.len+i.len)/2:0,scaleX:o?-1:1,scaleY:1}}removeEvents(t){let{eventsToUnbind:e}=this;t||rX(this),e.length&&(e.forEach(t=>{t()}),e.length=0)}render(){let t=this,{chart:e,options:i,hasRendered:s}=t,o=rc(i.animation),r=t.visible?\"inherit\":\"hidden\",a=i.zIndex,n=e.seriesGroup,h=t.finishedAnimating?0:o.duration;rO(this,\"render\"),t.plotGroup(\"group\",\"series\",r,a,n),t.markerGroup=t.plotGroup(\"markerGroup\",\"markers\",r,a,n),!1!==i.clip&&t.setClip(),h&&t.animate?.(!0),t.drawGraph&&(t.drawGraph(),t.applyZones()),t.visible&&t.drawPoints(),t.drawDataLabels?.(),t.redrawPoints?.(),i.enableMouseTracking&&t.drawTracker?.(),h&&t.animate?.(),s||(h&&o.defer&&(h+=o.defer),t.animationTimeout=rF(()=>{t.afterAnimate()},h||0)),t.isDirty=!1,t.hasRendered=!0,rO(t,\"afterRender\")}redraw(){let t=this.isDirty||this.isDirtyData;this.translate(),this.render(),t&&delete this.kdTree}reserveSpace(){return this.visible||!this.chart.options.chart.ignoreHiddenSeries}searchPoint(t,e){let{xAxis:i,yAxis:s}=this,o=this.chart.inverted;return this.searchKDTree({clientX:o?i.len-t.chartY+i.pos:t.chartX-i.pos,plotY:o?s.len-t.chartX+s.pos:t.chartY-s.pos},e,t)}buildKDTree(t){this.buildingKdTree=!0;let e=this,i=e.options.findNearestPointBy.indexOf(\"y\")>-1?2:1;delete e.kdTree,rF(function(){e.kdTree=function t(i,s,o){let r,a;let n=i?.length;if(n)return r=e.kdAxisArray[s%o],i.sort((t,e)=>(t[r]||0)-(e[r]||0)),{point:i[a=Math.floor(n/2)],left:t(i.slice(0,a),s+1,o),right:t(i.slice(a+1),s+1,o)}}(e.getValidPoints(void 0,!e.directTouch),i,i),e.buildingKdTree=!1},e.options.kdNow||t?.type===\"touchstart\"?0:1)}searchKDTree(t,e,i,s,o){let r=this,[a,n]=this.kdAxisArray,h=e?\"distX\":\"dist\",l=(r.options.findNearestPointBy||\"\").indexOf(\"y\")>-1?2:1,d=!!r.isBubble,c=s||((t,e,i)=>[(t[i]||0)<(e[i]||0)?t:e,!1]),p=o||((t,e)=>t=0&&r<=(s?s.len:e.plotHeight)&&o>=0&&o<=(i?i.len:e.plotWidth)}drawTracker(){let t=this,e=t.options,i=e.trackByArea,s=[].concat((i?t.areaPath:t.graphPath)||[]),o=t.chart,r=o.pointer,a=o.renderer,n=o.options.tooltip?.snap||0,h=()=>{e.enableMouseTracking&&o.hoverSeries!==t&&t.onMouseOver()},l=\"rgba(192,192,192,\"+(rf?1e-4:.002)+\")\",d=t.tracker;d?d.attr({d:s}):t.graph&&(t.tracker=d=a.path(s).attr({visibility:t.visible?\"inherit\":\"hidden\",zIndex:2}).addClass(i?\"highcharts-tracker-area\":\"highcharts-tracker-line\").add(t.group),o.styledMode||d.attr({\"stroke-linecap\":\"round\",\"stroke-linejoin\":\"round\",stroke:l,fill:i?l:\"none\",\"stroke-width\":t.graph.strokeWidth()+(i?0:2*n)}),[t.tracker,t.markerGroup,t.dataLabelsGroup].forEach(t=>{t&&(t.addClass(\"highcharts-tracker\").on(\"mouseover\",h).on(\"mouseout\",t=>{r?.onTrackerMouseOut(t)}),e.cursor&&!o.styledMode&&t.css({cursor:e.cursor}),t.on(\"touchstart\",h))})),rO(this,\"afterDrawTracker\")}addPoint(t,e,i,s,o){let r,a;let n=this.options,{chart:h,data:l,dataTable:d,xAxis:c}=this,p=c&&c.hasNames&&c.names,g=n.data,u=this.getColumn(\"x\");e=rH(e,!0);let f={series:this};this.pointClass.prototype.applyOptions.apply(f,[t]);let m=f.x;if(a=u.length,this.requireSorting&&mm;)a--;d.setRow(f,a,!0,{addColumns:!1}),p&&f.name&&(p[m]=f.name),g?.splice(a,0,t),(r||this.processedData)&&(this.data.splice(a,0,null),this.processData()),\"point\"===n.legendType&&this.generatePoints(),i&&(l[0]&&l[0].remove?l[0].remove(!1):([l,g,...Object.values(d.getColumns())].filter(rM).forEach(t=>{t.shift()}),d.rowCount-=1,rO(d,\"afterDeleteRows\"))),!1!==o&&rO(this,\"addPoint\",{point:f}),this.isDirty=!0,this.isDirtyData=!0,e&&h.redraw(s)}removePoint(t,e,i){let s=this,{chart:o,data:r,points:a,dataTable:n}=s,h=r[t],l=function(){[a?.length===r.length?a:void 0,r,s.options.data,...Object.values(n.getColumns())].filter(rM).forEach(e=>{e.splice(t,1)}),n.rowCount-=1,rO(n,\"afterDeleteRows\"),h?.destroy(),s.isDirty=!0,s.isDirtyData=!0,e&&o.redraw()};rp(i,o),e=rH(e,!0),h?h.firePointEvent(\"remove\",null,l):l()}remove(t,e,i,s){let o=this,r=o.chart;function a(){o.destroy(s),r.isDirtyLegend=r.isDirtyBox=!0,r.linkSeries(s),rH(t,!0)&&r.redraw(e)}!1!==i?rO(o,\"remove\",null,a):a()}update(t,e){rO(this,\"update\",{options:t=rT(t,this.userOptions)});let i=this,s=i.chart,o=i.userOptions,r=i.initialType||i.type,a=s.options.plotOptions,n=rx[r].prototype,h=i.finishedAnimating&&{animation:!1},l={},d,c,p=[\"colorIndex\",\"eventOptions\",\"navigatorSeries\",\"symbolIndex\",\"baseSeries\"],g=t.type||o.type||s.options.chart.type,u=!(this.hasDerivedData||g&&g!==this.type||void 0!==t.keys||void 0!==t.pointStart||void 0!==t.pointInterval||void 0!==t.relativeXValue||t.joinBy||t.mapData||[\"dataGrouping\",\"pointStart\",\"pointInterval\",\"pointIntervalUnit\",\"keys\"].some(t=>i.hasOptionChanged(t)));g=g||r,u?(p.push(\"data\",\"isDirtyData\",\"isDirtyCanvas\",\"points\",\"dataTable\",\"processedData\",\"xIncrement\",\"cropped\",\"_hasPointMarkers\",\"hasDataLabels\",\"nodes\",\"layout\",\"level\",\"mapMap\",\"mapData\",\"minY\",\"maxY\",\"minX\",\"maxX\",\"transformGroups\"),!1!==t.visible&&p.push(\"area\",\"graph\"),i.parallelArrays.forEach(function(t){p.push(t+\"Data\")}),t.data&&(t.dataSorting&&rP(i.options.dataSorting,t.dataSorting),this.setData(t.data,!1))):this.dataTable.modified=this.dataTable,t=rR(o,{index:void 0===o.index?i.index:o.index,pointStart:a?.series?.pointStart??o.pointStart??i.getColumn(\"x\")[0]},!u&&{data:i.options.data},t,h),u&&t.data&&(t.data=i.options.data),(p=[\"group\",\"markerGroup\",\"dataLabelsGroup\",\"transformGroup\"].concat(p)).forEach(function(t){p[t]=i[t],delete i[t]});let f=!1;if(rx[g]){if(f=g!==i.type,i.remove(!1,!1,!1,!0),f){if(s.propFromSeries(),Object.setPrototypeOf)Object.setPrototypeOf(i,rx[g].prototype);else{let t=Object.hasOwnProperty.call(i,\"hcEvents\")&&i.hcEvents;for(c in n)i[c]=void 0;rP(i,rx[g].prototype),t?i.hcEvents=t:delete i.hcEvents}}}else rA(17,!0,s,{missingModuleFor:g});if(p.forEach(function(t){i[t]=p[t]}),i.init(s,t),u&&this.points)for(let t of(!1===(d=i.options).visible?(l.graphic=1,l.dataLabel=1):(this.hasMarkerChanged(d,o)&&(l.graphic=1),i.hasDataLabels?.()||(l.dataLabel=1)),this.points))t&&t.series&&(t.resolveColor(),Object.keys(l).length&&t.destroyElements(l),!1===d.showInLegend&&t.legendItem&&s.legend.destroyItem(t));i.initialType=r,s.linkSeries(),s.setSortedData(),f&&i.linkedSeries.length&&(i.isDirtyData=!0),rO(this,\"afterUpdate\"),rH(e,!0)&&s.redraw(!!u&&void 0)}setName(t){this.name=this.options.name=this.userOptions.name=t,this.chart.isDirtyLegend=!0}hasOptionChanged(t){let e=this.chart,i=this.options[t],s=e.options.plotOptions,o=this.userOptions[t],r=rH(s?.[this.type]?.[t],s?.series?.[t]);return o&&!rM(r)?i!==o:i!==rH(r,i)}onMouseOver(){let t=this.chart,e=t.hoverSeries,i=t.pointer;i?.setHoverChartIndex(),e&&e!==this&&e.onMouseOut(),this.options.events.mouseOver&&rO(this,\"mouseOver\"),this.setState(\"hover\"),t.hoverSeries=this}onMouseOut(){let t=this.options,e=this.chart,i=e.tooltip,s=e.hoverPoint;e.hoverSeries=null,s&&s.onMouseOut(),this&&t.events.mouseOut&&rO(this,\"mouseOut\"),i&&!this.stickyTracking&&(!i.shared||this.noSharedTooltip)&&i.hide(),e.series.forEach(function(t){t.setState(\"\",!0)})}setState(t,e){let i=this,s=i.options,o=i.graph,r=s.inactiveOtherPoints,a=s.states,n=rH(a[t||\"normal\"]&&a[t||\"normal\"].animation,i.chart.options.chart.animation),h=s.lineWidth,l=s.opacity;if(t=t||\"\",i.state!==t&&([i.group,i.markerGroup,i.dataLabelsGroup].forEach(function(e){e&&(i.state&&e.removeClass(\"highcharts-series-\"+i.state),t&&e.addClass(\"highcharts-series-\"+t))}),i.state=t,!i.chart.styledMode)){if(a[t]&&!1===a[t].enabled)return;if(t&&(h=a[t].lineWidth||h+(a[t].lineWidthPlus||0),l=rH(a[t].opacity,l)),o&&!o.dashstyle&&rN(h))for(let t of[o,...this.zones.map(t=>t.graph)])t?.animate({\"stroke-width\":h},n);r||[i.group,i.markerGroup,i.dataLabelsGroup,i.labelBySeries].forEach(function(t){t&&t.animate({opacity:l},n)})}e&&r&&i.points&&i.setAllPointsToState(t||void 0)}setAllPointsToState(t){this.points.forEach(function(e){e.setState&&e.setState(t)})}setVisible(t,e){let i=this,s=i.chart,o=s.options.chart.ignoreHiddenSeries,r=i.visible;i.visible=t=i.options.visible=i.userOptions.visible=void 0===t?!r:t;let a=t?\"show\":\"hide\";[\"group\",\"dataLabelsGroup\",\"markerGroup\",\"tracker\",\"tt\"].forEach(t=>{i[t]?.[a]()}),(s.hoverSeries===i||s.hoverPoint?.series===i)&&i.onMouseOut(),i.legendItem&&s.legend.colorizeItem(i,t),i.isDirty=!0,i.options.stacking&&s.series.forEach(t=>{t.options.stacking&&t.visible&&(t.isDirty=!0)}),i.linkedSeries.forEach(e=>{e.setVisible(t,!1)}),o&&(s.isDirtyBox=!0),rO(i,a),!1!==e&&s.redraw()}show(){this.setVisible(!0)}hide(){this.setVisible(!1)}select(t){this.selected=t=this.options.selected=void 0===t?!this.selected:t,this.checkbox&&(this.checkbox.checked=t),rO(this,t?\"select\":\"unselect\")}shouldShowTooltip(t,e,i={}){return i.series=this,i.visiblePlotOnly=!0,this.chart.isInsidePlot(t,e,i)}drawLegendSymbol(t,e){rr[this.options.legendSymbol||\"rectangle\"]?.call(this,t,e)}}rG.defaultOptions={lineWidth:2,allowPointSelect:!1,crisp:!0,showCheckbox:!1,animation:{duration:1e3},enableMouseTracking:!0,events:{},marker:{enabledThreshold:2,lineColor:\"#ffffff\",lineWidth:0,radius:4,states:{normal:{animation:!0},hover:{animation:{duration:150},enabled:!0,radiusPlus:2,lineWidthPlus:1},select:{fillColor:\"#cccccc\",lineColor:\"#000000\",lineWidth:2}}},point:{events:{}},dataLabels:{animation:{},align:\"center\",borderWidth:0,defer:!0,formatter:function(){let{numberFormatter:t}=this.series.chart;return\"number\"!=typeof this.y?\"\":t(this.y,-1)},padding:5,style:{fontSize:\"0.7em\",fontWeight:\"bold\",color:\"contrast\",textOutline:\"1px contrast\"},verticalAlign:\"bottom\",x:0,y:0},cropThreshold:300,opacity:1,pointRange:0,softThreshold:!0,states:{normal:{animation:!0},hover:{animation:{duration:150},lineWidthPlus:1,marker:{},halo:{size:10,opacity:.25}},select:{animation:{duration:0}},inactive:{animation:{duration:150},opacity:.2}},stickyTracking:!0,turboThreshold:1e3,findNearestPointBy:\"x\"},rG.types=rd.seriesTypes,rG.registerType=rd.registerSeriesType,rP(rG.prototype,{axisTypes:[\"xAxis\",\"yAxis\"],coll:\"series\",colorCounter:0,directTouch:!1,invertible:!0,isCartesian:!0,kdAxisArray:[\"clientX\",\"plotY\"],parallelArrays:[\"x\",\"y\"],pointClass:oF,requireSorting:!0,sorted:!0}),rd.series=rG;let rY=rG,{animObject:rj,setAnimation:rU}=tR,{registerEventOptions:r$}=i3,{composed:rV,marginNames:r_}=k,{distribute:rq}=ed,{format:rZ}=eo,{addEvent:rK,createElement:rJ,css:rQ,defined:r0,discardElement:r1,find:r2,fireEvent:r3,isNumber:r5,merge:r6,pick:r9,pushUnique:r4,relativeLength:r8,stableSort:r7,syncTimeout:at}=$;class ae{constructor(t,e){this.allItems=[],this.initialItemY=0,this.itemHeight=0,this.itemMarginBottom=0,this.itemMarginTop=0,this.itemX=0,this.itemY=0,this.lastItemY=0,this.lastLineHeight=0,this.legendHeight=0,this.legendWidth=0,this.maxItemWidth=0,this.maxLegendWidth=0,this.offsetWidth=0,this.padding=0,this.pages=[],this.symbolHeight=0,this.symbolWidth=0,this.titleHeight=0,this.totalItemWidth=0,this.widthOption=0,this.chart=t,this.setOptions(e),e.enabled&&(this.render(),r$(this,e),rK(this.chart,\"endResize\",function(){this.legend.positionCheckboxes()})),rK(this.chart,\"render\",()=>{this.options.enabled&&this.proximate&&(this.proximatePositions(),this.positionItems())})}setOptions(t){let e=r9(t.padding,8);this.options=t,this.chart.styledMode||(this.itemStyle=t.itemStyle,this.itemHiddenStyle=r6(this.itemStyle,t.itemHiddenStyle)),this.itemMarginTop=t.itemMarginTop,this.itemMarginBottom=t.itemMarginBottom,this.padding=e,this.initialItemY=e-5,this.symbolWidth=r9(t.symbolWidth,16),this.pages=[],this.proximate=\"proximate\"===t.layout&&!this.chart.inverted,this.baseline=void 0}update(t,e){let i=this.chart;this.setOptions(r6(!0,this.options,t)),\"events\"in this.options&&r$(this,this.options),this.destroy(),i.isDirtyLegend=i.isDirtyBox=!0,r9(e,!0)&&i.redraw(),r3(this,\"afterUpdate\",{redraw:e})}colorizeItem(t,e){let i=t.color,{area:s,group:o,label:r,line:a,symbol:n}=t.legendItem||{};if((t instanceof rY||t instanceof oF)&&(t.color=t.options?.legendSymbolColor||i),o?.[e?\"removeClass\":\"addClass\"](\"highcharts-legend-item-hidden\"),!this.chart.styledMode){let{itemHiddenStyle:i={}}=this,o=i.color,{fillColor:h,fillOpacity:l,lineColor:d,marker:c}=t.options,p=t=>(!e&&(t.fill&&(t.fill=o),t.stroke&&(t.stroke=o)),t);r?.css(r6(e?this.itemStyle:i)),a?.attr(p({stroke:d||t.color})),n&&n.attr(p(c&&n.isMarker?t.pointAttribs():{fill:t.color})),s?.attr(p({fill:h||t.color,\"fill-opacity\":h?1:l??.75}))}t.color=i,r3(this,\"afterColorizeItem\",{item:t,visible:e})}positionItems(){this.allItems.forEach(this.positionItem,this),this.chart.isResizing||this.positionCheckboxes()}positionItem(t){let{group:e,x:i=0,y:s=0}=t.legendItem||{},o=this.options,r=o.symbolPadding,a=!o.rtl,n=t.checkbox;if(e&&e.element){let o={translateX:a?i:this.legendWidth-i-2*r-4,translateY:s};e[r0(e.translateY)?\"animate\":\"attr\"](o,void 0,()=>{r3(this,\"afterPositionItem\",{item:t})})}n&&(n.x=i,n.y=s)}destroyItem(t){let e=t.checkbox,i=t.legendItem||{};for(let t of[\"group\",\"label\",\"line\",\"symbol\"])i[t]&&(i[t]=i[t].destroy());e&&r1(e),t.legendItem=void 0}destroy(){for(let t of this.getAllItems())this.destroyItem(t);for(let t of[\"clipRect\",\"up\",\"down\",\"pager\",\"nav\",\"box\",\"title\",\"group\"])this[t]&&(this[t]=this[t].destroy());this.display=null}positionCheckboxes(){let t;let e=this.group&&this.group.alignAttr,i=this.clipHeight||this.legendHeight,s=this.titleHeight;e&&(t=e.translateY,this.allItems.forEach(function(o){let r;let a=o.checkbox;a&&(r=t+s+a.y+(this.scrollOffset||0)+3,rQ(a,{left:e.translateX+o.checkboxOffset+a.x-20+\"px\",top:r+\"px\",display:this.proximate||r>t-6&&r1.5*k?v.height:k))}layoutItem(t){let e=this.options,i=this.padding,s=\"horizontal\"===e.layout,o=t.itemHeight,r=this.itemMarginBottom,a=this.itemMarginTop,n=s?r9(e.itemDistance,20):0,h=this.maxLegendWidth,l=e.alignColumns&&this.totalItemWidth>h?this.maxItemWidth:t.itemWidth,d=t.legendItem||{};s&&this.itemX-i+l>h&&(this.itemX=i,this.lastLineHeight&&(this.itemY+=a+this.lastLineHeight+r),this.lastLineHeight=0),this.lastItemY=a+this.itemY+r,this.lastLineHeight=Math.max(o,this.lastLineHeight),d.x=this.itemX,d.y=this.itemY,s?this.itemX+=l:(this.itemY+=a+o+r,this.lastLineHeight=o),this.offsetWidth=this.widthOption||Math.max((s?this.itemX-i-(t.checkbox?0:n):l)+i,this.offsetWidth)}getAllItems(){let t=[];return this.chart.series.forEach(function(e){let i=e&&e.options;e&&r9(i.showInLegend,!r0(i.linkedTo)&&void 0,!0)&&(t=t.concat((e.legendItem||{}).labels||(\"point\"===i.legendType?e.data:e)))}),r3(this,\"afterGetAllItems\",{allItems:t}),t}getAlignment(){let t=this.options;return this.proximate?t.align.charAt(0)+\"tv\":t.floating?\"\":t.align.charAt(0)+t.verticalAlign.charAt(0)+t.layout.charAt(0)}adjustMargins(t,e){let i=this.chart,s=this.options,o=this.getAlignment();o&&[/(lth|ct|rth)/,/(rtv|rm|rbv)/,/(rbh|cb|lbh)/,/(lbv|lm|ltv)/].forEach(function(r,a){r.test(o)&&!r0(t[a])&&(i[r_[a]]=Math.max(i[r_[a]],i.legend[(a+1)%2?\"legendHeight\":\"legendWidth\"]+[1,-1,-1,1][a]*s[a%2?\"x\":\"y\"]+r9(s.margin,12)+e[a]+(i.titleOffset[a]||0)))})}proximatePositions(){let t;let e=this.chart,i=[],s=\"left\"===this.options.align;for(let o of(this.allItems.forEach(function(t){let o,r,a=s,n,h;t.yAxis&&(t.xAxis.options.reversed&&(a=!a),t.points&&(o=r2(a?t.points:t.points.slice(0).reverse(),function(t){return r5(t.plotY)})),r=this.itemMarginTop+t.legendItem.label.getBBox().height+this.itemMarginBottom,h=t.yAxis.top-e.plotTop,n=t.visible?(o?o.plotY:t.yAxis.height)+(h-.3*r):h+t.yAxis.height,i.push({target:n,size:r,item:t}))},this),rq(i,e.plotHeight)))t=o.item.legendItem||{},r5(o.pos)&&(t.y=e.plotTop-e.spacing[0]+o.pos)}render(){let t=this.chart,e=t.renderer,i=this.options,s=this.padding,o=this.getAllItems(),r,a,n,h=this.group,l,d=this.box;this.itemX=s,this.itemY=this.initialItemY,this.offsetWidth=0,this.lastItemY=0,this.widthOption=r8(i.width,t.spacingBox.width-s),l=t.spacingBox.width-2*s-i.x,[\"rm\",\"lm\"].indexOf(this.getAlignment().substring(0,2))>-1&&(l/=2),this.maxLegendWidth=this.widthOption||l,h||(this.group=h=e.g(\"legend\").addClass(i.className||\"\").attr({zIndex:7}).add(),this.contentGroup=e.g().attr({zIndex:1}).add(h),this.scrollGroup=e.g().add(this.contentGroup)),this.renderTitle(),r7(o,(t,e)=>(t.options&&t.options.legendIndex||0)-(e.options&&e.options.legendIndex||0)),i.reversed&&o.reverse(),this.allItems=o,this.display=r=!!o.length,this.lastLineHeight=0,this.maxItemWidth=0,this.totalItemWidth=0,this.itemHeight=0,o.forEach(this.renderItem,this),o.forEach(this.layoutItem,this),a=(this.widthOption||this.offsetWidth)+s,n=this.lastItemY+this.lastLineHeight+this.titleHeight,n=this.handleOverflow(n)+s,d||(this.box=d=e.rect().addClass(\"highcharts-legend-box\").attr({r:i.borderRadius}).add(h)),t.styledMode||d.attr({stroke:i.borderColor,\"stroke-width\":i.borderWidth||0,fill:i.backgroundColor||\"none\"}).shadow(i.shadow),a>0&&n>0&&d[d.placed?\"animate\":\"attr\"](d.crisp.call({},{x:0,y:0,width:a,height:n},d.strokeWidth())),h[r?\"show\":\"hide\"](),t.styledMode&&\"none\"===h.getStyle(\"display\")&&(a=n=0),this.legendWidth=a,this.legendHeight=n,r&&this.align(),this.proximate||this.positionItems(),r3(this,\"afterRender\")}align(t=this.chart.spacingBox){let e=this.chart,i=this.options,s=t.y;/(lth|ct|rth)/.test(this.getAlignment())&&e.titleOffset[0]>0?s+=e.titleOffset[0]:/(lbh|cb|rbh)/.test(this.getAlignment())&&e.titleOffset[2]>0&&(s-=e.titleOffset[2]),s!==t.y&&(t=r6(t,{y:s})),e.hasRendered||(this.group.placed=!1),this.group.align(r6(i,{width:this.legendWidth,height:this.legendHeight,verticalAlign:this.proximate?\"top\":i.verticalAlign}),!0,t)}handleOverflow(t){let e=this,i=this.chart,s=i.renderer,o=this.options,r=o.y,a=\"top\"===o.verticalAlign,n=this.padding,h=o.maxHeight,l=o.navigation,d=r9(l.animation,!0),c=l.arrowSize||12,p=this.pages,g=this.allItems,u=function(t){\"number\"==typeof t?k.attr({height:t}):k&&(e.clipRect=k.destroy(),e.contentGroup.clip()),e.contentGroup.div&&(e.contentGroup.div.style.clip=t?\"rect(\"+n+\"px,9999px,\"+(n+t)+\"px,0)\":\"auto\")},f=function(t){return e[t]=s.circle(0,0,1.3*c).translate(c/2,c/2).add(v),i.styledMode||e[t].attr(\"fill\",\"rgba(0,0,0,0.0001)\"),e[t]},m,x,y,b=i.spacingBox.height+(a?-r:r)-n,v=this.nav,k=this.clipRect;return\"horizontal\"!==o.layout||\"middle\"===o.verticalAlign||o.floating||(b/=2),h&&(b=Math.min(b,h)),p.length=0,t&&b>0&&t>b&&!1!==l.enabled?(this.clipHeight=m=Math.max(b-20-this.titleHeight-n,0),this.currentPage=r9(this.currentPage,1),this.fullHeight=t,g.forEach((t,e)=>{let i=(y=t.legendItem||{}).y||0,s=Math.round(y.label.getBBox().height),o=p.length;(!o||i-p[o-1]>m&&(x||i)!==p[o-1])&&(p.push(x||i),o++),y.pageIx=o-1,x&&((g[e-1].legendItem||{}).pageIx=o-1),e===g.length-1&&i+s-p[o-1]>m&&i>p[o-1]&&(p.push(i),y.pageIx=o),i!==x&&(x=i)}),k||(k=e.clipRect=s.clipRect(0,n-2,9999,0),e.contentGroup.clip(k)),u(m),v||(this.nav=v=s.g().attr({zIndex:1}).add(this.group),this.up=s.symbol(\"triangle\",0,0,c,c).add(v),f(\"upTracker\").on(\"click\",function(){e.scroll(-1,d)}),this.pager=s.text(\"\",15,10).addClass(\"highcharts-legend-navigation\"),!i.styledMode&&l.style&&this.pager.css(l.style),this.pager.add(v),this.down=s.symbol(\"triangle-down\",0,0,c,c).add(v),f(\"downTracker\").on(\"click\",function(){e.scroll(1,d)})),e.scroll(0),t=b):v&&(u(),this.nav=v.destroy(),this.scrollGroup.attr({translateY:1}),this.clipHeight=0),t}scroll(t,e){let i=this.chart,s=this.pages,o=s.length,r=this.clipHeight,a=this.options.navigation,n=this.pager,h=this.padding,l=this.currentPage+t;l>o&&(l=o),l>0&&(void 0!==e&&rU(e,i),this.nav.attr({translateX:h,translateY:r+this.padding+7+this.titleHeight,visibility:\"inherit\"}),[this.up,this.upTracker].forEach(function(t){t.attr({class:1===l?\"highcharts-legend-nav-inactive\":\"highcharts-legend-nav-active\"})}),n.attr({text:l+\"/\"+o}),[this.down,this.downTracker].forEach(function(t){t.attr({x:18+this.pager.getBBox().width,class:l===o?\"highcharts-legend-nav-inactive\":\"highcharts-legend-nav-active\"})},this),i.styledMode||(this.up.attr({fill:1===l?a.inactiveColor:a.activeColor}),this.upTracker.css({cursor:1===l?\"default\":\"pointer\"}),this.down.attr({fill:l===o?a.inactiveColor:a.activeColor}),this.downTracker.css({cursor:l===o?\"default\":\"pointer\"})),this.scrollOffset=-s[l-1]+this.initialItemY,this.scrollGroup.animate({translateY:this.scrollOffset}),this.currentPage=l,this.positionCheckboxes(),at(()=>{r3(this,\"afterScroll\",{currentPage:l})},rj(r9(e,i.renderer.globalAnimation,!0)).duration))}setItemEvents(t,e,i){let s=this,o=t.legendItem||{},r=s.chart.renderer.boxWrapper,a=t instanceof oF,n=t instanceof rY,h=\"highcharts-legend-\"+(a?\"point\":\"series\")+\"-active\",l=s.chart.styledMode,d=i?[e,o.symbol]:[o.group],c=e=>{s.allItems.forEach(i=>{t!==i&&[i].concat(i.linkedSeries||[]).forEach(t=>{t.setState(e,!a)})})};for(let i of d)i&&i.on(\"mouseover\",function(){t.visible&&c(\"inactive\"),t.setState(\"hover\"),t.visible&&r.addClass(h),l||e.css(s.options.itemHoverStyle)}).on(\"mouseout\",function(){s.chart.styledMode||e.css(r6(t.visible?s.itemStyle:s.itemHiddenStyle)),c(\"\"),r.removeClass(h),t.setState()}).on(\"click\",function(e){let i=function(){t.setVisible&&t.setVisible(),c(t.visible?\"inactive\":\"\")};r.removeClass(h),r3(s,\"itemClick\",{browserEvent:e,legendItem:t},i),a?t.firePointEvent(\"legendItemClick\",{browserEvent:e}):n&&r3(t,\"legendItemClick\",{browserEvent:e})})}createCheckboxForItem(t){t.checkbox=rJ(\"input\",{type:\"checkbox\",className:\"highcharts-legend-checkbox\",checked:t.selected,defaultChecked:t.selected},this.options.itemCheckboxStyle,this.chart.container),rK(t.checkbox,\"click\",function(e){let i=e.target;r3(t.series||t,\"checkboxClick\",{checked:i.checked,item:t},function(){t.select()})})}}!function(t){t.compose=function(e){r4(rV,\"Core.Legend\")&&rK(e,\"beforeMargins\",function(){this.legend=new t(this,this.options.legend)})}}(ae||(ae={}));let ai=ae,{animate:as,animObject:ao,setAnimation:ar}=tR,{defaultOptions:aa}=tm,{numberFormat:an}=eo,{registerEventOptions:ah}=i3,{charts:al,doc:ad,marginNames:ac,svg:ap,win:ag}=k,{seriesTypes:au}=rd,{addEvent:af,attr:am,createElement:ax,css:ay,defined:ab,diffObjects:av,discardElement:ak,erase:aw,error:aM,extend:aS,find:aT,fireEvent:aC,getAlignFactor:aA,getStyle:aP,isArray:aL,isNumber:aO,isObject:aE,isString:aI,merge:aD,objectEach:aB,pick:aN,pInt:az,relativeLength:aR,removeEvent:aW,splat:aH,syncTimeout:aX,uniqueKey:aF}=$;class aG{static chart(t,e,i){return new aG(t,e,i)}constructor(t,e,i){this.sharedClips={};let s=[...arguments];(aI(t)||t.nodeName)&&(this.renderTo=s.shift()),this.init(s[0],s[1])}setZoomOptions(){let t=this.options.chart,e=t.zooming;this.zooming={...e,type:aN(t.zoomType,e.type),key:aN(t.zoomKey,e.key),pinchType:aN(t.pinchType,e.pinchType),singleTouch:aN(t.zoomBySingleTouch,e.singleTouch,!1),resetButton:aD(e.resetButton,t.resetZoomButton)}}init(t,e){aC(this,\"init\",{args:arguments},function(){let i=aD(aa,t),s=i.chart,o=this.renderTo||s.renderTo;this.userOptions=aS({},t),(this.renderTo=aI(o)?ad.getElementById(o):o)||aM(13,!0,this),this.margin=[],this.spacing=[],this.labelCollectors=[],this.callback=e,this.isResizing=0,this.options=i,this.axes=[],this.series=[],this.locale=i.lang.locale??this.renderTo.closest(\"[lang]\")?.lang,this.time=new td(aS(i.time||{},{locale:this.locale})),i.time=this.time.options,this.numberFormatter=(s.numberFormatter||an).bind(this),this.styledMode=s.styledMode,this.hasCartesianSeries=s.showAxes,this.index=al.length,al.push(this),k.chartCount++,ah(this,s),this.xAxis=[],this.yAxis=[],this.pointCount=this.colorCounter=this.symbolCounter=0,this.setZoomOptions(),aC(this,\"afterInit\"),this.firstRender()})}initSeries(t){let e=this.options.chart,i=t.type||e.type,s=au[i];s||aM(17,!0,this,{missingModuleFor:i});let o=new s;return\"function\"==typeof o.init&&o.init(this,t),o}setSortedData(){this.getSeriesOrderByLinks().forEach(function(t){t.points||t.data||!t.enabledDataSorting||t.setData(t.options.data,!1)})}getSeriesOrderByLinks(){return this.series.concat().sort(function(t,e){return t.linkedSeries.length||e.linkedSeries.length?e.linkedSeries.length-t.linkedSeries.length:0})}orderItems(t,e=0){let i=this[t],s=this.options[t]=aH(this.options[t]).slice(),o=this.userOptions[t]=this.userOptions[t]?aH(this.userOptions[t]).slice():[];if(this.hasRendered&&(s.splice(e),o.splice(e)),i)for(let t=e,r=i.length;t=Math.max(h+r,t.pos)&&e<=Math.min(h+r+c.width,t.pos+t.len)||(u.isInsidePlot=!1)}if(!i.ignoreY&&u.isInsidePlot){let t=!s&&i.axis&&!i.axis.isXAxis&&i.axis||d&&(s?d.xAxis:d.yAxis)||{pos:a,len:1/0},e=i.paneCoordinates?t.pos+g:a+g;e>=Math.max(l+a,t.pos)&&e<=Math.min(l+a+c.height,t.pos+t.len)||(u.isInsidePlot=!1)}return aC(this,\"afterIsInsidePlot\",u),u.isInsidePlot}redraw(t){aC(this,\"beforeRedraw\");let e=this.hasCartesianSeries?this.axes:this.colorAxis||[],i=this.series,s=this.pointer,o=this.legend,r=this.userOptions.legend,a=this.renderer,n=a.isHidden(),h=[],l,d,c,p=this.isDirtyBox,g=this.isDirtyLegend,u;for(a.rootFontSize=a.boxWrapper.getStyle(\"font-size\"),this.setResponsive&&this.setResponsive(!1),ar(!!this.hasRendered&&t,this),n&&this.temporaryDisplay(),this.layOutTitles(!1),c=i.length;c--;)if(((u=i[c]).options.stacking||u.options.centerInCategory)&&(d=!0,u.isDirty)){l=!0;break}if(l)for(c=i.length;c--;)(u=i[c]).options.stacking&&(u.isDirty=!0);i.forEach(function(t){t.isDirty&&(\"point\"===t.options.legendType?(\"function\"==typeof t.updateTotals&&t.updateTotals(),g=!0):r&&(r.labelFormatter||r.labelFormat)&&(g=!0)),t.isDirtyData&&aC(t,\"updatedData\")}),g&&o&&o.options.enabled&&(o.render(),this.isDirtyLegend=!1),d&&this.getStacks(),e.forEach(function(t){t.updateNames(),t.setScale()}),this.getMargins(),e.forEach(function(t){t.isDirty&&(p=!0)}),e.forEach(function(t){let e=t.min+\",\"+t.max;t.extKey!==e&&(t.extKey=e,h.push(function(){aC(t,\"afterSetExtremes\",aS(t.eventArgs,t.getExtremes())),delete t.eventArgs})),(p||d)&&t.redraw()}),p&&this.drawChartBox(),aC(this,\"predraw\"),i.forEach(function(t){(p||t.isDirty)&&t.visible&&t.redraw(),t.isDirtyData=!1}),s&&s.reset(!0),a.draw(),aC(this,\"redraw\"),aC(this,\"render\"),n&&this.temporaryDisplay(!0),h.forEach(function(t){t.call()})}get(t){let e=this.series;function i(e){return e.id===t||e.options&&e.options.id===t}let s=aT(this.axes,i)||aT(this.series,i);for(let t=0;!s&&t(e.getPointsCollection().forEach(e=>{aN(e.selectedStaging,e.selected)&&t.push(e)}),t),[])}getSelectedSeries(){return this.series.filter(t=>t.selected)}setTitle(t,e,i){this.applyDescription(\"title\",t),this.applyDescription(\"subtitle\",e),this.applyDescription(\"caption\",void 0),this.layOutTitles(i)}applyDescription(t,e){let i=this,s=this.options[t]=aD(this.options[t],e),o=this[t];o&&e&&(this[t]=o=o.destroy()),s&&!o&&((o=this.renderer.text(s.text,0,0,s.useHTML).attr({align:s.align,class:\"highcharts-\"+t,zIndex:s.zIndex||4}).css({textOverflow:\"ellipsis\",whiteSpace:\"nowrap\"}).add()).update=function(e,s){i.applyDescription(t,e),i.layOutTitles(s)},this.styledMode||o.css(aS(\"title\"===t?{fontSize:this.options.isStock?\"1em\":\"1.2em\"}:{},s.style)),o.textPxLength=o.getBBox().width,o.css({whiteSpace:s.style?.whiteSpace}),this[t]=o)}layOutTitles(t=!0){let e=[0,0,0],{options:i,renderer:s,spacingBox:o}=this;[\"title\",\"subtitle\",\"caption\"].forEach(t=>{let i=this[t],r=this.options[t],a=aD(o),n=i?.textPxLength||0;if(i&&r){aC(this,\"layOutTitle\",{alignTo:a,key:t,textPxLength:n});let o=s.fontMetrics(i),h=o.b,l=o.h,d=r.verticalAlign||\"top\",c=\"top\"===d,p=c&&r.minScale||1,g=\"title\"===t?c?-3:0:c?e[0]+2:0,u=Math.min(a.width/n,1),f=Math.max(p,u),m=aD({y:\"bottom\"===d?h:g+h},{align:\"title\"===t?up?this.chartWidth:a.width)/f;i.alignValue!==m.align&&(i.placed=!1);let y=Math.round(i.css({width:`${x}px`}).getBBox(r.useHTML).height);if(m.height=y,i.align(m,!1,a).attr({align:m.align,scaleX:f,scaleY:f,\"transform-origin\":`${a.x+n*f*aA(m.align)} ${l}`}),!r.floating){let t=y*(y<1.2*l?1:f);\"top\"===d?e[0]=Math.ceil(e[0]+t):\"bottom\"===d&&(e[2]=Math.ceil(e[2]+t))}}},this),e[0]&&\"top\"===(i.title?.verticalAlign||\"top\")&&(e[0]+=i.title?.margin||0),e[2]&&i.caption?.verticalAlign===\"bottom\"&&(e[2]+=i.caption?.margin||0);let r=!this.titleOffset||this.titleOffset.join(\",\")!==e.join(\",\");this.titleOffset=e,aC(this,\"afterLayOutTitles\"),!this.isDirtyBox&&r&&(this.isDirtyBox=this.isDirtyLegend=r,this.hasRendered&&t&&this.isDirtyBox&&this.redraw())}getContainerBox(){let t=[].map.call(this.renderTo.children,t=>{if(t!==this.container){let e=t.style.display;return t.style.display=\"none\",[t,e]}}),e={width:aP(this.renderTo,\"width\",!0)||0,height:aP(this.renderTo,\"height\",!0)||0};return t.filter(Boolean).forEach(([t,e])=>{t.style.display=e}),e}getChartSize(){let t=this.options.chart,e=t.width,i=t.height,s=this.getContainerBox(),o=s.height<=1||!this.renderTo.parentElement?.style.height&&\"100%\"===this.renderTo.style.height;this.chartWidth=Math.max(0,e||s.width||600),this.chartHeight=Math.max(0,aR(i,this.chartWidth)||(o?400:s.height)),this.containerBox=s}temporaryDisplay(t){let e=this.renderTo,i;if(t)for(;e&&e.style;)e.hcOrigStyle&&(ay(e,e.hcOrigStyle),delete e.hcOrigStyle),e.hcOrigDetached&&(ad.body.removeChild(e),e.hcOrigDetached=!1),e=e.parentNode;else for(;e&&e.style&&(ad.body.contains(e)||e.parentNode||(e.hcOrigDetached=!0,ad.body.appendChild(e)),(\"none\"===aP(e,\"display\",!1)||e.hcOricDetached)&&(e.hcOrigStyle={display:e.style.display,height:e.style.height,overflow:e.style.overflow},i={display:\"block\",overflow:\"hidden\"},e!==this.renderTo&&(i.height=0),ay(e,i),e.offsetWidth||e.style.setProperty(\"display\",\"block\",\"important\")),(e=e.parentNode)!==ad.body););}setClassName(t){this.container.className=\"highcharts-container \"+(t||\"\")}getContainer(){let t;let e=this.options,i=e.chart,s=\"data-highcharts-chart\",o=aF(),r=this.renderTo,a=az(am(r,s));aO(a)&&al[a]&&al[a].hasRendered&&al[a].destroy(),am(r,s,this.index),r.innerHTML=tK.emptyHTML,i.skipClone||r.offsetWidth||this.temporaryDisplay(),this.getChartSize();let n=this.chartHeight,h=this.chartWidth;ay(r,{overflow:\"hidden\"}),this.styledMode||(t=aS({position:\"relative\",overflow:\"hidden\",width:h+\"px\",height:n+\"px\",textAlign:\"left\",lineHeight:\"normal\",zIndex:0,\"-webkit-tap-highlight-color\":\"rgba(0,0,0,0)\",userSelect:\"none\",\"touch-action\":\"manipulation\",outline:\"none\",padding:\"0px\"},i.style||{}));let l=ax(\"div\",{id:o},t,r);this.container=l,this.getChartSize(),h===this.chartWidth||(h=this.chartWidth,this.styledMode||ay(l,{width:aN(i.style?.width,h+\"px\")})),this.containerBox=this.getContainerBox(),this._cursor=l.style.cursor;let d=i.renderer||!ap?er.getRendererType(i.renderer):iR;if(this.renderer=new d(l,h,n,void 0,i.forExport,e.exporting&&e.exporting.allowHTML,this.styledMode),ar(void 0,this),this.setClassName(i.className),this.styledMode)for(let t in e.defs)this.renderer.definition(e.defs[t]);else this.renderer.setStyle(i.style);this.renderer.chartIndex=this.index,aC(this,\"afterGetContainer\")}getMargins(t){let{spacing:e,margin:i,titleOffset:s}=this;this.resetMargins(),s[0]&&!ab(i[0])&&(this.plotTop=Math.max(this.plotTop,s[0]+e[0])),s[2]&&!ab(i[2])&&(this.marginBottom=Math.max(this.marginBottom,s[2]+e[2])),this.legend&&this.legend.display&&this.legend.adjustMargins(i,e),aC(this,\"getMargins\"),t||this.getAxisMargins()}getAxisMargins(){let t=this,e=t.axisOffset=[0,0,0,0],i=t.colorAxis,s=t.margin,o=function(t){t.forEach(function(t){t.visible&&t.getOffset()})};t.hasCartesianSeries?o(t.axes):i&&i.length&&o(i),ac.forEach(function(i,o){ab(s[o])||(t[i]+=e[o])}),t.setChartSize()}getOptions(){return av(this.userOptions,aa)}reflow(t){let e=this,i=e.containerBox,s=e.getContainerBox();delete e.pointer?.chartPosition,!e.isPrinting&&!e.isResizing&&i&&s.width&&((s.width!==i.width||s.height!==i.height)&&($.clearTimeout(e.reflowTimeout),e.reflowTimeout=aX(function(){e.container&&e.setSize(void 0,void 0,!1)},t?100:0)),e.containerBox=s)}setReflow(){let t=this,e=e=>{t.options?.chart.reflow&&t.hasLoaded&&t.reflow(e)};if(\"function\"==typeof ResizeObserver)new ResizeObserver(e).observe(t.renderTo);else{let t=af(ag,\"resize\",e);af(this,\"destroy\",t)}}setSize(t,e,i){let s=this,o=s.renderer;s.isResizing+=1,ar(i,s);let r=o.globalAnimation;s.oldChartHeight=s.chartHeight,s.oldChartWidth=s.chartWidth,void 0!==t&&(s.options.chart.width=t),void 0!==e&&(s.options.chart.height=e),s.getChartSize();let{chartWidth:a,chartHeight:n,scrollablePixelsX:h=0,scrollablePixelsY:l=0}=s;(s.isDirtyBox||a!==s.oldChartWidth||n!==s.oldChartHeight)&&(s.styledMode||(r?as:ay)(s.container,{width:`${a+h}px`,height:`${n+l}px`},r),s.setChartSize(!0),o.setSize(a,n,r),s.axes.forEach(function(t){t.isDirty=!0,t.setScale()}),s.isDirtyLegend=!0,s.isDirtyBox=!0,s.layOutTitles(),s.getMargins(),s.redraw(r),s.oldChartHeight=void 0,aC(s,\"resize\"),setTimeout(()=>{s&&aC(s,\"endResize\")},ao(r).duration)),s.isResizing-=1}setChartSize(t){let e,i,s,o;let{chartHeight:r,chartWidth:a,inverted:n,spacing:h,renderer:l}=this,d=this.clipOffset,c=Math[n?\"floor\":\"round\"];this.plotLeft=e=Math.round(this.plotLeft),this.plotTop=i=Math.round(this.plotTop),this.plotWidth=s=Math.max(0,Math.round(a-e-this.marginRight)),this.plotHeight=o=Math.max(0,Math.round(r-i-this.marginBottom)),this.plotSizeX=n?o:s,this.plotSizeY=n?s:o,this.spacingBox=l.spacingBox={x:h[3],y:h[0],width:a-h[3]-h[1],height:r-h[0]-h[2]},this.plotBox=l.plotBox={x:e,y:i,width:s,height:o},d&&(this.clipBox={x:c(d[3]),y:c(d[0]),width:c(this.plotSizeX-d[1]-d[3]),height:c(this.plotSizeY-d[0]-d[2])}),t||(this.axes.forEach(function(t){t.setAxisSize(),t.setAxisTranslation()}),l.alignElements()),aC(this,\"afterSetChartSize\",{skipAxes:t})}resetMargins(){aC(this,\"resetMargins\");let t=this,e=t.options.chart,i=e.plotBorderWidth||0,s=i/2;[\"margin\",\"spacing\"].forEach(function(i){let s=e[i],o=aE(s)?s:[s,s,s,s];[\"Top\",\"Right\",\"Bottom\",\"Left\"].forEach(function(s,r){t[i][r]=aN(e[i+s],o[r])})}),ac.forEach(function(e,i){t[e]=aN(t.margin[i],t.spacing[i])}),t.axisOffset=[0,0,0,0],t.clipOffset=[s,s,s,s],t.plotBorderWidth=i}drawChartBox(){let t=this.options.chart,e=this.renderer,i=this.chartWidth,s=this.chartHeight,o=this.styledMode,r=this.plotBGImage,a=t.backgroundColor,n=t.plotBackgroundColor,h=t.plotBackgroundImage,l=this.plotLeft,d=this.plotTop,c=this.plotWidth,p=this.plotHeight,g=this.plotBox,u=this.clipRect,f=this.clipBox,m=this.chartBackground,x=this.plotBackground,y=this.plotBorder,b,v,k,w=\"animate\";m||(this.chartBackground=m=e.rect().addClass(\"highcharts-background\").add(),w=\"attr\"),o?b=v=m.strokeWidth():(v=(b=t.borderWidth||0)+(t.shadow?8:0),k={fill:a||\"none\"},(b||m[\"stroke-width\"])&&(k.stroke=t.borderColor,k[\"stroke-width\"]=b),m.attr(k).shadow(t.shadow)),m[w]({x:v/2,y:v/2,width:i-v-b%2,height:s-v-b%2,r:t.borderRadius}),w=\"animate\",x||(w=\"attr\",this.plotBackground=x=e.rect().addClass(\"highcharts-plot-background\").add()),x[w](g),!o&&(x.attr({fill:n||\"none\"}).shadow(t.plotShadow),h&&(r?(h!==r.attr(\"href\")&&r.attr(\"href\",h),r.animate(g)):this.plotBGImage=e.image(h,l,d,c,p).add())),u?u.animate({width:f.width,height:f.height}):this.clipRect=e.clipRect(f),w=\"animate\",y||(w=\"attr\",this.plotBorder=y=e.rect().addClass(\"highcharts-plot-border\").attr({zIndex:1}).add()),o||y.attr({stroke:t.plotBorderColor,\"stroke-width\":t.plotBorderWidth||0,fill:\"none\"}),y[w](y.crisp({x:l,y:d,width:c,height:p},-y.strokeWidth())),this.isDirtyBox=!1,aC(this,\"afterDrawChartBox\")}propFromSeries(){let t,e,i;let s=this,o=s.options.chart,r=s.options.series;[\"inverted\",\"angular\",\"polar\"].forEach(function(a){for(e=au[o.type],i=o[a]||e&&e.prototype[a],t=r&&r.length;!i&&t--;)(e=au[r[t].type])&&e.prototype[a]&&(i=!0);s[a]=i})}linkSeries(t){let e=this,i=e.series;i.forEach(function(t){t.linkedSeries.length=0}),i.forEach(function(t){let{linkedTo:i}=t.options;if(aI(i)){let s;(s=\":previous\"===i?e.series[t.index-1]:e.get(i))&&s.linkedParent!==t&&(s.linkedSeries.push(t),t.linkedParent=s,s.enabledDataSorting&&t.setDataSortingOptions(),t.visible=aN(t.options.visible,s.options.visible,t.visible))}}),aC(this,\"afterLinkSeries\",{isUpdating:t})}renderSeries(){this.series.forEach(function(t){t.translate(),t.render()})}render(){let t=this.axes,e=this.colorAxis,i=this.renderer,s=this.options.chart.axisLayoutRuns||2,o=t=>{t.forEach(t=>{t.visible&&t.render()})},r=0,a=!0,n,h=0;for(let e of(this.setTitle(),aC(this,\"beforeMargins\"),this.getStacks?.(),this.getMargins(!0),this.setChartSize(),t)){let{options:t}=e,{labels:i}=t;if(this.hasCartesianSeries&&e.horiz&&e.visible&&i.enabled&&e.series.length&&\"colorAxis\"!==e.coll&&!this.polar){r=t.tickLength,e.createGroups();let s=new sa(e,0,\"\",!0),o=s.createLabel(\"x\",i);if(s.destroy(),o&&aN(i.reserveSpace,!aO(t.crossing))&&(r=o.getBBox().height+i.distance+Math.max(t.offset||0,0)),r){o?.destroy();break}}}for(this.plotHeight=Math.max(this.plotHeight-r,0);(a||n||s>1)&&h(h?1:1.1),n=i/this.plotHeight>(h?1:1.05),h++}this.drawChartBox(),this.hasCartesianSeries?o(t):e&&e.length&&o(e),this.seriesGroup||(this.seriesGroup=i.g(\"series-group\").attr({zIndex:3}).shadow(this.options.chart.seriesGroupShadow).add()),this.renderSeries(),this.addCredits(),this.setResponsive&&this.setResponsive(),this.hasRendered=!0}addCredits(t){let e=this,i=aD(!0,this.options.credits,t);i.enabled&&!this.credits&&(this.credits=this.renderer.text(i.text+(this.mapCredits||\"\"),0,0).addClass(\"highcharts-credits\").on(\"click\",function(){i.href&&(ag.location.href=i.href)}).attr({align:i.position.align,zIndex:8}),e.styledMode||this.credits.css(i.style),this.credits.add().align(i.position),this.credits.update=function(t){e.credits=e.credits.destroy(),e.addCredits(t)})}destroy(){let t;let e=this,i=e.axes,s=e.series,o=e.container,r=o&&o.parentNode;for(aC(e,\"destroy\"),e.renderer.forExport?aw(al,e):al[e.index]=void 0,k.chartCount--,e.renderTo.removeAttribute(\"data-highcharts-chart\"),aW(e),t=i.length;t--;)i[t]=i[t].destroy();for(this.scroller&&this.scroller.destroy&&this.scroller.destroy(),t=s.length;t--;)s[t]=s[t].destroy();[\"title\",\"subtitle\",\"chartBackground\",\"plotBackground\",\"plotBGImage\",\"plotBorder\",\"seriesGroup\",\"clipRect\",\"credits\",\"pointer\",\"rangeSelector\",\"legend\",\"resetZoomButton\",\"tooltip\",\"renderer\"].forEach(function(t){let i=e[t];i&&i.destroy&&(e[t]=i.destroy())}),o&&(o.innerHTML=tK.emptyHTML,aW(o),r&&ak(o)),aB(e,function(t,i){delete e[i]})}firstRender(){let t=this,e=t.options;t.getContainer(),t.resetMargins(),t.setChartSize(),t.propFromSeries(),t.createAxes();let i=aL(e.series)?e.series:[];e.series=[],i.forEach(function(e){t.initSeries(e)}),t.linkSeries(),t.setSortedData(),aC(t,\"beforeRender\"),t.render(),t.pointer?.getChartPosition(),t.renderer.imgCount||t.hasLoaded||t.onload(),t.temporaryDisplay(!0)}onload(){this.callbacks.concat([this.callback]).forEach(function(t){t&&void 0!==this.index&&t.apply(this,[this])},this),aC(this,\"load\"),aC(this,\"render\"),ab(this.index)&&this.setReflow(),this.warnIfA11yModuleNotLoaded(),this.hasLoaded=!0}warnIfA11yModuleNotLoaded(){let{options:t,title:e}=this;!t||this.accessibility||(this.renderer.boxWrapper.attr({role:\"img\",\"aria-label\":(e&&e.element.textContent||\"\").replace(/this.transform({reset:!0,trigger:\"zoom\"}))}pan(t,e){let i=this,s=\"object\"==typeof e?e:{enabled:e,type:\"x\"},o=s.type,r=o&&i[({x:\"xAxis\",xy:\"axes\",y:\"yAxis\"})[o]].filter(t=>t.options.panningEnabled&&!t.options.isInternal),a=i.options.chart;a?.panning&&(a.panning=s),aC(this,\"pan\",{originalEvent:t},()=>{i.transform({axes:r,event:t,to:{x:t.chartX-(i.mouseDownX||0),y:t.chartY-(i.mouseDownY||0)},trigger:\"pan\"}),ay(i.container,{cursor:\"move\"})})}transform(t){let{axes:e=this.axes,event:i,from:s={},reset:o,selection:r,to:a={},trigger:n}=t,{inverted:h,time:l}=this,d=!1,c,p;for(let t of(this.hoverPoints?.forEach(t=>t.setState()),e)){let{horiz:e,len:g,minPointOffset:u=0,options:f,reversed:m}=t,x=e?\"width\":\"height\",y=e?\"x\":\"y\",b=aN(a[x],t.len),v=aN(s[x],t.len),k=10>Math.abs(b)?1:b/v,w=(s[y]||0)+v/2-t.pos,M=w-((a[y]??t.pos)+b/2-t.pos)/k,S=m&&!h||!m&&h?-1:1;if(!o&&(w<0||w>t.len))continue;let T=t.toValue(M,!0)+(r||t.isOrdinal?0:u*S),C=t.toValue(M+g/k,!0)-(r||t.isOrdinal?0:u*S||0),A=t.allExtremes;if(T>C&&([T,C]=[C,T]),1===k&&!o&&\"yAxis\"===t.coll&&!A){for(let e of t.series){let t=e.getExtremes(e.getProcessedData(!0).modified.getColumn(\"y\")||[],!0);A??(A={dataMin:Number.MAX_VALUE,dataMax:-Number.MAX_VALUE}),aO(t.dataMin)&&aO(t.dataMax)&&(A.dataMin=Math.min(t.dataMin,A.dataMin),A.dataMax=Math.max(t.dataMax,A.dataMax))}t.allExtremes=A}let{dataMin:P,dataMax:L,min:O,max:E}=aS(t.getExtremes(),A||{}),I=l.parse(f.min),D=l.parse(f.max),B=P??I,N=L??D,z=C-T,R=t.categories?0:Math.min(z,N-B),W=B-R*(ab(I)?0:f.minPadding),H=N+R*(ab(D)?0:f.maxPadding),X=t.allowZoomOutside||1===k||\"zoom\"!==n&&k>1,F=Math.min(I??W,W,X?O:W),G=Math.max(D??H,H,X?E:H);(!t.isOrdinal||t.options.overscroll||1!==k||o)&&(T=1&&(C=T+z)),C>G&&(C=G,k>=1&&(T=C-z)),(o||t.series.length&&(T!==O||C!==E)&&T>=F&&C<=G)&&(r?r[t.coll].push({axis:t,min:T,max:C}):(t.isPanning=\"zoom\"!==n,t.isPanning&&(p=!0),t.setExtremes(o?void 0:T,o?void 0:C,!1,!1,{move:M,trigger:n,scale:k}),!o&&(T>F||C{delete t.selection,t.trigger=\"zoom\",this.transform(t)}):(!c||p||this.resetZoomButton?!c&&this.resetZoomButton&&(this.resetZoomButton=this.resetZoomButton.destroy()):this.showResetZoom(),this.redraw(\"zoom\"===n&&(this.options.chart.animation??this.pointCount<100)))),d}}aS(aG.prototype,{callbacks:[],collectionsWithInit:{xAxis:[aG.prototype.addAxis,[!0]],yAxis:[aG.prototype.addAxis,[!1]],series:[aG.prototype.addSeries]},collectionsWithUpdate:[\"xAxis\",\"yAxis\",\"series\"],propsRequireDirtyBox:[\"backgroundColor\",\"borderColor\",\"borderWidth\",\"borderRadius\",\"plotBackgroundColor\",\"plotBackgroundImage\",\"plotBorderColor\",\"plotBorderWidth\",\"plotShadow\",\"shadow\"],propsRequireReflow:[\"margin\",\"marginTop\",\"marginRight\",\"marginBottom\",\"marginLeft\",\"spacing\",\"spacingTop\",\"spacingRight\",\"spacingBottom\",\"spacingLeft\"],propsRequireUpdateSeries:[\"chart.inverted\",\"chart.polar\",\"chart.ignoreHiddenSeries\",\"chart.type\",\"colors\",\"plotOptions\",\"time\",\"tooltip\"]});let{stop:aY}=tR,{composed:aj}=k,{addEvent:aU,createElement:a$,css:aV,defined:a_,erase:aq,merge:aZ,pushUnique:aK}=$;function aJ(){let t=this.scrollablePlotArea;(this.scrollablePixelsX||this.scrollablePixelsY)&&!t&&(this.scrollablePlotArea=t=new a0(this)),t?.applyFixed()}function aQ(){this.chart.scrollablePlotArea&&(this.chart.scrollablePlotArea.isDirty=!0)}class a0{static compose(t,e,i){aK(aj,this.compose)&&(aU(t,\"afterInit\",aQ),aU(e,\"afterSetChartSize\",t=>this.afterSetSize(t.target,t)),aU(e,\"render\",aJ),aU(i,\"show\",aQ))}static afterSetSize(t,e){let i,s,o;let{minWidth:r,minHeight:a}=t.options.chart.scrollablePlotArea||{},{clipBox:n,plotBox:h,inverted:l,renderer:d}=t;if(!d.forExport&&(r?(t.scrollablePixelsX=i=Math.max(0,r-t.chartWidth),i&&(t.scrollablePlotBox=aZ(t.plotBox),h.width=t.plotWidth+=i,n[l?\"height\":\"width\"]+=i,o=!0)):a&&(t.scrollablePixelsY=s=Math.max(0,a-t.chartHeight),a_(s)&&(t.scrollablePlotBox=aZ(t.plotBox),h.height=t.plotHeight+=s,n[l?\"width\":\"height\"]+=s,o=!1)),a_(o)&&!e.skipAxes))for(let e of t.axes)(e.horiz===o||t.hasParallelCoordinates&&\"yAxis\"===e.coll)&&(e.setAxisSize(),e.setAxisTranslation())}constructor(t){let e;let i=t.options.chart,s=er.getRendererType(),o=i.scrollablePlotArea||{},r=this.moveFixedElements.bind(this),a={WebkitOverflowScrolling:\"touch\",overflowX:\"hidden\",overflowY:\"hidden\"};t.scrollablePixelsX&&(a.overflowX=\"auto\"),t.scrollablePixelsY&&(a.overflowY=\"auto\"),this.chart=t;let n=this.parentDiv=a$(\"div\",{className:\"highcharts-scrolling-parent\"},{position:\"relative\"},t.renderTo),h=this.scrollingContainer=a$(\"div\",{className:\"highcharts-scrolling\"},a,n),l=this.innerContainer=a$(\"div\",{className:\"highcharts-inner-container\"},void 0,h),d=this.fixedDiv=a$(\"div\",{className:\"highcharts-fixed\"},{position:\"absolute\",overflow:\"hidden\",pointerEvents:\"none\",zIndex:(i.style?.zIndex||0)+2,top:0},void 0,!0),c=this.fixedRenderer=new s(d,t.chartWidth,t.chartHeight,i.style);this.mask=c.path().attr({fill:i.backgroundColor||\"#fff\",\"fill-opacity\":o.opacity??.85,zIndex:-1}).addClass(\"highcharts-scrollable-mask\").add(),h.parentNode.insertBefore(d,h),aV(t.renderTo,{overflow:\"visible\"}),aU(t,\"afterShowResetZoom\",r),aU(t,\"afterApplyDrilldown\",r),aU(t,\"afterLayOutTitles\",r),aU(h,\"scroll\",()=>{let{pointer:i,hoverPoint:s}=t;i&&(delete i.chartPosition,s&&(e=s),i.runPointActions(void 0,e,!0))}),l.appendChild(t.container)}applyFixed(){let{chart:t,fixedRenderer:e,isDirty:i,scrollingContainer:s}=this,{axisOffset:o,chartWidth:r,chartHeight:a,container:n,plotHeight:h,plotLeft:l,plotTop:d,plotWidth:c,scrollablePixelsX:p=0,scrollablePixelsY:g=0}=t,{scrollPositionX:u=0,scrollPositionY:f=0}=t.options.chart.scrollablePlotArea||{},m=r+p,x=a+g;e.setSize(r,a),(i??!0)&&(this.isDirty=!1,this.moveFixedElements()),aY(t.container),aV(n,{width:`${m}px`,height:`${x}px`}),t.renderer.boxWrapper.attr({width:m,height:x,viewBox:[0,0,m,x].join(\" \")}),t.chartBackground?.attr({width:m,height:x}),aV(s,{width:`${r}px`,height:`${a}px`}),a_(i)||(s.scrollLeft=p*u,s.scrollTop=g*f);let y=d-o[0]-1,b=l-o[3]-1,v=d+h+o[2]+1,k=l+c+o[1]+1,w=l+c-p,M=d+h-g,S=[[\"M\",0,0]];p?S=[[\"M\",0,y],[\"L\",l-1,y],[\"L\",l-1,v],[\"L\",0,v],[\"Z\"],[\"M\",w,y],[\"L\",r,y],[\"L\",r,v],[\"L\",w,v],[\"Z\"]]:g&&(S=[[\"M\",b,0],[\"L\",b,d-1],[\"L\",k,d-1],[\"L\",k,0],[\"Z\"],[\"M\",b,M],[\"L\",b,a],[\"L\",k,a],[\"L\",k,M],[\"Z\"]]),\"adjustHeight\"!==t.redrawTrigger&&this.mask.attr({d:S})}moveFixedElements(){let t;let{container:e,inverted:i,scrollablePixelsX:s,scrollablePixelsY:o}=this.chart,r=this.fixedRenderer,a=a0.fixedSelectors;if(s&&!i?t=\".highcharts-yaxis\":s&&i?t=\".highcharts-xaxis\":o&&!i?t=\".highcharts-xaxis\":o&&i&&(t=\".highcharts-yaxis\"),t&&!(this.chart.hasParallelCoordinates&&\".highcharts-yaxis\"===t))for(let e of[`${t}:not(.highcharts-radial-axis)`,`${t}-labels:not(.highcharts-radial-axis-labels)`])aK(a,e);else for(let t of[\".highcharts-xaxis\",\".highcharts-yaxis\"])for(let e of[`${t}:not(.highcharts-radial-axis)`,`${t}-labels:not(.highcharts-radial-axis-labels)`])aq(a,e);for(let t of a)[].forEach.call(e.querySelectorAll(t),t=>{(t.namespaceURI===r.SVG_NS?r.box:r.box.parentNode).appendChild(t),t.style.pointerEvents=\"auto\"})}}a0.fixedSelectors=[\".highcharts-breadcrumbs-group\",\".highcharts-contextbutton\",\".highcharts-caption\",\".highcharts-credits\",\".highcharts-drillup-button\",\".highcharts-legend\",\".highcharts-legend-checkbox\",\".highcharts-navigator-series\",\".highcharts-navigator-xaxis\",\".highcharts-navigator-yaxis\",\".highcharts-navigator\",\".highcharts-range-selector-group\",\".highcharts-reset-zoom\",\".highcharts-scrollbar\",\".highcharts-subtitle\",\".highcharts-title\"];let{format:a1}=eo,{series:a2}=rd,{destroyObjectProperties:a3,fireEvent:a5,getAlignFactor:a6,isNumber:a9,pick:a4}=$,a8=class{constructor(t,e,i,s,o){let r=t.chart.inverted,a=t.reversed;this.axis=t;let n=this.isNegative=!!i!=!!a;this.options=e=e||{},this.x=s,this.total=null,this.cumulative=null,this.points={},this.hasValidPoints=!1,this.stack=o,this.leftCliff=0,this.rightCliff=0,this.alignOptions={align:e.align||(r?n?\"left\":\"right\":\"center\"),verticalAlign:e.verticalAlign||(r?\"middle\":n?\"bottom\":\"top\"),y:e.y,x:e.x},this.textAlign=e.textAlign||(r?n?\"right\":\"left\":\"center\")}destroy(){a3(this,this.axis)}render(t){let e=this.axis.chart,i=this.options,s=i.format,o=s?a1(s,this,e):i.formatter.call(this);if(this.label)this.label.attr({text:o,visibility:\"hidden\"});else{this.label=e.renderer.label(o,null,void 0,i.shape,void 0,void 0,i.useHTML,!1,\"stack-labels\");let s={r:i.borderRadius||0,text:o,padding:a4(i.padding,5),visibility:\"hidden\"};e.styledMode||(s.fill=i.backgroundColor,s.stroke=i.borderColor,s[\"stroke-width\"]=i.borderWidth,this.label.css(i.style||{})),this.label.attr(s),this.label.added||this.label.add(t)}this.label.labelrank=e.plotSizeY,a5(this,\"afterRender\")}setOffset(t,e,i,s,o,r){let{alignOptions:a,axis:n,label:h,options:l,textAlign:d}=this,c=n.chart,p=this.getStackBox({xOffset:t,width:e,boxBottom:i,boxTop:s,defaultX:o,xAxis:r}),{verticalAlign:g}=a;if(h&&p){let t=h.getBBox(void 0,0),e=h.padding,i=\"justify\"===a4(l.overflow,\"justify\"),s;a.x=l.x||0,a.y=l.y||0;let{x:o,y:r}=this.adjustStackPosition({labelBox:t,verticalAlign:g,textAlign:d});p.x-=o,p.y-=r,h.align(a,!1,p),(s=c.isInsidePlot(h.alignAttr.x+a.x+o,h.alignAttr.y+a.y+r))||(i=!1),i&&a2.prototype.justifyDataLabel.call(n,h,a,h.alignAttr,t,p),h.attr({x:h.alignAttr.x,y:h.alignAttr.y,rotation:l.rotation,rotationOriginX:t.width*a6(l.textAlign||\"center\"),rotationOriginY:t.height/2}),a4(!i&&l.crop,!0)&&(s=a9(h.x)&&a9(h.y)&&c.isInsidePlot(h.x-e+(h.width||0),h.y)&&c.isInsidePlot(h.x+e,h.y)),h[s?\"show\":\"hide\"]()}a5(this,\"afterSetOffset\",{xOffset:t,width:e})}adjustStackPosition({labelBox:t,verticalAlign:e,textAlign:i}){return{x:t.width/2+t.width/2*(2*a6(i)-1),y:t.height/2*2*(1-a6(e))}}getStackBox(t){let e=this.axis,i=e.chart,{boxTop:s,defaultX:o,xOffset:r,width:a,boxBottom:n}=t,h=e.stacking.usePercentage?100:a4(s,this.total,0),l=e.toPixels(h),d=t.xAxis||i.xAxis[0],c=a4(o,d.translate(this.x))+r,p=Math.abs(l-e.toPixels(n||a9(e.min)&&e.logarithmic&&e.logarithmic.lin2log(e.min)||0)),g=i.inverted,u=this.isNegative;return g?{x:(u?l:l-p)-i.plotLeft,y:d.height-c-a+d.top-i.plotTop,width:p,height:a}:{x:c+d.transB-i.plotLeft,y:(u?l-p:l)-i.plotTop,width:a,height:p}}},{getDeferredAnimation:a7}=tR,{series:{prototype:nt}}=rd,{addEvent:ne,correctFloat:ni,defined:ns,destroyObjectProperties:no,fireEvent:nr,isNumber:na,objectEach:nn,pick:nh}=$;function nl(){let t=this.inverted;this.axes.forEach(t=>{t.stacking&&t.stacking.stacks&&t.hasVisibleSeries&&(t.stacking.oldStacks=t.stacking.stacks)}),this.series.forEach(e=>{let i=e.xAxis&&e.xAxis.options||{};e.options.stacking&&e.reserveSpace()&&(e.stackKey=[e.type,nh(e.options.stack,\"\"),t?i.top:i.left,t?i.height:i.width].join(\",\"))})}function nd(){let t=this.stacking;if(t){let e=t.stacks;nn(e,(t,i)=>{no(t),delete e[i]}),t.stackTotalGroup?.destroy()}}function nc(){this.stacking||(this.stacking=new nx(this))}function np(t,e,i,s){return!ns(t)||t.x!==e||s&&t.stackKey!==s?t={x:e,index:0,key:s,stackKey:s}:t.index++,t.key=[i,e,t.index].join(\",\"),t}function ng(){let t;let e=this,i=e.yAxis,s=e.stackKey||\"\",o=i.stacking.stacks,r=e.getColumn(\"x\",!0),a=e.options.stacking,n=e[a+\"Stacker\"];n&&[s,\"-\"+s].forEach(i=>{let s=r.length,a,h,l;for(;s--;)a=r[s],t=e.getStackIndicator(t,a,e.index,i),h=o[i]?.[a],(l=h?.points[t.key||\"\"])&&n.call(e,l,h,s)})}function nu(t,e,i){let s=e.total?100/e.total:0;t[0]=ni(t[0]*s),t[1]=ni(t[1]*s),this.stackedYData[i]=t[1]}function nf(t){(this.is(\"column\")||this.is(\"columnrange\"))&&(this.options.centerInCategory&&this.chart.series.length>1?nt.setStackedPoints.call(this,t,\"group\"):t.stacking.resetStacks())}function nm(t,e){let i,s,o,r,a,n,h;let l=e||this.options.stacking;if(!l||!this.reserveSpace()||(({group:\"xAxis\"})[l]||\"yAxis\")!==t.coll)return;let d=this.getColumn(\"x\",!0),c=this.getColumn(this.pointValKey||\"y\",!0),p=[],g=c.length,u=this.options,f=u.threshold||0,m=u.startFromThreshold?f:0,x=u.stack,y=e?`${this.type},${l}`:this.stackKey||\"\",b=\"-\"+y,v=this.negStacks,k=t.stacking,w=k.stacks,M=k.oldStacks;for(k.stacksTouched+=1,h=0;h0&&!1===this.singleStacks&&(o.points[n][0]=o.points[this.index+\",\"+e+\",0\"][0])):(delete o.points[n],delete o.points[this.index]);let S=o.total||0;\"percent\"===l?(r=s?y:b,S=v&&w[r]?.[e]?(r=w[r][e]).total=Math.max(r.total||0,S)+Math.abs(u):ni(S+Math.abs(u))):\"group\"===l?na(g)&&S++:S=ni(S+u),\"group\"===l?o.cumulative=(S||1)-1:o.cumulative=ni(nh(o.cumulative,m)+u),o.total=S,null!==g&&(o.points[n].push(o.cumulative),p[h]=o.cumulative,o.hasValidPoints=!0)}\"percent\"===l&&(k.usePercentage=!0),\"group\"!==l&&(this.stackedYData=p),k.oldStacks={}}class nx{constructor(t){this.oldStacks={},this.stacks={},this.stacksTouched=0,this.axis=t}buildStacks(){let t,e;let i=this.axis,s=i.series,o=\"xAxis\"===i.coll,r=i.options.reversedStacks,a=s.length;for(this.resetStacks(),this.usePercentage=!1,e=a;e--;)t=s[r?e:a-e-1],o&&t.setGroupedPoints(i),t.setStackedPoints(i);if(!o)for(e=0;e{nn(t,t=>{t.cumulative=t.total})}))}resetStacks(){nn(this.stacks,t=>{nn(t,(e,i)=>{na(e.touched)&&e.touched{nn(t,t=>{t.render(r)})}),r.animate({opacity:1},o)}}(p||(p={})).compose=function(t,e,i){let s=e.prototype,o=i.prototype;s.getStacks||(ne(t,\"init\",nc),ne(t,\"destroy\",nd),s.getStacks=nl,o.getStackIndicator=np,o.modifyStacks=ng,o.percentStacker=nu,o.setGroupedPoints=nf,o.setStackedPoints=nm)};let ny=p,{defined:nb,merge:nv,isObject:nk}=$;class nw extends rY{drawGraph(){let t=this.options,e=(this.gappedPath||this.getGraphPath).call(this),i=this.chart.styledMode;[this,...this.zones].forEach((s,o)=>{let r,a=s.graph,n=a?\"animate\":\"attr\",h=s.dashStyle||t.dashStyle;a?(a.endX=this.preventGraphAnimation?null:e.xMap,a.animate({d:e})):e.length&&(s.graph=a=this.chart.renderer.path(e).addClass(\"highcharts-graph\"+(o?` highcharts-zone-graph-${o-1} `:\" \")+(o&&s.className||\"\")).attr({zIndex:1}).add(this.group)),a&&!i&&(r={stroke:!o&&t.lineColor||s.color||this.color||\"#cccccc\",\"stroke-width\":t.lineWidth||0,fill:this.fillGraph&&this.color||\"none\"},h?r.dashstyle=h:\"square\"!==t.linecap&&(r[\"stroke-linecap\"]=r[\"stroke-linejoin\"]=\"round\"),a[n](r).shadow(t.shadow&&nv({filterUnits:\"userSpaceOnUse\"},nk(t.shadow)?t.shadow:{}))),a&&(a.startX=e.xMap,a.isArea=e.isArea)})}getGraphPath(t,e,i){let s=this,o=s.options,r=[],a=[],n,h=o.step,l=(t=t||s.points).reversed;return l&&t.reverse(),(h=({right:1,center:2})[h]||h&&3)&&l&&(h=4-h),(t=this.getValidPoints(t,!1,!(o.connectNulls&&!e&&!i))).forEach(function(l,d){let c;let p=l.plotX,g=l.plotY,u=t[d-1],f=l.isNull||\"number\"!=typeof g;(l.leftCliff||u&&u.rightCliff)&&!i&&(n=!0),f&&!nb(e)&&d>0?n=!o.connectNulls:f&&!e?n=!0:(0===d||n?c=[[\"M\",l.plotX,l.plotY]]:s.getPointSpline?c=[s.getPointSpline(t,l,d)]:h?(c=1===h?[[\"L\",u.plotX,g]]:2===h?[[\"L\",(u.plotX+p)/2,u.plotY],[\"L\",(u.plotX+p)/2,g]]:[[\"L\",p,u.plotY]]).push([\"L\",p,g]):c=[[\"L\",p,g]],a.push(l.x),h&&(a.push(l.x),2===h&&a.push(l.x)),r.push.apply(r,c),n=!1)}),r.xMap=a,s.graphPath=r,r}}nw.defaultOptions=nv(rY.defaultOptions,{legendSymbol:\"lineMarker\"}),rd.registerSeriesType(\"line\",nw);let{seriesTypes:{line:nM}}=rd,{extend:nS,merge:nT,objectEach:nC,pick:nA}=$;class nP extends nM{drawGraph(){this.areaPath=[],super.drawGraph.apply(this);let{areaPath:t,options:e}=this;[this,...this.zones].forEach((i,s)=>{let o={},r=i.fillColor||e.fillColor,a=i.area,n=a?\"animate\":\"attr\";a?(a.endX=this.preventGraphAnimation?null:t.xMap,a.animate({d:t})):(o.zIndex=0,(a=i.area=this.chart.renderer.path(t).addClass(\"highcharts-area\"+(s?` highcharts-zone-area-${s-1} `:\" \")+(s&&i.className||\"\")).add(this.group)).isArea=!0),this.chart.styledMode||(o.fill=r||i.color||this.color,o[\"fill-opacity\"]=r?1:e.fillOpacity??.75,a.css({pointerEvents:this.stickyTracking?\"none\":\"auto\"})),a[n](o),a.startX=t.xMap,a.shiftUnit=e.step?2:1})}getGraphPath(t){let e,i,s;let o=nM.prototype.getGraphPath,r=this.options,a=r.stacking,n=this.yAxis,h=[],l=[],d=this.index,c=n.stacking.stacks[this.stackKey],p=r.threshold,g=Math.round(n.getThreshold(r.threshold)),u=nA(r.connectNulls,\"percent\"===a),f=function(i,s,o){let r=t[i],u=a&&c[r.x].points[d],f=r[o+\"Null\"]||0,m=r[o+\"Cliff\"]||0,x,y,b=!0;m||f?(x=(f?u[0]:u[1])+m,y=u[0]+m,b=!!f):!a&&t[s]&&t[s].isNull&&(x=y=p),void 0!==x&&(l.push({plotX:e,plotY:null===x?g:n.getThreshold(x),isNull:b,isCliff:!0}),h.push({plotX:e,plotY:null===y?g:n.getThreshold(y),doCurve:!1}))};t=t||this.points,a&&(t=this.getStackPoints(t));for(let o=0,r=t.length;o1&&a&&l.some(t=>t.isCliff)&&(b.hasStackedCliffs=v.hasStackedCliffs=!0),b.xMap=m.xMap,this.areaPath=b,v}getStackPoints(t){let e=this,i=[],s=[],o=this.xAxis,r=this.yAxis,a=r.stacking.stacks[this.stackKey],n={},h=r.series,l=h.length,d=r.options.reversedStacks?1:-1,c=h.indexOf(e);if(t=t||this.points,this.options.stacking){for(let e=0;et.visible);s.forEach(function(t,g){let u=0,f,m;if(n[t]&&!n[t].isNull)i.push(n[t]),[-1,1].forEach(function(i){let o=1===i?\"rightNull\":\"leftNull\",r=a[s[g+i]],u=0;if(r){let i=c;for(;i>=0&&i=0&&ei&&o>h?(o=Math.max(i,h),a=2*h-o):op&&a>h?(a=Math.max(p,h),o=2*h-a):a1){let o=this.xAxis.series.filter(t=>t.visible).map(t=>t.index),r=0,a=0;nK(this.xAxis.stacking?.stacks,t=>{let e=\"number\"==typeof i.x?t[i.x.toString()]?.points:void 0,s=e?.[this.index],n={};if(e&&nV(s)){let t=this.index,i=Object.keys(e).filter(t=>!t.match(\",\")&&e[t]&&e[t].length>1).map(parseFloat).filter(t=>-1!==o.indexOf(t)).filter(e=>{let i=this.chart.series[e].options,s=i.stacking&&i.stack;if(nj(s)){if(n_(n[s]))return t===e&&(t=n[s]),!1;n[s]=e}return!0}).sort((t,e)=>e-t);r=i.indexOf(t),a=i.length}}),r=this.xAxis.reversed?a-1-r:r;let n=(a-1)*s.paddedWidth+e;t=(i.plotX||0)+n/2-e-r*s.paddedWidth}return t}translate(){let t=this,e=t.chart,i=t.options,s=t.dense=t.closestPointRange*t.xAxis.transA<2,o=t.borderWidth=nZ(i.borderWidth,s?0:1),r=t.xAxis,a=t.yAxis,n=i.threshold,h=nZ(i.minPointLength,5),l=t.getColumnMetrics(),d=l.width,c=t.pointXOffset=l.offset,p=t.dataMin,g=t.dataMax,u=t.translatedThreshold=a.getThreshold(n),f=t.barW=Math.max(d,1+2*o);i.pointPadding&&i.crisp&&(f=Math.ceil(f)),rY.prototype.translate.apply(t),t.points.forEach(function(s){let o=nZ(s.yBottom,u),m=999+Math.abs(o),x=s.plotX||0,y=nG(s.plotY,-m,a.len+m),b,v=Math.min(y,o),k=Math.max(y,o)-v,w=d,M=x+c,S=f;h&&Math.abs(k)h?o-h:u-(b?h:0)),nj(s.options.pointWidth)&&(M-=Math.round(((w=S=Math.ceil(s.options.pointWidth))-d)/2)),i.centerInCategory&&(M=t.adjustForMissingColumns(M,w,s,l)),s.barX=M,s.pointWidth=w,s.tooltipPos=e.inverted?[nG(a.len+a.pos-e.plotLeft-y,a.pos-e.plotLeft,a.len+a.pos-e.plotLeft),r.len+r.pos-e.plotTop-M-S/2,k]:[r.left-e.plotLeft+M+S/2,nG(y+a.pos-e.plotTop,a.pos-e.plotTop,a.len+a.pos-e.plotTop),k],s.shapeType=t.pointClass.prototype.shapeType||\"roundedRect\",s.shapeArgs=t.crispCol(M,s.isNull?u:v,S,s.isNull?0:k)}),n$(this,\"afterColumnTranslate\")}drawGraph(){this.group[this.dense?\"addClass\":\"removeClass\"](\"highcharts-dense-data\")}pointAttribs(t,e){let i=this.options,s=this.pointAttrToOptions||{},o=s.stroke||\"borderColor\",r=s[\"stroke-width\"]||\"borderWidth\",a,n,h,l=t&&t.color||this.color,d=t&&t[o]||i[o]||l,c=t&&t.options.dashStyle||i.dashStyle,p=t&&t[r]||i[r]||this[r]||0,g=nZ(t&&t.opacity,i.opacity,1);t&&this.zones.length&&(n=t.getZone(),l=t.options.color||n&&(n.color||t.nonZonedColor)||this.color,n&&(d=n.borderColor||d,c=n.dashStyle||c,p=n.borderWidth||p)),e&&t&&(h=(a=nq(i.states[e],t.options.states&&t.options.states[e]||{})).brightness,l=a.color||void 0!==h&&nX(l).brighten(a.brightness).get()||l,d=a[o]||d,p=a[r]||p,c=a.dashStyle||c,g=nZ(a.opacity,g));let u={fill:l,stroke:d,\"stroke-width\":p,opacity:g};return c&&(u.dashstyle=c),u}drawPoints(t=this.points){let e;let i=this,s=this.chart,o=i.options,r=s.renderer,a=o.animationLimit||250;t.forEach(function(t){let n=t.plotY,h=t.graphic,l=!!h,d=h&&s.pointCountt?.enabled)}function i(t,e,i,s,o){let{chart:r,enabledDataSorting:a}=this,n=this.isCartesian&&r.inverted,h=t.plotX,l=t.plotY,d=i.rotation||0,c=n2(h)&&n2(l)&&r.isInsidePlot(h,Math.round(l),{inverted:n,paneCoordinates:!0,series:this}),p=0===d&&\"justify\"===ht(i.overflow,a?\"none\":\"justify\"),g=this.visible&&!1!==t.visible&&n2(h)&&(t.series.forceDL||a&&!p||c||ht(i.inside,!!this.options.stacking)&&s&&r.isInsidePlot(h,n?s.x+1:s.y+s.height-1,{inverted:n,paneCoordinates:!0,series:this})),u=t.pos();if(g&&u){var f;let h=e.getBBox(),l=e.getBBox(void 0,0);if(s=n3({x:u[0],y:Math.round(u[1]),width:0,height:0},s||{}),\"plotEdges\"===i.alignTo&&this.isCartesian&&(s[n?\"x\":\"y\"]=0,s[n?\"width\":\"height\"]=this.yAxis?.len||0),n3(i,{width:h.width,height:h.height}),f=s,a&&this.xAxis&&!p&&this.setDataLabelStartPos(t,e,o,c,f),e.align(n8(i,{width:l.width,height:l.height}),!1,s,!1),e.alignAttr.x+=n6(i.align)*(l.width-h.width),e.alignAttr.y+=n6(i.verticalAlign)*(l.height-h.height),e[e.placed?\"animate\":\"attr\"]({\"text-align\":e.alignAttr[\"text-align\"]||\"center\",x:e.alignAttr.x+(h.width-l.width)/2,y:e.alignAttr.y+(h.height-l.height)/2,rotationOriginX:(e.width||0)/2,rotationOriginY:(e.height||0)/2}),p&&s.height>=0)this.justifyDataLabel(e,i,e.alignAttr,h,s,o);else if(ht(i.crop,!0)){let{x:t,y:i}=e.alignAttr;g=r.isInsidePlot(t,i,{paneCoordinates:!0,series:this})&&r.isInsidePlot(t+h.width-1,i+h.height-1,{paneCoordinates:!0,series:this})}i.shape&&!d&&e[o?\"attr\":\"animate\"]({anchorX:u[0],anchorY:u[1]})}o&&a&&(e.placed=!1),g||a&&!p?(e.show(),e.placed=!0):(e.hide(),e.placed=!1)}function s(){return this.plotGroup(\"dataLabelsGroup\",\"data-labels\",this.hasRendered?\"inherit\":\"hidden\",this.options.dataLabels.zIndex||6)}function o(t){let e=this.hasRendered||0,i=this.initDataLabelsGroup().attr({opacity:+e});return!e&&i&&(this.visible&&i.show(),this.options.animation?i.animate({opacity:1},t):i.attr({opacity:1})),i}function r(t){let e;t=t||this.points;let i=this,s=i.chart,o=i.options,r=s.renderer,{backgroundColor:a,plotBackgroundColor:l}=s.options.chart,d=r.getContrast(n4(l)&&l||n4(a)&&a||\"#000000\"),c=h(i),{animation:p,defer:g}=c[0],u=g?n0(s,p,i):{defer:0,duration:0};n5(this,\"drawDataLabels\"),i.hasDataLabels?.()&&(e=this.initDataLabels(u),t.forEach(t=>{let a=t.dataLabels||[];hi(n(c,t.dlOptions||t.options?.dataLabels)).forEach((n,h)=>{let l=n.enabled&&(t.visible||t.dataLabelOnHidden)&&(!t.isNull||t.dataLabelOnNull)&&function(t,e){let i=e.filter;if(i){let e=i.operator,s=t[i.property],o=i.value;return\">\"===e&&s>o||\"<\"===e&&s=\"===e&&s>=o||\"<=\"===e&&s<=o||\"==\"===e&&s==o||\"===\"===e&&s===o||\"!=\"===e&&s!=o||\"!==\"===e&&s!==o}return!0}(t,n),{backgroundColor:c,borderColor:p,distance:g,style:u={}}=n,f,m,x,y={},b=a[h],v=!b,k;l&&(m=n2(f=ht(n[t.formatPrefix+\"Format\"],n.format))?n1(f,t,s):(n[t.formatPrefix+\"Formatter\"]||n.formatter).call(t,n),x=n.rotation,!s.styledMode&&(u.color=ht(n.color,u.color,n4(i.color)?i.color:void 0,\"#000000\"),\"contrast\"===u.color?(\"none\"!==c&&(k=c),t.contrastColor=r.getContrast(\"auto\"!==k&&k||t.color||i.color),u.color=k||!n2(g)&&n.inside||0>he(g||0)||o.stacking?t.contrastColor:d):delete t.contrastColor,o.cursor&&(u.cursor=o.cursor)),y={r:n.borderRadius||0,rotation:x,padding:n.padding,zIndex:1},s.styledMode||(y.fill=\"auto\"===c?t.color:c,y.stroke=\"auto\"===p?t.color:p,y[\"stroke-width\"]=n.borderWidth),n7(y,(t,e)=>{void 0===t&&delete y[e]})),!b||l&&n2(m)&&!!b.div==!!n.useHTML&&(b.rotation&&n.rotation||b.rotation===n.rotation)||(b=void 0,v=!0),l&&n2(m)&&(b?y.text=m:(b=r.label(m,0,0,n.shape,void 0,void 0,n.useHTML,void 0,\"data-label\")).addClass(\" highcharts-data-label-color-\"+t.colorIndex+\" \"+(n.className||\"\")+(n.useHTML?\" highcharts-tracker\":\"\")),b&&(b.options=n,b.attr(y),s.styledMode?u.width&&b.css({width:u.width,textOverflow:u.textOverflow,whiteSpace:u.whiteSpace}):b.css(u).shadow(n.shadow),n5(b,\"beforeAddingDataLabel\",{labelOptions:n,point:t}),b.added||b.add(e),i.alignDataLabel(t,b,n,void 0,v),b.isActive=!0,a[h]&&a[h]!==b&&a[h].destroy(),a[h]=b))});let h=a.length;for(;h--;)a[h]&&a[h].isActive?a[h].isActive=!1:(a[h]?.destroy(),a.splice(h,1));t.dataLabel=a[0],t.dataLabels=a})),n5(this,\"afterDrawDataLabels\")}function a(t,e,i,s,o,r){let a=this.chart,n=e.align,h=e.verticalAlign,l=t.box?0:t.padding||0,d=a.inverted?this.yAxis:this.xAxis,c=d?d.left-a.plotLeft:0,p=a.inverted?this.xAxis:this.yAxis,g=p?p.top-a.plotTop:0,{x:u=0,y:f=0}=e,m,x;return(m=(i.x||0)+l+c)<0&&(\"right\"===n&&u>=0?(e.align=\"left\",e.inside=!0):u-=m,x=!0),(m=(i.x||0)+s.width-l+c)>a.plotWidth&&(\"left\"===n&&u<=0?(e.align=\"right\",e.inside=!0):u+=a.plotWidth-m,x=!0),(m=i.y+l+g)<0&&(\"bottom\"===h&&f>=0?(e.verticalAlign=\"top\",e.inside=!0):f-=m,x=!0),(m=(i.y||0)+s.height-l+g)>a.plotHeight&&(\"top\"===h&&f<=0?(e.verticalAlign=\"bottom\",e.inside=!0):f+=a.plotHeight-m,x=!0),x&&(e.x=u,e.y=f,t.placed=!r,t.align(e,void 0,o)),x}function n(t,e){let i=[],s;if(n9(t)&&!n9(e))i=t.map(function(t){return n8(t,e)});else if(n9(e)&&!n9(t))i=e.map(function(e){return n8(t,e)});else if(n9(t)||n9(e)){if(n9(t)&&n9(e))for(s=Math.max(t.length,e.length);s--;)i[s]=n8(t[s],e[s])}else i=n8(t,e);return i}function h(t){let e=t.chart.options.plotOptions;return hi(n(n(e?.series?.dataLabels,e?.[t.type]?.dataLabels),t.options.dataLabels))}function l(t,e,i,s,o){let r=this.chart,a=r.inverted,n=this.xAxis,h=n.reversed,l=((a?e.height:e.width)||0)/2,d=t.pointWidth,c=d?d/2:0;e.startXPos=a?o.x:h?-l-c:n.width-l+c,e.startYPos=a?h?this.yAxis.height-l+c:-l-c:o.y,s?\"hidden\"===e.visibility&&(e.show(),e.attr({opacity:0}).animate({opacity:1})):e.attr({opacity:1}).animate({opacity:0},void 0,e.hide),r.hasRendered&&(i&&e.attr({x:e.startXPos,y:e.startYPos}),e.placed=!0)}t.compose=function(t){let n=t.prototype;n.initDataLabels||(n.initDataLabels=o,n.initDataLabelsGroup=s,n.alignDataLabel=i,n.drawDataLabels=r,n.justifyDataLabel=a,n.setDataLabelStartPos=l,n.hasDataLabels=e)}}(g||(g={}));let hs=g,{composed:ho}=k,{series:hr}=rd,{merge:ha,pick:hn,pushUnique:hh}=$;!function(t){function e(t,e,i,s,o){let r=this.chart.inverted,a=t.series,n=(a.xAxis?a.xAxis.len:this.chart.plotSizeX)||0,h=(a.yAxis?a.yAxis.len:this.chart.plotSizeY)||0,l=t.dlBox||t.shapeArgs,d=hn(t.below,t.plotY>hn(this.translatedThreshold,h)),c=hn(i.inside,!!this.options.stacking);if(l){if(s=ha(l),!(\"allow\"===i.overflow&&!1===i.crop)){s.y<0&&(s.height+=s.y,s.y=0);let t=s.y+s.height-h;t>0&&t\u25CF {series.name}
',pointFormat:\"x: {point.x}
y: {point.y}
\"}}),hm(hy.prototype,{drawTracker:hg.prototype.drawTracker,sorted:!1,requireSorting:!1,noSharedTooltip:!0,trackerGroups:[\"group\",\"markerGroup\",\"dataLabelsGroup\"]}),hf(hy,\"afterTranslate\",function(){this.applyJitter()}),rd.registerSeriesType(\"scatter\",hy);let{deg2rad:hb}=k,{fireEvent:hv,isNumber:hk,pick:hw,relativeLength:hM}=$;!function(t){t.getCenter=function(){let t=this.options,e=this.chart,i=2*(t.slicedOffset||0),s=e.plotWidth-2*i,o=e.plotHeight-2*i,r=t.center,a=Math.min(s,o),n=t.thickness,h,l=t.size,d=t.innerSize||0,c,p;\"string\"==typeof l&&(l=parseFloat(l)),\"string\"==typeof d&&(d=parseFloat(d));let g=[hw(r?.[0],\"50%\"),hw(r?.[1],\"50%\"),hw(l&&l<0?void 0:t.size,\"100%\"),hw(d&&d<0?void 0:t.innerSize||0,\"0%\")];for(!e.angular||this instanceof rY||(g[3]=0),c=0;c<4;++c)p=g[c],h=c<2||2===c&&/%$/.test(p),g[c]=hM(p,[s,o,a,g[2]][c])+(h?i:0);return g[3]>g[2]&&(g[3]=g[2]),hk(n)&&2*n0&&(g[3]=g[2]-2*n),hv(this,\"afterGetCenter\",{positions:g}),g},t.getStartAndEndRadians=function(t,e){let i=hk(t)?t:0,s=hk(e)&&e>i&&e-i<360?e:i+360;return{start:hb*(i+-90),end:hb*(s+-90)}}}(f||(f={}));let hS=f,{setAnimation:hT}=tR,{addEvent:hC,defined:hA,extend:hP,isNumber:hL,pick:hO,relativeLength:hE}=$;class hI extends oF{getConnectorPath(t){let e=t.dataLabelPosition,i=t.options||{},s=i.connectorShape,o=this.connectorShapes[s]||s;return e&&o.call(this,{...e.computed,alignment:e.alignment},e.connectorPosition,i)||[]}getTranslate(){return this.sliced&&this.slicedTranslation||{translateX:0,translateY:0}}haloPath(t){let e=this.shapeArgs;return this.sliced||!this.visible?[]:this.series.chart.renderer.symbols.arc(e.x,e.y,e.r+t,e.r+t,{innerR:e.r-1,start:e.start,end:e.end,borderRadius:e.borderRadius})}constructor(t,e,i){super(t,e,i),this.half=0,this.name??(this.name=\"Slice\");let s=t=>{this.slice(\"select\"===t.type)};hC(this,\"select\",s),hC(this,\"unselect\",s)}isValid(){return hL(this.y)&&this.y>=0}setVisible(t,e=!0){t!==this.visible&&this.update({visible:t??!this.visible},e,void 0,!1)}slice(t,e,i){let s=this.series;hT(i,s.chart),e=hO(e,!0),this.sliced=this.options.sliced=t=hA(t)?t:!this.sliced,s.options.data[s.data.indexOf(this)]=this.options,this.graphic&&this.graphic.animate(this.getTranslate())}}hP(hI.prototype,{connectorShapes:{fixedOffset:function(t,e,i){let s=e.breakAt,o=e.touchingSliceAt,r=i.softConnector?[\"C\",t.x+(\"left\"===t.alignment?-5:5),t.y,2*s.x-o.x,2*s.y-o.y,s.x,s.y]:[\"L\",s.x,s.y];return[[\"M\",t.x,t.y],r,[\"L\",o.x,o.y]]},straight:function(t,e){let i=e.touchingSliceAt;return[[\"M\",t.x,t.y],[\"L\",i.x,i.y]]},crookedLine:function(t,e,i){let{angle:s=this.angle||0,breakAt:o,touchingSliceAt:r}=e,{series:a}=this,[n,h,l]=a.center,d=l/2,{plotLeft:c,plotWidth:p}=a.chart,g=\"left\"===t.alignment,{x:u,y:f}=t,m=o.x;if(i.crookDistance){let t=hE(i.crookDistance,1);m=g?n+d+(p+c-n-d)*(1-t):c+(n-d)*t}else m=n+(h-f)*Math.tan(s-Math.PI/2);let x=[[\"M\",u,f]];return(g?m<=u&&m>=o.x:m>=u&&m<=o.x)&&x.push([\"L\",m,f]),x.push([\"L\",o.x,o.y],[\"L\",r.x,r.y]),x}}});let{getStartAndEndRadians:hD}=hS,{noop:hB}=k,{clamp:hN,extend:hz,fireEvent:hR,merge:hW,pick:hH}=$;class hX extends rY{animate(t){let e=this,i=e.points,s=e.startAngleRad;t||i.forEach(function(t){let i=t.graphic,o=t.shapeArgs;i&&o&&(i.attr({r:hH(t.startR,e.center&&e.center[3]/2),start:s,end:s}),i.animate({r:o.r,start:o.start,end:o.end},e.options.animation))})}drawEmpty(){let t,e;let i=this.startAngleRad,s=this.endAngleRad,o=this.options;0===this.total&&this.center?(t=this.center[0],e=this.center[1],this.graph||(this.graph=this.chart.renderer.arc(t,e,this.center[1]/2,0,i,s).addClass(\"highcharts-empty-series\").add(this.group)),this.graph.attr({d:e6.arc(t,e,this.center[2]/2,0,{start:i,end:s,innerR:this.center[3]/2})}),this.chart.styledMode||this.graph.attr({\"stroke-width\":o.borderWidth,fill:o.fillColor||\"none\",stroke:o.color||\"#cccccc\"})):this.graph&&(this.graph=this.graph.destroy())}drawPoints(){let t=this.chart.renderer;this.points.forEach(function(e){e.graphic&&e.hasNewShapeType()&&(e.graphic=e.graphic.destroy()),e.graphic||(e.graphic=t[e.shapeType](e.shapeArgs).add(e.series.group),e.delayedRendering=!0)})}generatePoints(){super.generatePoints(),this.updateTotals()}getX(t,e,i,s){let o=this.center,r=this.radii?this.radii[i.index]||0:o[2]/2,a=s.dataLabelPosition,n=a?.distance||0,h=Math.asin(hN((t-o[1])/(r+n),-1,1));return o[0]+Math.cos(h)*(r+n)*(e?-1:1)+(n>0?(e?-1:1)*(s.padding||0):0)}hasData(){return!!this.dataTable.rowCount}redrawPoints(){let t,e,i,s;let o=this,r=o.chart;this.drawEmpty(),o.group&&!r.styledMode&&o.group.shadow(o.options.shadow),o.points.forEach(function(a){let n={};e=a.graphic,!a.isNull&&e?(s=a.shapeArgs,t=a.getTranslate(),r.styledMode||(i=o.pointAttribs(a,a.selected&&\"select\")),a.delayedRendering?(e.setRadialReference(o.center).attr(s).attr(t),r.styledMode||e.attr(i).attr({\"stroke-linejoin\":\"round\"}),a.delayedRendering=!1):(e.setRadialReference(o.center),r.styledMode||hW(!0,n,i),hW(!0,n,s,t),e.animate(n)),e.attr({visibility:a.visible?\"inherit\":\"hidden\"}),e.addClass(a.getClassName(),!0)):e&&(a.graphic=e.destroy())})}sortByAngle(t,e){t.sort(function(t,i){return void 0!==t.angle&&(i.angle-t.angle)*e})}translate(t){hR(this,\"translate\"),this.generatePoints();let e=this.options,i=e.slicedOffset,s=hD(e.startAngle,e.endAngle),o=this.startAngleRad=s.start,r=(this.endAngleRad=s.end)-o,a=this.points,n=e.ignoreHiddenPoint,h=a.length,l,d,c,p,g,u,f,m=0;for(t||(this.center=t=this.getCenter()),u=0;u1.5*Math.PI?c-=2*Math.PI:c<-Math.PI/2&&(c+=2*Math.PI),f.slicedTranslation={translateX:Math.round(Math.cos(c)*i),translateY:Math.round(Math.sin(c)*i)},p=Math.cos(c)*t[2]/2,g=Math.sin(c)*t[2]/2,f.tooltipPos=[t[0]+.7*p,t[1]+.7*g],f.half=c<-Math.PI/2||c>Math.PI/2?1:0,f.angle=c}hR(this,\"afterTranslate\")}updateTotals(){let t=this.points,e=t.length,i=this.options.ignoreHiddenPoint,s,o,r=0;for(s=0;s0&&(o.visible||!i)?o.y/r*100:0,o.total=r}}hX.defaultOptions=hW(rY.defaultOptions,{borderRadius:3,center:[null,null],clip:!1,colorByPoint:!0,dataLabels:{connectorPadding:5,connectorShape:\"crookedLine\",crookDistance:void 0,distance:30,enabled:!0,formatter:function(){return this.isNull?void 0:this.name},softConnector:!0,x:0},fillColor:void 0,ignoreHiddenPoint:!0,inactiveOtherPoints:!0,legendType:\"point\",marker:null,size:null,showInLegend:!1,slicedOffset:10,stickyTracking:!1,tooltip:{followPointer:!0},borderColor:\"#ffffff\",borderWidth:1,lineWidth:void 0,states:{hover:{brightness:.1}}}),hz(hX.prototype,{axisTypes:[],directTouch:!0,drawGraph:void 0,drawTracker:nQ.prototype.drawTracker,getCenter:hS.getCenter,getSymbol:hB,invertible:!1,isCartesian:!1,noSharedTooltip:!0,pointAttribs:nQ.prototype.pointAttribs,pointClass:hI,requireSorting:!1,searchPoint:hB,trackerGroups:[\"group\",\"dataLabelsGroup\"]}),rd.registerSeriesType(\"pie\",hX);let{composed:hF,noop:hG}=k,{distribute:hY}=ed,{series:hj}=rd,{arrayMax:hU,clamp:h$,defined:hV,pick:h_,pushUnique:hq,relativeLength:hZ}=$;!function(t){let e={radialDistributionY:function(t,e){return(e.dataLabelPosition?.top||0)+t.distributeBox.pos},radialDistributionX:function(t,e,i,s,o){let r=o.dataLabelPosition;return t.getX(i<(r?.top||0)+2||i>(r?.bottom||0)-2?s:i,e.half,e,o)},justify:function(t,e,i,s){return s[0]+(t.half?-1:1)*(i+(e.dataLabelPosition?.distance||0))},alignToPlotEdges:function(t,e,i,s){let o=t.getBBox().width;return e?o+s:i-o-s},alignToConnectors:function(t,e,i,s){let o=0,r;return t.forEach(function(t){(r=t.dataLabel.getBBox().width)>o&&(o=r)}),e?o+s:i-o-s}};function i(t,e){let i=Math.PI/2,{start:s=0,end:o=0}=t.shapeArgs||{},r=t.angle||0;e>0&&si&&r>i/2&&r<1.5*i&&(r=r<=i?Math.max(i/2,(s+i)/2):Math.min(1.5*i,(i+o)/2));let{center:a,options:n}=this,h=a[2]/2,l=Math.cos(r),d=Math.sin(r),c=a[0]+l*h,p=a[1]+d*h,g=Math.min((n.slicedOffset||0)+(n.borderWidth||0),e/5);return{natural:{x:c+l*e,y:p+d*e},computed:{},alignment:e<0?\"center\":t.half?\"right\":\"left\",connectorPosition:{angle:r,breakAt:{x:c+l*g,y:p+d*g},touchingSliceAt:{x:c,y:p}},distance:e}}function s(){let t=this,e=t.points,i=t.chart,s=i.plotWidth,o=i.plotHeight,r=i.plotLeft,a=Math.round(i.chartWidth/3),n=t.center,h=n[2]/2,l=n[1],d=[[],[]],c=[0,0,0,0],p=t.dataLabelPositioners,g,u,f,m=0;t.visible&&t.hasDataLabels?.()&&(e.forEach(t=>{(t.dataLabels||[]).forEach(t=>{t.shortened&&(t.attr({width:\"auto\"}).css({width:\"auto\",textOverflow:\"clip\"}),t.shortened=!1)})}),hj.prototype.drawDataLabels.apply(t),e.forEach(t=>{(t.dataLabels||[]).forEach((e,i)=>{let s=n[2]/2,o=e.options,r=hZ(o?.distance||0,s);0===i&&d[t.half].push(t),!hV(o?.style?.width)&&e.getBBox().width>a&&(e.css({width:Math.round(.7*a)+\"px\"}),e.shortened=!0),e.dataLabelPosition=this.getDataLabelPosition(t,r),m=Math.max(m,r)})}),d.forEach((e,a)=>{let d=e.length,g=[],x,y,b=0,v;d&&(t.sortByAngle(e,a-.5),m>0&&(x=Math.max(0,l-h-m),y=Math.min(l+h+m,i.plotHeight),e.forEach(t=>{(t.dataLabels||[]).forEach(e=>{let s=e.dataLabelPosition;s&&s.distance>0&&(s.top=Math.max(0,l-h-s.distance),s.bottom=Math.min(l+h+s.distance,i.plotHeight),b=e.getBBox().height||21,e.lineHeight=i.renderer.fontMetrics(e.text||e).h+2*e.padding,t.distributeBox={target:(e.dataLabelPosition?.natural.y||0)-s.top+e.lineHeight/2,size:b,rank:t.y},g.push(t.distributeBox))})}),hY(g,v=y+b-x,v/5)),e.forEach(i=>{(i.dataLabels||[]).forEach(l=>{let d=l.options||{},m=i.distributeBox,x=l.dataLabelPosition,y=x?.natural.y||0,b=d.connectorPadding||0,v=l.lineHeight||21,k=(v-l.getBBox().height)/2,w=0,M=y,S=\"inherit\";if(x){if(g&&hV(m)&&x.distance>0&&(void 0===m.pos?S=\"hidden\":(f=m.size,M=p.radialDistributionY(i,l))),d.justify)w=p.justify(i,l,h,n);else switch(d.alignTo){case\"connectors\":w=p.alignToConnectors(e,a,s,r);break;case\"plotEdges\":w=p.alignToPlotEdges(l,a,s,r);break;default:w=p.radialDistributionX(t,i,M-k,y,l)}if(x.attribs={visibility:S,align:x.alignment},x.posAttribs={x:w+(d.x||0)+(({left:b,right:-b})[x.alignment]||0),y:M+(d.y||0)-v/2},x.computed.x=w,x.computed.y=M-k,h_(d.crop,!0)){let t;w-(u=l.getBBox().width)s-b&&0===a&&(t=Math.round(w+u-s+b),c[1]=Math.max(t,c[1])),M-f/2<0?c[0]=Math.max(Math.round(-M+f/2),c[0]):M+f/2>o&&(c[2]=Math.max(Math.round(M+f/2-o),c[2])),x.sideOverflow=t}}})}))}),(0===hU(c)||this.verifyDataLabelOverflow(c))&&(this.placeDataLabels(),this.points.forEach(e=>{(e.dataLabels||[]).forEach(s=>{let{connectorColor:o,connectorWidth:r=1}=s.options||{},a=s.dataLabelPosition;if(r){let n;g=s.connector,a&&a.distance>0?(n=!g,g||(s.connector=g=i.renderer.path().addClass(\"highcharts-data-label-connector highcharts-color-\"+e.colorIndex+(e.className?\" \"+e.className:\"\")).add(t.dataLabelsGroup)),i.styledMode||g.attr({\"stroke-width\":r,stroke:o||e.color||\"#666666\"}),g[n?\"attr\":\"animate\"]({d:e.getConnectorPath(s)}),g.attr({visibility:a.attribs?.visibility})):g&&(s.connector=g.destroy())}})})))}function o(){this.points.forEach(t=>{(t.dataLabels||[]).forEach(t=>{let e=t.dataLabelPosition;e?(e.sideOverflow&&(t.css({width:Math.max(t.getBBox().width-e.sideOverflow,0)+\"px\",textOverflow:(t.options?.style||{}).textOverflow||\"ellipsis\"}),t.shortened=!0),t.attr(e.attribs),t[t.moved?\"animate\":\"attr\"](e.posAttribs),t.moved=!0):t&&t.attr({y:-9999})}),delete t.distributeBox},this)}function r(t){let e=this.center,i=this.options,s=i.center,o=i.minSize||80,r=o,a=null!==i.size;return!a&&(null!==s[0]?r=Math.max(e[2]-Math.max(t[1],t[3]),o):(r=Math.max(e[2]-t[1]-t[3],o),e[0]+=(t[3]-t[1])/2),null!==s[1]?r=h$(r,o,e[2]-Math.max(t[0],t[2])):(r=h$(r,o,e[2]-t[0]-t[2]),e[1]+=(t[0]-t[2])/2),r(t.x+=e.x,t.y+=e.y,t),{x:0,y:0});return{x:e.x/t.length,y:e.y/t.length}},t.getDistanceBetweenPoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},t.getAngleBetweenPoints=function(t,e){return Math.atan2(e.x-t.x,e.y-t.y)},t.pointInPolygon=function({x:t,y:e},i){let s=i.length,o,r,a=!1;for(o=0,r=s-1;oe!=l>e&&t<(h-s)*(e-n)/(l-n)+s&&(a=!a)}return a}}(x||(x={}));let{pointInPolygon:hJ}=x,{addEvent:hQ,fireEvent:h0,objectEach:h1,pick:h2}=$;function h3(t){let e=t.length,i=(t,e)=>!(e.x>=t.x+t.width||e.x+e.width<=t.x||e.y>=t.y+t.height||e.y+e.height<=t.y),s=(t,e)=>{for(let i of t)if(hJ({x:i[0],y:i[1]},e))return!0;return!1},o,r,a,n,h,l=!1;for(let i=0;i(e.labelrank||0)-(t.labelrank||0));for(let o=0;o{h1(t,t=>{t.label&&e.push(t.label)})});for(let i of t.series||[])if(i.visible&&i.hasDataLabels?.()){let s=i=>{for(let s of i)s.visible&&(s.dataLabels||[]).forEach(i=>{let o=i.options||{};i.labelrank=h2(o.labelrank,s.labelrank,s.shapeArgs?.height),o.allowOverlap??Number(o.distance)>0?(i.oldOpacity=i.opacity,i.newOpacity=1,h5(i,t)):e.push(i)})};s(i.nodes||[]),s(i.points)}this.hideOverlappingLabels(e)}let h9={compose:function(t){let e=t.prototype;e.hideOverlappingLabels||(e.hideOverlappingLabels=h3,hQ(t,\"render\",h6))}},{defaultOptions:h4}=tm,{noop:h8}=k,{addEvent:h7,extend:lt,isObject:le,merge:li,relativeLength:ls}=$,lo={radius:0,scope:\"stack\",where:void 0},lr=h8,la=h8;function ln(t,e,i,s,o={}){let r=lr(t,e,i,s,o),{innerR:a=0,r:n=i,start:h=0,end:l=0}=o;if(o.open||!o.borderRadius)return r;let d=l-h,c=Math.sin(d/2),p=Math.max(Math.min(ls(o.borderRadius||0,n-a),(n-a)/2,n*c/(1+c)),0),g=Math.min(p,d/Math.PI*2*a),u=r.length-1;for(;u--;)!function(t,e,i){let s,o,r;let a=t[e],n=t[e+1];if(\"Z\"===n[0]&&(n=t[0]),(\"M\"===a[0]||\"L\"===a[0])&&\"A\"===n[0]?(s=a,o=n,r=!0):\"A\"===a[0]&&(\"M\"===n[0]||\"L\"===n[0])&&(s=n,o=a),s&&o&&o.params){let a=o[1],n=o[5],h=o.params,{start:l,end:d,cx:c,cy:p}=h,g=n?a-i:a+i,u=g?Math.asin(i/g):0,f=n?u:-u,m=Math.cos(u)*g;r?(h.start=l+f,s[1]=c+m*Math.cos(l),s[2]=p+m*Math.sin(l),t.splice(e+1,0,[\"A\",i,i,0,0,1,c+a*Math.cos(h.start),p+a*Math.sin(h.start)])):(h.end=d-f,o[6]=c+a*Math.cos(h.end),o[7]=p+a*Math.sin(h.end),t.splice(e+1,0,[\"A\",i,i,0,0,1,c+m*Math.cos(d),p+m*Math.sin(d)])),o[4]=Math.abs(h.end-h.start)1?g:p);return r}function lh(){if(this.options.borderRadius&&!(this.chart.is3d&&this.chart.is3d())){let{options:t,yAxis:e}=this,i=\"percent\"===t.stacking,s=h4.plotOptions?.[this.type]?.borderRadius,o=ll(t.borderRadius,le(s)?s:{}),r=e.options.reversed;for(let s of this.points){let{shapeArgs:a}=s;if(\"roundedRect\"===s.shapeType&&a){let{width:n=0,height:h=0,y:l=0}=a,d=l,c=h;if(\"stack\"===o.scope&&s.stackTotal){let o=e.translate(i?100:s.stackTotal,!1,!0,!1,!0),r=e.translate(t.threshold||0,!1,!0,!1,!0),a=this.crispCol(0,Math.min(o,r),0,Math.abs(o-r));d=a.y,c=a.height}let p=(s.negative?-1:1)*(r?-1:1)==-1,g=o.where;!g&&this.is(\"waterfall\")&&Math.abs((s.yBottom||0)-(this.translatedThreshold||0))>this.borderWidth&&(g=\"all\"),g||(g=\"end\");let u=Math.min(ls(o.radius,n),n/2,\"all\"===g?h/2:1/0)||0;\"end\"===g&&(p&&(d-=u),c+=u),lt(a,{brBoxHeight:c,brBoxY:d,r:u})}}}}function ll(t,e){return le(t)||(t={radius:t||0}),li(lo,e,t)}function ld(){let t=ll(this.options.borderRadius);for(let e of this.points){let i=e.shapeArgs;i&&(i.borderRadius=ls(t.radius,(i.r||0)-(i.innerR||0)))}}function lc(t,e,i,s,o={}){let r=la(t,e,i,s,o),{r:a=0,brBoxHeight:n=s,brBoxY:h=e}=o,l=e-h,d=h+n-(e+s),c=l-a>-.1?0:a,p=d-a>-.1?0:a,g=Math.max(c&&l,0),u=Math.max(p&&d,0),f=[t+c,e],m=[t+i-c,e],x=[t+i,e+c],y=[t+i,e+s-p],b=[t+i-p,e+s],v=[t+p,e+s],k=[t,e+s-p],w=[t,e+c],M=(t,e)=>Math.sqrt(Math.pow(t,2)-Math.pow(e,2));if(g){let t=M(c,c-g);f[0]-=t,m[0]+=t,x[1]=w[1]=e+c-g}if(s=lm(i.minWidth,0)&&this.chartHeight>=lm(i.minHeight,0)}).call(this)&&e.push(t._id)}function i(t,e){let i=this.options.responsive,s=this.currentResponsive,o=[],r;!e&&i&&i.rules&&i.rules.forEach(t=>{void 0===t._id&&(t._id=lx()),this.matchResponsiveRule(t,o)},this);let a=lf(...o.map(t=>lu((i||{}).rules||[],e=>e._id===t)).map(t=>t&&t.chartOptions));a.isResponsiveOptions=!0,o=o.toString()||void 0;let n=s&&s.ruleIds;o===n||(s&&(this.currentResponsive=void 0,this.updatingResponsive=!0,this.update(s.undoOptions,t,!0),this.updatingResponsive=!1),o?((r=lp(a,this.options,!0,this.collectionsWithUpdate)).isResponsiveOptions=!0,this.currentResponsive={ruleIds:o,mergedOptions:a,undoOptions:r},this.updatingResponsive||this.update(a,t,!0)):this.currentResponsive=void 0)}t.compose=function(t){let s=t.prototype;return s.matchResponsiveRule||lg(s,{matchResponsiveRule:e,setResponsive:i}),t}}(y||(y={}));let ly=y;k.AST=tK,k.Axis=sR,k.Chart=aG,k.Color=tk,k.DataLabel=hs,k.DataTableCore=re,k.Fx=tC,k.HTMLElement=iZ,k.Legend=ai,k.LegendSymbol=rr,k.OverlappingDataLabels=k.OverlappingDataLabels||h9,k.PlotLineOrBand=s4,k.Point=oF,k.Pointer=o9,k.RendererRegistry=er,k.Series=rY,k.SeriesRegistry=rd,k.StackItem=a8,k.SVGElement=ej,k.SVGRenderer=iR,k.Templating=eo,k.Tick=sa,k.Time=td,k.Tooltip=ok,k.animate=tR.animate,k.animObject=tR.animObject,k.chart=aG.chart,k.color=tk.parse,k.dateFormat=eo.dateFormat,k.defaultOptions=tm.defaultOptions,k.distribute=ed.distribute,k.format=eo.format,k.getDeferredAnimation=tR.getDeferredAnimation,k.getOptions=tm.getOptions,k.numberFormat=eo.numberFormat,k.seriesType=rd.seriesType,k.setAnimation=tR.setAnimation,k.setOptions=tm.setOptions,k.stop=tR.stop,k.time=tm.defaultTime,k.timers=tC.timers,({compose:function(t,e,i){let s=t.types.pie;if(!e.symbolCustomAttribs.includes(\"borderRadius\")){let o=i.prototype.symbols;h7(t,\"afterColumnTranslate\",lh,{order:9}),h7(s,\"afterTranslate\",ld),e.symbolCustomAttribs.push(\"borderRadius\",\"brBoxHeight\",\"brBoxY\"),lr=o.arc,la=o.roundedRect,o.arc=ln,o.roundedRect=lc}},optionsToObject:ll}).compose(k.Series,k.SVGElement,k.SVGRenderer),hl.compose(k.Series.types.column),hs.compose(k.Series),sG.compose(k.Axis),iZ.compose(k.SVGRenderer),ai.compose(k.Chart),s$.compose(k.Axis),h9.compose(k.Chart),hK.compose(k.Series.types.pie),s4.compose(k.Chart,k.Axis),o9.compose(k.Chart),ly.compose(k.Chart),a0.compose(k.Axis,k.Chart,k.Series),ny.compose(k.Axis,k.Chart,k.Series),ok.compose(k.Pointer),$.extend(k,$);let lb=k;return v.default})());", "!/**\n * Highcharts JS v12.1.2 (2024-12-21)\n * @module highcharts/modules/accessibility\n * @requires highcharts\n *\n * Accessibility module\n *\n * (c) 2010-2024 Highsoft AS\n * Author: Oystein Moseng\n *\n * License: www.highcharts.com/license\n */function(e,t){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=t(e._Highcharts,e._Highcharts.Templating,e._Highcharts.AST,e._Highcharts.Legend,e._Highcharts.Axis,e._Highcharts.Color,e._Highcharts.SeriesRegistry,e._Highcharts.RendererRegistry,e._Highcharts.SVGRenderer,e._Highcharts.Point,e._Highcharts.Series):\"function\"==typeof define&&define.amd?define(\"highcharts/modules/accessibility\",[\"highcharts/highcharts\"],function(e){return t(e,e.Templating,e.AST,e.Legend,e.Axis,e.Color,e.SeriesRegistry,e.RendererRegistry,e.SVGRenderer,e.Point,e.Series)}):\"object\"==typeof exports?exports[\"highcharts/modules/accessibility\"]=t(e._Highcharts,e._Highcharts.Templating,e._Highcharts.AST,e._Highcharts.Legend,e._Highcharts.Axis,e._Highcharts.Color,e._Highcharts.SeriesRegistry,e._Highcharts.RendererRegistry,e._Highcharts.SVGRenderer,e._Highcharts.Point,e._Highcharts.Series):e.Highcharts=t(e.Highcharts,e.Highcharts.Templating,e.Highcharts.AST,e.Highcharts.Legend,e.Highcharts.Axis,e.Highcharts.Color,e.Highcharts.SeriesRegistry,e.Highcharts.RendererRegistry,e.Highcharts.SVGRenderer,e.Highcharts.Point,e.Highcharts.Series)}(\"undefined\"==typeof window?this:window,(e,t,i,s,n,r,o,a,l,h,c)=>(()=>{\"use strict\";let d;var u,p,g,m,b={660:e=>{e.exports=i},532:e=>{e.exports=n},620:e=>{e.exports=r},632:e=>{e.exports=s},260:e=>{e.exports=h},608:e=>{e.exports=a},540:e=>{e.exports=l},820:e=>{e.exports=c},512:e=>{e.exports=o},984:e=>{e.exports=t},944:t=>{t.exports=e}},f={};function x(e){var t=f[e];if(void 0!==t)return t.exports;var i=f[e]={exports:{}};return b[e](i,i.exports,x),i.exports}x.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return x.d(t,{a:t}),t},x.d=(e,t)=>{for(var i in t)x.o(t,i)&&!x.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},x.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var y={};x.d(y,{default:()=>nx});var v=x(944),w=x.n(v);let{doc:E,win:A}=w(),{css:T}=w(),C=A.EventTarget&&new A.EventTarget||\"none\";function M(e){if(\"function\"==typeof A.MouseEvent)return new A.MouseEvent(e.type,e);if(E.createEvent){let t=E.createEvent(\"MouseEvent\");if(t.initMouseEvent)return t.initMouseEvent(e.type,e.bubbles,e.cancelable,e.view||A,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget),t}return k(e.type)}function k(e,t,i){let s=t||{x:0,y:0};if(\"function\"==typeof A.MouseEvent)return new A.MouseEvent(e,{bubbles:!0,cancelable:!0,composed:!0,button:0,buttons:1,relatedTarget:i||C,view:A,detail:\"click\"===e?1:0,screenX:s.x,screenY:s.y,clientX:s.x,clientY:s.y});if(E.createEvent){let t=E.createEvent(\"MouseEvent\");if(t.initMouseEvent)return t.initMouseEvent(e,!0,!0,A,\"click\"===e?1:0,s.x,s.y,s.x,s.y,!1,!1,!1,!1,0,null),t}return{type:e}}let S={addClass:function(e,t){e.classList?e.classList.add(t):0>e.className.indexOf(t)&&(e.className+=\" \"+t)},cloneMouseEvent:M,cloneTouchEvent:function(e){let t=e=>{let t=[];for(let i=0;i/g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\").replace(/\\//g,\"/\")},getElement:function(e){return E.getElementById(e)},getFakeMouseEvent:k,getHeadingTagNameForElement:function(e){let t=e=>\"h\"+Math.min(6,parseInt(e.slice(1),10)+1),i=e=>/^H[1-6]$/i.test(e),s=e=>{let t=e;for(;t=t.previousSibling;){let e=t.tagName||\"\";if(i(e))return e}return\"\"},n=e=>{let r=s(e);if(r)return t(r);let o=e.parentElement;if(!o)return\"h6\";let a=o.tagName;return i(a)?t(a):n(o)};return n(e)},removeChildNodes:function(e){for(;e.lastChild;)e.removeChild(e.lastChild)},removeClass:function(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(t,\"g\"),\"\")},removeElement:function(e){e&&e.parentNode&&e.parentNode.removeChild(e)},reverseChildNodes:function(e){let t=e.childNodes.length;for(;t--;)e.appendChild(e.childNodes[t])},simulatedEventTarget:C,stripHTMLTagsFromString:function(e,t=!1){return\"string\"==typeof e?t?e.replace(/<\\/?[^>]+(>|$)/g,\"\"):e.replace(/<\\/?(?!\\s)[^>]+(>|$)/g,\"\"):e},visuallyHideElement:function(e){T(e,{position:\"absolute\",width:\"1px\",height:\"1px\",overflow:\"hidden\",whiteSpace:\"nowrap\",clip:\"rect(1px, 1px, 1px, 1px)\",marginTop:\"-3px\",\"-ms-filter\":\"progid:DXImageTransform.Microsoft.Alpha(Opacity=1)\",filter:\"alpha(opacity=1)\",opacity:.01})}};var P=x(984),D=x.n(P);let{format:N}=D(),{getNestedProperty:B,pick:I}=w();!function(e){function t(e,t,i){let s=(e,t)=>{let i=e.slice(t||0),s=i.indexOf(\"{\"),n=i.indexOf(\"}\");if(s>-1&&n>s)return{statement:i.substring(s+1,n),begin:t+s+1,end:t+n}},n=[],r,o,a=0;do r=s(e,a),(o=e.substring(a,r&&r.begin-1)).length&&n.push({value:o,type:\"constant\"}),r&&n.push({value:r.statement,type:\"statement\"}),a=r?r.end+1:a+1;while(r);return n.forEach(e=>{\"statement\"===e.type&&(e.value=function(e,t){let i,s;let n=e.indexOf(\"#each(\"),r=e.indexOf(\"#plural(\"),o=e.indexOf(\"[\"),a=e.indexOf(\"]\");if(n>-1){let r=e.slice(n).indexOf(\")\")+n,o=e.substring(0,n),a=e.substring(r+1),l=e.substring(n+6,r).split(\",\"),h=Number(l[1]),c;if(s=\"\",i=B(l[0],t)){c=(h=isNaN(h)?i.length:h)<0?i.length+h:Math.min(h,i.length);for(let e=0;e-1){var l;let i=e.slice(r).indexOf(\")\")+r,n=e.substring(r+8,i).split(\",\");switch(Number(B(n[0],t))){case 0:s=I(n[4],n[1]);break;case 1:s=I(n[2],n[1]);break;case 2:s=I(n[3],n[1]);break;default:s=n[1]}return s?(l=s).trim&&l.trim()||l.replace(/^\\s+|\\s+$/g,\"\"):\"\"}if(o>-1){let s;let n=e.substring(0,o),r=Number(e.substring(o+1,a));return i=B(n,t),!isNaN(r)&&i&&(r<0?void 0===(s=i[i.length+r])&&(s=i[0]):void 0===(s=i[r])&&(s=i[i.length-1])),void 0!==s?s:\"\"}return\"{\"+e+\"}\"}(e.value,t))}),N(n.reduce((e,t)=>e+t.value,\"\"),t,i)}function i(e,i){let s=e.split(\".\"),n=this.options.lang,r=0;for(;r!!e.graphic);return t&&t.graphic&&t.graphic.element}}function G(e){let t=q(e);return t&&t.parentNode||e.graph&&e.graph.element||e.group&&e.group.element}let K={fireEventOnWrappedOrUnwrappedElement:function e(t,i){let s=i.type,n=t.hcEvents;O.createEvent&&(t.dispatchEvent||t.fireEvent)?t.dispatchEvent?t.dispatchEvent(i):t.fireEvent(s,i):n&&n[s]?z(t,s,i):t.element&&e(t.element,i)},getChartTitle:function(e){return R(e.options.title.text||e.langFormat(\"accessibility.defaultChartTitle\",{chart:e}),e.renderer.forExport)},getAxisDescription:function(e){return e&&(e.options.accessibility?.description||e.axisTitle?.textStr||e.options.id||e.categories&&\"categories\"||e.dateTime&&\"Time\"||\"values\")},getAxisRangeDescription:function(e){let t=e.options||{};return t.accessibility&&void 0!==t.accessibility.rangeDescription?t.accessibility.rangeDescription:e.categories?function(e){let t=e.chart;return e.dataMax&&e.dataMin?t.langFormat(\"accessibility.axis.rangeCategories\",{chart:t,axis:e,numCategories:e.dataMax-e.dataMin+1}):\"\"}(e):e.dateTime&&(0===e.min||0===e.dataMin)?function(e){let t=e.chart,i={},s=e.dataMin||e.min||0,n=e.dataMax||e.max||0,r=\"Seconds\";i.Seconds=(n-s)/1e3,i.Minutes=i.Seconds/60,i.Hours=i.Minutes/60,i.Days=i.Hours/24,[\"Minutes\",\"Hours\",\"Days\"].forEach(function(e){i[e]>2&&(r=e)});let o=i[r].toFixed(\"Seconds\"!==r&&\"Minutes\"!==r?1:0);return t.langFormat(\"accessibility.axis.timeRange\"+r,{chart:t,axis:e,range:o.replace(\".0\",\"\")})}(e):function(e){let t=e.chart,i=t.options,s=i&&i.accessibility&&i.accessibility.screenReaderSection.axisRangeDateFormat||\"\",n={min:e.dataMin||e.min||0,max:e.dataMax||e.max||0},r=function(i){return e.dateTime?t.time.dateFormat(s,n[i]):n[i].toString()};return t.langFormat(\"accessibility.axis.rangeFromTo\",{chart:t,axis:e,rangeFrom:r(\"min\"),rangeTo:r(\"max\")})}(e)},getPointFromXY:function(e,t,i){let s=e.length,n;for(;s--;)if(n=H(e[s].points||[],function(e){return e.x===t&&e.y===i}))return n},getSeriesFirstPointElement:q,getSeriesFromName:function(e,t){return t?(e.series||[]).filter(function(e){return e.name===t}):e.series},getSeriesA11yElement:G,unhideChartElementFromAT:function e(t,i){i.setAttribute(\"aria-hidden\",!1),i!==t.renderTo&&i.parentNode&&i.parentNode!==O.body&&(Array.prototype.forEach.call(i.parentNode.childNodes,function(e){e.hasAttribute(\"aria-hidden\")||e.setAttribute(\"aria-hidden\",!0)}),e(t,i.parentNode))},hideSeriesFromAT:function(e){let t=G(e);t&&t.setAttribute(\"aria-hidden\",!0)},scrollAxisToPoint:function(e){let t=e.series.xAxis,i=e.series.yAxis,s=t&&t.scrollbar?t:i,n=s&&s.scrollbar;if(n&&L(n.to)&&L(n.from)){let t=n.to-n.from,i=function(e,t){if(!L(e.dataMin)||!L(e.dataMax))return 0;let i=e.toPixels(e.dataMin),s=e.toPixels(e.dataMax),n=\"xAxis\"===e.coll?\"x\":\"y\";return(e.toPixels(t[n]||0)-i)/(s-i)}(s,e);n.updatePosition(i-t/2,i+t/2),z(n,\"changed\",{from:n.from,to:n.to,trigger:\"scrollbar\",DOMEvent:null})}}},{doc:U}=w(),{removeElement:V}=S,W=class{constructor(){this.elements=[]}createElement(){let e=U.createElement.apply(U,arguments);return this.elements.push(e),e}removeElement(e){V(e),this.elements.splice(this.elements.indexOf(e),1)}destroyCreatedElements(){this.elements.forEach(function(e){V(e)}),this.elements=[]}},{addEvent:X}=w(),Y=class{constructor(){this.eventRemovers=[]}addEvent(){let e=X.apply(w(),arguments);return this.eventRemovers.push({element:arguments[0],remover:e}),e}removeEvent(e){let t=this.eventRemovers.map(e=>e.remover).indexOf(e);this.eventRemovers[t].remover(),this.eventRemovers.splice(t,1)}removeAddedEvents(){this.eventRemovers.map(e=>e.remover).forEach(e=>e()),this.eventRemovers=[]}},{fireEventOnWrappedOrUnwrappedElement:j}=K,{getFakeMouseEvent:_}=S,Z=class{destroy(){}getKeyboardNavigation(){return[]}init(){}onChartRender(){}onChartUpdate(){}initBase(e,t){this.chart=e,this.eventProvider=new Y,this.domElementProvider=new W,this.proxyProvider=t,this.keyCodes={left:37,right:39,up:38,down:40,enter:13,space:32,esc:27,tab:9,pageUp:33,pageDown:34,end:35,home:36}}addEvent(e,t,i,s){return this.eventProvider.addEvent(e,t,i,s)}createElement(e,t){return this.domElementProvider.createElement(e,t)}fakeClickEvent(e){j(e,_(\"click\"))}destroyBase(){this.domElementProvider.destroyCreatedElements(),this.eventProvider.removeAddedEvents()}},{find:$}=w(),Q=class{constructor(e,t){this.chart=e,this.keyCodeMap=t.keyCodeMap||[],this.validate=t.validate,this.init=t.init,this.terminate=t.terminate,this.response={success:1,prev:2,next:3,noHandler:4,fail:5}}run(e){let t=e.which||e.keyCode,i=this.response.noHandler,s=$(this.keyCodeMap,function(e){return e[0].indexOf(t)>-1});return s?i=s[1].call(this,t,e):9===t&&(i=this.response[e.shiftKey?\"prev\":\"next\"]),i}},{unhideChartElementFromAT:J,getChartTitle:ee}=K,{doc:et}=w(),{stripHTMLTagsFromString:ei}=S,es=class extends Z{onChartUpdate(){this.handleSVGTitleElement(),this.setSVGContainerLabel(),this.setGraphicContainerAttrs(),this.setRenderToAttrs(),this.makeCreditsAccessible()}handleSVGTitleElement(){let e=this.chart,t=\"highcharts-title-\"+e.index,i=ei(e.langFormat(\"accessibility.svgContainerTitle\",{chartTitle:ee(e)}));if(i.length){let s=this.svgTitleElement=this.svgTitleElement||et.createElementNS(\"http://www.w3.org/2000/svg\",\"title\");s.textContent=i,s.id=t,e.renderTo.insertBefore(s,e.renderTo.firstChild)}}setSVGContainerLabel(){let e=this.chart,t=e.langFormat(\"accessibility.svgContainerLabel\",{chartTitle:ee(e)});e.renderer.box&&t.length&&e.renderer.box.setAttribute(\"aria-label\",t)}setGraphicContainerAttrs(){let e=this.chart,t=e.langFormat(\"accessibility.graphicContainerLabel\",{chartTitle:ee(e)});t.length&&e.container.setAttribute(\"aria-label\",t)}setRenderToAttrs(){let e=this.chart,t=\"disabled\"!==e.options.accessibility.landmarkVerbosity,i=e.langFormat(\"accessibility.chartContainerLabel\",{title:ee(e),chart:e});i&&(e.renderTo.setAttribute(\"role\",t?\"region\":\"group\"),e.renderTo.setAttribute(\"aria-label\",i))}makeCreditsAccessible(){let e=this.chart,t=e.credits;t&&(t.textStr&&t.element.setAttribute(\"aria-label\",e.langFormat(\"accessibility.credits\",{creditsStr:ei(t.textStr,e.renderer.forExport)})),J(e,t.element))}getKeyboardNavigation(){let e=this.chart;return new Q(e,{keyCodeMap:[],validate:function(){return!0},init:function(){let t=e.accessibility;t&&t.keyboardNavigation.tabindexContainer.focus()}})}destroy(){this.chart.renderTo.setAttribute(\"aria-hidden\",!0)}},{addEvent:en,pick:er}=w();!function(e){let t=[\"x\",\"y\",\"transform\",\"width\",\"height\",\"r\",\"d\",\"stroke-width\"];function i(){let e=this.focusElement,t=this.options.accessibility.keyboardNavigation.focusBorder;e&&(e.removeFocusBorder(),t.enabled&&e.addFocusBorder(t.margin,{stroke:t.style.color,strokeWidth:t.style.lineWidth,r:t.style.borderRadius}))}function s(e,t){let i=this.options.accessibility.keyboardNavigation.focusBorder,s=t||e.element;s&&s.focus&&(s.hcEvents&&s.hcEvents.focusin||en(s,\"focusin\",function(){}),s.focus(),i.hideBrowserFocusOutline&&(s.style.outline=\"none\")),this.focusElement&&this.focusElement.removeFocusBorder(),this.focusElement=e,this.renderFocusBorder()}function n(e,i){this.focusBorder&&this.removeFocusBorder();let s=this.getBBox(),n=er(e,3),r=this.parentGroup,o=this.scaleX||r&&r.scaleX,a=this.scaleY||r&&r.scaleY,l=(o?!a:a)?Math.abs(o||a||1):(Math.abs(o||1)+Math.abs(a||1))/2,h=this.renderer.fontMetrics(this).h;s.x+=this.translateX?this.translateX:0,s.y+=this.translateY?this.translateY:0;let c=s.x-n,d=s.y-n,u=s.width+2*n,p=s.height+2*n,g=!!this.text;if(\"text\"===this.element.nodeName||g){let e,t;let i=!!this.rotation,r=g?{x:i?1:0,y:0}:(e=0,t=0,\"middle\"===this.attr(\"text-anchor\")?e=t=.5:this.rotation?e=.25:t=.75,{x:e,y:t}),o=+this.attr(\"x\"),a=+this.attr(\"y\");if(isNaN(o)||(c=o-s.width*r.x-n),isNaN(a)||(d=a-(\"start\"===this.attr(\"text-anchor\")?h:s.height)*r.y-n),g&&i){let e=u;u=p,p=e,isNaN(o)||(c=o-s.height*r.x-n),isNaN(a)||(d=a-s.width*r.y-n)}}this.focusBorder=this.renderer.rect(c,d,u,p,parseInt((i&&i.r||0).toString(),10)/l).addClass(\"highcharts-focus-border\").attr({zIndex:99}).add(r),this.renderer.styledMode||this.focusBorder.attr({stroke:i&&i.stroke,\"stroke-width\":(i&&i.strokeWidth||0)/l}),function(e,...i){e.focusBorderUpdateHooks||(e.focusBorderUpdateHooks={},t.forEach(t=>{let s=t+\"Setter\",n=e[s]||e._defaultSetter;e.focusBorderUpdateHooks[s]=n,e[s]=function(){let t=n.apply(e,arguments);return e.addFocusBorder.apply(e,i),t}}))}(this,e,i),function(e){if(e.focusBorderDestroyHook)return;let t=e.destroy;e.destroy=function(){return e.focusBorder&&e.focusBorder.destroy&&e.focusBorder.destroy(),t.apply(e,arguments)},e.focusBorderDestroyHook=t}(this)}function r(){var e;e=this,e.focusBorderUpdateHooks&&(Object.keys(e.focusBorderUpdateHooks).forEach(t=>{let i=e.focusBorderUpdateHooks[t];i===e._defaultSetter?delete e[t]:e[t]=i}),delete e.focusBorderUpdateHooks),this.focusBorderDestroyHook&&(this.destroy=this.focusBorderDestroyHook,delete this.focusBorderDestroyHook),this.focusBorder&&(this.focusBorder.destroy(),delete this.focusBorder)}e.compose=function(e,t){let o=e.prototype,a=t.prototype;o.renderFocusBorder||(o.renderFocusBorder=i,o.setFocusToElement=s),a.addFocusBorder||(a.addFocusBorder=n,a.removeFocusBorder=r)}}(p||(p={}));let eo=p;var ea=x(660),el=x.n(ea);let{doc:eh}=w(),{addClass:ec,visuallyHideElement:ed}=S,{attr:eu}=w(),ep=class{constructor(e,t){this.chart=e,this.domElementProvider=new W,this.announceRegion=this.addAnnounceRegion(t)}destroy(){this.domElementProvider.destroyCreatedElements()}announce(e){el().setElementHTML(this.announceRegion,e),this.clearAnnouncementRegionTimer&&clearTimeout(this.clearAnnouncementRegionTimer),this.clearAnnouncementRegionTimer=setTimeout(()=>{this.announceRegion.innerHTML=el().emptyHTML,delete this.clearAnnouncementRegionTimer},3e3)}addAnnounceRegion(e){let t=this.chart.announcerContainer||this.createAnnouncerContainer(),i=this.domElementProvider.createElement(\"div\");return eu(i,{\"aria-hidden\":!1,\"aria-live\":e,\"aria-atomic\":!0}),this.chart.styledMode?ec(i,\"highcharts-visually-hidden\"):ed(i),t.appendChild(i),i}createAnnouncerContainer(){let e=this.chart,t=eh.createElement(\"div\");return eu(t,{\"aria-hidden\":!1,class:\"highcharts-announcer-container\"}),t.style.position=\"relative\",e.renderTo.insertBefore(t,e.renderTo.firstChild),e.announcerContainer=t,t}},{escapeStringForHTML:eg,stripHTMLTagsFromString:em}=S;function eb(e){return(e.annotations||[]).reduce((e,t)=>(t.options&&!1!==t.options.visible&&(e=e.concat(t.labels)),e),[])}function ef(e){return e.options&&e.options.accessibility&&e.options.accessibility.description||e.graphic&&e.graphic.text&&e.graphic.text.textStr||\"\"}function ex(e){let t=e.options&&e.options.accessibility&&e.options.accessibility.description;if(t)return t;let i=e.chart,s=ef(e),n=e.points,r=e=>e.graphic&&e.graphic.element&&e.graphic.element.getAttribute(\"aria-label\")||\"\",o=n.filter(e=>!!e.graphic).map(e=>{let t=e.accessibility&&e.accessibility.valueDescription||r(e),i=e&&e.series.name||\"\";return(i?i+\", \":\"\")+\"data point \"+t}).filter(e=>!!e),a=o.length,l=a>1?\"MultiplePoints\":a?\"SinglePoint\":\"NoPoints\",h={annotationText:s,annotation:e,numPoints:a,annotationPoint:o[0],additionalAnnotationPoints:o.slice(1)};return i.langFormat(\"accessibility.screenReaderSection.annotations.description\"+l,h)}function ey(e){return eb(e).map(t=>{let i=eg(em(ex(t),e.renderer.forExport));return i?`
  • ${i}
  • `:\"\"})}let ev={getAnnotationsInfoHTML:function(e){let t=e.annotations;if(!(t&&t.length))return\"\";let i=ey(e);return`
      ${i.join(\" \")}
    `},getAnnotationLabelDescription:ex,getAnnotationListItems:ey,getPointAnnotationTexts:function(e){let t=eb(e.series.chart).filter(t=>t.points.indexOf(e)>-1);return t.length?t.map(e=>`${ef(e)}`):[]}},{getAnnotationsInfoHTML:ew}=ev,{getAxisDescription:eE,getAxisRangeDescription:eA,getChartTitle:eT,unhideChartElementFromAT:eC}=K,{format:eM}=D(),{doc:ek}=w(),{addClass:eS,getElement:eP,getHeadingTagNameForElement:eD,stripHTMLTagsFromString:eN,visuallyHideElement:eB}=S,{attr:eI,pick:eF,replaceNested:eO}=w();function eR(e){return eO(e,[/<([\\w\\-.:!]+)\\b[^<>]*>\\s*<\\/\\1>/g,\"\"])}let eL=class extends Z{constructor(){super(...arguments),this.screenReaderSections={}}init(){let e=this.chart,t=this;this.initRegionsDefinitions(),this.addEvent(e,\"aftergetTableAST\",function(e){t.onDataTableCreated(e)}),this.addEvent(e,\"afterViewData\",function(e){e.wasHidden&&(t.dataTableDiv=e.element,setTimeout(function(){t.focusDataTable()},300))}),this.addEvent(e,\"afterHideData\",function(){t.viewDataTableButton&&t.viewDataTableButton.setAttribute(\"aria-expanded\",\"false\")}),e.exporting&&this.addEvent(e,\"afterPrint\",function(){t.updateAllScreenReaderSections()}),this.announcer=new ep(e,\"assertive\")}initRegionsDefinitions(){let e=this,t=this.chart.options.accessibility;this.screenReaderSections={before:{element:null,buildContent:function(i){let s=t.screenReaderSection.beforeChartFormatter;return s?s(i):e.defaultBeforeChartFormatter(i)},insertIntoDOM:function(e,t){t.renderTo.insertBefore(e,t.renderTo.firstChild)},afterInserted:function(){void 0!==e.sonifyButtonId&&e.initSonifyButton(e.sonifyButtonId),void 0!==e.dataTableButtonId&&e.initDataTableButton(e.dataTableButtonId)}},after:{element:null,buildContent:function(i){let s=t.screenReaderSection.afterChartFormatter;return s?s(i):e.defaultAfterChartFormatter()},insertIntoDOM:function(e,t){t.renderTo.insertBefore(e,t.container.nextSibling)},afterInserted:function(){e.chart.accessibility&&t.keyboardNavigation.enabled&&e.chart.accessibility.keyboardNavigation.updateExitAnchor()}}}}onChartRender(){this.linkedDescriptionElement=this.getLinkedDescriptionElement(),this.setLinkedDescriptionAttrs(),this.updateAllScreenReaderSections()}updateAllScreenReaderSections(){let e=this;Object.keys(this.screenReaderSections).forEach(function(t){e.updateScreenReaderSection(t)})}getLinkedDescriptionElement(){let e=this.chart.options.accessibility.linkedDescription;if(!e)return;if(\"string\"!=typeof e)return e;let t=eM(e,this.chart),i=ek.querySelectorAll(t);if(1===i.length)return i[0]}setLinkedDescriptionAttrs(){let e=this.linkedDescriptionElement;e&&(e.setAttribute(\"aria-hidden\",\"true\"),eS(e,\"highcharts-linked-description\"))}updateScreenReaderSection(e){let t=this.chart,i=this.screenReaderSections[e],s=i.buildContent(t),n=i.element=i.element||this.createElement(\"div\"),r=n.firstChild||this.createElement(\"div\");s?(this.setScreenReaderSectionAttribs(n,e),el().setElementHTML(r,s),n.appendChild(r),i.insertIntoDOM(n,t),t.styledMode?eS(r,\"highcharts-visually-hidden\"):eB(r),eC(t,r),i.afterInserted&&i.afterInserted()):(n.parentNode&&n.parentNode.removeChild(n),i.element=null)}setScreenReaderSectionAttribs(e,t){let i=this.chart,s=i.langFormat(\"accessibility.screenReaderSection.\"+t+\"RegionLabel\",{chart:i,chartTitle:eT(i)});eI(e,{id:`highcharts-screen-reader-region-${t}-${i.index}`,\"aria-label\":s||void 0}),e.style.position=\"relative\",s&&e.setAttribute(\"role\",\"all\"===i.options.accessibility.landmarkVerbosity?\"region\":\"group\")}defaultBeforeChartFormatter(){let e=this.chart,t=e.options.accessibility.screenReaderSection.beforeChartFormat;if(!t)return\"\";let i=this.getAxesDescription(),s=e.sonify&&e.options.sonification&&e.options.sonification.enabled,n=\"highcharts-a11y-sonify-data-btn-\"+e.index,r=\"hc-linkto-highcharts-data-table-\"+e.index,o=ew(e),a=e.langFormat(\"accessibility.screenReaderSection.annotations.heading\",{chart:e}),l={headingTagName:eD(e.renderTo),chartTitle:eT(e),typeDescription:this.getTypeDescriptionText(),chartSubtitle:this.getSubtitleText(),chartLongdesc:this.getLongdescText(),xAxisDescription:i.xAxis,yAxisDescription:i.yAxis,playAsSoundButton:s?this.getSonifyButtonText(n):\"\",viewTableButton:e.getCSV?this.getDataTableButtonText(r):\"\",annotationsTitle:o?a:\"\",annotationsList:o},h=F.i18nFormat(t,l,e);return this.dataTableButtonId=r,this.sonifyButtonId=n,eR(h)}defaultAfterChartFormatter(){let e=this.chart,t=e.options.accessibility.screenReaderSection.afterChartFormat;if(!t)return\"\";let i={endOfChartMarker:this.getEndOfChartMarkerText()};return eR(F.i18nFormat(t,i,e))}getLinkedDescription(){let e=this.linkedDescriptionElement;return eN(e&&e.innerHTML||\"\",this.chart.renderer.forExport)}getLongdescText(){let e=this.chart.options,t=e.caption,i=t&&t.text,s=this.getLinkedDescription();return e.accessibility.description||s||i||\"\"}getTypeDescriptionText(){let e=this.chart;return e.types?e.options.accessibility.typeDescription||function(e,t){let i=t[0],s=e.series&&e.series[0]||{},n=e.mapView&&e.mapView.geoMap&&e.mapView.geoMap.title,r={numSeries:e.series.length,numPoints:s.points&&s.points.length,chart:e,mapTitle:n};return i?\"map\"===i||\"tiledwebmap\"===i?r.mapTitle?e.langFormat(\"accessibility.chartTypes.mapTypeDescription\",r):e.langFormat(\"accessibility.chartTypes.unknownMap\",r):e.types.length>1?e.langFormat(\"accessibility.chartTypes.combinationChart\",r):function(e,t,i){let s=t[0],n=e.langFormat(\"accessibility.seriesTypeDescriptions.\"+s,i),r=e.series&&e.series.length<2?\"Single\":\"Multiple\";return(e.langFormat(\"accessibility.chartTypes.\"+s+r,i)||e.langFormat(\"accessibility.chartTypes.default\"+r,i))+(n?\" \"+n:\"\")}(e,t,r):e.langFormat(\"accessibility.chartTypes.emptyChart\",r)}(e,e.types):\"\"}getDataTableButtonText(e){let t=this.chart;return'\"}getSonifyButtonText(e){let t=this.chart;return t.options.sonification&&!1===t.options.sonification.enabled?\"\":'\"}getSubtitleText(){let e=this.chart.options.subtitle;return eN(e&&e.text||\"\",this.chart.renderer.forExport)}getEndOfChartMarkerText(){let e=eP(`highcharts-end-of-chart-marker-${this.chart.index}`);if(e)return e.outerHTML;let t=this.chart,i=t.langFormat(\"accessibility.screenReaderSection.endOfChartMarker\",{chart:t});return'
    '+i+\"
    \"}onDataTableCreated(e){let t=this.chart;if(t.options.accessibility.enabled){this.viewDataTableButton&&this.viewDataTableButton.setAttribute(\"aria-expanded\",\"true\");let i=e.tree.attributes||{};i.tabindex=-1,i.summary=t.langFormat(\"accessibility.table.tableSummary\",{chart:t}),e.tree.attributes=i}}focusDataTable(){let e=this.dataTableDiv,t=e&&e.getElementsByTagName(\"table\")[0];t&&t.focus&&t.focus()}initSonifyButton(e){let t=this.sonifyButton=eP(e),i=this.chart,s=e=>{t&&(t.setAttribute(\"aria-hidden\",\"true\"),t.setAttribute(\"aria-label\",\"\")),e.preventDefault(),e.stopPropagation();let s=i.langFormat(\"accessibility.sonification.playAsSoundClickAnnouncement\",{chart:i});this.announcer.announce(s),setTimeout(()=>{t&&(t.removeAttribute(\"aria-hidden\"),t.removeAttribute(\"aria-label\")),i.sonify&&i.sonify()},1e3)};t&&i&&(t.setAttribute(\"tabindex\",-1),t.onclick=function(e){(i.options.accessibility&&i.options.accessibility.screenReaderSection.onPlayAsSoundClick||s).call(this,e,i)})}initDataTableButton(e){let t=this.viewDataTableButton=eP(e),i=this.chart,s=e.replace(\"hc-linkto-\",\"\");t&&(eI(t,{tabindex:-1,\"aria-expanded\":!!eP(s)}),t.onclick=i.options.accessibility.screenReaderSection.onViewDataTableClick||function(){i.viewData()})}getAxesDescription(){let e=this.chart,t=function(t,i){let s=e[t];return s.length>1||s[0]&&eF(s[0].options.accessibility&&s[0].options.accessibility.enabled,i)},i=!!e.types&&0>e.types.indexOf(\"map\")&&0>e.types.indexOf(\"treemap\")&&0>e.types.indexOf(\"tilemap\"),s=!!e.hasCartesianSeries,n=t(\"xAxis\",!e.angular&&s&&i),r=t(\"yAxis\",s&&i),o={};return n&&(o.xAxis=this.getAxisDescriptionText(\"xAxis\")),r&&(o.yAxis=this.getAxisDescriptionText(\"yAxis\")),o}getAxisDescriptionText(e){let t=this.chart,i=t[e];return t.langFormat(\"accessibility.axis.\"+e+\"Description\"+(i.length>1?\"Plural\":\"Singular\"),{chart:t,names:i.map(function(e){return eE(e)}),ranges:i.map(function(e){return eA(e)}),numAxes:i.length})}destroy(){this.announcer&&this.announcer.destroy()}},{attr:eH}=w(),{getChartTitle:ez,unhideChartElementFromAT:eq}=K,{getFakeMouseEvent:eG}=S;function eK(e){return e.exportSVGElements&&e.exportSVGElements[0]}class eU extends Z{init(){let e=this.chart,t=this;this.addEvent(e,\"exportMenuShown\",function(){t.onMenuShown()}),this.addEvent(e,\"exportMenuHidden\",function(){t.onMenuHidden()}),this.createProxyGroup()}onMenuHidden(){let e=this.chart.exportContextMenu;e&&e.setAttribute(\"aria-hidden\",\"true\"),this.setExportButtonExpandedState(\"false\")}onMenuShown(){let e=this.chart,t=e.exportContextMenu;t&&(this.addAccessibleContextMenuAttribs(),eq(e,t)),this.setExportButtonExpandedState(\"true\")}setExportButtonExpandedState(e){this.exportButtonProxy&&this.exportButtonProxy.innerElement.setAttribute(\"aria-expanded\",e)}onChartRender(){let e=this.chart,t=e.focusElement,i=e.accessibility;this.proxyProvider.clearGroup(\"chartMenu\"),this.proxyMenuButton(),this.exportButtonProxy&&t&&t===e.exportingGroup&&(t.focusBorder?e.setFocusToElement(t,this.exportButtonProxy.innerElement):i&&i.keyboardNavigation.tabindexContainer.focus())}proxyMenuButton(){let e=this.chart,t=this.proxyProvider,i=eK(e);(function(e){let t=e.options.exporting,i=eK(e);return!!(t&&!1!==t.enabled&&t.accessibility&&t.accessibility.enabled&&i&&i.element)})(e)&&i&&(this.exportButtonProxy=t.addProxyElement(\"chartMenu\",{click:i},\"button\",{\"aria-label\":e.langFormat(\"accessibility.exporting.menuButtonLabel\",{chart:e,chartTitle:ez(e)}),\"aria-expanded\":!1,title:e.options.lang.contextButtonTitle||null}))}createProxyGroup(){this.chart&&this.proxyProvider&&this.proxyProvider.addGroup(\"chartMenu\")}addAccessibleContextMenuAttribs(){let e=this.chart,t=e.exportDivElements;if(t&&t.length){t.forEach(e=>{e&&(\"LI\"!==e.tagName||e.children&&e.children.length?e.setAttribute(\"aria-hidden\",\"true\"):e.setAttribute(\"tabindex\",-1))});let i=t[0]&&t[0].parentNode;i&&eH(i,{\"aria-hidden\":void 0,\"aria-label\":e.langFormat(\"accessibility.exporting.chartMenuLabel\",{chart:e}),role:\"list\"})}}getKeyboardNavigation(){let e=this.keyCodes,t=this.chart,i=this;return new Q(t,{keyCodeMap:[[[e.left,e.up],function(){return i.onKbdPrevious(this)}],[[e.right,e.down],function(){return i.onKbdNext(this)}],[[e.enter,e.space],function(){return i.onKbdClick(this)}]],validate:function(){return!!t.exporting&&!1!==t.options.exporting.enabled&&!1!==t.options.exporting.accessibility.enabled},init:function(){let e=i.exportButtonProxy,s=i.chart.exportingGroup;e&&s&&t.setFocusToElement(s,e.innerElement)},terminate:function(){t.hideExportMenu()}})}onKbdPrevious(e){let t=this.chart,i=t.options.accessibility,s=e.response,n=t.highlightedExportItemIx||0;for(;n--;)if(t.highlightExportItem(n))return s.success;return i.keyboardNavigation.wrapAround?(t.highlightLastExportItem(),s.success):s.prev}onKbdNext(e){let t=this.chart,i=t.options.accessibility,s=e.response;for(let e=(t.highlightedExportItemIx||0)+1;e{e&&\"highcharts-menu-item\"===e.className&&e.onmouseout&&e.onmouseout(eG(\"mouseout\"))}),this.highlightedExportItemIx=0,this.exportContextMenu.hideMenu(),this.container.focus())}function s(e){let t=this.exportDivElements&&this.exportDivElements[e],i=this.exportDivElements&&this.exportDivElements[this.highlightedExportItemIx];if(t&&\"LI\"===t.tagName&&!(t.children&&t.children.length)){let s=!!(this.renderTo.getElementsByTagName(\"g\")[0]||{}).focus;return t.focus&&s&&t.focus(),i&&i.onmouseout&&i.onmouseout(eG(\"mouseout\")),t.onmouseover&&t.onmouseover(eG(\"mouseover\")),this.highlightedExportItemIx=e,!0}return!1}function n(){if(this.exportDivElements){let e=this.exportDivElements.length;for(;e--;)if(this.highlightExportItem(e))return!0}return!1}e.compose=function(e){let r=e.prototype;r.hideExportMenu||(r.hideExportMenu=i,r.highlightExportItem=s,r.highlightLastExportItem=n,r.showExportMenu=t)}}(eU||(eU={}));let eV=eU,{doc:eW,win:eX}=w(),{addEvent:eY,defined:ej,fireEvent:e_}=w(),{getElement:eZ,simulatedEventTarget:e$}=S;class eQ{constructor(e,t){this.currentModuleIx=NaN,this.modules=[],this.init(e,t)}init(e,t){let i=this.eventProvider=new Y;this.chart=e,this.components=t,this.modules=[],this.currentModuleIx=0,this.update(),i.addEvent(this.tabindexContainer,\"keydown\",e=>this.onKeydown(e)),i.addEvent(this.tabindexContainer,\"focus\",e=>this.onFocus(e)),[\"mouseup\",\"touchend\"].forEach(e=>i.addEvent(eW,e,e=>this.onMouseUp(e))),[\"mousedown\",\"touchstart\"].forEach(t=>i.addEvent(e.renderTo,t,()=>{this.isClickingChart=!0}))}update(e){let t=this.chart.options.accessibility,i=t&&t.keyboardNavigation,s=this.components;this.updateContainerTabindex(),i&&i.enabled&&e&&e.length?(this.modules=e.reduce(function(e,t){let i=s[t].getKeyboardNavigation();return e.concat(i)},[]),this.updateExitAnchor()):(this.modules=[],this.currentModuleIx=0,this.removeExitAnchor())}updateExitAnchor(){let e=eZ(`highcharts-end-of-chart-marker-${this.chart.index}`);this.removeExitAnchor(),e?(this.makeElementAnExitAnchor(e),this.exitAnchor=e):this.createExitAnchor()}move(e){let t=this.modules&&this.modules[this.currentModuleIx];t&&t.terminate&&t.terminate(e),this.chart.focusElement&&this.chart.focusElement.removeFocusBorder(),this.currentModuleIx+=e;let i=this.modules&&this.modules[this.currentModuleIx];if(i){if(i.validate&&!i.validate())return this.move(e);if(i.init)return i.init(e),!0}return this.currentModuleIx=0,this.exiting=!0,e>0?this.exitAnchor&&this.exitAnchor.focus():this.tabindexContainer.focus(),!1}onFocus(e){let t=this.chart,i=e.relatedTarget&&t.container.contains(e.relatedTarget),s=t.options.accessibility,n=s&&s.keyboardNavigation;if(n&&n.enabled&&!this.exiting&&!this.tabbingInBackwards&&!this.isClickingChart&&!i){let e=this.getFirstValidModuleIx();null!==e&&(this.currentModuleIx=e,this.modules[e].init(1))}this.keyboardReset=!1,this.exiting=!1}onMouseUp(e){if(delete this.isClickingChart,!this.keyboardReset&&e.relatedTarget!==e$){let t=this.chart;if(!e.target||!t.container.contains(e.target)){let e=this.modules&&this.modules[this.currentModuleIx||0];e&&e.terminate&&e.terminate(),this.currentModuleIx=0}t.focusElement&&(t.focusElement.removeFocusBorder(),delete t.focusElement),this.keyboardReset=!0}}onKeydown(e){let t;let i=e||eX.event,s=this.modules&&this.modules.length&&this.modules[this.currentModuleIx],n=i.target;if((!n||\"INPUT\"!==n.nodeName||n.classList.contains(\"highcharts-a11y-proxy-element\"))&&(this.keyboardReset=!1,this.exiting=!1,s)){let e=s.run(i);e===s.response.success?t=!0:e===s.response.prev?t=this.move(-1):e===s.response.next&&(t=this.move(1)),t&&(i.preventDefault(),i.stopPropagation())}}updateContainerTabindex(){let e;let t=this.chart.options.accessibility,i=t&&t.keyboardNavigation,s=!(i&&!1===i.enabled),n=this.chart,r=n.container;n.renderTo.hasAttribute(\"tabindex\")?(r.removeAttribute(\"tabindex\"),e=n.renderTo):e=r,this.tabindexContainer=e;let o=e.getAttribute(\"tabindex\");s&&!o?e.setAttribute(\"tabindex\",\"0\"):s||n.container.removeAttribute(\"tabindex\")}createExitAnchor(){let e=this.chart,t=this.exitAnchor=eW.createElement(\"div\");e.renderTo.appendChild(t),this.makeElementAnExitAnchor(t)}makeElementAnExitAnchor(e){let t=this.tabindexContainer.getAttribute(\"tabindex\")||0;e.setAttribute(\"class\",\"highcharts-exit-anchor\"),e.setAttribute(\"tabindex\",t),e.setAttribute(\"aria-hidden\",!1),this.addExitAnchorEventsToEl(e)}removeExitAnchor(){if(this.exitAnchor){let e=this.eventProvider.eventRemovers.find(e=>e.element===this.exitAnchor);e&&ej(e.remover)&&this.eventProvider.removeEvent(e.remover),this.exitAnchor.parentNode&&this.exitAnchor.parentNode.removeChild(this.exitAnchor),delete this.exitAnchor}}addExitAnchorEventsToEl(e){let t=this.chart,i=this;this.eventProvider.addEvent(e,\"focus\",function(e){let s=e||eX.event,n=!(s.relatedTarget&&t.container.contains(s.relatedTarget)||i.exiting);if(t.focusElement&&delete t.focusElement,n){if(i.tabbingInBackwards=!0,i.tabindexContainer.focus(),delete i.tabbingInBackwards,s.preventDefault(),i.modules&&i.modules.length){i.currentModuleIx=i.modules.length-1;let e=i.modules[i.currentModuleIx];e&&e.validate&&!e.validate()?i.move(-1):e&&e.init(-1)}}else i.exiting=!1})}getFirstValidModuleIx(){let e=this.modules.length;for(let t=0;t{e&&e.dismissPopupContent&&e.dismissPopupContent()})}e.compose=function(e){eV.compose(e);let s=e.prototype;return s.dismissPopupContent||(s.dismissPopupContent=t,eY(eW,\"keydown\",i)),e}}(eQ||(eQ={}));let eJ=eQ;var e0=x(632),e1=x.n(e0);let{animObject:e2}=w(),{doc:e3}=w(),{addEvent:e5,fireEvent:e4,isNumber:e6,pick:e9,syncTimeout:e8}=w(),{getChartTitle:e7}=K,{stripHTMLTagsFromString:te,addClass:tt,removeClass:ti}=S;function ts(e){let t=e.legend&&e.legend.allItems,i=e.options.legend.accessibility||{},s=e.colorAxis&&e.colorAxis.some(e=>!e.dataClasses||!e.dataClasses.length);return!!(t&&t.length&&!s&&!1!==i.enabled)}function tn(e,t){let i=t.legendItem||{};for(let s of(t.setState(e?\"hover\":\"\",!0),[\"group\",\"label\",\"symbol\"])){let t=i[s],n=t&&t.element||t;n&&e4(n,e?\"mouseover\":\"mouseout\")}}class tr extends Z{constructor(){super(...arguments),this.highlightedLegendItemIx=NaN,this.proxyGroup=null}init(){let e=this;this.recreateProxies(),this.addEvent(e1(),\"afterScroll\",function(){this.chart===e.chart&&(e.proxyProvider.updateGroupProxyElementPositions(\"legend\"),e.updateLegendItemProxyVisibility(),e.highlightedLegendItemIx>-1&&this.chart.highlightLegendItem(e.highlightedLegendItemIx))}),this.addEvent(e1(),\"afterPositionItem\",function(t){this.chart===e.chart&&this.chart.renderer&&e.updateProxyPositionForItem(t.item)}),this.addEvent(e1(),\"afterRender\",function(){this.chart===e.chart&&this.chart.renderer&&e.recreateProxies()&&e8(()=>e.proxyProvider.updateGroupProxyElementPositions(\"legend\"),e2(e9(this.chart.renderer.globalAnimation,!0)).duration)})}updateLegendItemProxyVisibility(){let e;let t=this.chart,i=t.legend,s=i.allItems||[],n=i.currentPage||1,r=i.clipHeight||0;s.forEach(s=>{if(s.a11yProxyElement){let o=i.pages&&i.pages.length,a=s.a11yProxyElement.element,l=!1;if(e=s.legendItem||{},o){let t=e.pageIx||0;l=(e.y||0)+(e.label?Math.round(e.label.getBBox().height):0)-i.pages[t]>r||t!==n-1}l?t.styledMode?tt(a,\"highcharts-a11y-invisible\"):a.style.visibility=\"hidden\":(ti(a,\"highcharts-a11y-invisible\"),a.style.visibility=\"\")}})}onChartRender(){ts(this.chart)||this.removeProxies()}highlightAdjacentLegendPage(e){let t=this.chart,i=t.legend,s=(i.currentPage||1)+e,n=i.pages||[];if(s>0&&s<=n.length){let e=0;for(let n of i.allItems)((n.legendItem||{}).pageIx||0)+1===s&&t.highlightLegendItem(e)&&(this.highlightedLegendItemIx=e),++e}}updateProxyPositionForItem(e){e.a11yProxyElement&&e.a11yProxyElement.refreshPosition()}recreateProxies(){let e=e3.activeElement,t=this.proxyGroup,i=e&&t&&t.contains(e);return this.removeProxies(),!!ts(this.chart)&&(this.addLegendProxyGroup(),this.proxyLegendItems(),this.updateLegendItemProxyVisibility(),this.updateLegendTitle(),i&&this.chart.highlightLegendItem(this.highlightedLegendItemIx),!0)}removeProxies(){this.proxyProvider.removeGroup(\"legend\")}updateLegendTitle(){let e=this.chart,t=te((e.legend&&e.legend.options.title&&e.legend.options.title.text||\"\").replace(/
    /g,\" \"),e.renderer.forExport),i=e.langFormat(\"accessibility.legend.legendLabel\"+(t?\"\":\"NoTitle\"),{chart:e,legendTitle:t,chartTitle:e7(e)});this.proxyProvider.updateGroupAttrs(\"legend\",{\"aria-label\":i})}addLegendProxyGroup(){let e=\"all\"===this.chart.options.accessibility.landmarkVerbosity?\"region\":null;this.proxyGroup=this.proxyProvider.addGroup(\"legend\",\"ul\",{\"aria-label\":\"_placeholder_\",role:e})}proxyLegendItems(){let e;let t=this;((this.chart.legend||{}).allItems||[]).forEach(i=>{(e=i.legendItem||{}).label&&e.label.element&&t.proxyLegendItem(i)})}proxyLegendItem(e){let t=e.legendItem||{};if(!t.label||!t.group)return;let i=this.chart.langFormat(\"accessibility.legend.legendItem\",{chart:this.chart,itemName:te(e.name,this.chart.renderer.forExport),item:e}),s={tabindex:-1,\"aria-pressed\":e.visible,\"aria-label\":i},n=t.group.div?t.label:t.group;e.a11yProxyElement=this.proxyProvider.addProxyElement(\"legend\",{click:t.label,visual:n.element},\"button\",s)}getKeyboardNavigation(){let e=this.keyCodes,t=this,i=this.chart;return new Q(i,{keyCodeMap:[[[e.left,e.right,e.up,e.down],function(e){return t.onKbdArrowKey(this,e)}],[[e.enter,e.space],function(){return t.onKbdClick(this)}],[[e.pageDown,e.pageUp],function(i){let s=i===e.pageDown?1:-1;return t.highlightAdjacentLegendPage(s),this.response.success}]],validate:function(){return t.shouldHaveLegendNavigation()},init:function(){i.highlightLegendItem(0),t.highlightedLegendItemIx=0},terminate:function(){t.highlightedLegendItemIx=-1,i.legend.allItems.forEach(e=>tn(!1,e))}})}onKbdArrowKey(e,t){let{keyCodes:{left:i,up:s},highlightedLegendItemIx:n,chart:r}=this,o=r.legend.allItems.length,a=r.options.accessibility.keyboardNavigation.wrapAround,l=t===i||t===s?-1:1;return r.highlightLegendItem(n+l)?this.highlightedLegendItemIx+=l:a&&o>1&&(this.highlightedLegendItemIx=l>0?0:o-1,r.highlightLegendItem(this.highlightedLegendItemIx)),e.response.success}onKbdClick(e){let t=this.chart.legend.allItems[this.highlightedLegendItemIx];return t&&t.a11yProxyElement&&t.a11yProxyElement.click(),e.response.success}shouldHaveLegendNavigation(){if(!ts(this.chart))return!1;let e=this.chart,t=(e.options.legend||{}).accessibility||{};return!!(e.legend.display&&t.keyboardNavigation&&t.keyboardNavigation.enabled)}destroy(){this.removeProxies()}}!function(e){function t(e){let t=this.legend.allItems,i=this.accessibility&&this.accessibility.components.legend.highlightedLegendItemIx,s=t[e],n=s?.legendItem||{};if(s){e6(i)&&t[i]&&tn(!1,t[i]),function(e,t){let i=(e.allItems[t].legendItem||{}).pageIx,s=e.currentPage;void 0!==i&&i+1!==s&&e.scroll(1+i-s)}(this.legend,e);let r=n.label,o=s.a11yProxyElement&&s.a11yProxyElement.innerElement;return r&&r.element&&o&&this.setFocusToElement(r,o),tn(!0,s),!0}return!1}function i(e){let t=this.chart.options.accessibility,i=e.item;t.enabled&&i&&i.a11yProxyElement&&i.a11yProxyElement.innerElement.setAttribute(\"aria-pressed\",e.visible?\"true\":\"false\")}e.compose=function(e,s){let n=e.prototype;n.highlightLegendItem||(n.highlightLegendItem=t,e5(s,\"afterColorizeItem\",i))}}(tr||(tr={}));let to=tr;var ta=x(532),tl=x.n(ta);let{isTouchDevice:th}=w(),{addEvent:tc,merge:td,pick:tu}=w(),tp=[];function tg(){this.navigator&&this.navigator.setBaseSeries(null,!1)}function tm(){let e,t,i;let s=this.legend,n=this.navigator;if(n){e=s&&s.options,t=n.xAxis,i=n.yAxis;let{scrollbarHeight:r,scrollButtonSize:o}=n;this.inverted?(n.left=n.opposite?this.chartWidth-r-n.height:this.spacing[3]+r,n.top=this.plotTop+o):(n.left=tu(t.left,this.plotLeft+o),n.top=n.navigatorOptions.top||this.chartHeight-n.height-r-(this.scrollbar?.options.margin||0)-this.spacing[2]-(this.rangeSelector&&this.extraBottomMargin?this.rangeSelector.getHeight():0)-(e&&\"bottom\"===e.verticalAlign&&\"proximate\"!==e.layout&&e.enabled&&!e.floating?s.legendHeight+tu(e.margin,10):0)-(this.titleOffset?this.titleOffset[2]:0)),t&&i&&(this.inverted?t.options.left=i.options.left=n.left:t.options.top=i.options.top=n.top,t.setAxisSize(),i.setAxisSize())}}function tb(e){!this.navigator&&!this.scroller&&(this.options.navigator.enabled||this.options.scrollbar.enabled)&&(this.scroller=this.navigator=new d(this),tu(e.redraw,!0)&&this.redraw(e.animation))}function tf(){let e=this.options;(e.navigator.enabled||e.scrollbar.enabled)&&(this.scroller=this.navigator=new d(this))}function tx(){let e=this.options,t=e.navigator,i=e.rangeSelector;if((t&&t.enabled||i&&i.enabled)&&(!th&&\"x\"===this.zooming.type||th&&\"x\"===this.zooming.pinchType))return!1}function ty(e){let t=e.navigator;if(t&&e.xAxis[0]){let i=e.xAxis[0].getExtremes();t.render(i.min,i.max)}}function tv(e){let t=e.options.navigator||{},i=e.options.scrollbar||{};!this.navigator&&!this.scroller&&(t.enabled||i.enabled)&&(td(!0,this.options.navigator,t),td(!0,this.options.scrollbar,i),delete e.options.navigator,delete e.options.scrollbar)}let tw={compose:function(e,t){if(w().pushUnique(tp,e)){let i=e.prototype;d=t,i.callbacks.push(ty),tc(e,\"afterAddSeries\",tg),tc(e,\"afterSetChartSize\",tm),tc(e,\"afterUpdate\",tb),tc(e,\"beforeRender\",tf),tc(e,\"beforeShowResetZoom\",tx),tc(e,\"update\",tv)}}},{isTouchDevice:tE}=w(),{addEvent:tA,correctFloat:tT,defined:tC,isNumber:tM,pick:tk}=w();function tS(){this.navigatorAxis||(this.navigatorAxis=new tD(this))}function tP(e){let t;let i=this.chart,s=i.options,n=s.navigator,r=this.navigatorAxis,o=i.zooming.pinchType,a=s.rangeSelector,l=i.zooming.type;if(this.isXAxis&&(n?.enabled||a?.enabled)){if(\"y\"===l&&\"zoom\"===e.trigger)t=!1;else if((\"zoom\"===e.trigger&&\"xy\"===l||tE&&\"xy\"===o)&&this.options.range){let t=r.previousZoom;tC(e.min)?r.previousZoom=[this.min,this.max]:t&&(e.min=t[0],e.max=t[1],r.previousZoom=void 0)}}void 0!==t&&e.preventDefault()}class tD{static compose(e){e.keepProps.includes(\"navigatorAxis\")||(e.keepProps.push(\"navigatorAxis\"),tA(e,\"init\",tS),tA(e,\"setExtremes\",tP))}constructor(e){this.axis=e}destroy(){this.axis=void 0}toFixedRange(e,t,i,s){let n=this.axis,r=(n.pointRange||0)/2,o=tk(i,n.translate(e,!0,!n.horiz)),a=tk(s,n.translate(t,!0,!n.horiz));return tC(i)||(o=tT(o+r)),tC(s)||(a=tT(a-r)),tM(o)&&tM(a)||(o=a=void 0),{min:o,max:a}}}var tN=x(620),tB=x.n(tN),tI=x(512),tF=x.n(tI);let{parse:tO}=tB(),{seriesTypes:tR}=tF(),tL={height:40,margin:25,maskInside:!0,handles:{width:7,borderRadius:0,height:15,symbols:[\"navigator-handle\",\"navigator-handle\"],enabled:!0,lineWidth:1,backgroundColor:\"#f2f2f2\",borderColor:\"#999999\"},maskFill:tO(\"#667aff\").setOpacity(.3).get(),outlineColor:\"#999999\",outlineWidth:1,series:{type:void 0===tR.areaspline?\"line\":\"areaspline\",fillOpacity:.05,lineWidth:1,compare:null,sonification:{enabled:!1},dataGrouping:{approximation:\"average\",enabled:!0,groupPixelWidth:2,firstAnchor:\"firstPoint\",anchor:\"middle\",lastAnchor:\"lastPoint\",units:[[\"millisecond\",[1,2,5,10,20,25,50,100,200,500]],[\"second\",[1,2,5,10,15,30]],[\"minute\",[1,2,5,10,15,30]],[\"hour\",[1,2,3,4,6,8,12]],[\"day\",[1,2,3,4]],[\"week\",[1,2,3]],[\"month\",[1,3,6]],[\"year\",null]]},dataLabels:{enabled:!1,zIndex:2},id:\"highcharts-navigator-series\",className:\"highcharts-navigator-series\",lineColor:null,marker:{enabled:!1},threshold:null},xAxis:{className:\"highcharts-navigator-xaxis\",tickLength:0,lineWidth:0,gridLineColor:\"#e6e6e6\",id:\"navigator-x-axis\",gridLineWidth:1,tickPixelInterval:200,labels:{align:\"left\",style:{color:\"#000000\",fontSize:\"0.7em\",opacity:.6,textOutline:\"2px contrast\"},x:3,y:-4},crosshair:!1},yAxis:{className:\"highcharts-navigator-yaxis\",gridLineWidth:0,startOnTick:!1,endOnTick:!1,minPadding:.1,id:\"navigator-y-axis\",maxPadding:.1,labels:{enabled:!1},crosshair:!1,title:{text:null},tickLength:0,tickWidth:0}},{defined:tH,isNumber:tz,pick:tq}=w(),tG={rect:function(e,t,i,s,n){return n&&n.r?function(e,t,i,s,n){let r=n?.r||0;return[[\"M\",e+r,t],[\"L\",e+i-r,t],[\"A\",r,r,0,0,1,e+i,t+r],[\"L\",e+i,t+s-r],[\"A\",r,r,0,0,1,e+i-r,t+s],[\"L\",e+r,t+s],[\"A\",r,r,0,0,1,e,t+s-r],[\"L\",e,t+r],[\"A\",r,r,0,0,1,e+r,t],[\"Z\"]]}(e,t,i,s,n):[[\"M\",e,t],[\"L\",e+i,t],[\"L\",e+i,t+s],[\"L\",e,t+s],[\"Z\"]]}},{relativeLength:tK}=w(),tU={\"navigator-handle\":function(e,t,i,s,n={}){let r=n.width?n.width/2:i,o=tK(n.borderRadius||0,Math.min(2*r,s));return[[\"M\",-1.5,(s=n.height||s)/2-3.5],[\"L\",-1.5,s/2+4.5],[\"M\",.5,s/2-3.5],[\"L\",.5,s/2+4.5],...tG.rect(-r-1,.5,2*r+1,s,{r:o})]}};var tV=x(608),tW=x.n(tV);let{defined:tX}=w(),{setOptions:tY}=w(),{composed:tj}=w(),{getRendererType:t_}=tW(),{setFixedRange:tZ}={setFixedRange:function(e){let t=this.xAxis[0];tX(t.dataMax)&&tX(t.dataMin)&&e?this.fixedRange=Math.min(e,t.dataMax-t.dataMin):this.fixedRange=e}},{addEvent:t$,extend:tQ,pushUnique:tJ}=w();function t0(){this.chart.navigator&&!this.options.isInternal&&this.chart.navigator.setBaseSeries(null,!1)}let t1={compose:function(e,t,i){tD.compose(t),tJ(tj,\"Navigator\")&&(e.prototype.setFixedRange=tZ,tQ(t_().prototype.symbols,tU),t$(i,\"afterUpdate\",t0),tY({navigator:tL}))}},{composed:t2}=w(),{addEvent:t3,defined:t5,pick:t4,pushUnique:t6}=w();!function(e){let t;function i(e){let t=t4(e.options&&e.options.min,e.min),i=t4(e.options&&e.options.max,e.max);return{axisMin:t,axisMax:i,scrollMin:t5(e.dataMin)?Math.min(t,e.min,e.dataMin,t4(e.threshold,1/0)):t,scrollMax:t5(e.dataMax)?Math.max(i,e.max,e.dataMax,t4(e.threshold,-1/0)):i}}function s(){let e=this.scrollbar,t=e&&!e.options.opposite,i=this.horiz?2:t?3:1;e&&(this.chart.scrollbarsOffsets=[0,0],this.chart.axisOffset[i]+=e.size+(e.options.margin||0))}function n(){let e=this;e.options&&e.options.scrollbar&&e.options.scrollbar.enabled&&(e.options.scrollbar.vertical=!e.horiz,e.options.startOnTick=e.options.endOnTick=!1,e.scrollbar=new t(e.chart.renderer,e.options.scrollbar,e.chart),t3(e.scrollbar,\"changed\",function(t){let s,n;let{axisMin:r,axisMax:o,scrollMin:a,scrollMax:l}=i(e),h=l-a;if(t5(r)&&t5(o)){if(e.horiz&&!e.reversed||!e.horiz&&e.reversed?(s=a+h*this.to,n=a+h*this.from):(s=a+h*(1-this.from),n=a+h*(1-this.to)),this.shouldUpdateExtremes(t.DOMType)){let i=\"mousemove\"!==t.DOMType&&\"touchmove\"!==t.DOMType&&void 0;e.setExtremes(n,s,!0,i,t)}else this.setRange(this.from,this.to)}}))}function r(){let e,t,s;let{scrollMin:n,scrollMax:r}=i(this),o=this.scrollbar,a=this.axisTitleMargin+(this.titleOffset||0),l=this.chart.scrollbarsOffsets,h=this.options.margin||0;if(o&&l){if(this.horiz)this.opposite||(l[1]+=a),o.position(this.left,this.top+this.height+2+l[1]-(this.opposite?h:0),this.width,this.height),this.opposite||(l[1]+=h),e=1;else{let t;this.opposite&&(l[0]+=a),t=o.options.opposite?this.left+this.width+2+l[0]-(this.opposite?0:h):this.opposite?0:h,o.position(t,this.top,this.width,this.height),this.opposite&&(l[0]+=h),e=0}if(l[e]+=o.size+(o.options.margin||0),isNaN(n)||isNaN(r)||!t5(this.min)||!t5(this.max)||this.dataMin===this.dataMax)o.setRange(0,1);else if(this.min===this.max){let e=this.pointRange/(this.dataMax+1);t=e*this.min,s=e*(this.max+1),o.setRange(t,s)}else t=(this.min-n)/(r-n),s=(this.max-n)/(r-n),this.horiz&&!this.reversed||!this.horiz&&this.reversed?o.setRange(t,s):o.setRange(1-s,1-t)}}e.compose=function(e,i){t6(t2,\"Axis.Scrollbar\")&&(t=i,t3(e,\"afterGetOffset\",s),t3(e,\"afterInit\",n),t3(e,\"afterRender\",r))}}(g||(g={}));let t9=g,t8={height:10,barBorderRadius:5,buttonBorderRadius:0,buttonsEnabled:!1,liveRedraw:void 0,margin:void 0,minWidth:6,opposite:!0,step:.2,zIndex:3,barBackgroundColor:\"#cccccc\",barBorderWidth:0,barBorderColor:\"#cccccc\",buttonArrowColor:\"#333333\",buttonBackgroundColor:\"#e6e6e6\",buttonBorderColor:\"#cccccc\",buttonBorderWidth:1,rifleColor:\"none\",trackBackgroundColor:\"rgba(255, 255, 255, 0.001)\",trackBorderColor:\"#cccccc\",trackBorderRadius:5,trackBorderWidth:1},{defaultOptions:t7}=w(),{addEvent:ie,correctFloat:it,crisp:ii,defined:is,destroyObjectProperties:ir,fireEvent:io,merge:ia,pick:il,removeEvent:ih}=w();class ic{static compose(e){t9.compose(e,ic)}static swapXY(e,t){return t&&e.forEach(e=>{let t;let i=e.length;for(let s=0;sthis.calculatedWidth?t.minWidth:0;return{chartX:(e.chartX-this.x-this.xOffset)/(this.barWidth-i),chartY:(e.chartY-this.y-this.yOffset)/(this.barWidth-i)}}destroy(){let e=this,t=e.chart.scroller;e.removeEvents(),[\"track\",\"scrollbarRifles\",\"scrollbar\",\"scrollbarGroup\",\"group\"].forEach(function(t){e[t]&&e[t].destroy&&(e[t]=e[t].destroy())}),t&&e===t.scrollbar&&(t.scrollbar=null,ir(t.scrollbarButtons))}drawScrollbarButton(e){let t=this.renderer,i=this.scrollbarButtons,s=this.options,n=this.size,r=t.g().add(this.group);if(i.push(r),s.buttonsEnabled){let o=t.rect().addClass(\"highcharts-scrollbar-button\").add(r);this.chart.styledMode||o.attr({stroke:s.buttonBorderColor,\"stroke-width\":s.buttonBorderWidth,fill:s.buttonBackgroundColor}),o.attr(o.crisp({x:-.5,y:-.5,width:n,height:n,r:s.buttonBorderRadius},o.strokeWidth()));let a=t.path(ic.swapXY([[\"M\",n/2+(e?-1:1),n/2-3],[\"L\",n/2+(e?-1:1),n/2+3],[\"L\",n/2+(e?2:-2),n/2]],s.vertical)).addClass(\"highcharts-scrollbar-arrow\").add(i[e]);this.chart.styledMode||a.attr({fill:s.buttonArrowColor})}}init(e,t,i){this.scrollbarButtons=[],this.renderer=e,this.userOptions=t,this.options=ia(t8,t7.scrollbar,t),this.options.margin=il(this.options.margin,10),this.chart=i,this.size=il(this.options.size,this.options.height),t.enabled&&(this.render(),this.addEvents())}mouseDownHandler(e){let t=this.chart.pointer?.normalize(e)||e,i=this.cursorToScrollbarPosition(t);this.chartX=i.chartX,this.chartY=i.chartY,this.initPositions=[this.from,this.to],this.grabbedCenter=!0}mouseMoveHandler(e){let t;let i=this.chart.pointer?.normalize(e)||e,s=this.options.vertical?\"chartY\":\"chartX\",n=this.initPositions||[];this.grabbedCenter&&(!e.touches||0!==e.touches[0][s])&&(t=this.cursorToScrollbarPosition(i)[s]-this[s],this.hasDragged=!0,this.updatePosition(n[0]+t,n[1]+t),this.hasDragged&&io(this,\"changed\",{from:this.from,to:this.to,trigger:\"scrollbar\",DOMType:e.type,DOMEvent:e}))}mouseUpHandler(e){this.hasDragged&&io(this,\"changed\",{from:this.from,to:this.to,trigger:\"scrollbar\",DOMType:e.type,DOMEvent:e}),this.grabbedCenter=this.hasDragged=this.chartX=this.chartY=null}position(e,t,i,s){let{buttonsEnabled:n,margin:r=0,vertical:o}=this.options,a=this.rendered?\"animate\":\"attr\",l=s,h=0;this.group.show(),this.x=e,this.y=t+this.trackBorderWidth,this.width=i,this.height=s,this.xOffset=l,this.yOffset=h,o?(this.width=this.yOffset=i=h=this.size,this.xOffset=l=0,this.yOffset=h=n?this.size:0,this.barWidth=s-(n?2*i:0),this.x=e+=r):(this.height=s=this.size,this.xOffset=l=n?this.size:0,this.barWidth=i-(n?2*s:0),this.y=this.y+r),this.group[a]({translateX:e,translateY:this.y}),this.track[a]({width:i,height:s}),this.scrollbarButtons[1][a]({translateX:o?0:i-l,translateY:o?s-h:0})}removeEvents(){this._events.forEach(function(e){ih.apply(null,e)}),this._events.length=0}render(){let e=this.renderer,t=this.options,i=this.size,s=this.chart.styledMode,n=e.g(\"scrollbar\").attr({zIndex:t.zIndex}).hide().add();this.group=n,this.track=e.rect().addClass(\"highcharts-scrollbar-track\").attr({r:t.trackBorderRadius||0,height:i,width:i}).add(n),s||this.track.attr({fill:t.trackBackgroundColor,stroke:t.trackBorderColor,\"stroke-width\":t.trackBorderWidth});let r=this.trackBorderWidth=this.track.strokeWidth();this.track.attr({x:-ii(0,r),y:-ii(0,r)}),this.scrollbarGroup=e.g().add(n),this.scrollbar=e.rect().addClass(\"highcharts-scrollbar-thumb\").attr({height:i-r,width:i-r,r:t.barBorderRadius||0}).add(this.scrollbarGroup),this.scrollbarRifles=e.path(ic.swapXY([[\"M\",-3,i/4],[\"L\",-3,2*i/3],[\"M\",0,i/4],[\"L\",0,2*i/3],[\"M\",3,i/4],[\"L\",3,2*i/3]],t.vertical)).addClass(\"highcharts-scrollbar-rifles\").add(this.scrollbarGroup),s||(this.scrollbar.attr({fill:t.barBackgroundColor,stroke:t.barBorderColor,\"stroke-width\":t.barBorderWidth}),this.scrollbarRifles.attr({stroke:t.rifleColor,\"stroke-width\":1})),this.scrollbarStrokeWidth=this.scrollbar.strokeWidth(),this.scrollbarGroup.translate(-ii(0,this.scrollbarStrokeWidth),-ii(0,this.scrollbarStrokeWidth)),this.drawScrollbarButton(0),this.drawScrollbarButton(1)}setRange(e,t){let i,s;let n=this.options,r=n.vertical,o=n.minWidth,a=this.barWidth,l=!this.rendered||this.hasDragged||this.chart.navigator&&this.chart.navigator.hasDragged?\"attr\":\"animate\";if(!is(a))return;let h=a*Math.min(t,1);i=Math.ceil(a*(e=Math.max(e,0))),this.calculatedWidth=s=it(h-i),s=1?this.group.hide():this.group.show()),this.rendered=!0}shouldUpdateExtremes(e){return il(this.options.liveRedraw,w().svg&&!w().isTouchDevice&&!this.chart.boosted)||\"mouseup\"===e||\"touchend\"===e||!is(e)}trackClick(e){let t=this.chart.pointer?.normalize(e)||e,i=this.to-this.from,s=this.y+this.scrollbarTop,n=this.x+this.scrollbarLeft;this.options.vertical&&t.chartY>s||!this.options.vertical&&t.chartX>n?this.updatePosition(this.from+i,this.to+i):this.updatePosition(this.from-i,this.to-i),io(this,\"changed\",{from:this.from,to:this.to,trigger:\"scrollbar\",DOMEvent:e})}update(e){this.destroy(),this.init(this.chart.renderer,ia(!0,this.options,e),this.chart)}updatePosition(e,t){t>1&&(e=it(1-it(t-e)),t=1),e<0&&(t=it(t-e),e=0),this.from=e,this.to=t}}ic.defaultOptions=t8,t7.scrollbar=ia(!0,ic.defaultOptions,t7.scrollbar);var id=x(540),iu=x.n(id);let{defaultOptions:ip}=w(),{isTouchDevice:ig}=w(),{prototype:{symbols:im}}=iu(),{addEvent:ib,clamp:ix,correctFloat:iy,defined:iv,destroyObjectProperties:iw,erase:iE,extend:iA,find:iT,fireEvent:iC,isArray:iM,isNumber:ik,merge:iS,pick:iP,removeEvent:iD,splat:iN}=w();function iB(e,...t){let i=[].filter.call(t,ik);if(i.length)return Math[e].apply(0,i)}class iI{static compose(e,t,i){tw.compose(e,iI),t1.compose(e,t,i)}constructor(e){this.isDirty=!1,this.scrollbarHeight=0,this.init(e)}drawHandle(e,t,i,s){let n=this.navigatorOptions.handles.height;this.handles[t][s](i?{translateX:Math.round(this.left+this.height/2),translateY:Math.round(this.top+parseInt(e,10)+.5-n)}:{translateX:Math.round(this.left+parseInt(e,10)),translateY:Math.round(this.top+this.height/2-n/2-1)})}drawOutline(e,t,i,s){let n=this.navigatorOptions.maskInside,r=this.outline.strokeWidth(),o=r/2,a=r%2/2,l=this.scrollButtonSize,h=this.size,c=this.top,d=this.height,u=c-o,p=c+d,g=this.left,m,b;i?(m=c+t+a,t=c+e+a,b=[[\"M\",g+d,c-l-a],[\"L\",g+d,m],[\"L\",g,m],[\"M\",g,t],[\"L\",g+d,t],[\"L\",g+d,c+h+l]],n&&b.push([\"M\",g+d,m-o],[\"L\",g+d,t+o])):(g-=l,e+=g+l-a,t+=g+l-a,b=[[\"M\",g,u],[\"L\",e,u],[\"L\",e,p],[\"M\",t,p],[\"L\",t,u],[\"L\",g+h+2*l,u]],n&&b.push([\"M\",e-o,u],[\"L\",t+o,u])),this.outline[s]({d:b})}drawMasks(e,t,i,s){let n,r,o,a;let l=this.left,h=this.top,c=this.height;i?(o=[l,l,l],a=[h,h+e,h+t],r=[c,c,c],n=[e,t-e,this.size-t]):(o=[l,l+e,l+t],a=[h,h,h],r=[e,t-e,this.size-t],n=[c,c,c]),this.shades.forEach((e,t)=>{e[s]({x:o[t],y:a[t],width:r[t],height:n[t]})})}renderElements(){let e=this,t=e.navigatorOptions,i=t.maskInside,s=e.chart,n=s.inverted,r=s.renderer,o={cursor:n?\"ns-resize\":\"ew-resize\"},a=e.navigatorGroup??(e.navigatorGroup=r.g(\"navigator\").attr({zIndex:8,visibility:\"hidden\"}).add());if([!i,i,!i].forEach((i,n)=>{let l=e.shades[n]??(e.shades[n]=r.rect().addClass(\"highcharts-navigator-mask\"+(1===n?\"-inside\":\"-outside\")).add(a));s.styledMode||(l.attr({fill:i?t.maskFill:\"rgba(0,0,0,0)\"}),1===n&&l.css(o))}),e.outline||(e.outline=r.path().addClass(\"highcharts-navigator-outline\").add(a)),s.styledMode||e.outline.attr({\"stroke-width\":t.outlineWidth,stroke:t.outlineColor}),t.handles?.enabled){let i=t.handles,{height:n,width:l}=i;[0,1].forEach(t=>{let h=i.symbols[t];if(e.handles[t]&&e.handles[t].symbolUrl===h){if(!e.handles[t].isImg&&e.handles[t].symbolName!==h){let i=im[h].call(im,-l/2-1,0,l,n);e.handles[t].attr({d:i}),e.handles[t].symbolName=h}}else e.handles[t]?.destroy(),e.handles[t]=r.symbol(h,-l/2-1,0,l,n,i),e.handles[t].attr({zIndex:7-t}).addClass(\"highcharts-navigator-handle highcharts-navigator-handle-\"+[\"left\",\"right\"][t]).add(a),e.addMouseEvents();s.inverted&&e.handles[t].attr({rotation:90,rotationOriginX:Math.floor(-l/2),rotationOriginY:(n+l)/2}),s.styledMode||e.handles[t].attr({fill:i.backgroundColor,stroke:i.borderColor,\"stroke-width\":i.lineWidth,width:i.width,height:i.height,x:-l/2-1,y:0}).css(o)})}}update(e,t=!1){let i=this.chart,s=i.options.chart.inverted!==i.scrollbar?.options.vertical;if(iS(!0,i.options.navigator,e),this.navigatorOptions=i.options.navigator||{},this.setOpposite(),iv(e.enabled)||s)return this.destroy(),this.navigatorEnabled=e.enabled||this.navigatorEnabled,this.init(i);if(this.navigatorEnabled&&(this.isDirty=!0,!1===e.adaptToUpdatedData&&this.baseSeries.forEach(e=>{iD(e,\"updatedData\",this.updatedDataHandler)},this),e.adaptToUpdatedData&&this.baseSeries.forEach(e=>{e.eventsToUnbind.push(ib(e,\"updatedData\",this.updatedDataHandler))},this),(e.series||e.baseSeries)&&this.setBaseSeries(void 0,!1),e.height||e.xAxis||e.yAxis)){this.height=e.height??this.height;let t=this.getXAxisOffsets();this.xAxis.update({...e.xAxis,offsets:t,[i.inverted?\"width\":\"height\"]:this.height,[i.inverted?\"height\":\"width\"]:void 0},!1),this.yAxis.update({...e.yAxis,[i.inverted?\"width\":\"height\"]:this.height},!1)}t&&i.redraw()}render(e,t,i,s){let n=this.chart,r=this.xAxis,o=r.pointRange||0,a=r.navigatorAxis.fake?n.xAxis[0]:r,l=this.navigatorEnabled,h=this.rendered,c=n.inverted,d=n.xAxis[0].minRange,u=n.xAxis[0].options.maxRange,p=this.scrollButtonSize,g,m,b,f=this.scrollbarHeight,x,y;if(this.hasDragged&&!iv(i))return;if(this.isDirty&&this.renderElements(),e=iy(e-o/2),t=iy(t+o/2),!ik(e)||!ik(t)){if(!h)return;i=0,s=iP(r.width,a.width)}this.left=iP(r.left,n.plotLeft+p+(c?n.plotWidth:0));let v=this.size=x=iP(r.len,(c?n.plotHeight:n.plotWidth)-2*p);g=c?f:x+2*p,i=iP(i,r.toPixels(e,!0)),s=iP(s,r.toPixels(t,!0)),ik(i)&&Math.abs(i)!==1/0||(i=0,s=g);let w=r.toValue(i,!0),E=r.toValue(s,!0),A=Math.abs(iy(E-w));Au&&(this.grabbedLeft?i=r.toPixels(E-u-o,!0):this.grabbedRight&&(s=r.toPixels(w+u+o,!0))),this.zoomedMax=ix(Math.max(i,s),0,v),this.zoomedMin=ix(this.fixedWidth?this.zoomedMax-this.fixedWidth:Math.min(i,s),0,v),this.range=this.zoomedMax-this.zoomedMin,v=Math.round(this.zoomedMax);let T=Math.round(this.zoomedMin);l&&(this.navigatorGroup.attr({visibility:\"inherit\"}),y=h&&!this.hasDragged?\"animate\":\"attr\",this.drawMasks(T,v,c,y),this.drawOutline(T,v,c,y),this.navigatorOptions.handles.enabled&&(this.drawHandle(T,0,c,y),this.drawHandle(v,1,c,y))),this.scrollbar&&(c?(b=this.top-p,m=this.left-f+(l||!a.opposite?0:(a.titleOffset||0)+a.axisTitleMargin),f=x+2*p):(b=this.top+(l?this.height:-f),m=this.left-p),this.scrollbar.position(m,b,g,f),this.scrollbar.setRange(this.zoomedMin/(x||1),this.zoomedMax/(x||1))),this.rendered=!0,this.isDirty=!1,iC(this,\"afterRender\")}addMouseEvents(){let e=this,t=e.chart,i=t.container,s=[],n,r;e.mouseMoveHandler=n=function(t){e.onMouseMove(t)},e.mouseUpHandler=r=function(t){e.onMouseUp(t)},(s=e.getPartsEvents(\"mousedown\")).push(ib(t.renderTo,\"mousemove\",n),ib(i.ownerDocument,\"mouseup\",r),ib(t.renderTo,\"touchmove\",n),ib(i.ownerDocument,\"touchend\",r)),s.concat(e.getPartsEvents(\"touchstart\")),e.eventsToUnbind=s,e.series&&e.series[0]&&s.push(ib(e.series[0].xAxis,\"foundExtremes\",function(){t.navigator.modifyNavigatorAxisExtremes()}))}getPartsEvents(e){let t=this,i=[];return[\"shades\",\"handles\"].forEach(function(s){t[s].forEach(function(n,r){i.push(ib(n.element,e,function(e){t[s+\"Mousedown\"](e,r)}))})}),i}shadesMousedown(e,t){e=this.chart.pointer?.normalize(e)||e;let i=this.chart,s=this.xAxis,n=this.zoomedMin,r=this.size,o=this.range,a=this.left,l=e.chartX,h,c,d,u;i.inverted&&(l=e.chartY,a=this.top),1===t?(this.grabbedCenter=l,this.fixedWidth=o,this.dragOffset=l-n):(u=l-a-o/2,0===t?u=Math.max(0,u):2===t&&u+o>=r&&(u=r-o,this.reversedExtremes?(u-=o,c=this.getUnionExtremes().dataMin):h=this.getUnionExtremes().dataMax),u!==n&&(this.fixedWidth=o,iv((d=s.navigatorAxis.toFixedRange(u,u+o,c,h)).min)&&iC(this,\"setRange\",{min:Math.min(d.min,d.max),max:Math.max(d.min,d.max),redraw:!0,eventArguments:{trigger:\"navigator\"}})))}handlesMousedown(e,t){e=this.chart.pointer?.normalize(e)||e;let i=this.chart,s=i.xAxis[0],n=this.reversedExtremes;0===t?(this.grabbedLeft=!0,this.otherHandlePos=this.zoomedMax,this.fixedExtreme=n?s.min:s.max):(this.grabbedRight=!0,this.otherHandlePos=this.zoomedMin,this.fixedExtreme=n?s.max:s.min),i.setFixedRange(void 0)}onMouseMove(e){let t=this,i=t.chart,s=t.navigatorSize,n=t.range,r=t.dragOffset,o=i.inverted,a=t.left,l;(!e.touches||0!==e.touches[0].pageX)&&(l=(e=i.pointer?.normalize(e)||e).chartX,o&&(a=t.top,l=e.chartY),t.grabbedLeft?(t.hasDragged=!0,t.render(0,0,l-a,t.otherHandlePos)):t.grabbedRight?(t.hasDragged=!0,t.render(0,0,t.otherHandlePos,l-a)):t.grabbedCenter&&(t.hasDragged=!0,ls+r-n&&(l=s+r-n),t.render(0,0,l-r,l-r+n)),t.hasDragged&&t.scrollbar&&iP(t.scrollbar.options.liveRedraw,!ig&&!this.chart.boosted)&&(e.DOMType=e.type,setTimeout(function(){t.onMouseUp(e)},0)))}onMouseUp(e){let t,i,s,n,r,o;let a=this.chart,l=this.xAxis,h=this.scrollbar,c=e.DOMEvent||e,d=a.inverted,u=this.rendered&&!this.hasDragged?\"animate\":\"attr\";(this.hasDragged&&(!h||!h.hasDragged)||\"scrollbar\"===e.trigger)&&(s=this.getUnionExtremes(),this.zoomedMin===this.otherHandlePos?n=this.fixedExtreme:this.zoomedMax===this.otherHandlePos&&(r=this.fixedExtreme),this.zoomedMax===this.size&&(r=this.reversedExtremes?s.dataMin:s.dataMax),0===this.zoomedMin&&(n=this.reversedExtremes?s.dataMax:s.dataMin),iv((o=l.navigatorAxis.toFixedRange(this.zoomedMin,this.zoomedMax,n,r)).min)&&iC(this,\"setRange\",{min:Math.min(o.min,o.max),max:Math.max(o.min,o.max),redraw:!0,animation:!this.hasDragged&&null,eventArguments:{trigger:\"navigator\",triggerOp:\"navigator-drag\",DOMEvent:c}})),\"mousemove\"!==e.DOMType&&\"touchmove\"!==e.DOMType&&(this.grabbedLeft=this.grabbedRight=this.grabbedCenter=this.fixedWidth=this.fixedExtreme=this.otherHandlePos=this.hasDragged=this.dragOffset=null),this.navigatorEnabled&&ik(this.zoomedMin)&&ik(this.zoomedMax)&&(i=Math.round(this.zoomedMin),t=Math.round(this.zoomedMax),this.shades&&this.drawMasks(i,t,d,u),this.outline&&this.drawOutline(i,t,d,u),this.navigatorOptions.handles.enabled&&Object.keys(this.handles).length===this.handles.length&&(this.drawHandle(i,0,d,u),this.drawHandle(t,1,d,u)))}removeEvents(){this.eventsToUnbind&&(this.eventsToUnbind.forEach(function(e){e()}),this.eventsToUnbind=void 0),this.removeBaseSeriesEvents()}removeBaseSeriesEvents(){let e=this.baseSeries||[];this.navigatorEnabled&&e[0]&&(!1!==this.navigatorOptions.adaptToUpdatedData&&e.forEach(function(e){iD(e,\"updatedData\",this.updatedDataHandler)},this),e[0].xAxis&&iD(e[0].xAxis,\"foundExtremes\",this.modifyBaseAxisExtremes))}getXAxisOffsets(){return this.chart.inverted?[this.scrollButtonSize,0,-this.scrollButtonSize,0]:[0,-this.scrollButtonSize,0,this.scrollButtonSize]}init(e){let t=e.options,i=t.navigator||{},s=i.enabled,n=t.scrollbar||{},r=n.enabled,o=s&&i.height||0,a=r&&n.height||0,l=n.buttonsEnabled&&a||0;this.handles=[],this.shades=[],this.chart=e,this.setBaseSeries(),this.height=o,this.scrollbarHeight=a,this.scrollButtonSize=l,this.scrollbarEnabled=r,this.navigatorEnabled=s,this.navigatorOptions=i,this.scrollbarOptions=n,this.setOpposite();let h=this,c=h.baseSeries,d=e.xAxis.length,u=e.yAxis.length,p=c&&c[0]&&c[0].xAxis||e.xAxis[0]||{options:{}};if(e.isDirtyBox=!0,h.navigatorEnabled){let t=this.getXAxisOffsets();h.xAxis=new(tl())(e,iS({breaks:p.options.breaks,ordinal:p.options.ordinal,overscroll:p.options.overscroll},i.xAxis,{type:\"datetime\",yAxis:i.yAxis?.id,index:d,isInternal:!0,offset:0,keepOrdinalPadding:!0,startOnTick:!1,endOnTick:!1,minPadding:p.options.ordinal?0:p.options.minPadding,maxPadding:p.options.ordinal?0:p.options.maxPadding,zoomEnabled:!1},e.inverted?{offsets:t,width:o}:{offsets:t,height:o}),\"xAxis\"),h.yAxis=new(tl())(e,iS(i.yAxis,{alignTicks:!1,offset:0,index:u,isInternal:!0,reversed:iP(i.yAxis&&i.yAxis.reversed,e.yAxis[0]&&e.yAxis[0].reversed,!1),zoomEnabled:!1},e.inverted?{width:o}:{height:o}),\"yAxis\"),c||i.series.data?h.updateNavigatorSeries(!1):0===e.series.length&&(h.unbindRedraw=ib(e,\"beforeRedraw\",function(){e.series.length>0&&!h.series&&(h.setBaseSeries(),h.unbindRedraw())})),h.reversedExtremes=e.inverted&&!h.xAxis.reversed||!e.inverted&&h.xAxis.reversed,h.renderElements(),h.addMouseEvents()}else h.xAxis={chart:e,navigatorAxis:{fake:!0},translate:function(t,i){let s=e.xAxis[0],n=s.getExtremes(),r=s.len-2*l,o=iB(\"min\",s.options.min,n.dataMin),a=iB(\"max\",s.options.max,n.dataMax)-o;return i?t*a/r+o:r*(t-o)/a},toPixels:function(e){return this.translate(e)},toValue:function(e){return this.translate(e,!0)}},h.xAxis.navigatorAxis.axis=h.xAxis,h.xAxis.navigatorAxis.toFixedRange=tD.prototype.toFixedRange.bind(h.xAxis.navigatorAxis);if(e.options.scrollbar.enabled){let t=iS(e.options.scrollbar,{vertical:e.inverted});!ik(t.margin)&&h.navigatorEnabled&&(t.margin=e.inverted?-3:3),e.scrollbar=h.scrollbar=new ic(e.renderer,t,e),ib(h.scrollbar,\"changed\",function(e){let t=h.size,i=t*this.to,s=t*this.from;h.hasDragged=h.scrollbar.hasDragged,h.render(0,0,s,i),this.shouldUpdateExtremes(e.DOMType)&&setTimeout(function(){h.onMouseUp(e)})})}h.addBaseSeriesEvents(),h.addChartEvents()}setOpposite(){let e=this.navigatorOptions,t=this.navigatorEnabled,i=this.chart;this.opposite=iP(e.opposite,!!(!t&&i.inverted))}getUnionExtremes(e){let t;let i=this.chart.xAxis[0],s=this.chart.time,n=this.xAxis,r=n.options,o=i.options;return e&&null===i.dataMin||(t={dataMin:iP(s.parse(r?.min),iB(\"min\",s.parse(o.min),i.dataMin,n.dataMin,n.min)),dataMax:iP(s.parse(r?.max),iB(\"max\",s.parse(o.max),i.dataMax,n.dataMax,n.max))}),t}setBaseSeries(e,t){let i=this.chart,s=this.baseSeries=[];e=e||i.options&&i.options.navigator.baseSeries||(i.series.length?iT(i.series,e=>!e.options.isInternal).index:0),(i.series||[]).forEach((t,i)=>{!t.options.isInternal&&(t.options.showInNavigator||(i===e||t.options.id===e)&&!1!==t.options.showInNavigator)&&s.push(t)}),this.xAxis&&!this.xAxis.navigatorAxis.fake&&this.updateNavigatorSeries(!0,t)}updateNavigatorSeries(e,t){let i=this,s=i.chart,n=i.baseSeries,r={enableMouseTracking:!1,index:null,linkedTo:null,group:\"nav\",padXAxis:!1,xAxis:this.navigatorOptions.xAxis?.id,yAxis:this.navigatorOptions.yAxis?.id,showInLegend:!1,stacking:void 0,isInternal:!0,states:{inactive:{opacity:1}}},o=i.series=(i.series||[]).filter(e=>{let t=e.baseSeries;return!(0>n.indexOf(t))||(t&&(iD(t,\"updatedData\",i.updatedDataHandler),delete t.navigatorSeries),e.chart&&e.destroy(),!1)}),a,l,h=i.navigatorOptions.series,c;n&&n.length&&n.forEach(e=>{let d=e.navigatorSeries,u=iA({color:e.color,visible:e.visible},iM(h)?ip.navigator.series:h);if(d&&!1===i.navigatorOptions.adaptToUpdatedData)return;r.name=\"Navigator \"+n.length,c=(a=e.options||{}).navigatorOptions||{},u.dataLabels=iN(u.dataLabels),(l=iS(a,r,u,c)).pointRange=iP(u.pointRange,c.pointRange,ip.plotOptions[l.type||\"line\"].pointRange);let p=c.data||u.data;i.hasNavigatorData=i.hasNavigatorData||!!p,l.data=p||a.data?.slice(0),d&&d.options?d.update(l,t):(e.navigatorSeries=s.initSeries(l),s.setSortedData(),e.navigatorSeries.baseSeries=e,o.push(e.navigatorSeries))}),(h.data&&!(n&&n.length)||iM(h))&&(i.hasNavigatorData=!1,(h=iN(h)).forEach((e,t)=>{r.name=\"Navigator \"+(o.length+1),(l=iS(ip.navigator.series,{color:s.series[t]&&!s.series[t].options.isInternal&&s.series[t].color||s.options.colors[t]||s.options.colors[0]},r,e)).data=e.data,l.data&&(i.hasNavigatorData=!0,o.push(s.initSeries(l)))})),e&&this.addBaseSeriesEvents()}addBaseSeriesEvents(){let e=this,t=e.baseSeries||[];t[0]&&t[0].xAxis&&t[0].eventsToUnbind.push(ib(t[0].xAxis,\"foundExtremes\",this.modifyBaseAxisExtremes)),t.forEach(i=>{i.eventsToUnbind.push(ib(i,\"show\",function(){this.navigatorSeries&&this.navigatorSeries.setVisible(!0,!1)})),i.eventsToUnbind.push(ib(i,\"hide\",function(){this.navigatorSeries&&this.navigatorSeries.setVisible(!1,!1)})),!1!==this.navigatorOptions.adaptToUpdatedData&&i.xAxis&&i.eventsToUnbind.push(ib(i,\"updatedData\",this.updatedDataHandler)),i.eventsToUnbind.push(ib(i,\"remove\",function(){t&&iE(t,i),this.navigatorSeries&&e.series&&(iE(e.series,this.navigatorSeries),iv(this.navigatorSeries.options)&&this.navigatorSeries.remove(!1),delete this.navigatorSeries)}))})}getBaseSeriesMin(e){return this.baseSeries.reduce(function(e,t){return Math.min(e,t.getColumn(\"x\")[0]??e)},e)}modifyNavigatorAxisExtremes(){let e=this.xAxis;if(void 0!==e.getExtremes){let t=this.getUnionExtremes(!0);t&&(t.dataMin!==e.min||t.dataMax!==e.max)&&(e.min=t.dataMin,e.max=t.dataMax)}}modifyBaseAxisExtremes(){let e,t;let i=this.chart.navigator,s=this.getExtremes(),n=s.min,r=s.max,o=s.dataMin,a=s.dataMax,l=r-n,h=i.stickToMin,c=i.stickToMax,d=iP(this.ordinal?.convertOverscroll(this.options.overscroll),0),u=i.series&&i.series[0],p=!!this.setExtremes;!(this.eventArgs&&\"rangeSelectorButton\"===this.eventArgs.trigger)&&(h&&(e=(t=o)+l),c&&(e=a+d,h||(t=Math.max(o,e-l,i.getBaseSeriesMin(u&&u.xData?u.xData[0]:-Number.MAX_VALUE)))),p&&(h||c)&&ik(t)&&(this.min=this.userMin=t,this.max=this.userMax=e)),i.stickToMin=i.stickToMax=null}updatedDataHandler(){let e=this.chart.navigator,t=this.navigatorSeries,i=e.reversedExtremes?0===Math.round(e.zoomedMin):Math.round(e.zoomedMax)>=Math.round(e.size);e.stickToMax=iP(this.chart.options.navigator&&this.chart.options.navigator.stickToMax,i),e.stickToMin=e.shouldStickToMin(this,e),t&&!e.hasNavigatorData&&(t.options.pointStart=this.getColumn(\"x\")[0],t.setData(this.options.data,!1,null,!1))}shouldStickToMin(e,t){let i=t.getBaseSeriesMin(e.getColumn(\"x\")[0]),s=e.xAxis,n=s.max,r=s.min,o=s.options.range;return!!(ik(n)&&ik(r))&&(o&&n-i>0?n-i{e.destroy&&e.destroy()}),[\"series\",\"xAxis\",\"yAxis\",\"shades\",\"outline\",\"scrollbarTrack\",\"scrollbarRifles\",\"scrollbarGroup\",\"scrollbar\",\"navigatorGroup\",\"rendered\"].forEach(e=>{this[e]&&this[e].destroy&&this[e].destroy(),this[e]=null}),[this.handles].forEach(e=>{iw(e)}),this.navigatorEnabled=!1}}let{animObject:iF}=w(),{format:iO}=D(),{clamp:iR,pick:iL,syncTimeout:iH}=w(),{getFakeMouseEvent:iz}=S,{getAxisRangeDescription:iq,fireEventOnWrappedOrUnwrappedElement:iG}=K,iK=class extends Z{init(){let e=this.chart,t=this;this.announcer=new ep(e,\"polite\"),this.addEvent(iI,\"afterRender\",function(){this.chart===t.chart&&this.chart.renderer&&iH(()=>{t.proxyProvider.updateGroupProxyElementPositions(\"navigator\"),t.updateHandleValues()},iF(iL(this.chart.renderer.globalAnimation,!0)).duration)})}onChartUpdate(){let e=this.chart,t=e.options,i=t.navigator;if(i.enabled&&i.accessibility?.enabled){let i=t.accessibility.landmarkVerbosity,s=t.lang.accessibility?.navigator.groupLabel;this.proxyProvider.removeGroup(\"navigator\"),this.proxyProvider.addGroup(\"navigator\",\"div\",{role:\"all\"===i?\"region\":\"group\",\"aria-label\":iO(s,{chart:e},e)});let n=t.lang.accessibility?.navigator.handleLabel;[0,1].forEach(t=>{let i=this.getHandleByIx(t);if(i){let s=this.proxyProvider.addProxyElement(\"navigator\",{click:i},\"input\",{type:\"range\",\"aria-label\":iO(n,{handleIx:t,chart:e},e)});this[t?\"maxHandleProxy\":\"minHandleProxy\"]=s.innerElement,s.innerElement.style.pointerEvents=\"none\",s.innerElement.oninput=()=>this.updateNavigator()}}),this.updateHandleValues()}else this.proxyProvider.removeGroup(\"navigator\")}getNavigatorHandleNavigation(e){let t=this,i=this.chart,s=e?this.maxHandleProxy:this.minHandleProxy,n=this.keyCodes;return new Q(i,{keyCodeMap:[[[n.left,n.right,n.up,n.down],function(r){if(s){let o=r===n.left||r===n.up?-1:1;s.value=\"\"+iR(parseFloat(s.value)+o,0,100),t.updateNavigator(()=>{let n=t.getHandleByIx(e);n&&i.setFocusToElement(n,s)})}return this.response.success}]],init:()=>{i.setFocusToElement(this.getHandleByIx(e),s)},validate:()=>!!(this.getHandleByIx(e)&&s&&i.options.navigator.accessibility?.enabled)})}getKeyboardNavigation(){return[this.getNavigatorHandleNavigation(0),this.getNavigatorHandleNavigation(1)]}destroy(){this.updateNavigatorThrottleTimer&&clearTimeout(this.updateNavigatorThrottleTimer),this.proxyProvider.removeGroup(\"navigator\"),this.announcer&&this.announcer.destroy()}updateHandleValues(){let e=this.chart.navigator;if(e&&this.minHandleProxy&&this.maxHandleProxy){let t=e.size;this.minHandleProxy.value=\"\"+Math.round(e.zoomedMin/t*100),this.maxHandleProxy.value=\"\"+Math.round(e.zoomedMax/t*100)}}getHandleByIx(e){let t=this.chart.navigator;return t&&t.handles&&t.handles[e]}updateNavigator(e){this.updateNavigatorThrottleTimer&&clearTimeout(this.updateNavigatorThrottleTimer),this.updateNavigatorThrottleTimer=setTimeout((e=>{let t=this.chart,{navigator:i,pointer:s}=t;if(i&&s&&this.minHandleProxy&&this.maxHandleProxy){let n=s.getChartPosition(),r=parseFloat(this.minHandleProxy.value)/100*i.size,o=parseFloat(this.maxHandleProxy.value)/100*i.size;[[0,\"mousedown\",i.zoomedMin],[0,\"mousemove\",r],[0,\"mouseup\",r],[1,\"mousedown\",i.zoomedMax],[1,\"mousemove\",o],[1,\"mouseup\",o]].forEach(([e,t,s])=>{let r=this.getHandleByIx(e)?.element;r&&iG(r,iz(t,{x:n.left+i.left+s,y:n.top+i.top},r))}),e&&e();let a=t.options.lang.accessibility?.navigator.changeAnnouncement,l=iq(t.xAxis[0]);this.announcer.announce(iO(a,{axisRangeDescription:l,chart:t},t))}}).bind(this,e),20)}},{getPointAnnotationTexts:iU}=ev,{getAxisDescription:iV,getSeriesFirstPointElement:iW,getSeriesA11yElement:iX,unhideChartElementFromAT:iY}=K,{format:ij,numberFormat:i_}=D(),{reverseChildNodes:iZ,stripHTMLTagsFromString:i$}=S,{find:iQ,isNumber:iJ,isString:i0,pick:i1,defined:i2}=w();function i3(e){let t=e.chart.options.accessibility.series.pointDescriptionEnabledThreshold;return!!(!1!==t&&e.points&&e.points.length>=+t)}function i5(e,t){let i=e.series,s=i.chart,n=s.options.accessibility.point||{},r=i.options.accessibility&&i.options.accessibility.point||{},o=i.tooltipOptions||{},a=s.options.lang;return iJ(t)?i_(t,r.valueDecimals||n.valueDecimals||o.valueDecimals||-1,a.decimalPoint,a.accessibility.thousandsSep||a.thousandsSep):t}function i4(e,t){let i=e[t];return e.chart.langFormat(\"accessibility.series.\"+t+\"Description\",{name:iV(i),series:e})}function i6(e){let t=e.series,i=t.chart.series.length>1||t.options.name,s=function(e){let t=e.series,i=t.chart,s=t.options.accessibility,n=s&&s.point&&s.point.valueDescriptionFormat||i.options.accessibility.point.valueDescriptionFormat,r=i1(t.xAxis&&t.xAxis.options.accessibility&&t.xAxis.options.accessibility.enabled,!i.angular&&\"flowmap\"!==t.type),o=r?function(e){let t=function(e){let t=e.series,i=t.chart,s=t.options.accessibility&&t.options.accessibility.point||{},n=i.options.accessibility.point||{},r=t.xAxis&&t.xAxis.dateTime;if(r){let t=r.getXDateFormat(e.x||0,i.options.tooltip.dateTimeLabelFormats),o=s.dateFormatter&&s.dateFormatter(e)||n.dateFormatter&&n.dateFormatter(e)||s.dateFormat||n.dateFormat||t;return i.time.dateFormat(o,e.x||0,void 0)}}(e),i=(e.series.xAxis||{}).categories&&i2(e.category)&&(\"\"+e.category).replace(\"
    \",\" \"),s=i2(e.id)&&0>(\"\"+e.id).indexOf(\"highcharts-\"),n=\"x, \"+e.x;return e.name||t||i||(s?e.id:n)}(e):\"\";return ij(n,{point:e,index:i2(e.index)?e.index+1:\"\",xDescription:o,value:function(e){let t=e.series,i=t.chart.options.accessibility.point||{},s=t.chart.options.accessibility&&t.chart.options.accessibility.point||{},n=t.tooltipOptions||{},r=s.valuePrefix||i.valuePrefix||n.valuePrefix||\"\",o=s.valueSuffix||i.valueSuffix||n.valueSuffix||\"\",a=void 0!==e.value?\"value\":\"y\",l=i5(e,e[a]);return e.isNull?t.chart.langFormat(\"accessibility.series.nullPointValue\",{point:e}):t.pointArrayMap?function(e,t,i){let s=t||\"\",n=i||\"\",r=function(t){let i=i5(e,i1(e[t],e.options[t]));return void 0!==i?t+\": \"+s+i+n:i};return e.series.pointArrayMap.reduce(function(e,t){let i=r(t);return i?e+(e.length?\", \":\"\")+i:e},\"\")}(e,r,o):r+l+o}(e),separator:r?\", \":\"\"},i)}(e),n=e.options&&e.options.accessibility&&e.options.accessibility.description,r=i?\" \"+t.name+\".\":\"\",o=function(e){let t=e.series.chart,i=iU(e);return i.length?t.langFormat(\"accessibility.series.pointAnnotationsDescription\",{point:e,annotations:i}):\"\"}(e);return e.accessibility=e.accessibility||{},e.accessibility.valueDescription=s,s+(n?\" \"+n:\"\")+r+(o?\" \"+o:\"\")}function i9(e){let t=e.chart,i=t.types||[],s=function(e){let t=(e.options.accessibility||{}).description;return t&&e.chart.langFormat(\"accessibility.series.description\",{description:t,series:e})||\"\"}(e),n=function(i){return t[i]&&t[i].length>1&&e[i]},r=e.index+1,o=i4(e,\"xAxis\"),a=i4(e,\"yAxis\"),l={seriesNumber:r,series:e,chart:t},h=i.length>1?\"Combination\":\"\",c=t.langFormat(\"accessibility.series.summary.\"+e.type+h,l)||t.langFormat(\"accessibility.series.summary.default\"+h,l),d=(n(\"yAxis\")?\" \"+a+\".\":\"\")+(n(\"xAxis\")?\" \"+o+\".\":\"\");return ij(i1(e.options.accessibility&&e.options.accessibility.descriptionFormat,t.options.accessibility.series.descriptionFormat,\"\"),{seriesDescription:c,authorDescription:s?\" \"+s:\"\",axisDescription:d,series:e,chart:t,seriesNumber:r},void 0)}let i8={defaultPointDescriptionFormatter:i6,defaultSeriesDescriptionFormatter:i9,describeSeries:function(e){let t=e.chart,i=iW(e),s=iX(e),n=t.is3d&&t.is3d();s&&(s.lastChild!==i||n||iZ(s),function(e){let t=function(e){let t=e.options.accessibility||{};return!i3(e)&&!t.exposeAsGroupOnly}(e),i=function(e){let t=e.chart.options.accessibility.keyboardNavigation.seriesNavigation;return!!(e.points&&(e.points.length<+t.pointNavigationEnabledThreshold||!1===t.pointNavigationEnabledThreshold))}(e),s=e.chart.options.accessibility.point.describeNull;(t||i)&&e.points.forEach(i=>{let n=i.graphic&&i.graphic.element||function(e){let t=e.series,i=t&&t.chart,s=t&&t.is(\"sunburst\"),n=e.isNull,r=i&&i.options.accessibility.point.describeNull;return n&&!s&&r}(i)&&function(e){let t=e.series,i=function(e){let t=e.index;return e.series&&e.series.data&&i2(t)&&iQ(e.series.data,function(e){return!!(e&&void 0!==e.index&&e.index>t&&e.graphic&&e.graphic.element)})||null}(e),s=i&&i.graphic,n=s?s.parentGroup:t.graph||t.group,r=i?{x:i1(e.plotX,i.plotX,0),y:i1(e.plotY,i.plotY,0)}:{x:i1(e.plotX,0),y:i1(e.plotY,0)},o=function(e,t){let i=e.series.chart.renderer.rect(t.x,t.y,1,1);return i.attr({class:\"highcharts-a11y-mock-point\",fill:\"none\",opacity:0,\"fill-opacity\":0,\"stroke-opacity\":0}),i}(e,r);if(n&&n.element)return e.graphic=o,e.hasMockGraphic=!0,o.add(n),n.element.insertBefore(o.element,s?s.element:null),o.element}(i),r=i.options&&i.options.accessibility&&!1===i.options.accessibility.enabled;if(n){if(i.isNull&&!s){n.setAttribute(\"aria-hidden\",!0);return}n.setAttribute(\"tabindex\",\"-1\"),e.chart.styledMode||(n.style.outline=\"none\"),t&&!r?function(e,t){let i=e.series,s=i.options.accessibility?.point||{},n=i.chart.options.accessibility.point||{},r=i$(i0(s.descriptionFormat)&&ij(s.descriptionFormat,e,i.chart)||s.descriptionFormatter?.(e)||i0(n.descriptionFormat)&&ij(n.descriptionFormat,e,i.chart)||n.descriptionFormatter?.(e)||i6(e),i.chart.renderer.forExport);t.setAttribute(\"role\",\"img\"),t.setAttribute(\"aria-label\",r)}(i,n):n.setAttribute(\"aria-hidden\",!0)}})}(e),iY(t,s),function(e){let t=e.chart,i=t.options.chart,s=i.options3d&&i.options3d.enabled,n=t.series.length>1,r=t.options.accessibility.series.describeSingleSeries,o=(e.options.accessibility||{}).exposeAsGroupOnly;return!(s&&n)&&(n||r||o||i3(e))}(e)?function(e,t){let i=e.options.accessibility||{},s=e.chart.options.accessibility,n=s.landmarkVerbosity;i.exposeAsGroupOnly?t.setAttribute(\"role\",\"img\"):\"all\"===n?t.setAttribute(\"role\",\"region\"):t.setAttribute(\"role\",\"group\"),t.setAttribute(\"tabindex\",\"-1\"),e.chart.styledMode||(t.style.outline=\"none\"),t.setAttribute(\"aria-label\",i$(s.series.descriptionFormatter&&s.series.descriptionFormatter(e)||i9(e),e.chart.renderer.forExport))}(e,s):s.removeAttribute(\"aria-label\"))}},{composed:i7}=w(),{addEvent:se,defined:st,pushUnique:si}=w(),{getChartTitle:ss}=K,{defaultPointDescriptionFormatter:sn,defaultSeriesDescriptionFormatter:sr}=i8;function so(e){return!!e.options.accessibility.announceNewData.enabled}class sa{constructor(e){this.dirty={allSeries:{}},this.lastAnnouncementTime=0,this.chart=e}init(){let e=this.chart,t=e.options.accessibility.announceNewData.interruptUser?\"assertive\":\"polite\";this.lastAnnouncementTime=0,this.dirty={allSeries:{}},this.eventProvider=new Y,this.announcer=new ep(e,t),this.addEventListeners()}destroy(){this.eventProvider.removeAddedEvents(),this.announcer.destroy()}addEventListeners(){let e=this,t=this.chart,i=this.eventProvider;i.addEvent(t,\"afterApplyDrilldown\",function(){e.lastAnnouncementTime=0}),i.addEvent(t,\"afterAddSeries\",function(t){e.onSeriesAdded(t.series)}),i.addEvent(t,\"redraw\",function(){e.announceDirtyData()})}onSeriesAdded(e){so(this.chart)&&(this.dirty.hasDirty=!0,this.dirty.allSeries[e.name+e.index]=e,this.dirty.newSeries=st(this.dirty.newSeries)?void 0:e)}announceDirtyData(){let e=this.chart,t=this;if(e.options.accessibility.announceNewData&&this.dirty.hasDirty){let e=this.dirty.newPoint;e&&(e=function(e){let t=e.series.data.filter(t=>e.x===t.x&&e.y===t.y);return 1===t.length?t[0]:e}(e)),this.queueAnnouncement(Object.keys(this.dirty.allSeries).map(e=>t.dirty.allSeries[e]),this.dirty.newSeries,e),this.dirty={allSeries:{}}}}queueAnnouncement(e,t,i){let s=this.chart.options.accessibility.announceNewData;if(s.enabled){let n=+new Date,r=n-this.lastAnnouncementTime,o=Math.max(0,s.minAnnounceInterval-r),a=function(e,t){let i=(e||[]).concat(t||[]).reduce((e,t)=>(e[t.name+t.index]=t,e),{});return Object.keys(i).map(e=>i[e])}(this.queuedAnnouncement&&this.queuedAnnouncement.series,e),l=this.buildAnnouncementMessage(a,t,i);l&&(this.queuedAnnouncement&&clearTimeout(this.queuedAnnouncementTimer),this.queuedAnnouncement={time:n,message:l,series:a},this.queuedAnnouncementTimer=setTimeout(()=>{this&&this.announcer&&(this.lastAnnouncementTime=+new Date,this.announcer.announce(this.queuedAnnouncement.message),delete this.queuedAnnouncement,delete this.queuedAnnouncementTimer)},o))}}buildAnnouncementMessage(e,t,i){let s=this.chart,n=s.options.accessibility.announceNewData;if(n.announcementFormatter){let s=n.announcementFormatter(e,t,i);if(!1!==s)return s.length?s:null}let r=w().charts&&w().charts.length>1?\"Multiple\":\"Single\",o=t?\"newSeriesAnnounce\"+r:i?\"newPointAnnounce\"+r:\"newDataAnnounce\",a=ss(s);return s.langFormat(\"accessibility.announceNewData.\"+o,{chartTitle:a,seriesDesc:t?sr(t):null,pointDesc:i?sn(i):null,point:i,series:t})}}!function(e){function t(e){let t=this.chart,i=t.accessibility?.components.series.newDataAnnouncer;i&&i.chart===t&&so(t)&&(i.dirty.newPoint=st(i.dirty.newPoint)?void 0:e.point)}function i(){let e=this.chart,t=e.accessibility?.components.series.newDataAnnouncer;t&&t.chart===e&&so(e)&&(t.dirty.hasDirty=!0,t.dirty.allSeries[this.name+this.index]=this)}e.compose=function(e){si(i7,\"A11y.NDA\")&&(se(e,\"addPoint\",t),se(e,\"updatedData\",i))}}(sa||(sa={}));let sl=sa,{doc:sh}=w(),{attr:sc,css:sd,merge:su}=w(),{fireEventOnWrappedOrUnwrappedElement:sp}=K,{cloneMouseEvent:sg,cloneTouchEvent:sm,getFakeMouseEvent:sb,removeElement:sf}=S,sx=class{constructor(e,t,i=\"button\",s,n){this.chart=e,this.target=t,this.eventProvider=new Y;let r=this.innerElement=sh.createElement(i),o=this.element=s?sh.createElement(s):r;e.styledMode||this.hideElementVisually(r),s&&(\"li\"!==s||e.styledMode||(o.style.listStyle=\"none\"),o.appendChild(r),this.element=o),this.updateTarget(t,n)}click(){let e=this.getTargetPosition();e.x+=e.width/2,e.y+=e.height/2;let t=sb(\"click\",e);sp(this.target.click,t)}updateTarget(e,t){this.target=e,this.updateCSSClassName();let i=t||{};Object.keys(i).forEach(e=>{null===i[e]&&delete i[e]});let s=this.getTargetAttr(e.click,\"aria-label\");sc(this.innerElement,su(s?{\"aria-label\":s}:{},i)),this.eventProvider.removeAddedEvents(),this.addProxyEventsToElement(this.innerElement,e.click),this.refreshPosition()}refreshPosition(){let e=this.getTargetPosition();sd(this.innerElement,{width:(e.width||1)+\"px\",height:(e.height||1)+\"px\",left:(Math.round(e.x)||0)+\"px\",top:(Math.round(e.y)||0)+\"px\"})}remove(){this.eventProvider.removeAddedEvents(),sf(this.element)}updateCSSClassName(){let e=e=>e.indexOf(\"highcharts-no-tooltip\")>-1,t=this.chart.legend,i=t.group&&t.group.div,s=e(i&&i.className||\"\"),n=e(this.getTargetAttr(this.target.click,\"class\")||\"\");this.innerElement.className=s||n?\"highcharts-a11y-proxy-element highcharts-no-tooltip\":\"highcharts-a11y-proxy-element\"}addProxyEventsToElement(e,t){[\"click\",\"touchstart\",\"touchend\",\"touchcancel\",\"touchmove\",\"mouseover\",\"mouseenter\",\"mouseleave\",\"mouseout\"].forEach(i=>{let s=0===i.indexOf(\"touch\");this.eventProvider.addEvent(e,i,e=>{let i=s?sm(e):sg(e);t&&sp(t,i),e.stopPropagation(),s||e.preventDefault()},{passive:!1})})}hideElementVisually(e){sd(e,{borderWidth:0,backgroundColor:\"transparent\",cursor:\"pointer\",outline:\"none\",opacity:.001,filter:\"alpha(opacity=1)\",zIndex:999,overflow:\"hidden\",padding:0,margin:0,display:\"block\",position:\"absolute\",\"-ms-filter\":\"progid:DXImageTransform.Microsoft.Alpha(Opacity=1)\"})}getTargetPosition(){let e=this.target.click,t=e.element?e.element:e,i=this.target.visual||t,s=this.chart.renderTo,n=this.chart.pointer;if(s&&i?.getBoundingClientRect&&n){let e=i.getBoundingClientRect(),t=n.getChartPosition();return{x:(e.left-t.left)/t.scaleX,y:(e.top-t.top)/t.scaleY,width:e.right/t.scaleX-e.left/t.scaleX,height:e.bottom/t.scaleY-e.top/t.scaleY}}return{x:0,y:0,width:1,height:1}}getTargetAttr(e,t){return e.element?e.element.getAttribute(t):e.getAttribute(t)}},{doc:sy}=w(),{attr:sv,css:sw}=w(),{unhideChartElementFromAT:sE}=K,{removeChildNodes:sA}=S,sT=class{constructor(e){this.chart=e,this.domElementProvider=new W,this.groups={},this.groupOrder=[],this.beforeChartProxyPosContainer=this.createProxyPosContainer(\"before\"),this.afterChartProxyPosContainer=this.createProxyPosContainer(\"after\"),this.update()}addProxyElement(e,t,i=\"button\",s){let n=this.groups[e];if(!n)throw Error(\"ProxyProvider.addProxyElement: Invalid group key \"+e);let r=\"ul\"===n.type||\"ol\"===n.type?\"li\":void 0,o=new sx(this.chart,t,i,r,s);return n.proxyContainerElement.appendChild(o.element),n.proxyElements.push(o),o}addGroup(e,t=\"div\",i){let s;let n=this.groups[e];if(n)return n.groupElement;let r=this.domElementProvider.createElement(t);return i&&i.role&&\"div\"!==t?(s=this.domElementProvider.createElement(\"div\")).appendChild(r):s=r,s.className=\"highcharts-a11y-proxy-group highcharts-a11y-proxy-group-\"+e.replace(/\\W/g,\"-\"),this.groups[e]={proxyContainerElement:r,groupElement:s,type:t,proxyElements:[]},sv(s,i||{}),\"ul\"===t&&r.setAttribute(\"role\",\"list\"),this.afterChartProxyPosContainer.appendChild(s),this.updateGroupOrder(this.groupOrder),s}updateGroupAttrs(e,t){let i=this.groups[e];if(!i)throw Error(\"ProxyProvider.updateGroupAttrs: Invalid group key \"+e);sv(i.groupElement,t)}updateGroupOrder(e){if(this.groupOrder=e.slice(),this.isDOMOrderGroupOrder())return;let t=e.indexOf(\"series\"),i=t>-1?e.slice(0,t):e,s=t>-1?e.slice(t+1):[],n=sy.activeElement;[\"before\",\"after\"].forEach(e=>{let t=this[\"before\"===e?\"beforeChartProxyPosContainer\":\"afterChartProxyPosContainer\"];sA(t),(\"before\"===e?i:s).forEach(e=>{let i=this.groups[e];i&&t.appendChild(i.groupElement)})}),(this.beforeChartProxyPosContainer.contains(n)||this.afterChartProxyPosContainer.contains(n))&&n&&n.focus&&n.focus()}clearGroup(e){let t=this.groups[e];if(!t)throw Error(\"ProxyProvider.clearGroup: Invalid group key \"+e);sA(t.proxyContainerElement)}removeGroup(e){let t=this.groups[e];t&&(this.domElementProvider.removeElement(t.groupElement),t.groupElement!==t.proxyContainerElement&&this.domElementProvider.removeElement(t.proxyContainerElement),delete this.groups[e])}update(){this.updatePosContainerPositions(),this.updateGroupOrder(this.groupOrder),this.updateProxyElementPositions()}updateProxyElementPositions(){Object.keys(this.groups).forEach(this.updateGroupProxyElementPositions.bind(this))}updateGroupProxyElementPositions(e){let t=this.groups[e];t&&t.proxyElements.forEach(e=>e.refreshPosition())}destroy(){this.domElementProvider.destroyCreatedElements()}createProxyPosContainer(e){let t=this.domElementProvider.createElement(\"div\");return t.setAttribute(\"aria-hidden\",\"false\"),t.className=\"highcharts-a11y-proxy-container\"+(e?\"-\"+e:\"\"),sw(t,{top:\"0\",left:\"0\"}),this.chart.styledMode||(t.style.whiteSpace=\"nowrap\",t.style.position=\"absolute\"),t}getCurrentGroupOrderInDOM(){let e=e=>{let t=Object.keys(this.groups),i=t.length;for(;i--;){let s=t[i],n=this.groups[s];if(n&&e===n.groupElement)return s}},t=t=>{let i=[],s=t.children;for(let t=0;t\"series\"===e||!!this.groups[e]),i=e.length;if(i!==t.length)return!1;for(;i--;)if(e[i]!==t[i])return!1;return!0}updatePosContainerPositions(){let e=this.chart;if(e.renderer.forExport)return;let t=e.renderer.box;e.container.insertBefore(this.afterChartProxyPosContainer,t.nextSibling),e.container.insertBefore(this.beforeChartProxyPosContainer,t),sE(this.chart,this.afterChartProxyPosContainer),sE(this.chart,this.beforeChartProxyPosContainer)}},{unhideChartElementFromAT:sC,getAxisRangeDescription:sM}=K,{addEvent:sk,attr:sS}=w();class sP extends Z{init(){let e=this.chart;this.announcer=new ep(e,\"polite\")}onChartUpdate(){let e=this.chart,t=this,i=e.rangeSelector;i&&(this.updateSelectorVisibility(),this.setDropdownAttrs(),i.buttons&&i.buttons.length&&i.buttons.forEach(e=>{t.setRangeButtonAttrs(e)}),i.maxInput&&i.minInput&&[\"minInput\",\"maxInput\"].forEach(function(s,n){let r=i[s];r&&(sC(e,r),t.setRangeInputAttrs(r,\"accessibility.rangeSelector.\"+(n?\"max\":\"min\")+\"InputLabel\"))}))}updateSelectorVisibility(){let e=this.chart,t=e.rangeSelector,i=t&&t.dropdown,s=t&&t.buttons||[],n=e=>e.setAttribute(\"aria-hidden\",!0);t&&t.hasVisibleDropdown&&i?(sC(e,i),s.forEach(e=>n(e.element))):(i&&n(i),s.forEach(t=>sC(e,t.element)))}setDropdownAttrs(){let e=this.chart,t=e.rangeSelector&&e.rangeSelector.dropdown;if(t){let i=e.langFormat(\"accessibility.rangeSelector.dropdownLabel\",{rangeTitle:e.options.lang.rangeSelectorZoom});t.setAttribute(\"aria-label\",i),t.setAttribute(\"tabindex\",-1)}}setRangeButtonAttrs(e){sS(e.element,{tabindex:-1,role:\"button\"})}setRangeInputAttrs(e,t){let i=this.chart;sS(e,{tabindex:-1,\"aria-label\":i.langFormat(t,{chart:i})})}onButtonNavKbdArrowKey(e,t){let i=e.response,s=this.keyCodes,n=this.chart,r=n.options.accessibility.keyboardNavigation.wrapAround,o=t===s.left||t===s.up?-1:1;return n.highlightRangeSelectorButton(n.highlightedRangeSelectorItemIx+o)?i.success:r?(e.init(o),i.success):i[o>0?\"next\":\"prev\"]}onButtonNavKbdClick(e){let t=e.response,i=this.chart;return 3!==i.oldRangeSelectorItemState&&this.fakeClickEvent(i.rangeSelector.buttons[i.highlightedRangeSelectorItemIx].element),t.success}onAfterBtnClick(){let e=this.chart,t=sM(e.xAxis[0]),i=e.langFormat(\"accessibility.rangeSelector.clickButtonAnnouncement\",{chart:e,axisRangeDescription:t});i&&this.announcer.announce(i)}onInputKbdMove(e){let t=this.chart,i=t.rangeSelector,s=t.highlightedInputRangeIx=(t.highlightedInputRangeIx||0)+e;if(s>1||s<0){if(t.accessibility)return t.accessibility.keyboardNavigation.exiting=!0,t.accessibility.keyboardNavigation.tabindexContainer.focus(),t.accessibility.keyboardNavigation.move(e)}else if(i){let e=i[s?\"maxDateBox\":\"minDateBox\"],n=i[s?\"maxInput\":\"minInput\"];e&&n&&t.setFocusToElement(e,n)}return!0}onInputNavInit(e){let t=this,i=this.chart,s=e>0?0:1,n=i.rangeSelector,r=n&&n[s?\"maxDateBox\":\"minDateBox\"],o=n&&n.minInput,a=n&&n.maxInput;if(i.highlightedInputRangeIx=s,r&&o&&a){i.setFocusToElement(r,s?a:o),this.removeInputKeydownHandler&&this.removeInputKeydownHandler();let e=e=>{(e.which||e.keyCode)===this.keyCodes.tab&&t.onInputKbdMove(e.shiftKey?-1:1)&&(e.preventDefault(),e.stopPropagation())},n=sk(o,\"keydown\",e),l=sk(a,\"keydown\",e);this.removeInputKeydownHandler=()=>{n(),l()}}}onInputNavTerminate(){let e=this.chart.rangeSelector||{};e.maxInput&&e.hideInput(\"max\"),e.minInput&&e.hideInput(\"min\"),this.removeInputKeydownHandler&&(this.removeInputKeydownHandler(),delete this.removeInputKeydownHandler)}initDropdownNav(){let e=this.chart,t=e.rangeSelector,i=t&&t.dropdown;t&&i&&(e.setFocusToElement(t.buttonGroup,i),this.removeDropdownKeydownHandler&&this.removeDropdownKeydownHandler(),this.removeDropdownKeydownHandler=sk(i,\"keydown\",t=>{let i=(t.which||t.keyCode)===this.keyCodes.tab,s=e.accessibility;i&&(t.preventDefault(),t.stopPropagation(),s&&s.keyboardNavigation.move(t.shiftKey?-1:1))}))}getRangeSelectorButtonNavigation(){let e=this.chart,t=this.keyCodes,i=this;return new Q(e,{keyCodeMap:[[[t.left,t.right,t.up,t.down],function(e){return i.onButtonNavKbdArrowKey(this,e)}],[[t.enter,t.space],function(){return i.onButtonNavKbdClick(this)}]],validate:function(){return!!(e.rangeSelector&&e.rangeSelector.buttons&&e.rangeSelector.buttons.length)},init:function(t){let s=e.rangeSelector;if(s&&s.hasVisibleDropdown)i.initDropdownNav();else if(s){let i=s.buttons.length-1;e.highlightRangeSelectorButton(t>0?0:i)}},terminate:function(){i.removeDropdownKeydownHandler&&(i.removeDropdownKeydownHandler(),delete i.removeDropdownKeydownHandler)}})}getRangeSelectorInputNavigation(){let e=this.chart,t=this;return new Q(e,{keyCodeMap:[],validate:function(){return!!(e.rangeSelector&&e.rangeSelector.inputGroup&&\"hidden\"!==e.rangeSelector.inputGroup.element.style.visibility&&!1!==e.options.rangeSelector.inputEnabled&&e.rangeSelector.minInput&&e.rangeSelector.maxInput)},init:function(e){t.onInputNavInit(e)},terminate:function(){t.onInputNavTerminate()}})}getKeyboardNavigation(){return[this.getRangeSelectorButtonNavigation(),this.getRangeSelectorInputNavigation()]}destroy(){this.removeDropdownKeydownHandler&&this.removeDropdownKeydownHandler(),this.removeInputKeydownHandler&&this.removeInputKeydownHandler(),this.announcer&&this.announcer.destroy()}}!function(e){function t(e){let t=this.rangeSelector&&this.rangeSelector.buttons||[],i=this.highlightedRangeSelectorItemIx,s=this.rangeSelector&&this.rangeSelector.selected;return void 0!==i&&t[i]&&i!==s&&t[i].setState(this.oldRangeSelectorItemState||0),this.highlightedRangeSelectorItemIx=e,!!t[e]&&(this.setFocusToElement(t[e].box,t[e].element),e!==s&&(this.oldRangeSelectorItemState=t[e].state,t[e].setState(1)),!0)}function i(){let e=this.chart.accessibility;if(e&&e.components.rangeSelector)return e.components.rangeSelector.onAfterBtnClick()}e.compose=function(e,s){let n=e.prototype;n.highlightRangeSelectorButton||(n.highlightRangeSelectorButton=t,sk(s,\"afterBtnClick\",i))}}(sP||(sP={}));let sD=sP,{composed:sN}=w(),{addEvent:sB,merge:sI,pushUnique:sF}=w();!function(e){function t(e){sI(!0,e,{marker:{enabled:!0,states:{normal:{opacity:0}}}})}function i(e){return e.marker.states&&e.marker.states.normal&&e.marker.states.normal.opacity}function s(e){return!!(e._hasPointMarkers&&e.points&&e.points.length)}function n(){this.chart.styledMode&&(this.markerGroup&&this.markerGroup[this.a11yMarkersForced?\"addClass\":\"removeClass\"](\"highcharts-a11y-markers-hidden\"),s(this)&&this.points.forEach(e=>{e.graphic&&(e.graphic[e.hasForcedA11yMarker?\"addClass\":\"removeClass\"](\"highcharts-a11y-marker-hidden\"),e.graphic[!1===e.hasForcedA11yMarker?\"addClass\":\"removeClass\"](\"highcharts-a11y-marker-visible\"))}))}function r(e){this.resetA11yMarkerOptions=sI(e.options.marker||{},this.userOptions.marker||{})}function o(){let e=this.options;!function(e){let t=e.chart.options.accessibility.enabled,i=!1!==(e.options.accessibility&&e.options.accessibility.enabled);return t&&i&&function(e){let t=e.chart.options.accessibility;return e.points.length-1;t.highlightedPoint===this&&i!==e&&!n&&e&&e.focus&&e.focus()})}onDrillupAll(){let e;let t=this.lastDrilledDownPoint,i=this.chart,s=t&&sW(i,t.seriesName);t&&s&&sK(t.x)&&sK(t.y)&&(e=sV(s,t.x,t.y)),e=e||sZ(i),i.container&&i.container.focus(),e&&e.highlight&&e.highlight(!1)}getKeyboardNavigationHandler(){let e=this,t=this.keyCodes,i=this.chart,s=i.inverted;return new Q(i,{keyCodeMap:[[s?[t.up,t.down]:[t.left,t.right],function(t){return e.onKbdSideways(this,t)}],[s?[t.left,t.right]:[t.up,t.down],function(t){return e.onKbdVertical(this,t)}],[[t.enter,t.space],function(e,t){let s=i.highlightedPoint;if(s){let{plotLeft:e,plotTop:i}=this.chart,{plotX:n=0,plotY:r=0}=s;t={...t,chartX:e+n,chartY:i+r,point:s,target:s.graphic?.element||t.target},sU(s.series,\"click\",t),s.firePointEvent(\"click\",t)}return this.response.success}],[[t.home],function(){return sQ(i),this.response.success}],[[t.end],function(){return s$(i),this.response.success}],[[t.pageDown,t.pageUp],function(e){return i.highlightAdjacentSeries(e===t.pageDown),this.response.success}]],init:function(){return e.onHandlerInit(this)},validate:function(){return!!sZ(i)},terminate:function(){return e.onHandlerTerminate()}})}onKbdSideways(e,t){let i=this.keyCodes,s=t===i.right||t===i.down;return this.attemptHighlightAdjacentPoint(e,s)}onHandlerInit(e){let t=this.chart;return t.options.accessibility.keyboardNavigation.seriesNavigation.rememberPointFocus&&t.highlightedPoint?t.highlightedPoint.highlight():sQ(t),e.response.success}onKbdVertical(e,t){let i=this.chart,s=this.keyCodes,n=t===s.down||t===s.right,r=i.options.accessibility.keyboardNavigation.seriesNavigation;if(r.mode&&\"serialize\"===r.mode)return this.attemptHighlightAdjacentPoint(e,n);let o=i.highlightedPoint&&i.highlightedPoint.series.keyboardMoveVertical?\"highlightAdjacentPointVertical\":\"highlightAdjacentSeries\";return i[o](n),e.response.success}onHandlerTerminate(){let e=this.chart,t=e.options.accessibility.keyboardNavigation;e.tooltip&&e.tooltip.hide(0);let i=e.highlightedPoint&&e.highlightedPoint.series;i&&i.onMouseOut&&i.onMouseOut(),e.highlightedPoint&&e.highlightedPoint.onMouseOut&&e.highlightedPoint.onMouseOut(),t.seriesNavigation.rememberPointFocus||delete e.highlightedPoint}attemptHighlightAdjacentPoint(e,t){let i=this.chart,s=i.options.accessibility.keyboardNavigation.wrapAround;return i.highlightAdjacentPoint(t)?e.response.success:s&&(t?sQ(i):s$(i))?e.response.success:e.response[t?\"next\":\"prev\"]}onSeriesDestroy(e){let t=this.chart;t.highlightedPoint&&t.highlightedPoint.series===e&&(delete t.highlightedPoint,t.focusElement&&t.focusElement.removeFocusBorder())}destroy(){this.eventProvider.removeAddedEvents()}}!function(e){function t(e){let t,i;let s=this.series,n=this.highlightedPoint,r=n&&sY(n)||0,o=n&&n.series.points||[],a=this.series&&this.series[this.series.length-1],l=a&&a.points&&a.points[a.points.length-1];if(!s[0]||!s[0].points)return!1;if(n){if(t=s[n.series.index+(e?1:-1)],(i=o[r+(e?1:-1)])||!t||(i=t.points[e?0:t.points.length-1]),!i)return!1}else i=e?s[0].points[0]:l;return s_(i)?(sj(t=i.series)?this.highlightedPoint=e?t.points[t.points.length-1]:t.points[0]:this.highlightedPoint=i,this.highlightAdjacentPoint(e)):i.highlight()}function i(e){let t=this.highlightedPoint,i=1/0,s;return!!(sK(t.plotX)&&sK(t.plotY))&&(this.series.forEach(n=>{sj(n)||n.points.forEach(r=>{if(!sK(r.plotY)||!sK(r.plotX)||r===t)return;let o=r.plotY-t.plotY,a=Math.abs(r.plotX-t.plotX),l=Math.abs(o)*Math.abs(o)+a*a*4;n.yAxis&&n.yAxis.reversed&&(o*=-1),!(o<=0&&e||o>=0&&!e||l<5||s_(r))&&l!(sK(e.plotX)&&sK(e.plotY));if(!h(e)){for(;l--;)!h(r=t.points[l])&&(a=(e.plotX-r.plotX)*(e.plotX-r.plotX)*4+(e.plotY-r.plotY)*(e.plotY-r.plotY)*1)=0;--e)if(!s_(i[e]))return i[e].highlight()}return!1}e.compose=function(e,o,a){let l=e.prototype,h=o.prototype,c=a.prototype;l.highlightAdjacentPoint||(l.highlightAdjacentPoint=t,l.highlightAdjacentPointVertical=i,l.highlightAdjacentSeries=s,h.highlight=n,c.keyboardMoveVertical=!0,[\"column\",\"gantt\",\"pie\"].forEach(e=>{sq[e]&&(sq[e].prototype.keyboardMoveVertical=!1)}),c.highlightNextValidPoint=r)}}(sJ||(sJ={}));let s0=sJ,{hideSeriesFromAT:s1}=K,{describeSeries:s2}=i8,s3=class extends Z{static compose(e,t,i){sl.compose(i),sO.compose(i),s0.compose(e,t,i)}init(){this.newDataAnnouncer=new sl(this.chart),this.newDataAnnouncer.init(),this.keyboardNavigation=new s0(this.chart,this.keyCodes),this.keyboardNavigation.init(),this.hideTooltipFromATWhenShown(),this.hideSeriesLabelsFromATWhenShown()}hideTooltipFromATWhenShown(){let e=this;this.chart.tooltip&&this.addEvent(this.chart.tooltip.constructor,\"refresh\",function(){this.chart===e.chart&&this.label&&this.label.element&&this.label.element.setAttribute(\"aria-hidden\",!0)})}hideSeriesLabelsFromATWhenShown(){this.addEvent(this.chart,\"afterDrawSeriesLabels\",function(){this.series.forEach(function(e){e.labelBySeries&&e.labelBySeries.attr(\"aria-hidden\",!0)})})}onChartRender(){this.chart.series.forEach(function(e){!1!==(e.options.accessibility&&e.options.accessibility.enabled)&&e.visible&&0!==e.getPointsCollection().length?s2(e):s1(e)})}getKeyboardNavigation(){return this.keyboardNavigation.getKeyboardNavigationHandler()}destroy(){this.newDataAnnouncer.destroy(),this.keyboardNavigation.destroy()}},{unhideChartElementFromAT:s5}=K,{getFakeMouseEvent:s4}=S,{attr:s6,pick:s9}=w(),s8=class extends Z{constructor(){super(...arguments),this.focusedMapNavButtonIx=-1}init(){let e=this,t=this.chart;this.proxyProvider.addGroup(\"zoom\",\"div\"),[\"afterShowResetZoom\",\"afterApplyDrilldown\",\"drillupall\"].forEach(i=>{e.addEvent(t,i,function(){e.updateProxyOverlays()})})}onChartUpdate(){let e=this.chart,t=this;e.mapNavigation&&e.mapNavigation.navButtons.forEach((i,s)=>{s5(e,i.element),t.setMapNavButtonAttrs(i.element,\"accessibility.zoom.mapZoom\"+(s?\"Out\":\"In\"))})}setMapNavButtonAttrs(e,t){let i=this.chart;s6(e,{tabindex:-1,role:\"button\",\"aria-label\":i.langFormat(t,{chart:i})})}onChartRender(){this.updateProxyOverlays()}updateProxyOverlays(){let e=this.chart;if(this.proxyProvider.clearGroup(\"zoom\"),e.resetZoomButton&&this.createZoomProxyButton(e.resetZoomButton,\"resetZoomProxyButton\",e.langFormat(\"accessibility.zoom.resetZoomButton\",{chart:e})),e.drillUpButton&&e.breadcrumbs&&e.breadcrumbs.list){let t=e.breadcrumbs.list[e.breadcrumbs.list.length-1];this.createZoomProxyButton(e.drillUpButton,\"drillUpProxyButton\",e.langFormat(\"accessibility.drillUpButton\",{chart:e,buttonText:e.breadcrumbs.getButtonText(t)}))}}createZoomProxyButton(e,t,i){this[t]=this.proxyProvider.addProxyElement(\"zoom\",{click:e},\"button\",{\"aria-label\":i,tabindex:-1})}getMapZoomNavigation(){let e=this.keyCodes,t=this.chart,i=this;return new Q(t,{keyCodeMap:[[[e.up,e.down,e.left,e.right],function(e){return i.onMapKbdArrow(this,e)}],[[e.tab],function(e,t){return i.onMapKbdTab(this,t)}],[[e.space,e.enter],function(){return i.onMapKbdClick(this)}]],validate:function(){return!!(t.mapView&&t.mapNavigation&&t.mapNavigation.navButtons.length)},init:function(e){return i.onMapNavInit(e)}})}onMapKbdArrow(e,t){let i=this.chart,s=this.keyCodes,n=i.container,r=t===s.up||t===s.down,o=t===s.left||t===s.up?1:-1,a=(r?i.plotHeight:i.plotWidth)/10*o,l=10*Math.random(),h={x:n.offsetLeft+i.plotLeft+i.plotWidth/2+l,y:n.offsetTop+i.plotTop+i.plotHeight/2+l},c=r?{x:h.x,y:h.y+a}:{x:h.x+a,y:h.y};return[s4(\"mousedown\",h),s4(\"mousemove\",c),s4(\"mouseup\",c)].forEach(e=>n.dispatchEvent(e)),e.response.success}onMapKbdTab(e,t){let i=this.chart,s=e.response,n=t.shiftKey,r=n&&!this.focusedMapNavButtonIx||!n&&this.focusedMapNavButtonIx;if(i.mapNavigation.navButtons[this.focusedMapNavButtonIx].setState(0),r)return i.mapView&&i.mapView.zoomBy(),s[n?\"prev\":\"next\"];this.focusedMapNavButtonIx+=n?-1:1;let o=i.mapNavigation.navButtons[this.focusedMapNavButtonIx];return i.setFocusToElement(o.box,o.element),o.setState(2),s.success}onMapKbdClick(e){let t=this.chart.mapNavigation.navButtons[this.focusedMapNavButtonIx].element;return this.fakeClickEvent(t),e.response.success}onMapNavInit(e){let t=this.chart,i=t.mapNavigation.navButtons[0],s=t.mapNavigation.navButtons[1],n=e>0?i:s;t.setFocusToElement(n.box,n.element),n.setState(2),this.focusedMapNavButtonIx=e>0?0:1}simpleButtonNavigation(e,t,i){let s=this.keyCodes,n=this,r=this.chart;return new Q(r,{keyCodeMap:[[[s.tab,s.up,s.down,s.left,s.right],function(e,t){let i=e===s.tab&&t.shiftKey||e===s.left||e===s.up;return this.response[i?\"prev\":\"next\"]}],[[s.space,s.enter],function(){return s9(i(this,r),this.response.success)}]],validate:function(){return r[e]&&r[e].box&&n[t].innerElement},init:function(){r.setFocusToElement(r[e].box,n[t].innerElement)}})}getKeyboardNavigation(){return[this.simpleButtonNavigation(\"resetZoomButton\",\"resetZoomProxyButton\",function(e,t){t.zoomOut()}),this.simpleButtonNavigation(\"drillUpButton\",\"drillUpProxyButton\",function(e,t){return t.drillUp(),e.response.prev}),this.getMapZoomNavigation()]}},{doc:s7,isMS:ne,win:nt}=w(),ni={isHighContrastModeActive:function(){let e=/(Edg)/.test(nt.navigator.userAgent);if(nt.matchMedia&&e)return nt.matchMedia(\"(-ms-high-contrast: active)\").matches;if(ne&&nt.getComputedStyle){let e=s7.createElement(\"div\");e.style.backgroundImage=\"url(data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)\",s7.body.appendChild(e);let t=(e.currentStyle||nt.getComputedStyle(e)).backgroundImage;return s7.body.removeChild(e),\"none\"===t}return nt.matchMedia&&nt.matchMedia(\"(forced-colors: active)\").matches},setHighContrastTheme:function(e){e.highContrastModeActive=!0;let t=e.options.accessibility.highContrastTheme;e.update(t,!1);let i=t.colors?.length>1;e.series.forEach(function(e){let s=t.plotOptions[e.type]||{},n=i&&void 0!==e.colorIndex?t.colors[e.colorIndex]:s.color||\"window\",r={color:s.color||\"windowText\",colors:i?t.colors:[s.color||\"windowText\"],borderColor:s.borderColor||\"window\",fillColor:n};e.update(r,!1),e.points&&e.points.forEach(function(e){e.options&&e.options.color&&e.update({color:s.color||\"windowText\",borderColor:s.borderColor||\"window\"},!1)})}),e.redraw()}},{error:ns,pick:nn}=w();function nr(e,t,i){let s=e,n,r=0;for(;r\"series\"!==e)):Object.keys(this.components):[]}update(){let e=this.components,t=this.chart,i=t.options.accessibility;nu(t,\"beforeA11yUpdate\"),t.types=this.getChartTypes();let s=i.keyboardNavigation.order;this.proxyProvider.updateGroupOrder(s),this.getComponentOrder().forEach(function(i){e[i].onChartUpdate(),nu(t,\"afterA11yComponentUpdate\",{name:i,component:e[i]})}),this.keyboardNavigation.update(s),!t.highContrastModeActive&&!1!==i.highContrastMode&&(ni.isHighContrastModeActive()||!0===i.highContrastMode)&&ni.setHighContrastTheme(t),nu(t,\"afterA11yUpdate\",{accessibility:this})}destroy(){let e=this.chart||{},t=this.components;Object.keys(t).forEach(function(e){t[e].destroy(),t[e].destroyBase()}),this.proxyProvider&&this.proxyProvider.destroy(),e.announcerContainer&&ng(e.announcerContainer),this.keyboardNavigation&&this.keyboardNavigation.destroy(),e.renderTo&&e.renderTo.setAttribute(\"aria-hidden\",!0),e.focusElement&&e.focusElement.removeFocusBorder()}getChartTypes(){let e={};return this.chart.series.forEach(function(t){e[t.type]=1}),Object.keys(e)}}!function(e){function t(){this.accessibility&&this.accessibility.destroy()}function i(){this.a11yDirty&&this.renderTo&&(delete this.a11yDirty,this.updateA11yEnabled());let e=this.accessibility;e&&!e.zombie&&(e.proxyProvider.updateProxyElementPositions(),e.getComponentOrder().forEach(function(t){e.components[t].onChartRender()}))}function s(e){let t=e.options.accessibility;t&&(t.customComponents&&(this.options.accessibility.customComponents=t.customComponents,delete t.customComponents),np(!0,this.options.accessibility,t),this.accessibility&&this.accessibility.destroy&&(this.accessibility.destroy(),delete this.accessibility)),this.a11yDirty=!0}function n(){let t=this.accessibility,i=this.options.accessibility,s=this.renderer.boxWrapper.element,n=this.title;if(i&&i.enabled)t&&!t.zombie?t.update():(this.accessibility=t=new e(this),t&&!t.zombie&&t.update(),\"img\"===s.getAttribute(\"role\")&&s.removeAttribute(\"role\"));else if(t)t.destroy&&t.destroy(),delete this.accessibility;else{this.renderTo.setAttribute(\"role\",\"img\"),this.renderTo.setAttribute(\"aria-hidden\",!1),this.renderTo.setAttribute(\"aria-label\",(n&&n.element.textContent||\"\").replace(/{nc(e,t,function(){this.a11yDirty=!0})}),[\"afterApplyDrilldown\",\"drillupall\"].forEach(t=>{nc(e,t,function(){let e=this.accessibility;e&&!e.zombie&&e.update()})}),nc(a,\"update\",r),[\"update\",\"updatedData\",\"remove\"].forEach(e=>{nc(l,e,function(){this.chart.accessibility&&(this.chart.a11yDirty=!0)})}))}}(nm||(nm={})),np(!0,nl,{accessibility:{enabled:!0,screenReaderSection:{beforeChartFormat:\"<{headingTagName}>{chartTitle}
    {typeDescription}
    {chartSubtitle}
    {chartLongdesc}
    {playAsSoundButton}
    {viewTableButton}
    {xAxisDescription}
    {yAxisDescription}
    {annotationsTitle}{annotationsList}
    \",afterChartFormat:\"{endOfChartMarker}\",axisRangeDateFormat:\"%Y-%m-%d %H:%M:%S\"},series:{descriptionFormat:\"{seriesDescription}{authorDescription}{axisDescription}\",describeSingleSeries:!1,pointDescriptionEnabledThreshold:200},point:{valueDescriptionFormat:\"{xDescription}{separator}{value}.\",describeNull:!0},landmarkVerbosity:\"all\",linkedDescription:'*[data-highcharts-chart=\"{index}\"] + .highcharts-description',highContrastMode:\"auto\",keyboardNavigation:{enabled:!0,focusBorder:{enabled:!0,hideBrowserFocusOutline:!0,style:{color:\"#334eff\",lineWidth:2,borderRadius:3},margin:2},order:[\"series\",\"zoom\",\"rangeSelector\",\"navigator\",\"legend\",\"chartMenu\"],wrapAround:!0,seriesNavigation:{skipNullPoints:!0,pointNavigationEnabledThreshold:!1,rememberPointFocus:!1}},announceNewData:{enabled:!1,minAnnounceInterval:5e3,interruptUser:!1}},legend:{accessibility:{enabled:!0,keyboardNavigation:{enabled:!0}}},exporting:{accessibility:{enabled:!0}},navigator:{accessibility:{enabled:!0}}},{accessibility:{highContrastTheme:{chart:{backgroundColor:\"window\"},title:{style:{color:\"windowText\"}},subtitle:{style:{color:\"windowText\"}},colorAxis:{minColor:\"windowText\",maxColor:\"windowText\",stops:[],dataClasses:[]},colors:[\"windowText\"],xAxis:{gridLineColor:\"windowText\",labels:{style:{color:\"windowText\"}},lineColor:\"windowText\",minorGridLineColor:\"windowText\",tickColor:\"windowText\",title:{style:{color:\"windowText\"}}},yAxis:{gridLineColor:\"windowText\",labels:{style:{color:\"windowText\"}},lineColor:\"windowText\",minorGridLineColor:\"windowText\",tickColor:\"windowText\",title:{style:{color:\"windowText\"}}},tooltip:{backgroundColor:\"window\",borderColor:\"windowText\",style:{color:\"windowText\"}},plotOptions:{series:{lineColor:\"windowText\",fillColor:\"window\",borderColor:\"windowText\",edgeColor:\"windowText\",borderWidth:1,dataLabels:{connectorColor:\"windowText\",color:\"windowText\",style:{color:\"windowText\",textOutline:\"none\"}},marker:{lineColor:\"windowText\",fillColor:\"windowText\"}},pie:{color:\"window\",colors:[\"window\"],borderColor:\"windowText\",borderWidth:1},boxplot:{fillColor:\"window\"},candlestick:{lineColor:\"windowText\",fillColor:\"window\"},errorbar:{fillColor:\"window\"}},legend:{backgroundColor:\"window\",itemStyle:{color:\"windowText\"},itemHoverStyle:{color:\"windowText\"},itemHiddenStyle:{color:\"#555\"},title:{style:{color:\"windowText\"}}},credits:{style:{color:\"windowText\"}},drilldown:{activeAxisLabelStyle:{color:\"windowText\"},activeDataLabelStyle:{color:\"windowText\"}},navigation:{buttonOptions:{symbolStroke:\"windowText\",theme:{fill:\"window\"}}},rangeSelector:{buttonTheme:{fill:\"window\",stroke:\"windowText\",style:{color:\"windowText\"},states:{hover:{fill:\"window\",stroke:\"windowText\",style:{color:\"windowText\"}},select:{fill:\"#444\",stroke:\"windowText\",style:{color:\"windowText\"}}}},inputBoxBorderColor:\"windowText\",inputStyle:{backgroundColor:\"window\",color:\"windowText\"},labelStyle:{color:\"windowText\"}},navigator:{handles:{backgroundColor:\"window\",borderColor:\"windowText\"},outlineColor:\"windowText\",maskFill:\"transparent\",series:{color:\"windowText\",lineColor:\"windowText\"},xAxis:{gridLineColor:\"windowText\"}},scrollbar:{barBackgroundColor:\"#444\",barBorderColor:\"windowText\",buttonArrowColor:\"windowText\",buttonBackgroundColor:\"window\",buttonBorderColor:\"windowText\",rifleColor:\"windowText\",trackBackgroundColor:\"window\",trackBorderColor:\"windowText\"}}},lang:{accessibility:{defaultChartTitle:\"Chart\",chartContainerLabel:\"{title}. Highcharts interactive chart.\",svgContainerLabel:\"Interactive chart\",drillUpButton:\"{buttonText}\",credits:\"Chart credits: {creditsStr}\",thousandsSep:\",\",svgContainerTitle:\"\",graphicContainerLabel:\"\",screenReaderSection:{beforeRegionLabel:\"\",afterRegionLabel:\"\",annotations:{heading:\"Chart annotations summary\",descriptionSinglePoint:\"{annotationText}. Related to {annotationPoint}\",descriptionMultiplePoints:\"{annotationText}. Related to {annotationPoint}{#each additionalAnnotationPoints}, also related to {this}{/each}\",descriptionNoPoints:\"{annotationText}\"},endOfChartMarker:\"End of interactive chart.\"},sonification:{playAsSoundButtonText:\"Play as sound, {chartTitle}\",playAsSoundClickAnnouncement:\"Play\"},legend:{legendLabelNoTitle:\"Toggle series visibility, {chartTitle}\",legendLabel:\"Chart legend: {legendTitle}\",legendItem:\"Show {itemName}\"},zoom:{mapZoomIn:\"Zoom chart\",mapZoomOut:\"Zoom out chart\",resetZoomButton:\"Reset zoom\"},rangeSelector:{dropdownLabel:\"{rangeTitle}\",minInputLabel:\"Select start date.\",maxInputLabel:\"Select end date.\",clickButtonAnnouncement:\"Viewing {axisRangeDescription}\"},navigator:{handleLabel:\"{#eq handleIx 0}Start, percent{else}End, percent{/eq}\",groupLabel:\"Axis zoom\",changeAnnouncement:\"{axisRangeDescription}\"},table:{viewAsDataTableButtonText:\"View as data table, {chartTitle}\",tableSummary:\"Table representation of chart.\"},announceNewData:{newDataAnnounce:\"Updated data for chart {chartTitle}\",newSeriesAnnounceSingle:\"New data series: {seriesDesc}\",newPointAnnounceSingle:\"New data point: {pointDesc}\",newSeriesAnnounceMultiple:\"New data series in chart {chartTitle}: {seriesDesc}\",newPointAnnounceMultiple:\"New data point in chart {chartTitle}: {pointDesc}\"},seriesTypeDescriptions:{boxplot:\"Box plot charts are typically used to display groups of statistical data. Each data point in the chart can have up to 5 values: minimum, lower quartile, median, upper quartile, and maximum.\",arearange:\"Arearange charts are line charts displaying a range between a lower and higher value for each point.\",areasplinerange:\"These charts are line charts displaying a range between a lower and higher value for each point.\",bubble:\"Bubble charts are scatter charts where each data point also has a size value.\",columnrange:\"Columnrange charts are column charts displaying a range between a lower and higher value for each point.\",errorbar:\"Errorbar series are used to display the variability of the data.\",funnel:\"Funnel charts are used to display reduction of data in stages.\",pyramid:\"Pyramid charts consist of a single pyramid with item heights corresponding to each point value.\",waterfall:\"A waterfall chart is a column chart where each column contributes towards a total end value.\"},chartTypes:{emptyChart:\"Empty chart\",mapTypeDescription:\"Map of {mapTitle} with {numSeries} data series.\",unknownMap:\"Map of unspecified region with {numSeries} data series.\",combinationChart:\"Combination chart with {numSeries} data series.\",defaultSingle:\"Chart with {numPoints} data {#eq numPoints 1}point{else}points{/eq}.\",defaultMultiple:\"Chart with {numSeries} data series.\",splineSingle:\"Line chart with {numPoints} data {#eq numPoints 1}point{else}points{/eq}.\",splineMultiple:\"Line chart with {numSeries} lines.\",lineSingle:\"Line chart with {numPoints} data {#eq numPoints 1}point{else}points{/eq}.\",lineMultiple:\"Line chart with {numSeries} lines.\",columnSingle:\"Bar chart with {numPoints} {#eq numPoints 1}bar{else}bars{/eq}.\",columnMultiple:\"Bar chart with {numSeries} data series.\",barSingle:\"Bar chart with {numPoints} {#eq numPoints 1}bar{else}bars{/eq}.\",barMultiple:\"Bar chart with {numSeries} data series.\",pieSingle:\"Pie chart with {numPoints} {#eq numPoints 1}slice{else}slices{/eq}.\",pieMultiple:\"Pie chart with {numSeries} pies.\",scatterSingle:\"Scatter chart with {numPoints} {#eq numPoints 1}point{else}points{/eq}.\",scatterMultiple:\"Scatter chart with {numSeries} data series.\",boxplotSingle:\"Boxplot with {numPoints} {#eq numPoints 1}box{else}boxes{/eq}.\",boxplotMultiple:\"Boxplot with {numSeries} data series.\",bubbleSingle:\"Bubble chart with {numPoints} {#eq numPoints 1}bubbles{else}bubble{/eq}.\",bubbleMultiple:\"Bubble chart with {numSeries} data series.\"},axis:{xAxisDescriptionSingular:\"The chart has 1 X axis displaying {names[0]}. {ranges[0]}\",xAxisDescriptionPlural:\"The chart has {numAxes} X axes displaying {#each names}{#unless @first},{/unless}{#if @last} and{/if} {this}{/each}.\",yAxisDescriptionSingular:\"The chart has 1 Y axis displaying {names[0]}. {ranges[0]}\",yAxisDescriptionPlural:\"The chart has {numAxes} Y axes displaying {#each names}{#unless @first},{/unless}{#if @last} and{/if} {this}{/each}.\",timeRangeDays:\"Data range: {range} days.\",timeRangeHours:\"Data range: {range} hours.\",timeRangeMinutes:\"Data range: {range} minutes.\",timeRangeSeconds:\"Data range: {range} seconds.\",rangeFromTo:\"Data ranges from {rangeFrom} to {rangeTo}.\",rangeCategories:\"Data range: {numCategories} categories.\"},exporting:{chartMenuLabel:\"Chart menu\",menuButtonLabel:\"View chart menu, {chartTitle}\"},series:{summary:{default:\"{series.name}, series {seriesNumber} of {chart.series.length} with {series.points.length} data {#eq series.points.length 1}point{else}points{/eq}.\",defaultCombination:\"{series.name}, series {seriesNumber} of {chart.series.length} with {series.points.length} data {#eq series.points.length 1}point{else}points{/eq}.\",line:\"{series.name}, line {seriesNumber} of {chart.series.length} with {series.points.length} data {#eq series.points.length 1}point{else}points{/eq}.\",lineCombination:\"{series.name}, series {seriesNumber} of {chart.series.length}. Line with {series.points.length} data {#eq series.points.length 1}point{else}points{/eq}.\",spline:\"{series.name}, line {seriesNumber} of {chart.series.length} with {series.points.length} data {#eq series.points.length 1}point{else}points{/eq}.\",splineCombination:\"{series.name}, series {seriesNumber} of {chart.series.length}. Line with {series.points.length} data {#eq series.points.length 1}point{else}points{/eq}.\",column:\"{series.name}, bar series {seriesNumber} of {chart.series.length} with {series.points.length} {#eq series.points.length 1}bar{else}bars{/eq}.\",columnCombination:\"{series.name}, series {seriesNumber} of {chart.series.length}. Bar series with {series.points.length} {#eq series.points.length 1}bar{else}bars{/eq}.\",bar:\"{series.name}, bar series {seriesNumber} of {chart.series.length} with {series.points.length} {#eq series.points.length 1}bar{else}bars{/eq}.\",barCombination:\"{series.name}, series {seriesNumber} of {chart.series.length}. Bar series with {series.points.length} {#eq series.points.length 1}bar{else}bars{/eq}.\",pie:\"{series.name}, pie {seriesNumber} of {chart.series.length} with {series.points.length} {#eq series.points.length 1}slice{else}slices{/eq}.\",pieCombination:\"{series.name}, series {seriesNumber} of {chart.series.length}. Pie with {series.points.length} {#eq series.points.length 1}slice{else}slices{/eq}.\",scatter:\"{series.name}, scatter plot {seriesNumber} of {chart.series.length} with {series.points.length} {#eq series.points.length 1}point{else}points{/eq}.\",scatterCombination:\"{series.name}, series {seriesNumber} of {chart.series.length}, scatter plot with {series.points.length} {#eq series.points.length 1}point{else}points{/eq}.\",boxplot:\"{series.name}, boxplot {seriesNumber} of {chart.series.length} with {series.points.length} {#eq series.points.length 1}box{else}boxes{/eq}.\",boxplotCombination:\"{series.name}, series {seriesNumber} of {chart.series.length}. Boxplot with {series.points.length} {#eq series.points.length 1}box{else}boxes{/eq}.\",bubble:\"{series.name}, bubble series {seriesNumber} of {chart.series.length} with {series.points.length} {#eq series.points.length 1}bubble{else}bubbles{/eq}.\",bubbleCombination:\"{series.name}, series {seriesNumber} of {chart.series.length}. Bubble series with {series.points.length} {#eq series.points.length 1}bubble{else}bubbles{/eq}.\",map:\"{series.name}, map {seriesNumber} of {chart.series.length} with {series.points.length} {#eq series.points.length 1}area{else}areas{/eq}.\",mapCombination:\"{series.name}, series {seriesNumber} of {chart.series.length}. Map with {series.points.length} {#eq series.points.length 1}area{else}areas{/eq}.\",mapline:\"{series.name}, line {seriesNumber} of {chart.series.length} with {series.points.length} data {#eq series.points.length 1}point{else}points{/eq}.\",maplineCombination:\"{series.name}, series {seriesNumber} of {chart.series.length}. Line with {series.points.length} data {#eq series.points.length 1}point{else}points{/eq}.\",mapbubble:\"{series.name}, bubble series {seriesNumber} of {chart.series.length} with {series.points.length} {#eq series.points.length 1}bubble{else}bubbles{/eq}.\",mapbubbleCombination:\"{series.name}, series {seriesNumber} of {chart.series.length}. Bubble series with {series.points.length} {#eq series.points.length 1}bubble{else}bubbles{/eq}.\"},description:\"{description}\",xAxisDescription:\"X axis, {name}\",yAxisDescription:\"Y axis, {name}\",nullPointValue:\"No value\",pointAnnotationsDescription:\"{#each annotations}Annotation: {this}{/each}\"}}}});let nb=nm,nf=w();nf.i18nFormat=nb.i18nFormat,nf.A11yChartUtilities=K,nf.A11yHTMLUtilities=S,nf.AccessibilityComponent=Z,nf.KeyboardNavigationHandler=Q,nf.SeriesAccessibilityDescriber=i8,nb.compose(nf.Chart,nf.Legend,nf.Point,nf.Series,nf.SVGElement,nf.RangeSelector);let nx=w();return y.default})());", "!/**\n * Highcharts JS v12.1.2 (2024-12-21)\n * @module highcharts/modules/annotations\n * @requires highcharts\n *\n * Annotations module\n *\n * (c) 2009-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n */function(t,i){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=i(t._Highcharts,t._Highcharts.SeriesRegistry,t._Highcharts.Templating,t._Highcharts.AST):\"function\"==typeof define&&define.amd?define(\"highcharts/modules/annotations\",[\"highcharts/highcharts\"],function(t){return i(t,t.SeriesRegistry,t.Templating,t.AST)}):\"object\"==typeof exports?exports[\"highcharts/modules/annotations\"]=i(t._Highcharts,t._Highcharts.SeriesRegistry,t._Highcharts.Templating,t._Highcharts.AST):t.Highcharts=i(t.Highcharts,t.Highcharts.SeriesRegistry,t.Highcharts.Templating,t.Highcharts.AST)}(\"undefined\"==typeof window?this:window,(t,i,e,s)=>(()=>{\"use strict\";var o,n,a,r,h={660:t=>{t.exports=s},512:t=>{t.exports=i},984:t=>{t.exports=e},944:i=>{i.exports=t}},l={};function c(t){var i=l[t];if(void 0!==i)return i.exports;var e=l[t]={exports:{}};return h[t](e,e.exports,c),e.exports}c.n=t=>{var i=t&&t.__esModule?()=>t.default:()=>t;return c.d(i,{a:i}),i},c.d=(t,i)=>{for(var e in i)c.o(i,e)&&!c.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:i[e]})},c.o=(t,i)=>Object.prototype.hasOwnProperty.call(t,i);var p={};c.d(p,{default:()=>en});var d=c(944),u=c.n(d);let{addEvent:g,erase:m,find:f,fireEvent:x,pick:v,wrap:y}=u();function b(t,i){let e=this.initAnnotation(t);return this.options.annotations.push(e.options),v(i,!0)&&(e.redraw(),e.graphic.attr({opacity:1})),e}function A(){let t=this;t.plotBoxClip=this.renderer.clipRect(this.plotBox),t.controlPointsGroup=t.renderer.g(\"control-points\").attr({zIndex:99}).clip(t.plotBoxClip).add(),t.options.annotations.forEach((i,e)=>{if(!t.annotations.some(t=>t.options===i)){let s=t.initAnnotation(i);t.options.annotations[e]=s.options}}),t.drawAnnotations(),g(t,\"redraw\",t.drawAnnotations),g(t,\"destroy\",function(){t.plotBoxClip.destroy(),t.controlPointsGroup.destroy()}),g(t,\"exportData\",function(i){let e=t.annotations,s=(this.options.exporting&&this.options.exporting.csv||{}).columnHeaderFormatter,o=!i.dataRows[1].xValues,n=t.options.lang&&t.options.lang.exportData&&t.options.lang.exportData.annotationHeader,a=i.dataRows[0].length,r=t.options.exporting&&t.options.exporting.csv&&t.options.exporting.csv.annotations&&t.options.exporting.csv.annotations.itemDelimiter,h=t.options.exporting&&t.options.exporting.csv&&t.options.exporting.csv.annotations&&t.options.exporting.csv.annotations.join;e.forEach(t=>{t.options.labelOptions&&t.options.labelOptions.includeInDataExport&&t.labels.forEach(t=>{if(t.options.text){let e=t.options.text;t.points.forEach(t=>{let s=t.x,o=t.series.xAxis?t.series.xAxis.index:-1,n=!1;if(-1===o){let t=i.dataRows[0].length,a=Array(t);for(let i=0;i{!n&&t.xValues&&void 0!==o&&s===t.xValues[o]&&(h&&t.length>a?t[t.length-1]+=r+e:t.push(e),n=!0)}),!n){let t=i.dataRows[0].length,n=Array(t);for(let i=0;i{l=Math.max(l,t.length)});let c=l-i.dataRows[0].length;for(let t=0;t{t.redraw(),t.graphic.animate({opacity:1},t.animationConfig)})}function w(t){let i=this.annotations,e=\"annotations\"===t.coll?t:f(i,function(i){return i.options.id===t});e&&(x(e,\"remove\"),m(this.options.annotations,e.options),m(i,e),e.destroy())}function C(){this.annotations=[],this.options.annotations||(this.options.annotations=[])}function E(t){this.chart.hasDraggedAnnotation||t.apply(this,Array.prototype.slice.call(arguments,1))}(o||(o={})).compose=function(t,i,e){let s=i.prototype;if(!s.addAnnotation){let o=e.prototype;g(i,\"afterInit\",C),s.addAnnotation=b,s.callbacks.push(A),s.collectionsWithInit.annotations=[b],s.collectionsWithUpdate.push(\"annotations\"),s.drawAnnotations=k,s.removeAnnotation=w,s.initAnnotation=function(i){let e=new(t.types[i.type]||t)(this,i);return this.annotations.push(e),e},y(o,\"onContainerMouseDown\",E)}};let P=o,{defined:O}=u(),{doc:B,isTouchDevice:M}=u(),{addEvent:T,fireEvent:N,objectEach:D,pick:L,removeEvent:I}=u(),S=class{addEvents(){let t=this,i=function(i){T(i,M?\"touchstart\":\"mousedown\",i=>{t.onMouseDown(i)},{passive:!1})};if(i(this.graphic.element),(t.labels||[]).forEach(t=>{t.options.useHTML&&t.graphic.text&&i(t.graphic.text.element)}),D(t.options.events,(i,e)=>{let s=function(s){\"click\"===e&&t.cancelClick||i.call(t,t.chart.pointer?.normalize(s),t.target)};-1===(t.nonDOMEvents||[]).indexOf(e)?(T(t.graphic.element,e,s,{passive:!1}),t.graphic.div&&T(t.graphic.div,e,s,{passive:!1})):T(t,e,s,{passive:!1})}),t.options.draggable&&(T(t,\"drag\",t.onDrag),!t.graphic.renderer.styledMode)){let i={cursor:{x:\"ew-resize\",y:\"ns-resize\",xy:\"move\"}[t.options.draggable]};t.graphic.css(i),(t.labels||[]).forEach(t=>{t.options.useHTML&&t.graphic.text&&t.graphic.text.css(i)})}t.isUpdating||N(t,\"add\")}destroy(){this.removeDocEvents(),I(this),this.hcEvents=null}mouseMoveToRadians(t,i,e){let s=t.prevChartY-e,o=t.prevChartX-i,n=t.chartY-e,a=t.chartX-i,r;return this.chart.inverted&&(r=o,o=s,s=r,r=a,a=n,n=r),Math.atan2(n,a)-Math.atan2(s,o)}mouseMoveToScale(t,i,e){let s=t.prevChartX-i,o=t.prevChartY-e,n=t.chartX-i,a=t.chartY-e,r=(n||1)/(s||1),h=(a||1)/(o||1);if(this.chart.inverted){let t=h;h=r,r=t}return{x:r,y:h}}mouseMoveToTranslation(t){let i=t.chartX-t.prevChartX,e=t.chartY-t.prevChartY,s;return this.chart.inverted&&(s=e,e=i,i=s),{x:i,y:e}}onDrag(t){if(this.chart.isInsidePlot(t.chartX-this.chart.plotLeft,t.chartY-this.chart.plotTop,{visiblePlotOnly:!0})){let i=this.mouseMoveToTranslation(t);\"x\"===this.options.draggable&&(i.y=0),\"y\"===this.options.draggable&&(i.x=0),this.points.length?this.translate(i.x,i.y):(this.shapes.forEach(t=>t.translate(i.x,i.y)),this.labels.forEach(t=>t.translate(i.x,i.y))),this.redraw(!1)}}onMouseDown(t){if(t.preventDefault&&t.preventDefault(),2===t.button)return;let i=this,e=i.chart.pointer,s=t?.sourceCapabilities?.firesTouchEvents||!1,o=(t=e?.normalize(t)||t).chartX,n=t.chartY;i.cancelClick=!1,i.chart.hasDraggedAnnotation=!0,i.removeDrag=T(B,M||s?\"touchmove\":\"mousemove\",function(t){i.hasDragged=!0,(t=e?.normalize(t)||t).prevChartX=o,t.prevChartY=n,N(i,\"drag\",t),o=t.chartX,n=t.chartY},M||s?{passive:!1}:void 0),i.removeMouseUp=T(B,M||s?\"touchend\":\"mouseup\",function(){let t=L(i.target&&i.target.annotation,i.target);t&&(t.cancelClick=i.hasDragged),i.cancelClick=i.hasDragged,i.chart.hasDraggedAnnotation=!1,i.hasDragged&&N(L(t,i),\"afterUpdate\"),i.hasDragged=!1,i.onMouseUp()},M||s?{passive:!1}:void 0)}onMouseUp(){this.removeDocEvents()}removeDocEvents(){this.removeDrag&&(this.removeDrag=this.removeDrag()),this.removeMouseUp&&(this.removeMouseUp=this.removeMouseUp())}},{merge:Y,pick:X}=u(),F=class extends S{constructor(t,i,e,s){super(),this.nonDOMEvents=[\"drag\"],this.chart=t,this.target=i,this.options=e,this.index=X(e.index,s)}destroy(){super.destroy(),this.graphic&&(this.graphic=this.graphic.destroy()),this.chart=null,this.target=null,this.options=null}redraw(t){this.graphic[t?\"animate\":\"attr\"](this.options.positioner.call(this,this.target))}render(){let t=this.chart,i=this.options;this.graphic=t.renderer.symbol(i.symbol,0,0,i.width,i.height).add(t.controlPointsGroup).css(i.style),this.setVisibility(i.visible),this.addEvents()}setVisibility(t){this.graphic[t?\"show\":\"hide\"](),this.options.visible=t}update(t){let i=this.chart,e=this.target,s=this.index,o=Y(!0,this.options,t);this.destroy(),this.constructor(i,e,o,s),this.render(i.controlPointsGroup),this.redraw()}};var R=c(512),U=c.n(R);let{series:{prototype:W}}=U(),{defined:H,fireEvent:V}=u();class j{static fromPoint(t){return new j(t.series.chart,null,{x:t.x,y:t.y,xAxis:t.series.xAxis,yAxis:t.series.yAxis})}static pointToPixels(t,i){let e=t.series,s=e.chart,o=t.plotX||0,n=t.plotY||0,a;return s.inverted&&(t.mock?(o=t.plotY,n=t.plotX):(o=s.plotWidth-(t.plotY||0),n=s.plotHeight-(t.plotX||0))),e&&!i&&(o+=(a=e.getPlotBox()).translateX,n+=a.translateY),{x:o,y:n}}static pointToOptions(t){return{x:t.x,y:t.y,xAxis:t.series.xAxis,yAxis:t.series.yAxis}}constructor(t,i,e){this.mock=!0,this.point=this,this.series={visible:!0,chart:t,getPlotBox:W.getPlotBox},this.target=i||null,this.options=e,this.applyOptions(this.getOptions())}applyOptions(t){this.command=t.command,this.setAxis(t,\"x\"),this.setAxis(t,\"y\"),this.refresh()}getOptions(){return this.hasDynamicOptions()?this.options(this.target):this.options}hasDynamicOptions(){return\"function\"==typeof this.options}isInsidePlot(){let t=this.plotX,i=this.plotY,e=this.series.xAxis,s=this.series.yAxis,o={x:t,y:i,isInsidePlot:!0,options:{}};return e&&(o.isInsidePlot=H(t)&&t>=0&&t<=e.len),s&&(o.isInsidePlot=o.isInsidePlot&&H(i)&&i>=0&&i<=s.len),V(this.series.chart,\"afterIsInsidePlot\",o),o.isInsidePlot}refresh(){let t=this.series,i=t.xAxis,e=t.yAxis,s=this.getOptions();i?(this.x=s.x,this.plotX=i.toPixels(s.x,!0)):(this.x=void 0,this.plotX=s.x),e?(this.y=s.y,this.plotY=e.toPixels(s.y,!0)):(this.y=null,this.plotY=s.y),this.isInside=this.isInsidePlot()}refreshOptions(){let t=this.series,i=t.xAxis,e=t.yAxis;this.x=this.options.x=i?this.options.x=i.toValue(this.plotX,!0):this.plotX,this.y=this.options.y=e?e.toValue(this.plotY,!0):this.plotY}rotate(t,i,e){if(!this.hasDynamicOptions()){let s=Math.cos(e),o=Math.sin(e),n=this.plotX-t,a=this.plotY-i;this.plotX=n*s-a*o+t,this.plotY=n*o+a*s+i,this.refreshOptions()}}scale(t,i,e,s){if(!this.hasDynamicOptions()){let o=this.plotX*e,n=this.plotY*s;this.plotX=(1-e)*t+o,this.plotY=(1-s)*i+n,this.refreshOptions()}}setAxis(t,i){let e=i+\"Axis\",s=t[e],o=this.series.chart;this.series[e]=\"object\"==typeof s?s:H(s)?o[e][s]||o.get(s):null}toAnchor(){let t=[this.plotX,this.plotY,0,0];return this.series.chart.inverted&&(t[0]=this.plotY,t[1]=this.plotX),t}translate(t,i,e,s){this.hasDynamicOptions()||(this.plotX+=e,this.plotY+=s,this.refreshOptions())}}!function(t){function i(){let t=this.controlPoints,i=this.options.controlPoints||[];i.forEach((e,s)=>{let o=u().merge(this.options.controlPointOptions,e);o.index||(o.index=s),i[s]=o,t.push(new F(this.chart,this,o))})}function e(t){let i=t.series.getPlotBox(),e=t.series.chart,s=t.mock?t.toAnchor():e.tooltip&&e.tooltip.getAnchor.call({chart:t.series.chart},t)||[0,0,0,0],o={x:s[0]+(this.options.x||0),y:s[1]+(this.options.y||0),height:s[2]||0,width:s[3]||0};return{relativePosition:o,absolutePosition:u().merge(o,{x:o.x+(t.mock?i.translateX:e.plotLeft),y:o.y+(t.mock?i.translateY:e.plotTop)})}}function s(){this.controlPoints.forEach(t=>t.destroy()),this.chart=null,this.controlPoints=null,this.points=null,this.options=null,this.annotation&&(this.annotation=null)}function o(){let t=this.options;return t.points||t.point&&u().splat(t.point)}function n(){let t,i;let e=this.getPointsOptions(),s=this.points,o=e&&e.length||0;for(t=0;ti.redraw(t))}function h(){this.controlPoints.forEach(t=>t.render())}function l(t,i,e,s,o){if(this.chart.inverted){let t=i;i=e,e=t}this.points.forEach((n,a)=>this.transformPoint(t,i,e,s,o,a),this)}function c(t,i,e,s,o,n){let a=this.points[n];a.mock||(a=this.points[n]=j.fromPoint(a)),a[t](i,e,s,o)}function p(t,i){this.transform(\"translate\",null,null,t,i)}function d(t,i,e){this.transformPoint(\"translate\",null,null,t,i,e)}t.compose=function(t){let g=t.prototype;g.addControlPoints||u().merge(!0,g,{addControlPoints:i,anchor:e,destroyControlTarget:s,getPointsOptions:o,linkPoints:n,point:a,redrawControlPoints:r,renderControlPoints:h,transform:l,transformPoint:c,translate:p,translatePoint:d})}}(n||(n={}));let q=n,{merge:z}=u();class _{constructor(t,i,e,s){this.annotation=t,this.chart=t.chart,this.collection=\"label\"===s?\"labels\":\"shapes\",this.controlPoints=[],this.options=i,this.points=[],this.index=e,this.itemType=s,this.init(t,i,e)}attr(...t){this.graphic.attr.apply(this.graphic,arguments)}attrsFromOptions(t){let i,e;let s=this.constructor.attrsMap,o={},n=this.chart.styledMode;for(i in t)e=s[i],void 0===s[i]||n&&-1!==[\"fill\",\"stroke\",\"stroke-width\"].indexOf(e)||(o[e]=t[i]);return o}destroy(){this.graphic&&(this.graphic=this.graphic.destroy()),this.tracker&&(this.tracker=this.tracker.destroy()),this.destroyControlTarget()}init(t,i,e){this.annotation=t,this.chart=t.chart,this.options=i,this.points=[],this.controlPoints=[],this.index=e,this.linkPoints(),this.addControlPoints()}redraw(t){this.redrawControlPoints(t)}render(t){this.options.className&&this.graphic&&this.graphic.addClass(this.options.className),this.renderControlPoints()}rotate(t,i,e){this.transform(\"rotate\",t,i,e)}scale(t,i,e,s){this.transform(\"scale\",t,i,e,s)}setControlPointsVisibility(t){this.controlPoints.forEach(i=>{i.setVisibility(t)})}shouldBeDrawn(){return!!this.points.length}translateShape(t,i,e){let s=this.annotation.chart,o=this.annotation.userOptions,n=s.annotations.indexOf(this.annotation),a=s.options.annotations[n];this.translatePoint(t,i,0),e&&this.translatePoint(t,i,1),a[this.collection][this.index].point=this.options.point,o[this.collection][this.index].point=this.options.point}update(t){let i=this.annotation,e=z(!0,this.options,t),s=this.graphic.parentGroup,o=this.constructor;this.destroy(),z(!0,this,new o(i,e,this.index,this.itemType)),this.render(s),this.redraw()}}q.compose(_);let G=_,{defaultMarkers:K}={defaultMarkers:{arrow:{tagName:\"marker\",attributes:{id:\"arrow\",refY:5,refX:9,markerWidth:10,markerHeight:10},children:[{tagName:\"path\",attributes:{d:\"M 0 0 L 10 5 L 0 10 Z\",\"stroke-width\":0}}]},\"reverse-arrow\":{tagName:\"marker\",attributes:{id:\"reverse-arrow\",refY:5,refX:1,markerWidth:10,markerHeight:10},children:[{tagName:\"path\",attributes:{d:\"M 0 5 L 10 0 L 10 10 Z\",\"stroke-width\":0}}]}}},{addEvent:Z,defined:$,extend:J,merge:Q,uniqueKey:tt}=u(),ti=to(\"marker-end\"),te=to(\"marker-start\"),ts=\"rgba(192,192,192,\"+(u().svg?1e-4:.002)+\")\";function to(t){return function(i){this.attr(t,\"url(#\"+i+\")\")}}function tn(){this.options.defs=Q(K,this.options.defs||{})}function ta(t,i){let e={attributes:{id:t}},s={stroke:i.color||\"none\",fill:i.color||\"rgba(0, 0, 0, 0.75)\"};e.children=i.children&&i.children.map(function(t){return Q(s,t)});let o=Q(!0,{attributes:{markerWidth:20,markerHeight:20,refX:0,refY:0,orient:\"auto\"}},i,e),n=this.definition(o);return n.id=t,n}class tr extends G{static compose(t,i){let e=i.prototype;e.addMarker||(Z(t,\"afterGetContainer\",tn),e.addMarker=ta)}constructor(t,i,e){super(t,i,e,\"shape\"),this.type=\"path\"}toD(){let t=this.options.d;if(t)return\"function\"==typeof t?t.call(this):t;let i=this.points,e=i.length,s=[],o=e,n=i[0],a=o&&this.anchor(n).absolutePosition,r=0,h;if(a)for(s.push([\"M\",a.x,a.y]);++r{t.yAxis=i.yAxis}),tu(i.xAxis)&&i.points.forEach(t=>{t.xAxis=i.xAxis}),super.init(t,i,e)}render(t){this.graphic=this.annotation.chart.renderer.createElement(\"ellipse\").attr(this.attrsFromOptions(this.options)).add(t),super.render()}translate(t,i){super.translateShape(t,i,!0)}getDistanceFromLine(t,i,e,s){return Math.abs((i.y-t.y)*e-(i.x-t.x)*s+i.x*t.y-i.y*t.x)/Math.sqrt((i.y-t.y)*(i.y-t.y)+(i.x-t.x)*(i.x-t.x))}getAttrs(t,i){let e=t.x,s=t.y,o=i.x,n=i.y,a=(e+o)/2,r=Math.sqrt((e-o)*(e-o)/4+(s-n)*(s-n)/4),h=180*Math.atan((n-s)/(o-e))/Math.PI;return ai+s?r.push([\"L\",t+l,i+s]):at+e&&r.push([\"L\",t+e,i+s/2])),r||[]}class tw extends G{static alignedPosition(t,i){return{x:Math.round((i.x||0)+(t.x||0)+(i.width-(t.width||0))*ty(t.align)),y:Math.round((i.y||0)+(t.y||0)+(i.height-(t.height||0))*ty(t.verticalAlign))}}static compose(t){t.prototype.symbols.connector=tk}static justifiedOptions(t,i,e,s){let o;let n=e.align,a=e.verticalAlign,r=i.box?0:i.padding||0,h=i.getBBox(),l={align:n,verticalAlign:a,x:e.x,y:e.y,width:i.width,height:i.height},c=(s.x||0)-t.plotLeft,p=(s.y||0)-t.plotTop;return(o=c+r)<0&&(\"right\"===n?l.align=\"left\":l.x=(l.x||0)-o),(o=c+h.width-r)>t.plotWidth&&(\"left\"===n?l.align=\"right\":l.x=(l.x||0)+t.plotWidth-o),(o=p+r)<0&&(\"bottom\"===a?l.verticalAlign=\"top\":l.y=(l.y||0)-o),(o=p+h.height-r)>t.plotHeight&&(\"top\"===a?l.verticalAlign=\"bottom\":l.y=(l.y||0)+t.plotHeight-o),l}constructor(t,i,e){super(t,i,e,\"label\")}translatePoint(t,i){super.translatePoint(t,i,0)}translate(t,i){let e=this.annotation.chart,s=this.annotation.userOptions,o=e.annotations.indexOf(this.annotation),n=e.options.annotations[o];if(e.inverted){let e=t;t=i,i=e}this.options.x+=t,this.options.y+=i,n[this.collection][this.index].x=this.options.x,n[this.collection][this.index].y=this.options.y,s[this.collection][this.index].x=this.options.x,s[this.collection][this.index].y=this.options.y}render(t){let i=this.options,e=this.attrsFromOptions(i),s=i.style;this.graphic=this.annotation.chart.renderer.label(\"\",0,-9999,i.shape,null,null,i.useHTML,null,\"annotation-label\").attr(e).add(t),this.annotation.chart.styledMode||(\"contrast\"===s.color&&(s.color=this.annotation.chart.renderer.getContrast(tw.shapesWithoutBackground.indexOf(i.shape)>-1?\"#FFFFFF\":i.backgroundColor)),this.graphic.css(i.style).shadow(i.shadow)),this.graphic.labelrank=i.labelrank,super.render()}redraw(t){let i=this.options,e=this.text||i.format||i.text,s=this.graphic,o=this.points[0];if(!s){this.redraw(t);return}s.attr({text:e?tx(String(e),o,this.annotation.chart):i.formatter.call(o,this)});let n=this.anchor(o),a=this.position(n);a?(s.alignAttr=a,a.anchorX=n.absolutePosition.x,a.anchorY=n.absolutePosition.y,s[t?\"animate\":\"attr\"](a)):s.attr({x:0,y:-9999}),s.placed=!!a,super.redraw(t)}anchor(t){let i=super.anchor.apply(this,arguments),e=this.options.x||0,s=this.options.y||0;return i.absolutePosition.x-=e,i.absolutePosition.y-=s,i.relativePosition.x-=e,i.relativePosition.y-=s,i}position(t){let i=this.graphic,e=this.annotation.chart,s=e.tooltip,o=this.points[0],n=this.options,a=t.absolutePosition,r=t.relativePosition,h,l,c,p,d=o.series.visible&&j.prototype.isInsidePlot.call(o);if(i&&d){let{width:t=0,height:u=0}=i;n.distance&&s?h=s.getPosition.call({chart:e,distance:tA(n.distance,16),getPlayingField:s.getPlayingField,pointer:s.pointer},t,u,{plotX:r.x,plotY:r.y,negative:o.negative,ttBelow:o.ttBelow,h:r.height||r.width}):n.positioner?h=n.positioner.call(this):(l={x:a.x,y:a.y,width:0,height:0},h=tw.alignedPosition(tv(n,{width:t,height:u}),l),\"justify\"===this.options.overflow&&(h=tw.alignedPosition(tw.justifiedOptions(e,i,n,h),l))),n.crop&&(c=h.x-e.plotLeft,p=h.y-e.plotTop,d=e.isInsidePlot(c,p)&&e.isInsidePlot(c+t,p+u))}return d?h:null}}tw.attrsMap={backgroundColor:\"fill\",borderColor:\"stroke\",borderWidth:\"stroke-width\",zIndex:\"zIndex\",borderRadius:\"r\",padding:\"padding\"},tw.shapesWithoutBackground=[\"connector\"];class tC extends G{constructor(t,i,e){super(t,i,e,\"shape\"),this.type=\"image\",this.translate=super.translateShape}render(t){let i=this.attrsFromOptions(this.options),e=this.options;this.graphic=this.annotation.chart.renderer.image(e.src,0,-9e9,e.width,e.height).attr(i).add(t),this.graphic.width=e.width,this.graphic.height=e.height,super.render()}redraw(t){if(this.graphic){let i=this.anchor(this.points[0]),e=tw.prototype.position.call(this,i);e?this.graphic[t?\"animate\":\"attr\"]({x:e.x,y:e.y}):this.graphic.attr({x:0,y:-9e9}),this.graphic.placed=!!e}super.redraw(t)}}tC.attrsMap={width:\"width\",height:\"height\",zIndex:\"zIndex\"};var tE=c(660),tP=c.n(tE);let{addEvent:tO,createElement:tB}=u(),tM=class{constructor(t,i){this.iconsURL=i,this.container=this.createPopupContainer(t),this.closeButton=this.addCloseButton()}createPopupContainer(t,i=\"highcharts-popup highcharts-no-tooltip\"){return tB(\"div\",{className:i},void 0,t)}addCloseButton(t=\"highcharts-popup-close\"){let i=this,e=this.iconsURL,s=tB(\"button\",{className:t},void 0,this.container);return s.style[\"background-image\"]=\"url(\"+(e.match(/png|svg|jpeg|jpg|gif/ig)?e:e+\"close.svg\")+\")\",[\"click\",\"touchstart\"].forEach(t=>{tO(s,t,i.closeButtonEvents.bind(i))}),tO(document,\"keydown\",function(t){\"Escape\"===t.code&&i.closeButtonEvents()}),s}closeButtonEvents(){this.closePopup()}showPopup(t=\"highcharts-annotation-toolbar\"){let i=this.container,e=this.closeButton;this.type=void 0,i.innerHTML=tP().emptyHTML,i.className.indexOf(t)>=0&&(i.classList.remove(t),i.removeAttribute(\"style\")),i.appendChild(e),i.style.display=\"block\",i.style.height=\"\"}closePopup(){this.container.style.display=\"none\"}},{doc:tT,isFirefox:tN}=u(),{createElement:tD,isArray:tL,isObject:tI,objectEach:tS,pick:tY,stableSort:tX}=u();function tF(t,i,e,s,o,n){let a,r;if(!i)return;let h=this.addInput,l=this.lang;tS(s,(s,n)=>{a=\"\"!==e?e+\".\"+n:n,tI(s)&&(!tL(s)||tL(s)&&tI(s[0])?((r=l[n]||n).match(/\\d/g)||o.push([!0,r,t]),tF.call(this,t,i,a,s,o,!1)):o.push([this,a,\"annotation\",t,s]))}),n&&(tX(o,t=>t[1].match(/format/g)?-1:1),tN&&o.reverse(),o.forEach(t=>{!0===t[0]?tD(\"span\",{className:\"highcharts-annotation-title\"},void 0,t[2]).appendChild(tT.createTextNode(t[1])):(t[4]={value:t[4][0],type:t[4][1]},h.apply(t[0],t.splice(1)))}))}let{doc:tR}=u(),{seriesTypes:tU}=U(),{addEvent:tW,createElement:tH,defined:tV,isArray:tj,isObject:tq,objectEach:tz,stableSort:t_}=u();!function(t){t[t[\"params.algorithm\"]=0]=\"params.algorithm\",t[t[\"params.average\"]=1]=\"params.average\"}(a||(a={}));let tG={\"algorithm-pivotpoints\":[\"standard\",\"fibonacci\",\"camarilla\"],\"average-disparityindex\":[\"sma\",\"ema\",\"dema\",\"tema\",\"wma\"]};function tK(t){let i=tH(\"div\",{className:\"highcharts-popup-lhs-col\"},void 0,t),e=tH(\"div\",{className:\"highcharts-popup-rhs-col\"},void 0,t);return tH(\"div\",{className:\"highcharts-popup-rhs-col-wrapper\"},void 0,e),{lhsCol:i,rhsCol:e}}function tZ(t,i,e,s){let o=i.params||i.options.params;s.innerHTML=tP().emptyHTML,tH(\"h3\",{className:\"highcharts-indicator-title\"},void 0,s).appendChild(tR.createTextNode(t4(i,e).indicatorFullName)),tH(\"input\",{type:\"hidden\",name:\"highcharts-type-\"+e,value:e},void 0,s),t5.call(this,e,\"series\",t,s,i,i.linkedParent&&i.linkedParent.options.id),o.volumeSeriesID&&t5.call(this,e,\"volume\",t,s,i,i.linkedParent&&o.volumeSeriesID),tJ.call(this,t,\"params\",o,e,s)}function t$(t,i,e,s){function o(i,e){let s=g.parentNode.children[1];tZ.call(n,t,i,e,g),s&&(s.style.display=\"block\"),l&&i.options&&tH(\"input\",{type:\"hidden\",name:\"highcharts-id-\"+e,value:i.options.id},void 0,g).setAttribute(\"highcharts-data-series-id\",i.options.id)}let n=this,a=n.lang,r=i.querySelectorAll(\".highcharts-popup-lhs-col\")[0],h=i.querySelectorAll(\".highcharts-popup-rhs-col\")[0],l=\"edit\"===e,c=l?t.series:t.options.plotOptions||{};if(!t&&c)return;let p,d=[];l||tj(c)?tj(c)&&(d=t2.call(this,c)):d=t9.call(this,c,s),t_(d,(t,i)=>{let e=t.indicatorFullName.toLowerCase(),s=i.indicatorFullName.toLowerCase();return es?1:0}),r.children[1]&&r.children[1].remove();let u=tH(\"ul\",{className:\"highcharts-indicator-list\"},void 0,r),g=h.querySelectorAll(\".highcharts-popup-rhs-col-wrapper\")[0];if(d.forEach(t=>{let{indicatorFullName:i,indicatorType:e,series:s}=t;p=tH(\"li\",{className:\"highcharts-indicator-list\"},void 0,u);let n=tH(\"button\",{className:\"highcharts-indicator-list-item\",textContent:i},void 0,p);[\"click\",\"touchstart\"].forEach(t=>{tW(n,t,function(){o(s,e)})})}),d.length>0){let{series:t,indicatorType:i}=d[0];o(t,i)}else l||(tP().setElementHTML(g.parentNode.children[0],a.noFilterMatch||\"\"),g.parentNode.children[1].style.display=\"none\")}function tJ(t,i,e,s,o){if(!t)return;let n=this.addInput;tz(e,(e,r)=>{let h=i+\".\"+r;if(tV(e)&&h){if(tq(e)&&(n.call(this,h,s,o,{}),tJ.call(this,t,h,e,s,o)),h in a){let n=t0.call(this,s,h,o);t1.call(this,t,i,n,s,r,e)}else\"params.volumeSeriesID\"===h||tj(e)||n.call(this,h,s,o,{value:e,type:\"number\"})}})}function tQ(t,i){let e=this,s=i.querySelectorAll(\".highcharts-popup-lhs-col\")[0],o=this.lang.clearFilter,n=tH(\"div\",{className:\"highcharts-input-wrapper\"},void 0,s),a=function(i){t$.call(e,t,e.container,\"add\",i)},r=this.addInput(\"searchIndicators\",\"input\",n,{value:\"\",type:\"text\",htmlFor:\"search-indicators\",labelClassName:\"highcharts-input-search-indicators-label\"}),h=tH(\"a\",{textContent:o},void 0,n);r.classList.add(\"highcharts-input-search-indicators\"),h.classList.add(\"clear-filter-button\"),tW(r,\"input\",function(){a(this.value),this.value.length?h.style.display=\"inline-block\":h.style.display=\"none\"}),[\"click\",\"touchstart\"].forEach(t=>{tW(h,t,function(){r.value=\"\",a(\"\"),h.style.display=\"none\"})})}function t0(t,i,e){let s=i.split(\".\"),o=s[s.length-1],n=\"highcharts-\"+i+\"-type-\"+t,a=this.lang;tH(\"label\",{htmlFor:n},null,e).appendChild(tR.createTextNode(a[o]||i));let r=tH(\"select\",{name:n,className:\"highcharts-popup-field\",id:\"highcharts-select-\"+i},null,e);return r.setAttribute(\"id\",\"highcharts-select-\"+i),r}function t1(t,i,e,s,o,n,a){\"series\"===i||\"volume\"===i?t.series.forEach(t=>{let s=t.options,o=s.name||s.params?t.name:s.id||\"\";\"highcharts-navigator-series\"!==s.id&&s.id!==(a&&a.options&&a.options.id)&&(tV(n)||\"volume\"!==i||\"column\"!==t.type||(n=s.id),tH(\"option\",{value:s.id},void 0,e).appendChild(tR.createTextNode(o)))}):s&&o&&tG[o+\"-\"+s].forEach(t=>{tH(\"option\",{value:t},void 0,e).appendChild(tR.createTextNode(t))}),tV(n)&&(e.value=n)}function t9(t,i){let e;let s=this.chart&&this.chart.options.lang,o=s&&s.navigation&&s.navigation.popup&&s.navigation.popup.indicatorAliases,n=[];return tz(t,(t,s)=>{let a=t&&t.options;if(t.params||a&&a.params){let{indicatorFullName:a,indicatorType:r}=t4(t,s);if(i){let s=RegExp(i.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\"),\"i\"),h=o&&o[r]&&o[r].join(\" \")||\"\";(a.match(s)||h.match(s))&&(e={indicatorFullName:a,indicatorType:r,series:t},n.push(e))}else e={indicatorFullName:a,indicatorType:r,series:t},n.push(e)}}),n}function t2(t){let i=[];return t.forEach(t=>{t.is(\"sma\")&&i.push({indicatorFullName:t.name,indicatorType:t.type,series:t})}),i}function t4(t,i){let e=t.options,s=tU[i]&&tU[i].prototype.nameBase||i.toUpperCase(),o=i;return e&&e.type&&(o=t.options.type,s=t.name),{indicatorFullName:s,indicatorType:o}}function t5(t,i,e,s,o,n){if(!e)return;let a=t0.call(this,t,i,s);t1.call(this,e,i,a,void 0,void 0,void 0,o),tV(n)&&(a.value=n)}let{doc:t6}=u(),{addEvent:t7,createElement:t3}=u();function t8(){return t3(\"div\",{className:\"highcharts-tab-item-content highcharts-no-mousewheel\"},void 0,this.container)}function it(t,i){let e=this.container,s=this.lang,o=\"highcharts-tab-item\";0===i&&(o+=\" highcharts-tab-disabled\");let n=t3(\"button\",{className:o},void 0,e);return n.appendChild(t6.createTextNode(s[t+\"Button\"]||t)),n.setAttribute(\"highcharts-data-tab-type\",t),n}function ii(){let t=this.container,i=t.querySelectorAll(\".highcharts-tab-item\"),e=t.querySelectorAll(\".highcharts-tab-item-content\");for(let t=0;t{(0!==t||\"edit\"!==e.getAttribute(\"highcharts-data-tab-type\"))&&[\"click\",\"touchstart\"].forEach(t=>{t7(e,t,function(){ii.call(i),ie.call(i,this,s)})})})}let{doc:io}=u(),{getOptions:ia}=u(),{addEvent:ir,createElement:ih,extend:il,fireEvent:ic,pick:ip}=u();class id extends tM{constructor(t,i,e){super(t,i),this.chart=e,this.lang=(ia().lang.navigation||{}).popup||{},ir(this.container,\"mousedown\",()=>{let t=e&&e.navigationBindings&&e.navigationBindings.activeAnnotation;if(t){t.cancelClick=!0;let i=ir(io,\"click\",()=>{setTimeout(()=>{t.cancelClick=!1},0),i()})}})}addInput(t,i,e,s){let o=t.split(\".\"),n=o[o.length-1],a=this.lang,r=\"highcharts-\"+i+\"-\"+ip(s.htmlFor,n);n.match(/^\\d+$/)||ih(\"label\",{htmlFor:r,className:s.labelClassName},void 0,e).appendChild(io.createTextNode(a[n]||n));let h=ih(\"input\",{name:r,value:s.value,type:s.type,className:\"highcharts-popup-field\"},void 0,e);return h.setAttribute(\"highcharts-data-name\",t),h}closeButtonEvents(){if(this.chart){let t=this.chart.navigationBindings;ic(t,\"closePopup\"),t&&t.selectedButtonElement&&ic(t,\"deselectButton\",{button:t.selectedButtonElement})}else super.closeButtonEvents()}addButton(t,i,e,s,o){let n=ih(\"button\",void 0,void 0,t);return n.appendChild(io.createTextNode(i)),o&&[\"click\",\"touchstart\"].forEach(t=>{ir(n,t,()=>(this.closePopup(),o(function(t,i){let e=Array.prototype.slice.call(t.querySelectorAll(\"input\")),s=Array.prototype.slice.call(t.querySelectorAll(\"select\")),o=t.querySelectorAll(\"#highcharts-select-series > option:checked\")[0],n=t.querySelectorAll(\"#highcharts-select-volume > option:checked\")[0],a={actionType:i,linkedTo:o&&o.getAttribute(\"value\")||\"\",fields:{}};return e.forEach(t=>{let i=t.getAttribute(\"highcharts-data-name\");t.getAttribute(\"highcharts-data-series-id\")?a.seriesId=t.value:i?a.fields[i]=t.value:a.type=t.value}),s.forEach(t=>{let i=t.id;if(\"highcharts-select-series\"!==i&&\"highcharts-select-volume\"!==i){let e=i.split(\"highcharts-select-\")[1];a.fields[e]=t.value}}),n&&(a.fields[\"params.volumeSeriesID\"]=n.getAttribute(\"value\")||\"\"),a}(s,e))))}),n}showForm(t,i,e,s){i&&(this.showPopup(),\"indicators\"===t&&this.indicators.addForm.call(this,i,e,s),\"annotation-toolbar\"===t&&this.annotations.addToolbar.call(this,i,e,s),\"annotation-edit\"===t&&this.annotations.addForm.call(this,i,e,s),\"flag\"===t&&this.annotations.addForm.call(this,i,e,s,!0),this.type=t,this.container.style.height=this.container.offsetHeight+\"px\")}}il(id.prototype,{annotations:{addForm:function(t,i,e,s){if(!t)return;let o=this.container,n=this.lang,a=tD(\"h2\",{className:\"highcharts-popup-main-title\"},void 0,o);a.appendChild(tT.createTextNode(n[i.langKey]||i.langKey||\"\")),a=tD(\"div\",{className:\"highcharts-popup-lhs-col highcharts-popup-lhs-full\"},void 0,o);let r=tD(\"div\",{className:\"highcharts-popup-bottom-row\"},void 0,o);tF.call(this,a,t,\"\",i,[],!0),this.addButton(r,s?n.addButton||\"Add\":n.saveButton||\"Save\",s?\"add\":\"save\",o,e)},addToolbar:function(t,i,e){let s=this.lang,o=this.container,n=this.showForm,a=\"highcharts-annotation-toolbar\";-1===o.className.indexOf(a)&&(o.className+=\" \"+a+\" highcharts-no-mousewheel\"),t&&(o.style.top=t.plotTop+10+\"px\");let r=tD(\"p\",{className:\"highcharts-annotation-label\"},void 0,o);r.setAttribute(\"aria-label\",\"Annotation type\"),r.appendChild(tT.createTextNode(tY(s[i.langKey]||i.langKey,i.shapes&&i.shapes[0].type,\"\")));let h=this.addButton(o,s.editButton||\"Edit\",\"edit\",o,()=>{n.call(this,\"annotation-edit\",t,i,e)});h.className+=\" highcharts-annotation-edit-button\",h.style[\"background-image\"]=\"url(\"+this.iconsURL+\"edit.svg)\",h=this.addButton(o,s.removeButton||\"Remove\",\"remove\",o,e),h.className+=\" highcharts-annotation-remove-button\",h.style[\"background-image\"]=\"url(\"+this.iconsURL+\"destroy.svg)\"}},indicators:{addForm:function(t,i,e){let s;let o=this.lang;if(!t)return;this.tabs.init.call(this,t);let n=this.container.querySelectorAll(\".highcharts-tab-item-content\");tK(n[0]),tQ.call(this,t,n[0]),t$.call(this,t,n[0],\"add\"),s=n[0].querySelectorAll(\".highcharts-popup-rhs-col\")[0],this.addButton(s,o.addButton||\"add\",\"add\",s,e),tK(n[1]),t$.call(this,t,n[1],\"edit\"),s=n[1].querySelectorAll(\".highcharts-popup-rhs-col\")[0],this.addButton(s,o.saveButton||\"save\",\"edit\",s,e),this.addButton(s,o.removeButton||\"remove\",\"remove\",s,e)},getAmount:function(){let t=0;return this.series.forEach(i=>{(i.params||i.options.params)&&t++}),t}},tabs:{init:function(t){if(!t)return;let i=this.indicators.getAmount.call(t),e=it.call(this,\"add\");it.call(this,\"edit\",i),t8.call(this),t8.call(this),is.call(this,i),ie.call(this,e,0)}}});let{composed:iu}=u(),{addEvent:ig,pushUnique:im,wrap:ix}=u();function iv(){this.popup&&this.popup.closePopup()}function iy(t){this.popup||(this.popup=new id(this.chart.container,this.chart.options.navigation.iconsURL||this.chart.options.stockTools&&this.chart.options.stockTools.gui.iconsURL||\"https://code.highcharts.com/12.1.2/gfx/stock-icons/\",this.chart)),this.popup.showForm(t.formType,this.chart,t.options,t.onSubmit)}function ib(t,i){this.inClass(i.target,\"highcharts-popup\")||t.apply(this,Array.prototype.slice.call(arguments,1))}let iA={compose:function(t,i){im(iu,\"Popup\")&&(ig(t,\"closePopup\",iv),ig(t,\"showPopup\",iy),ix(i.prototype,\"onContainerMouseDown\",ib))}},{getDeferredAnimation:ik}=u(),{destroyObjectProperties:iw,erase:iC,fireEvent:iE,merge:iP,pick:iO,splat:iB}=u();function iM(t,i){let e={};return[\"labels\",\"shapes\"].forEach(s=>{let o=t[s],n=i[s];o&&(n?e[s]=iB(n).map((t,i)=>iP(o[i],t)):e[s]=t[s])}),e}class iT extends S{static compose(t,i,e,s){P.compose(iT,t,e),tw.compose(s),tr.compose(t,s),i.compose(iT,t),iA.compose(i,e)}constructor(t,i){super(),this.coll=\"annotations\",this.chart=t,this.points=[],this.controlPoints=[],this.coll=\"annotations\",this.index=-1,this.labels=[],this.shapes=[],this.options=iP(this.defaultOptions,i),this.userOptions=i;let e=iM(this.options,i);this.options.labels=e.labels,this.options.shapes=e.shapes,this.init(t,this.options)}addClipPaths(){this.setClipAxes(),this.clipXAxis&&this.clipYAxis&&this.options.crop&&(this.clipRect=this.chart.renderer.clipRect(this.getClipBox()))}addLabels(){let t=this.options.labels||[];t.forEach((i,e)=>{let s=this.initLabel(i,e);iP(!0,t[e],s.options)})}addShapes(){let t=this.options.shapes||[];t.forEach((i,e)=>{let s=this.initShape(i,e);iP(!0,t[e],s.options)})}destroy(){let t=this.chart,i=function(t){t.destroy()};this.labels.forEach(i),this.shapes.forEach(i),this.clipXAxis=null,this.clipYAxis=null,iC(t.labelCollectors,this.labelCollector),super.destroy(),this.destroyControlTarget(),iw(this,t)}destroyItem(t){iC(this[t.itemType+\"s\"],t),t.destroy()}getClipBox(){if(this.clipXAxis&&this.clipYAxis)return{x:this.clipXAxis.left,y:this.clipYAxis.top,width:this.clipXAxis.width,height:this.clipYAxis.height}}initProperties(t,i){this.setOptions(i);let e=iM(this.options,i);this.options.labels=e.labels,this.options.shapes=e.shapes,this.chart=t,this.points=[],this.controlPoints=[],this.coll=\"annotations\",this.userOptions=i,this.labels=[],this.shapes=[]}init(t,i,e=this.index){let s=this.chart,o=this.options.animation;this.index=e,this.linkPoints(),this.addControlPoints(),this.addShapes(),this.addLabels(),this.setLabelCollector(),this.animationConfig=ik(s,o)}initLabel(t,i){let e=new tw(this,iP(this.options.labelOptions,{controlPointOptions:this.options.controlPointOptions},t),i);return e.itemType=\"label\",this.labels.push(e),e}initShape(t,i){let e=iP(this.options.shapeOptions,{controlPointOptions:this.options.controlPointOptions},t),s=new iT.shapesMap[e.type](this,e,i);return s.itemType=\"shape\",this.shapes.push(s),s}redraw(t){this.linkPoints(),this.graphic||this.render(),this.clipRect&&this.clipRect.animate(this.getClipBox()),this.redrawItems(this.shapes,t),this.redrawItems(this.labels,t),this.redrawControlPoints(t)}redrawItem(t,i){t.linkPoints(),t.shouldBeDrawn()?(t.graphic||this.renderItem(t),t.redraw(iO(i,!0)&&t.graphic.placed),t.points.length&&function(t){let i=t.graphic,e=t.points.some(t=>!1!==t.series.visible&&!1!==t.visible);i&&(e?\"hidden\"===i.visibility&&i.show():i.hide())}(t)):this.destroyItem(t)}redrawItems(t,i){let e=t.length;for(;e--;)this.redrawItem(t[e],i)}remove(){return this.chart.removeAnnotation(this)}render(){let t=this.chart.renderer;this.graphic=t.g(\"annotation\").attr({opacity:0,zIndex:this.options.zIndex,visibility:this.options.visible?\"inherit\":\"hidden\"}).add(),this.shapesGroup=t.g(\"annotation-shapes\").add(this.graphic),this.options.crop&&this.shapesGroup.clip(this.chart.plotBoxClip),this.labelsGroup=t.g(\"annotation-labels\").attr({translateX:0,translateY:0}).add(this.graphic),this.addClipPaths(),this.clipRect&&this.graphic.clip(this.clipRect),this.renderItems(this.shapes),this.renderItems(this.labels),this.addEvents(),this.renderControlPoints()}renderItem(t){t.render(\"label\"===t.itemType?this.labelsGroup:this.shapesGroup)}renderItems(t){let i=t.length;for(;i--;)this.renderItem(t[i])}setClipAxes(){let t=this.chart.xAxis,i=this.chart.yAxis,e=(this.options.labels||[]).concat(this.options.shapes||[]).reduce((e,s)=>{let o=s&&(s.point||s.points&&s.points[0]);return[t[o&&o.xAxis]||e[0],i[o&&o.yAxis]||e[1]]},[]);this.clipXAxis=e[0],this.clipYAxis=e[1]}setControlPointsVisibility(t){let i=function(i){i.setControlPointsVisibility(t)};this.controlPoints.forEach(i=>{i.setVisibility(t)}),this.shapes.forEach(i),this.labels.forEach(i)}setLabelCollector(){let t=this;t.labelCollector=function(){return t.labels.reduce(function(t,i){return i.options.allowOverlap||t.push(i.graphic),t},[])},t.chart.labelCollectors.push(t.labelCollector)}setOptions(t){this.options=iP(this.defaultOptions,t)}setVisibility(t){let i=this.options,e=this.chart.navigationBindings,s=iO(t,!i.visible);if(this.graphic.attr(\"visibility\",s?\"inherit\":\"hidden\"),!s){let t=function(t){t.setControlPointsVisibility(s)};this.shapes.forEach(t),this.labels.forEach(t),e.activeAnnotation===this&&e.popup&&\"annotation-toolbar\"===e.popup.type&&iE(e,\"closePopup\")}i.visible=s}update(t,i){let e=this.chart,s=iM(this.userOptions,t),o=e.annotations.indexOf(this),n=iP(!0,this.userOptions,t);n.labels=s.labels,n.shapes=s.shapes,this.destroy(),this.initProperties(e,n),this.init(e,n),e.options.annotations[o]=this.options,this.isUpdating=!0,iO(i,!0)&&e.drawAnnotations(),iE(this,\"afterUpdate\"),this.isUpdating=!1}}iT.ControlPoint=F,iT.MockPoint=j,iT.shapesMap={rect:tl,circle:tp,ellipse:tg,path:tr,image:tC},iT.types={},iT.prototype.defaultOptions={visible:!0,animation:{},crop:!0,draggable:\"xy\",labelOptions:{align:\"center\",allowOverlap:!1,backgroundColor:\"rgba(0, 0, 0, 0.75)\",borderColor:\"#000000\",borderRadius:3,borderWidth:1,className:\"highcharts-no-tooltip\",crop:!1,formatter:function(){return O(this.y)?\"\"+this.y:\"Annotation label\"},includeInDataExport:!0,overflow:\"justify\",padding:5,shadow:!1,shape:\"callout\",style:{fontSize:\"0.7em\",fontWeight:\"normal\",color:\"contrast\"},useHTML:!1,verticalAlign:\"bottom\",x:0,y:-16},shapeOptions:{stroke:\"rgba(0, 0, 0, 0.75)\",strokeWidth:1,fill:\"rgba(0, 0, 0, 0.75)\",r:0,snap:2},controlPointOptions:{events:{},style:{cursor:\"pointer\",fill:\"#ffffff\",stroke:\"#000000\",\"stroke-width\":2},height:10,symbol:\"circle\",visible:!1,width:10},events:{},zIndex:6},iT.prototype.nonDOMEvents=[\"add\",\"afterUpdate\",\"drag\",\"remove\"],q.compose(iT),function(t){t.compose=function(t){return t.navigation||(t.navigation=new i(t)),t};class i{constructor(t){this.updates=[],this.chart=t}addUpdate(t){this.chart.navigation.updates.push(t)}update(t,i){this.updates.forEach(e=>{e.call(this.chart,t,i)})}}t.Additions=i}(r||(r={}));let iN=r,{defined:iD,isNumber:iL,pick:iI}=u(),iS={backgroundColor:\"string\",borderColor:\"string\",borderRadius:\"string\",color:\"string\",fill:\"string\",fontSize:\"string\",labels:\"string\",name:\"string\",stroke:\"string\",title:\"string\"},iY={annotationsFieldsTypes:iS,getAssignedAxis:function(t){return t.filter(t=>{let i=t.axis.getExtremes(),e=i.min,s=i.max,o=iI(t.axis.minPointOffset,0);return iL(e)&&iL(s)&&t.value>=e-o&&t.value<=s+o&&!t.axis.options.isInternal})[0]},getFieldType:function(t,i){let e=iS[t],s=typeof i;return iD(e)&&(s=e),({string:\"text\",number:\"number\",boolean:\"checkbox\"})[s]}},{getAssignedAxis:iX}=iY,{isNumber:iF,merge:iR}=u(),iU={lang:{navigation:{popup:{simpleShapes:\"Simple shapes\",lines:\"Lines\",circle:\"Circle\",ellipse:\"Ellipse\",rectangle:\"Rectangle\",label:\"Label\",shapeOptions:\"Shape options\",typeOptions:\"Details\",fill:\"Fill\",format:\"Text\",strokeWidth:\"Line width\",stroke:\"Line color\",title:\"Title\",name:\"Name\",labelOptions:\"Label options\",labels:\"Labels\",backgroundColor:\"Background color\",backgroundColors:\"Background colors\",borderColor:\"Border color\",borderRadius:\"Border radius\",borderWidth:\"Border width\",style:\"Style\",padding:\"Padding\",fontSize:\"Font size\",color:\"Color\",height:\"Height\",shapes:\"Shape options\"}}},navigation:{bindingsClassName:\"highcharts-bindings-container\",bindings:{circleAnnotation:{className:\"highcharts-circle-annotation\",start:function(t){let i=this.chart.pointer?.getCoordinates(t),e=i&&iX(i.xAxis),s=i&&iX(i.yAxis),o=this.chart.options.navigation;if(e&&s)return this.chart.addAnnotation(iR({langKey:\"circle\",type:\"basicAnnotation\",shapes:[{type:\"circle\",point:{x:e.value,y:s.value,xAxis:e.axis.index,yAxis:s.axis.index},r:5}]},o.annotationsOptions,o.bindings.circleAnnotation.annotationsOptions))},steps:[function(t,i){let e;let s=i.options.shapes,o=s&&s[0]&&s[0].point||{};if(iF(o.xAxis)&&iF(o.yAxis)){let i=this.chart.inverted,s=this.chart.xAxis[o.xAxis].toPixels(o.x),n=this.chart.yAxis[o.yAxis].toPixels(o.y);e=Math.max(Math.sqrt(Math.pow(i?n-t.chartX:s-t.chartX,2)+Math.pow(i?s-t.chartY:n-t.chartY,2)),5)}i.update({shapes:[{r:e}]})}]},ellipseAnnotation:{className:\"highcharts-ellipse-annotation\",start:function(t){let i=this.chart.pointer?.getCoordinates(t),e=i&&iX(i.xAxis),s=i&&iX(i.yAxis),o=this.chart.options.navigation;if(e&&s)return this.chart.addAnnotation(iR({langKey:\"ellipse\",type:\"basicAnnotation\",shapes:[{type:\"ellipse\",xAxis:e.axis.index,yAxis:s.axis.index,points:[{x:e.value,y:s.value},{x:e.value,y:s.value}],ry:1}]},o.annotationsOptions,o.bindings.ellipseAnnotation.annotationOptions))},steps:[function(t,i){let e=i.shapes[0],s=e.getAbsolutePosition(e.points[1]);e.translatePoint(t.chartX-s.x,t.chartY-s.y,1),e.redraw(!1)},function(t,i){let e=i.shapes[0],s=e.getAbsolutePosition(e.points[0]),o=e.getAbsolutePosition(e.points[1]),n=e.getDistanceFromLine(s,o,t.chartX,t.chartY),a=e.getYAxis(),r=Math.abs(a.toValue(0)-a.toValue(n));e.setYRadius(r),e.redraw(!1)}]},rectangleAnnotation:{className:\"highcharts-rectangle-annotation\",start:function(t){let i=this.chart.pointer?.getCoordinates(t),e=i&&iX(i.xAxis),s=i&&iX(i.yAxis);if(!e||!s)return;let o=e.value,n=s.value,a=e.axis.index,r=s.axis.index,h=this.chart.options.navigation;return this.chart.addAnnotation(iR({langKey:\"rectangle\",type:\"basicAnnotation\",shapes:[{type:\"path\",points:[{xAxis:a,yAxis:r,x:o,y:n},{xAxis:a,yAxis:r,x:o,y:n},{xAxis:a,yAxis:r,x:o,y:n},{xAxis:a,yAxis:r,x:o,y:n},{command:\"Z\"}]}]},h.annotationsOptions,h.bindings.rectangleAnnotation.annotationsOptions))},steps:[function(t,i){let e=i.options.shapes,s=e&&e[0]&&e[0].points||[],o=this.chart.pointer?.getCoordinates(t),n=o&&iX(o.xAxis),a=o&&iX(o.yAxis);if(n&&a){let t=n.value,e=a.value;s[1].x=t,s[2].x=t,s[2].y=e,s[3].y=e,i.update({shapes:[{points:s}]})}}]},labelAnnotation:{className:\"highcharts-label-annotation\",start:function(t){let i=this.chart.pointer?.getCoordinates(t),e=i&&iX(i.xAxis),s=i&&iX(i.yAxis),o=this.chart.options.navigation;if(e&&s)return this.chart.addAnnotation(iR({langKey:\"label\",type:\"basicAnnotation\",labelOptions:{format:\"{y:.2f}\",overflow:\"none\",crop:!0},labels:[{point:{xAxis:e.axis.index,yAxis:s.axis.index,x:e.value,y:s.value}}]},o.annotationsOptions,o.bindings.labelAnnotation.annotationsOptions))}}},events:{},annotationsOptions:{animation:{defer:0}}}},{setOptions:iW}=u(),{format:iH}=tf(),{composed:iV,doc:ij,win:iq}=u(),{getAssignedAxis:iz,getFieldType:i_}=iY,{addEvent:iG,attr:iK,defined:iZ,fireEvent:i$,isArray:iJ,isFunction:iQ,isNumber:i0,isObject:i1,merge:i9,objectEach:i2,pick:i4,pushUnique:i5}=u();function i6(){this.chart.navigationBindings&&this.chart.navigationBindings.deselectAnnotation()}function i7(){this.navigationBindings&&this.navigationBindings.destroy()}function i3(){let t=this.options;t&&t.navigation&&t.navigation.bindings&&(this.navigationBindings=new es(this,t.navigation),this.navigationBindings.initEvents(),this.navigationBindings.initUpdate())}function i8(){let t=this.navigationBindings,i=\"highcharts-disabled-btn\";if(this&&t){let e=!1;if(this.series.forEach(t=>{!t.options.isInternal&&t.visible&&(e=!0)}),this.navigationBindings&&this.navigationBindings.container&&this.navigationBindings.container[0]){let s=this.navigationBindings.container[0];i2(t.boundClassNames,(t,o)=>{let n=s.querySelectorAll(\".\"+o);if(n)for(let s=0;s=4||o.call(this,t)}})}class es{static compose(t,i){i5(iV,\"NavigationBindings\")&&(iG(t,\"remove\",i6),ee(t),i2(t.types,t=>{ee(t)}),iG(i,\"destroy\",i7),iG(i,\"load\",i3),iG(i,\"render\",i8),iG(es,\"closePopup\",et),iG(es,\"deselectButton\",ei),iW(iU))}constructor(t,i){this.boundClassNames=void 0,this.chart=t,this.options=i,this.eventsToUnbind=[],this.container=this.chart.container.getElementsByClassName(this.options.bindingsClassName||\"\"),this.container.length||(this.container=ij.getElementsByClassName(this.options.bindingsClassName||\"\"))}getCoords(t){let i=this.chart.pointer?.getCoordinates(t);return[i&&iz(i.xAxis),i&&iz(i.yAxis)]}initEvents(){let t=this,i=t.chart,e=t.container,s=t.options;t.boundClassNames={},i2(s.bindings||{},i=>{t.boundClassNames[i.className]=i}),[].forEach.call(e,i=>{t.eventsToUnbind.push(iG(i,\"click\",e=>{let s=t.getButtonEvents(i,e);s&&!s.button.classList.contains(\"highcharts-disabled-btn\")&&t.bindingsButtonClick(s.button,s.events,e)}))}),i2(s.events||{},(i,e)=>{iQ(i)&&t.eventsToUnbind.push(iG(t,e,i,{passive:!1}))}),t.eventsToUnbind.push(iG(i.container,\"click\",function(e){!i.cancelClick&&i.isInsidePlot(e.chartX-i.plotLeft,e.chartY-i.plotTop,{visiblePlotOnly:!0})&&t.bindingsChartClick(this,e)})),t.eventsToUnbind.push(iG(i.container,u().isTouchDevice?\"touchmove\":\"mousemove\",function(i){t.bindingsContainerMouseMove(this,i)},u().isTouchDevice?{passive:!1}:void 0))}initUpdate(){let t=this;iN.compose(this.chart).navigation.addUpdate(i=>{t.update(i)})}bindingsButtonClick(t,i,e){let s=this.chart,o=s.renderer.boxWrapper,n=!0;this.selectedButtonElement&&(this.selectedButtonElement.classList===t.classList&&(n=!1),i$(this,\"deselectButton\",{button:this.selectedButtonElement}),this.nextEvent&&(this.currentUserDetails&&\"annotations\"===this.currentUserDetails.coll&&s.removeAnnotation(this.currentUserDetails),this.mouseMoveEvent=this.nextEvent=!1)),n?(this.selectedButton=i,this.selectedButtonElement=t,i$(this,\"selectButton\",{button:t}),i.init&&i.init.call(this,t,e),(i.start||i.steps)&&s.renderer.boxWrapper.addClass(\"highcharts-draw-mode\")):(s.stockTools&&t.classList.remove(\"highcharts-active\"),o.removeClass(\"highcharts-draw-mode\"),this.nextEvent=!1,this.mouseMoveEvent=!1,this.selectedButton=null)}bindingsChartClick(t,i){t=this.chart;let e=this.activeAnnotation,s=this.selectedButton,o=t.renderer.boxWrapper;e&&(e.cancelClick||i.activeAnnotation||!i.target.parentNode||function(t,i){let e=iq.Element.prototype,s=e.matches||e.msMatchesSelector||e.webkitMatchesSelector,o=null;if(e.closest)o=e.closest.call(t,i);else do{if(s.call(t,i))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return o}(i.target,\".highcharts-popup\")?e.cancelClick&&setTimeout(()=>{e.cancelClick=!1},0):i$(this,\"closePopup\")),s&&s.start&&(this.nextEvent?(this.nextEvent(i,this.currentUserDetails),this.steps&&(this.stepIndex++,s.steps[this.stepIndex]?this.mouseMoveEvent=this.nextEvent=s.steps[this.stepIndex]:(i$(this,\"deselectButton\",{button:this.selectedButtonElement}),o.removeClass(\"highcharts-draw-mode\"),s.end&&s.end.call(this,i,this.currentUserDetails),this.nextEvent=!1,this.mouseMoveEvent=!1,this.selectedButton=null))):(this.currentUserDetails=s.start.call(this,i),this.currentUserDetails&&s.steps?(this.stepIndex=0,this.steps=!0,this.mouseMoveEvent=this.nextEvent=s.steps[this.stepIndex]):(i$(this,\"deselectButton\",{button:this.selectedButtonElement}),o.removeClass(\"highcharts-draw-mode\"),this.steps=!1,this.selectedButton=null,s.end&&s.end.call(this,i,this.currentUserDetails))))}bindingsContainerMouseMove(t,i){this.mouseMoveEvent&&this.mouseMoveEvent(i,this.currentUserDetails)}fieldsToOptions(t,i){return i2(t,(t,e)=>{let s=parseFloat(t),o=e.split(\".\"),n=o.length-1;if(!i0(s)||t.match(/px|em/g)||e.match(/format/g)||(t=s),\"undefined\"!==t){let e=i;o.forEach((i,s)=>{if(\"__proto__\"!==i&&\"constructor\"!==i){let a=i4(o[s+1],\"\");n===s?e[i]=t:(e[i]||(e[i]=a.match(/\\d/g)?[]:{}),e=e[i])}})}}),i}deselectAnnotation(){this.activeAnnotation&&(this.activeAnnotation.setControlPointsVisibility(!1),this.activeAnnotation=!1)}annotationToFields(t){let i=t.options,e=es.annotationsEditable,s=e.nestedOptions,o=i4(i.type,i.shapes&&i.shapes[0]&&i.shapes[0].type,i.labels&&i.labels[0]&&i.labels[0].type,\"label\"),n=es.annotationsNonEditable[i.langKey]||[],a={langKey:i.langKey,type:o};function r(i,e,o,a,h){let l;o&&iZ(i)&&-1===n.indexOf(e)&&((o.indexOf&&o.indexOf(e))>=0||o[e]||!0===o)&&(iJ(i)?(a[e]=[],i.forEach((t,i)=>{i1(t)?(a[e][i]={},i2(t,(t,o)=>{r(t,o,s[e],a[e][i],e)})):r(t,0,s[e],a[e],e)})):i1(i)?(l={},iJ(a)?(a.push(l),l[e]={},l=l[e]):a[e]=l,i2(i,(t,i)=>{r(t,i,0===e?o:s[e],l,e)})):\"format\"===e?a[e]=[iH(i,t.labels[0].points[0]).toString(),\"text\"]:iJ(a)?a.push([i,i_(h,i)]):a[e]=[i,i_(e,i)])}return i2(i,(t,n)=>{\"typeOptions\"===n?(a[n]={},i2(i[n],(t,i)=>{r(t,i,s,a[n],i)})):r(t,n,e[o],a,n)}),a}getClickedClassNames(t,i){let e=i.target,s=[],o;for(;e&&e.tagName&&((o=iK(e,\"class\"))&&(s=s.concat(o.split(\" \").map(t=>[t,e]))),(e=e.parentNode)!==t););return s}getButtonEvents(t,i){let e;let s=this;return this.getClickedClassNames(t,i).forEach(t=>{s.boundClassNames[t[0]]&&!e&&(e={events:s.boundClassNames[t[0]],button:t[1]})}),e}update(t){this.options=i9(!0,this.options,t),this.removeEvents(),this.initEvents()}removeEvents(){this.eventsToUnbind.forEach(t=>t())}destroy(){this.removeEvents()}}es.annotationsEditable={nestedOptions:{labelOptions:[\"style\",\"format\",\"backgroundColor\"],labels:[\"style\"],label:[\"style\"],style:[\"fontSize\",\"color\"],background:[\"fill\",\"strokeWidth\",\"stroke\"],innerBackground:[\"fill\",\"strokeWidth\",\"stroke\"],outerBackground:[\"fill\",\"strokeWidth\",\"stroke\"],shapeOptions:[\"fill\",\"strokeWidth\",\"stroke\"],shapes:[\"fill\",\"strokeWidth\",\"stroke\"],line:[\"strokeWidth\",\"stroke\"],backgroundColors:[!0],connector:[\"fill\",\"strokeWidth\",\"stroke\"],crosshairX:[\"strokeWidth\",\"stroke\"],crosshairY:[\"strokeWidth\",\"stroke\"]},circle:[\"shapes\"],ellipse:[\"shapes\"],verticalLine:[],label:[\"labelOptions\"],measure:[\"background\",\"crosshairY\",\"crosshairX\"],fibonacci:[],tunnel:[\"background\",\"line\",\"height\"],pitchfork:[\"innerBackground\",\"outerBackground\"],rect:[\"shapes\"],crookedLine:[],basicAnnotation:[\"shapes\",\"labelOptions\"]},es.annotationsNonEditable={rectangle:[\"crosshairX\",\"crosshairY\",\"labelOptions\"],ellipse:[\"labelOptions\"],circle:[\"labelOptions\"]};let eo=u();eo.Annotation=eo.Annotation||iT,eo.NavigationBindings=eo.NavigationBindings||es,eo.Annotation.compose(eo.Chart,eo.NavigationBindings,eo.Pointer,eo.SVGRenderer);let en=u();return p.default})());", "!/**\n * Highcharts JS v12.1.2 (2024-12-21)\n * @module highcharts/modules/exporting\n * @requires highcharts\n *\n * Exporting module\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n */function(e,t){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=t(e._Highcharts,e._Highcharts.AST,e._Highcharts.Chart):\"function\"==typeof define&&define.amd?define(\"highcharts/modules/exporting\",[\"highcharts/highcharts\"],function(e){return t(e,e.AST,e.Chart)}):\"object\"==typeof exports?exports[\"highcharts/modules/exporting\"]=t(e._Highcharts,e._Highcharts.AST,e._Highcharts.Chart):e.Highcharts=t(e.Highcharts,e.Highcharts.AST,e.Highcharts.Chart)}(\"undefined\"==typeof window?this:window,(e,t,n)=>(()=>{\"use strict\";var i,o,r,s={660:e=>{e.exports=t},960:e=>{e.exports=n},944:t=>{t.exports=e}},l={};function a(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}};return s[e](n,n.exports,a),n.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var c={};a.d(c,{default:()=>_});var p=a(944),h=a.n(p),u=a(660),d=a.n(u);a(960),function(e){e.compose=function(e){return e.navigation||(e.navigation=new t(e)),e};class t{constructor(e){this.updates=[],this.chart=e}addUpdate(e){this.chart.navigation.updates.push(e)}update(e,t){this.updates.forEach(n=>{n.call(this.chart,e,t)})}}e.Additions=t}(i||(i={}));let g=i,{isTouchDevice:f}=h(),m={exporting:{allowTableSorting:!0,type:\"image/png\",url:\"https://export-svg.highcharts.com/\",pdfFont:{normal:void 0,bold:void 0,bolditalic:void 0,italic:void 0},printMaxWidth:780,scale:2,buttons:{contextButton:{className:\"highcharts-contextbutton\",menuClassName:\"highcharts-contextmenu\",symbol:\"menu\",titleKey:\"contextButtonTitle\",menuItems:[\"viewFullscreen\",\"printChart\",\"separator\",\"downloadPNG\",\"downloadJPEG\",\"downloadSVG\"],y:-5}},menuItemDefinitions:{viewFullscreen:{textKey:\"viewFullscreen\",onclick:function(){this.fullscreen&&this.fullscreen.toggle()}},printChart:{textKey:\"printChart\",onclick:function(){this.print()}},separator:{separator:!0},downloadPNG:{textKey:\"downloadPNG\",onclick:function(){this.exportChart()}},downloadJPEG:{textKey:\"downloadJPEG\",onclick:function(){this.exportChart({type:\"image/jpeg\"})}},downloadPDF:{textKey:\"downloadPDF\",onclick:function(){this.exportChart({type:\"application/pdf\"})}},downloadSVG:{textKey:\"downloadSVG\",onclick:function(){this.exportChart({type:\"image/svg+xml\"})}}}},lang:{viewFullscreen:\"View in full screen\",exitFullscreen:\"Exit from full screen\",printChart:\"Print chart\",downloadPNG:\"Download PNG image\",downloadJPEG:\"Download JPEG image\",downloadPDF:\"Download PDF document\",downloadSVG:\"Download SVG vector image\",contextButtonTitle:\"Chart context menu\"},navigation:{buttonOptions:{symbolSize:14,symbolX:14.5,symbolY:13.5,align:\"right\",buttonSpacing:5,height:28,verticalAlign:\"top\",width:28,symbolFill:\"#666666\",symbolStroke:\"#666666\",symbolStrokeWidth:3,theme:{fill:\"#ffffff\",padding:5,stroke:\"none\",\"stroke-linecap\":\"round\"}},menuStyle:{border:\"none\",borderRadius:\"3px\",background:\"#ffffff\",padding:\"0.5em\"},menuItemStyle:{background:\"none\",borderRadius:\"3px\",color:\"#333333\",padding:\"0.5em\",fontSize:f?\"0.9em\":\"0.8em\",transition:\"background 250ms, color 250ms\"},menuItemHoverStyle:{background:\"#f2f2f2\"}}};!function(e){let t=[];function n(e,t,n,i){return[[\"M\",e,t+2.5],[\"L\",e+n,t+2.5],[\"M\",e,t+i/2+.5],[\"L\",e+n,t+i/2+.5],[\"M\",e,t+i-1.5],[\"L\",e+n,t+i-1.5]]}function i(e,t,n,i){let o=i/3-2;return[].concat(this.circle(n-o,t,o,o),this.circle(n-o,t+o+4,o,o),this.circle(n-o,t+2*(o+4),o,o))}e.compose=function(e){if(-1===t.indexOf(e)){t.push(e);let o=e.prototype.symbols;o.menu=n,o.menuball=i.bind(o)}}}(o||(o={}));let x=o,{composed:y}=h(),{addEvent:b,fireEvent:v,pushUnique:w}=h();function S(){this.fullscreen=new E(this)}class E{static compose(e){w(y,\"Fullscreen\")&&b(e,\"beforeRender\",S)}constructor(e){this.chart=e,this.isOpen=!1;let t=e.renderTo;!this.browserProps&&(\"function\"==typeof t.requestFullscreen?this.browserProps={fullscreenChange:\"fullscreenchange\",requestFullscreen:\"requestFullscreen\",exitFullscreen:\"exitFullscreen\"}:t.mozRequestFullScreen?this.browserProps={fullscreenChange:\"mozfullscreenchange\",requestFullscreen:\"mozRequestFullScreen\",exitFullscreen:\"mozCancelFullScreen\"}:t.webkitRequestFullScreen?this.browserProps={fullscreenChange:\"webkitfullscreenchange\",requestFullscreen:\"webkitRequestFullScreen\",exitFullscreen:\"webkitExitFullscreen\"}:t.msRequestFullscreen&&(this.browserProps={fullscreenChange:\"MSFullscreenChange\",requestFullscreen:\"msRequestFullscreen\",exitFullscreen:\"msExitFullscreen\"}))}close(){let e=this,t=e.chart,n=t.options.chart;v(t,\"fullscreenClose\",null,function(){e.isOpen&&e.browserProps&&t.container.ownerDocument instanceof Document&&t.container.ownerDocument[e.browserProps.exitFullscreen](),e.unbindFullscreenEvent&&(e.unbindFullscreenEvent=e.unbindFullscreenEvent()),t.setSize(e.origWidth,e.origHeight,!1),e.origWidth=void 0,e.origHeight=void 0,n.width=e.origWidthOption,n.height=e.origHeightOption,e.origWidthOption=void 0,e.origHeightOption=void 0,e.isOpen=!1,e.setButtonText()})}open(){let e=this,t=e.chart,n=t.options.chart;v(t,\"fullscreenOpen\",null,function(){if(n&&(e.origWidthOption=n.width,e.origHeightOption=n.height),e.origWidth=t.chartWidth,e.origHeight=t.chartHeight,e.browserProps){let n=b(t.container.ownerDocument,e.browserProps.fullscreenChange,function(){e.isOpen?(e.isOpen=!1,e.close()):(t.setSize(null,null,!1),e.isOpen=!0,e.setButtonText())}),i=b(t,\"destroy\",n);e.unbindFullscreenEvent=()=>{n(),i()};let o=t.renderTo[e.browserProps.requestFullscreen]();o&&o.catch(function(){alert(\"Full screen is not supported inside a frame.\")})}})}setButtonText(){let e=this.chart,t=e.exportDivElements,n=e.options.exporting,i=n&&n.buttons&&n.buttons.contextButton.menuItems,o=e.options.lang;if(n&&n.menuItemDefinitions&&o&&o.exitFullscreen&&o.viewFullscreen&&i&&t){let e=t[i.indexOf(\"viewFullscreen\")];e&&d().setElementHTML(e,this.isOpen?o.exitFullscreen:n.menuItemDefinitions.viewFullscreen.text||o.viewFullscreen)}}toggle(){this.isOpen?this.close():this.open()}}let{win:C}=h(),{discardElement:T,objectEach:O}=h(),F={ajax:function(e){let t={json:\"application/json\",xml:\"application/xml\",text:\"text/plain\",octet:\"application/octet-stream\"},n=new XMLHttpRequest;function i(t,n){e.error&&e.error(t,n)}if(!e.url)return!1;n.open((e.type||\"get\").toUpperCase(),e.url,!0),e.headers&&e.headers[\"Content-Type\"]||n.setRequestHeader(\"Content-Type\",t[e.dataType||\"json\"]||t.text),O(e.headers,function(e,t){n.setRequestHeader(t,e)}),e.responseType&&(n.responseType=e.responseType),n.onreadystatechange=function(){let t;if(4===n.readyState){if(200===n.status){if(\"blob\"!==e.responseType&&(t=n.responseText,\"json\"===e.dataType))try{t=JSON.parse(t)}catch(e){if(e instanceof Error)return i(n,e)}return e.success&&e.success(t,n)}i(n,n.responseText)}},e.data&&\"string\"!=typeof e.data&&(e.data=JSON.stringify(e.data)),n.send(e.data)},getJSON:function(e,t){F.ajax({url:e,success:t,dataType:\"json\",headers:{\"Content-Type\":\"text/plain\"}})},post:function(e,t,n){let i=new C.FormData;O(t,function(e,t){i.append(t,e)}),i.append(\"b64\",\"true\");let{filename:o,type:r}=t;return C.fetch(e,{method:\"POST\",body:i,...n}).then(e=>{e.ok&&e.text().then(e=>{let t=document.createElement(\"a\");t.href=`data:${r};base64,${e}`,t.download=o,t.click(),T(t)})})}},{defaultOptions:P}=h(),{doc:M,SVG_NS:k,win:H}=h(),{addEvent:N,css:D,createElement:G,discardElement:I,extend:W,find:R,fireEvent:j,isObject:q,merge:V,objectEach:$,pick:z,removeEvent:L,splat:A,uniqueKey:K}=h();!function(e){let t;let n=[/-/,/^(clipPath|cssText|d|height|width)$/,/^font$/,/[lL]ogical(Width|Height)$/,/^parentRule$/,/^(cssRules|ownerRules)$/,/perspective/,/TapHighlightColor/,/^transition/,/^length$/,/^\\d+$/],i=[\"fill\",\"stroke\",\"strokeLinecap\",\"strokeLinejoin\",\"strokeWidth\",\"textAnchor\",\"x\",\"y\"];e.inlineAllowlist=[];let o=[\"clipPath\",\"defs\",\"desc\"];function r(e){let t,n;let i=this,o=i.renderer,r=V(i.options.navigation.buttonOptions,e),s=r.onclick,l=r.menuItems,a=r.symbolSize||12;if(i.btnCount||(i.btnCount=0),i.exportDivElements||(i.exportDivElements=[],i.exportSVGElements=[]),!1===r.enabled||!r.theme)return;let c=i.styledMode?{}:r.theme;s?n=function(e){e&&e.stopPropagation(),s.call(i,e)}:l&&(n=function(e){e&&e.stopPropagation(),i.contextMenu(p.menuClassName,l,p.translateX||0,p.translateY||0,p.width||0,p.height||0,p),p.setState(2)}),r.text&&r.symbol?c.paddingLeft=z(c.paddingLeft,30):r.text||W(c,{width:r.width,height:r.height,padding:0});let p=o.button(r.text,0,0,n,c,void 0,void 0,void 0,void 0,r.useHTML).addClass(e.className).attr({title:z(i.options.lang[r._titleKey||r.titleKey],\"\")});p.menuClassName=e.menuClassName||\"highcharts-menu-\"+i.btnCount++,r.symbol&&(t=o.symbol(r.symbol,Math.round((r.symbolX||0)-a/2),Math.round((r.symbolY||0)-a/2),a,a,{width:a,height:a}).addClass(\"highcharts-button-symbol\").attr({zIndex:1}).add(p),i.styledMode||t.attr({stroke:r.symbolStroke,fill:r.symbolFill,\"stroke-width\":r.symbolStrokeWidth||1})),p.add(i.exportingGroup).align(W(r,{width:p.width,x:z(r.x,i.buttonOffset)}),!0,\"spacingBox\"),i.buttonOffset+=((p.width||0)+r.buttonSpacing)*(\"right\"===r.align?-1:1),i.exportSVGElements.push(p,t)}function s(){if(!this.printReverseInfo)return;let{childNodes:e,origDisplay:n,resetParams:i}=this.printReverseInfo;this.moveContainers(this.renderTo),[].forEach.call(e,function(e,t){1===e.nodeType&&(e.style.display=n[t]||\"\")}),this.isPrinting=!1,i&&this.setSize.apply(this,i),delete this.printReverseInfo,t=void 0,j(this,\"afterPrint\")}function l(){let e=M.body,t=this.options.exporting.printMaxWidth,n={childNodes:e.childNodes,origDisplay:[],resetParams:void 0};this.isPrinting=!0,this.pointer?.reset(void 0,0),j(this,\"beforePrint\"),t&&this.chartWidth>t&&(n.resetParams=[this.options.chart.width,void 0,!1],this.setSize(t,void 0,!1)),[].forEach.call(n.childNodes,function(e,t){1===e.nodeType&&(n.origDisplay[t]=e.style.display,e.style.display=\"none\")}),this.moveContainers(e),this.printReverseInfo=n}function a(e){e.renderExporting(),N(e,\"redraw\",e.renderExporting),N(e,\"destroy\",e.destroyExport)}function c(e,t,n,i,o,r,s){let l=this,a=l.options.navigation,c=l.chartWidth,p=l.chartHeight,u=\"cache-\"+e,g=Math.max(o,r),f,m=l[u];m||(l.exportContextMenu=l[u]=m=G(\"div\",{className:e},{position:\"absolute\",zIndex:1e3,padding:g+\"px\",pointerEvents:\"auto\",...l.renderer.style},l.scrollablePlotArea?.fixedDiv||l.container),f=G(\"ul\",{className:\"highcharts-menu\"},l.styledMode?{}:{listStyle:\"none\",margin:0,padding:0},m),l.styledMode||D(f,W({MozBoxShadow:\"3px 3px 10px #888\",WebkitBoxShadow:\"3px 3px 10px #888\",boxShadow:\"3px 3px 10px #888\"},a.menuStyle)),m.hideMenu=function(){D(m,{display:\"none\"}),s&&s.setState(0),l.openMenu=!1,D(l.renderTo,{overflow:\"hidden\"}),D(l.container,{overflow:\"hidden\"}),h().clearTimeout(m.hideTimer),j(l,\"exportMenuHidden\")},l.exportEvents.push(N(m,\"mouseleave\",function(){m.hideTimer=H.setTimeout(m.hideMenu,500)}),N(m,\"mouseenter\",function(){h().clearTimeout(m.hideTimer)}),N(M,\"mouseup\",function(t){l.pointer?.inClass(t.target,e)||m.hideMenu()}),N(m,\"click\",function(){l.openMenu&&m.hideMenu()})),t.forEach(function(e){if(\"string\"==typeof e&&(e=l.options.exporting.menuItemDefinitions[e]),q(e,!0)){let t;e.separator?t=G(\"hr\",void 0,void 0,f):(\"viewData\"===e.textKey&&l.isDataTableVisible&&(e.textKey=\"hideData\"),t=G(\"li\",{className:\"highcharts-menu-item\",onclick:function(t){t&&t.stopPropagation(),m.hideMenu(),\"string\"!=typeof e&&e.onclick&&e.onclick.apply(l,arguments)}},void 0,f),d().setElementHTML(t,e.text||l.options.lang[e.textKey]),l.styledMode||(t.onmouseover=function(){D(this,a.menuItemHoverStyle)},t.onmouseout=function(){D(this,a.menuItemStyle)},D(t,W({cursor:\"pointer\"},a.menuItemStyle||{})))),l.exportDivElements.push(t)}}),l.exportDivElements.push(f,m),l.exportMenuWidth=m.offsetWidth,l.exportMenuHeight=m.offsetHeight);let x={display:\"block\"};n+(l.exportMenuWidth||0)>c?x.right=c-n-o-g+\"px\":x.left=n-g+\"px\",i+r+(l.exportMenuHeight||0)>p&&s.alignOptions?.verticalAlign!==\"top\"?x.bottom=p-i-g+\"px\":x.top=i+r-g+\"px\",D(m,x),D(l.renderTo,{overflow:\"\"}),D(l.container,{overflow:\"\"}),l.openMenu=!0,j(l,\"exportMenuShown\")}function p(e){let t;let n=e?e.target:this,i=n.exportSVGElements,o=n.exportDivElements,r=n.exportEvents;i&&(i.forEach((e,o)=>{e&&(e.onclick=e.ontouchstart=null,n[t=\"cache-\"+e.menuClassName]&&delete n[t],i[o]=e.destroy())}),i.length=0),n.exportingGroup&&(n.exportingGroup.destroy(),delete n.exportingGroup),o&&(o.forEach(function(e,t){e&&(h().clearTimeout(e.hideTimer),L(e,\"mouseleave\"),o[t]=e.onmouseout=e.onmouseover=e.ontouchstart=e.onclick=null,I(e))}),o.length=0),r&&(r.forEach(function(e){e()}),r.length=0)}function u(e,t){let n=this.getSVGForExport(e,t);e=V(this.options.exporting,e),F.post(e.url,{filename:e.filename?e.filename.replace(/\\//g,\"-\"):this.getFilename(),type:e.type,width:e.width,scale:e.scale,svg:n},e.fetchOptions)}function f(e){return e&&this.inlineStyles(),this.container.innerHTML}function y(){let e=this.userOptions.title&&this.userOptions.title.text,t=this.options.exporting.filename;return t?t.replace(/\\//g,\"-\"):(\"string\"==typeof e&&(t=e.toLowerCase().replace(/<\\/?[^>]+(>|$)/g,\"\").replace(/[\\s_]+/g,\"-\").replace(/[^a-z\\d\\-]/g,\"\").replace(/^[\\-]+/g,\"\").replace(/[\\-]+/g,\"-\").substr(0,24).replace(/[\\-]+$/g,\"\")),(!t||t.length<5)&&(t=\"chart\"),t)}function b(e){let t,n,i=V(this.options,e);i.plotOptions=V(this.userOptions.plotOptions,e&&e.plotOptions),i.time=V(this.userOptions.time,e&&e.time);let o=G(\"div\",null,{position:\"absolute\",top:\"-9999em\",width:this.chartWidth+\"px\",height:this.chartHeight+\"px\"},M.body),r=this.renderTo.style.width,s=this.renderTo.style.height,l=i.exporting.sourceWidth||i.chart.width||/px$/.test(r)&&parseInt(r,10)||(i.isGantt?800:600),a=i.exporting.sourceHeight||i.chart.height||/px$/.test(s)&&parseInt(s,10)||400;W(i.chart,{animation:!1,renderTo:o,forExport:!0,renderer:\"SVGRenderer\",width:l,height:a}),i.exporting.enabled=!1,delete i.data,i.series=[],this.series.forEach(function(e){(n=V(e.userOptions,{animation:!1,enableMouseTracking:!1,showCheckbox:!1,visible:e.visible})).isInternal||i.series.push(n)});let c={};this.axes.forEach(function(e){e.userOptions.internalKey||(e.userOptions.internalKey=K()),e.options.isInternal||(c[e.coll]||(c[e.coll]=!0,i[e.coll]=[]),i[e.coll].push(V(e.userOptions,{visible:e.visible,type:e.type,uniqueNames:e.uniqueNames})))}),i.colorAxis=this.userOptions.colorAxis;let p=new this.constructor(i,this.callback);return e&&[\"xAxis\",\"yAxis\",\"series\"].forEach(function(t){let n={};e[t]&&(n[t]=e[t],p.update(n))}),this.axes.forEach(function(t){let n=R(p.axes,e=>e.options.internalKey===t.userOptions.internalKey);if(n){let i=t.getExtremes(),o=A(e?.[t.coll]||{})[0],r=\"min\"in o?o.min:i.userMin,s=\"max\"in o?o.max:i.userMax;(void 0!==r&&r!==n.min||void 0!==s&&s!==n.max)&&n.setExtremes(r??void 0,s??void 0,!0,!1)}}),t=p.getChartHTML(this.styledMode||i.exporting?.applyStyleSheets),j(this,\"getSVG\",{chartCopy:p}),t=this.sanitizeSVG(t,i),i=null,p.destroy(),I(o),t}function v(e,t){let n=this.options.exporting;return this.getSVG(V({chart:{borderRadius:0}},n.chartOptions,t,{exporting:{sourceWidth:e&&e.sourceWidth||n.sourceWidth,sourceHeight:e&&e.sourceHeight||n.sourceHeight}}))}function w(){let t;let r=e.inlineAllowlist,s={},l=M.createElement(\"iframe\");D(l,{width:\"1px\",height:\"1px\",visibility:\"hidden\"}),M.body.appendChild(l);let a=l.contentWindow&&l.contentWindow.document;a&&a.body.appendChild(a.createElementNS(k,\"svg\")),function e(l){let c,p,u,d,g,f;let m={};if(a&&1===l.nodeType&&-1===o.indexOf(l.nodeName)){if(c=H.getComputedStyle(l,null),p=\"svg\"===l.nodeName?{}:H.getComputedStyle(l.parentNode,null),!s[l.nodeName]){t=a.getElementsByTagName(\"svg\")[0],u=a.createElementNS(l.namespaceURI,l.nodeName),t.appendChild(u);let e=H.getComputedStyle(u,null),n={};for(let t in e)t.length<1e3&&\"string\"==typeof e[t]&&!/^\\d+$/.test(t)&&(n[t]=e[t]);s[l.nodeName]=n,\"text\"===l.nodeName&&delete s.text.fill,t.removeChild(u)}for(let e in c)(h().isFirefox||h().isMS||h().isSafari||Object.hasOwnProperty.call(c,e))&&function(e,t){if(d=g=!1,r.length){for(f=r.length;f--&&!g;)g=r[f].test(t);d=!g}for(\"transform\"===t&&\"none\"===e&&(d=!0),f=n.length;f--&&!d;){if(t.length>1e3)throw Error(\"Input too long\");d=n[f].test(t)||\"function\"==typeof e}!d&&(p[t]!==e||\"svg\"===l.nodeName)&&s[l.nodeName][t]!==e&&(i&&-1===i.indexOf(t)?m[t]=e:e&&l.setAttribute(t.replace(/[A-Z]/g,function(e){return\"-\"+e.toLowerCase()}),e))}(c[e],e);if(D(l,m),\"svg\"===l.nodeName&&l.setAttribute(\"stroke-width\",\"1px\"),\"text\"===l.nodeName)return;[].forEach.call(l.children||l.childNodes,e)}}(this.container.querySelector(\"svg\")),t.parentNode.removeChild(t),l.parentNode.removeChild(l)}function S(e){let{scrollablePlotArea:t}=this;(t?[t.fixedDiv,t.scrollingContainer]:[this.container]).forEach(function(t){e.appendChild(t)})}function C(){let e=this,t=(t,n,i)=>{e.isDirtyExporting=!0,V(!0,e.options[t],n),z(i,!0)&&e.redraw()};e.exporting={update:function(e,n){t(\"exporting\",e,n)}},g.compose(e).navigation.addUpdate((e,n)=>{t(\"navigation\",e,n)})}function T({alignTo:e,key:t,textPxLength:n}){let i=this.options.exporting,{align:o,buttonSpacing:r=0,verticalAlign:s,width:l=0}=V(this.options.navigation?.buttonOptions,i?.buttons?.contextButton),a=e.width-n,c=l+r;(i?.enabled??!0)&&\"title\"===t&&\"right\"===o&&\"top\"===s&&a<2*c&&(a{H.focus(),H.print(),h().isSafari||setTimeout(()=>{e.afterPrint()},1e3)},1))}function B(){let e=this,t=e.options.exporting,n=t.buttons,i=e.isDirtyExporting||!e.exportSVGElements;e.buttonOffset=0,e.isDirtyExporting&&e.destroyExport(),i&&!1!==t.enabled&&(e.exportEvents=[],e.exportingGroup=e.exportingGroup||e.renderer.g(\"exporting-group\").attr({zIndex:3}).add(),$(n,function(t){e.addButton(t)}),e.isDirtyExporting=!1)}function J(e,t){let n=e.indexOf(\"\")+6,i=e.substr(n);return e=e.substr(0,n),t&&t.exporting&&t.exporting.allowHTML&&i&&(i=''+i.replace(/(<(?:img|br).*?(?=\\>))>/g,\"$1 />\")+\"\",e=e.replace(\"\",i+\"\")),e=e.replace(/zIndex=\"[^\"]+\"/g,\"\").replace(/symbolName=\"[^\"]+\"/g,\"\").replace(/jQuery\\d+=\"[^\"]+\"/g,\"\").replace(/url\\((\"|")(.*?)(\"|")\\;?\\)/g,\"url($2)\").replace(/url\\([^#]+#/g,\"url(#\").replace(/(()=>{\"use strict\";var o={984:t=>{t.exports=e},944:e=>{e.exports=t}},r={};function a(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={exports:{}};return o[t](i,i.exports,a),i.exports}a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var o in e)a.o(e,o)&&!a.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var i={};a.d(i,{default:()=>B});var h=a(944),n=a.n(h),l=a(984),s=a.n(l);let c={enabled:!0,connectorAllowed:!1,connectorNeighbourDistance:24,format:void 0,formatter:void 0,minFontSize:null,maxFontSize:null,onArea:null,style:{fontSize:\"0.8em\",fontWeight:\"bold\"},useHTML:!1,boxesToAvoid:[]};function p(t,e,o,r,a,i){let h=(i-e)*(o-t)-(r-e)*(a-t);return h>0||!(h<0)}function d(t,e,o,r,a,i,h,n){return p(t,e,a,i,h,n)!==p(o,r,a,i,h,n)&&p(t,e,o,r,a,i)!==p(t,e,o,r,h,n)}let{animObject:f}=n(),{format:u}=s(),{setOptions:x}=n(),{composed:g}=n(),{boxIntersectLine:b,intersectRect:m}={boxIntersectLine:function(t,e,o,r,a,i,h,n){return d(t,e,t+o,e,a,i,h,n)||d(t+o,e,t+o,e+r,a,i,h,n)||d(t,e+r,t+o,e+r,a,i,h,n)||d(t,e,t,e+r,a,i,h,n)},intersectRect:function(t,e){return!(e.left>t.right||e.rightt.bottom||e.bottom=e-16&&m[X-1].chartX<=e+r.width+16){if(b(e,o,r.width,r.height,m[X-1].chartX,m[X-1].chartY,m[X].chartX,m[X].chartY))return!1;t===s&&!u&&a&&(u=b(e-16,o-16,r.width+32,r.height+32,m[X-1].chartX,m[X-1].chartY,m[X].chartX,m[X].chartY))}(l||u)&&(t!==s||n)&&(c=Math.min(c,(x=e+r.width/2-m[X].chartX)*x+(g=o+r.height/2-m[X].chartY)*g))}if(!n&&l&&t===s&&(a&&!u||c(t||0)+(e||0),0),e.labelSeriesMaxSum=Math.max(e.labelSeriesMaxSum||0,r.sum||0)),\"load\"===t.type&&(o=Math.max(o,f(r.options.animation).duration)),h&&(void 0!==h[0].plotX?i.animate({x:h[0].plotX+h[1],y:h[0].plotY+h[2]}):i.attr({opacity:0})))}),e.seriesLabelTimer=S(function(){e.series&&e.labelSeries&&function(t){t.boxesToAvoid=[];let e=t.labelSeries||[],o=t.boxesToAvoid;t.series.forEach(t=>(t.points||[]).forEach(e=>(e.dataLabels||[]).forEach(e=>{let{width:r,height:a}=e.getBBox(),i=(e.translateX||0)+(t.xAxis?t.xAxis.pos:t.chart.plotLeft),h=(e.translateY||0)+(t.yAxis?t.yAxis.pos:t.chart.plotTop);o.push({left:i,top:h,right:i+r,bottom:h+a})}))),e.forEach(function(t){let e=t.options.label||{};t.interpolatedPoints=function(t){let e,o,r,a,i;if(!t.xAxis&&!t.yAxis)return;let h=t.points,n=[],l=t.graph||t.area,s=l&&l.element,c=t.chart.inverted,p=t.xAxis,d=t.yAxis,f=c?d.pos:p.pos,u=c?p.pos:d.pos,x=c?p.len:d.len,g=c?d.len:p.len,b=Y((t.options.label||{}).onArea,!!t.area),m=d.getThreshold(t.options.threshold),y={},X=c?\"chartCenterX\":\"chartCenterY\";function w(t){let e=Math.round((t.plotX||0)/8)+\",\"+Math.round((t.plotY||0)/8);y[e]||(y[e]=1,n.push(t))}if(t.getPointSpline&&s&&s.getPointAtLength&&!b&&h.length<(t.chart.plotSizeX||0)/16){let t=l.toD&&l.attr(\"d\");for(l.toD&&l.attr({d:l.toD}),r=s.getTotalLength(),e=0;e16&&o<999)for(i=1,a=Math.ceil(o/16);ir&&t<=a-o.width&&e>=s&&e<=s+p-o.height}function E(){L&&(e.labelBySeries=L.destroy())}if(x&&!n&&(T=[e.xAxis.toPixels(b[0]),e.xAxis.toPixels(b[b.length-1])],P=Math.min.apply(Math,T),B=Math.max.apply(Math,T)),e.visible&&!e.boosted&&d){if(!L){let a=e.name;if(\"string\"==typeof o.format?a=u(o.format,e,t):o.formatter&&(a=o.formatter.call(e)),e.labelBySeries=L=t.renderer.label(a,0,0,\"connector\",0,0,o.useHTML).addClass(\"highcharts-series-label highcharts-series-label-\"+e.index+\" \"+(e.options.className||\"\")+\" \"+r),!t.renderer.styledMode){let r=\"string\"==typeof e.color?e.color:\"#666666\";L.css(X({color:x?t.renderer.getContrast(r):r},o.style||{})),L.attr({opacity:t.renderer.forExport?1:0,stroke:e.color,\"stroke-width\":1})}i&&h&&L.css({fontSize:i+(e.sum||0)/(e.chart.labelSeriesMaxSum||0)*(h-i)+\"px\"}),L.attr({padding:0,zIndex:3}).add()}for((m=L.getBBox()).width=Math.round(m.width),A=d.length-1;A>0;A-=1)x?C(y=(d[A].chartCenterX??d[A].chartX)-m.width/2,w=(d[A].chartCenterY??d[A].chartY)-m.height/2,m)&&(S=v(e,y,w,m)):(C(y=d[A].chartX+3,w=d[A].chartY-m.height-3,m)&&(S=v(e,y,w,m,!0)),S&&g.push(S),C(y=d[A].chartX+3,w=d[A].chartY+3,m)&&(S=v(e,y,w,m,!0)),S&&g.push(S),C(y=d[A].chartX-m.width-3,w=d[A].chartY+3,m)&&(S=v(e,y,w,m,!0)),S&&g.push(S),C(y=d[A].chartX-m.width-3,w=d[A].chartY-m.height-3,m)&&(S=v(e,y,w,m,!0))),S&&g.push(S);if(o.connectorAllowed&&!g.length&&!x)for(y=l+c-m.width;y>=l;y-=16)for(w=s;we.weight-t.weight),S=g[0],(t.boxesToAvoid||[]).push({left:S.x,right:S.x+m.width,top:S.y,bottom:S.y+m.height});let o=Math.sqrt(Math.pow(Math.abs(S.x-(L.x||0)),2)+Math.pow(Math.abs(S.y-(L.y||0)),2));if(o&&e.labelBySeries){let r,i={opacity:t.renderer.forExport?1:0,x:S.x,y:S.y},h={opacity:1};o<=10&&(h={x:i.x,y:i.y},i={}),a&&(r=f(e.options.animation),r.duration*=.2),e.labelBySeries.attr(X(i,{anchorX:S.connectorPoint&&(S.connectorPoint.plotX||0)+l,anchorY:S.connectorPoint&&(S.connectorPoint.plotY||0)+s})).animate(h,r),e.options.kdNow=!0,e.buildKDTree();let n=e.searchPoint({chartX:S.x,chartY:S.y},!0);n&&(L.closest=[n,S.x-(n.plotX||0),S.y-(n.plotY||0)])}}else E()}else E()}),w(t,\"afterDrawSeriesLabels\")}(e)},e.renderer.forExport||!o?0:o)}}function T(t,e,o,r,a){let i=a&&a.anchorX,h=a&&a.anchorY,n,l,s=o/2;return M(i)&&M(h)&&(n=[[\"M\",i,h]],(l=e-h)<0&&(l=-r-l),le+r?n.push([\"L\",t+s,e+r]):ht+o&&n.push([\"L\",t+o,e+r/2])),n||[]}let P=n();({compose:function(t,e){A(g,\"SeriesLabel\")&&(y(t,\"load\",L),y(t,\"redraw\",L),e.prototype.symbols.connector=T,x({plotOptions:{series:{label:c}}}))}}).compose(P.Chart,P.SVGRenderer);let B=n();return i.default})());", "/**\n* plotly.js v3.0.1\n* Copyright 2012-2025, Plotly, Inc.\n* All rights reserved.\n* Licensed under the MIT license\n*/\n(\n function(root, factory) {\n if (typeof module === \"object\" && module.exports) {\n module.exports = factory();\n } else {\n root.moduleName = factory();\n }\n} (typeof self !== \"undefined\" ? self : this, () => {\n\"use strict\";\nvar Plotly = (() => {\n var __create = Object.create;\n var __defProp = Object.defineProperty;\n var __defProps = Object.defineProperties;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropDescs = Object.getOwnPropertyDescriptors;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __getOwnPropSymbols = Object.getOwnPropertySymbols;\n var __getProtoOf = Object.getPrototypeOf;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __propIsEnum = Object.prototype.propertyIsEnumerable;\n var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\n var __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n };\n var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\n var __esm = (fn, res) => function __init() {\n return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;\n };\n var __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n };\n var __export = (target, all) => {\n for (var name2 in all)\n __defProp(target, name2, { get: all[name2], enumerable: true });\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n ));\n var __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n // src/version.js\n var require_version = __commonJS({\n \"src/version.js\"(exports) {\n \"use strict\";\n exports.version = \"3.0.1\";\n }\n });\n\n // node_modules/native-promise-only/lib/npo.src.js\n var require_npo_src = __commonJS({\n \"node_modules/native-promise-only/lib/npo.src.js\"(exports, module) {\n (function UMD(name2, context, definition) {\n context[name2] = context[name2] || definition();\n if (typeof module != \"undefined\" && module.exports) {\n module.exports = context[name2];\n } else if (typeof define == \"function\" && false) {\n define(function $AMD$() {\n return context[name2];\n });\n }\n })(\"Promise\", typeof window != \"undefined\" ? window : exports, function DEF() {\n \"use strict\";\n var builtInProp, cycle, scheduling_queue, ToString = Object.prototype.toString, timer = typeof setImmediate != \"undefined\" ? function timer2(fn) {\n return setImmediate(fn);\n } : setTimeout;\n try {\n Object.defineProperty({}, \"x\", {});\n builtInProp = function builtInProp2(obj, name2, val, config) {\n return Object.defineProperty(obj, name2, {\n value: val,\n writable: true,\n configurable: config !== false\n });\n };\n } catch (err) {\n builtInProp = function builtInProp2(obj, name2, val) {\n obj[name2] = val;\n return obj;\n };\n }\n scheduling_queue = /* @__PURE__ */ function Queue() {\n var first, last, item;\n function Item(fn, self2) {\n this.fn = fn;\n this.self = self2;\n this.next = void 0;\n }\n return {\n add: function add(fn, self2) {\n item = new Item(fn, self2);\n if (last) {\n last.next = item;\n } else {\n first = item;\n }\n last = item;\n item = void 0;\n },\n drain: function drain() {\n var f = first;\n first = last = cycle = void 0;\n while (f) {\n f.fn.call(f.self);\n f = f.next;\n }\n }\n };\n }();\n function schedule(fn, self2) {\n scheduling_queue.add(fn, self2);\n if (!cycle) {\n cycle = timer(scheduling_queue.drain);\n }\n }\n function isThenable(o) {\n var _then, o_type = typeof o;\n if (o != null && (o_type == \"object\" || o_type == \"function\")) {\n _then = o.then;\n }\n return typeof _then == \"function\" ? _then : false;\n }\n function notify() {\n for (var i = 0; i < this.chain.length; i++) {\n notifyIsolated(\n this,\n this.state === 1 ? this.chain[i].success : this.chain[i].failure,\n this.chain[i]\n );\n }\n this.chain.length = 0;\n }\n function notifyIsolated(self2, cb, chain) {\n var ret, _then;\n try {\n if (cb === false) {\n chain.reject(self2.msg);\n } else {\n if (cb === true) {\n ret = self2.msg;\n } else {\n ret = cb.call(void 0, self2.msg);\n }\n if (ret === chain.promise) {\n chain.reject(TypeError(\"Promise-chain cycle\"));\n } else if (_then = isThenable(ret)) {\n _then.call(ret, chain.resolve, chain.reject);\n } else {\n chain.resolve(ret);\n }\n }\n } catch (err) {\n chain.reject(err);\n }\n }\n function resolve(msg) {\n var _then, self2 = this;\n if (self2.triggered) {\n return;\n }\n self2.triggered = true;\n if (self2.def) {\n self2 = self2.def;\n }\n try {\n if (_then = isThenable(msg)) {\n schedule(function() {\n var def_wrapper = new MakeDefWrapper(self2);\n try {\n _then.call(\n msg,\n function $resolve$() {\n resolve.apply(def_wrapper, arguments);\n },\n function $reject$() {\n reject.apply(def_wrapper, arguments);\n }\n );\n } catch (err) {\n reject.call(def_wrapper, err);\n }\n });\n } else {\n self2.msg = msg;\n self2.state = 1;\n if (self2.chain.length > 0) {\n schedule(notify, self2);\n }\n }\n } catch (err) {\n reject.call(new MakeDefWrapper(self2), err);\n }\n }\n function reject(msg) {\n var self2 = this;\n if (self2.triggered) {\n return;\n }\n self2.triggered = true;\n if (self2.def) {\n self2 = self2.def;\n }\n self2.msg = msg;\n self2.state = 2;\n if (self2.chain.length > 0) {\n schedule(notify, self2);\n }\n }\n function iteratePromises(Constructor, arr, resolver, rejecter) {\n for (var idx = 0; idx < arr.length; idx++) {\n (function IIFE(idx2) {\n Constructor.resolve(arr[idx2]).then(\n function $resolver$(msg) {\n resolver(idx2, msg);\n },\n rejecter\n );\n })(idx);\n }\n }\n function MakeDefWrapper(self2) {\n this.def = self2;\n this.triggered = false;\n }\n function MakeDef(self2) {\n this.promise = self2;\n this.state = 0;\n this.triggered = false;\n this.chain = [];\n this.msg = void 0;\n }\n function Promise2(executor) {\n if (typeof executor != \"function\") {\n throw TypeError(\"Not a function\");\n }\n if (this.__NPO__ !== 0) {\n throw TypeError(\"Not a promise\");\n }\n this.__NPO__ = 1;\n var def = new MakeDef(this);\n this[\"then\"] = function then(success, failure) {\n var o = {\n success: typeof success == \"function\" ? success : true,\n failure: typeof failure == \"function\" ? failure : false\n };\n o.promise = new this.constructor(function extractChain(resolve2, reject2) {\n if (typeof resolve2 != \"function\" || typeof reject2 != \"function\") {\n throw TypeError(\"Not a function\");\n }\n o.resolve = resolve2;\n o.reject = reject2;\n });\n def.chain.push(o);\n if (def.state !== 0) {\n schedule(notify, def);\n }\n return o.promise;\n };\n this[\"catch\"] = function $catch$(failure) {\n return this.then(void 0, failure);\n };\n try {\n executor.call(\n void 0,\n function publicResolve(msg) {\n resolve.call(def, msg);\n },\n function publicReject(msg) {\n reject.call(def, msg);\n }\n );\n } catch (err) {\n reject.call(def, err);\n }\n }\n var PromisePrototype = builtInProp(\n {},\n \"constructor\",\n Promise2,\n /*configurable=*/\n false\n );\n Promise2.prototype = PromisePrototype;\n builtInProp(\n PromisePrototype,\n \"__NPO__\",\n 0,\n /*configurable=*/\n false\n );\n builtInProp(Promise2, \"resolve\", function Promise$resolve(msg) {\n var Constructor = this;\n if (msg && typeof msg == \"object\" && msg.__NPO__ === 1) {\n return msg;\n }\n return new Constructor(function executor(resolve2, reject2) {\n if (typeof resolve2 != \"function\" || typeof reject2 != \"function\") {\n throw TypeError(\"Not a function\");\n }\n resolve2(msg);\n });\n });\n builtInProp(Promise2, \"reject\", function Promise$reject(msg) {\n return new this(function executor(resolve2, reject2) {\n if (typeof resolve2 != \"function\" || typeof reject2 != \"function\") {\n throw TypeError(\"Not a function\");\n }\n reject2(msg);\n });\n });\n builtInProp(Promise2, \"all\", function Promise$all(arr) {\n var Constructor = this;\n if (ToString.call(arr) != \"[object Array]\") {\n return Constructor.reject(TypeError(\"Not an array\"));\n }\n if (arr.length === 0) {\n return Constructor.resolve([]);\n }\n return new Constructor(function executor(resolve2, reject2) {\n if (typeof resolve2 != \"function\" || typeof reject2 != \"function\") {\n throw TypeError(\"Not a function\");\n }\n var len = arr.length, msgs = Array(len), count = 0;\n iteratePromises(Constructor, arr, function resolver(idx, msg) {\n msgs[idx] = msg;\n if (++count === len) {\n resolve2(msgs);\n }\n }, reject2);\n });\n });\n builtInProp(Promise2, \"race\", function Promise$race(arr) {\n var Constructor = this;\n if (ToString.call(arr) != \"[object Array]\") {\n return Constructor.reject(TypeError(\"Not an array\"));\n }\n return new Constructor(function executor(resolve2, reject2) {\n if (typeof resolve2 != \"function\" || typeof reject2 != \"function\") {\n throw TypeError(\"Not a function\");\n }\n iteratePromises(Constructor, arr, function resolver(idx, msg) {\n resolve2(msg);\n }, reject2);\n });\n });\n return Promise2;\n });\n }\n });\n\n // node_modules/@plotly/d3/d3.js\n var require_d3 = __commonJS({\n \"node_modules/@plotly/d3/d3.js\"(exports, module) {\n !function() {\n var d3 = {\n version: \"3.8.2\"\n };\n var d3_arraySlice = [].slice, d3_array = function(list) {\n return d3_arraySlice.call(list);\n };\n var d3_document = self.document;\n function d3_documentElement(node) {\n return node && (node.ownerDocument || node.document || node).documentElement;\n }\n function d3_window(node) {\n return node && (node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView);\n }\n if (d3_document) {\n try {\n d3_array(d3_document.documentElement.childNodes)[0].nodeType;\n } catch (e) {\n d3_array = function(list) {\n var i = list.length, array = new Array(i);\n while (i--) array[i] = list[i];\n return array;\n };\n }\n }\n if (!Date.now) Date.now = function() {\n return +/* @__PURE__ */ new Date();\n };\n if (d3_document) {\n try {\n d3_document.createElement(\"DIV\").style.setProperty(\"opacity\", 0, \"\");\n } catch (error) {\n var d3_element_prototype = this.Element.prototype, d3_element_setAttribute = d3_element_prototype.setAttribute, d3_element_setAttributeNS = d3_element_prototype.setAttributeNS, d3_style_prototype = this.CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty;\n d3_element_prototype.setAttribute = function(name2, value) {\n d3_element_setAttribute.call(this, name2, value + \"\");\n };\n d3_element_prototype.setAttributeNS = function(space, local, value) {\n d3_element_setAttributeNS.call(this, space, local, value + \"\");\n };\n d3_style_prototype.setProperty = function(name2, value, priority) {\n d3_style_setProperty.call(this, name2, value + \"\", priority);\n };\n }\n }\n d3.ascending = d3_ascending;\n function d3_ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n }\n d3.descending = function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n };\n d3.min = function(array, f) {\n var i = -1, n = array.length, a, b;\n if (arguments.length === 1) {\n while (++i < n) if ((b = array[i]) != null && b >= b) {\n a = b;\n break;\n }\n while (++i < n) if ((b = array[i]) != null && a > b) a = b;\n } else {\n while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) {\n a = b;\n break;\n }\n while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;\n }\n return a;\n };\n d3.max = function(array, f) {\n var i = -1, n = array.length, a, b;\n if (arguments.length === 1) {\n while (++i < n) if ((b = array[i]) != null && b >= b) {\n a = b;\n break;\n }\n while (++i < n) if ((b = array[i]) != null && b > a) a = b;\n } else {\n while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) {\n a = b;\n break;\n }\n while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;\n }\n return a;\n };\n d3.extent = function(array, f) {\n var i = -1, n = array.length, a, b, c;\n if (arguments.length === 1) {\n while (++i < n) if ((b = array[i]) != null && b >= b) {\n a = c = b;\n break;\n }\n while (++i < n) if ((b = array[i]) != null) {\n if (a > b) a = b;\n if (c < b) c = b;\n }\n } else {\n while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) {\n a = c = b;\n break;\n }\n while (++i < n) if ((b = f.call(array, array[i], i)) != null) {\n if (a > b) a = b;\n if (c < b) c = b;\n }\n }\n return [a, c];\n };\n function d3_number(x) {\n return x === null ? NaN : +x;\n }\n function d3_numeric(x) {\n return !isNaN(x);\n }\n d3.sum = function(array, f) {\n var s = 0, n = array.length, a, i = -1;\n if (arguments.length === 1) {\n while (++i < n) if (d3_numeric(a = +array[i])) s += a;\n } else {\n while (++i < n) if (d3_numeric(a = +f.call(array, array[i], i))) s += a;\n }\n return s;\n };\n d3.mean = function(array, f) {\n var s = 0, n = array.length, a, i = -1, j = n;\n if (arguments.length === 1) {\n while (++i < n) if (d3_numeric(a = d3_number(array[i]))) s += a;\n else --j;\n } else {\n while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) s += a;\n else --j;\n }\n if (j) return s / j;\n };\n d3.quantile = function(values, p) {\n var H = (values.length - 1) * p + 1, h = Math.floor(H), v = +values[h - 1], e = H - h;\n return e ? v + e * (values[h] - v) : v;\n };\n d3.median = function(array, f) {\n var numbers = [], n = array.length, a, i = -1;\n if (arguments.length === 1) {\n while (++i < n) if (d3_numeric(a = d3_number(array[i]))) numbers.push(a);\n } else {\n while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) numbers.push(a);\n }\n if (numbers.length) return d3.quantile(numbers.sort(d3_ascending), 0.5);\n };\n d3.variance = function(array, f) {\n var n = array.length, m = 0, a, d, s = 0, i = -1, j = 0;\n if (arguments.length === 1) {\n while (++i < n) {\n if (d3_numeric(a = d3_number(array[i]))) {\n d = a - m;\n m += d / ++j;\n s += d * (a - m);\n }\n }\n } else {\n while (++i < n) {\n if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) {\n d = a - m;\n m += d / ++j;\n s += d * (a - m);\n }\n }\n }\n if (j > 1) return s / (j - 1);\n };\n d3.deviation = function() {\n var v = d3.variance.apply(this, arguments);\n return v ? Math.sqrt(v) : v;\n };\n function d3_bisector(compare) {\n return {\n left: function(a, x, lo, hi) {\n if (arguments.length < 3) lo = 0;\n if (arguments.length < 4) hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (compare(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n },\n right: function(a, x, lo, hi) {\n if (arguments.length < 3) lo = 0;\n if (arguments.length < 4) hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (compare(a[mid], x) > 0) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n }\n };\n }\n var d3_bisect = d3_bisector(d3_ascending);\n d3.bisectLeft = d3_bisect.left;\n d3.bisect = d3.bisectRight = d3_bisect.right;\n d3.bisector = function(f) {\n return d3_bisector(f.length === 1 ? function(d, x) {\n return d3_ascending(f(d), x);\n } : f);\n };\n d3.shuffle = function(array, i0, i1) {\n if ((m = arguments.length) < 3) {\n i1 = array.length;\n if (m < 2) i0 = 0;\n }\n var m = i1 - i0, t, i;\n while (m) {\n i = Math.random() * m-- | 0;\n t = array[m + i0], array[m + i0] = array[i + i0], array[i + i0] = t;\n }\n return array;\n };\n d3.permute = function(array, indexes) {\n var i = indexes.length, permutes = new Array(i);\n while (i--) permutes[i] = array[indexes[i]];\n return permutes;\n };\n d3.pairs = function(array) {\n var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n);\n while (i < n) pairs[i] = [p0 = p1, p1 = array[++i]];\n return pairs;\n };\n d3.transpose = function(matrix) {\n if (!(n = matrix.length)) return [];\n for (var i = -1, m = d3.min(matrix, d3_transposeLength), transpose = new Array(m); ++i < m; ) {\n for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n; ) {\n row[j] = matrix[j][i];\n }\n }\n return transpose;\n };\n function d3_transposeLength(d) {\n return d.length;\n }\n d3.zip = function() {\n return d3.transpose(arguments);\n };\n d3.keys = function(map) {\n var keys = [];\n for (var key in map) keys.push(key);\n return keys;\n };\n d3.values = function(map) {\n var values = [];\n for (var key in map) values.push(map[key]);\n return values;\n };\n d3.entries = function(map) {\n var entries = [];\n for (var key in map) entries.push({\n key,\n value: map[key]\n });\n return entries;\n };\n d3.merge = function(arrays) {\n var n = arrays.length, m, i = -1, j = 0, merged, array;\n while (++i < n) j += arrays[i].length;\n merged = new Array(j);\n while (--n >= 0) {\n array = arrays[n];\n m = array.length;\n while (--m >= 0) {\n merged[--j] = array[m];\n }\n }\n return merged;\n };\n var abs = Math.abs;\n d3.range = function(start, stop, step) {\n if (arguments.length < 3) {\n step = 1;\n if (arguments.length < 2) {\n stop = start;\n start = 0;\n }\n }\n if ((stop - start) / step === Infinity) throw new Error(\"infinite range\");\n var range = [], k = d3_range_integerScale(abs(step)), i = -1, j;\n start *= k, stop *= k, step *= k;\n if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k);\n else while ((j = start + step * ++i) < stop) range.push(j / k);\n return range;\n };\n function d3_range_integerScale(x) {\n var k = 1;\n while (x * k % 1) k *= 10;\n return k;\n }\n function d3_class(ctor, properties) {\n for (var key in properties) {\n Object.defineProperty(ctor.prototype, key, {\n value: properties[key],\n enumerable: false\n });\n }\n }\n d3.map = function(object, f) {\n var map = new d3_Map();\n if (object instanceof d3_Map) {\n object.forEach(function(key2, value) {\n map.set(key2, value);\n });\n } else if (Array.isArray(object)) {\n var i = -1, n = object.length, o;\n if (arguments.length === 1) while (++i < n) map.set(i, object[i]);\n else while (++i < n) map.set(f.call(object, o = object[i], i), o);\n } else {\n for (var key in object) map.set(key, object[key]);\n }\n return map;\n };\n function d3_Map() {\n this._ = /* @__PURE__ */ Object.create(null);\n }\n var d3_map_proto = \"__proto__\", d3_map_zero = \"\\0\";\n d3_class(d3_Map, {\n has: d3_map_has,\n get: function(key) {\n return this._[d3_map_escape(key)];\n },\n set: function(key, value) {\n return this._[d3_map_escape(key)] = value;\n },\n remove: d3_map_remove,\n keys: d3_map_keys,\n values: function() {\n var values = [];\n for (var key in this._) values.push(this._[key]);\n return values;\n },\n entries: function() {\n var entries = [];\n for (var key in this._) entries.push({\n key: d3_map_unescape(key),\n value: this._[key]\n });\n return entries;\n },\n size: d3_map_size,\n empty: d3_map_empty,\n forEach: function(f) {\n for (var key in this._) f.call(this, d3_map_unescape(key), this._[key]);\n }\n });\n function d3_map_escape(key) {\n return (key += \"\") === d3_map_proto || key[0] === d3_map_zero ? d3_map_zero + key : key;\n }\n function d3_map_unescape(key) {\n return (key += \"\")[0] === d3_map_zero ? key.slice(1) : key;\n }\n function d3_map_has(key) {\n return d3_map_escape(key) in this._;\n }\n function d3_map_remove(key) {\n return (key = d3_map_escape(key)) in this._ && delete this._[key];\n }\n function d3_map_keys() {\n var keys = [];\n for (var key in this._) keys.push(d3_map_unescape(key));\n return keys;\n }\n function d3_map_size() {\n var size = 0;\n for (var key in this._) ++size;\n return size;\n }\n function d3_map_empty() {\n for (var key in this._) return false;\n return true;\n }\n d3.nest = function() {\n var nest = {}, keys = [], sortKeys = [], sortValues, rollup;\n function map(mapType, array, depth) {\n if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;\n var i = -1, n = array.length, key = keys[depth++], keyValue, object, setter, valuesByKey = new d3_Map(), values;\n while (++i < n) {\n if (values = valuesByKey.get(keyValue = key(object = array[i]))) {\n values.push(object);\n } else {\n valuesByKey.set(keyValue, [object]);\n }\n }\n if (mapType) {\n object = mapType();\n setter = function(keyValue2, values2) {\n object.set(keyValue2, map(mapType, values2, depth));\n };\n } else {\n object = {};\n setter = function(keyValue2, values2) {\n object[keyValue2] = map(mapType, values2, depth);\n };\n }\n valuesByKey.forEach(setter);\n return object;\n }\n function entries(map2, depth) {\n if (depth >= keys.length) return map2;\n var array = [], sortKey = sortKeys[depth++];\n map2.forEach(function(key, keyMap) {\n array.push({\n key,\n values: entries(keyMap, depth)\n });\n });\n return sortKey ? array.sort(function(a, b) {\n return sortKey(a.key, b.key);\n }) : array;\n }\n nest.map = function(array, mapType) {\n return map(mapType, array, 0);\n };\n nest.entries = function(array) {\n return entries(map(d3.map, array, 0), 0);\n };\n nest.key = function(d) {\n keys.push(d);\n return nest;\n };\n nest.sortKeys = function(order) {\n sortKeys[keys.length - 1] = order;\n return nest;\n };\n nest.sortValues = function(order) {\n sortValues = order;\n return nest;\n };\n nest.rollup = function(f) {\n rollup = f;\n return nest;\n };\n return nest;\n };\n d3.set = function(array) {\n var set = new d3_Set();\n if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]);\n return set;\n };\n function d3_Set() {\n this._ = /* @__PURE__ */ Object.create(null);\n }\n d3_class(d3_Set, {\n has: d3_map_has,\n add: function(key) {\n this._[d3_map_escape(key += \"\")] = true;\n return key;\n },\n remove: d3_map_remove,\n values: d3_map_keys,\n size: d3_map_size,\n empty: d3_map_empty,\n forEach: function(f) {\n for (var key in this._) f.call(this, d3_map_unescape(key));\n }\n });\n d3.behavior = {};\n function d3_identity(d) {\n return d;\n }\n d3.rebind = function(target, source) {\n var i = 1, n = arguments.length, method;\n while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);\n return target;\n };\n function d3_rebind(target, source, method) {\n return function() {\n var value = method.apply(source, arguments);\n return value === source ? target : value;\n };\n }\n function d3_vendorSymbol(object, name2) {\n if (name2 in object) return name2;\n name2 = name2.charAt(0).toUpperCase() + name2.slice(1);\n for (var i = 0, n = d3_vendorPrefixes.length; i < n; ++i) {\n var prefixName = d3_vendorPrefixes[i] + name2;\n if (prefixName in object) return prefixName;\n }\n }\n var d3_vendorPrefixes = [\"webkit\", \"ms\", \"moz\", \"Moz\", \"o\", \"O\"];\n function d3_noop() {\n }\n d3.dispatch = function() {\n var dispatch = new d3_dispatch(), i = -1, n = arguments.length;\n while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);\n return dispatch;\n };\n function d3_dispatch() {\n }\n d3_dispatch.prototype.on = function(type, listener) {\n var i = type.indexOf(\".\"), name2 = \"\";\n if (i >= 0) {\n name2 = type.slice(i + 1);\n type = type.slice(0, i);\n }\n if (type) return arguments.length < 2 ? this[type].on(name2) : this[type].on(name2, listener);\n if (arguments.length === 2) {\n if (listener == null) for (type in this) {\n if (this.hasOwnProperty(type)) this[type].on(name2, null);\n }\n return this;\n }\n };\n function d3_dispatch_event(dispatch) {\n var listeners = [], listenerByName = new d3_Map();\n function event() {\n var z = listeners, i = -1, n = z.length, l;\n while (++i < n) if (l = z[i].on) l.apply(this, arguments);\n return dispatch;\n }\n event.on = function(name2, listener) {\n var l = listenerByName.get(name2), i;\n if (arguments.length < 2) return l && l.on;\n if (l) {\n l.on = null;\n listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));\n listenerByName.remove(name2);\n }\n if (listener) listeners.push(listenerByName.set(name2, {\n on: listener\n }));\n return dispatch;\n };\n return event;\n }\n d3.event = null;\n function d3_eventPreventDefault() {\n d3.event.preventDefault();\n }\n function d3_eventSource() {\n var e = d3.event, s;\n while (s = e.sourceEvent) e = s;\n return e;\n }\n function d3_eventDispatch(target) {\n var dispatch = new d3_dispatch(), i = 0, n = arguments.length;\n while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);\n dispatch.of = function(thiz, argumentz) {\n return function(e1) {\n try {\n var e0 = e1.sourceEvent = d3.event;\n e1.target = target;\n d3.event = e1;\n dispatch[e1.type].apply(thiz, argumentz);\n } finally {\n d3.event = e0;\n }\n };\n };\n return dispatch;\n }\n d3.requote = function(s) {\n return s.replace(d3_requote_re, \"\\\\$&\");\n };\n var d3_requote_re = /[\\\\\\^\\$\\*\\+\\?\\|\\[\\]\\(\\)\\.\\{\\}]/g;\n var d3_subclass = {}.__proto__ ? function(object, prototype) {\n object.__proto__ = prototype;\n } : function(object, prototype) {\n for (var property in prototype) object[property] = prototype[property];\n };\n function d3_selection(groups) {\n d3_subclass(groups, d3_selectionPrototype);\n return groups;\n }\n var d3_select = function(s, n) {\n return n.querySelector(s);\n }, d3_selectAll = function(s, n) {\n return n.querySelectorAll(s);\n }, d3_selectMatches = function(n, s) {\n var d3_selectMatcher = n.matches || n[d3_vendorSymbol(n, \"matchesSelector\")];\n d3_selectMatches = function(n2, s2) {\n return d3_selectMatcher.call(n2, s2);\n };\n return d3_selectMatches(n, s);\n };\n if (typeof Sizzle === \"function\") {\n d3_select = function(s, n) {\n return Sizzle(s, n)[0] || null;\n };\n d3_selectAll = Sizzle;\n d3_selectMatches = Sizzle.matchesSelector;\n }\n d3.selection = function() {\n return d3.select(d3_document.documentElement);\n };\n var d3_selectionPrototype = d3.selection.prototype = [];\n d3_selectionPrototype.select = function(selector) {\n var subgroups = [], subgroup, subnode, group, node;\n selector = d3_selection_selector(selector);\n for (var j = -1, m = this.length; ++j < m; ) {\n subgroups.push(subgroup = []);\n subgroup.parentNode = (group = this[j]).parentNode;\n for (var i = -1, n = group.length; ++i < n; ) {\n if (node = group[i]) {\n subgroup.push(subnode = selector.call(node, node.__data__, i, j));\n if (subnode && \"__data__\" in node) subnode.__data__ = node.__data__;\n } else {\n subgroup.push(null);\n }\n }\n }\n return d3_selection(subgroups);\n };\n function d3_selection_selector(selector) {\n return typeof selector === \"function\" ? selector : function() {\n return d3_select(selector, this);\n };\n }\n d3_selectionPrototype.selectAll = function(selector) {\n var subgroups = [], subgroup, node;\n selector = d3_selection_selectorAll(selector);\n for (var j = -1, m = this.length; ++j < m; ) {\n for (var group = this[j], i = -1, n = group.length; ++i < n; ) {\n if (node = group[i]) {\n subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i, j)));\n subgroup.parentNode = node;\n }\n }\n }\n return d3_selection(subgroups);\n };\n function d3_selection_selectorAll(selector) {\n return typeof selector === \"function\" ? selector : function() {\n return d3_selectAll(selector, this);\n };\n }\n var d3_nsXhtml = \"http://www.w3.org/1999/xhtml\";\n var d3_nsPrefix = {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: d3_nsXhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n };\n d3.ns = {\n prefix: d3_nsPrefix,\n qualify: function(name2) {\n var i = name2.indexOf(\":\"), prefix = name2;\n if (i >= 0 && (prefix = name2.slice(0, i)) !== \"xmlns\") name2 = name2.slice(i + 1);\n return d3_nsPrefix.hasOwnProperty(prefix) ? {\n space: d3_nsPrefix[prefix],\n local: name2\n } : name2;\n }\n };\n d3_selectionPrototype.attr = function(name2, value) {\n if (arguments.length < 2) {\n if (typeof name2 === \"string\") {\n var node = this.node();\n name2 = d3.ns.qualify(name2);\n return name2.local ? node.getAttributeNS(name2.space, name2.local) : node.getAttribute(name2);\n }\n for (value in name2) this.each(d3_selection_attr(value, name2[value]));\n return this;\n }\n return this.each(d3_selection_attr(name2, value));\n };\n function d3_selection_attr(name2, value) {\n name2 = d3.ns.qualify(name2);\n function attrNull() {\n this.removeAttribute(name2);\n }\n function attrNullNS() {\n this.removeAttributeNS(name2.space, name2.local);\n }\n function attrConstant() {\n this.setAttribute(name2, value);\n }\n function attrConstantNS() {\n this.setAttributeNS(name2.space, name2.local, value);\n }\n function attrFunction() {\n var x = value.apply(this, arguments);\n if (x == null) this.removeAttribute(name2);\n else this.setAttribute(name2, x);\n }\n function attrFunctionNS() {\n var x = value.apply(this, arguments);\n if (x == null) this.removeAttributeNS(name2.space, name2.local);\n else this.setAttributeNS(name2.space, name2.local, x);\n }\n return value == null ? name2.local ? attrNullNS : attrNull : typeof value === \"function\" ? name2.local ? attrFunctionNS : attrFunction : name2.local ? attrConstantNS : attrConstant;\n }\n function d3_collapse(s) {\n return s.trim().replace(/\\s+/g, \" \");\n }\n d3_selectionPrototype.classed = function(name2, value) {\n if (arguments.length < 2) {\n if (typeof name2 === \"string\") {\n var node = this.node(), n = (name2 = d3_selection_classes(name2)).length, i = -1;\n if (value = node.classList) {\n while (++i < n) if (!value.contains(name2[i])) return false;\n } else {\n value = node.getAttribute(\"class\");\n while (++i < n) if (!d3_selection_classedRe(name2[i]).test(value)) return false;\n }\n return true;\n }\n for (value in name2) this.each(d3_selection_classed(value, name2[value]));\n return this;\n }\n return this.each(d3_selection_classed(name2, value));\n };\n function d3_selection_classedRe(name2) {\n return new RegExp(\"(?:^|\\\\s+)\" + d3.requote(name2) + \"(?:\\\\s+|$)\", \"g\");\n }\n function d3_selection_classes(name2) {\n return (name2 + \"\").trim().split(/^|\\s+/);\n }\n function d3_selection_classed(name2, value) {\n name2 = d3_selection_classes(name2).map(d3_selection_classedName);\n var n = name2.length;\n function classedConstant() {\n var i = -1;\n while (++i < n) name2[i](this, value);\n }\n function classedFunction() {\n var i = -1, x = value.apply(this, arguments);\n while (++i < n) name2[i](this, x);\n }\n return typeof value === \"function\" ? classedFunction : classedConstant;\n }\n function d3_selection_classedName(name2) {\n var re = d3_selection_classedRe(name2);\n return function(node, value) {\n if (c = node.classList) return value ? c.add(name2) : c.remove(name2);\n var c = node.getAttribute(\"class\") || \"\";\n if (value) {\n re.lastIndex = 0;\n if (!re.test(c)) node.setAttribute(\"class\", d3_collapse(c + \" \" + name2));\n } else {\n node.setAttribute(\"class\", d3_collapse(c.replace(re, \" \")));\n }\n };\n }\n d3_selectionPrototype.style = function(name2, value, priority) {\n var n = arguments.length;\n if (n < 3) {\n if (typeof name2 !== \"string\") {\n if (n < 2) value = \"\";\n for (priority in name2) this.each(d3_selection_style(priority, name2[priority], value));\n return this;\n }\n if (n < 2) {\n var node = this.node();\n return d3_window(node).getComputedStyle(node, null).getPropertyValue(name2);\n }\n priority = \"\";\n }\n return this.each(d3_selection_style(name2, value, priority));\n };\n function d3_selection_style(name2, value, priority) {\n function styleNull() {\n this.style.removeProperty(name2);\n }\n function styleConstant() {\n this.style.setProperty(name2, value, priority);\n }\n function styleFunction() {\n var x = value.apply(this, arguments);\n if (x == null) this.style.removeProperty(name2);\n else this.style.setProperty(name2, x, priority);\n }\n return value == null ? styleNull : typeof value === \"function\" ? styleFunction : styleConstant;\n }\n d3_selectionPrototype.property = function(name2, value) {\n if (arguments.length < 2) {\n if (typeof name2 === \"string\") return this.node()[name2];\n for (value in name2) this.each(d3_selection_property(value, name2[value]));\n return this;\n }\n return this.each(d3_selection_property(name2, value));\n };\n function d3_selection_property(name2, value) {\n function propertyNull() {\n delete this[name2];\n }\n function propertyConstant() {\n this[name2] = value;\n }\n function propertyFunction() {\n var x = value.apply(this, arguments);\n if (x == null) delete this[name2];\n else this[name2] = x;\n }\n return value == null ? propertyNull : typeof value === \"function\" ? propertyFunction : propertyConstant;\n }\n d3_selectionPrototype.text = function(value) {\n return arguments.length ? this.each(typeof value === \"function\" ? function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n } : value == null ? function() {\n this.textContent = \"\";\n } : function() {\n this.textContent = value;\n }) : this.node().textContent;\n };\n d3_selectionPrototype.html = function(value) {\n return arguments.length ? this.each(typeof value === \"function\" ? function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n } : value == null ? function() {\n this.innerHTML = \"\";\n } : function() {\n this.innerHTML = value;\n }) : this.node().innerHTML;\n };\n d3_selectionPrototype.append = function(name2) {\n name2 = d3_selection_creator(name2);\n return this.select(function() {\n return this.appendChild(name2.apply(this, arguments));\n });\n };\n function d3_selection_creator(name2) {\n function create() {\n var document2 = this.ownerDocument, namespace = this.namespaceURI;\n return namespace === d3_nsXhtml && document2.documentElement.namespaceURI === d3_nsXhtml ? document2.createElement(name2) : document2.createElementNS(namespace, name2);\n }\n function createNS() {\n return this.ownerDocument.createElementNS(name2.space, name2.local);\n }\n return typeof name2 === \"function\" ? name2 : (name2 = d3.ns.qualify(name2)).local ? createNS : create;\n }\n d3_selectionPrototype.insert = function(name2, before) {\n name2 = d3_selection_creator(name2);\n before = d3_selection_selector(before);\n return this.select(function() {\n return this.insertBefore(name2.apply(this, arguments), before.apply(this, arguments) || null);\n });\n };\n d3_selectionPrototype.remove = function() {\n return this.each(d3_selectionRemove);\n };\n function d3_selectionRemove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n }\n d3_selectionPrototype.data = function(value, key) {\n var i = -1, n = this.length, group, node;\n if (!arguments.length) {\n value = new Array(n = (group = this[0]).length);\n while (++i < n) {\n if (node = group[i]) {\n value[i] = node.__data__;\n }\n }\n return value;\n }\n function bind(group2, groupData) {\n var i2, n2 = group2.length, m = groupData.length, n0 = Math.min(n2, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n2), node2, nodeData;\n if (key) {\n var nodeByKeyValue = new d3_Map(), keyValues = new Array(n2), keyValue;\n for (i2 = -1; ++i2 < n2; ) {\n if (node2 = group2[i2]) {\n if (nodeByKeyValue.has(keyValue = key.call(node2, node2.__data__, i2))) {\n exitNodes[i2] = node2;\n } else {\n nodeByKeyValue.set(keyValue, node2);\n }\n keyValues[i2] = keyValue;\n }\n }\n for (i2 = -1; ++i2 < m; ) {\n if (!(node2 = nodeByKeyValue.get(keyValue = key.call(groupData, nodeData = groupData[i2], i2)))) {\n enterNodes[i2] = d3_selection_dataNode(nodeData);\n } else if (node2 !== true) {\n updateNodes[i2] = node2;\n node2.__data__ = nodeData;\n }\n nodeByKeyValue.set(keyValue, true);\n }\n for (i2 = -1; ++i2 < n2; ) {\n if (i2 in keyValues && nodeByKeyValue.get(keyValues[i2]) !== true) {\n exitNodes[i2] = group2[i2];\n }\n }\n } else {\n for (i2 = -1; ++i2 < n0; ) {\n node2 = group2[i2];\n nodeData = groupData[i2];\n if (node2) {\n node2.__data__ = nodeData;\n updateNodes[i2] = node2;\n } else {\n enterNodes[i2] = d3_selection_dataNode(nodeData);\n }\n }\n for (; i2 < m; ++i2) {\n enterNodes[i2] = d3_selection_dataNode(groupData[i2]);\n }\n for (; i2 < n2; ++i2) {\n exitNodes[i2] = group2[i2];\n }\n }\n enterNodes.update = updateNodes;\n enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group2.parentNode;\n enter.push(enterNodes);\n update.push(updateNodes);\n exit.push(exitNodes);\n }\n var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]);\n if (typeof value === \"function\") {\n while (++i < n) {\n bind(group = this[i], value.call(group, group.parentNode.__data__, i));\n }\n } else {\n while (++i < n) {\n bind(group = this[i], value);\n }\n }\n update.enter = function() {\n return enter;\n };\n update.exit = function() {\n return exit;\n };\n return update;\n };\n function d3_selection_dataNode(data) {\n return {\n __data__: data\n };\n }\n d3_selectionPrototype.datum = function(value) {\n return arguments.length ? this.property(\"__data__\", value) : this.property(\"__data__\");\n };\n d3_selectionPrototype.filter = function(filter) {\n var subgroups = [], subgroup, group, node;\n if (typeof filter !== \"function\") filter = d3_selection_filter(filter);\n for (var j = 0, m = this.length; j < m; j++) {\n subgroups.push(subgroup = []);\n subgroup.parentNode = (group = this[j]).parentNode;\n for (var i = 0, n = group.length; i < n; i++) {\n if ((node = group[i]) && filter.call(node, node.__data__, i, j)) {\n subgroup.push(node);\n }\n }\n }\n return d3_selection(subgroups);\n };\n function d3_selection_filter(selector) {\n return function() {\n return d3_selectMatches(this, selector);\n };\n }\n d3_selectionPrototype.order = function() {\n for (var j = -1, m = this.length; ++j < m; ) {\n for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {\n if (node = group[i]) {\n if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n return this;\n };\n d3_selectionPrototype.sort = function(comparator) {\n comparator = d3_selection_sortComparator.apply(this, arguments);\n for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator);\n return this.order();\n };\n function d3_selection_sortComparator(comparator) {\n if (!arguments.length) comparator = d3_ascending;\n return function(a, b) {\n return a && b ? comparator(a.__data__, b.__data__) : !a - !b;\n };\n }\n d3_selectionPrototype.each = function(callback) {\n return d3_selection_each(this, function(node, i, j) {\n callback.call(node, node.__data__, i, j);\n });\n };\n function d3_selection_each(groups, callback) {\n for (var j = 0, m = groups.length; j < m; j++) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) {\n if (node = group[i]) callback(node, i, j);\n }\n }\n return groups;\n }\n d3_selectionPrototype.call = function(callback) {\n var args = d3_array(arguments);\n callback.apply(args[0] = this, args);\n return this;\n };\n d3_selectionPrototype.empty = function() {\n return !this.node();\n };\n d3_selectionPrototype.node = function() {\n for (var j = 0, m = this.length; j < m; j++) {\n for (var group = this[j], i = 0, n = group.length; i < n; i++) {\n var node = group[i];\n if (node) return node;\n }\n }\n return null;\n };\n d3_selectionPrototype.size = function() {\n var n = 0;\n d3_selection_each(this, function() {\n ++n;\n });\n return n;\n };\n function d3_selection_enter(selection) {\n d3_subclass(selection, d3_selection_enterPrototype);\n return selection;\n }\n var d3_selection_enterPrototype = [];\n d3.selection.enter = d3_selection_enter;\n d3.selection.enter.prototype = d3_selection_enterPrototype;\n d3_selection_enterPrototype.append = d3_selectionPrototype.append;\n d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;\n d3_selection_enterPrototype.node = d3_selectionPrototype.node;\n d3_selection_enterPrototype.call = d3_selectionPrototype.call;\n d3_selection_enterPrototype.size = d3_selectionPrototype.size;\n d3_selection_enterPrototype.select = function(selector) {\n var subgroups = [], subgroup, subnode, upgroup, group, node;\n for (var j = -1, m = this.length; ++j < m; ) {\n upgroup = (group = this[j]).update;\n subgroups.push(subgroup = []);\n subgroup.parentNode = group.parentNode;\n for (var i = -1, n = group.length; ++i < n; ) {\n if (node = group[i]) {\n subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i, j));\n subnode.__data__ = node.__data__;\n } else {\n subgroup.push(null);\n }\n }\n }\n return d3_selection(subgroups);\n };\n d3_selection_enterPrototype.insert = function(name2, before) {\n if (arguments.length < 2) before = d3_selection_enterInsertBefore(this);\n return d3_selectionPrototype.insert.call(this, name2, before);\n };\n function d3_selection_enterInsertBefore(enter) {\n var i0, j0;\n return function(d, i, j) {\n var group = enter[j].update, n = group.length, node;\n if (j != j0) j0 = j, i0 = 0;\n if (i >= i0) i0 = i + 1;\n while (!(node = group[i0]) && ++i0 < n) ;\n return node;\n };\n }\n d3.select = function(node) {\n var group;\n if (typeof node === \"string\") {\n group = [d3_select(node, d3_document)];\n group.parentNode = d3_document.documentElement;\n } else {\n group = [node];\n group.parentNode = d3_documentElement(node);\n }\n return d3_selection([group]);\n };\n d3.selectAll = function(nodes) {\n var group;\n if (typeof nodes === \"string\") {\n group = d3_array(d3_selectAll(nodes, d3_document));\n group.parentNode = d3_document.documentElement;\n } else {\n group = d3_array(nodes);\n group.parentNode = null;\n }\n return d3_selection([group]);\n };\n d3_selectionPrototype.on = function(type, listener, capture) {\n var n = arguments.length;\n if (n < 3) {\n if (typeof type !== \"string\") {\n if (n < 2) listener = false;\n for (capture in type) this.each(d3_selection_on(capture, type[capture], listener));\n return this;\n }\n if (n < 2) return (n = this.node()[\"__on\" + type]) && n._;\n capture = false;\n }\n return this.each(d3_selection_on(type, listener, capture));\n };\n function d3_selection_on(type, listener, capture) {\n var name2 = \"__on\" + type, i = type.indexOf(\".\"), wrap = d3_selection_onListener;\n if (i > 0) type = type.slice(0, i);\n var filter = d3_selection_onFilters.get(type);\n if (filter) type = filter, wrap = d3_selection_onFilter;\n function onRemove() {\n var l = this[name2];\n if (l) {\n this.removeEventListener(type, l, l.$);\n delete this[name2];\n }\n }\n function onAdd() {\n var l = wrap(listener, d3_array(arguments));\n onRemove.call(this);\n this.addEventListener(type, this[name2] = l, l.$ = capture);\n l._ = listener;\n }\n function removeAll() {\n var re = new RegExp(\"^__on([^.]+)\" + d3.requote(type) + \"$\"), match;\n for (var name3 in this) {\n if (match = name3.match(re)) {\n var l = this[name3];\n this.removeEventListener(match[1], l, l.$);\n delete this[name3];\n }\n }\n }\n return i ? listener ? onAdd : onRemove : listener ? d3_noop : removeAll;\n }\n var d3_selection_onFilters = d3.map({\n mouseenter: \"mouseover\",\n mouseleave: \"mouseout\"\n });\n if (d3_document) {\n d3_selection_onFilters.forEach(function(k) {\n if (\"on\" + k in d3_document) d3_selection_onFilters.remove(k);\n });\n }\n function d3_selection_onListener(listener, argumentz) {\n return function(e) {\n var o = d3.event;\n d3.event = e;\n argumentz[0] = this.__data__;\n try {\n listener.apply(this, argumentz);\n } finally {\n d3.event = o;\n }\n };\n }\n function d3_selection_onFilter(listener, argumentz) {\n var l = d3_selection_onListener(listener, argumentz);\n return function(e) {\n var target = this, related = e.relatedTarget;\n if (!related || related !== target && !(related.compareDocumentPosition(target) & 8)) {\n l.call(target, e);\n }\n };\n }\n var d3_event_dragSelect, d3_event_dragId = 0;\n function d3_event_dragSuppress(node) {\n var name2 = \".dragsuppress-\" + ++d3_event_dragId, click = \"click\" + name2, w = d3.select(d3_window(node)).on(\"touchmove\" + name2, d3_eventPreventDefault).on(\"dragstart\" + name2, d3_eventPreventDefault).on(\"selectstart\" + name2, d3_eventPreventDefault);\n if (d3_event_dragSelect == null) {\n d3_event_dragSelect = \"onselectstart\" in node ? false : d3_vendorSymbol(node.style, \"userSelect\");\n }\n if (d3_event_dragSelect) {\n var style = d3_documentElement(node).style, select = style[d3_event_dragSelect];\n style[d3_event_dragSelect] = \"none\";\n }\n return function(suppressClick) {\n w.on(name2, null);\n if (d3_event_dragSelect) style[d3_event_dragSelect] = select;\n if (suppressClick) {\n var off = function() {\n w.on(click, null);\n };\n w.on(click, function() {\n d3_eventPreventDefault();\n off();\n }, true);\n setTimeout(off, 0);\n }\n };\n }\n d3.mouse = function(container) {\n return d3_mousePoint(container, d3_eventSource());\n };\n var d3_mouse_bug44083 = this.navigator && /WebKit/.test(this.navigator.userAgent) ? -1 : 0;\n function d3_mousePoint(container, e) {\n if (e.changedTouches) e = e.changedTouches[0];\n var svg = container.ownerSVGElement || container;\n if (svg.createSVGPoint) {\n var point = svg.createSVGPoint();\n if (d3_mouse_bug44083 < 0) {\n var window2 = d3_window(container);\n if (window2.scrollX || window2.scrollY) {\n svg = d3.select(\"body\").append(\"svg\").style({\n position: \"absolute\",\n top: 0,\n left: 0,\n margin: 0,\n padding: 0,\n border: \"none\"\n }, \"important\");\n var ctm = svg[0][0].getScreenCTM();\n d3_mouse_bug44083 = !(ctm.f || ctm.e);\n svg.remove();\n }\n }\n if (d3_mouse_bug44083) point.x = e.pageX, point.y = e.pageY;\n else point.x = e.clientX, point.y = e.clientY;\n point = point.matrixTransform(container.getScreenCTM().inverse());\n return [point.x, point.y];\n }\n var rect = container.getBoundingClientRect();\n return [e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop];\n }\n d3.touch = function(container, touches, identifier) {\n if (arguments.length < 3) identifier = touches, touches = d3_eventSource().changedTouches;\n if (touches) for (var i = 0, n = touches.length, touch; i < n; ++i) {\n if ((touch = touches[i]).identifier === identifier) {\n return d3_mousePoint(container, touch);\n }\n }\n };\n d3.behavior.drag = function() {\n var event = d3_eventDispatch(drag, \"drag\", \"dragstart\", \"dragend\"), origin = null, mousedown = dragstart(d3_noop, d3.mouse, d3_window, \"mousemove\", \"mouseup\"), touchstart = dragstart(d3_behavior_dragTouchId, d3.touch, d3_identity, \"touchmove\", \"touchend\");\n function drag() {\n this.on(\"mousedown.drag\", mousedown).on(\"touchstart.drag\", touchstart);\n }\n function dragstart(id, position, subject, move, end) {\n return function() {\n var that = this, target = d3.event.target.correspondingElement || d3.event.target, parent = that.parentNode, dispatch = event.of(that, arguments), dragged = 0, dragId = id(), dragName = \".drag\" + (dragId == null ? \"\" : \"-\" + dragId), dragOffset, dragSubject = d3.select(subject(target)).on(move + dragName, moved).on(end + dragName, ended), dragRestore = d3_event_dragSuppress(target), position0 = position(parent, dragId);\n if (origin) {\n dragOffset = origin.apply(that, arguments);\n dragOffset = [dragOffset.x - position0[0], dragOffset.y - position0[1]];\n } else {\n dragOffset = [0, 0];\n }\n dispatch({\n type: \"dragstart\"\n });\n function moved() {\n var position1 = position(parent, dragId), dx, dy;\n if (!position1) return;\n dx = position1[0] - position0[0];\n dy = position1[1] - position0[1];\n dragged |= dx | dy;\n position0 = position1;\n dispatch({\n type: \"drag\",\n x: position1[0] + dragOffset[0],\n y: position1[1] + dragOffset[1],\n dx,\n dy\n });\n }\n function ended() {\n if (!position(parent, dragId)) return;\n dragSubject.on(move + dragName, null).on(end + dragName, null);\n dragRestore(dragged);\n dispatch({\n type: \"dragend\"\n });\n }\n };\n }\n drag.origin = function(x) {\n if (!arguments.length) return origin;\n origin = x;\n return drag;\n };\n return d3.rebind(drag, event, \"on\");\n };\n function d3_behavior_dragTouchId() {\n return d3.event.changedTouches[0].identifier;\n }\n d3.touches = function(container, touches) {\n if (arguments.length < 2) touches = d3_eventSource().touches;\n return touches ? d3_array(touches).map(function(touch) {\n var point = d3_mousePoint(container, touch);\n point.identifier = touch.identifier;\n return point;\n }) : [];\n };\n var \\u03B5 = 1e-6, \\u03B52 = \\u03B5 * \\u03B5, \\u03C0 = Math.PI, \\u03C4 = 2 * \\u03C0, \\u03C4\\u03B5 = \\u03C4 - \\u03B5, half\\u03C0 = \\u03C0 / 2, d3_radians = \\u03C0 / 180, d3_degrees = 180 / \\u03C0;\n function d3_sgn(x) {\n return x > 0 ? 1 : x < 0 ? -1 : 0;\n }\n function d3_cross2d(a, b, c) {\n return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);\n }\n function d3_acos(x) {\n return x > 1 ? 0 : x < -1 ? \\u03C0 : Math.acos(x);\n }\n function d3_asin(x) {\n return x > 1 ? half\\u03C0 : x < -1 ? -half\\u03C0 : Math.asin(x);\n }\n function d3_sinh(x) {\n return ((x = Math.exp(x)) - 1 / x) / 2;\n }\n function d3_cosh(x) {\n return ((x = Math.exp(x)) + 1 / x) / 2;\n }\n function d3_tanh(x) {\n return ((x = Math.exp(2 * x)) - 1) / (x + 1);\n }\n function d3_haversin(x) {\n return (x = Math.sin(x / 2)) * x;\n }\n var \\u03C1 = Math.SQRT2, \\u03C12 = 2, \\u03C14 = 4;\n d3.interpolateZoom = function(p0, p1) {\n var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S;\n if (d2 < \\u03B52) {\n S = Math.log(w1 / w0) / \\u03C1;\n i = function(t) {\n return [ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(\\u03C1 * t * S)];\n };\n } else {\n var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + \\u03C14 * d2) / (2 * w0 * \\u03C12 * d1), b1 = (w1 * w1 - w0 * w0 - \\u03C14 * d2) / (2 * w1 * \\u03C12 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);\n S = (r1 - r0) / \\u03C1;\n i = function(t) {\n var s = t * S, coshr0 = d3_cosh(r0), u = w0 / (\\u03C12 * d1) * (coshr0 * d3_tanh(\\u03C1 * s + r0) - d3_sinh(r0));\n return [ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / d3_cosh(\\u03C1 * s + r0)];\n };\n }\n i.duration = S * 1e3;\n return i;\n };\n d3.behavior.zoom = function() {\n var view = {\n x: 0,\n y: 0,\n k: 1\n }, translate0, center0, center, size = [960, 500], scaleExtent = d3_behavior_zoomInfinity, duration = 250, zooming = 0, mousedown = \"mousedown.zoom\", mousemove = \"mousemove.zoom\", mouseup = \"mouseup.zoom\", mousewheelTimer, touchstart = \"touchstart.zoom\", touchtime, event = d3_eventDispatch(zoom, \"zoomstart\", \"zoom\", \"zoomend\"), x0, x1, y0, y1;\n if (!d3_behavior_zoomWheel) {\n d3_behavior_zoomWheel = \"onwheel\" in d3_document ? (d3_behavior_zoomDelta = function() {\n return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1);\n }, \"wheel\") : \"onmousewheel\" in d3_document ? (d3_behavior_zoomDelta = function() {\n return d3.event.wheelDelta;\n }, \"mousewheel\") : (d3_behavior_zoomDelta = function() {\n return -d3.event.detail;\n }, \"MozMousePixelScroll\");\n }\n function zoom(g) {\n g.on(mousedown, mousedowned).on(d3_behavior_zoomWheel + \".zoom\", mousewheeled).on(\"dblclick.zoom\", dblclicked).on(touchstart, touchstarted);\n }\n zoom.event = function(g) {\n g.each(function() {\n var dispatch = event.of(this, arguments), view1 = view;\n if (d3_transitionInheritId) {\n d3.select(this).transition().each(\"start.zoom\", function() {\n view = this.__chart__ || {\n x: 0,\n y: 0,\n k: 1\n };\n zoomstarted(dispatch);\n }).tween(\"zoom:zoom\", function() {\n var dx = size[0], dy = size[1], cx = center0 ? center0[0] : dx / 2, cy = center0 ? center0[1] : dy / 2, i = d3.interpolateZoom([(cx - view.x) / view.k, (cy - view.y) / view.k, dx / view.k], [(cx - view1.x) / view1.k, (cy - view1.y) / view1.k, dx / view1.k]);\n return function(t) {\n var l = i(t), k = dx / l[2];\n this.__chart__ = view = {\n x: cx - l[0] * k,\n y: cy - l[1] * k,\n k\n };\n zoomed(dispatch);\n };\n }).each(\"interrupt.zoom\", function() {\n zoomended(dispatch);\n }).each(\"end.zoom\", function() {\n zoomended(dispatch);\n });\n } else {\n this.__chart__ = view;\n zoomstarted(dispatch);\n zoomed(dispatch);\n zoomended(dispatch);\n }\n });\n };\n zoom.translate = function(_) {\n if (!arguments.length) return [view.x, view.y];\n view = {\n x: +_[0],\n y: +_[1],\n k: view.k\n };\n rescale();\n return zoom;\n };\n zoom.scale = function(_) {\n if (!arguments.length) return view.k;\n view = {\n x: view.x,\n y: view.y,\n k: null\n };\n scaleTo(+_);\n rescale();\n return zoom;\n };\n zoom.scaleExtent = function(_) {\n if (!arguments.length) return scaleExtent;\n scaleExtent = _ == null ? d3_behavior_zoomInfinity : [+_[0], +_[1]];\n return zoom;\n };\n zoom.center = function(_) {\n if (!arguments.length) return center;\n center = _ && [+_[0], +_[1]];\n return zoom;\n };\n zoom.size = function(_) {\n if (!arguments.length) return size;\n size = _ && [+_[0], +_[1]];\n return zoom;\n };\n zoom.duration = function(_) {\n if (!arguments.length) return duration;\n duration = +_;\n return zoom;\n };\n zoom.x = function(z) {\n if (!arguments.length) return x1;\n x1 = z;\n x0 = z.copy();\n view = {\n x: 0,\n y: 0,\n k: 1\n };\n return zoom;\n };\n zoom.y = function(z) {\n if (!arguments.length) return y1;\n y1 = z;\n y0 = z.copy();\n view = {\n x: 0,\n y: 0,\n k: 1\n };\n return zoom;\n };\n function location2(p) {\n return [(p[0] - view.x) / view.k, (p[1] - view.y) / view.k];\n }\n function point(l) {\n return [l[0] * view.k + view.x, l[1] * view.k + view.y];\n }\n function scaleTo(s) {\n view.k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));\n }\n function translateTo(p, l) {\n l = point(l);\n view.x += p[0] - l[0];\n view.y += p[1] - l[1];\n }\n function zoomTo(that, p, l, k) {\n that.__chart__ = {\n x: view.x,\n y: view.y,\n k: view.k\n };\n scaleTo(Math.pow(2, k));\n translateTo(center0 = p, l);\n that = d3.select(that);\n if (duration > 0) that = that.transition().duration(duration);\n that.call(zoom.event);\n }\n function rescale() {\n if (x1) x1.domain(x0.range().map(function(x) {\n return (x - view.x) / view.k;\n }).map(x0.invert));\n if (y1) y1.domain(y0.range().map(function(y) {\n return (y - view.y) / view.k;\n }).map(y0.invert));\n }\n function zoomstarted(dispatch) {\n if (!zooming++) dispatch({\n type: \"zoomstart\"\n });\n }\n function zoomed(dispatch) {\n rescale();\n dispatch({\n type: \"zoom\",\n scale: view.k,\n translate: [view.x, view.y]\n });\n }\n function zoomended(dispatch) {\n if (!--zooming) dispatch({\n type: \"zoomend\"\n }), center0 = null;\n }\n function mousedowned() {\n var that = this, dispatch = event.of(that, arguments), dragged = 0, subject = d3.select(d3_window(that)).on(mousemove, moved).on(mouseup, ended), location0 = location2(d3.mouse(that)), dragRestore = d3_event_dragSuppress(that);\n d3_selection_interrupt.call(that);\n zoomstarted(dispatch);\n function moved() {\n dragged = 1;\n translateTo(d3.mouse(that), location0);\n zoomed(dispatch);\n }\n function ended() {\n subject.on(mousemove, null).on(mouseup, null);\n dragRestore(dragged);\n zoomended(dispatch);\n }\n }\n function touchstarted() {\n var that = this, dispatch = event.of(that, arguments), locations0 = {}, distance0 = 0, scale0, zoomName = \".zoom-\" + d3.event.changedTouches[0].identifier, touchmove = \"touchmove\" + zoomName, touchend = \"touchend\" + zoomName, targets = [], subject = d3.select(that), dragRestore = d3_event_dragSuppress(that);\n started();\n zoomstarted(dispatch);\n subject.on(mousedown, null).on(touchstart, started);\n function relocate() {\n var touches = d3.touches(that);\n scale0 = view.k;\n touches.forEach(function(t) {\n if (t.identifier in locations0) locations0[t.identifier] = location2(t);\n });\n return touches;\n }\n function started() {\n var target = d3.event.target;\n d3.select(target).on(touchmove, moved).on(touchend, ended);\n targets.push(target);\n var changed = d3.event.changedTouches;\n for (var i = 0, n = changed.length; i < n; ++i) {\n locations0[changed[i].identifier] = null;\n }\n var touches = relocate(), now = Date.now();\n if (touches.length === 1) {\n if (now - touchtime < 500) {\n var p = touches[0];\n zoomTo(that, p, locations0[p.identifier], Math.floor(Math.log(view.k) / Math.LN2) + 1);\n d3_eventPreventDefault();\n }\n touchtime = now;\n } else if (touches.length > 1) {\n var p = touches[0], q = touches[1], dx = p[0] - q[0], dy = p[1] - q[1];\n distance0 = dx * dx + dy * dy;\n }\n }\n function moved() {\n var touches = d3.touches(that), p0, l0, p1, l1;\n d3_selection_interrupt.call(that);\n for (var i = 0, n = touches.length; i < n; ++i, l1 = null) {\n p1 = touches[i];\n if (l1 = locations0[p1.identifier]) {\n if (l0) break;\n p0 = p1, l0 = l1;\n }\n }\n if (l1) {\n var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1, scale1 = distance0 && Math.sqrt(distance1 / distance0);\n p0 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];\n l0 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];\n scaleTo(scale1 * scale0);\n }\n touchtime = null;\n translateTo(p0, l0);\n zoomed(dispatch);\n }\n function ended() {\n if (d3.event.touches.length) {\n var changed = d3.event.changedTouches;\n for (var i = 0, n = changed.length; i < n; ++i) {\n delete locations0[changed[i].identifier];\n }\n for (var identifier in locations0) {\n return void relocate();\n }\n }\n d3.selectAll(targets).on(zoomName, null);\n subject.on(mousedown, mousedowned).on(touchstart, touchstarted);\n dragRestore();\n zoomended(dispatch);\n }\n }\n function mousewheeled() {\n var dispatch = event.of(this, arguments);\n if (mousewheelTimer) clearTimeout(mousewheelTimer);\n else d3_selection_interrupt.call(this), translate0 = location2(center0 = center || d3.mouse(this)), zoomstarted(dispatch);\n mousewheelTimer = setTimeout(function() {\n mousewheelTimer = null;\n zoomended(dispatch);\n }, 50);\n d3_eventPreventDefault();\n scaleTo(Math.pow(2, d3_behavior_zoomDelta() * 2e-3) * view.k);\n translateTo(center0, translate0);\n zoomed(dispatch);\n }\n function dblclicked() {\n var p = d3.mouse(this), k = Math.log(view.k) / Math.LN2;\n zoomTo(this, p, location2(p), d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1);\n }\n return d3.rebind(zoom, event, \"on\");\n };\n var d3_behavior_zoomInfinity = [0, Infinity], d3_behavior_zoomDelta, d3_behavior_zoomWheel;\n d3.color = d3_color;\n function d3_color() {\n }\n d3_color.prototype.toString = function() {\n return this.rgb() + \"\";\n };\n d3.hsl = d3_hsl;\n function d3_hsl(h, s, l) {\n return this instanceof d3_hsl ? void (this.h = +h, this.s = +s, this.l = +l) : arguments.length < 2 ? h instanceof d3_hsl ? new d3_hsl(h.h, h.s, h.l) : d3_rgb_parse(\"\" + h, d3_rgb_hsl, d3_hsl) : new d3_hsl(h, s, l);\n }\n var d3_hslPrototype = d3_hsl.prototype = new d3_color();\n d3_hslPrototype.brighter = function(k) {\n k = Math.pow(0.7, arguments.length ? k : 1);\n return new d3_hsl(this.h, this.s, this.l / k);\n };\n d3_hslPrototype.darker = function(k) {\n k = Math.pow(0.7, arguments.length ? k : 1);\n return new d3_hsl(this.h, this.s, k * this.l);\n };\n d3_hslPrototype.rgb = function() {\n return d3_hsl_rgb(this.h, this.s, this.l);\n };\n function d3_hsl_rgb(h, s, l) {\n var m1, m2;\n h = isNaN(h) ? 0 : (h %= 360) < 0 ? h + 360 : h;\n s = isNaN(s) ? 0 : s < 0 ? 0 : s > 1 ? 1 : s;\n l = l < 0 ? 0 : l > 1 ? 1 : l;\n m2 = l <= 0.5 ? l * (1 + s) : l + s - l * s;\n m1 = 2 * l - m2;\n function v(h2) {\n if (h2 > 360) h2 -= 360;\n else if (h2 < 0) h2 += 360;\n if (h2 < 60) return m1 + (m2 - m1) * h2 / 60;\n if (h2 < 180) return m2;\n if (h2 < 240) return m1 + (m2 - m1) * (240 - h2) / 60;\n return m1;\n }\n function vv(h2) {\n return Math.round(v(h2) * 255);\n }\n return new d3_rgb(vv(h + 120), vv(h), vv(h - 120));\n }\n d3.hcl = d3_hcl;\n function d3_hcl(h, c, l) {\n return this instanceof d3_hcl ? void (this.h = +h, this.c = +c, this.l = +l) : arguments.length < 2 ? h instanceof d3_hcl ? new d3_hcl(h.h, h.c, h.l) : h instanceof d3_lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : new d3_hcl(h, c, l);\n }\n var d3_hclPrototype = d3_hcl.prototype = new d3_color();\n d3_hclPrototype.brighter = function(k) {\n return new d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)));\n };\n d3_hclPrototype.darker = function(k) {\n return new d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)));\n };\n d3_hclPrototype.rgb = function() {\n return d3_hcl_lab(this.h, this.c, this.l).rgb();\n };\n function d3_hcl_lab(h, c, l) {\n if (isNaN(h)) h = 0;\n if (isNaN(c)) c = 0;\n return new d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c);\n }\n d3.lab = d3_lab;\n function d3_lab(l, a, b) {\n return this instanceof d3_lab ? void (this.l = +l, this.a = +a, this.b = +b) : arguments.length < 2 ? l instanceof d3_lab ? new d3_lab(l.l, l.a, l.b) : l instanceof d3_hcl ? d3_hcl_lab(l.h, l.c, l.l) : d3_rgb_lab((l = d3_rgb(l)).r, l.g, l.b) : new d3_lab(l, a, b);\n }\n var d3_lab_K = 18;\n var d3_lab_X = 0.95047, d3_lab_Y = 1, d3_lab_Z = 1.08883;\n var d3_labPrototype = d3_lab.prototype = new d3_color();\n d3_labPrototype.brighter = function(k) {\n return new d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);\n };\n d3_labPrototype.darker = function(k) {\n return new d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);\n };\n d3_labPrototype.rgb = function() {\n return d3_lab_rgb(this.l, this.a, this.b);\n };\n function d3_lab_rgb(l, a, b) {\n var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;\n x = d3_lab_xyz(x) * d3_lab_X;\n y = d3_lab_xyz(y) * d3_lab_Y;\n z = d3_lab_xyz(z) * d3_lab_Z;\n return new d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z), d3_xyz_rgb(-0.969266 * x + 1.8760108 * y + 0.041556 * z), d3_xyz_rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z));\n }\n function d3_lab_hcl(l, a, b) {\n return l > 0 ? new d3_hcl(Math.atan2(b, a) * d3_degrees, Math.sqrt(a * a + b * b), l) : new d3_hcl(NaN, NaN, l);\n }\n function d3_lab_xyz(x) {\n return x > 0.206893034 ? x * x * x : (x - 4 / 29) / 7.787037;\n }\n function d3_xyz_lab(x) {\n return x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;\n }\n function d3_xyz_rgb(r) {\n return Math.round(255 * (r <= 304e-5 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - 0.055));\n }\n d3.rgb = d3_rgb;\n function d3_rgb(r, g, b) {\n return this instanceof d3_rgb ? void (this.r = ~~r, this.g = ~~g, this.b = ~~b) : arguments.length < 2 ? r instanceof d3_rgb ? new d3_rgb(r.r, r.g, r.b) : d3_rgb_parse(\"\" + r, d3_rgb, d3_hsl_rgb) : new d3_rgb(r, g, b);\n }\n function d3_rgbNumber(value) {\n return new d3_rgb(value >> 16, value >> 8 & 255, value & 255);\n }\n function d3_rgbString(value) {\n return d3_rgbNumber(value) + \"\";\n }\n var d3_rgbPrototype = d3_rgb.prototype = new d3_color();\n d3_rgbPrototype.brighter = function(k) {\n k = Math.pow(0.7, arguments.length ? k : 1);\n var r = this.r, g = this.g, b = this.b, i = 30;\n if (!r && !g && !b) return new d3_rgb(i, i, i);\n if (r && r < i) r = i;\n if (g && g < i) g = i;\n if (b && b < i) b = i;\n return new d3_rgb(Math.min(255, r / k), Math.min(255, g / k), Math.min(255, b / k));\n };\n d3_rgbPrototype.darker = function(k) {\n k = Math.pow(0.7, arguments.length ? k : 1);\n return new d3_rgb(k * this.r, k * this.g, k * this.b);\n };\n d3_rgbPrototype.hsl = function() {\n return d3_rgb_hsl(this.r, this.g, this.b);\n };\n d3_rgbPrototype.toString = function() {\n return \"#\" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);\n };\n function d3_rgb_hex(v) {\n return v < 16 ? \"0\" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16);\n }\n function d3_rgb_parse(format, rgb2, hsl3) {\n var r = 0, g = 0, b = 0, m1, m2, color2;\n m1 = /([a-z]+)\\((.*)\\)/.exec(format = format.toLowerCase());\n if (m1) {\n m2 = m1[2].split(\",\");\n switch (m1[1]) {\n case \"hsl\": {\n return hsl3(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100);\n }\n case \"rgb\": {\n return rgb2(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2]));\n }\n }\n }\n if (color2 = d3_rgb_names.get(format)) {\n return rgb2(color2.r, color2.g, color2.b);\n }\n if (format != null && format.charAt(0) === \"#\" && !isNaN(color2 = parseInt(format.slice(1), 16))) {\n if (format.length === 4) {\n r = (color2 & 3840) >> 4;\n r = r >> 4 | r;\n g = color2 & 240;\n g = g >> 4 | g;\n b = color2 & 15;\n b = b << 4 | b;\n } else if (format.length === 7) {\n r = (color2 & 16711680) >> 16;\n g = (color2 & 65280) >> 8;\n b = color2 & 255;\n }\n }\n return rgb2(r, g, b);\n }\n function d3_rgb_hsl(r, g, b) {\n var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2;\n if (d) {\n s = l < 0.5 ? d / (max + min) : d / (2 - max - min);\n if (r == max) h = (g - b) / d + (g < b ? 6 : 0);\n else if (g == max) h = (b - r) / d + 2;\n else h = (r - g) / d + 4;\n h *= 60;\n } else {\n h = NaN;\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new d3_hsl(h, s, l);\n }\n function d3_rgb_lab(r, g, b) {\n r = d3_rgb_xyz(r);\n g = d3_rgb_xyz(g);\n b = d3_rgb_xyz(b);\n var x = d3_xyz_lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / d3_lab_X), y = d3_xyz_lab((0.2126729 * r + 0.7151522 * g + 0.072175 * b) / d3_lab_Y), z = d3_xyz_lab((0.0193339 * r + 0.119192 * g + 0.9503041 * b) / d3_lab_Z);\n return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z));\n }\n function d3_rgb_xyz(r) {\n return (r /= 255) <= 0.04045 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4);\n }\n function d3_rgb_parseNumber(c) {\n var f = parseFloat(c);\n return c.charAt(c.length - 1) === \"%\" ? Math.round(f * 2.55) : f;\n }\n var d3_rgb_names = d3.map({\n aliceblue: 15792383,\n antiquewhite: 16444375,\n aqua: 65535,\n aquamarine: 8388564,\n azure: 15794175,\n beige: 16119260,\n bisque: 16770244,\n black: 0,\n blanchedalmond: 16772045,\n blue: 255,\n blueviolet: 9055202,\n brown: 10824234,\n burlywood: 14596231,\n cadetblue: 6266528,\n chartreuse: 8388352,\n chocolate: 13789470,\n coral: 16744272,\n cornflowerblue: 6591981,\n cornsilk: 16775388,\n crimson: 14423100,\n cyan: 65535,\n darkblue: 139,\n darkcyan: 35723,\n darkgoldenrod: 12092939,\n darkgray: 11119017,\n darkgreen: 25600,\n darkgrey: 11119017,\n darkkhaki: 12433259,\n darkmagenta: 9109643,\n darkolivegreen: 5597999,\n darkorange: 16747520,\n darkorchid: 10040012,\n darkred: 9109504,\n darksalmon: 15308410,\n darkseagreen: 9419919,\n darkslateblue: 4734347,\n darkslategray: 3100495,\n darkslategrey: 3100495,\n darkturquoise: 52945,\n darkviolet: 9699539,\n deeppink: 16716947,\n deepskyblue: 49151,\n dimgray: 6908265,\n dimgrey: 6908265,\n dodgerblue: 2003199,\n firebrick: 11674146,\n floralwhite: 16775920,\n forestgreen: 2263842,\n fuchsia: 16711935,\n gainsboro: 14474460,\n ghostwhite: 16316671,\n gold: 16766720,\n goldenrod: 14329120,\n gray: 8421504,\n green: 32768,\n greenyellow: 11403055,\n grey: 8421504,\n honeydew: 15794160,\n hotpink: 16738740,\n indianred: 13458524,\n indigo: 4915330,\n ivory: 16777200,\n khaki: 15787660,\n lavender: 15132410,\n lavenderblush: 16773365,\n lawngreen: 8190976,\n lemonchiffon: 16775885,\n lightblue: 11393254,\n lightcoral: 15761536,\n lightcyan: 14745599,\n lightgoldenrodyellow: 16448210,\n lightgray: 13882323,\n lightgreen: 9498256,\n lightgrey: 13882323,\n lightpink: 16758465,\n lightsalmon: 16752762,\n lightseagreen: 2142890,\n lightskyblue: 8900346,\n lightslategray: 7833753,\n lightslategrey: 7833753,\n lightsteelblue: 11584734,\n lightyellow: 16777184,\n lime: 65280,\n limegreen: 3329330,\n linen: 16445670,\n magenta: 16711935,\n maroon: 8388608,\n mediumaquamarine: 6737322,\n mediumblue: 205,\n mediumorchid: 12211667,\n mediumpurple: 9662683,\n mediumseagreen: 3978097,\n mediumslateblue: 8087790,\n mediumspringgreen: 64154,\n mediumturquoise: 4772300,\n mediumvioletred: 13047173,\n midnightblue: 1644912,\n mintcream: 16121850,\n mistyrose: 16770273,\n moccasin: 16770229,\n navajowhite: 16768685,\n navy: 128,\n oldlace: 16643558,\n olive: 8421376,\n olivedrab: 7048739,\n orange: 16753920,\n orangered: 16729344,\n orchid: 14315734,\n palegoldenrod: 15657130,\n palegreen: 10025880,\n paleturquoise: 11529966,\n palevioletred: 14381203,\n papayawhip: 16773077,\n peachpuff: 16767673,\n peru: 13468991,\n pink: 16761035,\n plum: 14524637,\n powderblue: 11591910,\n purple: 8388736,\n rebeccapurple: 6697881,\n red: 16711680,\n rosybrown: 12357519,\n royalblue: 4286945,\n saddlebrown: 9127187,\n salmon: 16416882,\n sandybrown: 16032864,\n seagreen: 3050327,\n seashell: 16774638,\n sienna: 10506797,\n silver: 12632256,\n skyblue: 8900331,\n slateblue: 6970061,\n slategray: 7372944,\n slategrey: 7372944,\n snow: 16775930,\n springgreen: 65407,\n steelblue: 4620980,\n tan: 13808780,\n teal: 32896,\n thistle: 14204888,\n tomato: 16737095,\n turquoise: 4251856,\n violet: 15631086,\n wheat: 16113331,\n white: 16777215,\n whitesmoke: 16119285,\n yellow: 16776960,\n yellowgreen: 10145074\n });\n d3_rgb_names.forEach(function(key, value) {\n d3_rgb_names.set(key, d3_rgbNumber(value));\n });\n function d3_functor(v) {\n return typeof v === \"function\" ? v : function() {\n return v;\n };\n }\n d3.functor = d3_functor;\n d3.xhr = d3_xhrType(d3_identity);\n function d3_xhrType(response) {\n return function(url, mimeType, callback) {\n if (arguments.length === 2 && typeof mimeType === \"function\") callback = mimeType, mimeType = null;\n return d3_xhr(url, mimeType, response, callback);\n };\n }\n function d3_xhr(url, mimeType, response, callback) {\n var xhr = {}, dispatch = d3.dispatch(\"beforesend\", \"progress\", \"load\", \"error\"), headers = {}, request = new XMLHttpRequest(), responseType = null;\n if (self.XDomainRequest && !(\"withCredentials\" in request) && /^(http(s)?:)?\\/\\//.test(url)) request = new XDomainRequest();\n \"onload\" in request ? request.onload = request.onerror = respond : request.onreadystatechange = function() {\n request.readyState > 3 && respond();\n };\n function respond() {\n var status = request.status, result;\n if (!status && d3_xhrHasResponse(request) || status >= 200 && status < 300 || status === 304) {\n try {\n result = response.call(xhr, request);\n } catch (e) {\n dispatch.error.call(xhr, e);\n return;\n }\n dispatch.load.call(xhr, result);\n } else {\n dispatch.error.call(xhr, request);\n }\n }\n request.onprogress = function(event) {\n var o = d3.event;\n d3.event = event;\n try {\n dispatch.progress.call(xhr, request);\n } finally {\n d3.event = o;\n }\n };\n xhr.header = function(name2, value) {\n name2 = (name2 + \"\").toLowerCase();\n if (arguments.length < 2) return headers[name2];\n if (value == null) delete headers[name2];\n else headers[name2] = value + \"\";\n return xhr;\n };\n xhr.mimeType = function(value) {\n if (!arguments.length) return mimeType;\n mimeType = value == null ? null : value + \"\";\n return xhr;\n };\n xhr.responseType = function(value) {\n if (!arguments.length) return responseType;\n responseType = value;\n return xhr;\n };\n xhr.response = function(value) {\n response = value;\n return xhr;\n };\n [\"get\", \"post\"].forEach(function(method) {\n xhr[method] = function() {\n return xhr.send.apply(xhr, [method].concat(d3_array(arguments)));\n };\n });\n xhr.send = function(method, data, callback2) {\n if (arguments.length === 2 && typeof data === \"function\") callback2 = data, data = null;\n request.open(method, url, true);\n if (mimeType != null && !(\"accept\" in headers)) headers[\"accept\"] = mimeType + \",*/*\";\n if (request.setRequestHeader) for (var name2 in headers) request.setRequestHeader(name2, headers[name2]);\n if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType);\n if (responseType != null) request.responseType = responseType;\n if (callback2 != null) xhr.on(\"error\", callback2).on(\"load\", function(request2) {\n callback2(null, request2);\n });\n dispatch.beforesend.call(xhr, request);\n request.send(data == null ? null : data);\n return xhr;\n };\n xhr.abort = function() {\n request.abort();\n return xhr;\n };\n d3.rebind(xhr, dispatch, \"on\");\n return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback));\n }\n function d3_xhr_fixCallback(callback) {\n return callback.length === 1 ? function(error, request) {\n callback(error == null ? request : null);\n } : callback;\n }\n function d3_xhrHasResponse(request) {\n var type = request.responseType;\n return type && type !== \"text\" ? request.response : request.responseText;\n }\n d3.dsv = function(delimiter, mimeType) {\n var reFormat = new RegExp('[\"' + delimiter + \"\\n]\"), delimiterCode = delimiter.charCodeAt(0);\n function dsv(url, row, callback) {\n if (arguments.length < 3) callback = row, row = null;\n var xhr = d3_xhr(url, mimeType, row == null ? response : typedResponse(row), callback);\n xhr.row = function(_) {\n return arguments.length ? xhr.response((row = _) == null ? response : typedResponse(_)) : row;\n };\n return xhr;\n }\n function response(request) {\n return dsv.parse(request.responseText);\n }\n function typedResponse(f) {\n return function(request) {\n return dsv.parse(request.responseText, f);\n };\n }\n dsv.parse = function(text, f) {\n var o;\n return dsv.parseRows(text, function(row, i) {\n if (o) return o(row, i - 1);\n var a = function(d) {\n var obj = {};\n var len = row.length;\n for (var k = 0; k < len; ++k) {\n obj[row[k]] = d[k];\n }\n return obj;\n };\n o = f ? function(row2, i2) {\n return f(a(row2), i2);\n } : a;\n });\n };\n dsv.parseRows = function(text, f) {\n var EOL = {}, EOF = {}, rows = [], N = text.length, I = 0, n = 0, t, eol;\n function token() {\n if (I >= N) return EOF;\n if (eol) return eol = false, EOL;\n var j = I;\n if (text.charCodeAt(j) === 34) {\n var i = j;\n while (i++ < N) {\n if (text.charCodeAt(i) === 34) {\n if (text.charCodeAt(i + 1) !== 34) break;\n ++i;\n }\n }\n I = i + 2;\n var c = text.charCodeAt(i + 1);\n if (c === 13) {\n eol = true;\n if (text.charCodeAt(i + 2) === 10) ++I;\n } else if (c === 10) {\n eol = true;\n }\n return text.slice(j + 1, i).replace(/\"\"/g, '\"');\n }\n while (I < N) {\n var c = text.charCodeAt(I++), k = 1;\n if (c === 10) eol = true;\n else if (c === 13) {\n eol = true;\n if (text.charCodeAt(I) === 10) ++I, ++k;\n } else if (c !== delimiterCode) continue;\n return text.slice(j, I - k);\n }\n return text.slice(j);\n }\n while ((t = token()) !== EOF) {\n var a = [];\n while (t !== EOL && t !== EOF) {\n a.push(t);\n t = token();\n }\n if (f && (a = f(a, n++)) == null) continue;\n rows.push(a);\n }\n return rows;\n };\n dsv.format = function(rows) {\n if (Array.isArray(rows[0])) return dsv.formatRows(rows);\n var fieldSet = new d3_Set(), fields = [];\n rows.forEach(function(row) {\n for (var field in row) {\n if (!fieldSet.has(field)) {\n fields.push(fieldSet.add(field));\n }\n }\n });\n return [fields.map(formatValue).join(delimiter)].concat(rows.map(function(row) {\n return fields.map(function(field) {\n return formatValue(row[field]);\n }).join(delimiter);\n })).join(\"\\n\");\n };\n dsv.formatRows = function(rows) {\n return rows.map(formatRow).join(\"\\n\");\n };\n function formatRow(row) {\n return row.map(formatValue).join(delimiter);\n }\n function formatValue(text) {\n return reFormat.test(text) ? '\"' + text.replace(/\\\"/g, '\"\"') + '\"' : text;\n }\n return dsv;\n };\n d3.csv = d3.dsv(\",\", \"text/csv\");\n d3.tsv = d3.dsv(\"\t\", \"text/tab-separated-values\");\n var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout, d3_timer_frame = this[d3_vendorSymbol(this, \"requestAnimationFrame\")] || function(callback) {\n setTimeout(callback, 17);\n };\n d3.timer = function() {\n d3_timer.apply(this, arguments);\n };\n function d3_timer(callback, delay, then) {\n var n = arguments.length;\n if (n < 2) delay = 0;\n if (n < 3) then = Date.now();\n var time = then + delay, timer = {\n c: callback,\n t: time,\n n: null\n };\n if (d3_timer_queueTail) d3_timer_queueTail.n = timer;\n else d3_timer_queueHead = timer;\n d3_timer_queueTail = timer;\n if (!d3_timer_interval) {\n d3_timer_timeout = clearTimeout(d3_timer_timeout);\n d3_timer_interval = 1;\n d3_timer_frame(d3_timer_step);\n }\n return timer;\n }\n function d3_timer_step() {\n var now = d3_timer_mark(), delay = d3_timer_sweep() - now;\n if (delay > 24) {\n if (isFinite(delay)) {\n clearTimeout(d3_timer_timeout);\n d3_timer_timeout = setTimeout(d3_timer_step, delay);\n }\n d3_timer_interval = 0;\n } else {\n d3_timer_interval = 1;\n d3_timer_frame(d3_timer_step);\n }\n }\n d3.timer.flush = function() {\n d3_timer_mark();\n d3_timer_sweep();\n };\n function d3_timer_mark() {\n var now = Date.now(), timer = d3_timer_queueHead;\n while (timer) {\n if (now >= timer.t && timer.c(now - timer.t)) timer.c = null;\n timer = timer.n;\n }\n return now;\n }\n function d3_timer_sweep() {\n var t02, t12 = d3_timer_queueHead, time = Infinity;\n while (t12) {\n if (t12.c) {\n if (t12.t < time) time = t12.t;\n t12 = (t02 = t12).n;\n } else {\n t12 = t02 ? t02.n = t12.n : d3_timer_queueHead = t12.n;\n }\n }\n d3_timer_queueTail = t02;\n return time;\n }\n d3.round = function(x, n) {\n return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x);\n };\n d3.geom = {};\n function d3_geom_pointX(d) {\n return d[0];\n }\n function d3_geom_pointY(d) {\n return d[1];\n }\n d3.geom.hull = function(vertices) {\n var x = d3_geom_pointX, y = d3_geom_pointY;\n if (arguments.length) return hull(vertices);\n function hull(data) {\n if (data.length < 3) return [];\n var fx = d3_functor(x), fy = d3_functor(y), i, n = data.length, points = [], flippedPoints = [];\n for (i = 0; i < n; i++) {\n points.push([+fx.call(this, data[i], i), +fy.call(this, data[i], i), i]);\n }\n points.sort(d3_geom_hullOrder);\n for (i = 0; i < n; i++) flippedPoints.push([points[i][0], -points[i][1]]);\n var upper = d3_geom_hullUpper(points), lower = d3_geom_hullUpper(flippedPoints);\n var skipLeft = lower[0] === upper[0], skipRight = lower[lower.length - 1] === upper[upper.length - 1], polygon = [];\n for (i = upper.length - 1; i >= 0; --i) polygon.push(data[points[upper[i]][2]]);\n for (i = +skipLeft; i < lower.length - skipRight; ++i) polygon.push(data[points[lower[i]][2]]);\n return polygon;\n }\n hull.x = function(_) {\n return arguments.length ? (x = _, hull) : x;\n };\n hull.y = function(_) {\n return arguments.length ? (y = _, hull) : y;\n };\n return hull;\n };\n function d3_geom_hullUpper(points) {\n var n = points.length, hull = [0, 1], hs = 2;\n for (var i = 2; i < n; i++) {\n while (hs > 1 && d3_cross2d(points[hull[hs - 2]], points[hull[hs - 1]], points[i]) <= 0) --hs;\n hull[hs++] = i;\n }\n return hull.slice(0, hs);\n }\n function d3_geom_hullOrder(a, b) {\n return a[0] - b[0] || a[1] - b[1];\n }\n d3.geom.polygon = function(coordinates) {\n d3_subclass(coordinates, d3_geom_polygonPrototype);\n return coordinates;\n };\n var d3_geom_polygonPrototype = d3.geom.polygon.prototype = [];\n d3_geom_polygonPrototype.area = function() {\n var i = -1, n = this.length, a, b = this[n - 1], area = 0;\n while (++i < n) {\n a = b;\n b = this[i];\n area += a[1] * b[0] - a[0] * b[1];\n }\n return area * 0.5;\n };\n d3_geom_polygonPrototype.centroid = function(k) {\n var i = -1, n = this.length, x = 0, y = 0, a, b = this[n - 1], c;\n if (!arguments.length) k = -1 / (6 * this.area());\n while (++i < n) {\n a = b;\n b = this[i];\n c = a[0] * b[1] - b[0] * a[1];\n x += (a[0] + b[0]) * c;\n y += (a[1] + b[1]) * c;\n }\n return [x * k, y * k];\n };\n d3_geom_polygonPrototype.clip = function(subject) {\n var input, closed = d3_geom_polygonClosed(subject), i = -1, n = this.length - d3_geom_polygonClosed(this), j, m, a = this[n - 1], b, c, d;\n while (++i < n) {\n input = subject.slice();\n subject.length = 0;\n b = this[i];\n c = input[(m = input.length - closed) - 1];\n j = -1;\n while (++j < m) {\n d = input[j];\n if (d3_geom_polygonInside(d, a, b)) {\n if (!d3_geom_polygonInside(c, a, b)) {\n subject.push(d3_geom_polygonIntersect(c, d, a, b));\n }\n subject.push(d);\n } else if (d3_geom_polygonInside(c, a, b)) {\n subject.push(d3_geom_polygonIntersect(c, d, a, b));\n }\n c = d;\n }\n if (closed) subject.push(subject[0]);\n a = b;\n }\n return subject;\n };\n function d3_geom_polygonInside(p, a, b) {\n return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);\n }\n function d3_geom_polygonIntersect(c, d, a, b) {\n var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21);\n return [x1 + ua * x21, y1 + ua * y21];\n }\n function d3_geom_polygonClosed(coordinates) {\n var a = coordinates[0], b = coordinates[coordinates.length - 1];\n return !(a[0] - b[0] || a[1] - b[1]);\n }\n var d3_geom_voronoiEdges, d3_geom_voronoiCells, d3_geom_voronoiBeaches, d3_geom_voronoiBeachPool = [], d3_geom_voronoiFirstCircle, d3_geom_voronoiCircles, d3_geom_voronoiCirclePool = [];\n function d3_geom_voronoiBeach() {\n d3_geom_voronoiRedBlackNode(this);\n this.edge = this.site = this.circle = null;\n }\n function d3_geom_voronoiCreateBeach(site) {\n var beach = d3_geom_voronoiBeachPool.pop() || new d3_geom_voronoiBeach();\n beach.site = site;\n return beach;\n }\n function d3_geom_voronoiDetachBeach(beach) {\n d3_geom_voronoiDetachCircle(beach);\n d3_geom_voronoiBeaches.remove(beach);\n d3_geom_voronoiBeachPool.push(beach);\n d3_geom_voronoiRedBlackNode(beach);\n }\n function d3_geom_voronoiRemoveBeach(beach) {\n var circle = beach.circle, x = circle.x, y = circle.cy, vertex = {\n x,\n y\n }, previous = beach.P, next = beach.N, disappearing = [beach];\n d3_geom_voronoiDetachBeach(beach);\n var lArc = previous;\n while (lArc.circle && abs(x - lArc.circle.x) < \\u03B5 && abs(y - lArc.circle.cy) < \\u03B5) {\n previous = lArc.P;\n disappearing.unshift(lArc);\n d3_geom_voronoiDetachBeach(lArc);\n lArc = previous;\n }\n disappearing.unshift(lArc);\n d3_geom_voronoiDetachCircle(lArc);\n var rArc = next;\n while (rArc.circle && abs(x - rArc.circle.x) < \\u03B5 && abs(y - rArc.circle.cy) < \\u03B5) {\n next = rArc.N;\n disappearing.push(rArc);\n d3_geom_voronoiDetachBeach(rArc);\n rArc = next;\n }\n disappearing.push(rArc);\n d3_geom_voronoiDetachCircle(rArc);\n var nArcs = disappearing.length, iArc;\n for (iArc = 1; iArc < nArcs; ++iArc) {\n rArc = disappearing[iArc];\n lArc = disappearing[iArc - 1];\n d3_geom_voronoiSetEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex);\n }\n lArc = disappearing[0];\n rArc = disappearing[nArcs - 1];\n rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, rArc.site, null, vertex);\n d3_geom_voronoiAttachCircle(lArc);\n d3_geom_voronoiAttachCircle(rArc);\n }\n function d3_geom_voronoiAddBeach(site) {\n var x = site.x, directrix = site.y, lArc, rArc, dxl, dxr, node = d3_geom_voronoiBeaches._;\n while (node) {\n dxl = d3_geom_voronoiLeftBreakPoint(node, directrix) - x;\n if (dxl > \\u03B5) node = node.L;\n else {\n dxr = x - d3_geom_voronoiRightBreakPoint(node, directrix);\n if (dxr > \\u03B5) {\n if (!node.R) {\n lArc = node;\n break;\n }\n node = node.R;\n } else {\n if (dxl > -\\u03B5) {\n lArc = node.P;\n rArc = node;\n } else if (dxr > -\\u03B5) {\n lArc = node;\n rArc = node.N;\n } else {\n lArc = rArc = node;\n }\n break;\n }\n }\n }\n var newArc = d3_geom_voronoiCreateBeach(site);\n d3_geom_voronoiBeaches.insert(lArc, newArc);\n if (!lArc && !rArc) return;\n if (lArc === rArc) {\n d3_geom_voronoiDetachCircle(lArc);\n rArc = d3_geom_voronoiCreateBeach(lArc.site);\n d3_geom_voronoiBeaches.insert(newArc, rArc);\n newArc.edge = rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site);\n d3_geom_voronoiAttachCircle(lArc);\n d3_geom_voronoiAttachCircle(rArc);\n return;\n }\n if (!rArc) {\n newArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site);\n return;\n }\n d3_geom_voronoiDetachCircle(lArc);\n d3_geom_voronoiDetachCircle(rArc);\n var lSite = lArc.site, ax = lSite.x, ay = lSite.y, bx = site.x - ax, by = site.y - ay, rSite = rArc.site, cx = rSite.x - ax, cy = rSite.y - ay, d = 2 * (bx * cy - by * cx), hb = bx * bx + by * by, hc = cx * cx + cy * cy, vertex = {\n x: (cy * hb - by * hc) / d + ax,\n y: (bx * hc - cx * hb) / d + ay\n };\n d3_geom_voronoiSetEdgeEnd(rArc.edge, lSite, rSite, vertex);\n newArc.edge = d3_geom_voronoiCreateEdge(lSite, site, null, vertex);\n rArc.edge = d3_geom_voronoiCreateEdge(site, rSite, null, vertex);\n d3_geom_voronoiAttachCircle(lArc);\n d3_geom_voronoiAttachCircle(rArc);\n }\n function d3_geom_voronoiLeftBreakPoint(arc, directrix) {\n var site = arc.site, rfocx = site.x, rfocy = site.y, pby2 = rfocy - directrix;\n if (!pby2) return rfocx;\n var lArc = arc.P;\n if (!lArc) return -Infinity;\n site = lArc.site;\n var lfocx = site.x, lfocy = site.y, plby2 = lfocy - directrix;\n if (!plby2) return lfocx;\n var hl = lfocx - rfocx, aby2 = 1 / pby2 - 1 / plby2, b = hl / plby2;\n if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx;\n return (rfocx + lfocx) / 2;\n }\n function d3_geom_voronoiRightBreakPoint(arc, directrix) {\n var rArc = arc.N;\n if (rArc) return d3_geom_voronoiLeftBreakPoint(rArc, directrix);\n var site = arc.site;\n return site.y === directrix ? site.x : Infinity;\n }\n function d3_geom_voronoiCell(site) {\n this.site = site;\n this.edges = [];\n }\n d3_geom_voronoiCell.prototype.prepare = function() {\n var halfEdges = this.edges, iHalfEdge = halfEdges.length, edge;\n while (iHalfEdge--) {\n edge = halfEdges[iHalfEdge].edge;\n if (!edge.b || !edge.a) halfEdges.splice(iHalfEdge, 1);\n }\n halfEdges.sort(d3_geom_voronoiHalfEdgeOrder);\n return halfEdges.length;\n };\n function d3_geom_voronoiCloseCells(extent) {\n var x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], x2, y2, x3, y3, cells = d3_geom_voronoiCells, iCell = cells.length, cell, iHalfEdge, halfEdges, nHalfEdges, start, end;\n while (iCell--) {\n cell = cells[iCell];\n if (!cell || !cell.prepare()) continue;\n halfEdges = cell.edges;\n nHalfEdges = halfEdges.length;\n iHalfEdge = 0;\n while (iHalfEdge < nHalfEdges) {\n end = halfEdges[iHalfEdge].end(), x3 = end.x, y3 = end.y;\n start = halfEdges[++iHalfEdge % nHalfEdges].start(), x2 = start.x, y2 = start.y;\n if (abs(x3 - x2) > \\u03B5 || abs(y3 - y2) > \\u03B5) {\n halfEdges.splice(iHalfEdge, 0, new d3_geom_voronoiHalfEdge(d3_geom_voronoiCreateBorderEdge(cell.site, end, abs(x3 - x0) < \\u03B5 && y1 - y3 > \\u03B5 ? {\n x: x0,\n y: abs(x2 - x0) < \\u03B5 ? y2 : y1\n } : abs(y3 - y1) < \\u03B5 && x1 - x3 > \\u03B5 ? {\n x: abs(y2 - y1) < \\u03B5 ? x2 : x1,\n y: y1\n } : abs(x3 - x1) < \\u03B5 && y3 - y0 > \\u03B5 ? {\n x: x1,\n y: abs(x2 - x1) < \\u03B5 ? y2 : y0\n } : abs(y3 - y0) < \\u03B5 && x3 - x0 > \\u03B5 ? {\n x: abs(y2 - y0) < \\u03B5 ? x2 : x0,\n y: y0\n } : null), cell.site, null));\n ++nHalfEdges;\n }\n }\n }\n }\n function d3_geom_voronoiHalfEdgeOrder(a, b) {\n return b.angle - a.angle;\n }\n function d3_geom_voronoiCircle() {\n d3_geom_voronoiRedBlackNode(this);\n this.x = this.y = this.arc = this.site = this.cy = null;\n }\n function d3_geom_voronoiAttachCircle(arc) {\n var lArc = arc.P, rArc = arc.N;\n if (!lArc || !rArc) return;\n var lSite = lArc.site, cSite = arc.site, rSite = rArc.site;\n if (lSite === rSite) return;\n var bx = cSite.x, by = cSite.y, ax = lSite.x - bx, ay = lSite.y - by, cx = rSite.x - bx, cy = rSite.y - by;\n var d = 2 * (ax * cy - ay * cx);\n if (d >= -\\u03B52) return;\n var ha = ax * ax + ay * ay, hc = cx * cx + cy * cy, x = (cy * ha - ay * hc) / d, y = (ax * hc - cx * ha) / d, cy = y + by;\n var circle = d3_geom_voronoiCirclePool.pop() || new d3_geom_voronoiCircle();\n circle.arc = arc;\n circle.site = cSite;\n circle.x = x + bx;\n circle.y = cy + Math.sqrt(x * x + y * y);\n circle.cy = cy;\n arc.circle = circle;\n var before = null, node = d3_geom_voronoiCircles._;\n while (node) {\n if (circle.y < node.y || circle.y === node.y && circle.x <= node.x) {\n if (node.L) node = node.L;\n else {\n before = node.P;\n break;\n }\n } else {\n if (node.R) node = node.R;\n else {\n before = node;\n break;\n }\n }\n }\n d3_geom_voronoiCircles.insert(before, circle);\n if (!before) d3_geom_voronoiFirstCircle = circle;\n }\n function d3_geom_voronoiDetachCircle(arc) {\n var circle = arc.circle;\n if (circle) {\n if (!circle.P) d3_geom_voronoiFirstCircle = circle.N;\n d3_geom_voronoiCircles.remove(circle);\n d3_geom_voronoiCirclePool.push(circle);\n d3_geom_voronoiRedBlackNode(circle);\n arc.circle = null;\n }\n }\n function d3_geom_clipLine(x0, y0, x1, y1) {\n return function(line) {\n var a = line.a, b = line.b, ax = a.x, ay = a.y, bx = b.x, by = b.y, t02 = 0, t12 = 1, dx = bx - ax, dy = by - ay, r;\n r = x0 - ax;\n if (!dx && r > 0) return;\n r /= dx;\n if (dx < 0) {\n if (r < t02) return;\n if (r < t12) t12 = r;\n } else if (dx > 0) {\n if (r > t12) return;\n if (r > t02) t02 = r;\n }\n r = x1 - ax;\n if (!dx && r < 0) return;\n r /= dx;\n if (dx < 0) {\n if (r > t12) return;\n if (r > t02) t02 = r;\n } else if (dx > 0) {\n if (r < t02) return;\n if (r < t12) t12 = r;\n }\n r = y0 - ay;\n if (!dy && r > 0) return;\n r /= dy;\n if (dy < 0) {\n if (r < t02) return;\n if (r < t12) t12 = r;\n } else if (dy > 0) {\n if (r > t12) return;\n if (r > t02) t02 = r;\n }\n r = y1 - ay;\n if (!dy && r < 0) return;\n r /= dy;\n if (dy < 0) {\n if (r > t12) return;\n if (r > t02) t02 = r;\n } else if (dy > 0) {\n if (r < t02) return;\n if (r < t12) t12 = r;\n }\n if (t02 > 0) line.a = {\n x: ax + t02 * dx,\n y: ay + t02 * dy\n };\n if (t12 < 1) line.b = {\n x: ax + t12 * dx,\n y: ay + t12 * dy\n };\n return line;\n };\n }\n function d3_geom_voronoiClipEdges(extent) {\n var edges = d3_geom_voronoiEdges, clip = d3_geom_clipLine(extent[0][0], extent[0][1], extent[1][0], extent[1][1]), i = edges.length, e;\n while (i--) {\n e = edges[i];\n if (!d3_geom_voronoiConnectEdge(e, extent) || !clip(e) || abs(e.a.x - e.b.x) < \\u03B5 && abs(e.a.y - e.b.y) < \\u03B5) {\n e.a = e.b = null;\n edges.splice(i, 1);\n }\n }\n }\n function d3_geom_voronoiConnectEdge(edge, extent) {\n var vb = edge.b;\n if (vb) return true;\n var va = edge.a, x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], lSite = edge.l, rSite = edge.r, lx = lSite.x, ly = lSite.y, rx = rSite.x, ry = rSite.y, fx = (lx + rx) / 2, fy = (ly + ry) / 2, fm, fb;\n if (ry === ly) {\n if (fx < x0 || fx >= x1) return;\n if (lx > rx) {\n if (!va) va = {\n x: fx,\n y: y0\n };\n else if (va.y >= y1) return;\n vb = {\n x: fx,\n y: y1\n };\n } else {\n if (!va) va = {\n x: fx,\n y: y1\n };\n else if (va.y < y0) return;\n vb = {\n x: fx,\n y: y0\n };\n }\n } else {\n fm = (lx - rx) / (ry - ly);\n fb = fy - fm * fx;\n if (fm < -1 || fm > 1) {\n if (lx > rx) {\n if (!va) va = {\n x: (y0 - fb) / fm,\n y: y0\n };\n else if (va.y >= y1) return;\n vb = {\n x: (y1 - fb) / fm,\n y: y1\n };\n } else {\n if (!va) va = {\n x: (y1 - fb) / fm,\n y: y1\n };\n else if (va.y < y0) return;\n vb = {\n x: (y0 - fb) / fm,\n y: y0\n };\n }\n } else {\n if (ly < ry) {\n if (!va) va = {\n x: x0,\n y: fm * x0 + fb\n };\n else if (va.x >= x1) return;\n vb = {\n x: x1,\n y: fm * x1 + fb\n };\n } else {\n if (!va) va = {\n x: x1,\n y: fm * x1 + fb\n };\n else if (va.x < x0) return;\n vb = {\n x: x0,\n y: fm * x0 + fb\n };\n }\n }\n }\n edge.a = va;\n edge.b = vb;\n return true;\n }\n function d3_geom_voronoiEdge(lSite, rSite) {\n this.l = lSite;\n this.r = rSite;\n this.a = this.b = null;\n }\n function d3_geom_voronoiCreateEdge(lSite, rSite, va, vb) {\n var edge = new d3_geom_voronoiEdge(lSite, rSite);\n d3_geom_voronoiEdges.push(edge);\n if (va) d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, va);\n if (vb) d3_geom_voronoiSetEdgeEnd(edge, rSite, lSite, vb);\n d3_geom_voronoiCells[lSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, lSite, rSite));\n d3_geom_voronoiCells[rSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, rSite, lSite));\n return edge;\n }\n function d3_geom_voronoiCreateBorderEdge(lSite, va, vb) {\n var edge = new d3_geom_voronoiEdge(lSite, null);\n edge.a = va;\n edge.b = vb;\n d3_geom_voronoiEdges.push(edge);\n return edge;\n }\n function d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, vertex) {\n if (!edge.a && !edge.b) {\n edge.a = vertex;\n edge.l = lSite;\n edge.r = rSite;\n } else if (edge.l === rSite) {\n edge.b = vertex;\n } else {\n edge.a = vertex;\n }\n }\n function d3_geom_voronoiHalfEdge(edge, lSite, rSite) {\n var va = edge.a, vb = edge.b;\n this.edge = edge;\n this.site = lSite;\n this.angle = rSite ? Math.atan2(rSite.y - lSite.y, rSite.x - lSite.x) : edge.l === lSite ? Math.atan2(vb.x - va.x, va.y - vb.y) : Math.atan2(va.x - vb.x, vb.y - va.y);\n }\n d3_geom_voronoiHalfEdge.prototype = {\n start: function() {\n return this.edge.l === this.site ? this.edge.a : this.edge.b;\n },\n end: function() {\n return this.edge.l === this.site ? this.edge.b : this.edge.a;\n }\n };\n function d3_geom_voronoiRedBlackTree() {\n this._ = null;\n }\n function d3_geom_voronoiRedBlackNode(node) {\n node.U = node.C = node.L = node.R = node.P = node.N = null;\n }\n d3_geom_voronoiRedBlackTree.prototype = {\n insert: function(after, node) {\n var parent, grandpa, uncle;\n if (after) {\n node.P = after;\n node.N = after.N;\n if (after.N) after.N.P = node;\n after.N = node;\n if (after.R) {\n after = after.R;\n while (after.L) after = after.L;\n after.L = node;\n } else {\n after.R = node;\n }\n parent = after;\n } else if (this._) {\n after = d3_geom_voronoiRedBlackFirst(this._);\n node.P = null;\n node.N = after;\n after.P = after.L = node;\n parent = after;\n } else {\n node.P = node.N = null;\n this._ = node;\n parent = null;\n }\n node.L = node.R = null;\n node.U = parent;\n node.C = true;\n after = node;\n while (parent && parent.C) {\n grandpa = parent.U;\n if (parent === grandpa.L) {\n uncle = grandpa.R;\n if (uncle && uncle.C) {\n parent.C = uncle.C = false;\n grandpa.C = true;\n after = grandpa;\n } else {\n if (after === parent.R) {\n d3_geom_voronoiRedBlackRotateLeft(this, parent);\n after = parent;\n parent = after.U;\n }\n parent.C = false;\n grandpa.C = true;\n d3_geom_voronoiRedBlackRotateRight(this, grandpa);\n }\n } else {\n uncle = grandpa.L;\n if (uncle && uncle.C) {\n parent.C = uncle.C = false;\n grandpa.C = true;\n after = grandpa;\n } else {\n if (after === parent.L) {\n d3_geom_voronoiRedBlackRotateRight(this, parent);\n after = parent;\n parent = after.U;\n }\n parent.C = false;\n grandpa.C = true;\n d3_geom_voronoiRedBlackRotateLeft(this, grandpa);\n }\n }\n parent = after.U;\n }\n this._.C = false;\n },\n remove: function(node) {\n if (node.N) node.N.P = node.P;\n if (node.P) node.P.N = node.N;\n node.N = node.P = null;\n var parent = node.U, sibling, left = node.L, right = node.R, next, red;\n if (!left) next = right;\n else if (!right) next = left;\n else next = d3_geom_voronoiRedBlackFirst(right);\n if (parent) {\n if (parent.L === node) parent.L = next;\n else parent.R = next;\n } else {\n this._ = next;\n }\n if (left && right) {\n red = next.C;\n next.C = node.C;\n next.L = left;\n left.U = next;\n if (next !== right) {\n parent = next.U;\n next.U = node.U;\n node = next.R;\n parent.L = node;\n next.R = right;\n right.U = next;\n } else {\n next.U = parent;\n parent = next;\n node = next.R;\n }\n } else {\n red = node.C;\n node = next;\n }\n if (node) node.U = parent;\n if (red) return;\n if (node && node.C) {\n node.C = false;\n return;\n }\n do {\n if (node === this._) break;\n if (node === parent.L) {\n sibling = parent.R;\n if (sibling.C) {\n sibling.C = false;\n parent.C = true;\n d3_geom_voronoiRedBlackRotateLeft(this, parent);\n sibling = parent.R;\n }\n if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) {\n if (!sibling.R || !sibling.R.C) {\n sibling.L.C = false;\n sibling.C = true;\n d3_geom_voronoiRedBlackRotateRight(this, sibling);\n sibling = parent.R;\n }\n sibling.C = parent.C;\n parent.C = sibling.R.C = false;\n d3_geom_voronoiRedBlackRotateLeft(this, parent);\n node = this._;\n break;\n }\n } else {\n sibling = parent.L;\n if (sibling.C) {\n sibling.C = false;\n parent.C = true;\n d3_geom_voronoiRedBlackRotateRight(this, parent);\n sibling = parent.L;\n }\n if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) {\n if (!sibling.L || !sibling.L.C) {\n sibling.R.C = false;\n sibling.C = true;\n d3_geom_voronoiRedBlackRotateLeft(this, sibling);\n sibling = parent.L;\n }\n sibling.C = parent.C;\n parent.C = sibling.L.C = false;\n d3_geom_voronoiRedBlackRotateRight(this, parent);\n node = this._;\n break;\n }\n }\n sibling.C = true;\n node = parent;\n parent = parent.U;\n } while (!node.C);\n if (node) node.C = false;\n }\n };\n function d3_geom_voronoiRedBlackRotateLeft(tree, node) {\n var p = node, q = node.R, parent = p.U;\n if (parent) {\n if (parent.L === p) parent.L = q;\n else parent.R = q;\n } else {\n tree._ = q;\n }\n q.U = parent;\n p.U = q;\n p.R = q.L;\n if (p.R) p.R.U = p;\n q.L = p;\n }\n function d3_geom_voronoiRedBlackRotateRight(tree, node) {\n var p = node, q = node.L, parent = p.U;\n if (parent) {\n if (parent.L === p) parent.L = q;\n else parent.R = q;\n } else {\n tree._ = q;\n }\n q.U = parent;\n p.U = q;\n p.L = q.R;\n if (p.L) p.L.U = p;\n q.R = p;\n }\n function d3_geom_voronoiRedBlackFirst(node) {\n while (node.L) node = node.L;\n return node;\n }\n function d3_geom_voronoi(sites, bbox) {\n var site = sites.sort(d3_geom_voronoiVertexOrder).pop(), x0, y0, circle;\n d3_geom_voronoiEdges = [];\n d3_geom_voronoiCells = new Array(sites.length);\n d3_geom_voronoiBeaches = new d3_geom_voronoiRedBlackTree();\n d3_geom_voronoiCircles = new d3_geom_voronoiRedBlackTree();\n while (true) {\n circle = d3_geom_voronoiFirstCircle;\n if (site && (!circle || site.y < circle.y || site.y === circle.y && site.x < circle.x)) {\n if (site.x !== x0 || site.y !== y0) {\n d3_geom_voronoiCells[site.i] = new d3_geom_voronoiCell(site);\n d3_geom_voronoiAddBeach(site);\n x0 = site.x, y0 = site.y;\n }\n site = sites.pop();\n } else if (circle) {\n d3_geom_voronoiRemoveBeach(circle.arc);\n } else {\n break;\n }\n }\n if (bbox) d3_geom_voronoiClipEdges(bbox), d3_geom_voronoiCloseCells(bbox);\n var diagram = {\n cells: d3_geom_voronoiCells,\n edges: d3_geom_voronoiEdges\n };\n d3_geom_voronoiBeaches = d3_geom_voronoiCircles = d3_geom_voronoiEdges = d3_geom_voronoiCells = null;\n return diagram;\n }\n function d3_geom_voronoiVertexOrder(a, b) {\n return b.y - a.y || b.x - a.x;\n }\n d3.geom.voronoi = function(points) {\n var x = d3_geom_pointX, y = d3_geom_pointY, fx = x, fy = y, clipExtent = d3_geom_voronoiClipExtent;\n if (points) return voronoi(points);\n function voronoi(data) {\n var polygons = new Array(data.length), x0 = clipExtent[0][0], y0 = clipExtent[0][1], x1 = clipExtent[1][0], y1 = clipExtent[1][1];\n d3_geom_voronoi(sites(data), clipExtent).cells.forEach(function(cell, i) {\n var edges = cell.edges, site = cell.site, polygon = polygons[i] = edges.length ? edges.map(function(e) {\n var s = e.start();\n return [s.x, s.y];\n }) : site.x >= x0 && site.x <= x1 && site.y >= y0 && site.y <= y1 ? [[x0, y1], [x1, y1], [x1, y0], [x0, y0]] : [];\n polygon.point = data[i];\n });\n return polygons;\n }\n function sites(data) {\n return data.map(function(d, i) {\n return {\n x: Math.round(fx(d, i) / \\u03B5) * \\u03B5,\n y: Math.round(fy(d, i) / \\u03B5) * \\u03B5,\n i\n };\n });\n }\n voronoi.links = function(data) {\n return d3_geom_voronoi(sites(data)).edges.filter(function(edge) {\n return edge.l && edge.r;\n }).map(function(edge) {\n return {\n source: data[edge.l.i],\n target: data[edge.r.i]\n };\n });\n };\n voronoi.triangles = function(data) {\n var triangles = [];\n d3_geom_voronoi(sites(data)).cells.forEach(function(cell, i) {\n var site = cell.site, edges = cell.edges.sort(d3_geom_voronoiHalfEdgeOrder), j = -1, m = edges.length, e0, s0, e1 = edges[m - 1].edge, s1 = e1.l === site ? e1.r : e1.l;\n while (++j < m) {\n e0 = e1;\n s0 = s1;\n e1 = edges[j].edge;\n s1 = e1.l === site ? e1.r : e1.l;\n if (i < s0.i && i < s1.i && d3_geom_voronoiTriangleArea(site, s0, s1) < 0) {\n triangles.push([data[i], data[s0.i], data[s1.i]]);\n }\n }\n });\n return triangles;\n };\n voronoi.x = function(_) {\n return arguments.length ? (fx = d3_functor(x = _), voronoi) : x;\n };\n voronoi.y = function(_) {\n return arguments.length ? (fy = d3_functor(y = _), voronoi) : y;\n };\n voronoi.clipExtent = function(_) {\n if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent;\n clipExtent = _ == null ? d3_geom_voronoiClipExtent : _;\n return voronoi;\n };\n voronoi.size = function(_) {\n if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent && clipExtent[1];\n return voronoi.clipExtent(_ && [[0, 0], _]);\n };\n return voronoi;\n };\n var d3_geom_voronoiClipExtent = [[-1e6, -1e6], [1e6, 1e6]];\n function d3_geom_voronoiTriangleArea(a, b, c) {\n return (a.x - c.x) * (b.y - a.y) - (a.x - b.x) * (c.y - a.y);\n }\n d3.geom.delaunay = function(vertices) {\n return d3.geom.voronoi().triangles(vertices);\n };\n d3.geom.quadtree = function(points, x1, y1, x2, y2) {\n var x = d3_geom_pointX, y = d3_geom_pointY, compat;\n if (compat = arguments.length) {\n x = d3_geom_quadtreeCompatX;\n y = d3_geom_quadtreeCompatY;\n if (compat === 3) {\n y2 = y1;\n x2 = x1;\n y1 = x1 = 0;\n }\n return quadtree(points);\n }\n function quadtree(data) {\n var d, fx = d3_functor(x), fy = d3_functor(y), xs, ys, i, n, x1_, y1_, x2_, y2_;\n if (x1 != null) {\n x1_ = x1, y1_ = y1, x2_ = x2, y2_ = y2;\n } else {\n x2_ = y2_ = -(x1_ = y1_ = Infinity);\n xs = [], ys = [];\n n = data.length;\n if (compat) for (i = 0; i < n; ++i) {\n d = data[i];\n if (d.x < x1_) x1_ = d.x;\n if (d.y < y1_) y1_ = d.y;\n if (d.x > x2_) x2_ = d.x;\n if (d.y > y2_) y2_ = d.y;\n xs.push(d.x);\n ys.push(d.y);\n }\n else for (i = 0; i < n; ++i) {\n var x_ = +fx(d = data[i], i), y_ = +fy(d, i);\n if (x_ < x1_) x1_ = x_;\n if (y_ < y1_) y1_ = y_;\n if (x_ > x2_) x2_ = x_;\n if (y_ > y2_) y2_ = y_;\n xs.push(x_);\n ys.push(y_);\n }\n }\n var dx = x2_ - x1_, dy = y2_ - y1_;\n if (dx > dy) y2_ = y1_ + dx;\n else x2_ = x1_ + dy;\n function insert(n2, d2, x3, y3, x12, y12, x22, y22) {\n if (isNaN(x3) || isNaN(y3)) return;\n if (n2.leaf) {\n var nx = n2.x, ny = n2.y;\n if (nx != null) {\n if (abs(nx - x3) + abs(ny - y3) < 0.01) {\n insertChild(n2, d2, x3, y3, x12, y12, x22, y22);\n } else {\n var nPoint = n2.point;\n n2.x = n2.y = n2.point = null;\n insertChild(n2, nPoint, nx, ny, x12, y12, x22, y22);\n insertChild(n2, d2, x3, y3, x12, y12, x22, y22);\n }\n } else {\n n2.x = x3, n2.y = y3, n2.point = d2;\n }\n } else {\n insertChild(n2, d2, x3, y3, x12, y12, x22, y22);\n }\n }\n function insertChild(n2, d2, x3, y3, x12, y12, x22, y22) {\n var xm = (x12 + x22) * 0.5, ym = (y12 + y22) * 0.5, right = x3 >= xm, below = y3 >= ym, i2 = below << 1 | right;\n n2.leaf = false;\n n2 = n2.nodes[i2] || (n2.nodes[i2] = d3_geom_quadtreeNode());\n if (right) x12 = xm;\n else x22 = xm;\n if (below) y12 = ym;\n else y22 = ym;\n insert(n2, d2, x3, y3, x12, y12, x22, y22);\n }\n var root = d3_geom_quadtreeNode();\n root.add = function(d2) {\n insert(root, d2, +fx(d2, ++i), +fy(d2, i), x1_, y1_, x2_, y2_);\n };\n root.visit = function(f) {\n d3_geom_quadtreeVisit(f, root, x1_, y1_, x2_, y2_);\n };\n root.find = function(point) {\n return d3_geom_quadtreeFind(root, point[0], point[1], x1_, y1_, x2_, y2_);\n };\n i = -1;\n if (x1 == null) {\n while (++i < n) {\n insert(root, data[i], xs[i], ys[i], x1_, y1_, x2_, y2_);\n }\n --i;\n } else data.forEach(root.add);\n xs = ys = data = d = null;\n return root;\n }\n quadtree.x = function(_) {\n return arguments.length ? (x = _, quadtree) : x;\n };\n quadtree.y = function(_) {\n return arguments.length ? (y = _, quadtree) : y;\n };\n quadtree.extent = function(_) {\n if (!arguments.length) return x1 == null ? null : [[x1, y1], [x2, y2]];\n if (_ == null) x1 = y1 = x2 = y2 = null;\n else x1 = +_[0][0], y1 = +_[0][1], x2 = +_[1][0], y2 = +_[1][1];\n return quadtree;\n };\n quadtree.size = function(_) {\n if (!arguments.length) return x1 == null ? null : [x2 - x1, y2 - y1];\n if (_ == null) x1 = y1 = x2 = y2 = null;\n else x1 = y1 = 0, x2 = +_[0], y2 = +_[1];\n return quadtree;\n };\n return quadtree;\n };\n function d3_geom_quadtreeCompatX(d) {\n return d.x;\n }\n function d3_geom_quadtreeCompatY(d) {\n return d.y;\n }\n function d3_geom_quadtreeNode() {\n return {\n leaf: true,\n nodes: [],\n point: null,\n x: null,\n y: null\n };\n }\n function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {\n if (!f(node, x1, y1, x2, y2)) {\n var sx = (x1 + x2) * 0.5, sy = (y1 + y2) * 0.5, children = node.nodes;\n if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);\n if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);\n if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);\n if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);\n }\n }\n function d3_geom_quadtreeFind(root, x, y, x0, y0, x3, y3) {\n var minDistance2 = Infinity, closestPoint;\n (function find(node, x1, y1, x2, y2) {\n if (x1 > x3 || y1 > y3 || x2 < x0 || y2 < y0) return;\n if (point = node.point) {\n var point, dx = x - node.x, dy = y - node.y, distance2 = dx * dx + dy * dy;\n if (distance2 < minDistance2) {\n var distance = Math.sqrt(minDistance2 = distance2);\n x0 = x - distance, y0 = y - distance;\n x3 = x + distance, y3 = y + distance;\n closestPoint = point;\n }\n }\n var children = node.nodes, xm = (x1 + x2) * 0.5, ym = (y1 + y2) * 0.5, right = x >= xm, below = y >= ym;\n for (var i = below << 1 | right, j = i + 4; i < j; ++i) {\n if (node = children[i & 3]) switch (i & 3) {\n case 0:\n find(node, x1, y1, xm, ym);\n break;\n case 1:\n find(node, xm, y1, x2, ym);\n break;\n case 2:\n find(node, x1, ym, xm, y2);\n break;\n case 3:\n find(node, xm, ym, x2, y2);\n break;\n }\n }\n })(root, x0, y0, x3, y3);\n return closestPoint;\n }\n d3.interpolateRgb = d3_interpolateRgb;\n function d3_interpolateRgb(a, b) {\n a = d3.rgb(a);\n b = d3.rgb(b);\n var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab;\n return function(t) {\n return \"#\" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t));\n };\n }\n d3.interpolateObject = d3_interpolateObject;\n function d3_interpolateObject(a, b) {\n var i = {}, c = {}, k;\n for (k in a) {\n if (k in b) {\n i[k] = d3_interpolate(a[k], b[k]);\n } else {\n c[k] = a[k];\n }\n }\n for (k in b) {\n if (!(k in a)) {\n c[k] = b[k];\n }\n }\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n }\n d3.interpolateNumber = d3_interpolateNumber;\n function d3_interpolateNumber(a, b) {\n a = +a, b = +b;\n return function(t) {\n return a * (1 - t) + b * t;\n };\n }\n d3.interpolateString = d3_interpolateString;\n function d3_interpolateString(a, b) {\n var bi = d3_interpolate_numberA.lastIndex = d3_interpolate_numberB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = [];\n a = a + \"\", b = b + \"\";\n while ((am = d3_interpolate_numberA.exec(a)) && (bm = d3_interpolate_numberB.exec(b))) {\n if ((bs = bm.index) > bi) {\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs;\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) {\n if (s[i]) s[i] += bm;\n else s[++i] = bm;\n } else {\n s[++i] = null;\n q.push({\n i,\n x: d3_interpolateNumber(am, bm)\n });\n }\n bi = d3_interpolate_numberB.lastIndex;\n }\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs;\n else s[++i] = bs;\n }\n return s.length < 2 ? q[0] ? (b = q[0].x, function(t) {\n return b(t) + \"\";\n }) : function() {\n return b;\n } : (b = q.length, function(t) {\n for (var i2 = 0, o; i2 < b; ++i2) s[(o = q[i2]).i] = o.x(t);\n return s.join(\"\");\n });\n }\n var d3_interpolate_numberA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g, d3_interpolate_numberB = new RegExp(d3_interpolate_numberA.source, \"g\");\n d3.interpolate = d3_interpolate;\n function d3_interpolate(a, b) {\n var i = d3.interpolators.length, f;\n while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ;\n return f;\n }\n d3.interpolators = [function(a, b) {\n var t = typeof b;\n return (t === \"string\" ? d3_rgb_names.has(b.toLowerCase()) || /^(#|rgb\\(|hsl\\()/i.test(b) ? d3_interpolateRgb : d3_interpolateString : b instanceof d3_color ? d3_interpolateRgb : Array.isArray(b) ? d3_interpolateArray : t === \"object\" && isNaN(b) ? d3_interpolateObject : d3_interpolateNumber)(a, b);\n }];\n d3.interpolateArray = d3_interpolateArray;\n function d3_interpolateArray(a, b) {\n var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i;\n for (i = 0; i < n0; ++i) x.push(d3_interpolate(a[i], b[i]));\n for (; i < na; ++i) c[i] = a[i];\n for (; i < nb; ++i) c[i] = b[i];\n return function(t) {\n for (i = 0; i < n0; ++i) c[i] = x[i](t);\n return c;\n };\n }\n var d3_ease_default = function() {\n return d3_identity;\n };\n var d3_ease = d3.map({\n linear: d3_ease_default,\n poly: d3_ease_poly,\n quad: function() {\n return d3_ease_quad;\n },\n cubic: function() {\n return d3_ease_cubic;\n },\n sin: function() {\n return d3_ease_sin;\n },\n exp: function() {\n return d3_ease_exp;\n },\n circle: function() {\n return d3_ease_circle;\n },\n elastic: d3_ease_elastic,\n back: d3_ease_back,\n bounce: function() {\n return d3_ease_bounce;\n }\n });\n var d3_ease_mode = d3.map({\n \"in\": d3_identity,\n out: d3_ease_reverse,\n \"in-out\": d3_ease_reflect,\n \"out-in\": function(f) {\n return d3_ease_reflect(d3_ease_reverse(f));\n }\n });\n d3.ease = function(name2) {\n var i = name2.indexOf(\"-\"), t = i >= 0 ? name2.slice(0, i) : name2, m = i >= 0 ? name2.slice(i + 1) : \"in\";\n t = d3_ease.get(t) || d3_ease_default;\n m = d3_ease_mode.get(m) || d3_identity;\n return d3_ease_clamp(m(t.apply(null, d3_arraySlice.call(arguments, 1))));\n };\n function d3_ease_clamp(f) {\n return function(t) {\n return t <= 0 ? 0 : t >= 1 ? 1 : f(t);\n };\n }\n function d3_ease_reverse(f) {\n return function(t) {\n return 1 - f(1 - t);\n };\n }\n function d3_ease_reflect(f) {\n return function(t) {\n return 0.5 * (t < 0.5 ? f(2 * t) : 2 - f(2 - 2 * t));\n };\n }\n function d3_ease_quad(t) {\n return t * t;\n }\n function d3_ease_cubic(t) {\n return t * t * t;\n }\n function d3_ease_cubicInOut(t) {\n if (t <= 0) return 0;\n if (t >= 1) return 1;\n var t22 = t * t, t32 = t22 * t;\n return 4 * (t < 0.5 ? t32 : 3 * (t - t22) + t32 - 0.75);\n }\n function d3_ease_poly(e) {\n return function(t) {\n return Math.pow(t, e);\n };\n }\n function d3_ease_sin(t) {\n return 1 - Math.cos(t * half\\u03C0);\n }\n function d3_ease_exp(t) {\n return Math.pow(2, 10 * (t - 1));\n }\n function d3_ease_circle(t) {\n return 1 - Math.sqrt(1 - t * t);\n }\n function d3_ease_elastic(a, p) {\n var s;\n if (arguments.length < 2) p = 0.45;\n if (arguments.length) s = p / \\u03C4 * Math.asin(1 / a);\n else a = 1, s = p / 4;\n return function(t) {\n return 1 + a * Math.pow(2, -10 * t) * Math.sin((t - s) * \\u03C4 / p);\n };\n }\n function d3_ease_back(s) {\n if (!s) s = 1.70158;\n return function(t) {\n return t * t * ((s + 1) * t - s);\n };\n }\n function d3_ease_bounce(t) {\n return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + 0.75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + 0.9375 : 7.5625 * (t -= 2.625 / 2.75) * t + 0.984375;\n }\n d3.interpolateHcl = d3_interpolateHcl;\n function d3_interpolateHcl(a, b) {\n a = d3.hcl(a);\n b = d3.hcl(b);\n var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al;\n if (isNaN(bc)) bc = 0, ac = isNaN(ac) ? b.c : ac;\n if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah;\n else if (bh > 180) bh -= 360;\n else if (bh < -180) bh += 360;\n return function(t) {\n return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + \"\";\n };\n }\n d3.interpolateHsl = d3_interpolateHsl;\n function d3_interpolateHsl(a, b) {\n a = d3.hsl(a);\n b = d3.hsl(b);\n var ah = a.h, as = a.s, al = a.l, bh = b.h - ah, bs = b.s - as, bl = b.l - al;\n if (isNaN(bs)) bs = 0, as = isNaN(as) ? b.s : as;\n if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah;\n else if (bh > 180) bh -= 360;\n else if (bh < -180) bh += 360;\n return function(t) {\n return d3_hsl_rgb(ah + bh * t, as + bs * t, al + bl * t) + \"\";\n };\n }\n d3.interpolateLab = d3_interpolateLab;\n function d3_interpolateLab(a, b) {\n a = d3.lab(a);\n b = d3.lab(b);\n var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab;\n return function(t) {\n return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + \"\";\n };\n }\n d3.interpolateRound = d3_interpolateRound;\n function d3_interpolateRound(a, b) {\n b -= a;\n return function(t) {\n return Math.round(a + b * t);\n };\n }\n d3.transform = function(string) {\n var g = d3_document.createElementNS(d3.ns.prefix.svg, \"g\");\n return (d3.transform = function(string2) {\n if (string2 != null) {\n g.setAttribute(\"transform\", string2);\n var t = g.transform.baseVal.consolidate();\n }\n return new d3_transform(t ? t.matrix : d3_transformIdentity);\n })(string);\n };\n function d3_transform(m) {\n var r0 = [m.a, m.b], r1 = [m.c, m.d], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;\n if (r0[0] * r1[1] < r1[0] * r0[1]) {\n r0[0] *= -1;\n r0[1] *= -1;\n kx *= -1;\n kz *= -1;\n }\n this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees;\n this.translate = [m.e, m.f];\n this.scale = [kx, ky];\n this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0;\n }\n d3_transform.prototype.toString = function() {\n return \"translate(\" + this.translate + \")rotate(\" + this.rotate + \")skewX(\" + this.skew + \")scale(\" + this.scale + \")\";\n };\n function d3_transformDot(a, b) {\n return a[0] * b[0] + a[1] * b[1];\n }\n function d3_transformNormalize(a) {\n var k = Math.sqrt(d3_transformDot(a, a));\n if (k) {\n a[0] /= k;\n a[1] /= k;\n }\n return k;\n }\n function d3_transformCombine(a, b, k) {\n a[0] += k * b[0];\n a[1] += k * b[1];\n return a;\n }\n var d3_transformIdentity = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: 0,\n f: 0\n };\n d3.interpolateTransform = d3_interpolateTransform;\n function d3_interpolateTransformPop(s) {\n return s.length ? s.pop() + \",\" : \"\";\n }\n function d3_interpolateTranslate(ta, tb, s, q) {\n if (ta[0] !== tb[0] || ta[1] !== tb[1]) {\n var i = s.push(\"translate(\", null, \",\", null, \")\");\n q.push({\n i: i - 4,\n x: d3_interpolateNumber(ta[0], tb[0])\n }, {\n i: i - 2,\n x: d3_interpolateNumber(ta[1], tb[1])\n });\n } else if (tb[0] || tb[1]) {\n s.push(\"translate(\" + tb + \")\");\n }\n }\n function d3_interpolateRotate(ra, rb, s, q) {\n if (ra !== rb) {\n if (ra - rb > 180) rb += 360;\n else if (rb - ra > 180) ra += 360;\n q.push({\n i: s.push(d3_interpolateTransformPop(s) + \"rotate(\", null, \")\") - 2,\n x: d3_interpolateNumber(ra, rb)\n });\n } else if (rb) {\n s.push(d3_interpolateTransformPop(s) + \"rotate(\" + rb + \")\");\n }\n }\n function d3_interpolateSkew(wa, wb, s, q) {\n if (wa !== wb) {\n q.push({\n i: s.push(d3_interpolateTransformPop(s) + \"skewX(\", null, \")\") - 2,\n x: d3_interpolateNumber(wa, wb)\n });\n } else if (wb) {\n s.push(d3_interpolateTransformPop(s) + \"skewX(\" + wb + \")\");\n }\n }\n function d3_interpolateScale(ka, kb, s, q) {\n if (ka[0] !== kb[0] || ka[1] !== kb[1]) {\n var i = s.push(d3_interpolateTransformPop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({\n i: i - 4,\n x: d3_interpolateNumber(ka[0], kb[0])\n }, {\n i: i - 2,\n x: d3_interpolateNumber(ka[1], kb[1])\n });\n } else if (kb[0] !== 1 || kb[1] !== 1) {\n s.push(d3_interpolateTransformPop(s) + \"scale(\" + kb + \")\");\n }\n }\n function d3_interpolateTransform(a, b) {\n var s = [], q = [];\n a = d3.transform(a), b = d3.transform(b);\n d3_interpolateTranslate(a.translate, b.translate, s, q);\n d3_interpolateRotate(a.rotate, b.rotate, s, q);\n d3_interpolateSkew(a.skew, b.skew, s, q);\n d3_interpolateScale(a.scale, b.scale, s, q);\n a = b = null;\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n }\n function d3_uninterpolateNumber(a, b) {\n b = (b -= a = +a) || 1 / b;\n return function(x) {\n return (x - a) / b;\n };\n }\n function d3_uninterpolateClamp(a, b) {\n b = (b -= a = +a) || 1 / b;\n return function(x) {\n return Math.max(0, Math.min(1, (x - a) / b));\n };\n }\n d3.layout = {};\n d3.layout.bundle = function() {\n return function(links) {\n var paths = [], i = -1, n = links.length;\n while (++i < n) paths.push(d3_layout_bundlePath(links[i]));\n return paths;\n };\n };\n function d3_layout_bundlePath(link) {\n var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [start];\n while (start !== lca) {\n start = start.parent;\n points.push(start);\n }\n var k = points.length;\n while (end !== lca) {\n points.splice(k, 0, end);\n end = end.parent;\n }\n return points;\n }\n function d3_layout_bundleAncestors(node) {\n var ancestors = [], parent = node.parent;\n while (parent != null) {\n ancestors.push(node);\n node = parent;\n parent = parent.parent;\n }\n ancestors.push(node);\n return ancestors;\n }\n function d3_layout_bundleLeastCommonAncestor(a, b) {\n if (a === b) return a;\n var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null;\n while (aNode === bNode) {\n sharedNode = aNode;\n aNode = aNodes.pop();\n bNode = bNodes.pop();\n }\n return sharedNode;\n }\n d3.layout.chord = function() {\n var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;\n function relayout() {\n var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j;\n chords = [];\n groups = [];\n k = 0, i = -1;\n while (++i < n) {\n x = 0, j = -1;\n while (++j < n) {\n x += matrix[i][j];\n }\n groupSums.push(x);\n subgroupIndex.push(d3.range(n));\n k += x;\n }\n if (sortGroups) {\n groupIndex.sort(function(a, b) {\n return sortGroups(groupSums[a], groupSums[b]);\n });\n }\n if (sortSubgroups) {\n subgroupIndex.forEach(function(d, i2) {\n d.sort(function(a, b) {\n return sortSubgroups(matrix[i2][a], matrix[i2][b]);\n });\n });\n }\n k = (\\u03C4 - padding * n) / k;\n x = 0, i = -1;\n while (++i < n) {\n x0 = x, j = -1;\n while (++j < n) {\n var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;\n subgroups[di + \"-\" + dj] = {\n index: di,\n subindex: dj,\n startAngle: a0,\n endAngle: a1,\n value: v\n };\n }\n groups[di] = {\n index: di,\n startAngle: x0,\n endAngle: x,\n value: groupSums[di]\n };\n x += padding;\n }\n i = -1;\n while (++i < n) {\n j = i - 1;\n while (++j < n) {\n var source = subgroups[i + \"-\" + j], target = subgroups[j + \"-\" + i];\n if (source.value || target.value) {\n chords.push(source.value < target.value ? {\n source: target,\n target: source\n } : {\n source,\n target\n });\n }\n }\n }\n if (sortChords) resort();\n }\n function resort() {\n chords.sort(function(a, b) {\n return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2);\n });\n }\n chord.matrix = function(x) {\n if (!arguments.length) return matrix;\n n = (matrix = x) && matrix.length;\n chords = groups = null;\n return chord;\n };\n chord.padding = function(x) {\n if (!arguments.length) return padding;\n padding = x;\n chords = groups = null;\n return chord;\n };\n chord.sortGroups = function(x) {\n if (!arguments.length) return sortGroups;\n sortGroups = x;\n chords = groups = null;\n return chord;\n };\n chord.sortSubgroups = function(x) {\n if (!arguments.length) return sortSubgroups;\n sortSubgroups = x;\n chords = null;\n return chord;\n };\n chord.sortChords = function(x) {\n if (!arguments.length) return sortChords;\n sortChords = x;\n if (chords) resort();\n return chord;\n };\n chord.chords = function() {\n if (!chords) relayout();\n return chords;\n };\n chord.groups = function() {\n if (!groups) relayout();\n return groups;\n };\n return chord;\n };\n d3.layout.force = function() {\n var force = {}, event = d3.dispatch(\"start\", \"tick\", \"end\"), timer, size = [1, 1], drag, alpha, friction = 0.9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, chargeDistance2 = d3_layout_forceChargeDistance2, gravity = 0.1, theta2 = 0.64, nodes = [], links = [], distances, strengths, charges;\n function repulse(node) {\n return function(quad, x1, _, x2) {\n if (quad.point !== node) {\n var dx = quad.cx - node.x, dy = quad.cy - node.y, dw = x2 - x1, dn = dx * dx + dy * dy;\n if (dw * dw / theta2 < dn) {\n if (dn < chargeDistance2) {\n var k = quad.charge / dn;\n node.px -= dx * k;\n node.py -= dy * k;\n }\n return true;\n }\n if (quad.point && dn && dn < chargeDistance2) {\n var k = quad.pointCharge / dn;\n node.px -= dx * k;\n node.py -= dy * k;\n }\n }\n return !quad.charge;\n };\n }\n force.tick = function() {\n if ((alpha *= 0.99) < 5e-3) {\n timer = null;\n event.end({\n type: \"end\",\n alpha: alpha = 0\n });\n return true;\n }\n var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y;\n for (i = 0; i < m; ++i) {\n o = links[i];\n s = o.source;\n t = o.target;\n x = t.x - s.x;\n y = t.y - s.y;\n if (l = x * x + y * y) {\n l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;\n x *= l;\n y *= l;\n t.x -= x * (k = s.weight + t.weight ? s.weight / (s.weight + t.weight) : 0.5);\n t.y -= y * k;\n s.x += x * (k = 1 - k);\n s.y += y * k;\n }\n }\n if (k = alpha * gravity) {\n x = size[0] / 2;\n y = size[1] / 2;\n i = -1;\n if (k) while (++i < n) {\n o = nodes[i];\n o.x += (x - o.x) * k;\n o.y += (y - o.y) * k;\n }\n }\n if (charge) {\n d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);\n i = -1;\n while (++i < n) {\n if (!(o = nodes[i]).fixed) {\n q.visit(repulse(o));\n }\n }\n }\n i = -1;\n while (++i < n) {\n o = nodes[i];\n if (o.fixed) {\n o.x = o.px;\n o.y = o.py;\n } else {\n o.x -= (o.px - (o.px = o.x)) * friction;\n o.y -= (o.py - (o.py = o.y)) * friction;\n }\n }\n event.tick({\n type: \"tick\",\n alpha\n });\n };\n force.nodes = function(x) {\n if (!arguments.length) return nodes;\n nodes = x;\n return force;\n };\n force.links = function(x) {\n if (!arguments.length) return links;\n links = x;\n return force;\n };\n force.size = function(x) {\n if (!arguments.length) return size;\n size = x;\n return force;\n };\n force.linkDistance = function(x) {\n if (!arguments.length) return linkDistance;\n linkDistance = typeof x === \"function\" ? x : +x;\n return force;\n };\n force.distance = force.linkDistance;\n force.linkStrength = function(x) {\n if (!arguments.length) return linkStrength;\n linkStrength = typeof x === \"function\" ? x : +x;\n return force;\n };\n force.friction = function(x) {\n if (!arguments.length) return friction;\n friction = +x;\n return force;\n };\n force.charge = function(x) {\n if (!arguments.length) return charge;\n charge = typeof x === \"function\" ? x : +x;\n return force;\n };\n force.chargeDistance = function(x) {\n if (!arguments.length) return Math.sqrt(chargeDistance2);\n chargeDistance2 = x * x;\n return force;\n };\n force.gravity = function(x) {\n if (!arguments.length) return gravity;\n gravity = +x;\n return force;\n };\n force.theta = function(x) {\n if (!arguments.length) return Math.sqrt(theta2);\n theta2 = x * x;\n return force;\n };\n force.alpha = function(x) {\n if (!arguments.length) return alpha;\n x = +x;\n if (alpha) {\n if (x > 0) {\n alpha = x;\n } else {\n timer.c = null, timer.t = NaN, timer = null;\n event.end({\n type: \"end\",\n alpha: alpha = 0\n });\n }\n } else if (x > 0) {\n event.start({\n type: \"start\",\n alpha: alpha = x\n });\n timer = d3_timer(force.tick);\n }\n return force;\n };\n force.start = function() {\n var i, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o;\n for (i = 0; i < n; ++i) {\n (o = nodes[i]).index = i;\n o.weight = 0;\n }\n for (i = 0; i < m; ++i) {\n o = links[i];\n if (typeof o.source == \"number\") o.source = nodes[o.source];\n if (typeof o.target == \"number\") o.target = nodes[o.target];\n ++o.source.weight;\n ++o.target.weight;\n }\n for (i = 0; i < n; ++i) {\n o = nodes[i];\n if (isNaN(o.x)) o.x = position(\"x\", w);\n if (isNaN(o.y)) o.y = position(\"y\", h);\n if (isNaN(o.px)) o.px = o.x;\n if (isNaN(o.py)) o.py = o.y;\n }\n distances = [];\n if (typeof linkDistance === \"function\") for (i = 0; i < m; ++i) distances[i] = +linkDistance.call(this, links[i], i);\n else for (i = 0; i < m; ++i) distances[i] = linkDistance;\n strengths = [];\n if (typeof linkStrength === \"function\") for (i = 0; i < m; ++i) strengths[i] = +linkStrength.call(this, links[i], i);\n else for (i = 0; i < m; ++i) strengths[i] = linkStrength;\n charges = [];\n if (typeof charge === \"function\") for (i = 0; i < n; ++i) charges[i] = +charge.call(this, nodes[i], i);\n else for (i = 0; i < n; ++i) charges[i] = charge;\n function position(dimension, size2) {\n if (!neighbors) {\n neighbors = new Array(n);\n for (j = 0; j < n; ++j) {\n neighbors[j] = [];\n }\n for (j = 0; j < m; ++j) {\n var o2 = links[j];\n neighbors[o2.source.index].push(o2.target);\n neighbors[o2.target.index].push(o2.source);\n }\n }\n var candidates = neighbors[i], j = -1, l = candidates.length, x;\n while (++j < l) if (!isNaN(x = candidates[j][dimension])) return x;\n return Math.random() * size2;\n }\n return force.resume();\n };\n force.resume = function() {\n return force.alpha(0.1);\n };\n force.stop = function() {\n return force.alpha(0);\n };\n force.drag = function() {\n if (!drag) drag = d3.behavior.drag().origin(d3_identity).on(\"dragstart.force\", d3_layout_forceDragstart).on(\"drag.force\", dragmove).on(\"dragend.force\", d3_layout_forceDragend);\n if (!arguments.length) return drag;\n this.on(\"mouseover.force\", d3_layout_forceMouseover).on(\"mouseout.force\", d3_layout_forceMouseout).call(drag);\n };\n function dragmove(d) {\n d.px = d3.event.x, d.py = d3.event.y;\n force.resume();\n }\n return d3.rebind(force, event, \"on\");\n };\n function d3_layout_forceDragstart(d) {\n d.fixed |= 2;\n }\n function d3_layout_forceDragend(d) {\n d.fixed &= ~6;\n }\n function d3_layout_forceMouseover(d) {\n d.fixed |= 4;\n d.px = d.x, d.py = d.y;\n }\n function d3_layout_forceMouseout(d) {\n d.fixed &= ~4;\n }\n function d3_layout_forceAccumulate(quad, alpha, charges) {\n var cx = 0, cy = 0;\n quad.charge = 0;\n if (!quad.leaf) {\n var nodes = quad.nodes, n = nodes.length, i = -1, c;\n while (++i < n) {\n c = nodes[i];\n if (c == null) continue;\n d3_layout_forceAccumulate(c, alpha, charges);\n quad.charge += c.charge;\n cx += c.charge * c.cx;\n cy += c.charge * c.cy;\n }\n }\n if (quad.point) {\n if (!quad.leaf) {\n quad.point.x += Math.random() - 0.5;\n quad.point.y += Math.random() - 0.5;\n }\n var k = alpha * charges[quad.point.index];\n quad.charge += quad.pointCharge = k;\n cx += k * quad.point.x;\n cy += k * quad.point.y;\n }\n quad.cx = cx / quad.charge;\n quad.cy = cy / quad.charge;\n }\n var d3_layout_forceLinkDistance = 20, d3_layout_forceLinkStrength = 1, d3_layout_forceChargeDistance2 = Infinity;\n d3.layout.hierarchy = function() {\n var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue;\n function hierarchy(root) {\n var stack = [root], nodes = [], node;\n root.depth = 0;\n while ((node = stack.pop()) != null) {\n nodes.push(node);\n if ((childs = children.call(hierarchy, node, node.depth)) && (n = childs.length)) {\n var n, childs, child;\n while (--n >= 0) {\n stack.push(child = childs[n]);\n child.parent = node;\n child.depth = node.depth + 1;\n }\n if (value) node.value = 0;\n node.children = childs;\n } else {\n if (value) node.value = +value.call(hierarchy, node, node.depth) || 0;\n delete node.children;\n }\n }\n d3_layout_hierarchyVisitAfter(root, function(node2) {\n var childs2, parent;\n if (sort && (childs2 = node2.children)) childs2.sort(sort);\n if (value && (parent = node2.parent)) parent.value += node2.value;\n });\n return nodes;\n }\n hierarchy.sort = function(x) {\n if (!arguments.length) return sort;\n sort = x;\n return hierarchy;\n };\n hierarchy.children = function(x) {\n if (!arguments.length) return children;\n children = x;\n return hierarchy;\n };\n hierarchy.value = function(x) {\n if (!arguments.length) return value;\n value = x;\n return hierarchy;\n };\n hierarchy.revalue = function(root) {\n if (value) {\n d3_layout_hierarchyVisitBefore(root, function(node) {\n if (node.children) node.value = 0;\n });\n d3_layout_hierarchyVisitAfter(root, function(node) {\n var parent;\n if (!node.children) node.value = +value.call(hierarchy, node, node.depth) || 0;\n if (parent = node.parent) parent.value += node.value;\n });\n }\n return root;\n };\n return hierarchy;\n };\n function d3_layout_hierarchyRebind(object, hierarchy) {\n d3.rebind(object, hierarchy, \"sort\", \"children\", \"value\");\n object.nodes = object;\n object.links = d3_layout_hierarchyLinks;\n return object;\n }\n function d3_layout_hierarchyVisitBefore(node, callback) {\n var nodes = [node];\n while ((node = nodes.pop()) != null) {\n callback(node);\n if ((children = node.children) && (n = children.length)) {\n var n, children;\n while (--n >= 0) nodes.push(children[n]);\n }\n }\n }\n function d3_layout_hierarchyVisitAfter(node, callback) {\n var nodes = [node], nodes2 = [];\n while ((node = nodes.pop()) != null) {\n nodes2.push(node);\n if ((children = node.children) && (n = children.length)) {\n var i = -1, n, children;\n while (++i < n) nodes.push(children[i]);\n }\n }\n while ((node = nodes2.pop()) != null) {\n callback(node);\n }\n }\n function d3_layout_hierarchyChildren(d) {\n return d.children;\n }\n function d3_layout_hierarchyValue(d) {\n return d.value;\n }\n function d3_layout_hierarchySort(a, b) {\n return b.value - a.value;\n }\n function d3_layout_hierarchyLinks(nodes) {\n return d3.merge(nodes.map(function(parent) {\n return (parent.children || []).map(function(child) {\n return {\n source: parent,\n target: child\n };\n });\n }));\n }\n d3.layout.partition = function() {\n var hierarchy = d3.layout.hierarchy(), size = [1, 1];\n function position(node, x, dx, dy) {\n var children = node.children;\n node.x = x;\n node.y = node.depth * dy;\n node.dx = dx;\n node.dy = dy;\n if (children && (n = children.length)) {\n var i = -1, n, c, d;\n dx = node.value ? dx / node.value : 0;\n while (++i < n) {\n position(c = children[i], x, d = c.value * dx, dy);\n x += d;\n }\n }\n }\n function depth(node) {\n var children = node.children, d = 0;\n if (children && (n = children.length)) {\n var i = -1, n;\n while (++i < n) d = Math.max(d, depth(children[i]));\n }\n return 1 + d;\n }\n function partition(d, i) {\n var nodes = hierarchy.call(this, d, i);\n position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));\n return nodes;\n }\n partition.size = function(x) {\n if (!arguments.length) return size;\n size = x;\n return partition;\n };\n return d3_layout_hierarchyRebind(partition, hierarchy);\n };\n d3.layout.pie = function() {\n var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = \\u03C4, padAngle = 0;\n function pie(data) {\n var n = data.length, values = data.map(function(d, i) {\n return +value.call(pie, d, i);\n }), a = +(typeof startAngle === \"function\" ? startAngle.apply(this, arguments) : startAngle), da = (typeof endAngle === \"function\" ? endAngle.apply(this, arguments) : endAngle) - a, p = Math.min(Math.abs(da) / n, +(typeof padAngle === \"function\" ? padAngle.apply(this, arguments) : padAngle)), pa = p * (da < 0 ? -1 : 1), sum = d3.sum(values), k = sum ? (da - n * pa) / sum : 0, index = d3.range(n), arcs = [], v;\n if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {\n return values[j] - values[i];\n } : function(i, j) {\n return sort(data[i], data[j]);\n });\n index.forEach(function(i) {\n arcs[i] = {\n data: data[i],\n value: v = values[i],\n startAngle: a,\n endAngle: a += v * k + pa,\n padAngle: p\n };\n });\n return arcs;\n }\n pie.value = function(_) {\n if (!arguments.length) return value;\n value = _;\n return pie;\n };\n pie.sort = function(_) {\n if (!arguments.length) return sort;\n sort = _;\n return pie;\n };\n pie.startAngle = function(_) {\n if (!arguments.length) return startAngle;\n startAngle = _;\n return pie;\n };\n pie.endAngle = function(_) {\n if (!arguments.length) return endAngle;\n endAngle = _;\n return pie;\n };\n pie.padAngle = function(_) {\n if (!arguments.length) return padAngle;\n padAngle = _;\n return pie;\n };\n return pie;\n };\n var d3_layout_pieSortByValue = {};\n d3.layout.stack = function() {\n var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;\n function stack(data, index) {\n if (!(n = data.length)) return data;\n var series = data.map(function(d, i2) {\n return values.call(stack, d, i2);\n });\n var points = series.map(function(d) {\n return d.map(function(v, i2) {\n return [x.call(stack, v, i2), y.call(stack, v, i2)];\n });\n });\n var orders = order.call(stack, points, index);\n series = d3.permute(series, orders);\n points = d3.permute(points, orders);\n var offsets = offset.call(stack, points, index);\n var m = series[0].length, n, i, j, o;\n for (j = 0; j < m; ++j) {\n out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);\n for (i = 1; i < n; ++i) {\n out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);\n }\n }\n return data;\n }\n stack.values = function(x2) {\n if (!arguments.length) return values;\n values = x2;\n return stack;\n };\n stack.order = function(x2) {\n if (!arguments.length) return order;\n order = typeof x2 === \"function\" ? x2 : d3_layout_stackOrders.get(x2) || d3_layout_stackOrderDefault;\n return stack;\n };\n stack.offset = function(x2) {\n if (!arguments.length) return offset;\n offset = typeof x2 === \"function\" ? x2 : d3_layout_stackOffsets.get(x2) || d3_layout_stackOffsetZero;\n return stack;\n };\n stack.x = function(z) {\n if (!arguments.length) return x;\n x = z;\n return stack;\n };\n stack.y = function(z) {\n if (!arguments.length) return y;\n y = z;\n return stack;\n };\n stack.out = function(z) {\n if (!arguments.length) return out;\n out = z;\n return stack;\n };\n return stack;\n };\n function d3_layout_stackX(d) {\n return d.x;\n }\n function d3_layout_stackY(d) {\n return d.y;\n }\n function d3_layout_stackOut(d, y0, y) {\n d.y0 = y0;\n d.y = y;\n }\n var d3_layout_stackOrders = d3.map({\n \"inside-out\": function(data) {\n var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) {\n return max[a] - max[b];\n }), top = 0, bottom = 0, tops = [], bottoms = [];\n for (i = 0; i < n; ++i) {\n j = index[i];\n if (top < bottom) {\n top += sums[j];\n tops.push(j);\n } else {\n bottom += sums[j];\n bottoms.push(j);\n }\n }\n return bottoms.reverse().concat(tops);\n },\n reverse: function(data) {\n return d3.range(data.length).reverse();\n },\n \"default\": d3_layout_stackOrderDefault\n });\n var d3_layout_stackOffsets = d3.map({\n silhouette: function(data) {\n var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = [];\n for (j = 0; j < m; ++j) {\n for (i = 0, o = 0; i < n; i++) o += data[i][j][1];\n if (o > max) max = o;\n sums.push(o);\n }\n for (j = 0; j < m; ++j) {\n y0[j] = (max - sums[j]) / 2;\n }\n return y0;\n },\n wiggle: function(data) {\n var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = [];\n y0[0] = o = o0 = 0;\n for (j = 1; j < m; ++j) {\n for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];\n for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {\n for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {\n s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;\n }\n s2 += s3 * data[i][j][1];\n }\n y0[j] = o -= s1 ? s2 / s1 * dx : 0;\n if (o < o0) o0 = o;\n }\n for (j = 0; j < m; ++j) y0[j] -= o0;\n return y0;\n },\n expand: function(data) {\n var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = [];\n for (j = 0; j < m; ++j) {\n for (i = 0, o = 0; i < n; i++) o += data[i][j][1];\n if (o) for (i = 0; i < n; i++) data[i][j][1] /= o;\n else for (i = 0; i < n; i++) data[i][j][1] = k;\n }\n for (j = 0; j < m; ++j) y0[j] = 0;\n return y0;\n },\n zero: d3_layout_stackOffsetZero\n });\n function d3_layout_stackOrderDefault(data) {\n return d3.range(data.length);\n }\n function d3_layout_stackOffsetZero(data) {\n var j = -1, m = data[0].length, y0 = [];\n while (++j < m) y0[j] = 0;\n return y0;\n }\n function d3_layout_stackMaxIndex(array) {\n var i = 1, j = 0, v = array[0][1], k, n = array.length;\n for (; i < n; ++i) {\n if ((k = array[i][1]) > v) {\n j = i;\n v = k;\n }\n }\n return j;\n }\n function d3_layout_stackReduceSum(d) {\n return d.reduce(d3_layout_stackSum, 0);\n }\n function d3_layout_stackSum(p, d) {\n return p + d[1];\n }\n d3.layout.histogram = function() {\n var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges;\n function histogram(data, i) {\n var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x;\n while (++i < m) {\n bin = bins[i] = [];\n bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);\n bin.y = 0;\n }\n if (m > 0) {\n i = -1;\n while (++i < n) {\n x = values[i];\n if (x >= range[0] && x <= range[1]) {\n bin = bins[d3.bisect(thresholds, x, 1, m) - 1];\n bin.y += k;\n bin.push(data[i]);\n }\n }\n }\n return bins;\n }\n histogram.value = function(x) {\n if (!arguments.length) return valuer;\n valuer = x;\n return histogram;\n };\n histogram.range = function(x) {\n if (!arguments.length) return ranger;\n ranger = d3_functor(x);\n return histogram;\n };\n histogram.bins = function(x) {\n if (!arguments.length) return binner;\n binner = typeof x === \"number\" ? function(range) {\n return d3_layout_histogramBinFixed(range, x);\n } : d3_functor(x);\n return histogram;\n };\n histogram.frequency = function(x) {\n if (!arguments.length) return frequency;\n frequency = !!x;\n return histogram;\n };\n return histogram;\n };\n function d3_layout_histogramBinSturges(range, values) {\n return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));\n }\n function d3_layout_histogramBinFixed(range, n) {\n var x = -1, b = +range[0], m = (range[1] - b) / n, f = [];\n while (++x <= n) f[x] = m * x + b;\n return f;\n }\n function d3_layout_histogramRange(values) {\n return [d3.min(values), d3.max(values)];\n }\n d3.layout.pack = function() {\n var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [1, 1], radius;\n function pack(d, i) {\n var nodes = hierarchy.call(this, d, i), root = nodes[0], w = size[0], h = size[1], r = radius == null ? Math.sqrt : typeof radius === \"function\" ? radius : function() {\n return radius;\n };\n root.x = root.y = 0;\n d3_layout_hierarchyVisitAfter(root, function(d2) {\n d2.r = +r(d2.value);\n });\n d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings);\n if (padding) {\n var dr = padding * (radius ? 1 : Math.max(2 * root.r / w, 2 * root.r / h)) / 2;\n d3_layout_hierarchyVisitAfter(root, function(d2) {\n d2.r += dr;\n });\n d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings);\n d3_layout_hierarchyVisitAfter(root, function(d2) {\n d2.r -= dr;\n });\n }\n d3_layout_packTransform(root, w / 2, h / 2, radius ? 1 : 1 / Math.max(2 * root.r / w, 2 * root.r / h));\n return nodes;\n }\n pack.size = function(_) {\n if (!arguments.length) return size;\n size = _;\n return pack;\n };\n pack.radius = function(_) {\n if (!arguments.length) return radius;\n radius = _ == null || typeof _ === \"function\" ? _ : +_;\n return pack;\n };\n pack.padding = function(_) {\n if (!arguments.length) return padding;\n padding = +_;\n return pack;\n };\n return d3_layout_hierarchyRebind(pack, hierarchy);\n };\n function d3_layout_packSort(a, b) {\n return a.value - b.value;\n }\n function d3_layout_packInsert(a, b) {\n var c = a._pack_next;\n a._pack_next = b;\n b._pack_prev = a;\n b._pack_next = c;\n c._pack_prev = b;\n }\n function d3_layout_packSplice(a, b) {\n a._pack_next = b;\n b._pack_prev = a;\n }\n function d3_layout_packIntersects(a, b) {\n var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r;\n return 0.999 * dr * dr > dx * dx + dy * dy;\n }\n function d3_layout_packSiblings(node) {\n if (!(nodes = node.children) || !(n = nodes.length)) return;\n var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n;\n function bound(node2) {\n xMin = Math.min(node2.x - node2.r, xMin);\n xMax = Math.max(node2.x + node2.r, xMax);\n yMin = Math.min(node2.y - node2.r, yMin);\n yMax = Math.max(node2.y + node2.r, yMax);\n }\n nodes.forEach(d3_layout_packLink);\n a = nodes[0];\n a.x = -a.r;\n a.y = 0;\n bound(a);\n if (n > 1) {\n b = nodes[1];\n b.x = b.r;\n b.y = 0;\n bound(b);\n if (n > 2) {\n c = nodes[2];\n d3_layout_packPlace(a, b, c);\n bound(c);\n d3_layout_packInsert(a, c);\n a._pack_prev = c;\n d3_layout_packInsert(c, b);\n b = a._pack_next;\n for (i = 3; i < n; i++) {\n d3_layout_packPlace(a, b, c = nodes[i]);\n var isect = 0, s1 = 1, s2 = 1;\n for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {\n if (d3_layout_packIntersects(j, c)) {\n isect = 1;\n break;\n }\n }\n if (isect == 1) {\n for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {\n if (d3_layout_packIntersects(k, c)) {\n break;\n }\n }\n }\n if (isect) {\n if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j);\n else d3_layout_packSplice(a = k, b);\n i--;\n } else {\n d3_layout_packInsert(a, c);\n b = c;\n bound(c);\n }\n }\n }\n }\n var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0;\n for (i = 0; i < n; i++) {\n c = nodes[i];\n c.x -= cx;\n c.y -= cy;\n cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y));\n }\n node.r = cr;\n nodes.forEach(d3_layout_packUnlink);\n }\n function d3_layout_packLink(node) {\n node._pack_next = node._pack_prev = node;\n }\n function d3_layout_packUnlink(node) {\n delete node._pack_next;\n delete node._pack_prev;\n }\n function d3_layout_packTransform(node, x, y, k) {\n var children = node.children;\n node.x = x += k * node.x;\n node.y = y += k * node.y;\n node.r *= k;\n if (children) {\n var i = -1, n = children.length;\n while (++i < n) d3_layout_packTransform(children[i], x, y, k);\n }\n }\n function d3_layout_packPlace(a, b, c) {\n var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y;\n if (db && (dx || dy)) {\n var da = b.r + c.r, dc = dx * dx + dy * dy;\n da *= da;\n db *= db;\n var x = 0.5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);\n c.x = a.x + x * dx + y * dy;\n c.y = a.y + x * dy - y * dx;\n } else {\n c.x = a.x + db;\n c.y = a.y;\n }\n }\n d3.layout.tree = function() {\n var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [1, 1], nodeSize = null;\n function tree(d, i) {\n var nodes = hierarchy.call(this, d, i), root0 = nodes[0], root1 = wrapTree(root0);\n d3_layout_hierarchyVisitAfter(root1, firstWalk), root1.parent.m = -root1.z;\n d3_layout_hierarchyVisitBefore(root1, secondWalk);\n if (nodeSize) d3_layout_hierarchyVisitBefore(root0, sizeNode);\n else {\n var left = root0, right = root0, bottom = root0;\n d3_layout_hierarchyVisitBefore(root0, function(node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var tx = separation(left, right) / 2 - left.x, kx = size[0] / (right.x + separation(right, left) / 2 + tx), ky = size[1] / (bottom.depth || 1);\n d3_layout_hierarchyVisitBefore(root0, function(node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n return nodes;\n }\n function wrapTree(root0) {\n var root1 = {\n A: null,\n children: [root0]\n }, queue = [root1], node1;\n while ((node1 = queue.pop()) != null) {\n for (var children = node1.children, child, i = 0, n = children.length; i < n; ++i) {\n queue.push((children[i] = child = {\n _: children[i],\n parent: node1,\n children: (child = children[i].children) && child.slice() || [],\n A: null,\n a: null,\n z: 0,\n m: 0,\n c: 0,\n s: 0,\n t: null,\n i\n }).a = child);\n }\n }\n return root1.children[0];\n }\n function firstWalk(v) {\n var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null;\n if (children.length) {\n d3_layout_treeShift(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n }\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n function apportion(v, w, ancestor) {\n if (w) {\n var vip = v, vop = v, vim = w, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift;\n while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {\n vom = d3_layout_treeLeft(vom);\n vop = d3_layout_treeRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n d3_layout_treeMove(d3_layout_treeAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !d3_layout_treeRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !d3_layout_treeLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n function sizeNode(node) {\n node.x *= size[0];\n node.y = node.depth * size[1];\n }\n tree.separation = function(x) {\n if (!arguments.length) return separation;\n separation = x;\n return tree;\n };\n tree.size = function(x) {\n if (!arguments.length) return nodeSize ? null : size;\n nodeSize = (size = x) == null ? sizeNode : null;\n return tree;\n };\n tree.nodeSize = function(x) {\n if (!arguments.length) return nodeSize ? size : null;\n nodeSize = (size = x) == null ? null : sizeNode;\n return tree;\n };\n return d3_layout_hierarchyRebind(tree, hierarchy);\n };\n function d3_layout_treeSeparation(a, b) {\n return a.parent == b.parent ? 1 : 2;\n }\n function d3_layout_treeLeft(v) {\n var children = v.children;\n return children.length ? children[0] : v.t;\n }\n function d3_layout_treeRight(v) {\n var children = v.children, n;\n return (n = children.length) ? children[n - 1] : v.t;\n }\n function d3_layout_treeMove(wm, wp, shift) {\n var change = shift / (wp.i - wm.i);\n wp.c -= change;\n wp.s += shift;\n wm.c += change;\n wp.z += shift;\n wp.m += shift;\n }\n function d3_layout_treeShift(v) {\n var shift = 0, change = 0, children = v.children, i = children.length, w;\n while (--i >= 0) {\n w = children[i];\n w.z += shift;\n w.m += shift;\n shift += w.s + (change += w.c);\n }\n }\n function d3_layout_treeAncestor(vim, v, ancestor) {\n return vim.a.parent === v.parent ? vim.a : ancestor;\n }\n d3.layout.cluster = function() {\n var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [1, 1], nodeSize = false;\n function cluster(d, i) {\n var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0;\n d3_layout_hierarchyVisitAfter(root, function(node) {\n var children = node.children;\n if (children && children.length) {\n node.x = d3_layout_clusterX(children);\n node.y = d3_layout_clusterY(children);\n } else {\n node.x = previousNode ? x += separation(node, previousNode) : 0;\n node.y = 0;\n previousNode = node;\n }\n });\n var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2;\n d3_layout_hierarchyVisitAfter(root, nodeSize ? function(node) {\n node.x = (node.x - root.x) * size[0];\n node.y = (root.y - node.y) * size[1];\n } : function(node) {\n node.x = (node.x - x0) / (x1 - x0) * size[0];\n node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];\n });\n return nodes;\n }\n cluster.separation = function(x) {\n if (!arguments.length) return separation;\n separation = x;\n return cluster;\n };\n cluster.size = function(x) {\n if (!arguments.length) return nodeSize ? null : size;\n nodeSize = (size = x) == null;\n return cluster;\n };\n cluster.nodeSize = function(x) {\n if (!arguments.length) return nodeSize ? size : null;\n nodeSize = (size = x) != null;\n return cluster;\n };\n return d3_layout_hierarchyRebind(cluster, hierarchy);\n };\n function d3_layout_clusterY(children) {\n return 1 + d3.max(children, function(child) {\n return child.y;\n });\n }\n function d3_layout_clusterX(children) {\n return children.reduce(function(x, child) {\n return x + child.x;\n }, 0) / children.length;\n }\n function d3_layout_clusterLeft(node) {\n var children = node.children;\n return children && children.length ? d3_layout_clusterLeft(children[0]) : node;\n }\n function d3_layout_clusterRight(node) {\n var children = node.children, n;\n return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;\n }\n d3.layout.treemap = function() {\n var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [1, 1], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, mode = \"squarify\", ratio = 0.5 * (1 + Math.sqrt(5));\n function scale(children, k) {\n var i = -1, n = children.length, child, area;\n while (++i < n) {\n area = (child = children[i]).value * (k < 0 ? 0 : k);\n child.area = isNaN(area) || area <= 0 ? 0 : area;\n }\n }\n function squarify(node) {\n var children = node.children;\n if (children && children.length) {\n var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = mode === \"slice\" ? rect.dx : mode === \"dice\" ? rect.dy : mode === \"slice-dice\" ? node.depth & 1 ? rect.dy : rect.dx : Math.min(rect.dx, rect.dy), n;\n scale(remaining, rect.dx * rect.dy / node.value);\n row.area = 0;\n while ((n = remaining.length) > 0) {\n row.push(child = remaining[n - 1]);\n row.area += child.area;\n if (mode !== \"squarify\" || (score = worst(row, u)) <= best) {\n remaining.pop();\n best = score;\n } else {\n row.area -= row.pop().area;\n position(row, u, rect, false);\n u = Math.min(rect.dx, rect.dy);\n row.length = row.area = 0;\n best = Infinity;\n }\n }\n if (row.length) {\n position(row, u, rect, true);\n row.length = row.area = 0;\n }\n children.forEach(squarify);\n }\n }\n function stickify(node) {\n var children = node.children;\n if (children && children.length) {\n var rect = pad(node), remaining = children.slice(), child, row = [];\n scale(remaining, rect.dx * rect.dy / node.value);\n row.area = 0;\n while (child = remaining.pop()) {\n row.push(child);\n row.area += child.area;\n if (child.z != null) {\n position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);\n row.length = row.area = 0;\n }\n }\n children.forEach(stickify);\n }\n }\n function worst(row, u) {\n var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length;\n while (++i < n) {\n if (!(r = row[i].area)) continue;\n if (r < rmin) rmin = r;\n if (r > rmax) rmax = r;\n }\n s *= s;\n u *= u;\n return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity;\n }\n function position(row, u, rect, flush) {\n var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o;\n if (u == rect.dx) {\n if (flush || v > rect.dy) v = rect.dy;\n while (++i < n) {\n o = row[i];\n o.x = x;\n o.y = y;\n o.dy = v;\n x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);\n }\n o.z = true;\n o.dx += rect.x + rect.dx - x;\n rect.y += v;\n rect.dy -= v;\n } else {\n if (flush || v > rect.dx) v = rect.dx;\n while (++i < n) {\n o = row[i];\n o.x = x;\n o.y = y;\n o.dx = v;\n y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);\n }\n o.z = false;\n o.dy += rect.y + rect.dy - y;\n rect.x += v;\n rect.dx -= v;\n }\n }\n function treemap(d) {\n var nodes = stickies || hierarchy(d), root = nodes[0];\n root.x = root.y = 0;\n if (root.value) root.dx = size[0], root.dy = size[1];\n else root.dx = root.dy = 0;\n if (stickies) hierarchy.revalue(root);\n scale([root], root.dx * root.dy / root.value);\n (stickies ? stickify : squarify)(root);\n if (sticky) stickies = nodes;\n return nodes;\n }\n treemap.size = function(x) {\n if (!arguments.length) return size;\n size = x;\n return treemap;\n };\n treemap.padding = function(x) {\n if (!arguments.length) return padding;\n function padFunction(node) {\n var p = x.call(treemap, node, node.depth);\n return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === \"number\" ? [p, p, p, p] : p);\n }\n function padConstant(node) {\n return d3_layout_treemapPad(node, x);\n }\n var type;\n pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === \"function\" ? padFunction : type === \"number\" ? (x = [x, x, x, x], padConstant) : padConstant;\n return treemap;\n };\n treemap.round = function(x) {\n if (!arguments.length) return round != Number;\n round = x ? Math.round : Number;\n return treemap;\n };\n treemap.sticky = function(x) {\n if (!arguments.length) return sticky;\n sticky = x;\n stickies = null;\n return treemap;\n };\n treemap.ratio = function(x) {\n if (!arguments.length) return ratio;\n ratio = x;\n return treemap;\n };\n treemap.mode = function(x) {\n if (!arguments.length) return mode;\n mode = x + \"\";\n return treemap;\n };\n return d3_layout_hierarchyRebind(treemap, hierarchy);\n };\n function d3_layout_treemapPadNull(node) {\n return {\n x: node.x,\n y: node.y,\n dx: node.dx,\n dy: node.dy\n };\n }\n function d3_layout_treemapPad(node, padding) {\n var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2];\n if (dx < 0) {\n x += dx / 2;\n dx = 0;\n }\n if (dy < 0) {\n y += dy / 2;\n dy = 0;\n }\n return {\n x,\n y,\n dx,\n dy\n };\n }\n d3.random = {\n normal: function(mu, sigma) {\n var n = arguments.length;\n if (n < 2) sigma = 1;\n if (n < 1) mu = 0;\n return function() {\n var x, y, r;\n do {\n x = Math.random() * 2 - 1;\n y = Math.random() * 2 - 1;\n r = x * x + y * y;\n } while (!r || r > 1);\n return mu + sigma * x * Math.sqrt(-2 * Math.log(r) / r);\n };\n },\n logNormal: function() {\n var random = d3.random.normal.apply(d3, arguments);\n return function() {\n return Math.exp(random());\n };\n },\n bates: function(m) {\n var random = d3.random.irwinHall(m);\n return function() {\n return random() / m;\n };\n },\n irwinHall: function(m) {\n return function() {\n for (var s = 0, j = 0; j < m; j++) s += Math.random();\n return s;\n };\n }\n };\n d3.scale = {};\n function d3_scaleExtent(domain) {\n var start = domain[0], stop = domain[domain.length - 1];\n return start < stop ? [start, stop] : [stop, start];\n }\n function d3_scaleRange(scale) {\n return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());\n }\n function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {\n var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]);\n return function(x) {\n return i(u(x));\n };\n }\n function d3_scale_nice(domain, nice) {\n var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx;\n if (x1 < x0) {\n dx = i0, i0 = i1, i1 = dx;\n dx = x0, x0 = x1, x1 = dx;\n }\n domain[i0] = nice.floor(x0);\n domain[i1] = nice.ceil(x1);\n return domain;\n }\n function d3_scale_niceStep(step) {\n return step ? {\n floor: function(x) {\n return Math.floor(x / step) * step;\n },\n ceil: function(x) {\n return Math.ceil(x / step) * step;\n }\n } : d3_scale_niceIdentity;\n }\n var d3_scale_niceIdentity = {\n floor: d3_identity,\n ceil: d3_identity\n };\n function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {\n var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1;\n if (domain[k] < domain[0]) {\n domain = domain.slice().reverse();\n range = range.slice().reverse();\n }\n while (++j <= k) {\n u.push(uninterpolate(domain[j - 1], domain[j]));\n i.push(interpolate(range[j - 1], range[j]));\n }\n return function(x) {\n var j2 = d3.bisect(domain, x, 1, k) - 1;\n return i[j2](u[j2](x));\n };\n }\n d3.scale.linear = function() {\n return d3_scale_linear([0, 1], [0, 1], d3_interpolate, false);\n };\n function d3_scale_linear(domain, range, interpolate, clamp) {\n var output, input;\n function rescale() {\n var linear2 = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;\n output = linear2(domain, range, uninterpolate, interpolate);\n input = linear2(range, domain, uninterpolate, d3_interpolate);\n return scale;\n }\n function scale(x) {\n return output(x);\n }\n scale.invert = function(y) {\n return input(y);\n };\n scale.domain = function(x) {\n if (!arguments.length) return domain;\n domain = x.map(Number);\n return rescale();\n };\n scale.range = function(x) {\n if (!arguments.length) return range;\n range = x;\n return rescale();\n };\n scale.rangeRound = function(x) {\n return scale.range(x).interpolate(d3_interpolateRound);\n };\n scale.clamp = function(x) {\n if (!arguments.length) return clamp;\n clamp = x;\n return rescale();\n };\n scale.interpolate = function(x) {\n if (!arguments.length) return interpolate;\n interpolate = x;\n return rescale();\n };\n scale.ticks = function(m) {\n return d3_scale_linearTicks(domain, m);\n };\n scale.tickFormat = function(m, format) {\n return d3_scale_linearTickFormat(domain, m, format);\n };\n scale.nice = function(m) {\n d3_scale_linearNice(domain, m);\n return rescale();\n };\n scale.copy = function() {\n return d3_scale_linear(domain, range, interpolate, clamp);\n };\n return rescale();\n }\n function d3_scale_linearRebind(scale, linear2) {\n return d3.rebind(scale, linear2, \"range\", \"rangeRound\", \"interpolate\", \"clamp\");\n }\n function d3_scale_linearNice(domain, m) {\n d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));\n d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));\n return domain;\n }\n function d3_scale_linearTickRange(domain, m) {\n if (m == null) m = 10;\n var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step;\n if (err <= 0.15) step *= 10;\n else if (err <= 0.35) step *= 5;\n else if (err <= 0.75) step *= 2;\n extent[0] = Math.ceil(extent[0] / step) * step;\n extent[1] = Math.floor(extent[1] / step) * step + step * 0.5;\n extent[2] = step;\n return extent;\n }\n function d3_scale_linearTicks(domain, m) {\n return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));\n }\n var d3_scale_linearFormatSignificant = {\n s: 1,\n g: 1,\n p: 1,\n r: 1,\n e: 1\n };\n function d3_scale_linearPrecision(value) {\n return -Math.floor(Math.log(value) / Math.LN10 + 0.01);\n }\n function d3_scale_linearFormatPrecision(type, range) {\n var p = d3_scale_linearPrecision(range[2]);\n return type in d3_scale_linearFormatSignificant ? Math.abs(p - d3_scale_linearPrecision(Math.max(abs(range[0]), abs(range[1])))) + +(type !== \"e\") : p - (type === \"%\") * 2;\n }\n d3.scale.log = function() {\n return d3_scale_log(d3.scale.linear().domain([0, 1]), 10, true, [1, 10]);\n };\n function d3_scale_log(linear2, base, positive, domain) {\n function log(x) {\n return (positive ? Math.log(x < 0 ? 0 : x) : -Math.log(x > 0 ? 0 : -x)) / Math.log(base);\n }\n function pow(x) {\n return positive ? Math.pow(base, x) : -Math.pow(base, -x);\n }\n function scale(x) {\n return linear2(log(x));\n }\n scale.invert = function(x) {\n return pow(linear2.invert(x));\n };\n scale.domain = function(x) {\n if (!arguments.length) return domain;\n positive = x[0] >= 0;\n linear2.domain((domain = x.map(Number)).map(log));\n return scale;\n };\n scale.base = function(_) {\n if (!arguments.length) return base;\n base = +_;\n linear2.domain(domain.map(log));\n return scale;\n };\n scale.nice = function() {\n var niced = d3_scale_nice(domain.map(log), positive ? Math : d3_scale_logNiceNegative);\n linear2.domain(niced);\n domain = niced.map(pow);\n return scale;\n };\n scale.ticks = function() {\n var extent = d3_scaleExtent(domain), ticks = [], u = extent[0], v = extent[1], i = Math.floor(log(u)), j = Math.ceil(log(v)), n = base % 1 ? 2 : base;\n if (isFinite(j - i)) {\n if (positive) {\n for (; i < j; i++) for (var k = 1; k < n; k++) ticks.push(pow(i) * k);\n ticks.push(pow(i));\n } else {\n ticks.push(pow(i));\n for (; i++ < j; ) for (var k = n - 1; k > 0; k--) ticks.push(pow(i) * k);\n }\n for (i = 0; ticks[i] < u; i++) {\n }\n for (j = ticks.length; ticks[j - 1] > v; j--) {\n }\n ticks = ticks.slice(i, j);\n }\n return ticks;\n };\n scale.copy = function() {\n return d3_scale_log(linear2.copy(), base, positive, domain);\n };\n return d3_scale_linearRebind(scale, linear2);\n }\n var d3_scale_logNiceNegative = {\n floor: function(x) {\n return -Math.ceil(-x);\n },\n ceil: function(x) {\n return -Math.floor(-x);\n }\n };\n d3.scale.pow = function() {\n return d3_scale_pow(d3.scale.linear(), 1, [0, 1]);\n };\n function d3_scale_pow(linear2, exponent, domain) {\n var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent);\n function scale(x) {\n return linear2(powp(x));\n }\n scale.invert = function(x) {\n return powb(linear2.invert(x));\n };\n scale.domain = function(x) {\n if (!arguments.length) return domain;\n linear2.domain((domain = x.map(Number)).map(powp));\n return scale;\n };\n scale.ticks = function(m) {\n return d3_scale_linearTicks(domain, m);\n };\n scale.tickFormat = function(m, format) {\n return d3_scale_linearTickFormat(domain, m, format);\n };\n scale.nice = function(m) {\n return scale.domain(d3_scale_linearNice(domain, m));\n };\n scale.exponent = function(x) {\n if (!arguments.length) return exponent;\n powp = d3_scale_powPow(exponent = x);\n powb = d3_scale_powPow(1 / exponent);\n linear2.domain(domain.map(powp));\n return scale;\n };\n scale.copy = function() {\n return d3_scale_pow(linear2.copy(), exponent, domain);\n };\n return d3_scale_linearRebind(scale, linear2);\n }\n function d3_scale_powPow(e) {\n return function(x) {\n return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);\n };\n }\n d3.scale.sqrt = function() {\n return d3.scale.pow().exponent(0.5);\n };\n d3.scale.ordinal = function() {\n return d3_scale_ordinal([], {\n t: \"range\",\n a: [[]]\n });\n };\n function d3_scale_ordinal(domain, ranger) {\n var index, range, rangeBand;\n function scale(x) {\n return range[((index.get(x) || (ranger.t === \"range\" ? index.set(x, domain.push(x)) : NaN)) - 1) % range.length];\n }\n function steps(start, step) {\n return d3.range(domain.length).map(function(i) {\n return start + step * i;\n });\n }\n scale.domain = function(x) {\n if (!arguments.length) return domain;\n domain = [];\n index = new d3_Map();\n var i = -1, n = x.length, xi;\n while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));\n return scale[ranger.t].apply(scale, ranger.a);\n };\n scale.range = function(x) {\n if (!arguments.length) return range;\n range = x;\n rangeBand = 0;\n ranger = {\n t: \"range\",\n a: arguments\n };\n return scale;\n };\n scale.rangePoints = function(x, padding) {\n if (arguments.length < 2) padding = 0;\n var start = x[0], stop = x[1], step = domain.length < 2 ? (start = (start + stop) / 2, 0) : (stop - start) / (domain.length - 1 + padding);\n range = steps(start + step * padding / 2, step);\n rangeBand = 0;\n ranger = {\n t: \"rangePoints\",\n a: arguments\n };\n return scale;\n };\n scale.rangeRoundPoints = function(x, padding) {\n if (arguments.length < 2) padding = 0;\n var start = x[0], stop = x[1], step = domain.length < 2 ? (start = stop = Math.round((start + stop) / 2), 0) : (stop - start) / (domain.length - 1 + padding) | 0;\n range = steps(start + Math.round(step * padding / 2 + (stop - start - (domain.length - 1 + padding) * step) / 2), step);\n rangeBand = 0;\n ranger = {\n t: \"rangeRoundPoints\",\n a: arguments\n };\n return scale;\n };\n scale.rangeBands = function(x, padding, outerPadding) {\n if (arguments.length < 2) padding = 0;\n if (arguments.length < 3) outerPadding = padding;\n var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding);\n range = steps(start + step * outerPadding, step);\n if (reverse) range.reverse();\n rangeBand = step * (1 - padding);\n ranger = {\n t: \"rangeBands\",\n a: arguments\n };\n return scale;\n };\n scale.rangeRoundBands = function(x, padding, outerPadding) {\n if (arguments.length < 2) padding = 0;\n if (arguments.length < 3) outerPadding = padding;\n var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding));\n range = steps(start + Math.round((stop - start - (domain.length - padding) * step) / 2), step);\n if (reverse) range.reverse();\n rangeBand = Math.round(step * (1 - padding));\n ranger = {\n t: \"rangeRoundBands\",\n a: arguments\n };\n return scale;\n };\n scale.rangeBand = function() {\n return rangeBand;\n };\n scale.rangeExtent = function() {\n return d3_scaleExtent(ranger.a[0]);\n };\n scale.copy = function() {\n return d3_scale_ordinal(domain, ranger);\n };\n return scale.domain(domain);\n }\n d3.scale.category10 = function() {\n return d3.scale.ordinal().range(d3_category10);\n };\n d3.scale.category20 = function() {\n return d3.scale.ordinal().range(d3_category20);\n };\n d3.scale.category20b = function() {\n return d3.scale.ordinal().range(d3_category20b);\n };\n d3.scale.category20c = function() {\n return d3.scale.ordinal().range(d3_category20c);\n };\n var d3_category10 = [2062260, 16744206, 2924588, 14034728, 9725885, 9197131, 14907330, 8355711, 12369186, 1556175].map(d3_rgbString);\n var d3_category20 = [2062260, 11454440, 16744206, 16759672, 2924588, 10018698, 14034728, 16750742, 9725885, 12955861, 9197131, 12885140, 14907330, 16234194, 8355711, 13092807, 12369186, 14408589, 1556175, 10410725].map(d3_rgbString);\n var d3_category20b = [3750777, 5395619, 7040719, 10264286, 6519097, 9216594, 11915115, 13556636, 9202993, 12426809, 15186514, 15190932, 8666169, 11356490, 14049643, 15177372, 8077683, 10834324, 13528509, 14589654].map(d3_rgbString);\n var d3_category20c = [3244733, 7057110, 10406625, 13032431, 15095053, 16616764, 16625259, 16634018, 3253076, 7652470, 10607003, 13101504, 7695281, 10394312, 12369372, 14342891, 6513507, 9868950, 12434877, 14277081].map(d3_rgbString);\n d3.scale.quantile = function() {\n return d3_scale_quantile([], []);\n };\n function d3_scale_quantile(domain, range) {\n var thresholds;\n function rescale() {\n var k = 0, q = range.length;\n thresholds = [];\n while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);\n return scale;\n }\n function scale(x) {\n if (!isNaN(x = +x)) return range[d3.bisect(thresholds, x)];\n }\n scale.domain = function(x) {\n if (!arguments.length) return domain;\n domain = x.map(d3_number).filter(d3_numeric).sort(d3_ascending);\n return rescale();\n };\n scale.range = function(x) {\n if (!arguments.length) return range;\n range = x;\n return rescale();\n };\n scale.quantiles = function() {\n return thresholds;\n };\n scale.invertExtent = function(y) {\n y = range.indexOf(y);\n return y < 0 ? [NaN, NaN] : [y > 0 ? thresholds[y - 1] : domain[0], y < thresholds.length ? thresholds[y] : domain[domain.length - 1]];\n };\n scale.copy = function() {\n return d3_scale_quantile(domain, range);\n };\n return rescale();\n }\n d3.scale.quantize = function() {\n return d3_scale_quantize(0, 1, [0, 1]);\n };\n function d3_scale_quantize(x0, x1, range) {\n var kx, i;\n function scale(x) {\n return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];\n }\n function rescale() {\n kx = range.length / (x1 - x0);\n i = range.length - 1;\n return scale;\n }\n scale.domain = function(x) {\n if (!arguments.length) return [x0, x1];\n x0 = +x[0];\n x1 = +x[x.length - 1];\n return rescale();\n };\n scale.range = function(x) {\n if (!arguments.length) return range;\n range = x;\n return rescale();\n };\n scale.invertExtent = function(y) {\n y = range.indexOf(y);\n y = y < 0 ? NaN : y / kx + x0;\n return [y, y + 1 / kx];\n };\n scale.copy = function() {\n return d3_scale_quantize(x0, x1, range);\n };\n return rescale();\n }\n d3.scale.threshold = function() {\n return d3_scale_threshold([0.5], [0, 1]);\n };\n function d3_scale_threshold(domain, range) {\n function scale(x) {\n if (x <= x) return range[d3.bisect(domain, x)];\n }\n scale.domain = function(_) {\n if (!arguments.length) return domain;\n domain = _;\n return scale;\n };\n scale.range = function(_) {\n if (!arguments.length) return range;\n range = _;\n return scale;\n };\n scale.invertExtent = function(y) {\n y = range.indexOf(y);\n return [domain[y - 1], domain[y]];\n };\n scale.copy = function() {\n return d3_scale_threshold(domain, range);\n };\n return scale;\n }\n d3.scale.identity = function() {\n return d3_scale_identity([0, 1]);\n };\n function d3_scale_identity(domain) {\n function identity2(x) {\n return +x;\n }\n identity2.invert = identity2;\n identity2.domain = identity2.range = function(x) {\n if (!arguments.length) return domain;\n domain = x.map(identity2);\n return identity2;\n };\n identity2.ticks = function(m) {\n return d3_scale_linearTicks(domain, m);\n };\n identity2.tickFormat = function(m, format) {\n return d3_scale_linearTickFormat(domain, m, format);\n };\n identity2.copy = function() {\n return d3_scale_identity(domain);\n };\n return identity2;\n }\n d3.svg = {};\n function d3_zero() {\n return 0;\n }\n d3.svg.arc = function() {\n var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, cornerRadius = d3_zero, padRadius = d3_svg_arcAuto, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle, padAngle = d3_svg_arcPadAngle;\n function arc() {\n var r0 = Math.max(0, +innerRadius.apply(this, arguments)), r1 = Math.max(0, +outerRadius.apply(this, arguments)), a0 = startAngle.apply(this, arguments) - half\\u03C0, a1 = endAngle.apply(this, arguments) - half\\u03C0, da = Math.abs(a1 - a0), cw = a0 > a1 ? 0 : 1;\n if (r1 < r0) rc = r1, r1 = r0, r0 = rc;\n if (da >= \\u03C4\\u03B5) return circleSegment(r1, cw) + (r0 ? circleSegment(r0, 1 - cw) : \"\") + \"Z\";\n var rc, cr, rp, ap, p0 = 0, p1 = 0, x0, y0, x1, y1, x2, y2, x3, y3, path = [];\n if (ap = (+padAngle.apply(this, arguments) || 0) / 2) {\n rp = padRadius === d3_svg_arcAuto ? Math.sqrt(r0 * r0 + r1 * r1) : +padRadius.apply(this, arguments);\n if (!cw) p1 *= -1;\n if (r1) p1 = d3_asin(rp / r1 * Math.sin(ap));\n if (r0) p0 = d3_asin(rp / r0 * Math.sin(ap));\n }\n if (r1) {\n x0 = r1 * Math.cos(a0 + p1);\n y0 = r1 * Math.sin(a0 + p1);\n x1 = r1 * Math.cos(a1 - p1);\n y1 = r1 * Math.sin(a1 - p1);\n var l1 = Math.abs(a1 - a0 - 2 * p1) <= \\u03C0 ? 0 : 1;\n if (p1 && d3_svg_arcSweep(x0, y0, x1, y1) === cw ^ l1) {\n var h1 = (a0 + a1) / 2;\n x0 = r1 * Math.cos(h1);\n y0 = r1 * Math.sin(h1);\n x1 = y1 = null;\n }\n } else {\n x0 = y0 = 0;\n }\n if (r0) {\n x2 = r0 * Math.cos(a1 - p0);\n y2 = r0 * Math.sin(a1 - p0);\n x3 = r0 * Math.cos(a0 + p0);\n y3 = r0 * Math.sin(a0 + p0);\n var l0 = Math.abs(a0 - a1 + 2 * p0) <= \\u03C0 ? 0 : 1;\n if (p0 && d3_svg_arcSweep(x2, y2, x3, y3) === 1 - cw ^ l0) {\n var h0 = (a0 + a1) / 2;\n x2 = r0 * Math.cos(h0);\n y2 = r0 * Math.sin(h0);\n x3 = y3 = null;\n }\n } else {\n x2 = y2 = 0;\n }\n if (da > \\u03B5 && (rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > 1e-3) {\n cr = r0 < r1 ^ cw ? 0 : 1;\n var rc1 = rc, rc0 = rc;\n if (da < \\u03C0) {\n var oc = x3 == null ? [x2, y2] : x1 == null ? [x0, y0] : d3_geom_polygonIntersect([x0, y0], [x3, y3], [x1, y1], [x2, y2]), ax = x0 - oc[0], ay = y0 - oc[1], bx = x1 - oc[0], by = y1 - oc[1], kc = 1 / Math.sin(Math.acos((ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))) / 2), lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1]);\n rc0 = Math.min(rc, (r0 - lc) / (kc - 1));\n rc1 = Math.min(rc, (r1 - lc) / (kc + 1));\n }\n if (x1 != null) {\n var t30 = d3_svg_arcCornerTangents(x3 == null ? [x2, y2] : [x3, y3], [x0, y0], r1, rc1, cw), t12 = d3_svg_arcCornerTangents([x1, y1], [x2, y2], r1, rc1, cw);\n if (rc === rc1) {\n path.push(\"M\", t30[0], \"A\", rc1, \",\", rc1, \" 0 0,\", cr, \" \", t30[1], \"A\", r1, \",\", r1, \" 0 \", 1 - cw ^ d3_svg_arcSweep(t30[1][0], t30[1][1], t12[1][0], t12[1][1]), \",\", cw, \" \", t12[1], \"A\", rc1, \",\", rc1, \" 0 0,\", cr, \" \", t12[0]);\n } else {\n path.push(\"M\", t30[0], \"A\", rc1, \",\", rc1, \" 0 1,\", cr, \" \", t12[0]);\n }\n } else {\n path.push(\"M\", x0, \",\", y0);\n }\n if (x3 != null) {\n var t03 = d3_svg_arcCornerTangents([x0, y0], [x3, y3], r0, -rc0, cw), t21 = d3_svg_arcCornerTangents([x2, y2], x1 == null ? [x0, y0] : [x1, y1], r0, -rc0, cw);\n if (rc === rc0) {\n path.push(\"L\", t21[0], \"A\", rc0, \",\", rc0, \" 0 0,\", cr, \" \", t21[1], \"A\", r0, \",\", r0, \" 0 \", cw ^ d3_svg_arcSweep(t21[1][0], t21[1][1], t03[1][0], t03[1][1]), \",\", 1 - cw, \" \", t03[1], \"A\", rc0, \",\", rc0, \" 0 0,\", cr, \" \", t03[0]);\n } else {\n path.push(\"L\", t21[0], \"A\", rc0, \",\", rc0, \" 0 0,\", cr, \" \", t03[0]);\n }\n } else {\n path.push(\"L\", x2, \",\", y2);\n }\n } else {\n path.push(\"M\", x0, \",\", y0);\n if (x1 != null) path.push(\"A\", r1, \",\", r1, \" 0 \", l1, \",\", cw, \" \", x1, \",\", y1);\n path.push(\"L\", x2, \",\", y2);\n if (x3 != null) path.push(\"A\", r0, \",\", r0, \" 0 \", l0, \",\", 1 - cw, \" \", x3, \",\", y3);\n }\n path.push(\"Z\");\n return path.join(\"\");\n }\n function circleSegment(r1, cw) {\n return \"M0,\" + r1 + \"A\" + r1 + \",\" + r1 + \" 0 1,\" + cw + \" 0,\" + -r1 + \"A\" + r1 + \",\" + r1 + \" 0 1,\" + cw + \" 0,\" + r1;\n }\n arc.innerRadius = function(v) {\n if (!arguments.length) return innerRadius;\n innerRadius = d3_functor(v);\n return arc;\n };\n arc.outerRadius = function(v) {\n if (!arguments.length) return outerRadius;\n outerRadius = d3_functor(v);\n return arc;\n };\n arc.cornerRadius = function(v) {\n if (!arguments.length) return cornerRadius;\n cornerRadius = d3_functor(v);\n return arc;\n };\n arc.padRadius = function(v) {\n if (!arguments.length) return padRadius;\n padRadius = v == d3_svg_arcAuto ? d3_svg_arcAuto : d3_functor(v);\n return arc;\n };\n arc.startAngle = function(v) {\n if (!arguments.length) return startAngle;\n startAngle = d3_functor(v);\n return arc;\n };\n arc.endAngle = function(v) {\n if (!arguments.length) return endAngle;\n endAngle = d3_functor(v);\n return arc;\n };\n arc.padAngle = function(v) {\n if (!arguments.length) return padAngle;\n padAngle = d3_functor(v);\n return arc;\n };\n arc.centroid = function() {\n var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - half\\u03C0;\n return [Math.cos(a) * r, Math.sin(a) * r];\n };\n return arc;\n };\n var d3_svg_arcAuto = \"auto\";\n function d3_svg_arcInnerRadius(d) {\n return d.innerRadius;\n }\n function d3_svg_arcOuterRadius(d) {\n return d.outerRadius;\n }\n function d3_svg_arcStartAngle(d) {\n return d.startAngle;\n }\n function d3_svg_arcEndAngle(d) {\n return d.endAngle;\n }\n function d3_svg_arcPadAngle(d) {\n return d && d.padAngle;\n }\n function d3_svg_arcSweep(x0, y0, x1, y1) {\n return (x0 - x1) * y0 - (y0 - y1) * x0 > 0 ? 0 : 1;\n }\n function d3_svg_arcCornerTangents(p0, p1, r1, rc, cw) {\n var x01 = p0[0] - p1[0], y01 = p0[1] - p1[1], lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x1 = p0[0] + ox, y1 = p0[1] + oy, x2 = p1[0] + ox, y2 = p1[1] + oy, x3 = (x1 + x2) / 2, y3 = (y1 + y2) / 2, dx = x2 - x1, dy = y2 - y1, d2 = dx * dx + dy * dy, r = r1 - rc, D2 = x1 * y2 - x2 * y1, d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D2 * D2)), cx0 = (D2 * dy - dx * d) / d2, cy0 = (-D2 * dx - dy * d) / d2, cx1 = (D2 * dy + dx * d) / d2, cy1 = (-D2 * dx + dy * d) / d2, dx0 = cx0 - x3, dy0 = cy0 - y3, dx1 = cx1 - x3, dy1 = cy1 - y3;\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;\n return [[cx0 - ox, cy0 - oy], [cx0 * r1 / r, cy0 * r1 / r]];\n }\n function d3_true() {\n return true;\n }\n function d3_svg_line(projection) {\n var x = d3_geom_pointX, y = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = 0.7;\n function line(data) {\n var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y);\n function segment() {\n segments.push(\"M\", interpolate(projection(points), tension));\n }\n while (++i < n) {\n if (defined.call(this, d = data[i], i)) {\n points.push([+fx.call(this, d, i), +fy.call(this, d, i)]);\n } else if (points.length) {\n segment();\n points = [];\n }\n }\n if (points.length) segment();\n return segments.length ? segments.join(\"\") : null;\n }\n line.x = function(_) {\n if (!arguments.length) return x;\n x = _;\n return line;\n };\n line.y = function(_) {\n if (!arguments.length) return y;\n y = _;\n return line;\n };\n line.defined = function(_) {\n if (!arguments.length) return defined;\n defined = _;\n return line;\n };\n line.interpolate = function(_) {\n if (!arguments.length) return interpolateKey;\n if (typeof _ === \"function\") interpolateKey = interpolate = _;\n else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;\n return line;\n };\n line.tension = function(_) {\n if (!arguments.length) return tension;\n tension = _;\n return line;\n };\n return line;\n }\n d3.svg.line = function() {\n return d3_svg_line(d3_identity);\n };\n var d3_svg_lineInterpolators = d3.map({\n linear: d3_svg_lineLinear,\n \"linear-closed\": d3_svg_lineLinearClosed,\n step: d3_svg_lineStep,\n \"step-before\": d3_svg_lineStepBefore,\n \"step-after\": d3_svg_lineStepAfter,\n basis: d3_svg_lineBasis,\n \"basis-open\": d3_svg_lineBasisOpen,\n \"basis-closed\": d3_svg_lineBasisClosed,\n bundle: d3_svg_lineBundle,\n cardinal: d3_svg_lineCardinal,\n \"cardinal-open\": d3_svg_lineCardinalOpen,\n \"cardinal-closed\": d3_svg_lineCardinalClosed,\n monotone: d3_svg_lineMonotone\n });\n d3_svg_lineInterpolators.forEach(function(key, value) {\n value.key = key;\n value.closed = /-closed$/.test(key);\n });\n function d3_svg_lineLinear(points) {\n return points.length > 1 ? points.join(\"L\") : points + \"Z\";\n }\n function d3_svg_lineLinearClosed(points) {\n return points.join(\"L\") + \"Z\";\n }\n function d3_svg_lineStep(points) {\n var i = 0, n = points.length, p = points[0], path = [p[0], \",\", p[1]];\n while (++i < n) path.push(\"H\", (p[0] + (p = points[i])[0]) / 2, \"V\", p[1]);\n if (n > 1) path.push(\"H\", p[0]);\n return path.join(\"\");\n }\n function d3_svg_lineStepBefore(points) {\n var i = 0, n = points.length, p = points[0], path = [p[0], \",\", p[1]];\n while (++i < n) path.push(\"V\", (p = points[i])[1], \"H\", p[0]);\n return path.join(\"\");\n }\n function d3_svg_lineStepAfter(points) {\n var i = 0, n = points.length, p = points[0], path = [p[0], \",\", p[1]];\n while (++i < n) path.push(\"H\", (p = points[i])[0], \"V\", p[1]);\n return path.join(\"\");\n }\n function d3_svg_lineCardinalOpen(points, tension) {\n return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, -1), d3_svg_lineCardinalTangents(points, tension));\n }\n function d3_svg_lineCardinalClosed(points, tension) {\n return points.length < 3 ? d3_svg_lineLinearClosed(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), points), d3_svg_lineCardinalTangents([points[points.length - 2]].concat(points, [points[1]]), tension));\n }\n function d3_svg_lineCardinal(points, tension) {\n return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension));\n }\n function d3_svg_lineHermite(points, tangents) {\n if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) {\n return d3_svg_lineLinear(points);\n }\n var quad = points.length != tangents.length, path = \"\", p0 = points[0], p = points[1], t02 = tangents[0], t = t02, pi = 1;\n if (quad) {\n path += \"Q\" + (p[0] - t02[0] * 2 / 3) + \",\" + (p[1] - t02[1] * 2 / 3) + \",\" + p[0] + \",\" + p[1];\n p0 = points[1];\n pi = 2;\n }\n if (tangents.length > 1) {\n t = tangents[1];\n p = points[pi];\n pi++;\n path += \"C\" + (p0[0] + t02[0]) + \",\" + (p0[1] + t02[1]) + \",\" + (p[0] - t[0]) + \",\" + (p[1] - t[1]) + \",\" + p[0] + \",\" + p[1];\n for (var i = 2; i < tangents.length; i++, pi++) {\n p = points[pi];\n t = tangents[i];\n path += \"S\" + (p[0] - t[0]) + \",\" + (p[1] - t[1]) + \",\" + p[0] + \",\" + p[1];\n }\n }\n if (quad) {\n var lp = points[pi];\n path += \"Q\" + (p[0] + t[0] * 2 / 3) + \",\" + (p[1] + t[1] * 2 / 3) + \",\" + lp[0] + \",\" + lp[1];\n }\n return path;\n }\n function d3_svg_lineCardinalTangents(points, tension) {\n var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length;\n while (++i < n) {\n p0 = p1;\n p1 = p2;\n p2 = points[i];\n tangents.push([a * (p2[0] - p0[0]), a * (p2[1] - p0[1])]);\n }\n return tangents;\n }\n function d3_svg_lineBasis(points) {\n if (points.length < 3) return d3_svg_lineLinear(points);\n var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [x0, x0, x0, (pi = points[1])[0]], py = [y0, y0, y0, pi[1]], path = [x0, \",\", y0, \"L\", d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), \",\", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)];\n points.push(points[n - 1]);\n while (++i <= n) {\n pi = points[i];\n px.shift();\n px.push(pi[0]);\n py.shift();\n py.push(pi[1]);\n d3_svg_lineBasisBezier(path, px, py);\n }\n points.pop();\n path.push(\"L\", pi);\n return path.join(\"\");\n }\n function d3_svg_lineBasisOpen(points) {\n if (points.length < 4) return d3_svg_lineLinear(points);\n var path = [], i = -1, n = points.length, pi, px = [0], py = [0];\n while (++i < 3) {\n pi = points[i];\n px.push(pi[0]);\n py.push(pi[1]);\n }\n path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + \",\" + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));\n --i;\n while (++i < n) {\n pi = points[i];\n px.shift();\n px.push(pi[0]);\n py.shift();\n py.push(pi[1]);\n d3_svg_lineBasisBezier(path, px, py);\n }\n return path.join(\"\");\n }\n function d3_svg_lineBasisClosed(points) {\n var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = [];\n while (++i < 4) {\n pi = points[i % n];\n px.push(pi[0]);\n py.push(pi[1]);\n }\n path = [d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), \",\", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)];\n --i;\n while (++i < m) {\n pi = points[i % n];\n px.shift();\n px.push(pi[0]);\n py.shift();\n py.push(pi[1]);\n d3_svg_lineBasisBezier(path, px, py);\n }\n return path.join(\"\");\n }\n function d3_svg_lineBundle(points, tension) {\n var n = points.length - 1;\n if (n) {\n var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t;\n while (++i <= n) {\n p = points[i];\n t = i / n;\n p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);\n p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);\n }\n }\n return d3_svg_lineBasis(points);\n }\n function d3_svg_lineDot4(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n }\n var d3_svg_lineBasisBezier1 = [0, 2 / 3, 1 / 3, 0], d3_svg_lineBasisBezier2 = [0, 1 / 3, 2 / 3, 0], d3_svg_lineBasisBezier3 = [0, 1 / 6, 2 / 3, 1 / 6];\n function d3_svg_lineBasisBezier(path, x, y) {\n path.push(\"C\", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), \",\", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), \",\", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), \",\", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), \",\", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), \",\", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));\n }\n function d3_svg_lineSlope(p0, p1) {\n return (p1[1] - p0[1]) / (p1[0] - p0[0]);\n }\n function d3_svg_lineFiniteDifferences(points) {\n var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1);\n while (++i < j) {\n m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2;\n }\n m[i] = d;\n return m;\n }\n function d3_svg_lineMonotoneTangents(points) {\n var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1;\n while (++i < j) {\n d = d3_svg_lineSlope(points[i], points[i + 1]);\n if (abs(d) < \\u03B5) {\n m[i] = m[i + 1] = 0;\n } else {\n a = m[i] / d;\n b = m[i + 1] / d;\n s = a * a + b * b;\n if (s > 9) {\n s = d * 3 / Math.sqrt(s);\n m[i] = s * a;\n m[i + 1] = s * b;\n }\n }\n }\n i = -1;\n while (++i <= j) {\n s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));\n tangents.push([s || 0, m[i] * s || 0]);\n }\n return tangents;\n }\n function d3_svg_lineMonotone(points) {\n return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));\n }\n d3.svg.line.radial = function() {\n var line = d3_svg_line(d3_svg_lineRadial);\n line.radius = line.x, delete line.x;\n line.angle = line.y, delete line.y;\n return line;\n };\n function d3_svg_lineRadial(points) {\n var point, i = -1, n = points.length, r, a;\n while (++i < n) {\n point = points[i];\n r = point[0];\n a = point[1] - half\\u03C0;\n point[0] = r * Math.cos(a);\n point[1] = r * Math.sin(a);\n }\n return points;\n }\n function d3_svg_area(projection) {\n var x0 = d3_geom_pointX, x1 = d3_geom_pointX, y0 = 0, y1 = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = \"L\", tension = 0.7;\n function area(data) {\n var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {\n return x;\n } : d3_functor(x1), fy1 = y0 === y1 ? function() {\n return y;\n } : d3_functor(y1), x, y;\n function segment() {\n segments.push(\"M\", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), \"Z\");\n }\n while (++i < n) {\n if (defined.call(this, d = data[i], i)) {\n points0.push([x = +fx0.call(this, d, i), y = +fy0.call(this, d, i)]);\n points1.push([+fx1.call(this, d, i), +fy1.call(this, d, i)]);\n } else if (points0.length) {\n segment();\n points0 = [];\n points1 = [];\n }\n }\n if (points0.length) segment();\n return segments.length ? segments.join(\"\") : null;\n }\n area.x = function(_) {\n if (!arguments.length) return x1;\n x0 = x1 = _;\n return area;\n };\n area.x0 = function(_) {\n if (!arguments.length) return x0;\n x0 = _;\n return area;\n };\n area.x1 = function(_) {\n if (!arguments.length) return x1;\n x1 = _;\n return area;\n };\n area.y = function(_) {\n if (!arguments.length) return y1;\n y0 = y1 = _;\n return area;\n };\n area.y0 = function(_) {\n if (!arguments.length) return y0;\n y0 = _;\n return area;\n };\n area.y1 = function(_) {\n if (!arguments.length) return y1;\n y1 = _;\n return area;\n };\n area.defined = function(_) {\n if (!arguments.length) return defined;\n defined = _;\n return area;\n };\n area.interpolate = function(_) {\n if (!arguments.length) return interpolateKey;\n if (typeof _ === \"function\") interpolateKey = interpolate = _;\n else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;\n interpolateReverse = interpolate.reverse || interpolate;\n L = interpolate.closed ? \"M\" : \"L\";\n return area;\n };\n area.tension = function(_) {\n if (!arguments.length) return tension;\n tension = _;\n return area;\n };\n return area;\n }\n d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;\n d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;\n d3.svg.area = function() {\n return d3_svg_area(d3_identity);\n };\n d3.svg.area.radial = function() {\n var area = d3_svg_area(d3_svg_lineRadial);\n area.radius = area.x, delete area.x;\n area.innerRadius = area.x0, delete area.x0;\n area.outerRadius = area.x1, delete area.x1;\n area.angle = area.y, delete area.y;\n area.startAngle = area.y0, delete area.y0;\n area.endAngle = area.y1, delete area.y1;\n return area;\n };\n function d3_source(d) {\n return d.source;\n }\n function d3_target(d) {\n return d.target;\n }\n d3.svg.chord = function() {\n var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;\n function chord(d, i) {\n var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);\n return \"M\" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + \"Z\";\n }\n function subgroup(self2, f, d, i) {\n var subgroup2 = f.call(self2, d, i), r = radius.call(self2, subgroup2, i), a0 = startAngle.call(self2, subgroup2, i) - half\\u03C0, a1 = endAngle.call(self2, subgroup2, i) - half\\u03C0;\n return {\n r,\n a0,\n a1,\n p0: [r * Math.cos(a0), r * Math.sin(a0)],\n p1: [r * Math.cos(a1), r * Math.sin(a1)]\n };\n }\n function equals(a, b) {\n return a.a0 == b.a0 && a.a1 == b.a1;\n }\n function arc(r, p, a) {\n return \"A\" + r + \",\" + r + \" 0 \" + +(a > \\u03C0) + \",1 \" + p;\n }\n function curve(r0, p0, r1, p1) {\n return \"Q 0,0 \" + p1;\n }\n chord.radius = function(v) {\n if (!arguments.length) return radius;\n radius = d3_functor(v);\n return chord;\n };\n chord.source = function(v) {\n if (!arguments.length) return source;\n source = d3_functor(v);\n return chord;\n };\n chord.target = function(v) {\n if (!arguments.length) return target;\n target = d3_functor(v);\n return chord;\n };\n chord.startAngle = function(v) {\n if (!arguments.length) return startAngle;\n startAngle = d3_functor(v);\n return chord;\n };\n chord.endAngle = function(v) {\n if (!arguments.length) return endAngle;\n endAngle = d3_functor(v);\n return chord;\n };\n return chord;\n };\n function d3_svg_chordRadius(d) {\n return d.radius;\n }\n d3.svg.diagonal = function() {\n var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection;\n function diagonal(d, i) {\n var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [p0, {\n x: p0.x,\n y: m\n }, {\n x: p3.x,\n y: m\n }, p3];\n p = p.map(projection);\n return \"M\" + p[0] + \"C\" + p[1] + \" \" + p[2] + \" \" + p[3];\n }\n diagonal.source = function(x) {\n if (!arguments.length) return source;\n source = d3_functor(x);\n return diagonal;\n };\n diagonal.target = function(x) {\n if (!arguments.length) return target;\n target = d3_functor(x);\n return diagonal;\n };\n diagonal.projection = function(x) {\n if (!arguments.length) return projection;\n projection = x;\n return diagonal;\n };\n return diagonal;\n };\n function d3_svg_diagonalProjection(d) {\n return [d.x, d.y];\n }\n d3.svg.diagonal.radial = function() {\n var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection;\n diagonal.projection = function(x) {\n return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection;\n };\n return diagonal;\n };\n function d3_svg_diagonalRadialProjection(projection) {\n return function() {\n var d = projection.apply(this, arguments), r = d[0], a = d[1] - half\\u03C0;\n return [r * Math.cos(a), r * Math.sin(a)];\n };\n }\n d3.svg.symbol = function() {\n var type = d3_svg_symbolType, size = d3_svg_symbolSize;\n function symbol(d, i) {\n return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i));\n }\n symbol.type = function(x) {\n if (!arguments.length) return type;\n type = d3_functor(x);\n return symbol;\n };\n symbol.size = function(x) {\n if (!arguments.length) return size;\n size = d3_functor(x);\n return symbol;\n };\n return symbol;\n };\n function d3_svg_symbolSize() {\n return 64;\n }\n function d3_svg_symbolType() {\n return \"circle\";\n }\n function d3_svg_symbolCircle(size) {\n var r = Math.sqrt(size / \\u03C0);\n return \"M0,\" + r + \"A\" + r + \",\" + r + \" 0 1,1 0,\" + -r + \"A\" + r + \",\" + r + \" 0 1,1 0,\" + r + \"Z\";\n }\n var d3_svg_symbols = d3.map({\n circle: d3_svg_symbolCircle,\n cross: function(size) {\n var r = Math.sqrt(size / 5) / 2;\n return \"M\" + -3 * r + \",\" + -r + \"H\" + -r + \"V\" + -3 * r + \"H\" + r + \"V\" + -r + \"H\" + 3 * r + \"V\" + r + \"H\" + r + \"V\" + 3 * r + \"H\" + -r + \"V\" + r + \"H\" + -3 * r + \"Z\";\n },\n diamond: function(size) {\n var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30;\n return \"M0,\" + -ry + \"L\" + rx + \",0 0,\" + ry + \" \" + -rx + \",0Z\";\n },\n square: function(size) {\n var r = Math.sqrt(size) / 2;\n return \"M\" + -r + \",\" + -r + \"L\" + r + \",\" + -r + \" \" + r + \",\" + r + \" \" + -r + \",\" + r + \"Z\";\n },\n \"triangle-down\": function(size) {\n var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;\n return \"M0,\" + ry + \"L\" + rx + \",\" + -ry + \" \" + -rx + \",\" + -ry + \"Z\";\n },\n \"triangle-up\": function(size) {\n var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;\n return \"M0,\" + -ry + \"L\" + rx + \",\" + ry + \" \" + -rx + \",\" + ry + \"Z\";\n }\n });\n d3.svg.symbolTypes = d3_svg_symbols.keys();\n var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians);\n d3_selectionPrototype.transition = function(name2) {\n var id = d3_transitionInheritId || ++d3_transitionId, ns = d3_transitionNamespace(name2), subgroups = [], subgroup, node, transition = d3_transitionInherit || {\n time: Date.now(),\n ease: d3_ease_cubicInOut,\n delay: 0,\n duration: 250\n };\n for (var j = -1, m = this.length; ++j < m; ) {\n subgroups.push(subgroup = []);\n for (var group = this[j], i = -1, n = group.length; ++i < n; ) {\n if (node = group[i]) d3_transitionNode(node, i, ns, id, transition);\n subgroup.push(node);\n }\n }\n return d3_transition(subgroups, ns, id);\n };\n d3_selectionPrototype.interrupt = function(name2) {\n return this.each(name2 == null ? d3_selection_interrupt : d3_selection_interruptNS(d3_transitionNamespace(name2)));\n };\n var d3_selection_interrupt = d3_selection_interruptNS(d3_transitionNamespace());\n function d3_selection_interruptNS(ns) {\n return function() {\n var lock, activeId, active;\n if ((lock = this[ns]) && (active = lock[activeId = lock.active])) {\n active.timer.c = null;\n active.timer.t = NaN;\n if (--lock.count) delete lock[activeId];\n else delete this[ns];\n lock.active += 0.5;\n active.event && active.event.interrupt.call(this, this.__data__, active.index);\n }\n };\n }\n function d3_transition(groups, ns, id) {\n d3_subclass(groups, d3_transitionPrototype);\n groups.namespace = ns;\n groups.id = id;\n return groups;\n }\n var d3_transitionPrototype = [], d3_transitionId = 0, d3_transitionInheritId, d3_transitionInherit;\n d3_transitionPrototype.call = d3_selectionPrototype.call;\n d3_transitionPrototype.empty = d3_selectionPrototype.empty;\n d3_transitionPrototype.node = d3_selectionPrototype.node;\n d3_transitionPrototype.size = d3_selectionPrototype.size;\n d3.transition = function(selection, name2) {\n return selection && selection.transition ? d3_transitionInheritId ? selection.transition(name2) : selection : d3.selection().transition(selection);\n };\n d3.transition.prototype = d3_transitionPrototype;\n d3_transitionPrototype.select = function(selector) {\n var id = this.id, ns = this.namespace, subgroups = [], subgroup, subnode, node;\n selector = d3_selection_selector(selector);\n for (var j = -1, m = this.length; ++j < m; ) {\n subgroups.push(subgroup = []);\n for (var group = this[j], i = -1, n = group.length; ++i < n; ) {\n if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i, j))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n d3_transitionNode(subnode, i, ns, id, node[ns][id]);\n subgroup.push(subnode);\n } else {\n subgroup.push(null);\n }\n }\n }\n return d3_transition(subgroups, ns, id);\n };\n d3_transitionPrototype.selectAll = function(selector) {\n var id = this.id, ns = this.namespace, subgroups = [], subgroup, subnodes, node, subnode, transition;\n selector = d3_selection_selectorAll(selector);\n for (var j = -1, m = this.length; ++j < m; ) {\n for (var group = this[j], i = -1, n = group.length; ++i < n; ) {\n if (node = group[i]) {\n transition = node[ns][id];\n subnodes = selector.call(node, node.__data__, i, j);\n subgroups.push(subgroup = []);\n for (var k = -1, o = subnodes.length; ++k < o; ) {\n if (subnode = subnodes[k]) d3_transitionNode(subnode, k, ns, id, transition);\n subgroup.push(subnode);\n }\n }\n }\n }\n return d3_transition(subgroups, ns, id);\n };\n d3_transitionPrototype.filter = function(filter) {\n var subgroups = [], subgroup, group, node;\n if (typeof filter !== \"function\") filter = d3_selection_filter(filter);\n for (var j = 0, m = this.length; j < m; j++) {\n subgroups.push(subgroup = []);\n for (var group = this[j], i = 0, n = group.length; i < n; i++) {\n if ((node = group[i]) && filter.call(node, node.__data__, i, j)) {\n subgroup.push(node);\n }\n }\n }\n return d3_transition(subgroups, this.namespace, this.id);\n };\n d3_transitionPrototype.tween = function(name2, tween) {\n var id = this.id, ns = this.namespace;\n if (arguments.length < 2) return this.node()[ns][id].tween.get(name2);\n return d3_selection_each(this, tween == null ? function(node) {\n node[ns][id].tween.remove(name2);\n } : function(node) {\n node[ns][id].tween.set(name2, tween);\n });\n };\n function d3_transition_tween(groups, name2, value, tween) {\n var id = groups.id, ns = groups.namespace;\n return d3_selection_each(groups, typeof value === \"function\" ? function(node, i, j) {\n node[ns][id].tween.set(name2, tween(value.call(node, node.__data__, i, j)));\n } : (value = tween(value), function(node) {\n node[ns][id].tween.set(name2, value);\n }));\n }\n d3_transitionPrototype.attr = function(nameNS, value) {\n if (arguments.length < 2) {\n for (value in nameNS) this.attr(value, nameNS[value]);\n return this;\n }\n var interpolate = nameNS == \"transform\" ? d3_interpolateTransform : d3_interpolate, name2 = d3.ns.qualify(nameNS);\n function attrNull() {\n this.removeAttribute(name2);\n }\n function attrNullNS() {\n this.removeAttributeNS(name2.space, name2.local);\n }\n function attrTween(b) {\n return b == null ? attrNull : (b += \"\", function() {\n var a = this.getAttribute(name2), i;\n return a !== b && (i = interpolate(a, b), function(t) {\n this.setAttribute(name2, i(t));\n });\n });\n }\n function attrTweenNS(b) {\n return b == null ? attrNullNS : (b += \"\", function() {\n var a = this.getAttributeNS(name2.space, name2.local), i;\n return a !== b && (i = interpolate(a, b), function(t) {\n this.setAttributeNS(name2.space, name2.local, i(t));\n });\n });\n }\n return d3_transition_tween(this, \"attr.\" + nameNS, value, name2.local ? attrTweenNS : attrTween);\n };\n d3_transitionPrototype.attrTween = function(nameNS, tween) {\n var name2 = d3.ns.qualify(nameNS);\n function attrTween(d, i) {\n var f = tween.call(this, d, i, this.getAttribute(name2));\n return f && function(t) {\n this.setAttribute(name2, f(t));\n };\n }\n function attrTweenNS(d, i) {\n var f = tween.call(this, d, i, this.getAttributeNS(name2.space, name2.local));\n return f && function(t) {\n this.setAttributeNS(name2.space, name2.local, f(t));\n };\n }\n return this.tween(\"attr.\" + nameNS, name2.local ? attrTweenNS : attrTween);\n };\n d3_transitionPrototype.style = function(name2, value, priority) {\n var n = arguments.length;\n if (n < 3) {\n if (typeof name2 !== \"string\") {\n if (n < 2) value = \"\";\n for (priority in name2) this.style(priority, name2[priority], value);\n return this;\n }\n priority = \"\";\n }\n function styleNull() {\n this.style.removeProperty(name2);\n }\n function styleString(b) {\n return b == null ? styleNull : (b += \"\", function() {\n var a = d3_window(this).getComputedStyle(this, null).getPropertyValue(name2), i;\n return a !== b && (i = d3_interpolate(a, b), function(t) {\n this.style.setProperty(name2, i(t), priority);\n });\n });\n }\n return d3_transition_tween(this, \"style.\" + name2, value, styleString);\n };\n d3_transitionPrototype.styleTween = function(name2, tween, priority) {\n if (arguments.length < 3) priority = \"\";\n function styleTween(d, i) {\n var f = tween.call(this, d, i, d3_window(this).getComputedStyle(this, null).getPropertyValue(name2));\n return f && function(t) {\n this.style.setProperty(name2, f(t), priority);\n };\n }\n return this.tween(\"style.\" + name2, styleTween);\n };\n d3_transitionPrototype.text = function(value) {\n return d3_transition_tween(this, \"text\", value, d3_transition_text);\n };\n function d3_transition_text(b) {\n if (b == null) b = \"\";\n return function() {\n this.textContent = b;\n };\n }\n d3_transitionPrototype.remove = function() {\n var ns = this.namespace;\n return this.each(\"end.transition\", function() {\n var p;\n if (this[ns].count < 2 && (p = this.parentNode)) p.removeChild(this);\n });\n };\n d3_transitionPrototype.ease = function(value) {\n var id = this.id, ns = this.namespace;\n if (arguments.length < 1) return this.node()[ns][id].ease;\n if (typeof value !== \"function\") value = d3.ease.apply(d3, arguments);\n return d3_selection_each(this, function(node) {\n node[ns][id].ease = value;\n });\n };\n d3_transitionPrototype.delay = function(value) {\n var id = this.id, ns = this.namespace;\n if (arguments.length < 1) return this.node()[ns][id].delay;\n return d3_selection_each(this, typeof value === \"function\" ? function(node, i, j) {\n node[ns][id].delay = +value.call(node, node.__data__, i, j);\n } : (value = +value, function(node) {\n node[ns][id].delay = value;\n }));\n };\n d3_transitionPrototype.duration = function(value) {\n var id = this.id, ns = this.namespace;\n if (arguments.length < 1) return this.node()[ns][id].duration;\n return d3_selection_each(this, typeof value === \"function\" ? function(node, i, j) {\n node[ns][id].duration = Math.max(1, value.call(node, node.__data__, i, j));\n } : (value = Math.max(1, value), function(node) {\n node[ns][id].duration = value;\n }));\n };\n d3_transitionPrototype.each = function(type, listener) {\n var id = this.id, ns = this.namespace;\n if (arguments.length < 2) {\n var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId;\n try {\n d3_transitionInheritId = id;\n d3_selection_each(this, function(node, i, j) {\n d3_transitionInherit = node[ns][id];\n type.call(node, node.__data__, i, j);\n });\n } finally {\n d3_transitionInherit = inherit;\n d3_transitionInheritId = inheritId;\n }\n } else {\n d3_selection_each(this, function(node) {\n var transition = node[ns][id];\n (transition.event || (transition.event = d3.dispatch(\"start\", \"end\", \"interrupt\"))).on(type, listener);\n });\n }\n return this;\n };\n d3_transitionPrototype.transition = function() {\n var id0 = this.id, id1 = ++d3_transitionId, ns = this.namespace, subgroups = [], subgroup, group, node, transition;\n for (var j = 0, m = this.length; j < m; j++) {\n subgroups.push(subgroup = []);\n for (var group = this[j], i = 0, n = group.length; i < n; i++) {\n if (node = group[i]) {\n transition = node[ns][id0];\n d3_transitionNode(node, i, ns, id1, {\n time: transition.time,\n ease: transition.ease,\n delay: transition.delay + transition.duration,\n duration: transition.duration\n });\n }\n subgroup.push(node);\n }\n }\n return d3_transition(subgroups, ns, id1);\n };\n function d3_transitionNamespace(name2) {\n return name2 == null ? \"__transition__\" : \"__transition_\" + name2 + \"__\";\n }\n function d3_transitionNode(node, i, ns, id, inherit) {\n var lock = node[ns] || (node[ns] = {\n active: 0,\n count: 0\n }), transition = lock[id], time, timer, duration, ease, tweens;\n function schedule(elapsed) {\n var delay = transition.delay;\n timer.t = delay + time;\n if (delay <= elapsed) return start(elapsed - delay);\n timer.c = start;\n }\n function start(elapsed) {\n var activeId = lock.active, active = lock[activeId];\n if (active) {\n active.timer.c = null;\n active.timer.t = NaN;\n --lock.count;\n delete lock[activeId];\n active.event && active.event.interrupt.call(node, node.__data__, active.index);\n }\n for (var cancelId in lock) {\n if (+cancelId < id) {\n var cancel = lock[cancelId];\n cancel.timer.c = null;\n cancel.timer.t = NaN;\n --lock.count;\n delete lock[cancelId];\n }\n }\n timer.c = tick;\n d3_timer(function() {\n if (timer.c && tick(elapsed || 1)) {\n timer.c = null;\n timer.t = NaN;\n }\n return 1;\n }, 0, time);\n lock.active = id;\n transition.event && transition.event.start.call(node, node.__data__, i);\n tweens = [];\n transition.tween.forEach(function(key, value) {\n if (value = value.call(node, node.__data__, i)) {\n tweens.push(value);\n }\n });\n ease = transition.ease;\n duration = transition.duration;\n }\n function tick(elapsed) {\n var t = elapsed / duration, e = ease(t), n = tweens.length;\n while (n > 0) {\n tweens[--n].call(node, e);\n }\n if (t >= 1) {\n transition.event && transition.event.end.call(node, node.__data__, i);\n if (--lock.count) delete lock[id];\n else delete node[ns];\n return 1;\n }\n }\n if (!transition) {\n time = inherit.time;\n timer = d3_timer(schedule, 0, time);\n transition = lock[id] = {\n tween: new d3_Map(),\n time,\n timer,\n delay: inherit.delay,\n duration: inherit.duration,\n ease: inherit.ease,\n index: i\n };\n inherit = null;\n ++lock.count;\n }\n }\n d3.svg.axis = function() {\n var scale = d3.scale.linear(), orient = d3_svg_axisDefaultOrient, innerTickSize = 6, outerTickSize = 6, tickPadding = 3, tickArguments_ = [10], tickValues = null, tickFormat_;\n function axis(g) {\n g.each(function() {\n var g2 = d3.select(this);\n var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = scale.copy();\n var ticks = tickValues == null ? scale1.ticks ? scale1.ticks.apply(scale1, tickArguments_) : scale1.domain() : tickValues, tickFormat = tickFormat_ == null ? scale1.tickFormat ? scale1.tickFormat.apply(scale1, tickArguments_) : d3_identity : tickFormat_, tick = g2.selectAll(\".tick\").data(ticks, scale1), tickEnter = tick.enter().insert(\"g\", \".domain\").attr(\"class\", \"tick\").style(\"opacity\", \\u03B5), tickExit = d3.transition(tick.exit()).style(\"opacity\", \\u03B5).remove(), tickUpdate = d3.transition(tick.order()).style(\"opacity\", 1), tickSpacing = Math.max(innerTickSize, 0) + tickPadding, tickTransform;\n var range = d3_scaleRange(scale1), path = g2.selectAll(\".domain\").data([0]), pathUpdate = (path.enter().append(\"path\").attr(\"class\", \"domain\"), d3.transition(path));\n tickEnter.append(\"line\");\n tickEnter.append(\"text\");\n var lineEnter = tickEnter.select(\"line\"), lineUpdate = tickUpdate.select(\"line\"), text = tick.select(\"text\").text(tickFormat), textEnter = tickEnter.select(\"text\"), textUpdate = tickUpdate.select(\"text\"), sign = orient === \"top\" || orient === \"left\" ? -1 : 1, x1, x2, y1, y2;\n if (orient === \"bottom\" || orient === \"top\") {\n tickTransform = d3_svg_axisX, x1 = \"x\", y1 = \"y\", x2 = \"x2\", y2 = \"y2\";\n text.attr(\"dy\", sign < 0 ? \"0em\" : \".71em\").style(\"text-anchor\", \"middle\");\n pathUpdate.attr(\"d\", \"M\" + range[0] + \",\" + sign * outerTickSize + \"V0H\" + range[1] + \"V\" + sign * outerTickSize);\n } else {\n tickTransform = d3_svg_axisY, x1 = \"y\", y1 = \"x\", x2 = \"y2\", y2 = \"x2\";\n text.attr(\"dy\", \".32em\").style(\"text-anchor\", sign < 0 ? \"end\" : \"start\");\n pathUpdate.attr(\"d\", \"M\" + sign * outerTickSize + \",\" + range[0] + \"H0V\" + range[1] + \"H\" + sign * outerTickSize);\n }\n lineEnter.attr(y2, sign * innerTickSize);\n textEnter.attr(y1, sign * tickSpacing);\n lineUpdate.attr(x2, 0).attr(y2, sign * innerTickSize);\n textUpdate.attr(x1, 0).attr(y1, sign * tickSpacing);\n if (scale1.rangeBand) {\n var x = scale1, dx = x.rangeBand() / 2;\n scale0 = scale1 = function(d) {\n return x(d) + dx;\n };\n } else if (scale0.rangeBand) {\n scale0 = scale1;\n } else {\n tickExit.call(tickTransform, scale1, scale0);\n }\n tickEnter.call(tickTransform, scale0, scale1);\n tickUpdate.call(tickTransform, scale1, scale1);\n });\n }\n axis.scale = function(x) {\n if (!arguments.length) return scale;\n scale = x;\n return axis;\n };\n axis.orient = function(x) {\n if (!arguments.length) return orient;\n orient = x in d3_svg_axisOrients ? x + \"\" : d3_svg_axisDefaultOrient;\n return axis;\n };\n axis.ticks = function() {\n if (!arguments.length) return tickArguments_;\n tickArguments_ = d3_array(arguments);\n return axis;\n };\n axis.tickValues = function(x) {\n if (!arguments.length) return tickValues;\n tickValues = x;\n return axis;\n };\n axis.tickFormat = function(x) {\n if (!arguments.length) return tickFormat_;\n tickFormat_ = x;\n return axis;\n };\n axis.tickSize = function(x) {\n var n = arguments.length;\n if (!n) return innerTickSize;\n innerTickSize = +x;\n outerTickSize = +arguments[n - 1];\n return axis;\n };\n axis.innerTickSize = function(x) {\n if (!arguments.length) return innerTickSize;\n innerTickSize = +x;\n return axis;\n };\n axis.outerTickSize = function(x) {\n if (!arguments.length) return outerTickSize;\n outerTickSize = +x;\n return axis;\n };\n axis.tickPadding = function(x) {\n if (!arguments.length) return tickPadding;\n tickPadding = +x;\n return axis;\n };\n axis.tickSubdivide = function() {\n return arguments.length && axis;\n };\n return axis;\n };\n var d3_svg_axisDefaultOrient = \"bottom\", d3_svg_axisOrients = {\n top: 1,\n right: 1,\n bottom: 1,\n left: 1\n };\n function d3_svg_axisX(selection, x0, x1) {\n selection.attr(\"transform\", function(d) {\n var v0 = x0(d);\n return \"translate(\" + (isFinite(v0) ? v0 : x1(d)) + \",0)\";\n });\n }\n function d3_svg_axisY(selection, y0, y1) {\n selection.attr(\"transform\", function(d) {\n var v0 = y0(d);\n return \"translate(0,\" + (isFinite(v0) ? v0 : y1(d)) + \")\";\n });\n }\n d3.svg.brush = function() {\n var event = d3_eventDispatch(brush, \"brushstart\", \"brush\", \"brushend\"), x = null, y = null, xExtent = [0, 0], yExtent = [0, 0], xExtentDomain, yExtentDomain, xClamp = true, yClamp = true, resizes = d3_svg_brushResizes[0];\n function brush(g) {\n g.each(function() {\n var g2 = d3.select(this).style(\"pointer-events\", \"all\").style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\").on(\"mousedown.brush\", brushstart).on(\"touchstart.brush\", brushstart);\n var background = g2.selectAll(\".background\").data([0]);\n background.enter().append(\"rect\").attr(\"class\", \"background\").style(\"visibility\", \"hidden\").style(\"cursor\", \"crosshair\");\n g2.selectAll(\".extent\").data([0]).enter().append(\"rect\").attr(\"class\", \"extent\").style(\"cursor\", \"move\");\n var resize = g2.selectAll(\".resize\").data(resizes, d3_identity);\n resize.exit().remove();\n resize.enter().append(\"g\").attr(\"class\", function(d) {\n return \"resize \" + d;\n }).style(\"cursor\", function(d) {\n return d3_svg_brushCursor[d];\n }).append(\"rect\").attr(\"x\", function(d) {\n return /[ew]$/.test(d) ? -3 : null;\n }).attr(\"y\", function(d) {\n return /^[ns]/.test(d) ? -3 : null;\n }).attr(\"width\", 6).attr(\"height\", 6).style(\"visibility\", \"hidden\");\n resize.style(\"display\", brush.empty() ? \"none\" : null);\n var gUpdate = d3.transition(g2), backgroundUpdate = d3.transition(background), range;\n if (x) {\n range = d3_scaleRange(x);\n backgroundUpdate.attr(\"x\", range[0]).attr(\"width\", range[1] - range[0]);\n redrawX(gUpdate);\n }\n if (y) {\n range = d3_scaleRange(y);\n backgroundUpdate.attr(\"y\", range[0]).attr(\"height\", range[1] - range[0]);\n redrawY(gUpdate);\n }\n redraw(gUpdate);\n });\n }\n brush.event = function(g) {\n g.each(function() {\n var event_ = event.of(this, arguments), extent1 = {\n x: xExtent,\n y: yExtent,\n i: xExtentDomain,\n j: yExtentDomain\n }, extent0 = this.__chart__ || extent1;\n this.__chart__ = extent1;\n if (d3_transitionInheritId) {\n d3.select(this).transition().each(\"start.brush\", function() {\n xExtentDomain = extent0.i;\n yExtentDomain = extent0.j;\n xExtent = extent0.x;\n yExtent = extent0.y;\n event_({\n type: \"brushstart\"\n });\n }).tween(\"brush:brush\", function() {\n var xi = d3_interpolateArray(xExtent, extent1.x), yi = d3_interpolateArray(yExtent, extent1.y);\n xExtentDomain = yExtentDomain = null;\n return function(t) {\n xExtent = extent1.x = xi(t);\n yExtent = extent1.y = yi(t);\n event_({\n type: \"brush\",\n mode: \"resize\"\n });\n };\n }).each(\"end.brush\", function() {\n xExtentDomain = extent1.i;\n yExtentDomain = extent1.j;\n event_({\n type: \"brush\",\n mode: \"resize\"\n });\n event_({\n type: \"brushend\"\n });\n });\n } else {\n event_({\n type: \"brushstart\"\n });\n event_({\n type: \"brush\",\n mode: \"resize\"\n });\n event_({\n type: \"brushend\"\n });\n }\n });\n };\n function redraw(g) {\n g.selectAll(\".resize\").attr(\"transform\", function(d) {\n return \"translate(\" + xExtent[+/e$/.test(d)] + \",\" + yExtent[+/^s/.test(d)] + \")\";\n });\n }\n function redrawX(g) {\n g.select(\".extent\").attr(\"x\", xExtent[0]);\n g.selectAll(\".extent,.n>rect,.s>rect\").attr(\"width\", xExtent[1] - xExtent[0]);\n }\n function redrawY(g) {\n g.select(\".extent\").attr(\"y\", yExtent[0]);\n g.selectAll(\".extent,.e>rect,.w>rect\").attr(\"height\", yExtent[1] - yExtent[0]);\n }\n function brushstart() {\n var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed(\"extent\"), dragRestore = d3_event_dragSuppress(target), center, origin = d3.mouse(target), offset;\n var w = d3.select(d3_window(target)).on(\"keydown.brush\", keydown).on(\"keyup.brush\", keyup);\n if (d3.event.changedTouches) {\n w.on(\"touchmove.brush\", brushmove).on(\"touchend.brush\", brushend);\n } else {\n w.on(\"mousemove.brush\", brushmove).on(\"mouseup.brush\", brushend);\n }\n g.interrupt().selectAll(\"*\").interrupt();\n if (dragging) {\n origin[0] = xExtent[0] - origin[0];\n origin[1] = yExtent[0] - origin[1];\n } else if (resizing) {\n var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing);\n offset = [xExtent[1 - ex] - origin[0], yExtent[1 - ey] - origin[1]];\n origin[0] = xExtent[ex];\n origin[1] = yExtent[ey];\n } else if (d3.event.altKey) center = origin.slice();\n g.style(\"pointer-events\", \"none\").selectAll(\".resize\").style(\"display\", null);\n d3.select(\"body\").style(\"cursor\", eventTarget.style(\"cursor\"));\n event_({\n type: \"brushstart\"\n });\n brushmove();\n function keydown() {\n if (d3.event.keyCode == 32) {\n if (!dragging) {\n center = null;\n origin[0] -= xExtent[1];\n origin[1] -= yExtent[1];\n dragging = 2;\n }\n d3_eventPreventDefault();\n }\n }\n function keyup() {\n if (d3.event.keyCode == 32 && dragging == 2) {\n origin[0] += xExtent[1];\n origin[1] += yExtent[1];\n dragging = 0;\n d3_eventPreventDefault();\n }\n }\n function brushmove() {\n var point = d3.mouse(target), moved = false;\n if (offset) {\n point[0] += offset[0];\n point[1] += offset[1];\n }\n if (!dragging) {\n if (d3.event.altKey) {\n if (!center) center = [(xExtent[0] + xExtent[1]) / 2, (yExtent[0] + yExtent[1]) / 2];\n origin[0] = xExtent[+(point[0] < center[0])];\n origin[1] = yExtent[+(point[1] < center[1])];\n } else center = null;\n }\n if (resizingX && move1(point, x, 0)) {\n redrawX(g);\n moved = true;\n }\n if (resizingY && move1(point, y, 1)) {\n redrawY(g);\n moved = true;\n }\n if (moved) {\n redraw(g);\n event_({\n type: \"brush\",\n mode: dragging ? \"move\" : \"resize\"\n });\n }\n }\n function move1(point, scale, i) {\n var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], extent = i ? yExtent : xExtent, size = extent[1] - extent[0], min, max;\n if (dragging) {\n r0 -= position;\n r1 -= size + position;\n }\n min = (i ? yClamp : xClamp) ? Math.max(r0, Math.min(r1, point[i])) : point[i];\n if (dragging) {\n max = (min += position) + size;\n } else {\n if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));\n if (position < min) {\n max = min;\n min = position;\n } else {\n max = position;\n }\n }\n if (extent[0] != min || extent[1] != max) {\n if (i) yExtentDomain = null;\n else xExtentDomain = null;\n extent[0] = min;\n extent[1] = max;\n return true;\n }\n }\n function brushend() {\n brushmove();\n g.style(\"pointer-events\", \"all\").selectAll(\".resize\").style(\"display\", brush.empty() ? \"none\" : null);\n d3.select(\"body\").style(\"cursor\", null);\n w.on(\"mousemove.brush\", null).on(\"mouseup.brush\", null).on(\"touchmove.brush\", null).on(\"touchend.brush\", null).on(\"keydown.brush\", null).on(\"keyup.brush\", null);\n dragRestore();\n event_({\n type: \"brushend\"\n });\n }\n }\n brush.x = function(z) {\n if (!arguments.length) return x;\n x = z;\n resizes = d3_svg_brushResizes[!x << 1 | !y];\n return brush;\n };\n brush.y = function(z) {\n if (!arguments.length) return y;\n y = z;\n resizes = d3_svg_brushResizes[!x << 1 | !y];\n return brush;\n };\n brush.clamp = function(z) {\n if (!arguments.length) return x && y ? [xClamp, yClamp] : x ? xClamp : y ? yClamp : null;\n if (x && y) xClamp = !!z[0], yClamp = !!z[1];\n else if (x) xClamp = !!z;\n else if (y) yClamp = !!z;\n return brush;\n };\n brush.extent = function(z) {\n var x0, x1, y0, y1, t;\n if (!arguments.length) {\n if (x) {\n if (xExtentDomain) {\n x0 = xExtentDomain[0], x1 = xExtentDomain[1];\n } else {\n x0 = xExtent[0], x1 = xExtent[1];\n if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);\n if (x1 < x0) t = x0, x0 = x1, x1 = t;\n }\n }\n if (y) {\n if (yExtentDomain) {\n y0 = yExtentDomain[0], y1 = yExtentDomain[1];\n } else {\n y0 = yExtent[0], y1 = yExtent[1];\n if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);\n if (y1 < y0) t = y0, y0 = y1, y1 = t;\n }\n }\n return x && y ? [[x0, y0], [x1, y1]] : x ? [x0, x1] : y && [y0, y1];\n }\n if (x) {\n x0 = z[0], x1 = z[1];\n if (y) x0 = x0[0], x1 = x1[0];\n xExtentDomain = [x0, x1];\n if (x.invert) x0 = x(x0), x1 = x(x1);\n if (x1 < x0) t = x0, x0 = x1, x1 = t;\n if (x0 != xExtent[0] || x1 != xExtent[1]) xExtent = [x0, x1];\n }\n if (y) {\n y0 = z[0], y1 = z[1];\n if (x) y0 = y0[1], y1 = y1[1];\n yExtentDomain = [y0, y1];\n if (y.invert) y0 = y(y0), y1 = y(y1);\n if (y1 < y0) t = y0, y0 = y1, y1 = t;\n if (y0 != yExtent[0] || y1 != yExtent[1]) yExtent = [y0, y1];\n }\n return brush;\n };\n brush.clear = function() {\n if (!brush.empty()) {\n xExtent = [0, 0], yExtent = [0, 0];\n xExtentDomain = yExtentDomain = null;\n }\n return brush;\n };\n brush.empty = function() {\n return !!x && xExtent[0] == xExtent[1] || !!y && yExtent[0] == yExtent[1];\n };\n return d3.rebind(brush, event, \"on\");\n };\n var d3_svg_brushCursor = {\n n: \"ns-resize\",\n e: \"ew-resize\",\n s: \"ns-resize\",\n w: \"ew-resize\",\n nw: \"nwse-resize\",\n ne: \"nesw-resize\",\n se: \"nwse-resize\",\n sw: \"nesw-resize\"\n };\n var d3_svg_brushResizes = [[\"n\", \"e\", \"s\", \"w\", \"nw\", \"ne\", \"se\", \"sw\"], [\"e\", \"w\"], [\"n\", \"s\"], []];\n d3.text = d3_xhrType(function(request) {\n return request.responseText;\n });\n d3.json = function(url, callback) {\n return d3_xhr(url, \"application/json\", d3_json, callback);\n };\n function d3_json(request) {\n return JSON.parse(request.responseText);\n }\n d3.html = function(url, callback) {\n return d3_xhr(url, \"text/html\", d3_html, callback);\n };\n function d3_html(request) {\n var range = d3_document.createRange();\n range.selectNode(d3_document.body);\n return range.createContextualFragment(request.responseText);\n }\n d3.xml = d3_xhrType(function(request) {\n return request.responseXML;\n });\n if (typeof define === \"function\" && false) define(d3);\n else if (typeof module === \"object\" && module.exports) module.exports = d3;\n else this.d3 = d3;\n }.apply(self);\n }\n });\n\n // node_modules/d3-time/dist/d3-time.js\n var require_d3_time = __commonJS({\n \"node_modules/d3-time/dist/d3-time.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports) : typeof define === \"function\" && false ? define([\"exports\"], factory) : (global2 = global2 || self, factory(global2.d3 = global2.d3 || {}));\n })(exports, function(exports2) {\n \"use strict\";\n var t02 = /* @__PURE__ */ new Date(), t12 = /* @__PURE__ */ new Date();\n function newInterval(floori, offseti, count, field) {\n function interval(date) {\n return floori(date = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+date)), date;\n }\n interval.floor = function(date) {\n return floori(date = /* @__PURE__ */ new Date(+date)), date;\n };\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;\n };\n interval.round = function(date) {\n var d0 = interval(date), d1 = interval.ceil(date);\n return date - d0 < d1 - date ? d0 : d1;\n };\n interval.offset = function(date, step) {\n return offseti(date = /* @__PURE__ */ new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n interval.range = function(start, stop, step) {\n var range = [], previous;\n start = interval.ceil(start);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range;\n do\n range.push(previous = /* @__PURE__ */ new Date(+start)), offseti(start, step), floori(start);\n while (previous < start && start < stop);\n return range;\n };\n interval.filter = function(test) {\n return newInterval(function(date) {\n if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n if (date >= date) {\n if (step < 0) while (++step <= 0) {\n while (offseti(date, -1), !test(date)) {\n }\n }\n else while (--step >= 0) {\n while (offseti(date, 1), !test(date)) {\n }\n }\n }\n });\n };\n if (count) {\n interval.count = function(start, end) {\n t02.setTime(+start), t12.setTime(+end);\n floori(t02), floori(t12);\n return Math.floor(count(t02, t12));\n };\n interval.every = function(step) {\n step = Math.floor(step);\n return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? function(d) {\n return field(d) % step === 0;\n } : function(d) {\n return interval.count(0, d) % step === 0;\n });\n };\n }\n return interval;\n }\n var millisecond = newInterval(function() {\n }, function(date, step) {\n date.setTime(+date + step);\n }, function(start, end) {\n return end - start;\n });\n millisecond.every = function(k) {\n k = Math.floor(k);\n if (!isFinite(k) || !(k > 0)) return null;\n if (!(k > 1)) return millisecond;\n return newInterval(function(date) {\n date.setTime(Math.floor(date / k) * k);\n }, function(date, step) {\n date.setTime(+date + step * k);\n }, function(start, end) {\n return (end - start) / k;\n });\n };\n var milliseconds = millisecond.range;\n var durationSecond = 1e3;\n var durationMinute = 6e4;\n var durationHour = 36e5;\n var durationDay = 864e5;\n var durationWeek = 6048e5;\n var second = newInterval(function(date) {\n date.setTime(date - date.getMilliseconds());\n }, function(date, step) {\n date.setTime(+date + step * durationSecond);\n }, function(start, end) {\n return (end - start) / durationSecond;\n }, function(date) {\n return date.getUTCSeconds();\n });\n var seconds = second.range;\n var minute = newInterval(function(date) {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);\n }, function(date, step) {\n date.setTime(+date + step * durationMinute);\n }, function(start, end) {\n return (end - start) / durationMinute;\n }, function(date) {\n return date.getMinutes();\n });\n var minutes = minute.range;\n var hour = newInterval(function(date) {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);\n }, function(date, step) {\n date.setTime(+date + step * durationHour);\n }, function(start, end) {\n return (end - start) / durationHour;\n }, function(date) {\n return date.getHours();\n });\n var hours = hour.range;\n var day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay;\n }, function(date) {\n return date.getDate() - 1;\n });\n var days = day.range;\n function weekday(i) {\n return newInterval(function(date) {\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;\n });\n }\n var sunday = weekday(0);\n var monday = weekday(1);\n var tuesday = weekday(2);\n var wednesday = weekday(3);\n var thursday = weekday(4);\n var friday = weekday(5);\n var saturday = weekday(6);\n var sundays = sunday.range;\n var mondays = monday.range;\n var tuesdays = tuesday.range;\n var wednesdays = wednesday.range;\n var thursdays = thursday.range;\n var fridays = friday.range;\n var saturdays = saturday.range;\n var month = newInterval(function(date) {\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setMonth(date.getMonth() + step);\n }, function(start, end) {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n }, function(date) {\n return date.getMonth();\n });\n var months = month.range;\n var year = newInterval(function(date) {\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n }, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n }, function(date) {\n return date.getFullYear();\n });\n year.every = function(k) {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {\n date.setFullYear(Math.floor(date.getFullYear() / k) * k);\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step * k);\n });\n };\n var years = year.range;\n var utcMinute = newInterval(function(date) {\n date.setUTCSeconds(0, 0);\n }, function(date, step) {\n date.setTime(+date + step * durationMinute);\n }, function(start, end) {\n return (end - start) / durationMinute;\n }, function(date) {\n return date.getUTCMinutes();\n });\n var utcMinutes = utcMinute.range;\n var utcHour = newInterval(function(date) {\n date.setUTCMinutes(0, 0, 0);\n }, function(date, step) {\n date.setTime(+date + step * durationHour);\n }, function(start, end) {\n return (end - start) / durationHour;\n }, function(date) {\n return date.getUTCHours();\n });\n var utcHours = utcHour.range;\n var utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n }, function(start, end) {\n return (end - start) / durationDay;\n }, function(date) {\n return date.getUTCDate() - 1;\n });\n var utcDays = utcDay.range;\n function utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / durationWeek;\n });\n }\n var utcSunday = utcWeekday(0);\n var utcMonday = utcWeekday(1);\n var utcTuesday = utcWeekday(2);\n var utcWednesday = utcWeekday(3);\n var utcThursday = utcWeekday(4);\n var utcFriday = utcWeekday(5);\n var utcSaturday = utcWeekday(6);\n var utcSundays = utcSunday.range;\n var utcMondays = utcMonday.range;\n var utcTuesdays = utcTuesday.range;\n var utcWednesdays = utcWednesday.range;\n var utcThursdays = utcThursday.range;\n var utcFridays = utcFriday.range;\n var utcSaturdays = utcSaturday.range;\n var utcMonth = newInterval(function(date) {\n date.setUTCDate(1);\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCMonth(date.getUTCMonth() + step);\n }, function(start, end) {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n }, function(date) {\n return date.getUTCMonth();\n });\n var utcMonths = utcMonth.range;\n var utcYear = newInterval(function(date) {\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n }, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n }, function(date) {\n return date.getUTCFullYear();\n });\n utcYear.every = function(k) {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {\n date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step * k);\n });\n };\n var utcYears = utcYear.range;\n exports2.timeDay = day;\n exports2.timeDays = days;\n exports2.timeFriday = friday;\n exports2.timeFridays = fridays;\n exports2.timeHour = hour;\n exports2.timeHours = hours;\n exports2.timeInterval = newInterval;\n exports2.timeMillisecond = millisecond;\n exports2.timeMilliseconds = milliseconds;\n exports2.timeMinute = minute;\n exports2.timeMinutes = minutes;\n exports2.timeMonday = monday;\n exports2.timeMondays = mondays;\n exports2.timeMonth = month;\n exports2.timeMonths = months;\n exports2.timeSaturday = saturday;\n exports2.timeSaturdays = saturdays;\n exports2.timeSecond = second;\n exports2.timeSeconds = seconds;\n exports2.timeSunday = sunday;\n exports2.timeSundays = sundays;\n exports2.timeThursday = thursday;\n exports2.timeThursdays = thursdays;\n exports2.timeTuesday = tuesday;\n exports2.timeTuesdays = tuesdays;\n exports2.timeWednesday = wednesday;\n exports2.timeWednesdays = wednesdays;\n exports2.timeWeek = sunday;\n exports2.timeWeeks = sundays;\n exports2.timeYear = year;\n exports2.timeYears = years;\n exports2.utcDay = utcDay;\n exports2.utcDays = utcDays;\n exports2.utcFriday = utcFriday;\n exports2.utcFridays = utcFridays;\n exports2.utcHour = utcHour;\n exports2.utcHours = utcHours;\n exports2.utcMillisecond = millisecond;\n exports2.utcMilliseconds = milliseconds;\n exports2.utcMinute = utcMinute;\n exports2.utcMinutes = utcMinutes;\n exports2.utcMonday = utcMonday;\n exports2.utcMondays = utcMondays;\n exports2.utcMonth = utcMonth;\n exports2.utcMonths = utcMonths;\n exports2.utcSaturday = utcSaturday;\n exports2.utcSaturdays = utcSaturdays;\n exports2.utcSecond = second;\n exports2.utcSeconds = seconds;\n exports2.utcSunday = utcSunday;\n exports2.utcSundays = utcSundays;\n exports2.utcThursday = utcThursday;\n exports2.utcThursdays = utcThursdays;\n exports2.utcTuesday = utcTuesday;\n exports2.utcTuesdays = utcTuesdays;\n exports2.utcWednesday = utcWednesday;\n exports2.utcWednesdays = utcWednesdays;\n exports2.utcWeek = utcSunday;\n exports2.utcWeeks = utcSundays;\n exports2.utcYear = utcYear;\n exports2.utcYears = utcYears;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // node_modules/d3-time-format/dist/d3-time-format.js\n var require_d3_time_format = __commonJS({\n \"node_modules/d3-time-format/dist/d3-time-format.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports, require_d3_time()) : typeof define === \"function\" && false ? define([\"exports\", \"d3-time\"], factory) : (global2 = global2 || self, factory(global2.d3 = global2.d3 || {}, global2.d3));\n })(exports, function(exports2, d3Time) {\n \"use strict\";\n function localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n }\n function utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n }\n function newDate(y, m, d) {\n return { y, m, d, H: 0, M: 0, S: 0, L: 0 };\n }\n function formatLocale(locale2) {\n var locale_dateTime = locale2.dateTime, locale_date = locale2.date, locale_time = locale2.time, locale_periods = locale2.periods, locale_weekdays = locale2.days, locale_shortWeekdays = locale2.shortDays, locale_months = locale2.months, locale_shortMonths = locale2.shortMonths;\n var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths);\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"f\": formatMicroseconds,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"q\": formatQuarter,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatSeconds,\n \"u\": formatWeekdayNumberMonday,\n \"U\": formatWeekNumberSunday,\n \"V\": formatWeekNumberISO,\n \"w\": formatWeekdayNumberSunday,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"f\": formatUTCMicroseconds,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"q\": formatUTCQuarter,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatUTCSeconds,\n \"u\": formatUTCWeekdayNumberMonday,\n \"U\": formatUTCWeekNumberSunday,\n \"V\": formatUTCWeekNumberISO,\n \"w\": formatUTCWeekdayNumberSunday,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"f\": parseMicroseconds,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"q\": parseQuarter,\n \"Q\": parseUnixTimestamp,\n \"s\": parseUnixTimestampSeconds,\n \"S\": parseSeconds,\n \"u\": parseWeekdayNumberMonday,\n \"U\": parseWeekNumberSunday,\n \"V\": parseWeekNumberISO,\n \"w\": parseWeekdayNumberSunday,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n function newFormat(specifier, formats2) {\n return function(date) {\n var string = [], i = -1, j = 0, n = specifier.length, c, pad2, format;\n if (!(date instanceof Date)) date = /* @__PURE__ */ new Date(+date);\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad2 = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n else pad2 = c === \"e\" ? \" \" : \"0\";\n if (format = formats2[c]) c = format(date, pad2);\n string.push(c);\n j = i + 1;\n }\n }\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n function newParse(specifier, Z) {\n return function(string) {\n var d = newDate(1900, void 0, 1), i = parseSpecifier(d, specifier, string += \"\", 0), week, day;\n if (i != string.length) return null;\n if (\"Q\" in d) return new Date(d.Q);\n if (\"s\" in d) return new Date(d.s * 1e3 + (\"L\" in d ? d.L : 0));\n if (Z && !(\"Z\" in d)) d.Z = 0;\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n if (d.m === void 0) d.m = \"q\" in d ? d.q : 0;\n if (\"V\" in d) {\n if (d.V < 1 || d.V > 53) return null;\n if (!(\"w\" in d)) d.w = 1;\n if (\"Z\" in d) {\n week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay();\n week = day > 4 || day === 0 ? d3Time.utcMonday.ceil(week) : d3Time.utcMonday(week);\n week = d3Time.utcDay.offset(week, (d.V - 1) * 7);\n d.y = week.getUTCFullYear();\n d.m = week.getUTCMonth();\n d.d = week.getUTCDate() + (d.w + 6) % 7;\n } else {\n week = localDate(newDate(d.y, 0, 1)), day = week.getDay();\n week = day > 4 || day === 0 ? d3Time.timeMonday.ceil(week) : d3Time.timeMonday(week);\n week = d3Time.timeDay.offset(week, (d.V - 1) * 7);\n d.y = week.getFullYear();\n d.m = week.getMonth();\n d.d = week.getDate() + (d.w + 6) % 7;\n }\n } else if (\"W\" in d || \"U\" in d) {\n if (!(\"w\" in d)) d.w = \"u\" in d ? d.u % 7 : \"W\" in d ? 1 : 0;\n day = \"Z\" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();\n d.m = 0;\n d.d = \"W\" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;\n }\n if (\"Z\" in d) {\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n return localDate(d);\n };\n }\n function parseSpecifier(d, specifier, string, j) {\n var i = 0, n = specifier.length, m = string.length, c, parse2;\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse2 = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse2 || (j = parse2(d, string, j)) < 0) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n return j;\n }\n function parsePeriod(d, string, i) {\n var n = periodRe.exec(string.slice(i));\n return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n function formatQuarter(d) {\n return 1 + ~~(d.getMonth() / 3);\n }\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n function formatUTCQuarter(d) {\n return 1 + ~~(d.getUTCMonth() / 3);\n }\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.toString = function() {\n return specifier;\n };\n return f;\n },\n parse: function(specifier) {\n var p = newParse(specifier += \"\", false);\n p.toString = function() {\n return specifier;\n };\n return p;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.toString = function() {\n return specifier;\n };\n return f;\n },\n utcParse: function(specifier) {\n var p = newParse(specifier += \"\", true);\n p.toString = function() {\n return specifier;\n };\n return p;\n }\n };\n }\n var pads = { \"-\": \"\", \"_\": \" \", \"0\": \"0\" }, numberRe = /^\\s*\\d+/, percentRe = /^%/, requoteRe = /[\\\\^$*+?|[\\]().{}]/g;\n function pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\", string = (sign ? -value : value) + \"\", length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n }\n function requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n }\n function formatRe(names2) {\n return new RegExp(\"^(?:\" + names2.map(requote).join(\"|\") + \")\", \"i\");\n }\n function formatLookup(names2) {\n var map = {}, i = -1, n = names2.length;\n while (++i < n) map[names2[i].toLowerCase()] = i;\n return map;\n }\n function parseWeekdayNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n }\n function parseWeekdayNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.u = +n[0], i + n[0].length) : -1;\n }\n function parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n }\n function parseWeekNumberISO(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.V = +n[0], i + n[0].length) : -1;\n }\n function parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n }\n function parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n }\n function parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2e3), i + n[0].length) : -1;\n }\n function parseZone(d, string, i) {\n var n = /^(Z)|([+-]\\d\\d)(?::?(\\d\\d))?/.exec(string.slice(i, i + 6));\n return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || \"00\")), i + n[0].length) : -1;\n }\n function parseQuarter(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;\n }\n function parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n }\n function parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n }\n function parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n }\n function parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n }\n function parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n }\n function parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n }\n function parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n }\n function parseMicroseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 6));\n return n ? (d.L = Math.floor(n[0] / 1e3), i + n[0].length) : -1;\n }\n function parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n }\n function parseUnixTimestamp(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.Q = +n[0], i + n[0].length) : -1;\n }\n function parseUnixTimestampSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.s = +n[0], i + n[0].length) : -1;\n }\n function formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n }\n function formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n }\n function formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n }\n function formatDayOfYear(d, p) {\n return pad(1 + d3Time.timeDay.count(d3Time.timeYear(d), d), p, 3);\n }\n function formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n }\n function formatMicroseconds(d, p) {\n return formatMilliseconds(d, p) + \"000\";\n }\n function formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n }\n function formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n }\n function formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n }\n function formatWeekdayNumberMonday(d) {\n var day = d.getDay();\n return day === 0 ? 7 : day;\n }\n function formatWeekNumberSunday(d, p) {\n return pad(d3Time.timeSunday.count(d3Time.timeYear(d) - 1, d), p, 2);\n }\n function formatWeekNumberISO(d, p) {\n var day = d.getDay();\n d = day >= 4 || day === 0 ? d3Time.timeThursday(d) : d3Time.timeThursday.ceil(d);\n return pad(d3Time.timeThursday.count(d3Time.timeYear(d), d) + (d3Time.timeYear(d).getDay() === 4), p, 2);\n }\n function formatWeekdayNumberSunday(d) {\n return d.getDay();\n }\n function formatWeekNumberMonday(d, p) {\n return pad(d3Time.timeMonday.count(d3Time.timeYear(d) - 1, d), p, 2);\n }\n function formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n }\n function formatFullYear(d, p) {\n return pad(d.getFullYear() % 1e4, p, 4);\n }\n function formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\")) + pad(z / 60 | 0, \"0\", 2) + pad(z % 60, \"0\", 2);\n }\n function formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n }\n function formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n }\n function formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n }\n function formatUTCDayOfYear(d, p) {\n return pad(1 + d3Time.utcDay.count(d3Time.utcYear(d), d), p, 3);\n }\n function formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n }\n function formatUTCMicroseconds(d, p) {\n return formatUTCMilliseconds(d, p) + \"000\";\n }\n function formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n }\n function formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n }\n function formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n }\n function formatUTCWeekdayNumberMonday(d) {\n var dow = d.getUTCDay();\n return dow === 0 ? 7 : dow;\n }\n function formatUTCWeekNumberSunday(d, p) {\n return pad(d3Time.utcSunday.count(d3Time.utcYear(d) - 1, d), p, 2);\n }\n function formatUTCWeekNumberISO(d, p) {\n var day = d.getUTCDay();\n d = day >= 4 || day === 0 ? d3Time.utcThursday(d) : d3Time.utcThursday.ceil(d);\n return pad(d3Time.utcThursday.count(d3Time.utcYear(d), d) + (d3Time.utcYear(d).getUTCDay() === 4), p, 2);\n }\n function formatUTCWeekdayNumberSunday(d) {\n return d.getUTCDay();\n }\n function formatUTCWeekNumberMonday(d, p) {\n return pad(d3Time.utcMonday.count(d3Time.utcYear(d) - 1, d), p, 2);\n }\n function formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n }\n function formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 1e4, p, 4);\n }\n function formatUTCZone() {\n return \"+0000\";\n }\n function formatLiteralPercent() {\n return \"%\";\n }\n function formatUnixTimestamp(d) {\n return +d;\n }\n function formatUnixTimestampSeconds(d) {\n return Math.floor(+d / 1e3);\n }\n var locale;\n defaultLocale({\n dateTime: \"%x, %X\",\n date: \"%-m/%-d/%Y\",\n time: \"%-I:%M:%S %p\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n });\n function defaultLocale(definition) {\n locale = formatLocale(definition);\n exports2.timeFormat = locale.format;\n exports2.timeParse = locale.parse;\n exports2.utcFormat = locale.utcFormat;\n exports2.utcParse = locale.utcParse;\n return locale;\n }\n var isoSpecifier = \"%Y-%m-%dT%H:%M:%S.%LZ\";\n function formatIsoNative(date) {\n return date.toISOString();\n }\n var formatIso = Date.prototype.toISOString ? formatIsoNative : exports2.utcFormat(isoSpecifier);\n function parseIsoNative(string) {\n var date = new Date(string);\n return isNaN(date) ? null : date;\n }\n var parseIso = +/* @__PURE__ */ new Date(\"2000-01-01T00:00:00.000Z\") ? parseIsoNative : exports2.utcParse(isoSpecifier);\n exports2.isoFormat = formatIso;\n exports2.isoParse = parseIso;\n exports2.timeFormatDefaultLocale = defaultLocale;\n exports2.timeFormatLocale = formatLocale;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // node_modules/d3-format/dist/d3-format.js\n var require_d3_format = __commonJS({\n \"node_modules/d3-format/dist/d3-format.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports) : typeof define === \"function\" && false ? define([\"exports\"], factory) : (global2 = typeof globalThis !== \"undefined\" ? globalThis : global2 || self, factory(global2.d3 = global2.d3 || {}));\n })(exports, function(exports2) {\n \"use strict\";\n function formatDecimal(x) {\n return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString(\"en\").replace(/,/g, \"\") : x.toString(10);\n }\n function formatDecimalParts(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null;\n var i, coefficient = x.slice(0, i);\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n }\n function exponent(x) {\n return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;\n }\n function formatGroup(grouping, thousands) {\n return function(value, width) {\n var i = value.length, t = [], j = 0, g = grouping[0], length = 0;\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n return t.reverse().join(thousands);\n };\n }\n function formatNumerals(numerals) {\n return function(value) {\n return value.replace(/[0-9]/g, function(i) {\n return numerals[+i];\n });\n };\n }\n var re = /^(?:(.)?([<>=^]))?([+\\-( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?(~)?([a-z%])?$/i;\n function formatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n var match;\n return new FormatSpecifier({\n fill: match[1],\n align: match[2],\n sign: match[3],\n symbol: match[4],\n zero: match[5],\n width: match[6],\n comma: match[7],\n precision: match[8] && match[8].slice(1),\n trim: match[9],\n type: match[10]\n });\n }\n formatSpecifier.prototype = FormatSpecifier.prototype;\n function FormatSpecifier(specifier) {\n this.fill = specifier.fill === void 0 ? \" \" : specifier.fill + \"\";\n this.align = specifier.align === void 0 ? \">\" : specifier.align + \"\";\n this.sign = specifier.sign === void 0 ? \"-\" : specifier.sign + \"\";\n this.symbol = specifier.symbol === void 0 ? \"\" : specifier.symbol + \"\";\n this.zero = !!specifier.zero;\n this.width = specifier.width === void 0 ? void 0 : +specifier.width;\n this.comma = !!specifier.comma;\n this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;\n this.trim = !!specifier.trim;\n this.type = specifier.type === void 0 ? \"\" : specifier.type + \"\";\n }\n FormatSpecifier.prototype.toString = function() {\n return this.fill + this.align + this.sign + this.symbol + (this.zero ? \"0\" : \"\") + (this.width === void 0 ? \"\" : Math.max(1, this.width | 0)) + (this.comma ? \",\" : \"\") + (this.precision === void 0 ? \"\" : \".\" + Math.max(0, this.precision | 0)) + (this.trim ? \"~\" : \"\") + this.type;\n };\n function formatTrim(s) {\n out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (s[i]) {\n case \".\":\n i0 = i1 = i;\n break;\n case \"0\":\n if (i0 === 0) i0 = i;\n i1 = i;\n break;\n default:\n if (!+s[i]) break out;\n if (i0 > 0) i0 = 0;\n break;\n }\n }\n return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;\n }\n var prefixExponent;\n function formatPrefixAuto(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0], exponent2 = d[1], i = exponent2 - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent2 / 3))) * 3) + 1, n = coefficient.length;\n return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join(\"0\") : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i) : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimalParts(x, Math.max(0, p + i - 1))[0];\n }\n function formatRounded(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0], exponent2 = d[1];\n return exponent2 < 0 ? \"0.\" + new Array(-exponent2).join(\"0\") + coefficient : coefficient.length > exponent2 + 1 ? coefficient.slice(0, exponent2 + 1) + \".\" + coefficient.slice(exponent2 + 1) : coefficient + new Array(exponent2 - coefficient.length + 2).join(\"0\");\n }\n var formatTypes = {\n \"%\": function(x, p) {\n return (x * 100).toFixed(p);\n },\n \"b\": function(x) {\n return Math.round(x).toString(2);\n },\n \"c\": function(x) {\n return x + \"\";\n },\n \"d\": formatDecimal,\n \"e\": function(x, p) {\n return x.toExponential(p);\n },\n \"f\": function(x, p) {\n return x.toFixed(p);\n },\n \"g\": function(x, p) {\n return x.toPrecision(p);\n },\n \"o\": function(x) {\n return Math.round(x).toString(8);\n },\n \"p\": function(x, p) {\n return formatRounded(x * 100, p);\n },\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": function(x) {\n return Math.round(x).toString(16).toUpperCase();\n },\n \"x\": function(x) {\n return Math.round(x).toString(16);\n }\n };\n function identity2(x) {\n return x;\n }\n var map = Array.prototype.map, prefixes = [\"y\", \"z\", \"a\", \"f\", \"p\", \"n\", \"\\xB5\", \"m\", \"\", \"k\", \"M\", \"G\", \"T\", \"P\", \"E\", \"Z\", \"Y\"];\n function formatLocale(locale2) {\n var group = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity2 : formatGroup(map.call(locale2.grouping, Number), locale2.thousands + \"\"), currencyPrefix = locale2.currency === void 0 ? \"\" : locale2.currency[0] + \"\", currencySuffix = locale2.currency === void 0 ? \"\" : locale2.currency[1] + \"\", decimal = locale2.decimal === void 0 ? \".\" : locale2.decimal + \"\", numerals = locale2.numerals === void 0 ? identity2 : formatNumerals(map.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? \"%\" : locale2.percent + \"\", minus = locale2.minus === void 0 ? \"-\" : locale2.minus + \"\", nan = locale2.nan === void 0 ? \"NaN\" : locale2.nan + \"\";\n function newFormat(specifier) {\n specifier = formatSpecifier(specifier);\n var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero2 = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type;\n if (type === \"n\") comma = true, type = \"g\";\n else if (!formatTypes[type]) precision === void 0 && (precision = 12), trim = true, type = \"g\";\n if (zero2 || fill === \"0\" && align === \"=\") zero2 = true, fill = \"0\", align = \"=\";\n var prefix = symbol === \"$\" ? currencyPrefix : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\", suffix = symbol === \"$\" ? currencySuffix : /[%p]/.test(type) ? percent : \"\";\n var formatType = formatTypes[type], maybeSuffix = /[defgprs%]/.test(type);\n precision = precision === void 0 ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision));\n function format(value) {\n var valuePrefix = prefix, valueSuffix = suffix, i, n, c;\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n var valueNegative = value < 0 || 1 / value < 0;\n value = isNaN(value) ? nan : formatType(Math.abs(value), precision);\n if (trim) value = formatTrim(value);\n if (valueNegative && +value === 0 && sign !== \"+\") valueNegative = false;\n valuePrefix = (valueNegative ? sign === \"(\" ? sign : minus : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + valueSuffix + (valueNegative && sign === \"(\" ? \")\" : \"\");\n if (maybeSuffix) {\n i = -1, n = value.length;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n if (comma && !zero2) value = group(value, Infinity);\n var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n if (comma && zero2) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n switch (align) {\n case \"<\":\n value = valuePrefix + value + valueSuffix + padding;\n break;\n case \"=\":\n value = valuePrefix + padding + value + valueSuffix;\n break;\n case \"^\":\n value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);\n break;\n default:\n value = padding + valuePrefix + value + valueSuffix;\n break;\n }\n return numerals(value);\n }\n format.toString = function() {\n return specifier + \"\";\n };\n return format;\n }\n function formatPrefix(specifier, value) {\n var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3];\n return function(value2) {\n return f(k * value2) + prefix;\n };\n }\n return {\n format: newFormat,\n formatPrefix\n };\n }\n var locale;\n defaultLocale({\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"],\n minus: \"-\"\n });\n function defaultLocale(definition) {\n locale = formatLocale(definition);\n exports2.format = locale.format;\n exports2.formatPrefix = locale.formatPrefix;\n return locale;\n }\n function precisionFixed(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n }\n function precisionPrefix(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n }\n function precisionRound(step, max) {\n step = Math.abs(step), max = Math.abs(max) - step;\n return Math.max(0, exponent(max) - exponent(step)) + 1;\n }\n exports2.FormatSpecifier = FormatSpecifier;\n exports2.formatDefaultLocale = defaultLocale;\n exports2.formatLocale = formatLocale;\n exports2.formatSpecifier = formatSpecifier;\n exports2.precisionFixed = precisionFixed;\n exports2.precisionPrefix = precisionPrefix;\n exports2.precisionRound = precisionRound;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // node_modules/is-string-blank/index.js\n var require_is_string_blank = __commonJS({\n \"node_modules/is-string-blank/index.js\"(exports, module) {\n \"use strict\";\n module.exports = function(str) {\n var l = str.length, a;\n for (var i = 0; i < l; i++) {\n a = str.charCodeAt(i);\n if ((a < 9 || a > 13) && a !== 32 && a !== 133 && a !== 160 && a !== 5760 && a !== 6158 && (a < 8192 || a > 8205) && a !== 8232 && a !== 8233 && a !== 8239 && a !== 8287 && a !== 8288 && a !== 12288 && a !== 65279) {\n return false;\n }\n }\n return true;\n };\n }\n });\n\n // node_modules/fast-isnumeric/index.js\n var require_fast_isnumeric = __commonJS({\n \"node_modules/fast-isnumeric/index.js\"(exports, module) {\n \"use strict\";\n var allBlankCharCodes = require_is_string_blank();\n module.exports = function(n) {\n var type = typeof n;\n if (type === \"string\") {\n var original = n;\n n = +n;\n if (n === 0 && allBlankCharCodes(original)) return false;\n } else if (type !== \"number\") return false;\n return n - n < 1;\n };\n }\n });\n\n // src/constants/numerical.js\n var require_numerical = __commonJS({\n \"src/constants/numerical.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n /**\n * Standardize all missing data in calcdata to use undefined\n * never null or NaN.\n * That way we can use !==undefined, or !== BADNUM,\n * to test for real data\n */\n BADNUM: void 0,\n /*\n * Limit certain operations to well below floating point max value\n * to avoid glitches: Make sure that even when you multiply it by the\n * number of pixels on a giant screen it still works\n */\n FP_SAFE: Number.MAX_VALUE * 1e-4,\n /*\n * conversion of date units to milliseconds\n * year and month constants are marked \"AVG\"\n * to remind us that not all years and months\n * have the same length\n */\n ONEMAXYEAR: 316224e5,\n // 366 * ONEDAY\n ONEAVGYEAR: 315576e5,\n // 365.25 days\n ONEMINYEAR: 31536e6,\n // 365 * ONEDAY\n ONEMAXQUARTER: 79488e5,\n // 92 * ONEDAY\n ONEAVGQUARTER: 78894e5,\n // 1/4 of ONEAVGYEAR\n ONEMINQUARTER: 76896e5,\n // 89 * ONEDAY\n ONEMAXMONTH: 26784e5,\n // 31 * ONEDAY\n ONEAVGMONTH: 26298e5,\n // 1/12 of ONEAVGYEAR\n ONEMINMONTH: 24192e5,\n // 28 * ONEDAY\n ONEWEEK: 6048e5,\n // 7 * ONEDAY\n ONEDAY: 864e5,\n // 24 * ONEHOUR\n ONEHOUR: 36e5,\n ONEMIN: 6e4,\n ONESEC: 1e3,\n ONEMILLI: 1,\n ONEMICROSEC: 1e-3,\n /*\n * For fast conversion btwn world calendars and epoch ms, the Julian Day Number\n * of the unix epoch. From calendars.instance().newDate(1970, 1, 1).toJD()\n */\n EPOCHJD: 24405875e-1,\n /*\n * Are two values nearly equal? Compare to 1PPM\n */\n ALMOST_EQUAL: 1 - 1e-6,\n /*\n * If we're asked to clip a non-positive log value, how far off-screen\n * do we put it?\n */\n LOG_CLIP: 10,\n /*\n * not a number, but for displaying numbers: the \"minus sign\" symbol is\n * wider than the regular ascii dash \"-\"\n */\n MINUS_SIGN: \"\\u2212\"\n };\n }\n });\n\n // node_modules/base64-arraybuffer/dist/base64-arraybuffer.umd.js\n var require_base64_arraybuffer_umd = __commonJS({\n \"node_modules/base64-arraybuffer/dist/base64-arraybuffer.umd.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports) : typeof define === \"function\" && false ? define([\"exports\"], factory) : (global2 = typeof globalThis !== \"undefined\" ? globalThis : global2 || self, factory(global2[\"base64-arraybuffer\"] = {}));\n })(exports, function(exports2) {\n \"use strict\";\n var chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n var lookup = typeof Uint8Array === \"undefined\" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = \"\";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + \"=\";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + \"==\";\n }\n return base64;\n };\n var decode = function(base64) {\n var bufferLength = base64.length * 0.75, len = base64.length, i2, p = 0, encoded1, encoded2, encoded3, encoded4;\n if (base64[base64.length - 1] === \"=\") {\n bufferLength--;\n if (base64[base64.length - 2] === \"=\") {\n bufferLength--;\n }\n }\n var arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer);\n for (i2 = 0; i2 < len; i2 += 4) {\n encoded1 = lookup[base64.charCodeAt(i2)];\n encoded2 = lookup[base64.charCodeAt(i2 + 1)];\n encoded3 = lookup[base64.charCodeAt(i2 + 2)];\n encoded4 = lookup[base64.charCodeAt(i2 + 3)];\n bytes[p++] = encoded1 << 2 | encoded2 >> 4;\n bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2;\n bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63;\n }\n return arraybuffer;\n };\n exports2.decode = decode;\n exports2.encode = encode;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // src/lib/is_plain_object.js\n var require_is_plain_object = __commonJS({\n \"src/lib/is_plain_object.js\"(exports, module) {\n \"use strict\";\n module.exports = function isPlainObject(obj) {\n if (window && window.process && window.process.versions) {\n return Object.prototype.toString.call(obj) === \"[object Object]\";\n }\n return Object.prototype.toString.call(obj) === \"[object Object]\" && Object.getPrototypeOf(obj).hasOwnProperty(\"hasOwnProperty\");\n };\n }\n });\n\n // src/lib/array.js\n var require_array = __commonJS({\n \"src/lib/array.js\"(exports) {\n \"use strict\";\n var b64decode = require_base64_arraybuffer_umd().decode;\n var isPlainObject = require_is_plain_object();\n var isArray = Array.isArray;\n var ab = ArrayBuffer;\n var dv = DataView;\n function isTypedArray(a) {\n return ab.isView(a) && !(a instanceof dv);\n }\n exports.isTypedArray = isTypedArray;\n function isArrayOrTypedArray(a) {\n return isArray(a) || isTypedArray(a);\n }\n exports.isArrayOrTypedArray = isArrayOrTypedArray;\n function isArray1D(a) {\n return !isArrayOrTypedArray(a[0]);\n }\n exports.isArray1D = isArray1D;\n exports.ensureArray = function(out, n) {\n if (!isArray(out)) out = [];\n out.length = n;\n return out;\n };\n var typedArrays = {\n u1c: typeof Uint8ClampedArray === \"undefined\" ? void 0 : Uint8ClampedArray,\n // not supported in numpy?\n i1: typeof Int8Array === \"undefined\" ? void 0 : Int8Array,\n u1: typeof Uint8Array === \"undefined\" ? void 0 : Uint8Array,\n i2: typeof Int16Array === \"undefined\" ? void 0 : Int16Array,\n u2: typeof Uint16Array === \"undefined\" ? void 0 : Uint16Array,\n i4: typeof Int32Array === \"undefined\" ? void 0 : Int32Array,\n u4: typeof Uint32Array === \"undefined\" ? void 0 : Uint32Array,\n f4: typeof Float32Array === \"undefined\" ? void 0 : Float32Array,\n f8: typeof Float64Array === \"undefined\" ? void 0 : Float64Array\n /* TODO: potentially add Big Int\n \n i8: typeof BigInt64Array === 'undefined' ? undefined :\n BigInt64Array,\n \n u8: typeof BigUint64Array === 'undefined' ? undefined :\n BigUint64Array,\n */\n };\n typedArrays.uint8c = typedArrays.u1c;\n typedArrays.uint8 = typedArrays.u1;\n typedArrays.int8 = typedArrays.i1;\n typedArrays.uint16 = typedArrays.u2;\n typedArrays.int16 = typedArrays.i2;\n typedArrays.uint32 = typedArrays.u4;\n typedArrays.int32 = typedArrays.i4;\n typedArrays.float32 = typedArrays.f4;\n typedArrays.float64 = typedArrays.f8;\n function isArrayBuffer(a) {\n return a.constructor === ArrayBuffer;\n }\n exports.isArrayBuffer = isArrayBuffer;\n exports.decodeTypedArraySpec = function(vIn) {\n var out = [];\n var v = coerceTypedArraySpec(vIn);\n var dtype = v.dtype;\n var T = typedArrays[dtype];\n if (!T) throw new Error('Error in dtype: \"' + dtype + '\"');\n var BYTES_PER_ELEMENT = T.BYTES_PER_ELEMENT;\n var buffer = v.bdata;\n if (!isArrayBuffer(buffer)) {\n buffer = b64decode(buffer);\n }\n var shape = v.shape === void 0 ? (\n // detect 1-d length\n [buffer.byteLength / BYTES_PER_ELEMENT]\n ) : (\n // convert number to string and split to array\n (\"\" + v.shape).split(\",\")\n );\n shape.reverse();\n var ndim = shape.length;\n var nj, j;\n var ni = +shape[0];\n var rowBytes = BYTES_PER_ELEMENT * ni;\n var pos = 0;\n if (ndim === 1) {\n out = new T(buffer);\n } else if (ndim === 2) {\n nj = +shape[1];\n for (j = 0; j < nj; j++) {\n out[j] = new T(buffer, pos, ni);\n pos += rowBytes;\n }\n } else if (ndim === 3) {\n nj = +shape[1];\n var nk = +shape[2];\n for (var k = 0; k < nk; k++) {\n out[k] = [];\n for (j = 0; j < nj; j++) {\n out[k][j] = new T(buffer, pos, ni);\n pos += rowBytes;\n }\n }\n } else {\n throw new Error(\"ndim: \" + ndim + 'is not supported with the shape:\"' + v.shape + '\"');\n }\n out.bdata = v.bdata;\n out.dtype = v.dtype;\n out.shape = shape.reverse().join(\",\");\n vIn._inputArray = out;\n return out;\n };\n exports.isTypedArraySpec = function(v) {\n return isPlainObject(v) && v.hasOwnProperty(\"dtype\") && typeof v.dtype === \"string\" && v.hasOwnProperty(\"bdata\") && (typeof v.bdata === \"string\" || isArrayBuffer(v.bdata)) && (v.shape === void 0 || v.hasOwnProperty(\"shape\") && (typeof v.shape === \"string\" || typeof v.shape === \"number\"));\n };\n function coerceTypedArraySpec(v) {\n return {\n bdata: v.bdata,\n dtype: v.dtype,\n shape: v.shape\n };\n }\n exports.concat = function() {\n var args = [];\n var allArray = true;\n var totalLen = 0;\n var _constructor, arg0, i, argi, posi, leni, out, j;\n for (i = 0; i < arguments.length; i++) {\n argi = arguments[i];\n leni = argi.length;\n if (leni) {\n if (arg0) args.push(argi);\n else {\n arg0 = argi;\n posi = leni;\n }\n if (isArray(argi)) {\n _constructor = false;\n } else {\n allArray = false;\n if (!totalLen) {\n _constructor = argi.constructor;\n } else if (_constructor !== argi.constructor) {\n _constructor = false;\n }\n }\n totalLen += leni;\n }\n }\n if (!totalLen) return [];\n if (!args.length) return arg0;\n if (allArray) return arg0.concat.apply(arg0, args);\n if (_constructor) {\n out = new _constructor(totalLen);\n out.set(arg0);\n for (i = 0; i < args.length; i++) {\n argi = args[i];\n out.set(argi, posi);\n posi += argi.length;\n }\n return out;\n }\n out = new Array(totalLen);\n for (j = 0; j < arg0.length; j++) out[j] = arg0[j];\n for (i = 0; i < args.length; i++) {\n argi = args[i];\n for (j = 0; j < argi.length; j++) out[posi + j] = argi[j];\n posi += j;\n }\n return out;\n };\n exports.maxRowLength = function(z) {\n return _rowLength(z, Math.max, 0);\n };\n exports.minRowLength = function(z) {\n return _rowLength(z, Math.min, Infinity);\n };\n function _rowLength(z, fn, len0) {\n if (isArrayOrTypedArray(z)) {\n if (isArrayOrTypedArray(z[0])) {\n var len = len0;\n for (var i = 0; i < z.length; i++) {\n len = fn(len, z[i].length);\n }\n return len;\n } else {\n return z.length;\n }\n }\n return 0;\n }\n }\n });\n\n // src/lib/nested_property.js\n var require_nested_property = __commonJS({\n \"src/lib/nested_property.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var isArrayOrTypedArray = require_array().isArrayOrTypedArray;\n module.exports = function nestedProperty(container, propStr) {\n if (isNumeric(propStr)) propStr = String(propStr);\n else if (typeof propStr !== \"string\" || propStr.substr(propStr.length - 4) === \"[-1]\") {\n throw \"bad property string\";\n }\n var propParts = propStr.split(\".\");\n var indexed;\n var indices;\n var i, j;\n for (j = 0; j < propParts.length; j++) {\n if (String(propParts[j]).slice(0, 2) === \"__\") {\n throw \"bad property string\";\n }\n }\n j = 0;\n while (j < propParts.length) {\n indexed = String(propParts[j]).match(/^([^\\[\\]]*)((\\[\\-?[0-9]*\\])+)$/);\n if (indexed) {\n if (indexed[1]) propParts[j] = indexed[1];\n else if (j === 0) propParts.splice(0, 1);\n else throw \"bad property string\";\n indices = indexed[2].substr(1, indexed[2].length - 2).split(\"][\");\n for (i = 0; i < indices.length; i++) {\n j++;\n propParts.splice(j, 0, Number(indices[i]));\n }\n }\n j++;\n }\n if (typeof container !== \"object\") {\n return badContainer(container, propStr, propParts);\n }\n return {\n set: npSet(container, propParts, propStr),\n get: npGet(container, propParts),\n astr: propStr,\n parts: propParts,\n obj: container\n };\n };\n function npGet(cont, parts) {\n return function(retainNull) {\n var curCont = cont;\n var curPart;\n var allSame;\n var out;\n var i;\n var j;\n for (i = 0; i < parts.length - 1; i++) {\n curPart = parts[i];\n if (curPart === -1) {\n allSame = true;\n out = [];\n for (j = 0; j < curCont.length; j++) {\n out[j] = npGet(curCont[j], parts.slice(i + 1))(retainNull);\n if (out[j] !== out[0]) allSame = false;\n }\n return allSame ? out[0] : out;\n }\n if (typeof curPart === \"number\" && !isArrayOrTypedArray(curCont)) {\n return void 0;\n }\n curCont = curCont[curPart];\n if (typeof curCont !== \"object\" || curCont === null) {\n return void 0;\n }\n }\n if (typeof curCont !== \"object\" || curCont === null) return void 0;\n out = curCont[parts[i]];\n if (!retainNull && out === null) return void 0;\n return out;\n };\n }\n var ARGS_PATTERN = /(^|\\.)args\\[/;\n function isDeletable(val, propStr) {\n return val === void 0 || val === null && !propStr.match(ARGS_PATTERN);\n }\n function npSet(cont, parts, propStr) {\n return function(val) {\n var curCont = cont;\n var propPart = \"\";\n var containerLevels = [[cont, propPart]];\n var toDelete = isDeletable(val, propStr);\n var curPart;\n var i;\n for (i = 0; i < parts.length - 1; i++) {\n curPart = parts[i];\n if (typeof curPart === \"number\" && !isArrayOrTypedArray(curCont)) {\n throw \"array index but container is not an array\";\n }\n if (curPart === -1) {\n toDelete = !setArrayAll(curCont, parts.slice(i + 1), val, propStr);\n if (toDelete) break;\n else return;\n }\n if (!checkNewContainer(curCont, curPart, parts[i + 1], toDelete)) {\n break;\n }\n curCont = curCont[curPart];\n if (typeof curCont !== \"object\" || curCont === null) {\n throw \"container is not an object\";\n }\n propPart = joinPropStr(propPart, curPart);\n containerLevels.push([curCont, propPart]);\n }\n if (toDelete) {\n if (i === parts.length - 1) {\n delete curCont[parts[i]];\n if (Array.isArray(curCont) && +parts[i] === curCont.length - 1) {\n while (curCont.length && curCont[curCont.length - 1] === void 0) {\n curCont.pop();\n }\n }\n }\n } else curCont[parts[i]] = val;\n };\n }\n function joinPropStr(propStr, newPart) {\n var toAdd = newPart;\n if (isNumeric(newPart)) toAdd = \"[\" + newPart + \"]\";\n else if (propStr) toAdd = \".\" + newPart;\n return propStr + toAdd;\n }\n function setArrayAll(containerArray, innerParts, val, propStr) {\n var arrayVal = isArrayOrTypedArray(val);\n var allSet = true;\n var thisVal = val;\n var thisPropStr = propStr.replace(\"-1\", 0);\n var deleteThis = arrayVal ? false : isDeletable(val, thisPropStr);\n var firstPart = innerParts[0];\n var i;\n for (i = 0; i < containerArray.length; i++) {\n thisPropStr = propStr.replace(\"-1\", i);\n if (arrayVal) {\n thisVal = val[i % val.length];\n deleteThis = isDeletable(thisVal, thisPropStr);\n }\n if (deleteThis) allSet = false;\n if (!checkNewContainer(containerArray, i, firstPart, deleteThis)) {\n continue;\n }\n npSet(containerArray[i], innerParts, propStr.replace(\"-1\", i))(thisVal);\n }\n return allSet;\n }\n function checkNewContainer(container, part, nextPart, toDelete) {\n if (container[part] === void 0) {\n if (toDelete) return false;\n if (typeof nextPart === \"number\") container[part] = [];\n else container[part] = {};\n }\n return true;\n }\n function badContainer(container, propStr, propParts) {\n return {\n set: function() {\n throw \"bad container\";\n },\n get: function() {\n },\n astr: propStr,\n parts: propParts,\n obj: container\n };\n }\n }\n });\n\n // src/lib/keyed_container.js\n var require_keyed_container = __commonJS({\n \"src/lib/keyed_container.js\"(exports, module) {\n \"use strict\";\n var nestedProperty = require_nested_property();\n var SIMPLE_PROPERTY_REGEX = /^\\w*$/;\n var NONE = 0;\n var NAME = 1;\n var VALUE = 2;\n var BOTH = 3;\n var UNSET = 4;\n module.exports = function keyedContainer(baseObj, path, keyName, valueName) {\n keyName = keyName || \"name\";\n valueName = valueName || \"value\";\n var i, arr, baseProp;\n var changeTypes = {};\n if (path && path.length) {\n baseProp = nestedProperty(baseObj, path);\n arr = baseProp.get();\n } else {\n arr = baseObj;\n }\n path = path || \"\";\n var indexLookup = {};\n if (arr) {\n for (i = 0; i < arr.length; i++) {\n indexLookup[arr[i][keyName]] = i;\n }\n }\n var isSimpleValueProp = SIMPLE_PROPERTY_REGEX.test(valueName);\n var obj = {\n set: function(name2, value) {\n var changeType = value === null ? UNSET : NONE;\n if (!arr) {\n if (!baseProp || changeType === UNSET) return;\n arr = [];\n baseProp.set(arr);\n }\n var idx = indexLookup[name2];\n if (idx === void 0) {\n if (changeType === UNSET) return;\n changeType = changeType | BOTH;\n idx = arr.length;\n indexLookup[name2] = idx;\n } else if (value !== (isSimpleValueProp ? arr[idx][valueName] : nestedProperty(arr[idx], valueName).get())) {\n changeType = changeType | VALUE;\n }\n var newValue = arr[idx] = arr[idx] || {};\n newValue[keyName] = name2;\n if (isSimpleValueProp) {\n newValue[valueName] = value;\n } else {\n nestedProperty(newValue, valueName).set(value);\n }\n if (value !== null) {\n changeType = changeType & ~UNSET;\n }\n changeTypes[idx] = changeTypes[idx] | changeType;\n return obj;\n },\n get: function(name2) {\n if (!arr) return;\n var idx = indexLookup[name2];\n if (idx === void 0) {\n return void 0;\n } else if (isSimpleValueProp) {\n return arr[idx][valueName];\n } else {\n return nestedProperty(arr[idx], valueName).get();\n }\n },\n rename: function(name2, newName) {\n var idx = indexLookup[name2];\n if (idx === void 0) return obj;\n changeTypes[idx] = changeTypes[idx] | NAME;\n indexLookup[newName] = idx;\n delete indexLookup[name2];\n arr[idx][keyName] = newName;\n return obj;\n },\n remove: function(name2) {\n var idx = indexLookup[name2];\n if (idx === void 0) return obj;\n var object = arr[idx];\n if (Object.keys(object).length > 2) {\n changeTypes[idx] = changeTypes[idx] | VALUE;\n return obj.set(name2, null);\n }\n if (isSimpleValueProp) {\n for (i = idx; i < arr.length; i++) {\n changeTypes[i] = changeTypes[i] | BOTH;\n }\n for (i = idx; i < arr.length; i++) {\n indexLookup[arr[i][keyName]]--;\n }\n arr.splice(idx, 1);\n delete indexLookup[name2];\n } else {\n nestedProperty(object, valueName).set(null);\n changeTypes[idx] = changeTypes[idx] | VALUE | UNSET;\n }\n return obj;\n },\n constructUpdate: function() {\n var astr, idx;\n var update = {};\n var changed = Object.keys(changeTypes);\n for (var i2 = 0; i2 < changed.length; i2++) {\n idx = changed[i2];\n astr = path + \"[\" + idx + \"]\";\n if (arr[idx]) {\n if (changeTypes[idx] & NAME) {\n update[astr + \".\" + keyName] = arr[idx][keyName];\n }\n if (changeTypes[idx] & VALUE) {\n if (isSimpleValueProp) {\n update[astr + \".\" + valueName] = changeTypes[idx] & UNSET ? null : arr[idx][valueName];\n } else {\n update[astr + \".\" + valueName] = changeTypes[idx] & UNSET ? null : nestedProperty(arr[idx], valueName).get();\n }\n }\n } else {\n update[astr] = null;\n }\n }\n return update;\n }\n };\n return obj;\n };\n }\n });\n\n // src/lib/relative_attr.js\n var require_relative_attr = __commonJS({\n \"src/lib/relative_attr.js\"(exports, module) {\n \"use strict\";\n var ASCEND = /^(.*)(\\.[^\\.\\[\\]]+|\\[\\d\\])$/;\n var SIMPLEATTR = /^[^\\.\\[\\]]+$/;\n module.exports = function(baseAttr, relativeAttr) {\n while (relativeAttr) {\n var match = baseAttr.match(ASCEND);\n if (match) baseAttr = match[1];\n else if (baseAttr.match(SIMPLEATTR)) baseAttr = \"\";\n else throw new Error(\"bad relativeAttr call:\" + [baseAttr, relativeAttr]);\n if (relativeAttr.charAt(0) === \"^\") relativeAttr = relativeAttr.slice(1);\n else break;\n }\n if (baseAttr && relativeAttr.charAt(0) !== \"[\") {\n return baseAttr + \".\" + relativeAttr;\n }\n return baseAttr + relativeAttr;\n };\n }\n });\n\n // src/lib/to_log_range.js\n var require_to_log_range = __commonJS({\n \"src/lib/to_log_range.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n module.exports = function toLogRange(val, range) {\n if (val > 0) return Math.log(val) / Math.LN10;\n var newVal = Math.log(Math.min(range[0], range[1])) / Math.LN10;\n if (!isNumeric(newVal)) newVal = Math.log(Math.max(range[0], range[1])) / Math.LN10 - 6;\n return newVal;\n };\n }\n });\n\n // src/lib/relink_private.js\n var require_relink_private = __commonJS({\n \"src/lib/relink_private.js\"(exports, module) {\n \"use strict\";\n var isArrayOrTypedArray = require_array().isArrayOrTypedArray;\n var isPlainObject = require_is_plain_object();\n module.exports = function relinkPrivateKeys(toContainer, fromContainer) {\n for (var k in fromContainer) {\n var fromVal = fromContainer[k];\n var toVal = toContainer[k];\n if (toVal === fromVal) continue;\n if (k.charAt(0) === \"_\" || typeof fromVal === \"function\") {\n if (k in toContainer) continue;\n toContainer[k] = fromVal;\n } else if (isArrayOrTypedArray(fromVal) && isArrayOrTypedArray(toVal) && isPlainObject(fromVal[0])) {\n if (k === \"customdata\" || k === \"ids\") continue;\n var minLen = Math.min(fromVal.length, toVal.length);\n for (var j = 0; j < minLen; j++) {\n if (toVal[j] !== fromVal[j] && isPlainObject(fromVal[j]) && isPlainObject(toVal[j])) {\n relinkPrivateKeys(toVal[j], fromVal[j]);\n }\n }\n } else if (isPlainObject(fromVal) && isPlainObject(toVal)) {\n relinkPrivateKeys(toVal, fromVal);\n if (!Object.keys(toVal).length) delete toContainer[k];\n }\n }\n };\n }\n });\n\n // src/lib/mod.js\n var require_mod = __commonJS({\n \"src/lib/mod.js\"(exports, module) {\n \"use strict\";\n function mod(v, d) {\n var out = v % d;\n return out < 0 ? out + d : out;\n }\n function modHalf(v, d) {\n return Math.abs(v) > d / 2 ? v - Math.round(v / d) * d : v;\n }\n module.exports = {\n mod,\n modHalf\n };\n }\n });\n\n // node_modules/tinycolor2/tinycolor.js\n var require_tinycolor = __commonJS({\n \"node_modules/tinycolor2/tinycolor.js\"(exports, module) {\n (function(Math2) {\n var trimLeft = /^\\s+/, trimRight = /\\s+$/, tinyCounter = 0, mathRound = Math2.round, mathMin = Math2.min, mathMax = Math2.max, mathRandom = Math2.random;\n function tinycolor(color2, opts) {\n color2 = color2 ? color2 : \"\";\n opts = opts || {};\n if (color2 instanceof tinycolor) {\n return color2;\n }\n if (!(this instanceof tinycolor)) {\n return new tinycolor(color2, opts);\n }\n var rgb2 = inputToRGB(color2);\n this._originalInput = color2, this._r = rgb2.r, this._g = rgb2.g, this._b = rgb2.b, this._a = rgb2.a, this._roundA = mathRound(100 * this._a) / 100, this._format = opts.format || rgb2.format;\n this._gradientType = opts.gradientType;\n if (this._r < 1) {\n this._r = mathRound(this._r);\n }\n if (this._g < 1) {\n this._g = mathRound(this._g);\n }\n if (this._b < 1) {\n this._b = mathRound(this._b);\n }\n this._ok = rgb2.ok;\n this._tc_id = tinyCounter++;\n }\n tinycolor.prototype = {\n isDark: function() {\n return this.getBrightness() < 128;\n },\n isLight: function() {\n return !this.isDark();\n },\n isValid: function() {\n return this._ok;\n },\n getOriginalInput: function() {\n return this._originalInput;\n },\n getFormat: function() {\n return this._format;\n },\n getAlpha: function() {\n return this._a;\n },\n getBrightness: function() {\n var rgb2 = this.toRgb();\n return (rgb2.r * 299 + rgb2.g * 587 + rgb2.b * 114) / 1e3;\n },\n getLuminance: function() {\n var rgb2 = this.toRgb();\n var RsRGB, GsRGB, BsRGB, R, G, B2;\n RsRGB = rgb2.r / 255;\n GsRGB = rgb2.g / 255;\n BsRGB = rgb2.b / 255;\n if (RsRGB <= 0.03928) {\n R = RsRGB / 12.92;\n } else {\n R = Math2.pow((RsRGB + 0.055) / 1.055, 2.4);\n }\n if (GsRGB <= 0.03928) {\n G = GsRGB / 12.92;\n } else {\n G = Math2.pow((GsRGB + 0.055) / 1.055, 2.4);\n }\n if (BsRGB <= 0.03928) {\n B2 = BsRGB / 12.92;\n } else {\n B2 = Math2.pow((BsRGB + 0.055) / 1.055, 2.4);\n }\n return 0.2126 * R + 0.7152 * G + 0.0722 * B2;\n },\n setAlpha: function(value) {\n this._a = boundAlpha(value);\n this._roundA = mathRound(100 * this._a) / 100;\n return this;\n },\n toHsv: function() {\n var hsv = rgbToHsv(this._r, this._g, this._b);\n return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };\n },\n toHsvString: function() {\n var hsv = rgbToHsv(this._r, this._g, this._b);\n var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);\n return this._a == 1 ? \"hsv(\" + h + \", \" + s + \"%, \" + v + \"%)\" : \"hsva(\" + h + \", \" + s + \"%, \" + v + \"%, \" + this._roundA + \")\";\n },\n toHsl: function() {\n var hsl3 = rgbToHsl(this._r, this._g, this._b);\n return { h: hsl3.h * 360, s: hsl3.s, l: hsl3.l, a: this._a };\n },\n toHslString: function() {\n var hsl3 = rgbToHsl(this._r, this._g, this._b);\n var h = mathRound(hsl3.h * 360), s = mathRound(hsl3.s * 100), l = mathRound(hsl3.l * 100);\n return this._a == 1 ? \"hsl(\" + h + \", \" + s + \"%, \" + l + \"%)\" : \"hsla(\" + h + \", \" + s + \"%, \" + l + \"%, \" + this._roundA + \")\";\n },\n toHex: function(allow3Char) {\n return rgbToHex(this._r, this._g, this._b, allow3Char);\n },\n toHexString: function(allow3Char) {\n return \"#\" + this.toHex(allow3Char);\n },\n toHex8: function(allow4Char) {\n return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);\n },\n toHex8String: function(allow4Char) {\n return \"#\" + this.toHex8(allow4Char);\n },\n toRgb: function() {\n return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };\n },\n toRgbString: function() {\n return this._a == 1 ? \"rgb(\" + mathRound(this._r) + \", \" + mathRound(this._g) + \", \" + mathRound(this._b) + \")\" : \"rgba(\" + mathRound(this._r) + \", \" + mathRound(this._g) + \", \" + mathRound(this._b) + \", \" + this._roundA + \")\";\n },\n toPercentageRgb: function() {\n return { r: mathRound(bound01(this._r, 255) * 100) + \"%\", g: mathRound(bound01(this._g, 255) * 100) + \"%\", b: mathRound(bound01(this._b, 255) * 100) + \"%\", a: this._a };\n },\n toPercentageRgbString: function() {\n return this._a == 1 ? \"rgb(\" + mathRound(bound01(this._r, 255) * 100) + \"%, \" + mathRound(bound01(this._g, 255) * 100) + \"%, \" + mathRound(bound01(this._b, 255) * 100) + \"%)\" : \"rgba(\" + mathRound(bound01(this._r, 255) * 100) + \"%, \" + mathRound(bound01(this._g, 255) * 100) + \"%, \" + mathRound(bound01(this._b, 255) * 100) + \"%, \" + this._roundA + \")\";\n },\n toName: function() {\n if (this._a === 0) {\n return \"transparent\";\n }\n if (this._a < 1) {\n return false;\n }\n return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;\n },\n toFilter: function(secondColor) {\n var hex8String = \"#\" + rgbaToArgbHex(this._r, this._g, this._b, this._a);\n var secondHex8String = hex8String;\n var gradientType = this._gradientType ? \"GradientType = 1, \" : \"\";\n if (secondColor) {\n var s = tinycolor(secondColor);\n secondHex8String = \"#\" + rgbaToArgbHex(s._r, s._g, s._b, s._a);\n }\n return \"progid:DXImageTransform.Microsoft.gradient(\" + gradientType + \"startColorstr=\" + hex8String + \",endColorstr=\" + secondHex8String + \")\";\n },\n toString: function(format) {\n var formatSet = !!format;\n format = format || this._format;\n var formattedString = false;\n var hasAlpha = this._a < 1 && this._a >= 0;\n var needsAlphaFormat = !formatSet && hasAlpha && (format === \"hex\" || format === \"hex6\" || format === \"hex3\" || format === \"hex4\" || format === \"hex8\" || format === \"name\");\n if (needsAlphaFormat) {\n if (format === \"name\" && this._a === 0) {\n return this.toName();\n }\n return this.toRgbString();\n }\n if (format === \"rgb\") {\n formattedString = this.toRgbString();\n }\n if (format === \"prgb\") {\n formattedString = this.toPercentageRgbString();\n }\n if (format === \"hex\" || format === \"hex6\") {\n formattedString = this.toHexString();\n }\n if (format === \"hex3\") {\n formattedString = this.toHexString(true);\n }\n if (format === \"hex4\") {\n formattedString = this.toHex8String(true);\n }\n if (format === \"hex8\") {\n formattedString = this.toHex8String();\n }\n if (format === \"name\") {\n formattedString = this.toName();\n }\n if (format === \"hsl\") {\n formattedString = this.toHslString();\n }\n if (format === \"hsv\") {\n formattedString = this.toHsvString();\n }\n return formattedString || this.toHexString();\n },\n clone: function() {\n return tinycolor(this.toString());\n },\n _applyModification: function(fn, args) {\n var color2 = fn.apply(null, [this].concat([].slice.call(args)));\n this._r = color2._r;\n this._g = color2._g;\n this._b = color2._b;\n this.setAlpha(color2._a);\n return this;\n },\n lighten: function() {\n return this._applyModification(lighten, arguments);\n },\n brighten: function() {\n return this._applyModification(brighten, arguments);\n },\n darken: function() {\n return this._applyModification(darken, arguments);\n },\n desaturate: function() {\n return this._applyModification(desaturate, arguments);\n },\n saturate: function() {\n return this._applyModification(saturate, arguments);\n },\n greyscale: function() {\n return this._applyModification(greyscale, arguments);\n },\n spin: function() {\n return this._applyModification(spin, arguments);\n },\n _applyCombination: function(fn, args) {\n return fn.apply(null, [this].concat([].slice.call(args)));\n },\n analogous: function() {\n return this._applyCombination(analogous, arguments);\n },\n complement: function() {\n return this._applyCombination(complement, arguments);\n },\n monochromatic: function() {\n return this._applyCombination(monochromatic, arguments);\n },\n splitcomplement: function() {\n return this._applyCombination(splitcomplement, arguments);\n },\n triad: function() {\n return this._applyCombination(triad, arguments);\n },\n tetrad: function() {\n return this._applyCombination(tetrad, arguments);\n }\n };\n tinycolor.fromRatio = function(color2, opts) {\n if (typeof color2 == \"object\") {\n var newColor = {};\n for (var i in color2) {\n if (color2.hasOwnProperty(i)) {\n if (i === \"a\") {\n newColor[i] = color2[i];\n } else {\n newColor[i] = convertToPercentage(color2[i]);\n }\n }\n }\n color2 = newColor;\n }\n return tinycolor(color2, opts);\n };\n function inputToRGB(color2) {\n var rgb2 = { r: 0, g: 0, b: 0 };\n var a = 1;\n var s = null;\n var v = null;\n var l = null;\n var ok = false;\n var format = false;\n if (typeof color2 == \"string\") {\n color2 = stringInputToObject(color2);\n }\n if (typeof color2 == \"object\") {\n if (isValidCSSUnit(color2.r) && isValidCSSUnit(color2.g) && isValidCSSUnit(color2.b)) {\n rgb2 = rgbToRgb(color2.r, color2.g, color2.b);\n ok = true;\n format = String(color2.r).substr(-1) === \"%\" ? \"prgb\" : \"rgb\";\n } else if (isValidCSSUnit(color2.h) && isValidCSSUnit(color2.s) && isValidCSSUnit(color2.v)) {\n s = convertToPercentage(color2.s);\n v = convertToPercentage(color2.v);\n rgb2 = hsvToRgb(color2.h, s, v);\n ok = true;\n format = \"hsv\";\n } else if (isValidCSSUnit(color2.h) && isValidCSSUnit(color2.s) && isValidCSSUnit(color2.l)) {\n s = convertToPercentage(color2.s);\n l = convertToPercentage(color2.l);\n rgb2 = hslToRgb(color2.h, s, l);\n ok = true;\n format = \"hsl\";\n }\n if (color2.hasOwnProperty(\"a\")) {\n a = color2.a;\n }\n }\n a = boundAlpha(a);\n return {\n ok,\n format: color2.format || format,\n r: mathMin(255, mathMax(rgb2.r, 0)),\n g: mathMin(255, mathMax(rgb2.g, 0)),\n b: mathMin(255, mathMax(rgb2.b, 0)),\n a\n };\n }\n function rgbToRgb(r, g, b) {\n return {\n r: bound01(r, 255) * 255,\n g: bound01(g, 255) * 255,\n b: bound01(b, 255) * 255\n };\n }\n function rgbToHsl(r, g, b) {\n r = bound01(r, 255);\n g = bound01(g, 255);\n b = bound01(b, 255);\n var max = mathMax(r, g, b), min = mathMin(r, g, b);\n var h, s, l = (max + min) / 2;\n if (max == min) {\n h = s = 0;\n } else {\n var d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n h /= 6;\n }\n return { h, s, l };\n }\n function hslToRgb(h, s, l) {\n var r, g, b;\n h = bound01(h, 360);\n s = bound01(s, 100);\n l = bound01(l, 100);\n function hue2rgb(p2, q2, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p2 + (q2 - p2) * 6 * t;\n if (t < 1 / 2) return q2;\n if (t < 2 / 3) return p2 + (q2 - p2) * (2 / 3 - t) * 6;\n return p2;\n }\n if (s === 0) {\n r = g = b = l;\n } else {\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n return { r: r * 255, g: g * 255, b: b * 255 };\n }\n function rgbToHsv(r, g, b) {\n r = bound01(r, 255);\n g = bound01(g, 255);\n b = bound01(b, 255);\n var max = mathMax(r, g, b), min = mathMin(r, g, b);\n var h, s, v = max;\n var d = max - min;\n s = max === 0 ? 0 : d / max;\n if (max == min) {\n h = 0;\n } else {\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n h /= 6;\n }\n return { h, s, v };\n }\n function hsvToRgb(h, s, v) {\n h = bound01(h, 360) * 6;\n s = bound01(s, 100);\n v = bound01(v, 100);\n var i = Math2.floor(h), f = h - i, p = v * (1 - s), q = v * (1 - f * s), t = v * (1 - (1 - f) * s), mod = i % 6, r = [v, q, p, p, t, v][mod], g = [t, v, v, q, p, p][mod], b = [p, p, t, v, v, q][mod];\n return { r: r * 255, g: g * 255, b: b * 255 };\n }\n function rgbToHex(r, g, b, allow3Char) {\n var hex2 = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n if (allow3Char && hex2[0].charAt(0) == hex2[0].charAt(1) && hex2[1].charAt(0) == hex2[1].charAt(1) && hex2[2].charAt(0) == hex2[2].charAt(1)) {\n return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0);\n }\n return hex2.join(\"\");\n }\n function rgbaToHex(r, g, b, a, allow4Char) {\n var hex2 = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16)),\n pad2(convertDecimalToHex(a))\n ];\n if (allow4Char && hex2[0].charAt(0) == hex2[0].charAt(1) && hex2[1].charAt(0) == hex2[1].charAt(1) && hex2[2].charAt(0) == hex2[2].charAt(1) && hex2[3].charAt(0) == hex2[3].charAt(1)) {\n return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0) + hex2[3].charAt(0);\n }\n return hex2.join(\"\");\n }\n function rgbaToArgbHex(r, g, b, a) {\n var hex2 = [\n pad2(convertDecimalToHex(a)),\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n return hex2.join(\"\");\n }\n tinycolor.equals = function(color1, color2) {\n if (!color1 || !color2) {\n return false;\n }\n return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();\n };\n tinycolor.random = function() {\n return tinycolor.fromRatio({\n r: mathRandom(),\n g: mathRandom(),\n b: mathRandom()\n });\n };\n function desaturate(color2, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var hsl3 = tinycolor(color2).toHsl();\n hsl3.s -= amount / 100;\n hsl3.s = clamp01(hsl3.s);\n return tinycolor(hsl3);\n }\n function saturate(color2, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var hsl3 = tinycolor(color2).toHsl();\n hsl3.s += amount / 100;\n hsl3.s = clamp01(hsl3.s);\n return tinycolor(hsl3);\n }\n function greyscale(color2) {\n return tinycolor(color2).desaturate(100);\n }\n function lighten(color2, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var hsl3 = tinycolor(color2).toHsl();\n hsl3.l += amount / 100;\n hsl3.l = clamp01(hsl3.l);\n return tinycolor(hsl3);\n }\n function brighten(color2, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var rgb2 = tinycolor(color2).toRgb();\n rgb2.r = mathMax(0, mathMin(255, rgb2.r - mathRound(255 * -(amount / 100))));\n rgb2.g = mathMax(0, mathMin(255, rgb2.g - mathRound(255 * -(amount / 100))));\n rgb2.b = mathMax(0, mathMin(255, rgb2.b - mathRound(255 * -(amount / 100))));\n return tinycolor(rgb2);\n }\n function darken(color2, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var hsl3 = tinycolor(color2).toHsl();\n hsl3.l -= amount / 100;\n hsl3.l = clamp01(hsl3.l);\n return tinycolor(hsl3);\n }\n function spin(color2, amount) {\n var hsl3 = tinycolor(color2).toHsl();\n var hue2 = (hsl3.h + amount) % 360;\n hsl3.h = hue2 < 0 ? 360 + hue2 : hue2;\n return tinycolor(hsl3);\n }\n function complement(color2) {\n var hsl3 = tinycolor(color2).toHsl();\n hsl3.h = (hsl3.h + 180) % 360;\n return tinycolor(hsl3);\n }\n function triad(color2) {\n var hsl3 = tinycolor(color2).toHsl();\n var h = hsl3.h;\n return [\n tinycolor(color2),\n tinycolor({ h: (h + 120) % 360, s: hsl3.s, l: hsl3.l }),\n tinycolor({ h: (h + 240) % 360, s: hsl3.s, l: hsl3.l })\n ];\n }\n function tetrad(color2) {\n var hsl3 = tinycolor(color2).toHsl();\n var h = hsl3.h;\n return [\n tinycolor(color2),\n tinycolor({ h: (h + 90) % 360, s: hsl3.s, l: hsl3.l }),\n tinycolor({ h: (h + 180) % 360, s: hsl3.s, l: hsl3.l }),\n tinycolor({ h: (h + 270) % 360, s: hsl3.s, l: hsl3.l })\n ];\n }\n function splitcomplement(color2) {\n var hsl3 = tinycolor(color2).toHsl();\n var h = hsl3.h;\n return [\n tinycolor(color2),\n tinycolor({ h: (h + 72) % 360, s: hsl3.s, l: hsl3.l }),\n tinycolor({ h: (h + 216) % 360, s: hsl3.s, l: hsl3.l })\n ];\n }\n function analogous(color2, results, slices) {\n results = results || 6;\n slices = slices || 30;\n var hsl3 = tinycolor(color2).toHsl();\n var part = 360 / slices;\n var ret = [tinycolor(color2)];\n for (hsl3.h = (hsl3.h - (part * results >> 1) + 720) % 360; --results; ) {\n hsl3.h = (hsl3.h + part) % 360;\n ret.push(tinycolor(hsl3));\n }\n return ret;\n }\n function monochromatic(color2, results) {\n results = results || 6;\n var hsv = tinycolor(color2).toHsv();\n var h = hsv.h, s = hsv.s, v = hsv.v;\n var ret = [];\n var modification = 1 / results;\n while (results--) {\n ret.push(tinycolor({ h, s, v }));\n v = (v + modification) % 1;\n }\n return ret;\n }\n tinycolor.mix = function(color1, color2, amount) {\n amount = amount === 0 ? 0 : amount || 50;\n var rgb1 = tinycolor(color1).toRgb();\n var rgb2 = tinycolor(color2).toRgb();\n var p = amount / 100;\n var rgba3 = {\n r: (rgb2.r - rgb1.r) * p + rgb1.r,\n g: (rgb2.g - rgb1.g) * p + rgb1.g,\n b: (rgb2.b - rgb1.b) * p + rgb1.b,\n a: (rgb2.a - rgb1.a) * p + rgb1.a\n };\n return tinycolor(rgba3);\n };\n tinycolor.readability = function(color1, color2) {\n var c1 = tinycolor(color1);\n var c2 = tinycolor(color2);\n return (Math2.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math2.min(c1.getLuminance(), c2.getLuminance()) + 0.05);\n };\n tinycolor.isReadable = function(color1, color2, wcag2) {\n var readability = tinycolor.readability(color1, color2);\n var wcag2Parms, out;\n out = false;\n wcag2Parms = validateWCAG2Parms(wcag2);\n switch (wcag2Parms.level + wcag2Parms.size) {\n case \"AAsmall\":\n case \"AAAlarge\":\n out = readability >= 4.5;\n break;\n case \"AAlarge\":\n out = readability >= 3;\n break;\n case \"AAAsmall\":\n out = readability >= 7;\n break;\n }\n return out;\n };\n tinycolor.mostReadable = function(baseColor, colorList, args) {\n var bestColor = null;\n var bestScore = 0;\n var readability;\n var includeFallbackColors, level, size;\n args = args || {};\n includeFallbackColors = args.includeFallbackColors;\n level = args.level;\n size = args.size;\n for (var i = 0; i < colorList.length; i++) {\n readability = tinycolor.readability(baseColor, colorList[i]);\n if (readability > bestScore) {\n bestScore = readability;\n bestColor = tinycolor(colorList[i]);\n }\n }\n if (tinycolor.isReadable(baseColor, bestColor, { \"level\": level, \"size\": size }) || !includeFallbackColors) {\n return bestColor;\n } else {\n args.includeFallbackColors = false;\n return tinycolor.mostReadable(baseColor, [\"#fff\", \"#000\"], args);\n }\n };\n var names2 = tinycolor.names = {\n aliceblue: \"f0f8ff\",\n antiquewhite: \"faebd7\",\n aqua: \"0ff\",\n aquamarine: \"7fffd4\",\n azure: \"f0ffff\",\n beige: \"f5f5dc\",\n bisque: \"ffe4c4\",\n black: \"000\",\n blanchedalmond: \"ffebcd\",\n blue: \"00f\",\n blueviolet: \"8a2be2\",\n brown: \"a52a2a\",\n burlywood: \"deb887\",\n burntsienna: \"ea7e5d\",\n cadetblue: \"5f9ea0\",\n chartreuse: \"7fff00\",\n chocolate: \"d2691e\",\n coral: \"ff7f50\",\n cornflowerblue: \"6495ed\",\n cornsilk: \"fff8dc\",\n crimson: \"dc143c\",\n cyan: \"0ff\",\n darkblue: \"00008b\",\n darkcyan: \"008b8b\",\n darkgoldenrod: \"b8860b\",\n darkgray: \"a9a9a9\",\n darkgreen: \"006400\",\n darkgrey: \"a9a9a9\",\n darkkhaki: \"bdb76b\",\n darkmagenta: \"8b008b\",\n darkolivegreen: \"556b2f\",\n darkorange: \"ff8c00\",\n darkorchid: \"9932cc\",\n darkred: \"8b0000\",\n darksalmon: \"e9967a\",\n darkseagreen: \"8fbc8f\",\n darkslateblue: \"483d8b\",\n darkslategray: \"2f4f4f\",\n darkslategrey: \"2f4f4f\",\n darkturquoise: \"00ced1\",\n darkviolet: \"9400d3\",\n deeppink: \"ff1493\",\n deepskyblue: \"00bfff\",\n dimgray: \"696969\",\n dimgrey: \"696969\",\n dodgerblue: \"1e90ff\",\n firebrick: \"b22222\",\n floralwhite: \"fffaf0\",\n forestgreen: \"228b22\",\n fuchsia: \"f0f\",\n gainsboro: \"dcdcdc\",\n ghostwhite: \"f8f8ff\",\n gold: \"ffd700\",\n goldenrod: \"daa520\",\n gray: \"808080\",\n green: \"008000\",\n greenyellow: \"adff2f\",\n grey: \"808080\",\n honeydew: \"f0fff0\",\n hotpink: \"ff69b4\",\n indianred: \"cd5c5c\",\n indigo: \"4b0082\",\n ivory: \"fffff0\",\n khaki: \"f0e68c\",\n lavender: \"e6e6fa\",\n lavenderblush: \"fff0f5\",\n lawngreen: \"7cfc00\",\n lemonchiffon: \"fffacd\",\n lightblue: \"add8e6\",\n lightcoral: \"f08080\",\n lightcyan: \"e0ffff\",\n lightgoldenrodyellow: \"fafad2\",\n lightgray: \"d3d3d3\",\n lightgreen: \"90ee90\",\n lightgrey: \"d3d3d3\",\n lightpink: \"ffb6c1\",\n lightsalmon: \"ffa07a\",\n lightseagreen: \"20b2aa\",\n lightskyblue: \"87cefa\",\n lightslategray: \"789\",\n lightslategrey: \"789\",\n lightsteelblue: \"b0c4de\",\n lightyellow: \"ffffe0\",\n lime: \"0f0\",\n limegreen: \"32cd32\",\n linen: \"faf0e6\",\n magenta: \"f0f\",\n maroon: \"800000\",\n mediumaquamarine: \"66cdaa\",\n mediumblue: \"0000cd\",\n mediumorchid: \"ba55d3\",\n mediumpurple: \"9370db\",\n mediumseagreen: \"3cb371\",\n mediumslateblue: \"7b68ee\",\n mediumspringgreen: \"00fa9a\",\n mediumturquoise: \"48d1cc\",\n mediumvioletred: \"c71585\",\n midnightblue: \"191970\",\n mintcream: \"f5fffa\",\n mistyrose: \"ffe4e1\",\n moccasin: \"ffe4b5\",\n navajowhite: \"ffdead\",\n navy: \"000080\",\n oldlace: \"fdf5e6\",\n olive: \"808000\",\n olivedrab: \"6b8e23\",\n orange: \"ffa500\",\n orangered: \"ff4500\",\n orchid: \"da70d6\",\n palegoldenrod: \"eee8aa\",\n palegreen: \"98fb98\",\n paleturquoise: \"afeeee\",\n palevioletred: \"db7093\",\n papayawhip: \"ffefd5\",\n peachpuff: \"ffdab9\",\n peru: \"cd853f\",\n pink: \"ffc0cb\",\n plum: \"dda0dd\",\n powderblue: \"b0e0e6\",\n purple: \"800080\",\n rebeccapurple: \"663399\",\n red: \"f00\",\n rosybrown: \"bc8f8f\",\n royalblue: \"4169e1\",\n saddlebrown: \"8b4513\",\n salmon: \"fa8072\",\n sandybrown: \"f4a460\",\n seagreen: \"2e8b57\",\n seashell: \"fff5ee\",\n sienna: \"a0522d\",\n silver: \"c0c0c0\",\n skyblue: \"87ceeb\",\n slateblue: \"6a5acd\",\n slategray: \"708090\",\n slategrey: \"708090\",\n snow: \"fffafa\",\n springgreen: \"00ff7f\",\n steelblue: \"4682b4\",\n tan: \"d2b48c\",\n teal: \"008080\",\n thistle: \"d8bfd8\",\n tomato: \"ff6347\",\n turquoise: \"40e0d0\",\n violet: \"ee82ee\",\n wheat: \"f5deb3\",\n white: \"fff\",\n whitesmoke: \"f5f5f5\",\n yellow: \"ff0\",\n yellowgreen: \"9acd32\"\n };\n var hexNames = tinycolor.hexNames = flip(names2);\n function flip(o) {\n var flipped = {};\n for (var i in o) {\n if (o.hasOwnProperty(i)) {\n flipped[o[i]] = i;\n }\n }\n return flipped;\n }\n function boundAlpha(a) {\n a = parseFloat(a);\n if (isNaN(a) || a < 0 || a > 1) {\n a = 1;\n }\n return a;\n }\n function bound01(n, max) {\n if (isOnePointZero(n)) {\n n = \"100%\";\n }\n var processPercent = isPercentage(n);\n n = mathMin(max, mathMax(0, parseFloat(n)));\n if (processPercent) {\n n = parseInt(n * max, 10) / 100;\n }\n if (Math2.abs(n - max) < 1e-6) {\n return 1;\n }\n return n % max / parseFloat(max);\n }\n function clamp01(val) {\n return mathMin(1, mathMax(0, val));\n }\n function parseIntFromHex(val) {\n return parseInt(val, 16);\n }\n function isOnePointZero(n) {\n return typeof n == \"string\" && n.indexOf(\".\") != -1 && parseFloat(n) === 1;\n }\n function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf(\"%\") != -1;\n }\n function pad2(c) {\n return c.length == 1 ? \"0\" + c : \"\" + c;\n }\n function convertToPercentage(n) {\n if (n <= 1) {\n n = n * 100 + \"%\";\n }\n return n;\n }\n function convertDecimalToHex(d) {\n return Math2.round(parseFloat(d) * 255).toString(16);\n }\n function convertHexToDecimal(h) {\n return parseIntFromHex(h) / 255;\n }\n var matchers = function() {\n var CSS_INTEGER = \"[-\\\\+]?\\\\d+%?\";\n var CSS_NUMBER = \"[-\\\\+]?\\\\d*\\\\.\\\\d+%?\";\n var CSS_UNIT = \"(?:\" + CSS_NUMBER + \")|(?:\" + CSS_INTEGER + \")\";\n var PERMISSIVE_MATCH3 = \"[\\\\s|\\\\(]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")\\\\s*\\\\)?\";\n var PERMISSIVE_MATCH4 = \"[\\\\s|\\\\(]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")\\\\s*\\\\)?\";\n return {\n CSS_UNIT: new RegExp(CSS_UNIT),\n rgb: new RegExp(\"rgb\" + PERMISSIVE_MATCH3),\n rgba: new RegExp(\"rgba\" + PERMISSIVE_MATCH4),\n hsl: new RegExp(\"hsl\" + PERMISSIVE_MATCH3),\n hsla: new RegExp(\"hsla\" + PERMISSIVE_MATCH4),\n hsv: new RegExp(\"hsv\" + PERMISSIVE_MATCH3),\n hsva: new RegExp(\"hsva\" + PERMISSIVE_MATCH4),\n hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,\n hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,\n hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,\n hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/\n };\n }();\n function isValidCSSUnit(color2) {\n return !!matchers.CSS_UNIT.exec(color2);\n }\n function stringInputToObject(color2) {\n color2 = color2.replace(trimLeft, \"\").replace(trimRight, \"\").toLowerCase();\n var named2 = false;\n if (names2[color2]) {\n color2 = names2[color2];\n named2 = true;\n } else if (color2 == \"transparent\") {\n return { r: 0, g: 0, b: 0, a: 0, format: \"name\" };\n }\n var match;\n if (match = matchers.rgb.exec(color2)) {\n return { r: match[1], g: match[2], b: match[3] };\n }\n if (match = matchers.rgba.exec(color2)) {\n return { r: match[1], g: match[2], b: match[3], a: match[4] };\n }\n if (match = matchers.hsl.exec(color2)) {\n return { h: match[1], s: match[2], l: match[3] };\n }\n if (match = matchers.hsla.exec(color2)) {\n return { h: match[1], s: match[2], l: match[3], a: match[4] };\n }\n if (match = matchers.hsv.exec(color2)) {\n return { h: match[1], s: match[2], v: match[3] };\n }\n if (match = matchers.hsva.exec(color2)) {\n return { h: match[1], s: match[2], v: match[3], a: match[4] };\n }\n if (match = matchers.hex8.exec(color2)) {\n return {\n r: parseIntFromHex(match[1]),\n g: parseIntFromHex(match[2]),\n b: parseIntFromHex(match[3]),\n a: convertHexToDecimal(match[4]),\n format: named2 ? \"name\" : \"hex8\"\n };\n }\n if (match = matchers.hex6.exec(color2)) {\n return {\n r: parseIntFromHex(match[1]),\n g: parseIntFromHex(match[2]),\n b: parseIntFromHex(match[3]),\n format: named2 ? \"name\" : \"hex\"\n };\n }\n if (match = matchers.hex4.exec(color2)) {\n return {\n r: parseIntFromHex(match[1] + \"\" + match[1]),\n g: parseIntFromHex(match[2] + \"\" + match[2]),\n b: parseIntFromHex(match[3] + \"\" + match[3]),\n a: convertHexToDecimal(match[4] + \"\" + match[4]),\n format: named2 ? \"name\" : \"hex8\"\n };\n }\n if (match = matchers.hex3.exec(color2)) {\n return {\n r: parseIntFromHex(match[1] + \"\" + match[1]),\n g: parseIntFromHex(match[2] + \"\" + match[2]),\n b: parseIntFromHex(match[3] + \"\" + match[3]),\n format: named2 ? \"name\" : \"hex\"\n };\n }\n return false;\n }\n function validateWCAG2Parms(parms) {\n var level, size;\n parms = parms || { \"level\": \"AA\", \"size\": \"small\" };\n level = (parms.level || \"AA\").toUpperCase();\n size = (parms.size || \"small\").toLowerCase();\n if (level !== \"AA\" && level !== \"AAA\") {\n level = \"AA\";\n }\n if (size !== \"small\" && size !== \"large\") {\n size = \"small\";\n }\n return { \"level\": level, \"size\": size };\n }\n if (typeof module !== \"undefined\" && module.exports) {\n module.exports = tinycolor;\n } else if (typeof define === \"function\" && false) {\n define(function() {\n return tinycolor;\n });\n } else {\n window.tinycolor = tinycolor;\n }\n })(Math);\n }\n });\n\n // src/lib/extend.js\n var require_extend = __commonJS({\n \"src/lib/extend.js\"(exports) {\n \"use strict\";\n var isPlainObject = require_is_plain_object();\n var isArray = Array.isArray;\n function primitivesLoopSplice(source, target) {\n var i, value;\n for (i = 0; i < source.length; i++) {\n value = source[i];\n if (value !== null && typeof value === \"object\") {\n return false;\n }\n if (value !== void 0) {\n target[i] = value;\n }\n }\n return true;\n }\n exports.extendFlat = function() {\n return _extend(arguments, false, false, false);\n };\n exports.extendDeep = function() {\n return _extend(arguments, true, false, false);\n };\n exports.extendDeepAll = function() {\n return _extend(arguments, true, true, false);\n };\n exports.extendDeepNoArrays = function() {\n return _extend(arguments, true, false, true);\n };\n function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) {\n var target = inputs[0];\n var length = inputs.length;\n var input, key, src, copy, copyIsArray, clone, allPrimitives;\n if (length === 2 && isArray(target) && isArray(inputs[1]) && target.length === 0) {\n allPrimitives = primitivesLoopSplice(inputs[1], target);\n if (allPrimitives) {\n return target;\n } else {\n target.splice(0, target.length);\n }\n }\n for (var i = 1; i < length; i++) {\n input = inputs[i];\n for (key in input) {\n src = target[key];\n copy = input[key];\n if (noArrayCopies && isArray(copy)) {\n target[key] = copy;\n } else if (isDeep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n if (copyIsArray) {\n copyIsArray = false;\n clone = src && isArray(src) ? src : [];\n } else {\n clone = src && isPlainObject(src) ? src : {};\n }\n target[key] = _extend([clone, copy], isDeep, keepAllKeys, noArrayCopies);\n } else if (typeof copy !== \"undefined\" || keepAllKeys) {\n target[key] = copy;\n }\n }\n }\n return target;\n }\n }\n });\n\n // src/plots/font_attributes.js\n var require_font_attributes = __commonJS({\n \"src/plots/font_attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = function(opts) {\n var variantValues = opts.variantValues;\n var editType = opts.editType;\n var colorEditType = opts.colorEditType;\n if (colorEditType === void 0) colorEditType = editType;\n var weight = {\n editType,\n valType: \"integer\",\n min: 1,\n max: 1e3,\n extras: [\"normal\", \"bold\"],\n dflt: \"normal\"\n };\n if (opts.noNumericWeightValues) {\n weight.valType = \"enumerated\";\n weight.values = weight.extras;\n weight.extras = void 0;\n weight.min = void 0;\n weight.max = void 0;\n }\n var attrs = {\n family: {\n valType: \"string\",\n noBlank: true,\n strict: true,\n editType\n },\n size: {\n valType: \"number\",\n min: 1,\n editType\n },\n color: {\n valType: \"color\",\n editType: colorEditType\n },\n weight,\n style: {\n editType,\n valType: \"enumerated\",\n values: [\"normal\", \"italic\"],\n dflt: \"normal\"\n },\n variant: opts.noFontVariant ? void 0 : {\n editType,\n valType: \"enumerated\",\n values: variantValues || [\n \"normal\",\n \"small-caps\",\n \"all-small-caps\",\n \"all-petite-caps\",\n \"petite-caps\",\n \"unicase\"\n ],\n dflt: \"normal\"\n },\n textcase: opts.noFontTextcase ? void 0 : {\n editType,\n valType: \"enumerated\",\n values: [\"normal\", \"word caps\", \"upper\", \"lower\"],\n dflt: \"normal\"\n },\n lineposition: opts.noFontLineposition ? void 0 : {\n editType,\n valType: \"flaglist\",\n flags: [\"under\", \"over\", \"through\"],\n extras: [\"none\"],\n dflt: \"none\"\n },\n shadow: opts.noFontShadow ? void 0 : {\n editType,\n valType: \"string\",\n dflt: opts.autoShadowDflt ? \"auto\" : \"none\"\n },\n editType\n // blank strings so compress_attributes can remove\n // TODO - that's uber hacky... better solution?\n };\n if (opts.autoSize) attrs.size.dflt = \"auto\";\n if (opts.autoColor) attrs.color.dflt = \"auto\";\n if (opts.arrayOk) {\n attrs.family.arrayOk = true;\n attrs.weight.arrayOk = true;\n attrs.style.arrayOk = true;\n if (!opts.noFontVariant) {\n attrs.variant.arrayOk = true;\n }\n if (!opts.noFontTextcase) {\n attrs.textcase.arrayOk = true;\n }\n if (!opts.noFontLineposition) {\n attrs.lineposition.arrayOk = true;\n }\n if (!opts.noFontShadow) {\n attrs.shadow.arrayOk = true;\n }\n attrs.size.arrayOk = true;\n attrs.color.arrayOk = true;\n }\n return attrs;\n };\n }\n });\n\n // src/components/fx/constants.js\n var require_constants = __commonJS({\n \"src/components/fx/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n // hover labels for multiple horizontal bars get tilted by this angle\n YANGLE: 60,\n // size and display constants for hover text\n // pixel size of hover arrows\n HOVERARROWSIZE: 6,\n // pixels padding around text\n HOVERTEXTPAD: 3,\n // hover font\n HOVERFONTSIZE: 13,\n HOVERFONT: \"Arial, sans-serif\",\n // minimum time (msec) between hover calls\n HOVERMINTIME: 50,\n // ID suffix (with fullLayout._uid) for hover events in the throttle cache\n HOVERID: \"-hover\"\n };\n }\n });\n\n // src/components/fx/layout_attributes.js\n var require_layout_attributes = __commonJS({\n \"src/components/fx/layout_attributes.js\"(exports, module) {\n \"use strict\";\n var constants = require_constants();\n var fontAttrs = require_font_attributes();\n var font = fontAttrs({\n editType: \"none\"\n });\n font.family.dflt = constants.HOVERFONT;\n font.size.dflt = constants.HOVERFONTSIZE;\n module.exports = {\n clickmode: {\n valType: \"flaglist\",\n flags: [\"event\", \"select\"],\n dflt: \"event\",\n editType: \"plot\",\n extras: [\"none\"]\n },\n dragmode: {\n valType: \"enumerated\",\n values: [\n \"zoom\",\n \"pan\",\n \"select\",\n \"lasso\",\n \"drawclosedpath\",\n \"drawopenpath\",\n \"drawline\",\n \"drawrect\",\n \"drawcircle\",\n \"orbit\",\n \"turntable\",\n false\n ],\n dflt: \"zoom\",\n editType: \"modebar\"\n },\n hovermode: {\n valType: \"enumerated\",\n values: [\"x\", \"y\", \"closest\", false, \"x unified\", \"y unified\"],\n dflt: \"closest\",\n editType: \"modebar\"\n },\n hoversubplots: {\n valType: \"enumerated\",\n values: [\"single\", \"overlaying\", \"axis\"],\n dflt: \"overlaying\",\n editType: \"none\"\n },\n hoverdistance: {\n valType: \"integer\",\n min: -1,\n dflt: 20,\n editType: \"none\"\n },\n spikedistance: {\n valType: \"integer\",\n min: -1,\n dflt: -1,\n editType: \"none\"\n },\n hoverlabel: {\n bgcolor: {\n valType: \"color\",\n editType: \"none\"\n },\n bordercolor: {\n valType: \"color\",\n editType: \"none\"\n },\n font,\n grouptitlefont: fontAttrs({\n editType: \"none\"\n }),\n align: {\n valType: \"enumerated\",\n values: [\"left\", \"right\", \"auto\"],\n dflt: \"auto\",\n editType: \"none\"\n },\n namelength: {\n valType: \"integer\",\n min: -1,\n dflt: 15,\n editType: \"none\"\n },\n editType: \"none\"\n },\n selectdirection: {\n valType: \"enumerated\",\n values: [\"h\", \"v\", \"d\", \"any\"],\n dflt: \"any\",\n editType: \"none\"\n }\n };\n }\n });\n\n // src/components/fx/attributes.js\n var require_attributes = __commonJS({\n \"src/components/fx/attributes.js\"(exports, module) {\n \"use strict\";\n var fontAttrs = require_font_attributes();\n var hoverLabelAttrs = require_layout_attributes().hoverlabel;\n var extendFlat = require_extend().extendFlat;\n module.exports = {\n hoverlabel: {\n bgcolor: extendFlat({}, hoverLabelAttrs.bgcolor, {\n arrayOk: true\n }),\n bordercolor: extendFlat({}, hoverLabelAttrs.bordercolor, {\n arrayOk: true\n }),\n font: fontAttrs({\n arrayOk: true,\n editType: \"none\"\n }),\n align: extendFlat({}, hoverLabelAttrs.align, { arrayOk: true }),\n namelength: extendFlat({}, hoverLabelAttrs.namelength, { arrayOk: true }),\n editType: \"none\"\n }\n };\n }\n });\n\n // src/plots/attributes.js\n var require_attributes2 = __commonJS({\n \"src/plots/attributes.js\"(exports, module) {\n \"use strict\";\n var fontAttrs = require_font_attributes();\n var fxAttrs = require_attributes();\n module.exports = {\n type: {\n valType: \"enumerated\",\n values: [],\n // listed dynamically\n dflt: \"scatter\",\n editType: \"calc+clearAxisTypes\",\n _noTemplating: true\n // we handle this at a higher level\n },\n visible: {\n valType: \"enumerated\",\n values: [true, false, \"legendonly\"],\n dflt: true,\n editType: \"calc\"\n },\n showlegend: {\n valType: \"boolean\",\n dflt: true,\n editType: \"style\"\n },\n legend: {\n valType: \"subplotid\",\n dflt: \"legend\",\n editType: \"style\"\n },\n legendgroup: {\n valType: \"string\",\n dflt: \"\",\n editType: \"style\"\n },\n legendgrouptitle: {\n text: {\n valType: \"string\",\n dflt: \"\",\n editType: \"style\"\n },\n font: fontAttrs({\n editType: \"style\"\n }),\n editType: \"style\"\n },\n legendrank: {\n valType: \"number\",\n dflt: 1e3,\n editType: \"style\"\n },\n legendwidth: {\n valType: \"number\",\n min: 0,\n editType: \"style\"\n },\n opacity: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 1,\n editType: \"style\"\n },\n name: {\n valType: \"string\",\n editType: \"style\"\n },\n uid: {\n valType: \"string\",\n editType: \"plot\",\n anim: true\n },\n ids: {\n valType: \"data_array\",\n editType: \"calc\",\n anim: true\n },\n customdata: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n meta: {\n valType: \"any\",\n arrayOk: true,\n editType: \"plot\"\n },\n // N.B. these cannot be 'data_array' as they do not have the same length as\n // other data arrays and arrayOk attributes in general\n //\n // Maybe add another valType:\n // https://github.com/plotly/plotly.js/issues/1894\n selectedpoints: {\n valType: \"any\",\n editType: \"calc\"\n },\n hoverinfo: {\n valType: \"flaglist\",\n flags: [\"x\", \"y\", \"z\", \"text\", \"name\"],\n extras: [\"all\", \"none\", \"skip\"],\n arrayOk: true,\n dflt: \"all\",\n editType: \"none\"\n },\n hoverlabel: fxAttrs.hoverlabel,\n stream: {\n token: {\n valType: \"string\",\n noBlank: true,\n strict: true,\n editType: \"calc\"\n },\n maxpoints: {\n valType: \"number\",\n min: 0,\n max: 1e4,\n dflt: 500,\n editType: \"calc\"\n },\n editType: \"calc\"\n },\n uirevision: {\n valType: \"any\",\n editType: \"none\"\n }\n };\n }\n });\n\n // src/components/colorscale/scales.js\n var require_scales = __commonJS({\n \"src/components/colorscale/scales.js\"(exports, module) {\n \"use strict\";\n var tinycolor = require_tinycolor();\n var scales = {\n Greys: [\n [0, \"rgb(0,0,0)\"],\n [1, \"rgb(255,255,255)\"]\n ],\n YlGnBu: [\n [0, \"rgb(8,29,88)\"],\n [0.125, \"rgb(37,52,148)\"],\n [0.25, \"rgb(34,94,168)\"],\n [0.375, \"rgb(29,145,192)\"],\n [0.5, \"rgb(65,182,196)\"],\n [0.625, \"rgb(127,205,187)\"],\n [0.75, \"rgb(199,233,180)\"],\n [0.875, \"rgb(237,248,217)\"],\n [1, \"rgb(255,255,217)\"]\n ],\n Greens: [\n [0, \"rgb(0,68,27)\"],\n [0.125, \"rgb(0,109,44)\"],\n [0.25, \"rgb(35,139,69)\"],\n [0.375, \"rgb(65,171,93)\"],\n [0.5, \"rgb(116,196,118)\"],\n [0.625, \"rgb(161,217,155)\"],\n [0.75, \"rgb(199,233,192)\"],\n [0.875, \"rgb(229,245,224)\"],\n [1, \"rgb(247,252,245)\"]\n ],\n YlOrRd: [\n [0, \"rgb(128,0,38)\"],\n [0.125, \"rgb(189,0,38)\"],\n [0.25, \"rgb(227,26,28)\"],\n [0.375, \"rgb(252,78,42)\"],\n [0.5, \"rgb(253,141,60)\"],\n [0.625, \"rgb(254,178,76)\"],\n [0.75, \"rgb(254,217,118)\"],\n [0.875, \"rgb(255,237,160)\"],\n [1, \"rgb(255,255,204)\"]\n ],\n Bluered: [\n [0, \"rgb(0,0,255)\"],\n [1, \"rgb(255,0,0)\"]\n ],\n // modified RdBu based on\n // http://www.kennethmoreland.com/color-maps/\n RdBu: [\n [0, \"rgb(5,10,172)\"],\n [0.35, \"rgb(106,137,247)\"],\n [0.5, \"rgb(190,190,190)\"],\n [0.6, \"rgb(220,170,132)\"],\n [0.7, \"rgb(230,145,90)\"],\n [1, \"rgb(178,10,28)\"]\n ],\n // Scale for non-negative numeric values\n Reds: [\n [0, \"rgb(220,220,220)\"],\n [0.2, \"rgb(245,195,157)\"],\n [0.4, \"rgb(245,160,105)\"],\n [1, \"rgb(178,10,28)\"]\n ],\n // Scale for non-positive numeric values\n Blues: [\n [0, \"rgb(5,10,172)\"],\n [0.35, \"rgb(40,60,190)\"],\n [0.5, \"rgb(70,100,245)\"],\n [0.6, \"rgb(90,120,245)\"],\n [0.7, \"rgb(106,137,247)\"],\n [1, \"rgb(220,220,220)\"]\n ],\n Picnic: [\n [0, \"rgb(0,0,255)\"],\n [0.1, \"rgb(51,153,255)\"],\n [0.2, \"rgb(102,204,255)\"],\n [0.3, \"rgb(153,204,255)\"],\n [0.4, \"rgb(204,204,255)\"],\n [0.5, \"rgb(255,255,255)\"],\n [0.6, \"rgb(255,204,255)\"],\n [0.7, \"rgb(255,153,255)\"],\n [0.8, \"rgb(255,102,204)\"],\n [0.9, \"rgb(255,102,102)\"],\n [1, \"rgb(255,0,0)\"]\n ],\n Rainbow: [\n [0, \"rgb(150,0,90)\"],\n [0.125, \"rgb(0,0,200)\"],\n [0.25, \"rgb(0,25,255)\"],\n [0.375, \"rgb(0,152,255)\"],\n [0.5, \"rgb(44,255,150)\"],\n [0.625, \"rgb(151,255,0)\"],\n [0.75, \"rgb(255,234,0)\"],\n [0.875, \"rgb(255,111,0)\"],\n [1, \"rgb(255,0,0)\"]\n ],\n Portland: [\n [0, \"rgb(12,51,131)\"],\n [0.25, \"rgb(10,136,186)\"],\n [0.5, \"rgb(242,211,56)\"],\n [0.75, \"rgb(242,143,56)\"],\n [1, \"rgb(217,30,30)\"]\n ],\n Jet: [\n [0, \"rgb(0,0,131)\"],\n [0.125, \"rgb(0,60,170)\"],\n [0.375, \"rgb(5,255,255)\"],\n [0.625, \"rgb(255,255,0)\"],\n [0.875, \"rgb(250,0,0)\"],\n [1, \"rgb(128,0,0)\"]\n ],\n Hot: [\n [0, \"rgb(0,0,0)\"],\n [0.3, \"rgb(230,0,0)\"],\n [0.6, \"rgb(255,210,0)\"],\n [1, \"rgb(255,255,255)\"]\n ],\n Blackbody: [\n [0, \"rgb(0,0,0)\"],\n [0.2, \"rgb(230,0,0)\"],\n [0.4, \"rgb(230,210,0)\"],\n [0.7, \"rgb(255,255,255)\"],\n [1, \"rgb(160,200,255)\"]\n ],\n Earth: [\n [0, \"rgb(0,0,130)\"],\n [0.1, \"rgb(0,180,180)\"],\n [0.2, \"rgb(40,210,40)\"],\n [0.4, \"rgb(230,230,50)\"],\n [0.6, \"rgb(120,70,20)\"],\n [1, \"rgb(255,255,255)\"]\n ],\n Electric: [\n [0, \"rgb(0,0,0)\"],\n [0.15, \"rgb(30,0,100)\"],\n [0.4, \"rgb(120,0,100)\"],\n [0.6, \"rgb(160,90,0)\"],\n [0.8, \"rgb(230,200,0)\"],\n [1, \"rgb(255,250,220)\"]\n ],\n Viridis: [\n [0, \"#440154\"],\n [0.06274509803921569, \"#48186a\"],\n [0.12549019607843137, \"#472d7b\"],\n [0.18823529411764706, \"#424086\"],\n [0.25098039215686274, \"#3b528b\"],\n [0.3137254901960784, \"#33638d\"],\n [0.3764705882352941, \"#2c728e\"],\n [0.4392156862745098, \"#26828e\"],\n [0.5019607843137255, \"#21918c\"],\n [0.5647058823529412, \"#1fa088\"],\n [0.6274509803921569, \"#28ae80\"],\n [0.6901960784313725, \"#3fbc73\"],\n [0.7529411764705882, \"#5ec962\"],\n [0.8156862745098039, \"#84d44b\"],\n [0.8784313725490196, \"#addc30\"],\n [0.9411764705882353, \"#d8e219\"],\n [1, \"#fde725\"]\n ],\n Cividis: [\n [0, \"rgb(0,32,76)\"],\n [0.058824, \"rgb(0,42,102)\"],\n [0.117647, \"rgb(0,52,110)\"],\n [0.176471, \"rgb(39,63,108)\"],\n [0.235294, \"rgb(60,74,107)\"],\n [0.294118, \"rgb(76,85,107)\"],\n [0.352941, \"rgb(91,95,109)\"],\n [0.411765, \"rgb(104,106,112)\"],\n [0.470588, \"rgb(117,117,117)\"],\n [0.529412, \"rgb(131,129,120)\"],\n [0.588235, \"rgb(146,140,120)\"],\n [0.647059, \"rgb(161,152,118)\"],\n [0.705882, \"rgb(176,165,114)\"],\n [0.764706, \"rgb(192,177,109)\"],\n [0.823529, \"rgb(209,191,102)\"],\n [0.882353, \"rgb(225,204,92)\"],\n [0.941176, \"rgb(243,219,79)\"],\n [1, \"rgb(255,233,69)\"]\n ]\n };\n var defaultScale = scales.RdBu;\n function getScale(scl, dflt) {\n if (!dflt) dflt = defaultScale;\n if (!scl) return dflt;\n function parseScale() {\n try {\n scl = scales[scl] || JSON.parse(scl);\n } catch (e) {\n scl = dflt;\n }\n }\n if (typeof scl === \"string\") {\n parseScale();\n if (typeof scl === \"string\") parseScale();\n }\n if (!isValidScaleArray(scl)) return dflt;\n return scl;\n }\n function isValidScaleArray(scl) {\n var highestVal = 0;\n if (!Array.isArray(scl) || scl.length < 2) return false;\n if (!scl[0] || !scl[scl.length - 1]) return false;\n if (+scl[0][0] !== 0 || +scl[scl.length - 1][0] !== 1) return false;\n for (var i = 0; i < scl.length; i++) {\n var si = scl[i];\n if (si.length !== 2 || +si[0] < highestVal || !tinycolor(si[1]).isValid()) {\n return false;\n }\n highestVal = +si[0];\n }\n return true;\n }\n function isValidScale(scl) {\n if (scales[scl] !== void 0) return true;\n else return isValidScaleArray(scl);\n }\n module.exports = {\n scales,\n defaultScale,\n get: getScale,\n isValid: isValidScale\n };\n }\n });\n\n // src/components/color/attributes.js\n var require_attributes3 = __commonJS({\n \"src/components/color/attributes.js\"(exports) {\n \"use strict\";\n exports.defaults = [\n \"#1f77b4\",\n // muted blue\n \"#ff7f0e\",\n // safety orange\n \"#2ca02c\",\n // cooked asparagus green\n \"#d62728\",\n // brick red\n \"#9467bd\",\n // muted purple\n \"#8c564b\",\n // chestnut brown\n \"#e377c2\",\n // raspberry yogurt pink\n \"#7f7f7f\",\n // middle gray\n \"#bcbd22\",\n // curry yellow-green\n \"#17becf\"\n // blue-teal\n ];\n exports.defaultLine = \"#444\";\n exports.lightLine = \"#eee\";\n exports.background = \"#fff\";\n exports.borderLine = \"#BEC8D9\";\n exports.lightFraction = 100 * (14 - 4) / (15 - 4);\n }\n });\n\n // src/components/color/index.js\n var require_color = __commonJS({\n \"src/components/color/index.js\"(exports, module) {\n \"use strict\";\n var tinycolor = require_tinycolor();\n var isNumeric = require_fast_isnumeric();\n var isTypedArray = require_array().isTypedArray;\n var color2 = module.exports = {};\n var colorAttrs = require_attributes3();\n color2.defaults = colorAttrs.defaults;\n var defaultLine = color2.defaultLine = colorAttrs.defaultLine;\n color2.lightLine = colorAttrs.lightLine;\n var background = color2.background = colorAttrs.background;\n color2.tinyRGB = function(tc) {\n var c = tc.toRgb();\n return \"rgb(\" + Math.round(c.r) + \", \" + Math.round(c.g) + \", \" + Math.round(c.b) + \")\";\n };\n color2.rgb = function(cstr) {\n return color2.tinyRGB(tinycolor(cstr));\n };\n color2.opacity = function(cstr) {\n return cstr ? tinycolor(cstr).getAlpha() : 0;\n };\n color2.addOpacity = function(cstr, op) {\n var c = tinycolor(cstr).toRgb();\n return \"rgba(\" + Math.round(c.r) + \", \" + Math.round(c.g) + \", \" + Math.round(c.b) + \", \" + op + \")\";\n };\n color2.combine = function(front, back) {\n var fc = tinycolor(front).toRgb();\n if (fc.a === 1) return tinycolor(front).toRgbString();\n var bc = tinycolor(back || background).toRgb();\n var bcflat = bc.a === 1 ? bc : {\n r: 255 * (1 - bc.a) + bc.r * bc.a,\n g: 255 * (1 - bc.a) + bc.g * bc.a,\n b: 255 * (1 - bc.a) + bc.b * bc.a\n };\n var fcflat = {\n r: bcflat.r * (1 - fc.a) + fc.r * fc.a,\n g: bcflat.g * (1 - fc.a) + fc.g * fc.a,\n b: bcflat.b * (1 - fc.a) + fc.b * fc.a\n };\n return tinycolor(fcflat).toRgbString();\n };\n color2.interpolate = function(first, second, factor) {\n var fc = tinycolor(first).toRgb();\n var sc = tinycolor(second).toRgb();\n var ic = {\n r: factor * fc.r + (1 - factor) * sc.r,\n g: factor * fc.g + (1 - factor) * sc.g,\n b: factor * fc.b + (1 - factor) * sc.b\n };\n return tinycolor(ic).toRgbString();\n };\n color2.contrast = function(cstr, lightAmount, darkAmount) {\n var tc = tinycolor(cstr);\n if (tc.getAlpha() !== 1) tc = tinycolor(color2.combine(cstr, background));\n var newColor = tc.isDark() ? lightAmount ? tc.lighten(lightAmount) : background : darkAmount ? tc.darken(darkAmount) : defaultLine;\n return newColor.toString();\n };\n color2.stroke = function(s, c) {\n var tc = tinycolor(c);\n s.style({ stroke: color2.tinyRGB(tc), \"stroke-opacity\": tc.getAlpha() });\n };\n color2.fill = function(s, c) {\n var tc = tinycolor(c);\n s.style({\n fill: color2.tinyRGB(tc),\n \"fill-opacity\": tc.getAlpha()\n });\n };\n color2.clean = function(container) {\n if (!container || typeof container !== \"object\") return;\n var keys = Object.keys(container);\n var i, j, key, val;\n for (i = 0; i < keys.length; i++) {\n key = keys[i];\n val = container[key];\n if (key.substr(key.length - 5) === \"color\") {\n if (Array.isArray(val)) {\n for (j = 0; j < val.length; j++) val[j] = cleanOne(val[j]);\n } else container[key] = cleanOne(val);\n } else if (key.substr(key.length - 10) === \"colorscale\" && Array.isArray(val)) {\n for (j = 0; j < val.length; j++) {\n if (Array.isArray(val[j])) val[j][1] = cleanOne(val[j][1]);\n }\n } else if (Array.isArray(val)) {\n var el0 = val[0];\n if (!Array.isArray(el0) && el0 && typeof el0 === \"object\") {\n for (j = 0; j < val.length; j++) color2.clean(val[j]);\n }\n } else if (val && typeof val === \"object\" && !isTypedArray(val)) color2.clean(val);\n }\n };\n function cleanOne(val) {\n if (isNumeric(val) || typeof val !== \"string\") return val;\n var valTrim = val.trim();\n if (valTrim.substr(0, 3) !== \"rgb\") return val;\n var match = valTrim.match(/^rgba?\\s*\\(([^()]*)\\)$/);\n if (!match) return val;\n var parts = match[1].trim().split(/\\s*[\\s,]\\s*/);\n var rgba3 = valTrim.charAt(3) === \"a\" && parts.length === 4;\n if (!rgba3 && parts.length !== 3) return val;\n for (var i = 0; i < parts.length; i++) {\n if (!parts[i].length) return val;\n parts[i] = Number(parts[i]);\n if (!(parts[i] >= 0)) {\n return val;\n }\n if (i === 3) {\n if (parts[i] > 1) parts[i] = 1;\n } else if (parts[i] >= 1) {\n return val;\n }\n }\n var rgbStr = Math.round(parts[0] * 255) + \", \" + Math.round(parts[1] * 255) + \", \" + Math.round(parts[2] * 255);\n if (rgba3) return \"rgba(\" + rgbStr + \", \" + parts[3] + \")\";\n return \"rgb(\" + rgbStr + \")\";\n }\n }\n });\n\n // src/constants/interactions.js\n var require_interactions = __commonJS({\n \"src/constants/interactions.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n /**\n * Timing information for interactive elements\n */\n SHOW_PLACEHOLDER: 100,\n HIDE_PLACEHOLDER: 1e3,\n // opacity dimming fraction for points that are not in selection\n DESELECTDIM: 0.2\n };\n }\n });\n\n // src/lib/regex.js\n var require_regex = __commonJS({\n \"src/lib/regex.js\"(exports) {\n \"use strict\";\n exports.counter = function(head, tail, openEnded, matchBeginning) {\n var fullTail = (tail || \"\") + (openEnded ? \"\" : \"$\");\n var startWithPrefix = matchBeginning === false ? \"\" : \"^\";\n if (head === \"xy\") {\n return new RegExp(startWithPrefix + \"x([2-9]|[1-9][0-9]+)?y([2-9]|[1-9][0-9]+)?\" + fullTail);\n }\n return new RegExp(startWithPrefix + head + \"([2-9]|[1-9][0-9]+)?\" + fullTail);\n };\n }\n });\n\n // src/lib/coerce.js\n var require_coerce = __commonJS({\n \"src/lib/coerce.js\"(exports) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var tinycolor = require_tinycolor();\n var extendFlat = require_extend().extendFlat;\n var baseTraceAttrs = require_attributes2();\n var colorscales = require_scales();\n var Color2 = require_color();\n var DESELECTDIM = require_interactions().DESELECTDIM;\n var nestedProperty = require_nested_property();\n var counterRegex = require_regex().counter;\n var modHalf = require_mod().modHalf;\n var isArrayOrTypedArray = require_array().isArrayOrTypedArray;\n var isTypedArraySpec = require_array().isTypedArraySpec;\n var decodeTypedArraySpec = require_array().decodeTypedArraySpec;\n exports.valObjectMeta = {\n data_array: {\n // You can use *dflt=[] to force said array to exist though.\n coerceFunction: function(v, propOut, dflt) {\n propOut.set(\n isArrayOrTypedArray(v) ? v : isTypedArraySpec(v) ? decodeTypedArraySpec(v) : dflt\n );\n }\n },\n enumerated: {\n coerceFunction: function(v, propOut, dflt, opts) {\n if (opts.coerceNumber) v = +v;\n if (opts.values.indexOf(v) === -1) propOut.set(dflt);\n else propOut.set(v);\n },\n validateFunction: function(v, opts) {\n if (opts.coerceNumber) v = +v;\n var values = opts.values;\n for (var i = 0; i < values.length; i++) {\n var k = String(values[i]);\n if (k.charAt(0) === \"/\" && k.charAt(k.length - 1) === \"/\") {\n var regex = new RegExp(k.substr(1, k.length - 2));\n if (regex.test(v)) return true;\n } else if (v === values[i]) return true;\n }\n return false;\n }\n },\n boolean: {\n coerceFunction: function(v, propOut, dflt) {\n if (v === true || v === false) propOut.set(v);\n else propOut.set(dflt);\n }\n },\n number: {\n coerceFunction: function(v, propOut, dflt, opts) {\n if (isTypedArraySpec(v)) v = decodeTypedArraySpec(v);\n if (!isNumeric(v) || opts.min !== void 0 && v < opts.min || opts.max !== void 0 && v > opts.max) {\n propOut.set(dflt);\n } else propOut.set(+v);\n }\n },\n integer: {\n coerceFunction: function(v, propOut, dflt, opts) {\n if ((opts.extras || []).indexOf(v) !== -1) {\n propOut.set(v);\n return;\n }\n if (isTypedArraySpec(v)) v = decodeTypedArraySpec(v);\n if (v % 1 || !isNumeric(v) || opts.min !== void 0 && v < opts.min || opts.max !== void 0 && v > opts.max) {\n propOut.set(dflt);\n } else propOut.set(+v);\n }\n },\n string: {\n // TODO 'values shouldn't be in there (edge case: 'dash' in Scatter)\n coerceFunction: function(v, propOut, dflt, opts) {\n if (typeof v !== \"string\") {\n var okToCoerce = typeof v === \"number\";\n if (opts.strict === true || !okToCoerce) propOut.set(dflt);\n else propOut.set(String(v));\n } else if (opts.noBlank && !v) propOut.set(dflt);\n else propOut.set(v);\n }\n },\n color: {\n coerceFunction: function(v, propOut, dflt) {\n if (isTypedArraySpec(v)) v = decodeTypedArraySpec(v);\n if (tinycolor(v).isValid()) propOut.set(v);\n else propOut.set(dflt);\n }\n },\n colorlist: {\n coerceFunction: function(v, propOut, dflt) {\n function isColor(color2) {\n return tinycolor(color2).isValid();\n }\n if (!Array.isArray(v) || !v.length) propOut.set(dflt);\n else if (v.every(isColor)) propOut.set(v);\n else propOut.set(dflt);\n }\n },\n colorscale: {\n coerceFunction: function(v, propOut, dflt) {\n propOut.set(colorscales.get(v, dflt));\n }\n },\n angle: {\n coerceFunction: function(v, propOut, dflt) {\n if (isTypedArraySpec(v)) v = decodeTypedArraySpec(v);\n if (v === \"auto\") propOut.set(\"auto\");\n else if (!isNumeric(v)) propOut.set(dflt);\n else propOut.set(modHalf(+v, 360));\n }\n },\n subplotid: {\n coerceFunction: function(v, propOut, dflt, opts) {\n var regex = opts.regex || counterRegex(dflt);\n if (typeof v === \"string\" && regex.test(v)) {\n propOut.set(v);\n return;\n }\n propOut.set(dflt);\n },\n validateFunction: function(v, opts) {\n var dflt = opts.dflt;\n if (v === dflt) return true;\n if (typeof v !== \"string\") return false;\n if (counterRegex(dflt).test(v)) return true;\n return false;\n }\n },\n flaglist: {\n coerceFunction: function(v, propOut, dflt, opts) {\n if ((opts.extras || []).indexOf(v) !== -1) {\n propOut.set(v);\n return;\n }\n if (typeof v !== \"string\") {\n propOut.set(dflt);\n return;\n }\n var vParts = v.split(\"+\");\n var i = 0;\n while (i < vParts.length) {\n var vi = vParts[i];\n if (opts.flags.indexOf(vi) === -1 || vParts.indexOf(vi) < i) {\n vParts.splice(i, 1);\n } else i++;\n }\n if (!vParts.length) propOut.set(dflt);\n else propOut.set(vParts.join(\"+\"));\n }\n },\n any: {\n coerceFunction: function(v, propOut, dflt) {\n if (v === void 0) {\n propOut.set(dflt);\n } else {\n propOut.set(\n isTypedArraySpec(v) ? decodeTypedArraySpec(v) : v\n );\n }\n }\n },\n info_array: {\n // set `dimensions=2` for a 2D array or '1-2' for either\n // `items` may be a single object instead of an array, in which case\n // `freeLength` must be true.\n // if `dimensions='1-2'` and items is a 1D array, then the value can\n // either be a matching 1D array or an array of such matching 1D arrays\n coerceFunction: function(v, propOut, dflt, opts) {\n function coercePart(v2, opts2, dflt2) {\n var out;\n var propPart = { set: function(v3) {\n out = v3;\n } };\n if (dflt2 === void 0) dflt2 = opts2.dflt;\n exports.valObjectMeta[opts2.valType].coerceFunction(v2, propPart, dflt2, opts2);\n return out;\n }\n if (isTypedArraySpec(v)) v = decodeTypedArraySpec(v);\n if (!isArrayOrTypedArray(v)) {\n propOut.set(dflt);\n return;\n }\n var twoD = opts.dimensions === 2 || opts.dimensions === \"1-2\" && Array.isArray(v) && isArrayOrTypedArray(v[0]);\n var items = opts.items;\n var vOut = [];\n var arrayItems = Array.isArray(items);\n var arrayItems2D = arrayItems && twoD && isArrayOrTypedArray(items[0]);\n var innerItemsOnly = twoD && arrayItems && !arrayItems2D;\n var len = arrayItems && !innerItemsOnly ? items.length : v.length;\n var i, j, row, item, len2, vNew;\n dflt = Array.isArray(dflt) ? dflt : [];\n if (twoD) {\n for (i = 0; i < len; i++) {\n vOut[i] = [];\n row = isArrayOrTypedArray(v[i]) ? v[i] : [];\n if (innerItemsOnly) len2 = items.length;\n else if (arrayItems) len2 = items[i].length;\n else len2 = row.length;\n for (j = 0; j < len2; j++) {\n if (innerItemsOnly) item = items[j];\n else if (arrayItems) item = items[i][j];\n else item = items;\n vNew = coercePart(row[j], item, (dflt[i] || [])[j]);\n if (vNew !== void 0) vOut[i][j] = vNew;\n }\n }\n } else {\n for (i = 0; i < len; i++) {\n vNew = coercePart(v[i], arrayItems ? items[i] : items, dflt[i]);\n if (vNew !== void 0) vOut[i] = vNew;\n }\n }\n propOut.set(vOut);\n },\n validateFunction: function(v, opts) {\n if (!isArrayOrTypedArray(v)) return false;\n var items = opts.items;\n var arrayItems = Array.isArray(items);\n var twoD = opts.dimensions === 2;\n if (!opts.freeLength && v.length !== items.length) return false;\n for (var i = 0; i < v.length; i++) {\n if (twoD) {\n if (!isArrayOrTypedArray(v[i]) || !opts.freeLength && v[i].length !== items[i].length) {\n return false;\n }\n for (var j = 0; j < v[i].length; j++) {\n if (!validate(v[i][j], arrayItems ? items[i][j] : items)) {\n return false;\n }\n }\n } else if (!validate(v[i], arrayItems ? items[i] : items)) return false;\n }\n return true;\n }\n }\n };\n exports.coerce = function(containerIn, containerOut, attributes, attribute, dflt) {\n var opts = nestedProperty(attributes, attribute).get();\n var propIn = nestedProperty(containerIn, attribute);\n var propOut = nestedProperty(containerOut, attribute);\n var v = propIn.get();\n var template = containerOut._template;\n if (v === void 0 && template) {\n v = nestedProperty(template, attribute).get();\n template = 0;\n }\n if (dflt === void 0) dflt = opts.dflt;\n if (opts.arrayOk) {\n if (isArrayOrTypedArray(v)) {\n propOut.set(v);\n return v;\n } else {\n if (isTypedArraySpec(v)) {\n v = decodeTypedArraySpec(v);\n propOut.set(v);\n return v;\n }\n }\n }\n var coerceFunction = exports.valObjectMeta[opts.valType].coerceFunction;\n coerceFunction(v, propOut, dflt, opts);\n var out = propOut.get();\n if (template && out === dflt && !validate(v, opts)) {\n v = nestedProperty(template, attribute).get();\n coerceFunction(v, propOut, dflt, opts);\n out = propOut.get();\n }\n return out;\n };\n exports.coerce2 = function(containerIn, containerOut, attributes, attribute, dflt) {\n var propIn = nestedProperty(containerIn, attribute);\n var propOut = exports.coerce(containerIn, containerOut, attributes, attribute, dflt);\n var valIn = propIn.get();\n return valIn !== void 0 && valIn !== null ? propOut : false;\n };\n exports.coerceFont = function(coerce, attr, dfltObj, opts) {\n if (!opts) opts = {};\n dfltObj = extendFlat({}, dfltObj);\n dfltObj = extendFlat(dfltObj, opts.overrideDflt || {});\n var out = {\n family: coerce(attr + \".family\", dfltObj.family),\n size: coerce(attr + \".size\", dfltObj.size),\n color: coerce(attr + \".color\", dfltObj.color),\n weight: coerce(attr + \".weight\", dfltObj.weight),\n style: coerce(attr + \".style\", dfltObj.style)\n };\n if (!opts.noFontVariant) out.variant = coerce(attr + \".variant\", dfltObj.variant);\n if (!opts.noFontLineposition) out.lineposition = coerce(attr + \".lineposition\", dfltObj.lineposition);\n if (!opts.noFontTextcase) out.textcase = coerce(attr + \".textcase\", dfltObj.textcase);\n if (!opts.noFontShadow) {\n var dfltShadow = dfltObj.shadow;\n if (dfltShadow === \"none\" && opts.autoShadowDflt) {\n dfltShadow = \"auto\";\n }\n out.shadow = coerce(attr + \".shadow\", dfltShadow);\n }\n return out;\n };\n exports.coercePattern = function(coerce, attr, markerColor, hasMarkerColorscale) {\n var shape = coerce(attr + \".shape\");\n if (shape) {\n coerce(attr + \".solidity\");\n coerce(attr + \".size\");\n var fillmode = coerce(attr + \".fillmode\");\n var isOverlay = fillmode === \"overlay\";\n if (!hasMarkerColorscale) {\n var bgcolor = coerce(\n attr + \".bgcolor\",\n isOverlay ? markerColor : void 0\n );\n coerce(\n attr + \".fgcolor\",\n isOverlay ? Color2.contrast(bgcolor) : markerColor\n );\n }\n coerce(\n attr + \".fgopacity\",\n isOverlay ? 0.5 : 1\n );\n }\n };\n exports.coerceHoverinfo = function(traceIn, traceOut, layoutOut) {\n var moduleAttrs = traceOut._module.attributes;\n var attrs = moduleAttrs.hoverinfo ? moduleAttrs : baseTraceAttrs;\n var valObj = attrs.hoverinfo;\n var dflt;\n if (layoutOut._dataLength === 1) {\n var flags = valObj.dflt === \"all\" ? valObj.flags.slice() : valObj.dflt.split(\"+\");\n flags.splice(flags.indexOf(\"name\"), 1);\n dflt = flags.join(\"+\");\n }\n return exports.coerce(traceIn, traceOut, attrs, \"hoverinfo\", dflt);\n };\n exports.coerceSelectionMarkerOpacity = function(traceOut, coerce) {\n if (!traceOut.marker) return;\n var mo = traceOut.marker.opacity;\n if (mo === void 0) return;\n var smoDflt;\n var usmoDflt;\n if (!isArrayOrTypedArray(mo) && !traceOut.selected && !traceOut.unselected) {\n smoDflt = mo;\n usmoDflt = DESELECTDIM * mo;\n }\n coerce(\"selected.marker.opacity\", smoDflt);\n coerce(\"unselected.marker.opacity\", usmoDflt);\n };\n function validate(value, opts) {\n var valObjectDef = exports.valObjectMeta[opts.valType];\n if (opts.arrayOk && isArrayOrTypedArray(value)) return true;\n if (valObjectDef.validateFunction) {\n return valObjectDef.validateFunction(value, opts);\n }\n var failed = {};\n var out = failed;\n var propMock = { set: function(v) {\n out = v;\n } };\n valObjectDef.coerceFunction(value, propMock, failed, opts);\n return out !== failed;\n }\n exports.validate = validate;\n }\n });\n\n // src/plot_api/plot_config.js\n var require_plot_config = __commonJS({\n \"src/plot_api/plot_config.js\"(exports, module) {\n \"use strict\";\n var configAttributes = {\n staticPlot: {\n valType: \"boolean\",\n dflt: false\n },\n typesetMath: {\n valType: \"boolean\",\n dflt: true\n },\n plotlyServerURL: {\n valType: \"string\",\n dflt: \"\"\n },\n editable: {\n valType: \"boolean\",\n dflt: false\n },\n edits: {\n annotationPosition: {\n valType: \"boolean\",\n dflt: false\n },\n annotationTail: {\n valType: \"boolean\",\n dflt: false\n },\n annotationText: {\n valType: \"boolean\",\n dflt: false\n },\n axisTitleText: {\n valType: \"boolean\",\n dflt: false\n },\n colorbarPosition: {\n valType: \"boolean\",\n dflt: false\n },\n colorbarTitleText: {\n valType: \"boolean\",\n dflt: false\n },\n legendPosition: {\n valType: \"boolean\",\n dflt: false\n },\n legendText: {\n valType: \"boolean\",\n dflt: false\n },\n shapePosition: {\n valType: \"boolean\",\n dflt: false\n },\n titleText: {\n valType: \"boolean\",\n dflt: false\n }\n },\n editSelection: {\n valType: \"boolean\",\n dflt: true\n },\n autosizable: {\n valType: \"boolean\",\n dflt: false\n },\n responsive: {\n valType: \"boolean\",\n dflt: false\n },\n fillFrame: {\n valType: \"boolean\",\n dflt: false\n },\n frameMargins: {\n valType: \"number\",\n dflt: 0,\n min: 0,\n max: 0.5\n },\n scrollZoom: {\n valType: \"flaglist\",\n flags: [\"cartesian\", \"gl3d\", \"geo\", \"mapbox\", \"map\"],\n extras: [true, false],\n dflt: \"gl3d+geo+map\"\n },\n doubleClick: {\n valType: \"enumerated\",\n values: [false, \"reset\", \"autosize\", \"reset+autosize\"],\n dflt: \"reset+autosize\"\n },\n doubleClickDelay: {\n valType: \"number\",\n dflt: 300,\n min: 0\n },\n showAxisDragHandles: {\n valType: \"boolean\",\n dflt: true\n },\n showAxisRangeEntryBoxes: {\n valType: \"boolean\",\n dflt: true\n },\n showTips: {\n valType: \"boolean\",\n dflt: true\n },\n showLink: {\n valType: \"boolean\",\n dflt: false\n },\n linkText: {\n valType: \"string\",\n dflt: \"Edit chart\",\n noBlank: true\n },\n sendData: {\n valType: \"boolean\",\n dflt: true\n },\n showSources: {\n valType: \"any\",\n dflt: false\n },\n displayModeBar: {\n valType: \"enumerated\",\n values: [\"hover\", true, false],\n dflt: \"hover\"\n },\n showSendToCloud: {\n valType: \"boolean\",\n dflt: false\n },\n showEditInChartStudio: {\n valType: \"boolean\",\n dflt: false\n },\n modeBarButtonsToRemove: {\n valType: \"any\",\n dflt: []\n },\n modeBarButtonsToAdd: {\n valType: \"any\",\n dflt: []\n },\n modeBarButtons: {\n valType: \"any\",\n dflt: false\n },\n toImageButtonOptions: {\n valType: \"any\",\n dflt: {}\n },\n displaylogo: {\n valType: \"boolean\",\n dflt: true\n },\n watermark: {\n valType: \"boolean\",\n dflt: false\n },\n plotGlPixelRatio: {\n valType: \"number\",\n dflt: 2,\n min: 1,\n max: 4\n },\n setBackground: {\n valType: \"any\",\n dflt: \"transparent\"\n },\n topojsonURL: {\n valType: \"string\",\n noBlank: true,\n dflt: \"https://cdn.plot.ly/\"\n },\n mapboxAccessToken: {\n valType: \"string\",\n dflt: null\n },\n logging: {\n valType: \"integer\",\n min: 0,\n max: 2,\n dflt: 1\n },\n notifyOnLogging: {\n valType: \"integer\",\n min: 0,\n max: 2,\n dflt: 0\n },\n queueLength: {\n valType: \"integer\",\n min: 0,\n dflt: 0\n },\n locale: {\n valType: \"string\",\n dflt: \"en-US\"\n },\n locales: {\n valType: \"any\",\n dflt: {}\n }\n };\n var dfltConfig = {};\n function crawl(src, target) {\n for (var k in src) {\n var obj = src[k];\n if (obj.valType) {\n target[k] = obj.dflt;\n } else {\n if (!target[k]) {\n target[k] = {};\n }\n crawl(obj, target[k]);\n }\n }\n }\n crawl(configAttributes, dfltConfig);\n module.exports = {\n configAttributes,\n dfltConfig\n };\n }\n });\n\n // src/lib/notifier.js\n var require_notifier = __commonJS({\n \"src/lib/notifier.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var isNumeric = require_fast_isnumeric();\n var NOTEDATA = [];\n module.exports = function(text, displayLength) {\n if (NOTEDATA.indexOf(text) !== -1) return;\n NOTEDATA.push(text);\n var ts = 1e3;\n if (isNumeric(displayLength)) ts = displayLength;\n else if (displayLength === \"long\") ts = 3e3;\n var notifierContainer = d3.select(\"body\").selectAll(\".plotly-notifier\").data([0]);\n notifierContainer.enter().append(\"div\").classed(\"plotly-notifier\", true);\n var notes = notifierContainer.selectAll(\".notifier-note\").data(NOTEDATA);\n function killNote(transition) {\n transition.duration(700).style(\"opacity\", 0).each(\"end\", function(thisText) {\n var thisIndex = NOTEDATA.indexOf(thisText);\n if (thisIndex !== -1) NOTEDATA.splice(thisIndex, 1);\n d3.select(this).remove();\n });\n }\n notes.enter().append(\"div\").classed(\"notifier-note\", true).style(\"opacity\", 0).each(function(thisText) {\n var note = d3.select(this);\n note.append(\"button\").classed(\"notifier-close\", true).html(\"×\").on(\"click\", function() {\n note.transition().call(killNote);\n });\n var p = note.append(\"p\");\n var lines = thisText.split(//g);\n for (var i = 0; i < lines.length; i++) {\n if (i) p.append(\"br\");\n p.append(\"span\").text(lines[i]);\n }\n if (displayLength === \"stick\") {\n note.transition().duration(350).style(\"opacity\", 1);\n } else {\n note.transition().duration(700).style(\"opacity\", 1).transition().delay(ts).call(killNote);\n }\n });\n };\n }\n });\n\n // src/lib/loggers.js\n var require_loggers = __commonJS({\n \"src/lib/loggers.js\"(exports, module) {\n \"use strict\";\n var dfltConfig = require_plot_config().dfltConfig;\n var notifier = require_notifier();\n var loggers = module.exports = {};\n loggers.log = function() {\n var i;\n if (dfltConfig.logging > 1) {\n var messages = [\"LOG:\"];\n for (i = 0; i < arguments.length; i++) {\n messages.push(arguments[i]);\n }\n console.trace.apply(console, messages);\n }\n if (dfltConfig.notifyOnLogging > 1) {\n var lines = [];\n for (i = 0; i < arguments.length; i++) {\n lines.push(arguments[i]);\n }\n notifier(lines.join(\"
    \"), \"long\");\n }\n };\n loggers.warn = function() {\n var i;\n if (dfltConfig.logging > 0) {\n var messages = [\"WARN:\"];\n for (i = 0; i < arguments.length; i++) {\n messages.push(arguments[i]);\n }\n console.trace.apply(console, messages);\n }\n if (dfltConfig.notifyOnLogging > 0) {\n var lines = [];\n for (i = 0; i < arguments.length; i++) {\n lines.push(arguments[i]);\n }\n notifier(lines.join(\"
    \"), \"stick\");\n }\n };\n loggers.error = function() {\n var i;\n if (dfltConfig.logging > 0) {\n var messages = [\"ERROR:\"];\n for (i = 0; i < arguments.length; i++) {\n messages.push(arguments[i]);\n }\n console.error.apply(console, messages);\n }\n if (dfltConfig.notifyOnLogging > 0) {\n var lines = [];\n for (i = 0; i < arguments.length; i++) {\n lines.push(arguments[i]);\n }\n notifier(lines.join(\"
    \"), \"stick\");\n }\n };\n }\n });\n\n // src/lib/noop.js\n var require_noop = __commonJS({\n \"src/lib/noop.js\"(exports, module) {\n \"use strict\";\n module.exports = function noop() {\n };\n }\n });\n\n // src/lib/push_unique.js\n var require_push_unique = __commonJS({\n \"src/lib/push_unique.js\"(exports, module) {\n \"use strict\";\n module.exports = function pushUnique(array, item) {\n if (item instanceof RegExp) {\n var itemStr = item.toString();\n for (var i = 0; i < array.length; i++) {\n if (array[i] instanceof RegExp && array[i].toString() === itemStr) {\n return array;\n }\n }\n array.push(item);\n } else if ((item || item === 0) && array.indexOf(item) === -1) array.push(item);\n return array;\n };\n }\n });\n\n // node_modules/gl-mat4/create.js\n var require_create = __commonJS({\n \"node_modules/gl-mat4/create.js\"(exports, module) {\n module.exports = create;\n function create() {\n var out = new Float32Array(16);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/clone.js\n var require_clone = __commonJS({\n \"node_modules/gl-mat4/clone.js\"(exports, module) {\n module.exports = clone;\n function clone(a) {\n var out = new Float32Array(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/copy.js\n var require_copy = __commonJS({\n \"node_modules/gl-mat4/copy.js\"(exports, module) {\n module.exports = copy;\n function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/identity.js\n var require_identity = __commonJS({\n \"node_modules/gl-mat4/identity.js\"(exports, module) {\n module.exports = identity2;\n function identity2(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/transpose.js\n var require_transpose = __commonJS({\n \"node_modules/gl-mat4/transpose.js\"(exports, module) {\n module.exports = transpose;\n function transpose(out, a) {\n if (out === a) {\n var a01 = a[1], a02 = a[2], a03 = a[3], a12 = a[6], a13 = a[7], a23 = a[11];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/invert.js\n var require_invert = __commonJS({\n \"node_modules/gl-mat4/invert.js\"(exports, module) {\n module.exports = invert;\n function invert(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], b00 = a00 * a11 - a01 * a10, b01 = a00 * a12 - a02 * a10, b02 = a00 * a13 - a03 * a10, b03 = a01 * a12 - a02 * a11, b04 = a01 * a13 - a03 * a11, b05 = a02 * a13 - a03 * a12, b06 = a20 * a31 - a21 * a30, b07 = a20 * a32 - a22 * a30, b08 = a20 * a33 - a23 * a30, b09 = a21 * a32 - a22 * a31, b10 = a21 * a33 - a23 * a31, b11 = a22 * a33 - a23 * a32, det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n if (!det) {\n return null;\n }\n det = 1 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/adjoint.js\n var require_adjoint = __commonJS({\n \"node_modules/gl-mat4/adjoint.js\"(exports, module) {\n module.exports = adjoint;\n function adjoint(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22);\n out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12);\n out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22);\n out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12);\n out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21);\n out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11);\n out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21);\n out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11);\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/determinant.js\n var require_determinant = __commonJS({\n \"node_modules/gl-mat4/determinant.js\"(exports, module) {\n module.exports = determinant;\n function determinant(a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], b00 = a00 * a11 - a01 * a10, b01 = a00 * a12 - a02 * a10, b02 = a00 * a13 - a03 * a10, b03 = a01 * a12 - a02 * a11, b04 = a01 * a13 - a03 * a11, b05 = a02 * a13 - a03 * a12, b06 = a20 * a31 - a21 * a30, b07 = a20 * a32 - a22 * a30, b08 = a20 * a33 - a23 * a30, b09 = a21 * a32 - a22 * a31, b10 = a21 * a33 - a23 * a31, b11 = a22 * a33 - a23 * a32;\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n }\n }\n });\n\n // node_modules/gl-mat4/multiply.js\n var require_multiply = __commonJS({\n \"node_modules/gl-mat4/multiply.js\"(exports, module) {\n module.exports = multiply;\n function multiply(out, a, b) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/translate.js\n var require_translate = __commonJS({\n \"node_modules/gl-mat4/translate.js\"(exports, module) {\n module.exports = translate;\n function translate(out, a, v) {\n var x = v[0], y = v[1], z = v[2], a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23;\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/scale.js\n var require_scale = __commonJS({\n \"node_modules/gl-mat4/scale.js\"(exports, module) {\n module.exports = scale;\n function scale(out, a, v) {\n var x = v[0], y = v[1], z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/rotate.js\n var require_rotate = __commonJS({\n \"node_modules/gl-mat4/rotate.js\"(exports, module) {\n module.exports = rotate;\n function rotate(out, a, rad, axis) {\n var x = axis[0], y = axis[1], z = axis[2], len = Math.sqrt(x * x + y * y + z * z), s, c, t, a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23, b00, b01, b02, b10, b11, b12, b20, b21, b22;\n if (Math.abs(len) < 1e-6) {\n return null;\n }\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n b00 = x * x * t + c;\n b01 = y * x * t + z * s;\n b02 = z * x * t - y * s;\n b10 = x * y * t - z * s;\n b11 = y * y * t + c;\n b12 = z * y * t + x * s;\n b20 = x * z * t + y * s;\n b21 = y * z * t - x * s;\n b22 = z * z * t + c;\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n if (a !== out) {\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/rotateX.js\n var require_rotateX = __commonJS({\n \"node_modules/gl-mat4/rotateX.js\"(exports, module) {\n module.exports = rotateX;\n function rotateX(out, a, rad) {\n var s = Math.sin(rad), c = Math.cos(rad), a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];\n if (a !== out) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/rotateY.js\n var require_rotateY = __commonJS({\n \"node_modules/gl-mat4/rotateY.js\"(exports, module) {\n module.exports = rotateY;\n function rotateY(out, a, rad) {\n var s = Math.sin(rad), c = Math.cos(rad), a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];\n if (a !== out) {\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/rotateZ.js\n var require_rotateZ = __commonJS({\n \"node_modules/gl-mat4/rotateZ.js\"(exports, module) {\n module.exports = rotateZ;\n function rotateZ(out, a, rad) {\n var s = Math.sin(rad), c = Math.cos(rad), a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];\n if (a !== out) {\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/fromRotation.js\n var require_fromRotation = __commonJS({\n \"node_modules/gl-mat4/fromRotation.js\"(exports, module) {\n module.exports = fromRotation;\n function fromRotation(out, rad, axis) {\n var s, c, t;\n var x = axis[0];\n var y = axis[1];\n var z = axis[2];\n var len = Math.sqrt(x * x + y * y + z * z);\n if (Math.abs(len) < 1e-6) {\n return null;\n }\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/fromRotationTranslation.js\n var require_fromRotationTranslation = __commonJS({\n \"node_modules/gl-mat4/fromRotationTranslation.js\"(exports, module) {\n module.exports = fromRotationTranslation;\n function fromRotationTranslation(out, q, v) {\n var x = q[0], y = q[1], z = q[2], w = q[3], x2 = x + x, y2 = y + y, z2 = z + z, xx = x * x2, xy = x * y2, xz = x * z2, yy = y * y2, yz = y * z2, zz = z * z2, wx = w * x2, wy = w * y2, wz = w * z2;\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/fromScaling.js\n var require_fromScaling = __commonJS({\n \"node_modules/gl-mat4/fromScaling.js\"(exports, module) {\n module.exports = fromScaling;\n function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/fromTranslation.js\n var require_fromTranslation = __commonJS({\n \"node_modules/gl-mat4/fromTranslation.js\"(exports, module) {\n module.exports = fromTranslation;\n function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/fromXRotation.js\n var require_fromXRotation = __commonJS({\n \"node_modules/gl-mat4/fromXRotation.js\"(exports, module) {\n module.exports = fromXRotation;\n function fromXRotation(out, rad) {\n var s = Math.sin(rad), c = Math.cos(rad);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/fromYRotation.js\n var require_fromYRotation = __commonJS({\n \"node_modules/gl-mat4/fromYRotation.js\"(exports, module) {\n module.exports = fromYRotation;\n function fromYRotation(out, rad) {\n var s = Math.sin(rad), c = Math.cos(rad);\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/fromZRotation.js\n var require_fromZRotation = __commonJS({\n \"node_modules/gl-mat4/fromZRotation.js\"(exports, module) {\n module.exports = fromZRotation;\n function fromZRotation(out, rad) {\n var s = Math.sin(rad), c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/fromQuat.js\n var require_fromQuat = __commonJS({\n \"node_modules/gl-mat4/fromQuat.js\"(exports, module) {\n module.exports = fromQuat;\n function fromQuat(out, q) {\n var x = q[0], y = q[1], z = q[2], w = q[3], x2 = x + x, y2 = y + y, z2 = z + z, xx = x * x2, yx = y * x2, yy = y * y2, zx = z * x2, zy = z * y2, zz = z * z2, wx = w * x2, wy = w * y2, wz = w * z2;\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/frustum.js\n var require_frustum = __commonJS({\n \"node_modules/gl-mat4/frustum.js\"(exports, module) {\n module.exports = frustum;\n function frustum(out, left, right, bottom, top, near, far) {\n var rl = 1 / (right - left), tb = 1 / (top - bottom), nf = 1 / (near - far);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = far * near * 2 * nf;\n out[15] = 0;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/perspective.js\n var require_perspective = __commonJS({\n \"node_modules/gl-mat4/perspective.js\"(exports, module) {\n module.exports = perspective;\n function perspective(out, fovy, aspect, near, far) {\n var f = 1 / Math.tan(fovy / 2), nf = 1 / (near - far);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = 2 * far * near * nf;\n out[15] = 0;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/perspectiveFromFieldOfView.js\n var require_perspectiveFromFieldOfView = __commonJS({\n \"node_modules/gl-mat4/perspectiveFromFieldOfView.js\"(exports, module) {\n module.exports = perspectiveFromFieldOfView;\n function perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov.upDegrees * Math.PI / 180), downTan = Math.tan(fov.downDegrees * Math.PI / 180), leftTan = Math.tan(fov.leftDegrees * Math.PI / 180), rightTan = Math.tan(fov.rightDegrees * Math.PI / 180), xScale = 2 / (leftTan + rightTan), yScale = 2 / (upTan + downTan);\n out[0] = xScale;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = yScale;\n out[6] = 0;\n out[7] = 0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = (upTan - downTan) * yScale * 0.5;\n out[10] = far / (near - far);\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = far * near / (near - far);\n out[15] = 0;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/ortho.js\n var require_ortho = __commonJS({\n \"node_modules/gl-mat4/ortho.js\"(exports, module) {\n module.exports = ortho;\n function ortho(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right), bt = 1 / (bottom - top), nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/lookAt.js\n var require_lookAt = __commonJS({\n \"node_modules/gl-mat4/lookAt.js\"(exports, module) {\n var identity2 = require_identity();\n module.exports = lookAt;\n function lookAt(out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len, eyex = eye[0], eyey = eye[1], eyez = eye[2], upx = up[0], upy = up[1], upz = up[2], centerx = center[0], centery = center[1], centerz = center[2];\n if (Math.abs(eyex - centerx) < 1e-6 && Math.abs(eyey - centery) < 1e-6 && Math.abs(eyez - centerz) < 1e-6) {\n return identity2(out);\n }\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n }\n }\n });\n\n // node_modules/gl-mat4/str.js\n var require_str = __commonJS({\n \"node_modules/gl-mat4/str.js\"(exports, module) {\n module.exports = str;\n function str(a) {\n return \"mat4(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \", \" + a[4] + \", \" + a[5] + \", \" + a[6] + \", \" + a[7] + \", \" + a[8] + \", \" + a[9] + \", \" + a[10] + \", \" + a[11] + \", \" + a[12] + \", \" + a[13] + \", \" + a[14] + \", \" + a[15] + \")\";\n }\n }\n });\n\n // node_modules/gl-mat4/index.js\n var require_gl_mat4 = __commonJS({\n \"node_modules/gl-mat4/index.js\"(exports, module) {\n module.exports = {\n create: require_create(),\n clone: require_clone(),\n copy: require_copy(),\n identity: require_identity(),\n transpose: require_transpose(),\n invert: require_invert(),\n adjoint: require_adjoint(),\n determinant: require_determinant(),\n multiply: require_multiply(),\n translate: require_translate(),\n scale: require_scale(),\n rotate: require_rotate(),\n rotateX: require_rotateX(),\n rotateY: require_rotateY(),\n rotateZ: require_rotateZ(),\n fromRotation: require_fromRotation(),\n fromRotationTranslation: require_fromRotationTranslation(),\n fromScaling: require_fromScaling(),\n fromTranslation: require_fromTranslation(),\n fromXRotation: require_fromXRotation(),\n fromYRotation: require_fromYRotation(),\n fromZRotation: require_fromZRotation(),\n fromQuat: require_fromQuat(),\n frustum: require_frustum(),\n perspective: require_perspective(),\n perspectiveFromFieldOfView: require_perspectiveFromFieldOfView(),\n ortho: require_ortho(),\n lookAt: require_lookAt(),\n str: require_str()\n };\n }\n });\n\n // src/lib/matrix.js\n var require_matrix = __commonJS({\n \"src/lib/matrix.js\"(exports) {\n \"use strict\";\n var mat4X4 = require_gl_mat4();\n exports.init2dArray = function(rowLength, colLength) {\n var array = new Array(rowLength);\n for (var i = 0; i < rowLength; i++) array[i] = new Array(colLength);\n return array;\n };\n exports.transposeRagged = function(z) {\n var maxlen = 0;\n var zlen = z.length;\n var i, j;\n for (i = 0; i < zlen; i++) maxlen = Math.max(maxlen, z[i].length);\n var t = new Array(maxlen);\n for (i = 0; i < maxlen; i++) {\n t[i] = new Array(zlen);\n for (j = 0; j < zlen; j++) t[i][j] = z[j][i];\n }\n return t;\n };\n exports.dot = function(x, y) {\n if (!(x.length && y.length) || x.length !== y.length) return null;\n var len = x.length;\n var out;\n var i;\n if (x[0].length) {\n out = new Array(len);\n for (i = 0; i < len; i++) out[i] = exports.dot(x[i], y);\n } else if (y[0].length) {\n var yTranspose = exports.transposeRagged(y);\n out = new Array(yTranspose.length);\n for (i = 0; i < yTranspose.length; i++) out[i] = exports.dot(x, yTranspose[i]);\n } else {\n out = 0;\n for (i = 0; i < len; i++) out += x[i] * y[i];\n }\n return out;\n };\n exports.translationMatrix = function(x, y) {\n return [[1, 0, x], [0, 1, y], [0, 0, 1]];\n };\n exports.rotationMatrix = function(alpha) {\n var a = alpha * Math.PI / 180;\n return [\n [Math.cos(a), -Math.sin(a), 0],\n [Math.sin(a), Math.cos(a), 0],\n [0, 0, 1]\n ];\n };\n exports.rotationXYMatrix = function(a, x, y) {\n return exports.dot(\n exports.dot(\n exports.translationMatrix(x, y),\n exports.rotationMatrix(a)\n ),\n exports.translationMatrix(-x, -y)\n );\n };\n exports.apply3DTransform = function(transform) {\n return function() {\n var args = arguments;\n var xyz = arguments.length === 1 ? args[0] : [args[0], args[1], args[2] || 0];\n return exports.dot(transform, [xyz[0], xyz[1], xyz[2], 1]).slice(0, 3);\n };\n };\n exports.apply2DTransform = function(transform) {\n return function() {\n var args = arguments;\n if (args.length === 3) {\n args = args[0];\n }\n var xy = arguments.length === 1 ? args[0] : [args[0], args[1]];\n return exports.dot(transform, [xy[0], xy[1], 1]).slice(0, 2);\n };\n };\n exports.apply2DTransform2 = function(transform) {\n var at = exports.apply2DTransform(transform);\n return function(xys) {\n return at(xys.slice(0, 2)).concat(at(xys.slice(2, 4)));\n };\n };\n exports.convertCssMatrix = function(m) {\n if (m) {\n var len = m.length;\n if (len === 16) return m;\n if (len === 6) {\n return [\n m[0],\n m[1],\n 0,\n 0,\n m[2],\n m[3],\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n m[4],\n m[5],\n 0,\n 1\n ];\n }\n }\n return [\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ];\n };\n exports.inverseTransformMatrix = function(m) {\n var out = [];\n mat4X4.invert(out, m);\n return [\n [out[0], out[1], out[2], out[3]],\n [out[4], out[5], out[6], out[7]],\n [out[8], out[9], out[10], out[11]],\n [out[12], out[13], out[14], out[15]]\n ];\n };\n }\n });\n\n // src/lib/dom.js\n var require_dom = __commonJS({\n \"src/lib/dom.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var loggers = require_loggers();\n var matrix = require_matrix();\n var mat4X4 = require_gl_mat4();\n function getGraphDiv(gd) {\n var gdElement;\n if (typeof gd === \"string\") {\n gdElement = document.getElementById(gd);\n if (gdElement === null) {\n throw new Error(\"No DOM element with id '\" + gd + \"' exists on the page.\");\n }\n return gdElement;\n } else if (gd === null || gd === void 0) {\n throw new Error(\"DOM element provided is null or undefined\");\n }\n return gd;\n }\n function isPlotDiv(el) {\n var el3 = d3.select(el);\n return el3.node() instanceof HTMLElement && el3.size() && el3.classed(\"js-plotly-plot\");\n }\n function removeElement(el) {\n var elParent = el && el.parentNode;\n if (elParent) elParent.removeChild(el);\n }\n function addStyleRule(selector, styleString) {\n addRelatedStyleRule(\"global\", selector, styleString);\n }\n function addRelatedStyleRule(uid, selector, styleString) {\n var id = \"plotly.js-style-\" + uid;\n var style = document.getElementById(id);\n if (style && style.matches(\".no-inline-styles\")) {\n return;\n }\n if (!style) {\n style = document.createElement(\"style\");\n style.setAttribute(\"id\", id);\n style.appendChild(document.createTextNode(\"\"));\n document.head.appendChild(style);\n }\n var styleSheet = style.sheet;\n if (!styleSheet) {\n loggers.warn(\"Cannot addRelatedStyleRule, probably due to strict CSP...\");\n } else if (styleSheet.insertRule) {\n styleSheet.insertRule(selector + \"{\" + styleString + \"}\", 0);\n } else if (styleSheet.addRule) {\n styleSheet.addRule(selector, styleString, 0);\n } else loggers.warn(\"addStyleRule failed\");\n }\n function deleteRelatedStyleRule(uid) {\n var id = \"plotly.js-style-\" + uid;\n var style = document.getElementById(id);\n if (style) removeElement(style);\n }\n function setStyleOnHover(selector, activeSelector, childSelector, activeStyle, inactiveStyle, element) {\n var activeStyleParts = activeStyle.split(\":\");\n var inactiveStyleParts = inactiveStyle.split(\":\");\n var eventAddedAttrName = \"data-btn-style-event-added\";\n if (!element) {\n element = document;\n }\n element.querySelectorAll(selector).forEach(function(el) {\n if (!el.getAttribute(eventAddedAttrName)) {\n el.addEventListener(\"mouseenter\", function() {\n var childEl = this.querySelector(childSelector);\n if (childEl) {\n childEl.style[activeStyleParts[0]] = activeStyleParts[1];\n }\n });\n el.addEventListener(\"mouseleave\", function() {\n var childEl = this.querySelector(childSelector);\n if (childEl) {\n if (activeSelector && this.matches(activeSelector)) {\n childEl.style[activeStyleParts[0]] = activeStyleParts[1];\n } else {\n childEl.style[inactiveStyleParts[0]] = inactiveStyleParts[1];\n }\n }\n });\n el.setAttribute(eventAddedAttrName, true);\n }\n });\n }\n function getFullTransformMatrix(element) {\n var allElements = getElementAndAncestors(element);\n var out = [\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ];\n allElements.forEach(function(e) {\n var t = getElementTransformMatrix(e);\n if (t) {\n var m = matrix.convertCssMatrix(t);\n out = mat4X4.multiply(out, out, m);\n }\n });\n return out;\n }\n function getElementTransformMatrix(element) {\n var style = window.getComputedStyle(element, null);\n var transform = style.getPropertyValue(\"-webkit-transform\") || style.getPropertyValue(\"-moz-transform\") || style.getPropertyValue(\"-ms-transform\") || style.getPropertyValue(\"-o-transform\") || style.getPropertyValue(\"transform\");\n if (transform === \"none\") return null;\n return transform.replace(\"matrix\", \"\").replace(\"3d\", \"\").slice(1, -1).split(\",\").map(function(n) {\n return +n;\n });\n }\n function getElementAndAncestors(element) {\n var allElements = [];\n while (isTransformableElement(element)) {\n allElements.push(element);\n element = element.parentNode;\n if (typeof ShadowRoot === \"function\" && element instanceof ShadowRoot) {\n element = element.host;\n }\n }\n return allElements;\n }\n function isTransformableElement(element) {\n return element && (element instanceof Element || element instanceof HTMLElement);\n }\n function equalDomRects(a, b) {\n return a && b && a.top === b.top && a.left === b.left && a.right === b.right && a.bottom === b.bottom;\n }\n module.exports = {\n getGraphDiv,\n isPlotDiv,\n removeElement,\n addStyleRule,\n addRelatedStyleRule,\n deleteRelatedStyleRule,\n setStyleOnHover,\n getFullTransformMatrix,\n getElementTransformMatrix,\n getElementAndAncestors,\n equalDomRects\n };\n }\n });\n\n // src/plots/animation_attributes.js\n var require_animation_attributes = __commonJS({\n \"src/plots/animation_attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n mode: {\n valType: \"enumerated\",\n dflt: \"afterall\",\n values: [\"immediate\", \"next\", \"afterall\"]\n },\n direction: {\n valType: \"enumerated\",\n values: [\"forward\", \"reverse\"],\n dflt: \"forward\"\n },\n fromcurrent: {\n valType: \"boolean\",\n dflt: false\n },\n frame: {\n duration: {\n valType: \"number\",\n min: 0,\n dflt: 500\n },\n redraw: {\n valType: \"boolean\",\n dflt: true\n }\n },\n transition: {\n duration: {\n valType: \"number\",\n min: 0,\n dflt: 500,\n editType: \"none\"\n },\n easing: {\n valType: \"enumerated\",\n dflt: \"cubic-in-out\",\n values: [\n \"linear\",\n \"quad\",\n \"cubic\",\n \"sin\",\n \"exp\",\n \"circle\",\n \"elastic\",\n \"back\",\n \"bounce\",\n \"linear-in\",\n \"quad-in\",\n \"cubic-in\",\n \"sin-in\",\n \"exp-in\",\n \"circle-in\",\n \"elastic-in\",\n \"back-in\",\n \"bounce-in\",\n \"linear-out\",\n \"quad-out\",\n \"cubic-out\",\n \"sin-out\",\n \"exp-out\",\n \"circle-out\",\n \"elastic-out\",\n \"back-out\",\n \"bounce-out\",\n \"linear-in-out\",\n \"quad-in-out\",\n \"cubic-in-out\",\n \"sin-in-out\",\n \"exp-in-out\",\n \"circle-in-out\",\n \"elastic-in-out\",\n \"back-in-out\",\n \"bounce-in-out\"\n ],\n editType: \"none\"\n },\n ordering: {\n valType: \"enumerated\",\n values: [\"layout first\", \"traces first\"],\n dflt: \"layout first\",\n editType: \"none\"\n }\n }\n };\n }\n });\n\n // src/plot_api/edit_types.js\n var require_edit_types = __commonJS({\n \"src/plot_api/edit_types.js\"(exports, module) {\n \"use strict\";\n var extendFlat = require_extend().extendFlat;\n var isPlainObject = require_is_plain_object();\n var traceOpts = {\n valType: \"flaglist\",\n extras: [\"none\"],\n flags: [\"calc\", \"clearAxisTypes\", \"plot\", \"style\", \"markerSize\", \"colorbars\"]\n };\n var layoutOpts = {\n valType: \"flaglist\",\n extras: [\"none\"],\n flags: [\n \"calc\",\n \"plot\",\n \"legend\",\n \"ticks\",\n \"axrange\",\n \"layoutstyle\",\n \"modebar\",\n \"camera\",\n \"arraydraw\",\n \"colorbars\"\n ]\n };\n var traceEditTypeFlags = traceOpts.flags.slice().concat([\"fullReplot\"]);\n var layoutEditTypeFlags = layoutOpts.flags.slice().concat(\"layoutReplot\");\n module.exports = {\n traces: traceOpts,\n layout: layoutOpts,\n /*\n * default (all false) edit flags for restyle (traces)\n * creates a new object each call, so the caller can mutate freely\n */\n traceFlags: function() {\n return falseObj(traceEditTypeFlags);\n },\n /*\n * default (all false) edit flags for relayout\n * creates a new object each call, so the caller can mutate freely\n */\n layoutFlags: function() {\n return falseObj(layoutEditTypeFlags);\n },\n /*\n * update `flags` with the `editType` values found in `attr`\n */\n update: function(flags, attr) {\n var editType = attr.editType;\n if (editType && editType !== \"none\") {\n var editTypeParts = editType.split(\"+\");\n for (var i = 0; i < editTypeParts.length; i++) {\n flags[editTypeParts[i]] = true;\n }\n }\n },\n overrideAll\n };\n function falseObj(keys) {\n var out = {};\n for (var i = 0; i < keys.length; i++) out[keys[i]] = false;\n return out;\n }\n function overrideAll(attrs, editTypeOverride, overrideContainers) {\n var out = extendFlat({}, attrs);\n for (var key in out) {\n var attr = out[key];\n if (isPlainObject(attr)) {\n out[key] = overrideOne(attr, editTypeOverride, overrideContainers, key);\n }\n }\n if (overrideContainers === \"from-root\") out.editType = editTypeOverride;\n return out;\n }\n function overrideOne(attr, editTypeOverride, overrideContainers, key) {\n if (attr.valType) {\n var out = extendFlat({}, attr);\n out.editType = editTypeOverride;\n if (Array.isArray(attr.items)) {\n out.items = new Array(attr.items.length);\n for (var i = 0; i < attr.items.length; i++) {\n out.items[i] = overrideOne(attr.items[i], editTypeOverride, \"from-root\");\n }\n }\n return out;\n } else {\n return overrideAll(\n attr,\n editTypeOverride,\n key.charAt(0) === \"_\" ? \"nested\" : \"from-root\"\n );\n }\n }\n }\n });\n\n // src/components/drawing/attributes.js\n var require_attributes4 = __commonJS({\n \"src/components/drawing/attributes.js\"(exports) {\n \"use strict\";\n exports.dash = {\n valType: \"string\",\n // string type usually doesn't take values... this one should really be\n // a special type or at least a special coercion function, from the GUI\n // you only get these values but elsewhere the user can supply a list of\n // dash lengths in px, and it will be honored\n values: [\"solid\", \"dot\", \"dash\", \"longdash\", \"dashdot\", \"longdashdot\"],\n dflt: \"solid\",\n editType: \"style\"\n };\n exports.pattern = {\n shape: {\n valType: \"enumerated\",\n values: [\"\", \"/\", \"\\\\\", \"x\", \"-\", \"|\", \"+\", \".\"],\n dflt: \"\",\n arrayOk: true,\n editType: \"style\"\n },\n fillmode: {\n valType: \"enumerated\",\n values: [\"replace\", \"overlay\"],\n dflt: \"replace\",\n editType: \"style\"\n },\n bgcolor: {\n valType: \"color\",\n arrayOk: true,\n editType: \"style\"\n },\n fgcolor: {\n valType: \"color\",\n arrayOk: true,\n editType: \"style\"\n },\n fgopacity: {\n valType: \"number\",\n editType: \"style\",\n min: 0,\n max: 1\n },\n size: {\n valType: \"number\",\n min: 0,\n dflt: 8,\n arrayOk: true,\n editType: \"style\"\n },\n solidity: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0.3,\n arrayOk: true,\n editType: \"style\"\n },\n editType: \"style\"\n };\n }\n });\n\n // src/constants/docs.js\n var require_docs = __commonJS({\n \"src/constants/docs.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n FORMAT_LINK: \"https://github.com/d3/d3-format/tree/v1.4.5#d3-format\",\n DATE_FORMAT_LINK: \"https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format\"\n };\n }\n });\n\n // src/plots/template_attributes.js\n var require_template_attributes = __commonJS({\n \"src/plots/template_attributes.js\"(exports) {\n \"use strict\";\n var docs = require_docs();\n var FORMAT_LINK = docs.FORMAT_LINK;\n var DATE_FORMAT_LINK = docs.DATE_FORMAT_LINK;\n function describeVariables(extra) {\n var descPart = extra.description ? \" \" + extra.description : \"\";\n var keys = extra.keys || [];\n if (keys.length > 0) {\n var quotedKeys = [];\n for (var i = 0; i < keys.length; i++) {\n quotedKeys[i] = \"`\" + keys[i] + \"`\";\n }\n descPart = descPart + \"Finally, the template string has access to \";\n if (keys.length === 1) {\n descPart = descPart + \"variable \" + quotedKeys[0];\n } else {\n descPart = descPart + \"variables \" + quotedKeys.slice(0, -1).join(\", \") + \" and \" + quotedKeys.slice(-1) + \".\";\n }\n }\n return descPart;\n }\n exports.hovertemplateAttrs = function(opts, extra) {\n opts = opts || {};\n extra = extra || {};\n var descPart = describeVariables(extra);\n var hovertemplate = {\n valType: \"string\",\n dflt: \"\",\n editType: opts.editType || \"none\"\n };\n if (opts.arrayOk !== false) {\n hovertemplate.arrayOk = true;\n }\n return hovertemplate;\n };\n exports.texttemplateAttrs = function(opts, extra) {\n opts = opts || {};\n extra = extra || {};\n var descPart = describeVariables(extra);\n var texttemplate = {\n valType: \"string\",\n dflt: \"\",\n editType: opts.editType || \"calc\"\n };\n if (opts.arrayOk !== false) {\n texttemplate.arrayOk = true;\n }\n return texttemplate;\n };\n exports.shapeTexttemplateAttrs = function(opts, extra) {\n opts = opts || {};\n extra = extra || {};\n var newStr = opts.newshape ? \"new \" : \"\";\n var descPart = describeVariables(extra);\n var texttemplate = {\n valType: \"string\",\n dflt: \"\",\n editType: opts.editType || \"arraydraw\"\n };\n return texttemplate;\n };\n }\n });\n\n // src/components/shapes/label_texttemplate.js\n var require_label_texttemplate = __commonJS({\n \"src/components/shapes/label_texttemplate.js\"(exports, module) {\n \"use strict\";\n function d2l(v, axis) {\n return axis ? axis.d2l(v) : v;\n }\n function l2d(v, axis) {\n return axis ? axis.l2d(v) : v;\n }\n function x0Fn(shape) {\n return shape.x0;\n }\n function x1Fn(shape) {\n return shape.x1;\n }\n function y0Fn(shape) {\n return shape.y0;\n }\n function y1Fn(shape) {\n return shape.y1;\n }\n function x0shiftFn(shape) {\n return shape.x0shift || 0;\n }\n function x1shiftFn(shape) {\n return shape.x1shift || 0;\n }\n function y0shiftFn(shape) {\n return shape.y0shift || 0;\n }\n function y1shiftFn(shape) {\n return shape.y1shift || 0;\n }\n function dxFn(shape, xa) {\n return d2l(shape.x1, xa) + x1shiftFn(shape) - d2l(shape.x0, xa) - x0shiftFn(shape);\n }\n function dyFn(shape, xa, ya) {\n return d2l(shape.y1, ya) + y1shiftFn(shape) - d2l(shape.y0, ya) - y0shiftFn(shape);\n }\n function widthFn(shape, xa) {\n return Math.abs(dxFn(shape, xa));\n }\n function heightFn(shape, xa, ya) {\n return Math.abs(dyFn(shape, xa, ya));\n }\n function lengthFn(shape, xa, ya) {\n return shape.type !== \"line\" ? void 0 : Math.sqrt(\n Math.pow(dxFn(shape, xa), 2) + Math.pow(dyFn(shape, xa, ya), 2)\n );\n }\n function xcenterFn(shape, xa) {\n return l2d((d2l(shape.x1, xa) + x1shiftFn(shape) + d2l(shape.x0, xa) + x0shiftFn(shape)) / 2, xa);\n }\n function ycenterFn(shape, xa, ya) {\n return l2d((d2l(shape.y1, ya) + y1shiftFn(shape) + d2l(shape.y0, ya) + y0shiftFn(shape)) / 2, ya);\n }\n function slopeFn(shape, xa, ya) {\n return shape.type !== \"line\" ? void 0 : dyFn(shape, xa, ya) / dxFn(shape, xa);\n }\n module.exports = {\n x0: x0Fn,\n x1: x1Fn,\n y0: y0Fn,\n y1: y1Fn,\n slope: slopeFn,\n dx: dxFn,\n dy: dyFn,\n width: widthFn,\n height: heightFn,\n length: lengthFn,\n xcenter: xcenterFn,\n ycenter: ycenterFn\n };\n }\n });\n\n // src/components/shapes/draw_newshape/attributes.js\n var require_attributes5 = __commonJS({\n \"src/components/shapes/draw_newshape/attributes.js\"(exports, module) {\n \"use strict\";\n var overrideAll = require_edit_types().overrideAll;\n var basePlotAttributes = require_attributes2();\n var fontAttrs = require_font_attributes();\n var dash = require_attributes4().dash;\n var extendFlat = require_extend().extendFlat;\n var shapeTexttemplateAttrs = require_template_attributes().shapeTexttemplateAttrs;\n var shapeLabelTexttemplateVars = require_label_texttemplate();\n module.exports = overrideAll({\n newshape: {\n visible: extendFlat({}, basePlotAttributes.visible, {}),\n showlegend: {\n valType: \"boolean\",\n dflt: false\n },\n legend: extendFlat({}, basePlotAttributes.legend, {}),\n legendgroup: extendFlat({}, basePlotAttributes.legendgroup, {}),\n legendgrouptitle: {\n text: extendFlat({}, basePlotAttributes.legendgrouptitle.text, {}),\n font: fontAttrs({})\n },\n legendrank: extendFlat({}, basePlotAttributes.legendrank, {}),\n legendwidth: extendFlat({}, basePlotAttributes.legendwidth, {}),\n line: {\n color: {\n valType: \"color\"\n },\n width: {\n valType: \"number\",\n min: 0,\n dflt: 4\n },\n dash: extendFlat({}, dash, {\n dflt: \"solid\"\n })\n },\n fillcolor: {\n valType: \"color\",\n dflt: \"rgba(0,0,0,0)\"\n },\n fillrule: {\n valType: \"enumerated\",\n values: [\"evenodd\", \"nonzero\"],\n dflt: \"evenodd\"\n },\n opacity: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 1\n },\n layer: {\n valType: \"enumerated\",\n values: [\"below\", \"above\", \"between\"],\n dflt: \"above\"\n },\n drawdirection: {\n valType: \"enumerated\",\n values: [\"ortho\", \"horizontal\", \"vertical\", \"diagonal\"],\n dflt: \"diagonal\"\n },\n name: extendFlat({}, basePlotAttributes.name, {}),\n label: {\n text: {\n valType: \"string\",\n dflt: \"\"\n },\n texttemplate: shapeTexttemplateAttrs({ newshape: true }, { keys: Object.keys(shapeLabelTexttemplateVars) }),\n font: fontAttrs({}),\n textposition: {\n valType: \"enumerated\",\n values: [\n \"top left\",\n \"top center\",\n \"top right\",\n \"middle left\",\n \"middle center\",\n \"middle right\",\n \"bottom left\",\n \"bottom center\",\n \"bottom right\",\n \"start\",\n \"middle\",\n \"end\"\n ]\n },\n textangle: {\n valType: \"angle\",\n dflt: \"auto\"\n },\n xanchor: {\n valType: \"enumerated\",\n values: [\"auto\", \"left\", \"center\", \"right\"],\n dflt: \"auto\"\n },\n yanchor: {\n valType: \"enumerated\",\n values: [\"top\", \"middle\", \"bottom\"]\n },\n padding: {\n valType: \"number\",\n dflt: 3,\n min: 0\n }\n }\n },\n activeshape: {\n fillcolor: {\n valType: \"color\",\n dflt: \"rgb(255,0,255)\"\n },\n opacity: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0.5\n }\n }\n }, \"none\", \"from-root\");\n }\n });\n\n // src/components/selections/draw_newselection/attributes.js\n var require_attributes6 = __commonJS({\n \"src/components/selections/draw_newselection/attributes.js\"(exports, module) {\n \"use strict\";\n var dash = require_attributes4().dash;\n var extendFlat = require_extend().extendFlat;\n module.exports = {\n newselection: {\n mode: {\n valType: \"enumerated\",\n values: [\"immediate\", \"gradual\"],\n dflt: \"immediate\",\n editType: \"none\"\n },\n line: {\n color: {\n valType: \"color\",\n editType: \"none\"\n },\n width: {\n valType: \"number\",\n min: 1,\n dflt: 1,\n editType: \"none\"\n },\n dash: extendFlat({}, dash, {\n dflt: \"dot\",\n editType: \"none\"\n }),\n editType: \"none\"\n },\n // no drawdirection here noting that layout.selectdirection is used instead.\n editType: \"none\"\n },\n activeselection: {\n fillcolor: {\n valType: \"color\",\n dflt: \"rgba(0,0,0,0)\",\n editType: \"none\"\n },\n opacity: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0.5,\n editType: \"none\"\n },\n editType: \"none\"\n }\n };\n }\n });\n\n // src/plots/pad_attributes.js\n var require_pad_attributes = __commonJS({\n \"src/plots/pad_attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = function(opts) {\n var editType = opts.editType;\n return {\n t: {\n valType: \"number\",\n dflt: 0,\n editType\n },\n r: {\n valType: \"number\",\n dflt: 0,\n editType\n },\n b: {\n valType: \"number\",\n dflt: 0,\n editType\n },\n l: {\n valType: \"number\",\n dflt: 0,\n editType\n },\n editType\n };\n };\n }\n });\n\n // src/plots/layout_attributes.js\n var require_layout_attributes2 = __commonJS({\n \"src/plots/layout_attributes.js\"(exports, module) {\n \"use strict\";\n var fontAttrs = require_font_attributes();\n var animationAttrs = require_animation_attributes();\n var colorAttrs = require_attributes3();\n var drawNewShapeAttrs = require_attributes5();\n var drawNewSelectionAttrs = require_attributes6();\n var padAttrs = require_pad_attributes();\n var extendFlat = require_extend().extendFlat;\n var globalFont = fontAttrs({\n editType: \"calc\"\n });\n globalFont.family.dflt = '\"Open Sans\", verdana, arial, sans-serif';\n globalFont.size.dflt = 12;\n globalFont.color.dflt = colorAttrs.defaultLine;\n module.exports = {\n font: globalFont,\n title: {\n text: {\n valType: \"string\",\n editType: \"layoutstyle\"\n },\n font: fontAttrs({\n editType: \"layoutstyle\"\n }),\n subtitle: {\n text: {\n valType: \"string\",\n editType: \"layoutstyle\"\n },\n font: fontAttrs({\n editType: \"layoutstyle\"\n }),\n editType: \"layoutstyle\"\n },\n xref: {\n valType: \"enumerated\",\n dflt: \"container\",\n values: [\"container\", \"paper\"],\n editType: \"layoutstyle\"\n },\n yref: {\n valType: \"enumerated\",\n dflt: \"container\",\n values: [\"container\", \"paper\"],\n editType: \"layoutstyle\"\n },\n x: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0.5,\n editType: \"layoutstyle\"\n },\n y: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: \"auto\",\n editType: \"layoutstyle\"\n },\n xanchor: {\n valType: \"enumerated\",\n dflt: \"auto\",\n values: [\"auto\", \"left\", \"center\", \"right\"],\n editType: \"layoutstyle\"\n },\n yanchor: {\n valType: \"enumerated\",\n dflt: \"auto\",\n values: [\"auto\", \"top\", \"middle\", \"bottom\"],\n editType: \"layoutstyle\"\n },\n pad: extendFlat(padAttrs({ editType: \"layoutstyle\" }), {}),\n automargin: {\n valType: \"boolean\",\n dflt: false,\n editType: \"plot\"\n },\n editType: \"layoutstyle\"\n },\n uniformtext: {\n mode: {\n valType: \"enumerated\",\n values: [false, \"hide\", \"show\"],\n dflt: false,\n editType: \"plot\"\n },\n minsize: {\n valType: \"number\",\n min: 0,\n dflt: 0,\n editType: \"plot\"\n },\n editType: \"plot\"\n },\n autosize: {\n valType: \"boolean\",\n dflt: false,\n // autosize, width, and height get special editType treatment in _relayout\n // so we can handle noop resizes more efficiently\n editType: \"none\"\n },\n width: {\n valType: \"number\",\n min: 10,\n dflt: 700,\n editType: \"plot\"\n },\n height: {\n valType: \"number\",\n min: 10,\n dflt: 450,\n editType: \"plot\"\n },\n minreducedwidth: {\n valType: \"number\",\n min: 2,\n dflt: 64,\n editType: \"plot\"\n },\n minreducedheight: {\n valType: \"number\",\n min: 2,\n dflt: 64,\n editType: \"plot\"\n },\n margin: {\n l: {\n valType: \"number\",\n min: 0,\n dflt: 80,\n editType: \"plot\"\n },\n r: {\n valType: \"number\",\n min: 0,\n dflt: 80,\n editType: \"plot\"\n },\n t: {\n valType: \"number\",\n min: 0,\n dflt: 100,\n editType: \"plot\"\n },\n b: {\n valType: \"number\",\n min: 0,\n dflt: 80,\n editType: \"plot\"\n },\n pad: {\n valType: \"number\",\n min: 0,\n dflt: 0,\n editType: \"plot\"\n },\n autoexpand: {\n valType: \"boolean\",\n dflt: true,\n editType: \"plot\"\n },\n editType: \"plot\"\n },\n computed: {\n valType: \"any\",\n editType: \"none\"\n },\n paper_bgcolor: {\n valType: \"color\",\n dflt: colorAttrs.background,\n editType: \"plot\"\n },\n plot_bgcolor: {\n // defined here, but set in cartesian.supplyLayoutDefaults\n // because it needs to know if there are (2D) axes or not\n valType: \"color\",\n dflt: colorAttrs.background,\n editType: \"layoutstyle\"\n },\n autotypenumbers: {\n valType: \"enumerated\",\n values: [\"convert types\", \"strict\"],\n dflt: \"convert types\",\n editType: \"calc\"\n },\n separators: {\n valType: \"string\",\n editType: \"plot\"\n },\n hidesources: {\n valType: \"boolean\",\n dflt: false,\n editType: \"plot\"\n },\n showlegend: {\n // handled in legend.supplyLayoutDefaults\n // but included here because it's not in the legend object\n valType: \"boolean\",\n editType: \"legend\"\n },\n colorway: {\n valType: \"colorlist\",\n dflt: colorAttrs.defaults,\n editType: \"calc\"\n },\n datarevision: {\n valType: \"any\",\n editType: \"calc\"\n },\n uirevision: {\n valType: \"any\",\n editType: \"none\"\n },\n editrevision: {\n valType: \"any\",\n editType: \"none\"\n },\n selectionrevision: {\n valType: \"any\",\n editType: \"none\"\n },\n template: {\n valType: \"any\",\n editType: \"calc\"\n },\n newshape: drawNewShapeAttrs.newshape,\n activeshape: drawNewShapeAttrs.activeshape,\n newselection: drawNewSelectionAttrs.newselection,\n activeselection: drawNewSelectionAttrs.activeselection,\n meta: {\n valType: \"any\",\n arrayOk: true,\n editType: \"plot\"\n },\n transition: extendFlat({}, animationAttrs.transition, {\n editType: \"none\"\n })\n };\n }\n });\n\n // temp_stylePlugin:node_modules/maplibre-gl/dist/maplibre-gl.css\n var init_maplibre_gl = __esm({\n \"temp_stylePlugin:node_modules/maplibre-gl/dist/maplibre-gl.css\"() {\n }\n });\n\n // stylePlugin:/Users/ekl/code/plotly.js/node_modules/maplibre-gl/dist/maplibre-gl.css\n var maplibre_gl_exports = {};\n var init_maplibre_gl2 = __esm({\n \"stylePlugin:/Users/ekl/code/plotly.js/node_modules/maplibre-gl/dist/maplibre-gl.css\"() {\n init_maplibre_gl();\n }\n });\n\n // src/registry.js\n var require_registry = __commonJS({\n \"src/registry.js\"(exports) {\n \"use strict\";\n var Loggers = require_loggers();\n var noop = require_noop();\n var pushUnique = require_push_unique();\n var isPlainObject = require_is_plain_object();\n var addStyleRule = require_dom().addStyleRule;\n var ExtendModule = require_extend();\n var basePlotAttributes = require_attributes2();\n var baseLayoutAttributes = require_layout_attributes2();\n var extendFlat = ExtendModule.extendFlat;\n var extendDeepAll = ExtendModule.extendDeepAll;\n exports.modules = {};\n exports.allCategories = {};\n exports.allTypes = [];\n exports.subplotsRegistry = {};\n exports.componentsRegistry = {};\n exports.layoutArrayContainers = [];\n exports.layoutArrayRegexes = [];\n exports.traceLayoutAttributes = {};\n exports.localeRegistry = {};\n exports.apiMethodRegistry = {};\n exports.collectableSubplotTypes = null;\n exports.register = function register(_modules) {\n exports.collectableSubplotTypes = null;\n if (!_modules) {\n throw new Error(\"No argument passed to Plotly.register.\");\n } else if (_modules && !Array.isArray(_modules)) {\n _modules = [_modules];\n }\n for (var i = 0; i < _modules.length; i++) {\n var newModule = _modules[i];\n if (!newModule) {\n throw new Error(\"Invalid module was attempted to be registered!\");\n }\n switch (newModule.moduleType) {\n case \"trace\":\n registerTraceModule(newModule);\n break;\n case \"transform\":\n registerTransformModule(newModule);\n break;\n case \"component\":\n registerComponentModule(newModule);\n break;\n case \"locale\":\n registerLocale(newModule);\n break;\n case \"apiMethod\":\n var name2 = newModule.name;\n exports.apiMethodRegistry[name2] = newModule.fn;\n break;\n default:\n throw new Error(\"Invalid module was attempted to be registered!\");\n }\n }\n };\n exports.getModule = function(trace) {\n var _module = exports.modules[getTraceType(trace)];\n if (!_module) return false;\n return _module._module;\n };\n exports.traceIs = function(traceType, category) {\n traceType = getTraceType(traceType);\n if (traceType === \"various\") return false;\n var _module = exports.modules[traceType];\n if (!_module) {\n if (traceType) {\n Loggers.log(\"Unrecognized trace type \" + traceType + \".\");\n }\n _module = exports.modules[basePlotAttributes.type.dflt];\n }\n return !!_module.categories[category];\n };\n exports.getComponentMethod = function(name2, method) {\n var _module = exports.componentsRegistry[name2];\n if (!_module) return noop;\n return _module[method] || noop;\n };\n exports.call = function() {\n var name2 = arguments[0];\n var args = [].slice.call(arguments, 1);\n return exports.apiMethodRegistry[name2].apply(null, args);\n };\n function registerTraceModule(_module) {\n var thisType = _module.name;\n var categoriesIn = _module.categories;\n var meta = _module.meta;\n if (exports.modules[thisType]) {\n Loggers.log(\"Type \" + thisType + \" already registered\");\n return;\n }\n if (!exports.subplotsRegistry[_module.basePlotModule.name]) {\n registerSubplot(_module.basePlotModule);\n }\n var categoryObj = {};\n for (var i = 0; i < categoriesIn.length; i++) {\n categoryObj[categoriesIn[i]] = true;\n exports.allCategories[categoriesIn[i]] = true;\n }\n exports.modules[thisType] = {\n _module,\n categories: categoryObj\n };\n if (meta && Object.keys(meta).length) {\n exports.modules[thisType].meta = meta;\n }\n exports.allTypes.push(thisType);\n for (var componentName in exports.componentsRegistry) {\n mergeComponentAttrsToTrace(componentName, thisType);\n }\n if (_module.layoutAttributes) {\n extendFlat(exports.traceLayoutAttributes, _module.layoutAttributes);\n }\n var basePlotModule = _module.basePlotModule;\n var bpmName = basePlotModule.name;\n if (bpmName === \"mapbox\") {\n var styleRules = basePlotModule.constants.styleRules;\n for (var k in styleRules) {\n addStyleRule(\".js-plotly-plot .plotly .mapboxgl-\" + k, styleRules[k]);\n }\n }\n if (bpmName === \"map\") {\n init_maplibre_gl2();\n }\n if ((bpmName === \"geo\" || bpmName === \"mapbox\" || bpmName === \"map\") && window.PlotlyGeoAssets === void 0) {\n window.PlotlyGeoAssets = { topojson: {} };\n }\n }\n function registerSubplot(_module) {\n var plotType = _module.name;\n if (exports.subplotsRegistry[plotType]) {\n Loggers.log(\"Plot type \" + plotType + \" already registered.\");\n return;\n }\n findArrayRegexps(_module);\n exports.subplotsRegistry[plotType] = _module;\n for (var componentName in exports.componentsRegistry) {\n mergeComponentAttrsToSubplot(componentName, _module.name);\n }\n }\n function registerComponentModule(_module) {\n if (typeof _module.name !== \"string\") {\n throw new Error(\"Component module *name* must be a string.\");\n }\n var name2 = _module.name;\n exports.componentsRegistry[name2] = _module;\n if (_module.layoutAttributes) {\n if (_module.layoutAttributes._isLinkedToArray) {\n pushUnique(exports.layoutArrayContainers, name2);\n }\n findArrayRegexps(_module);\n }\n for (var traceType in exports.modules) {\n mergeComponentAttrsToTrace(name2, traceType);\n }\n for (var subplotName in exports.subplotsRegistry) {\n mergeComponentAttrsToSubplot(name2, subplotName);\n }\n if (_module.schema && _module.schema.layout) {\n extendDeepAll(baseLayoutAttributes, _module.schema.layout);\n }\n }\n function registerTransformModule(_module) {\n if (typeof _module.name !== \"string\") {\n throw new Error(\"Transform module *name* must be a string.\");\n }\n var prefix = \"Transform module \" + _module.name;\n var hasTransform = typeof _module.transform === \"function\";\n var hasCalcTransform = typeof _module.calcTransform === \"function\";\n if (!hasTransform && !hasCalcTransform) {\n throw new Error(prefix + \" is missing a *transform* or *calcTransform* method.\");\n }\n if (hasTransform && hasCalcTransform) {\n Loggers.log([\n prefix + \" has both a *transform* and *calcTransform* methods.\",\n \"Please note that all *transform* methods are executed\",\n \"before all *calcTransform* methods.\"\n ].join(\" \"));\n }\n if (!isPlainObject(_module.attributes)) {\n Loggers.log(prefix + \" registered without an *attributes* object.\");\n }\n if (typeof _module.supplyDefaults !== \"function\") {\n Loggers.log(prefix + \" registered without a *supplyDefaults* method.\");\n }\n }\n function registerLocale(_module) {\n var locale = _module.name;\n var baseLocale = locale.split(\"-\")[0];\n var newDict = _module.dictionary;\n var newFormat = _module.format;\n var hasDict = newDict && Object.keys(newDict).length;\n var hasFormat = newFormat && Object.keys(newFormat).length;\n var locales = exports.localeRegistry;\n var localeObj = locales[locale];\n if (!localeObj) locales[locale] = localeObj = {};\n if (baseLocale !== locale) {\n var baseLocaleObj = locales[baseLocale];\n if (!baseLocaleObj) locales[baseLocale] = baseLocaleObj = {};\n if (hasDict && baseLocaleObj.dictionary === localeObj.dictionary) {\n baseLocaleObj.dictionary = newDict;\n }\n if (hasFormat && baseLocaleObj.format === localeObj.format) {\n baseLocaleObj.format = newFormat;\n }\n }\n if (hasDict) localeObj.dictionary = newDict;\n if (hasFormat) localeObj.format = newFormat;\n }\n function findArrayRegexps(_module) {\n if (_module.layoutAttributes) {\n var arrayAttrRegexps = _module.layoutAttributes._arrayAttrRegexps;\n if (arrayAttrRegexps) {\n for (var i = 0; i < arrayAttrRegexps.length; i++) {\n pushUnique(exports.layoutArrayRegexes, arrayAttrRegexps[i]);\n }\n }\n }\n }\n function mergeComponentAttrsToTrace(componentName, traceType) {\n var componentSchema = exports.componentsRegistry[componentName].schema;\n if (!componentSchema || !componentSchema.traces) return;\n var traceAttrs = componentSchema.traces[traceType];\n if (traceAttrs) {\n extendDeepAll(exports.modules[traceType]._module.attributes, traceAttrs);\n }\n }\n function mergeComponentAttrsToSubplot(componentName, subplotName) {\n var componentSchema = exports.componentsRegistry[componentName].schema;\n if (!componentSchema || !componentSchema.subplots) return;\n var subplotModule = exports.subplotsRegistry[subplotName];\n var subplotAttrs = subplotModule.layoutAttributes;\n var subplotAttr = subplotModule.attr === \"subplot\" ? subplotModule.name : subplotModule.attr;\n if (Array.isArray(subplotAttr)) subplotAttr = subplotAttr[0];\n var componentLayoutAttrs = componentSchema.subplots[subplotAttr];\n if (subplotAttrs && componentLayoutAttrs) {\n extendDeepAll(subplotAttrs, componentLayoutAttrs);\n }\n }\n function getTraceType(traceType) {\n if (typeof traceType === \"object\") traceType = traceType.type;\n return traceType;\n }\n }\n });\n\n // src/lib/dates.js\n var require_dates = __commonJS({\n \"src/lib/dates.js\"(exports) {\n \"use strict\";\n var timeFormat = require_d3_time_format().timeFormat;\n var isNumeric = require_fast_isnumeric();\n var Loggers = require_loggers();\n var mod = require_mod().mod;\n var constants = require_numerical();\n var BADNUM = constants.BADNUM;\n var ONEDAY = constants.ONEDAY;\n var ONEHOUR = constants.ONEHOUR;\n var ONEMIN = constants.ONEMIN;\n var ONESEC = constants.ONESEC;\n var EPOCHJD = constants.EPOCHJD;\n var Registry = require_registry();\n var utcFormat = require_d3_time_format().utcFormat;\n var DATETIME_REGEXP = /^\\s*(-?\\d\\d\\d\\d|\\d\\d)(-(\\d?\\d)(-(\\d?\\d)([ Tt]([01]?\\d|2[0-3])(:([0-5]\\d)(:([0-5]\\d(\\.\\d+)?))?(Z|z|[+\\-]\\d\\d(:?\\d\\d)?)?)?)?)?)?\\s*$/m;\n var DATETIME_REGEXP_CN = /^\\s*(-?\\d\\d\\d\\d|\\d\\d)(-(\\d?\\di?)(-(\\d?\\d)([ Tt]([01]?\\d|2[0-3])(:([0-5]\\d)(:([0-5]\\d(\\.\\d+)?))?(Z|z|[+\\-]\\d\\d(:?\\d\\d)?)?)?)?)?)?\\s*$/m;\n var YFIRST = (/* @__PURE__ */ new Date()).getFullYear() - 70;\n function isWorldCalendar(calendar) {\n return calendar && Registry.componentsRegistry.calendars && typeof calendar === \"string\" && calendar !== \"gregorian\";\n }\n exports.dateTick0 = function(calendar, dayOfWeek) {\n var tick0 = _dateTick0(calendar, !!dayOfWeek);\n if (dayOfWeek < 2) return tick0;\n var v = exports.dateTime2ms(tick0, calendar);\n v += ONEDAY * (dayOfWeek - 1);\n return exports.ms2DateTime(v, 0, calendar);\n };\n function _dateTick0(calendar, sunday) {\n if (isWorldCalendar(calendar)) {\n return sunday ? Registry.getComponentMethod(\"calendars\", \"CANONICAL_SUNDAY\")[calendar] : Registry.getComponentMethod(\"calendars\", \"CANONICAL_TICK\")[calendar];\n } else {\n return sunday ? \"2000-01-02\" : \"2000-01-01\";\n }\n }\n exports.dfltRange = function(calendar) {\n if (isWorldCalendar(calendar)) {\n return Registry.getComponentMethod(\"calendars\", \"DFLTRANGE\")[calendar];\n } else {\n return [\"2000-01-01\", \"2001-01-01\"];\n }\n };\n exports.isJSDate = function(v) {\n return typeof v === \"object\" && v !== null && typeof v.getTime === \"function\";\n };\n var MIN_MS;\n var MAX_MS;\n exports.dateTime2ms = function(s, calendar) {\n if (exports.isJSDate(s)) {\n var tzOffset = s.getTimezoneOffset() * ONEMIN;\n var offsetTweak = (s.getUTCMinutes() - s.getMinutes()) * ONEMIN + (s.getUTCSeconds() - s.getSeconds()) * ONESEC + (s.getUTCMilliseconds() - s.getMilliseconds());\n if (offsetTweak) {\n var comb = 3 * ONEMIN;\n tzOffset = tzOffset - comb / 2 + mod(offsetTweak - tzOffset + comb / 2, comb);\n }\n s = Number(s) - tzOffset;\n if (s >= MIN_MS && s <= MAX_MS) return s;\n return BADNUM;\n }\n if (typeof s !== \"string\" && typeof s !== \"number\") return BADNUM;\n s = String(s);\n var isWorld = isWorldCalendar(calendar);\n var s0 = s.charAt(0);\n if (isWorld && (s0 === \"G\" || s0 === \"g\")) {\n s = s.substr(1);\n calendar = \"\";\n }\n var isChinese = isWorld && calendar.substr(0, 7) === \"chinese\";\n var match = s.match(isChinese ? DATETIME_REGEXP_CN : DATETIME_REGEXP);\n if (!match) return BADNUM;\n var y = match[1];\n var m = match[3] || \"1\";\n var d = Number(match[5] || 1);\n var H = Number(match[7] || 0);\n var M = Number(match[9] || 0);\n var S = Number(match[11] || 0);\n if (isWorld) {\n if (y.length === 2) return BADNUM;\n y = Number(y);\n var cDate;\n try {\n var calInstance = Registry.getComponentMethod(\"calendars\", \"getCal\")(calendar);\n if (isChinese) {\n var isIntercalary = m.charAt(m.length - 1) === \"i\";\n m = parseInt(m, 10);\n cDate = calInstance.newDate(y, calInstance.toMonthIndex(y, m, isIntercalary), d);\n } else {\n cDate = calInstance.newDate(y, Number(m), d);\n }\n } catch (e) {\n return BADNUM;\n }\n if (!cDate) return BADNUM;\n return (cDate.toJD() - EPOCHJD) * ONEDAY + H * ONEHOUR + M * ONEMIN + S * ONESEC;\n }\n if (y.length === 2) {\n y = (Number(y) + 2e3 - YFIRST) % 100 + YFIRST;\n } else y = Number(y);\n m -= 1;\n var date = new Date(Date.UTC(2e3, m, d, H, M));\n date.setUTCFullYear(y);\n if (date.getUTCMonth() !== m) return BADNUM;\n if (date.getUTCDate() !== d) return BADNUM;\n return date.getTime() + S * ONESEC;\n };\n MIN_MS = exports.MIN_MS = exports.dateTime2ms(\"-9999\");\n MAX_MS = exports.MAX_MS = exports.dateTime2ms(\"9999-12-31 23:59:59.9999\");\n exports.isDateTime = function(s, calendar) {\n return exports.dateTime2ms(s, calendar) !== BADNUM;\n };\n function lpad(val, digits) {\n return String(val + Math.pow(10, digits)).substr(1);\n }\n var NINETYDAYS = 90 * ONEDAY;\n var THREEHOURS = 3 * ONEHOUR;\n var FIVEMIN = 5 * ONEMIN;\n exports.ms2DateTime = function(ms, r, calendar) {\n if (typeof ms !== \"number\" || !(ms >= MIN_MS && ms <= MAX_MS)) return BADNUM;\n if (!r) r = 0;\n var msecTenths = Math.floor(mod(ms + 0.05, 1) * 10);\n var msRounded = Math.round(ms - msecTenths / 10);\n var dateStr, h, m, s, msec10, d;\n if (isWorldCalendar(calendar)) {\n var dateJD = Math.floor(msRounded / ONEDAY) + EPOCHJD;\n var timeMs = Math.floor(mod(ms, ONEDAY));\n try {\n dateStr = Registry.getComponentMethod(\"calendars\", \"getCal\")(calendar).fromJD(dateJD).formatDate(\"yyyy-mm-dd\");\n } catch (e) {\n dateStr = utcFormat(\"G%Y-%m-%d\")(new Date(msRounded));\n }\n if (dateStr.charAt(0) === \"-\") {\n while (dateStr.length < 11) dateStr = \"-0\" + dateStr.substr(1);\n } else {\n while (dateStr.length < 10) dateStr = \"0\" + dateStr;\n }\n h = r < NINETYDAYS ? Math.floor(timeMs / ONEHOUR) : 0;\n m = r < NINETYDAYS ? Math.floor(timeMs % ONEHOUR / ONEMIN) : 0;\n s = r < THREEHOURS ? Math.floor(timeMs % ONEMIN / ONESEC) : 0;\n msec10 = r < FIVEMIN ? timeMs % ONESEC * 10 + msecTenths : 0;\n } else {\n d = new Date(msRounded);\n dateStr = utcFormat(\"%Y-%m-%d\")(d);\n h = r < NINETYDAYS ? d.getUTCHours() : 0;\n m = r < NINETYDAYS ? d.getUTCMinutes() : 0;\n s = r < THREEHOURS ? d.getUTCSeconds() : 0;\n msec10 = r < FIVEMIN ? d.getUTCMilliseconds() * 10 + msecTenths : 0;\n }\n return includeTime(dateStr, h, m, s, msec10);\n };\n exports.ms2DateTimeLocal = function(ms) {\n if (!(ms >= MIN_MS + ONEDAY && ms <= MAX_MS - ONEDAY)) return BADNUM;\n var msecTenths = Math.floor(mod(ms + 0.05, 1) * 10);\n var d = new Date(Math.round(ms - msecTenths / 10));\n var dateStr = timeFormat(\"%Y-%m-%d\")(d);\n var h = d.getHours();\n var m = d.getMinutes();\n var s = d.getSeconds();\n var msec10 = d.getUTCMilliseconds() * 10 + msecTenths;\n return includeTime(dateStr, h, m, s, msec10);\n };\n function includeTime(dateStr, h, m, s, msec10) {\n if (h || m || s || msec10) {\n dateStr += \" \" + lpad(h, 2) + \":\" + lpad(m, 2);\n if (s || msec10) {\n dateStr += \":\" + lpad(s, 2);\n if (msec10) {\n var digits = 4;\n while (msec10 % 10 === 0) {\n digits -= 1;\n msec10 /= 10;\n }\n dateStr += \".\" + lpad(msec10, digits);\n }\n }\n }\n return dateStr;\n }\n exports.cleanDate = function(v, dflt, calendar) {\n if (v === BADNUM) return dflt;\n if (exports.isJSDate(v) || typeof v === \"number\" && isFinite(v)) {\n if (isWorldCalendar(calendar)) {\n Loggers.error(\"JS Dates and milliseconds are incompatible with world calendars\", v);\n return dflt;\n }\n v = exports.ms2DateTimeLocal(+v);\n if (!v && dflt !== void 0) return dflt;\n } else if (!exports.isDateTime(v, calendar)) {\n Loggers.error(\"unrecognized date\", v);\n return dflt;\n }\n return v;\n };\n var fracMatch = /%\\d?f/g;\n var halfYearMatch = /%h/g;\n var quarterToHalfYear = {\n 1: \"1\",\n 2: \"1\",\n 3: \"2\",\n 4: \"2\"\n };\n function modDateFormat(fmt, x, formatter, calendar) {\n fmt = fmt.replace(fracMatch, function(match) {\n var digits = Math.min(+match.charAt(1) || 6, 6);\n var fracSecs = (x / 1e3 % 1 + 2).toFixed(digits).substr(2).replace(/0+$/, \"\") || \"0\";\n return fracSecs;\n });\n var d = new Date(Math.floor(x + 0.05));\n fmt = fmt.replace(halfYearMatch, function() {\n return quarterToHalfYear[formatter(\"%q\")(d)];\n });\n if (isWorldCalendar(calendar)) {\n try {\n fmt = Registry.getComponentMethod(\"calendars\", \"worldCalFmt\")(fmt, x, calendar);\n } catch (e) {\n return \"Invalid\";\n }\n }\n return formatter(fmt)(d);\n }\n var MAXSECONDS = [59, 59.9, 59.99, 59.999, 59.9999];\n function formatTime(x, tr) {\n var timePart = mod(x + 0.05, ONEDAY);\n var timeStr = lpad(Math.floor(timePart / ONEHOUR), 2) + \":\" + lpad(mod(Math.floor(timePart / ONEMIN), 60), 2);\n if (tr !== \"M\") {\n if (!isNumeric(tr)) tr = 0;\n var sec = Math.min(mod(x / ONESEC, 60), MAXSECONDS[tr]);\n var secStr = (100 + sec).toFixed(tr).substr(1);\n if (tr > 0) {\n secStr = secStr.replace(/0+$/, \"\").replace(/[\\.]$/, \"\");\n }\n timeStr += \":\" + secStr;\n }\n return timeStr;\n }\n exports.formatDate = function(x, fmt, tr, formatter, calendar, extraFormat) {\n calendar = isWorldCalendar(calendar) && calendar;\n if (!fmt) {\n if (tr === \"y\") fmt = extraFormat.year;\n else if (tr === \"m\") fmt = extraFormat.month;\n else if (tr === \"d\") {\n fmt = extraFormat.dayMonth + \"\\n\" + extraFormat.year;\n } else {\n return formatTime(x, tr) + \"\\n\" + modDateFormat(extraFormat.dayMonthYear, x, formatter, calendar);\n }\n }\n return modDateFormat(fmt, x, formatter, calendar);\n };\n var THREEDAYS = 3 * ONEDAY;\n exports.incrementMonth = function(ms, dMonth, calendar) {\n calendar = isWorldCalendar(calendar) && calendar;\n var timeMs = mod(ms, ONEDAY);\n ms = Math.round(ms - timeMs);\n if (calendar) {\n try {\n var dateJD = Math.round(ms / ONEDAY) + EPOCHJD;\n var calInstance = Registry.getComponentMethod(\"calendars\", \"getCal\")(calendar);\n var cDate = calInstance.fromJD(dateJD);\n if (dMonth % 12) calInstance.add(cDate, dMonth, \"m\");\n else calInstance.add(cDate, dMonth / 12, \"y\");\n return (cDate.toJD() - EPOCHJD) * ONEDAY + timeMs;\n } catch (e) {\n Loggers.error(\"invalid ms \" + ms + \" in calendar \" + calendar);\n }\n }\n var y = new Date(ms + THREEDAYS);\n return y.setUTCMonth(y.getUTCMonth() + dMonth) + timeMs - THREEDAYS;\n };\n exports.findExactDates = function(data, calendar) {\n var exactYears = 0;\n var exactMonths = 0;\n var exactDays = 0;\n var blankCount = 0;\n var d;\n var di;\n var calInstance = isWorldCalendar(calendar) && Registry.getComponentMethod(\"calendars\", \"getCal\")(calendar);\n for (var i = 0; i < data.length; i++) {\n di = data[i];\n if (!isNumeric(di)) {\n blankCount++;\n continue;\n }\n if (di % ONEDAY) continue;\n if (calInstance) {\n try {\n d = calInstance.fromJD(di / ONEDAY + EPOCHJD);\n if (d.day() === 1) {\n if (d.month() === 1) exactYears++;\n else exactMonths++;\n } else exactDays++;\n } catch (e) {\n }\n } else {\n d = new Date(di);\n if (d.getUTCDate() === 1) {\n if (d.getUTCMonth() === 0) exactYears++;\n else exactMonths++;\n } else exactDays++;\n }\n }\n exactMonths += exactYears;\n exactDays += exactMonths;\n var dataCount = data.length - blankCount;\n return {\n exactYears: exactYears / dataCount,\n exactMonths: exactMonths / dataCount,\n exactDays: exactDays / dataCount\n };\n };\n }\n });\n\n // src/lib/identity.js\n var require_identity2 = __commonJS({\n \"src/lib/identity.js\"(exports, module) {\n \"use strict\";\n module.exports = function identity2(d) {\n return d;\n };\n }\n });\n\n // src/lib/search.js\n var require_search = __commonJS({\n \"src/lib/search.js\"(exports) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var loggers = require_loggers();\n var identity2 = require_identity2();\n var BADNUM = require_numerical().BADNUM;\n var roundingError = 1e-9;\n exports.findBin = function(val, bins, linelow) {\n if (isNumeric(bins.start)) {\n return linelow ? Math.ceil((val - bins.start) / bins.size - roundingError) - 1 : Math.floor((val - bins.start) / bins.size + roundingError);\n } else {\n var n1 = 0;\n var n2 = bins.length;\n var c = 0;\n var binSize = n2 > 1 ? (bins[n2 - 1] - bins[0]) / (n2 - 1) : 1;\n var n, test;\n if (binSize >= 0) {\n test = linelow ? lessThan : lessOrEqual;\n } else {\n test = linelow ? greaterOrEqual : greaterThan;\n }\n val += binSize * roundingError * (linelow ? -1 : 1) * (binSize >= 0 ? 1 : -1);\n while (n1 < n2 && c++ < 100) {\n n = Math.floor((n1 + n2) / 2);\n if (test(bins[n], val)) n1 = n + 1;\n else n2 = n;\n }\n if (c > 90) loggers.log(\"Long binary search...\");\n return n1 - 1;\n }\n };\n function lessThan(a, b) {\n return a < b;\n }\n function lessOrEqual(a, b) {\n return a <= b;\n }\n function greaterThan(a, b) {\n return a > b;\n }\n function greaterOrEqual(a, b) {\n return a >= b;\n }\n exports.sorterAsc = function(a, b) {\n return a - b;\n };\n exports.sorterDes = function(a, b) {\n return b - a;\n };\n exports.distinctVals = function(valsIn) {\n var vals = valsIn.slice();\n vals.sort(exports.sorterAsc);\n var last;\n for (last = vals.length - 1; last > -1; last--) {\n if (vals[last] !== BADNUM) break;\n }\n var minDiff = vals[last] - vals[0] || 1;\n var errDiff = minDiff / (last || 1) / 1e4;\n var newVals = [];\n var preV;\n for (var i = 0; i <= last; i++) {\n var v = vals[i];\n var diff = v - preV;\n if (preV === void 0) {\n newVals.push(v);\n preV = v;\n } else if (diff > errDiff) {\n minDiff = Math.min(minDiff, diff);\n newVals.push(v);\n preV = v;\n }\n }\n return { vals: newVals, minDiff };\n };\n exports.roundUp = function(val, arrayIn, reverse) {\n var low = 0;\n var high = arrayIn.length - 1;\n var mid;\n var c = 0;\n var dlow = reverse ? 0 : 1;\n var dhigh = reverse ? 1 : 0;\n var rounded = reverse ? Math.ceil : Math.floor;\n while (low < high && c++ < 100) {\n mid = rounded((low + high) / 2);\n if (arrayIn[mid] <= val) low = mid + dlow;\n else high = mid - dhigh;\n }\n return arrayIn[low];\n };\n exports.sort = function(array, sortFn) {\n var notOrdered = 0;\n var notReversed = 0;\n for (var i = 1; i < array.length; i++) {\n var pairOrder = sortFn(array[i], array[i - 1]);\n if (pairOrder < 0) notOrdered = 1;\n else if (pairOrder > 0) notReversed = 1;\n if (notOrdered && notReversed) return array.sort(sortFn);\n }\n return notReversed ? array : array.reverse();\n };\n exports.findIndexOfMin = function(arr, fn) {\n fn = fn || identity2;\n var min = Infinity;\n var ind;\n for (var i = 0; i < arr.length; i++) {\n var v = fn(arr[i]);\n if (v < min) {\n min = v;\n ind = i;\n }\n }\n return ind;\n };\n }\n });\n\n // src/lib/sort_object_keys.js\n var require_sort_object_keys = __commonJS({\n \"src/lib/sort_object_keys.js\"(exports, module) {\n \"use strict\";\n module.exports = function sortObjectKeys(obj) {\n return Object.keys(obj).sort();\n };\n }\n });\n\n // src/lib/stats.js\n var require_stats = __commonJS({\n \"src/lib/stats.js\"(exports) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var isArrayOrTypedArray = require_array().isArrayOrTypedArray;\n exports.aggNums = function(f, v, a, len) {\n var i, b;\n if (!len || len > a.length) len = a.length;\n if (!isNumeric(v)) v = false;\n if (isArrayOrTypedArray(a[0])) {\n b = new Array(len);\n for (i = 0; i < len; i++) b[i] = exports.aggNums(f, v, a[i]);\n a = b;\n }\n for (i = 0; i < len; i++) {\n if (!isNumeric(v)) v = a[i];\n else if (isNumeric(a[i])) v = f(+v, +a[i]);\n }\n return v;\n };\n exports.len = function(data) {\n return exports.aggNums(function(a) {\n return a + 1;\n }, 0, data);\n };\n exports.mean = function(data, len) {\n if (!len) len = exports.len(data);\n return exports.aggNums(function(a, b) {\n return a + b;\n }, 0, data) / len;\n };\n exports.geometricMean = function(data, len) {\n if (!len) len = exports.len(data);\n return Math.pow(exports.aggNums(function(a, b) {\n return a * b;\n }, 1, data), 1 / len);\n };\n exports.midRange = function(numArr) {\n if (numArr === void 0 || numArr.length === 0) return void 0;\n return (exports.aggNums(Math.max, null, numArr) + exports.aggNums(Math.min, null, numArr)) / 2;\n };\n exports.variance = function(data, len, mean) {\n if (!len) len = exports.len(data);\n if (!isNumeric(mean)) mean = exports.mean(data, len);\n return exports.aggNums(function(a, b) {\n return a + Math.pow(b - mean, 2);\n }, 0, data) / len;\n };\n exports.stdev = function(data, len, mean) {\n return Math.sqrt(exports.variance(data, len, mean));\n };\n exports.median = function(data) {\n var b = data.slice().sort();\n return exports.interp(b, 0.5);\n };\n exports.interp = function(arr, n) {\n if (!isNumeric(n)) throw \"n should be a finite number\";\n n = n * arr.length - 0.5;\n if (n < 0) return arr[0];\n if (n > arr.length - 1) return arr[arr.length - 1];\n var frac = n % 1;\n return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)];\n };\n }\n });\n\n // src/lib/angles.js\n var require_angles = __commonJS({\n \"src/lib/angles.js\"(exports, module) {\n \"use strict\";\n var modModule = require_mod();\n var mod = modModule.mod;\n var modHalf = modModule.modHalf;\n var PI = Math.PI;\n var twoPI = 2 * PI;\n function deg2rad(deg) {\n return deg / 180 * PI;\n }\n function rad2deg(rad) {\n return rad / PI * 180;\n }\n function isFullCircle(aBnds) {\n return Math.abs(aBnds[1] - aBnds[0]) > twoPI - 1e-14;\n }\n function angleDelta(a, b) {\n return modHalf(b - a, twoPI);\n }\n function angleDist(a, b) {\n return Math.abs(angleDelta(a, b));\n }\n function isAngleInsideSector(a, aBnds) {\n if (isFullCircle(aBnds)) return true;\n var s0, s1;\n if (aBnds[0] < aBnds[1]) {\n s0 = aBnds[0];\n s1 = aBnds[1];\n } else {\n s0 = aBnds[1];\n s1 = aBnds[0];\n }\n s0 = mod(s0, twoPI);\n s1 = mod(s1, twoPI);\n if (s0 > s1) s1 += twoPI;\n var a0 = mod(a, twoPI);\n var a1 = a0 + twoPI;\n return a0 >= s0 && a0 <= s1 || a1 >= s0 && a1 <= s1;\n }\n function isPtInsideSector(r, a, rBnds, aBnds) {\n if (!isAngleInsideSector(a, aBnds)) return false;\n var r0, r1;\n if (rBnds[0] < rBnds[1]) {\n r0 = rBnds[0];\n r1 = rBnds[1];\n } else {\n r0 = rBnds[1];\n r1 = rBnds[0];\n }\n return r >= r0 && r <= r1;\n }\n function _path(r0, r1, a0, a1, cx, cy, isClosed) {\n cx = cx || 0;\n cy = cy || 0;\n var isCircle = isFullCircle([a0, a1]);\n var aStart, aMid, aEnd;\n var rStart, rEnd;\n if (isCircle) {\n aStart = 0;\n aMid = PI;\n aEnd = twoPI;\n } else {\n if (a0 < a1) {\n aStart = a0;\n aEnd = a1;\n } else {\n aStart = a1;\n aEnd = a0;\n }\n }\n if (r0 < r1) {\n rStart = r0;\n rEnd = r1;\n } else {\n rStart = r1;\n rEnd = r0;\n }\n function pt(r, a) {\n return [r * Math.cos(a) + cx, cy - r * Math.sin(a)];\n }\n var largeArc = Math.abs(aEnd - aStart) <= PI ? 0 : 1;\n function arc(r, a, cw) {\n return \"A\" + [r, r] + \" \" + [0, largeArc, cw] + \" \" + pt(r, a);\n }\n var p;\n if (isCircle) {\n if (rStart === null) {\n p = \"M\" + pt(rEnd, aStart) + arc(rEnd, aMid, 0) + arc(rEnd, aEnd, 0) + \"Z\";\n } else {\n p = \"M\" + pt(rStart, aStart) + arc(rStart, aMid, 0) + arc(rStart, aEnd, 0) + \"ZM\" + pt(rEnd, aStart) + arc(rEnd, aMid, 1) + arc(rEnd, aEnd, 1) + \"Z\";\n }\n } else {\n if (rStart === null) {\n p = \"M\" + pt(rEnd, aStart) + arc(rEnd, aEnd, 0);\n if (isClosed) p += \"L0,0Z\";\n } else {\n p = \"M\" + pt(rStart, aStart) + \"L\" + pt(rEnd, aStart) + arc(rEnd, aEnd, 0) + \"L\" + pt(rStart, aEnd) + arc(rStart, aStart, 1) + \"Z\";\n }\n }\n return p;\n }\n function pathArc(r, a0, a1, cx, cy) {\n return _path(null, r, a0, a1, cx, cy, 0);\n }\n function pathSector(r, a0, a1, cx, cy) {\n return _path(null, r, a0, a1, cx, cy, 1);\n }\n function pathAnnulus(r0, r1, a0, a1, cx, cy) {\n return _path(r0, r1, a0, a1, cx, cy, 1);\n }\n module.exports = {\n deg2rad,\n rad2deg,\n angleDelta,\n angleDist,\n isFullCircle,\n isAngleInsideSector,\n isPtInsideSector,\n pathArc,\n pathSector,\n pathAnnulus\n };\n }\n });\n\n // src/lib/anchor_utils.js\n var require_anchor_utils = __commonJS({\n \"src/lib/anchor_utils.js\"(exports) {\n \"use strict\";\n exports.isLeftAnchor = function isLeftAnchor(opts) {\n return opts.xanchor === \"left\" || opts.xanchor === \"auto\" && opts.x <= 1 / 3;\n };\n exports.isCenterAnchor = function isCenterAnchor(opts) {\n return opts.xanchor === \"center\" || opts.xanchor === \"auto\" && opts.x > 1 / 3 && opts.x < 2 / 3;\n };\n exports.isRightAnchor = function isRightAnchor(opts) {\n return opts.xanchor === \"right\" || opts.xanchor === \"auto\" && opts.x >= 2 / 3;\n };\n exports.isTopAnchor = function isTopAnchor(opts) {\n return opts.yanchor === \"top\" || opts.yanchor === \"auto\" && opts.y >= 2 / 3;\n };\n exports.isMiddleAnchor = function isMiddleAnchor(opts) {\n return opts.yanchor === \"middle\" || opts.yanchor === \"auto\" && opts.y > 1 / 3 && opts.y < 2 / 3;\n };\n exports.isBottomAnchor = function isBottomAnchor(opts) {\n return opts.yanchor === \"bottom\" || opts.yanchor === \"auto\" && opts.y <= 1 / 3;\n };\n }\n });\n\n // src/lib/geometry2d.js\n var require_geometry2d = __commonJS({\n \"src/lib/geometry2d.js\"(exports) {\n \"use strict\";\n var mod = require_mod().mod;\n exports.segmentsIntersect = segmentsIntersect;\n function segmentsIntersect(x1, y1, x2, y2, x3, y3, x4, y4) {\n var a = x2 - x1;\n var b = x3 - x1;\n var c = x4 - x3;\n var d = y2 - y1;\n var e = y3 - y1;\n var f = y4 - y3;\n var det = a * f - c * d;\n if (det === 0) return null;\n var t = (b * f - c * e) / det;\n var u = (b * d - a * e) / det;\n if (u < 0 || u > 1 || t < 0 || t > 1) return null;\n return { x: x1 + a * t, y: y1 + d * t };\n }\n exports.segmentDistance = function segmentDistance(x1, y1, x2, y2, x3, y3, x4, y4) {\n if (segmentsIntersect(x1, y1, x2, y2, x3, y3, x4, y4)) return 0;\n var x12 = x2 - x1;\n var y12 = y2 - y1;\n var x34 = x4 - x3;\n var y34 = y4 - y3;\n var ll12 = x12 * x12 + y12 * y12;\n var ll34 = x34 * x34 + y34 * y34;\n var dist2 = Math.min(\n perpDistance2(x12, y12, ll12, x3 - x1, y3 - y1),\n perpDistance2(x12, y12, ll12, x4 - x1, y4 - y1),\n perpDistance2(x34, y34, ll34, x1 - x3, y1 - y3),\n perpDistance2(x34, y34, ll34, x2 - x3, y2 - y3)\n );\n return Math.sqrt(dist2);\n };\n function perpDistance2(xab, yab, llab, xac, yac) {\n var fcAB = xac * xab + yac * yab;\n if (fcAB < 0) {\n return xac * xac + yac * yac;\n } else if (fcAB > llab) {\n var xbc = xac - xab;\n var ybc = yac - yab;\n return xbc * xbc + ybc * ybc;\n } else {\n var crossProduct = xac * yab - yac * xab;\n return crossProduct * crossProduct / llab;\n }\n }\n var locationCache;\n var workingPath;\n var workingTextWidth;\n exports.getTextLocation = function getTextLocation(path, totalPathLen, positionOnPath, textWidth) {\n if (path !== workingPath || textWidth !== workingTextWidth) {\n locationCache = {};\n workingPath = path;\n workingTextWidth = textWidth;\n }\n if (locationCache[positionOnPath]) {\n return locationCache[positionOnPath];\n }\n var p0 = path.getPointAtLength(mod(positionOnPath - textWidth / 2, totalPathLen));\n var p1 = path.getPointAtLength(mod(positionOnPath + textWidth / 2, totalPathLen));\n var theta = Math.atan((p1.y - p0.y) / (p1.x - p0.x));\n var pCenter = path.getPointAtLength(mod(positionOnPath, totalPathLen));\n var x = (pCenter.x * 4 + p0.x + p1.x) / 6;\n var y = (pCenter.y * 4 + p0.y + p1.y) / 6;\n var out = { x, y, theta };\n locationCache[positionOnPath] = out;\n return out;\n };\n exports.clearLocationCache = function() {\n workingPath = null;\n };\n exports.getVisibleSegment = function getVisibleSegment(path, bounds, buffer) {\n var left = bounds.left;\n var right = bounds.right;\n var top = bounds.top;\n var bottom = bounds.bottom;\n var pMin = 0;\n var pTotal = path.getTotalLength();\n var pMax = pTotal;\n var pt0, ptTotal;\n function getDistToPlot(len) {\n var pt = path.getPointAtLength(len);\n if (len === 0) pt0 = pt;\n else if (len === pTotal) ptTotal = pt;\n var dx = pt.x < left ? left - pt.x : pt.x > right ? pt.x - right : 0;\n var dy = pt.y < top ? top - pt.y : pt.y > bottom ? pt.y - bottom : 0;\n return Math.sqrt(dx * dx + dy * dy);\n }\n var distToPlot = getDistToPlot(pMin);\n while (distToPlot) {\n pMin += distToPlot + buffer;\n if (pMin > pMax) return;\n distToPlot = getDistToPlot(pMin);\n }\n distToPlot = getDistToPlot(pMax);\n while (distToPlot) {\n pMax -= distToPlot + buffer;\n if (pMin > pMax) return;\n distToPlot = getDistToPlot(pMax);\n }\n return {\n min: pMin,\n max: pMax,\n len: pMax - pMin,\n total: pTotal,\n isClosed: pMin === 0 && pMax === pTotal && Math.abs(pt0.x - ptTotal.x) < 0.1 && Math.abs(pt0.y - ptTotal.y) < 0.1\n };\n };\n exports.findPointOnPath = function findPointOnPath(path, val, coord, opts) {\n opts = opts || {};\n var pathLength = opts.pathLength || path.getTotalLength();\n var tolerance = opts.tolerance || 1e-3;\n var iterationLimit = opts.iterationLimit || 30;\n var mul = path.getPointAtLength(0)[coord] > path.getPointAtLength(pathLength)[coord] ? -1 : 1;\n var i = 0;\n var b0 = 0;\n var b1 = pathLength;\n var mid;\n var pt;\n var diff;\n while (i < iterationLimit) {\n mid = (b0 + b1) / 2;\n pt = path.getPointAtLength(mid);\n diff = pt[coord] - val;\n if (Math.abs(diff) < tolerance) {\n return pt;\n } else {\n if (mul * diff > 0) {\n b1 = mid;\n } else {\n b0 = mid;\n }\n i++;\n }\n }\n return pt;\n };\n }\n });\n\n // src/lib/throttle.js\n var require_throttle = __commonJS({\n \"src/lib/throttle.js\"(exports) {\n \"use strict\";\n var timerCache = {};\n exports.throttle = function throttle(id, minInterval, callback) {\n var cache = timerCache[id];\n var now = Date.now();\n if (!cache) {\n for (var idi in timerCache) {\n if (timerCache[idi].ts < now - 6e4) {\n delete timerCache[idi];\n }\n }\n cache = timerCache[id] = { ts: 0, timer: null };\n }\n _clearTimeout(cache);\n function exec() {\n callback();\n cache.ts = Date.now();\n if (cache.onDone) {\n cache.onDone();\n cache.onDone = null;\n }\n }\n if (now > cache.ts + minInterval) {\n exec();\n return;\n }\n cache.timer = setTimeout(function() {\n exec();\n cache.timer = null;\n }, minInterval);\n };\n exports.done = function(id) {\n var cache = timerCache[id];\n if (!cache || !cache.timer) return Promise.resolve();\n return new Promise(function(resolve) {\n var previousOnDone = cache.onDone;\n cache.onDone = function onDone() {\n if (previousOnDone) previousOnDone();\n resolve();\n cache.onDone = null;\n };\n });\n };\n exports.clear = function(id) {\n if (id) {\n _clearTimeout(timerCache[id]);\n delete timerCache[id];\n } else {\n for (var idi in timerCache) exports.clear(idi);\n }\n };\n function _clearTimeout(cache) {\n if (cache && cache.timer !== null) {\n clearTimeout(cache.timer);\n cache.timer = null;\n }\n }\n }\n });\n\n // src/lib/clear_responsive.js\n var require_clear_responsive = __commonJS({\n \"src/lib/clear_responsive.js\"(exports, module) {\n \"use strict\";\n module.exports = function clearResponsive(gd) {\n if (gd._responsiveChartHandler) {\n window.removeEventListener(\"resize\", gd._responsiveChartHandler);\n delete gd._responsiveChartHandler;\n }\n };\n }\n });\n\n // node_modules/is-mobile/index.js\n var require_is_mobile = __commonJS({\n \"node_modules/is-mobile/index.js\"(exports, module) {\n \"use strict\";\n module.exports = isMobile;\n module.exports.isMobile = isMobile;\n module.exports.default = isMobile;\n var mobileRE = /(android|bb\\d+|meego).+mobile|armv7l|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i;\n var notMobileRE = /CrOS/;\n var tabletRE = /android|ipad|playbook|silk/i;\n function isMobile(opts) {\n if (!opts) opts = {};\n let ua = opts.ua;\n if (!ua && typeof navigator !== \"undefined\") ua = navigator.userAgent;\n if (ua && ua.headers && typeof ua.headers[\"user-agent\"] === \"string\") {\n ua = ua.headers[\"user-agent\"];\n }\n if (typeof ua !== \"string\") return false;\n let result = mobileRE.test(ua) && !notMobileRE.test(ua) || !!opts.tablet && tabletRE.test(ua);\n if (!result && opts.tablet && opts.featureDetect && navigator && navigator.maxTouchPoints > 1 && ua.indexOf(\"Macintosh\") !== -1 && ua.indexOf(\"Safari\") !== -1) {\n result = true;\n }\n return result;\n }\n }\n });\n\n // src/lib/preserve_drawing_buffer.js\n var require_preserve_drawing_buffer = __commonJS({\n \"src/lib/preserve_drawing_buffer.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var isMobileOrTablet = require_is_mobile();\n module.exports = function preserveDrawingBuffer(opts) {\n var ua;\n if (opts && opts.hasOwnProperty(\"userAgent\")) {\n ua = opts.userAgent;\n } else {\n ua = getUserAgent();\n }\n if (typeof ua !== \"string\") return true;\n var enable = isMobileOrTablet({\n ua: { headers: { \"user-agent\": ua } },\n tablet: true,\n featureDetect: false\n });\n if (!enable) {\n var allParts = ua.split(\" \");\n for (var i = 1; i < allParts.length; i++) {\n var part = allParts[i];\n if (part.indexOf(\"Safari\") !== -1) {\n for (var k = i - 1; k > -1; k--) {\n var prevPart = allParts[k];\n if (prevPart.substr(0, 8) === \"Version/\") {\n var v = prevPart.substr(8).split(\".\")[0];\n if (isNumeric(v)) v = +v;\n if (v >= 13) return true;\n }\n }\n }\n }\n }\n return enable;\n };\n function getUserAgent() {\n var ua;\n if (typeof navigator !== \"undefined\") {\n ua = navigator.userAgent;\n }\n if (ua && ua.headers && typeof ua.headers[\"user-agent\"] === \"string\") {\n ua = ua.headers[\"user-agent\"];\n }\n return ua;\n }\n }\n });\n\n // src/lib/make_trace_groups.js\n var require_make_trace_groups = __commonJS({\n \"src/lib/make_trace_groups.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n module.exports = function makeTraceGroups(traceLayer, cdModule, cls) {\n var traces = traceLayer.selectAll(\"g.\" + cls.replace(/\\s/g, \".\")).data(cdModule, function(cd) {\n return cd[0].trace.uid;\n });\n traces.exit().remove();\n traces.enter().append(\"g\").attr(\"class\", cls);\n traces.order();\n var k = traceLayer.classed(\"rangeplot\") ? \"nodeRangePlot3\" : \"node3\";\n traces.each(function(cd) {\n cd[0][k] = d3.select(this);\n });\n return traces;\n };\n }\n });\n\n // src/lib/localize.js\n var require_localize = __commonJS({\n \"src/lib/localize.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n module.exports = function localize(gd, s) {\n var locale = gd._context.locale;\n for (var i = 0; i < 2; i++) {\n var locales = gd._context.locales;\n for (var j = 0; j < 2; j++) {\n var dict = (locales[locale] || {}).dictionary;\n if (dict) {\n var out = dict[s];\n if (out) return out;\n }\n locales = Registry.localeRegistry;\n }\n var baseLocale = locale.split(\"-\")[0];\n if (baseLocale === locale) break;\n locale = baseLocale;\n }\n return s;\n };\n }\n });\n\n // src/lib/filter_unique.js\n var require_filter_unique = __commonJS({\n \"src/lib/filter_unique.js\"(exports, module) {\n \"use strict\";\n module.exports = function filterUnique(array) {\n var seen = {};\n var out = [];\n var j = 0;\n for (var i = 0; i < array.length; i++) {\n var item = array[i];\n if (seen[item] !== 1) {\n seen[item] = 1;\n out[j++] = item;\n }\n }\n return out;\n };\n }\n });\n\n // src/lib/filter_visible.js\n var require_filter_visible = __commonJS({\n \"src/lib/filter_visible.js\"(exports, module) {\n \"use strict\";\n module.exports = function filterVisible(container) {\n var filterFn = isCalcData(container) ? calcDataFilter : baseFilter;\n var out = [];\n for (var i = 0; i < container.length; i++) {\n var item = container[i];\n if (filterFn(item)) out.push(item);\n }\n return out;\n };\n function baseFilter(item) {\n return item.visible === true;\n }\n function calcDataFilter(item) {\n var trace = item[0].trace;\n return trace.visible === true && trace._length !== 0;\n }\n function isCalcData(cont) {\n return Array.isArray(cont) && Array.isArray(cont[0]) && cont[0][0] && cont[0][0].trace;\n }\n }\n });\n\n // src/lib/increment.js\n var require_increment = __commonJS({\n \"src/lib/increment.js\"(exports, module) {\n \"use strict\";\n module.exports = function incrementNumeric(x, delta) {\n if (!delta) return x;\n var scale = 1 / Math.abs(delta);\n var newX = scale > 1 ? (scale * x + scale * delta) / scale : x + delta;\n var lenX1 = String(newX).length;\n if (lenX1 > 16) {\n var lenDt = String(delta).length;\n var lenX0 = String(x).length;\n if (lenX1 >= lenX0 + lenDt) {\n var s = parseFloat(newX).toPrecision(12);\n if (s.indexOf(\"e+\") === -1) newX = +s;\n }\n }\n return newX;\n };\n }\n });\n\n // src/lib/clean_number.js\n var require_clean_number = __commonJS({\n \"src/lib/clean_number.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var BADNUM = require_numerical().BADNUM;\n var JUNK = /^['\"%,$#\\s']+|[, ]|['\"%,$#\\s']+$/g;\n module.exports = function cleanNumber(v) {\n if (typeof v === \"string\") {\n v = v.replace(JUNK, \"\");\n }\n if (isNumeric(v)) return Number(v);\n return BADNUM;\n };\n }\n });\n\n // src/lib/index.js\n var require_lib = __commonJS({\n \"src/lib/index.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var utcFormat = require_d3_time_format().utcFormat;\n var d3Format = require_d3_format().format;\n var isNumeric = require_fast_isnumeric();\n var numConstants = require_numerical();\n var MAX_SAFE = numConstants.FP_SAFE;\n var MIN_SAFE = -MAX_SAFE;\n var BADNUM = numConstants.BADNUM;\n var lib = module.exports = {};\n lib.adjustFormat = function adjustFormat(formatStr) {\n if (!formatStr || /^\\d[.]\\df/.test(formatStr) || /[.]\\d%/.test(formatStr)) return formatStr;\n if (formatStr === \"0.f\") return \"~f\";\n if (/^\\d%/.test(formatStr)) return \"~%\";\n if (/^\\ds/.test(formatStr)) return \"~s\";\n if (!/^[~,.0$]/.test(formatStr) && /[&fps]/.test(formatStr)) return \"~\" + formatStr;\n return formatStr;\n };\n var seenBadFormats = {};\n lib.warnBadFormat = function(f) {\n var key = String(f);\n if (!seenBadFormats[key]) {\n seenBadFormats[key] = 1;\n lib.warn('encountered bad format: \"' + key + '\"');\n }\n };\n lib.noFormat = function(value) {\n return String(value);\n };\n lib.numberFormat = function(formatStr) {\n var fn;\n try {\n fn = d3Format(lib.adjustFormat(formatStr));\n } catch (e) {\n lib.warnBadFormat(formatStr);\n return lib.noFormat;\n }\n return fn;\n };\n lib.nestedProperty = require_nested_property();\n lib.keyedContainer = require_keyed_container();\n lib.relativeAttr = require_relative_attr();\n lib.isPlainObject = require_is_plain_object();\n lib.toLogRange = require_to_log_range();\n lib.relinkPrivateKeys = require_relink_private();\n var arrayModule = require_array();\n lib.isArrayBuffer = arrayModule.isArrayBuffer;\n lib.isTypedArray = arrayModule.isTypedArray;\n lib.isArrayOrTypedArray = arrayModule.isArrayOrTypedArray;\n lib.isArray1D = arrayModule.isArray1D;\n lib.ensureArray = arrayModule.ensureArray;\n lib.concat = arrayModule.concat;\n lib.maxRowLength = arrayModule.maxRowLength;\n lib.minRowLength = arrayModule.minRowLength;\n var modModule = require_mod();\n lib.mod = modModule.mod;\n lib.modHalf = modModule.modHalf;\n var coerceModule = require_coerce();\n lib.valObjectMeta = coerceModule.valObjectMeta;\n lib.coerce = coerceModule.coerce;\n lib.coerce2 = coerceModule.coerce2;\n lib.coerceFont = coerceModule.coerceFont;\n lib.coercePattern = coerceModule.coercePattern;\n lib.coerceHoverinfo = coerceModule.coerceHoverinfo;\n lib.coerceSelectionMarkerOpacity = coerceModule.coerceSelectionMarkerOpacity;\n lib.validate = coerceModule.validate;\n var datesModule = require_dates();\n lib.dateTime2ms = datesModule.dateTime2ms;\n lib.isDateTime = datesModule.isDateTime;\n lib.ms2DateTime = datesModule.ms2DateTime;\n lib.ms2DateTimeLocal = datesModule.ms2DateTimeLocal;\n lib.cleanDate = datesModule.cleanDate;\n lib.isJSDate = datesModule.isJSDate;\n lib.formatDate = datesModule.formatDate;\n lib.incrementMonth = datesModule.incrementMonth;\n lib.dateTick0 = datesModule.dateTick0;\n lib.dfltRange = datesModule.dfltRange;\n lib.findExactDates = datesModule.findExactDates;\n lib.MIN_MS = datesModule.MIN_MS;\n lib.MAX_MS = datesModule.MAX_MS;\n var searchModule = require_search();\n lib.findBin = searchModule.findBin;\n lib.sorterAsc = searchModule.sorterAsc;\n lib.sorterDes = searchModule.sorterDes;\n lib.distinctVals = searchModule.distinctVals;\n lib.roundUp = searchModule.roundUp;\n lib.sort = searchModule.sort;\n lib.findIndexOfMin = searchModule.findIndexOfMin;\n lib.sortObjectKeys = require_sort_object_keys();\n var statsModule = require_stats();\n lib.aggNums = statsModule.aggNums;\n lib.len = statsModule.len;\n lib.mean = statsModule.mean;\n lib.geometricMean = statsModule.geometricMean;\n lib.median = statsModule.median;\n lib.midRange = statsModule.midRange;\n lib.variance = statsModule.variance;\n lib.stdev = statsModule.stdev;\n lib.interp = statsModule.interp;\n var matrixModule = require_matrix();\n lib.init2dArray = matrixModule.init2dArray;\n lib.transposeRagged = matrixModule.transposeRagged;\n lib.dot = matrixModule.dot;\n lib.translationMatrix = matrixModule.translationMatrix;\n lib.rotationMatrix = matrixModule.rotationMatrix;\n lib.rotationXYMatrix = matrixModule.rotationXYMatrix;\n lib.apply3DTransform = matrixModule.apply3DTransform;\n lib.apply2DTransform = matrixModule.apply2DTransform;\n lib.apply2DTransform2 = matrixModule.apply2DTransform2;\n lib.convertCssMatrix = matrixModule.convertCssMatrix;\n lib.inverseTransformMatrix = matrixModule.inverseTransformMatrix;\n var anglesModule = require_angles();\n lib.deg2rad = anglesModule.deg2rad;\n lib.rad2deg = anglesModule.rad2deg;\n lib.angleDelta = anglesModule.angleDelta;\n lib.angleDist = anglesModule.angleDist;\n lib.isFullCircle = anglesModule.isFullCircle;\n lib.isAngleInsideSector = anglesModule.isAngleInsideSector;\n lib.isPtInsideSector = anglesModule.isPtInsideSector;\n lib.pathArc = anglesModule.pathArc;\n lib.pathSector = anglesModule.pathSector;\n lib.pathAnnulus = anglesModule.pathAnnulus;\n var anchorUtils = require_anchor_utils();\n lib.isLeftAnchor = anchorUtils.isLeftAnchor;\n lib.isCenterAnchor = anchorUtils.isCenterAnchor;\n lib.isRightAnchor = anchorUtils.isRightAnchor;\n lib.isTopAnchor = anchorUtils.isTopAnchor;\n lib.isMiddleAnchor = anchorUtils.isMiddleAnchor;\n lib.isBottomAnchor = anchorUtils.isBottomAnchor;\n var geom2dModule = require_geometry2d();\n lib.segmentsIntersect = geom2dModule.segmentsIntersect;\n lib.segmentDistance = geom2dModule.segmentDistance;\n lib.getTextLocation = geom2dModule.getTextLocation;\n lib.clearLocationCache = geom2dModule.clearLocationCache;\n lib.getVisibleSegment = geom2dModule.getVisibleSegment;\n lib.findPointOnPath = geom2dModule.findPointOnPath;\n var extendModule = require_extend();\n lib.extendFlat = extendModule.extendFlat;\n lib.extendDeep = extendModule.extendDeep;\n lib.extendDeepAll = extendModule.extendDeepAll;\n lib.extendDeepNoArrays = extendModule.extendDeepNoArrays;\n var loggersModule = require_loggers();\n lib.log = loggersModule.log;\n lib.warn = loggersModule.warn;\n lib.error = loggersModule.error;\n var regexModule = require_regex();\n lib.counterRegex = regexModule.counter;\n var throttleModule = require_throttle();\n lib.throttle = throttleModule.throttle;\n lib.throttleDone = throttleModule.done;\n lib.clearThrottle = throttleModule.clear;\n var domModule = require_dom();\n lib.getGraphDiv = domModule.getGraphDiv;\n lib.isPlotDiv = domModule.isPlotDiv;\n lib.removeElement = domModule.removeElement;\n lib.addStyleRule = domModule.addStyleRule;\n lib.addRelatedStyleRule = domModule.addRelatedStyleRule;\n lib.deleteRelatedStyleRule = domModule.deleteRelatedStyleRule;\n lib.setStyleOnHover = domModule.setStyleOnHover;\n lib.getFullTransformMatrix = domModule.getFullTransformMatrix;\n lib.getElementTransformMatrix = domModule.getElementTransformMatrix;\n lib.getElementAndAncestors = domModule.getElementAndAncestors;\n lib.equalDomRects = domModule.equalDomRects;\n lib.clearResponsive = require_clear_responsive();\n lib.preserveDrawingBuffer = require_preserve_drawing_buffer();\n lib.makeTraceGroups = require_make_trace_groups();\n lib._ = require_localize();\n lib.notifier = require_notifier();\n lib.filterUnique = require_filter_unique();\n lib.filterVisible = require_filter_visible();\n lib.pushUnique = require_push_unique();\n lib.increment = require_increment();\n lib.cleanNumber = require_clean_number();\n lib.ensureNumber = function ensureNumber(v) {\n if (!isNumeric(v)) return BADNUM;\n v = Number(v);\n return v > MAX_SAFE || v < MIN_SAFE ? BADNUM : v;\n };\n lib.isIndex = function(v, len) {\n if (len !== void 0 && v >= len) return false;\n return isNumeric(v) && v >= 0 && v % 1 === 0;\n };\n lib.noop = require_noop();\n lib.identity = require_identity2();\n lib.repeat = function(v, cnt) {\n var out = new Array(cnt);\n for (var i = 0; i < cnt; i++) {\n out[i] = v;\n }\n return out;\n };\n lib.swapAttrs = function(cont, attrList, part1, part2) {\n if (!part1) part1 = \"x\";\n if (!part2) part2 = \"y\";\n for (var i = 0; i < attrList.length; i++) {\n var attr = attrList[i];\n var xp = lib.nestedProperty(cont, attr.replace(\"?\", part1));\n var yp = lib.nestedProperty(cont, attr.replace(\"?\", part2));\n var temp = xp.get();\n xp.set(yp.get());\n yp.set(temp);\n }\n };\n lib.raiseToTop = function raiseToTop(elem) {\n elem.parentNode.appendChild(elem);\n };\n lib.cancelTransition = function(selection) {\n return selection.transition().duration(0);\n };\n lib.constrain = function(v, v0, v1) {\n if (v0 > v1) return Math.max(v1, Math.min(v0, v));\n return Math.max(v0, Math.min(v1, v));\n };\n lib.bBoxIntersect = function(a, b, pad) {\n pad = pad || 0;\n return a.left <= b.right + pad && b.left <= a.right + pad && a.top <= b.bottom + pad && b.top <= a.bottom + pad;\n };\n lib.simpleMap = function(array, func, x1, x2, opts) {\n var len = array.length;\n var out = new Array(len);\n for (var i = 0; i < len; i++) out[i] = func(array[i], x1, x2, opts);\n return out;\n };\n lib.randstr = function randstr(existing, bits, base, _recursion) {\n if (!base) base = 16;\n if (bits === void 0) bits = 24;\n if (bits <= 0) return \"0\";\n var digits = Math.log(Math.pow(2, bits)) / Math.log(base);\n var res = \"\";\n var i, b, x;\n for (i = 2; digits === Infinity; i *= 2) {\n digits = Math.log(Math.pow(2, bits / i)) / Math.log(base) * i;\n }\n var rem = digits - Math.floor(digits);\n for (i = 0; i < Math.floor(digits); i++) {\n x = Math.floor(Math.random() * base).toString(base);\n res = x + res;\n }\n if (rem) {\n b = Math.pow(base, rem);\n x = Math.floor(Math.random() * b).toString(base);\n res = x + res;\n }\n var parsed = parseInt(res, base);\n if (existing && existing[res] || parsed !== Infinity && parsed >= Math.pow(2, bits)) {\n if (_recursion > 10) {\n lib.warn(\"randstr failed uniqueness\");\n return res;\n }\n return randstr(existing, bits, base, (_recursion || 0) + 1);\n } else return res;\n };\n lib.OptionControl = function(opt, optname) {\n if (!opt) opt = {};\n if (!optname) optname = \"opt\";\n var self2 = {};\n self2.optionList = [];\n self2._newoption = function(optObj) {\n optObj[optname] = opt;\n self2[optObj.name] = optObj;\n self2.optionList.push(optObj);\n };\n self2[\"_\" + optname] = opt;\n return self2;\n };\n lib.smooth = function(arrayIn, FWHM) {\n FWHM = Math.round(FWHM) || 0;\n if (FWHM < 2) return arrayIn;\n var alen = arrayIn.length;\n var alen2 = 2 * alen;\n var wlen = 2 * FWHM - 1;\n var w = new Array(wlen);\n var arrayOut = new Array(alen);\n var i;\n var j;\n var k;\n var v;\n for (i = 0; i < wlen; i++) {\n w[i] = (1 - Math.cos(Math.PI * (i + 1) / FWHM)) / (2 * FWHM);\n }\n for (i = 0; i < alen; i++) {\n v = 0;\n for (j = 0; j < wlen; j++) {\n k = i + j + 1 - FWHM;\n if (k < -alen) k -= alen2 * Math.round(k / alen2);\n else if (k >= alen2) k -= alen2 * Math.floor(k / alen2);\n if (k < 0) k = -1 - k;\n else if (k >= alen) k = alen2 - 1 - k;\n v += arrayIn[k] * w[j];\n }\n arrayOut[i] = v;\n }\n return arrayOut;\n };\n lib.syncOrAsync = function(sequence, arg, finalStep) {\n var ret, fni;\n function continueAsync() {\n return lib.syncOrAsync(sequence, arg, finalStep);\n }\n while (sequence.length) {\n fni = sequence.splice(0, 1)[0];\n ret = fni(arg);\n if (ret && ret.then) {\n return ret.then(continueAsync);\n }\n }\n return finalStep && finalStep(arg);\n };\n lib.stripTrailingSlash = function(str) {\n if (str.substr(-1) === \"/\") return str.substr(0, str.length - 1);\n return str;\n };\n lib.noneOrAll = function(containerIn, containerOut, attrList) {\n if (!containerIn) return;\n var hasAny = false;\n var hasAll = true;\n var i;\n var val;\n for (i = 0; i < attrList.length; i++) {\n val = containerIn[attrList[i]];\n if (val !== void 0 && val !== null) hasAny = true;\n else hasAll = false;\n }\n if (hasAny && !hasAll) {\n for (i = 0; i < attrList.length; i++) {\n containerIn[attrList[i]] = containerOut[attrList[i]];\n }\n }\n };\n lib.mergeArray = function(traceAttr, cd, cdAttr, fn) {\n var hasFn = typeof fn === \"function\";\n if (lib.isArrayOrTypedArray(traceAttr)) {\n var imax = Math.min(traceAttr.length, cd.length);\n for (var i = 0; i < imax; i++) {\n var v = traceAttr[i];\n cd[i][cdAttr] = hasFn ? fn(v) : v;\n }\n }\n };\n lib.mergeArrayCastPositive = function(traceAttr, cd, cdAttr) {\n return lib.mergeArray(traceAttr, cd, cdAttr, function(v) {\n var w = +v;\n return !isFinite(w) ? 0 : w > 0 ? w : 0;\n });\n };\n lib.fillArray = function(traceAttr, cd, cdAttr, fn) {\n fn = fn || lib.identity;\n if (lib.isArrayOrTypedArray(traceAttr)) {\n for (var i = 0; i < cd.length; i++) {\n cd[i][cdAttr] = fn(traceAttr[i]);\n }\n }\n };\n lib.castOption = function(trace, ptNumber, astr, fn) {\n fn = fn || lib.identity;\n var val = lib.nestedProperty(trace, astr).get();\n if (lib.isArrayOrTypedArray(val)) {\n if (Array.isArray(ptNumber) && lib.isArrayOrTypedArray(val[ptNumber[0]])) {\n return fn(val[ptNumber[0]][ptNumber[1]]);\n } else {\n return fn(val[ptNumber]);\n }\n } else {\n return val;\n }\n };\n lib.extractOption = function(calcPt, trace, calcKey, traceKey) {\n if (calcKey in calcPt) return calcPt[calcKey];\n var traceVal = lib.nestedProperty(trace, traceKey).get();\n if (!Array.isArray(traceVal)) return traceVal;\n };\n function makePtIndex2PtNumber(indexToPoints) {\n var ptIndex2ptNumber = {};\n for (var k in indexToPoints) {\n var pts = indexToPoints[k];\n for (var j = 0; j < pts.length; j++) {\n ptIndex2ptNumber[pts[j]] = +k;\n }\n }\n return ptIndex2ptNumber;\n }\n lib.tagSelected = function(calcTrace, trace, ptNumber2cdIndex) {\n var selectedpoints = trace.selectedpoints;\n var indexToPoints = trace._indexToPoints;\n var ptIndex2ptNumber;\n if (indexToPoints) {\n ptIndex2ptNumber = makePtIndex2PtNumber(indexToPoints);\n }\n function isCdIndexValid(v) {\n return v !== void 0 && v < calcTrace.length;\n }\n for (var i = 0; i < selectedpoints.length; i++) {\n var ptIndex = selectedpoints[i];\n if (lib.isIndex(ptIndex) || lib.isArrayOrTypedArray(ptIndex) && lib.isIndex(ptIndex[0]) && lib.isIndex(ptIndex[1])) {\n var ptNumber = ptIndex2ptNumber ? ptIndex2ptNumber[ptIndex] : ptIndex;\n var cdIndex = ptNumber2cdIndex ? ptNumber2cdIndex[ptNumber] : ptNumber;\n if (isCdIndexValid(cdIndex)) {\n calcTrace[cdIndex].selected = 1;\n }\n }\n }\n };\n lib.selIndices2selPoints = function(trace) {\n var selectedpoints = trace.selectedpoints;\n var indexToPoints = trace._indexToPoints;\n if (indexToPoints) {\n var ptIndex2ptNumber = makePtIndex2PtNumber(indexToPoints);\n var out = [];\n for (var i = 0; i < selectedpoints.length; i++) {\n var ptIndex = selectedpoints[i];\n if (lib.isIndex(ptIndex)) {\n var ptNumber = ptIndex2ptNumber[ptIndex];\n if (lib.isIndex(ptNumber)) {\n out.push(ptNumber);\n }\n }\n }\n return out;\n } else {\n return selectedpoints;\n }\n };\n lib.getTargetArray = function(trace, transformOpts) {\n var target = transformOpts.target;\n if (typeof target === \"string\" && target) {\n var array = lib.nestedProperty(trace, target).get();\n return lib.isArrayOrTypedArray(array) ? array : false;\n } else if (lib.isArrayOrTypedArray(target)) {\n return target;\n }\n return false;\n };\n function minExtend(obj1, obj2, opt) {\n var objOut = {};\n if (typeof obj2 !== \"object\") obj2 = {};\n var arrayLen = opt === \"pieLike\" ? -1 : 3;\n var keys = Object.keys(obj1);\n var i, k, v;\n for (i = 0; i < keys.length; i++) {\n k = keys[i];\n v = obj1[k];\n if (k.charAt(0) === \"_\" || typeof v === \"function\") continue;\n else if (k === \"module\") objOut[k] = v;\n else if (Array.isArray(v)) {\n if (k === \"colorscale\" || arrayLen === -1) {\n objOut[k] = v.slice();\n } else {\n objOut[k] = v.slice(0, arrayLen);\n }\n } else if (lib.isTypedArray(v)) {\n if (arrayLen === -1) {\n objOut[k] = v.subarray();\n } else {\n objOut[k] = v.subarray(0, arrayLen);\n }\n } else if (v && typeof v === \"object\") objOut[k] = minExtend(obj1[k], obj2[k], opt);\n else objOut[k] = v;\n }\n keys = Object.keys(obj2);\n for (i = 0; i < keys.length; i++) {\n k = keys[i];\n v = obj2[k];\n if (typeof v !== \"object\" || !(k in objOut) || typeof objOut[k] !== \"object\") {\n objOut[k] = v;\n }\n }\n return objOut;\n }\n lib.minExtend = minExtend;\n lib.titleCase = function(s) {\n return s.charAt(0).toUpperCase() + s.substr(1);\n };\n lib.containsAny = function(s, fragments) {\n for (var i = 0; i < fragments.length; i++) {\n if (s.indexOf(fragments[i]) !== -1) return true;\n }\n return false;\n };\n var IS_SAFARI_REGEX = /Version\\/[\\d\\.]+.*Safari/;\n lib.isSafari = function() {\n return IS_SAFARI_REGEX.test(window.navigator.userAgent);\n };\n var IS_IOS_REGEX = /iPad|iPhone|iPod/;\n lib.isIOS = function() {\n return IS_IOS_REGEX.test(window.navigator.userAgent);\n };\n var FIREFOX_VERSION_REGEX = /Firefox\\/(\\d+)\\.\\d+/;\n lib.getFirefoxVersion = function() {\n var match = FIREFOX_VERSION_REGEX.exec(window.navigator.userAgent);\n if (match && match.length === 2) {\n var versionInt = parseInt(match[1]);\n if (!isNaN(versionInt)) {\n return versionInt;\n }\n }\n return null;\n };\n lib.isD3Selection = function(obj) {\n return obj instanceof d3.selection;\n };\n lib.ensureSingle = function(parent, nodeType, className, enterFn) {\n var sel = parent.select(nodeType + (className ? \".\" + className : \"\"));\n if (sel.size()) return sel;\n var layer = parent.append(nodeType);\n if (className) layer.classed(className, true);\n if (enterFn) layer.call(enterFn);\n return layer;\n };\n lib.ensureSingleById = function(parent, nodeType, id, enterFn) {\n var sel = parent.select(nodeType + \"#\" + id);\n if (sel.size()) return sel;\n var layer = parent.append(nodeType).attr(\"id\", id);\n if (enterFn) layer.call(enterFn);\n return layer;\n };\n lib.objectFromPath = function(path, value) {\n var keys = path.split(\".\");\n var tmpObj;\n var obj = tmpObj = {};\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var el = null;\n var parts = keys[i].match(/(.*)\\[([0-9]+)\\]/);\n if (parts) {\n key = parts[1];\n el = parts[2];\n tmpObj = tmpObj[key] = [];\n if (i === keys.length - 1) {\n tmpObj[el] = value;\n } else {\n tmpObj[el] = {};\n }\n tmpObj = tmpObj[el];\n } else {\n if (i === keys.length - 1) {\n tmpObj[key] = value;\n } else {\n tmpObj[key] = {};\n }\n tmpObj = tmpObj[key];\n }\n }\n return obj;\n };\n var dottedPropertyRegex = /^([^\\[\\.]+)\\.(.+)?/;\n var indexedPropertyRegex = /^([^\\.]+)\\[([0-9]+)\\](\\.)?(.+)?/;\n function notValid(prop) {\n return prop.slice(0, 2) === \"__\";\n }\n lib.expandObjectPaths = function(data) {\n var match, key, prop, datum, idx, dest, trailingPath;\n if (typeof data === \"object\" && !Array.isArray(data)) {\n for (key in data) {\n if (data.hasOwnProperty(key)) {\n if (match = key.match(dottedPropertyRegex)) {\n datum = data[key];\n prop = match[1];\n if (notValid(prop)) continue;\n delete data[key];\n data[prop] = lib.extendDeepNoArrays(data[prop] || {}, lib.objectFromPath(key, lib.expandObjectPaths(datum))[prop]);\n } else if (match = key.match(indexedPropertyRegex)) {\n datum = data[key];\n prop = match[1];\n if (notValid(prop)) continue;\n idx = parseInt(match[2]);\n delete data[key];\n data[prop] = data[prop] || [];\n if (match[3] === \".\") {\n trailingPath = match[4];\n dest = data[prop][idx] = data[prop][idx] || {};\n lib.extendDeepNoArrays(dest, lib.objectFromPath(trailingPath, lib.expandObjectPaths(datum)));\n } else {\n if (notValid(prop)) continue;\n data[prop][idx] = lib.expandObjectPaths(datum);\n }\n } else {\n if (notValid(key)) continue;\n data[key] = lib.expandObjectPaths(data[key]);\n }\n }\n }\n }\n return data;\n };\n lib.numSeparate = function(value, separators, separatethousands) {\n if (!separatethousands) separatethousands = false;\n if (typeof separators !== \"string\" || separators.length === 0) {\n throw new Error(\"Separator string required for formatting!\");\n }\n if (typeof value === \"number\") {\n value = String(value);\n }\n var thousandsRe = /(\\d+)(\\d{3})/;\n var decimalSep = separators.charAt(0);\n var thouSep = separators.charAt(1);\n var x = value.split(\".\");\n var x1 = x[0];\n var x2 = x.length > 1 ? decimalSep + x[1] : \"\";\n if (thouSep && (x.length > 1 || x1.length > 4 || separatethousands)) {\n while (thousandsRe.test(x1)) {\n x1 = x1.replace(thousandsRe, \"$1\" + thouSep + \"$2\");\n }\n }\n return x1 + x2;\n };\n lib.TEMPLATE_STRING_REGEX = /%{([^\\s%{}:]*)([:|\\|][^}]*)?}/g;\n var SIMPLE_PROPERTY_REGEX = /^\\w*$/;\n lib.templateString = function(string, obj) {\n var getterCache = {};\n return string.replace(lib.TEMPLATE_STRING_REGEX, function(dummy, key) {\n var v;\n if (SIMPLE_PROPERTY_REGEX.test(key)) {\n v = obj[key];\n } else {\n getterCache[key] = getterCache[key] || lib.nestedProperty(obj, key).get;\n v = getterCache[key](true);\n }\n return v !== void 0 ? v : \"\";\n });\n };\n var hovertemplateWarnings = {\n max: 10,\n count: 0,\n name: \"hovertemplate\"\n };\n lib.hovertemplateString = function() {\n return templateFormatString.apply(hovertemplateWarnings, arguments);\n };\n var texttemplateWarnings = {\n max: 10,\n count: 0,\n name: \"texttemplate\"\n };\n lib.texttemplateString = function() {\n return templateFormatString.apply(texttemplateWarnings, arguments);\n };\n var MULT_DIV_REGEX = /^(\\S+)([\\*\\/])(-?\\d+(\\.\\d+)?)$/;\n function multDivParser(inputStr) {\n var match = inputStr.match(MULT_DIV_REGEX);\n if (match) return { key: match[1], op: match[2], number: Number(match[3]) };\n return { key: inputStr, op: null, number: null };\n }\n var texttemplateWarningsForShapes = {\n max: 10,\n count: 0,\n name: \"texttemplate\",\n parseMultDiv: true\n };\n lib.texttemplateStringForShapes = function() {\n return templateFormatString.apply(texttemplateWarningsForShapes, arguments);\n };\n var TEMPLATE_STRING_FORMAT_SEPARATOR = /^[:|\\|]/;\n function templateFormatString(string, labels, d3locale) {\n var opts = this;\n var args = arguments;\n if (!labels) labels = {};\n return string.replace(lib.TEMPLATE_STRING_REGEX, function(match, rawKey, format) {\n var isOther = rawKey === \"xother\" || rawKey === \"yother\";\n var isSpaceOther = rawKey === \"_xother\" || rawKey === \"_yother\";\n var isSpaceOtherSpace = rawKey === \"_xother_\" || rawKey === \"_yother_\";\n var isOtherSpace = rawKey === \"xother_\" || rawKey === \"yother_\";\n var hasOther = isOther || isSpaceOther || isOtherSpace || isSpaceOtherSpace;\n var key = rawKey;\n if (isSpaceOther || isSpaceOtherSpace) key = key.substring(1);\n if (isOtherSpace || isSpaceOtherSpace) key = key.substring(0, key.length - 1);\n var parsedOp = null;\n var parsedNumber = null;\n if (opts.parseMultDiv) {\n var _match = multDivParser(key);\n key = _match.key;\n parsedOp = _match.op;\n parsedNumber = _match.number;\n }\n var value;\n if (hasOther) {\n value = labels[key];\n if (value === void 0) return \"\";\n } else {\n var obj, i;\n for (i = 3; i < args.length; i++) {\n obj = args[i];\n if (!obj) continue;\n if (obj.hasOwnProperty(key)) {\n value = obj[key];\n break;\n }\n if (!SIMPLE_PROPERTY_REGEX.test(key)) {\n value = lib.nestedProperty(obj, key).get(true);\n }\n if (value !== void 0) break;\n }\n }\n if (value !== void 0) {\n if (parsedOp === \"*\") value *= parsedNumber;\n if (parsedOp === \"/\") value /= parsedNumber;\n }\n if (value === void 0 && opts) {\n if (opts.count < opts.max) {\n lib.warn(\"Variable '\" + key + \"' in \" + opts.name + \" could not be found!\");\n value = match;\n }\n if (opts.count === opts.max) {\n lib.warn(\"Too many \" + opts.name + \" warnings - additional warnings will be suppressed\");\n }\n opts.count++;\n return match;\n }\n if (format) {\n var fmt;\n if (format[0] === \":\") {\n fmt = d3locale ? d3locale.numberFormat : lib.numberFormat;\n if (value !== \"\") {\n value = fmt(format.replace(TEMPLATE_STRING_FORMAT_SEPARATOR, \"\"))(value);\n }\n }\n if (format[0] === \"|\") {\n fmt = d3locale ? d3locale.timeFormat : utcFormat;\n var ms = lib.dateTime2ms(value);\n value = lib.formatDate(ms, format.replace(TEMPLATE_STRING_FORMAT_SEPARATOR, \"\"), false, fmt);\n }\n } else {\n var keyLabel = key + \"Label\";\n if (labels.hasOwnProperty(keyLabel)) value = labels[keyLabel];\n }\n if (hasOther) {\n value = \"(\" + value + \")\";\n if (isSpaceOther || isSpaceOtherSpace) value = \" \" + value;\n if (isOtherSpace || isSpaceOtherSpace) value = value + \" \";\n }\n return value;\n });\n }\n var char0 = 48;\n var char9 = 57;\n lib.subplotSort = function(a, b) {\n var l = Math.min(a.length, b.length) + 1;\n var numA = 0;\n var numB = 0;\n for (var i = 0; i < l; i++) {\n var charA = a.charCodeAt(i) || 0;\n var charB = b.charCodeAt(i) || 0;\n var isNumA = charA >= char0 && charA <= char9;\n var isNumB = charB >= char0 && charB <= char9;\n if (isNumA) numA = 10 * numA + charA - char0;\n if (isNumB) numB = 10 * numB + charB - char0;\n if (!isNumA || !isNumB) {\n if (numA !== numB) return numA - numB;\n if (charA !== charB) return charA - charB;\n }\n }\n return numB - numA;\n };\n var randSeed = 2e9;\n lib.seedPseudoRandom = function() {\n randSeed = 2e9;\n };\n lib.pseudoRandom = function() {\n var lastVal = randSeed;\n randSeed = (69069 * randSeed + 1) % 4294967296;\n if (Math.abs(randSeed - lastVal) < 429496729) return lib.pseudoRandom();\n return randSeed / 4294967296;\n };\n lib.fillText = function(calcPt, trace, contOut) {\n var fill = Array.isArray(contOut) ? function(v) {\n contOut.push(v);\n } : function(v) {\n contOut.text = v;\n };\n var htx = lib.extractOption(calcPt, trace, \"htx\", \"hovertext\");\n if (lib.isValidTextValue(htx)) return fill(htx);\n var tx = lib.extractOption(calcPt, trace, \"tx\", \"text\");\n if (lib.isValidTextValue(tx)) return fill(tx);\n };\n lib.isValidTextValue = function(v) {\n return v || v === 0;\n };\n lib.formatPercent = function(ratio, n) {\n n = n || 0;\n var str = (Math.round(100 * ratio * Math.pow(10, n)) * Math.pow(0.1, n)).toFixed(n) + \"%\";\n for (var i = 0; i < n; i++) {\n if (str.indexOf(\".\") !== -1) {\n str = str.replace(\"0%\", \"%\");\n str = str.replace(\".%\", \"%\");\n }\n }\n return str;\n };\n lib.isHidden = function(gd) {\n var display = window.getComputedStyle(gd).display;\n return !display || display === \"none\";\n };\n lib.strTranslate = function(x, y) {\n return x || y ? \"translate(\" + x + \",\" + y + \")\" : \"\";\n };\n lib.strRotate = function(a) {\n return a ? \"rotate(\" + a + \")\" : \"\";\n };\n lib.strScale = function(s) {\n return s !== 1 ? \"scale(\" + s + \")\" : \"\";\n };\n lib.getTextTransform = function(transform) {\n var noCenter = transform.noCenter;\n var textX = transform.textX;\n var textY = transform.textY;\n var targetX = transform.targetX;\n var targetY = transform.targetY;\n var anchorX = transform.anchorX || 0;\n var anchorY = transform.anchorY || 0;\n var rotate = transform.rotate;\n var scale = transform.scale;\n if (!scale) scale = 0;\n else if (scale > 1) scale = 1;\n return lib.strTranslate(\n targetX - scale * (textX + anchorX),\n targetY - scale * (textY + anchorY)\n ) + lib.strScale(scale) + (rotate ? \"rotate(\" + rotate + (noCenter ? \"\" : \" \" + textX + \" \" + textY) + \")\" : \"\");\n };\n lib.setTransormAndDisplay = function(s, transform) {\n s.attr(\"transform\", lib.getTextTransform(transform));\n s.style(\"display\", transform.scale ? null : \"none\");\n };\n lib.ensureUniformFontSize = function(gd, baseFont) {\n var out = lib.extendFlat({}, baseFont);\n out.size = Math.max(\n baseFont.size,\n gd._fullLayout.uniformtext.minsize || 0\n );\n return out;\n };\n lib.join2 = function(arr, mainSeparator, lastSeparator) {\n var len = arr.length;\n if (len > 1) {\n return arr.slice(0, -1).join(mainSeparator) + lastSeparator + arr[len - 1];\n }\n return arr.join(mainSeparator);\n };\n lib.bigFont = function(size) {\n return Math.round(1.2 * size);\n };\n var firefoxVersion = lib.getFirefoxVersion();\n var isProblematicFirefox = firefoxVersion !== null && firefoxVersion < 86;\n lib.getPositionFromD3Event = function() {\n if (isProblematicFirefox) {\n return [\n d3.event.layerX,\n d3.event.layerY\n ];\n } else {\n return [\n d3.event.offsetX,\n d3.event.offsetY\n ];\n }\n };\n }\n });\n\n // build/plotcss.js\n var require_plotcss = __commonJS({\n \"build/plotcss.js\"() {\n \"use strict\";\n var Lib = require_lib();\n var rules = {\n \"X,X div\": 'direction:ltr;font-family:\"Open Sans\",verdana,arial,sans-serif;margin:0;padding:0;',\n \"X input,X button\": 'font-family:\"Open Sans\",verdana,arial,sans-serif;',\n \"X input:focus,X button:focus\": \"outline:none;\",\n \"X a\": \"text-decoration:none;\",\n \"X a:hover\": \"text-decoration:none;\",\n \"X .crisp\": \"shape-rendering:crispEdges;\",\n \"X .user-select-none\": \"-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;\",\n \"X svg a\": \"fill:#447adb;\",\n \"X svg a:hover\": \"fill:#3c6dc5;\",\n \"X .main-svg\": \"position:absolute;top:0;left:0;pointer-events:none;\",\n \"X .main-svg .draglayer\": \"pointer-events:all;\",\n \"X .cursor-default\": \"cursor:default;\",\n \"X .cursor-pointer\": \"cursor:pointer;\",\n \"X .cursor-crosshair\": \"cursor:crosshair;\",\n \"X .cursor-move\": \"cursor:move;\",\n \"X .cursor-col-resize\": \"cursor:col-resize;\",\n \"X .cursor-row-resize\": \"cursor:row-resize;\",\n \"X .cursor-ns-resize\": \"cursor:ns-resize;\",\n \"X .cursor-ew-resize\": \"cursor:ew-resize;\",\n \"X .cursor-sw-resize\": \"cursor:sw-resize;\",\n \"X .cursor-s-resize\": \"cursor:s-resize;\",\n \"X .cursor-se-resize\": \"cursor:se-resize;\",\n \"X .cursor-w-resize\": \"cursor:w-resize;\",\n \"X .cursor-e-resize\": \"cursor:e-resize;\",\n \"X .cursor-nw-resize\": \"cursor:nw-resize;\",\n \"X .cursor-n-resize\": \"cursor:n-resize;\",\n \"X .cursor-ne-resize\": \"cursor:ne-resize;\",\n \"X .cursor-grab\": \"cursor:-webkit-grab;cursor:grab;\",\n \"X .modebar\": \"position:absolute;top:2px;right:2px;\",\n \"X .ease-bg\": \"-webkit-transition:background-color .3s ease 0s;-moz-transition:background-color .3s ease 0s;-ms-transition:background-color .3s ease 0s;-o-transition:background-color .3s ease 0s;transition:background-color .3s ease 0s;\",\n \"X .modebar--hover>:not(.watermark)\": \"opacity:0;-webkit-transition:opacity .3s ease 0s;-moz-transition:opacity .3s ease 0s;-ms-transition:opacity .3s ease 0s;-o-transition:opacity .3s ease 0s;transition:opacity .3s ease 0s;\",\n \"X:hover .modebar--hover .modebar-group\": \"opacity:1;\",\n \"X .modebar-group\": \"float:left;display:inline-block;box-sizing:border-box;padding-left:8px;position:relative;vertical-align:middle;white-space:nowrap;\",\n \"X .modebar-btn\": \"position:relative;font-size:16px;padding:3px 4px;height:22px;cursor:pointer;line-height:normal;box-sizing:border-box;\",\n \"X .modebar-btn svg\": \"position:relative;top:2px;\",\n \"X .modebar.vertical\": \"display:flex;flex-direction:column;flex-wrap:wrap;align-content:flex-end;max-height:100%;\",\n \"X .modebar.vertical svg\": \"top:-1px;\",\n \"X .modebar.vertical .modebar-group\": \"display:block;float:none;padding-left:0px;padding-bottom:8px;\",\n \"X .modebar.vertical .modebar-group .modebar-btn\": \"display:block;text-align:center;\",\n \"X [data-title]:before,X [data-title]:after\": \"position:absolute;-webkit-transform:translate3d(0, 0, 0);-moz-transform:translate3d(0, 0, 0);-ms-transform:translate3d(0, 0, 0);-o-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);display:none;opacity:0;z-index:1001;pointer-events:none;top:110%;right:50%;\",\n \"X [data-title]:hover:before,X [data-title]:hover:after\": \"display:block;opacity:1;\",\n \"X [data-title]:before\": 'content:\"\";position:absolute;background:rgba(0,0,0,0);border:6px solid rgba(0,0,0,0);z-index:1002;margin-top:-12px;border-bottom-color:#69738a;margin-right:-6px;',\n \"X [data-title]:after\": \"content:attr(data-title);background:#69738a;color:#fff;padding:8px 10px;font-size:12px;line-height:12px;white-space:nowrap;margin-right:-18px;border-radius:2px;\",\n \"X .vertical [data-title]:before,X .vertical [data-title]:after\": \"top:0%;right:200%;\",\n \"X .vertical [data-title]:before\": \"border:6px solid rgba(0,0,0,0);border-left-color:#69738a;margin-top:8px;margin-right:-30px;\",\n Y: 'font-family:\"Open Sans\",verdana,arial,sans-serif;position:fixed;top:50px;right:20px;z-index:10000;font-size:10pt;max-width:180px;',\n \"Y p\": \"margin:0;\",\n \"Y .notifier-note\": \"min-width:180px;max-width:250px;border:1px solid #fff;z-index:3000;margin:0;background-color:#8c97af;background-color:rgba(140,151,175,.9);color:#fff;padding:10px;overflow-wrap:break-word;word-wrap:break-word;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;\",\n \"Y .notifier-close\": \"color:#fff;opacity:.8;float:right;padding:0 5px;background:none;border:none;font-size:20px;font-weight:bold;line-height:20px;\",\n \"Y .notifier-close:hover\": \"color:#444;text-decoration:none;cursor:pointer;\"\n };\n for (selector in rules) {\n fullSelector = selector.replace(/^,/, \" ,\").replace(/X/g, \".js-plotly-plot .plotly\").replace(/Y/g, \".plotly-notifier\");\n Lib.addStyleRule(fullSelector, rules[selector]);\n }\n var fullSelector;\n var selector;\n }\n });\n\n // node_modules/is-browser/client.js\n var require_client = __commonJS({\n \"node_modules/is-browser/client.js\"(exports, module) {\n module.exports = true;\n }\n });\n\n // node_modules/has-hover/index.js\n var require_has_hover = __commonJS({\n \"node_modules/has-hover/index.js\"(exports, module) {\n \"use strict\";\n var isBrowser = require_client();\n var hasHover;\n if (typeof window.matchMedia === \"function\") {\n hasHover = !window.matchMedia(\"(hover: none)\").matches;\n } else {\n hasHover = isBrowser;\n }\n module.exports = hasHover;\n }\n });\n\n // node_modules/events/events.js\n var require_events = __commonJS({\n \"node_modules/events/events.js\"(exports, module) {\n \"use strict\";\n var R = typeof Reflect === \"object\" ? Reflect : null;\n var ReflectApply = R && typeof R.apply === \"function\" ? R.apply : function ReflectApply2(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n };\n var ReflectOwnKeys;\n if (R && typeof R.ownKeys === \"function\") {\n ReflectOwnKeys = R.ownKeys;\n } else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys2(target) {\n return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));\n };\n } else {\n ReflectOwnKeys = function ReflectOwnKeys2(target) {\n return Object.getOwnPropertyNames(target);\n };\n }\n function ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n }\n var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value) {\n return value !== value;\n };\n function EventEmitter() {\n EventEmitter.init.call(this);\n }\n module.exports = EventEmitter;\n module.exports.once = once;\n EventEmitter.EventEmitter = EventEmitter;\n EventEmitter.prototype._events = void 0;\n EventEmitter.prototype._eventsCount = 0;\n EventEmitter.prototype._maxListeners = void 0;\n var defaultMaxListeners = 10;\n function checkListener(listener) {\n if (typeof listener !== \"function\") {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n }\n Object.defineProperty(EventEmitter, \"defaultMaxListeners\", {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== \"number\" || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + \".\");\n }\n defaultMaxListeners = arg;\n }\n });\n EventEmitter.init = function() {\n if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) {\n this._events = /* @__PURE__ */ Object.create(null);\n this._eventsCount = 0;\n }\n this._maxListeners = this._maxListeners || void 0;\n };\n EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== \"number\" || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + \".\");\n }\n this._maxListeners = n;\n return this;\n };\n function _getMaxListeners(that) {\n if (that._maxListeners === void 0)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n }\n EventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n };\n EventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = type === \"error\";\n var events = this._events;\n if (events !== void 0)\n doError = doError && events.error === void 0;\n else if (!doError)\n return false;\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n throw er;\n }\n var err = new Error(\"Unhandled error.\" + (er ? \" (\" + er.message + \")\" : \"\"));\n err.context = er;\n throw err;\n }\n var handler = events[type];\n if (handler === void 0)\n return false;\n if (typeof handler === \"function\") {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n return true;\n };\n function _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n checkListener(listener);\n events = target._events;\n if (events === void 0) {\n events = target._events = /* @__PURE__ */ Object.create(null);\n target._eventsCount = 0;\n } else {\n if (events.newListener !== void 0) {\n target.emit(\n \"newListener\",\n type,\n listener.listener ? listener.listener : listener\n );\n events = target._events;\n }\n existing = events[type];\n }\n if (existing === void 0) {\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === \"function\") {\n existing = events[type] = prepend ? [listener, existing] : [existing, listener];\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n var w = new Error(\"Possible EventEmitter memory leak detected. \" + existing.length + \" \" + String(type) + \" listeners added. Use emitter.setMaxListeners() to increase limit\");\n w.name = \"MaxListenersExceededWarning\";\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n return target;\n }\n EventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n };\n EventEmitter.prototype.on = EventEmitter.prototype.addListener;\n EventEmitter.prototype.prependListener = function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n function onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n }\n function _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: void 0, target, type, listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n }\n EventEmitter.prototype.once = function once2(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n };\n EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n EventEmitter.prototype.removeListener = function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n checkListener(listener);\n events = this._events;\n if (events === void 0)\n return this;\n list = events[type];\n if (list === void 0)\n return this;\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = /* @__PURE__ */ Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit(\"removeListener\", type, list.listener || listener);\n }\n } else if (typeof list !== \"function\") {\n position = -1;\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n if (position < 0)\n return this;\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n if (list.length === 1)\n events[type] = list[0];\n if (events.removeListener !== void 0)\n this.emit(\"removeListener\", type, originalListener || listener);\n }\n return this;\n };\n EventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) {\n var listeners, events, i;\n events = this._events;\n if (events === void 0)\n return this;\n if (events.removeListener === void 0) {\n if (arguments.length === 0) {\n this._events = /* @__PURE__ */ Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== void 0) {\n if (--this._eventsCount === 0)\n this._events = /* @__PURE__ */ Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === \"removeListener\") continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners(\"removeListener\");\n this._events = /* @__PURE__ */ Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n listeners = events[type];\n if (typeof listeners === \"function\") {\n this.removeListener(type, listeners);\n } else if (listeners !== void 0) {\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n return this;\n };\n function _listeners(target, type, unwrap) {\n var events = target._events;\n if (events === void 0)\n return [];\n var evlistener = events[type];\n if (evlistener === void 0)\n return [];\n if (typeof evlistener === \"function\")\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n }\n EventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n };\n EventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n };\n EventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === \"function\") {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n };\n EventEmitter.prototype.listenerCount = listenerCount;\n function listenerCount(type) {\n var events = this._events;\n if (events !== void 0) {\n var evlistener = events[type];\n if (typeof evlistener === \"function\") {\n return 1;\n } else if (evlistener !== void 0) {\n return evlistener.length;\n }\n }\n return 0;\n }\n EventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n };\n function arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n }\n function spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n }\n function unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n }\n function once(emitter, name2) {\n return new Promise(function(resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name2, resolver);\n reject(err);\n }\n function resolver() {\n if (typeof emitter.removeListener === \"function\") {\n emitter.removeListener(\"error\", errorListener);\n }\n resolve([].slice.call(arguments));\n }\n ;\n eventTargetAgnosticAddListener(emitter, name2, resolver, { once: true });\n if (name2 !== \"error\") {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n }\n function addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === \"function\") {\n eventTargetAgnosticAddListener(emitter, \"error\", handler, flags);\n }\n }\n function eventTargetAgnosticAddListener(emitter, name2, listener, flags) {\n if (typeof emitter.on === \"function\") {\n if (flags.once) {\n emitter.once(name2, listener);\n } else {\n emitter.on(name2, listener);\n }\n } else if (typeof emitter.addEventListener === \"function\") {\n emitter.addEventListener(name2, function wrapListener(arg) {\n if (flags.once) {\n emitter.removeEventListener(name2, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n }\n }\n });\n\n // src/lib/events.js\n var require_events2 = __commonJS({\n \"src/lib/events.js\"(exports, module) {\n \"use strict\";\n var EventEmitter = require_events().EventEmitter;\n var Events = {\n init: function(plotObj) {\n if (plotObj._ev instanceof EventEmitter) return plotObj;\n var ev = new EventEmitter();\n var internalEv = new EventEmitter();\n plotObj._ev = ev;\n plotObj._internalEv = internalEv;\n plotObj.on = ev.on.bind(ev);\n plotObj.once = ev.once.bind(ev);\n plotObj.removeListener = ev.removeListener.bind(ev);\n plotObj.removeAllListeners = ev.removeAllListeners.bind(ev);\n plotObj._internalOn = internalEv.on.bind(internalEv);\n plotObj._internalOnce = internalEv.once.bind(internalEv);\n plotObj._removeInternalListener = internalEv.removeListener.bind(internalEv);\n plotObj._removeAllInternalListeners = internalEv.removeAllListeners.bind(internalEv);\n plotObj.emit = function(event, data) {\n ev.emit(event, data);\n internalEv.emit(event, data);\n };\n return plotObj;\n },\n /*\n * This function behaves like jQuery's triggerHandler. It calls\n * all handlers for a particular event and returns the return value\n * of the LAST handler.\n */\n triggerHandler: function(plotObj, event, data) {\n var nodeEventHandlerValue;\n var ev = plotObj._ev;\n if (!ev) return;\n var handlers = ev._events[event];\n if (!handlers) return;\n function apply(handler) {\n if (handler.listener) {\n ev.removeListener(event, handler.listener);\n if (!handler.fired) {\n handler.fired = true;\n return handler.listener.apply(ev, [data]);\n }\n } else {\n return handler.apply(ev, [data]);\n }\n }\n handlers = Array.isArray(handlers) ? handlers : [handlers];\n var i;\n for (i = 0; i < handlers.length - 1; i++) {\n apply(handlers[i]);\n }\n nodeEventHandlerValue = apply(handlers[i]);\n return nodeEventHandlerValue;\n },\n purge: function(plotObj) {\n delete plotObj._ev;\n delete plotObj.on;\n delete plotObj.once;\n delete plotObj.removeListener;\n delete plotObj.removeAllListeners;\n delete plotObj.emit;\n delete plotObj._ev;\n delete plotObj._internalEv;\n delete plotObj._internalOn;\n delete plotObj._internalOnce;\n delete plotObj._removeInternalListener;\n delete plotObj._removeAllInternalListeners;\n return plotObj;\n }\n };\n module.exports = Events;\n }\n });\n\n // src/lib/queue.js\n var require_queue = __commonJS({\n \"src/lib/queue.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var dfltConfig = require_plot_config().dfltConfig;\n function copyArgArray(gd, args) {\n var copy = [];\n var arg;\n for (var i = 0; i < args.length; i++) {\n arg = args[i];\n if (arg === gd) copy[i] = arg;\n else if (typeof arg === \"object\") {\n copy[i] = Array.isArray(arg) ? Lib.extendDeep([], arg) : Lib.extendDeepAll({}, arg);\n } else copy[i] = arg;\n }\n return copy;\n }\n var queue = {};\n queue.add = function(gd, undoFunc, undoArgs, redoFunc, redoArgs) {\n var queueObj, queueIndex;\n gd.undoQueue = gd.undoQueue || { index: 0, queue: [], sequence: false };\n queueIndex = gd.undoQueue.index;\n if (gd.autoplay) {\n if (!gd.undoQueue.inSequence) gd.autoplay = false;\n return;\n }\n if (!gd.undoQueue.sequence || gd.undoQueue.beginSequence) {\n queueObj = { undo: { calls: [], args: [] }, redo: { calls: [], args: [] } };\n gd.undoQueue.queue.splice(queueIndex, gd.undoQueue.queue.length - queueIndex, queueObj);\n gd.undoQueue.index += 1;\n } else {\n queueObj = gd.undoQueue.queue[queueIndex - 1];\n }\n gd.undoQueue.beginSequence = false;\n if (queueObj) {\n queueObj.undo.calls.unshift(undoFunc);\n queueObj.undo.args.unshift(undoArgs);\n queueObj.redo.calls.push(redoFunc);\n queueObj.redo.args.push(redoArgs);\n }\n if (gd.undoQueue.queue.length > dfltConfig.queueLength) {\n gd.undoQueue.queue.shift();\n gd.undoQueue.index--;\n }\n };\n queue.startSequence = function(gd) {\n gd.undoQueue = gd.undoQueue || { index: 0, queue: [], sequence: false };\n gd.undoQueue.sequence = true;\n gd.undoQueue.beginSequence = true;\n };\n queue.stopSequence = function(gd) {\n gd.undoQueue = gd.undoQueue || { index: 0, queue: [], sequence: false };\n gd.undoQueue.sequence = false;\n gd.undoQueue.beginSequence = false;\n };\n queue.undo = function undo(gd) {\n var queueObj, i;\n if (gd.undoQueue === void 0 || isNaN(gd.undoQueue.index) || gd.undoQueue.index <= 0) {\n return;\n }\n gd.undoQueue.index--;\n queueObj = gd.undoQueue.queue[gd.undoQueue.index];\n gd.undoQueue.inSequence = true;\n for (i = 0; i < queueObj.undo.calls.length; i++) {\n queue.plotDo(gd, queueObj.undo.calls[i], queueObj.undo.args[i]);\n }\n gd.undoQueue.inSequence = false;\n gd.autoplay = false;\n };\n queue.redo = function redo(gd) {\n var queueObj, i;\n if (gd.undoQueue === void 0 || isNaN(gd.undoQueue.index) || gd.undoQueue.index >= gd.undoQueue.queue.length) {\n return;\n }\n queueObj = gd.undoQueue.queue[gd.undoQueue.index];\n gd.undoQueue.inSequence = true;\n for (i = 0; i < queueObj.redo.calls.length; i++) {\n queue.plotDo(gd, queueObj.redo.calls[i], queueObj.redo.args[i]);\n }\n gd.undoQueue.inSequence = false;\n gd.autoplay = false;\n gd.undoQueue.index++;\n };\n queue.plotDo = function(gd, func, args) {\n gd.autoplay = true;\n args = copyArgArray(gd, args);\n func.apply(null, args);\n };\n module.exports = queue;\n }\n });\n\n // src/plots/frame_attributes.js\n var require_frame_attributes = __commonJS({\n \"src/plots/frame_attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n _isLinkedToArray: \"frames_entry\",\n group: {\n valType: \"string\"\n },\n name: {\n valType: \"string\"\n },\n traces: {\n valType: \"any\"\n },\n baseframe: {\n valType: \"string\"\n },\n data: {\n valType: \"any\"\n },\n layout: {\n valType: \"any\"\n }\n };\n }\n });\n\n // src/plot_api/plot_schema.js\n var require_plot_schema = __commonJS({\n \"src/plot_api/plot_schema.js\"(exports) {\n \"use strict\";\n var Registry = require_registry();\n var Lib = require_lib();\n var baseAttributes = require_attributes2();\n var baseLayoutAttributes = require_layout_attributes2();\n var frameAttributes = require_frame_attributes();\n var animationAttributes = require_animation_attributes();\n var configAttributes = require_plot_config().configAttributes;\n var editTypes = require_edit_types();\n var extendDeepAll = Lib.extendDeepAll;\n var isPlainObject = Lib.isPlainObject;\n var isArrayOrTypedArray = Lib.isArrayOrTypedArray;\n var nestedProperty = Lib.nestedProperty;\n var valObjectMeta = Lib.valObjectMeta;\n var IS_SUBPLOT_OBJ = \"_isSubplotObj\";\n var IS_LINKED_TO_ARRAY = \"_isLinkedToArray\";\n var ARRAY_ATTR_REGEXPS = \"_arrayAttrRegexps\";\n var DEPRECATED = \"_deprecated\";\n var UNDERSCORE_ATTRS = [IS_SUBPLOT_OBJ, IS_LINKED_TO_ARRAY, ARRAY_ATTR_REGEXPS, DEPRECATED];\n exports.IS_SUBPLOT_OBJ = IS_SUBPLOT_OBJ;\n exports.IS_LINKED_TO_ARRAY = IS_LINKED_TO_ARRAY;\n exports.DEPRECATED = DEPRECATED;\n exports.UNDERSCORE_ATTRS = UNDERSCORE_ATTRS;\n exports.get = function() {\n var traces = {};\n Registry.allTypes.forEach(function(type) {\n traces[type] = getTraceAttributes(type);\n });\n return {\n defs: {\n valObjects: valObjectMeta,\n metaKeys: UNDERSCORE_ATTRS.concat([\"description\", \"role\", \"editType\", \"impliedEdits\"]),\n editType: {\n traces: editTypes.traces,\n layout: editTypes.layout\n },\n impliedEdits: {}\n },\n traces,\n layout: getLayoutAttributes(),\n frames: getFramesAttributes(),\n animation: formatAttributes(animationAttributes),\n config: formatAttributes(configAttributes)\n };\n };\n exports.crawl = function(attrs, callback, specifiedLevel, attrString) {\n var level = specifiedLevel || 0;\n attrString = attrString || \"\";\n Object.keys(attrs).forEach(function(attrName) {\n var attr = attrs[attrName];\n if (UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return;\n var fullAttrString = (attrString ? attrString + \".\" : \"\") + attrName;\n callback(attr, attrName, attrs, level, fullAttrString);\n if (exports.isValObject(attr)) return;\n if (isPlainObject(attr) && attrName !== \"impliedEdits\") {\n exports.crawl(attr, callback, level + 1, fullAttrString);\n }\n });\n };\n exports.isValObject = function(obj) {\n return obj && obj.valType !== void 0;\n };\n exports.findArrayAttributes = function(trace) {\n var arrayAttributes = [];\n var stack = [];\n var isArrayStack = [];\n var baseContainer, baseAttrName;\n function callback(attr, attrName, attrs, level) {\n stack = stack.slice(0, level).concat([attrName]);\n isArrayStack = isArrayStack.slice(0, level).concat([attr && attr._isLinkedToArray]);\n var splittableAttr = attr && (attr.valType === \"data_array\" || attr.arrayOk === true) && !(stack[level - 1] === \"colorbar\" && (attrName === \"ticktext\" || attrName === \"tickvals\"));\n if (!splittableAttr) return;\n crawlIntoTrace(baseContainer, 0, \"\");\n }\n function crawlIntoTrace(container, i, astrPartial) {\n var item = container[stack[i]];\n var newAstrPartial = astrPartial + stack[i];\n if (i === stack.length - 1) {\n if (isArrayOrTypedArray(item)) {\n arrayAttributes.push(baseAttrName + newAstrPartial);\n }\n } else {\n if (isArrayStack[i]) {\n if (Array.isArray(item)) {\n for (var j = 0; j < item.length; j++) {\n if (isPlainObject(item[j])) {\n crawlIntoTrace(item[j], i + 1, newAstrPartial + \"[\" + j + \"].\");\n }\n }\n }\n } else if (isPlainObject(item)) {\n crawlIntoTrace(item, i + 1, newAstrPartial + \".\");\n }\n }\n }\n baseContainer = trace;\n baseAttrName = \"\";\n exports.crawl(baseAttributes, callback);\n if (trace._module && trace._module.attributes) {\n exports.crawl(trace._module.attributes, callback);\n }\n return arrayAttributes;\n };\n exports.getTraceValObject = function(trace, parts) {\n var head = parts[0];\n var i = 1;\n var moduleAttrs, valObject;\n var _module = trace._module;\n if (!_module) _module = (Registry.modules[trace.type || baseAttributes.type.dflt] || {})._module;\n if (!_module) return false;\n moduleAttrs = _module.attributes;\n valObject = moduleAttrs && moduleAttrs[head];\n if (!valObject) {\n var subplotModule = _module.basePlotModule;\n if (subplotModule && subplotModule.attributes) {\n valObject = subplotModule.attributes[head];\n }\n }\n if (!valObject) valObject = baseAttributes[head];\n return recurseIntoValObject(valObject, parts, i);\n };\n exports.getLayoutValObject = function(fullLayout, parts) {\n var valObject = layoutHeadAttr(fullLayout, parts[0]);\n return recurseIntoValObject(valObject, parts, 1);\n };\n function layoutHeadAttr(fullLayout, head) {\n var i, key, _module, attributes;\n var basePlotModules = fullLayout._basePlotModules;\n if (basePlotModules) {\n var out;\n for (i = 0; i < basePlotModules.length; i++) {\n _module = basePlotModules[i];\n if (_module.attrRegex && _module.attrRegex.test(head)) {\n if (_module.layoutAttrOverrides) return _module.layoutAttrOverrides;\n if (!out && _module.layoutAttributes) out = _module.layoutAttributes;\n }\n var baseOverrides = _module.baseLayoutAttrOverrides;\n if (baseOverrides && head in baseOverrides) return baseOverrides[head];\n }\n if (out) return out;\n }\n var modules = fullLayout._modules;\n if (modules) {\n for (i = 0; i < modules.length; i++) {\n attributes = modules[i].layoutAttributes;\n if (attributes && head in attributes) {\n return attributes[head];\n }\n }\n }\n for (key in Registry.componentsRegistry) {\n _module = Registry.componentsRegistry[key];\n if (_module.name === \"colorscale\" && head.indexOf(\"coloraxis\") === 0) {\n return _module.layoutAttributes[head];\n } else if (!_module.schema && head === _module.name) {\n return _module.layoutAttributes;\n }\n }\n if (head in baseLayoutAttributes) return baseLayoutAttributes[head];\n return false;\n }\n function recurseIntoValObject(valObject, parts, i) {\n if (!valObject) return false;\n if (valObject._isLinkedToArray) {\n if (isIndex(parts[i])) i++;\n else if (i < parts.length) return false;\n }\n for (; i < parts.length; i++) {\n var newValObject = valObject[parts[i]];\n if (isPlainObject(newValObject)) valObject = newValObject;\n else break;\n if (i === parts.length - 1) break;\n if (valObject._isLinkedToArray) {\n i++;\n if (!isIndex(parts[i])) return false;\n } else if (valObject.valType === \"info_array\") {\n i++;\n var index = parts[i];\n if (!isIndex(index)) return false;\n var items = valObject.items;\n if (Array.isArray(items)) {\n if (index >= items.length) return false;\n if (valObject.dimensions === 2) {\n i++;\n if (parts.length === i) return valObject;\n var index2 = parts[i];\n if (!isIndex(index2)) return false;\n valObject = items[index][index2];\n } else valObject = items[index];\n } else {\n valObject = items;\n }\n }\n }\n return valObject;\n }\n function isIndex(val) {\n return val === Math.round(val) && val >= 0;\n }\n function getTraceAttributes(type) {\n var _module, basePlotModule;\n _module = Registry.modules[type]._module, basePlotModule = _module.basePlotModule;\n var attributes = {};\n attributes.type = null;\n var copyBaseAttributes = extendDeepAll({}, baseAttributes);\n var copyModuleAttributes = extendDeepAll({}, _module.attributes);\n exports.crawl(copyModuleAttributes, function(attr, attrName, attrs, level, fullAttrString) {\n nestedProperty(copyBaseAttributes, fullAttrString).set(void 0);\n if (attr === void 0) nestedProperty(copyModuleAttributes, fullAttrString).set(void 0);\n });\n extendDeepAll(attributes, copyBaseAttributes);\n if (Registry.traceIs(type, \"noOpacity\")) {\n delete attributes.opacity;\n }\n if (!Registry.traceIs(type, \"showLegend\")) {\n delete attributes.showlegend;\n delete attributes.legendgroup;\n }\n if (Registry.traceIs(type, \"noHover\")) {\n delete attributes.hoverinfo;\n delete attributes.hoverlabel;\n }\n if (!_module.selectPoints) {\n delete attributes.selectedpoints;\n }\n extendDeepAll(attributes, copyModuleAttributes);\n if (basePlotModule.attributes) {\n extendDeepAll(attributes, basePlotModule.attributes);\n }\n attributes.type = type;\n var out = {\n meta: _module.meta || {},\n categories: _module.categories || {},\n animatable: Boolean(_module.animatable),\n type,\n attributes: formatAttributes(attributes)\n };\n if (_module.layoutAttributes) {\n var layoutAttributes = {};\n extendDeepAll(layoutAttributes, _module.layoutAttributes);\n out.layoutAttributes = formatAttributes(layoutAttributes);\n }\n if (!_module.animatable) {\n exports.crawl(out, function(attr) {\n if (exports.isValObject(attr) && \"anim\" in attr) {\n delete attr.anim;\n }\n });\n }\n return out;\n }\n function getLayoutAttributes() {\n var layoutAttributes = {};\n var key, _module;\n extendDeepAll(layoutAttributes, baseLayoutAttributes);\n for (key in Registry.subplotsRegistry) {\n _module = Registry.subplotsRegistry[key];\n if (!_module.layoutAttributes) continue;\n if (Array.isArray(_module.attr)) {\n for (var i = 0; i < _module.attr.length; i++) {\n handleBasePlotModule(layoutAttributes, _module, _module.attr[i]);\n }\n } else {\n var astr = _module.attr === \"subplot\" ? _module.name : _module.attr;\n handleBasePlotModule(layoutAttributes, _module, astr);\n }\n }\n for (key in Registry.componentsRegistry) {\n _module = Registry.componentsRegistry[key];\n var schema = _module.schema;\n if (schema && (schema.subplots || schema.layout)) {\n var subplots = schema.subplots;\n if (subplots && subplots.xaxis && !subplots.yaxis) {\n for (var xkey in subplots.xaxis) {\n delete layoutAttributes.yaxis[xkey];\n }\n }\n delete layoutAttributes.xaxis.shift;\n delete layoutAttributes.xaxis.autoshift;\n } else if (_module.name === \"colorscale\") {\n extendDeepAll(layoutAttributes, _module.layoutAttributes);\n } else if (_module.layoutAttributes) {\n insertAttrs(layoutAttributes, _module.layoutAttributes, _module.name);\n }\n }\n return {\n layoutAttributes: formatAttributes(layoutAttributes)\n };\n }\n function getFramesAttributes() {\n var attrs = {\n frames: extendDeepAll({}, frameAttributes)\n };\n formatAttributes(attrs);\n return attrs.frames;\n }\n function formatAttributes(attrs) {\n mergeValTypeAndRole(attrs);\n formatArrayContainers(attrs);\n stringify(attrs);\n return attrs;\n }\n function mergeValTypeAndRole(attrs) {\n function makeSrcAttr(attrName) {\n return {\n valType: \"string\",\n editType: \"none\"\n };\n }\n function callback(attr, attrName, attrs2) {\n if (exports.isValObject(attr)) {\n if (attr.arrayOk === true || attr.valType === \"data_array\") {\n attrs2[attrName + \"src\"] = makeSrcAttr(attrName);\n }\n } else if (isPlainObject(attr)) {\n attr.role = \"object\";\n }\n }\n exports.crawl(attrs, callback);\n }\n function formatArrayContainers(attrs) {\n function callback(attr, attrName, attrs2) {\n if (!attr) return;\n var itemName = attr[IS_LINKED_TO_ARRAY];\n if (!itemName) return;\n delete attr[IS_LINKED_TO_ARRAY];\n attrs2[attrName] = { items: {} };\n attrs2[attrName].items[itemName] = attr;\n attrs2[attrName].role = \"object\";\n }\n exports.crawl(attrs, callback);\n }\n function stringify(attrs) {\n function walk(attr) {\n for (var k in attr) {\n if (isPlainObject(attr[k])) {\n walk(attr[k]);\n } else if (Array.isArray(attr[k])) {\n for (var i = 0; i < attr[k].length; i++) {\n walk(attr[k][i]);\n }\n } else {\n if (attr[k] instanceof RegExp) {\n attr[k] = attr[k].toString();\n }\n }\n }\n }\n walk(attrs);\n }\n function handleBasePlotModule(layoutAttributes, _module, astr) {\n var np = nestedProperty(layoutAttributes, astr);\n var attrs = extendDeepAll({}, _module.layoutAttributes);\n attrs[IS_SUBPLOT_OBJ] = true;\n np.set(attrs);\n }\n function insertAttrs(baseAttrs, newAttrs, astr) {\n var np = nestedProperty(baseAttrs, astr);\n np.set(extendDeepAll(np.get() || {}, newAttrs));\n }\n }\n });\n\n // src/plot_api/plot_template.js\n var require_plot_template = __commonJS({\n \"src/plot_api/plot_template.js\"(exports) {\n \"use strict\";\n var Lib = require_lib();\n var plotAttributes = require_attributes2();\n var TEMPLATEITEMNAME = \"templateitemname\";\n var templateAttrs = {\n name: {\n valType: \"string\",\n editType: \"none\"\n }\n };\n templateAttrs[TEMPLATEITEMNAME] = {\n valType: \"string\",\n editType: \"calc\"\n };\n exports.templatedArray = function(name2, attrs) {\n attrs._isLinkedToArray = name2;\n attrs.name = templateAttrs.name;\n attrs[TEMPLATEITEMNAME] = templateAttrs[TEMPLATEITEMNAME];\n return attrs;\n };\n exports.traceTemplater = function(dataTemplate) {\n var traceCounts = {};\n var traceType, typeTemplates;\n for (traceType in dataTemplate) {\n typeTemplates = dataTemplate[traceType];\n if (Array.isArray(typeTemplates) && typeTemplates.length) {\n traceCounts[traceType] = 0;\n }\n }\n function newTrace(traceIn) {\n traceType = Lib.coerce(traceIn, {}, plotAttributes, \"type\");\n var traceOut = { type: traceType, _template: null };\n if (traceType in traceCounts) {\n typeTemplates = dataTemplate[traceType];\n var typei = traceCounts[traceType] % typeTemplates.length;\n traceCounts[traceType]++;\n traceOut._template = typeTemplates[typei];\n } else {\n }\n return traceOut;\n }\n return {\n newTrace\n // TODO: function to figure out what's left & what didn't work\n };\n };\n exports.newContainer = function(container, name2, baseName) {\n var template = container._template;\n var part = template && (template[name2] || baseName && template[baseName]);\n if (!Lib.isPlainObject(part)) part = null;\n var out = container[name2] = { _template: part };\n return out;\n };\n exports.arrayTemplater = function(container, name2, inclusionAttr) {\n var template = container._template;\n var defaultsTemplate = template && template[arrayDefaultKey(name2)];\n var templateItems = template && template[name2];\n if (!Array.isArray(templateItems) || !templateItems.length) {\n templateItems = [];\n }\n var usedNames = {};\n function newItem(itemIn) {\n var out = { name: itemIn.name, _input: itemIn };\n var templateItemName = out[TEMPLATEITEMNAME] = itemIn[TEMPLATEITEMNAME];\n if (!validItemName(templateItemName)) {\n out._template = defaultsTemplate;\n return out;\n }\n for (var i = 0; i < templateItems.length; i++) {\n var templateItem = templateItems[i];\n if (templateItem.name === templateItemName) {\n usedNames[templateItemName] = 1;\n out._template = templateItem;\n return out;\n }\n }\n out[inclusionAttr] = itemIn[inclusionAttr] || false;\n out._template = false;\n return out;\n }\n function defaultItems() {\n var out = [];\n for (var i = 0; i < templateItems.length; i++) {\n var templateItem = templateItems[i];\n var name3 = templateItem.name;\n if (validItemName(name3) && !usedNames[name3]) {\n var outi = {\n _template: templateItem,\n name: name3,\n _input: { _templateitemname: name3 }\n };\n outi[TEMPLATEITEMNAME] = templateItem[TEMPLATEITEMNAME];\n out.push(outi);\n usedNames[name3] = 1;\n }\n }\n return out;\n }\n return {\n newItem,\n defaultItems\n };\n };\n function validItemName(name2) {\n return name2 && typeof name2 === \"string\";\n }\n function arrayDefaultKey(name2) {\n var lastChar = name2.length - 1;\n if (name2.charAt(lastChar) !== \"s\") {\n Lib.warn(\"bad argument to arrayDefaultKey: \" + name2);\n }\n return name2.substr(0, name2.length - 1) + \"defaults\";\n }\n exports.arrayDefaultKey = arrayDefaultKey;\n exports.arrayEditor = function(parentIn, containerStr, itemOut) {\n var lengthIn = (Lib.nestedProperty(parentIn, containerStr).get() || []).length;\n var index = itemOut._index;\n var templateItemName = index >= lengthIn && (itemOut._input || {})._templateitemname;\n if (templateItemName) index = lengthIn;\n var itemStr = containerStr + \"[\" + index + \"]\";\n var update;\n function resetUpdate() {\n update = {};\n if (templateItemName) {\n update[itemStr] = {};\n update[itemStr][TEMPLATEITEMNAME] = templateItemName;\n }\n }\n resetUpdate();\n function modifyBase(attr, value) {\n update[attr] = value;\n }\n function modifyItem(attr, value) {\n if (templateItemName) {\n Lib.nestedProperty(update[itemStr], attr).set(value);\n } else {\n update[itemStr + \".\" + attr] = value;\n }\n }\n function getUpdateObj() {\n var updateOut = update;\n resetUpdate();\n return updateOut;\n }\n function applyUpdate(attr, value) {\n if (attr) modifyItem(attr, value);\n var updateToApply = getUpdateObj();\n for (var key in updateToApply) {\n Lib.nestedProperty(parentIn, key).set(updateToApply[key]);\n }\n }\n return {\n modifyBase,\n modifyItem,\n getUpdateObj,\n applyUpdate\n };\n };\n }\n });\n\n // src/plots/cartesian/constants.js\n var require_constants2 = __commonJS({\n \"src/plots/cartesian/constants.js\"(exports, module) {\n \"use strict\";\n var counterRegex = require_regex().counter;\n module.exports = {\n idRegex: {\n x: counterRegex(\"x\", \"( domain)?\"),\n y: counterRegex(\"y\", \"( domain)?\")\n },\n attrRegex: counterRegex(\"[xy]axis\"),\n // axis match regular expression\n xAxisMatch: counterRegex(\"xaxis\"),\n yAxisMatch: counterRegex(\"yaxis\"),\n // pattern matching axis ids and names\n // note that this is more permissive than counterRegex, as\n // id2name, name2id, and cleanId accept \"x1\" etc\n AX_ID_PATTERN: /^[xyz][0-9]*( domain)?$/,\n AX_NAME_PATTERN: /^[xyz]axis[0-9]*$/,\n // and for 2D subplots\n SUBPLOT_PATTERN: /^x([0-9]*)y([0-9]*)$/,\n HOUR_PATTERN: \"hour\",\n WEEKDAY_PATTERN: \"day of week\",\n // pixels to move mouse before you stop clamping to starting point\n MINDRAG: 8,\n // smallest dimension allowed for a zoombox\n MINZOOM: 20,\n // width of axis drag regions\n DRAGGERSIZE: 20,\n // delay before a redraw (relayout) after smooth panning and zooming\n REDRAWDELAY: 50,\n // last resort axis ranges for x and y axes if we have no data\n DFLTRANGEX: [-1, 6],\n DFLTRANGEY: [-1, 4],\n // Layers to keep trace types in the right order\n // N.B. each 'unique' plot method must have its own layer\n traceLayerClasses: [\n \"imagelayer\",\n \"heatmaplayer\",\n \"contourcarpetlayer\",\n \"contourlayer\",\n \"funnellayer\",\n \"waterfalllayer\",\n \"barlayer\",\n \"carpetlayer\",\n \"violinlayer\",\n \"boxlayer\",\n \"ohlclayer\",\n \"scattercarpetlayer\",\n \"scatterlayer\"\n ],\n clipOnAxisFalseQuery: [\n \".scatterlayer\",\n \".barlayer\",\n \".funnellayer\",\n \".waterfalllayer\"\n ],\n layerValue2layerClass: {\n \"above traces\": \"above\",\n \"below traces\": \"below\"\n },\n zindexSeparator: \"z\"\n // used for zindex of cartesian subplots e.g. xy, xyz2, xyz3, etc.\n };\n }\n });\n\n // src/plots/cartesian/axis_ids.js\n var require_axis_ids = __commonJS({\n \"src/plots/cartesian/axis_ids.js\"(exports) {\n \"use strict\";\n var Registry = require_registry();\n var constants = require_constants2();\n exports.id2name = function id2name(id) {\n if (typeof id !== \"string\" || !id.match(constants.AX_ID_PATTERN)) return;\n var axNum = id.split(\" \")[0].substr(1);\n if (axNum === \"1\") axNum = \"\";\n return id.charAt(0) + \"axis\" + axNum;\n };\n exports.name2id = function name2id(name2) {\n if (!name2.match(constants.AX_NAME_PATTERN)) return;\n var axNum = name2.substr(5);\n if (axNum === \"1\") axNum = \"\";\n return name2.charAt(0) + axNum;\n };\n exports.cleanId = function cleanId(id, axLetter, domainId) {\n var domainTest = /( domain)$/.test(id);\n if (typeof id !== \"string\" || !id.match(constants.AX_ID_PATTERN)) return;\n if (axLetter && id.charAt(0) !== axLetter) return;\n if (domainTest && !domainId) return;\n var axNum = id.split(\" \")[0].substr(1).replace(/^0+/, \"\");\n if (axNum === \"1\") axNum = \"\";\n return id.charAt(0) + axNum + (domainTest && domainId ? \" domain\" : \"\");\n };\n exports.list = function(gd, axLetter, only2d) {\n var fullLayout = gd._fullLayout;\n if (!fullLayout) return [];\n var idList = exports.listIds(gd, axLetter);\n var out = new Array(idList.length);\n var i;\n for (i = 0; i < idList.length; i++) {\n var idi = idList[i];\n out[i] = fullLayout[idi.charAt(0) + \"axis\" + idi.substr(1)];\n }\n if (!only2d) {\n var sceneIds3D = fullLayout._subplots.gl3d || [];\n for (i = 0; i < sceneIds3D.length; i++) {\n var scene = fullLayout[sceneIds3D[i]];\n if (axLetter) out.push(scene[axLetter + \"axis\"]);\n else out.push(scene.xaxis, scene.yaxis, scene.zaxis);\n }\n }\n return out;\n };\n exports.listIds = function(gd, axLetter) {\n var fullLayout = gd._fullLayout;\n if (!fullLayout) return [];\n var subplotLists = fullLayout._subplots;\n if (axLetter) return subplotLists[axLetter + \"axis\"];\n return subplotLists.xaxis.concat(subplotLists.yaxis);\n };\n exports.getFromId = function(gd, id, type) {\n var fullLayout = gd._fullLayout;\n id = id === void 0 || typeof id !== \"string\" ? id : id.replace(\" domain\", \"\");\n if (type === \"x\") id = id.replace(/y[0-9]*/, \"\");\n else if (type === \"y\") id = id.replace(/x[0-9]*/, \"\");\n return fullLayout[exports.id2name(id)];\n };\n exports.getFromTrace = function(gd, fullTrace, type) {\n var fullLayout = gd._fullLayout;\n var ax = null;\n if (Registry.traceIs(fullTrace, \"gl3d\")) {\n var scene = fullTrace.scene;\n if (scene.substr(0, 5) === \"scene\") {\n ax = fullLayout[scene][type + \"axis\"];\n }\n } else {\n ax = exports.getFromId(gd, fullTrace[type + \"axis\"] || type);\n }\n return ax;\n };\n exports.idSort = function(id1, id2) {\n var letter1 = id1.charAt(0);\n var letter2 = id2.charAt(0);\n if (letter1 !== letter2) return letter1 > letter2 ? 1 : -1;\n return +(id1.substr(1) || 1) - +(id2.substr(1) || 1);\n };\n exports.ref2id = function(ar) {\n return /^[xyz]/.test(ar) ? ar.split(\" \")[0] : false;\n };\n function isFound(axId, list) {\n if (list && list.length) {\n for (var i = 0; i < list.length; i++) {\n if (list[i][axId]) return true;\n }\n }\n return false;\n }\n exports.isLinked = function(fullLayout, axId) {\n return isFound(axId, fullLayout._axisMatchGroups) || isFound(axId, fullLayout._axisConstraintGroups);\n };\n }\n });\n\n // src/components/shapes/handle_outline.js\n var require_handle_outline = __commonJS({\n \"src/components/shapes/handle_outline.js\"(exports, module) {\n \"use strict\";\n function clearOutlineControllers(gd) {\n var zoomLayer = gd._fullLayout._zoomlayer;\n if (zoomLayer) {\n zoomLayer.selectAll(\".outline-controllers\").remove();\n }\n }\n function clearOutline(gd) {\n var zoomLayer = gd._fullLayout._zoomlayer;\n if (zoomLayer) {\n zoomLayer.selectAll(\".select-outline\").remove();\n }\n gd._fullLayout._outlining = false;\n }\n module.exports = {\n clearOutlineControllers,\n clearOutline\n };\n }\n });\n\n // src/traces/scatter/layout_attributes.js\n var require_layout_attributes3 = __commonJS({\n \"src/traces/scatter/layout_attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n scattermode: {\n valType: \"enumerated\",\n values: [\"group\", \"overlay\"],\n dflt: \"overlay\",\n editType: \"calc\"\n },\n scattergap: {\n valType: \"number\",\n min: 0,\n max: 1,\n editType: \"calc\"\n }\n };\n }\n });\n\n // src/plots/get_data.js\n var require_get_data = __commonJS({\n \"src/plots/get_data.js\"(exports) {\n \"use strict\";\n var Registry = require_registry();\n var SUBPLOT_PATTERN = require_constants2().SUBPLOT_PATTERN;\n exports.getSubplotCalcData = function(calcData, type, subplotId) {\n var basePlotModule = Registry.subplotsRegistry[type];\n if (!basePlotModule) return [];\n var attr = basePlotModule.attr;\n var subplotCalcData = [];\n for (var i = 0; i < calcData.length; i++) {\n var calcTrace = calcData[i];\n var trace = calcTrace[0].trace;\n if (trace[attr] === subplotId) subplotCalcData.push(calcTrace);\n }\n return subplotCalcData;\n };\n exports.getModuleCalcData = function(calcdata, arg1, arg2) {\n var moduleCalcData = [];\n var remainingCalcData = [];\n var plotMethod;\n if (typeof arg1 === \"string\") {\n plotMethod = Registry.getModule(arg1).plot;\n } else if (typeof arg1 === \"function\") {\n plotMethod = arg1;\n } else {\n plotMethod = arg1.plot;\n }\n if (!plotMethod) {\n return [moduleCalcData, calcdata];\n }\n var zorder = arg2;\n for (var i = 0; i < calcdata.length; i++) {\n var cd = calcdata[i];\n var trace = cd[0].trace;\n var filterByZ = trace.zorder !== void 0;\n if (trace.visible !== true || trace._length === 0) continue;\n if (trace._module && trace._module.plot === plotMethod && (!filterByZ || trace.zorder === zorder)) {\n moduleCalcData.push(cd);\n } else {\n remainingCalcData.push(cd);\n }\n }\n return [moduleCalcData, remainingCalcData];\n };\n exports.getSubplotData = function getSubplotData(data, type, subplotId) {\n if (!Registry.subplotsRegistry[type]) return [];\n var attr = Registry.subplotsRegistry[type].attr;\n var subplotData = [];\n var trace, subplotX, subplotY;\n for (var i = 0; i < data.length; i++) {\n trace = data[i];\n if (trace[attr] === subplotId) subplotData.push(trace);\n }\n return subplotData;\n };\n }\n });\n\n // src/plots/command.js\n var require_command = __commonJS({\n \"src/plots/command.js\"(exports) {\n \"use strict\";\n var Registry = require_registry();\n var Lib = require_lib();\n exports.manageCommandObserver = function(gd, container, commandList, onchange) {\n var ret = {};\n var enabled = true;\n if (container && container._commandObserver) {\n ret = container._commandObserver;\n }\n if (!ret.cache) {\n ret.cache = {};\n }\n ret.lookupTable = {};\n var binding = exports.hasSimpleAPICommandBindings(gd, commandList, ret.lookupTable);\n if (container && container._commandObserver) {\n if (!binding) {\n if (container._commandObserver.remove) {\n container._commandObserver.remove();\n container._commandObserver = null;\n return ret;\n }\n } else {\n return ret;\n }\n }\n if (binding) {\n bindingValueHasChanged(gd, binding, ret.cache);\n ret.check = function check() {\n if (!enabled) return;\n var update = bindingValueHasChanged(gd, binding, ret.cache);\n if (update.changed && onchange) {\n if (ret.lookupTable[update.value] !== void 0) {\n ret.disable();\n Promise.resolve(onchange({\n value: update.value,\n type: binding.type,\n prop: binding.prop,\n traces: binding.traces,\n index: ret.lookupTable[update.value]\n })).then(ret.enable, ret.enable);\n }\n }\n return update.changed;\n };\n var checkEvents = [\n \"plotly_relayout\",\n \"plotly_redraw\",\n \"plotly_restyle\",\n \"plotly_update\",\n \"plotly_animatingframe\",\n \"plotly_afterplot\"\n ];\n for (var i = 0; i < checkEvents.length; i++) {\n gd._internalOn(checkEvents[i], ret.check);\n }\n ret.remove = function() {\n for (var i2 = 0; i2 < checkEvents.length; i2++) {\n gd._removeInternalListener(checkEvents[i2], ret.check);\n }\n };\n } else {\n Lib.log(\"Unable to automatically bind plot updates to API command\");\n ret.lookupTable = {};\n ret.remove = function() {\n };\n }\n ret.disable = function disable() {\n enabled = false;\n };\n ret.enable = function enable() {\n enabled = true;\n };\n if (container) {\n container._commandObserver = ret;\n }\n return ret;\n };\n exports.hasSimpleAPICommandBindings = function(gd, commandList, bindingsByValue) {\n var i;\n var n = commandList.length;\n var refBinding;\n for (i = 0; i < n; i++) {\n var binding;\n var command = commandList[i];\n var method = command.method;\n var args = command.args;\n if (!Array.isArray(args)) args = [];\n if (!method) {\n return false;\n }\n var bindings = exports.computeAPICommandBindings(gd, method, args);\n if (bindings.length !== 1) {\n return false;\n }\n if (!refBinding) {\n refBinding = bindings[0];\n if (Array.isArray(refBinding.traces)) {\n refBinding.traces.sort();\n }\n } else {\n binding = bindings[0];\n if (binding.type !== refBinding.type) {\n return false;\n }\n if (binding.prop !== refBinding.prop) {\n return false;\n }\n if (Array.isArray(refBinding.traces)) {\n if (Array.isArray(binding.traces)) {\n binding.traces.sort();\n for (var j = 0; j < refBinding.traces.length; j++) {\n if (refBinding.traces[j] !== binding.traces[j]) {\n return false;\n }\n }\n } else {\n return false;\n }\n } else {\n if (binding.prop !== refBinding.prop) {\n return false;\n }\n }\n }\n binding = bindings[0];\n var value = binding.value;\n if (Array.isArray(value)) {\n if (value.length === 1) {\n value = value[0];\n } else {\n return false;\n }\n }\n if (bindingsByValue) {\n bindingsByValue[value] = i;\n }\n }\n return refBinding;\n };\n function bindingValueHasChanged(gd, binding, cache) {\n var container, value, obj;\n var changed = false;\n if (binding.type === \"data\") {\n container = gd._fullData[binding.traces !== null ? binding.traces[0] : 0];\n } else if (binding.type === \"layout\") {\n container = gd._fullLayout;\n } else {\n return false;\n }\n value = Lib.nestedProperty(container, binding.prop).get();\n obj = cache[binding.type] = cache[binding.type] || {};\n if (obj.hasOwnProperty(binding.prop)) {\n if (obj[binding.prop] !== value) {\n changed = true;\n }\n }\n obj[binding.prop] = value;\n return {\n changed,\n value\n };\n }\n exports.executeAPICommand = function(gd, method, args) {\n if (method === \"skip\") return Promise.resolve();\n var _method = Registry.apiMethodRegistry[method];\n var allArgs = [gd];\n if (!Array.isArray(args)) args = [];\n for (var i = 0; i < args.length; i++) {\n allArgs.push(args[i]);\n }\n return _method.apply(null, allArgs).catch(function(err) {\n Lib.warn(\"API call to Plotly.\" + method + \" rejected.\", err);\n return Promise.reject(err);\n });\n };\n exports.computeAPICommandBindings = function(gd, method, args) {\n var bindings;\n if (!Array.isArray(args)) args = [];\n switch (method) {\n case \"restyle\":\n bindings = computeDataBindings(gd, args);\n break;\n case \"relayout\":\n bindings = computeLayoutBindings(gd, args);\n break;\n case \"update\":\n bindings = computeDataBindings(gd, [args[0], args[2]]).concat(computeLayoutBindings(gd, [args[1]]));\n break;\n case \"animate\":\n bindings = computeAnimateBindings(gd, args);\n break;\n default:\n bindings = [];\n }\n return bindings;\n };\n function computeAnimateBindings(gd, args) {\n if (Array.isArray(args[0]) && args[0].length === 1 && [\"string\", \"number\"].indexOf(typeof args[0][0]) !== -1) {\n return [{ type: \"layout\", prop: \"_currentFrame\", value: args[0][0].toString() }];\n } else {\n return [];\n }\n }\n function computeLayoutBindings(gd, args) {\n var bindings = [];\n var astr = args[0];\n var aobj = {};\n if (typeof astr === \"string\") {\n aobj[astr] = args[1];\n } else if (Lib.isPlainObject(astr)) {\n aobj = astr;\n } else {\n return bindings;\n }\n crawl(aobj, function(path, attrName, attr) {\n bindings.push({ type: \"layout\", prop: path, value: attr });\n }, \"\", 0);\n return bindings;\n }\n function computeDataBindings(gd, args) {\n var traces, astr, val, aobj;\n var bindings = [];\n astr = args[0];\n val = args[1];\n traces = args[2];\n aobj = {};\n if (typeof astr === \"string\") {\n aobj[astr] = val;\n } else if (Lib.isPlainObject(astr)) {\n aobj = astr;\n if (traces === void 0) {\n traces = val;\n }\n } else {\n return bindings;\n }\n if (traces === void 0) {\n traces = null;\n }\n crawl(aobj, function(path, attrName, _attr) {\n var thisTraces;\n var attr;\n if (Array.isArray(_attr)) {\n attr = _attr.slice();\n var nAttr = Math.min(attr.length, gd.data.length);\n if (traces) {\n nAttr = Math.min(nAttr, traces.length);\n }\n thisTraces = [];\n for (var j = 0; j < nAttr; j++) {\n thisTraces[j] = traces ? traces[j] : j;\n }\n } else {\n attr = _attr;\n thisTraces = traces ? traces.slice() : null;\n }\n if (thisTraces === null) {\n if (Array.isArray(attr)) {\n attr = attr[0];\n }\n } else if (Array.isArray(thisTraces)) {\n if (!Array.isArray(attr)) {\n var tmp = attr;\n attr = [];\n for (var i = 0; i < thisTraces.length; i++) {\n attr[i] = tmp;\n }\n }\n attr.length = Math.min(thisTraces.length, attr.length);\n }\n bindings.push({\n type: \"data\",\n prop: path,\n traces: thisTraces,\n value: attr\n });\n }, \"\", 0);\n return bindings;\n }\n function crawl(attrs, callback, path, depth) {\n Object.keys(attrs).forEach(function(attrName) {\n var attr = attrs[attrName];\n if (attrName[0] === \"_\") return;\n var thisPath = path + (depth > 0 ? \".\" : \"\") + attrName;\n if (Lib.isPlainObject(attr)) {\n crawl(attr, callback, thisPath, depth + 1);\n } else {\n callback(thisPath, attrName, attr);\n }\n });\n }\n }\n });\n\n // src/plots/plots.js\n var require_plots = __commonJS({\n \"src/plots/plots.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var timeFormatLocale = require_d3_time_format().timeFormatLocale;\n var formatLocale = require_d3_format().formatLocale;\n var isNumeric = require_fast_isnumeric();\n var b64encode = require_base64_arraybuffer_umd();\n var Registry = require_registry();\n var PlotSchema = require_plot_schema();\n var Template = require_plot_template();\n var Lib = require_lib();\n var Color2 = require_color();\n var BADNUM = require_numerical().BADNUM;\n var axisIDs = require_axis_ids();\n var clearOutline = require_handle_outline().clearOutline;\n var scatterAttrs = require_layout_attributes3();\n var animationAttrs = require_animation_attributes();\n var frameAttrs = require_frame_attributes();\n var getModuleCalcData = require_get_data().getModuleCalcData;\n var relinkPrivateKeys = Lib.relinkPrivateKeys;\n var _ = Lib._;\n var plots = module.exports = {};\n Lib.extendFlat(plots, Registry);\n plots.attributes = require_attributes2();\n plots.attributes.type.values = plots.allTypes;\n plots.fontAttrs = require_font_attributes();\n plots.layoutAttributes = require_layout_attributes2();\n var commandModule = require_command();\n plots.executeAPICommand = commandModule.executeAPICommand;\n plots.computeAPICommandBindings = commandModule.computeAPICommandBindings;\n plots.manageCommandObserver = commandModule.manageCommandObserver;\n plots.hasSimpleAPICommandBindings = commandModule.hasSimpleAPICommandBindings;\n plots.redrawText = function(gd) {\n gd = Lib.getGraphDiv(gd);\n return new Promise(function(resolve) {\n setTimeout(function() {\n if (!gd._fullLayout) return;\n Registry.getComponentMethod(\"annotations\", \"draw\")(gd);\n Registry.getComponentMethod(\"legend\", \"draw\")(gd);\n Registry.getComponentMethod(\"colorbar\", \"draw\")(gd);\n resolve(plots.previousPromises(gd));\n }, 300);\n });\n };\n plots.resize = function(gd) {\n gd = Lib.getGraphDiv(gd);\n var resolveLastResize;\n var p = new Promise(function(resolve, reject) {\n if (!gd || Lib.isHidden(gd)) {\n reject(new Error(\"Resize must be passed a displayed plot div element.\"));\n }\n if (gd._redrawTimer) clearTimeout(gd._redrawTimer);\n if (gd._resolveResize) resolveLastResize = gd._resolveResize;\n gd._resolveResize = resolve;\n gd._redrawTimer = setTimeout(function() {\n if (!gd.layout || gd.layout.width && gd.layout.height || Lib.isHidden(gd)) {\n resolve(gd);\n return;\n }\n delete gd.layout.width;\n delete gd.layout.height;\n var oldchanged = gd.changed;\n gd.autoplay = true;\n Registry.call(\"relayout\", gd, { autosize: true }).then(function() {\n gd.changed = oldchanged;\n if (gd._resolveResize === resolve) {\n delete gd._resolveResize;\n resolve(gd);\n }\n });\n }, 100);\n });\n if (resolveLastResize) resolveLastResize(p);\n return p;\n };\n plots.previousPromises = function(gd) {\n if ((gd._promises || []).length) {\n return Promise.all(gd._promises).then(function() {\n gd._promises = [];\n });\n }\n };\n plots.addLinks = function(gd) {\n if (!gd._context.showLink && !gd._context.showSources) return;\n var fullLayout = gd._fullLayout;\n var linkContainer = Lib.ensureSingle(fullLayout._paper, \"text\", \"js-plot-link-container\", function(s) {\n s.style({\n \"font-family\": '\"Open Sans\", Arial, sans-serif',\n \"font-size\": \"12px\",\n fill: Color2.defaultLine,\n \"pointer-events\": \"all\"\n }).each(function() {\n var links = d3.select(this);\n links.append(\"tspan\").classed(\"js-link-to-tool\", true);\n links.append(\"tspan\").classed(\"js-link-spacer\", true);\n links.append(\"tspan\").classed(\"js-sourcelinks\", true);\n });\n });\n var text = linkContainer.node();\n var attrs = { y: fullLayout._paper.attr(\"height\") - 9 };\n if (document.body.contains(text) && text.getComputedTextLength() >= fullLayout.width - 20) {\n attrs[\"text-anchor\"] = \"start\";\n attrs.x = 5;\n } else {\n attrs[\"text-anchor\"] = \"end\";\n attrs.x = fullLayout._paper.attr(\"width\") - 7;\n }\n linkContainer.attr(attrs);\n var toolspan = linkContainer.select(\".js-link-to-tool\");\n var spacespan = linkContainer.select(\".js-link-spacer\");\n var sourcespan = linkContainer.select(\".js-sourcelinks\");\n if (gd._context.showSources) gd._context.showSources(gd);\n if (gd._context.showLink) positionPlayWithData(gd, toolspan);\n spacespan.text(toolspan.text() && sourcespan.text() ? \" - \" : \"\");\n };\n function positionPlayWithData(gd, container) {\n container.text(\"\");\n var link = container.append(\"a\").attr({\n \"xlink:xlink:href\": \"#\",\n class: \"link--impt link--embedview\",\n \"font-weight\": \"bold\"\n }).text(gd._context.linkText + \" \" + String.fromCharCode(187));\n if (gd._context.sendData) {\n link.on(\"click\", function() {\n plots.sendDataToCloud(gd);\n });\n } else {\n var path = window.location.pathname.split(\"/\");\n var query = window.location.search;\n link.attr({\n \"xlink:xlink:show\": \"new\",\n \"xlink:xlink:href\": \"/\" + path[2].split(\".\")[0] + \"/\" + path[1] + query\n });\n }\n }\n plots.sendDataToCloud = function(gd) {\n var baseUrl = (window.PLOTLYENV || {}).BASE_URL || gd._context.plotlyServerURL;\n if (!baseUrl) return;\n gd.emit(\"plotly_beforeexport\");\n var hiddenformDiv = d3.select(gd).append(\"div\").attr(\"id\", \"hiddenform\").style(\"display\", \"none\");\n var hiddenform = hiddenformDiv.append(\"form\").attr({\n action: baseUrl + \"/external\",\n method: \"post\",\n target: \"_blank\"\n });\n var hiddenformInput = hiddenform.append(\"input\").attr({\n type: \"text\",\n name: \"data\"\n });\n hiddenformInput.node().value = plots.graphJson(gd, false, \"keepdata\");\n hiddenform.node().submit();\n hiddenformDiv.remove();\n gd.emit(\"plotly_afterexport\");\n return false;\n };\n var d3FormatKeys = [\n \"days\",\n \"shortDays\",\n \"months\",\n \"shortMonths\",\n \"periods\",\n \"dateTime\",\n \"date\",\n \"time\",\n \"decimal\",\n \"thousands\",\n \"grouping\",\n \"currency\"\n ];\n var extraFormatKeys = [\n \"year\",\n \"month\",\n \"dayMonth\",\n \"dayMonthYear\"\n ];\n plots.supplyDefaults = function(gd, opts) {\n var skipUpdateCalc = opts && opts.skipUpdateCalc;\n var oldFullLayout = gd._fullLayout || {};\n if (oldFullLayout._skipDefaults) {\n delete oldFullLayout._skipDefaults;\n return;\n }\n var newFullLayout = gd._fullLayout = {};\n var newLayout = gd.layout || {};\n var oldFullData = gd._fullData || [];\n var newFullData = gd._fullData = [];\n var newData = gd.data || [];\n var oldCalcdata = gd.calcdata || [];\n var context = gd._context || {};\n var i;\n if (!gd._transitionData) plots.createTransitionData(gd);\n newFullLayout._dfltTitle = {\n plot: _(gd, \"Click to enter Plot title\"),\n subtitle: _(gd, \"Click to enter Plot subtitle\"),\n x: _(gd, \"Click to enter X axis title\"),\n y: _(gd, \"Click to enter Y axis title\"),\n colorbar: _(gd, \"Click to enter Colorscale title\"),\n annotation: _(gd, \"new text\")\n };\n newFullLayout._traceWord = _(gd, \"trace\");\n var formatObj = getFormatObj(gd, d3FormatKeys);\n newFullLayout._mapboxAccessToken = context.mapboxAccessToken;\n if (oldFullLayout._initialAutoSizeIsDone) {\n var oldWidth = oldFullLayout.width;\n var oldHeight = oldFullLayout.height;\n plots.supplyLayoutGlobalDefaults(newLayout, newFullLayout, formatObj);\n if (!newLayout.width) newFullLayout.width = oldWidth;\n if (!newLayout.height) newFullLayout.height = oldHeight;\n plots.sanitizeMargins(newFullLayout);\n } else {\n plots.supplyLayoutGlobalDefaults(newLayout, newFullLayout, formatObj);\n var missingWidthOrHeight = !newLayout.width || !newLayout.height;\n var autosize = newFullLayout.autosize;\n var autosizable = context.autosizable;\n var initialAutoSize = missingWidthOrHeight && (autosize || autosizable);\n if (initialAutoSize) plots.plotAutoSize(gd, newLayout, newFullLayout);\n else if (missingWidthOrHeight) plots.sanitizeMargins(newFullLayout);\n if (!autosize && missingWidthOrHeight) {\n newLayout.width = newFullLayout.width;\n newLayout.height = newFullLayout.height;\n }\n }\n newFullLayout._d3locale = getFormatter(formatObj, newFullLayout.separators);\n newFullLayout._extraFormat = getFormatObj(gd, extraFormatKeys);\n newFullLayout._initialAutoSizeIsDone = true;\n newFullLayout._dataLength = newData.length;\n newFullLayout._modules = [];\n newFullLayout._visibleModules = [];\n newFullLayout._basePlotModules = [];\n var subplots = newFullLayout._subplots = emptySubplotLists();\n var splomAxes = newFullLayout._splomAxes = { x: {}, y: {} };\n var splomSubplots = newFullLayout._splomSubplots = {};\n newFullLayout._splomGridDflt = {};\n newFullLayout._scatterStackOpts = {};\n newFullLayout._firstScatter = {};\n newFullLayout._alignmentOpts = {};\n newFullLayout._colorAxes = {};\n newFullLayout._requestRangeslider = {};\n newFullLayout._traceUids = getTraceUids(oldFullData, newData);\n plots.supplyDataDefaults(newData, newFullData, newLayout, newFullLayout);\n var splomXa = Object.keys(splomAxes.x);\n var splomYa = Object.keys(splomAxes.y);\n if (splomXa.length > 1 && splomYa.length > 1) {\n Registry.getComponentMethod(\"grid\", \"sizeDefaults\")(newLayout, newFullLayout);\n for (i = 0; i < splomXa.length; i++) {\n Lib.pushUnique(subplots.xaxis, splomXa[i]);\n }\n for (i = 0; i < splomYa.length; i++) {\n Lib.pushUnique(subplots.yaxis, splomYa[i]);\n }\n for (var k in splomSubplots) {\n Lib.pushUnique(subplots.cartesian, k);\n }\n }\n newFullLayout._has = plots._hasPlotType.bind(newFullLayout);\n if (oldFullData.length === newFullData.length) {\n for (i = 0; i < newFullData.length; i++) {\n relinkPrivateKeys(newFullData[i], oldFullData[i]);\n }\n }\n plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData, gd._transitionData);\n var _modules = newFullLayout._visibleModules;\n var crossTraceDefaultsFuncs = [];\n for (i = 0; i < _modules.length; i++) {\n var funci = _modules[i].crossTraceDefaults;\n if (funci) Lib.pushUnique(crossTraceDefaultsFuncs, funci);\n }\n for (i = 0; i < crossTraceDefaultsFuncs.length; i++) {\n crossTraceDefaultsFuncs[i](newFullData, newFullLayout);\n }\n newFullLayout._hasOnlyLargeSploms = newFullLayout._basePlotModules.length === 1 && newFullLayout._basePlotModules[0].name === \"splom\" && splomXa.length > 15 && splomYa.length > 15 && newFullLayout.shapes.length === 0 && newFullLayout.images.length === 0;\n plots.linkSubplots(newFullData, newFullLayout, oldFullData, oldFullLayout);\n plots.cleanPlot(newFullData, newFullLayout, oldFullData, oldFullLayout);\n var hadCartesian = !!(oldFullLayout._has && oldFullLayout._has(\"cartesian\"));\n var hasCartesian = !!(newFullLayout._has && newFullLayout._has(\"cartesian\"));\n var hadBgLayer = hadCartesian;\n var hasBgLayer = hasCartesian;\n if (hadBgLayer && !hasBgLayer) {\n oldFullLayout._bgLayer.remove();\n } else if (hasBgLayer && !hadBgLayer) {\n newFullLayout._shouldCreateBgLayer = true;\n }\n if (oldFullLayout._zoomlayer && !gd._dragging) {\n clearOutline({\n // mock old gd\n _fullLayout: oldFullLayout\n });\n }\n fillMetaTextHelpers(newFullData, newFullLayout);\n relinkPrivateKeys(newFullLayout, oldFullLayout);\n Registry.getComponentMethod(\"colorscale\", \"crossTraceDefaults\")(newFullData, newFullLayout);\n if (!newFullLayout._preGUI) newFullLayout._preGUI = {};\n if (!newFullLayout._tracePreGUI) newFullLayout._tracePreGUI = {};\n var tracePreGUI = newFullLayout._tracePreGUI;\n var uids = {};\n var uid;\n for (uid in tracePreGUI) uids[uid] = \"old\";\n for (i = 0; i < newFullData.length; i++) {\n uid = newFullData[i]._fullInput.uid;\n if (!uids[uid]) tracePreGUI[uid] = {};\n uids[uid] = \"new\";\n }\n for (uid in uids) {\n if (uids[uid] === \"old\") delete tracePreGUI[uid];\n }\n initMargins(newFullLayout);\n Registry.getComponentMethod(\"rangeslider\", \"makeData\")(newFullLayout);\n if (!skipUpdateCalc && oldCalcdata.length === newFullData.length) {\n plots.supplyDefaultsUpdateCalc(oldCalcdata, newFullData);\n }\n };\n plots.supplyDefaultsUpdateCalc = function(oldCalcdata, newFullData) {\n for (var i = 0; i < newFullData.length; i++) {\n var newTrace = newFullData[i];\n var cd0 = (oldCalcdata[i] || [])[0];\n if (cd0 && cd0.trace) {\n var oldTrace = cd0.trace;\n if (oldTrace._hasCalcTransform) {\n var arrayAttrs = oldTrace._arrayAttrs;\n var j, astr, oldArrayVal;\n for (j = 0; j < arrayAttrs.length; j++) {\n astr = arrayAttrs[j];\n oldArrayVal = Lib.nestedProperty(oldTrace, astr).get().slice();\n Lib.nestedProperty(newTrace, astr).set(oldArrayVal);\n }\n }\n cd0.trace = newTrace;\n }\n }\n };\n function getTraceUids(oldFullData, newData) {\n var len = newData.length;\n var oldFullInput = [];\n var i, prevFullInput;\n for (i = 0; i < oldFullData.length; i++) {\n var thisFullInput = oldFullData[i]._fullInput;\n if (thisFullInput !== prevFullInput) oldFullInput.push(thisFullInput);\n prevFullInput = thisFullInput;\n }\n var oldLen = oldFullInput.length;\n var out = new Array(len);\n var seenUids = {};\n function setUid(uid, i2) {\n out[i2] = uid;\n seenUids[uid] = 1;\n }\n function tryUid(uid, i2) {\n if (uid && typeof uid === \"string\" && !seenUids[uid]) {\n setUid(uid, i2);\n return true;\n }\n }\n for (i = 0; i < len; i++) {\n var newUid = newData[i].uid;\n if (typeof newUid === \"number\") newUid = String(newUid);\n if (tryUid(newUid, i)) continue;\n if (i < oldLen && tryUid(oldFullInput[i].uid, i)) continue;\n setUid(Lib.randstr(seenUids), i);\n }\n return out;\n }\n function emptySubplotLists() {\n var collectableSubplotTypes = Registry.collectableSubplotTypes;\n var out = {};\n var i, j;\n if (!collectableSubplotTypes) {\n collectableSubplotTypes = [];\n var subplotsRegistry = Registry.subplotsRegistry;\n for (var subplotType in subplotsRegistry) {\n var subplotModule = subplotsRegistry[subplotType];\n var subplotAttr = subplotModule.attr;\n if (subplotAttr) {\n collectableSubplotTypes.push(subplotType);\n if (Array.isArray(subplotAttr)) {\n for (j = 0; j < subplotAttr.length; j++) {\n Lib.pushUnique(collectableSubplotTypes, subplotAttr[j]);\n }\n }\n }\n }\n }\n for (i = 0; i < collectableSubplotTypes.length; i++) {\n out[collectableSubplotTypes[i]] = [];\n }\n return out;\n }\n function getFormatObj(gd, formatKeys) {\n var locale = gd._context.locale;\n if (!locale) locale = \"en-US\";\n var formatDone = false;\n var formatObj = {};\n function includeFormat(newFormat) {\n var formatFinished = true;\n for (var i2 = 0; i2 < formatKeys.length; i2++) {\n var formatKey = formatKeys[i2];\n if (!formatObj[formatKey]) {\n if (newFormat[formatKey]) {\n formatObj[formatKey] = newFormat[formatKey];\n } else formatFinished = false;\n }\n }\n if (formatFinished) formatDone = true;\n }\n for (var i = 0; i < 2; i++) {\n var locales = gd._context.locales;\n for (var j = 0; j < 2; j++) {\n var formatj = (locales[locale] || {}).format;\n if (formatj) {\n includeFormat(formatj);\n if (formatDone) break;\n }\n locales = Registry.localeRegistry;\n }\n var baseLocale = locale.split(\"-\")[0];\n if (formatDone || baseLocale === locale) break;\n locale = baseLocale;\n }\n if (!formatDone) includeFormat(Registry.localeRegistry.en.format);\n return formatObj;\n }\n function getFormatter(formatObj, separators) {\n formatObj.decimal = separators.charAt(0);\n formatObj.thousands = separators.charAt(1);\n return {\n numberFormat: function(formatStr) {\n try {\n formatStr = formatLocale(formatObj).format(\n Lib.adjustFormat(formatStr)\n );\n } catch (e) {\n Lib.warnBadFormat(formatStr);\n return Lib.noFormat;\n }\n return formatStr;\n },\n timeFormat: timeFormatLocale(formatObj).utcFormat\n };\n }\n function fillMetaTextHelpers(newFullData, newFullLayout) {\n var _meta;\n var meta4data = [];\n if (newFullLayout.meta) {\n _meta = newFullLayout._meta = {\n meta: newFullLayout.meta,\n layout: { meta: newFullLayout.meta }\n };\n }\n for (var i = 0; i < newFullData.length; i++) {\n var trace = newFullData[i];\n if (trace.meta) {\n meta4data[trace.index] = trace._meta = { meta: trace.meta };\n } else if (newFullLayout.meta) {\n trace._meta = { meta: newFullLayout.meta };\n }\n if (newFullLayout.meta) {\n trace._meta.layout = { meta: newFullLayout.meta };\n }\n }\n if (meta4data.length) {\n if (!_meta) {\n _meta = newFullLayout._meta = {};\n }\n _meta.data = meta4data;\n }\n }\n plots.createTransitionData = function(gd) {\n if (!gd._transitionData) {\n gd._transitionData = {};\n }\n if (!gd._transitionData._frames) {\n gd._transitionData._frames = [];\n }\n if (!gd._transitionData._frameHash) {\n gd._transitionData._frameHash = {};\n }\n if (!gd._transitionData._counter) {\n gd._transitionData._counter = 0;\n }\n if (!gd._transitionData._interruptCallbacks) {\n gd._transitionData._interruptCallbacks = [];\n }\n };\n plots._hasPlotType = function(category) {\n var i;\n var basePlotModules = this._basePlotModules || [];\n for (i = 0; i < basePlotModules.length; i++) {\n if (basePlotModules[i].name === category) return true;\n }\n var modules = this._modules || [];\n for (i = 0; i < modules.length; i++) {\n var name2 = modules[i].name;\n if (name2 === category) return true;\n var _module = Registry.modules[name2];\n if (_module && _module.categories[category]) return true;\n }\n return false;\n };\n plots.cleanPlot = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var i, j;\n var basePlotModules = oldFullLayout._basePlotModules || [];\n for (i = 0; i < basePlotModules.length; i++) {\n var _module = basePlotModules[i];\n if (_module.clean) {\n _module.clean(newFullData, newFullLayout, oldFullData, oldFullLayout);\n }\n }\n var hadGl = oldFullLayout._has && oldFullLayout._has(\"gl\");\n var hasGl = newFullLayout._has && newFullLayout._has(\"gl\");\n if (hadGl && !hasGl) {\n if (oldFullLayout._glcontainer !== void 0) {\n oldFullLayout._glcontainer.selectAll(\".gl-canvas\").remove();\n oldFullLayout._glcontainer.selectAll(\".no-webgl\").remove();\n oldFullLayout._glcanvas = null;\n }\n }\n var hasInfoLayer = !!oldFullLayout._infolayer;\n oldLoop:\n for (i = 0; i < oldFullData.length; i++) {\n var oldTrace = oldFullData[i];\n var oldUid = oldTrace.uid;\n for (j = 0; j < newFullData.length; j++) {\n var newTrace = newFullData[j];\n if (oldUid === newTrace.uid) continue oldLoop;\n }\n if (hasInfoLayer) {\n oldFullLayout._infolayer.select(\".cb\" + oldUid).remove();\n }\n }\n };\n plots.linkSubplots = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var i, j;\n var oldSubplots = oldFullLayout._plots || {};\n var newSubplots = newFullLayout._plots = {};\n var newSubplotList = newFullLayout._subplots;\n var mockGd = {\n _fullData: newFullData,\n _fullLayout: newFullLayout\n };\n var ids = newSubplotList.cartesian || [];\n for (i = 0; i < ids.length; i++) {\n var id = ids[i];\n var oldSubplot = oldSubplots[id];\n var xaxis = axisIDs.getFromId(mockGd, id, \"x\");\n var yaxis = axisIDs.getFromId(mockGd, id, \"y\");\n var plotinfo;\n if (oldSubplot) {\n plotinfo = newSubplots[id] = oldSubplot;\n } else {\n plotinfo = newSubplots[id] = {};\n plotinfo.id = id;\n }\n xaxis._counterAxes.push(yaxis._id);\n yaxis._counterAxes.push(xaxis._id);\n xaxis._subplotsWith.push(id);\n yaxis._subplotsWith.push(id);\n plotinfo.xaxis = xaxis;\n plotinfo.yaxis = yaxis;\n plotinfo._hasClipOnAxisFalse = false;\n for (j = 0; j < newFullData.length; j++) {\n var trace = newFullData[j];\n if (trace.xaxis === plotinfo.xaxis._id && trace.yaxis === plotinfo.yaxis._id && trace.cliponaxis === false) {\n plotinfo._hasClipOnAxisFalse = true;\n break;\n }\n }\n }\n var axList = axisIDs.list(mockGd, null, true);\n var ax;\n for (i = 0; i < axList.length; i++) {\n ax = axList[i];\n var mainAx = null;\n if (ax.overlaying) {\n mainAx = axisIDs.getFromId(mockGd, ax.overlaying);\n if (mainAx && mainAx.overlaying) {\n ax.overlaying = false;\n mainAx = null;\n }\n }\n ax._mainAxis = mainAx || ax;\n if (mainAx) ax.domain = mainAx.domain.slice();\n ax._anchorAxis = ax.anchor === \"free\" ? null : axisIDs.getFromId(mockGd, ax.anchor);\n }\n for (i = 0; i < axList.length; i++) {\n ax = axList[i];\n ax._counterAxes.sort(axisIDs.idSort);\n ax._subplotsWith.sort(Lib.subplotSort);\n ax._mainSubplot = findMainSubplot(ax, newFullLayout);\n if (ax._counterAxes.length && (ax.spikemode && ax.spikemode.indexOf(\"across\") !== -1 || ax.automargin && ax.mirror && ax.anchor !== \"free\" || Registry.getComponentMethod(\"rangeslider\", \"isVisible\")(ax))) {\n var min = 1;\n var max = 0;\n for (j = 0; j < ax._counterAxes.length; j++) {\n var ax2 = axisIDs.getFromId(mockGd, ax._counterAxes[j]);\n min = Math.min(min, ax2.domain[0]);\n max = Math.max(max, ax2.domain[1]);\n }\n if (min < max) {\n ax._counterDomainMin = min;\n ax._counterDomainMax = max;\n }\n }\n }\n };\n function findMainSubplot(ax, fullLayout) {\n var mockGd = { _fullLayout: fullLayout };\n var isX = ax._id.charAt(0) === \"x\";\n var anchorAx = ax._mainAxis._anchorAxis;\n var mainSubplotID = \"\";\n var nextBestMainSubplotID = \"\";\n var anchorID = \"\";\n if (anchorAx) {\n anchorID = anchorAx._mainAxis._id;\n mainSubplotID = isX ? ax._id + anchorID : anchorID + ax._id;\n }\n if (!mainSubplotID || !fullLayout._plots[mainSubplotID]) {\n mainSubplotID = \"\";\n var counterIDs = ax._counterAxes;\n for (var j = 0; j < counterIDs.length; j++) {\n var counterPart = counterIDs[j];\n var id = isX ? ax._id + counterPart : counterPart + ax._id;\n if (!nextBestMainSubplotID) nextBestMainSubplotID = id;\n var counterAx = axisIDs.getFromId(mockGd, counterPart);\n if (anchorID && counterAx.overlaying === anchorID) {\n mainSubplotID = id;\n break;\n }\n }\n }\n return mainSubplotID || nextBestMainSubplotID;\n }\n plots.clearExpandedTraceDefaultColors = function(trace) {\n var colorAttrs, path, i;\n function locateColorAttrs(attr, attrName, attrs, level) {\n path[level] = attrName;\n path.length = level + 1;\n if (attr.valType === \"color\" && attr.dflt === void 0) {\n colorAttrs.push(path.join(\".\"));\n }\n }\n path = [];\n colorAttrs = trace._module._colorAttrs;\n if (!colorAttrs) {\n trace._module._colorAttrs = colorAttrs = [];\n PlotSchema.crawl(\n trace._module.attributes,\n locateColorAttrs\n );\n }\n for (i = 0; i < colorAttrs.length; i++) {\n var origprop = Lib.nestedProperty(trace, \"_input.\" + colorAttrs[i]);\n if (!origprop.get()) {\n Lib.nestedProperty(trace, colorAttrs[i]).set(null);\n }\n }\n };\n plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) {\n var modules = fullLayout._modules;\n var visibleModules = fullLayout._visibleModules;\n var basePlotModules = fullLayout._basePlotModules;\n var cnt = 0;\n var colorCnt = 0;\n var i, fullTrace, trace;\n fullLayout._transformModules = [];\n function pushModule(fullTrace2) {\n dataOut.push(fullTrace2);\n var _module = fullTrace2._module;\n if (!_module) return;\n Lib.pushUnique(modules, _module);\n if (fullTrace2.visible === true) Lib.pushUnique(visibleModules, _module);\n Lib.pushUnique(basePlotModules, fullTrace2._module.basePlotModule);\n cnt++;\n if (fullTrace2._input.visible !== false) colorCnt++;\n }\n var carpetIndex = {};\n var carpetDependents = [];\n var dataTemplate = (layout.template || {}).data || {};\n var templater = Template.traceTemplater(dataTemplate);\n for (i = 0; i < dataIn.length; i++) {\n trace = dataIn[i];\n fullTrace = templater.newTrace(trace);\n fullTrace.uid = fullLayout._traceUids[i];\n plots.supplyTraceDefaults(trace, fullTrace, colorCnt, fullLayout, i);\n fullTrace.index = i;\n fullTrace._input = trace;\n fullTrace._fullInput = fullTrace;\n pushModule(fullTrace);\n if (Registry.traceIs(fullTrace, \"carpetAxis\")) {\n carpetIndex[fullTrace.carpet] = fullTrace;\n }\n if (Registry.traceIs(fullTrace, \"carpetDependent\")) {\n carpetDependents.push(i);\n }\n }\n for (i = 0; i < carpetDependents.length; i++) {\n fullTrace = dataOut[carpetDependents[i]];\n if (!fullTrace.visible) continue;\n var carpetAxis = carpetIndex[fullTrace.carpet];\n fullTrace._carpet = carpetAxis;\n if (!carpetAxis || !carpetAxis.visible) {\n fullTrace.visible = false;\n continue;\n }\n fullTrace.xaxis = carpetAxis.xaxis;\n fullTrace.yaxis = carpetAxis.yaxis;\n }\n };\n plots.supplyAnimationDefaults = function(opts) {\n opts = opts || {};\n var i;\n var optsOut = {};\n function coerce(attr, dflt) {\n return Lib.coerce(opts || {}, optsOut, animationAttrs, attr, dflt);\n }\n coerce(\"mode\");\n coerce(\"direction\");\n coerce(\"fromcurrent\");\n if (Array.isArray(opts.frame)) {\n optsOut.frame = [];\n for (i = 0; i < opts.frame.length; i++) {\n optsOut.frame[i] = plots.supplyAnimationFrameDefaults(opts.frame[i] || {});\n }\n } else {\n optsOut.frame = plots.supplyAnimationFrameDefaults(opts.frame || {});\n }\n if (Array.isArray(opts.transition)) {\n optsOut.transition = [];\n for (i = 0; i < opts.transition.length; i++) {\n optsOut.transition[i] = plots.supplyAnimationTransitionDefaults(opts.transition[i] || {});\n }\n } else {\n optsOut.transition = plots.supplyAnimationTransitionDefaults(opts.transition || {});\n }\n return optsOut;\n };\n plots.supplyAnimationFrameDefaults = function(opts) {\n var optsOut = {};\n function coerce(attr, dflt) {\n return Lib.coerce(opts || {}, optsOut, animationAttrs.frame, attr, dflt);\n }\n coerce(\"duration\");\n coerce(\"redraw\");\n return optsOut;\n };\n plots.supplyAnimationTransitionDefaults = function(opts) {\n var optsOut = {};\n function coerce(attr, dflt) {\n return Lib.coerce(opts || {}, optsOut, animationAttrs.transition, attr, dflt);\n }\n coerce(\"duration\");\n coerce(\"easing\");\n return optsOut;\n };\n plots.supplyFrameDefaults = function(frameIn) {\n var frameOut = {};\n function coerce(attr, dflt) {\n return Lib.coerce(frameIn, frameOut, frameAttrs, attr, dflt);\n }\n coerce(\"group\");\n coerce(\"name\");\n coerce(\"traces\");\n coerce(\"baseframe\");\n coerce(\"data\");\n coerce(\"layout\");\n return frameOut;\n };\n plots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, traceInIndex) {\n var colorway = layout.colorway || Color2.defaults;\n var defaultColor = colorway[colorIndex % colorway.length];\n var i;\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, plots.attributes, attr, dflt);\n }\n var visible = coerce(\"visible\");\n coerce(\"type\");\n coerce(\"name\", layout._traceWord + \" \" + traceInIndex);\n coerce(\"uirevision\", layout.uirevision);\n var _module = plots.getModule(traceOut);\n traceOut._module = _module;\n if (_module) {\n var basePlotModule = _module.basePlotModule;\n var subplotAttr = basePlotModule.attr;\n var subplotAttrs = basePlotModule.attributes;\n if (subplotAttr && subplotAttrs) {\n var subplots = layout._subplots;\n var subplotId = \"\";\n if (Array.isArray(subplotAttr)) {\n for (i = 0; i < subplotAttr.length; i++) {\n var attri = subplotAttr[i];\n var vali = Lib.coerce(traceIn, traceOut, subplotAttrs, attri);\n if (subplots[attri]) Lib.pushUnique(subplots[attri], vali);\n subplotId += vali;\n }\n } else {\n subplotId = Lib.coerce(traceIn, traceOut, subplotAttrs, subplotAttr);\n }\n if (subplots[basePlotModule.name]) {\n Lib.pushUnique(subplots[basePlotModule.name], subplotId);\n }\n }\n }\n if (visible) {\n coerce(\"customdata\");\n coerce(\"ids\");\n coerce(\"meta\");\n if (Registry.traceIs(traceOut, \"showLegend\")) {\n Lib.coerce(\n traceIn,\n traceOut,\n _module.attributes.showlegend ? _module.attributes : plots.attributes,\n \"showlegend\"\n );\n coerce(\"legend\");\n coerce(\"legendwidth\");\n coerce(\"legendgroup\");\n coerce(\"legendgrouptitle.text\");\n coerce(\"legendrank\");\n traceOut._dfltShowLegend = true;\n } else {\n traceOut._dfltShowLegend = false;\n }\n if (_module) {\n _module.supplyDefaults(traceIn, traceOut, defaultColor, layout);\n }\n if (!Registry.traceIs(traceOut, \"noOpacity\")) {\n coerce(\"opacity\");\n }\n if (Registry.traceIs(traceOut, \"notLegendIsolatable\")) {\n traceOut.visible = !!traceOut.visible;\n }\n if (!Registry.traceIs(traceOut, \"noHover\")) {\n if (!traceOut.hovertemplate) Lib.coerceHoverinfo(traceIn, traceOut, layout);\n if (traceOut.type !== \"parcats\") {\n Registry.getComponentMethod(\"fx\", \"supplyDefaults\")(traceIn, traceOut, defaultColor, layout);\n }\n }\n if (_module && _module.selectPoints) {\n var selectedpoints = coerce(\"selectedpoints\");\n if (Lib.isTypedArray(selectedpoints)) {\n traceOut.selectedpoints = Array.from(selectedpoints);\n }\n }\n }\n return traceOut;\n };\n plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) {\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, plots.layoutAttributes, attr, dflt);\n }\n var template = layoutIn.template;\n if (Lib.isPlainObject(template)) {\n layoutOut.template = template;\n layoutOut._template = template.layout;\n layoutOut._dataTemplate = template.data;\n }\n coerce(\"autotypenumbers\");\n var font = Lib.coerceFont(coerce, \"font\");\n var fontSize = font.size;\n Lib.coerceFont(coerce, \"title.font\", font, { overrideDflt: {\n size: Math.round(fontSize * 1.4)\n } });\n coerce(\"title.text\", layoutOut._dfltTitle.plot);\n coerce(\"title.xref\");\n var titleYref = coerce(\"title.yref\");\n coerce(\"title.pad.t\");\n coerce(\"title.pad.r\");\n coerce(\"title.pad.b\");\n coerce(\"title.pad.l\");\n var titleAutomargin = coerce(\"title.automargin\");\n coerce(\"title.x\");\n coerce(\"title.xanchor\");\n coerce(\"title.y\");\n coerce(\"title.yanchor\");\n coerce(\"title.subtitle.text\", layoutOut._dfltTitle.subtitle);\n Lib.coerceFont(coerce, \"title.subtitle.font\", font, {\n overrideDflt: {\n size: Math.round(layoutOut.title.font.size * 0.7)\n }\n });\n if (titleAutomargin) {\n if (titleYref === \"paper\") {\n if (layoutOut.title.y !== 0) layoutOut.title.y = 1;\n if (layoutOut.title.yanchor === \"auto\") {\n layoutOut.title.yanchor = layoutOut.title.y === 0 ? \"top\" : \"bottom\";\n }\n }\n if (titleYref === \"container\") {\n if (layoutOut.title.y === \"auto\") layoutOut.title.y = 1;\n if (layoutOut.title.yanchor === \"auto\") {\n layoutOut.title.yanchor = layoutOut.title.y < 0.5 ? \"bottom\" : \"top\";\n }\n }\n }\n var uniformtextMode = coerce(\"uniformtext.mode\");\n if (uniformtextMode) {\n coerce(\"uniformtext.minsize\");\n }\n coerce(\"autosize\", !(layoutIn.width && layoutIn.height));\n coerce(\"width\");\n coerce(\"height\");\n coerce(\"minreducedwidth\");\n coerce(\"minreducedheight\");\n coerce(\"margin.l\");\n coerce(\"margin.r\");\n coerce(\"margin.t\");\n coerce(\"margin.b\");\n coerce(\"margin.pad\");\n coerce(\"margin.autoexpand\");\n if (layoutIn.width && layoutIn.height) plots.sanitizeMargins(layoutOut);\n Registry.getComponentMethod(\"grid\", \"sizeDefaults\")(layoutIn, layoutOut);\n coerce(\"paper_bgcolor\");\n coerce(\"separators\", formatObj.decimal + formatObj.thousands);\n coerce(\"hidesources\");\n coerce(\"colorway\");\n coerce(\"datarevision\");\n var uirevision = coerce(\"uirevision\");\n coerce(\"editrevision\", uirevision);\n coerce(\"selectionrevision\", uirevision);\n Registry.getComponentMethod(\n \"modebar\",\n \"supplyLayoutDefaults\"\n )(layoutIn, layoutOut);\n Registry.getComponentMethod(\n \"shapes\",\n \"supplyDrawNewShapeDefaults\"\n )(layoutIn, layoutOut, coerce);\n Registry.getComponentMethod(\n \"selections\",\n \"supplyDrawNewSelectionDefaults\"\n )(layoutIn, layoutOut, coerce);\n coerce(\"meta\");\n if (Lib.isPlainObject(layoutIn.transition)) {\n coerce(\"transition.duration\");\n coerce(\"transition.easing\");\n coerce(\"transition.ordering\");\n }\n Registry.getComponentMethod(\n \"calendars\",\n \"handleDefaults\"\n )(layoutIn, layoutOut, \"calendar\");\n Registry.getComponentMethod(\n \"fx\",\n \"supplyLayoutGlobalDefaults\"\n )(layoutIn, layoutOut, coerce);\n Lib.coerce(layoutIn, layoutOut, scatterAttrs, \"scattermode\");\n };\n function getComputedSize(attr) {\n return typeof attr === \"string\" && attr.substr(attr.length - 2) === \"px\" && parseFloat(attr);\n }\n plots.plotAutoSize = function plotAutoSize(gd, layout, fullLayout) {\n var context = gd._context || {};\n var frameMargins = context.frameMargins;\n var newWidth;\n var newHeight;\n var isPlotDiv = Lib.isPlotDiv(gd);\n if (isPlotDiv) gd.emit(\"plotly_autosize\");\n if (context.fillFrame) {\n newWidth = window.innerWidth;\n newHeight = window.innerHeight;\n document.body.style.overflow = \"hidden\";\n } else {\n var computedStyle = isPlotDiv ? window.getComputedStyle(gd) : {};\n newWidth = getComputedSize(computedStyle.width) || getComputedSize(computedStyle.maxWidth) || fullLayout.width;\n newHeight = getComputedSize(computedStyle.height) || getComputedSize(computedStyle.maxHeight) || fullLayout.height;\n if (isNumeric(frameMargins) && frameMargins > 0) {\n var factor = 1 - 2 * frameMargins;\n newWidth = Math.round(factor * newWidth);\n newHeight = Math.round(factor * newHeight);\n }\n }\n var minWidth = plots.layoutAttributes.width.min;\n var minHeight = plots.layoutAttributes.height.min;\n if (newWidth < minWidth) newWidth = minWidth;\n if (newHeight < minHeight) newHeight = minHeight;\n var widthHasChanged = !layout.width && Math.abs(fullLayout.width - newWidth) > 1;\n var heightHasChanged = !layout.height && Math.abs(fullLayout.height - newHeight) > 1;\n if (heightHasChanged || widthHasChanged) {\n if (widthHasChanged) fullLayout.width = newWidth;\n if (heightHasChanged) fullLayout.height = newHeight;\n }\n if (!gd._initialAutoSize) {\n gd._initialAutoSize = { width: newWidth, height: newHeight };\n }\n plots.sanitizeMargins(fullLayout);\n };\n plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData, transitionData) {\n var componentsRegistry = Registry.componentsRegistry;\n var basePlotModules = layoutOut._basePlotModules;\n var component, i, _module;\n var Cartesian = Registry.subplotsRegistry.cartesian;\n for (component in componentsRegistry) {\n _module = componentsRegistry[component];\n if (_module.includeBasePlot) {\n _module.includeBasePlot(layoutIn, layoutOut);\n }\n }\n if (!basePlotModules.length) {\n basePlotModules.push(Cartesian);\n }\n if (layoutOut._has(\"cartesian\")) {\n Registry.getComponentMethod(\"grid\", \"contentDefaults\")(layoutIn, layoutOut);\n Cartesian.finalizeSubplots(layoutIn, layoutOut);\n }\n for (var subplotType in layoutOut._subplots) {\n layoutOut._subplots[subplotType].sort(Lib.subplotSort);\n }\n for (i = 0; i < basePlotModules.length; i++) {\n _module = basePlotModules[i];\n if (_module.supplyLayoutDefaults) {\n _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData);\n }\n }\n var modules = layoutOut._modules;\n for (i = 0; i < modules.length; i++) {\n _module = modules[i];\n if (_module.supplyLayoutDefaults) {\n _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData);\n }\n }\n var transformModules = layoutOut._transformModules;\n for (i = 0; i < transformModules.length; i++) {\n _module = transformModules[i];\n if (_module.supplyLayoutDefaults) {\n _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData, transitionData);\n }\n }\n for (component in componentsRegistry) {\n _module = componentsRegistry[component];\n if (_module.supplyLayoutDefaults) {\n _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData);\n }\n }\n };\n plots.purge = function(gd) {\n var fullLayout = gd._fullLayout || {};\n if (fullLayout._glcontainer !== void 0) {\n fullLayout._glcontainer.selectAll(\".gl-canvas\").remove();\n fullLayout._glcontainer.remove();\n fullLayout._glcanvas = null;\n }\n if (fullLayout._modeBar) fullLayout._modeBar.destroy();\n if (gd._transitionData) {\n if (gd._transitionData._interruptCallbacks) {\n gd._transitionData._interruptCallbacks.length = 0;\n }\n if (gd._transitionData._animationRaf) {\n window.cancelAnimationFrame(gd._transitionData._animationRaf);\n }\n }\n Lib.clearThrottle();\n Lib.clearResponsive(gd);\n delete gd.data;\n delete gd.layout;\n delete gd._fullData;\n delete gd._fullLayout;\n delete gd.calcdata;\n delete gd.empty;\n delete gd.fid;\n delete gd.undoqueue;\n delete gd.undonum;\n delete gd.autoplay;\n delete gd.changed;\n delete gd._promises;\n delete gd._redrawTimer;\n delete gd._hmlumcount;\n delete gd._hmpixcount;\n delete gd._transitionData;\n delete gd._transitioning;\n delete gd._initialAutoSize;\n delete gd._transitioningWithDuration;\n delete gd._dragging;\n delete gd._dragged;\n delete gd._dragdata;\n delete gd._hoverdata;\n delete gd._snapshotInProgress;\n delete gd._editing;\n delete gd._mouseDownTime;\n delete gd._legendMouseDownTime;\n if (gd.removeAllListeners) gd.removeAllListeners();\n };\n plots.style = function(gd) {\n var _modules = gd._fullLayout._visibleModules;\n var styleModules = [];\n var i;\n for (i = 0; i < _modules.length; i++) {\n var _module = _modules[i];\n if (_module.style) {\n Lib.pushUnique(styleModules, _module.style);\n }\n }\n for (i = 0; i < styleModules.length; i++) {\n styleModules[i](gd);\n }\n };\n plots.sanitizeMargins = function(fullLayout) {\n if (!fullLayout || !fullLayout.margin) return;\n var width = fullLayout.width;\n var height = fullLayout.height;\n var margin = fullLayout.margin;\n var plotWidth = width - (margin.l + margin.r);\n var plotHeight = height - (margin.t + margin.b);\n var correction;\n if (plotWidth < 0) {\n correction = (width - 1) / (margin.l + margin.r);\n margin.l = Math.floor(correction * margin.l);\n margin.r = Math.floor(correction * margin.r);\n }\n if (plotHeight < 0) {\n correction = (height - 1) / (margin.t + margin.b);\n margin.t = Math.floor(correction * margin.t);\n margin.b = Math.floor(correction * margin.b);\n }\n };\n plots.clearAutoMarginIds = function(gd) {\n gd._fullLayout._pushmarginIds = {};\n };\n plots.allowAutoMargin = function(gd, id) {\n gd._fullLayout._pushmarginIds[id] = 1;\n };\n function initMargins(fullLayout) {\n var margin = fullLayout.margin;\n if (!fullLayout._size) {\n var gs = fullLayout._size = {\n l: Math.round(margin.l),\n r: Math.round(margin.r),\n t: Math.round(margin.t),\n b: Math.round(margin.b),\n p: Math.round(margin.pad)\n };\n gs.w = Math.round(fullLayout.width) - gs.l - gs.r;\n gs.h = Math.round(fullLayout.height) - gs.t - gs.b;\n }\n if (!fullLayout._pushmargin) fullLayout._pushmargin = {};\n if (!fullLayout._pushmarginIds) fullLayout._pushmarginIds = {};\n if (!fullLayout._reservedMargin) fullLayout._reservedMargin = {};\n }\n var MIN_SPECIFIED_WIDTH = 2;\n var MIN_SPECIFIED_HEIGHT = 2;\n plots.autoMargin = function(gd, id, o) {\n var fullLayout = gd._fullLayout;\n var width = fullLayout.width;\n var height = fullLayout.height;\n var margin = fullLayout.margin;\n var minreducedwidth = fullLayout.minreducedwidth;\n var minreducedheight = fullLayout.minreducedheight;\n var minFinalWidth = Lib.constrain(\n width - margin.l - margin.r,\n MIN_SPECIFIED_WIDTH,\n minreducedwidth\n );\n var minFinalHeight = Lib.constrain(\n height - margin.t - margin.b,\n MIN_SPECIFIED_HEIGHT,\n minreducedheight\n );\n var maxSpaceW = Math.max(0, width - minFinalWidth);\n var maxSpaceH = Math.max(0, height - minFinalHeight);\n var pushMargin = fullLayout._pushmargin;\n var pushMarginIds = fullLayout._pushmarginIds;\n if (margin.autoexpand !== false) {\n if (!o) {\n delete pushMargin[id];\n delete pushMarginIds[id];\n } else {\n var pad = o.pad;\n if (pad === void 0) {\n pad = Math.min(12, margin.l, margin.r, margin.t, margin.b);\n }\n if (maxSpaceW) {\n var rW = (o.l + o.r) / maxSpaceW;\n if (rW > 1) {\n o.l /= rW;\n o.r /= rW;\n }\n }\n if (maxSpaceH) {\n var rH = (o.t + o.b) / maxSpaceH;\n if (rH > 1) {\n o.t /= rH;\n o.b /= rH;\n }\n }\n var xl = o.xl !== void 0 ? o.xl : o.x;\n var xr = o.xr !== void 0 ? o.xr : o.x;\n var yt = o.yt !== void 0 ? o.yt : o.y;\n var yb = o.yb !== void 0 ? o.yb : o.y;\n pushMargin[id] = {\n l: { val: xl, size: o.l + pad },\n r: { val: xr, size: o.r + pad },\n b: { val: yb, size: o.b + pad },\n t: { val: yt, size: o.t + pad }\n };\n pushMarginIds[id] = 1;\n }\n if (!fullLayout._replotting) {\n return plots.doAutoMargin(gd);\n }\n }\n };\n function needsRedrawForShift(gd) {\n if (\"_redrawFromAutoMarginCount\" in gd._fullLayout) {\n return false;\n }\n var axList = axisIDs.list(gd, \"\", true);\n for (var ax in axList) {\n if (axList[ax].autoshift || axList[ax].shift) return true;\n }\n return false;\n }\n plots.doAutoMargin = function(gd) {\n var fullLayout = gd._fullLayout;\n var width = fullLayout.width;\n var height = fullLayout.height;\n if (!fullLayout._size) fullLayout._size = {};\n initMargins(fullLayout);\n var gs = fullLayout._size;\n var margin = fullLayout.margin;\n var reservedMargins = { t: 0, b: 0, l: 0, r: 0 };\n var oldMargins = Lib.extendFlat({}, gs);\n var ml = margin.l;\n var mr = margin.r;\n var mt = margin.t;\n var mb = margin.b;\n var pushMargin = fullLayout._pushmargin;\n var pushMarginIds = fullLayout._pushmarginIds;\n var minreducedwidth = fullLayout.minreducedwidth;\n var minreducedheight = fullLayout.minreducedheight;\n if (margin.autoexpand !== false) {\n for (var k in pushMargin) {\n if (!pushMarginIds[k]) delete pushMargin[k];\n }\n var margins = gd._fullLayout._reservedMargin;\n for (var key in margins) {\n for (var side in margins[key]) {\n var val = margins[key][side];\n reservedMargins[side] = Math.max(reservedMargins[side], val);\n }\n }\n pushMargin.base = {\n l: { val: 0, size: ml },\n r: { val: 1, size: mr },\n t: { val: 1, size: mt },\n b: { val: 0, size: mb }\n };\n for (var s in reservedMargins) {\n var autoMarginPush = 0;\n for (var m in pushMargin) {\n if (m !== \"base\") {\n if (isNumeric(pushMargin[m][s].size)) {\n autoMarginPush = pushMargin[m][s].size > autoMarginPush ? pushMargin[m][s].size : autoMarginPush;\n }\n }\n }\n var extraMargin = Math.max(0, margin[s] - autoMarginPush);\n reservedMargins[s] = Math.max(0, reservedMargins[s] - extraMargin);\n }\n for (var k1 in pushMargin) {\n var pushleft = pushMargin[k1].l || {};\n var pushbottom = pushMargin[k1].b || {};\n var fl = pushleft.val;\n var pl = pushleft.size;\n var fb = pushbottom.val;\n var pb = pushbottom.size;\n var availableWidth = width - reservedMargins.r - reservedMargins.l;\n var availableHeight = height - reservedMargins.t - reservedMargins.b;\n for (var k2 in pushMargin) {\n if (isNumeric(pl) && pushMargin[k2].r) {\n var fr = pushMargin[k2].r.val;\n var pr = pushMargin[k2].r.size;\n if (fr > fl) {\n var newL = (pl * fr + (pr - availableWidth) * fl) / (fr - fl);\n var newR = (pr * (1 - fl) + (pl - availableWidth) * (1 - fr)) / (fr - fl);\n if (newL + newR > ml + mr) {\n ml = newL;\n mr = newR;\n }\n }\n }\n if (isNumeric(pb) && pushMargin[k2].t) {\n var ft = pushMargin[k2].t.val;\n var pt = pushMargin[k2].t.size;\n if (ft > fb) {\n var newB = (pb * ft + (pt - availableHeight) * fb) / (ft - fb);\n var newT = (pt * (1 - fb) + (pb - availableHeight) * (1 - ft)) / (ft - fb);\n if (newB + newT > mb + mt) {\n mb = newB;\n mt = newT;\n }\n }\n }\n }\n }\n }\n var minFinalWidth = Lib.constrain(\n width - margin.l - margin.r,\n MIN_SPECIFIED_WIDTH,\n minreducedwidth\n );\n var minFinalHeight = Lib.constrain(\n height - margin.t - margin.b,\n MIN_SPECIFIED_HEIGHT,\n minreducedheight\n );\n var maxSpaceW = Math.max(0, width - minFinalWidth);\n var maxSpaceH = Math.max(0, height - minFinalHeight);\n if (maxSpaceW) {\n var rW = (ml + mr) / maxSpaceW;\n if (rW > 1) {\n ml /= rW;\n mr /= rW;\n }\n }\n if (maxSpaceH) {\n var rH = (mb + mt) / maxSpaceH;\n if (rH > 1) {\n mb /= rH;\n mt /= rH;\n }\n }\n gs.l = Math.round(ml) + reservedMargins.l;\n gs.r = Math.round(mr) + reservedMargins.r;\n gs.t = Math.round(mt) + reservedMargins.t;\n gs.b = Math.round(mb) + reservedMargins.b;\n gs.p = Math.round(margin.pad);\n gs.w = Math.round(width) - gs.l - gs.r;\n gs.h = Math.round(height) - gs.t - gs.b;\n if (!fullLayout._replotting && (plots.didMarginChange(oldMargins, gs) || needsRedrawForShift(gd))) {\n if (\"_redrawFromAutoMarginCount\" in fullLayout) {\n fullLayout._redrawFromAutoMarginCount++;\n } else {\n fullLayout._redrawFromAutoMarginCount = 1;\n }\n var maxNumberOfRedraws = 3 * (1 + Object.keys(pushMarginIds).length);\n if (fullLayout._redrawFromAutoMarginCount < maxNumberOfRedraws) {\n return Registry.call(\"_doPlot\", gd);\n } else {\n fullLayout._size = oldMargins;\n Lib.warn(\"Too many auto-margin redraws.\");\n }\n }\n refineTicks(gd);\n };\n function refineTicks(gd) {\n var axList = axisIDs.list(gd, \"\", true);\n [\n \"_adjustTickLabelsOverflow\",\n \"_hideCounterAxisInsideTickLabels\"\n ].forEach(function(k) {\n for (var i = 0; i < axList.length; i++) {\n var hideFn = axList[i][k];\n if (hideFn) hideFn();\n }\n });\n }\n var marginKeys = [\"l\", \"r\", \"t\", \"b\", \"p\", \"w\", \"h\"];\n plots.didMarginChange = function(margin0, margin1) {\n for (var i = 0; i < marginKeys.length; i++) {\n var k = marginKeys[i];\n var m0 = margin0[k];\n var m1 = margin1[k];\n if (!isNumeric(m0) || Math.abs(m1 - m0) > 1) {\n return true;\n }\n }\n return false;\n };\n plots.graphJson = function(gd, dataonly, mode, output, useDefaults, includeConfig) {\n if (useDefaults && dataonly && !gd._fullData || useDefaults && !dataonly && !gd._fullLayout) {\n plots.supplyDefaults(gd);\n }\n var data = useDefaults ? gd._fullData : gd.data;\n var layout = useDefaults ? gd._fullLayout : gd.layout;\n var frames = (gd._transitionData || {})._frames;\n function stripObj(d, keepFunction) {\n if (typeof d === \"function\") {\n return keepFunction ? \"_function_\" : null;\n }\n if (Lib.isPlainObject(d)) {\n var o = {};\n var src;\n Object.keys(d).sort().forEach(function(v) {\n if ([\"_\", \"[\"].indexOf(v.charAt(0)) !== -1) return;\n if (typeof d[v] === \"function\") {\n if (keepFunction) o[v] = \"_function\";\n return;\n }\n if (mode === \"keepdata\") {\n if (v.substr(v.length - 3) === \"src\") {\n return;\n }\n } else if (mode === \"keepstream\") {\n src = d[v + \"src\"];\n if (typeof src === \"string\" && src.indexOf(\":\") > 0) {\n if (!Lib.isPlainObject(d.stream)) {\n return;\n }\n }\n } else if (mode !== \"keepall\") {\n src = d[v + \"src\"];\n if (typeof src === \"string\" && src.indexOf(\":\") > 0) {\n return;\n }\n }\n o[v] = stripObj(d[v], keepFunction);\n });\n return o;\n }\n var dIsArray = Array.isArray(d);\n var dIsTypedArray = Lib.isTypedArray(d);\n if ((dIsArray || dIsTypedArray) && d.dtype && d.shape) {\n var bdata = d.bdata;\n return stripObj({\n dtype: d.dtype,\n shape: d.shape,\n bdata: (\n // case of ArrayBuffer\n Lib.isArrayBuffer(bdata) ? b64encode.encode(bdata) : (\n // case of b64 string\n bdata\n )\n )\n }, keepFunction);\n }\n if (dIsArray) {\n return d.map(function(x) {\n return stripObj(x, keepFunction);\n });\n }\n if (dIsTypedArray) {\n return Lib.simpleMap(d, Lib.identity);\n }\n if (Lib.isJSDate(d)) return Lib.ms2DateTimeLocal(+d);\n return d;\n }\n var obj = {\n data: (data || []).map(function(v) {\n var d = stripObj(v);\n if (dataonly) {\n delete d.fit;\n }\n return d;\n })\n };\n if (!dataonly) {\n obj.layout = stripObj(layout);\n if (useDefaults) {\n var gs = layout._size;\n obj.layout.computed = {\n margin: {\n b: gs.b,\n l: gs.l,\n r: gs.r,\n t: gs.t\n }\n };\n }\n }\n if (frames) obj.frames = stripObj(frames);\n if (includeConfig) obj.config = stripObj(gd._context, true);\n return output === \"object\" ? obj : JSON.stringify(obj);\n };\n plots.modifyFrames = function(gd, operations) {\n var i, op, frame;\n var _frames = gd._transitionData._frames;\n var _frameHash = gd._transitionData._frameHash;\n for (i = 0; i < operations.length; i++) {\n op = operations[i];\n switch (op.type) {\n // No reason this couldn't exist, but is currently unused/untested:\n /* case 'rename':\n frame = _frames[op.index];\n delete _frameHash[frame.name];\n _frameHash[op.name] = frame;\n frame.name = op.name;\n break;*/\n case \"replace\":\n frame = op.value;\n var oldName = (_frames[op.index] || {}).name;\n var newName = frame.name;\n _frames[op.index] = _frameHash[newName] = frame;\n if (newName !== oldName) {\n delete _frameHash[oldName];\n _frameHash[newName] = frame;\n }\n break;\n case \"insert\":\n frame = op.value;\n _frameHash[frame.name] = frame;\n _frames.splice(op.index, 0, frame);\n break;\n case \"delete\":\n frame = _frames[op.index];\n delete _frameHash[frame.name];\n _frames.splice(op.index, 1);\n break;\n }\n }\n return Promise.resolve();\n };\n plots.computeFrame = function(gd, frameName) {\n var frameLookup = gd._transitionData._frameHash;\n var i, traceIndices, traceIndex, destIndex;\n if (!frameName) {\n throw new Error(\"computeFrame must be given a string frame name\");\n }\n var framePtr = frameLookup[frameName.toString()];\n if (!framePtr) {\n return false;\n }\n var frameStack = [framePtr];\n var frameNameStack = [framePtr.name];\n while (framePtr.baseframe && (framePtr = frameLookup[framePtr.baseframe.toString()])) {\n if (frameNameStack.indexOf(framePtr.name) !== -1) break;\n frameStack.push(framePtr);\n frameNameStack.push(framePtr.name);\n }\n var result = {};\n while (framePtr = frameStack.pop()) {\n if (framePtr.layout) {\n result.layout = plots.extendLayout(result.layout, framePtr.layout);\n }\n if (framePtr.data) {\n if (!result.data) {\n result.data = [];\n }\n traceIndices = framePtr.traces;\n if (!traceIndices) {\n traceIndices = [];\n for (i = 0; i < framePtr.data.length; i++) {\n traceIndices[i] = i;\n }\n }\n if (!result.traces) {\n result.traces = [];\n }\n for (i = 0; i < framePtr.data.length; i++) {\n traceIndex = traceIndices[i];\n if (traceIndex === void 0 || traceIndex === null) {\n continue;\n }\n destIndex = result.traces.indexOf(traceIndex);\n if (destIndex === -1) {\n destIndex = result.data.length;\n result.traces[destIndex] = traceIndex;\n }\n result.data[destIndex] = plots.extendTrace(result.data[destIndex], framePtr.data[i]);\n }\n }\n }\n return result;\n };\n plots.recomputeFrameHash = function(gd) {\n var hash = gd._transitionData._frameHash = {};\n var frames = gd._transitionData._frames;\n for (var i = 0; i < frames.length; i++) {\n var frame = frames[i];\n if (frame && frame.name) {\n hash[frame.name] = frame;\n }\n }\n };\n plots.extendObjectWithContainers = function(dest, src, containerPaths) {\n var containerProp, containerVal, i, j, srcProp, destProp, srcContainer, destContainer;\n var copy = Lib.extendDeepNoArrays({}, src || {});\n var expandedObj = Lib.expandObjectPaths(copy);\n var containerObj = {};\n if (containerPaths && containerPaths.length) {\n for (i = 0; i < containerPaths.length; i++) {\n containerProp = Lib.nestedProperty(expandedObj, containerPaths[i]);\n containerVal = containerProp.get();\n if (containerVal === void 0) {\n Lib.nestedProperty(containerObj, containerPaths[i]).set(null);\n } else {\n containerProp.set(null);\n Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal);\n }\n }\n }\n dest = Lib.extendDeepNoArrays(dest || {}, expandedObj);\n if (containerPaths && containerPaths.length) {\n for (i = 0; i < containerPaths.length; i++) {\n srcProp = Lib.nestedProperty(containerObj, containerPaths[i]);\n srcContainer = srcProp.get();\n if (!srcContainer) continue;\n destProp = Lib.nestedProperty(dest, containerPaths[i]);\n destContainer = destProp.get();\n if (!Array.isArray(destContainer)) {\n destContainer = [];\n destProp.set(destContainer);\n }\n for (j = 0; j < srcContainer.length; j++) {\n var srcObj = srcContainer[j];\n if (srcObj === null) destContainer[j] = null;\n else {\n destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcObj);\n }\n }\n destProp.set(destContainer);\n }\n }\n return dest;\n };\n plots.dataArrayContainers = [\"transforms\", \"dimensions\"];\n plots.layoutArrayContainers = Registry.layoutArrayContainers;\n plots.extendTrace = function(destTrace, srcTrace) {\n return plots.extendObjectWithContainers(destTrace, srcTrace, plots.dataArrayContainers);\n };\n plots.extendLayout = function(destLayout, srcLayout) {\n return plots.extendObjectWithContainers(destLayout, srcLayout, plots.layoutArrayContainers);\n };\n plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) {\n var opts = { redraw: frameOpts.redraw };\n var transitionedTraces = {};\n var axEdits = [];\n opts.prepareFn = function() {\n var dataLength = Array.isArray(data) ? data.length : 0;\n var traceIndices = traces.slice(0, dataLength);\n for (var i = 0; i < traceIndices.length; i++) {\n var traceIdx = traceIndices[i];\n var trace = gd._fullData[traceIdx];\n var _module = trace._module;\n if (!_module) continue;\n if (_module.animatable) {\n var n = _module.basePlotModule.name;\n if (!transitionedTraces[n]) transitionedTraces[n] = [];\n transitionedTraces[n].push(traceIdx);\n }\n gd.data[traceIndices[i]] = plots.extendTrace(gd.data[traceIndices[i]], data[i]);\n }\n var layoutUpdate = Lib.expandObjectPaths(Lib.extendDeepNoArrays({}, layout));\n var axisAttrRe = /^[xy]axis[0-9]*$/;\n for (var attr in layoutUpdate) {\n if (!axisAttrRe.test(attr)) continue;\n delete layoutUpdate[attr].range;\n }\n plots.extendLayout(gd.layout, layoutUpdate);\n delete gd.calcdata;\n plots.supplyDefaults(gd);\n plots.doCalcdata(gd);\n var newLayout = Lib.expandObjectPaths(layout);\n if (newLayout) {\n var subplots = gd._fullLayout._plots;\n for (var k in subplots) {\n var plotinfo = subplots[k];\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var xr0 = xa.range.slice();\n var yr0 = ya.range.slice();\n var xr1 = null;\n var yr1 = null;\n var editX = null;\n var editY = null;\n if (Array.isArray(newLayout[xa._name + \".range\"])) {\n xr1 = newLayout[xa._name + \".range\"].slice();\n } else if (Array.isArray((newLayout[xa._name] || {}).range)) {\n xr1 = newLayout[xa._name].range.slice();\n }\n if (Array.isArray(newLayout[ya._name + \".range\"])) {\n yr1 = newLayout[ya._name + \".range\"].slice();\n } else if (Array.isArray((newLayout[ya._name] || {}).range)) {\n yr1 = newLayout[ya._name].range.slice();\n }\n if (xr0 && xr1 && (xa.r2l(xr0[0]) !== xa.r2l(xr1[0]) || xa.r2l(xr0[1]) !== xa.r2l(xr1[1]))) {\n editX = { xr0, xr1 };\n }\n if (yr0 && yr1 && (ya.r2l(yr0[0]) !== ya.r2l(yr1[0]) || ya.r2l(yr0[1]) !== ya.r2l(yr1[1]))) {\n editY = { yr0, yr1 };\n }\n if (editX || editY) {\n axEdits.push(Lib.extendFlat({ plotinfo }, editX, editY));\n }\n }\n }\n return Promise.resolve();\n };\n opts.runFn = function(makeCallback) {\n var traceTransitionOpts;\n var basePlotModules = gd._fullLayout._basePlotModules;\n var hasAxisTransition = axEdits.length;\n var i;\n if (layout) {\n for (i = 0; i < basePlotModules.length; i++) {\n if (basePlotModules[i].transitionAxes) {\n basePlotModules[i].transitionAxes(gd, axEdits, transitionOpts, makeCallback);\n }\n }\n }\n if (hasAxisTransition) {\n traceTransitionOpts = Lib.extendFlat({}, transitionOpts);\n traceTransitionOpts.duration = 0;\n delete transitionedTraces.cartesian;\n } else {\n traceTransitionOpts = transitionOpts;\n }\n for (var n in transitionedTraces) {\n var traceIndices = transitionedTraces[n];\n var _module = gd._fullData[traceIndices[0]]._module;\n _module.basePlotModule.plot(gd, traceIndices, traceTransitionOpts, makeCallback);\n }\n };\n return _transition(gd, transitionOpts, opts);\n };\n plots.transitionFromReact = function(gd, restyleFlags, relayoutFlags, oldFullLayout) {\n var fullLayout = gd._fullLayout;\n var transitionOpts = fullLayout.transition;\n var opts = {};\n var axEdits = [];\n opts.prepareFn = function() {\n var subplots = fullLayout._plots;\n opts.redraw = false;\n if (restyleFlags.anim === \"some\") opts.redraw = true;\n if (relayoutFlags.anim === \"some\") opts.redraw = true;\n for (var k in subplots) {\n var plotinfo = subplots[k];\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var xr0 = oldFullLayout[xa._name].range.slice();\n var yr0 = oldFullLayout[ya._name].range.slice();\n var xr1 = xa.range.slice();\n var yr1 = ya.range.slice();\n xa.setScale();\n ya.setScale();\n var editX = null;\n var editY = null;\n if (xa.r2l(xr0[0]) !== xa.r2l(xr1[0]) || xa.r2l(xr0[1]) !== xa.r2l(xr1[1])) {\n editX = { xr0, xr1 };\n }\n if (ya.r2l(yr0[0]) !== ya.r2l(yr1[0]) || ya.r2l(yr0[1]) !== ya.r2l(yr1[1])) {\n editY = { yr0, yr1 };\n }\n if (editX || editY) {\n axEdits.push(Lib.extendFlat({ plotinfo }, editX, editY));\n }\n }\n return Promise.resolve();\n };\n opts.runFn = function(makeCallback) {\n var fullData = gd._fullData;\n var fullLayout2 = gd._fullLayout;\n var basePlotModules = fullLayout2._basePlotModules;\n var axisTransitionOpts;\n var traceTransitionOpts;\n var transitionedTraces;\n var allTraceIndices = [];\n for (var i = 0; i < fullData.length; i++) {\n allTraceIndices.push(i);\n }\n function transitionAxes() {\n if (!gd._fullLayout) return;\n for (var j = 0; j < basePlotModules.length; j++) {\n if (basePlotModules[j].transitionAxes) {\n basePlotModules[j].transitionAxes(gd, axEdits, axisTransitionOpts, makeCallback);\n }\n }\n }\n function transitionTraces() {\n if (!gd._fullLayout) return;\n for (var j = 0; j < basePlotModules.length; j++) {\n basePlotModules[j].plot(gd, transitionedTraces, traceTransitionOpts, makeCallback);\n }\n }\n if (axEdits.length && restyleFlags.anim) {\n if (transitionOpts.ordering === \"traces first\") {\n axisTransitionOpts = Lib.extendFlat({}, transitionOpts, { duration: 0 });\n transitionedTraces = allTraceIndices;\n traceTransitionOpts = transitionOpts;\n setTimeout(transitionAxes, transitionOpts.duration);\n transitionTraces();\n } else {\n axisTransitionOpts = transitionOpts;\n transitionedTraces = null;\n traceTransitionOpts = Lib.extendFlat({}, transitionOpts, { duration: 0 });\n setTimeout(transitionTraces, axisTransitionOpts.duration);\n transitionAxes();\n }\n } else if (axEdits.length) {\n axisTransitionOpts = transitionOpts;\n transitionAxes();\n } else if (restyleFlags.anim) {\n transitionedTraces = allTraceIndices;\n traceTransitionOpts = transitionOpts;\n transitionTraces();\n }\n };\n return _transition(gd, transitionOpts, opts);\n };\n function _transition(gd, transitionOpts, opts) {\n var aborted = false;\n function executeCallbacks(list) {\n var p = Promise.resolve();\n if (!list) return p;\n while (list.length) {\n p = p.then(list.shift());\n }\n return p;\n }\n function flushCallbacks(list) {\n if (!list) return;\n while (list.length) {\n list.shift();\n }\n }\n function executeTransitions() {\n gd.emit(\"plotly_transitioning\", []);\n return new Promise(function(resolve) {\n gd._transitioning = true;\n if (transitionOpts.duration > 0) {\n gd._transitioningWithDuration = true;\n }\n gd._transitionData._interruptCallbacks.push(function() {\n aborted = true;\n });\n if (opts.redraw) {\n gd._transitionData._interruptCallbacks.push(function() {\n return Registry.call(\"redraw\", gd);\n });\n }\n gd._transitionData._interruptCallbacks.push(function() {\n gd.emit(\"plotly_transitioninterrupted\", []);\n });\n var numCallbacks = 0;\n var numCompleted = 0;\n function makeCallback() {\n numCallbacks++;\n return function() {\n numCompleted++;\n if (!aborted && numCompleted === numCallbacks) {\n completeTransition(resolve);\n }\n };\n }\n opts.runFn(makeCallback);\n setTimeout(makeCallback());\n });\n }\n function completeTransition(callback) {\n if (!gd._transitionData) return;\n flushCallbacks(gd._transitionData._interruptCallbacks);\n return Promise.resolve().then(function() {\n if (opts.redraw) {\n return Registry.call(\"redraw\", gd);\n }\n }).then(function() {\n gd._transitioning = false;\n gd._transitioningWithDuration = false;\n gd.emit(\"plotly_transitioned\", []);\n }).then(callback);\n }\n function interruptPreviousTransitions() {\n if (!gd._transitionData) return;\n gd._transitioning = false;\n return executeCallbacks(gd._transitionData._interruptCallbacks);\n }\n var seq = [\n plots.previousPromises,\n interruptPreviousTransitions,\n opts.prepareFn,\n plots.rehover,\n plots.reselect,\n executeTransitions\n ];\n var transitionStarting = Lib.syncOrAsync(seq, gd);\n if (!transitionStarting || !transitionStarting.then) {\n transitionStarting = Promise.resolve();\n }\n return transitionStarting.then(function() {\n return gd;\n });\n }\n plots.doCalcdata = function(gd, traces) {\n var axList = axisIDs.list(gd);\n var fullData = gd._fullData;\n var fullLayout = gd._fullLayout;\n var trace, _module, i, j;\n var calcdata = new Array(fullData.length);\n var oldCalcdata = (gd.calcdata || []).slice();\n gd.calcdata = calcdata;\n fullLayout._numBoxes = 0;\n fullLayout._numViolins = 0;\n fullLayout._violinScaleGroupStats = {};\n gd._hmpixcount = 0;\n gd._hmlumcount = 0;\n fullLayout._piecolormap = {};\n fullLayout._sunburstcolormap = {};\n fullLayout._treemapcolormap = {};\n fullLayout._iciclecolormap = {};\n fullLayout._funnelareacolormap = {};\n for (i = 0; i < fullData.length; i++) {\n if (Array.isArray(traces) && traces.indexOf(i) === -1) {\n calcdata[i] = oldCalcdata[i];\n continue;\n }\n }\n for (i = 0; i < fullData.length; i++) {\n trace = fullData[i];\n trace._arrayAttrs = PlotSchema.findArrayAttributes(trace);\n trace._extremes = {};\n }\n var polarIds = fullLayout._subplots.polar || [];\n for (i = 0; i < polarIds.length; i++) {\n axList.push(\n fullLayout[polarIds[i]].radialaxis,\n fullLayout[polarIds[i]].angularaxis\n );\n }\n for (var k in fullLayout._colorAxes) {\n var cOpts = fullLayout[k];\n if (cOpts.cauto !== false) {\n delete cOpts.cmin;\n delete cOpts.cmax;\n }\n }\n var hasCalcTransform = false;\n function transformCalci(i2) {\n trace = fullData[i2];\n _module = trace._module;\n if (trace.visible === true && trace.transforms) {\n if (_module && _module.calc) {\n var cdi = _module.calc(gd, trace);\n if (cdi[0] && cdi[0].t && cdi[0].t._scene) {\n delete cdi[0].t._scene.dirty;\n }\n }\n for (j = 0; j < trace.transforms.length; j++) {\n var transform = trace.transforms[j];\n _module = transformsRegistry[transform.type];\n if (_module && _module.calcTransform) {\n trace._hasCalcTransform = true;\n hasCalcTransform = true;\n _module.calcTransform(gd, trace, transform);\n }\n }\n }\n }\n function calci(i2, isContainer) {\n trace = fullData[i2];\n _module = trace._module;\n if (!!_module.isContainer !== isContainer) return;\n var cd = [];\n if (trace.visible === true && trace._length !== 0) {\n delete trace._indexToPoints;\n var transforms = trace.transforms || [];\n for (j = transforms.length - 1; j >= 0; j--) {\n if (transforms[j].enabled) {\n trace._indexToPoints = transforms[j]._indexToPoints;\n break;\n }\n }\n if (_module && _module.calc) {\n cd = _module.calc(gd, trace);\n }\n }\n if (!Array.isArray(cd) || !cd[0]) {\n cd = [{ x: BADNUM, y: BADNUM }];\n }\n if (!cd[0].t) cd[0].t = {};\n cd[0].trace = trace;\n calcdata[i2] = cd;\n }\n setupAxisCategories(axList, fullData, fullLayout);\n for (i = 0; i < fullData.length; i++) calci(i, true);\n for (i = 0; i < fullData.length; i++) transformCalci(i);\n if (hasCalcTransform) setupAxisCategories(axList, fullData, fullLayout);\n for (i = 0; i < fullData.length; i++) calci(i, true);\n for (i = 0; i < fullData.length; i++) calci(i, false);\n doCrossTraceCalc(gd);\n var sorted = sortAxisCategoriesByValue(axList, gd);\n if (sorted.length) {\n fullLayout._numBoxes = 0;\n fullLayout._numViolins = 0;\n for (i = 0; i < sorted.length; i++) calci(sorted[i], true);\n for (i = 0; i < sorted.length; i++) calci(sorted[i], false);\n doCrossTraceCalc(gd);\n }\n Registry.getComponentMethod(\"fx\", \"calc\")(gd);\n Registry.getComponentMethod(\"errorbars\", \"calc\")(gd);\n };\n var sortAxisCategoriesByValueRegex = /(total|sum|min|max|mean|geometric mean|median) (ascending|descending)/;\n function sortAxisCategoriesByValue(axList, gd) {\n var affectedTraces = [];\n var i, j, k, l, o;\n function zMapCategory(type2, ax2, value2) {\n var axLetter2 = ax2._id.charAt(0);\n if (type2 === \"histogram2dcontour\") {\n var counterAxLetter = ax2._counterAxes[0];\n var counterAx = axisIDs.getFromId(gd, counterAxLetter);\n var xCategorical = axLetter2 === \"x\" || counterAxLetter === \"x\" && counterAx.type === \"category\";\n var yCategorical = axLetter2 === \"y\" || counterAxLetter === \"y\" && counterAx.type === \"category\";\n return function(o2, l2) {\n if (o2 === 0 || l2 === 0) return -1;\n if (xCategorical && o2 === value2[l2].length - 1) return -1;\n if (yCategorical && l2 === value2.length - 1) return -1;\n return (axLetter2 === \"y\" ? l2 : o2) - 1;\n };\n } else {\n return function(o2, l2) {\n return axLetter2 === \"y\" ? l2 : o2;\n };\n }\n }\n var aggFn = {\n min: function(values) {\n return Lib.aggNums(Math.min, null, values);\n },\n max: function(values) {\n return Lib.aggNums(Math.max, null, values);\n },\n sum: function(values) {\n return Lib.aggNums(function(a, b) {\n return a + b;\n }, null, values);\n },\n total: function(values) {\n return Lib.aggNums(function(a, b) {\n return a + b;\n }, null, values);\n },\n mean: function(values) {\n return Lib.mean(values);\n },\n \"geometric mean\": function(values) {\n return Lib.geometricMean(values);\n },\n median: function(values) {\n return Lib.median(values);\n }\n };\n function sortAscending(a, b) {\n return a[1] - b[1];\n }\n function sortDescending(a, b) {\n return b[1] - a[1];\n }\n for (i = 0; i < axList.length; i++) {\n var ax = axList[i];\n if (ax.type !== \"category\") continue;\n var match = ax.categoryorder.match(sortAxisCategoriesByValueRegex);\n if (match) {\n var aggregator = match[1];\n var order = match[2];\n var axLetter = ax._id.charAt(0);\n var isX = axLetter === \"x\";\n var categoriesValue = [];\n for (j = 0; j < ax._categories.length; j++) {\n categoriesValue.push([ax._categories[j], []]);\n }\n for (j = 0; j < ax._traceIndices.length; j++) {\n var traceIndex = ax._traceIndices[j];\n var fullTrace = gd._fullData[traceIndex];\n if (fullTrace.visible !== true) continue;\n var type = fullTrace.type;\n if (Registry.traceIs(fullTrace, \"histogram\")) {\n delete fullTrace._xautoBinFinished;\n delete fullTrace._yautoBinFinished;\n }\n var isSplom = type === \"splom\";\n var isScattergl = type === \"scattergl\";\n var cd = gd.calcdata[traceIndex];\n for (k = 0; k < cd.length; k++) {\n var cdi = cd[k];\n var catIndex, value;\n if (isSplom) {\n var currentDimensionIndex = fullTrace._axesDim[ax._id];\n if (!isX) {\n var associatedXAxisID = fullTrace._diag[currentDimensionIndex][0];\n if (associatedXAxisID) ax = gd._fullLayout[axisIDs.id2name(associatedXAxisID)];\n }\n var categories = cdi.trace.dimensions[currentDimensionIndex].values;\n for (l = 0; l < categories.length; l++) {\n catIndex = ax._categoriesMap[categories[l]];\n for (o = 0; o < cdi.trace.dimensions.length; o++) {\n if (o === currentDimensionIndex) continue;\n var dimension = cdi.trace.dimensions[o];\n categoriesValue[catIndex][1].push(dimension.values[l]);\n }\n }\n } else if (isScattergl) {\n for (l = 0; l < cdi.t.x.length; l++) {\n if (isX) {\n catIndex = cdi.t.x[l];\n value = cdi.t.y[l];\n } else {\n catIndex = cdi.t.y[l];\n value = cdi.t.x[l];\n }\n categoriesValue[catIndex][1].push(value);\n }\n if (cdi.t && cdi.t._scene) {\n delete cdi.t._scene.dirty;\n }\n } else if (cdi.hasOwnProperty(\"z\")) {\n value = cdi.z;\n var mapping = zMapCategory(fullTrace.type, ax, value);\n for (l = 0; l < value.length; l++) {\n for (o = 0; o < value[l].length; o++) {\n catIndex = mapping(o, l);\n if (catIndex + 1) categoriesValue[catIndex][1].push(value[l][o]);\n }\n }\n } else {\n catIndex = cdi.p;\n if (catIndex === void 0) catIndex = cdi[axLetter];\n value = cdi.s;\n if (value === void 0) value = cdi.v;\n if (value === void 0) value = isX ? cdi.y : cdi.x;\n if (!Array.isArray(value)) {\n if (value === void 0) value = [];\n else value = [value];\n }\n for (l = 0; l < value.length; l++) {\n categoriesValue[catIndex][1].push(value[l]);\n }\n }\n }\n }\n ax._categoriesValue = categoriesValue;\n var categoriesAggregatedValue = [];\n for (j = 0; j < categoriesValue.length; j++) {\n categoriesAggregatedValue.push([\n categoriesValue[j][0],\n aggFn[aggregator](categoriesValue[j][1])\n ]);\n }\n categoriesAggregatedValue.sort(order === \"descending\" ? sortDescending : sortAscending);\n ax._categoriesAggregatedValue = categoriesAggregatedValue;\n ax._initialCategories = categoriesAggregatedValue.map(function(c) {\n return c[0];\n });\n affectedTraces = affectedTraces.concat(ax.sortByInitialCategories());\n }\n }\n return affectedTraces;\n }\n function setupAxisCategories(axList, fullData, fullLayout) {\n var axLookup = {};\n function setupOne(ax) {\n ax.clearCalc();\n if (ax.type === \"multicategory\") {\n ax.setupMultiCategory(fullData);\n }\n axLookup[ax._id] = 1;\n }\n Lib.simpleMap(axList, setupOne);\n var matchGroups = fullLayout._axisMatchGroups || [];\n for (var i = 0; i < matchGroups.length; i++) {\n for (var axId in matchGroups[i]) {\n if (!axLookup[axId]) {\n setupOne(fullLayout[axisIDs.id2name(axId)]);\n }\n }\n }\n }\n function doCrossTraceCalc(gd) {\n var fullLayout = gd._fullLayout;\n var modules = fullLayout._visibleModules;\n var hash = {};\n var i, j, k;\n for (j = 0; j < modules.length; j++) {\n var _module = modules[j];\n var fn = _module.crossTraceCalc;\n if (fn) {\n var spType = _module.basePlotModule.name;\n if (hash[spType]) {\n Lib.pushUnique(hash[spType], fn);\n } else {\n hash[spType] = [fn];\n }\n }\n }\n for (k in hash) {\n var methods = hash[k];\n var subplots = fullLayout._subplots[k];\n if (Array.isArray(subplots)) {\n for (i = 0; i < subplots.length; i++) {\n var sp = subplots[i];\n var spInfo = k === \"cartesian\" ? fullLayout._plots[sp] : fullLayout[sp];\n for (j = 0; j < methods.length; j++) {\n methods[j](gd, spInfo, sp);\n }\n }\n } else {\n for (j = 0; j < methods.length; j++) {\n methods[j](gd);\n }\n }\n }\n }\n plots.rehover = function(gd) {\n if (gd._fullLayout._rehover) {\n gd._fullLayout._rehover();\n }\n };\n plots.redrag = function(gd) {\n if (gd._fullLayout._redrag) {\n gd._fullLayout._redrag();\n }\n };\n plots.reselect = function(gd) {\n var fullLayout = gd._fullLayout;\n var A2 = (gd.layout || {}).selections;\n var B2 = fullLayout._previousSelections;\n fullLayout._previousSelections = A2;\n var mayEmitSelected = fullLayout._reselect || JSON.stringify(A2) !== JSON.stringify(B2);\n Registry.getComponentMethod(\"selections\", \"reselect\")(gd, mayEmitSelected);\n };\n plots.generalUpdatePerTraceModule = function(gd, subplot, subplotCalcData, subplotLayout) {\n var traceHashOld = subplot.traceHash;\n var traceHash = {};\n var i;\n for (i = 0; i < subplotCalcData.length; i++) {\n var calcTraces = subplotCalcData[i];\n var trace = calcTraces[0].trace;\n if (trace.visible) {\n traceHash[trace.type] = traceHash[trace.type] || [];\n traceHash[trace.type].push(calcTraces);\n }\n }\n for (var moduleNameOld in traceHashOld) {\n if (!traceHash[moduleNameOld]) {\n var fakeCalcTrace = traceHashOld[moduleNameOld][0];\n var fakeTrace = fakeCalcTrace[0].trace;\n fakeTrace.visible = false;\n traceHash[moduleNameOld] = [fakeCalcTrace];\n }\n }\n for (var moduleName in traceHash) {\n var moduleCalcData = traceHash[moduleName];\n var _module = moduleCalcData[0][0].trace._module;\n _module.plot(gd, subplot, Lib.filterVisible(moduleCalcData), subplotLayout);\n }\n subplot.traceHash = traceHash;\n };\n plots.plotBasePlot = function(desiredType, gd, traces, transitionOpts, makeOnCompleteCallback) {\n var _module = Registry.getModule(desiredType);\n var cdmodule = getModuleCalcData(gd.calcdata, _module)[0];\n _module.plot(gd, cdmodule, transitionOpts, makeOnCompleteCallback);\n };\n plots.cleanBasePlot = function(desiredType, newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var had = oldFullLayout._has && oldFullLayout._has(desiredType);\n var has = newFullLayout._has && newFullLayout._has(desiredType);\n if (had && !has) {\n oldFullLayout[\"_\" + desiredType + \"layer\"].selectAll(\"g.trace\").remove();\n }\n };\n }\n });\n\n // src/constants/xmlns_namespaces.js\n var require_xmlns_namespaces = __commonJS({\n \"src/constants/xmlns_namespaces.js\"(exports) {\n \"use strict\";\n exports.xmlns = \"http://www.w3.org/2000/xmlns/\";\n exports.svg = \"http://www.w3.org/2000/svg\";\n exports.xlink = \"http://www.w3.org/1999/xlink\";\n exports.svgAttrs = {\n xmlns: exports.svg,\n \"xmlns:xlink\": exports.xlink\n };\n }\n });\n\n // src/constants/alignment.js\n var require_alignment = __commonJS({\n \"src/constants/alignment.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n // from bottom left: this is the origin of our paper-reference\n // positioning system\n FROM_BL: {\n left: 0,\n center: 0.5,\n right: 1,\n bottom: 0,\n middle: 0.5,\n top: 1\n },\n // from top left: this is the screen pixel positioning origin\n FROM_TL: {\n left: 0,\n center: 0.5,\n right: 1,\n bottom: 1,\n middle: 0.5,\n top: 0\n },\n // from bottom right: sometimes you just need the opposite of ^^\n FROM_BR: {\n left: 1,\n center: 0.5,\n right: 0,\n bottom: 0,\n middle: 0.5,\n top: 1\n },\n // multiple of fontSize to get the vertical offset between lines\n LINE_SPACING: 1.3,\n // multiple of fontSize to shift from the baseline\n // to the cap (captical letter) line\n // (to use when we don't calculate this shift from Drawing.bBox)\n // This is an approximation since in reality cap height can differ\n // from font to font. However, according to Wikipedia\n // an \"average\" font might have a cap height of 70% of the em\n // https://en.wikipedia.org/wiki/Em_(typography)#History\n CAP_SHIFT: 0.7,\n // half the cap height (distance between baseline and cap line)\n // of an \"average\" font (for more info see above).\n MID_SHIFT: 0.35,\n OPPOSITE_SIDE: {\n left: \"right\",\n right: \"left\",\n top: \"bottom\",\n bottom: \"top\"\n }\n };\n }\n });\n\n // src/lib/svg_text_utils.js\n var require_svg_text_utils = __commonJS({\n \"src/lib/svg_text_utils.js\"(exports) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var strTranslate = Lib.strTranslate;\n var xmlnsNamespaces = require_xmlns_namespaces();\n var LINE_SPACING = require_alignment().LINE_SPACING;\n var FIND_TEX = /([^$]*)([$]+[^$]*[$]+)([^$]*)/;\n exports.convertToTspans = function(_context, gd, _callback) {\n var str = _context.text();\n var tex = !_context.attr(\"data-notex\") && gd && gd._context.typesetMath && typeof MathJax !== \"undefined\" && str.match(FIND_TEX);\n var parent = d3.select(_context.node().parentNode);\n if (parent.empty()) return;\n var svgClass = _context.attr(\"class\") ? _context.attr(\"class\").split(\" \")[0] : \"text\";\n svgClass += \"-math\";\n parent.selectAll(\"svg.\" + svgClass).remove();\n parent.selectAll(\"g.\" + svgClass + \"-group\").remove();\n _context.style(\"display\", null).attr({\n // some callers use data-unformatted *from the element* in 'cancel'\n // so we need it here even if we're going to turn it into math\n // these two (plus style and text-anchor attributes) form the key we're\n // going to use for Drawing.bBox\n \"data-unformatted\": str,\n \"data-math\": \"N\"\n });\n function showText() {\n if (!parent.empty()) {\n svgClass = _context.attr(\"class\") + \"-math\";\n parent.select(\"svg.\" + svgClass).remove();\n }\n _context.text(\"\").style(\"white-space\", \"pre\");\n var hasLink = buildSVGText(_context.node(), str);\n if (hasLink) {\n _context.style(\"pointer-events\", \"all\");\n }\n exports.positionText(_context);\n if (_callback) _callback.call(_context);\n }\n if (tex) {\n (gd && gd._promises || []).push(new Promise(function(resolve) {\n _context.style(\"display\", \"none\");\n var fontSize = parseInt(_context.node().style.fontSize, 10);\n var config = { fontSize };\n texToSVG(tex[2], config, function(_svgEl, _glyphDefs, _svgBBox) {\n parent.selectAll(\"svg.\" + svgClass).remove();\n parent.selectAll(\"g.\" + svgClass + \"-group\").remove();\n var newSvg = _svgEl && _svgEl.select(\"svg\");\n if (!newSvg || !newSvg.node()) {\n showText();\n resolve();\n return;\n }\n var mathjaxGroup = parent.append(\"g\").classed(svgClass + \"-group\", true).attr({\n \"pointer-events\": \"none\",\n \"data-unformatted\": str,\n \"data-math\": \"Y\"\n });\n mathjaxGroup.node().appendChild(newSvg.node());\n if (_glyphDefs && _glyphDefs.node()) {\n newSvg.node().insertBefore(\n _glyphDefs.node().cloneNode(true),\n newSvg.node().firstChild\n );\n }\n var w0 = _svgBBox.width;\n var h0 = _svgBBox.height;\n newSvg.attr({\n class: svgClass,\n height: h0,\n preserveAspectRatio: \"xMinYMin meet\"\n }).style({ overflow: \"visible\", \"pointer-events\": \"none\" });\n var fill = _context.node().style.fill || \"black\";\n var g = newSvg.select(\"g\");\n g.attr({ fill, stroke: fill });\n var bb = g.node().getBoundingClientRect();\n var w = bb.width;\n var h = bb.height;\n if (w > w0 || h > h0) {\n newSvg.style(\"overflow\", \"hidden\");\n bb = newSvg.node().getBoundingClientRect();\n w = bb.width;\n h = bb.height;\n }\n var x = +_context.attr(\"x\");\n var y = +_context.attr(\"y\");\n var textHeight = fontSize || _context.node().getBoundingClientRect().height;\n var dy = -textHeight / 4;\n if (svgClass[0] === \"y\") {\n mathjaxGroup.attr({\n transform: \"rotate(\" + [-90, x, y] + \")\" + strTranslate(-w / 2, dy - h / 2)\n });\n } else if (svgClass[0] === \"l\") {\n y = dy - h / 2;\n } else if (svgClass[0] === \"a\" && svgClass.indexOf(\"atitle\") !== 0) {\n x = 0;\n y = dy;\n } else {\n var anchor = _context.attr(\"text-anchor\");\n x = x - w * (anchor === \"middle\" ? 0.5 : anchor === \"end\" ? 1 : 0);\n y = y + dy - h / 2;\n }\n newSvg.attr({\n x,\n y\n });\n if (_callback) _callback.call(_context, mathjaxGroup);\n resolve(mathjaxGroup);\n });\n }));\n } else showText();\n return _context;\n };\n var LT_MATCH = /(<|<|<)/g;\n var GT_MATCH = /(>|>|>)/g;\n function cleanEscapesForTex(s) {\n return s.replace(LT_MATCH, \"\\\\lt \").replace(GT_MATCH, \"\\\\gt \");\n }\n var inlineMath = [[\"$\", \"$\"], [\"\\\\(\", \"\\\\)\"]];\n function texToSVG(_texString, _config, _callback) {\n var MathJaxVersion = parseInt(\n (MathJax.version || \"\").split(\".\")[0]\n );\n if (MathJaxVersion !== 2 && MathJaxVersion !== 3) {\n Lib.warn(\"No MathJax version:\", MathJax.version);\n return;\n }\n var originalRenderer, originalConfig, originalProcessSectionDelay, tmpDiv;\n var setConfig2 = function() {\n originalConfig = Lib.extendDeepAll({}, MathJax.Hub.config);\n originalProcessSectionDelay = MathJax.Hub.processSectionDelay;\n if (MathJax.Hub.processSectionDelay !== void 0) {\n MathJax.Hub.processSectionDelay = 0;\n }\n return MathJax.Hub.Config({\n messageStyle: \"none\",\n tex2jax: {\n inlineMath\n },\n displayAlign: \"left\"\n });\n };\n var setConfig3 = function() {\n originalConfig = Lib.extendDeepAll({}, MathJax.config);\n if (!MathJax.config.tex) {\n MathJax.config.tex = {};\n }\n MathJax.config.tex.inlineMath = inlineMath;\n };\n var setRenderer2 = function() {\n originalRenderer = MathJax.Hub.config.menuSettings.renderer;\n if (originalRenderer !== \"SVG\") {\n return MathJax.Hub.setRenderer(\"SVG\");\n }\n };\n var setRenderer3 = function() {\n originalRenderer = MathJax.config.startup.output;\n if (originalRenderer !== \"svg\") {\n MathJax.config.startup.output = \"svg\";\n }\n };\n var initiateMathJax = function() {\n var randomID = \"math-output-\" + Lib.randstr({}, 64);\n tmpDiv = d3.select(\"body\").append(\"div\").attr({ id: randomID }).style({\n visibility: \"hidden\",\n position: \"absolute\",\n \"font-size\": _config.fontSize + \"px\"\n }).text(cleanEscapesForTex(_texString));\n var tmpNode = tmpDiv.node();\n return MathJaxVersion === 2 ? MathJax.Hub.Typeset(tmpNode) : MathJax.typeset([tmpNode]);\n };\n var finalizeMathJax = function() {\n var sel = tmpDiv.select(\n MathJaxVersion === 2 ? \".MathJax_SVG\" : \".MathJax\"\n );\n var node = !sel.empty() && tmpDiv.select(\"svg\").node();\n if (!node) {\n Lib.log(\"There was an error in the tex syntax.\", _texString);\n _callback();\n } else {\n var nodeBBox = node.getBoundingClientRect();\n var glyphDefs;\n if (MathJaxVersion === 2) {\n glyphDefs = d3.select(\"body\").select(\"#MathJax_SVG_glyphs\");\n } else {\n glyphDefs = sel.select(\"defs\");\n }\n _callback(sel, glyphDefs, nodeBBox);\n }\n tmpDiv.remove();\n };\n var resetRenderer2 = function() {\n if (originalRenderer !== \"SVG\") {\n return MathJax.Hub.setRenderer(originalRenderer);\n }\n };\n var resetRenderer3 = function() {\n if (originalRenderer !== \"svg\") {\n MathJax.config.startup.output = originalRenderer;\n }\n };\n var resetConfig2 = function() {\n if (originalProcessSectionDelay !== void 0) {\n MathJax.Hub.processSectionDelay = originalProcessSectionDelay;\n }\n return MathJax.Hub.Config(originalConfig);\n };\n var resetConfig3 = function() {\n MathJax.config = originalConfig;\n };\n if (MathJaxVersion === 2) {\n MathJax.Hub.Queue(\n setConfig2,\n setRenderer2,\n initiateMathJax,\n finalizeMathJax,\n resetRenderer2,\n resetConfig2\n );\n } else if (MathJaxVersion === 3) {\n setConfig3();\n setRenderer3();\n MathJax.startup.defaultReady();\n MathJax.startup.promise.then(function() {\n initiateMathJax();\n finalizeMathJax();\n resetRenderer3();\n resetConfig3();\n });\n }\n }\n var TAG_STYLES = {\n // would like to use baseline-shift for sub/sup but FF doesn't support it\n // so we need to use dy along with the uber hacky shift-back-to\n // baseline below\n sup: \"font-size:70%\",\n sub: \"font-size:70%\",\n s: \"text-decoration:line-through\",\n u: \"text-decoration:underline\",\n b: \"font-weight:bold\",\n i: \"font-style:italic\",\n a: \"cursor:pointer\",\n span: \"\",\n em: \"font-style:italic;font-weight:bold\"\n };\n var SHIFT_DY = {\n sub: \"0.3em\",\n sup: \"-0.6em\"\n };\n var RESET_DY = {\n sub: \"-0.21em\",\n sup: \"0.42em\"\n };\n var ZERO_WIDTH_SPACE = \"\\u200B\";\n var PROTOCOLS = [\"http:\", \"https:\", \"mailto:\", \"\", void 0, \":\"];\n var NEWLINES = exports.NEWLINES = /(\\r\\n?|\\n)/g;\n var SPLIT_TAGS = /(<[^<>]*>)/;\n var ONE_TAG = /<(\\/?)([^ >]*)(\\s+(.*))?>/i;\n var BR_TAG = //i;\n exports.BR_TAG_ALL = //gi;\n var STYLEMATCH = /(^|[\\s\"'])style\\s*=\\s*(\"([^\"]*);?\"|'([^']*);?')/i;\n var HREFMATCH = /(^|[\\s\"'])href\\s*=\\s*(\"([^\"]*)\"|'([^']*)')/i;\n var TARGETMATCH = /(^|[\\s\"'])target\\s*=\\s*(\"([^\"\\s]*)\"|'([^'\\s]*)')/i;\n var POPUPMATCH = /(^|[\\s\"'])popup\\s*=\\s*(\"([\\w=,]*)\"|'([\\w=,]*)')/i;\n function getQuotedMatch(_str, re) {\n if (!_str) return null;\n var match = _str.match(re);\n var result = match && (match[3] || match[4]);\n return result && convertEntities(result);\n }\n var COLORMATCH = /(^|;)\\s*color:/;\n exports.plainText = function(_str, opts) {\n opts = opts || {};\n var len = opts.len !== void 0 && opts.len !== -1 ? opts.len : Infinity;\n var allowedTags = opts.allowedTags !== void 0 ? opts.allowedTags : [\"br\"];\n var ellipsis = \"...\";\n var eLen = ellipsis.length;\n var oldParts = _str.split(SPLIT_TAGS);\n var newParts = [];\n var prevTag = \"\";\n var l = 0;\n for (var i = 0; i < oldParts.length; i++) {\n var p = oldParts[i];\n var match = p.match(ONE_TAG);\n var tagType = match && match[2].toLowerCase();\n if (tagType) {\n if (allowedTags.indexOf(tagType) !== -1) {\n newParts.push(p);\n prevTag = tagType;\n }\n } else {\n var pLen = p.length;\n if (l + pLen < len) {\n newParts.push(p);\n l += pLen;\n } else if (l < len) {\n var pLen2 = len - l;\n if (prevTag && (prevTag !== \"br\" || pLen2 <= eLen || pLen <= eLen)) {\n newParts.pop();\n }\n if (len > eLen) {\n newParts.push(p.substr(0, pLen2 - eLen) + ellipsis);\n } else {\n newParts.push(p.substr(0, pLen2));\n }\n break;\n }\n prevTag = \"\";\n }\n }\n return newParts.join(\"\");\n };\n var entityToUnicode = {\n mu: \"\\u03BC\",\n amp: \"&\",\n lt: \"<\",\n gt: \">\",\n nbsp: \"\\xA0\",\n times: \"\\xD7\",\n plusmn: \"\\xB1\",\n deg: \"\\xB0\"\n };\n var ENTITY_MATCH = /&(#\\d+|#x[\\da-fA-F]+|[a-z]+);/g;\n function convertEntities(_str) {\n return _str.replace(ENTITY_MATCH, function(fullMatch, innerMatch) {\n var outChar;\n if (innerMatch.charAt(0) === \"#\") {\n outChar = fromCodePoint(\n innerMatch.charAt(1) === \"x\" ? parseInt(innerMatch.substr(2), 16) : parseInt(innerMatch.substr(1), 10)\n );\n } else outChar = entityToUnicode[innerMatch];\n return outChar || fullMatch;\n });\n }\n exports.convertEntities = convertEntities;\n function fromCodePoint(code) {\n if (code > 1114111) return;\n var stringFromCodePoint = String.fromCodePoint;\n if (stringFromCodePoint) return stringFromCodePoint(code);\n var stringFromCharCode = String.fromCharCode;\n if (code <= 65535) return stringFromCharCode(code);\n return stringFromCharCode(\n (code >> 10) + 55232,\n code % 1024 + 56320\n );\n }\n function buildSVGText(containerNode, str) {\n str = str.replace(NEWLINES, \" \");\n var hasLink = false;\n var nodeStack = [];\n var currentNode;\n var currentLine = -1;\n function newLine() {\n currentLine++;\n var lineNode = document.createElementNS(xmlnsNamespaces.svg, \"tspan\");\n d3.select(lineNode).attr({\n class: \"line\",\n dy: currentLine * LINE_SPACING + \"em\"\n });\n containerNode.appendChild(lineNode);\n currentNode = lineNode;\n var oldNodeStack = nodeStack;\n nodeStack = [{ node: lineNode }];\n if (oldNodeStack.length > 1) {\n for (var i2 = 1; i2 < oldNodeStack.length; i2++) {\n enterNode(oldNodeStack[i2]);\n }\n }\n }\n function enterNode(nodeSpec2) {\n var type = nodeSpec2.type;\n var nodeAttrs = {};\n var nodeType;\n if (type === \"a\") {\n nodeType = \"a\";\n var target = nodeSpec2.target;\n var href2 = nodeSpec2.href;\n var popup = nodeSpec2.popup;\n if (href2) {\n nodeAttrs = {\n \"xlink:xlink:show\": target === \"_blank\" || target.charAt(0) !== \"_\" ? \"new\" : \"replace\",\n target,\n \"xlink:xlink:href\": href2\n };\n if (popup) {\n nodeAttrs.onclick = 'window.open(this.href.baseVal,this.target.baseVal,\"' + popup + '\");return false;';\n }\n }\n } else nodeType = \"tspan\";\n if (nodeSpec2.style) nodeAttrs.style = nodeSpec2.style;\n var newNode = document.createElementNS(xmlnsNamespaces.svg, nodeType);\n if (type === \"sup\" || type === \"sub\") {\n addTextNode(currentNode, ZERO_WIDTH_SPACE);\n currentNode.appendChild(newNode);\n var resetter = document.createElementNS(xmlnsNamespaces.svg, \"tspan\");\n addTextNode(resetter, ZERO_WIDTH_SPACE);\n d3.select(resetter).attr(\"dy\", RESET_DY[type]);\n nodeAttrs.dy = SHIFT_DY[type];\n currentNode.appendChild(newNode);\n currentNode.appendChild(resetter);\n } else {\n currentNode.appendChild(newNode);\n }\n d3.select(newNode).attr(nodeAttrs);\n currentNode = nodeSpec2.node = newNode;\n nodeStack.push(nodeSpec2);\n }\n function addTextNode(node, text) {\n node.appendChild(document.createTextNode(text));\n }\n function exitNode(type) {\n if (nodeStack.length === 1) {\n Lib.log(\"Ignoring unexpected end tag .\", str);\n return;\n }\n var innerNode = nodeStack.pop();\n if (type !== innerNode.type) {\n Lib.log(\"Start tag <\" + innerNode.type + \"> doesnt match end tag <\" + type + \">. Pretending it did match.\", str);\n }\n currentNode = nodeStack[nodeStack.length - 1].node;\n }\n var hasLines = BR_TAG.test(str);\n if (hasLines) newLine();\n else {\n currentNode = containerNode;\n nodeStack = [{ node: containerNode }];\n }\n var parts = str.split(SPLIT_TAGS);\n for (var i = 0; i < parts.length; i++) {\n var parti = parts[i];\n var match = parti.match(ONE_TAG);\n var tagType = match && match[2].toLowerCase();\n var tagStyle = TAG_STYLES[tagType];\n if (tagType === \"br\") {\n newLine();\n } else if (tagStyle === void 0) {\n addTextNode(currentNode, convertEntities(parti));\n } else {\n if (match[1]) {\n exitNode(tagType);\n } else {\n var extra = match[4];\n var nodeSpec = { type: tagType };\n var css = getQuotedMatch(extra, STYLEMATCH);\n if (css) {\n css = css.replace(COLORMATCH, \"$1 fill:\");\n if (tagStyle) css += \";\" + tagStyle;\n } else if (tagStyle) css = tagStyle;\n if (css) nodeSpec.style = css;\n if (tagType === \"a\") {\n hasLink = true;\n var href = getQuotedMatch(extra, HREFMATCH);\n if (href) {\n var safeHref = sanitizeHref(href);\n if (safeHref) {\n nodeSpec.href = safeHref;\n nodeSpec.target = getQuotedMatch(extra, TARGETMATCH) || \"_blank\";\n nodeSpec.popup = getQuotedMatch(extra, POPUPMATCH);\n }\n }\n }\n enterNode(nodeSpec);\n }\n }\n }\n return hasLink;\n }\n function sanitizeHref(href) {\n var decodedHref = encodeURI(decodeURI(href));\n var dummyAnchor1 = document.createElement(\"a\");\n var dummyAnchor2 = document.createElement(\"a\");\n dummyAnchor1.href = href;\n dummyAnchor2.href = decodedHref;\n var p1 = dummyAnchor1.protocol;\n var p2 = dummyAnchor2.protocol;\n if (PROTOCOLS.indexOf(p1) !== -1 && PROTOCOLS.indexOf(p2) !== -1) {\n return decodedHref;\n } else {\n return \"\";\n }\n }\n exports.sanitizeHTML = function sanitizeHTML(str) {\n str = str.replace(NEWLINES, \" \");\n var rootNode = document.createElement(\"p\");\n var currentNode = rootNode;\n var nodeStack = [];\n var parts = str.split(SPLIT_TAGS);\n for (var i = 0; i < parts.length; i++) {\n var parti = parts[i];\n var match = parti.match(ONE_TAG);\n var tagType = match && match[2].toLowerCase();\n if (tagType in TAG_STYLES) {\n if (match[1]) {\n if (nodeStack.length) {\n currentNode = nodeStack.pop();\n }\n } else {\n var extra = match[4];\n var css = getQuotedMatch(extra, STYLEMATCH);\n var nodeAttrs = css ? { style: css } : {};\n if (tagType === \"a\") {\n var href = getQuotedMatch(extra, HREFMATCH);\n if (href) {\n var safeHref = sanitizeHref(href);\n if (safeHref) {\n nodeAttrs.href = safeHref;\n var target = getQuotedMatch(extra, TARGETMATCH);\n if (target) {\n nodeAttrs.target = target;\n }\n }\n }\n }\n var newNode = document.createElement(tagType);\n currentNode.appendChild(newNode);\n d3.select(newNode).attr(nodeAttrs);\n currentNode = newNode;\n nodeStack.push(newNode);\n }\n } else {\n currentNode.appendChild(\n document.createTextNode(convertEntities(parti))\n );\n }\n }\n var key = \"innerHTML\";\n return rootNode[key];\n };\n exports.lineCount = function lineCount(s) {\n return s.selectAll(\"tspan.line\").size() || 1;\n };\n exports.positionText = function positionText(s, x, y) {\n return s.each(function() {\n var text = d3.select(this);\n function setOrGet(attr, val) {\n if (val === void 0) {\n val = text.attr(attr);\n if (val === null) {\n text.attr(attr, 0);\n val = 0;\n }\n } else text.attr(attr, val);\n return val;\n }\n var thisX = setOrGet(\"x\", x);\n var thisY = setOrGet(\"y\", y);\n if (this.nodeName === \"text\") {\n text.selectAll(\"tspan.line\").attr({ x: thisX, y: thisY });\n }\n });\n };\n function alignHTMLWith(_base, container, options) {\n var alignH = options.horizontalAlign;\n var alignV = options.verticalAlign || \"top\";\n var bRect = _base.node().getBoundingClientRect();\n var cRect = container.node().getBoundingClientRect();\n var thisRect;\n var getTop;\n var getLeft;\n if (alignV === \"bottom\") {\n getTop = function() {\n return bRect.bottom - thisRect.height;\n };\n } else if (alignV === \"middle\") {\n getTop = function() {\n return bRect.top + (bRect.height - thisRect.height) / 2;\n };\n } else {\n getTop = function() {\n return bRect.top;\n };\n }\n if (alignH === \"right\") {\n getLeft = function() {\n return bRect.right - thisRect.width;\n };\n } else if (alignH === \"center\") {\n getLeft = function() {\n return bRect.left + (bRect.width - thisRect.width) / 2;\n };\n } else {\n getLeft = function() {\n return bRect.left;\n };\n }\n return function() {\n thisRect = this.node().getBoundingClientRect();\n var x0 = getLeft() - cRect.left;\n var y0 = getTop() - cRect.top;\n var gd = options.gd || {};\n if (options.gd) {\n gd._fullLayout._calcInverseTransform(gd);\n var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0);\n x0 = transformedCoords[0];\n y0 = transformedCoords[1];\n }\n this.style({\n top: y0 + \"px\",\n left: x0 + \"px\",\n \"z-index\": 1e3\n });\n return this;\n };\n }\n var onePx = \"1px \";\n exports.makeTextShadow = function(color2) {\n var x = onePx;\n var y = onePx;\n var b = onePx;\n return x + y + b + color2 + \", -\" + x + \"-\" + y + b + color2 + \", \" + x + \"-\" + y + b + color2 + \", -\" + x + y + b + color2;\n };\n exports.makeEditable = function(context, options) {\n var gd = options.gd;\n var _delegate = options.delegate;\n var dispatch = d3.dispatch(\"edit\", \"input\", \"cancel\");\n var handlerElement = _delegate || context;\n context.style({ \"pointer-events\": _delegate ? \"none\" : \"all\" });\n if (context.size() !== 1) throw new Error(\"boo\");\n function handleClick() {\n appendEditable();\n context.style({ opacity: 0 });\n var svgClass = handlerElement.attr(\"class\");\n var mathjaxClass;\n if (svgClass) mathjaxClass = \".\" + svgClass.split(\" \")[0] + \"-math-group\";\n else mathjaxClass = \"[class*=-math-group]\";\n if (mathjaxClass) {\n d3.select(context.node().parentNode).select(mathjaxClass).style({ opacity: 0 });\n }\n }\n function selectElementContents(_el) {\n var el = _el.node();\n var range = document.createRange();\n range.selectNodeContents(el);\n var sel = window.getSelection();\n sel.removeAllRanges();\n sel.addRange(range);\n el.focus();\n }\n function appendEditable() {\n var plotDiv = d3.select(gd);\n var container = plotDiv.select(\".svg-container\");\n var div = container.append(\"div\");\n var cStyle = context.node().style;\n var fontSize = parseFloat(cStyle.fontSize || 12);\n var initialText = options.text;\n if (initialText === void 0) initialText = context.attr(\"data-unformatted\");\n div.classed(\"plugin-editable editable\", true).style({\n position: \"absolute\",\n \"font-family\": cStyle.fontFamily || \"Arial\",\n \"font-size\": fontSize,\n color: options.fill || cStyle.fill || \"black\",\n opacity: 1,\n \"background-color\": options.background || \"transparent\",\n outline: \"#ffffff33 1px solid\",\n margin: [-fontSize / 8 + 1, 0, 0, -1].join(\"px \") + \"px\",\n padding: \"0\",\n \"box-sizing\": \"border-box\"\n }).attr({ contenteditable: true }).text(initialText).call(alignHTMLWith(context, container, options)).on(\"blur\", function() {\n gd._editing = false;\n context.text(this.textContent).style({ opacity: 1 });\n var svgClass = d3.select(this).attr(\"class\");\n var mathjaxClass;\n if (svgClass) mathjaxClass = \".\" + svgClass.split(\" \")[0] + \"-math-group\";\n else mathjaxClass = \"[class*=-math-group]\";\n if (mathjaxClass) {\n d3.select(context.node().parentNode).select(mathjaxClass).style({ opacity: 0 });\n }\n var text = this.textContent;\n d3.select(this).transition().duration(0).remove();\n d3.select(document).on(\"mouseup\", null);\n dispatch.edit.call(context, text);\n }).on(\"focus\", function() {\n var editDiv = this;\n gd._editing = true;\n d3.select(document).on(\"mouseup\", function() {\n if (d3.event.target === editDiv) return false;\n if (document.activeElement === div.node()) div.node().blur();\n });\n }).on(\"keyup\", function() {\n if (d3.event.which === 27) {\n gd._editing = false;\n context.style({ opacity: 1 });\n d3.select(this).style({ opacity: 0 }).on(\"blur\", function() {\n return false;\n }).transition().remove();\n dispatch.cancel.call(context, this.textContent);\n } else {\n dispatch.input.call(context, this.textContent);\n d3.select(this).call(alignHTMLWith(context, container, options));\n }\n }).on(\"keydown\", function() {\n if (d3.event.which === 13) this.blur();\n }).call(selectElementContents);\n }\n if (options.immediate) handleClick();\n else handlerElement.on(\"click\", handleClick);\n return d3.rebind(context, dispatch, \"on\");\n };\n }\n });\n\n // src/components/colorscale/helpers.js\n var require_helpers = __commonJS({\n \"src/components/colorscale/helpers.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var tinycolor = require_tinycolor();\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var Color2 = require_color();\n var isValidScale = require_scales().isValid;\n function hasColorscale(trace, containerStr, colorKey) {\n var container = containerStr ? Lib.nestedProperty(trace, containerStr).get() || {} : trace;\n var color2 = container[colorKey || \"color\"];\n if (color2 && color2._inputArray) color2 = color2._inputArray;\n var isArrayWithOneNumber = false;\n if (Lib.isArrayOrTypedArray(color2)) {\n for (var i = 0; i < color2.length; i++) {\n if (isNumeric(color2[i])) {\n isArrayWithOneNumber = true;\n break;\n }\n }\n }\n return Lib.isPlainObject(container) && (isArrayWithOneNumber || container.showscale === true || isNumeric(container.cmin) && isNumeric(container.cmax) || isValidScale(container.colorscale) || Lib.isPlainObject(container.colorbar));\n }\n var constantAttrs = [\"showscale\", \"autocolorscale\", \"colorscale\", \"reversescale\", \"colorbar\"];\n var letterAttrs = [\"min\", \"max\", \"mid\", \"auto\"];\n function extractOpts(cont) {\n var colorAx = cont._colorAx;\n var cont2 = colorAx ? colorAx : cont;\n var out = {};\n var cLetter;\n var i, k;\n for (i = 0; i < constantAttrs.length; i++) {\n k = constantAttrs[i];\n out[k] = cont2[k];\n }\n if (colorAx) {\n cLetter = \"c\";\n for (i = 0; i < letterAttrs.length; i++) {\n k = letterAttrs[i];\n out[k] = cont2[\"c\" + k];\n }\n } else {\n var k2;\n for (i = 0; i < letterAttrs.length; i++) {\n k = letterAttrs[i];\n k2 = \"c\" + k;\n if (k2 in cont2) {\n out[k] = cont2[k2];\n continue;\n }\n k2 = \"z\" + k;\n if (k2 in cont2) {\n out[k] = cont2[k2];\n }\n }\n cLetter = k2.charAt(0);\n }\n out._sync = function(k3, v) {\n var k22 = letterAttrs.indexOf(k3) !== -1 ? cLetter + k3 : k3;\n cont2[k22] = cont2[\"_\" + k22] = v;\n };\n return out;\n }\n function extractScale(cont) {\n var cOpts = extractOpts(cont);\n var cmin = cOpts.min;\n var cmax = cOpts.max;\n var scl = cOpts.reversescale ? flipScale(cOpts.colorscale) : cOpts.colorscale;\n var N = scl.length;\n var domain = new Array(N);\n var range = new Array(N);\n for (var i = 0; i < N; i++) {\n var si = scl[i];\n domain[i] = cmin + si[0] * (cmax - cmin);\n range[i] = si[1];\n }\n return { domain, range };\n }\n function flipScale(scl) {\n var N = scl.length;\n var sclNew = new Array(N);\n for (var i = N - 1, j = 0; i >= 0; i--, j++) {\n var si = scl[i];\n sclNew[j] = [1 - si[0], si[1]];\n }\n return sclNew;\n }\n function makeColorScaleFunc(specs, opts) {\n opts = opts || {};\n var domain = specs.domain;\n var range = specs.range;\n var N = range.length;\n var _range = new Array(N);\n for (var i = 0; i < N; i++) {\n var rgba3 = tinycolor(range[i]).toRgb();\n _range[i] = [rgba3.r, rgba3.g, rgba3.b, rgba3.a];\n }\n var _sclFunc = d3.scale.linear().domain(domain).range(_range).clamp(true);\n var noNumericCheck = opts.noNumericCheck;\n var returnArray = opts.returnArray;\n var sclFunc;\n if (noNumericCheck && returnArray) {\n sclFunc = _sclFunc;\n } else if (noNumericCheck) {\n sclFunc = function(v) {\n return colorArray2rbga(_sclFunc(v));\n };\n } else if (returnArray) {\n sclFunc = function(v) {\n if (isNumeric(v)) return _sclFunc(v);\n else if (tinycolor(v).isValid()) return v;\n else return Color2.defaultLine;\n };\n } else {\n sclFunc = function(v) {\n if (isNumeric(v)) return colorArray2rbga(_sclFunc(v));\n else if (tinycolor(v).isValid()) return v;\n else return Color2.defaultLine;\n };\n }\n sclFunc.domain = _sclFunc.domain;\n sclFunc.range = function() {\n return range;\n };\n return sclFunc;\n }\n function makeColorScaleFuncFromTrace(trace, opts) {\n return makeColorScaleFunc(extractScale(trace), opts);\n }\n function colorArray2rbga(colorArray) {\n var colorObj = {\n r: colorArray[0],\n g: colorArray[1],\n b: colorArray[2],\n a: colorArray[3]\n };\n return tinycolor(colorObj).toRgbString();\n }\n module.exports = {\n hasColorscale,\n extractOpts,\n extractScale,\n flipScale,\n makeColorScaleFunc,\n makeColorScaleFuncFromTrace\n };\n }\n });\n\n // src/plots/cartesian/axis_format_attributes.js\n var require_axis_format_attributes = __commonJS({\n \"src/plots/cartesian/axis_format_attributes.js\"(exports, module) {\n \"use strict\";\n var docs = require_docs();\n var FORMAT_LINK = docs.FORMAT_LINK;\n var DATE_FORMAT_LINK = docs.DATE_FORMAT_LINK;\n function axisHoverFormat(x, noDates) {\n return {\n valType: \"string\",\n dflt: \"\",\n editType: \"none\",\n description: (noDates ? descriptionOnlyNumbers : descriptionWithDates)(\"hover text\", x) + [\n \"By default the values are formatted using \" + (noDates ? \"generic number format\" : \"`\" + x + \"axis.hoverformat`\") + \".\"\n ].join(\" \")\n };\n }\n function descriptionOnlyNumbers(label, x) {\n return [\n \"Sets the \" + label + \" formatting rule\" + (x ? \"for `\" + x + \"` \" : \"\"),\n \"using d3 formatting mini-languages\",\n \"which are very similar to those in Python. For numbers, see: \" + FORMAT_LINK + \".\"\n ].join(\" \");\n }\n function descriptionWithDates(label, x) {\n return descriptionOnlyNumbers(label, x) + [\n \" And for dates see: \" + DATE_FORMAT_LINK + \".\",\n \"We add two items to d3's date formatter:\",\n \"*%h* for half of the year as a decimal number as well as\",\n \"*%{n}f* for fractional seconds\",\n \"with n digits. For example, *2016-10-13 09:15:23.456* with tickformat\",\n \"*%H~%M~%S.%2f* would display *09~15~23.46*\"\n ].join(\" \");\n }\n module.exports = {\n axisHoverFormat,\n descriptionOnlyNumbers,\n descriptionWithDates\n };\n }\n });\n\n // src/plots/cartesian/layout_attributes.js\n var require_layout_attributes4 = __commonJS({\n \"src/plots/cartesian/layout_attributes.js\"(exports, module) {\n \"use strict\";\n var fontAttrs = require_font_attributes();\n var colorAttrs = require_attributes3();\n var dash = require_attributes4().dash;\n var extendFlat = require_extend().extendFlat;\n var templatedArray = require_plot_template().templatedArray;\n var descriptionWithDates = require_axis_format_attributes().descriptionWithDates;\n var ONEDAY = require_numerical().ONEDAY;\n var constants = require_constants2();\n var HOUR = constants.HOUR_PATTERN;\n var DAY_OF_WEEK = constants.WEEKDAY_PATTERN;\n var minorTickmode = {\n valType: \"enumerated\",\n values: [\"auto\", \"linear\", \"array\"],\n editType: \"ticks\",\n impliedEdits: { tick0: void 0, dtick: void 0 }\n };\n var tickmode = extendFlat({}, minorTickmode, {\n values: minorTickmode.values.slice().concat([\"sync\"])\n });\n function makeNticks(minor) {\n return {\n valType: \"integer\",\n min: 0,\n dflt: minor ? 5 : 0,\n editType: \"ticks\"\n };\n }\n var tick0 = {\n valType: \"any\",\n editType: \"ticks\",\n impliedEdits: { tickmode: \"linear\" }\n };\n var dtick = {\n valType: \"any\",\n editType: \"ticks\",\n impliedEdits: { tickmode: \"linear\" }\n };\n var tickvals = {\n valType: \"data_array\",\n editType: \"ticks\"\n };\n var ticks = {\n valType: \"enumerated\",\n values: [\"outside\", \"inside\", \"\"],\n editType: \"ticks\"\n };\n function makeTicklen(minor) {\n var obj = {\n valType: \"number\",\n min: 0,\n editType: \"ticks\"\n };\n if (!minor) obj.dflt = 5;\n return obj;\n }\n function makeTickwidth(minor) {\n var obj = {\n valType: \"number\",\n min: 0,\n editType: \"ticks\"\n };\n if (!minor) obj.dflt = 1;\n return obj;\n }\n var tickcolor = {\n valType: \"color\",\n dflt: colorAttrs.defaultLine,\n editType: \"ticks\"\n };\n var gridcolor = {\n valType: \"color\",\n dflt: colorAttrs.lightLine,\n editType: \"ticks\"\n };\n function makeGridwidth(minor) {\n var obj = {\n valType: \"number\",\n min: 0,\n editType: \"ticks\"\n };\n if (!minor) obj.dflt = 1;\n return obj;\n }\n var griddash = extendFlat({}, dash, { editType: \"ticks\" });\n var showgrid = {\n valType: \"boolean\",\n editType: \"ticks\"\n };\n module.exports = {\n visible: {\n valType: \"boolean\",\n editType: \"plot\"\n },\n color: {\n valType: \"color\",\n dflt: colorAttrs.defaultLine,\n editType: \"ticks\"\n },\n title: {\n text: {\n valType: \"string\",\n editType: \"ticks\"\n },\n font: fontAttrs({\n editType: \"ticks\"\n }),\n standoff: {\n valType: \"number\",\n min: 0,\n editType: \"ticks\"\n },\n editType: \"ticks\"\n },\n type: {\n valType: \"enumerated\",\n // '-' means we haven't yet run autotype or couldn't find any data\n // it gets turned into linear in gd._fullLayout but not copied back\n // to gd.data like the others are.\n values: [\"-\", \"linear\", \"log\", \"date\", \"category\", \"multicategory\"],\n dflt: \"-\",\n editType: \"calc\",\n // we forget when an axis has been autotyped, just writing the auto\n // value back to the input - so it doesn't make sense to template this.\n // Note: we do NOT prohibit this in `coerce`, so if someone enters a\n // type in the template explicitly it will be honored as the default.\n _noTemplating: true\n },\n autotypenumbers: {\n valType: \"enumerated\",\n values: [\"convert types\", \"strict\"],\n dflt: \"convert types\",\n editType: \"calc\"\n },\n autorange: {\n valType: \"enumerated\",\n values: [true, false, \"reversed\", \"min reversed\", \"max reversed\", \"min\", \"max\"],\n dflt: true,\n editType: \"axrange\",\n impliedEdits: { \"range[0]\": void 0, \"range[1]\": void 0 }\n },\n autorangeoptions: {\n minallowed: {\n valType: \"any\",\n editType: \"plot\",\n impliedEdits: { \"range[0]\": void 0, \"range[1]\": void 0 }\n },\n maxallowed: {\n valType: \"any\",\n editType: \"plot\",\n impliedEdits: { \"range[0]\": void 0, \"range[1]\": void 0 }\n },\n clipmin: {\n valType: \"any\",\n editType: \"plot\",\n impliedEdits: { \"range[0]\": void 0, \"range[1]\": void 0 }\n },\n clipmax: {\n valType: \"any\",\n editType: \"plot\",\n impliedEdits: { \"range[0]\": void 0, \"range[1]\": void 0 }\n },\n include: {\n valType: \"any\",\n arrayOk: true,\n editType: \"plot\",\n impliedEdits: { \"range[0]\": void 0, \"range[1]\": void 0 }\n },\n editType: \"plot\"\n },\n rangemode: {\n valType: \"enumerated\",\n values: [\"normal\", \"tozero\", \"nonnegative\"],\n dflt: \"normal\",\n editType: \"plot\"\n },\n range: {\n valType: \"info_array\",\n items: [\n { valType: \"any\", editType: \"axrange\", impliedEdits: { \"^autorange\": false }, anim: true },\n { valType: \"any\", editType: \"axrange\", impliedEdits: { \"^autorange\": false }, anim: true }\n ],\n editType: \"axrange\",\n impliedEdits: { autorange: false },\n anim: true\n },\n minallowed: {\n valType: \"any\",\n editType: \"plot\",\n impliedEdits: { \"^autorange\": false }\n },\n maxallowed: {\n valType: \"any\",\n editType: \"plot\",\n impliedEdits: { \"^autorange\": false }\n },\n fixedrange: {\n valType: \"boolean\",\n dflt: false,\n editType: \"calc\"\n },\n insiderange: {\n valType: \"info_array\",\n items: [\n { valType: \"any\", editType: \"plot\" },\n { valType: \"any\", editType: \"plot\" }\n ],\n editType: \"plot\"\n },\n // scaleanchor: not used directly, just put here for reference\n // values are any opposite-letter axis id, or `false`.\n scaleanchor: {\n valType: \"enumerated\",\n values: [\n constants.idRegex.x.toString(),\n constants.idRegex.y.toString(),\n false\n ],\n editType: \"plot\"\n },\n scaleratio: {\n valType: \"number\",\n min: 0,\n dflt: 1,\n editType: \"plot\"\n },\n constrain: {\n valType: \"enumerated\",\n values: [\"range\", \"domain\"],\n editType: \"plot\"\n },\n // constraintoward: not used directly, just put here for reference\n constraintoward: {\n valType: \"enumerated\",\n values: [\"left\", \"center\", \"right\", \"top\", \"middle\", \"bottom\"],\n editType: \"plot\"\n },\n matches: {\n valType: \"enumerated\",\n values: [\n constants.idRegex.x.toString(),\n constants.idRegex.y.toString()\n ],\n editType: \"calc\"\n },\n rangebreaks: templatedArray(\"rangebreak\", {\n enabled: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc\"\n },\n bounds: {\n valType: \"info_array\",\n items: [\n { valType: \"any\", editType: \"calc\" },\n { valType: \"any\", editType: \"calc\" }\n ],\n editType: \"calc\"\n },\n pattern: {\n valType: \"enumerated\",\n values: [DAY_OF_WEEK, HOUR, \"\"],\n editType: \"calc\"\n },\n values: {\n valType: \"info_array\",\n freeLength: true,\n editType: \"calc\",\n items: {\n valType: \"any\",\n editType: \"calc\"\n }\n },\n dvalue: {\n // TODO could become 'any' to add support for 'months', 'years'\n valType: \"number\",\n editType: \"calc\",\n min: 0,\n dflt: ONEDAY\n },\n /*\n gap: {\n valType: 'number',\n min: 0,\n dflt: 0, // for *date* axes, maybe something else for *linear*\n editType: 'calc',\n },\n gapmode: {\n valType: 'enumerated',\n values: ['pixels', 'fraction'],\n dflt: 'pixels',\n editType: 'calc',\n },\n */\n // To complete https://github.com/plotly/plotly.js/issues/4210\n // we additionally need `gap` and make this work on *linear*, and\n // possibly all other cartesian axis types. We possibly would also need\n // some style attributes controlling the zig-zag on the corresponding\n // axis.\n editType: \"calc\"\n }),\n // ticks\n tickmode,\n nticks: makeNticks(),\n tick0,\n dtick,\n ticklabelstep: {\n valType: \"integer\",\n min: 1,\n dflt: 1,\n editType: \"ticks\"\n },\n tickvals,\n ticktext: {\n valType: \"data_array\",\n editType: \"ticks\"\n },\n ticks,\n tickson: {\n valType: \"enumerated\",\n values: [\"labels\", \"boundaries\"],\n dflt: \"labels\",\n editType: \"ticks\"\n },\n ticklabelmode: {\n valType: \"enumerated\",\n values: [\"instant\", \"period\"],\n dflt: \"instant\",\n editType: \"ticks\"\n },\n // ticklabelposition: not used directly, as values depend on direction (similar to side)\n // left/right options are for x axes, and top/bottom options are for y axes\n ticklabelposition: {\n valType: \"enumerated\",\n values: [\n \"outside\",\n \"inside\",\n \"outside top\",\n \"inside top\",\n \"outside left\",\n \"inside left\",\n \"outside right\",\n \"inside right\",\n \"outside bottom\",\n \"inside bottom\"\n ],\n dflt: \"outside\",\n editType: \"calc\"\n },\n ticklabeloverflow: {\n valType: \"enumerated\",\n values: [\n \"allow\",\n \"hide past div\",\n \"hide past domain\"\n ],\n editType: \"calc\"\n },\n ticklabelshift: {\n valType: \"integer\",\n dflt: 0,\n editType: \"ticks\"\n },\n ticklabelstandoff: {\n valType: \"integer\",\n dflt: 0,\n editType: \"ticks\"\n },\n ticklabelindex: {\n // in the future maybe add `extras: ['all', 'minor']` to allow showing labels for all ticks\n // or for all minor ticks.\n valType: \"integer\",\n arrayOk: true,\n editType: \"calc\"\n },\n mirror: {\n valType: \"enumerated\",\n values: [true, \"ticks\", false, \"all\", \"allticks\"],\n dflt: false,\n editType: \"ticks+layoutstyle\"\n },\n ticklen: makeTicklen(),\n tickwidth: makeTickwidth(),\n tickcolor,\n showticklabels: {\n valType: \"boolean\",\n dflt: true,\n editType: \"ticks\"\n },\n labelalias: {\n valType: \"any\",\n dflt: false,\n editType: \"ticks\"\n },\n automargin: {\n valType: \"flaglist\",\n flags: [\"height\", \"width\", \"left\", \"right\", \"top\", \"bottom\"],\n extras: [true, false],\n dflt: false,\n editType: \"ticks\"\n },\n showspikes: {\n valType: \"boolean\",\n dflt: false,\n editType: \"modebar\"\n },\n spikecolor: {\n valType: \"color\",\n dflt: null,\n editType: \"none\"\n },\n spikethickness: {\n valType: \"number\",\n dflt: 3,\n editType: \"none\"\n },\n spikedash: extendFlat({}, dash, { dflt: \"dash\", editType: \"none\" }),\n spikemode: {\n valType: \"flaglist\",\n flags: [\"toaxis\", \"across\", \"marker\"],\n dflt: \"toaxis\",\n editType: \"none\"\n },\n spikesnap: {\n valType: \"enumerated\",\n values: [\"data\", \"cursor\", \"hovered data\"],\n dflt: \"hovered data\",\n editType: \"none\"\n },\n tickfont: fontAttrs({\n editType: \"ticks\"\n }),\n tickangle: {\n valType: \"angle\",\n dflt: \"auto\",\n editType: \"ticks\"\n },\n autotickangles: {\n valType: \"info_array\",\n freeLength: true,\n items: {\n valType: \"angle\"\n },\n dflt: [0, 30, 90],\n editType: \"ticks\"\n },\n tickprefix: {\n valType: \"string\",\n dflt: \"\",\n editType: \"ticks\"\n },\n showtickprefix: {\n valType: \"enumerated\",\n values: [\"all\", \"first\", \"last\", \"none\"],\n dflt: \"all\",\n editType: \"ticks\"\n },\n ticksuffix: {\n valType: \"string\",\n dflt: \"\",\n editType: \"ticks\"\n },\n showticksuffix: {\n valType: \"enumerated\",\n values: [\"all\", \"first\", \"last\", \"none\"],\n dflt: \"all\",\n editType: \"ticks\"\n },\n showexponent: {\n valType: \"enumerated\",\n values: [\"all\", \"first\", \"last\", \"none\"],\n dflt: \"all\",\n editType: \"ticks\"\n },\n exponentformat: {\n valType: \"enumerated\",\n values: [\"none\", \"e\", \"E\", \"power\", \"SI\", \"B\"],\n dflt: \"B\",\n editType: \"ticks\"\n },\n minexponent: {\n valType: \"number\",\n dflt: 3,\n min: 0,\n editType: \"ticks\"\n },\n separatethousands: {\n valType: \"boolean\",\n dflt: false,\n editType: \"ticks\"\n },\n tickformat: {\n valType: \"string\",\n dflt: \"\",\n editType: \"ticks\",\n description: descriptionWithDates(\"tick label\")\n },\n tickformatstops: templatedArray(\"tickformatstop\", {\n enabled: {\n valType: \"boolean\",\n dflt: true,\n editType: \"ticks\"\n },\n dtickrange: {\n valType: \"info_array\",\n items: [\n { valType: \"any\", editType: \"ticks\" },\n { valType: \"any\", editType: \"ticks\" }\n ],\n editType: \"ticks\"\n },\n value: {\n valType: \"string\",\n dflt: \"\",\n editType: \"ticks\"\n },\n editType: \"ticks\"\n }),\n hoverformat: {\n valType: \"string\",\n dflt: \"\",\n editType: \"none\",\n description: descriptionWithDates(\"hover text\")\n },\n // lines and grids\n showline: {\n valType: \"boolean\",\n dflt: false,\n editType: \"ticks+layoutstyle\"\n },\n linecolor: {\n valType: \"color\",\n dflt: colorAttrs.defaultLine,\n editType: \"layoutstyle\"\n },\n linewidth: {\n valType: \"number\",\n min: 0,\n dflt: 1,\n editType: \"ticks+layoutstyle\"\n },\n showgrid,\n gridcolor,\n gridwidth: makeGridwidth(),\n griddash,\n zeroline: {\n valType: \"boolean\",\n editType: \"ticks\"\n },\n zerolinecolor: {\n valType: \"color\",\n dflt: colorAttrs.defaultLine,\n editType: \"ticks\"\n },\n zerolinewidth: {\n valType: \"number\",\n dflt: 1,\n editType: \"ticks\"\n },\n showdividers: {\n valType: \"boolean\",\n dflt: true,\n editType: \"ticks\"\n },\n dividercolor: {\n valType: \"color\",\n dflt: colorAttrs.defaultLine,\n editType: \"ticks\"\n },\n dividerwidth: {\n valType: \"number\",\n dflt: 1,\n editType: \"ticks\"\n },\n // TODO dividerlen: that would override \"to label base\" length?\n // positioning attributes\n // anchor: not used directly, just put here for reference\n // values are any opposite-letter axis id\n anchor: {\n valType: \"enumerated\",\n values: [\n \"free\",\n constants.idRegex.x.toString(),\n constants.idRegex.y.toString()\n ],\n editType: \"plot\"\n },\n // side: not used directly, as values depend on direction\n // values are top, bottom for x axes, and left, right for y\n side: {\n valType: \"enumerated\",\n values: [\"top\", \"bottom\", \"left\", \"right\"],\n editType: \"plot\"\n },\n // overlaying: not used directly, just put here for reference\n // values are false and any other same-letter axis id that's not\n // itself overlaying anything\n overlaying: {\n valType: \"enumerated\",\n values: [\n \"free\",\n constants.idRegex.x.toString(),\n constants.idRegex.y.toString()\n ],\n editType: \"plot\"\n },\n minor: {\n tickmode: minorTickmode,\n nticks: makeNticks(\"minor\"),\n tick0,\n dtick,\n tickvals,\n ticks,\n ticklen: makeTicklen(\"minor\"),\n tickwidth: makeTickwidth(\"minor\"),\n tickcolor,\n gridcolor,\n gridwidth: makeGridwidth(\"minor\"),\n griddash,\n showgrid,\n editType: \"ticks\"\n },\n layer: {\n valType: \"enumerated\",\n values: [\"above traces\", \"below traces\"],\n dflt: \"above traces\",\n editType: \"plot\"\n },\n domain: {\n valType: \"info_array\",\n items: [\n { valType: \"number\", min: 0, max: 1, editType: \"plot\" },\n { valType: \"number\", min: 0, max: 1, editType: \"plot\" }\n ],\n dflt: [0, 1],\n editType: \"plot\"\n },\n position: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0,\n editType: \"plot\"\n },\n autoshift: {\n valType: \"boolean\",\n dflt: false,\n editType: \"plot\"\n },\n shift: {\n valType: \"number\",\n editType: \"plot\"\n },\n categoryorder: {\n valType: \"enumerated\",\n values: [\n \"trace\",\n \"category ascending\",\n \"category descending\",\n \"array\",\n \"total ascending\",\n \"total descending\",\n \"min ascending\",\n \"min descending\",\n \"max ascending\",\n \"max descending\",\n \"sum ascending\",\n \"sum descending\",\n \"mean ascending\",\n \"mean descending\",\n \"geometric mean ascending\",\n \"geometric mean descending\",\n \"median ascending\",\n \"median descending\"\n ],\n dflt: \"trace\",\n editType: \"calc\"\n },\n categoryarray: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n uirevision: {\n valType: \"any\",\n editType: \"none\"\n },\n editType: \"calc\"\n };\n }\n });\n\n // src/components/colorbar/attributes.js\n var require_attributes7 = __commonJS({\n \"src/components/colorbar/attributes.js\"(exports, module) {\n \"use strict\";\n var axesAttrs = require_layout_attributes4();\n var fontAttrs = require_font_attributes();\n var extendFlat = require_extend().extendFlat;\n var overrideAll = require_edit_types().overrideAll;\n module.exports = overrideAll({\n orientation: {\n valType: \"enumerated\",\n values: [\"h\", \"v\"],\n dflt: \"v\"\n },\n thicknessmode: {\n valType: \"enumerated\",\n values: [\"fraction\", \"pixels\"],\n dflt: \"pixels\"\n },\n thickness: {\n valType: \"number\",\n min: 0,\n dflt: 30\n },\n lenmode: {\n valType: \"enumerated\",\n values: [\"fraction\", \"pixels\"],\n dflt: \"fraction\"\n },\n len: {\n valType: \"number\",\n min: 0,\n dflt: 1\n },\n x: {\n valType: \"number\"\n },\n xref: {\n valType: \"enumerated\",\n dflt: \"paper\",\n values: [\"container\", \"paper\"],\n editType: \"layoutstyle\"\n },\n xanchor: {\n valType: \"enumerated\",\n values: [\"left\", \"center\", \"right\"]\n },\n xpad: {\n valType: \"number\",\n min: 0,\n dflt: 10\n },\n y: {\n valType: \"number\"\n },\n yref: {\n valType: \"enumerated\",\n dflt: \"paper\",\n values: [\"container\", \"paper\"],\n editType: \"layoutstyle\"\n },\n yanchor: {\n valType: \"enumerated\",\n values: [\"top\", \"middle\", \"bottom\"]\n },\n ypad: {\n valType: \"number\",\n min: 0,\n dflt: 10\n },\n // a possible line around the bar itself\n outlinecolor: axesAttrs.linecolor,\n outlinewidth: axesAttrs.linewidth,\n // Should outlinewidth have {dflt: 0} ?\n // another possible line outside the padding and tick labels\n bordercolor: axesAttrs.linecolor,\n borderwidth: {\n valType: \"number\",\n min: 0,\n dflt: 0\n },\n bgcolor: {\n valType: \"color\",\n dflt: \"rgba(0,0,0,0)\"\n },\n // tick and title properties named and function exactly as in axes\n tickmode: axesAttrs.minor.tickmode,\n nticks: axesAttrs.nticks,\n tick0: axesAttrs.tick0,\n dtick: axesAttrs.dtick,\n tickvals: axesAttrs.tickvals,\n ticktext: axesAttrs.ticktext,\n ticks: extendFlat({}, axesAttrs.ticks, { dflt: \"\" }),\n ticklabeloverflow: extendFlat({}, axesAttrs.ticklabeloverflow, {}),\n // ticklabelposition: not used directly, as values depend on orientation\n // left/right options are for x axes, and top/bottom options are for y axes\n ticklabelposition: {\n valType: \"enumerated\",\n values: [\n \"outside\",\n \"inside\",\n \"outside top\",\n \"inside top\",\n \"outside left\",\n \"inside left\",\n \"outside right\",\n \"inside right\",\n \"outside bottom\",\n \"inside bottom\"\n ],\n dflt: \"outside\"\n },\n ticklen: axesAttrs.ticklen,\n tickwidth: axesAttrs.tickwidth,\n tickcolor: axesAttrs.tickcolor,\n ticklabelstep: axesAttrs.ticklabelstep,\n showticklabels: axesAttrs.showticklabels,\n labelalias: axesAttrs.labelalias,\n tickfont: fontAttrs({}),\n tickangle: axesAttrs.tickangle,\n tickformat: axesAttrs.tickformat,\n tickformatstops: axesAttrs.tickformatstops,\n tickprefix: axesAttrs.tickprefix,\n showtickprefix: axesAttrs.showtickprefix,\n ticksuffix: axesAttrs.ticksuffix,\n showticksuffix: axesAttrs.showticksuffix,\n separatethousands: axesAttrs.separatethousands,\n exponentformat: axesAttrs.exponentformat,\n minexponent: axesAttrs.minexponent,\n showexponent: axesAttrs.showexponent,\n title: {\n text: {\n valType: \"string\"\n },\n font: fontAttrs({}),\n side: {\n valType: \"enumerated\",\n values: [\"right\", \"top\", \"bottom\"]\n }\n }\n }, \"colorbars\", \"from-root\");\n }\n });\n\n // src/components/colorscale/attributes.js\n var require_attributes8 = __commonJS({\n \"src/components/colorscale/attributes.js\"(exports, module) {\n \"use strict\";\n var colorbarAttrs = require_attributes7();\n var counterRegex = require_regex().counter;\n var sortObjectKeys = require_sort_object_keys();\n var palettes = require_scales().scales;\n var paletteStr = sortObjectKeys(palettes);\n function code(s) {\n return \"`\" + s + \"`\";\n }\n module.exports = function colorScaleAttrs(context, opts) {\n context = context || \"\";\n opts = opts || {};\n var cLetter = opts.cLetter || \"c\";\n var onlyIfNumerical = \"onlyIfNumerical\" in opts ? opts.onlyIfNumerical : Boolean(context);\n var noScale = \"noScale\" in opts ? opts.noScale : context === \"marker.line\";\n var showScaleDflt = \"showScaleDflt\" in opts ? opts.showScaleDflt : cLetter === \"z\";\n var colorscaleDflt = typeof opts.colorscaleDflt === \"string\" ? palettes[opts.colorscaleDflt] : null;\n var editTypeOverride = opts.editTypeOverride || \"\";\n var contextHead = context ? context + \".\" : \"\";\n var colorAttr, colorAttrFull;\n if (\"colorAttr\" in opts) {\n colorAttr = opts.colorAttr;\n colorAttrFull = opts.colorAttr;\n } else {\n colorAttr = { z: \"z\", c: \"color\" }[cLetter];\n colorAttrFull = \"in \" + code(contextHead + colorAttr);\n }\n var effectDesc = onlyIfNumerical ? \" Has an effect only if \" + colorAttrFull + \" is set to a numerical array.\" : \"\";\n var auto = cLetter + \"auto\";\n var min = cLetter + \"min\";\n var max = cLetter + \"max\";\n var mid = cLetter + \"mid\";\n var autoFull = code(contextHead + auto);\n var minFull = code(contextHead + min);\n var maxFull = code(contextHead + max);\n var minmaxFull = minFull + \" and \" + maxFull;\n var autoImpliedEdits = {};\n autoImpliedEdits[min] = autoImpliedEdits[max] = void 0;\n var minmaxImpliedEdits = {};\n minmaxImpliedEdits[auto] = false;\n var attrs = {};\n if (colorAttr === \"color\") {\n attrs.color = {\n valType: \"color\",\n arrayOk: true,\n editType: editTypeOverride || \"style\"\n };\n if (opts.anim) {\n attrs.color.anim = true;\n }\n }\n attrs[auto] = {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc\",\n impliedEdits: autoImpliedEdits\n };\n attrs[min] = {\n valType: \"number\",\n dflt: null,\n editType: editTypeOverride || \"plot\",\n impliedEdits: minmaxImpliedEdits\n };\n attrs[max] = {\n valType: \"number\",\n dflt: null,\n editType: editTypeOverride || \"plot\",\n impliedEdits: minmaxImpliedEdits\n };\n attrs[mid] = {\n valType: \"number\",\n dflt: null,\n editType: \"calc\",\n impliedEdits: autoImpliedEdits\n };\n attrs.colorscale = {\n valType: \"colorscale\",\n editType: \"calc\",\n dflt: colorscaleDflt,\n impliedEdits: { autocolorscale: false }\n };\n attrs.autocolorscale = {\n valType: \"boolean\",\n // gets overrode in 'heatmap' & 'surface' for backwards comp.\n dflt: opts.autoColorDflt === false ? false : true,\n editType: \"calc\",\n impliedEdits: { colorscale: void 0 }\n };\n attrs.reversescale = {\n valType: \"boolean\",\n dflt: false,\n editType: \"plot\"\n };\n if (!noScale) {\n attrs.showscale = {\n valType: \"boolean\",\n dflt: showScaleDflt,\n editType: \"calc\"\n };\n attrs.colorbar = colorbarAttrs;\n }\n if (!opts.noColorAxis) {\n attrs.coloraxis = {\n valType: \"subplotid\",\n regex: counterRegex(\"coloraxis\"),\n dflt: null,\n editType: \"calc\"\n };\n }\n return attrs;\n };\n }\n });\n\n // src/components/colorscale/layout_attributes.js\n var require_layout_attributes5 = __commonJS({\n \"src/components/colorscale/layout_attributes.js\"(exports, module) {\n \"use strict\";\n var extendFlat = require_extend().extendFlat;\n var colorScaleAttrs = require_attributes8();\n var scales = require_scales().scales;\n module.exports = {\n editType: \"calc\",\n colorscale: {\n editType: \"calc\",\n sequential: {\n valType: \"colorscale\",\n dflt: scales.Reds,\n editType: \"calc\"\n },\n sequentialminus: {\n valType: \"colorscale\",\n dflt: scales.Blues,\n editType: \"calc\"\n },\n diverging: {\n valType: \"colorscale\",\n dflt: scales.RdBu,\n editType: \"calc\"\n }\n },\n coloraxis: extendFlat({\n // not really a 'subplot' attribute container,\n // but this is the flag we use to denote attributes that\n // support yaxis, yaxis2, yaxis3, ... counters\n _isSubplotObj: true,\n editType: \"calc\"\n }, colorScaleAttrs(\"\", {\n colorAttr: \"corresponding trace color array(s)\",\n noColorAxis: true,\n showScaleDflt: true\n }))\n };\n }\n });\n\n // src/components/colorbar/has_colorbar.js\n var require_has_colorbar = __commonJS({\n \"src/components/colorbar/has_colorbar.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n module.exports = function hasColorbar(container) {\n return Lib.isPlainObject(container.colorbar);\n };\n }\n });\n\n // src/plots/cartesian/clean_ticks.js\n var require_clean_ticks = __commonJS({\n \"src/plots/cartesian/clean_ticks.js\"(exports) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var constants = require_numerical();\n var ONEDAY = constants.ONEDAY;\n var ONEWEEK = constants.ONEWEEK;\n exports.dtick = function(dtick, axType) {\n var isLog = axType === \"log\";\n var isDate = axType === \"date\";\n var isCat = axType === \"category\";\n var dtickDflt = isDate ? ONEDAY : 1;\n if (!dtick) return dtickDflt;\n if (isNumeric(dtick)) {\n dtick = Number(dtick);\n if (dtick <= 0) return dtickDflt;\n if (isCat) {\n return Math.max(1, Math.round(dtick));\n }\n if (isDate) {\n return Math.max(0.1, dtick);\n }\n return dtick;\n }\n if (typeof dtick !== \"string\" || !(isDate || isLog)) {\n return dtickDflt;\n }\n var prefix = dtick.charAt(0);\n var dtickNum = dtick.substr(1);\n dtickNum = isNumeric(dtickNum) ? Number(dtickNum) : 0;\n if (dtickNum <= 0 || !// \"M\" gives ticks every (integer) n months\n (isDate && prefix === \"M\" && dtickNum === Math.round(dtickNum) || // \"L\" gives ticks linearly spaced in data (not in position) every (float) f\n isLog && prefix === \"L\" || // \"D1\" gives powers of 10 with all small digits between, \"D2\" gives only 2 and 5\n isLog && prefix === \"D\" && (dtickNum === 1 || dtickNum === 2))) {\n return dtickDflt;\n }\n return dtick;\n };\n exports.tick0 = function(tick0, axType, calendar, dtick) {\n if (axType === \"date\") {\n return Lib.cleanDate(\n tick0,\n Lib.dateTick0(calendar, dtick % ONEWEEK === 0 ? 1 : 0)\n );\n }\n if (dtick === \"D1\" || dtick === \"D2\") {\n return void 0;\n }\n return isNumeric(tick0) ? Number(tick0) : 0;\n };\n }\n });\n\n // src/plots/cartesian/tick_value_defaults.js\n var require_tick_value_defaults = __commonJS({\n \"src/plots/cartesian/tick_value_defaults.js\"(exports, module) {\n \"use strict\";\n var cleanTicks = require_clean_ticks();\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n var isTypedArraySpec = require_array().isTypedArraySpec;\n var decodeTypedArraySpec = require_array().decodeTypedArraySpec;\n module.exports = function handleTickValueDefaults(containerIn, containerOut, coerce, axType, opts) {\n if (!opts) opts = {};\n var isMinor = opts.isMinor;\n var cIn = isMinor ? containerIn.minor || {} : containerIn;\n var cOut = isMinor ? containerOut.minor : containerOut;\n var prefix = isMinor ? \"minor.\" : \"\";\n function readInput(attr) {\n var v = cIn[attr];\n if (isTypedArraySpec(v)) v = decodeTypedArraySpec(v);\n return v !== void 0 ? v : (cOut._template || {})[attr];\n }\n var _tick0 = readInput(\"tick0\");\n var _dtick = readInput(\"dtick\");\n var _tickvals = readInput(\"tickvals\");\n var tickmodeDefault = isArrayOrTypedArray(_tickvals) ? \"array\" : _dtick ? \"linear\" : \"auto\";\n var tickmode = coerce(prefix + \"tickmode\", tickmodeDefault);\n if (tickmode === \"auto\" || tickmode === \"sync\") {\n coerce(prefix + \"nticks\");\n } else if (tickmode === \"linear\") {\n var dtick = cOut.dtick = cleanTicks.dtick(\n _dtick,\n axType\n );\n cOut.tick0 = cleanTicks.tick0(\n _tick0,\n axType,\n containerOut.calendar,\n dtick\n );\n } else if (axType !== \"multicategory\") {\n var tickvals = coerce(prefix + \"tickvals\");\n if (tickvals === void 0) cOut.tickmode = \"auto\";\n else if (!isMinor) coerce(\"ticktext\");\n }\n };\n }\n });\n\n // src/plots/cartesian/tick_mark_defaults.js\n var require_tick_mark_defaults = __commonJS({\n \"src/plots/cartesian/tick_mark_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var layoutAttributes = require_layout_attributes4();\n module.exports = function handleTickMarkDefaults(containerIn, containerOut, coerce, options) {\n var isMinor = options.isMinor;\n var cIn = isMinor ? containerIn.minor || {} : containerIn;\n var cOut = isMinor ? containerOut.minor : containerOut;\n var lAttr = isMinor ? layoutAttributes.minor : layoutAttributes;\n var prefix = isMinor ? \"minor.\" : \"\";\n var tickLen = Lib.coerce2(cIn, cOut, lAttr, \"ticklen\", isMinor ? (containerOut.ticklen || 5) * 0.6 : void 0);\n var tickWidth = Lib.coerce2(cIn, cOut, lAttr, \"tickwidth\", isMinor ? containerOut.tickwidth || 1 : void 0);\n var tickColor = Lib.coerce2(cIn, cOut, lAttr, \"tickcolor\", (isMinor ? containerOut.tickcolor : void 0) || cOut.color);\n var showTicks = coerce(prefix + \"ticks\", !isMinor && options.outerTicks || tickLen || tickWidth || tickColor ? \"outside\" : \"\");\n if (!showTicks) {\n delete cOut.ticklen;\n delete cOut.tickwidth;\n delete cOut.tickcolor;\n }\n };\n }\n });\n\n // src/plots/cartesian/show_dflt.js\n var require_show_dflt = __commonJS({\n \"src/plots/cartesian/show_dflt.js\"(exports, module) {\n \"use strict\";\n module.exports = function getShowAttrDflt(containerIn) {\n var showAttrsAll = [\"showexponent\", \"showtickprefix\", \"showticksuffix\"];\n var showAttrs = showAttrsAll.filter(function(a) {\n return containerIn[a] !== void 0;\n });\n var sameVal = function(a) {\n return containerIn[a] === containerIn[showAttrs[0]];\n };\n if (showAttrs.every(sameVal) || showAttrs.length === 1) {\n return containerIn[showAttrs[0]];\n }\n };\n }\n });\n\n // src/plots/array_container_defaults.js\n var require_array_container_defaults = __commonJS({\n \"src/plots/array_container_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Template = require_plot_template();\n module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut, opts) {\n var name2 = opts.name;\n var inclusionAttr = opts.inclusionAttr || \"visible\";\n var previousContOut = parentObjOut[name2];\n var contIn = Lib.isArrayOrTypedArray(parentObjIn[name2]) ? parentObjIn[name2] : [];\n var contOut = parentObjOut[name2] = [];\n var templater = Template.arrayTemplater(parentObjOut, name2, inclusionAttr);\n var i, itemOut;\n for (i = 0; i < contIn.length; i++) {\n var itemIn = contIn[i];\n if (!Lib.isPlainObject(itemIn)) {\n itemOut = templater.newItem({});\n itemOut[inclusionAttr] = false;\n } else {\n itemOut = templater.newItem(itemIn);\n }\n itemOut._index = i;\n if (itemOut[inclusionAttr] !== false) {\n opts.handleItemDefaults(itemIn, itemOut, parentObjOut, opts);\n }\n contOut.push(itemOut);\n }\n var defaultItems = templater.defaultItems();\n for (i = 0; i < defaultItems.length; i++) {\n itemOut = defaultItems[i];\n itemOut._index = contOut.length;\n opts.handleItemDefaults({}, itemOut, parentObjOut, opts, {});\n contOut.push(itemOut);\n }\n if (Lib.isArrayOrTypedArray(previousContOut)) {\n var len = Math.min(previousContOut.length, contOut.length);\n for (i = 0; i < len; i++) {\n Lib.relinkPrivateKeys(contOut[i], previousContOut[i]);\n }\n }\n return contOut;\n };\n }\n });\n\n // src/plots/cartesian/tick_label_defaults.js\n var require_tick_label_defaults = __commonJS({\n \"src/plots/cartesian/tick_label_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var contrast = require_color().contrast;\n var layoutAttributes = require_layout_attributes4();\n var getShowAttrDflt = require_show_dflt();\n var handleArrayContainerDefaults = require_array_container_defaults();\n module.exports = function handleTickLabelDefaults(containerIn, containerOut, coerce, axType, options) {\n if (!options) options = {};\n var labelalias = coerce(\"labelalias\");\n if (!Lib.isPlainObject(labelalias)) delete containerOut.labelalias;\n var showAttrDflt = getShowAttrDflt(containerIn);\n var showTickLabels = coerce(\"showticklabels\");\n if (showTickLabels) {\n if (!options.noTicklabelshift) {\n coerce(\"ticklabelshift\");\n }\n if (!options.noTicklabelstandoff) {\n coerce(\"ticklabelstandoff\");\n }\n var font = options.font || {};\n var contColor = containerOut.color;\n var position = containerOut.ticklabelposition || \"\";\n var dfltFontColor = position.indexOf(\"inside\") !== -1 ? contrast(options.bgColor) : (\n // as with title.font.color, inherit axis.color only if one was\n // explicitly provided\n contColor && contColor !== layoutAttributes.color.dflt ? contColor : font.color\n );\n Lib.coerceFont(coerce, \"tickfont\", font, { overrideDflt: {\n color: dfltFontColor\n } });\n if (!options.noTicklabelstep && axType !== \"multicategory\" && axType !== \"log\") {\n coerce(\"ticklabelstep\");\n }\n if (!options.noAng) {\n var tickAngle = coerce(\"tickangle\");\n if (!options.noAutotickangles && tickAngle === \"auto\") {\n coerce(\"autotickangles\");\n }\n }\n if (axType !== \"category\") {\n var tickFormat = coerce(\"tickformat\");\n handleArrayContainerDefaults(containerIn, containerOut, {\n name: \"tickformatstops\",\n inclusionAttr: \"enabled\",\n handleItemDefaults: tickformatstopDefaults\n });\n if (!containerOut.tickformatstops.length) {\n delete containerOut.tickformatstops;\n }\n if (!options.noExp && !tickFormat && axType !== \"date\") {\n coerce(\"showexponent\", showAttrDflt);\n coerce(\"exponentformat\");\n coerce(\"minexponent\");\n coerce(\"separatethousands\");\n }\n }\n }\n };\n function tickformatstopDefaults(valueIn, valueOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(valueIn, valueOut, layoutAttributes.tickformatstops, attr, dflt);\n }\n var enabled = coerce(\"enabled\");\n if (enabled) {\n coerce(\"dtickrange\");\n coerce(\"value\");\n }\n }\n }\n });\n\n // src/plots/cartesian/prefix_suffix_defaults.js\n var require_prefix_suffix_defaults = __commonJS({\n \"src/plots/cartesian/prefix_suffix_defaults.js\"(exports, module) {\n \"use strict\";\n var getShowAttrDflt = require_show_dflt();\n module.exports = function handlePrefixSuffixDefaults(containerIn, containerOut, coerce, axType, options) {\n if (!options) options = {};\n var tickSuffixDflt = options.tickSuffixDflt;\n var showAttrDflt = getShowAttrDflt(containerIn);\n var tickPrefix = coerce(\"tickprefix\");\n if (tickPrefix) coerce(\"showtickprefix\", showAttrDflt);\n var tickSuffix = coerce(\"ticksuffix\", tickSuffixDflt);\n if (tickSuffix) coerce(\"showticksuffix\", showAttrDflt);\n };\n }\n });\n\n // src/components/colorbar/defaults.js\n var require_defaults = __commonJS({\n \"src/components/colorbar/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Template = require_plot_template();\n var handleTickValueDefaults = require_tick_value_defaults();\n var handleTickMarkDefaults = require_tick_mark_defaults();\n var handleTickLabelDefaults = require_tick_label_defaults();\n var handlePrefixSuffixDefaults = require_prefix_suffix_defaults();\n var attributes = require_attributes7();\n module.exports = function colorbarDefaults(containerIn, containerOut, layout) {\n var colorbarOut = Template.newContainer(containerOut, \"colorbar\");\n var colorbarIn = containerIn.colorbar || {};\n function coerce(attr, dflt) {\n return Lib.coerce(colorbarIn, colorbarOut, attributes, attr, dflt);\n }\n var margin = layout.margin || { t: 0, b: 0, l: 0, r: 0 };\n var w = layout.width - margin.l - margin.r;\n var h = layout.height - margin.t - margin.b;\n var orientation = coerce(\"orientation\");\n var isVertical = orientation === \"v\";\n var thicknessmode = coerce(\"thicknessmode\");\n coerce(\n \"thickness\",\n thicknessmode === \"fraction\" ? 30 / (isVertical ? w : h) : 30\n );\n var lenmode = coerce(\"lenmode\");\n coerce(\n \"len\",\n lenmode === \"fraction\" ? 1 : isVertical ? h : w\n );\n var yref = coerce(\"yref\");\n var xref = coerce(\"xref\");\n var isPaperY = yref === \"paper\";\n var isPaperX = xref === \"paper\";\n var defaultX, defaultY, defaultYAnchor;\n var defaultXAnchor = \"left\";\n if (isVertical) {\n defaultYAnchor = \"middle\";\n defaultXAnchor = isPaperX ? \"left\" : \"right\";\n defaultX = isPaperX ? 1.02 : 1;\n defaultY = 0.5;\n } else {\n defaultYAnchor = isPaperY ? \"bottom\" : \"top\";\n defaultXAnchor = \"center\";\n defaultX = 0.5;\n defaultY = isPaperY ? 1.02 : 1;\n }\n Lib.coerce(colorbarIn, colorbarOut, {\n x: {\n valType: \"number\",\n min: isPaperX ? -2 : 0,\n max: isPaperX ? 3 : 1,\n dflt: defaultX\n }\n }, \"x\");\n Lib.coerce(colorbarIn, colorbarOut, {\n y: {\n valType: \"number\",\n min: isPaperY ? -2 : 0,\n max: isPaperY ? 3 : 1,\n dflt: defaultY\n }\n }, \"y\");\n coerce(\"xanchor\", defaultXAnchor);\n coerce(\"xpad\");\n coerce(\"yanchor\", defaultYAnchor);\n coerce(\"ypad\");\n Lib.noneOrAll(colorbarIn, colorbarOut, [\"x\", \"y\"]);\n coerce(\"outlinecolor\");\n coerce(\"outlinewidth\");\n coerce(\"bordercolor\");\n coerce(\"borderwidth\");\n coerce(\"bgcolor\");\n var ticklabelposition = Lib.coerce(colorbarIn, colorbarOut, {\n ticklabelposition: {\n valType: \"enumerated\",\n dflt: \"outside\",\n values: isVertical ? [\n \"outside\",\n \"inside\",\n \"outside top\",\n \"inside top\",\n \"outside bottom\",\n \"inside bottom\"\n ] : [\n \"outside\",\n \"inside\",\n \"outside left\",\n \"inside left\",\n \"outside right\",\n \"inside right\"\n ]\n }\n }, \"ticklabelposition\");\n coerce(\"ticklabeloverflow\", ticklabelposition.indexOf(\"inside\") !== -1 ? \"hide past domain\" : \"hide past div\");\n handleTickValueDefaults(colorbarIn, colorbarOut, coerce, \"linear\");\n var font = layout.font;\n var opts = {\n noAutotickangles: true,\n noTicklabelshift: true,\n noTicklabelstandoff: true,\n outerTicks: false,\n font\n };\n if (ticklabelposition.indexOf(\"inside\") !== -1) {\n opts.bgColor = \"black\";\n }\n handlePrefixSuffixDefaults(colorbarIn, colorbarOut, coerce, \"linear\", opts);\n handleTickLabelDefaults(colorbarIn, colorbarOut, coerce, \"linear\", opts);\n handleTickMarkDefaults(colorbarIn, colorbarOut, coerce, \"linear\", opts);\n coerce(\"title.text\", layout._dfltTitle.colorbar);\n var tickFont = colorbarOut.showticklabels ? colorbarOut.tickfont : font;\n var dfltTitleFont = Lib.extendFlat({}, font, {\n family: tickFont.family,\n size: Lib.bigFont(tickFont.size)\n });\n Lib.coerceFont(coerce, \"title.font\", dfltTitleFont);\n coerce(\"title.side\", isVertical ? \"top\" : \"right\");\n };\n }\n });\n\n // src/components/colorscale/defaults.js\n var require_defaults2 = __commonJS({\n \"src/components/colorscale/defaults.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var hasColorbar = require_has_colorbar();\n var colorbarDefaults = require_defaults();\n var isValidScale = require_scales().isValid;\n var traceIs = require_registry().traceIs;\n function npMaybe(parentCont, prefix) {\n var containerStr = prefix.slice(0, prefix.length - 1);\n return prefix ? Lib.nestedProperty(parentCont, containerStr).get() || {} : parentCont;\n }\n module.exports = function colorScaleDefaults(parentContIn, parentContOut, layout, coerce, opts) {\n var prefix = opts.prefix;\n var cLetter = opts.cLetter;\n var inTrace = \"_module\" in parentContOut;\n var containerIn = npMaybe(parentContIn, prefix);\n var containerOut = npMaybe(parentContOut, prefix);\n var template = npMaybe(parentContOut._template || {}, prefix) || {};\n var thisFn = function() {\n delete parentContIn.coloraxis;\n delete parentContOut.coloraxis;\n return colorScaleDefaults(parentContIn, parentContOut, layout, coerce, opts);\n };\n if (inTrace) {\n var colorAxes = layout._colorAxes || {};\n var colorAx = coerce(prefix + \"coloraxis\");\n if (colorAx) {\n var colorbarVisuals = traceIs(parentContOut, \"contour\") && Lib.nestedProperty(parentContOut, \"contours.coloring\").get() || \"heatmap\";\n var stash = colorAxes[colorAx];\n if (stash) {\n stash[2].push(thisFn);\n if (stash[0] !== colorbarVisuals) {\n stash[0] = false;\n Lib.warn([\n \"Ignoring coloraxis:\",\n colorAx,\n \"setting\",\n \"as it is linked to incompatible colorscales.\"\n ].join(\" \"));\n }\n } else {\n colorAxes[colorAx] = [colorbarVisuals, parentContOut, [thisFn]];\n }\n return;\n }\n }\n var minIn = containerIn[cLetter + \"min\"];\n var maxIn = containerIn[cLetter + \"max\"];\n var validMinMax = isNumeric(minIn) && isNumeric(maxIn) && minIn < maxIn;\n var auto = coerce(prefix + cLetter + \"auto\", !validMinMax);\n if (auto) {\n coerce(prefix + cLetter + \"mid\");\n } else {\n coerce(prefix + cLetter + \"min\");\n coerce(prefix + cLetter + \"max\");\n }\n var sclIn = containerIn.colorscale;\n var sclTemplate = template.colorscale;\n var autoColorscaleDflt;\n if (sclIn !== void 0) autoColorscaleDflt = !isValidScale(sclIn);\n if (sclTemplate !== void 0) autoColorscaleDflt = !isValidScale(sclTemplate);\n coerce(prefix + \"autocolorscale\", autoColorscaleDflt);\n coerce(prefix + \"colorscale\");\n coerce(prefix + \"reversescale\");\n if (prefix !== \"marker.line.\") {\n var showScaleDflt;\n if (prefix && inTrace) showScaleDflt = hasColorbar(containerIn);\n var showScale = coerce(prefix + \"showscale\", showScaleDflt);\n if (showScale) {\n if (prefix && template) containerOut._template = template;\n colorbarDefaults(containerIn, containerOut, layout);\n }\n }\n };\n }\n });\n\n // src/components/colorscale/layout_defaults.js\n var require_layout_defaults = __commonJS({\n \"src/components/colorscale/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Template = require_plot_template();\n var colorScaleAttrs = require_layout_attributes5();\n var colorScaleDefaults = require_defaults2();\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, colorScaleAttrs, attr, dflt);\n }\n coerce(\"colorscale.sequential\");\n coerce(\"colorscale.sequentialminus\");\n coerce(\"colorscale.diverging\");\n var colorAxes = layoutOut._colorAxes;\n var colorAxIn, colorAxOut;\n function coerceAx(attr, dflt) {\n return Lib.coerce(colorAxIn, colorAxOut, colorScaleAttrs.coloraxis, attr, dflt);\n }\n for (var k in colorAxes) {\n var stash = colorAxes[k];\n if (stash[0]) {\n colorAxIn = layoutIn[k] || {};\n colorAxOut = Template.newContainer(layoutOut, k, \"coloraxis\");\n colorAxOut._name = k;\n colorScaleDefaults(colorAxIn, colorAxOut, layoutOut, coerceAx, { prefix: \"\", cLetter: \"c\" });\n } else {\n for (var i = 0; i < stash[2].length; i++) {\n stash[2][i]();\n }\n delete layoutOut._colorAxes[k];\n }\n }\n };\n }\n });\n\n // src/components/colorscale/cross_trace_defaults.js\n var require_cross_trace_defaults = __commonJS({\n \"src/components/colorscale/cross_trace_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var hasColorscale = require_helpers().hasColorscale;\n var extractOpts = require_helpers().extractOpts;\n module.exports = function crossTraceDefaults(fullData, fullLayout) {\n function replace(cont, k2) {\n var val = cont[\"_\" + k2];\n if (val !== void 0) {\n cont[k2] = val;\n }\n }\n function relinkColorAttrs(outerCont, cbOpt) {\n var cont = cbOpt.container ? Lib.nestedProperty(outerCont, cbOpt.container).get() : outerCont;\n if (cont) {\n if (cont.coloraxis) {\n cont._colorAx = fullLayout[cont.coloraxis];\n } else {\n var cOpts = extractOpts(cont);\n var isAuto = cOpts.auto;\n if (isAuto || cOpts.min === void 0) {\n replace(cont, cbOpt.min);\n }\n if (isAuto || cOpts.max === void 0) {\n replace(cont, cbOpt.max);\n }\n if (cOpts.autocolorscale) {\n replace(cont, \"colorscale\");\n }\n }\n }\n }\n for (var i = 0; i < fullData.length; i++) {\n var trace = fullData[i];\n var cbOpts = trace._module.colorbar;\n if (cbOpts) {\n if (Array.isArray(cbOpts)) {\n for (var j = 0; j < cbOpts.length; j++) {\n relinkColorAttrs(trace, cbOpts[j]);\n }\n } else {\n relinkColorAttrs(trace, cbOpts);\n }\n }\n if (hasColorscale(trace, \"marker.line\")) {\n relinkColorAttrs(trace, {\n container: \"marker.line\",\n min: \"cmin\",\n max: \"cmax\"\n });\n }\n }\n for (var k in fullLayout._colorAxes) {\n relinkColorAttrs(fullLayout[k], { min: \"cmin\", max: \"cmax\" });\n }\n };\n }\n });\n\n // src/components/colorscale/calc.js\n var require_calc = __commonJS({\n \"src/components/colorscale/calc.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var extractOpts = require_helpers().extractOpts;\n module.exports = function calc(gd, trace, opts) {\n var fullLayout = gd._fullLayout;\n var vals = opts.vals;\n var containerStr = opts.containerStr;\n var container = containerStr ? Lib.nestedProperty(trace, containerStr).get() : trace;\n var cOpts = extractOpts(container);\n var auto = cOpts.auto !== false;\n var min = cOpts.min;\n var max = cOpts.max;\n var mid = cOpts.mid;\n var minVal = function() {\n return Lib.aggNums(Math.min, null, vals);\n };\n var maxVal = function() {\n return Lib.aggNums(Math.max, null, vals);\n };\n if (min === void 0) {\n min = minVal();\n } else if (auto) {\n if (container._colorAx && isNumeric(min)) {\n min = Math.min(min, minVal());\n } else {\n min = minVal();\n }\n }\n if (max === void 0) {\n max = maxVal();\n } else if (auto) {\n if (container._colorAx && isNumeric(max)) {\n max = Math.max(max, maxVal());\n } else {\n max = maxVal();\n }\n }\n if (auto && mid !== void 0) {\n if (max - mid > mid - min) {\n min = mid - (max - mid);\n } else if (max - mid < mid - min) {\n max = mid + (mid - min);\n }\n }\n if (min === max) {\n min -= 0.5;\n max += 0.5;\n }\n cOpts._sync(\"min\", min);\n cOpts._sync(\"max\", max);\n if (cOpts.autocolorscale) {\n var scl;\n if (min * max < 0) scl = fullLayout.colorscale.diverging;\n else if (min >= 0) scl = fullLayout.colorscale.sequential;\n else scl = fullLayout.colorscale.sequentialminus;\n cOpts._sync(\"colorscale\", scl);\n }\n };\n }\n });\n\n // src/components/colorscale/index.js\n var require_colorscale = __commonJS({\n \"src/components/colorscale/index.js\"(exports, module) {\n \"use strict\";\n var scales = require_scales();\n var helpers = require_helpers();\n module.exports = {\n moduleType: \"component\",\n name: \"colorscale\",\n attributes: require_attributes8(),\n layoutAttributes: require_layout_attributes5(),\n supplyLayoutDefaults: require_layout_defaults(),\n handleDefaults: require_defaults2(),\n crossTraceDefaults: require_cross_trace_defaults(),\n calc: require_calc(),\n // ./scales.js is required in lib/coerce.js ;\n // it needs to be a separate module to avoid a circular dependency\n scales: scales.scales,\n defaultScale: scales.defaultScale,\n getScale: scales.get,\n isValidScale: scales.isValid,\n hasColorscale: helpers.hasColorscale,\n extractOpts: helpers.extractOpts,\n extractScale: helpers.extractScale,\n flipScale: helpers.flipScale,\n makeColorScaleFunc: helpers.makeColorScaleFunc,\n makeColorScaleFuncFromTrace: helpers.makeColorScaleFuncFromTrace\n };\n }\n });\n\n // src/traces/scatter/subtypes.js\n var require_subtypes = __commonJS({\n \"src/traces/scatter/subtypes.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var isTypedArraySpec = require_array().isTypedArraySpec;\n module.exports = {\n hasLines: function(trace) {\n return trace.visible && trace.mode && trace.mode.indexOf(\"lines\") !== -1;\n },\n hasMarkers: function(trace) {\n return trace.visible && (trace.mode && trace.mode.indexOf(\"markers\") !== -1 || // until splom implements 'mode'\n trace.type === \"splom\");\n },\n hasText: function(trace) {\n return trace.visible && trace.mode && trace.mode.indexOf(\"text\") !== -1;\n },\n isBubble: function(trace) {\n var marker = trace.marker;\n return Lib.isPlainObject(marker) && (Lib.isArrayOrTypedArray(marker.size) || isTypedArraySpec(marker.size));\n }\n };\n }\n });\n\n // src/traces/scatter/make_bubble_size_func.js\n var require_make_bubble_size_func = __commonJS({\n \"src/traces/scatter/make_bubble_size_func.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n module.exports = function makeBubbleSizeFn(trace, factor) {\n if (!factor) {\n factor = 2;\n }\n var marker = trace.marker;\n var sizeRef = marker.sizeref || 1;\n var sizeMin = marker.sizemin || 0;\n var baseFn = marker.sizemode === \"area\" ? function(v) {\n return Math.sqrt(v / sizeRef);\n } : function(v) {\n return v / sizeRef;\n };\n return function(v) {\n var baseSize = baseFn(v / factor);\n return isNumeric(baseSize) && baseSize > 0 ? Math.max(baseSize, sizeMin) : 0;\n };\n };\n }\n });\n\n // src/components/fx/helpers.js\n var require_helpers2 = __commonJS({\n \"src/components/fx/helpers.js\"(exports) {\n \"use strict\";\n var Lib = require_lib();\n exports.getSubplot = function(trace) {\n return trace.subplot || trace.xaxis + trace.yaxis || trace.geo;\n };\n exports.isTraceInSubplots = function(trace, subplots) {\n if (trace.type === \"splom\") {\n var xaxes = trace.xaxes || [];\n var yaxes = trace.yaxes || [];\n for (var i = 0; i < xaxes.length; i++) {\n for (var j = 0; j < yaxes.length; j++) {\n if (subplots.indexOf(xaxes[i] + yaxes[j]) !== -1) {\n return true;\n }\n }\n }\n return false;\n }\n return subplots.indexOf(exports.getSubplot(trace)) !== -1;\n };\n exports.flat = function(subplots, v) {\n var out = new Array(subplots.length);\n for (var i = 0; i < subplots.length; i++) {\n out[i] = v;\n }\n return out;\n };\n exports.p2c = function(axArray, v) {\n var out = new Array(axArray.length);\n for (var i = 0; i < axArray.length; i++) {\n out[i] = axArray[i].p2c(v);\n }\n return out;\n };\n exports.getDistanceFunction = function(mode, dx, dy, dxy) {\n if (mode === \"closest\") return dxy || exports.quadrature(dx, dy);\n return mode.charAt(0) === \"x\" ? dx : dy;\n };\n exports.getClosest = function(cd, distfn, pointData) {\n if (pointData.index !== false) {\n if (pointData.index >= 0 && pointData.index < cd.length) {\n pointData.distance = 0;\n } else pointData.index = false;\n } else {\n var newDistance = Infinity;\n var len = cd.length;\n for (var i = 0; i < len; i++) {\n newDistance = distfn(cd[i]);\n if (newDistance <= pointData.distance) {\n pointData.index = i;\n pointData.distance = newDistance;\n }\n }\n }\n return pointData;\n };\n exports.inbox = function(v0, v1, passVal) {\n return v0 * v1 < 0 || v0 === 0 ? passVal : Infinity;\n };\n exports.quadrature = function(dx, dy) {\n return function(di) {\n var x = dx(di);\n var y = dy(di);\n return Math.sqrt(x * x + y * y);\n };\n };\n exports.makeEventData = function(pt, trace, cd) {\n var pointNumber = \"index\" in pt ? pt.index : pt.pointNumber;\n var out = {\n data: trace._input,\n fullData: trace,\n curveNumber: trace.index,\n pointNumber\n };\n if (trace._indexToPoints) {\n var pointIndices = trace._indexToPoints[pointNumber];\n if (pointIndices.length === 1) {\n out.pointIndex = pointIndices[0];\n } else {\n out.pointIndices = pointIndices;\n }\n } else {\n out.pointIndex = pointNumber;\n }\n if (trace._module.eventData) {\n out = trace._module.eventData(out, pt, trace, cd, pointNumber);\n } else {\n if (\"xVal\" in pt) out.x = pt.xVal;\n else if (\"x\" in pt) out.x = pt.x;\n if (\"yVal\" in pt) out.y = pt.yVal;\n else if (\"y\" in pt) out.y = pt.y;\n if (pt.xa) out.xaxis = pt.xa;\n if (pt.ya) out.yaxis = pt.ya;\n if (pt.zLabelVal !== void 0) out.z = pt.zLabelVal;\n }\n exports.appendArrayPointValue(out, trace, pointNumber);\n return out;\n };\n exports.appendArrayPointValue = function(pointData, trace, pointNumber) {\n var arrayAttrs = trace._arrayAttrs;\n if (!arrayAttrs) {\n return;\n }\n for (var i = 0; i < arrayAttrs.length; i++) {\n var astr = arrayAttrs[i];\n var key = getPointKey(astr);\n if (pointData[key] === void 0) {\n var val = Lib.nestedProperty(trace, astr).get();\n var pointVal = getPointData(val, pointNumber);\n if (pointVal !== void 0) pointData[key] = pointVal;\n }\n }\n };\n exports.appendArrayMultiPointValues = function(pointData, trace, pointNumbers) {\n var arrayAttrs = trace._arrayAttrs;\n if (!arrayAttrs) {\n return;\n }\n for (var i = 0; i < arrayAttrs.length; i++) {\n var astr = arrayAttrs[i];\n var key = getPointKey(astr);\n if (pointData[key] === void 0) {\n var val = Lib.nestedProperty(trace, astr).get();\n var keyVal = new Array(pointNumbers.length);\n for (var j = 0; j < pointNumbers.length; j++) {\n keyVal[j] = getPointData(val, pointNumbers[j]);\n }\n pointData[key] = keyVal;\n }\n }\n };\n var pointKeyMap = {\n ids: \"id\",\n locations: \"location\",\n labels: \"label\",\n values: \"value\",\n \"marker.colors\": \"color\",\n parents: \"parent\"\n };\n function getPointKey(astr) {\n return pointKeyMap[astr] || astr;\n }\n function getPointData(val, pointNumber) {\n if (Array.isArray(pointNumber)) {\n if (Array.isArray(val) && Array.isArray(val[pointNumber[0]])) {\n return val[pointNumber[0]][pointNumber[1]];\n }\n } else {\n return val[pointNumber];\n }\n }\n var xyHoverMode = {\n x: true,\n y: true\n };\n var unifiedHoverMode = {\n \"x unified\": true,\n \"y unified\": true\n };\n exports.isUnifiedHover = function(hovermode) {\n if (typeof hovermode !== \"string\") return false;\n return !!unifiedHoverMode[hovermode];\n };\n exports.isXYhover = function(hovermode) {\n if (typeof hovermode !== \"string\") return false;\n return !!xyHoverMode[hovermode];\n };\n }\n });\n\n // node_modules/parse-svg-path/index.js\n var require_parse_svg_path = __commonJS({\n \"node_modules/parse-svg-path/index.js\"(exports, module) {\n module.exports = parse2;\n var length = { a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0 };\n var segment = /([astvzqmhlc])([^astvzqmhlc]*)/ig;\n function parse2(path) {\n var data = [];\n path.replace(segment, function(_, command, args) {\n var type = command.toLowerCase();\n args = parseValues(args);\n if (type == \"m\" && args.length > 2) {\n data.push([command].concat(args.splice(0, 2)));\n type = \"l\";\n command = command == \"m\" ? \"l\" : \"L\";\n }\n while (true) {\n if (args.length == length[type]) {\n args.unshift(command);\n return data.push(args);\n }\n if (args.length < length[type]) throw new Error(\"malformed path data\");\n data.push([command].concat(args.splice(0, length[type])));\n }\n });\n return data;\n }\n var number = /-?[0-9]*\\.?[0-9]+(?:e[-+]?\\d+)?/ig;\n function parseValues(args) {\n var numbers = args.match(number);\n return numbers ? numbers.map(Number) : [];\n }\n }\n });\n\n // src/components/drawing/symbol_defs.js\n var require_symbol_defs = __commonJS({\n \"src/components/drawing/symbol_defs.js\"(exports, module) {\n \"use strict\";\n var parseSvgPath = require_parse_svg_path();\n var round = (\n // require('@plotly/d3').round;\n function(x, n) {\n return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x);\n }\n );\n var emptyPath = \"M0,0Z\";\n var sqrt2 = Math.sqrt(2);\n var sqrt3 = Math.sqrt(3);\n var PI = Math.PI;\n var cos = Math.cos;\n var sin = Math.sin;\n module.exports = {\n circle: {\n n: 0,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rs = round(r, 2);\n var circle = \"M\" + rs + \",0A\" + rs + \",\" + rs + \" 0 1,1 0,-\" + rs + \"A\" + rs + \",\" + rs + \" 0 0,1 \" + rs + \",0Z\";\n return standoff ? align(angle, standoff, circle) : circle;\n }\n },\n square: {\n n: 1,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rs = round(r, 2);\n return align(angle, standoff, \"M\" + rs + \",\" + rs + \"H-\" + rs + \"V-\" + rs + \"H\" + rs + \"Z\");\n }\n },\n diamond: {\n n: 2,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rd = round(r * 1.3, 2);\n return align(angle, standoff, \"M\" + rd + \",0L0,\" + rd + \"L-\" + rd + \",0L0,-\" + rd + \"Z\");\n }\n },\n cross: {\n n: 3,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rc = round(r * 0.4, 2);\n var rc2 = round(r * 1.2, 2);\n return align(angle, standoff, \"M\" + rc2 + \",\" + rc + \"H\" + rc + \"V\" + rc2 + \"H-\" + rc + \"V\" + rc + \"H-\" + rc2 + \"V-\" + rc + \"H-\" + rc + \"V-\" + rc2 + \"H\" + rc + \"V-\" + rc + \"H\" + rc2 + \"Z\");\n }\n },\n x: {\n n: 4,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rx = round(r * 0.8 / sqrt2, 2);\n var ne = \"l\" + rx + \",\" + rx;\n var se = \"l\" + rx + \",-\" + rx;\n var sw = \"l-\" + rx + \",-\" + rx;\n var nw = \"l-\" + rx + \",\" + rx;\n return align(angle, standoff, \"M0,\" + rx + ne + se + sw + se + sw + nw + sw + nw + ne + nw + ne + \"Z\");\n }\n },\n \"triangle-up\": {\n n: 5,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rt = round(r * 2 / sqrt3, 2);\n var r2 = round(r / 2, 2);\n var rs = round(r, 2);\n return align(angle, standoff, \"M-\" + rt + \",\" + r2 + \"H\" + rt + \"L0,-\" + rs + \"Z\");\n }\n },\n \"triangle-down\": {\n n: 6,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rt = round(r * 2 / sqrt3, 2);\n var r2 = round(r / 2, 2);\n var rs = round(r, 2);\n return align(angle, standoff, \"M-\" + rt + \",-\" + r2 + \"H\" + rt + \"L0,\" + rs + \"Z\");\n }\n },\n \"triangle-left\": {\n n: 7,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rt = round(r * 2 / sqrt3, 2);\n var r2 = round(r / 2, 2);\n var rs = round(r, 2);\n return align(angle, standoff, \"M\" + r2 + \",-\" + rt + \"V\" + rt + \"L-\" + rs + \",0Z\");\n }\n },\n \"triangle-right\": {\n n: 8,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rt = round(r * 2 / sqrt3, 2);\n var r2 = round(r / 2, 2);\n var rs = round(r, 2);\n return align(angle, standoff, \"M-\" + r2 + \",-\" + rt + \"V\" + rt + \"L\" + rs + \",0Z\");\n }\n },\n \"triangle-ne\": {\n n: 9,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var r1 = round(r * 0.6, 2);\n var r2 = round(r * 1.2, 2);\n return align(angle, standoff, \"M-\" + r2 + \",-\" + r1 + \"H\" + r1 + \"V\" + r2 + \"Z\");\n }\n },\n \"triangle-se\": {\n n: 10,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var r1 = round(r * 0.6, 2);\n var r2 = round(r * 1.2, 2);\n return align(angle, standoff, \"M\" + r1 + \",-\" + r2 + \"V\" + r1 + \"H-\" + r2 + \"Z\");\n }\n },\n \"triangle-sw\": {\n n: 11,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var r1 = round(r * 0.6, 2);\n var r2 = round(r * 1.2, 2);\n return align(angle, standoff, \"M\" + r2 + \",\" + r1 + \"H-\" + r1 + \"V-\" + r2 + \"Z\");\n }\n },\n \"triangle-nw\": {\n n: 12,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var r1 = round(r * 0.6, 2);\n var r2 = round(r * 1.2, 2);\n return align(angle, standoff, \"M-\" + r1 + \",\" + r2 + \"V-\" + r1 + \"H\" + r2 + \"Z\");\n }\n },\n pentagon: {\n n: 13,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var x1 = round(r * 0.951, 2);\n var x2 = round(r * 0.588, 2);\n var y0 = round(-r, 2);\n var y1 = round(r * -0.309, 2);\n var y2 = round(r * 0.809, 2);\n return align(angle, standoff, \"M\" + x1 + \",\" + y1 + \"L\" + x2 + \",\" + y2 + \"H-\" + x2 + \"L-\" + x1 + \",\" + y1 + \"L0,\" + y0 + \"Z\");\n }\n },\n hexagon: {\n n: 14,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var y0 = round(r, 2);\n var y1 = round(r / 2, 2);\n var x = round(r * sqrt3 / 2, 2);\n return align(angle, standoff, \"M\" + x + \",-\" + y1 + \"V\" + y1 + \"L0,\" + y0 + \"L-\" + x + \",\" + y1 + \"V-\" + y1 + \"L0,-\" + y0 + \"Z\");\n }\n },\n hexagon2: {\n n: 15,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var x0 = round(r, 2);\n var x1 = round(r / 2, 2);\n var y = round(r * sqrt3 / 2, 2);\n return align(angle, standoff, \"M-\" + x1 + \",\" + y + \"H\" + x1 + \"L\" + x0 + \",0L\" + x1 + \",-\" + y + \"H-\" + x1 + \"L-\" + x0 + \",0Z\");\n }\n },\n octagon: {\n n: 16,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var a = round(r * 0.924, 2);\n var b = round(r * 0.383, 2);\n return align(angle, standoff, \"M-\" + b + \",-\" + a + \"H\" + b + \"L\" + a + \",-\" + b + \"V\" + b + \"L\" + b + \",\" + a + \"H-\" + b + \"L-\" + a + \",\" + b + \"V-\" + b + \"Z\");\n }\n },\n star: {\n n: 17,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rs = r * 1.4;\n var x1 = round(rs * 0.225, 2);\n var x2 = round(rs * 0.951, 2);\n var x3 = round(rs * 0.363, 2);\n var x4 = round(rs * 0.588, 2);\n var y0 = round(-rs, 2);\n var y1 = round(rs * -0.309, 2);\n var y3 = round(rs * 0.118, 2);\n var y4 = round(rs * 0.809, 2);\n var y5 = round(rs * 0.382, 2);\n return align(angle, standoff, \"M\" + x1 + \",\" + y1 + \"H\" + x2 + \"L\" + x3 + \",\" + y3 + \"L\" + x4 + \",\" + y4 + \"L0,\" + y5 + \"L-\" + x4 + \",\" + y4 + \"L-\" + x3 + \",\" + y3 + \"L-\" + x2 + \",\" + y1 + \"H-\" + x1 + \"L0,\" + y0 + \"Z\");\n }\n },\n hexagram: {\n n: 18,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var y = round(r * 0.66, 2);\n var x1 = round(r * 0.38, 2);\n var x2 = round(r * 0.76, 2);\n return align(angle, standoff, \"M-\" + x2 + \",0l-\" + x1 + \",-\" + y + \"h\" + x2 + \"l\" + x1 + \",-\" + y + \"l\" + x1 + \",\" + y + \"h\" + x2 + \"l-\" + x1 + \",\" + y + \"l\" + x1 + \",\" + y + \"h-\" + x2 + \"l-\" + x1 + \",\" + y + \"l-\" + x1 + \",-\" + y + \"h-\" + x2 + \"Z\");\n }\n },\n \"star-triangle-up\": {\n n: 19,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var x = round(r * sqrt3 * 0.8, 2);\n var y1 = round(r * 0.8, 2);\n var y2 = round(r * 1.6, 2);\n var rc = round(r * 4, 2);\n var aPart = \"A \" + rc + \",\" + rc + \" 0 0 1 \";\n return align(angle, standoff, \"M-\" + x + \",\" + y1 + aPart + x + \",\" + y1 + aPart + \"0,-\" + y2 + aPart + \"-\" + x + \",\" + y1 + \"Z\");\n }\n },\n \"star-triangle-down\": {\n n: 20,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var x = round(r * sqrt3 * 0.8, 2);\n var y1 = round(r * 0.8, 2);\n var y2 = round(r * 1.6, 2);\n var rc = round(r * 4, 2);\n var aPart = \"A \" + rc + \",\" + rc + \" 0 0 1 \";\n return align(angle, standoff, \"M\" + x + \",-\" + y1 + aPart + \"-\" + x + \",-\" + y1 + aPart + \"0,\" + y2 + aPart + x + \",-\" + y1 + \"Z\");\n }\n },\n \"star-square\": {\n n: 21,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rp = round(r * 1.1, 2);\n var rc = round(r * 2, 2);\n var aPart = \"A \" + rc + \",\" + rc + \" 0 0 1 \";\n return align(angle, standoff, \"M-\" + rp + \",-\" + rp + aPart + \"-\" + rp + \",\" + rp + aPart + rp + \",\" + rp + aPart + rp + \",-\" + rp + aPart + \"-\" + rp + \",-\" + rp + \"Z\");\n }\n },\n \"star-diamond\": {\n n: 22,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rp = round(r * 1.4, 2);\n var rc = round(r * 1.9, 2);\n var aPart = \"A \" + rc + \",\" + rc + \" 0 0 1 \";\n return align(angle, standoff, \"M-\" + rp + \",0\" + aPart + \"0,\" + rp + aPart + rp + \",0\" + aPart + \"0,-\" + rp + aPart + \"-\" + rp + \",0Z\");\n }\n },\n \"diamond-tall\": {\n n: 23,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var x = round(r * 0.7, 2);\n var y = round(r * 1.4, 2);\n return align(angle, standoff, \"M0,\" + y + \"L\" + x + \",0L0,-\" + y + \"L-\" + x + \",0Z\");\n }\n },\n \"diamond-wide\": {\n n: 24,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var x = round(r * 1.4, 2);\n var y = round(r * 0.7, 2);\n return align(angle, standoff, \"M0,\" + y + \"L\" + x + \",0L0,-\" + y + \"L-\" + x + \",0Z\");\n }\n },\n hourglass: {\n n: 25,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rs = round(r, 2);\n return align(angle, standoff, \"M\" + rs + \",\" + rs + \"H-\" + rs + \"L\" + rs + \",-\" + rs + \"H-\" + rs + \"Z\");\n },\n noDot: true\n },\n bowtie: {\n n: 26,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rs = round(r, 2);\n return align(angle, standoff, \"M\" + rs + \",\" + rs + \"V-\" + rs + \"L-\" + rs + \",\" + rs + \"V-\" + rs + \"Z\");\n },\n noDot: true\n },\n \"circle-cross\": {\n n: 27,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rs = round(r, 2);\n return align(angle, standoff, \"M0,\" + rs + \"V-\" + rs + \"M\" + rs + \",0H-\" + rs + \"M\" + rs + \",0A\" + rs + \",\" + rs + \" 0 1,1 0,-\" + rs + \"A\" + rs + \",\" + rs + \" 0 0,1 \" + rs + \",0Z\");\n },\n needLine: true,\n noDot: true\n },\n \"circle-x\": {\n n: 28,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rs = round(r, 2);\n var rc = round(r / sqrt2, 2);\n return align(angle, standoff, \"M\" + rc + \",\" + rc + \"L-\" + rc + \",-\" + rc + \"M\" + rc + \",-\" + rc + \"L-\" + rc + \",\" + rc + \"M\" + rs + \",0A\" + rs + \",\" + rs + \" 0 1,1 0,-\" + rs + \"A\" + rs + \",\" + rs + \" 0 0,1 \" + rs + \",0Z\");\n },\n needLine: true,\n noDot: true\n },\n \"square-cross\": {\n n: 29,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rs = round(r, 2);\n return align(angle, standoff, \"M0,\" + rs + \"V-\" + rs + \"M\" + rs + \",0H-\" + rs + \"M\" + rs + \",\" + rs + \"H-\" + rs + \"V-\" + rs + \"H\" + rs + \"Z\");\n },\n needLine: true,\n noDot: true\n },\n \"square-x\": {\n n: 30,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rs = round(r, 2);\n return align(angle, standoff, \"M\" + rs + \",\" + rs + \"L-\" + rs + \",-\" + rs + \"M\" + rs + \",-\" + rs + \"L-\" + rs + \",\" + rs + \"M\" + rs + \",\" + rs + \"H-\" + rs + \"V-\" + rs + \"H\" + rs + \"Z\");\n },\n needLine: true,\n noDot: true\n },\n \"diamond-cross\": {\n n: 31,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rd = round(r * 1.3, 2);\n return align(angle, standoff, \"M\" + rd + \",0L0,\" + rd + \"L-\" + rd + \",0L0,-\" + rd + \"ZM0,-\" + rd + \"V\" + rd + \"M-\" + rd + \",0H\" + rd);\n },\n needLine: true,\n noDot: true\n },\n \"diamond-x\": {\n n: 32,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rd = round(r * 1.3, 2);\n var r2 = round(r * 0.65, 2);\n return align(angle, standoff, \"M\" + rd + \",0L0,\" + rd + \"L-\" + rd + \",0L0,-\" + rd + \"ZM-\" + r2 + \",-\" + r2 + \"L\" + r2 + \",\" + r2 + \"M-\" + r2 + \",\" + r2 + \"L\" + r2 + \",-\" + r2);\n },\n needLine: true,\n noDot: true\n },\n \"cross-thin\": {\n n: 33,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rc = round(r * 1.4, 2);\n return align(angle, standoff, \"M0,\" + rc + \"V-\" + rc + \"M\" + rc + \",0H-\" + rc);\n },\n needLine: true,\n noDot: true,\n noFill: true\n },\n \"x-thin\": {\n n: 34,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rx = round(r, 2);\n return align(angle, standoff, \"M\" + rx + \",\" + rx + \"L-\" + rx + \",-\" + rx + \"M\" + rx + \",-\" + rx + \"L-\" + rx + \",\" + rx);\n },\n needLine: true,\n noDot: true,\n noFill: true\n },\n asterisk: {\n n: 35,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rc = round(r * 1.2, 2);\n var rs = round(r * 0.85, 2);\n return align(angle, standoff, \"M0,\" + rc + \"V-\" + rc + \"M\" + rc + \",0H-\" + rc + \"M\" + rs + \",\" + rs + \"L-\" + rs + \",-\" + rs + \"M\" + rs + \",-\" + rs + \"L-\" + rs + \",\" + rs);\n },\n needLine: true,\n noDot: true,\n noFill: true\n },\n hash: {\n n: 36,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var r1 = round(r / 2, 2);\n var r2 = round(r, 2);\n return align(angle, standoff, \"M\" + r1 + \",\" + r2 + \"V-\" + r2 + \"M\" + (r1 - r2) + \",-\" + r2 + \"V\" + r2 + \"M\" + r2 + \",\" + r1 + \"H-\" + r2 + \"M-\" + r2 + \",\" + (r1 - r2) + \"H\" + r2);\n },\n needLine: true,\n noFill: true\n },\n \"y-up\": {\n n: 37,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var x = round(r * 1.2, 2);\n var y0 = round(r * 1.6, 2);\n var y1 = round(r * 0.8, 2);\n return align(angle, standoff, \"M-\" + x + \",\" + y1 + \"L0,0M\" + x + \",\" + y1 + \"L0,0M0,-\" + y0 + \"L0,0\");\n },\n needLine: true,\n noDot: true,\n noFill: true\n },\n \"y-down\": {\n n: 38,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var x = round(r * 1.2, 2);\n var y0 = round(r * 1.6, 2);\n var y1 = round(r * 0.8, 2);\n return align(angle, standoff, \"M-\" + x + \",-\" + y1 + \"L0,0M\" + x + \",-\" + y1 + \"L0,0M0,\" + y0 + \"L0,0\");\n },\n needLine: true,\n noDot: true,\n noFill: true\n },\n \"y-left\": {\n n: 39,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var y = round(r * 1.2, 2);\n var x0 = round(r * 1.6, 2);\n var x1 = round(r * 0.8, 2);\n return align(angle, standoff, \"M\" + x1 + \",\" + y + \"L0,0M\" + x1 + \",-\" + y + \"L0,0M-\" + x0 + \",0L0,0\");\n },\n needLine: true,\n noDot: true,\n noFill: true\n },\n \"y-right\": {\n n: 40,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var y = round(r * 1.2, 2);\n var x0 = round(r * 1.6, 2);\n var x1 = round(r * 0.8, 2);\n return align(angle, standoff, \"M-\" + x1 + \",\" + y + \"L0,0M-\" + x1 + \",-\" + y + \"L0,0M\" + x0 + \",0L0,0\");\n },\n needLine: true,\n noDot: true,\n noFill: true\n },\n \"line-ew\": {\n n: 41,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rc = round(r * 1.4, 2);\n return align(angle, standoff, \"M\" + rc + \",0H-\" + rc);\n },\n needLine: true,\n noDot: true,\n noFill: true\n },\n \"line-ns\": {\n n: 42,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rc = round(r * 1.4, 2);\n return align(angle, standoff, \"M0,\" + rc + \"V-\" + rc);\n },\n needLine: true,\n noDot: true,\n noFill: true\n },\n \"line-ne\": {\n n: 43,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rx = round(r, 2);\n return align(angle, standoff, \"M\" + rx + \",-\" + rx + \"L-\" + rx + \",\" + rx);\n },\n needLine: true,\n noDot: true,\n noFill: true\n },\n \"line-nw\": {\n n: 44,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rx = round(r, 2);\n return align(angle, standoff, \"M\" + rx + \",\" + rx + \"L-\" + rx + \",-\" + rx);\n },\n needLine: true,\n noDot: true,\n noFill: true\n },\n \"arrow-up\": {\n n: 45,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rx = round(r, 2);\n var ry = round(r * 2, 2);\n return align(angle, standoff, \"M0,0L-\" + rx + \",\" + ry + \"H\" + rx + \"Z\");\n },\n backoff: 1,\n noDot: true\n },\n \"arrow-down\": {\n n: 46,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rx = round(r, 2);\n var ry = round(r * 2, 2);\n return align(angle, standoff, \"M0,0L-\" + rx + \",-\" + ry + \"H\" + rx + \"Z\");\n },\n noDot: true\n },\n \"arrow-left\": {\n n: 47,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rx = round(r * 2, 2);\n var ry = round(r, 2);\n return align(angle, standoff, \"M0,0L\" + rx + \",-\" + ry + \"V\" + ry + \"Z\");\n },\n noDot: true\n },\n \"arrow-right\": {\n n: 48,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rx = round(r * 2, 2);\n var ry = round(r, 2);\n return align(angle, standoff, \"M0,0L-\" + rx + \",-\" + ry + \"V\" + ry + \"Z\");\n },\n noDot: true\n },\n \"arrow-bar-up\": {\n n: 49,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rx = round(r, 2);\n var ry = round(r * 2, 2);\n return align(angle, standoff, \"M-\" + rx + \",0H\" + rx + \"M0,0L-\" + rx + \",\" + ry + \"H\" + rx + \"Z\");\n },\n backoff: 1,\n needLine: true,\n noDot: true\n },\n \"arrow-bar-down\": {\n n: 50,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rx = round(r, 2);\n var ry = round(r * 2, 2);\n return align(angle, standoff, \"M-\" + rx + \",0H\" + rx + \"M0,0L-\" + rx + \",-\" + ry + \"H\" + rx + \"Z\");\n },\n needLine: true,\n noDot: true\n },\n \"arrow-bar-left\": {\n n: 51,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rx = round(r * 2, 2);\n var ry = round(r, 2);\n return align(angle, standoff, \"M0,-\" + ry + \"V\" + ry + \"M0,0L\" + rx + \",-\" + ry + \"V\" + ry + \"Z\");\n },\n needLine: true,\n noDot: true\n },\n \"arrow-bar-right\": {\n n: 52,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var rx = round(r * 2, 2);\n var ry = round(r, 2);\n return align(angle, standoff, \"M0,-\" + ry + \"V\" + ry + \"M0,0L-\" + rx + \",-\" + ry + \"V\" + ry + \"Z\");\n },\n needLine: true,\n noDot: true\n },\n arrow: {\n n: 53,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var headAngle = PI / 2.5;\n var x = 2 * r * cos(headAngle);\n var y = 2 * r * sin(headAngle);\n return align(\n angle,\n standoff,\n \"M0,0L\" + -x + \",\" + y + \"L\" + x + \",\" + y + \"Z\"\n );\n },\n backoff: 0.9,\n noDot: true\n },\n \"arrow-wide\": {\n n: 54,\n f: function(r, angle, standoff) {\n if (skipAngle(angle)) return emptyPath;\n var headAngle = PI / 4;\n var x = 2 * r * cos(headAngle);\n var y = 2 * r * sin(headAngle);\n return align(\n angle,\n standoff,\n \"M0,0L\" + -x + \",\" + y + \"A \" + 2 * r + \",\" + 2 * r + \" 0 0 1 \" + x + \",\" + y + \"Z\"\n );\n },\n backoff: 0.4,\n noDot: true\n }\n };\n function skipAngle(angle) {\n return angle === null;\n }\n var lastPathIn;\n var lastPathOut;\n var lastAngle;\n var lastStandoff;\n function align(angle, standoff, path) {\n if ((!angle || angle % 360 === 0) && !standoff) return path;\n if (lastAngle === angle && lastStandoff === standoff && lastPathIn === path) return lastPathOut;\n lastAngle = angle;\n lastStandoff = standoff;\n lastPathIn = path;\n function rotate(t4, xy) {\n var cosT = cos(t4);\n var sinT = sin(t4);\n var x2 = xy[0];\n var y2 = xy[1] + (standoff || 0);\n return [\n x2 * cosT - y2 * sinT,\n x2 * sinT + y2 * cosT\n ];\n }\n var t = angle / 180 * PI;\n var x = 0;\n var y = 0;\n var cmd = parseSvgPath(path);\n var str = \"\";\n for (var i = 0; i < cmd.length; i++) {\n var cmdI = cmd[i];\n var op = cmdI[0];\n var x0 = x;\n var y0 = y;\n if (op === \"M\" || op === \"L\") {\n x = +cmdI[1];\n y = +cmdI[2];\n } else if (op === \"m\" || op === \"l\") {\n x += +cmdI[1];\n y += +cmdI[2];\n } else if (op === \"H\") {\n x = +cmdI[1];\n } else if (op === \"h\") {\n x += +cmdI[1];\n } else if (op === \"V\") {\n y = +cmdI[1];\n } else if (op === \"v\") {\n y += +cmdI[1];\n } else if (op === \"A\") {\n x = +cmdI[1];\n y = +cmdI[2];\n var E2 = rotate(t, [+cmdI[6], +cmdI[7]]);\n cmdI[6] = E2[0];\n cmdI[7] = E2[1];\n cmdI[3] = +cmdI[3] + angle;\n }\n if (op === \"H\" || op === \"V\") op = \"L\";\n if (op === \"h\" || op === \"v\") op = \"l\";\n if (op === \"m\" || op === \"l\") {\n x -= x0;\n y -= y0;\n }\n var B2 = rotate(t, [x, y]);\n if (op === \"H\" || op === \"V\") op = \"L\";\n if (op === \"M\" || op === \"L\" || op === \"m\" || op === \"l\") {\n cmdI[1] = B2[0];\n cmdI[2] = B2[1];\n }\n cmdI[0] = op;\n str += cmdI[0] + cmdI.slice(1).join(\",\");\n }\n lastPathOut = str;\n return str;\n }\n }\n });\n\n // src/components/drawing/index.js\n var require_drawing = __commonJS({\n \"src/components/drawing/index.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var numberFormat = Lib.numberFormat;\n var isNumeric = require_fast_isnumeric();\n var tinycolor = require_tinycolor();\n var Registry = require_registry();\n var Color2 = require_color();\n var Colorscale = require_colorscale();\n var strTranslate = Lib.strTranslate;\n var svgTextUtils = require_svg_text_utils();\n var xmlnsNamespaces = require_xmlns_namespaces();\n var alignment = require_alignment();\n var LINE_SPACING = alignment.LINE_SPACING;\n var DESELECTDIM = require_interactions().DESELECTDIM;\n var subTypes = require_subtypes();\n var makeBubbleSizeFn = require_make_bubble_size_func();\n var appendArrayPointValue = require_helpers2().appendArrayPointValue;\n var drawing = module.exports = {};\n drawing.font = function(s, font) {\n var variant = font.variant;\n var style = font.style;\n var weight = font.weight;\n var color2 = font.color;\n var size = font.size;\n var family = font.family;\n var shadow = font.shadow;\n var lineposition = font.lineposition;\n var textcase = font.textcase;\n if (family) s.style(\"font-family\", family);\n if (size + 1) s.style(\"font-size\", size + \"px\");\n if (color2) s.call(Color2.fill, color2);\n if (weight) s.style(\"font-weight\", weight);\n if (style) s.style(\"font-style\", style);\n if (variant) s.style(\"font-variant\", variant);\n if (textcase) s.style(\"text-transform\", dropNone(textcase2transform(textcase)));\n if (shadow) s.style(\"text-shadow\", shadow === \"auto\" ? svgTextUtils.makeTextShadow(Color2.contrast(color2)) : dropNone(shadow));\n if (lineposition) s.style(\"text-decoration-line\", dropNone(lineposition2decorationLine(lineposition)));\n };\n function dropNone(a) {\n return a === \"none\" ? void 0 : a;\n }\n var textcase2transformOptions = {\n normal: \"none\",\n lower: \"lowercase\",\n upper: \"uppercase\",\n \"word caps\": \"capitalize\"\n };\n function textcase2transform(textcase) {\n return textcase2transformOptions[textcase];\n }\n function lineposition2decorationLine(lineposition) {\n return lineposition.replace(\"under\", \"underline\").replace(\"over\", \"overline\").replace(\"through\", \"line-through\").split(\"+\").join(\" \");\n }\n drawing.setPosition = function(s, x, y) {\n s.attr(\"x\", x).attr(\"y\", y);\n };\n drawing.setSize = function(s, w, h) {\n s.attr(\"width\", w).attr(\"height\", h);\n };\n drawing.setRect = function(s, x, y, w, h) {\n s.call(drawing.setPosition, x, y).call(drawing.setSize, w, h);\n };\n drawing.translatePoint = function(d, sel, xa, ya) {\n var x = xa.c2p(d.x);\n var y = ya.c2p(d.y);\n if (isNumeric(x) && isNumeric(y) && sel.node()) {\n if (sel.node().nodeName === \"text\") {\n sel.attr(\"x\", x).attr(\"y\", y);\n } else {\n sel.attr(\"transform\", strTranslate(x, y));\n }\n } else {\n return false;\n }\n return true;\n };\n drawing.translatePoints = function(s, xa, ya) {\n s.each(function(d) {\n var sel = d3.select(this);\n drawing.translatePoint(d, sel, xa, ya);\n });\n };\n drawing.hideOutsideRangePoint = function(d, sel, xa, ya, xcalendar, ycalendar) {\n sel.attr(\n \"display\",\n xa.isPtWithinRange(d, xcalendar) && ya.isPtWithinRange(d, ycalendar) ? null : \"none\"\n );\n };\n drawing.hideOutsideRangePoints = function(traceGroups, subplot) {\n if (!subplot._hasClipOnAxisFalse) return;\n var xa = subplot.xaxis;\n var ya = subplot.yaxis;\n traceGroups.each(function(d) {\n var trace = d[0].trace;\n var xcalendar = trace.xcalendar;\n var ycalendar = trace.ycalendar;\n var selector = Registry.traceIs(trace, \"bar-like\") ? \".bartext\" : \".point,.textpoint\";\n traceGroups.selectAll(selector).each(function(d2) {\n drawing.hideOutsideRangePoint(d2, d3.select(this), xa, ya, xcalendar, ycalendar);\n });\n });\n };\n drawing.crispRound = function(gd, lineWidth, dflt) {\n if (!lineWidth || !isNumeric(lineWidth)) return dflt || 0;\n if (gd._context.staticPlot) return lineWidth;\n if (lineWidth < 1) return 1;\n return Math.round(lineWidth);\n };\n drawing.singleLineStyle = function(d, s, lw, lc, ld) {\n s.style(\"fill\", \"none\");\n var line = (((d || [])[0] || {}).trace || {}).line || {};\n var lw1 = lw || line.width || 0;\n var dash = ld || line.dash || \"\";\n Color2.stroke(s, lc || line.color);\n drawing.dashLine(s, dash, lw1);\n };\n drawing.lineGroupStyle = function(s, lw, lc, ld) {\n s.style(\"fill\", \"none\").each(function(d) {\n var line = (((d || [])[0] || {}).trace || {}).line || {};\n var lw1 = lw || line.width || 0;\n var dash = ld || line.dash || \"\";\n d3.select(this).call(Color2.stroke, lc || line.color).call(drawing.dashLine, dash, lw1);\n });\n };\n drawing.dashLine = function(s, dash, lineWidth) {\n lineWidth = +lineWidth || 0;\n dash = drawing.dashStyle(dash, lineWidth);\n s.style({\n \"stroke-dasharray\": dash,\n \"stroke-width\": lineWidth + \"px\"\n });\n };\n drawing.dashStyle = function(dash, lineWidth) {\n lineWidth = +lineWidth || 1;\n var dlw = Math.max(lineWidth, 3);\n if (dash === \"solid\") dash = \"\";\n else if (dash === \"dot\") dash = dlw + \"px,\" + dlw + \"px\";\n else if (dash === \"dash\") dash = 3 * dlw + \"px,\" + 3 * dlw + \"px\";\n else if (dash === \"longdash\") dash = 5 * dlw + \"px,\" + 5 * dlw + \"px\";\n else if (dash === \"dashdot\") {\n dash = 3 * dlw + \"px,\" + dlw + \"px,\" + dlw + \"px,\" + dlw + \"px\";\n } else if (dash === \"longdashdot\") {\n dash = 5 * dlw + \"px,\" + 2 * dlw + \"px,\" + dlw + \"px,\" + 2 * dlw + \"px\";\n }\n return dash;\n };\n function setFillStyle(sel, trace, gd, forLegend) {\n var markerPattern = trace.fillpattern;\n var fillgradient = trace.fillgradient;\n var patternShape = markerPattern && drawing.getPatternAttr(markerPattern.shape, 0, \"\");\n if (patternShape) {\n var patternBGColor = drawing.getPatternAttr(markerPattern.bgcolor, 0, null);\n var patternFGColor = drawing.getPatternAttr(markerPattern.fgcolor, 0, null);\n var patternFGOpacity = markerPattern.fgopacity;\n var patternSize = drawing.getPatternAttr(markerPattern.size, 0, 8);\n var patternSolidity = drawing.getPatternAttr(markerPattern.solidity, 0, 0.3);\n var patternID = trace.uid;\n drawing.pattern(\n sel,\n \"point\",\n gd,\n patternID,\n patternShape,\n patternSize,\n patternSolidity,\n void 0,\n markerPattern.fillmode,\n patternBGColor,\n patternFGColor,\n patternFGOpacity\n );\n } else if (fillgradient && fillgradient.type !== \"none\") {\n var direction = fillgradient.type;\n var gradientID = \"scatterfill-\" + trace.uid;\n if (forLegend) {\n gradientID = \"legendfill-\" + trace.uid;\n }\n if (!forLegend && (fillgradient.start !== void 0 || fillgradient.stop !== void 0)) {\n var start, stop;\n if (direction === \"horizontal\") {\n start = {\n x: fillgradient.start,\n y: 0\n };\n stop = {\n x: fillgradient.stop,\n y: 0\n };\n } else if (direction === \"vertical\") {\n start = {\n x: 0,\n y: fillgradient.start\n };\n stop = {\n x: 0,\n y: fillgradient.stop\n };\n }\n start.x = trace._xA.c2p(\n start.x === void 0 ? trace._extremes.x.min[0].val : start.x,\n true\n );\n start.y = trace._yA.c2p(\n start.y === void 0 ? trace._extremes.y.min[0].val : start.y,\n true\n );\n stop.x = trace._xA.c2p(\n stop.x === void 0 ? trace._extremes.x.max[0].val : stop.x,\n true\n );\n stop.y = trace._yA.c2p(\n stop.y === void 0 ? trace._extremes.y.max[0].val : stop.y,\n true\n );\n sel.call(gradientWithBounds, gd, gradientID, \"linear\", fillgradient.colorscale, \"fill\", start, stop, true, false);\n } else {\n if (direction === \"horizontal\") {\n direction = direction + \"reversed\";\n }\n sel.call(drawing.gradient, gd, gradientID, direction, fillgradient.colorscale, \"fill\");\n }\n } else if (trace.fillcolor) {\n sel.call(Color2.fill, trace.fillcolor);\n }\n }\n drawing.singleFillStyle = function(sel, gd) {\n var node = d3.select(sel.node());\n var data = node.data();\n var trace = ((data[0] || [])[0] || {}).trace || {};\n setFillStyle(sel, trace, gd, false);\n };\n drawing.fillGroupStyle = function(s, gd, forLegend) {\n s.style(\"stroke-width\", 0).each(function(d) {\n var shape = d3.select(this);\n if (d[0].trace) {\n setFillStyle(shape, d[0].trace, gd, forLegend);\n }\n });\n };\n var SYMBOLDEFS = require_symbol_defs();\n drawing.symbolNames = [];\n drawing.symbolFuncs = [];\n drawing.symbolBackOffs = [];\n drawing.symbolNeedLines = {};\n drawing.symbolNoDot = {};\n drawing.symbolNoFill = {};\n drawing.symbolList = [];\n Object.keys(SYMBOLDEFS).forEach(function(k) {\n var symDef = SYMBOLDEFS[k];\n var n = symDef.n;\n drawing.symbolList.push(\n n,\n String(n),\n k,\n n + 100,\n String(n + 100),\n k + \"-open\"\n );\n drawing.symbolNames[n] = k;\n drawing.symbolFuncs[n] = symDef.f;\n drawing.symbolBackOffs[n] = symDef.backoff || 0;\n if (symDef.needLine) {\n drawing.symbolNeedLines[n] = true;\n }\n if (symDef.noDot) {\n drawing.symbolNoDot[n] = true;\n } else {\n drawing.symbolList.push(\n n + 200,\n String(n + 200),\n k + \"-dot\",\n n + 300,\n String(n + 300),\n k + \"-open-dot\"\n );\n }\n if (symDef.noFill) {\n drawing.symbolNoFill[n] = true;\n }\n });\n var MAXSYMBOL = drawing.symbolNames.length;\n var DOTPATH = \"M0,0.5L0.5,0L0,-0.5L-0.5,0Z\";\n drawing.symbolNumber = function(v) {\n if (isNumeric(v)) {\n v = +v;\n } else if (typeof v === \"string\") {\n var vbase = 0;\n if (v.indexOf(\"-open\") > 0) {\n vbase = 100;\n v = v.replace(\"-open\", \"\");\n }\n if (v.indexOf(\"-dot\") > 0) {\n vbase += 200;\n v = v.replace(\"-dot\", \"\");\n }\n v = drawing.symbolNames.indexOf(v);\n if (v >= 0) {\n v += vbase;\n }\n }\n return v % 100 >= MAXSYMBOL || v >= 400 ? 0 : Math.floor(Math.max(v, 0));\n };\n function makePointPath(symbolNumber, r, t, s) {\n var base = symbolNumber % 100;\n return drawing.symbolFuncs[base](r, t, s) + (symbolNumber >= 200 ? DOTPATH : \"\");\n }\n var stopFormatter = numberFormat(\"~f\");\n var gradientInfo = {\n radial: { type: \"radial\" },\n radialreversed: { type: \"radial\", reversed: true },\n horizontal: { type: \"linear\", start: { x: 1, y: 0 }, stop: { x: 0, y: 0 } },\n horizontalreversed: { type: \"linear\", start: { x: 1, y: 0 }, stop: { x: 0, y: 0 }, reversed: true },\n vertical: { type: \"linear\", start: { x: 0, y: 1 }, stop: { x: 0, y: 0 } },\n verticalreversed: { type: \"linear\", start: { x: 0, y: 1 }, stop: { x: 0, y: 0 }, reversed: true }\n };\n drawing.gradient = function(sel, gd, gradientID, type, colorscale, prop) {\n var info = gradientInfo[type];\n return gradientWithBounds(\n sel,\n gd,\n gradientID,\n info.type,\n colorscale,\n prop,\n info.start,\n info.stop,\n false,\n info.reversed\n );\n };\n function gradientWithBounds(sel, gd, gradientID, type, colorscale, prop, start, stop, inUserSpace, reversed) {\n var len = colorscale.length;\n var info;\n if (type === \"linear\") {\n info = {\n node: \"linearGradient\",\n attrs: {\n x1: start.x,\n y1: start.y,\n x2: stop.x,\n y2: stop.y,\n gradientUnits: inUserSpace ? \"userSpaceOnUse\" : \"objectBoundingBox\"\n },\n reversed\n };\n } else if (type === \"radial\") {\n info = {\n node: \"radialGradient\",\n reversed\n };\n }\n var colorStops = new Array(len);\n for (var i = 0; i < len; i++) {\n if (info.reversed) {\n colorStops[len - 1 - i] = [stopFormatter((1 - colorscale[i][0]) * 100), colorscale[i][1]];\n } else {\n colorStops[i] = [stopFormatter(colorscale[i][0] * 100), colorscale[i][1]];\n }\n }\n var fullLayout = gd._fullLayout;\n var fullID = \"g\" + fullLayout._uid + \"-\" + gradientID;\n var gradient = fullLayout._defs.select(\".gradients\").selectAll(\"#\" + fullID).data([type + colorStops.join(\";\")], Lib.identity);\n gradient.exit().remove();\n gradient.enter().append(info.node).each(function() {\n var el = d3.select(this);\n if (info.attrs) el.attr(info.attrs);\n el.attr(\"id\", fullID);\n var stops = el.selectAll(\"stop\").data(colorStops);\n stops.exit().remove();\n stops.enter().append(\"stop\");\n stops.each(function(d) {\n var tc = tinycolor(d[1]);\n d3.select(this).attr({\n offset: d[0] + \"%\",\n \"stop-color\": Color2.tinyRGB(tc),\n \"stop-opacity\": tc.getAlpha()\n });\n });\n });\n sel.style(prop, getFullUrl(fullID, gd)).style(prop + \"-opacity\", null);\n sel.classed(\"gradient_filled\", true);\n }\n drawing.pattern = function(sel, calledBy, gd, patternID, shape, size, solidity, mcc, fillmode, bgcolor, fgcolor, fgopacity) {\n var isLegend = calledBy === \"legend\";\n if (mcc) {\n if (fillmode === \"overlay\") {\n bgcolor = mcc;\n fgcolor = Color2.contrast(bgcolor);\n } else {\n bgcolor = void 0;\n fgcolor = mcc;\n }\n }\n var fullLayout = gd._fullLayout;\n var fullID = \"p\" + fullLayout._uid + \"-\" + patternID;\n var width, height;\n var linearFn = function(x, x0, x1, y0, y1) {\n return y0 + (y1 - y0) * (x - x0) / (x1 - x0);\n };\n var path, linewidth, radius;\n var patternTag;\n var patternAttrs = {};\n var fgC = tinycolor(fgcolor);\n var fgRGB = Color2.tinyRGB(fgC);\n var fgAlpha = fgC.getAlpha();\n var opacity = fgopacity * fgAlpha;\n switch (shape) {\n case \"/\":\n width = size * Math.sqrt(2);\n height = size * Math.sqrt(2);\n path = \"M-\" + width / 4 + \",\" + height / 4 + \"l\" + width / 2 + \",-\" + height / 2 + \"M0,\" + height + \"L\" + width + \",0M\" + width / 4 * 3 + \",\" + height / 4 * 5 + \"l\" + width / 2 + \",-\" + height / 2;\n linewidth = solidity * size;\n patternTag = \"path\";\n patternAttrs = {\n d: path,\n opacity,\n stroke: fgRGB,\n \"stroke-width\": linewidth + \"px\"\n };\n break;\n case \"\\\\\":\n width = size * Math.sqrt(2);\n height = size * Math.sqrt(2);\n path = \"M\" + width / 4 * 3 + \",-\" + height / 4 + \"l\" + width / 2 + \",\" + height / 2 + \"M0,0L\" + width + \",\" + height + \"M-\" + width / 4 + \",\" + height / 4 * 3 + \"l\" + width / 2 + \",\" + height / 2;\n linewidth = solidity * size;\n patternTag = \"path\";\n patternAttrs = {\n d: path,\n opacity,\n stroke: fgRGB,\n \"stroke-width\": linewidth + \"px\"\n };\n break;\n case \"x\":\n width = size * Math.sqrt(2);\n height = size * Math.sqrt(2);\n path = \"M-\" + width / 4 + \",\" + height / 4 + \"l\" + width / 2 + \",-\" + height / 2 + \"M0,\" + height + \"L\" + width + \",0M\" + width / 4 * 3 + \",\" + height / 4 * 5 + \"l\" + width / 2 + \",-\" + height / 2 + \"M\" + width / 4 * 3 + \",-\" + height / 4 + \"l\" + width / 2 + \",\" + height / 2 + \"M0,0L\" + width + \",\" + height + \"M-\" + width / 4 + \",\" + height / 4 * 3 + \"l\" + width / 2 + \",\" + height / 2;\n linewidth = size - size * Math.sqrt(1 - solidity);\n patternTag = \"path\";\n patternAttrs = {\n d: path,\n opacity,\n stroke: fgRGB,\n \"stroke-width\": linewidth + \"px\"\n };\n break;\n case \"|\":\n width = size;\n height = size;\n patternTag = \"path\";\n path = \"M\" + width / 2 + \",0L\" + width / 2 + \",\" + height;\n linewidth = solidity * size;\n patternTag = \"path\";\n patternAttrs = {\n d: path,\n opacity,\n stroke: fgRGB,\n \"stroke-width\": linewidth + \"px\"\n };\n break;\n case \"-\":\n width = size;\n height = size;\n patternTag = \"path\";\n path = \"M0,\" + height / 2 + \"L\" + width + \",\" + height / 2;\n linewidth = solidity * size;\n patternTag = \"path\";\n patternAttrs = {\n d: path,\n opacity,\n stroke: fgRGB,\n \"stroke-width\": linewidth + \"px\"\n };\n break;\n case \"+\":\n width = size;\n height = size;\n patternTag = \"path\";\n path = \"M\" + width / 2 + \",0L\" + width / 2 + \",\" + height + \"M0,\" + height / 2 + \"L\" + width + \",\" + height / 2;\n linewidth = size - size * Math.sqrt(1 - solidity);\n patternTag = \"path\";\n patternAttrs = {\n d: path,\n opacity,\n stroke: fgRGB,\n \"stroke-width\": linewidth + \"px\"\n };\n break;\n case \".\":\n width = size;\n height = size;\n if (solidity < Math.PI / 4) {\n radius = Math.sqrt(solidity * size * size / Math.PI);\n } else {\n radius = linearFn(solidity, Math.PI / 4, 1, size / 2, size / Math.sqrt(2));\n }\n patternTag = \"circle\";\n patternAttrs = {\n cx: width / 2,\n cy: height / 2,\n r: radius,\n opacity,\n fill: fgRGB\n };\n break;\n }\n var str = [\n shape || \"noSh\",\n bgcolor || \"noBg\",\n fgcolor || \"noFg\",\n size,\n solidity\n ].join(\";\");\n var pattern = fullLayout._defs.select(\".patterns\").selectAll(\"#\" + fullID).data([str], Lib.identity);\n pattern.exit().remove();\n pattern.enter().append(\"pattern\").each(function() {\n var el = d3.select(this);\n el.attr({\n id: fullID,\n width: width + \"px\",\n height: height + \"px\",\n patternUnits: \"userSpaceOnUse\",\n // for legends scale down patterns just a bit so that default size (i.e 8) nicely fit in small icons\n patternTransform: isLegend ? \"scale(0.8)\" : \"\"\n });\n if (bgcolor) {\n var bgC = tinycolor(bgcolor);\n var bgRGB = Color2.tinyRGB(bgC);\n var bgAlpha = bgC.getAlpha();\n var rects = el.selectAll(\"rect\").data([0]);\n rects.exit().remove();\n rects.enter().append(\"rect\").attr({\n width: width + \"px\",\n height: height + \"px\",\n fill: bgRGB,\n \"fill-opacity\": bgAlpha\n });\n }\n var patterns = el.selectAll(patternTag).data([0]);\n patterns.exit().remove();\n patterns.enter().append(patternTag).attr(patternAttrs);\n });\n sel.style(\"fill\", getFullUrl(fullID, gd)).style(\"fill-opacity\", null);\n sel.classed(\"pattern_filled\", true);\n };\n drawing.initGradients = function(gd) {\n var fullLayout = gd._fullLayout;\n var gradientsGroup = Lib.ensureSingle(fullLayout._defs, \"g\", \"gradients\");\n gradientsGroup.selectAll(\"linearGradient,radialGradient\").remove();\n d3.select(gd).selectAll(\".gradient_filled\").classed(\"gradient_filled\", false);\n };\n drawing.initPatterns = function(gd) {\n var fullLayout = gd._fullLayout;\n var patternsGroup = Lib.ensureSingle(fullLayout._defs, \"g\", \"patterns\");\n patternsGroup.selectAll(\"pattern\").remove();\n d3.select(gd).selectAll(\".pattern_filled\").classed(\"pattern_filled\", false);\n };\n drawing.getPatternAttr = function(mp, i, dflt) {\n if (mp && Lib.isArrayOrTypedArray(mp)) {\n return i < mp.length ? mp[i] : dflt;\n }\n return mp;\n };\n drawing.pointStyle = function(s, trace, gd, pt) {\n if (!s.size()) return;\n var fns = drawing.makePointStyleFns(trace);\n s.each(function(d) {\n drawing.singlePointStyle(d, d3.select(this), trace, fns, gd, pt);\n });\n };\n drawing.singlePointStyle = function(d, sel, trace, fns, gd, pt) {\n var marker = trace.marker;\n var markerLine = marker.line;\n if (pt && pt.i >= 0 && d.i === void 0) d.i = pt.i;\n sel.style(\n \"opacity\",\n fns.selectedOpacityFn ? fns.selectedOpacityFn(d) : d.mo === void 0 ? marker.opacity : d.mo\n );\n if (fns.ms2mrc) {\n var r;\n if (d.ms === \"various\" || marker.size === \"various\") {\n r = 3;\n } else {\n r = fns.ms2mrc(d.ms);\n }\n d.mrc = r;\n if (fns.selectedSizeFn) {\n r = d.mrc = fns.selectedSizeFn(d);\n }\n var x = drawing.symbolNumber(d.mx || marker.symbol) || 0;\n d.om = x % 200 >= 100;\n var angle = getMarkerAngle(d, trace);\n var standoff = getMarkerStandoff(d, trace);\n sel.attr(\"d\", makePointPath(x, r, angle, standoff));\n }\n var perPointGradient = false;\n var fillColor, lineColor, lineWidth;\n if (d.so) {\n lineWidth = markerLine.outlierwidth;\n lineColor = markerLine.outliercolor;\n fillColor = marker.outliercolor;\n } else {\n var markerLineWidth = (markerLine || {}).width;\n lineWidth = (d.mlw + 1 || markerLineWidth + 1 || // TODO: we need the latter for legends... can we get rid of it?\n (d.trace ? (d.trace.marker.line || {}).width : 0) + 1) - 1 || 0;\n if (\"mlc\" in d) lineColor = d.mlcc = fns.lineScale(d.mlc);\n else if (Lib.isArrayOrTypedArray(markerLine.color)) lineColor = Color2.defaultLine;\n else lineColor = markerLine.color;\n if (Lib.isArrayOrTypedArray(marker.color)) {\n fillColor = Color2.defaultLine;\n perPointGradient = true;\n }\n if (\"mc\" in d) {\n fillColor = d.mcc = fns.markerScale(d.mc);\n } else {\n fillColor = marker.color || marker.colors || \"rgba(0,0,0,0)\";\n }\n if (fns.selectedColorFn) {\n fillColor = fns.selectedColorFn(d);\n }\n }\n if (d.om) {\n sel.call(Color2.stroke, fillColor).style({\n \"stroke-width\": (lineWidth || 1) + \"px\",\n fill: \"none\"\n });\n } else {\n sel.style(\"stroke-width\", (d.isBlank ? 0 : lineWidth) + \"px\");\n var markerGradient = marker.gradient;\n var gradientType = d.mgt;\n if (gradientType) perPointGradient = true;\n else gradientType = markerGradient && markerGradient.type;\n if (Lib.isArrayOrTypedArray(gradientType)) {\n gradientType = gradientType[0];\n if (!gradientInfo[gradientType]) gradientType = 0;\n }\n var markerPattern = marker.pattern;\n var patternShape = markerPattern && drawing.getPatternAttr(markerPattern.shape, d.i, \"\");\n if (gradientType && gradientType !== \"none\") {\n var gradientColor = d.mgc;\n if (gradientColor) perPointGradient = true;\n else gradientColor = markerGradient.color;\n var gradientID = trace.uid;\n if (perPointGradient) gradientID += \"-\" + d.i;\n drawing.gradient(\n sel,\n gd,\n gradientID,\n gradientType,\n [[0, gradientColor], [1, fillColor]],\n \"fill\"\n );\n } else if (patternShape) {\n var perPointPattern = false;\n var fgcolor = markerPattern.fgcolor;\n if (!fgcolor && pt && pt.color) {\n fgcolor = pt.color;\n perPointPattern = true;\n }\n var patternFGColor = drawing.getPatternAttr(fgcolor, d.i, pt && pt.color || null);\n var patternBGColor = drawing.getPatternAttr(markerPattern.bgcolor, d.i, null);\n var patternFGOpacity = markerPattern.fgopacity;\n var patternSize = drawing.getPatternAttr(markerPattern.size, d.i, 8);\n var patternSolidity = drawing.getPatternAttr(markerPattern.solidity, d.i, 0.3);\n perPointPattern = perPointPattern || d.mcc || Lib.isArrayOrTypedArray(markerPattern.shape) || Lib.isArrayOrTypedArray(markerPattern.bgcolor) || Lib.isArrayOrTypedArray(markerPattern.fgcolor) || Lib.isArrayOrTypedArray(markerPattern.size) || Lib.isArrayOrTypedArray(markerPattern.solidity);\n var patternID = trace.uid;\n if (perPointPattern) patternID += \"-\" + d.i;\n drawing.pattern(\n sel,\n \"point\",\n gd,\n patternID,\n patternShape,\n patternSize,\n patternSolidity,\n d.mcc,\n markerPattern.fillmode,\n patternBGColor,\n patternFGColor,\n patternFGOpacity\n );\n } else {\n Lib.isArrayOrTypedArray(fillColor) ? Color2.fill(sel, fillColor[d.i]) : Color2.fill(sel, fillColor);\n }\n if (lineWidth) {\n Color2.stroke(sel, lineColor);\n }\n }\n };\n drawing.makePointStyleFns = function(trace) {\n var out = {};\n var marker = trace.marker;\n out.markerScale = drawing.tryColorscale(marker, \"\");\n out.lineScale = drawing.tryColorscale(marker, \"line\");\n if (Registry.traceIs(trace, \"symbols\")) {\n out.ms2mrc = subTypes.isBubble(trace) ? makeBubbleSizeFn(trace) : function() {\n return (marker.size || 6) / 2;\n };\n }\n if (trace.selectedpoints) {\n Lib.extendFlat(out, drawing.makeSelectedPointStyleFns(trace));\n }\n return out;\n };\n drawing.makeSelectedPointStyleFns = function(trace) {\n var out = {};\n var selectedAttrs = trace.selected || {};\n var unselectedAttrs = trace.unselected || {};\n var marker = trace.marker || {};\n var selectedMarker = selectedAttrs.marker || {};\n var unselectedMarker = unselectedAttrs.marker || {};\n var mo = marker.opacity;\n var smo = selectedMarker.opacity;\n var usmo = unselectedMarker.opacity;\n var smoIsDefined = smo !== void 0;\n var usmoIsDefined = usmo !== void 0;\n if (Lib.isArrayOrTypedArray(mo) || smoIsDefined || usmoIsDefined) {\n out.selectedOpacityFn = function(d) {\n var base = d.mo === void 0 ? marker.opacity : d.mo;\n if (d.selected) {\n return smoIsDefined ? smo : base;\n } else {\n return usmoIsDefined ? usmo : DESELECTDIM * base;\n }\n };\n }\n var mc = marker.color;\n var smc = selectedMarker.color;\n var usmc = unselectedMarker.color;\n if (smc || usmc) {\n out.selectedColorFn = function(d) {\n var base = d.mcc || mc;\n if (d.selected) {\n return smc || base;\n } else {\n return usmc || base;\n }\n };\n }\n var ms = marker.size;\n var sms = selectedMarker.size;\n var usms = unselectedMarker.size;\n var smsIsDefined = sms !== void 0;\n var usmsIsDefined = usms !== void 0;\n if (Registry.traceIs(trace, \"symbols\") && (smsIsDefined || usmsIsDefined)) {\n out.selectedSizeFn = function(d) {\n var base = d.mrc || ms / 2;\n if (d.selected) {\n return smsIsDefined ? sms / 2 : base;\n } else {\n return usmsIsDefined ? usms / 2 : base;\n }\n };\n }\n return out;\n };\n drawing.makeSelectedTextStyleFns = function(trace) {\n var out = {};\n var selectedAttrs = trace.selected || {};\n var unselectedAttrs = trace.unselected || {};\n var textFont = trace.textfont || {};\n var selectedTextFont = selectedAttrs.textfont || {};\n var unselectedTextFont = unselectedAttrs.textfont || {};\n var tc = textFont.color;\n var stc = selectedTextFont.color;\n var utc = unselectedTextFont.color;\n out.selectedTextColorFn = function(d) {\n var base = d.tc || tc;\n if (d.selected) {\n return stc || base;\n } else {\n if (utc) return utc;\n else return stc ? base : Color2.addOpacity(base, DESELECTDIM);\n }\n };\n return out;\n };\n drawing.selectedPointStyle = function(s, trace) {\n if (!s.size() || !trace.selectedpoints) return;\n var fns = drawing.makeSelectedPointStyleFns(trace);\n var marker = trace.marker || {};\n var seq = [];\n if (fns.selectedOpacityFn) {\n seq.push(function(pt, d) {\n pt.style(\"opacity\", fns.selectedOpacityFn(d));\n });\n }\n if (fns.selectedColorFn) {\n seq.push(function(pt, d) {\n Color2.fill(pt, fns.selectedColorFn(d));\n });\n }\n if (fns.selectedSizeFn) {\n seq.push(function(pt, d) {\n var mx = d.mx || marker.symbol || 0;\n var mrc2 = fns.selectedSizeFn(d);\n pt.attr(\"d\", makePointPath(drawing.symbolNumber(mx), mrc2, getMarkerAngle(d, trace), getMarkerStandoff(d, trace)));\n d.mrc2 = mrc2;\n });\n }\n if (seq.length) {\n s.each(function(d) {\n var pt = d3.select(this);\n for (var i = 0; i < seq.length; i++) {\n seq[i](pt, d);\n }\n });\n }\n };\n drawing.tryColorscale = function(marker, prefix) {\n var cont = prefix ? Lib.nestedProperty(marker, prefix).get() : marker;\n if (cont) {\n var colorArray = cont.color;\n if ((cont.colorscale || cont._colorAx) && Lib.isArrayOrTypedArray(colorArray)) {\n return Colorscale.makeColorScaleFuncFromTrace(cont);\n }\n }\n return Lib.identity;\n };\n var TEXTOFFSETSIGN = {\n start: 1,\n end: -1,\n middle: 0,\n bottom: 1,\n top: -1\n };\n function textPointPosition(s, textPosition, fontSize, markerRadius, dontTouchParent) {\n var group = d3.select(s.node().parentNode);\n var v = textPosition.indexOf(\"top\") !== -1 ? \"top\" : textPosition.indexOf(\"bottom\") !== -1 ? \"bottom\" : \"middle\";\n var h = textPosition.indexOf(\"left\") !== -1 ? \"end\" : textPosition.indexOf(\"right\") !== -1 ? \"start\" : \"middle\";\n var r = markerRadius ? markerRadius / 0.8 + 1 : 0;\n var numLines = (svgTextUtils.lineCount(s) - 1) * LINE_SPACING + 1;\n var dx = TEXTOFFSETSIGN[h] * r;\n var dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + (TEXTOFFSETSIGN[v] - 1) * numLines * fontSize / 2;\n s.attr(\"text-anchor\", h);\n if (!dontTouchParent) {\n group.attr(\"transform\", strTranslate(dx, dy));\n }\n }\n function extracTextFontSize(d, trace) {\n var fontSize = d.ts || trace.textfont.size;\n return isNumeric(fontSize) && fontSize > 0 ? fontSize : 0;\n }\n drawing.textPointStyle = function(s, trace, gd) {\n if (!s.size()) return;\n var selectedTextColorFn;\n if (trace.selectedpoints) {\n var fns = drawing.makeSelectedTextStyleFns(trace);\n selectedTextColorFn = fns.selectedTextColorFn;\n }\n var texttemplate = trace.texttemplate;\n var fullLayout = gd._fullLayout;\n s.each(function(d) {\n var p = d3.select(this);\n var text = texttemplate ? Lib.extractOption(d, trace, \"txt\", \"texttemplate\") : Lib.extractOption(d, trace, \"tx\", \"text\");\n if (!text && text !== 0) {\n p.remove();\n return;\n }\n if (texttemplate) {\n var fn = trace._module.formatLabels;\n var labels = fn ? fn(d, trace, fullLayout) : {};\n var pointValues = {};\n appendArrayPointValue(pointValues, trace, d.i);\n var meta = trace._meta || {};\n text = Lib.texttemplateString(text, labels, fullLayout._d3locale, pointValues, d, meta);\n }\n var pos = d.tp || trace.textposition;\n var fontSize = extracTextFontSize(d, trace);\n var fontColor = selectedTextColorFn ? selectedTextColorFn(d) : d.tc || trace.textfont.color;\n p.call(drawing.font, {\n family: d.tf || trace.textfont.family,\n weight: d.tw || trace.textfont.weight,\n style: d.ty || trace.textfont.style,\n variant: d.tv || trace.textfont.variant,\n textcase: d.tC || trace.textfont.textcase,\n lineposition: d.tE || trace.textfont.lineposition,\n shadow: d.tS || trace.textfont.shadow,\n size: fontSize,\n color: fontColor\n }).text(text).call(svgTextUtils.convertToTspans, gd).call(textPointPosition, pos, fontSize, d.mrc);\n });\n };\n drawing.selectedTextStyle = function(s, trace) {\n if (!s.size() || !trace.selectedpoints) return;\n var fns = drawing.makeSelectedTextStyleFns(trace);\n s.each(function(d) {\n var tx = d3.select(this);\n var tc = fns.selectedTextColorFn(d);\n var tp = d.tp || trace.textposition;\n var fontSize = extracTextFontSize(d, trace);\n Color2.fill(tx, tc);\n var dontTouchParent = Registry.traceIs(trace, \"bar-like\");\n textPointPosition(tx, tp, fontSize, d.mrc2 || d.mrc, dontTouchParent);\n });\n };\n var CatmullRomExp = 0.5;\n drawing.smoothopen = function(pts, smoothness) {\n if (pts.length < 3) {\n return \"M\" + pts.join(\"L\");\n }\n var path = \"M\" + pts[0];\n var tangents = [];\n var i;\n for (i = 1; i < pts.length - 1; i++) {\n tangents.push(makeTangent(pts[i - 1], pts[i], pts[i + 1], smoothness));\n }\n path += \"Q\" + tangents[0][0] + \" \" + pts[1];\n for (i = 2; i < pts.length - 1; i++) {\n path += \"C\" + tangents[i - 2][1] + \" \" + tangents[i - 1][0] + \" \" + pts[i];\n }\n path += \"Q\" + tangents[pts.length - 3][1] + \" \" + pts[pts.length - 1];\n return path;\n };\n drawing.smoothclosed = function(pts, smoothness) {\n if (pts.length < 3) {\n return \"M\" + pts.join(\"L\") + \"Z\";\n }\n var path = \"M\" + pts[0];\n var pLast = pts.length - 1;\n var tangents = [makeTangent(pts[pLast], pts[0], pts[1], smoothness)];\n var i;\n for (i = 1; i < pLast; i++) {\n tangents.push(makeTangent(pts[i - 1], pts[i], pts[i + 1], smoothness));\n }\n tangents.push(\n makeTangent(pts[pLast - 1], pts[pLast], pts[0], smoothness)\n );\n for (i = 1; i <= pLast; i++) {\n path += \"C\" + tangents[i - 1][1] + \" \" + tangents[i][0] + \" \" + pts[i];\n }\n path += \"C\" + tangents[pLast][1] + \" \" + tangents[0][0] + \" \" + pts[0] + \"Z\";\n return path;\n };\n var lastDrawnX;\n var lastDrawnY;\n function roundEnd(pt, isY, isLastPoint) {\n if (isLastPoint) pt = applyBackoff(pt);\n return isY ? roundY(pt[1]) : roundX(pt[0]);\n }\n function roundX(p) {\n var v = d3.round(p, 2);\n lastDrawnX = v;\n return v;\n }\n function roundY(p) {\n var v = d3.round(p, 2);\n lastDrawnY = v;\n return v;\n }\n function makeTangent(prevpt, thispt, nextpt, smoothness) {\n var d1x = prevpt[0] - thispt[0];\n var d1y = prevpt[1] - thispt[1];\n var d2x = nextpt[0] - thispt[0];\n var d2y = nextpt[1] - thispt[1];\n var d1a = Math.pow(d1x * d1x + d1y * d1y, CatmullRomExp / 2);\n var d2a = Math.pow(d2x * d2x + d2y * d2y, CatmullRomExp / 2);\n var numx = (d2a * d2a * d1x - d1a * d1a * d2x) * smoothness;\n var numy = (d2a * d2a * d1y - d1a * d1a * d2y) * smoothness;\n var denom1 = 3 * d2a * (d1a + d2a);\n var denom2 = 3 * d1a * (d1a + d2a);\n return [\n [\n roundX(thispt[0] + (denom1 && numx / denom1)),\n roundY(thispt[1] + (denom1 && numy / denom1))\n ],\n [\n roundX(thispt[0] - (denom2 && numx / denom2)),\n roundY(thispt[1] - (denom2 && numy / denom2))\n ]\n ];\n }\n var STEPPATH = {\n hv: function(p0, p1, isLastPoint) {\n return \"H\" + roundX(p1[0]) + \"V\" + roundEnd(p1, 1, isLastPoint);\n },\n vh: function(p0, p1, isLastPoint) {\n return \"V\" + roundY(p1[1]) + \"H\" + roundEnd(p1, 0, isLastPoint);\n },\n hvh: function(p0, p1, isLastPoint) {\n return \"H\" + roundX((p0[0] + p1[0]) / 2) + \"V\" + roundY(p1[1]) + \"H\" + roundEnd(p1, 0, isLastPoint);\n },\n vhv: function(p0, p1, isLastPoint) {\n return \"V\" + roundY((p0[1] + p1[1]) / 2) + \"H\" + roundX(p1[0]) + \"V\" + roundEnd(p1, 1, isLastPoint);\n }\n };\n var STEPLINEAR = function(p0, p1, isLastPoint) {\n return \"L\" + roundEnd(p1, 0, isLastPoint) + \",\" + roundEnd(p1, 1, isLastPoint);\n };\n drawing.steps = function(shape) {\n var onestep = STEPPATH[shape] || STEPLINEAR;\n return function(pts) {\n var path = \"M\" + roundX(pts[0][0]) + \",\" + roundY(pts[0][1]);\n var len = pts.length;\n for (var i = 1; i < len; i++) {\n path += onestep(pts[i - 1], pts[i], i === len - 1);\n }\n return path;\n };\n };\n function applyBackoff(pt, start) {\n var backoff = pt.backoff;\n var trace = pt.trace;\n var d = pt.d;\n var i = pt.i;\n if (backoff && trace && trace.marker && trace.marker.angle % 360 === 0 && trace.line && trace.line.shape !== \"spline\") {\n var arrayBackoff = Lib.isArrayOrTypedArray(backoff);\n var end = pt;\n var x1 = start ? start[0] : lastDrawnX || 0;\n var y1 = start ? start[1] : lastDrawnY || 0;\n var x2 = end[0];\n var y2 = end[1];\n var dx = x2 - x1;\n var dy = y2 - y1;\n var t = Math.atan2(dy, dx);\n var b = arrayBackoff ? backoff[i] : backoff;\n if (b === \"auto\") {\n var endI = end.i;\n if (trace.type === \"scatter\") endI--;\n var endMarker = end.marker;\n var endMarkerSymbol = endMarker.symbol;\n if (Lib.isArrayOrTypedArray(endMarkerSymbol)) endMarkerSymbol = endMarkerSymbol[endI];\n var endMarkerSize = endMarker.size;\n if (Lib.isArrayOrTypedArray(endMarkerSize)) endMarkerSize = endMarkerSize[endI];\n b = endMarker ? drawing.symbolBackOffs[drawing.symbolNumber(endMarkerSymbol)] * endMarkerSize : 0;\n b += drawing.getMarkerStandoff(d[endI], trace) || 0;\n }\n var x = x2 - b * Math.cos(t);\n var y = y2 - b * Math.sin(t);\n if ((x <= x2 && x >= x1 || x >= x2 && x <= x1) && (y <= y2 && y >= y1 || y >= y2 && y <= y1)) {\n pt = [x, y];\n }\n }\n return pt;\n }\n drawing.applyBackoff = applyBackoff;\n drawing.makeTester = function() {\n var tester = Lib.ensureSingleById(d3.select(\"body\"), \"svg\", \"js-plotly-tester\", function(s) {\n s.attr(xmlnsNamespaces.svgAttrs).style({\n position: \"absolute\",\n left: \"-10000px\",\n top: \"-10000px\",\n width: \"9000px\",\n height: \"9000px\",\n \"z-index\": \"1\"\n });\n });\n var testref = Lib.ensureSingle(tester, \"path\", \"js-reference-point\", function(s) {\n s.attr(\"d\", \"M0,0H1V1H0Z\").style({\n \"stroke-width\": 0,\n fill: \"black\"\n });\n });\n drawing.tester = tester;\n drawing.testref = testref;\n };\n drawing.savedBBoxes = {};\n var savedBBoxesCount = 0;\n var maxSavedBBoxes = 1e4;\n drawing.bBox = function(node, inTester, hash) {\n if (!hash) hash = nodeHash(node);\n var out;\n if (hash) {\n out = drawing.savedBBoxes[hash];\n if (out) return Lib.extendFlat({}, out);\n } else if (node.childNodes.length === 1) {\n var innerNode = node.childNodes[0];\n hash = nodeHash(innerNode);\n if (hash) {\n var x = +innerNode.getAttribute(\"x\") || 0;\n var y = +innerNode.getAttribute(\"y\") || 0;\n var transform = innerNode.getAttribute(\"transform\");\n if (!transform) {\n var innerBB = drawing.bBox(innerNode, false, hash);\n if (x) {\n innerBB.left += x;\n innerBB.right += x;\n }\n if (y) {\n innerBB.top += y;\n innerBB.bottom += y;\n }\n return innerBB;\n }\n hash += \"~\" + x + \"~\" + y + \"~\" + transform;\n out = drawing.savedBBoxes[hash];\n if (out) return Lib.extendFlat({}, out);\n }\n }\n var testNode, tester;\n if (inTester) {\n testNode = node;\n } else {\n tester = drawing.tester.node();\n testNode = node.cloneNode(true);\n tester.appendChild(testNode);\n }\n d3.select(testNode).attr(\"transform\", null).call(svgTextUtils.positionText, 0, 0);\n var testRect = testNode.getBoundingClientRect();\n var refRect = drawing.testref.node().getBoundingClientRect();\n if (!inTester) tester.removeChild(testNode);\n var bb = {\n height: testRect.height,\n width: testRect.width,\n left: testRect.left - refRect.left,\n top: testRect.top - refRect.top,\n right: testRect.right - refRect.left,\n bottom: testRect.bottom - refRect.top\n };\n if (savedBBoxesCount >= maxSavedBBoxes) {\n drawing.savedBBoxes = {};\n savedBBoxesCount = 0;\n }\n if (hash) drawing.savedBBoxes[hash] = bb;\n savedBBoxesCount++;\n return Lib.extendFlat({}, bb);\n };\n function nodeHash(node) {\n var inputText = node.getAttribute(\"data-unformatted\");\n if (inputText === null) return;\n return inputText + node.getAttribute(\"data-math\") + node.getAttribute(\"text-anchor\") + node.getAttribute(\"style\");\n }\n drawing.setClipUrl = function(s, localId, gd) {\n s.attr(\"clip-path\", getFullUrl(localId, gd));\n };\n function getFullUrl(localId, gd) {\n if (!localId) return null;\n var context = gd._context;\n var baseUrl = context._exportedPlot ? \"\" : context._baseUrl || \"\";\n return baseUrl ? \"url('\" + baseUrl + \"#\" + localId + \"')\" : \"url(#\" + localId + \")\";\n }\n drawing.getTranslate = function(element) {\n var re = /.*\\btranslate\\((-?\\d*\\.?\\d*)[^-\\d]*(-?\\d*\\.?\\d*)[^\\d].*/;\n var getter = element.attr ? \"attr\" : \"getAttribute\";\n var transform = element[getter](\"transform\") || \"\";\n var translate = transform.replace(re, function(match, p1, p2) {\n return [p1, p2].join(\" \");\n }).split(\" \");\n return {\n x: +translate[0] || 0,\n y: +translate[1] || 0\n };\n };\n drawing.setTranslate = function(element, x, y) {\n var re = /(\\btranslate\\(.*?\\);?)/;\n var getter = element.attr ? \"attr\" : \"getAttribute\";\n var setter = element.attr ? \"attr\" : \"setAttribute\";\n var transform = element[getter](\"transform\") || \"\";\n x = x || 0;\n y = y || 0;\n transform = transform.replace(re, \"\").trim();\n transform += strTranslate(x, y);\n transform = transform.trim();\n element[setter](\"transform\", transform);\n return transform;\n };\n drawing.getScale = function(element) {\n var re = /.*\\bscale\\((\\d*\\.?\\d*)[^\\d]*(\\d*\\.?\\d*)[^\\d].*/;\n var getter = element.attr ? \"attr\" : \"getAttribute\";\n var transform = element[getter](\"transform\") || \"\";\n var translate = transform.replace(re, function(match, p1, p2) {\n return [p1, p2].join(\" \");\n }).split(\" \");\n return {\n x: +translate[0] || 1,\n y: +translate[1] || 1\n };\n };\n drawing.setScale = function(element, x, y) {\n var re = /(\\bscale\\(.*?\\);?)/;\n var getter = element.attr ? \"attr\" : \"getAttribute\";\n var setter = element.attr ? \"attr\" : \"setAttribute\";\n var transform = element[getter](\"transform\") || \"\";\n x = x || 1;\n y = y || 1;\n transform = transform.replace(re, \"\").trim();\n transform += \"scale(\" + x + \",\" + y + \")\";\n transform = transform.trim();\n element[setter](\"transform\", transform);\n return transform;\n };\n var SCALE_RE = /\\s*sc.*/;\n drawing.setPointGroupScale = function(selection, xScale, yScale) {\n xScale = xScale || 1;\n yScale = yScale || 1;\n if (!selection) return;\n var scale = xScale === 1 && yScale === 1 ? \"\" : \"scale(\" + xScale + \",\" + yScale + \")\";\n selection.each(function() {\n var t = (this.getAttribute(\"transform\") || \"\").replace(SCALE_RE, \"\");\n t += scale;\n t = t.trim();\n this.setAttribute(\"transform\", t);\n });\n };\n var TEXT_POINT_LAST_TRANSLATION_RE = /translate\\([^)]*\\)\\s*$/;\n drawing.setTextPointsScale = function(selection, xScale, yScale) {\n if (!selection) return;\n selection.each(function() {\n var transforms;\n var el = d3.select(this);\n var text = el.select(\"text\");\n if (!text.node()) return;\n var x = parseFloat(text.attr(\"x\") || 0);\n var y = parseFloat(text.attr(\"y\") || 0);\n var existingTransform = (el.attr(\"transform\") || \"\").match(TEXT_POINT_LAST_TRANSLATION_RE);\n if (xScale === 1 && yScale === 1) {\n transforms = [];\n } else {\n transforms = [\n strTranslate(x, y),\n \"scale(\" + xScale + \",\" + yScale + \")\",\n strTranslate(-x, -y)\n ];\n }\n if (existingTransform) {\n transforms.push(existingTransform);\n }\n el.attr(\"transform\", transforms.join(\"\"));\n });\n };\n function getMarkerStandoff(d, trace) {\n var standoff;\n if (d) standoff = d.mf;\n if (standoff === void 0) {\n standoff = trace.marker ? trace.marker.standoff || 0 : 0;\n }\n if (!trace._geo && !trace._xA) {\n return -standoff;\n }\n return standoff;\n }\n drawing.getMarkerStandoff = getMarkerStandoff;\n var atan2 = Math.atan2;\n var cos = Math.cos;\n var sin = Math.sin;\n function rotate(t, xy) {\n var x = xy[0];\n var y = xy[1];\n return [\n x * cos(t) - y * sin(t),\n x * sin(t) + y * cos(t)\n ];\n }\n var previousLon;\n var previousLat;\n var previousX;\n var previousY;\n var previousI;\n var previousTraceUid;\n function getMarkerAngle(d, trace) {\n var angle = d.ma;\n if (angle === void 0) {\n angle = trace.marker.angle;\n if (!angle || Lib.isArrayOrTypedArray(angle)) {\n angle = 0;\n }\n }\n var x, y;\n var ref = trace.marker.angleref;\n if (ref === \"previous\" || ref === \"north\") {\n if (trace._geo) {\n var p = trace._geo.project(d.lonlat);\n x = p[0];\n y = p[1];\n } else {\n var xa = trace._xA;\n var ya = trace._yA;\n if (xa && ya) {\n x = xa.c2p(d.x);\n y = ya.c2p(d.y);\n } else {\n return 90;\n }\n }\n if (trace._geo) {\n var lon = d.lonlat[0];\n var lat = d.lonlat[1];\n var north = trace._geo.project([\n lon,\n lat + 1e-5\n // epsilon\n ]);\n var east = trace._geo.project([\n lon + 1e-5,\n // epsilon\n lat\n ]);\n var u = atan2(\n east[1] - y,\n east[0] - x\n );\n var v = atan2(\n north[1] - y,\n north[0] - x\n );\n var t;\n if (ref === \"north\") {\n t = angle / 180 * Math.PI;\n } else if (ref === \"previous\") {\n var lon1 = lon / 180 * Math.PI;\n var lat1 = lat / 180 * Math.PI;\n var lon2 = previousLon / 180 * Math.PI;\n var lat2 = previousLat / 180 * Math.PI;\n var dLon = lon2 - lon1;\n var deltaY = cos(lat2) * sin(dLon);\n var deltaX = sin(lat2) * cos(lat1) - cos(lat2) * sin(lat1) * cos(dLon);\n t = -atan2(\n deltaY,\n deltaX\n ) - Math.PI;\n previousLon = lon;\n previousLat = lat;\n }\n var A2 = rotate(u, [cos(t), 0]);\n var B2 = rotate(v, [sin(t), 0]);\n angle = atan2(\n A2[1] + B2[1],\n A2[0] + B2[0]\n ) / Math.PI * 180;\n if (ref === \"previous\" && !(previousTraceUid === trace.uid && d.i === previousI + 1)) {\n angle = null;\n }\n }\n if (ref === \"previous\" && !trace._geo) {\n if (previousTraceUid === trace.uid && d.i === previousI + 1 && isNumeric(x) && isNumeric(y)) {\n var dX = x - previousX;\n var dY = y - previousY;\n var shape = trace.line ? trace.line.shape || \"\" : \"\";\n var lastShapeChar = shape.slice(shape.length - 1);\n if (lastShapeChar === \"h\") dY = 0;\n if (lastShapeChar === \"v\") dX = 0;\n angle += atan2(dY, dX) / Math.PI * 180 + 90;\n } else {\n angle = null;\n }\n }\n }\n previousX = x;\n previousY = y;\n previousI = d.i;\n previousTraceUid = trace.uid;\n return angle;\n }\n drawing.getMarkerAngle = getMarkerAngle;\n }\n });\n\n // src/components/titles/index.js\n var require_titles = __commonJS({\n \"src/components/titles/index.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var isNumeric = require_fast_isnumeric();\n var Plots = require_plots();\n var Registry = require_registry();\n var Lib = require_lib();\n var strTranslate = Lib.strTranslate;\n var Drawing = require_drawing();\n var Color2 = require_color();\n var svgTextUtils = require_svg_text_utils();\n var interactConstants = require_interactions();\n var OPPOSITE_SIDE = require_alignment().OPPOSITE_SIDE;\n var numStripRE = / [XY][0-9]* /;\n var SUBTITLE_PADDING_MATHJAX_EM = 1.6;\n var SUBTITLE_PADDING_EM = 1.6;\n function draw(gd, titleClass, options) {\n var fullLayout = gd._fullLayout;\n var cont = options.propContainer;\n var prop = options.propName;\n var placeholder = options.placeholder;\n var traceIndex = options.traceIndex;\n var avoid = options.avoid || {};\n var attributes = options.attributes;\n var transform = options.transform;\n var group = options.containerGroup;\n var opacity = 1;\n var title = cont.title;\n var txt = (title && title.text ? title.text : \"\").trim();\n var titleIsPlaceholder = false;\n var font = title && title.font ? title.font : {};\n var fontFamily = font.family;\n var fontSize = font.size;\n var fontColor = font.color;\n var fontWeight = font.weight;\n var fontStyle = font.style;\n var fontVariant = font.variant;\n var fontTextcase = font.textcase;\n var fontLineposition = font.lineposition;\n var fontShadow = font.shadow;\n var subtitleProp = options.subtitlePropName;\n var subtitleEnabled = !!subtitleProp;\n var subtitlePlaceholder = options.subtitlePlaceholder;\n var subtitle = (cont.title || {}).subtitle || { text: \"\", font: {} };\n var subtitleTxt = subtitle.text.trim();\n var subtitleIsPlaceholder = false;\n var subtitleOpacity = 1;\n var subtitleFont = subtitle.font;\n var subFontFamily = subtitleFont.family;\n var subFontSize = subtitleFont.size;\n var subFontColor = subtitleFont.color;\n var subFontWeight = subtitleFont.weight;\n var subFontStyle = subtitleFont.style;\n var subFontVariant = subtitleFont.variant;\n var subFontTextcase = subtitleFont.textcase;\n var subFontLineposition = subtitleFont.lineposition;\n var subFontShadow = subtitleFont.shadow;\n var editAttr;\n if (prop === \"title.text\") editAttr = \"titleText\";\n else if (prop.indexOf(\"axis\") !== -1) editAttr = \"axisTitleText\";\n else if (prop.indexOf(\"colorbar\" !== -1)) editAttr = \"colorbarTitleText\";\n var editable = gd._context.edits[editAttr];\n function matchesPlaceholder(text, placeholder2) {\n if (text === void 0 || placeholder2 === void 0) return false;\n return text.replace(numStripRE, \" % \") === placeholder2.replace(numStripRE, \" % \");\n }\n if (txt === \"\") opacity = 0;\n else if (matchesPlaceholder(txt, placeholder)) {\n if (!editable) txt = \"\";\n opacity = 0.2;\n titleIsPlaceholder = true;\n }\n if (subtitleEnabled) {\n if (subtitleTxt === \"\") subtitleOpacity = 0;\n else if (matchesPlaceholder(subtitleTxt, subtitlePlaceholder)) {\n if (!editable) subtitleTxt = \"\";\n subtitleOpacity = 0.2;\n subtitleIsPlaceholder = true;\n }\n }\n if (options._meta) {\n txt = Lib.templateString(txt, options._meta);\n } else if (fullLayout._meta) {\n txt = Lib.templateString(txt, fullLayout._meta);\n }\n var elShouldExist = txt || subtitleTxt || editable;\n var hColorbarMoveTitle;\n if (!group) {\n group = Lib.ensureSingle(fullLayout._infolayer, \"g\", \"g-\" + titleClass);\n hColorbarMoveTitle = fullLayout._hColorbarMoveTitle;\n }\n var el = group.selectAll(\"text.\" + titleClass).data(elShouldExist ? [0] : []);\n el.enter().append(\"text\");\n el.text(txt).attr(\"class\", titleClass);\n el.exit().remove();\n var subtitleEl = null;\n var subtitleClass = titleClass + \"-subtitle\";\n var subtitleElShouldExist = subtitleTxt || editable;\n if (subtitleEnabled && subtitleElShouldExist) {\n subtitleEl = group.selectAll(\"text.\" + subtitleClass).data(subtitleElShouldExist ? [0] : []);\n subtitleEl.enter().append(\"text\");\n subtitleEl.text(subtitleTxt).attr(\"class\", subtitleClass);\n subtitleEl.exit().remove();\n }\n if (!elShouldExist) return group;\n function titleLayout(titleEl, subtitleEl2) {\n Lib.syncOrAsync([drawTitle, scootTitle], { title: titleEl, subtitle: subtitleEl2 });\n }\n function drawTitle(titleAndSubtitleEls) {\n var titleEl = titleAndSubtitleEls.title;\n var subtitleEl2 = titleAndSubtitleEls.subtitle;\n var transformVal;\n if (!transform && hColorbarMoveTitle) {\n transform = {};\n }\n if (transform) {\n transformVal = \"\";\n if (transform.rotate) {\n transformVal += \"rotate(\" + [transform.rotate, attributes.x, attributes.y] + \")\";\n }\n if (transform.offset || hColorbarMoveTitle) {\n transformVal += strTranslate(0, (transform.offset || 0) - (hColorbarMoveTitle || 0));\n }\n } else {\n transformVal = null;\n }\n titleEl.attr(\"transform\", transformVal);\n function adjustSubtitlePosition(titleElMathGroup2) {\n if (!titleElMathGroup2) return;\n var subtitleElement = d3.select(titleElMathGroup2.node().parentNode).select(\".\" + subtitleClass);\n if (!subtitleElement.empty()) {\n var titleElMathBbox2 = titleElMathGroup2.node().getBBox();\n if (titleElMathBbox2.height) {\n var subtitleY3 = titleElMathBbox2.y + titleElMathBbox2.height + SUBTITLE_PADDING_MATHJAX_EM * subFontSize;\n subtitleElement.attr(\"y\", subtitleY3);\n }\n }\n }\n titleEl.style(\"opacity\", opacity * Color2.opacity(fontColor)).call(Drawing.font, {\n color: Color2.rgb(fontColor),\n size: d3.round(fontSize, 2),\n family: fontFamily,\n weight: fontWeight,\n style: fontStyle,\n variant: fontVariant,\n textcase: fontTextcase,\n shadow: fontShadow,\n lineposition: fontLineposition\n }).attr(attributes).call(svgTextUtils.convertToTspans, gd, adjustSubtitlePosition);\n if (subtitleEl2) {\n var titleElMathGroup = group.select(\".\" + titleClass + \"-math-group\");\n var titleElBbox2 = titleEl.node().getBBox();\n var titleElMathBbox = titleElMathGroup.node() ? titleElMathGroup.node().getBBox() : void 0;\n var subtitleY2 = titleElMathBbox ? titleElMathBbox.y + titleElMathBbox.height + SUBTITLE_PADDING_MATHJAX_EM * subFontSize : titleElBbox2.y + titleElBbox2.height + SUBTITLE_PADDING_EM * subFontSize;\n var subtitleAttributes = Lib.extendFlat({}, attributes, {\n y: subtitleY2\n });\n subtitleEl2.attr(\"transform\", transformVal);\n subtitleEl2.style(\"opacity\", subtitleOpacity * Color2.opacity(subFontColor)).call(Drawing.font, {\n color: Color2.rgb(subFontColor),\n size: d3.round(subFontSize, 2),\n family: subFontFamily,\n weight: subFontWeight,\n style: subFontStyle,\n variant: subFontVariant,\n textcase: subFontTextcase,\n shadow: subFontShadow,\n lineposition: subFontLineposition\n }).attr(subtitleAttributes).call(svgTextUtils.convertToTspans, gd);\n }\n return Plots.previousPromises(gd);\n }\n function scootTitle(titleAndSubtitleEls) {\n var titleElIn = titleAndSubtitleEls.title;\n var titleGroup = d3.select(titleElIn.node().parentNode);\n if (avoid && avoid.selection && avoid.side && txt) {\n titleGroup.attr(\"transform\", null);\n var backside = OPPOSITE_SIDE[avoid.side];\n var shiftSign = avoid.side === \"left\" || avoid.side === \"top\" ? -1 : 1;\n var pad = isNumeric(avoid.pad) ? avoid.pad : 2;\n var titlebb = Drawing.bBox(titleGroup.node());\n var reservedMargins = { t: 0, b: 0, l: 0, r: 0 };\n var margins = gd._fullLayout._reservedMargin;\n for (var key in margins) {\n for (var side in margins[key]) {\n var val = margins[key][side];\n reservedMargins[side] = Math.max(reservedMargins[side], val);\n }\n }\n var paperbb = {\n left: reservedMargins.l,\n top: reservedMargins.t,\n right: fullLayout.width - reservedMargins.r,\n bottom: fullLayout.height - reservedMargins.b\n };\n var maxshift = avoid.maxShift || shiftSign * (paperbb[avoid.side] - titlebb[avoid.side]);\n var shift = 0;\n if (maxshift < 0) {\n shift = maxshift;\n } else {\n var offsetLeft = avoid.offsetLeft || 0;\n var offsetTop = avoid.offsetTop || 0;\n titlebb.left -= offsetLeft;\n titlebb.right -= offsetLeft;\n titlebb.top -= offsetTop;\n titlebb.bottom -= offsetTop;\n avoid.selection.each(function() {\n var avoidbb = Drawing.bBox(this);\n if (Lib.bBoxIntersect(titlebb, avoidbb, pad)) {\n shift = Math.max(shift, shiftSign * (avoidbb[avoid.side] - titlebb[backside]) + pad);\n }\n });\n shift = Math.min(maxshift, shift);\n cont._titleScoot = Math.abs(shift);\n }\n if (shift > 0 || maxshift < 0) {\n var shiftTemplate = {\n left: [-shift, 0],\n right: [shift, 0],\n top: [0, -shift],\n bottom: [0, shift]\n }[avoid.side];\n titleGroup.attr(\"transform\", strTranslate(shiftTemplate[0], shiftTemplate[1]));\n }\n }\n }\n el.call(titleLayout, subtitleEl);\n function setPlaceholder(element, placeholderText) {\n element.text(placeholderText).on(\"mouseover.opacity\", function() {\n d3.select(this).transition().duration(interactConstants.SHOW_PLACEHOLDER).style(\"opacity\", 1);\n }).on(\"mouseout.opacity\", function() {\n d3.select(this).transition().duration(interactConstants.HIDE_PLACEHOLDER).style(\"opacity\", 0);\n });\n }\n if (editable) {\n if (!txt) {\n setPlaceholder(el, placeholder);\n titleIsPlaceholder = true;\n } else el.on(\".opacity\", null);\n el.call(svgTextUtils.makeEditable, { gd }).on(\"edit\", function(text) {\n if (traceIndex !== void 0) {\n Registry.call(\"_guiRestyle\", gd, prop, text, traceIndex);\n } else {\n Registry.call(\"_guiRelayout\", gd, prop, text);\n }\n }).on(\"cancel\", function() {\n this.text(this.attr(\"data-unformatted\")).call(titleLayout);\n }).on(\"input\", function(d) {\n this.text(d || \" \").call(svgTextUtils.positionText, attributes.x, attributes.y);\n });\n if (subtitleEnabled) {\n if (subtitleEnabled && !txt) {\n var titleElBbox = el.node().getBBox();\n var subtitleY = titleElBbox.y + titleElBbox.height + SUBTITLE_PADDING_EM * subFontSize;\n subtitleEl.attr(\"y\", subtitleY);\n }\n if (!subtitleTxt) {\n setPlaceholder(subtitleEl, subtitlePlaceholder);\n subtitleIsPlaceholder = true;\n } else subtitleEl.on(\".opacity\", null);\n subtitleEl.call(svgTextUtils.makeEditable, { gd }).on(\"edit\", function(text) {\n Registry.call(\"_guiRelayout\", gd, \"title.subtitle.text\", text);\n }).on(\"cancel\", function() {\n this.text(this.attr(\"data-unformatted\")).call(titleLayout);\n }).on(\"input\", function(d) {\n this.text(d || \" \").call(svgTextUtils.positionText, subtitleEl.attr(\"x\"), subtitleEl.attr(\"y\"));\n });\n }\n }\n el.classed(\"js-placeholder\", titleIsPlaceholder);\n if (subtitleEl) subtitleEl.classed(\"js-placeholder\", subtitleIsPlaceholder);\n return group;\n }\n module.exports = {\n draw,\n SUBTITLE_PADDING_EM,\n SUBTITLE_PADDING_MATHJAX_EM\n };\n }\n });\n\n // src/plots/cartesian/set_convert.js\n var require_set_convert = __commonJS({\n \"src/plots/cartesian/set_convert.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var utcFormat = require_d3_time_format().utcFormat;\n var Lib = require_lib();\n var numberFormat = Lib.numberFormat;\n var isNumeric = require_fast_isnumeric();\n var cleanNumber = Lib.cleanNumber;\n var ms2DateTime = Lib.ms2DateTime;\n var dateTime2ms = Lib.dateTime2ms;\n var ensureNumber = Lib.ensureNumber;\n var isArrayOrTypedArray = Lib.isArrayOrTypedArray;\n var numConstants = require_numerical();\n var FP_SAFE = numConstants.FP_SAFE;\n var BADNUM = numConstants.BADNUM;\n var LOG_CLIP = numConstants.LOG_CLIP;\n var ONEWEEK = numConstants.ONEWEEK;\n var ONEDAY = numConstants.ONEDAY;\n var ONEHOUR = numConstants.ONEHOUR;\n var ONEMIN = numConstants.ONEMIN;\n var ONESEC = numConstants.ONESEC;\n var axisIds = require_axis_ids();\n var constants = require_constants2();\n var HOUR_PATTERN = constants.HOUR_PATTERN;\n var WEEKDAY_PATTERN = constants.WEEKDAY_PATTERN;\n function fromLog(v) {\n return Math.pow(10, v);\n }\n function isValidCategory(v) {\n return v !== null && v !== void 0;\n }\n module.exports = function setConvert(ax, fullLayout) {\n fullLayout = fullLayout || {};\n var axId = ax._id || \"x\";\n var axLetter = axId.charAt(0);\n function toLog(v, clip) {\n if (v > 0) return Math.log(v) / Math.LN10;\n else if (v <= 0 && clip && ax.range && ax.range.length === 2) {\n var r0 = ax.range[0];\n var r1 = ax.range[1];\n return 0.5 * (r0 + r1 - 2 * LOG_CLIP * Math.abs(r0 - r1));\n } else return BADNUM;\n }\n function dt2ms(v, _, calendar, opts) {\n if ((opts || {}).msUTC && isNumeric(v)) {\n return +v;\n }\n var ms = dateTime2ms(v, calendar || ax.calendar);\n if (ms === BADNUM) {\n if (isNumeric(v)) {\n v = +v;\n var msecTenths = Math.floor(Lib.mod(v + 0.05, 1) * 10);\n var msRounded = Math.round(v - msecTenths / 10);\n ms = dateTime2ms(new Date(msRounded)) + msecTenths / 10;\n } else return BADNUM;\n }\n return ms;\n }\n function ms2dt(v, r, calendar) {\n return ms2DateTime(v, r, calendar || ax.calendar);\n }\n function getCategoryName(v) {\n return ax._categories[Math.round(v)];\n }\n function setCategoryIndex(v) {\n if (isValidCategory(v)) {\n if (ax._categoriesMap === void 0) {\n ax._categoriesMap = {};\n }\n if (ax._categoriesMap[v] !== void 0) {\n return ax._categoriesMap[v];\n } else {\n ax._categories.push(typeof v === \"number\" ? String(v) : v);\n var curLength = ax._categories.length - 1;\n ax._categoriesMap[v] = curLength;\n return curLength;\n }\n }\n return BADNUM;\n }\n function setMultiCategoryIndex(arrayIn, len) {\n var arrayOut = new Array(len);\n for (var i = 0; i < len; i++) {\n var v0 = (arrayIn[0] || [])[i];\n var v1 = (arrayIn[1] || [])[i];\n arrayOut[i] = getCategoryIndex([v0, v1]);\n }\n return arrayOut;\n }\n function getCategoryIndex(v) {\n if (ax._categoriesMap) {\n return ax._categoriesMap[v];\n }\n }\n function getCategoryPosition(v) {\n var index = getCategoryIndex(v);\n if (index !== void 0) return index;\n if (isNumeric(v)) return +v;\n }\n function getRangePosition(v) {\n return isNumeric(v) ? +v : getCategoryIndex(v);\n }\n function _l2p(v, m, b) {\n return d3.round(b + m * v, 2);\n }\n function _p2l(px, m, b) {\n return (px - b) / m;\n }\n var l2p = function l2p2(v) {\n if (!isNumeric(v)) return BADNUM;\n return _l2p(v, ax._m, ax._b);\n };\n var p2l = function(px) {\n return _p2l(px, ax._m, ax._b);\n };\n if (ax.rangebreaks) {\n var isY = axLetter === \"y\";\n l2p = function(v) {\n if (!isNumeric(v)) return BADNUM;\n var len = ax._rangebreaks.length;\n if (!len) return _l2p(v, ax._m, ax._b);\n var flip = isY;\n if (ax.range[0] > ax.range[1]) flip = !flip;\n var signAx = flip ? -1 : 1;\n var pos = signAx * v;\n var q = 0;\n for (var i = 0; i < len; i++) {\n var min = signAx * ax._rangebreaks[i].min;\n var max = signAx * ax._rangebreaks[i].max;\n if (pos < min) break;\n if (pos > max) q = i + 1;\n else {\n q = pos < (min + max) / 2 ? i : i + 1;\n break;\n }\n }\n var b2 = ax._B[q] || 0;\n if (!isFinite(b2)) return 0;\n return _l2p(v, ax._m2, b2);\n };\n p2l = function(px) {\n var len = ax._rangebreaks.length;\n if (!len) return _p2l(px, ax._m, ax._b);\n var q = 0;\n for (var i = 0; i < len; i++) {\n if (px < ax._rangebreaks[i].pmin) break;\n if (px > ax._rangebreaks[i].pmax) q = i + 1;\n }\n return _p2l(px, ax._m2, ax._B[q]);\n };\n }\n ax.c2l = ax.type === \"log\" ? toLog : ensureNumber;\n ax.l2c = ax.type === \"log\" ? fromLog : ensureNumber;\n ax.l2p = l2p;\n ax.p2l = p2l;\n ax.c2p = ax.type === \"log\" ? function(v, clip) {\n return l2p(toLog(v, clip));\n } : l2p;\n ax.p2c = ax.type === \"log\" ? function(px) {\n return fromLog(p2l(px));\n } : p2l;\n if ([\"linear\", \"-\"].indexOf(ax.type) !== -1) {\n ax.d2r = ax.r2d = ax.d2c = ax.r2c = ax.d2l = ax.r2l = cleanNumber;\n ax.c2d = ax.c2r = ax.l2d = ax.l2r = ensureNumber;\n ax.d2p = ax.r2p = function(v) {\n return ax.l2p(cleanNumber(v));\n };\n ax.p2d = ax.p2r = p2l;\n ax.cleanPos = ensureNumber;\n } else if (ax.type === \"log\") {\n ax.d2r = ax.d2l = function(v, clip) {\n return toLog(cleanNumber(v), clip);\n };\n ax.r2d = ax.r2c = function(v) {\n return fromLog(cleanNumber(v));\n };\n ax.d2c = ax.r2l = cleanNumber;\n ax.c2d = ax.l2r = ensureNumber;\n ax.c2r = toLog;\n ax.l2d = fromLog;\n ax.d2p = function(v, clip) {\n return ax.l2p(ax.d2r(v, clip));\n };\n ax.p2d = function(px) {\n return fromLog(p2l(px));\n };\n ax.r2p = function(v) {\n return ax.l2p(cleanNumber(v));\n };\n ax.p2r = p2l;\n ax.cleanPos = ensureNumber;\n } else if (ax.type === \"date\") {\n ax.d2r = ax.r2d = Lib.identity;\n ax.d2c = ax.r2c = ax.d2l = ax.r2l = dt2ms;\n ax.c2d = ax.c2r = ax.l2d = ax.l2r = ms2dt;\n ax.d2p = ax.r2p = function(v, _, calendar) {\n return ax.l2p(dt2ms(v, 0, calendar));\n };\n ax.p2d = ax.p2r = function(px, r, calendar) {\n return ms2dt(p2l(px), r, calendar);\n };\n ax.cleanPos = function(v) {\n return Lib.cleanDate(v, BADNUM, ax.calendar);\n };\n } else if (ax.type === \"category\") {\n ax.d2c = ax.d2l = setCategoryIndex;\n ax.r2d = ax.c2d = ax.l2d = getCategoryName;\n ax.d2r = ax.d2l_noadd = getCategoryPosition;\n ax.r2c = function(v) {\n var index = getRangePosition(v);\n return index !== void 0 ? index : ax.fraction2r(0.5);\n };\n ax.l2r = ax.c2r = ensureNumber;\n ax.r2l = getRangePosition;\n ax.d2p = function(v) {\n return ax.l2p(ax.r2c(v));\n };\n ax.p2d = function(px) {\n return getCategoryName(p2l(px));\n };\n ax.r2p = ax.d2p;\n ax.p2r = p2l;\n ax.cleanPos = function(v) {\n if (typeof v === \"string\" && v !== \"\") return v;\n return ensureNumber(v);\n };\n } else if (ax.type === \"multicategory\") {\n ax.r2d = ax.c2d = ax.l2d = getCategoryName;\n ax.d2r = ax.d2l_noadd = getCategoryPosition;\n ax.r2c = function(v) {\n var index = getCategoryPosition(v);\n return index !== void 0 ? index : ax.fraction2r(0.5);\n };\n ax.r2c_just_indices = getCategoryIndex;\n ax.l2r = ax.c2r = ensureNumber;\n ax.r2l = getCategoryPosition;\n ax.d2p = function(v) {\n return ax.l2p(ax.r2c(v));\n };\n ax.p2d = function(px) {\n return getCategoryName(p2l(px));\n };\n ax.r2p = ax.d2p;\n ax.p2r = p2l;\n ax.cleanPos = function(v) {\n if (Array.isArray(v) || typeof v === \"string\" && v !== \"\") return v;\n return ensureNumber(v);\n };\n ax.setupMultiCategory = function(fullData) {\n var traceIndices = ax._traceIndices;\n var i, j;\n var group = ax._matchGroup;\n if (group && ax._categories.length === 0) {\n for (var axId2 in group) {\n if (axId2 !== axId) {\n var ax2 = fullLayout[axisIds.id2name(axId2)];\n traceIndices = traceIndices.concat(ax2._traceIndices);\n }\n }\n }\n var seen = [[0, {}], [0, {}]];\n var list = [];\n for (i = 0; i < traceIndices.length; i++) {\n var trace = fullData[traceIndices[i]];\n if (axLetter in trace) {\n var arrayIn = trace[axLetter];\n var len = trace._length || Lib.minRowLength(arrayIn);\n if (isArrayOrTypedArray(arrayIn[0]) && isArrayOrTypedArray(arrayIn[1])) {\n for (j = 0; j < len; j++) {\n var v0 = arrayIn[0][j];\n var v1 = arrayIn[1][j];\n if (isValidCategory(v0) && isValidCategory(v1)) {\n list.push([v0, v1]);\n if (!(v0 in seen[0][1])) {\n seen[0][1][v0] = seen[0][0]++;\n }\n if (!(v1 in seen[1][1])) {\n seen[1][1][v1] = seen[1][0]++;\n }\n }\n }\n }\n }\n }\n list.sort(function(a, b) {\n var ind0 = seen[0][1];\n var d = ind0[a[0]] - ind0[b[0]];\n if (d) return d;\n var ind1 = seen[1][1];\n return ind1[a[1]] - ind1[b[1]];\n });\n for (i = 0; i < list.length; i++) {\n setCategoryIndex(list[i]);\n }\n };\n }\n ax.fraction2r = function(v) {\n var rl0 = ax.r2l(ax.range[0]);\n var rl1 = ax.r2l(ax.range[1]);\n return ax.l2r(rl0 + v * (rl1 - rl0));\n };\n ax.r2fraction = function(v) {\n var rl0 = ax.r2l(ax.range[0]);\n var rl1 = ax.r2l(ax.range[1]);\n return (ax.r2l(v) - rl0) / (rl1 - rl0);\n };\n ax.limitRange = function(rangeAttr) {\n var minallowed = ax.minallowed;\n var maxallowed = ax.maxallowed;\n if (minallowed === void 0 && maxallowed === void 0) return;\n if (!rangeAttr) rangeAttr = \"range\";\n var range = Lib.nestedProperty(ax, rangeAttr).get();\n var rng = Lib.simpleMap(range, ax.r2l);\n var axrev = rng[1] < rng[0];\n if (axrev) rng.reverse();\n var bounds = Lib.simpleMap([minallowed, maxallowed], ax.r2l);\n if (minallowed !== void 0 && rng[0] < bounds[0]) range[axrev ? 1 : 0] = minallowed;\n if (maxallowed !== void 0 && rng[1] > bounds[1]) range[axrev ? 0 : 1] = maxallowed;\n if (range[0] === range[1]) {\n var minL = ax.l2r(minallowed);\n var maxL = ax.l2r(maxallowed);\n if (minallowed !== void 0) {\n var _max = minL + 1;\n if (maxallowed !== void 0) _max = Math.min(_max, maxL);\n range[axrev ? 1 : 0] = _max;\n }\n if (maxallowed !== void 0) {\n var _min = maxL + 1;\n if (minallowed !== void 0) _min = Math.max(_min, minL);\n range[axrev ? 0 : 1] = _min;\n }\n }\n };\n ax.cleanRange = function(rangeAttr, opts) {\n ax._cleanRange(rangeAttr, opts);\n ax.limitRange(rangeAttr);\n };\n ax._cleanRange = function(rangeAttr, opts) {\n if (!opts) opts = {};\n if (!rangeAttr) rangeAttr = \"range\";\n var range = Lib.nestedProperty(ax, rangeAttr).get();\n var i, dflt;\n if (ax.type === \"date\") dflt = Lib.dfltRange(ax.calendar);\n else if (axLetter === \"y\") dflt = constants.DFLTRANGEY;\n else if (ax._name === \"realaxis\") dflt = [0, 1];\n else dflt = opts.dfltRange || constants.DFLTRANGEX;\n dflt = dflt.slice();\n if (ax.rangemode === \"tozero\" || ax.rangemode === \"nonnegative\") {\n dflt[0] = 0;\n }\n if (!range || range.length !== 2) {\n Lib.nestedProperty(ax, rangeAttr).set(dflt);\n return;\n }\n var nullRange0 = range[0] === null;\n var nullRange1 = range[1] === null;\n if (ax.type === \"date\" && !ax.autorange) {\n range[0] = Lib.cleanDate(range[0], BADNUM, ax.calendar);\n range[1] = Lib.cleanDate(range[1], BADNUM, ax.calendar);\n }\n for (i = 0; i < 2; i++) {\n if (ax.type === \"date\") {\n if (!Lib.isDateTime(range[i], ax.calendar)) {\n ax[rangeAttr] = dflt;\n break;\n }\n if (ax.r2l(range[0]) === ax.r2l(range[1])) {\n var linCenter = Lib.constrain(\n ax.r2l(range[0]),\n Lib.MIN_MS + 1e3,\n Lib.MAX_MS - 1e3\n );\n range[0] = ax.l2r(linCenter - 1e3);\n range[1] = ax.l2r(linCenter + 1e3);\n break;\n }\n } else {\n if (!isNumeric(range[i])) {\n if (!(nullRange0 || nullRange1) && isNumeric(range[1 - i])) {\n range[i] = range[1 - i] * (i ? 10 : 0.1);\n } else {\n ax[rangeAttr] = dflt;\n break;\n }\n }\n if (range[i] < -FP_SAFE) range[i] = -FP_SAFE;\n else if (range[i] > FP_SAFE) range[i] = FP_SAFE;\n if (range[0] === range[1]) {\n var inc = Math.max(1, Math.abs(range[0] * 1e-6));\n range[0] -= inc;\n range[1] += inc;\n }\n }\n }\n };\n ax.setScale = function(usePrivateRange) {\n var gs = fullLayout._size;\n if (ax.overlaying) {\n var ax2 = axisIds.getFromId({ _fullLayout: fullLayout }, ax.overlaying);\n ax.domain = ax2.domain;\n }\n var rangeAttr = usePrivateRange && ax._r ? \"_r\" : \"range\";\n var calendar = ax.calendar;\n ax.cleanRange(rangeAttr);\n var rl0 = ax.r2l(ax[rangeAttr][0], calendar);\n var rl1 = ax.r2l(ax[rangeAttr][1], calendar);\n var isY2 = axLetter === \"y\";\n if (isY2) {\n ax._offset = gs.t + (1 - ax.domain[1]) * gs.h;\n ax._length = gs.h * (ax.domain[1] - ax.domain[0]);\n ax._m = ax._length / (rl0 - rl1);\n ax._b = -ax._m * rl1;\n } else {\n ax._offset = gs.l + ax.domain[0] * gs.w;\n ax._length = gs.w * (ax.domain[1] - ax.domain[0]);\n ax._m = ax._length / (rl1 - rl0);\n ax._b = -ax._m * rl0;\n }\n ax._rangebreaks = [];\n ax._lBreaks = 0;\n ax._m2 = 0;\n ax._B = [];\n if (ax.rangebreaks) {\n var i, brk;\n ax._rangebreaks = ax.locateBreaks(\n Math.min(rl0, rl1),\n Math.max(rl0, rl1)\n );\n if (ax._rangebreaks.length) {\n for (i = 0; i < ax._rangebreaks.length; i++) {\n brk = ax._rangebreaks[i];\n ax._lBreaks += Math.abs(brk.max - brk.min);\n }\n var flip = isY2;\n if (rl0 > rl1) flip = !flip;\n if (flip) ax._rangebreaks.reverse();\n var sign = flip ? -1 : 1;\n ax._m2 = sign * ax._length / (Math.abs(rl1 - rl0) - ax._lBreaks);\n ax._B.push(-ax._m2 * (isY2 ? rl1 : rl0));\n for (i = 0; i < ax._rangebreaks.length; i++) {\n brk = ax._rangebreaks[i];\n ax._B.push(\n ax._B[ax._B.length - 1] - sign * ax._m2 * (brk.max - brk.min)\n );\n }\n for (i = 0; i < ax._rangebreaks.length; i++) {\n brk = ax._rangebreaks[i];\n brk.pmin = l2p(brk.min);\n brk.pmax = l2p(brk.max);\n }\n }\n }\n if (!isFinite(ax._m) || !isFinite(ax._b) || ax._length < 0) {\n fullLayout._replotting = false;\n throw new Error(\"Something went wrong with axis scaling\");\n }\n };\n ax.maskBreaks = function(v) {\n var rangebreaksIn = ax.rangebreaks || [];\n var bnds, b0, b1, vb, vDate;\n if (!rangebreaksIn._cachedPatterns) {\n rangebreaksIn._cachedPatterns = rangebreaksIn.map(function(brk2) {\n return brk2.enabled && brk2.bounds ? Lib.simpleMap(\n brk2.bounds,\n brk2.pattern ? cleanNumber : ax.d2c\n // case of pattern: ''\n ) : null;\n });\n }\n if (!rangebreaksIn._cachedValues) {\n rangebreaksIn._cachedValues = rangebreaksIn.map(function(brk2) {\n return brk2.enabled && brk2.values ? Lib.simpleMap(brk2.values, ax.d2c).sort(Lib.sorterAsc) : null;\n });\n }\n for (var i = 0; i < rangebreaksIn.length; i++) {\n var brk = rangebreaksIn[i];\n if (brk.enabled) {\n if (brk.bounds) {\n var pattern = brk.pattern;\n bnds = rangebreaksIn._cachedPatterns[i];\n b0 = bnds[0];\n b1 = bnds[1];\n switch (pattern) {\n case WEEKDAY_PATTERN:\n vDate = new Date(v);\n vb = vDate.getUTCDay();\n if (b0 > b1) {\n b1 += 7;\n if (vb < b0) vb += 7;\n }\n break;\n case HOUR_PATTERN:\n vDate = new Date(v);\n var hours = vDate.getUTCHours();\n var minutes = vDate.getUTCMinutes();\n var seconds = vDate.getUTCSeconds();\n var milliseconds = vDate.getUTCMilliseconds();\n vb = hours + (minutes / 60 + seconds / 3600 + milliseconds / 36e5);\n if (b0 > b1) {\n b1 += 24;\n if (vb < b0) vb += 24;\n }\n break;\n case \"\":\n vb = v;\n break;\n }\n if (vb >= b0 && vb < b1) return BADNUM;\n } else {\n var vals = rangebreaksIn._cachedValues[i];\n for (var j = 0; j < vals.length; j++) {\n b0 = vals[j];\n b1 = b0 + brk.dvalue;\n if (v >= b0 && v < b1) return BADNUM;\n }\n }\n }\n }\n return v;\n };\n ax.locateBreaks = function(r0, r1) {\n var i, bnds, b0, b1;\n var rangebreaksOut = [];\n if (!ax.rangebreaks) return rangebreaksOut;\n var rangebreaksIn = ax.rangebreaks.slice().sort(function(a, b) {\n if (a.pattern === WEEKDAY_PATTERN && b.pattern === HOUR_PATTERN) return -1;\n if (b.pattern === WEEKDAY_PATTERN && a.pattern === HOUR_PATTERN) return 1;\n return 0;\n });\n var addBreak = function(min, max) {\n min = Lib.constrain(min, r0, r1);\n max = Lib.constrain(max, r0, r1);\n if (min === max) return;\n var isNewBreak = true;\n for (var j2 = 0; j2 < rangebreaksOut.length; j2++) {\n var brkj = rangebreaksOut[j2];\n if (min < brkj.max && max >= brkj.min) {\n if (min < brkj.min) {\n brkj.min = min;\n }\n if (max > brkj.max) {\n brkj.max = max;\n }\n isNewBreak = false;\n }\n }\n if (isNewBreak) {\n rangebreaksOut.push({ min, max });\n }\n };\n for (i = 0; i < rangebreaksIn.length; i++) {\n var brk = rangebreaksIn[i];\n if (brk.enabled) {\n if (brk.bounds) {\n var t02 = r0;\n var t12 = r1;\n if (brk.pattern) {\n t02 = Math.floor(t02);\n }\n bnds = Lib.simpleMap(brk.bounds, brk.pattern ? cleanNumber : ax.r2l);\n b0 = bnds[0];\n b1 = bnds[1];\n var t0Date = new Date(t02);\n var bndDelta;\n var step;\n switch (brk.pattern) {\n case WEEKDAY_PATTERN:\n step = ONEWEEK;\n bndDelta = ((b1 < b0 ? 7 : 0) + (b1 - b0)) * ONEDAY;\n t02 += b0 * ONEDAY - (t0Date.getUTCDay() * ONEDAY + t0Date.getUTCHours() * ONEHOUR + t0Date.getUTCMinutes() * ONEMIN + t0Date.getUTCSeconds() * ONESEC + t0Date.getUTCMilliseconds());\n break;\n case HOUR_PATTERN:\n step = ONEDAY;\n bndDelta = ((b1 < b0 ? 24 : 0) + (b1 - b0)) * ONEHOUR;\n t02 += b0 * ONEHOUR - (t0Date.getUTCHours() * ONEHOUR + t0Date.getUTCMinutes() * ONEMIN + t0Date.getUTCSeconds() * ONESEC + t0Date.getUTCMilliseconds());\n break;\n default:\n t02 = Math.min(bnds[0], bnds[1]);\n t12 = Math.max(bnds[0], bnds[1]);\n step = t12 - t02;\n bndDelta = step;\n }\n for (var t = t02; t < t12; t += step) {\n addBreak(t, t + bndDelta);\n }\n } else {\n var vals = Lib.simpleMap(brk.values, ax.d2c);\n for (var j = 0; j < vals.length; j++) {\n b0 = vals[j];\n b1 = b0 + brk.dvalue;\n addBreak(b0, b1);\n }\n }\n }\n }\n rangebreaksOut.sort(function(a, b) {\n return a.min - b.min;\n });\n return rangebreaksOut;\n };\n ax.makeCalcdata = function(trace, axLetter2, opts) {\n var arrayIn, arrayOut, i, len;\n var axType = ax.type;\n var cal = axType === \"date\" && trace[axLetter2 + \"calendar\"];\n if (axLetter2 in trace) {\n arrayIn = trace[axLetter2];\n len = trace._length || Lib.minRowLength(arrayIn);\n if (Lib.isTypedArray(arrayIn) && (axType === \"linear\" || axType === \"log\")) {\n if (len === arrayIn.length) {\n return arrayIn;\n } else if (arrayIn.subarray) {\n return arrayIn.subarray(0, len);\n }\n }\n if (axType === \"multicategory\") {\n return setMultiCategoryIndex(arrayIn, len);\n }\n arrayOut = new Array(len);\n for (i = 0; i < len; i++) {\n arrayOut[i] = ax.d2c(arrayIn[i], 0, cal, opts);\n }\n } else {\n var v0 = axLetter2 + \"0\" in trace ? ax.d2c(trace[axLetter2 + \"0\"], 0, cal) : 0;\n var dv = trace[\"d\" + axLetter2] ? Number(trace[\"d\" + axLetter2]) : 1;\n arrayIn = trace[{ x: \"y\", y: \"x\" }[axLetter2]];\n len = trace._length || arrayIn.length;\n arrayOut = new Array(len);\n for (i = 0; i < len; i++) {\n arrayOut[i] = v0 + i * dv;\n }\n }\n if (ax.rangebreaks) {\n for (i = 0; i < len; i++) {\n arrayOut[i] = ax.maskBreaks(arrayOut[i]);\n }\n }\n return arrayOut;\n };\n ax.isValidRange = function(range, nullOk) {\n return Array.isArray(range) && range.length === 2 && (nullOk && range[0] === null || isNumeric(ax.r2l(range[0]))) && (nullOk && range[1] === null || isNumeric(ax.r2l(range[1])));\n };\n ax.getAutorangeDflt = function(range, options) {\n var autorangeDflt = !ax.isValidRange(range, \"nullOk\");\n if (autorangeDflt && options && options.reverseDflt) autorangeDflt = \"reversed\";\n else if (range) {\n if (range[0] === null && range[1] === null) {\n autorangeDflt = true;\n } else if (range[0] === null && range[1] !== null) {\n autorangeDflt = \"min\";\n } else if (range[0] !== null && range[1] === null) {\n autorangeDflt = \"max\";\n }\n }\n return autorangeDflt;\n };\n ax.isReversed = function() {\n var autorange = ax.autorange;\n return autorange === \"reversed\" || autorange === \"min reversed\" || autorange === \"max reversed\";\n };\n ax.isPtWithinRange = function(d, calendar) {\n var coord = ax.c2l(d[axLetter], null, calendar);\n var r0 = ax.r2l(ax.range[0]);\n var r1 = ax.r2l(ax.range[1]);\n if (r0 < r1) {\n return r0 <= coord && coord <= r1;\n } else {\n return r1 <= coord && coord <= r0;\n }\n };\n ax._emptyCategories = function() {\n ax._categories = [];\n ax._categoriesMap = {};\n };\n ax.clearCalc = function() {\n var group = ax._matchGroup;\n if (group) {\n var categories = null;\n var categoriesMap = null;\n for (var axId2 in group) {\n var ax2 = fullLayout[axisIds.id2name(axId2)];\n if (ax2._categories) {\n categories = ax2._categories;\n categoriesMap = ax2._categoriesMap;\n break;\n }\n }\n if (categories && categoriesMap) {\n ax._categories = categories;\n ax._categoriesMap = categoriesMap;\n } else {\n ax._emptyCategories();\n }\n } else {\n ax._emptyCategories();\n }\n if (ax._initialCategories) {\n for (var j = 0; j < ax._initialCategories.length; j++) {\n setCategoryIndex(ax._initialCategories[j]);\n }\n }\n };\n ax.sortByInitialCategories = function() {\n var affectedTraces = [];\n ax._emptyCategories();\n if (ax._initialCategories) {\n for (var j = 0; j < ax._initialCategories.length; j++) {\n setCategoryIndex(ax._initialCategories[j]);\n }\n }\n affectedTraces = affectedTraces.concat(ax._traceIndices);\n var group = ax._matchGroup;\n for (var axId2 in group) {\n if (axId === axId2) continue;\n var ax2 = fullLayout[axisIds.id2name(axId2)];\n ax2._categories = ax._categories;\n ax2._categoriesMap = ax._categoriesMap;\n affectedTraces = affectedTraces.concat(ax2._traceIndices);\n }\n return affectedTraces;\n };\n var locale = fullLayout._d3locale;\n if (ax.type === \"date\") {\n ax._dateFormat = locale ? locale.timeFormat : utcFormat;\n ax._extraFormat = fullLayout._extraFormat;\n }\n ax._separators = fullLayout.separators;\n ax._numFormat = locale ? locale.numberFormat : numberFormat;\n delete ax._minDtick;\n delete ax._forceTick0;\n };\n }\n });\n\n // src/plots/cartesian/axis_autotype.js\n var require_axis_autotype = __commonJS({\n \"src/plots/cartesian/axis_autotype.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var BADNUM = require_numerical().BADNUM;\n var isArrayOrTypedArray = Lib.isArrayOrTypedArray;\n var isDateTime = Lib.isDateTime;\n var cleanNumber = Lib.cleanNumber;\n var round = Math.round;\n module.exports = function autoType(array, calendar, opts) {\n var a = array;\n var noMultiCategory = opts.noMultiCategory;\n if (isArrayOrTypedArray(a) && !a.length) return \"-\";\n if (!noMultiCategory && multiCategory(a)) return \"multicategory\";\n if (noMultiCategory && Array.isArray(a[0])) {\n var b = [];\n for (var i = 0; i < a.length; i++) {\n if (isArrayOrTypedArray(a[i])) {\n for (var j = 0; j < a[i].length; j++) {\n b.push(a[i][j]);\n }\n }\n }\n a = b;\n }\n if (moreDates(a, calendar)) return \"date\";\n var convertNumeric = opts.autotypenumbers !== \"strict\";\n if (category(a, convertNumeric)) return \"category\";\n if (linearOK(a, convertNumeric)) return \"linear\";\n return \"-\";\n };\n function hasTypeNumber(v, convertNumeric) {\n return convertNumeric ? isNumeric(v) : typeof v === \"number\";\n }\n function linearOK(a, convertNumeric) {\n var len = a.length;\n for (var i = 0; i < len; i++) {\n if (hasTypeNumber(a[i], convertNumeric)) return true;\n }\n return false;\n }\n function moreDates(a, calendar) {\n var len = a.length;\n var inc = getIncrement(len);\n var dats = 0;\n var nums = 0;\n var seen = {};\n for (var f = 0; f < len; f += inc) {\n var i = round(f);\n var ai = a[i];\n var stri = String(ai);\n if (seen[stri]) continue;\n seen[stri] = 1;\n if (isDateTime(ai, calendar)) dats++;\n if (isNumeric(ai)) nums++;\n }\n return dats > nums * 2;\n }\n function getIncrement(len) {\n return Math.max(1, (len - 1) / 1e3);\n }\n function category(a, convertNumeric) {\n var len = a.length;\n var inc = getIncrement(len);\n var nums = 0;\n var cats = 0;\n var seen = {};\n for (var f = 0; f < len; f += inc) {\n var i = round(f);\n var ai = a[i];\n var stri = String(ai);\n if (seen[stri]) continue;\n seen[stri] = 1;\n var t = typeof ai;\n if (t === \"boolean\") cats++;\n else if (convertNumeric ? cleanNumber(ai) !== BADNUM : t === \"number\") nums++;\n else if (t === \"string\") cats++;\n }\n return cats > nums * 2;\n }\n function multiCategory(a) {\n return isArrayOrTypedArray(a[0]) && isArrayOrTypedArray(a[1]);\n }\n }\n });\n\n // src/plots/cartesian/autorange.js\n var require_autorange = __commonJS({\n \"src/plots/cartesian/autorange.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var FP_SAFE = require_numerical().FP_SAFE;\n var Registry = require_registry();\n var Drawing = require_drawing();\n var axIds = require_axis_ids();\n var getFromId = axIds.getFromId;\n var isLinked = axIds.isLinked;\n module.exports = {\n applyAutorangeOptions,\n getAutoRange,\n makePadFn,\n doAutoRange,\n findExtremes,\n concatExtremes\n };\n function getAutoRange(gd, ax) {\n var i, j;\n var newRange = [];\n var fullLayout = gd._fullLayout;\n var getPadMin = makePadFn(fullLayout, ax, 0);\n var getPadMax = makePadFn(fullLayout, ax, 1);\n var extremes = concatExtremes(gd, ax);\n var minArray = extremes.min;\n var maxArray = extremes.max;\n if (minArray.length === 0 || maxArray.length === 0) {\n return Lib.simpleMap(ax.range, ax.r2l);\n }\n var minmin = minArray[0].val;\n var maxmax = maxArray[0].val;\n for (i = 1; i < minArray.length; i++) {\n if (minmin !== maxmax) break;\n minmin = Math.min(minmin, minArray[i].val);\n }\n for (i = 1; i < maxArray.length; i++) {\n if (minmin !== maxmax) break;\n maxmax = Math.max(maxmax, maxArray[i].val);\n }\n var autorange = ax.autorange;\n var axReverse = autorange === \"reversed\" || autorange === \"min reversed\" || autorange === \"max reversed\";\n if (!axReverse && ax.range) {\n var rng = Lib.simpleMap(ax.range, ax.r2l);\n axReverse = rng[1] < rng[0];\n }\n if (ax.autorange === \"reversed\") {\n ax.autorange = true;\n }\n var rangeMode = ax.rangemode;\n var toZero = rangeMode === \"tozero\";\n var nonNegative = rangeMode === \"nonnegative\";\n var axLen = ax._length;\n var minSpan = axLen / 10;\n var mbest = 0;\n var minpt, maxpt, minbest, maxbest, dp, dv;\n for (i = 0; i < minArray.length; i++) {\n minpt = minArray[i];\n for (j = 0; j < maxArray.length; j++) {\n maxpt = maxArray[j];\n dv = maxpt.val - minpt.val - calcBreaksLength(ax, minpt.val, maxpt.val);\n if (dv > 0) {\n dp = axLen - getPadMin(minpt) - getPadMax(maxpt);\n if (dp > minSpan) {\n if (dv / dp > mbest) {\n minbest = minpt;\n maxbest = maxpt;\n mbest = dv / dp;\n }\n } else if (dv / axLen > mbest) {\n minbest = { val: minpt.val, nopad: 1 };\n maxbest = { val: maxpt.val, nopad: 1 };\n mbest = dv / axLen;\n }\n }\n }\n }\n function maximumPad(prev, pt) {\n return Math.max(prev, getPadMax(pt));\n }\n if (minmin === maxmax) {\n var lower = minmin - 1;\n var upper = minmin + 1;\n if (toZero) {\n if (minmin === 0) {\n newRange = [0, 1];\n } else {\n var maxPad = (minmin > 0 ? maxArray : minArray).reduce(maximumPad, 0);\n var rangeEnd = minmin / (1 - Math.min(0.5, maxPad / axLen));\n newRange = minmin > 0 ? [0, rangeEnd] : [rangeEnd, 0];\n }\n } else if (nonNegative) {\n newRange = [Math.max(0, lower), Math.max(1, upper)];\n } else {\n newRange = [lower, upper];\n }\n } else {\n if (toZero) {\n if (minbest.val >= 0) {\n minbest = { val: 0, nopad: 1 };\n }\n if (maxbest.val <= 0) {\n maxbest = { val: 0, nopad: 1 };\n }\n } else if (nonNegative) {\n if (minbest.val - mbest * getPadMin(minbest) < 0) {\n minbest = { val: 0, nopad: 1 };\n }\n if (maxbest.val <= 0) {\n maxbest = { val: 1, nopad: 1 };\n }\n }\n mbest = (maxbest.val - minbest.val - calcBreaksLength(ax, minpt.val, maxpt.val)) / (axLen - getPadMin(minbest) - getPadMax(maxbest));\n newRange = [\n minbest.val - mbest * getPadMin(minbest),\n maxbest.val + mbest * getPadMax(maxbest)\n ];\n }\n newRange = applyAutorangeOptions(newRange, ax);\n if (ax.limitRange) ax.limitRange();\n if (axReverse) newRange.reverse();\n return Lib.simpleMap(newRange, ax.l2r || Number);\n }\n function calcBreaksLength(ax, v0, v1) {\n var lBreaks = 0;\n if (ax.rangebreaks) {\n var rangebreaksOut = ax.locateBreaks(v0, v1);\n for (var i = 0; i < rangebreaksOut.length; i++) {\n var brk = rangebreaksOut[i];\n lBreaks += brk.max - brk.min;\n }\n }\n return lBreaks;\n }\n function makePadFn(fullLayout, ax, max) {\n var extrappad = 0.05 * ax._length;\n var anchorAxis = ax._anchorAxis || {};\n if ((ax.ticklabelposition || \"\").indexOf(\"inside\") !== -1 || (anchorAxis.ticklabelposition || \"\").indexOf(\"inside\") !== -1) {\n var axReverse = ax.isReversed();\n if (!axReverse) {\n var rng = Lib.simpleMap(ax.range, ax.r2l);\n axReverse = rng[1] < rng[0];\n }\n if (axReverse) max = !max;\n }\n var zero2 = 0;\n if (!isLinked(fullLayout, ax._id)) {\n zero2 = padInsideLabelsOnAnchorAxis(fullLayout, ax, max);\n }\n extrappad = Math.max(zero2, extrappad);\n if (ax.constrain === \"domain\" && ax._inputDomain) {\n extrappad *= (ax._inputDomain[1] - ax._inputDomain[0]) / (ax.domain[1] - ax.domain[0]);\n }\n return function getPad(pt) {\n if (pt.nopad) return 0;\n return pt.pad + (pt.extrapad ? extrappad : zero2);\n };\n }\n var TEXTPAD = 3;\n function padInsideLabelsOnAnchorAxis(fullLayout, ax, max) {\n var pad = 0;\n var isX = ax._id.charAt(0) === \"x\";\n for (var subplot in fullLayout._plots) {\n var plotinfo = fullLayout._plots[subplot];\n if (ax._id !== plotinfo.xaxis._id && ax._id !== plotinfo.yaxis._id) continue;\n var anchorAxis = (isX ? plotinfo.yaxis : plotinfo.xaxis) || {};\n if ((anchorAxis.ticklabelposition || \"\").indexOf(\"inside\") !== -1) {\n if (!max && (anchorAxis.side === \"left\" || anchorAxis.side === \"bottom\") || max && (anchorAxis.side === \"top\" || anchorAxis.side === \"right\")) {\n if (anchorAxis._vals) {\n var rad = Lib.deg2rad(anchorAxis._tickAngles[anchorAxis._id + \"tick\"] || 0);\n var cosA = Math.abs(Math.cos(rad));\n var sinA = Math.abs(Math.sin(rad));\n if (!anchorAxis._vals[0].bb) {\n var cls = anchorAxis._id + \"tick\";\n var tickLabels = anchorAxis._selections[cls];\n tickLabels.each(function(d) {\n var thisLabel = d3.select(this);\n var mathjaxGroup = thisLabel.select(\".text-math-group\");\n if (mathjaxGroup.empty()) {\n d.bb = Drawing.bBox(thisLabel.node());\n }\n });\n }\n for (var i = 0; i < anchorAxis._vals.length; i++) {\n var t = anchorAxis._vals[i];\n var bb = t.bb;\n if (bb) {\n var w = 2 * TEXTPAD + bb.width;\n var h = 2 * TEXTPAD + bb.height;\n pad = Math.max(\n pad,\n isX ? Math.max(w * cosA, h * sinA) : Math.max(h * cosA, w * sinA)\n );\n }\n }\n }\n if (anchorAxis.ticks === \"inside\" && anchorAxis.ticklabelposition === \"inside\") {\n pad += anchorAxis.ticklen || 0;\n }\n }\n }\n }\n return pad;\n }\n function concatExtremes(gd, ax, noMatch) {\n var axId = ax._id;\n var fullData = gd._fullData;\n var fullLayout = gd._fullLayout;\n var minArray = [];\n var maxArray = [];\n var i, j, d;\n function _concat(cont, indices) {\n for (i = 0; i < indices.length; i++) {\n var item = cont[indices[i]];\n var extremes = (item._extremes || {})[axId];\n if (item.visible === true && extremes) {\n for (j = 0; j < extremes.min.length; j++) {\n d = extremes.min[j];\n collapseMinArray(minArray, d.val, d.pad, { extrapad: d.extrapad });\n }\n for (j = 0; j < extremes.max.length; j++) {\n d = extremes.max[j];\n collapseMaxArray(maxArray, d.val, d.pad, { extrapad: d.extrapad });\n }\n }\n }\n }\n _concat(fullData, ax._traceIndices);\n _concat(fullLayout.annotations || [], ax._annIndices || []);\n _concat(fullLayout.shapes || [], ax._shapeIndices || []);\n if (ax._matchGroup && !noMatch) {\n for (var axId2 in ax._matchGroup) {\n if (axId2 !== ax._id) {\n var ax2 = getFromId(gd, axId2);\n var extremes2 = concatExtremes(gd, ax2, true);\n var lenRatio = ax._length / ax2._length;\n for (j = 0; j < extremes2.min.length; j++) {\n d = extremes2.min[j];\n collapseMinArray(minArray, d.val, d.pad * lenRatio, { extrapad: d.extrapad });\n }\n for (j = 0; j < extremes2.max.length; j++) {\n d = extremes2.max[j];\n collapseMaxArray(maxArray, d.val, d.pad * lenRatio, { extrapad: d.extrapad });\n }\n }\n }\n }\n return { min: minArray, max: maxArray };\n }\n function doAutoRange(gd, ax, presetRange) {\n ax.setScale();\n if (ax.autorange) {\n ax.range = presetRange ? presetRange.slice() : getAutoRange(gd, ax);\n ax._r = ax.range.slice();\n ax._rl = Lib.simpleMap(ax._r, ax.r2l);\n var axIn = ax._input;\n var edits = {};\n edits[ax._attr + \".range\"] = ax.range;\n edits[ax._attr + \".autorange\"] = ax.autorange;\n Registry.call(\"_storeDirectGUIEdit\", gd.layout, gd._fullLayout._preGUI, edits);\n axIn.range = ax.range.slice();\n axIn.autorange = ax.autorange;\n }\n var anchorAx = ax._anchorAxis;\n if (anchorAx && anchorAx.rangeslider) {\n var axeRangeOpts = anchorAx.rangeslider[ax._name];\n if (axeRangeOpts) {\n if (axeRangeOpts.rangemode === \"auto\") {\n axeRangeOpts.range = getAutoRange(gd, ax);\n }\n }\n anchorAx._input.rangeslider[ax._name] = Lib.extendFlat({}, axeRangeOpts);\n }\n }\n function findExtremes(ax, data, opts) {\n if (!opts) opts = {};\n if (!ax._m) ax.setScale();\n var minArray = [];\n var maxArray = [];\n var len = data.length;\n var extrapad = opts.padded || false;\n var tozero = opts.tozero && (ax.type === \"linear\" || ax.type === \"-\");\n var isLog = ax.type === \"log\";\n var hasArrayOption = false;\n var vpadLinearized = opts.vpadLinearized || false;\n var i, v, di, dmin, dmax, ppadiplus, ppadiminus, vmin, vmax;\n function makePadAccessor(item) {\n if (Array.isArray(item)) {\n hasArrayOption = true;\n return function(i2) {\n return Math.max(Number(item[i2] || 0), 0);\n };\n } else {\n var v2 = Math.max(Number(item || 0), 0);\n return function() {\n return v2;\n };\n }\n }\n var ppadplus = makePadAccessor((ax._m > 0 ? opts.ppadplus : opts.ppadminus) || opts.ppad || 0);\n var ppadminus = makePadAccessor((ax._m > 0 ? opts.ppadminus : opts.ppadplus) || opts.ppad || 0);\n var vpadplus = makePadAccessor(opts.vpadplus || opts.vpad);\n var vpadminus = makePadAccessor(opts.vpadminus || opts.vpad);\n if (!hasArrayOption) {\n vmin = Infinity;\n vmax = -Infinity;\n if (isLog) {\n for (i = 0; i < len; i++) {\n v = data[i];\n if (v < vmin && v > 0) vmin = v;\n if (v > vmax && v < FP_SAFE) vmax = v;\n }\n } else {\n for (i = 0; i < len; i++) {\n v = data[i];\n if (v < vmin && v > -FP_SAFE) vmin = v;\n if (v > vmax && v < FP_SAFE) vmax = v;\n }\n }\n data = [vmin, vmax];\n len = 2;\n }\n var collapseOpts = { tozero, extrapad };\n function addItem(i2) {\n di = data[i2];\n if (!isNumeric(di)) return;\n ppadiplus = ppadplus(i2);\n ppadiminus = ppadminus(i2);\n if (vpadLinearized) {\n dmin = ax.c2l(di) - vpadminus(i2);\n dmax = ax.c2l(di) + vpadplus(i2);\n } else {\n vmin = di - vpadminus(i2);\n vmax = di + vpadplus(i2);\n if (isLog && vmin < vmax / 10) vmin = vmax / 10;\n dmin = ax.c2l(vmin);\n dmax = ax.c2l(vmax);\n }\n if (tozero) {\n dmin = Math.min(0, dmin);\n dmax = Math.max(0, dmax);\n }\n if (goodNumber(dmin)) {\n collapseMinArray(minArray, dmin, ppadiminus, collapseOpts);\n }\n if (goodNumber(dmax)) {\n collapseMaxArray(maxArray, dmax, ppadiplus, collapseOpts);\n }\n }\n var iMax = Math.min(6, len);\n for (i = 0; i < iMax; i++) addItem(i);\n for (i = len - 1; i >= iMax; i--) addItem(i);\n return {\n min: minArray,\n max: maxArray,\n opts\n };\n }\n function collapseMinArray(array, newVal, newPad, opts) {\n collapseArray(array, newVal, newPad, opts, lessOrEqual);\n }\n function collapseMaxArray(array, newVal, newPad, opts) {\n collapseArray(array, newVal, newPad, opts, greaterOrEqual);\n }\n function collapseArray(array, newVal, newPad, opts, atLeastAsExtreme) {\n var tozero = opts.tozero;\n var extrapad = opts.extrapad;\n var includeThis = true;\n for (var j = 0; j < array.length && includeThis; j++) {\n var v = array[j];\n if (atLeastAsExtreme(v.val, newVal) && v.pad >= newPad && (v.extrapad || !extrapad)) {\n includeThis = false;\n break;\n } else if (atLeastAsExtreme(newVal, v.val) && v.pad <= newPad && (extrapad || !v.extrapad)) {\n array.splice(j, 1);\n j--;\n }\n }\n if (includeThis) {\n var clipAtZero = tozero && newVal === 0;\n array.push({\n val: newVal,\n pad: clipAtZero ? 0 : newPad,\n extrapad: clipAtZero ? false : extrapad\n });\n }\n }\n function goodNumber(v) {\n return isNumeric(v) && Math.abs(v) < FP_SAFE;\n }\n function lessOrEqual(v0, v1) {\n return v0 <= v1;\n }\n function greaterOrEqual(v0, v1) {\n return v0 >= v1;\n }\n function applyAutorangeMinOptions(v, ax) {\n var autorangeoptions = ax.autorangeoptions;\n if (autorangeoptions && autorangeoptions.minallowed !== void 0 && hasValidMinAndMax(ax, autorangeoptions.minallowed, autorangeoptions.maxallowed)) {\n return autorangeoptions.minallowed;\n }\n if (autorangeoptions && autorangeoptions.clipmin !== void 0 && hasValidMinAndMax(ax, autorangeoptions.clipmin, autorangeoptions.clipmax)) {\n return Math.max(v, ax.d2l(autorangeoptions.clipmin));\n }\n return v;\n }\n function applyAutorangeMaxOptions(v, ax) {\n var autorangeoptions = ax.autorangeoptions;\n if (autorangeoptions && autorangeoptions.maxallowed !== void 0 && hasValidMinAndMax(ax, autorangeoptions.minallowed, autorangeoptions.maxallowed)) {\n return autorangeoptions.maxallowed;\n }\n if (autorangeoptions && autorangeoptions.clipmax !== void 0 && hasValidMinAndMax(ax, autorangeoptions.clipmin, autorangeoptions.clipmax)) {\n return Math.min(v, ax.d2l(autorangeoptions.clipmax));\n }\n return v;\n }\n function hasValidMinAndMax(ax, min, max) {\n if (min !== void 0 && max !== void 0) {\n min = ax.d2l(min);\n max = ax.d2l(max);\n return min < max;\n }\n return true;\n }\n function applyAutorangeOptions(range, ax) {\n if (!ax || !ax.autorangeoptions) return range;\n var min = range[0];\n var max = range[1];\n var include = ax.autorangeoptions.include;\n if (include !== void 0) {\n var lMin = ax.d2l(min);\n var lMax = ax.d2l(max);\n if (!Lib.isArrayOrTypedArray(include)) include = [include];\n for (var i = 0; i < include.length; i++) {\n var v = ax.d2l(include[i]);\n if (lMin >= v) {\n lMin = v;\n min = v;\n }\n if (lMax <= v) {\n lMax = v;\n max = v;\n }\n }\n }\n min = applyAutorangeMinOptions(min, ax);\n max = applyAutorangeMaxOptions(max, ax);\n return [min, max];\n }\n }\n });\n\n // src/plots/cartesian/axes.js\n var require_axes = __commonJS({\n \"src/plots/cartesian/axes.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var isNumeric = require_fast_isnumeric();\n var Plots = require_plots();\n var Registry = require_registry();\n var Lib = require_lib();\n var strTranslate = Lib.strTranslate;\n var svgTextUtils = require_svg_text_utils();\n var Titles = require_titles();\n var Color2 = require_color();\n var Drawing = require_drawing();\n var axAttrs = require_layout_attributes4();\n var cleanTicks = require_clean_ticks();\n var constants = require_numerical();\n var ONEMAXYEAR = constants.ONEMAXYEAR;\n var ONEAVGYEAR = constants.ONEAVGYEAR;\n var ONEMINYEAR = constants.ONEMINYEAR;\n var ONEMAXQUARTER = constants.ONEMAXQUARTER;\n var ONEAVGQUARTER = constants.ONEAVGQUARTER;\n var ONEMINQUARTER = constants.ONEMINQUARTER;\n var ONEMAXMONTH = constants.ONEMAXMONTH;\n var ONEAVGMONTH = constants.ONEAVGMONTH;\n var ONEMINMONTH = constants.ONEMINMONTH;\n var ONEWEEK = constants.ONEWEEK;\n var ONEDAY = constants.ONEDAY;\n var HALFDAY = ONEDAY / 2;\n var ONEHOUR = constants.ONEHOUR;\n var ONEMIN = constants.ONEMIN;\n var ONESEC = constants.ONESEC;\n var ONEMILLI = constants.ONEMILLI;\n var ONEMICROSEC = constants.ONEMICROSEC;\n var MINUS_SIGN = constants.MINUS_SIGN;\n var BADNUM = constants.BADNUM;\n var ZERO_PATH = { K: \"zeroline\" };\n var GRID_PATH = { K: \"gridline\", L: \"path\" };\n var MINORGRID_PATH = { K: \"minor-gridline\", L: \"path\" };\n var TICK_PATH = { K: \"tick\", L: \"path\" };\n var TICK_TEXT = { K: \"tick\", L: \"text\" };\n var MARGIN_MAPPING = {\n width: [\"x\", \"r\", \"l\", \"xl\", \"xr\"],\n height: [\"y\", \"t\", \"b\", \"yt\", \"yb\"],\n right: [\"r\", \"xr\"],\n left: [\"l\", \"xl\"],\n top: [\"t\", \"yt\"],\n bottom: [\"b\", \"yb\"]\n };\n var alignmentConstants = require_alignment();\n var MID_SHIFT = alignmentConstants.MID_SHIFT;\n var CAP_SHIFT = alignmentConstants.CAP_SHIFT;\n var LINE_SPACING = alignmentConstants.LINE_SPACING;\n var OPPOSITE_SIDE = alignmentConstants.OPPOSITE_SIDE;\n var TEXTPAD = 3;\n var axes = module.exports = {};\n axes.setConvert = require_set_convert();\n var autoType = require_axis_autotype();\n var axisIds = require_axis_ids();\n var idSort = axisIds.idSort;\n var isLinked = axisIds.isLinked;\n axes.id2name = axisIds.id2name;\n axes.name2id = axisIds.name2id;\n axes.cleanId = axisIds.cleanId;\n axes.list = axisIds.list;\n axes.listIds = axisIds.listIds;\n axes.getFromId = axisIds.getFromId;\n axes.getFromTrace = axisIds.getFromTrace;\n var autorange = require_autorange();\n axes.getAutoRange = autorange.getAutoRange;\n axes.findExtremes = autorange.findExtremes;\n var epsilon = 1e-4;\n function expandRange(range) {\n var delta = (range[1] - range[0]) * epsilon;\n return [\n range[0] - delta,\n range[1] + delta\n ];\n }\n axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption) {\n var axLetter = attr.charAt(attr.length - 1);\n var axlist = gd._fullLayout._subplots[axLetter + \"axis\"];\n var refAttr = attr + \"ref\";\n var attrDef = {};\n if (!dflt) dflt = axlist[0] || (typeof extraOption === \"string\" ? extraOption : extraOption[0]);\n if (!extraOption) extraOption = dflt;\n axlist = axlist.concat(axlist.map(function(x) {\n return x + \" domain\";\n }));\n attrDef[refAttr] = {\n valType: \"enumerated\",\n values: axlist.concat(extraOption ? typeof extraOption === \"string\" ? [extraOption] : extraOption : []),\n dflt\n };\n return Lib.coerce(containerIn, containerOut, attrDef, refAttr);\n };\n axes.getRefType = function(ar) {\n if (ar === void 0) {\n return ar;\n }\n if (ar === \"paper\") {\n return \"paper\";\n }\n if (ar === \"pixel\") {\n return \"pixel\";\n }\n if (/( domain)$/.test(ar)) {\n return \"domain\";\n } else {\n return \"range\";\n }\n };\n axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) {\n var cleanPos, pos;\n var axRefType = axes.getRefType(axRef);\n if (axRefType !== \"range\") {\n cleanPos = Lib.ensureNumber;\n pos = coerce(attr, dflt);\n } else {\n var ax = axes.getFromId(gd, axRef);\n dflt = ax.fraction2r(dflt);\n pos = coerce(attr, dflt);\n cleanPos = ax.cleanPos;\n }\n containerOut[attr] = cleanPos(pos);\n };\n axes.cleanPosition = function(pos, gd, axRef) {\n var cleanPos = axRef === \"paper\" || axRef === \"pixel\" ? Lib.ensureNumber : axes.getFromId(gd, axRef).cleanPos;\n return cleanPos(pos);\n };\n axes.redrawComponents = function(gd, axIds) {\n axIds = axIds ? axIds : axes.listIds(gd);\n var fullLayout = gd._fullLayout;\n function _redrawOneComp(moduleName, methodName, stashName, shortCircuit) {\n var method = Registry.getComponentMethod(moduleName, methodName);\n var stash = {};\n for (var i = 0; i < axIds.length; i++) {\n var ax = fullLayout[axes.id2name(axIds[i])];\n var indices = ax[stashName];\n for (var j = 0; j < indices.length; j++) {\n var ind = indices[j];\n if (!stash[ind]) {\n method(gd, ind);\n stash[ind] = 1;\n if (shortCircuit) return;\n }\n }\n }\n }\n _redrawOneComp(\"annotations\", \"drawOne\", \"_annIndices\");\n _redrawOneComp(\"shapes\", \"drawOne\", \"_shapeIndices\");\n _redrawOneComp(\"images\", \"draw\", \"_imgIndices\", true);\n _redrawOneComp(\"selections\", \"drawOne\", \"_selectionIndices\");\n };\n var getDataConversions = axes.getDataConversions = function(gd, trace, target, targetArray) {\n var ax;\n var d2cTarget = target === \"x\" || target === \"y\" || target === \"z\" ? target : targetArray;\n if (Lib.isArrayOrTypedArray(d2cTarget)) {\n ax = {\n type: autoType(targetArray, void 0, {\n autotypenumbers: gd._fullLayout.autotypenumbers\n }),\n _categories: []\n };\n axes.setConvert(ax);\n if (ax.type === \"category\") {\n for (var i = 0; i < targetArray.length; i++) {\n ax.d2c(targetArray[i]);\n }\n }\n } else {\n ax = axes.getFromTrace(gd, trace, d2cTarget);\n }\n if (ax) return { d2c: ax.d2c, c2d: ax.c2d };\n if (d2cTarget === \"ids\") return { d2c: toString, c2d: toString };\n return { d2c: toNum, c2d: toNum };\n };\n function toNum(v) {\n return +v;\n }\n function toString(v) {\n return String(v);\n }\n axes.getDataToCoordFunc = function(gd, trace, target, targetArray) {\n return getDataConversions(gd, trace, target, targetArray).d2c;\n };\n axes.counterLetter = function(id) {\n var axLetter = id.charAt(0);\n if (axLetter === \"x\") return \"y\";\n if (axLetter === \"y\") return \"x\";\n };\n axes.minDtick = function(ax, newDiff, newFirst, allow) {\n if ([\"log\", \"category\", \"multicategory\"].indexOf(ax.type) !== -1 || !allow) {\n ax._minDtick = 0;\n } else if (ax._minDtick === void 0) {\n ax._minDtick = newDiff;\n ax._forceTick0 = newFirst;\n } else if (ax._minDtick) {\n if ((ax._minDtick / newDiff + 1e-6) % 1 < 2e-6 && // existing minDtick is an integer multiple of newDiff\n // (within rounding err)\n // and forceTick0 can be shifted to newFirst\n ((newFirst - ax._forceTick0) / newDiff % 1 + 1.000001) % 1 < 2e-6) {\n ax._minDtick = newDiff;\n ax._forceTick0 = newFirst;\n } else if ((newDiff / ax._minDtick + 1e-6) % 1 > 2e-6 || // if the converse is true (newDiff is a multiple of minDtick and\n // newFirst can be shifted to forceTick0) then do nothing - same\n // forcing stands. Otherwise, cancel forced minimum\n ((newFirst - ax._forceTick0) / ax._minDtick % 1 + 1.000001) % 1 > 2e-6) {\n ax._minDtick = 0;\n }\n }\n };\n axes.saveRangeInitial = function(gd, overwrite) {\n var axList = axes.list(gd, \"\", true);\n var hasOneAxisChanged = false;\n for (var i = 0; i < axList.length; i++) {\n var ax = axList[i];\n var isNew = ax._rangeInitial0 === void 0 && ax._rangeInitial1 === void 0;\n var hasChanged = isNew || (ax.range[0] !== ax._rangeInitial0 || ax.range[1] !== ax._rangeInitial1);\n var autorange2 = ax.autorange;\n if (isNew && autorange2 !== true || overwrite && hasChanged) {\n ax._rangeInitial0 = autorange2 === \"min\" || autorange2 === \"max reversed\" ? void 0 : ax.range[0];\n ax._rangeInitial1 = autorange2 === \"max\" || autorange2 === \"min reversed\" ? void 0 : ax.range[1];\n ax._autorangeInitial = autorange2;\n hasOneAxisChanged = true;\n }\n }\n return hasOneAxisChanged;\n };\n axes.saveShowSpikeInitial = function(gd, overwrite) {\n var axList = axes.list(gd, \"\", true);\n var hasOneAxisChanged = false;\n var allSpikesEnabled = \"on\";\n for (var i = 0; i < axList.length; i++) {\n var ax = axList[i];\n var isNew = ax._showSpikeInitial === void 0;\n var hasChanged = isNew || !(ax.showspikes === ax._showspikes);\n if (isNew || overwrite && hasChanged) {\n ax._showSpikeInitial = ax.showspikes;\n hasOneAxisChanged = true;\n }\n if (allSpikesEnabled === \"on\" && !ax.showspikes) {\n allSpikesEnabled = \"off\";\n }\n }\n gd._fullLayout._cartesianSpikesEnabled = allSpikesEnabled;\n return hasOneAxisChanged;\n };\n axes.autoBin = function(data, ax, nbins, is2d, calendar, size) {\n var dataMin = Lib.aggNums(Math.min, null, data);\n var dataMax = Lib.aggNums(Math.max, null, data);\n if (ax.type === \"category\" || ax.type === \"multicategory\") {\n return {\n start: dataMin - 0.5,\n end: dataMax + 0.5,\n size: Math.max(1, Math.round(size) || 1),\n _dataSpan: dataMax - dataMin\n };\n }\n if (!calendar) calendar = ax.calendar;\n var dummyAx;\n if (ax.type === \"log\") {\n dummyAx = {\n type: \"linear\",\n range: [dataMin, dataMax]\n };\n } else {\n dummyAx = {\n type: ax.type,\n range: Lib.simpleMap([dataMin, dataMax], ax.c2r, 0, calendar),\n calendar\n };\n }\n axes.setConvert(dummyAx);\n size = size && cleanTicks.dtick(size, dummyAx.type);\n if (size) {\n dummyAx.dtick = size;\n dummyAx.tick0 = cleanTicks.tick0(void 0, dummyAx.type, calendar);\n } else {\n var size0;\n if (nbins) size0 = (dataMax - dataMin) / nbins;\n else {\n var distinctData = Lib.distinctVals(data);\n var msexp = Math.pow(10, Math.floor(\n Math.log(distinctData.minDiff) / Math.LN10\n ));\n var minSize = msexp * Lib.roundUp(\n distinctData.minDiff / msexp,\n [0.9, 1.9, 4.9, 9.9],\n true\n );\n size0 = Math.max(minSize, 2 * Lib.stdev(data) / Math.pow(data.length, is2d ? 0.25 : 0.4));\n if (!isNumeric(size0)) size0 = 1;\n }\n axes.autoTicks(dummyAx, size0);\n }\n var finalSize = dummyAx.dtick;\n var binStart = axes.tickIncrement(\n axes.tickFirst(dummyAx),\n finalSize,\n \"reverse\",\n calendar\n );\n var binEnd, bincount;\n if (typeof finalSize === \"number\") {\n binStart = autoShiftNumericBins(binStart, data, dummyAx, dataMin, dataMax);\n bincount = 1 + Math.floor((dataMax - binStart) / finalSize);\n binEnd = binStart + bincount * finalSize;\n } else {\n if (dummyAx.dtick.charAt(0) === \"M\") {\n binStart = autoShiftMonthBins(binStart, data, finalSize, dataMin, calendar);\n }\n binEnd = binStart;\n bincount = 0;\n while (binEnd <= dataMax) {\n binEnd = axes.tickIncrement(binEnd, finalSize, false, calendar);\n bincount++;\n }\n }\n return {\n start: ax.c2r(binStart, 0, calendar),\n end: ax.c2r(binEnd, 0, calendar),\n size: finalSize,\n _dataSpan: dataMax - dataMin\n };\n };\n function autoShiftNumericBins(binStart, data, ax, dataMin, dataMax) {\n var edgecount = 0;\n var midcount = 0;\n var intcount = 0;\n var blankCount = 0;\n function nearEdge(v) {\n return (1 + (v - binStart) * 100 / ax.dtick) % 100 < 2;\n }\n for (var i = 0; i < data.length; i++) {\n if (data[i] % 1 === 0) intcount++;\n else if (!isNumeric(data[i])) blankCount++;\n if (nearEdge(data[i])) edgecount++;\n if (nearEdge(data[i] + ax.dtick / 2)) midcount++;\n }\n var dataCount = data.length - blankCount;\n if (intcount === dataCount && ax.type !== \"date\") {\n if (ax.dtick < 1) {\n binStart = dataMin - 0.5 * ax.dtick;\n } else {\n binStart -= 0.5;\n if (binStart + ax.dtick < dataMin) binStart += ax.dtick;\n }\n } else if (midcount < dataCount * 0.1) {\n if (edgecount > dataCount * 0.3 || nearEdge(dataMin) || nearEdge(dataMax)) {\n var binshift = ax.dtick / 2;\n binStart += binStart + binshift < dataMin ? binshift : -binshift;\n }\n }\n return binStart;\n }\n function autoShiftMonthBins(binStart, data, dtick, dataMin, calendar) {\n var stats = Lib.findExactDates(data, calendar);\n var threshold = 0.8;\n if (stats.exactDays > threshold) {\n var numMonths = Number(dtick.substr(1));\n if (stats.exactYears > threshold && numMonths % 12 === 0) {\n binStart = axes.tickIncrement(binStart, \"M6\", \"reverse\") + ONEDAY * 1.5;\n } else if (stats.exactMonths > threshold) {\n binStart = axes.tickIncrement(binStart, \"M1\", \"reverse\") + ONEDAY * 15.5;\n } else {\n binStart -= HALFDAY;\n }\n var nextBinStart = axes.tickIncrement(binStart, dtick);\n if (nextBinStart <= dataMin) return nextBinStart;\n }\n return binStart;\n }\n axes.prepMinorTicks = function(mockAx, ax, opts) {\n if (!ax.minor.dtick) {\n delete mockAx.dtick;\n var hasMajor = ax.dtick && isNumeric(ax._tmin);\n var mockMinorRange;\n if (hasMajor) {\n var tick2 = axes.tickIncrement(ax._tmin, ax.dtick, true);\n mockMinorRange = [ax._tmin, tick2 * 0.99 + ax._tmin * 0.01];\n } else {\n var rl = Lib.simpleMap(ax.range, ax.r2l);\n mockMinorRange = [rl[0], 0.8 * rl[0] + 0.2 * rl[1]];\n }\n mockAx.range = Lib.simpleMap(mockMinorRange, ax.l2r);\n mockAx._isMinor = true;\n axes.prepTicks(mockAx, opts);\n if (hasMajor) {\n var numericMajor = isNumeric(ax.dtick);\n var numericMinor = isNumeric(mockAx.dtick);\n var majorNum = numericMajor ? ax.dtick : +ax.dtick.substring(1);\n var minorNum = numericMinor ? mockAx.dtick : +mockAx.dtick.substring(1);\n if (numericMajor && numericMinor) {\n if (!isMultiple(majorNum, minorNum)) {\n if (majorNum === 2 * ONEWEEK && minorNum === 3 * ONEDAY) {\n mockAx.dtick = ONEWEEK;\n } else if (majorNum === ONEWEEK && !(ax._input.minor || {}).nticks) {\n mockAx.dtick = ONEDAY;\n } else if (isClose(majorNum / minorNum, 2.5)) {\n mockAx.dtick = majorNum / 2;\n } else {\n mockAx.dtick = majorNum;\n }\n } else if (majorNum === 2 * ONEWEEK && minorNum === 2 * ONEDAY) {\n mockAx.dtick = ONEWEEK;\n }\n } else if (String(ax.dtick).charAt(0) === \"M\") {\n if (numericMinor) {\n mockAx.dtick = \"M1\";\n } else {\n if (!isMultiple(majorNum, minorNum)) {\n mockAx.dtick = ax.dtick;\n } else if (majorNum >= 12 && minorNum === 2) {\n mockAx.dtick = \"M3\";\n }\n }\n } else if (String(mockAx.dtick).charAt(0) === \"L\") {\n if (String(ax.dtick).charAt(0) === \"L\") {\n if (!isMultiple(majorNum, minorNum)) {\n mockAx.dtick = isClose(majorNum / minorNum, 2.5) ? ax.dtick / 2 : ax.dtick;\n }\n } else {\n mockAx.dtick = \"D1\";\n }\n } else if (mockAx.dtick === \"D2\" && +ax.dtick > 1) {\n mockAx.dtick = 1;\n }\n }\n mockAx.range = ax.range;\n }\n if (ax.minor._tick0Init === void 0) {\n mockAx.tick0 = ax.tick0;\n }\n };\n function isMultiple(bigger, smaller) {\n return Math.abs((bigger / smaller + 0.5) % 1 - 0.5) < 1e-3;\n }\n function isClose(a, b) {\n return Math.abs(a / b - 1) < 1e-3;\n }\n axes.prepTicks = function(ax, opts) {\n var rng = Lib.simpleMap(ax.range, ax.r2l, void 0, void 0, opts);\n if (ax.tickmode === \"auto\" || !ax.dtick) {\n var nt = ax.nticks;\n var minPx;\n if (!nt) {\n if (ax.type === \"category\" || ax.type === \"multicategory\") {\n minPx = ax.tickfont ? Lib.bigFont(ax.tickfont.size || 12) : 15;\n nt = ax._length / minPx;\n } else {\n minPx = ax._id.charAt(0) === \"y\" ? 40 : 80;\n nt = Lib.constrain(ax._length / minPx, 4, 9) + 1;\n }\n if (ax._name === \"radialaxis\") nt *= 2;\n }\n if (!(ax.minor && ax.minor.tickmode !== \"array\")) {\n if (ax.tickmode === \"array\") nt *= 100;\n }\n ax._roughDTick = Math.abs(rng[1] - rng[0]) / nt;\n axes.autoTicks(ax, ax._roughDTick);\n if (ax._minDtick > 0 && ax.dtick < ax._minDtick * 2) {\n ax.dtick = ax._minDtick;\n ax.tick0 = ax.l2r(ax._forceTick0);\n }\n }\n if (ax.ticklabelmode === \"period\") {\n adjustPeriodDelta(ax);\n }\n if (!ax.tick0) {\n ax.tick0 = ax.type === \"date\" ? \"2000-01-01\" : 0;\n }\n if (ax.type === \"date\" && ax.dtick < 0.1) ax.dtick = 0.1;\n autoTickRound(ax);\n };\n function nMonths(dtick) {\n return +dtick.substring(1);\n }\n function adjustPeriodDelta(ax) {\n var definedDelta;\n function mDate() {\n return !(isNumeric(ax.dtick) || ax.dtick.charAt(0) !== \"M\");\n }\n var isMDate = mDate();\n var tickformat = axes.getTickFormat(ax);\n if (tickformat) {\n var noDtick = ax._dtickInit !== ax.dtick;\n if (!/%[fLQsSMX]/.test(tickformat)) {\n if (/%[HI]/.test(tickformat)) {\n definedDelta = ONEHOUR;\n if (noDtick && !isMDate && ax.dtick < ONEHOUR) ax.dtick = ONEHOUR;\n } else if (/%p/.test(tickformat)) {\n definedDelta = HALFDAY;\n if (noDtick && !isMDate && ax.dtick < HALFDAY) ax.dtick = HALFDAY;\n } else if (/%[Aadejuwx]/.test(tickformat)) {\n definedDelta = ONEDAY;\n if (noDtick && !isMDate && ax.dtick < ONEDAY) ax.dtick = ONEDAY;\n } else if (/%[UVW]/.test(tickformat)) {\n definedDelta = ONEWEEK;\n if (noDtick && !isMDate && ax.dtick < ONEWEEK) ax.dtick = ONEWEEK;\n } else if (/%[Bbm]/.test(tickformat)) {\n definedDelta = ONEAVGMONTH;\n if (noDtick && (isMDate ? nMonths(ax.dtick) < 1 : ax.dtick < ONEMINMONTH)) ax.dtick = \"M1\";\n } else if (/%[q]/.test(tickformat)) {\n definedDelta = ONEAVGQUARTER;\n if (noDtick && (isMDate ? nMonths(ax.dtick) < 3 : ax.dtick < ONEMINQUARTER)) ax.dtick = \"M3\";\n } else if (/%[Yy]/.test(tickformat)) {\n definedDelta = ONEAVGYEAR;\n if (noDtick && (isMDate ? nMonths(ax.dtick) < 12 : ax.dtick < ONEMINYEAR)) ax.dtick = \"M12\";\n }\n }\n }\n isMDate = mDate();\n if (isMDate && ax.tick0 === ax._dowTick0) {\n ax.tick0 = ax._rawTick0;\n }\n ax._definedDelta = definedDelta;\n }\n function positionPeriodTicks(tickVals, ax, definedDelta) {\n for (var i = 0; i < tickVals.length; i++) {\n var v = tickVals[i].value;\n var a = i;\n var b = i + 1;\n if (i < tickVals.length - 1) {\n a = i;\n b = i + 1;\n } else if (i > 0) {\n a = i - 1;\n b = i;\n } else {\n a = i;\n b = i;\n }\n var A2 = tickVals[a].value;\n var B2 = tickVals[b].value;\n var actualDelta = Math.abs(B2 - A2);\n var delta = definedDelta || actualDelta;\n var periodLength = 0;\n if (delta >= ONEMINYEAR) {\n if (actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) {\n periodLength = actualDelta;\n } else {\n periodLength = ONEAVGYEAR;\n }\n } else if (definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) {\n if (actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) {\n periodLength = actualDelta;\n } else {\n periodLength = ONEAVGQUARTER;\n }\n } else if (delta >= ONEMINMONTH) {\n if (actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) {\n periodLength = actualDelta;\n } else {\n periodLength = ONEAVGMONTH;\n }\n } else if (definedDelta === ONEWEEK && delta >= ONEWEEK) {\n periodLength = ONEWEEK;\n } else if (delta >= ONEDAY) {\n periodLength = ONEDAY;\n } else if (definedDelta === HALFDAY && delta >= HALFDAY) {\n periodLength = HALFDAY;\n } else if (definedDelta === ONEHOUR && delta >= ONEHOUR) {\n periodLength = ONEHOUR;\n }\n var inBetween;\n if (periodLength >= actualDelta) {\n periodLength = actualDelta;\n inBetween = true;\n }\n var endPeriod = v + periodLength;\n if (ax.rangebreaks && periodLength > 0) {\n var nAll = 84;\n var n = 0;\n for (var c = 0; c < nAll; c++) {\n var r = (c + 0.5) / nAll;\n if (ax.maskBreaks(v * (1 - r) + r * endPeriod) !== BADNUM) n++;\n }\n periodLength *= n / nAll;\n if (!periodLength) {\n tickVals[i].drop = true;\n }\n if (inBetween && actualDelta > ONEWEEK) periodLength = actualDelta;\n }\n if (periodLength > 0 || // not instant\n i === 0) {\n tickVals[i].periodX = v + periodLength / 2;\n }\n }\n }\n axes.calcTicks = function calcTicks(ax, opts) {\n var type = ax.type;\n var calendar = ax.calendar;\n var ticklabelstep = ax.ticklabelstep;\n var isPeriod = ax.ticklabelmode === \"period\";\n var isReversed = ax.range[0] > ax.range[1];\n var ticklabelIndex = !ax.ticklabelindex || Lib.isArrayOrTypedArray(ax.ticklabelindex) ? ax.ticklabelindex : [ax.ticklabelindex];\n var rng = Lib.simpleMap(ax.range, ax.r2l, void 0, void 0, opts);\n var axrev = rng[1] < rng[0];\n var minRange = Math.min(rng[0], rng[1]);\n var maxRange = Math.max(rng[0], rng[1]);\n var maxTicks = Math.max(1e3, ax._length || 0);\n var ticksOut = [];\n var minorTicks = [];\n var tickVals = [];\n var minorTickVals = [];\n var allTicklabelVals = [];\n var hasMinor = ax.minor && (ax.minor.ticks || ax.minor.showgrid);\n for (var major = 1; major >= (hasMinor ? 0 : 1); major--) {\n var isMinor = !major;\n if (major) {\n ax._dtickInit = ax.dtick;\n ax._tick0Init = ax.tick0;\n } else {\n ax.minor._dtickInit = ax.minor.dtick;\n ax.minor._tick0Init = ax.minor.tick0;\n }\n var mockAx = major ? ax : Lib.extendFlat({}, ax, ax.minor);\n if (isMinor) {\n axes.prepMinorTicks(mockAx, ax, opts);\n } else {\n axes.prepTicks(mockAx, opts);\n }\n if (mockAx.tickmode === \"array\") {\n if (major) {\n tickVals = [];\n ticksOut = arrayTicks(ax, !isMinor);\n } else {\n minorTickVals = [];\n minorTicks = arrayTicks(ax, !isMinor);\n }\n continue;\n }\n if (mockAx.tickmode === \"sync\") {\n tickVals = [];\n ticksOut = syncTicks(ax);\n continue;\n }\n var exRng = expandRange(rng);\n var startTick = exRng[0];\n var endTick = exRng[1];\n var numDtick = isNumeric(mockAx.dtick);\n var isDLog = type === \"log\" && !(numDtick || mockAx.dtick.charAt(0) === \"L\");\n var x0 = axes.tickFirst(mockAx, opts);\n if (major) {\n ax._tmin = x0;\n if (x0 < startTick !== axrev) break;\n if (type === \"category\" || type === \"multicategory\") {\n endTick = axrev ? Math.max(-0.5, endTick) : Math.min(ax._categories.length - 0.5, endTick);\n }\n }\n var prevX = null;\n var x = x0;\n var majorId;\n if (major) {\n var _dTick;\n if (numDtick) {\n _dTick = ax.dtick;\n } else {\n if (type === \"date\") {\n if (typeof ax.dtick === \"string\" && ax.dtick.charAt(0) === \"M\") {\n _dTick = ONEAVGMONTH * ax.dtick.substring(1);\n }\n } else {\n _dTick = ax._roughDTick;\n }\n }\n majorId = Math.round((ax.r2l(x) - ax.r2l(ax.tick0)) / _dTick) - 1;\n }\n var dtick = mockAx.dtick;\n if (mockAx.rangebreaks && mockAx._tick0Init !== mockAx.tick0) {\n x = moveOutsideBreak(x, ax);\n if (!axrev) {\n x = axes.tickIncrement(x, dtick, !axrev, calendar);\n }\n }\n if (major && isPeriod) {\n x = axes.tickIncrement(x, dtick, !axrev, calendar);\n majorId--;\n }\n for (; axrev ? x >= endTick : x <= endTick; x = axes.tickIncrement(\n x,\n dtick,\n axrev,\n calendar\n )) {\n if (major) majorId++;\n if (mockAx.rangebreaks) {\n if (!axrev) {\n if (x < startTick) continue;\n if (mockAx.maskBreaks(x) === BADNUM && moveOutsideBreak(x, mockAx) >= maxRange) break;\n }\n }\n if (tickVals.length > maxTicks || x === prevX) break;\n prevX = x;\n var obj = { value: x };\n if (major) {\n if (isDLog && x !== (x | 0)) {\n obj.simpleLabel = true;\n }\n if (ticklabelstep > 1 && majorId % ticklabelstep) {\n obj.skipLabel = true;\n }\n tickVals.push(obj);\n } else {\n obj.minor = true;\n minorTickVals.push(obj);\n }\n }\n }\n if (!minorTickVals || minorTickVals.length < 2) {\n ticklabelIndex = false;\n } else {\n var diff = (minorTickVals[1].value - minorTickVals[0].value) * (isReversed ? -1 : 1);\n if (!periodCompatibleWithTickformat(diff, ax.tickformat)) {\n ticklabelIndex = false;\n }\n }\n if (!ticklabelIndex) {\n allTicklabelVals = tickVals;\n } else {\n var allTickVals = tickVals.concat(minorTickVals);\n if (isPeriod && tickVals.length) {\n allTickVals = allTickVals.slice(1);\n }\n allTickVals = allTickVals.sort(function(a, b) {\n return a.value - b.value;\n }).filter(function(tick, index, self2) {\n return index === 0 || tick.value !== self2[index - 1].value;\n });\n var majorTickIndices = allTickVals.map(function(item, index) {\n return item.minor === void 0 && !item.skipLabel ? index : null;\n }).filter(function(index) {\n return index !== null;\n });\n majorTickIndices.forEach(function(majorIdx) {\n ticklabelIndex.map(function(nextLabelIdx) {\n var minorIdx = majorIdx + nextLabelIdx;\n if (minorIdx >= 0 && minorIdx < allTickVals.length) {\n Lib.pushUnique(allTicklabelVals, allTickVals[minorIdx]);\n }\n });\n });\n }\n if (hasMinor) {\n var canOverlap = ax.minor.ticks === \"inside\" && ax.ticks === \"outside\" || ax.minor.ticks === \"outside\" && ax.ticks === \"inside\";\n if (!canOverlap) {\n var majorValues = tickVals.map(function(d) {\n return d.value;\n });\n var list = [];\n for (var k = 0; k < minorTickVals.length; k++) {\n var T = minorTickVals[k];\n var v = T.value;\n if (majorValues.indexOf(v) !== -1) {\n continue;\n }\n var found = false;\n for (var q = 0; !found && q < tickVals.length; q++) {\n if (\n // add 10e6 to eliminate problematic digits\n 1e7 + tickVals[q].value === 1e7 + v\n ) {\n found = true;\n }\n }\n if (!found) list.push(T);\n }\n minorTickVals = list;\n }\n }\n if (isPeriod) positionPeriodTicks(allTicklabelVals, ax, ax._definedDelta);\n var i;\n if (ax.rangebreaks) {\n var flip = ax._id.charAt(0) === \"y\";\n var fontSize = 1;\n if (ax.tickmode === \"auto\") {\n fontSize = ax.tickfont ? ax.tickfont.size : 12;\n }\n var prevL = NaN;\n for (i = tickVals.length - 1; i > -1; i--) {\n if (tickVals[i].drop) {\n tickVals.splice(i, 1);\n continue;\n }\n tickVals[i].value = moveOutsideBreak(tickVals[i].value, ax);\n var l = ax.c2p(tickVals[i].value);\n if (flip ? prevL > l - fontSize : prevL < l + fontSize) {\n tickVals.splice(axrev ? i + 1 : i, 1);\n } else {\n prevL = l;\n }\n }\n }\n if (isAngular(ax) && Math.abs(rng[1] - rng[0]) === 360) {\n tickVals.pop();\n }\n ax._tmax = (tickVals[tickVals.length - 1] || {}).value;\n ax._prevDateHead = \"\";\n ax._inCalcTicks = true;\n var lastVisibleHead;\n var hideLabel = function(tick) {\n tick.text = \"\";\n ax._prevDateHead = lastVisibleHead;\n };\n tickVals = tickVals.concat(minorTickVals);\n function setTickLabel(ax2, tickVal) {\n var text = axes.tickText(\n ax2,\n tickVal.value,\n false,\n // hover\n tickVal.simpleLabel\n // noSuffixPrefix\n );\n var p = tickVal.periodX;\n if (p !== void 0) {\n text.periodX = p;\n if (p > maxRange || p < minRange) {\n if (p > maxRange) text.periodX = maxRange;\n if (p < minRange) text.periodX = minRange;\n hideLabel(text);\n }\n }\n return text;\n }\n var t;\n for (i = 0; i < tickVals.length; i++) {\n var _minor = tickVals[i].minor;\n var _value = tickVals[i].value;\n if (_minor) {\n if (ticklabelIndex && allTicklabelVals.indexOf(tickVals[i]) !== -1) {\n t = setTickLabel(ax, tickVals[i]);\n } else {\n t = { x: _value };\n }\n t.minor = true;\n minorTicks.push(t);\n } else {\n lastVisibleHead = ax._prevDateHead;\n t = setTickLabel(ax, tickVals[i]);\n if (tickVals[i].skipLabel || ticklabelIndex && allTicklabelVals.indexOf(tickVals[i]) === -1) {\n hideLabel(t);\n }\n ticksOut.push(t);\n }\n }\n ticksOut = ticksOut.concat(minorTicks);\n ax._inCalcTicks = false;\n if (isPeriod && ticksOut.length) {\n ticksOut[0].noTick = true;\n }\n return ticksOut;\n };\n function filterRangeBreaks(ax, ticksOut) {\n if (ax.rangebreaks) {\n ticksOut = ticksOut.filter(function(d) {\n return ax.maskBreaks(d.x) !== BADNUM;\n });\n }\n return ticksOut;\n }\n function syncTicks(ax) {\n var baseAxis = ax._mainAxis;\n var ticksOut = [];\n if (baseAxis._vals) {\n for (var i = 0; i < baseAxis._vals.length; i++) {\n if (baseAxis._vals[i].noTick) {\n continue;\n }\n var pos = baseAxis.l2p(baseAxis._vals[i].x);\n var vali = ax.p2l(pos);\n var obj = axes.tickText(ax, vali);\n if (baseAxis._vals[i].minor) {\n obj.minor = true;\n obj.text = \"\";\n }\n ticksOut.push(obj);\n }\n }\n ticksOut = filterRangeBreaks(ax, ticksOut);\n return ticksOut;\n }\n function arrayTicks(ax, majorOnly) {\n var rng = Lib.simpleMap(ax.range, ax.r2l);\n var exRng = expandRange(rng);\n var tickMin = Math.min(exRng[0], exRng[1]);\n var tickMax = Math.max(exRng[0], exRng[1]);\n var tickVal2l = ax.type === \"category\" ? ax.d2l_noadd : ax.d2l;\n if (ax.type === \"log\" && String(ax.dtick).charAt(0) !== \"L\") {\n ax.dtick = \"L\" + Math.pow(10, Math.floor(Math.min(ax.range[0], ax.range[1])) - 1);\n }\n var ticksOut = [];\n for (var isMinor = 0; isMinor <= 1; isMinor++) {\n if (majorOnly !== void 0 && (majorOnly && isMinor || majorOnly === false && !isMinor)) continue;\n if (isMinor && !ax.minor) continue;\n var vals = !isMinor ? ax.tickvals : ax.minor.tickvals;\n var text = !isMinor ? ax.ticktext : [];\n if (!vals) continue;\n if (!Lib.isArrayOrTypedArray(text)) text = [];\n for (var i = 0; i < vals.length; i++) {\n var vali = tickVal2l(vals[i]);\n if (vali > tickMin && vali < tickMax) {\n var obj = axes.tickText(ax, vali, false, String(text[i]));\n if (isMinor) {\n obj.minor = true;\n obj.text = \"\";\n }\n ticksOut.push(obj);\n }\n }\n }\n ticksOut = filterRangeBreaks(ax, ticksOut);\n return ticksOut;\n }\n var roundBase10 = [2, 5, 10];\n var roundBase24 = [1, 2, 3, 6, 12];\n var roundBase60 = [1, 2, 5, 10, 15, 30];\n var roundDays = [1, 2, 3, 7, 14];\n var roundLog1 = [-0.046, 0, 0.301, 0.477, 0.602, 0.699, 0.778, 0.845, 0.903, 0.954, 1];\n var roundLog2 = [-0.301, 0, 0.301, 0.699, 1];\n var roundAngles = [15, 30, 45, 90, 180];\n function roundDTick(roughDTick, base, roundingSet) {\n return base * Lib.roundUp(roughDTick / base, roundingSet);\n }\n axes.autoTicks = function(ax, roughDTick, isMinor) {\n var base;\n function getBase(v) {\n return Math.pow(v, Math.floor(Math.log(roughDTick) / Math.LN10));\n }\n if (ax.type === \"date\") {\n ax.tick0 = Lib.dateTick0(ax.calendar, 0);\n var roughX2 = 2 * roughDTick;\n if (roughX2 > ONEAVGYEAR) {\n roughDTick /= ONEAVGYEAR;\n base = getBase(10);\n ax.dtick = \"M\" + 12 * roundDTick(roughDTick, base, roundBase10);\n } else if (roughX2 > ONEAVGMONTH) {\n roughDTick /= ONEAVGMONTH;\n ax.dtick = \"M\" + roundDTick(roughDTick, 1, roundBase24);\n } else if (roughX2 > ONEDAY) {\n ax.dtick = roundDTick(roughDTick, ONEDAY, ax._hasDayOfWeekBreaks ? [1, 2, 7, 14] : roundDays);\n if (!isMinor) {\n var tickformat = axes.getTickFormat(ax);\n var isPeriod = ax.ticklabelmode === \"period\";\n if (isPeriod) ax._rawTick0 = ax.tick0;\n if (/%[uVW]/.test(tickformat)) {\n ax.tick0 = Lib.dateTick0(ax.calendar, 2);\n } else {\n ax.tick0 = Lib.dateTick0(ax.calendar, 1);\n }\n if (isPeriod) ax._dowTick0 = ax.tick0;\n }\n } else if (roughX2 > ONEHOUR) {\n ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24);\n } else if (roughX2 > ONEMIN) {\n ax.dtick = roundDTick(roughDTick, ONEMIN, roundBase60);\n } else if (roughX2 > ONESEC) {\n ax.dtick = roundDTick(roughDTick, ONESEC, roundBase60);\n } else {\n base = getBase(10);\n ax.dtick = roundDTick(roughDTick, base, roundBase10);\n }\n } else if (ax.type === \"log\") {\n ax.tick0 = 0;\n var rng = Lib.simpleMap(ax.range, ax.r2l);\n if (ax._isMinor) {\n roughDTick *= 1.5;\n }\n if (roughDTick > 0.7) {\n ax.dtick = Math.ceil(roughDTick);\n } else if (Math.abs(rng[1] - rng[0]) < 1) {\n var nt = 1.5 * Math.abs((rng[1] - rng[0]) / roughDTick);\n roughDTick = Math.abs(Math.pow(10, rng[1]) - Math.pow(10, rng[0])) / nt;\n base = getBase(10);\n ax.dtick = \"L\" + roundDTick(roughDTick, base, roundBase10);\n } else {\n ax.dtick = roughDTick > 0.3 ? \"D2\" : \"D1\";\n }\n } else if (ax.type === \"category\" || ax.type === \"multicategory\") {\n ax.tick0 = 0;\n ax.dtick = Math.ceil(Math.max(roughDTick, 1));\n } else if (isAngular(ax)) {\n ax.tick0 = 0;\n base = 1;\n ax.dtick = roundDTick(roughDTick, base, roundAngles);\n } else {\n ax.tick0 = 0;\n base = getBase(10);\n ax.dtick = roundDTick(roughDTick, base, roundBase10);\n }\n if (ax.dtick === 0) ax.dtick = 1;\n if (!isNumeric(ax.dtick) && typeof ax.dtick !== \"string\") {\n var olddtick = ax.dtick;\n ax.dtick = 1;\n throw \"ax.dtick error: \" + String(olddtick);\n }\n };\n function autoTickRound(ax) {\n var dtick = ax.dtick;\n ax._tickexponent = 0;\n if (!isNumeric(dtick) && typeof dtick !== \"string\") {\n dtick = 1;\n }\n if (ax.type === \"category\" || ax.type === \"multicategory\") {\n ax._tickround = null;\n }\n if (ax.type === \"date\") {\n var tick0ms = ax.r2l(ax.tick0);\n var tick0str = ax.l2r(tick0ms).replace(/(^-|i)/g, \"\");\n var tick0len = tick0str.length;\n if (String(dtick).charAt(0) === \"M\") {\n if (tick0len > 10 || tick0str.substr(5) !== \"01-01\") ax._tickround = \"d\";\n else ax._tickround = +dtick.substr(1) % 12 === 0 ? \"y\" : \"m\";\n } else if (dtick >= ONEDAY && tick0len <= 10 || dtick >= ONEDAY * 15) ax._tickround = \"d\";\n else if (dtick >= ONEMIN && tick0len <= 16 || dtick >= ONEHOUR) ax._tickround = \"M\";\n else if (dtick >= ONESEC && tick0len <= 19 || dtick >= ONEMIN) ax._tickround = \"S\";\n else {\n var tick1len = ax.l2r(tick0ms + dtick).replace(/^-/, \"\").length;\n ax._tickround = Math.max(tick0len, tick1len) - 20;\n if (ax._tickround < 0) ax._tickround = 4;\n }\n } else if (isNumeric(dtick) || dtick.charAt(0) === \"L\") {\n var rng = ax.range.map(ax.r2d || Number);\n if (!isNumeric(dtick)) dtick = Number(dtick.substr(1));\n ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01);\n var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1]));\n var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01);\n var minexponent = ax.minexponent === void 0 ? 3 : ax.minexponent;\n if (Math.abs(rangeexp) > minexponent) {\n if (isSIFormat(ax.exponentformat) && !beyondSI(rangeexp)) {\n ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3);\n } else ax._tickexponent = rangeexp;\n }\n } else {\n ax._tickround = null;\n }\n }\n axes.tickIncrement = function(x, dtick, axrev, calendar) {\n var axSign = axrev ? -1 : 1;\n if (isNumeric(dtick)) return Lib.increment(x, axSign * dtick);\n var tType = dtick.charAt(0);\n var dtSigned = axSign * Number(dtick.substr(1));\n if (tType === \"M\") return Lib.incrementMonth(x, dtSigned, calendar);\n if (tType === \"L\") return Math.log(Math.pow(10, x) + dtSigned) / Math.LN10;\n if (tType === \"D\") {\n var tickset = dtick === \"D2\" ? roundLog2 : roundLog1;\n var x2 = x + axSign * 0.01;\n var frac = Lib.roundUp(Lib.mod(x2, 1), tickset, axrev);\n return Math.floor(x2) + Math.log(d3.round(Math.pow(10, frac), 1)) / Math.LN10;\n }\n throw \"unrecognized dtick \" + String(dtick);\n };\n axes.tickFirst = function(ax, opts) {\n var r2l = ax.r2l || Number;\n var rng = Lib.simpleMap(ax.range, r2l, void 0, void 0, opts);\n var axrev = rng[1] < rng[0];\n var sRound = axrev ? Math.floor : Math.ceil;\n var r0 = expandRange(rng)[0];\n var dtick = ax.dtick;\n var tick0 = r2l(ax.tick0);\n if (isNumeric(dtick)) {\n var tmin = sRound((r0 - tick0) / dtick) * dtick + tick0;\n if (ax.type === \"category\" || ax.type === \"multicategory\") {\n tmin = Lib.constrain(tmin, 0, ax._categories.length - 1);\n }\n return tmin;\n }\n var tType = dtick.charAt(0);\n var dtNum = Number(dtick.substr(1));\n if (tType === \"M\") {\n var cnt = 0;\n var t02 = tick0;\n var t12, mult, newDTick;\n while (cnt < 10) {\n t12 = axes.tickIncrement(t02, dtick, axrev, ax.calendar);\n if ((t12 - r0) * (t02 - r0) <= 0) {\n if (axrev) return Math.min(t02, t12);\n return Math.max(t02, t12);\n }\n mult = (r0 - (t02 + t12) / 2) / (t12 - t02);\n newDTick = tType + (Math.abs(Math.round(mult)) || 1) * dtNum;\n t02 = axes.tickIncrement(t02, newDTick, mult < 0 ? !axrev : axrev, ax.calendar);\n cnt++;\n }\n Lib.error(\"tickFirst did not converge\", ax);\n return t02;\n } else if (tType === \"L\") {\n return Math.log(sRound(\n (Math.pow(10, r0) - tick0) / dtNum\n ) * dtNum + tick0) / Math.LN10;\n } else if (tType === \"D\") {\n var tickset = dtick === \"D2\" ? roundLog2 : roundLog1;\n var frac = Lib.roundUp(Lib.mod(r0, 1), tickset, axrev);\n return Math.floor(r0) + Math.log(d3.round(Math.pow(10, frac), 1)) / Math.LN10;\n } else throw \"unrecognized dtick \" + String(dtick);\n };\n axes.tickText = function(ax, x, hover, noSuffixPrefix) {\n var out = tickTextObj(ax, x);\n var arrayMode = ax.tickmode === \"array\";\n var extraPrecision = hover || arrayMode;\n var axType = ax.type;\n var tickVal2l = axType === \"category\" ? ax.d2l_noadd : ax.d2l;\n var i;\n var inbounds = function(v) {\n var p = ax.l2p(v);\n return p >= 0 && p <= ax._length ? v : null;\n };\n if (arrayMode && Lib.isArrayOrTypedArray(ax.ticktext)) {\n var rng = Lib.simpleMap(ax.range, ax.r2l);\n var minDiff = (Math.abs(rng[1] - rng[0]) - (ax._lBreaks || 0)) / 1e4;\n for (i = 0; i < ax.ticktext.length; i++) {\n if (Math.abs(x - tickVal2l(ax.tickvals[i])) < minDiff) break;\n }\n if (i < ax.ticktext.length) {\n out.text = String(ax.ticktext[i]);\n out.xbnd = [\n inbounds(out.x - 0.5),\n inbounds(out.x + ax.dtick - 0.5)\n ];\n return out;\n }\n }\n function isHidden(showAttr) {\n if (showAttr === void 0) return true;\n if (hover) return showAttr === \"none\";\n var firstOrLast = {\n first: ax._tmin,\n last: ax._tmax\n }[showAttr];\n return showAttr !== \"all\" && x !== firstOrLast;\n }\n var hideexp = hover ? \"never\" : ax.exponentformat !== \"none\" && isHidden(ax.showexponent) ? \"hide\" : \"\";\n if (axType === \"date\") formatDate(ax, out, hover, extraPrecision);\n else if (axType === \"log\") formatLog(ax, out, hover, extraPrecision, hideexp);\n else if (axType === \"category\") formatCategory(ax, out);\n else if (axType === \"multicategory\") formatMultiCategory(ax, out, hover);\n else if (isAngular(ax)) formatAngle(ax, out, hover, extraPrecision, hideexp);\n else formatLinear(ax, out, hover, extraPrecision, hideexp);\n if (!noSuffixPrefix) {\n if (ax.tickprefix && !isHidden(ax.showtickprefix)) out.text = ax.tickprefix + out.text;\n if (ax.ticksuffix && !isHidden(ax.showticksuffix)) out.text += ax.ticksuffix;\n }\n if (ax.labelalias && ax.labelalias.hasOwnProperty(out.text)) {\n var t = ax.labelalias[out.text];\n if (typeof t === \"string\") out.text = t;\n }\n if (ax.tickson === \"boundaries\" || ax.showdividers) {\n out.xbnd = [\n inbounds(out.x - 0.5),\n inbounds(out.x + ax.dtick - 0.5)\n ];\n }\n return out;\n };\n axes.hoverLabelText = function(ax, values, hoverformat) {\n if (hoverformat) ax = Lib.extendFlat({}, ax, { hoverformat });\n var val = Lib.isArrayOrTypedArray(values) ? values[0] : values;\n var val2 = Lib.isArrayOrTypedArray(values) ? values[1] : void 0;\n if (val2 !== void 0 && val2 !== val) {\n return axes.hoverLabelText(ax, val, hoverformat) + \" - \" + axes.hoverLabelText(ax, val2, hoverformat);\n }\n var logOffScale = ax.type === \"log\" && val <= 0;\n var tx = axes.tickText(ax, ax.c2l(logOffScale ? -val : val), \"hover\").text;\n if (logOffScale) {\n return val === 0 ? \"0\" : MINUS_SIGN + tx;\n }\n return tx;\n };\n function tickTextObj(ax, x, text) {\n var tf = ax.tickfont || {};\n return {\n x,\n dx: 0,\n dy: 0,\n text: text || \"\",\n fontSize: tf.size,\n font: tf.family,\n fontWeight: tf.weight,\n fontStyle: tf.style,\n fontVariant: tf.variant,\n fontTextcase: tf.textcase,\n fontLineposition: tf.lineposition,\n fontShadow: tf.shadow,\n fontColor: tf.color\n };\n }\n function formatDate(ax, out, hover, extraPrecision) {\n var tr = ax._tickround;\n var fmt = hover && ax.hoverformat || axes.getTickFormat(ax);\n extraPrecision = !fmt && extraPrecision;\n if (extraPrecision) {\n if (isNumeric(tr)) tr = 4;\n else tr = { y: \"m\", m: \"d\", d: \"M\", M: \"S\", S: 4 }[tr];\n }\n var dateStr = Lib.formatDate(out.x, fmt, tr, ax._dateFormat, ax.calendar, ax._extraFormat);\n var headStr;\n var splitIndex = dateStr.indexOf(\"\\n\");\n if (splitIndex !== -1) {\n headStr = dateStr.substr(splitIndex + 1);\n dateStr = dateStr.substr(0, splitIndex);\n }\n if (extraPrecision) {\n if (headStr !== void 0 && (dateStr === \"00:00:00\" || dateStr === \"00:00\")) {\n dateStr = headStr;\n headStr = \"\";\n } else if (dateStr.length === 8) {\n dateStr = dateStr.replace(/:00$/, \"\");\n }\n }\n if (headStr) {\n if (hover) {\n if (tr === \"d\") dateStr += \", \" + headStr;\n else dateStr = headStr + (dateStr ? \", \" + dateStr : \"\");\n } else {\n if (!ax._inCalcTicks || ax._prevDateHead !== headStr) {\n ax._prevDateHead = headStr;\n dateStr += \"
    \" + headStr;\n } else {\n var isInside = insideTicklabelposition(ax);\n var side = ax._trueSide || ax.side;\n if (!isInside && side === \"top\" || isInside && side === \"bottom\") {\n dateStr += \"
    \";\n }\n }\n }\n }\n out.text = dateStr;\n }\n function formatLog(ax, out, hover, extraPrecision, hideexp) {\n var dtick = ax.dtick;\n var x = out.x;\n var tickformat = ax.tickformat;\n var dtChar0 = typeof dtick === \"string\" && dtick.charAt(0);\n if (hideexp === \"never\") {\n hideexp = \"\";\n }\n if (extraPrecision && dtChar0 !== \"L\") {\n dtick = \"L3\";\n dtChar0 = \"L\";\n }\n if (tickformat || dtChar0 === \"L\") {\n out.text = numFormat(Math.pow(10, x), ax, hideexp, extraPrecision);\n } else if (isNumeric(dtick) || dtChar0 === \"D\" && Lib.mod(x + 0.01, 1) < 0.1) {\n var p = Math.round(x);\n var absP = Math.abs(p);\n var exponentFormat = ax.exponentformat;\n if (exponentFormat === \"power\" || isSIFormat(exponentFormat) && beyondSI(p)) {\n if (p === 0) out.text = 1;\n else if (p === 1) out.text = \"10\";\n else out.text = \"10\" + (p > 1 ? \"\" : MINUS_SIGN) + absP + \"\";\n out.fontSize *= 1.25;\n } else if ((exponentFormat === \"e\" || exponentFormat === \"E\") && absP > 2) {\n out.text = \"1\" + exponentFormat + (p > 0 ? \"+\" : MINUS_SIGN) + absP;\n } else {\n out.text = numFormat(Math.pow(10, x), ax, \"\", \"fakehover\");\n if (dtick === \"D1\" && ax._id.charAt(0) === \"y\") {\n out.dy -= out.fontSize / 6;\n }\n }\n } else if (dtChar0 === \"D\") {\n out.text = String(Math.round(Math.pow(10, Lib.mod(x, 1))));\n out.fontSize *= 0.75;\n } else throw \"unrecognized dtick \" + String(dtick);\n if (ax.dtick === \"D1\") {\n var firstChar = String(out.text).charAt(0);\n if (firstChar === \"0\" || firstChar === \"1\") {\n if (ax._id.charAt(0) === \"y\") {\n out.dx -= out.fontSize / 4;\n } else {\n out.dy += out.fontSize / 2;\n out.dx += (ax.range[1] > ax.range[0] ? 1 : -1) * out.fontSize * (x < 0 ? 0.5 : 0.25);\n }\n }\n }\n }\n function formatCategory(ax, out) {\n var tt = ax._categories[Math.round(out.x)];\n if (tt === void 0) tt = \"\";\n out.text = String(tt);\n }\n function formatMultiCategory(ax, out, hover) {\n var v = Math.round(out.x);\n var cats = ax._categories[v] || [];\n var tt = cats[1] === void 0 ? \"\" : String(cats[1]);\n var tt2 = cats[0] === void 0 ? \"\" : String(cats[0]);\n if (hover) {\n out.text = tt2 + \" - \" + tt;\n } else {\n out.text = tt;\n out.text2 = tt2;\n }\n }\n function formatLinear(ax, out, hover, extraPrecision, hideexp) {\n if (hideexp === \"never\") {\n hideexp = \"\";\n } else if (ax.showexponent === \"all\" && Math.abs(out.x / ax.dtick) < 1e-6) {\n hideexp = \"hide\";\n }\n out.text = numFormat(out.x, ax, hideexp, extraPrecision);\n }\n function formatAngle(ax, out, hover, extraPrecision, hideexp) {\n if (ax.thetaunit === \"radians\" && !hover) {\n var num = out.x / 180;\n if (num === 0) {\n out.text = \"0\";\n } else {\n var frac = num2frac(num);\n if (frac[1] >= 100) {\n out.text = numFormat(Lib.deg2rad(out.x), ax, hideexp, extraPrecision);\n } else {\n var isNeg = out.x < 0;\n if (frac[1] === 1) {\n if (frac[0] === 1) out.text = \"\\u03C0\";\n else out.text = frac[0] + \"\\u03C0\";\n } else {\n out.text = [\n \"\",\n frac[0],\n \"\",\n \"\\u2044\",\n \"\",\n frac[1],\n \"\",\n \"\\u03C0\"\n ].join(\"\");\n }\n if (isNeg) out.text = MINUS_SIGN + out.text;\n }\n }\n } else {\n out.text = numFormat(out.x, ax, hideexp, extraPrecision);\n }\n }\n function num2frac(num) {\n function almostEq(a, b) {\n return Math.abs(a - b) <= 1e-6;\n }\n function findGCD(a, b) {\n return almostEq(b, 0) ? a : findGCD(b, a % b);\n }\n function findPrecision(n) {\n var e = 1;\n while (!almostEq(Math.round(n * e) / e, n)) {\n e *= 10;\n }\n return e;\n }\n var precision = findPrecision(num);\n var number = num * precision;\n var gcd = Math.abs(findGCD(number, precision));\n return [\n // numerator\n Math.round(number / gcd),\n // denominator\n Math.round(precision / gcd)\n ];\n }\n var SIPREFIXES = [\"f\", \"p\", \"n\", \"\\u03BC\", \"m\", \"\", \"k\", \"M\", \"G\", \"T\"];\n function isSIFormat(exponentFormat) {\n return exponentFormat === \"SI\" || exponentFormat === \"B\";\n }\n function beyondSI(exponent) {\n return exponent > 14 || exponent < -15;\n }\n function numFormat(v, ax, fmtoverride, hover) {\n var isNeg = v < 0;\n var tickRound = ax._tickround;\n var exponentFormat = fmtoverride || ax.exponentformat || \"B\";\n var exponent = ax._tickexponent;\n var tickformat = axes.getTickFormat(ax);\n var separatethousands = ax.separatethousands;\n if (hover) {\n var ah = {\n exponentformat: exponentFormat,\n minexponent: ax.minexponent,\n dtick: ax.showexponent === \"none\" ? ax.dtick : isNumeric(v) ? Math.abs(v) || 1 : 1,\n // if not showing any exponents, don't change the exponent\n // from what we calculate\n range: ax.showexponent === \"none\" ? ax.range.map(ax.r2d) : [0, v || 1]\n };\n autoTickRound(ah);\n tickRound = (Number(ah._tickround) || 0) + 4;\n exponent = ah._tickexponent;\n if (ax.hoverformat) tickformat = ax.hoverformat;\n }\n if (tickformat) return ax._numFormat(tickformat)(v).replace(/-/g, MINUS_SIGN);\n var e = Math.pow(10, -tickRound) / 2;\n if (exponentFormat === \"none\") exponent = 0;\n v = Math.abs(v);\n if (v < e) {\n v = \"0\";\n isNeg = false;\n } else {\n v += e;\n if (exponent) {\n v *= Math.pow(10, -exponent);\n tickRound += exponent;\n }\n if (tickRound === 0) v = String(Math.floor(v));\n else if (tickRound < 0) {\n v = String(Math.round(v));\n v = v.substr(0, v.length + tickRound);\n for (var i = tickRound; i < 0; i++) v += \"0\";\n } else {\n v = String(v);\n var dp = v.indexOf(\".\") + 1;\n if (dp) v = v.substr(0, dp + tickRound).replace(/\\.?0+$/, \"\");\n }\n v = Lib.numSeparate(v, ax._separators, separatethousands);\n }\n if (exponent && exponentFormat !== \"hide\") {\n if (isSIFormat(exponentFormat) && beyondSI(exponent)) exponentFormat = \"power\";\n var signedExponent;\n if (exponent < 0) signedExponent = MINUS_SIGN + -exponent;\n else if (exponentFormat !== \"power\") signedExponent = \"+\" + exponent;\n else signedExponent = String(exponent);\n if (exponentFormat === \"e\" || exponentFormat === \"E\") {\n v += exponentFormat + signedExponent;\n } else if (exponentFormat === \"power\") {\n v += \"\\xD710\" + signedExponent + \"\";\n } else if (exponentFormat === \"B\" && exponent === 9) {\n v += \"B\";\n } else if (isSIFormat(exponentFormat)) {\n v += SIPREFIXES[exponent / 3 + 5];\n }\n }\n if (isNeg) return MINUS_SIGN + v;\n return v;\n }\n axes.getTickFormat = function(ax) {\n var i;\n function convertToMs(dtick) {\n return typeof dtick !== \"string\" ? dtick : Number(dtick.replace(\"M\", \"\")) * ONEAVGMONTH;\n }\n function compareLogTicks(left, right) {\n var priority = [\"L\", \"D\"];\n if (typeof left === typeof right) {\n if (typeof left === \"number\") {\n return left - right;\n } else {\n var leftPriority = priority.indexOf(left.charAt(0));\n var rightPriority = priority.indexOf(right.charAt(0));\n if (leftPriority === rightPriority) {\n return Number(left.replace(/(L|D)/g, \"\")) - Number(right.replace(/(L|D)/g, \"\"));\n } else {\n return leftPriority - rightPriority;\n }\n }\n } else {\n return typeof left === \"number\" ? 1 : -1;\n }\n }\n function isProperStop(dtick, range, convert) {\n var convertFn = convert || function(x) {\n return x;\n };\n var leftDtick = range[0];\n var rightDtick = range[1];\n return (!leftDtick && typeof leftDtick !== \"number\" || convertFn(leftDtick) <= convertFn(dtick)) && (!rightDtick && typeof rightDtick !== \"number\" || convertFn(rightDtick) >= convertFn(dtick));\n }\n function isProperLogStop(dtick, range) {\n var isLeftDtickNull = range[0] === null;\n var isRightDtickNull = range[1] === null;\n var isDtickInRangeLeft = compareLogTicks(dtick, range[0]) >= 0;\n var isDtickInRangeRight = compareLogTicks(dtick, range[1]) <= 0;\n return (isLeftDtickNull || isDtickInRangeLeft) && (isRightDtickNull || isDtickInRangeRight);\n }\n var tickstop, stopi;\n if (ax.tickformatstops && ax.tickformatstops.length > 0) {\n switch (ax.type) {\n case \"date\":\n case \"linear\": {\n for (i = 0; i < ax.tickformatstops.length; i++) {\n stopi = ax.tickformatstops[i];\n if (stopi.enabled && isProperStop(ax.dtick, stopi.dtickrange, convertToMs)) {\n tickstop = stopi;\n break;\n }\n }\n break;\n }\n case \"log\": {\n for (i = 0; i < ax.tickformatstops.length; i++) {\n stopi = ax.tickformatstops[i];\n if (stopi.enabled && isProperLogStop(ax.dtick, stopi.dtickrange)) {\n tickstop = stopi;\n break;\n }\n }\n break;\n }\n default:\n }\n }\n return tickstop ? tickstop.value : ax.tickformat;\n };\n axes.getSubplots = function(gd, ax) {\n var subplotObj = gd._fullLayout._subplots;\n var allSubplots = subplotObj.cartesian.concat(subplotObj.gl2d || []);\n var out = ax ? axes.findSubplotsWithAxis(allSubplots, ax) : allSubplots;\n out.sort(function(a, b) {\n var aParts = a.substr(1).split(\"y\");\n var bParts = b.substr(1).split(\"y\");\n if (aParts[0] === bParts[0]) return +aParts[1] - +bParts[1];\n return +aParts[0] - +bParts[0];\n });\n return out;\n };\n axes.findSubplotsWithAxis = function(subplots, ax) {\n var axMatch = new RegExp(\n ax._id.charAt(0) === \"x\" ? \"^\" + ax._id + \"y\" : ax._id + \"$\"\n );\n var subplotsWithAx = [];\n for (var i = 0; i < subplots.length; i++) {\n var sp = subplots[i];\n if (axMatch.test(sp)) subplotsWithAx.push(sp);\n }\n return subplotsWithAx;\n };\n axes.makeClipPaths = function(gd) {\n var fullLayout = gd._fullLayout;\n if (fullLayout._hasOnlyLargeSploms) return;\n var fullWidth = { _offset: 0, _length: fullLayout.width, _id: \"\" };\n var fullHeight = { _offset: 0, _length: fullLayout.height, _id: \"\" };\n var xaList = axes.list(gd, \"x\", true);\n var yaList = axes.list(gd, \"y\", true);\n var clipList = [];\n var i, j;\n for (i = 0; i < xaList.length; i++) {\n clipList.push({ x: xaList[i], y: fullHeight });\n for (j = 0; j < yaList.length; j++) {\n if (i === 0) clipList.push({ x: fullWidth, y: yaList[j] });\n clipList.push({ x: xaList[i], y: yaList[j] });\n }\n }\n var axClips = fullLayout._clips.selectAll(\".axesclip\").data(clipList, function(d) {\n return d.x._id + d.y._id;\n });\n axClips.enter().append(\"clipPath\").classed(\"axesclip\", true).attr(\"id\", function(d) {\n return \"clip\" + fullLayout._uid + d.x._id + d.y._id;\n }).append(\"rect\");\n axClips.exit().remove();\n axClips.each(function(d) {\n d3.select(this).select(\"rect\").attr({\n x: d.x._offset || 0,\n y: d.y._offset || 0,\n width: d.x._length || 1,\n height: d.y._length || 1\n });\n });\n };\n axes.draw = function(gd, arg, opts) {\n var fullLayout = gd._fullLayout;\n if (arg === \"redraw\") {\n fullLayout._paper.selectAll(\"g.subplot\").each(function(d) {\n var id = d[0];\n var plotinfo = fullLayout._plots[id];\n if (plotinfo) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n plotinfo.xaxislayer.selectAll(\".\" + xa._id + \"tick\").remove();\n plotinfo.yaxislayer.selectAll(\".\" + ya._id + \"tick\").remove();\n plotinfo.xaxislayer.selectAll(\".\" + xa._id + \"tick2\").remove();\n plotinfo.yaxislayer.selectAll(\".\" + ya._id + \"tick2\").remove();\n plotinfo.xaxislayer.selectAll(\".\" + xa._id + \"divider\").remove();\n plotinfo.yaxislayer.selectAll(\".\" + ya._id + \"divider\").remove();\n if (plotinfo.minorGridlayer) plotinfo.minorGridlayer.selectAll(\"path\").remove();\n if (plotinfo.gridlayer) plotinfo.gridlayer.selectAll(\"path\").remove();\n if (plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll(\"path\").remove();\n fullLayout._infolayer.select(\".g-\" + xa._id + \"title\").remove();\n fullLayout._infolayer.select(\".g-\" + ya._id + \"title\").remove();\n }\n });\n }\n var axList = !arg || arg === \"redraw\" ? axes.listIds(gd) : arg;\n var fullAxList = axes.list(gd);\n var overlayingShiftedAx = fullAxList.filter(function(ax) {\n return ax.autoshift;\n }).map(function(ax) {\n return ax.overlaying;\n });\n axList.map(function(axId) {\n var ax = axes.getFromId(gd, axId);\n if (ax.tickmode === \"sync\" && ax.overlaying) {\n var overlayingIndex = axList.findIndex(function(axis) {\n return axis === ax.overlaying;\n });\n if (overlayingIndex >= 0) {\n axList.unshift(axList.splice(overlayingIndex, 1).shift());\n }\n }\n });\n var axShifts = { false: { left: 0, right: 0 } };\n return Lib.syncOrAsync(axList.map(function(axId) {\n return function() {\n if (!axId) return;\n var ax = axes.getFromId(gd, axId);\n if (!opts) opts = {};\n opts.axShifts = axShifts;\n opts.overlayingShiftedAx = overlayingShiftedAx;\n var axDone = axes.drawOne(gd, ax, opts);\n if (ax._shiftPusher) {\n incrementShift(ax, ax._fullDepth || 0, axShifts, true);\n }\n ax._r = ax.range.slice();\n ax._rl = Lib.simpleMap(ax._r, ax.r2l);\n return axDone;\n };\n }));\n };\n axes.drawOne = function(gd, ax, opts) {\n opts = opts || {};\n var axShifts = opts.axShifts || {};\n var overlayingShiftedAx = opts.overlayingShiftedAx || [];\n var i, sp, plotinfo;\n ax.setScale();\n var fullLayout = gd._fullLayout;\n var axId = ax._id;\n var axLetter = axId.charAt(0);\n var counterLetter = axes.counterLetter(axId);\n var mainPlotinfo = fullLayout._plots[ax._mainSubplot];\n if (!mainPlotinfo) return;\n ax._shiftPusher = ax.autoshift || overlayingShiftedAx.indexOf(ax._id) !== -1 || overlayingShiftedAx.indexOf(ax.overlaying) !== -1;\n if (ax._shiftPusher & ax.anchor === \"free\") {\n var selfPush = ax.linewidth / 2 || 0;\n if (ax.ticks === \"inside\") {\n selfPush += ax.ticklen;\n }\n incrementShift(ax, selfPush, axShifts, true);\n incrementShift(ax, ax.shift || 0, axShifts, false);\n }\n if (opts.skipTitle !== true || ax._shift === void 0) ax._shift = setShiftVal(ax, axShifts);\n var mainAxLayer = mainPlotinfo[axLetter + \"axislayer\"];\n var mainLinePosition = ax._mainLinePosition;\n var mainLinePositionShift = mainLinePosition += ax._shift;\n var mainMirrorPosition = ax._mainMirrorPosition;\n var vals = ax._vals = axes.calcTicks(ax);\n var axInfo = [ax.mirror, mainLinePositionShift, mainMirrorPosition].join(\"_\");\n for (i = 0; i < vals.length; i++) {\n vals[i].axInfo = axInfo;\n }\n ax._selections = {};\n if (ax._tickAngles) ax._prevTickAngles = ax._tickAngles;\n ax._tickAngles = {};\n ax._depth = null;\n var llbboxes = {};\n function getLabelLevelBbox(suffix) {\n var cls = axId + (suffix || \"tick\");\n if (!llbboxes[cls]) llbboxes[cls] = calcLabelLevelBbox(ax, cls, mainLinePositionShift);\n return llbboxes[cls];\n }\n if (!ax.visible) return;\n var transTickFn = axes.makeTransTickFn(ax);\n var transTickLabelFn = axes.makeTransTickLabelFn(ax);\n var tickVals;\n var valsClipped;\n var insideTicks = ax.ticks === \"inside\";\n var outsideTicks = ax.ticks === \"outside\";\n if (ax.tickson === \"boundaries\") {\n var boundaryVals = getBoundaryVals(ax, vals);\n valsClipped = axes.clipEnds(ax, boundaryVals);\n tickVals = insideTicks ? valsClipped : boundaryVals;\n } else {\n valsClipped = axes.clipEnds(ax, vals);\n tickVals = insideTicks && ax.ticklabelmode !== \"period\" ? valsClipped : vals;\n }\n var gridVals = ax._gridVals = valsClipped;\n var dividerVals = getDividerVals(ax, vals);\n if (!fullLayout._hasOnlyLargeSploms) {\n var subplotsWithAx = ax._subplotsWith;\n var finishedGrids = {};\n for (i = 0; i < subplotsWithAx.length; i++) {\n sp = subplotsWithAx[i];\n plotinfo = fullLayout._plots[sp];\n var counterAxis = plotinfo[counterLetter + \"axis\"];\n var mainCounterID = counterAxis._mainAxis._id;\n if (finishedGrids[mainCounterID]) continue;\n finishedGrids[mainCounterID] = 1;\n var gridPath = axLetter === \"x\" ? \"M0,\" + counterAxis._offset + \"v\" + counterAxis._length : \"M\" + counterAxis._offset + \",0h\" + counterAxis._length;\n axes.drawGrid(gd, ax, {\n vals: gridVals,\n counterAxis,\n layer: plotinfo.gridlayer.select(\".\" + axId),\n minorLayer: plotinfo.minorGridlayer.select(\".\" + axId),\n path: gridPath,\n transFn: transTickFn\n });\n axes.drawZeroLine(gd, ax, {\n counterAxis,\n layer: plotinfo.zerolinelayer,\n path: gridPath,\n transFn: transTickFn\n });\n }\n }\n var tickPath;\n var majorTickSigns = axes.getTickSigns(ax);\n var minorTickSigns = axes.getTickSigns(ax, \"minor\");\n if (ax.ticks || ax.minor && ax.minor.ticks) {\n var majorTickPath = axes.makeTickPath(ax, mainLinePositionShift, majorTickSigns[2]);\n var minorTickPath = axes.makeTickPath(ax, mainLinePositionShift, minorTickSigns[2], { minor: true });\n var mirrorMajorTickPath;\n var mirrorMinorTickPath;\n var fullMajorTickPath;\n var fullMinorTickPath;\n if (ax._anchorAxis && ax.mirror && ax.mirror !== true) {\n mirrorMajorTickPath = axes.makeTickPath(ax, mainMirrorPosition, majorTickSigns[3]);\n mirrorMinorTickPath = axes.makeTickPath(ax, mainMirrorPosition, minorTickSigns[3], { minor: true });\n fullMajorTickPath = majorTickPath + mirrorMajorTickPath;\n fullMinorTickPath = minorTickPath + mirrorMinorTickPath;\n } else {\n mirrorMajorTickPath = \"\";\n mirrorMinorTickPath = \"\";\n fullMajorTickPath = majorTickPath;\n fullMinorTickPath = minorTickPath;\n }\n if (ax.showdividers && outsideTicks && ax.tickson === \"boundaries\") {\n var dividerLookup = {};\n for (i = 0; i < dividerVals.length; i++) {\n dividerLookup[dividerVals[i].x] = 1;\n }\n tickPath = function(d) {\n return dividerLookup[d.x] ? mirrorMajorTickPath : fullMajorTickPath;\n };\n } else {\n tickPath = function(d) {\n return d.minor ? fullMinorTickPath : fullMajorTickPath;\n };\n }\n }\n axes.drawTicks(gd, ax, {\n vals: tickVals,\n layer: mainAxLayer,\n path: tickPath,\n transFn: transTickFn\n });\n if (ax.mirror === \"allticks\") {\n var tickSubplots = Object.keys(ax._linepositions || {});\n for (i = 0; i < tickSubplots.length; i++) {\n sp = tickSubplots[i];\n plotinfo = fullLayout._plots[sp];\n var linepositions = ax._linepositions[sp] || [];\n var p0 = linepositions[0];\n var p1 = linepositions[1];\n var isMinor = linepositions[2];\n var spTickPath = axes.makeTickPath(\n ax,\n p0,\n isMinor ? majorTickSigns[0] : minorTickSigns[0],\n { minor: isMinor }\n ) + axes.makeTickPath(\n ax,\n p1,\n isMinor ? majorTickSigns[1] : minorTickSigns[1],\n { minor: isMinor }\n );\n axes.drawTicks(gd, ax, {\n vals: tickVals,\n layer: plotinfo[axLetter + \"axislayer\"],\n path: spTickPath,\n transFn: transTickFn\n });\n }\n }\n var seq = [];\n seq.push(function() {\n return axes.drawLabels(gd, ax, {\n vals,\n layer: mainAxLayer,\n plotinfo,\n transFn: transTickLabelFn,\n labelFns: axes.makeLabelFns(ax, mainLinePositionShift)\n });\n });\n if (ax.type === \"multicategory\") {\n var pad = { x: 2, y: 10 }[axLetter];\n seq.push(function() {\n var bboxKey = { x: \"height\", y: \"width\" }[axLetter];\n var standoff = getLabelLevelBbox()[bboxKey] + pad + (ax._tickAngles[axId + \"tick\"] ? ax.tickfont.size * LINE_SPACING : 0);\n return axes.drawLabels(gd, ax, {\n vals: getSecondaryLabelVals(ax, vals),\n layer: mainAxLayer,\n cls: axId + \"tick2\",\n repositionOnUpdate: true,\n secondary: true,\n transFn: transTickFn,\n labelFns: axes.makeLabelFns(ax, mainLinePositionShift + standoff * majorTickSigns[4])\n });\n });\n seq.push(function() {\n ax._depth = majorTickSigns[4] * (getLabelLevelBbox(\"tick2\")[ax.side] - mainLinePositionShift);\n return drawDividers(gd, ax, {\n vals: dividerVals,\n layer: mainAxLayer,\n path: axes.makeTickPath(ax, mainLinePositionShift, majorTickSigns[4], { len: ax._depth }),\n transFn: transTickFn\n });\n });\n } else if (ax.title.hasOwnProperty(\"standoff\")) {\n seq.push(function() {\n ax._depth = majorTickSigns[4] * (getLabelLevelBbox()[ax.side] - mainLinePositionShift);\n });\n }\n var hasRangeSlider = Registry.getComponentMethod(\"rangeslider\", \"isVisible\")(ax);\n if (!opts.skipTitle && !(hasRangeSlider && ax.side === \"bottom\")) {\n seq.push(function() {\n return drawTitle(gd, ax);\n });\n }\n seq.push(function() {\n var s = ax.side.charAt(0);\n var sMirror = OPPOSITE_SIDE[ax.side].charAt(0);\n var pos = axes.getPxPosition(gd, ax);\n var outsideTickLen = outsideTicks ? ax.ticklen : 0;\n var llbbox;\n var push;\n var mirrorPush;\n var rangeSliderPush;\n if (ax.automargin || hasRangeSlider || ax._shiftPusher) {\n if (ax.type === \"multicategory\") {\n llbbox = getLabelLevelBbox(\"tick2\");\n } else {\n llbbox = getLabelLevelBbox();\n if (axLetter === \"x\" && s === \"b\") {\n ax._depth = Math.max(llbbox.width > 0 ? llbbox.bottom - pos : 0, outsideTickLen);\n }\n }\n }\n var axDepth = 0;\n var titleDepth = 0;\n if (ax._shiftPusher) {\n axDepth = Math.max(\n outsideTickLen,\n llbbox.height > 0 ? s === \"l\" ? pos - llbbox.left : llbbox.right - pos : 0\n );\n if (ax.title.text !== fullLayout._dfltTitle[axLetter]) {\n titleDepth = (ax._titleStandoff || 0) + (ax._titleScoot || 0);\n if (s === \"l\") {\n titleDepth += approxTitleDepth(ax);\n }\n }\n ax._fullDepth = Math.max(axDepth, titleDepth);\n }\n if (ax.automargin) {\n push = { x: 0, y: 0, r: 0, l: 0, t: 0, b: 0 };\n var domainIndices = [0, 1];\n var shift = typeof ax._shift === \"number\" ? ax._shift : 0;\n if (axLetter === \"x\") {\n if (s === \"b\") {\n push[s] = ax._depth;\n } else {\n push[s] = ax._depth = Math.max(llbbox.width > 0 ? pos - llbbox.top : 0, outsideTickLen);\n domainIndices.reverse();\n }\n if (llbbox.width > 0) {\n var rExtra = llbbox.right - (ax._offset + ax._length);\n if (rExtra > 0) {\n push.xr = 1;\n push.r = rExtra;\n }\n var lExtra = ax._offset - llbbox.left;\n if (lExtra > 0) {\n push.xl = 0;\n push.l = lExtra;\n }\n }\n } else {\n if (s === \"l\") {\n ax._depth = Math.max(llbbox.height > 0 ? pos - llbbox.left : 0, outsideTickLen);\n push[s] = ax._depth - shift;\n } else {\n ax._depth = Math.max(llbbox.height > 0 ? llbbox.right - pos : 0, outsideTickLen);\n push[s] = ax._depth + shift;\n domainIndices.reverse();\n }\n if (llbbox.height > 0) {\n var bExtra = llbbox.bottom - (ax._offset + ax._length);\n if (bExtra > 0) {\n push.yb = 0;\n push.b = bExtra;\n }\n var tExtra = ax._offset - llbbox.top;\n if (tExtra > 0) {\n push.yt = 1;\n push.t = tExtra;\n }\n }\n }\n push[counterLetter] = ax.anchor === \"free\" ? ax.position : ax._anchorAxis.domain[domainIndices[0]];\n if (ax.title.text !== fullLayout._dfltTitle[axLetter]) {\n push[s] += approxTitleDepth(ax) + (ax.title.standoff || 0);\n }\n if (ax.mirror && ax.anchor !== \"free\") {\n mirrorPush = { x: 0, y: 0, r: 0, l: 0, t: 0, b: 0 };\n mirrorPush[sMirror] = ax.linewidth;\n if (ax.mirror && ax.mirror !== true) mirrorPush[sMirror] += outsideTickLen;\n if (ax.mirror === true || ax.mirror === \"ticks\") {\n mirrorPush[counterLetter] = ax._anchorAxis.domain[domainIndices[1]];\n } else if (ax.mirror === \"all\" || ax.mirror === \"allticks\") {\n mirrorPush[counterLetter] = [ax._counterDomainMin, ax._counterDomainMax][domainIndices[1]];\n }\n }\n }\n if (hasRangeSlider) {\n rangeSliderPush = Registry.getComponentMethod(\"rangeslider\", \"autoMarginOpts\")(gd, ax);\n }\n if (typeof ax.automargin === \"string\") {\n filterPush(push, ax.automargin);\n filterPush(mirrorPush, ax.automargin);\n }\n Plots.autoMargin(gd, axAutoMarginID(ax), push);\n Plots.autoMargin(gd, axMirrorAutoMarginID(ax), mirrorPush);\n Plots.autoMargin(gd, rangeSliderAutoMarginID(ax), rangeSliderPush);\n });\n return Lib.syncOrAsync(seq);\n };\n function filterPush(push, automargin) {\n if (!push) return;\n var keepMargin = Object.keys(MARGIN_MAPPING).reduce(function(data, nextKey) {\n if (automargin.indexOf(nextKey) !== -1) {\n MARGIN_MAPPING[nextKey].forEach(function(key) {\n data[key] = 1;\n });\n }\n return data;\n }, {});\n Object.keys(push).forEach(function(key) {\n if (!keepMargin[key]) {\n if (key.length === 1) push[key] = 0;\n else delete push[key];\n }\n });\n }\n function getBoundaryVals(ax, vals) {\n var out = [];\n var i;\n var _push = function(d, bndIndex) {\n var xb = d.xbnd[bndIndex];\n if (xb !== null) {\n out.push(Lib.extendFlat({}, d, { x: xb }));\n }\n };\n if (vals.length) {\n for (i = 0; i < vals.length; i++) {\n _push(vals[i], 0);\n }\n _push(vals[i - 1], 1);\n }\n return out;\n }\n function getSecondaryLabelVals(ax, vals) {\n var out = [];\n var lookup = {};\n for (var i = 0; i < vals.length; i++) {\n var d = vals[i];\n if (lookup[d.text2]) {\n lookup[d.text2].push(d.x);\n } else {\n lookup[d.text2] = [d.x];\n }\n }\n for (var k in lookup) {\n out.push(tickTextObj(ax, Lib.interp(lookup[k], 0.5), k));\n }\n return out;\n }\n function getDividerVals(ax, vals) {\n var out = [];\n var i, current;\n var reversed = vals.length && vals[vals.length - 1].x < vals[0].x;\n var _push = function(d2, bndIndex) {\n var xb = d2.xbnd[bndIndex];\n if (xb !== null) {\n out.push(Lib.extendFlat({}, d2, { x: xb }));\n }\n };\n if (ax.showdividers && vals.length) {\n for (i = 0; i < vals.length; i++) {\n var d = vals[i];\n if (d.text2 !== current) {\n _push(d, reversed ? 1 : 0);\n }\n current = d.text2;\n }\n _push(vals[i - 1], reversed ? 0 : 1);\n }\n return out;\n }\n function calcLabelLevelBbox(ax, cls, mainLinePositionShift) {\n var top, bottom;\n var left, right;\n if (ax._selections[cls].size()) {\n top = Infinity;\n bottom = -Infinity;\n left = Infinity;\n right = -Infinity;\n ax._selections[cls].each(function() {\n var thisLabel = selectTickLabel(this);\n var bb = Drawing.bBox(thisLabel.node().parentNode);\n top = Math.min(top, bb.top);\n bottom = Math.max(bottom, bb.bottom);\n left = Math.min(left, bb.left);\n right = Math.max(right, bb.right);\n });\n } else {\n var dummyCalc = axes.makeLabelFns(ax, mainLinePositionShift);\n top = bottom = dummyCalc.yFn({ dx: 0, dy: 0, fontSize: 0 });\n left = right = dummyCalc.xFn({ dx: 0, dy: 0, fontSize: 0 });\n }\n return {\n top,\n bottom,\n left,\n right,\n height: bottom - top,\n width: right - left\n };\n }\n axes.getTickSigns = function(ax, minor) {\n var axLetter = ax._id.charAt(0);\n var sideOpposite = { x: \"top\", y: \"right\" }[axLetter];\n var main = ax.side === sideOpposite ? 1 : -1;\n var out = [-1, 1, main, -main];\n var ticks = minor ? (ax.minor || {}).ticks : ax.ticks;\n if (ticks !== \"inside\" === (axLetter === \"x\")) {\n out = out.map(function(v) {\n return -v;\n });\n }\n if (ax.side) {\n out.push({ l: -1, t: -1, r: 1, b: 1 }[ax.side.charAt(0)]);\n }\n return out;\n };\n axes.makeTransTickFn = function(ax) {\n return ax._id.charAt(0) === \"x\" ? function(d) {\n return strTranslate(ax._offset + ax.l2p(d.x), 0);\n } : function(d) {\n return strTranslate(0, ax._offset + ax.l2p(d.x));\n };\n };\n axes.makeTransTickLabelFn = function(ax) {\n var uv = getTickLabelUV(ax);\n var shift = ax.ticklabelshift || 0;\n var standoff = ax.ticklabelstandoff || 0;\n var u = uv[0];\n var v = uv[1];\n var isReversed = ax.range[0] > ax.range[1];\n var labelsInside = ax.ticklabelposition && ax.ticklabelposition.indexOf(\"inside\") !== -1;\n var labelsOutside = !labelsInside;\n if (shift) {\n var shiftSign = isReversed ? -1 : 1;\n shift = shift * shiftSign;\n }\n if (standoff) {\n var side = ax.side;\n var standoffSign = labelsInside && (side === \"top\" || side === \"left\") || labelsOutside && (side === \"bottom\" || side === \"right\") ? 1 : -1;\n standoff = standoff * standoffSign;\n }\n return ax._id.charAt(0) === \"x\" ? function(d) {\n return strTranslate(\n u + ax._offset + ax.l2p(getPosX(d)) + shift,\n v + standoff\n );\n } : function(d) {\n return strTranslate(\n v + standoff,\n u + ax._offset + ax.l2p(getPosX(d)) + shift\n );\n };\n };\n function getPosX(d) {\n return d.periodX !== void 0 ? d.periodX : d.x;\n }\n function getTickLabelUV(ax) {\n var ticklabelposition = ax.ticklabelposition || \"\";\n var has = function(str) {\n return ticklabelposition.indexOf(str) !== -1;\n };\n var isTop = has(\"top\");\n var isLeft = has(\"left\");\n var isRight = has(\"right\");\n var isBottom = has(\"bottom\");\n var isInside = has(\"inside\");\n var isAligned = isBottom || isLeft || isTop || isRight;\n if (!isAligned && !isInside) return [0, 0];\n var side = ax.side;\n var u = isAligned ? (ax.tickwidth || 0) / 2 : 0;\n var v = TEXTPAD;\n var fontSize = ax.tickfont ? ax.tickfont.size : 12;\n if (isBottom || isTop) {\n u += fontSize * CAP_SHIFT;\n v += (ax.linewidth || 0) / 2;\n }\n if (isLeft || isRight) {\n u += (ax.linewidth || 0) / 2;\n v += TEXTPAD;\n }\n if (isInside && side === \"top\") {\n v -= fontSize * (1 - CAP_SHIFT);\n }\n if (isLeft || isTop) u = -u;\n if (side === \"bottom\" || side === \"right\") v = -v;\n return [\n isAligned ? u : 0,\n isInside ? v : 0\n ];\n }\n axes.makeTickPath = function(ax, shift, sgn, opts) {\n if (!opts) opts = {};\n var minor = opts.minor;\n if (minor && !ax.minor) return \"\";\n var len = opts.len !== void 0 ? opts.len : minor ? ax.minor.ticklen : ax.ticklen;\n var axLetter = ax._id.charAt(0);\n var pad = (ax.linewidth || 1) / 2;\n return axLetter === \"x\" ? \"M0,\" + (shift + pad * sgn) + \"v\" + len * sgn : \"M\" + (shift + pad * sgn) + \",0h\" + len * sgn;\n };\n axes.makeLabelFns = function(ax, shift, angle) {\n var ticklabelposition = ax.ticklabelposition || \"\";\n var has = function(str) {\n return ticklabelposition.indexOf(str) !== -1;\n };\n var isTop = has(\"top\");\n var isLeft = has(\"left\");\n var isRight = has(\"right\");\n var isBottom = has(\"bottom\");\n var isAligned = isBottom || isLeft || isTop || isRight;\n var insideTickLabels = has(\"inside\");\n var labelsOverTicks = ticklabelposition === \"inside\" && ax.ticks === \"inside\" || !insideTickLabels && ax.ticks === \"outside\" && ax.tickson !== \"boundaries\";\n var labelStandoff = 0;\n var labelShift = 0;\n var tickLen = labelsOverTicks ? ax.ticklen : 0;\n if (insideTickLabels) {\n tickLen *= -1;\n } else if (isAligned) {\n tickLen = 0;\n }\n if (labelsOverTicks) {\n labelStandoff += tickLen;\n if (angle) {\n var rad = Lib.deg2rad(angle);\n labelStandoff = tickLen * Math.cos(rad) + 1;\n labelShift = tickLen * Math.sin(rad);\n }\n }\n if (ax.showticklabels && (labelsOverTicks || ax.showline)) {\n labelStandoff += 0.2 * ax.tickfont.size;\n }\n labelStandoff += (ax.linewidth || 1) / 2 * (insideTickLabels ? -1 : 1);\n var out = {\n labelStandoff,\n labelShift\n };\n var x0, y0, ff, flipIt;\n var xQ = 0;\n var side = ax.side;\n var axLetter = ax._id.charAt(0);\n var tickangle = ax.tickangle;\n var endSide;\n if (axLetter === \"x\") {\n endSide = !insideTickLabels && side === \"bottom\" || insideTickLabels && side === \"top\";\n flipIt = endSide ? 1 : -1;\n if (insideTickLabels) flipIt *= -1;\n x0 = labelShift * flipIt;\n y0 = shift + labelStandoff * flipIt;\n ff = endSide ? 1 : -0.2;\n if (Math.abs(tickangle) === 90) {\n if (insideTickLabels) {\n ff += MID_SHIFT;\n } else {\n if (tickangle === -90 && side === \"bottom\") {\n ff = CAP_SHIFT;\n } else if (tickangle === 90 && side === \"top\") {\n ff = MID_SHIFT;\n } else {\n ff = 0.5;\n }\n }\n xQ = MID_SHIFT / 2 * (tickangle / 90);\n }\n out.xFn = function(d) {\n return d.dx + x0 + xQ * d.fontSize;\n };\n out.yFn = function(d) {\n return d.dy + y0 + d.fontSize * ff;\n };\n out.anchorFn = function(d, a) {\n if (isAligned) {\n if (isLeft) return \"end\";\n if (isRight) return \"start\";\n }\n if (!isNumeric(a) || a === 0 || a === 180) {\n return \"middle\";\n }\n return a * flipIt < 0 !== insideTickLabels ? \"end\" : \"start\";\n };\n out.heightFn = function(d, a, h) {\n return a < -60 || a > 60 ? -0.5 * h : ax.side === \"top\" !== insideTickLabels ? -h : 0;\n };\n } else if (axLetter === \"y\") {\n endSide = !insideTickLabels && side === \"left\" || insideTickLabels && side === \"right\";\n flipIt = endSide ? 1 : -1;\n if (insideTickLabels) flipIt *= -1;\n x0 = labelStandoff;\n y0 = labelShift * flipIt;\n ff = 0;\n if (!insideTickLabels && Math.abs(tickangle) === 90) {\n if (tickangle === -90 && side === \"left\" || tickangle === 90 && side === \"right\") {\n ff = CAP_SHIFT;\n } else {\n ff = 0.5;\n }\n }\n if (insideTickLabels) {\n var ang = isNumeric(tickangle) ? +tickangle : 0;\n if (ang !== 0) {\n var rA = Lib.deg2rad(ang);\n xQ = Math.abs(Math.sin(rA)) * CAP_SHIFT * flipIt;\n ff = 0;\n }\n }\n out.xFn = function(d) {\n return d.dx + shift - (x0 + d.fontSize * ff) * flipIt + xQ * d.fontSize;\n };\n out.yFn = function(d) {\n return d.dy + y0 + d.fontSize * MID_SHIFT;\n };\n out.anchorFn = function(d, a) {\n if (isNumeric(a) && Math.abs(a) === 90) {\n return \"middle\";\n }\n return endSide ? \"end\" : \"start\";\n };\n out.heightFn = function(d, a, h) {\n if (ax.side === \"right\") a *= -1;\n return a < -30 ? -h : a < 30 ? -0.5 * h : 0;\n };\n }\n return out;\n };\n function tickDataFn(d) {\n return [d.text, d.x, d.axInfo, d.font, d.fontSize, d.fontColor].join(\"_\");\n }\n axes.drawTicks = function(gd, ax, opts) {\n opts = opts || {};\n var cls = ax._id + \"tick\";\n var vals = [].concat(\n ax.minor && ax.minor.ticks ? (\n // minor vals\n opts.vals.filter(function(d) {\n return d.minor && !d.noTick;\n })\n ) : []\n ).concat(\n ax.ticks ? (\n // major vals\n opts.vals.filter(function(d) {\n return !d.minor && !d.noTick;\n })\n ) : []\n );\n var ticks = opts.layer.selectAll(\"path.\" + cls).data(vals, tickDataFn);\n ticks.exit().remove();\n ticks.enter().append(\"path\").classed(cls, 1).classed(\"ticks\", 1).classed(\"crisp\", opts.crisp !== false).each(function(d) {\n return Color2.stroke(d3.select(this), d.minor ? ax.minor.tickcolor : ax.tickcolor);\n }).style(\"stroke-width\", function(d) {\n return Drawing.crispRound(\n gd,\n d.minor ? ax.minor.tickwidth : ax.tickwidth,\n 1\n ) + \"px\";\n }).attr(\"d\", opts.path).style(\"display\", null);\n hideCounterAxisInsideTickLabels(ax, [TICK_PATH]);\n ticks.attr(\"transform\", opts.transFn);\n };\n axes.drawGrid = function(gd, ax, opts) {\n opts = opts || {};\n if (ax.tickmode === \"sync\") {\n return;\n }\n var cls = ax._id + \"grid\";\n var hasMinor = ax.minor && ax.minor.showgrid;\n var minorVals = hasMinor ? opts.vals.filter(function(d) {\n return d.minor;\n }) : [];\n var majorVals = ax.showgrid ? opts.vals.filter(function(d) {\n return !d.minor;\n }) : [];\n var counterAx = opts.counterAxis;\n if (counterAx && axes.shouldShowZeroLine(gd, ax, counterAx)) {\n var isArrayMode = ax.tickmode === \"array\";\n for (var i = 0; i < majorVals.length; i++) {\n var xi = majorVals[i].x;\n if (isArrayMode ? !xi : Math.abs(xi) < ax.dtick / 100) {\n majorVals = majorVals.slice(0, i).concat(majorVals.slice(i + 1));\n if (isArrayMode) i--;\n else break;\n }\n }\n }\n ax._gw = Drawing.crispRound(gd, ax.gridwidth, 1);\n var wMinor = !hasMinor ? 0 : Drawing.crispRound(gd, ax.minor.gridwidth, 1);\n var majorLayer = opts.layer;\n var minorLayer = opts.minorLayer;\n for (var major = 1; major >= 0; major--) {\n var layer = major ? majorLayer : minorLayer;\n if (!layer) continue;\n var grid = layer.selectAll(\"path.\" + cls).data(major ? majorVals : minorVals, tickDataFn);\n grid.exit().remove();\n grid.enter().append(\"path\").classed(cls, 1).classed(\"crisp\", opts.crisp !== false);\n grid.attr(\"transform\", opts.transFn).attr(\"d\", opts.path).each(function(d) {\n return Color2.stroke(\n d3.select(this),\n d.minor ? ax.minor.gridcolor : ax.gridcolor || \"#ddd\"\n );\n }).style(\"stroke-dasharray\", function(d) {\n return Drawing.dashStyle(\n d.minor ? ax.minor.griddash : ax.griddash,\n d.minor ? ax.minor.gridwidth : ax.gridwidth\n );\n }).style(\"stroke-width\", function(d) {\n return (d.minor ? wMinor : ax._gw) + \"px\";\n }).style(\"display\", null);\n if (typeof opts.path === \"function\") grid.attr(\"d\", opts.path);\n }\n hideCounterAxisInsideTickLabels(ax, [GRID_PATH, MINORGRID_PATH]);\n };\n axes.drawZeroLine = function(gd, ax, opts) {\n opts = opts || opts;\n var cls = ax._id + \"zl\";\n var show = axes.shouldShowZeroLine(gd, ax, opts.counterAxis);\n var zl = opts.layer.selectAll(\"path.\" + cls).data(show ? [{ x: 0, id: ax._id }] : []);\n zl.exit().remove();\n zl.enter().append(\"path\").classed(cls, 1).classed(\"zl\", 1).classed(\"crisp\", opts.crisp !== false).each(function() {\n opts.layer.selectAll(\"path\").sort(function(da, db) {\n return idSort(da.id, db.id);\n });\n });\n zl.attr(\"transform\", opts.transFn).attr(\"d\", opts.path).call(Color2.stroke, ax.zerolinecolor || Color2.defaultLine).style(\"stroke-width\", Drawing.crispRound(gd, ax.zerolinewidth, ax._gw || 1) + \"px\").style(\"display\", null);\n hideCounterAxisInsideTickLabels(ax, [ZERO_PATH]);\n };\n axes.drawLabels = function(gd, ax, opts) {\n opts = opts || {};\n var fullLayout = gd._fullLayout;\n var axId = ax._id;\n var cls = opts.cls || axId + \"tick\";\n var vals = opts.vals.filter(function(d) {\n return d.text;\n });\n var labelFns = opts.labelFns;\n var tickAngle = opts.secondary ? 0 : ax.tickangle;\n var prevAngle = (ax._prevTickAngles || {})[cls];\n var tickLabels = opts.layer.selectAll(\"g.\" + cls).data(ax.showticklabels ? vals : [], tickDataFn);\n var labelsReady = [];\n tickLabels.enter().append(\"g\").classed(cls, 1).append(\"text\").attr(\"text-anchor\", \"middle\").each(function(d) {\n var thisLabel = d3.select(this);\n var newPromise = gd._promises.length;\n thisLabel.call(svgTextUtils.positionText, labelFns.xFn(d), labelFns.yFn(d)).call(Drawing.font, {\n family: d.font,\n size: d.fontSize,\n color: d.fontColor,\n weight: d.fontWeight,\n style: d.fontStyle,\n variant: d.fontVariant,\n textcase: d.fontTextcase,\n lineposition: d.fontLineposition,\n shadow: d.fontShadow\n }).text(d.text).call(svgTextUtils.convertToTspans, gd);\n if (gd._promises[newPromise]) {\n labelsReady.push(gd._promises.pop().then(function() {\n positionLabels(thisLabel, tickAngle);\n }));\n } else {\n positionLabels(thisLabel, tickAngle);\n }\n });\n hideCounterAxisInsideTickLabels(ax, [TICK_TEXT]);\n tickLabels.exit().remove();\n if (opts.repositionOnUpdate) {\n tickLabels.each(function(d) {\n d3.select(this).select(\"text\").call(svgTextUtils.positionText, labelFns.xFn(d), labelFns.yFn(d));\n });\n }\n function positionLabels(s, angle) {\n s.each(function(d) {\n var thisLabel = d3.select(this);\n var mathjaxGroup = thisLabel.select(\".text-math-group\");\n var anchor = labelFns.anchorFn(d, angle);\n var transform = opts.transFn.call(thisLabel.node(), d) + (isNumeric(angle) && +angle !== 0 ? \" rotate(\" + angle + \",\" + labelFns.xFn(d) + \",\" + (labelFns.yFn(d) - d.fontSize / 2) + \")\" : \"\");\n var nLines = svgTextUtils.lineCount(thisLabel);\n var lineHeight = LINE_SPACING * d.fontSize;\n var anchorHeight = labelFns.heightFn(d, isNumeric(angle) ? +angle : 0, (nLines - 1) * lineHeight);\n if (anchorHeight) {\n transform += strTranslate(0, anchorHeight);\n }\n if (mathjaxGroup.empty()) {\n var thisText = thisLabel.select(\"text\");\n thisText.attr({\n transform,\n \"text-anchor\": anchor\n });\n thisText.style(\"opacity\", 1);\n if (ax._adjustTickLabelsOverflow) {\n ax._adjustTickLabelsOverflow();\n }\n } else {\n var mjWidth = Drawing.bBox(mathjaxGroup.node()).width;\n var mjShift = mjWidth * { end: -0.5, start: 0.5 }[anchor];\n mathjaxGroup.attr(\"transform\", transform + strTranslate(mjShift, 0));\n }\n });\n }\n ax._adjustTickLabelsOverflow = function() {\n var ticklabeloverflow = ax.ticklabeloverflow;\n if (!ticklabeloverflow || ticklabeloverflow === \"allow\") return;\n var hideOverflow = ticklabeloverflow.indexOf(\"hide\") !== -1;\n var isX = ax._id.charAt(0) === \"x\";\n var p02 = 0;\n var p12 = isX ? gd._fullLayout.width : gd._fullLayout.height;\n if (ticklabeloverflow.indexOf(\"domain\") !== -1) {\n var rl = Lib.simpleMap(ax.range, ax.r2l);\n p02 = ax.l2p(rl[0]) + ax._offset;\n p12 = ax.l2p(rl[1]) + ax._offset;\n }\n var min = Math.min(p02, p12);\n var max = Math.max(p02, p12);\n var side = ax.side;\n var visibleLabelMin = Infinity;\n var visibleLabelMax = -Infinity;\n tickLabels.each(function(d) {\n var thisLabel = d3.select(this);\n var mathjaxGroup = thisLabel.select(\".text-math-group\");\n if (mathjaxGroup.empty()) {\n var bb = Drawing.bBox(thisLabel.node());\n var adjust = 0;\n if (isX) {\n if (bb.right > max) adjust = 1;\n else if (bb.left < min) adjust = 1;\n } else {\n if (bb.bottom > max) adjust = 1;\n else if (bb.top + (ax.tickangle ? 0 : d.fontSize / 4) < min) adjust = 1;\n }\n var t = thisLabel.select(\"text\");\n if (adjust) {\n if (hideOverflow) t.style(\"opacity\", 0);\n } else {\n t.style(\"opacity\", 1);\n if (side === \"bottom\" || side === \"right\") {\n visibleLabelMin = Math.min(visibleLabelMin, isX ? bb.top : bb.left);\n } else {\n visibleLabelMin = -Infinity;\n }\n if (side === \"top\" || side === \"left\") {\n visibleLabelMax = Math.max(visibleLabelMax, isX ? bb.bottom : bb.right);\n } else {\n visibleLabelMax = Infinity;\n }\n }\n }\n });\n for (var subplot in fullLayout._plots) {\n var plotinfo = fullLayout._plots[subplot];\n if (ax._id !== plotinfo.xaxis._id && ax._id !== plotinfo.yaxis._id) continue;\n var anchorAx2 = isX ? plotinfo.yaxis : plotinfo.xaxis;\n if (anchorAx2) {\n anchorAx2[\"_visibleLabelMin_\" + ax._id] = visibleLabelMin;\n anchorAx2[\"_visibleLabelMax_\" + ax._id] = visibleLabelMax;\n }\n }\n };\n ax._hideCounterAxisInsideTickLabels = function(partialOpts) {\n var isX = ax._id.charAt(0) === \"x\";\n var anchoredAxes = [];\n for (var subplot in fullLayout._plots) {\n var plotinfo = fullLayout._plots[subplot];\n if (ax._id !== plotinfo.xaxis._id && ax._id !== plotinfo.yaxis._id) continue;\n anchoredAxes.push(isX ? plotinfo.yaxis : plotinfo.xaxis);\n }\n anchoredAxes.forEach(function(anchorAx2, idx) {\n if (anchorAx2 && insideTicklabelposition(anchorAx2)) {\n (partialOpts || [\n ZERO_PATH,\n MINORGRID_PATH,\n GRID_PATH,\n TICK_PATH,\n TICK_TEXT\n ]).forEach(function(e) {\n var isPeriodLabel = e.K === \"tick\" && e.L === \"text\" && ax.ticklabelmode === \"period\";\n var mainPlotinfo = fullLayout._plots[ax._mainSubplot];\n var sel;\n if (e.K === ZERO_PATH.K) sel = mainPlotinfo.zerolinelayer.selectAll(\".\" + ax._id + \"zl\");\n else if (e.K === MINORGRID_PATH.K) sel = mainPlotinfo.minorGridlayer.selectAll(\".\" + ax._id);\n else if (e.K === GRID_PATH.K) sel = mainPlotinfo.gridlayer.selectAll(\".\" + ax._id);\n else sel = mainPlotinfo[ax._id.charAt(0) + \"axislayer\"];\n sel.each(function() {\n var w = d3.select(this);\n if (e.L) w = w.selectAll(e.L);\n w.each(function(d) {\n var q = ax.l2p(\n isPeriodLabel ? getPosX(d) : d.x\n ) + ax._offset;\n var t = d3.select(this);\n if (q < ax[\"_visibleLabelMax_\" + anchorAx2._id] && q > ax[\"_visibleLabelMin_\" + anchorAx2._id]) {\n t.style(\"display\", \"none\");\n } else if (e.K === \"tick\" && !idx) {\n t.style(\"display\", null);\n }\n });\n });\n });\n }\n });\n };\n positionLabels(tickLabels, prevAngle + 1 ? prevAngle : tickAngle);\n function allLabelsReady() {\n return labelsReady.length && Promise.all(labelsReady);\n }\n var autoangle = null;\n function fixLabelOverlaps() {\n positionLabels(tickLabels, tickAngle);\n if (vals.length && ax.autotickangles && (ax.type !== \"log\" || String(ax.dtick).charAt(0) !== \"D\")) {\n autoangle = ax.autotickangles[0];\n var maxFontSize = 0;\n var lbbArray = [];\n var i;\n var maxLines = 1;\n tickLabels.each(function(d) {\n maxFontSize = Math.max(maxFontSize, d.fontSize);\n var x = ax.l2p(d.x);\n var thisLabel = selectTickLabel(this);\n var bb = Drawing.bBox(thisLabel.node());\n maxLines = Math.max(maxLines, svgTextUtils.lineCount(thisLabel));\n lbbArray.push({\n // ignore about y, just deal with x overlaps\n top: 0,\n bottom: 10,\n height: 10,\n left: x - bb.width / 2,\n // impose a 2px gap\n right: x + bb.width / 2 + 2,\n width: bb.width + 2\n });\n });\n var preventOverlapWithTick = (ax.tickson === \"boundaries\" || ax.showdividers) && !opts.secondary;\n var vLen = vals.length;\n var tickSpacing = Math.abs((vals[vLen - 1].x - vals[0].x) * ax._m) / (vLen - 1);\n var adjacent = preventOverlapWithTick ? tickSpacing / 2 : tickSpacing;\n var opposite = preventOverlapWithTick ? ax.ticklen : maxFontSize * 1.25 * maxLines;\n var hypotenuse = Math.sqrt(Math.pow(adjacent, 2) + Math.pow(opposite, 2));\n var maxCos = adjacent / hypotenuse;\n var autoTickAnglesRadians = ax.autotickangles.map(\n function(degrees3) {\n return degrees3 * Math.PI / 180;\n }\n );\n var angleRadians = autoTickAnglesRadians.find(\n function(angle) {\n return Math.abs(Math.cos(angle)) <= maxCos;\n }\n );\n if (angleRadians === void 0) {\n angleRadians = autoTickAnglesRadians.reduce(\n function(currentMax, nextAngle) {\n return Math.abs(Math.cos(currentMax)) < Math.abs(Math.cos(nextAngle)) ? currentMax : nextAngle;\n },\n autoTickAnglesRadians[0]\n );\n }\n var newAngle = angleRadians * (180 / Math.PI);\n if (preventOverlapWithTick) {\n var gap = 2;\n if (ax.ticks) gap += ax.tickwidth / 2;\n for (i = 0; i < lbbArray.length; i++) {\n var xbnd = vals[i].xbnd;\n var lbb = lbbArray[i];\n if (xbnd[0] !== null && lbb.left - ax.l2p(xbnd[0]) < gap || xbnd[1] !== null && ax.l2p(xbnd[1]) - lbb.right < gap) {\n autoangle = newAngle;\n break;\n }\n }\n } else {\n var ticklabelposition = ax.ticklabelposition || \"\";\n var has = function(str) {\n return ticklabelposition.indexOf(str) !== -1;\n };\n var isTop = has(\"top\");\n var isLeft = has(\"left\");\n var isRight = has(\"right\");\n var isBottom = has(\"bottom\");\n var isAligned = isBottom || isLeft || isTop || isRight;\n var pad = !isAligned ? 0 : (ax.tickwidth || 0) + 2 * TEXTPAD;\n for (i = 0; i < lbbArray.length - 1; i++) {\n if (Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1], pad)) {\n autoangle = newAngle;\n break;\n }\n }\n }\n if (autoangle) {\n positionLabels(tickLabels, autoangle);\n }\n }\n }\n if (ax._selections) {\n ax._selections[cls] = tickLabels;\n }\n var seq = [allLabelsReady];\n if (ax.automargin && fullLayout._redrawFromAutoMarginCount && prevAngle === 90) {\n autoangle = prevAngle;\n seq.push(function() {\n positionLabels(tickLabels, prevAngle);\n });\n } else {\n seq.push(fixLabelOverlaps);\n }\n if (ax._tickAngles) {\n seq.push(function() {\n ax._tickAngles[cls] = autoangle === null ? isNumeric(tickAngle) ? tickAngle : 0 : autoangle;\n });\n }\n var computeTickLabelBoundingBoxes = function() {\n var labelsMaxW = 0;\n var labelsMaxH = 0;\n tickLabels.each(function(d, i) {\n var thisLabel = selectTickLabel(this);\n var mathjaxGroup = thisLabel.select(\".text-math-group\");\n if (mathjaxGroup.empty()) {\n var bb;\n if (ax._vals[i]) {\n bb = ax._vals[i].bb || Drawing.bBox(thisLabel.node());\n ax._vals[i].bb = bb;\n }\n labelsMaxW = Math.max(labelsMaxW, bb.width);\n labelsMaxH = Math.max(labelsMaxH, bb.height);\n }\n });\n return {\n labelsMaxW,\n labelsMaxH\n };\n };\n var anchorAx = ax._anchorAxis;\n if (anchorAx && (anchorAx.autorange || anchorAx.insiderange) && insideTicklabelposition(ax) && !isLinked(fullLayout, ax._id)) {\n if (!fullLayout._insideTickLabelsUpdaterange) {\n fullLayout._insideTickLabelsUpdaterange = {};\n }\n if (anchorAx.autorange) {\n fullLayout._insideTickLabelsUpdaterange[anchorAx._name + \".autorange\"] = anchorAx.autorange;\n seq.push(computeTickLabelBoundingBoxes);\n }\n if (anchorAx.insiderange) {\n var BBs = computeTickLabelBoundingBoxes();\n var move = ax._id.charAt(0) === \"y\" ? BBs.labelsMaxW : BBs.labelsMaxH;\n move += 2 * TEXTPAD;\n if (ax.ticklabelposition === \"inside\") {\n move += ax.ticklen || 0;\n }\n var sgn = ax.side === \"right\" || ax.side === \"top\" ? 1 : -1;\n var index = sgn === 1 ? 1 : 0;\n var otherIndex = sgn === 1 ? 0 : 1;\n var newRange = [];\n newRange[otherIndex] = anchorAx.range[otherIndex];\n var anchorAxRange = anchorAx.range;\n var p0 = anchorAx.r2p(anchorAxRange[index]);\n var p1 = anchorAx.r2p(anchorAxRange[otherIndex]);\n var _tempNewRange = fullLayout._insideTickLabelsUpdaterange[anchorAx._name + \".range\"];\n if (_tempNewRange) {\n var q0 = anchorAx.r2p(_tempNewRange[index]);\n var q1 = anchorAx.r2p(_tempNewRange[otherIndex]);\n var dir = sgn * (ax._id.charAt(0) === \"y\" ? 1 : -1);\n if (dir * p0 < dir * q0) {\n p0 = q0;\n newRange[index] = anchorAxRange[index] = _tempNewRange[index];\n }\n if (dir * p1 > dir * q1) {\n p1 = q1;\n newRange[otherIndex] = anchorAxRange[otherIndex] = _tempNewRange[otherIndex];\n }\n }\n var dist = Math.abs(p1 - p0);\n if (dist - move > 0) {\n dist -= move;\n move *= 1 + move / dist;\n } else {\n move = 0;\n }\n if (ax._id.charAt(0) !== \"y\") move = -move;\n newRange[index] = anchorAx.p2r(\n anchorAx.r2p(anchorAxRange[index]) + sgn * move\n );\n if (anchorAx.autorange === \"min\" || anchorAx.autorange === \"max reversed\") {\n newRange[0] = null;\n anchorAx._rangeInitial0 = void 0;\n anchorAx._rangeInitial1 = void 0;\n } else if (anchorAx.autorange === \"max\" || anchorAx.autorange === \"min reversed\") {\n newRange[1] = null;\n anchorAx._rangeInitial0 = void 0;\n anchorAx._rangeInitial1 = void 0;\n }\n fullLayout._insideTickLabelsUpdaterange[anchorAx._name + \".range\"] = newRange;\n }\n }\n var done = Lib.syncOrAsync(seq);\n if (done && done.then) gd._promises.push(done);\n return done;\n };\n function drawDividers(gd, ax, opts) {\n var cls = ax._id + \"divider\";\n var vals = opts.vals;\n var dividers = opts.layer.selectAll(\"path.\" + cls).data(vals, tickDataFn);\n dividers.exit().remove();\n dividers.enter().insert(\"path\", \":first-child\").classed(cls, 1).classed(\"crisp\", 1).call(Color2.stroke, ax.dividercolor).style(\"stroke-width\", Drawing.crispRound(gd, ax.dividerwidth, 1) + \"px\");\n dividers.attr(\"transform\", opts.transFn).attr(\"d\", opts.path);\n }\n axes.getPxPosition = function(gd, ax) {\n var gs = gd._fullLayout._size;\n var axLetter = ax._id.charAt(0);\n var side = ax.side;\n var anchorAxis;\n if (ax.anchor !== \"free\") {\n anchorAxis = ax._anchorAxis;\n } else if (axLetter === \"x\") {\n anchorAxis = {\n _offset: gs.t + (1 - (ax.position || 0)) * gs.h,\n _length: 0\n };\n } else if (axLetter === \"y\") {\n anchorAxis = {\n _offset: gs.l + (ax.position || 0) * gs.w + ax._shift,\n _length: 0\n };\n }\n if (side === \"top\" || side === \"left\") {\n return anchorAxis._offset;\n } else if (side === \"bottom\" || side === \"right\") {\n return anchorAxis._offset + anchorAxis._length;\n }\n };\n function approxTitleDepth(ax) {\n var fontSize = ax.title.font.size;\n var extraLines = (ax.title.text.match(svgTextUtils.BR_TAG_ALL) || []).length;\n if (ax.title.hasOwnProperty(\"standoff\")) {\n return fontSize * (CAP_SHIFT + extraLines * LINE_SPACING);\n } else {\n return extraLines ? fontSize * (extraLines + 1) * LINE_SPACING : fontSize;\n }\n }\n function drawTitle(gd, ax) {\n var fullLayout = gd._fullLayout;\n var axId = ax._id;\n var axLetter = axId.charAt(0);\n var fontSize = ax.title.font.size;\n var titleStandoff;\n var extraLines = (ax.title.text.match(svgTextUtils.BR_TAG_ALL) || []).length;\n if (ax.title.hasOwnProperty(\"standoff\")) {\n if (ax.side === \"bottom\" || ax.side === \"right\") {\n titleStandoff = ax._depth + ax.title.standoff + fontSize * CAP_SHIFT;\n } else if (ax.side === \"top\" || ax.side === \"left\") {\n titleStandoff = ax._depth + ax.title.standoff + fontSize * (MID_SHIFT + extraLines * LINE_SPACING);\n }\n } else {\n var isInside = insideTicklabelposition(ax);\n if (ax.type === \"multicategory\") {\n titleStandoff = ax._depth;\n } else {\n var offsetBase = 1.5 * fontSize;\n if (isInside) {\n offsetBase = 0.5 * fontSize;\n if (ax.ticks === \"outside\") {\n offsetBase += ax.ticklen;\n }\n }\n titleStandoff = 10 + offsetBase + (ax.linewidth ? ax.linewidth - 1 : 0);\n }\n if (!isInside) {\n if (axLetter === \"x\") {\n titleStandoff += ax.side === \"top\" ? fontSize * (ax.showticklabels ? 1 : 0) : fontSize * (ax.showticklabels ? 1.5 : 0.5);\n } else {\n titleStandoff += ax.side === \"right\" ? fontSize * (ax.showticklabels ? 1 : 0.5) : fontSize * (ax.showticklabels ? 0.5 : 0);\n }\n }\n }\n var pos = axes.getPxPosition(gd, ax);\n var transform, x, y;\n if (axLetter === \"x\") {\n x = ax._offset + ax._length / 2;\n y = ax.side === \"top\" ? pos - titleStandoff : pos + titleStandoff;\n } else {\n y = ax._offset + ax._length / 2;\n x = ax.side === \"right\" ? pos + titleStandoff : pos - titleStandoff;\n transform = { rotate: \"-90\", offset: 0 };\n }\n var avoid;\n if (ax.type !== \"multicategory\") {\n var tickLabels = ax._selections[ax._id + \"tick\"];\n avoid = {\n selection: tickLabels,\n side: ax.side\n };\n if (tickLabels && tickLabels.node() && tickLabels.node().parentNode) {\n var translation = Drawing.getTranslate(tickLabels.node().parentNode);\n avoid.offsetLeft = translation.x;\n avoid.offsetTop = translation.y;\n }\n if (ax.title.hasOwnProperty(\"standoff\")) {\n avoid.pad = 0;\n }\n }\n ax._titleStandoff = titleStandoff;\n return Titles.draw(gd, axId + \"title\", {\n propContainer: ax,\n propName: ax._name + \".title.text\",\n placeholder: fullLayout._dfltTitle[axLetter],\n avoid,\n transform,\n attributes: { x, y, \"text-anchor\": \"middle\" }\n });\n }\n axes.shouldShowZeroLine = function(gd, ax, counterAxis) {\n var rng = Lib.simpleMap(ax.range, ax.r2l);\n return rng[0] * rng[1] <= 0 && ax.zeroline && (ax.type === \"linear\" || ax.type === \"-\") && !(ax.rangebreaks && ax.maskBreaks(0) === BADNUM) && (clipEnds(ax, 0) || !anyCounterAxLineAtZero(gd, ax, counterAxis, rng) || hasBarsOrFill(gd, ax));\n };\n axes.clipEnds = function(ax, vals) {\n return vals.filter(function(d) {\n return clipEnds(ax, d.x);\n });\n };\n function clipEnds(ax, l) {\n var p = ax.l2p(l);\n return p > 1 && p < ax._length - 1;\n }\n function anyCounterAxLineAtZero(gd, ax, counterAxis, rng) {\n var mainCounterAxis = counterAxis._mainAxis;\n if (!mainCounterAxis) return;\n var fullLayout = gd._fullLayout;\n var axLetter = ax._id.charAt(0);\n var counterLetter = axes.counterLetter(ax._id);\n var zeroPosition = ax._offset + (Math.abs(rng[0]) < Math.abs(rng[1]) === (axLetter === \"x\") ? 0 : ax._length);\n function lineNearZero(ax2) {\n if (!ax2.showline || !ax2.linewidth) return false;\n var tolerance = Math.max((ax2.linewidth + ax.zerolinewidth) / 2, 1);\n function closeEnough(pos2) {\n return typeof pos2 === \"number\" && Math.abs(pos2 - zeroPosition) < tolerance;\n }\n if (closeEnough(ax2._mainLinePosition) || closeEnough(ax2._mainMirrorPosition)) {\n return true;\n }\n var linePositions = ax2._linepositions || {};\n for (var k in linePositions) {\n if (closeEnough(linePositions[k][0]) || closeEnough(linePositions[k][1])) {\n return true;\n }\n }\n }\n var plotinfo = fullLayout._plots[counterAxis._mainSubplot];\n if (!(plotinfo.mainplotinfo || plotinfo).overlays.length) {\n return lineNearZero(counterAxis, zeroPosition);\n }\n var counterLetterAxes = axes.list(gd, counterLetter);\n for (var i = 0; i < counterLetterAxes.length; i++) {\n var counterAxis2 = counterLetterAxes[i];\n if (counterAxis2._mainAxis === mainCounterAxis && lineNearZero(counterAxis2, zeroPosition)) {\n return true;\n }\n }\n }\n function hasBarsOrFill(gd, ax) {\n var fullData = gd._fullData;\n var subplot = ax._mainSubplot;\n var axLetter = ax._id.charAt(0);\n for (var i = 0; i < fullData.length; i++) {\n var trace = fullData[i];\n if (trace.visible === true && trace.xaxis + trace.yaxis === subplot) {\n if (Registry.traceIs(trace, \"bar-like\") && trace.orientation === { x: \"h\", y: \"v\" }[axLetter]) return true;\n if (trace.fill && trace.fill.charAt(trace.fill.length - 1) === axLetter) return true;\n }\n }\n return false;\n }\n function selectTickLabel(gTick) {\n var s = d3.select(gTick);\n var mj = s.select(\".text-math-group\");\n return mj.empty() ? s.select(\"text\") : mj;\n }\n axes.allowAutoMargin = function(gd) {\n var axList = axes.list(gd, \"\", true);\n for (var i = 0; i < axList.length; i++) {\n var ax = axList[i];\n if (ax.automargin) {\n Plots.allowAutoMargin(gd, axAutoMarginID(ax));\n if (ax.mirror) {\n Plots.allowAutoMargin(gd, axMirrorAutoMarginID(ax));\n }\n }\n if (Registry.getComponentMethod(\"rangeslider\", \"isVisible\")(ax)) {\n Plots.allowAutoMargin(gd, rangeSliderAutoMarginID(ax));\n }\n }\n };\n function axAutoMarginID(ax) {\n return ax._id + \".automargin\";\n }\n function axMirrorAutoMarginID(ax) {\n return axAutoMarginID(ax) + \".mirror\";\n }\n function rangeSliderAutoMarginID(ax) {\n return ax._id + \".rangeslider\";\n }\n axes.swap = function(gd, traces) {\n var axGroups = makeAxisGroups(gd, traces);\n for (var i = 0; i < axGroups.length; i++) {\n swapAxisGroup(gd, axGroups[i].x, axGroups[i].y);\n }\n };\n function makeAxisGroups(gd, traces) {\n var groups = [];\n var i, j;\n for (i = 0; i < traces.length; i++) {\n var groupsi = [];\n var xi = gd._fullData[traces[i]].xaxis;\n var yi = gd._fullData[traces[i]].yaxis;\n if (!xi || !yi) continue;\n for (j = 0; j < groups.length; j++) {\n if (groups[j].x.indexOf(xi) !== -1 || groups[j].y.indexOf(yi) !== -1) {\n groupsi.push(j);\n }\n }\n if (!groupsi.length) {\n groups.push({ x: [xi], y: [yi] });\n continue;\n }\n var group0 = groups[groupsi[0]];\n var groupj;\n if (groupsi.length > 1) {\n for (j = 1; j < groupsi.length; j++) {\n groupj = groups[groupsi[j]];\n mergeAxisGroups(group0.x, groupj.x);\n mergeAxisGroups(group0.y, groupj.y);\n }\n }\n mergeAxisGroups(group0.x, [xi]);\n mergeAxisGroups(group0.y, [yi]);\n }\n return groups;\n }\n function mergeAxisGroups(intoSet, fromSet) {\n for (var i = 0; i < fromSet.length; i++) {\n if (intoSet.indexOf(fromSet[i]) === -1) intoSet.push(fromSet[i]);\n }\n }\n function swapAxisGroup(gd, xIds, yIds) {\n var xFullAxes = [];\n var yFullAxes = [];\n var layout = gd.layout;\n var i, j;\n for (i = 0; i < xIds.length; i++) xFullAxes.push(axes.getFromId(gd, xIds[i]));\n for (i = 0; i < yIds.length; i++) yFullAxes.push(axes.getFromId(gd, yIds[i]));\n var allAxKeys = Object.keys(axAttrs);\n var noSwapAttrs = [\n \"anchor\",\n \"domain\",\n \"overlaying\",\n \"position\",\n \"side\",\n \"tickangle\",\n \"editType\"\n ];\n var numericTypes = [\"linear\", \"log\"];\n for (i = 0; i < allAxKeys.length; i++) {\n var keyi = allAxKeys[i];\n var xVal = xFullAxes[0][keyi];\n var yVal = yFullAxes[0][keyi];\n var allEqual = true;\n var coerceLinearX = false;\n var coerceLinearY = false;\n if (keyi.charAt(0) === \"_\" || typeof xVal === \"function\" || noSwapAttrs.indexOf(keyi) !== -1) {\n continue;\n }\n for (j = 1; j < xFullAxes.length && allEqual; j++) {\n var xVali = xFullAxes[j][keyi];\n if (keyi === \"type\" && numericTypes.indexOf(xVal) !== -1 && numericTypes.indexOf(xVali) !== -1 && xVal !== xVali) {\n coerceLinearX = true;\n } else if (xVali !== xVal) allEqual = false;\n }\n for (j = 1; j < yFullAxes.length && allEqual; j++) {\n var yVali = yFullAxes[j][keyi];\n if (keyi === \"type\" && numericTypes.indexOf(yVal) !== -1 && numericTypes.indexOf(yVali) !== -1 && yVal !== yVali) {\n coerceLinearY = true;\n } else if (yFullAxes[j][keyi] !== yVal) allEqual = false;\n }\n if (allEqual) {\n if (coerceLinearX) layout[xFullAxes[0]._name].type = \"linear\";\n if (coerceLinearY) layout[yFullAxes[0]._name].type = \"linear\";\n swapAxisAttrs(layout, keyi, xFullAxes, yFullAxes, gd._fullLayout._dfltTitle);\n }\n }\n for (i = 0; i < gd._fullLayout.annotations.length; i++) {\n var ann = gd._fullLayout.annotations[i];\n if (xIds.indexOf(ann.xref) !== -1 && yIds.indexOf(ann.yref) !== -1) {\n Lib.swapAttrs(layout.annotations[i], [\"?\"]);\n }\n }\n }\n function swapAxisAttrs(layout, key, xFullAxes, yFullAxes, dfltTitle) {\n var np = Lib.nestedProperty;\n var xVal = np(layout[xFullAxes[0]._name], key).get();\n var yVal = np(layout[yFullAxes[0]._name], key).get();\n var i;\n if (key === \"title\") {\n if (xVal && xVal.text === dfltTitle.x) {\n xVal.text = dfltTitle.y;\n }\n if (yVal && yVal.text === dfltTitle.y) {\n yVal.text = dfltTitle.x;\n }\n }\n for (i = 0; i < xFullAxes.length; i++) {\n np(layout, xFullAxes[i]._name + \".\" + key).set(yVal);\n }\n for (i = 0; i < yFullAxes.length; i++) {\n np(layout, yFullAxes[i]._name + \".\" + key).set(xVal);\n }\n }\n function isAngular(ax) {\n return ax._id === \"angularaxis\";\n }\n function moveOutsideBreak(v, ax) {\n var len = ax._rangebreaks.length;\n for (var k = 0; k < len; k++) {\n var brk = ax._rangebreaks[k];\n if (v >= brk.min && v < brk.max) {\n return brk.max;\n }\n }\n return v;\n }\n function insideTicklabelposition(ax) {\n return (ax.ticklabelposition || \"\").indexOf(\"inside\") !== -1;\n }\n function hideCounterAxisInsideTickLabels(ax, opts) {\n if (insideTicklabelposition(ax._anchorAxis || {})) {\n if (ax._hideCounterAxisInsideTickLabels) {\n ax._hideCounterAxisInsideTickLabels(opts);\n }\n }\n }\n function incrementShift(ax, shiftVal, axShifts, normalize) {\n var overlay = ax.anchor !== \"free\" && (ax.overlaying === void 0 || ax.overlaying === false) ? ax._id : ax.overlaying;\n var shiftValAdj;\n if (normalize) {\n shiftValAdj = ax.side === \"right\" ? shiftVal : -shiftVal;\n } else {\n shiftValAdj = shiftVal;\n }\n if (!(overlay in axShifts)) {\n axShifts[overlay] = {};\n }\n if (!(ax.side in axShifts[overlay])) {\n axShifts[overlay][ax.side] = 0;\n }\n axShifts[overlay][ax.side] += shiftValAdj;\n }\n function setShiftVal(ax, axShifts) {\n return ax.autoshift ? axShifts[ax.overlaying][ax.side] : ax.shift || 0;\n }\n function periodCompatibleWithTickformat(period, tickformat) {\n return /%f/.test(tickformat) ? period >= ONEMICROSEC : /%L/.test(tickformat) ? period >= ONEMILLI : /%[SX]/.test(tickformat) ? period >= ONESEC : /%M/.test(tickformat) ? period >= ONEMIN : /%[HI]/.test(tickformat) ? period >= ONEHOUR : /%p/.test(tickformat) ? period >= HALFDAY : /%[Aadejuwx]/.test(tickformat) ? period >= ONEDAY : /%[UVW]/.test(tickformat) ? period >= ONEWEEK : /%[Bbm]/.test(tickformat) ? period >= ONEMINMONTH : /%[q]/.test(tickformat) ? period >= ONEMINQUARTER : /%[Yy]/.test(tickformat) ? period >= ONEMINYEAR : true;\n }\n }\n });\n\n // src/plots/cartesian/autorange_options_defaults.js\n var require_autorange_options_defaults = __commonJS({\n \"src/plots/cartesian/autorange_options_defaults.js\"(exports, module) {\n \"use strict\";\n module.exports = function handleAutorangeOptionsDefaults(coerce, autorange, range) {\n var minRange, maxRange;\n if (range) {\n var isReversed = autorange === \"reversed\" || autorange === \"min reversed\" || autorange === \"max reversed\";\n minRange = range[isReversed ? 1 : 0];\n maxRange = range[isReversed ? 0 : 1];\n }\n var minallowed = coerce(\"autorangeoptions.minallowed\", maxRange === null ? minRange : void 0);\n var maxallowed = coerce(\"autorangeoptions.maxallowed\", minRange === null ? maxRange : void 0);\n if (minallowed === void 0) coerce(\"autorangeoptions.clipmin\");\n if (maxallowed === void 0) coerce(\"autorangeoptions.clipmax\");\n coerce(\"autorangeoptions.include\");\n };\n }\n });\n\n // src/plots/cartesian/range_defaults.js\n var require_range_defaults = __commonJS({\n \"src/plots/cartesian/range_defaults.js\"(exports, module) {\n \"use strict\";\n var handleAutorangeOptionsDefaults = require_autorange_options_defaults();\n module.exports = function handleRangeDefaults(containerIn, containerOut, coerce, options) {\n var axTemplate = containerOut._template || {};\n var axType = containerOut.type || axTemplate.type || \"-\";\n coerce(\"minallowed\");\n coerce(\"maxallowed\");\n var range = coerce(\"range\");\n if (!range) {\n var insiderange;\n if (!options.noInsiderange && axType !== \"log\") {\n insiderange = coerce(\"insiderange\");\n if (insiderange && (insiderange[0] === null || insiderange[1] === null)) {\n containerOut.insiderange = false;\n insiderange = void 0;\n }\n if (insiderange) range = coerce(\"range\", insiderange);\n }\n }\n var autorangeDflt = containerOut.getAutorangeDflt(range, options);\n var autorange = coerce(\"autorange\", autorangeDflt);\n var shouldAutorange;\n if (range && (range[0] === null && range[1] === null || (range[0] === null || range[1] === null) && (autorange === \"reversed\" || autorange === true) || range[0] !== null && (autorange === \"min\" || autorange === \"max reversed\") || range[1] !== null && (autorange === \"max\" || autorange === \"min reversed\"))) {\n range = void 0;\n delete containerOut.range;\n containerOut.autorange = true;\n shouldAutorange = true;\n }\n if (!shouldAutorange) {\n autorangeDflt = containerOut.getAutorangeDflt(range, options);\n autorange = coerce(\"autorange\", autorangeDflt);\n }\n if (autorange) {\n handleAutorangeOptionsDefaults(coerce, autorange, range);\n if (axType === \"linear\" || axType === \"-\") coerce(\"rangemode\");\n }\n containerOut.cleanRange();\n };\n }\n });\n\n // node_modules/mouse-event-offset/index.js\n var require_mouse_event_offset = __commonJS({\n \"node_modules/mouse-event-offset/index.js\"(exports, module) {\n var rootPosition = { left: 0, top: 0 };\n module.exports = mouseEventOffset;\n function mouseEventOffset(ev, target, out) {\n target = target || ev.currentTarget || ev.srcElement;\n if (!Array.isArray(out)) {\n out = [0, 0];\n }\n var cx = ev.clientX || 0;\n var cy = ev.clientY || 0;\n var rect = getBoundingClientOffset(target);\n out[0] = cx - rect.left;\n out[1] = cy - rect.top;\n return out;\n }\n function getBoundingClientOffset(element) {\n if (element === window || element === document || element === document.body) {\n return rootPosition;\n } else {\n return element.getBoundingClientRect();\n }\n }\n }\n });\n\n // node_modules/has-passive-events/index.js\n var require_has_passive_events = __commonJS({\n \"node_modules/has-passive-events/index.js\"(exports, module) {\n \"use strict\";\n var isBrowser = require_client();\n function detect() {\n var supported = false;\n try {\n var opts = Object.defineProperty({}, \"passive\", {\n get: function() {\n supported = true;\n }\n });\n window.addEventListener(\"test\", null, opts);\n window.removeEventListener(\"test\", null, opts);\n } catch (e) {\n supported = false;\n }\n return supported;\n }\n module.exports = isBrowser && detect();\n }\n });\n\n // src/components/dragelement/align.js\n var require_align = __commonJS({\n \"src/components/dragelement/align.js\"(exports, module) {\n \"use strict\";\n module.exports = function align(v, dv, v0, v1, anchor) {\n var vmin = (v - v0) / (v1 - v0);\n var vmax = vmin + dv / (v1 - v0);\n var vc = (vmin + vmax) / 2;\n if (anchor === \"left\" || anchor === \"bottom\") return vmin;\n if (anchor === \"center\" || anchor === \"middle\") return vc;\n if (anchor === \"right\" || anchor === \"top\") return vmax;\n if (vmin < 2 / 3 - vc) return vmin;\n if (vmax > 4 / 3 - vc) return vmax;\n return vc;\n };\n }\n });\n\n // src/components/dragelement/cursor.js\n var require_cursor = __commonJS({\n \"src/components/dragelement/cursor.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var cursorset = [\n [\"sw-resize\", \"s-resize\", \"se-resize\"],\n [\"w-resize\", \"move\", \"e-resize\"],\n [\"nw-resize\", \"n-resize\", \"ne-resize\"]\n ];\n module.exports = function getCursor(x, y, xanchor, yanchor) {\n if (xanchor === \"left\") x = 0;\n else if (xanchor === \"center\") x = 1;\n else if (xanchor === \"right\") x = 2;\n else x = Lib.constrain(Math.floor(x * 3), 0, 2);\n if (yanchor === \"bottom\") y = 0;\n else if (yanchor === \"middle\") y = 1;\n else if (yanchor === \"top\") y = 2;\n else y = Lib.constrain(Math.floor(y * 3), 0, 2);\n return cursorset[y][x];\n };\n }\n });\n\n // src/components/dragelement/unhover.js\n var require_unhover = __commonJS({\n \"src/components/dragelement/unhover.js\"(exports, module) {\n \"use strict\";\n var Events = require_events2();\n var throttle = require_throttle();\n var getGraphDiv = require_dom().getGraphDiv;\n var hoverConstants = require_constants();\n var unhover = module.exports = {};\n unhover.wrapped = function(gd, evt, subplot) {\n gd = getGraphDiv(gd);\n if (gd._fullLayout) {\n throttle.clear(gd._fullLayout._uid + hoverConstants.HOVERID);\n }\n unhover.raw(gd, evt, subplot);\n };\n unhover.raw = function raw(gd, evt) {\n var fullLayout = gd._fullLayout;\n var oldhoverdata = gd._hoverdata;\n if (!evt) evt = {};\n if (evt.target && !gd._dragged && Events.triggerHandler(gd, \"plotly_beforehover\", evt) === false) {\n return;\n }\n fullLayout._hoverlayer.selectAll(\"g\").remove();\n fullLayout._hoverlayer.selectAll(\"line\").remove();\n fullLayout._hoverlayer.selectAll(\"circle\").remove();\n gd._hoverdata = void 0;\n if (evt.target && oldhoverdata) {\n gd.emit(\"plotly_unhover\", {\n event: evt,\n points: oldhoverdata\n });\n }\n };\n }\n });\n\n // src/components/dragelement/index.js\n var require_dragelement = __commonJS({\n \"src/components/dragelement/index.js\"(exports, module) {\n \"use strict\";\n var mouseOffset = require_mouse_event_offset();\n var hasHover = require_has_hover();\n var supportsPassive = require_has_passive_events();\n var removeElement = require_lib().removeElement;\n var constants = require_constants2();\n var dragElement = module.exports = {};\n dragElement.align = require_align();\n dragElement.getCursor = require_cursor();\n var unhover = require_unhover();\n dragElement.unhover = unhover.wrapped;\n dragElement.unhoverRaw = unhover.raw;\n dragElement.init = function init(options) {\n var gd = options.gd;\n var numClicks = 1;\n var doubleClickDelay = gd._context.doubleClickDelay;\n var element = options.element;\n var startX, startY, newMouseDownTime, cursor, dragCover, initialEvent, initialTarget, rightClick;\n if (!gd._mouseDownTime) gd._mouseDownTime = 0;\n element.style.pointerEvents = \"all\";\n element.onmousedown = onStart;\n if (!supportsPassive) {\n element.ontouchstart = onStart;\n } else {\n if (element._ontouchstart) {\n element.removeEventListener(\"touchstart\", element._ontouchstart);\n }\n element._ontouchstart = onStart;\n element.addEventListener(\"touchstart\", onStart, { passive: false });\n }\n function _clampFn(dx, dy, minDrag) {\n if (Math.abs(dx) < minDrag) dx = 0;\n if (Math.abs(dy) < minDrag) dy = 0;\n return [dx, dy];\n }\n var clampFn = options.clampFn || _clampFn;\n function onStart(e) {\n gd._dragged = false;\n gd._dragging = true;\n var offset = pointerOffset(e);\n startX = offset[0];\n startY = offset[1];\n initialTarget = e.target;\n initialEvent = e;\n rightClick = e.buttons === 2 || e.ctrlKey;\n if (typeof e.clientX === \"undefined\" && typeof e.clientY === \"undefined\") {\n e.clientX = startX;\n e.clientY = startY;\n }\n newMouseDownTime = (/* @__PURE__ */ new Date()).getTime();\n if (newMouseDownTime - gd._mouseDownTime < doubleClickDelay) {\n numClicks += 1;\n } else {\n numClicks = 1;\n gd._mouseDownTime = newMouseDownTime;\n }\n if (options.prepFn) options.prepFn(e, startX, startY);\n if (hasHover && !rightClick) {\n dragCover = coverSlip();\n dragCover.style.cursor = window.getComputedStyle(element).cursor;\n } else if (!hasHover) {\n dragCover = document;\n cursor = window.getComputedStyle(document.documentElement).cursor;\n document.documentElement.style.cursor = window.getComputedStyle(element).cursor;\n }\n document.addEventListener(\"mouseup\", onDone);\n document.addEventListener(\"touchend\", onDone);\n if (options.dragmode !== false) {\n e.preventDefault();\n document.addEventListener(\"mousemove\", onMove);\n document.addEventListener(\"touchmove\", onMove, { passive: false });\n }\n return;\n }\n function onMove(e) {\n e.preventDefault();\n var offset = pointerOffset(e);\n var minDrag = options.minDrag || constants.MINDRAG;\n var dxdy = clampFn(offset[0] - startX, offset[1] - startY, minDrag);\n var dx = dxdy[0];\n var dy = dxdy[1];\n if (dx || dy) {\n gd._dragged = true;\n dragElement.unhover(gd, e);\n }\n if (gd._dragged && options.moveFn && !rightClick) {\n gd._dragdata = {\n element,\n dx,\n dy\n };\n options.moveFn(dx, dy);\n }\n return;\n }\n function onDone(e) {\n delete gd._dragdata;\n if (options.dragmode !== false) {\n e.preventDefault();\n document.removeEventListener(\"mousemove\", onMove);\n document.removeEventListener(\"touchmove\", onMove);\n }\n document.removeEventListener(\"mouseup\", onDone);\n document.removeEventListener(\"touchend\", onDone);\n if (hasHover) {\n removeElement(dragCover);\n } else if (cursor) {\n dragCover.documentElement.style.cursor = cursor;\n cursor = null;\n }\n if (!gd._dragging) {\n gd._dragged = false;\n return;\n }\n gd._dragging = false;\n if ((/* @__PURE__ */ new Date()).getTime() - gd._mouseDownTime > doubleClickDelay) {\n numClicks = Math.max(numClicks - 1, 1);\n }\n if (gd._dragged) {\n if (options.doneFn) options.doneFn();\n } else {\n var clickEvent;\n if (initialEvent.target === initialTarget) {\n clickEvent = initialEvent;\n } else {\n clickEvent = {\n target: initialTarget,\n srcElement: initialTarget,\n toElement: initialTarget\n };\n Object.keys(initialEvent).concat(Object.keys(initialEvent.__proto__)).forEach((k) => {\n var v = initialEvent[k];\n if (!clickEvent[k] && typeof v !== \"function\") {\n clickEvent[k] = v;\n }\n });\n }\n if (options.clickFn) options.clickFn(numClicks, clickEvent);\n if (!rightClick) {\n initialTarget.dispatchEvent(new MouseEvent(\"click\", e));\n }\n }\n gd._dragging = false;\n gd._dragged = false;\n return;\n }\n };\n function coverSlip() {\n var cover = document.createElement(\"div\");\n cover.className = \"dragcover\";\n var cStyle = cover.style;\n cStyle.position = \"fixed\";\n cStyle.left = 0;\n cStyle.right = 0;\n cStyle.top = 0;\n cStyle.bottom = 0;\n cStyle.zIndex = 999999999;\n cStyle.background = \"none\";\n document.body.appendChild(cover);\n return cover;\n }\n dragElement.coverSlip = coverSlip;\n function pointerOffset(e) {\n return mouseOffset(\n e.changedTouches ? e.changedTouches[0] : e,\n document.body\n );\n }\n }\n });\n\n // src/lib/setcursor.js\n var require_setcursor = __commonJS({\n \"src/lib/setcursor.js\"(exports, module) {\n \"use strict\";\n module.exports = function setCursor(el3, csr) {\n (el3.attr(\"class\") || \"\").split(\" \").forEach(function(cls) {\n if (cls.indexOf(\"cursor-\") === 0) el3.classed(cls, false);\n });\n if (csr) el3.classed(\"cursor-\" + csr, true);\n };\n }\n });\n\n // src/lib/override_cursor.js\n var require_override_cursor = __commonJS({\n \"src/lib/override_cursor.js\"(exports, module) {\n \"use strict\";\n var setCursor = require_setcursor();\n var STASHATTR = \"data-savedcursor\";\n var NO_CURSOR = \"!!\";\n module.exports = function overrideCursor(el3, csr) {\n var savedCursor = el3.attr(STASHATTR);\n if (csr) {\n if (!savedCursor) {\n var classes = (el3.attr(\"class\") || \"\").split(\" \");\n for (var i = 0; i < classes.length; i++) {\n var cls = classes[i];\n if (cls.indexOf(\"cursor-\") === 0) {\n el3.attr(STASHATTR, cls.substr(7)).classed(cls, false);\n }\n }\n if (!el3.attr(STASHATTR)) {\n el3.attr(STASHATTR, NO_CURSOR);\n }\n }\n setCursor(el3, csr);\n } else if (savedCursor) {\n el3.attr(STASHATTR, null);\n if (savedCursor === NO_CURSOR) setCursor(el3);\n else setCursor(el3, savedCursor);\n }\n };\n }\n });\n\n // src/components/legend/attributes.js\n var require_attributes9 = __commonJS({\n \"src/components/legend/attributes.js\"(exports, module) {\n \"use strict\";\n var fontAttrs = require_font_attributes();\n var colorAttrs = require_attributes3();\n module.exports = {\n // not really a 'subplot' attribute container,\n // but this is the flag we use to denote attributes that\n // support yaxis, yaxis2, yaxis3, ... counters\n _isSubplotObj: true,\n visible: {\n valType: \"boolean\",\n dflt: true,\n editType: \"legend\"\n },\n bgcolor: {\n valType: \"color\",\n editType: \"legend\"\n },\n bordercolor: {\n valType: \"color\",\n dflt: colorAttrs.defaultLine,\n editType: \"legend\"\n },\n borderwidth: {\n valType: \"number\",\n min: 0,\n dflt: 0,\n editType: \"legend\"\n },\n font: fontAttrs({\n editType: \"legend\"\n }),\n grouptitlefont: fontAttrs({\n editType: \"legend\"\n }),\n orientation: {\n valType: \"enumerated\",\n values: [\"v\", \"h\"],\n dflt: \"v\",\n editType: \"legend\"\n },\n traceorder: {\n valType: \"flaglist\",\n flags: [\"reversed\", \"grouped\"],\n extras: [\"normal\"],\n editType: \"legend\"\n },\n tracegroupgap: {\n valType: \"number\",\n min: 0,\n dflt: 10,\n editType: \"legend\"\n },\n entrywidth: {\n valType: \"number\",\n min: 0,\n editType: \"legend\"\n },\n entrywidthmode: {\n valType: \"enumerated\",\n values: [\"fraction\", \"pixels\"],\n dflt: \"pixels\",\n editType: \"legend\"\n },\n indentation: {\n valType: \"number\",\n min: -15,\n dflt: 0,\n editType: \"legend\"\n },\n itemsizing: {\n valType: \"enumerated\",\n values: [\"trace\", \"constant\"],\n dflt: \"trace\",\n editType: \"legend\"\n },\n itemwidth: {\n valType: \"number\",\n min: 30,\n dflt: 30,\n editType: \"legend\"\n },\n itemclick: {\n valType: \"enumerated\",\n values: [\"toggle\", \"toggleothers\", false],\n dflt: \"toggle\",\n editType: \"legend\"\n },\n itemdoubleclick: {\n valType: \"enumerated\",\n values: [\"toggle\", \"toggleothers\", false],\n dflt: \"toggleothers\",\n editType: \"legend\"\n },\n groupclick: {\n valType: \"enumerated\",\n values: [\"toggleitem\", \"togglegroup\"],\n dflt: \"togglegroup\",\n editType: \"legend\"\n },\n x: {\n valType: \"number\",\n editType: \"legend\"\n },\n xref: {\n valType: \"enumerated\",\n dflt: \"paper\",\n values: [\"container\", \"paper\"],\n editType: \"layoutstyle\"\n },\n xanchor: {\n valType: \"enumerated\",\n values: [\"auto\", \"left\", \"center\", \"right\"],\n dflt: \"left\",\n editType: \"legend\"\n },\n y: {\n valType: \"number\",\n editType: \"legend\"\n },\n yref: {\n valType: \"enumerated\",\n dflt: \"paper\",\n values: [\"container\", \"paper\"],\n editType: \"layoutstyle\"\n },\n yanchor: {\n valType: \"enumerated\",\n values: [\"auto\", \"top\", \"middle\", \"bottom\"],\n editType: \"legend\"\n },\n uirevision: {\n valType: \"any\",\n editType: \"none\"\n },\n valign: {\n valType: \"enumerated\",\n values: [\"top\", \"middle\", \"bottom\"],\n dflt: \"middle\",\n editType: \"legend\"\n },\n title: {\n text: {\n valType: \"string\",\n dflt: \"\",\n editType: \"legend\"\n },\n font: fontAttrs({\n editType: \"legend\"\n }),\n side: {\n valType: \"enumerated\",\n values: [\"top\", \"left\", \"top left\", \"top center\", \"top right\"],\n editType: \"legend\"\n },\n editType: \"legend\"\n },\n editType: \"legend\"\n };\n }\n });\n\n // src/components/legend/helpers.js\n var require_helpers3 = __commonJS({\n \"src/components/legend/helpers.js\"(exports) {\n \"use strict\";\n exports.isGrouped = function isGrouped(legendLayout) {\n return (legendLayout.traceorder || \"\").indexOf(\"grouped\") !== -1;\n };\n exports.isVertical = function isVertical(legendLayout) {\n return legendLayout.orientation !== \"h\";\n };\n exports.isReversed = function isReversed(legendLayout) {\n return (legendLayout.traceorder || \"\").indexOf(\"reversed\") !== -1;\n };\n }\n });\n\n // src/components/legend/defaults.js\n var require_defaults3 = __commonJS({\n \"src/components/legend/defaults.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var Lib = require_lib();\n var Template = require_plot_template();\n var plotsAttrs = require_attributes2();\n var attributes = require_attributes9();\n var basePlotLayoutAttributes = require_layout_attributes2();\n var helpers = require_helpers3();\n function groupDefaults(legendId, layoutIn, layoutOut, fullData) {\n var containerIn = layoutIn[legendId] || {};\n var containerOut = Template.newContainer(layoutOut, legendId);\n function coerce(attr, dflt) {\n return Lib.coerce(containerIn, containerOut, attributes, attr, dflt);\n }\n var itemFont = Lib.coerceFont(coerce, \"font\", layoutOut.font);\n coerce(\"bgcolor\", layoutOut.paper_bgcolor);\n coerce(\"bordercolor\");\n var visible = coerce(\"visible\");\n if (!visible) return;\n var trace;\n var traceCoerce = function(attr, dflt) {\n var traceIn = trace._input;\n var traceOut = trace;\n return Lib.coerce(traceIn, traceOut, plotsAttrs, attr, dflt);\n };\n var globalFont = layoutOut.font || {};\n var grouptitlefont = Lib.coerceFont(coerce, \"grouptitlefont\", globalFont, { overrideDflt: {\n size: Math.round(globalFont.size * 1.1)\n } });\n var legendTraceCount = 0;\n var legendReallyHasATrace = false;\n var defaultOrder = \"normal\";\n var shapesWithLegend = (layoutOut.shapes || []).filter(function(d) {\n return d.showlegend;\n });\n var allLegendItems = fullData.concat(shapesWithLegend).filter(function(d) {\n return legendId === (d.legend || \"legend\");\n });\n for (var i = 0; i < allLegendItems.length; i++) {\n trace = allLegendItems[i];\n if (!trace.visible) continue;\n var isShape = trace._isShape;\n if (trace.showlegend || trace._dfltShowLegend && !(trace._module && trace._module.attributes && trace._module.attributes.showlegend && trace._module.attributes.showlegend.dflt === false)) {\n legendTraceCount++;\n if (trace.showlegend) {\n legendReallyHasATrace = true;\n if (!isShape && Registry.traceIs(trace, \"pie-like\") || trace._input.showlegend === true) {\n legendTraceCount++;\n }\n }\n Lib.coerceFont(traceCoerce, \"legendgrouptitle.font\", grouptitlefont);\n }\n if (!isShape && Registry.traceIs(trace, \"bar\") && layoutOut.barmode === \"stack\" || [\"tonextx\", \"tonexty\"].indexOf(trace.fill) !== -1) {\n defaultOrder = helpers.isGrouped({ traceorder: defaultOrder }) ? \"grouped+reversed\" : \"reversed\";\n }\n if (trace.legendgroup !== void 0 && trace.legendgroup !== \"\") {\n defaultOrder = helpers.isReversed({ traceorder: defaultOrder }) ? \"reversed+grouped\" : \"grouped\";\n }\n }\n var showLegend = Lib.coerce(\n layoutIn,\n layoutOut,\n basePlotLayoutAttributes,\n \"showlegend\",\n legendReallyHasATrace && legendTraceCount > (legendId === \"legend\" ? 1 : 0)\n );\n if (showLegend === false) layoutOut[legendId] = void 0;\n if (showLegend === false && !containerIn.uirevision) return;\n coerce(\"uirevision\", layoutOut.uirevision);\n if (showLegend === false) return;\n coerce(\"borderwidth\");\n var orientation = coerce(\"orientation\");\n var yref = coerce(\"yref\");\n var xref = coerce(\"xref\");\n var isHorizontal = orientation === \"h\";\n var isPaperY = yref === \"paper\";\n var isPaperX = xref === \"paper\";\n var defaultX, defaultY, defaultYAnchor;\n var defaultXAnchor = \"left\";\n if (isHorizontal) {\n defaultX = 0;\n if (Registry.getComponentMethod(\"rangeslider\", \"isVisible\")(layoutIn.xaxis)) {\n if (isPaperY) {\n defaultY = 1.1;\n defaultYAnchor = \"bottom\";\n } else {\n defaultY = 1;\n defaultYAnchor = \"top\";\n }\n } else {\n if (isPaperY) {\n defaultY = -0.1;\n defaultYAnchor = \"top\";\n } else {\n defaultY = 0;\n defaultYAnchor = \"bottom\";\n }\n }\n } else {\n defaultY = 1;\n defaultYAnchor = \"auto\";\n if (isPaperX) {\n defaultX = 1.02;\n } else {\n defaultX = 1;\n defaultXAnchor = \"right\";\n }\n }\n Lib.coerce(containerIn, containerOut, {\n x: {\n valType: \"number\",\n editType: \"legend\",\n min: isPaperX ? -2 : 0,\n max: isPaperX ? 3 : 1,\n dflt: defaultX\n }\n }, \"x\");\n Lib.coerce(containerIn, containerOut, {\n y: {\n valType: \"number\",\n editType: \"legend\",\n min: isPaperY ? -2 : 0,\n max: isPaperY ? 3 : 1,\n dflt: defaultY\n }\n }, \"y\");\n coerce(\"traceorder\", defaultOrder);\n if (helpers.isGrouped(layoutOut[legendId])) coerce(\"tracegroupgap\");\n coerce(\"entrywidth\");\n coerce(\"entrywidthmode\");\n coerce(\"indentation\");\n coerce(\"itemsizing\");\n coerce(\"itemwidth\");\n coerce(\"itemclick\");\n coerce(\"itemdoubleclick\");\n coerce(\"groupclick\");\n coerce(\"xanchor\", defaultXAnchor);\n coerce(\"yanchor\", defaultYAnchor);\n coerce(\"valign\");\n Lib.noneOrAll(containerIn, containerOut, [\"x\", \"y\"]);\n var titleText = coerce(\"title.text\");\n if (titleText) {\n coerce(\"title.side\", isHorizontal ? \"left\" : \"top\");\n var dfltTitleFont = Lib.extendFlat({}, itemFont, {\n size: Lib.bigFont(itemFont.size)\n });\n Lib.coerceFont(coerce, \"title.font\", dfltTitleFont);\n }\n }\n module.exports = function legendDefaults(layoutIn, layoutOut, fullData) {\n var i;\n var allLegendsData = fullData.slice();\n var shapes = layoutOut.shapes;\n if (shapes) {\n for (i = 0; i < shapes.length; i++) {\n var shape = shapes[i];\n if (!shape.showlegend) continue;\n var mockTrace = {\n _input: shape._input,\n visible: shape.visible,\n showlegend: shape.showlegend,\n legend: shape.legend\n };\n allLegendsData.push(mockTrace);\n }\n }\n var legends = [\"legend\"];\n for (i = 0; i < allLegendsData.length; i++) {\n Lib.pushUnique(legends, allLegendsData[i].legend);\n }\n layoutOut._legends = [];\n for (i = 0; i < legends.length; i++) {\n var legendId = legends[i];\n groupDefaults(legendId, layoutIn, layoutOut, allLegendsData);\n if (layoutOut[legendId] && layoutOut[legendId].visible) {\n layoutOut[legendId]._id = legendId;\n }\n layoutOut._legends.push(legendId);\n }\n };\n }\n });\n\n // src/components/legend/handle_click.js\n var require_handle_click = __commonJS({\n \"src/components/legend/handle_click.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var Lib = require_lib();\n var pushUnique = Lib.pushUnique;\n var SHOWISOLATETIP = true;\n module.exports = function handleClick(g, gd, numClicks) {\n var fullLayout = gd._fullLayout;\n if (gd._dragged || gd._editing) return;\n var itemClick = fullLayout.legend.itemclick;\n var itemDoubleClick = fullLayout.legend.itemdoubleclick;\n var groupClick = fullLayout.legend.groupclick;\n if (numClicks === 1 && itemClick === \"toggle\" && itemDoubleClick === \"toggleothers\" && SHOWISOLATETIP && gd.data && gd._context.showTips) {\n Lib.notifier(Lib._(gd, \"Double-click on legend to isolate one trace\"), \"long\");\n SHOWISOLATETIP = false;\n } else {\n SHOWISOLATETIP = false;\n }\n var mode;\n if (numClicks === 1) mode = itemClick;\n else if (numClicks === 2) mode = itemDoubleClick;\n if (!mode) return;\n var toggleGroup = groupClick === \"togglegroup\";\n var hiddenSlices = fullLayout.hiddenlabels ? fullLayout.hiddenlabels.slice() : [];\n var legendItem = g.data()[0][0];\n if (legendItem.groupTitle && legendItem.noClick) return;\n var fullData = gd._fullData;\n var shapesWithLegend = (fullLayout.shapes || []).filter(function(d2) {\n return d2.showlegend;\n });\n var allLegendItems = fullData.concat(shapesWithLegend);\n var fullTrace = legendItem.trace;\n if (fullTrace._isShape) {\n fullTrace = fullTrace._fullInput;\n }\n var legendgroup = fullTrace.legendgroup;\n var i, j, kcont, key, keys, val;\n var dataUpdate = {};\n var dataIndices = [];\n var carrs = [];\n var carrIdx = [];\n function insertDataUpdate(traceIndex, value) {\n var attrIndex = dataIndices.indexOf(traceIndex);\n var valueArray = dataUpdate.visible;\n if (!valueArray) {\n valueArray = dataUpdate.visible = [];\n }\n if (dataIndices.indexOf(traceIndex) === -1) {\n dataIndices.push(traceIndex);\n attrIndex = dataIndices.length - 1;\n }\n valueArray[attrIndex] = value;\n return attrIndex;\n }\n var updatedShapes = (fullLayout.shapes || []).map(function(d2) {\n return d2._input;\n });\n var shapesUpdated = false;\n function insertShapesUpdate(shapeIndex, value) {\n updatedShapes[shapeIndex].visible = value;\n shapesUpdated = true;\n }\n function setVisibility(fullTrace2, visibility) {\n if (legendItem.groupTitle && !toggleGroup) return;\n var fullInput2 = fullTrace2._fullInput || fullTrace2;\n var isShape2 = fullInput2._isShape;\n var index = fullInput2.index;\n if (index === void 0) index = fullInput2._index;\n var nextVisibility2 = fullInput2.visible === false ? false : visibility;\n if (isShape2) {\n insertShapesUpdate(index, nextVisibility2);\n } else {\n insertDataUpdate(index, nextVisibility2);\n }\n }\n var thisLegend = fullTrace.legend;\n var fullInput = fullTrace._fullInput;\n var isShape = fullInput && fullInput._isShape;\n if (!isShape && Registry.traceIs(fullTrace, \"pie-like\")) {\n var thisLabel = legendItem.label;\n var thisLabelIndex = hiddenSlices.indexOf(thisLabel);\n if (mode === \"toggle\") {\n if (thisLabelIndex === -1) hiddenSlices.push(thisLabel);\n else hiddenSlices.splice(thisLabelIndex, 1);\n } else if (mode === \"toggleothers\") {\n var changed = thisLabelIndex !== -1;\n var unhideList = [];\n for (i = 0; i < gd.calcdata.length; i++) {\n var cdi = gd.calcdata[i];\n for (j = 0; j < cdi.length; j++) {\n var d = cdi[j];\n var dLabel = d.label;\n if (thisLegend === cdi[0].trace.legend) {\n if (thisLabel !== dLabel) {\n if (hiddenSlices.indexOf(dLabel) === -1) changed = true;\n pushUnique(hiddenSlices, dLabel);\n unhideList.push(dLabel);\n }\n }\n }\n }\n if (!changed) {\n for (var q = 0; q < unhideList.length; q++) {\n var pos = hiddenSlices.indexOf(unhideList[q]);\n if (pos !== -1) {\n hiddenSlices.splice(pos, 1);\n }\n }\n }\n }\n Registry.call(\"_guiRelayout\", gd, \"hiddenlabels\", hiddenSlices);\n } else {\n var hasLegendgroup = legendgroup && legendgroup.length;\n var traceIndicesInGroup = [];\n var tracei;\n if (hasLegendgroup) {\n for (i = 0; i < allLegendItems.length; i++) {\n tracei = allLegendItems[i];\n if (!tracei.visible) continue;\n if (tracei.legendgroup === legendgroup) {\n traceIndicesInGroup.push(i);\n }\n }\n }\n if (mode === \"toggle\") {\n var nextVisibility;\n switch (fullTrace.visible) {\n case true:\n nextVisibility = \"legendonly\";\n break;\n case false:\n nextVisibility = false;\n break;\n case \"legendonly\":\n nextVisibility = true;\n break;\n }\n if (hasLegendgroup) {\n if (toggleGroup) {\n for (i = 0; i < allLegendItems.length; i++) {\n var item = allLegendItems[i];\n if (item.visible !== false && item.legendgroup === legendgroup) {\n setVisibility(item, nextVisibility);\n }\n }\n } else {\n setVisibility(fullTrace, nextVisibility);\n }\n } else {\n setVisibility(fullTrace, nextVisibility);\n }\n } else if (mode === \"toggleothers\") {\n var isClicked, isInGroup, notInLegend, otherState, _item;\n var isIsolated = true;\n for (i = 0; i < allLegendItems.length; i++) {\n _item = allLegendItems[i];\n isClicked = _item === fullTrace;\n notInLegend = _item.showlegend !== true;\n if (isClicked || notInLegend) continue;\n isInGroup = hasLegendgroup && _item.legendgroup === legendgroup;\n if (!isInGroup && _item.legend === thisLegend && _item.visible === true && !Registry.traceIs(_item, \"notLegendIsolatable\")) {\n isIsolated = false;\n break;\n }\n }\n for (i = 0; i < allLegendItems.length; i++) {\n _item = allLegendItems[i];\n if (_item.visible === false || _item.legend !== thisLegend) continue;\n if (Registry.traceIs(_item, \"notLegendIsolatable\")) {\n continue;\n }\n switch (fullTrace.visible) {\n case \"legendonly\":\n setVisibility(_item, true);\n break;\n case true:\n otherState = isIsolated ? true : \"legendonly\";\n isClicked = _item === fullTrace;\n notInLegend = _item.showlegend !== true && !_item.legendgroup;\n isInGroup = isClicked || hasLegendgroup && _item.legendgroup === legendgroup;\n setVisibility(_item, isInGroup || notInLegend ? true : otherState);\n break;\n }\n }\n }\n for (i = 0; i < carrs.length; i++) {\n kcont = carrs[i];\n if (!kcont) continue;\n var update = kcont.constructUpdate();\n var updateKeys = Object.keys(update);\n for (j = 0; j < updateKeys.length; j++) {\n key = updateKeys[j];\n val = dataUpdate[key] = dataUpdate[key] || [];\n val[carrIdx[i]] = update[key];\n }\n }\n keys = Object.keys(dataUpdate);\n for (i = 0; i < keys.length; i++) {\n key = keys[i];\n for (j = 0; j < dataIndices.length; j++) {\n if (!dataUpdate[key].hasOwnProperty(j)) {\n dataUpdate[key][j] = void 0;\n }\n }\n }\n if (shapesUpdated) {\n Registry.call(\"_guiUpdate\", gd, dataUpdate, { shapes: updatedShapes }, dataIndices);\n } else {\n Registry.call(\"_guiRestyle\", gd, dataUpdate, dataIndices);\n }\n }\n };\n }\n });\n\n // src/components/legend/constants.js\n var require_constants3 = __commonJS({\n \"src/components/legend/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n scrollBarWidth: 6,\n scrollBarMinHeight: 20,\n scrollBarColor: \"#808BA4\",\n scrollBarMargin: 4,\n scrollBarEnterAttrs: { rx: 20, ry: 3, width: 0, height: 0 },\n // number of px between legend title and (left) side of legend (always in x direction and from inner border)\n titlePad: 2,\n // number of px between each legend item (x and/or y direction)\n itemGap: 5\n };\n }\n });\n\n // src/components/legend/get_legend_data.js\n var require_get_legend_data = __commonJS({\n \"src/components/legend/get_legend_data.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var helpers = require_helpers3();\n module.exports = function getLegendData(calcdata, opts, hasMultipleLegends) {\n var inHover = opts._inHover;\n var grouped = helpers.isGrouped(opts);\n var reversed = helpers.isReversed(opts);\n var lgroupToTraces = {};\n var lgroups = [];\n var hasOneNonBlankGroup = false;\n var slicesShown = {};\n var lgroupi = 0;\n var maxNameLength = 0;\n var i, j;\n function addOneItem(legendId, legendGroup, legendItem) {\n if (opts.visible === false) return;\n if (hasMultipleLegends && legendId !== opts._id) return;\n if (legendGroup === \"\" || !helpers.isGrouped(opts)) {\n var uniqueGroup = \"~~i\" + lgroupi;\n lgroups.push(uniqueGroup);\n lgroupToTraces[uniqueGroup] = [legendItem];\n lgroupi++;\n } else if (lgroups.indexOf(legendGroup) === -1) {\n lgroups.push(legendGroup);\n hasOneNonBlankGroup = true;\n lgroupToTraces[legendGroup] = [legendItem];\n } else {\n lgroupToTraces[legendGroup].push(legendItem);\n }\n }\n for (i = 0; i < calcdata.length; i++) {\n var cd = calcdata[i];\n var cd0 = cd[0];\n var trace = cd0.trace;\n var lid = trace.legend;\n var lgroup = trace.legendgroup;\n if (!inHover && (!trace.visible || !trace.showlegend)) continue;\n if (Registry.traceIs(trace, \"pie-like\")) {\n if (!slicesShown[lgroup]) slicesShown[lgroup] = {};\n for (j = 0; j < cd.length; j++) {\n var labelj = cd[j].label;\n if (!slicesShown[lgroup][labelj]) {\n addOneItem(lid, lgroup, {\n label: labelj,\n color: cd[j].color,\n i: cd[j].i,\n trace,\n pts: cd[j].pts\n });\n slicesShown[lgroup][labelj] = true;\n maxNameLength = Math.max(maxNameLength, (labelj || \"\").length);\n }\n }\n } else {\n addOneItem(lid, lgroup, cd0);\n maxNameLength = Math.max(maxNameLength, (trace.name || \"\").length);\n }\n }\n if (!lgroups.length) return [];\n var shouldCollapse = !hasOneNonBlankGroup || !grouped;\n var legendData = [];\n for (i = 0; i < lgroups.length; i++) {\n var t = lgroupToTraces[lgroups[i]];\n if (shouldCollapse) {\n legendData.push(t[0]);\n } else {\n legendData.push(t);\n }\n }\n if (shouldCollapse) legendData = [legendData];\n for (i = 0; i < legendData.length; i++) {\n var groupMinRank = Infinity;\n for (j = 0; j < legendData[i].length; j++) {\n var rank = legendData[i][j].trace.legendrank;\n if (groupMinRank > rank) groupMinRank = rank;\n }\n legendData[i][0]._groupMinRank = groupMinRank;\n legendData[i][0]._preGroupSort = i;\n }\n var orderFn1 = function(a, b) {\n return a[0]._groupMinRank - b[0]._groupMinRank || a[0]._preGroupSort - b[0]._preGroupSort;\n };\n var orderFn2 = function(a, b) {\n return a.trace.legendrank - b.trace.legendrank || a._preSort - b._preSort;\n };\n legendData.forEach(function(a, k) {\n a[0]._preGroupSort = k;\n });\n legendData.sort(orderFn1);\n for (i = 0; i < legendData.length; i++) {\n legendData[i].forEach(function(a, k) {\n a._preSort = k;\n });\n legendData[i].sort(orderFn2);\n var firstItemTrace = legendData[i][0].trace;\n var groupTitle = null;\n for (j = 0; j < legendData[i].length; j++) {\n var gt = legendData[i][j].trace.legendgrouptitle;\n if (gt && gt.text) {\n groupTitle = gt;\n if (inHover) gt.font = opts._groupTitleFont;\n break;\n }\n }\n if (reversed) legendData[i].reverse();\n if (groupTitle) {\n var hasPieLike = false;\n for (j = 0; j < legendData[i].length; j++) {\n if (Registry.traceIs(legendData[i][j].trace, \"pie-like\")) {\n hasPieLike = true;\n break;\n }\n }\n legendData[i].unshift({\n i: -1,\n groupTitle,\n noClick: hasPieLike,\n trace: {\n showlegend: firstItemTrace.showlegend,\n legendgroup: firstItemTrace.legendgroup,\n visible: opts.groupclick === \"toggleitem\" ? true : firstItemTrace.visible\n }\n });\n }\n for (j = 0; j < legendData[i].length; j++) {\n legendData[i][j] = [\n legendData[i][j]\n ];\n }\n }\n opts._lgroupsLength = legendData.length;\n opts._maxNameLength = maxNameLength;\n return legendData;\n };\n }\n });\n\n // src/traces/pie/helpers.js\n var require_helpers4 = __commonJS({\n \"src/traces/pie/helpers.js\"(exports) {\n \"use strict\";\n var Lib = require_lib();\n function format(vRounded) {\n return vRounded.indexOf(\"e\") !== -1 ? vRounded.replace(/[.]?0+e/, \"e\") : vRounded.indexOf(\".\") !== -1 ? vRounded.replace(/[.]?0+$/, \"\") : vRounded;\n }\n exports.formatPiePercent = function formatPiePercent(v, separators) {\n var vRounded = format((v * 100).toPrecision(3));\n return Lib.numSeparate(vRounded, separators) + \"%\";\n };\n exports.formatPieValue = function formatPieValue(v, separators) {\n var vRounded = format(v.toPrecision(10));\n return Lib.numSeparate(vRounded, separators);\n };\n exports.getFirstFilled = function getFirstFilled(array, indices) {\n if (!Lib.isArrayOrTypedArray(array)) return;\n for (var i = 0; i < indices.length; i++) {\n var v = array[indices[i]];\n if (v || v === 0 || v === \"\") return v;\n }\n };\n exports.castOption = function castOption(item, indices) {\n if (Lib.isArrayOrTypedArray(item)) return exports.getFirstFilled(item, indices);\n else if (item) return item;\n };\n exports.getRotationAngle = function(rotation) {\n return (rotation === \"auto\" ? 0 : rotation) * Math.PI / 180;\n };\n }\n });\n\n // src/traces/pie/fill_one.js\n var require_fill_one = __commonJS({\n \"src/traces/pie/fill_one.js\"(exports, module) {\n \"use strict\";\n var Drawing = require_drawing();\n var Color2 = require_color();\n module.exports = function fillOne(s, pt, trace, gd) {\n var pattern = trace.marker.pattern;\n if (pattern && pattern.shape) {\n Drawing.pointStyle(s, trace, gd, pt);\n } else {\n Color2.fill(s, pt.color);\n }\n };\n }\n });\n\n // src/traces/pie/style_one.js\n var require_style_one = __commonJS({\n \"src/traces/pie/style_one.js\"(exports, module) {\n \"use strict\";\n var Color2 = require_color();\n var castOption = require_helpers4().castOption;\n var fillOne = require_fill_one();\n module.exports = function styleOne(s, pt, trace, gd) {\n var line = trace.marker.line;\n var lineColor = castOption(line.color, pt.pts) || Color2.defaultLine;\n var lineWidth = castOption(line.width, pt.pts) || 0;\n s.call(fillOne, pt, trace, gd).style(\"stroke-width\", lineWidth).call(Color2.stroke, lineColor);\n };\n }\n });\n\n // src/components/legend/style.js\n var require_style = __commonJS({\n \"src/components/legend/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Registry = require_registry();\n var Lib = require_lib();\n var strTranslate = Lib.strTranslate;\n var Drawing = require_drawing();\n var Color2 = require_color();\n var extractOpts = require_helpers().extractOpts;\n var subTypes = require_subtypes();\n var stylePie = require_style_one();\n var pieCastOption = require_helpers4().castOption;\n var constants = require_constants3();\n var CST_MARKER_SIZE = 12;\n var CST_LINE_WIDTH = 5;\n var CST_MARKER_LINE_WIDTH = 2;\n var MAX_LINE_WIDTH = 10;\n var MAX_MARKER_LINE_WIDTH = 5;\n module.exports = function style(s, gd, legend) {\n var fullLayout = gd._fullLayout;\n if (!legend) legend = fullLayout.legend;\n var constantItemSizing = legend.itemsizing === \"constant\";\n var itemWidth = legend.itemwidth;\n var centerPos = (itemWidth + constants.itemGap * 2) / 2;\n var centerTransform = strTranslate(centerPos, 0);\n var boundLineWidth = function(mlw, cont, max, cst) {\n var v;\n if (mlw + 1) {\n v = mlw;\n } else if (cont && cont.width > 0) {\n v = cont.width;\n } else {\n return 0;\n }\n return constantItemSizing ? cst : Math.min(v, max);\n };\n s.each(function(d) {\n var traceGroup = d3.select(this);\n var layers = Lib.ensureSingle(traceGroup, \"g\", \"layers\");\n layers.style(\"opacity\", d[0].trace.opacity);\n var indentation = legend.indentation;\n var valign = legend.valign;\n var lineHeight = d[0].lineHeight;\n var height = d[0].height;\n if (valign === \"middle\" && indentation === 0 || !lineHeight || !height) {\n layers.attr(\"transform\", null);\n } else {\n var factor = { top: 1, bottom: -1 }[valign];\n var markerOffsetY = factor * (0.5 * (lineHeight - height + 3)) || 0;\n var markerOffsetX = legend.indentation;\n layers.attr(\"transform\", strTranslate(markerOffsetX, markerOffsetY));\n }\n var fill = layers.selectAll(\"g.legendfill\").data([d]);\n fill.enter().append(\"g\").classed(\"legendfill\", true);\n var line = layers.selectAll(\"g.legendlines\").data([d]);\n line.enter().append(\"g\").classed(\"legendlines\", true);\n var symbol = layers.selectAll(\"g.legendsymbols\").data([d]);\n symbol.enter().append(\"g\").classed(\"legendsymbols\", true);\n symbol.selectAll(\"g.legendpoints\").data([d]).enter().append(\"g\").classed(\"legendpoints\", true);\n }).each(styleSpatial).each(styleWaterfalls).each(styleFunnels).each(styleBars).each(styleBoxes).each(styleFunnelareas).each(stylePies).each(styleLines).each(stylePoints).each(styleCandles).each(styleOHLC);\n function styleLines(d) {\n var styleGuide = getStyleGuide(d);\n var showFill = styleGuide.showFill;\n var showLine = styleGuide.showLine;\n var showGradientLine = styleGuide.showGradientLine;\n var showGradientFill = styleGuide.showGradientFill;\n var anyFill = styleGuide.anyFill;\n var anyLine = styleGuide.anyLine;\n var d0 = d[0];\n var trace = d0.trace;\n var dMod, tMod;\n var cOpts = extractOpts(trace);\n var colorscale = cOpts.colorscale;\n var reversescale = cOpts.reversescale;\n var fillStyle = function(s2) {\n if (s2.size()) {\n if (showFill) {\n Drawing.fillGroupStyle(s2, gd, true);\n } else {\n var gradientID = \"legendfill-\" + trace.uid;\n Drawing.gradient(\n s2,\n gd,\n gradientID,\n getGradientDirection(reversescale),\n colorscale,\n \"fill\"\n );\n }\n }\n };\n var lineGradient = function(s2) {\n if (s2.size()) {\n var gradientID = \"legendline-\" + trace.uid;\n Drawing.lineGroupStyle(s2);\n Drawing.gradient(\n s2,\n gd,\n gradientID,\n getGradientDirection(reversescale),\n colorscale,\n \"stroke\"\n );\n }\n };\n var pathStart = subTypes.hasMarkers(trace) || !anyFill ? \"M5,0\" : (\n // with a line leave it slightly below center, to leave room for the\n // line thickness and because the line is usually more prominent\n anyLine ? \"M5,-2\" : \"M5,-3\"\n );\n var this3 = d3.select(this);\n var fill = this3.select(\".legendfill\").selectAll(\"path\").data(showFill || showGradientFill ? [d] : []);\n fill.enter().append(\"path\").classed(\"js-fill\", true);\n fill.exit().remove();\n fill.attr(\"d\", pathStart + \"h\" + itemWidth + \"v6h-\" + itemWidth + \"z\").call(fillStyle);\n if (showLine || showGradientLine) {\n var lw = boundLineWidth(void 0, trace.line, MAX_LINE_WIDTH, CST_LINE_WIDTH);\n tMod = Lib.minExtend(trace, { line: { width: lw } });\n dMod = [Lib.minExtend(d0, { trace: tMod })];\n }\n var line = this3.select(\".legendlines\").selectAll(\"path\").data(showLine || showGradientLine ? [dMod] : []);\n line.enter().append(\"path\").classed(\"js-line\", true);\n line.exit().remove();\n line.attr(\"d\", pathStart + (showGradientLine ? \"l\" + itemWidth + \",0.0001\" : \"h\" + itemWidth)).call(showLine ? Drawing.lineGroupStyle : lineGradient);\n }\n function stylePoints(d) {\n var styleGuide = getStyleGuide(d);\n var anyFill = styleGuide.anyFill;\n var anyLine = styleGuide.anyLine;\n var showLine = styleGuide.showLine;\n var showMarker = styleGuide.showMarker;\n var d0 = d[0];\n var trace = d0.trace;\n var showText = !showMarker && !anyLine && !anyFill && subTypes.hasText(trace);\n var dMod, tMod;\n function boundVal(attrIn, arrayToValFn, bounds, cst) {\n var valIn = Lib.nestedProperty(trace, attrIn).get();\n var valToBound = Lib.isArrayOrTypedArray(valIn) && arrayToValFn ? arrayToValFn(valIn) : valIn;\n if (constantItemSizing && valToBound && cst !== void 0) {\n valToBound = cst;\n }\n if (bounds) {\n if (valToBound < bounds[0]) return bounds[0];\n else if (valToBound > bounds[1]) return bounds[1];\n }\n return valToBound;\n }\n function pickFirst(array) {\n if (d0._distinct && d0.index && array[d0.index]) return array[d0.index];\n return array[0];\n }\n if (showMarker || showText || showLine) {\n var dEdit = {};\n var tEdit = {};\n if (showMarker) {\n dEdit.mc = boundVal(\"marker.color\", pickFirst);\n dEdit.mx = boundVal(\"marker.symbol\", pickFirst);\n dEdit.mo = boundVal(\"marker.opacity\", Lib.mean, [0.2, 1]);\n dEdit.mlc = boundVal(\"marker.line.color\", pickFirst);\n dEdit.mlw = boundVal(\"marker.line.width\", Lib.mean, [0, 5], CST_MARKER_LINE_WIDTH);\n tEdit.marker = {\n sizeref: 1,\n sizemin: 1,\n sizemode: \"diameter\"\n };\n var ms = boundVal(\"marker.size\", Lib.mean, [2, 16], CST_MARKER_SIZE);\n dEdit.ms = ms;\n tEdit.marker.size = ms;\n }\n if (showLine) {\n tEdit.line = {\n width: boundVal(\"line.width\", pickFirst, [0, 10], CST_LINE_WIDTH)\n };\n }\n if (showText) {\n dEdit.tx = \"Aa\";\n dEdit.tp = boundVal(\"textposition\", pickFirst);\n dEdit.ts = 10;\n dEdit.tc = boundVal(\"textfont.color\", pickFirst);\n dEdit.tf = boundVal(\"textfont.family\", pickFirst);\n dEdit.tw = boundVal(\"textfont.weight\", pickFirst);\n dEdit.ty = boundVal(\"textfont.style\", pickFirst);\n dEdit.tv = boundVal(\"textfont.variant\", pickFirst);\n dEdit.tC = boundVal(\"textfont.textcase\", pickFirst);\n dEdit.tE = boundVal(\"textfont.lineposition\", pickFirst);\n dEdit.tS = boundVal(\"textfont.shadow\", pickFirst);\n }\n dMod = [Lib.minExtend(d0, dEdit)];\n tMod = Lib.minExtend(trace, tEdit);\n tMod.selectedpoints = null;\n tMod.texttemplate = null;\n }\n var ptgroup = d3.select(this).select(\"g.legendpoints\");\n var pts = ptgroup.selectAll(\"path.scatterpts\").data(showMarker ? dMod : []);\n pts.enter().insert(\"path\", \":first-child\").classed(\"scatterpts\", true).attr(\"transform\", centerTransform);\n pts.exit().remove();\n pts.call(Drawing.pointStyle, tMod, gd);\n if (showMarker) dMod[0].mrc = 3;\n var txt = ptgroup.selectAll(\"g.pointtext\").data(showText ? dMod : []);\n txt.enter().append(\"g\").classed(\"pointtext\", true).append(\"text\").attr(\"transform\", centerTransform);\n txt.exit().remove();\n txt.selectAll(\"text\").call(Drawing.textPointStyle, tMod, gd);\n }\n function styleWaterfalls(d) {\n var trace = d[0].trace;\n var isWaterfall = trace.type === \"waterfall\";\n if (d[0]._distinct && isWaterfall) {\n var cont = d[0].trace[d[0].dir].marker;\n d[0].mc = cont.color;\n d[0].mlw = cont.line.width;\n d[0].mlc = cont.line.color;\n return styleBarLike(d, this, \"waterfall\");\n }\n var ptsData = [];\n if (trace.visible && isWaterfall) {\n ptsData = d[0].hasTotals ? [[\"increasing\", \"M-6,-6V6H0Z\"], [\"totals\", \"M6,6H0L-6,-6H-0Z\"], [\"decreasing\", \"M6,6V-6H0Z\"]] : [[\"increasing\", \"M-6,-6V6H6Z\"], [\"decreasing\", \"M6,6V-6H-6Z\"]];\n }\n var pts = d3.select(this).select(\"g.legendpoints\").selectAll(\"path.legendwaterfall\").data(ptsData);\n pts.enter().append(\"path\").classed(\"legendwaterfall\", true).attr(\"transform\", centerTransform).style(\"stroke-miterlimit\", 1);\n pts.exit().remove();\n pts.each(function(dd) {\n var pt = d3.select(this);\n var cont2 = trace[dd[0]].marker;\n var lw = boundLineWidth(void 0, cont2.line, MAX_MARKER_LINE_WIDTH, CST_MARKER_LINE_WIDTH);\n pt.attr(\"d\", dd[1]).style(\"stroke-width\", lw + \"px\").call(Color2.fill, cont2.color);\n if (lw) {\n pt.call(Color2.stroke, cont2.line.color);\n }\n });\n }\n function styleBars(d) {\n styleBarLike(d, this);\n }\n function styleFunnels(d) {\n styleBarLike(d, this, \"funnel\");\n }\n function styleBarLike(d, lThis, desiredType) {\n var trace = d[0].trace;\n var marker = trace.marker || {};\n var markerLine = marker.line || {};\n var pathStr = marker.cornerradius ? \"M6,3a3,3,0,0,1-3,3H-3a3,3,0,0,1-3-3V-3a3,3,0,0,1,3-3H3a3,3,0,0,1,3,3Z\" : (\n // Square with rounded corners\n \"M6,6H-6V-6H6Z\"\n );\n var isVisible = !desiredType ? Registry.traceIs(trace, \"bar\") : trace.visible && trace.type === desiredType;\n var barpath = d3.select(lThis).select(\"g.legendpoints\").selectAll(\"path.legend\" + desiredType).data(isVisible ? [d] : []);\n barpath.enter().append(\"path\").classed(\"legend\" + desiredType, true).attr(\"d\", pathStr).attr(\"transform\", centerTransform);\n barpath.exit().remove();\n barpath.each(function(d2) {\n var p = d3.select(this);\n var d0 = d2[0];\n var w = boundLineWidth(d0.mlw, marker.line, MAX_MARKER_LINE_WIDTH, CST_MARKER_LINE_WIDTH);\n p.style(\"stroke-width\", w + \"px\");\n var mcc = d0.mcc;\n if (!legend._inHover && \"mc\" in d0) {\n var cOpts = extractOpts(marker);\n var mid = cOpts.mid;\n if (mid === void 0) mid = (cOpts.max + cOpts.min) / 2;\n mcc = Drawing.tryColorscale(marker, \"\")(mid);\n }\n var fillColor = mcc || d0.mc || marker.color;\n var markerPattern = marker.pattern;\n var patternShape = markerPattern && Drawing.getPatternAttr(markerPattern.shape, 0, \"\");\n if (patternShape) {\n var patternBGColor = Drawing.getPatternAttr(markerPattern.bgcolor, 0, null);\n var patternFGColor = Drawing.getPatternAttr(markerPattern.fgcolor, 0, null);\n var patternFGOpacity = markerPattern.fgopacity;\n var patternSize = dimAttr(markerPattern.size, 8, 10);\n var patternSolidity = dimAttr(markerPattern.solidity, 0.5, 1);\n var patternID = \"legend-\" + trace.uid;\n p.call(\n Drawing.pattern,\n \"legend\",\n gd,\n patternID,\n patternShape,\n patternSize,\n patternSolidity,\n mcc,\n markerPattern.fillmode,\n patternBGColor,\n patternFGColor,\n patternFGOpacity\n );\n } else {\n p.call(Color2.fill, fillColor);\n }\n if (w) Color2.stroke(p, d0.mlc || markerLine.color);\n });\n }\n function styleBoxes(d) {\n var trace = d[0].trace;\n var pts = d3.select(this).select(\"g.legendpoints\").selectAll(\"path.legendbox\").data(trace.visible && Registry.traceIs(trace, \"box-violin\") ? [d] : []);\n pts.enter().append(\"path\").classed(\"legendbox\", true).attr(\"d\", \"M6,6H-6V-6H6Z\").attr(\"transform\", centerTransform);\n pts.exit().remove();\n pts.each(function() {\n var p = d3.select(this);\n if ((trace.boxpoints === \"all\" || trace.points === \"all\") && Color2.opacity(trace.fillcolor) === 0 && Color2.opacity((trace.line || {}).color) === 0) {\n var tMod = Lib.minExtend(trace, {\n marker: {\n size: constantItemSizing ? CST_MARKER_SIZE : Lib.constrain(trace.marker.size, 2, 16),\n sizeref: 1,\n sizemin: 1,\n sizemode: \"diameter\"\n }\n });\n pts.call(Drawing.pointStyle, tMod, gd);\n } else {\n var w = boundLineWidth(void 0, trace.line, MAX_MARKER_LINE_WIDTH, CST_MARKER_LINE_WIDTH);\n p.style(\"stroke-width\", w + \"px\").call(Color2.fill, trace.fillcolor);\n if (w) Color2.stroke(p, trace.line.color);\n }\n });\n }\n function styleCandles(d) {\n var trace = d[0].trace;\n var pts = d3.select(this).select(\"g.legendpoints\").selectAll(\"path.legendcandle\").data(trace.visible && trace.type === \"candlestick\" ? [d, d] : []);\n pts.enter().append(\"path\").classed(\"legendcandle\", true).attr(\"d\", function(_, i) {\n if (i) return \"M-15,0H-8M-8,6V-6H8Z\";\n return \"M15,0H8M8,-6V6H-8Z\";\n }).attr(\"transform\", centerTransform).style(\"stroke-miterlimit\", 1);\n pts.exit().remove();\n pts.each(function(_, i) {\n var p = d3.select(this);\n var cont = trace[i ? \"increasing\" : \"decreasing\"];\n var w = boundLineWidth(void 0, cont.line, MAX_MARKER_LINE_WIDTH, CST_MARKER_LINE_WIDTH);\n p.style(\"stroke-width\", w + \"px\").call(Color2.fill, cont.fillcolor);\n if (w) Color2.stroke(p, cont.line.color);\n });\n }\n function styleOHLC(d) {\n var trace = d[0].trace;\n var pts = d3.select(this).select(\"g.legendpoints\").selectAll(\"path.legendohlc\").data(trace.visible && trace.type === \"ohlc\" ? [d, d] : []);\n pts.enter().append(\"path\").classed(\"legendohlc\", true).attr(\"d\", function(_, i) {\n if (i) return \"M-15,0H0M-8,-6V0\";\n return \"M15,0H0M8,6V0\";\n }).attr(\"transform\", centerTransform).style(\"stroke-miterlimit\", 1);\n pts.exit().remove();\n pts.each(function(_, i) {\n var p = d3.select(this);\n var cont = trace[i ? \"increasing\" : \"decreasing\"];\n var w = boundLineWidth(void 0, cont.line, MAX_MARKER_LINE_WIDTH, CST_MARKER_LINE_WIDTH);\n p.style(\"fill\", \"none\").call(Drawing.dashLine, cont.line.dash, w);\n if (w) Color2.stroke(p, cont.line.color);\n });\n }\n function stylePies(d) {\n stylePieLike(d, this, \"pie\");\n }\n function styleFunnelareas(d) {\n stylePieLike(d, this, \"funnelarea\");\n }\n function stylePieLike(d, lThis, desiredType) {\n var d0 = d[0];\n var trace = d0.trace;\n var isVisible = !desiredType ? Registry.traceIs(trace, desiredType) : trace.visible && trace.type === desiredType;\n var pts = d3.select(lThis).select(\"g.legendpoints\").selectAll(\"path.legend\" + desiredType).data(isVisible ? [d] : []);\n pts.enter().append(\"path\").classed(\"legend\" + desiredType, true).attr(\"d\", \"M6,6H-6V-6H6Z\").attr(\"transform\", centerTransform);\n pts.exit().remove();\n if (pts.size()) {\n var cont = trace.marker || {};\n var lw = boundLineWidth(pieCastOption(cont.line.width, d0.pts), cont.line, MAX_MARKER_LINE_WIDTH, CST_MARKER_LINE_WIDTH);\n var opt = \"pieLike\";\n var tMod = Lib.minExtend(trace, { marker: { line: { width: lw } } }, opt);\n var d0Mod = Lib.minExtend(d0, { trace: tMod }, opt);\n stylePie(pts, d0Mod, tMod, gd);\n }\n }\n function styleSpatial(d) {\n var trace = d[0].trace;\n var useGradient;\n var ptsData = [];\n if (trace.visible) {\n switch (trace.type) {\n case \"histogram2d\":\n case \"heatmap\":\n ptsData = [\n [\"M-15,-2V4H15V-2Z\"]\n // similar to contour\n ];\n useGradient = true;\n break;\n case \"choropleth\":\n case \"choroplethmapbox\":\n case \"choroplethmap\":\n ptsData = [\n [\"M-6,-6V6H6V-6Z\"]\n ];\n useGradient = true;\n break;\n case \"densitymapbox\":\n case \"densitymap\":\n ptsData = [\n [\"M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0\"]\n ];\n useGradient = \"radial\";\n break;\n case \"cone\":\n ptsData = [\n [\"M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z\"],\n [\"M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z\"],\n [\"M-6,-2 A2,2 0 0,0 -6,2 L6,0Z\"]\n ];\n useGradient = false;\n break;\n case \"streamtube\":\n ptsData = [\n [\"M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z\"],\n [\"M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z\"],\n [\"M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z\"]\n ];\n useGradient = false;\n break;\n case \"surface\":\n ptsData = [\n [\"M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z\"],\n [\"M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z\"]\n ];\n useGradient = true;\n break;\n case \"mesh3d\":\n ptsData = [\n [\"M-6,6H0L-6,-6Z\"],\n [\"M6,6H0L6,-6Z\"],\n [\"M-6,-6H6L0,6Z\"]\n ];\n useGradient = false;\n break;\n case \"volume\":\n ptsData = [\n [\"M-6,6H0L-6,-6Z\"],\n [\"M6,6H0L6,-6Z\"],\n [\"M-6,-6H6L0,6Z\"]\n ];\n useGradient = true;\n break;\n case \"isosurface\":\n ptsData = [\n [\"M-6,6H0L-6,-6Z\"],\n [\"M6,6H0L6,-6Z\"],\n [\"M-6,-6 A12,24 0 0,0 6,-6 L0,6Z\"]\n ];\n useGradient = false;\n break;\n }\n }\n var pts = d3.select(this).select(\"g.legendpoints\").selectAll(\"path.legend3dandfriends\").data(ptsData);\n pts.enter().append(\"path\").classed(\"legend3dandfriends\", true).attr(\"transform\", centerTransform).style(\"stroke-miterlimit\", 1);\n pts.exit().remove();\n pts.each(function(dd, i) {\n var pt = d3.select(this);\n var cOpts = extractOpts(trace);\n var colorscale = cOpts.colorscale;\n var reversescale = cOpts.reversescale;\n var fillGradient = function(s2) {\n if (s2.size()) {\n var gradientID = \"legendfill-\" + trace.uid;\n Drawing.gradient(\n s2,\n gd,\n gradientID,\n getGradientDirection(reversescale, useGradient === \"radial\"),\n colorscale,\n \"fill\"\n );\n }\n };\n var fillColor;\n if (!colorscale) {\n var color2 = trace.vertexcolor || trace.facecolor || trace.color;\n fillColor = Lib.isArrayOrTypedArray(color2) ? color2[i] || color2[0] : color2;\n } else {\n if (!useGradient) {\n var len = colorscale.length;\n fillColor = i === 0 ? colorscale[reversescale ? len - 1 : 0][1] : (\n // minimum\n i === 1 ? colorscale[reversescale ? 0 : len - 1][1] : (\n // maximum\n colorscale[Math.floor((len - 1) / 2)][1]\n )\n );\n }\n }\n pt.attr(\"d\", dd[0]);\n if (fillColor) {\n pt.call(Color2.fill, fillColor);\n } else {\n pt.call(fillGradient);\n }\n });\n }\n };\n function getGradientDirection(reversescale, isRadial) {\n var str = isRadial ? \"radial\" : \"horizontal\";\n return str + (reversescale ? \"\" : \"reversed\");\n }\n function getStyleGuide(d) {\n var trace = d[0].trace;\n var contours = trace.contours;\n var showLine = subTypes.hasLines(trace);\n var showMarker = subTypes.hasMarkers(trace);\n var showFill = trace.visible && trace.fill && trace.fill !== \"none\";\n var showGradientLine = false;\n var showGradientFill = false;\n if (contours) {\n var coloring = contours.coloring;\n if (coloring === \"lines\") {\n showGradientLine = true;\n } else {\n showLine = coloring === \"none\" || coloring === \"heatmap\" || contours.showlines;\n }\n if (contours.type === \"constraint\") {\n showFill = contours._operation !== \"=\";\n } else if (coloring === \"fill\" || coloring === \"heatmap\") {\n showGradientFill = true;\n }\n }\n return {\n showMarker,\n showLine,\n showFill,\n showGradientLine,\n showGradientFill,\n anyLine: showLine || showGradientLine,\n anyFill: showFill || showGradientFill\n };\n }\n function dimAttr(v, dflt, max) {\n if (v && Lib.isArrayOrTypedArray(v)) return dflt;\n if (v > max) return max;\n return v;\n }\n }\n });\n\n // src/components/legend/draw.js\n var require_draw = __commonJS({\n \"src/components/legend/draw.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var Plots = require_plots();\n var Registry = require_registry();\n var Events = require_events2();\n var dragElement = require_dragelement();\n var Drawing = require_drawing();\n var Color2 = require_color();\n var svgTextUtils = require_svg_text_utils();\n var handleClick = require_handle_click();\n var constants = require_constants3();\n var alignmentConstants = require_alignment();\n var LINE_SPACING = alignmentConstants.LINE_SPACING;\n var FROM_TL = alignmentConstants.FROM_TL;\n var FROM_BR = alignmentConstants.FROM_BR;\n var getLegendData = require_get_legend_data();\n var style = require_style();\n var helpers = require_helpers3();\n var MAIN_TITLE = 1;\n var LEGEND_PATTERN = /^legend[0-9]*$/;\n module.exports = function draw(gd, opts) {\n if (opts) {\n drawOne(gd, opts);\n } else {\n var fullLayout = gd._fullLayout;\n var newLegends = fullLayout._legends;\n var oldLegends = fullLayout._infolayer.selectAll('[class^=\"legend\"]');\n oldLegends.each(function() {\n var el = d3.select(this);\n var classes = el.attr(\"class\");\n var cls = classes.split(\" \")[0];\n if (cls.match(LEGEND_PATTERN) && newLegends.indexOf(cls) === -1) {\n el.remove();\n }\n });\n for (var i = 0; i < newLegends.length; i++) {\n var legendId = newLegends[i];\n var legendObj = gd._fullLayout[legendId];\n drawOne(gd, legendObj);\n }\n }\n };\n function horizontalAlignTitle(titleEl, legendObj, bw) {\n if (legendObj.title.side !== \"top center\" && legendObj.title.side !== \"top right\") return;\n var font = legendObj.title.font;\n var lineHeight = font.size * LINE_SPACING;\n var titleOffset = 0;\n var textNode = titleEl.node();\n var width = Drawing.bBox(textNode).width;\n if (legendObj.title.side === \"top center\") {\n titleOffset = 0.5 * (legendObj._width - 2 * bw - 2 * constants.titlePad - width);\n } else if (legendObj.title.side === \"top right\") {\n titleOffset = legendObj._width - 2 * bw - 2 * constants.titlePad - width;\n }\n svgTextUtils.positionText(\n titleEl,\n bw + constants.titlePad + titleOffset,\n bw + lineHeight\n );\n }\n function drawOne(gd, opts) {\n var legendObj = opts || {};\n var fullLayout = gd._fullLayout;\n var legendId = getId(legendObj);\n var clipId, layer;\n var inHover = legendObj._inHover;\n if (inHover) {\n layer = legendObj.layer;\n clipId = \"hover\";\n } else {\n layer = fullLayout._infolayer;\n clipId = legendId;\n }\n if (!layer) return;\n clipId += fullLayout._uid;\n if (!gd._legendMouseDownTime) gd._legendMouseDownTime = 0;\n var legendData;\n if (!inHover) {\n var calcdata = (gd.calcdata || []).slice();\n var shapes = fullLayout.shapes;\n for (var i = 0; i < shapes.length; i++) {\n var shape = shapes[i];\n if (!shape.showlegend) continue;\n var shapeLegend = {\n _isShape: true,\n _fullInput: shape,\n index: shape._index,\n name: shape.name || shape.label.text || \"shape \" + shape._index,\n legend: shape.legend,\n legendgroup: shape.legendgroup,\n legendgrouptitle: shape.legendgrouptitle,\n legendrank: shape.legendrank,\n legendwidth: shape.legendwidth,\n showlegend: shape.showlegend,\n visible: shape.visible,\n opacity: shape.opacity,\n mode: shape.type === \"line\" ? \"lines\" : \"markers\",\n line: shape.line,\n marker: {\n line: shape.line,\n color: shape.fillcolor,\n size: 12,\n symbol: shape.type === \"rect\" ? \"square\" : shape.type === \"circle\" ? \"circle\" : (\n // case of path\n \"hexagon2\"\n )\n }\n };\n calcdata.push([{ trace: shapeLegend }]);\n }\n legendData = fullLayout.showlegend && getLegendData(calcdata, legendObj, fullLayout._legends.length > 1);\n } else {\n if (!legendObj.entries) return;\n legendData = getLegendData(legendObj.entries, legendObj);\n }\n var hiddenSlices = fullLayout.hiddenlabels || [];\n if (!inHover && (!fullLayout.showlegend || !legendData.length)) {\n layer.selectAll(\".\" + legendId).remove();\n fullLayout._topdefs.select(\"#\" + clipId).remove();\n return Plots.autoMargin(gd, legendId);\n }\n var legend = Lib.ensureSingle(layer, \"g\", legendId, function(s) {\n if (!inHover) s.attr(\"pointer-events\", \"all\");\n });\n var clipPath = Lib.ensureSingleById(fullLayout._topdefs, \"clipPath\", clipId, function(s) {\n s.append(\"rect\");\n });\n var bg = Lib.ensureSingle(legend, \"rect\", \"bg\", function(s) {\n s.attr(\"shape-rendering\", \"crispEdges\");\n });\n bg.call(Color2.stroke, legendObj.bordercolor).call(Color2.fill, legendObj.bgcolor).style(\"stroke-width\", legendObj.borderwidth + \"px\");\n var scrollBox = Lib.ensureSingle(legend, \"g\", \"scrollbox\");\n var title = legendObj.title;\n legendObj._titleWidth = 0;\n legendObj._titleHeight = 0;\n var titleEl;\n if (title.text) {\n titleEl = Lib.ensureSingle(scrollBox, \"text\", legendId + \"titletext\");\n titleEl.attr(\"text-anchor\", \"start\").call(Drawing.font, title.font).text(title.text);\n textLayout(titleEl, scrollBox, gd, legendObj, MAIN_TITLE);\n } else {\n scrollBox.selectAll(\".\" + legendId + \"titletext\").remove();\n }\n var scrollBar = Lib.ensureSingle(legend, \"rect\", \"scrollbar\", function(s) {\n s.attr(constants.scrollBarEnterAttrs).call(Color2.fill, constants.scrollBarColor);\n });\n var groups = scrollBox.selectAll(\"g.groups\").data(legendData);\n groups.enter().append(\"g\").attr(\"class\", \"groups\");\n groups.exit().remove();\n var traces = groups.selectAll(\"g.traces\").data(Lib.identity);\n traces.enter().append(\"g\").attr(\"class\", \"traces\");\n traces.exit().remove();\n traces.style(\"opacity\", function(d) {\n var trace = d[0].trace;\n if (Registry.traceIs(trace, \"pie-like\")) {\n return hiddenSlices.indexOf(d[0].label) !== -1 ? 0.5 : 1;\n } else {\n return trace.visible === \"legendonly\" ? 0.5 : 1;\n }\n }).each(function() {\n d3.select(this).call(drawTexts, gd, legendObj);\n }).call(style, gd, legendObj).each(function() {\n if (!inHover) d3.select(this).call(setupTraceToggle, gd, legendId);\n });\n Lib.syncOrAsync([\n Plots.previousPromises,\n function() {\n return computeLegendDimensions(gd, groups, traces, legendObj);\n },\n function() {\n var gs = fullLayout._size;\n var bw = legendObj.borderwidth;\n var isPaperX = legendObj.xref === \"paper\";\n var isPaperY = legendObj.yref === \"paper\";\n if (title.text) {\n horizontalAlignTitle(titleEl, legendObj, bw);\n }\n if (!inHover) {\n var lx, ly;\n if (isPaperX) {\n lx = gs.l + gs.w * legendObj.x - FROM_TL[getXanchor(legendObj)] * legendObj._width;\n } else {\n lx = fullLayout.width * legendObj.x - FROM_TL[getXanchor(legendObj)] * legendObj._width;\n }\n if (isPaperY) {\n ly = gs.t + gs.h * (1 - legendObj.y) - FROM_TL[getYanchor(legendObj)] * legendObj._effHeight;\n } else {\n ly = fullLayout.height * (1 - legendObj.y) - FROM_TL[getYanchor(legendObj)] * legendObj._effHeight;\n }\n var expMargin = expandMargin(gd, legendId, lx, ly);\n if (expMargin) return;\n if (fullLayout.margin.autoexpand) {\n var lx0 = lx;\n var ly0 = ly;\n lx = isPaperX ? Lib.constrain(lx, 0, fullLayout.width - legendObj._width) : lx0;\n ly = isPaperY ? Lib.constrain(ly, 0, fullLayout.height - legendObj._effHeight) : ly0;\n if (lx !== lx0) {\n Lib.log(\"Constrain \" + legendId + \".x to make legend fit inside graph\");\n }\n if (ly !== ly0) {\n Lib.log(\"Constrain \" + legendId + \".y to make legend fit inside graph\");\n }\n }\n Drawing.setTranslate(legend, lx, ly);\n }\n scrollBar.on(\".drag\", null);\n legend.on(\"wheel\", null);\n if (inHover || legendObj._height <= legendObj._maxHeight || gd._context.staticPlot) {\n var height = legendObj._effHeight;\n if (inHover) height = legendObj._height;\n bg.attr({\n width: legendObj._width - bw,\n height: height - bw,\n x: bw / 2,\n y: bw / 2\n });\n Drawing.setTranslate(scrollBox, 0, 0);\n clipPath.select(\"rect\").attr({\n width: legendObj._width - 2 * bw,\n height: height - 2 * bw,\n x: bw,\n y: bw\n });\n Drawing.setClipUrl(scrollBox, clipId, gd);\n Drawing.setRect(scrollBar, 0, 0, 0, 0);\n delete legendObj._scrollY;\n } else {\n var scrollBarHeight = Math.max(\n constants.scrollBarMinHeight,\n legendObj._effHeight * legendObj._effHeight / legendObj._height\n );\n var scrollBarYMax = legendObj._effHeight - scrollBarHeight - 2 * constants.scrollBarMargin;\n var scrollBoxYMax = legendObj._height - legendObj._effHeight;\n var scrollRatio = scrollBarYMax / scrollBoxYMax;\n var scrollBoxY = Math.min(legendObj._scrollY || 0, scrollBoxYMax);\n bg.attr({\n width: legendObj._width - 2 * bw + constants.scrollBarWidth + constants.scrollBarMargin,\n height: legendObj._effHeight - bw,\n x: bw / 2,\n y: bw / 2\n });\n clipPath.select(\"rect\").attr({\n width: legendObj._width - 2 * bw + constants.scrollBarWidth + constants.scrollBarMargin,\n height: legendObj._effHeight - 2 * bw,\n x: bw,\n y: bw + scrollBoxY\n });\n Drawing.setClipUrl(scrollBox, clipId, gd);\n scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio);\n legend.on(\"wheel\", function() {\n scrollBoxY = Lib.constrain(\n legendObj._scrollY + d3.event.deltaY / scrollBarYMax * scrollBoxYMax,\n 0,\n scrollBoxYMax\n );\n scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio);\n if (scrollBoxY !== 0 && scrollBoxY !== scrollBoxYMax) {\n d3.event.preventDefault();\n }\n });\n var eventY0, eventY1, scrollBoxY0;\n var getScrollBarDragY = function(scrollBoxY02, eventY02, eventY12) {\n var y = (eventY12 - eventY02) / scrollRatio + scrollBoxY02;\n return Lib.constrain(y, 0, scrollBoxYMax);\n };\n var getNaturalDragY = function(scrollBoxY02, eventY02, eventY12) {\n var y = (eventY02 - eventY12) / scrollRatio + scrollBoxY02;\n return Lib.constrain(y, 0, scrollBoxYMax);\n };\n var scrollBarDrag = d3.behavior.drag().on(\"dragstart\", function() {\n var e = d3.event.sourceEvent;\n if (e.type === \"touchstart\") {\n eventY0 = e.changedTouches[0].clientY;\n } else {\n eventY0 = e.clientY;\n }\n scrollBoxY0 = scrollBoxY;\n }).on(\"drag\", function() {\n var e = d3.event.sourceEvent;\n if (e.buttons === 2 || e.ctrlKey) return;\n if (e.type === \"touchmove\") {\n eventY1 = e.changedTouches[0].clientY;\n } else {\n eventY1 = e.clientY;\n }\n scrollBoxY = getScrollBarDragY(scrollBoxY0, eventY0, eventY1);\n scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio);\n });\n scrollBar.call(scrollBarDrag);\n var scrollBoxTouchDrag = d3.behavior.drag().on(\"dragstart\", function() {\n var e = d3.event.sourceEvent;\n if (e.type === \"touchstart\") {\n eventY0 = e.changedTouches[0].clientY;\n scrollBoxY0 = scrollBoxY;\n }\n }).on(\"drag\", function() {\n var e = d3.event.sourceEvent;\n if (e.type === \"touchmove\") {\n eventY1 = e.changedTouches[0].clientY;\n scrollBoxY = getNaturalDragY(scrollBoxY0, eventY0, eventY1);\n scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio);\n }\n });\n scrollBox.call(scrollBoxTouchDrag);\n }\n function scrollHandler(scrollBoxY2, scrollBarHeight2, scrollRatio2) {\n legendObj._scrollY = gd._fullLayout[legendId]._scrollY = scrollBoxY2;\n Drawing.setTranslate(scrollBox, 0, -scrollBoxY2);\n Drawing.setRect(\n scrollBar,\n legendObj._width,\n constants.scrollBarMargin + scrollBoxY2 * scrollRatio2,\n constants.scrollBarWidth,\n scrollBarHeight2\n );\n clipPath.select(\"rect\").attr(\"y\", bw + scrollBoxY2);\n }\n if (gd._context.edits.legendPosition) {\n var xf, yf, x0, y0;\n legend.classed(\"cursor-move\", true);\n dragElement.init({\n element: legend.node(),\n gd,\n prepFn: function(e) {\n if (e.target === scrollBar.node()) {\n return;\n }\n var transform = Drawing.getTranslate(legend);\n x0 = transform.x;\n y0 = transform.y;\n },\n moveFn: function(dx, dy) {\n if (x0 !== void 0 && y0 !== void 0) {\n var newX = x0 + dx;\n var newY = y0 + dy;\n Drawing.setTranslate(legend, newX, newY);\n xf = dragElement.align(newX, legendObj._width, gs.l, gs.l + gs.w, legendObj.xanchor);\n yf = dragElement.align(newY + legendObj._height, -legendObj._height, gs.t + gs.h, gs.t, legendObj.yanchor);\n }\n },\n doneFn: function() {\n if (xf !== void 0 && yf !== void 0) {\n var obj = {};\n obj[legendId + \".x\"] = xf;\n obj[legendId + \".y\"] = yf;\n Registry.call(\"_guiRelayout\", gd, obj);\n }\n },\n clickFn: function(numClicks, e) {\n var clickedTrace = layer.selectAll(\"g.traces\").filter(function() {\n var bbox = this.getBoundingClientRect();\n return e.clientX >= bbox.left && e.clientX <= bbox.right && e.clientY >= bbox.top && e.clientY <= bbox.bottom;\n });\n if (clickedTrace.size() > 0) {\n clickOrDoubleClick(gd, legend, clickedTrace, numClicks, e);\n }\n }\n });\n }\n }\n ], gd);\n }\n function getTraceWidth(d, legendObj, textGap) {\n var legendItem = d[0];\n var legendWidth = legendItem.width;\n var mode = legendObj.entrywidthmode;\n var traceLegendWidth = legendItem.trace.legendwidth || legendObj.entrywidth;\n if (mode === \"fraction\") return legendObj._maxWidth * traceLegendWidth;\n return textGap + (traceLegendWidth || legendWidth);\n }\n function clickOrDoubleClick(gd, legend, legendItem, numClicks, evt) {\n var trace = legendItem.data()[0][0].trace;\n var evtData = {\n event: evt,\n node: legendItem.node(),\n curveNumber: trace.index,\n expandedIndex: trace.index,\n data: gd.data,\n layout: gd.layout,\n frames: gd._transitionData._frames,\n config: gd._context,\n fullData: gd._fullData,\n fullLayout: gd._fullLayout\n };\n if (trace._group) {\n evtData.group = trace._group;\n }\n if (Registry.traceIs(trace, \"pie-like\")) {\n evtData.label = legendItem.datum()[0].label;\n }\n var clickVal = Events.triggerHandler(gd, \"plotly_legendclick\", evtData);\n if (numClicks === 1) {\n if (clickVal === false) return;\n legend._clickTimeout = setTimeout(function() {\n if (!gd._fullLayout) return;\n handleClick(legendItem, gd, numClicks);\n }, gd._context.doubleClickDelay);\n } else if (numClicks === 2) {\n if (legend._clickTimeout) clearTimeout(legend._clickTimeout);\n gd._legendMouseDownTime = 0;\n var dblClickVal = Events.triggerHandler(gd, \"plotly_legenddoubleclick\", evtData);\n if (dblClickVal !== false && clickVal !== false) handleClick(legendItem, gd, numClicks);\n }\n }\n function drawTexts(g, gd, legendObj) {\n var legendId = getId(legendObj);\n var legendItem = g.data()[0][0];\n var trace = legendItem.trace;\n var isPieLike = Registry.traceIs(trace, \"pie-like\");\n var isEditable = !legendObj._inHover && gd._context.edits.legendText && !isPieLike;\n var maxNameLength = legendObj._maxNameLength;\n var name2, font;\n if (legendItem.groupTitle) {\n name2 = legendItem.groupTitle.text;\n font = legendItem.groupTitle.font;\n } else {\n font = legendObj.font;\n if (!legendObj.entries) {\n name2 = isPieLike ? legendItem.label : trace.name;\n if (trace._meta) {\n name2 = Lib.templateString(name2, trace._meta);\n }\n } else {\n name2 = legendItem.text;\n }\n }\n var textEl = Lib.ensureSingle(g, \"text\", legendId + \"text\");\n textEl.attr(\"text-anchor\", \"start\").call(Drawing.font, font).text(isEditable ? ensureLength(name2, maxNameLength) : name2);\n var textGap = legendObj.indentation + legendObj.itemwidth + constants.itemGap * 2;\n svgTextUtils.positionText(textEl, textGap, 0);\n if (isEditable) {\n textEl.call(svgTextUtils.makeEditable, { gd, text: name2 }).call(textLayout, g, gd, legendObj).on(\"edit\", function(newName) {\n this.text(ensureLength(newName, maxNameLength)).call(textLayout, g, gd, legendObj);\n var fullInput = legendItem.trace._fullInput || {};\n var update = {};\n update.name = newName;\n if (fullInput._isShape) {\n return Registry.call(\"_guiRelayout\", gd, \"shapes[\" + trace.index + \"].name\", update.name);\n } else {\n return Registry.call(\"_guiRestyle\", gd, update, trace.index);\n }\n });\n } else {\n textLayout(textEl, g, gd, legendObj);\n }\n }\n function ensureLength(str, maxLength) {\n var targetLength = Math.max(4, maxLength);\n if (str && str.trim().length >= targetLength / 2) return str;\n str = str || \"\";\n for (var i = targetLength - str.length; i > 0; i--) str += \" \";\n return str;\n }\n function setupTraceToggle(g, gd, legendId) {\n var doubleClickDelay = gd._context.doubleClickDelay;\n var newMouseDownTime;\n var numClicks = 1;\n var traceToggle = Lib.ensureSingle(g, \"rect\", legendId + \"toggle\", function(s) {\n if (!gd._context.staticPlot) {\n s.style(\"cursor\", \"pointer\").attr(\"pointer-events\", \"all\");\n }\n s.call(Color2.fill, \"rgba(0,0,0,0)\");\n });\n if (gd._context.staticPlot) return;\n traceToggle.on(\"mousedown\", function() {\n newMouseDownTime = (/* @__PURE__ */ new Date()).getTime();\n if (newMouseDownTime - gd._legendMouseDownTime < doubleClickDelay) {\n numClicks += 1;\n } else {\n numClicks = 1;\n gd._legendMouseDownTime = newMouseDownTime;\n }\n });\n traceToggle.on(\"mouseup\", function() {\n if (gd._dragged || gd._editing) return;\n var legend = gd._fullLayout[legendId];\n if ((/* @__PURE__ */ new Date()).getTime() - gd._legendMouseDownTime > doubleClickDelay) {\n numClicks = Math.max(numClicks - 1, 1);\n }\n clickOrDoubleClick(gd, legend, g, numClicks, d3.event);\n });\n }\n function textLayout(s, g, gd, legendObj, aTitle) {\n if (legendObj._inHover) s.attr(\"data-notex\", true);\n svgTextUtils.convertToTspans(s, gd, function() {\n computeTextDimensions(g, gd, legendObj, aTitle);\n });\n }\n function computeTextDimensions(g, gd, legendObj, aTitle) {\n var legendItem = g.data()[0][0];\n if (!legendObj._inHover && legendItem && !legendItem.trace.showlegend) {\n g.remove();\n return;\n }\n var mathjaxGroup = g.select(\"g[class*=math-group]\");\n var mathjaxNode = mathjaxGroup.node();\n var legendId = getId(legendObj);\n if (!legendObj) {\n legendObj = gd._fullLayout[legendId];\n }\n var bw = legendObj.borderwidth;\n var font;\n if (aTitle === MAIN_TITLE) {\n font = legendObj.title.font;\n } else if (legendItem.groupTitle) {\n font = legendItem.groupTitle.font;\n } else {\n font = legendObj.font;\n }\n var lineHeight = font.size * LINE_SPACING;\n var height, width;\n if (mathjaxNode) {\n var mathjaxBB = Drawing.bBox(mathjaxNode);\n height = mathjaxBB.height;\n width = mathjaxBB.width;\n if (aTitle === MAIN_TITLE) {\n Drawing.setTranslate(mathjaxGroup, bw, bw + height * 0.75);\n } else {\n Drawing.setTranslate(mathjaxGroup, 0, height * 0.25);\n }\n } else {\n var cls = \".\" + legendId + (aTitle === MAIN_TITLE ? \"title\" : \"\") + \"text\";\n var textEl = g.select(cls);\n var textLines = svgTextUtils.lineCount(textEl);\n var textNode = textEl.node();\n height = lineHeight * textLines;\n width = textNode ? Drawing.bBox(textNode).width : 0;\n if (aTitle === MAIN_TITLE) {\n if (legendObj.title.side === \"left\") {\n width += constants.itemGap * 2;\n }\n svgTextUtils.positionText(\n textEl,\n bw + constants.titlePad,\n bw + lineHeight\n );\n } else {\n var x = constants.itemGap * 2 + legendObj.indentation + legendObj.itemwidth;\n if (legendItem.groupTitle) {\n x = constants.itemGap;\n width -= legendObj.indentation + legendObj.itemwidth;\n }\n svgTextUtils.positionText(\n textEl,\n x,\n -lineHeight * ((textLines - 1) / 2 - 0.3)\n );\n }\n }\n if (aTitle === MAIN_TITLE) {\n legendObj._titleWidth = width;\n legendObj._titleHeight = height;\n } else {\n legendItem.lineHeight = lineHeight;\n legendItem.height = Math.max(height, 16) + 3;\n legendItem.width = width;\n }\n }\n function getTitleSize(legendObj) {\n var w = 0;\n var h = 0;\n var side = legendObj.title.side;\n if (side) {\n if (side.indexOf(\"left\") !== -1) {\n w = legendObj._titleWidth;\n }\n if (side.indexOf(\"top\") !== -1) {\n h = legendObj._titleHeight;\n }\n }\n return [w, h];\n }\n function computeLegendDimensions(gd, groups, traces, legendObj) {\n var fullLayout = gd._fullLayout;\n var legendId = getId(legendObj);\n if (!legendObj) {\n legendObj = fullLayout[legendId];\n }\n var gs = fullLayout._size;\n var isVertical = helpers.isVertical(legendObj);\n var isGrouped = helpers.isGrouped(legendObj);\n var isFraction = legendObj.entrywidthmode === \"fraction\";\n var bw = legendObj.borderwidth;\n var bw2 = 2 * bw;\n var itemGap = constants.itemGap;\n var textGap = legendObj.indentation + legendObj.itemwidth + itemGap * 2;\n var endPad = 2 * (bw + itemGap);\n var yanchor = getYanchor(legendObj);\n var isBelowPlotArea = legendObj.y < 0 || legendObj.y === 0 && yanchor === \"top\";\n var isAbovePlotArea = legendObj.y > 1 || legendObj.y === 1 && yanchor === \"bottom\";\n var traceGroupGap = legendObj.tracegroupgap;\n var legendGroupWidths = {};\n legendObj._maxHeight = Math.max(\n isBelowPlotArea || isAbovePlotArea ? fullLayout.height / 2 : gs.h,\n 30\n );\n var toggleRectWidth = 0;\n legendObj._width = 0;\n legendObj._height = 0;\n var titleSize = getTitleSize(legendObj);\n if (isVertical) {\n traces.each(function(d) {\n var h = d[0].height;\n Drawing.setTranslate(\n this,\n bw + titleSize[0],\n bw + titleSize[1] + legendObj._height + h / 2 + itemGap\n );\n legendObj._height += h;\n legendObj._width = Math.max(legendObj._width, d[0].width);\n });\n toggleRectWidth = textGap + legendObj._width;\n legendObj._width += itemGap + textGap + bw2;\n legendObj._height += endPad;\n if (isGrouped) {\n groups.each(function(d, i) {\n Drawing.setTranslate(this, 0, i * legendObj.tracegroupgap);\n });\n legendObj._height += (legendObj._lgroupsLength - 1) * legendObj.tracegroupgap;\n }\n } else {\n var xanchor = getXanchor(legendObj);\n var isLeftOfPlotArea = legendObj.x < 0 || legendObj.x === 0 && xanchor === \"right\";\n var isRightOfPlotArea = legendObj.x > 1 || legendObj.x === 1 && xanchor === \"left\";\n var isBeyondPlotAreaY = isAbovePlotArea || isBelowPlotArea;\n var hw = fullLayout.width / 2;\n legendObj._maxWidth = Math.max(\n isLeftOfPlotArea ? isBeyondPlotAreaY && xanchor === \"left\" ? gs.l + gs.w : hw : isRightOfPlotArea ? isBeyondPlotAreaY && xanchor === \"right\" ? gs.r + gs.w : hw : gs.w,\n 2 * textGap\n );\n var maxItemWidth = 0;\n var combinedItemWidth = 0;\n traces.each(function(d) {\n var w = getTraceWidth(d, legendObj, textGap);\n maxItemWidth = Math.max(maxItemWidth, w);\n combinedItemWidth += w;\n });\n toggleRectWidth = null;\n var maxRowWidth = 0;\n if (isGrouped) {\n var maxGroupHeightInRow = 0;\n var groupOffsetX = 0;\n var groupOffsetY = 0;\n groups.each(function() {\n var maxWidthInGroup = 0;\n var offsetY2 = 0;\n d3.select(this).selectAll(\"g.traces\").each(function(d) {\n var w = getTraceWidth(d, legendObj, textGap);\n var h = d[0].height;\n Drawing.setTranslate(\n this,\n titleSize[0],\n titleSize[1] + bw + itemGap + h / 2 + offsetY2\n );\n offsetY2 += h;\n maxWidthInGroup = Math.max(maxWidthInGroup, w);\n legendGroupWidths[d[0].trace.legendgroup] = maxWidthInGroup;\n });\n var next = maxWidthInGroup + itemGap;\n if (\n // not on the first column already\n groupOffsetX > 0 && // goes beyound limit\n next + bw + groupOffsetX > legendObj._maxWidth\n ) {\n maxRowWidth = Math.max(maxRowWidth, groupOffsetX);\n groupOffsetX = 0;\n groupOffsetY += maxGroupHeightInRow + traceGroupGap;\n maxGroupHeightInRow = offsetY2;\n } else {\n maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY2);\n }\n Drawing.setTranslate(this, groupOffsetX, groupOffsetY);\n groupOffsetX += next;\n });\n legendObj._width = Math.max(maxRowWidth, groupOffsetX) + bw;\n legendObj._height = groupOffsetY + maxGroupHeightInRow + endPad;\n } else {\n var nTraces = traces.size();\n var oneRowLegend = combinedItemWidth + bw2 + (nTraces - 1) * itemGap < legendObj._maxWidth;\n var maxItemHeightInRow = 0;\n var offsetX = 0;\n var offsetY = 0;\n var rowWidth = 0;\n traces.each(function(d) {\n var h = d[0].height;\n var w = getTraceWidth(d, legendObj, textGap, isGrouped);\n var next = oneRowLegend ? w : maxItemWidth;\n if (!isFraction) {\n next += itemGap;\n }\n if (next + bw + offsetX - itemGap >= legendObj._maxWidth) {\n maxRowWidth = Math.max(maxRowWidth, rowWidth);\n offsetX = 0;\n offsetY += maxItemHeightInRow;\n legendObj._height += maxItemHeightInRow;\n maxItemHeightInRow = 0;\n }\n Drawing.setTranslate(\n this,\n titleSize[0] + bw + offsetX,\n titleSize[1] + bw + offsetY + h / 2 + itemGap\n );\n rowWidth = offsetX + w + itemGap;\n offsetX += next;\n maxItemHeightInRow = Math.max(maxItemHeightInRow, h);\n });\n if (oneRowLegend) {\n legendObj._width = offsetX + bw2;\n legendObj._height = maxItemHeightInRow + endPad;\n } else {\n legendObj._width = Math.max(maxRowWidth, rowWidth) + bw2;\n legendObj._height += maxItemHeightInRow + endPad;\n }\n }\n }\n legendObj._width = Math.ceil(\n Math.max(\n legendObj._width + titleSize[0],\n legendObj._titleWidth + 2 * (bw + constants.titlePad)\n )\n );\n legendObj._height = Math.ceil(\n Math.max(\n legendObj._height + titleSize[1],\n legendObj._titleHeight + 2 * (bw + constants.itemGap)\n )\n );\n legendObj._effHeight = Math.min(legendObj._height, legendObj._maxHeight);\n var edits = gd._context.edits;\n var isEditable = edits.legendText || edits.legendPosition;\n traces.each(function(d) {\n var traceToggle = d3.select(this).select(\".\" + legendId + \"toggle\");\n var h = d[0].height;\n var legendgroup = d[0].trace.legendgroup;\n var traceWidth = getTraceWidth(d, legendObj, textGap);\n if (isGrouped && legendgroup !== \"\") {\n traceWidth = legendGroupWidths[legendgroup];\n }\n var w = isEditable ? textGap : toggleRectWidth || traceWidth;\n if (!isVertical && !isFraction) {\n w += itemGap / 2;\n }\n Drawing.setRect(traceToggle, 0, -h / 2, w, h);\n });\n }\n function expandMargin(gd, legendId, lx, ly) {\n var fullLayout = gd._fullLayout;\n var legendObj = fullLayout[legendId];\n var xanchor = getXanchor(legendObj);\n var yanchor = getYanchor(legendObj);\n var isPaperX = legendObj.xref === \"paper\";\n var isPaperY = legendObj.yref === \"paper\";\n gd._fullLayout._reservedMargin[legendId] = {};\n var sideY = legendObj.y < 0.5 ? \"b\" : \"t\";\n var sideX = legendObj.x < 0.5 ? \"l\" : \"r\";\n var possibleReservedMargins = {\n r: fullLayout.width - lx,\n l: lx + legendObj._width,\n b: fullLayout.height - ly,\n t: ly + legendObj._effHeight\n };\n if (isPaperX && isPaperY) {\n return Plots.autoMargin(gd, legendId, {\n x: legendObj.x,\n y: legendObj.y,\n l: legendObj._width * FROM_TL[xanchor],\n r: legendObj._width * FROM_BR[xanchor],\n b: legendObj._effHeight * FROM_BR[yanchor],\n t: legendObj._effHeight * FROM_TL[yanchor]\n });\n } else if (isPaperX) {\n gd._fullLayout._reservedMargin[legendId][sideY] = possibleReservedMargins[sideY];\n } else if (isPaperY) {\n gd._fullLayout._reservedMargin[legendId][sideX] = possibleReservedMargins[sideX];\n } else {\n if (legendObj.orientation === \"v\") {\n gd._fullLayout._reservedMargin[legendId][sideX] = possibleReservedMargins[sideX];\n } else {\n gd._fullLayout._reservedMargin[legendId][sideY] = possibleReservedMargins[sideY];\n }\n }\n }\n function getXanchor(legendObj) {\n return Lib.isRightAnchor(legendObj) ? \"right\" : Lib.isCenterAnchor(legendObj) ? \"center\" : \"left\";\n }\n function getYanchor(legendObj) {\n return Lib.isBottomAnchor(legendObj) ? \"bottom\" : Lib.isMiddleAnchor(legendObj) ? \"middle\" : \"top\";\n }\n function getId(legendObj) {\n return legendObj._id || \"legend\";\n }\n }\n });\n\n // src/components/fx/hover.js\n var require_hover = __commonJS({\n \"src/components/fx/hover.js\"(exports) {\n \"use strict\";\n var d3 = require_d3();\n var isNumeric = require_fast_isnumeric();\n var tinycolor = require_tinycolor();\n var Lib = require_lib();\n var pushUnique = Lib.pushUnique;\n var strTranslate = Lib.strTranslate;\n var strRotate = Lib.strRotate;\n var Events = require_events2();\n var svgTextUtils = require_svg_text_utils();\n var overrideCursor = require_override_cursor();\n var Drawing = require_drawing();\n var Color2 = require_color();\n var dragElement = require_dragelement();\n var Axes = require_axes();\n var zindexSeparator = require_constants2().zindexSeparator;\n var Registry = require_registry();\n var helpers = require_helpers2();\n var constants = require_constants();\n var legendSupplyDefaults = require_defaults3();\n var legendDraw = require_draw();\n var YANGLE = constants.YANGLE;\n var YA_RADIANS = Math.PI * YANGLE / 180;\n var YFACTOR = 1 / Math.sin(YA_RADIANS);\n var YSHIFTX = Math.cos(YA_RADIANS);\n var YSHIFTY = Math.sin(YA_RADIANS);\n var HOVERARROWSIZE = constants.HOVERARROWSIZE;\n var HOVERTEXTPAD = constants.HOVERTEXTPAD;\n var multipleHoverPoints = {\n box: true,\n ohlc: true,\n violin: true,\n candlestick: true\n };\n var cartesianScatterPoints = {\n scatter: true,\n scattergl: true,\n splom: true\n };\n function distanceSort(a, b) {\n return a.distance - b.distance;\n }\n exports.hover = function hover(gd, evt, subplot, noHoverEvent) {\n gd = Lib.getGraphDiv(gd);\n var eventTarget = evt.target;\n Lib.throttle(\n gd._fullLayout._uid + constants.HOVERID,\n constants.HOVERMINTIME,\n function() {\n _hover(gd, evt, subplot, noHoverEvent, eventTarget);\n }\n );\n };\n exports.loneHover = function loneHover(hoverItems, opts) {\n var multiHover = true;\n if (!Array.isArray(hoverItems)) {\n multiHover = false;\n hoverItems = [hoverItems];\n }\n var gd = opts.gd;\n var gTop = getTopOffset(gd);\n var gLeft = getLeftOffset(gd);\n var pointsData = hoverItems.map(function(hoverItem) {\n var _x0 = hoverItem._x0 || hoverItem.x0 || hoverItem.x || 0;\n var _x1 = hoverItem._x1 || hoverItem.x1 || hoverItem.x || 0;\n var _y0 = hoverItem._y0 || hoverItem.y0 || hoverItem.y || 0;\n var _y1 = hoverItem._y1 || hoverItem.y1 || hoverItem.y || 0;\n var eventData = hoverItem.eventData;\n if (eventData) {\n var x0 = Math.min(_x0, _x1);\n var x1 = Math.max(_x0, _x1);\n var y0 = Math.min(_y0, _y1);\n var y1 = Math.max(_y0, _y1);\n var trace = hoverItem.trace;\n if (Registry.traceIs(trace, \"gl3d\")) {\n var container = gd._fullLayout[trace.scene]._scene.container;\n var dx = container.offsetLeft;\n var dy = container.offsetTop;\n x0 += dx;\n x1 += dx;\n y0 += dy;\n y1 += dy;\n }\n eventData.bbox = {\n x0: x0 + gLeft,\n x1: x1 + gLeft,\n y0: y0 + gTop,\n y1: y1 + gTop\n };\n if (opts.inOut_bbox) {\n opts.inOut_bbox.push(eventData.bbox);\n }\n } else {\n eventData = false;\n }\n return {\n color: hoverItem.color || Color2.defaultLine,\n x0: hoverItem.x0 || hoverItem.x || 0,\n x1: hoverItem.x1 || hoverItem.x || 0,\n y0: hoverItem.y0 || hoverItem.y || 0,\n y1: hoverItem.y1 || hoverItem.y || 0,\n xLabel: hoverItem.xLabel,\n yLabel: hoverItem.yLabel,\n zLabel: hoverItem.zLabel,\n text: hoverItem.text,\n name: hoverItem.name,\n idealAlign: hoverItem.idealAlign,\n // optional extra bits of styling\n borderColor: hoverItem.borderColor,\n fontFamily: hoverItem.fontFamily,\n fontSize: hoverItem.fontSize,\n fontColor: hoverItem.fontColor,\n fontWeight: hoverItem.fontWeight,\n fontStyle: hoverItem.fontStyle,\n fontVariant: hoverItem.fontVariant,\n nameLength: hoverItem.nameLength,\n textAlign: hoverItem.textAlign,\n // filler to make createHoverText happy\n trace: hoverItem.trace || {\n index: 0,\n hoverinfo: \"\"\n },\n xa: { _offset: 0 },\n ya: { _offset: 0 },\n index: 0,\n hovertemplate: hoverItem.hovertemplate || false,\n hovertemplateLabels: hoverItem.hovertemplateLabels || false,\n eventData\n };\n });\n var rotateLabels = false;\n var hoverText = createHoverText(pointsData, {\n gd,\n hovermode: \"closest\",\n rotateLabels,\n bgColor: opts.bgColor || Color2.background,\n container: d3.select(opts.container),\n outerContainer: opts.outerContainer || opts.container\n });\n var hoverLabel = hoverText.hoverLabels;\n var tooltipSpacing = 5;\n var lastBottomY = 0;\n var anchor = 0;\n hoverLabel.sort(function(a, b) {\n return a.y0 - b.y0;\n }).each(function(d, i) {\n var topY = d.y0 - d.by / 2;\n if (topY - tooltipSpacing < lastBottomY) {\n d.offset = lastBottomY - topY + tooltipSpacing;\n } else {\n d.offset = 0;\n }\n lastBottomY = topY + d.by + d.offset;\n if (i === opts.anchorIndex || 0) anchor = d.offset;\n }).each(function(d) {\n d.offset -= anchor;\n });\n var scaleX = gd._fullLayout._invScaleX;\n var scaleY = gd._fullLayout._invScaleY;\n alignHoverText(hoverLabel, rotateLabels, scaleX, scaleY);\n return multiHover ? hoverLabel : hoverLabel.node();\n };\n function _hover(gd, evt, subplot, noHoverEvent, eventTarget) {\n if (!subplot) subplot = \"xy\";\n if (typeof subplot === \"string\") {\n subplot = subplot.split(zindexSeparator)[0];\n }\n var subplots = Array.isArray(subplot) ? subplot : [subplot];\n var spId;\n var fullLayout = gd._fullLayout;\n var hoversubplots = fullLayout.hoversubplots;\n var plots = fullLayout._plots || [];\n var plotinfo = plots[subplot];\n var hasCartesian = fullLayout._has(\"cartesian\");\n var hovermode = evt.hovermode || fullLayout.hovermode;\n var hovermodeHasX = (hovermode || \"\").charAt(0) === \"x\";\n var hovermodeHasY = (hovermode || \"\").charAt(0) === \"y\";\n var firstXaxis;\n var firstYaxis;\n if (hasCartesian && (hovermodeHasX || hovermodeHasY) && hoversubplots === \"axis\") {\n var subplotsLength = subplots.length;\n for (var p = 0; p < subplotsLength; p++) {\n spId = subplots[p];\n if (plots[spId]) {\n firstXaxis = Axes.getFromId(gd, spId, \"x\");\n firstYaxis = Axes.getFromId(gd, spId, \"y\");\n var subplotsWith = (hovermodeHasX ? firstXaxis : firstYaxis)._subplotsWith;\n if (subplotsWith && subplotsWith.length) {\n for (var q = 0; q < subplotsWith.length; q++) {\n pushUnique(subplots, subplotsWith[q]);\n }\n }\n }\n }\n }\n if (plotinfo && hoversubplots !== \"single\") {\n var overlayedSubplots = plotinfo.overlays.map(function(pi) {\n return pi.id;\n });\n subplots = subplots.concat(overlayedSubplots);\n }\n var len = subplots.length;\n var xaArray = new Array(len);\n var yaArray = new Array(len);\n var supportsCompare = false;\n for (var i = 0; i < len; i++) {\n spId = subplots[i];\n if (plots[spId]) {\n supportsCompare = true;\n xaArray[i] = plots[spId].xaxis;\n yaArray[i] = plots[spId].yaxis;\n } else if (fullLayout[spId] && fullLayout[spId]._subplot) {\n var _subplot = fullLayout[spId]._subplot;\n xaArray[i] = _subplot.xaxis;\n yaArray[i] = _subplot.yaxis;\n } else {\n Lib.warn(\"Unrecognized subplot: \" + spId);\n return;\n }\n }\n if (hovermode && !supportsCompare) hovermode = \"closest\";\n if ([\"x\", \"y\", \"closest\", \"x unified\", \"y unified\"].indexOf(hovermode) === -1 || !gd.calcdata || gd.querySelector(\".zoombox\") || gd._dragging) {\n return dragElement.unhoverRaw(gd, evt);\n }\n var hoverdistance = fullLayout.hoverdistance;\n if (hoverdistance === -1) hoverdistance = Infinity;\n var spikedistance = fullLayout.spikedistance;\n if (spikedistance === -1) spikedistance = Infinity;\n var hoverData = [];\n var searchData = [];\n var xvalArray, yvalArray;\n var itemnum, curvenum, cd, trace, subplotId, subploti, _mode, xval, yval, pointData, closedataPreviousLength;\n var spikePoints = {\n hLinePoint: null,\n vLinePoint: null\n };\n var hasOneHorizontalTrace = false;\n if (Array.isArray(evt)) {\n hovermode = \"array\";\n for (itemnum = 0; itemnum < evt.length; itemnum++) {\n cd = gd.calcdata[evt[itemnum].curveNumber || 0];\n if (cd) {\n trace = cd[0].trace;\n if (cd[0].trace.hoverinfo !== \"skip\") {\n searchData.push(cd);\n if (trace.orientation === \"h\") {\n hasOneHorizontalTrace = true;\n }\n }\n }\n }\n } else {\n var zorderedCalcdata = gd.calcdata.slice();\n zorderedCalcdata.sort(function(a, b) {\n var aZorder = a[0].trace.zorder || 0;\n var bZorder = b[0].trace.zorder || 0;\n return aZorder - bZorder;\n });\n for (curvenum = 0; curvenum < zorderedCalcdata.length; curvenum++) {\n cd = zorderedCalcdata[curvenum];\n trace = cd[0].trace;\n if (trace.hoverinfo !== \"skip\" && helpers.isTraceInSubplots(trace, subplots)) {\n searchData.push(cd);\n if (trace.orientation === \"h\") {\n hasOneHorizontalTrace = true;\n }\n }\n }\n var hasUserCalledHover = !eventTarget;\n var xpx, ypx;\n if (hasUserCalledHover) {\n if (\"xpx\" in evt) xpx = evt.xpx;\n else xpx = xaArray[0]._length / 2;\n if (\"ypx\" in evt) ypx = evt.ypx;\n else ypx = yaArray[0]._length / 2;\n } else {\n if (Events.triggerHandler(gd, \"plotly_beforehover\", evt) === false) {\n return;\n }\n var dbb = eventTarget.getBoundingClientRect();\n xpx = evt.clientX - dbb.left;\n ypx = evt.clientY - dbb.top;\n fullLayout._calcInverseTransform(gd);\n var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(xpx, ypx);\n xpx = transformedCoords[0];\n ypx = transformedCoords[1];\n if (xpx < 0 || xpx > xaArray[0]._length || ypx < 0 || ypx > yaArray[0]._length) {\n return dragElement.unhoverRaw(gd, evt);\n }\n }\n evt.pointerX = xpx + xaArray[0]._offset;\n evt.pointerY = ypx + yaArray[0]._offset;\n if (\"xval\" in evt) xvalArray = helpers.flat(subplots, evt.xval);\n else xvalArray = helpers.p2c(xaArray, xpx);\n if (\"yval\" in evt) yvalArray = helpers.flat(subplots, evt.yval);\n else yvalArray = helpers.p2c(yaArray, ypx);\n if (!isNumeric(xvalArray[0]) || !isNumeric(yvalArray[0])) {\n Lib.warn(\"Fx.hover failed\", evt, gd);\n return dragElement.unhoverRaw(gd, evt);\n }\n }\n var distance = Infinity;\n function findHoverPoints(customXVal, customYVal) {\n for (curvenum = 0; curvenum < searchData.length; curvenum++) {\n cd = searchData[curvenum];\n if (!cd || !cd[0] || !cd[0].trace) continue;\n trace = cd[0].trace;\n if (trace.visible !== true || trace._length === 0) continue;\n if ([\"carpet\", \"contourcarpet\"].indexOf(trace._module.name) !== -1) continue;\n _mode = hovermode;\n if (helpers.isUnifiedHover(_mode)) {\n _mode = _mode.charAt(0);\n }\n if (trace.type === \"splom\") {\n subploti = 0;\n subplotId = subplots[subploti];\n } else {\n subplotId = helpers.getSubplot(trace);\n subploti = subplots.indexOf(subplotId);\n }\n pointData = {\n // trace properties\n cd,\n trace,\n xa: xaArray[subploti],\n ya: yaArray[subploti],\n // max distances for hover and spikes - for points that want to show but do not\n // want to override other points, set distance/spikeDistance equal to max*Distance\n // and it will not get filtered out but it will be guaranteed to have a greater\n // distance than any point that calculated a real distance.\n maxHoverDistance: hoverdistance,\n maxSpikeDistance: spikedistance,\n // point properties - override all of these\n index: false,\n // point index in trace - only used by plotly.js hoverdata consumers\n distance: Math.min(distance, hoverdistance),\n // pixel distance or pseudo-distance\n // distance/pseudo-distance for spikes. This distance should always be calculated\n // as if in \"closest\" mode, and should only be set if this point should\n // generate a spike.\n spikeDistance: Infinity,\n // in some cases the spikes have different positioning from the hover label\n // they don't need x0/x1, just one position\n xSpike: void 0,\n ySpike: void 0,\n // where and how to display the hover label\n color: Color2.defaultLine,\n // trace color\n name: trace.name,\n x0: void 0,\n x1: void 0,\n y0: void 0,\n y1: void 0,\n xLabelVal: void 0,\n yLabelVal: void 0,\n zLabelVal: void 0,\n text: void 0\n };\n if (fullLayout[subplotId]) {\n pointData.subplot = fullLayout[subplotId]._subplot;\n }\n if (fullLayout._splomScenes && fullLayout._splomScenes[trace.uid]) {\n pointData.scene = fullLayout._splomScenes[trace.uid];\n }\n if (_mode === \"array\") {\n var selection = evt[curvenum];\n if (\"pointNumber\" in selection) {\n pointData.index = selection.pointNumber;\n _mode = \"closest\";\n } else {\n _mode = \"\";\n if (\"xval\" in selection) {\n xval = selection.xval;\n _mode = \"x\";\n }\n if (\"yval\" in selection) {\n yval = selection.yval;\n _mode = _mode ? \"closest\" : \"y\";\n }\n }\n } else if (customXVal !== void 0 && customYVal !== void 0) {\n xval = customXVal;\n yval = customYVal;\n } else {\n xval = xvalArray[subploti];\n yval = yvalArray[subploti];\n }\n closedataPreviousLength = hoverData.length;\n if (hoverdistance !== 0) {\n if (trace._module && trace._module.hoverPoints) {\n var newPoints = trace._module.hoverPoints(pointData, xval, yval, _mode, {\n finiteRange: true,\n hoverLayer: fullLayout._hoverlayer,\n // options for splom when hovering on same axis\n hoversubplots,\n gd\n });\n if (newPoints) {\n var newPoint;\n for (var newPointNum = 0; newPointNum < newPoints.length; newPointNum++) {\n newPoint = newPoints[newPointNum];\n if (isNumeric(newPoint.x0) && isNumeric(newPoint.y0)) {\n hoverData.push(cleanPoint(newPoint, hovermode));\n }\n }\n }\n } else {\n Lib.log(\"Unrecognized trace type in hover:\", trace);\n }\n }\n if (hovermode === \"closest\" && hoverData.length > closedataPreviousLength) {\n hoverData.splice(0, closedataPreviousLength);\n distance = hoverData[0].distance;\n }\n if (hasCartesian && spikedistance !== 0) {\n if (hoverData.length === 0) {\n pointData.distance = spikedistance;\n pointData.index = false;\n var closestPoints = trace._module.hoverPoints(pointData, xval, yval, \"closest\", {\n hoverLayer: fullLayout._hoverlayer\n });\n if (closestPoints) {\n closestPoints = closestPoints.filter(function(point) {\n return point.spikeDistance <= spikedistance;\n });\n }\n if (closestPoints && closestPoints.length) {\n var tmpPoint;\n var closestVPoints = closestPoints.filter(function(point) {\n return point.xa.showspikes && point.xa.spikesnap !== \"hovered data\";\n });\n if (closestVPoints.length) {\n var closestVPt = closestVPoints[0];\n if (isNumeric(closestVPt.x0) && isNumeric(closestVPt.y0)) {\n tmpPoint = fillSpikePoint(closestVPt);\n if (!spikePoints.vLinePoint || spikePoints.vLinePoint.spikeDistance > tmpPoint.spikeDistance) {\n spikePoints.vLinePoint = tmpPoint;\n }\n }\n }\n var closestHPoints = closestPoints.filter(function(point) {\n return point.ya.showspikes && point.ya.spikesnap !== \"hovered data\";\n });\n if (closestHPoints.length) {\n var closestHPt = closestHPoints[0];\n if (isNumeric(closestHPt.x0) && isNumeric(closestHPt.y0)) {\n tmpPoint = fillSpikePoint(closestHPt);\n if (!spikePoints.hLinePoint || spikePoints.hLinePoint.spikeDistance > tmpPoint.spikeDistance) {\n spikePoints.hLinePoint = tmpPoint;\n }\n }\n }\n }\n }\n }\n }\n }\n findHoverPoints();\n function selectClosestPoint(pointsData, spikedistance2, spikeOnWinning2) {\n var resultPoint = null;\n var minDistance = Infinity;\n var thisSpikeDistance;\n for (var i2 = 0; i2 < pointsData.length; i2++) {\n if (firstXaxis && firstXaxis._id !== pointsData[i2].xa._id) continue;\n if (firstYaxis && firstYaxis._id !== pointsData[i2].ya._id) continue;\n thisSpikeDistance = pointsData[i2].spikeDistance;\n if (spikeOnWinning2 && i2 === 0) thisSpikeDistance = -Infinity;\n if (thisSpikeDistance <= minDistance && thisSpikeDistance <= spikedistance2) {\n resultPoint = pointsData[i2];\n minDistance = thisSpikeDistance;\n }\n }\n return resultPoint;\n }\n function fillSpikePoint(point) {\n if (!point) return null;\n return {\n xa: point.xa,\n ya: point.ya,\n x: point.xSpike !== void 0 ? point.xSpike : (point.x0 + point.x1) / 2,\n y: point.ySpike !== void 0 ? point.ySpike : (point.y0 + point.y1) / 2,\n distance: point.distance,\n spikeDistance: point.spikeDistance,\n curveNumber: point.trace.index,\n color: point.color,\n pointNumber: point.index\n };\n }\n var spikelineOpts = {\n fullLayout,\n container: fullLayout._hoverlayer,\n event: evt\n };\n var oldspikepoints = gd._spikepoints;\n var newspikepoints = {\n vLinePoint: spikePoints.vLinePoint,\n hLinePoint: spikePoints.hLinePoint\n };\n gd._spikepoints = newspikepoints;\n var sortHoverData = function() {\n var hoverDataInSubplot = hoverData.filter(function(a) {\n return firstXaxis && firstXaxis._id === a.xa._id && (firstYaxis && firstYaxis._id === a.ya._id);\n });\n var hoverDataOutSubplot = hoverData.filter(function(a) {\n return !(firstXaxis && firstXaxis._id === a.xa._id && (firstYaxis && firstYaxis._id === a.ya._id));\n });\n hoverDataInSubplot.sort(distanceSort);\n hoverDataOutSubplot.sort(distanceSort);\n hoverData = hoverDataInSubplot.concat(hoverDataOutSubplot);\n hoverData = orderRangePoints(hoverData, hovermode);\n };\n sortHoverData();\n var axLetter = hovermode.charAt(0);\n var spikeOnWinning = (axLetter === \"x\" || axLetter === \"y\") && hoverData[0] && cartesianScatterPoints[hoverData[0].trace.type];\n if (hasCartesian && spikedistance !== 0) {\n if (hoverData.length !== 0) {\n var tmpHPointData = hoverData.filter(function(point) {\n return point.ya.showspikes;\n });\n var tmpHPoint = selectClosestPoint(tmpHPointData, spikedistance, spikeOnWinning);\n spikePoints.hLinePoint = fillSpikePoint(tmpHPoint);\n var tmpVPointData = hoverData.filter(function(point) {\n return point.xa.showspikes;\n });\n var tmpVPoint = selectClosestPoint(tmpVPointData, spikedistance, spikeOnWinning);\n spikePoints.vLinePoint = fillSpikePoint(tmpVPoint);\n }\n }\n if (hoverData.length === 0) {\n var result = dragElement.unhoverRaw(gd, evt);\n if (hasCartesian && (spikePoints.hLinePoint !== null || spikePoints.vLinePoint !== null)) {\n if (spikesChanged(oldspikepoints)) {\n createSpikelines(gd, spikePoints, spikelineOpts);\n }\n }\n return result;\n }\n if (hasCartesian) {\n if (spikesChanged(oldspikepoints)) {\n createSpikelines(gd, spikePoints, spikelineOpts);\n }\n }\n if (helpers.isXYhover(_mode) && hoverData[0].length !== 0 && hoverData[0].trace.type !== \"splom\") {\n var winningPoint = hoverData[0];\n if (multipleHoverPoints[winningPoint.trace.type]) {\n hoverData = hoverData.filter(function(d) {\n return d.trace.index === winningPoint.trace.index;\n });\n } else {\n hoverData = [winningPoint];\n }\n var initLen = hoverData.length;\n var winX = getCoord(\"x\", winningPoint, fullLayout);\n var winY = getCoord(\"y\", winningPoint, fullLayout);\n findHoverPoints(winX, winY);\n var finalPoints = [];\n var seen = {};\n var id = 0;\n var insert = function(newHd) {\n var key = multipleHoverPoints[newHd.trace.type] ? hoverDataKey(newHd) : newHd.trace.index;\n if (!seen[key]) {\n id++;\n seen[key] = id;\n finalPoints.push(newHd);\n } else {\n var oldId = seen[key] - 1;\n var oldHd = finalPoints[oldId];\n if (oldId > 0 && Math.abs(newHd.distance) < Math.abs(oldHd.distance)) {\n finalPoints[oldId] = newHd;\n }\n }\n };\n var k;\n for (k = 0; k < initLen; k++) {\n insert(hoverData[k]);\n }\n for (k = hoverData.length - 1; k > initLen - 1; k--) {\n insert(hoverData[k]);\n }\n hoverData = finalPoints;\n sortHoverData();\n }\n var oldhoverdata = gd._hoverdata;\n var newhoverdata = [];\n var gTop = getTopOffset(gd);\n var gLeft = getLeftOffset(gd);\n for (itemnum = 0; itemnum < hoverData.length; itemnum++) {\n var pt = hoverData[itemnum];\n var eventData = helpers.makeEventData(pt, pt.trace, pt.cd);\n if (pt.hovertemplate !== false) {\n var ht = false;\n if (pt.cd[pt.index] && pt.cd[pt.index].ht) {\n ht = pt.cd[pt.index].ht;\n }\n pt.hovertemplate = ht || pt.trace.hovertemplate || false;\n }\n if (pt.xa && pt.ya) {\n var _x0 = pt.x0 + pt.xa._offset;\n var _x1 = pt.x1 + pt.xa._offset;\n var _y0 = pt.y0 + pt.ya._offset;\n var _y1 = pt.y1 + pt.ya._offset;\n var x0 = Math.min(_x0, _x1);\n var x1 = Math.max(_x0, _x1);\n var y0 = Math.min(_y0, _y1);\n var y1 = Math.max(_y0, _y1);\n eventData.bbox = {\n x0: x0 + gLeft,\n x1: x1 + gLeft,\n y0: y0 + gTop,\n y1: y1 + gTop\n };\n }\n pt.eventData = [eventData];\n newhoverdata.push(eventData);\n }\n gd._hoverdata = newhoverdata;\n var rotateLabels = hovermode === \"y\" && (searchData.length > 1 || hoverData.length > 1) || hovermode === \"closest\" && hasOneHorizontalTrace && hoverData.length > 1;\n var bgColor = Color2.combine(\n fullLayout.plot_bgcolor || Color2.background,\n fullLayout.paper_bgcolor\n );\n var hoverText = createHoverText(hoverData, {\n gd,\n hovermode,\n rotateLabels,\n bgColor,\n container: fullLayout._hoverlayer,\n outerContainer: fullLayout._paper.node(),\n commonLabelOpts: fullLayout.hoverlabel,\n hoverdistance: fullLayout.hoverdistance\n });\n var hoverLabels = hoverText.hoverLabels;\n if (!helpers.isUnifiedHover(hovermode)) {\n hoverAvoidOverlaps(hoverLabels, rotateLabels, fullLayout, hoverText.commonLabelBoundingBox);\n alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY);\n }\n if (eventTarget && eventTarget.tagName) {\n var hasClickToShow = Registry.getComponentMethod(\"annotations\", \"hasClickToShow\")(gd, newhoverdata);\n overrideCursor(d3.select(eventTarget), hasClickToShow ? \"pointer\" : \"\");\n }\n if (!eventTarget || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return;\n if (oldhoverdata) {\n gd.emit(\"plotly_unhover\", {\n event: evt,\n points: oldhoverdata\n });\n }\n gd.emit(\"plotly_hover\", {\n event: evt,\n points: gd._hoverdata,\n xaxes: xaArray,\n yaxes: yaArray,\n xvals: xvalArray,\n yvals: yvalArray\n });\n }\n function hoverDataKey(d) {\n return [d.trace.index, d.index, d.x0, d.y0, d.name, d.attr, d.xa ? d.xa._id : \"\", d.ya ? d.ya._id : \"\"].join(\",\");\n }\n var EXTRA_STRING_REGEX = /([\\s\\S]*)<\\/extra>/;\n function createHoverText(hoverData, opts) {\n var gd = opts.gd;\n var fullLayout = gd._fullLayout;\n var hovermode = opts.hovermode;\n var rotateLabels = opts.rotateLabels;\n var bgColor = opts.bgColor;\n var container = opts.container;\n var outerContainer = opts.outerContainer;\n var commonLabelOpts = opts.commonLabelOpts || {};\n if (hoverData.length === 0) return [[]];\n var fontFamily = opts.fontFamily || constants.HOVERFONT;\n var fontSize = opts.fontSize || constants.HOVERFONTSIZE;\n var fontWeight = opts.fontWeight || fullLayout.font.weight;\n var fontStyle = opts.fontStyle || fullLayout.font.style;\n var fontVariant = opts.fontVariant || fullLayout.font.variant;\n var fontTextcase = opts.fontTextcase || fullLayout.font.textcase;\n var fontLineposition = opts.fontLineposition || fullLayout.font.lineposition;\n var fontShadow = opts.fontShadow || fullLayout.font.shadow;\n var c0 = hoverData[0];\n var xa = c0.xa;\n var ya = c0.ya;\n var axLetter = hovermode.charAt(0);\n var axLabel = axLetter + \"Label\";\n var t02 = c0[axLabel];\n if (t02 === void 0 && xa.type === \"multicategory\") {\n for (var q = 0; q < hoverData.length; q++) {\n t02 = hoverData[q][axLabel];\n if (t02 !== void 0) break;\n }\n }\n var outerContainerBB = getBoundingClientRect(gd, outerContainer);\n var outerTop = outerContainerBB.top;\n var outerWidth = outerContainerBB.width;\n var outerHeight = outerContainerBB.height;\n var showCommonLabel = t02 !== void 0 && c0.distance <= opts.hoverdistance && (hovermode === \"x\" || hovermode === \"y\");\n if (showCommonLabel) {\n var allHaveZ = true;\n var i, traceHoverinfo;\n for (i = 0; i < hoverData.length; i++) {\n if (allHaveZ && hoverData[i].zLabel === void 0) allHaveZ = false;\n traceHoverinfo = hoverData[i].hoverinfo || hoverData[i].trace.hoverinfo;\n if (traceHoverinfo) {\n var parts = Array.isArray(traceHoverinfo) ? traceHoverinfo : traceHoverinfo.split(\"+\");\n if (parts.indexOf(\"all\") === -1 && parts.indexOf(hovermode) === -1) {\n showCommonLabel = false;\n break;\n }\n }\n }\n if (allHaveZ) showCommonLabel = false;\n }\n var commonLabel = container.selectAll(\"g.axistext\").data(showCommonLabel ? [0] : []);\n commonLabel.enter().append(\"g\").classed(\"axistext\", true);\n commonLabel.exit().remove();\n var commonLabelRect = {\n minX: 0,\n maxX: 0,\n minY: 0,\n maxY: 0\n };\n commonLabel.each(function() {\n var label = d3.select(this);\n var lpath = Lib.ensureSingle(label, \"path\", \"\", function(s) {\n s.style({ \"stroke-width\": \"1px\" });\n });\n var ltext = Lib.ensureSingle(label, \"text\", \"\", function(s) {\n s.attr(\"data-notex\", 1);\n });\n var commonBgColor = commonLabelOpts.bgcolor || Color2.defaultLine;\n var commonStroke = commonLabelOpts.bordercolor || Color2.contrast(commonBgColor);\n var contrastColor = Color2.contrast(commonBgColor);\n var commonLabelOptsFont = commonLabelOpts.font;\n var commonLabelFont = {\n weight: commonLabelOptsFont.weight || fontWeight,\n style: commonLabelOptsFont.style || fontStyle,\n variant: commonLabelOptsFont.variant || fontVariant,\n textcase: commonLabelOptsFont.textcase || fontTextcase,\n lineposition: commonLabelOptsFont.lineposition || fontLineposition,\n shadow: commonLabelOptsFont.shadow || fontShadow,\n family: commonLabelOptsFont.family || fontFamily,\n size: commonLabelOptsFont.size || fontSize,\n color: commonLabelOptsFont.color || contrastColor\n };\n lpath.style({\n fill: commonBgColor,\n stroke: commonStroke\n });\n ltext.text(t02).call(Drawing.font, commonLabelFont).call(svgTextUtils.positionText, 0, 0).call(svgTextUtils.convertToTspans, gd);\n label.attr(\"transform\", \"\");\n var tbb2 = getBoundingClientRect(gd, ltext.node());\n var lx2, ly2;\n if (hovermode === \"x\") {\n var topsign = xa.side === \"top\" ? \"-\" : \"\";\n ltext.attr(\"text-anchor\", \"middle\").call(svgTextUtils.positionText, 0, xa.side === \"top\" ? outerTop - tbb2.bottom - HOVERARROWSIZE - HOVERTEXTPAD : outerTop - tbb2.top + HOVERARROWSIZE + HOVERTEXTPAD);\n lx2 = xa._offset + (c0.x0 + c0.x1) / 2;\n ly2 = ya._offset + (xa.side === \"top\" ? 0 : ya._length);\n var halfWidth = tbb2.width / 2 + HOVERTEXTPAD;\n var tooltipMidX = lx2;\n if (lx2 < halfWidth) {\n tooltipMidX = halfWidth;\n } else if (lx2 > fullLayout.width - halfWidth) {\n tooltipMidX = fullLayout.width - halfWidth;\n }\n lpath.attr(\"d\", \"M\" + (lx2 - tooltipMidX) + \",0L\" + (lx2 - tooltipMidX + HOVERARROWSIZE) + \",\" + topsign + HOVERARROWSIZE + \"H\" + halfWidth + \"v\" + topsign + (HOVERTEXTPAD * 2 + tbb2.height) + \"H\" + -halfWidth + \"V\" + topsign + HOVERARROWSIZE + \"H\" + (lx2 - tooltipMidX - HOVERARROWSIZE) + \"Z\");\n lx2 = tooltipMidX;\n commonLabelRect.minX = lx2 - halfWidth;\n commonLabelRect.maxX = lx2 + halfWidth;\n if (xa.side === \"top\") {\n commonLabelRect.minY = ly2 - (HOVERTEXTPAD * 2 + tbb2.height);\n commonLabelRect.maxY = ly2 - HOVERTEXTPAD;\n } else {\n commonLabelRect.minY = ly2 + HOVERTEXTPAD;\n commonLabelRect.maxY = ly2 + (HOVERTEXTPAD * 2 + tbb2.height);\n }\n } else {\n var anchor;\n var sgn;\n var leftsign;\n if (ya.side === \"right\") {\n anchor = \"start\";\n sgn = 1;\n leftsign = \"\";\n lx2 = xa._offset + xa._length;\n } else {\n anchor = \"end\";\n sgn = -1;\n leftsign = \"-\";\n lx2 = xa._offset;\n }\n ly2 = ya._offset + (c0.y0 + c0.y1) / 2;\n ltext.attr(\"text-anchor\", anchor);\n lpath.attr(\"d\", \"M0,0L\" + leftsign + HOVERARROWSIZE + \",\" + HOVERARROWSIZE + \"V\" + (HOVERTEXTPAD + tbb2.height / 2) + \"h\" + leftsign + (HOVERTEXTPAD * 2 + tbb2.width) + \"V-\" + (HOVERTEXTPAD + tbb2.height / 2) + \"H\" + leftsign + HOVERARROWSIZE + \"V-\" + HOVERARROWSIZE + \"Z\");\n commonLabelRect.minY = ly2 - (HOVERTEXTPAD + tbb2.height / 2);\n commonLabelRect.maxY = ly2 + (HOVERTEXTPAD + tbb2.height / 2);\n if (ya.side === \"right\") {\n commonLabelRect.minX = lx2 + HOVERARROWSIZE;\n commonLabelRect.maxX = lx2 + HOVERARROWSIZE + (HOVERTEXTPAD * 2 + tbb2.width);\n } else {\n commonLabelRect.minX = lx2 - HOVERARROWSIZE - (HOVERTEXTPAD * 2 + tbb2.width);\n commonLabelRect.maxX = lx2 - HOVERARROWSIZE;\n }\n var halfHeight = tbb2.height / 2;\n var lty = outerTop - tbb2.top - halfHeight;\n var clipId = \"clip\" + fullLayout._uid + \"commonlabel\" + ya._id;\n var clipPath;\n if (lx2 < tbb2.width + 2 * HOVERTEXTPAD + HOVERARROWSIZE) {\n clipPath = \"M-\" + (HOVERARROWSIZE + HOVERTEXTPAD) + \"-\" + halfHeight + \"h-\" + (tbb2.width - HOVERTEXTPAD) + \"V\" + halfHeight + \"h\" + (tbb2.width - HOVERTEXTPAD) + \"Z\";\n var ltx = tbb2.width - lx2 + HOVERTEXTPAD;\n svgTextUtils.positionText(ltext, ltx, lty);\n if (anchor === \"end\") {\n ltext.selectAll(\"tspan\").each(function() {\n var s = d3.select(this);\n var dummy = Drawing.tester.append(\"text\").text(s.text()).call(Drawing.font, commonLabelFont);\n var dummyBB = getBoundingClientRect(gd, dummy.node());\n if (Math.round(dummyBB.width) < Math.round(tbb2.width)) {\n s.attr(\"x\", ltx - dummyBB.width);\n }\n dummy.remove();\n });\n }\n } else {\n svgTextUtils.positionText(ltext, sgn * (HOVERTEXTPAD + HOVERARROWSIZE), lty);\n clipPath = null;\n }\n var textClip = fullLayout._topclips.selectAll(\"#\" + clipId).data(clipPath ? [0] : []);\n textClip.enter().append(\"clipPath\").attr(\"id\", clipId).append(\"path\");\n textClip.exit().remove();\n textClip.select(\"path\").attr(\"d\", clipPath);\n Drawing.setClipUrl(ltext, clipPath ? clipId : null, gd);\n }\n label.attr(\"transform\", strTranslate(lx2, ly2));\n });\n if (helpers.isUnifiedHover(hovermode)) {\n container.selectAll(\"g.hovertext\").remove();\n var groupedHoverData = hoverData.filter(function(data) {\n return data.hoverinfo !== \"none\";\n });\n if (groupedHoverData.length === 0) return [];\n var hoverlabel = fullLayout.hoverlabel;\n var font = hoverlabel.font;\n var mockLayoutIn = {\n showlegend: true,\n legend: {\n title: { text: t02, font },\n font,\n bgcolor: hoverlabel.bgcolor,\n bordercolor: hoverlabel.bordercolor,\n borderwidth: 1,\n tracegroupgap: 7,\n traceorder: fullLayout.legend ? fullLayout.legend.traceorder : void 0,\n orientation: \"v\"\n }\n };\n var mockLayoutOut = {\n font\n };\n legendSupplyDefaults(mockLayoutIn, mockLayoutOut, gd._fullData);\n var mockLegend = mockLayoutOut.legend;\n mockLegend.entries = [];\n for (var j = 0; j < groupedHoverData.length; j++) {\n var pt = groupedHoverData[j];\n if (pt.hoverinfo === \"none\") continue;\n var texts = getHoverLabelText(pt, true, hovermode, fullLayout, t02);\n var text = texts[0];\n var name2 = texts[1];\n pt.name = name2;\n if (name2 !== \"\") {\n pt.text = name2 + \" : \" + text;\n } else {\n pt.text = text;\n }\n var cd = pt.cd[pt.index];\n if (cd) {\n if (cd.mc) pt.mc = cd.mc;\n if (cd.mcc) pt.mc = cd.mcc;\n if (cd.mlc) pt.mlc = cd.mlc;\n if (cd.mlcc) pt.mlc = cd.mlcc;\n if (cd.mlw) pt.mlw = cd.mlw;\n if (cd.mrc) pt.mrc = cd.mrc;\n if (cd.dir) pt.dir = cd.dir;\n }\n pt._distinct = true;\n mockLegend.entries.push([pt]);\n }\n mockLegend.entries.sort(function(a, b) {\n return a[0].trace.index - b[0].trace.index;\n });\n mockLegend.layer = container;\n mockLegend._inHover = true;\n mockLegend._groupTitleFont = hoverlabel.grouptitlefont;\n legendDraw(gd, mockLegend);\n var legendContainer = container.select(\"g.legend\");\n var tbb = getBoundingClientRect(gd, legendContainer.node());\n var tWidth = tbb.width + 2 * HOVERTEXTPAD;\n var tHeight = tbb.height + 2 * HOVERTEXTPAD;\n var winningPoint = groupedHoverData[0];\n var avgX = (winningPoint.x0 + winningPoint.x1) / 2;\n var avgY = (winningPoint.y0 + winningPoint.y1) / 2;\n var pointWon = !(Registry.traceIs(winningPoint.trace, \"bar-like\") || Registry.traceIs(winningPoint.trace, \"box-violin\"));\n var lyBottom, lyTop;\n if (axLetter === \"y\") {\n if (pointWon) {\n lyTop = avgY - HOVERTEXTPAD;\n lyBottom = avgY + HOVERTEXTPAD;\n } else {\n lyTop = Math.min.apply(null, groupedHoverData.map(function(c) {\n return Math.min(c.y0, c.y1);\n }));\n lyBottom = Math.max.apply(null, groupedHoverData.map(function(c) {\n return Math.max(c.y0, c.y1);\n }));\n }\n } else {\n lyTop = lyBottom = Lib.mean(groupedHoverData.map(function(c) {\n return (c.y0 + c.y1) / 2;\n })) - tHeight / 2;\n }\n var lxRight, lxLeft;\n if (axLetter === \"x\") {\n if (pointWon) {\n lxRight = avgX + HOVERTEXTPAD;\n lxLeft = avgX - HOVERTEXTPAD;\n } else {\n lxRight = Math.max.apply(null, groupedHoverData.map(function(c) {\n return Math.max(c.x0, c.x1);\n }));\n lxLeft = Math.min.apply(null, groupedHoverData.map(function(c) {\n return Math.min(c.x0, c.x1);\n }));\n }\n } else {\n lxRight = lxLeft = Lib.mean(groupedHoverData.map(function(c) {\n return (c.x0 + c.x1) / 2;\n })) - tWidth / 2;\n }\n var xOffset = xa._offset;\n var yOffset = ya._offset;\n lyBottom += yOffset;\n lxRight += xOffset;\n lxLeft += xOffset - tWidth;\n lyTop += yOffset - tHeight;\n var lx, ly;\n if (lxRight + tWidth < outerWidth && lxRight >= 0) {\n lx = lxRight;\n } else if (lxLeft + tWidth < outerWidth && lxLeft >= 0) {\n lx = lxLeft;\n } else if (xOffset + tWidth < outerWidth) {\n lx = xOffset;\n } else {\n if (lxRight - avgX < avgX - lxLeft + tWidth) {\n lx = outerWidth - tWidth;\n } else {\n lx = 0;\n }\n }\n lx += HOVERTEXTPAD;\n if (lyBottom + tHeight < outerHeight && lyBottom >= 0) {\n ly = lyBottom;\n } else if (lyTop + tHeight < outerHeight && lyTop >= 0) {\n ly = lyTop;\n } else if (yOffset + tHeight < outerHeight) {\n ly = yOffset;\n } else {\n if (lyBottom - avgY < avgY - lyTop + tHeight) {\n ly = outerHeight - tHeight;\n } else {\n ly = 0;\n }\n }\n ly += HOVERTEXTPAD;\n legendContainer.attr(\"transform\", strTranslate(lx - 1, ly - 1));\n return legendContainer;\n }\n var hoverLabels = container.selectAll(\"g.hovertext\").data(hoverData, function(d) {\n return hoverDataKey(d);\n });\n hoverLabels.enter().append(\"g\").classed(\"hovertext\", true).each(function() {\n var g = d3.select(this);\n g.append(\"rect\").call(Color2.fill, Color2.addOpacity(bgColor, 0.8));\n g.append(\"text\").classed(\"name\", true);\n g.append(\"path\").style(\"stroke-width\", \"1px\");\n g.append(\"text\").classed(\"nums\", true).call(Drawing.font, {\n weight: fontWeight,\n style: fontStyle,\n variant: fontVariant,\n textcase: fontTextcase,\n lineposition: fontLineposition,\n shadow: fontShadow,\n family: fontFamily,\n size: fontSize\n });\n });\n hoverLabels.exit().remove();\n hoverLabels.each(function(d) {\n var g = d3.select(this).attr(\"transform\", \"\");\n var dColor = d.color;\n if (Array.isArray(dColor)) {\n dColor = dColor[d.eventData[0].pointNumber];\n }\n var color0 = d.bgcolor || dColor;\n var numsColor = Color2.combine(\n Color2.opacity(color0) ? color0 : Color2.defaultLine,\n bgColor\n );\n var nameColor = Color2.combine(\n Color2.opacity(dColor) ? dColor : Color2.defaultLine,\n bgColor\n );\n var contrastColor = d.borderColor || Color2.contrast(numsColor);\n var texts2 = getHoverLabelText(d, showCommonLabel, hovermode, fullLayout, t02, g);\n var text2 = texts2[0];\n var name3 = texts2[1];\n var tx = g.select(\"text.nums\").call(Drawing.font, {\n family: d.fontFamily || fontFamily,\n size: d.fontSize || fontSize,\n color: d.fontColor || contrastColor,\n weight: d.fontWeight || fontWeight,\n style: d.fontStyle || fontStyle,\n variant: d.fontVariant || fontVariant,\n textcase: d.fontTextcase || fontTextcase,\n lineposition: d.fontLineposition || fontLineposition,\n shadow: d.fontShadow || fontShadow\n }).text(text2).attr(\"data-notex\", 1).call(svgTextUtils.positionText, 0, 0).call(svgTextUtils.convertToTspans, gd);\n var tx2 = g.select(\"text.name\");\n var tx2width = 0;\n var tx2height = 0;\n if (name3 && name3 !== text2) {\n tx2.call(Drawing.font, {\n family: d.fontFamily || fontFamily,\n size: d.fontSize || fontSize,\n color: nameColor,\n weight: d.fontWeight || fontWeight,\n style: d.fontStyle || fontStyle,\n variant: d.fontVariant || fontVariant,\n textcase: d.fontTextcase || fontTextcase,\n lineposition: d.fontLineposition || fontLineposition,\n shadow: d.fontShadow || fontShadow\n }).text(name3).attr(\"data-notex\", 1).call(svgTextUtils.positionText, 0, 0).call(svgTextUtils.convertToTspans, gd);\n var t2bb = getBoundingClientRect(gd, tx2.node());\n tx2width = t2bb.width + 2 * HOVERTEXTPAD;\n tx2height = t2bb.height + 2 * HOVERTEXTPAD;\n } else {\n tx2.remove();\n g.select(\"rect\").remove();\n }\n g.select(\"path\").style({\n fill: numsColor,\n stroke: contrastColor\n });\n var htx = d.xa._offset + (d.x0 + d.x1) / 2;\n var hty = d.ya._offset + (d.y0 + d.y1) / 2;\n var dx = Math.abs(d.x1 - d.x0);\n var dy = Math.abs(d.y1 - d.y0);\n var tbb2 = getBoundingClientRect(gd, tx.node());\n var tbbWidth = tbb2.width / fullLayout._invScaleX;\n var tbbHeight = tbb2.height / fullLayout._invScaleY;\n d.ty0 = (outerTop - tbb2.top) / fullLayout._invScaleY;\n d.bx = tbbWidth + 2 * HOVERTEXTPAD;\n d.by = Math.max(tbbHeight + 2 * HOVERTEXTPAD, tx2height);\n d.anchor = \"start\";\n d.txwidth = tbbWidth;\n d.tx2width = tx2width;\n d.offset = 0;\n var txTotalWidth = (tbbWidth + HOVERARROWSIZE + HOVERTEXTPAD + tx2width) * fullLayout._invScaleX;\n var anchorStartOK, anchorEndOK;\n if (rotateLabels) {\n d.pos = htx;\n anchorStartOK = hty + dy / 2 + txTotalWidth <= outerHeight;\n anchorEndOK = hty - dy / 2 - txTotalWidth >= 0;\n if ((d.idealAlign === \"top\" || !anchorStartOK) && anchorEndOK) {\n hty -= dy / 2;\n d.anchor = \"end\";\n } else if (anchorStartOK) {\n hty += dy / 2;\n d.anchor = \"start\";\n } else {\n d.anchor = \"middle\";\n }\n d.crossPos = hty;\n } else {\n d.pos = hty;\n anchorStartOK = htx + dx / 2 + txTotalWidth <= outerWidth;\n anchorEndOK = htx - dx / 2 - txTotalWidth >= 0;\n if ((d.idealAlign === \"left\" || !anchorStartOK) && anchorEndOK) {\n htx -= dx / 2;\n d.anchor = \"end\";\n } else if (anchorStartOK) {\n htx += dx / 2;\n d.anchor = \"start\";\n } else {\n d.anchor = \"middle\";\n var txHalfWidth = txTotalWidth / 2;\n var overflowR = htx + txHalfWidth - outerWidth;\n var overflowL = htx - txHalfWidth;\n if (overflowR > 0) htx -= overflowR;\n if (overflowL < 0) htx += -overflowL;\n }\n d.crossPos = htx;\n }\n tx.attr(\"text-anchor\", d.anchor);\n if (tx2width) tx2.attr(\"text-anchor\", d.anchor);\n g.attr(\"transform\", strTranslate(htx, hty) + (rotateLabels ? strRotate(YANGLE) : \"\"));\n });\n return {\n hoverLabels,\n commonLabelBoundingBox: commonLabelRect\n };\n }\n function getHoverLabelText(d, showCommonLabel, hovermode, fullLayout, t02, g) {\n var name2 = \"\";\n var text = \"\";\n if (d.nameOverride !== void 0) d.name = d.nameOverride;\n if (d.name) {\n if (d.trace._meta) {\n d.name = Lib.templateString(d.name, d.trace._meta);\n }\n name2 = plainText(d.name, d.nameLength);\n }\n var h0 = hovermode.charAt(0);\n var h1 = h0 === \"x\" ? \"y\" : \"x\";\n if (d.zLabel !== void 0) {\n if (d.xLabel !== void 0) text += \"x: \" + d.xLabel + \"
    \";\n if (d.yLabel !== void 0) text += \"y: \" + d.yLabel + \"
    \";\n if (d.trace.type !== \"choropleth\" && d.trace.type !== \"choroplethmapbox\" && d.trace.type !== \"choroplethmap\") {\n text += (text ? \"z: \" : \"\") + d.zLabel;\n }\n } else if (showCommonLabel && d[h0 + \"Label\"] === t02) {\n text = d[h1 + \"Label\"] || \"\";\n } else if (d.xLabel === void 0) {\n if (d.yLabel !== void 0 && d.trace.type !== \"scattercarpet\") {\n text = d.yLabel;\n }\n } else if (d.yLabel === void 0) text = d.xLabel;\n else text = \"(\" + d.xLabel + \", \" + d.yLabel + \")\";\n if ((d.text || d.text === 0) && !Array.isArray(d.text)) {\n text += (text ? \"
    \" : \"\") + d.text;\n }\n if (d.extraText !== void 0) text += (text ? \"
    \" : \"\") + d.extraText;\n if (g && text === \"\" && !d.hovertemplate) {\n if (name2 === \"\") g.remove();\n text = name2;\n }\n var hovertemplate = d.hovertemplate || false;\n if (hovertemplate) {\n var labels = d.hovertemplateLabels || d;\n if (d[h0 + \"Label\"] !== t02) {\n labels[h0 + \"other\"] = labels[h0 + \"Val\"];\n labels[h0 + \"otherLabel\"] = labels[h0 + \"Label\"];\n }\n text = Lib.hovertemplateString(\n hovertemplate,\n labels,\n fullLayout._d3locale,\n d.eventData[0] || {},\n d.trace._meta\n );\n text = text.replace(EXTRA_STRING_REGEX, function(match, extra) {\n name2 = plainText(extra, d.nameLength);\n return \"\";\n });\n }\n return [text, name2];\n }\n function hoverAvoidOverlaps(hoverLabels, rotateLabels, fullLayout, commonLabelBoundingBox) {\n var axKey = rotateLabels ? \"xa\" : \"ya\";\n var crossAxKey = rotateLabels ? \"ya\" : \"xa\";\n var nummoves = 0;\n var axSign = 1;\n var nLabels = hoverLabels.size();\n var pointgroups = new Array(nLabels);\n var k = 0;\n var axisLabelMinX = commonLabelBoundingBox.minX;\n var axisLabelMaxX = commonLabelBoundingBox.maxX;\n var axisLabelMinY = commonLabelBoundingBox.minY;\n var axisLabelMaxY = commonLabelBoundingBox.maxY;\n var pX = function(x) {\n return x * fullLayout._invScaleX;\n };\n var pY = function(y) {\n return y * fullLayout._invScaleY;\n };\n hoverLabels.each(function(d) {\n var ax = d[axKey];\n var crossAx = d[crossAxKey];\n var axIsX = ax._id.charAt(0) === \"x\";\n var rng = ax.range;\n if (k === 0 && rng && rng[0] > rng[1] !== axIsX) {\n axSign = -1;\n }\n var pmin = 0;\n var pmax = axIsX ? fullLayout.width : fullLayout.height;\n if (fullLayout.hovermode === \"x\" || fullLayout.hovermode === \"y\") {\n var offsets = getHoverLabelOffsets(d, rotateLabels);\n var anchor = d.anchor;\n var horzSign = anchor === \"end\" ? -1 : 1;\n var labelMin;\n var labelMax;\n if (anchor === \"middle\") {\n labelMin = d.crossPos + (axIsX ? pY(offsets.y - d.by / 2) : pX(d.bx / 2 + d.tx2width / 2));\n labelMax = labelMin + (axIsX ? pY(d.by) : pX(d.bx));\n } else {\n if (axIsX) {\n labelMin = d.crossPos + pY(HOVERARROWSIZE + offsets.y) - pY(d.by / 2 - HOVERARROWSIZE);\n labelMax = labelMin + pY(d.by);\n } else {\n var startX = pX(horzSign * HOVERARROWSIZE + offsets.x);\n var endX = startX + pX(horzSign * d.bx);\n labelMin = d.crossPos + Math.min(startX, endX);\n labelMax = d.crossPos + Math.max(startX, endX);\n }\n }\n if (axIsX) {\n if (axisLabelMinY !== void 0 && axisLabelMaxY !== void 0 && Math.min(labelMax, axisLabelMaxY) - Math.max(labelMin, axisLabelMinY) > 1) {\n if (crossAx.side === \"left\") {\n pmin = crossAx._mainLinePosition;\n pmax = fullLayout.width;\n } else {\n pmax = crossAx._mainLinePosition;\n }\n }\n } else {\n if (axisLabelMinX !== void 0 && axisLabelMaxX !== void 0 && Math.min(labelMax, axisLabelMaxX) - Math.max(labelMin, axisLabelMinX) > 1) {\n if (crossAx.side === \"top\") {\n pmin = crossAx._mainLinePosition;\n pmax = fullLayout.height;\n } else {\n pmax = crossAx._mainLinePosition;\n }\n }\n }\n }\n pointgroups[k++] = [{\n datum: d,\n traceIndex: d.trace.index,\n dp: 0,\n pos: d.pos,\n posref: d.posref,\n size: d.by * (axIsX ? YFACTOR : 1) / 2,\n pmin,\n pmax\n }];\n });\n pointgroups.sort(function(a, b) {\n return a[0].posref - b[0].posref || // for equal positions, sort trace indices increasing or decreasing\n // depending on whether the axis is reversed or not... so stacked\n // traces will generally keep their order even if one trace adds\n // nothing to the stack.\n axSign * (b[0].traceIndex - a[0].traceIndex);\n });\n var donepositioning, topOverlap, bottomOverlap, i, j, pti, sumdp;\n function constrainGroup(grp2) {\n var minPt = grp2[0];\n var maxPt = grp2[grp2.length - 1];\n topOverlap = minPt.pmin - minPt.pos - minPt.dp + minPt.size;\n bottomOverlap = maxPt.pos + maxPt.dp + maxPt.size - minPt.pmax;\n if (topOverlap > 0.01) {\n for (j = grp2.length - 1; j >= 0; j--) grp2[j].dp += topOverlap;\n donepositioning = false;\n }\n if (bottomOverlap < 0.01) return;\n if (topOverlap < -0.01) {\n for (j = grp2.length - 1; j >= 0; j--) grp2[j].dp -= bottomOverlap;\n donepositioning = false;\n }\n if (!donepositioning) return;\n var deleteCount = 0;\n for (i = 0; i < grp2.length; i++) {\n pti = grp2[i];\n if (pti.pos + pti.dp + pti.size > minPt.pmax) deleteCount++;\n }\n for (i = grp2.length - 1; i >= 0; i--) {\n if (deleteCount <= 0) break;\n pti = grp2[i];\n if (pti.pos > minPt.pmax - 1) {\n pti.del = true;\n deleteCount--;\n }\n }\n for (i = 0; i < grp2.length; i++) {\n if (deleteCount <= 0) break;\n pti = grp2[i];\n if (pti.pos < minPt.pmin + 1) {\n pti.del = true;\n deleteCount--;\n bottomOverlap = pti.size * 2;\n for (j = grp2.length - 1; j >= 0; j--) grp2[j].dp -= bottomOverlap;\n }\n }\n for (i = grp2.length - 1; i >= 0; i--) {\n if (deleteCount <= 0) break;\n pti = grp2[i];\n if (pti.pos + pti.dp + pti.size > minPt.pmax) {\n pti.del = true;\n deleteCount--;\n }\n }\n }\n while (!donepositioning && nummoves <= nLabels) {\n nummoves++;\n donepositioning = true;\n i = 0;\n while (i < pointgroups.length - 1) {\n var g0 = pointgroups[i];\n var g1 = pointgroups[i + 1];\n var p0 = g0[g0.length - 1];\n var p1 = g1[0];\n topOverlap = p0.pos + p0.dp + p0.size - p1.pos - p1.dp + p1.size;\n if (topOverlap > 0.01) {\n for (j = g1.length - 1; j >= 0; j--) g1[j].dp += topOverlap;\n g0.push.apply(g0, g1);\n pointgroups.splice(i + 1, 1);\n sumdp = 0;\n for (j = g0.length - 1; j >= 0; j--) sumdp += g0[j].dp;\n bottomOverlap = sumdp / g0.length;\n for (j = g0.length - 1; j >= 0; j--) g0[j].dp -= bottomOverlap;\n donepositioning = false;\n } else i++;\n }\n pointgroups.forEach(constrainGroup);\n }\n for (i = pointgroups.length - 1; i >= 0; i--) {\n var grp = pointgroups[i];\n for (j = grp.length - 1; j >= 0; j--) {\n var pt = grp[j];\n var hoverPt = pt.datum;\n hoverPt.offset = pt.dp;\n hoverPt.del = pt.del;\n }\n }\n }\n function getHoverLabelOffsets(hoverLabel, rotateLabels) {\n var offsetX = 0;\n var offsetY = hoverLabel.offset;\n if (rotateLabels) {\n offsetY *= -YSHIFTY;\n offsetX = hoverLabel.offset * YSHIFTX;\n }\n return {\n x: offsetX,\n y: offsetY\n };\n }\n function getTextShiftX(hoverLabel) {\n var alignShift = { start: 1, end: -1, middle: 0 }[hoverLabel.anchor];\n var textShiftX = alignShift * (HOVERARROWSIZE + HOVERTEXTPAD);\n var text2ShiftX = textShiftX + alignShift * (hoverLabel.txwidth + HOVERTEXTPAD);\n var isMiddle = hoverLabel.anchor === \"middle\";\n if (isMiddle) {\n textShiftX -= hoverLabel.tx2width / 2;\n text2ShiftX += hoverLabel.txwidth / 2 + HOVERTEXTPAD;\n }\n return {\n alignShift,\n textShiftX,\n text2ShiftX\n };\n }\n function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) {\n var pX = function(x) {\n return x * scaleX;\n };\n var pY = function(y) {\n return y * scaleY;\n };\n hoverLabels.each(function(d) {\n var g = d3.select(this);\n if (d.del) return g.remove();\n var tx = g.select(\"text.nums\");\n var anchor = d.anchor;\n var horzSign = anchor === \"end\" ? -1 : 1;\n var shiftX = getTextShiftX(d);\n var offsets = getHoverLabelOffsets(d, rotateLabels);\n var offsetX = offsets.x;\n var offsetY = offsets.y;\n var isMiddle = anchor === \"middle\";\n g.select(\"path\").attr(\"d\", isMiddle ? (\n // middle aligned: rect centered on data\n \"M-\" + pX(d.bx / 2 + d.tx2width / 2) + \",\" + pY(offsetY - d.by / 2) + \"h\" + pX(d.bx) + \"v\" + pY(d.by) + \"h-\" + pX(d.bx) + \"Z\"\n ) : (\n // left or right aligned: side rect with arrow to data\n \"M0,0L\" + pX(horzSign * HOVERARROWSIZE + offsetX) + \",\" + pY(HOVERARROWSIZE + offsetY) + \"v\" + pY(d.by / 2 - HOVERARROWSIZE) + \"h\" + pX(horzSign * d.bx) + \"v-\" + pY(d.by) + \"H\" + pX(horzSign * HOVERARROWSIZE + offsetX) + \"V\" + pY(offsetY - HOVERARROWSIZE) + \"Z\"\n ));\n var posX = offsetX + shiftX.textShiftX;\n var posY = offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD;\n var textAlign = d.textAlign || \"auto\";\n if (textAlign !== \"auto\") {\n if (textAlign === \"left\" && anchor !== \"start\") {\n tx.attr(\"text-anchor\", \"start\");\n posX = isMiddle ? -d.bx / 2 - d.tx2width / 2 + HOVERTEXTPAD : -d.bx - HOVERTEXTPAD;\n } else if (textAlign === \"right\" && anchor !== \"end\") {\n tx.attr(\"text-anchor\", \"end\");\n posX = isMiddle ? d.bx / 2 - d.tx2width / 2 - HOVERTEXTPAD : d.bx + HOVERTEXTPAD;\n }\n }\n tx.call(svgTextUtils.positionText, pX(posX), pY(posY));\n if (d.tx2width) {\n g.select(\"text.name\").call(\n svgTextUtils.positionText,\n pX(shiftX.text2ShiftX + shiftX.alignShift * HOVERTEXTPAD + offsetX),\n pY(offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD)\n );\n g.select(\"rect\").call(\n Drawing.setRect,\n pX(shiftX.text2ShiftX + (shiftX.alignShift - 1) * d.tx2width / 2 + offsetX),\n pY(offsetY - d.by / 2 - 1),\n pX(d.tx2width),\n pY(d.by + 2)\n );\n }\n });\n }\n function cleanPoint(d, hovermode) {\n var index = d.index;\n var trace = d.trace || {};\n var cd0 = d.cd[0];\n var cd = d.cd[index] || {};\n function pass(v) {\n return v || isNumeric(v) && v === 0;\n }\n var getVal = Array.isArray(index) ? function(calcKey, traceKey) {\n var v = Lib.castOption(cd0, index, calcKey);\n return pass(v) ? v : Lib.extractOption({}, trace, \"\", traceKey);\n } : function(calcKey, traceKey) {\n return Lib.extractOption(cd, trace, calcKey, traceKey);\n };\n function fill(key, calcKey, traceKey) {\n var val = getVal(calcKey, traceKey);\n if (pass(val)) d[key] = val;\n }\n fill(\"hoverinfo\", \"hi\", \"hoverinfo\");\n fill(\"bgcolor\", \"hbg\", \"hoverlabel.bgcolor\");\n fill(\"borderColor\", \"hbc\", \"hoverlabel.bordercolor\");\n fill(\"fontFamily\", \"htf\", \"hoverlabel.font.family\");\n fill(\"fontSize\", \"hts\", \"hoverlabel.font.size\");\n fill(\"fontColor\", \"htc\", \"hoverlabel.font.color\");\n fill(\"fontWeight\", \"htw\", \"hoverlabel.font.weight\");\n fill(\"fontStyle\", \"hty\", \"hoverlabel.font.style\");\n fill(\"fontVariant\", \"htv\", \"hoverlabel.font.variant\");\n fill(\"nameLength\", \"hnl\", \"hoverlabel.namelength\");\n fill(\"textAlign\", \"hta\", \"hoverlabel.align\");\n d.posref = hovermode === \"y\" || hovermode === \"closest\" && trace.orientation === \"h\" ? d.xa._offset + (d.x0 + d.x1) / 2 : d.ya._offset + (d.y0 + d.y1) / 2;\n d.x0 = Lib.constrain(d.x0, 0, d.xa._length);\n d.x1 = Lib.constrain(d.x1, 0, d.xa._length);\n d.y0 = Lib.constrain(d.y0, 0, d.ya._length);\n d.y1 = Lib.constrain(d.y1, 0, d.ya._length);\n if (d.xLabelVal !== void 0) {\n d.xLabel = \"xLabel\" in d ? d.xLabel : Axes.hoverLabelText(d.xa, d.xLabelVal, trace.xhoverformat);\n d.xVal = d.xa.c2d(d.xLabelVal);\n }\n if (d.yLabelVal !== void 0) {\n d.yLabel = \"yLabel\" in d ? d.yLabel : Axes.hoverLabelText(d.ya, d.yLabelVal, trace.yhoverformat);\n d.yVal = d.ya.c2d(d.yLabelVal);\n }\n if (d.zLabelVal !== void 0 && d.zLabel === void 0) {\n d.zLabel = String(d.zLabelVal);\n }\n if (!isNaN(d.xerr) && !(d.xa.type === \"log\" && d.xerr <= 0)) {\n var xeText = Axes.tickText(d.xa, d.xa.c2l(d.xerr), \"hover\").text;\n if (d.xerrneg !== void 0) {\n d.xLabel += \" +\" + xeText + \" / -\" + Axes.tickText(d.xa, d.xa.c2l(d.xerrneg), \"hover\").text;\n } else d.xLabel += \" \\xB1 \" + xeText;\n if (hovermode === \"x\") d.distance += 1;\n }\n if (!isNaN(d.yerr) && !(d.ya.type === \"log\" && d.yerr <= 0)) {\n var yeText = Axes.tickText(d.ya, d.ya.c2l(d.yerr), \"hover\").text;\n if (d.yerrneg !== void 0) {\n d.yLabel += \" +\" + yeText + \" / -\" + Axes.tickText(d.ya, d.ya.c2l(d.yerrneg), \"hover\").text;\n } else d.yLabel += \" \\xB1 \" + yeText;\n if (hovermode === \"y\") d.distance += 1;\n }\n var infomode = d.hoverinfo || d.trace.hoverinfo;\n if (infomode && infomode !== \"all\") {\n infomode = Array.isArray(infomode) ? infomode : infomode.split(\"+\");\n if (infomode.indexOf(\"x\") === -1) d.xLabel = void 0;\n if (infomode.indexOf(\"y\") === -1) d.yLabel = void 0;\n if (infomode.indexOf(\"z\") === -1) d.zLabel = void 0;\n if (infomode.indexOf(\"text\") === -1) d.text = void 0;\n if (infomode.indexOf(\"name\") === -1) d.name = void 0;\n }\n return d;\n }\n function createSpikelines(gd, closestPoints, opts) {\n var container = opts.container;\n var fullLayout = opts.fullLayout;\n var gs = fullLayout._size;\n var evt = opts.event;\n var showY = !!closestPoints.hLinePoint;\n var showX = !!closestPoints.vLinePoint;\n var xa, ya;\n container.selectAll(\".spikeline\").remove();\n if (!(showX || showY)) return;\n var contrastColor = Color2.combine(fullLayout.plot_bgcolor, fullLayout.paper_bgcolor);\n if (showY) {\n var hLinePoint = closestPoints.hLinePoint;\n var hLinePointX, hLinePointY;\n xa = hLinePoint && hLinePoint.xa;\n ya = hLinePoint && hLinePoint.ya;\n var ySnap = ya.spikesnap;\n if (ySnap === \"cursor\") {\n hLinePointX = evt.pointerX;\n hLinePointY = evt.pointerY;\n } else {\n hLinePointX = xa._offset + hLinePoint.x;\n hLinePointY = ya._offset + hLinePoint.y;\n }\n var dfltHLineColor = tinycolor.readability(hLinePoint.color, contrastColor) < 1.5 ? Color2.contrast(contrastColor) : hLinePoint.color;\n var yMode = ya.spikemode;\n var yThickness = ya.spikethickness;\n var yColor = ya.spikecolor || dfltHLineColor;\n var xEdge = Axes.getPxPosition(gd, ya);\n var xBase, xEndSpike;\n if (yMode.indexOf(\"toaxis\") !== -1 || yMode.indexOf(\"across\") !== -1) {\n if (yMode.indexOf(\"toaxis\") !== -1) {\n xBase = xEdge;\n xEndSpike = hLinePointX;\n }\n if (yMode.indexOf(\"across\") !== -1) {\n var xAcross0 = ya._counterDomainMin;\n var xAcross1 = ya._counterDomainMax;\n if (ya.anchor === \"free\") {\n xAcross0 = Math.min(xAcross0, ya.position);\n xAcross1 = Math.max(xAcross1, ya.position);\n }\n xBase = gs.l + xAcross0 * gs.w;\n xEndSpike = gs.l + xAcross1 * gs.w;\n }\n container.insert(\"line\", \":first-child\").attr({\n x1: xBase,\n x2: xEndSpike,\n y1: hLinePointY,\n y2: hLinePointY,\n \"stroke-width\": yThickness,\n stroke: yColor,\n \"stroke-dasharray\": Drawing.dashStyle(ya.spikedash, yThickness)\n }).classed(\"spikeline\", true).classed(\"crisp\", true);\n container.insert(\"line\", \":first-child\").attr({\n x1: xBase,\n x2: xEndSpike,\n y1: hLinePointY,\n y2: hLinePointY,\n \"stroke-width\": yThickness + 2,\n stroke: contrastColor\n }).classed(\"spikeline\", true).classed(\"crisp\", true);\n }\n if (yMode.indexOf(\"marker\") !== -1) {\n container.insert(\"circle\", \":first-child\").attr({\n cx: xEdge + (ya.side !== \"right\" ? yThickness : -yThickness),\n cy: hLinePointY,\n r: yThickness,\n fill: yColor\n }).classed(\"spikeline\", true);\n }\n }\n if (showX) {\n var vLinePoint = closestPoints.vLinePoint;\n var vLinePointX, vLinePointY;\n xa = vLinePoint && vLinePoint.xa;\n ya = vLinePoint && vLinePoint.ya;\n var xSnap = xa.spikesnap;\n if (xSnap === \"cursor\") {\n vLinePointX = evt.pointerX;\n vLinePointY = evt.pointerY;\n } else {\n vLinePointX = xa._offset + vLinePoint.x;\n vLinePointY = ya._offset + vLinePoint.y;\n }\n var dfltVLineColor = tinycolor.readability(vLinePoint.color, contrastColor) < 1.5 ? Color2.contrast(contrastColor) : vLinePoint.color;\n var xMode = xa.spikemode;\n var xThickness = xa.spikethickness;\n var xColor = xa.spikecolor || dfltVLineColor;\n var yEdge = Axes.getPxPosition(gd, xa);\n var yBase, yEndSpike;\n if (xMode.indexOf(\"toaxis\") !== -1 || xMode.indexOf(\"across\") !== -1) {\n if (xMode.indexOf(\"toaxis\") !== -1) {\n yBase = yEdge;\n yEndSpike = vLinePointY;\n }\n if (xMode.indexOf(\"across\") !== -1) {\n var yAcross0 = xa._counterDomainMin;\n var yAcross1 = xa._counterDomainMax;\n if (xa.anchor === \"free\") {\n yAcross0 = Math.min(yAcross0, xa.position);\n yAcross1 = Math.max(yAcross1, xa.position);\n }\n yBase = gs.t + (1 - yAcross1) * gs.h;\n yEndSpike = gs.t + (1 - yAcross0) * gs.h;\n }\n container.insert(\"line\", \":first-child\").attr({\n x1: vLinePointX,\n x2: vLinePointX,\n y1: yBase,\n y2: yEndSpike,\n \"stroke-width\": xThickness,\n stroke: xColor,\n \"stroke-dasharray\": Drawing.dashStyle(xa.spikedash, xThickness)\n }).classed(\"spikeline\", true).classed(\"crisp\", true);\n container.insert(\"line\", \":first-child\").attr({\n x1: vLinePointX,\n x2: vLinePointX,\n y1: yBase,\n y2: yEndSpike,\n \"stroke-width\": xThickness + 2,\n stroke: contrastColor\n }).classed(\"spikeline\", true).classed(\"crisp\", true);\n }\n if (xMode.indexOf(\"marker\") !== -1) {\n container.insert(\"circle\", \":first-child\").attr({\n cx: vLinePointX,\n cy: yEdge - (xa.side !== \"top\" ? xThickness : -xThickness),\n r: xThickness,\n fill: xColor\n }).classed(\"spikeline\", true);\n }\n }\n }\n function hoverChanged(gd, evt, oldhoverdata) {\n if (!oldhoverdata || oldhoverdata.length !== gd._hoverdata.length) return true;\n for (var i = oldhoverdata.length - 1; i >= 0; i--) {\n var oldPt = oldhoverdata[i];\n var newPt = gd._hoverdata[i];\n if (oldPt.curveNumber !== newPt.curveNumber || String(oldPt.pointNumber) !== String(newPt.pointNumber) || String(oldPt.pointNumbers) !== String(newPt.pointNumbers)) {\n return true;\n }\n }\n return false;\n }\n function spikesChanged(gd, oldspikepoints) {\n if (!oldspikepoints) return true;\n if (oldspikepoints.vLinePoint !== gd._spikepoints.vLinePoint || oldspikepoints.hLinePoint !== gd._spikepoints.hLinePoint) return true;\n return false;\n }\n function plainText(s, len) {\n return svgTextUtils.plainText(s || \"\", {\n len,\n allowedTags: [\"br\", \"sub\", \"sup\", \"b\", \"i\", \"em\", \"s\", \"u\"]\n });\n }\n function orderRangePoints(hoverData, hovermode) {\n var axLetter = hovermode.charAt(0);\n var first = [];\n var second = [];\n var last = [];\n for (var i = 0; i < hoverData.length; i++) {\n var d = hoverData[i];\n if (Registry.traceIs(d.trace, \"bar-like\") || Registry.traceIs(d.trace, \"box-violin\")) {\n last.push(d);\n } else if (d.trace[axLetter + \"period\"]) {\n second.push(d);\n } else {\n first.push(d);\n }\n }\n return first.concat(second).concat(last);\n }\n function getCoord(axLetter, winningPoint, fullLayout) {\n var ax = winningPoint[axLetter + \"a\"];\n var val = winningPoint[axLetter + \"Val\"];\n var cd0 = winningPoint.cd[0];\n if (ax.type === \"category\" || ax.type === \"multicategory\") val = ax._categoriesMap[val];\n else if (ax.type === \"date\") {\n var periodalignment = winningPoint.trace[axLetter + \"periodalignment\"];\n if (periodalignment) {\n var d = winningPoint.cd[winningPoint.index];\n var start = d[axLetter + \"Start\"];\n if (start === void 0) start = d[axLetter];\n var end = d[axLetter + \"End\"];\n if (end === void 0) end = d[axLetter];\n var diff = end - start;\n if (periodalignment === \"end\") {\n val += diff;\n } else if (periodalignment === \"middle\") {\n val += diff / 2;\n }\n }\n val = ax.d2c(val);\n }\n if (cd0 && cd0.t && cd0.t.posLetter === ax._id) {\n if (fullLayout.boxmode === \"group\" || fullLayout.violinmode === \"group\") {\n val += cd0.t.dPos;\n }\n }\n return val;\n }\n function getTopOffset(gd) {\n return gd.offsetTop + gd.clientTop;\n }\n function getLeftOffset(gd) {\n return gd.offsetLeft + gd.clientLeft;\n }\n function getBoundingClientRect(gd, node) {\n var fullLayout = gd._fullLayout;\n var rect = node.getBoundingClientRect();\n var x0 = rect.left;\n var y0 = rect.top;\n var x1 = x0 + rect.width;\n var y1 = y0 + rect.height;\n var A2 = Lib.apply3DTransform(fullLayout._invTransform)(x0, y0);\n var B2 = Lib.apply3DTransform(fullLayout._invTransform)(x1, y1);\n var Ax = A2[0];\n var Ay = A2[1];\n var Bx = B2[0];\n var By = B2[1];\n return {\n x: Ax,\n y: Ay,\n width: Bx - Ax,\n height: By - Ay,\n top: Math.min(Ay, By),\n left: Math.min(Ax, Bx),\n right: Math.max(Ax, Bx),\n bottom: Math.max(Ay, By)\n };\n }\n }\n });\n\n // src/components/fx/hoverlabel_defaults.js\n var require_hoverlabel_defaults = __commonJS({\n \"src/components/fx/hoverlabel_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Color2 = require_color();\n var isUnifiedHover = require_helpers2().isUnifiedHover;\n module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts) {\n opts = opts || {};\n var hasLegend = contOut.legend;\n function inheritFontAttr(attr) {\n if (!opts.font[attr]) {\n opts.font[attr] = hasLegend ? contOut.legend.font[attr] : contOut.font[attr];\n }\n }\n if (contOut && isUnifiedHover(contOut.hovermode)) {\n if (!opts.font) opts.font = {};\n inheritFontAttr(\"size\");\n inheritFontAttr(\"family\");\n inheritFontAttr(\"color\");\n inheritFontAttr(\"weight\");\n inheritFontAttr(\"style\");\n inheritFontAttr(\"variant\");\n if (hasLegend) {\n if (!opts.bgcolor) opts.bgcolor = Color2.combine(contOut.legend.bgcolor, contOut.paper_bgcolor);\n if (!opts.bordercolor) opts.bordercolor = contOut.legend.bordercolor;\n } else {\n if (!opts.bgcolor) opts.bgcolor = contOut.paper_bgcolor;\n }\n }\n coerce(\"hoverlabel.bgcolor\", opts.bgcolor);\n coerce(\"hoverlabel.bordercolor\", opts.bordercolor);\n coerce(\"hoverlabel.namelength\", opts.namelength);\n Lib.coerceFont(coerce, \"hoverlabel.font\", opts.font);\n coerce(\"hoverlabel.align\", opts.align);\n };\n }\n });\n\n // src/components/fx/layout_global_defaults.js\n var require_layout_global_defaults = __commonJS({\n \"src/components/fx/layout_global_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleHoverLabelDefaults = require_hoverlabel_defaults();\n var layoutAttributes = require_layout_attributes();\n module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);\n }\n handleHoverLabelDefaults(layoutIn, layoutOut, coerce);\n };\n }\n });\n\n // src/components/fx/defaults.js\n var require_defaults4 = __commonJS({\n \"src/components/fx/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var attributes = require_attributes();\n var handleHoverLabelDefaults = require_hoverlabel_defaults();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var opts = Lib.extendFlat({}, layout.hoverlabel);\n if (traceOut.hovertemplate) opts.namelength = -1;\n handleHoverLabelDefaults(traceIn, traceOut, coerce, opts);\n };\n }\n });\n\n // src/components/fx/hovermode_defaults.js\n var require_hovermode_defaults = __commonJS({\n \"src/components/fx/hovermode_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var layoutAttributes = require_layout_attributes();\n module.exports = function handleHoverModeDefaults(layoutIn, layoutOut) {\n function coerce(attr, dflt) {\n if (layoutOut[attr] !== void 0) return layoutOut[attr];\n return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);\n }\n coerce(\"clickmode\");\n coerce(\"hoversubplots\");\n return coerce(\"hovermode\");\n };\n }\n });\n\n // src/components/fx/layout_defaults.js\n var require_layout_defaults2 = __commonJS({\n \"src/components/fx/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var layoutAttributes = require_layout_attributes();\n var handleHoverModeDefaults = require_hovermode_defaults();\n var handleHoverLabelDefaults = require_hoverlabel_defaults();\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);\n }\n var hoverMode = handleHoverModeDefaults(layoutIn, layoutOut);\n if (hoverMode) {\n coerce(\"hoverdistance\");\n coerce(\"spikedistance\");\n }\n var dragMode = coerce(\"dragmode\");\n if (dragMode === \"select\") coerce(\"selectdirection\");\n var hasMapbox = layoutOut._has(\"mapbox\");\n var hasMap = layoutOut._has(\"map\");\n var hasGeo = layoutOut._has(\"geo\");\n var len = layoutOut._basePlotModules.length;\n if (layoutOut.dragmode === \"zoom\" && ((hasMapbox || hasMap || hasGeo) && len === 1 || (hasMapbox || hasMap) && hasGeo && len === 2)) {\n layoutOut.dragmode = \"pan\";\n }\n handleHoverLabelDefaults(layoutIn, layoutOut, coerce);\n Lib.coerceFont(coerce, \"hoverlabel.grouptitlefont\", layoutOut.hoverlabel.font);\n };\n }\n });\n\n // src/components/fx/calc.js\n var require_calc2 = __commonJS({\n \"src/components/fx/calc.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Registry = require_registry();\n module.exports = function calc(gd) {\n var calcdata = gd.calcdata;\n var fullLayout = gd._fullLayout;\n function makeCoerceHoverInfo(trace2) {\n return function(val) {\n return Lib.coerceHoverinfo({ hoverinfo: val }, { _module: trace2._module }, fullLayout);\n };\n }\n for (var i = 0; i < calcdata.length; i++) {\n var cd = calcdata[i];\n var trace = cd[0].trace;\n if (Registry.traceIs(trace, \"pie-like\")) continue;\n var fillFn = Registry.traceIs(trace, \"2dMap\") ? paste : Lib.fillArray;\n fillFn(trace.hoverinfo, cd, \"hi\", makeCoerceHoverInfo(trace));\n if (trace.hovertemplate) fillFn(trace.hovertemplate, cd, \"ht\");\n if (!trace.hoverlabel) continue;\n fillFn(trace.hoverlabel.bgcolor, cd, \"hbg\");\n fillFn(trace.hoverlabel.bordercolor, cd, \"hbc\");\n fillFn(trace.hoverlabel.font.size, cd, \"hts\");\n fillFn(trace.hoverlabel.font.color, cd, \"htc\");\n fillFn(trace.hoverlabel.font.family, cd, \"htf\");\n fillFn(trace.hoverlabel.font.weight, cd, \"htw\");\n fillFn(trace.hoverlabel.font.style, cd, \"hty\");\n fillFn(trace.hoverlabel.font.variant, cd, \"htv\");\n fillFn(trace.hoverlabel.namelength, cd, \"hnl\");\n fillFn(trace.hoverlabel.align, cd, \"hta\");\n }\n };\n function paste(traceAttr, cd, cdAttr, fn) {\n fn = fn || Lib.identity;\n if (Array.isArray(traceAttr)) {\n cd[0][cdAttr] = fn(traceAttr);\n }\n }\n }\n });\n\n // src/components/fx/click.js\n var require_click = __commonJS({\n \"src/components/fx/click.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var hover = require_hover().hover;\n module.exports = function click(gd, evt, subplot) {\n var annotationsDone = Registry.getComponentMethod(\"annotations\", \"onClick\")(gd, gd._hoverdata);\n if (subplot !== void 0) {\n hover(gd, evt, subplot, true);\n }\n function emitClick() {\n gd.emit(\"plotly_click\", { points: gd._hoverdata, event: evt });\n }\n if (gd._hoverdata && evt && evt.target) {\n if (annotationsDone && annotationsDone.then) {\n annotationsDone.then(emitClick);\n } else emitClick();\n if (evt.stopImmediatePropagation) evt.stopImmediatePropagation();\n }\n };\n }\n });\n\n // src/components/fx/index.js\n var require_fx = __commonJS({\n \"src/components/fx/index.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var dragElement = require_dragelement();\n var helpers = require_helpers2();\n var layoutAttributes = require_layout_attributes();\n var hoverModule = require_hover();\n module.exports = {\n moduleType: \"component\",\n name: \"fx\",\n constants: require_constants(),\n schema: {\n layout: layoutAttributes\n },\n attributes: require_attributes(),\n layoutAttributes,\n supplyLayoutGlobalDefaults: require_layout_global_defaults(),\n supplyDefaults: require_defaults4(),\n supplyLayoutDefaults: require_layout_defaults2(),\n calc: require_calc2(),\n getDistanceFunction: helpers.getDistanceFunction,\n getClosest: helpers.getClosest,\n inbox: helpers.inbox,\n quadrature: helpers.quadrature,\n appendArrayPointValue: helpers.appendArrayPointValue,\n castHoverOption,\n castHoverinfo,\n hover: hoverModule.hover,\n unhover: dragElement.unhover,\n loneHover: hoverModule.loneHover,\n loneUnhover,\n click: require_click()\n };\n function loneUnhover(containerOrSelection) {\n var selection = Lib.isD3Selection(containerOrSelection) ? containerOrSelection : d3.select(containerOrSelection);\n selection.selectAll(\"g.hovertext\").remove();\n selection.selectAll(\".spikeline\").remove();\n }\n function castHoverOption(trace, ptNumber, attr) {\n return Lib.castOption(trace, ptNumber, \"hoverlabel.\" + attr);\n }\n function castHoverinfo(trace, fullLayout, ptNumber) {\n function _coerce(val) {\n return Lib.coerceHoverinfo({ hoverinfo: val }, { _module: trace._module }, fullLayout);\n }\n return Lib.castOption(trace, ptNumber, \"hoverinfo\", _coerce);\n }\n }\n });\n\n // src/components/dragelement/helpers.js\n var require_helpers5 = __commonJS({\n \"src/components/dragelement/helpers.js\"(exports) {\n \"use strict\";\n exports.selectMode = function(dragmode) {\n return dragmode === \"lasso\" || dragmode === \"select\";\n };\n exports.drawMode = function(dragmode) {\n return dragmode === \"drawclosedpath\" || dragmode === \"drawopenpath\" || dragmode === \"drawline\" || dragmode === \"drawrect\" || dragmode === \"drawcircle\";\n };\n exports.openMode = function(dragmode) {\n return dragmode === \"drawline\" || dragmode === \"drawopenpath\";\n };\n exports.rectMode = function(dragmode) {\n return dragmode === \"select\" || dragmode === \"drawline\" || dragmode === \"drawrect\" || dragmode === \"drawcircle\";\n };\n exports.freeMode = function(dragmode) {\n return dragmode === \"lasso\" || dragmode === \"drawclosedpath\" || dragmode === \"drawopenpath\";\n };\n exports.selectingOrDrawing = function(dragmode) {\n return exports.freeMode(dragmode) || exports.rectMode(dragmode);\n };\n }\n });\n\n // src/lib/clear_gl_canvases.js\n var require_clear_gl_canvases = __commonJS({\n \"src/lib/clear_gl_canvases.js\"(exports, module) {\n \"use strict\";\n module.exports = function clearGlCanvases(gd) {\n var fullLayout = gd._fullLayout;\n if (fullLayout._glcanvas && fullLayout._glcanvas.size()) {\n fullLayout._glcanvas.each(function(d) {\n if (d.regl) d.regl.clear({ color: true, depth: true });\n });\n }\n };\n }\n });\n\n // src/fonts/ploticon.js\n var require_ploticon = __commonJS({\n \"src/fonts/ploticon.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n undo: {\n width: 857.1,\n height: 1e3,\n path: \"m857 350q0-87-34-166t-91-137-137-92-166-34q-96 0-183 41t-147 114q-4 6-4 13t5 11l76 77q6 5 14 5 9-1 13-7 41-53 100-82t126-29q58 0 110 23t92 61 61 91 22 111-22 111-61 91-92 61-110 23q-55 0-105-20t-90-57l77-77q17-16 8-38-10-23-33-23h-250q-15 0-25 11t-11 25v250q0 24 22 33 22 10 39-8l72-72q60 57 137 88t159 31q87 0 166-34t137-92 91-137 34-166z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n home: {\n width: 928.6,\n height: 1e3,\n path: \"m786 296v-267q0-15-11-26t-25-10h-214v214h-143v-214h-214q-15 0-25 10t-11 26v267q0 1 0 2t0 2l321 264 321-264q1-1 1-4z m124 39l-34-41q-5-5-12-6h-2q-7 0-12 3l-386 322-386-322q-7-4-13-4-7 2-12 7l-35 41q-4 5-3 13t6 12l401 334q18 15 42 15t43-15l136-114v109q0 8 5 13t13 5h107q8 0 13-5t5-13v-227l122-102q5-5 6-12t-4-13z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n \"camera-retro\": {\n width: 1e3,\n height: 1e3,\n path: \"m518 386q0 8-5 13t-13 5q-37 0-63-27t-26-63q0-8 5-13t13-5 12 5 5 13q0 23 16 38t38 16q8 0 13 5t5 13z m125-73q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z m-572-320h858v71h-858v-71z m643 320q0 89-62 152t-152 62-151-62-63-152 63-151 151-63 152 63 62 151z m-571 358h214v72h-214v-72z m-72-107h858v143h-462l-36-71h-360v-72z m929 143v-714q0-30-21-51t-50-21h-858q-29 0-50 21t-21 51v714q0 30 21 51t50 21h858q29 0 50-21t21-51z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n zoombox: {\n width: 1e3,\n height: 1e3,\n path: \"m1000-25l-250 251c40 63 63 138 63 218 0 224-182 406-407 406-224 0-406-182-406-406s183-406 407-406c80 0 155 22 218 62l250-250 125 125z m-812 250l0 438 437 0 0-438-437 0z m62 375l313 0 0-312-313 0 0 312z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n pan: {\n width: 1e3,\n height: 1e3,\n path: \"m1000 350l-187 188 0-125-250 0 0 250 125 0-188 187-187-187 125 0 0-250-250 0 0 125-188-188 186-187 0 125 252 0 0-250-125 0 187-188 188 188-125 0 0 250 250 0 0-126 187 188z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n zoom_plus: {\n width: 875,\n height: 1e3,\n path: \"m1 787l0-875 875 0 0 875-875 0z m687-500l-187 0 0-187-125 0 0 187-188 0 0 125 188 0 0 187 125 0 0-187 187 0 0-125z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n zoom_minus: {\n width: 875,\n height: 1e3,\n path: \"m0 788l0-876 875 0 0 876-875 0z m688-500l-500 0 0 125 500 0 0-125z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n autoscale: {\n width: 1e3,\n height: 1e3,\n path: \"m250 850l-187 0-63 0 0-62 0-188 63 0 0 188 187 0 0 62z m688 0l-188 0 0-62 188 0 0-188 62 0 0 188 0 62-62 0z m-875-938l0 188-63 0 0-188 0-62 63 0 187 0 0 62-187 0z m875 188l0-188-188 0 0-62 188 0 62 0 0 62 0 188-62 0z m-125 188l-1 0-93-94-156 156 156 156 92-93 2 0 0 250-250 0 0-2 93-92-156-156-156 156 94 92 0 2-250 0 0-250 0 0 93 93 157-156-157-156-93 94 0 0 0-250 250 0 0 0-94 93 156 157 156-157-93-93 0 0 250 0 0 250z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n tooltip_basic: {\n width: 1500,\n height: 1e3,\n path: \"m375 725l0 0-375-375 375-374 0-1 1125 0 0 750-1125 0z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n tooltip_compare: {\n width: 1125,\n height: 1e3,\n path: \"m187 786l0 2-187-188 188-187 0 0 937 0 0 373-938 0z m0-499l0 1-187-188 188-188 0 0 937 0 0 376-938-1z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n plotlylogo: {\n width: 1542,\n height: 1e3,\n path: \"m0-10h182v-140h-182v140z m228 146h183v-286h-183v286z m225 714h182v-1000h-182v1000z m225-285h182v-715h-182v715z m225 142h183v-857h-183v857z m231-428h182v-429h-182v429z m225-291h183v-138h-183v138z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n \"z-axis\": {\n width: 1e3,\n height: 1e3,\n path: \"m833 5l-17 108v41l-130-65 130-66c0 0 0 38 0 39 0-1 36-14 39-25 4-15-6-22-16-30-15-12-39-16-56-20-90-22-187-23-279-23-261 0-341 34-353 59 3 60 228 110 228 110-140-8-351-35-351-116 0-120 293-142 474-142 155 0 477 22 477 142 0 50-74 79-163 96z m-374 94c-58-5-99-21-99-40 0-24 65-43 144-43 79 0 143 19 143 43 0 19-42 34-98 40v216h87l-132 135-133-135h88v-216z m167 515h-136v1c16 16 31 34 46 52l84 109v54h-230v-71h124v-1c-16-17-28-32-44-51l-89-114v-51h245v72z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n \"3d_rotate\": {\n width: 1e3,\n height: 1e3,\n path: \"m922 660c-5 4-9 7-14 11-359 263-580-31-580-31l-102 28 58-400c0 1 1 1 2 2 118 108 351 249 351 249s-62 27-100 42c88 83 222 183 347 122 16-8 30-17 44-27-2 1-4 2-6 4z m36-329c0 0 64 229-88 296-62 27-124 14-175-11 157-78 225-208 249-266 8-19 11-31 11-31 2 5 6 15 11 32-5-13-8-20-8-20z m-775-239c70-31 117-50 198-32-121 80-199 346-199 346l-96-15-58-12c0 0 55-226 155-287z m603 133l-317-139c0 0 4-4 19-14 7-5 24-15 24-15s-177-147-389 4c235-287 536-112 536-112l31-22 100 299-4-1z m-298-153c6-4 14-9 24-15 0 0-17 10-24 15z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n camera: {\n width: 1e3,\n height: 1e3,\n path: \"m500 450c-83 0-150-67-150-150 0-83 67-150 150-150 83 0 150 67 150 150 0 83-67 150-150 150z m400 150h-120c-16 0-34 13-39 29l-31 93c-6 15-23 28-40 28h-340c-16 0-34-13-39-28l-31-94c-6-15-23-28-40-28h-120c-55 0-100-45-100-100v-450c0-55 45-100 100-100h800c55 0 100 45 100 100v450c0 55-45 100-100 100z m-400-550c-138 0-250 112-250 250 0 138 112 250 250 250 138 0 250-112 250-250 0-138-112-250-250-250z m365 380c-19 0-35 16-35 35 0 19 16 35 35 35 19 0 35-16 35-35 0-19-16-35-35-35z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n movie: {\n width: 1e3,\n height: 1e3,\n path: \"m938 413l-188-125c0 37-17 71-44 94 64 38 107 107 107 187 0 121-98 219-219 219-121 0-219-98-219-219 0-61 25-117 66-156h-115c30 33 49 76 49 125 0 103-84 187-187 187s-188-84-188-187c0-57 26-107 65-141-38-22-65-62-65-109v-250c0-70 56-126 125-126h500c69 0 125 56 125 126l188-126c34 0 62 28 62 63v375c0 35-28 63-62 63z m-750 0c-69 0-125 56-125 125s56 125 125 125 125-56 125-125-56-125-125-125z m406-1c-87 0-157 70-157 157 0 86 70 156 157 156s156-70 156-156-70-157-156-157z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n question: {\n width: 857.1,\n height: 1e3,\n path: \"m500 82v107q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-107q0-8 5-13t13-5h107q8 0 13 5t5 13z m143 375q0 49-31 91t-77 65-95 23q-136 0-207-119-9-14 4-24l74-55q4-4 10-4 9 0 14 7 30 38 48 51 19 14 48 14 27 0 48-15t21-33q0-21-11-34t-38-25q-35-16-65-48t-29-70v-20q0-8 5-13t13-5h107q8 0 13 5t5 13q0 10 12 27t30 28q18 10 28 16t25 19 25 27 16 34 7 45z m214-107q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n disk: {\n width: 857.1,\n height: 1e3,\n path: \"m214-7h429v214h-429v-214z m500 0h72v500q0 8-6 21t-11 20l-157 156q-5 6-19 12t-22 5v-232q0-22-15-38t-38-16h-322q-22 0-37 16t-16 38v232h-72v-714h72v232q0 22 16 38t37 16h465q22 0 38-16t15-38v-232z m-214 518v178q0 8-5 13t-13 5h-107q-7 0-13-5t-5-13v-178q0-8 5-13t13-5h107q7 0 13 5t5 13z m357-18v-518q0-22-15-38t-38-16h-750q-23 0-38 16t-16 38v750q0 22 16 38t38 16h517q23 0 50-12t42-26l156-157q16-15 27-42t11-49z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n drawopenpath: {\n width: 70,\n height: 70,\n path: \"M33.21,85.65a7.31,7.31,0,0,1-2.59-.48c-8.16-3.11-9.27-19.8-9.88-41.3-.1-3.58-.19-6.68-.35-9-.15-2.1-.67-3.48-1.43-3.79-2.13-.88-7.91,2.32-12,5.86L3,32.38c1.87-1.64,11.55-9.66,18.27-6.9,2.13.87,4.75,3.14,5.17,9,.17,2.43.26,5.59.36,9.25a224.17,224.17,0,0,0,1.5,23.4c1.54,10.76,4,12.22,4.48,12.4.84.32,2.79-.46,5.76-3.59L43,80.07C41.53,81.57,37.68,85.64,33.21,85.65ZM74.81,69a11.34,11.34,0,0,0,6.09-6.72L87.26,44.5,74.72,32,56.9,38.35c-2.37.86-5.57,3.42-6.61,6L38.65,72.14l8.42,8.43ZM55,46.27a7.91,7.91,0,0,1,3.64-3.17l14.8-5.3,8,8L76.11,60.6l-.06.19a6.37,6.37,0,0,1-3,3.43L48.25,74.59,44.62,71Zm16.57,7.82A6.9,6.9,0,1,0,64.64,61,6.91,6.91,0,0,0,71.54,54.09Zm-4.05,0a2.85,2.85,0,1,1-2.85-2.85A2.86,2.86,0,0,1,67.49,54.09Zm-4.13,5.22L60.5,56.45,44.26,72.7l2.86,2.86ZM97.83,35.67,84.14,22l-8.57,8.57L89.26,44.24Zm-13.69-8,8,8-2.85,2.85-8-8Z\",\n transform: \"matrix(1 0 0 1 -15 -15)\"\n },\n drawclosedpath: {\n width: 90,\n height: 90,\n path: \"M88.41,21.12a26.56,26.56,0,0,0-36.18,0l-2.07,2-2.07-2a26.57,26.57,0,0,0-36.18,0,23.74,23.74,0,0,0,0,34.8L48,90.12a3.22,3.22,0,0,0,4.42,0l36-34.21a23.73,23.73,0,0,0,0-34.79ZM84,51.24,50.16,83.35,16.35,51.25a17.28,17.28,0,0,1,0-25.47,20,20,0,0,1,27.3,0l4.29,4.07a3.23,3.23,0,0,0,4.44,0l4.29-4.07a20,20,0,0,1,27.3,0,17.27,17.27,0,0,1,0,25.46ZM66.76,47.68h-33v6.91h33ZM53.35,35H46.44V68h6.91Z\",\n transform: \"matrix(1 0 0 1 -5 -5)\"\n },\n lasso: {\n width: 1031,\n height: 1e3,\n path: \"m1018 538c-36 207-290 336-568 286-277-48-473-256-436-463 10-57 36-108 76-151-13-66 11-137 68-183 34-28 75-41 114-42l-55-70 0 0c-2-1-3-2-4-3-10-14-8-34 5-45 14-11 34-8 45 4 1 1 2 3 2 5l0 0 113 140c16 11 31 24 45 40 4 3 6 7 8 11 48-3 100 0 151 9 278 48 473 255 436 462z m-624-379c-80 14-149 48-197 96 42 42 109 47 156 9 33-26 47-66 41-105z m-187-74c-19 16-33 37-39 60 50-32 109-55 174-68-42-25-95-24-135 8z m360 75c-34-7-69-9-102-8 8 62-16 128-68 170-73 59-175 54-244-5-9 20-16 40-20 61-28 159 121 317 333 354s407-60 434-217c28-159-121-318-333-355z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n selectbox: {\n width: 1e3,\n height: 1e3,\n path: \"m0 850l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-285l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z\",\n transform: \"matrix(1 0 0 -1 0 850)\"\n },\n drawline: {\n width: 70,\n height: 70,\n path: \"M60.64,62.3a11.29,11.29,0,0,0,6.09-6.72l6.35-17.72L60.54,25.31l-17.82,6.4c-2.36.86-5.57,3.41-6.6,6L24.48,65.5l8.42,8.42ZM40.79,39.63a7.89,7.89,0,0,1,3.65-3.17l14.79-5.31,8,8L61.94,54l-.06.19a6.44,6.44,0,0,1-3,3.43L34.07,68l-3.62-3.63Zm16.57,7.81a6.9,6.9,0,1,0-6.89,6.9A6.9,6.9,0,0,0,57.36,47.44Zm-4,0a2.86,2.86,0,1,1-2.85-2.85A2.86,2.86,0,0,1,53.32,47.44Zm-4.13,5.22L46.33,49.8,30.08,66.05l2.86,2.86ZM83.65,29,70,15.34,61.4,23.9,75.09,37.59ZM70,21.06l8,8-2.84,2.85-8-8ZM87,80.49H10.67V87H87Z\",\n transform: \"matrix(1 0 0 1 -15 -15)\"\n },\n drawrect: {\n width: 80,\n height: 80,\n path: \"M78,22V79H21V22H78m9-9H12V88H87V13ZM68,46.22H31V54H68ZM53,32H45.22V69H53Z\",\n transform: \"matrix(1 0 0 1 -10 -10)\"\n },\n drawcircle: {\n width: 80,\n height: 80,\n path: \"M50,84.72C26.84,84.72,8,69.28,8,50.3S26.84,15.87,50,15.87,92,31.31,92,50.3,73.16,84.72,50,84.72Zm0-60.59c-18.6,0-33.74,11.74-33.74,26.17S31.4,76.46,50,76.46,83.74,64.72,83.74,50.3,68.6,24.13,50,24.13Zm17.15,22h-34v7.11h34Zm-13.8-13H46.24v34h7.11Z\",\n transform: \"matrix(1 0 0 1 -10 -10)\"\n },\n eraseshape: {\n width: 80,\n height: 80,\n path: \"M82.77,78H31.85L6,49.57,31.85,21.14H82.77a8.72,8.72,0,0,1,8.65,8.77V69.24A8.72,8.72,0,0,1,82.77,78ZM35.46,69.84H82.77a.57.57,0,0,0,.49-.6V29.91a.57.57,0,0,0-.49-.61H35.46L17,49.57Zm32.68-34.7-24,24,5,5,24-24Zm-19,.53-5,5,24,24,5-5Z\",\n transform: \"matrix(1 0 0 1 -10 -10)\"\n },\n spikeline: {\n width: 1e3,\n height: 1e3,\n path: \"M512 409c0-57-46-104-103-104-57 0-104 47-104 104 0 57 47 103 104 103 57 0 103-46 103-103z m-327-39l92 0 0 92-92 0z m-185 0l92 0 0 92-92 0z m370-186l92 0 0 93-92 0z m0-184l92 0 0 92-92 0z\",\n transform: \"matrix(1.5 0 0 -1.5 0 850)\"\n },\n pencil: {\n width: 1792,\n height: 1792,\n path: \"M491 1536l91-91-235-235-91 91v107h128v128h107zm523-928q0-22-22-22-10 0-17 7l-542 542q-7 7-7 17 0 22 22 22 10 0 17-7l542-542q7-7 7-17zm-54-192l416 416-832 832h-416v-416zm683 96q0 53-37 90l-166 166-416-416 166-165q36-38 90-38 53 0 91 38l235 234q37 39 37 91z\",\n transform: \"matrix(1 0 0 1 0 1)\"\n },\n newplotlylogo: {\n name: \"newplotlylogo\",\n svg: [\n \"\",\n \" plotly-logomark\",\n \" \",\n \" \",\n \" \",\n \" \",\n \" \",\n \" \",\n \" \",\n \" \",\n \" \",\n \" \",\n \" \",\n \" \",\n \" \",\n \"\"\n ].join(\"\")\n }\n };\n }\n });\n\n // src/components/shapes/draw_newshape/constants.js\n var require_constants4 = __commonJS({\n \"src/components/shapes/draw_newshape/constants.js\"(exports, module) {\n \"use strict\";\n var CIRCLE_SIDES = 32;\n module.exports = {\n CIRCLE_SIDES,\n i000: 0,\n i090: CIRCLE_SIDES / 4,\n i180: CIRCLE_SIDES / 2,\n i270: CIRCLE_SIDES / 4 * 3,\n cos45: Math.cos(Math.PI / 4),\n sin45: Math.sin(Math.PI / 4),\n SQRT2: Math.sqrt(2)\n };\n }\n });\n\n // src/components/selections/helpers.js\n var require_helpers6 = __commonJS({\n \"src/components/selections/helpers.js\"(exports, module) {\n \"use strict\";\n var strTranslate = require_lib().strTranslate;\n function p2r(ax, v) {\n switch (ax.type) {\n case \"log\":\n return ax.p2d(v);\n case \"date\":\n return ax.p2r(v, 0, ax.calendar);\n default:\n return ax.p2r(v);\n }\n }\n function r2p(ax, v) {\n switch (ax.type) {\n case \"log\":\n return ax.d2p(v);\n case \"date\":\n return ax.r2p(v, 0, ax.calendar);\n default:\n return ax.r2p(v);\n }\n }\n function axValue(ax) {\n var index = ax._id.charAt(0) === \"y\" ? 1 : 0;\n return function(v) {\n return p2r(ax, v[index]);\n };\n }\n function getTransform(plotinfo) {\n return strTranslate(\n plotinfo.xaxis._offset,\n plotinfo.yaxis._offset\n );\n }\n module.exports = {\n p2r,\n r2p,\n axValue,\n getTransform\n };\n }\n });\n\n // src/components/shapes/draw_newshape/helpers.js\n var require_helpers7 = __commonJS({\n \"src/components/shapes/draw_newshape/helpers.js\"(exports) {\n \"use strict\";\n var parseSvgPath = require_parse_svg_path();\n var constants = require_constants4();\n var CIRCLE_SIDES = constants.CIRCLE_SIDES;\n var SQRT2 = constants.SQRT2;\n var cartesianHelpers = require_helpers6();\n var p2r = cartesianHelpers.p2r;\n var r2p = cartesianHelpers.r2p;\n var iC = [0, 3, 4, 5, 6, 1, 2];\n var iQS = [0, 3, 4, 1, 2];\n exports.writePaths = function(polygons) {\n var nI = polygons.length;\n if (!nI) return \"M0,0Z\";\n var str = \"\";\n for (var i = 0; i < nI; i++) {\n var nJ = polygons[i].length;\n for (var j = 0; j < nJ; j++) {\n var w = polygons[i][j][0];\n if (w === \"Z\") {\n str += \"Z\";\n } else {\n var nK = polygons[i][j].length;\n for (var k = 0; k < nK; k++) {\n var realK = k;\n if (w === \"Q\" || w === \"S\") {\n realK = iQS[k];\n } else if (w === \"C\") {\n realK = iC[k];\n }\n str += polygons[i][j][realK];\n if (k > 0 && k < nK - 1) {\n str += \",\";\n }\n }\n }\n }\n }\n return str;\n };\n exports.readPaths = function(str, gd, plotinfo, isActiveShape) {\n var cmd = parseSvgPath(str);\n var polys = [];\n var n = -1;\n var newPoly = function() {\n n++;\n polys[n] = [];\n };\n var k;\n var x = 0;\n var y = 0;\n var initX;\n var initY;\n var recStart = function() {\n initX = x;\n initY = y;\n };\n recStart();\n for (var i = 0; i < cmd.length; i++) {\n var newPos = [];\n var x1, x2, y1, y2;\n var c = cmd[i][0];\n var w = c;\n switch (c) {\n case \"M\":\n newPoly();\n x = +cmd[i][1];\n y = +cmd[i][2];\n newPos.push([w, x, y]);\n recStart();\n break;\n case \"Q\":\n case \"S\":\n x1 = +cmd[i][1];\n y1 = +cmd[i][2];\n x = +cmd[i][3];\n y = +cmd[i][4];\n newPos.push([w, x, y, x1, y1]);\n break;\n case \"C\":\n x1 = +cmd[i][1];\n y1 = +cmd[i][2];\n x2 = +cmd[i][3];\n y2 = +cmd[i][4];\n x = +cmd[i][5];\n y = +cmd[i][6];\n newPos.push([w, x, y, x1, y1, x2, y2]);\n break;\n case \"T\":\n case \"L\":\n x = +cmd[i][1];\n y = +cmd[i][2];\n newPos.push([w, x, y]);\n break;\n case \"H\":\n w = \"L\";\n x = +cmd[i][1];\n newPos.push([w, x, y]);\n break;\n case \"V\":\n w = \"L\";\n y = +cmd[i][1];\n newPos.push([w, x, y]);\n break;\n case \"A\":\n w = \"L\";\n var rx = +cmd[i][1];\n var ry = +cmd[i][2];\n if (!+cmd[i][4]) {\n rx = -rx;\n ry = -ry;\n }\n var cenX = x - rx;\n var cenY = y;\n for (k = 1; k <= CIRCLE_SIDES / 2; k++) {\n var t = 2 * Math.PI * k / CIRCLE_SIDES;\n newPos.push([\n w,\n cenX + rx * Math.cos(t),\n cenY + ry * Math.sin(t)\n ]);\n }\n break;\n case \"Z\":\n if (x !== initX || y !== initY) {\n x = initX;\n y = initY;\n newPos.push([w, x, y]);\n }\n break;\n }\n var domain = (plotinfo || {}).domain;\n var size = gd._fullLayout._size;\n var xPixelSized = plotinfo && plotinfo.xsizemode === \"pixel\";\n var yPixelSized = plotinfo && plotinfo.ysizemode === \"pixel\";\n var noOffset = isActiveShape === false;\n for (var j = 0; j < newPos.length; j++) {\n for (k = 0; k + 2 < 7; k += 2) {\n var _x = newPos[j][k + 1];\n var _y = newPos[j][k + 2];\n if (_x === void 0 || _y === void 0) continue;\n x = _x;\n y = _y;\n if (plotinfo) {\n if (plotinfo.xaxis && plotinfo.xaxis.p2r) {\n if (noOffset) _x -= plotinfo.xaxis._offset;\n if (xPixelSized) {\n _x = r2p(plotinfo.xaxis, plotinfo.xanchor) + _x;\n } else {\n _x = p2r(plotinfo.xaxis, _x);\n }\n } else {\n if (noOffset) _x -= size.l;\n if (domain) _x = domain.x[0] + _x / size.w;\n else _x = _x / size.w;\n }\n if (plotinfo.yaxis && plotinfo.yaxis.p2r) {\n if (noOffset) _y -= plotinfo.yaxis._offset;\n if (yPixelSized) {\n _y = r2p(plotinfo.yaxis, plotinfo.yanchor) - _y;\n } else {\n _y = p2r(plotinfo.yaxis, _y);\n }\n } else {\n if (noOffset) _y -= size.t;\n if (domain) _y = domain.y[1] - _y / size.h;\n else _y = 1 - _y / size.h;\n }\n }\n newPos[j][k + 1] = _x;\n newPos[j][k + 2] = _y;\n }\n polys[n].push(\n newPos[j].slice()\n );\n }\n }\n return polys;\n };\n function almostEq(a, b) {\n return Math.abs(a - b) <= 1e-6;\n }\n function dist(a, b) {\n var dx = b[1] - a[1];\n var dy = b[2] - a[2];\n return Math.sqrt(\n dx * dx + dy * dy\n );\n }\n exports.pointsOnRectangle = function(cell) {\n var len = cell.length;\n if (len !== 5) return false;\n for (var j = 1; j < 3; j++) {\n var e01 = cell[0][j] - cell[1][j];\n var e32 = cell[3][j] - cell[2][j];\n if (!almostEq(e01, e32)) return false;\n var e03 = cell[0][j] - cell[3][j];\n var e12 = cell[1][j] - cell[2][j];\n if (!almostEq(e03, e12)) return false;\n }\n if (!almostEq(cell[0][1], cell[1][1]) && !almostEq(cell[0][1], cell[3][1])) return false;\n return !!(dist(cell[0], cell[1]) * dist(cell[0], cell[3]));\n };\n exports.pointsOnEllipse = function(cell) {\n var len = cell.length;\n if (len !== CIRCLE_SIDES + 1) return false;\n len = CIRCLE_SIDES;\n for (var i = 0; i < len; i++) {\n var k = (len * 2 - i) % len;\n var k2 = (len / 2 + k) % len;\n var i2 = (len / 2 + i) % len;\n if (!almostEq(\n dist(cell[i], cell[i2]),\n dist(cell[k], cell[k2])\n )) return false;\n }\n return true;\n };\n exports.handleEllipse = function(isEllipse, start, end) {\n if (!isEllipse) return [start, end];\n var pos = exports.ellipseOver({\n x0: start[0],\n y0: start[1],\n x1: end[0],\n y1: end[1]\n });\n var cx = (pos.x1 + pos.x0) / 2;\n var cy = (pos.y1 + pos.y0) / 2;\n var rx = (pos.x1 - pos.x0) / 2;\n var ry = (pos.y1 - pos.y0) / 2;\n if (!rx) rx = ry = ry / SQRT2;\n if (!ry) ry = rx = rx / SQRT2;\n var cell = [];\n for (var i = 0; i < CIRCLE_SIDES; i++) {\n var t = i * 2 * Math.PI / CIRCLE_SIDES;\n cell.push([\n cx + rx * Math.cos(t),\n cy + ry * Math.sin(t)\n ]);\n }\n return cell;\n };\n exports.ellipseOver = function(pos) {\n var x0 = pos.x0;\n var y0 = pos.y0;\n var x1 = pos.x1;\n var y1 = pos.y1;\n var dx = x1 - x0;\n var dy = y1 - y0;\n x0 -= dx;\n y0 -= dy;\n var cx = (x0 + x1) / 2;\n var cy = (y0 + y1) / 2;\n var scale = SQRT2;\n dx *= scale;\n dy *= scale;\n return {\n x0: cx - dx,\n y0: cy - dy,\n x1: cx + dx,\n y1: cy + dy\n };\n };\n exports.fixDatesForPaths = function(polygons, xaxis, yaxis) {\n var xIsDate = xaxis.type === \"date\";\n var yIsDate = yaxis.type === \"date\";\n if (!xIsDate && !yIsDate) return polygons;\n for (var i = 0; i < polygons.length; i++) {\n for (var j = 0; j < polygons[i].length; j++) {\n for (var k = 0; k + 2 < polygons[i][j].length; k += 2) {\n if (xIsDate) polygons[i][j][k + 1] = polygons[i][j][k + 1].replace(\" \", \"_\");\n if (yIsDate) polygons[i][j][k + 2] = polygons[i][j][k + 2].replace(\" \", \"_\");\n }\n }\n }\n return polygons;\n };\n }\n });\n\n // src/components/shapes/draw_newshape/newshapes.js\n var require_newshapes = __commonJS({\n \"src/components/shapes/draw_newshape/newshapes.js\"(exports, module) {\n \"use strict\";\n var dragHelpers = require_helpers5();\n var drawMode = dragHelpers.drawMode;\n var openMode = dragHelpers.openMode;\n var constants = require_constants4();\n var i000 = constants.i000;\n var i090 = constants.i090;\n var i180 = constants.i180;\n var i270 = constants.i270;\n var cos45 = constants.cos45;\n var sin45 = constants.sin45;\n var cartesianHelpers = require_helpers6();\n var p2r = cartesianHelpers.p2r;\n var r2p = cartesianHelpers.r2p;\n var handleOutline = require_handle_outline();\n var clearOutline = handleOutline.clearOutline;\n var helpers = require_helpers7();\n var readPaths = helpers.readPaths;\n var writePaths = helpers.writePaths;\n var ellipseOver = helpers.ellipseOver;\n var fixDatesForPaths = helpers.fixDatesForPaths;\n function newShapes(outlines, dragOptions) {\n if (!outlines.length) return;\n var e = outlines[0][0];\n if (!e) return;\n var gd = dragOptions.gd;\n var isActiveShape = dragOptions.isActiveShape;\n var dragmode = dragOptions.dragmode;\n var shapes = (gd.layout || {}).shapes || [];\n if (!drawMode(dragmode) && isActiveShape !== void 0) {\n var id = gd._fullLayout._activeShapeIndex;\n if (id < shapes.length) {\n switch (gd._fullLayout.shapes[id].type) {\n case \"rect\":\n dragmode = \"drawrect\";\n break;\n case \"circle\":\n dragmode = \"drawcircle\";\n break;\n case \"line\":\n dragmode = \"drawline\";\n break;\n case \"path\":\n var path = shapes[id].path || \"\";\n if (path[path.length - 1] === \"Z\") {\n dragmode = \"drawclosedpath\";\n } else {\n dragmode = \"drawopenpath\";\n }\n break;\n }\n }\n }\n var newShape = createShapeObj(outlines, dragOptions, dragmode);\n clearOutline(gd);\n var editHelpers = dragOptions.editHelpers;\n var modifyItem = (editHelpers || {}).modifyItem;\n var allShapes = [];\n for (var q = 0; q < shapes.length; q++) {\n var beforeEdit = gd._fullLayout.shapes[q];\n allShapes[q] = beforeEdit._input;\n if (isActiveShape !== void 0 && q === gd._fullLayout._activeShapeIndex) {\n var afterEdit = newShape;\n switch (beforeEdit.type) {\n case \"line\":\n case \"rect\":\n case \"circle\":\n modifyItem(\"x0\", afterEdit.x0 - (beforeEdit.x0shift || 0));\n modifyItem(\"x1\", afterEdit.x1 - (beforeEdit.x1shift || 0));\n modifyItem(\"y0\", afterEdit.y0 - (beforeEdit.y0shift || 0));\n modifyItem(\"y1\", afterEdit.y1 - (beforeEdit.y1shift || 0));\n break;\n case \"path\":\n modifyItem(\"path\", afterEdit.path);\n break;\n }\n }\n }\n if (isActiveShape === void 0) {\n allShapes.push(newShape);\n return allShapes;\n }\n return editHelpers ? editHelpers.getUpdateObj() : {};\n }\n function createShapeObj(outlines, dragOptions, dragmode) {\n var e = outlines[0][0];\n var gd = dragOptions.gd;\n var d = e.getAttribute(\"d\");\n var newStyle = gd._fullLayout.newshape;\n var plotinfo = dragOptions.plotinfo;\n var isActiveShape = dragOptions.isActiveShape;\n var xaxis = plotinfo.xaxis;\n var yaxis = plotinfo.yaxis;\n var xPaper = !!plotinfo.domain || !plotinfo.xaxis;\n var yPaper = !!plotinfo.domain || !plotinfo.yaxis;\n var isOpenMode = openMode(dragmode);\n var polygons = readPaths(d, gd, plotinfo, isActiveShape);\n var newShape = {\n editable: true,\n visible: newStyle.visible,\n name: newStyle.name,\n showlegend: newStyle.showlegend,\n legend: newStyle.legend,\n legendwidth: newStyle.legendwidth,\n legendgroup: newStyle.legendgroup,\n legendgrouptitle: {\n text: newStyle.legendgrouptitle.text,\n font: newStyle.legendgrouptitle.font\n },\n legendrank: newStyle.legendrank,\n label: newStyle.label,\n xref: xPaper ? \"paper\" : xaxis._id,\n yref: yPaper ? \"paper\" : yaxis._id,\n layer: newStyle.layer,\n opacity: newStyle.opacity,\n line: {\n color: newStyle.line.color,\n width: newStyle.line.width,\n dash: newStyle.line.dash\n }\n };\n if (!isOpenMode) {\n newShape.fillcolor = newStyle.fillcolor;\n newShape.fillrule = newStyle.fillrule;\n }\n var cell;\n if (polygons.length === 1) cell = polygons[0];\n if (cell && cell.length === 5 && // ensure we only have 4 corners for a rect\n dragmode === \"drawrect\") {\n newShape.type = \"rect\";\n newShape.x0 = cell[0][1];\n newShape.y0 = cell[0][2];\n newShape.x1 = cell[2][1];\n newShape.y1 = cell[2][2];\n } else if (cell && dragmode === \"drawline\") {\n newShape.type = \"line\";\n newShape.x0 = cell[0][1];\n newShape.y0 = cell[0][2];\n newShape.x1 = cell[1][1];\n newShape.y1 = cell[1][2];\n } else if (cell && dragmode === \"drawcircle\") {\n newShape.type = \"circle\";\n var xA = cell[i000][1];\n var xB = cell[i090][1];\n var xC = cell[i180][1];\n var xD = cell[i270][1];\n var yA = cell[i000][2];\n var yB = cell[i090][2];\n var yC = cell[i180][2];\n var yD = cell[i270][2];\n var xDateOrLog = plotinfo.xaxis && (plotinfo.xaxis.type === \"date\" || plotinfo.xaxis.type === \"log\");\n var yDateOrLog = plotinfo.yaxis && (plotinfo.yaxis.type === \"date\" || plotinfo.yaxis.type === \"log\");\n if (xDateOrLog) {\n xA = r2p(plotinfo.xaxis, xA);\n xB = r2p(plotinfo.xaxis, xB);\n xC = r2p(plotinfo.xaxis, xC);\n xD = r2p(plotinfo.xaxis, xD);\n }\n if (yDateOrLog) {\n yA = r2p(plotinfo.yaxis, yA);\n yB = r2p(plotinfo.yaxis, yB);\n yC = r2p(plotinfo.yaxis, yC);\n yD = r2p(plotinfo.yaxis, yD);\n }\n var x0 = (xB + xD) / 2;\n var y0 = (yA + yC) / 2;\n var rx = (xD - xB + xC - xA) / 2;\n var ry = (yD - yB + yC - yA) / 2;\n var pos = ellipseOver({\n x0,\n y0,\n x1: x0 + rx * cos45,\n y1: y0 + ry * sin45\n });\n if (xDateOrLog) {\n pos.x0 = p2r(plotinfo.xaxis, pos.x0);\n pos.x1 = p2r(plotinfo.xaxis, pos.x1);\n }\n if (yDateOrLog) {\n pos.y0 = p2r(plotinfo.yaxis, pos.y0);\n pos.y1 = p2r(plotinfo.yaxis, pos.y1);\n }\n newShape.x0 = pos.x0;\n newShape.y0 = pos.y0;\n newShape.x1 = pos.x1;\n newShape.y1 = pos.y1;\n } else {\n newShape.type = \"path\";\n if (xaxis && yaxis) fixDatesForPaths(polygons, xaxis, yaxis);\n newShape.path = writePaths(polygons);\n cell = null;\n }\n return newShape;\n }\n module.exports = {\n newShapes,\n createShapeObj\n };\n }\n });\n\n // src/components/selections/draw_newselection/newselections.js\n var require_newselections = __commonJS({\n \"src/components/selections/draw_newselection/newselections.js\"(exports, module) {\n \"use strict\";\n var dragHelpers = require_helpers5();\n var selectMode = dragHelpers.selectMode;\n var handleOutline = require_handle_outline();\n var clearOutline = handleOutline.clearOutline;\n var helpers = require_helpers7();\n var readPaths = helpers.readPaths;\n var writePaths = helpers.writePaths;\n var fixDatesForPaths = helpers.fixDatesForPaths;\n module.exports = function newSelections(outlines, dragOptions) {\n if (!outlines.length) return;\n var e = outlines[0][0];\n if (!e) return;\n var d = e.getAttribute(\"d\");\n var gd = dragOptions.gd;\n var newStyle = gd._fullLayout.newselection;\n var plotinfo = dragOptions.plotinfo;\n var xaxis = plotinfo.xaxis;\n var yaxis = plotinfo.yaxis;\n var isActiveSelection = dragOptions.isActiveSelection;\n var dragmode = dragOptions.dragmode;\n var selections = (gd.layout || {}).selections || [];\n if (!selectMode(dragmode) && isActiveSelection !== void 0) {\n var id = gd._fullLayout._activeSelectionIndex;\n if (id < selections.length) {\n switch (gd._fullLayout.selections[id].type) {\n case \"rect\":\n dragmode = \"select\";\n break;\n case \"path\":\n dragmode = \"lasso\";\n break;\n }\n }\n }\n var polygons = readPaths(d, gd, plotinfo, isActiveSelection);\n var newSelection = {\n xref: xaxis._id,\n yref: yaxis._id,\n opacity: newStyle.opacity,\n line: {\n color: newStyle.line.color,\n width: newStyle.line.width,\n dash: newStyle.line.dash\n }\n };\n var cell;\n if (polygons.length === 1) cell = polygons[0];\n if (cell && cell.length === 5 && // ensure we only have 4 corners for a rect\n dragmode === \"select\") {\n newSelection.type = \"rect\";\n newSelection.x0 = cell[0][1];\n newSelection.y0 = cell[0][2];\n newSelection.x1 = cell[2][1];\n newSelection.y1 = cell[2][2];\n } else {\n newSelection.type = \"path\";\n if (xaxis && yaxis) fixDatesForPaths(polygons, xaxis, yaxis);\n newSelection.path = writePaths(polygons);\n cell = null;\n }\n clearOutline(gd);\n var editHelpers = dragOptions.editHelpers;\n var modifyItem = (editHelpers || {}).modifyItem;\n var allSelections = [];\n for (var q = 0; q < selections.length; q++) {\n var beforeEdit = gd._fullLayout.selections[q];\n if (!beforeEdit) {\n allSelections[q] = beforeEdit;\n continue;\n }\n allSelections[q] = beforeEdit._input;\n if (isActiveSelection !== void 0 && q === gd._fullLayout._activeSelectionIndex) {\n var afterEdit = newSelection;\n switch (beforeEdit.type) {\n case \"rect\":\n modifyItem(\"x0\", afterEdit.x0);\n modifyItem(\"x1\", afterEdit.x1);\n modifyItem(\"y0\", afterEdit.y0);\n modifyItem(\"y1\", afterEdit.y1);\n break;\n case \"path\":\n modifyItem(\"path\", afterEdit.path);\n break;\n }\n }\n }\n if (isActiveSelection === void 0) {\n allSelections.push(newSelection);\n return allSelections;\n }\n return editHelpers ? editHelpers.getUpdateObj() : {};\n };\n }\n });\n\n // src/components/shapes/constants.js\n var require_constants5 = __commonJS({\n \"src/components/shapes/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n segmentRE: /[MLHVQCTSZ][^MLHVQCTSZ]*/g,\n paramRE: /[^\\s,]+/g,\n // which numbers in each path segment are x (or y) values\n // drawn is which param is a drawn point, as opposed to a\n // control point (which doesn't count toward autorange.\n // TODO: this means curved paths could extend beyond the\n // autorange bounds. This is a bit tricky to get right\n // unless we revert to bounding boxes, but perhaps there's\n // a calculation we could do...)\n paramIsX: {\n M: { 0: true, drawn: 0 },\n L: { 0: true, drawn: 0 },\n H: { 0: true, drawn: 0 },\n V: {},\n Q: { 0: true, 2: true, drawn: 2 },\n C: { 0: true, 2: true, 4: true, drawn: 4 },\n T: { 0: true, drawn: 0 },\n S: { 0: true, 2: true, drawn: 2 },\n // A: {0: true, 5: true},\n Z: {}\n },\n paramIsY: {\n M: { 1: true, drawn: 1 },\n L: { 1: true, drawn: 1 },\n H: {},\n V: { 0: true, drawn: 0 },\n Q: { 1: true, 3: true, drawn: 3 },\n C: { 1: true, 3: true, 5: true, drawn: 5 },\n T: { 1: true, drawn: 1 },\n S: { 1: true, 3: true, drawn: 5 },\n // A: {1: true, 6: true},\n Z: {}\n },\n numParams: {\n M: 2,\n L: 2,\n H: 1,\n V: 1,\n Q: 4,\n C: 6,\n T: 2,\n S: 4,\n // A: 7,\n Z: 0\n }\n };\n }\n });\n\n // src/components/shapes/helpers.js\n var require_helpers8 = __commonJS({\n \"src/components/shapes/helpers.js\"(exports) {\n \"use strict\";\n var constants = require_constants5();\n var Lib = require_lib();\n var Axes = require_axes();\n exports.rangeToShapePosition = function(ax) {\n return ax.type === \"log\" ? ax.r2d : function(v) {\n return v;\n };\n };\n exports.shapePositionToRange = function(ax) {\n return ax.type === \"log\" ? ax.d2r : function(v) {\n return v;\n };\n };\n exports.decodeDate = function(convertToPx) {\n return function(v) {\n if (v.replace) v = v.replace(\"_\", \" \");\n return convertToPx(v);\n };\n };\n exports.encodeDate = function(convertToDate) {\n return function(v) {\n return convertToDate(v).replace(\" \", \"_\");\n };\n };\n exports.extractPathCoords = function(path, paramsToUse, isRaw) {\n var extractedCoordinates = [];\n var segments = path.match(constants.segmentRE);\n segments.forEach(function(segment) {\n var relevantParamIdx = paramsToUse[segment.charAt(0)].drawn;\n if (relevantParamIdx === void 0) return;\n var params = segment.substr(1).match(constants.paramRE);\n if (!params || params.length < relevantParamIdx) return;\n var str = params[relevantParamIdx];\n var pos = isRaw ? str : Lib.cleanNumber(str);\n extractedCoordinates.push(pos);\n });\n return extractedCoordinates;\n };\n exports.getDataToPixel = function(gd, axis, shift, isVertical, refType) {\n var gs = gd._fullLayout._size;\n var dataToPixel;\n if (axis) {\n if (refType === \"domain\") {\n dataToPixel = function(v) {\n return axis._length * (isVertical ? 1 - v : v) + axis._offset;\n };\n } else {\n var d2r = exports.shapePositionToRange(axis);\n dataToPixel = function(v) {\n var shiftPixels = getPixelShift(axis, shift);\n return axis._offset + axis.r2p(d2r(v, true)) + shiftPixels;\n };\n if (axis.type === \"date\") dataToPixel = exports.decodeDate(dataToPixel);\n }\n } else if (isVertical) {\n dataToPixel = function(v) {\n return gs.t + gs.h * (1 - v);\n };\n } else {\n dataToPixel = function(v) {\n return gs.l + gs.w * v;\n };\n }\n return dataToPixel;\n };\n exports.getPixelToData = function(gd, axis, isVertical, opt) {\n var gs = gd._fullLayout._size;\n var pixelToData;\n if (axis) {\n if (opt === \"domain\") {\n pixelToData = function(p) {\n var q = (p - axis._offset) / axis._length;\n return isVertical ? 1 - q : q;\n };\n } else {\n var r2d = exports.rangeToShapePosition(axis);\n pixelToData = function(p) {\n return r2d(axis.p2r(p - axis._offset));\n };\n }\n } else if (isVertical) {\n pixelToData = function(p) {\n return 1 - (p - gs.t) / gs.h;\n };\n } else {\n pixelToData = function(p) {\n return (p - gs.l) / gs.w;\n };\n }\n return pixelToData;\n };\n exports.roundPositionForSharpStrokeRendering = function(pos, strokeWidth) {\n var strokeWidthIsOdd = Math.round(strokeWidth % 2) === 1;\n var posValAsInt = Math.round(pos);\n return strokeWidthIsOdd ? posValAsInt + 0.5 : posValAsInt;\n };\n exports.makeShapesOptionsAndPlotinfo = function(gd, index) {\n var options = gd._fullLayout.shapes[index] || {};\n var plotinfo = gd._fullLayout._plots[options.xref + options.yref];\n var hasPlotinfo = !!plotinfo;\n if (hasPlotinfo) {\n plotinfo._hadPlotinfo = true;\n } else {\n plotinfo = {};\n if (options.xref && options.xref !== \"paper\") plotinfo.xaxis = gd._fullLayout[options.xref + \"axis\"];\n if (options.yref && options.yref !== \"paper\") plotinfo.yaxis = gd._fullLayout[options.yref + \"axis\"];\n }\n plotinfo.xsizemode = options.xsizemode;\n plotinfo.ysizemode = options.ysizemode;\n plotinfo.xanchor = options.xanchor;\n plotinfo.yanchor = options.yanchor;\n return {\n options,\n plotinfo\n };\n };\n exports.makeSelectionsOptionsAndPlotinfo = function(gd, index) {\n var options = gd._fullLayout.selections[index] || {};\n var plotinfo = gd._fullLayout._plots[options.xref + options.yref];\n var hasPlotinfo = !!plotinfo;\n if (hasPlotinfo) {\n plotinfo._hadPlotinfo = true;\n } else {\n plotinfo = {};\n if (options.xref) plotinfo.xaxis = gd._fullLayout[options.xref + \"axis\"];\n if (options.yref) plotinfo.yaxis = gd._fullLayout[options.yref + \"axis\"];\n }\n return {\n options,\n plotinfo\n };\n };\n exports.getPathString = function(gd, options) {\n var type = options.type;\n var xRefType = Axes.getRefType(options.xref);\n var yRefType = Axes.getRefType(options.yref);\n var xa = Axes.getFromId(gd, options.xref);\n var ya = Axes.getFromId(gd, options.yref);\n var gs = gd._fullLayout._size;\n var x2r, x2p, y2r, y2p;\n var xShiftStart = getPixelShift(xa, options.x0shift);\n var xShiftEnd = getPixelShift(xa, options.x1shift);\n var yShiftStart = getPixelShift(ya, options.y0shift);\n var yShiftEnd = getPixelShift(ya, options.y1shift);\n var x0, x1, y0, y1;\n if (xa) {\n if (xRefType === \"domain\") {\n x2p = function(v) {\n return xa._offset + xa._length * v;\n };\n } else {\n x2r = exports.shapePositionToRange(xa);\n x2p = function(v) {\n return xa._offset + xa.r2p(x2r(v, true));\n };\n }\n } else {\n x2p = function(v) {\n return gs.l + gs.w * v;\n };\n }\n if (ya) {\n if (yRefType === \"domain\") {\n y2p = function(v) {\n return ya._offset + ya._length * (1 - v);\n };\n } else {\n y2r = exports.shapePositionToRange(ya);\n y2p = function(v) {\n return ya._offset + ya.r2p(y2r(v, true));\n };\n }\n } else {\n y2p = function(v) {\n return gs.t + gs.h * (1 - v);\n };\n }\n if (type === \"path\") {\n if (xa && xa.type === \"date\") x2p = exports.decodeDate(x2p);\n if (ya && ya.type === \"date\") y2p = exports.decodeDate(y2p);\n return convertPath(options, x2p, y2p);\n }\n if (options.xsizemode === \"pixel\") {\n var xAnchorPos = x2p(options.xanchor);\n x0 = xAnchorPos + options.x0 + xShiftStart;\n x1 = xAnchorPos + options.x1 + xShiftEnd;\n } else {\n x0 = x2p(options.x0) + xShiftStart;\n x1 = x2p(options.x1) + xShiftEnd;\n }\n if (options.ysizemode === \"pixel\") {\n var yAnchorPos = y2p(options.yanchor);\n y0 = yAnchorPos - options.y0 + yShiftStart;\n y1 = yAnchorPos - options.y1 + yShiftEnd;\n } else {\n y0 = y2p(options.y0) + yShiftStart;\n y1 = y2p(options.y1) + yShiftEnd;\n }\n if (type === \"line\") return \"M\" + x0 + \",\" + y0 + \"L\" + x1 + \",\" + y1;\n if (type === \"rect\") return \"M\" + x0 + \",\" + y0 + \"H\" + x1 + \"V\" + y1 + \"H\" + x0 + \"Z\";\n var cx = (x0 + x1) / 2;\n var cy = (y0 + y1) / 2;\n var rx = Math.abs(cx - x0);\n var ry = Math.abs(cy - y0);\n var rArc = \"A\" + rx + \",\" + ry;\n var rightPt = cx + rx + \",\" + cy;\n var topPt = cx + \",\" + (cy - ry);\n return \"M\" + rightPt + rArc + \" 0 1,1 \" + topPt + rArc + \" 0 0,1 \" + rightPt + \"Z\";\n };\n function convertPath(options, x2p, y2p) {\n var pathIn = options.path;\n var xSizemode = options.xsizemode;\n var ySizemode = options.ysizemode;\n var xAnchor = options.xanchor;\n var yAnchor = options.yanchor;\n return pathIn.replace(constants.segmentRE, function(segment) {\n var paramNumber = 0;\n var segmentType = segment.charAt(0);\n var xParams = constants.paramIsX[segmentType];\n var yParams = constants.paramIsY[segmentType];\n var nParams = constants.numParams[segmentType];\n var paramString = segment.substr(1).replace(constants.paramRE, function(param) {\n if (xParams[paramNumber]) {\n if (xSizemode === \"pixel\") param = x2p(xAnchor) + Number(param);\n else param = x2p(param);\n } else if (yParams[paramNumber]) {\n if (ySizemode === \"pixel\") param = y2p(yAnchor) - Number(param);\n else param = y2p(param);\n }\n paramNumber++;\n if (paramNumber > nParams) param = \"X\";\n return param;\n });\n if (paramNumber > nParams) {\n paramString = paramString.replace(/[\\s,]*X.*/, \"\");\n Lib.log(\"Ignoring extra params in segment \" + segment);\n }\n return segmentType + paramString;\n });\n }\n function getPixelShift(axis, shift) {\n shift = shift || 0;\n var shiftPixels = 0;\n if (shift && axis && (axis.type === \"category\" || axis.type === \"multicategory\")) {\n shiftPixels = (axis.r2p(1) - axis.r2p(0)) * shift;\n }\n return shiftPixels;\n }\n }\n });\n\n // src/components/shapes/display_labels.js\n var require_display_labels = __commonJS({\n \"src/components/shapes/display_labels.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Axes = require_axes();\n var svgTextUtils = require_svg_text_utils();\n var Drawing = require_drawing();\n var readPaths = require_helpers7().readPaths;\n var helpers = require_helpers8();\n var getPathString = helpers.getPathString;\n var shapeLabelTexttemplateVars = require_label_texttemplate();\n var FROM_TL = require_alignment().FROM_TL;\n module.exports = function drawLabel(gd, index, options, shapeGroup) {\n shapeGroup.selectAll(\".shape-label\").remove();\n if (!(options.label.text || options.label.texttemplate)) return;\n var text;\n if (options.label.texttemplate) {\n var templateValues = {};\n if (options.type !== \"path\") {\n var _xa = Axes.getFromId(gd, options.xref);\n var _ya = Axes.getFromId(gd, options.yref);\n for (var key in shapeLabelTexttemplateVars) {\n var val = shapeLabelTexttemplateVars[key](options, _xa, _ya);\n if (val !== void 0) templateValues[key] = val;\n }\n }\n text = Lib.texttemplateStringForShapes(\n options.label.texttemplate,\n {},\n gd._fullLayout._d3locale,\n templateValues\n );\n } else {\n text = options.label.text;\n }\n var labelGroupAttrs = {\n \"data-index\": index\n };\n var font = options.label.font;\n var labelTextAttrs = {\n \"data-notex\": 1\n };\n var labelGroup = shapeGroup.append(\"g\").attr(labelGroupAttrs).classed(\"shape-label\", true);\n var labelText = labelGroup.append(\"text\").attr(labelTextAttrs).classed(\"shape-label-text\", true).text(text);\n var shapex0, shapex1, shapey0, shapey1;\n if (options.path) {\n var d = getPathString(gd, options);\n var polygons = readPaths(d, gd);\n shapex0 = Infinity;\n shapey0 = Infinity;\n shapex1 = -Infinity;\n shapey1 = -Infinity;\n for (var i = 0; i < polygons.length; i++) {\n for (var j = 0; j < polygons[i].length; j++) {\n var p = polygons[i][j];\n for (var k = 1; k < p.length; k += 2) {\n var _x = p[k];\n var _y = p[k + 1];\n shapex0 = Math.min(shapex0, _x);\n shapex1 = Math.max(shapex1, _x);\n shapey0 = Math.min(shapey0, _y);\n shapey1 = Math.max(shapey1, _y);\n }\n }\n }\n } else {\n var xa = Axes.getFromId(gd, options.xref);\n var xShiftStart = options.x0shift;\n var xShiftEnd = options.x1shift;\n var xRefType = Axes.getRefType(options.xref);\n var ya = Axes.getFromId(gd, options.yref);\n var yShiftStart = options.y0shift;\n var yShiftEnd = options.y1shift;\n var yRefType = Axes.getRefType(options.yref);\n var x2p = function(v, shift) {\n var dataToPixel = helpers.getDataToPixel(gd, xa, shift, false, xRefType);\n return dataToPixel(v);\n };\n var y2p = function(v, shift) {\n var dataToPixel = helpers.getDataToPixel(gd, ya, shift, true, yRefType);\n return dataToPixel(v);\n };\n shapex0 = x2p(options.x0, xShiftStart);\n shapex1 = x2p(options.x1, xShiftEnd);\n shapey0 = y2p(options.y0, yShiftStart);\n shapey1 = y2p(options.y1, yShiftEnd);\n }\n var textangle = options.label.textangle;\n if (textangle === \"auto\") {\n if (options.type === \"line\") {\n textangle = calcTextAngle(shapex0, shapey0, shapex1, shapey1);\n } else {\n textangle = 0;\n }\n }\n labelText.call(function(s) {\n s.call(Drawing.font, font).attr({});\n svgTextUtils.convertToTspans(s, gd);\n return s;\n });\n var textBB = Drawing.bBox(labelText.node());\n var textPos = calcTextPosition(shapex0, shapey0, shapex1, shapey1, options, textangle, textBB);\n var textx = textPos.textx;\n var texty = textPos.texty;\n var xanchor = textPos.xanchor;\n labelText.attr({\n \"text-anchor\": {\n left: \"start\",\n center: \"middle\",\n right: \"end\"\n }[xanchor],\n y: texty,\n x: textx,\n transform: \"rotate(\" + textangle + \",\" + textx + \",\" + texty + \")\"\n }).call(svgTextUtils.positionText, textx, texty);\n };\n function calcTextAngle(shapex0, shapey0, shapex1, shapey1) {\n var dy, dx;\n dx = Math.abs(shapex1 - shapex0);\n if (shapex1 >= shapex0) {\n dy = shapey0 - shapey1;\n } else {\n dy = shapey1 - shapey0;\n }\n return -180 / Math.PI * Math.atan2(dy, dx);\n }\n function calcTextPosition(shapex0, shapey0, shapex1, shapey1, shapeOptions, actualTextAngle, textBB) {\n var textPosition = shapeOptions.label.textposition;\n var textAngle = shapeOptions.label.textangle;\n var textPadding = shapeOptions.label.padding;\n var shapeType = shapeOptions.type;\n var textAngleRad = Math.PI / 180 * actualTextAngle;\n var sinA = Math.sin(textAngleRad);\n var cosA = Math.cos(textAngleRad);\n var xanchor = shapeOptions.label.xanchor;\n var yanchor = shapeOptions.label.yanchor;\n var textx, texty, paddingX, paddingY;\n if (shapeType === \"line\") {\n if (textPosition === \"start\") {\n textx = shapex0;\n texty = shapey0;\n } else if (textPosition === \"end\") {\n textx = shapex1;\n texty = shapey1;\n } else {\n textx = (shapex0 + shapex1) / 2;\n texty = (shapey0 + shapey1) / 2;\n }\n if (xanchor === \"auto\") {\n if (textPosition === \"start\") {\n if (textAngle === \"auto\") {\n if (shapex1 > shapex0) xanchor = \"left\";\n else if (shapex1 < shapex0) xanchor = \"right\";\n else xanchor = \"center\";\n } else {\n if (shapex1 > shapex0) xanchor = \"right\";\n else if (shapex1 < shapex0) xanchor = \"left\";\n else xanchor = \"center\";\n }\n } else if (textPosition === \"end\") {\n if (textAngle === \"auto\") {\n if (shapex1 > shapex0) xanchor = \"right\";\n else if (shapex1 < shapex0) xanchor = \"left\";\n else xanchor = \"center\";\n } else {\n if (shapex1 > shapex0) xanchor = \"left\";\n else if (shapex1 < shapex0) xanchor = \"right\";\n else xanchor = \"center\";\n }\n } else {\n xanchor = \"center\";\n }\n }\n var paddingConstantsX = { left: 1, center: 0, right: -1 };\n var paddingConstantsY = { bottom: -1, middle: 0, top: 1 };\n if (textAngle === \"auto\") {\n var paddingDirection = paddingConstantsY[yanchor];\n paddingX = -textPadding * sinA * paddingDirection;\n paddingY = textPadding * cosA * paddingDirection;\n } else {\n var paddingDirectionX = paddingConstantsX[xanchor];\n var paddingDirectionY = paddingConstantsY[yanchor];\n paddingX = textPadding * paddingDirectionX;\n paddingY = textPadding * paddingDirectionY;\n }\n textx = textx + paddingX;\n texty = texty + paddingY;\n } else {\n paddingX = textPadding + 3;\n if (textPosition.indexOf(\"right\") !== -1) {\n textx = Math.max(shapex0, shapex1) - paddingX;\n if (xanchor === \"auto\") xanchor = \"right\";\n } else if (textPosition.indexOf(\"left\") !== -1) {\n textx = Math.min(shapex0, shapex1) + paddingX;\n if (xanchor === \"auto\") xanchor = \"left\";\n } else {\n textx = (shapex0 + shapex1) / 2;\n if (xanchor === \"auto\") xanchor = \"center\";\n }\n if (textPosition.indexOf(\"top\") !== -1) {\n texty = Math.min(shapey0, shapey1);\n } else if (textPosition.indexOf(\"bottom\") !== -1) {\n texty = Math.max(shapey0, shapey1);\n } else {\n texty = (shapey0 + shapey1) / 2;\n }\n paddingY = textPadding;\n if (yanchor === \"bottom\") {\n texty = texty - paddingY;\n } else if (yanchor === \"top\") {\n texty = texty + paddingY;\n }\n }\n var shiftFraction = FROM_TL[yanchor];\n var baselineAdjust = shapeOptions.label.font.size;\n var textHeight = textBB.height;\n var xshift = (textHeight * shiftFraction - baselineAdjust) * sinA;\n var yshift = -(textHeight * shiftFraction - baselineAdjust) * cosA;\n return { textx: textx + xshift, texty: texty + yshift, xanchor };\n }\n }\n });\n\n // src/components/shapes/display_outlines.js\n var require_display_outlines = __commonJS({\n \"src/components/shapes/display_outlines.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var strTranslate = Lib.strTranslate;\n var dragElement = require_dragelement();\n var dragHelpers = require_helpers5();\n var drawMode = dragHelpers.drawMode;\n var selectMode = dragHelpers.selectMode;\n var Registry = require_registry();\n var Color2 = require_color();\n var constants = require_constants4();\n var i000 = constants.i000;\n var i090 = constants.i090;\n var i180 = constants.i180;\n var i270 = constants.i270;\n var handleOutline = require_handle_outline();\n var clearOutlineControllers = handleOutline.clearOutlineControllers;\n var helpers = require_helpers7();\n var pointsOnRectangle = helpers.pointsOnRectangle;\n var pointsOnEllipse = helpers.pointsOnEllipse;\n var writePaths = helpers.writePaths;\n var newShapes = require_newshapes().newShapes;\n var createShapeObj = require_newshapes().createShapeObj;\n var newSelections = require_newselections();\n var drawLabel = require_display_labels();\n module.exports = function displayOutlines(polygons, outlines, dragOptions, nCalls) {\n if (!nCalls) nCalls = 0;\n var gd = dragOptions.gd;\n function redraw() {\n displayOutlines(polygons, outlines, dragOptions, nCalls++);\n if (pointsOnEllipse(polygons[0]) || dragOptions.hasText) {\n update({ redrawing: true });\n }\n }\n function update(opts) {\n var updateObject = {};\n if (dragOptions.isActiveShape !== void 0) {\n dragOptions.isActiveShape = false;\n updateObject = newShapes(outlines, dragOptions);\n }\n if (dragOptions.isActiveSelection !== void 0) {\n dragOptions.isActiveSelection = false;\n updateObject = newSelections(outlines, dragOptions);\n gd._fullLayout._reselect = true;\n }\n if (Object.keys(updateObject).length) {\n Registry.call((opts || {}).redrawing ? \"relayout\" : \"_guiRelayout\", gd, updateObject);\n }\n }\n var fullLayout = gd._fullLayout;\n var zoomLayer = fullLayout._zoomlayer;\n var dragmode = dragOptions.dragmode;\n var isDrawMode = drawMode(dragmode);\n var isSelectMode = selectMode(dragmode);\n if (isDrawMode || isSelectMode) {\n gd._fullLayout._outlining = true;\n }\n clearOutlineControllers(gd);\n outlines.attr(\"d\", writePaths(polygons));\n var vertexDragOptions;\n var groupDragOptions;\n var indexI;\n var indexJ;\n var copyPolygons;\n if (!nCalls && (dragOptions.isActiveShape || dragOptions.isActiveSelection)) {\n copyPolygons = recordPositions([], polygons);\n var g = zoomLayer.append(\"g\").attr(\"class\", \"outline-controllers\");\n addVertexControllers(g);\n addGroupControllers();\n }\n if (isDrawMode && dragOptions.hasText) {\n var shapeGroup = zoomLayer.select(\".label-temp\");\n var shapeOptions = createShapeObj(outlines, dragOptions, dragOptions.dragmode);\n drawLabel(gd, \"label-temp\", shapeOptions, shapeGroup);\n }\n function startDragVertex(evt) {\n indexI = +evt.srcElement.getAttribute(\"data-i\");\n indexJ = +evt.srcElement.getAttribute(\"data-j\");\n vertexDragOptions[indexI][indexJ].moveFn = moveVertexController;\n }\n function moveVertexController(dx, dy) {\n if (!polygons.length) return;\n var x0 = copyPolygons[indexI][indexJ][1];\n var y0 = copyPolygons[indexI][indexJ][2];\n var cell = polygons[indexI];\n var len = cell.length;\n if (pointsOnRectangle(cell)) {\n var _dx = dx;\n var _dy = dy;\n if (dragOptions.isActiveSelection) {\n var nextPoint = getNextPoint(cell, indexJ);\n if (nextPoint[1] === cell[indexJ][1]) {\n _dy = 0;\n } else {\n _dx = 0;\n }\n }\n for (var q = 0; q < len; q++) {\n if (q === indexJ) continue;\n var pos = cell[q];\n if (pos[1] === cell[indexJ][1]) {\n pos[1] = x0 + _dx;\n }\n if (pos[2] === cell[indexJ][2]) {\n pos[2] = y0 + _dy;\n }\n }\n cell[indexJ][1] = x0 + _dx;\n cell[indexJ][2] = y0 + _dy;\n if (!pointsOnRectangle(cell)) {\n for (var j = 0; j < len; j++) {\n for (var k = 0; k < cell[j].length; k++) {\n cell[j][k] = copyPolygons[indexI][j][k];\n }\n }\n }\n } else {\n cell[indexJ][1] = x0 + dx;\n cell[indexJ][2] = y0 + dy;\n }\n redraw();\n }\n function endDragVertexController() {\n update();\n }\n function removeVertex() {\n if (!polygons.length) return;\n if (!polygons[indexI]) return;\n if (!polygons[indexI].length) return;\n var newPolygon = [];\n for (var j = 0; j < polygons[indexI].length; j++) {\n if (j !== indexJ) {\n newPolygon.push(\n polygons[indexI][j]\n );\n }\n }\n if (newPolygon.length > 1 && !(newPolygon.length === 2 && newPolygon[1][0] === \"Z\")) {\n if (indexJ === 0) {\n newPolygon[0][0] = \"M\";\n }\n polygons[indexI] = newPolygon;\n redraw();\n update();\n }\n }\n function clickVertexController(numClicks, evt) {\n if (numClicks === 2) {\n indexI = +evt.srcElement.getAttribute(\"data-i\");\n indexJ = +evt.srcElement.getAttribute(\"data-j\");\n var cell = polygons[indexI];\n if (!pointsOnRectangle(cell) && !pointsOnEllipse(cell)) {\n removeVertex();\n }\n }\n }\n function addVertexControllers(g2) {\n vertexDragOptions = [];\n for (var i = 0; i < polygons.length; i++) {\n var cell = polygons[i];\n var onRect = pointsOnRectangle(cell);\n var onEllipse = !onRect && pointsOnEllipse(cell);\n vertexDragOptions[i] = [];\n var len = cell.length;\n for (var j = 0; j < len; j++) {\n if (cell[j][0] === \"Z\") continue;\n if (onEllipse && j !== i000 && j !== i090 && j !== i180 && j !== i270) {\n continue;\n }\n var rectSelection = onRect && dragOptions.isActiveSelection;\n var nextPoint;\n if (rectSelection) nextPoint = getNextPoint(cell, j);\n var x = cell[j][1];\n var y = cell[j][2];\n var vertex = g2.append(rectSelection ? \"rect\" : \"circle\").attr(\"data-i\", i).attr(\"data-j\", j).style({\n fill: Color2.background,\n stroke: Color2.defaultLine,\n \"stroke-width\": 1,\n \"shape-rendering\": \"crispEdges\"\n });\n if (rectSelection) {\n var dx = nextPoint[1] - x;\n var dy = nextPoint[2] - y;\n var width = dy ? 5 : Math.max(Math.min(25, Math.abs(dx) - 5), 5);\n var height = dx ? 5 : Math.max(Math.min(25, Math.abs(dy) - 5), 5);\n vertex.classed(dy ? \"cursor-ew-resize\" : \"cursor-ns-resize\", true).attr(\"width\", width).attr(\"height\", height).attr(\"x\", x - width / 2).attr(\"y\", y - height / 2).attr(\"transform\", strTranslate(dx / 2, dy / 2));\n } else {\n vertex.classed(\"cursor-grab\", true).attr(\"r\", 5).attr(\"cx\", x).attr(\"cy\", y);\n }\n vertexDragOptions[i][j] = {\n element: vertex.node(),\n gd,\n prepFn: startDragVertex,\n doneFn: endDragVertexController,\n clickFn: clickVertexController\n };\n dragElement.init(vertexDragOptions[i][j]);\n }\n }\n }\n function moveGroup(dx, dy) {\n if (!polygons.length) return;\n for (var i = 0; i < polygons.length; i++) {\n for (var j = 0; j < polygons[i].length; j++) {\n for (var k = 0; k + 2 < polygons[i][j].length; k += 2) {\n polygons[i][j][k + 1] = copyPolygons[i][j][k + 1] + dx;\n polygons[i][j][k + 2] = copyPolygons[i][j][k + 2] + dy;\n }\n }\n }\n }\n function moveGroupController(dx, dy) {\n moveGroup(dx, dy);\n redraw();\n }\n function startDragGroupController(evt) {\n indexI = +evt.srcElement.getAttribute(\"data-i\");\n if (!indexI) indexI = 0;\n groupDragOptions[indexI].moveFn = moveGroupController;\n }\n function endDragGroupController() {\n update();\n }\n function clickGroupController(numClicks) {\n if (numClicks === 2) {\n eraseActiveSelection(gd);\n }\n }\n function addGroupControllers() {\n groupDragOptions = [];\n if (!polygons.length) return;\n var i = 0;\n groupDragOptions[i] = {\n element: outlines[0][0],\n gd,\n prepFn: startDragGroupController,\n doneFn: endDragGroupController,\n clickFn: clickGroupController\n };\n dragElement.init(groupDragOptions[i]);\n }\n };\n function recordPositions(polygonsOut, polygonsIn) {\n for (var i = 0; i < polygonsIn.length; i++) {\n var cell = polygonsIn[i];\n polygonsOut[i] = [];\n for (var j = 0; j < cell.length; j++) {\n polygonsOut[i][j] = [];\n for (var k = 0; k < cell[j].length; k++) {\n polygonsOut[i][j][k] = cell[j][k];\n }\n }\n }\n return polygonsOut;\n }\n function getNextPoint(cell, j) {\n var x = cell[j][1];\n var y = cell[j][2];\n var len = cell.length;\n var nextJ, nextX, nextY;\n nextJ = (j + 1) % len;\n nextX = cell[nextJ][1];\n nextY = cell[nextJ][2];\n if (nextX === x && nextY === y) {\n nextJ = (j + 2) % len;\n nextX = cell[nextJ][1];\n nextY = cell[nextJ][2];\n }\n return [nextJ, nextX, nextY];\n }\n function eraseActiveSelection(gd) {\n if (!selectMode(gd._fullLayout.dragmode)) return;\n clearOutlineControllers(gd);\n var id = gd._fullLayout._activeSelectionIndex;\n var selections = (gd.layout || {}).selections || [];\n if (id < selections.length) {\n var list = [];\n for (var q = 0; q < selections.length; q++) {\n if (q !== id) {\n list.push(selections[q]);\n }\n }\n delete gd._fullLayout._activeSelectionIndex;\n var erasedSelection = gd._fullLayout.selections[id];\n gd._fullLayout._deselect = {\n xref: erasedSelection.xref,\n yref: erasedSelection.yref\n };\n Registry.call(\"_guiRelayout\", gd, {\n selections: list\n });\n }\n }\n }\n });\n\n // src/components/shapes/draw.js\n var require_draw2 = __commonJS({\n \"src/components/shapes/draw.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Registry = require_registry();\n var Lib = require_lib();\n var Axes = require_axes();\n var readPaths = require_helpers7().readPaths;\n var displayOutlines = require_display_outlines();\n var drawLabel = require_display_labels();\n var clearOutlineControllers = require_handle_outline().clearOutlineControllers;\n var Color2 = require_color();\n var Drawing = require_drawing();\n var arrayEditor = require_plot_template().arrayEditor;\n var dragElement = require_dragelement();\n var setCursor = require_setcursor();\n var constants = require_constants5();\n var helpers = require_helpers8();\n var getPathString = helpers.getPathString;\n module.exports = {\n draw,\n drawOne,\n eraseActiveShape,\n drawLabel\n };\n function draw(gd) {\n var fullLayout = gd._fullLayout;\n fullLayout._shapeUpperLayer.selectAll(\"path\").remove();\n fullLayout._shapeLowerLayer.selectAll(\"path\").remove();\n fullLayout._shapeUpperLayer.selectAll(\"text\").remove();\n fullLayout._shapeLowerLayer.selectAll(\"text\").remove();\n for (var k in fullLayout._plots) {\n var shapelayer = fullLayout._plots[k].shapelayer;\n if (shapelayer) {\n shapelayer.selectAll(\"path\").remove();\n shapelayer.selectAll(\"text\").remove();\n }\n }\n for (var i = 0; i < fullLayout.shapes.length; i++) {\n if (fullLayout.shapes[i].visible === true) {\n drawOne(gd, i);\n }\n }\n }\n function shouldSkipEdits(gd) {\n return !!gd._fullLayout._outlining;\n }\n function couldHaveActiveShape(gd) {\n return !gd._context.edits.shapePosition;\n }\n function drawOne(gd, index) {\n gd._fullLayout._paperdiv.selectAll('.shapelayer [data-index=\"' + index + '\"]').remove();\n var o = helpers.makeShapesOptionsAndPlotinfo(gd, index);\n var options = o.options;\n var plotinfo = o.plotinfo;\n if (!options._input || options.visible !== true) return;\n if (options.layer === \"above\") {\n drawShape(gd._fullLayout._shapeUpperLayer);\n } else if (options.xref === \"paper\" || options.yref === \"paper\") {\n drawShape(gd._fullLayout._shapeLowerLayer);\n } else if (options.layer === \"between\") {\n drawShape(plotinfo.shapelayerBetween);\n } else {\n if (plotinfo._hadPlotinfo) {\n var mainPlot = plotinfo.mainplotinfo || plotinfo;\n drawShape(mainPlot.shapelayer);\n } else {\n drawShape(gd._fullLayout._shapeLowerLayer);\n }\n }\n function drawShape(shapeLayer) {\n var d = getPathString(gd, options);\n var attrs = {\n \"data-index\": index,\n \"fill-rule\": options.fillrule,\n d\n };\n var opacity = options.opacity;\n var fillColor = options.fillcolor;\n var lineColor = options.line.width ? options.line.color : \"rgba(0,0,0,0)\";\n var lineWidth = options.line.width;\n var lineDash = options.line.dash;\n if (!lineWidth && options.editable === true) {\n lineWidth = 5;\n lineDash = \"solid\";\n }\n var isOpen = d[d.length - 1] !== \"Z\";\n var isActiveShape = couldHaveActiveShape(gd) && options.editable && gd._fullLayout._activeShapeIndex === index;\n if (isActiveShape) {\n fillColor = isOpen ? \"rgba(0,0,0,0)\" : gd._fullLayout.activeshape.fillcolor;\n opacity = gd._fullLayout.activeshape.opacity;\n }\n var shapeGroup = shapeLayer.append(\"g\").classed(\"shape-group\", true).attr({ \"data-index\": index });\n var path = shapeGroup.append(\"path\").attr(attrs).style(\"opacity\", opacity).call(Color2.stroke, lineColor).call(Color2.fill, fillColor).call(Drawing.dashLine, lineDash, lineWidth);\n setClipPath(shapeGroup, gd, options);\n drawLabel(gd, index, options, shapeGroup);\n var editHelpers;\n if (isActiveShape || gd._context.edits.shapePosition) editHelpers = arrayEditor(gd.layout, \"shapes\", options);\n if (isActiveShape) {\n path.style({\n cursor: \"move\"\n });\n var dragOptions = {\n element: path.node(),\n plotinfo,\n gd,\n editHelpers,\n hasText: options.label.text || options.label.texttemplate,\n isActiveShape: true\n // i.e. to enable controllers\n };\n var polygons = readPaths(d, gd);\n displayOutlines(polygons, path, dragOptions);\n } else {\n if (gd._context.edits.shapePosition) {\n setupDragElement(gd, path, options, index, shapeLayer, editHelpers);\n } else if (options.editable === true) {\n path.style(\n \"pointer-events\",\n isOpen || Color2.opacity(fillColor) * opacity <= 0.5 ? \"stroke\" : \"all\"\n );\n }\n }\n path.node().addEventListener(\"click\", function() {\n return activateShape(gd, path);\n });\n }\n }\n function setClipPath(shapePath, gd, shapeOptions) {\n var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, \"\").replace(/[xyz][1-9]* *domain/g, \"\");\n Drawing.setClipUrl(\n shapePath,\n clipAxes ? \"clip\" + gd._fullLayout._uid + clipAxes : null,\n gd\n );\n }\n function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHelpers) {\n var MINWIDTH = 10;\n var MINHEIGHT = 10;\n var xPixelSized = shapeOptions.xsizemode === \"pixel\";\n var yPixelSized = shapeOptions.ysizemode === \"pixel\";\n var isLine = shapeOptions.type === \"line\";\n var isPath = shapeOptions.type === \"path\";\n var modifyItem = editHelpers.modifyItem;\n var x0, y0, x1, y1, xAnchor, yAnchor;\n var n0, s0, w0, e0, optN, optS, optW, optE;\n var pathIn;\n var shapeGroup = d3.select(shapePath.node().parentNode);\n var xa = Axes.getFromId(gd, shapeOptions.xref);\n var xRefType = Axes.getRefType(shapeOptions.xref);\n var ya = Axes.getFromId(gd, shapeOptions.yref);\n var yRefType = Axes.getRefType(shapeOptions.yref);\n var shiftXStart = shapeOptions.x0shift;\n var shiftXEnd = shapeOptions.x1shift;\n var shiftYStart = shapeOptions.y0shift;\n var shiftYEnd = shapeOptions.y1shift;\n var x2p = function(v, shift) {\n var dataToPixel = helpers.getDataToPixel(gd, xa, shift, false, xRefType);\n return dataToPixel(v);\n };\n var y2p = function(v, shift) {\n var dataToPixel = helpers.getDataToPixel(gd, ya, shift, true, yRefType);\n return dataToPixel(v);\n };\n var p2x = helpers.getPixelToData(gd, xa, false, xRefType);\n var p2y = helpers.getPixelToData(gd, ya, true, yRefType);\n var sensoryElement = obtainSensoryElement();\n var dragOptions = {\n element: sensoryElement.node(),\n gd,\n prepFn: startDrag,\n doneFn: endDrag,\n clickFn: abortDrag\n };\n var dragMode;\n dragElement.init(dragOptions);\n sensoryElement.node().onmousemove = updateDragMode;\n function obtainSensoryElement() {\n return isLine ? createLineDragHandles() : shapePath;\n }\n function createLineDragHandles() {\n var minSensoryWidth = 10;\n var sensoryWidth = Math.max(shapeOptions.line.width, minSensoryWidth);\n var g = shapeLayer.append(\"g\").attr(\"data-index\", index).attr(\"drag-helper\", true);\n g.append(\"path\").attr(\"d\", shapePath.attr(\"d\")).style({\n cursor: \"move\",\n \"stroke-width\": sensoryWidth,\n \"stroke-opacity\": \"0\"\n // ensure not visible\n });\n var circleStyle = {\n \"fill-opacity\": \"0\"\n // ensure not visible\n };\n var circleRadius = Math.max(sensoryWidth / 2, minSensoryWidth);\n g.append(\"circle\").attr({\n \"data-line-point\": \"start-point\",\n cx: xPixelSized ? x2p(shapeOptions.xanchor) + shapeOptions.x0 : x2p(shapeOptions.x0, shiftXStart),\n cy: yPixelSized ? y2p(shapeOptions.yanchor) - shapeOptions.y0 : y2p(shapeOptions.y0, shiftYStart),\n r: circleRadius\n }).style(circleStyle).classed(\"cursor-grab\", true);\n g.append(\"circle\").attr({\n \"data-line-point\": \"end-point\",\n cx: xPixelSized ? x2p(shapeOptions.xanchor) + shapeOptions.x1 : x2p(shapeOptions.x1, shiftXEnd),\n cy: yPixelSized ? y2p(shapeOptions.yanchor) - shapeOptions.y1 : y2p(shapeOptions.y1, shiftYEnd),\n r: circleRadius\n }).style(circleStyle).classed(\"cursor-grab\", true);\n return g;\n }\n function updateDragMode(evt) {\n if (shouldSkipEdits(gd)) {\n dragMode = null;\n return;\n }\n if (isLine) {\n if (evt.target.tagName === \"path\") {\n dragMode = \"move\";\n } else {\n dragMode = evt.target.attributes[\"data-line-point\"].value === \"start-point\" ? \"resize-over-start-point\" : \"resize-over-end-point\";\n }\n } else {\n var dragBBox = dragOptions.element.getBoundingClientRect();\n var w = dragBBox.right - dragBBox.left;\n var h = dragBBox.bottom - dragBBox.top;\n var x = evt.clientX - dragBBox.left;\n var y = evt.clientY - dragBBox.top;\n var cursor = !isPath && w > MINWIDTH && h > MINHEIGHT && !evt.shiftKey ? dragElement.getCursor(x / w, 1 - y / h) : \"move\";\n setCursor(shapePath, cursor);\n dragMode = cursor.split(\"-\")[0];\n }\n }\n function startDrag(evt) {\n if (shouldSkipEdits(gd)) return;\n if (xPixelSized) {\n xAnchor = x2p(shapeOptions.xanchor);\n }\n if (yPixelSized) {\n yAnchor = y2p(shapeOptions.yanchor);\n }\n if (shapeOptions.type === \"path\") {\n pathIn = shapeOptions.path;\n } else {\n x0 = xPixelSized ? shapeOptions.x0 : x2p(shapeOptions.x0);\n y0 = yPixelSized ? shapeOptions.y0 : y2p(shapeOptions.y0);\n x1 = xPixelSized ? shapeOptions.x1 : x2p(shapeOptions.x1);\n y1 = yPixelSized ? shapeOptions.y1 : y2p(shapeOptions.y1);\n }\n if (x0 < x1) {\n w0 = x0;\n optW = \"x0\";\n e0 = x1;\n optE = \"x1\";\n } else {\n w0 = x1;\n optW = \"x1\";\n e0 = x0;\n optE = \"x0\";\n }\n if (!yPixelSized && y0 < y1 || yPixelSized && y0 > y1) {\n n0 = y0;\n optN = \"y0\";\n s0 = y1;\n optS = \"y1\";\n } else {\n n0 = y1;\n optN = \"y1\";\n s0 = y0;\n optS = \"y0\";\n }\n updateDragMode(evt);\n renderVisualCues(shapeLayer, shapeOptions);\n deactivateClipPathTemporarily(shapePath, shapeOptions, gd);\n dragOptions.moveFn = dragMode === \"move\" ? moveShape : resizeShape;\n dragOptions.altKey = evt.altKey;\n }\n function endDrag() {\n if (shouldSkipEdits(gd)) return;\n setCursor(shapePath);\n removeVisualCues(shapeLayer);\n setClipPath(shapePath, gd, shapeOptions);\n Registry.call(\"_guiRelayout\", gd, editHelpers.getUpdateObj());\n }\n function abortDrag() {\n if (shouldSkipEdits(gd)) return;\n removeVisualCues(shapeLayer);\n }\n function moveShape(dx, dy) {\n if (shapeOptions.type === \"path\") {\n var noOp = function(coord) {\n return coord;\n };\n var moveX = noOp;\n var moveY = noOp;\n if (xPixelSized) {\n modifyItem(\"xanchor\", shapeOptions.xanchor = p2x(xAnchor + dx));\n } else {\n moveX = function moveX2(x) {\n return p2x(x2p(x) + dx);\n };\n if (xa && xa.type === \"date\") moveX = helpers.encodeDate(moveX);\n }\n if (yPixelSized) {\n modifyItem(\"yanchor\", shapeOptions.yanchor = p2y(yAnchor + dy));\n } else {\n moveY = function moveY2(y) {\n return p2y(y2p(y) + dy);\n };\n if (ya && ya.type === \"date\") moveY = helpers.encodeDate(moveY);\n }\n modifyItem(\"path\", shapeOptions.path = movePath(pathIn, moveX, moveY));\n } else {\n if (xPixelSized) {\n modifyItem(\"xanchor\", shapeOptions.xanchor = p2x(xAnchor + dx));\n } else {\n modifyItem(\"x0\", shapeOptions.x0 = p2x(x0 + dx));\n modifyItem(\"x1\", shapeOptions.x1 = p2x(x1 + dx));\n }\n if (yPixelSized) {\n modifyItem(\"yanchor\", shapeOptions.yanchor = p2y(yAnchor + dy));\n } else {\n modifyItem(\"y0\", shapeOptions.y0 = p2y(y0 + dy));\n modifyItem(\"y1\", shapeOptions.y1 = p2y(y1 + dy));\n }\n }\n shapePath.attr(\"d\", getPathString(gd, shapeOptions));\n renderVisualCues(shapeLayer, shapeOptions);\n drawLabel(gd, index, shapeOptions, shapeGroup);\n }\n function resizeShape(dx, dy) {\n if (isPath) {\n var noOp = function(coord) {\n return coord;\n };\n var moveX = noOp;\n var moveY = noOp;\n if (xPixelSized) {\n modifyItem(\"xanchor\", shapeOptions.xanchor = p2x(xAnchor + dx));\n } else {\n moveX = function moveX2(x) {\n return p2x(x2p(x) + dx);\n };\n if (xa && xa.type === \"date\") moveX = helpers.encodeDate(moveX);\n }\n if (yPixelSized) {\n modifyItem(\"yanchor\", shapeOptions.yanchor = p2y(yAnchor + dy));\n } else {\n moveY = function moveY2(y) {\n return p2y(y2p(y) + dy);\n };\n if (ya && ya.type === \"date\") moveY = helpers.encodeDate(moveY);\n }\n modifyItem(\"path\", shapeOptions.path = movePath(pathIn, moveX, moveY));\n } else if (isLine) {\n if (dragMode === \"resize-over-start-point\") {\n var newX0 = x0 + dx;\n var newY0 = yPixelSized ? y0 - dy : y0 + dy;\n modifyItem(\"x0\", shapeOptions.x0 = xPixelSized ? newX0 : p2x(newX0));\n modifyItem(\"y0\", shapeOptions.y0 = yPixelSized ? newY0 : p2y(newY0));\n } else if (dragMode === \"resize-over-end-point\") {\n var newX1 = x1 + dx;\n var newY1 = yPixelSized ? y1 - dy : y1 + dy;\n modifyItem(\"x1\", shapeOptions.x1 = xPixelSized ? newX1 : p2x(newX1));\n modifyItem(\"y1\", shapeOptions.y1 = yPixelSized ? newY1 : p2y(newY1));\n }\n } else {\n var has = function(str) {\n return dragMode.indexOf(str) !== -1;\n };\n var hasN = has(\"n\");\n var hasS = has(\"s\");\n var hasW = has(\"w\");\n var hasE = has(\"e\");\n var newN = hasN ? n0 + dy : n0;\n var newS = hasS ? s0 + dy : s0;\n var newW = hasW ? w0 + dx : w0;\n var newE = hasE ? e0 + dx : e0;\n if (yPixelSized) {\n if (hasN) newN = n0 - dy;\n if (hasS) newS = s0 - dy;\n }\n if (!yPixelSized && newS - newN > MINHEIGHT || yPixelSized && newN - newS > MINHEIGHT) {\n modifyItem(optN, shapeOptions[optN] = yPixelSized ? newN : p2y(newN));\n modifyItem(optS, shapeOptions[optS] = yPixelSized ? newS : p2y(newS));\n }\n if (newE - newW > MINWIDTH) {\n modifyItem(optW, shapeOptions[optW] = xPixelSized ? newW : p2x(newW));\n modifyItem(optE, shapeOptions[optE] = xPixelSized ? newE : p2x(newE));\n }\n }\n shapePath.attr(\"d\", getPathString(gd, shapeOptions));\n renderVisualCues(shapeLayer, shapeOptions);\n drawLabel(gd, index, shapeOptions, shapeGroup);\n }\n function renderVisualCues(shapeLayer2, shapeOptions2) {\n if (xPixelSized || yPixelSized) {\n renderAnchor();\n }\n function renderAnchor() {\n var isNotPath = shapeOptions2.type !== \"path\";\n var visualCues = shapeLayer2.selectAll(\".visual-cue\").data([0]);\n var strokeWidth = 1;\n visualCues.enter().append(\"path\").attr({\n fill: \"#fff\",\n \"fill-rule\": \"evenodd\",\n stroke: \"#000\",\n \"stroke-width\": strokeWidth\n }).classed(\"visual-cue\", true);\n var posX = x2p(\n xPixelSized ? shapeOptions2.xanchor : Lib.midRange(\n isNotPath ? [shapeOptions2.x0, shapeOptions2.x1] : helpers.extractPathCoords(shapeOptions2.path, constants.paramIsX)\n )\n );\n var posY = y2p(\n yPixelSized ? shapeOptions2.yanchor : Lib.midRange(\n isNotPath ? [shapeOptions2.y0, shapeOptions2.y1] : helpers.extractPathCoords(shapeOptions2.path, constants.paramIsY)\n )\n );\n posX = helpers.roundPositionForSharpStrokeRendering(posX, strokeWidth);\n posY = helpers.roundPositionForSharpStrokeRendering(posY, strokeWidth);\n if (xPixelSized && yPixelSized) {\n var crossPath = \"M\" + (posX - 1 - strokeWidth) + \",\" + (posY - 1 - strokeWidth) + \"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z\";\n visualCues.attr(\"d\", crossPath);\n } else if (xPixelSized) {\n var vBarPath = \"M\" + (posX - 1 - strokeWidth) + \",\" + (posY - 9 - strokeWidth) + \"v18 h2 v-18 Z\";\n visualCues.attr(\"d\", vBarPath);\n } else {\n var hBarPath = \"M\" + (posX - 9 - strokeWidth) + \",\" + (posY - 1 - strokeWidth) + \"h18 v2 h-18 Z\";\n visualCues.attr(\"d\", hBarPath);\n }\n }\n }\n function removeVisualCues(shapeLayer2) {\n shapeLayer2.selectAll(\".visual-cue\").remove();\n }\n function deactivateClipPathTemporarily(shapePath2, shapeOptions2, gd2) {\n var xref = shapeOptions2.xref;\n var yref = shapeOptions2.yref;\n var xa2 = Axes.getFromId(gd2, xref);\n var ya2 = Axes.getFromId(gd2, yref);\n var clipAxes = \"\";\n if (xref !== \"paper\" && !xa2.autorange) clipAxes += xref;\n if (yref !== \"paper\" && !ya2.autorange) clipAxes += yref;\n Drawing.setClipUrl(\n shapePath2,\n clipAxes ? \"clip\" + gd2._fullLayout._uid + clipAxes : null,\n gd2\n );\n }\n }\n function movePath(pathIn, moveX, moveY) {\n return pathIn.replace(constants.segmentRE, function(segment) {\n var paramNumber = 0;\n var segmentType = segment.charAt(0);\n var xParams = constants.paramIsX[segmentType];\n var yParams = constants.paramIsY[segmentType];\n var nParams = constants.numParams[segmentType];\n var paramString = segment.substr(1).replace(constants.paramRE, function(param) {\n if (paramNumber >= nParams) return param;\n if (xParams[paramNumber]) param = moveX(param);\n else if (yParams[paramNumber]) param = moveY(param);\n paramNumber++;\n return param;\n });\n return segmentType + paramString;\n });\n }\n function activateShape(gd, path) {\n if (!couldHaveActiveShape(gd)) return;\n var element = path.node();\n var id = +element.getAttribute(\"data-index\");\n if (id >= 0) {\n if (id === gd._fullLayout._activeShapeIndex) {\n deactivateShape(gd);\n return;\n }\n gd._fullLayout._activeShapeIndex = id;\n gd._fullLayout._deactivateShape = deactivateShape;\n draw(gd);\n }\n }\n function deactivateShape(gd) {\n if (!couldHaveActiveShape(gd)) return;\n var id = gd._fullLayout._activeShapeIndex;\n if (id >= 0) {\n clearOutlineControllers(gd);\n delete gd._fullLayout._activeShapeIndex;\n draw(gd);\n }\n }\n function eraseActiveShape(gd) {\n if (!couldHaveActiveShape(gd)) return;\n clearOutlineControllers(gd);\n var id = gd._fullLayout._activeShapeIndex;\n var shapes = (gd.layout || {}).shapes || [];\n if (id < shapes.length) {\n var list = [];\n for (var q = 0; q < shapes.length; q++) {\n if (q !== id) {\n list.push(shapes[q]);\n }\n }\n delete gd._fullLayout._activeShapeIndex;\n return Registry.call(\"_guiRelayout\", gd, {\n shapes: list\n });\n }\n }\n }\n });\n\n // src/components/modebar/buttons.js\n var require_buttons = __commonJS({\n \"src/components/modebar/buttons.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var Plots = require_plots();\n var axisIds = require_axis_ids();\n var Icons = require_ploticon();\n var eraseActiveShape = require_draw2().eraseActiveShape;\n var Lib = require_lib();\n var _ = Lib._;\n var modeBarButtons = module.exports = {};\n modeBarButtons.toImage = {\n name: \"toImage\",\n title: function(gd) {\n var opts = gd._context.toImageButtonOptions || {};\n var format = opts.format || \"png\";\n return format === \"png\" ? _(gd, \"Download plot as a png\") : (\n // legacy text\n _(gd, \"Download plot\")\n );\n },\n icon: Icons.camera,\n click: function(gd) {\n var toImageButtonOptions = gd._context.toImageButtonOptions;\n var opts = { format: toImageButtonOptions.format || \"png\" };\n Lib.notifier(_(gd, \"Taking snapshot - this may take a few seconds\"), \"long\");\n [\"filename\", \"width\", \"height\", \"scale\"].forEach(function(key) {\n if (key in toImageButtonOptions) {\n opts[key] = toImageButtonOptions[key];\n }\n });\n Registry.call(\"downloadImage\", gd, opts).then(function(filename) {\n Lib.notifier(_(gd, \"Snapshot succeeded\") + \" - \" + filename, \"long\");\n }).catch(function() {\n Lib.notifier(_(gd, \"Sorry, there was a problem downloading your snapshot!\"), \"long\");\n });\n }\n };\n modeBarButtons.sendDataToCloud = {\n name: \"sendDataToCloud\",\n title: function(gd) {\n return _(gd, \"Edit in Chart Studio\");\n },\n icon: Icons.disk,\n click: function(gd) {\n Plots.sendDataToCloud(gd);\n }\n };\n modeBarButtons.editInChartStudio = {\n name: \"editInChartStudio\",\n title: function(gd) {\n return _(gd, \"Edit in Chart Studio\");\n },\n icon: Icons.pencil,\n click: function(gd) {\n Plots.sendDataToCloud(gd);\n }\n };\n modeBarButtons.zoom2d = {\n name: \"zoom2d\",\n _cat: \"zoom\",\n title: function(gd) {\n return _(gd, \"Zoom\");\n },\n attr: \"dragmode\",\n val: \"zoom\",\n icon: Icons.zoombox,\n click: handleCartesian\n };\n modeBarButtons.pan2d = {\n name: \"pan2d\",\n _cat: \"pan\",\n title: function(gd) {\n return _(gd, \"Pan\");\n },\n attr: \"dragmode\",\n val: \"pan\",\n icon: Icons.pan,\n click: handleCartesian\n };\n modeBarButtons.select2d = {\n name: \"select2d\",\n _cat: \"select\",\n title: function(gd) {\n return _(gd, \"Box Select\");\n },\n attr: \"dragmode\",\n val: \"select\",\n icon: Icons.selectbox,\n click: handleCartesian\n };\n modeBarButtons.lasso2d = {\n name: \"lasso2d\",\n _cat: \"lasso\",\n title: function(gd) {\n return _(gd, \"Lasso Select\");\n },\n attr: \"dragmode\",\n val: \"lasso\",\n icon: Icons.lasso,\n click: handleCartesian\n };\n modeBarButtons.drawclosedpath = {\n name: \"drawclosedpath\",\n title: function(gd) {\n return _(gd, \"Draw closed freeform\");\n },\n attr: \"dragmode\",\n val: \"drawclosedpath\",\n icon: Icons.drawclosedpath,\n click: handleCartesian\n };\n modeBarButtons.drawopenpath = {\n name: \"drawopenpath\",\n title: function(gd) {\n return _(gd, \"Draw open freeform\");\n },\n attr: \"dragmode\",\n val: \"drawopenpath\",\n icon: Icons.drawopenpath,\n click: handleCartesian\n };\n modeBarButtons.drawline = {\n name: \"drawline\",\n title: function(gd) {\n return _(gd, \"Draw line\");\n },\n attr: \"dragmode\",\n val: \"drawline\",\n icon: Icons.drawline,\n click: handleCartesian\n };\n modeBarButtons.drawrect = {\n name: \"drawrect\",\n title: function(gd) {\n return _(gd, \"Draw rectangle\");\n },\n attr: \"dragmode\",\n val: \"drawrect\",\n icon: Icons.drawrect,\n click: handleCartesian\n };\n modeBarButtons.drawcircle = {\n name: \"drawcircle\",\n title: function(gd) {\n return _(gd, \"Draw circle\");\n },\n attr: \"dragmode\",\n val: \"drawcircle\",\n icon: Icons.drawcircle,\n click: handleCartesian\n };\n modeBarButtons.eraseshape = {\n name: \"eraseshape\",\n title: function(gd) {\n return _(gd, \"Erase active shape\");\n },\n icon: Icons.eraseshape,\n click: eraseActiveShape\n };\n modeBarButtons.zoomIn2d = {\n name: \"zoomIn2d\",\n _cat: \"zoomin\",\n title: function(gd) {\n return _(gd, \"Zoom in\");\n },\n attr: \"zoom\",\n val: \"in\",\n icon: Icons.zoom_plus,\n click: handleCartesian\n };\n modeBarButtons.zoomOut2d = {\n name: \"zoomOut2d\",\n _cat: \"zoomout\",\n title: function(gd) {\n return _(gd, \"Zoom out\");\n },\n attr: \"zoom\",\n val: \"out\",\n icon: Icons.zoom_minus,\n click: handleCartesian\n };\n modeBarButtons.autoScale2d = {\n name: \"autoScale2d\",\n _cat: \"autoscale\",\n title: function(gd) {\n return _(gd, \"Autoscale\");\n },\n attr: \"zoom\",\n val: \"auto\",\n icon: Icons.autoscale,\n click: handleCartesian\n };\n modeBarButtons.resetScale2d = {\n name: \"resetScale2d\",\n _cat: \"resetscale\",\n title: function(gd) {\n return _(gd, \"Reset axes\");\n },\n attr: \"zoom\",\n val: \"reset\",\n icon: Icons.home,\n click: handleCartesian\n };\n modeBarButtons.hoverClosestCartesian = {\n name: \"hoverClosestCartesian\",\n _cat: \"hoverclosest\",\n title: function(gd) {\n return _(gd, \"Show closest data on hover\");\n },\n attr: \"hovermode\",\n val: \"closest\",\n icon: Icons.tooltip_basic,\n gravity: \"ne\",\n click: handleCartesian\n };\n modeBarButtons.hoverCompareCartesian = {\n name: \"hoverCompareCartesian\",\n _cat: \"hoverCompare\",\n title: function(gd) {\n return _(gd, \"Compare data on hover\");\n },\n attr: \"hovermode\",\n val: function(gd) {\n return gd._fullLayout._isHoriz ? \"y\" : \"x\";\n },\n icon: Icons.tooltip_compare,\n gravity: \"ne\",\n click: handleCartesian\n };\n function handleCartesian(gd, ev) {\n var button = ev.currentTarget;\n var astr = button.getAttribute(\"data-attr\");\n var val = button.getAttribute(\"data-val\") || true;\n var fullLayout = gd._fullLayout;\n var aobj = {};\n var axList = axisIds.list(gd, null, true);\n var allSpikesEnabled = fullLayout._cartesianSpikesEnabled;\n var ax, i;\n if (astr === \"zoom\") {\n var mag = val === \"in\" ? 0.5 : 2;\n var r0 = (1 + mag) / 2;\n var r1 = (1 - mag) / 2;\n var axName;\n for (i = 0; i < axList.length; i++) {\n ax = axList[i];\n if (!ax.fixedrange) {\n axName = ax._name;\n if (val === \"auto\") {\n aobj[axName + \".autorange\"] = true;\n } else if (val === \"reset\") {\n if (ax._rangeInitial0 === void 0 && ax._rangeInitial1 === void 0) {\n aobj[axName + \".autorange\"] = true;\n } else if (ax._rangeInitial0 === void 0) {\n aobj[axName + \".autorange\"] = ax._autorangeInitial;\n aobj[axName + \".range\"] = [null, ax._rangeInitial1];\n } else if (ax._rangeInitial1 === void 0) {\n aobj[axName + \".range\"] = [ax._rangeInitial0, null];\n aobj[axName + \".autorange\"] = ax._autorangeInitial;\n } else {\n aobj[axName + \".range\"] = [ax._rangeInitial0, ax._rangeInitial1];\n }\n if (ax._showSpikeInitial !== void 0) {\n aobj[axName + \".showspikes\"] = ax._showSpikeInitial;\n if (allSpikesEnabled === \"on\" && !ax._showSpikeInitial) {\n allSpikesEnabled = \"off\";\n }\n }\n } else {\n var rangeNow = [\n ax.r2l(ax.range[0]),\n ax.r2l(ax.range[1])\n ];\n var rangeNew = [\n r0 * rangeNow[0] + r1 * rangeNow[1],\n r0 * rangeNow[1] + r1 * rangeNow[0]\n ];\n aobj[axName + \".range[0]\"] = ax.l2r(rangeNew[0]);\n aobj[axName + \".range[1]\"] = ax.l2r(rangeNew[1]);\n }\n }\n }\n } else {\n if (astr === \"hovermode\" && (val === \"x\" || val === \"y\")) {\n val = fullLayout._isHoriz ? \"y\" : \"x\";\n button.setAttribute(\"data-val\", val);\n }\n aobj[astr] = val;\n }\n fullLayout._cartesianSpikesEnabled = allSpikesEnabled;\n Registry.call(\"_guiRelayout\", gd, aobj);\n }\n modeBarButtons.zoom3d = {\n name: \"zoom3d\",\n _cat: \"zoom\",\n title: function(gd) {\n return _(gd, \"Zoom\");\n },\n attr: \"scene.dragmode\",\n val: \"zoom\",\n icon: Icons.zoombox,\n click: handleDrag3d\n };\n modeBarButtons.pan3d = {\n name: \"pan3d\",\n _cat: \"pan\",\n title: function(gd) {\n return _(gd, \"Pan\");\n },\n attr: \"scene.dragmode\",\n val: \"pan\",\n icon: Icons.pan,\n click: handleDrag3d\n };\n modeBarButtons.orbitRotation = {\n name: \"orbitRotation\",\n title: function(gd) {\n return _(gd, \"Orbital rotation\");\n },\n attr: \"scene.dragmode\",\n val: \"orbit\",\n icon: Icons[\"3d_rotate\"],\n click: handleDrag3d\n };\n modeBarButtons.tableRotation = {\n name: \"tableRotation\",\n title: function(gd) {\n return _(gd, \"Turntable rotation\");\n },\n attr: \"scene.dragmode\",\n val: \"turntable\",\n icon: Icons[\"z-axis\"],\n click: handleDrag3d\n };\n function handleDrag3d(gd, ev) {\n var button = ev.currentTarget;\n var attr = button.getAttribute(\"data-attr\");\n var val = button.getAttribute(\"data-val\") || true;\n var sceneIds = gd._fullLayout._subplots.gl3d || [];\n var layoutUpdate = {};\n var parts = attr.split(\".\");\n for (var i = 0; i < sceneIds.length; i++) {\n layoutUpdate[sceneIds[i] + \".\" + parts[1]] = val;\n }\n var val2d = val === \"pan\" ? val : \"zoom\";\n layoutUpdate.dragmode = val2d;\n Registry.call(\"_guiRelayout\", gd, layoutUpdate);\n }\n modeBarButtons.resetCameraDefault3d = {\n name: \"resetCameraDefault3d\",\n _cat: \"resetCameraDefault\",\n title: function(gd) {\n return _(gd, \"Reset camera to default\");\n },\n attr: \"resetDefault\",\n icon: Icons.home,\n click: handleCamera3d\n };\n modeBarButtons.resetCameraLastSave3d = {\n name: \"resetCameraLastSave3d\",\n _cat: \"resetCameraLastSave\",\n title: function(gd) {\n return _(gd, \"Reset camera to last save\");\n },\n attr: \"resetLastSave\",\n icon: Icons.movie,\n click: handleCamera3d\n };\n function handleCamera3d(gd, ev) {\n var button = ev.currentTarget;\n var attr = button.getAttribute(\"data-attr\");\n var resetLastSave = attr === \"resetLastSave\";\n var resetDefault = attr === \"resetDefault\";\n var fullLayout = gd._fullLayout;\n var sceneIds = fullLayout._subplots.gl3d || [];\n var aobj = {};\n for (var i = 0; i < sceneIds.length; i++) {\n var sceneId = sceneIds[i];\n var camera = sceneId + \".camera\";\n var aspectratio = sceneId + \".aspectratio\";\n var aspectmode = sceneId + \".aspectmode\";\n var scene = fullLayout[sceneId]._scene;\n var didUpdate;\n if (resetLastSave) {\n aobj[camera + \".up\"] = scene.viewInitial.up;\n aobj[camera + \".eye\"] = scene.viewInitial.eye;\n aobj[camera + \".center\"] = scene.viewInitial.center;\n didUpdate = true;\n } else if (resetDefault) {\n aobj[camera + \".up\"] = null;\n aobj[camera + \".eye\"] = null;\n aobj[camera + \".center\"] = null;\n didUpdate = true;\n }\n if (didUpdate) {\n aobj[aspectratio + \".x\"] = scene.viewInitial.aspectratio.x;\n aobj[aspectratio + \".y\"] = scene.viewInitial.aspectratio.y;\n aobj[aspectratio + \".z\"] = scene.viewInitial.aspectratio.z;\n aobj[aspectmode] = scene.viewInitial.aspectmode;\n }\n }\n Registry.call(\"_guiRelayout\", gd, aobj);\n }\n modeBarButtons.hoverClosest3d = {\n name: \"hoverClosest3d\",\n _cat: \"hoverclosest\",\n title: function(gd) {\n return _(gd, \"Toggle show closest data on hover\");\n },\n attr: \"hovermode\",\n val: null,\n toggle: true,\n icon: Icons.tooltip_basic,\n gravity: \"ne\",\n click: handleHover3d\n };\n function getNextHover3d(gd, ev) {\n var button = ev.currentTarget;\n var val = button._previousVal;\n var fullLayout = gd._fullLayout;\n var sceneIds = fullLayout._subplots.gl3d || [];\n var axes = [\"xaxis\", \"yaxis\", \"zaxis\"];\n var currentSpikes = {};\n var layoutUpdate = {};\n if (val) {\n layoutUpdate = val;\n button._previousVal = null;\n } else {\n for (var i = 0; i < sceneIds.length; i++) {\n var sceneId = sceneIds[i];\n var sceneLayout = fullLayout[sceneId];\n var hovermodeAStr = sceneId + \".hovermode\";\n currentSpikes[hovermodeAStr] = sceneLayout.hovermode;\n layoutUpdate[hovermodeAStr] = false;\n for (var j = 0; j < 3; j++) {\n var axis = axes[j];\n var spikeAStr = sceneId + \".\" + axis + \".showspikes\";\n layoutUpdate[spikeAStr] = false;\n currentSpikes[spikeAStr] = sceneLayout[axis].showspikes;\n }\n }\n button._previousVal = currentSpikes;\n }\n return layoutUpdate;\n }\n function handleHover3d(gd, ev) {\n var layoutUpdate = getNextHover3d(gd, ev);\n Registry.call(\"_guiRelayout\", gd, layoutUpdate);\n }\n modeBarButtons.zoomInGeo = {\n name: \"zoomInGeo\",\n _cat: \"zoomin\",\n title: function(gd) {\n return _(gd, \"Zoom in\");\n },\n attr: \"zoom\",\n val: \"in\",\n icon: Icons.zoom_plus,\n click: handleGeo\n };\n modeBarButtons.zoomOutGeo = {\n name: \"zoomOutGeo\",\n _cat: \"zoomout\",\n title: function(gd) {\n return _(gd, \"Zoom out\");\n },\n attr: \"zoom\",\n val: \"out\",\n icon: Icons.zoom_minus,\n click: handleGeo\n };\n modeBarButtons.resetGeo = {\n name: \"resetGeo\",\n _cat: \"reset\",\n title: function(gd) {\n return _(gd, \"Reset\");\n },\n attr: \"reset\",\n val: null,\n icon: Icons.autoscale,\n click: handleGeo\n };\n modeBarButtons.hoverClosestGeo = {\n name: \"hoverClosestGeo\",\n _cat: \"hoverclosest\",\n title: function(gd) {\n return _(gd, \"Toggle show closest data on hover\");\n },\n attr: \"hovermode\",\n val: null,\n toggle: true,\n icon: Icons.tooltip_basic,\n gravity: \"ne\",\n click: toggleHover\n };\n function handleGeo(gd, ev) {\n var button = ev.currentTarget;\n var attr = button.getAttribute(\"data-attr\");\n var val = button.getAttribute(\"data-val\") || true;\n var fullLayout = gd._fullLayout;\n var geoIds = fullLayout._subplots.geo || [];\n for (var i = 0; i < geoIds.length; i++) {\n var id = geoIds[i];\n var geoLayout = fullLayout[id];\n if (attr === \"zoom\") {\n var scale = geoLayout.projection.scale;\n var newScale = val === \"in\" ? 2 * scale : 0.5 * scale;\n Registry.call(\"_guiRelayout\", gd, id + \".projection.scale\", newScale);\n }\n }\n if (attr === \"reset\") {\n resetView(gd, \"geo\");\n }\n }\n modeBarButtons.hoverClosestPie = {\n name: \"hoverClosestPie\",\n _cat: \"hoverclosest\",\n title: function(gd) {\n return _(gd, \"Toggle show closest data on hover\");\n },\n attr: \"hovermode\",\n val: \"closest\",\n icon: Icons.tooltip_basic,\n gravity: \"ne\",\n click: toggleHover\n };\n function getNextHover(gd) {\n var fullLayout = gd._fullLayout;\n if (fullLayout.hovermode) return false;\n if (fullLayout._has(\"cartesian\")) {\n return fullLayout._isHoriz ? \"y\" : \"x\";\n }\n return \"closest\";\n }\n function toggleHover(gd) {\n var newHover = getNextHover(gd);\n Registry.call(\"_guiRelayout\", gd, \"hovermode\", newHover);\n }\n modeBarButtons.resetViewSankey = {\n name: \"resetSankeyGroup\",\n title: function(gd) {\n return _(gd, \"Reset view\");\n },\n icon: Icons.home,\n click: function(gd) {\n var aObj = {\n \"node.groups\": [],\n \"node.x\": [],\n \"node.y\": []\n };\n for (var i = 0; i < gd._fullData.length; i++) {\n var viewInitial = gd._fullData[i]._viewInitial;\n aObj[\"node.groups\"].push(viewInitial.node.groups.slice());\n aObj[\"node.x\"].push(viewInitial.node.x.slice());\n aObj[\"node.y\"].push(viewInitial.node.y.slice());\n }\n Registry.call(\"restyle\", gd, aObj);\n }\n };\n modeBarButtons.toggleHover = {\n name: \"toggleHover\",\n title: function(gd) {\n return _(gd, \"Toggle show closest data on hover\");\n },\n attr: \"hovermode\",\n val: null,\n toggle: true,\n icon: Icons.tooltip_basic,\n gravity: \"ne\",\n click: function(gd, ev) {\n var layoutUpdate = getNextHover3d(gd, ev);\n layoutUpdate.hovermode = getNextHover(gd);\n Registry.call(\"_guiRelayout\", gd, layoutUpdate);\n }\n };\n modeBarButtons.resetViews = {\n name: \"resetViews\",\n title: function(gd) {\n return _(gd, \"Reset views\");\n },\n icon: Icons.home,\n click: function(gd, ev) {\n var button = ev.currentTarget;\n button.setAttribute(\"data-attr\", \"zoom\");\n button.setAttribute(\"data-val\", \"reset\");\n handleCartesian(gd, ev);\n button.setAttribute(\"data-attr\", \"resetLastSave\");\n handleCamera3d(gd, ev);\n resetView(gd, \"geo\");\n resetView(gd, \"mapbox\");\n resetView(gd, \"map\");\n }\n };\n modeBarButtons.toggleSpikelines = {\n name: \"toggleSpikelines\",\n title: function(gd) {\n return _(gd, \"Toggle Spike Lines\");\n },\n icon: Icons.spikeline,\n attr: \"_cartesianSpikesEnabled\",\n val: \"on\",\n click: function(gd) {\n var fullLayout = gd._fullLayout;\n var allSpikesEnabled = fullLayout._cartesianSpikesEnabled;\n fullLayout._cartesianSpikesEnabled = allSpikesEnabled === \"on\" ? \"off\" : \"on\";\n Registry.call(\"_guiRelayout\", gd, setSpikelineVisibility(gd));\n }\n };\n function setSpikelineVisibility(gd) {\n var fullLayout = gd._fullLayout;\n var areSpikesOn = fullLayout._cartesianSpikesEnabled === \"on\";\n var axList = axisIds.list(gd, null, true);\n var aobj = {};\n for (var i = 0; i < axList.length; i++) {\n var ax = axList[i];\n aobj[ax._name + \".showspikes\"] = areSpikesOn ? true : ax._showSpikeInitial;\n }\n return aobj;\n }\n modeBarButtons.resetViewMapbox = {\n name: \"resetViewMapbox\",\n _cat: \"resetView\",\n title: function(gd) {\n return _(gd, \"Reset view\");\n },\n attr: \"reset\",\n icon: Icons.home,\n click: function(gd) {\n resetView(gd, \"mapbox\");\n }\n };\n modeBarButtons.resetViewMap = {\n name: \"resetViewMap\",\n _cat: \"resetView\",\n title: function(gd) {\n return _(gd, \"Reset view\");\n },\n attr: \"reset\",\n icon: Icons.home,\n click: function(gd) {\n resetView(gd, \"map\");\n }\n };\n modeBarButtons.zoomInMapbox = {\n name: \"zoomInMapbox\",\n _cat: \"zoomin\",\n title: function(gd) {\n return _(gd, \"Zoom in\");\n },\n attr: \"zoom\",\n val: \"in\",\n icon: Icons.zoom_plus,\n click: handleMapboxZoom\n };\n modeBarButtons.zoomInMap = {\n name: \"zoomInMap\",\n _cat: \"zoomin\",\n title: function(gd) {\n return _(gd, \"Zoom in\");\n },\n attr: \"zoom\",\n val: \"in\",\n icon: Icons.zoom_plus,\n click: handleMapZoom\n };\n modeBarButtons.zoomOutMapbox = {\n name: \"zoomOutMapbox\",\n _cat: \"zoomout\",\n title: function(gd) {\n return _(gd, \"Zoom out\");\n },\n attr: \"zoom\",\n val: \"out\",\n icon: Icons.zoom_minus,\n click: handleMapboxZoom\n };\n modeBarButtons.zoomOutMap = {\n name: \"zoomOutMap\",\n _cat: \"zoomout\",\n title: function(gd) {\n return _(gd, \"Zoom out\");\n },\n attr: \"zoom\",\n val: \"out\",\n icon: Icons.zoom_minus,\n click: handleMapZoom\n };\n function handleMapboxZoom(gd, ev) {\n _handleMapZoom(gd, ev, \"mapbox\");\n }\n function handleMapZoom(gd, ev) {\n _handleMapZoom(gd, ev, \"map\");\n }\n function _handleMapZoom(gd, ev, mapType) {\n var button = ev.currentTarget;\n var val = button.getAttribute(\"data-val\");\n var fullLayout = gd._fullLayout;\n var subplotIds = fullLayout._subplots[mapType] || [];\n var scalar = 1.05;\n var aObj = {};\n for (var i = 0; i < subplotIds.length; i++) {\n var id = subplotIds[i];\n var current = fullLayout[id].zoom;\n var next = val === \"in\" ? scalar * current : current / scalar;\n aObj[id + \".zoom\"] = next;\n }\n Registry.call(\"_guiRelayout\", gd, aObj);\n }\n function resetView(gd, subplotType) {\n var fullLayout = gd._fullLayout;\n var subplotIds = fullLayout._subplots[subplotType] || [];\n var aObj = {};\n for (var i = 0; i < subplotIds.length; i++) {\n var id = subplotIds[i];\n var subplotObj = fullLayout[id]._subplot;\n var viewInitial = subplotObj.viewInitial;\n var viewKeys = Object.keys(viewInitial);\n for (var j = 0; j < viewKeys.length; j++) {\n var key = viewKeys[j];\n aObj[id + \".\" + key] = viewInitial[key];\n }\n }\n Registry.call(\"_guiRelayout\", gd, aObj);\n }\n }\n });\n\n // src/components/modebar/constants.js\n var require_constants6 = __commonJS({\n \"src/components/modebar/constants.js\"(exports, module) {\n \"use strict\";\n var modeBarButtons = require_buttons();\n var buttonList = Object.keys(modeBarButtons);\n var DRAW_MODES = [\n \"drawline\",\n \"drawopenpath\",\n \"drawclosedpath\",\n \"drawcircle\",\n \"drawrect\",\n \"eraseshape\"\n ];\n var backButtons = [\n \"v1hovermode\",\n \"hoverclosest\",\n \"hovercompare\",\n \"togglehover\",\n \"togglespikelines\"\n ].concat(DRAW_MODES);\n var foreButtons = [];\n var addToForeButtons = function(b) {\n if (backButtons.indexOf(b._cat || b.name) !== -1) return;\n var name2 = b.name;\n var _cat = (b._cat || b.name).toLowerCase();\n if (foreButtons.indexOf(name2) === -1) foreButtons.push(name2);\n if (foreButtons.indexOf(_cat) === -1) foreButtons.push(_cat);\n };\n buttonList.forEach(function(k) {\n addToForeButtons(modeBarButtons[k]);\n });\n foreButtons.sort();\n module.exports = {\n DRAW_MODES,\n backButtons,\n foreButtons\n };\n }\n });\n\n // src/components/modebar/attributes.js\n var require_attributes10 = __commonJS({\n \"src/components/modebar/attributes.js\"(exports, module) {\n \"use strict\";\n var constants = require_constants6();\n module.exports = {\n editType: \"modebar\",\n orientation: {\n valType: \"enumerated\",\n values: [\"v\", \"h\"],\n dflt: \"h\",\n editType: \"modebar\"\n },\n bgcolor: {\n valType: \"color\",\n editType: \"modebar\"\n },\n color: {\n valType: \"color\",\n editType: \"modebar\"\n },\n activecolor: {\n valType: \"color\",\n editType: \"modebar\"\n },\n uirevision: {\n valType: \"any\",\n editType: \"none\"\n },\n add: {\n valType: \"string\",\n arrayOk: true,\n dflt: \"\",\n editType: \"modebar\"\n },\n remove: {\n valType: \"string\",\n arrayOk: true,\n dflt: \"\",\n editType: \"modebar\"\n }\n };\n }\n });\n\n // src/components/modebar/defaults.js\n var require_defaults5 = __commonJS({\n \"src/components/modebar/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Color2 = require_color();\n var Template = require_plot_template();\n var attributes = require_attributes10();\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {\n var containerIn = layoutIn.modebar || {};\n var containerOut = Template.newContainer(layoutOut, \"modebar\");\n function coerce(attr, dflt) {\n return Lib.coerce(containerIn, containerOut, attributes, attr, dflt);\n }\n coerce(\"orientation\");\n coerce(\"bgcolor\", Color2.addOpacity(layoutOut.paper_bgcolor, 0.5));\n var defaultColor = Color2.contrast(Color2.rgb(layoutOut.modebar.bgcolor));\n coerce(\"color\", Color2.addOpacity(defaultColor, 0.3));\n coerce(\"activecolor\", Color2.addOpacity(defaultColor, 0.7));\n coerce(\"uirevision\", layoutOut.uirevision);\n coerce(\"add\");\n coerce(\"remove\");\n };\n }\n });\n\n // src/components/modebar/modebar.js\n var require_modebar = __commonJS({\n \"src/components/modebar/modebar.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var Icons = require_ploticon();\n var version = require_version().version;\n var Parser = new DOMParser();\n function ModeBar(opts) {\n this.container = opts.container;\n this.element = document.createElement(\"div\");\n this.update(opts.graphInfo, opts.buttons);\n this.container.appendChild(this.element);\n }\n var proto = ModeBar.prototype;\n proto.update = function(graphInfo, buttons) {\n this.graphInfo = graphInfo;\n var context = this.graphInfo._context;\n var fullLayout = this.graphInfo._fullLayout;\n var modeBarId = \"modebar-\" + fullLayout._uid;\n this.element.setAttribute(\"id\", modeBarId);\n this._uid = modeBarId;\n this.element.className = \"modebar\";\n if (context.displayModeBar === \"hover\") this.element.className += \" modebar--hover ease-bg\";\n if (fullLayout.modebar.orientation === \"v\") {\n this.element.className += \" vertical\";\n buttons = buttons.reverse();\n }\n var style = fullLayout.modebar;\n var groupSelector = \"#\" + modeBarId + \" .modebar-group\";\n document.querySelectorAll(groupSelector).forEach(function(group) {\n group.style.backgroundColor = style.bgcolor;\n });\n var needsNewButtons = !this.hasButtons(buttons);\n var needsNewLogo = this.hasLogo !== context.displaylogo;\n var needsNewLocale = this.locale !== context.locale;\n this.locale = context.locale;\n if (needsNewButtons || needsNewLogo || needsNewLocale) {\n this.removeAllButtons();\n this.updateButtons(buttons);\n if (context.watermark || context.displaylogo) {\n var logoGroup = this.getLogo();\n if (context.watermark) {\n logoGroup.className = logoGroup.className + \" watermark\";\n }\n if (fullLayout.modebar.orientation === \"v\") {\n this.element.insertBefore(logoGroup, this.element.childNodes[0]);\n } else {\n this.element.appendChild(logoGroup);\n }\n this.hasLogo = true;\n }\n }\n this.updateActiveButton();\n Lib.setStyleOnHover(\"#\" + modeBarId + \" .modebar-btn\", \".active\", \".icon path\", \"fill: \" + style.activecolor, \"fill: \" + style.color, this.element);\n };\n proto.updateButtons = function(buttons) {\n var _this = this;\n this.buttons = buttons;\n this.buttonElements = [];\n this.buttonsNames = [];\n this.buttons.forEach(function(buttonGroup) {\n var group = _this.createGroup();\n buttonGroup.forEach(function(buttonConfig) {\n var buttonName = buttonConfig.name;\n if (!buttonName) {\n throw new Error(\"must provide button 'name' in button config\");\n }\n if (_this.buttonsNames.indexOf(buttonName) !== -1) {\n throw new Error(\"button name '\" + buttonName + \"' is taken\");\n }\n _this.buttonsNames.push(buttonName);\n var button = _this.createButton(buttonConfig);\n _this.buttonElements.push(button);\n group.appendChild(button);\n });\n _this.element.appendChild(group);\n });\n };\n proto.createGroup = function() {\n var group = document.createElement(\"div\");\n group.className = \"modebar-group\";\n var style = this.graphInfo._fullLayout.modebar;\n group.style.backgroundColor = style.bgcolor;\n return group;\n };\n proto.createButton = function(config) {\n var _this = this;\n var button = document.createElement(\"a\");\n button.setAttribute(\"rel\", \"tooltip\");\n button.className = \"modebar-btn\";\n var title = config.title;\n if (title === void 0) title = config.name;\n else if (typeof title === \"function\") title = title(this.graphInfo);\n if (title || title === 0) button.setAttribute(\"data-title\", title);\n if (config.attr !== void 0) button.setAttribute(\"data-attr\", config.attr);\n var val = config.val;\n if (val !== void 0) {\n if (typeof val === \"function\") val = val(this.graphInfo);\n button.setAttribute(\"data-val\", val);\n }\n var click = config.click;\n if (typeof click !== \"function\") {\n throw new Error(\"must provide button 'click' function in button config\");\n } else {\n button.addEventListener(\"click\", function(ev) {\n config.click(_this.graphInfo, ev);\n _this.updateActiveButton(ev.currentTarget);\n });\n }\n button.setAttribute(\"data-toggle\", config.toggle || false);\n if (config.toggle) d3.select(button).classed(\"active\", true);\n var icon = config.icon;\n if (typeof icon === \"function\") {\n button.appendChild(icon());\n } else {\n button.appendChild(this.createIcon(icon || Icons.question));\n }\n button.setAttribute(\"data-gravity\", config.gravity || \"n\");\n return button;\n };\n proto.createIcon = function(thisIcon) {\n var iconHeight = isNumeric(thisIcon.height) ? Number(thisIcon.height) : thisIcon.ascent - thisIcon.descent;\n var svgNS = \"http://www.w3.org/2000/svg\";\n var icon;\n if (thisIcon.path) {\n icon = document.createElementNS(svgNS, \"svg\");\n icon.setAttribute(\"viewBox\", [0, 0, thisIcon.width, iconHeight].join(\" \"));\n icon.setAttribute(\"class\", \"icon\");\n var path = document.createElementNS(svgNS, \"path\");\n path.setAttribute(\"d\", thisIcon.path);\n if (thisIcon.transform) {\n path.setAttribute(\"transform\", thisIcon.transform);\n } else if (thisIcon.ascent !== void 0) {\n path.setAttribute(\"transform\", \"matrix(1 0 0 -1 0 \" + thisIcon.ascent + \")\");\n }\n icon.appendChild(path);\n }\n if (thisIcon.svg) {\n var svgDoc = Parser.parseFromString(thisIcon.svg, \"application/xml\");\n icon = svgDoc.childNodes[0];\n }\n icon.setAttribute(\"height\", \"1em\");\n icon.setAttribute(\"width\", \"1em\");\n return icon;\n };\n proto.updateActiveButton = function(buttonClicked) {\n var fullLayout = this.graphInfo._fullLayout;\n var dataAttrClicked = buttonClicked !== void 0 ? buttonClicked.getAttribute(\"data-attr\") : null;\n this.buttonElements.forEach(function(button) {\n var thisval = button.getAttribute(\"data-val\") || true;\n var dataAttr = button.getAttribute(\"data-attr\");\n var isToggleButton = button.getAttribute(\"data-toggle\") === \"true\";\n var button3 = d3.select(button);\n var updateButtonStyle = function(button2, isActive2) {\n var style = fullLayout.modebar;\n var childEl = button2.querySelector(\".icon path\");\n if (childEl) {\n if (isActive2 || button2.matches(\":hover\")) {\n childEl.style.fill = style.activecolor;\n } else {\n childEl.style.fill = style.color;\n }\n }\n };\n if (isToggleButton) {\n if (dataAttr === dataAttrClicked) {\n var isActive = !button3.classed(\"active\");\n button3.classed(\"active\", isActive);\n updateButtonStyle(button, isActive);\n }\n } else {\n var val = dataAttr === null ? dataAttr : Lib.nestedProperty(fullLayout, dataAttr).get();\n button3.classed(\"active\", val === thisval);\n updateButtonStyle(button, val === thisval);\n }\n });\n };\n proto.hasButtons = function(buttons) {\n var currentButtons = this.buttons;\n if (!currentButtons) return false;\n if (buttons.length !== currentButtons.length) return false;\n for (var i = 0; i < buttons.length; ++i) {\n if (buttons[i].length !== currentButtons[i].length) return false;\n for (var j = 0; j < buttons[i].length; j++) {\n if (buttons[i][j].name !== currentButtons[i][j].name) return false;\n }\n }\n return true;\n };\n function jsVersion(str) {\n return str + \" (v\" + version + \")\";\n }\n proto.getLogo = function() {\n var group = this.createGroup();\n var a = document.createElement(\"a\");\n a.href = \"https://plotly.com/\";\n a.target = \"_blank\";\n a.setAttribute(\"data-title\", jsVersion(Lib._(this.graphInfo, \"Produced with Plotly.js\")));\n a.className = \"modebar-btn plotlyjsicon modebar-btn--logo\";\n a.appendChild(this.createIcon(Icons.newplotlylogo));\n group.appendChild(a);\n return group;\n };\n proto.removeAllButtons = function() {\n while (this.element.firstChild) {\n this.element.removeChild(this.element.firstChild);\n }\n this.hasLogo = false;\n };\n proto.destroy = function() {\n Lib.removeElement(this.container.querySelector(\".modebar\"));\n };\n function createModeBar(gd, buttons) {\n var fullLayout = gd._fullLayout;\n var modeBar = new ModeBar({\n graphInfo: gd,\n container: fullLayout._modebardiv.node(),\n buttons\n });\n if (fullLayout._privateplot) {\n d3.select(modeBar.element).append(\"span\").classed(\"badge-private float--left\", true).text(\"PRIVATE\");\n }\n return modeBar;\n }\n module.exports = createModeBar;\n }\n });\n\n // src/components/modebar/manage.js\n var require_manage = __commonJS({\n \"src/components/modebar/manage.js\"(exports, module) {\n \"use strict\";\n var axisIds = require_axis_ids();\n var scatterSubTypes = require_subtypes();\n var Registry = require_registry();\n var isUnifiedHover = require_helpers2().isUnifiedHover;\n var createModeBar = require_modebar();\n var modeBarButtons = require_buttons();\n var DRAW_MODES = require_constants6().DRAW_MODES;\n var extendDeep = require_lib().extendDeep;\n module.exports = function manageModeBar(gd) {\n var fullLayout = gd._fullLayout;\n var context = gd._context;\n var modeBar = fullLayout._modeBar;\n if (!context.displayModeBar && !context.watermark) {\n if (modeBar) {\n modeBar.destroy();\n delete fullLayout._modeBar;\n }\n return;\n }\n if (!Array.isArray(context.modeBarButtonsToRemove)) {\n throw new Error([\n \"*modeBarButtonsToRemove* configuration options\",\n \"must be an array.\"\n ].join(\" \"));\n }\n if (!Array.isArray(context.modeBarButtonsToAdd)) {\n throw new Error([\n \"*modeBarButtonsToAdd* configuration options\",\n \"must be an array.\"\n ].join(\" \"));\n }\n var customButtons = context.modeBarButtons;\n var buttonGroups;\n if (Array.isArray(customButtons) && customButtons.length) {\n buttonGroups = fillCustomButton(customButtons);\n } else if (!context.displayModeBar && context.watermark) {\n buttonGroups = [];\n } else {\n buttonGroups = getButtonGroups(gd);\n }\n if (modeBar) modeBar.update(gd, buttonGroups);\n else fullLayout._modeBar = createModeBar(gd, buttonGroups);\n };\n function getButtonGroups(gd) {\n var fullLayout = gd._fullLayout;\n var fullData = gd._fullData;\n var context = gd._context;\n function match(name2, B2) {\n if (typeof B2 === \"string\") {\n if (B2.toLowerCase() === name2.toLowerCase()) return true;\n } else {\n var v0 = B2.name;\n var v1 = B2._cat || B2.name;\n if (v0 === name2 || v1 === name2.toLowerCase()) return true;\n }\n return false;\n }\n var layoutAdd = fullLayout.modebar.add;\n if (typeof layoutAdd === \"string\") layoutAdd = [layoutAdd];\n var layoutRemove = fullLayout.modebar.remove;\n if (typeof layoutRemove === \"string\") layoutRemove = [layoutRemove];\n var buttonsToAdd = context.modeBarButtonsToAdd.concat(\n layoutAdd.filter(function(e) {\n for (var i2 = 0; i2 < context.modeBarButtonsToRemove.length; i2++) {\n if (match(e, context.modeBarButtonsToRemove[i2])) return false;\n }\n return true;\n })\n );\n var buttonsToRemove = context.modeBarButtonsToRemove.concat(\n layoutRemove.filter(function(e) {\n for (var i2 = 0; i2 < context.modeBarButtonsToAdd.length; i2++) {\n if (match(e, context.modeBarButtonsToAdd[i2])) return false;\n }\n return true;\n })\n );\n var hasCartesian = fullLayout._has(\"cartesian\");\n var hasGL3D = fullLayout._has(\"gl3d\");\n var hasGeo = fullLayout._has(\"geo\");\n var hasPie = fullLayout._has(\"pie\");\n var hasFunnelarea = fullLayout._has(\"funnelarea\");\n var hasTernary = fullLayout._has(\"ternary\");\n var hasMapbox = fullLayout._has(\"mapbox\");\n var hasMap = fullLayout._has(\"map\");\n var hasPolar = fullLayout._has(\"polar\");\n var hasSmith = fullLayout._has(\"smith\");\n var hasSankey = fullLayout._has(\"sankey\");\n var allAxesFixed = areAllAxesFixed(fullLayout);\n var hasUnifiedHoverLabel = isUnifiedHover(fullLayout.hovermode);\n var groups = [];\n function addGroup(newGroup) {\n if (!newGroup.length) return;\n var out = [];\n for (var i2 = 0; i2 < newGroup.length; i2++) {\n var name2 = newGroup[i2];\n var B2 = modeBarButtons[name2];\n var v0 = B2.name.toLowerCase();\n var v1 = (B2._cat || B2.name).toLowerCase();\n var found = false;\n for (var q = 0; q < buttonsToRemove.length; q++) {\n var t = buttonsToRemove[q].toLowerCase();\n if (t === v0 || t === v1) {\n found = true;\n break;\n }\n }\n if (found) continue;\n out.push(modeBarButtons[name2]);\n }\n groups.push(out);\n }\n var commonGroup = [\"toImage\"];\n if (context.showEditInChartStudio) commonGroup.push(\"editInChartStudio\");\n else if (context.showSendToCloud) commonGroup.push(\"sendDataToCloud\");\n addGroup(commonGroup);\n var zoomGroup = [];\n var hoverGroup = [];\n var resetGroup = [];\n var dragModeGroup = [];\n if ((hasCartesian || hasPie || hasFunnelarea || hasTernary) + hasGeo + hasGL3D + hasMapbox + hasMap + hasPolar + hasSmith > 1) {\n hoverGroup = [\"toggleHover\"];\n resetGroup = [\"resetViews\"];\n } else if (hasGeo) {\n zoomGroup = [\"zoomInGeo\", \"zoomOutGeo\"];\n hoverGroup = [\"hoverClosestGeo\"];\n resetGroup = [\"resetGeo\"];\n } else if (hasGL3D) {\n hoverGroup = [\"hoverClosest3d\"];\n resetGroup = [\"resetCameraDefault3d\", \"resetCameraLastSave3d\"];\n } else if (hasMapbox) {\n zoomGroup = [\"zoomInMapbox\", \"zoomOutMapbox\"];\n hoverGroup = [\"toggleHover\"];\n resetGroup = [\"resetViewMapbox\"];\n } else if (hasMap) {\n zoomGroup = [\"zoomInMap\", \"zoomOutMap\"];\n hoverGroup = [\"toggleHover\"];\n resetGroup = [\"resetViewMap\"];\n } else if (hasPie) {\n hoverGroup = [\"hoverClosestPie\"];\n } else if (hasSankey) {\n hoverGroup = [\"hoverClosestCartesian\", \"hoverCompareCartesian\"];\n resetGroup = [\"resetViewSankey\"];\n } else {\n hoverGroup = [\"toggleHover\"];\n }\n if (hasCartesian) {\n hoverGroup.push(\"toggleSpikelines\", \"hoverClosestCartesian\", \"hoverCompareCartesian\");\n }\n if (hasNoHover(fullData) || hasUnifiedHoverLabel) {\n hoverGroup = [];\n }\n if (hasCartesian && !allAxesFixed) {\n zoomGroup = [\"zoomIn2d\", \"zoomOut2d\", \"autoScale2d\"];\n if (resetGroup[0] !== \"resetViews\") resetGroup = [\"resetScale2d\"];\n }\n if (hasGL3D) {\n dragModeGroup = [\"zoom3d\", \"pan3d\", \"orbitRotation\", \"tableRotation\"];\n } else if (hasCartesian && !allAxesFixed || hasTernary) {\n dragModeGroup = [\"zoom2d\", \"pan2d\"];\n } else if (hasMapbox || hasMap || hasGeo) {\n dragModeGroup = [\"pan2d\"];\n } else if (hasPolar) {\n dragModeGroup = [\"zoom2d\"];\n }\n if (isSelectable(fullData)) {\n dragModeGroup.push(\"select2d\", \"lasso2d\");\n }\n var enabledHoverGroup = [];\n var enableHover = function(a) {\n if (enabledHoverGroup.indexOf(a) !== -1) return;\n if (hoverGroup.indexOf(a) !== -1) {\n enabledHoverGroup.push(a);\n }\n };\n if (Array.isArray(buttonsToAdd)) {\n var newList = [];\n for (var i = 0; i < buttonsToAdd.length; i++) {\n var b = buttonsToAdd[i];\n if (typeof b === \"string\") {\n b = b.toLowerCase();\n if (DRAW_MODES.indexOf(b) !== -1) {\n if (fullLayout._has(\"mapbox\") || fullLayout._has(\"map\") || // draw shapes in paper coordinate (could be improved in future to support data coordinate, when there is no pitch)\n fullLayout._has(\"cartesian\")) {\n dragModeGroup.push(b);\n }\n } else if (b === \"togglespikelines\") {\n enableHover(\"toggleSpikelines\");\n } else if (b === \"togglehover\") {\n enableHover(\"toggleHover\");\n } else if (b === \"hovercompare\") {\n enableHover(\"hoverCompareCartesian\");\n } else if (b === \"hoverclosest\") {\n enableHover(\"hoverClosestCartesian\");\n enableHover(\"hoverClosestGeo\");\n enableHover(\"hoverClosest3d\");\n enableHover(\"hoverClosestPie\");\n } else if (b === \"v1hovermode\") {\n enableHover(\"hoverClosestCartesian\");\n enableHover(\"hoverCompareCartesian\");\n enableHover(\"hoverClosestGeo\");\n enableHover(\"hoverClosest3d\");\n enableHover(\"hoverClosestPie\");\n }\n } else newList.push(b);\n }\n buttonsToAdd = newList;\n }\n addGroup(dragModeGroup);\n addGroup(zoomGroup.concat(resetGroup));\n addGroup(enabledHoverGroup);\n return appendButtonsToGroups(groups, buttonsToAdd);\n }\n function areAllAxesFixed(fullLayout) {\n var axList = axisIds.list({ _fullLayout: fullLayout }, null, true);\n for (var i = 0; i < axList.length; i++) {\n if (!axList[i].fixedrange) {\n return false;\n }\n }\n return true;\n }\n function isSelectable(fullData) {\n var selectable = false;\n for (var i = 0; i < fullData.length; i++) {\n if (selectable) break;\n var trace = fullData[i];\n if (!trace._module || !trace._module.selectPoints) continue;\n if (Registry.traceIs(trace, \"scatter-like\")) {\n if (scatterSubTypes.hasMarkers(trace) || scatterSubTypes.hasText(trace)) {\n selectable = true;\n }\n } else if (Registry.traceIs(trace, \"box-violin\")) {\n if (trace.boxpoints === \"all\" || trace.points === \"all\") {\n selectable = true;\n }\n } else {\n selectable = true;\n }\n }\n return selectable;\n }\n function hasNoHover(fullData) {\n for (var i = 0; i < fullData.length; i++) {\n if (!Registry.traceIs(fullData[i], \"noHover\")) return false;\n }\n return true;\n }\n function appendButtonsToGroups(groups, buttons) {\n if (buttons.length) {\n if (Array.isArray(buttons[0])) {\n for (var i = 0; i < buttons.length; i++) {\n groups.push(buttons[i]);\n }\n } else groups.push(buttons);\n }\n return groups;\n }\n function fillCustomButton(originalModeBarButtons) {\n var customButtons = extendDeep([], originalModeBarButtons);\n for (var i = 0; i < customButtons.length; i++) {\n var buttonGroup = customButtons[i];\n for (var j = 0; j < buttonGroup.length; j++) {\n var button = buttonGroup[j];\n if (typeof button === \"string\") {\n if (modeBarButtons[button] !== void 0) {\n customButtons[i][j] = modeBarButtons[button];\n } else {\n throw new Error([\n \"*modeBarButtons* configuration options\",\n \"invalid button name\"\n ].join(\" \"));\n }\n }\n }\n }\n return customButtons;\n }\n }\n });\n\n // src/components/modebar/index.js\n var require_modebar2 = __commonJS({\n \"src/components/modebar/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"component\",\n name: \"modebar\",\n layoutAttributes: require_attributes10(),\n supplyLayoutDefaults: require_defaults5(),\n manage: require_manage()\n };\n }\n });\n\n // src/plots/cartesian/scale_zoom.js\n var require_scale_zoom = __commonJS({\n \"src/plots/cartesian/scale_zoom.js\"(exports, module) {\n \"use strict\";\n var FROM_BL = require_alignment().FROM_BL;\n module.exports = function scaleZoom(ax, factor, centerFraction) {\n if (centerFraction === void 0) {\n centerFraction = FROM_BL[ax.constraintoward || \"center\"];\n }\n var rangeLinear = [ax.r2l(ax.range[0]), ax.r2l(ax.range[1])];\n var center = rangeLinear[0] + (rangeLinear[1] - rangeLinear[0]) * centerFraction;\n ax.range = ax._input.range = [\n ax.l2r(center + (rangeLinear[0] - center) * factor),\n ax.l2r(center + (rangeLinear[1] - center) * factor)\n ];\n ax.setScale();\n };\n }\n });\n\n // src/plots/cartesian/constraints.js\n var require_constraints = __commonJS({\n \"src/plots/cartesian/constraints.js\"(exports) {\n \"use strict\";\n var Lib = require_lib();\n var autorange = require_autorange();\n var id2name = require_axis_ids().id2name;\n var layoutAttributes = require_layout_attributes4();\n var scaleZoom = require_scale_zoom();\n var setConvert = require_set_convert();\n var ALMOST_EQUAL = require_numerical().ALMOST_EQUAL;\n var FROM_BL = require_alignment().FROM_BL;\n exports.handleDefaults = function(layoutIn, layoutOut, opts) {\n var axIds = opts.axIds;\n var axHasImage = opts.axHasImage;\n var constraintGroups = layoutOut._axisConstraintGroups = [];\n var matchGroups = layoutOut._axisMatchGroups = [];\n var i, group, axId, axName, axIn, axOut, attr, val;\n for (i = 0; i < axIds.length; i++) {\n axName = id2name(axIds[i]);\n axIn = layoutIn[axName];\n axOut = layoutOut[axName];\n handleOneAxDefaults(axIn, axOut, {\n axIds,\n layoutOut,\n hasImage: axHasImage[axName]\n });\n }\n function stash(groups, stashAttr) {\n for (i = 0; i < groups.length; i++) {\n group = groups[i];\n for (axId in group) {\n layoutOut[id2name(axId)][stashAttr] = group;\n }\n }\n }\n stash(matchGroups, \"_matchGroup\");\n for (i = 0; i < constraintGroups.length; i++) {\n group = constraintGroups[i];\n for (axId in group) {\n axOut = layoutOut[id2name(axId)];\n if (axOut.fixedrange) {\n for (var axId2 in group) {\n var axName2 = id2name(axId2);\n if ((layoutIn[axName2] || {}).fixedrange === false) {\n Lib.warn(\n \"fixedrange was specified as false for axis \" + axName2 + \" but was overridden because another axis in its constraint group has fixedrange true\"\n );\n }\n layoutOut[axName2].fixedrange = true;\n }\n break;\n }\n }\n }\n i = 0;\n while (i < constraintGroups.length) {\n group = constraintGroups[i];\n for (axId in group) {\n axOut = layoutOut[id2name(axId)];\n if (axOut._matchGroup && Object.keys(axOut._matchGroup).length === Object.keys(group).length) {\n constraintGroups.splice(i, 1);\n i--;\n }\n break;\n }\n i++;\n }\n stash(constraintGroups, \"_constraintGroup\");\n var matchAttrs = [\n \"constrain\",\n \"range\",\n \"autorange\",\n \"rangemode\",\n \"rangebreaks\",\n \"categoryorder\",\n \"categoryarray\"\n ];\n var hasRange = false;\n var hasDayOfWeekBreaks = false;\n function setAttrVal() {\n val = axOut[attr];\n if (attr === \"rangebreaks\") {\n hasDayOfWeekBreaks = axOut._hasDayOfWeekBreaks;\n }\n }\n for (i = 0; i < matchGroups.length; i++) {\n group = matchGroups[i];\n for (var j = 0; j < matchAttrs.length; j++) {\n attr = matchAttrs[j];\n val = null;\n var baseAx;\n for (axId in group) {\n axName = id2name(axId);\n axIn = layoutIn[axName];\n axOut = layoutOut[axName];\n if (!(attr in axOut)) {\n continue;\n }\n if (!axOut.matches) {\n baseAx = axOut;\n if (attr in axIn) {\n setAttrVal();\n break;\n }\n }\n if (val === null && attr in axIn) {\n setAttrVal();\n }\n }\n if (attr === \"range\" && val && axIn.range && axIn.range.length === 2 && axIn.range[0] !== null && axIn.range[1] !== null) {\n hasRange = true;\n }\n if (attr === \"autorange\" && val === null && hasRange) {\n val = false;\n }\n if (val === null && attr in baseAx) {\n val = baseAx[attr];\n }\n if (val !== null) {\n for (axId in group) {\n axOut = layoutOut[id2name(axId)];\n axOut[attr] = attr === \"range\" ? val.slice() : val;\n if (attr === \"rangebreaks\") {\n axOut._hasDayOfWeekBreaks = hasDayOfWeekBreaks;\n setConvert(axOut, layoutOut);\n }\n }\n }\n }\n }\n };\n function handleOneAxDefaults(axIn, axOut, opts) {\n var axIds = opts.axIds;\n var layoutOut = opts.layoutOut;\n var hasImage = opts.hasImage;\n var constraintGroups = layoutOut._axisConstraintGroups;\n var matchGroups = layoutOut._axisMatchGroups;\n var axId = axOut._id;\n var axLetter = axId.charAt(0);\n var splomStash = ((layoutOut._splomAxes || {})[axLetter] || {})[axId] || {};\n var thisID = axOut._id;\n var isX = thisID.charAt(0) === \"x\";\n axOut._matchGroup = null;\n axOut._constraintGroup = null;\n function coerce(attr, dflt) {\n return Lib.coerce(axIn, axOut, layoutAttributes, attr, dflt);\n }\n coerce(\"constrain\", hasImage ? \"domain\" : \"range\");\n Lib.coerce(axIn, axOut, {\n constraintoward: {\n valType: \"enumerated\",\n values: isX ? [\"left\", \"center\", \"right\"] : [\"bottom\", \"middle\", \"top\"],\n dflt: isX ? \"center\" : \"middle\"\n }\n }, \"constraintoward\");\n var thisType = axOut.type;\n var i, idi;\n var linkableAxes = [];\n for (i = 0; i < axIds.length; i++) {\n idi = axIds[i];\n if (idi === thisID) continue;\n var axi = layoutOut[id2name(idi)];\n if (axi.type === thisType) {\n linkableAxes.push(idi);\n }\n }\n var thisGroup = getConstraintGroup(constraintGroups, thisID);\n if (thisGroup) {\n var linkableAxesNoLoops = [];\n for (i = 0; i < linkableAxes.length; i++) {\n idi = linkableAxes[i];\n if (!thisGroup[idi]) linkableAxesNoLoops.push(idi);\n }\n linkableAxes = linkableAxesNoLoops;\n }\n var canLink = linkableAxes.length;\n var matches, scaleanchor;\n if (canLink && (axIn.matches || splomStash.matches)) {\n matches = Lib.coerce(axIn, axOut, {\n matches: {\n valType: \"enumerated\",\n values: linkableAxes,\n dflt: linkableAxes.indexOf(splomStash.matches) !== -1 ? splomStash.matches : void 0\n }\n }, \"matches\");\n }\n var scaleanchorDflt = hasImage && !isX ? axOut.anchor : void 0;\n if (canLink && !matches && (axIn.scaleanchor || scaleanchorDflt)) {\n scaleanchor = Lib.coerce(axIn, axOut, {\n scaleanchor: {\n valType: \"enumerated\",\n values: linkableAxes.concat([false])\n }\n }, \"scaleanchor\", scaleanchorDflt);\n }\n if (matches) {\n axOut._matchGroup = updateConstraintGroups(matchGroups, thisID, matches, 1);\n var matchedAx = layoutOut[id2name(matches)];\n var matchRatio = extent(layoutOut, axOut) / extent(layoutOut, matchedAx);\n if (isX !== (matches.charAt(0) === \"x\")) {\n matchRatio = (isX ? \"x\" : \"y\") + matchRatio;\n }\n updateConstraintGroups(constraintGroups, thisID, matches, matchRatio);\n } else if (axIn.matches && axIds.indexOf(axIn.matches) !== -1) {\n Lib.warn(\"ignored \" + axOut._name + '.matches: \"' + axIn.matches + '\" to avoid an infinite loop');\n }\n if (scaleanchor) {\n var scaleratio = coerce(\"scaleratio\");\n if (!scaleratio) scaleratio = axOut.scaleratio = 1;\n updateConstraintGroups(constraintGroups, thisID, scaleanchor, scaleratio);\n } else if (axIn.scaleanchor && axIds.indexOf(axIn.scaleanchor) !== -1) {\n Lib.warn(\"ignored \" + axOut._name + '.scaleanchor: \"' + axIn.scaleanchor + '\" to avoid either an infinite loop and possibly inconsistent scaleratios, or because this axis declares a *matches* constraint.');\n }\n }\n function extent(layoutOut, ax) {\n var domain = ax.domain;\n if (!domain) {\n domain = layoutOut[id2name(ax.overlaying)].domain;\n }\n return domain[1] - domain[0];\n }\n function getConstraintGroup(groups, thisID) {\n for (var i = 0; i < groups.length; i++) {\n if (groups[i][thisID]) {\n return groups[i];\n }\n }\n return null;\n }\n function updateConstraintGroups(constraintGroups, thisID, thatID, scaleratio) {\n var i, j, groupi, keyj, thisGroupIndex;\n var thisGroup = getConstraintGroup(constraintGroups, thisID);\n if (thisGroup === null) {\n thisGroup = {};\n thisGroup[thisID] = 1;\n thisGroupIndex = constraintGroups.length;\n constraintGroups.push(thisGroup);\n } else {\n thisGroupIndex = constraintGroups.indexOf(thisGroup);\n }\n var thisGroupKeys = Object.keys(thisGroup);\n for (i = 0; i < constraintGroups.length; i++) {\n groupi = constraintGroups[i];\n if (i !== thisGroupIndex && groupi[thatID]) {\n var baseScale = groupi[thatID];\n for (j = 0; j < thisGroupKeys.length; j++) {\n keyj = thisGroupKeys[j];\n groupi[keyj] = multiplyScales(baseScale, multiplyScales(scaleratio, thisGroup[keyj]));\n }\n constraintGroups.splice(thisGroupIndex, 1);\n return;\n }\n }\n if (scaleratio !== 1) {\n for (j = 0; j < thisGroupKeys.length; j++) {\n var key = thisGroupKeys[j];\n thisGroup[key] = multiplyScales(scaleratio, thisGroup[key]);\n }\n }\n thisGroup[thatID] = 1;\n }\n function multiplyScales(a, b) {\n var aPrefix = \"\";\n var bPrefix = \"\";\n var aLen, bLen;\n if (typeof a === \"string\") {\n aPrefix = a.match(/^[xy]*/)[0];\n aLen = aPrefix.length;\n a = +a.substr(aLen);\n }\n if (typeof b === \"string\") {\n bPrefix = b.match(/^[xy]*/)[0];\n bLen = bPrefix.length;\n b = +b.substr(bLen);\n }\n var c = a * b;\n if (!aLen && !bLen) {\n return c;\n }\n if (!aLen || !bLen || aPrefix.charAt(0) === bPrefix.charAt(0)) {\n return aPrefix + bPrefix + a * b;\n }\n if (aLen === bLen) {\n return c;\n }\n return (aLen > bLen ? aPrefix.substr(bLen) : bPrefix.substr(aLen)) + c;\n }\n function finalRatios(group, fullLayout) {\n var size = fullLayout._size;\n var yRatio = size.h / size.w;\n var out = {};\n var keys = Object.keys(group);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var val = group[key];\n if (typeof val === \"string\") {\n var prefix = val.match(/^[xy]*/)[0];\n var pLen = prefix.length;\n val = +val.substr(pLen);\n var mult = prefix.charAt(0) === \"y\" ? yRatio : 1 / yRatio;\n for (var j = 0; j < pLen; j++) {\n val *= mult;\n }\n }\n out[key] = val;\n }\n return out;\n }\n exports.enforce = function enforce(gd) {\n var fullLayout = gd._fullLayout;\n var constraintGroups = fullLayout._axisConstraintGroups || [];\n var i, j, group, axisID, ax, normScale, mode, factor;\n for (i = 0; i < constraintGroups.length; i++) {\n group = finalRatios(constraintGroups[i], fullLayout);\n var axisIDs = Object.keys(group);\n var minScale = Infinity;\n var maxScale = 0;\n var matchScale = Infinity;\n var normScales = {};\n var axes = {};\n var hasAnyDomainConstraint = false;\n for (j = 0; j < axisIDs.length; j++) {\n axisID = axisIDs[j];\n axes[axisID] = ax = fullLayout[id2name(axisID)];\n if (ax._inputDomain) ax.domain = ax._inputDomain.slice();\n else ax._inputDomain = ax.domain.slice();\n if (!ax._inputRange) ax._inputRange = ax.range.slice();\n ax.setScale();\n normScales[axisID] = normScale = Math.abs(ax._m) / group[axisID];\n minScale = Math.min(minScale, normScale);\n if (ax.constrain === \"domain\" || !ax._constraintShrinkable) {\n matchScale = Math.min(matchScale, normScale);\n }\n delete ax._constraintShrinkable;\n maxScale = Math.max(maxScale, normScale);\n if (ax.constrain === \"domain\") hasAnyDomainConstraint = true;\n }\n if (minScale > ALMOST_EQUAL * maxScale && !hasAnyDomainConstraint) continue;\n for (j = 0; j < axisIDs.length; j++) {\n axisID = axisIDs[j];\n normScale = normScales[axisID];\n ax = axes[axisID];\n mode = ax.constrain;\n if (normScale !== matchScale || mode === \"domain\") {\n factor = normScale / matchScale;\n if (mode === \"range\") {\n scaleZoom(ax, factor);\n } else {\n var inputDomain = ax._inputDomain;\n var domainShrunk = (ax.domain[1] - ax.domain[0]) / (inputDomain[1] - inputDomain[0]);\n var rangeShrunk = (ax.r2l(ax.range[1]) - ax.r2l(ax.range[0])) / (ax.r2l(ax._inputRange[1]) - ax.r2l(ax._inputRange[0]));\n factor /= domainShrunk;\n if (factor * rangeShrunk < 1) {\n ax.domain = ax._input.domain = inputDomain.slice();\n scaleZoom(ax, factor);\n continue;\n }\n if (rangeShrunk < 1) {\n ax.range = ax._input.range = ax._inputRange.slice();\n factor *= rangeShrunk;\n }\n if (ax.autorange) {\n var rl0 = ax.r2l(ax.range[0]);\n var rl1 = ax.r2l(ax.range[1]);\n var rangeCenter = (rl0 + rl1) / 2;\n var rangeMin = rangeCenter;\n var rangeMax = rangeCenter;\n var halfRange = Math.abs(rl1 - rangeCenter);\n var outerMin = rangeCenter - halfRange * factor * 1.0001;\n var outerMax = rangeCenter + halfRange * factor * 1.0001;\n var getPadMin = autorange.makePadFn(fullLayout, ax, 0);\n var getPadMax = autorange.makePadFn(fullLayout, ax, 1);\n updateDomain(ax, factor);\n var m = Math.abs(ax._m);\n var extremes = autorange.concatExtremes(gd, ax);\n var minArray = extremes.min;\n var maxArray = extremes.max;\n var newVal;\n var k;\n for (k = 0; k < minArray.length; k++) {\n newVal = minArray[k].val - getPadMin(minArray[k]) / m;\n if (newVal > outerMin && newVal < rangeMin) {\n rangeMin = newVal;\n }\n }\n for (k = 0; k < maxArray.length; k++) {\n newVal = maxArray[k].val + getPadMax(maxArray[k]) / m;\n if (newVal < outerMax && newVal > rangeMax) {\n rangeMax = newVal;\n }\n }\n var domainExpand = (rangeMax - rangeMin) / (2 * halfRange);\n factor /= domainExpand;\n rangeMin = ax.l2r(rangeMin);\n rangeMax = ax.l2r(rangeMax);\n ax.range = ax._input.range = rl0 < rl1 ? [rangeMin, rangeMax] : [rangeMax, rangeMin];\n }\n updateDomain(ax, factor);\n }\n }\n }\n }\n };\n exports.getAxisGroup = function getAxisGroup(fullLayout, axId) {\n var matchGroups = fullLayout._axisMatchGroups;\n for (var i = 0; i < matchGroups.length; i++) {\n var group = matchGroups[i];\n if (group[axId]) return \"g\" + i;\n }\n return axId;\n };\n exports.clean = function clean(gd, ax) {\n if (ax._inputDomain) {\n var isConstrained = false;\n var axId = ax._id;\n var constraintGroups = gd._fullLayout._axisConstraintGroups;\n for (var j = 0; j < constraintGroups.length; j++) {\n if (constraintGroups[j][axId]) {\n isConstrained = true;\n break;\n }\n }\n if (!isConstrained || ax.constrain !== \"domain\") {\n ax._input.domain = ax.domain = ax._inputDomain;\n delete ax._inputDomain;\n }\n }\n };\n function updateDomain(ax, factor) {\n var inputDomain = ax._inputDomain;\n var centerFraction = FROM_BL[ax.constraintoward];\n var center = inputDomain[0] + (inputDomain[1] - inputDomain[0]) * centerFraction;\n ax.domain = ax._input.domain = [\n center + (inputDomain[0] - center) / factor,\n center + (inputDomain[1] - center) / factor\n ];\n ax.setScale();\n }\n }\n });\n\n // src/plot_api/subroutines.js\n var require_subroutines = __commonJS({\n \"src/plot_api/subroutines.js\"(exports) {\n \"use strict\";\n var d3 = require_d3();\n var Registry = require_registry();\n var Plots = require_plots();\n var Lib = require_lib();\n var svgTextUtils = require_svg_text_utils();\n var clearGlCanvases = require_clear_gl_canvases();\n var Color2 = require_color();\n var Drawing = require_drawing();\n var Titles = require_titles();\n var ModeBar = require_modebar2();\n var Axes = require_axes();\n var alignmentConstants = require_alignment();\n var axisConstraints = require_constraints();\n var enforceAxisConstraints = axisConstraints.enforce;\n var cleanAxisConstraints = axisConstraints.clean;\n var doAutoRange = require_autorange().doAutoRange;\n var SVG_TEXT_ANCHOR_START = \"start\";\n var SVG_TEXT_ANCHOR_MIDDLE = \"middle\";\n var SVG_TEXT_ANCHOR_END = \"end\";\n var zindexSeparator = require_constants2().zindexSeparator;\n exports.layoutStyles = function(gd) {\n return Lib.syncOrAsync([Plots.doAutoMargin, lsInner], gd);\n };\n function overlappingDomain(xDomain, yDomain, domains) {\n for (var i = 0; i < domains.length; i++) {\n var existingX = domains[i][0];\n var existingY = domains[i][1];\n if (existingX[0] >= xDomain[1] || existingX[1] <= xDomain[0]) {\n continue;\n }\n if (existingY[0] < yDomain[1] && existingY[1] > yDomain[0]) {\n return true;\n }\n }\n return false;\n }\n function lsInner(gd) {\n var fullLayout = gd._fullLayout;\n var gs = fullLayout._size;\n var pad = gs.p;\n var axList = Axes.list(gd, \"\", true);\n var i, subplot, plotinfo, ax, xa, ya;\n fullLayout._paperdiv.style({\n width: gd._context.responsive && fullLayout.autosize && !gd._context._hasZeroWidth && !gd.layout.width ? \"100%\" : fullLayout.width + \"px\",\n height: gd._context.responsive && fullLayout.autosize && !gd._context._hasZeroHeight && !gd.layout.height ? \"100%\" : fullLayout.height + \"px\"\n }).selectAll(\".main-svg\").call(Drawing.setSize, fullLayout.width, fullLayout.height);\n gd._context.setBackground(gd, fullLayout.paper_bgcolor);\n exports.drawMainTitle(gd);\n ModeBar.manage(gd);\n if (!fullLayout._has(\"cartesian\")) {\n return Plots.previousPromises(gd);\n }\n function getLinePosition(ax2, counterAx2, side) {\n var lwHalf = ax2._lw / 2;\n if (ax2._id.charAt(0) === \"x\") {\n if (!counterAx2) return gs.t + gs.h * (1 - (ax2.position || 0)) + lwHalf % 1;\n else if (side === \"top\") return counterAx2._offset - pad - lwHalf;\n return counterAx2._offset + counterAx2._length + pad + lwHalf;\n }\n if (!counterAx2) return gs.l + gs.w * (ax2.position || 0) + lwHalf % 1;\n else if (side === \"right\") return counterAx2._offset + counterAx2._length + pad + lwHalf;\n return counterAx2._offset - pad - lwHalf;\n }\n for (i = 0; i < axList.length; i++) {\n ax = axList[i];\n var counterAx = ax._anchorAxis;\n ax._linepositions = {};\n ax._lw = Drawing.crispRound(gd, ax.linewidth, 1);\n ax._mainLinePosition = getLinePosition(ax, counterAx, ax.side);\n ax._mainMirrorPosition = ax.mirror && counterAx ? getLinePosition(\n ax,\n counterAx,\n alignmentConstants.OPPOSITE_SIDE[ax.side]\n ) : null;\n }\n var lowerBackgroundIDs = [];\n var backgroundIds = [];\n var lowerDomains = [];\n var noNeedForBg = Color2.opacity(fullLayout.paper_bgcolor) === 1 && Color2.opacity(fullLayout.plot_bgcolor) === 1 && fullLayout.paper_bgcolor === fullLayout.plot_bgcolor;\n for (subplot in fullLayout._plots) {\n plotinfo = fullLayout._plots[subplot];\n if (plotinfo.mainplot) {\n if (plotinfo.bg) {\n plotinfo.bg.remove();\n }\n plotinfo.bg = void 0;\n } else {\n var xDomain = plotinfo.xaxis.domain;\n var yDomain = plotinfo.yaxis.domain;\n var plotgroup = plotinfo.plotgroup;\n if (overlappingDomain(xDomain, yDomain, lowerDomains) && subplot.indexOf(zindexSeparator) === -1) {\n var pgNode = plotgroup.node();\n var plotgroupBg = plotinfo.bg = Lib.ensureSingle(plotgroup, \"rect\", \"bg\");\n pgNode.insertBefore(plotgroupBg.node(), pgNode.childNodes[0]);\n backgroundIds.push(subplot);\n } else {\n plotgroup.select(\"rect.bg\").remove();\n lowerDomains.push([xDomain, yDomain]);\n if (!noNeedForBg) {\n lowerBackgroundIDs.push(subplot);\n backgroundIds.push(subplot);\n }\n }\n }\n }\n var lowerBackgrounds = fullLayout._bgLayer.selectAll(\".bg\").data(lowerBackgroundIDs);\n lowerBackgrounds.enter().append(\"rect\").classed(\"bg\", true);\n lowerBackgrounds.exit().remove();\n lowerBackgrounds.each(function(subplot2) {\n fullLayout._plots[subplot2].bg = d3.select(this);\n });\n for (i = 0; i < backgroundIds.length; i++) {\n plotinfo = fullLayout._plots[backgroundIds[i]];\n xa = plotinfo.xaxis;\n ya = plotinfo.yaxis;\n if (plotinfo.bg && xa._offset !== void 0 && ya._offset !== void 0) {\n plotinfo.bg.call(\n Drawing.setRect,\n xa._offset - pad,\n ya._offset - pad,\n xa._length + 2 * pad,\n ya._length + 2 * pad\n ).call(Color2.fill, fullLayout.plot_bgcolor).style(\"stroke-width\", 0);\n }\n }\n if (!fullLayout._hasOnlyLargeSploms) {\n for (subplot in fullLayout._plots) {\n plotinfo = fullLayout._plots[subplot];\n xa = plotinfo.xaxis;\n ya = plotinfo.yaxis;\n var clipId = plotinfo.clipId = \"clip\" + fullLayout._uid + subplot + \"plot\";\n var plotClip = Lib.ensureSingleById(fullLayout._clips, \"clipPath\", clipId, function(s) {\n s.classed(\"plotclip\", true).append(\"rect\");\n });\n plotinfo.clipRect = plotClip.select(\"rect\").attr({\n width: xa._length,\n height: ya._length\n });\n Drawing.setTranslate(plotinfo.plot, xa._offset, ya._offset);\n var plotClipId;\n var layerClipId;\n if (plotinfo._hasClipOnAxisFalse) {\n plotClipId = null;\n layerClipId = clipId;\n } else {\n plotClipId = clipId;\n layerClipId = null;\n }\n Drawing.setClipUrl(plotinfo.plot, plotClipId, gd);\n plotinfo.layerClipId = layerClipId;\n }\n }\n var xLinesXLeft, xLinesXRight, xLinesYBottom, xLinesYTop, leftYLineWidth, rightYLineWidth;\n var yLinesYBottom, yLinesYTop, yLinesXLeft, yLinesXRight, connectYBottom, connectYTop;\n var extraSubplot;\n function xLinePath(y) {\n return \"M\" + xLinesXLeft + \",\" + y + \"H\" + xLinesXRight;\n }\n function xLinePathFree(y) {\n return \"M\" + xa._offset + \",\" + y + \"h\" + xa._length;\n }\n function yLinePath(x) {\n return \"M\" + x + \",\" + yLinesYTop + \"V\" + yLinesYBottom;\n }\n function yLinePathFree(x) {\n if (ya._shift !== void 0) {\n x += ya._shift;\n }\n return \"M\" + x + \",\" + ya._offset + \"v\" + ya._length;\n }\n function mainPath(ax2, pathFn, pathFnFree) {\n if (!ax2.showline || subplot !== ax2._mainSubplot) return \"\";\n if (!ax2._anchorAxis) return pathFnFree(ax2._mainLinePosition);\n var out = pathFn(ax2._mainLinePosition);\n if (ax2.mirror) out += pathFn(ax2._mainMirrorPosition);\n return out;\n }\n for (subplot in fullLayout._plots) {\n plotinfo = fullLayout._plots[subplot];\n xa = plotinfo.xaxis;\n ya = plotinfo.yaxis;\n var xPath = \"M0,0\";\n if (shouldShowLinesOrTicks(xa, subplot)) {\n leftYLineWidth = findCounterAxisLineWidth(xa, \"left\", ya, axList);\n xLinesXLeft = xa._offset - (leftYLineWidth ? pad + leftYLineWidth : 0);\n rightYLineWidth = findCounterAxisLineWidth(xa, \"right\", ya, axList);\n xLinesXRight = xa._offset + xa._length + (rightYLineWidth ? pad + rightYLineWidth : 0);\n xLinesYBottom = getLinePosition(xa, ya, \"bottom\");\n xLinesYTop = getLinePosition(xa, ya, \"top\");\n extraSubplot = !xa._anchorAxis || subplot !== xa._mainSubplot;\n if (extraSubplot && (xa.mirror === \"allticks\" || xa.mirror === \"all\")) {\n xa._linepositions[subplot] = [xLinesYBottom, xLinesYTop];\n }\n xPath = mainPath(xa, xLinePath, xLinePathFree);\n if (extraSubplot && xa.showline && (xa.mirror === \"all\" || xa.mirror === \"allticks\")) {\n xPath += xLinePath(xLinesYBottom) + xLinePath(xLinesYTop);\n }\n plotinfo.xlines.style(\"stroke-width\", xa._lw + \"px\").call(Color2.stroke, xa.showline ? xa.linecolor : \"rgba(0,0,0,0)\");\n }\n plotinfo.xlines.attr(\"d\", xPath);\n var yPath = \"M0,0\";\n if (shouldShowLinesOrTicks(ya, subplot)) {\n connectYBottom = findCounterAxisLineWidth(ya, \"bottom\", xa, axList);\n yLinesYBottom = ya._offset + ya._length + (connectYBottom ? pad : 0);\n connectYTop = findCounterAxisLineWidth(ya, \"top\", xa, axList);\n yLinesYTop = ya._offset - (connectYTop ? pad : 0);\n yLinesXLeft = getLinePosition(ya, xa, \"left\");\n yLinesXRight = getLinePosition(ya, xa, \"right\");\n extraSubplot = !ya._anchorAxis || subplot !== ya._mainSubplot;\n if (extraSubplot && (ya.mirror === \"allticks\" || ya.mirror === \"all\")) {\n ya._linepositions[subplot] = [yLinesXLeft, yLinesXRight];\n }\n yPath = mainPath(ya, yLinePath, yLinePathFree);\n if (extraSubplot && ya.showline && (ya.mirror === \"all\" || ya.mirror === \"allticks\")) {\n yPath += yLinePath(yLinesXLeft) + yLinePath(yLinesXRight);\n }\n plotinfo.ylines.style(\"stroke-width\", ya._lw + \"px\").call(Color2.stroke, ya.showline ? ya.linecolor : \"rgba(0,0,0,0)\");\n }\n plotinfo.ylines.attr(\"d\", yPath);\n }\n Axes.makeClipPaths(gd);\n return Plots.previousPromises(gd);\n }\n function shouldShowLinesOrTicks(ax, subplot) {\n return (ax.ticks || ax.showline) && (subplot === ax._mainSubplot || ax.mirror === \"all\" || ax.mirror === \"allticks\");\n }\n function shouldShowLineThisSide(ax, side, counterAx) {\n if (!counterAx.showline || !counterAx._lw) return false;\n if (counterAx.mirror === \"all\" || counterAx.mirror === \"allticks\") return true;\n var anchorAx = counterAx._anchorAxis;\n if (!anchorAx) return false;\n var sideIndex = alignmentConstants.FROM_BL[side];\n if (counterAx.side === side) {\n return anchorAx.domain[sideIndex] === ax.domain[sideIndex];\n }\n return counterAx.mirror && anchorAx.domain[1 - sideIndex] === ax.domain[1 - sideIndex];\n }\n function findCounterAxisLineWidth(ax, side, counterAx, axList) {\n if (shouldShowLineThisSide(ax, side, counterAx)) {\n return counterAx._lw;\n }\n for (var i = 0; i < axList.length; i++) {\n var axi = axList[i];\n if (axi._mainAxis === counterAx._mainAxis && shouldShowLineThisSide(ax, side, axi)) {\n return axi._lw;\n }\n }\n return 0;\n }\n exports.drawMainTitle = function(gd) {\n var title = gd._fullLayout.title;\n var fullLayout = gd._fullLayout;\n var textAnchor = getMainTitleTextAnchor(fullLayout);\n var dy = getMainTitleDy(fullLayout);\n var y = getMainTitleY(fullLayout, dy);\n var x = getMainTitleX(fullLayout, textAnchor);\n Titles.draw(gd, \"gtitle\", {\n propContainer: fullLayout,\n propName: \"title.text\",\n subtitlePropName: \"title.subtitle.text\",\n placeholder: fullLayout._dfltTitle.plot,\n subtitlePlaceholder: fullLayout._dfltTitle.subtitle,\n attributes: {\n x,\n y,\n \"text-anchor\": textAnchor,\n dy\n }\n });\n if (title.text && title.automargin) {\n var titleObj = d3.selectAll(\".gtitle\");\n var titleHeight = Drawing.bBox(d3.selectAll(\".g-gtitle\").node()).height;\n var pushMargin = needsMarginPush(gd, title, titleHeight);\n if (pushMargin > 0) {\n applyTitleAutoMargin(gd, y, pushMargin, titleHeight);\n titleObj.attr({\n x,\n y,\n \"text-anchor\": textAnchor,\n dy: getMainTitleDyAdj(title.yanchor)\n }).call(svgTextUtils.positionText, x, y);\n var extraLines = (title.text.match(svgTextUtils.BR_TAG_ALL) || []).length;\n if (extraLines) {\n var delta = alignmentConstants.LINE_SPACING * extraLines + alignmentConstants.MID_SHIFT;\n if (title.y === 0) {\n delta = -delta;\n }\n titleObj.selectAll(\".line\").each(function() {\n var newDy = +this.getAttribute(\"dy\").slice(0, -2) - delta + \"em\";\n this.setAttribute(\"dy\", newDy);\n });\n }\n var subtitleObj = d3.selectAll(\".gtitle-subtitle\");\n if (subtitleObj.node()) {\n var titleBB = titleObj.node().getBBox();\n var titleBottom = titleBB.y + titleBB.height;\n var subtitleY = titleBottom + Titles.SUBTITLE_PADDING_EM * title.subtitle.font.size;\n subtitleObj.attr({\n x,\n y: subtitleY,\n \"text-anchor\": textAnchor,\n dy: getMainTitleDyAdj(title.yanchor)\n }).call(svgTextUtils.positionText, x, subtitleY);\n }\n }\n }\n };\n function isOutsideContainer(gd, title, position, y, titleHeight) {\n var plotHeight = title.yref === \"paper\" ? gd._fullLayout._size.h : gd._fullLayout.height;\n var yPosTop = Lib.isTopAnchor(title) ? y : y - titleHeight;\n var yPosRel = position === \"b\" ? plotHeight - yPosTop : yPosTop;\n if (Lib.isTopAnchor(title) && position === \"t\" || Lib.isBottomAnchor(title) && position === \"b\") {\n return false;\n } else {\n return yPosRel < titleHeight;\n }\n }\n function containerPushVal(position, titleY, titleYanchor, height, titleDepth) {\n var push = 0;\n if (titleYanchor === \"middle\") {\n push += titleDepth / 2;\n }\n if (position === \"t\") {\n if (titleYanchor === \"top\") {\n push += titleDepth;\n }\n push += height - titleY * height;\n } else {\n if (titleYanchor === \"bottom\") {\n push += titleDepth;\n }\n push += titleY * height;\n }\n return push;\n }\n function needsMarginPush(gd, title, titleHeight) {\n var titleY = title.y;\n var titleYanchor = title.yanchor;\n var position = titleY > 0.5 ? \"t\" : \"b\";\n var curMargin = gd._fullLayout.margin[position];\n var pushMargin = 0;\n if (title.yref === \"paper\") {\n pushMargin = titleHeight + title.pad.t + title.pad.b;\n } else if (title.yref === \"container\") {\n pushMargin = containerPushVal(position, titleY, titleYanchor, gd._fullLayout.height, titleHeight) + title.pad.t + title.pad.b;\n }\n if (pushMargin > curMargin) {\n return pushMargin;\n }\n return 0;\n }\n function applyTitleAutoMargin(gd, y, pushMargin, titleHeight) {\n var titleID = \"title.automargin\";\n var title = gd._fullLayout.title;\n var position = title.y > 0.5 ? \"t\" : \"b\";\n var push = {\n x: title.x,\n y: title.y,\n t: 0,\n b: 0\n };\n var reservedPush = {};\n if (title.yref === \"paper\" && isOutsideContainer(gd, title, position, y, titleHeight)) {\n push[position] = pushMargin;\n } else if (title.yref === \"container\") {\n reservedPush[position] = pushMargin;\n gd._fullLayout._reservedMargin[titleID] = reservedPush;\n }\n Plots.allowAutoMargin(gd, titleID);\n Plots.autoMargin(gd, titleID, push);\n }\n function getMainTitleX(fullLayout, textAnchor) {\n var title = fullLayout.title;\n var gs = fullLayout._size;\n var hPadShift = 0;\n if (textAnchor === SVG_TEXT_ANCHOR_START) {\n hPadShift = title.pad.l;\n } else if (textAnchor === SVG_TEXT_ANCHOR_END) {\n hPadShift = -title.pad.r;\n }\n switch (title.xref) {\n case \"paper\":\n return gs.l + gs.w * title.x + hPadShift;\n case \"container\":\n default:\n return fullLayout.width * title.x + hPadShift;\n }\n }\n function getMainTitleY(fullLayout, dy) {\n var title = fullLayout.title;\n var gs = fullLayout._size;\n var vPadShift = 0;\n if (dy === \"0em\" || !dy) {\n vPadShift = -title.pad.b;\n } else if (dy === alignmentConstants.CAP_SHIFT + \"em\") {\n vPadShift = title.pad.t;\n }\n if (title.y === \"auto\") {\n return gs.t / 2;\n } else {\n switch (title.yref) {\n case \"paper\":\n return gs.t + gs.h - gs.h * title.y + vPadShift;\n case \"container\":\n default:\n return fullLayout.height - fullLayout.height * title.y + vPadShift;\n }\n }\n }\n function getMainTitleDyAdj(yanchor) {\n if (yanchor === \"top\") {\n return alignmentConstants.CAP_SHIFT + 0.3 + \"em\";\n } else if (yanchor === \"bottom\") {\n return \"-0.3em\";\n } else {\n return alignmentConstants.MID_SHIFT + \"em\";\n }\n }\n function getMainTitleTextAnchor(fullLayout) {\n var title = fullLayout.title;\n var textAnchor = SVG_TEXT_ANCHOR_MIDDLE;\n if (Lib.isRightAnchor(title)) {\n textAnchor = SVG_TEXT_ANCHOR_END;\n } else if (Lib.isLeftAnchor(title)) {\n textAnchor = SVG_TEXT_ANCHOR_START;\n }\n return textAnchor;\n }\n function getMainTitleDy(fullLayout) {\n var title = fullLayout.title;\n var dy = \"0em\";\n if (Lib.isTopAnchor(title)) {\n dy = alignmentConstants.CAP_SHIFT + \"em\";\n } else if (Lib.isMiddleAnchor(title)) {\n dy = alignmentConstants.MID_SHIFT + \"em\";\n }\n return dy;\n }\n exports.doTraceStyle = function(gd) {\n var calcdata = gd.calcdata;\n var editStyleCalls = [];\n var i;\n for (i = 0; i < calcdata.length; i++) {\n var cd = calcdata[i];\n var cd0 = cd[0] || {};\n var trace = cd0.trace || {};\n var _module = trace._module || {};\n var arraysToCalcdata = _module.arraysToCalcdata;\n if (arraysToCalcdata) arraysToCalcdata(cd, trace);\n var editStyle = _module.editStyle;\n if (editStyle) editStyleCalls.push({ fn: editStyle, cd0 });\n }\n if (editStyleCalls.length) {\n for (i = 0; i < editStyleCalls.length; i++) {\n var edit = editStyleCalls[i];\n edit.fn(gd, edit.cd0);\n }\n clearGlCanvases(gd);\n exports.redrawReglTraces(gd);\n }\n Plots.style(gd);\n Registry.getComponentMethod(\"legend\", \"draw\")(gd);\n return Plots.previousPromises(gd);\n };\n exports.doColorBars = function(gd) {\n Registry.getComponentMethod(\"colorbar\", \"draw\")(gd);\n return Plots.previousPromises(gd);\n };\n exports.layoutReplot = function(gd) {\n var layout = gd.layout;\n gd.layout = void 0;\n return Registry.call(\"_doPlot\", gd, \"\", layout);\n };\n exports.doLegend = function(gd) {\n Registry.getComponentMethod(\"legend\", \"draw\")(gd);\n return Plots.previousPromises(gd);\n };\n exports.doTicksRelayout = function(gd) {\n Axes.draw(gd, \"redraw\");\n if (gd._fullLayout._hasOnlyLargeSploms) {\n Registry.subplotsRegistry.splom.updateGrid(gd);\n clearGlCanvases(gd);\n exports.redrawReglTraces(gd);\n }\n exports.drawMainTitle(gd);\n return Plots.previousPromises(gd);\n };\n exports.doModeBar = function(gd) {\n var fullLayout = gd._fullLayout;\n ModeBar.manage(gd);\n for (var i = 0; i < fullLayout._basePlotModules.length; i++) {\n var updateFx = fullLayout._basePlotModules[i].updateFx;\n if (updateFx) updateFx(gd);\n }\n return Plots.previousPromises(gd);\n };\n exports.doCamera = function(gd) {\n var fullLayout = gd._fullLayout;\n var sceneIds = fullLayout._subplots.gl3d;\n for (var i = 0; i < sceneIds.length; i++) {\n var sceneLayout = fullLayout[sceneIds[i]];\n var scene = sceneLayout._scene;\n scene.setViewport(sceneLayout);\n }\n };\n exports.drawData = function(gd) {\n var fullLayout = gd._fullLayout;\n clearGlCanvases(gd);\n var basePlotModules = fullLayout._basePlotModules;\n for (var i = 0; i < basePlotModules.length; i++) {\n basePlotModules[i].plot(gd);\n }\n exports.redrawReglTraces(gd);\n Plots.style(gd);\n Registry.getComponentMethod(\"selections\", \"draw\")(gd);\n Registry.getComponentMethod(\"shapes\", \"draw\")(gd);\n Registry.getComponentMethod(\"annotations\", \"draw\")(gd);\n Registry.getComponentMethod(\"images\", \"draw\")(gd);\n fullLayout._replotting = false;\n return Plots.previousPromises(gd);\n };\n exports.redrawReglTraces = function(gd) {\n var fullLayout = gd._fullLayout;\n if (fullLayout._has(\"regl\")) {\n var fullData = gd._fullData;\n var cartesianIds = [];\n var polarIds = [];\n var i, sp;\n if (fullLayout._hasOnlyLargeSploms) {\n fullLayout._splomGrid.draw();\n }\n for (i = 0; i < fullData.length; i++) {\n var trace = fullData[i];\n if (trace.visible === true && trace._length !== 0) {\n if (trace.type === \"splom\") {\n fullLayout._splomScenes[trace.uid].draw();\n } else if (trace.type === \"scattergl\") {\n Lib.pushUnique(cartesianIds, trace.xaxis + trace.yaxis);\n } else if (trace.type === \"scatterpolargl\") {\n Lib.pushUnique(polarIds, trace.subplot);\n }\n }\n }\n for (i = 0; i < cartesianIds.length; i++) {\n sp = fullLayout._plots[cartesianIds[i]];\n if (sp._scene) sp._scene.draw();\n }\n for (i = 0; i < polarIds.length; i++) {\n sp = fullLayout[polarIds[i]]._subplot;\n if (sp._scene) sp._scene.draw();\n }\n }\n };\n exports.doAutoRangeAndConstraints = function(gd) {\n var axList = Axes.list(gd, \"\", true);\n var ax;\n var autoRangeDone = {};\n for (var i = 0; i < axList.length; i++) {\n ax = axList[i];\n if (!autoRangeDone[ax._id]) {\n autoRangeDone[ax._id] = 1;\n cleanAxisConstraints(gd, ax);\n doAutoRange(gd, ax);\n var matchGroup = ax._matchGroup;\n if (matchGroup) {\n for (var id2 in matchGroup) {\n var ax2 = Axes.getFromId(gd, id2);\n doAutoRange(gd, ax2, ax.range);\n autoRangeDone[id2] = 1;\n }\n }\n }\n }\n enforceAxisConstraints(gd);\n };\n exports.finalDraw = function(gd) {\n Registry.getComponentMethod(\"rangeslider\", \"draw\")(gd);\n Registry.getComponentMethod(\"rangeselector\", \"draw\")(gd);\n };\n exports.drawMarginPushers = function(gd) {\n Registry.getComponentMethod(\"legend\", \"draw\")(gd);\n Registry.getComponentMethod(\"rangeselector\", \"draw\")(gd);\n Registry.getComponentMethod(\"sliders\", \"draw\")(gd);\n Registry.getComponentMethod(\"updatemenus\", \"draw\")(gd);\n Registry.getComponentMethod(\"colorbar\", \"draw\")(gd);\n };\n }\n });\n\n // src/components/selections/draw.js\n var require_draw3 = __commonJS({\n \"src/components/selections/draw.js\"(exports, module) {\n \"use strict\";\n var readPaths = require_helpers7().readPaths;\n var displayOutlines = require_display_outlines();\n var clearOutlineControllers = require_handle_outline().clearOutlineControllers;\n var Color2 = require_color();\n var Drawing = require_drawing();\n var arrayEditor = require_plot_template().arrayEditor;\n var helpers = require_helpers8();\n var getPathString = helpers.getPathString;\n module.exports = {\n draw,\n drawOne,\n activateLastSelection\n };\n function draw(gd) {\n var fullLayout = gd._fullLayout;\n clearOutlineControllers(gd);\n fullLayout._selectionLayer.selectAll(\"path\").remove();\n for (var k in fullLayout._plots) {\n var selectionLayer = fullLayout._plots[k].selectionLayer;\n if (selectionLayer) selectionLayer.selectAll(\"path\").remove();\n }\n for (var i = 0; i < fullLayout.selections.length; i++) {\n drawOne(gd, i);\n }\n }\n function couldHaveActiveSelection(gd) {\n return gd._context.editSelection;\n }\n function drawOne(gd, index) {\n gd._fullLayout._paperdiv.selectAll('.selectionlayer [data-index=\"' + index + '\"]').remove();\n var o = helpers.makeSelectionsOptionsAndPlotinfo(gd, index);\n var options = o.options;\n var plotinfo = o.plotinfo;\n if (!options._input) return;\n drawSelection(gd._fullLayout._selectionLayer);\n function drawSelection(selectionLayer) {\n var d = getPathString(gd, options);\n var attrs = {\n \"data-index\": index,\n \"fill-rule\": \"evenodd\",\n d\n };\n var opacity = options.opacity;\n var fillColor = \"rgba(0,0,0,0)\";\n var lineColor = options.line.color || Color2.contrast(gd._fullLayout.plot_bgcolor);\n var lineWidth = options.line.width;\n var lineDash = options.line.dash;\n if (!lineWidth) {\n lineWidth = 5;\n lineDash = \"solid\";\n }\n var isActiveSelection = couldHaveActiveSelection(gd) && gd._fullLayout._activeSelectionIndex === index;\n if (isActiveSelection) {\n fillColor = gd._fullLayout.activeselection.fillcolor;\n opacity = gd._fullLayout.activeselection.opacity;\n }\n var allPaths = [];\n for (var sensory = 1; sensory >= 0; sensory--) {\n var path = selectionLayer.append(\"path\").attr(attrs).style(\"opacity\", sensory ? 0.1 : opacity).call(Color2.stroke, lineColor).call(Color2.fill, fillColor).call(\n Drawing.dashLine,\n sensory ? \"solid\" : lineDash,\n sensory ? 4 + lineWidth : lineWidth\n );\n setClipPath(path, gd, options);\n if (isActiveSelection) {\n var editHelpers = arrayEditor(gd.layout, \"selections\", options);\n path.style({\n cursor: \"move\"\n });\n var dragOptions = {\n element: path.node(),\n plotinfo,\n gd,\n editHelpers,\n isActiveSelection: true\n // i.e. to enable controllers\n };\n var polygons = readPaths(d, gd);\n displayOutlines(polygons, path, dragOptions);\n } else {\n path.style(\"pointer-events\", sensory ? \"all\" : \"none\");\n }\n allPaths[sensory] = path;\n }\n var forePath = allPaths[0];\n var backPath = allPaths[1];\n backPath.node().addEventListener(\"click\", function() {\n return activateSelection(gd, forePath);\n });\n }\n }\n function setClipPath(selectionPath, gd, selectionOptions) {\n var clipAxes = selectionOptions.xref + selectionOptions.yref;\n Drawing.setClipUrl(\n selectionPath,\n \"clip\" + gd._fullLayout._uid + clipAxes,\n gd\n );\n }\n function activateSelection(gd, path) {\n if (!couldHaveActiveSelection(gd)) return;\n var element = path.node();\n var id = +element.getAttribute(\"data-index\");\n if (id >= 0) {\n if (id === gd._fullLayout._activeSelectionIndex) {\n deactivateSelection(gd);\n return;\n }\n gd._fullLayout._activeSelectionIndex = id;\n gd._fullLayout._deactivateSelection = deactivateSelection;\n draw(gd);\n }\n }\n function activateLastSelection(gd) {\n if (!couldHaveActiveSelection(gd)) return;\n var id = gd._fullLayout.selections.length - 1;\n gd._fullLayout._activeSelectionIndex = id;\n gd._fullLayout._deactivateSelection = deactivateSelection;\n draw(gd);\n }\n function deactivateSelection(gd) {\n if (!couldHaveActiveSelection(gd)) return;\n var id = gd._fullLayout._activeSelectionIndex;\n if (id >= 0) {\n clearOutlineControllers(gd);\n delete gd._fullLayout._activeSelectionIndex;\n draw(gd);\n }\n }\n }\n });\n\n // node_modules/polybooljs/lib/build-log.js\n var require_build_log = __commonJS({\n \"node_modules/polybooljs/lib/build-log.js\"(exports, module) {\n function BuildLog() {\n var my;\n var nextSegmentId = 0;\n var curVert = false;\n function push(type, data) {\n my.list.push({\n type,\n data: data ? JSON.parse(JSON.stringify(data)) : void 0\n });\n return my;\n }\n my = {\n list: [],\n segmentId: function() {\n return nextSegmentId++;\n },\n checkIntersection: function(seg1, seg2) {\n return push(\"check\", { seg1, seg2 });\n },\n segmentChop: function(seg, end) {\n push(\"div_seg\", { seg, pt: end });\n return push(\"chop\", { seg, pt: end });\n },\n statusRemove: function(seg) {\n return push(\"pop_seg\", { seg });\n },\n segmentUpdate: function(seg) {\n return push(\"seg_update\", { seg });\n },\n segmentNew: function(seg, primary) {\n return push(\"new_seg\", { seg, primary });\n },\n segmentRemove: function(seg) {\n return push(\"rem_seg\", { seg });\n },\n tempStatus: function(seg, above, below) {\n return push(\"temp_status\", { seg, above, below });\n },\n rewind: function(seg) {\n return push(\"rewind\", { seg });\n },\n status: function(seg, above, below) {\n return push(\"status\", { seg, above, below });\n },\n vert: function(x) {\n if (x === curVert)\n return my;\n curVert = x;\n return push(\"vert\", { x });\n },\n log: function(data) {\n if (typeof data !== \"string\")\n data = JSON.stringify(data, false, \" \");\n return push(\"log\", { txt: data });\n },\n reset: function() {\n return push(\"reset\");\n },\n selected: function(segs) {\n return push(\"selected\", { segs });\n },\n chainStart: function(seg) {\n return push(\"chain_start\", { seg });\n },\n chainRemoveHead: function(index, pt) {\n return push(\"chain_rem_head\", { index, pt });\n },\n chainRemoveTail: function(index, pt) {\n return push(\"chain_rem_tail\", { index, pt });\n },\n chainNew: function(pt1, pt2) {\n return push(\"chain_new\", { pt1, pt2 });\n },\n chainMatch: function(index) {\n return push(\"chain_match\", { index });\n },\n chainClose: function(index) {\n return push(\"chain_close\", { index });\n },\n chainAddHead: function(index, pt) {\n return push(\"chain_add_head\", { index, pt });\n },\n chainAddTail: function(index, pt) {\n return push(\"chain_add_tail\", { index, pt });\n },\n chainConnect: function(index1, index2) {\n return push(\"chain_con\", { index1, index2 });\n },\n chainReverse: function(index) {\n return push(\"chain_rev\", { index });\n },\n chainJoin: function(index1, index2) {\n return push(\"chain_join\", { index1, index2 });\n },\n done: function() {\n return push(\"done\");\n }\n };\n return my;\n }\n module.exports = BuildLog;\n }\n });\n\n // node_modules/polybooljs/lib/epsilon.js\n var require_epsilon = __commonJS({\n \"node_modules/polybooljs/lib/epsilon.js\"(exports, module) {\n function Epsilon(eps) {\n if (typeof eps !== \"number\")\n eps = 1e-10;\n var my = {\n epsilon: function(v) {\n if (typeof v === \"number\")\n eps = v;\n return eps;\n },\n pointAboveOrOnLine: function(pt, left, right) {\n var Ax = left[0];\n var Ay = left[1];\n var Bx = right[0];\n var By = right[1];\n var Cx = pt[0];\n var Cy = pt[1];\n return (Bx - Ax) * (Cy - Ay) - (By - Ay) * (Cx - Ax) >= -eps;\n },\n pointBetween: function(p, left, right) {\n var d_py_ly = p[1] - left[1];\n var d_rx_lx = right[0] - left[0];\n var d_px_lx = p[0] - left[0];\n var d_ry_ly = right[1] - left[1];\n var dot = d_px_lx * d_rx_lx + d_py_ly * d_ry_ly;\n if (dot < eps)\n return false;\n var sqlen = d_rx_lx * d_rx_lx + d_ry_ly * d_ry_ly;\n if (dot - sqlen > -eps)\n return false;\n return true;\n },\n pointsSameX: function(p1, p2) {\n return Math.abs(p1[0] - p2[0]) < eps;\n },\n pointsSameY: function(p1, p2) {\n return Math.abs(p1[1] - p2[1]) < eps;\n },\n pointsSame: function(p1, p2) {\n return my.pointsSameX(p1, p2) && my.pointsSameY(p1, p2);\n },\n pointsCompare: function(p1, p2) {\n if (my.pointsSameX(p1, p2))\n return my.pointsSameY(p1, p2) ? 0 : p1[1] < p2[1] ? -1 : 1;\n return p1[0] < p2[0] ? -1 : 1;\n },\n pointsCollinear: function(pt1, pt2, pt3) {\n var dx1 = pt1[0] - pt2[0];\n var dy1 = pt1[1] - pt2[1];\n var dx2 = pt2[0] - pt3[0];\n var dy2 = pt2[1] - pt3[1];\n return Math.abs(dx1 * dy2 - dx2 * dy1) < eps;\n },\n linesIntersect: function(a0, a1, b0, b1) {\n var adx = a1[0] - a0[0];\n var ady = a1[1] - a0[1];\n var bdx = b1[0] - b0[0];\n var bdy = b1[1] - b0[1];\n var axb = adx * bdy - ady * bdx;\n if (Math.abs(axb) < eps)\n return false;\n var dx = a0[0] - b0[0];\n var dy = a0[1] - b0[1];\n var A2 = (bdx * dy - bdy * dx) / axb;\n var B2 = (adx * dy - ady * dx) / axb;\n var ret = {\n alongA: 0,\n alongB: 0,\n pt: [\n a0[0] + A2 * adx,\n a0[1] + A2 * ady\n ]\n };\n if (A2 <= -eps)\n ret.alongA = -2;\n else if (A2 < eps)\n ret.alongA = -1;\n else if (A2 - 1 <= -eps)\n ret.alongA = 0;\n else if (A2 - 1 < eps)\n ret.alongA = 1;\n else\n ret.alongA = 2;\n if (B2 <= -eps)\n ret.alongB = -2;\n else if (B2 < eps)\n ret.alongB = -1;\n else if (B2 - 1 <= -eps)\n ret.alongB = 0;\n else if (B2 - 1 < eps)\n ret.alongB = 1;\n else\n ret.alongB = 2;\n return ret;\n },\n pointInsideRegion: function(pt, region) {\n var x = pt[0];\n var y = pt[1];\n var last_x = region[region.length - 1][0];\n var last_y = region[region.length - 1][1];\n var inside = false;\n for (var i = 0; i < region.length; i++) {\n var curr_x = region[i][0];\n var curr_y = region[i][1];\n if (curr_y - y > eps != last_y - y > eps && (last_x - curr_x) * (y - curr_y) / (last_y - curr_y) + curr_x - x > eps)\n inside = !inside;\n last_x = curr_x;\n last_y = curr_y;\n }\n return inside;\n }\n };\n return my;\n }\n module.exports = Epsilon;\n }\n });\n\n // node_modules/polybooljs/lib/linked-list.js\n var require_linked_list = __commonJS({\n \"node_modules/polybooljs/lib/linked-list.js\"(exports, module) {\n var LinkedList = {\n create: function() {\n var my = {\n root: { root: true, next: null },\n exists: function(node) {\n if (node === null || node === my.root)\n return false;\n return true;\n },\n isEmpty: function() {\n return my.root.next === null;\n },\n getHead: function() {\n return my.root.next;\n },\n insertBefore: function(node, check) {\n var last = my.root;\n var here = my.root.next;\n while (here !== null) {\n if (check(here)) {\n node.prev = here.prev;\n node.next = here;\n here.prev.next = node;\n here.prev = node;\n return;\n }\n last = here;\n here = here.next;\n }\n last.next = node;\n node.prev = last;\n node.next = null;\n },\n findTransition: function(check) {\n var prev = my.root;\n var here = my.root.next;\n while (here !== null) {\n if (check(here))\n break;\n prev = here;\n here = here.next;\n }\n return {\n before: prev === my.root ? null : prev,\n after: here,\n insert: function(node) {\n node.prev = prev;\n node.next = here;\n prev.next = node;\n if (here !== null)\n here.prev = node;\n return node;\n }\n };\n }\n };\n return my;\n },\n node: function(data) {\n data.prev = null;\n data.next = null;\n data.remove = function() {\n data.prev.next = data.next;\n if (data.next)\n data.next.prev = data.prev;\n data.prev = null;\n data.next = null;\n };\n return data;\n }\n };\n module.exports = LinkedList;\n }\n });\n\n // node_modules/polybooljs/lib/intersecter.js\n var require_intersecter = __commonJS({\n \"node_modules/polybooljs/lib/intersecter.js\"(exports, module) {\n var LinkedList = require_linked_list();\n function Intersecter(selfIntersection, eps, buildLog) {\n function segmentNew(start, end) {\n return {\n id: buildLog ? buildLog.segmentId() : -1,\n start,\n end,\n myFill: {\n above: null,\n // is there fill above us?\n below: null\n // is there fill below us?\n },\n otherFill: null\n };\n }\n function segmentCopy(start, end, seg) {\n return {\n id: buildLog ? buildLog.segmentId() : -1,\n start,\n end,\n myFill: {\n above: seg.myFill.above,\n below: seg.myFill.below\n },\n otherFill: null\n };\n }\n var event_root = LinkedList.create();\n function eventCompare(p1_isStart, p1_1, p1_2, p2_isStart, p2_1, p2_2) {\n var comp = eps.pointsCompare(p1_1, p2_1);\n if (comp !== 0)\n return comp;\n if (eps.pointsSame(p1_2, p2_2))\n return 0;\n if (p1_isStart !== p2_isStart)\n return p1_isStart ? 1 : -1;\n return eps.pointAboveOrOnLine(\n p1_2,\n p2_isStart ? p2_1 : p2_2,\n // order matters\n p2_isStart ? p2_2 : p2_1\n ) ? 1 : -1;\n }\n function eventAdd(ev, other_pt) {\n event_root.insertBefore(ev, function(here) {\n var comp = eventCompare(\n ev.isStart,\n ev.pt,\n other_pt,\n here.isStart,\n here.pt,\n here.other.pt\n );\n return comp < 0;\n });\n }\n function eventAddSegmentStart(seg, primary) {\n var ev_start = LinkedList.node({\n isStart: true,\n pt: seg.start,\n seg,\n primary,\n other: null,\n status: null\n });\n eventAdd(ev_start, seg.end);\n return ev_start;\n }\n function eventAddSegmentEnd(ev_start, seg, primary) {\n var ev_end = LinkedList.node({\n isStart: false,\n pt: seg.end,\n seg,\n primary,\n other: ev_start,\n status: null\n });\n ev_start.other = ev_end;\n eventAdd(ev_end, ev_start.pt);\n }\n function eventAddSegment(seg, primary) {\n var ev_start = eventAddSegmentStart(seg, primary);\n eventAddSegmentEnd(ev_start, seg, primary);\n return ev_start;\n }\n function eventUpdateEnd(ev, end) {\n if (buildLog)\n buildLog.segmentChop(ev.seg, end);\n ev.other.remove();\n ev.seg.end = end;\n ev.other.pt = end;\n eventAdd(ev.other, ev.pt);\n }\n function eventDivide(ev, pt) {\n var ns = segmentCopy(pt, ev.seg.end, ev.seg);\n eventUpdateEnd(ev, pt);\n return eventAddSegment(ns, ev.primary);\n }\n function calculate(primaryPolyInverted, secondaryPolyInverted) {\n var status_root = LinkedList.create();\n function statusCompare(ev1, ev2) {\n var a1 = ev1.seg.start;\n var a2 = ev1.seg.end;\n var b1 = ev2.seg.start;\n var b2 = ev2.seg.end;\n if (eps.pointsCollinear(a1, b1, b2)) {\n if (eps.pointsCollinear(a2, b1, b2))\n return 1;\n return eps.pointAboveOrOnLine(a2, b1, b2) ? 1 : -1;\n }\n return eps.pointAboveOrOnLine(a1, b1, b2) ? 1 : -1;\n }\n function statusFindSurrounding(ev2) {\n return status_root.findTransition(function(here) {\n var comp = statusCompare(ev2, here.ev);\n return comp > 0;\n });\n }\n function checkIntersection(ev1, ev2) {\n var seg1 = ev1.seg;\n var seg2 = ev2.seg;\n var a1 = seg1.start;\n var a2 = seg1.end;\n var b1 = seg2.start;\n var b2 = seg2.end;\n if (buildLog)\n buildLog.checkIntersection(seg1, seg2);\n var i = eps.linesIntersect(a1, a2, b1, b2);\n if (i === false) {\n if (!eps.pointsCollinear(a1, a2, b1))\n return false;\n if (eps.pointsSame(a1, b2) || eps.pointsSame(a2, b1))\n return false;\n var a1_equ_b1 = eps.pointsSame(a1, b1);\n var a2_equ_b2 = eps.pointsSame(a2, b2);\n if (a1_equ_b1 && a2_equ_b2)\n return ev2;\n var a1_between = !a1_equ_b1 && eps.pointBetween(a1, b1, b2);\n var a2_between = !a2_equ_b2 && eps.pointBetween(a2, b1, b2);\n if (a1_equ_b1) {\n if (a2_between) {\n eventDivide(ev2, a2);\n } else {\n eventDivide(ev1, b2);\n }\n return ev2;\n } else if (a1_between) {\n if (!a2_equ_b2) {\n if (a2_between) {\n eventDivide(ev2, a2);\n } else {\n eventDivide(ev1, b2);\n }\n }\n eventDivide(ev2, a1);\n }\n } else {\n if (i.alongA === 0) {\n if (i.alongB === -1)\n eventDivide(ev1, b1);\n else if (i.alongB === 0)\n eventDivide(ev1, i.pt);\n else if (i.alongB === 1)\n eventDivide(ev1, b2);\n }\n if (i.alongB === 0) {\n if (i.alongA === -1)\n eventDivide(ev2, a1);\n else if (i.alongA === 0)\n eventDivide(ev2, i.pt);\n else if (i.alongA === 1)\n eventDivide(ev2, a2);\n }\n }\n return false;\n }\n var segments = [];\n while (!event_root.isEmpty()) {\n var ev = event_root.getHead();\n if (buildLog)\n buildLog.vert(ev.pt[0]);\n if (ev.isStart) {\n let checkBothIntersections2 = function() {\n if (above) {\n var eve2 = checkIntersection(ev, above);\n if (eve2)\n return eve2;\n }\n if (below)\n return checkIntersection(ev, below);\n return false;\n };\n var checkBothIntersections = checkBothIntersections2;\n if (buildLog)\n buildLog.segmentNew(ev.seg, ev.primary);\n var surrounding = statusFindSurrounding(ev);\n var above = surrounding.before ? surrounding.before.ev : null;\n var below = surrounding.after ? surrounding.after.ev : null;\n if (buildLog) {\n buildLog.tempStatus(\n ev.seg,\n above ? above.seg : false,\n below ? below.seg : false\n );\n }\n var eve = checkBothIntersections2();\n if (eve) {\n if (selfIntersection) {\n var toggle;\n if (ev.seg.myFill.below === null)\n toggle = true;\n else\n toggle = ev.seg.myFill.above !== ev.seg.myFill.below;\n if (toggle)\n eve.seg.myFill.above = !eve.seg.myFill.above;\n } else {\n eve.seg.otherFill = ev.seg.myFill;\n }\n if (buildLog)\n buildLog.segmentUpdate(eve.seg);\n ev.other.remove();\n ev.remove();\n }\n if (event_root.getHead() !== ev) {\n if (buildLog)\n buildLog.rewind(ev.seg);\n continue;\n }\n if (selfIntersection) {\n var toggle;\n if (ev.seg.myFill.below === null)\n toggle = true;\n else\n toggle = ev.seg.myFill.above !== ev.seg.myFill.below;\n if (!below) {\n ev.seg.myFill.below = primaryPolyInverted;\n } else {\n ev.seg.myFill.below = below.seg.myFill.above;\n }\n if (toggle)\n ev.seg.myFill.above = !ev.seg.myFill.below;\n else\n ev.seg.myFill.above = ev.seg.myFill.below;\n } else {\n if (ev.seg.otherFill === null) {\n var inside;\n if (!below) {\n inside = ev.primary ? secondaryPolyInverted : primaryPolyInverted;\n } else {\n if (ev.primary === below.primary)\n inside = below.seg.otherFill.above;\n else\n inside = below.seg.myFill.above;\n }\n ev.seg.otherFill = {\n above: inside,\n below: inside\n };\n }\n }\n if (buildLog) {\n buildLog.status(\n ev.seg,\n above ? above.seg : false,\n below ? below.seg : false\n );\n }\n ev.other.status = surrounding.insert(LinkedList.node({ ev }));\n } else {\n var st = ev.status;\n if (st === null) {\n throw new Error(\"PolyBool: Zero-length segment detected; your epsilon is probably too small or too large\");\n }\n if (status_root.exists(st.prev) && status_root.exists(st.next))\n checkIntersection(st.prev.ev, st.next.ev);\n if (buildLog)\n buildLog.statusRemove(st.ev.seg);\n st.remove();\n if (!ev.primary) {\n var s = ev.seg.myFill;\n ev.seg.myFill = ev.seg.otherFill;\n ev.seg.otherFill = s;\n }\n segments.push(ev.seg);\n }\n event_root.getHead().remove();\n }\n if (buildLog)\n buildLog.done();\n return segments;\n }\n if (!selfIntersection) {\n return {\n calculate: function(segments1, inverted1, segments2, inverted2) {\n segments1.forEach(function(seg) {\n eventAddSegment(segmentCopy(seg.start, seg.end, seg), true);\n });\n segments2.forEach(function(seg) {\n eventAddSegment(segmentCopy(seg.start, seg.end, seg), false);\n });\n return calculate(inverted1, inverted2);\n }\n };\n }\n return {\n addRegion: function(region) {\n var pt1;\n var pt2 = region[region.length - 1];\n for (var i = 0; i < region.length; i++) {\n pt1 = pt2;\n pt2 = region[i];\n var forward = eps.pointsCompare(pt1, pt2);\n if (forward === 0)\n continue;\n eventAddSegment(\n segmentNew(\n forward < 0 ? pt1 : pt2,\n forward < 0 ? pt2 : pt1\n ),\n true\n );\n }\n },\n calculate: function(inverted) {\n return calculate(inverted, false);\n }\n };\n }\n module.exports = Intersecter;\n }\n });\n\n // node_modules/polybooljs/lib/segment-chainer.js\n var require_segment_chainer = __commonJS({\n \"node_modules/polybooljs/lib/segment-chainer.js\"(exports, module) {\n function SegmentChainer(segments, eps, buildLog) {\n var chains = [];\n var regions = [];\n segments.forEach(function(seg) {\n var pt1 = seg.start;\n var pt2 = seg.end;\n if (eps.pointsSame(pt1, pt2)) {\n console.warn(\"PolyBool: Warning: Zero-length segment detected; your epsilon is probably too small or too large\");\n return;\n }\n if (buildLog)\n buildLog.chainStart(seg);\n var first_match = {\n index: 0,\n matches_head: false,\n matches_pt1: false\n };\n var second_match = {\n index: 0,\n matches_head: false,\n matches_pt1: false\n };\n var next_match = first_match;\n function setMatch(index2, matches_head, matches_pt1) {\n next_match.index = index2;\n next_match.matches_head = matches_head;\n next_match.matches_pt1 = matches_pt1;\n if (next_match === first_match) {\n next_match = second_match;\n return false;\n }\n next_match = null;\n return true;\n }\n for (var i = 0; i < chains.length; i++) {\n var chain = chains[i];\n var head = chain[0];\n var head2 = chain[1];\n var tail = chain[chain.length - 1];\n var tail2 = chain[chain.length - 2];\n if (eps.pointsSame(head, pt1)) {\n if (setMatch(i, true, true))\n break;\n } else if (eps.pointsSame(head, pt2)) {\n if (setMatch(i, true, false))\n break;\n } else if (eps.pointsSame(tail, pt1)) {\n if (setMatch(i, false, true))\n break;\n } else if (eps.pointsSame(tail, pt2)) {\n if (setMatch(i, false, false))\n break;\n }\n }\n if (next_match === first_match) {\n chains.push([pt1, pt2]);\n if (buildLog)\n buildLog.chainNew(pt1, pt2);\n return;\n }\n if (next_match === second_match) {\n if (buildLog)\n buildLog.chainMatch(first_match.index);\n var index = first_match.index;\n var pt = first_match.matches_pt1 ? pt2 : pt1;\n var addToHead = first_match.matches_head;\n var chain = chains[index];\n var grow = addToHead ? chain[0] : chain[chain.length - 1];\n var grow2 = addToHead ? chain[1] : chain[chain.length - 2];\n var oppo = addToHead ? chain[chain.length - 1] : chain[0];\n var oppo2 = addToHead ? chain[chain.length - 2] : chain[1];\n if (eps.pointsCollinear(grow2, grow, pt)) {\n if (addToHead) {\n if (buildLog)\n buildLog.chainRemoveHead(first_match.index, pt);\n chain.shift();\n } else {\n if (buildLog)\n buildLog.chainRemoveTail(first_match.index, pt);\n chain.pop();\n }\n grow = grow2;\n }\n if (eps.pointsSame(oppo, pt)) {\n chains.splice(index, 1);\n if (eps.pointsCollinear(oppo2, oppo, grow)) {\n if (addToHead) {\n if (buildLog)\n buildLog.chainRemoveTail(first_match.index, grow);\n chain.pop();\n } else {\n if (buildLog)\n buildLog.chainRemoveHead(first_match.index, grow);\n chain.shift();\n }\n }\n if (buildLog)\n buildLog.chainClose(first_match.index);\n regions.push(chain);\n return;\n }\n if (addToHead) {\n if (buildLog)\n buildLog.chainAddHead(first_match.index, pt);\n chain.unshift(pt);\n } else {\n if (buildLog)\n buildLog.chainAddTail(first_match.index, pt);\n chain.push(pt);\n }\n return;\n }\n function reverseChain(index2) {\n if (buildLog)\n buildLog.chainReverse(index2);\n chains[index2].reverse();\n }\n function appendChain(index1, index2) {\n var chain1 = chains[index1];\n var chain2 = chains[index2];\n var tail3 = chain1[chain1.length - 1];\n var tail22 = chain1[chain1.length - 2];\n var head3 = chain2[0];\n var head22 = chain2[1];\n if (eps.pointsCollinear(tail22, tail3, head3)) {\n if (buildLog)\n buildLog.chainRemoveTail(index1, tail3);\n chain1.pop();\n tail3 = tail22;\n }\n if (eps.pointsCollinear(tail3, head3, head22)) {\n if (buildLog)\n buildLog.chainRemoveHead(index2, head3);\n chain2.shift();\n }\n if (buildLog)\n buildLog.chainJoin(index1, index2);\n chains[index1] = chain1.concat(chain2);\n chains.splice(index2, 1);\n }\n var F = first_match.index;\n var S = second_match.index;\n if (buildLog)\n buildLog.chainConnect(F, S);\n var reverseF = chains[F].length < chains[S].length;\n if (first_match.matches_head) {\n if (second_match.matches_head) {\n if (reverseF) {\n reverseChain(F);\n appendChain(F, S);\n } else {\n reverseChain(S);\n appendChain(S, F);\n }\n } else {\n appendChain(S, F);\n }\n } else {\n if (second_match.matches_head) {\n appendChain(F, S);\n } else {\n if (reverseF) {\n reverseChain(F);\n appendChain(S, F);\n } else {\n reverseChain(S);\n appendChain(F, S);\n }\n }\n }\n });\n return regions;\n }\n module.exports = SegmentChainer;\n }\n });\n\n // node_modules/polybooljs/lib/segment-selector.js\n var require_segment_selector = __commonJS({\n \"node_modules/polybooljs/lib/segment-selector.js\"(exports, module) {\n function select(segments, selection, buildLog) {\n var result = [];\n segments.forEach(function(seg) {\n var index = (seg.myFill.above ? 8 : 0) + (seg.myFill.below ? 4 : 0) + (seg.otherFill && seg.otherFill.above ? 2 : 0) + (seg.otherFill && seg.otherFill.below ? 1 : 0);\n if (selection[index] !== 0) {\n result.push({\n id: buildLog ? buildLog.segmentId() : -1,\n start: seg.start,\n end: seg.end,\n myFill: {\n above: selection[index] === 1,\n // 1 if filled above\n below: selection[index] === 2\n // 2 if filled below\n },\n otherFill: null\n });\n }\n });\n if (buildLog)\n buildLog.selected(result);\n return result;\n }\n var SegmentSelector = {\n union: function(segments, buildLog) {\n return select(segments, [\n 0,\n 2,\n 1,\n 0,\n 2,\n 2,\n 0,\n 0,\n 1,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 0\n ], buildLog);\n },\n intersect: function(segments, buildLog) {\n return select(segments, [\n 0,\n 0,\n 0,\n 0,\n 0,\n 2,\n 0,\n 2,\n 0,\n 0,\n 1,\n 1,\n 0,\n 2,\n 1,\n 0\n ], buildLog);\n },\n difference: function(segments, buildLog) {\n return select(segments, [\n 0,\n 0,\n 0,\n 0,\n 2,\n 0,\n 2,\n 0,\n 1,\n 1,\n 0,\n 0,\n 0,\n 1,\n 2,\n 0\n ], buildLog);\n },\n differenceRev: function(segments, buildLog) {\n return select(segments, [\n 0,\n 2,\n 1,\n 0,\n 0,\n 0,\n 1,\n 1,\n 0,\n 2,\n 0,\n 2,\n 0,\n 0,\n 0,\n 0\n ], buildLog);\n },\n xor: function(segments, buildLog) {\n return select(segments, [\n 0,\n 2,\n 1,\n 0,\n 2,\n 0,\n 0,\n 1,\n 1,\n 0,\n 0,\n 2,\n 0,\n 1,\n 2,\n 0\n ], buildLog);\n }\n };\n module.exports = SegmentSelector;\n }\n });\n\n // node_modules/polybooljs/lib/geojson.js\n var require_geojson = __commonJS({\n \"node_modules/polybooljs/lib/geojson.js\"(exports, module) {\n var GeoJSON = {\n // convert a GeoJSON object to a PolyBool polygon\n toPolygon: function(PolyBool, geojson) {\n function GeoPoly(coords) {\n if (coords.length <= 0)\n return PolyBool.segments({ inverted: false, regions: [] });\n function LineString(ls) {\n var reg = ls.slice(0, ls.length - 1);\n return PolyBool.segments({ inverted: false, regions: [reg] });\n }\n var out2 = LineString(coords[0]);\n for (var i2 = 1; i2 < coords.length; i2++)\n out2 = PolyBool.selectDifference(PolyBool.combine(out2, LineString(coords[i2])));\n return out2;\n }\n if (geojson.type === \"Polygon\") {\n return PolyBool.polygon(GeoPoly(geojson.coordinates));\n } else if (geojson.type === \"MultiPolygon\") {\n var out = PolyBool.segments({ inverted: false, regions: [] });\n for (var i = 0; i < geojson.coordinates.length; i++)\n out = PolyBool.selectUnion(PolyBool.combine(out, GeoPoly(geojson.coordinates[i])));\n return PolyBool.polygon(out);\n }\n throw new Error(\"PolyBool: Cannot convert GeoJSON object to PolyBool polygon\");\n },\n // convert a PolyBool polygon to a GeoJSON object\n fromPolygon: function(PolyBool, eps, poly) {\n poly = PolyBool.polygon(PolyBool.segments(poly));\n function regionInsideRegion(r1, r2) {\n return eps.pointInsideRegion([\n (r1[0][0] + r1[1][0]) * 0.5,\n (r1[0][1] + r1[1][1]) * 0.5\n ], r2);\n }\n function newNode(region2) {\n return {\n region: region2,\n children: []\n };\n }\n var roots = newNode(null);\n function addChild(root, region2) {\n for (var i2 = 0; i2 < root.children.length; i2++) {\n var child = root.children[i2];\n if (regionInsideRegion(region2, child.region)) {\n addChild(child, region2);\n return;\n }\n }\n var node = newNode(region2);\n for (var i2 = 0; i2 < root.children.length; i2++) {\n var child = root.children[i2];\n if (regionInsideRegion(child.region, region2)) {\n node.children.push(child);\n root.children.splice(i2, 1);\n i2--;\n }\n }\n root.children.push(node);\n }\n for (var i = 0; i < poly.regions.length; i++) {\n var region = poly.regions[i];\n if (region.length < 3)\n continue;\n addChild(roots, region);\n }\n function forceWinding(region2, clockwise) {\n var winding = 0;\n var last_x = region2[region2.length - 1][0];\n var last_y = region2[region2.length - 1][1];\n var copy = [];\n for (var i2 = 0; i2 < region2.length; i2++) {\n var curr_x = region2[i2][0];\n var curr_y = region2[i2][1];\n copy.push([curr_x, curr_y]);\n winding += curr_y * last_x - curr_x * last_y;\n last_x = curr_x;\n last_y = curr_y;\n }\n var isclockwise = winding < 0;\n if (isclockwise !== clockwise)\n copy.reverse();\n copy.push([copy[0][0], copy[0][1]]);\n return copy;\n }\n var geopolys = [];\n function addExterior(node) {\n var poly2 = [forceWinding(node.region, false)];\n geopolys.push(poly2);\n for (var i2 = 0; i2 < node.children.length; i2++)\n poly2.push(getInterior(node.children[i2]));\n }\n function getInterior(node) {\n for (var i2 = 0; i2 < node.children.length; i2++)\n addExterior(node.children[i2]);\n return forceWinding(node.region, true);\n }\n for (var i = 0; i < roots.children.length; i++)\n addExterior(roots.children[i]);\n if (geopolys.length <= 0)\n return { type: \"Polygon\", coordinates: [] };\n if (geopolys.length == 1)\n return { type: \"Polygon\", coordinates: geopolys[0] };\n return {\n // otherwise, use a GeoJSON MultiPolygon\n type: \"MultiPolygon\",\n coordinates: geopolys\n };\n }\n };\n module.exports = GeoJSON;\n }\n });\n\n // node_modules/polybooljs/index.js\n var require_polybooljs = __commonJS({\n \"node_modules/polybooljs/index.js\"(exports, module) {\n var BuildLog = require_build_log();\n var Epsilon = require_epsilon();\n var Intersecter = require_intersecter();\n var SegmentChainer = require_segment_chainer();\n var SegmentSelector = require_segment_selector();\n var GeoJSON = require_geojson();\n var buildLog = false;\n var epsilon = Epsilon();\n var PolyBool;\n PolyBool = {\n // getter/setter for buildLog\n buildLog: function(bl) {\n if (bl === true)\n buildLog = BuildLog();\n else if (bl === false)\n buildLog = false;\n return buildLog === false ? false : buildLog.list;\n },\n // getter/setter for epsilon\n epsilon: function(v) {\n return epsilon.epsilon(v);\n },\n // core API\n segments: function(poly) {\n var i = Intersecter(true, epsilon, buildLog);\n poly.regions.forEach(i.addRegion);\n return {\n segments: i.calculate(poly.inverted),\n inverted: poly.inverted\n };\n },\n combine: function(segments1, segments2) {\n var i3 = Intersecter(false, epsilon, buildLog);\n return {\n combined: i3.calculate(\n segments1.segments,\n segments1.inverted,\n segments2.segments,\n segments2.inverted\n ),\n inverted1: segments1.inverted,\n inverted2: segments2.inverted\n };\n },\n selectUnion: function(combined) {\n return {\n segments: SegmentSelector.union(combined.combined, buildLog),\n inverted: combined.inverted1 || combined.inverted2\n };\n },\n selectIntersect: function(combined) {\n return {\n segments: SegmentSelector.intersect(combined.combined, buildLog),\n inverted: combined.inverted1 && combined.inverted2\n };\n },\n selectDifference: function(combined) {\n return {\n segments: SegmentSelector.difference(combined.combined, buildLog),\n inverted: combined.inverted1 && !combined.inverted2\n };\n },\n selectDifferenceRev: function(combined) {\n return {\n segments: SegmentSelector.differenceRev(combined.combined, buildLog),\n inverted: !combined.inverted1 && combined.inverted2\n };\n },\n selectXor: function(combined) {\n return {\n segments: SegmentSelector.xor(combined.combined, buildLog),\n inverted: combined.inverted1 !== combined.inverted2\n };\n },\n polygon: function(segments) {\n return {\n regions: SegmentChainer(segments.segments, epsilon, buildLog),\n inverted: segments.inverted\n };\n },\n // GeoJSON converters\n polygonFromGeoJSON: function(geojson) {\n return GeoJSON.toPolygon(PolyBool, geojson);\n },\n polygonToGeoJSON: function(poly) {\n return GeoJSON.fromPolygon(PolyBool, epsilon, poly);\n },\n // helper functions for common operations\n union: function(poly1, poly2) {\n return operate(poly1, poly2, PolyBool.selectUnion);\n },\n intersect: function(poly1, poly2) {\n return operate(poly1, poly2, PolyBool.selectIntersect);\n },\n difference: function(poly1, poly2) {\n return operate(poly1, poly2, PolyBool.selectDifference);\n },\n differenceRev: function(poly1, poly2) {\n return operate(poly1, poly2, PolyBool.selectDifferenceRev);\n },\n xor: function(poly1, poly2) {\n return operate(poly1, poly2, PolyBool.selectXor);\n }\n };\n function operate(poly1, poly2, selector) {\n var seg1 = PolyBool.segments(poly1);\n var seg2 = PolyBool.segments(poly2);\n var comb = PolyBool.combine(seg1, seg2);\n var seg3 = selector(comb);\n return PolyBool.polygon(seg3);\n }\n if (typeof window === \"object\")\n window.PolyBool = PolyBool;\n module.exports = PolyBool;\n }\n });\n\n // node_modules/point-in-polygon/nested.js\n var require_nested = __commonJS({\n \"node_modules/point-in-polygon/nested.js\"(exports, module) {\n module.exports = function pointInPolygonNested(point, vs, start, end) {\n var x = point[0], y = point[1];\n var inside = false;\n if (start === void 0) start = 0;\n if (end === void 0) end = vs.length;\n var len = end - start;\n for (var i = 0, j = len - 1; i < len; j = i++) {\n var xi = vs[i + start][0], yi = vs[i + start][1];\n var xj = vs[j + start][0], yj = vs[j + start][1];\n var intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;\n if (intersect) inside = !inside;\n }\n return inside;\n };\n }\n });\n\n // src/lib/polygon.js\n var require_polygon = __commonJS({\n \"src/lib/polygon.js\"(exports, module) {\n \"use strict\";\n var dot = require_matrix().dot;\n var BADNUM = require_numerical().BADNUM;\n var polygon = module.exports = {};\n polygon.tester = function tester(ptsIn) {\n var pts = ptsIn.slice();\n var xmin = pts[0][0];\n var xmax = xmin;\n var ymin = pts[0][1];\n var ymax = ymin;\n var i;\n if (pts[pts.length - 1][0] !== pts[0][0] || pts[pts.length - 1][1] !== pts[0][1]) {\n pts.push(pts[0]);\n }\n for (i = 1; i < pts.length; i++) {\n xmin = Math.min(xmin, pts[i][0]);\n xmax = Math.max(xmax, pts[i][0]);\n ymin = Math.min(ymin, pts[i][1]);\n ymax = Math.max(ymax, pts[i][1]);\n }\n var isRect = false;\n var rectFirstEdgeTest;\n if (pts.length === 5) {\n if (pts[0][0] === pts[1][0]) {\n if (pts[2][0] === pts[3][0] && pts[0][1] === pts[3][1] && pts[1][1] === pts[2][1]) {\n isRect = true;\n rectFirstEdgeTest = function(pt) {\n return pt[0] === pts[0][0];\n };\n }\n } else if (pts[0][1] === pts[1][1]) {\n if (pts[2][1] === pts[3][1] && pts[0][0] === pts[3][0] && pts[1][0] === pts[2][0]) {\n isRect = true;\n rectFirstEdgeTest = function(pt) {\n return pt[1] === pts[0][1];\n };\n }\n }\n }\n function rectContains(pt, omitFirstEdge) {\n var x = pt[0];\n var y = pt[1];\n if (x === BADNUM || x < xmin || x > xmax || y === BADNUM || y < ymin || y > ymax) {\n return false;\n }\n if (omitFirstEdge && rectFirstEdgeTest(pt)) return false;\n return true;\n }\n function contains(pt, omitFirstEdge) {\n var x = pt[0];\n var y = pt[1];\n if (x === BADNUM || x < xmin || x > xmax || y === BADNUM || y < ymin || y > ymax) {\n return false;\n }\n var imax = pts.length;\n var x1 = pts[0][0];\n var y1 = pts[0][1];\n var crossings = 0;\n var i2;\n var x0;\n var y0;\n var xmini;\n var ycross;\n for (i2 = 1; i2 < imax; i2++) {\n x0 = x1;\n y0 = y1;\n x1 = pts[i2][0];\n y1 = pts[i2][1];\n xmini = Math.min(x0, x1);\n if (x < xmini || x > Math.max(x0, x1) || y > Math.max(y0, y1)) {\n continue;\n } else if (y < Math.min(y0, y1)) {\n if (x !== xmini) crossings++;\n } else {\n if (x1 === x0) ycross = y;\n else ycross = y0 + (x - x0) * (y1 - y0) / (x1 - x0);\n if (y === ycross) {\n if (i2 === 1 && omitFirstEdge) return false;\n return true;\n }\n if (y <= ycross && x !== xmini) crossings++;\n }\n }\n return crossings % 2 === 1;\n }\n var degenerate = true;\n var lastPt = pts[0];\n for (i = 1; i < pts.length; i++) {\n if (lastPt[0] !== pts[i][0] || lastPt[1] !== pts[i][1]) {\n degenerate = false;\n break;\n }\n }\n return {\n xmin,\n xmax,\n ymin,\n ymax,\n pts,\n contains: isRect ? rectContains : contains,\n isRect,\n degenerate\n };\n };\n polygon.isSegmentBent = function isSegmentBent(pts, start, end, tolerance) {\n var startPt = pts[start];\n var segment = [pts[end][0] - startPt[0], pts[end][1] - startPt[1]];\n var segmentSquared = dot(segment, segment);\n var segmentLen = Math.sqrt(segmentSquared);\n var unitPerp = [-segment[1] / segmentLen, segment[0] / segmentLen];\n var i;\n var part;\n var partParallel;\n for (i = start + 1; i < end; i++) {\n part = [pts[i][0] - startPt[0], pts[i][1] - startPt[1]];\n partParallel = dot(part, segment);\n if (partParallel < 0 || partParallel > segmentSquared || Math.abs(dot(part, unitPerp)) > tolerance) return true;\n }\n return false;\n };\n polygon.filter = function filter(pts, tolerance) {\n var ptsFiltered = [pts[0]];\n var doneRawIndex = 0;\n var doneFilteredIndex = 0;\n function addPt(pt) {\n pts.push(pt);\n var prevFilterLen = ptsFiltered.length;\n var iLast = doneRawIndex;\n ptsFiltered.splice(doneFilteredIndex + 1);\n for (var i = iLast + 1; i < pts.length; i++) {\n if (i === pts.length - 1 || polygon.isSegmentBent(pts, iLast, i + 1, tolerance)) {\n ptsFiltered.push(pts[i]);\n if (ptsFiltered.length < prevFilterLen - 2) {\n doneRawIndex = i;\n doneFilteredIndex = ptsFiltered.length - 1;\n }\n iLast = i;\n }\n }\n }\n if (pts.length > 1) {\n var lastPt = pts.pop();\n addPt(lastPt);\n }\n return {\n addPt,\n raw: pts,\n filtered: ptsFiltered\n };\n };\n }\n });\n\n // src/components/selections/constants.js\n var require_constants7 = __commonJS({\n \"src/components/selections/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n // max pixels off straight before a lasso select line counts as bent\n BENDPX: 1.5,\n // smallest dimension allowed for a select box\n MINSELECT: 12,\n // throttling limit (ms) for selectPoints calls\n SELECTDELAY: 100,\n // cache ID suffix for throttle\n SELECTID: \"-select\"\n };\n }\n });\n\n // src/components/selections/select.js\n var require_select = __commonJS({\n \"src/components/selections/select.js\"(exports, module) {\n \"use strict\";\n var polybool = require_polybooljs();\n var pointInPolygon = require_nested();\n var Registry = require_registry();\n var dashStyle = require_drawing().dashStyle;\n var Color2 = require_color();\n var Fx = require_fx();\n var makeEventData = require_helpers2().makeEventData;\n var dragHelpers = require_helpers5();\n var freeMode = dragHelpers.freeMode;\n var rectMode = dragHelpers.rectMode;\n var drawMode = dragHelpers.drawMode;\n var openMode = dragHelpers.openMode;\n var selectMode = dragHelpers.selectMode;\n var shapeHelpers = require_helpers8();\n var shapeConstants = require_constants5();\n var displayOutlines = require_display_outlines();\n var clearOutline = require_handle_outline().clearOutline;\n var newShapeHelpers = require_helpers7();\n var handleEllipse = newShapeHelpers.handleEllipse;\n var readPaths = newShapeHelpers.readPaths;\n var newShapes = require_newshapes().newShapes;\n var newSelections = require_newselections();\n var activateLastSelection = require_draw3().activateLastSelection;\n var Lib = require_lib();\n var ascending = Lib.sorterAsc;\n var libPolygon = require_polygon();\n var throttle = require_throttle();\n var getFromId = require_axis_ids().getFromId;\n var clearGlCanvases = require_clear_gl_canvases();\n var redrawReglTraces = require_subroutines().redrawReglTraces;\n var constants = require_constants7();\n var MINSELECT = constants.MINSELECT;\n var filteredPolygon = libPolygon.filter;\n var polygonTester = libPolygon.tester;\n var helpers = require_helpers6();\n var p2r = helpers.p2r;\n var axValue = helpers.axValue;\n var getTransform = helpers.getTransform;\n function hasSubplot(dragOptions) {\n return dragOptions.subplot !== void 0;\n }\n function prepSelect(evt, startX, startY, dragOptions, mode) {\n var isCartesian = !hasSubplot(dragOptions);\n var isFreeMode = freeMode(mode);\n var isRectMode = rectMode(mode);\n var isOpenMode = openMode(mode);\n var isDrawMode = drawMode(mode);\n var isSelectMode = selectMode(mode);\n var isLine = mode === \"drawline\";\n var isEllipse = mode === \"drawcircle\";\n var isLineOrEllipse = isLine || isEllipse;\n var gd = dragOptions.gd;\n var fullLayout = gd._fullLayout;\n var immediateSelect = isSelectMode && fullLayout.newselection.mode === \"immediate\" && isCartesian;\n var zoomLayer = fullLayout._zoomlayer;\n var dragBBox = dragOptions.element.getBoundingClientRect();\n var plotinfo = dragOptions.plotinfo;\n var transform = getTransform(plotinfo);\n var x0 = startX - dragBBox.left;\n var y0 = startY - dragBBox.top;\n fullLayout._calcInverseTransform(gd);\n var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(x0, y0);\n x0 = transformedCoords[0];\n y0 = transformedCoords[1];\n var scaleX = fullLayout._invScaleX;\n var scaleY = fullLayout._invScaleY;\n var x1 = x0;\n var y1 = y0;\n var path0 = \"M\" + x0 + \",\" + y0;\n var xAxis = dragOptions.xaxes[0];\n var yAxis = dragOptions.yaxes[0];\n var pw = xAxis._length;\n var ph = yAxis._length;\n var subtract = evt.altKey && !(drawMode(mode) && isOpenMode);\n var filterPoly, selectionTesters, mergedPolygons, currentPolygon;\n var i, searchInfo, eventData;\n coerceSelectionsCache(evt, gd, dragOptions);\n if (isFreeMode) {\n filterPoly = filteredPolygon([[x0, y0]], constants.BENDPX);\n }\n var outlines = zoomLayer.selectAll(\"path.select-outline-\" + plotinfo.id).data([1]);\n var newStyle = isDrawMode ? fullLayout.newshape : fullLayout.newselection;\n if (isDrawMode) {\n dragOptions.hasText = newStyle.label.text || newStyle.label.texttemplate;\n }\n var fillC = isDrawMode && !isOpenMode ? newStyle.fillcolor : \"rgba(0,0,0,0)\";\n var strokeC = newStyle.line.color || (isCartesian ? Color2.contrast(gd._fullLayout.plot_bgcolor) : \"#7f7f7f\");\n outlines.enter().append(\"path\").attr(\"class\", \"select-outline select-outline-\" + plotinfo.id).style({\n opacity: isDrawMode ? newStyle.opacity / 2 : 1,\n \"stroke-dasharray\": dashStyle(newStyle.line.dash, newStyle.line.width),\n \"stroke-width\": newStyle.line.width + \"px\",\n \"shape-rendering\": \"crispEdges\"\n }).call(Color2.stroke, strokeC).call(Color2.fill, fillC).attr(\"fill-rule\", \"evenodd\").classed(\"cursor-move\", isDrawMode ? true : false).attr(\"transform\", transform).attr(\"d\", path0 + \"Z\");\n var corners = zoomLayer.append(\"path\").attr(\"class\", \"zoombox-corners\").style({\n fill: Color2.background,\n stroke: Color2.defaultLine,\n \"stroke-width\": 1\n }).attr(\"transform\", transform).attr(\"d\", \"M0,0Z\");\n if (isDrawMode && dragOptions.hasText) {\n var shapeGroup = zoomLayer.select(\".label-temp\");\n if (shapeGroup.empty()) {\n shapeGroup = zoomLayer.append(\"g\").classed(\"label-temp\", true).classed(\"select-outline\", true).style({ opacity: 0.8 });\n }\n }\n var throttleID = fullLayout._uid + constants.SELECTID;\n var selection = [];\n var searchTraces = determineSearchTraces(\n gd,\n dragOptions.xaxes,\n dragOptions.yaxes,\n dragOptions.subplot\n );\n if (immediateSelect && !evt.shiftKey) {\n dragOptions._clearSubplotSelections = function() {\n if (!isCartesian) return;\n var xRef = xAxis._id;\n var yRef = yAxis._id;\n deselectSubplot(gd, xRef, yRef, searchTraces);\n var selections = (gd.layout || {}).selections || [];\n var list = [];\n var selectionErased = false;\n for (var q = 0; q < selections.length; q++) {\n var s = fullLayout.selections[q];\n if (!s || s.xref !== xRef || s.yref !== yRef) {\n list.push(selections[q]);\n } else {\n selectionErased = true;\n }\n }\n if (selectionErased) {\n gd._fullLayout._noEmitSelectedAtStart = true;\n Registry.call(\"_guiRelayout\", gd, {\n selections: list\n });\n }\n };\n }\n var fillRangeItems = getFillRangeItems(dragOptions);\n dragOptions.moveFn = function(dx0, dy0) {\n if (dragOptions._clearSubplotSelections) {\n dragOptions._clearSubplotSelections();\n dragOptions._clearSubplotSelections = void 0;\n }\n x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0));\n y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0));\n var dx = Math.abs(x1 - x0);\n var dy = Math.abs(y1 - y0);\n if (isRectMode) {\n var direction;\n var start, end;\n if (isSelectMode) {\n var q = fullLayout.selectdirection;\n if (q === \"any\") {\n if (dy < Math.min(dx * 0.6, MINSELECT)) {\n direction = \"h\";\n } else if (dx < Math.min(dy * 0.6, MINSELECT)) {\n direction = \"v\";\n } else {\n direction = \"d\";\n }\n } else {\n direction = q;\n }\n switch (direction) {\n case \"h\":\n start = isEllipse ? ph / 2 : 0;\n end = ph;\n break;\n case \"v\":\n start = isEllipse ? pw / 2 : 0;\n end = pw;\n break;\n }\n }\n if (isDrawMode) {\n switch (fullLayout.newshape.drawdirection) {\n case \"vertical\":\n direction = \"h\";\n start = isEllipse ? ph / 2 : 0;\n end = ph;\n break;\n case \"horizontal\":\n direction = \"v\";\n start = isEllipse ? pw / 2 : 0;\n end = pw;\n break;\n case \"ortho\":\n if (dx < dy) {\n direction = \"h\";\n start = y0;\n end = y1;\n } else {\n direction = \"v\";\n start = x0;\n end = x1;\n }\n break;\n default:\n direction = \"d\";\n }\n }\n if (direction === \"h\") {\n currentPolygon = isLineOrEllipse ? handleEllipse(isEllipse, [x1, start], [x1, end]) : (\n // using x1 instead of x0 allows adjusting the line while drawing\n [[x0, start], [x0, end], [x1, end], [x1, start]]\n );\n currentPolygon.xmin = isLineOrEllipse ? x1 : Math.min(x0, x1);\n currentPolygon.xmax = isLineOrEllipse ? x1 : Math.max(x0, x1);\n currentPolygon.ymin = Math.min(start, end);\n currentPolygon.ymax = Math.max(start, end);\n corners.attr(\"d\", \"M\" + currentPolygon.xmin + \",\" + (y0 - MINSELECT) + \"h-4v\" + 2 * MINSELECT + \"h4ZM\" + (currentPolygon.xmax - 1) + \",\" + (y0 - MINSELECT) + \"h4v\" + 2 * MINSELECT + \"h-4Z\");\n } else if (direction === \"v\") {\n currentPolygon = isLineOrEllipse ? handleEllipse(isEllipse, [start, y1], [end, y1]) : (\n // using y1 instead of y0 allows adjusting the line while drawing\n [[start, y0], [start, y1], [end, y1], [end, y0]]\n );\n currentPolygon.xmin = Math.min(start, end);\n currentPolygon.xmax = Math.max(start, end);\n currentPolygon.ymin = isLineOrEllipse ? y1 : Math.min(y0, y1);\n currentPolygon.ymax = isLineOrEllipse ? y1 : Math.max(y0, y1);\n corners.attr(\"d\", \"M\" + (x0 - MINSELECT) + \",\" + currentPolygon.ymin + \"v-4h\" + 2 * MINSELECT + \"v4ZM\" + (x0 - MINSELECT) + \",\" + (currentPolygon.ymax - 1) + \"v4h\" + 2 * MINSELECT + \"v-4Z\");\n } else if (direction === \"d\") {\n currentPolygon = isLineOrEllipse ? handleEllipse(isEllipse, [x0, y0], [x1, y1]) : [[x0, y0], [x0, y1], [x1, y1], [x1, y0]];\n currentPolygon.xmin = Math.min(x0, x1);\n currentPolygon.xmax = Math.max(x0, x1);\n currentPolygon.ymin = Math.min(y0, y1);\n currentPolygon.ymax = Math.max(y0, y1);\n corners.attr(\"d\", \"M0,0Z\");\n }\n } else if (isFreeMode) {\n filterPoly.addPt([x1, y1]);\n currentPolygon = filterPoly.filtered;\n }\n if (dragOptions.selectionDefs && dragOptions.selectionDefs.length) {\n mergedPolygons = mergePolygons(dragOptions.mergedPolygons, currentPolygon, subtract);\n currentPolygon.subtract = subtract;\n selectionTesters = multiTester(dragOptions.selectionDefs.concat([currentPolygon]));\n } else {\n mergedPolygons = [currentPolygon];\n selectionTesters = polygonTester(currentPolygon);\n }\n displayOutlines(convertPoly(mergedPolygons, isOpenMode), outlines, dragOptions);\n if (isSelectMode) {\n var _res = reselect(gd, false);\n var extraPoints = _res.eventData ? _res.eventData.points.slice() : [];\n _res = reselect(gd, false, selectionTesters, searchTraces, dragOptions);\n selectionTesters = _res.selectionTesters;\n eventData = _res.eventData;\n var poly;\n if (filterPoly) {\n poly = filterPoly.filtered;\n } else {\n poly = castMultiPolygon(mergedPolygons);\n }\n throttle.throttle(\n throttleID,\n constants.SELECTDELAY,\n function() {\n selection = _doSelect(selectionTesters, searchTraces);\n var newPoints = selection.slice();\n for (var w = 0; w < extraPoints.length; w++) {\n var p = extraPoints[w];\n var found = false;\n for (var u = 0; u < newPoints.length; u++) {\n if (newPoints[u].curveNumber === p.curveNumber && newPoints[u].pointNumber === p.pointNumber) {\n found = true;\n break;\n }\n }\n if (!found) newPoints.push(p);\n }\n if (newPoints.length) {\n if (!eventData) eventData = {};\n eventData.points = newPoints;\n }\n fillRangeItems(eventData, poly);\n emitSelecting(gd, eventData);\n }\n );\n }\n };\n dragOptions.clickFn = function(numClicks, evt2) {\n corners.remove();\n if (gd._fullLayout._activeShapeIndex >= 0) {\n gd._fullLayout._deactivateShape(gd);\n return;\n }\n if (isDrawMode) return;\n var clickmode = fullLayout.clickmode;\n throttle.done(throttleID).then(function() {\n throttle.clear(throttleID);\n if (numClicks === 2) {\n outlines.remove();\n for (i = 0; i < searchTraces.length; i++) {\n searchInfo = searchTraces[i];\n searchInfo._module.selectPoints(searchInfo, false);\n }\n updateSelectedState(gd, searchTraces);\n clearSelectionsCache(dragOptions);\n emitDeselect(gd);\n if (searchTraces.length) {\n var clickedXaxis = searchTraces[0].xaxis;\n var clickedYaxis = searchTraces[0].yaxis;\n if (clickedXaxis && clickedYaxis) {\n var subSelections = [];\n var allSelections = gd._fullLayout.selections;\n for (var k = 0; k < allSelections.length; k++) {\n var s = allSelections[k];\n if (!s) continue;\n if (s.xref !== clickedXaxis._id || s.yref !== clickedYaxis._id) {\n subSelections.push(s);\n }\n }\n if (subSelections.length < allSelections.length) {\n gd._fullLayout._noEmitSelectedAtStart = true;\n Registry.call(\"_guiRelayout\", gd, {\n selections: subSelections\n });\n }\n }\n }\n } else {\n if (clickmode.indexOf(\"select\") > -1) {\n selectOnClick(\n evt2,\n gd,\n dragOptions.xaxes,\n dragOptions.yaxes,\n dragOptions.subplot,\n dragOptions,\n outlines\n );\n }\n if (clickmode === \"event\") {\n emitSelected(gd, void 0);\n }\n }\n Fx.click(gd, evt2, plotinfo.id);\n }).catch(Lib.error);\n };\n dragOptions.doneFn = function() {\n corners.remove();\n throttle.done(throttleID).then(function() {\n throttle.clear(throttleID);\n if (!immediateSelect && currentPolygon && dragOptions.selectionDefs) {\n currentPolygon.subtract = subtract;\n dragOptions.selectionDefs.push(currentPolygon);\n dragOptions.mergedPolygons.length = 0;\n [].push.apply(dragOptions.mergedPolygons, mergedPolygons);\n }\n if (immediateSelect || isDrawMode) {\n clearSelectionsCache(dragOptions, immediateSelect);\n }\n if (dragOptions.doneFnCompleted) {\n dragOptions.doneFnCompleted(selection);\n }\n if (isSelectMode) {\n emitSelected(gd, eventData);\n }\n }).catch(Lib.error);\n };\n }\n function selectOnClick(evt, gd, xAxes, yAxes, subplot, dragOptions, polygonOutlines) {\n var hoverData = gd._hoverdata;\n var fullLayout = gd._fullLayout;\n var clickmode = fullLayout.clickmode;\n var sendEvents = clickmode.indexOf(\"event\") > -1;\n var selection = [];\n var searchTraces, searchInfo, currentSelectionDef, selectionTesters, traceSelection;\n var thisTracesSelection, pointOrBinSelected, subtract, eventData, i;\n if (isHoverDataSet(hoverData)) {\n coerceSelectionsCache(evt, gd, dragOptions);\n searchTraces = determineSearchTraces(gd, xAxes, yAxes, subplot);\n var clickedPtInfo = extractClickedPtInfo(hoverData, searchTraces);\n var isBinnedTrace = clickedPtInfo.pointNumbers.length > 0;\n if (isBinnedTrace ? isOnlyThisBinSelected(searchTraces, clickedPtInfo) : isOnlyOnePointSelected(searchTraces) && (pointOrBinSelected = isPointOrBinSelected(clickedPtInfo))) {\n if (polygonOutlines) polygonOutlines.remove();\n for (i = 0; i < searchTraces.length; i++) {\n searchInfo = searchTraces[i];\n searchInfo._module.selectPoints(searchInfo, false);\n }\n updateSelectedState(gd, searchTraces);\n clearSelectionsCache(dragOptions);\n if (sendEvents) {\n emitDeselect(gd);\n }\n } else {\n subtract = evt.shiftKey && (pointOrBinSelected !== void 0 ? pointOrBinSelected : isPointOrBinSelected(clickedPtInfo));\n currentSelectionDef = newPointSelectionDef(clickedPtInfo.pointNumber, clickedPtInfo.searchInfo, subtract);\n var allSelectionDefs = dragOptions.selectionDefs.concat([currentSelectionDef]);\n selectionTesters = multiTester(allSelectionDefs, selectionTesters);\n for (i = 0; i < searchTraces.length; i++) {\n traceSelection = searchTraces[i]._module.selectPoints(searchTraces[i], selectionTesters);\n thisTracesSelection = fillSelectionItem(traceSelection, searchTraces[i]);\n if (selection.length) {\n for (var j = 0; j < thisTracesSelection.length; j++) {\n selection.push(thisTracesSelection[j]);\n }\n } else selection = thisTracesSelection;\n }\n eventData = { points: selection };\n updateSelectedState(gd, searchTraces, eventData);\n if (currentSelectionDef && dragOptions) {\n dragOptions.selectionDefs.push(currentSelectionDef);\n }\n if (polygonOutlines) {\n var polygons = dragOptions.mergedPolygons;\n var isOpenMode = openMode(dragOptions.dragmode);\n displayOutlines(convertPoly(polygons, isOpenMode), polygonOutlines, dragOptions);\n }\n if (sendEvents) {\n emitSelected(gd, eventData);\n }\n }\n }\n }\n function newPointSelectionDef(pointNumber, searchInfo, subtract) {\n return {\n pointNumber,\n searchInfo,\n subtract: !!subtract\n };\n }\n function isPointSelectionDef(o) {\n return \"pointNumber\" in o && \"searchInfo\" in o;\n }\n function newPointNumTester(pointSelectionDef) {\n return {\n xmin: 0,\n xmax: 0,\n ymin: 0,\n ymax: 0,\n pts: [],\n contains: function(pt, omitFirstEdge, pointNumber, searchInfo) {\n var idxWantedTrace = pointSelectionDef.searchInfo.cd[0].trace.index;\n var idxActualTrace = searchInfo.cd[0].trace.index;\n return idxActualTrace === idxWantedTrace && pointNumber === pointSelectionDef.pointNumber;\n },\n isRect: false,\n degenerate: false,\n subtract: !!pointSelectionDef.subtract\n };\n }\n function multiTester(list) {\n if (!list.length) return;\n var testers = [];\n var xmin = isPointSelectionDef(list[0]) ? 0 : list[0][0][0];\n var xmax = xmin;\n var ymin = isPointSelectionDef(list[0]) ? 0 : list[0][0][1];\n var ymax = ymin;\n for (var i = 0; i < list.length; i++) {\n if (isPointSelectionDef(list[i])) {\n testers.push(newPointNumTester(list[i]));\n } else {\n var tester = polygonTester(list[i]);\n tester.subtract = !!list[i].subtract;\n testers.push(tester);\n xmin = Math.min(xmin, tester.xmin);\n xmax = Math.max(xmax, tester.xmax);\n ymin = Math.min(ymin, tester.ymin);\n ymax = Math.max(ymax, tester.ymax);\n }\n }\n function contains(pt, arg, pointNumber, searchInfo) {\n var contained = false;\n for (var i2 = 0; i2 < testers.length; i2++) {\n if (testers[i2].contains(pt, arg, pointNumber, searchInfo)) {\n contained = !testers[i2].subtract;\n }\n }\n return contained;\n }\n return {\n xmin,\n xmax,\n ymin,\n ymax,\n pts: [],\n contains,\n isRect: false,\n degenerate: false\n };\n }\n function coerceSelectionsCache(evt, gd, dragOptions) {\n var fullLayout = gd._fullLayout;\n var plotinfo = dragOptions.plotinfo;\n var dragmode = dragOptions.dragmode;\n var selectingOnSameSubplot = fullLayout._lastSelectedSubplot && fullLayout._lastSelectedSubplot === plotinfo.id;\n var hasModifierKey = (evt.shiftKey || evt.altKey) && !(drawMode(dragmode) && openMode(dragmode));\n if (selectingOnSameSubplot && hasModifierKey && plotinfo.selection && plotinfo.selection.selectionDefs && !dragOptions.selectionDefs) {\n dragOptions.selectionDefs = plotinfo.selection.selectionDefs;\n dragOptions.mergedPolygons = plotinfo.selection.mergedPolygons;\n } else if (!hasModifierKey || !plotinfo.selection) {\n clearSelectionsCache(dragOptions);\n }\n if (!selectingOnSameSubplot) {\n clearOutline(gd);\n fullLayout._lastSelectedSubplot = plotinfo.id;\n }\n }\n function hasActiveShape(gd) {\n return gd._fullLayout._activeShapeIndex >= 0;\n }\n function hasActiveSelection(gd) {\n return gd._fullLayout._activeSelectionIndex >= 0;\n }\n function clearSelectionsCache(dragOptions, immediateSelect) {\n var dragmode = dragOptions.dragmode;\n var plotinfo = dragOptions.plotinfo;\n var gd = dragOptions.gd;\n if (hasActiveShape(gd)) {\n gd._fullLayout._deactivateShape(gd);\n }\n if (hasActiveSelection(gd)) {\n gd._fullLayout._deactivateSelection(gd);\n }\n var fullLayout = gd._fullLayout;\n var zoomLayer = fullLayout._zoomlayer;\n var isDrawMode = drawMode(dragmode);\n var isSelectMode = selectMode(dragmode);\n if (isDrawMode || isSelectMode) {\n var outlines = zoomLayer.selectAll(\".select-outline-\" + plotinfo.id);\n if (outlines && gd._fullLayout._outlining) {\n var shapes;\n if (isDrawMode) {\n shapes = newShapes(outlines, dragOptions);\n }\n if (shapes) {\n Registry.call(\"_guiRelayout\", gd, {\n shapes\n });\n }\n var selections;\n if (isSelectMode && !hasSubplot(dragOptions)) {\n selections = newSelections(outlines, dragOptions);\n }\n if (selections) {\n gd._fullLayout._noEmitSelectedAtStart = true;\n Registry.call(\"_guiRelayout\", gd, {\n selections\n }).then(function() {\n if (immediateSelect) {\n activateLastSelection(gd);\n }\n });\n }\n gd._fullLayout._outlining = false;\n }\n }\n plotinfo.selection = {};\n plotinfo.selection.selectionDefs = dragOptions.selectionDefs = [];\n plotinfo.selection.mergedPolygons = dragOptions.mergedPolygons = [];\n }\n function getAxId(ax) {\n return ax._id;\n }\n function determineSearchTraces(gd, xAxes, yAxes, subplot) {\n if (!gd.calcdata) return [];\n var searchTraces = [];\n var xAxisIds = xAxes.map(getAxId);\n var yAxisIds = yAxes.map(getAxId);\n var cd, trace, i;\n for (i = 0; i < gd.calcdata.length; i++) {\n cd = gd.calcdata[i];\n trace = cd[0].trace;\n if (trace.visible !== true || !trace._module || !trace._module.selectPoints) continue;\n if (hasSubplot({ subplot }) && (trace.subplot === subplot || trace.geo === subplot)) {\n searchTraces.push(createSearchInfo(trace._module, cd, xAxes[0], yAxes[0]));\n } else if (trace.type === \"splom\") {\n if (trace._xaxes[xAxisIds[0]] && trace._yaxes[yAxisIds[0]]) {\n var info = createSearchInfo(trace._module, cd, xAxes[0], yAxes[0]);\n info.scene = gd._fullLayout._splomScenes[trace.uid];\n searchTraces.push(info);\n }\n } else if (trace.type === \"sankey\") {\n var sankeyInfo = createSearchInfo(trace._module, cd, xAxes[0], yAxes[0]);\n searchTraces.push(sankeyInfo);\n } else {\n if (xAxisIds.indexOf(trace.xaxis) === -1 && (!trace._xA || !trace._xA.overlaying)) continue;\n if (yAxisIds.indexOf(trace.yaxis) === -1 && (!trace._yA || !trace._yA.overlaying)) continue;\n searchTraces.push(createSearchInfo(\n trace._module,\n cd,\n getFromId(gd, trace.xaxis),\n getFromId(gd, trace.yaxis)\n ));\n }\n }\n return searchTraces;\n }\n function createSearchInfo(module2, calcData, xaxis, yaxis) {\n return {\n _module: module2,\n cd: calcData,\n xaxis,\n yaxis\n };\n }\n function isHoverDataSet(hoverData) {\n return hoverData && Array.isArray(hoverData) && hoverData[0].hoverOnBox !== true;\n }\n function extractClickedPtInfo(hoverData, searchTraces) {\n var hoverDatum = hoverData[0];\n var pointNumber = -1;\n var pointNumbers = [];\n var searchInfo, i;\n for (i = 0; i < searchTraces.length; i++) {\n searchInfo = searchTraces[i];\n if (hoverDatum.fullData.index === searchInfo.cd[0].trace.index) {\n if (hoverDatum.hoverOnBox === true) {\n break;\n }\n if (hoverDatum.pointNumber !== void 0) {\n pointNumber = hoverDatum.pointNumber;\n } else if (hoverDatum.binNumber !== void 0) {\n pointNumber = hoverDatum.binNumber;\n pointNumbers = hoverDatum.pointNumbers;\n }\n break;\n }\n }\n return {\n pointNumber,\n pointNumbers,\n searchInfo\n };\n }\n function isPointOrBinSelected(clickedPtInfo) {\n var trace = clickedPtInfo.searchInfo.cd[0].trace;\n var ptNum = clickedPtInfo.pointNumber;\n var ptNums = clickedPtInfo.pointNumbers;\n var ptNumsSet = ptNums.length > 0;\n var ptNumToTest = ptNumsSet ? ptNums[0] : ptNum;\n return trace.selectedpoints ? trace.selectedpoints.indexOf(ptNumToTest) > -1 : false;\n }\n function isOnlyThisBinSelected(searchTraces, clickedPtInfo) {\n var tracesWithSelectedPts = [];\n var searchInfo, trace, isSameTrace, i;\n for (i = 0; i < searchTraces.length; i++) {\n searchInfo = searchTraces[i];\n if (searchInfo.cd[0].trace.selectedpoints && searchInfo.cd[0].trace.selectedpoints.length > 0) {\n tracesWithSelectedPts.push(searchInfo);\n }\n }\n if (tracesWithSelectedPts.length === 1) {\n isSameTrace = tracesWithSelectedPts[0] === clickedPtInfo.searchInfo;\n if (isSameTrace) {\n trace = clickedPtInfo.searchInfo.cd[0].trace;\n if (trace.selectedpoints.length === clickedPtInfo.pointNumbers.length) {\n for (i = 0; i < clickedPtInfo.pointNumbers.length; i++) {\n if (trace.selectedpoints.indexOf(clickedPtInfo.pointNumbers[i]) < 0) {\n return false;\n }\n }\n return true;\n }\n }\n }\n return false;\n }\n function isOnlyOnePointSelected(searchTraces) {\n var len = 0;\n var searchInfo, trace, i;\n for (i = 0; i < searchTraces.length; i++) {\n searchInfo = searchTraces[i];\n trace = searchInfo.cd[0].trace;\n if (trace.selectedpoints) {\n if (trace.selectedpoints.length > 1) return false;\n len += trace.selectedpoints.length;\n if (len > 1) return false;\n }\n }\n return len === 1;\n }\n function updateSelectedState(gd, searchTraces, eventData) {\n var i;\n for (i = 0; i < searchTraces.length; i++) {\n var fullInputTrace = searchTraces[i].cd[0].trace._fullInput;\n var tracePreGUI = gd._fullLayout._tracePreGUI[fullInputTrace.uid] || {};\n if (tracePreGUI.selectedpoints === void 0) {\n tracePreGUI.selectedpoints = fullInputTrace._input.selectedpoints || null;\n }\n }\n var trace;\n if (eventData) {\n var pts = eventData.points || [];\n for (i = 0; i < searchTraces.length; i++) {\n trace = searchTraces[i].cd[0].trace;\n trace._input.selectedpoints = trace._fullInput.selectedpoints = [];\n if (trace._fullInput !== trace) trace.selectedpoints = [];\n }\n for (var k = 0; k < pts.length; k++) {\n var pt = pts[k];\n var data = pt.data;\n var fullData = pt.fullData;\n var pointIndex = pt.pointIndex;\n var pointIndices = pt.pointIndices;\n if (pointIndices) {\n [].push.apply(data.selectedpoints, pointIndices);\n if (trace._fullInput !== trace) {\n [].push.apply(fullData.selectedpoints, pointIndices);\n }\n } else {\n data.selectedpoints.push(pointIndex);\n if (trace._fullInput !== trace) {\n fullData.selectedpoints.push(pointIndex);\n }\n }\n }\n } else {\n for (i = 0; i < searchTraces.length; i++) {\n trace = searchTraces[i].cd[0].trace;\n delete trace.selectedpoints;\n delete trace._input.selectedpoints;\n if (trace._fullInput !== trace) {\n delete trace._fullInput.selectedpoints;\n }\n }\n }\n updateReglSelectedState(gd, searchTraces);\n }\n function updateReglSelectedState(gd, searchTraces) {\n var hasRegl = false;\n for (var i = 0; i < searchTraces.length; i++) {\n var searchInfo = searchTraces[i];\n var cd = searchInfo.cd;\n if (Registry.traceIs(cd[0].trace, \"regl\")) {\n hasRegl = true;\n }\n var _module = searchInfo._module;\n var fn = _module.styleOnSelect || _module.style;\n if (fn) {\n fn(gd, cd, cd[0].node3);\n if (cd[0].nodeRangePlot3) fn(gd, cd, cd[0].nodeRangePlot3);\n }\n }\n if (hasRegl) {\n clearGlCanvases(gd);\n redrawReglTraces(gd);\n }\n }\n function mergePolygons(list, poly, subtract) {\n var fn = subtract ? polybool.difference : polybool.union;\n var res = fn({\n regions: list\n }, {\n regions: [poly]\n });\n var allPolygons = res.regions.reverse();\n for (var i = 0; i < allPolygons.length; i++) {\n var polygon = allPolygons[i];\n polygon.subtract = getSubtract(polygon, allPolygons.slice(0, i));\n }\n return allPolygons;\n }\n function fillSelectionItem(selection, searchInfo) {\n if (Array.isArray(selection)) {\n var cd = searchInfo.cd;\n var trace = searchInfo.cd[0].trace;\n for (var i = 0; i < selection.length; i++) {\n selection[i] = makeEventData(selection[i], trace, cd);\n }\n }\n return selection;\n }\n function convertPoly(polygonsIn, isOpenMode) {\n var polygonsOut = [];\n for (var i = 0; i < polygonsIn.length; i++) {\n polygonsOut[i] = [];\n for (var j = 0; j < polygonsIn[i].length; j++) {\n polygonsOut[i][j] = [];\n polygonsOut[i][j][0] = j ? \"L\" : \"M\";\n for (var k = 0; k < polygonsIn[i][j].length; k++) {\n polygonsOut[i][j].push(\n polygonsIn[i][j][k]\n );\n }\n }\n if (!isOpenMode) {\n polygonsOut[i].push([\n \"Z\",\n polygonsOut[i][0][1],\n // initial x\n polygonsOut[i][0][2]\n // initial y\n ]);\n }\n }\n return polygonsOut;\n }\n function _doSelect(selectionTesters, searchTraces) {\n var allSelections = [];\n var thisSelection;\n var traceSelections = [];\n var traceSelection;\n for (var i = 0; i < searchTraces.length; i++) {\n var searchInfo = searchTraces[i];\n traceSelection = searchInfo._module.selectPoints(searchInfo, selectionTesters);\n traceSelections.push(traceSelection);\n thisSelection = fillSelectionItem(traceSelection, searchInfo);\n allSelections = allSelections.concat(thisSelection);\n }\n return allSelections;\n }\n function reselect(gd, mayEmitSelected, selectionTesters, searchTraces, dragOptions) {\n var hadSearchTraces = !!searchTraces;\n var plotinfo, xRef, yRef;\n if (dragOptions) {\n plotinfo = dragOptions.plotinfo;\n xRef = dragOptions.xaxes[0]._id;\n yRef = dragOptions.yaxes[0]._id;\n }\n var allSelections = [];\n var allSearchTraces = [];\n var layoutPolygons = getLayoutPolygons(gd);\n var fullLayout = gd._fullLayout;\n if (plotinfo) {\n var zoomLayer = fullLayout._zoomlayer;\n var mode = fullLayout.dragmode;\n var isDrawMode = drawMode(mode);\n var isSelectMode = selectMode(mode);\n if (isDrawMode || isSelectMode) {\n var xaxis = getFromId(gd, xRef, \"x\");\n var yaxis = getFromId(gd, yRef, \"y\");\n if (xaxis && yaxis) {\n var outlines = zoomLayer.selectAll(\".select-outline-\" + plotinfo.id);\n if (outlines && gd._fullLayout._outlining) {\n if (outlines.length) {\n var e = outlines[0][0];\n var d = e.getAttribute(\"d\");\n var outlinePolys = readPaths(d, gd, plotinfo);\n var draftPolygons = [];\n for (var u = 0; u < outlinePolys.length; u++) {\n var p = outlinePolys[u];\n var polygon = [];\n for (var t = 0; t < p.length; t++) {\n polygon.push([\n convert(xaxis, p[t][1]),\n convert(yaxis, p[t][2])\n ]);\n }\n polygon.xref = xRef;\n polygon.yref = yRef;\n polygon.subtract = getSubtract(polygon, draftPolygons);\n draftPolygons.push(polygon);\n }\n layoutPolygons = layoutPolygons.concat(draftPolygons);\n }\n }\n }\n }\n }\n var subplots = xRef && yRef ? [xRef + yRef] : fullLayout._subplots.cartesian;\n epmtySplomSelectionBatch(gd);\n var seenSplom = {};\n for (var i = 0; i < subplots.length; i++) {\n var subplot = subplots[i];\n var yAt = subplot.indexOf(\"y\");\n var _xRef = subplot.slice(0, yAt);\n var _yRef = subplot.slice(yAt);\n var _selectionTesters = xRef && yRef ? selectionTesters : void 0;\n _selectionTesters = addTester(layoutPolygons, _xRef, _yRef, _selectionTesters);\n if (_selectionTesters) {\n var _searchTraces = searchTraces;\n if (!hadSearchTraces) {\n var _xA = getFromId(gd, _xRef, \"x\");\n var _yA = getFromId(gd, _yRef, \"y\");\n _searchTraces = determineSearchTraces(\n gd,\n [_xA],\n [_yA],\n subplot\n );\n for (var w = 0; w < _searchTraces.length; w++) {\n var s = _searchTraces[w];\n var cd0 = s.cd[0];\n var trace = cd0.trace;\n if (s._module.name === \"scattergl\" && !cd0.t.xpx) {\n var x = trace.x;\n var y = trace.y;\n var len = trace._length;\n cd0.t.xpx = [];\n cd0.t.ypx = [];\n for (var j = 0; j < len; j++) {\n cd0.t.xpx[j] = _xA.c2p(x[j]);\n cd0.t.ypx[j] = _yA.c2p(y[j]);\n }\n }\n if (s._module.name === \"splom\") {\n if (!seenSplom[trace.uid]) {\n seenSplom[trace.uid] = true;\n }\n }\n }\n }\n var selection = _doSelect(_selectionTesters, _searchTraces);\n allSelections = allSelections.concat(selection);\n allSearchTraces = allSearchTraces.concat(_searchTraces);\n }\n }\n var eventData = { points: allSelections };\n updateSelectedState(gd, allSearchTraces, eventData);\n var clickmode = fullLayout.clickmode;\n var sendEvents = clickmode.indexOf(\"event\") > -1 && mayEmitSelected;\n if (!plotinfo && // get called from plot_api & plots\n mayEmitSelected) {\n var activePolygons = getLayoutPolygons(gd, true);\n if (activePolygons.length) {\n var xref = activePolygons[0].xref;\n var yref = activePolygons[0].yref;\n if (xref && yref) {\n var poly = castMultiPolygon(activePolygons);\n var fillRangeItems = makeFillRangeItems([\n getFromId(gd, xref, \"x\"),\n getFromId(gd, yref, \"y\")\n ]);\n fillRangeItems(eventData, poly);\n }\n }\n if (gd._fullLayout._noEmitSelectedAtStart) {\n gd._fullLayout._noEmitSelectedAtStart = false;\n } else {\n if (sendEvents) emitSelected(gd, eventData);\n }\n fullLayout._reselect = false;\n }\n if (!plotinfo && // get called from plot_api & plots\n fullLayout._deselect) {\n var deselect = fullLayout._deselect;\n xRef = deselect.xref;\n yRef = deselect.yref;\n if (!subplotSelected(xRef, yRef, allSearchTraces)) {\n deselectSubplot(gd, xRef, yRef, searchTraces);\n }\n if (sendEvents) {\n if (eventData.points.length) {\n emitSelected(gd, eventData);\n } else {\n emitDeselect(gd);\n }\n }\n fullLayout._deselect = false;\n }\n return {\n eventData,\n selectionTesters\n };\n }\n function epmtySplomSelectionBatch(gd) {\n var cd = gd.calcdata;\n if (!cd) return;\n for (var i = 0; i < cd.length; i++) {\n var cd0 = cd[i][0];\n var trace = cd0.trace;\n var splomScenes = gd._fullLayout._splomScenes;\n if (splomScenes) {\n var scene = splomScenes[trace.uid];\n if (scene) {\n scene.selectBatch = [];\n }\n }\n }\n }\n function subplotSelected(xRef, yRef, searchTraces) {\n for (var i = 0; i < searchTraces.length; i++) {\n var s = searchTraces[i];\n if (s.xaxis && s.xaxis._id === xRef && (s.yaxis && s.yaxis._id === yRef)) {\n return true;\n }\n }\n return false;\n }\n function deselectSubplot(gd, xRef, yRef, searchTraces) {\n searchTraces = determineSearchTraces(\n gd,\n [getFromId(gd, xRef, \"x\")],\n [getFromId(gd, yRef, \"y\")],\n xRef + yRef\n );\n for (var k = 0; k < searchTraces.length; k++) {\n var searchInfo = searchTraces[k];\n searchInfo._module.selectPoints(searchInfo, false);\n }\n updateSelectedState(gd, searchTraces);\n }\n function addTester(layoutPolygons, xRef, yRef, selectionTesters) {\n var mergedPolygons;\n for (var i = 0; i < layoutPolygons.length; i++) {\n var currentPolygon = layoutPolygons[i];\n if (xRef !== currentPolygon.xref || yRef !== currentPolygon.yref) continue;\n if (mergedPolygons) {\n var subtract = !!currentPolygon.subtract;\n mergedPolygons = mergePolygons(mergedPolygons, currentPolygon, subtract);\n selectionTesters = multiTester(mergedPolygons);\n } else {\n mergedPolygons = [currentPolygon];\n selectionTesters = polygonTester(currentPolygon);\n }\n }\n return selectionTesters;\n }\n function getLayoutPolygons(gd, onlyActiveOnes) {\n var allPolygons = [];\n var fullLayout = gd._fullLayout;\n var allSelections = fullLayout.selections;\n var len = allSelections.length;\n for (var i = 0; i < len; i++) {\n if (onlyActiveOnes && i !== fullLayout._activeSelectionIndex) continue;\n var selection = allSelections[i];\n if (!selection) continue;\n var xref = selection.xref;\n var yref = selection.yref;\n var xaxis = getFromId(gd, xref, \"x\");\n var yaxis = getFromId(gd, yref, \"y\");\n var xmin, xmax, ymin, ymax;\n var polygon;\n if (selection.type === \"rect\") {\n polygon = [];\n var x0 = convert(xaxis, selection.x0);\n var x1 = convert(xaxis, selection.x1);\n var y0 = convert(yaxis, selection.y0);\n var y1 = convert(yaxis, selection.y1);\n polygon = [[x0, y0], [x0, y1], [x1, y1], [x1, y0]];\n xmin = Math.min(x0, x1);\n xmax = Math.max(x0, x1);\n ymin = Math.min(y0, y1);\n ymax = Math.max(y0, y1);\n polygon.xmin = xmin;\n polygon.xmax = xmax;\n polygon.ymin = ymin;\n polygon.ymax = ymax;\n polygon.xref = xref;\n polygon.yref = yref;\n polygon.subtract = false;\n polygon.isRect = true;\n allPolygons.push(polygon);\n } else if (selection.type === \"path\") {\n var segments = selection.path.split(\"Z\");\n var multiPolygons = [];\n for (var j = 0; j < segments.length; j++) {\n var path = segments[j];\n if (!path) continue;\n path += \"Z\";\n var allX = shapeHelpers.extractPathCoords(path, shapeConstants.paramIsX, \"raw\");\n var allY = shapeHelpers.extractPathCoords(path, shapeConstants.paramIsY, \"raw\");\n xmin = Infinity;\n xmax = -Infinity;\n ymin = Infinity;\n ymax = -Infinity;\n polygon = [];\n for (var k = 0; k < allX.length; k++) {\n var x = convert(xaxis, allX[k]);\n var y = convert(yaxis, allY[k]);\n polygon.push([x, y]);\n xmin = Math.min(x, xmin);\n xmax = Math.max(x, xmax);\n ymin = Math.min(y, ymin);\n ymax = Math.max(y, ymax);\n }\n polygon.xmin = xmin;\n polygon.xmax = xmax;\n polygon.ymin = ymin;\n polygon.ymax = ymax;\n polygon.xref = xref;\n polygon.yref = yref;\n polygon.subtract = getSubtract(polygon, multiPolygons);\n multiPolygons.push(polygon);\n allPolygons.push(polygon);\n }\n }\n }\n return allPolygons;\n }\n function getSubtract(polygon, previousPolygons) {\n var subtract = false;\n for (var i = 0; i < previousPolygons.length; i++) {\n var previousPolygon = previousPolygons[i];\n for (var k = 0; k < polygon.length; k++) {\n if (pointInPolygon(polygon[k], previousPolygon)) {\n subtract = !subtract;\n break;\n }\n }\n }\n return subtract;\n }\n function convert(ax, d) {\n if (ax.type === \"date\") d = d.replace(\"_\", \" \");\n return ax.type === \"log\" ? ax.c2p(d) : ax.r2p(d, null, ax.calendar);\n }\n function castMultiPolygon(allPolygons) {\n var len = allPolygons.length;\n var p = [];\n for (var i = 0; i < len; i++) {\n var polygon = allPolygons[i];\n p = p.concat(polygon);\n p = p.concat([polygon[0]]);\n }\n return computeRectAndRanges(p);\n }\n function computeRectAndRanges(poly) {\n poly.isRect = poly.length === 5 && poly[0][0] === poly[4][0] && poly[0][1] === poly[4][1] && (poly[0][0] === poly[1][0] && poly[2][0] === poly[3][0] && poly[0][1] === poly[3][1] && poly[1][1] === poly[2][1]) || poly[0][1] === poly[1][1] && poly[2][1] === poly[3][1] && poly[0][0] === poly[3][0] && poly[1][0] === poly[2][0];\n if (poly.isRect) {\n poly.xmin = Math.min(poly[0][0], poly[2][0]);\n poly.xmax = Math.max(poly[0][0], poly[2][0]);\n poly.ymin = Math.min(poly[0][1], poly[2][1]);\n poly.ymax = Math.max(poly[0][1], poly[2][1]);\n }\n return poly;\n }\n function makeFillRangeItems(allAxes) {\n return function(eventData, poly) {\n var range;\n var lassoPoints;\n for (var i = 0; i < allAxes.length; i++) {\n var ax = allAxes[i];\n var id = ax._id;\n var axLetter = id.charAt(0);\n if (poly.isRect) {\n if (!range) range = {};\n var min = poly[axLetter + \"min\"];\n var max = poly[axLetter + \"max\"];\n if (min !== void 0 && max !== void 0) {\n range[id] = [\n p2r(ax, min),\n p2r(ax, max)\n ].sort(ascending);\n }\n } else {\n if (!lassoPoints) lassoPoints = {};\n lassoPoints[id] = poly.map(axValue(ax));\n }\n }\n if (range) {\n eventData.range = range;\n }\n if (lassoPoints) {\n eventData.lassoPoints = lassoPoints;\n }\n };\n }\n function getFillRangeItems(dragOptions) {\n var plotinfo = dragOptions.plotinfo;\n return plotinfo.fillRangeItems || // allow subplots (i.e. geo, mapbox, map, sankey) to override fillRangeItems routine\n makeFillRangeItems(dragOptions.xaxes.concat(dragOptions.yaxes));\n }\n function emitSelecting(gd, eventData) {\n gd.emit(\"plotly_selecting\", eventData);\n }\n function emitSelected(gd, eventData) {\n if (eventData) {\n eventData.selections = (gd.layout || {}).selections || [];\n }\n gd.emit(\"plotly_selected\", eventData);\n }\n function emitDeselect(gd) {\n gd.emit(\"plotly_deselect\", null);\n }\n module.exports = {\n reselect,\n prepSelect,\n clearOutline,\n clearSelectionsCache,\n selectOnClick\n };\n }\n });\n\n // src/components/annotations/arrow_paths.js\n var require_arrow_paths = __commonJS({\n \"src/components/annotations/arrow_paths.js\"(exports, module) {\n \"use strict\";\n module.exports = [\n // no arrow\n {\n path: \"\",\n backoff: 0\n },\n // wide with flat back\n {\n path: \"M-2.4,-3V3L0.6,0Z\",\n backoff: 0.6\n },\n // narrower with flat back\n {\n path: \"M-3.7,-2.5V2.5L1.3,0Z\",\n backoff: 1.3\n },\n // barbed\n {\n path: \"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z\",\n backoff: 1.55\n },\n // wide line-drawn\n {\n path: \"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z\",\n backoff: 1.6\n },\n // narrower line-drawn\n {\n path: \"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z\",\n backoff: 2\n },\n // circle\n {\n path: \"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z\",\n backoff: 0,\n noRotate: true\n },\n // square\n {\n path: \"M2,2V-2H-2V2Z\",\n backoff: 0,\n noRotate: true\n }\n ];\n }\n });\n\n // src/constants/axis_placeable_objects.js\n var require_axis_placeable_objects = __commonJS({\n \"src/constants/axis_placeable_objects.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n axisRefDescription: function(axisname, lower, upper) {\n return [\n \"If set to a\",\n axisname,\n \"axis id (e.g. *\" + axisname + \"* or\",\n \"*\" + axisname + \"2*), the `\" + axisname + \"` position refers to a\",\n axisname,\n \"coordinate. If set to *paper*, the `\" + axisname + \"`\",\n \"position refers to the distance from the\",\n lower,\n \"of the plotting\",\n \"area in normalized coordinates where *0* (*1*) corresponds to the\",\n lower,\n \"(\" + upper + \"). If set to a\",\n axisname,\n \"axis ID followed by\",\n \"*domain* (separated by a space), the position behaves like for\",\n \"*paper*, but refers to the distance in fractions of the domain\",\n \"length from the\",\n lower,\n \"of the domain of that axis: e.g.,\",\n \"*\" + axisname + \"2 domain* refers to the domain of the second\",\n axisname,\n \" axis and a\",\n axisname,\n \"position of 0.5 refers to the\",\n \"point between the\",\n lower,\n \"and the\",\n upper,\n \"of the domain of the\",\n \"second\",\n axisname,\n \"axis.\"\n ].join(\" \");\n }\n };\n }\n });\n\n // src/components/annotations/attributes.js\n var require_attributes11 = __commonJS({\n \"src/components/annotations/attributes.js\"(exports, module) {\n \"use strict\";\n var ARROWPATHS = require_arrow_paths();\n var fontAttrs = require_font_attributes();\n var cartesianConstants = require_constants2();\n var templatedArray = require_plot_template().templatedArray;\n var axisPlaceableObjs = require_axis_placeable_objects();\n module.exports = templatedArray(\"annotation\", {\n visible: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc+arraydraw\"\n },\n text: {\n valType: \"string\",\n editType: \"calc+arraydraw\"\n },\n textangle: {\n valType: \"angle\",\n dflt: 0,\n editType: \"calc+arraydraw\"\n },\n font: fontAttrs({\n editType: \"calc+arraydraw\",\n colorEditType: \"arraydraw\"\n }),\n width: {\n valType: \"number\",\n min: 1,\n dflt: null,\n editType: \"calc+arraydraw\"\n },\n height: {\n valType: \"number\",\n min: 1,\n dflt: null,\n editType: \"calc+arraydraw\"\n },\n opacity: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 1,\n editType: \"arraydraw\"\n },\n align: {\n valType: \"enumerated\",\n values: [\"left\", \"center\", \"right\"],\n dflt: \"center\",\n editType: \"arraydraw\"\n },\n valign: {\n valType: \"enumerated\",\n values: [\"top\", \"middle\", \"bottom\"],\n dflt: \"middle\",\n editType: \"arraydraw\"\n },\n bgcolor: {\n valType: \"color\",\n dflt: \"rgba(0,0,0,0)\",\n editType: \"arraydraw\"\n },\n bordercolor: {\n valType: \"color\",\n dflt: \"rgba(0,0,0,0)\",\n editType: \"arraydraw\"\n },\n borderpad: {\n valType: \"number\",\n min: 0,\n dflt: 1,\n editType: \"calc+arraydraw\"\n },\n borderwidth: {\n valType: \"number\",\n min: 0,\n dflt: 1,\n editType: \"calc+arraydraw\"\n },\n // arrow\n showarrow: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc+arraydraw\"\n },\n arrowcolor: {\n valType: \"color\",\n editType: \"arraydraw\"\n },\n arrowhead: {\n valType: \"integer\",\n min: 0,\n max: ARROWPATHS.length,\n dflt: 1,\n editType: \"arraydraw\"\n },\n startarrowhead: {\n valType: \"integer\",\n min: 0,\n max: ARROWPATHS.length,\n dflt: 1,\n editType: \"arraydraw\"\n },\n arrowside: {\n valType: \"flaglist\",\n flags: [\"end\", \"start\"],\n extras: [\"none\"],\n dflt: \"end\",\n editType: \"arraydraw\"\n },\n arrowsize: {\n valType: \"number\",\n min: 0.3,\n dflt: 1,\n editType: \"calc+arraydraw\"\n },\n startarrowsize: {\n valType: \"number\",\n min: 0.3,\n dflt: 1,\n editType: \"calc+arraydraw\"\n },\n arrowwidth: {\n valType: \"number\",\n min: 0.1,\n editType: \"calc+arraydraw\"\n },\n standoff: {\n valType: \"number\",\n min: 0,\n dflt: 0,\n editType: \"calc+arraydraw\"\n },\n startstandoff: {\n valType: \"number\",\n min: 0,\n dflt: 0,\n editType: \"calc+arraydraw\"\n },\n ax: {\n valType: \"any\",\n editType: \"calc+arraydraw\"\n },\n ay: {\n valType: \"any\",\n editType: \"calc+arraydraw\"\n },\n axref: {\n valType: \"enumerated\",\n dflt: \"pixel\",\n values: [\n \"pixel\",\n cartesianConstants.idRegex.x.toString()\n ],\n editType: \"calc\"\n },\n ayref: {\n valType: \"enumerated\",\n dflt: \"pixel\",\n values: [\n \"pixel\",\n cartesianConstants.idRegex.y.toString()\n ],\n editType: \"calc\"\n },\n // positioning\n xref: {\n valType: \"enumerated\",\n values: [\n \"paper\",\n cartesianConstants.idRegex.x.toString()\n ],\n editType: \"calc\"\n },\n x: {\n valType: \"any\",\n editType: \"calc+arraydraw\"\n },\n xanchor: {\n valType: \"enumerated\",\n values: [\"auto\", \"left\", \"center\", \"right\"],\n dflt: \"auto\",\n editType: \"calc+arraydraw\"\n },\n xshift: {\n valType: \"number\",\n dflt: 0,\n editType: \"calc+arraydraw\"\n },\n yref: {\n valType: \"enumerated\",\n values: [\n \"paper\",\n cartesianConstants.idRegex.y.toString()\n ],\n editType: \"calc\"\n },\n y: {\n valType: \"any\",\n editType: \"calc+arraydraw\"\n },\n yanchor: {\n valType: \"enumerated\",\n values: [\"auto\", \"top\", \"middle\", \"bottom\"],\n dflt: \"auto\",\n editType: \"calc+arraydraw\"\n },\n yshift: {\n valType: \"number\",\n dflt: 0,\n editType: \"calc+arraydraw\"\n },\n clicktoshow: {\n valType: \"enumerated\",\n values: [false, \"onoff\", \"onout\"],\n dflt: false,\n editType: \"arraydraw\"\n },\n xclick: {\n valType: \"any\",\n editType: \"arraydraw\"\n },\n yclick: {\n valType: \"any\",\n editType: \"arraydraw\"\n },\n hovertext: {\n valType: \"string\",\n editType: \"arraydraw\"\n },\n hoverlabel: {\n bgcolor: {\n valType: \"color\",\n editType: \"arraydraw\"\n },\n bordercolor: {\n valType: \"color\",\n editType: \"arraydraw\"\n },\n font: fontAttrs({\n editType: \"arraydraw\"\n }),\n editType: \"arraydraw\"\n },\n captureevents: {\n valType: \"boolean\",\n editType: \"arraydraw\"\n },\n editType: \"calc\"\n });\n }\n });\n\n // src/traces/scatter/constants.js\n var require_constants8 = __commonJS({\n \"src/traces/scatter/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n PTS_LINESONLY: 20,\n // fixed parameters of clustering and clipping algorithms\n // fraction of clustering tolerance \"so close we don't even consider it a new point\"\n minTolerance: 0.2,\n // how fast does clustering tolerance increase as you get away from the visible region\n toleranceGrowth: 10,\n // number of viewport sizes away from the visible region\n // at which we clip all lines to the perimeter\n maxScreensAway: 20,\n eventDataKeys: []\n };\n }\n });\n\n // src/traces/scatter/fillcolor_attribute.js\n var require_fillcolor_attribute = __commonJS({\n \"src/traces/scatter/fillcolor_attribute.js\"(exports, module) {\n \"use strict\";\n module.exports = function makeFillcolorAttr(hasFillgradient) {\n return {\n valType: \"color\",\n editType: \"style\",\n anim: true\n };\n };\n }\n });\n\n // src/traces/scatter/attributes.js\n var require_attributes12 = __commonJS({\n \"src/traces/scatter/attributes.js\"(exports, module) {\n \"use strict\";\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var colorScaleAttrs = require_attributes8();\n var fontAttrs = require_font_attributes();\n var dash = require_attributes4().dash;\n var pattern = require_attributes4().pattern;\n var Drawing = require_drawing();\n var constants = require_constants8();\n var extendFlat = require_extend().extendFlat;\n var makeFillcolorAttr = require_fillcolor_attribute();\n function axisPeriod(axis) {\n return {\n valType: \"any\",\n dflt: 0,\n editType: \"calc\"\n };\n }\n function axisPeriod0(axis) {\n return {\n valType: \"any\",\n editType: \"calc\"\n };\n }\n function axisPeriodAlignment(axis) {\n return {\n valType: \"enumerated\",\n values: [\n \"start\",\n \"middle\",\n \"end\"\n ],\n dflt: \"middle\",\n editType: \"calc\"\n };\n }\n module.exports = {\n x: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\",\n anim: true\n },\n x0: {\n valType: \"any\",\n dflt: 0,\n editType: \"calc+clearAxisTypes\",\n anim: true\n },\n dx: {\n valType: \"number\",\n dflt: 1,\n editType: \"calc\",\n anim: true\n },\n y: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\",\n anim: true\n },\n y0: {\n valType: \"any\",\n dflt: 0,\n editType: \"calc+clearAxisTypes\",\n anim: true\n },\n dy: {\n valType: \"number\",\n dflt: 1,\n editType: \"calc\",\n anim: true\n },\n xperiod: axisPeriod(\"x\"),\n yperiod: axisPeriod(\"y\"),\n xperiod0: axisPeriod0(\"x0\"),\n yperiod0: axisPeriod0(\"y0\"),\n xperiodalignment: axisPeriodAlignment(\"x\"),\n yperiodalignment: axisPeriodAlignment(\"y\"),\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n offsetgroup: {\n valType: \"string\",\n dflt: \"\",\n editType: \"calc\"\n },\n alignmentgroup: {\n valType: \"string\",\n dflt: \"\",\n editType: \"calc\"\n },\n stackgroup: {\n valType: \"string\",\n dflt: \"\",\n editType: \"calc\"\n },\n orientation: {\n valType: \"enumerated\",\n values: [\"v\", \"h\"],\n editType: \"calc\"\n },\n groupnorm: {\n valType: \"enumerated\",\n values: [\"\", \"fraction\", \"percent\"],\n dflt: \"\",\n editType: \"calc\"\n },\n stackgaps: {\n valType: \"enumerated\",\n values: [\"infer zero\", \"interpolate\"],\n dflt: \"infer zero\",\n editType: \"calc\"\n },\n text: {\n valType: \"string\",\n dflt: \"\",\n arrayOk: true,\n editType: \"calc\"\n },\n texttemplate: texttemplateAttrs({}, {}),\n hovertext: {\n valType: \"string\",\n dflt: \"\",\n arrayOk: true,\n editType: \"style\"\n },\n mode: {\n valType: \"flaglist\",\n flags: [\"lines\", \"markers\", \"text\"],\n extras: [\"none\"],\n editType: \"calc\"\n },\n hoveron: {\n valType: \"flaglist\",\n flags: [\"points\", \"fills\"],\n editType: \"style\"\n },\n hovertemplate: hovertemplateAttrs({}, {\n keys: constants.eventDataKeys\n }),\n line: {\n color: {\n valType: \"color\",\n editType: \"style\",\n anim: true\n },\n width: {\n valType: \"number\",\n min: 0,\n dflt: 2,\n editType: \"style\",\n anim: true\n },\n shape: {\n valType: \"enumerated\",\n values: [\"linear\", \"spline\", \"hv\", \"vh\", \"hvh\", \"vhv\"],\n dflt: \"linear\",\n editType: \"plot\"\n },\n smoothing: {\n valType: \"number\",\n min: 0,\n max: 1.3,\n dflt: 1,\n editType: \"plot\"\n },\n dash: extendFlat({}, dash, { editType: \"style\" }),\n backoff: {\n // we want to have a similar option for the start of the line\n valType: \"number\",\n min: 0,\n dflt: \"auto\",\n arrayOk: true,\n editType: \"plot\"\n },\n simplify: {\n valType: \"boolean\",\n dflt: true,\n editType: \"plot\"\n },\n editType: \"plot\"\n },\n connectgaps: {\n valType: \"boolean\",\n dflt: false,\n editType: \"calc\"\n },\n cliponaxis: {\n valType: \"boolean\",\n dflt: true,\n editType: \"plot\"\n },\n fill: {\n valType: \"enumerated\",\n values: [\"none\", \"tozeroy\", \"tozerox\", \"tonexty\", \"tonextx\", \"toself\", \"tonext\"],\n editType: \"calc\"\n },\n fillcolor: makeFillcolorAttr(true),\n fillgradient: extendFlat({\n type: {\n valType: \"enumerated\",\n values: [\"radial\", \"horizontal\", \"vertical\", \"none\"],\n dflt: \"none\",\n editType: \"calc\"\n },\n start: {\n valType: \"number\",\n editType: \"calc\"\n },\n stop: {\n valType: \"number\",\n editType: \"calc\"\n },\n colorscale: {\n valType: \"colorscale\",\n editType: \"style\"\n },\n editType: \"calc\"\n }),\n fillpattern: pattern,\n marker: extendFlat(\n {\n symbol: {\n valType: \"enumerated\",\n values: Drawing.symbolList,\n dflt: \"circle\",\n arrayOk: true,\n editType: \"style\"\n },\n opacity: {\n valType: \"number\",\n min: 0,\n max: 1,\n arrayOk: true,\n editType: \"style\",\n anim: true\n },\n angle: {\n valType: \"angle\",\n dflt: 0,\n arrayOk: true,\n editType: \"plot\",\n anim: false\n // TODO: possibly set to true in future\n },\n angleref: {\n valType: \"enumerated\",\n values: [\"previous\", \"up\"],\n dflt: \"up\",\n editType: \"plot\",\n anim: false\n },\n standoff: {\n valType: \"number\",\n min: 0,\n dflt: 0,\n arrayOk: true,\n editType: \"plot\",\n anim: true\n },\n size: {\n valType: \"number\",\n min: 0,\n dflt: 6,\n arrayOk: true,\n editType: \"calc\",\n anim: true\n },\n maxdisplayed: {\n valType: \"number\",\n min: 0,\n dflt: 0,\n editType: \"plot\"\n },\n sizeref: {\n valType: \"number\",\n dflt: 1,\n editType: \"calc\"\n },\n sizemin: {\n valType: \"number\",\n min: 0,\n dflt: 0,\n editType: \"calc\"\n },\n sizemode: {\n valType: \"enumerated\",\n values: [\"diameter\", \"area\"],\n dflt: \"diameter\",\n editType: \"calc\"\n },\n line: extendFlat(\n {\n width: {\n valType: \"number\",\n min: 0,\n arrayOk: true,\n editType: \"style\",\n anim: true\n },\n editType: \"calc\"\n },\n colorScaleAttrs(\"marker.line\", { anim: true })\n ),\n gradient: {\n type: {\n valType: \"enumerated\",\n values: [\"radial\", \"horizontal\", \"vertical\", \"none\"],\n arrayOk: true,\n dflt: \"none\",\n editType: \"calc\"\n },\n color: {\n valType: \"color\",\n arrayOk: true,\n editType: \"calc\"\n },\n editType: \"calc\"\n },\n editType: \"calc\"\n },\n colorScaleAttrs(\"marker\", { anim: true })\n ),\n selected: {\n marker: {\n opacity: {\n valType: \"number\",\n min: 0,\n max: 1,\n editType: \"style\"\n },\n color: {\n valType: \"color\",\n editType: \"style\"\n },\n size: {\n valType: \"number\",\n min: 0,\n editType: \"style\"\n },\n editType: \"style\"\n },\n textfont: {\n color: {\n valType: \"color\",\n editType: \"style\"\n },\n editType: \"style\"\n },\n editType: \"style\"\n },\n unselected: {\n marker: {\n opacity: {\n valType: \"number\",\n min: 0,\n max: 1,\n editType: \"style\"\n },\n color: {\n valType: \"color\",\n editType: \"style\"\n },\n size: {\n valType: \"number\",\n min: 0,\n editType: \"style\"\n },\n editType: \"style\"\n },\n textfont: {\n color: {\n valType: \"color\",\n editType: \"style\"\n },\n editType: \"style\"\n },\n editType: \"style\"\n },\n textposition: {\n valType: \"enumerated\",\n values: [\n \"top left\",\n \"top center\",\n \"top right\",\n \"middle left\",\n \"middle center\",\n \"middle right\",\n \"bottom left\",\n \"bottom center\",\n \"bottom right\"\n ],\n dflt: \"middle center\",\n arrayOk: true,\n editType: \"calc\"\n },\n textfont: fontAttrs({\n editType: \"calc\",\n colorEditType: \"style\",\n arrayOk: true\n }),\n zorder: {\n valType: \"integer\",\n dflt: 0,\n editType: \"plot\"\n }\n };\n }\n });\n\n // src/components/selections/attributes.js\n var require_attributes13 = __commonJS({\n \"src/components/selections/attributes.js\"(exports, module) {\n \"use strict\";\n var annAttrs = require_attributes11();\n var scatterLineAttrs = require_attributes12().line;\n var dash = require_attributes4().dash;\n var extendFlat = require_extend().extendFlat;\n var overrideAll = require_edit_types().overrideAll;\n var templatedArray = require_plot_template().templatedArray;\n var axisPlaceableObjs = require_axis_placeable_objects();\n module.exports = overrideAll(templatedArray(\"selection\", {\n type: {\n valType: \"enumerated\",\n values: [\"rect\", \"path\"]\n },\n xref: extendFlat({}, annAttrs.xref, {}),\n yref: extendFlat({}, annAttrs.yref, {}),\n x0: {\n valType: \"any\"\n },\n x1: {\n valType: \"any\"\n },\n y0: {\n valType: \"any\"\n },\n y1: {\n valType: \"any\"\n },\n path: {\n valType: \"string\",\n editType: \"arraydraw\"\n },\n opacity: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0.7,\n editType: \"arraydraw\"\n },\n line: {\n color: scatterLineAttrs.color,\n width: extendFlat({}, scatterLineAttrs.width, {\n min: 1,\n dflt: 1\n }),\n dash: extendFlat({}, dash, {\n dflt: \"dot\"\n })\n }\n }), \"arraydraw\", \"from-root\");\n }\n });\n\n // src/components/selections/defaults.js\n var require_defaults6 = __commonJS({\n \"src/components/selections/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Axes = require_axes();\n var handleArrayContainerDefaults = require_array_container_defaults();\n var attributes = require_attributes13();\n var helpers = require_helpers8();\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {\n handleArrayContainerDefaults(layoutIn, layoutOut, {\n name: \"selections\",\n handleItemDefaults: handleSelectionDefaults\n });\n var selections = layoutOut.selections;\n for (var i = 0; i < selections.length; i++) {\n var selection = selections[i];\n if (!selection) continue;\n if (selection.path === void 0) {\n if (selection.x0 === void 0 || selection.x1 === void 0 || selection.y0 === void 0 || selection.y1 === void 0) {\n layoutOut.selections[i] = null;\n }\n }\n }\n };\n function handleSelectionDefaults(selectionIn, selectionOut, fullLayout) {\n function coerce(attr, dflt) {\n return Lib.coerce(selectionIn, selectionOut, attributes, attr, dflt);\n }\n var path = coerce(\"path\");\n var dfltType = path ? \"path\" : \"rect\";\n var selectionType = coerce(\"type\", dfltType);\n var noPath = selectionType !== \"path\";\n if (noPath) delete selectionOut.path;\n coerce(\"opacity\");\n coerce(\"line.color\");\n coerce(\"line.width\");\n coerce(\"line.dash\");\n var axLetters = [\"x\", \"y\"];\n for (var i = 0; i < 2; i++) {\n var axLetter = axLetters[i];\n var gdMock = { _fullLayout: fullLayout };\n var ax;\n var pos2r;\n var r2pos;\n var axRef = Axes.coerceRef(selectionIn, selectionOut, gdMock, axLetter);\n ax = Axes.getFromId(gdMock, axRef);\n ax._selectionIndices.push(selectionOut._index);\n r2pos = helpers.rangeToShapePosition(ax);\n pos2r = helpers.shapePositionToRange(ax);\n if (noPath) {\n var attr0 = axLetter + \"0\";\n var attr1 = axLetter + \"1\";\n var in0 = selectionIn[attr0];\n var in1 = selectionIn[attr1];\n selectionIn[attr0] = pos2r(selectionIn[attr0], true);\n selectionIn[attr1] = pos2r(selectionIn[attr1], true);\n Axes.coercePosition(selectionOut, gdMock, coerce, axRef, attr0);\n Axes.coercePosition(selectionOut, gdMock, coerce, axRef, attr1);\n var p0 = selectionOut[attr0];\n var p1 = selectionOut[attr1];\n if (p0 !== void 0 && p1 !== void 0) {\n selectionOut[attr0] = r2pos(p0);\n selectionOut[attr1] = r2pos(p1);\n selectionIn[attr0] = in0;\n selectionIn[attr1] = in1;\n }\n }\n }\n if (noPath) {\n Lib.noneOrAll(selectionIn, selectionOut, [\"x0\", \"x1\", \"y0\", \"y1\"]);\n }\n }\n }\n });\n\n // src/components/selections/draw_newselection/defaults.js\n var require_defaults7 = __commonJS({\n \"src/components/selections/draw_newselection/defaults.js\"(exports, module) {\n \"use strict\";\n module.exports = function supplyDrawNewSelectionDefaults(layoutIn, layoutOut, coerce) {\n coerce(\"newselection.mode\");\n var newselectionLineWidth = coerce(\"newselection.line.width\");\n if (newselectionLineWidth) {\n coerce(\"newselection.line.color\");\n coerce(\"newselection.line.dash\");\n }\n coerce(\"activeselection.fillcolor\");\n coerce(\"activeselection.opacity\");\n };\n }\n });\n\n // src/plots/cartesian/include_components.js\n var require_include_components = __commonJS({\n \"src/plots/cartesian/include_components.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var Lib = require_lib();\n var axisIds = require_axis_ids();\n module.exports = function makeIncludeComponents(containerArrayName) {\n return function includeComponents(layoutIn, layoutOut) {\n var array = layoutIn[containerArrayName];\n if (!Array.isArray(array)) return;\n var Cartesian = Registry.subplotsRegistry.cartesian;\n var idRegex = Cartesian.idRegex;\n var subplots = layoutOut._subplots;\n var xaList = subplots.xaxis;\n var yaList = subplots.yaxis;\n var cartesianList = subplots.cartesian;\n var hasCartesian = layoutOut._has(\"cartesian\");\n for (var i = 0; i < array.length; i++) {\n var itemi = array[i];\n if (!Lib.isPlainObject(itemi)) continue;\n var xref = axisIds.cleanId(itemi.xref, \"x\", false);\n var yref = axisIds.cleanId(itemi.yref, \"y\", false);\n var hasXref = idRegex.x.test(xref);\n var hasYref = idRegex.y.test(yref);\n if (hasXref || hasYref) {\n if (!hasCartesian) Lib.pushUnique(layoutOut._basePlotModules, Cartesian);\n var newAxis = false;\n if (hasXref && xaList.indexOf(xref) === -1) {\n xaList.push(xref);\n newAxis = true;\n }\n if (hasYref && yaList.indexOf(yref) === -1) {\n yaList.push(yref);\n newAxis = true;\n }\n if (newAxis && hasXref && hasYref) {\n cartesianList.push(xref + yref);\n }\n }\n }\n };\n };\n }\n });\n\n // src/components/selections/index.js\n var require_selections = __commonJS({\n \"src/components/selections/index.js\"(exports, module) {\n \"use strict\";\n var drawModule = require_draw3();\n var select = require_select();\n module.exports = {\n moduleType: \"component\",\n name: \"selections\",\n layoutAttributes: require_attributes13(),\n supplyLayoutDefaults: require_defaults6(),\n supplyDrawNewSelectionDefaults: require_defaults7(),\n includeBasePlot: require_include_components()(\"selections\"),\n draw: drawModule.draw,\n drawOne: drawModule.drawOne,\n reselect: select.reselect,\n prepSelect: select.prepSelect,\n clearOutline: select.clearOutline,\n clearSelectionsCache: select.clearSelectionsCache,\n selectOnClick: select.selectOnClick\n };\n }\n });\n\n // src/plots/cartesian/dragbox.js\n var require_dragbox = __commonJS({\n \"src/plots/cartesian/dragbox.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var numberFormat = Lib.numberFormat;\n var tinycolor = require_tinycolor();\n var supportsPassive = require_has_passive_events();\n var Registry = require_registry();\n var strTranslate = Lib.strTranslate;\n var svgTextUtils = require_svg_text_utils();\n var Color2 = require_color();\n var Drawing = require_drawing();\n var Fx = require_fx();\n var Axes = require_axes();\n var setCursor = require_setcursor();\n var dragElement = require_dragelement();\n var helpers = require_helpers5();\n var selectingOrDrawing = helpers.selectingOrDrawing;\n var freeMode = helpers.freeMode;\n var FROM_TL = require_alignment().FROM_TL;\n var clearGlCanvases = require_clear_gl_canvases();\n var redrawReglTraces = require_subroutines().redrawReglTraces;\n var Plots = require_plots();\n var getFromId = require_axis_ids().getFromId;\n var prepSelect = require_selections().prepSelect;\n var clearOutline = require_selections().clearOutline;\n var selectOnClick = require_selections().selectOnClick;\n var scaleZoom = require_scale_zoom();\n var constants = require_constants2();\n var MINDRAG = constants.MINDRAG;\n var MINZOOM = constants.MINZOOM;\n var SHOWZOOMOUTTIP = true;\n function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {\n var zoomlayer = gd._fullLayout._zoomlayer;\n var isMainDrag = ns + ew === \"nsew\";\n var singleEnd = (ns + ew).length === 1;\n var xa0, ya0;\n var xaHash, yaHash;\n var xaxes, yaxes;\n var xs, ys;\n var pw, ph;\n var links;\n var matches;\n var xActive, yActive;\n var allFixedRanges;\n var editX, editY;\n var hasScatterGl, hasSplom, hasSVG;\n var updates;\n var scaleX;\n var scaleY;\n x += plotinfo.yaxis._shift;\n function recomputeAxisLists() {\n xa0 = plotinfo.xaxis;\n ya0 = plotinfo.yaxis;\n pw = xa0._length;\n ph = ya0._length;\n xs = xa0._offset;\n ys = ya0._offset;\n xaHash = {};\n xaHash[xa0._id] = xa0;\n yaHash = {};\n yaHash[ya0._id] = ya0;\n if (ns && ew) {\n var overlays = plotinfo.overlays;\n for (var i = 0; i < overlays.length; i++) {\n var xa = overlays[i].xaxis;\n xaHash[xa._id] = xa;\n var ya = overlays[i].yaxis;\n yaHash[ya._id] = ya;\n }\n }\n xaxes = hashValues(xaHash);\n yaxes = hashValues(yaHash);\n xActive = isDirectionActive(xaxes, ew);\n yActive = isDirectionActive(yaxes, ns);\n allFixedRanges = !yActive && !xActive;\n matches = calcLinks(gd, gd._fullLayout._axisMatchGroups, xaHash, yaHash);\n links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash, matches);\n var spConstrained = links.isSubplotConstrained || matches.isSubplotConstrained;\n editX = ew || spConstrained;\n editY = ns || spConstrained;\n var fullLayout = gd._fullLayout;\n hasScatterGl = fullLayout._has(\"scattergl\");\n hasSplom = fullLayout._has(\"splom\");\n hasSVG = fullLayout._has(\"svg\");\n }\n recomputeAxisLists();\n var cursor = getDragCursor(yActive + xActive, gd._fullLayout.dragmode, isMainDrag);\n var dragger = makeRectDragger(plotinfo, ns + ew + \"drag\", cursor, x, y, w, h);\n if (allFixedRanges && !isMainDrag) {\n dragger.onmousedown = null;\n dragger.style.pointerEvents = \"none\";\n return dragger;\n }\n var dragOptions = {\n element: dragger,\n gd,\n plotinfo\n };\n dragOptions.prepFn = function(e, startX, startY) {\n var dragModePrev = dragOptions.dragmode;\n var dragModeNow = gd._fullLayout.dragmode;\n if (dragModeNow !== dragModePrev) {\n dragOptions.dragmode = dragModeNow;\n }\n recomputeAxisLists();\n scaleX = gd._fullLayout._invScaleX;\n scaleY = gd._fullLayout._invScaleY;\n if (!allFixedRanges) {\n if (isMainDrag) {\n if (e.shiftKey) {\n if (dragModeNow === \"pan\") dragModeNow = \"zoom\";\n else if (!selectingOrDrawing(dragModeNow)) dragModeNow = \"pan\";\n } else if (e.ctrlKey) {\n dragModeNow = \"pan\";\n }\n } else {\n dragModeNow = \"pan\";\n }\n }\n if (freeMode(dragModeNow)) dragOptions.minDrag = 1;\n else dragOptions.minDrag = void 0;\n if (selectingOrDrawing(dragModeNow)) {\n dragOptions.xaxes = xaxes;\n dragOptions.yaxes = yaxes;\n prepSelect(e, startX, startY, dragOptions, dragModeNow);\n } else {\n dragOptions.clickFn = clickFn;\n if (selectingOrDrawing(dragModePrev)) {\n clearAndResetSelect();\n }\n if (!allFixedRanges) {\n if (dragModeNow === \"zoom\") {\n dragOptions.moveFn = zoomMove;\n dragOptions.doneFn = zoomDone;\n dragOptions.minDrag = 1;\n zoomPrep(e, startX, startY);\n } else if (dragModeNow === \"pan\") {\n dragOptions.moveFn = plotDrag;\n dragOptions.doneFn = dragTail;\n }\n }\n }\n gd._fullLayout._redrag = function() {\n var dragDataNow = gd._dragdata;\n if (dragDataNow && dragDataNow.element === dragger) {\n var dragModeNow2 = gd._fullLayout.dragmode;\n if (!selectingOrDrawing(dragModeNow2)) {\n recomputeAxisLists();\n updateSubplots([0, 0, pw, ph]);\n dragOptions.moveFn(dragDataNow.dx, dragDataNow.dy);\n }\n }\n };\n };\n function clearAndResetSelect() {\n dragOptions.plotinfo.selection = false;\n clearOutline(gd);\n }\n function clickFn(numClicks, evt) {\n var gd2 = dragOptions.gd;\n if (gd2._fullLayout._activeShapeIndex >= 0) {\n gd2._fullLayout._deactivateShape(gd2);\n return;\n }\n var clickmode = gd2._fullLayout.clickmode;\n removeZoombox(gd2);\n if (numClicks === 2 && !singleEnd) doubleClick();\n if (isMainDrag) {\n if (clickmode.indexOf(\"select\") > -1) {\n selectOnClick(evt, gd2, xaxes, yaxes, plotinfo.id, dragOptions);\n }\n if (clickmode.indexOf(\"event\") > -1) {\n Fx.click(gd2, evt, plotinfo.id);\n }\n } else if (numClicks === 1 && singleEnd) {\n var ax = ns ? ya0 : xa0;\n var end = ns === \"s\" || ew === \"w\" ? 0 : 1;\n var attrStr = ax._name + \".range[\" + end + \"]\";\n var initialText = getEndText(ax, end);\n var hAlign = \"left\";\n var vAlign = \"middle\";\n if (ax.fixedrange) return;\n if (ns) {\n vAlign = ns === \"n\" ? \"top\" : \"bottom\";\n if (ax.side === \"right\") hAlign = \"right\";\n } else if (ew === \"e\") hAlign = \"right\";\n if (gd2._context.showAxisRangeEntryBoxes) {\n d3.select(dragger).call(svgTextUtils.makeEditable, {\n gd: gd2,\n immediate: true,\n background: gd2._fullLayout.paper_bgcolor,\n text: String(initialText),\n fill: ax.tickfont ? ax.tickfont.color : \"#444\",\n horizontalAlign: hAlign,\n verticalAlign: vAlign\n }).on(\"edit\", function(text) {\n var v = ax.d2r(text);\n if (v !== void 0) {\n Registry.call(\"_guiRelayout\", gd2, attrStr, v);\n }\n });\n }\n }\n }\n dragElement.init(dragOptions);\n var x0, y0;\n var box;\n var lum;\n var path0;\n var dimmed;\n var zoomMode;\n var zb;\n var corners;\n var zoomDragged;\n function zoomPrep(e, startX, startY) {\n var dragBBox = dragger.getBoundingClientRect();\n x0 = startX - dragBBox.left;\n y0 = startY - dragBBox.top;\n gd._fullLayout._calcInverseTransform(gd);\n var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0);\n x0 = transformedCoords[0];\n y0 = transformedCoords[1];\n box = { l: x0, r: x0, w: 0, t: y0, b: y0, h: 0 };\n lum = gd._hmpixcount ? gd._hmlumcount / gd._hmpixcount : tinycolor(gd._fullLayout.plot_bgcolor).getLuminance();\n path0 = \"M0,0H\" + pw + \"V\" + ph + \"H0V0\";\n dimmed = false;\n zoomMode = \"xy\";\n zoomDragged = false;\n zb = makeZoombox(zoomlayer, lum, xs, ys, path0);\n corners = makeCorners(zoomlayer, xs, ys);\n }\n function zoomMove(dx0, dy0) {\n if (gd._transitioningWithDuration) {\n return false;\n }\n var x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0));\n var y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0));\n var dx = Math.abs(x1 - x0);\n var dy = Math.abs(y1 - y0);\n box.l = Math.min(x0, x1);\n box.r = Math.max(x0, x1);\n box.t = Math.min(y0, y1);\n box.b = Math.max(y0, y1);\n function noZoom() {\n zoomMode = \"\";\n box.r = box.l;\n box.t = box.b;\n corners.attr(\"d\", \"M0,0Z\");\n }\n if (links.isSubplotConstrained) {\n if (dx > MINZOOM || dy > MINZOOM) {\n zoomMode = \"xy\";\n if (dx / pw > dy / ph) {\n dy = dx * ph / pw;\n if (y0 > y1) box.t = y0 - dy;\n else box.b = y0 + dy;\n } else {\n dx = dy * pw / ph;\n if (x0 > x1) box.l = x0 - dx;\n else box.r = x0 + dx;\n }\n corners.attr(\"d\", xyCorners(box));\n } else {\n noZoom();\n }\n } else if (matches.isSubplotConstrained) {\n if (dx > MINZOOM || dy > MINZOOM) {\n zoomMode = \"xy\";\n var r0 = Math.min(box.l / pw, (ph - box.b) / ph);\n var r1 = Math.max(box.r / pw, (ph - box.t) / ph);\n box.l = r0 * pw;\n box.r = r1 * pw;\n box.b = (1 - r0) * ph;\n box.t = (1 - r1) * ph;\n corners.attr(\"d\", xyCorners(box));\n } else {\n noZoom();\n }\n } else if (!yActive || dy < Math.min(Math.max(dx * 0.6, MINDRAG), MINZOOM)) {\n if (dx < MINDRAG || !xActive) {\n noZoom();\n } else {\n box.t = 0;\n box.b = ph;\n zoomMode = \"x\";\n corners.attr(\"d\", xCorners(box, y0));\n }\n } else if (!xActive || dx < Math.min(dy * 0.6, MINZOOM)) {\n box.l = 0;\n box.r = pw;\n zoomMode = \"y\";\n corners.attr(\"d\", yCorners(box, x0));\n } else {\n zoomMode = \"xy\";\n corners.attr(\"d\", xyCorners(box));\n }\n box.w = box.r - box.l;\n box.h = box.b - box.t;\n if (zoomMode) zoomDragged = true;\n gd._dragged = zoomDragged;\n updateZoombox(zb, corners, box, path0, dimmed, lum);\n computeZoomUpdates();\n gd.emit(\"plotly_relayouting\", updates);\n dimmed = true;\n }\n function computeZoomUpdates() {\n updates = {};\n if (zoomMode === \"xy\" || zoomMode === \"x\") {\n zoomAxRanges(xaxes, box.l / pw, box.r / pw, updates, links.xaxes);\n updateMatchedAxRange(\"x\", updates);\n }\n if (zoomMode === \"xy\" || zoomMode === \"y\") {\n zoomAxRanges(yaxes, (ph - box.b) / ph, (ph - box.t) / ph, updates, links.yaxes);\n updateMatchedAxRange(\"y\", updates);\n }\n }\n function zoomDone() {\n computeZoomUpdates();\n removeZoombox(gd);\n dragTail();\n showDoubleClickNotifier(gd);\n }\n var scrollViewBox = [0, 0, pw, ph];\n var redrawTimer = null;\n var REDRAWDELAY = constants.REDRAWDELAY;\n var mainplot = plotinfo.mainplot ? gd._fullLayout._plots[plotinfo.mainplot] : plotinfo;\n function zoomWheel(e) {\n if (!gd._context._scrollZoom.cartesian && !gd._fullLayout._enablescrollzoom) {\n return;\n }\n clearAndResetSelect();\n if (gd._transitioningWithDuration) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n recomputeAxisLists();\n clearTimeout(redrawTimer);\n var wheelDelta = -e.deltaY;\n if (!isFinite(wheelDelta)) wheelDelta = e.wheelDelta / 10;\n if (!isFinite(wheelDelta)) {\n Lib.log(\"Did not find wheel motion attributes: \", e);\n return;\n }\n var zoom = Math.exp(-Math.min(Math.max(wheelDelta, -20), 20) / 200);\n var gbb = mainplot.draglayer.select(\".nsewdrag\").node().getBoundingClientRect();\n var xfrac = (e.clientX - gbb.left) / gbb.width;\n var yfrac = (gbb.bottom - e.clientY) / gbb.height;\n var i;\n function zoomWheelOneAxis(ax, centerFraction, zoom2) {\n if (ax.fixedrange) return;\n var axRange = Lib.simpleMap(ax.range, ax.r2l);\n var v0 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction;\n function doZoom(v) {\n return ax.l2r(v0 + (v - v0) * zoom2);\n }\n ax.range = axRange.map(doZoom);\n }\n if (editX) {\n if (!ew) xfrac = 0.5;\n for (i = 0; i < xaxes.length; i++) {\n zoomWheelOneAxis(xaxes[i], xfrac, zoom);\n }\n updateMatchedAxRange(\"x\");\n scrollViewBox[2] *= zoom;\n scrollViewBox[0] += scrollViewBox[2] * xfrac * (1 / zoom - 1);\n }\n if (editY) {\n if (!ns) yfrac = 0.5;\n for (i = 0; i < yaxes.length; i++) {\n zoomWheelOneAxis(yaxes[i], yfrac, zoom);\n }\n updateMatchedAxRange(\"y\");\n scrollViewBox[3] *= zoom;\n scrollViewBox[1] += scrollViewBox[3] * (1 - yfrac) * (1 / zoom - 1);\n }\n updateSubplots(scrollViewBox);\n ticksAndAnnotations();\n gd.emit(\"plotly_relayouting\", updates);\n redrawTimer = setTimeout(function() {\n if (!gd._fullLayout) return;\n scrollViewBox = [0, 0, pw, ph];\n dragTail();\n }, REDRAWDELAY);\n e.preventDefault();\n return;\n }\n if (ns.length * ew.length !== 1) {\n attachWheelEventHandler(dragger, zoomWheel);\n }\n function plotDrag(dx, dy) {\n dx = dx * scaleX;\n dy = dy * scaleY;\n if (gd._transitioningWithDuration) {\n return;\n }\n gd._fullLayout._replotting = true;\n if (xActive === \"ew\" || yActive === \"ns\") {\n var spDx = xActive ? -dx : 0;\n var spDy = yActive ? -dy : 0;\n if (matches.isSubplotConstrained) {\n if (xActive && yActive) {\n var frac = (dx / pw - dy / ph) / 2;\n dx = frac * pw;\n dy = -frac * ph;\n spDx = -dx;\n spDy = -dy;\n }\n if (yActive) {\n spDx = -spDy * pw / ph;\n } else {\n spDy = -spDx * ph / pw;\n }\n }\n if (xActive) {\n dragAxList(xaxes, dx);\n updateMatchedAxRange(\"x\");\n }\n if (yActive) {\n dragAxList(yaxes, dy);\n updateMatchedAxRange(\"y\");\n }\n updateSubplots([spDx, spDy, pw, ph]);\n ticksAndAnnotations();\n gd.emit(\"plotly_relayouting\", updates);\n return;\n }\n function dz(axArray, end, d) {\n var otherEnd = 1 - end;\n var movedAx;\n var newLinearizedEnd;\n for (var i2 = 0; i2 < axArray.length; i2++) {\n var axi = axArray[i2];\n if (axi.fixedrange) continue;\n movedAx = axi;\n newLinearizedEnd = axi._rl[otherEnd] + (axi._rl[end] - axi._rl[otherEnd]) / dZoom(d / axi._length);\n var newEnd = axi.l2r(newLinearizedEnd);\n if (newEnd !== false && newEnd !== void 0) axi.range[end] = newEnd;\n }\n return movedAx._length * (movedAx._rl[end] - newLinearizedEnd) / (movedAx._rl[end] - movedAx._rl[otherEnd]);\n }\n var dxySign = xActive === \"w\" === (yActive === \"n\") ? 1 : -1;\n if (xActive && yActive && (links.isSubplotConstrained || matches.isSubplotConstrained)) {\n var dxyFraction = (dx / pw + dxySign * dy / ph) / 2;\n dx = dxyFraction * pw;\n dy = dxySign * dxyFraction * ph;\n }\n var xStart, yStart;\n if (xActive === \"w\") dx = dz(xaxes, 0, dx);\n else if (xActive === \"e\") dx = dz(xaxes, 1, -dx);\n else if (!xActive) dx = 0;\n if (yActive === \"n\") dy = dz(yaxes, 1, dy);\n else if (yActive === \"s\") dy = dz(yaxes, 0, -dy);\n else if (!yActive) dy = 0;\n xStart = xActive === \"w\" ? dx : 0;\n yStart = yActive === \"n\" ? dy : 0;\n if (links.isSubplotConstrained && !matches.isSubplotConstrained || // NW or SE on matching axes - create a symmetric zoom\n matches.isSubplotConstrained && xActive && yActive && dxySign > 0) {\n var i;\n if (matches.isSubplotConstrained || !xActive && yActive.length === 1) {\n for (i = 0; i < xaxes.length; i++) {\n xaxes[i].range = xaxes[i]._r.slice();\n scaleZoom(xaxes[i], 1 - dy / ph);\n }\n dx = dy * pw / ph;\n xStart = dx / 2;\n }\n if (matches.isSubplotConstrained || !yActive && xActive.length === 1) {\n for (i = 0; i < yaxes.length; i++) {\n yaxes[i].range = yaxes[i]._r.slice();\n scaleZoom(yaxes[i], 1 - dx / pw);\n }\n dy = dx * ph / pw;\n yStart = dy / 2;\n }\n }\n if (!matches.isSubplotConstrained || !yActive) {\n updateMatchedAxRange(\"x\");\n }\n if (!matches.isSubplotConstrained || !xActive) {\n updateMatchedAxRange(\"y\");\n }\n var xSize = pw - dx;\n var ySize = ph - dy;\n if (matches.isSubplotConstrained && !(xActive && yActive)) {\n if (xActive) {\n yStart = xStart ? 0 : dx * ph / pw;\n ySize = xSize * ph / pw;\n } else {\n xStart = yStart ? 0 : dy * pw / ph;\n xSize = ySize * pw / ph;\n }\n }\n updateSubplots([xStart, yStart, xSize, ySize]);\n ticksAndAnnotations();\n gd.emit(\"plotly_relayouting\", updates);\n }\n function updateMatchedAxRange(axLetter, out) {\n var matchedAxes = matches.isSubplotConstrained ? { x: yaxes, y: xaxes }[axLetter] : matches[axLetter + \"axes\"];\n var constrainedAxes = matches.isSubplotConstrained ? { x: xaxes, y: yaxes }[axLetter] : [];\n for (var i = 0; i < matchedAxes.length; i++) {\n var ax = matchedAxes[i];\n var axId = ax._id;\n var axId2 = matches.xLinks[axId] || matches.yLinks[axId];\n var ax2 = constrainedAxes[0] || xaHash[axId2] || yaHash[axId2];\n if (ax2) {\n if (out) {\n out[ax._name + \".range[0]\"] = out[ax2._name + \".range[0]\"];\n out[ax._name + \".range[1]\"] = out[ax2._name + \".range[1]\"];\n } else {\n ax.range = ax2.range.slice();\n }\n }\n }\n }\n function ticksAndAnnotations() {\n var activeAxIds = [];\n var i;\n function pushActiveAxIds(axList) {\n for (i = 0; i < axList.length; i++) {\n if (!axList[i].fixedrange) activeAxIds.push(axList[i]._id);\n }\n }\n function pushActiveAxIdsSynced(axList, axisType) {\n for (i = 0; i < axList.length; i++) {\n var axListI = axList[i];\n var axListIType = axListI[axisType];\n if (!axListI.fixedrange && axListIType.tickmode === \"sync\") activeAxIds.push(axListIType._id);\n }\n }\n if (editX) {\n pushActiveAxIds(xaxes);\n pushActiveAxIds(links.xaxes);\n pushActiveAxIds(matches.xaxes);\n pushActiveAxIdsSynced(plotinfo.overlays, \"xaxis\");\n }\n if (editY) {\n pushActiveAxIds(yaxes);\n pushActiveAxIds(links.yaxes);\n pushActiveAxIds(matches.yaxes);\n pushActiveAxIdsSynced(plotinfo.overlays, \"yaxis\");\n }\n updates = {};\n for (i = 0; i < activeAxIds.length; i++) {\n var axId = activeAxIds[i];\n var ax = getFromId(gd, axId);\n Axes.drawOne(gd, ax, { skipTitle: true });\n updates[ax._name + \".range[0]\"] = ax.range[0];\n updates[ax._name + \".range[1]\"] = ax.range[1];\n }\n Axes.redrawComponents(gd, activeAxIds);\n }\n function doubleClick() {\n if (gd._transitioningWithDuration) return;\n var doubleClickConfig = gd._context.doubleClick;\n var axList = [];\n if (xActive) axList = axList.concat(xaxes);\n if (yActive) axList = axList.concat(yaxes);\n if (matches.xaxes) axList = axList.concat(matches.xaxes);\n if (matches.yaxes) axList = axList.concat(matches.yaxes);\n var attrs = {};\n var ax, i;\n if (doubleClickConfig === \"reset+autosize\") {\n doubleClickConfig = \"autosize\";\n for (i = 0; i < axList.length; i++) {\n ax = axList[i];\n var r0 = ax._rangeInitial0;\n var r1 = ax._rangeInitial1;\n var hasRangeInitial = r0 !== void 0 || r1 !== void 0;\n if (hasRangeInitial && (r0 !== void 0 && r0 !== ax.range[0] || r1 !== void 0 && r1 !== ax.range[1]) || !hasRangeInitial && ax.autorange !== true) {\n doubleClickConfig = \"reset\";\n break;\n }\n }\n }\n if (doubleClickConfig === \"autosize\") {\n for (i = 0; i < axList.length; i++) {\n ax = axList[i];\n if (!ax.fixedrange) attrs[ax._name + \".autorange\"] = true;\n }\n } else if (doubleClickConfig === \"reset\") {\n if (xActive || links.isSubplotConstrained) axList = axList.concat(links.xaxes);\n if (yActive && !links.isSubplotConstrained) axList = axList.concat(links.yaxes);\n if (links.isSubplotConstrained) {\n if (!xActive) axList = axList.concat(xaxes);\n else if (!yActive) axList = axList.concat(yaxes);\n }\n for (i = 0; i < axList.length; i++) {\n ax = axList[i];\n if (!ax.fixedrange) {\n var axName = ax._name;\n var autorangeInitial = ax._autorangeInitial;\n if (ax._rangeInitial0 === void 0 && ax._rangeInitial1 === void 0) {\n attrs[axName + \".autorange\"] = true;\n } else if (ax._rangeInitial0 === void 0) {\n attrs[axName + \".autorange\"] = autorangeInitial;\n attrs[axName + \".range\"] = [null, ax._rangeInitial1];\n } else if (ax._rangeInitial1 === void 0) {\n attrs[axName + \".range\"] = [ax._rangeInitial0, null];\n attrs[axName + \".autorange\"] = autorangeInitial;\n } else {\n attrs[axName + \".range\"] = [ax._rangeInitial0, ax._rangeInitial1];\n }\n }\n }\n }\n gd.emit(\"plotly_doubleclick\", null);\n Registry.call(\"_guiRelayout\", gd, attrs);\n }\n function dragTail() {\n updateSubplots([0, 0, pw, ph]);\n Lib.syncOrAsync([\n Plots.previousPromises,\n function() {\n gd._fullLayout._replotting = false;\n Registry.call(\"_guiRelayout\", gd, updates);\n }\n ], gd);\n }\n function updateSubplots(viewBox) {\n var fullLayout = gd._fullLayout;\n var plotinfos = fullLayout._plots;\n var subplots = fullLayout._subplots.cartesian;\n var i, sp, xa, ya;\n if (hasSplom) {\n Registry.subplotsRegistry.splom.drag(gd);\n }\n if (hasScatterGl) {\n for (i = 0; i < subplots.length; i++) {\n sp = plotinfos[subplots[i]];\n xa = sp.xaxis;\n ya = sp.yaxis;\n if (sp._scene) {\n if (xa.limitRange) xa.limitRange();\n if (ya.limitRange) ya.limitRange();\n var xrng = Lib.simpleMap(xa.range, xa.r2l);\n var yrng = Lib.simpleMap(ya.range, ya.r2l);\n sp._scene.update({ range: [xrng[0], yrng[0], xrng[1], yrng[1]] });\n }\n }\n }\n if (hasSplom || hasScatterGl) {\n clearGlCanvases(gd);\n redrawReglTraces(gd);\n }\n if (hasSVG) {\n var xScaleFactor = viewBox[2] / xa0._length;\n var yScaleFactor = viewBox[3] / ya0._length;\n for (i = 0; i < subplots.length; i++) {\n sp = plotinfos[subplots[i]];\n xa = sp.xaxis;\n ya = sp.yaxis;\n var editX2 = (editX || matches.isSubplotConstrained) && !xa.fixedrange && xaHash[xa._id];\n var editY2 = (editY || matches.isSubplotConstrained) && !ya.fixedrange && yaHash[ya._id];\n var xScaleFactor2, yScaleFactor2;\n var clipDx, clipDy;\n if (editX2) {\n xScaleFactor2 = xScaleFactor;\n clipDx = ew || matches.isSubplotConstrained ? viewBox[0] : getShift(xa, xScaleFactor2);\n } else if (matches.xaHash[xa._id]) {\n xScaleFactor2 = xScaleFactor;\n clipDx = viewBox[0] * xa._length / xa0._length;\n } else if (matches.yaHash[xa._id]) {\n xScaleFactor2 = yScaleFactor;\n clipDx = yActive === \"ns\" ? -viewBox[1] * xa._length / ya0._length : getShift(xa, xScaleFactor2, { n: \"top\", s: \"bottom\" }[yActive]);\n } else {\n xScaleFactor2 = getLinkedScaleFactor(xa, xScaleFactor, yScaleFactor);\n clipDx = scaleAndGetShift(xa, xScaleFactor2);\n }\n if (xScaleFactor2 > 1 && (xa.maxallowed !== void 0 && editX === (xa.range[0] < xa.range[1] ? \"e\" : \"w\") || xa.minallowed !== void 0 && editX === (xa.range[0] < xa.range[1] ? \"w\" : \"e\"))) {\n xScaleFactor2 = 1;\n clipDx = 0;\n }\n if (editY2) {\n yScaleFactor2 = yScaleFactor;\n clipDy = ns || matches.isSubplotConstrained ? viewBox[1] : getShift(ya, yScaleFactor2);\n } else if (matches.yaHash[ya._id]) {\n yScaleFactor2 = yScaleFactor;\n clipDy = viewBox[1] * ya._length / ya0._length;\n } else if (matches.xaHash[ya._id]) {\n yScaleFactor2 = xScaleFactor;\n clipDy = xActive === \"ew\" ? -viewBox[0] * ya._length / xa0._length : getShift(ya, yScaleFactor2, { e: \"right\", w: \"left\" }[xActive]);\n } else {\n yScaleFactor2 = getLinkedScaleFactor(ya, xScaleFactor, yScaleFactor);\n clipDy = scaleAndGetShift(ya, yScaleFactor2);\n }\n if (yScaleFactor2 > 1 && (ya.maxallowed !== void 0 && editY === (ya.range[0] < ya.range[1] ? \"n\" : \"s\") || ya.minallowed !== void 0 && editY === (ya.range[0] < ya.range[1] ? \"s\" : \"n\"))) {\n yScaleFactor2 = 1;\n clipDy = 0;\n }\n if (!xScaleFactor2 && !yScaleFactor2) {\n continue;\n }\n if (!xScaleFactor2) xScaleFactor2 = 1;\n if (!yScaleFactor2) yScaleFactor2 = 1;\n var plotDx = xa._offset - clipDx / xScaleFactor2;\n var plotDy = ya._offset - clipDy / yScaleFactor2;\n sp.clipRect.call(Drawing.setTranslate, clipDx, clipDy).call(Drawing.setScale, xScaleFactor2, yScaleFactor2);\n sp.plot.call(Drawing.setTranslate, plotDx, plotDy).call(Drawing.setScale, 1 / xScaleFactor2, 1 / yScaleFactor2);\n if (xScaleFactor2 !== sp.xScaleFactor || yScaleFactor2 !== sp.yScaleFactor) {\n Drawing.setPointGroupScale(sp.zoomScalePts, xScaleFactor2, yScaleFactor2);\n Drawing.setTextPointsScale(sp.zoomScaleTxt, xScaleFactor2, yScaleFactor2);\n }\n Drawing.hideOutsideRangePoints(sp.clipOnAxisFalseTraces, sp);\n sp.xScaleFactor = xScaleFactor2;\n sp.yScaleFactor = yScaleFactor2;\n }\n }\n }\n function getLinkedScaleFactor(ax, xScaleFactor, yScaleFactor) {\n if (ax.fixedrange) return 0;\n if (editX && links.xaHash[ax._id]) {\n return xScaleFactor;\n }\n if (editY && (links.isSubplotConstrained ? links.xaHash : links.yaHash)[ax._id]) {\n return yScaleFactor;\n }\n return 0;\n }\n function scaleAndGetShift(ax, scaleFactor) {\n if (scaleFactor) {\n ax.range = ax._r.slice();\n scaleZoom(ax, scaleFactor);\n return getShift(ax, scaleFactor);\n }\n return 0;\n }\n function getShift(ax, scaleFactor, from) {\n return ax._length * (1 - scaleFactor) * FROM_TL[from || ax.constraintoward || \"middle\"];\n }\n return dragger;\n }\n function makeDragger(plotinfo, nodeName, dragClass, cursor) {\n var dragger3 = Lib.ensureSingle(plotinfo.draglayer, nodeName, dragClass, function(s) {\n s.classed(\"drag\", true).style({ fill: \"transparent\", \"stroke-width\": 0 }).attr(\"data-subplot\", plotinfo.id);\n });\n dragger3.call(setCursor, cursor);\n return dragger3.node();\n }\n function makeRectDragger(plotinfo, dragClass, cursor, x, y, w, h) {\n var dragger = makeDragger(plotinfo, \"rect\", dragClass, cursor);\n d3.select(dragger).call(Drawing.setRect, x, y, w, h);\n return dragger;\n }\n function isDirectionActive(axList, activeVal) {\n for (var i = 0; i < axList.length; i++) {\n if (!axList[i].fixedrange) return activeVal;\n }\n return \"\";\n }\n function getEndText(ax, end) {\n var initialVal = ax.range[end];\n var diff = Math.abs(initialVal - ax.range[1 - end]);\n var dig;\n if (ax.type === \"date\") {\n return initialVal;\n } else if (ax.type === \"log\") {\n dig = Math.ceil(Math.max(0, -Math.log(diff) / Math.LN10)) + 3;\n return numberFormat(\".\" + dig + \"g\")(Math.pow(10, initialVal));\n } else {\n dig = Math.floor(Math.log(Math.abs(initialVal)) / Math.LN10) - Math.floor(Math.log(diff) / Math.LN10) + 4;\n return numberFormat(\".\" + String(dig) + \"g\")(initialVal);\n }\n }\n function zoomAxRanges(axList, r0Fraction, r1Fraction, updates, linkedAxes) {\n for (var i = 0; i < axList.length; i++) {\n var axi = axList[i];\n if (axi.fixedrange) continue;\n if (axi.rangebreaks) {\n var isY = axi._id.charAt(0) === \"y\";\n var r0F = isY ? 1 - r0Fraction : r0Fraction;\n var r1F = isY ? 1 - r1Fraction : r1Fraction;\n updates[axi._name + \".range[0]\"] = axi.l2r(axi.p2l(r0F * axi._length));\n updates[axi._name + \".range[1]\"] = axi.l2r(axi.p2l(r1F * axi._length));\n } else {\n var axRangeLinear0 = axi._rl[0];\n var axRangeLinearSpan = axi._rl[1] - axRangeLinear0;\n updates[axi._name + \".range[0]\"] = axi.l2r(axRangeLinear0 + axRangeLinearSpan * r0Fraction);\n updates[axi._name + \".range[1]\"] = axi.l2r(axRangeLinear0 + axRangeLinearSpan * r1Fraction);\n }\n }\n if (linkedAxes && linkedAxes.length) {\n var linkedR0Fraction = (r0Fraction + (1 - r1Fraction)) / 2;\n zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction, updates, []);\n }\n }\n function dragAxList(axList, pix) {\n for (var i = 0; i < axList.length; i++) {\n var axi = axList[i];\n if (!axi.fixedrange) {\n if (axi.rangebreaks) {\n var p0 = 0;\n var p1 = axi._length;\n var d0 = axi.p2l(p0 + pix) - axi.p2l(p0);\n var d1 = axi.p2l(p1 + pix) - axi.p2l(p1);\n var delta = (d0 + d1) / 2;\n axi.range = [\n axi.l2r(axi._rl[0] - delta),\n axi.l2r(axi._rl[1] - delta)\n ];\n } else {\n axi.range = [\n axi.l2r(axi._rl[0] - pix / axi._m),\n axi.l2r(axi._rl[1] - pix / axi._m)\n ];\n }\n if (axi.limitRange) axi.limitRange();\n }\n }\n }\n function dZoom(d) {\n return 1 - (d >= 0 ? Math.min(d, 0.9) : 1 / (1 / Math.max(d, -0.3) + 3.222));\n }\n function getDragCursor(nsew, dragmode, isMainDrag) {\n if (!nsew) return \"pointer\";\n if (nsew === \"nsew\") {\n if (isMainDrag) return \"\";\n if (dragmode === \"pan\") return \"move\";\n return \"crosshair\";\n }\n return nsew.toLowerCase() + \"-resize\";\n }\n function makeZoombox(zoomlayer, lum, xs, ys, path0) {\n return zoomlayer.append(\"path\").attr(\"class\", \"zoombox\").style({\n fill: lum > 0.2 ? \"rgba(0,0,0,0)\" : \"rgba(255,255,255,0)\",\n \"stroke-width\": 0\n }).attr(\"transform\", strTranslate(xs, ys)).attr(\"d\", path0 + \"Z\");\n }\n function makeCorners(zoomlayer, xs, ys) {\n return zoomlayer.append(\"path\").attr(\"class\", \"zoombox-corners\").style({\n fill: Color2.background,\n stroke: Color2.defaultLine,\n \"stroke-width\": 1,\n opacity: 0\n }).attr(\"transform\", strTranslate(xs, ys)).attr(\"d\", \"M0,0Z\");\n }\n function updateZoombox(zb, corners, box, path0, dimmed, lum) {\n zb.attr(\n \"d\",\n path0 + \"M\" + box.l + \",\" + box.t + \"v\" + box.h + \"h\" + box.w + \"v-\" + box.h + \"h-\" + box.w + \"Z\"\n );\n transitionZoombox(zb, corners, dimmed, lum);\n }\n function transitionZoombox(zb, corners, dimmed, lum) {\n if (!dimmed) {\n zb.transition().style(\"fill\", lum > 0.2 ? \"rgba(0,0,0,0.4)\" : \"rgba(255,255,255,0.3)\").duration(200);\n corners.transition().style(\"opacity\", 1).duration(200);\n }\n }\n function removeZoombox(gd) {\n d3.select(gd).selectAll(\".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners\").remove();\n }\n function showDoubleClickNotifier(gd) {\n if (SHOWZOOMOUTTIP && gd.data && gd._context.showTips) {\n Lib.notifier(Lib._(gd, \"Double-click to zoom back out\"), \"long\");\n SHOWZOOMOUTTIP = false;\n }\n }\n function xCorners(box, y0) {\n return \"M\" + (box.l - 0.5) + \",\" + (y0 - MINZOOM - 0.5) + \"h-3v\" + (2 * MINZOOM + 1) + \"h3ZM\" + (box.r + 0.5) + \",\" + (y0 - MINZOOM - 0.5) + \"h3v\" + (2 * MINZOOM + 1) + \"h-3Z\";\n }\n function yCorners(box, x0) {\n return \"M\" + (x0 - MINZOOM - 0.5) + \",\" + (box.t - 0.5) + \"v-3h\" + (2 * MINZOOM + 1) + \"v3ZM\" + (x0 - MINZOOM - 0.5) + \",\" + (box.b + 0.5) + \"v3h\" + (2 * MINZOOM + 1) + \"v-3Z\";\n }\n function xyCorners(box) {\n var clen = Math.floor(Math.min(box.b - box.t, box.r - box.l, MINZOOM) / 2);\n return \"M\" + (box.l - 3.5) + \",\" + (box.t - 0.5 + clen) + \"h3v\" + -clen + \"h\" + clen + \"v-3h-\" + (clen + 3) + \"ZM\" + (box.r + 3.5) + \",\" + (box.t - 0.5 + clen) + \"h-3v\" + -clen + \"h\" + -clen + \"v-3h\" + (clen + 3) + \"ZM\" + (box.r + 3.5) + \",\" + (box.b + 0.5 - clen) + \"h-3v\" + clen + \"h\" + -clen + \"v3h\" + (clen + 3) + \"ZM\" + (box.l - 3.5) + \",\" + (box.b + 0.5 - clen) + \"h3v\" + clen + \"h\" + clen + \"v3h-\" + (clen + 3) + \"Z\";\n }\n function calcLinks(gd, groups, xaHash, yaHash, exclude) {\n var isSubplotConstrained = false;\n var xLinks = {};\n var yLinks = {};\n var xID, yID, xLinkID, yLinkID;\n var xExclude = (exclude || {}).xaHash;\n var yExclude = (exclude || {}).yaHash;\n for (var i = 0; i < groups.length; i++) {\n var group = groups[i];\n for (xID in xaHash) {\n if (group[xID]) {\n for (xLinkID in group) {\n if (!(exclude && (xExclude[xLinkID] || yExclude[xLinkID])) && !(xLinkID.charAt(0) === \"x\" ? xaHash : yaHash)[xLinkID]) {\n xLinks[xLinkID] = xID;\n }\n }\n for (yID in yaHash) {\n if (!(exclude && (xExclude[yID] || yExclude[yID])) && group[yID]) {\n isSubplotConstrained = true;\n }\n }\n }\n }\n for (yID in yaHash) {\n if (group[yID]) {\n for (yLinkID in group) {\n if (!(exclude && (xExclude[yLinkID] || yExclude[yLinkID])) && !(yLinkID.charAt(0) === \"x\" ? xaHash : yaHash)[yLinkID]) {\n yLinks[yLinkID] = yID;\n }\n }\n }\n }\n }\n if (isSubplotConstrained) {\n Lib.extendFlat(xLinks, yLinks);\n yLinks = {};\n }\n var xaHashLinked = {};\n var xaxesLinked = [];\n for (xLinkID in xLinks) {\n var xa = getFromId(gd, xLinkID);\n xaxesLinked.push(xa);\n xaHashLinked[xa._id] = xa;\n }\n var yaHashLinked = {};\n var yaxesLinked = [];\n for (yLinkID in yLinks) {\n var ya = getFromId(gd, yLinkID);\n yaxesLinked.push(ya);\n yaHashLinked[ya._id] = ya;\n }\n return {\n xaHash: xaHashLinked,\n yaHash: yaHashLinked,\n xaxes: xaxesLinked,\n yaxes: yaxesLinked,\n xLinks,\n yLinks,\n isSubplotConstrained\n };\n }\n function attachWheelEventHandler(element, handler) {\n if (!supportsPassive) {\n if (element.onwheel !== void 0) element.onwheel = handler;\n else if (element.onmousewheel !== void 0) element.onmousewheel = handler;\n else if (!element.isAddedWheelEvent) {\n element.isAddedWheelEvent = true;\n element.addEventListener(\"wheel\", handler, { passive: false });\n }\n } else {\n var wheelEventName = element.onwheel !== void 0 ? \"wheel\" : \"mousewheel\";\n if (element._onwheel) {\n element.removeEventListener(wheelEventName, element._onwheel);\n }\n element._onwheel = handler;\n element.addEventListener(wheelEventName, handler, { passive: false });\n }\n }\n function hashValues(hash) {\n var out = [];\n for (var k in hash) out.push(hash[k]);\n return out;\n }\n module.exports = {\n makeDragBox,\n makeDragger,\n makeRectDragger,\n makeZoombox,\n makeCorners,\n updateZoombox,\n xyCorners,\n transitionZoombox,\n removeZoombox,\n showDoubleClickNotifier,\n attachWheelEventHandler\n };\n }\n });\n\n // src/plots/cartesian/graph_interact.js\n var require_graph_interact = __commonJS({\n \"src/plots/cartesian/graph_interact.js\"(exports) {\n \"use strict\";\n var d3 = require_d3();\n var Fx = require_fx();\n var dragElement = require_dragelement();\n var setCursor = require_setcursor();\n var makeDragBox = require_dragbox().makeDragBox;\n var DRAGGERSIZE = require_constants2().DRAGGERSIZE;\n exports.initInteractions = function initInteractions(gd) {\n var fullLayout = gd._fullLayout;\n if (gd._context.staticPlot) {\n d3.select(gd).selectAll(\".drag\").remove();\n return;\n }\n if (!fullLayout._has(\"cartesian\") && !fullLayout._has(\"splom\")) return;\n var subplots = Object.keys(fullLayout._plots || {}).sort(function(a, b) {\n if ((fullLayout._plots[a].mainplot && true) === (fullLayout._plots[b].mainplot && true)) {\n var aParts = a.split(\"y\");\n var bParts = b.split(\"y\");\n return aParts[0] === bParts[0] ? Number(aParts[1] || 1) - Number(bParts[1] || 1) : Number(aParts[0] || 1) - Number(bParts[0] || 1);\n }\n return fullLayout._plots[a].mainplot ? 1 : -1;\n });\n subplots.forEach(function(subplot) {\n var plotinfo = fullLayout._plots[subplot];\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n if (!plotinfo.mainplot) {\n var maindrag = makeDragBox(\n gd,\n plotinfo,\n xa._offset,\n ya._offset,\n xa._length,\n ya._length,\n \"ns\",\n \"ew\"\n );\n maindrag.onmousemove = function(evt) {\n gd._fullLayout._rehover = function() {\n if (gd._fullLayout._hoversubplot === subplot && gd._fullLayout._plots[subplot]) {\n Fx.hover(gd, evt, subplot);\n }\n };\n Fx.hover(gd, evt, subplot);\n gd._fullLayout._lasthover = maindrag;\n gd._fullLayout._hoversubplot = subplot;\n };\n maindrag.onmouseout = function(evt) {\n if (gd._dragging) return;\n gd._fullLayout._hoversubplot = null;\n dragElement.unhover(gd, evt);\n };\n if (gd._context.showAxisDragHandles) {\n makeDragBox(\n gd,\n plotinfo,\n xa._offset - DRAGGERSIZE,\n ya._offset - DRAGGERSIZE,\n DRAGGERSIZE,\n DRAGGERSIZE,\n \"n\",\n \"w\"\n );\n makeDragBox(\n gd,\n plotinfo,\n xa._offset + xa._length,\n ya._offset - DRAGGERSIZE,\n DRAGGERSIZE,\n DRAGGERSIZE,\n \"n\",\n \"e\"\n );\n makeDragBox(\n gd,\n plotinfo,\n xa._offset - DRAGGERSIZE,\n ya._offset + ya._length,\n DRAGGERSIZE,\n DRAGGERSIZE,\n \"s\",\n \"w\"\n );\n makeDragBox(\n gd,\n plotinfo,\n xa._offset + xa._length,\n ya._offset + ya._length,\n DRAGGERSIZE,\n DRAGGERSIZE,\n \"s\",\n \"e\"\n );\n }\n }\n if (gd._context.showAxisDragHandles) {\n if (subplot === xa._mainSubplot) {\n var y0 = xa._mainLinePosition;\n if (xa.side === \"top\") y0 -= DRAGGERSIZE;\n makeDragBox(\n gd,\n plotinfo,\n xa._offset + xa._length * 0.1,\n y0,\n xa._length * 0.8,\n DRAGGERSIZE,\n \"\",\n \"ew\"\n );\n makeDragBox(\n gd,\n plotinfo,\n xa._offset,\n y0,\n xa._length * 0.1,\n DRAGGERSIZE,\n \"\",\n \"w\"\n );\n makeDragBox(\n gd,\n plotinfo,\n xa._offset + xa._length * 0.9,\n y0,\n xa._length * 0.1,\n DRAGGERSIZE,\n \"\",\n \"e\"\n );\n }\n if (subplot === ya._mainSubplot) {\n var x0 = ya._mainLinePosition;\n if (ya.side !== \"right\") x0 -= DRAGGERSIZE;\n makeDragBox(\n gd,\n plotinfo,\n x0,\n ya._offset + ya._length * 0.1,\n DRAGGERSIZE,\n ya._length * 0.8,\n \"ns\",\n \"\"\n );\n makeDragBox(\n gd,\n plotinfo,\n x0,\n ya._offset + ya._length * 0.9,\n DRAGGERSIZE,\n ya._length * 0.1,\n \"s\",\n \"\"\n );\n makeDragBox(\n gd,\n plotinfo,\n x0,\n ya._offset,\n DRAGGERSIZE,\n ya._length * 0.1,\n \"n\",\n \"\"\n );\n }\n }\n });\n var hoverLayer = fullLayout._hoverlayer.node();\n hoverLayer.onmousemove = function(evt) {\n evt.target = gd._fullLayout._lasthover;\n Fx.hover(gd, evt, fullLayout._hoversubplot);\n };\n hoverLayer.onclick = function(evt) {\n evt.target = gd._fullLayout._lasthover;\n Fx.click(gd, evt);\n };\n hoverLayer.onmousedown = function(evt) {\n gd._fullLayout._lasthover.onmousedown(evt);\n };\n exports.updateFx(gd);\n };\n exports.updateFx = function(gd) {\n var fullLayout = gd._fullLayout;\n var cursor = fullLayout.dragmode === \"pan\" ? \"move\" : \"crosshair\";\n setCursor(fullLayout._draggers, cursor);\n };\n }\n });\n\n // src/plot_api/container_array_match.js\n var require_container_array_match = __commonJS({\n \"src/plot_api/container_array_match.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n module.exports = function containerArrayMatch(astr) {\n var rootContainers = Registry.layoutArrayContainers;\n var regexpContainers = Registry.layoutArrayRegexes;\n var rootPart = astr.split(\"[\")[0];\n var arrayStr;\n var match;\n for (var i = 0; i < regexpContainers.length; i++) {\n match = astr.match(regexpContainers[i]);\n if (match && match.index === 0) {\n arrayStr = match[0];\n break;\n }\n }\n if (!arrayStr) arrayStr = rootContainers[rootContainers.indexOf(rootPart)];\n if (!arrayStr) return false;\n var tail = astr.substr(arrayStr.length);\n if (!tail) return { array: arrayStr, index: \"\", property: \"\" };\n match = tail.match(/^\\[(0|[1-9][0-9]*)\\](\\.(.+))?$/);\n if (!match) return false;\n return { array: arrayStr, index: Number(match[1]), property: match[3] || \"\" };\n };\n }\n });\n\n // src/plot_api/manage_arrays.js\n var require_manage_arrays = __commonJS({\n \"src/plot_api/manage_arrays.js\"(exports) {\n \"use strict\";\n var isPlainObject = require_is_plain_object();\n var noop = require_noop();\n var Loggers = require_loggers();\n var sorterAsc = require_search().sorterAsc;\n var Registry = require_registry();\n exports.containerArrayMatch = require_container_array_match();\n var isAddVal = exports.isAddVal = function isAddVal2(val) {\n return val === \"add\" || isPlainObject(val);\n };\n var isRemoveVal = exports.isRemoveVal = function isRemoveVal2(val) {\n return val === null || val === \"remove\";\n };\n exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, edits, flags, _nestedProperty) {\n var componentType = np.astr;\n var supplyComponentDefaults = Registry.getComponentMethod(componentType, \"supplyLayoutDefaults\");\n var draw = Registry.getComponentMethod(componentType, \"draw\");\n var drawOne = Registry.getComponentMethod(componentType, \"drawOne\");\n var replotLater = flags.replot || flags.recalc || supplyComponentDefaults === noop || draw === noop;\n var layout = gd.layout;\n var fullLayout = gd._fullLayout;\n if (edits[\"\"]) {\n if (Object.keys(edits).length > 1) {\n Loggers.warn(\n \"Full array edits are incompatible with other edits\",\n componentType\n );\n }\n var fullVal = edits[\"\"][\"\"];\n if (isRemoveVal(fullVal)) np.set(null);\n else if (Array.isArray(fullVal)) np.set(fullVal);\n else {\n Loggers.warn(\"Unrecognized full array edit value\", componentType, fullVal);\n return true;\n }\n if (replotLater) return false;\n supplyComponentDefaults(layout, fullLayout);\n draw(gd);\n return true;\n }\n var componentNums = Object.keys(edits).map(Number).sort(sorterAsc);\n var componentArrayIn = np.get();\n var componentArray = componentArrayIn || [];\n var componentArrayFull = _nestedProperty(fullLayout, componentType).get();\n var deletes = [];\n var firstIndexChange = -1;\n var maxIndex = componentArray.length;\n var i;\n var j;\n var componentNum;\n var objEdits;\n var objKeys;\n var objVal;\n var adding, prefix;\n for (i = 0; i < componentNums.length; i++) {\n componentNum = componentNums[i];\n objEdits = edits[componentNum];\n objKeys = Object.keys(objEdits);\n objVal = objEdits[\"\"], adding = isAddVal(objVal);\n if (componentNum < 0 || componentNum > componentArray.length - (adding ? 0 : 1)) {\n Loggers.warn(\"index out of range\", componentType, componentNum);\n continue;\n }\n if (objVal !== void 0) {\n if (objKeys.length > 1) {\n Loggers.warn(\n \"Insertion & removal are incompatible with edits to the same index.\",\n componentType,\n componentNum\n );\n }\n if (isRemoveVal(objVal)) {\n deletes.push(componentNum);\n } else if (adding) {\n if (objVal === \"add\") objVal = {};\n componentArray.splice(componentNum, 0, objVal);\n if (componentArrayFull) componentArrayFull.splice(componentNum, 0, {});\n } else {\n Loggers.warn(\n \"Unrecognized full object edit value\",\n componentType,\n componentNum,\n objVal\n );\n }\n if (firstIndexChange === -1) firstIndexChange = componentNum;\n } else {\n for (j = 0; j < objKeys.length; j++) {\n prefix = componentType + \"[\" + componentNum + \"].\";\n _nestedProperty(componentArray[componentNum], objKeys[j], prefix).set(objEdits[objKeys[j]]);\n }\n }\n }\n for (i = deletes.length - 1; i >= 0; i--) {\n componentArray.splice(deletes[i], 1);\n if (componentArrayFull) componentArrayFull.splice(deletes[i], 1);\n }\n if (!componentArray.length) np.set(null);\n else if (!componentArrayIn) np.set(componentArray);\n if (replotLater) return false;\n supplyComponentDefaults(layout, fullLayout);\n if (drawOne !== noop) {\n var indicesToDraw;\n if (firstIndexChange === -1) {\n indicesToDraw = componentNums;\n } else {\n maxIndex = Math.max(componentArray.length, maxIndex);\n indicesToDraw = [];\n for (i = 0; i < componentNums.length; i++) {\n componentNum = componentNums[i];\n if (componentNum >= firstIndexChange) break;\n indicesToDraw.push(componentNum);\n }\n for (i = firstIndexChange; i < maxIndex; i++) {\n indicesToDraw.push(i);\n }\n }\n for (i = 0; i < indicesToDraw.length; i++) {\n drawOne(gd, indicesToDraw[i]);\n }\n } else draw(gd);\n return true;\n };\n }\n });\n\n // src/plot_api/helpers.js\n var require_helpers9 = __commonJS({\n \"src/plot_api/helpers.js\"(exports) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var m4FromQuat = require_fromQuat();\n var Registry = require_registry();\n var Lib = require_lib();\n var Plots = require_plots();\n var AxisIds = require_axis_ids();\n var Color2 = require_color();\n var cleanId = AxisIds.cleanId;\n var getFromTrace = AxisIds.getFromTrace;\n var traceIs = Registry.traceIs;\n exports.clearPromiseQueue = function(gd) {\n if (Array.isArray(gd._promises) && gd._promises.length > 0) {\n Lib.log(\"Clearing previous rejected promises from queue.\");\n }\n gd._promises = [];\n };\n exports.cleanLayout = function(layout) {\n var i, j;\n if (!layout) layout = {};\n if (layout.xaxis1) {\n if (!layout.xaxis) layout.xaxis = layout.xaxis1;\n delete layout.xaxis1;\n }\n if (layout.yaxis1) {\n if (!layout.yaxis) layout.yaxis = layout.yaxis1;\n delete layout.yaxis1;\n }\n if (layout.scene1) {\n if (!layout.scene) layout.scene = layout.scene1;\n delete layout.scene1;\n }\n var axisAttrRegex = (Plots.subplotsRegistry.cartesian || {}).attrRegex;\n var polarAttrRegex = (Plots.subplotsRegistry.polar || {}).attrRegex;\n var ternaryAttrRegex = (Plots.subplotsRegistry.ternary || {}).attrRegex;\n var sceneAttrRegex = (Plots.subplotsRegistry.gl3d || {}).attrRegex;\n var keys = Object.keys(layout);\n for (i = 0; i < keys.length; i++) {\n var key = keys[i];\n if (axisAttrRegex && axisAttrRegex.test(key)) {\n var ax = layout[key];\n if (ax.anchor && ax.anchor !== \"free\") {\n ax.anchor = cleanId(ax.anchor);\n }\n if (ax.overlaying) ax.overlaying = cleanId(ax.overlaying);\n if (!ax.type) {\n if (ax.isdate) ax.type = \"date\";\n else if (ax.islog) ax.type = \"log\";\n else if (ax.isdate === false && ax.islog === false) ax.type = \"linear\";\n }\n if (ax.autorange === \"withzero\" || ax.autorange === \"tozero\") {\n ax.autorange = true;\n ax.rangemode = \"tozero\";\n }\n if (ax.insiderange) delete ax.range;\n delete ax.islog;\n delete ax.isdate;\n delete ax.categories;\n if (emptyContainer(ax, \"domain\")) delete ax.domain;\n }\n }\n var annotationsLen = Array.isArray(layout.annotations) ? layout.annotations.length : 0;\n for (i = 0; i < annotationsLen; i++) {\n var ann = layout.annotations[i];\n if (!Lib.isPlainObject(ann)) continue;\n cleanAxRef(ann, \"xref\");\n cleanAxRef(ann, \"yref\");\n }\n var shapesLen = Array.isArray(layout.shapes) ? layout.shapes.length : 0;\n for (i = 0; i < shapesLen; i++) {\n var shape = layout.shapes[i];\n if (!Lib.isPlainObject(shape)) continue;\n cleanAxRef(shape, \"xref\");\n cleanAxRef(shape, \"yref\");\n }\n var imagesLen = Array.isArray(layout.images) ? layout.images.length : 0;\n for (i = 0; i < imagesLen; i++) {\n var image = layout.images[i];\n if (!Lib.isPlainObject(image)) continue;\n cleanAxRef(image, \"xref\");\n cleanAxRef(image, \"yref\");\n }\n var legend = layout.legend;\n if (legend) {\n if (legend.x > 3) {\n legend.x = 1.02;\n legend.xanchor = \"left\";\n } else if (legend.x < -2) {\n legend.x = -0.02;\n legend.xanchor = \"right\";\n }\n if (legend.y > 3) {\n legend.y = 1.02;\n legend.yanchor = \"bottom\";\n } else if (legend.y < -2) {\n legend.y = -0.02;\n legend.yanchor = \"top\";\n }\n }\n if (layout.dragmode === \"rotate\") layout.dragmode = \"orbit\";\n Color2.clean(layout);\n if (layout.template && layout.template.layout) {\n exports.cleanLayout(layout.template.layout);\n }\n return layout;\n };\n function cleanAxRef(container, attr) {\n var valIn = container[attr];\n var axLetter = attr.charAt(0);\n if (valIn && valIn !== \"paper\") {\n container[attr] = cleanId(valIn, axLetter, true);\n }\n }\n exports.cleanData = function(data) {\n for (var tracei = 0; tracei < data.length; tracei++) {\n var trace = data[tracei];\n var i;\n if (trace.type === \"histogramy\" && \"xbins\" in trace && !(\"ybins\" in trace)) {\n trace.ybins = trace.xbins;\n delete trace.xbins;\n }\n if (trace.type === \"histogramy\") exports.swapXYData(trace);\n if (trace.type === \"histogramx\" || trace.type === \"histogramy\") {\n trace.type = \"histogram\";\n }\n if (\"scl\" in trace && !(\"colorscale\" in trace)) {\n trace.colorscale = trace.scl;\n delete trace.scl;\n }\n if (\"reversescl\" in trace && !(\"reversescale\" in trace)) {\n trace.reversescale = trace.reversescl;\n delete trace.reversescl;\n }\n if (trace.xaxis) trace.xaxis = cleanId(trace.xaxis, \"x\");\n if (trace.yaxis) trace.yaxis = cleanId(trace.yaxis, \"y\");\n if (traceIs(trace, \"gl3d\") && trace.scene) {\n trace.scene = Plots.subplotsRegistry.gl3d.cleanId(trace.scene);\n }\n if (!traceIs(trace, \"pie-like\") && !traceIs(trace, \"bar-like\")) {\n if (Array.isArray(trace.textposition)) {\n for (i = 0; i < trace.textposition.length; i++) {\n trace.textposition[i] = cleanTextPosition(trace.textposition[i]);\n }\n } else if (trace.textposition) {\n trace.textposition = cleanTextPosition(trace.textposition);\n }\n }\n var _module = Registry.getModule(trace);\n if (_module && _module.colorbar) {\n var containerName = _module.colorbar.container;\n var container = containerName ? trace[containerName] : trace;\n if (container && container.colorscale) {\n if (container.colorscale === \"YIGnBu\") container.colorscale = \"YlGnBu\";\n if (container.colorscale === \"YIOrRd\") container.colorscale = \"YlOrRd\";\n }\n }\n if (trace.type === \"surface\" && Lib.isPlainObject(trace.contours)) {\n var dims = [\"x\", \"y\", \"z\"];\n for (i = 0; i < dims.length; i++) {\n var opts = trace.contours[dims[i]];\n if (!Lib.isPlainObject(opts)) continue;\n if (opts.highlightColor) {\n opts.highlightcolor = opts.highlightColor;\n delete opts.highlightColor;\n }\n if (opts.highlightWidth) {\n opts.highlightwidth = opts.highlightWidth;\n delete opts.highlightWidth;\n }\n }\n }\n if (trace.type === \"candlestick\" || trace.type === \"ohlc\") {\n var increasingShowlegend = (trace.increasing || {}).showlegend !== false;\n var decreasingShowlegend = (trace.decreasing || {}).showlegend !== false;\n var increasingName = cleanFinanceDir(trace.increasing);\n var decreasingName = cleanFinanceDir(trace.decreasing);\n if (increasingName !== false && decreasingName !== false) {\n var newName = commonPrefix(\n increasingName,\n decreasingName,\n increasingShowlegend,\n decreasingShowlegend\n );\n if (newName) trace.name = newName;\n } else if ((increasingName || decreasingName) && !trace.name) {\n trace.name = increasingName || decreasingName;\n }\n }\n if (emptyContainer(trace, \"line\")) delete trace.line;\n if (\"marker\" in trace) {\n if (emptyContainer(trace.marker, \"line\")) delete trace.marker.line;\n if (emptyContainer(trace, \"marker\")) delete trace.marker;\n }\n Color2.clean(trace);\n if (trace.autobinx) {\n delete trace.autobinx;\n delete trace.xbins;\n }\n if (trace.autobiny) {\n delete trace.autobiny;\n delete trace.ybins;\n }\n }\n };\n function cleanFinanceDir(dirContainer) {\n if (!Lib.isPlainObject(dirContainer)) return false;\n var dirName = dirContainer.name;\n delete dirContainer.name;\n delete dirContainer.showlegend;\n return (typeof dirName === \"string\" || typeof dirName === \"number\") && String(dirName);\n }\n function commonPrefix(name1, name2, show1, show2) {\n if (show1 && !show2) return name1;\n if (show2 && !show1) return name2;\n if (!name1.trim()) return name2;\n if (!name2.trim()) return name1;\n var minLen = Math.min(name1.length, name2.length);\n var i;\n for (i = 0; i < minLen; i++) {\n if (name1.charAt(i) !== name2.charAt(i)) break;\n }\n var out = name1.substr(0, i);\n return out.trim();\n }\n function cleanTextPosition(textposition) {\n var posY = \"middle\";\n var posX = \"center\";\n if (typeof textposition === \"string\") {\n if (textposition.indexOf(\"top\") !== -1) posY = \"top\";\n else if (textposition.indexOf(\"bottom\") !== -1) posY = \"bottom\";\n if (textposition.indexOf(\"left\") !== -1) posX = \"left\";\n else if (textposition.indexOf(\"right\") !== -1) posX = \"right\";\n }\n return posY + \" \" + posX;\n }\n function emptyContainer(outer, innerStr) {\n return innerStr in outer && typeof outer[innerStr] === \"object\" && Object.keys(outer[innerStr]).length === 0;\n }\n exports.swapXYData = function(trace) {\n var i;\n Lib.swapAttrs(trace, [\"?\", \"?0\", \"d?\", \"?bins\", \"nbins?\", \"autobin?\", \"?src\", \"error_?\"]);\n if (Array.isArray(trace.z) && Array.isArray(trace.z[0])) {\n if (trace.transpose) delete trace.transpose;\n else trace.transpose = true;\n }\n if (trace.error_x && trace.error_y) {\n var errorY = trace.error_y;\n var copyYstyle = \"copy_ystyle\" in errorY ? errorY.copy_ystyle : !(errorY.color || errorY.thickness || errorY.width);\n Lib.swapAttrs(trace, [\"error_?.copy_ystyle\"]);\n if (copyYstyle) {\n Lib.swapAttrs(trace, [\"error_?.color\", \"error_?.thickness\", \"error_?.width\"]);\n }\n }\n if (typeof trace.hoverinfo === \"string\") {\n var hoverInfoParts = trace.hoverinfo.split(\"+\");\n for (i = 0; i < hoverInfoParts.length; i++) {\n if (hoverInfoParts[i] === \"x\") hoverInfoParts[i] = \"y\";\n else if (hoverInfoParts[i] === \"y\") hoverInfoParts[i] = \"x\";\n }\n trace.hoverinfo = hoverInfoParts.join(\"+\");\n }\n };\n exports.coerceTraceIndices = function(gd, traceIndices) {\n if (isNumeric(traceIndices)) {\n return [traceIndices];\n } else if (!Array.isArray(traceIndices) || !traceIndices.length) {\n return gd.data.map(function(_, i2) {\n return i2;\n });\n } else if (Array.isArray(traceIndices)) {\n var traceIndicesOut = [];\n for (var i = 0; i < traceIndices.length; i++) {\n if (Lib.isIndex(traceIndices[i], gd.data.length)) {\n traceIndicesOut.push(traceIndices[i]);\n } else {\n Lib.warn(\"trace index (\", traceIndices[i], \") is not a number or is out of bounds\");\n }\n }\n return traceIndicesOut;\n }\n return traceIndices;\n };\n exports.manageArrayContainers = function(np, newVal, undoit) {\n var obj = np.obj;\n var parts = np.parts;\n var pLength = parts.length;\n var pLast = parts[pLength - 1];\n var pLastIsNumber = isNumeric(pLast);\n if (pLastIsNumber && newVal === null) {\n var contPath = parts.slice(0, pLength - 1).join(\".\");\n var cont = Lib.nestedProperty(obj, contPath).get();\n cont.splice(pLast, 1);\n } else if (pLastIsNumber && np.get() === void 0) {\n if (np.get() === void 0) undoit[np.astr] = null;\n np.set(newVal);\n } else {\n np.set(newVal);\n }\n };\n var ATTR_TAIL_RE = /(\\.[^\\[\\]\\.]+|\\[[^\\[\\]\\.]+\\])$/;\n function getParent(attr) {\n var tail = attr.search(ATTR_TAIL_RE);\n if (tail > 0) return attr.substr(0, tail);\n }\n exports.hasParent = function(aobj, attr) {\n var attrParent = getParent(attr);\n while (attrParent) {\n if (attrParent in aobj) return true;\n attrParent = getParent(attrParent);\n }\n return false;\n };\n var axLetters = [\"x\", \"y\", \"z\"];\n exports.clearAxisTypes = function(gd, traces, layoutUpdate) {\n for (var i = 0; i < traces.length; i++) {\n var trace = gd._fullData[i];\n for (var j = 0; j < 3; j++) {\n var ax = getFromTrace(gd, trace, axLetters[j]);\n if (ax && ax.type !== \"log\") {\n var axAttr = ax._name;\n var sceneName = ax._id.substr(1);\n if (sceneName.substr(0, 5) === \"scene\") {\n if (layoutUpdate[sceneName] !== void 0) continue;\n axAttr = sceneName + \".\" + axAttr;\n }\n var typeAttr = axAttr + \".type\";\n if (layoutUpdate[axAttr] === void 0 && layoutUpdate[typeAttr] === void 0) {\n Lib.nestedProperty(gd.layout, typeAttr).set(null);\n }\n }\n }\n }\n };\n }\n });\n\n // src/plot_api/plot_api.js\n var require_plot_api = __commonJS({\n \"src/plot_api/plot_api.js\"(exports) {\n \"use strict\";\n var d3 = require_d3();\n var isNumeric = require_fast_isnumeric();\n var hasHover = require_has_hover();\n var Lib = require_lib();\n var nestedProperty = Lib.nestedProperty;\n var Events = require_events2();\n var Queue = require_queue();\n var Registry = require_registry();\n var PlotSchema = require_plot_schema();\n var Plots = require_plots();\n var Axes = require_axes();\n var handleRangeDefaults = require_range_defaults();\n var cartesianLayoutAttributes = require_layout_attributes4();\n var Drawing = require_drawing();\n var Color2 = require_color();\n var initInteractions = require_graph_interact().initInteractions;\n var xmlnsNamespaces = require_xmlns_namespaces();\n var clearOutline = require_selections().clearOutline;\n var dfltConfig = require_plot_config().dfltConfig;\n var manageArrays = require_manage_arrays();\n var helpers = require_helpers9();\n var subroutines = require_subroutines();\n var editTypes = require_edit_types();\n var AX_NAME_PATTERN = require_constants2().AX_NAME_PATTERN;\n var numericNameWarningCount = 0;\n var numericNameWarningCountLimit = 5;\n function _doPlot(gd, data, layout, config) {\n var frames;\n gd = Lib.getGraphDiv(gd);\n Events.init(gd);\n if (Lib.isPlainObject(data)) {\n var obj = data;\n data = obj.data;\n layout = obj.layout;\n config = obj.config;\n frames = obj.frames;\n }\n var okToPlot = Events.triggerHandler(gd, \"plotly_beforeplot\", [data, layout, config]);\n if (okToPlot === false) return Promise.reject();\n if (!data && !layout && !Lib.isPlotDiv(gd)) {\n Lib.warn(\"Calling _doPlot as if redrawing but this container doesn't yet have a plot.\", gd);\n }\n function addFrames2() {\n if (frames) {\n return exports.addFrames(gd, frames);\n }\n }\n setPlotContext(gd, config);\n if (!layout) layout = {};\n d3.select(gd).classed(\"js-plotly-plot\", true);\n Drawing.makeTester();\n if (!Array.isArray(gd._promises)) gd._promises = [];\n var graphWasEmpty = (gd.data || []).length === 0 && Array.isArray(data);\n if (Array.isArray(data)) {\n helpers.cleanData(data);\n if (graphWasEmpty) gd.data = data;\n else gd.data.push.apply(gd.data, data);\n gd.empty = false;\n }\n if (!gd.layout || graphWasEmpty) {\n gd.layout = helpers.cleanLayout(layout);\n }\n Plots.supplyDefaults(gd);\n var fullLayout = gd._fullLayout;\n var hasCartesian = fullLayout._has(\"cartesian\");\n fullLayout._replotting = true;\n if (graphWasEmpty || fullLayout._shouldCreateBgLayer) {\n makePlotFramework(gd);\n if (fullLayout._shouldCreateBgLayer) {\n delete fullLayout._shouldCreateBgLayer;\n }\n }\n Drawing.initGradients(gd);\n Drawing.initPatterns(gd);\n if (graphWasEmpty) Axes.saveShowSpikeInitial(gd);\n var recalc = !gd.calcdata || gd.calcdata.length !== (gd._fullData || []).length;\n if (recalc) Plots.doCalcdata(gd);\n for (var i = 0; i < gd.calcdata.length; i++) {\n gd.calcdata[i][0].trace = gd._fullData[i];\n }\n if (gd._context.responsive) {\n if (!gd._responsiveChartHandler) {\n gd._responsiveChartHandler = function() {\n if (!Lib.isHidden(gd)) Plots.resize(gd);\n };\n window.addEventListener(\"resize\", gd._responsiveChartHandler);\n }\n } else {\n Lib.clearResponsive(gd);\n }\n var oldMargins = Lib.extendFlat({}, fullLayout._size);\n var drawFrameworkCalls = 0;\n function drawFramework() {\n var basePlotModules = fullLayout._basePlotModules;\n for (var i2 = 0; i2 < basePlotModules.length; i2++) {\n if (basePlotModules[i2].drawFramework) {\n basePlotModules[i2].drawFramework(gd);\n }\n }\n if (!fullLayout._glcanvas && fullLayout._has(\"gl\")) {\n fullLayout._glcanvas = fullLayout._glcontainer.selectAll(\".gl-canvas\").data([{\n key: \"contextLayer\",\n context: true,\n pick: false\n }, {\n key: \"focusLayer\",\n context: false,\n pick: false\n }, {\n key: \"pickLayer\",\n context: false,\n pick: true\n }], function(d) {\n return d.key;\n });\n fullLayout._glcanvas.enter().append(\"canvas\").attr(\"class\", function(d) {\n return \"gl-canvas gl-canvas-\" + d.key.replace(\"Layer\", \"\");\n }).style({\n position: \"absolute\",\n top: 0,\n left: 0,\n overflow: \"visible\",\n \"pointer-events\": \"none\"\n });\n }\n var plotGlPixelRatio = gd._context.plotGlPixelRatio;\n if (fullLayout._glcanvas) {\n fullLayout._glcanvas.attr(\"width\", fullLayout.width * plotGlPixelRatio).attr(\"height\", fullLayout.height * plotGlPixelRatio).style(\"width\", fullLayout.width + \"px\").style(\"height\", fullLayout.height + \"px\");\n var regl = fullLayout._glcanvas.data()[0].regl;\n if (regl) {\n if (Math.floor(fullLayout.width * plotGlPixelRatio) !== regl._gl.drawingBufferWidth || Math.floor(fullLayout.height * plotGlPixelRatio) !== regl._gl.drawingBufferHeight) {\n var msg = \"WebGL context buffer and canvas dimensions do not match due to browser/WebGL bug.\";\n if (drawFrameworkCalls) {\n Lib.error(msg);\n } else {\n Lib.log(msg + \" Clearing graph and plotting again.\");\n Plots.cleanPlot([], {}, gd._fullData, fullLayout);\n Plots.supplyDefaults(gd);\n fullLayout = gd._fullLayout;\n Plots.doCalcdata(gd);\n drawFrameworkCalls++;\n return drawFramework();\n }\n }\n }\n }\n if (fullLayout.modebar.orientation === \"h\") {\n fullLayout._modebardiv.style(\"height\", null).style(\"width\", \"100%\");\n } else {\n fullLayout._modebardiv.style(\"width\", null).style(\"height\", fullLayout.height + \"px\");\n }\n return Plots.previousPromises(gd);\n }\n function marginPushers() {\n Plots.clearAutoMarginIds(gd);\n subroutines.drawMarginPushers(gd);\n Axes.allowAutoMargin(gd);\n if (gd._fullLayout.title.text && gd._fullLayout.title.automargin) Plots.allowAutoMargin(gd, \"title.automargin\");\n if (fullLayout._has(\"pie\")) {\n var fullData = gd._fullData;\n for (var i2 = 0; i2 < fullData.length; i2++) {\n var trace = fullData[i2];\n if (trace.type === \"pie\" && trace.automargin) {\n Plots.allowAutoMargin(gd, \"pie.\" + trace.uid + \".automargin\");\n }\n }\n }\n Plots.doAutoMargin(gd);\n return Plots.previousPromises(gd);\n }\n function marginPushersAgain() {\n if (!Plots.didMarginChange(oldMargins, fullLayout._size)) return;\n return Lib.syncOrAsync([\n marginPushers,\n subroutines.layoutStyles\n ], gd);\n }\n function positionAndAutorange() {\n if (!recalc) {\n doAutoRangeAndConstraints();\n return;\n }\n return Lib.syncOrAsync([\n Registry.getComponentMethod(\"shapes\", \"calcAutorange\"),\n Registry.getComponentMethod(\"annotations\", \"calcAutorange\"),\n doAutoRangeAndConstraints\n ], gd);\n }\n function doAutoRangeAndConstraints() {\n if (gd._transitioning) return;\n subroutines.doAutoRangeAndConstraints(gd);\n if (graphWasEmpty) Axes.saveRangeInitial(gd);\n Registry.getComponentMethod(\"rangeslider\", \"calcAutorange\")(gd);\n }\n function drawAxes() {\n return Axes.draw(gd, graphWasEmpty ? \"\" : \"redraw\");\n }\n var seq = [\n Plots.previousPromises,\n addFrames2,\n drawFramework,\n marginPushers,\n marginPushersAgain\n ];\n if (hasCartesian) seq.push(positionAndAutorange);\n seq.push(subroutines.layoutStyles);\n if (hasCartesian) {\n seq.push(\n drawAxes,\n function insideTickLabelsAutorange(gd2) {\n var insideTickLabelsUpdaterange = gd2._fullLayout._insideTickLabelsUpdaterange;\n if (insideTickLabelsUpdaterange) {\n gd2._fullLayout._insideTickLabelsUpdaterange = void 0;\n return relayout(gd2, insideTickLabelsUpdaterange).then(function() {\n Axes.saveRangeInitial(gd2, true);\n });\n }\n }\n );\n }\n seq.push(\n subroutines.drawData,\n subroutines.finalDraw,\n initInteractions,\n Plots.addLinks,\n Plots.rehover,\n Plots.redrag,\n Plots.reselect,\n // TODO: doAutoMargin is only needed here for axis automargin, which\n // happens outside of marginPushers where all the other automargins are\n // calculated. Would be much better to separate margin calculations from\n // component drawing - see https://github.com/plotly/plotly.js/issues/2704\n Plots.doAutoMargin,\n Plots.previousPromises\n );\n var plotDone = Lib.syncOrAsync(seq, gd);\n if (!plotDone || !plotDone.then) plotDone = Promise.resolve();\n return plotDone.then(function() {\n emitAfterPlot(gd);\n return gd;\n });\n }\n function emitAfterPlot(gd) {\n var fullLayout = gd._fullLayout;\n if (fullLayout._redrawFromAutoMarginCount) {\n fullLayout._redrawFromAutoMarginCount--;\n } else {\n gd.emit(\"plotly_afterplot\");\n }\n }\n function setPlotConfig(obj) {\n return Lib.extendFlat(dfltConfig, obj);\n }\n function setBackground(gd, bgColor) {\n try {\n gd._fullLayout._paper.style(\"background\", bgColor);\n } catch (e) {\n Lib.error(e);\n }\n }\n function opaqueSetBackground(gd, bgColor) {\n var blend = Color2.combine(bgColor, \"white\");\n setBackground(gd, blend);\n }\n function setPlotContext(gd, config) {\n if (!gd._context) {\n gd._context = Lib.extendDeep({}, dfltConfig);\n var base = d3.select(\"base\");\n gd._context._baseUrl = base.size() && base.attr(\"href\") ? window.location.href.split(\"#\")[0] : \"\";\n }\n var context = gd._context;\n var i, keys, key;\n if (config) {\n keys = Object.keys(config);\n for (i = 0; i < keys.length; i++) {\n key = keys[i];\n if (key === \"editable\" || key === \"edits\") continue;\n if (key in context) {\n if (key === \"setBackground\" && config[key] === \"opaque\") {\n context[key] = opaqueSetBackground;\n } else {\n context[key] = config[key];\n }\n }\n }\n var editable = config.editable;\n if (editable !== void 0) {\n context.editable = editable;\n keys = Object.keys(context.edits);\n for (i = 0; i < keys.length; i++) {\n context.edits[keys[i]] = editable;\n }\n }\n if (config.edits) {\n keys = Object.keys(config.edits);\n for (i = 0; i < keys.length; i++) {\n key = keys[i];\n if (key in context.edits) {\n context.edits[key] = config.edits[key];\n }\n }\n }\n context._exportedPlot = config._exportedPlot;\n }\n if (context.staticPlot) {\n context.editable = false;\n context.edits = {};\n context.autosizable = false;\n context.scrollZoom = false;\n context.doubleClick = false;\n context.showTips = false;\n context.showLink = false;\n context.displayModeBar = false;\n }\n if (context.displayModeBar === \"hover\" && !hasHover) {\n context.displayModeBar = true;\n }\n if (context.setBackground === \"transparent\" || typeof context.setBackground !== \"function\") {\n context.setBackground = setBackground;\n }\n context._hasZeroHeight = context._hasZeroHeight || gd.clientHeight === 0;\n context._hasZeroWidth = context._hasZeroWidth || gd.clientWidth === 0;\n var szIn = context.scrollZoom;\n var szOut = context._scrollZoom = {};\n if (szIn === true) {\n szOut.cartesian = 1;\n szOut.gl3d = 1;\n szOut.geo = 1;\n szOut.mapbox = 1;\n szOut.map = 1;\n } else if (typeof szIn === \"string\") {\n var parts = szIn.split(\"+\");\n for (i = 0; i < parts.length; i++) {\n szOut[parts[i]] = 1;\n }\n } else if (szIn !== false) {\n szOut.gl3d = 1;\n szOut.geo = 1;\n szOut.mapbox = 1;\n szOut.map = 1;\n }\n }\n function redraw(gd) {\n gd = Lib.getGraphDiv(gd);\n if (!Lib.isPlotDiv(gd)) {\n throw new Error(\"This element is not a Plotly plot: \" + gd);\n }\n helpers.cleanData(gd.data);\n helpers.cleanLayout(gd.layout);\n gd.calcdata = void 0;\n return exports._doPlot(gd).then(function() {\n gd.emit(\"plotly_redraw\");\n return gd;\n });\n }\n function newPlot(gd, data, layout, config) {\n gd = Lib.getGraphDiv(gd);\n Plots.cleanPlot([], {}, gd._fullData || [], gd._fullLayout || {});\n Plots.purge(gd);\n return exports._doPlot(gd, data, layout, config);\n }\n function positivifyIndices(indices, maxIndex) {\n var parentLength = maxIndex + 1;\n var positiveIndices = [];\n var i;\n var index;\n for (i = 0; i < indices.length; i++) {\n index = indices[i];\n if (index < 0) {\n positiveIndices.push(parentLength + index);\n } else {\n positiveIndices.push(index);\n }\n }\n return positiveIndices;\n }\n function assertIndexArray(gd, indices, arrayName) {\n var i, index;\n for (i = 0; i < indices.length; i++) {\n index = indices[i];\n if (index !== parseInt(index, 10)) {\n throw new Error(\"all values in \" + arrayName + \" must be integers\");\n }\n if (index >= gd.data.length || index < -gd.data.length) {\n throw new Error(arrayName + \" must be valid indices for gd.data.\");\n }\n if (indices.indexOf(index, i + 1) > -1 || index >= 0 && indices.indexOf(-gd.data.length + index) > -1 || index < 0 && indices.indexOf(gd.data.length + index) > -1) {\n throw new Error(\"each index in \" + arrayName + \" must be unique.\");\n }\n }\n }\n function checkMoveTracesArgs(gd, currentIndices, newIndices) {\n if (!Array.isArray(gd.data)) {\n throw new Error(\"gd.data must be an array.\");\n }\n if (typeof currentIndices === \"undefined\") {\n throw new Error(\"currentIndices is a required argument.\");\n } else if (!Array.isArray(currentIndices)) {\n currentIndices = [currentIndices];\n }\n assertIndexArray(gd, currentIndices, \"currentIndices\");\n if (typeof newIndices !== \"undefined\" && !Array.isArray(newIndices)) {\n newIndices = [newIndices];\n }\n if (typeof newIndices !== \"undefined\") {\n assertIndexArray(gd, newIndices, \"newIndices\");\n }\n if (typeof newIndices !== \"undefined\" && currentIndices.length !== newIndices.length) {\n throw new Error(\"current and new indices must be of equal length.\");\n }\n }\n function checkAddTracesArgs(gd, traces, newIndices) {\n var i, value;\n if (!Array.isArray(gd.data)) {\n throw new Error(\"gd.data must be an array.\");\n }\n if (typeof traces === \"undefined\") {\n throw new Error(\"traces must be defined.\");\n }\n if (!Array.isArray(traces)) {\n traces = [traces];\n }\n for (i = 0; i < traces.length; i++) {\n value = traces[i];\n if (typeof value !== \"object\" || (Array.isArray(value) || value === null)) {\n throw new Error(\"all values in traces array must be non-array objects\");\n }\n }\n if (typeof newIndices !== \"undefined\" && !Array.isArray(newIndices)) {\n newIndices = [newIndices];\n }\n if (typeof newIndices !== \"undefined\" && newIndices.length !== traces.length) {\n throw new Error(\n \"if indices is specified, traces.length must equal indices.length\"\n );\n }\n }\n function assertExtendTracesArgs(gd, update2, indices, maxPoints) {\n var maxPointsIsObject = Lib.isPlainObject(maxPoints);\n if (!Array.isArray(gd.data)) {\n throw new Error(\"gd.data must be an array\");\n }\n if (!Lib.isPlainObject(update2)) {\n throw new Error(\"update must be a key:value object\");\n }\n if (typeof indices === \"undefined\") {\n throw new Error(\"indices must be an integer or array of integers\");\n }\n assertIndexArray(gd, indices, \"indices\");\n for (var key in update2) {\n if (!Array.isArray(update2[key]) || update2[key].length !== indices.length) {\n throw new Error(\"attribute \" + key + \" must be an array of length equal to indices array length\");\n }\n if (maxPointsIsObject && (!(key in maxPoints) || !Array.isArray(maxPoints[key]) || maxPoints[key].length !== update2[key].length)) {\n throw new Error(\"when maxPoints is set as a key:value object it must contain a 1:1 corrispondence with the keys and number of traces in the update object\");\n }\n }\n }\n function getExtendProperties(gd, update2, indices, maxPoints) {\n var maxPointsIsObject = Lib.isPlainObject(maxPoints);\n var updateProps = [];\n var trace, target, prop, insert, maxp;\n if (!Array.isArray(indices)) indices = [indices];\n indices = positivifyIndices(indices, gd.data.length - 1);\n for (var key in update2) {\n for (var j = 0; j < indices.length; j++) {\n trace = gd.data[indices[j]];\n prop = nestedProperty(trace, key);\n target = prop.get();\n insert = update2[key][j];\n if (!Lib.isArrayOrTypedArray(insert)) {\n throw new Error(\"attribute: \" + key + \" index: \" + j + \" must be an array\");\n }\n if (!Lib.isArrayOrTypedArray(target)) {\n throw new Error(\"cannot extend missing or non-array attribute: \" + key);\n }\n if (target.constructor !== insert.constructor) {\n throw new Error(\"cannot extend array with an array of a different type: \" + key);\n }\n maxp = maxPointsIsObject ? maxPoints[key][j] : maxPoints;\n if (!isNumeric(maxp)) maxp = -1;\n updateProps.push({\n prop,\n target,\n insert,\n maxp: Math.floor(maxp)\n });\n }\n }\n return updateProps;\n }\n function spliceTraces(gd, update2, indices, maxPoints, updateArray) {\n assertExtendTracesArgs(gd, update2, indices, maxPoints);\n var updateProps = getExtendProperties(gd, update2, indices, maxPoints);\n var undoUpdate = {};\n var undoPoints = {};\n for (var i = 0; i < updateProps.length; i++) {\n var prop = updateProps[i].prop;\n var maxp = updateProps[i].maxp;\n var out = updateArray(updateProps[i].target, updateProps[i].insert, maxp);\n prop.set(out[0]);\n if (!Array.isArray(undoUpdate[prop.astr])) undoUpdate[prop.astr] = [];\n undoUpdate[prop.astr].push(out[1]);\n if (!Array.isArray(undoPoints[prop.astr])) undoPoints[prop.astr] = [];\n undoPoints[prop.astr].push(updateProps[i].target.length);\n }\n return { update: undoUpdate, maxPoints: undoPoints };\n }\n function concatTypedArray(arr0, arr1) {\n var arr2 = new arr0.constructor(arr0.length + arr1.length);\n arr2.set(arr0);\n arr2.set(arr1, arr0.length);\n return arr2;\n }\n function extendTraces(gd, update2, indices, maxPoints) {\n gd = Lib.getGraphDiv(gd);\n function updateArray(target, insert, maxp) {\n var newArray, remainder;\n if (Lib.isTypedArray(target)) {\n if (maxp < 0) {\n var none = new target.constructor(0);\n var both = concatTypedArray(target, insert);\n if (maxp < 0) {\n newArray = both;\n remainder = none;\n } else {\n newArray = none;\n remainder = both;\n }\n } else {\n newArray = new target.constructor(maxp);\n remainder = new target.constructor(target.length + insert.length - maxp);\n if (maxp === insert.length) {\n newArray.set(insert);\n remainder.set(target);\n } else if (maxp < insert.length) {\n var numberOfItemsFromInsert = insert.length - maxp;\n newArray.set(insert.subarray(numberOfItemsFromInsert));\n remainder.set(target);\n remainder.set(insert.subarray(0, numberOfItemsFromInsert), target.length);\n } else {\n var numberOfItemsFromTarget = maxp - insert.length;\n var targetBegin = target.length - numberOfItemsFromTarget;\n newArray.set(target.subarray(targetBegin));\n newArray.set(insert, numberOfItemsFromTarget);\n remainder.set(target.subarray(0, targetBegin));\n }\n }\n } else {\n newArray = target.concat(insert);\n remainder = maxp >= 0 && maxp < newArray.length ? newArray.splice(0, newArray.length - maxp) : [];\n }\n return [newArray, remainder];\n }\n var undo = spliceTraces(gd, update2, indices, maxPoints, updateArray);\n var promise = exports.redraw(gd);\n var undoArgs = [gd, undo.update, indices, undo.maxPoints];\n Queue.add(gd, exports.prependTraces, undoArgs, extendTraces, arguments);\n return promise;\n }\n function prependTraces(gd, update2, indices, maxPoints) {\n gd = Lib.getGraphDiv(gd);\n function updateArray(target, insert, maxp) {\n var newArray, remainder;\n if (Lib.isTypedArray(target)) {\n if (maxp <= 0) {\n var none = new target.constructor(0);\n var both = concatTypedArray(insert, target);\n if (maxp < 0) {\n newArray = both;\n remainder = none;\n } else {\n newArray = none;\n remainder = both;\n }\n } else {\n newArray = new target.constructor(maxp);\n remainder = new target.constructor(target.length + insert.length - maxp);\n if (maxp === insert.length) {\n newArray.set(insert);\n remainder.set(target);\n } else if (maxp < insert.length) {\n var numberOfItemsFromInsert = insert.length - maxp;\n newArray.set(insert.subarray(0, numberOfItemsFromInsert));\n remainder.set(insert.subarray(numberOfItemsFromInsert));\n remainder.set(target, numberOfItemsFromInsert);\n } else {\n var numberOfItemsFromTarget = maxp - insert.length;\n newArray.set(insert);\n newArray.set(target.subarray(0, numberOfItemsFromTarget), insert.length);\n remainder.set(target.subarray(numberOfItemsFromTarget));\n }\n }\n } else {\n newArray = insert.concat(target);\n remainder = maxp >= 0 && maxp < newArray.length ? newArray.splice(maxp, newArray.length) : [];\n }\n return [newArray, remainder];\n }\n var undo = spliceTraces(gd, update2, indices, maxPoints, updateArray);\n var promise = exports.redraw(gd);\n var undoArgs = [gd, undo.update, indices, undo.maxPoints];\n Queue.add(gd, exports.extendTraces, undoArgs, prependTraces, arguments);\n return promise;\n }\n function addTraces(gd, traces, newIndices) {\n gd = Lib.getGraphDiv(gd);\n var currentIndices = [];\n var undoFunc = exports.deleteTraces;\n var redoFunc = addTraces;\n var undoArgs = [gd, currentIndices];\n var redoArgs = [gd, traces];\n var i;\n var promise;\n checkAddTracesArgs(gd, traces, newIndices);\n if (!Array.isArray(traces)) {\n traces = [traces];\n }\n traces = traces.map(function(trace) {\n return Lib.extendFlat({}, trace);\n });\n helpers.cleanData(traces);\n for (i = 0; i < traces.length; i++) {\n gd.data.push(traces[i]);\n }\n for (i = 0; i < traces.length; i++) {\n currentIndices.push(-traces.length + i);\n }\n if (typeof newIndices === \"undefined\") {\n promise = exports.redraw(gd);\n Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);\n return promise;\n }\n if (!Array.isArray(newIndices)) {\n newIndices = [newIndices];\n }\n try {\n checkMoveTracesArgs(gd, currentIndices, newIndices);\n } catch (error) {\n gd.data.splice(gd.data.length - traces.length, traces.length);\n throw error;\n }\n Queue.startSequence(gd);\n Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);\n promise = exports.moveTraces(gd, currentIndices, newIndices);\n Queue.stopSequence(gd);\n return promise;\n }\n function deleteTraces(gd, indices) {\n gd = Lib.getGraphDiv(gd);\n var traces = [];\n var undoFunc = exports.addTraces;\n var redoFunc = deleteTraces;\n var undoArgs = [gd, traces, indices];\n var redoArgs = [gd, indices];\n var i;\n var deletedTrace;\n if (typeof indices === \"undefined\") {\n throw new Error(\"indices must be an integer or array of integers.\");\n } else if (!Array.isArray(indices)) {\n indices = [indices];\n }\n assertIndexArray(gd, indices, \"indices\");\n indices = positivifyIndices(indices, gd.data.length - 1);\n indices.sort(Lib.sorterDes);\n for (i = 0; i < indices.length; i += 1) {\n deletedTrace = gd.data.splice(indices[i], 1)[0];\n traces.push(deletedTrace);\n }\n var promise = exports.redraw(gd);\n Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);\n return promise;\n }\n function moveTraces(gd, currentIndices, newIndices) {\n gd = Lib.getGraphDiv(gd);\n var newData = [];\n var movingTraceMap = [];\n var undoFunc = moveTraces;\n var redoFunc = moveTraces;\n var undoArgs = [gd, newIndices, currentIndices];\n var redoArgs = [gd, currentIndices, newIndices];\n var i;\n checkMoveTracesArgs(gd, currentIndices, newIndices);\n currentIndices = Array.isArray(currentIndices) ? currentIndices : [currentIndices];\n if (typeof newIndices === \"undefined\") {\n newIndices = [];\n for (i = 0; i < currentIndices.length; i++) {\n newIndices.push(-currentIndices.length + i);\n }\n }\n newIndices = Array.isArray(newIndices) ? newIndices : [newIndices];\n currentIndices = positivifyIndices(currentIndices, gd.data.length - 1);\n newIndices = positivifyIndices(newIndices, gd.data.length - 1);\n for (i = 0; i < gd.data.length; i++) {\n if (currentIndices.indexOf(i) === -1) {\n newData.push(gd.data[i]);\n }\n }\n for (i = 0; i < currentIndices.length; i++) {\n movingTraceMap.push({ newIndex: newIndices[i], trace: gd.data[currentIndices[i]] });\n }\n movingTraceMap.sort(function(a, b) {\n return a.newIndex - b.newIndex;\n });\n for (i = 0; i < movingTraceMap.length; i += 1) {\n newData.splice(movingTraceMap[i].newIndex, 0, movingTraceMap[i].trace);\n }\n gd.data = newData;\n var promise = exports.redraw(gd);\n Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);\n return promise;\n }\n function restyle(gd, astr, val, _traces) {\n gd = Lib.getGraphDiv(gd);\n helpers.clearPromiseQueue(gd);\n var aobj = {};\n if (typeof astr === \"string\") aobj[astr] = val;\n else if (Lib.isPlainObject(astr)) {\n aobj = Lib.extendFlat({}, astr);\n if (_traces === void 0) _traces = val;\n } else {\n Lib.warn(\"Restyle fail.\", astr, val, _traces);\n return Promise.reject();\n }\n if (Object.keys(aobj).length) gd.changed = true;\n var traces = helpers.coerceTraceIndices(gd, _traces);\n var specs = _restyle(gd, aobj, traces);\n var flags = specs.flags;\n if (flags.calc) gd.calcdata = void 0;\n if (flags.clearAxisTypes) helpers.clearAxisTypes(gd, traces, {});\n var seq = [];\n if (flags.fullReplot) {\n seq.push(exports._doPlot);\n } else {\n seq.push(Plots.previousPromises);\n Plots.supplyDefaults(gd);\n if (flags.markerSize) {\n Plots.doCalcdata(gd);\n addAxRangeSequence(seq);\n }\n if (flags.style) seq.push(subroutines.doTraceStyle);\n if (flags.colorbars) seq.push(subroutines.doColorBars);\n seq.push(emitAfterPlot);\n }\n seq.push(\n Plots.rehover,\n Plots.redrag,\n Plots.reselect\n );\n Queue.add(\n gd,\n restyle,\n [gd, specs.undoit, specs.traces],\n restyle,\n [gd, specs.redoit, specs.traces]\n );\n var plotDone = Lib.syncOrAsync(seq, gd);\n if (!plotDone || !plotDone.then) plotDone = Promise.resolve();\n return plotDone.then(function() {\n gd.emit(\"plotly_restyle\", specs.eventData);\n return gd;\n });\n }\n function undefinedToNull(val) {\n if (val === void 0) return null;\n return val;\n }\n function makeNP(preGUI, guiEditFlag) {\n if (!guiEditFlag) return nestedProperty;\n return function(container, attr, prefix) {\n var np = nestedProperty(container, attr);\n var npSet = np.set;\n np.set = function(val) {\n var fullAttr = (prefix || \"\") + attr;\n storeCurrent(fullAttr, np.get(), val, preGUI);\n npSet(val);\n };\n return np;\n };\n }\n function storeCurrent(attr, val, newVal, preGUI) {\n if (Array.isArray(val) || Array.isArray(newVal)) {\n var arrayVal = Array.isArray(val) ? val : [];\n var arrayNew = Array.isArray(newVal) ? newVal : [];\n var maxLen = Math.max(arrayVal.length, arrayNew.length);\n for (var i = 0; i < maxLen; i++) {\n storeCurrent(attr + \"[\" + i + \"]\", arrayVal[i], arrayNew[i], preGUI);\n }\n } else if (Lib.isPlainObject(val) || Lib.isPlainObject(newVal)) {\n var objVal = Lib.isPlainObject(val) ? val : {};\n var objNew = Lib.isPlainObject(newVal) ? newVal : {};\n var objBoth = Lib.extendFlat({}, objVal, objNew);\n for (var key in objBoth) {\n storeCurrent(attr + \".\" + key, objVal[key], objNew[key], preGUI);\n }\n } else if (preGUI[attr] === void 0) {\n preGUI[attr] = undefinedToNull(val);\n }\n }\n function _storeDirectGUIEdit(container, preGUI, edits) {\n for (var attr in edits) {\n var np = nestedProperty(container, attr);\n storeCurrent(attr, np.get(), edits[attr], preGUI);\n }\n }\n function _restyle(gd, aobj, traces) {\n var fullLayout = gd._fullLayout;\n var fullData = gd._fullData;\n var data = gd.data;\n var guiEditFlag = fullLayout._guiEditing;\n var layoutNP = makeNP(fullLayout._preGUI, guiEditFlag);\n var eventData = Lib.extendDeepAll({}, aobj);\n var i;\n var flags = editTypes.traceFlags();\n var redoit = {};\n var undoit = {};\n var axlist;\n function a0() {\n return traces.map(function() {\n return void 0;\n });\n }\n function addToAxlist(axid) {\n var axName = Axes.id2name(axid);\n if (axlist.indexOf(axName) === -1) axlist.push(axName);\n }\n function autorangeAttr(axName) {\n return \"LAYOUT\" + axName + \".autorange\";\n }\n function rangeAttr(axName) {\n return \"LAYOUT\" + axName + \".range\";\n }\n function getFullTrace(traceIndex) {\n for (var j = traceIndex; j < fullData.length; j++) {\n if (fullData[j]._input === data[traceIndex]) return fullData[j];\n }\n }\n function doextra(attr, val, i2) {\n if (Array.isArray(attr)) {\n attr.forEach(function(a) {\n doextra(a, val, i2);\n });\n return;\n }\n if (attr in aobj || helpers.hasParent(aobj, attr)) return;\n var extraparam;\n if (attr.substr(0, 6) === \"LAYOUT\") {\n extraparam = layoutNP(gd.layout, attr.replace(\"LAYOUT\", \"\"));\n } else {\n var tracei = traces[i2];\n var preGUI2 = fullLayout._tracePreGUI[getFullTrace(tracei)._fullInput.uid];\n extraparam = makeNP(preGUI2, guiEditFlag)(data[tracei], attr);\n }\n if (!(attr in undoit)) {\n undoit[attr] = a0();\n }\n if (undoit[attr][i2] === void 0) {\n undoit[attr][i2] = undefinedToNull(extraparam.get());\n }\n if (val !== void 0) {\n extraparam.set(val);\n }\n }\n function allBins(binAttr) {\n return function(j) {\n return fullData[j][binAttr];\n };\n }\n function arrayBins(binAttr) {\n return function(vij, j) {\n return vij === false ? fullData[traces[j]][binAttr] : null;\n };\n }\n for (var ai in aobj) {\n if (helpers.hasParent(aobj, ai)) {\n throw new Error(\"cannot set \" + ai + \" and a parent attribute simultaneously\");\n }\n var vi = aobj[ai];\n var cont;\n var contFull;\n var param;\n var oldVal;\n var newVal;\n var valObject;\n if (ai === \"autobinx\" || ai === \"autobiny\") {\n ai = ai.charAt(ai.length - 1) + \"bins\";\n if (Array.isArray(vi)) vi = vi.map(arrayBins(ai));\n else if (vi === false) vi = traces.map(allBins(ai));\n else vi = null;\n }\n redoit[ai] = vi;\n if (ai.substr(0, 6) === \"LAYOUT\") {\n param = layoutNP(gd.layout, ai.replace(\"LAYOUT\", \"\"));\n undoit[ai] = [undefinedToNull(param.get())];\n param.set(Array.isArray(vi) ? vi[0] : vi);\n flags.calc = true;\n continue;\n }\n undoit[ai] = a0();\n for (i = 0; i < traces.length; i++) {\n cont = data[traces[i]];\n contFull = getFullTrace(traces[i]);\n var preGUI = fullLayout._tracePreGUI[contFull._fullInput.uid];\n param = makeNP(preGUI, guiEditFlag)(cont, ai);\n oldVal = param.get();\n newVal = Array.isArray(vi) ? vi[i % vi.length] : vi;\n if (newVal === void 0) continue;\n var finalPart = param.parts[param.parts.length - 1];\n var prefix = ai.substr(0, ai.length - finalPart.length - 1);\n var prefixDot = prefix ? prefix + \".\" : \"\";\n var innerContFull = prefix ? nestedProperty(contFull, prefix).get() : contFull;\n valObject = PlotSchema.getTraceValObject(contFull, param.parts);\n if (valObject && valObject.impliedEdits && newVal !== null) {\n for (var impliedKey in valObject.impliedEdits) {\n doextra(Lib.relativeAttr(ai, impliedKey), valObject.impliedEdits[impliedKey], i);\n }\n } else if ((finalPart === \"thicknessmode\" || finalPart === \"lenmode\") && oldVal !== newVal && (newVal === \"fraction\" || newVal === \"pixels\") && innerContFull) {\n var gs = fullLayout._size;\n var orient = innerContFull.orient;\n var topOrBottom = orient === \"top\" || orient === \"bottom\";\n if (finalPart === \"thicknessmode\") {\n var thicknorm = topOrBottom ? gs.h : gs.w;\n doextra(prefixDot + \"thickness\", innerContFull.thickness * (newVal === \"fraction\" ? 1 / thicknorm : thicknorm), i);\n } else {\n var lennorm = topOrBottom ? gs.w : gs.h;\n doextra(prefixDot + \"len\", innerContFull.len * (newVal === \"fraction\" ? 1 / lennorm : lennorm), i);\n }\n } else if (ai === \"type\" && (newVal === \"pie\" !== (oldVal === \"pie\") || newVal === \"funnelarea\" !== (oldVal === \"funnelarea\"))) {\n var labelsTo = \"x\";\n var valuesTo = \"y\";\n if ((newVal === \"bar\" || oldVal === \"bar\") && cont.orientation === \"h\") {\n labelsTo = \"y\";\n valuesTo = \"x\";\n }\n Lib.swapAttrs(cont, [\"?\", \"?src\"], \"labels\", labelsTo);\n Lib.swapAttrs(cont, [\"d?\", \"?0\"], \"label\", labelsTo);\n Lib.swapAttrs(cont, [\"?\", \"?src\"], \"values\", valuesTo);\n if (oldVal === \"pie\" || oldVal === \"funnelarea\") {\n nestedProperty(cont, \"marker.color\").set(nestedProperty(cont, \"marker.colors\").get());\n fullLayout._pielayer.selectAll(\"g.trace\").remove();\n } else if (Registry.traceIs(cont, \"cartesian\")) {\n nestedProperty(cont, \"marker.colors\").set(nestedProperty(cont, \"marker.color\").get());\n }\n }\n undoit[ai][i] = undefinedToNull(oldVal);\n var swapAttrs = [\n \"swapxy\",\n \"swapxyaxes\",\n \"orientation\",\n \"orientationaxes\"\n ];\n if (swapAttrs.indexOf(ai) !== -1) {\n if (ai === \"orientation\") {\n param.set(newVal);\n var defaultOrientation = cont.x && !cont.y ? \"h\" : \"v\";\n if ((param.get() || defaultOrientation) === contFull.orientation) {\n continue;\n }\n } else if (ai === \"orientationaxes\") {\n cont.orientation = { v: \"h\", h: \"v\" }[contFull.orientation];\n }\n helpers.swapXYData(cont);\n flags.calc = flags.clearAxisTypes = true;\n } else if (Plots.dataArrayContainers.indexOf(param.parts[0]) !== -1) {\n helpers.manageArrayContainers(param, newVal, undoit);\n flags.calc = true;\n } else {\n if (valObject) {\n if (valObject.arrayOk && !Registry.traceIs(contFull, \"regl\") && (Lib.isArrayOrTypedArray(newVal) || Lib.isArrayOrTypedArray(oldVal))) {\n flags.calc = true;\n } else editTypes.update(flags, valObject);\n } else {\n flags.calc = true;\n }\n param.set(newVal);\n }\n }\n if ([\"swapxyaxes\", \"orientationaxes\"].indexOf(ai) !== -1) {\n Axes.swap(gd, traces);\n }\n if (ai === \"orientationaxes\") {\n var hovermode = nestedProperty(gd.layout, \"hovermode\");\n var h = hovermode.get();\n if (h === \"x\") {\n hovermode.set(\"y\");\n } else if (h === \"y\") {\n hovermode.set(\"x\");\n } else if (h === \"x unified\") {\n hovermode.set(\"y unified\");\n } else if (h === \"y unified\") {\n hovermode.set(\"x unified\");\n }\n }\n if ([\"orientation\", \"type\"].indexOf(ai) !== -1) {\n axlist = [];\n for (i = 0; i < traces.length; i++) {\n var trace = data[traces[i]];\n if (Registry.traceIs(trace, \"cartesian\")) {\n addToAxlist(trace.xaxis || \"x\");\n addToAxlist(trace.yaxis || \"y\");\n }\n }\n doextra(axlist.map(autorangeAttr), true, 0);\n doextra(axlist.map(rangeAttr), [0, 1], 0);\n }\n }\n if (flags.calc || flags.plot) {\n flags.fullReplot = true;\n }\n return {\n flags,\n undoit,\n redoit,\n traces,\n eventData: Lib.extendDeepNoArrays([], [eventData, traces])\n };\n }\n function relayout(gd, astr, val) {\n gd = Lib.getGraphDiv(gd);\n helpers.clearPromiseQueue(gd);\n var aobj = {};\n if (typeof astr === \"string\") {\n aobj[astr] = val;\n } else if (Lib.isPlainObject(astr)) {\n aobj = Lib.extendFlat({}, astr);\n } else {\n Lib.warn(\"Relayout fail.\", astr, val);\n return Promise.reject();\n }\n if (Object.keys(aobj).length) gd.changed = true;\n var specs = _relayout(gd, aobj);\n var flags = specs.flags;\n if (flags.calc) gd.calcdata = void 0;\n var seq = [Plots.previousPromises];\n if (flags.layoutReplot) {\n seq.push(subroutines.layoutReplot);\n } else if (Object.keys(aobj).length) {\n axRangeSupplyDefaultsByPass(gd, flags, specs) || Plots.supplyDefaults(gd);\n if (flags.legend) seq.push(subroutines.doLegend);\n if (flags.layoutstyle) seq.push(subroutines.layoutStyles);\n if (flags.axrange) addAxRangeSequence(seq, specs.rangesAltered);\n if (flags.ticks) seq.push(subroutines.doTicksRelayout);\n if (flags.modebar) seq.push(subroutines.doModeBar);\n if (flags.camera) seq.push(subroutines.doCamera);\n if (flags.colorbars) seq.push(subroutines.doColorBars);\n seq.push(emitAfterPlot);\n }\n seq.push(\n Plots.rehover,\n Plots.redrag,\n Plots.reselect\n );\n Queue.add(\n gd,\n relayout,\n [gd, specs.undoit],\n relayout,\n [gd, specs.redoit]\n );\n var plotDone = Lib.syncOrAsync(seq, gd);\n if (!plotDone || !plotDone.then) plotDone = Promise.resolve(gd);\n return plotDone.then(function() {\n gd.emit(\"plotly_relayout\", specs.eventData);\n return gd;\n });\n }\n function axRangeSupplyDefaultsByPass(gd, flags, specs) {\n var fullLayout = gd._fullLayout;\n if (!flags.axrange) return false;\n for (var k in flags) {\n if (k !== \"axrange\" && flags[k]) return false;\n }\n var axIn, axOut;\n var coerce = function(attr, dflt) {\n return Lib.coerce(axIn, axOut, cartesianLayoutAttributes, attr, dflt);\n };\n var options = {};\n for (var axId in specs.rangesAltered) {\n var axName = Axes.id2name(axId);\n axIn = gd.layout[axName];\n axOut = fullLayout[axName];\n handleRangeDefaults(axIn, axOut, coerce, options);\n if (axOut._matchGroup) {\n for (var axId2 in axOut._matchGroup) {\n if (axId2 !== axId) {\n var ax2 = fullLayout[Axes.id2name(axId2)];\n ax2.autorange = axOut.autorange;\n ax2.range = axOut.range.slice();\n ax2._input.range = axOut.range.slice();\n }\n }\n }\n }\n return true;\n }\n function addAxRangeSequence(seq, rangesAltered) {\n var drawAxes = rangesAltered ? function(gd) {\n var axIds = [];\n var skipTitle = true;\n for (var id in rangesAltered) {\n var ax = Axes.getFromId(gd, id);\n axIds.push(id);\n if ((ax.ticklabelposition || \"\").indexOf(\"inside\") !== -1) {\n if (ax._anchorAxis) {\n axIds.push(ax._anchorAxis._id);\n }\n }\n if (ax._matchGroup) {\n for (var id2 in ax._matchGroup) {\n if (!rangesAltered[id2]) {\n axIds.push(id2);\n }\n }\n }\n }\n return Axes.draw(gd, axIds, { skipTitle });\n } : function(gd) {\n return Axes.draw(gd, \"redraw\");\n };\n seq.push(\n clearOutline,\n subroutines.doAutoRangeAndConstraints,\n drawAxes,\n subroutines.drawData,\n subroutines.finalDraw\n );\n }\n var AX_RANGE_RE = /^[xyz]axis[0-9]*\\.range(\\[[0|1]\\])?$/;\n var AX_AUTORANGE_RE = /^[xyz]axis[0-9]*\\.autorange$/;\n var AX_DOMAIN_RE = /^[xyz]axis[0-9]*\\.domain(\\[[0|1]\\])?$/;\n function _relayout(gd, aobj) {\n var layout = gd.layout;\n var fullLayout = gd._fullLayout;\n var guiEditFlag = fullLayout._guiEditing;\n var layoutNP = makeNP(fullLayout._preGUI, guiEditFlag);\n var keys = Object.keys(aobj);\n var axes = Axes.list(gd);\n var eventData = Lib.extendDeepAll({}, aobj);\n var arrayEdits = {};\n var arrayStr, i, j;\n keys = Object.keys(aobj);\n for (i = 0; i < keys.length; i++) {\n if (keys[i].indexOf(\"allaxes\") === 0) {\n for (j = 0; j < axes.length; j++) {\n var scene = axes[j]._id.substr(1);\n var axisAttr = scene.indexOf(\"scene\") !== -1 ? scene + \".\" : \"\";\n var newkey = keys[i].replace(\"allaxes\", axisAttr + axes[j]._name);\n if (!aobj[newkey]) aobj[newkey] = aobj[keys[i]];\n }\n delete aobj[keys[i]];\n }\n }\n var flags = editTypes.layoutFlags();\n var redoit = {};\n var undoit = {};\n function doextra(attr, val) {\n if (Array.isArray(attr)) {\n attr.forEach(function(a) {\n doextra(a, val);\n });\n return;\n }\n if (attr in aobj || helpers.hasParent(aobj, attr)) return;\n var p2 = layoutNP(layout, attr);\n if (!(attr in undoit)) {\n undoit[attr] = undefinedToNull(p2.get());\n }\n if (val !== void 0) p2.set(val);\n }\n var rangesAltered = {};\n var ax;\n function recordAlteredAxis(pleafPlus2) {\n var axId2 = Axes.name2id(pleafPlus2.split(\".\")[0]);\n rangesAltered[axId2] = 1;\n return axId2;\n }\n for (var ai in aobj) {\n if (helpers.hasParent(aobj, ai)) {\n throw new Error(\"cannot set \" + ai + \" and a parent attribute simultaneously\");\n }\n var p = layoutNP(layout, ai);\n var vi = aobj[ai];\n var plen = p.parts.length;\n var pend = plen - 1;\n while (pend > 0 && typeof p.parts[pend] !== \"string\") pend--;\n var pleaf = p.parts[pend];\n var pleafPlus = p.parts[pend - 1] + \".\" + pleaf;\n var ptrunk = p.parts.slice(0, pend).join(\".\");\n var parentIn = nestedProperty(gd.layout, ptrunk).get();\n var parentFull = nestedProperty(fullLayout, ptrunk).get();\n var vOld = p.get();\n if (vi === void 0) continue;\n redoit[ai] = vi;\n undoit[ai] = pleaf === \"reverse\" ? vi : undefinedToNull(vOld);\n var valObject = PlotSchema.getLayoutValObject(fullLayout, p.parts);\n if (valObject && valObject.impliedEdits && vi !== null) {\n for (var impliedKey in valObject.impliedEdits) {\n doextra(Lib.relativeAttr(ai, impliedKey), valObject.impliedEdits[impliedKey]);\n }\n }\n if ([\"width\", \"height\"].indexOf(ai) !== -1) {\n if (vi) {\n doextra(\"autosize\", null);\n var oppositeAttr = ai === \"height\" ? \"width\" : \"height\";\n doextra(oppositeAttr, fullLayout[oppositeAttr]);\n } else {\n fullLayout[ai] = gd._initialAutoSize[ai];\n }\n } else if (ai === \"autosize\") {\n doextra(\"width\", vi ? null : fullLayout.width);\n doextra(\"height\", vi ? null : fullLayout.height);\n } else if (pleafPlus.match(AX_RANGE_RE)) {\n recordAlteredAxis(pleafPlus);\n nestedProperty(fullLayout, ptrunk + \"._inputRange\").set(null);\n } else if (pleafPlus.match(AX_AUTORANGE_RE)) {\n recordAlteredAxis(pleafPlus);\n nestedProperty(fullLayout, ptrunk + \"._inputRange\").set(null);\n var axFull = nestedProperty(fullLayout, ptrunk).get();\n if (axFull._inputDomain) {\n axFull._input.domain = axFull._inputDomain.slice();\n }\n } else if (pleafPlus.match(AX_DOMAIN_RE)) {\n nestedProperty(fullLayout, ptrunk + \"._inputDomain\").set(null);\n }\n if (pleaf === \"type\") {\n ax = parentIn;\n var toLog = parentFull.type === \"linear\" && vi === \"log\";\n var fromLog = parentFull.type === \"log\" && vi === \"linear\";\n if (toLog || fromLog) {\n if (!ax || !ax.range) {\n doextra(ptrunk + \".autorange\", true);\n } else if (!parentFull.autorange) {\n var r0 = ax.range[0];\n var r1 = ax.range[1];\n if (toLog) {\n if (r0 <= 0 && r1 <= 0) {\n doextra(ptrunk + \".autorange\", true);\n }\n if (r0 <= 0) r0 = r1 / 1e6;\n else if (r1 <= 0) r1 = r0 / 1e6;\n doextra(ptrunk + \".range[0]\", Math.log(r0) / Math.LN10);\n doextra(ptrunk + \".range[1]\", Math.log(r1) / Math.LN10);\n } else {\n doextra(ptrunk + \".range[0]\", Math.pow(10, r0));\n doextra(ptrunk + \".range[1]\", Math.pow(10, r1));\n }\n } else if (toLog) {\n ax.range = ax.range[1] > ax.range[0] ? [1, 2] : [2, 1];\n }\n if (Array.isArray(fullLayout._subplots.polar) && fullLayout._subplots.polar.length && fullLayout[p.parts[0]] && p.parts[1] === \"radialaxis\") {\n delete fullLayout[p.parts[0]]._subplot.viewInitial[\"radialaxis.range\"];\n }\n Registry.getComponentMethod(\"annotations\", \"convertCoords\")(gd, parentFull, vi, doextra);\n Registry.getComponentMethod(\"images\", \"convertCoords\")(gd, parentFull, vi, doextra);\n } else {\n doextra(ptrunk + \".autorange\", true);\n doextra(ptrunk + \".range\", null);\n }\n nestedProperty(fullLayout, ptrunk + \"._inputRange\").set(null);\n } else if (pleaf.match(AX_NAME_PATTERN)) {\n var fullProp = nestedProperty(fullLayout, ai).get();\n var newType = (vi || {}).type;\n if (!newType || newType === \"-\") newType = \"linear\";\n Registry.getComponentMethod(\"annotations\", \"convertCoords\")(gd, fullProp, newType, doextra);\n Registry.getComponentMethod(\"images\", \"convertCoords\")(gd, fullProp, newType, doextra);\n }\n var containerArrayMatch = manageArrays.containerArrayMatch(ai);\n if (containerArrayMatch) {\n arrayStr = containerArrayMatch.array;\n i = containerArrayMatch.index;\n var propStr = containerArrayMatch.property;\n var updateValObject = valObject || { editType: \"calc\" };\n if (i !== \"\" && propStr === \"\") {\n if (manageArrays.isAddVal(vi)) {\n undoit[ai] = null;\n } else if (manageArrays.isRemoveVal(vi)) {\n undoit[ai] = (nestedProperty(layout, arrayStr).get() || [])[i];\n } else {\n Lib.warn(\"unrecognized full object value\", aobj);\n }\n }\n editTypes.update(flags, updateValObject);\n if (!arrayEdits[arrayStr]) arrayEdits[arrayStr] = {};\n var objEdits = arrayEdits[arrayStr][i];\n if (!objEdits) objEdits = arrayEdits[arrayStr][i] = {};\n objEdits[propStr] = vi;\n delete aobj[ai];\n } else if (pleaf === \"reverse\") {\n if (parentIn.range) parentIn.range.reverse();\n else {\n doextra(ptrunk + \".autorange\", true);\n parentIn.range = [1, 0];\n }\n if (parentFull.autorange) flags.calc = true;\n else flags.plot = true;\n } else {\n if (ai === \"dragmode\" && (vi === false && vOld !== false || vi !== false && vOld === false)) {\n flags.plot = true;\n } else if (fullLayout._has(\"scatter-like\") && fullLayout._has(\"regl\") && (ai === \"dragmode\" && (vi === \"lasso\" || vi === \"select\") && !(vOld === \"lasso\" || vOld === \"select\"))) {\n flags.plot = true;\n } else if (valObject) editTypes.update(flags, valObject);\n else flags.calc = true;\n p.set(vi);\n }\n }\n for (arrayStr in arrayEdits) {\n var finished = manageArrays.applyContainerArrayChanges(\n gd,\n layoutNP(layout, arrayStr),\n arrayEdits[arrayStr],\n flags,\n layoutNP\n );\n if (!finished) flags.plot = true;\n }\n for (var axId in rangesAltered) {\n ax = Axes.getFromId(gd, axId);\n var group = ax && ax._constraintGroup;\n if (group) {\n flags.calc = true;\n for (var groupAxId in group) {\n if (!rangesAltered[groupAxId]) {\n Axes.getFromId(gd, groupAxId)._constraintShrinkable = true;\n }\n }\n }\n }\n if (updateAutosize(gd) || aobj.height || aobj.width) flags.plot = true;\n var shapes = fullLayout.shapes;\n for (i = 0; i < shapes.length; i++) {\n if (shapes[i].showlegend) {\n flags.calc = true;\n break;\n }\n }\n if (flags.plot || flags.calc) {\n flags.layoutReplot = true;\n }\n return {\n flags,\n rangesAltered,\n undoit,\n redoit,\n eventData\n };\n }\n function updateAutosize(gd) {\n var fullLayout = gd._fullLayout;\n var oldWidth = fullLayout.width;\n var oldHeight = fullLayout.height;\n if (gd.layout.autosize) Plots.plotAutoSize(gd, gd.layout, fullLayout);\n return fullLayout.width !== oldWidth || fullLayout.height !== oldHeight;\n }\n function update(gd, traceUpdate, layoutUpdate, _traces) {\n gd = Lib.getGraphDiv(gd);\n helpers.clearPromiseQueue(gd);\n if (!Lib.isPlainObject(traceUpdate)) traceUpdate = {};\n if (!Lib.isPlainObject(layoutUpdate)) layoutUpdate = {};\n if (Object.keys(traceUpdate).length) gd.changed = true;\n if (Object.keys(layoutUpdate).length) gd.changed = true;\n var traces = helpers.coerceTraceIndices(gd, _traces);\n var restyleSpecs = _restyle(gd, Lib.extendFlat({}, traceUpdate), traces);\n var restyleFlags = restyleSpecs.flags;\n var relayoutSpecs = _relayout(gd, Lib.extendFlat({}, layoutUpdate));\n var relayoutFlags = relayoutSpecs.flags;\n if (restyleFlags.calc || relayoutFlags.calc) gd.calcdata = void 0;\n if (restyleFlags.clearAxisTypes) helpers.clearAxisTypes(gd, traces, layoutUpdate);\n var seq = [];\n if (relayoutFlags.layoutReplot) {\n seq.push(subroutines.layoutReplot);\n } else if (restyleFlags.fullReplot) {\n seq.push(exports._doPlot);\n } else {\n seq.push(Plots.previousPromises);\n axRangeSupplyDefaultsByPass(gd, relayoutFlags, relayoutSpecs) || Plots.supplyDefaults(gd);\n if (restyleFlags.style) seq.push(subroutines.doTraceStyle);\n if (restyleFlags.colorbars || relayoutFlags.colorbars) seq.push(subroutines.doColorBars);\n if (relayoutFlags.legend) seq.push(subroutines.doLegend);\n if (relayoutFlags.layoutstyle) seq.push(subroutines.layoutStyles);\n if (relayoutFlags.axrange) addAxRangeSequence(seq, relayoutSpecs.rangesAltered);\n if (relayoutFlags.ticks) seq.push(subroutines.doTicksRelayout);\n if (relayoutFlags.modebar) seq.push(subroutines.doModeBar);\n if (relayoutFlags.camera) seq.push(subroutines.doCamera);\n seq.push(emitAfterPlot);\n }\n seq.push(\n Plots.rehover,\n Plots.redrag,\n Plots.reselect\n );\n Queue.add(\n gd,\n update,\n [gd, restyleSpecs.undoit, relayoutSpecs.undoit, restyleSpecs.traces],\n update,\n [gd, restyleSpecs.redoit, relayoutSpecs.redoit, restyleSpecs.traces]\n );\n var plotDone = Lib.syncOrAsync(seq, gd);\n if (!plotDone || !plotDone.then) plotDone = Promise.resolve(gd);\n return plotDone.then(function() {\n gd.emit(\"plotly_update\", {\n data: restyleSpecs.eventData,\n layout: relayoutSpecs.eventData\n });\n return gd;\n });\n }\n function guiEdit(func) {\n return function wrappedEdit(gd) {\n gd._fullLayout._guiEditing = true;\n var p = func.apply(null, arguments);\n gd._fullLayout._guiEditing = false;\n return p;\n };\n }\n var layoutUIControlPatterns = [\n { pattern: /^hiddenlabels/, attr: \"legend.uirevision\" },\n { pattern: /^((x|y)axis\\d*)\\.((auto)?range|title\\.text)/ },\n // showspikes and modes include those nested inside scenes\n { pattern: /axis\\d*\\.showspikes$/, attr: \"modebar.uirevision\" },\n { pattern: /(hover|drag)mode$/, attr: \"modebar.uirevision\" },\n { pattern: /^(scene\\d*)\\.camera/ },\n { pattern: /^(geo\\d*)\\.(projection|center|fitbounds)/ },\n { pattern: /^(ternary\\d*\\.[abc]axis)\\.(min|title\\.text)$/ },\n { pattern: /^(polar\\d*\\.radialaxis)\\.((auto)?range|angle|title\\.text)/ },\n { pattern: /^(polar\\d*\\.angularaxis)\\.rotation/ },\n { pattern: /^(mapbox\\d*)\\.(center|zoom|bearing|pitch)/ },\n { pattern: /^(map\\d*)\\.(center|zoom|bearing|pitch)/ },\n { pattern: /^legend\\.(x|y)$/, attr: \"editrevision\" },\n { pattern: /^(shapes|annotations)/, attr: \"editrevision\" },\n { pattern: /^title\\.text$/, attr: \"editrevision\" }\n ];\n var traceUIControlPatterns = [\n { pattern: /^selectedpoints$/, attr: \"selectionrevision\" },\n // \"visible\" includes trace.transforms[i].styles[j].value.visible\n { pattern: /(^|value\\.)visible$/, attr: \"legend.uirevision\" },\n { pattern: /^dimensions\\[\\d+\\]\\.constraintrange/ },\n { pattern: /^node\\.(x|y|groups)/ },\n // for Sankey nodes\n { pattern: /^level$/ },\n // for Sunburst, Treemap and Icicle traces\n // below this you must be in editable: true mode\n // TODO: I still put name and title with `trace.uirevision`\n // reasonable or should these be `editrevision`?\n // Also applies to axis titles up in the layout section\n // \"name\" also includes transform.styles\n { pattern: /(^|value\\.)name$/ },\n // including nested colorbar attributes (ie marker.colorbar)\n { pattern: /colorbar\\.title\\.text$/ },\n { pattern: /colorbar\\.(x|y)$/, attr: \"editrevision\" }\n ];\n function findUIPattern(key, patternSpecs) {\n for (var i = 0; i < patternSpecs.length; i++) {\n var spec = patternSpecs[i];\n var match = key.match(spec.pattern);\n if (match) {\n var head = match[1] || \"\";\n return { head, tail: key.substr(head.length + 1), attr: spec.attr };\n }\n }\n }\n function getNewRev(revAttr, container) {\n var newRev = nestedProperty(container, revAttr).get();\n if (newRev !== void 0) return newRev;\n var parts = revAttr.split(\".\");\n parts.pop();\n while (parts.length > 1) {\n parts.pop();\n newRev = nestedProperty(container, parts.join(\".\") + \".uirevision\").get();\n if (newRev !== void 0) return newRev;\n }\n return container.uirevision;\n }\n function getFullTraceIndexFromUid(uid, fullData) {\n for (var i = 0; i < fullData.length; i++) {\n if (fullData[i]._fullInput.uid === uid) return i;\n }\n return -1;\n }\n function getTraceIndexFromUid(uid, data, tracei) {\n for (var i = 0; i < data.length; i++) {\n if (data[i].uid === uid) return i;\n }\n return !data[tracei] || data[tracei].uid ? -1 : tracei;\n }\n function valsMatch(v1, v2) {\n var v1IsObj = Lib.isPlainObject(v1);\n var v1IsArray = Array.isArray(v1);\n if (v1IsObj || v1IsArray) {\n return (v1IsObj && Lib.isPlainObject(v2) || v1IsArray && Array.isArray(v2)) && JSON.stringify(v1) === JSON.stringify(v2);\n }\n return v1 === v2;\n }\n function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {\n var layoutPreGUI = oldFullLayout._preGUI;\n var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal, head, tail;\n var bothInheritAutorange = [];\n var newAutorangeIn = {};\n var newRangeAccepted = {};\n for (key in layoutPreGUI) {\n match = findUIPattern(key, layoutUIControlPatterns);\n if (match) {\n head = match.head;\n tail = match.tail;\n revAttr = match.attr || head + \".uirevision\";\n oldRev = nestedProperty(oldFullLayout, revAttr).get();\n newRev = oldRev && getNewRev(revAttr, layout);\n if (newRev && newRev === oldRev) {\n preGUIVal = layoutPreGUI[key];\n if (preGUIVal === null) preGUIVal = void 0;\n newNP = nestedProperty(layout, key);\n newVal = newNP.get();\n if (valsMatch(newVal, preGUIVal)) {\n if (newVal === void 0 && tail === \"autorange\") {\n bothInheritAutorange.push(head);\n }\n newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));\n continue;\n } else if (tail === \"autorange\" || tail.substr(0, 6) === \"range[\") {\n var pre0 = layoutPreGUI[head + \".range[0]\"];\n var pre1 = layoutPreGUI[head + \".range[1]\"];\n var preAuto = layoutPreGUI[head + \".autorange\"];\n if (preAuto || preAuto === null && pre0 === null && pre1 === null) {\n if (!(head in newAutorangeIn)) {\n var newContainer = nestedProperty(layout, head).get();\n newAutorangeIn[head] = newContainer && (newContainer.autorange || newContainer.autorange !== false && (!newContainer.range || newContainer.range.length !== 2));\n }\n if (newAutorangeIn[head]) {\n newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));\n continue;\n }\n }\n }\n }\n } else {\n Lib.warn(\"unrecognized GUI edit: \" + key);\n }\n delete layoutPreGUI[key];\n if (match && match.tail.substr(0, 6) === \"range[\") {\n newRangeAccepted[match.head] = 1;\n }\n }\n for (var i = 0; i < bothInheritAutorange.length; i++) {\n var axAttr = bothInheritAutorange[i];\n if (newRangeAccepted[axAttr]) {\n var newAx = nestedProperty(layout, axAttr).get();\n if (newAx) delete newAx.autorange;\n }\n }\n var allTracePreGUI = oldFullLayout._tracePreGUI;\n for (var uid in allTracePreGUI) {\n var tracePreGUI = allTracePreGUI[uid];\n var newTrace = null;\n var fullInput;\n for (key in tracePreGUI) {\n if (!newTrace) {\n var fulli = getFullTraceIndexFromUid(uid, oldFullData);\n if (fulli < 0) {\n delete allTracePreGUI[uid];\n break;\n }\n var fullTrace = oldFullData[fulli];\n fullInput = fullTrace._fullInput;\n var newTracei = getTraceIndexFromUid(uid, data, fullInput.index);\n if (newTracei < 0) {\n delete allTracePreGUI[uid];\n break;\n }\n newTrace = data[newTracei];\n }\n match = findUIPattern(key, traceUIControlPatterns);\n if (match) {\n if (match.attr) {\n oldRev = nestedProperty(oldFullLayout, match.attr).get();\n newRev = oldRev && getNewRev(match.attr, layout);\n } else {\n oldRev = fullInput.uirevision;\n newRev = newTrace.uirevision;\n if (newRev === void 0) newRev = layout.uirevision;\n }\n if (newRev && newRev === oldRev) {\n preGUIVal = tracePreGUI[key];\n if (preGUIVal === null) preGUIVal = void 0;\n newNP = nestedProperty(newTrace, key);\n newVal = newNP.get();\n if (valsMatch(newVal, preGUIVal)) {\n newNP.set(undefinedToNull(nestedProperty(fullInput, key).get()));\n continue;\n }\n }\n } else {\n Lib.warn(\"unrecognized GUI edit: \" + key + \" in trace uid \" + uid);\n }\n delete tracePreGUI[key];\n }\n }\n }\n function react(gd, data, layout, config) {\n var frames, plotDone;\n function addFrames2() {\n return exports.addFrames(gd, frames);\n }\n gd = Lib.getGraphDiv(gd);\n helpers.clearPromiseQueue(gd);\n var oldFullData = gd._fullData;\n var oldFullLayout = gd._fullLayout;\n if (!Lib.isPlotDiv(gd) || !oldFullData || !oldFullLayout) {\n plotDone = exports.newPlot(gd, data, layout, config);\n } else {\n if (Lib.isPlainObject(data)) {\n var obj = data;\n data = obj.data;\n layout = obj.layout;\n config = obj.config;\n frames = obj.frames;\n }\n var configChanged = false;\n if (config) {\n var oldConfig = Lib.extendDeep({}, gd._context);\n gd._context = void 0;\n setPlotContext(gd, config);\n configChanged = diffConfig(oldConfig, gd._context);\n }\n gd.data = data || [];\n helpers.cleanData(gd.data);\n gd.layout = layout || {};\n helpers.cleanLayout(gd.layout);\n applyUIRevisions(gd.data, gd.layout, oldFullData, oldFullLayout);\n Plots.supplyDefaults(gd, { skipUpdateCalc: true });\n var newFullData = gd._fullData;\n var newFullLayout = gd._fullLayout;\n var immutable = newFullLayout.datarevision === void 0;\n var transition = newFullLayout.transition;\n var relayoutFlags = diffLayout(gd, oldFullLayout, newFullLayout, immutable, transition);\n var newDataRevision = relayoutFlags.newDataRevision;\n var restyleFlags = diffData(gd, oldFullData, newFullData, immutable, transition, newDataRevision);\n if (updateAutosize(gd)) relayoutFlags.layoutReplot = true;\n if (restyleFlags.calc || relayoutFlags.calc) {\n gd.calcdata = void 0;\n var allNames = Object.getOwnPropertyNames(newFullLayout);\n for (var q = 0; q < allNames.length; q++) {\n var name2 = allNames[q];\n var start = name2.substring(0, 5);\n if (start === \"xaxis\" || start === \"yaxis\") {\n var emptyCategories = newFullLayout[name2]._emptyCategories;\n if (emptyCategories) emptyCategories();\n }\n }\n } else {\n Plots.supplyDefaultsUpdateCalc(gd.calcdata, newFullData);\n }\n var seq = [];\n if (frames) {\n gd._transitionData = {};\n Plots.createTransitionData(gd);\n seq.push(addFrames2);\n }\n if (newFullLayout.transition && !configChanged && (restyleFlags.anim || relayoutFlags.anim)) {\n if (relayoutFlags.ticks) seq.push(subroutines.doTicksRelayout);\n Plots.doCalcdata(gd);\n subroutines.doAutoRangeAndConstraints(gd);\n seq.push(function() {\n return Plots.transitionFromReact(gd, restyleFlags, relayoutFlags, oldFullLayout);\n });\n } else if (restyleFlags.fullReplot || relayoutFlags.layoutReplot || configChanged) {\n gd._fullLayout._skipDefaults = true;\n seq.push(exports._doPlot);\n } else {\n for (var componentType in relayoutFlags.arrays) {\n var indices = relayoutFlags.arrays[componentType];\n if (indices.length) {\n var drawOne = Registry.getComponentMethod(componentType, \"drawOne\");\n if (drawOne !== Lib.noop) {\n for (var i = 0; i < indices.length; i++) {\n drawOne(gd, indices[i]);\n }\n } else {\n var draw = Registry.getComponentMethod(componentType, \"draw\");\n if (draw === Lib.noop) {\n throw new Error(\"cannot draw components: \" + componentType);\n }\n draw(gd);\n }\n }\n }\n seq.push(Plots.previousPromises);\n if (restyleFlags.style) seq.push(subroutines.doTraceStyle);\n if (restyleFlags.colorbars || relayoutFlags.colorbars) seq.push(subroutines.doColorBars);\n if (relayoutFlags.legend) seq.push(subroutines.doLegend);\n if (relayoutFlags.layoutstyle) seq.push(subroutines.layoutStyles);\n if (relayoutFlags.axrange) addAxRangeSequence(seq);\n if (relayoutFlags.ticks) seq.push(subroutines.doTicksRelayout);\n if (relayoutFlags.modebar) seq.push(subroutines.doModeBar);\n if (relayoutFlags.camera) seq.push(subroutines.doCamera);\n seq.push(emitAfterPlot);\n }\n seq.push(\n Plots.rehover,\n Plots.redrag,\n Plots.reselect\n );\n plotDone = Lib.syncOrAsync(seq, gd);\n if (!plotDone || !plotDone.then) plotDone = Promise.resolve(gd);\n }\n return plotDone.then(function() {\n gd.emit(\"plotly_react\", {\n data,\n layout\n });\n return gd;\n });\n }\n function diffData(gd, oldFullData, newFullData, immutable, transition, newDataRevision) {\n var sameTraceLength = oldFullData.length === newFullData.length;\n if (!transition && !sameTraceLength) {\n return {\n fullReplot: true,\n calc: true\n };\n }\n var flags = editTypes.traceFlags();\n flags.arrays = {};\n flags.nChanges = 0;\n flags.nChangesAnim = 0;\n var i, trace;\n function getTraceValObject(parts) {\n var out = PlotSchema.getTraceValObject(trace, parts);\n if (!trace._module.animatable && out.anim) {\n out.anim = false;\n }\n return out;\n }\n var diffOpts = {\n getValObject: getTraceValObject,\n flags,\n immutable,\n transition,\n newDataRevision,\n gd\n };\n var seenUIDs = {};\n for (i = 0; i < oldFullData.length; i++) {\n if (newFullData[i]) {\n trace = newFullData[i]._fullInput;\n if (seenUIDs[trace.uid]) continue;\n seenUIDs[trace.uid] = 1;\n getDiffFlags(oldFullData[i]._fullInput, trace, [], diffOpts);\n }\n }\n if (flags.calc || flags.plot) {\n flags.fullReplot = true;\n }\n if (transition && flags.nChanges && flags.nChangesAnim) {\n flags.anim = flags.nChanges === flags.nChangesAnim && sameTraceLength ? \"all\" : \"some\";\n }\n return flags;\n }\n function diffLayout(gd, oldFullLayout, newFullLayout, immutable, transition) {\n var flags = editTypes.layoutFlags();\n flags.arrays = {};\n flags.rangesAltered = {};\n flags.nChanges = 0;\n flags.nChangesAnim = 0;\n function getLayoutValObject(parts) {\n return PlotSchema.getLayoutValObject(newFullLayout, parts);\n }\n for (var key in newFullLayout) {\n if (!key.startsWith(\"xaxis\") && !key.startsWith(\"yaxis\")) {\n continue;\n }\n if (!oldFullLayout[key]) {\n continue;\n }\n var newDomain = newFullLayout[key].domain;\n var oldDomain = oldFullLayout[key].domain;\n var oldInputDomain = oldFullLayout[key]._inputDomain;\n if (oldFullLayout[key]._inputDomain) {\n if (newDomain[0] === oldInputDomain[0] && newDomain[1] === oldInputDomain[1]) {\n newFullLayout[key].domain = oldFullLayout[key].domain;\n } else if (newDomain[0] !== oldDomain[0] || newDomain[1] !== oldDomain[1]) {\n newFullLayout[key]._inputDomain = null;\n }\n }\n }\n var diffOpts = {\n getValObject: getLayoutValObject,\n flags,\n immutable,\n transition,\n gd\n };\n getDiffFlags(oldFullLayout, newFullLayout, [], diffOpts);\n if (flags.plot || flags.calc) {\n flags.layoutReplot = true;\n }\n if (transition && flags.nChanges && flags.nChangesAnim) {\n flags.anim = flags.nChanges === flags.nChangesAnim ? \"all\" : \"some\";\n }\n return flags;\n }\n function getDiffFlags(oldContainer, newContainer, outerparts, opts) {\n var valObject, key, astr;\n var getValObject = opts.getValObject;\n var flags = opts.flags;\n var immutable = opts.immutable;\n var inArray = opts.inArray;\n var arrayIndex = opts.arrayIndex;\n function changed() {\n var editType = valObject.editType;\n if (inArray && editType.indexOf(\"arraydraw\") !== -1) {\n Lib.pushUnique(flags.arrays[inArray], arrayIndex);\n return;\n }\n editTypes.update(flags, valObject);\n if (editType !== \"none\") {\n flags.nChanges++;\n }\n if (opts.transition && valObject.anim) {\n flags.nChangesAnim++;\n }\n if (AX_RANGE_RE.test(astr) || AX_AUTORANGE_RE.test(astr)) {\n flags.rangesAltered[outerparts[0]] = 1;\n }\n if (key === \"datarevision\") {\n flags.newDataRevision = 1;\n }\n }\n function valObjectCanBeDataArray(valObject2) {\n return valObject2.valType === \"data_array\" || valObject2.arrayOk;\n }\n for (key in oldContainer) {\n if (flags.calc && !opts.transition) return;\n var oldVal = oldContainer[key];\n var newVal = newContainer[key];\n var parts = outerparts.concat(key);\n astr = parts.join(\".\");\n if (key.charAt(0) === \"_\" || typeof oldVal === \"function\" || oldVal === newVal) continue;\n if ((key === \"tick0\" || key === \"dtick\") && outerparts[0] !== \"geo\") {\n var tickMode = newContainer.tickmode;\n if (tickMode === \"auto\" || tickMode === \"array\" || !tickMode) continue;\n }\n if (key === \"range\" && newContainer.autorange) continue;\n if ((key === \"zmin\" || key === \"zmax\") && newContainer.type === \"contourcarpet\") continue;\n valObject = getValObject(parts);\n if (!valObject) continue;\n if (valObject._compareAsJSON && JSON.stringify(oldVal) === JSON.stringify(newVal)) continue;\n var valType = valObject.valType;\n var i;\n var canBeDataArray = valObjectCanBeDataArray(valObject);\n var wasArray = Array.isArray(oldVal);\n var nowArray = Array.isArray(newVal);\n if (wasArray && nowArray) {\n var inputKey = \"_input_\" + key;\n var oldValIn = oldContainer[inputKey];\n var newValIn = newContainer[inputKey];\n if (Array.isArray(oldValIn) && oldValIn === newValIn) continue;\n }\n if (newVal === void 0) {\n if (canBeDataArray && wasArray) flags.calc = true;\n else changed();\n } else if (valObject._isLinkedToArray) {\n var arrayEditIndices = [];\n var extraIndices = false;\n if (!inArray) flags.arrays[key] = arrayEditIndices;\n var minLen = Math.min(oldVal.length, newVal.length);\n var maxLen = Math.max(oldVal.length, newVal.length);\n if (minLen !== maxLen) {\n if (valObject.editType === \"arraydraw\") {\n extraIndices = true;\n } else {\n changed();\n continue;\n }\n }\n for (i = 0; i < minLen; i++) {\n getDiffFlags(\n oldVal[i],\n newVal[i],\n parts.concat(i),\n // add array indices, but not if we're already in an array\n Lib.extendFlat({ inArray: key, arrayIndex: i }, opts)\n );\n }\n if (extraIndices) {\n for (i = minLen; i < maxLen; i++) {\n arrayEditIndices.push(i);\n }\n }\n } else if (!valType && Lib.isPlainObject(oldVal)) {\n getDiffFlags(oldVal, newVal, parts, opts);\n } else if (canBeDataArray) {\n if (wasArray && nowArray) {\n if (immutable) {\n flags.calc = true;\n }\n if (immutable || opts.newDataRevision) {\n changed();\n }\n } else if (wasArray !== nowArray) {\n flags.calc = true;\n } else changed();\n } else if (wasArray && nowArray) {\n if (oldVal.length !== newVal.length || String(oldVal) !== String(newVal)) {\n changed();\n }\n } else {\n changed();\n }\n }\n for (key in newContainer) {\n if (!(key in oldContainer || key.charAt(0) === \"_\" || typeof newContainer[key] === \"function\")) {\n valObject = getValObject(outerparts.concat(key));\n if (valObjectCanBeDataArray(valObject) && Array.isArray(newContainer[key])) {\n flags.calc = true;\n return;\n } else changed();\n }\n }\n }\n function diffConfig(oldConfig, newConfig) {\n var key;\n for (key in oldConfig) {\n if (key.charAt(0) === \"_\") continue;\n var oldVal = oldConfig[key];\n var newVal = newConfig[key];\n if (oldVal !== newVal) {\n if (Lib.isPlainObject(oldVal) && Lib.isPlainObject(newVal)) {\n if (diffConfig(oldVal, newVal)) {\n return true;\n }\n } else if (Array.isArray(oldVal) && Array.isArray(newVal)) {\n if (oldVal.length !== newVal.length) {\n return true;\n }\n for (var i = 0; i < oldVal.length; i++) {\n if (oldVal[i] !== newVal[i]) {\n if (Lib.isPlainObject(oldVal[i]) && Lib.isPlainObject(newVal[i])) {\n if (diffConfig(oldVal[i], newVal[i])) {\n return true;\n }\n } else {\n return true;\n }\n }\n }\n } else {\n return true;\n }\n }\n }\n }\n function animate(gd, frameOrGroupNameOrFrameList, animationOpts) {\n gd = Lib.getGraphDiv(gd);\n if (!Lib.isPlotDiv(gd)) {\n throw new Error(\n \"This element is not a Plotly plot: \" + gd + \". It's likely that you've failed to create a plot before animating it. For more details, see https://plotly.com/javascript/animations/\"\n );\n }\n var trans = gd._transitionData;\n if (!trans._frameQueue) {\n trans._frameQueue = [];\n }\n animationOpts = Plots.supplyAnimationDefaults(animationOpts);\n var transitionOpts = animationOpts.transition;\n var frameOpts = animationOpts.frame;\n if (trans._frameWaitingCnt === void 0) {\n trans._frameWaitingCnt = 0;\n }\n function getTransitionOpts(i) {\n if (Array.isArray(transitionOpts)) {\n if (i >= transitionOpts.length) {\n return transitionOpts[0];\n } else {\n return transitionOpts[i];\n }\n } else {\n return transitionOpts;\n }\n }\n function getFrameOpts(i) {\n if (Array.isArray(frameOpts)) {\n if (i >= frameOpts.length) {\n return frameOpts[0];\n } else {\n return frameOpts[i];\n }\n } else {\n return frameOpts;\n }\n }\n function callbackOnNthTime(cb, n) {\n var cnt = 0;\n return function() {\n if (cb && ++cnt === n) {\n return cb();\n }\n };\n }\n return new Promise(function(resolve, reject) {\n function discardExistingFrames() {\n if (trans._frameQueue.length === 0) {\n return;\n }\n while (trans._frameQueue.length) {\n var next = trans._frameQueue.pop();\n if (next.onInterrupt) {\n next.onInterrupt();\n }\n }\n gd.emit(\"plotly_animationinterrupted\", []);\n }\n function queueFrames(frameList2) {\n if (frameList2.length === 0) return;\n for (var i2 = 0; i2 < frameList2.length; i2++) {\n var computedFrame;\n if (frameList2[i2].type === \"byname\") {\n computedFrame = Plots.computeFrame(gd, frameList2[i2].name);\n } else {\n computedFrame = frameList2[i2].data;\n }\n var frameOpts2 = getFrameOpts(i2);\n var transitionOpts2 = getTransitionOpts(i2);\n transitionOpts2.duration = Math.min(transitionOpts2.duration, frameOpts2.duration);\n var nextFrame2 = {\n frame: computedFrame,\n name: frameList2[i2].name,\n frameOpts: frameOpts2,\n transitionOpts: transitionOpts2\n };\n if (i2 === frameList2.length - 1) {\n nextFrame2.onComplete = callbackOnNthTime(resolve, 2);\n nextFrame2.onInterrupt = reject;\n }\n trans._frameQueue.push(nextFrame2);\n }\n if (animationOpts.mode === \"immediate\") {\n trans._lastFrameAt = -Infinity;\n }\n if (!trans._animationRaf) {\n beginAnimationLoop();\n }\n }\n function stopAnimationLoop() {\n gd.emit(\"plotly_animated\");\n window.cancelAnimationFrame(trans._animationRaf);\n trans._animationRaf = null;\n }\n function nextFrame() {\n if (trans._currentFrame && trans._currentFrame.onComplete) {\n trans._currentFrame.onComplete();\n }\n var newFrame = trans._currentFrame = trans._frameQueue.shift();\n if (newFrame) {\n var stringName = newFrame.name ? newFrame.name.toString() : null;\n gd._fullLayout._currentFrame = stringName;\n trans._lastFrameAt = Date.now();\n trans._timeToNext = newFrame.frameOpts.duration;\n Plots.transition(\n gd,\n newFrame.frame.data,\n newFrame.frame.layout,\n helpers.coerceTraceIndices(gd, newFrame.frame.traces),\n newFrame.frameOpts,\n newFrame.transitionOpts\n ).then(function() {\n if (newFrame.onComplete) {\n newFrame.onComplete();\n }\n });\n gd.emit(\"plotly_animatingframe\", {\n name: stringName,\n frame: newFrame.frame,\n animation: {\n frame: newFrame.frameOpts,\n transition: newFrame.transitionOpts\n }\n });\n } else {\n stopAnimationLoop();\n }\n }\n function beginAnimationLoop() {\n gd.emit(\"plotly_animating\");\n trans._lastFrameAt = -Infinity;\n trans._timeToNext = 0;\n trans._runningTransitions = 0;\n trans._currentFrame = null;\n var doFrame = function() {\n trans._animationRaf = window.requestAnimationFrame(doFrame);\n if (Date.now() - trans._lastFrameAt > trans._timeToNext) {\n nextFrame();\n }\n };\n doFrame();\n }\n var configCounter = 0;\n function setTransitionConfig(frame2) {\n if (Array.isArray(transitionOpts)) {\n if (configCounter >= transitionOpts.length) {\n frame2.transitionOpts = transitionOpts[configCounter];\n } else {\n frame2.transitionOpts = transitionOpts[0];\n }\n } else {\n frame2.transitionOpts = transitionOpts;\n }\n configCounter++;\n return frame2;\n }\n var i, frame;\n var frameList = [];\n var allFrames = frameOrGroupNameOrFrameList === void 0 || frameOrGroupNameOrFrameList === null;\n var isFrameArray = Array.isArray(frameOrGroupNameOrFrameList);\n var isSingleFrame = !allFrames && !isFrameArray && Lib.isPlainObject(frameOrGroupNameOrFrameList);\n if (isSingleFrame) {\n frameList.push({\n type: \"object\",\n data: setTransitionConfig(Lib.extendFlat({}, frameOrGroupNameOrFrameList))\n });\n } else if (allFrames || [\"string\", \"number\"].indexOf(typeof frameOrGroupNameOrFrameList) !== -1) {\n for (i = 0; i < trans._frames.length; i++) {\n frame = trans._frames[i];\n if (!frame) continue;\n if (allFrames || String(frame.group) === String(frameOrGroupNameOrFrameList)) {\n frameList.push({\n type: \"byname\",\n name: String(frame.name),\n data: setTransitionConfig({ name: frame.name })\n });\n }\n }\n } else if (isFrameArray) {\n for (i = 0; i < frameOrGroupNameOrFrameList.length; i++) {\n var frameOrName = frameOrGroupNameOrFrameList[i];\n if ([\"number\", \"string\"].indexOf(typeof frameOrName) !== -1) {\n frameOrName = String(frameOrName);\n frameList.push({\n type: \"byname\",\n name: frameOrName,\n data: setTransitionConfig({ name: frameOrName })\n });\n } else if (Lib.isPlainObject(frameOrName)) {\n frameList.push({\n type: \"object\",\n data: setTransitionConfig(Lib.extendFlat({}, frameOrName))\n });\n }\n }\n }\n for (i = 0; i < frameList.length; i++) {\n frame = frameList[i];\n if (frame.type === \"byname\" && !trans._frameHash[frame.data.name]) {\n Lib.warn('animate failure: frame not found: \"' + frame.data.name + '\"');\n reject();\n return;\n }\n }\n if ([\"next\", \"immediate\"].indexOf(animationOpts.mode) !== -1) {\n discardExistingFrames();\n }\n if (animationOpts.direction === \"reverse\") {\n frameList.reverse();\n }\n var currentFrame = gd._fullLayout._currentFrame;\n if (currentFrame && animationOpts.fromcurrent) {\n var idx = -1;\n for (i = 0; i < frameList.length; i++) {\n frame = frameList[i];\n if (frame.type === \"byname\" && frame.name === currentFrame) {\n idx = i;\n break;\n }\n }\n if (idx > 0 && idx < frameList.length - 1) {\n var filteredFrameList = [];\n for (i = 0; i < frameList.length; i++) {\n frame = frameList[i];\n if (frameList[i].type !== \"byname\" || i > idx) {\n filteredFrameList.push(frame);\n }\n }\n frameList = filteredFrameList;\n }\n }\n if (frameList.length > 0) {\n queueFrames(frameList);\n } else {\n gd.emit(\"plotly_animated\");\n resolve();\n }\n });\n }\n function addFrames(gd, frameList, indices) {\n gd = Lib.getGraphDiv(gd);\n if (frameList === null || frameList === void 0) {\n return Promise.resolve();\n }\n if (!Lib.isPlotDiv(gd)) {\n throw new Error(\n \"This element is not a Plotly plot: \" + gd + \". It's likely that you've failed to create a plot before adding frames. For more details, see https://plotly.com/javascript/animations/\"\n );\n }\n var i, frame, j, idx;\n var _frames = gd._transitionData._frames;\n var _frameHash = gd._transitionData._frameHash;\n if (!Array.isArray(frameList)) {\n throw new Error(\"addFrames failure: frameList must be an Array of frame definitions\" + frameList);\n }\n var bigIndex = _frames.length + frameList.length * 2;\n var insertions = [];\n var _frameHashLocal = {};\n for (i = frameList.length - 1; i >= 0; i--) {\n if (!Lib.isPlainObject(frameList[i])) continue;\n var lookupName = frameList[i].name;\n var name2 = (_frameHash[lookupName] || _frameHashLocal[lookupName] || {}).name;\n var newName = frameList[i].name;\n var collisionPresent = _frameHash[name2] || _frameHashLocal[name2];\n if (name2 && newName && typeof newName === \"number\" && collisionPresent && numericNameWarningCount < numericNameWarningCountLimit) {\n numericNameWarningCount++;\n Lib.warn('addFrames: overwriting frame \"' + (_frameHash[name2] || _frameHashLocal[name2]).name + '\" with a frame whose name of type \"number\" also equates to \"' + name2 + '\". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.');\n if (numericNameWarningCount === numericNameWarningCountLimit) {\n Lib.warn(\"addFrames: This API call has yielded too many of these warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.\");\n }\n }\n _frameHashLocal[lookupName] = { name: lookupName };\n insertions.push({\n frame: Plots.supplyFrameDefaults(frameList[i]),\n index: indices && indices[i] !== void 0 && indices[i] !== null ? indices[i] : bigIndex + i\n });\n }\n insertions.sort(function(a, b) {\n if (a.index > b.index) return -1;\n if (a.index < b.index) return 1;\n return 0;\n });\n var ops = [];\n var revops = [];\n var frameCount = _frames.length;\n for (i = insertions.length - 1; i >= 0; i--) {\n frame = insertions[i].frame;\n if (typeof frame.name === \"number\") {\n Lib.warn(\"Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings\");\n }\n if (!frame.name) {\n while (_frameHash[frame.name = \"frame \" + gd._transitionData._counter++]) ;\n }\n if (_frameHash[frame.name]) {\n for (j = 0; j < _frames.length; j++) {\n if ((_frames[j] || {}).name === frame.name) break;\n }\n ops.push({ type: \"replace\", index: j, value: frame });\n revops.unshift({ type: \"replace\", index: j, value: _frames[j] });\n } else {\n idx = Math.max(0, Math.min(insertions[i].index, frameCount));\n ops.push({ type: \"insert\", index: idx, value: frame });\n revops.unshift({ type: \"delete\", index: idx });\n frameCount++;\n }\n }\n var undoFunc = Plots.modifyFrames;\n var redoFunc = Plots.modifyFrames;\n var undoArgs = [gd, revops];\n var redoArgs = [gd, ops];\n if (Queue) Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);\n return Plots.modifyFrames(gd, ops);\n }\n function deleteFrames(gd, frameList) {\n gd = Lib.getGraphDiv(gd);\n if (!Lib.isPlotDiv(gd)) {\n throw new Error(\"This element is not a Plotly plot: \" + gd);\n }\n var i, idx;\n var _frames = gd._transitionData._frames;\n var ops = [];\n var revops = [];\n if (!frameList) {\n frameList = [];\n for (i = 0; i < _frames.length; i++) {\n frameList.push(i);\n }\n }\n frameList = frameList.slice();\n frameList.sort();\n for (i = frameList.length - 1; i >= 0; i--) {\n idx = frameList[i];\n ops.push({ type: \"delete\", index: idx });\n revops.unshift({ type: \"insert\", index: idx, value: _frames[idx] });\n }\n var undoFunc = Plots.modifyFrames;\n var redoFunc = Plots.modifyFrames;\n var undoArgs = [gd, revops];\n var redoArgs = [gd, ops];\n if (Queue) Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);\n return Plots.modifyFrames(gd, ops);\n }\n function purge(gd) {\n gd = Lib.getGraphDiv(gd);\n var fullLayout = gd._fullLayout || {};\n var fullData = gd._fullData || [];\n Plots.cleanPlot([], {}, fullData, fullLayout);\n Plots.purge(gd);\n Events.purge(gd);\n if (fullLayout._container) fullLayout._container.remove();\n delete gd._context;\n return gd;\n }\n function calcInverseTransform(gd) {\n var fullLayout = gd._fullLayout;\n var newBBox = gd.getBoundingClientRect();\n if (Lib.equalDomRects(newBBox, fullLayout._lastBBox)) return;\n var m = fullLayout._invTransform = Lib.inverseTransformMatrix(Lib.getFullTransformMatrix(gd));\n fullLayout._invScaleX = Math.sqrt(m[0][0] * m[0][0] + m[0][1] * m[0][1] + m[0][2] * m[0][2]);\n fullLayout._invScaleY = Math.sqrt(m[1][0] * m[1][0] + m[1][1] * m[1][1] + m[1][2] * m[1][2]);\n fullLayout._lastBBox = newBBox;\n }\n function makePlotFramework(gd) {\n var gd3 = d3.select(gd);\n var fullLayout = gd._fullLayout;\n fullLayout._calcInverseTransform = calcInverseTransform;\n fullLayout._calcInverseTransform(gd);\n fullLayout._container = gd3.selectAll(\".plot-container\").data([0]);\n fullLayout._container.enter().insert(\"div\", \":first-child\").classed(\"plot-container\", true).classed(\"plotly\", true).style({\n width: \"100%\",\n height: \"100%\"\n });\n fullLayout._paperdiv = fullLayout._container.selectAll(\".svg-container\").data([0]);\n fullLayout._paperdiv.enter().append(\"div\").classed(\"user-select-none\", true).classed(\"svg-container\", true).style(\"position\", \"relative\");\n fullLayout._glcontainer = fullLayout._paperdiv.selectAll(\".gl-container\").data([{}]);\n fullLayout._glcontainer.enter().append(\"div\").classed(\"gl-container\", true);\n fullLayout._paperdiv.selectAll(\".main-svg\").remove();\n fullLayout._paperdiv.select(\".modebar-container\").remove();\n fullLayout._paper = fullLayout._paperdiv.insert(\"svg\", \":first-child\").classed(\"main-svg\", true);\n fullLayout._toppaper = fullLayout._paperdiv.append(\"svg\").classed(\"main-svg\", true);\n fullLayout._modebardiv = fullLayout._paperdiv.append(\"div\");\n delete fullLayout._modeBar;\n fullLayout._hoverpaper = fullLayout._paperdiv.append(\"svg\").classed(\"main-svg\", true);\n if (!fullLayout._uid) {\n var otherUids = {};\n d3.selectAll(\"defs\").each(function() {\n if (this.id) otherUids[this.id.split(\"-\")[1]] = 1;\n });\n fullLayout._uid = Lib.randstr(otherUids);\n }\n fullLayout._paperdiv.selectAll(\".main-svg\").attr(xmlnsNamespaces.svgAttrs);\n fullLayout._defs = fullLayout._paper.append(\"defs\").attr(\"id\", \"defs-\" + fullLayout._uid);\n fullLayout._clips = fullLayout._defs.append(\"g\").classed(\"clips\", true);\n fullLayout._topdefs = fullLayout._toppaper.append(\"defs\").attr(\"id\", \"topdefs-\" + fullLayout._uid);\n fullLayout._topclips = fullLayout._topdefs.append(\"g\").classed(\"clips\", true);\n fullLayout._bgLayer = fullLayout._paper.append(\"g\").classed(\"bglayer\", true);\n fullLayout._draggers = fullLayout._paper.append(\"g\").classed(\"draglayer\", true);\n var layerBelow = fullLayout._paper.append(\"g\").classed(\"layer-below\", true);\n fullLayout._imageLowerLayer = layerBelow.append(\"g\").classed(\"imagelayer\", true);\n fullLayout._shapeLowerLayer = layerBelow.append(\"g\").classed(\"shapelayer\", true);\n fullLayout._cartesianlayer = fullLayout._paper.append(\"g\").classed(\"cartesianlayer\", true);\n fullLayout._polarlayer = fullLayout._paper.append(\"g\").classed(\"polarlayer\", true);\n fullLayout._smithlayer = fullLayout._paper.append(\"g\").classed(\"smithlayer\", true);\n fullLayout._ternarylayer = fullLayout._paper.append(\"g\").classed(\"ternarylayer\", true);\n fullLayout._geolayer = fullLayout._paper.append(\"g\").classed(\"geolayer\", true);\n fullLayout._funnelarealayer = fullLayout._paper.append(\"g\").classed(\"funnelarealayer\", true);\n fullLayout._pielayer = fullLayout._paper.append(\"g\").classed(\"pielayer\", true);\n fullLayout._iciclelayer = fullLayout._paper.append(\"g\").classed(\"iciclelayer\", true);\n fullLayout._treemaplayer = fullLayout._paper.append(\"g\").classed(\"treemaplayer\", true);\n fullLayout._sunburstlayer = fullLayout._paper.append(\"g\").classed(\"sunburstlayer\", true);\n fullLayout._indicatorlayer = fullLayout._toppaper.append(\"g\").classed(\"indicatorlayer\", true);\n fullLayout._glimages = fullLayout._paper.append(\"g\").classed(\"glimages\", true);\n var layerAbove = fullLayout._toppaper.append(\"g\").classed(\"layer-above\", true);\n fullLayout._imageUpperLayer = layerAbove.append(\"g\").classed(\"imagelayer\", true);\n fullLayout._shapeUpperLayer = layerAbove.append(\"g\").classed(\"shapelayer\", true);\n fullLayout._selectionLayer = fullLayout._toppaper.append(\"g\").classed(\"selectionlayer\", true);\n fullLayout._infolayer = fullLayout._toppaper.append(\"g\").classed(\"infolayer\", true);\n fullLayout._menulayer = fullLayout._toppaper.append(\"g\").classed(\"menulayer\", true);\n fullLayout._zoomlayer = fullLayout._toppaper.append(\"g\").classed(\"zoomlayer\", true);\n fullLayout._hoverlayer = fullLayout._hoverpaper.append(\"g\").classed(\"hoverlayer\", true);\n fullLayout._modebardiv.classed(\"modebar-container\", true).style(\"position\", \"absolute\").style(\"top\", \"0px\").style(\"right\", \"0px\");\n gd.emit(\"plotly_framework\");\n }\n exports.animate = animate;\n exports.addFrames = addFrames;\n exports.deleteFrames = deleteFrames;\n exports.addTraces = addTraces;\n exports.deleteTraces = deleteTraces;\n exports.extendTraces = extendTraces;\n exports.moveTraces = moveTraces;\n exports.prependTraces = prependTraces;\n exports.newPlot = newPlot;\n exports._doPlot = _doPlot;\n exports.purge = purge;\n exports.react = react;\n exports.redraw = redraw;\n exports.relayout = relayout;\n exports.restyle = restyle;\n exports.setPlotConfig = setPlotConfig;\n exports.update = update;\n exports._guiRelayout = guiEdit(relayout);\n exports._guiRestyle = guiEdit(restyle);\n exports._guiUpdate = guiEdit(update);\n exports._storeDirectGUIEdit = _storeDirectGUIEdit;\n }\n });\n\n // src/snapshot/helpers.js\n var require_helpers10 = __commonJS({\n \"src/snapshot/helpers.js\"(exports) {\n \"use strict\";\n var Registry = require_registry();\n exports.getDelay = function(fullLayout) {\n if (!fullLayout._has) return 0;\n return fullLayout._has(\"gl3d\") || fullLayout._has(\"mapbox\") || fullLayout._has(\"map\") ? 500 : 0;\n };\n exports.getRedrawFunc = function(gd) {\n return function() {\n Registry.getComponentMethod(\"colorbar\", \"draw\")(gd);\n };\n };\n exports.encodeSVG = function(svg) {\n return \"data:image/svg+xml,\" + encodeURIComponent(svg);\n };\n exports.encodeJSON = function(json) {\n return \"data:application/json,\" + encodeURIComponent(json);\n };\n var DOM_URL = window.URL || window.webkitURL;\n exports.createObjectURL = function(blob) {\n return DOM_URL.createObjectURL(blob);\n };\n exports.revokeObjectURL = function(url) {\n return DOM_URL.revokeObjectURL(url);\n };\n exports.createBlob = function(url, format) {\n if (format === \"svg\") {\n return new window.Blob([url], { type: \"image/svg+xml;charset=utf-8\" });\n } else if (format === \"full-json\") {\n return new window.Blob([url], { type: \"application/json;charset=utf-8\" });\n } else {\n var binary = fixBinary(window.atob(url));\n return new window.Blob([binary], { type: \"image/\" + format });\n }\n };\n exports.octetStream = function(s) {\n document.location.href = \"data:application/octet-stream\" + s;\n };\n function fixBinary(b) {\n var len = b.length;\n var buf = new ArrayBuffer(len);\n var arr = new Uint8Array(buf);\n for (var i = 0; i < len; i++) {\n arr[i] = b.charCodeAt(i);\n }\n return buf;\n }\n exports.IMAGE_URL_PREFIX = /^data:image\\/\\w+;base64,/;\n }\n });\n\n // src/snapshot/tosvg.js\n var require_tosvg = __commonJS({\n \"src/snapshot/tosvg.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var Drawing = require_drawing();\n var Color2 = require_color();\n var xmlnsNamespaces = require_xmlns_namespaces();\n var DOUBLEQUOTE_REGEX = /\"/g;\n var DUMMY_SUB = \"TOBESTRIPPED\";\n var DUMMY_REGEX = new RegExp('(\"' + DUMMY_SUB + \")|(\" + DUMMY_SUB + '\")', \"g\");\n function htmlEntityDecode(s) {\n var hiddenDiv = d3.select(\"body\").append(\"div\").style({ display: \"none\" }).html(\"\");\n var replaced = s.replace(/(&[^;]*;)/gi, function(d) {\n if (d === \"<\") {\n return \"<\";\n }\n if (d === \"&rt;\") {\n return \">\";\n }\n if (d.indexOf(\"<\") !== -1 || d.indexOf(\">\") !== -1) {\n return \"\";\n }\n return hiddenDiv.html(d).text();\n });\n hiddenDiv.remove();\n return replaced;\n }\n function xmlEntityEncode(str) {\n return str.replace(/&(?!\\w+;|\\#[0-9]+;| \\#x[0-9A-F]+;)/g, \"&\");\n }\n module.exports = function toSVG(gd, format, scale) {\n var fullLayout = gd._fullLayout;\n var svg = fullLayout._paper;\n var toppaper = fullLayout._toppaper;\n var width = fullLayout.width;\n var height = fullLayout.height;\n var i;\n svg.insert(\"rect\", \":first-child\").call(Drawing.setRect, 0, 0, width, height).call(Color2.fill, fullLayout.paper_bgcolor);\n var basePlotModules = fullLayout._basePlotModules || [];\n for (i = 0; i < basePlotModules.length; i++) {\n var _module = basePlotModules[i];\n if (_module.toSVG) _module.toSVG(gd);\n }\n if (toppaper) {\n var nodes = toppaper.node().childNodes;\n var topGroups = Array.prototype.slice.call(nodes);\n for (i = 0; i < topGroups.length; i++) {\n var topGroup = topGroups[i];\n if (topGroup.childNodes.length) svg.node().appendChild(topGroup);\n }\n }\n if (fullLayout._draggers) {\n fullLayout._draggers.remove();\n }\n svg.node().style.background = \"\";\n svg.selectAll(\"text\").attr({ \"data-unformatted\": null, \"data-math\": null }).each(function() {\n var txt = d3.select(this);\n if (this.style.visibility === \"hidden\" || this.style.display === \"none\") {\n txt.remove();\n return;\n } else {\n txt.style({ visibility: null, display: null });\n }\n var ff = this.style.fontFamily;\n if (ff && ff.indexOf('\"') !== -1) {\n txt.style(\"font-family\", ff.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB));\n }\n var fw = this.style.fontWeight;\n if (fw && (fw === \"normal\" || fw === \"400\")) {\n txt.style(\"font-weight\", void 0);\n }\n var fs = this.style.fontStyle;\n if (fs && fs === \"normal\") {\n txt.style(\"font-style\", void 0);\n }\n var fv = this.style.fontVariant;\n if (fv && fv === \"normal\") {\n txt.style(\"font-variant\", void 0);\n }\n });\n svg.selectAll(\".gradient_filled,.pattern_filled\").each(function() {\n var pt = d3.select(this);\n var fill = this.style.fill;\n if (fill && fill.indexOf(\"url(\") !== -1) {\n pt.style(\"fill\", fill.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB));\n }\n var stroke = this.style.stroke;\n if (stroke && stroke.indexOf(\"url(\") !== -1) {\n pt.style(\"stroke\", stroke.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB));\n }\n });\n if (format === \"pdf\" || format === \"eps\") {\n svg.selectAll(\"#MathJax_SVG_glyphs path\").attr(\"stroke-width\", 0);\n }\n if (format === \"svg\" && scale) {\n svg.attr(\"width\", scale * width);\n svg.attr(\"height\", scale * height);\n svg.attr(\"viewBox\", \"0 0 \" + width + \" \" + height);\n }\n var s = new window.XMLSerializer().serializeToString(svg.node());\n s = htmlEntityDecode(s);\n s = xmlEntityEncode(s);\n s = s.replace(DUMMY_REGEX, \"'\");\n return s;\n };\n }\n });\n\n // src/snapshot/svgtoimg.js\n var require_svgtoimg = __commonJS({\n \"src/snapshot/svgtoimg.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var EventEmitter = require_events().EventEmitter;\n var helpers = require_helpers10();\n function svgToImg(opts) {\n var ev = opts.emitter || new EventEmitter();\n var promise = new Promise(function(resolve, reject) {\n var Image2 = window.Image;\n var svg = opts.svg;\n var format = opts.format || \"png\";\n var canvas = opts.canvas;\n var scale = opts.scale || 1;\n var w0 = opts.width || 300;\n var h0 = opts.height || 150;\n var w1 = scale * w0;\n var h1 = scale * h0;\n var ctx = canvas.getContext(\"2d\", { willReadFrequently: true });\n var img = new Image2();\n var svgBlob, url;\n if (format === \"svg\" || Lib.isSafari()) {\n url = helpers.encodeSVG(svg);\n } else {\n svgBlob = helpers.createBlob(svg, \"svg\");\n url = helpers.createObjectURL(svgBlob);\n }\n canvas.width = w1;\n canvas.height = h1;\n img.onload = function() {\n var imgData;\n svgBlob = null;\n helpers.revokeObjectURL(url);\n if (format !== \"svg\") {\n ctx.drawImage(img, 0, 0, w1, h1);\n }\n switch (format) {\n case \"jpeg\":\n imgData = canvas.toDataURL(\"image/jpeg\");\n break;\n case \"png\":\n imgData = canvas.toDataURL(\"image/png\");\n break;\n case \"webp\":\n imgData = canvas.toDataURL(\"image/webp\");\n break;\n case \"svg\":\n imgData = url;\n break;\n default:\n var errorMsg = \"Image format is not jpeg, png, svg or webp.\";\n reject(new Error(errorMsg));\n if (!opts.promise) {\n return ev.emit(\"error\", errorMsg);\n }\n }\n resolve(imgData);\n if (!opts.promise) {\n ev.emit(\"success\", imgData);\n }\n };\n img.onerror = function(err) {\n svgBlob = null;\n helpers.revokeObjectURL(url);\n reject(err);\n if (!opts.promise) {\n return ev.emit(\"error\", err);\n }\n };\n img.src = url;\n });\n if (opts.promise) {\n return promise;\n }\n return ev;\n }\n module.exports = svgToImg;\n }\n });\n\n // src/plot_api/to_image.js\n var require_to_image = __commonJS({\n \"src/plot_api/to_image.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var plotApi = require_plot_api();\n var plots = require_plots();\n var Lib = require_lib();\n var helpers = require_helpers10();\n var toSVG = require_tosvg();\n var svgToImg = require_svgtoimg();\n var version = require_version().version;\n var attrs = {\n format: {\n valType: \"enumerated\",\n values: [\"png\", \"jpeg\", \"webp\", \"svg\", \"full-json\"],\n dflt: \"png\"\n },\n width: {\n valType: \"number\",\n min: 1\n },\n height: {\n valType: \"number\",\n min: 1\n },\n scale: {\n valType: \"number\",\n min: 0,\n dflt: 1\n },\n setBackground: {\n valType: \"any\",\n dflt: false\n },\n imageDataOnly: {\n valType: \"boolean\",\n dflt: false\n }\n };\n function toImage(gd, opts) {\n opts = opts || {};\n var data;\n var layout;\n var config;\n var fullLayout;\n if (Lib.isPlainObject(gd)) {\n data = gd.data || [];\n layout = gd.layout || {};\n config = gd.config || {};\n fullLayout = {};\n } else {\n gd = Lib.getGraphDiv(gd);\n data = Lib.extendDeep([], gd.data);\n layout = Lib.extendDeep({}, gd.layout);\n config = gd._context;\n fullLayout = gd._fullLayout || {};\n }\n function isImpliedOrValid(attr) {\n return !(attr in opts) || Lib.validate(opts[attr], attrs[attr]);\n }\n if (!isImpliedOrValid(\"width\") && opts.width !== null || !isImpliedOrValid(\"height\") && opts.height !== null) {\n throw new Error(\"Height and width should be pixel values.\");\n }\n if (!isImpliedOrValid(\"format\")) {\n throw new Error(\"Export format is not \" + Lib.join2(attrs.format.values, \", \", \" or \") + \".\");\n }\n var fullOpts = {};\n function coerce(attr, dflt) {\n return Lib.coerce(opts, fullOpts, attrs, attr, dflt);\n }\n var format = coerce(\"format\");\n var width = coerce(\"width\");\n var height = coerce(\"height\");\n var scale = coerce(\"scale\");\n var setBackground = coerce(\"setBackground\");\n var imageDataOnly = coerce(\"imageDataOnly\");\n var clonedGd = document.createElement(\"div\");\n clonedGd.style.position = \"absolute\";\n clonedGd.style.left = \"-5000px\";\n document.body.appendChild(clonedGd);\n var layoutImage = Lib.extendFlat({}, layout);\n if (width) {\n layoutImage.width = width;\n } else if (opts.width === null && isNumeric(fullLayout.width)) {\n layoutImage.width = fullLayout.width;\n }\n if (height) {\n layoutImage.height = height;\n } else if (opts.height === null && isNumeric(fullLayout.height)) {\n layoutImage.height = fullLayout.height;\n }\n var configImage = Lib.extendFlat({}, config, {\n _exportedPlot: true,\n staticPlot: true,\n setBackground\n });\n var redrawFunc = helpers.getRedrawFunc(clonedGd);\n function wait() {\n return new Promise(function(resolve) {\n setTimeout(resolve, helpers.getDelay(clonedGd._fullLayout));\n });\n }\n function convert() {\n return new Promise(function(resolve, reject) {\n var svg = toSVG(clonedGd, format, scale);\n var width2 = clonedGd._fullLayout.width;\n var height2 = clonedGd._fullLayout.height;\n function cleanup() {\n plotApi.purge(clonedGd);\n document.body.removeChild(clonedGd);\n }\n if (format === \"full-json\") {\n var json = plots.graphJson(clonedGd, false, \"keepdata\", \"object\", true, true);\n json.version = version;\n json = JSON.stringify(json);\n cleanup();\n if (imageDataOnly) {\n return resolve(json);\n } else {\n return resolve(helpers.encodeJSON(json));\n }\n }\n cleanup();\n if (format === \"svg\") {\n if (imageDataOnly) {\n return resolve(svg);\n } else {\n return resolve(helpers.encodeSVG(svg));\n }\n }\n var canvas = document.createElement(\"canvas\");\n canvas.id = Lib.randstr();\n svgToImg({\n format,\n width: width2,\n height: height2,\n scale,\n canvas,\n svg,\n // ask svgToImg to return a Promise\n // rather than EventEmitter\n // leave EventEmitter for backward\n // compatibility\n promise: true\n }).then(resolve).catch(reject);\n });\n }\n function urlToImageData(url) {\n if (imageDataOnly) {\n return url.replace(helpers.IMAGE_URL_PREFIX, \"\");\n } else {\n return url;\n }\n }\n return new Promise(function(resolve, reject) {\n plotApi.newPlot(clonedGd, data, layoutImage, configImage).then(redrawFunc).then(wait).then(convert).then(function(url) {\n resolve(urlToImageData(url));\n }).catch(function(err) {\n reject(err);\n });\n });\n }\n module.exports = toImage;\n }\n });\n\n // src/plot_api/validate.js\n var require_validate = __commonJS({\n \"src/plot_api/validate.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Plots = require_plots();\n var PlotSchema = require_plot_schema();\n var dfltConfig = require_plot_config().dfltConfig;\n var isPlainObject = Lib.isPlainObject;\n var isArray = Array.isArray;\n var isArrayOrTypedArray = Lib.isArrayOrTypedArray;\n module.exports = function validate(data, layout) {\n if (data === void 0) data = [];\n if (layout === void 0) layout = {};\n var schema = PlotSchema.get();\n var errorList = [];\n var gd = { _context: Lib.extendFlat({}, dfltConfig) };\n var dataIn, layoutIn;\n if (isArray(data)) {\n gd.data = Lib.extendDeep([], data);\n dataIn = data;\n } else {\n gd.data = [];\n dataIn = [];\n errorList.push(format(\"array\", \"data\"));\n }\n if (isPlainObject(layout)) {\n gd.layout = Lib.extendDeep({}, layout);\n layoutIn = layout;\n } else {\n gd.layout = {};\n layoutIn = {};\n if (arguments.length > 1) {\n errorList.push(format(\"object\", \"layout\"));\n }\n }\n Plots.supplyDefaults(gd);\n var dataOut = gd._fullData;\n var len = dataIn.length;\n for (var i = 0; i < len; i++) {\n var traceIn = dataIn[i];\n var base = [\"data\", i];\n if (!isPlainObject(traceIn)) {\n errorList.push(format(\"object\", base));\n continue;\n }\n var traceOut = dataOut[i];\n var traceType = traceOut.type;\n var traceSchema = schema.traces[traceType].attributes;\n traceSchema.type = {\n valType: \"enumerated\",\n values: [traceType]\n };\n if (traceOut.visible === false && traceIn.visible !== false) {\n errorList.push(format(\"invisible\", base));\n }\n crawl(traceIn, traceOut, traceSchema, errorList, base);\n }\n var layoutOut = gd._fullLayout;\n var layoutSchema = fillLayoutSchema(schema, dataOut);\n crawl(layoutIn, layoutOut, layoutSchema, errorList, \"layout\");\n return errorList.length === 0 ? void 0 : errorList;\n };\n function crawl(objIn, objOut, schema, list, base, path) {\n path = path || [];\n var keys = Object.keys(objIn);\n for (var i = 0; i < keys.length; i++) {\n var k = keys[i];\n var p = path.slice();\n p.push(k);\n var valIn = objIn[k];\n var valOut = objOut[k];\n var nestedSchema = getNestedSchema(schema, k);\n var nestedValType = (nestedSchema || {}).valType;\n var isInfoArray = nestedValType === \"info_array\";\n var isColorscale = nestedValType === \"colorscale\";\n var items = (nestedSchema || {}).items;\n if (!isInSchema(schema, k)) {\n list.push(format(\"schema\", base, p));\n } else if (isPlainObject(valIn) && isPlainObject(valOut) && nestedValType !== \"any\") {\n crawl(valIn, valOut, nestedSchema, list, base, p);\n } else if (isInfoArray && isArray(valIn)) {\n if (valIn.length > valOut.length) {\n list.push(format(\"unused\", base, p.concat(valOut.length)));\n }\n var len = valOut.length;\n var arrayItems = Array.isArray(items);\n if (arrayItems) len = Math.min(len, items.length);\n var m, n, item, valInPart, valOutPart;\n if (nestedSchema.dimensions === 2) {\n for (n = 0; n < len; n++) {\n if (isArray(valIn[n])) {\n if (valIn[n].length > valOut[n].length) {\n list.push(format(\"unused\", base, p.concat(n, valOut[n].length)));\n }\n var len2 = valOut[n].length;\n for (m = 0; m < (arrayItems ? Math.min(len2, items[n].length) : len2); m++) {\n item = arrayItems ? items[n][m] : items;\n valInPart = valIn[n][m];\n valOutPart = valOut[n][m];\n if (!Lib.validate(valInPart, item)) {\n list.push(format(\"value\", base, p.concat(n, m), valInPart));\n } else if (valOutPart !== valInPart && valOutPart !== +valInPart) {\n list.push(format(\"dynamic\", base, p.concat(n, m), valInPart, valOutPart));\n }\n }\n } else {\n list.push(format(\"array\", base, p.concat(n), valIn[n]));\n }\n }\n } else {\n for (n = 0; n < len; n++) {\n item = arrayItems ? items[n] : items;\n valInPart = valIn[n];\n valOutPart = valOut[n];\n if (!Lib.validate(valInPart, item)) {\n list.push(format(\"value\", base, p.concat(n), valInPart));\n } else if (valOutPart !== valInPart && valOutPart !== +valInPart) {\n list.push(format(\"dynamic\", base, p.concat(n), valInPart, valOutPart));\n }\n }\n }\n } else if (nestedSchema.items && !isInfoArray && isArray(valIn)) {\n var _nestedSchema = items[Object.keys(items)[0]];\n var indexList = [];\n var j, _p;\n for (j = 0; j < valOut.length; j++) {\n var _index = valOut[j]._index || j;\n _p = p.slice();\n _p.push(_index);\n if (isPlainObject(valIn[_index]) && isPlainObject(valOut[j])) {\n indexList.push(_index);\n var valInj = valIn[_index];\n var valOutj = valOut[j];\n if (isPlainObject(valInj) && valInj.visible !== false && valOutj.visible === false) {\n list.push(format(\"invisible\", base, _p));\n } else crawl(valInj, valOutj, _nestedSchema, list, base, _p);\n }\n }\n for (j = 0; j < valIn.length; j++) {\n _p = p.slice();\n _p.push(j);\n if (!isPlainObject(valIn[j])) {\n list.push(format(\"object\", base, _p, valIn[j]));\n } else if (indexList.indexOf(j) === -1) {\n list.push(format(\"unused\", base, _p));\n }\n }\n } else if (!isPlainObject(valIn) && isPlainObject(valOut)) {\n list.push(format(\"object\", base, p, valIn));\n } else if (!isArrayOrTypedArray(valIn) && isArrayOrTypedArray(valOut) && !isInfoArray && !isColorscale) {\n list.push(format(\"array\", base, p, valIn));\n } else if (!(k in objOut)) {\n list.push(format(\"unused\", base, p, valIn));\n } else if (!Lib.validate(valIn, nestedSchema)) {\n list.push(format(\"value\", base, p, valIn));\n } else if (nestedSchema.valType === \"enumerated\" && (nestedSchema.coerceNumber && valIn !== +valOut || valIn !== valOut)) {\n list.push(format(\"dynamic\", base, p, valIn, valOut));\n }\n }\n return list;\n }\n function fillLayoutSchema(schema, dataOut) {\n var layoutSchema = schema.layout.layoutAttributes;\n for (var i = 0; i < dataOut.length; i++) {\n var traceOut = dataOut[i];\n var traceSchema = schema.traces[traceOut.type];\n var traceLayoutAttr = traceSchema.layoutAttributes;\n if (traceLayoutAttr) {\n if (traceOut.subplot) {\n Lib.extendFlat(layoutSchema[traceSchema.attributes.subplot.dflt], traceLayoutAttr);\n } else {\n Lib.extendFlat(layoutSchema, traceLayoutAttr);\n }\n }\n }\n return layoutSchema;\n }\n var code2msgFunc = {\n object: function(base, astr) {\n var prefix;\n if (base === \"layout\" && astr === \"\") prefix = \"The layout argument\";\n else if (base[0] === \"data\" && astr === \"\") {\n prefix = \"Trace \" + base[1] + \" in the data argument\";\n } else prefix = inBase(base) + \"key \" + astr;\n return prefix + \" must be linked to an object container\";\n },\n array: function(base, astr) {\n var prefix;\n if (base === \"data\") prefix = \"The data argument\";\n else prefix = inBase(base) + \"key \" + astr;\n return prefix + \" must be linked to an array container\";\n },\n schema: function(base, astr) {\n return inBase(base) + \"key \" + astr + \" is not part of the schema\";\n },\n unused: function(base, astr, valIn) {\n var target = isPlainObject(valIn) ? \"container\" : \"key\";\n return inBase(base) + target + \" \" + astr + \" did not get coerced\";\n },\n dynamic: function(base, astr, valIn, valOut) {\n return [\n inBase(base) + \"key\",\n astr,\n \"(set to '\" + valIn + \"')\",\n \"got reset to\",\n \"'\" + valOut + \"'\",\n \"during defaults.\"\n ].join(\" \");\n },\n invisible: function(base, astr) {\n return (astr ? inBase(base) + \"item \" + astr : \"Trace \" + base[1]) + \" got defaulted to be not visible\";\n },\n value: function(base, astr, valIn) {\n return [\n inBase(base) + \"key \" + astr,\n \"is set to an invalid value (\" + valIn + \")\"\n ].join(\" \");\n }\n };\n function inBase(base) {\n if (isArray(base)) return \"In data trace \" + base[1] + \", \";\n return \"In \" + base + \", \";\n }\n function format(code, base, path, valIn, valOut) {\n path = path || \"\";\n var container, trace;\n if (isArray(base)) {\n container = base[0];\n trace = base[1];\n } else {\n container = base;\n trace = null;\n }\n var astr = convertPathToAttributeString(path);\n var msg = code2msgFunc[code](base, astr, valIn, valOut);\n Lib.log(msg);\n return {\n code,\n container,\n trace,\n path,\n astr,\n msg\n };\n }\n function isInSchema(schema, key) {\n var parts = splitKey(key);\n var keyMinusId = parts.keyMinusId;\n var id = parts.id;\n if (keyMinusId in schema && schema[keyMinusId]._isSubplotObj && id) {\n return true;\n }\n return key in schema;\n }\n function getNestedSchema(schema, key) {\n if (key in schema) return schema[key];\n var parts = splitKey(key);\n return schema[parts.keyMinusId];\n }\n var idRegex = Lib.counterRegex(\"([a-z]+)\");\n function splitKey(key) {\n var idMatch = key.match(idRegex);\n return {\n keyMinusId: idMatch && idMatch[1],\n id: idMatch && idMatch[2]\n };\n }\n function convertPathToAttributeString(path) {\n if (!isArray(path)) return String(path);\n var astr = \"\";\n for (var i = 0; i < path.length; i++) {\n var p = path[i];\n if (typeof p === \"number\") {\n astr = astr.substr(0, astr.length - 1) + \"[\" + p + \"]\";\n } else {\n astr += p;\n }\n if (i < path.length - 1) astr += \".\";\n }\n return astr;\n }\n }\n });\n\n // src/snapshot/filesaver.js\n var require_filesaver = __commonJS({\n \"src/snapshot/filesaver.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var helpers = require_helpers10();\n function fileSaver(url, name2, format) {\n var saveLink = document.createElement(\"a\");\n var canUseSaveLink = \"download\" in saveLink;\n var promise = new Promise(function(resolve, reject) {\n var blob;\n var objectUrl;\n if (canUseSaveLink) {\n blob = helpers.createBlob(url, format);\n objectUrl = helpers.createObjectURL(blob);\n saveLink.href = objectUrl;\n saveLink.download = name2;\n document.body.appendChild(saveLink);\n saveLink.click();\n document.body.removeChild(saveLink);\n helpers.revokeObjectURL(objectUrl);\n blob = null;\n return resolve(name2);\n }\n if (Lib.isSafari()) {\n var prefix = format === \"svg\" ? \",\" : \";base64,\";\n helpers.octetStream(prefix + encodeURIComponent(url));\n return resolve(name2);\n }\n reject(new Error(\"download error\"));\n });\n return promise;\n }\n module.exports = fileSaver;\n }\n });\n\n // src/snapshot/download.js\n var require_download = __commonJS({\n \"src/snapshot/download.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var toImage = require_to_image();\n var fileSaver = require_filesaver();\n var helpers = require_helpers10();\n function downloadImage(gd, opts) {\n var _gd;\n if (!Lib.isPlainObject(gd)) _gd = Lib.getGraphDiv(gd);\n opts = opts || {};\n opts.format = opts.format || \"png\";\n opts.width = opts.width || null;\n opts.height = opts.height || null;\n opts.imageDataOnly = true;\n return new Promise(function(resolve, reject) {\n if (_gd && _gd._snapshotInProgress) {\n reject(new Error(\"Snapshotting already in progress.\"));\n }\n if (_gd) _gd._snapshotInProgress = true;\n var promise = toImage(gd, opts);\n var filename = opts.filename || gd.fn || \"newplot\";\n filename += \".\" + opts.format.replace(\"-\", \".\");\n promise.then(function(result) {\n if (_gd) _gd._snapshotInProgress = false;\n return fileSaver(result, filename, opts.format);\n }).then(function(name2) {\n resolve(name2);\n }).catch(function(err) {\n if (_gd) _gd._snapshotInProgress = false;\n reject(err);\n });\n });\n }\n module.exports = downloadImage;\n }\n });\n\n // src/plot_api/template_api.js\n var require_template_api = __commonJS({\n \"src/plot_api/template_api.js\"(exports) {\n \"use strict\";\n var Lib = require_lib();\n var isPlainObject = Lib.isPlainObject;\n var PlotSchema = require_plot_schema();\n var Plots = require_plots();\n var plotAttributes = require_attributes2();\n var Template = require_plot_template();\n var dfltConfig = require_plot_config().dfltConfig;\n exports.makeTemplate = function(figure) {\n figure = Lib.isPlainObject(figure) ? figure : Lib.getGraphDiv(figure);\n figure = Lib.extendDeep({ _context: dfltConfig }, { data: figure.data, layout: figure.layout });\n Plots.supplyDefaults(figure);\n var data = figure.data || [];\n var layout = figure.layout || {};\n layout._basePlotModules = figure._fullLayout._basePlotModules;\n layout._modules = figure._fullLayout._modules;\n var template = {\n data: {},\n layout: {}\n };\n data.forEach(function(trace) {\n var traceTemplate = {};\n walkStyleKeys(trace, traceTemplate, getTraceInfo.bind(null, trace));\n var traceType2 = Lib.coerce(trace, {}, plotAttributes, \"type\");\n var typeTemplates2 = template.data[traceType2];\n if (!typeTemplates2) typeTemplates2 = template.data[traceType2] = [];\n typeTemplates2.push(traceTemplate);\n });\n walkStyleKeys(layout, template.layout, getLayoutInfo.bind(null, layout));\n delete template.layout.template;\n var oldTemplate = layout.template;\n if (isPlainObject(oldTemplate)) {\n var oldLayoutTemplate = oldTemplate.layout;\n var i, traceType, oldTypeTemplates, oldTypeLen, typeTemplates, typeLen;\n if (isPlainObject(oldLayoutTemplate)) {\n mergeTemplates(oldLayoutTemplate, template.layout);\n }\n var oldDataTemplate = oldTemplate.data;\n if (isPlainObject(oldDataTemplate)) {\n for (traceType in template.data) {\n oldTypeTemplates = oldDataTemplate[traceType];\n if (Array.isArray(oldTypeTemplates)) {\n typeTemplates = template.data[traceType];\n typeLen = typeTemplates.length;\n oldTypeLen = oldTypeTemplates.length;\n for (i = 0; i < typeLen; i++) {\n mergeTemplates(oldTypeTemplates[i % oldTypeLen], typeTemplates[i]);\n }\n for (i = typeLen; i < oldTypeLen; i++) {\n typeTemplates.push(Lib.extendDeep({}, oldTypeTemplates[i]));\n }\n }\n }\n for (traceType in oldDataTemplate) {\n if (!(traceType in template.data)) {\n template.data[traceType] = Lib.extendDeep([], oldDataTemplate[traceType]);\n }\n }\n }\n }\n return template;\n };\n function mergeTemplates(oldTemplate, newTemplate) {\n oldTemplate = Lib.extendDeep({}, oldTemplate);\n var oldKeys = Object.keys(oldTemplate).sort();\n var i, j;\n function mergeOne(oldVal2, newVal, key3) {\n if (isPlainObject(newVal) && isPlainObject(oldVal2)) {\n mergeTemplates(oldVal2, newVal);\n } else if (Array.isArray(newVal) && Array.isArray(oldVal2)) {\n var templater = Template.arrayTemplater({ _template: oldTemplate }, key3);\n for (j = 0; j < newVal.length; j++) {\n var item = newVal[j];\n var oldItem = templater.newItem(item)._template;\n if (oldItem) mergeTemplates(oldItem, item);\n }\n var defaultItems = templater.defaultItems();\n for (j = 0; j < defaultItems.length; j++) newVal.push(defaultItems[j]._template);\n for (j = 0; j < newVal.length; j++) delete newVal[j].templateitemname;\n }\n }\n for (i = 0; i < oldKeys.length; i++) {\n var key = oldKeys[i];\n var oldVal = oldTemplate[key];\n if (key in newTemplate) {\n mergeOne(oldVal, newTemplate[key], key);\n } else newTemplate[key] = oldVal;\n if (getBaseKey(key) === key) {\n for (var key2 in newTemplate) {\n var baseKey2 = getBaseKey(key2);\n if (key2 !== baseKey2 && baseKey2 === key && !(key2 in oldTemplate)) {\n mergeOne(oldVal, newTemplate[key2], key);\n }\n }\n }\n }\n }\n function getBaseKey(key) {\n return key.replace(/[0-9]+$/, \"\");\n }\n function walkStyleKeys(parent, templateOut, getAttributeInfo, path, basePath) {\n var pathAttr = basePath && getAttributeInfo(basePath);\n for (var key in parent) {\n var child = parent[key];\n var nextPath = getNextPath(parent, key, path);\n var nextBasePath = getNextPath(parent, key, basePath);\n var attr = getAttributeInfo(nextBasePath);\n if (!attr) {\n var baseKey = getBaseKey(key);\n if (baseKey !== key) {\n nextBasePath = getNextPath(parent, baseKey, basePath);\n attr = getAttributeInfo(nextBasePath);\n }\n }\n if (pathAttr && pathAttr === attr) continue;\n if (!attr || attr._noTemplating || attr.valType === \"data_array\" || attr.arrayOk && Array.isArray(child)) {\n continue;\n }\n if (!attr.valType && isPlainObject(child)) {\n walkStyleKeys(child, templateOut, getAttributeInfo, nextPath, nextBasePath);\n } else if (attr._isLinkedToArray && Array.isArray(child)) {\n var dfltDone = false;\n var namedIndex = 0;\n var usedNames = {};\n for (var i = 0; i < child.length; i++) {\n var item = child[i];\n if (isPlainObject(item)) {\n var name2 = item.name;\n if (name2) {\n if (!usedNames[name2]) {\n walkStyleKeys(\n item,\n templateOut,\n getAttributeInfo,\n getNextPath(child, namedIndex, nextPath),\n getNextPath(child, namedIndex, nextBasePath)\n );\n namedIndex++;\n usedNames[name2] = 1;\n }\n } else if (!dfltDone) {\n var dfltKey = Template.arrayDefaultKey(key);\n var dfltPath = getNextPath(parent, dfltKey, path);\n var pathInArray = getNextPath(child, namedIndex, nextPath);\n walkStyleKeys(\n item,\n templateOut,\n getAttributeInfo,\n pathInArray,\n getNextPath(child, namedIndex, nextBasePath)\n );\n var itemPropInArray = Lib.nestedProperty(templateOut, pathInArray);\n var dfltProp = Lib.nestedProperty(templateOut, dfltPath);\n dfltProp.set(itemPropInArray.get());\n itemPropInArray.set(null);\n dfltDone = true;\n }\n }\n }\n } else {\n var templateProp = Lib.nestedProperty(templateOut, nextPath);\n templateProp.set(child);\n }\n }\n }\n function getLayoutInfo(layout, path) {\n return PlotSchema.getLayoutValObject(\n layout,\n Lib.nestedProperty({}, path).parts\n );\n }\n function getTraceInfo(trace, path) {\n return PlotSchema.getTraceValObject(\n trace,\n Lib.nestedProperty({}, path).parts\n );\n }\n function getNextPath(parent, key, path) {\n var nextPath;\n if (!path) nextPath = key;\n else if (Array.isArray(parent)) nextPath = path + \"[\" + key + \"]\";\n else nextPath = path + \".\" + key;\n return nextPath;\n }\n exports.validateTemplate = function(figureIn, template) {\n var figure = Lib.extendDeep({}, {\n _context: dfltConfig,\n data: figureIn.data,\n layout: figureIn.layout\n });\n var layout = figure.layout || {};\n if (!isPlainObject(template)) template = layout.template || {};\n var layoutTemplate = template.layout;\n var dataTemplate = template.data;\n var errorList = [];\n figure.layout = layout;\n figure.layout.template = template;\n Plots.supplyDefaults(figure);\n var fullLayout = figure._fullLayout;\n var fullData = figure._fullData;\n var layoutPaths = {};\n function crawlLayoutForContainers(obj, paths) {\n for (var key in obj) {\n if (key.charAt(0) !== \"_\" && isPlainObject(obj[key])) {\n var baseKey = getBaseKey(key);\n var nextPaths = [];\n var i2;\n for (i2 = 0; i2 < paths.length; i2++) {\n nextPaths.push(getNextPath(obj, key, paths[i2]));\n if (baseKey !== key) nextPaths.push(getNextPath(obj, baseKey, paths[i2]));\n }\n for (i2 = 0; i2 < nextPaths.length; i2++) {\n layoutPaths[nextPaths[i2]] = 1;\n }\n crawlLayoutForContainers(obj[key], nextPaths);\n }\n }\n }\n function crawlLayoutTemplateForContainers(obj, path) {\n for (var key in obj) {\n if (key.indexOf(\"defaults\") === -1 && isPlainObject(obj[key])) {\n var nextPath = getNextPath(obj, key, path);\n if (layoutPaths[nextPath]) {\n crawlLayoutTemplateForContainers(obj[key], nextPath);\n } else {\n errorList.push({ code: \"unused\", path: nextPath });\n }\n }\n }\n }\n if (!isPlainObject(layoutTemplate)) {\n errorList.push({ code: \"layout\" });\n } else {\n crawlLayoutForContainers(fullLayout, [\"layout\"]);\n crawlLayoutTemplateForContainers(layoutTemplate, \"layout\");\n }\n if (!isPlainObject(dataTemplate)) {\n errorList.push({ code: \"data\" });\n } else {\n var typeCount = {};\n var traceType;\n for (var i = 0; i < fullData.length; i++) {\n var fullTrace = fullData[i];\n traceType = fullTrace.type;\n typeCount[traceType] = (typeCount[traceType] || 0) + 1;\n if (!fullTrace._fullInput._template) {\n errorList.push({\n code: \"missing\",\n index: fullTrace.index,\n traceType\n });\n }\n }\n for (traceType in dataTemplate) {\n var templateCount = dataTemplate[traceType].length;\n var dataCount = typeCount[traceType] || 0;\n if (templateCount > dataCount) {\n errorList.push({\n code: \"unused\",\n traceType,\n templateCount,\n dataCount\n });\n } else if (dataCount > templateCount) {\n errorList.push({\n code: \"reused\",\n traceType,\n templateCount,\n dataCount\n });\n }\n }\n }\n function crawlForMissingTemplates(obj, path) {\n for (var key in obj) {\n if (key.charAt(0) === \"_\") continue;\n var val = obj[key];\n var nextPath = getNextPath(obj, key, path);\n if (isPlainObject(val)) {\n if (Array.isArray(obj) && val._template === false && val.templateitemname) {\n errorList.push({\n code: \"missing\",\n path: nextPath,\n templateitemname: val.templateitemname\n });\n }\n crawlForMissingTemplates(val, nextPath);\n } else if (Array.isArray(val) && hasPlainObject(val)) {\n crawlForMissingTemplates(val, nextPath);\n }\n }\n }\n crawlForMissingTemplates({ data: fullData, layout: fullLayout }, \"\");\n if (errorList.length) return errorList.map(format);\n };\n function hasPlainObject(arr) {\n for (var i = 0; i < arr.length; i++) {\n if (isPlainObject(arr[i])) return true;\n }\n }\n function format(opts) {\n var msg;\n switch (opts.code) {\n case \"data\":\n msg = \"The template has no key data.\";\n break;\n case \"layout\":\n msg = \"The template has no key layout.\";\n break;\n case \"missing\":\n if (opts.path) {\n msg = \"There are no templates for item \" + opts.path + \" with name \" + opts.templateitemname;\n } else {\n msg = \"There are no templates for trace \" + opts.index + \", of type \" + opts.traceType + \".\";\n }\n break;\n case \"unused\":\n if (opts.path) {\n msg = \"The template item at \" + opts.path + \" was not used in constructing the plot.\";\n } else if (opts.dataCount) {\n msg = \"Some of the templates of type \" + opts.traceType + \" were not used. The template has \" + opts.templateCount + \" traces, the data only has \" + opts.dataCount + \" of this type.\";\n } else {\n msg = \"The template has \" + opts.templateCount + \" traces of type \" + opts.traceType + \" but there are none in the data.\";\n }\n break;\n case \"reused\":\n msg = \"Some of the templates of type \" + opts.traceType + \" were used more than once. The template has \" + opts.templateCount + \" traces, the data has \" + opts.dataCount + \" of this type.\";\n break;\n }\n opts.msg = msg;\n return opts;\n }\n }\n });\n\n // src/plot_api/index.js\n var require_plot_api2 = __commonJS({\n \"src/plot_api/index.js\"(exports) {\n \"use strict\";\n var main = require_plot_api();\n exports._doPlot = main._doPlot;\n exports.newPlot = main.newPlot;\n exports.restyle = main.restyle;\n exports.relayout = main.relayout;\n exports.redraw = main.redraw;\n exports.update = main.update;\n exports._guiRestyle = main._guiRestyle;\n exports._guiRelayout = main._guiRelayout;\n exports._guiUpdate = main._guiUpdate;\n exports._storeDirectGUIEdit = main._storeDirectGUIEdit;\n exports.react = main.react;\n exports.extendTraces = main.extendTraces;\n exports.prependTraces = main.prependTraces;\n exports.addTraces = main.addTraces;\n exports.deleteTraces = main.deleteTraces;\n exports.moveTraces = main.moveTraces;\n exports.purge = main.purge;\n exports.addFrames = main.addFrames;\n exports.deleteFrames = main.deleteFrames;\n exports.animate = main.animate;\n exports.setPlotConfig = main.setPlotConfig;\n var getGraphDiv = require_dom().getGraphDiv;\n var eraseActiveShape = require_draw2().eraseActiveShape;\n exports.deleteActiveShape = function(gd) {\n return eraseActiveShape(getGraphDiv(gd));\n };\n exports.toImage = require_to_image();\n exports.validate = require_validate();\n exports.downloadImage = require_download();\n var templateApi = require_template_api();\n exports.makeTemplate = templateApi.makeTemplate;\n exports.validateTemplate = templateApi.validateTemplate;\n }\n });\n\n // src/traces/scatter/xy_defaults.js\n var require_xy_defaults = __commonJS({\n \"src/traces/scatter/xy_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Registry = require_registry();\n module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) {\n var x = coerce(\"x\");\n var y = coerce(\"y\");\n var len;\n var handleCalendarDefaults = Registry.getComponentMethod(\"calendars\", \"handleTraceDefaults\");\n handleCalendarDefaults(traceIn, traceOut, [\"x\", \"y\"], layout);\n if (x) {\n var xlen = Lib.minRowLength(x);\n if (y) {\n len = Math.min(xlen, Lib.minRowLength(y));\n } else {\n len = xlen;\n coerce(\"y0\");\n coerce(\"dy\");\n }\n } else {\n if (!y) return 0;\n len = Lib.minRowLength(y);\n coerce(\"x0\");\n coerce(\"dx\");\n }\n traceOut._length = len;\n return len;\n };\n }\n });\n\n // src/traces/scatter/period_defaults.js\n var require_period_defaults = __commonJS({\n \"src/traces/scatter/period_defaults.js\"(exports, module) {\n \"use strict\";\n var dateTick0 = require_lib().dateTick0;\n var numConstants = require_numerical();\n var ONEWEEK = numConstants.ONEWEEK;\n function getPeriod0Dflt(period, calendar) {\n if (period % ONEWEEK === 0) {\n return dateTick0(calendar, 1);\n }\n return dateTick0(calendar, 0);\n }\n module.exports = function handlePeriodDefaults(traceIn, traceOut, layout, coerce, opts) {\n if (!opts) {\n opts = {\n x: true,\n y: true\n };\n }\n if (opts.x) {\n var xperiod = coerce(\"xperiod\");\n if (xperiod) {\n coerce(\"xperiod0\", getPeriod0Dflt(xperiod, traceOut.xcalendar));\n coerce(\"xperiodalignment\");\n }\n }\n if (opts.y) {\n var yperiod = coerce(\"yperiod\");\n if (yperiod) {\n coerce(\"yperiod0\", getPeriod0Dflt(yperiod, traceOut.ycalendar));\n coerce(\"yperiodalignment\");\n }\n }\n };\n }\n });\n\n // src/traces/scatter/stack_defaults.js\n var require_stack_defaults = __commonJS({\n \"src/traces/scatter/stack_defaults.js\"(exports, module) {\n \"use strict\";\n var perStackAttrs = [\"orientation\", \"groupnorm\", \"stackgaps\"];\n module.exports = function handleStackDefaults(traceIn, traceOut, layout, coerce) {\n var stackOpts = layout._scatterStackOpts;\n var stackGroup = coerce(\"stackgroup\");\n if (stackGroup) {\n var subplot = traceOut.xaxis + traceOut.yaxis;\n var subplotStackOpts = stackOpts[subplot];\n if (!subplotStackOpts) subplotStackOpts = stackOpts[subplot] = {};\n var groupOpts = subplotStackOpts[stackGroup];\n var firstTrace = false;\n if (groupOpts) {\n groupOpts.traces.push(traceOut);\n } else {\n groupOpts = subplotStackOpts[stackGroup] = {\n // keep track of trace indices for use during stacking calculations\n // this will be filled in during `calc` and used during `crossTraceCalc`\n // so it's OK if we don't recreate it during a non-calc edit\n traceIndices: [],\n // Hold on to the whole set of prior traces\n // First one is most important, so we can clear defaults\n // there if we find explicit values only in later traces.\n // We're only going to *use* the values stored in groupOpts,\n // but for the editor and validate we want things self-consistent\n // The full set of traces is used only to fix `fill` default if\n // we find `orientation: 'h'` beyond the first trace\n traces: [traceOut]\n };\n firstTrace = true;\n }\n var dflts = {\n orientation: traceOut.x && !traceOut.y ? \"h\" : \"v\"\n };\n for (var i = 0; i < perStackAttrs.length; i++) {\n var attr = perStackAttrs[i];\n var attrFound = attr + \"Found\";\n if (!groupOpts[attrFound]) {\n var traceHasAttr = traceIn[attr] !== void 0;\n var isOrientation = attr === \"orientation\";\n if (traceHasAttr || firstTrace) {\n groupOpts[attr] = coerce(attr, dflts[attr]);\n if (isOrientation) {\n groupOpts.fillDflt = groupOpts[attr] === \"h\" ? \"tonextx\" : \"tonexty\";\n }\n if (traceHasAttr) {\n groupOpts[attrFound] = true;\n if (!firstTrace) {\n delete groupOpts.traces[0][attr];\n if (isOrientation) {\n for (var j = 0; j < groupOpts.traces.length - 1; j++) {\n var trace2 = groupOpts.traces[j];\n if (trace2._input.fill !== trace2.fill) {\n trace2.fill = groupOpts.fillDflt;\n }\n }\n }\n }\n }\n }\n }\n }\n return groupOpts;\n }\n };\n }\n });\n\n // src/traces/scatter/marker_defaults.js\n var require_marker_defaults = __commonJS({\n \"src/traces/scatter/marker_defaults.js\"(exports, module) {\n \"use strict\";\n var Color2 = require_color();\n var hasColorscale = require_helpers().hasColorscale;\n var colorscaleDefaults = require_defaults2();\n var subTypes = require_subtypes();\n module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout, coerce, opts) {\n var isBubble = subTypes.isBubble(traceIn);\n var lineColor = (traceIn.line || {}).color;\n var defaultMLC;\n opts = opts || {};\n if (lineColor) defaultColor = lineColor;\n coerce(\"marker.symbol\");\n coerce(\"marker.opacity\", isBubble ? 0.7 : 1);\n coerce(\"marker.size\");\n if (!opts.noAngle) {\n coerce(\"marker.angle\");\n if (!opts.noAngleRef) {\n coerce(\"marker.angleref\");\n }\n if (!opts.noStandOff) {\n coerce(\"marker.standoff\");\n }\n }\n coerce(\"marker.color\", defaultColor);\n if (hasColorscale(traceIn, \"marker\")) {\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"marker.\", cLetter: \"c\" });\n }\n if (!opts.noSelect) {\n coerce(\"selected.marker.color\");\n coerce(\"unselected.marker.color\");\n coerce(\"selected.marker.size\");\n coerce(\"unselected.marker.size\");\n }\n if (!opts.noLine) {\n if (lineColor && !Array.isArray(lineColor) && traceOut.marker.color !== lineColor) {\n defaultMLC = lineColor;\n } else if (isBubble) defaultMLC = Color2.background;\n else defaultMLC = Color2.defaultLine;\n coerce(\"marker.line.color\", defaultMLC);\n if (hasColorscale(traceIn, \"marker.line\")) {\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"marker.line.\", cLetter: \"c\" });\n }\n coerce(\"marker.line.width\", isBubble ? 1 : 0);\n }\n if (isBubble) {\n coerce(\"marker.sizeref\");\n coerce(\"marker.sizemin\");\n coerce(\"marker.sizemode\");\n }\n if (opts.gradient) {\n var gradientType = coerce(\"marker.gradient.type\");\n if (gradientType !== \"none\") {\n coerce(\"marker.gradient.color\");\n }\n }\n };\n }\n });\n\n // src/traces/scatter/line_defaults.js\n var require_line_defaults = __commonJS({\n \"src/traces/scatter/line_defaults.js\"(exports, module) {\n \"use strict\";\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n var hasColorscale = require_helpers().hasColorscale;\n var colorscaleDefaults = require_defaults2();\n module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce, opts) {\n if (!opts) opts = {};\n var markerColor = (traceIn.marker || {}).color;\n if (markerColor && markerColor._inputArray) markerColor = markerColor._inputArray;\n coerce(\"line.color\", defaultColor);\n if (hasColorscale(traceIn, \"line\")) {\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"line.\", cLetter: \"c\" });\n } else {\n var lineColorDflt = (isArrayOrTypedArray(markerColor) ? false : markerColor) || defaultColor;\n coerce(\"line.color\", lineColorDflt);\n }\n coerce(\"line.width\");\n if (!opts.noDash) coerce(\"line.dash\");\n if (opts.backoff) coerce(\"line.backoff\");\n };\n }\n });\n\n // src/traces/scatter/line_shape_defaults.js\n var require_line_shape_defaults = __commonJS({\n \"src/traces/scatter/line_shape_defaults.js\"(exports, module) {\n \"use strict\";\n module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) {\n var shape = coerce(\"line.shape\");\n if (shape === \"spline\") coerce(\"line.smoothing\");\n };\n }\n });\n\n // src/traces/scatter/text_defaults.js\n var require_text_defaults = __commonJS({\n \"src/traces/scatter/text_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n module.exports = function(traceIn, traceOut, layout, coerce, opts) {\n opts = opts || {};\n coerce(\"textposition\");\n Lib.coerceFont(coerce, \"textfont\", opts.font || layout.font, opts);\n if (!opts.noSelect) {\n coerce(\"selected.textfont.color\");\n coerce(\"unselected.textfont.color\");\n }\n };\n }\n });\n\n // src/traces/scatter/fillcolor_defaults.js\n var require_fillcolor_defaults = __commonJS({\n \"src/traces/scatter/fillcolor_defaults.js\"(exports, module) {\n \"use strict\";\n var Color2 = require_color();\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n function averageColors(colorscale) {\n var color2 = Color2.interpolate(colorscale[0][1], colorscale[1][1], 0.5);\n for (var i = 2; i < colorscale.length; i++) {\n var averageColorI = Color2.interpolate(colorscale[i - 1][1], colorscale[i][1], 0.5);\n color2 = Color2.interpolate(color2, averageColorI, colorscale[i - 1][0] / colorscale[i][0]);\n }\n return color2;\n }\n module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coerce, opts) {\n if (!opts) opts = {};\n var inheritColorFromMarker = false;\n if (traceOut.marker) {\n var markerColor = traceOut.marker.color;\n var markerLineColor = (traceOut.marker.line || {}).color;\n if (markerColor && !isArrayOrTypedArray(markerColor)) {\n inheritColorFromMarker = markerColor;\n } else if (markerLineColor && !isArrayOrTypedArray(markerLineColor)) {\n inheritColorFromMarker = markerLineColor;\n }\n }\n var averageGradientColor;\n if (opts.moduleHasFillgradient) {\n var gradientOrientation = coerce(\"fillgradient.type\");\n if (gradientOrientation !== \"none\") {\n coerce(\"fillgradient.start\");\n coerce(\"fillgradient.stop\");\n var gradientColorscale = coerce(\"fillgradient.colorscale\");\n if (gradientColorscale) {\n averageGradientColor = averageColors(gradientColorscale);\n }\n }\n }\n coerce(\"fillcolor\", Color2.addOpacity(\n (traceOut.line || {}).color || inheritColorFromMarker || averageGradientColor || defaultColor,\n 0.5\n ));\n };\n }\n });\n\n // src/traces/scatter/defaults.js\n var require_defaults8 = __commonJS({\n \"src/traces/scatter/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Registry = require_registry();\n var attributes = require_attributes12();\n var constants = require_constants8();\n var subTypes = require_subtypes();\n var handleXYDefaults = require_xy_defaults();\n var handlePeriodDefaults = require_period_defaults();\n var handleStackDefaults = require_stack_defaults();\n var handleMarkerDefaults = require_marker_defaults();\n var handleLineDefaults = require_line_defaults();\n var handleLineShapeDefaults = require_line_shape_defaults();\n var handleTextDefaults = require_text_defaults();\n var handleFillColorDefaults = require_fillcolor_defaults();\n var coercePattern = require_lib().coercePattern;\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var len = handleXYDefaults(traceIn, traceOut, layout, coerce);\n if (!len) traceOut.visible = false;\n if (!traceOut.visible) return;\n handlePeriodDefaults(traceIn, traceOut, layout, coerce);\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n coerce(\"zorder\");\n var stackGroupOpts = handleStackDefaults(traceIn, traceOut, layout, coerce);\n if (layout.scattermode === \"group\" && traceOut.orientation === void 0) {\n coerce(\"orientation\", \"v\");\n }\n var defaultMode = !stackGroupOpts && len < constants.PTS_LINESONLY ? \"lines+markers\" : \"lines\";\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"mode\", defaultMode);\n if (subTypes.hasMarkers(traceOut)) {\n handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, { gradient: true });\n }\n if (subTypes.hasLines(traceOut)) {\n handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce, { backoff: true });\n handleLineShapeDefaults(traceIn, traceOut, coerce);\n coerce(\"connectgaps\");\n coerce(\"line.simplify\");\n }\n if (subTypes.hasText(traceOut)) {\n coerce(\"texttemplate\");\n handleTextDefaults(traceIn, traceOut, layout, coerce);\n }\n var dfltHoverOn = [];\n if (subTypes.hasMarkers(traceOut) || subTypes.hasText(traceOut)) {\n coerce(\"cliponaxis\");\n coerce(\"marker.maxdisplayed\");\n dfltHoverOn.push(\"points\");\n }\n coerce(\"fill\", stackGroupOpts ? stackGroupOpts.fillDflt : \"none\");\n if (traceOut.fill !== \"none\") {\n handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce, {\n moduleHasFillgradient: true\n });\n if (!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce);\n coercePattern(coerce, \"fillpattern\", traceOut.fillcolor, false);\n }\n var lineColor = (traceOut.line || {}).color;\n var markerColor = (traceOut.marker || {}).color;\n if (traceOut.fill === \"tonext\" || traceOut.fill === \"toself\") {\n dfltHoverOn.push(\"fills\");\n }\n coerce(\"hoveron\", dfltHoverOn.join(\"+\") || \"points\");\n if (traceOut.hoveron !== \"fills\") coerce(\"hovertemplate\");\n var errorBarsSupplyDefaults = Registry.getComponentMethod(\"errorbars\", \"supplyDefaults\");\n errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, { axis: \"y\" });\n errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, { axis: \"x\", inherit: \"y\" });\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n };\n }\n });\n\n // src/traces/scatter/grouping_defaults.js\n var require_grouping_defaults = __commonJS({\n \"src/traces/scatter/grouping_defaults.js\"(exports, module) {\n \"use strict\";\n var getAxisGroup = require_constraints().getAxisGroup;\n module.exports = function handleGroupingDefaults(traceIn, traceOut, fullLayout, coerce, barmode) {\n var orientation = traceOut.orientation;\n var posAxId = traceOut[{ v: \"x\", h: \"y\" }[orientation] + \"axis\"];\n var groupId = getAxisGroup(fullLayout, posAxId) + orientation;\n var alignmentOpts = fullLayout._alignmentOpts || {};\n var alignmentgroup = coerce(\"alignmentgroup\");\n var alignmentGroups = alignmentOpts[groupId];\n if (!alignmentGroups) alignmentGroups = alignmentOpts[groupId] = {};\n var alignmentGroupOpts = alignmentGroups[alignmentgroup];\n if (alignmentGroupOpts) {\n alignmentGroupOpts.traces.push(traceOut);\n } else {\n alignmentGroupOpts = alignmentGroups[alignmentgroup] = {\n traces: [traceOut],\n alignmentIndex: Object.keys(alignmentGroups).length,\n offsetGroups: {}\n };\n }\n var offsetgroup = coerce(\"offsetgroup\") || \"\";\n var offsetGroups = alignmentGroupOpts.offsetGroups;\n var offsetGroupOpts = offsetGroups[offsetgroup];\n traceOut._offsetIndex = 0;\n if (barmode !== \"group\" || offsetgroup) {\n if (!offsetGroupOpts) {\n offsetGroupOpts = offsetGroups[offsetgroup] = {\n offsetIndex: Object.keys(offsetGroups).length\n };\n }\n traceOut._offsetIndex = offsetGroupOpts.offsetIndex;\n }\n };\n }\n });\n\n // src/traces/scatter/cross_trace_defaults.js\n var require_cross_trace_defaults2 = __commonJS({\n \"src/traces/scatter/cross_trace_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleGroupingDefaults = require_grouping_defaults();\n var attributes = require_attributes12();\n module.exports = function crossTraceDefaults(fullData, fullLayout) {\n var traceIn, traceOut, i;\n var scattermode = fullLayout.scattermode;\n function coerce(attr) {\n return Lib.coerce(traceOut._input, traceOut, attributes, attr);\n }\n if (fullLayout.scattermode === \"group\") {\n for (i = 0; i < fullData.length; i++) {\n traceOut = fullData[i];\n if (traceOut.type === \"scatter\") {\n traceIn = traceOut._input;\n handleGroupingDefaults(traceIn, traceOut, fullLayout, coerce, scattermode);\n }\n }\n }\n for (i = 0; i < fullData.length; i++) {\n var tracei = fullData[i];\n if (tracei.type !== \"scatter\") continue;\n var filli = tracei.fill;\n if (filli === \"none\" || filli === \"toself\") continue;\n tracei.opacity = void 0;\n if (filli === \"tonexty\" || filli === \"tonextx\") {\n for (var j = i - 1; j >= 0; j--) {\n var tracej = fullData[j];\n if (tracej.type === \"scatter\" && tracej.xaxis === tracei.xaxis && tracej.yaxis === tracei.yaxis) {\n tracej.opacity = void 0;\n break;\n }\n }\n }\n }\n };\n }\n });\n\n // src/traces/scatter/layout_defaults.js\n var require_layout_defaults3 = __commonJS({\n \"src/traces/scatter/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var layoutAttributes = require_layout_attributes3();\n module.exports = function(layoutIn, layoutOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);\n }\n var groupBarmode = layoutOut.barmode === \"group\";\n if (layoutOut.scattermode === \"group\") {\n coerce(\"scattergap\", groupBarmode ? layoutOut.bargap : 0.2);\n }\n };\n }\n });\n\n // src/plots/cartesian/align_period.js\n var require_align_period = __commonJS({\n \"src/plots/cartesian/align_period.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var dateTime2ms = Lib.dateTime2ms;\n var incrementMonth = Lib.incrementMonth;\n var constants = require_numerical();\n var ONEAVGMONTH = constants.ONEAVGMONTH;\n module.exports = function alignPeriod(trace, ax, axLetter, vals) {\n if (ax.type !== \"date\") return { vals };\n var alignment = trace[axLetter + \"periodalignment\"];\n if (!alignment) return { vals };\n var period = trace[axLetter + \"period\"];\n var mPeriod;\n if (isNumeric(period)) {\n period = +period;\n if (period <= 0) return { vals };\n } else if (typeof period === \"string\" && period.charAt(0) === \"M\") {\n var n = +period.substring(1);\n if (n > 0 && Math.round(n) === n) {\n mPeriod = n;\n } else return { vals };\n }\n var calendar = ax.calendar;\n var isStart = \"start\" === alignment;\n var isEnd = \"end\" === alignment;\n var period0 = trace[axLetter + \"period0\"];\n var base = dateTime2ms(period0, calendar) || 0;\n var newVals = [];\n var starts = [];\n var ends = [];\n var len = vals.length;\n for (var i = 0; i < len; i++) {\n var v = vals[i];\n var nEstimated, startTime, endTime;\n if (mPeriod) {\n nEstimated = Math.round((v - base) / (mPeriod * ONEAVGMONTH));\n endTime = incrementMonth(base, mPeriod * nEstimated, calendar);\n while (endTime > v) {\n endTime = incrementMonth(endTime, -mPeriod, calendar);\n }\n while (endTime <= v) {\n endTime = incrementMonth(endTime, mPeriod, calendar);\n }\n startTime = incrementMonth(endTime, -mPeriod, calendar);\n } else {\n nEstimated = Math.round((v - base) / period);\n endTime = base + nEstimated * period;\n while (endTime > v) {\n endTime -= period;\n }\n while (endTime <= v) {\n endTime += period;\n }\n startTime = endTime - period;\n }\n newVals[i] = isStart ? startTime : isEnd ? endTime : (startTime + endTime) / 2;\n starts[i] = startTime;\n ends[i] = endTime;\n }\n return {\n vals: newVals,\n starts,\n ends\n };\n };\n }\n });\n\n // src/traces/scatter/colorscale_calc.js\n var require_colorscale_calc = __commonJS({\n \"src/traces/scatter/colorscale_calc.js\"(exports, module) {\n \"use strict\";\n var hasColorscale = require_helpers().hasColorscale;\n var calcColorscale = require_calc();\n var subTypes = require_subtypes();\n module.exports = function calcMarkerColorscale(gd, trace) {\n if (subTypes.hasLines(trace) && hasColorscale(trace, \"line\")) {\n calcColorscale(gd, trace, {\n vals: trace.line.color,\n containerStr: \"line\",\n cLetter: \"c\"\n });\n }\n if (subTypes.hasMarkers(trace)) {\n if (hasColorscale(trace, \"marker\")) {\n calcColorscale(gd, trace, {\n vals: trace.marker.color,\n containerStr: \"marker\",\n cLetter: \"c\"\n });\n }\n if (hasColorscale(trace, \"marker.line\")) {\n calcColorscale(gd, trace, {\n vals: trace.marker.line.color,\n containerStr: \"marker.line\",\n cLetter: \"c\"\n });\n }\n }\n };\n }\n });\n\n // src/traces/scatter/arrays_to_calcdata.js\n var require_arrays_to_calcdata = __commonJS({\n \"src/traces/scatter/arrays_to_calcdata.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n module.exports = function arraysToCalcdata(cd, trace) {\n for (var i = 0; i < cd.length; i++) cd[i].i = i;\n Lib.mergeArray(trace.text, cd, \"tx\");\n Lib.mergeArray(trace.texttemplate, cd, \"txt\");\n Lib.mergeArray(trace.hovertext, cd, \"htx\");\n Lib.mergeArray(trace.customdata, cd, \"data\");\n Lib.mergeArray(trace.textposition, cd, \"tp\");\n if (trace.textfont) {\n Lib.mergeArrayCastPositive(trace.textfont.size, cd, \"ts\");\n Lib.mergeArray(trace.textfont.color, cd, \"tc\");\n Lib.mergeArray(trace.textfont.family, cd, \"tf\");\n Lib.mergeArray(trace.textfont.weight, cd, \"tw\");\n Lib.mergeArray(trace.textfont.style, cd, \"ty\");\n Lib.mergeArray(trace.textfont.variant, cd, \"tv\");\n Lib.mergeArray(trace.textfont.textcase, cd, \"tC\");\n Lib.mergeArray(trace.textfont.lineposition, cd, \"tE\");\n Lib.mergeArray(trace.textfont.shadow, cd, \"tS\");\n }\n var marker = trace.marker;\n if (marker) {\n Lib.mergeArrayCastPositive(marker.size, cd, \"ms\");\n Lib.mergeArrayCastPositive(marker.opacity, cd, \"mo\");\n Lib.mergeArray(marker.symbol, cd, \"mx\");\n Lib.mergeArray(marker.angle, cd, \"ma\");\n Lib.mergeArray(marker.standoff, cd, \"mf\");\n Lib.mergeArray(marker.color, cd, \"mc\");\n var markerLine = marker.line;\n if (marker.line) {\n Lib.mergeArray(markerLine.color, cd, \"mlc\");\n Lib.mergeArrayCastPositive(markerLine.width, cd, \"mlw\");\n }\n var markerGradient = marker.gradient;\n if (markerGradient && markerGradient.type !== \"none\") {\n Lib.mergeArray(markerGradient.type, cd, \"mgt\");\n Lib.mergeArray(markerGradient.color, cd, \"mgc\");\n }\n }\n };\n }\n });\n\n // src/traces/scatter/calc_selection.js\n var require_calc_selection = __commonJS({\n \"src/traces/scatter/calc_selection.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n module.exports = function calcSelection(cd, trace) {\n if (Lib.isArrayOrTypedArray(trace.selectedpoints)) {\n Lib.tagSelected(cd, trace);\n }\n };\n }\n });\n\n // src/traces/scatter/calc.js\n var require_calc3 = __commonJS({\n \"src/traces/scatter/calc.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var Axes = require_axes();\n var alignPeriod = require_align_period();\n var BADNUM = require_numerical().BADNUM;\n var subTypes = require_subtypes();\n var calcColorscale = require_colorscale_calc();\n var arraysToCalcdata = require_arrays_to_calcdata();\n var calcSelection = require_calc_selection();\n function calc(gd, trace) {\n var fullLayout = gd._fullLayout;\n var xa = trace._xA = Axes.getFromId(gd, trace.xaxis || \"x\", \"x\");\n var ya = trace._yA = Axes.getFromId(gd, trace.yaxis || \"y\", \"y\");\n var origX = xa.makeCalcdata(trace, \"x\");\n var origY = ya.makeCalcdata(trace, \"y\");\n var xObj = alignPeriod(trace, xa, \"x\", origX);\n var yObj = alignPeriod(trace, ya, \"y\", origY);\n var x = xObj.vals;\n var y = yObj.vals;\n var serieslen = trace._length;\n var cd = new Array(serieslen);\n var ids = trace.ids;\n var stackGroupOpts = getStackOpts(trace, fullLayout, xa, ya);\n var interpolateGaps = false;\n var isV, i, j, k, interpolate, vali;\n setFirstScatter(fullLayout, trace);\n var xAttr = \"x\";\n var yAttr = \"y\";\n var posAttr;\n if (stackGroupOpts) {\n Lib.pushUnique(stackGroupOpts.traceIndices, trace.index);\n isV = stackGroupOpts.orientation === \"v\";\n if (isV) {\n yAttr = \"s\";\n posAttr = \"x\";\n } else {\n xAttr = \"s\";\n posAttr = \"y\";\n }\n interpolate = stackGroupOpts.stackgaps === \"interpolate\";\n } else {\n var ppad = calcMarkerSize(trace, serieslen);\n calcAxisExpansion(gd, trace, xa, ya, x, y, ppad);\n }\n var hasPeriodX = !!trace.xperiodalignment;\n var hasPeriodY = !!trace.yperiodalignment;\n for (i = 0; i < serieslen; i++) {\n var cdi = cd[i] = {};\n var xValid = isNumeric(x[i]);\n var yValid = isNumeric(y[i]);\n if (xValid && yValid) {\n cdi[xAttr] = x[i];\n cdi[yAttr] = y[i];\n if (hasPeriodX) {\n cdi.orig_x = origX[i];\n cdi.xEnd = xObj.ends[i];\n cdi.xStart = xObj.starts[i];\n }\n if (hasPeriodY) {\n cdi.orig_y = origY[i];\n cdi.yEnd = yObj.ends[i];\n cdi.yStart = yObj.starts[i];\n }\n } else if (stackGroupOpts && (isV ? xValid : yValid)) {\n cdi[posAttr] = isV ? x[i] : y[i];\n cdi.gap = true;\n if (interpolate) {\n cdi.s = BADNUM;\n interpolateGaps = true;\n } else {\n cdi.s = 0;\n }\n } else {\n cdi[xAttr] = cdi[yAttr] = BADNUM;\n }\n if (ids) {\n cdi.id = String(ids[i]);\n }\n }\n arraysToCalcdata(cd, trace);\n calcColorscale(gd, trace);\n calcSelection(cd, trace);\n if (stackGroupOpts) {\n i = 0;\n while (i < cd.length) {\n if (cd[i][posAttr] === BADNUM) {\n cd.splice(i, 1);\n } else i++;\n }\n Lib.sort(cd, function(a, b) {\n return a[posAttr] - b[posAttr] || a.i - b.i;\n });\n if (interpolateGaps) {\n i = 0;\n while (i < cd.length - 1 && cd[i].gap) {\n i++;\n }\n vali = cd[i].s;\n if (!vali) vali = cd[i].s = 0;\n for (j = 0; j < i; j++) {\n cd[j].s = vali;\n }\n k = cd.length - 1;\n while (k > i && cd[k].gap) {\n k--;\n }\n vali = cd[k].s;\n for (j = cd.length - 1; j > k; j--) {\n cd[j].s = vali;\n }\n while (i < k) {\n i++;\n if (cd[i].gap) {\n j = i + 1;\n while (cd[j].gap) {\n j++;\n }\n var pos0 = cd[i - 1][posAttr];\n var size0 = cd[i - 1].s;\n var m = (cd[j].s - size0) / (cd[j][posAttr] - pos0);\n while (i < j) {\n cd[i].s = size0 + (cd[i][posAttr] - pos0) * m;\n i++;\n }\n }\n }\n }\n }\n return cd;\n }\n function calcAxisExpansion(gd, trace, xa, ya, x, y, ppad) {\n var serieslen = trace._length;\n var fullLayout = gd._fullLayout;\n var xId = xa._id;\n var yId = ya._id;\n var firstScatter = fullLayout._firstScatter[firstScatterGroup(trace)] === trace.uid;\n var stackOrientation = (getStackOpts(trace, fullLayout, xa, ya) || {}).orientation;\n var fill = trace.fill;\n xa._minDtick = 0;\n ya._minDtick = 0;\n var xOptions = { padded: true };\n var yOptions = { padded: true };\n if (ppad) {\n xOptions.ppad = yOptions.ppad = ppad;\n }\n var openEnded = serieslen < 2 || x[0] !== x[serieslen - 1] || y[0] !== y[serieslen - 1];\n if (openEnded && (fill === \"tozerox\" || fill === \"tonextx\" && (firstScatter || stackOrientation === \"h\"))) {\n xOptions.tozero = true;\n } else if (!(trace.error_y || {}).visible && // if no error bars, markers or text, or fill to y=0 remove x padding\n (fill === \"tonexty\" || fill === \"tozeroy\" || !subTypes.hasMarkers(trace) && !subTypes.hasText(trace))) {\n xOptions.padded = false;\n xOptions.ppad = 0;\n }\n if (openEnded && (fill === \"tozeroy\" || fill === \"tonexty\" && (firstScatter || stackOrientation === \"v\"))) {\n yOptions.tozero = true;\n } else if (fill === \"tonextx\" || fill === \"tozerox\") {\n yOptions.padded = false;\n }\n if (xId) trace._extremes[xId] = Axes.findExtremes(xa, x, xOptions);\n if (yId) trace._extremes[yId] = Axes.findExtremes(ya, y, yOptions);\n }\n function calcMarkerSize(trace, serieslen) {\n if (!subTypes.hasMarkers(trace)) return;\n var marker = trace.marker;\n var sizeref = 1.6 * (trace.marker.sizeref || 1);\n var markerTrans;\n if (trace.marker.sizemode === \"area\") {\n markerTrans = function(v) {\n return Math.max(Math.sqrt((v || 0) / sizeref), 3);\n };\n } else {\n markerTrans = function(v) {\n return Math.max((v || 0) / sizeref, 3);\n };\n }\n if (Lib.isArrayOrTypedArray(marker.size)) {\n var ax = { type: \"linear\" };\n Axes.setConvert(ax);\n var s = ax.makeCalcdata(trace.marker, \"size\");\n var sizeOut = new Array(serieslen);\n for (var i = 0; i < serieslen; i++) {\n sizeOut[i] = markerTrans(s[i]);\n }\n return sizeOut;\n } else {\n return markerTrans(marker.size);\n }\n }\n function setFirstScatter(fullLayout, trace) {\n var group = firstScatterGroup(trace);\n var firstScatter = fullLayout._firstScatter;\n if (!firstScatter[group]) firstScatter[group] = trace.uid;\n }\n function firstScatterGroup(trace) {\n var stackGroup = trace.stackgroup;\n return trace.xaxis + trace.yaxis + trace.type + (stackGroup ? \"-\" + stackGroup : \"\");\n }\n function getStackOpts(trace, fullLayout, xa, ya) {\n var stackGroup = trace.stackgroup;\n if (!stackGroup) return;\n var stackOpts = fullLayout._scatterStackOpts[xa._id + ya._id][stackGroup];\n var stackAx = stackOpts.orientation === \"v\" ? ya : xa;\n if (stackAx.type === \"linear\" || stackAx.type === \"log\") return stackOpts;\n }\n module.exports = {\n calc,\n calcMarkerSize,\n calcAxisExpansion,\n setFirstScatter,\n getStackOpts\n };\n }\n });\n\n // src/traces/bar/sieve.js\n var require_sieve = __commonJS({\n \"src/traces/bar/sieve.js\"(exports, module) {\n \"use strict\";\n module.exports = Sieve;\n var distinctVals = require_lib().distinctVals;\n function Sieve(traces, opts) {\n this.traces = traces;\n this.sepNegVal = opts.sepNegVal;\n this.overlapNoMerge = opts.overlapNoMerge;\n var width1 = Infinity;\n var axLetter = opts.posAxis._id.charAt(0);\n var positions = [];\n for (var i = 0; i < traces.length; i++) {\n var trace = traces[i];\n for (var j = 0; j < trace.length; j++) {\n var bar = trace[j];\n var pos = bar.p;\n if (pos === void 0) {\n pos = bar[axLetter];\n }\n if (pos !== void 0) positions.push(pos);\n }\n if (trace[0] && trace[0].width1) {\n width1 = Math.min(trace[0].width1, width1);\n }\n }\n this.positions = positions;\n var dv = distinctVals(positions);\n this.distinctPositions = dv.vals;\n if (dv.vals.length === 1 && width1 !== Infinity) this.minDiff = width1;\n else this.minDiff = Math.min(dv.minDiff, width1);\n var type = (opts.posAxis || {}).type;\n if (type === \"category\" || type === \"multicategory\") {\n this.minDiff = 1;\n }\n this.binWidth = this.minDiff;\n this.bins = {};\n }\n Sieve.prototype.put = function put(position, group, value) {\n var label = this.getLabel(position, group, value);\n var oldValue = this.bins[label] || 0;\n this.bins[label] = oldValue + value;\n return oldValue;\n };\n Sieve.prototype.get = function get(position, group, value) {\n var label = this.getLabel(position, group, value);\n return this.bins[label] || 0;\n };\n Sieve.prototype.getLabel = function getLabel(position, group, value) {\n var prefix = value < 0 && this.sepNegVal ? \"v\" : \"^\";\n var label = this.overlapNoMerge ? position : Math.round(position / this.binWidth);\n return prefix + label + \"g\" + group;\n };\n }\n });\n\n // src/traces/bar/cross_trace_calc.js\n var require_cross_trace_calc = __commonJS({\n \"src/traces/bar/cross_trace_calc.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n var BADNUM = require_numerical().BADNUM;\n var Registry = require_registry();\n var Axes = require_axes();\n var getAxisGroup = require_constraints().getAxisGroup;\n var Sieve = require_sieve();\n function crossTraceCalc(gd, plotinfo) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var fullLayout = gd._fullLayout;\n var fullTraces = gd._fullData;\n var calcTraces = gd.calcdata;\n var calcTracesHorz = [];\n var calcTracesVert = [];\n for (var i = 0; i < fullTraces.length; i++) {\n var fullTrace = fullTraces[i];\n if (fullTrace.visible === true && Registry.traceIs(fullTrace, \"bar\") && fullTrace.xaxis === xa._id && fullTrace.yaxis === ya._id) {\n if (fullTrace.orientation === \"h\") {\n calcTracesHorz.push(calcTraces[i]);\n } else {\n calcTracesVert.push(calcTraces[i]);\n }\n if (fullTrace._computePh) {\n var cd = gd.calcdata[i];\n for (var j = 0; j < cd.length; j++) {\n if (typeof cd[j].ph0 === \"function\") cd[j].ph0 = cd[j].ph0();\n if (typeof cd[j].ph1 === \"function\") cd[j].ph1 = cd[j].ph1();\n }\n }\n }\n }\n var opts = {\n xCat: xa.type === \"category\" || xa.type === \"multicategory\",\n yCat: ya.type === \"category\" || ya.type === \"multicategory\",\n mode: fullLayout.barmode,\n norm: fullLayout.barnorm,\n gap: fullLayout.bargap,\n groupgap: fullLayout.bargroupgap\n };\n setGroupPositions(gd, xa, ya, calcTracesVert, opts);\n setGroupPositions(gd, ya, xa, calcTracesHorz, opts);\n }\n function setGroupPositions(gd, pa, sa, calcTraces, opts) {\n if (!calcTraces.length) return;\n var excluded;\n var included;\n var i, calcTrace, fullTrace;\n initBase(sa, calcTraces);\n switch (opts.mode) {\n case \"overlay\":\n setGroupPositionsInOverlayMode(gd, pa, sa, calcTraces, opts);\n break;\n case \"group\":\n excluded = [];\n included = [];\n for (i = 0; i < calcTraces.length; i++) {\n calcTrace = calcTraces[i];\n fullTrace = calcTrace[0].trace;\n if (fullTrace.offset === void 0) included.push(calcTrace);\n else excluded.push(calcTrace);\n }\n if (included.length) {\n setGroupPositionsInGroupMode(gd, pa, sa, included, opts);\n }\n if (excluded.length) {\n setGroupPositionsInOverlayMode(gd, pa, sa, excluded, opts);\n }\n break;\n case \"stack\":\n case \"relative\":\n excluded = [];\n included = [];\n for (i = 0; i < calcTraces.length; i++) {\n calcTrace = calcTraces[i];\n fullTrace = calcTrace[0].trace;\n if (fullTrace.base === void 0) included.push(calcTrace);\n else excluded.push(calcTrace);\n }\n standardizeCornerradius(included);\n if (included.length) {\n setGroupPositionsInStackOrRelativeMode(gd, pa, sa, included, opts);\n }\n if (excluded.length) {\n setGroupPositionsInOverlayMode(gd, pa, sa, excluded, opts);\n }\n break;\n }\n setCornerradius(calcTraces);\n collectExtents(calcTraces, pa);\n }\n function setCornerradius(calcTraces) {\n var i, calcTrace, fullTrace, t, cr, crValue, crForm;\n for (i = 0; i < calcTraces.length; i++) {\n calcTrace = calcTraces[i];\n fullTrace = calcTrace[0].trace;\n t = calcTrace[0].t;\n if (t.cornerradiusvalue === void 0) {\n cr = fullTrace.marker ? fullTrace.marker.cornerradius : void 0;\n if (cr !== void 0) {\n crValue = isNumeric(cr) ? +cr : +cr.slice(0, -1);\n crForm = isNumeric(cr) ? \"px\" : \"%\";\n t.cornerradiusvalue = crValue;\n t.cornerradiusform = crForm;\n }\n }\n }\n }\n function standardizeCornerradius(calcTraces) {\n if (calcTraces.length < 2) return;\n var i, calcTrace, fullTrace, t;\n var cr, crValue, crForm;\n for (i = 0; i < calcTraces.length; i++) {\n calcTrace = calcTraces[i];\n fullTrace = calcTrace[0].trace;\n cr = fullTrace.marker ? fullTrace.marker.cornerradius : void 0;\n if (cr !== void 0) break;\n }\n if (cr !== void 0) {\n crValue = isNumeric(cr) ? +cr : +cr.slice(0, -1);\n crForm = isNumeric(cr) ? \"px\" : \"%\";\n for (i = 0; i < calcTraces.length; i++) {\n calcTrace = calcTraces[i];\n t = calcTrace[0].t;\n t.cornerradiusvalue = crValue;\n t.cornerradiusform = crForm;\n }\n }\n }\n function initBase(sa, calcTraces) {\n var i, j;\n for (i = 0; i < calcTraces.length; i++) {\n var cd = calcTraces[i];\n var trace = cd[0].trace;\n var base = trace.type === \"funnel\" ? trace._base : trace.base;\n var b;\n var scalendar = trace.orientation === \"h\" ? trace.xcalendar : trace.ycalendar;\n var d2c = sa.type === \"category\" || sa.type === \"multicategory\" ? function() {\n return null;\n } : sa.d2c;\n if (isArrayOrTypedArray(base)) {\n for (j = 0; j < Math.min(base.length, cd.length); j++) {\n b = d2c(base[j], 0, scalendar);\n if (isNumeric(b)) {\n cd[j].b = +b;\n cd[j].hasB = 1;\n } else cd[j].b = 0;\n }\n for (; j < cd.length; j++) {\n cd[j].b = 0;\n }\n } else {\n b = d2c(base, 0, scalendar);\n var hasBase = isNumeric(b);\n b = hasBase ? b : 0;\n for (j = 0; j < cd.length; j++) {\n cd[j].b = b;\n if (hasBase) cd[j].hasB = 1;\n }\n }\n }\n }\n function setGroupPositionsInOverlayMode(gd, pa, sa, calcTraces, opts) {\n for (var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n var sieve = new Sieve([calcTrace], {\n posAxis: pa,\n sepNegVal: false,\n overlapNoMerge: !opts.norm\n });\n setOffsetAndWidth(gd, pa, sieve, opts);\n if (opts.norm) {\n sieveBars(sieve);\n normalizeBars(sa, sieve, opts);\n } else {\n setBaseAndTop(sa, sieve);\n }\n }\n }\n function setGroupPositionsInGroupMode(gd, pa, sa, calcTraces, opts) {\n var sieve = new Sieve(calcTraces, {\n posAxis: pa,\n sepNegVal: false,\n overlapNoMerge: !opts.norm\n });\n setOffsetAndWidth(gd, pa, sieve, opts);\n unhideBarsWithinTrace(sieve, pa);\n if (opts.norm) {\n sieveBars(sieve);\n normalizeBars(sa, sieve, opts);\n } else {\n setBaseAndTop(sa, sieve);\n }\n }\n function setGroupPositionsInStackOrRelativeMode(gd, pa, sa, calcTraces, opts) {\n var sieve = new Sieve(calcTraces, {\n posAxis: pa,\n sepNegVal: opts.mode === \"relative\",\n overlapNoMerge: !(opts.norm || opts.mode === \"stack\" || opts.mode === \"relative\")\n });\n setOffsetAndWidth(gd, pa, sieve, opts);\n stackBars(sa, sieve, opts);\n for (var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n var offsetIndex = calcTrace[0].t.offsetindex;\n for (var j = 0; j < calcTrace.length; j++) {\n var bar = calcTrace[j];\n if (bar.s !== BADNUM) {\n var isOutmostBar = bar.b + bar.s === sieve.get(bar.p, offsetIndex, bar.s);\n if (isOutmostBar) bar._outmost = true;\n }\n }\n }\n if (opts.norm) normalizeBars(sa, sieve, opts);\n }\n function setOffsetAndWidth(gd, pa, sieve, opts) {\n var fullLayout = gd._fullLayout;\n var positions = sieve.positions;\n var distinctPositions = sieve.distinctPositions;\n var minDiff = sieve.minDiff;\n var calcTraces = sieve.traces;\n var nTraces = calcTraces.length;\n var overlap = positions.length !== distinctPositions.length;\n var barGroupWidth = minDiff * (1 - opts.gap);\n var barWidthPlusGap;\n var barWidth;\n var offsetFromCenter;\n var alignmentGroups;\n if (pa._id === \"angularaxis\") {\n barWidthPlusGap = barGroupWidth;\n barWidth = barWidthPlusGap * (1 - (opts.groupgap || 0));\n offsetFromCenter = -barWidth / 2;\n } else {\n var groupId = getAxisGroup(fullLayout, pa._id) + calcTraces[0][0].trace.orientation;\n alignmentGroups = fullLayout._alignmentOpts[groupId] || {};\n }\n for (var i = 0; i < nTraces; i++) {\n var calcTrace = calcTraces[i];\n var trace = calcTrace[0].trace;\n if (pa._id !== \"angularaxis\") {\n var alignmentGroupOpts = alignmentGroups[trace.alignmentgroup] || {};\n var nOffsetGroups = Object.keys(alignmentGroupOpts.offsetGroups || {}).length;\n if (nOffsetGroups) {\n barWidthPlusGap = barGroupWidth / nOffsetGroups;\n } else {\n barWidthPlusGap = overlap ? barGroupWidth / nTraces : barGroupWidth;\n }\n barWidth = barWidthPlusGap * (1 - (opts.groupgap || 0));\n if (nOffsetGroups) {\n offsetFromCenter = ((2 * trace._offsetIndex + 1 - nOffsetGroups) * barWidthPlusGap - barWidth) / 2;\n } else {\n offsetFromCenter = overlap ? ((2 * i + 1 - nTraces) * barWidthPlusGap - barWidth) / 2 : -barWidth / 2;\n }\n }\n var t = calcTrace[0].t;\n t.barwidth = barWidth;\n t.offsetindex = trace._offsetIndex || 0;\n t.poffset = offsetFromCenter;\n t.bargroupwidth = barGroupWidth;\n t.bardelta = minDiff;\n }\n sieve.binWidth = calcTraces[0][0].t.barwidth / 100;\n applyAttributes(sieve);\n setBarCenterAndWidth(pa, sieve);\n if (pa._id === \"angularaxis\") {\n updatePositionAxis(pa, sieve);\n } else {\n updatePositionAxis(pa, sieve, overlap);\n }\n }\n function applyAttributes(sieve) {\n var calcTraces = sieve.traces;\n var i, j;\n for (i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n var calcTrace0 = calcTrace[0];\n var fullTrace = calcTrace0.trace;\n var t = calcTrace0.t;\n var offset = fullTrace._offset || fullTrace.offset;\n var initialPoffset = t.poffset;\n var newPoffset;\n if (isArrayOrTypedArray(offset)) {\n newPoffset = Array.prototype.slice.call(offset, 0, calcTrace.length);\n for (j = 0; j < newPoffset.length; j++) {\n if (!isNumeric(newPoffset[j])) {\n newPoffset[j] = initialPoffset;\n }\n }\n for (j = newPoffset.length; j < calcTrace.length; j++) {\n newPoffset.push(initialPoffset);\n }\n t.poffset = newPoffset;\n } else if (offset !== void 0) {\n t.poffset = offset;\n }\n var width = fullTrace._width || fullTrace.width;\n var initialBarwidth = t.barwidth;\n if (isArrayOrTypedArray(width)) {\n var newBarwidth = Array.prototype.slice.call(width, 0, calcTrace.length);\n for (j = 0; j < newBarwidth.length; j++) {\n if (!isNumeric(newBarwidth[j])) newBarwidth[j] = initialBarwidth;\n }\n for (j = newBarwidth.length; j < calcTrace.length; j++) {\n newBarwidth.push(initialBarwidth);\n }\n t.barwidth = newBarwidth;\n if (offset === void 0) {\n newPoffset = [];\n for (j = 0; j < calcTrace.length; j++) {\n newPoffset.push(\n initialPoffset + (initialBarwidth - newBarwidth[j]) / 2\n );\n }\n t.poffset = newPoffset;\n }\n } else if (width !== void 0) {\n t.barwidth = width;\n if (offset === void 0) {\n t.poffset = initialPoffset + (initialBarwidth - width) / 2;\n }\n }\n }\n }\n function setBarCenterAndWidth(pa, sieve) {\n var calcTraces = sieve.traces;\n var pLetter = getAxisLetter(pa);\n for (var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n var t = calcTrace[0].t;\n var poffset = t.poffset;\n var poffsetIsArray = isArrayOrTypedArray(poffset);\n var barwidth = t.barwidth;\n var barwidthIsArray = isArrayOrTypedArray(barwidth);\n for (var j = 0; j < calcTrace.length; j++) {\n var calcBar = calcTrace[j];\n var width = calcBar.w = barwidthIsArray ? barwidth[j] : barwidth;\n if (calcBar.p === void 0) {\n calcBar.p = calcBar[pLetter];\n calcBar[\"orig_\" + pLetter] = calcBar[pLetter];\n }\n var delta = (poffsetIsArray ? poffset[j] : poffset) + width / 2;\n calcBar[pLetter] = calcBar.p + delta;\n }\n }\n }\n function updatePositionAxis(pa, sieve, allowMinDtick) {\n var calcTraces = sieve.traces;\n var minDiff = sieve.minDiff;\n var vpad = minDiff / 2;\n Axes.minDtick(pa, sieve.minDiff, sieve.distinctPositions[0], allowMinDtick);\n for (var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n var calcTrace0 = calcTrace[0];\n var fullTrace = calcTrace0.trace;\n var pts = [];\n var bar, l, r, j;\n for (j = 0; j < calcTrace.length; j++) {\n bar = calcTrace[j];\n l = bar.p - vpad;\n r = bar.p + vpad;\n pts.push(l, r);\n }\n if (fullTrace.width || fullTrace.offset) {\n var t = calcTrace0.t;\n var poffset = t.poffset;\n var barwidth = t.barwidth;\n var poffsetIsArray = isArrayOrTypedArray(poffset);\n var barwidthIsArray = isArrayOrTypedArray(barwidth);\n for (j = 0; j < calcTrace.length; j++) {\n bar = calcTrace[j];\n var calcBarOffset = poffsetIsArray ? poffset[j] : poffset;\n var calcBarWidth = barwidthIsArray ? barwidth[j] : barwidth;\n l = bar.p + calcBarOffset;\n r = l + calcBarWidth;\n pts.push(l, r);\n }\n }\n fullTrace._extremes[pa._id] = Axes.findExtremes(pa, pts, { padded: false });\n }\n }\n function setBaseAndTop(sa, sieve) {\n var calcTraces = sieve.traces;\n var sLetter = getAxisLetter(sa);\n for (var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n var fullTrace = calcTrace[0].trace;\n var isScatter = fullTrace.type === \"scatter\";\n var isVertical = fullTrace.orientation === \"v\";\n var pts = [];\n var tozero = false;\n for (var j = 0; j < calcTrace.length; j++) {\n var bar = calcTrace[j];\n var base = isScatter ? 0 : bar.b;\n var top = isScatter ? isVertical ? bar.y : bar.x : base + bar.s;\n bar[sLetter] = top;\n pts.push(top);\n if (bar.hasB) pts.push(base);\n if (!bar.hasB || !bar.b) {\n tozero = true;\n }\n }\n fullTrace._extremes[sa._id] = Axes.findExtremes(sa, pts, {\n tozero,\n padded: true\n });\n }\n }\n function stackBars(sa, sieve, opts) {\n var sLetter = getAxisLetter(sa);\n var calcTraces = sieve.traces;\n var calcTrace;\n var fullTrace;\n var isFunnel;\n var i, j;\n var bar;\n var offsetIndex;\n for (i = 0; i < calcTraces.length; i++) {\n calcTrace = calcTraces[i];\n fullTrace = calcTrace[0].trace;\n if (fullTrace.type === \"funnel\") {\n offsetIndex = calcTrace[0].t.offsetindex;\n for (j = 0; j < calcTrace.length; j++) {\n bar = calcTrace[j];\n if (bar.s !== BADNUM) {\n sieve.put(bar.p, offsetIndex, -0.5 * bar.s);\n }\n }\n }\n }\n for (i = 0; i < calcTraces.length; i++) {\n calcTrace = calcTraces[i];\n fullTrace = calcTrace[0].trace;\n isFunnel = fullTrace.type === \"funnel\";\n offsetIndex = fullTrace.type === \"barpolar\" ? 0 : calcTrace[0].t.offsetindex;\n var pts = [];\n for (j = 0; j < calcTrace.length; j++) {\n bar = calcTrace[j];\n if (bar.s !== BADNUM) {\n var value;\n if (isFunnel) {\n value = bar.s;\n } else {\n value = bar.s + bar.b;\n }\n var base = sieve.put(bar.p, offsetIndex, value);\n var top = base + value;\n bar.b = base;\n bar[sLetter] = top;\n if (!opts.norm) {\n pts.push(top);\n if (bar.hasB) {\n pts.push(base);\n }\n }\n }\n }\n if (!opts.norm) {\n fullTrace._extremes[sa._id] = Axes.findExtremes(sa, pts, {\n // N.B. we don't stack base with 'base',\n // so set tozero:true always!\n tozero: true,\n padded: true\n });\n }\n }\n }\n function sieveBars(sieve) {\n var calcTraces = sieve.traces;\n for (var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n var offsetIndex = calcTrace[0].t.offsetindex;\n for (var j = 0; j < calcTrace.length; j++) {\n var bar = calcTrace[j];\n if (bar.s !== BADNUM) {\n sieve.put(bar.p, offsetIndex, bar.b + bar.s);\n }\n }\n }\n }\n function unhideBarsWithinTrace(sieve, pa) {\n var calcTraces = sieve.traces;\n for (var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n var fullTrace = calcTrace[0].trace;\n var offsetIndex = calcTrace[0].t.offsetindex;\n if (fullTrace.base === void 0) {\n var inTraceSieve = new Sieve([calcTrace], {\n posAxis: pa,\n sepNegVal: true,\n overlapNoMerge: true\n });\n for (var j = 0; j < calcTrace.length; j++) {\n var bar = calcTrace[j];\n if (bar.p !== BADNUM) {\n var base = inTraceSieve.put(bar.p, offsetIndex, bar.b + bar.s);\n if (base) bar.b = base;\n }\n }\n }\n }\n }\n function normalizeBars(sa, sieve, opts) {\n var calcTraces = sieve.traces;\n var sLetter = getAxisLetter(sa);\n var sTop = opts.norm === \"fraction\" ? 1 : 100;\n var sTiny = sTop / 1e9;\n var sMin = sa.l2c(sa.c2l(0));\n var sMax = opts.mode === \"stack\" ? sTop : sMin;\n function needsPadding(v) {\n return isNumeric(sa.c2l(v)) && (v < sMin - sTiny || v > sMax + sTiny || !isNumeric(sMin));\n }\n for (var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n var offsetIndex = calcTrace[0].t.offsetindex;\n var fullTrace = calcTrace[0].trace;\n var pts = [];\n var tozero = false;\n var padded = false;\n for (var j = 0; j < calcTrace.length; j++) {\n var bar = calcTrace[j];\n if (bar.s !== BADNUM) {\n var scale = Math.abs(sTop / sieve.get(bar.p, offsetIndex, bar.s));\n bar.b *= scale;\n bar.s *= scale;\n var base = bar.b;\n var top = base + bar.s;\n bar[sLetter] = top;\n pts.push(top);\n padded = padded || needsPadding(top);\n if (bar.hasB) {\n pts.push(base);\n padded = padded || needsPadding(base);\n }\n if (!bar.hasB || !bar.b) {\n tozero = true;\n }\n }\n }\n fullTrace._extremes[sa._id] = Axes.findExtremes(sa, pts, {\n tozero,\n padded\n });\n }\n }\n function setHelperValuesForRoundedCorners(calcTraces, sMinByPos, sMaxByPos, pa) {\n var pLetter = getAxisLetter(pa);\n for (var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n for (var j = 0; j < calcTrace.length; j++) {\n var bar = calcTrace[j];\n var pos = bar[pLetter];\n bar._sMin = sMinByPos[pos];\n bar._sMax = sMaxByPos[pos];\n }\n }\n }\n function collectExtents(calcTraces, pa) {\n var pLetter = getAxisLetter(pa);\n var extents = {};\n var i, j, cd;\n var pMin = Infinity;\n var pMax = -Infinity;\n for (i = 0; i < calcTraces.length; i++) {\n cd = calcTraces[i];\n for (j = 0; j < cd.length; j++) {\n var p = cd[j].p;\n if (isNumeric(p)) {\n pMin = Math.min(pMin, p);\n pMax = Math.max(pMax, p);\n }\n }\n }\n var roundFactor = 1e4 / (pMax - pMin);\n var round = extents.round = function(p2) {\n return String(Math.round(roundFactor * (p2 - pMin)));\n };\n var sMinByPos = {};\n var sMaxByPos = {};\n var anyTraceHasCornerradius = calcTraces.some(function(x) {\n var trace = x[0].trace;\n return \"marker\" in trace && trace.marker.cornerradius;\n });\n for (i = 0; i < calcTraces.length; i++) {\n cd = calcTraces[i];\n cd[0].t.extents = extents;\n var poffset = cd[0].t.poffset;\n var poffsetIsArray = isArrayOrTypedArray(poffset);\n for (j = 0; j < cd.length; j++) {\n var di = cd[j];\n var p0 = di[pLetter] - di.w / 2;\n if (isNumeric(p0)) {\n var p1 = di[pLetter] + di.w / 2;\n var pVal = round(di.p);\n if (extents[pVal]) {\n extents[pVal] = [Math.min(p0, extents[pVal][0]), Math.max(p1, extents[pVal][1])];\n } else {\n extents[pVal] = [p0, p1];\n }\n }\n di.p0 = di.p + (poffsetIsArray ? poffset[j] : poffset);\n di.p1 = di.p0 + di.w;\n di.s0 = di.b;\n di.s1 = di.s0 + di.s;\n if (anyTraceHasCornerradius) {\n var sMin = Math.min(di.s0, di.s1) || 0;\n var sMax = Math.max(di.s0, di.s1) || 0;\n var pos = di[pLetter];\n sMinByPos[pos] = pos in sMinByPos ? Math.min(sMinByPos[pos], sMin) : sMin;\n sMaxByPos[pos] = pos in sMaxByPos ? Math.max(sMaxByPos[pos], sMax) : sMax;\n }\n }\n }\n if (anyTraceHasCornerradius) {\n setHelperValuesForRoundedCorners(calcTraces, sMinByPos, sMaxByPos, pa);\n }\n }\n function getAxisLetter(ax) {\n return ax._id.charAt(0);\n }\n module.exports = {\n crossTraceCalc,\n setGroupPositions\n };\n }\n });\n\n // src/traces/scatter/cross_trace_calc.js\n var require_cross_trace_calc2 = __commonJS({\n \"src/traces/scatter/cross_trace_calc.js\"(exports, module) {\n \"use strict\";\n var calc = require_calc3();\n var setGroupPositions = require_cross_trace_calc().setGroupPositions;\n function groupCrossTraceCalc(gd, plotinfo) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var fullLayout = gd._fullLayout;\n var fullTraces = gd._fullData;\n var calcTraces = gd.calcdata;\n var calcTracesHorz = [];\n var calcTracesVert = [];\n for (var i = 0; i < fullTraces.length; i++) {\n var fullTrace = fullTraces[i];\n if (fullTrace.visible === true && fullTrace.type === \"scatter\" && fullTrace.xaxis === xa._id && fullTrace.yaxis === ya._id) {\n if (fullTrace.orientation === \"h\") {\n calcTracesHorz.push(calcTraces[i]);\n } else if (fullTrace.orientation === \"v\") {\n calcTracesVert.push(calcTraces[i]);\n }\n }\n }\n var opts = {\n mode: fullLayout.scattermode,\n gap: fullLayout.scattergap\n };\n setGroupPositions(gd, xa, ya, calcTracesVert, opts);\n setGroupPositions(gd, ya, xa, calcTracesHorz, opts);\n }\n module.exports = function crossTraceCalc(gd, plotinfo) {\n if (gd._fullLayout.scattermode === \"group\") {\n groupCrossTraceCalc(gd, plotinfo);\n }\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var subplot = xa._id + ya._id;\n var subplotStackOpts = gd._fullLayout._scatterStackOpts[subplot];\n if (!subplotStackOpts) return;\n var calcTraces = gd.calcdata;\n var i, j, k, i2, cd, cd0, posj, sumj, norm;\n var groupOpts, interpolate, groupnorm, posAttr, valAttr;\n var hasAnyBlanks;\n for (var stackGroup in subplotStackOpts) {\n groupOpts = subplotStackOpts[stackGroup];\n var indices = groupOpts.traceIndices;\n if (!indices.length) continue;\n interpolate = groupOpts.stackgaps === \"interpolate\";\n groupnorm = groupOpts.groupnorm;\n if (groupOpts.orientation === \"v\") {\n posAttr = \"x\";\n valAttr = \"y\";\n } else {\n posAttr = \"y\";\n valAttr = \"x\";\n }\n hasAnyBlanks = new Array(indices.length);\n for (i = 0; i < hasAnyBlanks.length; i++) {\n hasAnyBlanks[i] = false;\n }\n cd0 = calcTraces[indices[0]];\n var allPositions = new Array(cd0.length);\n for (i = 0; i < cd0.length; i++) {\n allPositions[i] = cd0[i][posAttr];\n }\n for (i = 1; i < indices.length; i++) {\n cd = calcTraces[indices[i]];\n for (j = k = 0; j < cd.length; j++) {\n posj = cd[j][posAttr];\n for (; posj > allPositions[k] && k < allPositions.length; k++) {\n insertBlank(cd, j, allPositions[k], i, hasAnyBlanks, interpolate, posAttr);\n j++;\n }\n if (posj !== allPositions[k]) {\n for (i2 = 0; i2 < i; i2++) {\n insertBlank(calcTraces[indices[i2]], k, posj, i2, hasAnyBlanks, interpolate, posAttr);\n }\n allPositions.splice(k, 0, posj);\n }\n k++;\n }\n for (; k < allPositions.length; k++) {\n insertBlank(cd, j, allPositions[k], i, hasAnyBlanks, interpolate, posAttr);\n j++;\n }\n }\n var serieslen = allPositions.length;\n for (j = 0; j < cd0.length; j++) {\n sumj = cd0[j][valAttr] = cd0[j].s;\n for (i = 1; i < indices.length; i++) {\n cd = calcTraces[indices[i]];\n cd[0].trace._rawLength = cd[0].trace._length;\n cd[0].trace._length = serieslen;\n sumj += cd[j].s;\n cd[j][valAttr] = sumj;\n }\n if (groupnorm) {\n norm = (groupnorm === \"fraction\" ? sumj : sumj / 100) || 1;\n for (i = 0; i < indices.length; i++) {\n var cdj = calcTraces[indices[i]][j];\n cdj[valAttr] /= norm;\n cdj.sNorm = cdj.s / norm;\n }\n }\n }\n for (i = 0; i < indices.length; i++) {\n cd = calcTraces[indices[i]];\n var trace = cd[0].trace;\n var ppad = calc.calcMarkerSize(trace, trace._rawLength);\n var arrayPad = Array.isArray(ppad);\n if (ppad && hasAnyBlanks[i] || arrayPad) {\n var ppadRaw = ppad;\n ppad = new Array(serieslen);\n for (j = 0; j < serieslen; j++) {\n ppad[j] = cd[j].gap ? 0 : arrayPad ? ppadRaw[cd[j].i] : ppadRaw;\n }\n }\n var x = new Array(serieslen);\n var y = new Array(serieslen);\n for (j = 0; j < serieslen; j++) {\n x[j] = cd[j].x;\n y[j] = cd[j].y;\n }\n calc.calcAxisExpansion(gd, trace, xa, ya, x, y, ppad);\n cd[0].t.orientation = groupOpts.orientation;\n }\n }\n };\n function insertBlank(calcTrace, index, position, traceIndex, hasAnyBlanks, interpolate, posAttr) {\n hasAnyBlanks[traceIndex] = true;\n var newEntry = {\n i: null,\n gap: true,\n s: 0\n };\n newEntry[posAttr] = position;\n calcTrace.splice(index, 0, newEntry);\n if (index && position === calcTrace[index - 1][posAttr]) {\n var prevEntry = calcTrace[index - 1];\n newEntry.s = prevEntry.s;\n newEntry.i = prevEntry.i;\n newEntry.gap = prevEntry.gap;\n } else if (interpolate) {\n newEntry.s = getInterp(calcTrace, index, position, posAttr);\n }\n if (!index) {\n calcTrace[0].t = calcTrace[1].t;\n calcTrace[0].trace = calcTrace[1].trace;\n delete calcTrace[1].t;\n delete calcTrace[1].trace;\n }\n }\n function getInterp(calcTrace, index, position, posAttr) {\n var pt0 = calcTrace[index - 1];\n var pt1 = calcTrace[index + 1];\n if (!pt1) return pt0.s;\n if (!pt0) return pt1.s;\n return pt0.s + (pt1.s - pt0.s) * (position - pt0[posAttr]) / (pt1[posAttr] - pt0[posAttr]);\n }\n }\n });\n\n // src/traces/scatter/line_points.js\n var require_line_points = __commonJS({\n \"src/traces/scatter/line_points.js\"(exports, module) {\n \"use strict\";\n var Drawing = require_drawing();\n var numConstants = require_numerical();\n var BADNUM = numConstants.BADNUM;\n var LOG_CLIP = numConstants.LOG_CLIP;\n var LOG_CLIP_PLUS = LOG_CLIP + 0.5;\n var LOG_CLIP_MINUS = LOG_CLIP - 0.5;\n var Lib = require_lib();\n var segmentsIntersect = Lib.segmentsIntersect;\n var constrain = Lib.constrain;\n var constants = require_constants8();\n module.exports = function linePoints(d, opts) {\n var trace = opts.trace || {};\n var xa = opts.xaxis;\n var ya = opts.yaxis;\n var xLog = xa.type === \"log\";\n var yLog = ya.type === \"log\";\n var xLen = xa._length;\n var yLen = ya._length;\n var backoff = opts.backoff;\n var marker = trace.marker;\n var connectGaps = opts.connectGaps;\n var baseTolerance = opts.baseTolerance;\n var shape = opts.shape;\n var linear2 = shape === \"linear\";\n var fill = trace.fill && trace.fill !== \"none\";\n var segments = [];\n var minTolerance = constants.minTolerance;\n var len = d.length;\n var pts = new Array(len);\n var pti = 0;\n var i;\n var clusterStartPt, clusterEndPt, clusterHighPt, clusterLowPt;\n var thisPt;\n var clusterHighFirst;\n var clusterUnitVector;\n var thisVector;\n var clusterRefDist, clusterHighVal, clusterLowVal, thisVal;\n var clusterMinDeviation, clusterMaxDeviation, thisDeviation;\n function getPt(index) {\n var di = d[index];\n if (!di) return false;\n var x = opts.linearized ? xa.l2p(di.x) : xa.c2p(di.x);\n var y = opts.linearized ? ya.l2p(di.y) : ya.c2p(di.y);\n if (x === BADNUM) {\n if (xLog) x = xa.c2p(di.x, true);\n if (x === BADNUM) return false;\n if (yLog && y === BADNUM) {\n x *= Math.abs(xa._m * yLen * (xa._m > 0 ? LOG_CLIP_PLUS : LOG_CLIP_MINUS) / (ya._m * xLen * (ya._m > 0 ? LOG_CLIP_PLUS : LOG_CLIP_MINUS)));\n }\n x *= 1e3;\n }\n if (y === BADNUM) {\n if (yLog) y = ya.c2p(di.y, true);\n if (y === BADNUM) return false;\n y *= 1e3;\n }\n return [x, y];\n }\n function crossesViewport(xFrac0, yFrac0, xFrac1, yFrac1) {\n var dx = xFrac1 - xFrac0;\n var dy = yFrac1 - yFrac0;\n var dx0 = 0.5 - xFrac0;\n var dy0 = 0.5 - yFrac0;\n var norm2 = dx * dx + dy * dy;\n var dot = dx * dx0 + dy * dy0;\n if (dot > 0 && dot < norm2) {\n var cross = dx0 * dy - dy0 * dx;\n if (cross * cross < norm2) return true;\n }\n }\n var latestXFrac, latestYFrac;\n function getTolerance(pt, nextPt2) {\n var xFrac = pt[0] / xLen;\n var yFrac = pt[1] / yLen;\n var offScreenFraction = Math.max(0, -xFrac, xFrac - 1, -yFrac, yFrac - 1);\n if (offScreenFraction && latestXFrac !== void 0 && crossesViewport(xFrac, yFrac, latestXFrac, latestYFrac)) {\n offScreenFraction = 0;\n }\n if (offScreenFraction && nextPt2 && crossesViewport(xFrac, yFrac, nextPt2[0] / xLen, nextPt2[1] / yLen)) {\n offScreenFraction = 0;\n }\n return (1 + constants.toleranceGrowth * offScreenFraction) * baseTolerance;\n }\n function ptDist(pt1, pt2) {\n var dx = pt1[0] - pt2[0];\n var dy = pt1[1] - pt2[1];\n return Math.sqrt(dx * dx + dy * dy);\n }\n var maxScreensAway = constants.maxScreensAway;\n var xEdge0 = -xLen * maxScreensAway;\n var xEdge1 = xLen * (1 + maxScreensAway);\n var yEdge0 = -yLen * maxScreensAway;\n var yEdge1 = yLen * (1 + maxScreensAway);\n var edges = [\n [xEdge0, yEdge0, xEdge1, yEdge0],\n [xEdge1, yEdge0, xEdge1, yEdge1],\n [xEdge1, yEdge1, xEdge0, yEdge1],\n [xEdge0, yEdge1, xEdge0, yEdge0]\n ];\n var xEdge, yEdge, lastXEdge, lastYEdge, lastFarPt, edgePt;\n function getLinearEdgeIntersections(pt1, pt2) {\n var out = [];\n var ptCount = 0;\n for (var i2 = 0; i2 < 4; i2++) {\n var edge = edges[i2];\n var ptInt = segmentsIntersect(\n pt1[0],\n pt1[1],\n pt2[0],\n pt2[1],\n edge[0],\n edge[1],\n edge[2],\n edge[3]\n );\n if (ptInt && (!ptCount || Math.abs(ptInt.x - out[0][0]) > 1 || Math.abs(ptInt.y - out[0][1]) > 1)) {\n ptInt = [ptInt.x, ptInt.y];\n if (ptCount && ptDist(ptInt, pt1) < ptDist(out[0], pt1)) out.unshift(ptInt);\n else out.push(ptInt);\n ptCount++;\n }\n }\n return out;\n }\n function onlyConstrainedPoint(pt) {\n if (pt[0] < xEdge0 || pt[0] > xEdge1 || pt[1] < yEdge0 || pt[1] > yEdge1) {\n return [constrain(pt[0], xEdge0, xEdge1), constrain(pt[1], yEdge0, yEdge1)];\n }\n }\n function sameEdge(pt1, pt2) {\n if (pt1[0] === pt2[0] && (pt1[0] === xEdge0 || pt1[0] === xEdge1)) return true;\n if (pt1[1] === pt2[1] && (pt1[1] === yEdge0 || pt1[1] === yEdge1)) return true;\n }\n function getHVEdgeIntersections(pt1, pt2) {\n var out = [];\n var ptInt1 = onlyConstrainedPoint(pt1);\n var ptInt2 = onlyConstrainedPoint(pt2);\n if (ptInt1 && ptInt2 && sameEdge(ptInt1, ptInt2)) return out;\n if (ptInt1) out.push(ptInt1);\n if (ptInt2) out.push(ptInt2);\n return out;\n }\n function getABAEdgeIntersections(dim, limit0, limit1) {\n return function(pt1, pt2) {\n var ptInt1 = onlyConstrainedPoint(pt1);\n var ptInt2 = onlyConstrainedPoint(pt2);\n var out = [];\n if (ptInt1 && ptInt2 && sameEdge(ptInt1, ptInt2)) return out;\n if (ptInt1) out.push(ptInt1);\n if (ptInt2) out.push(ptInt2);\n var midShift = 2 * Lib.constrain((pt1[dim] + pt2[dim]) / 2, limit0, limit1) - ((ptInt1 || pt1)[dim] + (ptInt2 || pt2)[dim]);\n if (midShift) {\n var ptToAlter;\n if (ptInt1 && ptInt2) {\n ptToAlter = midShift > 0 === ptInt1[dim] > ptInt2[dim] ? ptInt1 : ptInt2;\n } else ptToAlter = ptInt1 || ptInt2;\n ptToAlter[dim] += midShift;\n }\n return out;\n };\n }\n var getEdgeIntersections;\n if (shape === \"linear\" || shape === \"spline\") {\n getEdgeIntersections = getLinearEdgeIntersections;\n } else if (shape === \"hv\" || shape === \"vh\") {\n getEdgeIntersections = getHVEdgeIntersections;\n } else if (shape === \"hvh\") getEdgeIntersections = getABAEdgeIntersections(0, xEdge0, xEdge1);\n else if (shape === \"vhv\") getEdgeIntersections = getABAEdgeIntersections(1, yEdge0, yEdge1);\n function getClosestCorner(pt1, pt2) {\n var dx = pt2[0] - pt1[0];\n var m = (pt2[1] - pt1[1]) / dx;\n var b = (pt1[1] * pt2[0] - pt2[1] * pt1[0]) / dx;\n if (b > 0) return [m > 0 ? xEdge0 : xEdge1, yEdge1];\n else return [m > 0 ? xEdge1 : xEdge0, yEdge0];\n }\n function updateEdge(pt) {\n var x = pt[0];\n var y = pt[1];\n var xSame = x === pts[pti - 1][0];\n var ySame = y === pts[pti - 1][1];\n if (xSame && ySame) return;\n if (pti > 1) {\n var xSame2 = x === pts[pti - 2][0];\n var ySame2 = y === pts[pti - 2][1];\n if (xSame && (x === xEdge0 || x === xEdge1) && xSame2) {\n if (ySame2) pti--;\n else pts[pti - 1] = pt;\n } else if (ySame && (y === yEdge0 || y === yEdge1) && ySame2) {\n if (xSame2) pti--;\n else pts[pti - 1] = pt;\n } else pts[pti++] = pt;\n } else pts[pti++] = pt;\n }\n function updateEdgesForReentry(pt) {\n if (pts[pti - 1][0] !== pt[0] && pts[pti - 1][1] !== pt[1]) {\n updateEdge([lastXEdge, lastYEdge]);\n }\n updateEdge(pt);\n lastFarPt = null;\n lastXEdge = lastYEdge = 0;\n }\n var arrayMarker = Lib.isArrayOrTypedArray(marker);\n function addPt(pt) {\n if (pt && backoff) {\n pt.i = i;\n pt.d = d;\n pt.trace = trace;\n pt.marker = arrayMarker ? marker[pt.i] : marker;\n pt.backoff = backoff;\n }\n latestXFrac = pt[0] / xLen;\n latestYFrac = pt[1] / yLen;\n xEdge = pt[0] < xEdge0 ? xEdge0 : pt[0] > xEdge1 ? xEdge1 : 0;\n yEdge = pt[1] < yEdge0 ? yEdge0 : pt[1] > yEdge1 ? yEdge1 : 0;\n if (xEdge || yEdge) {\n if (!pti) {\n pts[pti++] = [xEdge || pt[0], yEdge || pt[1]];\n } else if (lastFarPt) {\n var intersections = getEdgeIntersections(lastFarPt, pt);\n if (intersections.length > 1) {\n updateEdgesForReentry(intersections[0]);\n pts[pti++] = intersections[1];\n }\n } else {\n edgePt = getEdgeIntersections(pts[pti - 1], pt)[0];\n pts[pti++] = edgePt;\n }\n var lastPt = pts[pti - 1];\n if (xEdge && yEdge && (lastPt[0] !== xEdge || lastPt[1] !== yEdge)) {\n if (lastFarPt) {\n if (lastXEdge !== xEdge && lastYEdge !== yEdge) {\n if (lastXEdge && lastYEdge) {\n updateEdge(getClosestCorner(lastFarPt, pt));\n } else {\n updateEdge([lastXEdge || xEdge, lastYEdge || yEdge]);\n }\n } else if (lastXEdge && lastYEdge) {\n updateEdge([lastXEdge, lastYEdge]);\n }\n }\n updateEdge([xEdge, yEdge]);\n } else if (lastXEdge - xEdge && lastYEdge - yEdge) {\n updateEdge([xEdge || lastXEdge, yEdge || lastYEdge]);\n }\n lastFarPt = pt;\n lastXEdge = xEdge;\n lastYEdge = yEdge;\n } else {\n if (lastFarPt) {\n updateEdgesForReentry(getEdgeIntersections(lastFarPt, pt)[0]);\n }\n pts[pti++] = pt;\n }\n }\n for (i = 0; i < len; i++) {\n clusterStartPt = getPt(i);\n if (!clusterStartPt) continue;\n pti = 0;\n lastFarPt = null;\n addPt(clusterStartPt);\n for (i++; i < len; i++) {\n clusterHighPt = getPt(i);\n if (!clusterHighPt) {\n if (connectGaps) continue;\n else break;\n }\n if (!linear2 || !opts.simplify) {\n addPt(clusterHighPt);\n continue;\n }\n var nextPt = getPt(i + 1);\n clusterRefDist = ptDist(clusterHighPt, clusterStartPt);\n if (!(fill && (pti === 0 || pti === len - 1)) && clusterRefDist < getTolerance(clusterHighPt, nextPt) * minTolerance) continue;\n clusterUnitVector = [\n (clusterHighPt[0] - clusterStartPt[0]) / clusterRefDist,\n (clusterHighPt[1] - clusterStartPt[1]) / clusterRefDist\n ];\n clusterLowPt = clusterStartPt;\n clusterHighVal = clusterRefDist;\n clusterLowVal = clusterMinDeviation = clusterMaxDeviation = 0;\n clusterHighFirst = false;\n clusterEndPt = clusterHighPt;\n for (i++; i < d.length; i++) {\n thisPt = nextPt;\n nextPt = getPt(i + 1);\n if (!thisPt) {\n if (connectGaps) continue;\n else break;\n }\n thisVector = [\n thisPt[0] - clusterStartPt[0],\n thisPt[1] - clusterStartPt[1]\n ];\n thisDeviation = thisVector[0] * clusterUnitVector[1] - thisVector[1] * clusterUnitVector[0];\n clusterMinDeviation = Math.min(clusterMinDeviation, thisDeviation);\n clusterMaxDeviation = Math.max(clusterMaxDeviation, thisDeviation);\n if (clusterMaxDeviation - clusterMinDeviation > getTolerance(thisPt, nextPt)) break;\n clusterEndPt = thisPt;\n thisVal = thisVector[0] * clusterUnitVector[0] + thisVector[1] * clusterUnitVector[1];\n if (thisVal > clusterHighVal) {\n clusterHighVal = thisVal;\n clusterHighPt = thisPt;\n clusterHighFirst = false;\n } else if (thisVal < clusterLowVal) {\n clusterLowVal = thisVal;\n clusterLowPt = thisPt;\n clusterHighFirst = true;\n }\n }\n if (clusterHighFirst) {\n addPt(clusterHighPt);\n if (clusterEndPt !== clusterLowPt) addPt(clusterLowPt);\n } else {\n if (clusterLowPt !== clusterStartPt) addPt(clusterLowPt);\n if (clusterEndPt !== clusterHighPt) addPt(clusterHighPt);\n }\n addPt(clusterEndPt);\n if (i >= d.length || !thisPt) break;\n addPt(thisPt);\n clusterStartPt = thisPt;\n }\n if (lastFarPt) updateEdge([lastXEdge || lastFarPt[0], lastYEdge || lastFarPt[1]]);\n segments.push(pts.slice(0, pti));\n }\n var lastShapeChar = shape.slice(shape.length - 1);\n if (backoff && lastShapeChar !== \"h\" && lastShapeChar !== \"v\") {\n var trimmed = false;\n var n = -1;\n var newSegments = [];\n for (var j = 0; j < segments.length; j++) {\n for (var k = 0; k < segments[j].length - 1; k++) {\n var start = segments[j][k];\n var end = segments[j][k + 1];\n var xy = Drawing.applyBackoff(end, start);\n if (xy[0] !== end[0] || xy[1] !== end[1]) {\n trimmed = true;\n }\n if (!newSegments[n + 1]) {\n n++;\n newSegments[n] = [\n start,\n [xy[0], xy[1]]\n ];\n }\n }\n }\n return trimmed ? newSegments : segments;\n }\n return segments;\n };\n }\n });\n\n // src/traces/scatter/link_traces.js\n var require_link_traces = __commonJS({\n \"src/traces/scatter/link_traces.js\"(exports, module) {\n \"use strict\";\n var LINKEDFILLS = { tonextx: 1, tonexty: 1, tonext: 1 };\n module.exports = function linkTraces(gd, plotinfo, cdscatter) {\n var trace, i, group, prevtrace, groupIndex;\n var groupIndices = {};\n var needsSort = false;\n var prevGroupIndex = -1;\n var nextGroupIndex = 0;\n var prevUnstackedGroupIndex = -1;\n for (i = 0; i < cdscatter.length; i++) {\n trace = cdscatter[i][0].trace;\n group = trace.stackgroup || \"\";\n if (group) {\n if (group in groupIndices) {\n groupIndex = groupIndices[group];\n } else {\n groupIndex = groupIndices[group] = nextGroupIndex;\n nextGroupIndex++;\n }\n } else if (trace.fill in LINKEDFILLS && prevUnstackedGroupIndex >= 0) {\n groupIndex = prevUnstackedGroupIndex;\n } else {\n groupIndex = prevUnstackedGroupIndex = nextGroupIndex;\n nextGroupIndex++;\n }\n if (groupIndex < prevGroupIndex) needsSort = true;\n trace._groupIndex = prevGroupIndex = groupIndex;\n }\n var cdscatterSorted = cdscatter.slice();\n if (needsSort) {\n cdscatterSorted.sort(function(a, b) {\n var traceA = a[0].trace;\n var traceB = b[0].trace;\n return traceA._groupIndex - traceB._groupIndex || traceA.index - traceB.index;\n });\n }\n var prevtraces = {};\n for (i = 0; i < cdscatterSorted.length; i++) {\n trace = cdscatterSorted[i][0].trace;\n group = trace.stackgroup || \"\";\n if (trace.visible === true) {\n trace._nexttrace = null;\n if (trace.fill in LINKEDFILLS) {\n prevtrace = prevtraces[group];\n trace._prevtrace = prevtrace || null;\n if (prevtrace) {\n prevtrace._nexttrace = trace;\n }\n }\n trace._ownfill = trace.fill && (trace.fill.substr(0, 6) === \"tozero\" || trace.fill === \"toself\" || trace.fill.substr(0, 2) === \"to\" && !trace._prevtrace);\n prevtraces[group] = trace;\n } else {\n trace._prevtrace = trace._nexttrace = trace._ownfill = null;\n }\n }\n return cdscatterSorted;\n };\n }\n });\n\n // src/traces/scatter/plot.js\n var require_plot = __commonJS({\n \"src/traces/scatter/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Registry = require_registry();\n var Lib = require_lib();\n var ensureSingle = Lib.ensureSingle;\n var identity2 = Lib.identity;\n var Drawing = require_drawing();\n var subTypes = require_subtypes();\n var linePoints = require_line_points();\n var linkTraces = require_link_traces();\n var polygonTester = require_polygon().tester;\n module.exports = function plot(gd, plotinfo, cdscatter, scatterLayer, transitionOpts, makeOnCompleteCallback) {\n var join, onComplete;\n var isFullReplot = !transitionOpts;\n var hasTransition = !!transitionOpts && transitionOpts.duration > 0;\n var cdscatterSorted = linkTraces(gd, plotinfo, cdscatter);\n join = scatterLayer.selectAll(\"g.trace\").data(cdscatterSorted, function(d) {\n return d[0].trace.uid;\n });\n join.enter().append(\"g\").attr(\"class\", function(d) {\n return \"trace scatter trace\" + d[0].trace.uid;\n }).style(\"stroke-miterlimit\", 2);\n join.order();\n createFills(gd, join, plotinfo);\n if (hasTransition) {\n if (makeOnCompleteCallback) {\n onComplete = makeOnCompleteCallback();\n }\n var transition = d3.transition().duration(transitionOpts.duration).ease(transitionOpts.easing).each(\"end\", function() {\n onComplete && onComplete();\n }).each(\"interrupt\", function() {\n onComplete && onComplete();\n });\n transition.each(function() {\n scatterLayer.selectAll(\"g.trace\").each(function(d, i) {\n plotOne(gd, i, plotinfo, d, cdscatterSorted, this, transitionOpts);\n });\n });\n } else {\n join.each(function(d, i) {\n plotOne(gd, i, plotinfo, d, cdscatterSorted, this, transitionOpts);\n });\n }\n if (isFullReplot) {\n join.exit().remove();\n }\n scatterLayer.selectAll(\"path:not([d])\").remove();\n };\n function createFills(gd, traceJoin, plotinfo) {\n traceJoin.each(function(d) {\n var fills = ensureSingle(d3.select(this), \"g\", \"fills\");\n Drawing.setClipUrl(fills, plotinfo.layerClipId, gd);\n var trace = d[0].trace;\n var fillData = [];\n if (trace._ownfill) fillData.push(\"_ownFill\");\n if (trace._nexttrace) fillData.push(\"_nextFill\");\n var fillJoin = fills.selectAll(\"g\").data(fillData, identity2);\n fillJoin.enter().append(\"g\");\n fillJoin.exit().each(function(d2) {\n trace[d2] = null;\n }).remove();\n fillJoin.order().each(function(d2) {\n trace[d2] = ensureSingle(d3.select(this), \"path\", \"js-fill\");\n });\n });\n }\n function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transitionOpts) {\n var isStatic = gd._context.staticPlot;\n var i;\n selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll);\n var hasTransition = !!transitionOpts && transitionOpts.duration > 0;\n function transition(selection) {\n return hasTransition ? selection.transition() : selection;\n }\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var trace = cdscatter[0].trace;\n var line = trace.line;\n var tr = d3.select(element);\n var errorBarGroup = ensureSingle(tr, \"g\", \"errorbars\");\n var lines = ensureSingle(tr, \"g\", \"lines\");\n var points = ensureSingle(tr, \"g\", \"points\");\n var text = ensureSingle(tr, \"g\", \"text\");\n Registry.getComponentMethod(\"errorbars\", \"plot\")(gd, errorBarGroup, plotinfo, transitionOpts);\n if (trace.visible !== true) return;\n transition(tr).style(\"opacity\", trace.opacity);\n var ownFillEl3, tonext;\n var ownFillDir = trace.fill.charAt(trace.fill.length - 1);\n if (ownFillDir !== \"x\" && ownFillDir !== \"y\") ownFillDir = \"\";\n var fillAxisIndex, fillAxisZero;\n if (ownFillDir === \"y\") {\n fillAxisIndex = 1;\n fillAxisZero = ya.c2p(0, true);\n } else if (ownFillDir === \"x\") {\n fillAxisIndex = 0;\n fillAxisZero = xa.c2p(0, true);\n }\n cdscatter[0][plotinfo.isRangePlot ? \"nodeRangePlot3\" : \"node3\"] = tr;\n var prevRevpath = \"\";\n var prevPolygons = [];\n var prevtrace = trace._prevtrace;\n var prevFillsegments = null;\n var prevFillElement = null;\n if (prevtrace) {\n prevRevpath = prevtrace._prevRevpath || \"\";\n tonext = prevtrace._nextFill;\n prevPolygons = prevtrace._ownPolygons;\n prevFillsegments = prevtrace._fillsegments;\n prevFillElement = prevtrace._fillElement;\n }\n var thispath;\n var thisrevpath;\n var fullpath = \"\";\n var revpath = \"\";\n var pathfn, revpathbase, revpathfn;\n var pt0, lastSegment, pt1;\n var thisPolygons = [];\n trace._polygons = [];\n var fillsegments = [];\n var segments = [];\n var makeUpdate = Lib.noop;\n ownFillEl3 = trace._ownFill;\n if (subTypes.hasLines(trace) || trace.fill !== \"none\") {\n if (tonext) {\n tonext.datum(cdscatter);\n }\n if ([\"hv\", \"vh\", \"hvh\", \"vhv\"].indexOf(line.shape) !== -1) {\n pathfn = Drawing.steps(line.shape);\n revpathbase = Drawing.steps(\n line.shape.split(\"\").reverse().join(\"\")\n );\n } else if (line.shape === \"spline\") {\n pathfn = revpathbase = function(pts2) {\n var pLast = pts2[pts2.length - 1];\n if (pts2.length > 1 && pts2[0][0] === pLast[0] && pts2[0][1] === pLast[1]) {\n return Drawing.smoothclosed(pts2.slice(1), line.smoothing);\n } else {\n return Drawing.smoothopen(pts2, line.smoothing);\n }\n };\n } else {\n pathfn = revpathbase = function(pts2) {\n return \"M\" + pts2.join(\"L\");\n };\n }\n revpathfn = function(pts2) {\n return revpathbase(pts2.reverse());\n };\n segments = linePoints(cdscatter, {\n xaxis: xa,\n yaxis: ya,\n trace,\n connectGaps: trace.connectgaps,\n baseTolerance: Math.max(line.width || 1, 3) / 4,\n shape: line.shape,\n backoff: line.backoff,\n simplify: line.simplify,\n fill: trace.fill\n });\n fillsegments = new Array(segments.length);\n var fillsegmentCount = 0;\n for (i = 0; i < segments.length; i++) {\n var curpoints;\n var pts = segments[i];\n if (!curpoints || !ownFillDir) {\n curpoints = pts.slice();\n fillsegments[fillsegmentCount] = curpoints;\n fillsegmentCount++;\n } else {\n curpoints.push.apply(curpoints, pts);\n }\n }\n trace._fillElement = null;\n trace._fillExclusionElement = prevFillElement;\n trace._fillsegments = fillsegments.slice(0, fillsegmentCount);\n fillsegments = trace._fillsegments;\n if (segments.length) {\n pt0 = segments[0][0].slice();\n lastSegment = segments[segments.length - 1];\n pt1 = lastSegment[lastSegment.length - 1].slice();\n }\n makeUpdate = function(isEnter) {\n return function(pts2) {\n thispath = pathfn(pts2);\n thisrevpath = revpathfn(pts2);\n if (!fullpath) {\n fullpath = thispath;\n revpath = thisrevpath;\n } else if (ownFillDir) {\n fullpath += \"L\" + thispath.substr(1);\n revpath = thisrevpath + (\"L\" + revpath.substr(1));\n } else {\n fullpath += \"Z\" + thispath;\n revpath = thisrevpath + \"Z\" + revpath;\n }\n if (subTypes.hasLines(trace)) {\n var el = d3.select(this);\n el.datum(cdscatter);\n if (isEnter) {\n transition(el.style(\"opacity\", 0).attr(\"d\", thispath).call(Drawing.lineGroupStyle)).style(\"opacity\", 1);\n } else {\n var sel = transition(el);\n sel.attr(\"d\", thispath);\n Drawing.singleLineStyle(cdscatter, sel);\n }\n }\n };\n };\n }\n var lineJoin = lines.selectAll(\".js-line\").data(segments);\n transition(lineJoin.exit()).style(\"opacity\", 0).remove();\n lineJoin.each(makeUpdate(false));\n lineJoin.enter().append(\"path\").classed(\"js-line\", true).style(\"vector-effect\", isStatic ? \"none\" : \"non-scaling-stroke\").call(Drawing.lineGroupStyle).each(makeUpdate(true));\n Drawing.setClipUrl(lineJoin, plotinfo.layerClipId, gd);\n function clearFill(selection) {\n transition(selection).attr(\"d\", \"M0,0Z\");\n }\n var makeSelfPolygons = function() {\n var polygons = new Array(fillsegments.length);\n for (i = 0; i < fillsegments.length; i++) {\n polygons[i] = polygonTester(fillsegments[i]);\n }\n return polygons;\n };\n var makePolygonsToPrevious = function(prevFillsegments2) {\n var polygons, i2;\n if (!prevFillsegments2 || prevFillsegments2.length === 0) {\n polygons = new Array(fillsegments.length);\n for (i2 = 0; i2 < fillsegments.length; i2++) {\n var pt02 = fillsegments[i2][0].slice();\n var pt12 = fillsegments[i2][fillsegments[i2].length - 1].slice();\n pt02[fillAxisIndex] = pt12[fillAxisIndex] = fillAxisZero;\n var zeropoints = [pt12, pt02];\n var polypoints = zeropoints.concat(fillsegments[i2]);\n polygons[i2] = polygonTester(polypoints);\n }\n } else {\n polygons = new Array(prevFillsegments2.length - 1 + fillsegments.length);\n for (i2 = 0; i2 < prevFillsegments2.length - 1; i2++) {\n polygons[i2] = polygonTester(prevFillsegments2[i2]);\n }\n var reversedPrevFillsegment = prevFillsegments2[prevFillsegments2.length - 1].slice();\n reversedPrevFillsegment.reverse();\n for (i2 = 0; i2 < fillsegments.length; i2++) {\n polygons[prevFillsegments2.length - 1 + i2] = polygonTester(fillsegments[i2].concat(reversedPrevFillsegment));\n }\n }\n return polygons;\n };\n if (segments.length) {\n if (ownFillEl3) {\n ownFillEl3.datum(cdscatter);\n if (pt0 && pt1) {\n if (ownFillDir) {\n pt0[fillAxisIndex] = pt1[fillAxisIndex] = fillAxisZero;\n transition(ownFillEl3).attr(\"d\", \"M\" + pt1 + \"L\" + pt0 + \"L\" + fullpath.substr(1)).call(Drawing.singleFillStyle, gd);\n thisPolygons = makePolygonsToPrevious(null);\n } else {\n transition(ownFillEl3).attr(\"d\", fullpath + \"Z\").call(Drawing.singleFillStyle, gd);\n thisPolygons = makeSelfPolygons();\n }\n }\n trace._polygons = thisPolygons;\n trace._fillElement = ownFillEl3;\n } else if (tonext) {\n if (trace.fill.substr(0, 6) === \"tonext\" && fullpath && prevRevpath) {\n if (trace.fill === \"tonext\") {\n transition(tonext).attr(\"d\", fullpath + \"Z\" + prevRevpath + \"Z\").call(Drawing.singleFillStyle, gd);\n thisPolygons = makeSelfPolygons();\n trace._polygons = thisPolygons.concat(prevPolygons);\n } else {\n transition(tonext).attr(\"d\", fullpath + \"L\" + prevRevpath.substr(1) + \"Z\").call(Drawing.singleFillStyle, gd);\n thisPolygons = makePolygonsToPrevious(prevFillsegments);\n trace._polygons = thisPolygons;\n }\n trace._fillElement = tonext;\n } else {\n clearFill(tonext);\n }\n }\n trace._prevRevpath = revpath;\n } else {\n if (ownFillEl3) clearFill(ownFillEl3);\n else if (tonext) clearFill(tonext);\n trace._prevRevpath = null;\n }\n trace._ownPolygons = thisPolygons;\n function visFilter(d) {\n return d.filter(function(v) {\n return !v.gap && v.vis;\n });\n }\n function visFilterWithGaps(d) {\n return d.filter(function(v) {\n return v.vis;\n });\n }\n function gapFilter(d) {\n return d.filter(function(v) {\n return !v.gap;\n });\n }\n function keyFunc(d) {\n return d.id;\n }\n function getKeyFunc(trace2) {\n if (trace2.ids) {\n return keyFunc;\n }\n }\n function hideFilter() {\n return false;\n }\n function makePoints(points2, text2, cdscatter2) {\n var join, selection, hasNode;\n var trace2 = cdscatter2[0].trace;\n var showMarkers = subTypes.hasMarkers(trace2);\n var showText = subTypes.hasText(trace2);\n var keyFunc2 = getKeyFunc(trace2);\n var markerFilter = hideFilter;\n var textFilter = hideFilter;\n if (showMarkers || showText) {\n var showFilter = identity2;\n var stackGroup = trace2.stackgroup;\n var isInferZero = stackGroup && gd._fullLayout._scatterStackOpts[xa._id + ya._id][stackGroup].stackgaps === \"infer zero\";\n if (trace2.marker.maxdisplayed || trace2._needsCull) {\n showFilter = isInferZero ? visFilterWithGaps : visFilter;\n } else if (stackGroup && !isInferZero) {\n showFilter = gapFilter;\n }\n if (showMarkers) markerFilter = showFilter;\n if (showText) textFilter = showFilter;\n }\n selection = points2.selectAll(\"path.point\");\n join = selection.data(markerFilter, keyFunc2);\n var enter = join.enter().append(\"path\").classed(\"point\", true);\n if (hasTransition) {\n enter.call(Drawing.pointStyle, trace2, gd).call(Drawing.translatePoints, xa, ya).style(\"opacity\", 0).transition().style(\"opacity\", 1);\n }\n join.order();\n var styleFns;\n if (showMarkers) {\n styleFns = Drawing.makePointStyleFns(trace2);\n }\n join.each(function(d) {\n var el = d3.select(this);\n var sel = transition(el);\n hasNode = Drawing.translatePoint(d, sel, xa, ya);\n if (hasNode) {\n Drawing.singlePointStyle(d, sel, trace2, styleFns, gd);\n if (plotinfo.layerClipId) {\n Drawing.hideOutsideRangePoint(d, sel, xa, ya, trace2.xcalendar, trace2.ycalendar);\n }\n if (trace2.customdata) {\n el.classed(\"plotly-customdata\", d.data !== null && d.data !== void 0);\n }\n } else {\n sel.remove();\n }\n });\n if (hasTransition) {\n join.exit().transition().style(\"opacity\", 0).remove();\n } else {\n join.exit().remove();\n }\n selection = text2.selectAll(\"g\");\n join = selection.data(textFilter, keyFunc2);\n join.enter().append(\"g\").classed(\"textpoint\", true).append(\"text\");\n join.order();\n join.each(function(d) {\n var g = d3.select(this);\n var sel = transition(g.select(\"text\"));\n hasNode = Drawing.translatePoint(d, sel, xa, ya);\n if (hasNode) {\n if (plotinfo.layerClipId) {\n Drawing.hideOutsideRangePoint(d, g, xa, ya, trace2.xcalendar, trace2.ycalendar);\n }\n } else {\n g.remove();\n }\n });\n join.selectAll(\"text\").call(Drawing.textPointStyle, trace2, gd).each(function(d) {\n var x = xa.c2p(d.x);\n var y = ya.c2p(d.y);\n d3.select(this).selectAll(\"tspan.line\").each(function() {\n transition(d3.select(this)).attr({ x, y });\n });\n });\n join.exit().remove();\n }\n points.datum(cdscatter);\n text.datum(cdscatter);\n makePoints(points, text, cdscatter);\n var hasClipOnAxisFalse = trace.cliponaxis === false;\n var clipUrl = hasClipOnAxisFalse ? null : plotinfo.layerClipId;\n Drawing.setClipUrl(points, clipUrl, gd);\n Drawing.setClipUrl(text, clipUrl, gd);\n }\n function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var xr = d3.extent(Lib.simpleMap(xa.range, xa.r2c));\n var yr = d3.extent(Lib.simpleMap(ya.range, ya.r2c));\n var trace = cdscatter[0].trace;\n if (!subTypes.hasMarkers(trace)) return;\n var mnum = trace.marker.maxdisplayed;\n if (mnum === 0) return;\n var cd = cdscatter.filter(function(v) {\n return v.x >= xr[0] && v.x <= xr[1] && v.y >= yr[0] && v.y <= yr[1];\n });\n var inc = Math.ceil(cd.length / mnum);\n var tnum = 0;\n cdscatterAll.forEach(function(cdj, j) {\n var tracei = cdj[0].trace;\n if (subTypes.hasMarkers(tracei) && tracei.marker.maxdisplayed > 0 && j < idx) {\n tnum++;\n }\n });\n var i0 = Math.round(tnum * inc / 3 + Math.floor(tnum / 3) * inc / 7.1);\n cdscatter.forEach(function(v) {\n delete v.vis;\n });\n cd.forEach(function(v, i) {\n if (Math.round((i + i0) % inc) === 0) v.vis = true;\n });\n }\n }\n });\n\n // src/traces/scatter/marker_colorbar.js\n var require_marker_colorbar = __commonJS({\n \"src/traces/scatter/marker_colorbar.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n container: \"marker\",\n min: \"cmin\",\n max: \"cmax\"\n };\n }\n });\n\n // src/traces/scatter/format_labels.js\n var require_format_labels = __commonJS({\n \"src/traces/scatter/format_labels.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n module.exports = function formatLabels(cdi, trace, fullLayout) {\n var labels = {};\n var mockGd = { _fullLayout: fullLayout };\n var xa = Axes.getFromTrace(mockGd, trace, \"x\");\n var ya = Axes.getFromTrace(mockGd, trace, \"y\");\n var x = cdi.orig_x;\n if (x === void 0) x = cdi.x;\n var y = cdi.orig_y;\n if (y === void 0) y = cdi.y;\n labels.xLabel = Axes.tickText(xa, xa.c2l(x), true).text;\n labels.yLabel = Axes.tickText(ya, ya.c2l(y), true).text;\n return labels;\n };\n }\n });\n\n // src/traces/scatter/style.js\n var require_style2 = __commonJS({\n \"src/traces/scatter/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Drawing = require_drawing();\n var Registry = require_registry();\n function style(gd) {\n var s = d3.select(gd).selectAll(\"g.trace.scatter\");\n s.style(\"opacity\", function(d) {\n return d[0].trace.opacity;\n });\n s.selectAll(\"g.points\").each(function(d) {\n var sel = d3.select(this);\n var trace = d.trace || d[0].trace;\n stylePoints(sel, trace, gd);\n });\n s.selectAll(\"g.text\").each(function(d) {\n var sel = d3.select(this);\n var trace = d.trace || d[0].trace;\n styleText(sel, trace, gd);\n });\n s.selectAll(\"g.trace path.js-line\").call(Drawing.lineGroupStyle);\n s.selectAll(\"g.trace path.js-fill\").call(Drawing.fillGroupStyle, gd, false);\n Registry.getComponentMethod(\"errorbars\", \"style\")(s);\n }\n function stylePoints(sel, trace, gd) {\n Drawing.pointStyle(sel.selectAll(\"path.point\"), trace, gd);\n }\n function styleText(sel, trace, gd) {\n Drawing.textPointStyle(sel.selectAll(\"text\"), trace, gd);\n }\n function styleOnSelect(gd, cd, sel) {\n var trace = cd[0].trace;\n if (trace.selectedpoints) {\n Drawing.selectedPointStyle(sel.selectAll(\"path.point\"), trace);\n Drawing.selectedTextStyle(sel.selectAll(\"text\"), trace);\n } else {\n stylePoints(sel, trace, gd);\n styleText(sel, trace, gd);\n }\n }\n module.exports = {\n style,\n stylePoints,\n styleText,\n styleOnSelect\n };\n }\n });\n\n // src/traces/scatter/get_trace_color.js\n var require_get_trace_color = __commonJS({\n \"src/traces/scatter/get_trace_color.js\"(exports, module) {\n \"use strict\";\n var Color2 = require_color();\n var subtypes = require_subtypes();\n module.exports = function getTraceColor(trace, di) {\n var lc, tc;\n if (trace.mode === \"lines\") {\n lc = trace.line.color;\n return lc && Color2.opacity(lc) ? lc : trace.fillcolor;\n } else if (trace.mode === \"none\") {\n return trace.fill ? trace.fillcolor : \"\";\n } else {\n var mc = di.mcc || (trace.marker || {}).color;\n var mlc = di.mlcc || ((trace.marker || {}).line || {}).color;\n tc = mc && Color2.opacity(mc) ? mc : mlc && Color2.opacity(mlc) && (di.mlw || ((trace.marker || {}).line || {}).width) ? mlc : \"\";\n if (tc) {\n if (Color2.opacity(tc) < 0.3) {\n return Color2.addOpacity(tc, 0.3);\n } else return tc;\n } else {\n lc = (trace.line || {}).color;\n return lc && Color2.opacity(lc) && subtypes.hasLines(trace) && trace.line.width ? lc : trace.fillcolor;\n }\n }\n };\n }\n });\n\n // src/traces/scatter/hover.js\n var require_hover2 = __commonJS({\n \"src/traces/scatter/hover.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Fx = require_fx();\n var Registry = require_registry();\n var getTraceColor = require_get_trace_color();\n var Color2 = require_color();\n var fillText = Lib.fillText;\n module.exports = function hoverPoints(pointData, xval, yval, hovermode) {\n var cd = pointData.cd;\n var trace = cd[0].trace;\n var xa = pointData.xa;\n var ya = pointData.ya;\n var xpx = xa.c2p(xval);\n var ypx = ya.c2p(yval);\n var pt = [xpx, ypx];\n var hoveron = trace.hoveron || \"\";\n var minRad = trace.mode.indexOf(\"markers\") !== -1 ? 3 : 0.5;\n var xPeriod = !!trace.xperiodalignment;\n var yPeriod = !!trace.yperiodalignment;\n if (hoveron.indexOf(\"points\") !== -1) {\n var dx = function(di2) {\n if (xPeriod) {\n var x0 = xa.c2p(di2.xStart);\n var x1 = xa.c2p(di2.xEnd);\n return xpx >= Math.min(x0, x1) && xpx <= Math.max(x0, x1) ? 0 : Infinity;\n }\n var rad2 = Math.max(3, di2.mrc || 0);\n var kink = 1 - 1 / rad2;\n var dxRaw = Math.abs(xa.c2p(di2.x) - xpx);\n return dxRaw < rad2 ? kink * dxRaw / rad2 : dxRaw - rad2 + kink;\n };\n var dy = function(di2) {\n if (yPeriod) {\n var y0 = ya.c2p(di2.yStart);\n var y1 = ya.c2p(di2.yEnd);\n return ypx >= Math.min(y0, y1) && ypx <= Math.max(y0, y1) ? 0 : Infinity;\n }\n var rad2 = Math.max(3, di2.mrc || 0);\n var kink = 1 - 1 / rad2;\n var dyRaw = Math.abs(ya.c2p(di2.y) - ypx);\n return dyRaw < rad2 ? kink * dyRaw / rad2 : dyRaw - rad2 + kink;\n };\n var dxy = function(di2) {\n var rad2 = Math.max(minRad, di2.mrc || 0);\n var dx2 = xa.c2p(di2.x) - xpx;\n var dy2 = ya.c2p(di2.y) - ypx;\n return Math.max(Math.sqrt(dx2 * dx2 + dy2 * dy2) - rad2, 1 - minRad / rad2);\n };\n var distfn = Fx.getDistanceFunction(hovermode, dx, dy, dxy);\n Fx.getClosest(cd, distfn, pointData);\n if (pointData.index !== false) {\n var di = cd[pointData.index];\n var xc = xa.c2p(di.x, true);\n var yc = ya.c2p(di.y, true);\n var rad = di.mrc || 1;\n pointData.index = di.i;\n var orientation = cd[0].t.orientation;\n var sizeVal = orientation && (di.sNorm || di.s);\n var xLabelVal = orientation === \"h\" ? sizeVal : di.orig_x !== void 0 ? di.orig_x : di.x;\n var yLabelVal = orientation === \"v\" ? sizeVal : di.orig_y !== void 0 ? di.orig_y : di.y;\n Lib.extendFlat(pointData, {\n color: getTraceColor(trace, di),\n x0: xc - rad,\n x1: xc + rad,\n xLabelVal,\n y0: yc - rad,\n y1: yc + rad,\n yLabelVal,\n spikeDistance: dxy(di),\n hovertemplate: trace.hovertemplate\n });\n fillText(di, trace, pointData);\n Registry.getComponentMethod(\"errorbars\", \"hoverInfo\")(di, trace, pointData);\n return [pointData];\n }\n }\n function isHoverPointInFillElement(el) {\n if (!el) {\n return false;\n }\n var svgElement = el.node();\n try {\n var domPoint = new DOMPoint(pt[0], pt[1]);\n return svgElement.isPointInFill(domPoint);\n } catch (TypeError2) {\n var svgPoint = svgElement.ownerSVGElement.createSVGPoint();\n svgPoint.x = pt[0];\n svgPoint.y = pt[1];\n return svgElement.isPointInFill(svgPoint);\n }\n }\n function getHoverLabelPosition(polygons) {\n var i;\n var polygonsIn = [];\n var xmin = Infinity;\n var xmax = -Infinity;\n var ymin = Infinity;\n var ymax = -Infinity;\n var yPos;\n for (i = 0; i < polygons.length; i++) {\n var polygon = polygons[i];\n if (polygon.contains(pt)) {\n polygonsIn.push(polygon);\n ymin = Math.min(ymin, polygon.ymin);\n ymax = Math.max(ymax, polygon.ymax);\n }\n }\n if (polygonsIn.length === 0) {\n return null;\n }\n ymin = Math.max(ymin, 0);\n ymax = Math.min(ymax, ya._length);\n yPos = (ymin + ymax) / 2;\n var j, pts, xAtYPos, x0, x1, y0, y1;\n for (i = 0; i < polygonsIn.length; i++) {\n pts = polygonsIn[i].pts;\n for (j = 1; j < pts.length; j++) {\n y0 = pts[j - 1][1];\n y1 = pts[j][1];\n if (y0 > yPos !== y1 >= yPos) {\n x0 = pts[j - 1][0];\n x1 = pts[j][0];\n if (y1 - y0) {\n xAtYPos = x0 + (x1 - x0) * (yPos - y0) / (y1 - y0);\n xmin = Math.min(xmin, xAtYPos);\n xmax = Math.max(xmax, xAtYPos);\n }\n }\n }\n }\n xmin = Math.max(xmin, 0);\n xmax = Math.min(xmax, xa._length);\n return {\n x0: xmin,\n x1: xmax,\n y0: yPos,\n y1: yPos\n };\n }\n if (hoveron.indexOf(\"fills\") !== -1 && trace._fillElement) {\n var inside = isHoverPointInFillElement(trace._fillElement) && !isHoverPointInFillElement(trace._fillExclusionElement);\n if (inside) {\n var hoverLabelCoords = getHoverLabelPosition(trace._polygons);\n if (hoverLabelCoords === null) {\n hoverLabelCoords = {\n x0: pt[0],\n x1: pt[0],\n y0: pt[1],\n y1: pt[1]\n };\n }\n var color2 = Color2.defaultLine;\n if (Color2.opacity(trace.fillcolor)) color2 = trace.fillcolor;\n else if (Color2.opacity((trace.line || {}).color)) {\n color2 = trace.line.color;\n }\n Lib.extendFlat(pointData, {\n // never let a 2D override 1D type as closest point\n // also: no spikeDistance, it's not allowed for fills\n distance: pointData.maxHoverDistance,\n x0: hoverLabelCoords.x0,\n x1: hoverLabelCoords.x1,\n y0: hoverLabelCoords.y0,\n y1: hoverLabelCoords.y1,\n color: color2,\n hovertemplate: false\n });\n delete pointData.index;\n if (trace.text && !Lib.isArrayOrTypedArray(trace.text)) {\n pointData.text = String(trace.text);\n } else pointData.text = trace.name;\n return [pointData];\n }\n }\n };\n }\n });\n\n // src/traces/scatter/select.js\n var require_select2 = __commonJS({\n \"src/traces/scatter/select.js\"(exports, module) {\n \"use strict\";\n var subtypes = require_subtypes();\n module.exports = function selectPoints(searchInfo, selectionTester) {\n var cd = searchInfo.cd;\n var xa = searchInfo.xaxis;\n var ya = searchInfo.yaxis;\n var selection = [];\n var trace = cd[0].trace;\n var i;\n var di;\n var x;\n var y;\n var hasOnlyLines = !subtypes.hasMarkers(trace) && !subtypes.hasText(trace);\n if (hasOnlyLines) return [];\n if (selectionTester === false) {\n for (i = 0; i < cd.length; i++) {\n cd[i].selected = 0;\n }\n } else {\n for (i = 0; i < cd.length; i++) {\n di = cd[i];\n x = xa.c2p(di.x);\n y = ya.c2p(di.y);\n if (di.i !== null && selectionTester.contains([x, y], false, i, searchInfo)) {\n selection.push({\n pointNumber: di.i,\n x: xa.c2d(di.x),\n y: ya.c2d(di.y)\n });\n di.selected = 1;\n } else {\n di.selected = 0;\n }\n }\n }\n return selection;\n };\n }\n });\n\n // src/plots/cartesian/attributes.js\n var require_attributes14 = __commonJS({\n \"src/plots/cartesian/attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n xaxis: {\n valType: \"subplotid\",\n dflt: \"x\",\n editType: \"calc+clearAxisTypes\"\n },\n yaxis: {\n valType: \"subplotid\",\n dflt: \"y\",\n editType: \"calc+clearAxisTypes\"\n }\n };\n }\n });\n\n // src/plots/cartesian/type_defaults.js\n var require_type_defaults = __commonJS({\n \"src/plots/cartesian/type_defaults.js\"(exports, module) {\n \"use strict\";\n var traceIs = require_registry().traceIs;\n var autoType = require_axis_autotype();\n module.exports = function handleTypeDefaults(containerIn, containerOut, coerce, options) {\n coerce(\"autotypenumbers\", options.autotypenumbersDflt);\n var axType = coerce(\"type\", (options.splomStash || {}).type);\n if (axType === \"-\") {\n setAutoType(containerOut, options.data);\n if (containerOut.type === \"-\") {\n containerOut.type = \"linear\";\n } else {\n containerIn.type = containerOut.type;\n }\n }\n };\n function setAutoType(ax, data) {\n if (ax.type !== \"-\") return;\n var id = ax._id;\n var axLetter = id.charAt(0);\n var i;\n if (id.indexOf(\"scene\") !== -1) id = axLetter;\n var d0 = getFirstNonEmptyTrace(data, id, axLetter);\n if (!d0) return;\n if (d0.type === \"histogram\" && axLetter === { v: \"y\", h: \"x\" }[d0.orientation || \"v\"]) {\n ax.type = \"linear\";\n return;\n }\n var calAttr = axLetter + \"calendar\";\n var calendar = d0[calAttr];\n var opts = { noMultiCategory: !traceIs(d0, \"cartesian\") || traceIs(d0, \"noMultiCategory\") };\n if (d0.type === \"box\" && d0._hasPreCompStats && axLetter === { h: \"x\", v: \"y\" }[d0.orientation || \"v\"]) {\n opts.noMultiCategory = true;\n }\n opts.autotypenumbers = ax.autotypenumbers;\n if (isBoxWithoutPositionCoords(d0, axLetter)) {\n var posLetter = getBoxPosLetter(d0);\n var boxPositions = [];\n for (i = 0; i < data.length; i++) {\n var trace = data[i];\n if (!traceIs(trace, \"box-violin\") || (trace[axLetter + \"axis\"] || axLetter) !== id) continue;\n if (trace[posLetter] !== void 0) boxPositions.push(trace[posLetter][0]);\n else if (trace.name !== void 0) boxPositions.push(trace.name);\n else boxPositions.push(\"text\");\n if (trace[calAttr] !== calendar) calendar = void 0;\n }\n ax.type = autoType(boxPositions, calendar, opts);\n } else if (d0.type === \"splom\") {\n var dimensions = d0.dimensions;\n var dim = dimensions[d0._axesDim[id]];\n if (dim.visible) ax.type = autoType(dim.values, calendar, opts);\n } else {\n ax.type = autoType(d0[axLetter] || [d0[axLetter + \"0\"]], calendar, opts);\n }\n }\n function getFirstNonEmptyTrace(data, id, axLetter) {\n for (var i = 0; i < data.length; i++) {\n var trace = data[i];\n if (trace.type === \"splom\" && trace._length > 0 && (trace[\"_\" + axLetter + \"axes\"] || {})[id]) {\n return trace;\n }\n if ((trace[axLetter + \"axis\"] || axLetter) === id) {\n if (isBoxWithoutPositionCoords(trace, axLetter)) {\n return trace;\n } else if ((trace[axLetter] || []).length || trace[axLetter + \"0\"]) {\n return trace;\n }\n }\n }\n }\n function getBoxPosLetter(trace) {\n return { v: \"x\", h: \"y\" }[trace.orientation || \"v\"];\n }\n function isBoxWithoutPositionCoords(trace, axLetter) {\n var posLetter = getBoxPosLetter(trace);\n var isBox = traceIs(trace, \"box-violin\");\n var isCandlestick = traceIs(trace._fullInput || {}, \"candlestick\");\n return isBox && !isCandlestick && axLetter === posLetter && trace[posLetter] === void 0 && trace[posLetter + \"0\"] === void 0;\n }\n }\n });\n\n // src/plots/cartesian/category_order_defaults.js\n var require_category_order_defaults = __commonJS({\n \"src/plots/cartesian/category_order_defaults.js\"(exports, module) {\n \"use strict\";\n var isTypedArraySpec = require_array().isTypedArraySpec;\n function findCategories(ax, opts) {\n var dataAttr = opts.dataAttr || ax._id.charAt(0);\n var lookup = {};\n var axData;\n var i, j;\n if (opts.axData) {\n axData = opts.axData;\n } else {\n axData = [];\n for (i = 0; i < opts.data.length; i++) {\n var trace = opts.data[i];\n if (trace[dataAttr + \"axis\"] === ax._id) {\n axData.push(trace);\n }\n }\n }\n for (i = 0; i < axData.length; i++) {\n var vals = axData[i][dataAttr];\n for (j = 0; j < vals.length; j++) {\n var v = vals[j];\n if (v !== null && v !== void 0) {\n lookup[v] = 1;\n }\n }\n }\n return Object.keys(lookup);\n }\n module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, coerce, opts) {\n if (containerOut.type !== \"category\") return;\n var arrayIn = containerIn.categoryarray;\n var isValidArray = Array.isArray(arrayIn) && arrayIn.length > 0 || isTypedArraySpec(arrayIn);\n var orderDefault;\n if (isValidArray) orderDefault = \"array\";\n var order = coerce(\"categoryorder\", orderDefault);\n var array;\n if (order === \"array\") {\n array = coerce(\"categoryarray\");\n }\n if (!isValidArray && order === \"array\") {\n order = containerOut.categoryorder = \"trace\";\n }\n if (order === \"trace\") {\n containerOut._initialCategories = [];\n } else if (order === \"array\") {\n containerOut._initialCategories = array.slice();\n } else {\n array = findCategories(containerOut, opts).sort();\n if (order === \"category ascending\") {\n containerOut._initialCategories = array;\n } else if (order === \"category descending\") {\n containerOut._initialCategories = array.reverse();\n }\n }\n };\n }\n });\n\n // src/plots/cartesian/line_grid_defaults.js\n var require_line_grid_defaults = __commonJS({\n \"src/plots/cartesian/line_grid_defaults.js\"(exports, module) {\n \"use strict\";\n var colorMix = require_tinycolor().mix;\n var colorAttrs = require_attributes3();\n var Lib = require_lib();\n module.exports = function handleLineGridDefaults(containerIn, containerOut, coerce, opts) {\n opts = opts || {};\n var dfltColor = opts.dfltColor;\n function coerce2(attr, dflt) {\n return Lib.coerce2(containerIn, containerOut, opts.attributes, attr, dflt);\n }\n var lineColor = coerce2(\"linecolor\", dfltColor);\n var lineWidth = coerce2(\"linewidth\");\n var showLine = coerce(\"showline\", opts.showLine || !!lineColor || !!lineWidth);\n if (!showLine) {\n delete containerOut.linecolor;\n delete containerOut.linewidth;\n }\n var gridColorDflt = colorMix(dfltColor, opts.bgColor, opts.blend || colorAttrs.lightFraction).toRgbString();\n var gridColor = coerce2(\"gridcolor\", gridColorDflt);\n var gridWidth = coerce2(\"gridwidth\");\n var gridDash = coerce2(\"griddash\");\n var showGridLines = coerce(\n \"showgrid\",\n opts.showGrid || !!gridColor || !!gridWidth || !!gridDash\n );\n if (!showGridLines) {\n delete containerOut.gridcolor;\n delete containerOut.gridwidth;\n delete containerOut.griddash;\n }\n if (opts.hasMinor) {\n var minorGridColorDflt = colorMix(containerOut.gridcolor, opts.bgColor, 67).toRgbString();\n var minorGridColor = coerce2(\"minor.gridcolor\", minorGridColorDflt);\n var minorGridWidth = coerce2(\"minor.gridwidth\", containerOut.gridwidth || 1);\n var minorGridDash = coerce2(\"minor.griddash\", containerOut.griddash || \"solid\");\n var minorShowGridLines = coerce(\n \"minor.showgrid\",\n !!minorGridColor || !!minorGridWidth || !!minorGridDash\n );\n if (!minorShowGridLines) {\n delete containerOut.minor.gridcolor;\n delete containerOut.minor.gridwidth;\n delete containerOut.minor.griddash;\n }\n }\n if (!opts.noZeroLine) {\n var zeroLineColor = coerce2(\"zerolinecolor\", dfltColor);\n var zeroLineWidth = coerce2(\"zerolinewidth\");\n var showZeroLine = coerce(\"zeroline\", opts.showGrid || !!zeroLineColor || !!zeroLineWidth);\n if (!showZeroLine) {\n delete containerOut.zerolinecolor;\n delete containerOut.zerolinewidth;\n }\n }\n };\n }\n });\n\n // src/plots/cartesian/axis_defaults.js\n var require_axis_defaults = __commonJS({\n \"src/plots/cartesian/axis_defaults.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Registry = require_registry();\n var Lib = require_lib();\n var Template = require_plot_template();\n var handleArrayContainerDefaults = require_array_container_defaults();\n var layoutAttributes = require_layout_attributes4();\n var handleTickValueDefaults = require_tick_value_defaults();\n var handleTickMarkDefaults = require_tick_mark_defaults();\n var handleTickLabelDefaults = require_tick_label_defaults();\n var handlePrefixSuffixDefaults = require_prefix_suffix_defaults();\n var handleCategoryOrderDefaults = require_category_order_defaults();\n var handleLineGridDefaults = require_line_grid_defaults();\n var handleRangeDefaults = require_range_defaults();\n var setConvert = require_set_convert();\n var DAY_OF_WEEK = require_constants2().WEEKDAY_PATTERN;\n var HOUR = require_constants2().HOUR_PATTERN;\n module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, options, layoutOut) {\n var letter = options.letter;\n var font = options.font || {};\n var splomStash = options.splomStash || {};\n var visible = coerce(\"visible\", !options.visibleDflt);\n var axTemplate = containerOut._template || {};\n var axType = containerOut.type || axTemplate.type || \"-\";\n var ticklabelmode;\n if (axType === \"date\") {\n var handleCalendarDefaults = Registry.getComponentMethod(\"calendars\", \"handleDefaults\");\n handleCalendarDefaults(containerIn, containerOut, \"calendar\", options.calendar);\n if (!options.noTicklabelmode) {\n ticklabelmode = coerce(\"ticklabelmode\");\n }\n }\n if (!options.noTicklabelindex && (axType === \"date\" || axType === \"linear\")) {\n coerce(\"ticklabelindex\");\n }\n var ticklabelposition = \"\";\n if (!options.noTicklabelposition || axType === \"multicategory\") {\n ticklabelposition = Lib.coerce(containerIn, containerOut, {\n ticklabelposition: {\n valType: \"enumerated\",\n dflt: \"outside\",\n values: ticklabelmode === \"period\" ? [\"outside\", \"inside\"] : letter === \"x\" ? [\n \"outside\",\n \"inside\",\n \"outside left\",\n \"inside left\",\n \"outside right\",\n \"inside right\"\n ] : [\n \"outside\",\n \"inside\",\n \"outside top\",\n \"inside top\",\n \"outside bottom\",\n \"inside bottom\"\n ]\n }\n }, \"ticklabelposition\");\n }\n if (!options.noTicklabeloverflow) {\n coerce(\n \"ticklabeloverflow\",\n ticklabelposition.indexOf(\"inside\") !== -1 ? \"hide past domain\" : axType === \"category\" || axType === \"multicategory\" ? \"allow\" : \"hide past div\"\n );\n }\n setConvert(containerOut, layoutOut);\n handleRangeDefaults(containerIn, containerOut, coerce, options);\n handleCategoryOrderDefaults(containerIn, containerOut, coerce, options);\n if (axType !== \"category\" && !options.noHover) coerce(\"hoverformat\");\n var dfltColor = coerce(\"color\");\n var dfltFontColor = dfltColor !== layoutAttributes.color.dflt ? dfltColor : font.color;\n var dfltTitle = splomStash.label || layoutOut._dfltTitle[letter];\n handlePrefixSuffixDefaults(containerIn, containerOut, coerce, axType, options);\n if (!visible) return containerOut;\n coerce(\"title.text\", dfltTitle);\n Lib.coerceFont(coerce, \"title.font\", font, { overrideDflt: {\n size: Lib.bigFont(font.size),\n color: dfltFontColor\n } });\n handleTickValueDefaults(containerIn, containerOut, coerce, axType);\n var hasMinor = options.hasMinor;\n if (hasMinor) {\n Template.newContainer(containerOut, \"minor\");\n handleTickValueDefaults(containerIn, containerOut, coerce, axType, { isMinor: true });\n }\n handleTickLabelDefaults(containerIn, containerOut, coerce, axType, options);\n handleTickMarkDefaults(containerIn, containerOut, coerce, options);\n if (hasMinor) {\n var keepIsMinor = options.isMinor;\n options.isMinor = true;\n handleTickMarkDefaults(containerIn, containerOut, coerce, options);\n options.isMinor = keepIsMinor;\n }\n handleLineGridDefaults(containerIn, containerOut, coerce, {\n dfltColor,\n bgColor: options.bgColor,\n showGrid: options.showGrid,\n hasMinor,\n attributes: layoutAttributes\n });\n if (hasMinor && !containerOut.minor.ticks && !containerOut.minor.showgrid) {\n delete containerOut.minor;\n }\n if (containerOut.showline || containerOut.ticks) coerce(\"mirror\");\n var isMultiCategory = axType === \"multicategory\";\n if (!options.noTickson && (axType === \"category\" || isMultiCategory) && (containerOut.ticks || containerOut.showgrid)) {\n var ticksonDflt;\n if (isMultiCategory) ticksonDflt = \"boundaries\";\n var tickson = coerce(\"tickson\", ticksonDflt);\n if (tickson === \"boundaries\") {\n delete containerOut.ticklabelposition;\n }\n }\n if (isMultiCategory) {\n var showDividers = coerce(\"showdividers\");\n if (showDividers) {\n coerce(\"dividercolor\");\n coerce(\"dividerwidth\");\n }\n }\n if (axType === \"date\") {\n handleArrayContainerDefaults(containerIn, containerOut, {\n name: \"rangebreaks\",\n inclusionAttr: \"enabled\",\n handleItemDefaults: rangebreaksDefaults\n });\n if (!containerOut.rangebreaks.length) {\n delete containerOut.rangebreaks;\n } else {\n for (var k = 0; k < containerOut.rangebreaks.length; k++) {\n if (containerOut.rangebreaks[k].pattern === DAY_OF_WEEK) {\n containerOut._hasDayOfWeekBreaks = true;\n break;\n }\n }\n setConvert(containerOut, layoutOut);\n if (layoutOut._has(\"scattergl\") || layoutOut._has(\"splom\")) {\n for (var i = 0; i < options.data.length; i++) {\n var trace = options.data[i];\n if (trace.type === \"scattergl\" || trace.type === \"splom\") {\n trace.visible = false;\n Lib.warn(trace.type + \" traces do not work on axes with rangebreaks. Setting trace \" + trace.index + \" to `visible: false`.\");\n }\n }\n }\n }\n }\n return containerOut;\n };\n function rangebreaksDefaults(itemIn, itemOut, containerOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(itemIn, itemOut, layoutAttributes.rangebreaks, attr, dflt);\n }\n var enabled = coerce(\"enabled\");\n if (enabled) {\n var bnds = coerce(\"bounds\");\n if (bnds && bnds.length >= 2) {\n var dfltPattern = \"\";\n var i, q;\n if (bnds.length === 2) {\n for (i = 0; i < 2; i++) {\n q = indexOfDay(bnds[i]);\n if (q) {\n dfltPattern = DAY_OF_WEEK;\n break;\n }\n }\n }\n var pattern = coerce(\"pattern\", dfltPattern);\n if (pattern === DAY_OF_WEEK) {\n for (i = 0; i < 2; i++) {\n q = indexOfDay(bnds[i]);\n if (q) {\n itemOut.bounds[i] = bnds[i] = q - 1;\n }\n }\n }\n if (pattern) {\n for (i = 0; i < 2; i++) {\n q = bnds[i];\n switch (pattern) {\n case DAY_OF_WEEK:\n if (!isNumeric(q)) {\n itemOut.enabled = false;\n return;\n }\n q = +q;\n if (q !== Math.floor(q) || // don't accept fractional days for mow\n q < 0 || q >= 7) {\n itemOut.enabled = false;\n return;\n }\n itemOut.bounds[i] = bnds[i] = q;\n break;\n case HOUR:\n if (!isNumeric(q)) {\n itemOut.enabled = false;\n return;\n }\n q = +q;\n if (q < 0 || q > 24) {\n itemOut.enabled = false;\n return;\n }\n itemOut.bounds[i] = bnds[i] = q;\n break;\n }\n }\n }\n if (containerOut.autorange === false) {\n var rng = containerOut.range;\n if (rng[0] < rng[1]) {\n if (bnds[0] < rng[0] && bnds[1] > rng[1]) {\n itemOut.enabled = false;\n return;\n }\n } else if (bnds[0] > rng[0] && bnds[1] < rng[1]) {\n itemOut.enabled = false;\n return;\n }\n }\n } else {\n var values = coerce(\"values\");\n if (values && values.length) {\n coerce(\"dvalue\");\n } else {\n itemOut.enabled = false;\n return;\n }\n }\n }\n }\n var dayStrToNum = {\n sun: 1,\n mon: 2,\n tue: 3,\n wed: 4,\n thu: 5,\n fri: 6,\n sat: 7\n };\n function indexOfDay(v) {\n if (typeof v !== \"string\") return;\n return dayStrToNum[v.substr(0, 3).toLowerCase()];\n }\n }\n });\n\n // src/plots/cartesian/position_defaults.js\n var require_position_defaults = __commonJS({\n \"src/plots/cartesian/position_defaults.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n module.exports = function handlePositionDefaults(containerIn, containerOut, coerce, options) {\n var counterAxes = options.counterAxes || [];\n var overlayableAxes = options.overlayableAxes || [];\n var letter = options.letter;\n var grid = options.grid;\n var overlayingDomain = options.overlayingDomain;\n var dfltAnchor, dfltDomain, dfltSide, dfltPosition, dfltShift, dfltAutomargin;\n if (grid) {\n dfltDomain = grid._domains[letter][grid._axisMap[containerOut._id]];\n dfltAnchor = grid._anchors[containerOut._id];\n if (dfltDomain) {\n dfltSide = grid[letter + \"side\"].split(\" \")[0];\n dfltPosition = grid.domain[letter][dfltSide === \"right\" || dfltSide === \"top\" ? 1 : 0];\n }\n }\n dfltDomain = dfltDomain || [0, 1];\n dfltAnchor = dfltAnchor || (isNumeric(containerIn.position) ? \"free\" : counterAxes[0] || \"free\");\n dfltSide = dfltSide || (letter === \"x\" ? \"bottom\" : \"left\");\n dfltPosition = dfltPosition || 0;\n dfltShift = 0;\n dfltAutomargin = false;\n var anchor = Lib.coerce(containerIn, containerOut, {\n anchor: {\n valType: \"enumerated\",\n values: [\"free\"].concat(counterAxes),\n dflt: dfltAnchor\n }\n }, \"anchor\");\n var side = Lib.coerce(containerIn, containerOut, {\n side: {\n valType: \"enumerated\",\n values: letter === \"x\" ? [\"bottom\", \"top\"] : [\"left\", \"right\"],\n dflt: dfltSide\n }\n }, \"side\");\n if (anchor === \"free\") {\n if (letter === \"y\") {\n var autoshift = coerce(\"autoshift\");\n if (autoshift) {\n dfltPosition = side === \"left\" ? overlayingDomain[0] : overlayingDomain[1];\n dfltAutomargin = containerOut.automargin ? containerOut.automargin : true;\n dfltShift = side === \"left\" ? -3 : 3;\n }\n coerce(\"shift\", dfltShift);\n }\n coerce(\"position\", dfltPosition);\n }\n coerce(\"automargin\", dfltAutomargin);\n var overlaying = false;\n if (overlayableAxes.length) {\n overlaying = Lib.coerce(containerIn, containerOut, {\n overlaying: {\n valType: \"enumerated\",\n values: [false].concat(overlayableAxes),\n dflt: false\n }\n }, \"overlaying\");\n }\n if (!overlaying) {\n var domain = coerce(\"domain\", dfltDomain);\n if (domain[0] > domain[1] - 1 / 4096) containerOut.domain = dfltDomain;\n Lib.noneOrAll(containerIn.domain, containerOut.domain, dfltDomain);\n if (containerOut.tickmode === \"sync\") {\n containerOut.tickmode = \"auto\";\n }\n }\n coerce(\"layer\");\n return containerOut;\n };\n }\n });\n\n // src/plots/cartesian/layout_defaults.js\n var require_layout_defaults4 = __commonJS({\n \"src/plots/cartesian/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Color2 = require_color();\n var isUnifiedHover = require_helpers2().isUnifiedHover;\n var handleHoverModeDefaults = require_hovermode_defaults();\n var Template = require_plot_template();\n var basePlotLayoutAttributes = require_layout_attributes2();\n var layoutAttributes = require_layout_attributes4();\n var handleTypeDefaults = require_type_defaults();\n var handleAxisDefaults = require_axis_defaults();\n var constraints = require_constraints();\n var handlePositionDefaults = require_position_defaults();\n var axisIds = require_axis_ids();\n var id2name = axisIds.id2name;\n var name2id = axisIds.name2id;\n var AX_ID_PATTERN = require_constants2().AX_ID_PATTERN;\n var Registry = require_registry();\n var traceIs = Registry.traceIs;\n var getComponentMethod = Registry.getComponentMethod;\n function appendList(cont, k, item) {\n if (Array.isArray(cont[k])) cont[k].push(item);\n else cont[k] = [item];\n }\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {\n var autotypenumbersDflt = layoutOut.autotypenumbers;\n var ax2traces = {};\n var xaMayHide = {};\n var yaMayHide = {};\n var xaMustDisplay = {};\n var yaMustDisplay = {};\n var yaMustNotReverse = {};\n var yaMayReverse = {};\n var axHasImage = {};\n var outerTicks = {};\n var noGrids = {};\n var i, j;\n for (i = 0; i < fullData.length; i++) {\n var trace = fullData[i];\n if (!traceIs(trace, \"cartesian\")) continue;\n var xaName;\n if (trace.xaxis) {\n xaName = id2name(trace.xaxis);\n appendList(ax2traces, xaName, trace);\n } else if (trace.xaxes) {\n for (j = 0; j < trace.xaxes.length; j++) {\n appendList(ax2traces, id2name(trace.xaxes[j]), trace);\n }\n }\n var yaName;\n if (trace.yaxis) {\n yaName = id2name(trace.yaxis);\n appendList(ax2traces, yaName, trace);\n } else if (trace.yaxes) {\n for (j = 0; j < trace.yaxes.length; j++) {\n appendList(ax2traces, id2name(trace.yaxes[j]), trace);\n }\n }\n if (trace.type === \"funnel\") {\n if (trace.orientation === \"h\") {\n if (xaName) xaMayHide[xaName] = true;\n if (yaName) yaMayReverse[yaName] = true;\n } else {\n if (yaName) yaMayHide[yaName] = true;\n }\n } else if (trace.type === \"image\") {\n if (yaName) axHasImage[yaName] = true;\n if (xaName) axHasImage[xaName] = true;\n } else {\n if (yaName) {\n yaMustDisplay[yaName] = true;\n yaMustNotReverse[yaName] = true;\n }\n if (!traceIs(trace, \"carpet\") || trace.type === \"carpet\" && !trace._cheater) {\n if (xaName) xaMustDisplay[xaName] = true;\n }\n }\n if (trace.type === \"carpet\" && trace._cheater) {\n if (xaName) xaMayHide[xaName] = true;\n }\n if (traceIs(trace, \"2dMap\")) {\n outerTicks[xaName] = true;\n outerTicks[yaName] = true;\n }\n if (traceIs(trace, \"oriented\")) {\n var positionAxis = trace.orientation === \"h\" ? yaName : xaName;\n noGrids[positionAxis] = true;\n }\n }\n var subplots = layoutOut._subplots;\n var xIds = subplots.xaxis;\n var yIds = subplots.yaxis;\n var xNames = Lib.simpleMap(xIds, id2name);\n var yNames = Lib.simpleMap(yIds, id2name);\n var axNames = xNames.concat(yNames);\n var plotBgColor = Color2.background;\n if (xIds.length && yIds.length) {\n plotBgColor = Lib.coerce(layoutIn, layoutOut, basePlotLayoutAttributes, \"plot_bgcolor\");\n }\n var bgColor = Color2.combine(plotBgColor, layoutOut.paper_bgcolor);\n var axName;\n var axId;\n var axLetter;\n var axLayoutIn;\n var axLayoutOut;\n function newAxLayoutOut() {\n var traces = ax2traces[axName] || [];\n axLayoutOut._traceIndices = traces.map(function(t) {\n return t.index;\n });\n axLayoutOut._annIndices = [];\n axLayoutOut._shapeIndices = [];\n axLayoutOut._selectionIndices = [];\n axLayoutOut._imgIndices = [];\n axLayoutOut._subplotsWith = [];\n axLayoutOut._counterAxes = [];\n axLayoutOut._name = axLayoutOut._attr = axName;\n axLayoutOut._id = axId;\n }\n function coerce(attr, dflt) {\n return Lib.coerce(axLayoutIn, axLayoutOut, layoutAttributes, attr, dflt);\n }\n function coerce2(attr, dflt) {\n return Lib.coerce2(axLayoutIn, axLayoutOut, layoutAttributes, attr, dflt);\n }\n function getCounterAxes(axLetter2) {\n return axLetter2 === \"x\" ? yIds : xIds;\n }\n function getOverlayableAxes(axLetter2, axName2) {\n var list = axLetter2 === \"x\" ? xNames : yNames;\n var out = [];\n for (var j2 = 0; j2 < list.length; j2++) {\n var axName22 = list[j2];\n if (axName22 !== axName2 && !(layoutIn[axName22] || {}).overlaying) {\n out.push(name2id(axName22));\n }\n }\n return out;\n }\n var counterAxes = { x: getCounterAxes(\"x\"), y: getCounterAxes(\"y\") };\n var allAxisIds = counterAxes.x.concat(counterAxes.y);\n var missingMatchedAxisIdsLookup = {};\n var missingMatchedAxisIds = [];\n function addMissingMatchedAxis() {\n var matchesIn = axLayoutIn.matches;\n if (AX_ID_PATTERN.test(matchesIn) && allAxisIds.indexOf(matchesIn) === -1) {\n missingMatchedAxisIdsLookup[matchesIn] = axLayoutIn.type;\n missingMatchedAxisIds = Object.keys(missingMatchedAxisIdsLookup);\n }\n }\n var hovermode = handleHoverModeDefaults(layoutIn, layoutOut);\n var unifiedHover = isUnifiedHover(hovermode);\n for (i = 0; i < axNames.length; i++) {\n axName = axNames[i];\n axId = name2id(axName);\n axLetter = axName.charAt(0);\n if (!Lib.isPlainObject(layoutIn[axName])) {\n layoutIn[axName] = {};\n }\n axLayoutIn = layoutIn[axName];\n axLayoutOut = Template.newContainer(layoutOut, axName, axLetter + \"axis\");\n newAxLayoutOut();\n var visibleDflt = axLetter === \"x\" && !xaMustDisplay[axName] && xaMayHide[axName] || axLetter === \"y\" && !yaMustDisplay[axName] && yaMayHide[axName];\n var reverseDflt = axLetter === \"y\" && (!yaMustNotReverse[axName] && yaMayReverse[axName] || axHasImage[axName]);\n var defaultOptions = {\n hasMinor: true,\n letter: axLetter,\n font: layoutOut.font,\n outerTicks: outerTicks[axName],\n showGrid: !noGrids[axName],\n data: ax2traces[axName] || [],\n bgColor,\n calendar: layoutOut.calendar,\n automargin: true,\n visibleDflt,\n reverseDflt,\n autotypenumbersDflt,\n splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId],\n noAutotickangles: axLetter === \"y\"\n };\n coerce(\"uirevision\", layoutOut.uirevision);\n handleTypeDefaults(axLayoutIn, axLayoutOut, coerce, defaultOptions);\n handleAxisDefaults(axLayoutIn, axLayoutOut, coerce, defaultOptions, layoutOut);\n var unifiedSpike = unifiedHover && axLetter === hovermode.charAt(0);\n var spikecolor = coerce2(\"spikecolor\", unifiedHover ? axLayoutOut.color : void 0);\n var spikethickness = coerce2(\"spikethickness\", unifiedHover ? 1.5 : void 0);\n var spikedash = coerce2(\"spikedash\", unifiedHover ? \"dot\" : void 0);\n var spikemode = coerce2(\"spikemode\", unifiedHover ? \"across\" : void 0);\n var spikesnap = coerce2(\"spikesnap\");\n var showSpikes = coerce(\"showspikes\", !!unifiedSpike || !!spikecolor || !!spikethickness || !!spikedash || !!spikemode || !!spikesnap);\n if (!showSpikes) {\n delete axLayoutOut.spikecolor;\n delete axLayoutOut.spikethickness;\n delete axLayoutOut.spikedash;\n delete axLayoutOut.spikemode;\n delete axLayoutOut.spikesnap;\n }\n var overlayingAxis = id2name(axLayoutIn.overlaying);\n var overlayingAnchorDomain = [0, 1];\n if (layoutOut[overlayingAxis] !== void 0) {\n var overlayingAnchor = id2name(layoutOut[overlayingAxis].anchor);\n if (layoutOut[overlayingAnchor] !== void 0) {\n overlayingAnchorDomain = layoutOut[overlayingAnchor].domain;\n }\n }\n handlePositionDefaults(axLayoutIn, axLayoutOut, coerce, {\n letter: axLetter,\n counterAxes: counterAxes[axLetter],\n overlayableAxes: getOverlayableAxes(axLetter, axName),\n grid: layoutOut.grid,\n overlayingDomain: overlayingAnchorDomain\n });\n coerce(\"title.standoff\");\n addMissingMatchedAxis();\n axLayoutOut._input = axLayoutIn;\n }\n i = 0;\n while (i < missingMatchedAxisIds.length) {\n axId = missingMatchedAxisIds[i++];\n axName = id2name(axId);\n axLetter = axName.charAt(0);\n if (!Lib.isPlainObject(layoutIn[axName])) {\n layoutIn[axName] = {};\n }\n axLayoutIn = layoutIn[axName];\n axLayoutOut = Template.newContainer(layoutOut, axName, axLetter + \"axis\");\n newAxLayoutOut();\n var defaultOptions2 = {\n letter: axLetter,\n font: layoutOut.font,\n outerTicks: outerTicks[axName],\n showGrid: !noGrids[axName],\n data: [],\n bgColor,\n calendar: layoutOut.calendar,\n automargin: true,\n visibleDflt: false,\n reverseDflt: false,\n autotypenumbersDflt,\n splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId]\n };\n coerce(\"uirevision\", layoutOut.uirevision);\n axLayoutOut.type = missingMatchedAxisIdsLookup[axId] || \"linear\";\n handleAxisDefaults(axLayoutIn, axLayoutOut, coerce, defaultOptions2, layoutOut);\n handlePositionDefaults(axLayoutIn, axLayoutOut, coerce, {\n letter: axLetter,\n counterAxes: counterAxes[axLetter],\n overlayableAxes: getOverlayableAxes(axLetter, axName),\n grid: layoutOut.grid\n });\n coerce(\"fixedrange\");\n addMissingMatchedAxis();\n axLayoutOut._input = axLayoutIn;\n }\n var rangeSliderDefaults = getComponentMethod(\"rangeslider\", \"handleDefaults\");\n var rangeSelectorDefaults = getComponentMethod(\"rangeselector\", \"handleDefaults\");\n for (i = 0; i < xNames.length; i++) {\n axName = xNames[i];\n axLayoutIn = layoutIn[axName];\n axLayoutOut = layoutOut[axName];\n rangeSliderDefaults(layoutIn, layoutOut, axName);\n if (axLayoutOut.type === \"date\") {\n rangeSelectorDefaults(\n axLayoutIn,\n axLayoutOut,\n layoutOut,\n yNames,\n axLayoutOut.calendar\n );\n }\n coerce(\"fixedrange\");\n }\n for (i = 0; i < yNames.length; i++) {\n axName = yNames[i];\n axLayoutIn = layoutIn[axName];\n axLayoutOut = layoutOut[axName];\n var anchoredAxis = layoutOut[id2name(axLayoutOut.anchor)];\n var fixedRangeDflt = getComponentMethod(\"rangeslider\", \"isVisible\")(anchoredAxis);\n coerce(\"fixedrange\", fixedRangeDflt);\n }\n constraints.handleDefaults(layoutIn, layoutOut, {\n axIds: allAxisIds.concat(missingMatchedAxisIds).sort(axisIds.idSort),\n axHasImage\n });\n };\n }\n });\n\n // src/plots/cartesian/transition_axes.js\n var require_transition_axes = __commonJS({\n \"src/plots/cartesian/transition_axes.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Registry = require_registry();\n var Lib = require_lib();\n var Drawing = require_drawing();\n var Axes = require_axes();\n module.exports = function transitionAxes(gd, edits, transitionOpts, makeOnCompleteCallback) {\n var fullLayout = gd._fullLayout;\n if (edits.length === 0) {\n Axes.redrawComponents(gd);\n return;\n }\n function unsetSubplotTransform(subplot) {\n var xa = subplot.xaxis;\n var ya = subplot.yaxis;\n fullLayout._defs.select(\"#\" + subplot.clipId + \"> rect\").call(Drawing.setTranslate, 0, 0).call(Drawing.setScale, 1, 1);\n subplot.plot.call(Drawing.setTranslate, xa._offset, ya._offset).call(Drawing.setScale, 1, 1);\n var traceGroups = subplot.plot.selectAll(\".scatterlayer .trace\");\n traceGroups.selectAll(\".point\").call(Drawing.setPointGroupScale, 1, 1);\n traceGroups.selectAll(\".textpoint\").call(Drawing.setTextPointsScale, 1, 1);\n traceGroups.call(Drawing.hideOutsideRangePoints, subplot);\n }\n function updateSubplot(edit, progress) {\n var plotinfo = edit.plotinfo;\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var xlen = xa._length;\n var ylen = ya._length;\n var editX = !!edit.xr1;\n var editY = !!edit.yr1;\n var viewBox = [];\n if (editX) {\n var xr0 = Lib.simpleMap(edit.xr0, xa.r2l);\n var xr1 = Lib.simpleMap(edit.xr1, xa.r2l);\n var dx0 = xr0[1] - xr0[0];\n var dx1 = xr1[1] - xr1[0];\n viewBox[0] = (xr0[0] * (1 - progress) + progress * xr1[0] - xr0[0]) / (xr0[1] - xr0[0]) * xlen;\n viewBox[2] = xlen * (1 - progress + progress * dx1 / dx0);\n xa.range[0] = xa.l2r(xr0[0] * (1 - progress) + progress * xr1[0]);\n xa.range[1] = xa.l2r(xr0[1] * (1 - progress) + progress * xr1[1]);\n } else {\n viewBox[0] = 0;\n viewBox[2] = xlen;\n }\n if (editY) {\n var yr0 = Lib.simpleMap(edit.yr0, ya.r2l);\n var yr1 = Lib.simpleMap(edit.yr1, ya.r2l);\n var dy0 = yr0[1] - yr0[0];\n var dy1 = yr1[1] - yr1[0];\n viewBox[1] = (yr0[1] * (1 - progress) + progress * yr1[1] - yr0[1]) / (yr0[0] - yr0[1]) * ylen;\n viewBox[3] = ylen * (1 - progress + progress * dy1 / dy0);\n ya.range[0] = xa.l2r(yr0[0] * (1 - progress) + progress * yr1[0]);\n ya.range[1] = ya.l2r(yr0[1] * (1 - progress) + progress * yr1[1]);\n } else {\n viewBox[1] = 0;\n viewBox[3] = ylen;\n }\n Axes.drawOne(gd, xa, { skipTitle: true });\n Axes.drawOne(gd, ya, { skipTitle: true });\n Axes.redrawComponents(gd, [xa._id, ya._id]);\n var xScaleFactor = editX ? xlen / viewBox[2] : 1;\n var yScaleFactor = editY ? ylen / viewBox[3] : 1;\n var clipDx = editX ? viewBox[0] : 0;\n var clipDy = editY ? viewBox[1] : 0;\n var fracDx = editX ? viewBox[0] / viewBox[2] * xlen : 0;\n var fracDy = editY ? viewBox[1] / viewBox[3] * ylen : 0;\n var plotDx = xa._offset - fracDx;\n var plotDy = ya._offset - fracDy;\n plotinfo.clipRect.call(Drawing.setTranslate, clipDx, clipDy).call(Drawing.setScale, 1 / xScaleFactor, 1 / yScaleFactor);\n plotinfo.plot.call(Drawing.setTranslate, plotDx, plotDy).call(Drawing.setScale, xScaleFactor, yScaleFactor);\n Drawing.setPointGroupScale(plotinfo.zoomScalePts, 1 / xScaleFactor, 1 / yScaleFactor);\n Drawing.setTextPointsScale(plotinfo.zoomScaleTxt, 1 / xScaleFactor, 1 / yScaleFactor);\n }\n var onComplete;\n if (makeOnCompleteCallback) {\n onComplete = makeOnCompleteCallback();\n }\n function transitionComplete() {\n var aobj = {};\n for (var i = 0; i < edits.length; i++) {\n var edit = edits[i];\n var xa = edit.plotinfo.xaxis;\n var ya = edit.plotinfo.yaxis;\n if (edit.xr1) aobj[xa._name + \".range\"] = edit.xr1.slice();\n if (edit.yr1) aobj[ya._name + \".range\"] = edit.yr1.slice();\n }\n onComplete && onComplete();\n return Registry.call(\"relayout\", gd, aobj).then(function() {\n for (var i2 = 0; i2 < edits.length; i2++) {\n unsetSubplotTransform(edits[i2].plotinfo);\n }\n });\n }\n function transitionInterrupt() {\n var aobj = {};\n for (var i = 0; i < edits.length; i++) {\n var edit = edits[i];\n var xa = edit.plotinfo.xaxis;\n var ya = edit.plotinfo.yaxis;\n if (edit.xr0) aobj[xa._name + \".range\"] = edit.xr0.slice();\n if (edit.yr0) aobj[ya._name + \".range\"] = edit.yr0.slice();\n }\n return Registry.call(\"relayout\", gd, aobj).then(function() {\n for (var i2 = 0; i2 < edits.length; i2++) {\n unsetSubplotTransform(edits[i2].plotinfo);\n }\n });\n }\n var t12, t22, raf;\n var easeFn = d3.ease(transitionOpts.easing);\n gd._transitionData._interruptCallbacks.push(function() {\n window.cancelAnimationFrame(raf);\n raf = null;\n return transitionInterrupt();\n });\n function doFrame() {\n t22 = Date.now();\n var tInterp = Math.min(1, (t22 - t12) / transitionOpts.duration);\n var progress = easeFn(tInterp);\n for (var i = 0; i < edits.length; i++) {\n updateSubplot(edits[i], progress);\n }\n if (t22 - t12 > transitionOpts.duration) {\n transitionComplete();\n raf = window.cancelAnimationFrame(doFrame);\n } else {\n raf = window.requestAnimationFrame(doFrame);\n }\n }\n t12 = Date.now();\n raf = window.requestAnimationFrame(doFrame);\n return Promise.resolve();\n };\n }\n });\n\n // src/plots/cartesian/index.js\n var require_cartesian = __commonJS({\n \"src/plots/cartesian/index.js\"(exports) {\n \"use strict\";\n var d3 = require_d3();\n var Registry = require_registry();\n var Lib = require_lib();\n var Plots = require_plots();\n var Drawing = require_drawing();\n var getModuleCalcData = require_get_data().getModuleCalcData;\n var axisIds = require_axis_ids();\n var constants = require_constants2();\n var xmlnsNamespaces = require_xmlns_namespaces();\n var ensureSingle = Lib.ensureSingle;\n function ensureSingleAndAddDatum(parent, nodeType, className) {\n return Lib.ensureSingle(parent, nodeType, className, function(s) {\n s.datum(className);\n });\n }\n var zindexSeparator = constants.zindexSeparator;\n exports.name = \"cartesian\";\n exports.attr = [\"xaxis\", \"yaxis\"];\n exports.idRoot = [\"x\", \"y\"];\n exports.idRegex = constants.idRegex;\n exports.attrRegex = constants.attrRegex;\n exports.attributes = require_attributes14();\n exports.layoutAttributes = require_layout_attributes4();\n exports.supplyLayoutDefaults = require_layout_defaults4();\n exports.transitionAxes = require_transition_axes();\n exports.finalizeSubplots = function(layoutIn, layoutOut) {\n var subplots = layoutOut._subplots;\n var xList = subplots.xaxis;\n var yList = subplots.yaxis;\n var spSVG = subplots.cartesian;\n var spAll = spSVG;\n var allX = {};\n var allY = {};\n var i, xi, yi;\n for (i = 0; i < spAll.length; i++) {\n var parts = spAll[i].split(\"y\");\n allX[parts[0]] = 1;\n allY[\"y\" + parts[1]] = 1;\n }\n for (i = 0; i < xList.length; i++) {\n xi = xList[i];\n if (!allX[xi]) {\n yi = (layoutIn[axisIds.id2name(xi)] || {}).anchor;\n if (!constants.idRegex.y.test(yi)) yi = \"y\";\n spSVG.push(xi + yi);\n spAll.push(xi + yi);\n if (!allY[yi]) {\n allY[yi] = 1;\n Lib.pushUnique(yList, yi);\n }\n }\n }\n for (i = 0; i < yList.length; i++) {\n yi = yList[i];\n if (!allY[yi]) {\n xi = (layoutIn[axisIds.id2name(yi)] || {}).anchor;\n if (!constants.idRegex.x.test(xi)) xi = \"x\";\n spSVG.push(xi + yi);\n spAll.push(xi + yi);\n if (!allX[xi]) {\n allX[xi] = 1;\n Lib.pushUnique(xList, xi);\n }\n }\n }\n if (!spAll.length) {\n xi = \"\";\n yi = \"\";\n for (var ki in layoutIn) {\n if (constants.attrRegex.test(ki)) {\n var axLetter = ki.charAt(0);\n if (axLetter === \"x\") {\n if (!xi || +ki.substr(5) < +xi.substr(5)) {\n xi = ki;\n }\n } else if (!yi || +ki.substr(5) < +yi.substr(5)) {\n yi = ki;\n }\n }\n }\n xi = xi ? axisIds.name2id(xi) : \"x\";\n yi = yi ? axisIds.name2id(yi) : \"y\";\n xList.push(xi);\n yList.push(yi);\n spSVG.push(xi + yi);\n }\n };\n exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) {\n var fullLayout = gd._fullLayout;\n var subplots = fullLayout._subplots.cartesian;\n var calcdata = gd.calcdata;\n var i;\n if (!Array.isArray(traces)) {\n traces = [];\n for (i = 0; i < calcdata.length; i++) traces.push(i);\n }\n var zindices = fullLayout._zindices;\n for (var z = 0; z < zindices.length; z++) {\n var zorder = zindices[z];\n for (i = 0; i < subplots.length; i++) {\n var subplot = subplots[i];\n var subplotInfo = fullLayout._plots[subplot];\n if (z > 0) {\n var idWithZ = subplotInfo.id;\n if (idWithZ.indexOf(zindexSeparator) !== -1) continue;\n idWithZ += zindexSeparator + (z + 1);\n subplotInfo = Lib.extendFlat({}, subplotInfo, {\n id: idWithZ,\n plot: fullLayout._cartesianlayer.selectAll(\".subplot\").select(\".\" + idWithZ)\n });\n }\n var cdSubplot = [];\n var pcd;\n for (var j = 0; j < calcdata.length; j++) {\n var cd = calcdata[j];\n var trace = cd[0].trace;\n if (zorder !== (trace.zorder || 0)) continue;\n if (trace.xaxis + trace.yaxis === subplot) {\n if (traces.indexOf(trace.index) !== -1 || trace.carpet) {\n if (pcd && pcd[0].trace.xaxis + pcd[0].trace.yaxis === subplot && [\"tonextx\", \"tonexty\", \"tonext\"].indexOf(trace.fill) !== -1 && cdSubplot.indexOf(pcd) === -1) {\n cdSubplot.push(pcd);\n }\n cdSubplot.push(cd);\n }\n pcd = cd;\n }\n }\n plotOne(gd, subplotInfo, cdSubplot, transitionOpts, makeOnCompleteCallback);\n }\n }\n };\n function plotOne(gd, plotinfo, cdSubplot, transitionOpts, makeOnCompleteCallback) {\n var traceLayerClasses = constants.traceLayerClasses;\n var fullLayout = gd._fullLayout;\n var zindices = fullLayout._zindices;\n var modules = fullLayout._modules;\n var _module, cdModuleAndOthers, cdModule;\n var layerData = [];\n var zoomScaleQueryParts = [];\n for (var z = 0; z < zindices.length; z++) {\n var zorder = zindices[z];\n for (var i = 0; i < modules.length; i++) {\n _module = modules[i];\n var name2 = _module.name;\n var categories = Registry.modules[name2].categories;\n if (categories.svg) {\n var classBaseName = _module.layerName || name2 + \"layer\";\n var className = classBaseName + (z ? Number(z) + 1 : \"\");\n var plotMethod = _module.plot;\n cdModuleAndOthers = getModuleCalcData(cdSubplot, plotMethod, zorder);\n cdModule = cdModuleAndOthers[0];\n cdSubplot = cdModuleAndOthers[1];\n if (cdModule.length) {\n layerData.push({\n i: traceLayerClasses.indexOf(classBaseName),\n zindex: z,\n className,\n plotMethod,\n cdModule\n });\n }\n if (categories.zoomScale) {\n zoomScaleQueryParts.push(\".\" + className);\n }\n }\n }\n }\n layerData.sort(function(a, b) {\n return (a.zindex || 0) - (b.zindex || 0) || a.i - b.i;\n });\n var layers = plotinfo.plot.selectAll(\"g.mlayer\").data(layerData, function(d) {\n return d.className;\n });\n layers.enter().append(\"g\").attr(\"class\", function(d) {\n return d.className;\n }).classed(\"mlayer\", true).classed(\"rangeplot\", plotinfo.isRangePlot);\n layers.exit().remove();\n layers.order();\n layers.each(function(d) {\n var sel = d3.select(this);\n var className2 = d.className;\n d.plotMethod(\n gd,\n plotinfo,\n d.cdModule,\n sel,\n transitionOpts,\n makeOnCompleteCallback\n );\n if (constants.clipOnAxisFalseQuery.indexOf(\".\" + className2) === -1) {\n Drawing.setClipUrl(sel, plotinfo.layerClipId, gd);\n }\n });\n if (fullLayout._has(\"scattergl\")) {\n _module = Registry.getModule(\"scattergl\");\n cdModule = getModuleCalcData(cdSubplot, _module)[0];\n _module.plot(gd, plotinfo, cdModule);\n }\n if (!gd._context.staticPlot) {\n if (plotinfo._hasClipOnAxisFalse) {\n plotinfo.clipOnAxisFalseTraces = plotinfo.plot.selectAll(constants.clipOnAxisFalseQuery.join(\",\")).selectAll(\".trace\");\n }\n if (zoomScaleQueryParts.length) {\n var traces = plotinfo.plot.selectAll(zoomScaleQueryParts.join(\",\")).selectAll(\".trace\");\n plotinfo.zoomScalePts = traces.selectAll(\"path.point\");\n plotinfo.zoomScaleTxt = traces.selectAll(\".textpoint\");\n }\n }\n }\n exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var oldPlots = oldFullLayout._plots || {};\n var newPlots = newFullLayout._plots || {};\n var oldSubplotList = oldFullLayout._subplots || {};\n var plotinfo;\n var i, k;\n if (oldFullLayout._hasOnlyLargeSploms && !newFullLayout._hasOnlyLargeSploms) {\n for (k in oldPlots) {\n plotinfo = oldPlots[k];\n if (plotinfo.plotgroup) plotinfo.plotgroup.remove();\n }\n }\n var hadGl = oldFullLayout._has && oldFullLayout._has(\"gl\");\n var hasGl = newFullLayout._has && newFullLayout._has(\"gl\");\n if (hadGl && !hasGl) {\n for (k in oldPlots) {\n plotinfo = oldPlots[k];\n if (plotinfo._scene) plotinfo._scene.destroy();\n }\n }\n if (oldSubplotList.xaxis && oldSubplotList.yaxis) {\n var oldAxIDs = axisIds.listIds({ _fullLayout: oldFullLayout });\n for (i = 0; i < oldAxIDs.length; i++) {\n var oldAxId = oldAxIDs[i];\n if (!newFullLayout[axisIds.id2name(oldAxId)]) {\n oldFullLayout._infolayer.selectAll(\".g-\" + oldAxId + \"title\").remove();\n }\n }\n }\n var hadCartesian = oldFullLayout._has && oldFullLayout._has(\"cartesian\");\n var hasCartesian = newFullLayout._has && newFullLayout._has(\"cartesian\");\n if (hadCartesian && !hasCartesian) {\n purgeSubplotLayers(oldFullLayout._cartesianlayer.selectAll(\".subplot\"), oldFullLayout);\n oldFullLayout._defs.selectAll(\".axesclip\").remove();\n delete oldFullLayout._axisConstraintGroups;\n delete oldFullLayout._axisMatchGroups;\n } else if (oldSubplotList.cartesian) {\n for (i = 0; i < oldSubplotList.cartesian.length; i++) {\n var oldSubplotId = oldSubplotList.cartesian[i];\n if (oldSubplotId.indexOf(zindexSeparator) !== -1) continue;\n if (!newPlots[oldSubplotId]) {\n var selector = \".\" + oldSubplotId + \",.\" + oldSubplotId + \"-x,.\" + oldSubplotId + \"-y\";\n oldFullLayout._cartesianlayer.selectAll(selector).remove();\n removeSubplotExtras(oldSubplotId, oldFullLayout);\n }\n }\n }\n };\n exports.drawFramework = function(gd) {\n var fullLayout = gd._fullLayout;\n var calcdata = gd.calcdata;\n var i;\n var traceZorderGroups = {};\n for (i = 0; i < calcdata.length; i++) {\n var cdi = calcdata[i][0];\n var trace = cdi.trace;\n var zi = trace.zorder || 0;\n if (!traceZorderGroups[zi]) traceZorderGroups[zi] = [];\n traceZorderGroups[zi].push(cdi);\n }\n var zindices = Object.keys(traceZorderGroups).map(Number).sort(Lib.sorterAsc);\n if (!zindices.length) zindices = [0];\n fullLayout._zindices = zindices;\n var initialSubplotData = makeSubplotData(gd);\n var len = initialSubplotData.length;\n var subplotData = [];\n for (i = 0; i < len; i++) {\n subplotData[i] = initialSubplotData[i].slice();\n }\n for (var z = 1; z < zindices.length; z++) {\n var newSubplotData = [];\n for (i = 0; i < len; i++) {\n newSubplotData[i] = initialSubplotData[i].slice();\n newSubplotData[i][0] += zindexSeparator + (z + 1);\n }\n subplotData = subplotData.concat(newSubplotData);\n }\n var subplotLayers = fullLayout._cartesianlayer.selectAll(\".subplot\").data(subplotData, String);\n subplotLayers.enter().append(\"g\").attr(\"class\", function(d) {\n return \"subplot \" + d[0];\n });\n subplotLayers.order();\n subplotLayers.exit().call(purgeSubplotLayers, fullLayout);\n subplotLayers.each(function(d) {\n var id = d[0];\n var posZ = id.indexOf(zindexSeparator);\n var hasZ = posZ !== -1;\n var idWithoutZ = hasZ ? id.slice(0, posZ) : id;\n var plotinfo = fullLayout._plots[id];\n if (!plotinfo) {\n plotinfo = Lib.extendFlat({}, fullLayout._plots[idWithoutZ]);\n if (plotinfo) {\n plotinfo.id = id;\n fullLayout._plots[id] = plotinfo;\n fullLayout._subplots.cartesian.push(id);\n }\n }\n if (plotinfo) {\n plotinfo.plotgroup = d3.select(this);\n makeSubplotLayer(gd, plotinfo);\n if (!hasZ) {\n plotinfo.draglayer = ensureSingle(fullLayout._draggers, \"g\", id);\n }\n }\n });\n };\n exports.rangePlot = function(gd, plotinfo, cdSubplot) {\n makeSubplotLayer(gd, plotinfo);\n plotOne(gd, plotinfo, cdSubplot);\n Plots.style(gd);\n };\n function makeSubplotData(gd) {\n var fullLayout = gd._fullLayout;\n var numZ = fullLayout._zindices.length;\n var ids = fullLayout._subplots.cartesian;\n var len = ids.length;\n var i, j, id, plotinfo, xa, ya;\n var regulars = [];\n var overlays = [];\n for (i = 0; i < len; i++) {\n id = ids[i];\n plotinfo = fullLayout._plots[id];\n xa = plotinfo.xaxis;\n ya = plotinfo.yaxis;\n var xa2 = xa._mainAxis;\n var ya2 = ya._mainAxis;\n var mainplot = xa2._id + ya2._id;\n var mainplotinfo = fullLayout._plots[mainplot];\n plotinfo.overlays = [];\n if (mainplot !== id && mainplotinfo) {\n plotinfo.mainplot = mainplot;\n plotinfo.mainplotinfo = mainplotinfo;\n overlays.push(id);\n } else {\n plotinfo.mainplot = void 0;\n plotinfo.mainplotinfo = void 0;\n regulars.push(id);\n }\n }\n for (i = 0; i < overlays.length; i++) {\n id = overlays[i];\n plotinfo = fullLayout._plots[id];\n plotinfo.mainplotinfo.overlays.push(plotinfo);\n }\n var subplotIds = regulars.concat(overlays);\n var subplotData = [];\n for (i = 0; i < len; i++) {\n id = subplotIds[i];\n plotinfo = fullLayout._plots[id];\n xa = plotinfo.xaxis;\n ya = plotinfo.yaxis;\n var d = [];\n for (var z = 1; z <= numZ; z++) {\n var zStr = \"\";\n if (z > 1) zStr += zindexSeparator + z;\n d.push(id + zStr);\n for (j = 0; j < plotinfo.overlays.length; j++) {\n d.push(plotinfo.overlays[j].id + zStr);\n }\n }\n d = d.concat([\n xa.layer,\n ya.layer,\n xa.overlaying || \"\",\n ya.overlaying || \"\"\n ]);\n subplotData.push(d);\n }\n return subplotData;\n }\n function makeSubplotLayer(gd, plotinfo) {\n var fullLayout = gd._fullLayout;\n var plotgroup = plotinfo.plotgroup;\n var id = plotinfo.id;\n var posZ = id.indexOf(zindexSeparator);\n var hasZ = posZ !== -1;\n var xLayer = constants.layerValue2layerClass[plotinfo.xaxis.layer];\n var yLayer = constants.layerValue2layerClass[plotinfo.yaxis.layer];\n var hasOnlyLargeSploms = fullLayout._hasOnlyLargeSploms;\n var hasMultipleZ = fullLayout._zindices.length > 1;\n var mainplotinfo = plotinfo.mainplotinfo;\n if (!plotinfo.mainplot || hasMultipleZ) {\n if (hasOnlyLargeSploms) {\n plotinfo.xlines = ensureSingle(plotgroup, \"path\", \"xlines-above\");\n plotinfo.ylines = ensureSingle(plotgroup, \"path\", \"ylines-above\");\n plotinfo.xaxislayer = ensureSingle(plotgroup, \"g\", \"xaxislayer-above\");\n plotinfo.yaxislayer = ensureSingle(plotgroup, \"g\", \"yaxislayer-above\");\n } else {\n if (!hasZ) {\n var backLayer = ensureSingle(plotgroup, \"g\", \"layer-subplot\");\n plotinfo.shapelayer = ensureSingle(backLayer, \"g\", \"shapelayer\");\n plotinfo.imagelayer = ensureSingle(backLayer, \"g\", \"imagelayer\");\n if (mainplotinfo && hasMultipleZ) {\n plotinfo.minorGridlayer = mainplotinfo.minorGridlayer;\n plotinfo.gridlayer = mainplotinfo.gridlayer;\n plotinfo.zerolinelayer = mainplotinfo.zerolinelayer;\n } else {\n plotinfo.minorGridlayer = ensureSingle(plotgroup, \"g\", \"minor-gridlayer\");\n plotinfo.gridlayer = ensureSingle(plotgroup, \"g\", \"gridlayer\");\n plotinfo.zerolinelayer = ensureSingle(plotgroup, \"g\", \"zerolinelayer\");\n }\n var betweenLayer = ensureSingle(plotgroup, \"g\", \"layer-between\");\n plotinfo.shapelayerBetween = ensureSingle(betweenLayer, \"g\", \"shapelayer\");\n plotinfo.imagelayerBetween = ensureSingle(betweenLayer, \"g\", \"imagelayer\");\n ensureSingle(plotgroup, \"path\", \"xlines-below\");\n ensureSingle(plotgroup, \"path\", \"ylines-below\");\n plotinfo.overlinesBelow = ensureSingle(plotgroup, \"g\", \"overlines-below\");\n ensureSingle(plotgroup, \"g\", \"xaxislayer-below\");\n ensureSingle(plotgroup, \"g\", \"yaxislayer-below\");\n plotinfo.overaxesBelow = ensureSingle(plotgroup, \"g\", \"overaxes-below\");\n }\n plotinfo.overplot = ensureSingle(plotgroup, \"g\", \"overplot\");\n plotinfo.plot = ensureSingle(plotinfo.overplot, \"g\", id);\n if (!hasZ) {\n plotinfo.xlines = ensureSingle(plotgroup, \"path\", \"xlines-above\");\n plotinfo.ylines = ensureSingle(plotgroup, \"path\", \"ylines-above\");\n plotinfo.overlinesAbove = ensureSingle(plotgroup, \"g\", \"overlines-above\");\n ensureSingle(plotgroup, \"g\", \"xaxislayer-above\");\n ensureSingle(plotgroup, \"g\", \"yaxislayer-above\");\n plotinfo.overaxesAbove = ensureSingle(plotgroup, \"g\", \"overaxes-above\");\n plotinfo.xlines = plotgroup.select(\".xlines-\" + xLayer);\n plotinfo.ylines = plotgroup.select(\".ylines-\" + yLayer);\n plotinfo.xaxislayer = plotgroup.select(\".xaxislayer-\" + xLayer);\n plotinfo.yaxislayer = plotgroup.select(\".yaxislayer-\" + yLayer);\n }\n }\n } else {\n var mainplotgroup = mainplotinfo.plotgroup;\n var xId = id + \"-x\";\n var yId = id + \"-y\";\n plotinfo.minorGridlayer = mainplotinfo.minorGridlayer;\n plotinfo.gridlayer = mainplotinfo.gridlayer;\n plotinfo.zerolinelayer = mainplotinfo.zerolinelayer;\n ensureSingle(mainplotinfo.overlinesBelow, \"path\", xId);\n ensureSingle(mainplotinfo.overlinesBelow, \"path\", yId);\n ensureSingle(mainplotinfo.overaxesBelow, \"g\", xId);\n ensureSingle(mainplotinfo.overaxesBelow, \"g\", yId);\n plotinfo.plot = ensureSingle(mainplotinfo.overplot, \"g\", id);\n ensureSingle(mainplotinfo.overlinesAbove, \"path\", xId);\n ensureSingle(mainplotinfo.overlinesAbove, \"path\", yId);\n ensureSingle(mainplotinfo.overaxesAbove, \"g\", xId);\n ensureSingle(mainplotinfo.overaxesAbove, \"g\", yId);\n plotinfo.xlines = mainplotgroup.select(\".overlines-\" + xLayer).select(\".\" + xId);\n plotinfo.ylines = mainplotgroup.select(\".overlines-\" + yLayer).select(\".\" + yId);\n plotinfo.xaxislayer = mainplotgroup.select(\".overaxes-\" + xLayer).select(\".\" + xId);\n plotinfo.yaxislayer = mainplotgroup.select(\".overaxes-\" + yLayer).select(\".\" + yId);\n }\n if (!hasZ) {\n if (!hasOnlyLargeSploms) {\n ensureSingleAndAddDatum(plotinfo.minorGridlayer, \"g\", plotinfo.xaxis._id);\n ensureSingleAndAddDatum(plotinfo.minorGridlayer, \"g\", plotinfo.yaxis._id);\n plotinfo.minorGridlayer.selectAll(\"g\").map(function(d) {\n return d[0];\n }).sort(axisIds.idSort);\n ensureSingleAndAddDatum(plotinfo.gridlayer, \"g\", plotinfo.xaxis._id);\n ensureSingleAndAddDatum(plotinfo.gridlayer, \"g\", plotinfo.yaxis._id);\n plotinfo.gridlayer.selectAll(\"g\").map(function(d) {\n return d[0];\n }).sort(axisIds.idSort);\n }\n plotinfo.xlines.style(\"fill\", \"none\").classed(\"crisp\", true);\n plotinfo.ylines.style(\"fill\", \"none\").classed(\"crisp\", true);\n }\n }\n function purgeSubplotLayers(layers, fullLayout) {\n if (!layers) return;\n var overlayIdsToRemove = {};\n layers.each(function(d) {\n var id = d[0];\n var plotgroup = d3.select(this);\n plotgroup.remove();\n removeSubplotExtras(id, fullLayout);\n overlayIdsToRemove[id] = true;\n });\n for (var k in fullLayout._plots) {\n var subplotInfo = fullLayout._plots[k];\n var overlays = subplotInfo.overlays || [];\n for (var j = 0; j < overlays.length; j++) {\n var overlayInfo = overlays[j];\n if (overlayIdsToRemove[overlayInfo.id]) {\n overlayInfo.plot.selectAll(\".trace\").remove();\n }\n }\n }\n }\n function removeSubplotExtras(subplotId, fullLayout) {\n fullLayout._draggers.selectAll(\"g.\" + subplotId).remove();\n fullLayout._defs.select(\"#clip\" + fullLayout._uid + subplotId + \"plot\").remove();\n }\n exports.toSVG = function(gd) {\n var imageRoot = gd._fullLayout._glimages;\n var root = d3.select(gd).selectAll(\".svg-container\");\n var canvases = root.filter(function(d, i) {\n return i === root.size() - 1;\n }).selectAll(\".gl-canvas-context, .gl-canvas-focus\");\n function canvasToImage() {\n var canvas = this;\n var imageData = canvas.toDataURL(\"image/png\");\n var image = imageRoot.append(\"svg:image\");\n image.attr({\n xmlns: xmlnsNamespaces.svg,\n \"xlink:href\": imageData,\n preserveAspectRatio: \"none\",\n x: 0,\n y: 0,\n width: canvas.style.width,\n height: canvas.style.height\n });\n }\n canvases.each(canvasToImage);\n };\n exports.updateFx = require_graph_interact().updateFx;\n }\n });\n\n // src/traces/scatter/index.js\n var require_scatter = __commonJS({\n \"src/traces/scatter/index.js\"(exports, module) {\n \"use strict\";\n var subtypes = require_subtypes();\n module.exports = {\n hasLines: subtypes.hasLines,\n hasMarkers: subtypes.hasMarkers,\n hasText: subtypes.hasText,\n isBubble: subtypes.isBubble,\n attributes: require_attributes12(),\n layoutAttributes: require_layout_attributes3(),\n supplyDefaults: require_defaults8(),\n crossTraceDefaults: require_cross_trace_defaults2(),\n supplyLayoutDefaults: require_layout_defaults3(),\n calc: require_calc3().calc,\n crossTraceCalc: require_cross_trace_calc2(),\n arraysToCalcdata: require_arrays_to_calcdata(),\n plot: require_plot(),\n colorbar: require_marker_colorbar(),\n formatLabels: require_format_labels(),\n style: require_style2().style,\n styleOnSelect: require_style2().styleOnSelect,\n hoverPoints: require_hover2(),\n selectPoints: require_select2(),\n animatable: true,\n moduleType: \"trace\",\n name: \"scatter\",\n basePlotModule: require_cartesian(),\n categories: [\n \"cartesian\",\n \"svg\",\n \"symbols\",\n \"errorBarsOK\",\n \"showLegend\",\n \"scatter-like\",\n \"zoomScale\"\n ],\n meta: {}\n };\n }\n });\n\n // src/components/annotations/draw_arrow_head.js\n var require_draw_arrow_head = __commonJS({\n \"src/components/annotations/draw_arrow_head.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Color2 = require_color();\n var ARROWPATHS = require_arrow_paths();\n var Lib = require_lib();\n var strScale = Lib.strScale;\n var strRotate = Lib.strRotate;\n var strTranslate = Lib.strTranslate;\n module.exports = function drawArrowHead(el3, ends, options) {\n var el = el3.node();\n var headStyle = ARROWPATHS[options.arrowhead || 0];\n var startHeadStyle = ARROWPATHS[options.startarrowhead || 0];\n var scale = (options.arrowwidth || 1) * (options.arrowsize || 1);\n var startScale = (options.arrowwidth || 1) * (options.startarrowsize || 1);\n var doStart = ends.indexOf(\"start\") >= 0;\n var doEnd = ends.indexOf(\"end\") >= 0;\n var backOff = headStyle.backoff * scale + options.standoff;\n var startBackOff = startHeadStyle.backoff * startScale + options.startstandoff;\n var start, end, startRot, endRot;\n if (el.nodeName === \"line\") {\n start = { x: +el3.attr(\"x1\"), y: +el3.attr(\"y1\") };\n end = { x: +el3.attr(\"x2\"), y: +el3.attr(\"y2\") };\n var dx = start.x - end.x;\n var dy = start.y - end.y;\n startRot = Math.atan2(dy, dx);\n endRot = startRot + Math.PI;\n if (backOff && startBackOff) {\n if (backOff + startBackOff > Math.sqrt(dx * dx + dy * dy)) {\n hideLine();\n return;\n }\n }\n if (backOff) {\n if (backOff * backOff > dx * dx + dy * dy) {\n hideLine();\n return;\n }\n var backOffX = backOff * Math.cos(startRot);\n var backOffY = backOff * Math.sin(startRot);\n end.x += backOffX;\n end.y += backOffY;\n el3.attr({ x2: end.x, y2: end.y });\n }\n if (startBackOff) {\n if (startBackOff * startBackOff > dx * dx + dy * dy) {\n hideLine();\n return;\n }\n var startBackOffX = startBackOff * Math.cos(startRot);\n var startbackOffY = startBackOff * Math.sin(startRot);\n start.x -= startBackOffX;\n start.y -= startbackOffY;\n el3.attr({ x1: start.x, y1: start.y });\n }\n } else if (el.nodeName === \"path\") {\n var pathlen = el.getTotalLength();\n var dashArray = \"\";\n if (pathlen < backOff + startBackOff) {\n hideLine();\n return;\n }\n var start0 = el.getPointAtLength(0);\n var dstart = el.getPointAtLength(0.1);\n startRot = Math.atan2(start0.y - dstart.y, start0.x - dstart.x);\n start = el.getPointAtLength(Math.min(startBackOff, pathlen));\n dashArray = \"0px,\" + startBackOff + \"px,\";\n var end0 = el.getPointAtLength(pathlen);\n var dend = el.getPointAtLength(pathlen - 0.1);\n endRot = Math.atan2(end0.y - dend.y, end0.x - dend.x);\n end = el.getPointAtLength(Math.max(0, pathlen - backOff));\n var shortening = dashArray ? startBackOff + backOff : backOff;\n dashArray += pathlen - shortening + \"px,\" + pathlen + \"px\";\n el3.style(\"stroke-dasharray\", dashArray);\n }\n function hideLine() {\n el3.style(\"stroke-dasharray\", \"0px,100px\");\n }\n function drawhead(arrowHeadStyle, p, rot, arrowScale) {\n if (!arrowHeadStyle.path) return;\n if (arrowHeadStyle.noRotate) rot = 0;\n d3.select(el.parentNode).append(\"path\").attr({\n class: el3.attr(\"class\"),\n d: arrowHeadStyle.path,\n transform: strTranslate(p.x, p.y) + strRotate(rot * 180 / Math.PI) + strScale(arrowScale)\n }).style({\n fill: Color2.rgb(options.arrowcolor),\n \"stroke-width\": 0\n });\n }\n if (doStart) drawhead(startHeadStyle, start, startRot, startScale);\n if (doEnd) drawhead(headStyle, end, endRot, scale);\n };\n }\n });\n\n // src/components/annotations/draw.js\n var require_draw4 = __commonJS({\n \"src/components/annotations/draw.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Registry = require_registry();\n var Plots = require_plots();\n var Lib = require_lib();\n var strTranslate = Lib.strTranslate;\n var Axes = require_axes();\n var Color2 = require_color();\n var Drawing = require_drawing();\n var Fx = require_fx();\n var svgTextUtils = require_svg_text_utils();\n var setCursor = require_setcursor();\n var dragElement = require_dragelement();\n var arrayEditor = require_plot_template().arrayEditor;\n var drawArrowHead = require_draw_arrow_head();\n module.exports = {\n draw,\n drawOne,\n drawRaw\n };\n function draw(gd) {\n var fullLayout = gd._fullLayout;\n fullLayout._infolayer.selectAll(\".annotation\").remove();\n for (var i = 0; i < fullLayout.annotations.length; i++) {\n if (fullLayout.annotations[i].visible) {\n drawOne(gd, i);\n }\n }\n return Plots.previousPromises(gd);\n }\n function drawOne(gd, index) {\n var fullLayout = gd._fullLayout;\n var options = fullLayout.annotations[index] || {};\n var xa = Axes.getFromId(gd, options.xref);\n var ya = Axes.getFromId(gd, options.yref);\n if (xa) xa.setScale();\n if (ya) ya.setScale();\n drawRaw(gd, options, index, false, xa, ya);\n }\n function shiftPosition(axa, dAx, axLetter, gs, options) {\n var optAx = options[axLetter];\n var axRef = options[axLetter + \"ref\"];\n var vertical = axLetter.indexOf(\"y\") !== -1;\n var axDomainRef = Axes.getRefType(axRef) === \"domain\";\n var gsDim = vertical ? gs.h : gs.w;\n if (axa) {\n if (axDomainRef) {\n return optAx + (vertical ? -dAx : dAx) / axa._length;\n } else {\n return axa.p2r(axa.r2p(optAx) + dAx);\n }\n } else {\n return optAx + (vertical ? -dAx : dAx) / gsDim;\n }\n }\n function drawRaw(gd, options, index, subplotId, xa, ya) {\n var fullLayout = gd._fullLayout;\n var gs = gd._fullLayout._size;\n var edits = gd._context.edits;\n var className, containerStr;\n if (subplotId) {\n className = \"annotation-\" + subplotId;\n containerStr = subplotId + \".annotations\";\n } else {\n className = \"annotation\";\n containerStr = \"annotations\";\n }\n var editHelpers = arrayEditor(gd.layout, containerStr, options);\n var modifyBase = editHelpers.modifyBase;\n var modifyItem = editHelpers.modifyItem;\n var getUpdateObj = editHelpers.getUpdateObj;\n fullLayout._infolayer.selectAll(\".\" + className + '[data-index=\"' + index + '\"]').remove();\n var annClipID = \"clip\" + fullLayout._uid + \"_ann\" + index;\n if (!options._input || options.visible === false) {\n d3.selectAll(\"#\" + annClipID).remove();\n return;\n }\n var annPosPx = { x: {}, y: {} };\n var textangle = +options.textangle || 0;\n var annGroup = fullLayout._infolayer.append(\"g\").classed(className, true).attr(\"data-index\", String(index)).style(\"opacity\", options.opacity);\n var annTextGroup = annGroup.append(\"g\").classed(\"annotation-text-g\", true);\n var editTextPosition = edits[options.showarrow ? \"annotationTail\" : \"annotationPosition\"];\n var textEvents = options.captureevents || edits.annotationText || editTextPosition;\n function makeEventData(initialEvent) {\n var eventData = {\n index,\n annotation: options._input,\n fullAnnotation: options,\n event: initialEvent\n };\n if (subplotId) {\n eventData.subplotId = subplotId;\n }\n return eventData;\n }\n var annTextGroupInner = annTextGroup.append(\"g\").style(\"pointer-events\", textEvents ? \"all\" : null).call(setCursor, \"pointer\").on(\"click\", function() {\n gd._dragging = false;\n gd.emit(\"plotly_clickannotation\", makeEventData(d3.event));\n });\n if (options.hovertext) {\n annTextGroupInner.on(\"mouseover\", function() {\n var hoverOptions = options.hoverlabel;\n var hoverFont = hoverOptions.font;\n var bBox = this.getBoundingClientRect();\n var bBoxRef = gd.getBoundingClientRect();\n Fx.loneHover({\n x0: bBox.left - bBoxRef.left,\n x1: bBox.right - bBoxRef.left,\n y: (bBox.top + bBox.bottom) / 2 - bBoxRef.top,\n text: options.hovertext,\n color: hoverOptions.bgcolor,\n borderColor: hoverOptions.bordercolor,\n fontFamily: hoverFont.family,\n fontSize: hoverFont.size,\n fontColor: hoverFont.color,\n fontWeight: hoverFont.weight,\n fontStyle: hoverFont.style,\n fontVariant: hoverFont.variant,\n fontShadow: hoverFont.fontShadow,\n fontLineposition: hoverFont.fontLineposition,\n fontTextcase: hoverFont.fontTextcase\n }, {\n container: fullLayout._hoverlayer.node(),\n outerContainer: fullLayout._paper.node(),\n gd\n });\n }).on(\"mouseout\", function() {\n Fx.loneUnhover(fullLayout._hoverlayer.node());\n });\n }\n var borderwidth = options.borderwidth;\n var borderpad = options.borderpad;\n var borderfull = borderwidth + borderpad;\n var annTextBG = annTextGroupInner.append(\"rect\").attr(\"class\", \"bg\").style(\"stroke-width\", borderwidth + \"px\").call(Color2.stroke, options.bordercolor).call(Color2.fill, options.bgcolor);\n var isSizeConstrained = options.width || options.height;\n var annTextClip = fullLayout._topclips.selectAll(\"#\" + annClipID).data(isSizeConstrained ? [0] : []);\n annTextClip.enter().append(\"clipPath\").classed(\"annclip\", true).attr(\"id\", annClipID).append(\"rect\");\n annTextClip.exit().remove();\n var font = options.font;\n var text = fullLayout._meta ? Lib.templateString(options.text, fullLayout._meta) : options.text;\n var annText = annTextGroupInner.append(\"text\").classed(\"annotation-text\", true).text(text);\n function textLayout(s) {\n s.call(Drawing.font, font).attr({\n \"text-anchor\": {\n left: \"start\",\n right: \"end\"\n }[options.align] || \"middle\"\n });\n svgTextUtils.convertToTspans(s, gd, drawGraphicalElements);\n return s;\n }\n function drawGraphicalElements() {\n var anchor3 = annText.selectAll(\"a\");\n if (anchor3.size() === 1 && anchor3.text() === annText.text()) {\n var wholeLink = annTextGroupInner.insert(\"a\", \":first-child\").attr({\n \"xlink:xlink:href\": anchor3.attr(\"xlink:href\"),\n \"xlink:xlink:show\": anchor3.attr(\"xlink:show\")\n }).style({ cursor: \"pointer\" });\n wholeLink.node().appendChild(annTextBG.node());\n }\n var mathjaxGroup = annTextGroupInner.select(\".annotation-text-math-group\");\n var hasMathjax = !mathjaxGroup.empty();\n var anntextBB = Drawing.bBox(\n (hasMathjax ? mathjaxGroup : annText).node()\n );\n var textWidth = anntextBB.width;\n var textHeight = anntextBB.height;\n var annWidth = options.width || textWidth;\n var annHeight = options.height || textHeight;\n var outerWidth = Math.round(annWidth + 2 * borderfull);\n var outerHeight = Math.round(annHeight + 2 * borderfull);\n function shiftFraction(v, anchor2) {\n if (anchor2 === \"auto\") {\n if (v < 1 / 3) anchor2 = \"left\";\n else if (v > 2 / 3) anchor2 = \"right\";\n else anchor2 = \"center\";\n }\n return {\n center: 0,\n middle: 0,\n left: 0.5,\n bottom: -0.5,\n right: -0.5,\n top: 0.5\n }[anchor2];\n }\n var annotationIsOffscreen = false;\n var letters = [\"x\", \"y\"];\n for (var i = 0; i < letters.length; i++) {\n var axLetter = letters[i];\n var axRef = options[axLetter + \"ref\"] || axLetter;\n var tailRef = options[\"a\" + axLetter + \"ref\"];\n var ax = { x: xa, y: ya }[axLetter];\n var dimAngle = (textangle + (axLetter === \"x\" ? 0 : -90)) * Math.PI / 180;\n var annSizeFromWidth = outerWidth * Math.cos(dimAngle);\n var annSizeFromHeight = outerHeight * Math.sin(dimAngle);\n var annSize = Math.abs(annSizeFromWidth) + Math.abs(annSizeFromHeight);\n var anchor = options[axLetter + \"anchor\"];\n var overallShift = options[axLetter + \"shift\"] * (axLetter === \"x\" ? 1 : -1);\n var posPx = annPosPx[axLetter];\n var basePx;\n var textPadShift;\n var alignPosition;\n var autoAlignFraction;\n var textShift;\n var axRefType = Axes.getRefType(axRef);\n if (ax && axRefType !== \"domain\") {\n var posFraction = ax.r2fraction(options[axLetter]);\n if (posFraction < 0 || posFraction > 1) {\n if (tailRef === axRef) {\n posFraction = ax.r2fraction(options[\"a\" + axLetter]);\n if (posFraction < 0 || posFraction > 1) {\n annotationIsOffscreen = true;\n }\n } else {\n annotationIsOffscreen = true;\n }\n }\n basePx = ax._offset + ax.r2p(options[axLetter]);\n autoAlignFraction = 0.5;\n } else {\n var axRefTypeEqDomain = axRefType === \"domain\";\n if (axLetter === \"x\") {\n alignPosition = options[axLetter];\n basePx = axRefTypeEqDomain ? ax._offset + ax._length * alignPosition : basePx = gs.l + gs.w * alignPosition;\n } else {\n alignPosition = 1 - options[axLetter];\n basePx = axRefTypeEqDomain ? ax._offset + ax._length * alignPosition : basePx = gs.t + gs.h * alignPosition;\n }\n autoAlignFraction = options.showarrow ? 0.5 : alignPosition;\n }\n if (options.showarrow) {\n posPx.head = basePx;\n var arrowLength = options[\"a\" + axLetter];\n textShift = annSizeFromWidth * shiftFraction(0.5, options.xanchor) - annSizeFromHeight * shiftFraction(0.5, options.yanchor);\n if (tailRef === axRef) {\n var tailRefType = Axes.getRefType(tailRef);\n if (tailRefType === \"domain\") {\n if (axLetter === \"y\") {\n arrowLength = 1 - arrowLength;\n }\n posPx.tail = ax._offset + ax._length * arrowLength;\n } else if (tailRefType === \"paper\") {\n if (axLetter === \"y\") {\n arrowLength = 1 - arrowLength;\n posPx.tail = gs.t + gs.h * arrowLength;\n } else {\n posPx.tail = gs.l + gs.w * arrowLength;\n }\n } else {\n posPx.tail = ax._offset + ax.r2p(arrowLength);\n }\n textPadShift = textShift;\n } else {\n posPx.tail = basePx + arrowLength;\n textPadShift = textShift + arrowLength;\n }\n posPx.text = posPx.tail + textShift;\n var maxPx = fullLayout[axLetter === \"x\" ? \"width\" : \"height\"];\n if (axRef === \"paper\") {\n posPx.head = Lib.constrain(posPx.head, 1, maxPx - 1);\n }\n if (tailRef === \"pixel\") {\n var shiftPlus = -Math.max(posPx.tail - 3, posPx.text);\n var shiftMinus = Math.min(posPx.tail + 3, posPx.text) - maxPx;\n if (shiftPlus > 0) {\n posPx.tail += shiftPlus;\n posPx.text += shiftPlus;\n } else if (shiftMinus > 0) {\n posPx.tail -= shiftMinus;\n posPx.text -= shiftMinus;\n }\n }\n posPx.tail += overallShift;\n posPx.head += overallShift;\n } else {\n textShift = annSize * shiftFraction(autoAlignFraction, anchor);\n textPadShift = textShift;\n posPx.text = basePx + textShift;\n }\n posPx.text += overallShift;\n textShift += overallShift;\n textPadShift += overallShift;\n options[\"_\" + axLetter + \"padplus\"] = annSize / 2 + textPadShift;\n options[\"_\" + axLetter + \"padminus\"] = annSize / 2 - textPadShift;\n options[\"_\" + axLetter + \"size\"] = annSize;\n options[\"_\" + axLetter + \"shift\"] = textShift;\n }\n if (annotationIsOffscreen) {\n annTextGroupInner.remove();\n return;\n }\n var xShift = 0;\n var yShift = 0;\n if (options.align !== \"left\") {\n xShift = (annWidth - textWidth) * (options.align === \"center\" ? 0.5 : 1);\n }\n if (options.valign !== \"top\") {\n yShift = (annHeight - textHeight) * (options.valign === \"middle\" ? 0.5 : 1);\n }\n if (hasMathjax) {\n mathjaxGroup.select(\"svg\").attr({\n x: borderfull + xShift - 1,\n y: borderfull + yShift\n }).call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null, gd);\n } else {\n var texty = borderfull + yShift - anntextBB.top;\n var textx = borderfull + xShift - anntextBB.left;\n annText.call(svgTextUtils.positionText, textx, texty).call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null, gd);\n }\n annTextClip.select(\"rect\").call(\n Drawing.setRect,\n borderfull,\n borderfull,\n annWidth,\n annHeight\n );\n annTextBG.call(\n Drawing.setRect,\n borderwidth / 2,\n borderwidth / 2,\n outerWidth - borderwidth,\n outerHeight - borderwidth\n );\n annTextGroupInner.call(\n Drawing.setTranslate,\n Math.round(annPosPx.x.text - outerWidth / 2),\n Math.round(annPosPx.y.text - outerHeight / 2)\n );\n annTextGroup.attr({ transform: \"rotate(\" + textangle + \",\" + annPosPx.x.text + \",\" + annPosPx.y.text + \")\" });\n var drawArrow = function(dx, dy) {\n annGroup.selectAll(\".annotation-arrow-g\").remove();\n var headX = annPosPx.x.head;\n var headY = annPosPx.y.head;\n var tailX = annPosPx.x.tail + dx;\n var tailY = annPosPx.y.tail + dy;\n var textX = annPosPx.x.text + dx;\n var textY = annPosPx.y.text + dy;\n var transform = Lib.rotationXYMatrix(textangle, textX, textY);\n var applyTransform = Lib.apply2DTransform(transform);\n var applyTransform2 = Lib.apply2DTransform2(transform);\n var width = +annTextBG.attr(\"width\");\n var height = +annTextBG.attr(\"height\");\n var xLeft = textX - 0.5 * width;\n var xRight = xLeft + width;\n var yTop = textY - 0.5 * height;\n var yBottom = yTop + height;\n var edges = [\n [xLeft, yTop, xLeft, yBottom],\n [xLeft, yBottom, xRight, yBottom],\n [xRight, yBottom, xRight, yTop],\n [xRight, yTop, xLeft, yTop]\n ].map(applyTransform2);\n if (edges.reduce(function(a, x) {\n return a ^ !!Lib.segmentsIntersect(\n headX,\n headY,\n headX + 1e6,\n headY + 1e6,\n x[0],\n x[1],\n x[2],\n x[3]\n );\n }, false)) {\n return;\n }\n edges.forEach(function(x) {\n var p = Lib.segmentsIntersect(\n tailX,\n tailY,\n headX,\n headY,\n x[0],\n x[1],\n x[2],\n x[3]\n );\n if (p) {\n tailX = p.x;\n tailY = p.y;\n }\n });\n var strokewidth = options.arrowwidth;\n var arrowColor = options.arrowcolor;\n var arrowSide = options.arrowside;\n var arrowGroup = annGroup.append(\"g\").style({ opacity: Color2.opacity(arrowColor) }).classed(\"annotation-arrow-g\", true);\n var arrow = arrowGroup.append(\"path\").attr(\"d\", \"M\" + tailX + \",\" + tailY + \"L\" + headX + \",\" + headY).style(\"stroke-width\", strokewidth + \"px\").call(Color2.stroke, Color2.rgb(arrowColor));\n drawArrowHead(arrow, arrowSide, options);\n if (edits.annotationPosition && arrow.node().parentNode && !subplotId) {\n var arrowDragHeadX = headX;\n var arrowDragHeadY = headY;\n if (options.standoff) {\n var arrowLength2 = Math.sqrt(Math.pow(headX - tailX, 2) + Math.pow(headY - tailY, 2));\n arrowDragHeadX += options.standoff * (tailX - headX) / arrowLength2;\n arrowDragHeadY += options.standoff * (tailY - headY) / arrowLength2;\n }\n var arrowDrag = arrowGroup.append(\"path\").classed(\"annotation-arrow\", true).classed(\"anndrag\", true).classed(\"cursor-move\", true).attr({\n d: \"M3,3H-3V-3H3ZM0,0L\" + (tailX - arrowDragHeadX) + \",\" + (tailY - arrowDragHeadY),\n transform: strTranslate(arrowDragHeadX, arrowDragHeadY)\n }).style(\"stroke-width\", strokewidth + 6 + \"px\").call(Color2.stroke, \"rgba(0,0,0,0)\").call(Color2.fill, \"rgba(0,0,0,0)\");\n var annx0, anny0;\n dragElement.init({\n element: arrowDrag.node(),\n gd,\n prepFn: function() {\n var pos = Drawing.getTranslate(annTextGroupInner);\n annx0 = pos.x;\n anny0 = pos.y;\n if (xa && xa.autorange) {\n modifyBase(xa._name + \".autorange\", true);\n }\n if (ya && ya.autorange) {\n modifyBase(ya._name + \".autorange\", true);\n }\n },\n moveFn: function(dx2, dy2) {\n var annxy0 = applyTransform(annx0, anny0);\n var xcenter = annxy0[0] + dx2;\n var ycenter = annxy0[1] + dy2;\n annTextGroupInner.call(Drawing.setTranslate, xcenter, ycenter);\n modifyItem(\n \"x\",\n shiftPosition(xa, dx2, \"x\", gs, options)\n );\n modifyItem(\n \"y\",\n shiftPosition(ya, dy2, \"y\", gs, options)\n );\n if (options.axref === options.xref) {\n modifyItem(\"ax\", shiftPosition(xa, dx2, \"ax\", gs, options));\n }\n if (options.ayref === options.yref) {\n modifyItem(\"ay\", shiftPosition(ya, dy2, \"ay\", gs, options));\n }\n arrowGroup.attr(\"transform\", strTranslate(dx2, dy2));\n annTextGroup.attr({\n transform: \"rotate(\" + textangle + \",\" + xcenter + \",\" + ycenter + \")\"\n });\n },\n doneFn: function() {\n Registry.call(\"_guiRelayout\", gd, getUpdateObj());\n var notesBox = document.querySelector(\".js-notes-box-panel\");\n if (notesBox) notesBox.redraw(notesBox.selectedObj);\n }\n });\n }\n };\n if (options.showarrow) drawArrow(0, 0);\n if (editTextPosition) {\n var baseTextTransform;\n dragElement.init({\n element: annTextGroupInner.node(),\n gd,\n prepFn: function() {\n baseTextTransform = annTextGroup.attr(\"transform\");\n },\n moveFn: function(dx, dy) {\n var csr = \"pointer\";\n if (options.showarrow) {\n if (options.axref === options.xref) {\n modifyItem(\"ax\", shiftPosition(xa, dx, \"ax\", gs, options));\n } else {\n modifyItem(\"ax\", options.ax + dx);\n }\n if (options.ayref === options.yref) {\n modifyItem(\"ay\", shiftPosition(ya, dy, \"ay\", gs.w, options));\n } else {\n modifyItem(\"ay\", options.ay + dy);\n }\n drawArrow(dx, dy);\n } else if (!subplotId) {\n var xUpdate, yUpdate;\n if (xa) {\n xUpdate = shiftPosition(xa, dx, \"x\", gs, options);\n } else {\n var widthFraction = options._xsize / gs.w;\n var xLeft = options.x + (options._xshift - options.xshift) / gs.w - widthFraction / 2;\n xUpdate = dragElement.align(\n xLeft + dx / gs.w,\n widthFraction,\n 0,\n 1,\n options.xanchor\n );\n }\n if (ya) {\n yUpdate = shiftPosition(ya, dy, \"y\", gs, options);\n } else {\n var heightFraction = options._ysize / gs.h;\n var yBottom = options.y - (options._yshift + options.yshift) / gs.h - heightFraction / 2;\n yUpdate = dragElement.align(\n yBottom - dy / gs.h,\n heightFraction,\n 0,\n 1,\n options.yanchor\n );\n }\n modifyItem(\"x\", xUpdate);\n modifyItem(\"y\", yUpdate);\n if (!xa || !ya) {\n csr = dragElement.getCursor(\n xa ? 0.5 : xUpdate,\n ya ? 0.5 : yUpdate,\n options.xanchor,\n options.yanchor\n );\n }\n } else return;\n annTextGroup.attr({\n transform: strTranslate(dx, dy) + baseTextTransform\n });\n setCursor(annTextGroupInner, csr);\n },\n clickFn: function(_, initialEvent) {\n if (options.captureevents) {\n gd.emit(\"plotly_clickannotation\", makeEventData(initialEvent));\n }\n },\n doneFn: function() {\n setCursor(annTextGroupInner);\n Registry.call(\"_guiRelayout\", gd, getUpdateObj());\n var notesBox = document.querySelector(\".js-notes-box-panel\");\n if (notesBox) notesBox.redraw(notesBox.selectedObj);\n }\n });\n }\n }\n if (edits.annotationText) {\n annText.call(svgTextUtils.makeEditable, { delegate: annTextGroupInner, gd }).call(textLayout).on(\"edit\", function(_text) {\n options.text = _text;\n this.call(textLayout);\n modifyItem(\"text\", _text);\n if (xa && xa.autorange) {\n modifyBase(xa._name + \".autorange\", true);\n }\n if (ya && ya.autorange) {\n modifyBase(ya._name + \".autorange\", true);\n }\n Registry.call(\"_guiRelayout\", gd, getUpdateObj());\n });\n } else annText.call(textLayout);\n }\n }\n });\n\n // src/components/annotations/click.js\n var require_click2 = __commonJS({\n \"src/components/annotations/click.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Registry = require_registry();\n var arrayEditor = require_plot_template().arrayEditor;\n module.exports = {\n hasClickToShow,\n onClick\n };\n function hasClickToShow(gd, hoverData) {\n var sets = getToggleSets(gd, hoverData);\n return sets.on.length > 0 || sets.explicitOff.length > 0;\n }\n function onClick(gd, hoverData) {\n var toggleSets = getToggleSets(gd, hoverData);\n var onSet = toggleSets.on;\n var offSet = toggleSets.off.concat(toggleSets.explicitOff);\n var update = {};\n var annotationsOut = gd._fullLayout.annotations;\n var i, editHelpers;\n if (!(onSet.length || offSet.length)) return;\n for (i = 0; i < onSet.length; i++) {\n editHelpers = arrayEditor(gd.layout, \"annotations\", annotationsOut[onSet[i]]);\n editHelpers.modifyItem(\"visible\", true);\n Lib.extendFlat(update, editHelpers.getUpdateObj());\n }\n for (i = 0; i < offSet.length; i++) {\n editHelpers = arrayEditor(gd.layout, \"annotations\", annotationsOut[offSet[i]]);\n editHelpers.modifyItem(\"visible\", false);\n Lib.extendFlat(update, editHelpers.getUpdateObj());\n }\n return Registry.call(\"update\", gd, {}, update);\n }\n function getToggleSets(gd, hoverData) {\n var annotations = gd._fullLayout.annotations;\n var onSet = [];\n var offSet = [];\n var explicitOffSet = [];\n var hoverLen = (hoverData || []).length;\n var i, j, anni, showMode, pointj, xa, ya, toggleType;\n for (i = 0; i < annotations.length; i++) {\n anni = annotations[i];\n showMode = anni.clicktoshow;\n if (showMode) {\n for (j = 0; j < hoverLen; j++) {\n pointj = hoverData[j];\n xa = pointj.xaxis;\n ya = pointj.yaxis;\n if (xa._id === anni.xref && ya._id === anni.yref && xa.d2r(pointj.x) === clickData2r(anni._xclick, xa) && ya.d2r(pointj.y) === clickData2r(anni._yclick, ya)) {\n if (anni.visible) {\n if (showMode === \"onout\") toggleType = offSet;\n else toggleType = explicitOffSet;\n } else {\n toggleType = onSet;\n }\n toggleType.push(i);\n break;\n }\n }\n if (j === hoverLen) {\n if (anni.visible && showMode === \"onout\") offSet.push(i);\n }\n }\n }\n return { on: onSet, off: offSet, explicitOff: explicitOffSet };\n }\n function clickData2r(d, ax) {\n return ax.type === \"log\" ? ax.l2r(d) : ax.d2r(d);\n }\n }\n });\n\n // src/components/annotations/common_defaults.js\n var require_common_defaults = __commonJS({\n \"src/components/annotations/common_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Color2 = require_color();\n module.exports = function handleAnnotationCommonDefaults(annIn, annOut, fullLayout, coerce) {\n coerce(\"opacity\");\n var bgColor = coerce(\"bgcolor\");\n var borderColor = coerce(\"bordercolor\");\n var borderOpacity = Color2.opacity(borderColor);\n coerce(\"borderpad\");\n var borderWidth = coerce(\"borderwidth\");\n var showArrow = coerce(\"showarrow\");\n coerce(\"text\", showArrow ? \" \" : fullLayout._dfltTitle.annotation);\n coerce(\"textangle\");\n Lib.coerceFont(coerce, \"font\", fullLayout.font);\n coerce(\"width\");\n coerce(\"align\");\n var h = coerce(\"height\");\n if (h) coerce(\"valign\");\n if (showArrow) {\n var arrowside = coerce(\"arrowside\");\n var arrowhead;\n var arrowsize;\n if (arrowside.indexOf(\"end\") !== -1) {\n arrowhead = coerce(\"arrowhead\");\n arrowsize = coerce(\"arrowsize\");\n }\n if (arrowside.indexOf(\"start\") !== -1) {\n coerce(\"startarrowhead\", arrowhead);\n coerce(\"startarrowsize\", arrowsize);\n }\n coerce(\"arrowcolor\", borderOpacity ? annOut.bordercolor : Color2.defaultLine);\n coerce(\"arrowwidth\", (borderOpacity && borderWidth || 1) * 2);\n coerce(\"standoff\");\n coerce(\"startstandoff\");\n }\n var hoverText = coerce(\"hovertext\");\n var globalHoverLabel = fullLayout.hoverlabel || {};\n if (hoverText) {\n var hoverBG = coerce(\n \"hoverlabel.bgcolor\",\n globalHoverLabel.bgcolor || (Color2.opacity(bgColor) ? Color2.rgb(bgColor) : Color2.defaultLine)\n );\n var hoverBorder = coerce(\n \"hoverlabel.bordercolor\",\n globalHoverLabel.bordercolor || Color2.contrast(hoverBG)\n );\n var fontDflt = Lib.extendFlat({}, globalHoverLabel.font);\n if (!fontDflt.color) {\n fontDflt.color = hoverBorder;\n }\n Lib.coerceFont(coerce, \"hoverlabel.font\", fontDflt);\n }\n coerce(\"captureevents\", !!hoverText);\n };\n }\n });\n\n // src/components/annotations/defaults.js\n var require_defaults9 = __commonJS({\n \"src/components/annotations/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Axes = require_axes();\n var handleArrayContainerDefaults = require_array_container_defaults();\n var handleAnnotationCommonDefaults = require_common_defaults();\n var attributes = require_attributes11();\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {\n handleArrayContainerDefaults(layoutIn, layoutOut, {\n name: \"annotations\",\n handleItemDefaults: handleAnnotationDefaults\n });\n };\n function handleAnnotationDefaults(annIn, annOut, fullLayout) {\n function coerce(attr, dflt) {\n return Lib.coerce(annIn, annOut, attributes, attr, dflt);\n }\n var visible = coerce(\"visible\");\n var clickToShow = coerce(\"clicktoshow\");\n if (!(visible || clickToShow)) return;\n handleAnnotationCommonDefaults(annIn, annOut, fullLayout, coerce);\n var showArrow = annOut.showarrow;\n var axLetters = [\"x\", \"y\"];\n var arrowPosDflt = [-10, -30];\n var gdMock = { _fullLayout: fullLayout };\n for (var i = 0; i < 2; i++) {\n var axLetter = axLetters[i];\n var axRef = Axes.coerceRef(annIn, annOut, gdMock, axLetter, \"\", \"paper\");\n if (axRef !== \"paper\") {\n var ax = Axes.getFromId(gdMock, axRef);\n ax._annIndices.push(annOut._index);\n }\n Axes.coercePosition(annOut, gdMock, coerce, axRef, axLetter, 0.5);\n if (showArrow) {\n var arrowPosAttr = \"a\" + axLetter;\n var aaxRef = Axes.coerceRef(\n annIn,\n annOut,\n gdMock,\n arrowPosAttr,\n \"pixel\",\n [\"pixel\", \"paper\"]\n );\n if (aaxRef !== \"pixel\" && aaxRef !== axRef) {\n aaxRef = annOut[arrowPosAttr] = \"pixel\";\n }\n var aDflt = aaxRef === \"pixel\" ? arrowPosDflt[i] : 0.4;\n Axes.coercePosition(annOut, gdMock, coerce, aaxRef, arrowPosAttr, aDflt);\n }\n coerce(axLetter + \"anchor\");\n coerce(axLetter + \"shift\");\n }\n Lib.noneOrAll(annIn, annOut, [\"x\", \"y\"]);\n if (showArrow) {\n Lib.noneOrAll(annIn, annOut, [\"ax\", \"ay\"]);\n }\n if (clickToShow) {\n var xClick = coerce(\"xclick\");\n var yClick = coerce(\"yclick\");\n annOut._xclick = xClick === void 0 ? annOut.x : Axes.cleanPosition(xClick, gdMock, annOut.xref);\n annOut._yclick = yClick === void 0 ? annOut.y : Axes.cleanPosition(yClick, gdMock, annOut.yref);\n }\n }\n }\n });\n\n // src/components/annotations/calc_autorange.js\n var require_calc_autorange = __commonJS({\n \"src/components/annotations/calc_autorange.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Axes = require_axes();\n var draw = require_draw4().draw;\n module.exports = function calcAutorange(gd) {\n var fullLayout = gd._fullLayout;\n var annotationList = Lib.filterVisible(fullLayout.annotations);\n if (annotationList.length && gd._fullData.length) {\n return Lib.syncOrAsync([draw, annAutorange], gd);\n }\n };\n function annAutorange(gd) {\n var fullLayout = gd._fullLayout;\n Lib.filterVisible(fullLayout.annotations).forEach(function(ann) {\n var xa = Axes.getFromId(gd, ann.xref);\n var ya = Axes.getFromId(gd, ann.yref);\n var xRefType = Axes.getRefType(ann.xref);\n var yRefType = Axes.getRefType(ann.yref);\n ann._extremes = {};\n if (xRefType === \"range\") calcAxisExpansion(ann, xa);\n if (yRefType === \"range\") calcAxisExpansion(ann, ya);\n });\n }\n function calcAxisExpansion(ann, ax) {\n var axId = ax._id;\n var letter = axId.charAt(0);\n var pos = ann[letter];\n var apos = ann[\"a\" + letter];\n var ref = ann[letter + \"ref\"];\n var aref = ann[\"a\" + letter + \"ref\"];\n var padplus = ann[\"_\" + letter + \"padplus\"];\n var padminus = ann[\"_\" + letter + \"padminus\"];\n var shift = { x: 1, y: -1 }[letter] * ann[letter + \"shift\"];\n var headSize = 3 * ann.arrowsize * ann.arrowwidth || 0;\n var headPlus = headSize + shift;\n var headMinus = headSize - shift;\n var startHeadSize = 3 * ann.startarrowsize * ann.arrowwidth || 0;\n var startHeadPlus = startHeadSize + shift;\n var startHeadMinus = startHeadSize - shift;\n var extremes;\n if (aref === ref) {\n var extremeArrowHead = Axes.findExtremes(ax, [ax.r2c(pos)], {\n ppadplus: headPlus,\n ppadminus: headMinus\n });\n var extremeText = Axes.findExtremes(ax, [ax.r2c(apos)], {\n ppadplus: Math.max(padplus, startHeadPlus),\n ppadminus: Math.max(padminus, startHeadMinus)\n });\n extremes = {\n min: [extremeArrowHead.min[0], extremeText.min[0]],\n max: [extremeArrowHead.max[0], extremeText.max[0]]\n };\n } else {\n startHeadPlus = apos ? startHeadPlus + apos : startHeadPlus;\n startHeadMinus = apos ? startHeadMinus - apos : startHeadMinus;\n extremes = Axes.findExtremes(ax, [ax.r2c(pos)], {\n ppadplus: Math.max(padplus, headPlus, startHeadPlus),\n ppadminus: Math.max(padminus, headMinus, startHeadMinus)\n });\n }\n ann._extremes[axId] = extremes;\n }\n }\n });\n\n // src/components/annotations/convert_coords.js\n var require_convert_coords = __commonJS({\n \"src/components/annotations/convert_coords.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var toLogRange = require_to_log_range();\n module.exports = function convertCoords(gd, ax, newType, doExtra) {\n ax = ax || {};\n var toLog = newType === \"log\" && ax.type === \"linear\";\n var fromLog = newType === \"linear\" && ax.type === \"log\";\n if (!(toLog || fromLog)) return;\n var annotations = gd._fullLayout.annotations;\n var axLetter = ax._id.charAt(0);\n var ann;\n var attrPrefix;\n function convert(attr) {\n var currentVal = ann[attr];\n var newVal = null;\n if (toLog) newVal = toLogRange(currentVal, ax.range);\n else newVal = Math.pow(10, currentVal);\n if (!isNumeric(newVal)) newVal = null;\n doExtra(attrPrefix + attr, newVal);\n }\n for (var i = 0; i < annotations.length; i++) {\n ann = annotations[i];\n attrPrefix = \"annotations[\" + i + \"].\";\n if (ann[axLetter + \"ref\"] === ax._id) convert(axLetter);\n if (ann[\"a\" + axLetter + \"ref\"] === ax._id) convert(\"a\" + axLetter);\n }\n };\n }\n });\n\n // src/components/annotations/index.js\n var require_annotations = __commonJS({\n \"src/components/annotations/index.js\"(exports, module) {\n \"use strict\";\n var drawModule = require_draw4();\n var clickModule = require_click2();\n module.exports = {\n moduleType: \"component\",\n name: \"annotations\",\n layoutAttributes: require_attributes11(),\n supplyLayoutDefaults: require_defaults9(),\n includeBasePlot: require_include_components()(\"annotations\"),\n calcAutorange: require_calc_autorange(),\n draw: drawModule.draw,\n drawOne: drawModule.drawOne,\n drawRaw: drawModule.drawRaw,\n hasClickToShow: clickModule.hasClickToShow,\n onClick: clickModule.onClick,\n convertCoords: require_convert_coords()\n };\n }\n });\n\n // src/components/annotations3d/attributes.js\n var require_attributes15 = __commonJS({\n \"src/components/annotations3d/attributes.js\"(exports, module) {\n \"use strict\";\n var annAttrs = require_attributes11();\n var overrideAll = require_edit_types().overrideAll;\n var templatedArray = require_plot_template().templatedArray;\n module.exports = overrideAll(templatedArray(\"annotation\", {\n visible: annAttrs.visible,\n x: {\n valType: \"any\"\n },\n y: {\n valType: \"any\"\n },\n z: {\n valType: \"any\"\n },\n ax: {\n valType: \"number\"\n },\n ay: {\n valType: \"number\"\n },\n xanchor: annAttrs.xanchor,\n xshift: annAttrs.xshift,\n yanchor: annAttrs.yanchor,\n yshift: annAttrs.yshift,\n text: annAttrs.text,\n textangle: annAttrs.textangle,\n font: annAttrs.font,\n width: annAttrs.width,\n height: annAttrs.height,\n opacity: annAttrs.opacity,\n align: annAttrs.align,\n valign: annAttrs.valign,\n bgcolor: annAttrs.bgcolor,\n bordercolor: annAttrs.bordercolor,\n borderpad: annAttrs.borderpad,\n borderwidth: annAttrs.borderwidth,\n showarrow: annAttrs.showarrow,\n arrowcolor: annAttrs.arrowcolor,\n arrowhead: annAttrs.arrowhead,\n startarrowhead: annAttrs.startarrowhead,\n arrowside: annAttrs.arrowside,\n arrowsize: annAttrs.arrowsize,\n startarrowsize: annAttrs.startarrowsize,\n arrowwidth: annAttrs.arrowwidth,\n standoff: annAttrs.standoff,\n startstandoff: annAttrs.startstandoff,\n hovertext: annAttrs.hovertext,\n hoverlabel: annAttrs.hoverlabel,\n captureevents: annAttrs.captureevents\n // maybes later?\n // clicktoshow: annAttrs.clicktoshow,\n // xclick: annAttrs.xclick,\n // yclick: annAttrs.yclick,\n // not needed!\n // axref: 'pixel'\n // ayref: 'pixel'\n // xref: 'x'\n // yref: 'y\n // zref: 'z'\n }), \"calc\", \"from-root\");\n }\n });\n\n // src/components/annotations3d/defaults.js\n var require_defaults10 = __commonJS({\n \"src/components/annotations3d/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Axes = require_axes();\n var handleArrayContainerDefaults = require_array_container_defaults();\n var handleAnnotationCommonDefaults = require_common_defaults();\n var attributes = require_attributes15();\n module.exports = function handleDefaults(sceneLayoutIn, sceneLayoutOut, opts) {\n handleArrayContainerDefaults(sceneLayoutIn, sceneLayoutOut, {\n name: \"annotations\",\n handleItemDefaults: handleAnnotationDefaults,\n fullLayout: opts.fullLayout\n });\n };\n function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts) {\n function coerce(attr, dflt) {\n return Lib.coerce(annIn, annOut, attributes, attr, dflt);\n }\n function coercePosition(axLetter) {\n var axName = axLetter + \"axis\";\n var gdMock = { _fullLayout: {} };\n gdMock._fullLayout[axName] = sceneLayout[axName];\n return Axes.coercePosition(annOut, gdMock, coerce, axLetter, axLetter, 0.5);\n }\n var visible = coerce(\"visible\");\n if (!visible) return;\n handleAnnotationCommonDefaults(annIn, annOut, opts.fullLayout, coerce);\n coercePosition(\"x\");\n coercePosition(\"y\");\n coercePosition(\"z\");\n Lib.noneOrAll(annIn, annOut, [\"x\", \"y\", \"z\"]);\n annOut.xref = \"x\";\n annOut.yref = \"y\";\n annOut.zref = \"z\";\n coerce(\"xanchor\");\n coerce(\"yanchor\");\n coerce(\"xshift\");\n coerce(\"yshift\");\n if (annOut.showarrow) {\n annOut.axref = \"pixel\";\n annOut.ayref = \"pixel\";\n coerce(\"ax\", -10);\n coerce(\"ay\", -30);\n Lib.noneOrAll(annIn, annOut, [\"ax\", \"ay\"]);\n }\n }\n }\n });\n\n // src/components/annotations3d/convert.js\n var require_convert = __commonJS({\n \"src/components/annotations3d/convert.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Axes = require_axes();\n module.exports = function convert(scene) {\n var fullSceneLayout = scene.fullSceneLayout;\n var anns = fullSceneLayout.annotations;\n for (var i = 0; i < anns.length; i++) {\n mockAnnAxes(anns[i], scene);\n }\n scene.fullLayout._infolayer.selectAll(\".annotation-\" + scene.id).remove();\n };\n function mockAnnAxes(ann, scene) {\n var fullSceneLayout = scene.fullSceneLayout;\n var domain = fullSceneLayout.domain;\n var size = scene.fullLayout._size;\n var base = {\n // this gets fill in on render\n pdata: null,\n // to get setConvert to not execute cleanly\n type: \"linear\",\n // don't try to update them on `editable: true`\n autorange: false,\n // set infinite range so that annotation draw routine\n // does not try to remove 'outside-range' annotations,\n // this case is handled in the render loop\n range: [-Infinity, Infinity]\n };\n ann._xa = {};\n Lib.extendFlat(ann._xa, base);\n Axes.setConvert(ann._xa);\n ann._xa._offset = size.l + domain.x[0] * size.w;\n ann._xa.l2p = function() {\n return 0.5 * (1 + ann._pdata[0] / ann._pdata[3]) * size.w * (domain.x[1] - domain.x[0]);\n };\n ann._ya = {};\n Lib.extendFlat(ann._ya, base);\n Axes.setConvert(ann._ya);\n ann._ya._offset = size.t + (1 - domain.y[1]) * size.h;\n ann._ya.l2p = function() {\n return 0.5 * (1 - ann._pdata[1] / ann._pdata[3]) * size.h * (domain.y[1] - domain.y[0]);\n };\n }\n }\n });\n\n // src/plots/gl3d/project.js\n var require_project = __commonJS({\n \"src/plots/gl3d/project.js\"(exports, module) {\n \"use strict\";\n function xformMatrix(m, v) {\n var out = [0, 0, 0, 0];\n var i, j;\n for (i = 0; i < 4; ++i) {\n for (j = 0; j < 4; ++j) {\n out[j] += m[4 * i + j] * v[i];\n }\n }\n return out;\n }\n function project(camera, v) {\n var p = xformMatrix(\n camera.projection,\n xformMatrix(\n camera.view,\n xformMatrix(camera.model, [v[0], v[1], v[2], 1])\n )\n );\n return p;\n }\n module.exports = project;\n }\n });\n\n // src/components/annotations3d/draw.js\n var require_draw5 = __commonJS({\n \"src/components/annotations3d/draw.js\"(exports, module) {\n \"use strict\";\n var drawRaw = require_draw4().drawRaw;\n var project = require_project();\n var axLetters = [\"x\", \"y\", \"z\"];\n module.exports = function draw(scene) {\n var fullSceneLayout = scene.fullSceneLayout;\n var dataScale = scene.dataScale;\n var anns = fullSceneLayout.annotations;\n for (var i = 0; i < anns.length; i++) {\n var ann = anns[i];\n var annotationIsOffscreen = false;\n for (var j = 0; j < 3; j++) {\n var axLetter = axLetters[j];\n var pos = ann[axLetter];\n var ax = fullSceneLayout[axLetter + \"axis\"];\n var posFraction = ax.r2fraction(pos);\n if (posFraction < 0 || posFraction > 1) {\n annotationIsOffscreen = true;\n break;\n }\n }\n if (annotationIsOffscreen) {\n scene.fullLayout._infolayer.select(\".annotation-\" + scene.id + '[data-index=\"' + i + '\"]').remove();\n } else {\n ann._pdata = project(scene.glplot.cameraParams, [\n fullSceneLayout.xaxis.r2l(ann.x) * dataScale[0],\n fullSceneLayout.yaxis.r2l(ann.y) * dataScale[1],\n fullSceneLayout.zaxis.r2l(ann.z) * dataScale[2]\n ]);\n drawRaw(scene.graphDiv, ann, i, scene.id, ann._xa, ann._ya);\n }\n }\n };\n }\n });\n\n // src/components/annotations3d/index.js\n var require_annotations3d = __commonJS({\n \"src/components/annotations3d/index.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var Lib = require_lib();\n module.exports = {\n moduleType: \"component\",\n name: \"annotations3d\",\n schema: {\n subplots: {\n scene: { annotations: require_attributes15() }\n }\n },\n layoutAttributes: require_attributes15(),\n handleDefaults: require_defaults10(),\n includeBasePlot: includeGL3D,\n convert: require_convert(),\n draw: require_draw5()\n };\n function includeGL3D(layoutIn, layoutOut) {\n var GL3D = Registry.subplotsRegistry.gl3d;\n if (!GL3D) return;\n var attrRegex = GL3D.attrRegex;\n var keys = Object.keys(layoutIn);\n for (var i = 0; i < keys.length; i++) {\n var k = keys[i];\n if (attrRegex.test(k) && (layoutIn[k].annotations || []).length) {\n Lib.pushUnique(layoutOut._basePlotModules, GL3D);\n Lib.pushUnique(layoutOut._subplots.gl3d, k);\n }\n }\n }\n }\n });\n\n // src/components/shapes/attributes.js\n var require_attributes16 = __commonJS({\n \"src/components/shapes/attributes.js\"(exports, module) {\n \"use strict\";\n var annAttrs = require_attributes11();\n var fontAttrs = require_font_attributes();\n var scatterLineAttrs = require_attributes12().line;\n var dash = require_attributes4().dash;\n var extendFlat = require_extend().extendFlat;\n var templatedArray = require_plot_template().templatedArray;\n var axisPlaceableObjs = require_axis_placeable_objects();\n var basePlotAttributes = require_attributes2();\n var shapeTexttemplateAttrs = require_template_attributes().shapeTexttemplateAttrs;\n var shapeLabelTexttemplateVars = require_label_texttemplate();\n module.exports = templatedArray(\"shape\", {\n visible: extendFlat({}, basePlotAttributes.visible, {\n editType: \"calc+arraydraw\"\n }),\n showlegend: {\n valType: \"boolean\",\n dflt: false,\n editType: \"calc+arraydraw\"\n },\n legend: extendFlat({}, basePlotAttributes.legend, {\n editType: \"calc+arraydraw\"\n }),\n legendgroup: extendFlat({}, basePlotAttributes.legendgroup, {\n editType: \"calc+arraydraw\"\n }),\n legendgrouptitle: {\n text: extendFlat({}, basePlotAttributes.legendgrouptitle.text, {\n editType: \"calc+arraydraw\"\n }),\n font: fontAttrs({\n editType: \"calc+arraydraw\"\n }),\n editType: \"calc+arraydraw\"\n },\n legendrank: extendFlat({}, basePlotAttributes.legendrank, {\n editType: \"calc+arraydraw\"\n }),\n legendwidth: extendFlat({}, basePlotAttributes.legendwidth, {\n editType: \"calc+arraydraw\"\n }),\n type: {\n valType: \"enumerated\",\n values: [\"circle\", \"rect\", \"path\", \"line\"],\n editType: \"calc+arraydraw\"\n },\n layer: {\n valType: \"enumerated\",\n values: [\"below\", \"above\", \"between\"],\n dflt: \"above\",\n editType: \"arraydraw\"\n },\n xref: extendFlat({}, annAttrs.xref, {}),\n xsizemode: {\n valType: \"enumerated\",\n values: [\"scaled\", \"pixel\"],\n dflt: \"scaled\",\n editType: \"calc+arraydraw\"\n },\n xanchor: {\n valType: \"any\",\n editType: \"calc+arraydraw\"\n },\n x0: {\n valType: \"any\",\n editType: \"calc+arraydraw\"\n },\n x1: {\n valType: \"any\",\n editType: \"calc+arraydraw\"\n },\n x0shift: {\n valType: \"number\",\n dflt: 0,\n min: -1,\n max: 1,\n editType: \"calc\"\n },\n x1shift: {\n valType: \"number\",\n dflt: 0,\n min: -1,\n max: 1,\n editType: \"calc\"\n },\n yref: extendFlat({}, annAttrs.yref, {}),\n ysizemode: {\n valType: \"enumerated\",\n values: [\"scaled\", \"pixel\"],\n dflt: \"scaled\",\n editType: \"calc+arraydraw\"\n },\n yanchor: {\n valType: \"any\",\n editType: \"calc+arraydraw\"\n },\n y0: {\n valType: \"any\",\n editType: \"calc+arraydraw\"\n },\n y1: {\n valType: \"any\",\n editType: \"calc+arraydraw\"\n },\n y0shift: {\n valType: \"number\",\n dflt: 0,\n min: -1,\n max: 1,\n editType: \"calc\"\n },\n y1shift: {\n valType: \"number\",\n dflt: 0,\n min: -1,\n max: 1,\n editType: \"calc\"\n },\n path: {\n valType: \"string\",\n editType: \"calc+arraydraw\"\n },\n opacity: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 1,\n editType: \"arraydraw\"\n },\n line: {\n color: extendFlat({}, scatterLineAttrs.color, { editType: \"arraydraw\" }),\n width: extendFlat({}, scatterLineAttrs.width, { editType: \"calc+arraydraw\" }),\n dash: extendFlat({}, dash, { editType: \"arraydraw\" }),\n editType: \"calc+arraydraw\"\n },\n fillcolor: {\n valType: \"color\",\n dflt: \"rgba(0,0,0,0)\",\n editType: \"arraydraw\"\n },\n fillrule: {\n valType: \"enumerated\",\n values: [\"evenodd\", \"nonzero\"],\n dflt: \"evenodd\",\n editType: \"arraydraw\"\n },\n editable: {\n valType: \"boolean\",\n dflt: false,\n editType: \"calc+arraydraw\"\n },\n label: {\n text: {\n valType: \"string\",\n dflt: \"\",\n editType: \"arraydraw\"\n },\n texttemplate: shapeTexttemplateAttrs({}, { keys: Object.keys(shapeLabelTexttemplateVars) }),\n font: fontAttrs({\n editType: \"calc+arraydraw\",\n colorEditType: \"arraydraw\"\n }),\n textposition: {\n valType: \"enumerated\",\n values: [\n \"top left\",\n \"top center\",\n \"top right\",\n \"middle left\",\n \"middle center\",\n \"middle right\",\n \"bottom left\",\n \"bottom center\",\n \"bottom right\",\n \"start\",\n \"middle\",\n \"end\"\n ],\n editType: \"arraydraw\"\n },\n textangle: {\n valType: \"angle\",\n dflt: \"auto\",\n editType: \"calc+arraydraw\"\n },\n xanchor: {\n valType: \"enumerated\",\n values: [\"auto\", \"left\", \"center\", \"right\"],\n dflt: \"auto\",\n editType: \"calc+arraydraw\"\n },\n yanchor: {\n valType: \"enumerated\",\n values: [\"top\", \"middle\", \"bottom\"],\n editType: \"calc+arraydraw\"\n },\n padding: {\n valType: \"number\",\n dflt: 3,\n min: 0,\n editType: \"arraydraw\"\n },\n editType: \"arraydraw\"\n },\n editType: \"arraydraw\"\n });\n }\n });\n\n // src/components/shapes/defaults.js\n var require_defaults11 = __commonJS({\n \"src/components/shapes/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Axes = require_axes();\n var handleArrayContainerDefaults = require_array_container_defaults();\n var attributes = require_attributes16();\n var helpers = require_helpers8();\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {\n handleArrayContainerDefaults(layoutIn, layoutOut, {\n name: \"shapes\",\n handleItemDefaults: handleShapeDefaults\n });\n };\n function dfltLabelYanchor(isLine, labelTextPosition) {\n return isLine ? \"bottom\" : labelTextPosition.indexOf(\"top\") !== -1 ? \"top\" : labelTextPosition.indexOf(\"bottom\") !== -1 ? \"bottom\" : \"middle\";\n }\n function handleShapeDefaults(shapeIn, shapeOut, fullLayout) {\n function coerce(attr, dflt) {\n return Lib.coerce(shapeIn, shapeOut, attributes, attr, dflt);\n }\n shapeOut._isShape = true;\n var visible = coerce(\"visible\");\n if (!visible) return;\n var showlegend = coerce(\"showlegend\");\n if (showlegend) {\n coerce(\"legend\");\n coerce(\"legendwidth\");\n coerce(\"legendgroup\");\n coerce(\"legendgrouptitle.text\");\n Lib.coerceFont(coerce, \"legendgrouptitle.font\");\n coerce(\"legendrank\");\n }\n var path = coerce(\"path\");\n var dfltType = path ? \"path\" : \"rect\";\n var shapeType = coerce(\"type\", dfltType);\n var noPath = shapeType !== \"path\";\n if (noPath) delete shapeOut.path;\n coerce(\"editable\");\n coerce(\"layer\");\n coerce(\"opacity\");\n coerce(\"fillcolor\");\n coerce(\"fillrule\");\n var lineWidth = coerce(\"line.width\");\n if (lineWidth) {\n coerce(\"line.color\");\n coerce(\"line.dash\");\n }\n var xSizeMode = coerce(\"xsizemode\");\n var ySizeMode = coerce(\"ysizemode\");\n var axLetters = [\"x\", \"y\"];\n for (var i = 0; i < 2; i++) {\n var axLetter = axLetters[i];\n var attrAnchor = axLetter + \"anchor\";\n var sizeMode = axLetter === \"x\" ? xSizeMode : ySizeMode;\n var gdMock = { _fullLayout: fullLayout };\n var ax;\n var pos2r;\n var r2pos;\n var axRef = Axes.coerceRef(\n shapeIn,\n shapeOut,\n gdMock,\n axLetter,\n void 0,\n \"paper\"\n );\n var axRefType = Axes.getRefType(axRef);\n if (axRefType === \"range\") {\n ax = Axes.getFromId(gdMock, axRef);\n ax._shapeIndices.push(shapeOut._index);\n r2pos = helpers.rangeToShapePosition(ax);\n pos2r = helpers.shapePositionToRange(ax);\n if (ax.type === \"category\" || ax.type === \"multicategory\") {\n coerce(axLetter + \"0shift\");\n coerce(axLetter + \"1shift\");\n }\n } else {\n pos2r = r2pos = Lib.identity;\n }\n if (noPath) {\n var dflt0 = 0.25;\n var dflt1 = 0.75;\n var attr0 = axLetter + \"0\";\n var attr1 = axLetter + \"1\";\n var in0 = shapeIn[attr0];\n var in1 = shapeIn[attr1];\n shapeIn[attr0] = pos2r(shapeIn[attr0], true);\n shapeIn[attr1] = pos2r(shapeIn[attr1], true);\n if (sizeMode === \"pixel\") {\n coerce(attr0, 0);\n coerce(attr1, 10);\n } else {\n Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr0, dflt0);\n Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr1, dflt1);\n }\n shapeOut[attr0] = r2pos(shapeOut[attr0]);\n shapeOut[attr1] = r2pos(shapeOut[attr1]);\n shapeIn[attr0] = in0;\n shapeIn[attr1] = in1;\n }\n if (sizeMode === \"pixel\") {\n var inAnchor = shapeIn[attrAnchor];\n shapeIn[attrAnchor] = pos2r(shapeIn[attrAnchor], true);\n Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attrAnchor, 0.25);\n shapeOut[attrAnchor] = r2pos(shapeOut[attrAnchor]);\n shapeIn[attrAnchor] = inAnchor;\n }\n }\n if (noPath) {\n Lib.noneOrAll(shapeIn, shapeOut, [\"x0\", \"x1\", \"y0\", \"y1\"]);\n }\n var isLine = shapeType === \"line\";\n var labelTextTemplate, labelText;\n if (noPath) {\n labelTextTemplate = coerce(\"label.texttemplate\");\n }\n if (!labelTextTemplate) {\n labelText = coerce(\"label.text\");\n }\n if (labelText || labelTextTemplate) {\n coerce(\"label.textangle\");\n var labelTextPosition = coerce(\"label.textposition\", isLine ? \"middle\" : \"middle center\");\n coerce(\"label.xanchor\");\n coerce(\"label.yanchor\", dfltLabelYanchor(isLine, labelTextPosition));\n coerce(\"label.padding\");\n Lib.coerceFont(coerce, \"label.font\", fullLayout.font);\n }\n }\n }\n });\n\n // src/components/shapes/draw_newshape/defaults.js\n var require_defaults12 = __commonJS({\n \"src/components/shapes/draw_newshape/defaults.js\"(exports, module) {\n \"use strict\";\n var Color2 = require_color();\n var Lib = require_lib();\n function dfltLabelYanchor(isLine, labelTextPosition) {\n return isLine ? \"bottom\" : labelTextPosition.indexOf(\"top\") !== -1 ? \"top\" : labelTextPosition.indexOf(\"bottom\") !== -1 ? \"bottom\" : \"middle\";\n }\n module.exports = function supplyDrawNewShapeDefaults(layoutIn, layoutOut, coerce) {\n coerce(\"newshape.visible\");\n coerce(\"newshape.name\");\n coerce(\"newshape.showlegend\");\n coerce(\"newshape.legend\");\n coerce(\"newshape.legendwidth\");\n coerce(\"newshape.legendgroup\");\n coerce(\"newshape.legendgrouptitle.text\");\n Lib.coerceFont(coerce, \"newshape.legendgrouptitle.font\");\n coerce(\"newshape.legendrank\");\n coerce(\"newshape.drawdirection\");\n coerce(\"newshape.layer\");\n coerce(\"newshape.fillcolor\");\n coerce(\"newshape.fillrule\");\n coerce(\"newshape.opacity\");\n var newshapeLineWidth = coerce(\"newshape.line.width\");\n if (newshapeLineWidth) {\n var bgcolor = (layoutIn || {}).plot_bgcolor || \"#FFF\";\n coerce(\"newshape.line.color\", Color2.contrast(bgcolor));\n coerce(\"newshape.line.dash\");\n }\n var isLine = layoutIn.dragmode === \"drawline\";\n var labelText = coerce(\"newshape.label.text\");\n var labelTextTemplate = coerce(\"newshape.label.texttemplate\");\n if (labelText || labelTextTemplate) {\n coerce(\"newshape.label.textangle\");\n var labelTextPosition = coerce(\"newshape.label.textposition\", isLine ? \"middle\" : \"middle center\");\n coerce(\"newshape.label.xanchor\");\n coerce(\"newshape.label.yanchor\", dfltLabelYanchor(isLine, labelTextPosition));\n coerce(\"newshape.label.padding\");\n Lib.coerceFont(coerce, \"newshape.label.font\", layoutOut.font);\n }\n coerce(\"activeshape.fillcolor\");\n coerce(\"activeshape.opacity\");\n };\n }\n });\n\n // src/components/shapes/calc_autorange.js\n var require_calc_autorange2 = __commonJS({\n \"src/components/shapes/calc_autorange.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Axes = require_axes();\n var constants = require_constants5();\n var helpers = require_helpers8();\n module.exports = function calcAutorange(gd) {\n var fullLayout = gd._fullLayout;\n var shapeList = Lib.filterVisible(fullLayout.shapes);\n if (!shapeList.length || !gd._fullData.length) return;\n for (var i = 0; i < shapeList.length; i++) {\n var shape = shapeList[i];\n shape._extremes = {};\n var ax;\n var bounds;\n var xRefType = Axes.getRefType(shape.xref);\n var yRefType = Axes.getRefType(shape.yref);\n if (shape.xref !== \"paper\" && xRefType !== \"domain\") {\n ax = Axes.getFromId(gd, shape.xref);\n bounds = shapeBounds(ax, shape, constants.paramIsX);\n if (bounds) {\n shape._extremes[ax._id] = Axes.findExtremes(ax, bounds, calcXPaddingOptions(shape));\n }\n }\n if (shape.yref !== \"paper\" && yRefType !== \"domain\") {\n ax = Axes.getFromId(gd, shape.yref);\n bounds = shapeBounds(ax, shape, constants.paramIsY);\n if (bounds) {\n shape._extremes[ax._id] = Axes.findExtremes(ax, bounds, calcYPaddingOptions(shape));\n }\n }\n }\n };\n function calcXPaddingOptions(shape) {\n return calcPaddingOptions(shape.line.width, shape.xsizemode, shape.x0, shape.x1, shape.path, false);\n }\n function calcYPaddingOptions(shape) {\n return calcPaddingOptions(shape.line.width, shape.ysizemode, shape.y0, shape.y1, shape.path, true);\n }\n function calcPaddingOptions(lineWidth, sizeMode, v0, v1, path, isYAxis) {\n var ppad = lineWidth / 2;\n var axisDirectionReverted = isYAxis;\n if (sizeMode === \"pixel\") {\n var coords = path ? helpers.extractPathCoords(path, isYAxis ? constants.paramIsY : constants.paramIsX) : [v0, v1];\n var maxValue = Lib.aggNums(Math.max, null, coords);\n var minValue = Lib.aggNums(Math.min, null, coords);\n var beforePad = minValue < 0 ? Math.abs(minValue) + ppad : ppad;\n var afterPad = maxValue > 0 ? maxValue + ppad : ppad;\n return {\n ppad,\n ppadplus: axisDirectionReverted ? beforePad : afterPad,\n ppadminus: axisDirectionReverted ? afterPad : beforePad\n };\n } else {\n return { ppad };\n }\n }\n function shapeBounds(ax, shape, paramsToUse) {\n var dim = ax._id.charAt(0) === \"x\" ? \"x\" : \"y\";\n var isCategory = ax.type === \"category\" || ax.type === \"multicategory\";\n var v0;\n var v1;\n var shiftStart = 0;\n var shiftEnd = 0;\n var convertVal = isCategory ? ax.r2c : ax.d2c;\n var isSizeModeScale = shape[dim + \"sizemode\"] === \"scaled\";\n if (isSizeModeScale) {\n v0 = shape[dim + \"0\"];\n v1 = shape[dim + \"1\"];\n if (isCategory) {\n shiftStart = shape[dim + \"0shift\"];\n shiftEnd = shape[dim + \"1shift\"];\n }\n } else {\n v0 = shape[dim + \"anchor\"];\n v1 = shape[dim + \"anchor\"];\n }\n if (v0 !== void 0) return [convertVal(v0) + shiftStart, convertVal(v1) + shiftEnd];\n if (!shape.path) return;\n var min = Infinity;\n var max = -Infinity;\n var segments = shape.path.match(constants.segmentRE);\n var i;\n var segment;\n var drawnParam;\n var params;\n var val;\n if (ax.type === \"date\") convertVal = helpers.decodeDate(convertVal);\n for (i = 0; i < segments.length; i++) {\n segment = segments[i];\n drawnParam = paramsToUse[segment.charAt(0)].drawn;\n if (drawnParam === void 0) continue;\n params = segments[i].substr(1).match(constants.paramRE);\n if (!params || params.length < drawnParam) continue;\n val = convertVal(params[drawnParam]);\n if (val < min) min = val;\n if (val > max) max = val;\n }\n if (max >= min) return [min, max];\n }\n }\n });\n\n // src/components/shapes/index.js\n var require_shapes = __commonJS({\n \"src/components/shapes/index.js\"(exports, module) {\n \"use strict\";\n var drawModule = require_draw2();\n module.exports = {\n moduleType: \"component\",\n name: \"shapes\",\n layoutAttributes: require_attributes16(),\n supplyLayoutDefaults: require_defaults11(),\n supplyDrawNewShapeDefaults: require_defaults12(),\n includeBasePlot: require_include_components()(\"shapes\"),\n calcAutorange: require_calc_autorange2(),\n draw: drawModule.draw,\n drawOne: drawModule.drawOne\n };\n }\n });\n\n // src/components/images/attributes.js\n var require_attributes17 = __commonJS({\n \"src/components/images/attributes.js\"(exports, module) {\n \"use strict\";\n var cartesianConstants = require_constants2();\n var templatedArray = require_plot_template().templatedArray;\n var axisPlaceableObjs = require_axis_placeable_objects();\n module.exports = templatedArray(\"image\", {\n visible: {\n valType: \"boolean\",\n dflt: true,\n editType: \"arraydraw\"\n },\n source: {\n valType: \"string\",\n editType: \"arraydraw\"\n },\n layer: {\n valType: \"enumerated\",\n values: [\"below\", \"above\"],\n dflt: \"above\",\n editType: \"arraydraw\"\n },\n sizex: {\n valType: \"number\",\n dflt: 0,\n editType: \"arraydraw\"\n },\n sizey: {\n valType: \"number\",\n dflt: 0,\n editType: \"arraydraw\"\n },\n sizing: {\n valType: \"enumerated\",\n values: [\"fill\", \"contain\", \"stretch\"],\n dflt: \"contain\",\n editType: \"arraydraw\"\n },\n opacity: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 1,\n editType: \"arraydraw\"\n },\n x: {\n valType: \"any\",\n dflt: 0,\n editType: \"arraydraw\"\n },\n y: {\n valType: \"any\",\n dflt: 0,\n editType: \"arraydraw\"\n },\n xanchor: {\n valType: \"enumerated\",\n values: [\"left\", \"center\", \"right\"],\n dflt: \"left\",\n editType: \"arraydraw\"\n },\n yanchor: {\n valType: \"enumerated\",\n values: [\"top\", \"middle\", \"bottom\"],\n dflt: \"top\",\n editType: \"arraydraw\"\n },\n xref: {\n valType: \"enumerated\",\n values: [\n \"paper\",\n cartesianConstants.idRegex.x.toString()\n ],\n dflt: \"paper\",\n editType: \"arraydraw\"\n },\n yref: {\n valType: \"enumerated\",\n values: [\n \"paper\",\n cartesianConstants.idRegex.y.toString()\n ],\n dflt: \"paper\",\n editType: \"arraydraw\"\n },\n editType: \"arraydraw\"\n });\n }\n });\n\n // src/components/images/defaults.js\n var require_defaults13 = __commonJS({\n \"src/components/images/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Axes = require_axes();\n var handleArrayContainerDefaults = require_array_container_defaults();\n var attributes = require_attributes17();\n var name2 = \"images\";\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {\n var opts = {\n name: name2,\n handleItemDefaults: imageDefaults\n };\n handleArrayContainerDefaults(layoutIn, layoutOut, opts);\n };\n function imageDefaults(imageIn, imageOut, fullLayout) {\n function coerce(attr, dflt) {\n return Lib.coerce(imageIn, imageOut, attributes, attr, dflt);\n }\n var source = coerce(\"source\");\n var visible = coerce(\"visible\", !!source);\n if (!visible) return imageOut;\n coerce(\"layer\");\n coerce(\"xanchor\");\n coerce(\"yanchor\");\n coerce(\"sizex\");\n coerce(\"sizey\");\n coerce(\"sizing\");\n coerce(\"opacity\");\n var gdMock = { _fullLayout: fullLayout };\n var axLetters = [\"x\", \"y\"];\n for (var i = 0; i < 2; i++) {\n var axLetter = axLetters[i];\n var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, \"paper\", void 0);\n if (axRef !== \"paper\") {\n var ax = Axes.getFromId(gdMock, axRef);\n ax._imgIndices.push(imageOut._index);\n }\n Axes.coercePosition(imageOut, gdMock, coerce, axRef, axLetter, 0);\n }\n return imageOut;\n }\n }\n });\n\n // src/components/images/draw.js\n var require_draw6 = __commonJS({\n \"src/components/images/draw.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Drawing = require_drawing();\n var Axes = require_axes();\n var axisIds = require_axis_ids();\n var xmlnsNamespaces = require_xmlns_namespaces();\n module.exports = function draw(gd) {\n var fullLayout = gd._fullLayout;\n var imageDataAbove = [];\n var imageDataSubplot = {};\n var imageDataBelow = [];\n var subplot;\n var i;\n for (i = 0; i < fullLayout.images.length; i++) {\n var img = fullLayout.images[i];\n if (img.visible) {\n if (img.layer === \"below\" && img.xref !== \"paper\" && img.yref !== \"paper\") {\n subplot = axisIds.ref2id(img.xref) + axisIds.ref2id(img.yref);\n var plotinfo = fullLayout._plots[subplot];\n if (!plotinfo) {\n imageDataBelow.push(img);\n continue;\n }\n if (plotinfo.mainplot) {\n subplot = plotinfo.mainplot.id;\n }\n if (!imageDataSubplot[subplot]) {\n imageDataSubplot[subplot] = [];\n }\n imageDataSubplot[subplot].push(img);\n } else if (img.layer === \"above\") {\n imageDataAbove.push(img);\n } else {\n imageDataBelow.push(img);\n }\n }\n }\n var anchors = {\n x: {\n left: { sizing: \"xMin\", offset: 0 },\n center: { sizing: \"xMid\", offset: -1 / 2 },\n right: { sizing: \"xMax\", offset: -1 }\n },\n y: {\n top: { sizing: \"YMin\", offset: 0 },\n middle: { sizing: \"YMid\", offset: -1 / 2 },\n bottom: { sizing: \"YMax\", offset: -1 }\n }\n };\n function setImage(d) {\n var thisImage = d3.select(this);\n if (this._imgSrc === d.source) {\n return;\n }\n thisImage.attr(\"xmlns\", xmlnsNamespaces.svg);\n if (!gd._context.staticPlot || d.source && d.source.slice(0, 5) === \"data:\") {\n thisImage.attr(\"xlink:href\", d.source);\n this._imgSrc = d.source;\n } else {\n var imagePromise = new Promise(function(resolve) {\n var img2 = new Image();\n this.img = img2;\n img2.setAttribute(\"crossOrigin\", \"anonymous\");\n img2.onerror = errorHandler;\n img2.onload = function() {\n var canvas = document.createElement(\"canvas\");\n canvas.width = this.width;\n canvas.height = this.height;\n var ctx = canvas.getContext(\"2d\", { willReadFrequently: true });\n ctx.drawImage(this, 0, 0);\n var dataURL = canvas.toDataURL(\"image/png\");\n thisImage.attr(\"xlink:href\", dataURL);\n resolve();\n };\n thisImage.on(\"error\", errorHandler);\n img2.src = d.source;\n this._imgSrc = d.source;\n function errorHandler() {\n thisImage.remove();\n resolve();\n }\n }.bind(this));\n gd._promises.push(imagePromise);\n }\n }\n function applyAttributes(d) {\n var thisImage = d3.select(this);\n var xa = Axes.getFromId(gd, d.xref);\n var ya = Axes.getFromId(gd, d.yref);\n var xIsDomain = Axes.getRefType(d.xref) === \"domain\";\n var yIsDomain = Axes.getRefType(d.yref) === \"domain\";\n var size = fullLayout._size;\n var width, height;\n if (xa !== void 0) {\n width = typeof d.xref === \"string\" && xIsDomain ? xa._length * d.sizex : Math.abs(xa.l2p(d.sizex) - xa.l2p(0));\n } else {\n width = d.sizex * size.w;\n }\n if (ya !== void 0) {\n height = typeof d.yref === \"string\" && yIsDomain ? ya._length * d.sizey : Math.abs(ya.l2p(d.sizey) - ya.l2p(0));\n } else {\n height = d.sizey * size.h;\n }\n var xOffset = width * anchors.x[d.xanchor].offset;\n var yOffset = height * anchors.y[d.yanchor].offset;\n var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing;\n var xPos, yPos;\n if (xa !== void 0) {\n xPos = typeof d.xref === \"string\" && xIsDomain ? xa._length * d.x + xa._offset : xa.r2p(d.x) + xa._offset;\n } else {\n xPos = d.x * size.w + size.l;\n }\n xPos += xOffset;\n if (ya !== void 0) {\n yPos = typeof d.yref === \"string\" && yIsDomain ? (\n // consistent with \"paper\" yref value, where positive values\n // move up the page\n ya._length * (1 - d.y) + ya._offset\n ) : ya.r2p(d.y) + ya._offset;\n } else {\n yPos = size.h - d.y * size.h + size.t;\n }\n yPos += yOffset;\n switch (d.sizing) {\n case \"fill\":\n sizing += \" slice\";\n break;\n case \"stretch\":\n sizing = \"none\";\n break;\n }\n thisImage.attr({\n x: xPos,\n y: yPos,\n width,\n height,\n preserveAspectRatio: sizing,\n opacity: d.opacity\n });\n var xId = xa && Axes.getRefType(d.xref) !== \"domain\" ? xa._id : \"\";\n var yId = ya && Axes.getRefType(d.yref) !== \"domain\" ? ya._id : \"\";\n var clipAxes = xId + yId;\n Drawing.setClipUrl(\n thisImage,\n clipAxes ? \"clip\" + fullLayout._uid + clipAxes : null,\n gd\n );\n }\n function imgDataFunc(d) {\n return [d.xref, d.x, d.sizex, d.yref, d.y, d.sizey].join(\"_\");\n }\n function imgSort(a, b) {\n return a._index - b._index;\n }\n var imagesBelow = fullLayout._imageLowerLayer.selectAll(\"image\").data(imageDataBelow, imgDataFunc);\n var imagesAbove = fullLayout._imageUpperLayer.selectAll(\"image\").data(imageDataAbove, imgDataFunc);\n imagesBelow.enter().append(\"image\");\n imagesAbove.enter().append(\"image\");\n imagesBelow.exit().remove();\n imagesAbove.exit().remove();\n imagesBelow.each(function(d) {\n setImage.bind(this)(d);\n applyAttributes.bind(this)(d);\n });\n imagesAbove.each(function(d) {\n setImage.bind(this)(d);\n applyAttributes.bind(this)(d);\n });\n imagesBelow.sort(imgSort);\n imagesAbove.sort(imgSort);\n var allSubplots = Object.keys(fullLayout._plots);\n for (i = 0; i < allSubplots.length; i++) {\n subplot = allSubplots[i];\n var subplotObj = fullLayout._plots[subplot];\n if (!subplotObj.imagelayer) continue;\n var imagesOnSubplot = subplotObj.imagelayer.selectAll(\"image\").data(imageDataSubplot[subplot] || [], imgDataFunc);\n imagesOnSubplot.enter().append(\"image\");\n imagesOnSubplot.exit().remove();\n imagesOnSubplot.each(function(d) {\n setImage.bind(this)(d);\n applyAttributes.bind(this)(d);\n });\n imagesOnSubplot.sort(imgSort);\n }\n };\n }\n });\n\n // src/components/images/convert_coords.js\n var require_convert_coords2 = __commonJS({\n \"src/components/images/convert_coords.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var toLogRange = require_to_log_range();\n module.exports = function convertCoords(gd, ax, newType, doExtra) {\n ax = ax || {};\n var toLog = newType === \"log\" && ax.type === \"linear\";\n var fromLog = newType === \"linear\" && ax.type === \"log\";\n if (!(toLog || fromLog)) return;\n var images = gd._fullLayout.images;\n var axLetter = ax._id.charAt(0);\n var image;\n var attrPrefix;\n for (var i = 0; i < images.length; i++) {\n image = images[i];\n attrPrefix = \"images[\" + i + \"].\";\n if (image[axLetter + \"ref\"] === ax._id) {\n var currentPos = image[axLetter];\n var currentSize = image[\"size\" + axLetter];\n var newPos = null;\n var newSize = null;\n if (toLog) {\n newPos = toLogRange(currentPos, ax.range);\n var dx = currentSize / Math.pow(10, newPos) / 2;\n newSize = 2 * Math.log(dx + Math.sqrt(1 + dx * dx)) / Math.LN10;\n } else {\n newPos = Math.pow(10, currentPos);\n newSize = newPos * (Math.pow(10, currentSize / 2) - Math.pow(10, -currentSize / 2));\n }\n if (!isNumeric(newPos)) {\n newPos = null;\n newSize = null;\n } else if (!isNumeric(newSize)) newSize = null;\n doExtra(attrPrefix + axLetter, newPos);\n doExtra(attrPrefix + \"size\" + axLetter, newSize);\n }\n }\n };\n }\n });\n\n // src/components/images/index.js\n var require_images = __commonJS({\n \"src/components/images/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"component\",\n name: \"images\",\n layoutAttributes: require_attributes17(),\n supplyLayoutDefaults: require_defaults13(),\n includeBasePlot: require_include_components()(\"images\"),\n draw: require_draw6(),\n convertCoords: require_convert_coords2()\n };\n }\n });\n\n // src/components/updatemenus/constants.js\n var require_constants9 = __commonJS({\n \"src/components/updatemenus/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n // layout attribute name\n name: \"updatemenus\",\n // class names\n containerClassName: \"updatemenu-container\",\n headerGroupClassName: \"updatemenu-header-group\",\n headerClassName: \"updatemenu-header\",\n headerArrowClassName: \"updatemenu-header-arrow\",\n dropdownButtonGroupClassName: \"updatemenu-dropdown-button-group\",\n dropdownButtonClassName: \"updatemenu-dropdown-button\",\n buttonClassName: \"updatemenu-button\",\n itemRectClassName: \"updatemenu-item-rect\",\n itemTextClassName: \"updatemenu-item-text\",\n // DOM attribute name in button group keeping track\n // of active update menu\n menuIndexAttrName: \"updatemenu-active-index\",\n // id root pass to Plots.autoMargin\n autoMarginIdRoot: \"updatemenu-\",\n // options when 'active: -1'\n blankHeaderOpts: { label: \" \" },\n // min item width / height\n minWidth: 30,\n minHeight: 30,\n // padding around item text\n textPadX: 24,\n arrowPadX: 16,\n // item rect radii\n rx: 2,\n ry: 2,\n // item text x offset off left edge\n textOffsetX: 12,\n // item text y offset (w.r.t. middle)\n textOffsetY: 3,\n // arrow offset off right edge\n arrowOffsetX: 4,\n // gap between header and buttons\n gapButtonHeader: 5,\n // gap between between buttons\n gapButton: 2,\n // color given to active buttons\n activeColor: \"#F4FAFF\",\n // color given to hovered buttons\n hoverColor: \"#F4FAFF\",\n // symbol for menu open arrow\n arrowSymbol: {\n left: \"\\u25C4\",\n right: \"\\u25BA\",\n up: \"\\u25B2\",\n down: \"\\u25BC\"\n }\n };\n }\n });\n\n // src/components/updatemenus/attributes.js\n var require_attributes18 = __commonJS({\n \"src/components/updatemenus/attributes.js\"(exports, module) {\n \"use strict\";\n var fontAttrs = require_font_attributes();\n var colorAttrs = require_attributes3();\n var extendFlat = require_extend().extendFlat;\n var overrideAll = require_edit_types().overrideAll;\n var padAttrs = require_pad_attributes();\n var templatedArray = require_plot_template().templatedArray;\n var buttonsAttrs = templatedArray(\"button\", {\n visible: {\n valType: \"boolean\"\n },\n method: {\n valType: \"enumerated\",\n values: [\"restyle\", \"relayout\", \"animate\", \"update\", \"skip\"],\n dflt: \"restyle\"\n },\n args: {\n valType: \"info_array\",\n freeLength: true,\n items: [\n { valType: \"any\" },\n { valType: \"any\" },\n { valType: \"any\" }\n ]\n },\n args2: {\n valType: \"info_array\",\n freeLength: true,\n items: [\n { valType: \"any\" },\n { valType: \"any\" },\n { valType: \"any\" }\n ]\n },\n label: {\n valType: \"string\",\n dflt: \"\"\n },\n execute: {\n valType: \"boolean\",\n dflt: true\n }\n });\n module.exports = overrideAll(templatedArray(\"updatemenu\", {\n _arrayAttrRegexps: [/^updatemenus\\[(0|[1-9][0-9]+)\\]\\.buttons/],\n visible: {\n valType: \"boolean\"\n },\n type: {\n valType: \"enumerated\",\n values: [\"dropdown\", \"buttons\"],\n dflt: \"dropdown\"\n },\n direction: {\n valType: \"enumerated\",\n values: [\"left\", \"right\", \"up\", \"down\"],\n dflt: \"down\"\n },\n active: {\n valType: \"integer\",\n min: -1,\n dflt: 0\n },\n showactive: {\n valType: \"boolean\",\n dflt: true\n },\n buttons: buttonsAttrs,\n x: {\n valType: \"number\",\n min: -2,\n max: 3,\n dflt: -0.05\n },\n xanchor: {\n valType: \"enumerated\",\n values: [\"auto\", \"left\", \"center\", \"right\"],\n dflt: \"right\"\n },\n y: {\n valType: \"number\",\n min: -2,\n max: 3,\n dflt: 1\n },\n yanchor: {\n valType: \"enumerated\",\n values: [\"auto\", \"top\", \"middle\", \"bottom\"],\n dflt: \"top\"\n },\n pad: extendFlat(padAttrs({ editType: \"arraydraw\" }), {}),\n font: fontAttrs({}),\n bgcolor: {\n valType: \"color\"\n },\n bordercolor: {\n valType: \"color\",\n dflt: colorAttrs.borderLine\n },\n borderwidth: {\n valType: \"number\",\n min: 0,\n dflt: 1,\n editType: \"arraydraw\"\n }\n }), \"arraydraw\", \"from-root\");\n }\n });\n\n // src/components/updatemenus/defaults.js\n var require_defaults14 = __commonJS({\n \"src/components/updatemenus/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleArrayContainerDefaults = require_array_container_defaults();\n var attributes = require_attributes18();\n var constants = require_constants9();\n var name2 = constants.name;\n var buttonAttrs = attributes.buttons;\n module.exports = function updateMenusDefaults(layoutIn, layoutOut) {\n var opts = {\n name: name2,\n handleItemDefaults: menuDefaults\n };\n handleArrayContainerDefaults(layoutIn, layoutOut, opts);\n };\n function menuDefaults(menuIn, menuOut, layoutOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(menuIn, menuOut, attributes, attr, dflt);\n }\n var buttons = handleArrayContainerDefaults(menuIn, menuOut, {\n name: \"buttons\",\n handleItemDefaults: buttonDefaults\n });\n var visible = coerce(\"visible\", buttons.length > 0);\n if (!visible) return;\n coerce(\"active\");\n coerce(\"direction\");\n coerce(\"type\");\n coerce(\"showactive\");\n coerce(\"x\");\n coerce(\"y\");\n Lib.noneOrAll(menuIn, menuOut, [\"x\", \"y\"]);\n coerce(\"xanchor\");\n coerce(\"yanchor\");\n coerce(\"pad.t\");\n coerce(\"pad.r\");\n coerce(\"pad.b\");\n coerce(\"pad.l\");\n Lib.coerceFont(coerce, \"font\", layoutOut.font);\n coerce(\"bgcolor\", layoutOut.paper_bgcolor);\n coerce(\"bordercolor\");\n coerce(\"borderwidth\");\n }\n function buttonDefaults(buttonIn, buttonOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(buttonIn, buttonOut, buttonAttrs, attr, dflt);\n }\n var visible = coerce(\n \"visible\",\n buttonIn.method === \"skip\" || Array.isArray(buttonIn.args)\n );\n if (visible) {\n coerce(\"method\");\n coerce(\"args\");\n coerce(\"args2\");\n coerce(\"label\");\n coerce(\"execute\");\n }\n }\n }\n });\n\n // src/components/updatemenus/scrollbox.js\n var require_scrollbox = __commonJS({\n \"src/components/updatemenus/scrollbox.js\"(exports, module) {\n \"use strict\";\n module.exports = ScrollBox;\n var d3 = require_d3();\n var Color2 = require_color();\n var Drawing = require_drawing();\n var Lib = require_lib();\n function ScrollBox(gd, container, id) {\n this.gd = gd;\n this.container = container;\n this.id = id;\n this.position = null;\n this.translateX = null;\n this.translateY = null;\n this.hbar = null;\n this.vbar = null;\n this.bg = this.container.selectAll(\"rect.scrollbox-bg\").data([0]);\n this.bg.exit().on(\".drag\", null).on(\"wheel\", null).remove();\n this.bg.enter().append(\"rect\").classed(\"scrollbox-bg\", true).style(\"pointer-events\", \"all\").attr({\n opacity: 0,\n x: 0,\n y: 0,\n width: 0,\n height: 0\n });\n }\n ScrollBox.barWidth = 2;\n ScrollBox.barLength = 20;\n ScrollBox.barRadius = 2;\n ScrollBox.barPad = 1;\n ScrollBox.barColor = \"#808BA4\";\n ScrollBox.prototype.enable = function enable(position, translateX, translateY) {\n var fullLayout = this.gd._fullLayout;\n var fullWidth = fullLayout.width;\n var fullHeight = fullLayout.height;\n this.position = position;\n var l = this.position.l;\n var w = this.position.w;\n var t = this.position.t;\n var h = this.position.h;\n var direction = this.position.direction;\n var isDown = direction === \"down\";\n var isLeft = direction === \"left\";\n var isRight = direction === \"right\";\n var isUp = direction === \"up\";\n var boxW = w;\n var boxH = h;\n var boxL, boxR;\n var boxT, boxB;\n if (!isDown && !isLeft && !isRight && !isUp) {\n this.position.direction = \"down\";\n isDown = true;\n }\n var isVertical = isDown || isUp;\n if (isVertical) {\n boxL = l;\n boxR = boxL + boxW;\n if (isDown) {\n boxT = t;\n boxB = Math.min(boxT + boxH, fullHeight);\n boxH = boxB - boxT;\n } else {\n boxB = t + boxH;\n boxT = Math.max(boxB - boxH, 0);\n boxH = boxB - boxT;\n }\n } else {\n boxT = t;\n boxB = boxT + boxH;\n if (isLeft) {\n boxR = l + boxW;\n boxL = Math.max(boxR - boxW, 0);\n boxW = boxR - boxL;\n } else {\n boxL = l;\n boxR = Math.min(boxL + boxW, fullWidth);\n boxW = boxR - boxL;\n }\n }\n this._box = {\n l: boxL,\n t: boxT,\n w: boxW,\n h: boxH\n };\n var needsHorizontalScrollBar = w > boxW;\n var hbarW = ScrollBox.barLength + 2 * ScrollBox.barPad;\n var hbarH = ScrollBox.barWidth + 2 * ScrollBox.barPad;\n var hbarL = l;\n var hbarT = t + h;\n if (hbarT + hbarH > fullHeight) hbarT = fullHeight - hbarH;\n var hbar = this.container.selectAll(\"rect.scrollbar-horizontal\").data(\n needsHorizontalScrollBar ? [0] : []\n );\n hbar.exit().on(\".drag\", null).remove();\n hbar.enter().append(\"rect\").classed(\"scrollbar-horizontal\", true).call(Color2.fill, ScrollBox.barColor);\n if (needsHorizontalScrollBar) {\n this.hbar = hbar.attr({\n rx: ScrollBox.barRadius,\n ry: ScrollBox.barRadius,\n x: hbarL,\n y: hbarT,\n width: hbarW,\n height: hbarH\n });\n this._hbarXMin = hbarL + hbarW / 2;\n this._hbarTranslateMax = boxW - hbarW;\n } else {\n delete this.hbar;\n delete this._hbarXMin;\n delete this._hbarTranslateMax;\n }\n var needsVerticalScrollBar = h > boxH;\n var vbarW = ScrollBox.barWidth + 2 * ScrollBox.barPad;\n var vbarH = ScrollBox.barLength + 2 * ScrollBox.barPad;\n var vbarL = l + w;\n var vbarT = t;\n if (vbarL + vbarW > fullWidth) vbarL = fullWidth - vbarW;\n var vbar = this.container.selectAll(\"rect.scrollbar-vertical\").data(\n needsVerticalScrollBar ? [0] : []\n );\n vbar.exit().on(\".drag\", null).remove();\n vbar.enter().append(\"rect\").classed(\"scrollbar-vertical\", true).call(Color2.fill, ScrollBox.barColor);\n if (needsVerticalScrollBar) {\n this.vbar = vbar.attr({\n rx: ScrollBox.barRadius,\n ry: ScrollBox.barRadius,\n x: vbarL,\n y: vbarT,\n width: vbarW,\n height: vbarH\n });\n this._vbarYMin = vbarT + vbarH / 2;\n this._vbarTranslateMax = boxH - vbarH;\n } else {\n delete this.vbar;\n delete this._vbarYMin;\n delete this._vbarTranslateMax;\n }\n var clipId = this.id;\n var clipL = boxL - 0.5;\n var clipR = needsVerticalScrollBar ? boxR + vbarW + 0.5 : boxR + 0.5;\n var clipT = boxT - 0.5;\n var clipB = needsHorizontalScrollBar ? boxB + hbarH + 0.5 : boxB + 0.5;\n var clipPath = fullLayout._topdefs.selectAll(\"#\" + clipId).data(needsHorizontalScrollBar || needsVerticalScrollBar ? [0] : []);\n clipPath.exit().remove();\n clipPath.enter().append(\"clipPath\").attr(\"id\", clipId).append(\"rect\");\n if (needsHorizontalScrollBar || needsVerticalScrollBar) {\n this._clipRect = clipPath.select(\"rect\").attr({\n x: Math.floor(clipL),\n y: Math.floor(clipT),\n width: Math.ceil(clipR) - Math.floor(clipL),\n height: Math.ceil(clipB) - Math.floor(clipT)\n });\n this.container.call(Drawing.setClipUrl, clipId, this.gd);\n this.bg.attr({\n x: l,\n y: t,\n width: w,\n height: h\n });\n } else {\n this.bg.attr({\n width: 0,\n height: 0\n });\n this.container.on(\"wheel\", null).on(\".drag\", null).call(Drawing.setClipUrl, null);\n delete this._clipRect;\n }\n if (needsHorizontalScrollBar || needsVerticalScrollBar) {\n var onBoxDrag = d3.behavior.drag().on(\"dragstart\", function() {\n d3.event.sourceEvent.preventDefault();\n }).on(\"drag\", this._onBoxDrag.bind(this));\n this.container.on(\"wheel\", null).on(\"wheel\", this._onBoxWheel.bind(this)).on(\".drag\", null).call(onBoxDrag);\n var onBarDrag = d3.behavior.drag().on(\"dragstart\", function() {\n d3.event.sourceEvent.preventDefault();\n d3.event.sourceEvent.stopPropagation();\n }).on(\"drag\", this._onBarDrag.bind(this));\n if (needsHorizontalScrollBar) {\n this.hbar.on(\".drag\", null).call(onBarDrag);\n }\n if (needsVerticalScrollBar) {\n this.vbar.on(\".drag\", null).call(onBarDrag);\n }\n }\n this.setTranslate(translateX, translateY);\n };\n ScrollBox.prototype.disable = function disable() {\n if (this.hbar || this.vbar) {\n this.bg.attr({\n width: 0,\n height: 0\n });\n this.container.on(\"wheel\", null).on(\".drag\", null).call(Drawing.setClipUrl, null);\n delete this._clipRect;\n }\n if (this.hbar) {\n this.hbar.on(\".drag\", null);\n this.hbar.remove();\n delete this.hbar;\n delete this._hbarXMin;\n delete this._hbarTranslateMax;\n }\n if (this.vbar) {\n this.vbar.on(\".drag\", null);\n this.vbar.remove();\n delete this.vbar;\n delete this._vbarYMin;\n delete this._vbarTranslateMax;\n }\n };\n ScrollBox.prototype._onBoxDrag = function _onBoxDrag() {\n var translateX = this.translateX;\n var translateY = this.translateY;\n if (this.hbar) {\n translateX -= d3.event.dx;\n }\n if (this.vbar) {\n translateY -= d3.event.dy;\n }\n this.setTranslate(translateX, translateY);\n };\n ScrollBox.prototype._onBoxWheel = function _onBoxWheel() {\n var translateX = this.translateX;\n var translateY = this.translateY;\n if (this.hbar) {\n translateX += d3.event.deltaY;\n }\n if (this.vbar) {\n translateY += d3.event.deltaY;\n }\n this.setTranslate(translateX, translateY);\n };\n ScrollBox.prototype._onBarDrag = function _onBarDrag() {\n var translateX = this.translateX;\n var translateY = this.translateY;\n if (this.hbar) {\n var xMin = translateX + this._hbarXMin;\n var xMax = xMin + this._hbarTranslateMax;\n var x = Lib.constrain(d3.event.x, xMin, xMax);\n var xf = (x - xMin) / (xMax - xMin);\n var translateXMax = this.position.w - this._box.w;\n translateX = xf * translateXMax;\n }\n if (this.vbar) {\n var yMin = translateY + this._vbarYMin;\n var yMax = yMin + this._vbarTranslateMax;\n var y = Lib.constrain(d3.event.y, yMin, yMax);\n var yf = (y - yMin) / (yMax - yMin);\n var translateYMax = this.position.h - this._box.h;\n translateY = yf * translateYMax;\n }\n this.setTranslate(translateX, translateY);\n };\n ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) {\n var translateXMax = this.position.w - this._box.w;\n var translateYMax = this.position.h - this._box.h;\n translateX = Lib.constrain(translateX || 0, 0, translateXMax);\n translateY = Lib.constrain(translateY || 0, 0, translateYMax);\n this.translateX = translateX;\n this.translateY = translateY;\n this.container.call(\n Drawing.setTranslate,\n this._box.l - this.position.l - translateX,\n this._box.t - this.position.t - translateY\n );\n if (this._clipRect) {\n this._clipRect.attr({\n x: Math.floor(this.position.l + translateX - 0.5),\n y: Math.floor(this.position.t + translateY - 0.5)\n });\n }\n if (this.hbar) {\n var xf = translateX / translateXMax;\n this.hbar.call(\n Drawing.setTranslate,\n translateX + xf * this._hbarTranslateMax,\n translateY\n );\n }\n if (this.vbar) {\n var yf = translateY / translateYMax;\n this.vbar.call(\n Drawing.setTranslate,\n translateX,\n translateY + yf * this._vbarTranslateMax\n );\n }\n };\n }\n });\n\n // src/components/updatemenus/draw.js\n var require_draw7 = __commonJS({\n \"src/components/updatemenus/draw.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Plots = require_plots();\n var Color2 = require_color();\n var Drawing = require_drawing();\n var Lib = require_lib();\n var svgTextUtils = require_svg_text_utils();\n var arrayEditor = require_plot_template().arrayEditor;\n var LINE_SPACING = require_alignment().LINE_SPACING;\n var constants = require_constants9();\n var ScrollBox = require_scrollbox();\n module.exports = function draw(gd) {\n var fullLayout = gd._fullLayout;\n var menuData = Lib.filterVisible(fullLayout[constants.name]);\n function clearAutoMargin(menuOpts2) {\n Plots.autoMargin(gd, autoMarginId(menuOpts2));\n }\n var menus = fullLayout._menulayer.selectAll(\"g.\" + constants.containerClassName).data(menuData.length > 0 ? [0] : []);\n menus.enter().append(\"g\").classed(constants.containerClassName, true).style(\"cursor\", \"pointer\");\n menus.exit().each(function() {\n d3.select(this).selectAll(\"g.\" + constants.headerGroupClassName).each(clearAutoMargin);\n }).remove();\n if (menuData.length === 0) return;\n var headerGroups = menus.selectAll(\"g.\" + constants.headerGroupClassName).data(menuData, keyFunction);\n headerGroups.enter().append(\"g\").classed(constants.headerGroupClassName, true);\n var gButton = Lib.ensureSingle(menus, \"g\", constants.dropdownButtonGroupClassName, function(s) {\n s.style(\"pointer-events\", \"all\");\n });\n for (var i = 0; i < menuData.length; i++) {\n var menuOpts = menuData[i];\n findDimensions(gd, menuOpts);\n }\n var scrollBoxId = \"updatemenus\" + fullLayout._uid;\n var scrollBox = new ScrollBox(gd, gButton, scrollBoxId);\n if (headerGroups.enter().size()) {\n gButton.node().parentNode.appendChild(gButton.node());\n gButton.call(removeAllButtons);\n }\n headerGroups.exit().each(function(menuOpts2) {\n gButton.call(removeAllButtons);\n clearAutoMargin(menuOpts2);\n }).remove();\n headerGroups.each(function(menuOpts2) {\n var gHeader = d3.select(this);\n var _gButton = menuOpts2.type === \"dropdown\" ? gButton : null;\n Plots.manageCommandObserver(gd, menuOpts2, menuOpts2.buttons, function(data) {\n setActive(gd, menuOpts2, menuOpts2.buttons[data.index], gHeader, _gButton, scrollBox, data.index, true);\n });\n if (menuOpts2.type === \"dropdown\") {\n drawHeader(gd, gHeader, gButton, scrollBox, menuOpts2);\n if (isActive(gButton, menuOpts2)) {\n drawButtons(gd, gHeader, gButton, scrollBox, menuOpts2);\n }\n } else {\n drawButtons(gd, gHeader, null, null, menuOpts2);\n }\n });\n };\n function keyFunction(menuOpts) {\n return menuOpts._index;\n }\n function isFolded(gButton) {\n return +gButton.attr(constants.menuIndexAttrName) === -1;\n }\n function isActive(gButton, menuOpts) {\n return +gButton.attr(constants.menuIndexAttrName) === menuOpts._index;\n }\n function setActive(gd, menuOpts, buttonOpts, gHeader, gButton, scrollBox, buttonIndex, isSilentUpdate) {\n menuOpts.active = buttonIndex;\n arrayEditor(gd.layout, constants.name, menuOpts).applyUpdate(\"active\", buttonIndex);\n if (menuOpts.type === \"buttons\") {\n drawButtons(gd, gHeader, null, null, menuOpts);\n } else if (menuOpts.type === \"dropdown\") {\n gButton.attr(constants.menuIndexAttrName, \"-1\");\n drawHeader(gd, gHeader, gButton, scrollBox, menuOpts);\n if (!isSilentUpdate) {\n drawButtons(gd, gHeader, gButton, scrollBox, menuOpts);\n }\n }\n }\n function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) {\n var header = Lib.ensureSingle(gHeader, \"g\", constants.headerClassName, function(s) {\n s.style(\"pointer-events\", \"all\");\n });\n var dims = menuOpts._dims;\n var active = menuOpts.active;\n var headerOpts = menuOpts.buttons[active] || constants.blankHeaderOpts;\n var posOpts = { y: menuOpts.pad.t, yPad: 0, x: menuOpts.pad.l, xPad: 0, index: 0 };\n var positionOverrides = {\n width: dims.headerWidth,\n height: dims.headerHeight\n };\n header.call(drawItem, menuOpts, headerOpts, gd).call(setItemPosition, menuOpts, posOpts, positionOverrides);\n var arrow = Lib.ensureSingle(gHeader, \"text\", constants.headerArrowClassName, function(s) {\n s.attr(\"text-anchor\", \"end\").call(Drawing.font, menuOpts.font).text(constants.arrowSymbol[menuOpts.direction]);\n });\n arrow.attr({\n x: dims.headerWidth - constants.arrowOffsetX + menuOpts.pad.l,\n y: dims.headerHeight / 2 + constants.textOffsetY + menuOpts.pad.t\n });\n header.on(\"click\", function() {\n gButton.call(\n removeAllButtons,\n String(isActive(gButton, menuOpts) ? -1 : menuOpts._index)\n );\n drawButtons(gd, gHeader, gButton, scrollBox, menuOpts);\n });\n header.on(\"mouseover\", function() {\n header.call(styleOnMouseOver);\n });\n header.on(\"mouseout\", function() {\n header.call(styleOnMouseOut, menuOpts);\n });\n Drawing.setTranslate(gHeader, dims.lx, dims.ly);\n }\n function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) {\n if (!gButton) {\n gButton = gHeader;\n gButton.attr(\"pointer-events\", \"all\");\n }\n var buttonData = !isFolded(gButton) || menuOpts.type === \"buttons\" ? menuOpts.buttons : [];\n var klass = menuOpts.type === \"dropdown\" ? constants.dropdownButtonClassName : constants.buttonClassName;\n var buttons = gButton.selectAll(\"g.\" + klass).data(Lib.filterVisible(buttonData));\n var enter = buttons.enter().append(\"g\").classed(klass, true);\n var exit = buttons.exit();\n if (menuOpts.type === \"dropdown\") {\n enter.attr(\"opacity\", \"0\").transition().attr(\"opacity\", \"1\");\n exit.transition().attr(\"opacity\", \"0\").remove();\n } else {\n exit.remove();\n }\n var x0 = 0;\n var y0 = 0;\n var dims = menuOpts._dims;\n var isVertical = [\"up\", \"down\"].indexOf(menuOpts.direction) !== -1;\n if (menuOpts.type === \"dropdown\") {\n if (isVertical) {\n y0 = dims.headerHeight + constants.gapButtonHeader;\n } else {\n x0 = dims.headerWidth + constants.gapButtonHeader;\n }\n }\n if (menuOpts.type === \"dropdown\" && menuOpts.direction === \"up\") {\n y0 = -constants.gapButtonHeader + constants.gapButton - dims.openHeight;\n }\n if (menuOpts.type === \"dropdown\" && menuOpts.direction === \"left\") {\n x0 = -constants.gapButtonHeader + constants.gapButton - dims.openWidth;\n }\n var posOpts = {\n x: dims.lx + x0 + menuOpts.pad.l,\n y: dims.ly + y0 + menuOpts.pad.t,\n yPad: constants.gapButton,\n xPad: constants.gapButton,\n index: 0\n };\n var scrollBoxPosition = {\n l: posOpts.x + menuOpts.borderwidth,\n t: posOpts.y + menuOpts.borderwidth\n };\n buttons.each(function(buttonOpts, buttonIndex) {\n var button = d3.select(this);\n button.call(drawItem, menuOpts, buttonOpts, gd).call(setItemPosition, menuOpts, posOpts);\n button.on(\"click\", function() {\n if (d3.event.defaultPrevented) return;\n if (buttonOpts.execute) {\n if (buttonOpts.args2 && menuOpts.active === buttonIndex) {\n setActive(gd, menuOpts, buttonOpts, gHeader, gButton, scrollBox, -1);\n Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args2);\n } else {\n setActive(gd, menuOpts, buttonOpts, gHeader, gButton, scrollBox, buttonIndex);\n Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args);\n }\n }\n gd.emit(\"plotly_buttonclicked\", { menu: menuOpts, button: buttonOpts, active: menuOpts.active });\n });\n button.on(\"mouseover\", function() {\n button.call(styleOnMouseOver);\n });\n button.on(\"mouseout\", function() {\n button.call(styleOnMouseOut, menuOpts);\n buttons.call(styleButtons, menuOpts);\n });\n });\n buttons.call(styleButtons, menuOpts);\n if (isVertical) {\n scrollBoxPosition.w = Math.max(dims.openWidth, dims.headerWidth);\n scrollBoxPosition.h = posOpts.y - scrollBoxPosition.t;\n } else {\n scrollBoxPosition.w = posOpts.x - scrollBoxPosition.l;\n scrollBoxPosition.h = Math.max(dims.openHeight, dims.headerHeight);\n }\n scrollBoxPosition.direction = menuOpts.direction;\n if (scrollBox) {\n if (buttons.size()) {\n drawScrollBox(gd, gHeader, gButton, scrollBox, menuOpts, scrollBoxPosition);\n } else {\n hideScrollBox(scrollBox);\n }\n }\n }\n function drawScrollBox(gd, gHeader, gButton, scrollBox, menuOpts, position) {\n var direction = menuOpts.direction;\n var isVertical = direction === \"up\" || direction === \"down\";\n var dims = menuOpts._dims;\n var active = menuOpts.active;\n var translateX, translateY;\n var i;\n if (isVertical) {\n translateY = 0;\n for (i = 0; i < active; i++) {\n translateY += dims.heights[i] + constants.gapButton;\n }\n } else {\n translateX = 0;\n for (i = 0; i < active; i++) {\n translateX += dims.widths[i] + constants.gapButton;\n }\n }\n scrollBox.enable(position, translateX, translateY);\n if (scrollBox.hbar) {\n scrollBox.hbar.attr(\"opacity\", \"0\").transition().attr(\"opacity\", \"1\");\n }\n if (scrollBox.vbar) {\n scrollBox.vbar.attr(\"opacity\", \"0\").transition().attr(\"opacity\", \"1\");\n }\n }\n function hideScrollBox(scrollBox) {\n var hasHBar = !!scrollBox.hbar;\n var hasVBar = !!scrollBox.vbar;\n if (hasHBar) {\n scrollBox.hbar.transition().attr(\"opacity\", \"0\").each(\"end\", function() {\n hasHBar = false;\n if (!hasVBar) scrollBox.disable();\n });\n }\n if (hasVBar) {\n scrollBox.vbar.transition().attr(\"opacity\", \"0\").each(\"end\", function() {\n hasVBar = false;\n if (!hasHBar) scrollBox.disable();\n });\n }\n }\n function drawItem(item, menuOpts, itemOpts, gd) {\n item.call(drawItemRect, menuOpts).call(drawItemText, menuOpts, itemOpts, gd);\n }\n function drawItemRect(item, menuOpts) {\n var rect = Lib.ensureSingle(item, \"rect\", constants.itemRectClassName, function(s) {\n s.attr({\n rx: constants.rx,\n ry: constants.ry,\n \"shape-rendering\": \"crispEdges\"\n });\n });\n rect.call(Color2.stroke, menuOpts.bordercolor).call(Color2.fill, menuOpts.bgcolor).style(\"stroke-width\", menuOpts.borderwidth + \"px\");\n }\n function drawItemText(item, menuOpts, itemOpts, gd) {\n var text = Lib.ensureSingle(item, \"text\", constants.itemTextClassName, function(s) {\n s.attr({\n \"text-anchor\": \"start\",\n \"data-notex\": 1\n });\n });\n var tx = itemOpts.label;\n var _meta = gd._fullLayout._meta;\n if (_meta) tx = Lib.templateString(tx, _meta);\n text.call(Drawing.font, menuOpts.font).text(tx).call(svgTextUtils.convertToTspans, gd);\n }\n function styleButtons(buttons, menuOpts) {\n var active = menuOpts.active;\n buttons.each(function(buttonOpts, i) {\n var button = d3.select(this);\n if (i === active && menuOpts.showactive) {\n button.select(\"rect.\" + constants.itemRectClassName).call(Color2.fill, constants.activeColor);\n }\n });\n }\n function styleOnMouseOver(item) {\n item.select(\"rect.\" + constants.itemRectClassName).call(Color2.fill, constants.hoverColor);\n }\n function styleOnMouseOut(item, menuOpts) {\n item.select(\"rect.\" + constants.itemRectClassName).call(Color2.fill, menuOpts.bgcolor);\n }\n function findDimensions(gd, menuOpts) {\n var dims = menuOpts._dims = {\n width1: 0,\n height1: 0,\n heights: [],\n widths: [],\n totalWidth: 0,\n totalHeight: 0,\n openWidth: 0,\n openHeight: 0,\n lx: 0,\n ly: 0\n };\n var fakeButtons = Drawing.tester.selectAll(\"g.\" + constants.dropdownButtonClassName).data(Lib.filterVisible(menuOpts.buttons));\n fakeButtons.enter().append(\"g\").classed(constants.dropdownButtonClassName, true);\n var isVertical = [\"up\", \"down\"].indexOf(menuOpts.direction) !== -1;\n fakeButtons.each(function(buttonOpts, i) {\n var button = d3.select(this);\n button.call(drawItem, menuOpts, buttonOpts, gd);\n var text = button.select(\".\" + constants.itemTextClassName);\n var tWidth = text.node() && Drawing.bBox(text.node()).width;\n var wEff = Math.max(tWidth + constants.textPadX, constants.minWidth);\n var tHeight = menuOpts.font.size * LINE_SPACING;\n var tLines = svgTextUtils.lineCount(text);\n var hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY;\n hEff = Math.ceil(hEff);\n wEff = Math.ceil(wEff);\n dims.widths[i] = wEff;\n dims.heights[i] = hEff;\n dims.height1 = Math.max(dims.height1, hEff);\n dims.width1 = Math.max(dims.width1, wEff);\n if (isVertical) {\n dims.totalWidth = Math.max(dims.totalWidth, wEff);\n dims.openWidth = dims.totalWidth;\n dims.totalHeight += hEff + constants.gapButton;\n dims.openHeight += hEff + constants.gapButton;\n } else {\n dims.totalWidth += wEff + constants.gapButton;\n dims.openWidth += wEff + constants.gapButton;\n dims.totalHeight = Math.max(dims.totalHeight, hEff);\n dims.openHeight = dims.totalHeight;\n }\n });\n if (isVertical) {\n dims.totalHeight -= constants.gapButton;\n } else {\n dims.totalWidth -= constants.gapButton;\n }\n dims.headerWidth = dims.width1 + constants.arrowPadX;\n dims.headerHeight = dims.height1;\n if (menuOpts.type === \"dropdown\") {\n if (isVertical) {\n dims.width1 += constants.arrowPadX;\n dims.totalHeight = dims.height1;\n } else {\n dims.totalWidth = dims.width1;\n }\n dims.totalWidth += constants.arrowPadX;\n }\n fakeButtons.remove();\n var paddedWidth = dims.totalWidth + menuOpts.pad.l + menuOpts.pad.r;\n var paddedHeight = dims.totalHeight + menuOpts.pad.t + menuOpts.pad.b;\n var graphSize = gd._fullLayout._size;\n dims.lx = graphSize.l + graphSize.w * menuOpts.x;\n dims.ly = graphSize.t + graphSize.h * (1 - menuOpts.y);\n var xanchor = \"left\";\n if (Lib.isRightAnchor(menuOpts)) {\n dims.lx -= paddedWidth;\n xanchor = \"right\";\n }\n if (Lib.isCenterAnchor(menuOpts)) {\n dims.lx -= paddedWidth / 2;\n xanchor = \"center\";\n }\n var yanchor = \"top\";\n if (Lib.isBottomAnchor(menuOpts)) {\n dims.ly -= paddedHeight;\n yanchor = \"bottom\";\n }\n if (Lib.isMiddleAnchor(menuOpts)) {\n dims.ly -= paddedHeight / 2;\n yanchor = \"middle\";\n }\n dims.totalWidth = Math.ceil(dims.totalWidth);\n dims.totalHeight = Math.ceil(dims.totalHeight);\n dims.lx = Math.round(dims.lx);\n dims.ly = Math.round(dims.ly);\n Plots.autoMargin(gd, autoMarginId(menuOpts), {\n x: menuOpts.x,\n y: menuOpts.y,\n l: paddedWidth * ({ right: 1, center: 0.5 }[xanchor] || 0),\n r: paddedWidth * ({ left: 1, center: 0.5 }[xanchor] || 0),\n b: paddedHeight * ({ top: 1, middle: 0.5 }[yanchor] || 0),\n t: paddedHeight * ({ bottom: 1, middle: 0.5 }[yanchor] || 0)\n });\n }\n function autoMarginId(menuOpts) {\n return constants.autoMarginIdRoot + menuOpts._index;\n }\n function setItemPosition(item, menuOpts, posOpts, overrideOpts) {\n overrideOpts = overrideOpts || {};\n var rect = item.select(\".\" + constants.itemRectClassName);\n var text = item.select(\".\" + constants.itemTextClassName);\n var borderWidth = menuOpts.borderwidth;\n var index = posOpts.index;\n var dims = menuOpts._dims;\n Drawing.setTranslate(item, borderWidth + posOpts.x, borderWidth + posOpts.y);\n var isVertical = [\"up\", \"down\"].indexOf(menuOpts.direction) !== -1;\n var finalHeight = overrideOpts.height || (isVertical ? dims.heights[index] : dims.height1);\n rect.attr({\n x: 0,\n y: 0,\n width: overrideOpts.width || (isVertical ? dims.width1 : dims.widths[index]),\n height: finalHeight\n });\n var tHeight = menuOpts.font.size * LINE_SPACING;\n var tLines = svgTextUtils.lineCount(text);\n var spanOffset = (tLines - 1) * tHeight / 2;\n svgTextUtils.positionText(\n text,\n constants.textOffsetX,\n finalHeight / 2 - spanOffset + constants.textOffsetY\n );\n if (isVertical) {\n posOpts.y += dims.heights[index] + posOpts.yPad;\n } else {\n posOpts.x += dims.widths[index] + posOpts.xPad;\n }\n posOpts.index++;\n }\n function removeAllButtons(gButton, newMenuIndexAttr) {\n gButton.attr(constants.menuIndexAttrName, newMenuIndexAttr || \"-1\").selectAll(\"g.\" + constants.dropdownButtonClassName).remove();\n }\n }\n });\n\n // src/components/updatemenus/index.js\n var require_updatemenus = __commonJS({\n \"src/components/updatemenus/index.js\"(exports, module) {\n \"use strict\";\n var constants = require_constants9();\n module.exports = {\n moduleType: \"component\",\n name: constants.name,\n layoutAttributes: require_attributes18(),\n supplyLayoutDefaults: require_defaults14(),\n draw: require_draw7()\n };\n }\n });\n\n // src/components/sliders/constants.js\n var require_constants10 = __commonJS({\n \"src/components/sliders/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n // layout attribute name\n name: \"sliders\",\n // class names\n containerClassName: \"slider-container\",\n groupClassName: \"slider-group\",\n inputAreaClass: \"slider-input-area\",\n railRectClass: \"slider-rail-rect\",\n railTouchRectClass: \"slider-rail-touch-rect\",\n gripRectClass: \"slider-grip-rect\",\n tickRectClass: \"slider-tick-rect\",\n inputProxyClass: \"slider-input-proxy\",\n labelsClass: \"slider-labels\",\n labelGroupClass: \"slider-label-group\",\n labelClass: \"slider-label\",\n currentValueClass: \"slider-current-value\",\n railHeight: 5,\n // DOM attribute name in button group keeping track\n // of active update menu\n menuIndexAttrName: \"slider-active-index\",\n // id root pass to Plots.autoMargin\n autoMarginIdRoot: \"slider-\",\n // min item width / height\n minWidth: 30,\n minHeight: 30,\n // padding around item text\n textPadX: 40,\n // arrow offset off right edge\n arrowOffsetX: 4,\n railRadius: 2,\n railWidth: 5,\n railBorder: 4,\n railBorderWidth: 1,\n railBorderColor: \"#bec8d9\",\n railBgColor: \"#f8fafc\",\n // The distance of the rail from the edge of the touchable area\n // Slightly less than the step inset because of the curved edges\n // of the rail\n railInset: 8,\n // The distance from the extremal tick marks to the edge of the\n // touchable area. This is basically the same as the grip radius,\n // but for other styles it wouldn't really need to be.\n stepInset: 10,\n gripRadius: 10,\n gripWidth: 20,\n gripHeight: 20,\n gripBorder: 20,\n gripBorderWidth: 1,\n gripBorderColor: \"#bec8d9\",\n gripBgColor: \"#f6f8fa\",\n gripBgActiveColor: \"#dbdde0\",\n labelPadding: 8,\n labelOffset: 0,\n tickWidth: 1,\n tickColor: \"#333\",\n tickOffset: 25,\n tickLength: 7,\n minorTickOffset: 25,\n minorTickColor: \"#333\",\n minorTickLength: 4,\n // Extra space below the current value label:\n currentValuePadding: 8,\n currentValueInset: 0\n };\n }\n });\n\n // src/components/sliders/attributes.js\n var require_attributes19 = __commonJS({\n \"src/components/sliders/attributes.js\"(exports, module) {\n \"use strict\";\n var fontAttrs = require_font_attributes();\n var padAttrs = require_pad_attributes();\n var extendDeepAll = require_extend().extendDeepAll;\n var overrideAll = require_edit_types().overrideAll;\n var animationAttrs = require_animation_attributes();\n var templatedArray = require_plot_template().templatedArray;\n var constants = require_constants10();\n var stepsAttrs = templatedArray(\"step\", {\n visible: {\n valType: \"boolean\",\n dflt: true\n },\n method: {\n valType: \"enumerated\",\n values: [\"restyle\", \"relayout\", \"animate\", \"update\", \"skip\"],\n dflt: \"restyle\"\n },\n args: {\n valType: \"info_array\",\n freeLength: true,\n items: [\n { valType: \"any\" },\n { valType: \"any\" },\n { valType: \"any\" }\n ]\n },\n label: {\n valType: \"string\"\n },\n value: {\n valType: \"string\"\n },\n execute: {\n valType: \"boolean\",\n dflt: true\n }\n });\n module.exports = overrideAll(templatedArray(\"slider\", {\n visible: {\n valType: \"boolean\",\n dflt: true\n },\n active: {\n valType: \"number\",\n min: 0,\n dflt: 0\n },\n steps: stepsAttrs,\n lenmode: {\n valType: \"enumerated\",\n values: [\"fraction\", \"pixels\"],\n dflt: \"fraction\"\n },\n len: {\n valType: \"number\",\n min: 0,\n dflt: 1\n },\n x: {\n valType: \"number\",\n min: -2,\n max: 3,\n dflt: 0\n },\n pad: extendDeepAll(padAttrs({ editType: \"arraydraw\" }), {}, { t: { dflt: 20 } }),\n xanchor: {\n valType: \"enumerated\",\n values: [\"auto\", \"left\", \"center\", \"right\"],\n dflt: \"left\"\n },\n y: {\n valType: \"number\",\n min: -2,\n max: 3,\n dflt: 0\n },\n yanchor: {\n valType: \"enumerated\",\n values: [\"auto\", \"top\", \"middle\", \"bottom\"],\n dflt: \"top\"\n },\n transition: {\n duration: {\n valType: \"number\",\n min: 0,\n dflt: 150\n },\n easing: {\n valType: \"enumerated\",\n values: animationAttrs.transition.easing.values,\n dflt: \"cubic-in-out\"\n }\n },\n currentvalue: {\n visible: {\n valType: \"boolean\",\n dflt: true\n },\n xanchor: {\n valType: \"enumerated\",\n values: [\"left\", \"center\", \"right\"],\n dflt: \"left\"\n },\n offset: {\n valType: \"number\",\n dflt: 10\n },\n prefix: {\n valType: \"string\"\n },\n suffix: {\n valType: \"string\"\n },\n font: fontAttrs({})\n },\n font: fontAttrs({}),\n activebgcolor: {\n valType: \"color\",\n dflt: constants.gripBgActiveColor\n },\n bgcolor: {\n valType: \"color\",\n dflt: constants.railBgColor\n },\n bordercolor: {\n valType: \"color\",\n dflt: constants.railBorderColor\n },\n borderwidth: {\n valType: \"number\",\n min: 0,\n dflt: constants.railBorderWidth\n },\n ticklen: {\n valType: \"number\",\n min: 0,\n dflt: constants.tickLength\n },\n tickcolor: {\n valType: \"color\",\n dflt: constants.tickColor\n },\n tickwidth: {\n valType: \"number\",\n min: 0,\n dflt: 1\n },\n minorticklen: {\n valType: \"number\",\n min: 0,\n dflt: constants.minorTickLength\n }\n }), \"arraydraw\", \"from-root\");\n }\n });\n\n // src/components/sliders/defaults.js\n var require_defaults15 = __commonJS({\n \"src/components/sliders/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleArrayContainerDefaults = require_array_container_defaults();\n var attributes = require_attributes19();\n var constants = require_constants10();\n var name2 = constants.name;\n var stepAttrs = attributes.steps;\n module.exports = function slidersDefaults(layoutIn, layoutOut) {\n handleArrayContainerDefaults(layoutIn, layoutOut, {\n name: name2,\n handleItemDefaults: sliderDefaults\n });\n };\n function sliderDefaults(sliderIn, sliderOut, layoutOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(sliderIn, sliderOut, attributes, attr, dflt);\n }\n var steps = handleArrayContainerDefaults(sliderIn, sliderOut, {\n name: \"steps\",\n handleItemDefaults: stepDefaults\n });\n var stepCount = 0;\n for (var i = 0; i < steps.length; i++) {\n if (steps[i].visible) stepCount++;\n }\n var visible;\n if (stepCount < 2) visible = sliderOut.visible = false;\n else visible = coerce(\"visible\");\n if (!visible) return;\n sliderOut._stepCount = stepCount;\n var visSteps = sliderOut._visibleSteps = Lib.filterVisible(steps);\n var active = coerce(\"active\");\n if (!(steps[active] || {}).visible) sliderOut.active = visSteps[0]._index;\n coerce(\"x\");\n coerce(\"y\");\n Lib.noneOrAll(sliderIn, sliderOut, [\"x\", \"y\"]);\n coerce(\"xanchor\");\n coerce(\"yanchor\");\n coerce(\"len\");\n coerce(\"lenmode\");\n coerce(\"pad.t\");\n coerce(\"pad.r\");\n coerce(\"pad.b\");\n coerce(\"pad.l\");\n Lib.coerceFont(coerce, \"font\", layoutOut.font);\n var currentValueIsVisible = coerce(\"currentvalue.visible\");\n if (currentValueIsVisible) {\n coerce(\"currentvalue.xanchor\");\n coerce(\"currentvalue.prefix\");\n coerce(\"currentvalue.suffix\");\n coerce(\"currentvalue.offset\");\n Lib.coerceFont(coerce, \"currentvalue.font\", sliderOut.font);\n }\n coerce(\"transition.duration\");\n coerce(\"transition.easing\");\n coerce(\"bgcolor\");\n coerce(\"activebgcolor\");\n coerce(\"bordercolor\");\n coerce(\"borderwidth\");\n coerce(\"ticklen\");\n coerce(\"tickwidth\");\n coerce(\"tickcolor\");\n coerce(\"minorticklen\");\n }\n function stepDefaults(valueIn, valueOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(valueIn, valueOut, stepAttrs, attr, dflt);\n }\n var visible;\n if (valueIn.method !== \"skip\" && !Array.isArray(valueIn.args)) {\n visible = valueOut.visible = false;\n } else visible = coerce(\"visible\");\n if (visible) {\n coerce(\"method\");\n coerce(\"args\");\n var label = coerce(\"label\", \"step-\" + valueOut._index);\n coerce(\"value\", label);\n coerce(\"execute\");\n }\n }\n }\n });\n\n // src/components/sliders/draw.js\n var require_draw8 = __commonJS({\n \"src/components/sliders/draw.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Plots = require_plots();\n var Color2 = require_color();\n var Drawing = require_drawing();\n var Lib = require_lib();\n var strTranslate = Lib.strTranslate;\n var svgTextUtils = require_svg_text_utils();\n var arrayEditor = require_plot_template().arrayEditor;\n var constants = require_constants10();\n var alignmentConstants = require_alignment();\n var LINE_SPACING = alignmentConstants.LINE_SPACING;\n var FROM_TL = alignmentConstants.FROM_TL;\n var FROM_BR = alignmentConstants.FROM_BR;\n module.exports = function draw(gd) {\n var staticPlot = gd._context.staticPlot;\n var fullLayout = gd._fullLayout;\n var sliderData = makeSliderData(fullLayout, gd);\n var sliders = fullLayout._infolayer.selectAll(\"g.\" + constants.containerClassName).data(sliderData.length > 0 ? [0] : []);\n sliders.enter().append(\"g\").classed(constants.containerClassName, true).style(\"cursor\", staticPlot ? null : \"ew-resize\");\n function clearSlider(sliderOpts2) {\n if (sliderOpts2._commandObserver) {\n sliderOpts2._commandObserver.remove();\n delete sliderOpts2._commandObserver;\n }\n Plots.autoMargin(gd, autoMarginId(sliderOpts2));\n }\n sliders.exit().each(function() {\n d3.select(this).selectAll(\"g.\" + constants.groupClassName).each(clearSlider);\n }).remove();\n if (sliderData.length === 0) return;\n var sliderGroups = sliders.selectAll(\"g.\" + constants.groupClassName).data(sliderData, keyFunction);\n sliderGroups.enter().append(\"g\").classed(constants.groupClassName, true);\n sliderGroups.exit().each(clearSlider).remove();\n for (var i = 0; i < sliderData.length; i++) {\n var sliderOpts = sliderData[i];\n findDimensions(gd, sliderOpts);\n }\n sliderGroups.each(function(sliderOpts2) {\n var gSlider = d3.select(this);\n computeLabelSteps(sliderOpts2);\n Plots.manageCommandObserver(gd, sliderOpts2, sliderOpts2._visibleSteps, function(data) {\n var opts = gSlider.data()[0];\n if (opts.active === data.index) return;\n if (opts._dragging) return;\n setActive(gd, gSlider, opts, data.index, false, true);\n });\n drawSlider(gd, d3.select(this), sliderOpts2);\n });\n };\n function autoMarginId(sliderOpts) {\n return constants.autoMarginIdRoot + sliderOpts._index;\n }\n function makeSliderData(fullLayout, gd) {\n var contOpts = fullLayout[constants.name];\n var sliderData = [];\n for (var i = 0; i < contOpts.length; i++) {\n var item = contOpts[i];\n if (!item.visible) continue;\n item._gd = gd;\n sliderData.push(item);\n }\n return sliderData;\n }\n function keyFunction(opts) {\n return opts._index;\n }\n function findDimensions(gd, sliderOpts) {\n var sliderLabels = Drawing.tester.selectAll(\"g.\" + constants.labelGroupClass).data(sliderOpts._visibleSteps);\n sliderLabels.enter().append(\"g\").classed(constants.labelGroupClass, true);\n var maxLabelWidth = 0;\n var labelHeight = 0;\n sliderLabels.each(function(stepOpts) {\n var labelGroup = d3.select(this);\n var text = drawLabel(labelGroup, { step: stepOpts }, sliderOpts);\n var textNode = text.node();\n if (textNode) {\n var bBox = Drawing.bBox(textNode);\n labelHeight = Math.max(labelHeight, bBox.height);\n maxLabelWidth = Math.max(maxLabelWidth, bBox.width);\n }\n });\n sliderLabels.remove();\n var dims = sliderOpts._dims = {};\n dims.inputAreaWidth = Math.max(\n constants.railWidth,\n constants.gripHeight\n );\n var graphSize = gd._fullLayout._size;\n dims.lx = graphSize.l + graphSize.w * sliderOpts.x;\n dims.ly = graphSize.t + graphSize.h * (1 - sliderOpts.y);\n if (sliderOpts.lenmode === \"fraction\") {\n dims.outerLength = Math.round(graphSize.w * sliderOpts.len);\n } else {\n dims.outerLength = sliderOpts.len;\n }\n dims.inputAreaStart = 0;\n dims.inputAreaLength = Math.round(dims.outerLength - sliderOpts.pad.l - sliderOpts.pad.r);\n var textableInputLength = dims.inputAreaLength - 2 * constants.stepInset;\n var availableSpacePerLabel = textableInputLength / (sliderOpts._stepCount - 1);\n var computedSpacePerLabel = maxLabelWidth + constants.labelPadding;\n dims.labelStride = Math.max(1, Math.ceil(computedSpacePerLabel / availableSpacePerLabel));\n dims.labelHeight = labelHeight;\n dims.currentValueMaxWidth = 0;\n dims.currentValueHeight = 0;\n dims.currentValueTotalHeight = 0;\n dims.currentValueMaxLines = 1;\n if (sliderOpts.currentvalue.visible) {\n var dummyGroup = Drawing.tester.append(\"g\");\n sliderLabels.each(function(stepOpts) {\n var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label);\n var curValSize = curValPrefix.node() && Drawing.bBox(curValPrefix.node()) || { width: 0, height: 0 };\n var lines = svgTextUtils.lineCount(curValPrefix);\n dims.currentValueMaxWidth = Math.max(dims.currentValueMaxWidth, Math.ceil(curValSize.width));\n dims.currentValueHeight = Math.max(dims.currentValueHeight, Math.ceil(curValSize.height));\n dims.currentValueMaxLines = Math.max(dims.currentValueMaxLines, lines);\n });\n dims.currentValueTotalHeight = dims.currentValueHeight + sliderOpts.currentvalue.offset;\n dummyGroup.remove();\n }\n dims.height = dims.currentValueTotalHeight + constants.tickOffset + sliderOpts.ticklen + constants.labelOffset + dims.labelHeight + sliderOpts.pad.t + sliderOpts.pad.b;\n var xanchor = \"left\";\n if (Lib.isRightAnchor(sliderOpts)) {\n dims.lx -= dims.outerLength;\n xanchor = \"right\";\n }\n if (Lib.isCenterAnchor(sliderOpts)) {\n dims.lx -= dims.outerLength / 2;\n xanchor = \"center\";\n }\n var yanchor = \"top\";\n if (Lib.isBottomAnchor(sliderOpts)) {\n dims.ly -= dims.height;\n yanchor = \"bottom\";\n }\n if (Lib.isMiddleAnchor(sliderOpts)) {\n dims.ly -= dims.height / 2;\n yanchor = \"middle\";\n }\n dims.outerLength = Math.ceil(dims.outerLength);\n dims.height = Math.ceil(dims.height);\n dims.lx = Math.round(dims.lx);\n dims.ly = Math.round(dims.ly);\n var marginOpts = {\n y: sliderOpts.y,\n b: dims.height * FROM_BR[yanchor],\n t: dims.height * FROM_TL[yanchor]\n };\n if (sliderOpts.lenmode === \"fraction\") {\n marginOpts.l = 0;\n marginOpts.xl = sliderOpts.x - sliderOpts.len * FROM_TL[xanchor];\n marginOpts.r = 0;\n marginOpts.xr = sliderOpts.x + sliderOpts.len * FROM_BR[xanchor];\n } else {\n marginOpts.x = sliderOpts.x;\n marginOpts.l = dims.outerLength * FROM_TL[xanchor];\n marginOpts.r = dims.outerLength * FROM_BR[xanchor];\n }\n Plots.autoMargin(gd, autoMarginId(sliderOpts), marginOpts);\n }\n function drawSlider(gd, sliderGroup, sliderOpts) {\n if (!(sliderOpts.steps[sliderOpts.active] || {}).visible) {\n sliderOpts.active = sliderOpts._visibleSteps[0]._index;\n }\n sliderGroup.call(drawCurrentValue, sliderOpts).call(drawRail, sliderOpts).call(drawLabelGroup, sliderOpts).call(drawTicks, sliderOpts).call(drawTouchRect, gd, sliderOpts).call(drawGrip, gd, sliderOpts);\n var dims = sliderOpts._dims;\n Drawing.setTranslate(sliderGroup, dims.lx + sliderOpts.pad.l, dims.ly + sliderOpts.pad.t);\n sliderGroup.call(setGripPosition, sliderOpts, false);\n sliderGroup.call(drawCurrentValue, sliderOpts);\n }\n function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) {\n if (!sliderOpts.currentvalue.visible) return;\n var dims = sliderOpts._dims;\n var x0, textAnchor;\n switch (sliderOpts.currentvalue.xanchor) {\n case \"right\":\n x0 = dims.inputAreaLength - constants.currentValueInset - dims.currentValueMaxWidth;\n textAnchor = \"left\";\n break;\n case \"center\":\n x0 = dims.inputAreaLength * 0.5;\n textAnchor = \"middle\";\n break;\n default:\n x0 = constants.currentValueInset;\n textAnchor = \"left\";\n }\n var text = Lib.ensureSingle(sliderGroup, \"text\", constants.labelClass, function(s) {\n s.attr({\n \"text-anchor\": textAnchor,\n \"data-notex\": 1\n });\n });\n var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : \"\";\n if (typeof valueOverride === \"string\") {\n str += valueOverride;\n } else {\n var curVal = sliderOpts.steps[sliderOpts.active].label;\n var _meta = sliderOpts._gd._fullLayout._meta;\n if (_meta) curVal = Lib.templateString(curVal, _meta);\n str += curVal;\n }\n if (sliderOpts.currentvalue.suffix) {\n str += sliderOpts.currentvalue.suffix;\n }\n text.call(Drawing.font, sliderOpts.currentvalue.font).text(str).call(svgTextUtils.convertToTspans, sliderOpts._gd);\n var lines = svgTextUtils.lineCount(text);\n var y0 = (dims.currentValueMaxLines + 1 - lines) * sliderOpts.currentvalue.font.size * LINE_SPACING;\n svgTextUtils.positionText(text, x0, y0);\n return text;\n }\n function drawGrip(sliderGroup, gd, sliderOpts) {\n var grip = Lib.ensureSingle(sliderGroup, \"rect\", constants.gripRectClass, function(s) {\n s.call(attachGripEvents, gd, sliderGroup, sliderOpts).style(\"pointer-events\", \"all\");\n });\n grip.attr({\n width: constants.gripWidth,\n height: constants.gripHeight,\n rx: constants.gripRadius,\n ry: constants.gripRadius\n }).call(Color2.stroke, sliderOpts.bordercolor).call(Color2.fill, sliderOpts.bgcolor).style(\"stroke-width\", sliderOpts.borderwidth + \"px\");\n }\n function drawLabel(item, data, sliderOpts) {\n var text = Lib.ensureSingle(item, \"text\", constants.labelClass, function(s) {\n s.attr({\n \"text-anchor\": \"middle\",\n \"data-notex\": 1\n });\n });\n var tx = data.step.label;\n var _meta = sliderOpts._gd._fullLayout._meta;\n if (_meta) tx = Lib.templateString(tx, _meta);\n text.call(Drawing.font, sliderOpts.font).text(tx).call(svgTextUtils.convertToTspans, sliderOpts._gd);\n return text;\n }\n function drawLabelGroup(sliderGroup, sliderOpts) {\n var labels = Lib.ensureSingle(sliderGroup, \"g\", constants.labelsClass);\n var dims = sliderOpts._dims;\n var labelItems = labels.selectAll(\"g.\" + constants.labelGroupClass).data(dims.labelSteps);\n labelItems.enter().append(\"g\").classed(constants.labelGroupClass, true);\n labelItems.exit().remove();\n labelItems.each(function(d) {\n var item = d3.select(this);\n item.call(drawLabel, d, sliderOpts);\n Drawing.setTranslate(\n item,\n normalizedValueToPosition(sliderOpts, d.fraction),\n constants.tickOffset + sliderOpts.ticklen + // position is the baseline of the top line of text only, even\n // if the label spans multiple lines\n sliderOpts.font.size * LINE_SPACING + constants.labelOffset + dims.currentValueTotalHeight\n );\n });\n }\n function handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, doTransition) {\n var quantizedPosition = Math.round(normalizedPosition * (sliderOpts._stepCount - 1));\n var quantizedIndex = sliderOpts._visibleSteps[quantizedPosition]._index;\n if (quantizedIndex !== sliderOpts.active) {\n setActive(gd, sliderGroup, sliderOpts, quantizedIndex, true, doTransition);\n }\n }\n function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) {\n var previousActive = sliderOpts.active;\n sliderOpts.active = index;\n arrayEditor(gd.layout, constants.name, sliderOpts).applyUpdate(\"active\", index);\n var step = sliderOpts.steps[sliderOpts.active];\n sliderGroup.call(setGripPosition, sliderOpts, doTransition);\n sliderGroup.call(drawCurrentValue, sliderOpts);\n gd.emit(\"plotly_sliderchange\", {\n slider: sliderOpts,\n step: sliderOpts.steps[sliderOpts.active],\n interaction: doCallback,\n previousActive\n });\n if (step && step.method && doCallback) {\n if (sliderGroup._nextMethod) {\n sliderGroup._nextMethod.step = step;\n sliderGroup._nextMethod.doCallback = doCallback;\n sliderGroup._nextMethod.doTransition = doTransition;\n } else {\n sliderGroup._nextMethod = { step, doCallback, doTransition };\n sliderGroup._nextMethodRaf = window.requestAnimationFrame(function() {\n var _step = sliderGroup._nextMethod.step;\n if (!_step.method) return;\n if (_step.execute) {\n Plots.executeAPICommand(gd, _step.method, _step.args);\n }\n sliderGroup._nextMethod = null;\n sliderGroup._nextMethodRaf = null;\n });\n }\n }\n }\n function attachGripEvents(item, gd, sliderGroup) {\n if (gd._context.staticPlot) return;\n var node = sliderGroup.node();\n var $gd = d3.select(gd);\n function getSliderOpts() {\n return sliderGroup.data()[0];\n }\n function mouseDownHandler() {\n var sliderOpts = getSliderOpts();\n gd.emit(\"plotly_sliderstart\", { slider: sliderOpts });\n var grip = sliderGroup.select(\".\" + constants.gripRectClass);\n d3.event.stopPropagation();\n d3.event.preventDefault();\n grip.call(Color2.fill, sliderOpts.activebgcolor);\n var normalizedPosition = positionToNormalizedValue(sliderOpts, d3.mouse(node)[0]);\n handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, true);\n sliderOpts._dragging = true;\n function mouseMoveHandler() {\n var sliderOpts2 = getSliderOpts();\n var normalizedPosition2 = positionToNormalizedValue(sliderOpts2, d3.mouse(node)[0]);\n handleInput(gd, sliderGroup, sliderOpts2, normalizedPosition2, false);\n }\n $gd.on(\"mousemove\", mouseMoveHandler);\n $gd.on(\"touchmove\", mouseMoveHandler);\n function mouseUpHandler() {\n var sliderOpts2 = getSliderOpts();\n sliderOpts2._dragging = false;\n grip.call(Color2.fill, sliderOpts2.bgcolor);\n $gd.on(\"mouseup\", null);\n $gd.on(\"mousemove\", null);\n $gd.on(\"touchend\", null);\n $gd.on(\"touchmove\", null);\n gd.emit(\"plotly_sliderend\", {\n slider: sliderOpts2,\n step: sliderOpts2.steps[sliderOpts2.active]\n });\n }\n $gd.on(\"mouseup\", mouseUpHandler);\n $gd.on(\"touchend\", mouseUpHandler);\n }\n item.on(\"mousedown\", mouseDownHandler);\n item.on(\"touchstart\", mouseDownHandler);\n }\n function drawTicks(sliderGroup, sliderOpts) {\n var tick = sliderGroup.selectAll(\"rect.\" + constants.tickRectClass).data(sliderOpts._visibleSteps);\n var dims = sliderOpts._dims;\n tick.enter().append(\"rect\").classed(constants.tickRectClass, true);\n tick.exit().remove();\n tick.attr({\n width: sliderOpts.tickwidth + \"px\",\n \"shape-rendering\": \"crispEdges\"\n });\n tick.each(function(d, i) {\n var isMajor = i % dims.labelStride === 0;\n var item = d3.select(this);\n item.attr({ height: isMajor ? sliderOpts.ticklen : sliderOpts.minorticklen }).call(Color2.fill, isMajor ? sliderOpts.tickcolor : sliderOpts.tickcolor);\n Drawing.setTranslate(\n item,\n normalizedValueToPosition(sliderOpts, i / (sliderOpts._stepCount - 1)) - 0.5 * sliderOpts.tickwidth,\n (isMajor ? constants.tickOffset : constants.minorTickOffset) + dims.currentValueTotalHeight\n );\n });\n }\n function computeLabelSteps(sliderOpts) {\n var dims = sliderOpts._dims;\n dims.labelSteps = [];\n var nsteps = sliderOpts._stepCount;\n for (var i = 0; i < nsteps; i += dims.labelStride) {\n dims.labelSteps.push({\n fraction: i / (nsteps - 1),\n step: sliderOpts._visibleSteps[i]\n });\n }\n }\n function setGripPosition(sliderGroup, sliderOpts, doTransition) {\n var grip = sliderGroup.select(\"rect.\" + constants.gripRectClass);\n var quantizedIndex = 0;\n for (var i = 0; i < sliderOpts._stepCount; i++) {\n if (sliderOpts._visibleSteps[i]._index === sliderOpts.active) {\n quantizedIndex = i;\n break;\n }\n }\n var x = normalizedValueToPosition(sliderOpts, quantizedIndex / (sliderOpts._stepCount - 1));\n if (sliderOpts._invokingCommand) return;\n var el = grip;\n if (doTransition && sliderOpts.transition.duration > 0) {\n el = el.transition().duration(sliderOpts.transition.duration).ease(sliderOpts.transition.easing);\n }\n el.attr(\"transform\", strTranslate(x - constants.gripWidth * 0.5, sliderOpts._dims.currentValueTotalHeight));\n }\n function normalizedValueToPosition(sliderOpts, normalizedPosition) {\n var dims = sliderOpts._dims;\n return dims.inputAreaStart + constants.stepInset + (dims.inputAreaLength - 2 * constants.stepInset) * Math.min(1, Math.max(0, normalizedPosition));\n }\n function positionToNormalizedValue(sliderOpts, position) {\n var dims = sliderOpts._dims;\n return Math.min(1, Math.max(0, (position - constants.stepInset - dims.inputAreaStart) / (dims.inputAreaLength - 2 * constants.stepInset - 2 * dims.inputAreaStart)));\n }\n function drawTouchRect(sliderGroup, gd, sliderOpts) {\n var dims = sliderOpts._dims;\n var rect = Lib.ensureSingle(sliderGroup, \"rect\", constants.railTouchRectClass, function(s) {\n s.call(attachGripEvents, gd, sliderGroup, sliderOpts).style(\"pointer-events\", \"all\");\n });\n rect.attr({\n width: dims.inputAreaLength,\n height: Math.max(dims.inputAreaWidth, constants.tickOffset + sliderOpts.ticklen + dims.labelHeight)\n }).call(Color2.fill, sliderOpts.bgcolor).attr(\"opacity\", 0);\n Drawing.setTranslate(rect, 0, dims.currentValueTotalHeight);\n }\n function drawRail(sliderGroup, sliderOpts) {\n var dims = sliderOpts._dims;\n var computedLength = dims.inputAreaLength - constants.railInset * 2;\n var rect = Lib.ensureSingle(sliderGroup, \"rect\", constants.railRectClass);\n rect.attr({\n width: computedLength,\n height: constants.railWidth,\n rx: constants.railRadius,\n ry: constants.railRadius,\n \"shape-rendering\": \"crispEdges\"\n }).call(Color2.stroke, sliderOpts.bordercolor).call(Color2.fill, sliderOpts.bgcolor).style(\"stroke-width\", sliderOpts.borderwidth + \"px\");\n Drawing.setTranslate(\n rect,\n constants.railInset,\n (dims.inputAreaWidth - constants.railWidth) * 0.5 + dims.currentValueTotalHeight\n );\n }\n }\n });\n\n // src/components/sliders/index.js\n var require_sliders = __commonJS({\n \"src/components/sliders/index.js\"(exports, module) {\n \"use strict\";\n var constants = require_constants10();\n module.exports = {\n moduleType: \"component\",\n name: constants.name,\n layoutAttributes: require_attributes19(),\n supplyLayoutDefaults: require_defaults15(),\n draw: require_draw8()\n };\n }\n });\n\n // src/components/rangeslider/attributes.js\n var require_attributes20 = __commonJS({\n \"src/components/rangeslider/attributes.js\"(exports, module) {\n \"use strict\";\n var colorAttributes = require_attributes3();\n module.exports = {\n bgcolor: {\n valType: \"color\",\n dflt: colorAttributes.background,\n editType: \"plot\"\n },\n bordercolor: {\n valType: \"color\",\n dflt: colorAttributes.defaultLine,\n editType: \"plot\"\n },\n borderwidth: {\n valType: \"integer\",\n dflt: 0,\n min: 0,\n editType: \"plot\"\n },\n autorange: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc\",\n impliedEdits: { \"range[0]\": void 0, \"range[1]\": void 0 }\n },\n range: {\n valType: \"info_array\",\n items: [\n { valType: \"any\", editType: \"calc\", impliedEdits: { \"^autorange\": false } },\n { valType: \"any\", editType: \"calc\", impliedEdits: { \"^autorange\": false } }\n ],\n editType: \"calc\",\n impliedEdits: { autorange: false }\n },\n thickness: {\n valType: \"number\",\n dflt: 0.15,\n min: 0,\n max: 1,\n editType: \"plot\"\n },\n visible: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc\"\n },\n editType: \"calc\"\n };\n }\n });\n\n // src/components/rangeslider/oppaxis_attributes.js\n var require_oppaxis_attributes = __commonJS({\n \"src/components/rangeslider/oppaxis_attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n // not really a 'subplot' attribute container,\n // but this is the flag we use to denote attributes that\n // support yaxis, yaxis2, yaxis3, ... counters\n _isSubplotObj: true,\n rangemode: {\n valType: \"enumerated\",\n values: [\"auto\", \"fixed\", \"match\"],\n dflt: \"match\",\n editType: \"calc\"\n },\n range: {\n valType: \"info_array\",\n items: [\n { valType: \"any\", editType: \"plot\" },\n { valType: \"any\", editType: \"plot\" }\n ],\n editType: \"plot\"\n },\n editType: \"calc\"\n };\n }\n });\n\n // src/components/rangeslider/constants.js\n var require_constants11 = __commonJS({\n \"src/components/rangeslider/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n // attribute container name\n name: \"rangeslider\",\n // class names\n containerClassName: \"rangeslider-container\",\n bgClassName: \"rangeslider-bg\",\n rangePlotClassName: \"rangeslider-rangeplot\",\n maskMinClassName: \"rangeslider-mask-min\",\n maskMaxClassName: \"rangeslider-mask-max\",\n slideBoxClassName: \"rangeslider-slidebox\",\n grabberMinClassName: \"rangeslider-grabber-min\",\n grabAreaMinClassName: \"rangeslider-grabarea-min\",\n handleMinClassName: \"rangeslider-handle-min\",\n grabberMaxClassName: \"rangeslider-grabber-max\",\n grabAreaMaxClassName: \"rangeslider-grabarea-max\",\n handleMaxClassName: \"rangeslider-handle-max\",\n maskMinOppAxisClassName: \"rangeslider-mask-min-opp-axis\",\n maskMaxOppAxisClassName: \"rangeslider-mask-max-opp-axis\",\n // style constants\n maskColor: \"rgba(0,0,0,0.4)\",\n maskOppAxisColor: \"rgba(0,0,0,0.2)\",\n slideBoxFill: \"transparent\",\n slideBoxCursor: \"ew-resize\",\n grabAreaFill: \"transparent\",\n grabAreaCursor: \"col-resize\",\n grabAreaWidth: 10,\n handleWidth: 4,\n handleRadius: 1,\n handleStrokeWidth: 1,\n extraPad: 15\n };\n }\n });\n\n // src/components/rangeslider/helpers.js\n var require_helpers11 = __commonJS({\n \"src/components/rangeslider/helpers.js\"(exports) {\n \"use strict\";\n var axisIDs = require_axis_ids();\n var svgTextUtils = require_svg_text_utils();\n var constants = require_constants11();\n var LINE_SPACING = require_alignment().LINE_SPACING;\n var name2 = constants.name;\n function isVisible(ax) {\n var rangeSlider = ax && ax[name2];\n return rangeSlider && rangeSlider.visible;\n }\n exports.isVisible = isVisible;\n exports.makeData = function(fullLayout) {\n var axes = axisIDs.list({ _fullLayout: fullLayout }, \"x\", true);\n var margin = fullLayout.margin;\n var rangeSliderData = [];\n for (var i = 0; i < axes.length; i++) {\n var ax = axes[i];\n if (isVisible(ax)) {\n rangeSliderData.push(ax);\n var opts = ax[name2];\n opts._id = name2 + ax._id;\n opts._height = (fullLayout.height - margin.b - margin.t) * opts.thickness;\n opts._offsetShift = Math.floor(opts.borderwidth / 2);\n }\n }\n fullLayout._rangeSliderData = rangeSliderData;\n };\n exports.autoMarginOpts = function(gd, ax) {\n var fullLayout = gd._fullLayout;\n var opts = ax[name2];\n var axLetter = ax._id.charAt(0);\n var bottomDepth = 0;\n var titleHeight = 0;\n if (ax.side === \"bottom\") {\n bottomDepth = ax._depth;\n if (ax.title.text !== fullLayout._dfltTitle[axLetter]) {\n titleHeight = 1.5 * ax.title.font.size + 10 + opts._offsetShift;\n var extraLines = (ax.title.text.match(svgTextUtils.BR_TAG_ALL) || []).length;\n titleHeight += extraLines * ax.title.font.size * LINE_SPACING;\n }\n }\n return {\n x: 0,\n y: ax._counterDomainMin,\n l: 0,\n r: 0,\n t: 0,\n b: opts._height + bottomDepth + Math.max(fullLayout.margin.b, titleHeight),\n pad: constants.extraPad + opts._offsetShift * 2\n };\n };\n }\n });\n\n // src/components/rangeslider/defaults.js\n var require_defaults16 = __commonJS({\n \"src/components/rangeslider/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Template = require_plot_template();\n var axisIds = require_axis_ids();\n var attributes = require_attributes20();\n var oppAxisAttrs = require_oppaxis_attributes();\n module.exports = function handleDefaults(layoutIn, layoutOut, axName) {\n var axIn = layoutIn[axName];\n var axOut = layoutOut[axName];\n if (!(axIn.rangeslider || layoutOut._requestRangeslider[axOut._id])) return;\n if (!Lib.isPlainObject(axIn.rangeslider)) {\n axIn.rangeslider = {};\n }\n var containerIn = axIn.rangeslider;\n var containerOut = Template.newContainer(axOut, \"rangeslider\");\n function coerce(attr, dflt) {\n return Lib.coerce(containerIn, containerOut, attributes, attr, dflt);\n }\n var rangeContainerIn, rangeContainerOut;\n function coerceRange(attr, dflt) {\n return Lib.coerce(rangeContainerIn, rangeContainerOut, oppAxisAttrs, attr, dflt);\n }\n var visible = coerce(\"visible\");\n if (!visible) return;\n coerce(\"bgcolor\", layoutOut.plot_bgcolor);\n coerce(\"bordercolor\");\n coerce(\"borderwidth\");\n coerce(\"thickness\");\n coerce(\"autorange\", !axOut.isValidRange(containerIn.range));\n coerce(\"range\");\n var subplots = layoutOut._subplots;\n if (subplots) {\n var yIds = subplots.cartesian.filter(function(subplotId) {\n return subplotId.substr(0, subplotId.indexOf(\"y\")) === axisIds.name2id(axName);\n }).map(function(subplotId) {\n return subplotId.substr(subplotId.indexOf(\"y\"), subplotId.length);\n });\n var yNames = Lib.simpleMap(yIds, axisIds.id2name);\n for (var i = 0; i < yNames.length; i++) {\n var yName = yNames[i];\n rangeContainerIn = containerIn[yName] || {};\n rangeContainerOut = Template.newContainer(containerOut, yName, \"yaxis\");\n var yAxOut = layoutOut[yName];\n var rangemodeDflt;\n if (rangeContainerIn.range && yAxOut.isValidRange(rangeContainerIn.range)) {\n rangemodeDflt = \"fixed\";\n }\n var rangeMode = coerceRange(\"rangemode\", rangemodeDflt);\n if (rangeMode !== \"match\") {\n coerceRange(\"range\", yAxOut.range.slice());\n }\n }\n }\n containerOut._input = containerIn;\n };\n }\n });\n\n // src/components/rangeslider/calc_autorange.js\n var require_calc_autorange3 = __commonJS({\n \"src/components/rangeslider/calc_autorange.js\"(exports, module) {\n \"use strict\";\n var listAxes = require_axis_ids().list;\n var getAutoRange = require_autorange().getAutoRange;\n var constants = require_constants11();\n module.exports = function calcAutorange(gd) {\n var axes = listAxes(gd, \"x\", true);\n for (var i = 0; i < axes.length; i++) {\n var ax = axes[i];\n var opts = ax[constants.name];\n if (opts && opts.visible && opts.autorange) {\n opts._input.autorange = true;\n opts._input.range = opts.range = getAutoRange(gd, ax);\n }\n }\n };\n }\n });\n\n // src/components/rangeslider/draw.js\n var require_draw9 = __commonJS({\n \"src/components/rangeslider/draw.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Registry = require_registry();\n var Plots = require_plots();\n var Lib = require_lib();\n var strTranslate = Lib.strTranslate;\n var Drawing = require_drawing();\n var Color2 = require_color();\n var Titles = require_titles();\n var Cartesian = require_cartesian();\n var axisIDs = require_axis_ids();\n var dragElement = require_dragelement();\n var setCursor = require_setcursor();\n var constants = require_constants11();\n module.exports = function(gd) {\n var fullLayout = gd._fullLayout;\n var rangeSliderData = fullLayout._rangeSliderData;\n for (var i = 0; i < rangeSliderData.length; i++) {\n var opts = rangeSliderData[i][constants.name];\n opts._clipId = opts._id + \"-\" + fullLayout._uid;\n }\n function keyFunction(axisOpts) {\n return axisOpts._name;\n }\n var rangeSliders = fullLayout._infolayer.selectAll(\"g.\" + constants.containerClassName).data(rangeSliderData, keyFunction);\n rangeSliders.exit().each(function(axisOpts) {\n var opts2 = axisOpts[constants.name];\n fullLayout._topdefs.select(\"#\" + opts2._clipId).remove();\n }).remove();\n if (rangeSliderData.length === 0) return;\n rangeSliders.enter().append(\"g\").classed(constants.containerClassName, true).attr(\"pointer-events\", \"all\");\n rangeSliders.each(function(axisOpts) {\n var rangeSlider = d3.select(this);\n var opts2 = axisOpts[constants.name];\n var oppAxisOpts = fullLayout[axisIDs.id2name(axisOpts.anchor)];\n var oppAxisRangeOpts = opts2[axisIDs.id2name(axisOpts.anchor)];\n if (opts2.range) {\n var rng = Lib.simpleMap(opts2.range, axisOpts.r2l);\n var axRng = Lib.simpleMap(axisOpts.range, axisOpts.r2l);\n var newRng;\n if (axRng[0] < axRng[1]) {\n newRng = [\n Math.min(rng[0], axRng[0]),\n Math.max(rng[1], axRng[1])\n ];\n } else {\n newRng = [\n Math.max(rng[0], axRng[0]),\n Math.min(rng[1], axRng[1])\n ];\n }\n opts2.range = opts2._input.range = Lib.simpleMap(newRng, axisOpts.l2r);\n }\n axisOpts.cleanRange(\"rangeslider.range\");\n var gs = fullLayout._size;\n var domain = axisOpts.domain;\n opts2._width = gs.w * (domain[1] - domain[0]);\n var x = Math.round(gs.l + gs.w * domain[0]);\n var y = Math.round(\n gs.t + gs.h * (1 - axisOpts._counterDomainMin) + (axisOpts.side === \"bottom\" ? axisOpts._depth : 0) + opts2._offsetShift + constants.extraPad\n );\n rangeSlider.attr(\"transform\", strTranslate(x, y));\n opts2._rl = Lib.simpleMap(opts2.range, axisOpts.r2l);\n var rl0 = opts2._rl[0];\n var rl1 = opts2._rl[1];\n var drl = rl1 - rl0;\n opts2.p2d = function(v) {\n return v / opts2._width * drl + rl0;\n };\n opts2.d2p = function(v) {\n return (v - rl0) / drl * opts2._width;\n };\n if (axisOpts.rangebreaks) {\n var rsBreaks = axisOpts.locateBreaks(rl0, rl1);\n if (rsBreaks.length) {\n var j, brk;\n var lBreaks = 0;\n for (j = 0; j < rsBreaks.length; j++) {\n brk = rsBreaks[j];\n lBreaks += brk.max - brk.min;\n }\n var m2 = opts2._width / (rl1 - rl0 - lBreaks);\n var _B = [-m2 * rl0];\n for (j = 0; j < rsBreaks.length; j++) {\n brk = rsBreaks[j];\n _B.push(_B[_B.length - 1] - m2 * (brk.max - brk.min));\n }\n opts2.d2p = function(v) {\n var b = _B[0];\n for (var j2 = 0; j2 < rsBreaks.length; j2++) {\n var brk2 = rsBreaks[j2];\n if (v >= brk2.max) b = _B[j2 + 1];\n else if (v < brk2.min) break;\n }\n return b + m2 * v;\n };\n for (j = 0; j < rsBreaks.length; j++) {\n brk = rsBreaks[j];\n brk.pmin = opts2.d2p(brk.min);\n brk.pmax = opts2.d2p(brk.max);\n }\n opts2.p2d = function(v) {\n var b = _B[0];\n for (var j2 = 0; j2 < rsBreaks.length; j2++) {\n var brk2 = rsBreaks[j2];\n if (v >= brk2.pmax) b = _B[j2 + 1];\n else if (v < brk2.pmin) break;\n }\n return (v - b) / m2;\n };\n }\n }\n if (oppAxisRangeOpts.rangemode !== \"match\") {\n var range0OppAxis = oppAxisOpts.r2l(oppAxisRangeOpts.range[0]);\n var range1OppAxis = oppAxisOpts.r2l(oppAxisRangeOpts.range[1]);\n var distOppAxis = range1OppAxis - range0OppAxis;\n opts2.d2pOppAxis = function(v) {\n return (v - range0OppAxis) / distOppAxis * opts2._height;\n };\n }\n rangeSlider.call(drawBg, gd, axisOpts, opts2).call(addClipPath, gd, axisOpts, opts2).call(drawRangePlot, gd, axisOpts, opts2).call(drawMasks, gd, axisOpts, opts2, oppAxisRangeOpts).call(drawSlideBox, gd, axisOpts, opts2).call(drawGrabbers, gd, axisOpts, opts2);\n setupDragElement(rangeSlider, gd, axisOpts, opts2);\n setPixelRange(rangeSlider, gd, axisOpts, opts2, oppAxisOpts, oppAxisRangeOpts);\n if (axisOpts.side === \"bottom\") {\n Titles.draw(gd, axisOpts._id + \"title\", {\n propContainer: axisOpts,\n propName: axisOpts._name + \".title\",\n placeholder: fullLayout._dfltTitle.x,\n attributes: {\n x: axisOpts._offset + axisOpts._length / 2,\n y: y + opts2._height + opts2._offsetShift + 10 + 1.5 * axisOpts.title.font.size,\n \"text-anchor\": \"middle\"\n }\n });\n }\n });\n };\n function eventX(event) {\n if (typeof event.clientX === \"number\") {\n return event.clientX;\n }\n if (event.touches && event.touches.length > 0) {\n return event.touches[0].clientX;\n }\n return 0;\n }\n function setupDragElement(rangeSlider, gd, axisOpts, opts) {\n if (gd._context.staticPlot) return;\n var slideBox = rangeSlider.select(\"rect.\" + constants.slideBoxClassName).node();\n var grabAreaMin = rangeSlider.select(\"rect.\" + constants.grabAreaMinClassName).node();\n var grabAreaMax = rangeSlider.select(\"rect.\" + constants.grabAreaMaxClassName).node();\n function mouseDownHandler() {\n var event = d3.event;\n var target = event.target;\n var startX = eventX(event);\n var offsetX = startX - rangeSlider.node().getBoundingClientRect().left;\n var minVal = opts.d2p(axisOpts._rl[0]);\n var maxVal = opts.d2p(axisOpts._rl[1]);\n var dragCover = dragElement.coverSlip();\n this.addEventListener(\"touchmove\", mouseMove);\n this.addEventListener(\"touchend\", mouseUp);\n dragCover.addEventListener(\"mousemove\", mouseMove);\n dragCover.addEventListener(\"mouseup\", mouseUp);\n function mouseMove(e) {\n var clientX = eventX(e);\n var delta = +clientX - startX;\n var pixelMin, pixelMax, cursor;\n switch (target) {\n case slideBox:\n cursor = \"ew-resize\";\n if (minVal + delta > axisOpts._length || maxVal + delta < 0) {\n return;\n }\n pixelMin = minVal + delta;\n pixelMax = maxVal + delta;\n break;\n case grabAreaMin:\n cursor = \"col-resize\";\n if (minVal + delta > axisOpts._length) {\n return;\n }\n pixelMin = minVal + delta;\n pixelMax = maxVal;\n break;\n case grabAreaMax:\n cursor = \"col-resize\";\n if (maxVal + delta < 0) {\n return;\n }\n pixelMin = minVal;\n pixelMax = maxVal + delta;\n break;\n default:\n cursor = \"ew-resize\";\n pixelMin = offsetX;\n pixelMax = offsetX + delta;\n break;\n }\n if (pixelMax < pixelMin) {\n var tmp = pixelMax;\n pixelMax = pixelMin;\n pixelMin = tmp;\n }\n opts._pixelMin = pixelMin;\n opts._pixelMax = pixelMax;\n setCursor(d3.select(dragCover), cursor);\n setDataRange(rangeSlider, gd, axisOpts, opts);\n }\n function mouseUp() {\n dragCover.removeEventListener(\"mousemove\", mouseMove);\n dragCover.removeEventListener(\"mouseup\", mouseUp);\n this.removeEventListener(\"touchmove\", mouseMove);\n this.removeEventListener(\"touchend\", mouseUp);\n Lib.removeElement(dragCover);\n }\n }\n rangeSlider.on(\"mousedown\", mouseDownHandler);\n rangeSlider.on(\"touchstart\", mouseDownHandler);\n }\n function setDataRange(rangeSlider, gd, axisOpts, opts) {\n function clamp(v) {\n return axisOpts.l2r(Lib.constrain(v, opts._rl[0], opts._rl[1]));\n }\n var dataMin = clamp(opts.p2d(opts._pixelMin));\n var dataMax = clamp(opts.p2d(opts._pixelMax));\n window.requestAnimationFrame(function() {\n Registry.call(\"_guiRelayout\", gd, axisOpts._name + \".range\", [dataMin, dataMax]);\n });\n }\n function setPixelRange(rangeSlider, gd, axisOpts, opts, oppAxisOpts, oppAxisRangeOpts) {\n var hw2 = constants.handleWidth / 2;\n function clamp(v) {\n return Lib.constrain(v, 0, opts._width);\n }\n function clampOppAxis(v) {\n return Lib.constrain(v, 0, opts._height);\n }\n function clampHandle(v) {\n return Lib.constrain(v, -hw2, opts._width + hw2);\n }\n var pixelMin = clamp(opts.d2p(axisOpts._rl[0]));\n var pixelMax = clamp(opts.d2p(axisOpts._rl[1]));\n rangeSlider.select(\"rect.\" + constants.slideBoxClassName).attr(\"x\", pixelMin).attr(\"width\", pixelMax - pixelMin);\n rangeSlider.select(\"rect.\" + constants.maskMinClassName).attr(\"width\", pixelMin);\n rangeSlider.select(\"rect.\" + constants.maskMaxClassName).attr(\"x\", pixelMax).attr(\"width\", opts._width - pixelMax);\n if (oppAxisRangeOpts.rangemode !== \"match\") {\n var pixelMinOppAxis = opts._height - clampOppAxis(opts.d2pOppAxis(oppAxisOpts._rl[1]));\n var pixelMaxOppAxis = opts._height - clampOppAxis(opts.d2pOppAxis(oppAxisOpts._rl[0]));\n rangeSlider.select(\"rect.\" + constants.maskMinOppAxisClassName).attr(\"x\", pixelMin).attr(\"height\", pixelMinOppAxis).attr(\"width\", pixelMax - pixelMin);\n rangeSlider.select(\"rect.\" + constants.maskMaxOppAxisClassName).attr(\"x\", pixelMin).attr(\"y\", pixelMaxOppAxis).attr(\"height\", opts._height - pixelMaxOppAxis).attr(\"width\", pixelMax - pixelMin);\n rangeSlider.select(\"rect.\" + constants.slideBoxClassName).attr(\"y\", pixelMinOppAxis).attr(\"height\", pixelMaxOppAxis - pixelMinOppAxis);\n }\n var offset = 0.5;\n var xMin = Math.round(clampHandle(pixelMin - hw2)) - offset;\n var xMax = Math.round(clampHandle(pixelMax - hw2)) + offset;\n rangeSlider.select(\"g.\" + constants.grabberMinClassName).attr(\"transform\", strTranslate(xMin, offset));\n rangeSlider.select(\"g.\" + constants.grabberMaxClassName).attr(\"transform\", strTranslate(xMax, offset));\n }\n function drawBg(rangeSlider, gd, axisOpts, opts) {\n var bg = Lib.ensureSingle(rangeSlider, \"rect\", constants.bgClassName, function(s) {\n s.attr({\n x: 0,\n y: 0,\n \"shape-rendering\": \"crispEdges\"\n });\n });\n var borderCorrect = opts.borderwidth % 2 === 0 ? opts.borderwidth : opts.borderwidth - 1;\n var offsetShift = -opts._offsetShift;\n var lw = Drawing.crispRound(gd, opts.borderwidth);\n bg.attr({\n width: opts._width + borderCorrect,\n height: opts._height + borderCorrect,\n transform: strTranslate(offsetShift, offsetShift),\n \"stroke-width\": lw\n }).call(Color2.stroke, opts.bordercolor).call(Color2.fill, opts.bgcolor);\n }\n function addClipPath(rangeSlider, gd, axisOpts, opts) {\n var fullLayout = gd._fullLayout;\n var clipPath = Lib.ensureSingleById(fullLayout._topdefs, \"clipPath\", opts._clipId, function(s) {\n s.append(\"rect\").attr({ x: 0, y: 0 });\n });\n clipPath.select(\"rect\").attr({\n width: opts._width,\n height: opts._height\n });\n }\n function drawRangePlot(rangeSlider, gd, axisOpts, opts) {\n var calcData = gd.calcdata;\n var rangePlots = rangeSlider.selectAll(\"g.\" + constants.rangePlotClassName).data(axisOpts._subplotsWith, Lib.identity);\n rangePlots.enter().append(\"g\").attr(\"class\", function(id) {\n return constants.rangePlotClassName + \" \" + id;\n }).call(Drawing.setClipUrl, opts._clipId, gd);\n rangePlots.order();\n rangePlots.exit().remove();\n var mainplotinfo;\n rangePlots.each(function(id, i) {\n var plotgroup = d3.select(this);\n var isMainPlot = i === 0;\n var oppAxisOpts = axisIDs.getFromId(gd, id, \"y\");\n var oppAxisName = oppAxisOpts._name;\n var oppAxisRangeOpts = opts[oppAxisName];\n var mockFigure = {\n data: [],\n layout: {\n xaxis: {\n type: axisOpts.type,\n domain: [0, 1],\n range: opts.range.slice(),\n calendar: axisOpts.calendar\n },\n width: opts._width,\n height: opts._height,\n margin: { t: 0, b: 0, l: 0, r: 0 }\n },\n _context: gd._context\n };\n if (axisOpts.rangebreaks) {\n mockFigure.layout.xaxis.rangebreaks = axisOpts.rangebreaks;\n }\n mockFigure.layout[oppAxisName] = {\n type: oppAxisOpts.type,\n domain: [0, 1],\n range: oppAxisRangeOpts.rangemode !== \"match\" ? oppAxisRangeOpts.range.slice() : oppAxisOpts.range.slice(),\n calendar: oppAxisOpts.calendar\n };\n if (oppAxisOpts.rangebreaks) {\n mockFigure.layout[oppAxisName].rangebreaks = oppAxisOpts.rangebreaks;\n }\n Plots.supplyDefaults(mockFigure);\n var xa = mockFigure._fullLayout.xaxis;\n var ya = mockFigure._fullLayout[oppAxisName];\n xa.clearCalc();\n xa.setScale();\n ya.clearCalc();\n ya.setScale();\n var plotinfo = {\n id,\n plotgroup,\n xaxis: xa,\n yaxis: ya,\n isRangePlot: true\n };\n if (isMainPlot) mainplotinfo = plotinfo;\n else {\n plotinfo.mainplot = \"xy\";\n plotinfo.mainplotinfo = mainplotinfo;\n }\n Cartesian.rangePlot(gd, plotinfo, filterRangePlotCalcData(calcData, id));\n });\n }\n function filterRangePlotCalcData(calcData, subplotId) {\n var out = [];\n for (var i = 0; i < calcData.length; i++) {\n var calcTrace = calcData[i];\n var trace = calcTrace[0].trace;\n if (trace.xaxis + trace.yaxis === subplotId) {\n out.push(calcTrace);\n }\n }\n return out;\n }\n function drawMasks(rangeSlider, gd, axisOpts, opts, oppAxisRangeOpts) {\n var maskMin = Lib.ensureSingle(rangeSlider, \"rect\", constants.maskMinClassName, function(s) {\n s.attr({\n x: 0,\n y: 0,\n \"shape-rendering\": \"crispEdges\"\n });\n });\n maskMin.attr(\"height\", opts._height).call(Color2.fill, constants.maskColor);\n var maskMax = Lib.ensureSingle(rangeSlider, \"rect\", constants.maskMaxClassName, function(s) {\n s.attr({\n y: 0,\n \"shape-rendering\": \"crispEdges\"\n });\n });\n maskMax.attr(\"height\", opts._height).call(Color2.fill, constants.maskColor);\n if (oppAxisRangeOpts.rangemode !== \"match\") {\n var maskMinOppAxis = Lib.ensureSingle(rangeSlider, \"rect\", constants.maskMinOppAxisClassName, function(s) {\n s.attr({\n y: 0,\n \"shape-rendering\": \"crispEdges\"\n });\n });\n maskMinOppAxis.attr(\"width\", opts._width).call(Color2.fill, constants.maskOppAxisColor);\n var maskMaxOppAxis = Lib.ensureSingle(rangeSlider, \"rect\", constants.maskMaxOppAxisClassName, function(s) {\n s.attr({\n y: 0,\n \"shape-rendering\": \"crispEdges\"\n });\n });\n maskMaxOppAxis.attr(\"width\", opts._width).style(\"border-top\", constants.maskOppBorder).call(Color2.fill, constants.maskOppAxisColor);\n }\n }\n function drawSlideBox(rangeSlider, gd, axisOpts, opts) {\n if (gd._context.staticPlot) return;\n var slideBox = Lib.ensureSingle(rangeSlider, \"rect\", constants.slideBoxClassName, function(s) {\n s.attr({\n y: 0,\n cursor: constants.slideBoxCursor,\n \"shape-rendering\": \"crispEdges\"\n });\n });\n slideBox.attr({\n height: opts._height,\n fill: constants.slideBoxFill\n });\n }\n function drawGrabbers(rangeSlider, gd, axisOpts, opts) {\n var grabberMin = Lib.ensureSingle(rangeSlider, \"g\", constants.grabberMinClassName);\n var grabberMax = Lib.ensureSingle(rangeSlider, \"g\", constants.grabberMaxClassName);\n var handleFixAttrs = {\n x: 0,\n width: constants.handleWidth,\n rx: constants.handleRadius,\n fill: Color2.background,\n stroke: Color2.defaultLine,\n \"stroke-width\": constants.handleStrokeWidth,\n \"shape-rendering\": \"crispEdges\"\n };\n var handleDynamicAttrs = {\n y: Math.round(opts._height / 4),\n height: Math.round(opts._height / 2)\n };\n var handleMin = Lib.ensureSingle(grabberMin, \"rect\", constants.handleMinClassName, function(s) {\n s.attr(handleFixAttrs);\n });\n handleMin.attr(handleDynamicAttrs);\n var handleMax = Lib.ensureSingle(grabberMax, \"rect\", constants.handleMaxClassName, function(s) {\n s.attr(handleFixAttrs);\n });\n handleMax.attr(handleDynamicAttrs);\n var grabAreaFixAttrs = {\n width: constants.grabAreaWidth,\n x: 0,\n y: 0,\n fill: constants.grabAreaFill,\n cursor: !gd._context.staticPlot ? constants.grabAreaCursor : void 0\n };\n var grabAreaMin = Lib.ensureSingle(grabberMin, \"rect\", constants.grabAreaMinClassName, function(s) {\n s.attr(grabAreaFixAttrs);\n });\n grabAreaMin.attr(\"height\", opts._height);\n var grabAreaMax = Lib.ensureSingle(grabberMax, \"rect\", constants.grabAreaMaxClassName, function(s) {\n s.attr(grabAreaFixAttrs);\n });\n grabAreaMax.attr(\"height\", opts._height);\n }\n }\n });\n\n // src/components/rangeslider/index.js\n var require_rangeslider = __commonJS({\n \"src/components/rangeslider/index.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var attrs = require_attributes20();\n var oppAxisAttrs = require_oppaxis_attributes();\n var helpers = require_helpers11();\n module.exports = {\n moduleType: \"component\",\n name: \"rangeslider\",\n schema: {\n subplots: {\n xaxis: {\n rangeslider: Lib.extendFlat({}, attrs, {\n yaxis: oppAxisAttrs\n })\n }\n }\n },\n layoutAttributes: require_attributes20(),\n handleDefaults: require_defaults16(),\n calcAutorange: require_calc_autorange3(),\n draw: require_draw9(),\n isVisible: helpers.isVisible,\n makeData: helpers.makeData,\n autoMarginOpts: helpers.autoMarginOpts\n };\n }\n });\n\n // src/components/rangeselector/attributes.js\n var require_attributes21 = __commonJS({\n \"src/components/rangeselector/attributes.js\"(exports, module) {\n \"use strict\";\n var fontAttrs = require_font_attributes();\n var colorAttrs = require_attributes3();\n var templatedArray = require_plot_template().templatedArray;\n var buttonAttrs = templatedArray(\"button\", {\n visible: {\n valType: \"boolean\",\n dflt: true,\n editType: \"plot\"\n },\n step: {\n valType: \"enumerated\",\n values: [\"month\", \"year\", \"day\", \"hour\", \"minute\", \"second\", \"all\"],\n dflt: \"month\",\n editType: \"plot\"\n },\n stepmode: {\n valType: \"enumerated\",\n values: [\"backward\", \"todate\"],\n dflt: \"backward\",\n editType: \"plot\"\n },\n count: {\n valType: \"number\",\n min: 0,\n dflt: 1,\n editType: \"plot\"\n },\n label: {\n valType: \"string\",\n editType: \"plot\"\n },\n editType: \"plot\"\n });\n module.exports = {\n visible: {\n valType: \"boolean\",\n editType: \"plot\"\n },\n buttons: buttonAttrs,\n x: {\n valType: \"number\",\n min: -2,\n max: 3,\n editType: \"plot\"\n },\n xanchor: {\n valType: \"enumerated\",\n values: [\"auto\", \"left\", \"center\", \"right\"],\n dflt: \"left\",\n editType: \"plot\"\n },\n y: {\n valType: \"number\",\n min: -2,\n max: 3,\n editType: \"plot\"\n },\n yanchor: {\n valType: \"enumerated\",\n values: [\"auto\", \"top\", \"middle\", \"bottom\"],\n dflt: \"bottom\",\n editType: \"plot\"\n },\n font: fontAttrs({\n editType: \"plot\"\n }),\n bgcolor: {\n valType: \"color\",\n dflt: colorAttrs.lightLine,\n editType: \"plot\"\n },\n activecolor: {\n valType: \"color\",\n editType: \"plot\"\n },\n bordercolor: {\n valType: \"color\",\n dflt: colorAttrs.defaultLine,\n editType: \"plot\"\n },\n borderwidth: {\n valType: \"number\",\n min: 0,\n dflt: 0,\n editType: \"plot\"\n },\n editType: \"plot\"\n };\n }\n });\n\n // src/components/rangeselector/constants.js\n var require_constants12 = __commonJS({\n \"src/components/rangeselector/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n // 'y' position pad above counter axis domain\n yPad: 0.02,\n // minimum button width (regardless of text size)\n minButtonWidth: 30,\n // buttons rect radii\n rx: 3,\n ry: 3,\n // light fraction used to compute the 'activecolor' default\n lightAmount: 25,\n darkAmount: 10\n };\n }\n });\n\n // src/components/rangeselector/defaults.js\n var require_defaults17 = __commonJS({\n \"src/components/rangeselector/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Color2 = require_color();\n var Template = require_plot_template();\n var handleArrayContainerDefaults = require_array_container_defaults();\n var attributes = require_attributes21();\n var constants = require_constants12();\n module.exports = function handleDefaults(containerIn, containerOut, layout, counterAxes, calendar) {\n var selectorIn = containerIn.rangeselector || {};\n var selectorOut = Template.newContainer(containerOut, \"rangeselector\");\n function coerce(attr, dflt) {\n return Lib.coerce(selectorIn, selectorOut, attributes, attr, dflt);\n }\n var buttons = handleArrayContainerDefaults(selectorIn, selectorOut, {\n name: \"buttons\",\n handleItemDefaults: buttonDefaults,\n calendar\n });\n var visible = coerce(\"visible\", buttons.length > 0);\n if (visible) {\n var posDflt = getPosDflt(containerOut, layout, counterAxes);\n coerce(\"x\", posDflt[0]);\n coerce(\"y\", posDflt[1]);\n Lib.noneOrAll(containerIn, containerOut, [\"x\", \"y\"]);\n coerce(\"xanchor\");\n coerce(\"yanchor\");\n Lib.coerceFont(coerce, \"font\", layout.font);\n var bgColor = coerce(\"bgcolor\");\n coerce(\"activecolor\", Color2.contrast(bgColor, constants.lightAmount, constants.darkAmount));\n coerce(\"bordercolor\");\n coerce(\"borderwidth\");\n }\n };\n function buttonDefaults(buttonIn, buttonOut, selectorOut, opts) {\n var calendar = opts.calendar;\n function coerce(attr, dflt) {\n return Lib.coerce(buttonIn, buttonOut, attributes.buttons, attr, dflt);\n }\n var visible = coerce(\"visible\");\n if (visible) {\n var step = coerce(\"step\");\n if (step !== \"all\") {\n if (calendar && calendar !== \"gregorian\" && (step === \"month\" || step === \"year\")) {\n buttonOut.stepmode = \"backward\";\n } else {\n coerce(\"stepmode\");\n }\n coerce(\"count\");\n }\n coerce(\"label\");\n }\n }\n function getPosDflt(containerOut, layout, counterAxes) {\n var anchoredList = counterAxes.filter(function(ax) {\n return layout[ax].anchor === containerOut._id;\n });\n var posY = 0;\n for (var i = 0; i < anchoredList.length; i++) {\n var domain = layout[anchoredList[i]].domain;\n if (domain) posY = Math.max(domain[1], posY);\n }\n return [containerOut.domain[0], posY + constants.yPad];\n }\n }\n });\n\n // src/components/rangeselector/get_update_object.js\n var require_get_update_object = __commonJS({\n \"src/components/rangeselector/get_update_object.js\"(exports, module) {\n \"use strict\";\n var d3Time = require_d3_time();\n var titleCase = require_lib().titleCase;\n module.exports = function getUpdateObject(axisLayout, buttonLayout) {\n var axName = axisLayout._name;\n var update = {};\n if (buttonLayout.step === \"all\") {\n update[axName + \".autorange\"] = true;\n } else {\n var xrange = getXRange(axisLayout, buttonLayout);\n update[axName + \".range[0]\"] = xrange[0];\n update[axName + \".range[1]\"] = xrange[1];\n }\n return update;\n };\n function getXRange(axisLayout, buttonLayout) {\n var currentRange = axisLayout.range;\n var base = new Date(axisLayout.r2l(currentRange[1]));\n var step = buttonLayout.step;\n var utcStep = d3Time[\"utc\" + titleCase(step)];\n var count = buttonLayout.count;\n var range0;\n switch (buttonLayout.stepmode) {\n case \"backward\":\n range0 = axisLayout.l2r(+utcStep.offset(base, -count));\n break;\n case \"todate\":\n var base2 = utcStep.offset(base, -count);\n range0 = axisLayout.l2r(+utcStep.ceil(base2));\n break;\n }\n var range1 = currentRange[1];\n return [range0, range1];\n }\n }\n });\n\n // src/components/rangeselector/draw.js\n var require_draw10 = __commonJS({\n \"src/components/rangeselector/draw.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Registry = require_registry();\n var Plots = require_plots();\n var Color2 = require_color();\n var Drawing = require_drawing();\n var Lib = require_lib();\n var strTranslate = Lib.strTranslate;\n var svgTextUtils = require_svg_text_utils();\n var axisIds = require_axis_ids();\n var alignmentConstants = require_alignment();\n var LINE_SPACING = alignmentConstants.LINE_SPACING;\n var FROM_TL = alignmentConstants.FROM_TL;\n var FROM_BR = alignmentConstants.FROM_BR;\n var constants = require_constants12();\n var getUpdateObject = require_get_update_object();\n module.exports = function draw(gd) {\n var fullLayout = gd._fullLayout;\n var selectors = fullLayout._infolayer.selectAll(\".rangeselector\").data(makeSelectorData(gd), selectorKeyFunc);\n selectors.enter().append(\"g\").classed(\"rangeselector\", true);\n selectors.exit().remove();\n selectors.style({\n cursor: \"pointer\",\n \"pointer-events\": \"all\"\n });\n selectors.each(function(d) {\n var selector = d3.select(this);\n var axisLayout = d;\n var selectorLayout = axisLayout.rangeselector;\n var buttons = selector.selectAll(\"g.button\").data(Lib.filterVisible(selectorLayout.buttons));\n buttons.enter().append(\"g\").classed(\"button\", true);\n buttons.exit().remove();\n buttons.each(function(d2) {\n var button = d3.select(this);\n var update = getUpdateObject(axisLayout, d2);\n d2._isActive = isActive(axisLayout, d2, update);\n button.call(drawButtonRect, selectorLayout, d2);\n button.call(drawButtonText, selectorLayout, d2, gd);\n button.on(\"click\", function() {\n if (gd._dragged) return;\n Registry.call(\"_guiRelayout\", gd, update);\n });\n button.on(\"mouseover\", function() {\n d2._isHovered = true;\n button.call(drawButtonRect, selectorLayout, d2);\n });\n button.on(\"mouseout\", function() {\n d2._isHovered = false;\n button.call(drawButtonRect, selectorLayout, d2);\n });\n });\n reposition(gd, buttons, selectorLayout, axisLayout._name, selector);\n });\n };\n function makeSelectorData(gd) {\n var axes = axisIds.list(gd, \"x\", true);\n var data = [];\n for (var i = 0; i < axes.length; i++) {\n var axis = axes[i];\n if (axis.rangeselector && axis.rangeselector.visible) {\n data.push(axis);\n }\n }\n return data;\n }\n function selectorKeyFunc(d) {\n return d._id;\n }\n function isActive(axisLayout, opts, update) {\n if (opts.step === \"all\") {\n return axisLayout.autorange === true;\n } else {\n var keys = Object.keys(update);\n return axisLayout.range[0] === update[keys[0]] && axisLayout.range[1] === update[keys[1]];\n }\n }\n function drawButtonRect(button, selectorLayout, d) {\n var rect = Lib.ensureSingle(button, \"rect\", \"selector-rect\", function(s) {\n s.attr(\"shape-rendering\", \"crispEdges\");\n });\n rect.attr({\n rx: constants.rx,\n ry: constants.ry\n });\n rect.call(Color2.stroke, selectorLayout.bordercolor).call(Color2.fill, getFillColor(selectorLayout, d)).style(\"stroke-width\", selectorLayout.borderwidth + \"px\");\n }\n function getFillColor(selectorLayout, d) {\n return d._isActive || d._isHovered ? selectorLayout.activecolor : selectorLayout.bgcolor;\n }\n function drawButtonText(button, selectorLayout, d, gd) {\n function textLayout(s) {\n svgTextUtils.convertToTspans(s, gd);\n }\n var text = Lib.ensureSingle(button, \"text\", \"selector-text\", function(s) {\n s.attr(\"text-anchor\", \"middle\");\n });\n text.call(Drawing.font, selectorLayout.font).text(getLabel(d, gd._fullLayout._meta)).call(textLayout);\n }\n function getLabel(opts, _meta) {\n if (opts.label) {\n return _meta ? Lib.templateString(opts.label, _meta) : opts.label;\n }\n if (opts.step === \"all\") return \"all\";\n return opts.count + opts.step.charAt(0);\n }\n function reposition(gd, buttons, opts, axName, selector) {\n var width = 0;\n var height = 0;\n var borderWidth = opts.borderwidth;\n buttons.each(function() {\n var button = d3.select(this);\n var text = button.select(\".selector-text\");\n var tHeight = opts.font.size * LINE_SPACING;\n var hEff = Math.max(tHeight * svgTextUtils.lineCount(text), 16) + 3;\n height = Math.max(height, hEff);\n });\n buttons.each(function() {\n var button = d3.select(this);\n var rect = button.select(\".selector-rect\");\n var text = button.select(\".selector-text\");\n var tWidth = text.node() && Drawing.bBox(text.node()).width;\n var tHeight = opts.font.size * LINE_SPACING;\n var tLines = svgTextUtils.lineCount(text);\n var wEff = Math.max(tWidth + 10, constants.minButtonWidth);\n button.attr(\"transform\", strTranslate(borderWidth + width, borderWidth));\n rect.attr({\n x: 0,\n y: 0,\n width: wEff,\n height\n });\n svgTextUtils.positionText(\n text,\n wEff / 2,\n height / 2 - (tLines - 1) * tHeight / 2 + 3\n );\n width += wEff + 5;\n });\n var graphSize = gd._fullLayout._size;\n var lx = graphSize.l + graphSize.w * opts.x;\n var ly = graphSize.t + graphSize.h * (1 - opts.y);\n var xanchor = \"left\";\n if (Lib.isRightAnchor(opts)) {\n lx -= width;\n xanchor = \"right\";\n }\n if (Lib.isCenterAnchor(opts)) {\n lx -= width / 2;\n xanchor = \"center\";\n }\n var yanchor = \"top\";\n if (Lib.isBottomAnchor(opts)) {\n ly -= height;\n yanchor = \"bottom\";\n }\n if (Lib.isMiddleAnchor(opts)) {\n ly -= height / 2;\n yanchor = \"middle\";\n }\n width = Math.ceil(width);\n height = Math.ceil(height);\n lx = Math.round(lx);\n ly = Math.round(ly);\n Plots.autoMargin(gd, axName + \"-range-selector\", {\n x: opts.x,\n y: opts.y,\n l: width * FROM_TL[xanchor],\n r: width * FROM_BR[xanchor],\n b: height * FROM_BR[yanchor],\n t: height * FROM_TL[yanchor]\n });\n selector.attr(\"transform\", strTranslate(lx, ly));\n }\n }\n });\n\n // src/components/rangeselector/index.js\n var require_rangeselector = __commonJS({\n \"src/components/rangeselector/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"component\",\n name: \"rangeselector\",\n schema: {\n subplots: {\n xaxis: { rangeselector: require_attributes21() }\n }\n },\n layoutAttributes: require_attributes21(),\n handleDefaults: require_defaults17(),\n draw: require_draw10()\n };\n }\n });\n\n // src/plots/domain.js\n var require_domain = __commonJS({\n \"src/plots/domain.js\"(exports) {\n \"use strict\";\n var extendFlat = require_extend().extendFlat;\n exports.attributes = function(opts, extra) {\n opts = opts || {};\n extra = extra || {};\n var base = {\n valType: \"info_array\",\n editType: opts.editType,\n items: [\n { valType: \"number\", min: 0, max: 1, editType: opts.editType },\n { valType: \"number\", min: 0, max: 1, editType: opts.editType }\n ],\n dflt: [0, 1]\n };\n var namePart = opts.name ? opts.name + \" \" : \"\";\n var contPart = opts.trace ? \"trace \" : \"subplot \";\n var descPart = extra.description ? \" \" + extra.description : \"\";\n var out = {\n x: extendFlat({}, base, {}),\n y: extendFlat({}, base, {}),\n editType: opts.editType\n };\n if (!opts.noGridCell) {\n out.row = {\n valType: \"integer\",\n min: 0,\n dflt: 0,\n editType: opts.editType\n };\n out.column = {\n valType: \"integer\",\n min: 0,\n dflt: 0,\n editType: opts.editType\n };\n }\n return out;\n };\n exports.defaults = function(containerOut, layout, coerce, dfltDomains) {\n var dfltX = dfltDomains && dfltDomains.x || [0, 1];\n var dfltY = dfltDomains && dfltDomains.y || [0, 1];\n var grid = layout.grid;\n if (grid) {\n var column = coerce(\"domain.column\");\n if (column !== void 0) {\n if (column < grid.columns) dfltX = grid._domains.x[column];\n else delete containerOut.domain.column;\n }\n var row = coerce(\"domain.row\");\n if (row !== void 0) {\n if (row < grid.rows) dfltY = grid._domains.y[row];\n else delete containerOut.domain.row;\n }\n }\n var x = coerce(\"domain.x\", dfltX);\n var y = coerce(\"domain.y\", dfltY);\n if (!(x[0] < x[1])) containerOut.domain.x = dfltX.slice();\n if (!(y[0] < y[1])) containerOut.domain.y = dfltY.slice();\n };\n }\n });\n\n // src/components/grid/index.js\n var require_grid = __commonJS({\n \"src/components/grid/index.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var counterRegex = require_regex().counter;\n var domainAttrs = require_domain().attributes;\n var cartesianIdRegex = require_constants2().idRegex;\n var Template = require_plot_template();\n var gridAttrs = {\n rows: {\n valType: \"integer\",\n min: 1,\n editType: \"plot\"\n },\n roworder: {\n valType: \"enumerated\",\n values: [\"top to bottom\", \"bottom to top\"],\n dflt: \"top to bottom\",\n editType: \"plot\"\n },\n columns: {\n valType: \"integer\",\n min: 1,\n editType: \"plot\"\n },\n subplots: {\n valType: \"info_array\",\n freeLength: true,\n dimensions: 2,\n items: { valType: \"enumerated\", values: [counterRegex(\"xy\").toString(), \"\"], editType: \"plot\" },\n editType: \"plot\"\n },\n xaxes: {\n valType: \"info_array\",\n freeLength: true,\n items: { valType: \"enumerated\", values: [cartesianIdRegex.x.toString(), \"\"], editType: \"plot\" },\n editType: \"plot\"\n },\n yaxes: {\n valType: \"info_array\",\n freeLength: true,\n items: { valType: \"enumerated\", values: [cartesianIdRegex.y.toString(), \"\"], editType: \"plot\" },\n editType: \"plot\"\n },\n pattern: {\n valType: \"enumerated\",\n values: [\"independent\", \"coupled\"],\n dflt: \"coupled\",\n editType: \"plot\"\n },\n xgap: {\n valType: \"number\",\n min: 0,\n max: 1,\n editType: \"plot\"\n },\n ygap: {\n valType: \"number\",\n min: 0,\n max: 1,\n editType: \"plot\"\n },\n domain: domainAttrs({ name: \"grid\", editType: \"plot\", noGridCell: true }, {}),\n xside: {\n valType: \"enumerated\",\n values: [\"bottom\", \"bottom plot\", \"top plot\", \"top\"],\n dflt: \"bottom plot\",\n editType: \"plot\"\n },\n yside: {\n valType: \"enumerated\",\n values: [\"left\", \"left plot\", \"right plot\", \"right\"],\n dflt: \"left plot\",\n editType: \"plot\"\n },\n editType: \"plot\"\n };\n function getAxes(layout, grid, axLetter) {\n var gridVal = grid[axLetter + \"axes\"];\n var splomVal = Object.keys((layout._splomAxes || {})[axLetter] || {});\n if (Array.isArray(gridVal)) return gridVal;\n if (splomVal.length) return splomVal;\n }\n function sizeDefaults(layoutIn, layoutOut) {\n var gridIn = layoutIn.grid || {};\n var xAxes = getAxes(layoutOut, gridIn, \"x\");\n var yAxes = getAxes(layoutOut, gridIn, \"y\");\n if (!layoutIn.grid && !xAxes && !yAxes) return;\n var hasSubplotGrid = Array.isArray(gridIn.subplots) && Array.isArray(gridIn.subplots[0]);\n var hasXaxes = Array.isArray(xAxes);\n var hasYaxes = Array.isArray(yAxes);\n var isSplomGenerated = hasXaxes && xAxes !== gridIn.xaxes && hasYaxes && yAxes !== gridIn.yaxes;\n var dfltRows, dfltColumns;\n if (hasSubplotGrid) {\n dfltRows = gridIn.subplots.length;\n dfltColumns = gridIn.subplots[0].length;\n } else {\n if (hasYaxes) dfltRows = yAxes.length;\n if (hasXaxes) dfltColumns = xAxes.length;\n }\n var gridOut = Template.newContainer(layoutOut, \"grid\");\n function coerce(attr, dflt) {\n return Lib.coerce(gridIn, gridOut, gridAttrs, attr, dflt);\n }\n var rows = coerce(\"rows\", dfltRows);\n var columns = coerce(\"columns\", dfltColumns);\n if (!(rows * columns > 1)) {\n delete layoutOut.grid;\n return;\n }\n if (!hasSubplotGrid && !hasXaxes && !hasYaxes) {\n var useDefaultSubplots = coerce(\"pattern\") === \"independent\";\n if (useDefaultSubplots) hasSubplotGrid = true;\n }\n gridOut._hasSubplotGrid = hasSubplotGrid;\n var rowOrder = coerce(\"roworder\");\n var reversed = rowOrder === \"top to bottom\";\n var dfltGapX = hasSubplotGrid ? 0.2 : 0.1;\n var dfltGapY = hasSubplotGrid ? 0.3 : 0.1;\n var dfltSideX, dfltSideY;\n if (isSplomGenerated && layoutOut._splomGridDflt) {\n dfltSideX = layoutOut._splomGridDflt.xside;\n dfltSideY = layoutOut._splomGridDflt.yside;\n }\n gridOut._domains = {\n x: fillGridPositions(\"x\", coerce, dfltGapX, dfltSideX, columns),\n y: fillGridPositions(\"y\", coerce, dfltGapY, dfltSideY, rows, reversed)\n };\n }\n function fillGridPositions(axLetter, coerce, dfltGap, dfltSide, len, reversed) {\n var dirGap = coerce(axLetter + \"gap\", dfltGap);\n var domain = coerce(\"domain.\" + axLetter);\n coerce(axLetter + \"side\", dfltSide);\n var out = new Array(len);\n var start = domain[0];\n var step = (domain[1] - start) / (len - dirGap);\n var cellDomain = step * (1 - dirGap);\n for (var i = 0; i < len; i++) {\n var cellStart = start + step * i;\n out[reversed ? len - 1 - i : i] = [cellStart, cellStart + cellDomain];\n }\n return out;\n }\n function contentDefaults(layoutIn, layoutOut) {\n var gridOut = layoutOut.grid;\n if (!gridOut || !gridOut._domains) return;\n var gridIn = layoutIn.grid || {};\n var subplots = layoutOut._subplots;\n var hasSubplotGrid = gridOut._hasSubplotGrid;\n var rows = gridOut.rows;\n var columns = gridOut.columns;\n var useDefaultSubplots = gridOut.pattern === \"independent\";\n var i, j, xId, yId, subplotId, subplotsOut, yPos;\n var axisMap = gridOut._axisMap = {};\n if (hasSubplotGrid) {\n var subplotsIn = gridIn.subplots || [];\n subplotsOut = gridOut.subplots = new Array(rows);\n var index = 1;\n for (i = 0; i < rows; i++) {\n var rowOut = subplotsOut[i] = new Array(columns);\n var rowIn = subplotsIn[i] || [];\n for (j = 0; j < columns; j++) {\n if (useDefaultSubplots) {\n subplotId = index === 1 ? \"xy\" : \"x\" + index + \"y\" + index;\n index++;\n } else subplotId = rowIn[j];\n rowOut[j] = \"\";\n if (subplots.cartesian.indexOf(subplotId) !== -1) {\n yPos = subplotId.indexOf(\"y\");\n xId = subplotId.slice(0, yPos);\n yId = subplotId.slice(yPos);\n if (axisMap[xId] !== void 0 && axisMap[xId] !== j || axisMap[yId] !== void 0 && axisMap[yId] !== i) {\n continue;\n }\n rowOut[j] = subplotId;\n axisMap[xId] = j;\n axisMap[yId] = i;\n }\n }\n }\n } else {\n var xAxes = getAxes(layoutOut, gridIn, \"x\");\n var yAxes = getAxes(layoutOut, gridIn, \"y\");\n gridOut.xaxes = fillGridAxes(xAxes, subplots.xaxis, columns, axisMap, \"x\");\n gridOut.yaxes = fillGridAxes(yAxes, subplots.yaxis, rows, axisMap, \"y\");\n }\n var anchors = gridOut._anchors = {};\n var reversed = gridOut.roworder === \"top to bottom\";\n for (var axisId in axisMap) {\n var axLetter = axisId.charAt(0);\n var side = gridOut[axLetter + \"side\"];\n var i0, inc, iFinal;\n if (side.length < 8) {\n anchors[axisId] = \"free\";\n } else if (axLetter === \"x\") {\n if (side.charAt(0) === \"t\" === reversed) {\n i0 = 0;\n inc = 1;\n iFinal = rows;\n } else {\n i0 = rows - 1;\n inc = -1;\n iFinal = -1;\n }\n if (hasSubplotGrid) {\n var column = axisMap[axisId];\n for (i = i0; i !== iFinal; i += inc) {\n subplotId = subplotsOut[i][column];\n if (!subplotId) continue;\n yPos = subplotId.indexOf(\"y\");\n if (subplotId.slice(0, yPos) === axisId) {\n anchors[axisId] = subplotId.slice(yPos);\n break;\n }\n }\n } else {\n for (i = i0; i !== iFinal; i += inc) {\n yId = gridOut.yaxes[i];\n if (subplots.cartesian.indexOf(axisId + yId) !== -1) {\n anchors[axisId] = yId;\n break;\n }\n }\n }\n } else {\n if (side.charAt(0) === \"l\") {\n i0 = 0;\n inc = 1;\n iFinal = columns;\n } else {\n i0 = columns - 1;\n inc = -1;\n iFinal = -1;\n }\n if (hasSubplotGrid) {\n var row = axisMap[axisId];\n for (i = i0; i !== iFinal; i += inc) {\n subplotId = subplotsOut[row][i];\n if (!subplotId) continue;\n yPos = subplotId.indexOf(\"y\");\n if (subplotId.slice(yPos) === axisId) {\n anchors[axisId] = subplotId.slice(0, yPos);\n break;\n }\n }\n } else {\n for (i = i0; i !== iFinal; i += inc) {\n xId = gridOut.xaxes[i];\n if (subplots.cartesian.indexOf(xId + axisId) !== -1) {\n anchors[axisId] = xId;\n break;\n }\n }\n }\n }\n }\n }\n function fillGridAxes(axesIn, axesAllowed, len, axisMap, axLetter) {\n var out = new Array(len);\n var i;\n function fillOneAxis(i2, axisId) {\n if (axesAllowed.indexOf(axisId) !== -1 && axisMap[axisId] === void 0) {\n out[i2] = axisId;\n axisMap[axisId] = i2;\n } else out[i2] = \"\";\n }\n if (Array.isArray(axesIn)) {\n for (i = 0; i < len; i++) {\n fillOneAxis(i, axesIn[i]);\n }\n } else {\n fillOneAxis(0, axLetter);\n for (i = 1; i < len; i++) {\n fillOneAxis(i, axLetter + (i + 1));\n }\n }\n return out;\n }\n module.exports = {\n moduleType: \"component\",\n name: \"grid\",\n schema: {\n layout: { grid: gridAttrs }\n },\n layoutAttributes: gridAttrs,\n sizeDefaults,\n contentDefaults\n };\n }\n });\n\n // src/components/errorbars/attributes.js\n var require_attributes22 = __commonJS({\n \"src/components/errorbars/attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n visible: {\n valType: \"boolean\",\n editType: \"calc\"\n },\n type: {\n valType: \"enumerated\",\n values: [\"percent\", \"constant\", \"sqrt\", \"data\"],\n editType: \"calc\"\n },\n symmetric: {\n valType: \"boolean\",\n editType: \"calc\"\n },\n array: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n arrayminus: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n value: {\n valType: \"number\",\n min: 0,\n dflt: 10,\n editType: \"calc\"\n },\n valueminus: {\n valType: \"number\",\n min: 0,\n dflt: 10,\n editType: \"calc\"\n },\n traceref: {\n valType: \"integer\",\n min: 0,\n dflt: 0,\n editType: \"style\"\n },\n tracerefminus: {\n valType: \"integer\",\n min: 0,\n dflt: 0,\n editType: \"style\"\n },\n copy_ystyle: {\n valType: \"boolean\",\n editType: \"plot\"\n },\n copy_zstyle: {\n valType: \"boolean\",\n editType: \"style\"\n },\n color: {\n valType: \"color\",\n editType: \"style\"\n },\n thickness: {\n valType: \"number\",\n min: 0,\n dflt: 2,\n editType: \"style\"\n },\n width: {\n valType: \"number\",\n min: 0,\n editType: \"plot\"\n },\n editType: \"calc\"\n };\n }\n });\n\n // src/components/errorbars/defaults.js\n var require_defaults18 = __commonJS({\n \"src/components/errorbars/defaults.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Registry = require_registry();\n var Lib = require_lib();\n var Template = require_plot_template();\n var attributes = require_attributes22();\n module.exports = function(traceIn, traceOut, defaultColor, opts) {\n var objName = \"error_\" + opts.axis;\n var containerOut = Template.newContainer(traceOut, objName);\n var containerIn = traceIn[objName] || {};\n function coerce(attr, dflt) {\n return Lib.coerce(containerIn, containerOut, attributes, attr, dflt);\n }\n var hasErrorBars = containerIn.array !== void 0 || containerIn.value !== void 0 || containerIn.type === \"sqrt\";\n var visible = coerce(\"visible\", hasErrorBars);\n if (visible === false) return;\n var type = coerce(\"type\", \"array\" in containerIn ? \"data\" : \"percent\");\n var symmetric = true;\n if (type !== \"sqrt\") {\n symmetric = coerce(\n \"symmetric\",\n !((type === \"data\" ? \"arrayminus\" : \"valueminus\") in containerIn)\n );\n }\n if (type === \"data\") {\n coerce(\"array\");\n coerce(\"traceref\");\n if (!symmetric) {\n coerce(\"arrayminus\");\n coerce(\"tracerefminus\");\n }\n } else if (type === \"percent\" || type === \"constant\") {\n coerce(\"value\");\n if (!symmetric) coerce(\"valueminus\");\n }\n var copyAttr = \"copy_\" + opts.inherit + \"style\";\n if (opts.inherit) {\n var inheritObj = traceOut[\"error_\" + opts.inherit];\n if ((inheritObj || {}).visible) {\n coerce(copyAttr, !(containerIn.color || isNumeric(containerIn.thickness) || isNumeric(containerIn.width)));\n }\n }\n if (!opts.inherit || !containerOut[copyAttr]) {\n coerce(\"color\", defaultColor);\n coerce(\"thickness\");\n coerce(\"width\", Registry.traceIs(traceOut, \"gl3d\") ? 0 : 4);\n }\n };\n }\n });\n\n // src/components/errorbars/compute_error.js\n var require_compute_error = __commonJS({\n \"src/components/errorbars/compute_error.js\"(exports, module) {\n \"use strict\";\n module.exports = function makeComputeError(opts) {\n var type = opts.type;\n var symmetric = opts.symmetric;\n if (type === \"data\") {\n var array = opts.array || [];\n if (symmetric) {\n return function computeError(dataPt, index) {\n var val = +array[index];\n return [val, val];\n };\n } else {\n var arrayminus = opts.arrayminus || [];\n return function computeError(dataPt, index) {\n var val = +array[index];\n var valMinus = +arrayminus[index];\n if (!isNaN(val) || !isNaN(valMinus)) {\n return [valMinus || 0, val || 0];\n }\n return [NaN, NaN];\n };\n }\n } else {\n var computeErrorValue = makeComputeErrorValue(type, opts.value);\n var computeErrorValueMinus = makeComputeErrorValue(type, opts.valueminus);\n if (symmetric || opts.valueminus === void 0) {\n return function computeError(dataPt) {\n var val = computeErrorValue(dataPt);\n return [val, val];\n };\n } else {\n return function computeError(dataPt) {\n return [\n computeErrorValueMinus(dataPt),\n computeErrorValue(dataPt)\n ];\n };\n }\n }\n };\n function makeComputeErrorValue(type, value) {\n if (type === \"percent\") {\n return function(dataPt) {\n return Math.abs(dataPt * value / 100);\n };\n }\n if (type === \"constant\") {\n return function() {\n return Math.abs(value);\n };\n }\n if (type === \"sqrt\") {\n return function(dataPt) {\n return Math.sqrt(Math.abs(dataPt));\n };\n }\n }\n }\n });\n\n // src/components/errorbars/calc.js\n var require_calc4 = __commonJS({\n \"src/components/errorbars/calc.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Registry = require_registry();\n var Axes = require_axes();\n var Lib = require_lib();\n var makeComputeError = require_compute_error();\n module.exports = function calc(gd) {\n var calcdata = gd.calcdata;\n for (var i = 0; i < calcdata.length; i++) {\n var calcTrace = calcdata[i];\n var trace = calcTrace[0].trace;\n if (trace.visible === true && Registry.traceIs(trace, \"errorBarsOK\")) {\n var xa = Axes.getFromId(gd, trace.xaxis);\n var ya = Axes.getFromId(gd, trace.yaxis);\n calcOneAxis(calcTrace, trace, xa, \"x\");\n calcOneAxis(calcTrace, trace, ya, \"y\");\n }\n }\n };\n function calcOneAxis(calcTrace, trace, axis, coord) {\n var opts = trace[\"error_\" + coord] || {};\n var isVisible = opts.visible && [\"linear\", \"log\"].indexOf(axis.type) !== -1;\n var vals = [];\n if (!isVisible) return;\n var computeError = makeComputeError(opts);\n for (var i = 0; i < calcTrace.length; i++) {\n var calcPt = calcTrace[i];\n var iIn = calcPt.i;\n if (iIn === void 0) iIn = i;\n else if (iIn === null) continue;\n var calcCoord = calcPt[coord];\n if (!isNumeric(axis.c2l(calcCoord))) continue;\n var errors = computeError(calcCoord, iIn);\n if (isNumeric(errors[0]) && isNumeric(errors[1])) {\n var shoe = calcPt[coord + \"s\"] = calcCoord - errors[0];\n var hat = calcPt[coord + \"h\"] = calcCoord + errors[1];\n vals.push(shoe, hat);\n }\n }\n var axId = axis._id;\n var baseExtremes = trace._extremes[axId];\n var extremes = Axes.findExtremes(\n axis,\n vals,\n Lib.extendFlat({ tozero: baseExtremes.opts.tozero }, { padded: true })\n );\n baseExtremes.min = baseExtremes.min.concat(extremes.min);\n baseExtremes.max = baseExtremes.max.concat(extremes.max);\n }\n }\n });\n\n // src/components/errorbars/plot.js\n var require_plot2 = __commonJS({\n \"src/components/errorbars/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var isNumeric = require_fast_isnumeric();\n var Drawing = require_drawing();\n var subTypes = require_subtypes();\n module.exports = function plot(gd, traces, plotinfo, transitionOpts) {\n var isNew;\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var hasAnimation = transitionOpts && transitionOpts.duration > 0;\n var isStatic = gd._context.staticPlot;\n traces.each(function(d) {\n var trace = d[0].trace;\n var xObj = trace.error_x || {};\n var yObj = trace.error_y || {};\n var keyFunc;\n if (trace.ids) {\n keyFunc = function(d2) {\n return d2.id;\n };\n }\n var sparse = subTypes.hasMarkers(trace) && trace.marker.maxdisplayed > 0;\n if (!yObj.visible && !xObj.visible) d = [];\n var errorbars = d3.select(this).selectAll(\"g.errorbar\").data(d, keyFunc);\n errorbars.exit().remove();\n if (!d.length) return;\n if (!xObj.visible) errorbars.selectAll(\"path.xerror\").remove();\n if (!yObj.visible) errorbars.selectAll(\"path.yerror\").remove();\n errorbars.style(\"opacity\", 1);\n var enter = errorbars.enter().append(\"g\").classed(\"errorbar\", true);\n if (hasAnimation) {\n enter.style(\"opacity\", 0).transition().duration(transitionOpts.duration).style(\"opacity\", 1);\n }\n Drawing.setClipUrl(errorbars, plotinfo.layerClipId, gd);\n errorbars.each(function(d2) {\n var errorbar = d3.select(this);\n var coords = errorCoords(d2, xa, ya);\n if (sparse && !d2.vis) return;\n var path;\n var yerror = errorbar.select(\"path.yerror\");\n if (yObj.visible && isNumeric(coords.x) && isNumeric(coords.yh) && isNumeric(coords.ys)) {\n var yw = yObj.width;\n path = \"M\" + (coords.x - yw) + \",\" + coords.yh + \"h\" + 2 * yw + // hat\n \"m-\" + yw + \",0V\" + coords.ys;\n if (!coords.noYS) path += \"m-\" + yw + \",0h\" + 2 * yw;\n isNew = !yerror.size();\n if (isNew) {\n yerror = errorbar.append(\"path\").style(\"vector-effect\", isStatic ? \"none\" : \"non-scaling-stroke\").classed(\"yerror\", true);\n } else if (hasAnimation) {\n yerror = yerror.transition().duration(transitionOpts.duration).ease(transitionOpts.easing);\n }\n yerror.attr(\"d\", path);\n } else yerror.remove();\n var xerror = errorbar.select(\"path.xerror\");\n if (xObj.visible && isNumeric(coords.y) && isNumeric(coords.xh) && isNumeric(coords.xs)) {\n var xw = (xObj.copy_ystyle ? yObj : xObj).width;\n path = \"M\" + coords.xh + \",\" + (coords.y - xw) + \"v\" + 2 * xw + // hat\n \"m0,-\" + xw + \"H\" + coords.xs;\n if (!coords.noXS) path += \"m0,-\" + xw + \"v\" + 2 * xw;\n isNew = !xerror.size();\n if (isNew) {\n xerror = errorbar.append(\"path\").style(\"vector-effect\", isStatic ? \"none\" : \"non-scaling-stroke\").classed(\"xerror\", true);\n } else if (hasAnimation) {\n xerror = xerror.transition().duration(transitionOpts.duration).ease(transitionOpts.easing);\n }\n xerror.attr(\"d\", path);\n } else xerror.remove();\n });\n });\n };\n function errorCoords(d, xa, ya) {\n var out = {\n x: xa.c2p(d.x),\n y: ya.c2p(d.y)\n };\n if (d.yh !== void 0) {\n out.yh = ya.c2p(d.yh);\n out.ys = ya.c2p(d.ys);\n if (!isNumeric(out.ys)) {\n out.noYS = true;\n out.ys = ya.c2p(d.ys, true);\n }\n }\n if (d.xh !== void 0) {\n out.xh = xa.c2p(d.xh);\n out.xs = xa.c2p(d.xs);\n if (!isNumeric(out.xs)) {\n out.noXS = true;\n out.xs = xa.c2p(d.xs, true);\n }\n }\n return out;\n }\n }\n });\n\n // src/components/errorbars/style.js\n var require_style3 = __commonJS({\n \"src/components/errorbars/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Color2 = require_color();\n module.exports = function style(traces) {\n traces.each(function(d) {\n var trace = d[0].trace;\n var yObj = trace.error_y || {};\n var xObj = trace.error_x || {};\n var s = d3.select(this);\n s.selectAll(\"path.yerror\").style(\"stroke-width\", yObj.thickness + \"px\").call(Color2.stroke, yObj.color);\n if (xObj.copy_ystyle) xObj = yObj;\n s.selectAll(\"path.xerror\").style(\"stroke-width\", xObj.thickness + \"px\").call(Color2.stroke, xObj.color);\n });\n };\n }\n });\n\n // src/components/errorbars/index.js\n var require_errorbars = __commonJS({\n \"src/components/errorbars/index.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var overrideAll = require_edit_types().overrideAll;\n var attributes = require_attributes22();\n var xyAttrs = {\n error_x: Lib.extendFlat({}, attributes),\n error_y: Lib.extendFlat({}, attributes)\n };\n delete xyAttrs.error_x.copy_zstyle;\n delete xyAttrs.error_y.copy_zstyle;\n delete xyAttrs.error_y.copy_ystyle;\n var xyzAttrs = {\n error_x: Lib.extendFlat({}, attributes),\n error_y: Lib.extendFlat({}, attributes),\n error_z: Lib.extendFlat({}, attributes)\n };\n delete xyzAttrs.error_x.copy_ystyle;\n delete xyzAttrs.error_y.copy_ystyle;\n delete xyzAttrs.error_z.copy_ystyle;\n delete xyzAttrs.error_z.copy_zstyle;\n module.exports = {\n moduleType: \"component\",\n name: \"errorbars\",\n schema: {\n traces: {\n scatter: xyAttrs,\n bar: xyAttrs,\n histogram: xyAttrs,\n scatter3d: overrideAll(xyzAttrs, \"calc\", \"nested\"),\n scattergl: overrideAll(xyAttrs, \"calc\", \"nested\")\n }\n },\n supplyDefaults: require_defaults18(),\n calc: require_calc4(),\n makeComputeError: require_compute_error(),\n plot: require_plot2(),\n style: require_style3(),\n hoverInfo\n };\n function hoverInfo(calcPoint, trace, hoverPoint) {\n if ((trace.error_y || {}).visible) {\n hoverPoint.yerr = calcPoint.yh - calcPoint.y;\n if (!trace.error_y.symmetric) hoverPoint.yerrneg = calcPoint.y - calcPoint.ys;\n }\n if ((trace.error_x || {}).visible) {\n hoverPoint.xerr = calcPoint.xh - calcPoint.x;\n if (!trace.error_x.symmetric) hoverPoint.xerrneg = calcPoint.x - calcPoint.xs;\n }\n }\n }\n });\n\n // src/components/colorbar/constants.js\n var require_constants13 = __commonJS({\n \"src/components/colorbar/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n cn: {\n colorbar: \"colorbar\",\n cbbg: \"cbbg\",\n cbfill: \"cbfill\",\n cbfills: \"cbfills\",\n cbline: \"cbline\",\n cblines: \"cblines\",\n cbaxis: \"cbaxis\",\n cbtitleunshift: \"cbtitleunshift\",\n cbtitle: \"cbtitle\",\n cboutline: \"cboutline\",\n crisp: \"crisp\",\n jsPlaceholder: \"js-placeholder\"\n }\n };\n }\n });\n\n // src/components/colorbar/draw.js\n var require_draw11 = __commonJS({\n \"src/components/colorbar/draw.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var tinycolor = require_tinycolor();\n var Plots = require_plots();\n var Registry = require_registry();\n var Axes = require_axes();\n var dragElement = require_dragelement();\n var Lib = require_lib();\n var strTranslate = Lib.strTranslate;\n var extendFlat = require_extend().extendFlat;\n var setCursor = require_setcursor();\n var Drawing = require_drawing();\n var Color2 = require_color();\n var Titles = require_titles();\n var svgTextUtils = require_svg_text_utils();\n var flipScale = require_helpers().flipScale;\n var handleAxisDefaults = require_axis_defaults();\n var handleAxisPositionDefaults = require_position_defaults();\n var axisLayoutAttrs = require_layout_attributes4();\n var alignmentConstants = require_alignment();\n var LINE_SPACING = alignmentConstants.LINE_SPACING;\n var FROM_TL = alignmentConstants.FROM_TL;\n var FROM_BR = alignmentConstants.FROM_BR;\n var cn = require_constants13().cn;\n function draw(gd) {\n var fullLayout = gd._fullLayout;\n var colorBars = fullLayout._infolayer.selectAll(\"g.\" + cn.colorbar).data(makeColorBarData(gd), function(opts) {\n return opts._id;\n });\n colorBars.enter().append(\"g\").attr(\"class\", function(opts) {\n return opts._id;\n }).classed(cn.colorbar, true);\n colorBars.each(function(opts) {\n var g = d3.select(this);\n Lib.ensureSingle(g, \"rect\", cn.cbbg);\n Lib.ensureSingle(g, \"g\", cn.cbfills);\n Lib.ensureSingle(g, \"g\", cn.cblines);\n Lib.ensureSingle(g, \"g\", cn.cbaxis, function(s) {\n s.classed(cn.crisp, true);\n });\n Lib.ensureSingle(g, \"g\", cn.cbtitleunshift, function(s) {\n s.append(\"g\").classed(cn.cbtitle, true);\n });\n Lib.ensureSingle(g, \"rect\", cn.cboutline);\n var done = drawColorBar(g, opts, gd);\n if (done && done.then) (gd._promises || []).push(done);\n if (gd._context.edits.colorbarPosition) {\n makeEditable(g, opts, gd);\n }\n });\n colorBars.exit().each(function(opts) {\n Plots.autoMargin(gd, opts._id);\n }).remove();\n colorBars.order();\n }\n function makeColorBarData(gd) {\n var fullLayout = gd._fullLayout;\n var calcdata = gd.calcdata;\n var out = [];\n var opts;\n var cont;\n var trace;\n var cbOpt;\n function initOpts(opts2) {\n return extendFlat(opts2, {\n // fillcolor can be a d3 scale, domain is z values, range is colors\n // or leave it out for no fill,\n // or set to a string constant for single-color fill\n _fillcolor: null,\n // line.color has the same options as fillcolor\n _line: { color: null, width: null, dash: null },\n // levels of lines to draw.\n // note that this DOES NOT determine the extent of the bar\n // that's given by the domain of fillcolor\n // (or line.color if no fillcolor domain)\n _levels: { start: null, end: null, size: null },\n // separate fill levels (for example, heatmap coloring of a\n // contour map) if this is omitted, fillcolors will be\n // evaluated halfway between levels\n _filllevels: null,\n // for continuous colorscales: fill with a gradient instead of explicit levels\n // value should be the colorscale [[0, c0], [v1, c1], ..., [1, cEnd]]\n _fillgradient: null,\n // when using a gradient, we need the data range specified separately\n _zrange: null\n });\n }\n function calcOpts() {\n if (typeof cbOpt.calc === \"function\") {\n cbOpt.calc(gd, trace, opts);\n } else {\n opts._fillgradient = cont.reversescale ? flipScale(cont.colorscale) : cont.colorscale;\n opts._zrange = [cont[cbOpt.min], cont[cbOpt.max]];\n }\n }\n for (var i = 0; i < calcdata.length; i++) {\n var cd = calcdata[i];\n trace = cd[0].trace;\n if (!trace._module) continue;\n var moduleOpts = trace._module.colorbar;\n if (trace.visible === true && moduleOpts) {\n var allowsMultiplotCbs = Array.isArray(moduleOpts);\n var cbOpts = allowsMultiplotCbs ? moduleOpts : [moduleOpts];\n for (var j = 0; j < cbOpts.length; j++) {\n cbOpt = cbOpts[j];\n var contName = cbOpt.container;\n cont = contName ? trace[contName] : trace;\n if (cont && cont.showscale) {\n opts = initOpts(cont.colorbar);\n opts._id = \"cb\" + trace.uid + (allowsMultiplotCbs && contName ? \"-\" + contName : \"\");\n opts._traceIndex = trace.index;\n opts._propPrefix = (contName ? contName + \".\" : \"\") + \"colorbar.\";\n opts._meta = trace._meta;\n calcOpts();\n out.push(opts);\n }\n }\n }\n }\n for (var k in fullLayout._colorAxes) {\n cont = fullLayout[k];\n if (cont.showscale) {\n var colorAxOpts = fullLayout._colorAxes[k];\n opts = initOpts(cont.colorbar);\n opts._id = \"cb\" + k;\n opts._propPrefix = k + \".colorbar.\";\n opts._meta = fullLayout._meta;\n cbOpt = { min: \"cmin\", max: \"cmax\" };\n if (colorAxOpts[0] !== \"heatmap\") {\n trace = colorAxOpts[1];\n cbOpt.calc = trace._module.colorbar.calc;\n }\n calcOpts();\n out.push(opts);\n }\n }\n return out;\n }\n function drawColorBar(g, opts, gd) {\n var isVertical = opts.orientation === \"v\";\n var len = opts.len;\n var lenmode = opts.lenmode;\n var thickness = opts.thickness;\n var thicknessmode = opts.thicknessmode;\n var outlinewidth = opts.outlinewidth;\n var borderwidth = opts.borderwidth;\n var bgcolor = opts.bgcolor;\n var xanchor = opts.xanchor;\n var yanchor = opts.yanchor;\n var xpad = opts.xpad;\n var ypad = opts.ypad;\n var optsX = opts.x;\n var optsY = isVertical ? opts.y : 1 - opts.y;\n var isPaperY = opts.yref === \"paper\";\n var isPaperX = opts.xref === \"paper\";\n var fullLayout = gd._fullLayout;\n var gs = fullLayout._size;\n var fillColor = opts._fillcolor;\n var line = opts._line;\n var title = opts.title;\n var titleSide = title.side;\n var zrange = opts._zrange || d3.extent((typeof fillColor === \"function\" ? fillColor : line.color).domain());\n var lineColormap = typeof line.color === \"function\" ? line.color : function() {\n return line.color;\n };\n var fillColormap = typeof fillColor === \"function\" ? fillColor : function() {\n return fillColor;\n };\n var levelsIn = opts._levels;\n var levelsOut = calcLevels(gd, opts, zrange);\n var fillLevels = levelsOut.fill;\n var lineLevels = levelsOut.line;\n var thickPx = Math.round(thickness * (thicknessmode === \"fraction\" ? isVertical ? gs.w : gs.h : 1));\n var thickFrac = thickPx / (isVertical ? gs.w : gs.h);\n var lenPx = Math.round(len * (lenmode === \"fraction\" ? isVertical ? gs.h : gs.w : 1));\n var lenFrac = lenPx / (isVertical ? gs.h : gs.w);\n var posW = isPaperX ? gs.w : gd._fullLayout.width;\n var posH = isPaperY ? gs.h : gd._fullLayout.height;\n var uPx = Math.round(\n isVertical ? optsX * posW + xpad : optsY * posH + ypad\n );\n var xRatio = { center: 0.5, right: 1 }[xanchor] || 0;\n var yRatio = { top: 1, middle: 0.5 }[yanchor] || 0;\n var uFrac = isVertical ? optsX - xRatio * thickFrac : optsY - yRatio * thickFrac;\n var vFrac = isVertical ? optsY - yRatio * lenFrac : optsX - xRatio * lenFrac;\n var vPx = Math.round(\n isVertical ? posH * (1 - vFrac) : posW * vFrac\n );\n opts._lenFrac = lenFrac;\n opts._thickFrac = thickFrac;\n opts._uFrac = uFrac;\n opts._vFrac = vFrac;\n var ax = opts._axis = mockColorBarAxis(gd, opts, zrange);\n ax.position = thickFrac + (isVertical ? optsX + xpad / gs.w : optsY + ypad / gs.h);\n var topOrBottom = [\"top\", \"bottom\"].indexOf(titleSide) !== -1;\n if (isVertical && topOrBottom) {\n ax.title.side = titleSide;\n ax.titlex = optsX + xpad / gs.w;\n ax.titley = vFrac + (title.side === \"top\" ? lenFrac - ypad / gs.h : ypad / gs.h);\n }\n if (!isVertical && !topOrBottom) {\n ax.title.side = titleSide;\n ax.titley = optsY + ypad / gs.h;\n ax.titlex = vFrac + xpad / gs.w;\n }\n if (line.color && opts.tickmode === \"auto\") {\n ax.tickmode = \"linear\";\n ax.tick0 = levelsIn.start;\n var dtick = levelsIn.size;\n var autoNtick = Lib.constrain(lenPx / 50, 4, 15) + 1;\n var dtFactor = (zrange[1] - zrange[0]) / ((opts.nticks || autoNtick) * dtick);\n if (dtFactor > 1) {\n var dtexp = Math.pow(10, Math.floor(Math.log(dtFactor) / Math.LN10));\n dtick *= dtexp * Lib.roundUp(dtFactor / dtexp, [2, 5, 10]);\n if ((Math.abs(levelsIn.start) / levelsIn.size + 1e-6) % 1 < 2e-6) {\n ax.tick0 = 0;\n }\n }\n ax.dtick = dtick;\n }\n ax.domain = isVertical ? [\n vFrac + ypad / gs.h,\n vFrac + lenFrac - ypad / gs.h\n ] : [\n vFrac + xpad / gs.w,\n vFrac + lenFrac - xpad / gs.w\n ];\n ax.setScale();\n g.attr(\"transform\", strTranslate(Math.round(gs.l), Math.round(gs.t)));\n var titleCont = g.select(\".\" + cn.cbtitleunshift).attr(\"transform\", strTranslate(-Math.round(gs.l), -Math.round(gs.t)));\n var ticklabelposition = ax.ticklabelposition;\n var titleFontSize = ax.title.font.size;\n var axLayer = g.select(\".\" + cn.cbaxis);\n var titleEl;\n var titleHeight = 0;\n var titleWidth = 0;\n function drawTitle(titleClass, titleOpts) {\n var dfltTitleOpts = {\n propContainer: ax,\n propName: opts._propPrefix + \"title\",\n traceIndex: opts._traceIndex,\n _meta: opts._meta,\n placeholder: fullLayout._dfltTitle.colorbar,\n containerGroup: g.select(\".\" + cn.cbtitle)\n };\n var otherClass = titleClass.charAt(0) === \"h\" ? titleClass.substr(1) : \"h\" + titleClass;\n g.selectAll(\".\" + otherClass + \",.\" + otherClass + \"-math-group\").remove();\n Titles.draw(gd, titleClass, extendFlat(dfltTitleOpts, titleOpts || {}));\n }\n function drawDummyTitle() {\n if (isVertical && topOrBottom || !isVertical && !topOrBottom) {\n var x, y;\n if (titleSide === \"top\") {\n x = xpad + gs.l + posW * optsX;\n y = ypad + gs.t + posH * (1 - vFrac - lenFrac) + 3 + titleFontSize * 0.75;\n }\n if (titleSide === \"bottom\") {\n x = xpad + gs.l + posW * optsX;\n y = ypad + gs.t + posH * (1 - vFrac) - 3 - titleFontSize * 0.25;\n }\n if (titleSide === \"right\") {\n y = ypad + gs.t + posH * optsY + 3 + titleFontSize * 0.75;\n x = xpad + gs.l + posW * vFrac;\n }\n drawTitle(ax._id + \"title\", {\n attributes: { x, y, \"text-anchor\": isVertical ? \"start\" : \"middle\" }\n });\n }\n }\n function drawCbTitle() {\n if (isVertical && !topOrBottom || !isVertical && topOrBottom) {\n var pos = ax.position || 0;\n var mid = ax._offset + ax._length / 2;\n var x, y;\n if (titleSide === \"right\") {\n y = mid;\n x = gs.l + posW * pos + 10 + titleFontSize * (ax.showticklabels ? 1 : 0.5);\n } else {\n x = mid;\n if (titleSide === \"bottom\") {\n y = gs.t + posH * pos + 10 + (ticklabelposition.indexOf(\"inside\") === -1 ? ax.tickfont.size : 0) + (ax.ticks !== \"intside\" ? opts.ticklen || 0 : 0);\n }\n if (titleSide === \"top\") {\n var nlines = title.text.split(\"
    \").length;\n y = gs.t + posH * pos + 10 - thickPx - LINE_SPACING * titleFontSize * nlines;\n }\n }\n drawTitle((isVertical ? (\n // the 'h' + is a hack to get around the fact that\n // convertToTspans rotates any 'y...' class by 90 degrees.\n // TODO: find a better way to control this.\n \"h\"\n ) : \"v\") + ax._id + \"title\", {\n avoid: {\n selection: d3.select(gd).selectAll(\"g.\" + ax._id + \"tick\"),\n side: titleSide,\n offsetTop: isVertical ? 0 : gs.t,\n offsetLeft: isVertical ? gs.l : 0,\n maxShift: isVertical ? fullLayout.width : fullLayout.height\n },\n attributes: { x, y, \"text-anchor\": \"middle\" },\n transform: { rotate: isVertical ? -90 : 0, offset: 0 }\n });\n }\n }\n function drawAxis() {\n if (!isVertical && !topOrBottom || isVertical && topOrBottom) {\n var titleGroup = g.select(\".\" + cn.cbtitle);\n var titleText = titleGroup.select(\"text\");\n var titleTrans = [-outlinewidth / 2, outlinewidth / 2];\n var mathJaxNode = titleGroup.select(\".h\" + ax._id + \"title-math-group\").node();\n var lineSize = 15.6;\n if (titleText.node()) {\n lineSize = parseInt(titleText.node().style.fontSize, 10) * LINE_SPACING;\n }\n var bb;\n if (mathJaxNode) {\n bb = Drawing.bBox(mathJaxNode);\n titleWidth = bb.width;\n titleHeight = bb.height;\n if (titleHeight > lineSize) {\n titleTrans[1] -= (titleHeight - lineSize) / 2;\n }\n } else if (titleText.node() && !titleText.classed(cn.jsPlaceholder)) {\n bb = Drawing.bBox(titleText.node());\n titleWidth = bb.width;\n titleHeight = bb.height;\n }\n if (isVertical) {\n if (titleHeight) {\n titleHeight += 5;\n if (titleSide === \"top\") {\n ax.domain[1] -= titleHeight / gs.h;\n titleTrans[1] *= -1;\n } else {\n ax.domain[0] += titleHeight / gs.h;\n var nlines = svgTextUtils.lineCount(titleText);\n titleTrans[1] += (1 - nlines) * lineSize;\n }\n titleGroup.attr(\"transform\", strTranslate(titleTrans[0], titleTrans[1]));\n ax.setScale();\n }\n } else {\n if (titleWidth) {\n if (titleSide === \"right\") {\n ax.domain[0] += (titleWidth + titleFontSize / 2) / gs.w;\n }\n titleGroup.attr(\"transform\", strTranslate(titleTrans[0], titleTrans[1]));\n ax.setScale();\n }\n }\n }\n g.selectAll(\".\" + cn.cbfills + \",.\" + cn.cblines).attr(\n \"transform\",\n isVertical ? strTranslate(0, Math.round(gs.h * (1 - ax.domain[1]))) : strTranslate(Math.round(gs.w * ax.domain[0]), 0)\n );\n axLayer.attr(\n \"transform\",\n isVertical ? strTranslate(0, Math.round(-gs.t)) : strTranslate(Math.round(-gs.l), 0)\n );\n var fills = g.select(\".\" + cn.cbfills).selectAll(\"rect.\" + cn.cbfill).attr(\"style\", \"\").data(fillLevels);\n fills.enter().append(\"rect\").classed(cn.cbfill, true).attr(\"style\", \"\");\n fills.exit().remove();\n var zBounds = zrange.map(ax.c2p).map(Math.round).sort(function(a, b) {\n return a - b;\n });\n fills.each(function(d, i) {\n var z = [\n i === 0 ? zrange[0] : (fillLevels[i] + fillLevels[i - 1]) / 2,\n i === fillLevels.length - 1 ? zrange[1] : (fillLevels[i] + fillLevels[i + 1]) / 2\n ].map(ax.c2p).map(Math.round);\n if (isVertical) {\n z[1] = Lib.constrain(z[1] + (z[1] > z[0]) ? 1 : -1, zBounds[0], zBounds[1]);\n }\n var fillEl = d3.select(this).attr(isVertical ? \"x\" : \"y\", uPx).attr(isVertical ? \"y\" : \"x\", d3.min(z)).attr(isVertical ? \"width\" : \"height\", Math.max(thickPx, 2)).attr(isVertical ? \"height\" : \"width\", Math.max(d3.max(z) - d3.min(z), 2));\n if (opts._fillgradient) {\n Drawing.gradient(fillEl, gd, opts._id, isVertical ? \"vertical\" : \"horizontalreversed\", opts._fillgradient, \"fill\");\n } else {\n var colorString = fillColormap(d).replace(\"e-\", \"\");\n fillEl.attr(\"fill\", tinycolor(colorString).toHexString());\n }\n });\n var lines = g.select(\".\" + cn.cblines).selectAll(\"path.\" + cn.cbline).data(line.color && line.width ? lineLevels : []);\n lines.enter().append(\"path\").classed(cn.cbline, true);\n lines.exit().remove();\n lines.each(function(d) {\n var a = uPx;\n var b = Math.round(ax.c2p(d)) + line.width / 2 % 1;\n d3.select(this).attr(\n \"d\",\n \"M\" + (isVertical ? a + \",\" + b : b + \",\" + a) + (isVertical ? \"h\" : \"v\") + thickPx\n ).call(Drawing.lineGroupStyle, line.width, lineColormap(d), line.dash);\n });\n axLayer.selectAll(\"g.\" + ax._id + \"tick,path\").remove();\n var shift = uPx + thickPx + (outlinewidth || 0) / 2 - (opts.ticks === \"outside\" ? 1 : 0);\n var vals = Axes.calcTicks(ax);\n var tickSign = Axes.getTickSigns(ax)[2];\n Axes.drawTicks(gd, ax, {\n vals: ax.ticks === \"inside\" ? Axes.clipEnds(ax, vals) : vals,\n layer: axLayer,\n path: Axes.makeTickPath(ax, shift, tickSign),\n transFn: Axes.makeTransTickFn(ax)\n });\n return Axes.drawLabels(gd, ax, {\n vals,\n layer: axLayer,\n transFn: Axes.makeTransTickLabelFn(ax),\n labelFns: Axes.makeLabelFns(ax, shift)\n });\n }\n function positionCB() {\n var bb;\n var innerThickness = thickPx + outlinewidth / 2;\n if (ticklabelposition.indexOf(\"inside\") === -1) {\n bb = Drawing.bBox(axLayer.node());\n innerThickness += isVertical ? bb.width : bb.height;\n }\n titleEl = titleCont.select(\"text\");\n var titleWidth2 = 0;\n var topSideVertical = isVertical && titleSide === \"top\";\n var rightSideHorizontal = !isVertical && titleSide === \"right\";\n var moveY = 0;\n if (titleEl.node() && !titleEl.classed(cn.jsPlaceholder)) {\n var _titleHeight;\n var mathJaxNode = titleCont.select(\".h\" + ax._id + \"title-math-group\").node();\n if (mathJaxNode && (isVertical && topOrBottom || !isVertical && !topOrBottom)) {\n bb = Drawing.bBox(mathJaxNode);\n titleWidth2 = bb.width;\n _titleHeight = bb.height;\n } else {\n bb = Drawing.bBox(titleCont.node());\n titleWidth2 = bb.right - gs.l - (isVertical ? uPx : vPx);\n _titleHeight = bb.bottom - gs.t - (isVertical ? vPx : uPx);\n if (!isVertical && titleSide === \"top\") {\n innerThickness += bb.height;\n moveY = bb.height;\n }\n }\n if (rightSideHorizontal) {\n titleEl.attr(\"transform\", strTranslate(titleWidth2 / 2 + titleFontSize / 2, 0));\n titleWidth2 *= 2;\n }\n innerThickness = Math.max(\n innerThickness,\n isVertical ? titleWidth2 : _titleHeight\n );\n }\n var outerThickness = (isVertical ? xpad : ypad) * 2 + innerThickness + borderwidth + outlinewidth / 2;\n var hColorbarMoveTitle = 0;\n if (!isVertical && title.text && yanchor === \"bottom\" && optsY <= 0) {\n hColorbarMoveTitle = outerThickness / 2;\n outerThickness += hColorbarMoveTitle;\n moveY += hColorbarMoveTitle;\n }\n fullLayout._hColorbarMoveTitle = hColorbarMoveTitle;\n fullLayout._hColorbarMoveCBTitle = moveY;\n var extraW = borderwidth + outlinewidth;\n var lx = (isVertical ? uPx : vPx) - extraW / 2 - (isVertical ? xpad : 0);\n var ly = (isVertical ? vPx : uPx) - (isVertical ? lenPx : ypad + moveY - hColorbarMoveTitle);\n g.select(\".\" + cn.cbbg).attr(\"x\", lx).attr(\"y\", ly).attr(isVertical ? \"width\" : \"height\", Math.max(outerThickness - hColorbarMoveTitle, 2)).attr(isVertical ? \"height\" : \"width\", Math.max(lenPx + extraW, 2)).call(Color2.fill, bgcolor).call(Color2.stroke, opts.bordercolor).style(\"stroke-width\", borderwidth);\n var moveX = rightSideHorizontal ? Math.max(titleWidth2 - 10, 0) : 0;\n g.selectAll(\".\" + cn.cboutline).attr(\"x\", (isVertical ? uPx : vPx + xpad) + moveX).attr(\"y\", (isVertical ? vPx + ypad - lenPx : uPx) + (topSideVertical ? titleHeight : 0)).attr(isVertical ? \"width\" : \"height\", Math.max(thickPx, 2)).attr(isVertical ? \"height\" : \"width\", Math.max(lenPx - (isVertical ? 2 * ypad + titleHeight : 2 * xpad + moveX), 2)).call(Color2.stroke, opts.outlinecolor).style({\n fill: \"none\",\n \"stroke-width\": outlinewidth\n });\n var xShift = isVertical ? xRatio * outerThickness : 0;\n var yShift = isVertical ? 0 : (1 - yRatio) * outerThickness - moveY;\n xShift = isPaperX ? gs.l - xShift : -xShift;\n yShift = isPaperY ? gs.t - yShift : -yShift;\n g.attr(\"transform\", strTranslate(\n xShift,\n yShift\n ));\n if (!isVertical && (borderwidth || tinycolor(bgcolor).getAlpha() && !tinycolor.equals(fullLayout.paper_bgcolor, bgcolor))) {\n var tickLabels = axLayer.selectAll(\"text\");\n var numTicks = tickLabels[0].length;\n var border = g.select(\".\" + cn.cbbg).node();\n var oBb = Drawing.bBox(border);\n var oTr = Drawing.getTranslate(g);\n var TEXTPAD = 2;\n tickLabels.each(function(d, i) {\n var first = 0;\n var last = numTicks - 1;\n if (i === first || i === last) {\n var iBb = Drawing.bBox(this);\n var iTr = Drawing.getTranslate(this);\n var deltaX;\n if (i === last) {\n var iRight = iBb.right + iTr.x;\n var oRight = oBb.right + oTr.x + vPx - borderwidth - TEXTPAD + optsX;\n deltaX = oRight - iRight;\n if (deltaX > 0) deltaX = 0;\n } else if (i === first) {\n var iLeft = iBb.left + iTr.x;\n var oLeft = oBb.left + oTr.x + vPx + borderwidth + TEXTPAD;\n deltaX = oLeft - iLeft;\n if (deltaX < 0) deltaX = 0;\n }\n if (deltaX) {\n if (numTicks < 3) {\n this.setAttribute(\n \"transform\",\n \"translate(\" + deltaX + \",0) \" + this.getAttribute(\"transform\")\n );\n } else {\n this.setAttribute(\"visibility\", \"hidden\");\n }\n }\n }\n });\n }\n var marginOpts = {};\n var lFrac = FROM_TL[xanchor];\n var rFrac = FROM_BR[xanchor];\n var tFrac = FROM_TL[yanchor];\n var bFrac = FROM_BR[yanchor];\n var extraThickness = outerThickness - thickPx;\n if (isVertical) {\n if (lenmode === \"pixels\") {\n marginOpts.y = optsY;\n marginOpts.t = lenPx * tFrac;\n marginOpts.b = lenPx * bFrac;\n } else {\n marginOpts.t = marginOpts.b = 0;\n marginOpts.yt = optsY + len * tFrac;\n marginOpts.yb = optsY - len * bFrac;\n }\n if (thicknessmode === \"pixels\") {\n marginOpts.x = optsX;\n marginOpts.l = outerThickness * lFrac;\n marginOpts.r = outerThickness * rFrac;\n } else {\n marginOpts.l = extraThickness * lFrac;\n marginOpts.r = extraThickness * rFrac;\n marginOpts.xl = optsX - thickness * lFrac;\n marginOpts.xr = optsX + thickness * rFrac;\n }\n } else {\n if (lenmode === \"pixels\") {\n marginOpts.x = optsX;\n marginOpts.l = lenPx * lFrac;\n marginOpts.r = lenPx * rFrac;\n } else {\n marginOpts.l = marginOpts.r = 0;\n marginOpts.xl = optsX + len * lFrac;\n marginOpts.xr = optsX - len * rFrac;\n }\n if (thicknessmode === \"pixels\") {\n marginOpts.y = 1 - optsY;\n marginOpts.t = outerThickness * tFrac;\n marginOpts.b = outerThickness * bFrac;\n } else {\n marginOpts.t = extraThickness * tFrac;\n marginOpts.b = extraThickness * bFrac;\n marginOpts.yt = optsY - thickness * tFrac;\n marginOpts.yb = optsY + thickness * bFrac;\n }\n }\n var sideY = opts.y < 0.5 ? \"b\" : \"t\";\n var sideX = opts.x < 0.5 ? \"l\" : \"r\";\n gd._fullLayout._reservedMargin[opts._id] = {};\n var possibleReservedMargins = {\n r: fullLayout.width - lx - xShift,\n l: lx + marginOpts.r,\n b: fullLayout.height - ly - yShift,\n t: ly + marginOpts.b\n };\n if (isPaperX && isPaperY) {\n Plots.autoMargin(gd, opts._id, marginOpts);\n } else if (isPaperX) {\n gd._fullLayout._reservedMargin[opts._id][sideY] = possibleReservedMargins[sideY];\n } else if (isPaperY) {\n gd._fullLayout._reservedMargin[opts._id][sideX] = possibleReservedMargins[sideX];\n } else {\n if (isVertical) {\n gd._fullLayout._reservedMargin[opts._id][sideX] = possibleReservedMargins[sideX];\n } else {\n gd._fullLayout._reservedMargin[opts._id][sideY] = possibleReservedMargins[sideY];\n }\n }\n }\n return Lib.syncOrAsync([\n Plots.previousPromises,\n drawDummyTitle,\n drawAxis,\n drawCbTitle,\n Plots.previousPromises,\n positionCB\n ], gd);\n }\n function makeEditable(g, opts, gd) {\n var isVertical = opts.orientation === \"v\";\n var fullLayout = gd._fullLayout;\n var gs = fullLayout._size;\n var t02, xf, yf;\n dragElement.init({\n element: g.node(),\n gd,\n prepFn: function() {\n t02 = g.attr(\"transform\");\n setCursor(g);\n },\n moveFn: function(dx, dy) {\n g.attr(\"transform\", t02 + strTranslate(dx, dy));\n xf = dragElement.align(\n (isVertical ? opts._uFrac : opts._vFrac) + dx / gs.w,\n isVertical ? opts._thickFrac : opts._lenFrac,\n 0,\n 1,\n opts.xanchor\n );\n yf = dragElement.align(\n (isVertical ? opts._vFrac : 1 - opts._uFrac) - dy / gs.h,\n isVertical ? opts._lenFrac : opts._thickFrac,\n 0,\n 1,\n opts.yanchor\n );\n var csr = dragElement.getCursor(xf, yf, opts.xanchor, opts.yanchor);\n setCursor(g, csr);\n },\n doneFn: function() {\n setCursor(g);\n if (xf !== void 0 && yf !== void 0) {\n var update = {};\n update[opts._propPrefix + \"x\"] = xf;\n update[opts._propPrefix + \"y\"] = yf;\n if (opts._traceIndex !== void 0) {\n Registry.call(\"_guiRestyle\", gd, update, opts._traceIndex);\n } else {\n Registry.call(\"_guiRelayout\", gd, update);\n }\n }\n }\n });\n }\n function calcLevels(gd, opts, zrange) {\n var levelsIn = opts._levels;\n var lineLevels = [];\n var fillLevels = [];\n var l;\n var i;\n var l0 = levelsIn.end + levelsIn.size / 100;\n var ls = levelsIn.size;\n var zr0 = 1.001 * zrange[0] - 1e-3 * zrange[1];\n var zr1 = 1.001 * zrange[1] - 1e-3 * zrange[0];\n for (i = 0; i < 1e5; i++) {\n l = levelsIn.start + i * ls;\n if (ls > 0 ? l >= l0 : l <= l0) break;\n if (l > zr0 && l < zr1) lineLevels.push(l);\n }\n if (opts._fillgradient) {\n fillLevels = [0];\n } else if (typeof opts._fillcolor === \"function\") {\n var fillLevelsIn = opts._filllevels;\n if (fillLevelsIn) {\n l0 = fillLevelsIn.end + fillLevelsIn.size / 100;\n ls = fillLevelsIn.size;\n for (i = 0; i < 1e5; i++) {\n l = fillLevelsIn.start + i * ls;\n if (ls > 0 ? l >= l0 : l <= l0) break;\n if (l > zrange[0] && l < zrange[1]) fillLevels.push(l);\n }\n } else {\n fillLevels = lineLevels.map(function(v) {\n return v - levelsIn.size / 2;\n });\n fillLevels.push(fillLevels[fillLevels.length - 1] + levelsIn.size);\n }\n } else if (opts._fillcolor && typeof opts._fillcolor === \"string\") {\n fillLevels = [0];\n }\n if (levelsIn.size < 0) {\n lineLevels.reverse();\n fillLevels.reverse();\n }\n return { line: lineLevels, fill: fillLevels };\n }\n function mockColorBarAxis(gd, opts, zrange) {\n var fullLayout = gd._fullLayout;\n var isVertical = opts.orientation === \"v\";\n var cbAxisIn = {\n type: \"linear\",\n range: zrange,\n tickmode: opts.tickmode,\n nticks: opts.nticks,\n tick0: opts.tick0,\n dtick: opts.dtick,\n tickvals: opts.tickvals,\n ticktext: opts.ticktext,\n ticks: opts.ticks,\n ticklen: opts.ticklen,\n tickwidth: opts.tickwidth,\n tickcolor: opts.tickcolor,\n showticklabels: opts.showticklabels,\n labelalias: opts.labelalias,\n ticklabelposition: opts.ticklabelposition,\n ticklabeloverflow: opts.ticklabeloverflow,\n ticklabelstep: opts.ticklabelstep,\n tickfont: opts.tickfont,\n tickangle: opts.tickangle,\n tickformat: opts.tickformat,\n exponentformat: opts.exponentformat,\n minexponent: opts.minexponent,\n separatethousands: opts.separatethousands,\n showexponent: opts.showexponent,\n showtickprefix: opts.showtickprefix,\n tickprefix: opts.tickprefix,\n showticksuffix: opts.showticksuffix,\n ticksuffix: opts.ticksuffix,\n title: opts.title,\n showline: true,\n anchor: \"free\",\n side: isVertical ? \"right\" : \"bottom\",\n position: 1\n };\n var letter = isVertical ? \"y\" : \"x\";\n var cbAxisOut = {\n type: \"linear\",\n _id: letter + opts._id\n };\n var axisOptions = {\n letter,\n font: fullLayout.font,\n noAutotickangles: letter === \"y\",\n noHover: true,\n noTickson: true,\n noTicklabelmode: true,\n noInsideRange: true,\n calendar: fullLayout.calendar\n // not really necessary (yet?)\n };\n function coerce(attr, dflt) {\n return Lib.coerce(cbAxisIn, cbAxisOut, axisLayoutAttrs, attr, dflt);\n }\n handleAxisDefaults(cbAxisIn, cbAxisOut, coerce, axisOptions, fullLayout);\n handleAxisPositionDefaults(cbAxisIn, cbAxisOut, coerce, axisOptions);\n return cbAxisOut;\n }\n module.exports = {\n draw\n };\n }\n });\n\n // src/components/colorbar/index.js\n var require_colorbar = __commonJS({\n \"src/components/colorbar/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"component\",\n name: \"colorbar\",\n attributes: require_attributes7(),\n supplyDefaults: require_defaults(),\n draw: require_draw11().draw,\n hasColorbar: require_has_colorbar()\n };\n }\n });\n\n // src/components/legend/index.js\n var require_legend = __commonJS({\n \"src/components/legend/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"component\",\n name: \"legend\",\n layoutAttributes: require_attributes9(),\n supplyLayoutDefaults: require_defaults3(),\n draw: require_draw(),\n style: require_style()\n };\n }\n });\n\n // src/locale-en.js\n var require_locale_en = __commonJS({\n \"src/locale-en.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"locale\",\n name: \"en\",\n dictionary: {\n \"Click to enter Colorscale title\": \"Click to enter Colourscale title\"\n },\n format: {\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\"\n ],\n shortMonths: [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\"\n ],\n periods: [\"AM\", \"PM\"],\n dateTime: \"%a %b %e %X %Y\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"],\n year: \"%Y\",\n month: \"%b %Y\",\n dayMonth: \"%b %-d\",\n dayMonthYear: \"%b %-d, %Y\"\n }\n };\n }\n });\n\n // src/locale-en-us.js\n var require_locale_en_us = __commonJS({\n \"src/locale-en-us.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"locale\",\n name: \"en-US\",\n dictionary: {\n \"Click to enter Colorscale title\": \"Click to enter Colorscale title\"\n },\n format: {\n date: \"%m/%d/%Y\"\n }\n };\n }\n });\n\n // src/snapshot/cloneplot.js\n var require_cloneplot = __commonJS({\n \"src/snapshot/cloneplot.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var Lib = require_lib();\n var extendFlat = Lib.extendFlat;\n var extendDeep = Lib.extendDeep;\n function cloneLayoutOverride(tileClass) {\n var override;\n switch (tileClass) {\n case \"themes__thumb\":\n override = {\n autosize: true,\n width: 150,\n height: 150,\n title: { text: \"\" },\n showlegend: false,\n margin: { l: 5, r: 5, t: 5, b: 5, pad: 0 },\n annotations: []\n };\n break;\n case \"thumbnail\":\n override = {\n title: { text: \"\" },\n hidesources: true,\n showlegend: false,\n borderwidth: 0,\n bordercolor: \"\",\n margin: { l: 1, r: 1, t: 1, b: 1, pad: 0 },\n annotations: []\n };\n break;\n default:\n override = {};\n }\n return override;\n }\n function keyIsAxis(keyName) {\n var types = [\"xaxis\", \"yaxis\", \"zaxis\"];\n return types.indexOf(keyName.slice(0, 5)) > -1;\n }\n module.exports = function clonePlot(graphObj, options) {\n var i;\n var oldData = graphObj.data;\n var oldLayout = graphObj.layout;\n var newData = extendDeep([], oldData);\n var newLayout = extendDeep({}, oldLayout, cloneLayoutOverride(options.tileClass));\n var context = graphObj._context || {};\n if (options.width) newLayout.width = options.width;\n if (options.height) newLayout.height = options.height;\n if (options.tileClass === \"thumbnail\" || options.tileClass === \"themes__thumb\") {\n newLayout.annotations = [];\n var keys = Object.keys(newLayout);\n for (i = 0; i < keys.length; i++) {\n if (keyIsAxis(keys[i])) {\n newLayout[keys[i]].title = { text: \"\" };\n }\n }\n for (i = 0; i < newData.length; i++) {\n var trace = newData[i];\n trace.showscale = false;\n if (trace.marker) trace.marker.showscale = false;\n if (Registry.traceIs(trace, \"pie-like\")) trace.textposition = \"none\";\n }\n }\n if (Array.isArray(options.annotations)) {\n for (i = 0; i < options.annotations.length; i++) {\n newLayout.annotations.push(options.annotations[i]);\n }\n }\n var sceneIds = Object.keys(newLayout).filter(function(key) {\n return key.match(/^scene\\d*$/);\n });\n if (sceneIds.length) {\n var axesImageOverride = {};\n if (options.tileClass === \"thumbnail\") {\n axesImageOverride = {\n title: { text: \"\" },\n showaxeslabels: false,\n showticklabels: false,\n linetickenable: false\n };\n }\n for (i = 0; i < sceneIds.length; i++) {\n var scene = newLayout[sceneIds[i]];\n if (!scene.xaxis) {\n scene.xaxis = {};\n }\n if (!scene.yaxis) {\n scene.yaxis = {};\n }\n if (!scene.zaxis) {\n scene.zaxis = {};\n }\n extendFlat(scene.xaxis, axesImageOverride);\n extendFlat(scene.yaxis, axesImageOverride);\n extendFlat(scene.zaxis, axesImageOverride);\n scene._scene = null;\n }\n }\n var gd = document.createElement(\"div\");\n if (options.tileClass) gd.className = options.tileClass;\n var plotTile = {\n gd,\n td: gd,\n // for external (image server) compatibility\n layout: newLayout,\n data: newData,\n config: {\n staticPlot: options.staticPlot === void 0 ? true : options.staticPlot,\n plotGlPixelRatio: options.plotGlPixelRatio === void 0 ? 2 : options.plotGlPixelRatio,\n displaylogo: options.displaylogo || false,\n showLink: options.showLink || false,\n showTips: options.showTips || false,\n mapboxAccessToken: context.mapboxAccessToken\n }\n };\n if (options.setBackground !== \"transparent\") {\n plotTile.config.setBackground = options.setBackground || \"opaque\";\n }\n plotTile.gd.defaultLayout = cloneLayoutOverride(options.tileClass);\n return plotTile;\n };\n }\n });\n\n // src/snapshot/toimage.js\n var require_toimage = __commonJS({\n \"src/snapshot/toimage.js\"(exports, module) {\n \"use strict\";\n var EventEmitter = require_events().EventEmitter;\n var Registry = require_registry();\n var Lib = require_lib();\n var helpers = require_helpers10();\n var clonePlot = require_cloneplot();\n var toSVG = require_tosvg();\n var svgToImg = require_svgtoimg();\n function toImage(gd, opts) {\n var ev = new EventEmitter();\n var clone = clonePlot(gd, { format: \"png\" });\n var clonedGd = clone.gd;\n clonedGd.style.position = \"absolute\";\n clonedGd.style.left = \"-5000px\";\n document.body.appendChild(clonedGd);\n function wait() {\n var delay = helpers.getDelay(clonedGd._fullLayout);\n setTimeout(function() {\n var svg = toSVG(clonedGd);\n var canvas = document.createElement(\"canvas\");\n canvas.id = Lib.randstr();\n ev = svgToImg({\n format: opts.format,\n width: clonedGd._fullLayout.width,\n height: clonedGd._fullLayout.height,\n canvas,\n emitter: ev,\n svg\n });\n ev.clean = function() {\n if (clonedGd) document.body.removeChild(clonedGd);\n };\n }, delay);\n }\n var redrawFunc = helpers.getRedrawFunc(clonedGd);\n Registry.call(\"_doPlot\", clonedGd, clone.data, clone.layout, clone.config).then(redrawFunc).then(wait).catch(function(err) {\n ev.emit(\"error\", err);\n });\n return ev;\n }\n module.exports = toImage;\n }\n });\n\n // src/snapshot/index.js\n var require_snapshot = __commonJS({\n \"src/snapshot/index.js\"(exports, module) {\n \"use strict\";\n var helpers = require_helpers10();\n var Snapshot = {\n getDelay: helpers.getDelay,\n getRedrawFunc: helpers.getRedrawFunc,\n clone: require_cloneplot(),\n toSVG: require_tosvg(),\n svgToImg: require_svgtoimg(),\n toImage: require_toimage(),\n downloadImage: require_download()\n };\n module.exports = Snapshot;\n }\n });\n\n // src/core.js\n var require_core = __commonJS({\n \"src/core.js\"(exports) {\n \"use strict\";\n exports.version = require_version().version;\n require_npo_src();\n require_plotcss();\n var Registry = require_registry();\n var register = exports.register = Registry.register;\n var plotApi = require_plot_api2();\n var methodNames = Object.keys(plotApi);\n for (i = 0; i < methodNames.length; i++) {\n name2 = methodNames[i];\n if (name2.charAt(0) !== \"_\") exports[name2] = plotApi[name2];\n register({\n moduleType: \"apiMethod\",\n name: name2,\n fn: plotApi[name2]\n });\n }\n var name2;\n var i;\n register(require_scatter());\n register([\n require_annotations(),\n require_annotations3d(),\n require_selections(),\n require_shapes(),\n require_images(),\n require_updatemenus(),\n require_sliders(),\n require_rangeslider(),\n require_rangeselector(),\n require_grid(),\n require_errorbars(),\n require_colorscale(),\n require_colorbar(),\n require_legend(),\n // legend needs to come after shape | legend defaults depends on shapes\n require_fx(),\n // fx needs to come after legend | unified hover defaults depends on legends\n require_modebar2()\n ]);\n register([\n require_locale_en(),\n require_locale_en_us()\n ]);\n if (window.PlotlyLocales && Array.isArray(window.PlotlyLocales)) {\n register(window.PlotlyLocales);\n delete window.PlotlyLocales;\n }\n exports.Icons = require_ploticon();\n var Fx = require_fx();\n var Plots = require_plots();\n exports.Plots = {\n resize: Plots.resize,\n graphJson: Plots.graphJson,\n sendDataToCloud: Plots.sendDataToCloud\n };\n exports.Fx = {\n hover: Fx.hover,\n unhover: Fx.unhover,\n loneHover: Fx.loneHover,\n loneUnhover: Fx.loneUnhover\n };\n exports.Snapshot = require_snapshot();\n exports.PlotSchema = require_plot_schema();\n }\n });\n\n // lib/core.js\n var require_core2 = __commonJS({\n \"lib/core.js\"(exports, module) {\n \"use strict\";\n module.exports = require_core();\n }\n });\n\n // src/traces/bar/constants.js\n var require_constants14 = __commonJS({\n \"src/traces/bar/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n // padding in pixels around text\n TEXTPAD: 3,\n // 'value' and 'label' are not really necessary for bar traces,\n // but they were made available to `texttemplate` (maybe by accident)\n // via tokens `%{value}` and `%{label}` starting in 1.50.0,\n // so let's include them in the event data also.\n eventDataKeys: [\"value\", \"label\"]\n };\n }\n });\n\n // src/traces/bar/attributes.js\n var require_attributes23 = __commonJS({\n \"src/traces/bar/attributes.js\"(exports, module) {\n \"use strict\";\n var scatterAttrs = require_attributes12();\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var colorScaleAttrs = require_attributes8();\n var fontAttrs = require_font_attributes();\n var constants = require_constants14();\n var pattern = require_attributes4().pattern;\n var extendFlat = require_extend().extendFlat;\n var textFontAttrs = fontAttrs({\n editType: \"calc\",\n arrayOk: true,\n colorEditType: \"style\"\n });\n var scatterMarkerAttrs = scatterAttrs.marker;\n var scatterMarkerLineAttrs = scatterMarkerAttrs.line;\n var markerLineWidth = extendFlat(\n {},\n scatterMarkerLineAttrs.width,\n { dflt: 0 }\n );\n var markerLine = extendFlat({\n width: markerLineWidth,\n editType: \"calc\"\n }, colorScaleAttrs(\"marker.line\"));\n var marker = extendFlat({\n line: markerLine,\n editType: \"calc\"\n }, colorScaleAttrs(\"marker\"), {\n opacity: {\n valType: \"number\",\n arrayOk: true,\n dflt: 1,\n min: 0,\n max: 1,\n editType: \"style\"\n },\n pattern,\n cornerradius: {\n valType: \"any\",\n editType: \"calc\"\n }\n });\n module.exports = {\n x: scatterAttrs.x,\n x0: scatterAttrs.x0,\n dx: scatterAttrs.dx,\n y: scatterAttrs.y,\n y0: scatterAttrs.y0,\n dy: scatterAttrs.dy,\n xperiod: scatterAttrs.xperiod,\n yperiod: scatterAttrs.yperiod,\n xperiod0: scatterAttrs.xperiod0,\n yperiod0: scatterAttrs.yperiod0,\n xperiodalignment: scatterAttrs.xperiodalignment,\n yperiodalignment: scatterAttrs.yperiodalignment,\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n text: scatterAttrs.text,\n texttemplate: texttemplateAttrs({ editType: \"plot\" }, {\n keys: constants.eventDataKeys\n }),\n hovertext: scatterAttrs.hovertext,\n hovertemplate: hovertemplateAttrs({}, {\n keys: constants.eventDataKeys\n }),\n textposition: {\n valType: \"enumerated\",\n values: [\"inside\", \"outside\", \"auto\", \"none\"],\n dflt: \"auto\",\n arrayOk: true,\n editType: \"calc\"\n },\n insidetextanchor: {\n valType: \"enumerated\",\n values: [\"end\", \"middle\", \"start\"],\n dflt: \"end\",\n editType: \"plot\"\n },\n textangle: {\n valType: \"angle\",\n dflt: \"auto\",\n editType: \"plot\"\n },\n textfont: extendFlat({}, textFontAttrs, {}),\n insidetextfont: extendFlat({}, textFontAttrs, {}),\n outsidetextfont: extendFlat({}, textFontAttrs, {}),\n constraintext: {\n valType: \"enumerated\",\n values: [\"inside\", \"outside\", \"both\", \"none\"],\n dflt: \"both\",\n editType: \"calc\"\n },\n cliponaxis: extendFlat({}, scatterAttrs.cliponaxis, {}),\n orientation: {\n valType: \"enumerated\",\n values: [\"v\", \"h\"],\n editType: \"calc+clearAxisTypes\"\n },\n base: {\n valType: \"any\",\n dflt: null,\n arrayOk: true,\n editType: \"calc\"\n },\n offset: {\n valType: \"number\",\n dflt: null,\n arrayOk: true,\n editType: \"calc\"\n },\n width: {\n valType: \"number\",\n dflt: null,\n min: 0,\n arrayOk: true,\n editType: \"calc\"\n },\n marker,\n offsetgroup: scatterAttrs.offsetgroup,\n alignmentgroup: scatterAttrs.alignmentgroup,\n selected: {\n marker: {\n opacity: scatterAttrs.selected.marker.opacity,\n color: scatterAttrs.selected.marker.color,\n editType: \"style\"\n },\n textfont: scatterAttrs.selected.textfont,\n editType: \"style\"\n },\n unselected: {\n marker: {\n opacity: scatterAttrs.unselected.marker.opacity,\n color: scatterAttrs.unselected.marker.color,\n editType: \"style\"\n },\n textfont: scatterAttrs.unselected.textfont,\n editType: \"style\"\n },\n zorder: scatterAttrs.zorder\n };\n }\n });\n\n // src/traces/bar/layout_attributes.js\n var require_layout_attributes6 = __commonJS({\n \"src/traces/bar/layout_attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n barmode: {\n valType: \"enumerated\",\n values: [\"stack\", \"group\", \"overlay\", \"relative\"],\n dflt: \"group\",\n editType: \"calc\"\n },\n barnorm: {\n valType: \"enumerated\",\n values: [\"\", \"fraction\", \"percent\"],\n dflt: \"\",\n editType: \"calc\"\n },\n bargap: {\n valType: \"number\",\n min: 0,\n max: 1,\n editType: \"calc\"\n },\n bargroupgap: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0,\n editType: \"calc\"\n },\n barcornerradius: {\n valType: \"any\",\n editType: \"calc\"\n }\n };\n }\n });\n\n // src/traces/bar/style_defaults.js\n var require_style_defaults = __commonJS({\n \"src/traces/bar/style_defaults.js\"(exports, module) {\n \"use strict\";\n var Color2 = require_color();\n var hasColorscale = require_helpers().hasColorscale;\n var colorscaleDefaults = require_defaults2();\n var coercePattern = require_lib().coercePattern;\n module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout) {\n var markerColor = coerce(\"marker.color\", defaultColor);\n var hasMarkerColorscale = hasColorscale(traceIn, \"marker\");\n if (hasMarkerColorscale) {\n colorscaleDefaults(\n traceIn,\n traceOut,\n layout,\n coerce,\n { prefix: \"marker.\", cLetter: \"c\" }\n );\n }\n coerce(\"marker.line.color\", Color2.defaultLine);\n if (hasColorscale(traceIn, \"marker.line\")) {\n colorscaleDefaults(\n traceIn,\n traceOut,\n layout,\n coerce,\n { prefix: \"marker.line.\", cLetter: \"c\" }\n );\n }\n coerce(\"marker.line.width\");\n coerce(\"marker.opacity\");\n coercePattern(coerce, \"marker.pattern\", markerColor, hasMarkerColorscale);\n coerce(\"selected.marker.color\");\n coerce(\"unselected.marker.color\");\n };\n }\n });\n\n // src/traces/bar/defaults.js\n var require_defaults19 = __commonJS({\n \"src/traces/bar/defaults.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var Color2 = require_color();\n var Registry = require_registry();\n var handleXYDefaults = require_xy_defaults();\n var handlePeriodDefaults = require_period_defaults();\n var handleStyleDefaults = require_style_defaults();\n var handleGroupingDefaults = require_grouping_defaults();\n var attributes = require_attributes23();\n var coerceFont = Lib.coerceFont;\n function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var len = handleXYDefaults(traceIn, traceOut, layout, coerce);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n handlePeriodDefaults(traceIn, traceOut, layout, coerce);\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n coerce(\"zorder\");\n coerce(\"orientation\", traceOut.x && !traceOut.y ? \"h\" : \"v\");\n coerce(\"base\");\n coerce(\"offset\");\n coerce(\"width\");\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n var textposition = coerce(\"textposition\");\n handleText(traceIn, traceOut, layout, coerce, textposition, {\n moduleHasSelected: true,\n moduleHasUnselected: true,\n moduleHasConstrain: true,\n moduleHasCliponaxis: true,\n moduleHasTextangle: true,\n moduleHasInsideanchor: true\n });\n handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout);\n var lineColor = (traceOut.marker.line || {}).color;\n var errorBarsSupplyDefaults = Registry.getComponentMethod(\"errorbars\", \"supplyDefaults\");\n errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color2.defaultLine, { axis: \"y\" });\n errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color2.defaultLine, { axis: \"x\", inherit: \"y\" });\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n }\n function crossTraceDefaults(fullData, fullLayout) {\n var traceIn, traceOut;\n function coerce(attr, dflt) {\n return Lib.coerce(traceOut._input, traceOut, attributes, attr, dflt);\n }\n for (var i = 0; i < fullData.length; i++) {\n traceOut = fullData[i];\n if (traceOut.type === \"bar\") {\n traceIn = traceOut._input;\n var r = coerce(\"marker.cornerradius\", fullLayout.barcornerradius);\n if (traceOut.marker) {\n traceOut.marker.cornerradius = validateCornerradius(r);\n }\n handleGroupingDefaults(traceIn, traceOut, fullLayout, coerce, fullLayout.barmode);\n }\n }\n }\n function validateCornerradius(r) {\n if (isNumeric(r)) {\n r = +r;\n if (r >= 0) return r;\n } else if (typeof r === \"string\") {\n r = r.trim();\n if (r.slice(-1) === \"%\" && isNumeric(r.slice(0, -1))) {\n r = +r.slice(0, -1);\n if (r >= 0) return r + \"%\";\n }\n }\n return void 0;\n }\n function handleText(traceIn, traceOut, layout, coerce, textposition, opts) {\n opts = opts || {};\n var moduleHasSelected = !(opts.moduleHasSelected === false);\n var moduleHasUnselected = !(opts.moduleHasUnselected === false);\n var moduleHasConstrain = !(opts.moduleHasConstrain === false);\n var moduleHasCliponaxis = !(opts.moduleHasCliponaxis === false);\n var moduleHasTextangle = !(opts.moduleHasTextangle === false);\n var moduleHasInsideanchor = !(opts.moduleHasInsideanchor === false);\n var hasPathbar = !!opts.hasPathbar;\n var hasBoth = Array.isArray(textposition) || textposition === \"auto\";\n var hasInside = hasBoth || textposition === \"inside\";\n var hasOutside = hasBoth || textposition === \"outside\";\n if (hasInside || hasOutside) {\n var dfltFont = coerceFont(coerce, \"textfont\", layout.font);\n var insideTextFontDefault = Lib.extendFlat({}, dfltFont);\n var isTraceTextfontColorSet = traceIn.textfont && traceIn.textfont.color;\n var isColorInheritedFromLayoutFont = !isTraceTextfontColorSet;\n if (isColorInheritedFromLayoutFont) {\n delete insideTextFontDefault.color;\n }\n coerceFont(coerce, \"insidetextfont\", insideTextFontDefault);\n if (hasPathbar) {\n var pathbarTextFontDefault = Lib.extendFlat({}, dfltFont);\n if (isColorInheritedFromLayoutFont) {\n delete pathbarTextFontDefault.color;\n }\n coerceFont(coerce, \"pathbar.textfont\", pathbarTextFontDefault);\n }\n if (hasOutside) coerceFont(coerce, \"outsidetextfont\", dfltFont);\n if (moduleHasSelected) coerce(\"selected.textfont.color\");\n if (moduleHasUnselected) coerce(\"unselected.textfont.color\");\n if (moduleHasConstrain) coerce(\"constraintext\");\n if (moduleHasCliponaxis) coerce(\"cliponaxis\");\n if (moduleHasTextangle) coerce(\"textangle\");\n coerce(\"texttemplate\");\n }\n if (hasInside) {\n if (moduleHasInsideanchor) coerce(\"insidetextanchor\");\n }\n }\n module.exports = {\n supplyDefaults,\n crossTraceDefaults,\n handleText,\n validateCornerradius\n };\n }\n });\n\n // src/traces/bar/layout_defaults.js\n var require_layout_defaults5 = __commonJS({\n \"src/traces/bar/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var Axes = require_axes();\n var Lib = require_lib();\n var layoutAttributes = require_layout_attributes6();\n var validateCornerradius = require_defaults19().validateCornerradius;\n module.exports = function(layoutIn, layoutOut, fullData) {\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);\n }\n var hasBars = false;\n var shouldBeGapless = false;\n var gappedAnyway = false;\n var usedSubplots = {};\n var mode = coerce(\"barmode\");\n var isGroup = mode === \"group\";\n for (var i = 0; i < fullData.length; i++) {\n var trace = fullData[i];\n if (Registry.traceIs(trace, \"bar\") && trace.visible) hasBars = true;\n else continue;\n var subploti = trace.xaxis + trace.yaxis;\n if (isGroup) {\n if (usedSubplots[subploti]) gappedAnyway = true;\n usedSubplots[subploti] = true;\n } else {\n subploti += trace._input.offsetgroup;\n if (usedSubplots.length > 0 && !usedSubplots[subploti]) gappedAnyway = true;\n usedSubplots[subploti] = true;\n }\n if (trace.visible && trace.type === \"histogram\") {\n var pa = Axes.getFromId(\n { _fullLayout: layoutOut },\n trace[trace.orientation === \"v\" ? \"xaxis\" : \"yaxis\"]\n );\n if (pa.type !== \"category\") shouldBeGapless = true;\n }\n }\n if (!hasBars) {\n delete layoutOut.barmode;\n return;\n }\n if (mode !== \"overlay\") coerce(\"barnorm\");\n coerce(\"bargap\", shouldBeGapless && !gappedAnyway ? 0 : 0.2);\n coerce(\"bargroupgap\");\n var r = coerce(\"barcornerradius\");\n layoutOut.barcornerradius = validateCornerradius(r);\n };\n }\n });\n\n // src/traces/bar/arrays_to_calcdata.js\n var require_arrays_to_calcdata2 = __commonJS({\n \"src/traces/bar/arrays_to_calcdata.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n module.exports = function arraysToCalcdata(cd, trace) {\n for (var i = 0; i < cd.length; i++) cd[i].i = i;\n Lib.mergeArray(trace.text, cd, \"tx\");\n Lib.mergeArray(trace.hovertext, cd, \"htx\");\n var marker = trace.marker;\n if (marker) {\n Lib.mergeArray(marker.opacity, cd, \"mo\", true);\n Lib.mergeArray(marker.color, cd, \"mc\");\n var markerLine = marker.line;\n if (markerLine) {\n Lib.mergeArray(markerLine.color, cd, \"mlc\");\n Lib.mergeArrayCastPositive(markerLine.width, cd, \"mlw\");\n }\n }\n };\n }\n });\n\n // src/traces/bar/calc.js\n var require_calc5 = __commonJS({\n \"src/traces/bar/calc.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n var alignPeriod = require_align_period();\n var hasColorscale = require_helpers().hasColorscale;\n var colorscaleCalc = require_calc();\n var arraysToCalcdata = require_arrays_to_calcdata2();\n var calcSelection = require_calc_selection();\n module.exports = function calc(gd, trace) {\n var xa = Axes.getFromId(gd, trace.xaxis || \"x\");\n var ya = Axes.getFromId(gd, trace.yaxis || \"y\");\n var size, pos, origPos, pObj, hasPeriod, pLetter;\n var sizeOpts = {\n msUTC: !!(trace.base || trace.base === 0)\n };\n if (trace.orientation === \"h\") {\n size = xa.makeCalcdata(trace, \"x\", sizeOpts);\n origPos = ya.makeCalcdata(trace, \"y\");\n pObj = alignPeriod(trace, ya, \"y\", origPos);\n hasPeriod = !!trace.yperiodalignment;\n pLetter = \"y\";\n } else {\n size = ya.makeCalcdata(trace, \"y\", sizeOpts);\n origPos = xa.makeCalcdata(trace, \"x\");\n pObj = alignPeriod(trace, xa, \"x\", origPos);\n hasPeriod = !!trace.xperiodalignment;\n pLetter = \"x\";\n }\n pos = pObj.vals;\n var serieslen = Math.min(pos.length, size.length);\n var cd = new Array(serieslen);\n for (var i = 0; i < serieslen; i++) {\n cd[i] = { p: pos[i], s: size[i] };\n if (hasPeriod) {\n cd[i].orig_p = origPos[i];\n cd[i][pLetter + \"End\"] = pObj.ends[i];\n cd[i][pLetter + \"Start\"] = pObj.starts[i];\n }\n if (trace.ids) {\n cd[i].id = String(trace.ids[i]);\n }\n }\n if (hasColorscale(trace, \"marker\")) {\n colorscaleCalc(gd, trace, {\n vals: trace.marker.color,\n containerStr: \"marker\",\n cLetter: \"c\"\n });\n }\n if (hasColorscale(trace, \"marker.line\")) {\n colorscaleCalc(gd, trace, {\n vals: trace.marker.line.color,\n containerStr: \"marker.line\",\n cLetter: \"c\"\n });\n }\n arraysToCalcdata(cd, trace);\n calcSelection(cd, trace);\n return cd;\n };\n }\n });\n\n // src/traces/bar/uniform_text.js\n var require_uniform_text = __commonJS({\n \"src/traces/bar/uniform_text.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n function resizeText(gd, gTrace, traceType) {\n var fullLayout = gd._fullLayout;\n var minSize = fullLayout[\"_\" + traceType + \"Text_minsize\"];\n if (minSize) {\n var shouldHide = fullLayout.uniformtext.mode === \"hide\";\n var selector;\n switch (traceType) {\n case \"funnelarea\":\n case \"pie\":\n case \"sunburst\":\n selector = \"g.slice\";\n break;\n case \"treemap\":\n case \"icicle\":\n selector = \"g.slice, g.pathbar\";\n break;\n default:\n selector = \"g.points > g.point\";\n }\n gTrace.selectAll(selector).each(function(d) {\n var transform = d.transform;\n if (transform) {\n transform.scale = shouldHide && transform.hide ? 0 : minSize / transform.fontSize;\n var el = d3.select(this).select(\"text\");\n Lib.setTransormAndDisplay(el, transform);\n }\n });\n }\n }\n function recordMinTextSize(traceType, transform, fullLayout) {\n if (fullLayout.uniformtext.mode) {\n var minKey = getMinKey(traceType);\n var minSize = fullLayout.uniformtext.minsize;\n var size = transform.scale * transform.fontSize;\n transform.hide = size < minSize;\n fullLayout[minKey] = fullLayout[minKey] || Infinity;\n if (!transform.hide) {\n fullLayout[minKey] = Math.min(\n fullLayout[minKey],\n Math.max(size, minSize)\n );\n }\n }\n }\n function clearMinTextSize(traceType, fullLayout) {\n var minKey = getMinKey(traceType);\n fullLayout[minKey] = void 0;\n }\n function getMinKey(traceType) {\n return \"_\" + traceType + \"Text_minsize\";\n }\n module.exports = {\n recordMinTextSize,\n clearMinTextSize,\n resizeText\n };\n }\n });\n\n // src/traces/bar/helpers.js\n var require_helpers12 = __commonJS({\n \"src/traces/bar/helpers.js\"(exports) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var tinycolor = require_tinycolor();\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n exports.coerceString = function(attributeDefinition, value, defaultValue) {\n if (typeof value === \"string\") {\n if (value || !attributeDefinition.noBlank) return value;\n } else if (typeof value === \"number\" || value === true) {\n if (!attributeDefinition.strict) return String(value);\n }\n return defaultValue !== void 0 ? defaultValue : attributeDefinition.dflt;\n };\n exports.coerceNumber = function(attributeDefinition, value, defaultValue) {\n if (isNumeric(value)) {\n value = +value;\n var min = attributeDefinition.min;\n var max = attributeDefinition.max;\n var isOutOfBounds = min !== void 0 && value < min || max !== void 0 && value > max;\n if (!isOutOfBounds) return value;\n }\n return defaultValue !== void 0 ? defaultValue : attributeDefinition.dflt;\n };\n exports.coerceColor = function(attributeDefinition, value, defaultValue) {\n if (tinycolor(value).isValid()) return value;\n return defaultValue !== void 0 ? defaultValue : attributeDefinition.dflt;\n };\n exports.coerceEnumerated = function(attributeDefinition, value, defaultValue) {\n if (attributeDefinition.coerceNumber) value = +value;\n if (attributeDefinition.values.indexOf(value) !== -1) return value;\n return defaultValue !== void 0 ? defaultValue : attributeDefinition.dflt;\n };\n exports.getValue = function(arrayOrScalar, index) {\n var value;\n if (!isArrayOrTypedArray(arrayOrScalar)) value = arrayOrScalar;\n else if (index < arrayOrScalar.length) value = arrayOrScalar[index];\n return value;\n };\n exports.getLineWidth = function(trace, di) {\n var w = 0 < di.mlw ? di.mlw : !isArrayOrTypedArray(trace.marker.line.width) ? trace.marker.line.width : 0;\n return w;\n };\n }\n });\n\n // src/traces/bar/style.js\n var require_style4 = __commonJS({\n \"src/traces/bar/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Color2 = require_color();\n var Drawing = require_drawing();\n var Lib = require_lib();\n var Registry = require_registry();\n var resizeText = require_uniform_text().resizeText;\n var attributes = require_attributes23();\n var attributeTextFont = attributes.textfont;\n var attributeInsideTextFont = attributes.insidetextfont;\n var attributeOutsideTextFont = attributes.outsidetextfont;\n var helpers = require_helpers12();\n function style(gd) {\n var s = d3.select(gd).selectAll('g[class^=\"barlayer\"]').selectAll(\"g.trace\");\n resizeText(gd, s, \"bar\");\n var barcount = s.size();\n var fullLayout = gd._fullLayout;\n s.style(\"opacity\", function(d) {\n return d[0].trace.opacity;\n }).each(function(d) {\n if (fullLayout.barmode === \"stack\" && barcount > 1 || fullLayout.bargap === 0 && fullLayout.bargroupgap === 0 && !d[0].trace.marker.line.width) {\n d3.select(this).attr(\"shape-rendering\", \"crispEdges\");\n }\n });\n s.selectAll(\"g.points\").each(function(d) {\n var sel = d3.select(this);\n var trace = d[0].trace;\n stylePoints(sel, trace, gd);\n });\n Registry.getComponentMethod(\"errorbars\", \"style\")(s);\n }\n function stylePoints(sel, trace, gd) {\n Drawing.pointStyle(sel.selectAll(\"path\"), trace, gd);\n styleTextPoints(sel, trace, gd);\n }\n function styleTextPoints(sel, trace, gd) {\n sel.selectAll(\"text\").each(function(d) {\n var tx = d3.select(this);\n var font = Lib.ensureUniformFontSize(gd, determineFont(tx, d, trace, gd));\n Drawing.font(tx, font);\n });\n }\n function styleOnSelect(gd, cd, sel) {\n var trace = cd[0].trace;\n if (trace.selectedpoints) {\n stylePointsInSelectionMode(sel, trace, gd);\n } else {\n stylePoints(sel, trace, gd);\n Registry.getComponentMethod(\"errorbars\", \"style\")(sel);\n }\n }\n function stylePointsInSelectionMode(s, trace, gd) {\n Drawing.selectedPointStyle(s.selectAll(\"path\"), trace);\n styleTextInSelectionMode(s.selectAll(\"text\"), trace, gd);\n }\n function styleTextInSelectionMode(txs, trace, gd) {\n txs.each(function(d) {\n var tx = d3.select(this);\n var font;\n if (d.selected) {\n font = Lib.ensureUniformFontSize(gd, determineFont(tx, d, trace, gd));\n var selectedFontColor = trace.selected.textfont && trace.selected.textfont.color;\n if (selectedFontColor) {\n font.color = selectedFontColor;\n }\n Drawing.font(tx, font);\n } else {\n Drawing.selectedTextStyle(tx, trace);\n }\n });\n }\n function determineFont(tx, d, trace, gd) {\n var layoutFont = gd._fullLayout.font;\n var textFont = trace.textfont;\n if (tx.classed(\"bartext-inside\")) {\n var barColor = getBarColor(d, trace);\n textFont = getInsideTextFont(trace, d.i, layoutFont, barColor);\n } else if (tx.classed(\"bartext-outside\")) {\n textFont = getOutsideTextFont(trace, d.i, layoutFont);\n }\n return textFont;\n }\n function getTextFont(trace, index, defaultValue) {\n return getFontValue(\n attributeTextFont,\n trace.textfont,\n index,\n defaultValue\n );\n }\n function getInsideTextFont(trace, index, layoutFont, barColor) {\n var defaultFont = getTextFont(trace, index, layoutFont);\n var wouldFallBackToLayoutFont = trace._input.textfont === void 0 || trace._input.textfont.color === void 0 || Array.isArray(trace.textfont.color) && trace.textfont.color[index] === void 0;\n if (wouldFallBackToLayoutFont) {\n defaultFont = {\n color: Color2.contrast(barColor),\n family: defaultFont.family,\n size: defaultFont.size,\n weight: defaultFont.weight,\n style: defaultFont.style,\n variant: defaultFont.variant,\n textcase: defaultFont.textcase,\n lineposition: defaultFont.lineposition,\n shadow: defaultFont.shadow\n };\n }\n return getFontValue(\n attributeInsideTextFont,\n trace.insidetextfont,\n index,\n defaultFont\n );\n }\n function getOutsideTextFont(trace, index, layoutFont) {\n var defaultFont = getTextFont(trace, index, layoutFont);\n return getFontValue(\n attributeOutsideTextFont,\n trace.outsidetextfont,\n index,\n defaultFont\n );\n }\n function getFontValue(attributeDefinition, attributeValue, index, defaultValue) {\n attributeValue = attributeValue || {};\n var familyValue = helpers.getValue(attributeValue.family, index);\n var sizeValue = helpers.getValue(attributeValue.size, index);\n var colorValue = helpers.getValue(attributeValue.color, index);\n var weightValue = helpers.getValue(attributeValue.weight, index);\n var styleValue = helpers.getValue(attributeValue.style, index);\n var variantValue = helpers.getValue(attributeValue.variant, index);\n var textcaseValue = helpers.getValue(attributeValue.textcase, index);\n var linepositionValue = helpers.getValue(attributeValue.lineposition, index);\n var shadowValue = helpers.getValue(attributeValue.shadow, index);\n return {\n family: helpers.coerceString(\n attributeDefinition.family,\n familyValue,\n defaultValue.family\n ),\n size: helpers.coerceNumber(\n attributeDefinition.size,\n sizeValue,\n defaultValue.size\n ),\n color: helpers.coerceColor(\n attributeDefinition.color,\n colorValue,\n defaultValue.color\n ),\n weight: helpers.coerceString(\n attributeDefinition.weight,\n weightValue,\n defaultValue.weight\n ),\n style: helpers.coerceString(\n attributeDefinition.style,\n styleValue,\n defaultValue.style\n ),\n variant: helpers.coerceString(\n attributeDefinition.variant,\n variantValue,\n defaultValue.variant\n ),\n textcase: helpers.coerceString(\n attributeDefinition.variant,\n textcaseValue,\n defaultValue.textcase\n ),\n lineposition: helpers.coerceString(\n attributeDefinition.variant,\n linepositionValue,\n defaultValue.lineposition\n ),\n shadow: helpers.coerceString(\n attributeDefinition.variant,\n shadowValue,\n defaultValue.shadow\n )\n };\n }\n function getBarColor(cd, trace) {\n if (trace.type === \"waterfall\") {\n return trace[cd.dir].marker.color;\n }\n return cd.mcc || cd.mc || trace.marker.color;\n }\n module.exports = {\n style,\n styleTextPoints,\n styleOnSelect,\n getInsideTextFont,\n getOutsideTextFont,\n getBarColor,\n resizeText\n };\n }\n });\n\n // src/traces/bar/plot.js\n var require_plot3 = __commonJS({\n \"src/traces/bar/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var svgTextUtils = require_svg_text_utils();\n var Color2 = require_color();\n var Drawing = require_drawing();\n var Registry = require_registry();\n var tickText = require_axes().tickText;\n var uniformText = require_uniform_text();\n var recordMinTextSize = uniformText.recordMinTextSize;\n var clearMinTextSize = uniformText.clearMinTextSize;\n var style = require_style4();\n var helpers = require_helpers12();\n var constants = require_constants14();\n var attributes = require_attributes23();\n var attributeText = attributes.text;\n var attributeTextPosition = attributes.textposition;\n var appendArrayPointValue = require_helpers2().appendArrayPointValue;\n var TEXTPAD = constants.TEXTPAD;\n function keyFunc(d) {\n return d.id;\n }\n function getKeyFunc(trace) {\n if (trace.ids) {\n return keyFunc;\n }\n }\n function sign(v) {\n return (v > 0) - (v < 0);\n }\n function dirSign(a, b) {\n return a < b ? 1 : -1;\n }\n function getXY(di, xa, ya, isHorizontal) {\n var s = [];\n var p = [];\n var sAxis = isHorizontal ? xa : ya;\n var pAxis = isHorizontal ? ya : xa;\n s[0] = sAxis.c2p(di.s0, true);\n p[0] = pAxis.c2p(di.p0, true);\n s[1] = sAxis.c2p(di.s1, true);\n p[1] = pAxis.c2p(di.p1, true);\n return isHorizontal ? [s, p] : [p, s];\n }\n function transition(selection, fullLayout, opts, makeOnCompleteCallback) {\n if (!fullLayout.uniformtext.mode && hasTransition(opts)) {\n var onComplete;\n if (makeOnCompleteCallback) {\n onComplete = makeOnCompleteCallback();\n }\n return selection.transition().duration(opts.duration).ease(opts.easing).each(\"end\", function() {\n onComplete && onComplete();\n }).each(\"interrupt\", function() {\n onComplete && onComplete();\n });\n } else {\n return selection;\n }\n }\n function hasTransition(transitionOpts) {\n return transitionOpts && transitionOpts.duration > 0;\n }\n function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var fullLayout = gd._fullLayout;\n var isStatic = gd._context.staticPlot;\n if (!opts) {\n opts = {\n mode: fullLayout.barmode,\n norm: fullLayout.barmode,\n gap: fullLayout.bargap,\n groupgap: fullLayout.bargroupgap\n };\n clearMinTextSize(\"bar\", fullLayout);\n }\n var bartraces = Lib.makeTraceGroups(traceLayer, cdModule, \"trace bars\").each(function(cd) {\n var plotGroup = d3.select(this);\n var trace = cd[0].trace;\n var t = cd[0].t;\n var isWaterfall = trace.type === \"waterfall\";\n var isFunnel = trace.type === \"funnel\";\n var isHistogram = trace.type === \"histogram\";\n var isBar = trace.type === \"bar\";\n var shouldDisplayZeros = isBar || isFunnel;\n var adjustPixel = 0;\n if (isWaterfall && trace.connector.visible && trace.connector.mode === \"between\") {\n adjustPixel = trace.connector.line.width / 2;\n }\n var isHorizontal = trace.orientation === \"h\";\n var withTransition = hasTransition(opts);\n var pointGroup = Lib.ensureSingle(plotGroup, \"g\", \"points\");\n var keyFunc2 = getKeyFunc(trace);\n var bars = pointGroup.selectAll(\"g.point\").data(Lib.identity, keyFunc2);\n bars.enter().append(\"g\").classed(\"point\", true);\n bars.exit().remove();\n bars.each(function(di, i) {\n var bar = d3.select(this);\n var xy = getXY(di, xa, ya, isHorizontal);\n var x0 = xy[0][0];\n var x1 = xy[0][1];\n var y0 = xy[1][0];\n var y1 = xy[1][1];\n var isBlank = (isHorizontal ? x1 - x0 : y1 - y0) === 0;\n if (isBlank && shouldDisplayZeros && helpers.getLineWidth(trace, di)) {\n isBlank = false;\n }\n if (!isBlank) {\n isBlank = !isNumeric(x0) || !isNumeric(x1) || !isNumeric(y0) || !isNumeric(y1);\n }\n di.isBlank = isBlank;\n if (isBlank) {\n if (isHorizontal) {\n x1 = x0;\n } else {\n y1 = y0;\n }\n }\n if (adjustPixel && !isBlank) {\n if (isHorizontal) {\n x0 -= dirSign(x0, x1) * adjustPixel;\n x1 += dirSign(x0, x1) * adjustPixel;\n } else {\n y0 -= dirSign(y0, y1) * adjustPixel;\n y1 += dirSign(y0, y1) * adjustPixel;\n }\n }\n var lw;\n var mc;\n if (trace.type === \"waterfall\") {\n if (!isBlank) {\n var cont = trace[di.dir].marker;\n lw = cont.line.width;\n mc = cont.color;\n }\n } else {\n lw = helpers.getLineWidth(trace, di);\n mc = di.mc || trace.marker.color;\n }\n function roundWithLine(v) {\n var offset = d3.round(lw / 2 % 1, 2);\n return opts.gap === 0 && opts.groupgap === 0 ? d3.round(Math.round(v) - offset, 2) : v;\n }\n function expandToVisible(v, vc, hideZeroSpan) {\n if (hideZeroSpan && v === vc) {\n return v;\n }\n return Math.abs(v - vc) >= 2 ? roundWithLine(v) : (\n // but if it's very thin, expand it so it's\n // necessarily visible, even if it might overlap\n // its neighbor\n v > vc ? Math.ceil(v) : Math.floor(v)\n );\n }\n var op = Color2.opacity(mc);\n var fixpx = op < 1 || lw > 0.01 ? roundWithLine : expandToVisible;\n if (!gd._context.staticPlot) {\n x0 = fixpx(x0, x1, isHorizontal);\n x1 = fixpx(x1, x0, isHorizontal);\n y0 = fixpx(y0, y1, !isHorizontal);\n y1 = fixpx(y1, y0, !isHorizontal);\n }\n var c2p = isHorizontal ? xa.c2p : ya.c2p;\n var outerBound;\n if (di.s0 > 0) {\n outerBound = di._sMax;\n } else if (di.s0 < 0) {\n outerBound = di._sMin;\n } else {\n outerBound = di.s1 > 0 ? di._sMax : di._sMin;\n }\n function calcCornerRadius(crValue, crForm) {\n if (!crValue) return 0;\n var barWidth = isHorizontal ? Math.abs(y1 - y0) : Math.abs(x1 - x0);\n var barLength = isHorizontal ? Math.abs(x1 - x0) : Math.abs(y1 - y0);\n var stackedBarTotalLength = fixpx(Math.abs(c2p(outerBound, true) - c2p(0, true)));\n var maxRadius = di.hasB ? Math.min(barWidth / 2, barLength / 2) : Math.min(barWidth / 2, stackedBarTotalLength);\n var crPx;\n if (crForm === \"%\") {\n var crPercent = Math.min(50, crValue);\n crPx = barWidth * (crPercent / 100);\n } else {\n crPx = crValue;\n }\n return fixpx(Math.max(Math.min(crPx, maxRadius), 0));\n }\n var r = isBar || isHistogram ? calcCornerRadius(t.cornerradiusvalue, t.cornerradiusform) : 0;\n var path, h;\n var rectanglePath = \"M\" + x0 + \",\" + y0 + \"V\" + y1 + \"H\" + x1 + \"V\" + y0 + \"Z\";\n var overhead = 0;\n if (r && di.s) {\n var refPoint = sign(di.s0) === 0 || sign(di.s) === sign(di.s0) ? di.s1 : di.s0;\n overhead = fixpx(!di.hasB ? Math.abs(c2p(outerBound, true) - c2p(refPoint, true)) : 0);\n if (overhead < r) {\n var xdir = dirSign(x0, x1);\n var ydir = dirSign(y0, y1);\n var cornersweep = xdir === -ydir ? 1 : 0;\n if (isHorizontal) {\n if (di.hasB) {\n path = \"M\" + (x0 + r * xdir) + \",\" + y0 + \"A \" + r + \",\" + r + \" 0 0 \" + cornersweep + \" \" + x0 + \",\" + (y0 + r * ydir) + \"V\" + (y1 - r * ydir) + \"A \" + r + \",\" + r + \" 0 0 \" + cornersweep + \" \" + (x0 + r * xdir) + \",\" + y1 + \"H\" + (x1 - r * xdir) + \"A \" + r + \",\" + r + \" 0 0 \" + cornersweep + \" \" + x1 + \",\" + (y1 - r * ydir) + \"V\" + (y0 + r * ydir) + \"A \" + r + \",\" + r + \" 0 0 \" + cornersweep + \" \" + (x1 - r * xdir) + \",\" + y0 + \"Z\";\n } else {\n h = Math.abs(x1 - x0) + overhead;\n var dy1 = h < r ? r - Math.sqrt(h * (2 * r - h)) : 0;\n var dy2 = overhead > 0 ? Math.sqrt(overhead * (2 * r - overhead)) : 0;\n var xminfunc = xdir > 0 ? Math.max : Math.min;\n path = \"M\" + x0 + \",\" + y0 + \"V\" + (y1 - dy1 * ydir) + \"H\" + xminfunc(x1 - (r - overhead) * xdir, x0) + \"A \" + r + \",\" + r + \" 0 0 \" + cornersweep + \" \" + x1 + \",\" + (y1 - r * ydir - dy2) + \"V\" + (y0 + r * ydir + dy2) + \"A \" + r + \",\" + r + \" 0 0 \" + cornersweep + \" \" + xminfunc(x1 - (r - overhead) * xdir, x0) + \",\" + (y0 + dy1 * ydir) + \"Z\";\n }\n } else {\n if (di.hasB) {\n path = \"M\" + (x0 + r * xdir) + \",\" + y0 + \"A \" + r + \",\" + r + \" 0 0 \" + cornersweep + \" \" + x0 + \",\" + (y0 + r * ydir) + \"V\" + (y1 - r * ydir) + \"A \" + r + \",\" + r + \" 0 0 \" + cornersweep + \" \" + (x0 + r * xdir) + \",\" + y1 + \"H\" + (x1 - r * xdir) + \"A \" + r + \",\" + r + \" 0 0 \" + cornersweep + \" \" + x1 + \",\" + (y1 - r * ydir) + \"V\" + (y0 + r * ydir) + \"A \" + r + \",\" + r + \" 0 0 \" + cornersweep + \" \" + (x1 - r * xdir) + \",\" + y0 + \"Z\";\n } else {\n h = Math.abs(y1 - y0) + overhead;\n var dx1 = h < r ? r - Math.sqrt(h * (2 * r - h)) : 0;\n var dx2 = overhead > 0 ? Math.sqrt(overhead * (2 * r - overhead)) : 0;\n var yminfunc = ydir > 0 ? Math.max : Math.min;\n path = \"M\" + (x0 + dx1 * xdir) + \",\" + y0 + \"V\" + yminfunc(y1 - (r - overhead) * ydir, y0) + \"A \" + r + \",\" + r + \" 0 0 \" + cornersweep + \" \" + (x0 + r * xdir - dx2) + \",\" + y1 + \"H\" + (x1 - r * xdir + dx2) + \"A \" + r + \",\" + r + \" 0 0 \" + cornersweep + \" \" + (x1 - dx1 * xdir) + \",\" + yminfunc(y1 - (r - overhead) * ydir, y0) + \"V\" + y0 + \"Z\";\n }\n }\n } else {\n path = rectanglePath;\n }\n } else {\n path = rectanglePath;\n }\n var sel = transition(Lib.ensureSingle(bar, \"path\"), fullLayout, opts, makeOnCompleteCallback);\n sel.style(\"vector-effect\", isStatic ? \"none\" : \"non-scaling-stroke\").attr(\"d\", isNaN((x1 - x0) * (y1 - y0)) || isBlank && gd._context.staticPlot ? \"M0,0Z\" : path).call(Drawing.setClipUrl, plotinfo.layerClipId, gd);\n if (!fullLayout.uniformtext.mode && withTransition) {\n var styleFns = Drawing.makePointStyleFns(trace);\n Drawing.singlePointStyle(di, sel, trace, styleFns, gd);\n }\n appendBarText(gd, plotinfo, bar, cd, i, x0, x1, y0, y1, r, overhead, opts, makeOnCompleteCallback);\n if (plotinfo.layerClipId) {\n Drawing.hideOutsideRangePoint(di, bar.select(\"text\"), xa, ya, trace.xcalendar, trace.ycalendar);\n }\n });\n var hasClipOnAxisFalse = trace.cliponaxis === false;\n Drawing.setClipUrl(plotGroup, hasClipOnAxisFalse ? null : plotinfo.layerClipId, gd);\n });\n Registry.getComponentMethod(\"errorbars\", \"plot\")(gd, bartraces, plotinfo, opts);\n }\n function appendBarText(gd, plotinfo, bar, cd, i, x0, x1, y0, y1, r, overhead, opts, makeOnCompleteCallback) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var fullLayout = gd._fullLayout;\n var textPosition;\n function appendTextNode(bar2, text2, font2) {\n var textSelection2 = Lib.ensureSingle(bar2, \"text\").text(text2).attr({\n class: \"bartext bartext-\" + textPosition,\n \"text-anchor\": \"middle\",\n // prohibit tex interpretation until we can handle\n // tex and regular text together\n \"data-notex\": 1\n }).call(Drawing.font, font2).call(svgTextUtils.convertToTspans, gd);\n return textSelection2;\n }\n var trace = cd[0].trace;\n var isHorizontal = trace.orientation === \"h\";\n var text = getText(fullLayout, cd, i, xa, ya);\n textPosition = getTextPosition(trace, i);\n var inStackOrRelativeMode = opts.mode === \"stack\" || opts.mode === \"relative\";\n var calcBar = cd[i];\n var isOutmostBar = !inStackOrRelativeMode || calcBar._outmost;\n var hasB = calcBar.hasB;\n var barIsRounded = r && r - overhead > TEXTPAD;\n if (!text || textPosition === \"none\" || (calcBar.isBlank || x0 === x1 || y0 === y1) && (textPosition === \"auto\" || textPosition === \"inside\")) {\n bar.select(\"text\").remove();\n return;\n }\n var layoutFont = fullLayout.font;\n var barColor = style.getBarColor(cd[i], trace);\n var insideTextFont = style.getInsideTextFont(trace, i, layoutFont, barColor);\n var outsideTextFont = style.getOutsideTextFont(trace, i, layoutFont);\n var insidetextanchor = trace.insidetextanchor || \"end\";\n var di = bar.datum();\n if (isHorizontal) {\n if (xa.type === \"log\" && di.s0 <= 0) {\n if (xa.range[0] < xa.range[1]) {\n x0 = 0;\n } else {\n x0 = xa._length;\n }\n }\n } else {\n if (ya.type === \"log\" && di.s0 <= 0) {\n if (ya.range[0] < ya.range[1]) {\n y0 = ya._length;\n } else {\n y0 = 0;\n }\n }\n }\n var lx = Math.abs(x1 - x0);\n var ly = Math.abs(y1 - y0);\n var barWidth = lx - 2 * TEXTPAD;\n var barHeight = ly - 2 * TEXTPAD;\n var textSelection;\n var textBB;\n var textWidth;\n var textHeight;\n var font;\n if (textPosition === \"outside\") {\n if (!isOutmostBar && !calcBar.hasB) textPosition = \"inside\";\n }\n if (textPosition === \"auto\") {\n if (isOutmostBar) {\n textPosition = \"inside\";\n font = Lib.ensureUniformFontSize(gd, insideTextFont);\n textSelection = appendTextNode(bar, text, font);\n textBB = Drawing.bBox(textSelection.node());\n textWidth = textBB.width;\n textHeight = textBB.height;\n var textHasSize = textWidth > 0 && textHeight > 0;\n var fitsInside;\n if (barIsRounded) {\n if (hasB) {\n fitsInside = textfitsInsideBar(barWidth - 2 * r, barHeight, textWidth, textHeight, isHorizontal) || textfitsInsideBar(barWidth, barHeight - 2 * r, textWidth, textHeight, isHorizontal);\n } else if (isHorizontal) {\n fitsInside = textfitsInsideBar(barWidth - (r - overhead), barHeight, textWidth, textHeight, isHorizontal) || textfitsInsideBar(barWidth, barHeight - 2 * (r - overhead), textWidth, textHeight, isHorizontal);\n } else {\n fitsInside = textfitsInsideBar(barWidth, barHeight - (r - overhead), textWidth, textHeight, isHorizontal) || textfitsInsideBar(barWidth - 2 * (r - overhead), barHeight, textWidth, textHeight, isHorizontal);\n }\n } else {\n fitsInside = textfitsInsideBar(barWidth, barHeight, textWidth, textHeight, isHorizontal);\n }\n if (textHasSize && fitsInside) {\n textPosition = \"inside\";\n } else {\n textPosition = \"outside\";\n textSelection.remove();\n textSelection = null;\n }\n } else {\n textPosition = \"inside\";\n }\n }\n if (!textSelection) {\n font = Lib.ensureUniformFontSize(gd, textPosition === \"outside\" ? outsideTextFont : insideTextFont);\n textSelection = appendTextNode(bar, text, font);\n var currentTransform = textSelection.attr(\"transform\");\n textSelection.attr(\"transform\", \"\");\n textBB = Drawing.bBox(textSelection.node()), textWidth = textBB.width, textHeight = textBB.height;\n textSelection.attr(\"transform\", currentTransform);\n if (textWidth <= 0 || textHeight <= 0) {\n textSelection.remove();\n return;\n }\n }\n var angle = trace.textangle;\n var transform, constrained;\n if (textPosition === \"outside\") {\n constrained = trace.constraintext === \"both\" || trace.constraintext === \"outside\";\n transform = toMoveOutsideBar(x0, x1, y0, y1, textBB, {\n isHorizontal,\n constrained,\n angle\n });\n } else {\n constrained = trace.constraintext === \"both\" || trace.constraintext === \"inside\";\n transform = toMoveInsideBar(x0, x1, y0, y1, textBB, {\n isHorizontal,\n constrained,\n angle,\n anchor: insidetextanchor,\n hasB,\n r,\n overhead\n });\n }\n transform.fontSize = font.size;\n recordMinTextSize(trace.type === \"histogram\" ? \"bar\" : trace.type, transform, fullLayout);\n calcBar.transform = transform;\n var s = transition(textSelection, fullLayout, opts, makeOnCompleteCallback);\n Lib.setTransormAndDisplay(s, transform);\n }\n function textfitsInsideBar(barWidth, barHeight, textWidth, textHeight, isHorizontal) {\n if (barWidth < 0 || barHeight < 0) return false;\n var fitsInside = textWidth <= barWidth && textHeight <= barHeight;\n var fitsInsideIfRotated = textWidth <= barHeight && textHeight <= barWidth;\n var fitsInsideIfShrunk = isHorizontal ? barWidth >= textWidth * (barHeight / textHeight) : barHeight >= textHeight * (barWidth / textWidth);\n return fitsInside || fitsInsideIfRotated || fitsInsideIfShrunk;\n }\n function getRotateFromAngle(angle) {\n return angle === \"auto\" ? 0 : angle;\n }\n function getRotatedTextSize(textBB, rotate) {\n var a = Math.PI / 180 * rotate;\n var absSin = Math.abs(Math.sin(a));\n var absCos = Math.abs(Math.cos(a));\n return {\n x: textBB.width * absCos + textBB.height * absSin,\n y: textBB.width * absSin + textBB.height * absCos\n };\n }\n function toMoveInsideBar(x0, x1, y0, y1, textBB, opts) {\n var isHorizontal = !!opts.isHorizontal;\n var constrained = !!opts.constrained;\n var angle = opts.angle || 0;\n var anchor = opts.anchor;\n var isEnd = anchor === \"end\";\n var isStart = anchor === \"start\";\n var leftToRight = opts.leftToRight || 0;\n var toRight = (leftToRight + 1) / 2;\n var toLeft = 1 - toRight;\n var hasB = opts.hasB;\n var r = opts.r;\n var overhead = opts.overhead;\n var textWidth = textBB.width;\n var textHeight = textBB.height;\n var lx = Math.abs(x1 - x0);\n var ly = Math.abs(y1 - y0);\n var textpad = lx > 2 * TEXTPAD && ly > 2 * TEXTPAD ? TEXTPAD : 0;\n lx -= 2 * textpad;\n ly -= 2 * textpad;\n var rotate = getRotateFromAngle(angle);\n if (angle === \"auto\" && !(textWidth <= lx && textHeight <= ly) && (textWidth > lx || textHeight > ly) && (!(textWidth > ly || textHeight > lx) || textWidth < textHeight !== lx < ly)) {\n rotate += 90;\n }\n var t = getRotatedTextSize(textBB, rotate);\n var scale, padForRounding;\n if (r && r - overhead > TEXTPAD) {\n var scaleAndPad = scaleTextForRoundedBar(x0, x1, y0, y1, t, r, overhead, isHorizontal, hasB);\n scale = scaleAndPad.scale;\n padForRounding = scaleAndPad.pad;\n } else {\n scale = 1;\n if (constrained) {\n scale = Math.min(\n 1,\n lx / t.x,\n ly / t.y\n );\n }\n padForRounding = 0;\n }\n var textX = textBB.left * toLeft + textBB.right * toRight;\n var textY = (textBB.top + textBB.bottom) / 2;\n var targetX = (x0 + TEXTPAD) * toLeft + (x1 - TEXTPAD) * toRight;\n var targetY = (y0 + y1) / 2;\n var anchorX = 0;\n var anchorY = 0;\n if (isStart || isEnd) {\n var extrapad = (isHorizontal ? t.x : t.y) / 2;\n if (r && (isEnd || hasB)) {\n textpad += padForRounding;\n }\n var dir = isHorizontal ? dirSign(x0, x1) : dirSign(y0, y1);\n if (isHorizontal) {\n if (isStart) {\n targetX = x0 + dir * textpad;\n anchorX = -dir * extrapad;\n } else {\n targetX = x1 - dir * textpad;\n anchorX = dir * extrapad;\n }\n } else {\n if (isStart) {\n targetY = y0 + dir * textpad;\n anchorY = -dir * extrapad;\n } else {\n targetY = y1 - dir * textpad;\n anchorY = dir * extrapad;\n }\n }\n }\n return {\n textX,\n textY,\n targetX,\n targetY,\n anchorX,\n anchorY,\n scale,\n rotate\n };\n }\n function scaleTextForRoundedBar(x0, x1, y0, y1, t, r, overhead, isHorizontal, hasB) {\n var barWidth = Math.max(0, Math.abs(x1 - x0) - 2 * TEXTPAD);\n var barHeight = Math.max(0, Math.abs(y1 - y0) - 2 * TEXTPAD);\n var R = r - TEXTPAD;\n var clippedR = overhead ? R - Math.sqrt(R * R - (R - overhead) * (R - overhead)) : R;\n var rX = hasB ? R * 2 : isHorizontal ? R - overhead : 2 * clippedR;\n var rY = hasB ? R * 2 : isHorizontal ? 2 * clippedR : R - overhead;\n var a, b, c;\n var scale, pad;\n if (t.y / t.x >= barHeight / (barWidth - rX)) {\n scale = barHeight / t.y;\n } else if (t.y / t.x <= (barHeight - rY) / barWidth) {\n scale = barWidth / t.x;\n } else if (!hasB && isHorizontal) {\n a = t.x * t.x + t.y * t.y / 4;\n b = -2 * t.x * (barWidth - R) - t.y * (barHeight / 2 - R);\n c = (barWidth - R) * (barWidth - R) + (barHeight / 2 - R) * (barHeight / 2 - R) - R * R;\n scale = (-b + Math.sqrt(b * b - 4 * a * c)) / (2 * a);\n } else if (!hasB) {\n a = t.x * t.x / 4 + t.y * t.y;\n b = -t.x * (barWidth / 2 - R) - 2 * t.y * (barHeight - R);\n c = (barWidth / 2 - R) * (barWidth / 2 - R) + (barHeight - R) * (barHeight - R) - R * R;\n scale = (-b + Math.sqrt(b * b - 4 * a * c)) / (2 * a);\n } else {\n a = (t.x * t.x + t.y * t.y) / 4;\n b = -t.x * (barWidth / 2 - R) - t.y * (barHeight / 2 - R);\n c = (barWidth / 2 - R) * (barWidth / 2 - R) + (barHeight / 2 - R) * (barHeight / 2 - R) - R * R;\n scale = (-b + Math.sqrt(b * b - 4 * a * c)) / (2 * a);\n }\n scale = Math.min(1, scale);\n if (isHorizontal) {\n pad = Math.max(0, R - Math.sqrt(Math.max(0, R * R - (R - (barHeight - t.y * scale) / 2) * (R - (barHeight - t.y * scale) / 2))) - overhead);\n } else {\n pad = Math.max(0, R - Math.sqrt(Math.max(0, R * R - (R - (barWidth - t.x * scale) / 2) * (R - (barWidth - t.x * scale) / 2))) - overhead);\n }\n return { scale, pad };\n }\n function toMoveOutsideBar(x0, x1, y0, y1, textBB, opts) {\n var isHorizontal = !!opts.isHorizontal;\n var constrained = !!opts.constrained;\n var angle = opts.angle || 0;\n var textWidth = textBB.width;\n var textHeight = textBB.height;\n var lx = Math.abs(x1 - x0);\n var ly = Math.abs(y1 - y0);\n var textpad;\n if (isHorizontal) {\n textpad = ly > 2 * TEXTPAD ? TEXTPAD : 0;\n } else {\n textpad = lx > 2 * TEXTPAD ? TEXTPAD : 0;\n }\n var scale = 1;\n if (constrained) {\n scale = isHorizontal ? Math.min(1, ly / textHeight) : Math.min(1, lx / textWidth);\n }\n var rotate = getRotateFromAngle(angle);\n var t = getRotatedTextSize(textBB, rotate);\n var extrapad = (isHorizontal ? t.x : t.y) / 2;\n var textX = (textBB.left + textBB.right) / 2;\n var textY = (textBB.top + textBB.bottom) / 2;\n var targetX = (x0 + x1) / 2;\n var targetY = (y0 + y1) / 2;\n var anchorX = 0;\n var anchorY = 0;\n var dir = isHorizontal ? dirSign(x1, x0) : dirSign(y0, y1);\n if (isHorizontal) {\n targetX = x1 - dir * textpad;\n anchorX = dir * extrapad;\n } else {\n targetY = y1 + dir * textpad;\n anchorY = -dir * extrapad;\n }\n return {\n textX,\n textY,\n targetX,\n targetY,\n anchorX,\n anchorY,\n scale,\n rotate\n };\n }\n function getText(fullLayout, cd, index, xa, ya) {\n var trace = cd[0].trace;\n var texttemplate = trace.texttemplate;\n var value;\n if (texttemplate) {\n value = calcTexttemplate(fullLayout, cd, index, xa, ya);\n } else if (trace.textinfo) {\n value = calcTextinfo(cd, index, xa, ya);\n } else {\n value = helpers.getValue(trace.text, index);\n }\n return helpers.coerceString(attributeText, value);\n }\n function getTextPosition(trace, index) {\n var value = helpers.getValue(trace.textposition, index);\n return helpers.coerceEnumerated(attributeTextPosition, value);\n }\n function calcTexttemplate(fullLayout, cd, index, xa, ya) {\n var trace = cd[0].trace;\n var texttemplate = Lib.castOption(trace, index, \"texttemplate\");\n if (!texttemplate) return \"\";\n var isHistogram = trace.type === \"histogram\";\n var isWaterfall = trace.type === \"waterfall\";\n var isFunnel = trace.type === \"funnel\";\n var isHorizontal = trace.orientation === \"h\";\n var pLetter, pAxis;\n var vLetter, vAxis;\n if (isHorizontal) {\n pLetter = \"y\";\n pAxis = ya;\n vLetter = \"x\";\n vAxis = xa;\n } else {\n pLetter = \"x\";\n pAxis = xa;\n vLetter = \"y\";\n vAxis = ya;\n }\n function formatLabel(u) {\n return tickText(pAxis, pAxis.c2l(u), true).text;\n }\n function formatNumber(v) {\n return tickText(vAxis, vAxis.c2l(v), true).text;\n }\n var cdi = cd[index];\n var obj = {};\n obj.label = cdi.p;\n obj.labelLabel = obj[pLetter + \"Label\"] = formatLabel(cdi.p);\n var tx = Lib.castOption(trace, cdi.i, \"text\");\n if (tx === 0 || tx) obj.text = tx;\n obj.value = cdi.s;\n obj.valueLabel = obj[vLetter + \"Label\"] = formatNumber(cdi.s);\n var pt = {};\n appendArrayPointValue(pt, trace, cdi.i);\n if (isHistogram || pt.x === void 0) pt.x = isHorizontal ? obj.value : obj.label;\n if (isHistogram || pt.y === void 0) pt.y = isHorizontal ? obj.label : obj.value;\n if (isHistogram || pt.xLabel === void 0) pt.xLabel = isHorizontal ? obj.valueLabel : obj.labelLabel;\n if (isHistogram || pt.yLabel === void 0) pt.yLabel = isHorizontal ? obj.labelLabel : obj.valueLabel;\n if (isWaterfall) {\n obj.delta = +cdi.rawS || cdi.s;\n obj.deltaLabel = formatNumber(obj.delta);\n obj.final = cdi.v;\n obj.finalLabel = formatNumber(obj.final);\n obj.initial = obj.final - obj.delta;\n obj.initialLabel = formatNumber(obj.initial);\n }\n if (isFunnel) {\n obj.value = cdi.s;\n obj.valueLabel = formatNumber(obj.value);\n obj.percentInitial = cdi.begR;\n obj.percentInitialLabel = Lib.formatPercent(cdi.begR);\n obj.percentPrevious = cdi.difR;\n obj.percentPreviousLabel = Lib.formatPercent(cdi.difR);\n obj.percentTotal = cdi.sumR;\n obj.percenTotalLabel = Lib.formatPercent(cdi.sumR);\n }\n var customdata = Lib.castOption(trace, cdi.i, \"customdata\");\n if (customdata) obj.customdata = customdata;\n return Lib.texttemplateString(texttemplate, obj, fullLayout._d3locale, pt, obj, trace._meta || {});\n }\n function calcTextinfo(cd, index, xa, ya) {\n var trace = cd[0].trace;\n var isHorizontal = trace.orientation === \"h\";\n var isWaterfall = trace.type === \"waterfall\";\n var isFunnel = trace.type === \"funnel\";\n function formatLabel(u) {\n var pAxis = isHorizontal ? ya : xa;\n return tickText(pAxis, u, true).text;\n }\n function formatNumber(v) {\n var sAxis = isHorizontal ? xa : ya;\n return tickText(sAxis, +v, true).text;\n }\n var textinfo = trace.textinfo;\n var cdi = cd[index];\n var parts = textinfo.split(\"+\");\n var text = [];\n var tx;\n var hasFlag = function(flag) {\n return parts.indexOf(flag) !== -1;\n };\n if (hasFlag(\"label\")) {\n text.push(formatLabel(cd[index].p));\n }\n if (hasFlag(\"text\")) {\n tx = Lib.castOption(trace, cdi.i, \"text\");\n if (tx === 0 || tx) text.push(tx);\n }\n if (isWaterfall) {\n var delta = +cdi.rawS || cdi.s;\n var final = cdi.v;\n var initial = final - delta;\n if (hasFlag(\"initial\")) text.push(formatNumber(initial));\n if (hasFlag(\"delta\")) text.push(formatNumber(delta));\n if (hasFlag(\"final\")) text.push(formatNumber(final));\n }\n if (isFunnel) {\n if (hasFlag(\"value\")) text.push(formatNumber(cdi.s));\n var nPercent = 0;\n if (hasFlag(\"percent initial\")) nPercent++;\n if (hasFlag(\"percent previous\")) nPercent++;\n if (hasFlag(\"percent total\")) nPercent++;\n var hasMultiplePercents = nPercent > 1;\n if (hasFlag(\"percent initial\")) {\n tx = Lib.formatPercent(cdi.begR);\n if (hasMultiplePercents) tx += \" of initial\";\n text.push(tx);\n }\n if (hasFlag(\"percent previous\")) {\n tx = Lib.formatPercent(cdi.difR);\n if (hasMultiplePercents) tx += \" of previous\";\n text.push(tx);\n }\n if (hasFlag(\"percent total\")) {\n tx = Lib.formatPercent(cdi.sumR);\n if (hasMultiplePercents) tx += \" of total\";\n text.push(tx);\n }\n }\n return text.join(\"
    \");\n }\n module.exports = {\n plot,\n toMoveInsideBar\n };\n }\n });\n\n // src/traces/bar/hover.js\n var require_hover3 = __commonJS({\n \"src/traces/bar/hover.js\"(exports, module) {\n \"use strict\";\n var Fx = require_fx();\n var Registry = require_registry();\n var Color2 = require_color();\n var fillText = require_lib().fillText;\n var getLineWidth = require_helpers12().getLineWidth;\n var hoverLabelText = require_axes().hoverLabelText;\n var BADNUM = require_numerical().BADNUM;\n function hoverPoints(pointData, xval, yval, hovermode, opts) {\n var barPointData = hoverOnBars(pointData, xval, yval, hovermode, opts);\n if (barPointData) {\n var cd = barPointData.cd;\n var trace = cd[0].trace;\n var di = cd[barPointData.index];\n barPointData.color = getTraceColor(trace, di);\n Registry.getComponentMethod(\"errorbars\", \"hoverInfo\")(di, trace, barPointData);\n return [barPointData];\n }\n }\n function hoverOnBars(pointData, xval, yval, hovermode, opts) {\n var cd = pointData.cd;\n var trace = cd[0].trace;\n var t = cd[0].t;\n var isClosest = hovermode === \"closest\";\n var isWaterfall = trace.type === \"waterfall\";\n var maxHoverDistance = pointData.maxHoverDistance;\n var maxSpikeDistance = pointData.maxSpikeDistance;\n var posVal, sizeVal, posLetter, sizeLetter, dx, dy, pRangeCalc;\n if (trace.orientation === \"h\") {\n posVal = yval;\n sizeVal = xval;\n posLetter = \"y\";\n sizeLetter = \"x\";\n dx = sizeFn;\n dy = positionFn;\n } else {\n posVal = xval;\n sizeVal = yval;\n posLetter = \"x\";\n sizeLetter = \"y\";\n dy = sizeFn;\n dx = positionFn;\n }\n var period = trace[posLetter + \"period\"];\n var isClosestOrPeriod = isClosest || period;\n function thisBarMinPos(di2) {\n return thisBarExtPos(di2, -1);\n }\n function thisBarMaxPos(di2) {\n return thisBarExtPos(di2, 1);\n }\n function thisBarExtPos(di2, sgn) {\n var w = di2.w;\n return di2[posLetter] + sgn * w / 2;\n }\n function periodLength(di2) {\n return di2[posLetter + \"End\"] - di2[posLetter + \"Start\"];\n }\n var minPos = isClosest ? thisBarMinPos : period ? function(di2) {\n return di2.p - periodLength(di2) / 2;\n } : function(di2) {\n return Math.min(thisBarMinPos(di2), di2.p - t.bardelta / 2);\n };\n var maxPos = isClosest ? thisBarMaxPos : period ? function(di2) {\n return di2.p + periodLength(di2) / 2;\n } : function(di2) {\n return Math.max(thisBarMaxPos(di2), di2.p + t.bardelta / 2);\n };\n function inbox(_minPos, _maxPos, maxDistance) {\n if (opts.finiteRange) maxDistance = 0;\n return Fx.inbox(\n _minPos - posVal,\n _maxPos - posVal,\n maxDistance + Math.min(1, Math.abs(_maxPos - _minPos) / pRangeCalc) - 1\n );\n }\n function positionFn(di2) {\n return inbox(minPos(di2), maxPos(di2), maxHoverDistance);\n }\n function thisBarPositionFn(di2) {\n return inbox(thisBarMinPos(di2), thisBarMaxPos(di2), maxSpikeDistance);\n }\n function getSize(di2) {\n var s = di2[sizeLetter];\n if (isWaterfall) {\n var rawS = Math.abs(di2.rawS) || 0;\n if (sizeVal > 0) {\n s += rawS;\n } else if (sizeVal < 0) {\n s -= rawS;\n }\n }\n return s;\n }\n function sizeFn(di2) {\n var v = sizeVal;\n var b = di2.b;\n var s = getSize(di2);\n return Fx.inbox(b - v, s - v, maxHoverDistance + (s - v) / (s - b) - 1);\n }\n function thisBarSizeFn(di2) {\n var v = sizeVal;\n var b = di2.b;\n var s = getSize(di2);\n return Fx.inbox(b - v, s - v, maxSpikeDistance + (s - v) / (s - b) - 1);\n }\n var pa = pointData[posLetter + \"a\"];\n var sa = pointData[sizeLetter + \"a\"];\n pRangeCalc = Math.abs(pa.r2c(pa.range[1]) - pa.r2c(pa.range[0]));\n function dxy(di2) {\n return (dx(di2) + dy(di2)) / 2;\n }\n var distfn = Fx.getDistanceFunction(hovermode, dx, dy, dxy);\n Fx.getClosest(cd, distfn, pointData);\n if (pointData.index === false) return;\n if (cd[pointData.index].p === BADNUM) return;\n if (!isClosestOrPeriod) {\n minPos = function(di2) {\n return Math.min(thisBarMinPos(di2), di2.p - t.bargroupwidth / 2);\n };\n maxPos = function(di2) {\n return Math.max(thisBarMaxPos(di2), di2.p + t.bargroupwidth / 2);\n };\n }\n var index = pointData.index;\n var di = cd[index];\n var size = trace.base ? di.b + di.s : di.s;\n pointData[sizeLetter + \"0\"] = pointData[sizeLetter + \"1\"] = sa.c2p(di[sizeLetter], true);\n pointData[sizeLetter + \"LabelVal\"] = size;\n var extent = t.extents[t.extents.round(di.p)];\n pointData[posLetter + \"0\"] = pa.c2p(isClosest ? minPos(di) : extent[0], true);\n pointData[posLetter + \"1\"] = pa.c2p(isClosest ? maxPos(di) : extent[1], true);\n var hasPeriod = di.orig_p !== void 0;\n pointData[posLetter + \"LabelVal\"] = hasPeriod ? di.orig_p : di.p;\n pointData.labelLabel = hoverLabelText(pa, pointData[posLetter + \"LabelVal\"], trace[posLetter + \"hoverformat\"]);\n pointData.valueLabel = hoverLabelText(sa, pointData[sizeLetter + \"LabelVal\"], trace[sizeLetter + \"hoverformat\"]);\n pointData.baseLabel = hoverLabelText(sa, di.b, trace[sizeLetter + \"hoverformat\"]);\n pointData.spikeDistance = (thisBarSizeFn(di) + thisBarPositionFn(di)) / 2;\n pointData[posLetter + \"Spike\"] = pa.c2p(di.p, true);\n fillText(di, trace, pointData);\n pointData.hovertemplate = trace.hovertemplate;\n return pointData;\n }\n function getTraceColor(trace, di) {\n var mc = di.mcc || trace.marker.color;\n var mlc = di.mlcc || trace.marker.line.color;\n var mlw = getLineWidth(trace, di);\n if (Color2.opacity(mc)) return mc;\n else if (Color2.opacity(mlc) && mlw) return mlc;\n }\n module.exports = {\n hoverPoints,\n hoverOnBars,\n getTraceColor\n };\n }\n });\n\n // src/traces/bar/event_data.js\n var require_event_data = __commonJS({\n \"src/traces/bar/event_data.js\"(exports, module) {\n \"use strict\";\n module.exports = function eventData(out, pt, trace) {\n out.x = \"xVal\" in pt ? pt.xVal : pt.x;\n out.y = \"yVal\" in pt ? pt.yVal : pt.y;\n if (pt.xa) out.xaxis = pt.xa;\n if (pt.ya) out.yaxis = pt.ya;\n if (trace.orientation === \"h\") {\n out.label = out.y;\n out.value = out.x;\n } else {\n out.label = out.x;\n out.value = out.y;\n }\n return out;\n };\n }\n });\n\n // src/traces/bar/select.js\n var require_select3 = __commonJS({\n \"src/traces/bar/select.js\"(exports, module) {\n \"use strict\";\n module.exports = function selectPoints(searchInfo, selectionTester) {\n var cd = searchInfo.cd;\n var xa = searchInfo.xaxis;\n var ya = searchInfo.yaxis;\n var trace = cd[0].trace;\n var isFunnel = trace.type === \"funnel\";\n var isHorizontal = trace.orientation === \"h\";\n var selection = [];\n var i;\n if (selectionTester === false) {\n for (i = 0; i < cd.length; i++) {\n cd[i].selected = 0;\n }\n } else {\n for (i = 0; i < cd.length; i++) {\n var di = cd[i];\n var ct = \"ct\" in di ? di.ct : getCentroid(di, xa, ya, isHorizontal, isFunnel);\n if (selectionTester.contains(ct, false, i, searchInfo)) {\n selection.push({\n pointNumber: i,\n x: xa.c2d(di.x),\n y: ya.c2d(di.y)\n });\n di.selected = 1;\n } else {\n di.selected = 0;\n }\n }\n }\n return selection;\n };\n function getCentroid(d, xa, ya, isHorizontal, isFunnel) {\n var x0 = xa.c2p(isHorizontal ? d.s0 : d.p0, true);\n var x1 = xa.c2p(isHorizontal ? d.s1 : d.p1, true);\n var y0 = ya.c2p(isHorizontal ? d.p0 : d.s0, true);\n var y1 = ya.c2p(isHorizontal ? d.p1 : d.s1, true);\n if (isFunnel) {\n return [(x0 + x1) / 2, (y0 + y1) / 2];\n } else {\n if (isHorizontal) {\n return [x1, (y0 + y1) / 2];\n } else {\n return [(x0 + x1) / 2, y1];\n }\n }\n }\n }\n });\n\n // src/traces/bar/index.js\n var require_bar = __commonJS({\n \"src/traces/bar/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes23(),\n layoutAttributes: require_layout_attributes6(),\n supplyDefaults: require_defaults19().supplyDefaults,\n crossTraceDefaults: require_defaults19().crossTraceDefaults,\n supplyLayoutDefaults: require_layout_defaults5(),\n calc: require_calc5(),\n crossTraceCalc: require_cross_trace_calc().crossTraceCalc,\n colorbar: require_marker_colorbar(),\n arraysToCalcdata: require_arrays_to_calcdata2(),\n plot: require_plot3().plot,\n style: require_style4().style,\n styleOnSelect: require_style4().styleOnSelect,\n hoverPoints: require_hover3().hoverPoints,\n eventData: require_event_data(),\n selectPoints: require_select3(),\n moduleType: \"trace\",\n name: \"bar\",\n basePlotModule: require_cartesian(),\n categories: [\"bar-like\", \"cartesian\", \"svg\", \"bar\", \"oriented\", \"errorBarsOK\", \"showLegend\", \"zoomScale\"],\n animatable: true,\n meta: {}\n };\n }\n });\n\n // lib/bar.js\n var require_bar2 = __commonJS({\n \"lib/bar.js\"(exports, module) {\n \"use strict\";\n module.exports = require_bar();\n }\n });\n\n // src/traces/box/attributes.js\n var require_attributes24 = __commonJS({\n \"src/traces/box/attributes.js\"(exports, module) {\n \"use strict\";\n var makeFillcolorAttr = require_fillcolor_attribute();\n var scatterAttrs = require_attributes12();\n var barAttrs = require_attributes23();\n var colorAttrs = require_attributes3();\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var extendFlat = require_extend().extendFlat;\n var scatterMarkerAttrs = scatterAttrs.marker;\n var scatterMarkerLineAttrs = scatterMarkerAttrs.line;\n module.exports = {\n y: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n x: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n x0: {\n valType: \"any\",\n editType: \"calc+clearAxisTypes\"\n },\n y0: {\n valType: \"any\",\n editType: \"calc+clearAxisTypes\"\n },\n dx: {\n valType: \"number\",\n editType: \"calc\"\n },\n dy: {\n valType: \"number\",\n editType: \"calc\"\n },\n xperiod: scatterAttrs.xperiod,\n yperiod: scatterAttrs.yperiod,\n xperiod0: scatterAttrs.xperiod0,\n yperiod0: scatterAttrs.yperiod0,\n xperiodalignment: scatterAttrs.xperiodalignment,\n yperiodalignment: scatterAttrs.yperiodalignment,\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n name: {\n valType: \"string\",\n editType: \"calc+clearAxisTypes\"\n },\n q1: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n median: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n q3: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n lowerfence: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n upperfence: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n notched: {\n valType: \"boolean\",\n editType: \"calc\"\n },\n notchwidth: {\n valType: \"number\",\n min: 0,\n max: 0.5,\n dflt: 0.25,\n editType: \"calc\"\n },\n notchspan: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n // TODO\n // maybe add\n // - loweroutlierbound / upperoutlierbound\n // - lowersuspectedoutlierbound / uppersuspectedoutlierbound\n boxpoints: {\n valType: \"enumerated\",\n values: [\"all\", \"outliers\", \"suspectedoutliers\", false],\n editType: \"calc\"\n },\n jitter: {\n valType: \"number\",\n min: 0,\n max: 1,\n editType: \"calc\"\n },\n pointpos: {\n valType: \"number\",\n min: -2,\n max: 2,\n editType: \"calc\"\n },\n sdmultiple: {\n valType: \"number\",\n min: 0,\n editType: \"calc\",\n dflt: 1\n },\n sizemode: {\n valType: \"enumerated\",\n values: [\"quartiles\", \"sd\"],\n editType: \"calc\",\n dflt: \"quartiles\"\n },\n boxmean: {\n valType: \"enumerated\",\n values: [true, \"sd\", false],\n editType: \"calc\"\n },\n mean: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n sd: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n orientation: {\n valType: \"enumerated\",\n values: [\"v\", \"h\"],\n editType: \"calc+clearAxisTypes\"\n },\n quartilemethod: {\n valType: \"enumerated\",\n values: [\"linear\", \"exclusive\", \"inclusive\"],\n dflt: \"linear\",\n editType: \"calc\"\n },\n width: {\n valType: \"number\",\n min: 0,\n dflt: 0,\n editType: \"calc\"\n },\n marker: {\n outliercolor: {\n valType: \"color\",\n dflt: \"rgba(0, 0, 0, 0)\",\n editType: \"style\"\n },\n symbol: extendFlat(\n {},\n scatterMarkerAttrs.symbol,\n { arrayOk: false, editType: \"plot\" }\n ),\n opacity: extendFlat(\n {},\n scatterMarkerAttrs.opacity,\n { arrayOk: false, dflt: 1, editType: \"style\" }\n ),\n angle: extendFlat(\n {},\n scatterMarkerAttrs.angle,\n { arrayOk: false, editType: \"calc\" }\n ),\n size: extendFlat(\n {},\n scatterMarkerAttrs.size,\n { arrayOk: false, editType: \"calc\" }\n ),\n color: extendFlat(\n {},\n scatterMarkerAttrs.color,\n { arrayOk: false, editType: \"style\" }\n ),\n line: {\n color: extendFlat(\n {},\n scatterMarkerLineAttrs.color,\n { arrayOk: false, dflt: colorAttrs.defaultLine, editType: \"style\" }\n ),\n width: extendFlat(\n {},\n scatterMarkerLineAttrs.width,\n { arrayOk: false, dflt: 0, editType: \"style\" }\n ),\n outliercolor: {\n valType: \"color\",\n editType: \"style\"\n },\n outlierwidth: {\n valType: \"number\",\n min: 0,\n dflt: 1,\n editType: \"style\"\n },\n editType: \"style\"\n },\n editType: \"plot\"\n },\n line: {\n color: {\n valType: \"color\",\n editType: \"style\"\n },\n width: {\n valType: \"number\",\n min: 0,\n dflt: 2,\n editType: \"style\"\n },\n editType: \"plot\"\n },\n fillcolor: makeFillcolorAttr(),\n whiskerwidth: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0.5,\n editType: \"calc\"\n },\n showwhiskers: {\n valType: \"boolean\",\n editType: \"calc\"\n },\n offsetgroup: barAttrs.offsetgroup,\n alignmentgroup: barAttrs.alignmentgroup,\n selected: {\n marker: scatterAttrs.selected.marker,\n editType: \"style\"\n },\n unselected: {\n marker: scatterAttrs.unselected.marker,\n editType: \"style\"\n },\n text: extendFlat({}, scatterAttrs.text, {}),\n hovertext: extendFlat({}, scatterAttrs.hovertext, {}),\n hovertemplate: hovertemplateAttrs({}),\n hoveron: {\n valType: \"flaglist\",\n flags: [\"boxes\", \"points\"],\n dflt: \"boxes+points\",\n editType: \"style\"\n },\n zorder: scatterAttrs.zorder\n };\n }\n });\n\n // src/traces/box/layout_attributes.js\n var require_layout_attributes7 = __commonJS({\n \"src/traces/box/layout_attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n boxmode: {\n valType: \"enumerated\",\n values: [\"group\", \"overlay\"],\n dflt: \"overlay\",\n editType: \"calc\"\n },\n boxgap: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0.3,\n editType: \"calc\"\n },\n boxgroupgap: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0.3,\n editType: \"calc\"\n }\n };\n }\n });\n\n // src/traces/box/defaults.js\n var require_defaults20 = __commonJS({\n \"src/traces/box/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Registry = require_registry();\n var Color2 = require_color();\n var handlePeriodDefaults = require_period_defaults();\n var handleGroupingDefaults = require_grouping_defaults();\n var autoType = require_axis_autotype();\n var attributes = require_attributes24();\n function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n handleSampleDefaults(traceIn, traceOut, coerce, layout);\n if (traceOut.visible === false) return;\n handlePeriodDefaults(traceIn, traceOut, layout, coerce);\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n var hasPreCompStats = traceOut._hasPreCompStats;\n if (hasPreCompStats) {\n coerce(\"lowerfence\");\n coerce(\"upperfence\");\n }\n coerce(\"line.color\", (traceIn.marker || {}).color || defaultColor);\n coerce(\"line.width\");\n coerce(\"fillcolor\", Color2.addOpacity(traceOut.line.color, 0.5));\n var boxmeanDflt = false;\n if (hasPreCompStats) {\n var mean = coerce(\"mean\");\n var sd = coerce(\"sd\");\n if (mean && mean.length) {\n boxmeanDflt = true;\n if (sd && sd.length) boxmeanDflt = \"sd\";\n }\n }\n coerce(\"whiskerwidth\");\n var sizemode = coerce(\"sizemode\");\n var boxmean;\n if (sizemode === \"quartiles\") {\n boxmean = coerce(\"boxmean\", boxmeanDflt);\n }\n coerce(\"showwhiskers\", sizemode === \"quartiles\");\n if (sizemode === \"sd\" || boxmean === \"sd\") {\n coerce(\"sdmultiple\");\n }\n coerce(\"width\");\n coerce(\"quartilemethod\");\n var notchedDflt = false;\n if (hasPreCompStats) {\n var notchspan = coerce(\"notchspan\");\n if (notchspan && notchspan.length) {\n notchedDflt = true;\n }\n } else if (Lib.validate(traceIn.notchwidth, attributes.notchwidth)) {\n notchedDflt = true;\n }\n var notched = coerce(\"notched\", notchedDflt);\n if (notched) coerce(\"notchwidth\");\n handlePointsDefaults(traceIn, traceOut, coerce, { prefix: \"box\" });\n coerce(\"zorder\");\n }\n function handleSampleDefaults(traceIn, traceOut, coerce, layout) {\n function getDims(arr) {\n var dims = 0;\n if (arr && arr.length) {\n dims += 1;\n if (Lib.isArrayOrTypedArray(arr[0]) && arr[0].length) {\n dims += 1;\n }\n }\n return dims;\n }\n function valid(astr) {\n return Lib.validate(traceIn[astr], attributes[astr]);\n }\n var y = coerce(\"y\");\n var x = coerce(\"x\");\n var sLen;\n if (traceOut.type === \"box\") {\n var q1 = coerce(\"q1\");\n var median = coerce(\"median\");\n var q3 = coerce(\"q3\");\n traceOut._hasPreCompStats = q1 && q1.length && median && median.length && q3 && q3.length;\n sLen = Math.min(\n Lib.minRowLength(q1),\n Lib.minRowLength(median),\n Lib.minRowLength(q3)\n );\n }\n var yDims = getDims(y);\n var xDims = getDims(x);\n var yLen = yDims && Lib.minRowLength(y);\n var xLen = xDims && Lib.minRowLength(x);\n var calendar = layout.calendar;\n var opts = {\n autotypenumbers: layout.autotypenumbers\n };\n var defaultOrientation, len;\n if (traceOut._hasPreCompStats) {\n switch (String(xDims) + String(yDims)) {\n // no x / no y\n case \"00\":\n var setInX = valid(\"x0\") || valid(\"dx\");\n var setInY = valid(\"y0\") || valid(\"dy\");\n if (setInY && !setInX) {\n defaultOrientation = \"h\";\n } else {\n defaultOrientation = \"v\";\n }\n len = sLen;\n break;\n // just x\n case \"10\":\n defaultOrientation = \"v\";\n len = Math.min(sLen, xLen);\n break;\n case \"20\":\n defaultOrientation = \"h\";\n len = Math.min(sLen, x.length);\n break;\n // just y\n case \"01\":\n defaultOrientation = \"h\";\n len = Math.min(sLen, yLen);\n break;\n case \"02\":\n defaultOrientation = \"v\";\n len = Math.min(sLen, y.length);\n break;\n // both\n case \"12\":\n defaultOrientation = \"v\";\n len = Math.min(sLen, xLen, y.length);\n break;\n case \"21\":\n defaultOrientation = \"h\";\n len = Math.min(sLen, x.length, yLen);\n break;\n case \"11\":\n len = 0;\n break;\n case \"22\":\n var hasCategories = false;\n var i;\n for (i = 0; i < x.length; i++) {\n if (autoType(x[i], calendar, opts) === \"category\") {\n hasCategories = true;\n break;\n }\n }\n if (hasCategories) {\n defaultOrientation = \"v\";\n len = Math.min(sLen, xLen, y.length);\n } else {\n for (i = 0; i < y.length; i++) {\n if (autoType(y[i], calendar, opts) === \"category\") {\n hasCategories = true;\n break;\n }\n }\n if (hasCategories) {\n defaultOrientation = \"h\";\n len = Math.min(sLen, x.length, yLen);\n } else {\n defaultOrientation = \"v\";\n len = Math.min(sLen, xLen, y.length);\n }\n }\n break;\n }\n } else if (yDims > 0) {\n defaultOrientation = \"v\";\n if (xDims > 0) {\n len = Math.min(xLen, yLen);\n } else {\n len = Math.min(yLen);\n }\n } else if (xDims > 0) {\n defaultOrientation = \"h\";\n len = Math.min(xLen);\n } else {\n len = 0;\n }\n if (!len) {\n traceOut.visible = false;\n return;\n }\n traceOut._length = len;\n var orientation = coerce(\"orientation\", defaultOrientation);\n if (traceOut._hasPreCompStats) {\n if (orientation === \"v\" && xDims === 0) {\n coerce(\"x0\", 0);\n coerce(\"dx\", 1);\n } else if (orientation === \"h\" && yDims === 0) {\n coerce(\"y0\", 0);\n coerce(\"dy\", 1);\n }\n } else {\n if (orientation === \"v\" && xDims === 0) {\n coerce(\"x0\");\n } else if (orientation === \"h\" && yDims === 0) {\n coerce(\"y0\");\n }\n }\n var handleCalendarDefaults = Registry.getComponentMethod(\"calendars\", \"handleTraceDefaults\");\n handleCalendarDefaults(traceIn, traceOut, [\"x\", \"y\"], layout);\n }\n function handlePointsDefaults(traceIn, traceOut, coerce, opts) {\n var prefix = opts.prefix;\n var outlierColorDflt = Lib.coerce2(traceIn, traceOut, attributes, \"marker.outliercolor\");\n var lineoutliercolor = coerce(\"marker.line.outliercolor\");\n var modeDflt = \"outliers\";\n if (traceOut._hasPreCompStats) {\n modeDflt = \"all\";\n } else if (outlierColorDflt || lineoutliercolor) {\n modeDflt = \"suspectedoutliers\";\n }\n var mode = coerce(prefix + \"points\", modeDflt);\n if (mode) {\n coerce(\"jitter\", mode === \"all\" ? 0.3 : 0);\n coerce(\"pointpos\", mode === \"all\" ? -1.5 : 0);\n coerce(\"marker.symbol\");\n coerce(\"marker.opacity\");\n coerce(\"marker.size\");\n coerce(\"marker.angle\");\n coerce(\"marker.color\", traceOut.line.color);\n coerce(\"marker.line.color\");\n coerce(\"marker.line.width\");\n if (mode === \"suspectedoutliers\") {\n coerce(\"marker.line.outliercolor\", traceOut.marker.color);\n coerce(\"marker.line.outlierwidth\");\n }\n coerce(\"selected.marker.color\");\n coerce(\"unselected.marker.color\");\n coerce(\"selected.marker.size\");\n coerce(\"unselected.marker.size\");\n coerce(\"text\");\n coerce(\"hovertext\");\n } else {\n delete traceOut.marker;\n }\n var hoveron = coerce(\"hoveron\");\n if (hoveron === \"all\" || hoveron.indexOf(\"points\") !== -1) {\n coerce(\"hovertemplate\");\n }\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n }\n function crossTraceDefaults(fullData, fullLayout) {\n var traceIn, traceOut;\n function coerce(attr) {\n return Lib.coerce(traceOut._input, traceOut, attributes, attr);\n }\n for (var i = 0; i < fullData.length; i++) {\n traceOut = fullData[i];\n var traceType = traceOut.type;\n if (traceType === \"box\" || traceType === \"violin\") {\n traceIn = traceOut._input;\n var mode = fullLayout[traceType + \"mode\"];\n if (mode === \"group\") {\n handleGroupingDefaults(traceIn, traceOut, fullLayout, coerce, mode);\n }\n }\n }\n }\n module.exports = {\n supplyDefaults,\n crossTraceDefaults,\n handleSampleDefaults,\n handlePointsDefaults\n };\n }\n });\n\n // src/traces/box/layout_defaults.js\n var require_layout_defaults6 = __commonJS({\n \"src/traces/box/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var Lib = require_lib();\n var layoutAttributes = require_layout_attributes7();\n function _supply(layoutIn, layoutOut, fullData, coerce, traceType) {\n var category = traceType + \"Layout\";\n var hasTraceType = false;\n for (var i = 0; i < fullData.length; i++) {\n var trace = fullData[i];\n if (Registry.traceIs(trace, category)) {\n hasTraceType = true;\n break;\n }\n }\n if (!hasTraceType) return;\n coerce(traceType + \"mode\");\n coerce(traceType + \"gap\");\n coerce(traceType + \"groupgap\");\n }\n function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);\n }\n _supply(layoutIn, layoutOut, fullData, coerce, \"box\");\n }\n module.exports = {\n supplyLayoutDefaults,\n _supply\n };\n }\n });\n\n // src/traces/box/calc.js\n var require_calc6 = __commonJS({\n \"src/traces/box/calc.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Axes = require_axes();\n var alignPeriod = require_align_period();\n var Lib = require_lib();\n var BADNUM = require_numerical().BADNUM;\n var _ = Lib._;\n module.exports = function calc(gd, trace) {\n var fullLayout = gd._fullLayout;\n var xa = Axes.getFromId(gd, trace.xaxis || \"x\");\n var ya = Axes.getFromId(gd, trace.yaxis || \"y\");\n var cd = [];\n var numKey = trace.type === \"violin\" ? \"_numViolins\" : \"_numBoxes\";\n var i, j;\n var valAxis, valLetter;\n var posAxis, posLetter;\n var hasPeriod;\n if (trace.orientation === \"h\") {\n valAxis = xa;\n valLetter = \"x\";\n posAxis = ya;\n posLetter = \"y\";\n hasPeriod = !!trace.yperiodalignment;\n } else {\n valAxis = ya;\n valLetter = \"y\";\n posAxis = xa;\n posLetter = \"x\";\n hasPeriod = !!trace.xperiodalignment;\n }\n var allPosArrays = getPosArrays(trace, posLetter, posAxis, fullLayout[numKey]);\n var posArray = allPosArrays[0];\n var origPos = allPosArrays[1];\n var dv = Lib.distinctVals(posArray, posAxis);\n var posDistinct = dv.vals;\n var dPos = dv.minDiff / 2;\n var cdi;\n var pts;\n var boxVals;\n var N;\n var pt;\n var v;\n var ptFilterFn = (trace.boxpoints || trace.points) === \"all\" ? Lib.identity : function(pt2) {\n return pt2.v < cdi.lf || pt2.v > cdi.uf;\n };\n if (trace._hasPreCompStats) {\n var valArrayRaw = trace[valLetter];\n var d2c = function(k) {\n return valAxis.d2c((trace[k] || [])[i]);\n };\n var minVal = Infinity;\n var maxVal = -Infinity;\n for (i = 0; i < trace._length; i++) {\n var posi = posArray[i];\n if (!isNumeric(posi)) continue;\n cdi = {};\n cdi.pos = cdi[posLetter] = posi;\n if (hasPeriod && origPos) {\n cdi.orig_p = origPos[i];\n }\n cdi.q1 = d2c(\"q1\");\n cdi.med = d2c(\"median\");\n cdi.q3 = d2c(\"q3\");\n pts = [];\n if (valArrayRaw && Lib.isArrayOrTypedArray(valArrayRaw[i])) {\n for (j = 0; j < valArrayRaw[i].length; j++) {\n v = valAxis.d2c(valArrayRaw[i][j]);\n if (v !== BADNUM) {\n pt = { v, i: [i, j] };\n arraysToCalcdata(pt, trace, [i, j]);\n pts.push(pt);\n }\n }\n }\n cdi.pts = pts.sort(sortByVal);\n boxVals = cdi[valLetter] = pts.map(extractVal);\n N = boxVals.length;\n if (cdi.med !== BADNUM && cdi.q1 !== BADNUM && cdi.q3 !== BADNUM && cdi.med >= cdi.q1 && cdi.q3 >= cdi.med) {\n var lf = d2c(\"lowerfence\");\n cdi.lf = lf !== BADNUM && lf <= cdi.q1 ? lf : computeLowerFence(cdi, boxVals, N);\n var uf = d2c(\"upperfence\");\n cdi.uf = uf !== BADNUM && uf >= cdi.q3 ? uf : computeUpperFence(cdi, boxVals, N);\n var mean = d2c(\"mean\");\n cdi.mean = mean !== BADNUM ? mean : N ? Lib.mean(boxVals, N) : (cdi.q1 + cdi.q3) / 2;\n var sd = d2c(\"sd\");\n cdi.sd = mean !== BADNUM && sd >= 0 ? sd : N ? Lib.stdev(boxVals, N, cdi.mean) : cdi.q3 - cdi.q1;\n cdi.lo = computeLowerOutlierBound(cdi);\n cdi.uo = computeUpperOutlierBound(cdi);\n var ns = d2c(\"notchspan\");\n ns = ns !== BADNUM && ns > 0 ? ns : computeNotchSpan(cdi, N);\n cdi.ln = cdi.med - ns;\n cdi.un = cdi.med + ns;\n var imin = cdi.lf;\n var imax = cdi.uf;\n if (trace.boxpoints && boxVals.length) {\n imin = Math.min(imin, boxVals[0]);\n imax = Math.max(imax, boxVals[N - 1]);\n }\n if (trace.notched) {\n imin = Math.min(imin, cdi.ln);\n imax = Math.max(imax, cdi.un);\n }\n cdi.min = imin;\n cdi.max = imax;\n } else {\n Lib.warn([\n \"Invalid input - make sure that q1 <= median <= q3\",\n \"q1 = \" + cdi.q1,\n \"median = \" + cdi.med,\n \"q3 = \" + cdi.q3\n ].join(\"\\n\"));\n var v0;\n if (cdi.med !== BADNUM) {\n v0 = cdi.med;\n } else if (cdi.q1 !== BADNUM) {\n if (cdi.q3 !== BADNUM) v0 = (cdi.q1 + cdi.q3) / 2;\n else v0 = cdi.q1;\n } else if (cdi.q3 !== BADNUM) {\n v0 = cdi.q3;\n } else {\n v0 = 0;\n }\n cdi.med = v0;\n cdi.q1 = cdi.q3 = v0;\n cdi.lf = cdi.uf = v0;\n cdi.mean = cdi.sd = v0;\n cdi.ln = cdi.un = v0;\n cdi.min = cdi.max = v0;\n }\n minVal = Math.min(minVal, cdi.min);\n maxVal = Math.max(maxVal, cdi.max);\n cdi.pts2 = pts.filter(ptFilterFn);\n cd.push(cdi);\n }\n trace._extremes[valAxis._id] = Axes.findExtremes(\n valAxis,\n [minVal, maxVal],\n { padded: true }\n );\n } else {\n var valArray = valAxis.makeCalcdata(trace, valLetter);\n var posBins = makeBins(posDistinct, dPos);\n var pLen = posDistinct.length;\n var ptsPerBin = initNestedArray(pLen);\n for (i = 0; i < trace._length; i++) {\n v = valArray[i];\n if (!isNumeric(v)) continue;\n var n = Lib.findBin(posArray[i], posBins);\n if (n >= 0 && n < pLen) {\n pt = { v, i };\n arraysToCalcdata(pt, trace, i);\n ptsPerBin[n].push(pt);\n }\n }\n var minLowerNotch = Infinity;\n var maxUpperNotch = -Infinity;\n var quartilemethod = trace.quartilemethod;\n var usesExclusive = quartilemethod === \"exclusive\";\n var usesInclusive = quartilemethod === \"inclusive\";\n for (i = 0; i < pLen; i++) {\n if (ptsPerBin[i].length > 0) {\n cdi = {};\n cdi.pos = cdi[posLetter] = posDistinct[i];\n pts = cdi.pts = ptsPerBin[i].sort(sortByVal);\n boxVals = cdi[valLetter] = pts.map(extractVal);\n N = boxVals.length;\n cdi.min = boxVals[0];\n cdi.max = boxVals[N - 1];\n cdi.mean = Lib.mean(boxVals, N);\n cdi.sd = Lib.stdev(boxVals, N, cdi.mean) * trace.sdmultiple;\n cdi.med = Lib.interp(boxVals, 0.5);\n if (N % 2 && (usesExclusive || usesInclusive)) {\n var lower;\n var upper;\n if (usesExclusive) {\n lower = boxVals.slice(0, N / 2);\n upper = boxVals.slice(N / 2 + 1);\n } else if (usesInclusive) {\n lower = boxVals.slice(0, N / 2 + 1);\n upper = boxVals.slice(N / 2);\n }\n cdi.q1 = Lib.interp(lower, 0.5);\n cdi.q3 = Lib.interp(upper, 0.5);\n } else {\n cdi.q1 = Lib.interp(boxVals, 0.25);\n cdi.q3 = Lib.interp(boxVals, 0.75);\n }\n cdi.lf = computeLowerFence(cdi, boxVals, N);\n cdi.uf = computeUpperFence(cdi, boxVals, N);\n cdi.lo = computeLowerOutlierBound(cdi);\n cdi.uo = computeUpperOutlierBound(cdi);\n var mci = computeNotchSpan(cdi, N);\n cdi.ln = cdi.med - mci;\n cdi.un = cdi.med + mci;\n minLowerNotch = Math.min(minLowerNotch, cdi.ln);\n maxUpperNotch = Math.max(maxUpperNotch, cdi.un);\n cdi.pts2 = pts.filter(ptFilterFn);\n cd.push(cdi);\n }\n }\n if (trace.notched && Lib.isTypedArray(valArray)) valArray = Array.from(valArray);\n trace._extremes[valAxis._id] = Axes.findExtremes(\n valAxis,\n trace.notched ? valArray.concat([minLowerNotch, maxUpperNotch]) : valArray,\n { padded: true }\n );\n }\n calcSelection(cd, trace);\n if (cd.length > 0) {\n cd[0].t = {\n num: fullLayout[numKey],\n dPos,\n posLetter,\n valLetter,\n labels: {\n med: _(gd, \"median:\"),\n min: _(gd, \"min:\"),\n q1: _(gd, \"q1:\"),\n q3: _(gd, \"q3:\"),\n max: _(gd, \"max:\"),\n mean: trace.boxmean === \"sd\" || trace.sizemode === \"sd\" ? _(gd, \"mean \\xB1 \\u03C3:\").replace(\"\\u03C3\", trace.sdmultiple === 1 ? \"\\u03C3\" : trace.sdmultiple + \"\\u03C3\") : (\n // displaying mean +- N\u03C3 whilst supporting translations\n _(gd, \"mean:\")\n ),\n lf: _(gd, \"lower fence:\"),\n uf: _(gd, \"upper fence:\")\n }\n };\n fullLayout[numKey]++;\n return cd;\n } else {\n return [{ t: { empty: true } }];\n }\n };\n function getPosArrays(trace, posLetter, posAxis, num) {\n var hasPosArray = posLetter in trace;\n var hasPos0 = posLetter + \"0\" in trace;\n var hasPosStep = \"d\" + posLetter in trace;\n if (hasPosArray || hasPos0 && hasPosStep) {\n var origPos = posAxis.makeCalcdata(trace, posLetter);\n var pos = alignPeriod(trace, posAxis, posLetter, origPos).vals;\n return [pos, origPos];\n }\n var pos0;\n if (hasPos0) {\n pos0 = trace[posLetter + \"0\"];\n } else if (\"name\" in trace && (posAxis.type === \"category\" || isNumeric(trace.name) && [\"linear\", \"log\"].indexOf(posAxis.type) !== -1 || Lib.isDateTime(trace.name) && posAxis.type === \"date\")) {\n pos0 = trace.name;\n } else {\n pos0 = num;\n }\n var pos0c = posAxis.type === \"multicategory\" ? posAxis.r2c_just_indices(pos0) : posAxis.d2c(pos0, 0, trace[posLetter + \"calendar\"]);\n var len = trace._length;\n var out = new Array(len);\n for (var i = 0; i < len; i++) out[i] = pos0c;\n return [out];\n }\n function makeBins(x, dx) {\n var len = x.length;\n var bins = new Array(len + 1);\n for (var i = 0; i < len; i++) {\n bins[i] = x[i] - dx;\n }\n bins[len] = x[len - 1] + dx;\n return bins;\n }\n function initNestedArray(len) {\n var arr = new Array(len);\n for (var i = 0; i < len; i++) {\n arr[i] = [];\n }\n return arr;\n }\n var TRACE_TO_CALC = {\n text: \"tx\",\n hovertext: \"htx\"\n };\n function arraysToCalcdata(pt, trace, ptNumber) {\n for (var k in TRACE_TO_CALC) {\n if (Lib.isArrayOrTypedArray(trace[k])) {\n if (Array.isArray(ptNumber)) {\n if (Lib.isArrayOrTypedArray(trace[k][ptNumber[0]])) {\n pt[TRACE_TO_CALC[k]] = trace[k][ptNumber[0]][ptNumber[1]];\n }\n } else {\n pt[TRACE_TO_CALC[k]] = trace[k][ptNumber];\n }\n }\n }\n }\n function calcSelection(cd, trace) {\n if (Lib.isArrayOrTypedArray(trace.selectedpoints)) {\n for (var i = 0; i < cd.length; i++) {\n var pts = cd[i].pts || [];\n var ptNumber2cdIndex = {};\n for (var j = 0; j < pts.length; j++) {\n ptNumber2cdIndex[pts[j].i] = j;\n }\n Lib.tagSelected(pts, trace, ptNumber2cdIndex);\n }\n }\n }\n function sortByVal(a, b) {\n return a.v - b.v;\n }\n function extractVal(o) {\n return o.v;\n }\n function computeLowerFence(cdi, boxVals, N) {\n if (N === 0) return cdi.q1;\n return Math.min(\n cdi.q1,\n boxVals[Math.min(\n Lib.findBin(2.5 * cdi.q1 - 1.5 * cdi.q3, boxVals, true) + 1,\n N - 1\n )]\n );\n }\n function computeUpperFence(cdi, boxVals, N) {\n if (N === 0) return cdi.q3;\n return Math.max(\n cdi.q3,\n boxVals[Math.max(\n Lib.findBin(2.5 * cdi.q3 - 1.5 * cdi.q1, boxVals),\n 0\n )]\n );\n }\n function computeLowerOutlierBound(cdi) {\n return 4 * cdi.q1 - 3 * cdi.q3;\n }\n function computeUpperOutlierBound(cdi) {\n return 4 * cdi.q3 - 3 * cdi.q1;\n }\n function computeNotchSpan(cdi, N) {\n if (N === 0) return 0;\n return 1.57 * (cdi.q3 - cdi.q1) / Math.sqrt(N);\n }\n }\n });\n\n // src/traces/box/cross_trace_calc.js\n var require_cross_trace_calc3 = __commonJS({\n \"src/traces/box/cross_trace_calc.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n var Lib = require_lib();\n var getAxisGroup = require_constraints().getAxisGroup;\n var orientations = [\"v\", \"h\"];\n function crossTraceCalc(gd, plotinfo) {\n var calcdata = gd.calcdata;\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n for (var i = 0; i < orientations.length; i++) {\n var orientation = orientations[i];\n var posAxis = orientation === \"h\" ? ya : xa;\n var boxList = [];\n for (var j = 0; j < calcdata.length; j++) {\n var cd = calcdata[j];\n var t = cd[0].t;\n var trace = cd[0].trace;\n if (trace.visible === true && (trace.type === \"box\" || trace.type === \"candlestick\") && !t.empty && (trace.orientation || \"v\") === orientation && trace.xaxis === xa._id && trace.yaxis === ya._id) {\n boxList.push(j);\n }\n }\n setPositionOffset(\"box\", gd, boxList, posAxis);\n }\n }\n function setPositionOffset(traceType, gd, boxList, posAxis) {\n var calcdata = gd.calcdata;\n var fullLayout = gd._fullLayout;\n var axId = posAxis._id;\n var axLetter = axId.charAt(0);\n var i, j, calcTrace;\n var pointList = [];\n var shownPts = 0;\n for (i = 0; i < boxList.length; i++) {\n calcTrace = calcdata[boxList[i]];\n for (j = 0; j < calcTrace.length; j++) {\n pointList.push(posAxis.c2l(calcTrace[j].pos, true));\n shownPts += (calcTrace[j].pts2 || []).length;\n }\n }\n if (!pointList.length) return;\n var boxdv = Lib.distinctVals(pointList);\n if (posAxis.type === \"category\" || posAxis.type === \"multicategory\") {\n boxdv.minDiff = 1;\n }\n var dPos0 = boxdv.minDiff / 2;\n Axes.minDtick(posAxis, boxdv.minDiff, boxdv.vals[0], true);\n var numKey = traceType === \"violin\" ? \"_numViolins\" : \"_numBoxes\";\n var numTotal = fullLayout[numKey];\n var group = fullLayout[traceType + \"mode\"] === \"group\" && numTotal > 1;\n var groupFraction = 1 - fullLayout[traceType + \"gap\"];\n var groupGapFraction = 1 - fullLayout[traceType + \"groupgap\"];\n for (i = 0; i < boxList.length; i++) {\n calcTrace = calcdata[boxList[i]];\n var trace = calcTrace[0].trace;\n var t = calcTrace[0].t;\n var width = trace.width;\n var side = trace.side;\n var dPos;\n var bdPos;\n var bPos;\n var wHover;\n if (width) {\n dPos = bdPos = wHover = width / 2;\n bPos = 0;\n } else {\n dPos = dPos0;\n if (group) {\n var groupId = getAxisGroup(fullLayout, posAxis._id) + trace.orientation;\n var alignmentGroups = fullLayout._alignmentOpts[groupId] || {};\n var alignmentGroupOpts = alignmentGroups[trace.alignmentgroup] || {};\n var nOffsetGroups = Object.keys(alignmentGroupOpts.offsetGroups || {}).length;\n var num = nOffsetGroups || numTotal;\n var shift = nOffsetGroups ? trace._offsetIndex : t.num;\n bdPos = dPos * groupFraction * groupGapFraction / num;\n bPos = 2 * dPos * (-0.5 + (shift + 0.5) / num) * groupFraction;\n wHover = dPos * groupFraction / num;\n } else {\n bdPos = dPos * groupFraction * groupGapFraction;\n bPos = 0;\n wHover = dPos;\n }\n }\n t.dPos = dPos;\n t.bPos = bPos;\n t.bdPos = bdPos;\n t.wHover = wHover;\n var pushplus;\n var pushminus;\n var edge = bPos + bdPos;\n var edgeplus;\n var edgeminus;\n var vpadplus;\n var vpadminus;\n var ppadplus;\n var ppadminus;\n var padded = Boolean(width);\n var hasPts = (trace.boxpoints || trace.points) && shownPts > 0;\n if (side === \"positive\") {\n pushplus = dPos * (width ? 1 : 0.5);\n edgeplus = edge;\n pushminus = edgeplus = bPos;\n } else if (side === \"negative\") {\n pushplus = edgeplus = bPos;\n pushminus = dPos * (width ? 1 : 0.5);\n edgeminus = edge;\n } else {\n pushplus = pushminus = dPos;\n edgeplus = edgeminus = edge;\n }\n if (hasPts) {\n var pointpos = trace.pointpos;\n var jitter = trace.jitter;\n var ms = trace.marker.size / 2;\n var pp = 0;\n if (pointpos + jitter >= 0) {\n pp = edge * (pointpos + jitter);\n if (pp > pushplus) {\n padded = true;\n ppadplus = ms;\n vpadplus = pp;\n } else if (pp > edgeplus) {\n ppadplus = ms;\n vpadplus = pushplus;\n }\n }\n if (pp <= pushplus) {\n vpadplus = pushplus;\n }\n var pm = 0;\n if (pointpos - jitter <= 0) {\n pm = -edge * (pointpos - jitter);\n if (pm > pushminus) {\n padded = true;\n ppadminus = ms;\n vpadminus = pm;\n } else if (pm > edgeminus) {\n ppadminus = ms;\n vpadminus = pushminus;\n }\n }\n if (pm <= pushminus) {\n vpadminus = pushminus;\n }\n } else {\n vpadplus = pushplus;\n vpadminus = pushminus;\n }\n var pos = new Array(calcTrace.length);\n for (j = 0; j < calcTrace.length; j++) {\n pos[j] = calcTrace[j].pos;\n }\n trace._extremes[axId] = Axes.findExtremes(posAxis, pos, {\n padded,\n vpadminus,\n vpadplus,\n vpadLinearized: true,\n // N.B. SVG px-space positive/negative\n ppadminus: { x: ppadminus, y: ppadplus }[axLetter],\n ppadplus: { x: ppadplus, y: ppadminus }[axLetter]\n });\n }\n }\n module.exports = {\n crossTraceCalc,\n setPositionOffset\n };\n }\n });\n\n // src/traces/box/plot.js\n var require_plot4 = __commonJS({\n \"src/traces/box/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var Drawing = require_drawing();\n var JITTERCOUNT = 5;\n var JITTERSPREAD = 0.01;\n function plot(gd, plotinfo, cdbox, boxLayer) {\n var isStatic = gd._context.staticPlot;\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n Lib.makeTraceGroups(boxLayer, cdbox, \"trace boxes\").each(function(cd) {\n var plotGroup = d3.select(this);\n var cd0 = cd[0];\n var t = cd0.t;\n var trace = cd0.trace;\n t.wdPos = t.bdPos * trace.whiskerwidth;\n if (trace.visible !== true || t.empty) {\n plotGroup.remove();\n return;\n }\n var posAxis, valAxis;\n if (trace.orientation === \"h\") {\n posAxis = ya;\n valAxis = xa;\n } else {\n posAxis = xa;\n valAxis = ya;\n }\n plotBoxAndWhiskers(plotGroup, { pos: posAxis, val: valAxis }, trace, t, isStatic);\n plotPoints(plotGroup, { x: xa, y: ya }, trace, t);\n plotBoxMean(plotGroup, { pos: posAxis, val: valAxis }, trace, t);\n });\n }\n function plotBoxAndWhiskers(sel, axes, trace, t, isStatic) {\n var isHorizontal = trace.orientation === \"h\";\n var valAxis = axes.val;\n var posAxis = axes.pos;\n var posHasRangeBreaks = !!posAxis.rangebreaks;\n var bPos = t.bPos;\n var wdPos = t.wdPos || 0;\n var bPosPxOffset = t.bPosPxOffset || 0;\n var whiskerWidth = trace.whiskerwidth || 0;\n var showWhiskers = trace.showwhiskers !== false;\n var notched = trace.notched || false;\n var nw = notched ? 1 - 2 * trace.notchwidth : 1;\n var bdPos0;\n var bdPos1;\n if (Array.isArray(t.bdPos)) {\n bdPos0 = t.bdPos[0];\n bdPos1 = t.bdPos[1];\n } else {\n bdPos0 = t.bdPos;\n bdPos1 = t.bdPos;\n }\n var paths = sel.selectAll(\"path.box\").data(trace.type !== \"violin\" || trace.box.visible ? Lib.identity : []);\n paths.enter().append(\"path\").style(\"vector-effect\", isStatic ? \"none\" : \"non-scaling-stroke\").attr(\"class\", \"box\");\n paths.exit().remove();\n paths.each(function(d) {\n if (d.empty) return d3.select(this).attr(\"d\", \"M0,0Z\");\n var lcenter = posAxis.c2l(d.pos + bPos, true);\n var pos0 = posAxis.l2p(lcenter - bdPos0) + bPosPxOffset;\n var pos1 = posAxis.l2p(lcenter + bdPos1) + bPosPxOffset;\n var posc = posHasRangeBreaks ? (pos0 + pos1) / 2 : posAxis.l2p(lcenter) + bPosPxOffset;\n var r = trace.whiskerwidth;\n var posw0 = posHasRangeBreaks ? pos0 * r + (1 - r) * posc : posAxis.l2p(lcenter - wdPos) + bPosPxOffset;\n var posw1 = posHasRangeBreaks ? pos1 * r + (1 - r) * posc : posAxis.l2p(lcenter + wdPos) + bPosPxOffset;\n var posm0 = posAxis.l2p(lcenter - bdPos0 * nw) + bPosPxOffset;\n var posm1 = posAxis.l2p(lcenter + bdPos1 * nw) + bPosPxOffset;\n var sdmode = trace.sizemode === \"sd\";\n var q1 = valAxis.c2p(sdmode ? d.mean - d.sd : d.q1, true);\n var q3 = sdmode ? valAxis.c2p(d.mean + d.sd, true) : valAxis.c2p(d.q3, true);\n var m = Lib.constrain(\n sdmode ? valAxis.c2p(d.mean, true) : valAxis.c2p(d.med, true),\n Math.min(q1, q3) + 1,\n Math.max(q1, q3) - 1\n );\n var useExtremes = d.lf === void 0 || trace.boxpoints === false || sdmode;\n var lf = valAxis.c2p(useExtremes ? d.min : d.lf, true);\n var uf = valAxis.c2p(useExtremes ? d.max : d.uf, true);\n var ln = valAxis.c2p(d.ln, true);\n var un = valAxis.c2p(d.un, true);\n if (isHorizontal) {\n d3.select(this).attr(\n \"d\",\n \"M\" + m + \",\" + posm0 + \"V\" + posm1 + // median line\n \"M\" + q1 + \",\" + pos0 + \"V\" + pos1 + // left edge\n (notched ? \"H\" + ln + \"L\" + m + \",\" + posm1 + \"L\" + un + \",\" + pos1 : \"\") + // top notched edge\n \"H\" + q3 + // end of the top edge\n \"V\" + pos0 + // right edge\n (notched ? \"H\" + un + \"L\" + m + \",\" + posm0 + \"L\" + ln + \",\" + pos0 : \"\") + // bottom notched edge\n \"Z\" + // end of the box\n (showWhiskers ? \"M\" + q1 + \",\" + posc + \"H\" + lf + \"M\" + q3 + \",\" + posc + \"H\" + uf + // whiskers\n (whiskerWidth === 0 ? \"\" : (\n // whisker caps\n \"M\" + lf + \",\" + posw0 + \"V\" + posw1 + \"M\" + uf + \",\" + posw0 + \"V\" + posw1\n )) : \"\")\n );\n } else {\n d3.select(this).attr(\n \"d\",\n \"M\" + posm0 + \",\" + m + \"H\" + posm1 + // median line\n \"M\" + pos0 + \",\" + q1 + \"H\" + pos1 + // top of the box\n (notched ? \"V\" + ln + \"L\" + posm1 + \",\" + m + \"L\" + pos1 + \",\" + un : \"\") + // notched right edge\n \"V\" + q3 + // end of the right edge\n \"H\" + pos0 + // bottom of the box\n (notched ? \"V\" + un + \"L\" + posm0 + \",\" + m + \"L\" + pos0 + \",\" + ln : \"\") + // notched left edge\n \"Z\" + // end of the box\n (showWhiskers ? \"M\" + posc + \",\" + q1 + \"V\" + lf + \"M\" + posc + \",\" + q3 + \"V\" + uf + // whiskers\n (whiskerWidth === 0 ? \"\" : (\n // whisker caps\n \"M\" + posw0 + \",\" + lf + \"H\" + posw1 + \"M\" + posw0 + \",\" + uf + \"H\" + posw1\n )) : \"\")\n );\n }\n });\n }\n function plotPoints(sel, axes, trace, t) {\n var xa = axes.x;\n var ya = axes.y;\n var bdPos = t.bdPos;\n var bPos = t.bPos;\n var mode = trace.boxpoints || trace.points;\n Lib.seedPseudoRandom();\n var fn = function(d) {\n d.forEach(function(v) {\n v.t = t;\n v.trace = trace;\n });\n return d;\n };\n var gPoints = sel.selectAll(\"g.points\").data(mode ? fn : []);\n gPoints.enter().append(\"g\").attr(\"class\", \"points\");\n gPoints.exit().remove();\n var paths = gPoints.selectAll(\"path\").data(function(d) {\n var i;\n var pts = d.pts2;\n var typicalSpread = Math.max((d.max - d.min) / 10, d.q3 - d.q1);\n var minSpread = typicalSpread * 1e-9;\n var spreadLimit = typicalSpread * JITTERSPREAD;\n var jitterFactors = [];\n var maxJitterFactor = 0;\n var newJitter;\n if (trace.jitter) {\n if (typicalSpread === 0) {\n maxJitterFactor = 1;\n jitterFactors = new Array(pts.length);\n for (i = 0; i < pts.length; i++) {\n jitterFactors[i] = 1;\n }\n } else {\n for (i = 0; i < pts.length; i++) {\n var i0 = Math.max(0, i - JITTERCOUNT);\n var pmin = pts[i0].v;\n var i1 = Math.min(pts.length - 1, i + JITTERCOUNT);\n var pmax = pts[i1].v;\n if (mode !== \"all\") {\n if (pts[i].v < d.lf) pmax = Math.min(pmax, d.lf);\n else pmin = Math.max(pmin, d.uf);\n }\n var jitterFactor = Math.sqrt(spreadLimit * (i1 - i0) / (pmax - pmin + minSpread)) || 0;\n jitterFactor = Lib.constrain(Math.abs(jitterFactor), 0, 1);\n jitterFactors.push(jitterFactor);\n maxJitterFactor = Math.max(jitterFactor, maxJitterFactor);\n }\n }\n newJitter = trace.jitter * 2 / (maxJitterFactor || 1);\n }\n for (i = 0; i < pts.length; i++) {\n var pt = pts[i];\n var v = pt.v;\n var jitterOffset = trace.jitter ? newJitter * jitterFactors[i] * (Lib.pseudoRandom() - 0.5) : 0;\n var posPx = d.pos + bPos + bdPos * (trace.pointpos + jitterOffset);\n if (trace.orientation === \"h\") {\n pt.y = posPx;\n pt.x = v;\n } else {\n pt.x = posPx;\n pt.y = v;\n }\n if (mode === \"suspectedoutliers\" && v < d.uo && v > d.lo) {\n pt.so = true;\n }\n }\n return pts;\n });\n paths.enter().append(\"path\").classed(\"point\", true);\n paths.exit().remove();\n paths.call(Drawing.translatePoints, xa, ya);\n }\n function plotBoxMean(sel, axes, trace, t) {\n var valAxis = axes.val;\n var posAxis = axes.pos;\n var posHasRangeBreaks = !!posAxis.rangebreaks;\n var bPos = t.bPos;\n var bPosPxOffset = t.bPosPxOffset || 0;\n var mode = trace.boxmean || (trace.meanline || {}).visible;\n var bdPos0;\n var bdPos1;\n if (Array.isArray(t.bdPos)) {\n bdPos0 = t.bdPos[0];\n bdPos1 = t.bdPos[1];\n } else {\n bdPos0 = t.bdPos;\n bdPos1 = t.bdPos;\n }\n var paths = sel.selectAll(\"path.mean\").data(trace.type === \"box\" && trace.boxmean || trace.type === \"violin\" && trace.box.visible && trace.meanline.visible ? Lib.identity : []);\n paths.enter().append(\"path\").attr(\"class\", \"mean\").style({\n fill: \"none\",\n \"vector-effect\": \"non-scaling-stroke\"\n });\n paths.exit().remove();\n paths.each(function(d) {\n var lcenter = posAxis.c2l(d.pos + bPos, true);\n var pos0 = posAxis.l2p(lcenter - bdPos0) + bPosPxOffset;\n var pos1 = posAxis.l2p(lcenter + bdPos1) + bPosPxOffset;\n var posc = posHasRangeBreaks ? (pos0 + pos1) / 2 : posAxis.l2p(lcenter) + bPosPxOffset;\n var m = valAxis.c2p(d.mean, true);\n var sl = valAxis.c2p(d.mean - d.sd, true);\n var sh = valAxis.c2p(d.mean + d.sd, true);\n if (trace.orientation === \"h\") {\n d3.select(this).attr(\n \"d\",\n \"M\" + m + \",\" + pos0 + \"V\" + pos1 + (mode === \"sd\" ? \"m0,0L\" + sl + \",\" + posc + \"L\" + m + \",\" + pos0 + \"L\" + sh + \",\" + posc + \"Z\" : \"\")\n );\n } else {\n d3.select(this).attr(\n \"d\",\n \"M\" + pos0 + \",\" + m + \"H\" + pos1 + (mode === \"sd\" ? \"m0,0L\" + posc + \",\" + sl + \"L\" + pos0 + \",\" + m + \"L\" + posc + \",\" + sh + \"Z\" : \"\")\n );\n }\n });\n }\n module.exports = {\n plot,\n plotBoxAndWhiskers,\n plotPoints,\n plotBoxMean\n };\n }\n });\n\n // src/traces/box/style.js\n var require_style5 = __commonJS({\n \"src/traces/box/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Color2 = require_color();\n var Drawing = require_drawing();\n function style(gd, cd, sel) {\n var s = sel ? sel : d3.select(gd).selectAll(\"g.trace.boxes\");\n s.style(\"opacity\", function(d) {\n return d[0].trace.opacity;\n });\n s.each(function(d) {\n var el = d3.select(this);\n var trace = d[0].trace;\n var lineWidth = trace.line.width;\n function styleBox(boxSel, lineWidth2, lineColor, fillColor) {\n boxSel.style(\"stroke-width\", lineWidth2 + \"px\").call(Color2.stroke, lineColor).call(Color2.fill, fillColor);\n }\n var allBoxes = el.selectAll(\"path.box\");\n if (trace.type === \"candlestick\") {\n allBoxes.each(function(boxData) {\n if (boxData.empty) return;\n var thisBox = d3.select(this);\n var container = trace[boxData.dir];\n styleBox(thisBox, container.line.width, container.line.color, container.fillcolor);\n thisBox.style(\"opacity\", trace.selectedpoints && !boxData.selected ? 0.3 : 1);\n });\n } else {\n styleBox(allBoxes, lineWidth, trace.line.color, trace.fillcolor);\n el.selectAll(\"path.mean\").style({\n \"stroke-width\": lineWidth,\n \"stroke-dasharray\": 2 * lineWidth + \"px,\" + lineWidth + \"px\"\n }).call(Color2.stroke, trace.line.color);\n var pts = el.selectAll(\"path.point\");\n Drawing.pointStyle(pts, trace, gd);\n }\n });\n }\n function styleOnSelect(gd, cd, sel) {\n var trace = cd[0].trace;\n var pts = sel.selectAll(\"path.point\");\n if (trace.selectedpoints) {\n Drawing.selectedPointStyle(pts, trace);\n } else {\n Drawing.pointStyle(pts, trace, gd);\n }\n }\n module.exports = {\n style,\n styleOnSelect\n };\n }\n });\n\n // src/traces/box/hover.js\n var require_hover4 = __commonJS({\n \"src/traces/box/hover.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n var Lib = require_lib();\n var Fx = require_fx();\n var Color2 = require_color();\n var fillText = Lib.fillText;\n function hoverPoints(pointData, xval, yval, hovermode) {\n var cd = pointData.cd;\n var trace = cd[0].trace;\n var hoveron = trace.hoveron;\n var closeBoxData = [];\n var closePtData;\n if (hoveron.indexOf(\"boxes\") !== -1) {\n closeBoxData = closeBoxData.concat(hoverOnBoxes(pointData, xval, yval, hovermode));\n }\n if (hoveron.indexOf(\"points\") !== -1) {\n closePtData = hoverOnPoints(pointData, xval, yval);\n }\n if (hovermode === \"closest\") {\n if (closePtData) return [closePtData];\n return closeBoxData;\n }\n if (closePtData) {\n closeBoxData.push(closePtData);\n return closeBoxData;\n }\n return closeBoxData;\n }\n function hoverOnBoxes(pointData, xval, yval, hovermode) {\n var cd = pointData.cd;\n var xa = pointData.xa;\n var ya = pointData.ya;\n var trace = cd[0].trace;\n var t = cd[0].t;\n var isViolin = trace.type === \"violin\";\n var pLetter, vLetter, pAxis, vAxis, vVal, pVal, dx, dy, dPos, hoverPseudoDistance, spikePseudoDistance;\n var boxDelta = t.bdPos;\n var boxDeltaPos, boxDeltaNeg;\n var posAcceptance = t.wHover;\n var shiftPos = function(di2) {\n return pAxis.c2l(di2.pos) + t.bPos - pAxis.c2l(pVal);\n };\n if (isViolin && trace.side !== \"both\") {\n if (trace.side === \"positive\") {\n dPos = function(di2) {\n var pos = shiftPos(di2);\n return Fx.inbox(pos, pos + posAcceptance, hoverPseudoDistance);\n };\n boxDeltaPos = boxDelta;\n boxDeltaNeg = 0;\n }\n if (trace.side === \"negative\") {\n dPos = function(di2) {\n var pos = shiftPos(di2);\n return Fx.inbox(pos - posAcceptance, pos, hoverPseudoDistance);\n };\n boxDeltaPos = 0;\n boxDeltaNeg = boxDelta;\n }\n } else {\n dPos = function(di2) {\n var pos = shiftPos(di2);\n return Fx.inbox(pos - posAcceptance, pos + posAcceptance, hoverPseudoDistance);\n };\n boxDeltaPos = boxDeltaNeg = boxDelta;\n }\n var dVal;\n if (isViolin) {\n dVal = function(di2) {\n return Fx.inbox(di2.span[0] - vVal, di2.span[1] - vVal, hoverPseudoDistance);\n };\n } else {\n dVal = function(di2) {\n return Fx.inbox(di2.min - vVal, di2.max - vVal, hoverPseudoDistance);\n };\n }\n if (trace.orientation === \"h\") {\n vVal = xval;\n pVal = yval;\n dx = dVal;\n dy = dPos;\n pLetter = \"y\";\n pAxis = ya;\n vLetter = \"x\";\n vAxis = xa;\n } else {\n vVal = yval;\n pVal = xval;\n dx = dPos;\n dy = dVal;\n pLetter = \"x\";\n pAxis = xa;\n vLetter = \"y\";\n vAxis = ya;\n }\n var pseudoDistance = Math.min(1, boxDelta / Math.abs(pAxis.r2c(pAxis.range[1]) - pAxis.r2c(pAxis.range[0])));\n hoverPseudoDistance = pointData.maxHoverDistance - pseudoDistance;\n spikePseudoDistance = pointData.maxSpikeDistance - pseudoDistance;\n function dxy(di2) {\n return (dx(di2) + dy(di2)) / 2;\n }\n var distfn = Fx.getDistanceFunction(hovermode, dx, dy, dxy);\n Fx.getClosest(cd, distfn, pointData);\n if (pointData.index === false) return [];\n var di = cd[pointData.index];\n var lc = trace.line.color;\n var mc = (trace.marker || {}).color;\n if (Color2.opacity(lc) && trace.line.width) pointData.color = lc;\n else if (Color2.opacity(mc) && trace.boxpoints) pointData.color = mc;\n else pointData.color = trace.fillcolor;\n pointData[pLetter + \"0\"] = pAxis.c2p(di.pos + t.bPos - boxDeltaNeg, true);\n pointData[pLetter + \"1\"] = pAxis.c2p(di.pos + t.bPos + boxDeltaPos, true);\n pointData[pLetter + \"LabelVal\"] = di.orig_p !== void 0 ? di.orig_p : di.pos;\n var spikePosAttr = pLetter + \"Spike\";\n pointData.spikeDistance = dxy(di) * spikePseudoDistance / hoverPseudoDistance;\n pointData[spikePosAttr] = pAxis.c2p(di.pos, true);\n var hasMean = trace.boxmean || trace.sizemode === \"sd\" || (trace.meanline || {}).visible;\n var hasFences = trace.boxpoints || trace.points;\n var attrs = hasFences && hasMean ? [\"max\", \"uf\", \"q3\", \"med\", \"mean\", \"q1\", \"lf\", \"min\"] : hasFences && !hasMean ? [\"max\", \"uf\", \"q3\", \"med\", \"q1\", \"lf\", \"min\"] : !hasFences && hasMean ? [\"max\", \"q3\", \"med\", \"mean\", \"q1\", \"min\"] : [\"max\", \"q3\", \"med\", \"q1\", \"min\"];\n var rev = vAxis.range[1] < vAxis.range[0];\n if (trace.orientation === (rev ? \"v\" : \"h\")) {\n attrs.reverse();\n }\n var spikeDistance = pointData.spikeDistance;\n var spikePosition = pointData[spikePosAttr];\n var closeBoxData = [];\n for (var i = 0; i < attrs.length; i++) {\n var attr = attrs[i];\n if (!(attr in di)) continue;\n var val = di[attr];\n var valPx = vAxis.c2p(val, true);\n var pointData2 = Lib.extendFlat({}, pointData);\n pointData2.attr = attr;\n pointData2[vLetter + \"0\"] = pointData2[vLetter + \"1\"] = valPx;\n pointData2[vLetter + \"LabelVal\"] = val;\n pointData2[vLetter + \"Label\"] = (t.labels ? t.labels[attr] + \" \" : \"\") + Axes.hoverLabelText(vAxis, val, trace[vLetter + \"hoverformat\"]);\n pointData2.hoverOnBox = true;\n if (attr === \"mean\" && \"sd\" in di && (trace.boxmean === \"sd\" || trace.sizemode === \"sd\")) {\n pointData2[vLetter + \"err\"] = di.sd;\n }\n pointData2.hovertemplate = false;\n closeBoxData.push(pointData2);\n }\n pointData.name = \"\";\n pointData.spikeDistance = void 0;\n pointData[spikePosAttr] = void 0;\n for (var k = 0; k < closeBoxData.length; k++) {\n if (closeBoxData[k].attr !== \"med\") {\n closeBoxData[k].name = \"\";\n closeBoxData[k].spikeDistance = void 0;\n closeBoxData[k][spikePosAttr] = void 0;\n } else {\n closeBoxData[k].spikeDistance = spikeDistance;\n closeBoxData[k][spikePosAttr] = spikePosition;\n }\n }\n return closeBoxData;\n }\n function hoverOnPoints(pointData, xval, yval) {\n var cd = pointData.cd;\n var xa = pointData.xa;\n var ya = pointData.ya;\n var trace = cd[0].trace;\n var xPx = xa.c2p(xval);\n var yPx = ya.c2p(yval);\n var closePtData;\n var dx = function(di2) {\n var rad2 = Math.max(3, di2.mrc || 0);\n return Math.max(Math.abs(xa.c2p(di2.x) - xPx) - rad2, 1 - 3 / rad2);\n };\n var dy = function(di2) {\n var rad2 = Math.max(3, di2.mrc || 0);\n return Math.max(Math.abs(ya.c2p(di2.y) - yPx) - rad2, 1 - 3 / rad2);\n };\n var distfn = Fx.quadrature(dx, dy);\n var ijClosest = false;\n var di, pt;\n for (var i = 0; i < cd.length; i++) {\n di = cd[i];\n for (var j = 0; j < (di.pts || []).length; j++) {\n pt = di.pts[j];\n var newDistance = distfn(pt);\n if (newDistance <= pointData.distance) {\n pointData.distance = newDistance;\n ijClosest = [i, j];\n }\n }\n }\n if (!ijClosest) return false;\n di = cd[ijClosest[0]];\n pt = di.pts[ijClosest[1]];\n var xc = xa.c2p(pt.x, true);\n var yc = ya.c2p(pt.y, true);\n var rad = pt.mrc || 1;\n closePtData = Lib.extendFlat({}, pointData, {\n // corresponds to index in x/y input data array\n index: pt.i,\n color: (trace.marker || {}).color,\n name: trace.name,\n x0: xc - rad,\n x1: xc + rad,\n y0: yc - rad,\n y1: yc + rad,\n spikeDistance: pointData.distance,\n hovertemplate: trace.hovertemplate\n });\n var origPos = di.orig_p;\n var pos = origPos !== void 0 ? origPos : di.pos;\n var pa;\n if (trace.orientation === \"h\") {\n pa = ya;\n closePtData.xLabelVal = pt.x;\n closePtData.yLabelVal = pos;\n } else {\n pa = xa;\n closePtData.xLabelVal = pos;\n closePtData.yLabelVal = pt.y;\n }\n var pLetter = pa._id.charAt(0);\n closePtData[pLetter + \"Spike\"] = pa.c2p(di.pos, true);\n fillText(pt, trace, closePtData);\n return closePtData;\n }\n module.exports = {\n hoverPoints,\n hoverOnBoxes,\n hoverOnPoints\n };\n }\n });\n\n // src/traces/box/event_data.js\n var require_event_data2 = __commonJS({\n \"src/traces/box/event_data.js\"(exports, module) {\n \"use strict\";\n module.exports = function eventData(out, pt) {\n if (pt.hoverOnBox) out.hoverOnBox = pt.hoverOnBox;\n if (\"xVal\" in pt) out.x = pt.xVal;\n if (\"yVal\" in pt) out.y = pt.yVal;\n if (pt.xa) out.xaxis = pt.xa;\n if (pt.ya) out.yaxis = pt.ya;\n return out;\n };\n }\n });\n\n // src/traces/box/select.js\n var require_select4 = __commonJS({\n \"src/traces/box/select.js\"(exports, module) {\n \"use strict\";\n module.exports = function selectPoints(searchInfo, selectionTester) {\n var cd = searchInfo.cd;\n var xa = searchInfo.xaxis;\n var ya = searchInfo.yaxis;\n var selection = [];\n var i, j;\n if (selectionTester === false) {\n for (i = 0; i < cd.length; i++) {\n for (j = 0; j < (cd[i].pts || []).length; j++) {\n cd[i].pts[j].selected = 0;\n }\n }\n } else {\n for (i = 0; i < cd.length; i++) {\n for (j = 0; j < (cd[i].pts || []).length; j++) {\n var pt = cd[i].pts[j];\n var x = xa.c2p(pt.x);\n var y = ya.c2p(pt.y);\n if (selectionTester.contains([x, y], null, pt.i, searchInfo)) {\n selection.push({\n pointNumber: pt.i,\n x: xa.c2d(pt.x),\n y: ya.c2d(pt.y)\n });\n pt.selected = 1;\n } else {\n pt.selected = 0;\n }\n }\n }\n }\n return selection;\n };\n }\n });\n\n // src/traces/box/index.js\n var require_box = __commonJS({\n \"src/traces/box/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes24(),\n layoutAttributes: require_layout_attributes7(),\n supplyDefaults: require_defaults20().supplyDefaults,\n crossTraceDefaults: require_defaults20().crossTraceDefaults,\n supplyLayoutDefaults: require_layout_defaults6().supplyLayoutDefaults,\n calc: require_calc6(),\n crossTraceCalc: require_cross_trace_calc3().crossTraceCalc,\n plot: require_plot4().plot,\n style: require_style5().style,\n styleOnSelect: require_style5().styleOnSelect,\n hoverPoints: require_hover4().hoverPoints,\n eventData: require_event_data2(),\n selectPoints: require_select4(),\n moduleType: \"trace\",\n name: \"box\",\n basePlotModule: require_cartesian(),\n categories: [\"cartesian\", \"svg\", \"symbols\", \"oriented\", \"box-violin\", \"showLegend\", \"boxLayout\", \"zoomScale\"],\n meta: {}\n };\n }\n });\n\n // lib/box.js\n var require_box2 = __commonJS({\n \"lib/box.js\"(exports, module) {\n \"use strict\";\n module.exports = require_box();\n }\n });\n\n // src/traces/heatmap/attributes.js\n var require_attributes25 = __commonJS({\n \"src/traces/heatmap/attributes.js\"(exports, module) {\n \"use strict\";\n var scatterAttrs = require_attributes12();\n var baseAttrs = require_attributes2();\n var fontAttrs = require_font_attributes();\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var colorScaleAttrs = require_attributes8();\n var extendFlat = require_extend().extendFlat;\n module.exports = extendFlat(\n {\n z: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n x: extendFlat({}, scatterAttrs.x, { impliedEdits: { xtype: \"array\" } }),\n x0: extendFlat({}, scatterAttrs.x0, { impliedEdits: { xtype: \"scaled\" } }),\n dx: extendFlat({}, scatterAttrs.dx, { impliedEdits: { xtype: \"scaled\" } }),\n y: extendFlat({}, scatterAttrs.y, { impliedEdits: { ytype: \"array\" } }),\n y0: extendFlat({}, scatterAttrs.y0, { impliedEdits: { ytype: \"scaled\" } }),\n dy: extendFlat({}, scatterAttrs.dy, { impliedEdits: { ytype: \"scaled\" } }),\n xperiod: extendFlat({}, scatterAttrs.xperiod, { impliedEdits: { xtype: \"scaled\" } }),\n yperiod: extendFlat({}, scatterAttrs.yperiod, { impliedEdits: { ytype: \"scaled\" } }),\n xperiod0: extendFlat({}, scatterAttrs.xperiod0, { impliedEdits: { xtype: \"scaled\" } }),\n yperiod0: extendFlat({}, scatterAttrs.yperiod0, { impliedEdits: { ytype: \"scaled\" } }),\n xperiodalignment: extendFlat({}, scatterAttrs.xperiodalignment, { impliedEdits: { xtype: \"scaled\" } }),\n yperiodalignment: extendFlat({}, scatterAttrs.yperiodalignment, { impliedEdits: { ytype: \"scaled\" } }),\n text: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n hovertext: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n transpose: {\n valType: \"boolean\",\n dflt: false,\n editType: \"calc\"\n },\n xtype: {\n valType: \"enumerated\",\n values: [\"array\", \"scaled\"],\n editType: \"calc+clearAxisTypes\"\n },\n ytype: {\n valType: \"enumerated\",\n values: [\"array\", \"scaled\"],\n editType: \"calc+clearAxisTypes\"\n },\n zsmooth: {\n valType: \"enumerated\",\n values: [\"fast\", \"best\", false],\n dflt: false,\n editType: \"calc\"\n },\n hoverongaps: {\n valType: \"boolean\",\n dflt: true,\n editType: \"none\"\n },\n connectgaps: {\n valType: \"boolean\",\n editType: \"calc\"\n },\n xgap: {\n valType: \"number\",\n dflt: 0,\n min: 0,\n editType: \"plot\"\n },\n ygap: {\n valType: \"number\",\n dflt: 0,\n min: 0,\n editType: \"plot\"\n },\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n zhoverformat: axisHoverFormat(\"z\", 1),\n hovertemplate: hovertemplateAttrs(),\n texttemplate: texttemplateAttrs({\n arrayOk: false,\n editType: \"plot\"\n }, {\n keys: [\"x\", \"y\", \"z\", \"text\"]\n }),\n textfont: fontAttrs({\n editType: \"plot\",\n autoSize: true,\n autoColor: true,\n colorEditType: \"style\"\n }),\n showlegend: extendFlat({}, baseAttrs.showlegend, { dflt: false }),\n zorder: scatterAttrs.zorder\n },\n colorScaleAttrs(\"\", { cLetter: \"z\", autoColorDflt: false })\n );\n }\n });\n\n // src/traces/heatmap/xyz_defaults.js\n var require_xyz_defaults = __commonJS({\n \"src/traces/heatmap/xyz_defaults.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var Registry = require_registry();\n module.exports = function handleXYZDefaults(traceIn, traceOut, coerce, layout, xName, yName) {\n var z = coerce(\"z\");\n xName = xName || \"x\";\n yName = yName || \"y\";\n var x, y;\n if (z === void 0 || !z.length) return 0;\n if (Lib.isArray1D(z)) {\n x = coerce(xName);\n y = coerce(yName);\n var xlen = Lib.minRowLength(x);\n var ylen = Lib.minRowLength(y);\n if (xlen === 0 || ylen === 0) return 0;\n traceOut._length = Math.min(xlen, ylen, z.length);\n } else {\n x = coordDefaults(xName, coerce);\n y = coordDefaults(yName, coerce);\n if (!isValidZ(z)) return 0;\n coerce(\"transpose\");\n traceOut._length = null;\n }\n var handleCalendarDefaults = Registry.getComponentMethod(\"calendars\", \"handleTraceDefaults\");\n handleCalendarDefaults(traceIn, traceOut, [xName, yName], layout);\n return true;\n };\n function coordDefaults(coordStr, coerce) {\n var coord = coerce(coordStr);\n var coordType = coord ? coerce(coordStr + \"type\", \"array\") : \"scaled\";\n if (coordType === \"scaled\") {\n coerce(coordStr + \"0\");\n coerce(\"d\" + coordStr);\n }\n return coord;\n }\n function isValidZ(z) {\n var allRowsAreArrays = true;\n var oneRowIsFilled = false;\n var hasOneNumber = false;\n var zi;\n for (var i = 0; i < z.length; i++) {\n zi = z[i];\n if (!Lib.isArrayOrTypedArray(zi)) {\n allRowsAreArrays = false;\n break;\n }\n if (zi.length > 0) oneRowIsFilled = true;\n for (var j = 0; j < zi.length; j++) {\n if (isNumeric(zi[j])) {\n hasOneNumber = true;\n break;\n }\n }\n }\n return allRowsAreArrays && oneRowIsFilled && hasOneNumber;\n }\n }\n });\n\n // src/traces/heatmap/label_defaults.js\n var require_label_defaults = __commonJS({\n \"src/traces/heatmap/label_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n module.exports = function handleHeatmapLabelDefaults(coerce, layout) {\n coerce(\"texttemplate\");\n var fontDflt = Lib.extendFlat({}, layout.font, {\n color: \"auto\",\n size: \"auto\"\n });\n Lib.coerceFont(coerce, \"textfont\", fontDflt);\n };\n }\n });\n\n // src/traces/heatmap/style_defaults.js\n var require_style_defaults2 = __commonJS({\n \"src/traces/heatmap/style_defaults.js\"(exports, module) {\n \"use strict\";\n module.exports = function handleStyleDefaults(traceIn, traceOut, coerce) {\n var zsmooth = coerce(\"zsmooth\");\n if (zsmooth === false) {\n coerce(\"xgap\");\n coerce(\"ygap\");\n }\n coerce(\"zhoverformat\");\n };\n }\n });\n\n // src/traces/heatmap/defaults.js\n var require_defaults21 = __commonJS({\n \"src/traces/heatmap/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleXYZDefaults = require_xyz_defaults();\n var handleHeatmapLabelDefaults = require_label_defaults();\n var handlePeriodDefaults = require_period_defaults();\n var handleStyleDefaults = require_style_defaults2();\n var colorscaleDefaults = require_defaults2();\n var attributes = require_attributes25();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var validData = handleXYZDefaults(traceIn, traceOut, coerce, layout);\n if (!validData) {\n traceOut.visible = false;\n return;\n }\n handlePeriodDefaults(traceIn, traceOut, layout, coerce);\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n handleHeatmapLabelDefaults(coerce, layout);\n handleStyleDefaults(traceIn, traceOut, coerce, layout);\n coerce(\"hoverongaps\");\n coerce(\"connectgaps\", Lib.isArray1D(traceOut.z) && traceOut.zsmooth !== false);\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"\", cLetter: \"z\" });\n coerce(\"zorder\");\n };\n }\n });\n\n // src/traces/histogram/bin_functions.js\n var require_bin_functions = __commonJS({\n \"src/traces/histogram/bin_functions.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n module.exports = {\n count: function(n, i, size) {\n size[n]++;\n return 1;\n },\n sum: function(n, i, size, counterData) {\n var v = counterData[i];\n if (isNumeric(v)) {\n v = Number(v);\n size[n] += v;\n return v;\n }\n return 0;\n },\n avg: function(n, i, size, counterData, counts) {\n var v = counterData[i];\n if (isNumeric(v)) {\n v = Number(v);\n size[n] += v;\n counts[n]++;\n }\n return 0;\n },\n min: function(n, i, size, counterData) {\n var v = counterData[i];\n if (isNumeric(v)) {\n v = Number(v);\n if (!isNumeric(size[n])) {\n size[n] = v;\n return v;\n } else if (size[n] > v) {\n var delta = v - size[n];\n size[n] = v;\n return delta;\n }\n }\n return 0;\n },\n max: function(n, i, size, counterData) {\n var v = counterData[i];\n if (isNumeric(v)) {\n v = Number(v);\n if (!isNumeric(size[n])) {\n size[n] = v;\n return v;\n } else if (size[n] < v) {\n var delta = v - size[n];\n size[n] = v;\n return delta;\n }\n }\n return 0;\n }\n };\n }\n });\n\n // src/traces/histogram/norm_functions.js\n var require_norm_functions = __commonJS({\n \"src/traces/histogram/norm_functions.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n percent: function(size, total) {\n var nMax = size.length;\n var norm = 100 / total;\n for (var n = 0; n < nMax; n++) size[n] *= norm;\n },\n probability: function(size, total) {\n var nMax = size.length;\n for (var n = 0; n < nMax; n++) size[n] /= total;\n },\n density: function(size, total, inc, yinc) {\n var nMax = size.length;\n yinc = yinc || 1;\n for (var n = 0; n < nMax; n++) size[n] *= inc[n] * yinc;\n },\n \"probability density\": function(size, total, inc, yinc) {\n var nMax = size.length;\n if (yinc) total /= yinc;\n for (var n = 0; n < nMax; n++) size[n] *= inc[n] / total;\n }\n };\n }\n });\n\n // src/traces/histogram/average.js\n var require_average = __commonJS({\n \"src/traces/histogram/average.js\"(exports, module) {\n \"use strict\";\n module.exports = function doAvg(size, counts) {\n var nMax = size.length;\n var total = 0;\n for (var i = 0; i < nMax; i++) {\n if (counts[i]) {\n size[i] /= counts[i];\n total += size[i];\n } else size[i] = null;\n }\n return total;\n };\n }\n });\n\n // src/traces/histogram/bin_label_vals.js\n var require_bin_label_vals = __commonJS({\n \"src/traces/histogram/bin_label_vals.js\"(exports, module) {\n \"use strict\";\n var numConstants = require_numerical();\n var oneYear = numConstants.ONEAVGYEAR;\n var oneMonth = numConstants.ONEAVGMONTH;\n var oneDay = numConstants.ONEDAY;\n var oneHour = numConstants.ONEHOUR;\n var oneMin = numConstants.ONEMIN;\n var oneSec = numConstants.ONESEC;\n var tickIncrement = require_axes().tickIncrement;\n module.exports = function getBinSpanLabelRound(leftGap, rightGap, binEdges, pa, calendar) {\n var dv0 = -1.1 * rightGap;\n var dv1 = -0.1 * rightGap;\n var dv2 = leftGap - dv1;\n var edge0 = binEdges[0];\n var edge1 = binEdges[1];\n var leftDigit = Math.min(\n biggestDigitChanged(edge0 + dv1, edge0 + dv2, pa, calendar),\n biggestDigitChanged(edge1 + dv1, edge1 + dv2, pa, calendar)\n );\n var rightDigit = Math.min(\n biggestDigitChanged(edge0 + dv0, edge0 + dv1, pa, calendar),\n biggestDigitChanged(edge1 + dv0, edge1 + dv1, pa, calendar)\n );\n var digit, disambiguateEdges;\n if (leftDigit > rightDigit && rightDigit < Math.abs(edge1 - edge0) / 4e3) {\n digit = leftDigit;\n disambiguateEdges = false;\n } else {\n digit = Math.min(leftDigit, rightDigit);\n disambiguateEdges = true;\n }\n if (pa.type === \"date\" && digit > oneDay) {\n var dashExclude = digit === oneYear ? 1 : 6;\n var increment = digit === oneYear ? \"M12\" : \"M1\";\n return function(v, isRightEdge) {\n var dateStr = pa.c2d(v, oneYear, calendar);\n var dashPos = dateStr.indexOf(\"-\", dashExclude);\n if (dashPos > 0) dateStr = dateStr.substr(0, dashPos);\n var roundedV = pa.d2c(dateStr, 0, calendar);\n if (roundedV < v) {\n var nextV = tickIncrement(roundedV, increment, false, calendar);\n if ((roundedV + nextV) / 2 < v + leftGap) roundedV = nextV;\n }\n if (isRightEdge && disambiguateEdges) {\n return tickIncrement(roundedV, increment, true, calendar);\n }\n return roundedV;\n };\n }\n return function(v, isRightEdge) {\n var roundedV = digit * Math.round(v / digit);\n if (roundedV + digit / 10 < v && roundedV + digit * 0.9 < v + leftGap) {\n roundedV += digit;\n }\n if (isRightEdge && disambiguateEdges) {\n roundedV -= digit;\n }\n return roundedV;\n };\n };\n function biggestDigitChanged(v1, v2, pa, calendar) {\n if (v1 * v2 <= 0) return Infinity;\n var dv = Math.abs(v2 - v1);\n var isDate = pa.type === \"date\";\n var digit = biggestGuaranteedDigitChanged(dv, isDate);\n for (var i = 0; i < 10; i++) {\n var nextDigit = biggestGuaranteedDigitChanged(digit * 80, isDate);\n if (digit === nextDigit) break;\n if (didDigitChange(nextDigit, v1, v2, isDate, pa, calendar)) digit = nextDigit;\n else break;\n }\n return digit;\n }\n function biggestGuaranteedDigitChanged(dv, isDate) {\n if (isDate && dv > oneSec) {\n if (dv > oneDay) {\n if (dv > oneYear * 1.1) return oneYear;\n if (dv > oneMonth * 1.1) return oneMonth;\n return oneDay;\n }\n if (dv > oneHour) return oneHour;\n if (dv > oneMin) return oneMin;\n return oneSec;\n }\n return Math.pow(10, Math.floor(Math.log(dv) / Math.LN10));\n }\n function didDigitChange(digit, v1, v2, isDate, pa, calendar) {\n if (isDate && digit > oneDay) {\n var dateParts1 = dateParts(v1, pa, calendar);\n var dateParts2 = dateParts(v2, pa, calendar);\n var parti = digit === oneYear ? 0 : 1;\n return dateParts1[parti] !== dateParts2[parti];\n }\n return Math.floor(v2 / digit) - Math.floor(v1 / digit) > 0.1;\n }\n function dateParts(v, pa, calendar) {\n var parts = pa.c2d(v, oneYear, calendar).split(\"-\");\n if (parts[0] === \"\") {\n parts.unshift();\n parts[0] = \"-\" + parts[0];\n }\n return parts;\n }\n }\n });\n\n // src/traces/histogram/calc.js\n var require_calc7 = __commonJS({\n \"src/traces/histogram/calc.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var Registry = require_registry();\n var Axes = require_axes();\n var arraysToCalcdata = require_arrays_to_calcdata2();\n var binFunctions = require_bin_functions();\n var normFunctions = require_norm_functions();\n var doAvg = require_average();\n var getBinSpanLabelRound = require_bin_label_vals();\n function calc(gd, trace) {\n var pos = [];\n var size = [];\n var isHorizontal = trace.orientation === \"h\";\n var pa = Axes.getFromId(gd, isHorizontal ? trace.yaxis : trace.xaxis);\n var mainData = isHorizontal ? \"y\" : \"x\";\n var counterData = { x: \"y\", y: \"x\" }[mainData];\n var calendar = trace[mainData + \"calendar\"];\n var cumulativeSpec = trace.cumulative;\n var i;\n var binsAndPos = calcAllAutoBins(gd, trace, pa, mainData);\n var binSpec = binsAndPos[0];\n var pos0 = binsAndPos[1];\n var nonuniformBins = typeof binSpec.size === \"string\";\n var binEdges = [];\n var bins = nonuniformBins ? binEdges : binSpec;\n var inc = [];\n var counts = [];\n var inputPoints = [];\n var total = 0;\n var norm = trace.histnorm;\n var func = trace.histfunc;\n var densityNorm = norm.indexOf(\"density\") !== -1;\n var i2, binEnd, n;\n if (cumulativeSpec.enabled && densityNorm) {\n norm = norm.replace(/ ?density$/, \"\");\n densityNorm = false;\n }\n var extremeFunc = func === \"max\" || func === \"min\";\n var sizeInit = extremeFunc ? null : 0;\n var binFunc = binFunctions.count;\n var normFunc = normFunctions[norm];\n var isAvg = false;\n var pr2c = function(v) {\n return pa.r2c(v, 0, calendar);\n };\n var rawCounterData;\n if (Lib.isArrayOrTypedArray(trace[counterData]) && func !== \"count\") {\n rawCounterData = trace[counterData];\n isAvg = func === \"avg\";\n binFunc = binFunctions[func];\n }\n i = pr2c(binSpec.start);\n binEnd = pr2c(binSpec.end) + (i - Axes.tickIncrement(i, binSpec.size, false, calendar)) / 1e6;\n while (i < binEnd && pos.length < 1e6) {\n i2 = Axes.tickIncrement(i, binSpec.size, false, calendar);\n pos.push((i + i2) / 2);\n size.push(sizeInit);\n inputPoints.push([]);\n binEdges.push(i);\n if (densityNorm) inc.push(1 / (i2 - i));\n if (isAvg) counts.push(0);\n if (i2 <= i) break;\n i = i2;\n }\n binEdges.push(i);\n if (!nonuniformBins && pa.type === \"date\") {\n bins = {\n start: pr2c(bins.start),\n end: pr2c(bins.end),\n size: bins.size\n };\n }\n if (!gd._fullLayout._roundFnOpts) gd._fullLayout._roundFnOpts = {};\n var groupName = trace[\"_\" + mainData + \"bingroup\"];\n var roundFnOpts = { leftGap: Infinity, rightGap: Infinity };\n if (groupName) {\n if (!gd._fullLayout._roundFnOpts[groupName]) gd._fullLayout._roundFnOpts[groupName] = roundFnOpts;\n roundFnOpts = gd._fullLayout._roundFnOpts[groupName];\n }\n var nMax = size.length;\n var uniqueValsPerBin = true;\n var leftGap = roundFnOpts.leftGap;\n var rightGap = roundFnOpts.rightGap;\n var ptNumber2cdIndex = {};\n for (i = 0; i < pos0.length; i++) {\n var posi = pos0[i];\n n = Lib.findBin(posi, bins);\n if (n >= 0 && n < nMax) {\n total += binFunc(n, i, size, rawCounterData, counts);\n if (uniqueValsPerBin && inputPoints[n].length && posi !== pos0[inputPoints[n][0]]) {\n uniqueValsPerBin = false;\n }\n inputPoints[n].push(i);\n ptNumber2cdIndex[i] = n;\n leftGap = Math.min(leftGap, posi - binEdges[n]);\n rightGap = Math.min(rightGap, binEdges[n + 1] - posi);\n }\n }\n roundFnOpts.leftGap = leftGap;\n roundFnOpts.rightGap = rightGap;\n var roundFn;\n if (!uniqueValsPerBin) {\n roundFn = function(v, isRightEdge) {\n return function() {\n var roundFnOpts2 = gd._fullLayout._roundFnOpts[groupName];\n return getBinSpanLabelRound(\n roundFnOpts2.leftGap,\n roundFnOpts2.rightGap,\n binEdges,\n pa,\n calendar\n )(v, isRightEdge);\n };\n };\n }\n if (isAvg) total = doAvg(size, counts);\n if (normFunc) normFunc(size, total, inc);\n if (cumulativeSpec.enabled) cdf(size, cumulativeSpec.direction, cumulativeSpec.currentbin);\n var seriesLen = Math.min(pos.length, size.length);\n var cd = [];\n var firstNonzero = 0;\n var lastNonzero = seriesLen - 1;\n for (i = 0; i < seriesLen; i++) {\n if (size[i]) {\n firstNonzero = i;\n break;\n }\n }\n for (i = seriesLen - 1; i >= firstNonzero; i--) {\n if (size[i]) {\n lastNonzero = i;\n break;\n }\n }\n for (i = firstNonzero; i <= lastNonzero; i++) {\n if (isNumeric(pos[i]) && isNumeric(size[i])) {\n var cdi = {\n p: pos[i],\n s: size[i],\n b: 0\n };\n if (!cumulativeSpec.enabled) {\n cdi.pts = inputPoints[i];\n if (uniqueValsPerBin) {\n cdi.ph0 = cdi.ph1 = inputPoints[i].length ? pos0[inputPoints[i][0]] : pos[i];\n } else {\n trace._computePh = true;\n cdi.ph0 = roundFn(binEdges[i]);\n cdi.ph1 = roundFn(binEdges[i + 1], true);\n }\n }\n cd.push(cdi);\n }\n }\n if (cd.length === 1) {\n cd[0].width1 = Axes.tickIncrement(cd[0].p, binSpec.size, false, calendar) - cd[0].p;\n }\n arraysToCalcdata(cd, trace);\n if (Lib.isArrayOrTypedArray(trace.selectedpoints)) {\n Lib.tagSelected(cd, trace, ptNumber2cdIndex);\n }\n return cd;\n }\n function calcAllAutoBins(gd, trace, pa, mainData, _overlayEdgeCase) {\n var binAttr = mainData + \"bins\";\n var fullLayout = gd._fullLayout;\n var groupName = trace[\"_\" + mainData + \"bingroup\"];\n var binOpts = fullLayout._histogramBinOpts[groupName];\n var isOverlay = fullLayout.barmode === \"overlay\";\n var i, traces, tracei, calendar, pos0, autoVals, cumulativeSpec;\n var r2c = function(v) {\n return pa.r2c(v, 0, calendar);\n };\n var c2r = function(v) {\n return pa.c2r(v, 0, calendar);\n };\n var cleanBound = pa.type === \"date\" ? function(v) {\n return v || v === 0 ? Lib.cleanDate(v, null, calendar) : null;\n } : function(v) {\n return isNumeric(v) ? Number(v) : null;\n };\n function setBound(attr, bins, newBins) {\n if (bins[attr + \"Found\"]) {\n bins[attr] = cleanBound(bins[attr]);\n if (bins[attr] === null) bins[attr] = newBins[attr];\n } else {\n autoVals[attr] = bins[attr] = newBins[attr];\n Lib.nestedProperty(traces[0], binAttr + \".\" + attr).set(newBins[attr]);\n }\n }\n if (trace[\"_\" + mainData + \"autoBinFinished\"]) {\n delete trace[\"_\" + mainData + \"autoBinFinished\"];\n } else {\n traces = binOpts.traces;\n var allPos = [];\n var isFirstVisible = true;\n var has2dMap = false;\n var hasHist2dContour = false;\n for (i = 0; i < traces.length; i++) {\n tracei = traces[i];\n if (tracei.visible) {\n var mainDatai = binOpts.dirs[i];\n pos0 = tracei[\"_\" + mainDatai + \"pos0\"] = pa.makeCalcdata(tracei, mainDatai);\n allPos = Lib.concat(allPos, pos0);\n delete tracei[\"_\" + mainData + \"autoBinFinished\"];\n if (trace.visible === true) {\n if (isFirstVisible) {\n isFirstVisible = false;\n } else {\n delete tracei._autoBin;\n tracei[\"_\" + mainData + \"autoBinFinished\"] = 1;\n }\n if (Registry.traceIs(tracei, \"2dMap\")) {\n has2dMap = true;\n }\n if (tracei.type === \"histogram2dcontour\") {\n hasHist2dContour = true;\n }\n }\n }\n }\n calendar = traces[0][mainData + \"calendar\"];\n var newBinSpec = Axes.autoBin(allPos, pa, binOpts.nbins, has2dMap, calendar, binOpts.sizeFound && binOpts.size);\n var autoBin = traces[0]._autoBin = {};\n autoVals = autoBin[binOpts.dirs[0]] = {};\n if (hasHist2dContour) {\n if (!binOpts.size) {\n newBinSpec.start = c2r(Axes.tickIncrement(\n r2c(newBinSpec.start),\n newBinSpec.size,\n true,\n calendar\n ));\n }\n if (binOpts.end === void 0) {\n newBinSpec.end = c2r(Axes.tickIncrement(\n r2c(newBinSpec.end),\n newBinSpec.size,\n false,\n calendar\n ));\n }\n }\n if (isOverlay && !Registry.traceIs(trace, \"2dMap\") && newBinSpec._dataSpan === 0 && pa.type !== \"category\" && pa.type !== \"multicategory\" && trace.bingroup === \"\" && typeof trace.xbins === \"undefined\") {\n if (_overlayEdgeCase) return [newBinSpec, pos0, true];\n newBinSpec = handleSingleValueOverlays(gd, trace, pa, mainData, binAttr);\n }\n cumulativeSpec = tracei.cumulative || {};\n if (cumulativeSpec.enabled && cumulativeSpec.currentbin !== \"include\") {\n if (cumulativeSpec.direction === \"decreasing\") {\n newBinSpec.start = c2r(Axes.tickIncrement(\n r2c(newBinSpec.start),\n newBinSpec.size,\n true,\n calendar\n ));\n } else {\n newBinSpec.end = c2r(Axes.tickIncrement(\n r2c(newBinSpec.end),\n newBinSpec.size,\n false,\n calendar\n ));\n }\n }\n binOpts.size = newBinSpec.size;\n if (!binOpts.sizeFound) {\n autoVals.size = newBinSpec.size;\n Lib.nestedProperty(traces[0], binAttr + \".size\").set(newBinSpec.size);\n }\n setBound(\"start\", binOpts, newBinSpec);\n setBound(\"end\", binOpts, newBinSpec);\n }\n pos0 = trace[\"_\" + mainData + \"pos0\"];\n delete trace[\"_\" + mainData + \"pos0\"];\n var traceInputBins = trace._input[binAttr] || {};\n var traceBinOptsCalc = Lib.extendFlat({}, binOpts);\n var mainStart = binOpts.start;\n var startIn = pa.r2l(traceInputBins.start);\n var hasStart = startIn !== void 0;\n if ((binOpts.startFound || hasStart) && startIn !== pa.r2l(mainStart)) {\n var traceStart = hasStart ? startIn : Lib.aggNums(Math.min, null, pos0);\n var dummyAx = {\n type: pa.type === \"category\" || pa.type === \"multicategory\" ? \"linear\" : pa.type,\n r2l: pa.r2l,\n dtick: binOpts.size,\n tick0: mainStart,\n calendar,\n range: [traceStart, Axes.tickIncrement(traceStart, binOpts.size, false, calendar)].map(pa.l2r)\n };\n var newStart = Axes.tickFirst(dummyAx);\n if (newStart > pa.r2l(traceStart)) {\n newStart = Axes.tickIncrement(newStart, binOpts.size, true, calendar);\n }\n traceBinOptsCalc.start = pa.l2r(newStart);\n if (!hasStart) Lib.nestedProperty(trace, binAttr + \".start\").set(traceBinOptsCalc.start);\n }\n var mainEnd = binOpts.end;\n var endIn = pa.r2l(traceInputBins.end);\n var hasEnd = endIn !== void 0;\n if ((binOpts.endFound || hasEnd) && endIn !== pa.r2l(mainEnd)) {\n var traceEnd = hasEnd ? endIn : Lib.aggNums(Math.max, null, pos0);\n traceBinOptsCalc.end = pa.l2r(traceEnd);\n if (!hasEnd) Lib.nestedProperty(trace, binAttr + \".start\").set(traceBinOptsCalc.end);\n }\n var autoBinAttr = \"autobin\" + mainData;\n if (trace._input[autoBinAttr] === false) {\n trace._input[binAttr] = Lib.extendFlat({}, trace[binAttr] || {});\n delete trace._input[autoBinAttr];\n delete trace[autoBinAttr];\n }\n return [traceBinOptsCalc, pos0];\n }\n function handleSingleValueOverlays(gd, trace, pa, mainData, binAttr) {\n var fullLayout = gd._fullLayout;\n var overlaidTraceGroup = getConnectedHistograms(gd, trace);\n var pastThisTrace = false;\n var minSize = Infinity;\n var singleValuedTraces = [trace];\n var i, tracei, binOpts;\n for (i = 0; i < overlaidTraceGroup.length; i++) {\n tracei = overlaidTraceGroup[i];\n if (tracei === trace) {\n pastThisTrace = true;\n } else if (!pastThisTrace) {\n binOpts = fullLayout._histogramBinOpts[tracei[\"_\" + mainData + \"bingroup\"]];\n minSize = Math.min(minSize, binOpts.size || tracei[binAttr].size);\n } else {\n var resulti = calcAllAutoBins(gd, tracei, pa, mainData, true);\n var binSpeci = resulti[0];\n var isSingleValued = resulti[2];\n tracei[\"_\" + mainData + \"autoBinFinished\"] = 1;\n tracei[\"_\" + mainData + \"pos0\"] = resulti[1];\n if (isSingleValued) {\n singleValuedTraces.push(tracei);\n } else {\n minSize = Math.min(minSize, binSpeci.size);\n }\n }\n }\n var dataVals = new Array(singleValuedTraces.length);\n for (i = 0; i < singleValuedTraces.length; i++) {\n var pos0 = singleValuedTraces[i][\"_\" + mainData + \"pos0\"];\n for (var j = 0; j < pos0.length; j++) {\n if (pos0[j] !== void 0) {\n dataVals[i] = pos0[j];\n break;\n }\n }\n }\n if (!isFinite(minSize)) {\n minSize = Lib.distinctVals(dataVals).minDiff;\n }\n for (i = 0; i < singleValuedTraces.length; i++) {\n tracei = singleValuedTraces[i];\n var calendar = tracei[mainData + \"calendar\"];\n var newBins = {\n start: pa.c2r(dataVals[i] - minSize / 2, 0, calendar),\n end: pa.c2r(dataVals[i] + minSize / 2, 0, calendar),\n size: minSize\n };\n tracei._input[binAttr] = tracei[binAttr] = newBins;\n binOpts = fullLayout._histogramBinOpts[tracei[\"_\" + mainData + \"bingroup\"]];\n if (binOpts) Lib.extendFlat(binOpts, newBins);\n }\n return trace[binAttr];\n }\n function getConnectedHistograms(gd, trace) {\n var xid = trace.xaxis;\n var yid = trace.yaxis;\n var orientation = trace.orientation;\n var out = [];\n var fullData = gd._fullData;\n for (var i = 0; i < fullData.length; i++) {\n var tracei = fullData[i];\n if (tracei.type === \"histogram\" && tracei.visible === true && tracei.orientation === orientation && tracei.xaxis === xid && tracei.yaxis === yid) {\n out.push(tracei);\n }\n }\n return out;\n }\n function cdf(size, direction, currentBin) {\n var i, vi, prevSum;\n function firstHalfPoint(i2) {\n prevSum = size[i2];\n size[i2] /= 2;\n }\n function nextHalfPoint(i2) {\n vi = size[i2];\n size[i2] = prevSum + vi / 2;\n prevSum += vi;\n }\n if (currentBin === \"half\") {\n if (direction === \"increasing\") {\n firstHalfPoint(0);\n for (i = 1; i < size.length; i++) {\n nextHalfPoint(i);\n }\n } else {\n firstHalfPoint(size.length - 1);\n for (i = size.length - 2; i >= 0; i--) {\n nextHalfPoint(i);\n }\n }\n } else if (direction === \"increasing\") {\n for (i = 1; i < size.length; i++) {\n size[i] += size[i - 1];\n }\n if (currentBin === \"exclude\") {\n size.unshift(0);\n size.pop();\n }\n } else {\n for (i = size.length - 2; i >= 0; i--) {\n size[i] += size[i + 1];\n }\n if (currentBin === \"exclude\") {\n size.push(0);\n size.shift();\n }\n }\n }\n module.exports = {\n calc,\n calcAllAutoBins\n };\n }\n });\n\n // src/traces/histogram2d/calc.js\n var require_calc8 = __commonJS({\n \"src/traces/histogram2d/calc.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Axes = require_axes();\n var binFunctions = require_bin_functions();\n var normFunctions = require_norm_functions();\n var doAvg = require_average();\n var getBinSpanLabelRound = require_bin_label_vals();\n var calcAllAutoBins = require_calc7().calcAllAutoBins;\n module.exports = function calc(gd, trace) {\n var xa = Axes.getFromId(gd, trace.xaxis);\n var ya = Axes.getFromId(gd, trace.yaxis);\n var xcalendar = trace.xcalendar;\n var ycalendar = trace.ycalendar;\n var xr2c = function(v) {\n return xa.r2c(v, 0, xcalendar);\n };\n var yr2c = function(v) {\n return ya.r2c(v, 0, ycalendar);\n };\n var xc2r = function(v) {\n return xa.c2r(v, 0, xcalendar);\n };\n var yc2r = function(v) {\n return ya.c2r(v, 0, ycalendar);\n };\n var i, j, n, m;\n var xBinsAndPos = calcAllAutoBins(gd, trace, xa, \"x\");\n var xBinSpec = xBinsAndPos[0];\n var xPos0 = xBinsAndPos[1];\n var yBinsAndPos = calcAllAutoBins(gd, trace, ya, \"y\");\n var yBinSpec = yBinsAndPos[0];\n var yPos0 = yBinsAndPos[1];\n var serieslen = trace._length;\n if (xPos0.length > serieslen) xPos0.splice(serieslen, xPos0.length - serieslen);\n if (yPos0.length > serieslen) yPos0.splice(serieslen, yPos0.length - serieslen);\n var z = [];\n var onecol = [];\n var zerocol = [];\n var nonuniformBinsX = typeof xBinSpec.size === \"string\";\n var nonuniformBinsY = typeof yBinSpec.size === \"string\";\n var xEdges = [];\n var yEdges = [];\n var xbins = nonuniformBinsX ? xEdges : xBinSpec;\n var ybins = nonuniformBinsY ? yEdges : yBinSpec;\n var total = 0;\n var counts = [];\n var inputPoints = [];\n var norm = trace.histnorm;\n var func = trace.histfunc;\n var densitynorm = norm.indexOf(\"density\") !== -1;\n var extremefunc = func === \"max\" || func === \"min\";\n var sizeinit = extremefunc ? null : 0;\n var binfunc = binFunctions.count;\n var normfunc = normFunctions[norm];\n var doavg = false;\n var xinc = [];\n var yinc = [];\n var rawCounterData = \"z\" in trace ? trace.z : \"marker\" in trace && Array.isArray(trace.marker.color) ? trace.marker.color : \"\";\n if (rawCounterData && func !== \"count\") {\n doavg = func === \"avg\";\n binfunc = binFunctions[func];\n }\n var xBinSize = xBinSpec.size;\n var xBinStart = xr2c(xBinSpec.start);\n var xBinEnd = xr2c(xBinSpec.end) + (xBinStart - Axes.tickIncrement(xBinStart, xBinSize, false, xcalendar)) / 1e6;\n for (i = xBinStart; i < xBinEnd; i = Axes.tickIncrement(i, xBinSize, false, xcalendar)) {\n onecol.push(sizeinit);\n xEdges.push(i);\n if (doavg) zerocol.push(0);\n }\n xEdges.push(i);\n var nx = onecol.length;\n var dx = (i - xBinStart) / nx;\n var x0 = xc2r(xBinStart + dx / 2);\n var yBinSize = yBinSpec.size;\n var yBinStart = yr2c(yBinSpec.start);\n var yBinEnd = yr2c(yBinSpec.end) + (yBinStart - Axes.tickIncrement(yBinStart, yBinSize, false, ycalendar)) / 1e6;\n for (i = yBinStart; i < yBinEnd; i = Axes.tickIncrement(i, yBinSize, false, ycalendar)) {\n z.push(onecol.slice());\n yEdges.push(i);\n var ipCol = new Array(nx);\n for (j = 0; j < nx; j++) ipCol[j] = [];\n inputPoints.push(ipCol);\n if (doavg) counts.push(zerocol.slice());\n }\n yEdges.push(i);\n var ny = z.length;\n var dy = (i - yBinStart) / ny;\n var y0 = yc2r(yBinStart + dy / 2);\n if (densitynorm) {\n xinc = makeIncrements(onecol.length, xbins, dx, nonuniformBinsX);\n yinc = makeIncrements(z.length, ybins, dy, nonuniformBinsY);\n }\n if (!nonuniformBinsX && xa.type === \"date\") xbins = binsToCalc(xr2c, xbins);\n if (!nonuniformBinsY && ya.type === \"date\") ybins = binsToCalc(yr2c, ybins);\n var uniqueValsPerX = true;\n var uniqueValsPerY = true;\n var xVals = new Array(nx);\n var yVals = new Array(ny);\n var xGapLow = Infinity;\n var xGapHigh = Infinity;\n var yGapLow = Infinity;\n var yGapHigh = Infinity;\n for (i = 0; i < serieslen; i++) {\n var xi = xPos0[i];\n var yi = yPos0[i];\n n = Lib.findBin(xi, xbins);\n m = Lib.findBin(yi, ybins);\n if (n >= 0 && n < nx && m >= 0 && m < ny) {\n total += binfunc(n, i, z[m], rawCounterData, counts[m]);\n inputPoints[m][n].push(i);\n if (uniqueValsPerX) {\n if (xVals[n] === void 0) xVals[n] = xi;\n else if (xVals[n] !== xi) uniqueValsPerX = false;\n }\n if (uniqueValsPerY) {\n if (yVals[m] === void 0) yVals[m] = yi;\n else if (yVals[m] !== yi) uniqueValsPerY = false;\n }\n xGapLow = Math.min(xGapLow, xi - xEdges[n]);\n xGapHigh = Math.min(xGapHigh, xEdges[n + 1] - xi);\n yGapLow = Math.min(yGapLow, yi - yEdges[m]);\n yGapHigh = Math.min(yGapHigh, yEdges[m + 1] - yi);\n }\n }\n if (doavg) {\n for (m = 0; m < ny; m++) total += doAvg(z[m], counts[m]);\n }\n if (normfunc) {\n for (m = 0; m < ny; m++) normfunc(z[m], total, xinc, yinc[m]);\n }\n return {\n x: xPos0,\n xRanges: getRanges(xEdges, uniqueValsPerX && xVals, xGapLow, xGapHigh, xa, xcalendar),\n x0,\n dx,\n y: yPos0,\n yRanges: getRanges(yEdges, uniqueValsPerY && yVals, yGapLow, yGapHigh, ya, ycalendar),\n y0,\n dy,\n z,\n pts: inputPoints\n };\n };\n function makeIncrements(len, bins, dv, nonuniform) {\n var out = new Array(len);\n var i;\n if (nonuniform) {\n for (i = 0; i < len; i++) out[i] = 1 / (bins[i + 1] - bins[i]);\n } else {\n var inc = 1 / dv;\n for (i = 0; i < len; i++) out[i] = inc;\n }\n return out;\n }\n function binsToCalc(r2c, bins) {\n return {\n start: r2c(bins.start),\n end: r2c(bins.end),\n size: bins.size\n };\n }\n function getRanges(edges, uniqueVals, gapLow, gapHigh, ax, calendar) {\n var i;\n var len = edges.length - 1;\n var out = new Array(len);\n var roundFn = getBinSpanLabelRound(gapLow, gapHigh, edges, ax, calendar);\n for (i = 0; i < len; i++) {\n var v = (uniqueVals || [])[i];\n out[i] = v === void 0 ? [roundFn(edges[i]), roundFn(edges[i + 1], true)] : [v, v];\n }\n return out;\n }\n }\n });\n\n // src/traces/heatmap/convert_column_xyz.js\n var require_convert_column_xyz = __commonJS({\n \"src/traces/heatmap/convert_column_xyz.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var BADNUM = require_numerical().BADNUM;\n var alignPeriod = require_align_period();\n module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, arrayVarNames) {\n var colLen = trace._length;\n var col1 = ax1.makeCalcdata(trace, var1Name);\n var col2 = ax2.makeCalcdata(trace, var2Name);\n col1 = alignPeriod(trace, ax1, var1Name, col1).vals;\n col2 = alignPeriod(trace, ax2, var2Name, col2).vals;\n var textCol = trace.text;\n var hasColumnText = textCol !== void 0 && Lib.isArray1D(textCol);\n var hoverTextCol = trace.hovertext;\n var hasColumnHoverText = hoverTextCol !== void 0 && Lib.isArray1D(hoverTextCol);\n var i, j;\n var col1dv = Lib.distinctVals(col1);\n var col1vals = col1dv.vals;\n var col2dv = Lib.distinctVals(col2);\n var col2vals = col2dv.vals;\n var newArrays = [];\n var text;\n var hovertext;\n var nI = col2vals.length;\n var nJ = col1vals.length;\n for (i = 0; i < arrayVarNames.length; i++) {\n newArrays[i] = Lib.init2dArray(nI, nJ);\n }\n if (hasColumnText) {\n text = Lib.init2dArray(nI, nJ);\n }\n if (hasColumnHoverText) {\n hovertext = Lib.init2dArray(nI, nJ);\n }\n var after2before = Lib.init2dArray(nI, nJ);\n for (i = 0; i < colLen; i++) {\n if (col1[i] !== BADNUM && col2[i] !== BADNUM) {\n var i1 = Lib.findBin(col1[i] + col1dv.minDiff / 2, col1vals);\n var i2 = Lib.findBin(col2[i] + col2dv.minDiff / 2, col2vals);\n for (j = 0; j < arrayVarNames.length; j++) {\n var arrayVarName = arrayVarNames[j];\n var arrayVar = trace[arrayVarName];\n var newArray = newArrays[j];\n newArray[i2][i1] = arrayVar[i];\n after2before[i2][i1] = i;\n }\n if (hasColumnText) text[i2][i1] = textCol[i];\n if (hasColumnHoverText) hovertext[i2][i1] = hoverTextCol[i];\n }\n }\n trace[\"_\" + var1Name] = col1vals;\n trace[\"_\" + var2Name] = col2vals;\n for (j = 0; j < arrayVarNames.length; j++) {\n trace[\"_\" + arrayVarNames[j]] = newArrays[j];\n }\n if (hasColumnText) trace._text = text;\n if (hasColumnHoverText) trace._hovertext = hovertext;\n if (ax1 && ax1.type === \"category\") {\n trace[\"_\" + var1Name + \"CategoryMap\"] = col1vals.map(function(v) {\n return ax1._categories[v];\n });\n }\n if (ax2 && ax2.type === \"category\") {\n trace[\"_\" + var2Name + \"CategoryMap\"] = col2vals.map(function(v) {\n return ax2._categories[v];\n });\n }\n trace._after2before = after2before;\n };\n }\n });\n\n // src/traces/heatmap/clean_2d_array.js\n var require_clean_2d_array = __commonJS({\n \"src/traces/heatmap/clean_2d_array.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var BADNUM = require_numerical().BADNUM;\n module.exports = function clean2dArray(zOld, trace, xa, ya) {\n var rowlen, collen, getCollen, old2new, i, j;\n function cleanZvalue(v) {\n if (!isNumeric(v)) return void 0;\n return +v;\n }\n if (trace && trace.transpose) {\n rowlen = 0;\n for (i = 0; i < zOld.length; i++) rowlen = Math.max(rowlen, zOld[i].length);\n if (rowlen === 0) return false;\n getCollen = function(zOld2) {\n return zOld2.length;\n };\n old2new = function(zOld2, i2, j2) {\n return (zOld2[j2] || [])[i2];\n };\n } else {\n rowlen = zOld.length;\n getCollen = function(zOld2, i2) {\n return zOld2[i2].length;\n };\n old2new = function(zOld2, i2, j2) {\n return (zOld2[i2] || [])[j2];\n };\n }\n var padOld2new = function(zOld2, i2, j2) {\n if (i2 === BADNUM || j2 === BADNUM) return BADNUM;\n return old2new(zOld2, i2, j2);\n };\n function axisMapping(ax) {\n if (trace && trace.type !== \"carpet\" && trace.type !== \"contourcarpet\" && ax && ax.type === \"category\" && trace[\"_\" + ax._id.charAt(0)].length) {\n var axLetter = ax._id.charAt(0);\n var axMapping = {};\n var traceCategories = trace[\"_\" + axLetter + \"CategoryMap\"] || trace[axLetter];\n for (i = 0; i < traceCategories.length; i++) {\n axMapping[traceCategories[i]] = i;\n }\n return function(i2) {\n var ind = axMapping[ax._categories[i2]];\n return ind + 1 ? ind : BADNUM;\n };\n } else {\n return Lib.identity;\n }\n }\n var xMap = axisMapping(xa);\n var yMap = axisMapping(ya);\n if (ya && ya.type === \"category\") rowlen = ya._categories.length;\n var zNew = new Array(rowlen);\n for (i = 0; i < rowlen; i++) {\n if (xa && xa.type === \"category\") {\n collen = xa._categories.length;\n } else {\n collen = getCollen(zOld, i);\n }\n zNew[i] = new Array(collen);\n for (j = 0; j < collen; j++) zNew[i][j] = cleanZvalue(padOld2new(zOld, yMap(i), xMap(j)));\n }\n return zNew;\n };\n }\n });\n\n // src/traces/heatmap/interp2d.js\n var require_interp2d = __commonJS({\n \"src/traces/heatmap/interp2d.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var INTERPTHRESHOLD = 0.01;\n var NEIGHBORSHIFTS = [[-1, 0], [1, 0], [0, -1], [0, 1]];\n function correctionOvershoot(maxFractionalChange) {\n return 0.5 - 0.25 * Math.min(1, maxFractionalChange * 0.5);\n }\n module.exports = function interp2d(z, emptyPoints) {\n var maxFractionalChange = 1;\n var i;\n iterateInterp2d(z, emptyPoints);\n for (i = 0; i < emptyPoints.length; i++) {\n if (emptyPoints[i][2] < 4) break;\n }\n emptyPoints = emptyPoints.slice(i);\n for (i = 0; i < 100 && maxFractionalChange > INTERPTHRESHOLD; i++) {\n maxFractionalChange = iterateInterp2d(\n z,\n emptyPoints,\n correctionOvershoot(maxFractionalChange)\n );\n }\n if (maxFractionalChange > INTERPTHRESHOLD) {\n Lib.log(\"interp2d didn't converge quickly\", maxFractionalChange);\n }\n return z;\n };\n function iterateInterp2d(z, emptyPoints, overshoot) {\n var maxFractionalChange = 0;\n var thisPt;\n var i;\n var j;\n var p;\n var q;\n var neighborShift;\n var neighborRow;\n var neighborVal;\n var neighborCount;\n var neighborSum;\n var initialVal;\n var minNeighbor;\n var maxNeighbor;\n for (p = 0; p < emptyPoints.length; p++) {\n thisPt = emptyPoints[p];\n i = thisPt[0];\n j = thisPt[1];\n initialVal = z[i][j];\n neighborSum = 0;\n neighborCount = 0;\n for (q = 0; q < 4; q++) {\n neighborShift = NEIGHBORSHIFTS[q];\n neighborRow = z[i + neighborShift[0]];\n if (!neighborRow) continue;\n neighborVal = neighborRow[j + neighborShift[1]];\n if (neighborVal !== void 0) {\n if (neighborSum === 0) {\n minNeighbor = maxNeighbor = neighborVal;\n } else {\n minNeighbor = Math.min(minNeighbor, neighborVal);\n maxNeighbor = Math.max(maxNeighbor, neighborVal);\n }\n neighborCount++;\n neighborSum += neighborVal;\n }\n }\n if (neighborCount === 0) {\n throw \"iterateInterp2d order is wrong: no defined neighbors\";\n }\n z[i][j] = neighborSum / neighborCount;\n if (initialVal === void 0) {\n if (neighborCount < 4) maxFractionalChange = 1;\n } else {\n z[i][j] = (1 + overshoot) * z[i][j] - overshoot * initialVal;\n if (maxNeighbor > minNeighbor) {\n maxFractionalChange = Math.max(\n maxFractionalChange,\n Math.abs(z[i][j] - initialVal) / (maxNeighbor - minNeighbor)\n );\n }\n }\n }\n return maxFractionalChange;\n }\n }\n });\n\n // src/traces/heatmap/find_empties.js\n var require_find_empties = __commonJS({\n \"src/traces/heatmap/find_empties.js\"(exports, module) {\n \"use strict\";\n var maxRowLength = require_lib().maxRowLength;\n module.exports = function findEmpties(z) {\n var empties = [];\n var neighborHash = {};\n var noNeighborList = [];\n var nextRow = z[0];\n var row = [];\n var blank = [0, 0, 0];\n var rowLength = maxRowLength(z);\n var prevRow;\n var i;\n var j;\n var thisPt;\n var p;\n var neighborCount;\n var newNeighborHash;\n var foundNewNeighbors;\n for (i = 0; i < z.length; i++) {\n prevRow = row;\n row = nextRow;\n nextRow = z[i + 1] || [];\n for (j = 0; j < rowLength; j++) {\n if (row[j] === void 0) {\n neighborCount = (row[j - 1] !== void 0 ? 1 : 0) + (row[j + 1] !== void 0 ? 1 : 0) + (prevRow[j] !== void 0 ? 1 : 0) + (nextRow[j] !== void 0 ? 1 : 0);\n if (neighborCount) {\n if (i === 0) neighborCount++;\n if (j === 0) neighborCount++;\n if (i === z.length - 1) neighborCount++;\n if (j === row.length - 1) neighborCount++;\n if (neighborCount < 4) {\n neighborHash[[i, j]] = [i, j, neighborCount];\n }\n empties.push([i, j, neighborCount]);\n } else noNeighborList.push([i, j]);\n }\n }\n }\n while (noNeighborList.length) {\n newNeighborHash = {};\n foundNewNeighbors = false;\n for (p = noNeighborList.length - 1; p >= 0; p--) {\n thisPt = noNeighborList[p];\n i = thisPt[0];\n j = thisPt[1];\n neighborCount = ((neighborHash[[i - 1, j]] || blank)[2] + (neighborHash[[i + 1, j]] || blank)[2] + (neighborHash[[i, j - 1]] || blank)[2] + (neighborHash[[i, j + 1]] || blank)[2]) / 20;\n if (neighborCount) {\n newNeighborHash[thisPt] = [i, j, neighborCount];\n noNeighborList.splice(p, 1);\n foundNewNeighbors = true;\n }\n }\n if (!foundNewNeighbors) {\n throw \"findEmpties iterated with no new neighbors\";\n }\n for (thisPt in newNeighborHash) {\n neighborHash[thisPt] = newNeighborHash[thisPt];\n empties.push(newNeighborHash[thisPt]);\n }\n }\n return empties.sort(function(a, b) {\n return b[2] - a[2];\n });\n };\n }\n });\n\n // src/traces/heatmap/make_bound_array.js\n var require_make_bound_array = __commonJS({\n \"src/traces/heatmap/make_bound_array.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n module.exports = function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, ax) {\n var arrayOut = [];\n var isContour = Registry.traceIs(trace, \"contour\");\n var isHist = Registry.traceIs(trace, \"histogram\");\n var v0;\n var dv;\n var i;\n var isArrayOfTwoItemsOrMore = isArrayOrTypedArray(arrayIn) && arrayIn.length > 1;\n if (isArrayOfTwoItemsOrMore && !isHist && ax.type !== \"category\") {\n var len = arrayIn.length;\n if (len <= numbricks) {\n if (isContour) arrayOut = Array.from(arrayIn).slice(0, numbricks);\n else if (numbricks === 1) {\n if (ax.type === \"log\") {\n arrayOut = [0.5 * arrayIn[0], 2 * arrayIn[0]];\n } else {\n arrayOut = [arrayIn[0] - 0.5, arrayIn[0] + 0.5];\n }\n } else if (ax.type === \"log\") {\n arrayOut = [Math.pow(arrayIn[0], 1.5) / Math.pow(arrayIn[1], 0.5)];\n for (i = 1; i < len; i++) {\n arrayOut.push(Math.sqrt(arrayIn[i - 1] * arrayIn[i]));\n }\n arrayOut.push(Math.pow(arrayIn[len - 1], 1.5) / Math.pow(arrayIn[len - 2], 0.5));\n } else {\n arrayOut = [1.5 * arrayIn[0] - 0.5 * arrayIn[1]];\n for (i = 1; i < len; i++) {\n arrayOut.push((arrayIn[i - 1] + arrayIn[i]) * 0.5);\n }\n arrayOut.push(1.5 * arrayIn[len - 1] - 0.5 * arrayIn[len - 2]);\n }\n if (len < numbricks) {\n var lastPt = arrayOut[arrayOut.length - 1];\n var delta;\n if (ax.type === \"log\") {\n delta = lastPt / arrayOut[arrayOut.length - 2];\n for (i = len; i < numbricks; i++) {\n lastPt *= delta;\n arrayOut.push(lastPt);\n }\n } else {\n delta = lastPt - arrayOut[arrayOut.length - 2];\n for (i = len; i < numbricks; i++) {\n lastPt += delta;\n arrayOut.push(lastPt);\n }\n }\n }\n } else {\n return isContour ? arrayIn.slice(0, numbricks) : (\n // we must be strict for contours\n arrayIn.slice(0, numbricks + 1)\n );\n }\n } else {\n var calendar = trace[ax._id.charAt(0) + \"calendar\"];\n if (isHist) {\n v0 = ax.r2c(v0In, 0, calendar);\n } else {\n if (isArrayOrTypedArray(arrayIn) && arrayIn.length === 1) {\n v0 = arrayIn[0];\n } else if (v0In === void 0) {\n v0 = 0;\n } else {\n var fn = ax.type === \"log\" ? ax.d2c : ax.r2c;\n v0 = fn(v0In, 0, calendar);\n }\n }\n dv = dvIn || 1;\n for (i = isContour ? 0 : -0.5; i < numbricks; i++) {\n arrayOut.push(v0 + dv * i);\n }\n }\n return arrayOut;\n };\n }\n });\n\n // src/traces/heatmap/calc.js\n var require_calc9 = __commonJS({\n \"src/traces/heatmap/calc.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var Lib = require_lib();\n var Axes = require_axes();\n var alignPeriod = require_align_period();\n var histogram2dCalc = require_calc8();\n var colorscaleCalc = require_calc();\n var convertColumnData = require_convert_column_xyz();\n var clean2dArray = require_clean_2d_array();\n var interp2d = require_interp2d();\n var findEmpties = require_find_empties();\n var makeBoundArray = require_make_bound_array();\n var BADNUM = require_numerical().BADNUM;\n module.exports = function calc(gd, trace) {\n var xa = Axes.getFromId(gd, trace.xaxis || \"x\");\n var ya = Axes.getFromId(gd, trace.yaxis || \"y\");\n var isContour = Registry.traceIs(trace, \"contour\");\n var isHist = Registry.traceIs(trace, \"histogram\");\n var zsmooth = isContour ? \"best\" : trace.zsmooth;\n var x, x0, dx, origX;\n var y, y0, dy, origY;\n var z, i, binned;\n xa._minDtick = 0;\n ya._minDtick = 0;\n if (isHist) {\n binned = histogram2dCalc(gd, trace);\n origX = binned.orig_x;\n x = binned.x;\n x0 = binned.x0;\n dx = binned.dx;\n origY = binned.orig_y;\n y = binned.y;\n y0 = binned.y0;\n dy = binned.dy;\n z = binned.z;\n } else {\n var zIn = trace.z;\n if (Lib.isArray1D(zIn)) {\n convertColumnData(trace, xa, ya, \"x\", \"y\", [\"z\"]);\n x = trace._x;\n y = trace._y;\n zIn = trace._z;\n } else {\n origX = trace.x ? xa.makeCalcdata(trace, \"x\") : [];\n origY = trace.y ? ya.makeCalcdata(trace, \"y\") : [];\n x = alignPeriod(trace, xa, \"x\", origX).vals;\n y = alignPeriod(trace, ya, \"y\", origY).vals;\n trace._x = x;\n trace._y = y;\n }\n x0 = trace.x0;\n dx = trace.dx;\n y0 = trace.y0;\n dy = trace.dy;\n z = clean2dArray(zIn, trace, xa, ya);\n }\n if (xa.rangebreaks || ya.rangebreaks) {\n z = dropZonBreaks(x, y, z);\n if (!isHist) {\n x = skipBreaks(x);\n y = skipBreaks(y);\n trace._x = x;\n trace._y = y;\n }\n }\n if (!isHist && (isContour || trace.connectgaps)) {\n trace._emptypoints = findEmpties(z);\n interp2d(z, trace._emptypoints);\n }\n function noZsmooth(msg) {\n zsmooth = trace._input.zsmooth = trace.zsmooth = false;\n Lib.warn('cannot use zsmooth: \"fast\": ' + msg);\n }\n function scaleIsLinear(s) {\n if (s.length > 1) {\n var avgdx = (s[s.length - 1] - s[0]) / (s.length - 1);\n var maxErrX = Math.abs(avgdx / 100);\n for (i = 0; i < s.length - 1; i++) {\n if (Math.abs(s[i + 1] - s[i] - avgdx) > maxErrX) {\n return false;\n }\n }\n }\n return true;\n }\n trace._islinear = false;\n if (xa.type === \"log\" || ya.type === \"log\") {\n if (zsmooth === \"fast\") {\n noZsmooth(\"log axis found\");\n }\n } else if (!scaleIsLinear(x)) {\n if (zsmooth === \"fast\") noZsmooth(\"x scale is not linear\");\n } else if (!scaleIsLinear(y)) {\n if (zsmooth === \"fast\") noZsmooth(\"y scale is not linear\");\n } else {\n trace._islinear = true;\n }\n var xlen = Lib.maxRowLength(z);\n var xIn = trace.xtype === \"scaled\" ? \"\" : x;\n var xArray = makeBoundArray(trace, xIn, x0, dx, xlen, xa);\n var yIn = trace.ytype === \"scaled\" ? \"\" : y;\n var yArray = makeBoundArray(trace, yIn, y0, dy, z.length, ya);\n trace._extremes[xa._id] = Axes.findExtremes(xa, xArray);\n trace._extremes[ya._id] = Axes.findExtremes(ya, yArray);\n var cd0 = {\n x: xArray,\n y: yArray,\n z,\n text: trace._text || trace.text,\n hovertext: trace._hovertext || trace.hovertext\n };\n if (trace.xperiodalignment && origX) {\n cd0.orig_x = origX;\n }\n if (trace.yperiodalignment && origY) {\n cd0.orig_y = origY;\n }\n if (xIn && xIn.length === xArray.length - 1) cd0.xCenter = xIn;\n if (yIn && yIn.length === yArray.length - 1) cd0.yCenter = yIn;\n if (isHist) {\n cd0.xRanges = binned.xRanges;\n cd0.yRanges = binned.yRanges;\n cd0.pts = binned.pts;\n }\n if (!isContour) {\n colorscaleCalc(gd, trace, { vals: z, cLetter: \"z\" });\n }\n if (isContour && trace.contours && trace.contours.coloring === \"heatmap\") {\n var dummyTrace = {\n type: trace.type === \"contour\" ? \"heatmap\" : \"histogram2d\",\n xcalendar: trace.xcalendar,\n ycalendar: trace.ycalendar\n };\n cd0.xfill = makeBoundArray(dummyTrace, xIn, x0, dx, xlen, xa);\n cd0.yfill = makeBoundArray(dummyTrace, yIn, y0, dy, z.length, ya);\n }\n return [cd0];\n };\n function skipBreaks(a) {\n var b = [];\n var len = a.length;\n for (var i = 0; i < len; i++) {\n var v = a[i];\n if (v !== BADNUM) b.push(v);\n }\n return b;\n }\n function dropZonBreaks(x, y, z) {\n var newZ = [];\n var k = -1;\n for (var i = 0; i < z.length; i++) {\n if (y[i] === BADNUM) continue;\n k++;\n newZ[k] = [];\n for (var j = 0; j < z[i].length; j++) {\n if (x[j] === BADNUM) continue;\n newZ[k].push(z[i][j]);\n }\n }\n return newZ;\n }\n }\n });\n\n // src/constants/pixelated_image.js\n var require_pixelated_image = __commonJS({\n \"src/constants/pixelated_image.js\"(exports) {\n \"use strict\";\n exports.CSS_DECLARATIONS = [\n [\"image-rendering\", \"optimizeSpeed\"],\n [\"image-rendering\", \"-moz-crisp-edges\"],\n [\"image-rendering\", \"-o-crisp-edges\"],\n [\"image-rendering\", \"-webkit-optimize-contrast\"],\n [\"image-rendering\", \"optimize-contrast\"],\n [\"image-rendering\", \"crisp-edges\"],\n [\"image-rendering\", \"pixelated\"]\n ];\n exports.STYLE = exports.CSS_DECLARATIONS.map(function(d) {\n return d.join(\": \") + \"; \";\n }).join(\"\");\n }\n });\n\n // src/lib/supports_pixelated_image.js\n var require_supports_pixelated_image = __commonJS({\n \"src/lib/supports_pixelated_image.js\"(exports, module) {\n \"use strict\";\n var constants = require_pixelated_image();\n var Drawing = require_drawing();\n var Lib = require_lib();\n var _supportsPixelated = null;\n function supportsPixelatedImage() {\n if (_supportsPixelated !== null) {\n return _supportsPixelated;\n }\n _supportsPixelated = false;\n var unsupportedBrowser = Lib.isSafari() || Lib.isIOS();\n if (window.navigator.userAgent && !unsupportedBrowser) {\n var declarations = Array.from(constants.CSS_DECLARATIONS).reverse();\n var supports = window.CSS && window.CSS.supports || window.supportsCSS;\n if (typeof supports === \"function\") {\n _supportsPixelated = declarations.some(function(d) {\n return supports.apply(null, d);\n });\n } else {\n var image3 = Drawing.tester.append(\"image\").attr(\"style\", constants.STYLE);\n var cStyles = window.getComputedStyle(image3.node());\n var imageRendering = cStyles.imageRendering;\n _supportsPixelated = declarations.some(function(d) {\n var value = d[1];\n return imageRendering === value || imageRendering === value.toLowerCase();\n });\n image3.remove();\n }\n }\n return _supportsPixelated;\n }\n module.exports = supportsPixelatedImage;\n }\n });\n\n // src/traces/heatmap/plot.js\n var require_plot5 = __commonJS({\n \"src/traces/heatmap/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var tinycolor = require_tinycolor();\n var Registry = require_registry();\n var Drawing = require_drawing();\n var Axes = require_axes();\n var Lib = require_lib();\n var svgTextUtils = require_svg_text_utils();\n var formatLabels = require_format_labels();\n var Color2 = require_color();\n var extractOpts = require_colorscale().extractOpts;\n var makeColorScaleFuncFromTrace = require_colorscale().makeColorScaleFuncFromTrace;\n var xmlnsNamespaces = require_xmlns_namespaces();\n var alignmentConstants = require_alignment();\n var LINE_SPACING = alignmentConstants.LINE_SPACING;\n var supportsPixelatedImage = require_supports_pixelated_image();\n var PIXELATED_IMAGE_STYLE = require_pixelated_image().STYLE;\n var labelClass = \"heatmap-label\";\n function selectLabels(plotGroup) {\n return plotGroup.selectAll(\"g.\" + labelClass);\n }\n function removeLabels(plotGroup) {\n selectLabels(plotGroup).remove();\n }\n module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n Lib.makeTraceGroups(heatmapLayer, cdheatmaps, \"hm\").each(function(cd) {\n var plotGroup = d3.select(this);\n var cd0 = cd[0];\n var trace = cd0.trace;\n var xGap = trace.xgap || 0;\n var yGap = trace.ygap || 0;\n var z = cd0.z;\n var x = cd0.x;\n var y = cd0.y;\n var xc = cd0.xCenter;\n var yc = cd0.yCenter;\n var isContour = Registry.traceIs(trace, \"contour\");\n var zsmooth = isContour ? \"best\" : trace.zsmooth;\n var m = z.length;\n var n = Lib.maxRowLength(z);\n var xrev = false;\n var yrev = false;\n var left, right, temp, top, bottom, i, j, k;\n i = 0;\n while (left === void 0 && i < x.length - 1) {\n left = xa.c2p(x[i]);\n i++;\n }\n i = x.length - 1;\n while (right === void 0 && i > 0) {\n right = xa.c2p(x[i]);\n i--;\n }\n if (right < left) {\n temp = right;\n right = left;\n left = temp;\n xrev = true;\n }\n i = 0;\n while (top === void 0 && i < y.length - 1) {\n top = ya.c2p(y[i]);\n i++;\n }\n i = y.length - 1;\n while (bottom === void 0 && i > 0) {\n bottom = ya.c2p(y[i]);\n i--;\n }\n if (bottom < top) {\n temp = top;\n top = bottom;\n bottom = temp;\n yrev = true;\n }\n if (isContour) {\n xc = x;\n yc = y;\n x = cd0.xfill;\n y = cd0.yfill;\n }\n var drawingMethod = \"default\";\n if (zsmooth) {\n drawingMethod = zsmooth === \"best\" ? \"smooth\" : \"fast\";\n } else if (trace._islinear && xGap === 0 && yGap === 0 && supportsPixelatedImage()) {\n drawingMethod = \"fast\";\n }\n if (drawingMethod !== \"fast\") {\n var extra = zsmooth === \"best\" ? 0 : 0.5;\n left = Math.max(-extra * xa._length, left);\n right = Math.min((1 + extra) * xa._length, right);\n top = Math.max(-extra * ya._length, top);\n bottom = Math.min((1 + extra) * ya._length, bottom);\n }\n var imageWidth = Math.round(right - left);\n var imageHeight = Math.round(bottom - top);\n var isOffScreen = left >= xa._length || right <= 0 || top >= ya._length || bottom <= 0;\n if (isOffScreen) {\n var noImage = plotGroup.selectAll(\"image\").data([]);\n noImage.exit().remove();\n removeLabels(plotGroup);\n return;\n }\n var canvasW, canvasH;\n if (drawingMethod === \"fast\") {\n canvasW = n;\n canvasH = m;\n } else {\n canvasW = imageWidth;\n canvasH = imageHeight;\n }\n var canvas = document.createElement(\"canvas\");\n canvas.width = canvasW;\n canvas.height = canvasH;\n var context = canvas.getContext(\"2d\", { willReadFrequently: true });\n var sclFunc = makeColorScaleFuncFromTrace(trace, { noNumericCheck: true, returnArray: true });\n var xpx, ypx;\n if (drawingMethod === \"fast\") {\n xpx = xrev ? function(index) {\n return n - 1 - index;\n } : Lib.identity;\n ypx = yrev ? function(index) {\n return m - 1 - index;\n } : Lib.identity;\n } else {\n xpx = function(index) {\n return Lib.constrain(\n Math.round(xa.c2p(x[index]) - left),\n 0,\n imageWidth\n );\n };\n ypx = function(index) {\n return Lib.constrain(\n Math.round(ya.c2p(y[index]) - top),\n 0,\n imageHeight\n );\n };\n }\n var yi = ypx(0);\n var yb = [yi, yi];\n var xbi = xrev ? 0 : 1;\n var ybi = yrev ? 0 : 1;\n var pixcount = 0;\n var rcount = 0;\n var gcount = 0;\n var bcount = 0;\n var xb, xi, v, row, c;\n function setColor(v2, pixsize) {\n if (v2 !== void 0) {\n var c2 = sclFunc(v2);\n c2[0] = Math.round(c2[0]);\n c2[1] = Math.round(c2[1]);\n c2[2] = Math.round(c2[2]);\n pixcount += pixsize;\n rcount += c2[0] * pixsize;\n gcount += c2[1] * pixsize;\n bcount += c2[2] * pixsize;\n return c2;\n }\n return [0, 0, 0, 0];\n }\n function interpColor(r02, r12, xinterp, yinterp2) {\n var z00 = r02[xinterp.bin0];\n if (z00 === void 0) return setColor(void 0, 1);\n var z01 = r02[xinterp.bin1];\n var z10 = r12[xinterp.bin0];\n var z11 = r12[xinterp.bin1];\n var dx2 = z01 - z00 || 0;\n var dy2 = z10 - z00 || 0;\n var dxy;\n if (z01 === void 0) {\n if (z11 === void 0) dxy = 0;\n else if (z10 === void 0) dxy = 2 * (z11 - z00);\n else dxy = (2 * z11 - z10 - z00) * 2 / 3;\n } else if (z11 === void 0) {\n if (z10 === void 0) dxy = 0;\n else dxy = (2 * z00 - z01 - z10) * 2 / 3;\n } else if (z10 === void 0) dxy = (2 * z11 - z01 - z00) * 2 / 3;\n else dxy = z11 + z00 - z01 - z10;\n return setColor(z00 + xinterp.frac * dx2 + yinterp2.frac * (dy2 + xinterp.frac * dxy));\n }\n if (drawingMethod !== \"default\") {\n var pxIndex = 0;\n var pixels;\n try {\n pixels = new Uint8Array(canvasW * canvasH * 4);\n } catch (e) {\n pixels = new Array(canvasW * canvasH * 4);\n }\n if (drawingMethod === \"smooth\") {\n var xForPx = xc || x;\n var yForPx = yc || y;\n var xPixArray = new Array(xForPx.length);\n var yPixArray = new Array(yForPx.length);\n var xinterpArray = new Array(imageWidth);\n var findInterpX = xc ? findInterpFromCenters : findInterp;\n var findInterpY = yc ? findInterpFromCenters : findInterp;\n var yinterp, r0, r1;\n for (i = 0; i < xForPx.length; i++) xPixArray[i] = Math.round(xa.c2p(xForPx[i]) - left);\n for (i = 0; i < yForPx.length; i++) yPixArray[i] = Math.round(ya.c2p(yForPx[i]) - top);\n for (i = 0; i < imageWidth; i++) xinterpArray[i] = findInterpX(i, xPixArray);\n for (j = 0; j < imageHeight; j++) {\n yinterp = findInterpY(j, yPixArray);\n r0 = z[yinterp.bin0];\n r1 = z[yinterp.bin1];\n for (i = 0; i < imageWidth; i++, pxIndex += 4) {\n c = interpColor(r0, r1, xinterpArray[i], yinterp);\n putColor(pixels, pxIndex, c);\n }\n }\n } else {\n for (j = 0; j < m; j++) {\n row = z[j];\n yb = ypx(j);\n for (i = 0; i < n; i++) {\n c = setColor(row[i], 1);\n pxIndex = (yb * n + xpx(i)) * 4;\n putColor(pixels, pxIndex, c);\n }\n }\n }\n var imageData = context.createImageData(canvasW, canvasH);\n try {\n imageData.data.set(pixels);\n } catch (e) {\n var pxArray = imageData.data;\n var dlen = pxArray.length;\n for (j = 0; j < dlen; j++) {\n pxArray[j] = pixels[j];\n }\n }\n context.putImageData(imageData, 0, 0);\n } else {\n var xGapLeft = Math.floor(xGap / 2);\n var yGapTop = Math.floor(yGap / 2);\n for (j = 0; j < m; j++) {\n row = z[j];\n yb.reverse();\n yb[ybi] = ypx(j + 1);\n if (yb[0] === yb[1] || yb[0] === void 0 || yb[1] === void 0) {\n continue;\n }\n xi = xpx(0);\n xb = [xi, xi];\n for (i = 0; i < n; i++) {\n xb.reverse();\n xb[xbi] = xpx(i + 1);\n if (xb[0] === xb[1] || xb[0] === void 0 || xb[1] === void 0) {\n continue;\n }\n v = row[i];\n c = setColor(v, (xb[1] - xb[0]) * (yb[1] - yb[0]));\n context.fillStyle = \"rgba(\" + c.join(\",\") + \")\";\n context.fillRect(\n xb[0] + xGapLeft,\n yb[0] + yGapTop,\n xb[1] - xb[0] - xGap,\n yb[1] - yb[0] - yGap\n );\n }\n }\n }\n rcount = Math.round(rcount / pixcount);\n gcount = Math.round(gcount / pixcount);\n bcount = Math.round(bcount / pixcount);\n var avgColor = tinycolor(\"rgb(\" + rcount + \",\" + gcount + \",\" + bcount + \")\");\n gd._hmpixcount = (gd._hmpixcount || 0) + pixcount;\n gd._hmlumcount = (gd._hmlumcount || 0) + pixcount * avgColor.getLuminance();\n var image3 = plotGroup.selectAll(\"image\").data(cd);\n image3.enter().append(\"svg:image\").attr({\n xmlns: xmlnsNamespaces.svg,\n preserveAspectRatio: \"none\"\n });\n image3.attr({\n height: imageHeight,\n width: imageWidth,\n x: left,\n y: top,\n \"xlink:href\": canvas.toDataURL(\"image/png\")\n });\n if (drawingMethod === \"fast\" && !zsmooth) {\n image3.attr(\"style\", PIXELATED_IMAGE_STYLE);\n }\n removeLabels(plotGroup);\n var texttemplate = trace.texttemplate;\n if (texttemplate) {\n var cOpts = extractOpts(trace);\n var dummyAx = {\n type: \"linear\",\n range: [cOpts.min, cOpts.max],\n _separators: xa._separators,\n _numFormat: xa._numFormat\n };\n var aHistogram2dContour = trace.type === \"histogram2dcontour\";\n var aContour = trace.type === \"contour\";\n var iStart = aContour ? 1 : 0;\n var iStop = aContour ? m - 1 : m;\n var jStart = aContour ? 1 : 0;\n var jStop = aContour ? n - 1 : n;\n var textData = [];\n for (i = iStart; i < iStop; i++) {\n var yVal;\n if (aContour) {\n yVal = cd0.y[i];\n } else if (aHistogram2dContour) {\n if (i === 0 || i === m - 1) continue;\n yVal = cd0.y[i];\n } else if (cd0.yCenter) {\n yVal = cd0.yCenter[i];\n } else {\n if (i + 1 === m && cd0.y[i + 1] === void 0) continue;\n yVal = (cd0.y[i] + cd0.y[i + 1]) / 2;\n }\n var _y = Math.round(ya.c2p(yVal));\n if (0 > _y || _y > ya._length) continue;\n for (j = jStart; j < jStop; j++) {\n var xVal;\n if (aContour) {\n xVal = cd0.x[j];\n } else if (aHistogram2dContour) {\n if (j === 0 || j === n - 1) continue;\n xVal = cd0.x[j];\n } else if (cd0.xCenter) {\n xVal = cd0.xCenter[j];\n } else {\n if (j + 1 === n && cd0.x[j + 1] === void 0) continue;\n xVal = (cd0.x[j] + cd0.x[j + 1]) / 2;\n }\n var _x = Math.round(xa.c2p(xVal));\n if (0 > _x || _x > xa._length) continue;\n var obj = formatLabels({\n x: xVal,\n y: yVal\n }, trace, gd._fullLayout);\n obj.x = xVal;\n obj.y = yVal;\n var zVal = cd0.z[i][j];\n if (zVal === void 0) {\n obj.z = \"\";\n obj.zLabel = \"\";\n } else {\n obj.z = zVal;\n obj.zLabel = Axes.tickText(dummyAx, zVal, \"hover\").text;\n }\n var theText = cd0.text && cd0.text[i] && cd0.text[i][j];\n if (theText === void 0 || theText === false) theText = \"\";\n obj.text = theText;\n var _t = Lib.texttemplateString(texttemplate, obj, gd._fullLayout._d3locale, obj, trace._meta || {});\n if (!_t) continue;\n var lines = _t.split(\"
    \");\n var nL = lines.length;\n var nC = 0;\n for (k = 0; k < nL; k++) {\n nC = Math.max(nC, lines[k].length);\n }\n textData.push({\n l: nL,\n // number of lines\n c: nC,\n // maximum number of chars in a line\n t: _t,\n // text\n x: _x,\n y: _y,\n z: zVal\n });\n }\n }\n var font = trace.textfont;\n var fontSize = font.size;\n var globalFontSize = gd._fullLayout.font.size;\n if (!fontSize || fontSize === \"auto\") {\n var minW = Infinity;\n var minH = Infinity;\n var maxL = 0;\n var maxC = 0;\n for (k = 0; k < textData.length; k++) {\n var d = textData[k];\n maxL = Math.max(maxL, d.l);\n maxC = Math.max(maxC, d.c);\n if (k < textData.length - 1) {\n var nextD = textData[k + 1];\n var dx = Math.abs(nextD.x - d.x);\n var dy = Math.abs(nextD.y - d.y);\n if (dx) minW = Math.min(minW, dx);\n if (dy) minH = Math.min(minH, dy);\n }\n }\n if (!isFinite(minW) || !isFinite(minH)) {\n fontSize = globalFontSize;\n } else {\n minW -= xGap;\n minH -= yGap;\n minW /= maxC;\n minH /= maxL;\n minW /= LINE_SPACING / 2;\n minH /= LINE_SPACING;\n fontSize = Math.min(\n Math.floor(minW),\n Math.floor(minH),\n globalFontSize\n );\n }\n }\n if (fontSize <= 0 || !isFinite(fontSize)) return;\n var xFn = function(d2) {\n return d2.x;\n };\n var yFn = function(d2) {\n return d2.y - fontSize * (d2.l * LINE_SPACING / 2 - 1);\n };\n var labels = selectLabels(plotGroup).data(textData);\n labels.enter().append(\"g\").classed(labelClass, 1).append(\"text\").attr(\"text-anchor\", \"middle\").each(function(d2) {\n var thisLabel = d3.select(this);\n var fontColor = font.color;\n if (!fontColor || fontColor === \"auto\") {\n fontColor = Color2.contrast(\n d2.z === void 0 ? gd._fullLayout.plot_bgcolor : \"rgba(\" + sclFunc(d2.z).join() + \")\"\n );\n }\n thisLabel.attr(\"data-notex\", 1).call(svgTextUtils.positionText, xFn(d2), yFn(d2)).call(Drawing.font, {\n family: font.family,\n size: fontSize,\n color: fontColor,\n weight: font.weight,\n style: font.style,\n variant: font.variant,\n textcase: font.textcase,\n lineposition: font.lineposition,\n shadow: font.shadow\n }).text(d2.t).call(svgTextUtils.convertToTspans, gd);\n });\n }\n });\n };\n function findInterp(pixel, pixArray) {\n var maxBin = pixArray.length - 2;\n var bin = Lib.constrain(Lib.findBin(pixel, pixArray), 0, maxBin);\n var pix0 = pixArray[bin];\n var pix1 = pixArray[bin + 1];\n var interp = Lib.constrain(bin + (pixel - pix0) / (pix1 - pix0) - 0.5, 0, maxBin);\n var bin0 = Math.round(interp);\n var frac = Math.abs(interp - bin0);\n if (!interp || interp === maxBin || !frac) {\n return {\n bin0,\n bin1: bin0,\n frac: 0\n };\n }\n return {\n bin0,\n frac,\n bin1: Math.round(bin0 + frac / (interp - bin0))\n };\n }\n function findInterpFromCenters(pixel, centerPixArray) {\n var maxBin = centerPixArray.length - 1;\n var bin = Lib.constrain(Lib.findBin(pixel, centerPixArray), 0, maxBin);\n var pix0 = centerPixArray[bin];\n var pix1 = centerPixArray[bin + 1];\n var frac = (pixel - pix0) / (pix1 - pix0) || 0;\n if (frac <= 0) {\n return {\n bin0: bin,\n bin1: bin,\n frac: 0\n };\n }\n if (frac < 0.5) {\n return {\n bin0: bin,\n bin1: bin + 1,\n frac\n };\n }\n return {\n bin0: bin + 1,\n bin1: bin,\n frac: 1 - frac\n };\n }\n function putColor(pixels, pxIndex, c) {\n pixels[pxIndex] = c[0];\n pixels[pxIndex + 1] = c[1];\n pixels[pxIndex + 2] = c[2];\n pixels[pxIndex + 3] = Math.round(c[3] * 255);\n }\n }\n });\n\n // src/traces/heatmap/colorbar.js\n var require_colorbar2 = __commonJS({\n \"src/traces/heatmap/colorbar.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n min: \"zmin\",\n max: \"zmax\"\n };\n }\n });\n\n // src/traces/heatmap/style.js\n var require_style6 = __commonJS({\n \"src/traces/heatmap/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n module.exports = function style(gd) {\n d3.select(gd).selectAll(\".hm image\").style(\"opacity\", function(d) {\n return d.trace.opacity;\n });\n };\n }\n });\n\n // src/traces/heatmap/hover.js\n var require_hover5 = __commonJS({\n \"src/traces/heatmap/hover.js\"(exports, module) {\n \"use strict\";\n var Fx = require_fx();\n var Lib = require_lib();\n var isArrayOrTypedArray = Lib.isArrayOrTypedArray;\n var Axes = require_axes();\n var extractOpts = require_colorscale().extractOpts;\n module.exports = function hoverPoints(pointData, xval, yval, hovermode, opts) {\n if (!opts) opts = {};\n var isContour = opts.isContour;\n var cd0 = pointData.cd[0];\n var trace = cd0.trace;\n var xa = pointData.xa;\n var ya = pointData.ya;\n var x = cd0.x;\n var y = cd0.y;\n var z = cd0.z;\n var xc = cd0.xCenter;\n var yc = cd0.yCenter;\n var zmask = cd0.zmask;\n var zhoverformat = trace.zhoverformat;\n var x2 = x;\n var y2 = y;\n var xl, yl, nx, ny;\n if (pointData.index !== false) {\n try {\n nx = Math.round(pointData.index[1]);\n ny = Math.round(pointData.index[0]);\n } catch (e) {\n Lib.error(\"Error hovering on heatmap, pointNumber must be [row,col], found:\", pointData.index);\n return;\n }\n if (nx < 0 || nx >= z[0].length || ny < 0 || ny > z.length) {\n return;\n }\n } else if (Fx.inbox(xval - x[0], xval - x[x.length - 1], 0) > 0 || Fx.inbox(yval - y[0], yval - y[y.length - 1], 0) > 0) {\n return;\n } else {\n if (isContour) {\n var i2;\n x2 = [2 * x[0] - x[1]];\n for (i2 = 1; i2 < x.length; i2++) {\n x2.push((x[i2] + x[i2 - 1]) / 2);\n }\n x2.push([2 * x[x.length - 1] - x[x.length - 2]]);\n y2 = [2 * y[0] - y[1]];\n for (i2 = 1; i2 < y.length; i2++) {\n y2.push((y[i2] + y[i2 - 1]) / 2);\n }\n y2.push([2 * y[y.length - 1] - y[y.length - 2]]);\n }\n nx = Math.max(0, Math.min(x2.length - 2, Lib.findBin(xval, x2)));\n ny = Math.max(0, Math.min(y2.length - 2, Lib.findBin(yval, y2)));\n }\n var x0 = xa.c2p(x[nx]);\n var x1 = xa.c2p(x[nx + 1]);\n var y0 = ya.c2p(y[ny]);\n var y1 = ya.c2p(y[ny + 1]);\n var _x, _y;\n if (isContour) {\n _x = cd0.orig_x || x;\n _y = cd0.orig_y || y;\n x1 = x0;\n xl = _x[nx];\n y1 = y0;\n yl = _y[ny];\n } else {\n _x = cd0.orig_x || xc || x;\n _y = cd0.orig_y || yc || y;\n xl = xc ? _x[nx] : (_x[nx] + _x[nx + 1]) / 2;\n yl = yc ? _y[ny] : (_y[ny] + _y[ny + 1]) / 2;\n if (xa && xa.type === \"category\") xl = x[nx];\n if (ya && ya.type === \"category\") yl = y[ny];\n if (trace.zsmooth) {\n x0 = x1 = xa.c2p(xl);\n y0 = y1 = ya.c2p(yl);\n }\n }\n var zVal = z[ny][nx];\n if (zmask && !zmask[ny][nx]) zVal = void 0;\n if (zVal === void 0 && !trace.hoverongaps) return;\n var text;\n if (isArrayOrTypedArray(cd0.hovertext) && isArrayOrTypedArray(cd0.hovertext[ny])) {\n text = cd0.hovertext[ny][nx];\n } else if (isArrayOrTypedArray(cd0.text) && isArrayOrTypedArray(cd0.text[ny])) {\n text = cd0.text[ny][nx];\n }\n var cOpts = extractOpts(trace);\n var dummyAx = {\n type: \"linear\",\n range: [cOpts.min, cOpts.max],\n hoverformat: zhoverformat,\n _separators: xa._separators,\n _numFormat: xa._numFormat\n };\n var zLabel = Axes.tickText(dummyAx, zVal, \"hover\").text;\n return [Lib.extendFlat(pointData, {\n index: trace._after2before ? trace._after2before[ny][nx] : [ny, nx],\n // never let a 2D override 1D type as closest point\n distance: pointData.maxHoverDistance,\n spikeDistance: pointData.maxSpikeDistance,\n x0,\n x1,\n y0,\n y1,\n xLabelVal: xl,\n yLabelVal: yl,\n zLabelVal: zVal,\n zLabel,\n text\n })];\n };\n }\n });\n\n // src/traces/heatmap/index.js\n var require_heatmap = __commonJS({\n \"src/traces/heatmap/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes25(),\n supplyDefaults: require_defaults21(),\n calc: require_calc9(),\n plot: require_plot5(),\n colorbar: require_colorbar2(),\n style: require_style6(),\n hoverPoints: require_hover5(),\n moduleType: \"trace\",\n name: \"heatmap\",\n basePlotModule: require_cartesian(),\n categories: [\"cartesian\", \"svg\", \"2dMap\", \"showLegend\"],\n meta: {}\n };\n }\n });\n\n // lib/heatmap.js\n var require_heatmap2 = __commonJS({\n \"lib/heatmap.js\"(exports, module) {\n \"use strict\";\n module.exports = require_heatmap();\n }\n });\n\n // src/traces/histogram/bin_attributes.js\n var require_bin_attributes = __commonJS({\n \"src/traces/histogram/bin_attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = function makeBinAttrs(axLetter, match) {\n return {\n start: {\n valType: \"any\",\n // for date axes\n editType: \"calc\"\n },\n end: {\n valType: \"any\",\n // for date axes\n editType: \"calc\"\n },\n size: {\n valType: \"any\",\n // for date axes\n editType: \"calc\"\n },\n editType: \"calc\"\n };\n };\n }\n });\n\n // src/traces/histogram/constants.js\n var require_constants15 = __commonJS({\n \"src/traces/histogram/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n eventDataKeys: [\"binNumber\"]\n };\n }\n });\n\n // src/traces/histogram/attributes.js\n var require_attributes26 = __commonJS({\n \"src/traces/histogram/attributes.js\"(exports, module) {\n \"use strict\";\n var barAttrs = require_attributes23();\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var fontAttrs = require_font_attributes();\n var makeBinAttrs = require_bin_attributes();\n var constants = require_constants15();\n var extendFlat = require_extend().extendFlat;\n module.exports = {\n x: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n y: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n text: extendFlat({}, barAttrs.text, {}),\n hovertext: extendFlat({}, barAttrs.hovertext, {}),\n orientation: barAttrs.orientation,\n histfunc: {\n valType: \"enumerated\",\n values: [\"count\", \"sum\", \"avg\", \"min\", \"max\"],\n dflt: \"count\",\n editType: \"calc\"\n },\n histnorm: {\n valType: \"enumerated\",\n values: [\"\", \"percent\", \"probability\", \"density\", \"probability density\"],\n dflt: \"\",\n editType: \"calc\"\n },\n cumulative: {\n enabled: {\n valType: \"boolean\",\n dflt: false,\n editType: \"calc\"\n },\n direction: {\n valType: \"enumerated\",\n values: [\"increasing\", \"decreasing\"],\n dflt: \"increasing\",\n editType: \"calc\"\n },\n currentbin: {\n valType: \"enumerated\",\n values: [\"include\", \"exclude\", \"half\"],\n dflt: \"include\",\n editType: \"calc\"\n },\n editType: \"calc\"\n },\n nbinsx: {\n valType: \"integer\",\n min: 0,\n dflt: 0,\n editType: \"calc\"\n },\n xbins: makeBinAttrs(\"x\", true),\n nbinsy: {\n valType: \"integer\",\n min: 0,\n dflt: 0,\n editType: \"calc\"\n },\n ybins: makeBinAttrs(\"y\", true),\n autobinx: {\n valType: \"boolean\",\n dflt: null,\n editType: \"calc\"\n },\n autobiny: {\n valType: \"boolean\",\n dflt: null,\n editType: \"calc\"\n },\n bingroup: {\n valType: \"string\",\n dflt: \"\",\n editType: \"calc\"\n },\n hovertemplate: hovertemplateAttrs({}, {\n keys: constants.eventDataKeys\n }),\n texttemplate: texttemplateAttrs({\n arrayOk: false,\n editType: \"plot\"\n }, {\n keys: [\"label\", \"value\"]\n }),\n textposition: extendFlat({}, barAttrs.textposition, {\n arrayOk: false\n }),\n textfont: fontAttrs({\n arrayOk: false,\n editType: \"plot\",\n colorEditType: \"style\"\n }),\n outsidetextfont: fontAttrs({\n arrayOk: false,\n editType: \"plot\",\n colorEditType: \"style\"\n }),\n insidetextfont: fontAttrs({\n arrayOk: false,\n editType: \"plot\",\n colorEditType: \"style\"\n }),\n insidetextanchor: barAttrs.insidetextanchor,\n textangle: barAttrs.textangle,\n cliponaxis: barAttrs.cliponaxis,\n constraintext: barAttrs.constraintext,\n marker: barAttrs.marker,\n offsetgroup: barAttrs.offsetgroup,\n alignmentgroup: barAttrs.alignmentgroup,\n selected: barAttrs.selected,\n unselected: barAttrs.unselected,\n zorder: barAttrs.zorder\n };\n }\n });\n\n // src/traces/histogram/defaults.js\n var require_defaults22 = __commonJS({\n \"src/traces/histogram/defaults.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var Lib = require_lib();\n var Color2 = require_color();\n var handleText = require_defaults19().handleText;\n var handleStyleDefaults = require_style_defaults();\n var attributes = require_attributes26();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var x = coerce(\"x\");\n var y = coerce(\"y\");\n var cumulative = coerce(\"cumulative.enabled\");\n if (cumulative) {\n coerce(\"cumulative.direction\");\n coerce(\"cumulative.currentbin\");\n }\n coerce(\"text\");\n var textposition = coerce(\"textposition\");\n handleText(traceIn, traceOut, layout, coerce, textposition, {\n moduleHasSelected: true,\n moduleHasUnselected: true,\n moduleHasConstrain: true,\n moduleHasCliponaxis: true,\n moduleHasTextangle: true,\n moduleHasInsideanchor: true\n });\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n var orientation = coerce(\"orientation\", y && !x ? \"h\" : \"v\");\n var sampleLetter = orientation === \"v\" ? \"x\" : \"y\";\n var aggLetter = orientation === \"v\" ? \"y\" : \"x\";\n var len = x && y ? Math.min(Lib.minRowLength(x) && Lib.minRowLength(y)) : Lib.minRowLength(traceOut[sampleLetter] || []);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n traceOut._length = len;\n var handleCalendarDefaults = Registry.getComponentMethod(\"calendars\", \"handleTraceDefaults\");\n handleCalendarDefaults(traceIn, traceOut, [\"x\", \"y\"], layout);\n var hasAggregationData = traceOut[aggLetter];\n if (hasAggregationData) coerce(\"histfunc\");\n coerce(\"histnorm\");\n coerce(\"autobin\" + sampleLetter);\n handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout);\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n var lineColor = (traceOut.marker.line || {}).color;\n var errorBarsSupplyDefaults = Registry.getComponentMethod(\"errorbars\", \"supplyDefaults\");\n errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color2.defaultLine, { axis: \"y\" });\n errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color2.defaultLine, { axis: \"x\", inherit: \"y\" });\n coerce(\"zorder\");\n };\n }\n });\n\n // src/traces/histogram/cross_trace_defaults.js\n var require_cross_trace_defaults3 = __commonJS({\n \"src/traces/histogram/cross_trace_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var axisIds = require_axis_ids();\n var traceIs = require_registry().traceIs;\n var handleGroupingDefaults = require_grouping_defaults();\n var validateCornerradius = require_defaults19().validateCornerradius;\n var nestedProperty = Lib.nestedProperty;\n var getAxisGroup = require_constraints().getAxisGroup;\n var BINATTRS = [\n { aStr: { x: \"xbins.start\", y: \"ybins.start\" }, name: \"start\" },\n { aStr: { x: \"xbins.end\", y: \"ybins.end\" }, name: \"end\" },\n { aStr: { x: \"xbins.size\", y: \"ybins.size\" }, name: \"size\" },\n { aStr: { x: \"nbinsx\", y: \"nbinsy\" }, name: \"nbins\" }\n ];\n var BINDIRECTIONS = [\"x\", \"y\"];\n module.exports = function crossTraceDefaults(fullData, fullLayout) {\n var allBinOpts = fullLayout._histogramBinOpts = {};\n var histTraces = [];\n var mustMatchTracesLookup = {};\n var otherTracesList = [];\n var traceOut, traces, groupName, binDir;\n var i, j, k;\n function coerce(attr2, dflt) {\n return Lib.coerce(traceOut._input, traceOut, traceOut._module.attributes, attr2, dflt);\n }\n function orientation2binDir(traceOut2) {\n return traceOut2.orientation === \"v\" ? \"x\" : \"y\";\n }\n function getAxisType(traceOut2, binDir2) {\n var ax = axisIds.getFromTrace({ _fullLayout: fullLayout }, traceOut2, binDir2);\n return ax.type;\n }\n function fillBinOpts(traceOut2, groupName2, binDir2) {\n var fallbackGroupName = traceOut2.uid + \"__\" + binDir2;\n if (!groupName2) groupName2 = fallbackGroupName;\n var axType = getAxisType(traceOut2, binDir2);\n var calendar = traceOut2[binDir2 + \"calendar\"] || \"\";\n var binOpts2 = allBinOpts[groupName2];\n var needsNewItem = true;\n if (binOpts2) {\n if (axType === binOpts2.axType && calendar === binOpts2.calendar) {\n needsNewItem = false;\n binOpts2.traces.push(traceOut2);\n binOpts2.dirs.push(binDir2);\n } else {\n groupName2 = fallbackGroupName;\n if (axType !== binOpts2.axType) {\n Lib.warn([\n \"Attempted to group the bins of trace\",\n traceOut2.index,\n \"set on a\",\n \"type:\" + axType,\n \"axis\",\n \"with bins on\",\n \"type:\" + binOpts2.axType,\n \"axis.\"\n ].join(\" \"));\n }\n if (calendar !== binOpts2.calendar) {\n Lib.warn([\n \"Attempted to group the bins of trace\",\n traceOut2.index,\n \"set with a\",\n calendar,\n \"calendar\",\n \"with bins\",\n binOpts2.calendar ? \"on a \" + binOpts2.calendar + \" calendar\" : \"w/o a set calendar\"\n ].join(\" \"));\n }\n }\n }\n if (needsNewItem) {\n allBinOpts[groupName2] = {\n traces: [traceOut2],\n dirs: [binDir2],\n axType,\n calendar: traceOut2[binDir2 + \"calendar\"] || \"\"\n };\n }\n traceOut2[\"_\" + binDir2 + \"bingroup\"] = groupName2;\n }\n for (i = 0; i < fullData.length; i++) {\n traceOut = fullData[i];\n if (traceIs(traceOut, \"histogram\")) {\n histTraces.push(traceOut);\n delete traceOut._xautoBinFinished;\n delete traceOut._yautoBinFinished;\n if (traceOut.type === \"histogram\") {\n var r = coerce(\"marker.cornerradius\", fullLayout.barcornerradius);\n if (traceOut.marker) {\n traceOut.marker.cornerradius = validateCornerradius(r);\n }\n }\n if (!traceIs(traceOut, \"2dMap\")) {\n handleGroupingDefaults(traceOut._input, traceOut, fullLayout, coerce, fullLayout.barmode);\n }\n }\n }\n var alignmentOpts = fullLayout._alignmentOpts || {};\n for (i = 0; i < histTraces.length; i++) {\n traceOut = histTraces[i];\n groupName = \"\";\n if (!traceIs(traceOut, \"2dMap\")) {\n binDir = orientation2binDir(traceOut);\n if (fullLayout.barmode === \"group\" && traceOut.alignmentgroup) {\n var pa = traceOut[binDir + \"axis\"];\n var aGroupId = getAxisGroup(fullLayout, pa) + traceOut.orientation;\n if ((alignmentOpts[aGroupId] || {})[traceOut.alignmentgroup]) {\n groupName = aGroupId;\n }\n }\n if (!groupName && fullLayout.barmode !== \"overlay\") {\n groupName = getAxisGroup(fullLayout, traceOut.xaxis) + getAxisGroup(fullLayout, traceOut.yaxis) + orientation2binDir(traceOut);\n }\n }\n if (groupName) {\n if (!mustMatchTracesLookup[groupName]) {\n mustMatchTracesLookup[groupName] = [];\n }\n mustMatchTracesLookup[groupName].push(traceOut);\n } else {\n otherTracesList.push(traceOut);\n }\n }\n for (groupName in mustMatchTracesLookup) {\n traces = mustMatchTracesLookup[groupName];\n if (traces.length === 1) {\n otherTracesList.push(traces[0]);\n continue;\n }\n var binGroupFound = false;\n if (traces.length) {\n traceOut = traces[0];\n binGroupFound = coerce(\"bingroup\");\n }\n groupName = binGroupFound || groupName;\n for (i = 0; i < traces.length; i++) {\n traceOut = traces[i];\n var bingroupIn = traceOut._input.bingroup;\n if (bingroupIn && bingroupIn !== groupName) {\n Lib.warn([\n \"Trace\",\n traceOut.index,\n \"must match\",\n \"within bingroup\",\n groupName + \".\",\n \"Ignoring its bingroup:\",\n bingroupIn,\n \"setting.\"\n ].join(\" \"));\n }\n traceOut.bingroup = groupName;\n fillBinOpts(traceOut, groupName, orientation2binDir(traceOut));\n }\n }\n for (i = 0; i < otherTracesList.length; i++) {\n traceOut = otherTracesList[i];\n var binGroup = coerce(\"bingroup\");\n if (traceIs(traceOut, \"2dMap\")) {\n for (k = 0; k < 2; k++) {\n binDir = BINDIRECTIONS[k];\n var binGroupInDir = coerce(\n binDir + \"bingroup\",\n binGroup ? binGroup + \"__\" + binDir : null\n );\n fillBinOpts(traceOut, binGroupInDir, binDir);\n }\n } else {\n fillBinOpts(traceOut, binGroup, orientation2binDir(traceOut));\n }\n }\n for (groupName in allBinOpts) {\n var binOpts = allBinOpts[groupName];\n traces = binOpts.traces;\n for (j = 0; j < BINATTRS.length; j++) {\n var attrSpec = BINATTRS[j];\n var attr = attrSpec.name;\n var aStr;\n var autoVals;\n if (attr === \"nbins\" && binOpts.sizeFound) continue;\n for (i = 0; i < traces.length; i++) {\n traceOut = traces[i];\n binDir = binOpts.dirs[i];\n aStr = attrSpec.aStr[binDir];\n if (nestedProperty(traceOut._input, aStr).get() !== void 0) {\n binOpts[attr] = coerce(aStr);\n binOpts[attr + \"Found\"] = true;\n break;\n }\n autoVals = (traceOut._autoBin || {})[binDir] || {};\n if (autoVals[attr]) {\n nestedProperty(traceOut, aStr).set(autoVals[attr]);\n }\n }\n if (attr === \"start\" || attr === \"end\") {\n for (; i < traces.length; i++) {\n traceOut = traces[i];\n if (traceOut[\"_\" + binDir + \"bingroup\"]) {\n autoVals = (traceOut._autoBin || {})[binDir] || {};\n coerce(aStr, autoVals[attr]);\n }\n }\n }\n if (attr === \"nbins\" && !binOpts.sizeFound && !binOpts.nbinsFound) {\n traceOut = traces[0];\n binOpts[attr] = coerce(aStr);\n }\n }\n }\n };\n }\n });\n\n // src/traces/histogram/hover.js\n var require_hover6 = __commonJS({\n \"src/traces/histogram/hover.js\"(exports, module) {\n \"use strict\";\n var barHover = require_hover3().hoverPoints;\n var hoverLabelText = require_axes().hoverLabelText;\n module.exports = function hoverPoints(pointData, xval, yval, hovermode, opts) {\n var pts = barHover(pointData, xval, yval, hovermode, opts);\n if (!pts) return;\n pointData = pts[0];\n var di = pointData.cd[pointData.index];\n var trace = pointData.cd[0].trace;\n if (!trace.cumulative.enabled) {\n var posLetter = trace.orientation === \"h\" ? \"y\" : \"x\";\n pointData[posLetter + \"Label\"] = hoverLabelText(pointData[posLetter + \"a\"], [di.ph0, di.ph1], trace[posLetter + \"hoverformat\"]);\n }\n return pts;\n };\n }\n });\n\n // src/traces/histogram/event_data.js\n var require_event_data3 = __commonJS({\n \"src/traces/histogram/event_data.js\"(exports, module) {\n \"use strict\";\n module.exports = function eventData(out, pt, trace, cd, pointNumber) {\n out.x = \"xVal\" in pt ? pt.xVal : pt.x;\n out.y = \"yVal\" in pt ? pt.yVal : pt.y;\n if (\"zLabelVal\" in pt) out.z = pt.zLabelVal;\n if (pt.xa) out.xaxis = pt.xa;\n if (pt.ya) out.yaxis = pt.ya;\n if (!(trace.cumulative || {}).enabled) {\n var pts = Array.isArray(pointNumber) ? cd[0].pts[pointNumber[0]][pointNumber[1]] : cd[pointNumber].pts;\n out.pointNumbers = pts;\n out.binNumber = out.pointNumber;\n delete out.pointNumber;\n delete out.pointIndex;\n var pointIndices;\n if (trace._indexToPoints) {\n pointIndices = [];\n for (var i = 0; i < pts.length; i++) {\n pointIndices = pointIndices.concat(trace._indexToPoints[pts[i]]);\n }\n } else {\n pointIndices = pts;\n }\n out.pointIndices = pointIndices;\n }\n return out;\n };\n }\n });\n\n // src/traces/histogram/index.js\n var require_histogram = __commonJS({\n \"src/traces/histogram/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes26(),\n layoutAttributes: require_layout_attributes6(),\n supplyDefaults: require_defaults22(),\n crossTraceDefaults: require_cross_trace_defaults3(),\n supplyLayoutDefaults: require_layout_defaults5(),\n calc: require_calc7().calc,\n crossTraceCalc: require_cross_trace_calc().crossTraceCalc,\n plot: require_plot3().plot,\n layerName: \"barlayer\",\n style: require_style4().style,\n styleOnSelect: require_style4().styleOnSelect,\n colorbar: require_marker_colorbar(),\n hoverPoints: require_hover6(),\n selectPoints: require_select3(),\n eventData: require_event_data3(),\n moduleType: \"trace\",\n name: \"histogram\",\n basePlotModule: require_cartesian(),\n categories: [\"bar-like\", \"cartesian\", \"svg\", \"bar\", \"histogram\", \"oriented\", \"errorBarsOK\", \"showLegend\"],\n meta: {}\n };\n }\n });\n\n // lib/histogram.js\n var require_histogram2 = __commonJS({\n \"lib/histogram.js\"(exports, module) {\n \"use strict\";\n module.exports = require_histogram();\n }\n });\n\n // src/traces/histogram2d/attributes.js\n var require_attributes27 = __commonJS({\n \"src/traces/histogram2d/attributes.js\"(exports, module) {\n \"use strict\";\n var histogramAttrs = require_attributes26();\n var makeBinAttrs = require_bin_attributes();\n var heatmapAttrs = require_attributes25();\n var baseAttrs = require_attributes2();\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var colorScaleAttrs = require_attributes8();\n var extendFlat = require_extend().extendFlat;\n module.exports = extendFlat(\n {\n x: histogramAttrs.x,\n y: histogramAttrs.y,\n z: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n marker: {\n color: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n editType: \"calc\"\n },\n histnorm: histogramAttrs.histnorm,\n histfunc: histogramAttrs.histfunc,\n nbinsx: histogramAttrs.nbinsx,\n xbins: makeBinAttrs(\"x\"),\n nbinsy: histogramAttrs.nbinsy,\n ybins: makeBinAttrs(\"y\"),\n autobinx: histogramAttrs.autobinx,\n autobiny: histogramAttrs.autobiny,\n bingroup: extendFlat({}, histogramAttrs.bingroup, {}),\n xbingroup: extendFlat({}, histogramAttrs.bingroup, {}),\n ybingroup: extendFlat({}, histogramAttrs.bingroup, {}),\n xgap: heatmapAttrs.xgap,\n ygap: heatmapAttrs.ygap,\n zsmooth: heatmapAttrs.zsmooth,\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n zhoverformat: axisHoverFormat(\"z\", 1),\n hovertemplate: hovertemplateAttrs({}, { keys: \"z\" }),\n texttemplate: texttemplateAttrs({\n arrayOk: false,\n editType: \"plot\"\n }, {\n keys: \"z\"\n }),\n textfont: heatmapAttrs.textfont,\n showlegend: extendFlat({}, baseAttrs.showlegend, { dflt: false })\n },\n colorScaleAttrs(\"\", { cLetter: \"z\", autoColorDflt: false })\n );\n }\n });\n\n // src/traces/histogram2d/sample_defaults.js\n var require_sample_defaults = __commonJS({\n \"src/traces/histogram2d/sample_defaults.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var Lib = require_lib();\n module.exports = function handleSampleDefaults(traceIn, traceOut, coerce, layout) {\n var x = coerce(\"x\");\n var y = coerce(\"y\");\n var xlen = Lib.minRowLength(x);\n var ylen = Lib.minRowLength(y);\n if (!xlen || !ylen) {\n traceOut.visible = false;\n return;\n }\n traceOut._length = Math.min(xlen, ylen);\n var handleCalendarDefaults = Registry.getComponentMethod(\"calendars\", \"handleTraceDefaults\");\n handleCalendarDefaults(traceIn, traceOut, [\"x\", \"y\"], layout);\n var hasAggregationData = coerce(\"z\") || coerce(\"marker.color\");\n if (hasAggregationData) coerce(\"histfunc\");\n coerce(\"histnorm\");\n coerce(\"autobinx\");\n coerce(\"autobiny\");\n };\n }\n });\n\n // src/traces/histogram2d/defaults.js\n var require_defaults23 = __commonJS({\n \"src/traces/histogram2d/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleSampleDefaults = require_sample_defaults();\n var handleStyleDefaults = require_style_defaults2();\n var colorscaleDefaults = require_defaults2();\n var handleHeatmapLabelDefaults = require_label_defaults();\n var attributes = require_attributes27();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n handleSampleDefaults(traceIn, traceOut, coerce, layout);\n if (traceOut.visible === false) return;\n handleStyleDefaults(traceIn, traceOut, coerce, layout);\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"\", cLetter: \"z\" });\n coerce(\"hovertemplate\");\n handleHeatmapLabelDefaults(coerce, layout);\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n };\n }\n });\n\n // src/traces/histogram2d/hover.js\n var require_hover7 = __commonJS({\n \"src/traces/histogram2d/hover.js\"(exports, module) {\n \"use strict\";\n var heatmapHover = require_hover5();\n var hoverLabelText = require_axes().hoverLabelText;\n module.exports = function hoverPoints(pointData, xval, yval, hovermode, opts) {\n var pts = heatmapHover(pointData, xval, yval, hovermode, opts);\n if (!pts) return;\n pointData = pts[0];\n var indices = pointData.index;\n var ny = indices[0];\n var nx = indices[1];\n var cd0 = pointData.cd[0];\n var trace = cd0.trace;\n var xRange = cd0.xRanges[nx];\n var yRange = cd0.yRanges[ny];\n pointData.xLabel = hoverLabelText(pointData.xa, [xRange[0], xRange[1]], trace.xhoverformat);\n pointData.yLabel = hoverLabelText(pointData.ya, [yRange[0], yRange[1]], trace.yhoverformat);\n return pts;\n };\n }\n });\n\n // src/traces/histogram2d/index.js\n var require_histogram2d = __commonJS({\n \"src/traces/histogram2d/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes27(),\n supplyDefaults: require_defaults23(),\n crossTraceDefaults: require_cross_trace_defaults3(),\n calc: require_calc9(),\n plot: require_plot5(),\n layerName: \"heatmaplayer\",\n colorbar: require_colorbar2(),\n style: require_style6(),\n hoverPoints: require_hover7(),\n eventData: require_event_data3(),\n moduleType: \"trace\",\n name: \"histogram2d\",\n basePlotModule: require_cartesian(),\n categories: [\"cartesian\", \"svg\", \"2dMap\", \"histogram\", \"showLegend\"],\n meta: {}\n };\n }\n });\n\n // lib/histogram2d.js\n var require_histogram2d2 = __commonJS({\n \"lib/histogram2d.js\"(exports, module) {\n \"use strict\";\n module.exports = require_histogram2d();\n }\n });\n\n // src/constants/filter_ops.js\n var require_filter_ops = __commonJS({\n \"src/constants/filter_ops.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n COMPARISON_OPS: [\"=\", \"!=\", \"<\", \">=\", \">\", \"<=\"],\n COMPARISON_OPS2: [\"=\", \"<\", \">=\", \">\", \"<=\"],\n INTERVAL_OPS: [\"[]\", \"()\", \"[)\", \"(]\", \"][\", \")(\", \"](\", \")[\"],\n SET_OPS: [\"{}\", \"}{\"],\n CONSTRAINT_REDUCTION: {\n // for contour constraints, open/closed endpoints are equivalent\n \"=\": \"=\",\n \"<\": \"<\",\n \"<=\": \"<\",\n \">\": \">\",\n \">=\": \">\",\n \"[]\": \"[]\",\n \"()\": \"[]\",\n \"[)\": \"[]\",\n \"(]\": \"[]\",\n \"][\": \"][\",\n \")(\": \"][\",\n \"](\": \"][\",\n \")[\": \"][\"\n }\n };\n }\n });\n\n // src/traces/contour/attributes.js\n var require_attributes28 = __commonJS({\n \"src/traces/contour/attributes.js\"(exports, module) {\n \"use strict\";\n var heatmapAttrs = require_attributes25();\n var scatterAttrs = require_attributes12();\n var axisFormat = require_axis_format_attributes();\n var axisHoverFormat = axisFormat.axisHoverFormat;\n var descriptionOnlyNumbers = axisFormat.descriptionOnlyNumbers;\n var colorScaleAttrs = require_attributes8();\n var dash = require_attributes4().dash;\n var fontAttrs = require_font_attributes();\n var extendFlat = require_extend().extendFlat;\n var filterOps = require_filter_ops();\n var COMPARISON_OPS2 = filterOps.COMPARISON_OPS2;\n var INTERVAL_OPS = filterOps.INTERVAL_OPS;\n var scatterLineAttrs = scatterAttrs.line;\n module.exports = extendFlat(\n {\n z: heatmapAttrs.z,\n x: heatmapAttrs.x,\n x0: heatmapAttrs.x0,\n dx: heatmapAttrs.dx,\n y: heatmapAttrs.y,\n y0: heatmapAttrs.y0,\n dy: heatmapAttrs.dy,\n xperiod: heatmapAttrs.xperiod,\n yperiod: heatmapAttrs.yperiod,\n xperiod0: scatterAttrs.xperiod0,\n yperiod0: scatterAttrs.yperiod0,\n xperiodalignment: heatmapAttrs.xperiodalignment,\n yperiodalignment: heatmapAttrs.yperiodalignment,\n text: heatmapAttrs.text,\n hovertext: heatmapAttrs.hovertext,\n transpose: heatmapAttrs.transpose,\n xtype: heatmapAttrs.xtype,\n ytype: heatmapAttrs.ytype,\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n zhoverformat: axisHoverFormat(\"z\", 1),\n hovertemplate: heatmapAttrs.hovertemplate,\n texttemplate: extendFlat({}, heatmapAttrs.texttemplate, {}),\n textfont: extendFlat({}, heatmapAttrs.textfont, {}),\n hoverongaps: heatmapAttrs.hoverongaps,\n connectgaps: extendFlat({}, heatmapAttrs.connectgaps, {}),\n fillcolor: {\n valType: \"color\",\n editType: \"calc\"\n },\n autocontour: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc\",\n impliedEdits: {\n \"contours.start\": void 0,\n \"contours.end\": void 0,\n \"contours.size\": void 0\n }\n },\n ncontours: {\n valType: \"integer\",\n dflt: 15,\n min: 1,\n editType: \"calc\"\n },\n contours: {\n type: {\n valType: \"enumerated\",\n values: [\"levels\", \"constraint\"],\n dflt: \"levels\",\n editType: \"calc\"\n },\n start: {\n valType: \"number\",\n dflt: null,\n editType: \"plot\",\n impliedEdits: { \"^autocontour\": false }\n },\n end: {\n valType: \"number\",\n dflt: null,\n editType: \"plot\",\n impliedEdits: { \"^autocontour\": false }\n },\n size: {\n valType: \"number\",\n dflt: null,\n min: 0,\n editType: \"plot\",\n impliedEdits: { \"^autocontour\": false }\n },\n coloring: {\n valType: \"enumerated\",\n values: [\"fill\", \"heatmap\", \"lines\", \"none\"],\n dflt: \"fill\",\n editType: \"calc\"\n },\n showlines: {\n valType: \"boolean\",\n dflt: true,\n editType: \"plot\"\n },\n showlabels: {\n valType: \"boolean\",\n dflt: false,\n editType: \"plot\"\n },\n labelfont: fontAttrs({\n editType: \"plot\",\n colorEditType: \"style\"\n }),\n labelformat: {\n valType: \"string\",\n dflt: \"\",\n editType: \"plot\",\n description: descriptionOnlyNumbers(\"contour label\")\n },\n operation: {\n valType: \"enumerated\",\n values: [].concat(COMPARISON_OPS2).concat(INTERVAL_OPS),\n dflt: \"=\",\n editType: \"calc\"\n },\n value: {\n valType: \"any\",\n dflt: 0,\n editType: \"calc\"\n },\n editType: \"calc\",\n impliedEdits: { autocontour: false }\n },\n line: {\n color: extendFlat({}, scatterLineAttrs.color, {\n editType: \"style+colorbars\"\n }),\n width: {\n valType: \"number\",\n min: 0,\n editType: \"style+colorbars\"\n },\n dash,\n smoothing: extendFlat({}, scatterLineAttrs.smoothing, {}),\n editType: \"plot\"\n },\n zorder: scatterAttrs.zorder\n },\n colorScaleAttrs(\"\", {\n cLetter: \"z\",\n autoColorDflt: false,\n editTypeOverride: \"calc\"\n })\n );\n }\n });\n\n // src/traces/histogram2dcontour/attributes.js\n var require_attributes29 = __commonJS({\n \"src/traces/histogram2dcontour/attributes.js\"(exports, module) {\n \"use strict\";\n var histogram2dAttrs = require_attributes27();\n var contourAttrs = require_attributes28();\n var colorScaleAttrs = require_attributes8();\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var extendFlat = require_extend().extendFlat;\n module.exports = extendFlat(\n {\n x: histogram2dAttrs.x,\n y: histogram2dAttrs.y,\n z: histogram2dAttrs.z,\n marker: histogram2dAttrs.marker,\n histnorm: histogram2dAttrs.histnorm,\n histfunc: histogram2dAttrs.histfunc,\n nbinsx: histogram2dAttrs.nbinsx,\n xbins: histogram2dAttrs.xbins,\n nbinsy: histogram2dAttrs.nbinsy,\n ybins: histogram2dAttrs.ybins,\n autobinx: histogram2dAttrs.autobinx,\n autobiny: histogram2dAttrs.autobiny,\n bingroup: histogram2dAttrs.bingroup,\n xbingroup: histogram2dAttrs.xbingroup,\n ybingroup: histogram2dAttrs.ybingroup,\n autocontour: contourAttrs.autocontour,\n ncontours: contourAttrs.ncontours,\n contours: contourAttrs.contours,\n line: {\n color: contourAttrs.line.color,\n width: extendFlat({}, contourAttrs.line.width, {\n dflt: 0.5\n }),\n dash: contourAttrs.line.dash,\n smoothing: contourAttrs.line.smoothing,\n editType: \"plot\"\n },\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n zhoverformat: axisHoverFormat(\"z\", 1),\n hovertemplate: histogram2dAttrs.hovertemplate,\n texttemplate: contourAttrs.texttemplate,\n textfont: contourAttrs.textfont\n },\n colorScaleAttrs(\"\", {\n cLetter: \"z\",\n editTypeOverride: \"calc\"\n })\n );\n }\n });\n\n // src/traces/contour/contours_defaults.js\n var require_contours_defaults = __commonJS({\n \"src/traces/contour/contours_defaults.js\"(exports, module) {\n \"use strict\";\n module.exports = function handleContourDefaults(traceIn, traceOut, coerce, coerce2) {\n var contourStart = coerce2(\"contours.start\");\n var contourEnd = coerce2(\"contours.end\");\n var missingEnd = contourStart === false || contourEnd === false;\n var contourSize = coerce(\"contours.size\");\n var autoContour;\n if (missingEnd) autoContour = traceOut.autocontour = true;\n else autoContour = coerce(\"autocontour\", false);\n if (autoContour || !contourSize) coerce(\"ncontours\");\n };\n }\n });\n\n // src/traces/contour/label_defaults.js\n var require_label_defaults2 = __commonJS({\n \"src/traces/contour/label_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n module.exports = function handleLabelDefaults(coerce, layout, lineColor, opts) {\n if (!opts) opts = {};\n var showLabels = coerce(\"contours.showlabels\");\n if (showLabels) {\n var globalFont = layout.font;\n Lib.coerceFont(coerce, \"contours.labelfont\", globalFont, { overrideDflt: {\n color: lineColor\n } });\n coerce(\"contours.labelformat\");\n }\n if (opts.hasHover !== false) coerce(\"zhoverformat\");\n };\n }\n });\n\n // src/traces/contour/style_defaults.js\n var require_style_defaults3 = __commonJS({\n \"src/traces/contour/style_defaults.js\"(exports, module) {\n \"use strict\";\n var colorscaleDefaults = require_defaults2();\n var handleLabelDefaults = require_label_defaults2();\n module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout, opts) {\n var coloring = coerce(\"contours.coloring\");\n var showLines;\n var lineColor = \"\";\n if (coloring === \"fill\") showLines = coerce(\"contours.showlines\");\n if (showLines !== false) {\n if (coloring !== \"lines\") lineColor = coerce(\"line.color\", \"#000\");\n coerce(\"line.width\", 0.5);\n coerce(\"line.dash\");\n }\n if (coloring !== \"none\") {\n if (traceIn.showlegend !== true) traceOut.showlegend = false;\n traceOut._dfltShowLegend = false;\n colorscaleDefaults(\n traceIn,\n traceOut,\n layout,\n coerce,\n { prefix: \"\", cLetter: \"z\" }\n );\n }\n coerce(\"line.smoothing\");\n handleLabelDefaults(coerce, layout, lineColor, opts);\n };\n }\n });\n\n // src/traces/histogram2dcontour/defaults.js\n var require_defaults24 = __commonJS({\n \"src/traces/histogram2dcontour/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleSampleDefaults = require_sample_defaults();\n var handleContoursDefaults = require_contours_defaults();\n var handleStyleDefaults = require_style_defaults3();\n var handleHeatmapLabelDefaults = require_label_defaults();\n var attributes = require_attributes29();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n function coerce2(attr) {\n return Lib.coerce2(traceIn, traceOut, attributes, attr);\n }\n handleSampleDefaults(traceIn, traceOut, coerce, layout);\n if (traceOut.visible === false) return;\n handleContoursDefaults(traceIn, traceOut, coerce, coerce2);\n handleStyleDefaults(traceIn, traceOut, coerce, layout);\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n coerce(\"hovertemplate\");\n if (traceOut.contours && traceOut.contours.coloring === \"heatmap\") {\n handleHeatmapLabelDefaults(coerce, layout);\n }\n };\n }\n });\n\n // src/traces/contour/set_contours.js\n var require_set_contours = __commonJS({\n \"src/traces/contour/set_contours.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n var Lib = require_lib();\n module.exports = function setContours(trace, vals) {\n var contours = trace.contours;\n if (trace.autocontour) {\n var zmin = trace.zmin;\n var zmax = trace.zmax;\n if (trace.zauto || zmin === void 0) {\n zmin = Lib.aggNums(Math.min, null, vals);\n }\n if (trace.zauto || zmax === void 0) {\n zmax = Lib.aggNums(Math.max, null, vals);\n }\n var dummyAx = autoContours(zmin, zmax, trace.ncontours);\n contours.size = dummyAx.dtick;\n contours.start = Axes.tickFirst(dummyAx);\n dummyAx.range.reverse();\n contours.end = Axes.tickFirst(dummyAx);\n if (contours.start === zmin) contours.start += contours.size;\n if (contours.end === zmax) contours.end -= contours.size;\n if (contours.start > contours.end) {\n contours.start = contours.end = (contours.start + contours.end) / 2;\n }\n if (!trace._input.contours) trace._input.contours = {};\n Lib.extendFlat(trace._input.contours, {\n start: contours.start,\n end: contours.end,\n size: contours.size\n });\n trace._input.autocontour = true;\n } else if (contours.type !== \"constraint\") {\n var start = contours.start;\n var end = contours.end;\n var inputContours = trace._input.contours;\n if (start > end) {\n contours.start = inputContours.start = end;\n end = contours.end = inputContours.end = start;\n start = contours.start;\n }\n if (!(contours.size > 0)) {\n var sizeOut;\n if (start === end) sizeOut = 1;\n else sizeOut = autoContours(start, end, trace.ncontours).dtick;\n inputContours.size = contours.size = sizeOut;\n }\n }\n };\n function autoContours(start, end, ncontours) {\n var dummyAx = {\n type: \"linear\",\n range: [start, end]\n };\n Axes.autoTicks(\n dummyAx,\n (end - start) / (ncontours || 15)\n );\n return dummyAx;\n }\n }\n });\n\n // src/traces/contour/end_plus.js\n var require_end_plus = __commonJS({\n \"src/traces/contour/end_plus.js\"(exports, module) {\n \"use strict\";\n module.exports = function endPlus(contours) {\n return contours.end + contours.size / 1e6;\n };\n }\n });\n\n // src/traces/contour/calc.js\n var require_calc10 = __commonJS({\n \"src/traces/contour/calc.js\"(exports, module) {\n \"use strict\";\n var Colorscale = require_colorscale();\n var heatmapCalc = require_calc9();\n var setContours = require_set_contours();\n var endPlus = require_end_plus();\n module.exports = function calc(gd, trace) {\n var cd = heatmapCalc(gd, trace);\n var zOut = cd[0].z;\n setContours(trace, zOut);\n var contours = trace.contours;\n var cOpts = Colorscale.extractOpts(trace);\n var cVals;\n if (contours.coloring === \"heatmap\" && cOpts.auto && trace.autocontour === false) {\n var start = contours.start;\n var end = endPlus(contours);\n var cs = contours.size || 1;\n var nc = Math.floor((end - start) / cs) + 1;\n if (!isFinite(cs)) {\n cs = 1;\n nc = 1;\n }\n var min0 = start - cs / 2;\n var max0 = min0 + nc * cs;\n cVals = [min0, max0];\n } else {\n cVals = zOut;\n }\n Colorscale.calc(gd, trace, { vals: cVals, cLetter: \"z\" });\n return cd;\n };\n }\n });\n\n // src/traces/contour/constants.js\n var require_constants16 = __commonJS({\n \"src/traces/contour/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n // some constants to help with marching squares algorithm\n // where does the path start for each index?\n BOTTOMSTART: [1, 9, 13, 104, 713],\n TOPSTART: [4, 6, 7, 104, 713],\n LEFTSTART: [8, 12, 14, 208, 1114],\n RIGHTSTART: [2, 3, 11, 208, 1114],\n // which way [dx,dy] do we leave a given index?\n // saddles are already disambiguated\n NEWDELTA: [\n null,\n [-1, 0],\n [0, -1],\n [-1, 0],\n [1, 0],\n null,\n [0, -1],\n [-1, 0],\n [0, 1],\n [0, 1],\n null,\n [0, 1],\n [1, 0],\n [1, 0],\n [0, -1]\n ],\n // for each saddle, the first index here is used\n // for dx||dy<0, the second for dx||dy>0\n CHOOSESADDLE: {\n 104: [4, 1],\n 208: [2, 8],\n 713: [7, 13],\n 1114: [11, 14]\n },\n // after one index has been used for a saddle, which do we\n // substitute to be used up later?\n SADDLEREMAINDER: { 1: 4, 2: 8, 4: 1, 7: 13, 8: 2, 11: 14, 13: 7, 14: 11 },\n // length of a contour, as a multiple of the plot area diagonal, per label\n LABELDISTANCE: 2,\n // number of contour levels after which we start increasing the number of\n // labels we draw. Many contours means they will generally be close\n // together, so it will be harder to follow a long way to find a label\n LABELINCREASE: 10,\n // minimum length of a contour line, as a multiple of the label length,\n // at which we draw *any* labels\n LABELMIN: 3,\n // max number of labels to draw on a single contour path, no matter how long\n LABELMAX: 10,\n // constants for the label position cost function\n LABELOPTIMIZER: {\n // weight given to edge proximity\n EDGECOST: 1,\n // weight given to the angle off horizontal\n ANGLECOST: 1,\n // weight given to distance from already-placed labels\n NEIGHBORCOST: 5,\n // cost multiplier for labels on the same level\n SAMELEVELFACTOR: 10,\n // minimum distance (as a multiple of the label length)\n // for labels on the same level\n SAMELEVELDISTANCE: 5,\n // maximum cost before we won't even place the label\n MAXCOST: 100,\n // number of evenly spaced points to look at in the first\n // iteration of the search\n INITIALSEARCHPOINTS: 10,\n // number of binary search iterations after the initial wide search\n ITERATIONS: 5\n }\n };\n }\n });\n\n // src/traces/contour/make_crossings.js\n var require_make_crossings = __commonJS({\n \"src/traces/contour/make_crossings.js\"(exports, module) {\n \"use strict\";\n var constants = require_constants16();\n module.exports = function makeCrossings(pathinfo) {\n var z = pathinfo[0].z;\n var m = z.length;\n var n = z[0].length;\n var twoWide = m === 2 || n === 2;\n var xi;\n var yi;\n var startIndices;\n var ystartIndices;\n var label;\n var corners;\n var mi;\n var pi;\n var i;\n for (yi = 0; yi < m - 1; yi++) {\n ystartIndices = [];\n if (yi === 0) ystartIndices = ystartIndices.concat(constants.BOTTOMSTART);\n if (yi === m - 2) ystartIndices = ystartIndices.concat(constants.TOPSTART);\n for (xi = 0; xi < n - 1; xi++) {\n startIndices = ystartIndices.slice();\n if (xi === 0) startIndices = startIndices.concat(constants.LEFTSTART);\n if (xi === n - 2) startIndices = startIndices.concat(constants.RIGHTSTART);\n label = xi + \",\" + yi;\n corners = [\n [z[yi][xi], z[yi][xi + 1]],\n [z[yi + 1][xi], z[yi + 1][xi + 1]]\n ];\n for (i = 0; i < pathinfo.length; i++) {\n pi = pathinfo[i];\n mi = getMarchingIndex(pi.level, corners);\n if (!mi) continue;\n pi.crossings[label] = mi;\n if (startIndices.indexOf(mi) !== -1) {\n pi.starts.push([xi, yi]);\n if (twoWide && startIndices.indexOf(\n mi,\n startIndices.indexOf(mi) + 1\n ) !== -1) {\n pi.starts.push([xi, yi]);\n }\n }\n }\n }\n }\n };\n function getMarchingIndex(val, corners) {\n var mi = (corners[0][0] > val ? 0 : 1) + (corners[0][1] > val ? 0 : 2) + (corners[1][1] > val ? 0 : 4) + (corners[1][0] > val ? 0 : 8);\n if (mi === 5 || mi === 10) {\n var avg = (corners[0][0] + corners[0][1] + corners[1][0] + corners[1][1]) / 4;\n if (val > avg) return mi === 5 ? 713 : 1114;\n return mi === 5 ? 104 : 208;\n }\n return mi === 15 ? 0 : mi;\n }\n }\n });\n\n // src/traces/contour/find_all_paths.js\n var require_find_all_paths = __commonJS({\n \"src/traces/contour/find_all_paths.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var constants = require_constants16();\n module.exports = function findAllPaths(pathinfo, xtol, ytol) {\n var cnt, startLoc, i, pi, j;\n xtol = xtol || 0.01;\n ytol = ytol || 0.01;\n for (i = 0; i < pathinfo.length; i++) {\n pi = pathinfo[i];\n for (j = 0; j < pi.starts.length; j++) {\n startLoc = pi.starts[j];\n makePath(pi, startLoc, \"edge\", xtol, ytol);\n }\n cnt = 0;\n while (Object.keys(pi.crossings).length && cnt < 1e4) {\n cnt++;\n startLoc = Object.keys(pi.crossings)[0].split(\",\").map(Number);\n makePath(pi, startLoc, void 0, xtol, ytol);\n }\n if (cnt === 1e4) Lib.log(\"Infinite loop in contour?\");\n }\n };\n function equalPts(pt1, pt2, xtol, ytol) {\n return Math.abs(pt1[0] - pt2[0]) < xtol && Math.abs(pt1[1] - pt2[1]) < ytol;\n }\n function ptDist(pt1, pt2) {\n var dx = pt1[2] - pt2[2];\n var dy = pt1[3] - pt2[3];\n return Math.sqrt(dx * dx + dy * dy);\n }\n function makePath(pi, loc, edgeflag, xtol, ytol) {\n var locStr = loc.join(\",\");\n var mi = pi.crossings[locStr];\n var marchStep = getStartStep(mi, edgeflag, loc);\n var pts = [getInterpPx(pi, loc, [-marchStep[0], -marchStep[1]])];\n var m = pi.z.length;\n var n = pi.z[0].length;\n var startLoc = loc.slice();\n var startStep = marchStep.slice();\n var cnt;\n for (cnt = 0; cnt < 1e4; cnt++) {\n if (mi > 20) {\n mi = constants.CHOOSESADDLE[mi][(marchStep[0] || marchStep[1]) < 0 ? 0 : 1];\n pi.crossings[locStr] = constants.SADDLEREMAINDER[mi];\n } else {\n delete pi.crossings[locStr];\n }\n marchStep = constants.NEWDELTA[mi];\n if (!marchStep) {\n Lib.log(\"Found bad marching index:\", mi, loc, pi.level);\n break;\n }\n pts.push(getInterpPx(pi, loc, marchStep));\n loc[0] += marchStep[0];\n loc[1] += marchStep[1];\n locStr = loc.join(\",\");\n if (equalPts(pts[pts.length - 1], pts[pts.length - 2], xtol, ytol)) pts.pop();\n var atEdge = marchStep[0] && (loc[0] < 0 || loc[0] > n - 2) || marchStep[1] && (loc[1] < 0 || loc[1] > m - 2);\n var closedLoop = loc[0] === startLoc[0] && loc[1] === startLoc[1] && marchStep[0] === startStep[0] && marchStep[1] === startStep[1];\n if (closedLoop || edgeflag && atEdge) break;\n mi = pi.crossings[locStr];\n }\n if (cnt === 1e4) {\n Lib.log(\"Infinite loop in contour?\");\n }\n var closedpath = equalPts(pts[0], pts[pts.length - 1], xtol, ytol);\n var totaldist = 0;\n var distThresholdFactor = 0.2 * pi.smoothing;\n var alldists = [];\n var cropstart = 0;\n var distgroup, cnt2, cnt3, newpt, ptcnt, ptavg, thisdist, i, j, edgepathi, edgepathj;\n for (cnt = 1; cnt < pts.length; cnt++) {\n thisdist = ptDist(pts[cnt], pts[cnt - 1]);\n totaldist += thisdist;\n alldists.push(thisdist);\n }\n var distThreshold = totaldist / alldists.length * distThresholdFactor;\n function getpt(i2) {\n return pts[i2 % pts.length];\n }\n for (cnt = pts.length - 2; cnt >= cropstart; cnt--) {\n distgroup = alldists[cnt];\n if (distgroup < distThreshold) {\n cnt3 = 0;\n for (cnt2 = cnt - 1; cnt2 >= cropstart; cnt2--) {\n if (distgroup + alldists[cnt2] < distThreshold) {\n distgroup += alldists[cnt2];\n } else break;\n }\n if (closedpath && cnt === pts.length - 2) {\n for (cnt3 = 0; cnt3 < cnt2; cnt3++) {\n if (distgroup + alldists[cnt3] < distThreshold) {\n distgroup += alldists[cnt3];\n } else break;\n }\n }\n ptcnt = cnt - cnt2 + cnt3 + 1;\n ptavg = Math.floor((cnt + cnt2 + cnt3 + 2) / 2);\n if (!closedpath && cnt === pts.length - 2) newpt = pts[pts.length - 1];\n else if (!closedpath && cnt2 === -1) newpt = pts[0];\n else if (ptcnt % 2) newpt = getpt(ptavg);\n else {\n newpt = [\n (getpt(ptavg)[0] + getpt(ptavg + 1)[0]) / 2,\n (getpt(ptavg)[1] + getpt(ptavg + 1)[1]) / 2\n ];\n }\n pts.splice(cnt2 + 1, cnt - cnt2 + 1, newpt);\n cnt = cnt2 + 1;\n if (cnt3) cropstart = cnt3;\n if (closedpath) {\n if (cnt === pts.length - 2) pts[cnt3] = pts[pts.length - 1];\n else if (cnt === 0) pts[pts.length - 1] = pts[0];\n }\n }\n }\n pts.splice(0, cropstart);\n for (cnt = 0; cnt < pts.length; cnt++) pts[cnt].length = 2;\n if (pts.length < 2) return;\n else if (closedpath) {\n pts.pop();\n pi.paths.push(pts);\n } else {\n if (!edgeflag) {\n Lib.log(\n \"Unclosed interior contour?\",\n pi.level,\n startLoc.join(\",\"),\n pts.join(\"L\")\n );\n }\n var merged = false;\n for (i = 0; i < pi.edgepaths.length; i++) {\n edgepathi = pi.edgepaths[i];\n if (!merged && equalPts(edgepathi[0], pts[pts.length - 1], xtol, ytol)) {\n pts.pop();\n merged = true;\n var doublemerged = false;\n for (j = 0; j < pi.edgepaths.length; j++) {\n edgepathj = pi.edgepaths[j];\n if (equalPts(edgepathj[edgepathj.length - 1], pts[0], xtol, ytol)) {\n doublemerged = true;\n pts.shift();\n pi.edgepaths.splice(i, 1);\n if (j === i) {\n pi.paths.push(pts.concat(edgepathj));\n } else {\n if (j > i) j--;\n pi.edgepaths[j] = edgepathj.concat(pts, edgepathi);\n }\n break;\n }\n }\n if (!doublemerged) {\n pi.edgepaths[i] = pts.concat(edgepathi);\n }\n }\n }\n for (i = 0; i < pi.edgepaths.length; i++) {\n if (merged) break;\n edgepathi = pi.edgepaths[i];\n if (equalPts(edgepathi[edgepathi.length - 1], pts[0], xtol, ytol)) {\n pts.shift();\n pi.edgepaths[i] = edgepathi.concat(pts);\n merged = true;\n }\n }\n if (!merged) pi.edgepaths.push(pts);\n }\n }\n function getStartStep(mi, edgeflag, loc) {\n var dx = 0;\n var dy = 0;\n if (mi > 20 && edgeflag) {\n if (mi === 208 || mi === 1114) {\n dx = loc[0] === 0 ? 1 : -1;\n } else {\n dy = loc[1] === 0 ? 1 : -1;\n }\n } else if (constants.BOTTOMSTART.indexOf(mi) !== -1) dy = 1;\n else if (constants.LEFTSTART.indexOf(mi) !== -1) dx = 1;\n else if (constants.TOPSTART.indexOf(mi) !== -1) dy = -1;\n else dx = -1;\n return [dx, dy];\n }\n function getInterpPx(pi, loc, step) {\n var locx = loc[0] + Math.max(step[0], 0);\n var locy = loc[1] + Math.max(step[1], 0);\n var zxy = pi.z[locy][locx];\n var xa = pi.xaxis;\n var ya = pi.yaxis;\n if (step[1]) {\n var dx = (pi.level - zxy) / (pi.z[locy][locx + 1] - zxy);\n var dxl = (dx !== 1 ? (1 - dx) * xa.c2l(pi.x[locx]) : 0) + (dx !== 0 ? dx * xa.c2l(pi.x[locx + 1]) : 0);\n return [\n xa.c2p(xa.l2c(dxl), true),\n ya.c2p(pi.y[locy], true),\n locx + dx,\n locy\n ];\n } else {\n var dy = (pi.level - zxy) / (pi.z[locy + 1][locx] - zxy);\n var dyl = (dy !== 1 ? (1 - dy) * ya.c2l(pi.y[locy]) : 0) + (dy !== 0 ? dy * ya.c2l(pi.y[locy + 1]) : 0);\n return [\n xa.c2p(pi.x[locx], true),\n ya.c2p(ya.l2c(dyl), true),\n locx,\n locy + dy\n ];\n }\n }\n }\n });\n\n // src/traces/contour/constraint_mapping.js\n var require_constraint_mapping = __commonJS({\n \"src/traces/contour/constraint_mapping.js\"(exports, module) {\n \"use strict\";\n var filterOps = require_filter_ops();\n var isNumeric = require_fast_isnumeric();\n module.exports = {\n \"[]\": makeRangeSettings(\"[]\"),\n \"][\": makeRangeSettings(\"][\"),\n \">\": makeInequalitySettings(\">\"),\n \"<\": makeInequalitySettings(\"<\"),\n \"=\": makeInequalitySettings(\"=\")\n };\n function coerceValue(operation, value) {\n var hasArrayValue = Array.isArray(value);\n var coercedValue;\n function coerce(value2) {\n return isNumeric(value2) ? +value2 : null;\n }\n if (filterOps.COMPARISON_OPS2.indexOf(operation) !== -1) {\n coercedValue = hasArrayValue ? coerce(value[0]) : coerce(value);\n } else if (filterOps.INTERVAL_OPS.indexOf(operation) !== -1) {\n coercedValue = hasArrayValue ? [coerce(value[0]), coerce(value[1])] : [coerce(value), coerce(value)];\n } else if (filterOps.SET_OPS.indexOf(operation) !== -1) {\n coercedValue = hasArrayValue ? value.map(coerce) : [coerce(value)];\n }\n return coercedValue;\n }\n function makeRangeSettings(operation) {\n return function(value) {\n value = coerceValue(operation, value);\n var min = Math.min(value[0], value[1]);\n var max = Math.max(value[0], value[1]);\n return {\n start: min,\n end: max,\n size: max - min\n };\n };\n }\n function makeInequalitySettings(operation) {\n return function(value) {\n value = coerceValue(operation, value);\n return {\n start: value,\n end: Infinity,\n size: Infinity\n };\n };\n }\n }\n });\n\n // src/traces/contour/empty_pathinfo.js\n var require_empty_pathinfo = __commonJS({\n \"src/traces/contour/empty_pathinfo.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var constraintMapping = require_constraint_mapping();\n var endPlus = require_end_plus();\n module.exports = function emptyPathinfo(contours, plotinfo, cd0) {\n var contoursFinal = contours.type === \"constraint\" ? constraintMapping[contours._operation](contours.value) : contours;\n var cs = contoursFinal.size;\n var pathinfo = [];\n var end = endPlus(contoursFinal);\n var carpet = cd0.trace._carpetTrace;\n var basePathinfo = carpet ? {\n // store axes so we can convert to px\n xaxis: carpet.aaxis,\n yaxis: carpet.baxis,\n // full data arrays to use for interpolation\n x: cd0.a,\n y: cd0.b\n } : {\n xaxis: plotinfo.xaxis,\n yaxis: plotinfo.yaxis,\n x: cd0.x,\n y: cd0.y\n };\n for (var ci = contoursFinal.start; ci < end; ci += cs) {\n pathinfo.push(Lib.extendFlat({\n level: ci,\n // all the cells with nontrivial marching index\n crossings: {},\n // starting points on the edges of the lattice for each contour\n starts: [],\n // all unclosed paths (may have less items than starts,\n // if a path is closed by rounding)\n edgepaths: [],\n // all closed paths\n paths: [],\n z: cd0.z,\n smoothing: cd0.trace.line.smoothing\n }, basePathinfo));\n if (pathinfo.length > 1e3) {\n Lib.warn(\"Too many contours, clipping at 1000\", contours);\n break;\n }\n }\n return pathinfo;\n };\n }\n });\n\n // src/traces/contour/convert_to_constraints.js\n var require_convert_to_constraints = __commonJS({\n \"src/traces/contour/convert_to_constraints.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n module.exports = function(pathinfo, operation) {\n var i, pi0, pi1;\n var op0 = function(arr) {\n return arr.reverse();\n };\n var op1 = function(arr) {\n return arr;\n };\n switch (operation) {\n case \"=\":\n case \"<\":\n return pathinfo;\n case \">\":\n if (pathinfo.length !== 1) {\n Lib.warn(\"Contour data invalid for the specified inequality operation.\");\n }\n pi0 = pathinfo[0];\n for (i = 0; i < pi0.edgepaths.length; i++) {\n pi0.edgepaths[i] = op0(pi0.edgepaths[i]);\n }\n for (i = 0; i < pi0.paths.length; i++) {\n pi0.paths[i] = op0(pi0.paths[i]);\n }\n for (i = 0; i < pi0.starts.length; i++) {\n pi0.starts[i] = op0(pi0.starts[i]);\n }\n return pathinfo;\n case \"][\":\n var tmp = op0;\n op0 = op1;\n op1 = tmp;\n // It's a nice rule, except this definitely *is* what's intended here.\n /* eslint-disable: no-fallthrough */\n case \"[]\":\n if (pathinfo.length !== 2) {\n Lib.warn(\"Contour data invalid for the specified inequality range operation.\");\n }\n pi0 = copyPathinfo(pathinfo[0]);\n pi1 = copyPathinfo(pathinfo[1]);\n for (i = 0; i < pi0.edgepaths.length; i++) {\n pi0.edgepaths[i] = op0(pi0.edgepaths[i]);\n }\n for (i = 0; i < pi0.paths.length; i++) {\n pi0.paths[i] = op0(pi0.paths[i]);\n }\n for (i = 0; i < pi0.starts.length; i++) {\n pi0.starts[i] = op0(pi0.starts[i]);\n }\n while (pi1.edgepaths.length) {\n pi0.edgepaths.push(op1(pi1.edgepaths.shift()));\n }\n while (pi1.paths.length) {\n pi0.paths.push(op1(pi1.paths.shift()));\n }\n while (pi1.starts.length) {\n pi0.starts.push(op1(pi1.starts.shift()));\n }\n return [pi0];\n }\n };\n function copyPathinfo(pi) {\n return Lib.extendFlat({}, pi, {\n edgepaths: Lib.extendDeep([], pi.edgepaths),\n paths: Lib.extendDeep([], pi.paths),\n starts: Lib.extendDeep([], pi.starts)\n });\n }\n }\n });\n\n // src/traces/contour/close_boundaries.js\n var require_close_boundaries = __commonJS({\n \"src/traces/contour/close_boundaries.js\"(exports, module) {\n \"use strict\";\n module.exports = function(pathinfo, contours) {\n var pi0 = pathinfo[0];\n var z = pi0.z;\n var i;\n switch (contours.type) {\n case \"levels\":\n var edgeVal2 = Math.min(z[0][0], z[0][1]);\n for (i = 0; i < pathinfo.length; i++) {\n var pi = pathinfo[i];\n pi.prefixBoundary = !pi.edgepaths.length && (edgeVal2 > pi.level || pi.starts.length && edgeVal2 === pi.level);\n }\n break;\n case \"constraint\":\n pi0.prefixBoundary = false;\n if (pi0.edgepaths.length) return;\n var na = pi0.x.length;\n var nb = pi0.y.length;\n var boundaryMax = -Infinity;\n var boundaryMin = Infinity;\n for (i = 0; i < nb; i++) {\n boundaryMin = Math.min(boundaryMin, z[i][0]);\n boundaryMin = Math.min(boundaryMin, z[i][na - 1]);\n boundaryMax = Math.max(boundaryMax, z[i][0]);\n boundaryMax = Math.max(boundaryMax, z[i][na - 1]);\n }\n for (i = 1; i < na - 1; i++) {\n boundaryMin = Math.min(boundaryMin, z[0][i]);\n boundaryMin = Math.min(boundaryMin, z[nb - 1][i]);\n boundaryMax = Math.max(boundaryMax, z[0][i]);\n boundaryMax = Math.max(boundaryMax, z[nb - 1][i]);\n }\n var contoursValue = contours.value;\n var v1, v2;\n switch (contours._operation) {\n case \">\":\n if (contoursValue > boundaryMax) {\n pi0.prefixBoundary = true;\n }\n break;\n case \"<\":\n if (contoursValue < boundaryMin || pi0.starts.length && contoursValue === boundaryMin) {\n pi0.prefixBoundary = true;\n }\n break;\n case \"[]\":\n v1 = Math.min(contoursValue[0], contoursValue[1]);\n v2 = Math.max(contoursValue[0], contoursValue[1]);\n if (v2 < boundaryMin || v1 > boundaryMax || pi0.starts.length && v2 === boundaryMin) {\n pi0.prefixBoundary = true;\n }\n break;\n case \"][\":\n v1 = Math.min(contoursValue[0], contoursValue[1]);\n v2 = Math.max(contoursValue[0], contoursValue[1]);\n if (v1 < boundaryMin && v2 > boundaryMax) {\n pi0.prefixBoundary = true;\n }\n break;\n }\n break;\n }\n };\n }\n });\n\n // src/traces/contour/plot.js\n var require_plot6 = __commonJS({\n \"src/traces/contour/plot.js\"(exports) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var Drawing = require_drawing();\n var Colorscale = require_colorscale();\n var svgTextUtils = require_svg_text_utils();\n var Axes = require_axes();\n var setConvert = require_set_convert();\n var heatmapPlot = require_plot5();\n var makeCrossings = require_make_crossings();\n var findAllPaths = require_find_all_paths();\n var emptyPathinfo = require_empty_pathinfo();\n var convertToConstraints = require_convert_to_constraints();\n var closeBoundaries = require_close_boundaries();\n var constants = require_constants16();\n var costConstants = constants.LABELOPTIMIZER;\n exports.plot = function plot(gd, plotinfo, cdcontours, contourLayer) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n Lib.makeTraceGroups(contourLayer, cdcontours, \"contour\").each(function(cd) {\n var plotGroup = d3.select(this);\n var cd0 = cd[0];\n var trace = cd0.trace;\n var x = cd0.x;\n var y = cd0.y;\n var contours = trace.contours;\n var pathinfo = emptyPathinfo(contours, plotinfo, cd0);\n var heatmapColoringLayer = Lib.ensureSingle(plotGroup, \"g\", \"heatmapcoloring\");\n var cdheatmaps = [];\n if (contours.coloring === \"heatmap\") {\n cdheatmaps = [cd];\n }\n heatmapPlot(gd, plotinfo, cdheatmaps, heatmapColoringLayer);\n makeCrossings(pathinfo);\n findAllPaths(pathinfo);\n var leftedge = xa.c2p(x[0], true);\n var rightedge = xa.c2p(x[x.length - 1], true);\n var bottomedge = ya.c2p(y[0], true);\n var topedge = ya.c2p(y[y.length - 1], true);\n var perimeter = [\n [leftedge, topedge],\n [rightedge, topedge],\n [rightedge, bottomedge],\n [leftedge, bottomedge]\n ];\n var fillPathinfo = pathinfo;\n if (contours.type === \"constraint\") {\n fillPathinfo = convertToConstraints(pathinfo, contours._operation);\n }\n makeBackground(plotGroup, perimeter, contours);\n makeFills(plotGroup, fillPathinfo, perimeter, contours);\n makeLinesAndLabels(plotGroup, pathinfo, gd, cd0, contours);\n clipGaps(plotGroup, plotinfo, gd, cd0, perimeter);\n });\n };\n function makeBackground(plotgroup, perimeter, contours) {\n var bggroup = Lib.ensureSingle(plotgroup, \"g\", \"contourbg\");\n var bgfill = bggroup.selectAll(\"path\").data(contours.coloring === \"fill\" ? [0] : []);\n bgfill.enter().append(\"path\");\n bgfill.exit().remove();\n bgfill.attr(\"d\", \"M\" + perimeter.join(\"L\") + \"Z\").style(\"stroke\", \"none\");\n }\n function makeFills(plotgroup, pathinfo, perimeter, contours) {\n var hasFills = contours.coloring === \"fill\" || contours.type === \"constraint\" && contours._operation !== \"=\";\n var boundaryPath = \"M\" + perimeter.join(\"L\") + \"Z\";\n if (hasFills) {\n closeBoundaries(pathinfo, contours);\n }\n var fillgroup = Lib.ensureSingle(plotgroup, \"g\", \"contourfill\");\n var fillitems = fillgroup.selectAll(\"path\").data(hasFills ? pathinfo : []);\n fillitems.enter().append(\"path\");\n fillitems.exit().remove();\n fillitems.each(function(pi) {\n var fullpath = (pi.prefixBoundary ? boundaryPath : \"\") + joinAllPaths(pi, perimeter);\n if (!fullpath) {\n d3.select(this).remove();\n } else {\n d3.select(this).attr(\"d\", fullpath).style(\"stroke\", \"none\");\n }\n });\n }\n function joinAllPaths(pi, perimeter) {\n var fullpath = \"\";\n var i = 0;\n var startsleft = pi.edgepaths.map(function(v, i2) {\n return i2;\n });\n var newloop = true;\n var endpt;\n var newendpt;\n var cnt;\n var nexti;\n var possiblei;\n var addpath;\n function istop(pt) {\n return Math.abs(pt[1] - perimeter[0][1]) < 0.01;\n }\n function isbottom(pt) {\n return Math.abs(pt[1] - perimeter[2][1]) < 0.01;\n }\n function isleft(pt) {\n return Math.abs(pt[0] - perimeter[0][0]) < 0.01;\n }\n function isright(pt) {\n return Math.abs(pt[0] - perimeter[2][0]) < 0.01;\n }\n while (startsleft.length) {\n addpath = Drawing.smoothopen(pi.edgepaths[i], pi.smoothing);\n fullpath += newloop ? addpath : addpath.replace(/^M/, \"L\");\n startsleft.splice(startsleft.indexOf(i), 1);\n endpt = pi.edgepaths[i][pi.edgepaths[i].length - 1];\n nexti = -1;\n for (cnt = 0; cnt < 4; cnt++) {\n if (!endpt) {\n Lib.log(\"Missing end?\", i, pi);\n break;\n }\n if (istop(endpt) && !isright(endpt)) newendpt = perimeter[1];\n else if (isleft(endpt)) newendpt = perimeter[0];\n else if (isbottom(endpt)) newendpt = perimeter[3];\n else if (isright(endpt)) newendpt = perimeter[2];\n for (possiblei = 0; possiblei < pi.edgepaths.length; possiblei++) {\n var ptNew = pi.edgepaths[possiblei][0];\n if (Math.abs(endpt[0] - newendpt[0]) < 0.01) {\n if (Math.abs(endpt[0] - ptNew[0]) < 0.01 && (ptNew[1] - endpt[1]) * (newendpt[1] - ptNew[1]) >= 0) {\n newendpt = ptNew;\n nexti = possiblei;\n }\n } else if (Math.abs(endpt[1] - newendpt[1]) < 0.01) {\n if (Math.abs(endpt[1] - ptNew[1]) < 0.01 && (ptNew[0] - endpt[0]) * (newendpt[0] - ptNew[0]) >= 0) {\n newendpt = ptNew;\n nexti = possiblei;\n }\n } else {\n Lib.log(\n \"endpt to newendpt is not vert. or horz.\",\n endpt,\n newendpt,\n ptNew\n );\n }\n }\n endpt = newendpt;\n if (nexti >= 0) break;\n fullpath += \"L\" + newendpt;\n }\n if (nexti === pi.edgepaths.length) {\n Lib.log(\"unclosed perimeter path\");\n break;\n }\n i = nexti;\n newloop = startsleft.indexOf(i) === -1;\n if (newloop) {\n i = startsleft[0];\n fullpath += \"Z\";\n }\n }\n for (i = 0; i < pi.paths.length; i++) {\n fullpath += Drawing.smoothclosed(pi.paths[i], pi.smoothing);\n }\n return fullpath;\n }\n function makeLinesAndLabels(plotgroup, pathinfo, gd, cd0, contours) {\n var isStatic = gd._context.staticPlot;\n var lineContainer = Lib.ensureSingle(plotgroup, \"g\", \"contourlines\");\n var showLines = contours.showlines !== false;\n var showLabels = contours.showlabels;\n var clipLinesForLabels = showLines && showLabels;\n var linegroup = exports.createLines(lineContainer, showLines || showLabels, pathinfo, isStatic);\n var lineClip = exports.createLineClip(lineContainer, clipLinesForLabels, gd, cd0.trace.uid);\n var labelGroup = plotgroup.selectAll(\"g.contourlabels\").data(showLabels ? [0] : []);\n labelGroup.exit().remove();\n labelGroup.enter().append(\"g\").classed(\"contourlabels\", true);\n if (showLabels) {\n var labelClipPathData = [];\n var labelData = [];\n Lib.clearLocationCache();\n var contourFormat = exports.labelFormatter(gd, cd0);\n var dummyText = Drawing.tester.append(\"text\").attr(\"data-notex\", 1).call(Drawing.font, contours.labelfont);\n var xa = pathinfo[0].xaxis;\n var ya = pathinfo[0].yaxis;\n var xLen = xa._length;\n var yLen = ya._length;\n var xRng = xa.range;\n var yRng = ya.range;\n var xMin = Lib.aggNums(Math.min, null, cd0.x);\n var xMax = Lib.aggNums(Math.max, null, cd0.x);\n var yMin = Lib.aggNums(Math.min, null, cd0.y);\n var yMax = Lib.aggNums(Math.max, null, cd0.y);\n var x0 = Math.max(xa.c2p(xMin, true), 0);\n var x1 = Math.min(xa.c2p(xMax, true), xLen);\n var y0 = Math.max(ya.c2p(yMax, true), 0);\n var y1 = Math.min(ya.c2p(yMin, true), yLen);\n var bounds = {};\n if (xRng[0] < xRng[1]) {\n bounds.left = x0;\n bounds.right = x1;\n } else {\n bounds.left = x1;\n bounds.right = x0;\n }\n if (yRng[0] < yRng[1]) {\n bounds.top = y0;\n bounds.bottom = y1;\n } else {\n bounds.top = y1;\n bounds.bottom = y0;\n }\n bounds.middle = (bounds.top + bounds.bottom) / 2;\n bounds.center = (bounds.left + bounds.right) / 2;\n labelClipPathData.push([\n [bounds.left, bounds.top],\n [bounds.right, bounds.top],\n [bounds.right, bounds.bottom],\n [bounds.left, bounds.bottom]\n ]);\n var plotDiagonal = Math.sqrt(xLen * xLen + yLen * yLen);\n var normLength = constants.LABELDISTANCE * plotDiagonal / Math.max(1, pathinfo.length / constants.LABELINCREASE);\n linegroup.each(function(d) {\n var textOpts = exports.calcTextOpts(d.level, contourFormat, dummyText, gd);\n d3.select(this).selectAll(\"path\").each(function() {\n var path = this;\n var pathBounds = Lib.getVisibleSegment(path, bounds, textOpts.height / 2);\n if (!pathBounds) return;\n if (pathBounds.len < (textOpts.width + textOpts.height) * constants.LABELMIN) return;\n var maxLabels = Math.min(\n Math.ceil(pathBounds.len / normLength),\n constants.LABELMAX\n );\n for (var i = 0; i < maxLabels; i++) {\n var loc = exports.findBestTextLocation(\n path,\n pathBounds,\n textOpts,\n labelData,\n bounds\n );\n if (!loc) break;\n exports.addLabelData(loc, textOpts, labelData, labelClipPathData);\n }\n });\n });\n dummyText.remove();\n exports.drawLabels(\n labelGroup,\n labelData,\n gd,\n lineClip,\n clipLinesForLabels ? labelClipPathData : null\n );\n }\n if (showLabels && !showLines) linegroup.remove();\n }\n exports.createLines = function(lineContainer, makeLines, pathinfo, isStatic) {\n var smoothing = pathinfo[0].smoothing;\n var linegroup = lineContainer.selectAll(\"g.contourlevel\").data(makeLines ? pathinfo : []);\n linegroup.exit().remove();\n linegroup.enter().append(\"g\").classed(\"contourlevel\", true);\n if (makeLines) {\n var opencontourlines = linegroup.selectAll(\"path.openline\").data(function(d) {\n return d.pedgepaths || d.edgepaths;\n });\n opencontourlines.exit().remove();\n opencontourlines.enter().append(\"path\").classed(\"openline\", true);\n opencontourlines.attr(\"d\", function(d) {\n return Drawing.smoothopen(d, smoothing);\n }).style(\"stroke-miterlimit\", 1).style(\"vector-effect\", isStatic ? \"none\" : \"non-scaling-stroke\");\n var closedcontourlines = linegroup.selectAll(\"path.closedline\").data(function(d) {\n return d.ppaths || d.paths;\n });\n closedcontourlines.exit().remove();\n closedcontourlines.enter().append(\"path\").classed(\"closedline\", true);\n closedcontourlines.attr(\"d\", function(d) {\n return Drawing.smoothclosed(d, smoothing);\n }).style(\"stroke-miterlimit\", 1).style(\"vector-effect\", isStatic ? \"none\" : \"non-scaling-stroke\");\n }\n return linegroup;\n };\n exports.createLineClip = function(lineContainer, clipLinesForLabels, gd, uid) {\n var clips = gd._fullLayout._clips;\n var clipId = clipLinesForLabels ? \"clipline\" + uid : null;\n var lineClip = clips.selectAll(\"#\" + clipId).data(clipLinesForLabels ? [0] : []);\n lineClip.exit().remove();\n lineClip.enter().append(\"clipPath\").classed(\"contourlineclip\", true).attr(\"id\", clipId);\n Drawing.setClipUrl(lineContainer, clipId, gd);\n return lineClip;\n };\n exports.labelFormatter = function(gd, cd0) {\n var fullLayout = gd._fullLayout;\n var trace = cd0.trace;\n var contours = trace.contours;\n var formatAxis = {\n type: \"linear\",\n _id: \"ycontour\",\n showexponent: \"all\",\n exponentformat: \"B\"\n };\n if (contours.labelformat) {\n formatAxis.tickformat = contours.labelformat;\n setConvert(formatAxis, fullLayout);\n } else {\n var cOpts = Colorscale.extractOpts(trace);\n if (cOpts && cOpts.colorbar && cOpts.colorbar._axis) {\n formatAxis = cOpts.colorbar._axis;\n } else {\n if (contours.type === \"constraint\") {\n var value = contours.value;\n if (Lib.isArrayOrTypedArray(value)) {\n formatAxis.range = [value[0], value[value.length - 1]];\n } else formatAxis.range = [value, value];\n } else {\n formatAxis.range = [contours.start, contours.end];\n formatAxis.nticks = (contours.end - contours.start) / contours.size;\n }\n if (formatAxis.range[0] === formatAxis.range[1]) {\n formatAxis.range[1] += formatAxis.range[0] || 1;\n }\n if (!formatAxis.nticks) formatAxis.nticks = 1e3;\n setConvert(formatAxis, fullLayout);\n Axes.prepTicks(formatAxis);\n formatAxis._tmin = null;\n formatAxis._tmax = null;\n }\n }\n return function(v) {\n return Axes.tickText(formatAxis, v).text;\n };\n };\n exports.calcTextOpts = function(level, contourFormat, dummyText, gd) {\n var text = contourFormat(level);\n dummyText.text(text).call(svgTextUtils.convertToTspans, gd);\n var el = dummyText.node();\n var bBox = Drawing.bBox(el, true);\n return {\n text,\n width: bBox.width,\n height: bBox.height,\n fontSize: +el.style[\"font-size\"].replace(\"px\", \"\"),\n level,\n dy: (bBox.top + bBox.bottom) / 2\n };\n };\n exports.findBestTextLocation = function(path, pathBounds, textOpts, labelData, plotBounds) {\n var textWidth = textOpts.width;\n var p0, dp, pMax, pMin, loc;\n if (pathBounds.isClosed) {\n dp = pathBounds.len / costConstants.INITIALSEARCHPOINTS;\n p0 = pathBounds.min + dp / 2;\n pMax = pathBounds.max;\n } else {\n dp = (pathBounds.len - textWidth) / (costConstants.INITIALSEARCHPOINTS + 1);\n p0 = pathBounds.min + dp + textWidth / 2;\n pMax = pathBounds.max - (dp + textWidth) / 2;\n }\n var cost = Infinity;\n for (var j = 0; j < costConstants.ITERATIONS; j++) {\n for (var p = p0; p < pMax; p += dp) {\n var newLocation = Lib.getTextLocation(path, pathBounds.total, p, textWidth);\n var newCost = locationCost(newLocation, textOpts, labelData, plotBounds);\n if (newCost < cost) {\n cost = newCost;\n loc = newLocation;\n pMin = p;\n }\n }\n if (cost > costConstants.MAXCOST * 2) break;\n if (j) dp /= 2;\n p0 = pMin - dp / 2;\n pMax = p0 + dp * 1.5;\n }\n if (cost <= costConstants.MAXCOST) return loc;\n };\n function locationCost(loc, textOpts, labelData, bounds) {\n var halfWidth = textOpts.width / 2;\n var halfHeight = textOpts.height / 2;\n var x = loc.x;\n var y = loc.y;\n var theta = loc.theta;\n var dx = Math.cos(theta) * halfWidth;\n var dy = Math.sin(theta) * halfWidth;\n var normX = (x > bounds.center ? bounds.right - x : x - bounds.left) / (dx + Math.abs(Math.sin(theta) * halfHeight));\n var normY = (y > bounds.middle ? bounds.bottom - y : y - bounds.top) / (Math.abs(dy) + Math.cos(theta) * halfHeight);\n if (normX < 1 || normY < 1) return Infinity;\n var cost = costConstants.EDGECOST * (1 / (normX - 1) + 1 / (normY - 1));\n cost += costConstants.ANGLECOST * theta * theta;\n var x1 = x - dx;\n var y1 = y - dy;\n var x2 = x + dx;\n var y2 = y + dy;\n for (var i = 0; i < labelData.length; i++) {\n var labeli = labelData[i];\n var dxd = Math.cos(labeli.theta) * labeli.width / 2;\n var dyd = Math.sin(labeli.theta) * labeli.width / 2;\n var dist = Lib.segmentDistance(\n x1,\n y1,\n x2,\n y2,\n labeli.x - dxd,\n labeli.y - dyd,\n labeli.x + dxd,\n labeli.y + dyd\n ) * 2 / (textOpts.height + labeli.height);\n var sameLevel = labeli.level === textOpts.level;\n var distOffset = sameLevel ? costConstants.SAMELEVELDISTANCE : 1;\n if (dist <= distOffset) return Infinity;\n var distFactor = costConstants.NEIGHBORCOST * (sameLevel ? costConstants.SAMELEVELFACTOR : 1);\n cost += distFactor / (dist - distOffset);\n }\n return cost;\n }\n exports.addLabelData = function(loc, textOpts, labelData, labelClipPathData) {\n var fontSize = textOpts.fontSize;\n var w = textOpts.width + fontSize / 3;\n var h = Math.max(0, textOpts.height - fontSize / 3);\n var x = loc.x;\n var y = loc.y;\n var theta = loc.theta;\n var sin = Math.sin(theta);\n var cos = Math.cos(theta);\n var rotateXY = function(dx, dy) {\n return [\n x + dx * cos - dy * sin,\n y + dx * sin + dy * cos\n ];\n };\n var bBoxPts = [\n rotateXY(-w / 2, -h / 2),\n rotateXY(-w / 2, h / 2),\n rotateXY(w / 2, h / 2),\n rotateXY(w / 2, -h / 2)\n ];\n labelData.push({\n text: textOpts.text,\n x,\n y,\n dy: textOpts.dy,\n theta,\n level: textOpts.level,\n width: w,\n height: h\n });\n labelClipPathData.push(bBoxPts);\n };\n exports.drawLabels = function(labelGroup, labelData, gd, lineClip, labelClipPathData) {\n var labels = labelGroup.selectAll(\"text\").data(labelData, function(d) {\n return d.text + \",\" + d.x + \",\" + d.y + \",\" + d.theta;\n });\n labels.exit().remove();\n labels.enter().append(\"text\").attr({\n \"data-notex\": 1,\n \"text-anchor\": \"middle\"\n }).each(function(d) {\n var x = d.x + Math.sin(d.theta) * d.dy;\n var y = d.y - Math.cos(d.theta) * d.dy;\n d3.select(this).text(d.text).attr({\n x,\n y,\n transform: \"rotate(\" + 180 * d.theta / Math.PI + \" \" + x + \" \" + y + \")\"\n }).call(svgTextUtils.convertToTspans, gd);\n });\n if (labelClipPathData) {\n var clipPath = \"\";\n for (var i = 0; i < labelClipPathData.length; i++) {\n clipPath += \"M\" + labelClipPathData[i].join(\"L\") + \"Z\";\n }\n var lineClipPath = Lib.ensureSingle(lineClip, \"path\", \"\");\n lineClipPath.attr(\"d\", clipPath);\n }\n };\n function clipGaps(plotGroup, plotinfo, gd, cd0, perimeter) {\n var trace = cd0.trace;\n var clips = gd._fullLayout._clips;\n var clipId = \"clip\" + trace.uid;\n var clipPath = clips.selectAll(\"#\" + clipId).data(trace.connectgaps ? [] : [0]);\n clipPath.enter().append(\"clipPath\").classed(\"contourclip\", true).attr(\"id\", clipId);\n clipPath.exit().remove();\n if (trace.connectgaps === false) {\n var clipPathInfo = {\n // fraction of the way from missing to present point\n // to draw the boundary.\n // if you make this 1 (or 1-epsilon) then a point in\n // a sea of missing data will disappear entirely.\n level: 0.9,\n crossings: {},\n starts: [],\n edgepaths: [],\n paths: [],\n xaxis: plotinfo.xaxis,\n yaxis: plotinfo.yaxis,\n x: cd0.x,\n y: cd0.y,\n // 0 = no data, 1 = data\n z: makeClipMask(cd0),\n smoothing: 0\n };\n makeCrossings([clipPathInfo]);\n findAllPaths([clipPathInfo]);\n closeBoundaries([clipPathInfo], { type: \"levels\" });\n var path = Lib.ensureSingle(clipPath, \"path\", \"\");\n path.attr(\n \"d\",\n (clipPathInfo.prefixBoundary ? \"M\" + perimeter.join(\"L\") + \"Z\" : \"\") + joinAllPaths(clipPathInfo, perimeter)\n );\n } else clipId = null;\n Drawing.setClipUrl(plotGroup, clipId, gd);\n }\n function makeClipMask(cd0) {\n var empties = cd0.trace._emptypoints;\n var z = [];\n var m = cd0.z.length;\n var n = cd0.z[0].length;\n var i;\n var row = [];\n var emptyPoint;\n for (i = 0; i < n; i++) row.push(1);\n for (i = 0; i < m; i++) z.push(row.slice());\n for (i = 0; i < empties.length; i++) {\n emptyPoint = empties[i];\n z[emptyPoint[0]][emptyPoint[1]] = 0;\n }\n cd0.zmask = z;\n return z;\n }\n }\n });\n\n // src/traces/contour/make_color_map.js\n var require_make_color_map = __commonJS({\n \"src/traces/contour/make_color_map.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Colorscale = require_colorscale();\n var endPlus = require_end_plus();\n module.exports = function makeColorMap(trace) {\n var contours = trace.contours;\n var start = contours.start;\n var end = endPlus(contours);\n var cs = contours.size || 1;\n var nc = Math.floor((end - start) / cs) + 1;\n var extra = contours.coloring === \"lines\" ? 0 : 1;\n var cOpts = Colorscale.extractOpts(trace);\n if (!isFinite(cs)) {\n cs = 1;\n nc = 1;\n }\n var scl = cOpts.reversescale ? Colorscale.flipScale(cOpts.colorscale) : cOpts.colorscale;\n var len = scl.length;\n var domain = new Array(len);\n var range = new Array(len);\n var si, i;\n var zmin0 = cOpts.min;\n var zmax0 = cOpts.max;\n if (contours.coloring === \"heatmap\") {\n for (i = 0; i < len; i++) {\n si = scl[i];\n domain[i] = si[0] * (zmax0 - zmin0) + zmin0;\n range[i] = si[1];\n }\n var zRange = d3.extent([\n zmin0,\n zmax0,\n contours.start,\n contours.start + cs * (nc - 1)\n ]);\n var zmin = zRange[zmin0 < zmax0 ? 0 : 1];\n var zmax = zRange[zmin0 < zmax0 ? 1 : 0];\n if (zmin !== zmin0) {\n domain.splice(0, 0, zmin);\n range.splice(0, 0, range[0]);\n }\n if (zmax !== zmax0) {\n domain.push(zmax);\n range.push(range[range.length - 1]);\n }\n } else {\n var zRangeInput = trace._input && (typeof trace._input.zmin === \"number\" && typeof trace._input.zmax === \"number\");\n if (zRangeInput && (start <= zmin0 || end >= zmax0)) {\n if (start <= zmin0) start = zmin0;\n if (end >= zmax0) end = zmax0;\n nc = Math.floor((end - start) / cs) + 1;\n extra = 0;\n }\n for (i = 0; i < len; i++) {\n si = scl[i];\n domain[i] = (si[0] * (nc + extra - 1) - extra / 2) * cs + start;\n range[i] = si[1];\n }\n if (zRangeInput || trace.autocontour) {\n if (domain[0] > zmin0) {\n domain.unshift(zmin0);\n range.unshift(range[0]);\n }\n if (domain[domain.length - 1] < zmax0) {\n domain.push(zmax0);\n range.push(range[range.length - 1]);\n }\n }\n }\n return Colorscale.makeColorScaleFunc(\n { domain, range },\n { noNumericCheck: true }\n );\n };\n }\n });\n\n // src/traces/contour/style.js\n var require_style7 = __commonJS({\n \"src/traces/contour/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Drawing = require_drawing();\n var heatmapStyle = require_style6();\n var makeColorMap = require_make_color_map();\n module.exports = function style(gd) {\n var contours = d3.select(gd).selectAll(\"g.contour\");\n contours.style(\"opacity\", function(d) {\n return d[0].trace.opacity;\n });\n contours.each(function(d) {\n var c = d3.select(this);\n var trace = d[0].trace;\n var contours2 = trace.contours;\n var line = trace.line;\n var cs = contours2.size || 1;\n var start = contours2.start;\n var isConstraintType = contours2.type === \"constraint\";\n var colorLines = !isConstraintType && contours2.coloring === \"lines\";\n var colorFills = !isConstraintType && contours2.coloring === \"fill\";\n var colorMap = colorLines || colorFills ? makeColorMap(trace) : null;\n c.selectAll(\"g.contourlevel\").each(function(d2) {\n d3.select(this).selectAll(\"path\").call(\n Drawing.lineGroupStyle,\n line.width,\n colorLines ? colorMap(d2.level) : line.color,\n line.dash\n );\n });\n var labelFont = contours2.labelfont;\n c.selectAll(\"g.contourlabels text\").each(function(d2) {\n Drawing.font(d3.select(this), {\n weight: labelFont.weight,\n style: labelFont.style,\n variant: labelFont.variant,\n textcase: labelFont.textcase,\n lineposition: labelFont.lineposition,\n shadow: labelFont.shadow,\n family: labelFont.family,\n size: labelFont.size,\n color: labelFont.color || (colorLines ? colorMap(d2.level) : line.color)\n });\n });\n if (isConstraintType) {\n c.selectAll(\"g.contourfill path\").style(\"fill\", trace.fillcolor);\n } else if (colorFills) {\n var firstFill;\n c.selectAll(\"g.contourfill path\").style(\"fill\", function(d2) {\n if (firstFill === void 0) firstFill = d2.level;\n return colorMap(d2.level + 0.5 * cs);\n });\n if (firstFill === void 0) firstFill = start;\n c.selectAll(\"g.contourbg path\").style(\"fill\", colorMap(firstFill - 0.5 * cs));\n }\n });\n heatmapStyle(gd);\n };\n }\n });\n\n // src/traces/contour/colorbar.js\n var require_colorbar3 = __commonJS({\n \"src/traces/contour/colorbar.js\"(exports, module) {\n \"use strict\";\n var Colorscale = require_colorscale();\n var makeColorMap = require_make_color_map();\n var endPlus = require_end_plus();\n function calc(gd, trace, opts) {\n var contours = trace.contours;\n var line = trace.line;\n var cs = contours.size || 1;\n var coloring = contours.coloring;\n var colorMap = makeColorMap(trace, { isColorbar: true });\n if (coloring === \"heatmap\") {\n var cOpts = Colorscale.extractOpts(trace);\n opts._fillgradient = cOpts.reversescale ? Colorscale.flipScale(cOpts.colorscale) : cOpts.colorscale;\n opts._zrange = [cOpts.min, cOpts.max];\n } else if (coloring === \"fill\") {\n opts._fillcolor = colorMap;\n }\n opts._line = {\n color: coloring === \"lines\" ? colorMap : line.color,\n width: contours.showlines !== false ? line.width : 0,\n dash: line.dash\n };\n opts._levels = {\n start: contours.start,\n end: endPlus(contours),\n size: cs\n };\n }\n module.exports = {\n min: \"zmin\",\n max: \"zmax\",\n calc\n };\n }\n });\n\n // src/traces/contour/hover.js\n var require_hover8 = __commonJS({\n \"src/traces/contour/hover.js\"(exports, module) {\n \"use strict\";\n var Color2 = require_color();\n var heatmapHoverPoints = require_hover5();\n module.exports = function hoverPoints(pointData, xval, yval, hovermode, opts) {\n if (!opts) opts = {};\n opts.isContour = true;\n var hoverData = heatmapHoverPoints(pointData, xval, yval, hovermode, opts);\n if (hoverData) {\n hoverData.forEach(function(hoverPt) {\n var trace = hoverPt.trace;\n if (trace.contours.type === \"constraint\") {\n if (trace.fillcolor && Color2.opacity(trace.fillcolor)) {\n hoverPt.color = Color2.addOpacity(trace.fillcolor, 1);\n } else if (trace.contours.showlines && Color2.opacity(trace.line.color)) {\n hoverPt.color = Color2.addOpacity(trace.line.color, 1);\n }\n }\n });\n }\n return hoverData;\n };\n }\n });\n\n // src/traces/histogram2dcontour/index.js\n var require_histogram2dcontour = __commonJS({\n \"src/traces/histogram2dcontour/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes29(),\n supplyDefaults: require_defaults24(),\n crossTraceDefaults: require_cross_trace_defaults3(),\n calc: require_calc10(),\n plot: require_plot6().plot,\n layerName: \"contourlayer\",\n style: require_style7(),\n colorbar: require_colorbar3(),\n hoverPoints: require_hover8(),\n moduleType: \"trace\",\n name: \"histogram2dcontour\",\n basePlotModule: require_cartesian(),\n categories: [\"cartesian\", \"svg\", \"2dMap\", \"contour\", \"histogram\", \"showLegend\"],\n meta: {}\n };\n }\n });\n\n // lib/histogram2dcontour.js\n var require_histogram2dcontour2 = __commonJS({\n \"lib/histogram2dcontour.js\"(exports, module) {\n \"use strict\";\n module.exports = require_histogram2dcontour();\n }\n });\n\n // src/traces/contour/constraint_defaults.js\n var require_constraint_defaults = __commonJS({\n \"src/traces/contour/constraint_defaults.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var handleLabelDefaults = require_label_defaults2();\n var Color2 = require_color();\n var addOpacity = Color2.addOpacity;\n var opacity = Color2.opacity;\n var filterOps = require_filter_ops();\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n var CONSTRAINT_REDUCTION = filterOps.CONSTRAINT_REDUCTION;\n var COMPARISON_OPS2 = filterOps.COMPARISON_OPS2;\n module.exports = function handleConstraintDefaults(traceIn, traceOut, coerce, layout, defaultColor, opts) {\n var contours = traceOut.contours;\n var showLines, lineColor, fillColor;\n var operation = coerce(\"contours.operation\");\n contours._operation = CONSTRAINT_REDUCTION[operation];\n handleConstraintValueDefaults(coerce, contours);\n if (operation === \"=\") {\n showLines = contours.showlines = true;\n } else {\n showLines = coerce(\"contours.showlines\");\n fillColor = coerce(\"fillcolor\", addOpacity(\n (traceIn.line || {}).color || defaultColor,\n 0.5\n ));\n }\n if (showLines) {\n var lineDfltColor = fillColor && opacity(fillColor) ? addOpacity(traceOut.fillcolor, 1) : defaultColor;\n lineColor = coerce(\"line.color\", lineDfltColor);\n coerce(\"line.width\", 2);\n coerce(\"line.dash\");\n }\n coerce(\"line.smoothing\");\n handleLabelDefaults(coerce, layout, lineColor, opts);\n };\n function handleConstraintValueDefaults(coerce, contours) {\n var zvalue;\n if (COMPARISON_OPS2.indexOf(contours.operation) === -1) {\n coerce(\"contours.value\", [0, 1]);\n if (!isArrayOrTypedArray(contours.value)) {\n if (isNumeric(contours.value)) {\n zvalue = parseFloat(contours.value);\n contours.value = [zvalue, zvalue + 1];\n }\n } else if (contours.value.length > 2) {\n contours.value = contours.value.slice(2);\n } else if (contours.length === 0) {\n contours.value = [0, 1];\n } else if (contours.length < 2) {\n zvalue = parseFloat(contours.value[0]);\n contours.value = [zvalue, zvalue + 1];\n } else {\n contours.value = [\n parseFloat(contours.value[0]),\n parseFloat(contours.value[1])\n ];\n }\n } else {\n coerce(\"contours.value\", 0);\n if (!isNumeric(contours.value)) {\n if (isArrayOrTypedArray(contours.value)) {\n contours.value = parseFloat(contours.value[0]);\n } else {\n contours.value = 0;\n }\n }\n }\n }\n }\n });\n\n // src/traces/contour/defaults.js\n var require_defaults25 = __commonJS({\n \"src/traces/contour/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleXYZDefaults = require_xyz_defaults();\n var handlePeriodDefaults = require_period_defaults();\n var handleConstraintDefaults = require_constraint_defaults();\n var handleContoursDefaults = require_contours_defaults();\n var handleStyleDefaults = require_style_defaults3();\n var handleHeatmapLabelDefaults = require_label_defaults();\n var attributes = require_attributes28();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n function coerce2(attr) {\n return Lib.coerce2(traceIn, traceOut, attributes, attr);\n }\n var len = handleXYZDefaults(traceIn, traceOut, coerce, layout);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n handlePeriodDefaults(traceIn, traceOut, layout, coerce);\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hoverongaps\");\n coerce(\"hovertemplate\");\n var isConstraint = coerce(\"contours.type\") === \"constraint\";\n coerce(\"connectgaps\", Lib.isArray1D(traceOut.z));\n if (isConstraint) {\n handleConstraintDefaults(traceIn, traceOut, coerce, layout, defaultColor);\n } else {\n handleContoursDefaults(traceIn, traceOut, coerce, coerce2);\n handleStyleDefaults(traceIn, traceOut, coerce, layout);\n }\n if (traceOut.contours && traceOut.contours.coloring === \"heatmap\") {\n handleHeatmapLabelDefaults(coerce, layout);\n }\n coerce(\"zorder\");\n };\n }\n });\n\n // src/traces/contour/index.js\n var require_contour = __commonJS({\n \"src/traces/contour/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes28(),\n supplyDefaults: require_defaults25(),\n calc: require_calc10(),\n plot: require_plot6().plot,\n style: require_style7(),\n colorbar: require_colorbar3(),\n hoverPoints: require_hover8(),\n moduleType: \"trace\",\n name: \"contour\",\n basePlotModule: require_cartesian(),\n categories: [\"cartesian\", \"svg\", \"2dMap\", \"contour\", \"showLegend\"],\n meta: {}\n };\n }\n });\n\n // lib/contour.js\n var require_contour2 = __commonJS({\n \"lib/contour.js\"(exports, module) {\n \"use strict\";\n module.exports = require_contour();\n }\n });\n\n // src/traces/scatterternary/attributes.js\n var require_attributes30 = __commonJS({\n \"src/traces/scatterternary/attributes.js\"(exports, module) {\n \"use strict\";\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var makeFillcolorAttr = require_fillcolor_attribute();\n var scatterAttrs = require_attributes12();\n var baseAttrs = require_attributes2();\n var colorScaleAttrs = require_attributes8();\n var dash = require_attributes4().dash;\n var extendFlat = require_extend().extendFlat;\n var scatterMarkerAttrs = scatterAttrs.marker;\n var scatterLineAttrs = scatterAttrs.line;\n var scatterMarkerLineAttrs = scatterMarkerAttrs.line;\n module.exports = {\n a: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n b: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n c: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n sum: {\n valType: \"number\",\n dflt: 0,\n min: 0,\n editType: \"calc\"\n },\n mode: extendFlat({}, scatterAttrs.mode, { dflt: \"markers\" }),\n text: extendFlat({}, scatterAttrs.text, {}),\n texttemplate: texttemplateAttrs({ editType: \"plot\" }, {\n keys: [\"a\", \"b\", \"c\", \"text\"]\n }),\n hovertext: extendFlat({}, scatterAttrs.hovertext, {}),\n line: {\n color: scatterLineAttrs.color,\n width: scatterLineAttrs.width,\n dash,\n backoff: scatterLineAttrs.backoff,\n shape: extendFlat(\n {},\n scatterLineAttrs.shape,\n { values: [\"linear\", \"spline\"] }\n ),\n smoothing: scatterLineAttrs.smoothing,\n editType: \"calc\"\n },\n connectgaps: scatterAttrs.connectgaps,\n cliponaxis: scatterAttrs.cliponaxis,\n fill: extendFlat({}, scatterAttrs.fill, {\n values: [\"none\", \"toself\", \"tonext\"],\n dflt: \"none\"\n }),\n fillcolor: makeFillcolorAttr(),\n marker: extendFlat(\n {\n symbol: scatterMarkerAttrs.symbol,\n opacity: scatterMarkerAttrs.opacity,\n angle: scatterMarkerAttrs.angle,\n angleref: scatterMarkerAttrs.angleref,\n standoff: scatterMarkerAttrs.standoff,\n maxdisplayed: scatterMarkerAttrs.maxdisplayed,\n size: scatterMarkerAttrs.size,\n sizeref: scatterMarkerAttrs.sizeref,\n sizemin: scatterMarkerAttrs.sizemin,\n sizemode: scatterMarkerAttrs.sizemode,\n line: extendFlat(\n {\n width: scatterMarkerLineAttrs.width,\n editType: \"calc\"\n },\n colorScaleAttrs(\"marker.line\")\n ),\n gradient: scatterMarkerAttrs.gradient,\n editType: \"calc\"\n },\n colorScaleAttrs(\"marker\")\n ),\n textfont: scatterAttrs.textfont,\n textposition: scatterAttrs.textposition,\n selected: scatterAttrs.selected,\n unselected: scatterAttrs.unselected,\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: [\"a\", \"b\", \"c\", \"text\", \"name\"]\n }),\n hoveron: scatterAttrs.hoveron,\n hovertemplate: hovertemplateAttrs()\n };\n }\n });\n\n // src/traces/scatterternary/defaults.js\n var require_defaults26 = __commonJS({\n \"src/traces/scatterternary/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var constants = require_constants8();\n var subTypes = require_subtypes();\n var handleMarkerDefaults = require_marker_defaults();\n var handleLineDefaults = require_line_defaults();\n var handleLineShapeDefaults = require_line_shape_defaults();\n var handleTextDefaults = require_text_defaults();\n var handleFillColorDefaults = require_fillcolor_defaults();\n var attributes = require_attributes30();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var a = coerce(\"a\");\n var b = coerce(\"b\");\n var c = coerce(\"c\");\n var len;\n if (a) {\n len = a.length;\n if (b) {\n len = Math.min(len, b.length);\n if (c) len = Math.min(len, c.length);\n } else if (c) len = Math.min(len, c.length);\n else len = 0;\n } else if (b && c) {\n len = Math.min(b.length, c.length);\n }\n if (!len) {\n traceOut.visible = false;\n return;\n }\n traceOut._length = len;\n coerce(\"sum\");\n coerce(\"text\");\n coerce(\"hovertext\");\n if (traceOut.hoveron !== \"fills\") coerce(\"hovertemplate\");\n var defaultMode = len < constants.PTS_LINESONLY ? \"lines+markers\" : \"lines\";\n coerce(\"mode\", defaultMode);\n if (subTypes.hasMarkers(traceOut)) {\n handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, { gradient: true });\n }\n if (subTypes.hasLines(traceOut)) {\n handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce, { backoff: true });\n handleLineShapeDefaults(traceIn, traceOut, coerce);\n coerce(\"connectgaps\");\n }\n if (subTypes.hasText(traceOut)) {\n coerce(\"texttemplate\");\n handleTextDefaults(traceIn, traceOut, layout, coerce);\n }\n var dfltHoverOn = [];\n if (subTypes.hasMarkers(traceOut) || subTypes.hasText(traceOut)) {\n coerce(\"cliponaxis\");\n coerce(\"marker.maxdisplayed\");\n dfltHoverOn.push(\"points\");\n }\n coerce(\"fill\");\n if (traceOut.fill !== \"none\") {\n handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce);\n if (!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce);\n }\n if (traceOut.fill === \"tonext\" || traceOut.fill === \"toself\") {\n dfltHoverOn.push(\"fills\");\n }\n coerce(\"hoveron\", dfltHoverOn.join(\"+\") || \"points\");\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n };\n }\n });\n\n // src/traces/scatterternary/format_labels.js\n var require_format_labels2 = __commonJS({\n \"src/traces/scatterternary/format_labels.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n module.exports = function formatLabels(cdi, trace, fullLayout) {\n var labels = {};\n var subplot = fullLayout[trace.subplot]._subplot;\n labels.aLabel = Axes.tickText(subplot.aaxis, cdi.a, true).text;\n labels.bLabel = Axes.tickText(subplot.baxis, cdi.b, true).text;\n labels.cLabel = Axes.tickText(subplot.caxis, cdi.c, true).text;\n return labels;\n };\n }\n });\n\n // src/traces/scatterternary/calc.js\n var require_calc11 = __commonJS({\n \"src/traces/scatterternary/calc.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var calcColorscale = require_colorscale_calc();\n var arraysToCalcdata = require_arrays_to_calcdata();\n var calcSelection = require_calc_selection();\n var calcMarkerSize = require_calc3().calcMarkerSize;\n var dataArrays = [\"a\", \"b\", \"c\"];\n var arraysToFill = { a: [\"b\", \"c\"], b: [\"a\", \"c\"], c: [\"a\", \"b\"] };\n module.exports = function calc(gd, trace) {\n var ternary = gd._fullLayout[trace.subplot];\n var displaySum = ternary.sum;\n var normSum = trace.sum || displaySum;\n var arrays = { a: trace.a, b: trace.b, c: trace.c };\n var ids = trace.ids;\n var i, j, dataArray, newArray, fillArray1, fillArray2;\n for (i = 0; i < dataArrays.length; i++) {\n dataArray = dataArrays[i];\n if (arrays[dataArray]) continue;\n fillArray1 = arrays[arraysToFill[dataArray][0]];\n fillArray2 = arrays[arraysToFill[dataArray][1]];\n newArray = new Array(fillArray1.length);\n for (j = 0; j < fillArray1.length; j++) {\n newArray[j] = normSum - fillArray1[j] - fillArray2[j];\n }\n arrays[dataArray] = newArray;\n }\n var serieslen = trace._length;\n var cd = new Array(serieslen);\n var a, b, c, norm, x, y;\n for (i = 0; i < serieslen; i++) {\n a = arrays.a[i];\n b = arrays.b[i];\n c = arrays.c[i];\n if (isNumeric(a) && isNumeric(b) && isNumeric(c)) {\n a = +a;\n b = +b;\n c = +c;\n norm = displaySum / (a + b + c);\n if (norm !== 1) {\n a *= norm;\n b *= norm;\n c *= norm;\n }\n y = a;\n x = c - b;\n cd[i] = { x, y, a, b, c };\n if (ids) {\n cd[i].id = ids[i];\n }\n } else cd[i] = { x: false, y: false };\n }\n calcMarkerSize(trace, serieslen);\n calcColorscale(gd, trace);\n arraysToCalcdata(cd, trace);\n calcSelection(cd, trace);\n return cd;\n };\n }\n });\n\n // src/traces/scatterternary/plot.js\n var require_plot7 = __commonJS({\n \"src/traces/scatterternary/plot.js\"(exports, module) {\n \"use strict\";\n var scatterPlot = require_plot();\n module.exports = function plot(gd, ternary, moduleCalcData) {\n var plotContainer = ternary.plotContainer;\n plotContainer.select(\".scatterlayer\").selectAll(\"*\").remove();\n var xa = ternary.xaxis;\n var ya = ternary.yaxis;\n var plotinfo = {\n xaxis: xa,\n yaxis: ya,\n plot: plotContainer,\n layerClipId: ternary._hasClipOnAxisFalse ? ternary.clipIdRelative : null\n };\n var scatterLayer = ternary.layers.frontplot.select(\"g.scatterlayer\");\n for (var i = 0; i < moduleCalcData.length; i++) {\n var cdi = moduleCalcData[i];\n if (cdi.length) {\n cdi[0].trace._xA = xa;\n cdi[0].trace._yA = ya;\n }\n }\n scatterPlot(gd, plotinfo, moduleCalcData, scatterLayer);\n };\n }\n });\n\n // src/traces/scatterternary/hover.js\n var require_hover9 = __commonJS({\n \"src/traces/scatterternary/hover.js\"(exports, module) {\n \"use strict\";\n var scatterHover = require_hover2();\n module.exports = function hoverPoints(pointData, xval, yval, hovermode) {\n var scatterPointData = scatterHover(pointData, xval, yval, hovermode);\n if (!scatterPointData || scatterPointData[0].index === false) return;\n var newPointData = scatterPointData[0];\n if (newPointData.index === void 0) {\n var yFracUp = 1 - newPointData.y0 / pointData.ya._length;\n var xLen = pointData.xa._length;\n var xMin = xLen * yFracUp / 2;\n var xMax = xLen - xMin;\n newPointData.x0 = Math.max(Math.min(newPointData.x0, xMax), xMin);\n newPointData.x1 = Math.max(Math.min(newPointData.x1, xMax), xMin);\n return scatterPointData;\n }\n var cdi = newPointData.cd[newPointData.index];\n var trace = newPointData.trace;\n var subplot = newPointData.subplot;\n newPointData.a = cdi.a;\n newPointData.b = cdi.b;\n newPointData.c = cdi.c;\n newPointData.xLabelVal = void 0;\n newPointData.yLabelVal = void 0;\n var fullLayout = {};\n fullLayout[trace.subplot] = { _subplot: subplot };\n var labels = trace._module.formatLabels(cdi, trace, fullLayout);\n newPointData.aLabel = labels.aLabel;\n newPointData.bLabel = labels.bLabel;\n newPointData.cLabel = labels.cLabel;\n var hoverinfo = cdi.hi || trace.hoverinfo;\n var text = [];\n function textPart(ax, val) {\n text.push(ax._hovertitle + \": \" + val);\n }\n if (!trace.hovertemplate) {\n var parts = hoverinfo.split(\"+\");\n if (parts.indexOf(\"all\") !== -1) parts = [\"a\", \"b\", \"c\"];\n if (parts.indexOf(\"a\") !== -1) textPart(subplot.aaxis, newPointData.aLabel);\n if (parts.indexOf(\"b\") !== -1) textPart(subplot.baxis, newPointData.bLabel);\n if (parts.indexOf(\"c\") !== -1) textPart(subplot.caxis, newPointData.cLabel);\n }\n newPointData.extraText = text.join(\"
    \");\n newPointData.hovertemplate = trace.hovertemplate;\n return scatterPointData;\n };\n }\n });\n\n // src/traces/scatterternary/event_data.js\n var require_event_data4 = __commonJS({\n \"src/traces/scatterternary/event_data.js\"(exports, module) {\n \"use strict\";\n module.exports = function eventData(out, pt, trace, cd, pointNumber) {\n if (pt.xa) out.xaxis = pt.xa;\n if (pt.ya) out.yaxis = pt.ya;\n if (cd[pointNumber]) {\n var cdi = cd[pointNumber];\n out.a = cdi.a;\n out.b = cdi.b;\n out.c = cdi.c;\n } else {\n out.a = pt.a;\n out.b = pt.b;\n out.c = pt.c;\n }\n return out;\n };\n }\n });\n\n // src/plots/ternary/ternary.js\n var require_ternary = __commonJS({\n \"src/plots/ternary/ternary.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var tinycolor = require_tinycolor();\n var Registry = require_registry();\n var Lib = require_lib();\n var strTranslate = Lib.strTranslate;\n var _ = Lib._;\n var Color2 = require_color();\n var Drawing = require_drawing();\n var setConvert = require_set_convert();\n var extendFlat = require_extend().extendFlat;\n var Plots = require_plots();\n var Axes = require_axes();\n var dragElement = require_dragelement();\n var Fx = require_fx();\n var dragHelpers = require_helpers5();\n var freeMode = dragHelpers.freeMode;\n var rectMode = dragHelpers.rectMode;\n var Titles = require_titles();\n var prepSelect = require_selections().prepSelect;\n var selectOnClick = require_selections().selectOnClick;\n var clearOutline = require_selections().clearOutline;\n var clearSelectionsCache = require_selections().clearSelectionsCache;\n var constants = require_constants2();\n function Ternary(options, fullLayout) {\n this.id = options.id;\n this.graphDiv = options.graphDiv;\n this.init(fullLayout);\n this.makeFramework(fullLayout);\n this.updateFx(fullLayout);\n this.aTickLayout = null;\n this.bTickLayout = null;\n this.cTickLayout = null;\n }\n module.exports = Ternary;\n var proto = Ternary.prototype;\n proto.init = function(fullLayout) {\n this.container = fullLayout._ternarylayer;\n this.defs = fullLayout._defs;\n this.layoutId = fullLayout._uid;\n this.traceHash = {};\n this.layers = {};\n };\n proto.plot = function(ternaryCalcData, fullLayout) {\n var _this = this;\n var ternaryLayout = fullLayout[_this.id];\n var graphSize = fullLayout._size;\n _this._hasClipOnAxisFalse = false;\n for (var i = 0; i < ternaryCalcData.length; i++) {\n var trace = ternaryCalcData[i][0].trace;\n if (trace.cliponaxis === false) {\n _this._hasClipOnAxisFalse = true;\n break;\n }\n }\n _this.updateLayers(ternaryLayout);\n _this.adjustLayout(ternaryLayout, graphSize);\n Plots.generalUpdatePerTraceModule(_this.graphDiv, _this, ternaryCalcData, ternaryLayout);\n _this.layers.plotbg.select(\"path\").call(Color2.fill, ternaryLayout.bgcolor);\n };\n proto.makeFramework = function(fullLayout) {\n var _this = this;\n var gd = _this.graphDiv;\n var ternaryLayout = fullLayout[_this.id];\n var clipId = _this.clipId = \"clip\" + _this.layoutId + _this.id;\n var clipIdRelative = _this.clipIdRelative = \"clip-relative\" + _this.layoutId + _this.id;\n _this.clipDef = Lib.ensureSingleById(fullLayout._clips, \"clipPath\", clipId, function(s) {\n s.append(\"path\").attr(\"d\", \"M0,0Z\");\n });\n _this.clipDefRelative = Lib.ensureSingleById(fullLayout._clips, \"clipPath\", clipIdRelative, function(s) {\n s.append(\"path\").attr(\"d\", \"M0,0Z\");\n });\n _this.plotContainer = Lib.ensureSingle(_this.container, \"g\", _this.id);\n _this.updateLayers(ternaryLayout);\n Drawing.setClipUrl(_this.layers.backplot, clipId, gd);\n Drawing.setClipUrl(_this.layers.grids, clipId, gd);\n };\n proto.updateFx = function(fullLayout) {\n fullLayout._ternarylayer.selectAll(\"g.toplevel\").style(\"cursor\", fullLayout.dragmode === \"pan\" ? \"move\" : \"crosshair\");\n };\n proto.updateLayers = function(ternaryLayout) {\n var _this = this;\n var layers = _this.layers;\n var plotLayers = [\"draglayer\", \"plotbg\", \"backplot\", \"grids\"];\n if (ternaryLayout.aaxis.layer === \"below traces\") {\n plotLayers.push(\"aaxis\", \"aline\");\n }\n if (ternaryLayout.baxis.layer === \"below traces\") {\n plotLayers.push(\"baxis\", \"bline\");\n }\n if (ternaryLayout.caxis.layer === \"below traces\") {\n plotLayers.push(\"caxis\", \"cline\");\n }\n plotLayers.push(\"frontplot\");\n if (ternaryLayout.aaxis.layer === \"above traces\") {\n plotLayers.push(\"aaxis\", \"aline\");\n }\n if (ternaryLayout.baxis.layer === \"above traces\") {\n plotLayers.push(\"baxis\", \"bline\");\n }\n if (ternaryLayout.caxis.layer === \"above traces\") {\n plotLayers.push(\"caxis\", \"cline\");\n }\n var toplevel = _this.plotContainer.selectAll(\"g.toplevel\").data(plotLayers, String);\n var grids = [\"agrid\", \"bgrid\", \"cgrid\"];\n toplevel.enter().append(\"g\").attr(\"class\", function(d) {\n return \"toplevel \" + d;\n }).each(function(d) {\n var s = d3.select(this);\n layers[d] = s;\n if (d === \"frontplot\") {\n s.append(\"g\").classed(\"scatterlayer\", true);\n } else if (d === \"backplot\") {\n s.append(\"g\").classed(\"maplayer\", true);\n } else if (d === \"plotbg\") {\n s.append(\"path\").attr(\"d\", \"M0,0Z\");\n } else if (d === \"aline\" || d === \"bline\" || d === \"cline\") {\n s.append(\"path\");\n } else if (d === \"grids\") {\n grids.forEach(function(d2) {\n layers[d2] = s.append(\"g\").classed(\"grid \" + d2, true);\n });\n }\n });\n toplevel.order();\n };\n var whRatio = Math.sqrt(4 / 3);\n proto.adjustLayout = function(ternaryLayout, graphSize) {\n var _this = this;\n var domain = ternaryLayout.domain;\n var xDomainCenter = (domain.x[0] + domain.x[1]) / 2;\n var yDomainCenter = (domain.y[0] + domain.y[1]) / 2;\n var xDomain = domain.x[1] - domain.x[0];\n var yDomain = domain.y[1] - domain.y[0];\n var wmax = xDomain * graphSize.w;\n var hmax = yDomain * graphSize.h;\n var sum = ternaryLayout.sum;\n var amin = ternaryLayout.aaxis.min;\n var bmin = ternaryLayout.baxis.min;\n var cmin = ternaryLayout.caxis.min;\n var x0, y0, w, h, xDomainFinal, yDomainFinal;\n if (wmax > whRatio * hmax) {\n h = hmax;\n w = h * whRatio;\n } else {\n w = wmax;\n h = w / whRatio;\n }\n xDomainFinal = xDomain * w / wmax;\n yDomainFinal = yDomain * h / hmax;\n x0 = graphSize.l + graphSize.w * xDomainCenter - w / 2;\n y0 = graphSize.t + graphSize.h * (1 - yDomainCenter) - h / 2;\n _this.x0 = x0;\n _this.y0 = y0;\n _this.w = w;\n _this.h = h;\n _this.sum = sum;\n _this.xaxis = {\n type: \"linear\",\n range: [amin + 2 * cmin - sum, sum - amin - 2 * bmin],\n domain: [\n xDomainCenter - xDomainFinal / 2,\n xDomainCenter + xDomainFinal / 2\n ],\n _id: \"x\"\n };\n setConvert(_this.xaxis, _this.graphDiv._fullLayout);\n _this.xaxis.setScale();\n _this.xaxis.isPtWithinRange = function(d) {\n return d.a >= _this.aaxis.range[0] && d.a <= _this.aaxis.range[1] && d.b >= _this.baxis.range[1] && d.b <= _this.baxis.range[0] && d.c >= _this.caxis.range[1] && d.c <= _this.caxis.range[0];\n };\n _this.yaxis = {\n type: \"linear\",\n range: [amin, sum - bmin - cmin],\n domain: [\n yDomainCenter - yDomainFinal / 2,\n yDomainCenter + yDomainFinal / 2\n ],\n _id: \"y\"\n };\n setConvert(_this.yaxis, _this.graphDiv._fullLayout);\n _this.yaxis.setScale();\n _this.yaxis.isPtWithinRange = function() {\n return true;\n };\n var yDomain0 = _this.yaxis.domain[0];\n var aaxis = _this.aaxis = extendFlat({}, ternaryLayout.aaxis, {\n range: [amin, sum - bmin - cmin],\n side: \"left\",\n // tickangle = 'auto' means 0 anyway for a y axis, need to coerce to 0 here\n // so we can shift by 30.\n tickangle: (+ternaryLayout.aaxis.tickangle || 0) - 30,\n domain: [yDomain0, yDomain0 + yDomainFinal * whRatio],\n anchor: \"free\",\n position: 0,\n _id: \"y\",\n _length: w\n });\n setConvert(aaxis, _this.graphDiv._fullLayout);\n aaxis.setScale();\n var baxis = _this.baxis = extendFlat({}, ternaryLayout.baxis, {\n range: [sum - amin - cmin, bmin],\n side: \"bottom\",\n domain: _this.xaxis.domain,\n anchor: \"free\",\n position: 0,\n _id: \"x\",\n _length: w\n });\n setConvert(baxis, _this.graphDiv._fullLayout);\n baxis.setScale();\n var caxis = _this.caxis = extendFlat({}, ternaryLayout.caxis, {\n range: [sum - amin - bmin, cmin],\n side: \"right\",\n tickangle: (+ternaryLayout.caxis.tickangle || 0) + 30,\n domain: [yDomain0, yDomain0 + yDomainFinal * whRatio],\n anchor: \"free\",\n position: 0,\n _id: \"y\",\n _length: w\n });\n setConvert(caxis, _this.graphDiv._fullLayout);\n caxis.setScale();\n var triangleClip = \"M\" + x0 + \",\" + (y0 + h) + \"h\" + w + \"l-\" + w / 2 + \",-\" + h + \"Z\";\n _this.clipDef.select(\"path\").attr(\"d\", triangleClip);\n _this.layers.plotbg.select(\"path\").attr(\"d\", triangleClip);\n var triangleClipRelative = \"M0,\" + h + \"h\" + w + \"l-\" + w / 2 + \",-\" + h + \"Z\";\n _this.clipDefRelative.select(\"path\").attr(\"d\", triangleClipRelative);\n var plotTransform = strTranslate(x0, y0);\n _this.plotContainer.selectAll(\".scatterlayer,.maplayer\").attr(\"transform\", plotTransform);\n _this.clipDefRelative.select(\"path\").attr(\"transform\", null);\n var bTransform = strTranslate(x0 - baxis._offset, y0 + h);\n _this.layers.baxis.attr(\"transform\", bTransform);\n _this.layers.bgrid.attr(\"transform\", bTransform);\n var aTransform = strTranslate(x0 + w / 2, y0) + \"rotate(30)\" + strTranslate(0, -aaxis._offset);\n _this.layers.aaxis.attr(\"transform\", aTransform);\n _this.layers.agrid.attr(\"transform\", aTransform);\n var cTransform = strTranslate(x0 + w / 2, y0) + \"rotate(-30)\" + strTranslate(0, -caxis._offset);\n _this.layers.caxis.attr(\"transform\", cTransform);\n _this.layers.cgrid.attr(\"transform\", cTransform);\n _this.drawAxes(true);\n _this.layers.aline.select(\"path\").attr(\"d\", aaxis.showline ? \"M\" + x0 + \",\" + (y0 + h) + \"l\" + w / 2 + \",-\" + h : \"M0,0\").call(Color2.stroke, aaxis.linecolor || \"#000\").style(\"stroke-width\", (aaxis.linewidth || 0) + \"px\");\n _this.layers.bline.select(\"path\").attr(\"d\", baxis.showline ? \"M\" + x0 + \",\" + (y0 + h) + \"h\" + w : \"M0,0\").call(Color2.stroke, baxis.linecolor || \"#000\").style(\"stroke-width\", (baxis.linewidth || 0) + \"px\");\n _this.layers.cline.select(\"path\").attr(\"d\", caxis.showline ? \"M\" + (x0 + w / 2) + \",\" + y0 + \"l\" + w / 2 + \",\" + h : \"M0,0\").call(Color2.stroke, caxis.linecolor || \"#000\").style(\"stroke-width\", (caxis.linewidth || 0) + \"px\");\n if (!_this.graphDiv._context.staticPlot) {\n _this.initInteractions();\n }\n Drawing.setClipUrl(\n _this.layers.frontplot,\n _this._hasClipOnAxisFalse ? null : _this.clipId,\n _this.graphDiv\n );\n };\n proto.drawAxes = function(doTitles) {\n var _this = this;\n var gd = _this.graphDiv;\n var titlesuffix = _this.id.substr(7) + \"title\";\n var layers = _this.layers;\n var aaxis = _this.aaxis;\n var baxis = _this.baxis;\n var caxis = _this.caxis;\n _this.drawAx(aaxis);\n _this.drawAx(baxis);\n _this.drawAx(caxis);\n if (doTitles) {\n var apad = Math.max(\n aaxis.showticklabels ? aaxis.tickfont.size / 2 : 0,\n (caxis.showticklabels ? caxis.tickfont.size * 0.75 : 0) + (caxis.ticks === \"outside\" ? caxis.ticklen * 0.87 : 0)\n );\n var bpad = (baxis.showticklabels ? baxis.tickfont.size : 0) + (baxis.ticks === \"outside\" ? baxis.ticklen : 0) + 3;\n layers[\"a-title\"] = Titles.draw(gd, \"a\" + titlesuffix, {\n propContainer: aaxis,\n propName: _this.id + \".aaxis.title\",\n placeholder: _(gd, \"Click to enter Component A title\"),\n attributes: {\n x: _this.x0 + _this.w / 2,\n y: _this.y0 - aaxis.title.font.size / 3 - apad,\n \"text-anchor\": \"middle\"\n }\n });\n layers[\"b-title\"] = Titles.draw(gd, \"b\" + titlesuffix, {\n propContainer: baxis,\n propName: _this.id + \".baxis.title\",\n placeholder: _(gd, \"Click to enter Component B title\"),\n attributes: {\n x: _this.x0 - bpad,\n y: _this.y0 + _this.h + baxis.title.font.size * 0.83 + bpad,\n \"text-anchor\": \"middle\"\n }\n });\n layers[\"c-title\"] = Titles.draw(gd, \"c\" + titlesuffix, {\n propContainer: caxis,\n propName: _this.id + \".caxis.title\",\n placeholder: _(gd, \"Click to enter Component C title\"),\n attributes: {\n x: _this.x0 + _this.w + bpad,\n y: _this.y0 + _this.h + caxis.title.font.size * 0.83 + bpad,\n \"text-anchor\": \"middle\"\n }\n });\n }\n };\n proto.drawAx = function(ax) {\n var _this = this;\n var gd = _this.graphDiv;\n var axName = ax._name;\n var axLetter = axName.charAt(0);\n var axId = ax._id;\n var axLayer = _this.layers[axName];\n var counterAngle = 30;\n var stashKey = axLetter + \"tickLayout\";\n var newTickLayout = strTickLayout(ax);\n if (_this[stashKey] !== newTickLayout) {\n axLayer.selectAll(\".\" + axId + \"tick\").remove();\n _this[stashKey] = newTickLayout;\n }\n ax.setScale();\n var vals = Axes.calcTicks(ax);\n var valsClipped = Axes.clipEnds(ax, vals);\n var transFn = Axes.makeTransTickFn(ax);\n var tickSign = Axes.getTickSigns(ax)[2];\n var caRad = Lib.deg2rad(counterAngle);\n var pad = tickSign * (ax.linewidth || 1) / 2;\n var len = tickSign * ax.ticklen;\n var w = _this.w;\n var h = _this.h;\n var tickPath = axLetter === \"b\" ? \"M0,\" + pad + \"l\" + Math.sin(caRad) * len + \",\" + Math.cos(caRad) * len : \"M\" + pad + \",0l\" + Math.cos(caRad) * len + \",\" + -Math.sin(caRad) * len;\n var gridPath = {\n a: \"M0,0l\" + h + \",-\" + w / 2,\n b: \"M0,0l-\" + w / 2 + \",-\" + h,\n c: \"M0,0l-\" + h + \",\" + w / 2\n }[axLetter];\n Axes.drawTicks(gd, ax, {\n vals: ax.ticks === \"inside\" ? valsClipped : vals,\n layer: axLayer,\n path: tickPath,\n transFn,\n crisp: false\n });\n Axes.drawGrid(gd, ax, {\n vals: valsClipped,\n layer: _this.layers[axLetter + \"grid\"],\n path: gridPath,\n transFn,\n crisp: false\n });\n Axes.drawLabels(gd, ax, {\n vals,\n layer: axLayer,\n transFn,\n labelFns: Axes.makeLabelFns(ax, 0, counterAngle)\n });\n };\n function strTickLayout(axLayout) {\n return axLayout.ticks + String(axLayout.ticklen) + String(axLayout.showticklabels);\n }\n var CLEN = constants.MINZOOM / 2 + 0.87;\n var BLPATH = \"m-0.87,.5h\" + CLEN + \"v3h-\" + (CLEN + 5.2) + \"l\" + (CLEN / 2 + 2.6) + \",-\" + (CLEN * 0.87 + 4.5) + \"l2.6,1.5l-\" + CLEN / 2 + \",\" + CLEN * 0.87 + \"Z\";\n var BRPATH = \"m0.87,.5h-\" + CLEN + \"v3h\" + (CLEN + 5.2) + \"l-\" + (CLEN / 2 + 2.6) + \",-\" + (CLEN * 0.87 + 4.5) + \"l-2.6,1.5l\" + CLEN / 2 + \",\" + CLEN * 0.87 + \"Z\";\n var TOPPATH = \"m0,1l\" + CLEN / 2 + \",\" + CLEN * 0.87 + \"l2.6,-1.5l-\" + (CLEN / 2 + 2.6) + \",-\" + (CLEN * 0.87 + 4.5) + \"l-\" + (CLEN / 2 + 2.6) + \",\" + (CLEN * 0.87 + 4.5) + \"l2.6,1.5l\" + CLEN / 2 + \",-\" + CLEN * 0.87 + \"Z\";\n var STARTMARKER = \"m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z\";\n var SHOWZOOMOUTTIP = true;\n proto.clearOutline = function() {\n clearSelectionsCache(this.dragOptions);\n clearOutline(this.dragOptions.gd);\n };\n proto.initInteractions = function() {\n var _this = this;\n var dragger = _this.layers.plotbg.select(\"path\").node();\n var gd = _this.graphDiv;\n var zoomLayer = gd._fullLayout._zoomlayer;\n var scaleX;\n var scaleY;\n this.dragOptions = {\n element: dragger,\n gd,\n plotinfo: {\n id: _this.id,\n domain: gd._fullLayout[_this.id].domain,\n xaxis: _this.xaxis,\n yaxis: _this.yaxis\n },\n subplot: _this.id,\n prepFn: function(e, startX, startY) {\n _this.dragOptions.xaxes = [_this.xaxis];\n _this.dragOptions.yaxes = [_this.yaxis];\n scaleX = gd._fullLayout._invScaleX;\n scaleY = gd._fullLayout._invScaleY;\n var dragModeNow = _this.dragOptions.dragmode = gd._fullLayout.dragmode;\n if (freeMode(dragModeNow)) _this.dragOptions.minDrag = 1;\n else _this.dragOptions.minDrag = void 0;\n if (dragModeNow === \"zoom\") {\n _this.dragOptions.moveFn = zoomMove;\n _this.dragOptions.clickFn = clickZoomPan;\n _this.dragOptions.doneFn = zoomDone;\n zoomPrep(e, startX, startY);\n } else if (dragModeNow === \"pan\") {\n _this.dragOptions.moveFn = plotDrag;\n _this.dragOptions.clickFn = clickZoomPan;\n _this.dragOptions.doneFn = dragDone;\n panPrep();\n _this.clearOutline(gd);\n } else if (rectMode(dragModeNow) || freeMode(dragModeNow)) {\n prepSelect(e, startX, startY, _this.dragOptions, dragModeNow);\n }\n }\n };\n var x0, y0, mins0, span0, mins, lum, path0, dimmed, zb, corners;\n function makeUpdate(_mins) {\n var attrs = {};\n attrs[_this.id + \".aaxis.min\"] = _mins.a;\n attrs[_this.id + \".baxis.min\"] = _mins.b;\n attrs[_this.id + \".caxis.min\"] = _mins.c;\n return attrs;\n }\n function clickZoomPan(numClicks, evt) {\n var clickMode = gd._fullLayout.clickmode;\n removeZoombox(gd);\n if (numClicks === 2) {\n gd.emit(\"plotly_doubleclick\", null);\n Registry.call(\"_guiRelayout\", gd, makeUpdate({ a: 0, b: 0, c: 0 }));\n }\n if (clickMode.indexOf(\"select\") > -1 && numClicks === 1) {\n selectOnClick(evt, gd, [_this.xaxis], [_this.yaxis], _this.id, _this.dragOptions);\n }\n if (clickMode.indexOf(\"event\") > -1) {\n Fx.click(gd, evt, _this.id);\n }\n }\n function zoomPrep(e, startX, startY) {\n var dragBBox = dragger.getBoundingClientRect();\n x0 = startX - dragBBox.left;\n y0 = startY - dragBBox.top;\n gd._fullLayout._calcInverseTransform(gd);\n var inverse = gd._fullLayout._invTransform;\n var transformedCoords = Lib.apply3DTransform(inverse)(x0, y0);\n x0 = transformedCoords[0];\n y0 = transformedCoords[1];\n mins0 = {\n a: _this.aaxis.range[0],\n b: _this.baxis.range[1],\n c: _this.caxis.range[1]\n };\n mins = mins0;\n span0 = _this.aaxis.range[1] - mins0.a;\n lum = tinycolor(_this.graphDiv._fullLayout[_this.id].bgcolor).getLuminance();\n path0 = \"M0,\" + _this.h + \"L\" + _this.w / 2 + \", 0L\" + _this.w + \",\" + _this.h + \"Z\";\n dimmed = false;\n zb = zoomLayer.append(\"path\").attr(\"class\", \"zoombox\").attr(\"transform\", strTranslate(_this.x0, _this.y0)).style({\n fill: lum > 0.2 ? \"rgba(0,0,0,0)\" : \"rgba(255,255,255,0)\",\n \"stroke-width\": 0\n }).attr(\"d\", path0);\n corners = zoomLayer.append(\"path\").attr(\"class\", \"zoombox-corners\").attr(\"transform\", strTranslate(_this.x0, _this.y0)).style({\n fill: Color2.background,\n stroke: Color2.defaultLine,\n \"stroke-width\": 1,\n opacity: 0\n }).attr(\"d\", \"M0,0Z\");\n _this.clearOutline(gd);\n }\n function getAFrac(x, y) {\n return 1 - y / _this.h;\n }\n function getBFrac(x, y) {\n return 1 - (x + (_this.h - y) / Math.sqrt(3)) / _this.w;\n }\n function getCFrac(x, y) {\n return (x - (_this.h - y) / Math.sqrt(3)) / _this.w;\n }\n function zoomMove(dx0, dy0) {\n var x1 = x0 + dx0 * scaleX;\n var y1 = y0 + dy0 * scaleY;\n var afrac = Math.max(0, Math.min(1, getAFrac(x0, y0), getAFrac(x1, y1)));\n var bfrac = Math.max(0, Math.min(1, getBFrac(x0, y0), getBFrac(x1, y1)));\n var cfrac = Math.max(0, Math.min(1, getCFrac(x0, y0), getCFrac(x1, y1)));\n var xLeft = (afrac / 2 + cfrac) * _this.w;\n var xRight = (1 - afrac / 2 - bfrac) * _this.w;\n var xCenter = (xLeft + xRight) / 2;\n var xSpan = xRight - xLeft;\n var yBottom = (1 - afrac) * _this.h;\n var yTop = yBottom - xSpan / whRatio;\n if (xSpan < constants.MINZOOM) {\n mins = mins0;\n zb.attr(\"d\", path0);\n corners.attr(\"d\", \"M0,0Z\");\n } else {\n mins = {\n a: mins0.a + afrac * span0,\n b: mins0.b + bfrac * span0,\n c: mins0.c + cfrac * span0\n };\n zb.attr(\"d\", path0 + \"M\" + xLeft + \",\" + yBottom + \"H\" + xRight + \"L\" + xCenter + \",\" + yTop + \"L\" + xLeft + \",\" + yBottom + \"Z\");\n corners.attr(\"d\", \"M\" + x0 + \",\" + y0 + STARTMARKER + \"M\" + xLeft + \",\" + yBottom + BLPATH + \"M\" + xRight + \",\" + yBottom + BRPATH + \"M\" + xCenter + \",\" + yTop + TOPPATH);\n }\n if (!dimmed) {\n zb.transition().style(\"fill\", lum > 0.2 ? \"rgba(0,0,0,0.4)\" : \"rgba(255,255,255,0.3)\").duration(200);\n corners.transition().style(\"opacity\", 1).duration(200);\n dimmed = true;\n }\n gd.emit(\"plotly_relayouting\", makeUpdate(mins));\n }\n function zoomDone() {\n removeZoombox(gd);\n if (mins === mins0) return;\n Registry.call(\"_guiRelayout\", gd, makeUpdate(mins));\n if (SHOWZOOMOUTTIP && gd.data && gd._context.showTips) {\n Lib.notifier(_(gd, \"Double-click to zoom back out\"), \"long\");\n SHOWZOOMOUTTIP = false;\n }\n }\n function panPrep() {\n mins0 = {\n a: _this.aaxis.range[0],\n b: _this.baxis.range[1],\n c: _this.caxis.range[1]\n };\n mins = mins0;\n }\n function plotDrag(dx, dy) {\n var dxScaled = dx / _this.xaxis._m;\n var dyScaled = dy / _this.yaxis._m;\n mins = {\n a: mins0.a - dyScaled,\n b: mins0.b + (dxScaled + dyScaled) / 2,\n c: mins0.c - (dxScaled - dyScaled) / 2\n };\n var minsorted = [mins.a, mins.b, mins.c].sort(Lib.sorterAsc);\n var minindices = {\n a: minsorted.indexOf(mins.a),\n b: minsorted.indexOf(mins.b),\n c: minsorted.indexOf(mins.c)\n };\n if (minsorted[0] < 0) {\n if (minsorted[1] + minsorted[0] / 2 < 0) {\n minsorted[2] += minsorted[0] + minsorted[1];\n minsorted[0] = minsorted[1] = 0;\n } else {\n minsorted[2] += minsorted[0] / 2;\n minsorted[1] += minsorted[0] / 2;\n minsorted[0] = 0;\n }\n mins = {\n a: minsorted[minindices.a],\n b: minsorted[minindices.b],\n c: minsorted[minindices.c]\n };\n dy = (mins0.a - mins.a) * _this.yaxis._m;\n dx = (mins0.c - mins.c - mins0.b + mins.b) * _this.xaxis._m;\n }\n var plotTransform = strTranslate(_this.x0 + dx, _this.y0 + dy);\n _this.plotContainer.selectAll(\".scatterlayer,.maplayer\").attr(\"transform\", plotTransform);\n var plotTransform2 = strTranslate(-dx, -dy);\n _this.clipDefRelative.select(\"path\").attr(\"transform\", plotTransform2);\n _this.aaxis.range = [mins.a, _this.sum - mins.b - mins.c];\n _this.baxis.range = [_this.sum - mins.a - mins.c, mins.b];\n _this.caxis.range = [_this.sum - mins.a - mins.b, mins.c];\n _this.drawAxes(false);\n if (_this._hasClipOnAxisFalse) {\n _this.plotContainer.select(\".scatterlayer\").selectAll(\".trace\").call(Drawing.hideOutsideRangePoints, _this);\n }\n gd.emit(\"plotly_relayouting\", makeUpdate(mins));\n }\n function dragDone() {\n Registry.call(\"_guiRelayout\", gd, makeUpdate(mins));\n }\n dragger.onmousemove = function(evt) {\n Fx.hover(gd, evt, _this.id);\n gd._fullLayout._lasthover = dragger;\n gd._fullLayout._hoversubplot = _this.id;\n };\n dragger.onmouseout = function(evt) {\n if (gd._dragging) return;\n dragElement.unhover(gd, evt);\n };\n dragElement.init(this.dragOptions);\n };\n function removeZoombox(gd) {\n d3.select(gd).selectAll(\".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners\").remove();\n }\n }\n });\n\n // src/plots/ternary/layout_attributes.js\n var require_layout_attributes8 = __commonJS({\n \"src/plots/ternary/layout_attributes.js\"(exports, module) {\n \"use strict\";\n var colorAttrs = require_attributes3();\n var domainAttrs = require_domain().attributes;\n var axesAttrs = require_layout_attributes4();\n var overrideAll = require_edit_types().overrideAll;\n var extendFlat = require_extend().extendFlat;\n var ternaryAxesAttrs = {\n title: {\n text: axesAttrs.title.text,\n font: axesAttrs.title.font\n // TODO does standoff here make sense?\n },\n color: axesAttrs.color,\n // ticks\n tickmode: axesAttrs.minor.tickmode,\n nticks: extendFlat({}, axesAttrs.nticks, { dflt: 6, min: 1 }),\n tick0: axesAttrs.tick0,\n dtick: axesAttrs.dtick,\n tickvals: axesAttrs.tickvals,\n ticktext: axesAttrs.ticktext,\n ticks: axesAttrs.ticks,\n ticklen: axesAttrs.ticklen,\n tickwidth: axesAttrs.tickwidth,\n tickcolor: axesAttrs.tickcolor,\n ticklabelstep: axesAttrs.ticklabelstep,\n showticklabels: axesAttrs.showticklabels,\n labelalias: axesAttrs.labelalias,\n showtickprefix: axesAttrs.showtickprefix,\n tickprefix: axesAttrs.tickprefix,\n showticksuffix: axesAttrs.showticksuffix,\n ticksuffix: axesAttrs.ticksuffix,\n showexponent: axesAttrs.showexponent,\n exponentformat: axesAttrs.exponentformat,\n minexponent: axesAttrs.minexponent,\n separatethousands: axesAttrs.separatethousands,\n tickfont: axesAttrs.tickfont,\n tickangle: axesAttrs.tickangle,\n tickformat: axesAttrs.tickformat,\n tickformatstops: axesAttrs.tickformatstops,\n hoverformat: axesAttrs.hoverformat,\n // lines and grids\n showline: extendFlat({}, axesAttrs.showline, { dflt: true }),\n linecolor: axesAttrs.linecolor,\n linewidth: axesAttrs.linewidth,\n showgrid: extendFlat({}, axesAttrs.showgrid, { dflt: true }),\n gridcolor: axesAttrs.gridcolor,\n gridwidth: axesAttrs.gridwidth,\n griddash: axesAttrs.griddash,\n layer: axesAttrs.layer,\n // range\n min: {\n valType: \"number\",\n dflt: 0,\n min: 0\n }\n };\n var attrs = module.exports = overrideAll({\n domain: domainAttrs({ name: \"ternary\" }),\n bgcolor: {\n valType: \"color\",\n dflt: colorAttrs.background\n },\n sum: {\n valType: \"number\",\n dflt: 1,\n min: 0\n },\n aaxis: ternaryAxesAttrs,\n baxis: ternaryAxesAttrs,\n caxis: ternaryAxesAttrs\n }, \"plot\", \"from-root\");\n attrs.uirevision = {\n valType: \"any\",\n editType: \"none\"\n };\n attrs.aaxis.uirevision = attrs.baxis.uirevision = attrs.caxis.uirevision = {\n valType: \"any\",\n editType: \"none\"\n };\n }\n });\n\n // src/plots/subplot_defaults.js\n var require_subplot_defaults = __commonJS({\n \"src/plots/subplot_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Template = require_plot_template();\n var handleDomainDefaults = require_domain().defaults;\n module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, opts) {\n var subplotType = opts.type;\n var subplotAttributes = opts.attributes;\n var handleDefaults = opts.handleDefaults;\n var partition = opts.partition || \"x\";\n var ids = layoutOut._subplots[subplotType];\n var idsLength = ids.length;\n var baseId = idsLength && ids[0].replace(/\\d+$/, \"\");\n var subplotLayoutIn, subplotLayoutOut;\n function coerce(attr, dflt) {\n return Lib.coerce(subplotLayoutIn, subplotLayoutOut, subplotAttributes, attr, dflt);\n }\n for (var i = 0; i < idsLength; i++) {\n var id = ids[i];\n if (layoutIn[id]) subplotLayoutIn = layoutIn[id];\n else subplotLayoutIn = layoutIn[id] = {};\n subplotLayoutOut = Template.newContainer(layoutOut, id, baseId);\n if (!opts.noUirevision) coerce(\"uirevision\", layoutOut.uirevision);\n var dfltDomains = {};\n dfltDomains[partition] = [i / idsLength, (i + 1) / idsLength];\n handleDomainDefaults(subplotLayoutOut, layoutOut, coerce, dfltDomains);\n opts.id = id;\n handleDefaults(subplotLayoutIn, subplotLayoutOut, coerce, opts);\n }\n };\n }\n });\n\n // src/plots/ternary/layout_defaults.js\n var require_layout_defaults7 = __commonJS({\n \"src/plots/ternary/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Color2 = require_color();\n var Template = require_plot_template();\n var Lib = require_lib();\n var handleSubplotDefaults = require_subplot_defaults();\n var handleTickLabelDefaults = require_tick_label_defaults();\n var handlePrefixSuffixDefaults = require_prefix_suffix_defaults();\n var handleTickMarkDefaults = require_tick_mark_defaults();\n var handleTickValueDefaults = require_tick_value_defaults();\n var handleLineGridDefaults = require_line_grid_defaults();\n var layoutAttributes = require_layout_attributes8();\n var axesNames = [\"aaxis\", \"baxis\", \"caxis\"];\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {\n handleSubplotDefaults(layoutIn, layoutOut, fullData, {\n type: \"ternary\",\n attributes: layoutAttributes,\n handleDefaults: handleTernaryDefaults,\n font: layoutOut.font,\n paper_bgcolor: layoutOut.paper_bgcolor\n });\n };\n function handleTernaryDefaults(ternaryLayoutIn, ternaryLayoutOut, coerce, options) {\n var bgColor = coerce(\"bgcolor\");\n var sum = coerce(\"sum\");\n options.bgColor = Color2.combine(bgColor, options.paper_bgcolor);\n var axName, containerIn, containerOut;\n for (var j = 0; j < axesNames.length; j++) {\n axName = axesNames[j];\n containerIn = ternaryLayoutIn[axName] || {};\n containerOut = Template.newContainer(ternaryLayoutOut, axName);\n containerOut._name = axName;\n handleAxisDefaults(containerIn, containerOut, options, ternaryLayoutOut);\n }\n var aaxis = ternaryLayoutOut.aaxis;\n var baxis = ternaryLayoutOut.baxis;\n var caxis = ternaryLayoutOut.caxis;\n if (aaxis.min + baxis.min + caxis.min >= sum) {\n aaxis.min = 0;\n baxis.min = 0;\n caxis.min = 0;\n if (ternaryLayoutIn.aaxis) delete ternaryLayoutIn.aaxis.min;\n if (ternaryLayoutIn.baxis) delete ternaryLayoutIn.baxis.min;\n if (ternaryLayoutIn.caxis) delete ternaryLayoutIn.caxis.min;\n }\n }\n function handleAxisDefaults(containerIn, containerOut, options, ternaryLayoutOut) {\n var axAttrs = layoutAttributes[containerOut._name];\n function coerce(attr, dflt) {\n return Lib.coerce(containerIn, containerOut, axAttrs, attr, dflt);\n }\n coerce(\"uirevision\", ternaryLayoutOut.uirevision);\n containerOut.type = \"linear\";\n var dfltColor = coerce(\"color\");\n var dfltFontColor = dfltColor !== axAttrs.color.dflt ? dfltColor : options.font.color;\n var axName = containerOut._name;\n var letterUpper = axName.charAt(0).toUpperCase();\n var dfltTitle = \"Component \" + letterUpper;\n var title = coerce(\"title.text\", dfltTitle);\n containerOut._hovertitle = title === dfltTitle ? title : letterUpper;\n Lib.coerceFont(coerce, \"title.font\", options.font, { overrideDflt: {\n size: Lib.bigFont(options.font.size),\n color: dfltFontColor\n } });\n coerce(\"min\");\n handleTickValueDefaults(containerIn, containerOut, coerce, \"linear\");\n handlePrefixSuffixDefaults(containerIn, containerOut, coerce, \"linear\");\n handleTickLabelDefaults(containerIn, containerOut, coerce, \"linear\", {\n noAutotickangles: true,\n noTicklabelshift: true,\n noTicklabelstandoff: true\n });\n handleTickMarkDefaults(\n containerIn,\n containerOut,\n coerce,\n { outerTicks: true }\n );\n var showTickLabels = coerce(\"showticklabels\");\n if (showTickLabels) {\n Lib.coerceFont(coerce, \"tickfont\", options.font, { overrideDflt: {\n color: dfltFontColor\n } });\n coerce(\"tickangle\");\n coerce(\"tickformat\");\n }\n handleLineGridDefaults(containerIn, containerOut, coerce, {\n dfltColor,\n bgColor: options.bgColor,\n // default grid color is darker here (60%, vs cartesian default ~91%)\n // because the grid is not square so the eye needs heavier cues to follow\n blend: 60,\n showLine: true,\n showGrid: true,\n noZeroLine: true,\n attributes: axAttrs\n });\n coerce(\"hoverformat\");\n coerce(\"layer\");\n }\n }\n });\n\n // src/plots/ternary/index.js\n var require_ternary2 = __commonJS({\n \"src/plots/ternary/index.js\"(exports) {\n \"use strict\";\n var Ternary = require_ternary();\n var getSubplotCalcData = require_get_data().getSubplotCalcData;\n var counterRegex = require_lib().counterRegex;\n var TERNARY = \"ternary\";\n exports.name = TERNARY;\n var attr = exports.attr = \"subplot\";\n exports.idRoot = TERNARY;\n exports.idRegex = exports.attrRegex = counterRegex(TERNARY);\n var attributes = exports.attributes = {};\n attributes[attr] = {\n valType: \"subplotid\",\n dflt: \"ternary\",\n editType: \"calc\"\n };\n exports.layoutAttributes = require_layout_attributes8();\n exports.supplyLayoutDefaults = require_layout_defaults7();\n exports.plot = function plot(gd) {\n var fullLayout = gd._fullLayout;\n var calcData = gd.calcdata;\n var ternaryIds = fullLayout._subplots[TERNARY];\n for (var i = 0; i < ternaryIds.length; i++) {\n var ternaryId = ternaryIds[i];\n var ternaryCalcData = getSubplotCalcData(calcData, TERNARY, ternaryId);\n var ternary = fullLayout[ternaryId]._subplot;\n if (!ternary) {\n ternary = new Ternary(\n {\n id: ternaryId,\n graphDiv: gd,\n container: fullLayout._ternarylayer.node()\n },\n fullLayout\n );\n fullLayout[ternaryId]._subplot = ternary;\n }\n ternary.plot(ternaryCalcData, fullLayout, gd._promises);\n }\n };\n exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var oldTernaryKeys = oldFullLayout._subplots[TERNARY] || [];\n for (var i = 0; i < oldTernaryKeys.length; i++) {\n var oldTernaryKey = oldTernaryKeys[i];\n var oldTernary = oldFullLayout[oldTernaryKey]._subplot;\n if (!newFullLayout[oldTernaryKey] && !!oldTernary) {\n oldTernary.plotContainer.remove();\n oldTernary.clipDef.remove();\n oldTernary.clipDefRelative.remove();\n oldTernary.layers[\"a-title\"].remove();\n oldTernary.layers[\"b-title\"].remove();\n oldTernary.layers[\"c-title\"].remove();\n }\n }\n };\n exports.updateFx = function(gd) {\n var fullLayout = gd._fullLayout;\n fullLayout._ternarylayer.selectAll(\"g.toplevel\").style(\"cursor\", fullLayout.dragmode === \"pan\" ? \"move\" : \"crosshair\");\n };\n }\n });\n\n // src/traces/scatterternary/index.js\n var require_scatterternary = __commonJS({\n \"src/traces/scatterternary/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes30(),\n supplyDefaults: require_defaults26(),\n colorbar: require_marker_colorbar(),\n formatLabels: require_format_labels2(),\n calc: require_calc11(),\n plot: require_plot7(),\n style: require_style2().style,\n styleOnSelect: require_style2().styleOnSelect,\n hoverPoints: require_hover9(),\n selectPoints: require_select2(),\n eventData: require_event_data4(),\n moduleType: \"trace\",\n name: \"scatterternary\",\n basePlotModule: require_ternary2(),\n categories: [\"ternary\", \"symbols\", \"showLegend\", \"scatter-like\"],\n meta: {}\n };\n }\n });\n\n // lib/scatterternary.js\n var require_scatterternary2 = __commonJS({\n \"lib/scatterternary.js\"(exports, module) {\n \"use strict\";\n module.exports = require_scatterternary();\n }\n });\n\n // src/traces/violin/attributes.js\n var require_attributes31 = __commonJS({\n \"src/traces/violin/attributes.js\"(exports, module) {\n \"use strict\";\n var boxAttrs = require_attributes24();\n var extendFlat = require_extend().extendFlat;\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n module.exports = {\n y: boxAttrs.y,\n x: boxAttrs.x,\n x0: boxAttrs.x0,\n y0: boxAttrs.y0,\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n name: extendFlat({}, boxAttrs.name, {}),\n orientation: extendFlat({}, boxAttrs.orientation, {}),\n bandwidth: {\n valType: \"number\",\n min: 0,\n editType: \"calc\"\n },\n scalegroup: {\n valType: \"string\",\n dflt: \"\",\n editType: \"calc\"\n },\n scalemode: {\n valType: \"enumerated\",\n values: [\"width\", \"count\"],\n dflt: \"width\",\n editType: \"calc\"\n },\n spanmode: {\n valType: \"enumerated\",\n values: [\"soft\", \"hard\", \"manual\"],\n dflt: \"soft\",\n editType: \"calc\"\n },\n span: {\n valType: \"info_array\",\n items: [\n { valType: \"any\", editType: \"calc\" },\n { valType: \"any\", editType: \"calc\" }\n ],\n editType: \"calc\"\n },\n line: {\n color: {\n valType: \"color\",\n editType: \"style\"\n },\n width: {\n valType: \"number\",\n min: 0,\n dflt: 2,\n editType: \"style\"\n },\n editType: \"plot\"\n },\n fillcolor: boxAttrs.fillcolor,\n points: extendFlat({}, boxAttrs.boxpoints, {}),\n jitter: extendFlat({}, boxAttrs.jitter, {}),\n pointpos: extendFlat({}, boxAttrs.pointpos, {}),\n width: extendFlat({}, boxAttrs.width, {}),\n marker: boxAttrs.marker,\n text: boxAttrs.text,\n hovertext: boxAttrs.hovertext,\n hovertemplate: boxAttrs.hovertemplate,\n quartilemethod: boxAttrs.quartilemethod,\n box: {\n visible: {\n valType: \"boolean\",\n dflt: false,\n editType: \"plot\"\n },\n width: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0.25,\n editType: \"plot\"\n },\n fillcolor: {\n valType: \"color\",\n editType: \"style\"\n },\n line: {\n color: {\n valType: \"color\",\n editType: \"style\"\n },\n width: {\n valType: \"number\",\n min: 0,\n editType: \"style\"\n },\n editType: \"style\"\n },\n editType: \"plot\"\n },\n meanline: {\n visible: {\n valType: \"boolean\",\n dflt: false,\n editType: \"plot\"\n },\n color: {\n valType: \"color\",\n editType: \"style\"\n },\n width: {\n valType: \"number\",\n min: 0,\n editType: \"style\"\n },\n editType: \"plot\"\n },\n side: {\n valType: \"enumerated\",\n values: [\"both\", \"positive\", \"negative\"],\n dflt: \"both\",\n editType: \"calc\"\n },\n offsetgroup: boxAttrs.offsetgroup,\n alignmentgroup: boxAttrs.alignmentgroup,\n selected: boxAttrs.selected,\n unselected: boxAttrs.unselected,\n hoveron: {\n valType: \"flaglist\",\n flags: [\"violins\", \"points\", \"kde\"],\n dflt: \"violins+points+kde\",\n extras: [\"all\"],\n editType: \"style\"\n },\n zorder: boxAttrs.zorder\n };\n }\n });\n\n // src/traces/violin/layout_attributes.js\n var require_layout_attributes9 = __commonJS({\n \"src/traces/violin/layout_attributes.js\"(exports, module) {\n \"use strict\";\n var boxLayoutAttrs = require_layout_attributes7();\n var extendFlat = require_lib().extendFlat;\n module.exports = {\n violinmode: extendFlat({}, boxLayoutAttrs.boxmode, {}),\n violingap: extendFlat({}, boxLayoutAttrs.boxgap, {}),\n violingroupgap: extendFlat({}, boxLayoutAttrs.boxgroupgap, {})\n };\n }\n });\n\n // src/traces/violin/defaults.js\n var require_defaults27 = __commonJS({\n \"src/traces/violin/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Color2 = require_color();\n var boxDefaults = require_defaults20();\n var attributes = require_attributes31();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n function coerce2(attr, dflt) {\n return Lib.coerce2(traceIn, traceOut, attributes, attr, dflt);\n }\n boxDefaults.handleSampleDefaults(traceIn, traceOut, coerce, layout);\n if (traceOut.visible === false) return;\n coerce(\"bandwidth\");\n coerce(\"side\");\n var width = coerce(\"width\");\n if (!width) {\n coerce(\"scalegroup\", traceOut.name);\n coerce(\"scalemode\");\n }\n var span = coerce(\"span\");\n var spanmodeDflt;\n if (Array.isArray(span)) spanmodeDflt = \"manual\";\n coerce(\"spanmode\", spanmodeDflt);\n var lineColor = coerce(\"line.color\", (traceIn.marker || {}).color || defaultColor);\n var lineWidth = coerce(\"line.width\");\n var fillColor = coerce(\"fillcolor\", Color2.addOpacity(traceOut.line.color, 0.5));\n boxDefaults.handlePointsDefaults(traceIn, traceOut, coerce, { prefix: \"\" });\n var boxWidth = coerce2(\"box.width\");\n var boxFillColor = coerce2(\"box.fillcolor\", fillColor);\n var boxLineColor = coerce2(\"box.line.color\", lineColor);\n var boxLineWidth = coerce2(\"box.line.width\", lineWidth);\n var boxVisible = coerce(\"box.visible\", Boolean(boxWidth || boxFillColor || boxLineColor || boxLineWidth));\n if (!boxVisible) traceOut.box = { visible: false };\n var meanLineColor = coerce2(\"meanline.color\", lineColor);\n var meanLineWidth = coerce2(\"meanline.width\", lineWidth);\n var meanLineVisible = coerce(\"meanline.visible\", Boolean(meanLineColor || meanLineWidth));\n if (!meanLineVisible) traceOut.meanline = { visible: false };\n coerce(\"quartilemethod\");\n coerce(\"zorder\");\n };\n }\n });\n\n // src/traces/violin/layout_defaults.js\n var require_layout_defaults8 = __commonJS({\n \"src/traces/violin/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var layoutAttributes = require_layout_attributes9();\n var boxLayoutDefaults = require_layout_defaults6();\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);\n }\n boxLayoutDefaults._supply(layoutIn, layoutOut, fullData, coerce, \"violin\");\n };\n }\n });\n\n // src/traces/violin/helpers.js\n var require_helpers13 = __commonJS({\n \"src/traces/violin/helpers.js\"(exports) {\n \"use strict\";\n var Lib = require_lib();\n var kernels = {\n gaussian: function(v) {\n return 1 / Math.sqrt(2 * Math.PI) * Math.exp(-0.5 * v * v);\n }\n };\n exports.makeKDE = function(calcItem, trace, vals) {\n var len = vals.length;\n var kernel = kernels.gaussian;\n var bandwidth = calcItem.bandwidth;\n var factor = 1 / (len * bandwidth);\n return function(x) {\n var sum = 0;\n for (var i = 0; i < len; i++) {\n sum += kernel((x - vals[i]) / bandwidth);\n }\n return factor * sum;\n };\n };\n exports.getPositionOnKdePath = function(calcItem, trace, valuePx) {\n var posLetter, valLetter;\n if (trace.orientation === \"h\") {\n posLetter = \"y\";\n valLetter = \"x\";\n } else {\n posLetter = \"x\";\n valLetter = \"y\";\n }\n var pointOnPath = Lib.findPointOnPath(\n calcItem.path,\n valuePx,\n valLetter,\n { pathLength: calcItem.pathLength }\n );\n var posCenterPx = calcItem.posCenterPx;\n var posOnPath0 = pointOnPath[posLetter];\n var posOnPath1 = trace.side === \"both\" ? 2 * posCenterPx - posOnPath0 : posCenterPx;\n return [posOnPath0, posOnPath1];\n };\n exports.getKdeValue = function(calcItem, trace, valueDist) {\n var vals = calcItem.pts.map(exports.extractVal);\n var kde = exports.makeKDE(calcItem, trace, vals);\n return kde(valueDist) / calcItem.posDensityScale;\n };\n exports.extractVal = function(o) {\n return o.v;\n };\n }\n });\n\n // src/traces/violin/calc.js\n var require_calc12 = __commonJS({\n \"src/traces/violin/calc.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Axes = require_axes();\n var boxCalc = require_calc6();\n var helpers = require_helpers13();\n var BADNUM = require_numerical().BADNUM;\n module.exports = function calc(gd, trace) {\n var cd = boxCalc(gd, trace);\n if (cd[0].t.empty) return cd;\n var fullLayout = gd._fullLayout;\n var valAxis = Axes.getFromId(\n gd,\n trace[trace.orientation === \"h\" ? \"xaxis\" : \"yaxis\"]\n );\n var spanMin = Infinity;\n var spanMax = -Infinity;\n var maxKDE = 0;\n var maxCount = 0;\n for (var i = 0; i < cd.length; i++) {\n var cdi = cd[i];\n var vals = cdi.pts.map(helpers.extractVal);\n var bandwidth = cdi.bandwidth = calcBandwidth(trace, cdi, vals);\n var span = cdi.span = calcSpan(trace, cdi, valAxis, bandwidth);\n if (cdi.min === cdi.max && bandwidth === 0) {\n span = cdi.span = [cdi.min, cdi.max];\n cdi.density = [{ v: 1, t: span[0] }];\n cdi.bandwidth = bandwidth;\n maxKDE = Math.max(maxKDE, 1);\n } else {\n var dist = span[1] - span[0];\n var n = Math.ceil(dist / (bandwidth / 3));\n var step = dist / n;\n if (!isFinite(step) || !isFinite(n)) {\n Lib.error(\"Something went wrong with computing the violin span\");\n cd[0].t.empty = true;\n return cd;\n }\n var kde = helpers.makeKDE(cdi, trace, vals);\n cdi.density = new Array(n);\n for (var k = 0, t = span[0]; t < span[1] + step / 2; k++, t += step) {\n var v = kde(t);\n cdi.density[k] = { v, t };\n maxKDE = Math.max(maxKDE, v);\n }\n }\n maxCount = Math.max(maxCount, vals.length);\n spanMin = Math.min(spanMin, span[0]);\n spanMax = Math.max(spanMax, span[1]);\n }\n var extremes = Axes.findExtremes(valAxis, [spanMin, spanMax], { padded: true });\n trace._extremes[valAxis._id] = extremes;\n if (trace.width) {\n cd[0].t.maxKDE = maxKDE;\n } else {\n var violinScaleGroupStats = fullLayout._violinScaleGroupStats;\n var scaleGroup = trace.scalegroup;\n var groupStats = violinScaleGroupStats[scaleGroup];\n if (groupStats) {\n groupStats.maxKDE = Math.max(groupStats.maxKDE, maxKDE);\n groupStats.maxCount = Math.max(groupStats.maxCount, maxCount);\n } else {\n violinScaleGroupStats[scaleGroup] = {\n maxKDE,\n maxCount\n };\n }\n }\n cd[0].t.labels.kde = Lib._(gd, \"kde:\");\n return cd;\n };\n function silvermanRule(len, ssd, iqr) {\n var a = Math.min(ssd, iqr / 1.349);\n return 1.059 * a * Math.pow(len, -0.2);\n }\n function calcBandwidth(trace, cdi, vals) {\n var span = cdi.max - cdi.min;\n if (!span) {\n if (trace.bandwidth) {\n return trace.bandwidth;\n } else {\n return 0;\n }\n }\n if (trace.bandwidth) {\n return Math.max(trace.bandwidth, span / 1e4);\n } else {\n var len = vals.length;\n var ssd = Lib.stdev(vals, len - 1, cdi.mean);\n return Math.max(\n silvermanRule(len, ssd, cdi.q3 - cdi.q1),\n span / 100\n );\n }\n }\n function calcSpan(trace, cdi, valAxis, bandwidth) {\n var spanmode = trace.spanmode;\n var spanIn = trace.span || [];\n var spanTight = [cdi.min, cdi.max];\n var spanLoose = [cdi.min - 2 * bandwidth, cdi.max + 2 * bandwidth];\n var spanOut;\n function calcSpanItem(index) {\n var s = spanIn[index];\n var sc = valAxis.type === \"multicategory\" ? valAxis.r2c(s) : valAxis.d2c(s, 0, trace[cdi.valLetter + \"calendar\"]);\n return sc === BADNUM ? spanLoose[index] : sc;\n }\n if (spanmode === \"soft\") {\n spanOut = spanLoose;\n } else if (spanmode === \"hard\") {\n spanOut = spanTight;\n } else {\n spanOut = [calcSpanItem(0), calcSpanItem(1)];\n }\n var dummyAx = {\n type: \"linear\",\n range: spanOut\n };\n Axes.setConvert(dummyAx);\n dummyAx.cleanRange();\n return spanOut;\n }\n }\n });\n\n // src/traces/violin/cross_trace_calc.js\n var require_cross_trace_calc4 = __commonJS({\n \"src/traces/violin/cross_trace_calc.js\"(exports, module) {\n \"use strict\";\n var setPositionOffset = require_cross_trace_calc3().setPositionOffset;\n var orientations = [\"v\", \"h\"];\n module.exports = function crossTraceCalc(gd, plotinfo) {\n var calcdata = gd.calcdata;\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n for (var i = 0; i < orientations.length; i++) {\n var orientation = orientations[i];\n var posAxis = orientation === \"h\" ? ya : xa;\n var violinList = [];\n for (var j = 0; j < calcdata.length; j++) {\n var cd = calcdata[j];\n var t = cd[0].t;\n var trace = cd[0].trace;\n if (trace.visible === true && trace.type === \"violin\" && !t.empty && trace.orientation === orientation && trace.xaxis === xa._id && trace.yaxis === ya._id) {\n violinList.push(j);\n }\n }\n setPositionOffset(\"violin\", gd, violinList, posAxis);\n }\n };\n }\n });\n\n // src/traces/violin/plot.js\n var require_plot8 = __commonJS({\n \"src/traces/violin/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var Drawing = require_drawing();\n var boxPlot = require_plot4();\n var linePoints = require_line_points();\n var helpers = require_helpers13();\n module.exports = function plot(gd, plotinfo, cdViolins, violinLayer) {\n var isStatic = gd._context.staticPlot;\n var fullLayout = gd._fullLayout;\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n function makePath(pts, trace) {\n var segments = linePoints(pts, {\n xaxis: xa,\n yaxis: ya,\n trace,\n connectGaps: true,\n baseTolerance: 0.75,\n shape: \"spline\",\n simplify: true,\n linearized: true\n });\n return Drawing.smoothopen(segments[0], 1);\n }\n Lib.makeTraceGroups(violinLayer, cdViolins, \"trace violins\").each(function(cd) {\n var plotGroup = d3.select(this);\n var cd0 = cd[0];\n var t = cd0.t;\n var trace = cd0.trace;\n if (trace.visible !== true || t.empty) {\n plotGroup.remove();\n return;\n }\n var bPos = t.bPos;\n var bdPos = t.bdPos;\n var valAxis = plotinfo[t.valLetter + \"axis\"];\n var posAxis = plotinfo[t.posLetter + \"axis\"];\n var hasBothSides = trace.side === \"both\";\n var hasPositiveSide = hasBothSides || trace.side === \"positive\";\n var hasNegativeSide = hasBothSides || trace.side === \"negative\";\n var violins = plotGroup.selectAll(\"path.violin\").data(Lib.identity);\n violins.enter().append(\"path\").style(\"vector-effect\", isStatic ? \"none\" : \"non-scaling-stroke\").attr(\"class\", \"violin\");\n violins.exit().remove();\n violins.each(function(d) {\n var pathSel = d3.select(this);\n var density = d.density;\n var len = density.length;\n var posCenter = posAxis.c2l(d.pos + bPos, true);\n var posCenterPx = posAxis.l2p(posCenter);\n var scale;\n if (trace.width) {\n scale = t.maxKDE / bdPos;\n } else {\n var groupStats = fullLayout._violinScaleGroupStats[trace.scalegroup];\n scale = trace.scalemode === \"count\" ? groupStats.maxKDE / bdPos * (groupStats.maxCount / d.pts.length) : groupStats.maxKDE / bdPos;\n }\n var pathPos, pathNeg, path;\n var i, k, pts, pt;\n if (hasPositiveSide) {\n pts = new Array(len);\n for (i = 0; i < len; i++) {\n pt = pts[i] = {};\n pt[t.posLetter] = posCenter + density[i].v / scale;\n pt[t.valLetter] = valAxis.c2l(density[i].t, true);\n }\n pathPos = makePath(pts, trace);\n }\n if (hasNegativeSide) {\n pts = new Array(len);\n for (k = 0, i = len - 1; k < len; k++, i--) {\n pt = pts[k] = {};\n pt[t.posLetter] = posCenter - density[i].v / scale;\n pt[t.valLetter] = valAxis.c2l(density[i].t, true);\n }\n pathNeg = makePath(pts, trace);\n }\n if (hasBothSides) {\n path = pathPos + \"L\" + pathNeg.substr(1) + \"Z\";\n } else {\n var startPt = [posCenterPx, valAxis.c2p(density[0].t)];\n var endPt = [posCenterPx, valAxis.c2p(density[len - 1].t)];\n if (trace.orientation === \"h\") {\n startPt.reverse();\n endPt.reverse();\n }\n if (hasPositiveSide) {\n path = \"M\" + startPt + \"L\" + pathPos.substr(1) + \"L\" + endPt;\n } else {\n path = \"M\" + endPt + \"L\" + pathNeg.substr(1) + \"L\" + startPt;\n }\n }\n pathSel.attr(\"d\", path);\n d.posCenterPx = posCenterPx;\n d.posDensityScale = scale * bdPos;\n d.path = pathSel.node();\n d.pathLength = d.path.getTotalLength() / (hasBothSides ? 2 : 1);\n });\n var boxAttrs = trace.box;\n var boxWidth = boxAttrs.width;\n var boxLineWidth = (boxAttrs.line || {}).width;\n var bdPosScaled;\n var bPosPxOffset;\n if (hasBothSides) {\n bdPosScaled = bdPos * boxWidth;\n bPosPxOffset = 0;\n } else if (hasPositiveSide) {\n bdPosScaled = [0, bdPos * boxWidth / 2];\n bPosPxOffset = boxLineWidth * { x: 1, y: -1 }[t.posLetter];\n } else {\n bdPosScaled = [bdPos * boxWidth / 2, 0];\n bPosPxOffset = boxLineWidth * { x: -1, y: 1 }[t.posLetter];\n }\n boxPlot.plotBoxAndWhiskers(plotGroup, { pos: posAxis, val: valAxis }, trace, {\n bPos,\n bdPos: bdPosScaled,\n bPosPxOffset\n });\n boxPlot.plotBoxMean(plotGroup, { pos: posAxis, val: valAxis }, trace, {\n bPos,\n bdPos: bdPosScaled,\n bPosPxOffset\n });\n var fn;\n if (!trace.box.visible && trace.meanline.visible) {\n fn = Lib.identity;\n }\n var meanPaths = plotGroup.selectAll(\"path.meanline\").data(fn || []);\n meanPaths.enter().append(\"path\").attr(\"class\", \"meanline\").style(\"fill\", \"none\").style(\"vector-effect\", isStatic ? \"none\" : \"non-scaling-stroke\");\n meanPaths.exit().remove();\n meanPaths.each(function(d) {\n var v = valAxis.c2p(d.mean, true);\n var p = helpers.getPositionOnKdePath(d, trace, v);\n d3.select(this).attr(\n \"d\",\n trace.orientation === \"h\" ? \"M\" + v + \",\" + p[0] + \"V\" + p[1] : \"M\" + p[0] + \",\" + v + \"H\" + p[1]\n );\n });\n boxPlot.plotPoints(plotGroup, { x: xa, y: ya }, trace, t);\n });\n };\n }\n });\n\n // src/traces/violin/style.js\n var require_style8 = __commonJS({\n \"src/traces/violin/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Color2 = require_color();\n var stylePoints = require_style2().stylePoints;\n module.exports = function style(gd) {\n var s = d3.select(gd).selectAll(\"g.trace.violins\");\n s.style(\"opacity\", function(d) {\n return d[0].trace.opacity;\n });\n s.each(function(d) {\n var trace = d[0].trace;\n var sel = d3.select(this);\n var box = trace.box || {};\n var boxLine = box.line || {};\n var meanline = trace.meanline || {};\n var meanLineWidth = meanline.width;\n sel.selectAll(\"path.violin\").style(\"stroke-width\", trace.line.width + \"px\").call(Color2.stroke, trace.line.color).call(Color2.fill, trace.fillcolor);\n sel.selectAll(\"path.box\").style(\"stroke-width\", boxLine.width + \"px\").call(Color2.stroke, boxLine.color).call(Color2.fill, box.fillcolor);\n var meanLineStyle = {\n \"stroke-width\": meanLineWidth + \"px\",\n \"stroke-dasharray\": 2 * meanLineWidth + \"px,\" + meanLineWidth + \"px\"\n };\n sel.selectAll(\"path.mean\").style(meanLineStyle).call(Color2.stroke, meanline.color);\n sel.selectAll(\"path.meanline\").style(meanLineStyle).call(Color2.stroke, meanline.color);\n stylePoints(sel, trace, gd);\n });\n };\n }\n });\n\n // src/traces/violin/hover.js\n var require_hover10 = __commonJS({\n \"src/traces/violin/hover.js\"(exports, module) {\n \"use strict\";\n var Color2 = require_color();\n var Lib = require_lib();\n var Axes = require_axes();\n var boxHoverPoints = require_hover4();\n var helpers = require_helpers13();\n module.exports = function hoverPoints(pointData, xval, yval, hovermode, opts) {\n if (!opts) opts = {};\n var hoverLayer = opts.hoverLayer;\n var cd = pointData.cd;\n var trace = cd[0].trace;\n var hoveron = trace.hoveron;\n var hasHoveronViolins = hoveron.indexOf(\"violins\") !== -1;\n var hasHoveronKDE = hoveron.indexOf(\"kde\") !== -1;\n var closeData = [];\n var closePtData;\n var violinLineAttrs;\n if (hasHoveronViolins || hasHoveronKDE) {\n var closeBoxData = boxHoverPoints.hoverOnBoxes(pointData, xval, yval, hovermode);\n if (hasHoveronKDE && closeBoxData.length > 0) {\n var xa = pointData.xa;\n var ya = pointData.ya;\n var pLetter, vLetter, pAxis, vAxis, vVal;\n if (trace.orientation === \"h\") {\n vVal = xval;\n pLetter = \"y\";\n pAxis = ya;\n vLetter = \"x\";\n vAxis = xa;\n } else {\n vVal = yval;\n pLetter = \"x\";\n pAxis = xa;\n vLetter = \"y\";\n vAxis = ya;\n }\n var di = cd[pointData.index];\n if (vVal >= di.span[0] && vVal <= di.span[1]) {\n var kdePointData = Lib.extendFlat({}, pointData);\n var vValPx = vAxis.c2p(vVal, true);\n var kdeVal = helpers.getKdeValue(di, trace, vVal);\n var pOnPath = helpers.getPositionOnKdePath(di, trace, vValPx);\n var paOffset = pAxis._offset;\n var paLength = pAxis._length;\n kdePointData[pLetter + \"0\"] = pOnPath[0];\n kdePointData[pLetter + \"1\"] = pOnPath[1];\n kdePointData[vLetter + \"0\"] = kdePointData[vLetter + \"1\"] = vValPx;\n kdePointData[vLetter + \"Label\"] = vLetter + \": \" + Axes.hoverLabelText(vAxis, vVal, trace[vLetter + \"hoverformat\"]) + \", \" + cd[0].t.labels.kde + \" \" + kdeVal.toFixed(3);\n var medId = 0;\n for (var k = 0; k < closeBoxData.length; k++) {\n if (closeBoxData[k].attr === \"med\") {\n medId = k;\n break;\n }\n }\n kdePointData.spikeDistance = closeBoxData[medId].spikeDistance;\n var spikePosAttr = pLetter + \"Spike\";\n kdePointData[spikePosAttr] = closeBoxData[medId][spikePosAttr];\n closeBoxData[medId].spikeDistance = void 0;\n closeBoxData[medId][spikePosAttr] = void 0;\n kdePointData.hovertemplate = false;\n closeData.push(kdePointData);\n violinLineAttrs = {};\n violinLineAttrs[pLetter + \"1\"] = Lib.constrain(paOffset + pOnPath[0], paOffset, paOffset + paLength);\n violinLineAttrs[pLetter + \"2\"] = Lib.constrain(paOffset + pOnPath[1], paOffset, paOffset + paLength);\n violinLineAttrs[vLetter + \"1\"] = violinLineAttrs[vLetter + \"2\"] = vAxis._offset + vValPx;\n }\n }\n if (hasHoveronViolins) {\n closeData = closeData.concat(closeBoxData);\n }\n }\n if (hoveron.indexOf(\"points\") !== -1) {\n closePtData = boxHoverPoints.hoverOnPoints(pointData, xval, yval);\n }\n var violinLine = hoverLayer.selectAll(\".violinline-\" + trace.uid).data(violinLineAttrs ? [0] : []);\n violinLine.enter().append(\"line\").classed(\"violinline-\" + trace.uid, true).attr(\"stroke-width\", 1.5);\n violinLine.exit().remove();\n violinLine.attr(violinLineAttrs).call(Color2.stroke, pointData.color);\n if (hovermode === \"closest\") {\n if (closePtData) return [closePtData];\n return closeData;\n }\n if (closePtData) {\n closeData.push(closePtData);\n return closeData;\n }\n return closeData;\n };\n }\n });\n\n // src/traces/violin/index.js\n var require_violin = __commonJS({\n \"src/traces/violin/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes31(),\n layoutAttributes: require_layout_attributes9(),\n supplyDefaults: require_defaults27(),\n crossTraceDefaults: require_defaults20().crossTraceDefaults,\n supplyLayoutDefaults: require_layout_defaults8(),\n calc: require_calc12(),\n crossTraceCalc: require_cross_trace_calc4(),\n plot: require_plot8(),\n style: require_style8(),\n styleOnSelect: require_style2().styleOnSelect,\n hoverPoints: require_hover10(),\n selectPoints: require_select4(),\n moduleType: \"trace\",\n name: \"violin\",\n basePlotModule: require_cartesian(),\n categories: [\"cartesian\", \"svg\", \"symbols\", \"oriented\", \"box-violin\", \"showLegend\", \"violinLayout\", \"zoomScale\"],\n meta: {}\n };\n }\n });\n\n // lib/violin.js\n var require_violin2 = __commonJS({\n \"lib/violin.js\"(exports, module) {\n \"use strict\";\n module.exports = require_violin();\n }\n });\n\n // src/traces/funnel/constants.js\n var require_constants17 = __commonJS({\n \"src/traces/funnel/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n eventDataKeys: [\n \"percentInitial\",\n \"percentPrevious\",\n \"percentTotal\"\n ]\n };\n }\n });\n\n // src/traces/funnel/attributes.js\n var require_attributes32 = __commonJS({\n \"src/traces/funnel/attributes.js\"(exports, module) {\n \"use strict\";\n var barAttrs = require_attributes23();\n var lineAttrs = require_attributes12().line;\n var baseAttrs = require_attributes2();\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var constants = require_constants17();\n var extendFlat = require_extend().extendFlat;\n var Color2 = require_color();\n module.exports = {\n x: barAttrs.x,\n x0: barAttrs.x0,\n dx: barAttrs.dx,\n y: barAttrs.y,\n y0: barAttrs.y0,\n dy: barAttrs.dy,\n xperiod: barAttrs.xperiod,\n yperiod: barAttrs.yperiod,\n xperiod0: barAttrs.xperiod0,\n yperiod0: barAttrs.yperiod0,\n xperiodalignment: barAttrs.xperiodalignment,\n yperiodalignment: barAttrs.yperiodalignment,\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n hovertext: barAttrs.hovertext,\n hovertemplate: hovertemplateAttrs({}, {\n keys: constants.eventDataKeys\n }),\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: [\"name\", \"x\", \"y\", \"text\", \"percent initial\", \"percent previous\", \"percent total\"]\n }),\n textinfo: {\n valType: \"flaglist\",\n flags: [\"label\", \"text\", \"percent initial\", \"percent previous\", \"percent total\", \"value\"],\n extras: [\"none\"],\n editType: \"plot\",\n arrayOk: false\n },\n // TODO: incorporate `label` and `value` in the eventData\n texttemplate: texttemplateAttrs({ editType: \"plot\" }, {\n keys: constants.eventDataKeys.concat([\"label\", \"value\"])\n }),\n text: barAttrs.text,\n textposition: barAttrs.textposition,\n insidetextanchor: extendFlat({}, barAttrs.insidetextanchor, { dflt: \"middle\" }),\n textangle: extendFlat({}, barAttrs.textangle, { dflt: 0 }),\n textfont: barAttrs.textfont,\n insidetextfont: barAttrs.insidetextfont,\n outsidetextfont: barAttrs.outsidetextfont,\n constraintext: barAttrs.constraintext,\n cliponaxis: barAttrs.cliponaxis,\n orientation: extendFlat({}, barAttrs.orientation, {}),\n offset: extendFlat({}, barAttrs.offset, { arrayOk: false }),\n width: extendFlat({}, barAttrs.width, { arrayOk: false }),\n marker: funnelMarker(),\n connector: {\n fillcolor: {\n valType: \"color\",\n editType: \"style\"\n },\n line: {\n color: extendFlat({}, lineAttrs.color, { dflt: Color2.defaultLine }),\n width: extendFlat({}, lineAttrs.width, {\n dflt: 0,\n editType: \"plot\"\n }),\n dash: lineAttrs.dash,\n editType: \"style\"\n },\n visible: {\n valType: \"boolean\",\n dflt: true,\n editType: \"plot\"\n },\n editType: \"plot\"\n },\n offsetgroup: barAttrs.offsetgroup,\n alignmentgroup: barAttrs.alignmentgroup,\n zorder: barAttrs.zorder\n };\n function funnelMarker() {\n var marker = extendFlat({}, barAttrs.marker);\n delete marker.pattern;\n delete marker.cornerradius;\n return marker;\n }\n }\n });\n\n // src/traces/funnel/layout_attributes.js\n var require_layout_attributes10 = __commonJS({\n \"src/traces/funnel/layout_attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n funnelmode: {\n valType: \"enumerated\",\n values: [\"stack\", \"group\", \"overlay\"],\n dflt: \"stack\",\n editType: \"calc\"\n },\n funnelgap: {\n valType: \"number\",\n min: 0,\n max: 1,\n editType: \"calc\"\n },\n funnelgroupgap: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0,\n editType: \"calc\"\n }\n };\n }\n });\n\n // src/traces/funnel/defaults.js\n var require_defaults28 = __commonJS({\n \"src/traces/funnel/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleGroupingDefaults = require_grouping_defaults();\n var handleText = require_defaults19().handleText;\n var handleXYDefaults = require_xy_defaults();\n var handlePeriodDefaults = require_period_defaults();\n var attributes = require_attributes32();\n var Color2 = require_color();\n function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var len = handleXYDefaults(traceIn, traceOut, layout, coerce);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n handlePeriodDefaults(traceIn, traceOut, layout, coerce);\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n coerce(\"orientation\", traceOut.y && !traceOut.x ? \"v\" : \"h\");\n coerce(\"offset\");\n coerce(\"width\");\n var text = coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n var textposition = coerce(\"textposition\");\n handleText(traceIn, traceOut, layout, coerce, textposition, {\n moduleHasSelected: false,\n moduleHasUnselected: false,\n moduleHasConstrain: true,\n moduleHasCliponaxis: true,\n moduleHasTextangle: true,\n moduleHasInsideanchor: true\n });\n if (traceOut.textposition !== \"none\" && !traceOut.texttemplate) {\n coerce(\"textinfo\", Lib.isArrayOrTypedArray(text) ? \"text+value\" : \"value\");\n }\n var markerColor = coerce(\"marker.color\", defaultColor);\n coerce(\"marker.line.color\", Color2.defaultLine);\n coerce(\"marker.line.width\");\n var connectorVisible = coerce(\"connector.visible\");\n if (connectorVisible) {\n coerce(\"connector.fillcolor\", defaultFillColor(markerColor));\n var connectorLineWidth = coerce(\"connector.line.width\");\n if (connectorLineWidth) {\n coerce(\"connector.line.color\");\n coerce(\"connector.line.dash\");\n }\n }\n coerce(\"zorder\");\n }\n function defaultFillColor(markerColor) {\n var cBase = Lib.isArrayOrTypedArray(markerColor) ? \"#000\" : markerColor;\n return Color2.addOpacity(cBase, 0.5 * Color2.opacity(cBase));\n }\n function crossTraceDefaults(fullData, fullLayout) {\n var traceIn, traceOut;\n function coerce(attr) {\n return Lib.coerce(traceOut._input, traceOut, attributes, attr);\n }\n for (var i = 0; i < fullData.length; i++) {\n traceOut = fullData[i];\n if (traceOut.type === \"funnel\") {\n traceIn = traceOut._input;\n handleGroupingDefaults(traceIn, traceOut, fullLayout, coerce, fullLayout.funnelmode);\n }\n }\n }\n module.exports = {\n supplyDefaults,\n crossTraceDefaults\n };\n }\n });\n\n // src/traces/funnel/layout_defaults.js\n var require_layout_defaults9 = __commonJS({\n \"src/traces/funnel/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var layoutAttributes = require_layout_attributes10();\n module.exports = function(layoutIn, layoutOut, fullData) {\n var hasTraceType = false;\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);\n }\n for (var i = 0; i < fullData.length; i++) {\n var trace = fullData[i];\n if (trace.visible && trace.type === \"funnel\") {\n hasTraceType = true;\n break;\n }\n }\n if (hasTraceType) {\n coerce(\"funnelmode\");\n coerce(\"funnelgap\", 0.2);\n coerce(\"funnelgroupgap\");\n }\n };\n }\n });\n\n // src/traces/funnel/arrays_to_calcdata.js\n var require_arrays_to_calcdata3 = __commonJS({\n \"src/traces/funnel/arrays_to_calcdata.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n module.exports = function arraysToCalcdata(cd, trace) {\n for (var i = 0; i < cd.length; i++) cd[i].i = i;\n Lib.mergeArray(trace.text, cd, \"tx\");\n Lib.mergeArray(trace.hovertext, cd, \"htx\");\n var marker = trace.marker;\n if (marker) {\n Lib.mergeArray(marker.opacity, cd, \"mo\");\n Lib.mergeArray(marker.color, cd, \"mc\");\n var markerLine = marker.line;\n if (markerLine) {\n Lib.mergeArray(markerLine.color, cd, \"mlc\");\n Lib.mergeArrayCastPositive(markerLine.width, cd, \"mlw\");\n }\n }\n };\n }\n });\n\n // src/traces/funnel/calc.js\n var require_calc13 = __commonJS({\n \"src/traces/funnel/calc.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n var alignPeriod = require_align_period();\n var arraysToCalcdata = require_arrays_to_calcdata3();\n var calcSelection = require_calc_selection();\n var BADNUM = require_numerical().BADNUM;\n module.exports = function calc(gd, trace) {\n var xa = Axes.getFromId(gd, trace.xaxis || \"x\");\n var ya = Axes.getFromId(gd, trace.yaxis || \"y\");\n var size, pos, origPos, pObj, hasPeriod, pLetter, i, cdi;\n if (trace.orientation === \"h\") {\n size = xa.makeCalcdata(trace, \"x\");\n origPos = ya.makeCalcdata(trace, \"y\");\n pObj = alignPeriod(trace, ya, \"y\", origPos);\n hasPeriod = !!trace.yperiodalignment;\n pLetter = \"y\";\n } else {\n size = ya.makeCalcdata(trace, \"y\");\n origPos = xa.makeCalcdata(trace, \"x\");\n pObj = alignPeriod(trace, xa, \"x\", origPos);\n hasPeriod = !!trace.xperiodalignment;\n pLetter = \"x\";\n }\n pos = pObj.vals;\n var serieslen = Math.min(pos.length, size.length);\n var cd = new Array(serieslen);\n trace._base = [];\n for (i = 0; i < serieslen; i++) {\n if (size[i] < 0) size[i] = BADNUM;\n var connectToNext = false;\n if (size[i] !== BADNUM) {\n if (i + 1 < serieslen && size[i + 1] !== BADNUM) {\n connectToNext = true;\n }\n }\n cdi = cd[i] = {\n p: pos[i],\n s: size[i],\n cNext: connectToNext\n };\n trace._base[i] = -0.5 * cdi.s;\n if (hasPeriod) {\n cd[i].orig_p = origPos[i];\n cd[i][pLetter + \"End\"] = pObj.ends[i];\n cd[i][pLetter + \"Start\"] = pObj.starts[i];\n }\n if (trace.ids) {\n cdi.id = String(trace.ids[i]);\n }\n if (i === 0) cd[0].vTotal = 0;\n cd[0].vTotal += fixNum(cdi.s);\n cdi.begR = fixNum(cdi.s) / fixNum(cd[0].s);\n }\n var prevGoodNum;\n for (i = 0; i < serieslen; i++) {\n cdi = cd[i];\n if (cdi.s === BADNUM) continue;\n cdi.sumR = cdi.s / cd[0].vTotal;\n cdi.difR = prevGoodNum !== void 0 ? cdi.s / prevGoodNum : 1;\n prevGoodNum = cdi.s;\n }\n arraysToCalcdata(cd, trace);\n calcSelection(cd, trace);\n return cd;\n };\n function fixNum(a) {\n return a === BADNUM ? 0 : a;\n }\n }\n });\n\n // src/traces/funnel/cross_trace_calc.js\n var require_cross_trace_calc5 = __commonJS({\n \"src/traces/funnel/cross_trace_calc.js\"(exports, module) {\n \"use strict\";\n var setGroupPositions = require_cross_trace_calc().setGroupPositions;\n module.exports = function crossTraceCalc(gd, plotinfo) {\n var fullLayout = gd._fullLayout;\n var fullData = gd._fullData;\n var calcdata = gd.calcdata;\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var funnels = [];\n var funnelsVert = [];\n var funnelsHorz = [];\n var cd, i;\n for (i = 0; i < fullData.length; i++) {\n var fullTrace = fullData[i];\n var isHorizontal = fullTrace.orientation === \"h\";\n if (fullTrace.visible === true && fullTrace.xaxis === xa._id && fullTrace.yaxis === ya._id && fullTrace.type === \"funnel\") {\n cd = calcdata[i];\n if (isHorizontal) {\n funnelsHorz.push(cd);\n } else {\n funnelsVert.push(cd);\n }\n funnels.push(cd);\n }\n }\n var opts = {\n mode: fullLayout.funnelmode,\n norm: fullLayout.funnelnorm,\n gap: fullLayout.funnelgap,\n groupgap: fullLayout.funnelgroupgap\n };\n setGroupPositions(gd, xa, ya, funnelsVert, opts);\n setGroupPositions(gd, ya, xa, funnelsHorz, opts);\n for (i = 0; i < funnels.length; i++) {\n cd = funnels[i];\n for (var j = 0; j < cd.length; j++) {\n if (j + 1 < cd.length) {\n cd[j].nextP0 = cd[j + 1].p0;\n cd[j].nextS0 = cd[j + 1].s0;\n cd[j].nextP1 = cd[j + 1].p1;\n cd[j].nextS1 = cd[j + 1].s1;\n }\n }\n }\n };\n }\n });\n\n // src/traces/funnel/plot.js\n var require_plot9 = __commonJS({\n \"src/traces/funnel/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var Drawing = require_drawing();\n var BADNUM = require_numerical().BADNUM;\n var barPlot = require_plot3();\n var clearMinTextSize = require_uniform_text().clearMinTextSize;\n module.exports = function plot(gd, plotinfo, cdModule, traceLayer) {\n var fullLayout = gd._fullLayout;\n clearMinTextSize(\"funnel\", fullLayout);\n plotConnectorRegions(gd, plotinfo, cdModule, traceLayer);\n plotConnectorLines(gd, plotinfo, cdModule, traceLayer);\n barPlot.plot(gd, plotinfo, cdModule, traceLayer, {\n mode: fullLayout.funnelmode,\n norm: fullLayout.funnelmode,\n gap: fullLayout.funnelgap,\n groupgap: fullLayout.funnelgroupgap\n });\n };\n function plotConnectorRegions(gd, plotinfo, cdModule, traceLayer) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n Lib.makeTraceGroups(traceLayer, cdModule, \"trace bars\").each(function(cd) {\n var plotGroup = d3.select(this);\n var trace = cd[0].trace;\n var group = Lib.ensureSingle(plotGroup, \"g\", \"regions\");\n if (!trace.connector || !trace.connector.visible) {\n group.remove();\n return;\n }\n var isHorizontal = trace.orientation === \"h\";\n var connectors = group.selectAll(\"g.region\").data(Lib.identity);\n connectors.enter().append(\"g\").classed(\"region\", true);\n connectors.exit().remove();\n var len = connectors.size();\n connectors.each(function(di, i) {\n if (i !== len - 1 && !di.cNext) return;\n var xy = getXY(di, xa, ya, isHorizontal);\n var x = xy[0];\n var y = xy[1];\n var shape = \"\";\n if (x[0] !== BADNUM && y[0] !== BADNUM && x[1] !== BADNUM && y[1] !== BADNUM && x[2] !== BADNUM && y[2] !== BADNUM && x[3] !== BADNUM && y[3] !== BADNUM) {\n if (isHorizontal) {\n shape += \"M\" + x[0] + \",\" + y[1] + \"L\" + x[2] + \",\" + y[2] + \"H\" + x[3] + \"L\" + x[1] + \",\" + y[1] + \"Z\";\n } else {\n shape += \"M\" + x[1] + \",\" + y[1] + \"L\" + x[2] + \",\" + y[3] + \"V\" + y[2] + \"L\" + x[1] + \",\" + y[0] + \"Z\";\n }\n }\n if (shape === \"\") shape = \"M0,0Z\";\n Lib.ensureSingle(d3.select(this), \"path\").attr(\"d\", shape).call(Drawing.setClipUrl, plotinfo.layerClipId, gd);\n });\n });\n }\n function plotConnectorLines(gd, plotinfo, cdModule, traceLayer) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n Lib.makeTraceGroups(traceLayer, cdModule, \"trace bars\").each(function(cd) {\n var plotGroup = d3.select(this);\n var trace = cd[0].trace;\n var group = Lib.ensureSingle(plotGroup, \"g\", \"lines\");\n if (!trace.connector || !trace.connector.visible || !trace.connector.line.width) {\n group.remove();\n return;\n }\n var isHorizontal = trace.orientation === \"h\";\n var connectors = group.selectAll(\"g.line\").data(Lib.identity);\n connectors.enter().append(\"g\").classed(\"line\", true);\n connectors.exit().remove();\n var len = connectors.size();\n connectors.each(function(di, i) {\n if (i !== len - 1 && !di.cNext) return;\n var xy = getXY(di, xa, ya, isHorizontal);\n var x = xy[0];\n var y = xy[1];\n var shape = \"\";\n if (x[3] !== void 0 && y[3] !== void 0) {\n if (isHorizontal) {\n shape += \"M\" + x[0] + \",\" + y[1] + \"L\" + x[2] + \",\" + y[2];\n shape += \"M\" + x[1] + \",\" + y[1] + \"L\" + x[3] + \",\" + y[2];\n } else {\n shape += \"M\" + x[1] + \",\" + y[1] + \"L\" + x[2] + \",\" + y[3];\n shape += \"M\" + x[1] + \",\" + y[0] + \"L\" + x[2] + \",\" + y[2];\n }\n }\n if (shape === \"\") shape = \"M0,0Z\";\n Lib.ensureSingle(d3.select(this), \"path\").attr(\"d\", shape).call(Drawing.setClipUrl, plotinfo.layerClipId, gd);\n });\n });\n }\n function getXY(di, xa, ya, isHorizontal) {\n var s = [];\n var p = [];\n var sAxis = isHorizontal ? xa : ya;\n var pAxis = isHorizontal ? ya : xa;\n s[0] = sAxis.c2p(di.s0, true);\n p[0] = pAxis.c2p(di.p0, true);\n s[1] = sAxis.c2p(di.s1, true);\n p[1] = pAxis.c2p(di.p1, true);\n s[2] = sAxis.c2p(di.nextS0, true);\n p[2] = pAxis.c2p(di.nextP0, true);\n s[3] = sAxis.c2p(di.nextS1, true);\n p[3] = pAxis.c2p(di.nextP1, true);\n return isHorizontal ? [s, p] : [p, s];\n }\n }\n });\n\n // src/traces/funnel/style.js\n var require_style9 = __commonJS({\n \"src/traces/funnel/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Drawing = require_drawing();\n var Color2 = require_color();\n var DESELECTDIM = require_interactions().DESELECTDIM;\n var barStyle = require_style4();\n var resizeText = require_uniform_text().resizeText;\n var styleTextPoints = barStyle.styleTextPoints;\n function style(gd, cd, sel) {\n var s = sel ? sel : d3.select(gd).selectAll('g[class^=\"funnellayer\"]').selectAll(\"g.trace\");\n resizeText(gd, s, \"funnel\");\n s.style(\"opacity\", function(d) {\n return d[0].trace.opacity;\n });\n s.each(function(d) {\n var gTrace = d3.select(this);\n var trace = d[0].trace;\n gTrace.selectAll(\".point > path\").each(function(di) {\n if (!di.isBlank) {\n var cont = trace.marker;\n d3.select(this).call(Color2.fill, di.mc || cont.color).call(Color2.stroke, di.mlc || cont.line.color).call(Drawing.dashLine, cont.line.dash, di.mlw || cont.line.width).style(\"opacity\", trace.selectedpoints && !di.selected ? DESELECTDIM : 1);\n }\n });\n styleTextPoints(gTrace, trace, gd);\n gTrace.selectAll(\".regions\").each(function() {\n d3.select(this).selectAll(\"path\").style(\"stroke-width\", 0).call(Color2.fill, trace.connector.fillcolor);\n });\n gTrace.selectAll(\".lines\").each(function() {\n var cont = trace.connector.line;\n Drawing.lineGroupStyle(\n d3.select(this).selectAll(\"path\"),\n cont.width,\n cont.color,\n cont.dash\n );\n });\n });\n }\n module.exports = {\n style\n };\n }\n });\n\n // src/traces/funnel/hover.js\n var require_hover11 = __commonJS({\n \"src/traces/funnel/hover.js\"(exports, module) {\n \"use strict\";\n var opacity = require_color().opacity;\n var hoverOnBars = require_hover3().hoverOnBars;\n var formatPercent = require_lib().formatPercent;\n module.exports = function hoverPoints(pointData, xval, yval, hovermode, opts) {\n var point = hoverOnBars(pointData, xval, yval, hovermode, opts);\n if (!point) return;\n var cd = point.cd;\n var trace = cd[0].trace;\n var isHorizontal = trace.orientation === \"h\";\n var index = point.index;\n var di = cd[index];\n var sizeLetter = isHorizontal ? \"x\" : \"y\";\n point[sizeLetter + \"LabelVal\"] = di.s;\n point.percentInitial = di.begR;\n point.percentInitialLabel = formatPercent(di.begR, 1);\n point.percentPrevious = di.difR;\n point.percentPreviousLabel = formatPercent(di.difR, 1);\n point.percentTotal = di.sumR;\n point.percentTotalLabel = formatPercent(di.sumR, 1);\n var hoverinfo = di.hi || trace.hoverinfo;\n var text = [];\n if (hoverinfo && hoverinfo !== \"none\" && hoverinfo !== \"skip\") {\n var isAll = hoverinfo === \"all\";\n var parts = hoverinfo.split(\"+\");\n var hasFlag = function(flag) {\n return isAll || parts.indexOf(flag) !== -1;\n };\n if (hasFlag(\"percent initial\")) {\n text.push(point.percentInitialLabel + \" of initial\");\n }\n if (hasFlag(\"percent previous\")) {\n text.push(point.percentPreviousLabel + \" of previous\");\n }\n if (hasFlag(\"percent total\")) {\n text.push(point.percentTotalLabel + \" of total\");\n }\n }\n point.extraText = text.join(\"
    \");\n point.color = getTraceColor(trace, di);\n return [point];\n };\n function getTraceColor(trace, di) {\n var cont = trace.marker;\n var mc = di.mc || cont.color;\n var mlc = di.mlc || cont.line.color;\n var mlw = di.mlw || cont.line.width;\n if (opacity(mc)) return mc;\n else if (opacity(mlc) && mlw) return mlc;\n }\n }\n });\n\n // src/traces/funnel/event_data.js\n var require_event_data5 = __commonJS({\n \"src/traces/funnel/event_data.js\"(exports, module) {\n \"use strict\";\n module.exports = function eventData(out, pt) {\n out.x = \"xVal\" in pt ? pt.xVal : pt.x;\n out.y = \"yVal\" in pt ? pt.yVal : pt.y;\n if (\"percentInitial\" in pt) out.percentInitial = pt.percentInitial;\n if (\"percentPrevious\" in pt) out.percentPrevious = pt.percentPrevious;\n if (\"percentTotal\" in pt) out.percentTotal = pt.percentTotal;\n if (pt.xa) out.xaxis = pt.xa;\n if (pt.ya) out.yaxis = pt.ya;\n return out;\n };\n }\n });\n\n // src/traces/funnel/index.js\n var require_funnel = __commonJS({\n \"src/traces/funnel/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes32(),\n layoutAttributes: require_layout_attributes10(),\n supplyDefaults: require_defaults28().supplyDefaults,\n crossTraceDefaults: require_defaults28().crossTraceDefaults,\n supplyLayoutDefaults: require_layout_defaults9(),\n calc: require_calc13(),\n crossTraceCalc: require_cross_trace_calc5(),\n plot: require_plot9(),\n style: require_style9().style,\n hoverPoints: require_hover11(),\n eventData: require_event_data5(),\n selectPoints: require_select3(),\n moduleType: \"trace\",\n name: \"funnel\",\n basePlotModule: require_cartesian(),\n categories: [\"bar-like\", \"cartesian\", \"svg\", \"oriented\", \"showLegend\", \"zoomScale\"],\n meta: {}\n };\n }\n });\n\n // lib/funnel.js\n var require_funnel2 = __commonJS({\n \"lib/funnel.js\"(exports, module) {\n \"use strict\";\n module.exports = require_funnel();\n }\n });\n\n // src/traces/waterfall/constants.js\n var require_constants18 = __commonJS({\n \"src/traces/waterfall/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n eventDataKeys: [\n \"initial\",\n \"delta\",\n \"final\"\n ]\n };\n }\n });\n\n // src/traces/waterfall/attributes.js\n var require_attributes33 = __commonJS({\n \"src/traces/waterfall/attributes.js\"(exports, module) {\n \"use strict\";\n var barAttrs = require_attributes23();\n var lineAttrs = require_attributes12().line;\n var baseAttrs = require_attributes2();\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var constants = require_constants18();\n var extendFlat = require_extend().extendFlat;\n var Color2 = require_color();\n function directionAttrs(dirTxt) {\n return {\n marker: {\n color: extendFlat({}, barAttrs.marker.color, {\n arrayOk: false,\n editType: \"style\"\n }),\n line: {\n color: extendFlat({}, barAttrs.marker.line.color, {\n arrayOk: false,\n editType: \"style\"\n }),\n width: extendFlat({}, barAttrs.marker.line.width, {\n arrayOk: false,\n editType: \"style\"\n }),\n editType: \"style\"\n },\n editType: \"style\"\n },\n editType: \"style\"\n };\n }\n module.exports = {\n measure: {\n valType: \"data_array\",\n dflt: [],\n editType: \"calc\"\n },\n base: {\n valType: \"number\",\n dflt: null,\n arrayOk: false,\n editType: \"calc\"\n },\n x: barAttrs.x,\n x0: barAttrs.x0,\n dx: barAttrs.dx,\n y: barAttrs.y,\n y0: barAttrs.y0,\n dy: barAttrs.dy,\n xperiod: barAttrs.xperiod,\n yperiod: barAttrs.yperiod,\n xperiod0: barAttrs.xperiod0,\n yperiod0: barAttrs.yperiod0,\n xperiodalignment: barAttrs.xperiodalignment,\n yperiodalignment: barAttrs.yperiodalignment,\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n hovertext: barAttrs.hovertext,\n hovertemplate: hovertemplateAttrs({}, {\n keys: constants.eventDataKeys\n }),\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: [\"name\", \"x\", \"y\", \"text\", \"initial\", \"delta\", \"final\"]\n }),\n textinfo: {\n valType: \"flaglist\",\n flags: [\"label\", \"text\", \"initial\", \"delta\", \"final\"],\n extras: [\"none\"],\n editType: \"plot\",\n arrayOk: false\n },\n // TODO: incorporate `label` and `value` in the eventData\n texttemplate: texttemplateAttrs({ editType: \"plot\" }, {\n keys: constants.eventDataKeys.concat([\"label\"])\n }),\n text: barAttrs.text,\n textposition: barAttrs.textposition,\n insidetextanchor: barAttrs.insidetextanchor,\n textangle: barAttrs.textangle,\n textfont: barAttrs.textfont,\n insidetextfont: barAttrs.insidetextfont,\n outsidetextfont: barAttrs.outsidetextfont,\n constraintext: barAttrs.constraintext,\n cliponaxis: barAttrs.cliponaxis,\n orientation: barAttrs.orientation,\n offset: barAttrs.offset,\n width: barAttrs.width,\n increasing: directionAttrs(\"increasing\"),\n decreasing: directionAttrs(\"decreasing\"),\n totals: directionAttrs(\"intermediate sums and total\"),\n connector: {\n line: {\n color: extendFlat({}, lineAttrs.color, { dflt: Color2.defaultLine }),\n width: extendFlat({}, lineAttrs.width, {\n editType: \"plot\"\n // i.e. to adjust bars is mode: 'between'. See https://github.com/plotly/plotly.js/issues/3787\n }),\n dash: lineAttrs.dash,\n editType: \"plot\"\n },\n mode: {\n valType: \"enumerated\",\n values: [\"spanning\", \"between\"],\n dflt: \"between\",\n editType: \"plot\"\n },\n visible: {\n valType: \"boolean\",\n dflt: true,\n editType: \"plot\"\n },\n editType: \"plot\"\n },\n offsetgroup: barAttrs.offsetgroup,\n alignmentgroup: barAttrs.alignmentgroup,\n zorder: barAttrs.zorder\n };\n }\n });\n\n // src/traces/waterfall/layout_attributes.js\n var require_layout_attributes11 = __commonJS({\n \"src/traces/waterfall/layout_attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n waterfallmode: {\n valType: \"enumerated\",\n values: [\"group\", \"overlay\"],\n dflt: \"group\",\n editType: \"calc\"\n },\n waterfallgap: {\n valType: \"number\",\n min: 0,\n max: 1,\n editType: \"calc\"\n },\n waterfallgroupgap: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0,\n editType: \"calc\"\n }\n };\n }\n });\n\n // src/constants/delta.js\n var require_delta = __commonJS({\n \"src/constants/delta.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n INCREASING: {\n COLOR: \"#3D9970\",\n SYMBOL: \"\\u25B2\"\n },\n DECREASING: {\n COLOR: \"#FF4136\",\n SYMBOL: \"\\u25BC\"\n }\n };\n }\n });\n\n // src/traces/waterfall/defaults.js\n var require_defaults29 = __commonJS({\n \"src/traces/waterfall/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleGroupingDefaults = require_grouping_defaults();\n var handleText = require_defaults19().handleText;\n var handleXYDefaults = require_xy_defaults();\n var handlePeriodDefaults = require_period_defaults();\n var attributes = require_attributes33();\n var Color2 = require_color();\n var delta = require_delta();\n var INCREASING_COLOR = delta.INCREASING.COLOR;\n var DECREASING_COLOR = delta.DECREASING.COLOR;\n var TOTALS_COLOR = \"#4499FF\";\n function handleDirection(coerce, direction, defaultColor) {\n coerce(direction + \".marker.color\", defaultColor);\n coerce(direction + \".marker.line.color\", Color2.defaultLine);\n coerce(direction + \".marker.line.width\");\n }\n function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var len = handleXYDefaults(traceIn, traceOut, layout, coerce);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n handlePeriodDefaults(traceIn, traceOut, layout, coerce);\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n coerce(\"measure\");\n coerce(\"orientation\", traceOut.x && !traceOut.y ? \"h\" : \"v\");\n coerce(\"base\");\n coerce(\"offset\");\n coerce(\"width\");\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n var textposition = coerce(\"textposition\");\n handleText(traceIn, traceOut, layout, coerce, textposition, {\n moduleHasSelected: false,\n moduleHasUnselected: false,\n moduleHasConstrain: true,\n moduleHasCliponaxis: true,\n moduleHasTextangle: true,\n moduleHasInsideanchor: true\n });\n if (traceOut.textposition !== \"none\") {\n coerce(\"texttemplate\");\n if (!traceOut.texttemplate) coerce(\"textinfo\");\n }\n handleDirection(coerce, \"increasing\", INCREASING_COLOR);\n handleDirection(coerce, \"decreasing\", DECREASING_COLOR);\n handleDirection(coerce, \"totals\", TOTALS_COLOR);\n var connectorVisible = coerce(\"connector.visible\");\n if (connectorVisible) {\n coerce(\"connector.mode\");\n var connectorLineWidth = coerce(\"connector.line.width\");\n if (connectorLineWidth) {\n coerce(\"connector.line.color\");\n coerce(\"connector.line.dash\");\n }\n }\n coerce(\"zorder\");\n }\n function crossTraceDefaults(fullData, fullLayout) {\n var traceIn, traceOut;\n function coerce(attr) {\n return Lib.coerce(traceOut._input, traceOut, attributes, attr);\n }\n if (fullLayout.waterfallmode === \"group\") {\n for (var i = 0; i < fullData.length; i++) {\n traceOut = fullData[i];\n traceIn = traceOut._input;\n handleGroupingDefaults(traceIn, traceOut, fullLayout, coerce, fullLayout.waterfallmode);\n }\n }\n }\n module.exports = {\n supplyDefaults,\n crossTraceDefaults\n };\n }\n });\n\n // src/traces/waterfall/layout_defaults.js\n var require_layout_defaults10 = __commonJS({\n \"src/traces/waterfall/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var layoutAttributes = require_layout_attributes11();\n module.exports = function(layoutIn, layoutOut, fullData) {\n var hasTraceType = false;\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);\n }\n for (var i = 0; i < fullData.length; i++) {\n var trace = fullData[i];\n if (trace.visible && trace.type === \"waterfall\") {\n hasTraceType = true;\n break;\n }\n }\n if (hasTraceType) {\n coerce(\"waterfallmode\");\n coerce(\"waterfallgap\", 0.2);\n coerce(\"waterfallgroupgap\");\n }\n };\n }\n });\n\n // src/traces/waterfall/calc.js\n var require_calc14 = __commonJS({\n \"src/traces/waterfall/calc.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n var alignPeriod = require_align_period();\n var mergeArray = require_lib().mergeArray;\n var calcSelection = require_calc_selection();\n var BADNUM = require_numerical().BADNUM;\n function isAbsolute(a) {\n return a === \"a\" || a === \"absolute\";\n }\n function isTotal(a) {\n return a === \"t\" || a === \"total\";\n }\n module.exports = function calc(gd, trace) {\n var xa = Axes.getFromId(gd, trace.xaxis || \"x\");\n var ya = Axes.getFromId(gd, trace.yaxis || \"y\");\n var size, pos, origPos, pObj, hasPeriod, pLetter;\n if (trace.orientation === \"h\") {\n size = xa.makeCalcdata(trace, \"x\");\n origPos = ya.makeCalcdata(trace, \"y\");\n pObj = alignPeriod(trace, ya, \"y\", origPos);\n hasPeriod = !!trace.yperiodalignment;\n pLetter = \"y\";\n } else {\n size = ya.makeCalcdata(trace, \"y\");\n origPos = xa.makeCalcdata(trace, \"x\");\n pObj = alignPeriod(trace, xa, \"x\", origPos);\n hasPeriod = !!trace.xperiodalignment;\n pLetter = \"x\";\n }\n pos = pObj.vals;\n var serieslen = Math.min(pos.length, size.length);\n var cd = new Array(serieslen);\n var previousSum = 0;\n var newSize;\n var hasTotals = false;\n for (var i = 0; i < serieslen; i++) {\n var amount = size[i] || 0;\n var connectToNext = false;\n if (size[i] !== BADNUM || isTotal(trace.measure[i]) || isAbsolute(trace.measure[i])) {\n if (i + 1 < serieslen && (size[i + 1] !== BADNUM || isTotal(trace.measure[i + 1]) || isAbsolute(trace.measure[i + 1]))) {\n connectToNext = true;\n }\n }\n var cdi = cd[i] = {\n i,\n p: pos[i],\n s: amount,\n rawS: amount,\n cNext: connectToNext\n };\n if (isAbsolute(trace.measure[i])) {\n previousSum = cdi.s;\n cdi.isSum = true;\n cdi.dir = \"totals\";\n cdi.s = previousSum;\n } else if (isTotal(trace.measure[i])) {\n cdi.isSum = true;\n cdi.dir = \"totals\";\n cdi.s = previousSum;\n } else {\n cdi.isSum = false;\n cdi.dir = cdi.rawS < 0 ? \"decreasing\" : \"increasing\";\n newSize = cdi.s;\n cdi.s = previousSum + newSize;\n previousSum += newSize;\n }\n if (cdi.dir === \"totals\") {\n hasTotals = true;\n }\n if (hasPeriod) {\n cd[i].orig_p = origPos[i];\n cd[i][pLetter + \"End\"] = pObj.ends[i];\n cd[i][pLetter + \"Start\"] = pObj.starts[i];\n }\n if (trace.ids) {\n cdi.id = String(trace.ids[i]);\n }\n cdi.v = (trace.base || 0) + previousSum;\n }\n if (cd.length) cd[0].hasTotals = hasTotals;\n mergeArray(trace.text, cd, \"tx\");\n mergeArray(trace.hovertext, cd, \"htx\");\n calcSelection(cd, trace);\n return cd;\n };\n }\n });\n\n // src/traces/waterfall/cross_trace_calc.js\n var require_cross_trace_calc6 = __commonJS({\n \"src/traces/waterfall/cross_trace_calc.js\"(exports, module) {\n \"use strict\";\n var setGroupPositions = require_cross_trace_calc().setGroupPositions;\n module.exports = function crossTraceCalc(gd, plotinfo) {\n var fullLayout = gd._fullLayout;\n var fullData = gd._fullData;\n var calcdata = gd.calcdata;\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var waterfalls = [];\n var waterfallsVert = [];\n var waterfallsHorz = [];\n var cd, i;\n for (i = 0; i < fullData.length; i++) {\n var fullTrace = fullData[i];\n if (fullTrace.visible === true && fullTrace.xaxis === xa._id && fullTrace.yaxis === ya._id && fullTrace.type === \"waterfall\") {\n cd = calcdata[i];\n if (fullTrace.orientation === \"h\") {\n waterfallsHorz.push(cd);\n } else {\n waterfallsVert.push(cd);\n }\n waterfalls.push(cd);\n }\n }\n var opts = {\n mode: fullLayout.waterfallmode,\n norm: fullLayout.waterfallnorm,\n gap: fullLayout.waterfallgap,\n groupgap: fullLayout.waterfallgroupgap\n };\n setGroupPositions(gd, xa, ya, waterfallsVert, opts);\n setGroupPositions(gd, ya, xa, waterfallsHorz, opts);\n for (i = 0; i < waterfalls.length; i++) {\n cd = waterfalls[i];\n for (var j = 0; j < cd.length; j++) {\n var di = cd[j];\n if (di.isSum === false) {\n di.s0 += j === 0 ? 0 : cd[j - 1].s;\n }\n if (j + 1 < cd.length) {\n cd[j].nextP0 = cd[j + 1].p0;\n cd[j].nextS0 = cd[j + 1].s0;\n }\n }\n }\n };\n }\n });\n\n // src/traces/waterfall/plot.js\n var require_plot10 = __commonJS({\n \"src/traces/waterfall/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var Drawing = require_drawing();\n var BADNUM = require_numerical().BADNUM;\n var barPlot = require_plot3();\n var clearMinTextSize = require_uniform_text().clearMinTextSize;\n module.exports = function plot(gd, plotinfo, cdModule, traceLayer) {\n var fullLayout = gd._fullLayout;\n clearMinTextSize(\"waterfall\", fullLayout);\n barPlot.plot(gd, plotinfo, cdModule, traceLayer, {\n mode: fullLayout.waterfallmode,\n norm: fullLayout.waterfallmode,\n gap: fullLayout.waterfallgap,\n groupgap: fullLayout.waterfallgroupgap\n });\n plotConnectors(gd, plotinfo, cdModule, traceLayer);\n };\n function plotConnectors(gd, plotinfo, cdModule, traceLayer) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n Lib.makeTraceGroups(traceLayer, cdModule, \"trace bars\").each(function(cd) {\n var plotGroup = d3.select(this);\n var trace = cd[0].trace;\n var group = Lib.ensureSingle(plotGroup, \"g\", \"lines\");\n if (!trace.connector || !trace.connector.visible) {\n group.remove();\n return;\n }\n var isHorizontal = trace.orientation === \"h\";\n var mode = trace.connector.mode;\n var connectors = group.selectAll(\"g.line\").data(Lib.identity);\n connectors.enter().append(\"g\").classed(\"line\", true);\n connectors.exit().remove();\n var len = connectors.size();\n connectors.each(function(di, i) {\n if (i !== len - 1 && !di.cNext) return;\n var xy = getXY(di, xa, ya, isHorizontal);\n var x = xy[0];\n var y = xy[1];\n var shape = \"\";\n if (x[0] !== BADNUM && y[0] !== BADNUM && x[1] !== BADNUM && y[1] !== BADNUM) {\n if (mode === \"spanning\") {\n if (!di.isSum && i > 0) {\n if (isHorizontal) {\n shape += \"M\" + x[0] + \",\" + y[1] + \"V\" + y[0];\n } else {\n shape += \"M\" + x[1] + \",\" + y[0] + \"H\" + x[0];\n }\n }\n }\n if (mode !== \"between\") {\n if (di.isSum || i < len - 1) {\n if (isHorizontal) {\n shape += \"M\" + x[1] + \",\" + y[0] + \"V\" + y[1];\n } else {\n shape += \"M\" + x[0] + \",\" + y[1] + \"H\" + x[1];\n }\n }\n }\n if (x[2] !== BADNUM && y[2] !== BADNUM) {\n if (isHorizontal) {\n shape += \"M\" + x[1] + \",\" + y[1] + \"V\" + y[2];\n } else {\n shape += \"M\" + x[1] + \",\" + y[1] + \"H\" + x[2];\n }\n }\n }\n if (shape === \"\") shape = \"M0,0Z\";\n Lib.ensureSingle(d3.select(this), \"path\").attr(\"d\", shape).call(Drawing.setClipUrl, plotinfo.layerClipId, gd);\n });\n });\n }\n function getXY(di, xa, ya, isHorizontal) {\n var s = [];\n var p = [];\n var sAxis = isHorizontal ? xa : ya;\n var pAxis = isHorizontal ? ya : xa;\n s[0] = sAxis.c2p(di.s0, true);\n p[0] = pAxis.c2p(di.p0, true);\n s[1] = sAxis.c2p(di.s1, true);\n p[1] = pAxis.c2p(di.p1, true);\n s[2] = sAxis.c2p(di.nextS0, true);\n p[2] = pAxis.c2p(di.nextP0, true);\n return isHorizontal ? [s, p] : [p, s];\n }\n }\n });\n\n // src/traces/waterfall/style.js\n var require_style10 = __commonJS({\n \"src/traces/waterfall/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Drawing = require_drawing();\n var Color2 = require_color();\n var DESELECTDIM = require_interactions().DESELECTDIM;\n var barStyle = require_style4();\n var resizeText = require_uniform_text().resizeText;\n var styleTextPoints = barStyle.styleTextPoints;\n function style(gd, cd, sel) {\n var s = sel ? sel : d3.select(gd).selectAll('g[class^=\"waterfalllayer\"]').selectAll(\"g.trace\");\n resizeText(gd, s, \"waterfall\");\n s.style(\"opacity\", function(d) {\n return d[0].trace.opacity;\n });\n s.each(function(d) {\n var gTrace = d3.select(this);\n var trace = d[0].trace;\n gTrace.selectAll(\".point > path\").each(function(di) {\n if (!di.isBlank) {\n var cont = trace[di.dir].marker;\n d3.select(this).call(Color2.fill, cont.color).call(Color2.stroke, cont.line.color).call(Drawing.dashLine, cont.line.dash, cont.line.width).style(\"opacity\", trace.selectedpoints && !di.selected ? DESELECTDIM : 1);\n }\n });\n styleTextPoints(gTrace, trace, gd);\n gTrace.selectAll(\".lines\").each(function() {\n var cont = trace.connector.line;\n Drawing.lineGroupStyle(\n d3.select(this).selectAll(\"path\"),\n cont.width,\n cont.color,\n cont.dash\n );\n });\n });\n }\n module.exports = {\n style\n };\n }\n });\n\n // src/traces/waterfall/hover.js\n var require_hover12 = __commonJS({\n \"src/traces/waterfall/hover.js\"(exports, module) {\n \"use strict\";\n var hoverLabelText = require_axes().hoverLabelText;\n var opacity = require_color().opacity;\n var hoverOnBars = require_hover3().hoverOnBars;\n var delta = require_delta();\n var DIRSYMBOL = {\n increasing: delta.INCREASING.SYMBOL,\n decreasing: delta.DECREASING.SYMBOL\n };\n module.exports = function hoverPoints(pointData, xval, yval, hovermode, opts) {\n var point = hoverOnBars(pointData, xval, yval, hovermode, opts);\n if (!point) return;\n var cd = point.cd;\n var trace = cd[0].trace;\n var isHorizontal = trace.orientation === \"h\";\n var vLetter = isHorizontal ? \"x\" : \"y\";\n var vAxis = isHorizontal ? pointData.xa : pointData.ya;\n function formatNumber(a) {\n return hoverLabelText(vAxis, a, trace[vLetter + \"hoverformat\"]);\n }\n var index = point.index;\n var di = cd[index];\n var size = di.isSum ? di.b + di.s : di.rawS;\n point.initial = di.b + di.s - size;\n point.delta = size;\n point.final = point.initial + point.delta;\n var v = formatNumber(Math.abs(point.delta));\n point.deltaLabel = size < 0 ? \"(\" + v + \")\" : v;\n point.finalLabel = formatNumber(point.final);\n point.initialLabel = formatNumber(point.initial);\n var hoverinfo = di.hi || trace.hoverinfo;\n var text = [];\n if (hoverinfo && hoverinfo !== \"none\" && hoverinfo !== \"skip\") {\n var isAll = hoverinfo === \"all\";\n var parts = hoverinfo.split(\"+\");\n var hasFlag = function(flag) {\n return isAll || parts.indexOf(flag) !== -1;\n };\n if (!di.isSum) {\n if (hasFlag(\"final\") && (isHorizontal ? !hasFlag(\"x\") : !hasFlag(\"y\"))) {\n text.push(point.finalLabel);\n }\n if (hasFlag(\"delta\")) {\n if (size < 0) {\n text.push(point.deltaLabel + \" \" + DIRSYMBOL.decreasing);\n } else {\n text.push(point.deltaLabel + \" \" + DIRSYMBOL.increasing);\n }\n }\n if (hasFlag(\"initial\")) {\n text.push(\"Initial: \" + point.initialLabel);\n }\n }\n }\n if (text.length) point.extraText = text.join(\"
    \");\n point.color = getTraceColor(trace, di);\n return [point];\n };\n function getTraceColor(trace, di) {\n var cont = trace[di.dir].marker;\n var mc = cont.color;\n var mlc = cont.line.color;\n var mlw = cont.line.width;\n if (opacity(mc)) return mc;\n else if (opacity(mlc) && mlw) return mlc;\n }\n }\n });\n\n // src/traces/waterfall/event_data.js\n var require_event_data6 = __commonJS({\n \"src/traces/waterfall/event_data.js\"(exports, module) {\n \"use strict\";\n module.exports = function eventData(out, pt) {\n out.x = \"xVal\" in pt ? pt.xVal : pt.x;\n out.y = \"yVal\" in pt ? pt.yVal : pt.y;\n if (\"initial\" in pt) out.initial = pt.initial;\n if (\"delta\" in pt) out.delta = pt.delta;\n if (\"final\" in pt) out.final = pt.final;\n if (pt.xa) out.xaxis = pt.xa;\n if (pt.ya) out.yaxis = pt.ya;\n return out;\n };\n }\n });\n\n // src/traces/waterfall/index.js\n var require_waterfall = __commonJS({\n \"src/traces/waterfall/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes33(),\n layoutAttributes: require_layout_attributes11(),\n supplyDefaults: require_defaults29().supplyDefaults,\n crossTraceDefaults: require_defaults29().crossTraceDefaults,\n supplyLayoutDefaults: require_layout_defaults10(),\n calc: require_calc14(),\n crossTraceCalc: require_cross_trace_calc6(),\n plot: require_plot10(),\n style: require_style10().style,\n hoverPoints: require_hover12(),\n eventData: require_event_data6(),\n selectPoints: require_select3(),\n moduleType: \"trace\",\n name: \"waterfall\",\n basePlotModule: require_cartesian(),\n categories: [\"bar-like\", \"cartesian\", \"svg\", \"oriented\", \"showLegend\", \"zoomScale\"],\n meta: {}\n };\n }\n });\n\n // lib/waterfall.js\n var require_waterfall2 = __commonJS({\n \"lib/waterfall.js\"(exports, module) {\n \"use strict\";\n module.exports = require_waterfall();\n }\n });\n\n // src/traces/image/constants.js\n var require_constants19 = __commonJS({\n \"src/traces/image/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n colormodel: {\n // min and max define the numerical range accepted in CSS\n // If z(min|max)Dflt are not defined, z(min|max) will default to min/max\n rgb: {\n min: [0, 0, 0],\n max: [255, 255, 255],\n fmt: function(c) {\n return c.slice(0, 3);\n },\n suffix: [\"\", \"\", \"\"]\n },\n rgba: {\n min: [0, 0, 0, 0],\n max: [255, 255, 255, 1],\n fmt: function(c) {\n return c.slice(0, 4);\n },\n suffix: [\"\", \"\", \"\", \"\"]\n },\n rgba256: {\n colormodel: \"rgba\",\n // because rgba256 is not an accept colormodel in CSS\n zminDflt: [0, 0, 0, 0],\n zmaxDflt: [255, 255, 255, 255],\n min: [0, 0, 0, 0],\n max: [255, 255, 255, 1],\n fmt: function(c) {\n return c.slice(0, 4);\n },\n suffix: [\"\", \"\", \"\", \"\"]\n },\n hsl: {\n min: [0, 0, 0],\n max: [360, 100, 100],\n fmt: function(c) {\n var p = c.slice(0, 3);\n p[1] = p[1] + \"%\";\n p[2] = p[2] + \"%\";\n return p;\n },\n suffix: [\"\\xB0\", \"%\", \"%\"]\n },\n hsla: {\n min: [0, 0, 0, 0],\n max: [360, 100, 100, 1],\n fmt: function(c) {\n var p = c.slice(0, 4);\n p[1] = p[1] + \"%\";\n p[2] = p[2] + \"%\";\n return p;\n },\n suffix: [\"\\xB0\", \"%\", \"%\", \"\"]\n }\n }\n };\n }\n });\n\n // src/traces/image/attributes.js\n var require_attributes34 = __commonJS({\n \"src/traces/image/attributes.js\"(exports, module) {\n \"use strict\";\n var baseAttrs = require_attributes2();\n var zorder = require_attributes12().zorder;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var extendFlat = require_extend().extendFlat;\n var colormodel = require_constants19().colormodel;\n var cm = [\"rgb\", \"rgba\", \"rgba256\", \"hsl\", \"hsla\"];\n var zminDesc = [];\n var zmaxDesc = [];\n for (i = 0; i < cm.length; i++) {\n cr = colormodel[cm[i]];\n zminDesc.push(\"For the `\" + cm[i] + \"` colormodel, it is [\" + (cr.zminDflt || cr.min).join(\", \") + \"].\");\n zmaxDesc.push(\"For the `\" + cm[i] + \"` colormodel, it is [\" + (cr.zmaxDflt || cr.max).join(\", \") + \"].\");\n }\n var cr;\n var i;\n module.exports = extendFlat({\n source: {\n valType: \"string\",\n editType: \"calc\"\n },\n z: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n colormodel: {\n valType: \"enumerated\",\n values: cm,\n editType: \"calc\"\n },\n zsmooth: {\n valType: \"enumerated\",\n values: [\"fast\", false],\n dflt: false,\n editType: \"plot\"\n },\n zmin: {\n valType: \"info_array\",\n items: [\n { valType: \"number\", editType: \"calc\" },\n { valType: \"number\", editType: \"calc\" },\n { valType: \"number\", editType: \"calc\" },\n { valType: \"number\", editType: \"calc\" }\n ],\n editType: \"calc\"\n },\n zmax: {\n valType: \"info_array\",\n items: [\n { valType: \"number\", editType: \"calc\" },\n { valType: \"number\", editType: \"calc\" },\n { valType: \"number\", editType: \"calc\" },\n { valType: \"number\", editType: \"calc\" }\n ],\n editType: \"calc\"\n },\n x0: {\n valType: \"any\",\n dflt: 0,\n editType: \"calc+clearAxisTypes\"\n },\n y0: {\n valType: \"any\",\n dflt: 0,\n editType: \"calc+clearAxisTypes\"\n },\n dx: {\n valType: \"number\",\n dflt: 1,\n editType: \"calc\"\n },\n dy: {\n valType: \"number\",\n dflt: 1,\n editType: \"calc\"\n },\n text: {\n valType: \"data_array\",\n editType: \"plot\"\n },\n hovertext: {\n valType: \"data_array\",\n editType: \"plot\"\n },\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: [\"x\", \"y\", \"z\", \"color\", \"name\", \"text\"],\n dflt: \"x+y+z+text+name\"\n }),\n hovertemplate: hovertemplateAttrs({}, {\n keys: [\"z\", \"color\", \"colormodel\"]\n }),\n zorder\n });\n }\n });\n\n // src/traces/image/defaults.js\n var require_defaults30 = __commonJS({\n \"src/traces/image/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var attributes = require_attributes34();\n var constants = require_constants19();\n var dataUri = require_helpers10().IMAGE_URL_PREFIX;\n module.exports = function supplyDefaults(traceIn, traceOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n coerce(\"source\");\n if (traceOut.source && !traceOut.source.match(dataUri)) delete traceOut.source;\n traceOut._hasSource = !!traceOut.source;\n var z = coerce(\"z\");\n traceOut._hasZ = !(z === void 0 || !z.length || !z[0] || !z[0].length);\n if (!traceOut._hasZ && !traceOut._hasSource) {\n traceOut.visible = false;\n return;\n }\n coerce(\"x0\");\n coerce(\"y0\");\n coerce(\"dx\");\n coerce(\"dy\");\n var cm;\n if (traceOut._hasZ) {\n coerce(\"colormodel\", \"rgb\");\n cm = constants.colormodel[traceOut.colormodel];\n coerce(\"zmin\", cm.zminDflt || cm.min);\n coerce(\"zmax\", cm.zmaxDflt || cm.max);\n } else if (traceOut._hasSource) {\n traceOut.colormodel = \"rgba256\";\n cm = constants.colormodel[traceOut.colormodel];\n traceOut.zmin = cm.zminDflt;\n traceOut.zmax = cm.zmaxDflt;\n }\n coerce(\"zsmooth\");\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n traceOut._length = null;\n coerce(\"zorder\");\n };\n }\n });\n\n // node_modules/inherits/inherits_browser.js\n var require_inherits_browser = __commonJS({\n \"node_modules/inherits/inherits_browser.js\"(exports, module) {\n if (typeof Object.create === \"function\") {\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n }\n };\n } else {\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function() {\n };\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n };\n }\n }\n });\n\n // node_modules/stream-browserify/node_modules/readable-stream/lib/internal/streams/stream-browser.js\n var require_stream_browser = __commonJS({\n \"node_modules/stream-browserify/node_modules/readable-stream/lib/internal/streams/stream-browser.js\"(exports, module) {\n module.exports = require_events().EventEmitter;\n }\n });\n\n // node_modules/base64-js/index.js\n var require_base64_js = __commonJS({\n \"node_modules/base64-js/index.js\"(exports) {\n \"use strict\";\n exports.byteLength = byteLength;\n exports.toByteArray = toByteArray;\n exports.fromByteArray = fromByteArray;\n var lookup = [];\n var revLookup = [];\n var Arr = typeof Uint8Array !== \"undefined\" ? Uint8Array : Array;\n var code = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n for (i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i];\n revLookup[code.charCodeAt(i)] = i;\n }\n var i;\n var len;\n revLookup[\"-\".charCodeAt(0)] = 62;\n revLookup[\"_\".charCodeAt(0)] = 63;\n function getLens(b64) {\n var len2 = b64.length;\n if (len2 % 4 > 0) {\n throw new Error(\"Invalid string. Length must be a multiple of 4\");\n }\n var validLen = b64.indexOf(\"=\");\n if (validLen === -1) validLen = len2;\n var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;\n return [validLen, placeHoldersLen];\n }\n function byteLength(b64) {\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n }\n function _byteLength(b64, validLen, placeHoldersLen) {\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n }\n function toByteArray(b64) {\n var tmp;\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));\n var curByte = 0;\n var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;\n var i2;\n for (i2 = 0; i2 < len2; i2 += 4) {\n tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)];\n arr[curByte++] = tmp >> 16 & 255;\n arr[curByte++] = tmp >> 8 & 255;\n arr[curByte++] = tmp & 255;\n }\n if (placeHoldersLen === 2) {\n tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4;\n arr[curByte++] = tmp & 255;\n }\n if (placeHoldersLen === 1) {\n tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2;\n arr[curByte++] = tmp >> 8 & 255;\n arr[curByte++] = tmp & 255;\n }\n return arr;\n }\n function tripletToBase64(num) {\n return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];\n }\n function encodeChunk(uint8, start, end) {\n var tmp;\n var output = [];\n for (var i2 = start; i2 < end; i2 += 3) {\n tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);\n output.push(tripletToBase64(tmp));\n }\n return output.join(\"\");\n }\n function fromByteArray(uint8) {\n var tmp;\n var len2 = uint8.length;\n var extraBytes = len2 % 3;\n var parts = [];\n var maxChunkLength = 16383;\n for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) {\n parts.push(encodeChunk(\n uint8,\n i2,\n i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength\n ));\n }\n if (extraBytes === 1) {\n tmp = uint8[len2 - 1];\n parts.push(\n lookup[tmp >> 2] + lookup[tmp << 4 & 63] + \"==\"\n );\n } else if (extraBytes === 2) {\n tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];\n parts.push(\n lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + \"=\"\n );\n }\n return parts.join(\"\");\n }\n }\n });\n\n // node_modules/ieee754/index.js\n var require_ieee754 = __commonJS({\n \"node_modules/ieee754/index.js\"(exports) {\n exports.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 i += d;\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 exports.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 value = Math.abs(value);\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 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 for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {\n }\n e = e << mLen | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {\n }\n buffer[offset + i - d] |= s * 128;\n };\n }\n });\n\n // node_modules/buffer/index.js\n var require_buffer = __commonJS({\n \"node_modules/buffer/index.js\"(exports) {\n \"use strict\";\n var base64 = require_base64_js();\n var ieee754 = require_ieee754();\n var customInspectSymbol = typeof Symbol === \"function\" && typeof Symbol[\"for\"] === \"function\" ? Symbol[\"for\"](\"nodejs.util.inspect.custom\") : null;\n exports.Buffer = Buffer2;\n exports.SlowBuffer = SlowBuffer;\n exports.INSPECT_MAX_BYTES = 50;\n var K_MAX_LENGTH = 2147483647;\n exports.kMaxLength = K_MAX_LENGTH;\n Buffer2.TYPED_ARRAY_SUPPORT = typedArraySupport();\n if (!Buffer2.TYPED_ARRAY_SUPPORT && typeof console !== \"undefined\" && typeof console.error === \"function\") {\n console.error(\n \"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.\"\n );\n }\n function typedArraySupport() {\n try {\n const arr = new Uint8Array(1);\n const proto = { foo: function() {\n return 42;\n } };\n Object.setPrototypeOf(proto, Uint8Array.prototype);\n Object.setPrototypeOf(arr, proto);\n return arr.foo() === 42;\n } catch (e) {\n return false;\n }\n }\n Object.defineProperty(Buffer2.prototype, \"parent\", {\n enumerable: true,\n get: function() {\n if (!Buffer2.isBuffer(this)) return void 0;\n return this.buffer;\n }\n });\n Object.defineProperty(Buffer2.prototype, \"offset\", {\n enumerable: true,\n get: function() {\n if (!Buffer2.isBuffer(this)) return void 0;\n return this.byteOffset;\n }\n });\n function createBuffer(length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"');\n }\n const buf = new Uint8Array(length);\n Object.setPrototypeOf(buf, Buffer2.prototype);\n return buf;\n }\n function Buffer2(arg, encodingOrOffset, length) {\n if (typeof arg === \"number\") {\n if (typeof encodingOrOffset === \"string\") {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n );\n }\n return allocUnsafe(arg);\n }\n return from(arg, encodingOrOffset, length);\n }\n Buffer2.poolSize = 8192;\n function from(value, encodingOrOffset, length) {\n if (typeof value === \"string\") {\n return fromString(value, encodingOrOffset);\n }\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value);\n }\n if (value == null) {\n throw new TypeError(\n \"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \" + typeof value\n );\n }\n if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {\n return fromArrayBuffer(value, encodingOrOffset, length);\n }\n if (typeof SharedArrayBuffer !== \"undefined\" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length);\n }\n if (typeof value === \"number\") {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n );\n }\n const valueOf = value.valueOf && value.valueOf();\n if (valueOf != null && valueOf !== value) {\n return Buffer2.from(valueOf, encodingOrOffset, length);\n }\n const b = fromObject(value);\n if (b) return b;\n if (typeof Symbol !== \"undefined\" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === \"function\") {\n return Buffer2.from(value[Symbol.toPrimitive](\"string\"), encodingOrOffset, length);\n }\n throw new TypeError(\n \"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \" + typeof value\n );\n }\n Buffer2.from = function(value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length);\n };\n Object.setPrototypeOf(Buffer2.prototype, Uint8Array.prototype);\n Object.setPrototypeOf(Buffer2, Uint8Array);\n function assertSize(size) {\n if (typeof size !== \"number\") {\n throw new TypeError('\"size\" argument must be of type number');\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"');\n }\n }\n function alloc(size, fill, encoding) {\n assertSize(size);\n if (size <= 0) {\n return createBuffer(size);\n }\n if (fill !== void 0) {\n return typeof encoding === \"string\" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);\n }\n return createBuffer(size);\n }\n Buffer2.alloc = function(size, fill, encoding) {\n return alloc(size, fill, encoding);\n };\n function allocUnsafe(size) {\n assertSize(size);\n return createBuffer(size < 0 ? 0 : checked(size) | 0);\n }\n Buffer2.allocUnsafe = function(size) {\n return allocUnsafe(size);\n };\n Buffer2.allocUnsafeSlow = function(size) {\n return allocUnsafe(size);\n };\n function fromString(string, encoding) {\n if (typeof encoding !== \"string\" || encoding === \"\") {\n encoding = \"utf8\";\n }\n if (!Buffer2.isEncoding(encoding)) {\n throw new TypeError(\"Unknown encoding: \" + encoding);\n }\n const length = byteLength(string, encoding) | 0;\n let buf = createBuffer(length);\n const actual = buf.write(string, encoding);\n if (actual !== length) {\n buf = buf.slice(0, actual);\n }\n return buf;\n }\n function fromArrayLike(array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0;\n const buf = createBuffer(length);\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255;\n }\n return buf;\n }\n function fromArrayView(arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView);\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);\n }\n return fromArrayLike(arrayView);\n }\n function fromArrayBuffer(array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds');\n }\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds');\n }\n let buf;\n if (byteOffset === void 0 && length === void 0) {\n buf = new Uint8Array(array);\n } else if (length === void 0) {\n buf = new Uint8Array(array, byteOffset);\n } else {\n buf = new Uint8Array(array, byteOffset, length);\n }\n Object.setPrototypeOf(buf, Buffer2.prototype);\n return buf;\n }\n function fromObject(obj) {\n if (Buffer2.isBuffer(obj)) {\n const len = checked(obj.length) | 0;\n const buf = createBuffer(len);\n if (buf.length === 0) {\n return buf;\n }\n obj.copy(buf, 0, 0, len);\n return buf;\n }\n if (obj.length !== void 0) {\n if (typeof obj.length !== \"number\" || numberIsNaN(obj.length)) {\n return createBuffer(0);\n }\n return fromArrayLike(obj);\n }\n if (obj.type === \"Buffer\" && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data);\n }\n }\n function checked(length) {\n if (length >= K_MAX_LENGTH) {\n throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\" + K_MAX_LENGTH.toString(16) + \" bytes\");\n }\n return length | 0;\n }\n function SlowBuffer(length) {\n if (+length != length) {\n length = 0;\n }\n return Buffer2.alloc(+length);\n }\n Buffer2.isBuffer = function isBuffer(b) {\n return b != null && b._isBuffer === true && b !== Buffer2.prototype;\n };\n Buffer2.compare = function compare(a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer2.from(a, a.offset, a.byteLength);\n if (isInstance(b, Uint8Array)) b = Buffer2.from(b, b.offset, b.byteLength);\n if (!Buffer2.isBuffer(a) || !Buffer2.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n );\n }\n if (a === b) return 0;\n let x = a.length;\n let y = b.length;\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break;\n }\n }\n if (x < y) return -1;\n if (y < x) return 1;\n return 0;\n };\n Buffer2.isEncoding = function isEncoding(encoding) {\n switch (String(encoding).toLowerCase()) {\n case \"hex\":\n case \"utf8\":\n case \"utf-8\":\n case \"ascii\":\n case \"latin1\":\n case \"binary\":\n case \"base64\":\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n return true;\n default:\n return false;\n }\n };\n Buffer2.concat = function concat(list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers');\n }\n if (list.length === 0) {\n return Buffer2.alloc(0);\n }\n let i;\n if (length === void 0) {\n length = 0;\n for (i = 0; i < list.length; ++i) {\n length += list[i].length;\n }\n }\n const buffer = Buffer2.allocUnsafe(length);\n let pos = 0;\n for (i = 0; i < list.length; ++i) {\n let buf = list[i];\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer2.isBuffer(buf)) buf = Buffer2.from(buf);\n buf.copy(buffer, pos);\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n );\n }\n } else if (!Buffer2.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers');\n } else {\n buf.copy(buffer, pos);\n }\n pos += buf.length;\n }\n return buffer;\n };\n function byteLength(string, encoding) {\n if (Buffer2.isBuffer(string)) {\n return string.length;\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength;\n }\n if (typeof string !== \"string\") {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string\n );\n }\n const len = string.length;\n const mustMatch = arguments.length > 2 && arguments[2] === true;\n if (!mustMatch && len === 0) return 0;\n let loweredCase = false;\n for (; ; ) {\n switch (encoding) {\n case \"ascii\":\n case \"latin1\":\n case \"binary\":\n return len;\n case \"utf8\":\n case \"utf-8\":\n return utf8ToBytes(string).length;\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n return len * 2;\n case \"hex\":\n return len >>> 1;\n case \"base64\":\n return base64ToBytes(string).length;\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length;\n }\n encoding = (\"\" + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n }\n Buffer2.byteLength = byteLength;\n function slowToString(encoding, start, end) {\n let loweredCase = false;\n if (start === void 0 || start < 0) {\n start = 0;\n }\n if (start > this.length) {\n return \"\";\n }\n if (end === void 0 || end > this.length) {\n end = this.length;\n }\n if (end <= 0) {\n return \"\";\n }\n end >>>= 0;\n start >>>= 0;\n if (end <= start) {\n return \"\";\n }\n if (!encoding) encoding = \"utf8\";\n while (true) {\n switch (encoding) {\n case \"hex\":\n return hexSlice(this, start, end);\n case \"utf8\":\n case \"utf-8\":\n return utf8Slice(this, start, end);\n case \"ascii\":\n return asciiSlice(this, start, end);\n case \"latin1\":\n case \"binary\":\n return latin1Slice(this, start, end);\n case \"base64\":\n return base64Slice(this, start, end);\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n return utf16leSlice(this, start, end);\n default:\n if (loweredCase) throw new TypeError(\"Unknown encoding: \" + encoding);\n encoding = (encoding + \"\").toLowerCase();\n loweredCase = true;\n }\n }\n }\n Buffer2.prototype._isBuffer = true;\n function swap(b, n, m) {\n const i = b[n];\n b[n] = b[m];\n b[m] = i;\n }\n Buffer2.prototype.swap16 = function swap16() {\n const len = this.length;\n if (len % 2 !== 0) {\n throw new RangeError(\"Buffer size must be a multiple of 16-bits\");\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1);\n }\n return this;\n };\n Buffer2.prototype.swap32 = function swap32() {\n const len = this.length;\n if (len % 4 !== 0) {\n throw new RangeError(\"Buffer size must be a multiple of 32-bits\");\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3);\n swap(this, i + 1, i + 2);\n }\n return this;\n };\n Buffer2.prototype.swap64 = function swap64() {\n const len = this.length;\n if (len % 8 !== 0) {\n throw new RangeError(\"Buffer size must be a multiple of 64-bits\");\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7);\n swap(this, i + 1, i + 6);\n swap(this, i + 2, i + 5);\n swap(this, i + 3, i + 4);\n }\n return this;\n };\n Buffer2.prototype.toString = function toString() {\n const length = this.length;\n if (length === 0) return \"\";\n if (arguments.length === 0) return utf8Slice(this, 0, length);\n return slowToString.apply(this, arguments);\n };\n Buffer2.prototype.toLocaleString = Buffer2.prototype.toString;\n Buffer2.prototype.equals = function equals(b) {\n if (!Buffer2.isBuffer(b)) throw new TypeError(\"Argument must be a Buffer\");\n if (this === b) return true;\n return Buffer2.compare(this, b) === 0;\n };\n Buffer2.prototype.inspect = function inspect() {\n let str = \"\";\n const max = exports.INSPECT_MAX_BYTES;\n str = this.toString(\"hex\", 0, max).replace(/(.{2})/g, \"$1 \").trim();\n if (this.length > max) str += \" ... \";\n return \"\";\n };\n if (customInspectSymbol) {\n Buffer2.prototype[customInspectSymbol] = Buffer2.prototype.inspect;\n }\n Buffer2.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer2.from(target, target.offset, target.byteLength);\n }\n if (!Buffer2.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target\n );\n }\n if (start === void 0) {\n start = 0;\n }\n if (end === void 0) {\n end = target ? target.length : 0;\n }\n if (thisStart === void 0) {\n thisStart = 0;\n }\n if (thisEnd === void 0) {\n thisEnd = this.length;\n }\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError(\"out of range index\");\n }\n if (thisStart >= thisEnd && start >= end) {\n return 0;\n }\n if (thisStart >= thisEnd) {\n return -1;\n }\n if (start >= end) {\n return 1;\n }\n start >>>= 0;\n end >>>= 0;\n thisStart >>>= 0;\n thisEnd >>>= 0;\n if (this === target) return 0;\n let x = thisEnd - thisStart;\n let y = end - start;\n const len = Math.min(x, y);\n const thisCopy = this.slice(thisStart, thisEnd);\n const targetCopy = target.slice(start, end);\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i];\n y = targetCopy[i];\n break;\n }\n }\n if (x < y) return -1;\n if (y < x) return 1;\n return 0;\n };\n function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {\n if (buffer.length === 0) return -1;\n if (typeof byteOffset === \"string\") {\n encoding = byteOffset;\n byteOffset = 0;\n } else if (byteOffset > 2147483647) {\n byteOffset = 2147483647;\n } else if (byteOffset < -2147483648) {\n byteOffset = -2147483648;\n }\n byteOffset = +byteOffset;\n if (numberIsNaN(byteOffset)) {\n byteOffset = dir ? 0 : buffer.length - 1;\n }\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset;\n if (byteOffset >= buffer.length) {\n if (dir) return -1;\n else byteOffset = buffer.length - 1;\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0;\n else return -1;\n }\n if (typeof val === \"string\") {\n val = Buffer2.from(val, encoding);\n }\n if (Buffer2.isBuffer(val)) {\n if (val.length === 0) {\n return -1;\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir);\n } else if (typeof val === \"number\") {\n val = val & 255;\n if (typeof Uint8Array.prototype.indexOf === \"function\") {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);\n }\n throw new TypeError(\"val must be string, number or Buffer\");\n }\n function arrayIndexOf(arr, val, byteOffset, encoding, dir) {\n let indexSize = 1;\n let arrLength = arr.length;\n let valLength = val.length;\n if (encoding !== void 0) {\n encoding = String(encoding).toLowerCase();\n if (encoding === \"ucs2\" || encoding === \"ucs-2\" || encoding === \"utf16le\" || encoding === \"utf-16le\") {\n if (arr.length < 2 || val.length < 2) {\n return -1;\n }\n indexSize = 2;\n arrLength /= 2;\n valLength /= 2;\n byteOffset /= 2;\n }\n }\n function read(buf, i2) {\n if (indexSize === 1) {\n return buf[i2];\n } else {\n return buf.readUInt16BE(i2 * indexSize);\n }\n }\n let i;\n if (dir) {\n let foundIndex = -1;\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i;\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;\n } else {\n if (foundIndex !== -1) i -= i - foundIndex;\n foundIndex = -1;\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;\n for (i = byteOffset; i >= 0; i--) {\n let found = true;\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false;\n break;\n }\n }\n if (found) return i;\n }\n }\n return -1;\n }\n Buffer2.prototype.includes = function includes(val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1;\n };\n Buffer2.prototype.indexOf = function indexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true);\n };\n Buffer2.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false);\n };\n function hexWrite(buf, string, offset, length) {\n offset = Number(offset) || 0;\n const remaining = buf.length - offset;\n if (!length) {\n length = remaining;\n } else {\n length = Number(length);\n if (length > remaining) {\n length = remaining;\n }\n }\n const strLen = string.length;\n if (length > strLen / 2) {\n length = strLen / 2;\n }\n let i;\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16);\n if (numberIsNaN(parsed)) return i;\n buf[offset + i] = parsed;\n }\n return i;\n }\n function utf8Write(buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);\n }\n function asciiWrite(buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length);\n }\n function base64Write(buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length);\n }\n function ucs2Write(buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);\n }\n Buffer2.prototype.write = function write(string, offset, length, encoding) {\n if (offset === void 0) {\n encoding = \"utf8\";\n length = this.length;\n offset = 0;\n } else if (length === void 0 && typeof offset === \"string\") {\n encoding = offset;\n length = this.length;\n offset = 0;\n } else if (isFinite(offset)) {\n offset = offset >>> 0;\n if (isFinite(length)) {\n length = length >>> 0;\n if (encoding === void 0) encoding = \"utf8\";\n } else {\n encoding = length;\n length = void 0;\n }\n } else {\n throw new Error(\n \"Buffer.write(string, encoding, offset[, length]) is no longer supported\"\n );\n }\n const remaining = this.length - offset;\n if (length === void 0 || length > remaining) length = remaining;\n if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {\n throw new RangeError(\"Attempt to write outside buffer bounds\");\n }\n if (!encoding) encoding = \"utf8\";\n let loweredCase = false;\n for (; ; ) {\n switch (encoding) {\n case \"hex\":\n return hexWrite(this, string, offset, length);\n case \"utf8\":\n case \"utf-8\":\n return utf8Write(this, string, offset, length);\n case \"ascii\":\n case \"latin1\":\n case \"binary\":\n return asciiWrite(this, string, offset, length);\n case \"base64\":\n return base64Write(this, string, offset, length);\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n return ucs2Write(this, string, offset, length);\n default:\n if (loweredCase) throw new TypeError(\"Unknown encoding: \" + encoding);\n encoding = (\"\" + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n };\n Buffer2.prototype.toJSON = function toJSON() {\n return {\n type: \"Buffer\",\n data: Array.prototype.slice.call(this._arr || this, 0)\n };\n };\n function base64Slice(buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf);\n } else {\n return base64.fromByteArray(buf.slice(start, end));\n }\n }\n function utf8Slice(buf, start, end) {\n end = Math.min(buf.length, end);\n const res = [];\n let i = start;\n while (i < end) {\n const firstByte = buf[i];\n let codePoint = null;\n let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint;\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 128) {\n codePoint = firstByte;\n }\n break;\n case 2:\n secondByte = buf[i + 1];\n if ((secondByte & 192) === 128) {\n tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;\n if (tempCodePoint > 127) {\n codePoint = tempCodePoint;\n }\n }\n break;\n case 3:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {\n tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;\n if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {\n codePoint = tempCodePoint;\n }\n }\n break;\n case 4:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n fourthByte = buf[i + 3];\n if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {\n tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;\n if (tempCodePoint > 65535 && tempCodePoint < 1114112) {\n codePoint = tempCodePoint;\n }\n }\n }\n }\n if (codePoint === null) {\n codePoint = 65533;\n bytesPerSequence = 1;\n } else if (codePoint > 65535) {\n codePoint -= 65536;\n res.push(codePoint >>> 10 & 1023 | 55296);\n codePoint = 56320 | codePoint & 1023;\n }\n res.push(codePoint);\n i += bytesPerSequence;\n }\n return decodeCodePointsArray(res);\n }\n var MAX_ARGUMENTS_LENGTH = 4096;\n function decodeCodePointsArray(codePoints) {\n const len = codePoints.length;\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints);\n }\n let res = \"\";\n let i = 0;\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n );\n }\n return res;\n }\n function asciiSlice(buf, start, end) {\n let ret = \"\";\n end = Math.min(buf.length, end);\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 127);\n }\n return ret;\n }\n function latin1Slice(buf, start, end) {\n let ret = \"\";\n end = Math.min(buf.length, end);\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i]);\n }\n return ret;\n }\n function hexSlice(buf, start, end) {\n const len = buf.length;\n if (!start || start < 0) start = 0;\n if (!end || end < 0 || end > len) end = len;\n let out = \"\";\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]];\n }\n return out;\n }\n function utf16leSlice(buf, start, end) {\n const bytes = buf.slice(start, end);\n let res = \"\";\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);\n }\n return res;\n }\n Buffer2.prototype.slice = function slice(start, end) {\n const len = this.length;\n start = ~~start;\n end = end === void 0 ? len : ~~end;\n if (start < 0) {\n start += len;\n if (start < 0) start = 0;\n } else if (start > len) {\n start = len;\n }\n if (end < 0) {\n end += len;\n if (end < 0) end = 0;\n } else if (end > len) {\n end = len;\n }\n if (end < start) end = start;\n const newBuf = this.subarray(start, end);\n Object.setPrototypeOf(newBuf, Buffer2.prototype);\n return newBuf;\n };\n function checkOffset(offset, ext, length) {\n if (offset % 1 !== 0 || offset < 0) throw new RangeError(\"offset is not uint\");\n if (offset + ext > length) throw new RangeError(\"Trying to access beyond buffer length\");\n }\n Buffer2.prototype.readUintLE = Buffer2.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) checkOffset(offset, byteLength2, this.length);\n let val = this[offset];\n let mul = 1;\n let i = 0;\n while (++i < byteLength2 && (mul *= 256)) {\n val += this[offset + i] * mul;\n }\n return val;\n };\n Buffer2.prototype.readUintBE = Buffer2.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n checkOffset(offset, byteLength2, this.length);\n }\n let val = this[offset + --byteLength2];\n let mul = 1;\n while (byteLength2 > 0 && (mul *= 256)) {\n val += this[offset + --byteLength2] * mul;\n }\n return val;\n };\n Buffer2.prototype.readUint8 = Buffer2.prototype.readUInt8 = function readUInt8(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 1, this.length);\n return this[offset];\n };\n Buffer2.prototype.readUint16LE = Buffer2.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n return this[offset] | this[offset + 1] << 8;\n };\n Buffer2.prototype.readUint16BE = Buffer2.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n return this[offset] << 8 | this[offset + 1];\n };\n Buffer2.prototype.readUint32LE = Buffer2.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;\n };\n Buffer2.prototype.readUint32BE = Buffer2.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);\n };\n Buffer2.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, \"offset\");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24;\n const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;\n return BigInt(lo) + (BigInt(hi) << BigInt(32));\n });\n Buffer2.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, \"offset\");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];\n const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;\n return (BigInt(hi) << BigInt(32)) + BigInt(lo);\n });\n Buffer2.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) checkOffset(offset, byteLength2, this.length);\n let val = this[offset];\n let mul = 1;\n let i = 0;\n while (++i < byteLength2 && (mul *= 256)) {\n val += this[offset + i] * mul;\n }\n mul *= 128;\n if (val >= mul) val -= Math.pow(2, 8 * byteLength2);\n return val;\n };\n Buffer2.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) checkOffset(offset, byteLength2, this.length);\n let i = byteLength2;\n let mul = 1;\n let val = this[offset + --i];\n while (i > 0 && (mul *= 256)) {\n val += this[offset + --i] * mul;\n }\n mul *= 128;\n if (val >= mul) val -= Math.pow(2, 8 * byteLength2);\n return val;\n };\n Buffer2.prototype.readInt8 = function readInt8(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 1, this.length);\n if (!(this[offset] & 128)) return this[offset];\n return (255 - this[offset] + 1) * -1;\n };\n Buffer2.prototype.readInt16LE = function readInt16LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n const val = this[offset] | this[offset + 1] << 8;\n return val & 32768 ? val | 4294901760 : val;\n };\n Buffer2.prototype.readInt16BE = function readInt16BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n const val = this[offset + 1] | this[offset] << 8;\n return val & 32768 ? val | 4294901760 : val;\n };\n Buffer2.prototype.readInt32LE = function readInt32LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;\n };\n Buffer2.prototype.readInt32BE = function readInt32BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];\n };\n Buffer2.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, \"offset\");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24);\n return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);\n });\n Buffer2.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, \"offset\");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];\n return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);\n });\n Buffer2.prototype.readFloatLE = function readFloatLE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754.read(this, offset, true, 23, 4);\n };\n Buffer2.prototype.readFloatBE = function readFloatBE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754.read(this, offset, false, 23, 4);\n };\n Buffer2.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754.read(this, offset, true, 52, 8);\n };\n Buffer2.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754.read(this, offset, false, 52, 8);\n };\n function checkInt(buf, value, offset, ext, max, min) {\n if (!Buffer2.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance');\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds');\n if (offset + ext > buf.length) throw new RangeError(\"Index out of range\");\n }\n Buffer2.prototype.writeUintLE = Buffer2.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength2) - 1;\n checkInt(this, value, offset, byteLength2, maxBytes, 0);\n }\n let mul = 1;\n let i = 0;\n this[offset] = value & 255;\n while (++i < byteLength2 && (mul *= 256)) {\n this[offset + i] = value / mul & 255;\n }\n return offset + byteLength2;\n };\n Buffer2.prototype.writeUintBE = Buffer2.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength2) - 1;\n checkInt(this, value, offset, byteLength2, maxBytes, 0);\n }\n let i = byteLength2 - 1;\n let mul = 1;\n this[offset + i] = value & 255;\n while (--i >= 0 && (mul *= 256)) {\n this[offset + i] = value / mul & 255;\n }\n return offset + byteLength2;\n };\n Buffer2.prototype.writeUint8 = Buffer2.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 1, 255, 0);\n this[offset] = value & 255;\n return offset + 1;\n };\n Buffer2.prototype.writeUint16LE = Buffer2.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n return offset + 2;\n };\n Buffer2.prototype.writeUint16BE = Buffer2.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);\n this[offset] = value >>> 8;\n this[offset + 1] = value & 255;\n return offset + 2;\n };\n Buffer2.prototype.writeUint32LE = Buffer2.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);\n this[offset + 3] = value >>> 24;\n this[offset + 2] = value >>> 16;\n this[offset + 1] = value >>> 8;\n this[offset] = value & 255;\n return offset + 4;\n };\n Buffer2.prototype.writeUint32BE = Buffer2.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);\n this[offset] = value >>> 24;\n this[offset + 1] = value >>> 16;\n this[offset + 2] = value >>> 8;\n this[offset + 3] = value & 255;\n return offset + 4;\n };\n function wrtBigUInt64LE(buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7);\n let lo = Number(value & BigInt(4294967295));\n buf[offset++] = lo;\n lo = lo >> 8;\n buf[offset++] = lo;\n lo = lo >> 8;\n buf[offset++] = lo;\n lo = lo >> 8;\n buf[offset++] = lo;\n let hi = Number(value >> BigInt(32) & BigInt(4294967295));\n buf[offset++] = hi;\n hi = hi >> 8;\n buf[offset++] = hi;\n hi = hi >> 8;\n buf[offset++] = hi;\n hi = hi >> 8;\n buf[offset++] = hi;\n return offset;\n }\n function wrtBigUInt64BE(buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7);\n let lo = Number(value & BigInt(4294967295));\n buf[offset + 7] = lo;\n lo = lo >> 8;\n buf[offset + 6] = lo;\n lo = lo >> 8;\n buf[offset + 5] = lo;\n lo = lo >> 8;\n buf[offset + 4] = lo;\n let hi = Number(value >> BigInt(32) & BigInt(4294967295));\n buf[offset + 3] = hi;\n hi = hi >> 8;\n buf[offset + 2] = hi;\n hi = hi >> 8;\n buf[offset + 1] = hi;\n hi = hi >> 8;\n buf[offset] = hi;\n return offset + 8;\n }\n Buffer2.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt(\"0xffffffffffffffff\"));\n });\n Buffer2.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt(\"0xffffffffffffffff\"));\n });\n Buffer2.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n const limit = Math.pow(2, 8 * byteLength2 - 1);\n checkInt(this, value, offset, byteLength2, limit - 1, -limit);\n }\n let i = 0;\n let mul = 1;\n let sub = 0;\n this[offset] = value & 255;\n while (++i < byteLength2 && (mul *= 256)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = (value / mul >> 0) - sub & 255;\n }\n return offset + byteLength2;\n };\n Buffer2.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n const limit = Math.pow(2, 8 * byteLength2 - 1);\n checkInt(this, value, offset, byteLength2, limit - 1, -limit);\n }\n let i = byteLength2 - 1;\n let mul = 1;\n let sub = 0;\n this[offset + i] = value & 255;\n while (--i >= 0 && (mul *= 256)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = (value / mul >> 0) - sub & 255;\n }\n return offset + byteLength2;\n };\n Buffer2.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 1, 127, -128);\n if (value < 0) value = 255 + value + 1;\n this[offset] = value & 255;\n return offset + 1;\n };\n Buffer2.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n return offset + 2;\n };\n Buffer2.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);\n this[offset] = value >>> 8;\n this[offset + 1] = value & 255;\n return offset + 2;\n };\n Buffer2.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n this[offset + 2] = value >>> 16;\n this[offset + 3] = value >>> 24;\n return offset + 4;\n };\n Buffer2.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);\n if (value < 0) value = 4294967295 + value + 1;\n this[offset] = value >>> 24;\n this[offset + 1] = value >>> 16;\n this[offset + 2] = value >>> 8;\n this[offset + 3] = value & 255;\n return offset + 4;\n };\n Buffer2.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt(\"0x8000000000000000\"), BigInt(\"0x7fffffffffffffff\"));\n });\n Buffer2.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt(\"0x8000000000000000\"), BigInt(\"0x7fffffffffffffff\"));\n });\n function checkIEEE754(buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError(\"Index out of range\");\n if (offset < 0) throw new RangeError(\"Index out of range\");\n }\n function writeFloat(buf, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 34028234663852886e22, -34028234663852886e22);\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4);\n return offset + 4;\n }\n Buffer2.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert);\n };\n Buffer2.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert);\n };\n function writeDouble(buf, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 17976931348623157e292, -17976931348623157e292);\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8);\n return offset + 8;\n }\n Buffer2.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert);\n };\n Buffer2.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert);\n };\n Buffer2.prototype.copy = function copy(target, targetStart, start, end) {\n if (!Buffer2.isBuffer(target)) throw new TypeError(\"argument should be a Buffer\");\n if (!start) start = 0;\n if (!end && end !== 0) end = this.length;\n if (targetStart >= target.length) targetStart = target.length;\n if (!targetStart) targetStart = 0;\n if (end > 0 && end < start) end = start;\n if (end === start) return 0;\n if (target.length === 0 || this.length === 0) return 0;\n if (targetStart < 0) {\n throw new RangeError(\"targetStart out of bounds\");\n }\n if (start < 0 || start >= this.length) throw new RangeError(\"Index out of range\");\n if (end < 0) throw new RangeError(\"sourceEnd out of bounds\");\n if (end > this.length) end = this.length;\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start;\n }\n const len = end - start;\n if (this === target && typeof Uint8Array.prototype.copyWithin === \"function\") {\n this.copyWithin(targetStart, start, end);\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n );\n }\n return len;\n };\n Buffer2.prototype.fill = function fill(val, start, end, encoding) {\n if (typeof val === \"string\") {\n if (typeof start === \"string\") {\n encoding = start;\n start = 0;\n end = this.length;\n } else if (typeof end === \"string\") {\n encoding = end;\n end = this.length;\n }\n if (encoding !== void 0 && typeof encoding !== \"string\") {\n throw new TypeError(\"encoding must be a string\");\n }\n if (typeof encoding === \"string\" && !Buffer2.isEncoding(encoding)) {\n throw new TypeError(\"Unknown encoding: \" + encoding);\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0);\n if (encoding === \"utf8\" && code < 128 || encoding === \"latin1\") {\n val = code;\n }\n }\n } else if (typeof val === \"number\") {\n val = val & 255;\n } else if (typeof val === \"boolean\") {\n val = Number(val);\n }\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError(\"Out of range index\");\n }\n if (end <= start) {\n return this;\n }\n start = start >>> 0;\n end = end === void 0 ? this.length : end >>> 0;\n if (!val) val = 0;\n let i;\n if (typeof val === \"number\") {\n for (i = start; i < end; ++i) {\n this[i] = val;\n }\n } else {\n const bytes = Buffer2.isBuffer(val) ? val : Buffer2.from(val, encoding);\n const len = bytes.length;\n if (len === 0) {\n throw new TypeError('The value \"' + val + '\" is invalid for argument \"value\"');\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len];\n }\n }\n return this;\n };\n var errors = {};\n function E2(sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor() {\n super();\n Object.defineProperty(this, \"message\", {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n });\n this.name = `${this.name} [${sym}]`;\n this.stack;\n delete this.name;\n }\n get code() {\n return sym;\n }\n set code(value) {\n Object.defineProperty(this, \"code\", {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n });\n }\n toString() {\n return `${this.name} [${sym}]: ${this.message}`;\n }\n };\n }\n E2(\n \"ERR_BUFFER_OUT_OF_BOUNDS\",\n function(name2) {\n if (name2) {\n return `${name2} is outside of buffer bounds`;\n }\n return \"Attempt to access memory outside buffer bounds\";\n },\n RangeError\n );\n E2(\n \"ERR_INVALID_ARG_TYPE\",\n function(name2, actual) {\n return `The \"${name2}\" argument must be of type number. Received type ${typeof actual}`;\n },\n TypeError\n );\n E2(\n \"ERR_OUT_OF_RANGE\",\n function(str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`;\n let received = input;\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input));\n } else if (typeof input === \"bigint\") {\n received = String(input);\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received);\n }\n received += \"n\";\n }\n msg += ` It must be ${range}. Received ${received}`;\n return msg;\n },\n RangeError\n );\n function addNumericalSeparator(val) {\n let res = \"\";\n let i = val.length;\n const start = val[0] === \"-\" ? 1 : 0;\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`;\n }\n return `${val.slice(0, i)}${res}`;\n }\n function checkBounds(buf, offset, byteLength2) {\n validateNumber(offset, \"offset\");\n if (buf[offset] === void 0 || buf[offset + byteLength2] === void 0) {\n boundsError(offset, buf.length - (byteLength2 + 1));\n }\n }\n function checkIntBI(value, min, max, buf, offset, byteLength2) {\n if (value > max || value < min) {\n const n = typeof min === \"bigint\" ? \"n\" : \"\";\n let range;\n if (byteLength2 > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength2 + 1) * 8}${n}`;\n } else {\n range = `>= -(2${n} ** ${(byteLength2 + 1) * 8 - 1}${n}) and < 2 ** ${(byteLength2 + 1) * 8 - 1}${n}`;\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`;\n }\n throw new errors.ERR_OUT_OF_RANGE(\"value\", range, value);\n }\n checkBounds(buf, offset, byteLength2);\n }\n function validateNumber(value, name2) {\n if (typeof value !== \"number\") {\n throw new errors.ERR_INVALID_ARG_TYPE(name2, \"number\", value);\n }\n }\n function boundsError(value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type);\n throw new errors.ERR_OUT_OF_RANGE(type || \"offset\", \"an integer\", value);\n }\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS();\n }\n throw new errors.ERR_OUT_OF_RANGE(\n type || \"offset\",\n `>= ${type ? 1 : 0} and <= ${length}`,\n value\n );\n }\n var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;\n function base64clean(str) {\n str = str.split(\"=\")[0];\n str = str.trim().replace(INVALID_BASE64_RE, \"\");\n if (str.length < 2) return \"\";\n while (str.length % 4 !== 0) {\n str = str + \"=\";\n }\n return str;\n }\n function utf8ToBytes(string, units) {\n units = units || Infinity;\n let codePoint;\n const length = string.length;\n let leadSurrogate = null;\n const bytes = [];\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i);\n if (codePoint > 55295 && codePoint < 57344) {\n if (!leadSurrogate) {\n if (codePoint > 56319) {\n if ((units -= 3) > -1) bytes.push(239, 191, 189);\n continue;\n } else if (i + 1 === length) {\n if ((units -= 3) > -1) bytes.push(239, 191, 189);\n continue;\n }\n leadSurrogate = codePoint;\n continue;\n }\n if (codePoint < 56320) {\n if ((units -= 3) > -1) bytes.push(239, 191, 189);\n leadSurrogate = codePoint;\n continue;\n }\n codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;\n } else if (leadSurrogate) {\n if ((units -= 3) > -1) bytes.push(239, 191, 189);\n }\n leadSurrogate = null;\n if (codePoint < 128) {\n if ((units -= 1) < 0) break;\n bytes.push(codePoint);\n } else if (codePoint < 2048) {\n if ((units -= 2) < 0) break;\n bytes.push(\n codePoint >> 6 | 192,\n codePoint & 63 | 128\n );\n } else if (codePoint < 65536) {\n if ((units -= 3) < 0) break;\n bytes.push(\n codePoint >> 12 | 224,\n codePoint >> 6 & 63 | 128,\n codePoint & 63 | 128\n );\n } else if (codePoint < 1114112) {\n if ((units -= 4) < 0) break;\n bytes.push(\n codePoint >> 18 | 240,\n codePoint >> 12 & 63 | 128,\n codePoint >> 6 & 63 | 128,\n codePoint & 63 | 128\n );\n } else {\n throw new Error(\"Invalid code point\");\n }\n }\n return bytes;\n }\n function asciiToBytes(str) {\n const byteArray = [];\n for (let i = 0; i < str.length; ++i) {\n byteArray.push(str.charCodeAt(i) & 255);\n }\n return byteArray;\n }\n function utf16leToBytes(str, units) {\n let c, hi, lo;\n const byteArray = [];\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break;\n c = str.charCodeAt(i);\n hi = c >> 8;\n lo = c % 256;\n byteArray.push(lo);\n byteArray.push(hi);\n }\n return byteArray;\n }\n function base64ToBytes(str) {\n return base64.toByteArray(base64clean(str));\n }\n function blitBuffer(src, dst, offset, length) {\n let i;\n for (i = 0; i < length; ++i) {\n if (i + offset >= dst.length || i >= src.length) break;\n dst[i + offset] = src[i];\n }\n return i;\n }\n function isInstance(obj, type) {\n return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;\n }\n function numberIsNaN(obj) {\n return obj !== obj;\n }\n var hexSliceLookupTable = function() {\n const alphabet = \"0123456789abcdef\";\n const table = new Array(256);\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16;\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j];\n }\n }\n return table;\n }();\n function defineBigIntMethod(fn) {\n return typeof BigInt === \"undefined\" ? BufferBigIntNotDefined : fn;\n }\n function BufferBigIntNotDefined() {\n throw new Error(\"BigInt not supported\");\n }\n }\n });\n\n // node_modules/has-symbols/shams.js\n var require_shams = __commonJS({\n \"node_modules/has-symbols/shams.js\"(exports, module) {\n \"use strict\";\n module.exports = function hasSymbols() {\n if (typeof Symbol !== \"function\" || typeof Object.getOwnPropertySymbols !== \"function\") {\n return false;\n }\n if (typeof Symbol.iterator === \"symbol\") {\n return true;\n }\n var obj = {};\n var sym = Symbol(\"test\");\n var symObj = Object(sym);\n if (typeof sym === \"string\") {\n return false;\n }\n if (Object.prototype.toString.call(sym) !== \"[object Symbol]\") {\n return false;\n }\n if (Object.prototype.toString.call(symObj) !== \"[object Symbol]\") {\n return false;\n }\n var symVal = 42;\n obj[sym] = symVal;\n for (sym in obj) {\n return false;\n }\n if (typeof Object.keys === \"function\" && Object.keys(obj).length !== 0) {\n return false;\n }\n if (typeof Object.getOwnPropertyNames === \"function\" && Object.getOwnPropertyNames(obj).length !== 0) {\n return false;\n }\n var syms = Object.getOwnPropertySymbols(obj);\n if (syms.length !== 1 || syms[0] !== sym) {\n return false;\n }\n if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) {\n return false;\n }\n if (typeof Object.getOwnPropertyDescriptor === \"function\") {\n var descriptor = Object.getOwnPropertyDescriptor(obj, sym);\n if (descriptor.value !== symVal || descriptor.enumerable !== true) {\n return false;\n }\n }\n return true;\n };\n }\n });\n\n // node_modules/has-tostringtag/shams.js\n var require_shams2 = __commonJS({\n \"node_modules/has-tostringtag/shams.js\"(exports, module) {\n \"use strict\";\n var hasSymbols = require_shams();\n module.exports = function hasToStringTagShams() {\n return hasSymbols() && !!Symbol.toStringTag;\n };\n }\n });\n\n // node_modules/es-errors/index.js\n var require_es_errors = __commonJS({\n \"node_modules/es-errors/index.js\"(exports, module) {\n \"use strict\";\n module.exports = Error;\n }\n });\n\n // node_modules/es-errors/eval.js\n var require_eval = __commonJS({\n \"node_modules/es-errors/eval.js\"(exports, module) {\n \"use strict\";\n module.exports = EvalError;\n }\n });\n\n // node_modules/es-errors/range.js\n var require_range = __commonJS({\n \"node_modules/es-errors/range.js\"(exports, module) {\n \"use strict\";\n module.exports = RangeError;\n }\n });\n\n // node_modules/es-errors/ref.js\n var require_ref = __commonJS({\n \"node_modules/es-errors/ref.js\"(exports, module) {\n \"use strict\";\n module.exports = ReferenceError;\n }\n });\n\n // node_modules/es-errors/syntax.js\n var require_syntax = __commonJS({\n \"node_modules/es-errors/syntax.js\"(exports, module) {\n \"use strict\";\n module.exports = SyntaxError;\n }\n });\n\n // node_modules/es-errors/type.js\n var require_type = __commonJS({\n \"node_modules/es-errors/type.js\"(exports, module) {\n \"use strict\";\n module.exports = TypeError;\n }\n });\n\n // node_modules/es-errors/uri.js\n var require_uri = __commonJS({\n \"node_modules/es-errors/uri.js\"(exports, module) {\n \"use strict\";\n module.exports = URIError;\n }\n });\n\n // node_modules/has-symbols/index.js\n var require_has_symbols = __commonJS({\n \"node_modules/has-symbols/index.js\"(exports, module) {\n \"use strict\";\n var origSymbol = typeof Symbol !== \"undefined\" && Symbol;\n var hasSymbolSham = require_shams();\n module.exports = function hasNativeSymbols() {\n if (typeof origSymbol !== \"function\") {\n return false;\n }\n if (typeof Symbol !== \"function\") {\n return false;\n }\n if (typeof origSymbol(\"foo\") !== \"symbol\") {\n return false;\n }\n if (typeof Symbol(\"bar\") !== \"symbol\") {\n return false;\n }\n return hasSymbolSham();\n };\n }\n });\n\n // node_modules/has-proto/index.js\n var require_has_proto = __commonJS({\n \"node_modules/has-proto/index.js\"(exports, module) {\n \"use strict\";\n var test = {\n foo: {}\n };\n var $Object = Object;\n module.exports = function hasProto() {\n return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object);\n };\n }\n });\n\n // node_modules/function-bind/implementation.js\n var require_implementation = __commonJS({\n \"node_modules/function-bind/implementation.js\"(exports, module) {\n \"use strict\";\n var ERROR_MESSAGE = \"Function.prototype.bind called on incompatible \";\n var toStr = Object.prototype.toString;\n var max = Math.max;\n var funcType = \"[object Function]\";\n var concatty = function concatty2(a, b) {\n var arr = [];\n for (var i = 0; i < a.length; i += 1) {\n arr[i] = a[i];\n }\n for (var j = 0; j < b.length; j += 1) {\n arr[j + a.length] = b[j];\n }\n return arr;\n };\n var slicy = function slicy2(arrLike, offset) {\n var arr = [];\n for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {\n arr[j] = arrLike[i];\n }\n return arr;\n };\n var joiny = function(arr, joiner) {\n var str = \"\";\n for (var i = 0; i < arr.length; i += 1) {\n str += arr[i];\n if (i + 1 < arr.length) {\n str += joiner;\n }\n }\n return str;\n };\n module.exports = function bind(that) {\n var target = this;\n if (typeof target !== \"function\" || toStr.apply(target) !== funcType) {\n throw new TypeError(ERROR_MESSAGE + target);\n }\n var args = slicy(arguments, 1);\n var bound;\n var binder = function() {\n if (this instanceof bound) {\n var result = target.apply(\n this,\n concatty(args, arguments)\n );\n if (Object(result) === result) {\n return result;\n }\n return this;\n }\n return target.apply(\n that,\n concatty(args, arguments)\n );\n };\n var boundLength = max(0, target.length - args.length);\n var boundArgs = [];\n for (var i = 0; i < boundLength; i++) {\n boundArgs[i] = \"$\" + i;\n }\n bound = Function(\"binder\", \"return function (\" + joiny(boundArgs, \",\") + \"){ return binder.apply(this,arguments); }\")(binder);\n if (target.prototype) {\n var Empty = function Empty2() {\n };\n Empty.prototype = target.prototype;\n bound.prototype = new Empty();\n Empty.prototype = null;\n }\n return bound;\n };\n }\n });\n\n // node_modules/function-bind/index.js\n var require_function_bind = __commonJS({\n \"node_modules/function-bind/index.js\"(exports, module) {\n \"use strict\";\n var implementation = require_implementation();\n module.exports = Function.prototype.bind || implementation;\n }\n });\n\n // node_modules/hasown/index.js\n var require_hasown = __commonJS({\n \"node_modules/hasown/index.js\"(exports, module) {\n \"use strict\";\n var call = Function.prototype.call;\n var $hasOwn = Object.prototype.hasOwnProperty;\n var bind = require_function_bind();\n module.exports = bind.call(call, $hasOwn);\n }\n });\n\n // node_modules/get-intrinsic/index.js\n var require_get_intrinsic = __commonJS({\n \"node_modules/get-intrinsic/index.js\"(exports, module) {\n \"use strict\";\n var undefined2;\n var $Error = require_es_errors();\n var $EvalError = require_eval();\n var $RangeError = require_range();\n var $ReferenceError = require_ref();\n var $SyntaxError = require_syntax();\n var $TypeError = require_type();\n var $URIError = require_uri();\n var $Function = Function;\n var getEvalledConstructor = function(expressionSyntax) {\n try {\n return $Function('\"use strict\"; return (' + expressionSyntax + \").constructor;\")();\n } catch (e) {\n }\n };\n var $gOPD = Object.getOwnPropertyDescriptor;\n if ($gOPD) {\n try {\n $gOPD({}, \"\");\n } catch (e) {\n $gOPD = null;\n }\n }\n var throwTypeError = function() {\n throw new $TypeError();\n };\n var ThrowTypeError = $gOPD ? function() {\n try {\n arguments.callee;\n return throwTypeError;\n } catch (calleeThrows) {\n try {\n return $gOPD(arguments, \"callee\").get;\n } catch (gOPDthrows) {\n return throwTypeError;\n }\n }\n }() : throwTypeError;\n var hasSymbols = require_has_symbols()();\n var hasProto = require_has_proto()();\n var getProto = Object.getPrototypeOf || (hasProto ? function(x) {\n return x.__proto__;\n } : null);\n var needsEval = {};\n var TypedArray = typeof Uint8Array === \"undefined\" || !getProto ? undefined2 : getProto(Uint8Array);\n var INTRINSICS = {\n __proto__: null,\n \"%AggregateError%\": typeof AggregateError === \"undefined\" ? undefined2 : AggregateError,\n \"%Array%\": Array,\n \"%ArrayBuffer%\": typeof ArrayBuffer === \"undefined\" ? undefined2 : ArrayBuffer,\n \"%ArrayIteratorPrototype%\": hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined2,\n \"%AsyncFromSyncIteratorPrototype%\": undefined2,\n \"%AsyncFunction%\": needsEval,\n \"%AsyncGenerator%\": needsEval,\n \"%AsyncGeneratorFunction%\": needsEval,\n \"%AsyncIteratorPrototype%\": needsEval,\n \"%Atomics%\": typeof Atomics === \"undefined\" ? undefined2 : Atomics,\n \"%BigInt%\": typeof BigInt === \"undefined\" ? undefined2 : BigInt,\n \"%BigInt64Array%\": typeof BigInt64Array === \"undefined\" ? undefined2 : BigInt64Array,\n \"%BigUint64Array%\": typeof BigUint64Array === \"undefined\" ? undefined2 : BigUint64Array,\n \"%Boolean%\": Boolean,\n \"%DataView%\": typeof DataView === \"undefined\" ? undefined2 : DataView,\n \"%Date%\": Date,\n \"%decodeURI%\": decodeURI,\n \"%decodeURIComponent%\": decodeURIComponent,\n \"%encodeURI%\": encodeURI,\n \"%encodeURIComponent%\": encodeURIComponent,\n \"%Error%\": $Error,\n \"%eval%\": eval,\n // eslint-disable-line no-eval\n \"%EvalError%\": $EvalError,\n \"%Float32Array%\": typeof Float32Array === \"undefined\" ? undefined2 : Float32Array,\n \"%Float64Array%\": typeof Float64Array === \"undefined\" ? undefined2 : Float64Array,\n \"%FinalizationRegistry%\": typeof FinalizationRegistry === \"undefined\" ? undefined2 : FinalizationRegistry,\n \"%Function%\": $Function,\n \"%GeneratorFunction%\": needsEval,\n \"%Int8Array%\": typeof Int8Array === \"undefined\" ? undefined2 : Int8Array,\n \"%Int16Array%\": typeof Int16Array === \"undefined\" ? undefined2 : Int16Array,\n \"%Int32Array%\": typeof Int32Array === \"undefined\" ? undefined2 : Int32Array,\n \"%isFinite%\": isFinite,\n \"%isNaN%\": isNaN,\n \"%IteratorPrototype%\": hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined2,\n \"%JSON%\": typeof JSON === \"object\" ? JSON : undefined2,\n \"%Map%\": typeof Map === \"undefined\" ? undefined2 : Map,\n \"%MapIteratorPrototype%\": typeof Map === \"undefined\" || !hasSymbols || !getProto ? undefined2 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()),\n \"%Math%\": Math,\n \"%Number%\": Number,\n \"%Object%\": Object,\n \"%parseFloat%\": parseFloat,\n \"%parseInt%\": parseInt,\n \"%Promise%\": typeof Promise === \"undefined\" ? undefined2 : Promise,\n \"%Proxy%\": typeof Proxy === \"undefined\" ? undefined2 : Proxy,\n \"%RangeError%\": $RangeError,\n \"%ReferenceError%\": $ReferenceError,\n \"%Reflect%\": typeof Reflect === \"undefined\" ? undefined2 : Reflect,\n \"%RegExp%\": RegExp,\n \"%Set%\": typeof Set === \"undefined\" ? undefined2 : Set,\n \"%SetIteratorPrototype%\": typeof Set === \"undefined\" || !hasSymbols || !getProto ? undefined2 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()),\n \"%SharedArrayBuffer%\": typeof SharedArrayBuffer === \"undefined\" ? undefined2 : SharedArrayBuffer,\n \"%String%\": String,\n \"%StringIteratorPrototype%\": hasSymbols && getProto ? getProto(\"\"[Symbol.iterator]()) : undefined2,\n \"%Symbol%\": hasSymbols ? Symbol : undefined2,\n \"%SyntaxError%\": $SyntaxError,\n \"%ThrowTypeError%\": ThrowTypeError,\n \"%TypedArray%\": TypedArray,\n \"%TypeError%\": $TypeError,\n \"%Uint8Array%\": typeof Uint8Array === \"undefined\" ? undefined2 : Uint8Array,\n \"%Uint8ClampedArray%\": typeof Uint8ClampedArray === \"undefined\" ? undefined2 : Uint8ClampedArray,\n \"%Uint16Array%\": typeof Uint16Array === \"undefined\" ? undefined2 : Uint16Array,\n \"%Uint32Array%\": typeof Uint32Array === \"undefined\" ? undefined2 : Uint32Array,\n \"%URIError%\": $URIError,\n \"%WeakMap%\": typeof WeakMap === \"undefined\" ? undefined2 : WeakMap,\n \"%WeakRef%\": typeof WeakRef === \"undefined\" ? undefined2 : WeakRef,\n \"%WeakSet%\": typeof WeakSet === \"undefined\" ? undefined2 : WeakSet\n };\n if (getProto) {\n try {\n null.error;\n } catch (e) {\n errorProto = getProto(getProto(e));\n INTRINSICS[\"%Error.prototype%\"] = errorProto;\n }\n }\n var errorProto;\n var doEval = function doEval2(name2) {\n var value;\n if (name2 === \"%AsyncFunction%\") {\n value = getEvalledConstructor(\"async function () {}\");\n } else if (name2 === \"%GeneratorFunction%\") {\n value = getEvalledConstructor(\"function* () {}\");\n } else if (name2 === \"%AsyncGeneratorFunction%\") {\n value = getEvalledConstructor(\"async function* () {}\");\n } else if (name2 === \"%AsyncGenerator%\") {\n var fn = doEval2(\"%AsyncGeneratorFunction%\");\n if (fn) {\n value = fn.prototype;\n }\n } else if (name2 === \"%AsyncIteratorPrototype%\") {\n var gen = doEval2(\"%AsyncGenerator%\");\n if (gen && getProto) {\n value = getProto(gen.prototype);\n }\n }\n INTRINSICS[name2] = value;\n return value;\n };\n var LEGACY_ALIASES = {\n __proto__: null,\n \"%ArrayBufferPrototype%\": [\"ArrayBuffer\", \"prototype\"],\n \"%ArrayPrototype%\": [\"Array\", \"prototype\"],\n \"%ArrayProto_entries%\": [\"Array\", \"prototype\", \"entries\"],\n \"%ArrayProto_forEach%\": [\"Array\", \"prototype\", \"forEach\"],\n \"%ArrayProto_keys%\": [\"Array\", \"prototype\", \"keys\"],\n \"%ArrayProto_values%\": [\"Array\", \"prototype\", \"values\"],\n \"%AsyncFunctionPrototype%\": [\"AsyncFunction\", \"prototype\"],\n \"%AsyncGenerator%\": [\"AsyncGeneratorFunction\", \"prototype\"],\n \"%AsyncGeneratorPrototype%\": [\"AsyncGeneratorFunction\", \"prototype\", \"prototype\"],\n \"%BooleanPrototype%\": [\"Boolean\", \"prototype\"],\n \"%DataViewPrototype%\": [\"DataView\", \"prototype\"],\n \"%DatePrototype%\": [\"Date\", \"prototype\"],\n \"%ErrorPrototype%\": [\"Error\", \"prototype\"],\n \"%EvalErrorPrototype%\": [\"EvalError\", \"prototype\"],\n \"%Float32ArrayPrototype%\": [\"Float32Array\", \"prototype\"],\n \"%Float64ArrayPrototype%\": [\"Float64Array\", \"prototype\"],\n \"%FunctionPrototype%\": [\"Function\", \"prototype\"],\n \"%Generator%\": [\"GeneratorFunction\", \"prototype\"],\n \"%GeneratorPrototype%\": [\"GeneratorFunction\", \"prototype\", \"prototype\"],\n \"%Int8ArrayPrototype%\": [\"Int8Array\", \"prototype\"],\n \"%Int16ArrayPrototype%\": [\"Int16Array\", \"prototype\"],\n \"%Int32ArrayPrototype%\": [\"Int32Array\", \"prototype\"],\n \"%JSONParse%\": [\"JSON\", \"parse\"],\n \"%JSONStringify%\": [\"JSON\", \"stringify\"],\n \"%MapPrototype%\": [\"Map\", \"prototype\"],\n \"%NumberPrototype%\": [\"Number\", \"prototype\"],\n \"%ObjectPrototype%\": [\"Object\", \"prototype\"],\n \"%ObjProto_toString%\": [\"Object\", \"prototype\", \"toString\"],\n \"%ObjProto_valueOf%\": [\"Object\", \"prototype\", \"valueOf\"],\n \"%PromisePrototype%\": [\"Promise\", \"prototype\"],\n \"%PromiseProto_then%\": [\"Promise\", \"prototype\", \"then\"],\n \"%Promise_all%\": [\"Promise\", \"all\"],\n \"%Promise_reject%\": [\"Promise\", \"reject\"],\n \"%Promise_resolve%\": [\"Promise\", \"resolve\"],\n \"%RangeErrorPrototype%\": [\"RangeError\", \"prototype\"],\n \"%ReferenceErrorPrototype%\": [\"ReferenceError\", \"prototype\"],\n \"%RegExpPrototype%\": [\"RegExp\", \"prototype\"],\n \"%SetPrototype%\": [\"Set\", \"prototype\"],\n \"%SharedArrayBufferPrototype%\": [\"SharedArrayBuffer\", \"prototype\"],\n \"%StringPrototype%\": [\"String\", \"prototype\"],\n \"%SymbolPrototype%\": [\"Symbol\", \"prototype\"],\n \"%SyntaxErrorPrototype%\": [\"SyntaxError\", \"prototype\"],\n \"%TypedArrayPrototype%\": [\"TypedArray\", \"prototype\"],\n \"%TypeErrorPrototype%\": [\"TypeError\", \"prototype\"],\n \"%Uint8ArrayPrototype%\": [\"Uint8Array\", \"prototype\"],\n \"%Uint8ClampedArrayPrototype%\": [\"Uint8ClampedArray\", \"prototype\"],\n \"%Uint16ArrayPrototype%\": [\"Uint16Array\", \"prototype\"],\n \"%Uint32ArrayPrototype%\": [\"Uint32Array\", \"prototype\"],\n \"%URIErrorPrototype%\": [\"URIError\", \"prototype\"],\n \"%WeakMapPrototype%\": [\"WeakMap\", \"prototype\"],\n \"%WeakSetPrototype%\": [\"WeakSet\", \"prototype\"]\n };\n var bind = require_function_bind();\n var hasOwn = require_hasown();\n var $concat = bind.call(Function.call, Array.prototype.concat);\n var $spliceApply = bind.call(Function.apply, Array.prototype.splice);\n var $replace = bind.call(Function.call, String.prototype.replace);\n var $strSlice = bind.call(Function.call, String.prototype.slice);\n var $exec = bind.call(Function.call, RegExp.prototype.exec);\n var rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\n var reEscapeChar = /\\\\(\\\\)?/g;\n var stringToPath = function stringToPath2(string) {\n var first = $strSlice(string, 0, 1);\n var last = $strSlice(string, -1);\n if (first === \"%\" && last !== \"%\") {\n throw new $SyntaxError(\"invalid intrinsic syntax, expected closing `%`\");\n } else if (last === \"%\" && first !== \"%\") {\n throw new $SyntaxError(\"invalid intrinsic syntax, expected opening `%`\");\n }\n var result = [];\n $replace(string, rePropName, function(match, number, quote, subString) {\n result[result.length] = quote ? $replace(subString, reEscapeChar, \"$1\") : number || match;\n });\n return result;\n };\n var getBaseIntrinsic = function getBaseIntrinsic2(name2, allowMissing) {\n var intrinsicName = name2;\n var alias;\n if (hasOwn(LEGACY_ALIASES, intrinsicName)) {\n alias = LEGACY_ALIASES[intrinsicName];\n intrinsicName = \"%\" + alias[0] + \"%\";\n }\n if (hasOwn(INTRINSICS, intrinsicName)) {\n var value = INTRINSICS[intrinsicName];\n if (value === needsEval) {\n value = doEval(intrinsicName);\n }\n if (typeof value === \"undefined\" && !allowMissing) {\n throw new $TypeError(\"intrinsic \" + name2 + \" exists, but is not available. Please file an issue!\");\n }\n return {\n alias,\n name: intrinsicName,\n value\n };\n }\n throw new $SyntaxError(\"intrinsic \" + name2 + \" does not exist!\");\n };\n module.exports = function GetIntrinsic(name2, allowMissing) {\n if (typeof name2 !== \"string\" || name2.length === 0) {\n throw new $TypeError(\"intrinsic name must be a non-empty string\");\n }\n if (arguments.length > 1 && typeof allowMissing !== \"boolean\") {\n throw new $TypeError('\"allowMissing\" argument must be a boolean');\n }\n if ($exec(/^%?[^%]*%?$/, name2) === null) {\n throw new $SyntaxError(\"`%` may not be present anywhere but at the beginning and end of the intrinsic name\");\n }\n var parts = stringToPath(name2);\n var intrinsicBaseName = parts.length > 0 ? parts[0] : \"\";\n var intrinsic = getBaseIntrinsic(\"%\" + intrinsicBaseName + \"%\", allowMissing);\n var intrinsicRealName = intrinsic.name;\n var value = intrinsic.value;\n var skipFurtherCaching = false;\n var alias = intrinsic.alias;\n if (alias) {\n intrinsicBaseName = alias[0];\n $spliceApply(parts, $concat([0, 1], alias));\n }\n for (var i = 1, isOwn = true; i < parts.length; i += 1) {\n var part = parts[i];\n var first = $strSlice(part, 0, 1);\n var last = $strSlice(part, -1);\n if ((first === '\"' || first === \"'\" || first === \"`\" || (last === '\"' || last === \"'\" || last === \"`\")) && first !== last) {\n throw new $SyntaxError(\"property names with quotes must have matching quotes\");\n }\n if (part === \"constructor\" || !isOwn) {\n skipFurtherCaching = true;\n }\n intrinsicBaseName += \".\" + part;\n intrinsicRealName = \"%\" + intrinsicBaseName + \"%\";\n if (hasOwn(INTRINSICS, intrinsicRealName)) {\n value = INTRINSICS[intrinsicRealName];\n } else if (value != null) {\n if (!(part in value)) {\n if (!allowMissing) {\n throw new $TypeError(\"base intrinsic for \" + name2 + \" exists, but the property is not available.\");\n }\n return void 0;\n }\n if ($gOPD && i + 1 >= parts.length) {\n var desc = $gOPD(value, part);\n isOwn = !!desc;\n if (isOwn && \"get\" in desc && !(\"originalValue\" in desc.get)) {\n value = desc.get;\n } else {\n value = value[part];\n }\n } else {\n isOwn = hasOwn(value, part);\n value = value[part];\n }\n if (isOwn && !skipFurtherCaching) {\n INTRINSICS[intrinsicRealName] = value;\n }\n }\n }\n return value;\n };\n }\n });\n\n // node_modules/es-define-property/index.js\n var require_es_define_property = __commonJS({\n \"node_modules/es-define-property/index.js\"(exports, module) {\n \"use strict\";\n var GetIntrinsic = require_get_intrinsic();\n var $defineProperty = GetIntrinsic(\"%Object.defineProperty%\", true) || false;\n if ($defineProperty) {\n try {\n $defineProperty({}, \"a\", { value: 1 });\n } catch (e) {\n $defineProperty = false;\n }\n }\n module.exports = $defineProperty;\n }\n });\n\n // node_modules/gopd/index.js\n var require_gopd = __commonJS({\n \"node_modules/gopd/index.js\"(exports, module) {\n \"use strict\";\n var GetIntrinsic = require_get_intrinsic();\n var $gOPD = GetIntrinsic(\"%Object.getOwnPropertyDescriptor%\", true);\n if ($gOPD) {\n try {\n $gOPD([], \"length\");\n } catch (e) {\n $gOPD = null;\n }\n }\n module.exports = $gOPD;\n }\n });\n\n // node_modules/define-data-property/index.js\n var require_define_data_property = __commonJS({\n \"node_modules/define-data-property/index.js\"(exports, module) {\n \"use strict\";\n var $defineProperty = require_es_define_property();\n var $SyntaxError = require_syntax();\n var $TypeError = require_type();\n var gopd = require_gopd();\n module.exports = function defineDataProperty(obj, property, value) {\n if (!obj || typeof obj !== \"object\" && typeof obj !== \"function\") {\n throw new $TypeError(\"`obj` must be an object or a function`\");\n }\n if (typeof property !== \"string\" && typeof property !== \"symbol\") {\n throw new $TypeError(\"`property` must be a string or a symbol`\");\n }\n if (arguments.length > 3 && typeof arguments[3] !== \"boolean\" && arguments[3] !== null) {\n throw new $TypeError(\"`nonEnumerable`, if provided, must be a boolean or null\");\n }\n if (arguments.length > 4 && typeof arguments[4] !== \"boolean\" && arguments[4] !== null) {\n throw new $TypeError(\"`nonWritable`, if provided, must be a boolean or null\");\n }\n if (arguments.length > 5 && typeof arguments[5] !== \"boolean\" && arguments[5] !== null) {\n throw new $TypeError(\"`nonConfigurable`, if provided, must be a boolean or null\");\n }\n if (arguments.length > 6 && typeof arguments[6] !== \"boolean\") {\n throw new $TypeError(\"`loose`, if provided, must be a boolean\");\n }\n var nonEnumerable = arguments.length > 3 ? arguments[3] : null;\n var nonWritable = arguments.length > 4 ? arguments[4] : null;\n var nonConfigurable = arguments.length > 5 ? arguments[5] : null;\n var loose = arguments.length > 6 ? arguments[6] : false;\n var desc = !!gopd && gopd(obj, property);\n if ($defineProperty) {\n $defineProperty(obj, property, {\n configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,\n enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,\n value,\n writable: nonWritable === null && desc ? desc.writable : !nonWritable\n });\n } else if (loose || !nonEnumerable && !nonWritable && !nonConfigurable) {\n obj[property] = value;\n } else {\n throw new $SyntaxError(\"This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.\");\n }\n };\n }\n });\n\n // node_modules/has-property-descriptors/index.js\n var require_has_property_descriptors = __commonJS({\n \"node_modules/has-property-descriptors/index.js\"(exports, module) {\n \"use strict\";\n var $defineProperty = require_es_define_property();\n var hasPropertyDescriptors = function hasPropertyDescriptors2() {\n return !!$defineProperty;\n };\n hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {\n if (!$defineProperty) {\n return null;\n }\n try {\n return $defineProperty([], \"length\", { value: 1 }).length !== 1;\n } catch (e) {\n return true;\n }\n };\n module.exports = hasPropertyDescriptors;\n }\n });\n\n // node_modules/set-function-length/index.js\n var require_set_function_length = __commonJS({\n \"node_modules/set-function-length/index.js\"(exports, module) {\n \"use strict\";\n var GetIntrinsic = require_get_intrinsic();\n var define2 = require_define_data_property();\n var hasDescriptors = require_has_property_descriptors()();\n var gOPD = require_gopd();\n var $TypeError = require_type();\n var $floor = GetIntrinsic(\"%Math.floor%\");\n module.exports = function setFunctionLength(fn, length) {\n if (typeof fn !== \"function\") {\n throw new $TypeError(\"`fn` is not a function\");\n }\n if (typeof length !== \"number\" || length < 0 || length > 4294967295 || $floor(length) !== length) {\n throw new $TypeError(\"`length` must be a positive 32-bit integer\");\n }\n var loose = arguments.length > 2 && !!arguments[2];\n var functionLengthIsConfigurable = true;\n var functionLengthIsWritable = true;\n if (\"length\" in fn && gOPD) {\n var desc = gOPD(fn, \"length\");\n if (desc && !desc.configurable) {\n functionLengthIsConfigurable = false;\n }\n if (desc && !desc.writable) {\n functionLengthIsWritable = false;\n }\n }\n if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {\n if (hasDescriptors) {\n define2(\n /** @type {Parameters[0]} */\n fn,\n \"length\",\n length,\n true,\n true\n );\n } else {\n define2(\n /** @type {Parameters[0]} */\n fn,\n \"length\",\n length\n );\n }\n }\n return fn;\n };\n }\n });\n\n // node_modules/call-bind/index.js\n var require_call_bind = __commonJS({\n \"node_modules/call-bind/index.js\"(exports, module) {\n \"use strict\";\n var bind = require_function_bind();\n var GetIntrinsic = require_get_intrinsic();\n var setFunctionLength = require_set_function_length();\n var $TypeError = require_type();\n var $apply = GetIntrinsic(\"%Function.prototype.apply%\");\n var $call = GetIntrinsic(\"%Function.prototype.call%\");\n var $reflectApply = GetIntrinsic(\"%Reflect.apply%\", true) || bind.call($call, $apply);\n var $defineProperty = require_es_define_property();\n var $max = GetIntrinsic(\"%Math.max%\");\n module.exports = function callBind(originalFunction) {\n if (typeof originalFunction !== \"function\") {\n throw new $TypeError(\"a function is required\");\n }\n var func = $reflectApply(bind, $call, arguments);\n return setFunctionLength(\n func,\n 1 + $max(0, originalFunction.length - (arguments.length - 1)),\n true\n );\n };\n var applyBind = function applyBind2() {\n return $reflectApply(bind, $apply, arguments);\n };\n if ($defineProperty) {\n $defineProperty(module.exports, \"apply\", { value: applyBind });\n } else {\n module.exports.apply = applyBind;\n }\n }\n });\n\n // node_modules/call-bind/callBound.js\n var require_callBound = __commonJS({\n \"node_modules/call-bind/callBound.js\"(exports, module) {\n \"use strict\";\n var GetIntrinsic = require_get_intrinsic();\n var callBind = require_call_bind();\n var $indexOf = callBind(GetIntrinsic(\"String.prototype.indexOf\"));\n module.exports = function callBoundIntrinsic(name2, allowMissing) {\n var intrinsic = GetIntrinsic(name2, !!allowMissing);\n if (typeof intrinsic === \"function\" && $indexOf(name2, \".prototype.\") > -1) {\n return callBind(intrinsic);\n }\n return intrinsic;\n };\n }\n });\n\n // node_modules/is-arguments/index.js\n var require_is_arguments = __commonJS({\n \"node_modules/is-arguments/index.js\"(exports, module) {\n \"use strict\";\n var hasToStringTag = require_shams2()();\n var callBound = require_callBound();\n var $toString = callBound(\"Object.prototype.toString\");\n var isStandardArguments = function isArguments(value) {\n if (hasToStringTag && value && typeof value === \"object\" && Symbol.toStringTag in value) {\n return false;\n }\n return $toString(value) === \"[object Arguments]\";\n };\n var isLegacyArguments = function isArguments(value) {\n if (isStandardArguments(value)) {\n return true;\n }\n return value !== null && typeof value === \"object\" && typeof value.length === \"number\" && value.length >= 0 && $toString(value) !== \"[object Array]\" && $toString(value.callee) === \"[object Function]\";\n };\n var supportsStandardArguments = function() {\n return isStandardArguments(arguments);\n }();\n isStandardArguments.isLegacyArguments = isLegacyArguments;\n module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;\n }\n });\n\n // node_modules/is-generator-function/index.js\n var require_is_generator_function = __commonJS({\n \"node_modules/is-generator-function/index.js\"(exports, module) {\n \"use strict\";\n var toStr = Object.prototype.toString;\n var fnToStr = Function.prototype.toString;\n var isFnRegex = /^\\s*(?:function)?\\*/;\n var hasToStringTag = require_shams2()();\n var getProto = Object.getPrototypeOf;\n var getGeneratorFunc = function() {\n if (!hasToStringTag) {\n return false;\n }\n try {\n return Function(\"return function*() {}\")();\n } catch (e) {\n }\n };\n var GeneratorFunction;\n module.exports = function isGeneratorFunction(fn) {\n if (typeof fn !== \"function\") {\n return false;\n }\n if (isFnRegex.test(fnToStr.call(fn))) {\n return true;\n }\n if (!hasToStringTag) {\n var str = toStr.call(fn);\n return str === \"[object GeneratorFunction]\";\n }\n if (!getProto) {\n return false;\n }\n if (typeof GeneratorFunction === \"undefined\") {\n var generatorFunc = getGeneratorFunc();\n GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false;\n }\n return getProto(fn) === GeneratorFunction;\n };\n }\n });\n\n // node_modules/is-callable/index.js\n var require_is_callable = __commonJS({\n \"node_modules/is-callable/index.js\"(exports, module) {\n \"use strict\";\n var fnToStr = Function.prototype.toString;\n var reflectApply = typeof Reflect === \"object\" && Reflect !== null && Reflect.apply;\n var badArrayLike;\n var isCallableMarker;\n if (typeof reflectApply === \"function\" && typeof Object.defineProperty === \"function\") {\n try {\n badArrayLike = Object.defineProperty({}, \"length\", {\n get: function() {\n throw isCallableMarker;\n }\n });\n isCallableMarker = {};\n reflectApply(function() {\n throw 42;\n }, null, badArrayLike);\n } catch (_) {\n if (_ !== isCallableMarker) {\n reflectApply = null;\n }\n }\n } else {\n reflectApply = null;\n }\n var constructorRegex = /^\\s*class\\b/;\n var isES6ClassFn = function isES6ClassFunction(value) {\n try {\n var fnStr = fnToStr.call(value);\n return constructorRegex.test(fnStr);\n } catch (e) {\n return false;\n }\n };\n var tryFunctionObject = function tryFunctionToStr(value) {\n try {\n if (isES6ClassFn(value)) {\n return false;\n }\n fnToStr.call(value);\n return true;\n } catch (e) {\n return false;\n }\n };\n var toStr = Object.prototype.toString;\n var objectClass = \"[object Object]\";\n var fnClass = \"[object Function]\";\n var genClass = \"[object GeneratorFunction]\";\n var ddaClass = \"[object HTMLAllCollection]\";\n var ddaClass2 = \"[object HTML document.all class]\";\n var ddaClass3 = \"[object HTMLCollection]\";\n var hasToStringTag = typeof Symbol === \"function\" && !!Symbol.toStringTag;\n var isIE68 = !(0 in [,]);\n var isDDA = function isDocumentDotAll() {\n return false;\n };\n if (typeof document === \"object\") {\n all = document.all;\n if (toStr.call(all) === toStr.call(document.all)) {\n isDDA = function isDocumentDotAll(value) {\n if ((isIE68 || !value) && (typeof value === \"undefined\" || typeof value === \"object\")) {\n try {\n var str = toStr.call(value);\n return (str === ddaClass || str === ddaClass2 || str === ddaClass3 || str === objectClass) && value(\"\") == null;\n } catch (e) {\n }\n }\n return false;\n };\n }\n }\n var all;\n module.exports = reflectApply ? function isCallable(value) {\n if (isDDA(value)) {\n return true;\n }\n if (!value) {\n return false;\n }\n if (typeof value !== \"function\" && typeof value !== \"object\") {\n return false;\n }\n try {\n reflectApply(value, null, badArrayLike);\n } catch (e) {\n if (e !== isCallableMarker) {\n return false;\n }\n }\n return !isES6ClassFn(value) && tryFunctionObject(value);\n } : function isCallable(value) {\n if (isDDA(value)) {\n return true;\n }\n if (!value) {\n return false;\n }\n if (typeof value !== \"function\" && typeof value !== \"object\") {\n return false;\n }\n if (hasToStringTag) {\n return tryFunctionObject(value);\n }\n if (isES6ClassFn(value)) {\n return false;\n }\n var strClass = toStr.call(value);\n if (strClass !== fnClass && strClass !== genClass && !/^\\[object HTML/.test(strClass)) {\n return false;\n }\n return tryFunctionObject(value);\n };\n }\n });\n\n // node_modules/for-each/index.js\n var require_for_each = __commonJS({\n \"node_modules/for-each/index.js\"(exports, module) {\n \"use strict\";\n var isCallable = require_is_callable();\n var toStr = Object.prototype.toString;\n var hasOwnProperty2 = Object.prototype.hasOwnProperty;\n var forEachArray = function forEachArray2(array, iterator, receiver) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (hasOwnProperty2.call(array, i)) {\n if (receiver == null) {\n iterator(array[i], i, array);\n } else {\n iterator.call(receiver, array[i], i, array);\n }\n }\n }\n };\n var forEachString = function forEachString2(string, iterator, receiver) {\n for (var i = 0, len = string.length; i < len; i++) {\n if (receiver == null) {\n iterator(string.charAt(i), i, string);\n } else {\n iterator.call(receiver, string.charAt(i), i, string);\n }\n }\n };\n var forEachObject = function forEachObject2(object, iterator, receiver) {\n for (var k in object) {\n if (hasOwnProperty2.call(object, k)) {\n if (receiver == null) {\n iterator(object[k], k, object);\n } else {\n iterator.call(receiver, object[k], k, object);\n }\n }\n }\n };\n var forEach = function forEach2(list, iterator, thisArg) {\n if (!isCallable(iterator)) {\n throw new TypeError(\"iterator must be a function\");\n }\n var receiver;\n if (arguments.length >= 3) {\n receiver = thisArg;\n }\n if (toStr.call(list) === \"[object Array]\") {\n forEachArray(list, iterator, receiver);\n } else if (typeof list === \"string\") {\n forEachString(list, iterator, receiver);\n } else {\n forEachObject(list, iterator, receiver);\n }\n };\n module.exports = forEach;\n }\n });\n\n // node_modules/available-typed-arrays/index.js\n var require_available_typed_arrays = __commonJS({\n \"node_modules/available-typed-arrays/index.js\"(exports, module) {\n \"use strict\";\n var possibleNames = [\n \"BigInt64Array\",\n \"BigUint64Array\",\n \"Float32Array\",\n \"Float64Array\",\n \"Int16Array\",\n \"Int32Array\",\n \"Int8Array\",\n \"Uint16Array\",\n \"Uint32Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\"\n ];\n var g = typeof globalThis === \"undefined\" ? window : globalThis;\n module.exports = function availableTypedArrays() {\n var out = [];\n for (var i = 0; i < possibleNames.length; i++) {\n if (typeof g[possibleNames[i]] === \"function\") {\n out[out.length] = possibleNames[i];\n }\n }\n return out;\n };\n }\n });\n\n // node_modules/which-typed-array/index.js\n var require_which_typed_array = __commonJS({\n \"node_modules/which-typed-array/index.js\"(exports, module) {\n \"use strict\";\n var forEach = require_for_each();\n var availableTypedArrays = require_available_typed_arrays();\n var callBind = require_call_bind();\n var callBound = require_callBound();\n var gOPD = require_gopd();\n var $toString = callBound(\"Object.prototype.toString\");\n var hasToStringTag = require_shams2()();\n var g = typeof globalThis === \"undefined\" ? window : globalThis;\n var typedArrays = availableTypedArrays();\n var $slice = callBound(\"String.prototype.slice\");\n var getPrototypeOf = Object.getPrototypeOf;\n var $indexOf = callBound(\"Array.prototype.indexOf\", true) || /** @type {(array: readonly unknown[], value: unknown) => keyof array} */\n function indexOf(array, value) {\n for (var i = 0; i < array.length; i += 1) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n };\n var cache = { __proto__: null };\n if (hasToStringTag && gOPD && getPrototypeOf) {\n forEach(typedArrays, function(typedArray) {\n var arr = new g[typedArray]();\n if (Symbol.toStringTag in arr) {\n var proto = getPrototypeOf(arr);\n var descriptor = gOPD(proto, Symbol.toStringTag);\n if (!descriptor) {\n var superProto = getPrototypeOf(proto);\n descriptor = gOPD(superProto, Symbol.toStringTag);\n }\n cache[\"$\" + typedArray] = callBind(descriptor.get);\n }\n });\n } else {\n forEach(typedArrays, function(typedArray) {\n var arr = new g[typedArray]();\n var fn = arr.slice || arr.set;\n if (fn) {\n cache[\"$\" + typedArray] = callBind(fn);\n }\n });\n }\n var tryTypedArrays = function tryAllTypedArrays(value) {\n var found = false;\n forEach(\n // eslint-disable-next-line no-extra-parens\n /** @type {Record<`\\$${TypedArrayName}`, typeof cache>} */\n /** @type {any} */\n cache,\n /** @type {(getter: typeof cache, name: `\\$${TypedArrayName}`) => void} */\n function(getter, typedArray) {\n if (!found) {\n try {\n if (\"$\" + getter(value) === typedArray) {\n found = $slice(typedArray, 1);\n }\n } catch (e) {\n }\n }\n }\n );\n return found;\n };\n var trySlices = function tryAllSlices(value) {\n var found = false;\n forEach(\n // eslint-disable-next-line no-extra-parens\n /** @type {any} */\n cache,\n /** @type {(getter: typeof cache, name: `\\$${TypedArrayName}`) => void} */\n function(getter, name2) {\n if (!found) {\n try {\n getter(value);\n found = $slice(name2, 1);\n } catch (e) {\n }\n }\n }\n );\n return found;\n };\n module.exports = function whichTypedArray(value) {\n if (!value || typeof value !== \"object\") {\n return false;\n }\n if (!hasToStringTag) {\n var tag = $slice($toString(value), 8, -1);\n if ($indexOf(typedArrays, tag) > -1) {\n return tag;\n }\n if (tag !== \"Object\") {\n return false;\n }\n return trySlices(value);\n }\n if (!gOPD) {\n return null;\n }\n return tryTypedArrays(value);\n };\n }\n });\n\n // node_modules/is-typed-array/index.js\n var require_is_typed_array = __commonJS({\n \"node_modules/is-typed-array/index.js\"(exports, module) {\n \"use strict\";\n var forEach = require_for_each();\n var availableTypedArrays = require_available_typed_arrays();\n var callBound = require_callBound();\n var $toString = callBound(\"Object.prototype.toString\");\n var hasToStringTag = require_shams2()();\n var gOPD = require_gopd();\n var g = typeof globalThis === \"undefined\" ? window : globalThis;\n var typedArrays = availableTypedArrays();\n var $indexOf = callBound(\"Array.prototype.indexOf\", true) || function indexOf(array, value) {\n for (var i = 0; i < array.length; i += 1) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n };\n var $slice = callBound(\"String.prototype.slice\");\n var toStrTags = {};\n var getPrototypeOf = Object.getPrototypeOf;\n if (hasToStringTag && gOPD && getPrototypeOf) {\n forEach(typedArrays, function(typedArray) {\n var arr = new g[typedArray]();\n if (Symbol.toStringTag in arr) {\n var proto = getPrototypeOf(arr);\n var descriptor = gOPD(proto, Symbol.toStringTag);\n if (!descriptor) {\n var superProto = getPrototypeOf(proto);\n descriptor = gOPD(superProto, Symbol.toStringTag);\n }\n toStrTags[typedArray] = descriptor.get;\n }\n });\n }\n var tryTypedArrays = function tryAllTypedArrays(value) {\n var anyTrue = false;\n forEach(toStrTags, function(getter, typedArray) {\n if (!anyTrue) {\n try {\n anyTrue = getter.call(value) === typedArray;\n } catch (e) {\n }\n }\n });\n return anyTrue;\n };\n module.exports = function isTypedArray(value) {\n if (!value || typeof value !== \"object\") {\n return false;\n }\n if (!hasToStringTag || !(Symbol.toStringTag in value)) {\n var tag = $slice($toString(value), 8, -1);\n return $indexOf(typedArrays, tag) > -1;\n }\n if (!gOPD) {\n return false;\n }\n return tryTypedArrays(value);\n };\n }\n });\n\n // node_modules/util/support/types.js\n var require_types = __commonJS({\n \"node_modules/util/support/types.js\"(exports) {\n \"use strict\";\n var isArgumentsObject = require_is_arguments();\n var isGeneratorFunction = require_is_generator_function();\n var whichTypedArray = require_which_typed_array();\n var isTypedArray = require_is_typed_array();\n function uncurryThis(f) {\n return f.call.bind(f);\n }\n var BigIntSupported = typeof BigInt !== \"undefined\";\n var SymbolSupported = typeof Symbol !== \"undefined\";\n var ObjectToString = uncurryThis(Object.prototype.toString);\n var numberValue = uncurryThis(Number.prototype.valueOf);\n var stringValue = uncurryThis(String.prototype.valueOf);\n var booleanValue = uncurryThis(Boolean.prototype.valueOf);\n if (BigIntSupported) {\n bigIntValue = uncurryThis(BigInt.prototype.valueOf);\n }\n var bigIntValue;\n if (SymbolSupported) {\n symbolValue = uncurryThis(Symbol.prototype.valueOf);\n }\n var symbolValue;\n function checkBoxedPrimitive(value, prototypeValueOf) {\n if (typeof value !== \"object\") {\n return false;\n }\n try {\n prototypeValueOf(value);\n return true;\n } catch (e) {\n return false;\n }\n }\n exports.isArgumentsObject = isArgumentsObject;\n exports.isGeneratorFunction = isGeneratorFunction;\n exports.isTypedArray = isTypedArray;\n function isPromise(input) {\n return typeof Promise !== \"undefined\" && input instanceof Promise || input !== null && typeof input === \"object\" && typeof input.then === \"function\" && typeof input.catch === \"function\";\n }\n exports.isPromise = isPromise;\n function isArrayBufferView(value) {\n if (typeof ArrayBuffer !== \"undefined\" && ArrayBuffer.isView) {\n return ArrayBuffer.isView(value);\n }\n return isTypedArray(value) || isDataView(value);\n }\n exports.isArrayBufferView = isArrayBufferView;\n function isUint8Array(value) {\n return whichTypedArray(value) === \"Uint8Array\";\n }\n exports.isUint8Array = isUint8Array;\n function isUint8ClampedArray(value) {\n return whichTypedArray(value) === \"Uint8ClampedArray\";\n }\n exports.isUint8ClampedArray = isUint8ClampedArray;\n function isUint16Array(value) {\n return whichTypedArray(value) === \"Uint16Array\";\n }\n exports.isUint16Array = isUint16Array;\n function isUint32Array(value) {\n return whichTypedArray(value) === \"Uint32Array\";\n }\n exports.isUint32Array = isUint32Array;\n function isInt8Array(value) {\n return whichTypedArray(value) === \"Int8Array\";\n }\n exports.isInt8Array = isInt8Array;\n function isInt16Array(value) {\n return whichTypedArray(value) === \"Int16Array\";\n }\n exports.isInt16Array = isInt16Array;\n function isInt32Array(value) {\n return whichTypedArray(value) === \"Int32Array\";\n }\n exports.isInt32Array = isInt32Array;\n function isFloat32Array(value) {\n return whichTypedArray(value) === \"Float32Array\";\n }\n exports.isFloat32Array = isFloat32Array;\n function isFloat64Array(value) {\n return whichTypedArray(value) === \"Float64Array\";\n }\n exports.isFloat64Array = isFloat64Array;\n function isBigInt64Array(value) {\n return whichTypedArray(value) === \"BigInt64Array\";\n }\n exports.isBigInt64Array = isBigInt64Array;\n function isBigUint64Array(value) {\n return whichTypedArray(value) === \"BigUint64Array\";\n }\n exports.isBigUint64Array = isBigUint64Array;\n function isMapToString(value) {\n return ObjectToString(value) === \"[object Map]\";\n }\n isMapToString.working = typeof Map !== \"undefined\" && isMapToString(/* @__PURE__ */ new Map());\n function isMap(value) {\n if (typeof Map === \"undefined\") {\n return false;\n }\n return isMapToString.working ? isMapToString(value) : value instanceof Map;\n }\n exports.isMap = isMap;\n function isSetToString(value) {\n return ObjectToString(value) === \"[object Set]\";\n }\n isSetToString.working = typeof Set !== \"undefined\" && isSetToString(/* @__PURE__ */ new Set());\n function isSet(value) {\n if (typeof Set === \"undefined\") {\n return false;\n }\n return isSetToString.working ? isSetToString(value) : value instanceof Set;\n }\n exports.isSet = isSet;\n function isWeakMapToString(value) {\n return ObjectToString(value) === \"[object WeakMap]\";\n }\n isWeakMapToString.working = typeof WeakMap !== \"undefined\" && isWeakMapToString(/* @__PURE__ */ new WeakMap());\n function isWeakMap(value) {\n if (typeof WeakMap === \"undefined\") {\n return false;\n }\n return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap;\n }\n exports.isWeakMap = isWeakMap;\n function isWeakSetToString(value) {\n return ObjectToString(value) === \"[object WeakSet]\";\n }\n isWeakSetToString.working = typeof WeakSet !== \"undefined\" && isWeakSetToString(/* @__PURE__ */ new WeakSet());\n function isWeakSet(value) {\n return isWeakSetToString(value);\n }\n exports.isWeakSet = isWeakSet;\n function isArrayBufferToString(value) {\n return ObjectToString(value) === \"[object ArrayBuffer]\";\n }\n isArrayBufferToString.working = typeof ArrayBuffer !== \"undefined\" && isArrayBufferToString(new ArrayBuffer());\n function isArrayBuffer(value) {\n if (typeof ArrayBuffer === \"undefined\") {\n return false;\n }\n return isArrayBufferToString.working ? isArrayBufferToString(value) : value instanceof ArrayBuffer;\n }\n exports.isArrayBuffer = isArrayBuffer;\n function isDataViewToString(value) {\n return ObjectToString(value) === \"[object DataView]\";\n }\n isDataViewToString.working = typeof ArrayBuffer !== \"undefined\" && typeof DataView !== \"undefined\" && isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1));\n function isDataView(value) {\n if (typeof DataView === \"undefined\") {\n return false;\n }\n return isDataViewToString.working ? isDataViewToString(value) : value instanceof DataView;\n }\n exports.isDataView = isDataView;\n var SharedArrayBufferCopy = typeof SharedArrayBuffer !== \"undefined\" ? SharedArrayBuffer : void 0;\n function isSharedArrayBufferToString(value) {\n return ObjectToString(value) === \"[object SharedArrayBuffer]\";\n }\n function isSharedArrayBuffer(value) {\n if (typeof SharedArrayBufferCopy === \"undefined\") {\n return false;\n }\n if (typeof isSharedArrayBufferToString.working === \"undefined\") {\n isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());\n }\n return isSharedArrayBufferToString.working ? isSharedArrayBufferToString(value) : value instanceof SharedArrayBufferCopy;\n }\n exports.isSharedArrayBuffer = isSharedArrayBuffer;\n function isAsyncFunction(value) {\n return ObjectToString(value) === \"[object AsyncFunction]\";\n }\n exports.isAsyncFunction = isAsyncFunction;\n function isMapIterator(value) {\n return ObjectToString(value) === \"[object Map Iterator]\";\n }\n exports.isMapIterator = isMapIterator;\n function isSetIterator(value) {\n return ObjectToString(value) === \"[object Set Iterator]\";\n }\n exports.isSetIterator = isSetIterator;\n function isGeneratorObject(value) {\n return ObjectToString(value) === \"[object Generator]\";\n }\n exports.isGeneratorObject = isGeneratorObject;\n function isWebAssemblyCompiledModule(value) {\n return ObjectToString(value) === \"[object WebAssembly.Module]\";\n }\n exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;\n function isNumberObject(value) {\n return checkBoxedPrimitive(value, numberValue);\n }\n exports.isNumberObject = isNumberObject;\n function isStringObject(value) {\n return checkBoxedPrimitive(value, stringValue);\n }\n exports.isStringObject = isStringObject;\n function isBooleanObject(value) {\n return checkBoxedPrimitive(value, booleanValue);\n }\n exports.isBooleanObject = isBooleanObject;\n function isBigIntObject(value) {\n return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);\n }\n exports.isBigIntObject = isBigIntObject;\n function isSymbolObject(value) {\n return SymbolSupported && checkBoxedPrimitive(value, symbolValue);\n }\n exports.isSymbolObject = isSymbolObject;\n function isBoxedPrimitive(value) {\n return isNumberObject(value) || isStringObject(value) || isBooleanObject(value) || isBigIntObject(value) || isSymbolObject(value);\n }\n exports.isBoxedPrimitive = isBoxedPrimitive;\n function isAnyArrayBuffer(value) {\n return typeof Uint8Array !== \"undefined\" && (isArrayBuffer(value) || isSharedArrayBuffer(value));\n }\n exports.isAnyArrayBuffer = isAnyArrayBuffer;\n [\"isProxy\", \"isExternal\", \"isModuleNamespaceObject\"].forEach(function(method) {\n Object.defineProperty(exports, method, {\n enumerable: false,\n value: function() {\n throw new Error(method + \" is not supported in userland\");\n }\n });\n });\n }\n });\n\n // node_modules/util/support/isBufferBrowser.js\n var require_isBufferBrowser = __commonJS({\n \"node_modules/util/support/isBufferBrowser.js\"(exports, module) {\n module.exports = function isBuffer(arg) {\n return arg && typeof arg === \"object\" && typeof arg.copy === \"function\" && typeof arg.fill === \"function\" && typeof arg.readUInt8 === \"function\";\n };\n }\n });\n\n // (disabled):node_modules/util/util.js\n var require_util = __commonJS({\n \"(disabled):node_modules/util/util.js\"(exports) {\n var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors2(obj) {\n var keys = Object.keys(obj);\n var descriptors = {};\n for (var i = 0; i < keys.length; i++) {\n descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);\n }\n return descriptors;\n };\n var formatRegExp = /%[sdj%]/g;\n exports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(\" \");\n }\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x2) {\n if (x2 === \"%%\") return \"%\";\n if (i >= len) return x2;\n switch (x2) {\n case \"%s\":\n return String(args[i++]);\n case \"%d\":\n return Number(args[i++]);\n case \"%j\":\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return \"[Circular]\";\n }\n default:\n return x2;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += \" \" + x;\n } else {\n str += \" \" + inspect(x);\n }\n }\n return str;\n };\n exports.deprecate = function(fn, msg) {\n if (typeof process !== \"undefined\" && process.noDeprecation === true) {\n return fn;\n }\n if (typeof process === \"undefined\") {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n return deprecated;\n };\n var debugs = {};\n var debugEnvRegex = /^$/;\n if (\"false\") {\n debugEnv = \"false\";\n debugEnv = debugEnv.replace(/[|\\\\{}()[\\]^$+?.]/g, \"\\\\$&\").replace(/\\*/g, \".*\").replace(/,/g, \"$|^\").toUpperCase();\n debugEnvRegex = new RegExp(\"^\" + debugEnv + \"$\", \"i\");\n }\n var debugEnv;\n exports.debuglog = function(set) {\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (debugEnvRegex.test(set)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error(\"%s %d: %s\", set, pid, msg);\n };\n } else {\n debugs[set] = function() {\n };\n }\n }\n return debugs[set];\n };\n function inspect(obj, opts) {\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n ctx.showHidden = opts;\n } else if (opts) {\n exports._extend(ctx, opts);\n }\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n }\n exports.inspect = inspect;\n inspect.colors = {\n \"bold\": [1, 22],\n \"italic\": [3, 23],\n \"underline\": [4, 24],\n \"inverse\": [7, 27],\n \"white\": [37, 39],\n \"grey\": [90, 39],\n \"black\": [30, 39],\n \"blue\": [34, 39],\n \"cyan\": [36, 39],\n \"green\": [32, 39],\n \"magenta\": [35, 39],\n \"red\": [31, 39],\n \"yellow\": [33, 39]\n };\n inspect.styles = {\n \"special\": \"cyan\",\n \"number\": \"yellow\",\n \"boolean\": \"yellow\",\n \"undefined\": \"grey\",\n \"null\": \"bold\",\n \"string\": \"green\",\n \"date\": \"magenta\",\n // \"name\": intentionally not styling\n \"regexp\": \"red\"\n };\n function stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n if (style) {\n return \"\\x1B[\" + inspect.colors[style][0] + \"m\" + str + \"\\x1B[\" + inspect.colors[style][1] + \"m\";\n } else {\n return str;\n }\n }\n function stylizeNoColor(str, styleType) {\n return str;\n }\n function arrayToHash(array) {\n var hash = {};\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n return hash;\n }\n function formatValue(ctx, value, recurseTimes) {\n if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect && // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n if (isError(value) && (keys.indexOf(\"message\") >= 0 || keys.indexOf(\"description\") >= 0)) {\n return formatError(value);\n }\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name2 = value.name ? \": \" + value.name : \"\";\n return ctx.stylize(\"[Function\" + name2 + \"]\", \"special\");\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), \"regexp\");\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), \"date\");\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n var base = \"\", array = false, braces = [\"{\", \"}\"];\n if (isArray(value)) {\n array = true;\n braces = [\"[\", \"]\"];\n }\n if (isFunction(value)) {\n var n = value.name ? \": \" + value.name : \"\";\n base = \" [Function\" + n + \"]\";\n }\n if (isRegExp(value)) {\n base = \" \" + RegExp.prototype.toString.call(value);\n }\n if (isDate(value)) {\n base = \" \" + Date.prototype.toUTCString.call(value);\n }\n if (isError(value)) {\n base = \" \" + formatError(value);\n }\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), \"regexp\");\n } else {\n return ctx.stylize(\"[Object]\", \"special\");\n }\n }\n ctx.seen.push(value);\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n ctx.seen.pop();\n return reduceToSingleString(output, base, braces);\n }\n function formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize(\"undefined\", \"undefined\");\n if (isString(value)) {\n var simple = \"'\" + JSON.stringify(value).replace(/^\"|\"$/g, \"\").replace(/'/g, \"\\\\'\").replace(/\\\\\"/g, '\"') + \"'\";\n return ctx.stylize(simple, \"string\");\n }\n if (isNumber(value))\n return ctx.stylize(\"\" + value, \"number\");\n if (isBoolean(value))\n return ctx.stylize(\"\" + value, \"boolean\");\n if (isNull(value))\n return ctx.stylize(\"null\", \"null\");\n }\n function formatError(value) {\n return \"[\" + Error.prototype.toString.call(value) + \"]\";\n }\n function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty2(value, String(i))) {\n output.push(formatProperty(\n ctx,\n value,\n recurseTimes,\n visibleKeys,\n String(i),\n true\n ));\n } else {\n output.push(\"\");\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(\n ctx,\n value,\n recurseTimes,\n visibleKeys,\n key,\n true\n ));\n }\n });\n return output;\n }\n function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name2, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize(\"[Getter/Setter]\", \"special\");\n } else {\n str = ctx.stylize(\"[Getter]\", \"special\");\n }\n } else {\n if (desc.set) {\n str = ctx.stylize(\"[Setter]\", \"special\");\n }\n }\n if (!hasOwnProperty2(visibleKeys, key)) {\n name2 = \"[\" + key + \"]\";\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf(\"\\n\") > -1) {\n if (array) {\n str = str.split(\"\\n\").map(function(line) {\n return \" \" + line;\n }).join(\"\\n\").slice(2);\n } else {\n str = \"\\n\" + str.split(\"\\n\").map(function(line) {\n return \" \" + line;\n }).join(\"\\n\");\n }\n }\n } else {\n str = ctx.stylize(\"[Circular]\", \"special\");\n }\n }\n if (isUndefined(name2)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name2 = JSON.stringify(\"\" + key);\n if (name2.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name2 = name2.slice(1, -1);\n name2 = ctx.stylize(name2, \"name\");\n } else {\n name2 = name2.replace(/'/g, \"\\\\'\").replace(/\\\\\"/g, '\"').replace(/(^\"|\"$)/g, \"'\");\n name2 = ctx.stylize(name2, \"string\");\n }\n }\n return name2 + \": \" + str;\n }\n function reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf(\"\\n\") >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, \"\").length + 1;\n }, 0);\n if (length > 60) {\n return braces[0] + (base === \"\" ? \"\" : base + \"\\n \") + \" \" + output.join(\",\\n \") + \" \" + braces[1];\n }\n return braces[0] + base + \" \" + output.join(\", \") + \" \" + braces[1];\n }\n exports.types = require_types();\n function isArray(ar) {\n return Array.isArray(ar);\n }\n exports.isArray = isArray;\n function isBoolean(arg) {\n return typeof arg === \"boolean\";\n }\n exports.isBoolean = isBoolean;\n function isNull(arg) {\n return arg === null;\n }\n exports.isNull = isNull;\n function isNullOrUndefined(arg) {\n return arg == null;\n }\n exports.isNullOrUndefined = isNullOrUndefined;\n function isNumber(arg) {\n return typeof arg === \"number\";\n }\n exports.isNumber = isNumber;\n function isString(arg) {\n return typeof arg === \"string\";\n }\n exports.isString = isString;\n function isSymbol(arg) {\n return typeof arg === \"symbol\";\n }\n exports.isSymbol = isSymbol;\n function isUndefined(arg) {\n return arg === void 0;\n }\n exports.isUndefined = isUndefined;\n function isRegExp(re) {\n return isObject(re) && objectToString(re) === \"[object RegExp]\";\n }\n exports.isRegExp = isRegExp;\n exports.types.isRegExp = isRegExp;\n function isObject(arg) {\n return typeof arg === \"object\" && arg !== null;\n }\n exports.isObject = isObject;\n function isDate(d) {\n return isObject(d) && objectToString(d) === \"[object Date]\";\n }\n exports.isDate = isDate;\n exports.types.isDate = isDate;\n function isError(e) {\n return isObject(e) && (objectToString(e) === \"[object Error]\" || e instanceof Error);\n }\n exports.isError = isError;\n exports.types.isNativeError = isError;\n function isFunction(arg) {\n return typeof arg === \"function\";\n }\n exports.isFunction = isFunction;\n function isPrimitive(arg) {\n return arg === null || typeof arg === \"boolean\" || typeof arg === \"number\" || typeof arg === \"string\" || typeof arg === \"symbol\" || // ES6 symbol\n typeof arg === \"undefined\";\n }\n exports.isPrimitive = isPrimitive;\n exports.isBuffer = require_isBufferBrowser();\n function objectToString(o) {\n return Object.prototype.toString.call(o);\n }\n function pad(n) {\n return n < 10 ? \"0\" + n.toString(10) : n.toString(10);\n }\n var months = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\"\n ];\n function timestamp() {\n var d = /* @__PURE__ */ new Date();\n var time = [\n pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())\n ].join(\":\");\n return [d.getDate(), months[d.getMonth()], time].join(\" \");\n }\n exports.log = function() {\n console.log(\"%s - %s\", timestamp(), exports.format.apply(exports, arguments));\n };\n exports.inherits = require_inherits_browser();\n exports._extend = function(origin, add) {\n if (!add || !isObject(add)) return origin;\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n };\n function hasOwnProperty2(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n }\n var kCustomPromisifiedSymbol = typeof Symbol !== \"undefined\" ? Symbol(\"util.promisify.custom\") : void 0;\n exports.promisify = function promisify(original) {\n if (typeof original !== \"function\")\n throw new TypeError('The \"original\" argument must be of type Function');\n if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n if (typeof fn !== \"function\") {\n throw new TypeError('The \"util.promisify.custom\" argument must be of type Function');\n }\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn,\n enumerable: false,\n writable: false,\n configurable: true\n });\n return fn;\n }\n function fn() {\n var promiseResolve, promiseReject;\n var promise = new Promise(function(resolve, reject) {\n promiseResolve = resolve;\n promiseReject = reject;\n });\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n args.push(function(err, value) {\n if (err) {\n promiseReject(err);\n } else {\n promiseResolve(value);\n }\n });\n try {\n original.apply(this, args);\n } catch (err) {\n promiseReject(err);\n }\n return promise;\n }\n Object.setPrototypeOf(fn, Object.getPrototypeOf(original));\n if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn,\n enumerable: false,\n writable: false,\n configurable: true\n });\n return Object.defineProperties(\n fn,\n getOwnPropertyDescriptors(original)\n );\n };\n exports.promisify.custom = kCustomPromisifiedSymbol;\n function callbackifyOnRejected(reason, cb) {\n if (!reason) {\n var newReason = new Error(\"Promise was rejected with a falsy value\");\n newReason.reason = reason;\n reason = newReason;\n }\n return cb(reason);\n }\n function callbackify(original) {\n if (typeof original !== \"function\") {\n throw new TypeError('The \"original\" argument must be of type Function');\n }\n function callbackified() {\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n var maybeCb = args.pop();\n if (typeof maybeCb !== \"function\") {\n throw new TypeError(\"The last argument must be of type Function\");\n }\n var self2 = this;\n var cb = function() {\n return maybeCb.apply(self2, arguments);\n };\n original.apply(this, args).then(\n function(ret) {\n process.nextTick(cb.bind(null, null, ret));\n },\n function(rej) {\n process.nextTick(callbackifyOnRejected.bind(null, rej, cb));\n }\n );\n }\n Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));\n Object.defineProperties(\n callbackified,\n getOwnPropertyDescriptors(original)\n );\n return callbackified;\n }\n exports.callbackify = callbackify;\n }\n });\n\n // node_modules/stream-browserify/node_modules/readable-stream/lib/internal/streams/buffer_list.js\n var require_buffer_list = __commonJS({\n \"node_modules/stream-browserify/node_modules/readable-stream/lib/internal/streams/buffer_list.js\"(exports, module) {\n \"use strict\";\n function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function(sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n return keys;\n }\n function _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function(key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function(key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n return target;\n }\n function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });\n } else {\n obj[key] = value;\n }\n return obj;\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n }\n var _require = require_buffer();\n var Buffer2 = _require.Buffer;\n var _require2 = require_util();\n var inspect = _require2.inspect;\n var custom = inspect && inspect.custom || \"inspect\";\n function copyBuffer(src, target, offset) {\n Buffer2.prototype.copy.call(src, target, offset);\n }\n module.exports = /* @__PURE__ */ function() {\n function BufferList() {\n _classCallCheck(this, BufferList);\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n _createClass(BufferList, [{\n key: \"push\",\n value: function push(v) {\n var entry = {\n data: v,\n next: null\n };\n if (this.length > 0) this.tail.next = entry;\n else this.head = entry;\n this.tail = entry;\n ++this.length;\n }\n }, {\n key: \"unshift\",\n value: function unshift(v) {\n var entry = {\n data: v,\n next: this.head\n };\n if (this.length === 0) this.tail = entry;\n this.head = entry;\n ++this.length;\n }\n }, {\n key: \"shift\",\n value: function shift() {\n if (this.length === 0) return;\n var ret = this.head.data;\n if (this.length === 1) this.head = this.tail = null;\n else this.head = this.head.next;\n --this.length;\n return ret;\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.head = this.tail = null;\n this.length = 0;\n }\n }, {\n key: \"join\",\n value: function join(s) {\n if (this.length === 0) return \"\";\n var p = this.head;\n var ret = \"\" + p.data;\n while (p = p.next) {\n ret += s + p.data;\n }\n return ret;\n }\n }, {\n key: \"concat\",\n value: function concat(n) {\n if (this.length === 0) return Buffer2.alloc(0);\n var ret = Buffer2.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n return ret;\n }\n // Consumes a specified amount of bytes or characters from the buffered data.\n }, {\n key: \"consume\",\n value: function consume(n, hasStrings) {\n var ret;\n if (n < this.head.data.length) {\n ret = this.head.data.slice(0, n);\n this.head.data = this.head.data.slice(n);\n } else if (n === this.head.data.length) {\n ret = this.shift();\n } else {\n ret = hasStrings ? this._getString(n) : this._getBuffer(n);\n }\n return ret;\n }\n }, {\n key: \"first\",\n value: function first() {\n return this.head.data;\n }\n // Consumes a specified amount of characters from the buffered data.\n }, {\n key: \"_getString\",\n value: function _getString(n) {\n var p = this.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;\n else ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) this.head = p.next;\n else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n // Consumes a specified amount of bytes from the buffered data.\n }, {\n key: \"_getBuffer\",\n value: function _getBuffer(n) {\n var ret = Buffer2.allocUnsafe(n);\n var p = this.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) this.head = p.next;\n else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n // Make sure the linked list only shows the minimal necessary information.\n }, {\n key: custom,\n value: function value(_, options) {\n return inspect(this, _objectSpread({}, options, {\n // Only inspect one level.\n depth: 0,\n // It should not recurse.\n customInspect: false\n }));\n }\n }]);\n return BufferList;\n }();\n }\n });\n\n // node_modules/stream-browserify/node_modules/readable-stream/lib/internal/streams/destroy.js\n var require_destroy = __commonJS({\n \"node_modules/stream-browserify/node_modules/readable-stream/lib/internal/streams/destroy.js\"(exports, module) {\n \"use strict\";\n function destroy(err, cb) {\n var _this = this;\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n process.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n process.nextTick(emitErrorNT, this, err);\n }\n }\n return this;\n }\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n this._destroy(err || null, function(err2) {\n if (!cb && err2) {\n if (!_this._writableState) {\n process.nextTick(emitErrorAndCloseNT, _this, err2);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n process.nextTick(emitErrorAndCloseNT, _this, err2);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, _this);\n cb(err2);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n });\n return this;\n }\n function emitErrorAndCloseNT(self2, err) {\n emitErrorNT(self2, err);\n emitCloseNT(self2);\n }\n function emitCloseNT(self2) {\n if (self2._writableState && !self2._writableState.emitClose) return;\n if (self2._readableState && !self2._readableState.emitClose) return;\n self2.emit(\"close\");\n }\n function undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n }\n function emitErrorNT(self2, err) {\n self2.emit(\"error\", err);\n }\n function errorOrDestroy(stream, err) {\n var rState = stream._readableState;\n var wState = stream._writableState;\n if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);\n else stream.emit(\"error\", err);\n }\n module.exports = {\n destroy,\n undestroy,\n errorOrDestroy\n };\n }\n });\n\n // node_modules/stream-browserify/node_modules/readable-stream/errors-browser.js\n var require_errors_browser = __commonJS({\n \"node_modules/stream-browserify/node_modules/readable-stream/errors-browser.js\"(exports, module) {\n \"use strict\";\n function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n }\n var codes = {};\n function createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === \"string\") {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n var NodeError = /* @__PURE__ */ function(_Base) {\n _inheritsLoose(NodeError2, _Base);\n function NodeError2(arg1, arg2, arg3) {\n return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;\n }\n return NodeError2;\n }(Base);\n NodeError.prototype.name = Base.name;\n NodeError.prototype.code = code;\n codes[code] = NodeError;\n }\n function oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function(i) {\n return String(i);\n });\n if (len > 2) {\n return \"one of \".concat(thing, \" \").concat(expected.slice(0, len - 1).join(\", \"), \", or \") + expected[len - 1];\n } else if (len === 2) {\n return \"one of \".concat(thing, \" \").concat(expected[0], \" or \").concat(expected[1]);\n } else {\n return \"of \".concat(thing, \" \").concat(expected[0]);\n }\n } else {\n return \"of \".concat(thing, \" \").concat(String(expected));\n }\n }\n function startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n }\n function endsWith(str, search, this_len) {\n if (this_len === void 0 || this_len > str.length) {\n this_len = str.length;\n }\n return str.substring(this_len - search.length, this_len) === search;\n }\n function includes(str, search, start) {\n if (typeof start !== \"number\") {\n start = 0;\n }\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n }\n createErrorType(\"ERR_INVALID_OPT_VALUE\", function(name2, value) {\n return 'The value \"' + value + '\" is invalid for option \"' + name2 + '\"';\n }, TypeError);\n createErrorType(\"ERR_INVALID_ARG_TYPE\", function(name2, expected, actual) {\n var determiner;\n if (typeof expected === \"string\" && startsWith(expected, \"not \")) {\n determiner = \"must not be\";\n expected = expected.replace(/^not /, \"\");\n } else {\n determiner = \"must be\";\n }\n var msg;\n if (endsWith(name2, \" argument\")) {\n msg = \"The \".concat(name2, \" \").concat(determiner, \" \").concat(oneOf(expected, \"type\"));\n } else {\n var type = includes(name2, \".\") ? \"property\" : \"argument\";\n msg = 'The \"'.concat(name2, '\" ').concat(type, \" \").concat(determiner, \" \").concat(oneOf(expected, \"type\"));\n }\n msg += \". Received type \".concat(typeof actual);\n return msg;\n }, TypeError);\n createErrorType(\"ERR_STREAM_PUSH_AFTER_EOF\", \"stream.push() after EOF\");\n createErrorType(\"ERR_METHOD_NOT_IMPLEMENTED\", function(name2) {\n return \"The \" + name2 + \" method is not implemented\";\n });\n createErrorType(\"ERR_STREAM_PREMATURE_CLOSE\", \"Premature close\");\n createErrorType(\"ERR_STREAM_DESTROYED\", function(name2) {\n return \"Cannot call \" + name2 + \" after a stream was destroyed\";\n });\n createErrorType(\"ERR_MULTIPLE_CALLBACK\", \"Callback called multiple times\");\n createErrorType(\"ERR_STREAM_CANNOT_PIPE\", \"Cannot pipe, not readable\");\n createErrorType(\"ERR_STREAM_WRITE_AFTER_END\", \"write after end\");\n createErrorType(\"ERR_STREAM_NULL_VALUES\", \"May not write null values to stream\", TypeError);\n createErrorType(\"ERR_UNKNOWN_ENCODING\", function(arg) {\n return \"Unknown encoding: \" + arg;\n }, TypeError);\n createErrorType(\"ERR_STREAM_UNSHIFT_AFTER_END_EVENT\", \"stream.unshift() after end event\");\n module.exports.codes = codes;\n }\n });\n\n // node_modules/stream-browserify/node_modules/readable-stream/lib/internal/streams/state.js\n var require_state = __commonJS({\n \"node_modules/stream-browserify/node_modules/readable-stream/lib/internal/streams/state.js\"(exports, module) {\n \"use strict\";\n var ERR_INVALID_OPT_VALUE = require_errors_browser().codes.ERR_INVALID_OPT_VALUE;\n function highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n }\n function getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name2 = isDuplex ? duplexKey : \"highWaterMark\";\n throw new ERR_INVALID_OPT_VALUE(name2, hwm);\n }\n return Math.floor(hwm);\n }\n return state.objectMode ? 16 : 16 * 1024;\n }\n module.exports = {\n getHighWaterMark\n };\n }\n });\n\n // node_modules/util-deprecate/browser.js\n var require_browser = __commonJS({\n \"node_modules/util-deprecate/browser.js\"(exports, module) {\n module.exports = deprecate;\n function deprecate(fn, msg) {\n if (config(\"noDeprecation\")) {\n return fn;\n }\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config(\"throwDeprecation\")) {\n throw new Error(msg);\n } else if (config(\"traceDeprecation\")) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n return deprecated;\n }\n function config(name2) {\n try {\n if (!window.localStorage) return false;\n } catch (_) {\n return false;\n }\n var val = window.localStorage[name2];\n if (null == val) return false;\n return String(val).toLowerCase() === \"true\";\n }\n }\n });\n\n // node_modules/stream-browserify/node_modules/readable-stream/lib/_stream_writable.js\n var require_stream_writable = __commonJS({\n \"node_modules/stream-browserify/node_modules/readable-stream/lib/_stream_writable.js\"(exports, module) {\n \"use strict\";\n module.exports = Writable;\n function CorkedRequest(state) {\n var _this = this;\n this.next = null;\n this.entry = null;\n this.finish = function() {\n onCorkedFinish(_this, state);\n };\n }\n var Duplex;\n Writable.WritableState = WritableState;\n var internalUtil = {\n deprecate: require_browser()\n };\n var Stream = require_stream_browser();\n var Buffer2 = require_buffer().Buffer;\n var OurUint8Array = window.Uint8Array || function() {\n };\n function _uint8ArrayToBuffer(chunk) {\n return Buffer2.from(chunk);\n }\n function _isUint8Array(obj) {\n return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;\n }\n var destroyImpl = require_destroy();\n var _require = require_state();\n var getHighWaterMark = _require.getHighWaterMark;\n var _require$codes = require_errors_browser().codes;\n var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;\n var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;\n var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;\n var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE;\n var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\n var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES;\n var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END;\n var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\n var errorOrDestroy = destroyImpl.errorOrDestroy;\n require_inherits_browser()(Writable, Stream);\n function nop() {\n }\n function WritableState(options, stream, isDuplex) {\n Duplex = Duplex || require_stream_duplex();\n options = options || {};\n if (typeof isDuplex !== \"boolean\") isDuplex = stream instanceof Duplex;\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;\n this.highWaterMark = getHighWaterMark(this, options, \"writableHighWaterMark\", isDuplex);\n this.finalCalled = false;\n this.needDrain = false;\n this.ending = false;\n this.ended = false;\n this.finished = false;\n this.destroyed = false;\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n this.defaultEncoding = options.defaultEncoding || \"utf8\";\n this.length = 0;\n this.writing = false;\n this.corked = 0;\n this.sync = true;\n this.bufferProcessing = false;\n this.onwrite = function(er) {\n onwrite(stream, er);\n };\n this.writecb = null;\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n this.pendingcb = 0;\n this.prefinished = false;\n this.errorEmitted = false;\n this.emitClose = options.emitClose !== false;\n this.autoDestroy = !!options.autoDestroy;\n this.bufferedRequestCount = 0;\n this.corkedRequestsFree = new CorkedRequest(this);\n }\n WritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n };\n (function() {\n try {\n Object.defineProperty(WritableState.prototype, \"buffer\", {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, \"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.\", \"DEP0003\")\n });\n } catch (_) {\n }\n })();\n var realHasInstance;\n if (typeof Symbol === \"function\" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === \"function\") {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n } else {\n realHasInstance = function realHasInstance2(object) {\n return object instanceof this;\n };\n }\n function Writable(options) {\n Duplex = Duplex || require_stream_duplex();\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex);\n this.writable = true;\n if (options) {\n if (typeof options.write === \"function\") this._write = options.write;\n if (typeof options.writev === \"function\") this._writev = options.writev;\n if (typeof options.destroy === \"function\") this._destroy = options.destroy;\n if (typeof options.final === \"function\") this._final = options.final;\n }\n Stream.call(this);\n }\n Writable.prototype.pipe = function() {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n };\n function writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END();\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n }\n function validChunk(stream, state, chunk, cb) {\n var er;\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== \"string\" && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE(\"chunk\", [\"string\", \"Buffer\"], chunk);\n }\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n return true;\n }\n Writable.prototype.write = function(chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n if (isBuf && !Buffer2.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (typeof encoding === \"function\") {\n cb = encoding;\n encoding = null;\n }\n if (isBuf) encoding = \"buffer\";\n else if (!encoding) encoding = state.defaultEncoding;\n if (typeof cb !== \"function\") cb = nop;\n if (state.ending) writeAfterEnd(this, cb);\n else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n };\n Writable.prototype.cork = function() {\n this._writableState.corked++;\n };\n Writable.prototype.uncork = function() {\n var state = this._writableState;\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n };\n Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n if (typeof encoding === \"string\") encoding = encoding.toLowerCase();\n if (!([\"hex\", \"utf8\", \"utf-8\", \"ascii\", \"binary\", \"base64\", \"ucs2\", \"ucs-2\", \"utf16le\", \"utf-16le\", \"raw\"].indexOf((encoding + \"\").toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n };\n Object.defineProperty(Writable.prototype, \"writableBuffer\", {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n });\n function decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === \"string\") {\n chunk = Buffer2.from(chunk, encoding);\n }\n return chunk;\n }\n Object.defineProperty(Writable.prototype, \"writableHighWaterMark\", {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n });\n function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = \"buffer\";\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark;\n if (!ret) state.needDrain = true;\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk,\n encoding,\n isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n return ret;\n }\n function doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED(\"write\"));\n else if (writev) stream._writev(chunk, state.onwrite);\n else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n }\n function onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n if (sync) {\n process.nextTick(cb, er);\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n finishMaybe(stream, state);\n }\n }\n function onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n }\n function onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== \"function\") throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er) onwriteError(stream, state, sync, er, cb);\n else {\n var finished = needFinish(state) || stream.destroyed;\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n }\n function afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n }\n function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit(\"drain\");\n }\n }\n function clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n if (stream._writev && entry && entry.next) {\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, \"\", holder.finish);\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n state.bufferedRequestCount = 0;\n } else {\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n if (state.writing) {\n break;\n }\n }\n if (entry === null) state.lastBufferedRequest = null;\n }\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n }\n Writable.prototype._write = function(chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED(\"_write()\"));\n };\n Writable.prototype._writev = null;\n Writable.prototype.end = function(chunk, encoding, cb) {\n var state = this._writableState;\n if (typeof chunk === \"function\") {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === \"function\") {\n cb = encoding;\n encoding = null;\n }\n if (chunk !== null && chunk !== void 0) this.write(chunk, encoding);\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n if (!state.ending) endWritable(this, state, cb);\n return this;\n };\n Object.defineProperty(Writable.prototype, \"writableLength\", {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n });\n function needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n }\n function callFinal(stream, state) {\n stream._final(function(err) {\n state.pendingcb--;\n if (err) {\n errorOrDestroy(stream, err);\n }\n state.prefinished = true;\n stream.emit(\"prefinish\");\n finishMaybe(stream, state);\n });\n }\n function prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === \"function\" && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit(\"prefinish\");\n }\n }\n }\n function finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit(\"finish\");\n if (state.autoDestroy) {\n var rState = stream._readableState;\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n return need;\n }\n function endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished) process.nextTick(cb);\n else stream.once(\"finish\", cb);\n }\n state.ended = true;\n stream.writable = false;\n }\n function onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n state.corkedRequestsFree.next = corkReq;\n }\n Object.defineProperty(Writable.prototype, \"destroyed\", {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._writableState === void 0) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set: function set(value) {\n if (!this._writableState) {\n return;\n }\n this._writableState.destroyed = value;\n }\n });\n Writable.prototype.destroy = destroyImpl.destroy;\n Writable.prototype._undestroy = destroyImpl.undestroy;\n Writable.prototype._destroy = function(err, cb) {\n cb(err);\n };\n }\n });\n\n // node_modules/stream-browserify/node_modules/readable-stream/lib/_stream_duplex.js\n var require_stream_duplex = __commonJS({\n \"node_modules/stream-browserify/node_modules/readable-stream/lib/_stream_duplex.js\"(exports, module) {\n \"use strict\";\n var objectKeys = Object.keys || function(obj) {\n var keys2 = [];\n for (var key in obj) {\n keys2.push(key);\n }\n return keys2;\n };\n module.exports = Duplex;\n var Readable = require_stream_readable();\n var Writable = require_stream_writable();\n require_inherits_browser()(Duplex, Readable);\n {\n keys = objectKeys(Writable.prototype);\n for (v = 0; v < keys.length; v++) {\n method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n }\n var keys;\n var method;\n var v;\n function Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n Readable.call(this, options);\n Writable.call(this, options);\n this.allowHalfOpen = true;\n if (options) {\n if (options.readable === false) this.readable = false;\n if (options.writable === false) this.writable = false;\n if (options.allowHalfOpen === false) {\n this.allowHalfOpen = false;\n this.once(\"end\", onend);\n }\n }\n }\n Object.defineProperty(Duplex.prototype, \"writableHighWaterMark\", {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n });\n Object.defineProperty(Duplex.prototype, \"writableBuffer\", {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n });\n Object.defineProperty(Duplex.prototype, \"writableLength\", {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n });\n function onend() {\n if (this._writableState.ended) return;\n process.nextTick(onEndNT, this);\n }\n function onEndNT(self2) {\n self2.end();\n }\n Object.defineProperty(Duplex.prototype, \"destroyed\", {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === void 0 || this._writableState === void 0) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function set(value) {\n if (this._readableState === void 0 || this._writableState === void 0) {\n return;\n }\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n });\n }\n });\n\n // node_modules/safe-buffer/index.js\n var require_safe_buffer = __commonJS({\n \"node_modules/safe-buffer/index.js\"(exports, module) {\n var buffer = require_buffer();\n var Buffer2 = buffer.Buffer;\n function copyProps(src, dst) {\n for (var key in src) {\n dst[key] = src[key];\n }\n }\n if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {\n module.exports = buffer;\n } else {\n copyProps(buffer, exports);\n exports.Buffer = SafeBuffer;\n }\n function SafeBuffer(arg, encodingOrOffset, length) {\n return Buffer2(arg, encodingOrOffset, length);\n }\n SafeBuffer.prototype = Object.create(Buffer2.prototype);\n copyProps(Buffer2, SafeBuffer);\n SafeBuffer.from = function(arg, encodingOrOffset, length) {\n if (typeof arg === \"number\") {\n throw new TypeError(\"Argument must not be a number\");\n }\n return Buffer2(arg, encodingOrOffset, length);\n };\n SafeBuffer.alloc = function(size, fill, encoding) {\n if (typeof size !== \"number\") {\n throw new TypeError(\"Argument must be a number\");\n }\n var buf = Buffer2(size);\n if (fill !== void 0) {\n if (typeof encoding === \"string\") {\n buf.fill(fill, encoding);\n } else {\n buf.fill(fill);\n }\n } else {\n buf.fill(0);\n }\n return buf;\n };\n SafeBuffer.allocUnsafe = function(size) {\n if (typeof size !== \"number\") {\n throw new TypeError(\"Argument must be a number\");\n }\n return Buffer2(size);\n };\n SafeBuffer.allocUnsafeSlow = function(size) {\n if (typeof size !== \"number\") {\n throw new TypeError(\"Argument must be a number\");\n }\n return buffer.SlowBuffer(size);\n };\n }\n });\n\n // node_modules/stream-browserify/node_modules/string_decoder/lib/string_decoder.js\n var require_string_decoder = __commonJS({\n \"node_modules/stream-browserify/node_modules/string_decoder/lib/string_decoder.js\"(exports) {\n \"use strict\";\n var Buffer2 = require_safe_buffer().Buffer;\n var isEncoding = Buffer2.isEncoding || function(encoding) {\n encoding = \"\" + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case \"hex\":\n case \"utf8\":\n case \"utf-8\":\n case \"ascii\":\n case \"binary\":\n case \"base64\":\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n case \"raw\":\n return true;\n default:\n return false;\n }\n };\n function _normalizeEncoding(enc) {\n if (!enc) return \"utf8\";\n var retried;\n while (true) {\n switch (enc) {\n case \"utf8\":\n case \"utf-8\":\n return \"utf8\";\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n return \"utf16le\";\n case \"latin1\":\n case \"binary\":\n return \"latin1\";\n case \"base64\":\n case \"ascii\":\n case \"hex\":\n return enc;\n default:\n if (retried) return;\n enc = (\"\" + enc).toLowerCase();\n retried = true;\n }\n }\n }\n function normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== \"string\" && (Buffer2.isEncoding === isEncoding || !isEncoding(enc))) throw new Error(\"Unknown encoding: \" + enc);\n return nenc || enc;\n }\n exports.StringDecoder = StringDecoder;\n function StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case \"utf16le\":\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case \"utf8\":\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case \"base64\":\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer2.allocUnsafe(nb);\n }\n StringDecoder.prototype.write = function(buf) {\n if (buf.length === 0) return \"\";\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf);\n if (r === void 0) return \"\";\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);\n return r || \"\";\n };\n StringDecoder.prototype.end = utf8End;\n StringDecoder.prototype.text = utf8Text;\n StringDecoder.prototype.fillLast = function(buf) {\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);\n this.lastNeed -= buf.length;\n };\n function utf8CheckByte(byte) {\n if (byte <= 127) return 0;\n else if (byte >> 5 === 6) return 2;\n else if (byte >> 4 === 14) return 3;\n else if (byte >> 3 === 30) return 4;\n return byte >> 6 === 2 ? -1 : -2;\n }\n function utf8CheckIncomplete(self2, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self2.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self2.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;\n else self2.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n }\n function utf8CheckExtraBytes(self2, buf, p) {\n if ((buf[0] & 192) !== 128) {\n self2.lastNeed = 0;\n return \"\\uFFFD\";\n }\n if (self2.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 192) !== 128) {\n self2.lastNeed = 1;\n return \"\\uFFFD\";\n }\n if (self2.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 192) !== 128) {\n self2.lastNeed = 2;\n return \"\\uFFFD\";\n }\n }\n }\n }\n function utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== void 0) return r;\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n }\n function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString(\"utf8\", i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString(\"utf8\", i, end);\n }\n function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : \"\";\n if (this.lastNeed) return r + \"\\uFFFD\";\n return r;\n }\n function utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString(\"utf16le\", i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 55296 && c <= 56319) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString(\"utf16le\", i, buf.length - 1);\n }\n function utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : \"\";\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString(\"utf16le\", 0, end);\n }\n return r;\n }\n function base64Text(buf, i) {\n var n = (buf.length - i) % 3;\n if (n === 0) return buf.toString(\"base64\", i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf[buf.length - 1];\n } else {\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n }\n return buf.toString(\"base64\", i, buf.length - n);\n }\n function base64End(buf) {\n var r = buf && buf.length ? this.write(buf) : \"\";\n if (this.lastNeed) return r + this.lastChar.toString(\"base64\", 0, 3 - this.lastNeed);\n return r;\n }\n function simpleWrite(buf) {\n return buf.toString(this.encoding);\n }\n function simpleEnd(buf) {\n return buf && buf.length ? this.write(buf) : \"\";\n }\n }\n });\n\n // node_modules/stream-browserify/node_modules/readable-stream/lib/internal/streams/end-of-stream.js\n var require_end_of_stream = __commonJS({\n \"node_modules/stream-browserify/node_modules/readable-stream/lib/internal/streams/end-of-stream.js\"(exports, module) {\n \"use strict\";\n var ERR_STREAM_PREMATURE_CLOSE = require_errors_browser().codes.ERR_STREAM_PREMATURE_CLOSE;\n function once(callback) {\n var called = false;\n return function() {\n if (called) return;\n called = true;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n callback.apply(this, args);\n };\n }\n function noop() {\n }\n function isRequest(stream) {\n return stream.setHeader && typeof stream.abort === \"function\";\n }\n function eos(stream, opts, callback) {\n if (typeof opts === \"function\") return eos(stream, null, opts);\n if (!opts) opts = {};\n callback = once(callback || noop);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable = opts.writable || opts.writable !== false && stream.writable;\n var onlegacyfinish = function onlegacyfinish2() {\n if (!stream.writable) onfinish();\n };\n var writableEnded = stream._writableState && stream._writableState.finished;\n var onfinish = function onfinish2() {\n writable = false;\n writableEnded = true;\n if (!readable) callback.call(stream);\n };\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n var onend = function onend2() {\n readable = false;\n readableEnded = true;\n if (!writable) callback.call(stream);\n };\n var onerror = function onerror2(err) {\n callback.call(stream, err);\n };\n var onclose = function onclose2() {\n var err;\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n if (writable && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n var onrequest = function onrequest2() {\n stream.req.on(\"finish\", onfinish);\n };\n if (isRequest(stream)) {\n stream.on(\"complete\", onfinish);\n stream.on(\"abort\", onclose);\n if (stream.req) onrequest();\n else stream.on(\"request\", onrequest);\n } else if (writable && !stream._writableState) {\n stream.on(\"end\", onlegacyfinish);\n stream.on(\"close\", onlegacyfinish);\n }\n stream.on(\"end\", onend);\n stream.on(\"finish\", onfinish);\n if (opts.error !== false) stream.on(\"error\", onerror);\n stream.on(\"close\", onclose);\n return function() {\n stream.removeListener(\"complete\", onfinish);\n stream.removeListener(\"abort\", onclose);\n stream.removeListener(\"request\", onrequest);\n if (stream.req) stream.req.removeListener(\"finish\", onfinish);\n stream.removeListener(\"end\", onlegacyfinish);\n stream.removeListener(\"close\", onlegacyfinish);\n stream.removeListener(\"finish\", onfinish);\n stream.removeListener(\"end\", onend);\n stream.removeListener(\"error\", onerror);\n stream.removeListener(\"close\", onclose);\n };\n }\n module.exports = eos;\n }\n });\n\n // node_modules/stream-browserify/node_modules/readable-stream/lib/internal/streams/async_iterator.js\n var require_async_iterator = __commonJS({\n \"node_modules/stream-browserify/node_modules/readable-stream/lib/internal/streams/async_iterator.js\"(exports, module) {\n \"use strict\";\n var _Object$setPrototypeO;\n function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });\n } else {\n obj[key] = value;\n }\n return obj;\n }\n var finished = require_end_of_stream();\n var kLastResolve = Symbol(\"lastResolve\");\n var kLastReject = Symbol(\"lastReject\");\n var kError = Symbol(\"error\");\n var kEnded = Symbol(\"ended\");\n var kLastPromise = Symbol(\"lastPromise\");\n var kHandlePromise = Symbol(\"handlePromise\");\n var kStream = Symbol(\"stream\");\n function createIterResult(value, done) {\n return {\n value,\n done\n };\n }\n function readAndResolve(iter) {\n var resolve = iter[kLastResolve];\n if (resolve !== null) {\n var data = iter[kStream].read();\n if (data !== null) {\n iter[kLastPromise] = null;\n iter[kLastResolve] = null;\n iter[kLastReject] = null;\n resolve(createIterResult(data, false));\n }\n }\n }\n function onReadable(iter) {\n process.nextTick(readAndResolve, iter);\n }\n function wrapForNext(lastPromise, iter) {\n return function(resolve, reject) {\n lastPromise.then(function() {\n if (iter[kEnded]) {\n resolve(createIterResult(void 0, true));\n return;\n }\n iter[kHandlePromise](resolve, reject);\n }, reject);\n };\n }\n var AsyncIteratorPrototype = Object.getPrototypeOf(function() {\n });\n var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {\n get stream() {\n return this[kStream];\n },\n next: function next() {\n var _this = this;\n var error = this[kError];\n if (error !== null) {\n return Promise.reject(error);\n }\n if (this[kEnded]) {\n return Promise.resolve(createIterResult(void 0, true));\n }\n if (this[kStream].destroyed) {\n return new Promise(function(resolve, reject) {\n process.nextTick(function() {\n if (_this[kError]) {\n reject(_this[kError]);\n } else {\n resolve(createIterResult(void 0, true));\n }\n });\n });\n }\n var lastPromise = this[kLastPromise];\n var promise;\n if (lastPromise) {\n promise = new Promise(wrapForNext(lastPromise, this));\n } else {\n var data = this[kStream].read();\n if (data !== null) {\n return Promise.resolve(createIterResult(data, false));\n }\n promise = new Promise(this[kHandlePromise]);\n }\n this[kLastPromise] = promise;\n return promise;\n }\n }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() {\n return this;\n }), _defineProperty(_Object$setPrototypeO, \"return\", function _return() {\n var _this2 = this;\n return new Promise(function(resolve, reject) {\n _this2[kStream].destroy(null, function(err) {\n if (err) {\n reject(err);\n return;\n }\n resolve(createIterResult(void 0, true));\n });\n });\n }), _Object$setPrototypeO), AsyncIteratorPrototype);\n var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) {\n var _Object$create;\n var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {\n value: stream,\n writable: true\n }), _defineProperty(_Object$create, kLastResolve, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kLastReject, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kError, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kEnded, {\n value: stream._readableState.endEmitted,\n writable: true\n }), _defineProperty(_Object$create, kHandlePromise, {\n value: function value(resolve, reject) {\n var data = iterator[kStream].read();\n if (data) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(data, false));\n } else {\n iterator[kLastResolve] = resolve;\n iterator[kLastReject] = reject;\n }\n },\n writable: true\n }), _Object$create));\n iterator[kLastPromise] = null;\n finished(stream, function(err) {\n if (err && err.code !== \"ERR_STREAM_PREMATURE_CLOSE\") {\n var reject = iterator[kLastReject];\n if (reject !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n reject(err);\n }\n iterator[kError] = err;\n return;\n }\n var resolve = iterator[kLastResolve];\n if (resolve !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(void 0, true));\n }\n iterator[kEnded] = true;\n });\n stream.on(\"readable\", onReadable.bind(null, iterator));\n return iterator;\n };\n module.exports = createReadableStreamAsyncIterator;\n }\n });\n\n // node_modules/stream-browserify/node_modules/readable-stream/lib/internal/streams/from-browser.js\n var require_from_browser = __commonJS({\n \"node_modules/stream-browserify/node_modules/readable-stream/lib/internal/streams/from-browser.js\"(exports, module) {\n module.exports = function() {\n throw new Error(\"Readable.from is not available in the browser\");\n };\n }\n });\n\n // node_modules/stream-browserify/node_modules/readable-stream/lib/_stream_readable.js\n var require_stream_readable = __commonJS({\n \"node_modules/stream-browserify/node_modules/readable-stream/lib/_stream_readable.js\"(exports, module) {\n \"use strict\";\n module.exports = Readable;\n var Duplex;\n Readable.ReadableState = ReadableState;\n var EE = require_events().EventEmitter;\n var EElistenerCount = function EElistenerCount2(emitter, type) {\n return emitter.listeners(type).length;\n };\n var Stream = require_stream_browser();\n var Buffer2 = require_buffer().Buffer;\n var OurUint8Array = window.Uint8Array || function() {\n };\n function _uint8ArrayToBuffer(chunk) {\n return Buffer2.from(chunk);\n }\n function _isUint8Array(obj) {\n return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;\n }\n var debugUtil = require_util();\n var debug;\n if (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog(\"stream\");\n } else {\n debug = function debug2() {\n };\n }\n var BufferList = require_buffer_list();\n var destroyImpl = require_destroy();\n var _require = require_state();\n var getHighWaterMark = _require.getHighWaterMark;\n var _require$codes = require_errors_browser().codes;\n var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;\n var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF;\n var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;\n var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;\n var StringDecoder;\n var createReadableStreamAsyncIterator;\n var from;\n require_inherits_browser()(Readable, Stream);\n var errorOrDestroy = destroyImpl.errorOrDestroy;\n var kProxyEvents = [\"error\", \"close\", \"destroy\", \"pause\", \"resume\"];\n function prependListener(emitter, event, fn) {\n if (typeof emitter.prependListener === \"function\") return emitter.prependListener(event, fn);\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);\n else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);\n else emitter._events[event] = [fn, emitter._events[event]];\n }\n function ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || require_stream_duplex();\n options = options || {};\n if (typeof isDuplex !== \"boolean\") isDuplex = stream instanceof Duplex;\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;\n this.highWaterMark = getHighWaterMark(this, options, \"readableHighWaterMark\", isDuplex);\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n this.sync = true;\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true;\n this.emitClose = options.emitClose !== false;\n this.autoDestroy = !!options.autoDestroy;\n this.destroyed = false;\n this.defaultEncoding = options.defaultEncoding || \"utf8\";\n this.awaitDrain = 0;\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require_string_decoder().StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n }\n function Readable(options) {\n Duplex = Duplex || require_stream_duplex();\n if (!(this instanceof Readable)) return new Readable(options);\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex);\n this.readable = true;\n if (options) {\n if (typeof options.read === \"function\") this._read = options.read;\n if (typeof options.destroy === \"function\") this._destroy = options.destroy;\n }\n Stream.call(this);\n }\n Object.defineProperty(Readable.prototype, \"destroyed\", {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === void 0) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set: function set(value) {\n if (!this._readableState) {\n return;\n }\n this._readableState.destroyed = value;\n }\n });\n Readable.prototype.destroy = destroyImpl.destroy;\n Readable.prototype._undestroy = destroyImpl.undestroy;\n Readable.prototype._destroy = function(err, cb) {\n cb(err);\n };\n Readable.prototype.push = function(chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n if (!state.objectMode) {\n if (typeof chunk === \"string\") {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer2.from(chunk, encoding);\n encoding = \"\";\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n };\n Readable.prototype.unshift = function(chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n };\n function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug(\"readableAddChunk\", chunk);\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== \"string\" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (addToFront) {\n if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());\n else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);\n else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n }\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n }\n function addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit(\"data\", chunk);\n } else {\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);\n else state.buffer.push(chunk);\n if (state.needReadable) emitReadable(stream);\n }\n maybeReadMore(stream, state);\n }\n function chunkInvalid(state, chunk) {\n var er;\n if (!_isUint8Array(chunk) && typeof chunk !== \"string\" && chunk !== void 0 && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE(\"chunk\", [\"string\", \"Buffer\", \"Uint8Array\"], chunk);\n }\n return er;\n }\n Readable.prototype.isPaused = function() {\n return this._readableState.flowing === false;\n };\n Readable.prototype.setEncoding = function(enc) {\n if (!StringDecoder) StringDecoder = require_string_decoder().StringDecoder;\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder;\n this._readableState.encoding = this._readableState.decoder.encoding;\n var p = this._readableState.buffer.head;\n var content = \"\";\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n this._readableState.buffer.clear();\n if (content !== \"\") this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n };\n var MAX_HWM = 1073741824;\n function computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n }\n function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n if (n !== n) {\n if (state.flowing && state.length) return state.buffer.head.data.length;\n else return state.length;\n }\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n;\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n }\n Readable.prototype.read = function(n) {\n debug(\"read\", n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0) state.emittedReadable = false;\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug(\"read: emitReadable\", state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);\n else emitReadable(this);\n return null;\n }\n n = howMuchToRead(n, state);\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n }\n var doRead = state.needReadable;\n debug(\"need readable\", doRead);\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug(\"length less than watermark\", doRead);\n }\n if (state.ended || state.reading) {\n doRead = false;\n debug(\"reading or ended\", doRead);\n } else if (doRead) {\n debug(\"do read\");\n state.reading = true;\n state.sync = true;\n if (state.length === 0) state.needReadable = true;\n this._read(state.highWaterMark);\n state.sync = false;\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n var ret;\n if (n > 0) ret = fromList(n, state);\n else ret = null;\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n if (state.length === 0) {\n if (!state.ended) state.needReadable = true;\n if (nOrig !== n && state.ended) endReadable(this);\n }\n if (ret !== null) this.emit(\"data\", ret);\n return ret;\n };\n function onEofChunk(stream, state) {\n debug(\"onEofChunk\");\n if (state.ended) return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n if (state.sync) {\n emitReadable(stream);\n } else {\n state.needReadable = false;\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n }\n function emitReadable(stream) {\n var state = stream._readableState;\n debug(\"emitReadable\", state.needReadable, state.emittedReadable);\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug(\"emitReadable\", state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n }\n function emitReadable_(stream) {\n var state = stream._readableState;\n debug(\"emitReadable_\", state.destroyed, state.length, state.ended);\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit(\"readable\");\n state.emittedReadable = false;\n }\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n }\n function maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n }\n function maybeReadMore_(stream, state) {\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug(\"maybeReadMore read 0\");\n stream.read(0);\n if (len === state.length)\n break;\n }\n state.readingMore = false;\n }\n Readable.prototype._read = function(n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED(\"_read()\"));\n };\n Readable.prototype.pipe = function(dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug(\"pipe count=%d opts=%j\", state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) process.nextTick(endFn);\n else src.once(\"end\", endFn);\n dest.on(\"unpipe\", onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug(\"onunpipe\");\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n function onend() {\n debug(\"onend\");\n dest.end();\n }\n var ondrain = pipeOnDrain(src);\n dest.on(\"drain\", ondrain);\n var cleanedUp = false;\n function cleanup() {\n debug(\"cleanup\");\n dest.removeListener(\"close\", onclose);\n dest.removeListener(\"finish\", onfinish);\n dest.removeListener(\"drain\", ondrain);\n dest.removeListener(\"error\", onerror);\n dest.removeListener(\"unpipe\", onunpipe);\n src.removeListener(\"end\", onend);\n src.removeListener(\"end\", unpipe);\n src.removeListener(\"data\", ondata);\n cleanedUp = true;\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n src.on(\"data\", ondata);\n function ondata(chunk) {\n debug(\"ondata\");\n var ret = dest.write(chunk);\n debug(\"dest.write\", ret);\n if (ret === false) {\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug(\"false write response, pause\", state.awaitDrain);\n state.awaitDrain++;\n }\n src.pause();\n }\n }\n function onerror(er) {\n debug(\"onerror\", er);\n unpipe();\n dest.removeListener(\"error\", onerror);\n if (EElistenerCount(dest, \"error\") === 0) errorOrDestroy(dest, er);\n }\n prependListener(dest, \"error\", onerror);\n function onclose() {\n dest.removeListener(\"finish\", onfinish);\n unpipe();\n }\n dest.once(\"close\", onclose);\n function onfinish() {\n debug(\"onfinish\");\n dest.removeListener(\"close\", onclose);\n unpipe();\n }\n dest.once(\"finish\", onfinish);\n function unpipe() {\n debug(\"unpipe\");\n src.unpipe(dest);\n }\n dest.emit(\"pipe\", src);\n if (!state.flowing) {\n debug(\"pipe resume\");\n src.resume();\n }\n return dest;\n };\n function pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug(\"pipeOnDrain\", state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, \"data\")) {\n state.flowing = true;\n flow(src);\n }\n };\n }\n Readable.prototype.unpipe = function(dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n };\n if (state.pipesCount === 0) return this;\n if (state.pipesCount === 1) {\n if (dest && dest !== state.pipes) return this;\n if (!dest) dest = state.pipes;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit(\"unpipe\", this, unpipeInfo);\n return this;\n }\n if (!dest) {\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n for (var i = 0; i < len; i++) {\n dests[i].emit(\"unpipe\", this, {\n hasUnpiped: false\n });\n }\n return this;\n }\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n dest.emit(\"unpipe\", this, unpipeInfo);\n return this;\n };\n Readable.prototype.on = function(ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n if (ev === \"data\") {\n state.readableListening = this.listenerCount(\"readable\") > 0;\n if (state.flowing !== false) this.resume();\n } else if (ev === \"readable\") {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug(\"on readable\", state.length, state.reading);\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n return res;\n };\n Readable.prototype.addListener = Readable.prototype.on;\n Readable.prototype.removeListener = function(ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n if (ev === \"readable\") {\n process.nextTick(updateReadableListening, this);\n }\n return res;\n };\n Readable.prototype.removeAllListeners = function(ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n if (ev === \"readable\" || ev === void 0) {\n process.nextTick(updateReadableListening, this);\n }\n return res;\n };\n function updateReadableListening(self2) {\n var state = self2._readableState;\n state.readableListening = self2.listenerCount(\"readable\") > 0;\n if (state.resumeScheduled && !state.paused) {\n state.flowing = true;\n } else if (self2.listenerCount(\"data\") > 0) {\n self2.resume();\n }\n }\n function nReadingNextTick(self2) {\n debug(\"readable nexttick read 0\");\n self2.read(0);\n }\n Readable.prototype.resume = function() {\n var state = this._readableState;\n if (!state.flowing) {\n debug(\"resume\");\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n state.paused = false;\n return this;\n };\n function resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n }\n function resume_(stream, state) {\n debug(\"resume\", state.reading);\n if (!state.reading) {\n stream.read(0);\n }\n state.resumeScheduled = false;\n stream.emit(\"resume\");\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n }\n Readable.prototype.pause = function() {\n debug(\"call pause flowing=%j\", this._readableState.flowing);\n if (this._readableState.flowing !== false) {\n debug(\"pause\");\n this._readableState.flowing = false;\n this.emit(\"pause\");\n }\n this._readableState.paused = true;\n return this;\n };\n function flow(stream) {\n var state = stream._readableState;\n debug(\"flow\", state.flowing);\n while (state.flowing && stream.read() !== null) {\n ;\n }\n }\n Readable.prototype.wrap = function(stream) {\n var _this = this;\n var state = this._readableState;\n var paused = false;\n stream.on(\"end\", function() {\n debug(\"wrapped end\");\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n _this.push(null);\n });\n stream.on(\"data\", function(chunk) {\n debug(\"wrapped data\");\n if (state.decoder) chunk = state.decoder.write(chunk);\n if (state.objectMode && (chunk === null || chunk === void 0)) return;\n else if (!state.objectMode && (!chunk || !chunk.length)) return;\n var ret = _this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n for (var i in stream) {\n if (this[i] === void 0 && typeof stream[i] === \"function\") {\n this[i] = /* @__PURE__ */ function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n this._read = function(n2) {\n debug(\"wrapped _read\", n2);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n return this;\n };\n if (typeof Symbol === \"function\") {\n Readable.prototype[Symbol.asyncIterator] = function() {\n if (createReadableStreamAsyncIterator === void 0) {\n createReadableStreamAsyncIterator = require_async_iterator();\n }\n return createReadableStreamAsyncIterator(this);\n };\n }\n Object.defineProperty(Readable.prototype, \"readableHighWaterMark\", {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n });\n Object.defineProperty(Readable.prototype, \"readableBuffer\", {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n });\n Object.defineProperty(Readable.prototype, \"readableFlowing\", {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n });\n Readable._fromList = fromList;\n Object.defineProperty(Readable.prototype, \"readableLength\", {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n });\n function fromList(n, state) {\n if (state.length === 0) return null;\n var ret;\n if (state.objectMode) ret = state.buffer.shift();\n else if (!n || n >= state.length) {\n if (state.decoder) ret = state.buffer.join(\"\");\n else if (state.buffer.length === 1) ret = state.buffer.first();\n else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n }\n function endReadable(stream) {\n var state = stream._readableState;\n debug(\"endReadable\", state.endEmitted);\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n }\n function endReadableNT(state, stream) {\n debug(\"endReadableNT\", state.endEmitted, state.length);\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit(\"end\");\n if (state.autoDestroy) {\n var wState = stream._writableState;\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n }\n if (typeof Symbol === \"function\") {\n Readable.from = function(iterable, opts) {\n if (from === void 0) {\n from = require_from_browser();\n }\n return from(Readable, iterable, opts);\n };\n }\n function indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n }\n }\n });\n\n // node_modules/stream-browserify/node_modules/readable-stream/lib/_stream_transform.js\n var require_stream_transform = __commonJS({\n \"node_modules/stream-browserify/node_modules/readable-stream/lib/_stream_transform.js\"(exports, module) {\n \"use strict\";\n module.exports = Transform;\n var _require$codes = require_errors_browser().codes;\n var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;\n var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;\n var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING;\n var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\n var Duplex = require_stream_duplex();\n require_inherits_browser()(Transform, Duplex);\n function afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n if (cb === null) {\n return this.emit(\"error\", new ERR_MULTIPLE_CALLBACK());\n }\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null)\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n }\n function Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n this._readableState.needReadable = true;\n this._readableState.sync = false;\n if (options) {\n if (typeof options.transform === \"function\") this._transform = options.transform;\n if (typeof options.flush === \"function\") this._flush = options.flush;\n }\n this.on(\"prefinish\", prefinish);\n }\n function prefinish() {\n var _this = this;\n if (typeof this._flush === \"function\" && !this._readableState.destroyed) {\n this._flush(function(er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n }\n Transform.prototype.push = function(chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n };\n Transform.prototype._transform = function(chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED(\"_transform()\"));\n };\n Transform.prototype._write = function(chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n };\n Transform.prototype._read = function(n) {\n var ts = this._transformState;\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n ts.needTransform = true;\n }\n };\n Transform.prototype._destroy = function(err, cb) {\n Duplex.prototype._destroy.call(this, err, function(err2) {\n cb(err2);\n });\n };\n function done(stream, er, data) {\n if (er) return stream.emit(\"error\", er);\n if (data != null)\n stream.push(data);\n if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n }\n }\n });\n\n // node_modules/stream-browserify/node_modules/readable-stream/lib/_stream_passthrough.js\n var require_stream_passthrough = __commonJS({\n \"node_modules/stream-browserify/node_modules/readable-stream/lib/_stream_passthrough.js\"(exports, module) {\n \"use strict\";\n module.exports = PassThrough;\n var Transform = require_stream_transform();\n require_inherits_browser()(PassThrough, Transform);\n function PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options);\n Transform.call(this, options);\n }\n PassThrough.prototype._transform = function(chunk, encoding, cb) {\n cb(null, chunk);\n };\n }\n });\n\n // node_modules/stream-browserify/node_modules/readable-stream/lib/internal/streams/pipeline.js\n var require_pipeline = __commonJS({\n \"node_modules/stream-browserify/node_modules/readable-stream/lib/internal/streams/pipeline.js\"(exports, module) {\n \"use strict\";\n var eos;\n function once(callback) {\n var called = false;\n return function() {\n if (called) return;\n called = true;\n callback.apply(void 0, arguments);\n };\n }\n var _require$codes = require_errors_browser().codes;\n var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;\n var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\n function noop(err) {\n if (err) throw err;\n }\n function isRequest(stream) {\n return stream.setHeader && typeof stream.abort === \"function\";\n }\n function destroyer(stream, reading, writing, callback) {\n callback = once(callback);\n var closed = false;\n stream.on(\"close\", function() {\n closed = true;\n });\n if (eos === void 0) eos = require_end_of_stream();\n eos(stream, {\n readable: reading,\n writable: writing\n }, function(err) {\n if (err) return callback(err);\n closed = true;\n callback();\n });\n var destroyed = false;\n return function(err) {\n if (closed) return;\n if (destroyed) return;\n destroyed = true;\n if (isRequest(stream)) return stream.abort();\n if (typeof stream.destroy === \"function\") return stream.destroy();\n callback(err || new ERR_STREAM_DESTROYED(\"pipe\"));\n };\n }\n function call(fn) {\n fn();\n }\n function pipe(from, to) {\n return from.pipe(to);\n }\n function popCallback(streams) {\n if (!streams.length) return noop;\n if (typeof streams[streams.length - 1] !== \"function\") return noop;\n return streams.pop();\n }\n function pipeline() {\n for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {\n streams[_key] = arguments[_key];\n }\n var callback = popCallback(streams);\n if (Array.isArray(streams[0])) streams = streams[0];\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS(\"streams\");\n }\n var error;\n var destroys = streams.map(function(stream, i) {\n var reading = i < streams.length - 1;\n var writing = i > 0;\n return destroyer(stream, reading, writing, function(err) {\n if (!error) error = err;\n if (err) destroys.forEach(call);\n if (reading) return;\n destroys.forEach(call);\n callback(error);\n });\n });\n return streams.reduce(pipe);\n }\n module.exports = pipeline;\n }\n });\n\n // node_modules/stream-browserify/index.js\n var require_stream_browserify = __commonJS({\n \"node_modules/stream-browserify/index.js\"(exports, module) {\n module.exports = Stream;\n var EE = require_events().EventEmitter;\n var inherits = require_inherits_browser();\n inherits(Stream, EE);\n Stream.Readable = require_stream_readable();\n Stream.Writable = require_stream_writable();\n Stream.Duplex = require_stream_duplex();\n Stream.Transform = require_stream_transform();\n Stream.PassThrough = require_stream_passthrough();\n Stream.finished = require_end_of_stream();\n Stream.pipeline = require_pipeline();\n Stream.Stream = Stream;\n function Stream() {\n EE.call(this);\n }\n Stream.prototype.pipe = function(dest, options) {\n var source = this;\n function ondata(chunk) {\n if (dest.writable) {\n if (false === dest.write(chunk) && source.pause) {\n source.pause();\n }\n }\n }\n source.on(\"data\", ondata);\n function ondrain() {\n if (source.readable && source.resume) {\n source.resume();\n }\n }\n dest.on(\"drain\", ondrain);\n if (!dest._isStdio && (!options || options.end !== false)) {\n source.on(\"end\", onend);\n source.on(\"close\", onclose);\n }\n var didOnEnd = false;\n function onend() {\n if (didOnEnd) return;\n didOnEnd = true;\n dest.end();\n }\n function onclose() {\n if (didOnEnd) return;\n didOnEnd = true;\n if (typeof dest.destroy === \"function\") dest.destroy();\n }\n function onerror(er) {\n cleanup();\n if (EE.listenerCount(this, \"error\") === 0) {\n throw er;\n }\n }\n source.on(\"error\", onerror);\n dest.on(\"error\", onerror);\n function cleanup() {\n source.removeListener(\"data\", ondata);\n dest.removeListener(\"drain\", ondrain);\n source.removeListener(\"end\", onend);\n source.removeListener(\"close\", onclose);\n source.removeListener(\"error\", onerror);\n dest.removeListener(\"error\", onerror);\n source.removeListener(\"end\", cleanup);\n source.removeListener(\"close\", cleanup);\n dest.removeListener(\"close\", cleanup);\n }\n source.on(\"end\", cleanup);\n source.on(\"close\", cleanup);\n dest.on(\"close\", cleanup);\n dest.emit(\"pipe\", source);\n return dest;\n };\n }\n });\n\n // node_modules/util/util.js\n var require_util2 = __commonJS({\n \"node_modules/util/util.js\"(exports) {\n var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors2(obj) {\n var keys = Object.keys(obj);\n var descriptors = {};\n for (var i = 0; i < keys.length; i++) {\n descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);\n }\n return descriptors;\n };\n var formatRegExp = /%[sdj%]/g;\n exports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(\" \");\n }\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x2) {\n if (x2 === \"%%\") return \"%\";\n if (i >= len) return x2;\n switch (x2) {\n case \"%s\":\n return String(args[i++]);\n case \"%d\":\n return Number(args[i++]);\n case \"%j\":\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return \"[Circular]\";\n }\n default:\n return x2;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += \" \" + x;\n } else {\n str += \" \" + inspect(x);\n }\n }\n return str;\n };\n exports.deprecate = function(fn, msg) {\n if (typeof process !== \"undefined\" && process.noDeprecation === true) {\n return fn;\n }\n if (typeof process === \"undefined\") {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n return deprecated;\n };\n var debugs = {};\n var debugEnvRegex = /^$/;\n if (\"false\") {\n debugEnv = \"false\";\n debugEnv = debugEnv.replace(/[|\\\\{}()[\\]^$+?.]/g, \"\\\\$&\").replace(/\\*/g, \".*\").replace(/,/g, \"$|^\").toUpperCase();\n debugEnvRegex = new RegExp(\"^\" + debugEnv + \"$\", \"i\");\n }\n var debugEnv;\n exports.debuglog = function(set) {\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (debugEnvRegex.test(set)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error(\"%s %d: %s\", set, pid, msg);\n };\n } else {\n debugs[set] = function() {\n };\n }\n }\n return debugs[set];\n };\n function inspect(obj, opts) {\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n ctx.showHidden = opts;\n } else if (opts) {\n exports._extend(ctx, opts);\n }\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n }\n exports.inspect = inspect;\n inspect.colors = {\n \"bold\": [1, 22],\n \"italic\": [3, 23],\n \"underline\": [4, 24],\n \"inverse\": [7, 27],\n \"white\": [37, 39],\n \"grey\": [90, 39],\n \"black\": [30, 39],\n \"blue\": [34, 39],\n \"cyan\": [36, 39],\n \"green\": [32, 39],\n \"magenta\": [35, 39],\n \"red\": [31, 39],\n \"yellow\": [33, 39]\n };\n inspect.styles = {\n \"special\": \"cyan\",\n \"number\": \"yellow\",\n \"boolean\": \"yellow\",\n \"undefined\": \"grey\",\n \"null\": \"bold\",\n \"string\": \"green\",\n \"date\": \"magenta\",\n // \"name\": intentionally not styling\n \"regexp\": \"red\"\n };\n function stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n if (style) {\n return \"\\x1B[\" + inspect.colors[style][0] + \"m\" + str + \"\\x1B[\" + inspect.colors[style][1] + \"m\";\n } else {\n return str;\n }\n }\n function stylizeNoColor(str, styleType) {\n return str;\n }\n function arrayToHash(array) {\n var hash = {};\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n return hash;\n }\n function formatValue(ctx, value, recurseTimes) {\n if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect && // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n if (isError(value) && (keys.indexOf(\"message\") >= 0 || keys.indexOf(\"description\") >= 0)) {\n return formatError(value);\n }\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name2 = value.name ? \": \" + value.name : \"\";\n return ctx.stylize(\"[Function\" + name2 + \"]\", \"special\");\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), \"regexp\");\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), \"date\");\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n var base = \"\", array = false, braces = [\"{\", \"}\"];\n if (isArray(value)) {\n array = true;\n braces = [\"[\", \"]\"];\n }\n if (isFunction(value)) {\n var n = value.name ? \": \" + value.name : \"\";\n base = \" [Function\" + n + \"]\";\n }\n if (isRegExp(value)) {\n base = \" \" + RegExp.prototype.toString.call(value);\n }\n if (isDate(value)) {\n base = \" \" + Date.prototype.toUTCString.call(value);\n }\n if (isError(value)) {\n base = \" \" + formatError(value);\n }\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), \"regexp\");\n } else {\n return ctx.stylize(\"[Object]\", \"special\");\n }\n }\n ctx.seen.push(value);\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n ctx.seen.pop();\n return reduceToSingleString(output, base, braces);\n }\n function formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize(\"undefined\", \"undefined\");\n if (isString(value)) {\n var simple = \"'\" + JSON.stringify(value).replace(/^\"|\"$/g, \"\").replace(/'/g, \"\\\\'\").replace(/\\\\\"/g, '\"') + \"'\";\n return ctx.stylize(simple, \"string\");\n }\n if (isNumber(value))\n return ctx.stylize(\"\" + value, \"number\");\n if (isBoolean(value))\n return ctx.stylize(\"\" + value, \"boolean\");\n if (isNull(value))\n return ctx.stylize(\"null\", \"null\");\n }\n function formatError(value) {\n return \"[\" + Error.prototype.toString.call(value) + \"]\";\n }\n function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty2(value, String(i))) {\n output.push(formatProperty(\n ctx,\n value,\n recurseTimes,\n visibleKeys,\n String(i),\n true\n ));\n } else {\n output.push(\"\");\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(\n ctx,\n value,\n recurseTimes,\n visibleKeys,\n key,\n true\n ));\n }\n });\n return output;\n }\n function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name2, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize(\"[Getter/Setter]\", \"special\");\n } else {\n str = ctx.stylize(\"[Getter]\", \"special\");\n }\n } else {\n if (desc.set) {\n str = ctx.stylize(\"[Setter]\", \"special\");\n }\n }\n if (!hasOwnProperty2(visibleKeys, key)) {\n name2 = \"[\" + key + \"]\";\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf(\"\\n\") > -1) {\n if (array) {\n str = str.split(\"\\n\").map(function(line) {\n return \" \" + line;\n }).join(\"\\n\").slice(2);\n } else {\n str = \"\\n\" + str.split(\"\\n\").map(function(line) {\n return \" \" + line;\n }).join(\"\\n\");\n }\n }\n } else {\n str = ctx.stylize(\"[Circular]\", \"special\");\n }\n }\n if (isUndefined(name2)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name2 = JSON.stringify(\"\" + key);\n if (name2.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name2 = name2.slice(1, -1);\n name2 = ctx.stylize(name2, \"name\");\n } else {\n name2 = name2.replace(/'/g, \"\\\\'\").replace(/\\\\\"/g, '\"').replace(/(^\"|\"$)/g, \"'\");\n name2 = ctx.stylize(name2, \"string\");\n }\n }\n return name2 + \": \" + str;\n }\n function reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf(\"\\n\") >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, \"\").length + 1;\n }, 0);\n if (length > 60) {\n return braces[0] + (base === \"\" ? \"\" : base + \"\\n \") + \" \" + output.join(\",\\n \") + \" \" + braces[1];\n }\n return braces[0] + base + \" \" + output.join(\", \") + \" \" + braces[1];\n }\n exports.types = require_types();\n function isArray(ar) {\n return Array.isArray(ar);\n }\n exports.isArray = isArray;\n function isBoolean(arg) {\n return typeof arg === \"boolean\";\n }\n exports.isBoolean = isBoolean;\n function isNull(arg) {\n return arg === null;\n }\n exports.isNull = isNull;\n function isNullOrUndefined(arg) {\n return arg == null;\n }\n exports.isNullOrUndefined = isNullOrUndefined;\n function isNumber(arg) {\n return typeof arg === \"number\";\n }\n exports.isNumber = isNumber;\n function isString(arg) {\n return typeof arg === \"string\";\n }\n exports.isString = isString;\n function isSymbol(arg) {\n return typeof arg === \"symbol\";\n }\n exports.isSymbol = isSymbol;\n function isUndefined(arg) {\n return arg === void 0;\n }\n exports.isUndefined = isUndefined;\n function isRegExp(re) {\n return isObject(re) && objectToString(re) === \"[object RegExp]\";\n }\n exports.isRegExp = isRegExp;\n exports.types.isRegExp = isRegExp;\n function isObject(arg) {\n return typeof arg === \"object\" && arg !== null;\n }\n exports.isObject = isObject;\n function isDate(d) {\n return isObject(d) && objectToString(d) === \"[object Date]\";\n }\n exports.isDate = isDate;\n exports.types.isDate = isDate;\n function isError(e) {\n return isObject(e) && (objectToString(e) === \"[object Error]\" || e instanceof Error);\n }\n exports.isError = isError;\n exports.types.isNativeError = isError;\n function isFunction(arg) {\n return typeof arg === \"function\";\n }\n exports.isFunction = isFunction;\n function isPrimitive(arg) {\n return arg === null || typeof arg === \"boolean\" || typeof arg === \"number\" || typeof arg === \"string\" || typeof arg === \"symbol\" || // ES6 symbol\n typeof arg === \"undefined\";\n }\n exports.isPrimitive = isPrimitive;\n exports.isBuffer = require_isBufferBrowser();\n function objectToString(o) {\n return Object.prototype.toString.call(o);\n }\n function pad(n) {\n return n < 10 ? \"0\" + n.toString(10) : n.toString(10);\n }\n var months = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\"\n ];\n function timestamp() {\n var d = /* @__PURE__ */ new Date();\n var time = [\n pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())\n ].join(\":\");\n return [d.getDate(), months[d.getMonth()], time].join(\" \");\n }\n exports.log = function() {\n console.log(\"%s - %s\", timestamp(), exports.format.apply(exports, arguments));\n };\n exports.inherits = require_inherits_browser();\n exports._extend = function(origin, add) {\n if (!add || !isObject(add)) return origin;\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n };\n function hasOwnProperty2(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n }\n var kCustomPromisifiedSymbol = typeof Symbol !== \"undefined\" ? Symbol(\"util.promisify.custom\") : void 0;\n exports.promisify = function promisify(original) {\n if (typeof original !== \"function\")\n throw new TypeError('The \"original\" argument must be of type Function');\n if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n if (typeof fn !== \"function\") {\n throw new TypeError('The \"util.promisify.custom\" argument must be of type Function');\n }\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn,\n enumerable: false,\n writable: false,\n configurable: true\n });\n return fn;\n }\n function fn() {\n var promiseResolve, promiseReject;\n var promise = new Promise(function(resolve, reject) {\n promiseResolve = resolve;\n promiseReject = reject;\n });\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n args.push(function(err, value) {\n if (err) {\n promiseReject(err);\n } else {\n promiseResolve(value);\n }\n });\n try {\n original.apply(this, args);\n } catch (err) {\n promiseReject(err);\n }\n return promise;\n }\n Object.setPrototypeOf(fn, Object.getPrototypeOf(original));\n if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn,\n enumerable: false,\n writable: false,\n configurable: true\n });\n return Object.defineProperties(\n fn,\n getOwnPropertyDescriptors(original)\n );\n };\n exports.promisify.custom = kCustomPromisifiedSymbol;\n function callbackifyOnRejected(reason, cb) {\n if (!reason) {\n var newReason = new Error(\"Promise was rejected with a falsy value\");\n newReason.reason = reason;\n reason = newReason;\n }\n return cb(reason);\n }\n function callbackify(original) {\n if (typeof original !== \"function\") {\n throw new TypeError('The \"original\" argument must be of type Function');\n }\n function callbackified() {\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n var maybeCb = args.pop();\n if (typeof maybeCb !== \"function\") {\n throw new TypeError(\"The last argument must be of type Function\");\n }\n var self2 = this;\n var cb = function() {\n return maybeCb.apply(self2, arguments);\n };\n original.apply(this, args).then(\n function(ret) {\n process.nextTick(cb.bind(null, null, ret));\n },\n function(rej) {\n process.nextTick(callbackifyOnRejected.bind(null, rej, cb));\n }\n );\n }\n Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));\n Object.defineProperties(\n callbackified,\n getOwnPropertyDescriptors(original)\n );\n return callbackified;\n }\n exports.callbackify = callbackify;\n }\n });\n\n // node_modules/assert/build/internal/errors.js\n var require_errors = __commonJS({\n \"node_modules/assert/build/internal/errors.js\"(exports, module) {\n \"use strict\";\n function _typeof(o) {\n \"@babel/helpers - typeof\";\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(o2) {\n return typeof o2;\n } : function(o2) {\n return o2 && \"function\" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? \"symbol\" : typeof o2;\n }, _typeof(o);\n }\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", { writable: false });\n return Constructor;\n }\n function _toPropertyKey(arg) {\n var key = _toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n }\n function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== void 0) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });\n Object.defineProperty(subClass, \"prototype\", { writable: false });\n if (superClass) _setPrototypeOf(subClass, superClass);\n }\n function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {\n o2.__proto__ = p2;\n return o2;\n };\n return _setPrototypeOf(o, p);\n }\n function _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived), result;\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n return _possibleConstructorReturn(this, result);\n };\n }\n function _possibleConstructorReturn(self2, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n return _assertThisInitialized(self2);\n }\n function _assertThisInitialized(self2) {\n if (self2 === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n return self2;\n }\n function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {\n }));\n return true;\n } catch (e) {\n return false;\n }\n }\n function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {\n return o2.__proto__ || Object.getPrototypeOf(o2);\n };\n return _getPrototypeOf(o);\n }\n var codes = {};\n var assert;\n var util;\n function createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === \"string\") {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n var NodeError = /* @__PURE__ */ function(_Base) {\n _inherits(NodeError2, _Base);\n var _super = _createSuper(NodeError2);\n function NodeError2(arg1, arg2, arg3) {\n var _this;\n _classCallCheck(this, NodeError2);\n _this = _super.call(this, getMessage(arg1, arg2, arg3));\n _this.code = code;\n return _this;\n }\n return _createClass(NodeError2);\n }(Base);\n codes[code] = NodeError;\n }\n function oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function(i) {\n return String(i);\n });\n if (len > 2) {\n return \"one of \".concat(thing, \" \").concat(expected.slice(0, len - 1).join(\", \"), \", or \") + expected[len - 1];\n } else if (len === 2) {\n return \"one of \".concat(thing, \" \").concat(expected[0], \" or \").concat(expected[1]);\n } else {\n return \"of \".concat(thing, \" \").concat(expected[0]);\n }\n } else {\n return \"of \".concat(thing, \" \").concat(String(expected));\n }\n }\n function startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n }\n function endsWith(str, search, this_len) {\n if (this_len === void 0 || this_len > str.length) {\n this_len = str.length;\n }\n return str.substring(this_len - search.length, this_len) === search;\n }\n function includes(str, search, start) {\n if (typeof start !== \"number\") {\n start = 0;\n }\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n }\n createErrorType(\"ERR_AMBIGUOUS_ARGUMENT\", 'The \"%s\" argument is ambiguous. %s', TypeError);\n createErrorType(\"ERR_INVALID_ARG_TYPE\", function(name2, expected, actual) {\n if (assert === void 0) assert = require_assert();\n assert(typeof name2 === \"string\", \"'name' must be a string\");\n var determiner;\n if (typeof expected === \"string\" && startsWith(expected, \"not \")) {\n determiner = \"must not be\";\n expected = expected.replace(/^not /, \"\");\n } else {\n determiner = \"must be\";\n }\n var msg;\n if (endsWith(name2, \" argument\")) {\n msg = \"The \".concat(name2, \" \").concat(determiner, \" \").concat(oneOf(expected, \"type\"));\n } else {\n var type = includes(name2, \".\") ? \"property\" : \"argument\";\n msg = 'The \"'.concat(name2, '\" ').concat(type, \" \").concat(determiner, \" \").concat(oneOf(expected, \"type\"));\n }\n msg += \". Received type \".concat(_typeof(actual));\n return msg;\n }, TypeError);\n createErrorType(\"ERR_INVALID_ARG_VALUE\", function(name2, value) {\n var reason = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : \"is invalid\";\n if (util === void 0) util = require_util2();\n var inspected = util.inspect(value);\n if (inspected.length > 128) {\n inspected = \"\".concat(inspected.slice(0, 128), \"...\");\n }\n return \"The argument '\".concat(name2, \"' \").concat(reason, \". Received \").concat(inspected);\n }, TypeError, RangeError);\n createErrorType(\"ERR_INVALID_RETURN_VALUE\", function(input, name2, value) {\n var type;\n if (value && value.constructor && value.constructor.name) {\n type = \"instance of \".concat(value.constructor.name);\n } else {\n type = \"type \".concat(_typeof(value));\n }\n return \"Expected \".concat(input, ' to be returned from the \"').concat(name2, '\"') + \" function but got \".concat(type, \".\");\n }, TypeError);\n createErrorType(\"ERR_MISSING_ARGS\", function() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (assert === void 0) assert = require_assert();\n assert(args.length > 0, \"At least one arg needs to be specified\");\n var msg = \"The \";\n var len = args.length;\n args = args.map(function(a) {\n return '\"'.concat(a, '\"');\n });\n switch (len) {\n case 1:\n msg += \"\".concat(args[0], \" argument\");\n break;\n case 2:\n msg += \"\".concat(args[0], \" and \").concat(args[1], \" arguments\");\n break;\n default:\n msg += args.slice(0, len - 1).join(\", \");\n msg += \", and \".concat(args[len - 1], \" arguments\");\n break;\n }\n return \"\".concat(msg, \" must be specified\");\n }, TypeError);\n module.exports.codes = codes;\n }\n });\n\n // node_modules/assert/build/internal/assert/assertion_error.js\n var require_assertion_error = __commonJS({\n \"node_modules/assert/build/internal/assert/assertion_error.js\"(exports, module) {\n \"use strict\";\n function ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function(r2) {\n return Object.getOwnPropertyDescriptor(e, r2).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n }\n function _objectSpread(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {\n _defineProperty(e, r2, t[r2]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {\n Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));\n });\n }\n return e;\n }\n function _defineProperty(obj, key, value) {\n key = _toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });\n } else {\n obj[key] = value;\n }\n return obj;\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", { writable: false });\n return Constructor;\n }\n function _toPropertyKey(arg) {\n var key = _toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n }\n function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== void 0) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n }\n function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });\n Object.defineProperty(subClass, \"prototype\", { writable: false });\n if (superClass) _setPrototypeOf(subClass, superClass);\n }\n function _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived), result;\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n return _possibleConstructorReturn(this, result);\n };\n }\n function _possibleConstructorReturn(self2, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n return _assertThisInitialized(self2);\n }\n function _assertThisInitialized(self2) {\n if (self2 === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n return self2;\n }\n function _wrapNativeSuper(Class) {\n var _cache = typeof Map === \"function\" ? /* @__PURE__ */ new Map() : void 0;\n _wrapNativeSuper = function _wrapNativeSuper2(Class2) {\n if (Class2 === null || !_isNativeFunction(Class2)) return Class2;\n if (typeof Class2 !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class2)) return _cache.get(Class2);\n _cache.set(Class2, Wrapper);\n }\n function Wrapper() {\n return _construct(Class2, arguments, _getPrototypeOf(this).constructor);\n }\n Wrapper.prototype = Object.create(Class2.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } });\n return _setPrototypeOf(Wrapper, Class2);\n };\n return _wrapNativeSuper(Class);\n }\n function _construct(Parent, args, Class) {\n if (_isNativeReflectConstruct()) {\n _construct = Reflect.construct.bind();\n } else {\n _construct = function _construct2(Parent2, args2, Class2) {\n var a = [null];\n a.push.apply(a, args2);\n var Constructor = Function.bind.apply(Parent2, a);\n var instance = new Constructor();\n if (Class2) _setPrototypeOf(instance, Class2.prototype);\n return instance;\n };\n }\n return _construct.apply(null, arguments);\n }\n function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {\n }));\n return true;\n } catch (e) {\n return false;\n }\n }\n function _isNativeFunction(fn) {\n return Function.toString.call(fn).indexOf(\"[native code]\") !== -1;\n }\n function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {\n o2.__proto__ = p2;\n return o2;\n };\n return _setPrototypeOf(o, p);\n }\n function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {\n return o2.__proto__ || Object.getPrototypeOf(o2);\n };\n return _getPrototypeOf(o);\n }\n function _typeof(o) {\n \"@babel/helpers - typeof\";\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(o2) {\n return typeof o2;\n } : function(o2) {\n return o2 && \"function\" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? \"symbol\" : typeof o2;\n }, _typeof(o);\n }\n var _require = require_util2();\n var inspect = _require.inspect;\n var _require2 = require_errors();\n var ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE;\n function endsWith(str, search, this_len) {\n if (this_len === void 0 || this_len > str.length) {\n this_len = str.length;\n }\n return str.substring(this_len - search.length, this_len) === search;\n }\n function repeat(str, count) {\n count = Math.floor(count);\n if (str.length == 0 || count == 0) return \"\";\n var maxCount = str.length * count;\n count = Math.floor(Math.log(count) / Math.log(2));\n while (count) {\n str += str;\n count--;\n }\n str += str.substring(0, maxCount - str.length);\n return str;\n }\n var blue = \"\";\n var green = \"\";\n var red = \"\";\n var white = \"\";\n var kReadableOperator = {\n deepStrictEqual: \"Expected values to be strictly deep-equal:\",\n strictEqual: \"Expected values to be strictly equal:\",\n strictEqualObject: 'Expected \"actual\" to be reference-equal to \"expected\":',\n deepEqual: \"Expected values to be loosely deep-equal:\",\n equal: \"Expected values to be loosely equal:\",\n notDeepStrictEqual: 'Expected \"actual\" not to be strictly deep-equal to:',\n notStrictEqual: 'Expected \"actual\" to be strictly unequal to:',\n notStrictEqualObject: 'Expected \"actual\" not to be reference-equal to \"expected\":',\n notDeepEqual: 'Expected \"actual\" not to be loosely deep-equal to:',\n notEqual: 'Expected \"actual\" to be loosely unequal to:',\n notIdentical: \"Values identical but not reference-equal:\"\n };\n var kMaxShortLength = 10;\n function copyError(source) {\n var keys = Object.keys(source);\n var target = Object.create(Object.getPrototypeOf(source));\n keys.forEach(function(key) {\n target[key] = source[key];\n });\n Object.defineProperty(target, \"message\", {\n value: source.message\n });\n return target;\n }\n function inspectValue(val) {\n return inspect(val, {\n compact: false,\n customInspect: false,\n depth: 1e3,\n maxArrayLength: Infinity,\n // Assert compares only enumerable properties (with a few exceptions).\n showHidden: false,\n // Having a long line as error is better than wrapping the line for\n // comparison for now.\n // TODO(BridgeAR): `breakLength` should be limited as soon as soon as we\n // have meta information about the inspected properties (i.e., know where\n // in what line the property starts and ends).\n breakLength: Infinity,\n // Assert does not detect proxies currently.\n showProxy: false,\n sorted: true,\n // Inspect getters as we also check them when comparing entries.\n getters: true\n });\n }\n function createErrDiff(actual, expected, operator) {\n var other = \"\";\n var res = \"\";\n var lastPos = 0;\n var end = \"\";\n var skipped = false;\n var actualInspected = inspectValue(actual);\n var actualLines = actualInspected.split(\"\\n\");\n var expectedLines = inspectValue(expected).split(\"\\n\");\n var i = 0;\n var indicator = \"\";\n if (operator === \"strictEqual\" && _typeof(actual) === \"object\" && _typeof(expected) === \"object\" && actual !== null && expected !== null) {\n operator = \"strictEqualObject\";\n }\n if (actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) {\n var inputLength = actualLines[0].length + expectedLines[0].length;\n if (inputLength <= kMaxShortLength) {\n if ((_typeof(actual) !== \"object\" || actual === null) && (_typeof(expected) !== \"object\" || expected === null) && (actual !== 0 || expected !== 0)) {\n return \"\".concat(kReadableOperator[operator], \"\\n\\n\") + \"\".concat(actualLines[0], \" !== \").concat(expectedLines[0], \"\\n\");\n }\n } else if (operator !== \"strictEqualObject\") {\n var maxLength = process.stderr && process.stderr.isTTY ? process.stderr.columns : 80;\n if (inputLength < maxLength) {\n while (actualLines[0][i] === expectedLines[0][i]) {\n i++;\n }\n if (i > 2) {\n indicator = \"\\n \".concat(repeat(\" \", i), \"^\");\n i = 0;\n }\n }\n }\n }\n var a = actualLines[actualLines.length - 1];\n var b = expectedLines[expectedLines.length - 1];\n while (a === b) {\n if (i++ < 2) {\n end = \"\\n \".concat(a).concat(end);\n } else {\n other = a;\n }\n actualLines.pop();\n expectedLines.pop();\n if (actualLines.length === 0 || expectedLines.length === 0) break;\n a = actualLines[actualLines.length - 1];\n b = expectedLines[expectedLines.length - 1];\n }\n var maxLines = Math.max(actualLines.length, expectedLines.length);\n if (maxLines === 0) {\n var _actualLines = actualInspected.split(\"\\n\");\n if (_actualLines.length > 30) {\n _actualLines[26] = \"\".concat(blue, \"...\").concat(white);\n while (_actualLines.length > 27) {\n _actualLines.pop();\n }\n }\n return \"\".concat(kReadableOperator.notIdentical, \"\\n\\n\").concat(_actualLines.join(\"\\n\"), \"\\n\");\n }\n if (i > 3) {\n end = \"\\n\".concat(blue, \"...\").concat(white).concat(end);\n skipped = true;\n }\n if (other !== \"\") {\n end = \"\\n \".concat(other).concat(end);\n other = \"\";\n }\n var printedLines = 0;\n var msg = kReadableOperator[operator] + \"\\n\".concat(green, \"+ actual\").concat(white, \" \").concat(red, \"- expected\").concat(white);\n var skippedMsg = \" \".concat(blue, \"...\").concat(white, \" Lines skipped\");\n for (i = 0; i < maxLines; i++) {\n var cur = i - lastPos;\n if (actualLines.length < i + 1) {\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += \"\\n\".concat(blue, \"...\").concat(white);\n skipped = true;\n } else if (cur > 3) {\n res += \"\\n \".concat(expectedLines[i - 2]);\n printedLines++;\n }\n res += \"\\n \".concat(expectedLines[i - 1]);\n printedLines++;\n }\n lastPos = i;\n other += \"\\n\".concat(red, \"-\").concat(white, \" \").concat(expectedLines[i]);\n printedLines++;\n } else if (expectedLines.length < i + 1) {\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += \"\\n\".concat(blue, \"...\").concat(white);\n skipped = true;\n } else if (cur > 3) {\n res += \"\\n \".concat(actualLines[i - 2]);\n printedLines++;\n }\n res += \"\\n \".concat(actualLines[i - 1]);\n printedLines++;\n }\n lastPos = i;\n res += \"\\n\".concat(green, \"+\").concat(white, \" \").concat(actualLines[i]);\n printedLines++;\n } else {\n var expectedLine = expectedLines[i];\n var actualLine = actualLines[i];\n var divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, \",\") || actualLine.slice(0, -1) !== expectedLine);\n if (divergingLines && endsWith(expectedLine, \",\") && expectedLine.slice(0, -1) === actualLine) {\n divergingLines = false;\n actualLine += \",\";\n }\n if (divergingLines) {\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += \"\\n\".concat(blue, \"...\").concat(white);\n skipped = true;\n } else if (cur > 3) {\n res += \"\\n \".concat(actualLines[i - 2]);\n printedLines++;\n }\n res += \"\\n \".concat(actualLines[i - 1]);\n printedLines++;\n }\n lastPos = i;\n res += \"\\n\".concat(green, \"+\").concat(white, \" \").concat(actualLine);\n other += \"\\n\".concat(red, \"-\").concat(white, \" \").concat(expectedLine);\n printedLines += 2;\n } else {\n res += other;\n other = \"\";\n if (cur === 1 || i === 0) {\n res += \"\\n \".concat(actualLine);\n printedLines++;\n }\n }\n }\n if (printedLines > 20 && i < maxLines - 2) {\n return \"\".concat(msg).concat(skippedMsg, \"\\n\").concat(res, \"\\n\").concat(blue, \"...\").concat(white).concat(other, \"\\n\") + \"\".concat(blue, \"...\").concat(white);\n }\n }\n return \"\".concat(msg).concat(skipped ? skippedMsg : \"\", \"\\n\").concat(res).concat(other).concat(end).concat(indicator);\n }\n var AssertionError = /* @__PURE__ */ function(_Error, _inspect$custom) {\n _inherits(AssertionError2, _Error);\n var _super = _createSuper(AssertionError2);\n function AssertionError2(options) {\n var _this;\n _classCallCheck(this, AssertionError2);\n if (_typeof(options) !== \"object\" || options === null) {\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n }\n var message = options.message, operator = options.operator, stackStartFn = options.stackStartFn;\n var actual = options.actual, expected = options.expected;\n var limit = Error.stackTraceLimit;\n Error.stackTraceLimit = 0;\n if (message != null) {\n _this = _super.call(this, String(message));\n } else {\n if (process.stderr && process.stderr.isTTY) {\n if (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1) {\n blue = \"\\x1B[34m\";\n green = \"\\x1B[32m\";\n white = \"\\x1B[39m\";\n red = \"\\x1B[31m\";\n } else {\n blue = \"\";\n green = \"\";\n white = \"\";\n red = \"\";\n }\n }\n if (_typeof(actual) === \"object\" && actual !== null && _typeof(expected) === \"object\" && expected !== null && \"stack\" in actual && actual instanceof Error && \"stack\" in expected && expected instanceof Error) {\n actual = copyError(actual);\n expected = copyError(expected);\n }\n if (operator === \"deepStrictEqual\" || operator === \"strictEqual\") {\n _this = _super.call(this, createErrDiff(actual, expected, operator));\n } else if (operator === \"notDeepStrictEqual\" || operator === \"notStrictEqual\") {\n var base = kReadableOperator[operator];\n var res = inspectValue(actual).split(\"\\n\");\n if (operator === \"notStrictEqual\" && _typeof(actual) === \"object\" && actual !== null) {\n base = kReadableOperator.notStrictEqualObject;\n }\n if (res.length > 30) {\n res[26] = \"\".concat(blue, \"...\").concat(white);\n while (res.length > 27) {\n res.pop();\n }\n }\n if (res.length === 1) {\n _this = _super.call(this, \"\".concat(base, \" \").concat(res[0]));\n } else {\n _this = _super.call(this, \"\".concat(base, \"\\n\\n\").concat(res.join(\"\\n\"), \"\\n\"));\n }\n } else {\n var _res = inspectValue(actual);\n var other = \"\";\n var knownOperators = kReadableOperator[operator];\n if (operator === \"notDeepEqual\" || operator === \"notEqual\") {\n _res = \"\".concat(kReadableOperator[operator], \"\\n\\n\").concat(_res);\n if (_res.length > 1024) {\n _res = \"\".concat(_res.slice(0, 1021), \"...\");\n }\n } else {\n other = \"\".concat(inspectValue(expected));\n if (_res.length > 512) {\n _res = \"\".concat(_res.slice(0, 509), \"...\");\n }\n if (other.length > 512) {\n other = \"\".concat(other.slice(0, 509), \"...\");\n }\n if (operator === \"deepEqual\" || operator === \"equal\") {\n _res = \"\".concat(knownOperators, \"\\n\\n\").concat(_res, \"\\n\\nshould equal\\n\\n\");\n } else {\n other = \" \".concat(operator, \" \").concat(other);\n }\n }\n _this = _super.call(this, \"\".concat(_res).concat(other));\n }\n }\n Error.stackTraceLimit = limit;\n _this.generatedMessage = !message;\n Object.defineProperty(_assertThisInitialized(_this), \"name\", {\n value: \"AssertionError [ERR_ASSERTION]\",\n enumerable: false,\n writable: true,\n configurable: true\n });\n _this.code = \"ERR_ASSERTION\";\n _this.actual = actual;\n _this.expected = expected;\n _this.operator = operator;\n if (Error.captureStackTrace) {\n Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn);\n }\n _this.stack;\n _this.name = \"AssertionError\";\n return _possibleConstructorReturn(_this);\n }\n _createClass(AssertionError2, [{\n key: \"toString\",\n value: function toString() {\n return \"\".concat(this.name, \" [\").concat(this.code, \"]: \").concat(this.message);\n }\n }, {\n key: _inspect$custom,\n value: function value(recurseTimes, ctx) {\n return inspect(this, _objectSpread(_objectSpread({}, ctx), {}, {\n customInspect: false,\n depth: 0\n }));\n }\n }]);\n return AssertionError2;\n }(/* @__PURE__ */ _wrapNativeSuper(Error), inspect.custom);\n module.exports = AssertionError;\n }\n });\n\n // node_modules/object-keys/isArguments.js\n var require_isArguments = __commonJS({\n \"node_modules/object-keys/isArguments.js\"(exports, module) {\n \"use strict\";\n var toStr = Object.prototype.toString;\n module.exports = function isArguments(value) {\n var str = toStr.call(value);\n var isArgs = str === \"[object Arguments]\";\n if (!isArgs) {\n isArgs = str !== \"[object Array]\" && value !== null && typeof value === \"object\" && typeof value.length === \"number\" && value.length >= 0 && toStr.call(value.callee) === \"[object Function]\";\n }\n return isArgs;\n };\n }\n });\n\n // node_modules/object-keys/implementation.js\n var require_implementation2 = __commonJS({\n \"node_modules/object-keys/implementation.js\"(exports, module) {\n \"use strict\";\n var keysShim;\n if (!Object.keys) {\n has = Object.prototype.hasOwnProperty;\n toStr = Object.prototype.toString;\n isArgs = require_isArguments();\n isEnumerable = Object.prototype.propertyIsEnumerable;\n hasDontEnumBug = !isEnumerable.call({ toString: null }, \"toString\");\n hasProtoEnumBug = isEnumerable.call(function() {\n }, \"prototype\");\n dontEnums = [\n \"toString\",\n \"toLocaleString\",\n \"valueOf\",\n \"hasOwnProperty\",\n \"isPrototypeOf\",\n \"propertyIsEnumerable\",\n \"constructor\"\n ];\n equalsConstructorPrototype = function(o) {\n var ctor = o.constructor;\n return ctor && ctor.prototype === o;\n };\n excludedKeys = {\n $applicationCache: true,\n $console: true,\n $external: true,\n $frame: true,\n $frameElement: true,\n $frames: true,\n $innerHeight: true,\n $innerWidth: true,\n $onmozfullscreenchange: true,\n $onmozfullscreenerror: true,\n $outerHeight: true,\n $outerWidth: true,\n $pageXOffset: true,\n $pageYOffset: true,\n $parent: true,\n $scrollLeft: true,\n $scrollTop: true,\n $scrollX: true,\n $scrollY: true,\n $self: true,\n $webkitIndexedDB: true,\n $webkitStorageInfo: true,\n $window: true\n };\n hasAutomationEqualityBug = function() {\n if (typeof window === \"undefined\") {\n return false;\n }\n for (var k in window) {\n try {\n if (!excludedKeys[\"$\" + k] && has.call(window, k) && window[k] !== null && typeof window[k] === \"object\") {\n try {\n equalsConstructorPrototype(window[k]);\n } catch (e) {\n return true;\n }\n }\n } catch (e) {\n return true;\n }\n }\n return false;\n }();\n equalsConstructorPrototypeIfNotBuggy = function(o) {\n if (typeof window === \"undefined\" || !hasAutomationEqualityBug) {\n return equalsConstructorPrototype(o);\n }\n try {\n return equalsConstructorPrototype(o);\n } catch (e) {\n return false;\n }\n };\n keysShim = function keys(object) {\n var isObject = object !== null && typeof object === \"object\";\n var isFunction = toStr.call(object) === \"[object Function]\";\n var isArguments = isArgs(object);\n var isString = isObject && toStr.call(object) === \"[object String]\";\n var theKeys = [];\n if (!isObject && !isFunction && !isArguments) {\n throw new TypeError(\"Object.keys called on a non-object\");\n }\n var skipProto = hasProtoEnumBug && isFunction;\n if (isString && object.length > 0 && !has.call(object, 0)) {\n for (var i = 0; i < object.length; ++i) {\n theKeys.push(String(i));\n }\n }\n if (isArguments && object.length > 0) {\n for (var j = 0; j < object.length; ++j) {\n theKeys.push(String(j));\n }\n } else {\n for (var name2 in object) {\n if (!(skipProto && name2 === \"prototype\") && has.call(object, name2)) {\n theKeys.push(String(name2));\n }\n }\n }\n if (hasDontEnumBug) {\n var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);\n for (var k = 0; k < dontEnums.length; ++k) {\n if (!(skipConstructor && dontEnums[k] === \"constructor\") && has.call(object, dontEnums[k])) {\n theKeys.push(dontEnums[k]);\n }\n }\n }\n return theKeys;\n };\n }\n var has;\n var toStr;\n var isArgs;\n var isEnumerable;\n var hasDontEnumBug;\n var hasProtoEnumBug;\n var dontEnums;\n var equalsConstructorPrototype;\n var excludedKeys;\n var hasAutomationEqualityBug;\n var equalsConstructorPrototypeIfNotBuggy;\n module.exports = keysShim;\n }\n });\n\n // node_modules/object-keys/index.js\n var require_object_keys = __commonJS({\n \"node_modules/object-keys/index.js\"(exports, module) {\n \"use strict\";\n var slice = Array.prototype.slice;\n var isArgs = require_isArguments();\n var origKeys = Object.keys;\n var keysShim = origKeys ? function keys(o) {\n return origKeys(o);\n } : require_implementation2();\n var originalKeys = Object.keys;\n keysShim.shim = function shimObjectKeys() {\n if (Object.keys) {\n var keysWorksWithArguments = function() {\n var args = Object.keys(arguments);\n return args && args.length === arguments.length;\n }(1, 2);\n if (!keysWorksWithArguments) {\n Object.keys = function keys(object) {\n if (isArgs(object)) {\n return originalKeys(slice.call(object));\n }\n return originalKeys(object);\n };\n }\n } else {\n Object.keys = keysShim;\n }\n return Object.keys || keysShim;\n };\n module.exports = keysShim;\n }\n });\n\n // node_modules/object.assign/implementation.js\n var require_implementation3 = __commonJS({\n \"node_modules/object.assign/implementation.js\"(exports, module) {\n \"use strict\";\n var objectKeys = require_object_keys();\n var hasSymbols = require_shams()();\n var callBound = require_callBound();\n var toObject = Object;\n var $push = callBound(\"Array.prototype.push\");\n var $propIsEnumerable = callBound(\"Object.prototype.propertyIsEnumerable\");\n var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;\n module.exports = function assign(target, source1) {\n if (target == null) {\n throw new TypeError(\"target must be an object\");\n }\n var to = toObject(target);\n if (arguments.length === 1) {\n return to;\n }\n for (var s = 1; s < arguments.length; ++s) {\n var from = toObject(arguments[s]);\n var keys = objectKeys(from);\n var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);\n if (getSymbols) {\n var syms = getSymbols(from);\n for (var j = 0; j < syms.length; ++j) {\n var key = syms[j];\n if ($propIsEnumerable(from, key)) {\n $push(keys, key);\n }\n }\n }\n for (var i = 0; i < keys.length; ++i) {\n var nextKey = keys[i];\n if ($propIsEnumerable(from, nextKey)) {\n var propValue = from[nextKey];\n to[nextKey] = propValue;\n }\n }\n }\n return to;\n };\n }\n });\n\n // node_modules/object.assign/polyfill.js\n var require_polyfill = __commonJS({\n \"node_modules/object.assign/polyfill.js\"(exports, module) {\n \"use strict\";\n var implementation = require_implementation3();\n var lacksProperEnumerationOrder = function() {\n if (!Object.assign) {\n return false;\n }\n var str = \"abcdefghijklmnopqrst\";\n var letters = str.split(\"\");\n var map = {};\n for (var i = 0; i < letters.length; ++i) {\n map[letters[i]] = letters[i];\n }\n var obj = Object.assign({}, map);\n var actual = \"\";\n for (var k in obj) {\n actual += k;\n }\n return str !== actual;\n };\n var assignHasPendingExceptions = function() {\n if (!Object.assign || !Object.preventExtensions) {\n return false;\n }\n var thrower = Object.preventExtensions({ 1: 2 });\n try {\n Object.assign(thrower, \"xy\");\n } catch (e) {\n return thrower[1] === \"y\";\n }\n return false;\n };\n module.exports = function getPolyfill() {\n if (!Object.assign) {\n return implementation;\n }\n if (lacksProperEnumerationOrder()) {\n return implementation;\n }\n if (assignHasPendingExceptions()) {\n return implementation;\n }\n return Object.assign;\n };\n }\n });\n\n // node_modules/object-is/implementation.js\n var require_implementation4 = __commonJS({\n \"node_modules/object-is/implementation.js\"(exports, module) {\n \"use strict\";\n var numberIsNaN = function(value) {\n return value !== value;\n };\n module.exports = function is(a, b) {\n if (a === 0 && b === 0) {\n return 1 / a === 1 / b;\n }\n if (a === b) {\n return true;\n }\n if (numberIsNaN(a) && numberIsNaN(b)) {\n return true;\n }\n return false;\n };\n }\n });\n\n // node_modules/object-is/polyfill.js\n var require_polyfill2 = __commonJS({\n \"node_modules/object-is/polyfill.js\"(exports, module) {\n \"use strict\";\n var implementation = require_implementation4();\n module.exports = function getPolyfill() {\n return typeof Object.is === \"function\" ? Object.is : implementation;\n };\n }\n });\n\n // node_modules/define-properties/index.js\n var require_define_properties = __commonJS({\n \"node_modules/define-properties/index.js\"(exports, module) {\n \"use strict\";\n var keys = require_object_keys();\n var hasSymbols = typeof Symbol === \"function\" && typeof Symbol(\"foo\") === \"symbol\";\n var toStr = Object.prototype.toString;\n var concat = Array.prototype.concat;\n var origDefineProperty = Object.defineProperty;\n var isFunction = function(fn) {\n return typeof fn === \"function\" && toStr.call(fn) === \"[object Function]\";\n };\n var hasPropertyDescriptors = require_has_property_descriptors()();\n var supportsDescriptors = origDefineProperty && hasPropertyDescriptors;\n var defineProperty = function(object, name2, value, predicate) {\n if (name2 in object) {\n if (predicate === true) {\n if (object[name2] === value) {\n return;\n }\n } else if (!isFunction(predicate) || !predicate()) {\n return;\n }\n }\n if (supportsDescriptors) {\n origDefineProperty(object, name2, {\n configurable: true,\n enumerable: false,\n value,\n writable: true\n });\n } else {\n object[name2] = value;\n }\n };\n var defineProperties = function(object, map) {\n var predicates = arguments.length > 2 ? arguments[2] : {};\n var props = keys(map);\n if (hasSymbols) {\n props = concat.call(props, Object.getOwnPropertySymbols(map));\n }\n for (var i = 0; i < props.length; i += 1) {\n defineProperty(object, props[i], map[props[i]], predicates[props[i]]);\n }\n };\n defineProperties.supportsDescriptors = !!supportsDescriptors;\n module.exports = defineProperties;\n }\n });\n\n // node_modules/object-is/shim.js\n var require_shim = __commonJS({\n \"node_modules/object-is/shim.js\"(exports, module) {\n \"use strict\";\n var getPolyfill = require_polyfill2();\n var define2 = require_define_properties();\n module.exports = function shimObjectIs() {\n var polyfill = getPolyfill();\n define2(Object, { is: polyfill }, {\n is: function testObjectIs() {\n return Object.is !== polyfill;\n }\n });\n return polyfill;\n };\n }\n });\n\n // node_modules/object-is/index.js\n var require_object_is = __commonJS({\n \"node_modules/object-is/index.js\"(exports, module) {\n \"use strict\";\n var define2 = require_define_properties();\n var callBind = require_call_bind();\n var implementation = require_implementation4();\n var getPolyfill = require_polyfill2();\n var shim = require_shim();\n var polyfill = callBind(getPolyfill(), Object);\n define2(polyfill, {\n getPolyfill,\n implementation,\n shim\n });\n module.exports = polyfill;\n }\n });\n\n // node_modules/is-nan/implementation.js\n var require_implementation5 = __commonJS({\n \"node_modules/is-nan/implementation.js\"(exports, module) {\n \"use strict\";\n module.exports = function isNaN2(value) {\n return value !== value;\n };\n }\n });\n\n // node_modules/is-nan/polyfill.js\n var require_polyfill3 = __commonJS({\n \"node_modules/is-nan/polyfill.js\"(exports, module) {\n \"use strict\";\n var implementation = require_implementation5();\n module.exports = function getPolyfill() {\n if (Number.isNaN && Number.isNaN(NaN) && !Number.isNaN(\"a\")) {\n return Number.isNaN;\n }\n return implementation;\n };\n }\n });\n\n // node_modules/is-nan/shim.js\n var require_shim2 = __commonJS({\n \"node_modules/is-nan/shim.js\"(exports, module) {\n \"use strict\";\n var define2 = require_define_properties();\n var getPolyfill = require_polyfill3();\n module.exports = function shimNumberIsNaN() {\n var polyfill = getPolyfill();\n define2(Number, { isNaN: polyfill }, {\n isNaN: function testIsNaN() {\n return Number.isNaN !== polyfill;\n }\n });\n return polyfill;\n };\n }\n });\n\n // node_modules/is-nan/index.js\n var require_is_nan = __commonJS({\n \"node_modules/is-nan/index.js\"(exports, module) {\n \"use strict\";\n var callBind = require_call_bind();\n var define2 = require_define_properties();\n var implementation = require_implementation5();\n var getPolyfill = require_polyfill3();\n var shim = require_shim2();\n var polyfill = callBind(getPolyfill(), Number);\n define2(polyfill, {\n getPolyfill,\n implementation,\n shim\n });\n module.exports = polyfill;\n }\n });\n\n // node_modules/assert/build/internal/util/comparisons.js\n var require_comparisons = __commonJS({\n \"node_modules/assert/build/internal/util/comparisons.js\"(exports, module) {\n \"use strict\";\n function _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n }\n function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n }\n function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n return arr2;\n }\n function _iterableToArrayLimit(r, l) {\n var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (null != t) {\n var e, n, i, u, a = [], f = true, o = false;\n try {\n if (i = (t = t.call(r)).next, 0 === l) {\n if (Object(t) !== t) return;\n f = false;\n } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = true) ;\n } catch (r2) {\n o = true, n = r2;\n } finally {\n try {\n if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;\n } finally {\n if (o) throw n;\n }\n }\n return a;\n }\n }\n function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n }\n function _typeof(o) {\n \"@babel/helpers - typeof\";\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(o2) {\n return typeof o2;\n } : function(o2) {\n return o2 && \"function\" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? \"symbol\" : typeof o2;\n }, _typeof(o);\n }\n var regexFlagsSupported = /a/g.flags !== void 0;\n var arrayFromSet = function arrayFromSet2(set) {\n var array = [];\n set.forEach(function(value) {\n return array.push(value);\n });\n return array;\n };\n var arrayFromMap = function arrayFromMap2(map) {\n var array = [];\n map.forEach(function(value, key) {\n return array.push([key, value]);\n });\n return array;\n };\n var objectIs = Object.is ? Object.is : require_object_is();\n var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols : function() {\n return [];\n };\n var numberIsNaN = Number.isNaN ? Number.isNaN : require_is_nan();\n function uncurryThis(f) {\n return f.call.bind(f);\n }\n var hasOwnProperty2 = uncurryThis(Object.prototype.hasOwnProperty);\n var propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable);\n var objectToString = uncurryThis(Object.prototype.toString);\n var _require$types = require_util2().types;\n var isAnyArrayBuffer = _require$types.isAnyArrayBuffer;\n var isArrayBufferView = _require$types.isArrayBufferView;\n var isDate = _require$types.isDate;\n var isMap = _require$types.isMap;\n var isRegExp = _require$types.isRegExp;\n var isSet = _require$types.isSet;\n var isNativeError = _require$types.isNativeError;\n var isBoxedPrimitive = _require$types.isBoxedPrimitive;\n var isNumberObject = _require$types.isNumberObject;\n var isStringObject = _require$types.isStringObject;\n var isBooleanObject = _require$types.isBooleanObject;\n var isBigIntObject = _require$types.isBigIntObject;\n var isSymbolObject = _require$types.isSymbolObject;\n var isFloat32Array = _require$types.isFloat32Array;\n var isFloat64Array = _require$types.isFloat64Array;\n function isNonIndex(key) {\n if (key.length === 0 || key.length > 10) return true;\n for (var i = 0; i < key.length; i++) {\n var code = key.charCodeAt(i);\n if (code < 48 || code > 57) return true;\n }\n return key.length === 10 && key >= Math.pow(2, 32);\n }\n function getOwnNonIndexProperties(value) {\n return Object.keys(value).filter(isNonIndex).concat(objectGetOwnPropertySymbols(value).filter(Object.prototype.propertyIsEnumerable.bind(value)));\n }\n function compare(a, b) {\n if (a === b) {\n return 0;\n }\n var x = a.length;\n var y = b.length;\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break;\n }\n }\n if (x < y) {\n return -1;\n }\n if (y < x) {\n return 1;\n }\n return 0;\n }\n var ONLY_ENUMERABLE = void 0;\n var kStrict = true;\n var kLoose = false;\n var kNoIterator = 0;\n var kIsArray = 1;\n var kIsSet = 2;\n var kIsMap = 3;\n function areSimilarRegExps(a, b) {\n return regexFlagsSupported ? a.source === b.source && a.flags === b.flags : RegExp.prototype.toString.call(a) === RegExp.prototype.toString.call(b);\n }\n function areSimilarFloatArrays(a, b) {\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n for (var offset = 0; offset < a.byteLength; offset++) {\n if (a[offset] !== b[offset]) {\n return false;\n }\n }\n return true;\n }\n function areSimilarTypedArrays(a, b) {\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n return compare(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)) === 0;\n }\n function areEqualArrayBuffers(buf1, buf2) {\n return buf1.byteLength === buf2.byteLength && compare(new Uint8Array(buf1), new Uint8Array(buf2)) === 0;\n }\n function isEqualBoxedPrimitive(val1, val2) {\n if (isNumberObject(val1)) {\n return isNumberObject(val2) && objectIs(Number.prototype.valueOf.call(val1), Number.prototype.valueOf.call(val2));\n }\n if (isStringObject(val1)) {\n return isStringObject(val2) && String.prototype.valueOf.call(val1) === String.prototype.valueOf.call(val2);\n }\n if (isBooleanObject(val1)) {\n return isBooleanObject(val2) && Boolean.prototype.valueOf.call(val1) === Boolean.prototype.valueOf.call(val2);\n }\n if (isBigIntObject(val1)) {\n return isBigIntObject(val2) && BigInt.prototype.valueOf.call(val1) === BigInt.prototype.valueOf.call(val2);\n }\n return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2);\n }\n function innerDeepEqual(val1, val2, strict, memos) {\n if (val1 === val2) {\n if (val1 !== 0) return true;\n return strict ? objectIs(val1, val2) : true;\n }\n if (strict) {\n if (_typeof(val1) !== \"object\") {\n return typeof val1 === \"number\" && numberIsNaN(val1) && numberIsNaN(val2);\n }\n if (_typeof(val2) !== \"object\" || val1 === null || val2 === null) {\n return false;\n }\n if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) {\n return false;\n }\n } else {\n if (val1 === null || _typeof(val1) !== \"object\") {\n if (val2 === null || _typeof(val2) !== \"object\") {\n return val1 == val2;\n }\n return false;\n }\n if (val2 === null || _typeof(val2) !== \"object\") {\n return false;\n }\n }\n var val1Tag = objectToString(val1);\n var val2Tag = objectToString(val2);\n if (val1Tag !== val2Tag) {\n return false;\n }\n if (Array.isArray(val1)) {\n if (val1.length !== val2.length) {\n return false;\n }\n var keys1 = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);\n var keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);\n if (keys1.length !== keys2.length) {\n return false;\n }\n return keyCheck(val1, val2, strict, memos, kIsArray, keys1);\n }\n if (val1Tag === \"[object Object]\") {\n if (!isMap(val1) && isMap(val2) || !isSet(val1) && isSet(val2)) {\n return false;\n }\n }\n if (isDate(val1)) {\n if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) {\n return false;\n }\n } else if (isRegExp(val1)) {\n if (!isRegExp(val2) || !areSimilarRegExps(val1, val2)) {\n return false;\n }\n } else if (isNativeError(val1) || val1 instanceof Error) {\n if (val1.message !== val2.message || val1.name !== val2.name) {\n return false;\n }\n } else if (isArrayBufferView(val1)) {\n if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) {\n if (!areSimilarFloatArrays(val1, val2)) {\n return false;\n }\n } else if (!areSimilarTypedArrays(val1, val2)) {\n return false;\n }\n var _keys = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);\n var _keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);\n if (_keys.length !== _keys2.length) {\n return false;\n }\n return keyCheck(val1, val2, strict, memos, kNoIterator, _keys);\n } else if (isSet(val1)) {\n if (!isSet(val2) || val1.size !== val2.size) {\n return false;\n }\n return keyCheck(val1, val2, strict, memos, kIsSet);\n } else if (isMap(val1)) {\n if (!isMap(val2) || val1.size !== val2.size) {\n return false;\n }\n return keyCheck(val1, val2, strict, memos, kIsMap);\n } else if (isAnyArrayBuffer(val1)) {\n if (!areEqualArrayBuffers(val1, val2)) {\n return false;\n }\n } else if (isBoxedPrimitive(val1) && !isEqualBoxedPrimitive(val1, val2)) {\n return false;\n }\n return keyCheck(val1, val2, strict, memos, kNoIterator);\n }\n function getEnumerables(val, keys) {\n return keys.filter(function(k) {\n return propertyIsEnumerable(val, k);\n });\n }\n function keyCheck(val1, val2, strict, memos, iterationType, aKeys) {\n if (arguments.length === 5) {\n aKeys = Object.keys(val1);\n var bKeys = Object.keys(val2);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n }\n var i = 0;\n for (; i < aKeys.length; i++) {\n if (!hasOwnProperty2(val2, aKeys[i])) {\n return false;\n }\n }\n if (strict && arguments.length === 5) {\n var symbolKeysA = objectGetOwnPropertySymbols(val1);\n if (symbolKeysA.length !== 0) {\n var count = 0;\n for (i = 0; i < symbolKeysA.length; i++) {\n var key = symbolKeysA[i];\n if (propertyIsEnumerable(val1, key)) {\n if (!propertyIsEnumerable(val2, key)) {\n return false;\n }\n aKeys.push(key);\n count++;\n } else if (propertyIsEnumerable(val2, key)) {\n return false;\n }\n }\n var symbolKeysB = objectGetOwnPropertySymbols(val2);\n if (symbolKeysA.length !== symbolKeysB.length && getEnumerables(val2, symbolKeysB).length !== count) {\n return false;\n }\n } else {\n var _symbolKeysB = objectGetOwnPropertySymbols(val2);\n if (_symbolKeysB.length !== 0 && getEnumerables(val2, _symbolKeysB).length !== 0) {\n return false;\n }\n }\n }\n if (aKeys.length === 0 && (iterationType === kNoIterator || iterationType === kIsArray && val1.length === 0 || val1.size === 0)) {\n return true;\n }\n if (memos === void 0) {\n memos = {\n val1: /* @__PURE__ */ new Map(),\n val2: /* @__PURE__ */ new Map(),\n position: 0\n };\n } else {\n var val2MemoA = memos.val1.get(val1);\n if (val2MemoA !== void 0) {\n var val2MemoB = memos.val2.get(val2);\n if (val2MemoB !== void 0) {\n return val2MemoA === val2MemoB;\n }\n }\n memos.position++;\n }\n memos.val1.set(val1, memos.position);\n memos.val2.set(val2, memos.position);\n var areEq = objEquiv(val1, val2, strict, aKeys, memos, iterationType);\n memos.val1.delete(val1);\n memos.val2.delete(val2);\n return areEq;\n }\n function setHasEqualElement(set, val1, strict, memo) {\n var setValues = arrayFromSet(set);\n for (var i = 0; i < setValues.length; i++) {\n var val2 = setValues[i];\n if (innerDeepEqual(val1, val2, strict, memo)) {\n set.delete(val2);\n return true;\n }\n }\n return false;\n }\n function findLooseMatchingPrimitives(prim) {\n switch (_typeof(prim)) {\n case \"undefined\":\n return null;\n case \"object\":\n return void 0;\n case \"symbol\":\n return false;\n case \"string\":\n prim = +prim;\n // Loose equal entries exist only if the string is possible to convert to\n // a regular number and not NaN.\n // Fall through\n case \"number\":\n if (numberIsNaN(prim)) {\n return false;\n }\n }\n return true;\n }\n function setMightHaveLoosePrim(a, b, prim) {\n var altValue = findLooseMatchingPrimitives(prim);\n if (altValue != null) return altValue;\n return b.has(altValue) && !a.has(altValue);\n }\n function mapMightHaveLoosePrim(a, b, prim, item, memo) {\n var altValue = findLooseMatchingPrimitives(prim);\n if (altValue != null) {\n return altValue;\n }\n var curB = b.get(altValue);\n if (curB === void 0 && !b.has(altValue) || !innerDeepEqual(item, curB, false, memo)) {\n return false;\n }\n return !a.has(altValue) && innerDeepEqual(item, curB, false, memo);\n }\n function setEquiv(a, b, strict, memo) {\n var set = null;\n var aValues = arrayFromSet(a);\n for (var i = 0; i < aValues.length; i++) {\n var val = aValues[i];\n if (_typeof(val) === \"object\" && val !== null) {\n if (set === null) {\n set = /* @__PURE__ */ new Set();\n }\n set.add(val);\n } else if (!b.has(val)) {\n if (strict) return false;\n if (!setMightHaveLoosePrim(a, b, val)) {\n return false;\n }\n if (set === null) {\n set = /* @__PURE__ */ new Set();\n }\n set.add(val);\n }\n }\n if (set !== null) {\n var bValues = arrayFromSet(b);\n for (var _i = 0; _i < bValues.length; _i++) {\n var _val = bValues[_i];\n if (_typeof(_val) === \"object\" && _val !== null) {\n if (!setHasEqualElement(set, _val, strict, memo)) return false;\n } else if (!strict && !a.has(_val) && !setHasEqualElement(set, _val, strict, memo)) {\n return false;\n }\n }\n return set.size === 0;\n }\n return true;\n }\n function mapHasEqualEntry(set, map, key1, item1, strict, memo) {\n var setValues = arrayFromSet(set);\n for (var i = 0; i < setValues.length; i++) {\n var key2 = setValues[i];\n if (innerDeepEqual(key1, key2, strict, memo) && innerDeepEqual(item1, map.get(key2), strict, memo)) {\n set.delete(key2);\n return true;\n }\n }\n return false;\n }\n function mapEquiv(a, b, strict, memo) {\n var set = null;\n var aEntries = arrayFromMap(a);\n for (var i = 0; i < aEntries.length; i++) {\n var _aEntries$i = _slicedToArray(aEntries[i], 2), key = _aEntries$i[0], item1 = _aEntries$i[1];\n if (_typeof(key) === \"object\" && key !== null) {\n if (set === null) {\n set = /* @__PURE__ */ new Set();\n }\n set.add(key);\n } else {\n var item2 = b.get(key);\n if (item2 === void 0 && !b.has(key) || !innerDeepEqual(item1, item2, strict, memo)) {\n if (strict) return false;\n if (!mapMightHaveLoosePrim(a, b, key, item1, memo)) return false;\n if (set === null) {\n set = /* @__PURE__ */ new Set();\n }\n set.add(key);\n }\n }\n }\n if (set !== null) {\n var bEntries = arrayFromMap(b);\n for (var _i2 = 0; _i2 < bEntries.length; _i2++) {\n var _bEntries$_i = _slicedToArray(bEntries[_i2], 2), _key = _bEntries$_i[0], item = _bEntries$_i[1];\n if (_typeof(_key) === \"object\" && _key !== null) {\n if (!mapHasEqualEntry(set, a, _key, item, strict, memo)) return false;\n } else if (!strict && (!a.has(_key) || !innerDeepEqual(a.get(_key), item, false, memo)) && !mapHasEqualEntry(set, a, _key, item, false, memo)) {\n return false;\n }\n }\n return set.size === 0;\n }\n return true;\n }\n function objEquiv(a, b, strict, keys, memos, iterationType) {\n var i = 0;\n if (iterationType === kIsSet) {\n if (!setEquiv(a, b, strict, memos)) {\n return false;\n }\n } else if (iterationType === kIsMap) {\n if (!mapEquiv(a, b, strict, memos)) {\n return false;\n }\n } else if (iterationType === kIsArray) {\n for (; i < a.length; i++) {\n if (hasOwnProperty2(a, i)) {\n if (!hasOwnProperty2(b, i) || !innerDeepEqual(a[i], b[i], strict, memos)) {\n return false;\n }\n } else if (hasOwnProperty2(b, i)) {\n return false;\n } else {\n var keysA = Object.keys(a);\n for (; i < keysA.length; i++) {\n var key = keysA[i];\n if (!hasOwnProperty2(b, key) || !innerDeepEqual(a[key], b[key], strict, memos)) {\n return false;\n }\n }\n if (keysA.length !== Object.keys(b).length) {\n return false;\n }\n return true;\n }\n }\n }\n for (i = 0; i < keys.length; i++) {\n var _key2 = keys[i];\n if (!innerDeepEqual(a[_key2], b[_key2], strict, memos)) {\n return false;\n }\n }\n return true;\n }\n function isDeepEqual(val1, val2) {\n return innerDeepEqual(val1, val2, kLoose);\n }\n function isDeepStrictEqual(val1, val2) {\n return innerDeepEqual(val1, val2, kStrict);\n }\n module.exports = {\n isDeepEqual,\n isDeepStrictEqual\n };\n }\n });\n\n // node_modules/assert/build/assert.js\n var require_assert = __commonJS({\n \"node_modules/assert/build/assert.js\"(exports, module) {\n \"use strict\";\n function _typeof(o) {\n \"@babel/helpers - typeof\";\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(o2) {\n return typeof o2;\n } : function(o2) {\n return o2 && \"function\" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? \"symbol\" : typeof o2;\n }, _typeof(o);\n }\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", { writable: false });\n return Constructor;\n }\n function _toPropertyKey(arg) {\n var key = _toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n }\n function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== void 0) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n var _require = require_errors();\n var _require$codes = _require.codes;\n var ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT;\n var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;\n var ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE;\n var ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE;\n var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;\n var AssertionError = require_assertion_error();\n var _require2 = require_util2();\n var inspect = _require2.inspect;\n var _require$types = require_util2().types;\n var isPromise = _require$types.isPromise;\n var isRegExp = _require$types.isRegExp;\n var objectAssign = require_polyfill()();\n var objectIs = require_polyfill2()();\n var RegExpPrototypeTest = require_callBound()(\"RegExp.prototype.test\");\n var isDeepEqual;\n var isDeepStrictEqual;\n function lazyLoadComparison() {\n var comparison = require_comparisons();\n isDeepEqual = comparison.isDeepEqual;\n isDeepStrictEqual = comparison.isDeepStrictEqual;\n }\n var warned = false;\n var assert = module.exports = ok;\n var NO_EXCEPTION_SENTINEL = {};\n function innerFail(obj) {\n if (obj.message instanceof Error) throw obj.message;\n throw new AssertionError(obj);\n }\n function fail(actual, expected, message, operator, stackStartFn) {\n var argsLen = arguments.length;\n var internalMessage;\n if (argsLen === 0) {\n internalMessage = \"Failed\";\n } else if (argsLen === 1) {\n message = actual;\n actual = void 0;\n } else {\n if (warned === false) {\n warned = true;\n var warn = process.emitWarning ? process.emitWarning : console.warn.bind(console);\n warn(\"assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.\", \"DeprecationWarning\", \"DEP0094\");\n }\n if (argsLen === 2) operator = \"!=\";\n }\n if (message instanceof Error) throw message;\n var errArgs = {\n actual,\n expected,\n operator: operator === void 0 ? \"fail\" : operator,\n stackStartFn: stackStartFn || fail\n };\n if (message !== void 0) {\n errArgs.message = message;\n }\n var err = new AssertionError(errArgs);\n if (internalMessage) {\n err.message = internalMessage;\n err.generatedMessage = true;\n }\n throw err;\n }\n assert.fail = fail;\n assert.AssertionError = AssertionError;\n function innerOk(fn, argLen, value, message) {\n if (!value) {\n var generatedMessage = false;\n if (argLen === 0) {\n generatedMessage = true;\n message = \"No value argument passed to `assert.ok()`\";\n } else if (message instanceof Error) {\n throw message;\n }\n var err = new AssertionError({\n actual: value,\n expected: true,\n message,\n operator: \"==\",\n stackStartFn: fn\n });\n err.generatedMessage = generatedMessage;\n throw err;\n }\n }\n function ok() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n innerOk.apply(void 0, [ok, args.length].concat(args));\n }\n assert.ok = ok;\n assert.equal = function equal(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n }\n if (actual != expected) {\n innerFail({\n actual,\n expected,\n message,\n operator: \"==\",\n stackStartFn: equal\n });\n }\n };\n assert.notEqual = function notEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n }\n if (actual == expected) {\n innerFail({\n actual,\n expected,\n message,\n operator: \"!=\",\n stackStartFn: notEqual\n });\n }\n };\n assert.deepEqual = function deepEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n }\n if (isDeepEqual === void 0) lazyLoadComparison();\n if (!isDeepEqual(actual, expected)) {\n innerFail({\n actual,\n expected,\n message,\n operator: \"deepEqual\",\n stackStartFn: deepEqual\n });\n }\n };\n assert.notDeepEqual = function notDeepEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n }\n if (isDeepEqual === void 0) lazyLoadComparison();\n if (isDeepEqual(actual, expected)) {\n innerFail({\n actual,\n expected,\n message,\n operator: \"notDeepEqual\",\n stackStartFn: notDeepEqual\n });\n }\n };\n assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n }\n if (isDeepEqual === void 0) lazyLoadComparison();\n if (!isDeepStrictEqual(actual, expected)) {\n innerFail({\n actual,\n expected,\n message,\n operator: \"deepStrictEqual\",\n stackStartFn: deepStrictEqual\n });\n }\n };\n assert.notDeepStrictEqual = notDeepStrictEqual;\n function notDeepStrictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n }\n if (isDeepEqual === void 0) lazyLoadComparison();\n if (isDeepStrictEqual(actual, expected)) {\n innerFail({\n actual,\n expected,\n message,\n operator: \"notDeepStrictEqual\",\n stackStartFn: notDeepStrictEqual\n });\n }\n }\n assert.strictEqual = function strictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n }\n if (!objectIs(actual, expected)) {\n innerFail({\n actual,\n expected,\n message,\n operator: \"strictEqual\",\n stackStartFn: strictEqual\n });\n }\n };\n assert.notStrictEqual = function notStrictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS(\"actual\", \"expected\");\n }\n if (objectIs(actual, expected)) {\n innerFail({\n actual,\n expected,\n message,\n operator: \"notStrictEqual\",\n stackStartFn: notStrictEqual\n });\n }\n };\n var Comparison = /* @__PURE__ */ _createClass(function Comparison2(obj, keys, actual) {\n var _this = this;\n _classCallCheck(this, Comparison2);\n keys.forEach(function(key) {\n if (key in obj) {\n if (actual !== void 0 && typeof actual[key] === \"string\" && isRegExp(obj[key]) && RegExpPrototypeTest(obj[key], actual[key])) {\n _this[key] = actual[key];\n } else {\n _this[key] = obj[key];\n }\n }\n });\n });\n function compareExceptionKey(actual, expected, key, message, keys, fn) {\n if (!(key in actual) || !isDeepStrictEqual(actual[key], expected[key])) {\n if (!message) {\n var a = new Comparison(actual, keys);\n var b = new Comparison(expected, keys, actual);\n var err = new AssertionError({\n actual: a,\n expected: b,\n operator: \"deepStrictEqual\",\n stackStartFn: fn\n });\n err.actual = actual;\n err.expected = expected;\n err.operator = fn.name;\n throw err;\n }\n innerFail({\n actual,\n expected,\n message,\n operator: fn.name,\n stackStartFn: fn\n });\n }\n }\n function expectedException(actual, expected, msg, fn) {\n if (typeof expected !== \"function\") {\n if (isRegExp(expected)) return RegExpPrototypeTest(expected, actual);\n if (arguments.length === 2) {\n throw new ERR_INVALID_ARG_TYPE(\"expected\", [\"Function\", \"RegExp\"], expected);\n }\n if (_typeof(actual) !== \"object\" || actual === null) {\n var err = new AssertionError({\n actual,\n expected,\n message: msg,\n operator: \"deepStrictEqual\",\n stackStartFn: fn\n });\n err.operator = fn.name;\n throw err;\n }\n var keys = Object.keys(expected);\n if (expected instanceof Error) {\n keys.push(\"name\", \"message\");\n } else if (keys.length === 0) {\n throw new ERR_INVALID_ARG_VALUE(\"error\", expected, \"may not be an empty object\");\n }\n if (isDeepEqual === void 0) lazyLoadComparison();\n keys.forEach(function(key) {\n if (typeof actual[key] === \"string\" && isRegExp(expected[key]) && RegExpPrototypeTest(expected[key], actual[key])) {\n return;\n }\n compareExceptionKey(actual, expected, key, msg, keys, fn);\n });\n return true;\n }\n if (expected.prototype !== void 0 && actual instanceof expected) {\n return true;\n }\n if (Error.isPrototypeOf(expected)) {\n return false;\n }\n return expected.call({}, actual) === true;\n }\n function getActual(fn) {\n if (typeof fn !== \"function\") {\n throw new ERR_INVALID_ARG_TYPE(\"fn\", \"Function\", fn);\n }\n try {\n fn();\n } catch (e) {\n return e;\n }\n return NO_EXCEPTION_SENTINEL;\n }\n function checkIsPromise(obj) {\n return isPromise(obj) || obj !== null && _typeof(obj) === \"object\" && typeof obj.then === \"function\" && typeof obj.catch === \"function\";\n }\n function waitForActual(promiseFn) {\n return Promise.resolve().then(function() {\n var resultPromise;\n if (typeof promiseFn === \"function\") {\n resultPromise = promiseFn();\n if (!checkIsPromise(resultPromise)) {\n throw new ERR_INVALID_RETURN_VALUE(\"instance of Promise\", \"promiseFn\", resultPromise);\n }\n } else if (checkIsPromise(promiseFn)) {\n resultPromise = promiseFn;\n } else {\n throw new ERR_INVALID_ARG_TYPE(\"promiseFn\", [\"Function\", \"Promise\"], promiseFn);\n }\n return Promise.resolve().then(function() {\n return resultPromise;\n }).then(function() {\n return NO_EXCEPTION_SENTINEL;\n }).catch(function(e) {\n return e;\n });\n });\n }\n function expectsError(stackStartFn, actual, error, message) {\n if (typeof error === \"string\") {\n if (arguments.length === 4) {\n throw new ERR_INVALID_ARG_TYPE(\"error\", [\"Object\", \"Error\", \"Function\", \"RegExp\"], error);\n }\n if (_typeof(actual) === \"object\" && actual !== null) {\n if (actual.message === error) {\n throw new ERR_AMBIGUOUS_ARGUMENT(\"error/message\", 'The error message \"'.concat(actual.message, '\" is identical to the message.'));\n }\n } else if (actual === error) {\n throw new ERR_AMBIGUOUS_ARGUMENT(\"error/message\", 'The error \"'.concat(actual, '\" is identical to the message.'));\n }\n message = error;\n error = void 0;\n } else if (error != null && _typeof(error) !== \"object\" && typeof error !== \"function\") {\n throw new ERR_INVALID_ARG_TYPE(\"error\", [\"Object\", \"Error\", \"Function\", \"RegExp\"], error);\n }\n if (actual === NO_EXCEPTION_SENTINEL) {\n var details = \"\";\n if (error && error.name) {\n details += \" (\".concat(error.name, \")\");\n }\n details += message ? \": \".concat(message) : \".\";\n var fnType = stackStartFn.name === \"rejects\" ? \"rejection\" : \"exception\";\n innerFail({\n actual: void 0,\n expected: error,\n operator: stackStartFn.name,\n message: \"Missing expected \".concat(fnType).concat(details),\n stackStartFn\n });\n }\n if (error && !expectedException(actual, error, message, stackStartFn)) {\n throw actual;\n }\n }\n function expectsNoError(stackStartFn, actual, error, message) {\n if (actual === NO_EXCEPTION_SENTINEL) return;\n if (typeof error === \"string\") {\n message = error;\n error = void 0;\n }\n if (!error || expectedException(actual, error)) {\n var details = message ? \": \".concat(message) : \".\";\n var fnType = stackStartFn.name === \"doesNotReject\" ? \"rejection\" : \"exception\";\n innerFail({\n actual,\n expected: error,\n operator: stackStartFn.name,\n message: \"Got unwanted \".concat(fnType).concat(details, \"\\n\") + 'Actual message: \"'.concat(actual && actual.message, '\"'),\n stackStartFn\n });\n }\n throw actual;\n }\n assert.throws = function throws(promiseFn) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args));\n };\n assert.rejects = function rejects(promiseFn) {\n for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n args[_key3 - 1] = arguments[_key3];\n }\n return waitForActual(promiseFn).then(function(result) {\n return expectsError.apply(void 0, [rejects, result].concat(args));\n });\n };\n assert.doesNotThrow = function doesNotThrow(fn) {\n for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n args[_key4 - 1] = arguments[_key4];\n }\n expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args));\n };\n assert.doesNotReject = function doesNotReject(fn) {\n for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {\n args[_key5 - 1] = arguments[_key5];\n }\n return waitForActual(fn).then(function(result) {\n return expectsNoError.apply(void 0, [doesNotReject, result].concat(args));\n });\n };\n assert.ifError = function ifError(err) {\n if (err !== null && err !== void 0) {\n var message = \"ifError got unwanted exception: \";\n if (_typeof(err) === \"object\" && typeof err.message === \"string\") {\n if (err.message.length === 0 && err.constructor) {\n message += err.constructor.name;\n } else {\n message += err.message;\n }\n } else {\n message += inspect(err);\n }\n var newErr = new AssertionError({\n actual: err,\n expected: null,\n operator: \"ifError\",\n message,\n stackStartFn: ifError\n });\n var origStack = err.stack;\n if (typeof origStack === \"string\") {\n var tmp2 = origStack.split(\"\\n\");\n tmp2.shift();\n var tmp1 = newErr.stack.split(\"\\n\");\n for (var i = 0; i < tmp2.length; i++) {\n var pos = tmp1.indexOf(tmp2[i]);\n if (pos !== -1) {\n tmp1 = tmp1.slice(0, pos);\n break;\n }\n }\n newErr.stack = \"\".concat(tmp1.join(\"\\n\"), \"\\n\").concat(tmp2.join(\"\\n\"));\n }\n throw newErr;\n }\n };\n function internalMatch(string, regexp, message, fn, fnName) {\n if (!isRegExp(regexp)) {\n throw new ERR_INVALID_ARG_TYPE(\"regexp\", \"RegExp\", regexp);\n }\n var match = fnName === \"match\";\n if (typeof string !== \"string\" || RegExpPrototypeTest(regexp, string) !== match) {\n if (message instanceof Error) {\n throw message;\n }\n var generatedMessage = !message;\n message = message || (typeof string !== \"string\" ? 'The \"string\" argument must be of type string. Received type ' + \"\".concat(_typeof(string), \" (\").concat(inspect(string), \")\") : (match ? \"The input did not match the regular expression \" : \"The input was expected to not match the regular expression \") + \"\".concat(inspect(regexp), \". Input:\\n\\n\").concat(inspect(string), \"\\n\"));\n var err = new AssertionError({\n actual: string,\n expected: regexp,\n message,\n operator: fnName,\n stackStartFn: fn\n });\n err.generatedMessage = generatedMessage;\n throw err;\n }\n }\n assert.match = function match(string, regexp, message) {\n internalMatch(string, regexp, message, match, \"match\");\n };\n assert.doesNotMatch = function doesNotMatch(string, regexp, message) {\n internalMatch(string, regexp, message, doesNotMatch, \"doesNotMatch\");\n };\n function strict() {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n innerOk.apply(void 0, [strict, args.length].concat(args));\n }\n assert.strict = objectAssign(strict, assert, {\n equal: assert.strictEqual,\n deepEqual: assert.deepStrictEqual,\n notEqual: assert.notStrictEqual,\n notDeepEqual: assert.notDeepStrictEqual\n });\n assert.strict.strict = assert.strict;\n }\n });\n\n // node_modules/stream-parser/node_modules/ms/index.js\n var require_ms = __commonJS({\n \"node_modules/stream-parser/node_modules/ms/index.js\"(exports, module) {\n var s = 1e3;\n var m = s * 60;\n var h = m * 60;\n var d = h * 24;\n var y = d * 365.25;\n module.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === \"string\" && val.length > 0) {\n return parse2(val);\n } else if (type === \"number\" && isNaN(val) === false) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n \"val is not a non-empty string or a valid number. val=\" + JSON.stringify(val)\n );\n };\n function parse2(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^((?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || \"ms\").toLowerCase();\n switch (type) {\n case \"years\":\n case \"year\":\n case \"yrs\":\n case \"yr\":\n case \"y\":\n return n * y;\n case \"days\":\n case \"day\":\n case \"d\":\n return n * d;\n case \"hours\":\n case \"hour\":\n case \"hrs\":\n case \"hr\":\n case \"h\":\n return n * h;\n case \"minutes\":\n case \"minute\":\n case \"mins\":\n case \"min\":\n case \"m\":\n return n * m;\n case \"seconds\":\n case \"second\":\n case \"secs\":\n case \"sec\":\n case \"s\":\n return n * s;\n case \"milliseconds\":\n case \"millisecond\":\n case \"msecs\":\n case \"msec\":\n case \"ms\":\n return n;\n default:\n return void 0;\n }\n }\n function fmtShort(ms) {\n if (ms >= d) {\n return Math.round(ms / d) + \"d\";\n }\n if (ms >= h) {\n return Math.round(ms / h) + \"h\";\n }\n if (ms >= m) {\n return Math.round(ms / m) + \"m\";\n }\n if (ms >= s) {\n return Math.round(ms / s) + \"s\";\n }\n return ms + \"ms\";\n }\n function fmtLong(ms) {\n return plural(ms, d, \"day\") || plural(ms, h, \"hour\") || plural(ms, m, \"minute\") || plural(ms, s, \"second\") || ms + \" ms\";\n }\n function plural(ms, n, name2) {\n if (ms < n) {\n return;\n }\n if (ms < n * 1.5) {\n return Math.floor(ms / n) + \" \" + name2;\n }\n return Math.ceil(ms / n) + \" \" + name2 + \"s\";\n }\n }\n });\n\n // node_modules/stream-parser/node_modules/debug/src/debug.js\n var require_debug = __commonJS({\n \"node_modules/stream-parser/node_modules/debug/src/debug.js\"(exports, module) {\n exports = module.exports = createDebug.debug = createDebug[\"default\"] = createDebug;\n exports.coerce = coerce;\n exports.disable = disable;\n exports.enable = enable;\n exports.enabled = enabled;\n exports.humanize = require_ms();\n exports.names = [];\n exports.skips = [];\n exports.formatters = {};\n var prevTime;\n function selectColor(namespace) {\n var hash = 0, i;\n for (i in namespace) {\n hash = (hash << 5) - hash + namespace.charCodeAt(i);\n hash |= 0;\n }\n return exports.colors[Math.abs(hash) % exports.colors.length];\n }\n function createDebug(namespace) {\n function debug() {\n if (!debug.enabled) return;\n var self2 = debug;\n var curr = +/* @__PURE__ */ new Date();\n var ms = curr - (prevTime || curr);\n self2.diff = ms;\n self2.prev = prevTime;\n self2.curr = curr;\n prevTime = curr;\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n args[0] = exports.coerce(args[0]);\n if (\"string\" !== typeof args[0]) {\n args.unshift(\"%O\");\n }\n var index = 0;\n args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {\n if (match === \"%%\") return match;\n index++;\n var formatter = exports.formatters[format];\n if (\"function\" === typeof formatter) {\n var val = args[index];\n match = formatter.call(self2, val);\n args.splice(index, 1);\n index--;\n }\n return match;\n });\n exports.formatArgs.call(self2, args);\n var logFn = debug.log || exports.log || console.log.bind(console);\n logFn.apply(self2, args);\n }\n debug.namespace = namespace;\n debug.enabled = exports.enabled(namespace);\n debug.useColors = exports.useColors();\n debug.color = selectColor(namespace);\n if (\"function\" === typeof exports.init) {\n exports.init(debug);\n }\n return debug;\n }\n function enable(namespaces) {\n exports.save(namespaces);\n exports.names = [];\n exports.skips = [];\n var split = (typeof namespaces === \"string\" ? namespaces : \"\").split(/[\\s,]+/);\n var len = split.length;\n for (var i = 0; i < len; i++) {\n if (!split[i]) continue;\n namespaces = split[i].replace(/\\*/g, \".*?\");\n if (namespaces[0] === \"-\") {\n exports.skips.push(new RegExp(\"^\" + namespaces.substr(1) + \"$\"));\n } else {\n exports.names.push(new RegExp(\"^\" + namespaces + \"$\"));\n }\n }\n }\n function disable() {\n exports.enable(\"\");\n }\n function enabled(name2) {\n var i, len;\n for (i = 0, len = exports.skips.length; i < len; i++) {\n if (exports.skips[i].test(name2)) {\n return false;\n }\n }\n for (i = 0, len = exports.names.length; i < len; i++) {\n if (exports.names[i].test(name2)) {\n return true;\n }\n }\n return false;\n }\n function coerce(val) {\n if (val instanceof Error) return val.stack || val.message;\n return val;\n }\n }\n });\n\n // node_modules/stream-parser/node_modules/debug/src/browser.js\n var require_browser2 = __commonJS({\n \"node_modules/stream-parser/node_modules/debug/src/browser.js\"(exports, module) {\n exports = module.exports = require_debug();\n exports.log = log;\n exports.formatArgs = formatArgs;\n exports.save = save;\n exports.load = load;\n exports.useColors = useColors;\n exports.storage = \"undefined\" != typeof chrome && \"undefined\" != typeof chrome.storage ? chrome.storage.local : localstorage();\n exports.colors = [\n \"lightseagreen\",\n \"forestgreen\",\n \"goldenrod\",\n \"dodgerblue\",\n \"darkorchid\",\n \"crimson\"\n ];\n function useColors() {\n if (typeof window !== \"undefined\" && window.process && window.process.type === \"renderer\") {\n return true;\n }\n return typeof document !== \"undefined\" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // is firebug? http://stackoverflow.com/a/398120/376773\n typeof window !== \"undefined\" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // is firefox >= v31?\n // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n typeof navigator !== \"undefined\" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // double check webkit in userAgent just in case we are in a worker\n typeof navigator !== \"undefined\" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/);\n }\n exports.formatters.j = function(v) {\n try {\n return JSON.stringify(v);\n } catch (err) {\n return \"[UnexpectedJSONParseError]: \" + err.message;\n }\n };\n function formatArgs(args) {\n var useColors2 = this.useColors;\n args[0] = (useColors2 ? \"%c\" : \"\") + this.namespace + (useColors2 ? \" %c\" : \" \") + args[0] + (useColors2 ? \"%c \" : \" \") + \"+\" + exports.humanize(this.diff);\n if (!useColors2) return;\n var c = \"color: \" + this.color;\n args.splice(1, 0, c, \"color: inherit\");\n var index = 0;\n var lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, function(match) {\n if (\"%%\" === match) return;\n index++;\n if (\"%c\" === match) {\n lastC = index;\n }\n });\n args.splice(lastC, 0, c);\n }\n function log() {\n return \"object\" === typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments);\n }\n function save(namespaces) {\n try {\n if (null == namespaces) {\n exports.storage.removeItem(\"debug\");\n } else {\n exports.storage.debug = namespaces;\n }\n } catch (e) {\n }\n }\n function load() {\n var r;\n try {\n r = exports.storage.debug;\n } catch (e) {\n }\n if (!r && typeof process !== \"undefined\" && \"env\" in process) {\n r = process.env.DEBUG;\n }\n return r;\n }\n exports.enable(load());\n function localstorage() {\n try {\n return window.localStorage;\n } catch (e) {\n }\n }\n }\n });\n\n // node_modules/stream-parser/index.js\n var require_stream_parser = __commonJS({\n \"node_modules/stream-parser/index.js\"(exports, module) {\n var assert = require_assert();\n var debug = require_browser2()(\"stream-parser\");\n module.exports = Parser;\n var INIT = -1;\n var BUFFERING = 0;\n var SKIPPING = 1;\n var PASSTHROUGH = 2;\n function Parser(stream) {\n var isTransform = stream && \"function\" == typeof stream._transform;\n var isWritable = stream && \"function\" == typeof stream._write;\n if (!isTransform && !isWritable) throw new Error(\"must pass a Writable or Transform stream in\");\n debug(\"extending Parser into stream\");\n stream._bytes = _bytes;\n stream._skipBytes = _skipBytes;\n if (isTransform) stream._passthrough = _passthrough;\n if (isTransform) {\n stream._transform = transform;\n } else {\n stream._write = write;\n }\n }\n function init(stream) {\n debug(\"initializing parser stream\");\n stream._parserBytesLeft = 0;\n stream._parserBuffers = [];\n stream._parserBuffered = 0;\n stream._parserState = INIT;\n stream._parserCallback = null;\n if (\"function\" == typeof stream.push) {\n stream._parserOutput = stream.push.bind(stream);\n }\n stream._parserInit = true;\n }\n function _bytes(n, fn) {\n assert(!this._parserCallback, 'there is already a \"callback\" set!');\n assert(isFinite(n) && n > 0, 'can only buffer a finite number of bytes > 0, got \"' + n + '\"');\n if (!this._parserInit) init(this);\n debug(\"buffering %o bytes\", n);\n this._parserBytesLeft = n;\n this._parserCallback = fn;\n this._parserState = BUFFERING;\n }\n function _skipBytes(n, fn) {\n assert(!this._parserCallback, 'there is already a \"callback\" set!');\n assert(n > 0, 'can only skip > 0 bytes, got \"' + n + '\"');\n if (!this._parserInit) init(this);\n debug(\"skipping %o bytes\", n);\n this._parserBytesLeft = n;\n this._parserCallback = fn;\n this._parserState = SKIPPING;\n }\n function _passthrough(n, fn) {\n assert(!this._parserCallback, 'There is already a \"callback\" set!');\n assert(n > 0, 'can only pass through > 0 bytes, got \"' + n + '\"');\n if (!this._parserInit) init(this);\n debug(\"passing through %o bytes\", n);\n this._parserBytesLeft = n;\n this._parserCallback = fn;\n this._parserState = PASSTHROUGH;\n }\n function write(chunk, encoding, fn) {\n if (!this._parserInit) init(this);\n debug(\"write(%o bytes)\", chunk.length);\n if (\"function\" == typeof encoding) fn = encoding;\n data(this, chunk, null, fn);\n }\n function transform(chunk, output, fn) {\n if (!this._parserInit) init(this);\n debug(\"transform(%o bytes)\", chunk.length);\n if (\"function\" != typeof output) {\n output = this._parserOutput;\n }\n data(this, chunk, output, fn);\n }\n function _data(stream, chunk, output, fn) {\n if (stream._parserBytesLeft <= 0) {\n return fn(new Error(\"got data but not currently parsing anything\"));\n }\n if (chunk.length <= stream._parserBytesLeft) {\n return function() {\n return process2(stream, chunk, output, fn);\n };\n } else {\n return function() {\n var b = chunk.slice(0, stream._parserBytesLeft);\n return process2(stream, b, output, function(err) {\n if (err) return fn(err);\n if (chunk.length > b.length) {\n return function() {\n return _data(stream, chunk.slice(b.length), output, fn);\n };\n }\n });\n };\n }\n }\n function process2(stream, chunk, output, fn) {\n stream._parserBytesLeft -= chunk.length;\n debug(\"%o bytes left for stream piece\", stream._parserBytesLeft);\n if (stream._parserState === BUFFERING) {\n stream._parserBuffers.push(chunk);\n stream._parserBuffered += chunk.length;\n } else if (stream._parserState === PASSTHROUGH) {\n output(chunk);\n }\n if (0 === stream._parserBytesLeft) {\n var cb = stream._parserCallback;\n if (cb && stream._parserState === BUFFERING && stream._parserBuffers.length > 1) {\n chunk = Buffer.concat(stream._parserBuffers, stream._parserBuffered);\n }\n if (stream._parserState !== BUFFERING) {\n chunk = null;\n }\n stream._parserCallback = null;\n stream._parserBuffered = 0;\n stream._parserState = INIT;\n stream._parserBuffers.splice(0);\n if (cb) {\n var args = [];\n if (chunk) {\n args.push(chunk);\n } else {\n }\n if (output) {\n args.push(output);\n }\n var async = cb.length > args.length;\n if (async) {\n args.push(trampoline(fn));\n }\n var rtn = cb.apply(stream, args);\n if (!async || fn === rtn) return fn;\n }\n } else {\n return fn;\n }\n }\n var data = trampoline(_data);\n function trampoline(fn) {\n return function() {\n var result = fn.apply(this, arguments);\n while (\"function\" == typeof result) {\n result = result();\n }\n return result;\n };\n }\n }\n });\n\n // node_modules/probe-image-size/lib/common.js\n var require_common = __commonJS({\n \"node_modules/probe-image-size/lib/common.js\"(exports) {\n \"use strict\";\n var Transform = require_stream_browserify().Transform;\n var streamParser = require_stream_parser();\n function ParserStream() {\n Transform.call(this, { readableObjectMode: true });\n }\n ParserStream.prototype = Object.create(Transform.prototype);\n ParserStream.prototype.constructor = ParserStream;\n streamParser(ParserStream.prototype);\n exports.ParserStream = ParserStream;\n exports.sliceEq = function(src, start, dest) {\n for (var i = start, j = 0; j < dest.length; ) {\n if (src[i++] !== dest[j++]) return false;\n }\n return true;\n };\n exports.str2arr = function(str, format) {\n var arr = [], i = 0;\n if (format && format === \"hex\") {\n while (i < str.length) {\n arr.push(parseInt(str.slice(i, i + 2), 16));\n i += 2;\n }\n } else {\n for (; i < str.length; i++) {\n arr.push(str.charCodeAt(i) & 255);\n }\n }\n return arr;\n };\n exports.readUInt16LE = function(data, offset) {\n return data[offset] | data[offset + 1] << 8;\n };\n exports.readUInt16BE = function(data, offset) {\n return data[offset + 1] | data[offset] << 8;\n };\n exports.readUInt32LE = function(data, offset) {\n return data[offset] | data[offset + 1] << 8 | data[offset + 2] << 16 | data[offset + 3] * 16777216;\n };\n exports.readUInt32BE = function(data, offset) {\n return data[offset + 3] | data[offset + 2] << 8 | data[offset + 1] << 16 | data[offset] * 16777216;\n };\n function ProbeError(message, code, statusCode) {\n Error.call(this);\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = new Error().stack || \"\";\n }\n this.name = this.constructor.name;\n this.message = message;\n if (code) this.code = code;\n if (statusCode) this.statusCode = statusCode;\n }\n ProbeError.prototype = Object.create(Error.prototype);\n ProbeError.prototype.constructor = ProbeError;\n exports.ProbeError = ProbeError;\n }\n });\n\n // node_modules/probe-image-size/lib/miaf_utils.js\n var require_miaf_utils = __commonJS({\n \"node_modules/probe-image-size/lib/miaf_utils.js\"(exports, module) {\n \"use strict\";\n var readUInt16BE = require_common().readUInt16BE;\n var readUInt32BE = require_common().readUInt32BE;\n function unbox(data, offset) {\n if (data.length < 4 + offset) return null;\n var size = readUInt32BE(data, offset);\n if (data.length < size + offset || size < 8) return null;\n return {\n boxtype: String.fromCharCode.apply(null, data.slice(offset + 4, offset + 8)),\n data: data.slice(offset + 8, offset + size),\n end: offset + size\n };\n }\n module.exports.unbox = unbox;\n function scan_ipco(data, sandbox) {\n var offset = 0;\n for (; ; ) {\n var box = unbox(data, offset);\n if (!box) break;\n switch (box.boxtype) {\n case \"ispe\":\n sandbox.sizes.push({\n width: readUInt32BE(box.data, 4),\n height: readUInt32BE(box.data, 8)\n });\n break;\n case \"irot\":\n sandbox.transforms.push({\n type: \"irot\",\n value: box.data[0] & 3\n });\n break;\n case \"imir\":\n sandbox.transforms.push({\n type: \"imir\",\n value: box.data[0] & 1\n });\n break;\n }\n offset = box.end;\n }\n }\n function readUIntBE(data, offset, size) {\n var result = 0;\n for (var i = 0; i < size; i++) {\n result = result * 256 + (data[offset + i] || 0);\n }\n return result;\n }\n function scan_iloc(data, sandbox) {\n var offset_size = data[4] >> 4 & 15;\n var length_size = data[4] & 15;\n var base_offset_size = data[5] >> 4 & 15;\n var item_count = readUInt16BE(data, 6);\n var offset = 8;\n for (var i = 0; i < item_count; i++) {\n var item_ID = readUInt16BE(data, offset);\n offset += 2;\n var data_reference_index = readUInt16BE(data, offset);\n offset += 2;\n var base_offset = readUIntBE(data, offset, base_offset_size);\n offset += base_offset_size;\n var extent_count = readUInt16BE(data, offset);\n offset += 2;\n if (data_reference_index === 0 && extent_count === 1) {\n var first_extent_offset = readUIntBE(data, offset, offset_size);\n var first_extent_length = readUIntBE(data, offset + offset_size, length_size);\n sandbox.item_loc[item_ID] = { length: first_extent_length, offset: first_extent_offset + base_offset };\n }\n offset += extent_count * (offset_size + length_size);\n }\n }\n function scan_iinf(data, sandbox) {\n var item_count = readUInt16BE(data, 4);\n var offset = 6;\n for (var i = 0; i < item_count; i++) {\n var box = unbox(data, offset);\n if (!box) break;\n if (box.boxtype === \"infe\") {\n var item_id = readUInt16BE(box.data, 4);\n var item_name = \"\";\n for (var pos = 8; pos < box.data.length && box.data[pos]; pos++) {\n item_name += String.fromCharCode(box.data[pos]);\n }\n sandbox.item_inf[item_name] = item_id;\n }\n offset = box.end;\n }\n }\n function scan_iprp(data, sandbox) {\n var offset = 0;\n for (; ; ) {\n var box = unbox(data, offset);\n if (!box) break;\n if (box.boxtype === \"ipco\") scan_ipco(box.data, sandbox);\n offset = box.end;\n }\n }\n function scan_meta(data, sandbox) {\n var offset = 4;\n for (; ; ) {\n var box = unbox(data, offset);\n if (!box) break;\n if (box.boxtype === \"iprp\") scan_iprp(box.data, sandbox);\n if (box.boxtype === \"iloc\") scan_iloc(box.data, sandbox);\n if (box.boxtype === \"iinf\") scan_iinf(box.data, sandbox);\n offset = box.end;\n }\n }\n function getMaxSize(sizes) {\n var maxWidthSize = sizes.reduce(function(a, b) {\n return a.width > b.width || a.width === b.width && a.height > b.height ? a : b;\n });\n var maxHeightSize = sizes.reduce(function(a, b) {\n return a.height > b.height || a.height === b.height && a.width > b.width ? a : b;\n });\n var maxSize;\n if (maxWidthSize.width > maxHeightSize.height || maxWidthSize.width === maxHeightSize.height && maxWidthSize.height > maxHeightSize.width) {\n maxSize = maxWidthSize;\n } else {\n maxSize = maxHeightSize;\n }\n return maxSize;\n }\n module.exports.readSizeFromMeta = function(data) {\n var sandbox = {\n sizes: [],\n transforms: [],\n item_inf: {},\n item_loc: {}\n };\n scan_meta(data, sandbox);\n if (!sandbox.sizes.length) return;\n var maxSize = getMaxSize(sandbox.sizes);\n var orientation = 1;\n sandbox.transforms.forEach(function(transform) {\n var rotate_ccw = { 1: 6, 2: 5, 3: 8, 4: 7, 5: 4, 6: 3, 7: 2, 8: 1 };\n var mirror_vert = { 1: 4, 2: 3, 3: 2, 4: 1, 5: 6, 6: 5, 7: 8, 8: 7 };\n if (transform.type === \"imir\") {\n if (transform.value === 0) {\n orientation = mirror_vert[orientation];\n } else {\n orientation = mirror_vert[orientation];\n orientation = rotate_ccw[orientation];\n orientation = rotate_ccw[orientation];\n }\n }\n if (transform.type === \"irot\") {\n for (var i = 0; i < transform.value; i++) {\n orientation = rotate_ccw[orientation];\n }\n }\n });\n var exif_location = null;\n if (sandbox.item_inf.Exif) {\n exif_location = sandbox.item_loc[sandbox.item_inf.Exif];\n }\n return {\n width: maxSize.width,\n height: maxSize.height,\n orientation: sandbox.transforms.length ? orientation : null,\n variants: sandbox.sizes,\n exif_location\n };\n };\n module.exports.getMimeType = function(data) {\n var brand = String.fromCharCode.apply(null, data.slice(0, 4));\n var compat = {};\n compat[brand] = true;\n for (var i = 8; i < data.length; i += 4) {\n compat[String.fromCharCode.apply(null, data.slice(i, i + 4))] = true;\n }\n if (!compat.mif1 && !compat.msf1 && !compat.miaf) return;\n if (brand === \"avif\" || brand === \"avis\" || brand === \"avio\") {\n return { type: \"avif\", mime: \"image/avif\" };\n }\n if (brand === \"heic\" || brand === \"heix\") {\n return { type: \"heic\", mime: \"image/heic\" };\n }\n if (brand === \"hevc\" || brand === \"hevx\") {\n return { type: \"heic\", mime: \"image/heic-sequence\" };\n }\n if (compat.avif || compat.avis) {\n return { type: \"avif\", mime: \"image/avif\" };\n }\n if (compat.heic || compat.heix || compat.hevc || compat.hevx || compat.heis) {\n if (compat.msf1) {\n return { type: \"heif\", mime: \"image/heif-sequence\" };\n }\n return { type: \"heif\", mime: \"image/heif\" };\n }\n return { type: \"avif\", mime: \"image/avif\" };\n };\n }\n });\n\n // node_modules/probe-image-size/lib/exif_utils.js\n var require_exif_utils = __commonJS({\n \"node_modules/probe-image-size/lib/exif_utils.js\"(exports, module) {\n \"use strict\";\n function error(message, code) {\n var err = new Error(message);\n err.code = code;\n return err;\n }\n function utf8_decode(str) {\n try {\n return decodeURIComponent(escape(str));\n } catch (_) {\n return str;\n }\n }\n function ExifParser(jpeg_bin, exif_start, exif_end) {\n this.input = jpeg_bin.subarray(exif_start, exif_end);\n this.start = exif_start;\n var sig = String.fromCharCode.apply(null, this.input.subarray(0, 4));\n if (sig !== \"II*\\0\" && sig !== \"MM\\0*\") {\n throw error(\"invalid TIFF signature\", \"EBADDATA\");\n }\n this.big_endian = sig[0] === \"M\";\n }\n ExifParser.prototype.each = function(on_entry) {\n this.aborted = false;\n var offset = this.read_uint32(4);\n this.ifds_to_read = [{\n id: 0,\n offset\n }];\n while (this.ifds_to_read.length > 0 && !this.aborted) {\n var i = this.ifds_to_read.shift();\n if (!i.offset) continue;\n this.scan_ifd(i.id, i.offset, on_entry);\n }\n };\n ExifParser.prototype.read_uint16 = function(offset) {\n var d = this.input;\n if (offset + 2 > d.length) throw error(\"unexpected EOF\", \"EBADDATA\");\n return this.big_endian ? d[offset] * 256 + d[offset + 1] : d[offset] + d[offset + 1] * 256;\n };\n ExifParser.prototype.read_uint32 = function(offset) {\n var d = this.input;\n if (offset + 4 > d.length) throw error(\"unexpected EOF\", \"EBADDATA\");\n return this.big_endian ? d[offset] * 16777216 + d[offset + 1] * 65536 + d[offset + 2] * 256 + d[offset + 3] : d[offset] + d[offset + 1] * 256 + d[offset + 2] * 65536 + d[offset + 3] * 16777216;\n };\n ExifParser.prototype.is_subifd_link = function(ifd, tag) {\n return ifd === 0 && tag === 34665 || // SubIFD\n ifd === 0 && tag === 34853 || // GPS Info\n ifd === 34665 && tag === 40965;\n };\n ExifParser.prototype.exif_format_length = function(format) {\n switch (format) {\n case 1:\n // byte\n case 2:\n // ascii\n case 6:\n // sbyte\n case 7:\n return 1;\n case 3:\n // short\n case 8:\n return 2;\n case 4:\n // long\n case 9:\n // slong\n case 11:\n return 4;\n case 5:\n // rational\n case 10:\n // srational\n case 12:\n return 8;\n default:\n return 0;\n }\n };\n ExifParser.prototype.exif_format_read = function(format, offset) {\n var v;\n switch (format) {\n case 1:\n // byte\n case 2:\n v = this.input[offset];\n return v;\n case 6:\n v = this.input[offset];\n return v | (v & 128) * 33554430;\n case 3:\n v = this.read_uint16(offset);\n return v;\n case 8:\n v = this.read_uint16(offset);\n return v | (v & 32768) * 131070;\n case 4:\n v = this.read_uint32(offset);\n return v;\n case 9:\n v = this.read_uint32(offset);\n return v | 0;\n case 5:\n // rational\n case 10:\n // srational\n case 11:\n // float\n case 12:\n return null;\n // not implemented\n case 7:\n return null;\n // blob\n default:\n return null;\n }\n };\n ExifParser.prototype.scan_ifd = function(ifd_no, offset, on_entry) {\n var entry_count = this.read_uint16(offset);\n offset += 2;\n for (var i = 0; i < entry_count; i++) {\n var tag = this.read_uint16(offset);\n var format = this.read_uint16(offset + 2);\n var count = this.read_uint32(offset + 4);\n var comp_length = this.exif_format_length(format);\n var data_length = count * comp_length;\n var data_offset = data_length <= 4 ? offset + 8 : this.read_uint32(offset + 8);\n var is_subifd_link = false;\n if (data_offset + data_length > this.input.length) {\n throw error(\"unexpected EOF\", \"EBADDATA\");\n }\n var value = [];\n var comp_offset = data_offset;\n for (var j = 0; j < count; j++, comp_offset += comp_length) {\n var item = this.exif_format_read(format, comp_offset);\n if (item === null) {\n value = null;\n break;\n }\n value.push(item);\n }\n if (Array.isArray(value) && format === 2) {\n value = utf8_decode(String.fromCharCode.apply(null, value));\n if (value && value[value.length - 1] === \"\\0\") value = value.slice(0, -1);\n }\n if (this.is_subifd_link(ifd_no, tag)) {\n if (Array.isArray(value) && Number.isInteger(value[0]) && value[0] > 0) {\n this.ifds_to_read.push({\n id: tag,\n offset: value[0]\n });\n is_subifd_link = true;\n }\n }\n var entry = {\n is_big_endian: this.big_endian,\n ifd: ifd_no,\n tag,\n format,\n count,\n entry_offset: offset + this.start,\n data_length,\n data_offset: data_offset + this.start,\n value,\n is_subifd_link\n };\n if (on_entry(entry) === false) {\n this.aborted = true;\n return;\n }\n offset += 12;\n }\n if (ifd_no === 0) {\n this.ifds_to_read.push({\n id: 1,\n offset: this.read_uint32(offset)\n });\n }\n };\n module.exports.ExifParser = ExifParser;\n module.exports.get_orientation = function(data) {\n var orientation = 0;\n try {\n new ExifParser(data, 0, data.length).each(function(entry) {\n if (entry.ifd === 0 && entry.tag === 274 && Array.isArray(entry.value)) {\n orientation = entry.value[0];\n return false;\n }\n });\n return orientation;\n } catch (err) {\n return -1;\n }\n };\n }\n });\n\n // node_modules/probe-image-size/lib/parse_sync/avif.js\n var require_avif = __commonJS({\n \"node_modules/probe-image-size/lib/parse_sync/avif.js\"(exports, module) {\n \"use strict\";\n var str2arr = require_common().str2arr;\n var sliceEq = require_common().sliceEq;\n var readUInt32BE = require_common().readUInt32BE;\n var miaf = require_miaf_utils();\n var exif = require_exif_utils();\n var SIG_FTYP = str2arr(\"ftyp\");\n module.exports = function(data) {\n if (!sliceEq(data, 4, SIG_FTYP)) return;\n var firstBox = miaf.unbox(data, 0);\n if (!firstBox) return;\n var fileType = miaf.getMimeType(firstBox.data);\n if (!fileType) return;\n var meta, offset = firstBox.end;\n for (; ; ) {\n var box = miaf.unbox(data, offset);\n if (!box) break;\n offset = box.end;\n if (box.boxtype === \"mdat\") return;\n if (box.boxtype === \"meta\") {\n meta = box.data;\n break;\n }\n }\n if (!meta) return;\n var imgSize = miaf.readSizeFromMeta(meta);\n if (!imgSize) return;\n var result = {\n width: imgSize.width,\n height: imgSize.height,\n type: fileType.type,\n mime: fileType.mime,\n wUnits: \"px\",\n hUnits: \"px\"\n };\n if (imgSize.variants.length > 1) {\n result.variants = imgSize.variants;\n }\n if (imgSize.orientation) {\n result.orientation = imgSize.orientation;\n }\n if (imgSize.exif_location && imgSize.exif_location.offset + imgSize.exif_location.length <= data.length) {\n var sig_offset = readUInt32BE(data, imgSize.exif_location.offset);\n var exif_data = data.slice(\n imgSize.exif_location.offset + sig_offset + 4,\n imgSize.exif_location.offset + imgSize.exif_location.length\n );\n var orientation = exif.get_orientation(exif_data);\n if (orientation > 0) result.orientation = orientation;\n }\n return result;\n };\n }\n });\n\n // node_modules/probe-image-size/lib/parse_sync/bmp.js\n var require_bmp = __commonJS({\n \"node_modules/probe-image-size/lib/parse_sync/bmp.js\"(exports, module) {\n \"use strict\";\n var str2arr = require_common().str2arr;\n var sliceEq = require_common().sliceEq;\n var readUInt16LE = require_common().readUInt16LE;\n var SIG_BM = str2arr(\"BM\");\n module.exports = function(data) {\n if (data.length < 26) return;\n if (!sliceEq(data, 0, SIG_BM)) return;\n return {\n width: readUInt16LE(data, 18),\n height: readUInt16LE(data, 22),\n type: \"bmp\",\n mime: \"image/bmp\",\n wUnits: \"px\",\n hUnits: \"px\"\n };\n };\n }\n });\n\n // node_modules/probe-image-size/lib/parse_sync/gif.js\n var require_gif = __commonJS({\n \"node_modules/probe-image-size/lib/parse_sync/gif.js\"(exports, module) {\n \"use strict\";\n var str2arr = require_common().str2arr;\n var sliceEq = require_common().sliceEq;\n var readUInt16LE = require_common().readUInt16LE;\n var SIG_GIF87a = str2arr(\"GIF87a\");\n var SIG_GIF89a = str2arr(\"GIF89a\");\n module.exports = function(data) {\n if (data.length < 10) return;\n if (!sliceEq(data, 0, SIG_GIF87a) && !sliceEq(data, 0, SIG_GIF89a)) return;\n return {\n width: readUInt16LE(data, 6),\n height: readUInt16LE(data, 8),\n type: \"gif\",\n mime: \"image/gif\",\n wUnits: \"px\",\n hUnits: \"px\"\n };\n };\n }\n });\n\n // node_modules/probe-image-size/lib/parse_sync/ico.js\n var require_ico = __commonJS({\n \"node_modules/probe-image-size/lib/parse_sync/ico.js\"(exports, module) {\n \"use strict\";\n var readUInt16LE = require_common().readUInt16LE;\n var HEADER = 0;\n var TYPE_ICO = 1;\n var INDEX_SIZE = 16;\n module.exports = function(data) {\n var header = readUInt16LE(data, 0);\n var type = readUInt16LE(data, 2);\n var numImages = readUInt16LE(data, 4);\n if (header !== HEADER || type !== TYPE_ICO || !numImages) {\n return;\n }\n var variants = [];\n var maxSize = { width: 0, height: 0 };\n for (var i = 0; i < numImages; i++) {\n var width = data[6 + INDEX_SIZE * i] || 256;\n var height = data[6 + INDEX_SIZE * i + 1] || 256;\n var size = { width, height };\n variants.push(size);\n if (width > maxSize.width || height > maxSize.height) {\n maxSize = size;\n }\n }\n return {\n width: maxSize.width,\n height: maxSize.height,\n variants,\n type: \"ico\",\n mime: \"image/x-icon\",\n wUnits: \"px\",\n hUnits: \"px\"\n };\n };\n }\n });\n\n // node_modules/probe-image-size/lib/parse_sync/jpeg.js\n var require_jpeg = __commonJS({\n \"node_modules/probe-image-size/lib/parse_sync/jpeg.js\"(exports, module) {\n \"use strict\";\n var readUInt16BE = require_common().readUInt16BE;\n var str2arr = require_common().str2arr;\n var sliceEq = require_common().sliceEq;\n var exif = require_exif_utils();\n var SIG_EXIF = str2arr(\"Exif\\0\\0\");\n module.exports = function(data) {\n if (data.length < 2) return;\n if (data[0] !== 255 || data[1] !== 216 || data[2] !== 255) return;\n var offset = 2;\n for (; ; ) {\n for (; ; ) {\n if (data.length - offset < 2) return;\n if (data[offset++] === 255) break;\n }\n var code = data[offset++];\n var length;\n while (code === 255) code = data[offset++];\n if (208 <= code && code <= 217 || code === 1) {\n length = 0;\n } else if (192 <= code && code <= 254) {\n if (data.length - offset < 2) return;\n length = readUInt16BE(data, offset) - 2;\n offset += 2;\n } else {\n return;\n }\n if (code === 217 || code === 218) {\n return;\n }\n var orientation;\n if (code === 225 && length >= 10 && sliceEq(data, offset, SIG_EXIF)) {\n orientation = exif.get_orientation(data.slice(offset + 6, offset + length));\n }\n if (length >= 5 && (192 <= code && code <= 207) && code !== 196 && code !== 200 && code !== 204) {\n if (data.length - offset < length) return;\n var result = {\n width: readUInt16BE(data, offset + 3),\n height: readUInt16BE(data, offset + 1),\n type: \"jpg\",\n mime: \"image/jpeg\",\n wUnits: \"px\",\n hUnits: \"px\"\n };\n if (orientation > 0) {\n result.orientation = orientation;\n }\n return result;\n }\n offset += length;\n }\n };\n }\n });\n\n // node_modules/probe-image-size/lib/parse_sync/png.js\n var require_png = __commonJS({\n \"node_modules/probe-image-size/lib/parse_sync/png.js\"(exports, module) {\n \"use strict\";\n var str2arr = require_common().str2arr;\n var sliceEq = require_common().sliceEq;\n var readUInt32BE = require_common().readUInt32BE;\n var SIG_PNG = str2arr(\"\\x89PNG\\r\\n\u001A\\n\");\n var SIG_IHDR = str2arr(\"IHDR\");\n module.exports = function(data) {\n if (data.length < 24) return;\n if (!sliceEq(data, 0, SIG_PNG)) return;\n if (!sliceEq(data, 12, SIG_IHDR)) return;\n return {\n width: readUInt32BE(data, 16),\n height: readUInt32BE(data, 20),\n type: \"png\",\n mime: \"image/png\",\n wUnits: \"px\",\n hUnits: \"px\"\n };\n };\n }\n });\n\n // node_modules/probe-image-size/lib/parse_sync/psd.js\n var require_psd = __commonJS({\n \"node_modules/probe-image-size/lib/parse_sync/psd.js\"(exports, module) {\n \"use strict\";\n var str2arr = require_common().str2arr;\n var sliceEq = require_common().sliceEq;\n var readUInt32BE = require_common().readUInt32BE;\n var SIG_8BPS = str2arr(\"8BPS\\0\u0001\");\n module.exports = function(data) {\n if (data.length < 6 + 16) return;\n if (!sliceEq(data, 0, SIG_8BPS)) return;\n return {\n width: readUInt32BE(data, 6 + 12),\n height: readUInt32BE(data, 6 + 8),\n type: \"psd\",\n mime: \"image/vnd.adobe.photoshop\",\n wUnits: \"px\",\n hUnits: \"px\"\n };\n };\n }\n });\n\n // node_modules/probe-image-size/lib/parse_sync/svg.js\n var require_svg = __commonJS({\n \"node_modules/probe-image-size/lib/parse_sync/svg.js\"(exports, module) {\n \"use strict\";\n function isWhiteSpace(chr) {\n return chr === 32 || chr === 9 || chr === 13 || chr === 10;\n }\n function isFinitePositive(val) {\n return typeof val === \"number\" && isFinite(val) && val > 0;\n }\n function canBeSvg(buf) {\n var i = 0, max = buf.length;\n if (buf[0] === 239 && buf[1] === 187 && buf[2] === 191) i = 3;\n while (i < max && isWhiteSpace(buf[i])) i++;\n if (i === max) return false;\n return buf[i] === 60;\n }\n var SVG_HEADER_RE = /<[-_.:a-zA-Z0-9][^>]*>/;\n var SVG_TAG_RE = /^<([-_.:a-zA-Z0-9]+:)?svg\\s/;\n var SVG_WIDTH_RE = /[^-]\\bwidth=\"([^%]+?)\"|[^-]\\bwidth='([^%]+?)'/;\n var SVG_HEIGHT_RE = /\\bheight=\"([^%]+?)\"|\\bheight='([^%]+?)'/;\n var SVG_VIEWBOX_RE = /\\bview[bB]ox=\"(.+?)\"|\\bview[bB]ox='(.+?)'/;\n var SVG_UNITS_RE = /in$|mm$|cm$|pt$|pc$|px$|em$|ex$/;\n function svgAttrs(str) {\n var width = str.match(SVG_WIDTH_RE);\n var height = str.match(SVG_HEIGHT_RE);\n var viewbox = str.match(SVG_VIEWBOX_RE);\n return {\n width: width && (width[1] || width[2]),\n height: height && (height[1] || height[2]),\n viewbox: viewbox && (viewbox[1] || viewbox[2])\n };\n }\n function units(str) {\n if (!SVG_UNITS_RE.test(str)) return \"px\";\n return str.match(SVG_UNITS_RE)[0];\n }\n module.exports = function(data) {\n if (!canBeSvg(data)) return;\n var str = \"\";\n for (var i = 0; i < data.length; i++) {\n str += String.fromCharCode(data[i]);\n }\n var svgTag = (str.match(SVG_HEADER_RE) || [\"\"])[0];\n if (!SVG_TAG_RE.test(svgTag)) return;\n var attrs = svgAttrs(svgTag);\n var width = parseFloat(attrs.width);\n var height = parseFloat(attrs.height);\n if (attrs.width && attrs.height) {\n if (!isFinitePositive(width) || !isFinitePositive(height)) return;\n return {\n width,\n height,\n type: \"svg\",\n mime: \"image/svg+xml\",\n wUnits: units(attrs.width),\n hUnits: units(attrs.height)\n };\n }\n var parts = (attrs.viewbox || \"\").split(\" \");\n var viewbox = {\n width: parts[2],\n height: parts[3]\n };\n var vbWidth = parseFloat(viewbox.width);\n var vbHeight = parseFloat(viewbox.height);\n if (!isFinitePositive(vbWidth) || !isFinitePositive(vbHeight)) return;\n if (units(viewbox.width) !== units(viewbox.height)) return;\n var ratio = vbWidth / vbHeight;\n if (attrs.width) {\n if (!isFinitePositive(width)) return;\n return {\n width,\n height: width / ratio,\n type: \"svg\",\n mime: \"image/svg+xml\",\n wUnits: units(attrs.width),\n hUnits: units(attrs.width)\n };\n }\n if (attrs.height) {\n if (!isFinitePositive(height)) return;\n return {\n width: height * ratio,\n height,\n type: \"svg\",\n mime: \"image/svg+xml\",\n wUnits: units(attrs.height),\n hUnits: units(attrs.height)\n };\n }\n return {\n width: vbWidth,\n height: vbHeight,\n type: \"svg\",\n mime: \"image/svg+xml\",\n wUnits: units(viewbox.width),\n hUnits: units(viewbox.height)\n };\n };\n }\n });\n\n // node_modules/probe-image-size/lib/parse_sync/tiff.js\n var require_tiff = __commonJS({\n \"node_modules/probe-image-size/lib/parse_sync/tiff.js\"(exports, module) {\n \"use strict\";\n var str2arr = require_common().str2arr;\n var sliceEq = require_common().sliceEq;\n var readUInt16LE = require_common().readUInt16LE;\n var readUInt16BE = require_common().readUInt16BE;\n var readUInt32LE = require_common().readUInt32LE;\n var readUInt32BE = require_common().readUInt32BE;\n var SIG_1 = str2arr(\"II*\\0\");\n var SIG_2 = str2arr(\"MM\\0*\");\n function readUInt16(buffer, offset, is_big_endian) {\n return is_big_endian ? readUInt16BE(buffer, offset) : readUInt16LE(buffer, offset);\n }\n function readUInt32(buffer, offset, is_big_endian) {\n return is_big_endian ? readUInt32BE(buffer, offset) : readUInt32LE(buffer, offset);\n }\n function readIFDValue(data, data_offset, is_big_endian) {\n var type = readUInt16(data, data_offset + 2, is_big_endian);\n var values = readUInt32(data, data_offset + 4, is_big_endian);\n if (values !== 1 || type !== 3 && type !== 4) return null;\n if (type === 3) {\n return readUInt16(data, data_offset + 8, is_big_endian);\n }\n return readUInt32(data, data_offset + 8, is_big_endian);\n }\n module.exports = function(data) {\n if (data.length < 8) return;\n if (!sliceEq(data, 0, SIG_1) && !sliceEq(data, 0, SIG_2)) return;\n var is_big_endian = data[0] === 77;\n var count = readUInt32(data, 4, is_big_endian) - 8;\n if (count < 0) return;\n var offset = count + 8;\n if (data.length - offset < 2) return;\n var ifd_size = readUInt16(data, offset + 0, is_big_endian) * 12;\n if (ifd_size <= 0) return;\n offset += 2;\n if (data.length - offset < ifd_size) return;\n var i, width, height, tag;\n for (i = 0; i < ifd_size; i += 12) {\n tag = readUInt16(data, offset + i, is_big_endian);\n if (tag === 256) {\n width = readIFDValue(data, offset + i, is_big_endian);\n } else if (tag === 257) {\n height = readIFDValue(data, offset + i, is_big_endian);\n }\n }\n if (width && height) {\n return {\n width,\n height,\n type: \"tiff\",\n mime: \"image/tiff\",\n wUnits: \"px\",\n hUnits: \"px\"\n };\n }\n };\n }\n });\n\n // node_modules/probe-image-size/lib/parse_sync/webp.js\n var require_webp = __commonJS({\n \"node_modules/probe-image-size/lib/parse_sync/webp.js\"(exports, module) {\n \"use strict\";\n var str2arr = require_common().str2arr;\n var sliceEq = require_common().sliceEq;\n var readUInt16LE = require_common().readUInt16LE;\n var readUInt32LE = require_common().readUInt32LE;\n var exif = require_exif_utils();\n var SIG_RIFF = str2arr(\"RIFF\");\n var SIG_WEBP = str2arr(\"WEBP\");\n function parseVP8(data, offset) {\n if (data[offset + 3] !== 157 || data[offset + 4] !== 1 || data[offset + 5] !== 42) {\n return;\n }\n return {\n width: readUInt16LE(data, offset + 6) & 16383,\n height: readUInt16LE(data, offset + 8) & 16383,\n type: \"webp\",\n mime: \"image/webp\",\n wUnits: \"px\",\n hUnits: \"px\"\n };\n }\n function parseVP8L(data, offset) {\n if (data[offset] !== 47) return;\n var bits = readUInt32LE(data, offset + 1);\n return {\n width: (bits & 16383) + 1,\n height: (bits >> 14 & 16383) + 1,\n type: \"webp\",\n mime: \"image/webp\",\n wUnits: \"px\",\n hUnits: \"px\"\n };\n }\n function parseVP8X(data, offset) {\n return {\n // TODO: replace with `data.readUIntLE(8, 3) + 1`\n // when 0.10 support is dropped\n width: (data[offset + 6] << 16 | data[offset + 5] << 8 | data[offset + 4]) + 1,\n height: (data[offset + 9] << offset | data[offset + 8] << 8 | data[offset + 7]) + 1,\n type: \"webp\",\n mime: \"image/webp\",\n wUnits: \"px\",\n hUnits: \"px\"\n };\n }\n module.exports = function(data) {\n if (data.length < 16) return;\n if (!sliceEq(data, 0, SIG_RIFF) && !sliceEq(data, 8, SIG_WEBP)) return;\n var offset = 12;\n var result = null;\n var exif_orientation = 0;\n var fileLength = readUInt32LE(data, 4) + 8;\n if (fileLength > data.length) return;\n while (offset + 8 < fileLength) {\n if (data[offset] === 0) {\n offset++;\n continue;\n }\n var header = String.fromCharCode.apply(null, data.slice(offset, offset + 4));\n var length = readUInt32LE(data, offset + 4);\n if (header === \"VP8 \" && length >= 10) {\n result = result || parseVP8(data, offset + 8);\n } else if (header === \"VP8L\" && length >= 9) {\n result = result || parseVP8L(data, offset + 8);\n } else if (header === \"VP8X\" && length >= 10) {\n result = result || parseVP8X(data, offset + 8);\n } else if (header === \"EXIF\") {\n exif_orientation = exif.get_orientation(data.slice(offset + 8, offset + 8 + length));\n offset = Infinity;\n }\n offset += 8 + length;\n }\n if (!result) return;\n if (exif_orientation > 0) {\n result.orientation = exif_orientation;\n }\n return result;\n };\n }\n });\n\n // node_modules/probe-image-size/lib/parsers_sync.js\n var require_parsers_sync = __commonJS({\n \"node_modules/probe-image-size/lib/parsers_sync.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n avif: require_avif(),\n bmp: require_bmp(),\n gif: require_gif(),\n ico: require_ico(),\n jpeg: require_jpeg(),\n png: require_png(),\n psd: require_psd(),\n svg: require_svg(),\n tiff: require_tiff(),\n webp: require_webp()\n };\n }\n });\n\n // node_modules/probe-image-size/sync.js\n var require_sync = __commonJS({\n \"node_modules/probe-image-size/sync.js\"(exports, module) {\n \"use strict\";\n var parsers = require_parsers_sync();\n function probeBuffer(buffer) {\n var parser_names = Object.keys(parsers);\n for (var i = 0; i < parser_names.length; i++) {\n var result = parsers[parser_names[i]](buffer);\n if (result) return result;\n }\n return null;\n }\n module.exports = function get_image_size(src) {\n return probeBuffer(src);\n };\n module.exports.parsers = parsers;\n }\n });\n\n // src/traces/image/helpers.js\n var require_helpers14 = __commonJS({\n \"src/traces/image/helpers.js\"(exports) {\n \"use strict\";\n var probeSync = require_sync();\n var dataUri = require_helpers10().IMAGE_URL_PREFIX;\n var Buffer2 = require_buffer().Buffer;\n exports.getImageSize = function(src) {\n var data = src.replace(dataUri, \"\");\n var buff = new Buffer2(data, \"base64\");\n return probeSync(buff);\n };\n }\n });\n\n // src/traces/image/calc.js\n var require_calc15 = __commonJS({\n \"src/traces/image/calc.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var constants = require_constants19();\n var isNumeric = require_fast_isnumeric();\n var Axes = require_axes();\n var maxRowLength = require_lib().maxRowLength;\n var getImageSize = require_helpers14().getImageSize;\n module.exports = function calc(gd, trace) {\n var h;\n var w;\n if (trace._hasZ) {\n h = trace.z.length;\n w = maxRowLength(trace.z);\n } else if (trace._hasSource) {\n var size = getImageSize(trace.source);\n h = size.height;\n w = size.width;\n }\n var xa = Axes.getFromId(gd, trace.xaxis || \"x\");\n var ya = Axes.getFromId(gd, trace.yaxis || \"y\");\n var x0 = xa.d2c(trace.x0) - trace.dx / 2;\n var y0 = ya.d2c(trace.y0) - trace.dy / 2;\n var i;\n var xrange = [x0, x0 + w * trace.dx];\n var yrange = [y0, y0 + h * trace.dy];\n if (xa && xa.type === \"log\") for (i = 0; i < w; i++) xrange.push(x0 + i * trace.dx);\n if (ya && ya.type === \"log\") for (i = 0; i < h; i++) yrange.push(y0 + i * trace.dy);\n trace._extremes[xa._id] = Axes.findExtremes(xa, xrange);\n trace._extremes[ya._id] = Axes.findExtremes(ya, yrange);\n trace._scaler = makeScaler(trace);\n var cd0 = {\n x0,\n y0,\n z: trace.z,\n w,\n h\n };\n return [cd0];\n };\n function scale(zero2, ratio, min, max) {\n return function(c) {\n return Lib.constrain((c - zero2) * ratio, min, max);\n };\n }\n function constrain(min, max) {\n return function(c) {\n return Lib.constrain(c, min, max);\n };\n }\n function makeScaler(trace) {\n var cr = constants.colormodel[trace.colormodel];\n var colormodel = cr.colormodel || trace.colormodel;\n var n = colormodel.length;\n trace._sArray = [];\n for (var k = 0; k < n; k++) {\n if (cr.min[k] !== trace.zmin[k] || cr.max[k] !== trace.zmax[k]) {\n trace._sArray.push(scale(\n trace.zmin[k],\n (cr.max[k] - cr.min[k]) / (trace.zmax[k] - trace.zmin[k]),\n cr.min[k],\n cr.max[k]\n ));\n } else {\n trace._sArray.push(constrain(cr.min[k], cr.max[k]));\n }\n }\n return function(pixel) {\n var c = pixel.slice(0, n);\n for (var k2 = 0; k2 < n; k2++) {\n var ck = c[k2];\n if (!isNumeric(ck)) return false;\n c[k2] = trace._sArray[k2](ck);\n }\n return c;\n };\n }\n }\n });\n\n // src/traces/image/plot.js\n var require_plot11 = __commonJS({\n \"src/traces/image/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var strTranslate = Lib.strTranslate;\n var xmlnsNamespaces = require_xmlns_namespaces();\n var constants = require_constants19();\n var supportsPixelatedImage = require_supports_pixelated_image();\n var PIXELATED_IMAGE_STYLE = require_pixelated_image().STYLE;\n module.exports = function plot(gd, plotinfo, cdimage, imageLayer) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var supportsPixelated = !gd._context._exportedPlot && supportsPixelatedImage();\n Lib.makeTraceGroups(imageLayer, cdimage, \"im\").each(function(cd) {\n var plotGroup = d3.select(this);\n var cd0 = cd[0];\n var trace = cd0.trace;\n var realImage = (trace.zsmooth === \"fast\" || trace.zsmooth === false && supportsPixelated) && !trace._hasZ && trace._hasSource && xa.type === \"linear\" && ya.type === \"linear\";\n trace._realImage = realImage;\n var z = cd0.z;\n var x0 = cd0.x0;\n var y0 = cd0.y0;\n var w = cd0.w;\n var h = cd0.h;\n var dx = trace.dx;\n var dy = trace.dy;\n var left, right, temp, top, bottom, i;\n i = 0;\n while (left === void 0 && i < w) {\n left = xa.c2p(x0 + i * dx);\n i++;\n }\n i = w;\n while (right === void 0 && i > 0) {\n right = xa.c2p(x0 + i * dx);\n i--;\n }\n i = 0;\n while (top === void 0 && i < h) {\n top = ya.c2p(y0 + i * dy);\n i++;\n }\n i = h;\n while (bottom === void 0 && i > 0) {\n bottom = ya.c2p(y0 + i * dy);\n i--;\n }\n if (right < left) {\n temp = right;\n right = left;\n left = temp;\n }\n if (bottom < top) {\n temp = top;\n top = bottom;\n bottom = temp;\n }\n if (!realImage) {\n var extra = 0.5;\n left = Math.max(-extra * xa._length, left);\n right = Math.min((1 + extra) * xa._length, right);\n top = Math.max(-extra * ya._length, top);\n bottom = Math.min((1 + extra) * ya._length, bottom);\n }\n var imageWidth = Math.round(right - left);\n var imageHeight = Math.round(bottom - top);\n var isOffScreen = imageWidth <= 0 || imageHeight <= 0;\n if (isOffScreen) {\n var noImage = plotGroup.selectAll(\"image\").data([]);\n noImage.exit().remove();\n return;\n }\n function drawMagnifiedPixelsOnCanvas(readPixel) {\n var canvas = document.createElement(\"canvas\");\n canvas.width = imageWidth;\n canvas.height = imageHeight;\n var context = canvas.getContext(\"2d\", { willReadFrequently: true });\n var ipx = function(i2) {\n return Lib.constrain(Math.round(xa.c2p(x0 + i2 * dx) - left), 0, imageWidth);\n };\n var jpx = function(j2) {\n return Lib.constrain(Math.round(ya.c2p(y0 + j2 * dy) - top), 0, imageHeight);\n };\n var cr = constants.colormodel[trace.colormodel];\n var colormodel = cr.colormodel || trace.colormodel;\n var fmt = cr.fmt;\n var c;\n for (i = 0; i < cd0.w; i++) {\n var ipx0 = ipx(i);\n var ipx1 = ipx(i + 1);\n if (ipx1 === ipx0 || isNaN(ipx1) || isNaN(ipx0)) continue;\n for (var j = 0; j < cd0.h; j++) {\n var jpx0 = jpx(j);\n var jpx1 = jpx(j + 1);\n if (jpx1 === jpx0 || isNaN(jpx1) || isNaN(jpx0) || !readPixel(i, j)) continue;\n c = trace._scaler(readPixel(i, j));\n if (c) {\n context.fillStyle = colormodel + \"(\" + fmt(c).join(\",\") + \")\";\n } else {\n context.fillStyle = \"rgba(0,0,0,0)\";\n }\n context.fillRect(ipx0, jpx0, ipx1 - ipx0, jpx1 - jpx0);\n }\n }\n return canvas;\n }\n var image3 = plotGroup.selectAll(\"image\").data([cd]);\n image3.enter().append(\"svg:image\").attr({\n xmlns: xmlnsNamespaces.svg,\n preserveAspectRatio: \"none\"\n });\n image3.exit().remove();\n var style = trace.zsmooth === false ? PIXELATED_IMAGE_STYLE : \"\";\n if (realImage) {\n var xRange = Lib.simpleMap(xa.range, xa.r2l);\n var yRange = Lib.simpleMap(ya.range, ya.r2l);\n var flipX = xRange[1] < xRange[0];\n var flipY = yRange[1] > yRange[0];\n if (flipX || flipY) {\n var tx = left + imageWidth / 2;\n var ty = top + imageHeight / 2;\n style += \"transform:\" + strTranslate(tx + \"px\", ty + \"px\") + \"scale(\" + (flipX ? -1 : 1) + \",\" + (flipY ? -1 : 1) + \")\" + strTranslate(-tx + \"px\", -ty + \"px\") + \";\";\n }\n }\n image3.attr(\"style\", style);\n var p = new Promise(function(resolve) {\n if (trace._hasZ) {\n resolve();\n } else if (trace._hasSource) {\n if (trace._canvas && trace._canvas.el.width === w && trace._canvas.el.height === h && trace._canvas.source === trace.source) {\n resolve();\n } else {\n var canvas = document.createElement(\"canvas\");\n canvas.width = w;\n canvas.height = h;\n var context = canvas.getContext(\"2d\", { willReadFrequently: true });\n trace._image = trace._image || new Image();\n var image = trace._image;\n image.onload = function() {\n context.drawImage(image, 0, 0);\n trace._canvas = {\n el: canvas,\n source: trace.source\n };\n resolve();\n };\n image.setAttribute(\"src\", trace.source);\n }\n }\n }).then(function() {\n var href, canvas;\n if (trace._hasZ) {\n canvas = drawMagnifiedPixelsOnCanvas(function(i2, j) {\n var _z = z[j][i2];\n if (Lib.isTypedArray(_z)) _z = Array.from(_z);\n return _z;\n });\n href = canvas.toDataURL(\"image/png\");\n } else if (trace._hasSource) {\n if (realImage) {\n href = trace.source;\n } else {\n var context = trace._canvas.el.getContext(\"2d\", { willReadFrequently: true });\n var data = context.getImageData(0, 0, w, h).data;\n canvas = drawMagnifiedPixelsOnCanvas(function(i2, j) {\n var index = 4 * (j * w + i2);\n return [\n data[index],\n data[index + 1],\n data[index + 2],\n data[index + 3]\n ];\n });\n href = canvas.toDataURL(\"image/png\");\n }\n }\n image3.attr({\n \"xlink:href\": href,\n height: imageHeight,\n width: imageWidth,\n x: left,\n y: top\n });\n });\n gd._promises.push(p);\n });\n };\n }\n });\n\n // src/traces/image/style.js\n var require_style11 = __commonJS({\n \"src/traces/image/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n module.exports = function style(gd) {\n d3.select(gd).selectAll(\".im image\").style(\"opacity\", function(d) {\n return d[0].trace.opacity;\n });\n };\n }\n });\n\n // src/traces/image/hover.js\n var require_hover13 = __commonJS({\n \"src/traces/image/hover.js\"(exports, module) {\n \"use strict\";\n var Fx = require_fx();\n var Lib = require_lib();\n var isArrayOrTypedArray = Lib.isArrayOrTypedArray;\n var constants = require_constants19();\n module.exports = function hoverPoints(pointData, xval, yval) {\n var cd0 = pointData.cd[0];\n var trace = cd0.trace;\n var xa = pointData.xa;\n var ya = pointData.ya;\n if (Fx.inbox(xval - cd0.x0, xval - (cd0.x0 + cd0.w * trace.dx), 0) > 0 || Fx.inbox(yval - cd0.y0, yval - (cd0.y0 + cd0.h * trace.dy), 0) > 0) {\n return;\n }\n var nx = Math.floor((xval - cd0.x0) / trace.dx);\n var ny = Math.floor(Math.abs(yval - cd0.y0) / trace.dy);\n var pixel;\n if (trace._hasZ) {\n pixel = cd0.z[ny][nx];\n } else if (trace._hasSource) {\n pixel = trace._canvas.el.getContext(\"2d\", { willReadFrequently: true }).getImageData(nx, ny, 1, 1).data;\n }\n if (!pixel) return;\n var hoverinfo = cd0.hi || trace.hoverinfo;\n var fmtColor;\n if (hoverinfo) {\n var parts = hoverinfo.split(\"+\");\n if (parts.indexOf(\"all\") !== -1) parts = [\"color\"];\n if (parts.indexOf(\"color\") !== -1) fmtColor = true;\n }\n var cr = constants.colormodel[trace.colormodel];\n var colormodel = cr.colormodel || trace.colormodel;\n var dims = colormodel.length;\n var c = trace._scaler(pixel);\n var s = cr.suffix;\n var colorstring = [];\n if (trace.hovertemplate || fmtColor) {\n colorstring.push(\"[\" + [c[0] + s[0], c[1] + s[1], c[2] + s[2]].join(\", \"));\n if (dims === 4) colorstring.push(\", \" + c[3] + s[3]);\n colorstring.push(\"]\");\n colorstring = colorstring.join(\"\");\n pointData.extraText = colormodel.toUpperCase() + \": \" + colorstring;\n }\n var text;\n if (isArrayOrTypedArray(trace.hovertext) && isArrayOrTypedArray(trace.hovertext[ny])) {\n text = trace.hovertext[ny][nx];\n } else if (isArrayOrTypedArray(trace.text) && isArrayOrTypedArray(trace.text[ny])) {\n text = trace.text[ny][nx];\n }\n var py = ya.c2p(cd0.y0 + (ny + 0.5) * trace.dy);\n var xVal = cd0.x0 + (nx + 0.5) * trace.dx;\n var yVal = cd0.y0 + (ny + 0.5) * trace.dy;\n var zLabel = \"[\" + pixel.slice(0, trace.colormodel.length).join(\", \") + \"]\";\n return [Lib.extendFlat(pointData, {\n index: [ny, nx],\n x0: xa.c2p(cd0.x0 + nx * trace.dx),\n x1: xa.c2p(cd0.x0 + (nx + 1) * trace.dx),\n y0: py,\n y1: py,\n color: c,\n xVal,\n xLabelVal: xVal,\n yVal,\n yLabelVal: yVal,\n zLabelVal: zLabel,\n text,\n hovertemplateLabels: {\n zLabel,\n colorLabel: colorstring,\n \"color[0]Label\": c[0] + s[0],\n \"color[1]Label\": c[1] + s[1],\n \"color[2]Label\": c[2] + s[2],\n \"color[3]Label\": c[3] + s[3]\n }\n })];\n };\n }\n });\n\n // src/traces/image/event_data.js\n var require_event_data7 = __commonJS({\n \"src/traces/image/event_data.js\"(exports, module) {\n \"use strict\";\n module.exports = function eventData(out, pt) {\n if (\"xVal\" in pt) out.x = pt.xVal;\n if (\"yVal\" in pt) out.y = pt.yVal;\n if (pt.xa) out.xaxis = pt.xa;\n if (pt.ya) out.yaxis = pt.ya;\n out.color = pt.color;\n out.colormodel = pt.trace.colormodel;\n if (!out.z) out.z = pt.color;\n return out;\n };\n }\n });\n\n // src/traces/image/index.js\n var require_image = __commonJS({\n \"src/traces/image/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes34(),\n supplyDefaults: require_defaults30(),\n calc: require_calc15(),\n plot: require_plot11(),\n style: require_style11(),\n hoverPoints: require_hover13(),\n eventData: require_event_data7(),\n moduleType: \"trace\",\n name: \"image\",\n basePlotModule: require_cartesian(),\n categories: [\"cartesian\", \"svg\", \"2dMap\", \"noSortingByValue\"],\n animatable: false,\n meta: {}\n };\n }\n });\n\n // lib/image.js\n var require_image2 = __commonJS({\n \"lib/image.js\"(exports, module) {\n \"use strict\";\n module.exports = require_image();\n }\n });\n\n // src/traces/pie/attributes.js\n var require_attributes35 = __commonJS({\n \"src/traces/pie/attributes.js\"(exports, module) {\n \"use strict\";\n var baseAttrs = require_attributes2();\n var domainAttrs = require_domain().attributes;\n var fontAttrs = require_font_attributes();\n var colorAttrs = require_attributes3();\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var extendFlat = require_extend().extendFlat;\n var pattern = require_attributes4().pattern;\n var textFontAttrs = fontAttrs({\n editType: \"plot\",\n arrayOk: true,\n colorEditType: \"plot\"\n });\n module.exports = {\n labels: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n // equivalent of x0 and dx, if label is missing\n label0: {\n valType: \"number\",\n dflt: 0,\n editType: \"calc\"\n },\n dlabel: {\n valType: \"number\",\n dflt: 1,\n editType: \"calc\"\n },\n values: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n marker: {\n colors: {\n valType: \"data_array\",\n // TODO 'color_array' ?\n editType: \"calc\"\n },\n line: {\n color: {\n valType: \"color\",\n dflt: colorAttrs.defaultLine,\n arrayOk: true,\n editType: \"style\"\n },\n width: {\n valType: \"number\",\n min: 0,\n dflt: 0,\n arrayOk: true,\n editType: \"style\"\n },\n editType: \"calc\"\n },\n pattern,\n editType: \"calc\"\n },\n text: {\n valType: \"data_array\",\n editType: \"plot\"\n },\n hovertext: {\n valType: \"string\",\n dflt: \"\",\n arrayOk: true,\n editType: \"style\"\n },\n // 'see eg:'\n // 'https://www.e-education.psu.edu/natureofgeoinfo/sites/www.e-education.psu.edu.natureofgeoinfo/files/image/hisp_pies.gif',\n // '(this example involves a map too - may someday be a whole trace type',\n // 'of its own. but the point is the size of the whole pie is important.)'\n scalegroup: {\n valType: \"string\",\n dflt: \"\",\n editType: \"calc\"\n },\n // labels (legend is handled by plots.attributes.showlegend and layout.hiddenlabels)\n textinfo: {\n valType: \"flaglist\",\n flags: [\"label\", \"text\", \"value\", \"percent\"],\n extras: [\"none\"],\n editType: \"calc\"\n },\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: [\"label\", \"text\", \"value\", \"percent\", \"name\"]\n }),\n hovertemplate: hovertemplateAttrs({}, {\n keys: [\"label\", \"color\", \"value\", \"percent\", \"text\"]\n }),\n texttemplate: texttemplateAttrs({ editType: \"plot\" }, {\n keys: [\"label\", \"color\", \"value\", \"percent\", \"text\"]\n }),\n textposition: {\n valType: \"enumerated\",\n values: [\"inside\", \"outside\", \"auto\", \"none\"],\n dflt: \"auto\",\n arrayOk: true,\n editType: \"plot\"\n },\n textfont: extendFlat({}, textFontAttrs, {}),\n insidetextorientation: {\n valType: \"enumerated\",\n values: [\"horizontal\", \"radial\", \"tangential\", \"auto\"],\n dflt: \"auto\",\n editType: \"plot\"\n },\n insidetextfont: extendFlat({}, textFontAttrs, {}),\n outsidetextfont: extendFlat({}, textFontAttrs, {}),\n automargin: {\n valType: \"boolean\",\n dflt: false,\n editType: \"plot\"\n },\n title: {\n text: {\n valType: \"string\",\n dflt: \"\",\n editType: \"plot\"\n },\n font: extendFlat({}, textFontAttrs, {}),\n position: {\n valType: \"enumerated\",\n values: [\n \"top left\",\n \"top center\",\n \"top right\",\n \"middle center\",\n \"bottom left\",\n \"bottom center\",\n \"bottom right\"\n ],\n editType: \"plot\"\n },\n editType: \"plot\"\n },\n // position and shape\n domain: domainAttrs({ name: \"pie\", trace: true, editType: \"calc\" }),\n hole: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0,\n editType: \"calc\"\n },\n // ordering and direction\n sort: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc\"\n },\n direction: {\n /**\n * there are two common conventions, both of which place the first\n * (largest, if sorted) slice with its left edge at 12 o'clock but\n * succeeding slices follow either cw or ccw from there.\n *\n * see http://visage.co/data-visualization-101-pie-charts/\n */\n valType: \"enumerated\",\n values: [\"clockwise\", \"counterclockwise\"],\n dflt: \"counterclockwise\",\n editType: \"calc\"\n },\n rotation: {\n valType: \"angle\",\n dflt: 0,\n editType: \"calc\"\n },\n pull: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0,\n arrayOk: true,\n editType: \"calc\"\n }\n };\n }\n });\n\n // src/traces/pie/defaults.js\n var require_defaults31 = __commonJS({\n \"src/traces/pie/defaults.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var attributes = require_attributes35();\n var handleDomainDefaults = require_domain().defaults;\n var handleText = require_defaults19().handleText;\n var coercePattern = require_lib().coercePattern;\n function handleLabelsAndValues(labels, values) {\n var hasLabels = Lib.isArrayOrTypedArray(labels);\n var hasValues = Lib.isArrayOrTypedArray(values);\n var len = Math.min(\n hasLabels ? labels.length : Infinity,\n hasValues ? values.length : Infinity\n );\n if (!isFinite(len)) len = 0;\n if (len && hasValues) {\n var hasPositive;\n for (var i = 0; i < len; i++) {\n var v = values[i];\n if (isNumeric(v) && v > 0) {\n hasPositive = true;\n break;\n }\n }\n if (!hasPositive) len = 0;\n }\n return {\n hasLabels,\n hasValues,\n len\n };\n }\n function handleMarkerDefaults(traceIn, traceOut, layout, coerce, isPie) {\n var lineWidth = coerce(\"marker.line.width\");\n if (lineWidth) {\n coerce(\n \"marker.line.color\",\n isPie ? void 0 : layout.paper_bgcolor\n // case of funnelarea, sunburst, icicle, treemap\n );\n }\n var markerColors = coerce(\"marker.colors\");\n coercePattern(coerce, \"marker.pattern\", markerColors);\n if (traceIn.marker && !traceOut.marker.pattern.fgcolor) traceOut.marker.pattern.fgcolor = traceIn.marker.colors;\n if (!traceOut.marker.pattern.bgcolor) traceOut.marker.pattern.bgcolor = layout.paper_bgcolor;\n }\n function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var labels = coerce(\"labels\");\n var values = coerce(\"values\");\n var res = handleLabelsAndValues(labels, values);\n var len = res.len;\n traceOut._hasLabels = res.hasLabels;\n traceOut._hasValues = res.hasValues;\n if (!traceOut._hasLabels && traceOut._hasValues) {\n coerce(\"label0\");\n coerce(\"dlabel\");\n }\n if (!len) {\n traceOut.visible = false;\n return;\n }\n traceOut._length = len;\n handleMarkerDefaults(traceIn, traceOut, layout, coerce, true);\n coerce(\"scalegroup\");\n var textData = coerce(\"text\");\n var textTemplate = coerce(\"texttemplate\");\n var textInfo;\n if (!textTemplate) textInfo = coerce(\"textinfo\", Lib.isArrayOrTypedArray(textData) ? \"text+percent\" : \"percent\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n if (textTemplate || textInfo && textInfo !== \"none\") {\n var textposition = coerce(\"textposition\");\n handleText(traceIn, traceOut, layout, coerce, textposition, {\n moduleHasSelected: false,\n moduleHasUnselected: false,\n moduleHasConstrain: false,\n moduleHasCliponaxis: false,\n moduleHasTextangle: false,\n moduleHasInsideanchor: false\n });\n var hasBoth = Array.isArray(textposition) || textposition === \"auto\";\n var hasOutside = hasBoth || textposition === \"outside\";\n if (hasOutside) {\n coerce(\"automargin\");\n }\n if (textposition === \"inside\" || textposition === \"auto\" || Array.isArray(textposition)) {\n coerce(\"insidetextorientation\");\n }\n } else if (textInfo === \"none\") {\n coerce(\"textposition\", \"none\");\n }\n handleDomainDefaults(traceOut, layout, coerce);\n var hole = coerce(\"hole\");\n var title = coerce(\"title.text\");\n if (title) {\n var titlePosition = coerce(\"title.position\", hole ? \"middle center\" : \"top center\");\n if (!hole && titlePosition === \"middle center\") traceOut.title.position = \"top center\";\n Lib.coerceFont(coerce, \"title.font\", layout.font);\n }\n coerce(\"sort\");\n coerce(\"direction\");\n coerce(\"rotation\");\n coerce(\"pull\");\n }\n module.exports = {\n handleLabelsAndValues,\n handleMarkerDefaults,\n supplyDefaults\n };\n }\n });\n\n // src/traces/pie/layout_attributes.js\n var require_layout_attributes12 = __commonJS({\n \"src/traces/pie/layout_attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n hiddenlabels: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n piecolorway: {\n valType: \"colorlist\",\n editType: \"calc\"\n },\n extendpiecolors: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc\"\n }\n };\n }\n });\n\n // src/traces/pie/layout_defaults.js\n var require_layout_defaults11 = __commonJS({\n \"src/traces/pie/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var layoutAttributes = require_layout_attributes12();\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);\n }\n coerce(\"hiddenlabels\");\n coerce(\"piecolorway\", layoutOut.colorway);\n coerce(\"extendpiecolors\");\n };\n }\n });\n\n // src/traces/pie/calc.js\n var require_calc16 = __commonJS({\n \"src/traces/pie/calc.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var tinycolor = require_tinycolor();\n var Color2 = require_color();\n var extendedColorWayList = {};\n function calc(gd, trace) {\n var cd = [];\n var fullLayout = gd._fullLayout;\n var hiddenLabels = fullLayout.hiddenlabels || [];\n var labels = trace.labels;\n var colors = trace.marker.colors || [];\n var vals = trace.values;\n var len = trace._length;\n var hasValues = trace._hasValues && len;\n var i, pt;\n if (trace.dlabel) {\n labels = new Array(len);\n for (i = 0; i < len; i++) {\n labels[i] = String(trace.label0 + i * trace.dlabel);\n }\n }\n var allThisTraceLabels = {};\n var pullColor = makePullColorFn(fullLayout[\"_\" + trace.type + \"colormap\"]);\n var vTotal = 0;\n var isAggregated = false;\n for (i = 0; i < len; i++) {\n var v, label, hidden;\n if (hasValues) {\n v = vals[i];\n if (!isNumeric(v)) continue;\n v = +v;\n } else v = 1;\n label = labels[i];\n if (label === void 0 || label === \"\") label = i;\n label = String(label);\n var thisLabelIndex = allThisTraceLabels[label];\n if (thisLabelIndex === void 0) {\n allThisTraceLabels[label] = cd.length;\n hidden = hiddenLabels.indexOf(label) !== -1;\n if (!hidden) vTotal += v;\n cd.push({\n v,\n label,\n color: pullColor(colors[i], label),\n i,\n pts: [i],\n hidden\n });\n } else {\n isAggregated = true;\n pt = cd[thisLabelIndex];\n pt.v += v;\n pt.pts.push(i);\n if (!pt.hidden) vTotal += v;\n if (pt.color === false && colors[i]) {\n pt.color = pullColor(colors[i], label);\n }\n }\n }\n cd = cd.filter(function(elem) {\n return elem.v >= 0;\n });\n var shouldSort = trace.type === \"funnelarea\" ? isAggregated : trace.sort;\n if (shouldSort) cd.sort(function(a, b) {\n return b.v - a.v;\n });\n if (cd[0]) cd[0].vTotal = vTotal;\n return cd;\n }\n function makePullColorFn(colorMap) {\n return function pullColor(color2, id) {\n if (!color2) return false;\n color2 = tinycolor(color2);\n if (!color2.isValid()) return false;\n color2 = Color2.addOpacity(color2, color2.getAlpha());\n if (!colorMap[id]) colorMap[id] = color2;\n return color2;\n };\n }\n function crossTraceCalc(gd, plotinfo) {\n var desiredType = (plotinfo || {}).type;\n if (!desiredType) desiredType = \"pie\";\n var fullLayout = gd._fullLayout;\n var calcdata = gd.calcdata;\n var colorWay = fullLayout[desiredType + \"colorway\"];\n var colorMap = fullLayout[\"_\" + desiredType + \"colormap\"];\n if (fullLayout[\"extend\" + desiredType + \"colors\"]) {\n colorWay = generateExtendedColors(colorWay, extendedColorWayList);\n }\n var dfltColorCount = 0;\n for (var i = 0; i < calcdata.length; i++) {\n var cd = calcdata[i];\n var traceType = cd[0].trace.type;\n if (traceType !== desiredType) continue;\n for (var j = 0; j < cd.length; j++) {\n var pt = cd[j];\n if (pt.color === false) {\n if (colorMap[pt.label]) {\n pt.color = colorMap[pt.label];\n } else {\n colorMap[pt.label] = pt.color = colorWay[dfltColorCount % colorWay.length];\n dfltColorCount++;\n }\n }\n }\n }\n }\n function generateExtendedColors(colorList, extendedColorWays) {\n var i;\n var colorString = JSON.stringify(colorList);\n var colors = extendedColorWays[colorString];\n if (!colors) {\n colors = colorList.slice();\n for (i = 0; i < colorList.length; i++) {\n colors.push(tinycolor(colorList[i]).lighten(20).toHexString());\n }\n for (i = 0; i < colorList.length; i++) {\n colors.push(tinycolor(colorList[i]).darken(20).toHexString());\n }\n extendedColorWays[colorString] = colors;\n }\n return colors;\n }\n module.exports = {\n calc,\n crossTraceCalc,\n makePullColorFn,\n generateExtendedColors\n };\n }\n });\n\n // src/traces/pie/event_data.js\n var require_event_data8 = __commonJS({\n \"src/traces/pie/event_data.js\"(exports, module) {\n \"use strict\";\n var appendArrayMultiPointValues = require_helpers2().appendArrayMultiPointValues;\n module.exports = function eventData(pt, trace) {\n var out = {\n curveNumber: trace.index,\n pointNumbers: pt.pts,\n data: trace._input,\n fullData: trace,\n label: pt.label,\n color: pt.color,\n value: pt.v,\n percent: pt.percent,\n text: pt.text,\n bbox: pt.bbox,\n // pt.v (and pt.i below) for backward compatibility\n v: pt.v\n };\n if (pt.pts.length === 1) out.pointNumber = out.i = pt.pts[0];\n appendArrayMultiPointValues(out, trace, pt.pts);\n if (trace.type === \"funnelarea\") {\n delete out.v;\n delete out.i;\n }\n return out;\n };\n }\n });\n\n // src/traces/pie/plot.js\n var require_plot12 = __commonJS({\n \"src/traces/pie/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Plots = require_plots();\n var Fx = require_fx();\n var Color2 = require_color();\n var Drawing = require_drawing();\n var Lib = require_lib();\n var strScale = Lib.strScale;\n var strTranslate = Lib.strTranslate;\n var svgTextUtils = require_svg_text_utils();\n var uniformText = require_uniform_text();\n var recordMinTextSize = uniformText.recordMinTextSize;\n var clearMinTextSize = uniformText.clearMinTextSize;\n var TEXTPAD = require_constants14().TEXTPAD;\n var helpers = require_helpers4();\n var eventData = require_event_data8();\n var isValidTextValue = require_lib().isValidTextValue;\n function plot(gd, cdModule) {\n var isStatic = gd._context.staticPlot;\n var fullLayout = gd._fullLayout;\n var gs = fullLayout._size;\n clearMinTextSize(\"pie\", fullLayout);\n prerenderTitles(cdModule, gd);\n layoutAreas(cdModule, gs);\n var plotGroups = Lib.makeTraceGroups(fullLayout._pielayer, cdModule, \"trace\").each(function(cd) {\n var plotGroup = d3.select(this);\n var cd0 = cd[0];\n var trace = cd0.trace;\n setCoords(cd);\n plotGroup.attr(\"stroke-linejoin\", \"round\");\n plotGroup.each(function() {\n var slices = d3.select(this).selectAll(\"g.slice\").data(cd);\n slices.enter().append(\"g\").classed(\"slice\", true);\n slices.exit().remove();\n var quadrants = [\n [[], []],\n // y<0: x<0, x>=0\n [[], []]\n // y>=0: x<0, x>=0\n ];\n var hasOutsideText = false;\n slices.each(function(pt, i) {\n if (pt.hidden) {\n d3.select(this).selectAll(\"path,g\").remove();\n return;\n }\n pt.pointNumber = pt.i;\n pt.curveNumber = trace.index;\n quadrants[pt.pxmid[1] < 0 ? 0 : 1][pt.pxmid[0] < 0 ? 0 : 1].push(pt);\n var cx = cd0.cx;\n var cy = cd0.cy;\n var sliceTop = d3.select(this);\n var slicePath = sliceTop.selectAll(\"path.surface\").data([pt]);\n slicePath.enter().append(\"path\").classed(\"surface\", true).style({ \"pointer-events\": isStatic ? \"none\" : \"all\" });\n sliceTop.call(attachFxHandlers, gd, cd);\n if (trace.pull) {\n var pull = +helpers.castOption(trace.pull, pt.pts) || 0;\n if (pull > 0) {\n cx += pull * pt.pxmid[0];\n cy += pull * pt.pxmid[1];\n }\n }\n pt.cxFinal = cx;\n pt.cyFinal = cy;\n function arc(start, finish, cw, scale) {\n var dx = scale * (finish[0] - start[0]);\n var dy = scale * (finish[1] - start[1]);\n return \"a\" + scale * cd0.r + \",\" + scale * cd0.r + \" 0 \" + pt.largeArc + (cw ? \" 1 \" : \" 0 \") + dx + \",\" + dy;\n }\n var hole = trace.hole;\n if (pt.v === cd0.vTotal) {\n var outerCircle = \"M\" + (cx + pt.px0[0]) + \",\" + (cy + pt.px0[1]) + arc(pt.px0, pt.pxmid, true, 1) + arc(pt.pxmid, pt.px0, true, 1) + \"Z\";\n if (hole) {\n slicePath.attr(\n \"d\",\n \"M\" + (cx + hole * pt.px0[0]) + \",\" + (cy + hole * pt.px0[1]) + arc(pt.px0, pt.pxmid, false, hole) + arc(pt.pxmid, pt.px0, false, hole) + \"Z\" + outerCircle\n );\n } else slicePath.attr(\"d\", outerCircle);\n } else {\n var outerArc = arc(pt.px0, pt.px1, true, 1);\n if (hole) {\n var rim = 1 - hole;\n slicePath.attr(\n \"d\",\n \"M\" + (cx + hole * pt.px1[0]) + \",\" + (cy + hole * pt.px1[1]) + arc(pt.px1, pt.px0, false, hole) + \"l\" + rim * pt.px0[0] + \",\" + rim * pt.px0[1] + outerArc + \"Z\"\n );\n } else {\n slicePath.attr(\n \"d\",\n \"M\" + cx + \",\" + cy + \"l\" + pt.px0[0] + \",\" + pt.px0[1] + outerArc + \"Z\"\n );\n }\n }\n formatSliceLabel(gd, pt, cd0);\n var textPosition = helpers.castOption(trace.textposition, pt.pts);\n var sliceTextGroup = sliceTop.selectAll(\"g.slicetext\").data(pt.text && textPosition !== \"none\" ? [0] : []);\n sliceTextGroup.enter().append(\"g\").classed(\"slicetext\", true);\n sliceTextGroup.exit().remove();\n sliceTextGroup.each(function() {\n var sliceText = Lib.ensureSingle(d3.select(this), \"text\", \"\", function(s) {\n s.attr(\"data-notex\", 1);\n });\n var font = Lib.ensureUniformFontSize(\n gd,\n textPosition === \"outside\" ? determineOutsideTextFont(trace, pt, fullLayout.font) : determineInsideTextFont(trace, pt, fullLayout.font)\n );\n sliceText.text(pt.text).attr({\n class: \"slicetext\",\n transform: \"\",\n \"text-anchor\": \"middle\"\n }).call(Drawing.font, font).call(svgTextUtils.convertToTspans, gd);\n var textBB = Drawing.bBox(sliceText.node());\n var transform;\n if (textPosition === \"outside\") {\n transform = transformOutsideText(textBB, pt);\n } else {\n transform = transformInsideText(textBB, pt, cd0);\n if (textPosition === \"auto\" && transform.scale < 1) {\n var newFont = Lib.ensureUniformFontSize(gd, trace.outsidetextfont);\n sliceText.call(Drawing.font, newFont);\n textBB = Drawing.bBox(sliceText.node());\n transform = transformOutsideText(textBB, pt);\n }\n }\n var textPosAngle = transform.textPosAngle;\n var textXY = textPosAngle === void 0 ? pt.pxmid : getCoords(cd0.r, textPosAngle);\n transform.targetX = cx + textXY[0] * transform.rCenter + (transform.x || 0);\n transform.targetY = cy + textXY[1] * transform.rCenter + (transform.y || 0);\n computeTransform(transform, textBB);\n if (transform.outside) {\n var targetY = transform.targetY;\n pt.yLabelMin = targetY - textBB.height / 2;\n pt.yLabelMid = targetY;\n pt.yLabelMax = targetY + textBB.height / 2;\n pt.labelExtraX = 0;\n pt.labelExtraY = 0;\n hasOutsideText = true;\n }\n transform.fontSize = font.size;\n recordMinTextSize(trace.type, transform, fullLayout);\n cd[i].transform = transform;\n Lib.setTransormAndDisplay(sliceText, transform);\n });\n });\n var titleTextGroup = d3.select(this).selectAll(\"g.titletext\").data(trace.title.text ? [0] : []);\n titleTextGroup.enter().append(\"g\").classed(\"titletext\", true);\n titleTextGroup.exit().remove();\n titleTextGroup.each(function() {\n var titleText = Lib.ensureSingle(d3.select(this), \"text\", \"\", function(s) {\n s.attr(\"data-notex\", 1);\n });\n var txt = trace.title.text;\n if (trace._meta) {\n txt = Lib.templateString(txt, trace._meta);\n }\n titleText.text(txt).attr({\n class: \"titletext\",\n transform: \"\",\n \"text-anchor\": \"middle\"\n }).call(Drawing.font, trace.title.font).call(svgTextUtils.convertToTspans, gd);\n var transform;\n if (trace.title.position === \"middle center\") {\n transform = positionTitleInside(cd0);\n } else {\n transform = positionTitleOutside(cd0, gs);\n }\n titleText.attr(\n \"transform\",\n strTranslate(transform.x, transform.y) + strScale(Math.min(1, transform.scale)) + strTranslate(transform.tx, transform.ty)\n );\n });\n if (hasOutsideText) scootLabels(quadrants, trace);\n plotTextLines(slices, trace);\n if (hasOutsideText && trace.automargin) {\n var traceBbox = Drawing.bBox(plotGroup.node());\n var domain = trace.domain;\n var vpw = gs.w * (domain.x[1] - domain.x[0]);\n var vph = gs.h * (domain.y[1] - domain.y[0]);\n var xgap = (0.5 * vpw - cd0.r) / gs.w;\n var ygap = (0.5 * vph - cd0.r) / gs.h;\n Plots.autoMargin(gd, \"pie.\" + trace.uid + \".automargin\", {\n xl: domain.x[0] - xgap,\n xr: domain.x[1] + xgap,\n yb: domain.y[0] - ygap,\n yt: domain.y[1] + ygap,\n l: Math.max(cd0.cx - cd0.r - traceBbox.left, 0),\n r: Math.max(traceBbox.right - (cd0.cx + cd0.r), 0),\n b: Math.max(traceBbox.bottom - (cd0.cy + cd0.r), 0),\n t: Math.max(cd0.cy - cd0.r - traceBbox.top, 0),\n pad: 5\n });\n }\n });\n });\n setTimeout(function() {\n plotGroups.selectAll(\"tspan\").each(function() {\n var s = d3.select(this);\n if (s.attr(\"dy\")) s.attr(\"dy\", s.attr(\"dy\"));\n });\n }, 0);\n }\n function plotTextLines(slices, trace) {\n slices.each(function(pt) {\n var sliceTop = d3.select(this);\n if (!pt.labelExtraX && !pt.labelExtraY) {\n sliceTop.select(\"path.textline\").remove();\n return;\n }\n var sliceText = sliceTop.select(\"g.slicetext text\");\n pt.transform.targetX += pt.labelExtraX;\n pt.transform.targetY += pt.labelExtraY;\n Lib.setTransormAndDisplay(sliceText, pt.transform);\n var lineStartX = pt.cxFinal + pt.pxmid[0];\n var lineStartY = pt.cyFinal + pt.pxmid[1];\n var textLinePath = \"M\" + lineStartX + \",\" + lineStartY;\n var finalX = (pt.yLabelMax - pt.yLabelMin) * (pt.pxmid[0] < 0 ? -1 : 1) / 4;\n if (pt.labelExtraX) {\n var yFromX = pt.labelExtraX * pt.pxmid[1] / pt.pxmid[0];\n var yNet = pt.yLabelMid + pt.labelExtraY - (pt.cyFinal + pt.pxmid[1]);\n if (Math.abs(yFromX) > Math.abs(yNet)) {\n textLinePath += \"l\" + yNet * pt.pxmid[0] / pt.pxmid[1] + \",\" + yNet + \"H\" + (lineStartX + pt.labelExtraX + finalX);\n } else {\n textLinePath += \"l\" + pt.labelExtraX + \",\" + yFromX + \"v\" + (yNet - yFromX) + \"h\" + finalX;\n }\n } else {\n textLinePath += \"V\" + (pt.yLabelMid + pt.labelExtraY) + \"h\" + finalX;\n }\n Lib.ensureSingle(sliceTop, \"path\", \"textline\").call(Color2.stroke, trace.outsidetextfont.color).attr({\n \"stroke-width\": Math.min(2, trace.outsidetextfont.size / 8),\n d: textLinePath,\n fill: \"none\"\n });\n });\n }\n function attachFxHandlers(sliceTop, gd, cd) {\n var cd0 = cd[0];\n var cx = cd0.cx;\n var cy = cd0.cy;\n var trace = cd0.trace;\n var isFunnelArea = trace.type === \"funnelarea\";\n if (!(\"_hasHoverLabel\" in trace)) trace._hasHoverLabel = false;\n if (!(\"_hasHoverEvent\" in trace)) trace._hasHoverEvent = false;\n sliceTop.on(\"mouseover\", function(pt) {\n var fullLayout2 = gd._fullLayout;\n var trace2 = gd._fullData[trace.index];\n if (gd._dragging || fullLayout2.hovermode === false) return;\n var hoverinfo = trace2.hoverinfo;\n if (Array.isArray(hoverinfo)) {\n hoverinfo = Fx.castHoverinfo({\n hoverinfo: [helpers.castOption(hoverinfo, pt.pts)],\n _module: trace._module\n }, fullLayout2, 0);\n }\n if (hoverinfo === \"all\") hoverinfo = \"label+text+value+percent+name\";\n if (trace2.hovertemplate || hoverinfo !== \"none\" && hoverinfo !== \"skip\" && hoverinfo) {\n var rInscribed = pt.rInscribed || 0;\n var hoverCenterX = cx + pt.pxmid[0] * (1 - rInscribed);\n var hoverCenterY = cy + pt.pxmid[1] * (1 - rInscribed);\n var separators = fullLayout2.separators;\n var text = [];\n if (hoverinfo && hoverinfo.indexOf(\"label\") !== -1) text.push(pt.label);\n pt.text = helpers.castOption(trace2.hovertext || trace2.text, pt.pts);\n if (hoverinfo && hoverinfo.indexOf(\"text\") !== -1) {\n var tx = pt.text;\n if (Lib.isValidTextValue(tx)) text.push(tx);\n }\n pt.value = pt.v;\n pt.valueLabel = helpers.formatPieValue(pt.v, separators);\n if (hoverinfo && hoverinfo.indexOf(\"value\") !== -1) text.push(pt.valueLabel);\n pt.percent = pt.v / cd0.vTotal;\n pt.percentLabel = helpers.formatPiePercent(pt.percent, separators);\n if (hoverinfo && hoverinfo.indexOf(\"percent\") !== -1) text.push(pt.percentLabel);\n var hoverLabel = trace2.hoverlabel;\n var hoverFont = hoverLabel.font;\n var bbox = [];\n Fx.loneHover({\n trace,\n x0: hoverCenterX - rInscribed * cd0.r,\n x1: hoverCenterX + rInscribed * cd0.r,\n y: hoverCenterY,\n _x0: isFunnelArea ? cx + pt.TL[0] : hoverCenterX - rInscribed * cd0.r,\n _x1: isFunnelArea ? cx + pt.TR[0] : hoverCenterX + rInscribed * cd0.r,\n _y0: isFunnelArea ? cy + pt.TL[1] : hoverCenterY - rInscribed * cd0.r,\n _y1: isFunnelArea ? cy + pt.BL[1] : hoverCenterY + rInscribed * cd0.r,\n text: text.join(\"
    \"),\n name: trace2.hovertemplate || hoverinfo.indexOf(\"name\") !== -1 ? trace2.name : void 0,\n idealAlign: pt.pxmid[0] < 0 ? \"left\" : \"right\",\n color: helpers.castOption(hoverLabel.bgcolor, pt.pts) || pt.color,\n borderColor: helpers.castOption(hoverLabel.bordercolor, pt.pts),\n fontFamily: helpers.castOption(hoverFont.family, pt.pts),\n fontSize: helpers.castOption(hoverFont.size, pt.pts),\n fontColor: helpers.castOption(hoverFont.color, pt.pts),\n nameLength: helpers.castOption(hoverLabel.namelength, pt.pts),\n textAlign: helpers.castOption(hoverLabel.align, pt.pts),\n hovertemplate: helpers.castOption(trace2.hovertemplate, pt.pts),\n hovertemplateLabels: pt,\n eventData: [eventData(pt, trace2)]\n }, {\n container: fullLayout2._hoverlayer.node(),\n outerContainer: fullLayout2._paper.node(),\n gd,\n inOut_bbox: bbox\n });\n pt.bbox = bbox[0];\n trace._hasHoverLabel = true;\n }\n trace._hasHoverEvent = true;\n gd.emit(\"plotly_hover\", {\n points: [eventData(pt, trace2)],\n event: d3.event\n });\n });\n sliceTop.on(\"mouseout\", function(evt) {\n var fullLayout2 = gd._fullLayout;\n var trace2 = gd._fullData[trace.index];\n var pt = d3.select(this).datum();\n if (trace._hasHoverEvent) {\n evt.originalEvent = d3.event;\n gd.emit(\"plotly_unhover\", {\n points: [eventData(pt, trace2)],\n event: d3.event\n });\n trace._hasHoverEvent = false;\n }\n if (trace._hasHoverLabel) {\n Fx.loneUnhover(fullLayout2._hoverlayer.node());\n trace._hasHoverLabel = false;\n }\n });\n sliceTop.on(\"click\", function(pt) {\n var fullLayout2 = gd._fullLayout;\n var trace2 = gd._fullData[trace.index];\n if (gd._dragging || fullLayout2.hovermode === false) return;\n gd._hoverdata = [eventData(pt, trace2)];\n Fx.click(gd, d3.event);\n });\n }\n function determineOutsideTextFont(trace, pt, layoutFont) {\n var color2 = helpers.castOption(trace.outsidetextfont.color, pt.pts) || helpers.castOption(trace.textfont.color, pt.pts) || layoutFont.color;\n var family = helpers.castOption(trace.outsidetextfont.family, pt.pts) || helpers.castOption(trace.textfont.family, pt.pts) || layoutFont.family;\n var size = helpers.castOption(trace.outsidetextfont.size, pt.pts) || helpers.castOption(trace.textfont.size, pt.pts) || layoutFont.size;\n var weight = helpers.castOption(trace.outsidetextfont.weight, pt.pts) || helpers.castOption(trace.textfont.weight, pt.pts) || layoutFont.weight;\n var style = helpers.castOption(trace.outsidetextfont.style, pt.pts) || helpers.castOption(trace.textfont.style, pt.pts) || layoutFont.style;\n var variant = helpers.castOption(trace.outsidetextfont.variant, pt.pts) || helpers.castOption(trace.textfont.variant, pt.pts) || layoutFont.variant;\n var textcase = helpers.castOption(trace.outsidetextfont.textcase, pt.pts) || helpers.castOption(trace.textfont.textcase, pt.pts) || layoutFont.textcase;\n var lineposition = helpers.castOption(trace.outsidetextfont.lineposition, pt.pts) || helpers.castOption(trace.textfont.lineposition, pt.pts) || layoutFont.lineposition;\n var shadow = helpers.castOption(trace.outsidetextfont.shadow, pt.pts) || helpers.castOption(trace.textfont.shadow, pt.pts) || layoutFont.shadow;\n return {\n color: color2,\n family,\n size,\n weight,\n style,\n variant,\n textcase,\n lineposition,\n shadow\n };\n }\n function determineInsideTextFont(trace, pt, layoutFont) {\n var customColor = helpers.castOption(trace.insidetextfont.color, pt.pts);\n if (!customColor && trace._input.textfont) {\n customColor = helpers.castOption(trace._input.textfont.color, pt.pts);\n }\n var family = helpers.castOption(trace.insidetextfont.family, pt.pts) || helpers.castOption(trace.textfont.family, pt.pts) || layoutFont.family;\n var size = helpers.castOption(trace.insidetextfont.size, pt.pts) || helpers.castOption(trace.textfont.size, pt.pts) || layoutFont.size;\n var weight = helpers.castOption(trace.insidetextfont.weight, pt.pts) || helpers.castOption(trace.textfont.weight, pt.pts) || layoutFont.weight;\n var style = helpers.castOption(trace.insidetextfont.style, pt.pts) || helpers.castOption(trace.textfont.style, pt.pts) || layoutFont.style;\n var variant = helpers.castOption(trace.insidetextfont.variant, pt.pts) || helpers.castOption(trace.textfont.variant, pt.pts) || layoutFont.variant;\n var textcase = helpers.castOption(trace.insidetextfont.textcase, pt.pts) || helpers.castOption(trace.textfont.textcase, pt.pts) || layoutFont.textcase;\n var lineposition = helpers.castOption(trace.insidetextfont.lineposition, pt.pts) || helpers.castOption(trace.textfont.lineposition, pt.pts) || layoutFont.lineposition;\n var shadow = helpers.castOption(trace.insidetextfont.shadow, pt.pts) || helpers.castOption(trace.textfont.shadow, pt.pts) || layoutFont.shadow;\n return {\n color: customColor || Color2.contrast(pt.color),\n family,\n size,\n weight,\n style,\n variant,\n textcase,\n lineposition,\n shadow\n };\n }\n function prerenderTitles(cdModule, gd) {\n var cd0, trace;\n for (var i = 0; i < cdModule.length; i++) {\n cd0 = cdModule[i][0];\n trace = cd0.trace;\n if (trace.title.text) {\n var txt = trace.title.text;\n if (trace._meta) {\n txt = Lib.templateString(txt, trace._meta);\n }\n var dummyTitle = Drawing.tester.append(\"text\").attr(\"data-notex\", 1).text(txt).call(Drawing.font, trace.title.font).call(svgTextUtils.convertToTspans, gd);\n var bBox = Drawing.bBox(dummyTitle.node(), true);\n cd0.titleBox = {\n width: bBox.width,\n height: bBox.height\n };\n dummyTitle.remove();\n }\n }\n }\n function transformInsideText(textBB, pt, cd0) {\n var r = cd0.r || pt.rpx1;\n var rInscribed = pt.rInscribed;\n var isEmpty = pt.startangle === pt.stopangle;\n if (isEmpty) {\n return {\n rCenter: 1 - rInscribed,\n scale: 0,\n rotate: 0,\n textPosAngle: 0\n };\n }\n var ring = pt.ring;\n var isCircle = ring === 1 && Math.abs(pt.startangle - pt.stopangle) === Math.PI * 2;\n var halfAngle = pt.halfangle;\n var midAngle = pt.midangle;\n var orientation = cd0.trace.insidetextorientation;\n var isHorizontal = orientation === \"horizontal\";\n var isTangential = orientation === \"tangential\";\n var isRadial = orientation === \"radial\";\n var isAuto = orientation === \"auto\";\n var allTransforms = [];\n var newT;\n if (!isAuto) {\n var considerCrossing = function(angle, key) {\n if (isCrossing(pt, angle)) {\n var dStart = Math.abs(angle - pt.startangle);\n var dStop = Math.abs(angle - pt.stopangle);\n var closestEdge = dStart < dStop ? dStart : dStop;\n if (key === \"tan\") {\n newT = calcTanTransform(textBB, r, ring, closestEdge, 0);\n } else {\n newT = calcRadTransform(textBB, r, ring, closestEdge, Math.PI / 2);\n }\n newT.textPosAngle = angle;\n allTransforms.push(newT);\n }\n };\n var i;\n if (isHorizontal || isTangential) {\n for (i = 4; i >= -4; i -= 2) considerCrossing(Math.PI * i, \"tan\");\n for (i = 4; i >= -4; i -= 2) considerCrossing(Math.PI * (i + 1), \"tan\");\n }\n if (isHorizontal || isRadial) {\n for (i = 4; i >= -4; i -= 2) considerCrossing(Math.PI * (i + 1.5), \"rad\");\n for (i = 4; i >= -4; i -= 2) considerCrossing(Math.PI * (i + 0.5), \"rad\");\n }\n }\n if (isCircle || isAuto || isHorizontal) {\n var textDiameter = Math.sqrt(textBB.width * textBB.width + textBB.height * textBB.height);\n newT = {\n scale: rInscribed * r * 2 / textDiameter,\n // and the center position and rotation in this case\n rCenter: 1 - rInscribed,\n rotate: 0\n };\n newT.textPosAngle = (pt.startangle + pt.stopangle) / 2;\n if (newT.scale >= 1) return newT;\n allTransforms.push(newT);\n }\n if (isAuto || isRadial) {\n newT = calcRadTransform(textBB, r, ring, halfAngle, midAngle);\n newT.textPosAngle = (pt.startangle + pt.stopangle) / 2;\n allTransforms.push(newT);\n }\n if (isAuto || isTangential) {\n newT = calcTanTransform(textBB, r, ring, halfAngle, midAngle);\n newT.textPosAngle = (pt.startangle + pt.stopangle) / 2;\n allTransforms.push(newT);\n }\n var id = 0;\n var maxScale = 0;\n for (var k = 0; k < allTransforms.length; k++) {\n var s = allTransforms[k].scale;\n if (maxScale < s) {\n maxScale = s;\n id = k;\n }\n if (!isAuto && maxScale >= 1) {\n break;\n }\n }\n return allTransforms[id];\n }\n function isCrossing(pt, angle) {\n var start = pt.startangle;\n var stop = pt.stopangle;\n return start > angle && angle > stop || start < angle && angle < stop;\n }\n function calcRadTransform(textBB, r, ring, halfAngle, midAngle) {\n r = Math.max(0, r - 2 * TEXTPAD);\n var a = textBB.width / textBB.height;\n var s = calcMaxHalfSize(a, halfAngle, r, ring);\n return {\n scale: s * 2 / textBB.height,\n rCenter: calcRCenter(a, s / r),\n rotate: calcRotate(midAngle)\n };\n }\n function calcTanTransform(textBB, r, ring, halfAngle, midAngle) {\n r = Math.max(0, r - 2 * TEXTPAD);\n var a = textBB.height / textBB.width;\n var s = calcMaxHalfSize(a, halfAngle, r, ring);\n return {\n scale: s * 2 / textBB.width,\n rCenter: calcRCenter(a, s / r),\n rotate: calcRotate(midAngle + Math.PI / 2)\n };\n }\n function calcRCenter(a, b) {\n return Math.cos(b) - a * b;\n }\n function calcRotate(t) {\n return (180 / Math.PI * t + 720) % 180 - 90;\n }\n function calcMaxHalfSize(a, halfAngle, r, ring) {\n var q = a + 1 / (2 * Math.tan(halfAngle));\n return r * Math.min(\n 1 / (Math.sqrt(q * q + 0.5) + q),\n ring / (Math.sqrt(a * a + ring / 2) + a)\n );\n }\n function getInscribedRadiusFraction(pt, cd0) {\n if (pt.v === cd0.vTotal && !cd0.trace.hole) return 1;\n return Math.min(1 / (1 + 1 / Math.sin(pt.halfangle)), pt.ring / 2);\n }\n function transformOutsideText(textBB, pt) {\n var x = pt.pxmid[0];\n var y = pt.pxmid[1];\n var dx = textBB.width / 2;\n var dy = textBB.height / 2;\n if (x < 0) dx *= -1;\n if (y < 0) dy *= -1;\n return {\n scale: 1,\n rCenter: 1,\n rotate: 0,\n x: dx + Math.abs(dy) * (dx > 0 ? 1 : -1) / 2,\n y: dy / (1 + x * x / (y * y)),\n outside: true\n };\n }\n function positionTitleInside(cd0) {\n var textDiameter = Math.sqrt(cd0.titleBox.width * cd0.titleBox.width + cd0.titleBox.height * cd0.titleBox.height);\n return {\n x: cd0.cx,\n y: cd0.cy,\n scale: cd0.trace.hole * cd0.r * 2 / textDiameter,\n tx: 0,\n ty: -cd0.titleBox.height / 2 + cd0.trace.title.font.size\n };\n }\n function positionTitleOutside(cd0, plotSize) {\n var scaleX = 1;\n var scaleY = 1;\n var maxPull;\n var trace = cd0.trace;\n var topMiddle = {\n x: cd0.cx,\n y: cd0.cy\n };\n var translate = {\n tx: 0,\n ty: 0\n };\n translate.ty += trace.title.font.size;\n maxPull = getMaxPull(trace);\n if (trace.title.position.indexOf(\"top\") !== -1) {\n topMiddle.y -= (1 + maxPull) * cd0.r;\n translate.ty -= cd0.titleBox.height;\n } else if (trace.title.position.indexOf(\"bottom\") !== -1) {\n topMiddle.y += (1 + maxPull) * cd0.r;\n }\n var rx = applyAspectRatio(cd0.r, cd0.trace.aspectratio);\n var maxWidth = plotSize.w * (trace.domain.x[1] - trace.domain.x[0]) / 2;\n if (trace.title.position.indexOf(\"left\") !== -1) {\n maxWidth = maxWidth + rx;\n topMiddle.x -= (1 + maxPull) * rx;\n translate.tx += cd0.titleBox.width / 2;\n } else if (trace.title.position.indexOf(\"center\") !== -1) {\n maxWidth *= 2;\n } else if (trace.title.position.indexOf(\"right\") !== -1) {\n maxWidth = maxWidth + rx;\n topMiddle.x += (1 + maxPull) * rx;\n translate.tx -= cd0.titleBox.width / 2;\n }\n scaleX = maxWidth / cd0.titleBox.width;\n scaleY = getTitleSpace(cd0, plotSize) / cd0.titleBox.height;\n return {\n x: topMiddle.x,\n y: topMiddle.y,\n scale: Math.min(scaleX, scaleY),\n tx: translate.tx,\n ty: translate.ty\n };\n }\n function applyAspectRatio(x, aspectratio) {\n return x / (aspectratio === void 0 ? 1 : aspectratio);\n }\n function getTitleSpace(cd0, plotSize) {\n var trace = cd0.trace;\n var pieBoxHeight = plotSize.h * (trace.domain.y[1] - trace.domain.y[0]);\n return Math.min(cd0.titleBox.height, pieBoxHeight / 2);\n }\n function getMaxPull(trace) {\n var maxPull = trace.pull;\n if (!maxPull) return 0;\n var j;\n if (Lib.isArrayOrTypedArray(maxPull)) {\n maxPull = 0;\n for (j = 0; j < trace.pull.length; j++) {\n if (trace.pull[j] > maxPull) maxPull = trace.pull[j];\n }\n }\n return maxPull;\n }\n function scootLabels(quadrants, trace) {\n var xHalf, yHalf, equatorFirst, farthestX, farthestY, xDiffSign, yDiffSign, thisQuad, oppositeQuad, wholeSide, i, thisQuadOutside, firstOppositeOutsidePt;\n function topFirst(a, b) {\n return a.pxmid[1] - b.pxmid[1];\n }\n function bottomFirst(a, b) {\n return b.pxmid[1] - a.pxmid[1];\n }\n function scootOneLabel(thisPt, prevPt2) {\n if (!prevPt2) prevPt2 = {};\n var prevOuterY = prevPt2.labelExtraY + (yHalf ? prevPt2.yLabelMax : prevPt2.yLabelMin);\n var thisInnerY = yHalf ? thisPt.yLabelMin : thisPt.yLabelMax;\n var thisOuterY = yHalf ? thisPt.yLabelMax : thisPt.yLabelMin;\n var thisSliceOuterY = thisPt.cyFinal + farthestY(thisPt.px0[1], thisPt.px1[1]);\n var newExtraY = prevOuterY - thisInnerY;\n var xBuffer, i2, otherPt, otherOuterY, otherOuterX, newExtraX;\n if (newExtraY * yDiffSign > 0) thisPt.labelExtraY = newExtraY;\n if (!Lib.isArrayOrTypedArray(trace.pull)) return;\n for (i2 = 0; i2 < wholeSide.length; i2++) {\n otherPt = wholeSide[i2];\n if (otherPt === thisPt || (helpers.castOption(trace.pull, thisPt.pts) || 0) >= (helpers.castOption(trace.pull, otherPt.pts) || 0)) {\n continue;\n }\n if ((thisPt.pxmid[1] - otherPt.pxmid[1]) * yDiffSign > 0) {\n otherOuterY = otherPt.cyFinal + farthestY(otherPt.px0[1], otherPt.px1[1]);\n newExtraY = otherOuterY - thisInnerY - thisPt.labelExtraY;\n if (newExtraY * yDiffSign > 0) thisPt.labelExtraY += newExtraY;\n } else if ((thisOuterY + thisPt.labelExtraY - thisSliceOuterY) * yDiffSign > 0) {\n xBuffer = 3 * xDiffSign * Math.abs(i2 - wholeSide.indexOf(thisPt));\n otherOuterX = otherPt.cxFinal + farthestX(otherPt.px0[0], otherPt.px1[0]);\n newExtraX = otherOuterX + xBuffer - (thisPt.cxFinal + thisPt.pxmid[0]) - thisPt.labelExtraX;\n if (newExtraX * xDiffSign > 0) thisPt.labelExtraX += newExtraX;\n }\n }\n }\n for (yHalf = 0; yHalf < 2; yHalf++) {\n equatorFirst = yHalf ? topFirst : bottomFirst;\n farthestY = yHalf ? Math.max : Math.min;\n yDiffSign = yHalf ? 1 : -1;\n for (xHalf = 0; xHalf < 2; xHalf++) {\n farthestX = xHalf ? Math.max : Math.min;\n xDiffSign = xHalf ? 1 : -1;\n thisQuad = quadrants[yHalf][xHalf];\n thisQuad.sort(equatorFirst);\n oppositeQuad = quadrants[1 - yHalf][xHalf];\n wholeSide = oppositeQuad.concat(thisQuad);\n thisQuadOutside = [];\n for (i = 0; i < thisQuad.length; i++) {\n if (thisQuad[i].yLabelMid !== void 0) thisQuadOutside.push(thisQuad[i]);\n }\n firstOppositeOutsidePt = false;\n for (i = 0; yHalf && i < oppositeQuad.length; i++) {\n if (oppositeQuad[i].yLabelMid !== void 0) {\n firstOppositeOutsidePt = oppositeQuad[i];\n break;\n }\n }\n for (i = 0; i < thisQuadOutside.length; i++) {\n var prevPt = i && thisQuadOutside[i - 1];\n if (firstOppositeOutsidePt && !i) prevPt = firstOppositeOutsidePt;\n scootOneLabel(thisQuadOutside[i], prevPt);\n }\n }\n }\n }\n function layoutAreas(cdModule, plotSize) {\n var scaleGroups = [];\n for (var i = 0; i < cdModule.length; i++) {\n var cd0 = cdModule[i][0];\n var trace = cd0.trace;\n var domain = trace.domain;\n var width = plotSize.w * (domain.x[1] - domain.x[0]);\n var height = plotSize.h * (domain.y[1] - domain.y[0]);\n if (trace.title.text && trace.title.position !== \"middle center\") {\n height -= getTitleSpace(cd0, plotSize);\n }\n var rx = width / 2;\n var ry = height / 2;\n if (trace.type === \"funnelarea\" && !trace.scalegroup) {\n ry /= trace.aspectratio;\n }\n cd0.r = Math.min(rx, ry) / (1 + getMaxPull(trace));\n cd0.cx = plotSize.l + plotSize.w * (trace.domain.x[1] + trace.domain.x[0]) / 2;\n cd0.cy = plotSize.t + plotSize.h * (1 - trace.domain.y[0]) - height / 2;\n if (trace.title.text && trace.title.position.indexOf(\"bottom\") !== -1) {\n cd0.cy -= getTitleSpace(cd0, plotSize);\n }\n if (trace.scalegroup && scaleGroups.indexOf(trace.scalegroup) === -1) {\n scaleGroups.push(trace.scalegroup);\n }\n }\n groupScale(cdModule, scaleGroups);\n }\n function groupScale(cdModule, scaleGroups) {\n var cd0, i, trace;\n for (var k = 0; k < scaleGroups.length; k++) {\n var min = Infinity;\n var g = scaleGroups[k];\n for (i = 0; i < cdModule.length; i++) {\n cd0 = cdModule[i][0];\n trace = cd0.trace;\n if (trace.scalegroup === g) {\n var area;\n if (trace.type === \"pie\") {\n area = cd0.r * cd0.r;\n } else if (trace.type === \"funnelarea\") {\n var rx, ry;\n if (trace.aspectratio > 1) {\n rx = cd0.r;\n ry = rx / trace.aspectratio;\n } else {\n ry = cd0.r;\n rx = ry * trace.aspectratio;\n }\n rx *= (1 + trace.baseratio) / 2;\n area = rx * ry;\n }\n min = Math.min(min, area / cd0.vTotal);\n }\n }\n for (i = 0; i < cdModule.length; i++) {\n cd0 = cdModule[i][0];\n trace = cd0.trace;\n if (trace.scalegroup === g) {\n var v = min * cd0.vTotal;\n if (trace.type === \"funnelarea\") {\n v /= (1 + trace.baseratio) / 2;\n v /= trace.aspectratio;\n }\n cd0.r = Math.sqrt(v);\n }\n }\n }\n }\n function setCoords(cd) {\n var cd0 = cd[0];\n var r = cd0.r;\n var trace = cd0.trace;\n var currentAngle = helpers.getRotationAngle(trace.rotation);\n var angleFactor = 2 * Math.PI / cd0.vTotal;\n var firstPt = \"px0\";\n var lastPt = \"px1\";\n var i, cdi, currentCoords;\n if (trace.direction === \"counterclockwise\") {\n for (i = 0; i < cd.length; i++) {\n if (!cd[i].hidden) break;\n }\n if (i === cd.length) return;\n currentAngle += angleFactor * cd[i].v;\n angleFactor *= -1;\n firstPt = \"px1\";\n lastPt = \"px0\";\n }\n currentCoords = getCoords(r, currentAngle);\n for (i = 0; i < cd.length; i++) {\n cdi = cd[i];\n if (cdi.hidden) continue;\n cdi[firstPt] = currentCoords;\n cdi.startangle = currentAngle;\n currentAngle += angleFactor * cdi.v / 2;\n cdi.pxmid = getCoords(r, currentAngle);\n cdi.midangle = currentAngle;\n currentAngle += angleFactor * cdi.v / 2;\n currentCoords = getCoords(r, currentAngle);\n cdi.stopangle = currentAngle;\n cdi[lastPt] = currentCoords;\n cdi.largeArc = cdi.v > cd0.vTotal / 2 ? 1 : 0;\n cdi.halfangle = Math.PI * Math.min(cdi.v / cd0.vTotal, 0.5);\n cdi.ring = 1 - trace.hole;\n cdi.rInscribed = getInscribedRadiusFraction(cdi, cd0);\n }\n }\n function getCoords(r, angle) {\n return [r * Math.sin(angle), -r * Math.cos(angle)];\n }\n function formatSliceLabel(gd, pt, cd0) {\n var fullLayout = gd._fullLayout;\n var trace = cd0.trace;\n var texttemplate = trace.texttemplate;\n var textinfo = trace.textinfo;\n if (!texttemplate && textinfo && textinfo !== \"none\") {\n var parts = textinfo.split(\"+\");\n var hasFlag = function(flag) {\n return parts.indexOf(flag) !== -1;\n };\n var hasLabel = hasFlag(\"label\");\n var hasText = hasFlag(\"text\");\n var hasValue = hasFlag(\"value\");\n var hasPercent = hasFlag(\"percent\");\n var separators = fullLayout.separators;\n var text;\n text = hasLabel ? [pt.label] : [];\n if (hasText) {\n var tx = helpers.getFirstFilled(trace.text, pt.pts);\n if (isValidTextValue(tx)) text.push(tx);\n }\n if (hasValue) text.push(helpers.formatPieValue(pt.v, separators));\n if (hasPercent) text.push(helpers.formatPiePercent(pt.v / cd0.vTotal, separators));\n pt.text = text.join(\"
    \");\n }\n function makeTemplateVariables(pt2) {\n return {\n label: pt2.label,\n value: pt2.v,\n valueLabel: helpers.formatPieValue(pt2.v, fullLayout.separators),\n percent: pt2.v / cd0.vTotal,\n percentLabel: helpers.formatPiePercent(pt2.v / cd0.vTotal, fullLayout.separators),\n color: pt2.color,\n text: pt2.text,\n customdata: Lib.castOption(trace, pt2.i, \"customdata\")\n };\n }\n if (texttemplate) {\n var txt = Lib.castOption(trace, pt.i, \"texttemplate\");\n if (!txt) {\n pt.text = \"\";\n } else {\n var obj = makeTemplateVariables(pt);\n var ptTx = helpers.getFirstFilled(trace.text, pt.pts);\n if (isValidTextValue(ptTx) || ptTx === \"\") obj.text = ptTx;\n pt.text = Lib.texttemplateString(txt, obj, gd._fullLayout._d3locale, obj, trace._meta || {});\n }\n }\n }\n function computeTransform(transform, textBB) {\n var a = transform.rotate * Math.PI / 180;\n var cosA = Math.cos(a);\n var sinA = Math.sin(a);\n var midX = (textBB.left + textBB.right) / 2;\n var midY = (textBB.top + textBB.bottom) / 2;\n transform.textX = midX * cosA - midY * sinA;\n transform.textY = midX * sinA + midY * cosA;\n transform.noCenter = true;\n }\n module.exports = {\n plot,\n formatSliceLabel,\n transformInsideText,\n determineInsideTextFont,\n positionTitleOutside,\n prerenderTitles,\n layoutAreas,\n attachFxHandlers,\n computeTransform\n };\n }\n });\n\n // src/traces/pie/style.js\n var require_style12 = __commonJS({\n \"src/traces/pie/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var styleOne = require_style_one();\n var resizeText = require_uniform_text().resizeText;\n module.exports = function style(gd) {\n var s = gd._fullLayout._pielayer.selectAll(\".trace\");\n resizeText(gd, s, \"pie\");\n s.each(function(cd) {\n var cd0 = cd[0];\n var trace = cd0.trace;\n var traceSelection = d3.select(this);\n traceSelection.style({ opacity: trace.opacity });\n traceSelection.selectAll(\"path.surface\").each(function(pt) {\n d3.select(this).call(styleOne, pt, trace, gd);\n });\n });\n };\n }\n });\n\n // src/traces/pie/base_plot.js\n var require_base_plot = __commonJS({\n \"src/traces/pie/base_plot.js\"(exports) {\n \"use strict\";\n var plots = require_plots();\n exports.name = \"pie\";\n exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) {\n plots.plotBasePlot(exports.name, gd, traces, transitionOpts, makeOnCompleteCallback);\n };\n exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout);\n };\n }\n });\n\n // src/traces/pie/index.js\n var require_pie = __commonJS({\n \"src/traces/pie/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes35(),\n supplyDefaults: require_defaults31().supplyDefaults,\n supplyLayoutDefaults: require_layout_defaults11(),\n layoutAttributes: require_layout_attributes12(),\n calc: require_calc16().calc,\n crossTraceCalc: require_calc16().crossTraceCalc,\n plot: require_plot12().plot,\n style: require_style12(),\n styleOne: require_style_one(),\n moduleType: \"trace\",\n name: \"pie\",\n basePlotModule: require_base_plot(),\n categories: [\"pie-like\", \"pie\", \"showLegend\"],\n meta: {}\n };\n }\n });\n\n // lib/pie.js\n var require_pie2 = __commonJS({\n \"lib/pie.js\"(exports, module) {\n \"use strict\";\n module.exports = require_pie();\n }\n });\n\n // src/traces/sunburst/base_plot.js\n var require_base_plot2 = __commonJS({\n \"src/traces/sunburst/base_plot.js\"(exports) {\n \"use strict\";\n var plots = require_plots();\n exports.name = \"sunburst\";\n exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) {\n plots.plotBasePlot(exports.name, gd, traces, transitionOpts, makeOnCompleteCallback);\n };\n exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout);\n };\n }\n });\n\n // src/traces/sunburst/constants.js\n var require_constants20 = __commonJS({\n \"src/traces/sunburst/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n CLICK_TRANSITION_TIME: 750,\n CLICK_TRANSITION_EASING: \"linear\",\n eventDataKeys: [\n // string\n \"currentPath\",\n \"root\",\n \"entry\",\n // no need to add 'parent' here\n // percentages i.e. ratios\n \"percentRoot\",\n \"percentEntry\",\n \"percentParent\"\n ]\n };\n }\n });\n\n // src/traces/sunburst/attributes.js\n var require_attributes36 = __commonJS({\n \"src/traces/sunburst/attributes.js\"(exports, module) {\n \"use strict\";\n var baseAttrs = require_attributes2();\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var colorScaleAttrs = require_attributes8();\n var domainAttrs = require_domain().attributes;\n var pieAttrs = require_attributes35();\n var constants = require_constants20();\n var extendFlat = require_extend().extendFlat;\n var pattern = require_attributes4().pattern;\n module.exports = {\n labels: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n parents: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n values: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n branchvalues: {\n valType: \"enumerated\",\n values: [\"remainder\", \"total\"],\n dflt: \"remainder\",\n editType: \"calc\"\n },\n count: {\n valType: \"flaglist\",\n flags: [\n \"branches\",\n \"leaves\"\n ],\n dflt: \"leaves\",\n editType: \"calc\"\n },\n level: {\n valType: \"any\",\n editType: \"plot\",\n anim: true\n },\n maxdepth: {\n valType: \"integer\",\n editType: \"plot\",\n dflt: -1\n },\n marker: extendFlat(\n {\n colors: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n // colorinheritance: {\n // valType: 'enumerated',\n // values: ['per-branch', 'per-label', false]\n // },\n line: {\n color: extendFlat({}, pieAttrs.marker.line.color, {\n dflt: null\n }),\n width: extendFlat({}, pieAttrs.marker.line.width, { dflt: 1 }),\n editType: \"calc\"\n },\n pattern,\n editType: \"calc\"\n },\n colorScaleAttrs(\"marker\", {\n colorAttr: \"colors\",\n anim: false\n // TODO: set to anim: true?\n })\n ),\n leaf: {\n opacity: {\n valType: \"number\",\n editType: \"style\",\n min: 0,\n max: 1\n },\n editType: \"plot\"\n },\n text: pieAttrs.text,\n textinfo: {\n valType: \"flaglist\",\n flags: [\n \"label\",\n \"text\",\n \"value\",\n \"current path\",\n \"percent root\",\n \"percent entry\",\n \"percent parent\"\n ],\n extras: [\"none\"],\n editType: \"plot\"\n },\n // TODO: incorporate `label` and `value` in the eventData\n texttemplate: texttemplateAttrs({ editType: \"plot\" }, {\n keys: constants.eventDataKeys.concat([\"label\", \"value\"])\n }),\n hovertext: pieAttrs.hovertext,\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: [\n \"label\",\n \"text\",\n \"value\",\n \"name\",\n \"current path\",\n \"percent root\",\n \"percent entry\",\n \"percent parent\"\n ],\n dflt: \"label+text+value+name\"\n }),\n hovertemplate: hovertemplateAttrs({}, {\n keys: constants.eventDataKeys\n }),\n textfont: pieAttrs.textfont,\n insidetextorientation: pieAttrs.insidetextorientation,\n insidetextfont: pieAttrs.insidetextfont,\n outsidetextfont: extendFlat({}, pieAttrs.outsidetextfont, {}),\n rotation: {\n valType: \"angle\",\n dflt: 0,\n editType: \"plot\"\n },\n sort: pieAttrs.sort,\n root: {\n color: {\n valType: \"color\",\n editType: \"calc\",\n dflt: \"rgba(0,0,0,0)\"\n },\n editType: \"calc\"\n },\n domain: domainAttrs({ name: \"sunburst\", trace: true, editType: \"calc\" })\n };\n }\n });\n\n // src/traces/sunburst/layout_attributes.js\n var require_layout_attributes13 = __commonJS({\n \"src/traces/sunburst/layout_attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n sunburstcolorway: {\n valType: \"colorlist\",\n editType: \"calc\"\n },\n extendsunburstcolors: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc\"\n }\n };\n }\n });\n\n // src/traces/sunburst/defaults.js\n var require_defaults32 = __commonJS({\n \"src/traces/sunburst/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var attributes = require_attributes36();\n var handleDomainDefaults = require_domain().defaults;\n var handleText = require_defaults19().handleText;\n var handleMarkerDefaults = require_defaults31().handleMarkerDefaults;\n var Colorscale = require_colorscale();\n var hasColorscale = Colorscale.hasColorscale;\n var colorscaleDefaults = Colorscale.handleDefaults;\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var labels = coerce(\"labels\");\n var parents = coerce(\"parents\");\n if (!labels || !labels.length || !parents || !parents.length) {\n traceOut.visible = false;\n return;\n }\n var vals = coerce(\"values\");\n if (vals && vals.length) {\n coerce(\"branchvalues\");\n } else {\n coerce(\"count\");\n }\n coerce(\"level\");\n coerce(\"maxdepth\");\n handleMarkerDefaults(traceIn, traceOut, layout, coerce);\n var withColorscale = traceOut._hasColorscale = hasColorscale(traceIn, \"marker\", \"colors\") || (traceIn.marker || {}).coloraxis;\n if (withColorscale) {\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"marker.\", cLetter: \"c\" });\n }\n coerce(\"leaf.opacity\", withColorscale ? 1 : 0.7);\n var text = coerce(\"text\");\n coerce(\"texttemplate\");\n if (!traceOut.texttemplate) coerce(\"textinfo\", Lib.isArrayOrTypedArray(text) ? \"text+label\" : \"label\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n var textposition = \"auto\";\n handleText(traceIn, traceOut, layout, coerce, textposition, {\n moduleHasSelected: false,\n moduleHasUnselected: false,\n moduleHasConstrain: false,\n moduleHasCliponaxis: false,\n moduleHasTextangle: false,\n moduleHasInsideanchor: false\n });\n coerce(\"insidetextorientation\");\n coerce(\"sort\");\n coerce(\"rotation\");\n coerce(\"root.color\");\n handleDomainDefaults(traceOut, layout, coerce);\n traceOut._length = null;\n };\n }\n });\n\n // src/traces/sunburst/layout_defaults.js\n var require_layout_defaults12 = __commonJS({\n \"src/traces/sunburst/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var layoutAttributes = require_layout_attributes13();\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);\n }\n coerce(\"sunburstcolorway\", layoutOut.colorway);\n coerce(\"extendsunburstcolors\");\n };\n }\n });\n\n // node_modules/d3-hierarchy/dist/d3-hierarchy.js\n var require_d3_hierarchy = __commonJS({\n \"node_modules/d3-hierarchy/dist/d3-hierarchy.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports) : typeof define === \"function\" && false ? define([\"exports\"], factory) : (global2 = global2 || self, factory(global2.d3 = global2.d3 || {}));\n })(exports, function(exports2) {\n \"use strict\";\n function defaultSeparation(a, b) {\n return a.parent === b.parent ? 1 : 2;\n }\n function meanX(children) {\n return children.reduce(meanXReduce, 0) / children.length;\n }\n function meanXReduce(x, c) {\n return x + c.x;\n }\n function maxY(children) {\n return 1 + children.reduce(maxYReduce, 0);\n }\n function maxYReduce(y, c) {\n return Math.max(y, c.y);\n }\n function leafLeft(node) {\n var children;\n while (children = node.children) node = children[0];\n return node;\n }\n function leafRight(node) {\n var children;\n while (children = node.children) node = children[children.length - 1];\n return node;\n }\n function cluster() {\n var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = false;\n function cluster2(root) {\n var previousNode, x = 0;\n root.eachAfter(function(node) {\n var children = node.children;\n if (children) {\n node.x = meanX(children);\n node.y = maxY(children);\n } else {\n node.x = previousNode ? x += separation(node, previousNode) : 0;\n node.y = 0;\n previousNode = node;\n }\n });\n var left = leafLeft(root), right = leafRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2;\n return root.eachAfter(nodeSize ? function(node) {\n node.x = (node.x - root.x) * dx;\n node.y = (root.y - node.y) * dy;\n } : function(node) {\n node.x = (node.x - x0) / (x1 - x0) * dx;\n node.y = (1 - (root.y ? node.y / root.y : 1)) * dy;\n });\n }\n cluster2.separation = function(x) {\n return arguments.length ? (separation = x, cluster2) : separation;\n };\n cluster2.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster2) : nodeSize ? null : [dx, dy];\n };\n cluster2.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster2) : nodeSize ? [dx, dy] : null;\n };\n return cluster2;\n }\n function count(node) {\n var sum = 0, children = node.children, i = children && children.length;\n if (!i) sum = 1;\n else while (--i >= 0) sum += children[i].value;\n node.value = sum;\n }\n function node_count() {\n return this.eachAfter(count);\n }\n function node_each(callback) {\n var node = this, current, next = [node], children, i, n;\n do {\n current = next.reverse(), next = [];\n while (node = current.pop()) {\n callback(node), children = node.children;\n if (children) for (i = 0, n = children.length; i < n; ++i) {\n next.push(children[i]);\n }\n }\n } while (next.length);\n return this;\n }\n function node_eachBefore(callback) {\n var node = this, nodes = [node], children, i;\n while (node = nodes.pop()) {\n callback(node), children = node.children;\n if (children) for (i = children.length - 1; i >= 0; --i) {\n nodes.push(children[i]);\n }\n }\n return this;\n }\n function node_eachAfter(callback) {\n var node = this, nodes = [node], next = [], children, i, n;\n while (node = nodes.pop()) {\n next.push(node), children = node.children;\n if (children) for (i = 0, n = children.length; i < n; ++i) {\n nodes.push(children[i]);\n }\n }\n while (node = next.pop()) {\n callback(node);\n }\n return this;\n }\n function node_sum(value) {\n return this.eachAfter(function(node) {\n var sum = +value(node.data) || 0, children = node.children, i = children && children.length;\n while (--i >= 0) sum += children[i].value;\n node.value = sum;\n });\n }\n function node_sort(compare) {\n return this.eachBefore(function(node) {\n if (node.children) {\n node.children.sort(compare);\n }\n });\n }\n function node_path(end) {\n var start = this, ancestor = leastCommonAncestor(start, end), nodes = [start];\n while (start !== ancestor) {\n start = start.parent;\n nodes.push(start);\n }\n var k = nodes.length;\n while (end !== ancestor) {\n nodes.splice(k, 0, end);\n end = end.parent;\n }\n return nodes;\n }\n function leastCommonAncestor(a, b) {\n if (a === b) return a;\n var aNodes = a.ancestors(), bNodes = b.ancestors(), c = null;\n a = aNodes.pop();\n b = bNodes.pop();\n while (a === b) {\n c = a;\n a = aNodes.pop();\n b = bNodes.pop();\n }\n return c;\n }\n function node_ancestors() {\n var node = this, nodes = [node];\n while (node = node.parent) {\n nodes.push(node);\n }\n return nodes;\n }\n function node_descendants() {\n var nodes = [];\n this.each(function(node) {\n nodes.push(node);\n });\n return nodes;\n }\n function node_leaves() {\n var leaves = [];\n this.eachBefore(function(node) {\n if (!node.children) {\n leaves.push(node);\n }\n });\n return leaves;\n }\n function node_links() {\n var root = this, links = [];\n root.each(function(node) {\n if (node !== root) {\n links.push({ source: node.parent, target: node });\n }\n });\n return links;\n }\n function hierarchy(data, children) {\n var root = new Node(data), valued = +data.value && (root.value = data.value), node, nodes = [root], child, childs, i, n;\n if (children == null) children = defaultChildren;\n while (node = nodes.pop()) {\n if (valued) node.value = +node.data.value;\n if ((childs = children(node.data)) && (n = childs.length)) {\n node.children = new Array(n);\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = node.children[i] = new Node(childs[i]));\n child.parent = node;\n child.depth = node.depth + 1;\n }\n }\n }\n return root.eachBefore(computeHeight);\n }\n function node_copy() {\n return hierarchy(this).eachBefore(copyData);\n }\n function defaultChildren(d) {\n return d.children;\n }\n function copyData(node) {\n node.data = node.data.data;\n }\n function computeHeight(node) {\n var height = 0;\n do\n node.height = height;\n while ((node = node.parent) && node.height < ++height);\n }\n function Node(data) {\n this.data = data;\n this.depth = this.height = 0;\n this.parent = null;\n }\n Node.prototype = hierarchy.prototype = {\n constructor: Node,\n count: node_count,\n each: node_each,\n eachAfter: node_eachAfter,\n eachBefore: node_eachBefore,\n sum: node_sum,\n sort: node_sort,\n path: node_path,\n ancestors: node_ancestors,\n descendants: node_descendants,\n leaves: node_leaves,\n links: node_links,\n copy: node_copy\n };\n var slice = Array.prototype.slice;\n function shuffle(array) {\n var m = array.length, t, i;\n while (m) {\n i = Math.random() * m-- | 0;\n t = array[m];\n array[m] = array[i];\n array[i] = t;\n }\n return array;\n }\n function enclose(circles) {\n var i = 0, n = (circles = shuffle(slice.call(circles))).length, B2 = [], p, e;\n while (i < n) {\n p = circles[i];\n if (e && enclosesWeak(e, p)) ++i;\n else e = encloseBasis(B2 = extendBasis(B2, p)), i = 0;\n }\n return e;\n }\n function extendBasis(B2, p) {\n var i, j;\n if (enclosesWeakAll(p, B2)) return [p];\n for (i = 0; i < B2.length; ++i) {\n if (enclosesNot(p, B2[i]) && enclosesWeakAll(encloseBasis2(B2[i], p), B2)) {\n return [B2[i], p];\n }\n }\n for (i = 0; i < B2.length - 1; ++i) {\n for (j = i + 1; j < B2.length; ++j) {\n if (enclosesNot(encloseBasis2(B2[i], B2[j]), p) && enclosesNot(encloseBasis2(B2[i], p), B2[j]) && enclosesNot(encloseBasis2(B2[j], p), B2[i]) && enclosesWeakAll(encloseBasis3(B2[i], B2[j], p), B2)) {\n return [B2[i], B2[j], p];\n }\n }\n }\n throw new Error();\n }\n function enclosesNot(a, b) {\n var dr = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y;\n return dr < 0 || dr * dr < dx * dx + dy * dy;\n }\n function enclosesWeak(a, b) {\n var dr = a.r - b.r + 1e-6, dx = b.x - a.x, dy = b.y - a.y;\n return dr > 0 && dr * dr > dx * dx + dy * dy;\n }\n function enclosesWeakAll(a, B2) {\n for (var i = 0; i < B2.length; ++i) {\n if (!enclosesWeak(a, B2[i])) {\n return false;\n }\n }\n return true;\n }\n function encloseBasis(B2) {\n switch (B2.length) {\n case 1:\n return encloseBasis1(B2[0]);\n case 2:\n return encloseBasis2(B2[0], B2[1]);\n case 3:\n return encloseBasis3(B2[0], B2[1], B2[2]);\n }\n }\n function encloseBasis1(a) {\n return {\n x: a.x,\n y: a.y,\n r: a.r\n };\n }\n function encloseBasis2(a, b) {\n var x1 = a.x, y1 = a.y, r1 = a.r, x2 = b.x, y2 = b.y, r2 = b.r, x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1, l = Math.sqrt(x21 * x21 + y21 * y21);\n return {\n x: (x1 + x2 + x21 / l * r21) / 2,\n y: (y1 + y2 + y21 / l * r21) / 2,\n r: (l + r1 + r2) / 2\n };\n }\n function encloseBasis3(a, b, c) {\n var x1 = a.x, y1 = a.y, r1 = a.r, x2 = b.x, y2 = b.y, r2 = b.r, x3 = c.x, y3 = c.y, r3 = c.r, a2 = x1 - x2, a3 = x1 - x3, b2 = y1 - y2, b3 = y1 - y3, c2 = r2 - r1, c3 = r3 - r1, d1 = x1 * x1 + y1 * y1 - r1 * r1, d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2, d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3, ab = a3 * b2 - a2 * b3, xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1, xb = (b3 * c2 - b2 * c3) / ab, ya = (a3 * d2 - a2 * d3) / (ab * 2) - y1, yb = (a2 * c3 - a3 * c2) / ab, A2 = xb * xb + yb * yb - 1, B2 = 2 * (r1 + xa * xb + ya * yb), C2 = xa * xa + ya * ya - r1 * r1, r = -(A2 ? (B2 + Math.sqrt(B2 * B2 - 4 * A2 * C2)) / (2 * A2) : C2 / B2);\n return {\n x: x1 + xa + xb * r,\n y: y1 + ya + yb * r,\n r\n };\n }\n function place(b, a, c) {\n var dx = b.x - a.x, x, a2, dy = b.y - a.y, y, b2, d2 = dx * dx + dy * dy;\n if (d2) {\n a2 = a.r + c.r, a2 *= a2;\n b2 = b.r + c.r, b2 *= b2;\n if (a2 > b2) {\n x = (d2 + b2 - a2) / (2 * d2);\n y = Math.sqrt(Math.max(0, b2 / d2 - x * x));\n c.x = b.x - x * dx - y * dy;\n c.y = b.y - x * dy + y * dx;\n } else {\n x = (d2 + a2 - b2) / (2 * d2);\n y = Math.sqrt(Math.max(0, a2 / d2 - x * x));\n c.x = a.x + x * dx - y * dy;\n c.y = a.y + x * dy + y * dx;\n }\n } else {\n c.x = a.x + c.r;\n c.y = a.y;\n }\n }\n function intersects(a, b) {\n var dr = a.r + b.r - 1e-6, dx = b.x - a.x, dy = b.y - a.y;\n return dr > 0 && dr * dr > dx * dx + dy * dy;\n }\n function score(node) {\n var a = node._, b = node.next._, ab = a.r + b.r, dx = (a.x * b.r + b.x * a.r) / ab, dy = (a.y * b.r + b.y * a.r) / ab;\n return dx * dx + dy * dy;\n }\n function Node$1(circle) {\n this._ = circle;\n this.next = null;\n this.previous = null;\n }\n function packEnclose(circles) {\n if (!(n = circles.length)) return 0;\n var a, b, c, n, aa, ca, i, j, k, sj, sk;\n a = circles[0], a.x = 0, a.y = 0;\n if (!(n > 1)) return a.r;\n b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0;\n if (!(n > 2)) return a.r + b.r;\n place(b, a, c = circles[2]);\n a = new Node$1(a), b = new Node$1(b), c = new Node$1(c);\n a.next = c.previous = b;\n b.next = a.previous = c;\n c.next = b.previous = a;\n pack: for (i = 3; i < n; ++i) {\n place(a._, b._, c = circles[i]), c = new Node$1(c);\n j = b.next, k = a.previous, sj = b._.r, sk = a._.r;\n do {\n if (sj <= sk) {\n if (intersects(j._, c._)) {\n b = j, a.next = b, b.previous = a, --i;\n continue pack;\n }\n sj += j._.r, j = j.next;\n } else {\n if (intersects(k._, c._)) {\n a = k, a.next = b, b.previous = a, --i;\n continue pack;\n }\n sk += k._.r, k = k.previous;\n }\n } while (j !== k.next);\n c.previous = a, c.next = b, a.next = b.previous = b = c;\n aa = score(a);\n while ((c = c.next) !== b) {\n if ((ca = score(c)) < aa) {\n a = c, aa = ca;\n }\n }\n b = a.next;\n }\n a = [b._], c = b;\n while ((c = c.next) !== b) a.push(c._);\n c = enclose(a);\n for (i = 0; i < n; ++i) a = circles[i], a.x -= c.x, a.y -= c.y;\n return c.r;\n }\n function siblings(circles) {\n packEnclose(circles);\n return circles;\n }\n function optional(f) {\n return f == null ? null : required(f);\n }\n function required(f) {\n if (typeof f !== \"function\") throw new Error();\n return f;\n }\n function constantZero() {\n return 0;\n }\n function constant(x) {\n return function() {\n return x;\n };\n }\n function defaultRadius(d) {\n return Math.sqrt(d.value);\n }\n function index() {\n var radius = null, dx = 1, dy = 1, padding = constantZero;\n function pack(root) {\n root.x = dx / 2, root.y = dy / 2;\n if (radius) {\n root.eachBefore(radiusLeaf(radius)).eachAfter(packChildren(padding, 0.5)).eachBefore(translateChild(1));\n } else {\n root.eachBefore(radiusLeaf(defaultRadius)).eachAfter(packChildren(constantZero, 1)).eachAfter(packChildren(padding, root.r / Math.min(dx, dy))).eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r)));\n }\n return root;\n }\n pack.radius = function(x) {\n return arguments.length ? (radius = optional(x), pack) : radius;\n };\n pack.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy];\n };\n pack.padding = function(x) {\n return arguments.length ? (padding = typeof x === \"function\" ? x : constant(+x), pack) : padding;\n };\n return pack;\n }\n function radiusLeaf(radius) {\n return function(node) {\n if (!node.children) {\n node.r = Math.max(0, +radius(node) || 0);\n }\n };\n }\n function packChildren(padding, k) {\n return function(node) {\n if (children = node.children) {\n var children, i, n = children.length, r = padding(node) * k || 0, e;\n if (r) for (i = 0; i < n; ++i) children[i].r += r;\n e = packEnclose(children);\n if (r) for (i = 0; i < n; ++i) children[i].r -= r;\n node.r = e + r;\n }\n };\n }\n function translateChild(k) {\n return function(node) {\n var parent = node.parent;\n node.r *= k;\n if (parent) {\n node.x = parent.x + k * node.x;\n node.y = parent.y + k * node.y;\n }\n };\n }\n function roundNode(node) {\n node.x0 = Math.round(node.x0);\n node.y0 = Math.round(node.y0);\n node.x1 = Math.round(node.x1);\n node.y1 = Math.round(node.y1);\n }\n function treemapDice(parent, x0, y0, x1, y1) {\n var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x1 - x0) / parent.value;\n while (++i < n) {\n node = nodes[i], node.y0 = y0, node.y1 = y1;\n node.x0 = x0, node.x1 = x0 += node.value * k;\n }\n }\n function partition() {\n var dx = 1, dy = 1, padding = 0, round = false;\n function partition2(root) {\n var n = root.height + 1;\n root.x0 = root.y0 = padding;\n root.x1 = dx;\n root.y1 = dy / n;\n root.eachBefore(positionNode(dy, n));\n if (round) root.eachBefore(roundNode);\n return root;\n }\n function positionNode(dy2, n) {\n return function(node) {\n if (node.children) {\n treemapDice(node, node.x0, dy2 * (node.depth + 1) / n, node.x1, dy2 * (node.depth + 2) / n);\n }\n var x0 = node.x0, y0 = node.y0, x1 = node.x1 - padding, y1 = node.y1 - padding;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n };\n }\n partition2.round = function(x) {\n return arguments.length ? (round = !!x, partition2) : round;\n };\n partition2.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], partition2) : [dx, dy];\n };\n partition2.padding = function(x) {\n return arguments.length ? (padding = +x, partition2) : padding;\n };\n return partition2;\n }\n var keyPrefix = \"$\", preroot = { depth: -1 }, ambiguous = {};\n function defaultId(d) {\n return d.id;\n }\n function defaultParentId(d) {\n return d.parentId;\n }\n function stratify() {\n var id = defaultId, parentId = defaultParentId;\n function stratify2(data) {\n var d, i, n = data.length, root, parent, node, nodes = new Array(n), nodeId, nodeKey, nodeByKey = {};\n for (i = 0; i < n; ++i) {\n d = data[i], node = nodes[i] = new Node(d);\n if ((nodeId = id(d, i, data)) != null && (nodeId += \"\")) {\n nodeKey = keyPrefix + (node.id = nodeId);\n nodeByKey[nodeKey] = nodeKey in nodeByKey ? ambiguous : node;\n }\n }\n for (i = 0; i < n; ++i) {\n node = nodes[i], nodeId = parentId(data[i], i, data);\n if (nodeId == null || !(nodeId += \"\")) {\n if (root) throw new Error(\"multiple roots\");\n root = node;\n } else {\n parent = nodeByKey[keyPrefix + nodeId];\n if (!parent) throw new Error(\"missing: \" + nodeId);\n if (parent === ambiguous) throw new Error(\"ambiguous: \" + nodeId);\n if (parent.children) parent.children.push(node);\n else parent.children = [node];\n node.parent = parent;\n }\n }\n if (!root) throw new Error(\"no root\");\n root.parent = preroot;\n root.eachBefore(function(node2) {\n node2.depth = node2.parent.depth + 1;\n --n;\n }).eachBefore(computeHeight);\n root.parent = null;\n if (n > 0) throw new Error(\"cycle\");\n return root;\n }\n stratify2.id = function(x) {\n return arguments.length ? (id = required(x), stratify2) : id;\n };\n stratify2.parentId = function(x) {\n return arguments.length ? (parentId = required(x), stratify2) : parentId;\n };\n return stratify2;\n }\n function defaultSeparation$1(a, b) {\n return a.parent === b.parent ? 1 : 2;\n }\n function nextLeft(v) {\n var children = v.children;\n return children ? children[0] : v.t;\n }\n function nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n }\n function moveSubtree(wm, wp, shift) {\n var change = shift / (wp.i - wm.i);\n wp.c -= change;\n wp.s += shift;\n wm.c += change;\n wp.z += shift;\n wp.m += shift;\n }\n function executeShifts(v) {\n var shift = 0, change = 0, children = v.children, i = children.length, w;\n while (--i >= 0) {\n w = children[i];\n w.z += shift;\n w.m += shift;\n shift += w.s + (change += w.c);\n }\n }\n function nextAncestor(vim, v, ancestor) {\n return vim.a.parent === v.parent ? vim.a : ancestor;\n }\n function TreeNode(node, i) {\n this._ = node;\n this.parent = null;\n this.children = null;\n this.A = null;\n this.a = this;\n this.z = 0;\n this.m = 0;\n this.c = 0;\n this.s = 0;\n this.t = null;\n this.i = i;\n }\n TreeNode.prototype = Object.create(Node.prototype);\n function treeRoot(root) {\n var tree2 = new TreeNode(root, 0), node, nodes = [tree2], child, children, i, n;\n while (node = nodes.pop()) {\n if (children = node._.children) {\n node.children = new Array(n = children.length);\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = node.children[i] = new TreeNode(children[i], i));\n child.parent = node;\n }\n }\n }\n (tree2.parent = new TreeNode(null, 0)).children = [tree2];\n return tree2;\n }\n function tree() {\n var separation = defaultSeparation$1, dx = 1, dy = 1, nodeSize = null;\n function tree2(root) {\n var t = treeRoot(root);\n t.eachAfter(firstWalk), t.parent.m = -t.z;\n t.eachBefore(secondWalk);\n if (nodeSize) root.eachBefore(sizeNode);\n else {\n var left = root, right = root, bottom = root;\n root.eachBefore(function(node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var s = left === right ? 1 : separation(left, right) / 2, tx = s - left.x, kx = dx / (right.x + s + tx), ky = dy / (bottom.depth || 1);\n root.eachBefore(function(node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n return root;\n }\n function firstWalk(v) {\n var children = v.children, siblings2 = v.parent.children, w = v.i ? siblings2[v.i - 1] : null;\n if (children) {\n executeShifts(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings2[0]);\n }\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n function apportion(v, w, ancestor) {\n if (w) {\n var vip = v, vop = v, vim = w, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift;\n while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {\n vom = nextLeft(vom);\n vop = nextRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !nextRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !nextLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n function sizeNode(node) {\n node.x *= dx;\n node.y = node.depth * dy;\n }\n tree2.separation = function(x) {\n return arguments.length ? (separation = x, tree2) : separation;\n };\n tree2.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree2) : nodeSize ? null : [dx, dy];\n };\n tree2.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree2) : nodeSize ? [dx, dy] : null;\n };\n return tree2;\n }\n function treemapSlice(parent, x0, y0, x1, y1) {\n var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (y1 - y0) / parent.value;\n while (++i < n) {\n node = nodes[i], node.x0 = x0, node.x1 = x1;\n node.y0 = y0, node.y1 = y0 += node.value * k;\n }\n }\n var phi = (1 + Math.sqrt(5)) / 2;\n function squarifyRatio(ratio, parent, x0, y0, x1, y1) {\n var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n = nodes.length, dx, dy, value = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta;\n while (i0 < n) {\n dx = x1 - x0, dy = y1 - y0;\n do\n sumValue = nodes[i1++].value;\n while (!sumValue && i1 < n);\n minValue = maxValue = sumValue;\n alpha = Math.max(dy / dx, dx / dy) / (value * ratio);\n beta = sumValue * sumValue * alpha;\n minRatio = Math.max(maxValue / beta, beta / minValue);\n for (; i1 < n; ++i1) {\n sumValue += nodeValue = nodes[i1].value;\n if (nodeValue < minValue) minValue = nodeValue;\n if (nodeValue > maxValue) maxValue = nodeValue;\n beta = sumValue * sumValue * alpha;\n newRatio = Math.max(maxValue / beta, beta / minValue);\n if (newRatio > minRatio) {\n sumValue -= nodeValue;\n break;\n }\n minRatio = newRatio;\n }\n rows.push(row = { value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1) });\n if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);\n else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);\n value -= sumValue, i0 = i1;\n }\n return rows;\n }\n var squarify = function custom(ratio) {\n function squarify2(parent, x0, y0, x1, y1) {\n squarifyRatio(ratio, parent, x0, y0, x1, y1);\n }\n squarify2.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n return squarify2;\n }(phi);\n function index$1() {\n var tile = squarify, round = false, dx = 1, dy = 1, paddingStack = [0], paddingInner = constantZero, paddingTop = constantZero, paddingRight = constantZero, paddingBottom = constantZero, paddingLeft = constantZero;\n function treemap(root) {\n root.x0 = root.y0 = 0;\n root.x1 = dx;\n root.y1 = dy;\n root.eachBefore(positionNode);\n paddingStack = [0];\n if (round) root.eachBefore(roundNode);\n return root;\n }\n function positionNode(node) {\n var p = paddingStack[node.depth], x0 = node.x0 + p, y0 = node.y0 + p, x1 = node.x1 - p, y1 = node.y1 - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n if (node.children) {\n p = paddingStack[node.depth + 1] = paddingInner(node) / 2;\n x0 += paddingLeft(node) - p;\n y0 += paddingTop(node) - p;\n x1 -= paddingRight(node) - p;\n y1 -= paddingBottom(node) - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n tile(node, x0, y0, x1, y1);\n }\n }\n treemap.round = function(x) {\n return arguments.length ? (round = !!x, treemap) : round;\n };\n treemap.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];\n };\n treemap.tile = function(x) {\n return arguments.length ? (tile = required(x), treemap) : tile;\n };\n treemap.padding = function(x) {\n return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();\n };\n treemap.paddingInner = function(x) {\n return arguments.length ? (paddingInner = typeof x === \"function\" ? x : constant(+x), treemap) : paddingInner;\n };\n treemap.paddingOuter = function(x) {\n return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();\n };\n treemap.paddingTop = function(x) {\n return arguments.length ? (paddingTop = typeof x === \"function\" ? x : constant(+x), treemap) : paddingTop;\n };\n treemap.paddingRight = function(x) {\n return arguments.length ? (paddingRight = typeof x === \"function\" ? x : constant(+x), treemap) : paddingRight;\n };\n treemap.paddingBottom = function(x) {\n return arguments.length ? (paddingBottom = typeof x === \"function\" ? x : constant(+x), treemap) : paddingBottom;\n };\n treemap.paddingLeft = function(x) {\n return arguments.length ? (paddingLeft = typeof x === \"function\" ? x : constant(+x), treemap) : paddingLeft;\n };\n return treemap;\n }\n function binary(parent, x0, y0, x1, y1) {\n var nodes = parent.children, i, n = nodes.length, sum, sums = new Array(n + 1);\n for (sums[0] = sum = i = 0; i < n; ++i) {\n sums[i + 1] = sum += nodes[i].value;\n }\n partition2(0, n, parent.value, x0, y0, x1, y1);\n function partition2(i2, j, value, x02, y02, x12, y12) {\n if (i2 >= j - 1) {\n var node = nodes[i2];\n node.x0 = x02, node.y0 = y02;\n node.x1 = x12, node.y1 = y12;\n return;\n }\n var valueOffset = sums[i2], valueTarget = value / 2 + valueOffset, k = i2 + 1, hi = j - 1;\n while (k < hi) {\n var mid = k + hi >>> 1;\n if (sums[mid] < valueTarget) k = mid + 1;\n else hi = mid;\n }\n if (valueTarget - sums[k - 1] < sums[k] - valueTarget && i2 + 1 < k) --k;\n var valueLeft = sums[k] - valueOffset, valueRight = value - valueLeft;\n if (x12 - x02 > y12 - y02) {\n var xk = (x02 * valueRight + x12 * valueLeft) / value;\n partition2(i2, k, valueLeft, x02, y02, xk, y12);\n partition2(k, j, valueRight, xk, y02, x12, y12);\n } else {\n var yk = (y02 * valueRight + y12 * valueLeft) / value;\n partition2(i2, k, valueLeft, x02, y02, x12, yk);\n partition2(k, j, valueRight, x02, yk, x12, y12);\n }\n }\n }\n function sliceDice(parent, x0, y0, x1, y1) {\n (parent.depth & 1 ? treemapSlice : treemapDice)(parent, x0, y0, x1, y1);\n }\n var resquarify = function custom(ratio) {\n function resquarify2(parent, x0, y0, x1, y1) {\n if ((rows = parent._squarify) && rows.ratio === ratio) {\n var rows, row, nodes, i, j = -1, n, m = rows.length, value = parent.value;\n while (++j < m) {\n row = rows[j], nodes = row.children;\n for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value;\n if (row.dice) treemapDice(row, x0, y0, x1, y0 += (y1 - y0) * row.value / value);\n else treemapSlice(row, x0, y0, x0 += (x1 - x0) * row.value / value, y1);\n value -= row.value;\n }\n } else {\n parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1);\n rows.ratio = ratio;\n }\n }\n resquarify2.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n return resquarify2;\n }(phi);\n exports2.cluster = cluster;\n exports2.hierarchy = hierarchy;\n exports2.pack = index;\n exports2.packEnclose = enclose;\n exports2.packSiblings = siblings;\n exports2.partition = partition;\n exports2.stratify = stratify;\n exports2.tree = tree;\n exports2.treemap = index$1;\n exports2.treemapBinary = binary;\n exports2.treemapDice = treemapDice;\n exports2.treemapResquarify = resquarify;\n exports2.treemapSlice = treemapSlice;\n exports2.treemapSliceDice = sliceDice;\n exports2.treemapSquarify = squarify;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // src/traces/sunburst/calc.js\n var require_calc17 = __commonJS({\n \"src/traces/sunburst/calc.js\"(exports) {\n \"use strict\";\n var d3Hierarchy = require_d3_hierarchy();\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var makeColorScaleFn = require_colorscale().makeColorScaleFuncFromTrace;\n var makePullColorFn = require_calc16().makePullColorFn;\n var generateExtendedColors = require_calc16().generateExtendedColors;\n var colorscaleCalc = require_colorscale().calc;\n var ALMOST_EQUAL = require_numerical().ALMOST_EQUAL;\n var sunburstExtendedColorWays = {};\n var treemapExtendedColorWays = {};\n var icicleExtendedColorWays = {};\n exports.calc = function(gd, trace) {\n var fullLayout = gd._fullLayout;\n var ids = trace.ids;\n var hasIds = Lib.isArrayOrTypedArray(ids);\n var labels = trace.labels;\n var parents = trace.parents;\n var values = trace.values;\n var hasValues = Lib.isArrayOrTypedArray(values);\n var cd = [];\n var parent2children = {};\n var refs = {};\n var addToLookup = function(parent, v) {\n if (parent2children[parent]) parent2children[parent].push(v);\n else parent2children[parent] = [v];\n refs[v] = 1;\n };\n var isValidKey = function(k2) {\n return k2 || typeof k2 === \"number\";\n };\n var isValidVal = function(i2) {\n return !hasValues || isNumeric(values[i2]) && values[i2] >= 0;\n };\n var len;\n var isValid;\n var getId;\n if (hasIds) {\n len = Math.min(ids.length, parents.length);\n isValid = function(i2) {\n return isValidKey(ids[i2]) && isValidVal(i2);\n };\n getId = function(i2) {\n return String(ids[i2]);\n };\n } else {\n len = Math.min(labels.length, parents.length);\n isValid = function(i2) {\n return isValidKey(labels[i2]) && isValidVal(i2);\n };\n getId = function(i2) {\n return String(labels[i2]);\n };\n }\n if (hasValues) len = Math.min(len, values.length);\n for (var i = 0; i < len; i++) {\n if (isValid(i)) {\n var id = getId(i);\n var pid = isValidKey(parents[i]) ? String(parents[i]) : \"\";\n var cdi = {\n i,\n id,\n pid,\n label: isValidKey(labels[i]) ? String(labels[i]) : \"\"\n };\n if (hasValues) cdi.v = +values[i];\n cd.push(cdi);\n addToLookup(pid, id);\n }\n }\n if (!parent2children[\"\"]) {\n var impliedRoots = [];\n var k;\n for (k in parent2children) {\n if (!refs[k]) {\n impliedRoots.push(k);\n }\n }\n if (impliedRoots.length === 1) {\n k = impliedRoots[0];\n cd.unshift({\n hasImpliedRoot: true,\n id: k,\n pid: \"\",\n label: k\n });\n } else {\n return Lib.warn([\n \"Multiple implied roots, cannot build\",\n trace.type,\n \"hierarchy of\",\n trace.name + \".\",\n \"These roots include:\",\n impliedRoots.join(\", \")\n ].join(\" \"));\n }\n } else if (parent2children[\"\"].length > 1) {\n var dummyId = Lib.randstr();\n for (var j = 0; j < cd.length; j++) {\n if (cd[j].pid === \"\") {\n cd[j].pid = dummyId;\n }\n }\n cd.unshift({\n hasMultipleRoots: true,\n id: dummyId,\n pid: \"\",\n label: \"\"\n });\n }\n var root;\n try {\n root = d3Hierarchy.stratify().id(function(d) {\n return d.id;\n }).parentId(function(d) {\n return d.pid;\n })(cd);\n } catch (e) {\n return Lib.warn([\n \"Failed to build\",\n trace.type,\n \"hierarchy of\",\n trace.name + \".\",\n \"Error:\",\n e.message\n ].join(\" \"));\n }\n var hierarchy = d3Hierarchy.hierarchy(root);\n var failed = false;\n if (hasValues) {\n switch (trace.branchvalues) {\n case \"remainder\":\n hierarchy.sum(function(d) {\n return d.data.v;\n });\n break;\n case \"total\":\n hierarchy.each(function(d) {\n var cdi2 = d.data.data;\n var v = cdi2.v;\n if (d.children) {\n var partialSum = d.children.reduce(function(a, c) {\n return a + c.data.data.v;\n }, 0);\n if (cdi2.hasImpliedRoot || cdi2.hasMultipleRoots) {\n v = partialSum;\n }\n if (v < partialSum * ALMOST_EQUAL) {\n failed = true;\n return Lib.warn([\n \"Total value for node\",\n d.data.data.id,\n \"of\",\n trace.name,\n \"is smaller than the sum of its children.\",\n \"\\nparent value =\",\n v,\n \"\\nchildren sum =\",\n partialSum\n ].join(\" \"));\n }\n }\n d.value = v;\n });\n break;\n }\n } else {\n countDescendants(hierarchy, trace, {\n branches: trace.count.indexOf(\"branches\") !== -1,\n leaves: trace.count.indexOf(\"leaves\") !== -1\n });\n }\n if (failed) return;\n if (trace.sort) {\n hierarchy.sort(function(a, b) {\n return b.value - a.value;\n });\n }\n var pullColor;\n var scaleColor;\n var colors = trace.marker.colors || [];\n var hasColors = !!colors.length;\n if (trace._hasColorscale) {\n if (!hasColors) {\n colors = hasValues ? trace.values : trace._values;\n }\n colorscaleCalc(gd, trace, {\n vals: colors,\n containerStr: \"marker\",\n cLetter: \"c\"\n });\n scaleColor = makeColorScaleFn(trace.marker);\n } else {\n pullColor = makePullColorFn(fullLayout[\"_\" + trace.type + \"colormap\"]);\n }\n hierarchy.each(function(d) {\n var cdi2 = d.data.data;\n cdi2.color = trace._hasColorscale ? scaleColor(colors[cdi2.i]) : pullColor(colors[cdi2.i], cdi2.id);\n });\n cd[0].hierarchy = hierarchy;\n return cd;\n };\n exports._runCrossTraceCalc = function(desiredType, gd) {\n var fullLayout = gd._fullLayout;\n var calcdata = gd.calcdata;\n var colorWay = fullLayout[desiredType + \"colorway\"];\n var colorMap = fullLayout[\"_\" + desiredType + \"colormap\"];\n if (fullLayout[\"extend\" + desiredType + \"colors\"]) {\n colorWay = generateExtendedColors(\n colorWay,\n desiredType === \"icicle\" ? icicleExtendedColorWays : desiredType === \"treemap\" ? treemapExtendedColorWays : sunburstExtendedColorWays\n );\n }\n var dfltColorCount = 0;\n var rootColor;\n function pickColor(d) {\n var cdi = d.data.data;\n var id = cdi.id;\n if (cdi.color === false) {\n if (colorMap[id]) {\n cdi.color = colorMap[id];\n } else if (d.parent) {\n if (d.parent.parent) {\n cdi.color = d.parent.data.data.color;\n } else {\n colorMap[id] = cdi.color = colorWay[dfltColorCount % colorWay.length];\n dfltColorCount++;\n }\n } else {\n cdi.color = rootColor;\n }\n }\n }\n for (var i = 0; i < calcdata.length; i++) {\n var cd = calcdata[i];\n var cd0 = cd[0];\n if (cd0.trace.type === desiredType && cd0.hierarchy) {\n rootColor = cd0.trace.root.color;\n cd0.hierarchy.each(pickColor);\n }\n }\n };\n exports.crossTraceCalc = function(gd) {\n return exports._runCrossTraceCalc(\"sunburst\", gd);\n };\n function countDescendants(node, trace, opts) {\n var nChild = 0;\n var children = node.children;\n if (children) {\n var len = children.length;\n for (var i = 0; i < len; i++) {\n nChild += countDescendants(children[i], trace, opts);\n }\n if (opts.branches) nChild++;\n } else {\n if (opts.leaves) nChild++;\n }\n node.value = node.data.data.value = nChild;\n if (!trace._values) trace._values = [];\n trace._values[node.data.data.i] = nChild;\n return nChild;\n }\n }\n });\n\n // node_modules/d3-color/src/define.js\n function define_default(constructor, factory, prototype) {\n constructor.prototype = factory.prototype = prototype;\n prototype.constructor = constructor;\n }\n function extend(parent, definition) {\n var prototype = Object.create(parent.prototype);\n for (var key in definition) prototype[key] = definition[key];\n return prototype;\n }\n var init_define = __esm({\n \"node_modules/d3-color/src/define.js\"() {\n }\n });\n\n // node_modules/d3-color/src/color.js\n function Color() {\n }\n function color_formatHex() {\n return this.rgb().formatHex();\n }\n function color_formatHex8() {\n return this.rgb().formatHex8();\n }\n function color_formatHsl() {\n return hslConvert(this).formatHsl();\n }\n function color_formatRgb() {\n return this.rgb().formatRgb();\n }\n function color(format) {\n var m, l;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format) ? rgbn(named[format]) : format === \"transparent\" ? new Rgb(NaN, NaN, NaN, 0) : null;\n }\n function rgbn(n) {\n return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1);\n }\n function rgba(r, g, b, a) {\n if (a <= 0) r = g = b = NaN;\n return new Rgb(r, g, b, a);\n }\n function rgbConvert(o) {\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Rgb();\n o = o.rgb();\n return new Rgb(o.r, o.g, o.b, o.opacity);\n }\n function rgb(r, g, b, opacity) {\n return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);\n }\n function Rgb(r, g, b, opacity) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n this.opacity = +opacity;\n }\n function rgb_formatHex() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;\n }\n function rgb_formatHex8() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;\n }\n function rgb_formatRgb() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"rgb(\" : \"rgba(\"}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? \")\" : `, ${a})`}`;\n }\n function clampa(opacity) {\n return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));\n }\n function clampi(value) {\n return Math.max(0, Math.min(255, Math.round(value) || 0));\n }\n function hex(value) {\n value = clampi(value);\n return (value < 16 ? \"0\" : \"\") + value.toString(16);\n }\n function hsla(h, s, l, a) {\n if (a <= 0) h = s = l = NaN;\n else if (l <= 0 || l >= 1) h = s = NaN;\n else if (s <= 0) h = NaN;\n return new Hsl(h, s, l, a);\n }\n function hslConvert(o) {\n if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Hsl();\n if (o instanceof Hsl) return o;\n o = o.rgb();\n var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2;\n if (s) {\n if (r === max) h = (g - b) / s + (g < b) * 6;\n else if (g === max) h = (b - r) / s + 2;\n else h = (r - g) / s + 4;\n s /= l < 0.5 ? max + min : 2 - max - min;\n h *= 60;\n } else {\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new Hsl(h, s, l, o.opacity);\n }\n function hsl(h, s, l, opacity) {\n return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);\n }\n function Hsl(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n }\n function clamph(value) {\n value = (value || 0) % 360;\n return value < 0 ? value + 360 : value;\n }\n function clampt(value) {\n return Math.max(0, Math.min(1, value || 0));\n }\n function hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;\n }\n var darker, brighter, reI, reN, reP, reHex, reRgbInteger, reRgbPercent, reRgbaInteger, reRgbaPercent, reHslPercent, reHslaPercent, named;\n var init_color = __esm({\n \"node_modules/d3-color/src/color.js\"() {\n init_define();\n darker = 0.7;\n brighter = 1 / darker;\n reI = \"\\\\s*([+-]?\\\\d+)\\\\s*\";\n reN = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\";\n reP = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\";\n reHex = /^#([0-9a-f]{3,8})$/;\n reRgbInteger = new RegExp(`^rgb\\\\(${reI},${reI},${reI}\\\\)$`);\n reRgbPercent = new RegExp(`^rgb\\\\(${reP},${reP},${reP}\\\\)$`);\n reRgbaInteger = new RegExp(`^rgba\\\\(${reI},${reI},${reI},${reN}\\\\)$`);\n reRgbaPercent = new RegExp(`^rgba\\\\(${reP},${reP},${reP},${reN}\\\\)$`);\n reHslPercent = new RegExp(`^hsl\\\\(${reN},${reP},${reP}\\\\)$`);\n reHslaPercent = new RegExp(`^hsla\\\\(${reN},${reP},${reP},${reN}\\\\)$`);\n named = {\n aliceblue: 15792383,\n antiquewhite: 16444375,\n aqua: 65535,\n aquamarine: 8388564,\n azure: 15794175,\n beige: 16119260,\n bisque: 16770244,\n black: 0,\n blanchedalmond: 16772045,\n blue: 255,\n blueviolet: 9055202,\n brown: 10824234,\n burlywood: 14596231,\n cadetblue: 6266528,\n chartreuse: 8388352,\n chocolate: 13789470,\n coral: 16744272,\n cornflowerblue: 6591981,\n cornsilk: 16775388,\n crimson: 14423100,\n cyan: 65535,\n darkblue: 139,\n darkcyan: 35723,\n darkgoldenrod: 12092939,\n darkgray: 11119017,\n darkgreen: 25600,\n darkgrey: 11119017,\n darkkhaki: 12433259,\n darkmagenta: 9109643,\n darkolivegreen: 5597999,\n darkorange: 16747520,\n darkorchid: 10040012,\n darkred: 9109504,\n darksalmon: 15308410,\n darkseagreen: 9419919,\n darkslateblue: 4734347,\n darkslategray: 3100495,\n darkslategrey: 3100495,\n darkturquoise: 52945,\n darkviolet: 9699539,\n deeppink: 16716947,\n deepskyblue: 49151,\n dimgray: 6908265,\n dimgrey: 6908265,\n dodgerblue: 2003199,\n firebrick: 11674146,\n floralwhite: 16775920,\n forestgreen: 2263842,\n fuchsia: 16711935,\n gainsboro: 14474460,\n ghostwhite: 16316671,\n gold: 16766720,\n goldenrod: 14329120,\n gray: 8421504,\n green: 32768,\n greenyellow: 11403055,\n grey: 8421504,\n honeydew: 15794160,\n hotpink: 16738740,\n indianred: 13458524,\n indigo: 4915330,\n ivory: 16777200,\n khaki: 15787660,\n lavender: 15132410,\n lavenderblush: 16773365,\n lawngreen: 8190976,\n lemonchiffon: 16775885,\n lightblue: 11393254,\n lightcoral: 15761536,\n lightcyan: 14745599,\n lightgoldenrodyellow: 16448210,\n lightgray: 13882323,\n lightgreen: 9498256,\n lightgrey: 13882323,\n lightpink: 16758465,\n lightsalmon: 16752762,\n lightseagreen: 2142890,\n lightskyblue: 8900346,\n lightslategray: 7833753,\n lightslategrey: 7833753,\n lightsteelblue: 11584734,\n lightyellow: 16777184,\n lime: 65280,\n limegreen: 3329330,\n linen: 16445670,\n magenta: 16711935,\n maroon: 8388608,\n mediumaquamarine: 6737322,\n mediumblue: 205,\n mediumorchid: 12211667,\n mediumpurple: 9662683,\n mediumseagreen: 3978097,\n mediumslateblue: 8087790,\n mediumspringgreen: 64154,\n mediumturquoise: 4772300,\n mediumvioletred: 13047173,\n midnightblue: 1644912,\n mintcream: 16121850,\n mistyrose: 16770273,\n moccasin: 16770229,\n navajowhite: 16768685,\n navy: 128,\n oldlace: 16643558,\n olive: 8421376,\n olivedrab: 7048739,\n orange: 16753920,\n orangered: 16729344,\n orchid: 14315734,\n palegoldenrod: 15657130,\n palegreen: 10025880,\n paleturquoise: 11529966,\n palevioletred: 14381203,\n papayawhip: 16773077,\n peachpuff: 16767673,\n peru: 13468991,\n pink: 16761035,\n plum: 14524637,\n powderblue: 11591910,\n purple: 8388736,\n rebeccapurple: 6697881,\n red: 16711680,\n rosybrown: 12357519,\n royalblue: 4286945,\n saddlebrown: 9127187,\n salmon: 16416882,\n sandybrown: 16032864,\n seagreen: 3050327,\n seashell: 16774638,\n sienna: 10506797,\n silver: 12632256,\n skyblue: 8900331,\n slateblue: 6970061,\n slategray: 7372944,\n slategrey: 7372944,\n snow: 16775930,\n springgreen: 65407,\n steelblue: 4620980,\n tan: 13808780,\n teal: 32896,\n thistle: 14204888,\n tomato: 16737095,\n turquoise: 4251856,\n violet: 15631086,\n wheat: 16113331,\n white: 16777215,\n whitesmoke: 16119285,\n yellow: 16776960,\n yellowgreen: 10145074\n };\n define_default(Color, color, {\n copy(channels) {\n return Object.assign(new this.constructor(), this, channels);\n },\n displayable() {\n return this.rgb().displayable();\n },\n hex: color_formatHex,\n // Deprecated! Use color.formatHex.\n formatHex: color_formatHex,\n formatHex8: color_formatHex8,\n formatHsl: color_formatHsl,\n formatRgb: color_formatRgb,\n toString: color_formatRgb\n });\n define_default(Rgb, rgb, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n rgb() {\n return this;\n },\n clamp() {\n return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));\n },\n displayable() {\n return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1);\n },\n hex: rgb_formatHex,\n // Deprecated! Use color.formatHex.\n formatHex: rgb_formatHex,\n formatHex8: rgb_formatHex8,\n formatRgb: rgb_formatRgb,\n toString: rgb_formatRgb\n }));\n define_default(Hsl, hsl, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),\n this.opacity\n );\n },\n clamp() {\n return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));\n },\n displayable() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);\n },\n formatHsl() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"hsl(\" : \"hsla(\"}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? \")\" : `, ${a})`}`;\n }\n }));\n }\n });\n\n // node_modules/d3-color/src/math.js\n var radians, degrees;\n var init_math = __esm({\n \"node_modules/d3-color/src/math.js\"() {\n radians = Math.PI / 180;\n degrees = 180 / Math.PI;\n }\n });\n\n // node_modules/d3-color/src/lab.js\n function labConvert(o) {\n if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);\n if (o instanceof Hcl) return hcl2lab(o);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b = rgb2lrgb(o.b), y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;\n if (r === g && g === b) x = z = y;\n else {\n x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);\n z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);\n }\n return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);\n }\n function lab(l, a, b, opacity) {\n return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);\n }\n function Lab(l, a, b, opacity) {\n this.l = +l;\n this.a = +a;\n this.b = +b;\n this.opacity = +opacity;\n }\n function xyz2lab(t) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n }\n function lab2xyz(t) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n }\n function lrgb2rgb(x) {\n return 255 * (x <= 31308e-7 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n }\n function rgb2lrgb(x) {\n return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n }\n function hclConvert(o) {\n if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);\n if (!(o instanceof Lab)) o = labConvert(o);\n if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);\n var h = Math.atan2(o.b, o.a) * degrees;\n return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);\n }\n function hcl(h, c, l, opacity) {\n return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n }\n function Hcl(h, c, l, opacity) {\n this.h = +h;\n this.c = +c;\n this.l = +l;\n this.opacity = +opacity;\n }\n function hcl2lab(o) {\n if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);\n var h = o.h * radians;\n return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);\n }\n var K, Xn, Yn, Zn, t0, t1, t2, t3;\n var init_lab = __esm({\n \"node_modules/d3-color/src/lab.js\"() {\n init_define();\n init_color();\n init_math();\n K = 18;\n Xn = 0.96422;\n Yn = 1;\n Zn = 0.82521;\n t0 = 4 / 29;\n t1 = 6 / 29;\n t2 = 3 * t1 * t1;\n t3 = t1 * t1 * t1;\n define_default(Lab, lab, extend(Color, {\n brighter(k) {\n return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n darker(k) {\n return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n rgb() {\n var y = (this.l + 16) / 116, x = isNaN(this.a) ? y : y + this.a / 500, z = isNaN(this.b) ? y : y - this.b / 200;\n x = Xn * lab2xyz(x);\n y = Yn * lab2xyz(y);\n z = Zn * lab2xyz(z);\n return new Rgb(\n lrgb2rgb(3.1338561 * x - 1.6168667 * y - 0.4906146 * z),\n lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.033454 * z),\n lrgb2rgb(0.0719453 * x - 0.2289914 * y + 1.4052427 * z),\n this.opacity\n );\n }\n }));\n define_default(Hcl, hcl, extend(Color, {\n brighter(k) {\n return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);\n },\n darker(k) {\n return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);\n },\n rgb() {\n return hcl2lab(this).rgb();\n }\n }));\n }\n });\n\n // node_modules/d3-color/src/cubehelix.js\n function cubehelixConvert(o) {\n if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = o.r / 255, g = o.g / 255, b = o.b / 255, l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), bl = b - l, k = (E * (g - l) - C * bl) / D, s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), h = s ? Math.atan2(k, bl) * degrees - 120 : NaN;\n return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);\n }\n function cubehelix(h, s, l, opacity) {\n return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);\n }\n function Cubehelix(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n }\n var A, B, C, D, E, ED, EB, BC_DA;\n var init_cubehelix = __esm({\n \"node_modules/d3-color/src/cubehelix.js\"() {\n init_define();\n init_color();\n init_math();\n A = -0.14861;\n B = 1.78277;\n C = -0.29227;\n D = -0.90649;\n E = 1.97294;\n ED = E * D;\n EB = E * B;\n BC_DA = B * C - D * A;\n define_default(Cubehelix, cubehelix, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = isNaN(this.h) ? 0 : (this.h + 120) * radians, l = +this.l, a = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh2 = Math.cos(h), sinh2 = Math.sin(h);\n return new Rgb(\n 255 * (l + a * (A * cosh2 + B * sinh2)),\n 255 * (l + a * (C * cosh2 + D * sinh2)),\n 255 * (l + a * (E * cosh2)),\n this.opacity\n );\n }\n }));\n }\n });\n\n // node_modules/d3-color/src/index.js\n var init_src = __esm({\n \"node_modules/d3-color/src/index.js\"() {\n init_color();\n init_lab();\n init_cubehelix();\n }\n });\n\n // node_modules/d3-interpolate/src/basis.js\n function basis(t12, v0, v1, v2, v3) {\n var t22 = t12 * t12, t32 = t22 * t12;\n return ((1 - 3 * t12 + 3 * t22 - t32) * v0 + (4 - 6 * t22 + 3 * t32) * v1 + (1 + 3 * t12 + 3 * t22 - 3 * t32) * v2 + t32 * v3) / 6;\n }\n function basis_default(values) {\n var n = values.length - 1;\n return function(t) {\n var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values[i], v2 = values[i + 1], v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n }\n var init_basis = __esm({\n \"node_modules/d3-interpolate/src/basis.js\"() {\n }\n });\n\n // node_modules/d3-interpolate/src/basisClosed.js\n function basisClosed_default(values) {\n var n = values.length;\n return function(t) {\n var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values[(i + n - 1) % n], v1 = values[i % n], v2 = values[(i + 1) % n], v3 = values[(i + 2) % n];\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n }\n var init_basisClosed = __esm({\n \"node_modules/d3-interpolate/src/basisClosed.js\"() {\n init_basis();\n }\n });\n\n // node_modules/d3-interpolate/src/constant.js\n var constant_default;\n var init_constant = __esm({\n \"node_modules/d3-interpolate/src/constant.js\"() {\n constant_default = (x) => () => x;\n }\n });\n\n // node_modules/d3-interpolate/src/color.js\n function linear(a, d) {\n return function(t) {\n return a + t * d;\n };\n }\n function exponential(a, b, y) {\n return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {\n return Math.pow(a + t * b, y);\n };\n }\n function hue(a, b) {\n var d = b - a;\n return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant_default(isNaN(a) ? b : a);\n }\n function gamma(y) {\n return (y = +y) === 1 ? nogamma : function(a, b) {\n return b - a ? exponential(a, b, y) : constant_default(isNaN(a) ? b : a);\n };\n }\n function nogamma(a, b) {\n var d = b - a;\n return d ? linear(a, d) : constant_default(isNaN(a) ? b : a);\n }\n var init_color2 = __esm({\n \"node_modules/d3-interpolate/src/color.js\"() {\n init_constant();\n }\n });\n\n // node_modules/d3-interpolate/src/rgb.js\n function rgbSpline(spline) {\n return function(colors) {\n var n = colors.length, r = new Array(n), g = new Array(n), b = new Array(n), i, color2;\n for (i = 0; i < n; ++i) {\n color2 = rgb(colors[i]);\n r[i] = color2.r || 0;\n g[i] = color2.g || 0;\n b[i] = color2.b || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n color2.opacity = 1;\n return function(t) {\n color2.r = r(t);\n color2.g = g(t);\n color2.b = b(t);\n return color2 + \"\";\n };\n };\n }\n var rgb_default, rgbBasis, rgbBasisClosed;\n var init_rgb = __esm({\n \"node_modules/d3-interpolate/src/rgb.js\"() {\n init_src();\n init_basis();\n init_basisClosed();\n init_color2();\n rgb_default = function rgbGamma(y) {\n var color2 = gamma(y);\n function rgb2(start, end) {\n var r = color2((start = rgb(start)).r, (end = rgb(end)).r), g = color2(start.g, end.g), b = color2(start.b, end.b), opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.r = r(t);\n start.g = g(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n rgb2.gamma = rgbGamma;\n return rgb2;\n }(1);\n rgbBasis = rgbSpline(basis_default);\n rgbBasisClosed = rgbSpline(basisClosed_default);\n }\n });\n\n // node_modules/d3-interpolate/src/numberArray.js\n function numberArray_default(a, b) {\n if (!b) b = [];\n var n = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i;\n return function(t) {\n for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;\n return c;\n };\n }\n function isNumberArray(x) {\n return ArrayBuffer.isView(x) && !(x instanceof DataView);\n }\n var init_numberArray = __esm({\n \"node_modules/d3-interpolate/src/numberArray.js\"() {\n }\n });\n\n // node_modules/d3-interpolate/src/array.js\n function array_default(a, b) {\n return (isNumberArray(b) ? numberArray_default : genericArray)(a, b);\n }\n function genericArray(a, b) {\n var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i;\n for (i = 0; i < na; ++i) x[i] = value_default(a[i], b[i]);\n for (; i < nb; ++i) c[i] = b[i];\n return function(t) {\n for (i = 0; i < na; ++i) c[i] = x[i](t);\n return c;\n };\n }\n var init_array = __esm({\n \"node_modules/d3-interpolate/src/array.js\"() {\n init_value();\n init_numberArray();\n }\n });\n\n // node_modules/d3-interpolate/src/date.js\n function date_default(a, b) {\n var d = /* @__PURE__ */ new Date();\n return a = +a, b = +b, function(t) {\n return d.setTime(a * (1 - t) + b * t), d;\n };\n }\n var init_date = __esm({\n \"node_modules/d3-interpolate/src/date.js\"() {\n }\n });\n\n // node_modules/d3-interpolate/src/number.js\n function number_default(a, b) {\n return a = +a, b = +b, function(t) {\n return a * (1 - t) + b * t;\n };\n }\n var init_number = __esm({\n \"node_modules/d3-interpolate/src/number.js\"() {\n }\n });\n\n // node_modules/d3-interpolate/src/object.js\n function object_default(a, b) {\n var i = {}, c = {}, k;\n if (a === null || typeof a !== \"object\") a = {};\n if (b === null || typeof b !== \"object\") b = {};\n for (k in b) {\n if (k in a) {\n i[k] = value_default(a[k], b[k]);\n } else {\n c[k] = b[k];\n }\n }\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n }\n var init_object = __esm({\n \"node_modules/d3-interpolate/src/object.js\"() {\n init_value();\n }\n });\n\n // node_modules/d3-interpolate/src/string.js\n function zero(b) {\n return function() {\n return b;\n };\n }\n function one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n }\n function string_default(a, b) {\n var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = [];\n a = a + \"\", b = b + \"\";\n while ((am = reA.exec(a)) && (bm = reB.exec(b))) {\n if ((bs = bm.index) > bi) {\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs;\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) {\n if (s[i]) s[i] += bm;\n else s[++i] = bm;\n } else {\n s[++i] = null;\n q.push({ i, x: number_default(am, bm) });\n }\n bi = reB.lastIndex;\n }\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs;\n else s[++i] = bs;\n }\n return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function(t) {\n for (var i2 = 0, o; i2 < b; ++i2) s[(o = q[i2]).i] = o.x(t);\n return s.join(\"\");\n });\n }\n var reA, reB;\n var init_string = __esm({\n \"node_modules/d3-interpolate/src/string.js\"() {\n init_number();\n reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g;\n reB = new RegExp(reA.source, \"g\");\n }\n });\n\n // node_modules/d3-interpolate/src/value.js\n function value_default(a, b) {\n var t = typeof b, c;\n return b == null || t === \"boolean\" ? constant_default(b) : (t === \"number\" ? number_default : t === \"string\" ? (c = color(b)) ? (b = c, rgb_default) : string_default : b instanceof color ? rgb_default : b instanceof Date ? date_default : isNumberArray(b) ? numberArray_default : Array.isArray(b) ? genericArray : typeof b.valueOf !== \"function\" && typeof b.toString !== \"function\" || isNaN(b) ? object_default : number_default)(a, b);\n }\n var init_value = __esm({\n \"node_modules/d3-interpolate/src/value.js\"() {\n init_src();\n init_rgb();\n init_array();\n init_date();\n init_number();\n init_object();\n init_string();\n init_constant();\n init_numberArray();\n }\n });\n\n // node_modules/d3-interpolate/src/discrete.js\n function discrete_default(range) {\n var n = range.length;\n return function(t) {\n return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];\n };\n }\n var init_discrete = __esm({\n \"node_modules/d3-interpolate/src/discrete.js\"() {\n }\n });\n\n // node_modules/d3-interpolate/src/hue.js\n function hue_default(a, b) {\n var i = hue(+a, +b);\n return function(t) {\n var x = i(t);\n return x - 360 * Math.floor(x / 360);\n };\n }\n var init_hue = __esm({\n \"node_modules/d3-interpolate/src/hue.js\"() {\n init_color2();\n }\n });\n\n // node_modules/d3-interpolate/src/round.js\n function round_default(a, b) {\n return a = +a, b = +b, function(t) {\n return Math.round(a * (1 - t) + b * t);\n };\n }\n var init_round = __esm({\n \"node_modules/d3-interpolate/src/round.js\"() {\n }\n });\n\n // node_modules/d3-interpolate/src/transform/decompose.js\n function decompose_default(a, b, c, d, e, f) {\n var scaleX, scaleY, skewX;\n if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;\n if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;\n if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;\n if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;\n return {\n translateX: e,\n translateY: f,\n rotate: Math.atan2(b, a) * degrees2,\n skewX: Math.atan(skewX) * degrees2,\n scaleX,\n scaleY\n };\n }\n var degrees2, identity;\n var init_decompose = __esm({\n \"node_modules/d3-interpolate/src/transform/decompose.js\"() {\n degrees2 = 180 / Math.PI;\n identity = {\n translateX: 0,\n translateY: 0,\n rotate: 0,\n skewX: 0,\n scaleX: 1,\n scaleY: 1\n };\n }\n });\n\n // node_modules/d3-interpolate/src/transform/parse.js\n function parseCss(value) {\n const m = new (typeof DOMMatrix === \"function\" ? DOMMatrix : WebKitCSSMatrix)(value + \"\");\n return m.isIdentity ? identity : decompose_default(m.a, m.b, m.c, m.d, m.e, m.f);\n }\n function parseSvg(value) {\n if (value == null) return identity;\n if (!svgNode) svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n svgNode.setAttribute(\"transform\", value);\n if (!(value = svgNode.transform.baseVal.consolidate())) return identity;\n value = value.matrix;\n return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f);\n }\n var svgNode;\n var init_parse = __esm({\n \"node_modules/d3-interpolate/src/transform/parse.js\"() {\n init_decompose();\n }\n });\n\n // node_modules/d3-interpolate/src/transform/index.js\n function interpolateTransform(parse2, pxComma, pxParen, degParen) {\n function pop(s) {\n return s.length ? s.pop() + \" \" : \"\";\n }\n function translate(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(\"translate(\", null, pxComma, null, pxParen);\n q.push({ i: i - 4, x: number_default(xa, xb) }, { i: i - 2, x: number_default(ya, yb) });\n } else if (xb || yb) {\n s.push(\"translate(\" + xb + pxComma + yb + pxParen);\n }\n }\n function rotate(a, b, s, q) {\n if (a !== b) {\n if (a - b > 180) b += 360;\n else if (b - a > 180) a += 360;\n q.push({ i: s.push(pop(s) + \"rotate(\", null, degParen) - 2, x: number_default(a, b) });\n } else if (b) {\n s.push(pop(s) + \"rotate(\" + b + degParen);\n }\n }\n function skewX(a, b, s, q) {\n if (a !== b) {\n q.push({ i: s.push(pop(s) + \"skewX(\", null, degParen) - 2, x: number_default(a, b) });\n } else if (b) {\n s.push(pop(s) + \"skewX(\" + b + degParen);\n }\n }\n function scale(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(pop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({ i: i - 4, x: number_default(xa, xb) }, { i: i - 2, x: number_default(ya, yb) });\n } else if (xb !== 1 || yb !== 1) {\n s.push(pop(s) + \"scale(\" + xb + \",\" + yb + \")\");\n }\n }\n return function(a, b) {\n var s = [], q = [];\n a = parse2(a), b = parse2(b);\n translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);\n rotate(a.rotate, b.rotate, s, q);\n skewX(a.skewX, b.skewX, s, q);\n scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);\n a = b = null;\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n };\n }\n var interpolateTransformCss, interpolateTransformSvg;\n var init_transform = __esm({\n \"node_modules/d3-interpolate/src/transform/index.js\"() {\n init_number();\n init_parse();\n interpolateTransformCss = interpolateTransform(parseCss, \"px, \", \"px)\", \"deg)\");\n interpolateTransformSvg = interpolateTransform(parseSvg, \", \", \")\", \")\");\n }\n });\n\n // node_modules/d3-interpolate/src/zoom.js\n function cosh(x) {\n return ((x = Math.exp(x)) + 1 / x) / 2;\n }\n function sinh(x) {\n return ((x = Math.exp(x)) - 1 / x) / 2;\n }\n function tanh(x) {\n return ((x = Math.exp(2 * x)) - 1) / (x + 1);\n }\n var epsilon2, zoom_default;\n var init_zoom = __esm({\n \"node_modules/d3-interpolate/src/zoom.js\"() {\n epsilon2 = 1e-12;\n zoom_default = function zoomRho(rho, rho2, rho4) {\n function zoom(p0, p1) {\n var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S;\n if (d2 < epsilon2) {\n S = Math.log(w1 / w0) / rho;\n i = function(t) {\n return [\n ux0 + t * dx,\n uy0 + t * dy,\n w0 * Math.exp(rho * t * S)\n ];\n };\n } else {\n var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);\n S = (r1 - r0) / rho;\n i = function(t) {\n var s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));\n return [\n ux0 + u * dx,\n uy0 + u * dy,\n w0 * coshr0 / cosh(rho * s + r0)\n ];\n };\n }\n i.duration = S * 1e3 * rho / Math.SQRT2;\n return i;\n }\n zoom.rho = function(_) {\n var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;\n return zoomRho(_1, _2, _4);\n };\n return zoom;\n }(Math.SQRT2, 2, 4);\n }\n });\n\n // node_modules/d3-interpolate/src/hsl.js\n function hsl2(hue2) {\n return function(start, end) {\n var h = hue2((start = hsl(start)).h, (end = hsl(end)).h), s = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n };\n }\n var hsl_default, hslLong;\n var init_hsl = __esm({\n \"node_modules/d3-interpolate/src/hsl.js\"() {\n init_src();\n init_color2();\n hsl_default = hsl2(hue);\n hslLong = hsl2(nogamma);\n }\n });\n\n // node_modules/d3-interpolate/src/lab.js\n function lab2(start, end) {\n var l = nogamma((start = lab(start)).l, (end = lab(end)).l), a = nogamma(start.a, end.a), b = nogamma(start.b, end.b), opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.l = l(t);\n start.a = a(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n var init_lab2 = __esm({\n \"node_modules/d3-interpolate/src/lab.js\"() {\n init_src();\n init_color2();\n }\n });\n\n // node_modules/d3-interpolate/src/hcl.js\n function hcl2(hue2) {\n return function(start, end) {\n var h = hue2((start = hcl(start)).h, (end = hcl(end)).h), c = nogamma(start.c, end.c), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.c = c(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n };\n }\n var hcl_default, hclLong;\n var init_hcl = __esm({\n \"node_modules/d3-interpolate/src/hcl.js\"() {\n init_src();\n init_color2();\n hcl_default = hcl2(hue);\n hclLong = hcl2(nogamma);\n }\n });\n\n // node_modules/d3-interpolate/src/cubehelix.js\n function cubehelix2(hue2) {\n return function cubehelixGamma(y) {\n y = +y;\n function cubehelix3(start, end) {\n var h = hue2((start = cubehelix(start)).h, (end = cubehelix(end)).h), s = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(Math.pow(t, y));\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n cubehelix3.gamma = cubehelixGamma;\n return cubehelix3;\n }(1);\n }\n var cubehelix_default, cubehelixLong;\n var init_cubehelix2 = __esm({\n \"node_modules/d3-interpolate/src/cubehelix.js\"() {\n init_src();\n init_color2();\n cubehelix_default = cubehelix2(hue);\n cubehelixLong = cubehelix2(nogamma);\n }\n });\n\n // node_modules/d3-interpolate/src/piecewise.js\n function piecewise(interpolate, values) {\n if (values === void 0) values = interpolate, interpolate = value_default;\n var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n);\n while (i < n) I[i] = interpolate(v, v = values[++i]);\n return function(t) {\n var i2 = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));\n return I[i2](t - i2);\n };\n }\n var init_piecewise = __esm({\n \"node_modules/d3-interpolate/src/piecewise.js\"() {\n init_value();\n }\n });\n\n // node_modules/d3-interpolate/src/quantize.js\n function quantize_default(interpolator, n) {\n var samples = new Array(n);\n for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));\n return samples;\n }\n var init_quantize = __esm({\n \"node_modules/d3-interpolate/src/quantize.js\"() {\n }\n });\n\n // node_modules/d3-interpolate/src/index.js\n var src_exports = {};\n __export(src_exports, {\n interpolate: () => value_default,\n interpolateArray: () => array_default,\n interpolateBasis: () => basis_default,\n interpolateBasisClosed: () => basisClosed_default,\n interpolateCubehelix: () => cubehelix_default,\n interpolateCubehelixLong: () => cubehelixLong,\n interpolateDate: () => date_default,\n interpolateDiscrete: () => discrete_default,\n interpolateHcl: () => hcl_default,\n interpolateHclLong: () => hclLong,\n interpolateHsl: () => hsl_default,\n interpolateHslLong: () => hslLong,\n interpolateHue: () => hue_default,\n interpolateLab: () => lab2,\n interpolateNumber: () => number_default,\n interpolateNumberArray: () => numberArray_default,\n interpolateObject: () => object_default,\n interpolateRgb: () => rgb_default,\n interpolateRgbBasis: () => rgbBasis,\n interpolateRgbBasisClosed: () => rgbBasisClosed,\n interpolateRound: () => round_default,\n interpolateString: () => string_default,\n interpolateTransformCss: () => interpolateTransformCss,\n interpolateTransformSvg: () => interpolateTransformSvg,\n interpolateZoom: () => zoom_default,\n piecewise: () => piecewise,\n quantize: () => quantize_default\n });\n var init_src2 = __esm({\n \"node_modules/d3-interpolate/src/index.js\"() {\n init_value();\n init_array();\n init_basis();\n init_basisClosed();\n init_date();\n init_discrete();\n init_hue();\n init_number();\n init_numberArray();\n init_object();\n init_round();\n init_string();\n init_transform();\n init_zoom();\n init_rgb();\n init_hsl();\n init_lab2();\n init_hcl();\n init_cubehelix2();\n init_piecewise();\n init_quantize();\n }\n });\n\n // src/traces/sunburst/fill_one.js\n var require_fill_one2 = __commonJS({\n \"src/traces/sunburst/fill_one.js\"(exports, module) {\n \"use strict\";\n var Drawing = require_drawing();\n var Color2 = require_color();\n module.exports = function fillOne(s, pt, trace, gd, fadedColor) {\n var cdi = pt.data.data;\n var ptNumber = cdi.i;\n var color2 = fadedColor || cdi.color;\n if (ptNumber >= 0) {\n pt.i = cdi.i;\n var marker = trace.marker;\n if (marker.pattern) {\n if (!marker.colors || !marker.pattern.shape) {\n marker.color = color2;\n pt.color = color2;\n }\n } else {\n marker.color = color2;\n pt.color = color2;\n }\n Drawing.pointStyle(s, trace, gd, pt);\n } else {\n Color2.fill(s, color2);\n }\n };\n }\n });\n\n // src/traces/sunburst/style.js\n var require_style13 = __commonJS({\n \"src/traces/sunburst/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Color2 = require_color();\n var Lib = require_lib();\n var resizeText = require_uniform_text().resizeText;\n var fillOne = require_fill_one2();\n function style(gd) {\n var s = gd._fullLayout._sunburstlayer.selectAll(\".trace\");\n resizeText(gd, s, \"sunburst\");\n s.each(function(cd) {\n var gTrace = d3.select(this);\n var cd0 = cd[0];\n var trace = cd0.trace;\n gTrace.style(\"opacity\", trace.opacity);\n gTrace.selectAll(\"path.surface\").each(function(pt) {\n d3.select(this).call(styleOne, pt, trace, gd);\n });\n });\n }\n function styleOne(s, pt, trace, gd) {\n var cdi = pt.data.data;\n var isLeaf = !pt.children;\n var ptNumber = cdi.i;\n var lineColor = Lib.castOption(trace, ptNumber, \"marker.line.color\") || Color2.defaultLine;\n var lineWidth = Lib.castOption(trace, ptNumber, \"marker.line.width\") || 0;\n s.call(fillOne, pt, trace, gd).style(\"stroke-width\", lineWidth).call(Color2.stroke, lineColor).style(\"opacity\", isLeaf ? trace.leaf.opacity : null);\n }\n module.exports = {\n style,\n styleOne\n };\n }\n });\n\n // src/traces/sunburst/helpers.js\n var require_helpers15 = __commonJS({\n \"src/traces/sunburst/helpers.js\"(exports) {\n \"use strict\";\n var Lib = require_lib();\n var Color2 = require_color();\n var setCursor = require_setcursor();\n var pieHelpers = require_helpers4();\n exports.findEntryWithLevel = function(hierarchy, level) {\n var out;\n if (level) {\n hierarchy.eachAfter(function(pt) {\n if (exports.getPtId(pt) === level) {\n return out = pt.copy();\n }\n });\n }\n return out || hierarchy;\n };\n exports.findEntryWithChild = function(hierarchy, childId) {\n var out;\n hierarchy.eachAfter(function(pt) {\n var children = pt.children || [];\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n if (exports.getPtId(child) === childId) {\n return out = pt.copy();\n }\n }\n });\n return out || hierarchy;\n };\n exports.isEntry = function(pt) {\n return !pt.parent;\n };\n exports.isLeaf = function(pt) {\n return !pt.children;\n };\n exports.getPtId = function(pt) {\n return pt.data.data.id;\n };\n exports.getPtLabel = function(pt) {\n return pt.data.data.label;\n };\n exports.getValue = function(d) {\n return d.value;\n };\n exports.isHierarchyRoot = function(pt) {\n return getParentId(pt) === \"\";\n };\n exports.setSliceCursor = function(sliceTop, gd, opts) {\n var hide = opts.isTransitioning;\n if (!hide) {\n var pt = sliceTop.datum();\n hide = opts.hideOnRoot && exports.isHierarchyRoot(pt) || opts.hideOnLeaves && exports.isLeaf(pt);\n }\n setCursor(sliceTop, hide ? null : \"pointer\");\n };\n function determineOutsideTextFont(trace, pt, layoutFont) {\n return {\n color: exports.getOutsideTextFontKey(\"color\", trace, pt, layoutFont),\n family: exports.getOutsideTextFontKey(\"family\", trace, pt, layoutFont),\n size: exports.getOutsideTextFontKey(\"size\", trace, pt, layoutFont),\n weight: exports.getOutsideTextFontKey(\"weight\", trace, pt, layoutFont),\n style: exports.getOutsideTextFontKey(\"style\", trace, pt, layoutFont),\n variant: exports.getOutsideTextFontKey(\"variant\", trace, pt, layoutFont),\n textcase: exports.getOutsideTextFontKey(\"textcase\", trace, pt, layoutFont),\n lineposition: exports.getOutsideTextFontKey(\"lineposition\", trace, pt, layoutFont),\n shadow: exports.getOutsideTextFontKey(\"shadow\", trace, pt, layoutFont)\n };\n }\n function determineInsideTextFont(trace, pt, layoutFont, opts) {\n var onPathbar = (opts || {}).onPathbar;\n var cdi = pt.data.data;\n var ptNumber = cdi.i;\n var customColor = Lib.castOption(\n trace,\n ptNumber,\n (onPathbar ? \"pathbar.textfont\" : \"insidetextfont\") + \".color\"\n );\n if (!customColor && trace._input.textfont) {\n customColor = Lib.castOption(trace._input, ptNumber, \"textfont.color\");\n }\n return {\n color: customColor || Color2.contrast(cdi.color),\n family: exports.getInsideTextFontKey(\"family\", trace, pt, layoutFont, opts),\n size: exports.getInsideTextFontKey(\"size\", trace, pt, layoutFont, opts),\n weight: exports.getInsideTextFontKey(\"weight\", trace, pt, layoutFont, opts),\n style: exports.getInsideTextFontKey(\"style\", trace, pt, layoutFont, opts),\n variant: exports.getInsideTextFontKey(\"variant\", trace, pt, layoutFont, opts),\n textcase: exports.getInsideTextFontKey(\"textcase\", trace, pt, layoutFont, opts),\n lineposition: exports.getInsideTextFontKey(\"lineposition\", trace, pt, layoutFont, opts),\n shadow: exports.getInsideTextFontKey(\"shadow\", trace, pt, layoutFont, opts)\n };\n }\n exports.getInsideTextFontKey = function(keyStr, trace, pt, layoutFont, opts) {\n var onPathbar = (opts || {}).onPathbar;\n var cont = onPathbar ? \"pathbar.textfont\" : \"insidetextfont\";\n var ptNumber = pt.data.data.i;\n return Lib.castOption(trace, ptNumber, cont + \".\" + keyStr) || Lib.castOption(trace, ptNumber, \"textfont.\" + keyStr) || layoutFont.size;\n };\n exports.getOutsideTextFontKey = function(keyStr, trace, pt, layoutFont) {\n var ptNumber = pt.data.data.i;\n return Lib.castOption(trace, ptNumber, \"outsidetextfont.\" + keyStr) || Lib.castOption(trace, ptNumber, \"textfont.\" + keyStr) || layoutFont.size;\n };\n exports.isOutsideText = function(trace, pt) {\n return !trace._hasColorscale && exports.isHierarchyRoot(pt);\n };\n exports.determineTextFont = function(trace, pt, layoutFont, opts) {\n return exports.isOutsideText(trace, pt) ? determineOutsideTextFont(trace, pt, layoutFont) : determineInsideTextFont(trace, pt, layoutFont, opts);\n };\n exports.hasTransition = function(transitionOpts) {\n return !!(transitionOpts && transitionOpts.duration > 0);\n };\n exports.getMaxDepth = function(trace) {\n return trace.maxdepth >= 0 ? trace.maxdepth : Infinity;\n };\n exports.isHeader = function(pt, trace) {\n return !(exports.isLeaf(pt) || pt.depth === trace._maxDepth - 1);\n };\n function getParentId(pt) {\n return pt.data.data.pid;\n }\n exports.getParent = function(hierarchy, pt) {\n return exports.findEntryWithLevel(hierarchy, getParentId(pt));\n };\n exports.listPath = function(d, keyStr) {\n var parent = d.parent;\n if (!parent) return [];\n var list = keyStr ? [parent.data[keyStr]] : [parent];\n return exports.listPath(parent, keyStr).concat(list);\n };\n exports.getPath = function(d) {\n return exports.listPath(d, \"label\").join(\"/\") + \"/\";\n };\n exports.formatValue = pieHelpers.formatPieValue;\n exports.formatPercent = function(v, separators) {\n var tx = Lib.formatPercent(v, 0);\n if (tx === \"0%\") tx = pieHelpers.formatPiePercent(v, separators);\n return tx;\n };\n }\n });\n\n // src/traces/sunburst/fx.js\n var require_fx2 = __commonJS({\n \"src/traces/sunburst/fx.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Registry = require_registry();\n var appendArrayPointValue = require_helpers2().appendArrayPointValue;\n var Fx = require_fx();\n var Lib = require_lib();\n var Events = require_events2();\n var helpers = require_helpers15();\n var pieHelpers = require_helpers4();\n var formatValue = pieHelpers.formatPieValue;\n module.exports = function attachFxHandlers(sliceTop, entry, gd, cd, opts) {\n var cd0 = cd[0];\n var trace = cd0.trace;\n var hierarchy = cd0.hierarchy;\n var isSunburst = trace.type === \"sunburst\";\n var isTreemapOrIcicle = trace.type === \"treemap\" || trace.type === \"icicle\";\n if (!(\"_hasHoverLabel\" in trace)) trace._hasHoverLabel = false;\n if (!(\"_hasHoverEvent\" in trace)) trace._hasHoverEvent = false;\n var onMouseOver = function(pt) {\n var fullLayoutNow = gd._fullLayout;\n if (gd._dragging || fullLayoutNow.hovermode === false) return;\n var traceNow = gd._fullData[trace.index];\n var cdi = pt.data.data;\n var ptNumber = cdi.i;\n var isRoot = helpers.isHierarchyRoot(pt);\n var parent = helpers.getParent(hierarchy, pt);\n var val = helpers.getValue(pt);\n var _cast = function(astr) {\n return Lib.castOption(traceNow, ptNumber, astr);\n };\n var hovertemplate = _cast(\"hovertemplate\");\n var hoverinfo = Fx.castHoverinfo(traceNow, fullLayoutNow, ptNumber);\n var separators = fullLayoutNow.separators;\n var eventData;\n if (hovertemplate || hoverinfo && hoverinfo !== \"none\" && hoverinfo !== \"skip\") {\n var hoverCenterX;\n var hoverCenterY;\n if (isSunburst) {\n hoverCenterX = cd0.cx + pt.pxmid[0] * (1 - pt.rInscribed);\n hoverCenterY = cd0.cy + pt.pxmid[1] * (1 - pt.rInscribed);\n }\n if (isTreemapOrIcicle) {\n hoverCenterX = pt._hoverX;\n hoverCenterY = pt._hoverY;\n }\n var hoverPt = {};\n var parts = [];\n var thisText = [];\n var hasFlag = function(flag) {\n return parts.indexOf(flag) !== -1;\n };\n if (hoverinfo) {\n parts = hoverinfo === \"all\" ? traceNow._module.attributes.hoverinfo.flags : hoverinfo.split(\"+\");\n }\n hoverPt.label = cdi.label;\n if (hasFlag(\"label\") && hoverPt.label) thisText.push(hoverPt.label);\n if (cdi.hasOwnProperty(\"v\")) {\n hoverPt.value = cdi.v;\n hoverPt.valueLabel = formatValue(hoverPt.value, separators);\n if (hasFlag(\"value\")) thisText.push(hoverPt.valueLabel);\n }\n hoverPt.currentPath = pt.currentPath = helpers.getPath(pt.data);\n if (hasFlag(\"current path\") && !isRoot) {\n thisText.push(hoverPt.currentPath);\n }\n var tx;\n var allPercents = [];\n var insertPercent = function() {\n if (allPercents.indexOf(tx) === -1) {\n thisText.push(tx);\n allPercents.push(tx);\n }\n };\n hoverPt.percentParent = pt.percentParent = val / helpers.getValue(parent);\n hoverPt.parent = pt.parentString = helpers.getPtLabel(parent);\n if (hasFlag(\"percent parent\")) {\n tx = helpers.formatPercent(hoverPt.percentParent, separators) + \" of \" + hoverPt.parent;\n insertPercent();\n }\n hoverPt.percentEntry = pt.percentEntry = val / helpers.getValue(entry);\n hoverPt.entry = pt.entry = helpers.getPtLabel(entry);\n if (hasFlag(\"percent entry\") && !isRoot && !pt.onPathbar) {\n tx = helpers.formatPercent(hoverPt.percentEntry, separators) + \" of \" + hoverPt.entry;\n insertPercent();\n }\n hoverPt.percentRoot = pt.percentRoot = val / helpers.getValue(hierarchy);\n hoverPt.root = pt.root = helpers.getPtLabel(hierarchy);\n if (hasFlag(\"percent root\") && !isRoot) {\n tx = helpers.formatPercent(hoverPt.percentRoot, separators) + \" of \" + hoverPt.root;\n insertPercent();\n }\n hoverPt.text = _cast(\"hovertext\") || _cast(\"text\");\n if (hasFlag(\"text\")) {\n tx = hoverPt.text;\n if (Lib.isValidTextValue(tx)) thisText.push(tx);\n }\n eventData = [makeEventData(pt, traceNow, opts.eventDataKeys)];\n var hoverItems = {\n trace: traceNow,\n y: hoverCenterY,\n _x0: pt._x0,\n _x1: pt._x1,\n _y0: pt._y0,\n _y1: pt._y1,\n text: thisText.join(\"
    \"),\n name: hovertemplate || hasFlag(\"name\") ? traceNow.name : void 0,\n color: _cast(\"hoverlabel.bgcolor\") || cdi.color,\n borderColor: _cast(\"hoverlabel.bordercolor\"),\n fontFamily: _cast(\"hoverlabel.font.family\"),\n fontSize: _cast(\"hoverlabel.font.size\"),\n fontColor: _cast(\"hoverlabel.font.color\"),\n fontWeight: _cast(\"hoverlabel.font.weight\"),\n fontStyle: _cast(\"hoverlabel.font.style\"),\n fontVariant: _cast(\"hoverlabel.font.variant\"),\n nameLength: _cast(\"hoverlabel.namelength\"),\n textAlign: _cast(\"hoverlabel.align\"),\n hovertemplate,\n hovertemplateLabels: hoverPt,\n eventData\n };\n if (isSunburst) {\n hoverItems.x0 = hoverCenterX - pt.rInscribed * pt.rpx1;\n hoverItems.x1 = hoverCenterX + pt.rInscribed * pt.rpx1;\n hoverItems.idealAlign = pt.pxmid[0] < 0 ? \"left\" : \"right\";\n }\n if (isTreemapOrIcicle) {\n hoverItems.x = hoverCenterX;\n hoverItems.idealAlign = hoverCenterX < 0 ? \"left\" : \"right\";\n }\n var bbox = [];\n Fx.loneHover(hoverItems, {\n container: fullLayoutNow._hoverlayer.node(),\n outerContainer: fullLayoutNow._paper.node(),\n gd,\n inOut_bbox: bbox\n });\n eventData[0].bbox = bbox[0];\n trace._hasHoverLabel = true;\n }\n if (isTreemapOrIcicle) {\n var slice = sliceTop.select(\"path.surface\");\n opts.styleOne(slice, pt, traceNow, gd, {\n hovered: true\n });\n }\n trace._hasHoverEvent = true;\n gd.emit(\"plotly_hover\", {\n points: eventData || [makeEventData(pt, traceNow, opts.eventDataKeys)],\n event: d3.event\n });\n };\n var onMouseOut = function(evt) {\n var fullLayoutNow = gd._fullLayout;\n var traceNow = gd._fullData[trace.index];\n var pt = d3.select(this).datum();\n if (trace._hasHoverEvent) {\n evt.originalEvent = d3.event;\n gd.emit(\"plotly_unhover\", {\n points: [makeEventData(pt, traceNow, opts.eventDataKeys)],\n event: d3.event\n });\n trace._hasHoverEvent = false;\n }\n if (trace._hasHoverLabel) {\n Fx.loneUnhover(fullLayoutNow._hoverlayer.node());\n trace._hasHoverLabel = false;\n }\n if (isTreemapOrIcicle) {\n var slice = sliceTop.select(\"path.surface\");\n opts.styleOne(slice, pt, traceNow, gd, {\n hovered: false\n });\n }\n };\n var onClick = function(pt) {\n var fullLayoutNow = gd._fullLayout;\n var traceNow = gd._fullData[trace.index];\n var noTransition = isSunburst && (helpers.isHierarchyRoot(pt) || helpers.isLeaf(pt));\n var id = helpers.getPtId(pt);\n var nextEntry = helpers.isEntry(pt) ? helpers.findEntryWithChild(hierarchy, id) : helpers.findEntryWithLevel(hierarchy, id);\n var nextLevel = helpers.getPtId(nextEntry);\n var typeClickEvtData = {\n points: [makeEventData(pt, traceNow, opts.eventDataKeys)],\n event: d3.event\n };\n if (!noTransition) typeClickEvtData.nextLevel = nextLevel;\n var clickVal = Events.triggerHandler(gd, \"plotly_\" + trace.type + \"click\", typeClickEvtData);\n if (clickVal !== false && fullLayoutNow.hovermode) {\n gd._hoverdata = [makeEventData(pt, traceNow, opts.eventDataKeys)];\n Fx.click(gd, d3.event);\n }\n if (noTransition) return;\n if (clickVal === false) return;\n if (gd._dragging) return;\n if (gd._transitioning) return;\n Registry.call(\"_storeDirectGUIEdit\", traceNow, fullLayoutNow._tracePreGUI[traceNow.uid], {\n level: traceNow.level\n });\n var frame = {\n data: [{ level: nextLevel }],\n traces: [trace.index]\n };\n var animOpts = {\n frame: {\n redraw: false,\n duration: opts.transitionTime\n },\n transition: {\n duration: opts.transitionTime,\n easing: opts.transitionEasing\n },\n mode: \"immediate\",\n fromcurrent: true\n };\n Fx.loneUnhover(fullLayoutNow._hoverlayer.node());\n Registry.call(\"animate\", gd, frame, animOpts);\n };\n sliceTop.on(\"mouseover\", onMouseOver);\n sliceTop.on(\"mouseout\", onMouseOut);\n sliceTop.on(\"click\", onClick);\n };\n function makeEventData(pt, trace, keys) {\n var cdi = pt.data.data;\n var out = {\n curveNumber: trace.index,\n pointNumber: cdi.i,\n data: trace._input,\n fullData: trace\n // TODO more things like 'children', 'siblings', 'hierarchy?\n };\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n if (key in pt) out[key] = pt[key];\n }\n if (\"parentString\" in pt && !helpers.isHierarchyRoot(pt)) out.parent = pt.parentString;\n appendArrayPointValue(out, trace, cdi.i);\n return out;\n }\n }\n });\n\n // src/traces/sunburst/plot.js\n var require_plot13 = __commonJS({\n \"src/traces/sunburst/plot.js\"(exports) {\n \"use strict\";\n var d3 = require_d3();\n var d3Hierarchy = require_d3_hierarchy();\n var interpolate = (init_src2(), __toCommonJS(src_exports)).interpolate;\n var Drawing = require_drawing();\n var Lib = require_lib();\n var svgTextUtils = require_svg_text_utils();\n var uniformText = require_uniform_text();\n var recordMinTextSize = uniformText.recordMinTextSize;\n var clearMinTextSize = uniformText.clearMinTextSize;\n var piePlot = require_plot12();\n var getRotationAngle = require_helpers4().getRotationAngle;\n var computeTransform = piePlot.computeTransform;\n var transformInsideText = piePlot.transformInsideText;\n var styleOne = require_style13().styleOne;\n var resizeText = require_style4().resizeText;\n var attachFxHandlers = require_fx2();\n var constants = require_constants20();\n var helpers = require_helpers15();\n exports.plot = function(gd, cdmodule, transitionOpts, makeOnCompleteCallback) {\n var fullLayout = gd._fullLayout;\n var layer = fullLayout._sunburstlayer;\n var join, onComplete;\n var isFullReplot = !transitionOpts;\n var hasTransition = !fullLayout.uniformtext.mode && helpers.hasTransition(transitionOpts);\n clearMinTextSize(\"sunburst\", fullLayout);\n join = layer.selectAll(\"g.trace.sunburst\").data(cdmodule, function(cd) {\n return cd[0].trace.uid;\n });\n join.enter().append(\"g\").classed(\"trace\", true).classed(\"sunburst\", true).attr(\"stroke-linejoin\", \"round\");\n join.order();\n if (hasTransition) {\n if (makeOnCompleteCallback) {\n onComplete = makeOnCompleteCallback();\n }\n var transition = d3.transition().duration(transitionOpts.duration).ease(transitionOpts.easing).each(\"end\", function() {\n onComplete && onComplete();\n }).each(\"interrupt\", function() {\n onComplete && onComplete();\n });\n transition.each(function() {\n layer.selectAll(\"g.trace\").each(function(cd) {\n plotOne(gd, cd, this, transitionOpts);\n });\n });\n } else {\n join.each(function(cd) {\n plotOne(gd, cd, this, transitionOpts);\n });\n if (fullLayout.uniformtext.mode) {\n resizeText(gd, fullLayout._sunburstlayer.selectAll(\".trace\"), \"sunburst\");\n }\n }\n if (isFullReplot) {\n join.exit().remove();\n }\n };\n function plotOne(gd, cd, element, transitionOpts) {\n var isStatic = gd._context.staticPlot;\n var fullLayout = gd._fullLayout;\n var hasTransition = !fullLayout.uniformtext.mode && helpers.hasTransition(transitionOpts);\n var gTrace = d3.select(element);\n var slices = gTrace.selectAll(\"g.slice\");\n var cd0 = cd[0];\n var trace = cd0.trace;\n var hierarchy = cd0.hierarchy;\n var entry = helpers.findEntryWithLevel(hierarchy, trace.level);\n var maxDepth = helpers.getMaxDepth(trace);\n var gs = fullLayout._size;\n var domain = trace.domain;\n var vpw = gs.w * (domain.x[1] - domain.x[0]);\n var vph = gs.h * (domain.y[1] - domain.y[0]);\n var rMax = 0.5 * Math.min(vpw, vph);\n var cx = cd0.cx = gs.l + gs.w * (domain.x[1] + domain.x[0]) / 2;\n var cy = cd0.cy = gs.t + gs.h * (1 - domain.y[0]) - vph / 2;\n if (!entry) {\n return slices.remove();\n }\n var prevEntry = null;\n var prevLookup = {};\n if (hasTransition) {\n slices.each(function(pt) {\n prevLookup[helpers.getPtId(pt)] = {\n rpx0: pt.rpx0,\n rpx1: pt.rpx1,\n x0: pt.x0,\n x1: pt.x1,\n transform: pt.transform\n };\n if (!prevEntry && helpers.isEntry(pt)) {\n prevEntry = pt;\n }\n });\n }\n var sliceData = partition(entry).descendants();\n var maxHeight = entry.height + 1;\n var yOffset = 0;\n var cutoff = maxDepth;\n if (cd0.hasMultipleRoots && helpers.isHierarchyRoot(entry)) {\n sliceData = sliceData.slice(1);\n maxHeight -= 1;\n yOffset = 1;\n cutoff += 1;\n }\n sliceData = sliceData.filter(function(pt) {\n return pt.y1 <= cutoff;\n });\n var baseX = getRotationAngle(trace.rotation);\n if (baseX) {\n sliceData.forEach(function(pt) {\n pt.x0 += baseX;\n pt.x1 += baseX;\n });\n }\n var maxY = Math.min(maxHeight, maxDepth);\n var y2rpx = function(y) {\n return (y - yOffset) / maxY * rMax;\n };\n var rx2px = function(r, x) {\n return [r * Math.cos(x), -r * Math.sin(x)];\n };\n var pathSlice = function(d) {\n return Lib.pathAnnulus(d.rpx0, d.rpx1, d.x0, d.x1, cx, cy);\n };\n var getTargetX = function(d) {\n return cx + getTextXY(d)[0] * (d.transform.rCenter || 0) + (d.transform.x || 0);\n };\n var getTargetY = function(d) {\n return cy + getTextXY(d)[1] * (d.transform.rCenter || 0) + (d.transform.y || 0);\n };\n slices = slices.data(sliceData, helpers.getPtId);\n slices.enter().append(\"g\").classed(\"slice\", true);\n if (hasTransition) {\n slices.exit().transition().each(function() {\n var sliceTop = d3.select(this);\n var slicePath = sliceTop.select(\"path.surface\");\n slicePath.transition().attrTween(\"d\", function(pt2) {\n var interp = makeExitSliceInterpolator(pt2);\n return function(t) {\n return pathSlice(interp(t));\n };\n });\n var sliceTextGroup = sliceTop.select(\"g.slicetext\");\n sliceTextGroup.attr(\"opacity\", 0);\n }).remove();\n } else {\n slices.exit().remove();\n }\n slices.order();\n var nextX1ofPrevEntry = null;\n if (hasTransition && prevEntry) {\n var prevEntryId = helpers.getPtId(prevEntry);\n slices.each(function(pt) {\n if (nextX1ofPrevEntry === null && helpers.getPtId(pt) === prevEntryId) {\n nextX1ofPrevEntry = pt.x1;\n }\n });\n }\n var updateSlices = slices;\n if (hasTransition) {\n updateSlices = updateSlices.transition().each(\"end\", function() {\n var sliceTop = d3.select(this);\n helpers.setSliceCursor(sliceTop, gd, {\n hideOnRoot: true,\n hideOnLeaves: true,\n isTransitioning: false\n });\n });\n }\n updateSlices.each(function(pt) {\n var sliceTop = d3.select(this);\n var slicePath = Lib.ensureSingle(sliceTop, \"path\", \"surface\", function(s) {\n s.style(\"pointer-events\", isStatic ? \"none\" : \"all\");\n });\n pt.rpx0 = y2rpx(pt.y0);\n pt.rpx1 = y2rpx(pt.y1);\n pt.xmid = (pt.x0 + pt.x1) / 2;\n pt.pxmid = rx2px(pt.rpx1, pt.xmid);\n pt.midangle = -(pt.xmid - Math.PI / 2);\n pt.startangle = -(pt.x0 - Math.PI / 2);\n pt.stopangle = -(pt.x1 - Math.PI / 2);\n pt.halfangle = 0.5 * Math.min(Lib.angleDelta(pt.x0, pt.x1) || Math.PI, Math.PI);\n pt.ring = 1 - pt.rpx0 / pt.rpx1;\n pt.rInscribed = getInscribedRadiusFraction(pt, trace);\n if (hasTransition) {\n slicePath.transition().attrTween(\"d\", function(pt2) {\n var interp = makeUpdateSliceInterpolator(pt2);\n return function(t) {\n return pathSlice(interp(t));\n };\n });\n } else {\n slicePath.attr(\"d\", pathSlice);\n }\n sliceTop.call(attachFxHandlers, entry, gd, cd, {\n eventDataKeys: constants.eventDataKeys,\n transitionTime: constants.CLICK_TRANSITION_TIME,\n transitionEasing: constants.CLICK_TRANSITION_EASING\n }).call(helpers.setSliceCursor, gd, {\n hideOnRoot: true,\n hideOnLeaves: true,\n isTransitioning: gd._transitioning\n });\n slicePath.call(styleOne, pt, trace, gd);\n var sliceTextGroup = Lib.ensureSingle(sliceTop, \"g\", \"slicetext\");\n var sliceText = Lib.ensureSingle(sliceTextGroup, \"text\", \"\", function(s) {\n s.attr(\"data-notex\", 1);\n });\n var font = Lib.ensureUniformFontSize(gd, helpers.determineTextFont(trace, pt, fullLayout.font));\n sliceText.text(exports.formatSliceLabel(pt, entry, trace, cd, fullLayout)).classed(\"slicetext\", true).attr(\"text-anchor\", \"middle\").call(Drawing.font, font).call(svgTextUtils.convertToTspans, gd);\n var textBB = Drawing.bBox(sliceText.node());\n pt.transform = transformInsideText(textBB, pt, cd0);\n pt.transform.targetX = getTargetX(pt);\n pt.transform.targetY = getTargetY(pt);\n var strTransform = function(d, textBB2) {\n var transform = d.transform;\n computeTransform(transform, textBB2);\n transform.fontSize = font.size;\n recordMinTextSize(trace.type, transform, fullLayout);\n return Lib.getTextTransform(transform);\n };\n if (hasTransition) {\n sliceText.transition().attrTween(\"transform\", function(pt2) {\n var interp = makeUpdateTextInterpolator(pt2);\n return function(t) {\n return strTransform(interp(t), textBB);\n };\n });\n } else {\n sliceText.attr(\"transform\", strTransform(pt, textBB));\n }\n });\n function makeExitSliceInterpolator(pt) {\n var id = helpers.getPtId(pt);\n var prev = prevLookup[id];\n var entryPrev = prevLookup[helpers.getPtId(entry)];\n var next;\n if (entryPrev) {\n var a = (pt.x1 > entryPrev.x1 ? 2 * Math.PI : 0) + baseX;\n next = pt.rpx1 < entryPrev.rpx1 ? { x0: pt.x0, x1: pt.x1, rpx0: 0, rpx1: 0 } : { x0: a, x1: a, rpx0: pt.rpx0, rpx1: pt.rpx1 };\n } else {\n var parent;\n var parentId = helpers.getPtId(pt.parent);\n slices.each(function(pt2) {\n if (helpers.getPtId(pt2) === parentId) {\n return parent = pt2;\n }\n });\n var parentChildren = parent.children;\n var ci;\n parentChildren.forEach(function(pt2, i) {\n if (helpers.getPtId(pt2) === id) {\n return ci = i;\n }\n });\n var n = parentChildren.length;\n var interp = interpolate(parent.x0, parent.x1);\n next = {\n rpx0: rMax,\n rpx1: rMax,\n x0: interp(ci / n),\n x1: interp((ci + 1) / n)\n };\n }\n return interpolate(prev, next);\n }\n function makeUpdateSliceInterpolator(pt) {\n var prev0 = prevLookup[helpers.getPtId(pt)];\n var prev;\n var next = { x0: pt.x0, x1: pt.x1, rpx0: pt.rpx0, rpx1: pt.rpx1 };\n if (prev0) {\n prev = prev0;\n } else {\n if (prevEntry) {\n if (pt.parent) {\n if (nextX1ofPrevEntry) {\n var a = (pt.x1 > nextX1ofPrevEntry ? 2 * Math.PI : 0) + baseX;\n prev = { x0: a, x1: a };\n } else {\n prev = { rpx0: rMax, rpx1: rMax };\n Lib.extendFlat(prev, interpX0X1FromParent(pt));\n }\n } else {\n prev = { rpx0: 0, rpx1: 0 };\n }\n } else {\n prev = { x0: baseX, x1: baseX };\n }\n }\n return interpolate(prev, next);\n }\n function makeUpdateTextInterpolator(pt) {\n var prev0 = prevLookup[helpers.getPtId(pt)];\n var prev;\n var transform = pt.transform;\n if (prev0) {\n prev = prev0;\n } else {\n prev = {\n rpx1: pt.rpx1,\n transform: {\n textPosAngle: transform.textPosAngle,\n scale: 0,\n rotate: transform.rotate,\n rCenter: transform.rCenter,\n x: transform.x,\n y: transform.y\n }\n };\n if (prevEntry) {\n if (pt.parent) {\n if (nextX1ofPrevEntry) {\n var a = pt.x1 > nextX1ofPrevEntry ? 2 * Math.PI : 0;\n prev.x0 = prev.x1 = a;\n } else {\n Lib.extendFlat(prev, interpX0X1FromParent(pt));\n }\n } else {\n prev.x0 = prev.x1 = baseX;\n }\n } else {\n prev.x0 = prev.x1 = baseX;\n }\n }\n var textPosAngleFn = interpolate(prev.transform.textPosAngle, pt.transform.textPosAngle);\n var rpx1Fn = interpolate(prev.rpx1, pt.rpx1);\n var x0Fn = interpolate(prev.x0, pt.x0);\n var x1Fn = interpolate(prev.x1, pt.x1);\n var scaleFn = interpolate(prev.transform.scale, transform.scale);\n var rotateFn = interpolate(prev.transform.rotate, transform.rotate);\n var pow = transform.rCenter === 0 ? 3 : prev.transform.rCenter === 0 ? 1 / 3 : 1;\n var _rCenterFn = interpolate(prev.transform.rCenter, transform.rCenter);\n var rCenterFn = function(t) {\n return _rCenterFn(Math.pow(t, pow));\n };\n return function(t) {\n var rpx1 = rpx1Fn(t);\n var x0 = x0Fn(t);\n var x1 = x1Fn(t);\n var rCenter = rCenterFn(t);\n var pxmid = rx2px(rpx1, (x0 + x1) / 2);\n var textPosAngle = textPosAngleFn(t);\n var d = {\n pxmid,\n rpx1,\n transform: {\n textPosAngle,\n rCenter,\n x: transform.x,\n y: transform.y\n }\n };\n recordMinTextSize(trace.type, transform, fullLayout);\n return {\n transform: {\n targetX: getTargetX(d),\n targetY: getTargetY(d),\n scale: scaleFn(t),\n rotate: rotateFn(t),\n rCenter\n }\n };\n };\n }\n function interpX0X1FromParent(pt) {\n var parent = pt.parent;\n var parentPrev = prevLookup[helpers.getPtId(parent)];\n var out = {};\n if (parentPrev) {\n var parentChildren = parent.children;\n var ci = parentChildren.indexOf(pt);\n var n = parentChildren.length;\n var interp = interpolate(parentPrev.x0, parentPrev.x1);\n out.x0 = interp(ci / n);\n out.x1 = interp(ci / n);\n } else {\n out.x0 = out.x1 = 0;\n }\n return out;\n }\n }\n function partition(entry) {\n return d3Hierarchy.partition().size([2 * Math.PI, entry.height + 1])(entry);\n }\n exports.formatSliceLabel = function(pt, entry, trace, cd, fullLayout) {\n var texttemplate = trace.texttemplate;\n var textinfo = trace.textinfo;\n if (!texttemplate && (!textinfo || textinfo === \"none\")) {\n return \"\";\n }\n var separators = fullLayout.separators;\n var cd0 = cd[0];\n var cdi = pt.data.data;\n var hierarchy = cd0.hierarchy;\n var isRoot = helpers.isHierarchyRoot(pt);\n var parent = helpers.getParent(hierarchy, pt);\n var val = helpers.getValue(pt);\n if (!texttemplate) {\n var parts = textinfo.split(\"+\");\n var hasFlag = function(flag) {\n return parts.indexOf(flag) !== -1;\n };\n var thisText = [];\n var tx;\n if (hasFlag(\"label\") && cdi.label) {\n thisText.push(cdi.label);\n }\n if (cdi.hasOwnProperty(\"v\") && hasFlag(\"value\")) {\n thisText.push(helpers.formatValue(cdi.v, separators));\n }\n if (!isRoot) {\n if (hasFlag(\"current path\")) {\n thisText.push(helpers.getPath(pt.data));\n }\n var nPercent = 0;\n if (hasFlag(\"percent parent\")) nPercent++;\n if (hasFlag(\"percent entry\")) nPercent++;\n if (hasFlag(\"percent root\")) nPercent++;\n var hasMultiplePercents = nPercent > 1;\n if (nPercent) {\n var percent;\n var addPercent = function(key) {\n tx = helpers.formatPercent(percent, separators);\n if (hasMultiplePercents) tx += \" of \" + key;\n thisText.push(tx);\n };\n if (hasFlag(\"percent parent\") && !isRoot) {\n percent = val / helpers.getValue(parent);\n addPercent(\"parent\");\n }\n if (hasFlag(\"percent entry\")) {\n percent = val / helpers.getValue(entry);\n addPercent(\"entry\");\n }\n if (hasFlag(\"percent root\")) {\n percent = val / helpers.getValue(hierarchy);\n addPercent(\"root\");\n }\n }\n }\n if (hasFlag(\"text\")) {\n tx = Lib.castOption(trace, cdi.i, \"text\");\n if (Lib.isValidTextValue(tx)) thisText.push(tx);\n }\n return thisText.join(\"
    \");\n }\n var txt = Lib.castOption(trace, cdi.i, \"texttemplate\");\n if (!txt) return \"\";\n var obj = {};\n if (cdi.label) obj.label = cdi.label;\n if (cdi.hasOwnProperty(\"v\")) {\n obj.value = cdi.v;\n obj.valueLabel = helpers.formatValue(cdi.v, separators);\n }\n obj.currentPath = helpers.getPath(pt.data);\n if (!isRoot) {\n obj.percentParent = val / helpers.getValue(parent);\n obj.percentParentLabel = helpers.formatPercent(\n obj.percentParent,\n separators\n );\n obj.parent = helpers.getPtLabel(parent);\n }\n obj.percentEntry = val / helpers.getValue(entry);\n obj.percentEntryLabel = helpers.formatPercent(\n obj.percentEntry,\n separators\n );\n obj.entry = helpers.getPtLabel(entry);\n obj.percentRoot = val / helpers.getValue(hierarchy);\n obj.percentRootLabel = helpers.formatPercent(\n obj.percentRoot,\n separators\n );\n obj.root = helpers.getPtLabel(hierarchy);\n if (cdi.hasOwnProperty(\"color\")) {\n obj.color = cdi.color;\n }\n var ptTx = Lib.castOption(trace, cdi.i, \"text\");\n if (Lib.isValidTextValue(ptTx) || ptTx === \"\") obj.text = ptTx;\n obj.customdata = Lib.castOption(trace, cdi.i, \"customdata\");\n return Lib.texttemplateString(txt, obj, fullLayout._d3locale, obj, trace._meta || {});\n };\n function getInscribedRadiusFraction(pt) {\n if (pt.rpx0 === 0 && Lib.isFullCircle([pt.x0, pt.x1])) {\n return 1;\n } else {\n return Math.max(0, Math.min(\n 1 / (1 + 1 / Math.sin(pt.halfangle)),\n pt.ring / 2\n ));\n }\n }\n function getTextXY(d) {\n return getCoords(d.rpx1, d.transform.textPosAngle);\n }\n function getCoords(r, angle) {\n return [r * Math.sin(angle), -r * Math.cos(angle)];\n }\n }\n });\n\n // src/traces/sunburst/index.js\n var require_sunburst = __commonJS({\n \"src/traces/sunburst/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"trace\",\n name: \"sunburst\",\n basePlotModule: require_base_plot2(),\n categories: [],\n animatable: true,\n attributes: require_attributes36(),\n layoutAttributes: require_layout_attributes13(),\n supplyDefaults: require_defaults32(),\n supplyLayoutDefaults: require_layout_defaults12(),\n calc: require_calc17().calc,\n crossTraceCalc: require_calc17().crossTraceCalc,\n plot: require_plot13().plot,\n style: require_style13().style,\n colorbar: require_marker_colorbar(),\n meta: {}\n };\n }\n });\n\n // lib/sunburst.js\n var require_sunburst2 = __commonJS({\n \"lib/sunburst.js\"(exports, module) {\n \"use strict\";\n module.exports = require_sunburst();\n }\n });\n\n // src/traces/treemap/base_plot.js\n var require_base_plot3 = __commonJS({\n \"src/traces/treemap/base_plot.js\"(exports) {\n \"use strict\";\n var plots = require_plots();\n exports.name = \"treemap\";\n exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) {\n plots.plotBasePlot(exports.name, gd, traces, transitionOpts, makeOnCompleteCallback);\n };\n exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout);\n };\n }\n });\n\n // src/traces/treemap/constants.js\n var require_constants21 = __commonJS({\n \"src/traces/treemap/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n CLICK_TRANSITION_TIME: 750,\n CLICK_TRANSITION_EASING: \"poly\",\n eventDataKeys: [\n // string\n \"currentPath\",\n \"root\",\n \"entry\",\n // no need to add 'parent' here\n // percentages i.e. ratios\n \"percentRoot\",\n \"percentEntry\",\n \"percentParent\"\n ],\n gapWithPathbar: 1\n // i.e. one pixel\n };\n }\n });\n\n // src/traces/treemap/attributes.js\n var require_attributes37 = __commonJS({\n \"src/traces/treemap/attributes.js\"(exports, module) {\n \"use strict\";\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var colorScaleAttrs = require_attributes8();\n var domainAttrs = require_domain().attributes;\n var pieAttrs = require_attributes35();\n var sunburstAttrs = require_attributes36();\n var constants = require_constants21();\n var extendFlat = require_extend().extendFlat;\n var pattern = require_attributes4().pattern;\n module.exports = {\n labels: sunburstAttrs.labels,\n parents: sunburstAttrs.parents,\n values: sunburstAttrs.values,\n branchvalues: sunburstAttrs.branchvalues,\n count: sunburstAttrs.count,\n level: sunburstAttrs.level,\n maxdepth: sunburstAttrs.maxdepth,\n tiling: {\n packing: {\n valType: \"enumerated\",\n values: [\n \"squarify\",\n \"binary\",\n \"dice\",\n \"slice\",\n \"slice-dice\",\n \"dice-slice\"\n ],\n dflt: \"squarify\",\n editType: \"plot\"\n },\n squarifyratio: {\n valType: \"number\",\n min: 1,\n dflt: 1,\n editType: \"plot\"\n },\n flip: {\n valType: \"flaglist\",\n flags: [\n \"x\",\n \"y\"\n ],\n dflt: \"\",\n editType: \"plot\"\n },\n pad: {\n valType: \"number\",\n min: 0,\n dflt: 3,\n editType: \"plot\"\n },\n editType: \"calc\"\n },\n marker: extendFlat(\n {\n pad: {\n t: {\n valType: \"number\",\n min: 0,\n editType: \"plot\"\n },\n l: {\n valType: \"number\",\n min: 0,\n editType: \"plot\"\n },\n r: {\n valType: \"number\",\n min: 0,\n editType: \"plot\"\n },\n b: {\n valType: \"number\",\n min: 0,\n editType: \"plot\"\n },\n editType: \"calc\"\n },\n colors: sunburstAttrs.marker.colors,\n pattern,\n depthfade: {\n valType: \"enumerated\",\n values: [true, false, \"reversed\"],\n editType: \"style\"\n },\n line: sunburstAttrs.marker.line,\n cornerradius: {\n valType: \"number\",\n min: 0,\n dflt: 0,\n editType: \"plot\"\n },\n editType: \"calc\"\n },\n colorScaleAttrs(\"marker\", {\n colorAttr: \"colors\",\n anim: false\n // TODO: set to anim: true?\n })\n ),\n pathbar: {\n visible: {\n valType: \"boolean\",\n dflt: true,\n editType: \"plot\"\n },\n side: {\n valType: \"enumerated\",\n values: [\n \"top\",\n \"bottom\"\n ],\n dflt: \"top\",\n editType: \"plot\"\n },\n edgeshape: {\n valType: \"enumerated\",\n values: [\n \">\",\n \"<\",\n \"|\",\n \"/\",\n \"\\\\\"\n ],\n dflt: \">\",\n editType: \"plot\"\n },\n thickness: {\n valType: \"number\",\n min: 12,\n editType: \"plot\"\n },\n textfont: extendFlat({}, pieAttrs.textfont, {}),\n editType: \"calc\"\n },\n text: pieAttrs.text,\n textinfo: sunburstAttrs.textinfo,\n // TODO: incorporate `label` and `value` in the eventData\n texttemplate: texttemplateAttrs({ editType: \"plot\" }, {\n keys: constants.eventDataKeys.concat([\"label\", \"value\"])\n }),\n hovertext: pieAttrs.hovertext,\n hoverinfo: sunburstAttrs.hoverinfo,\n hovertemplate: hovertemplateAttrs({}, {\n keys: constants.eventDataKeys\n }),\n textfont: pieAttrs.textfont,\n insidetextfont: pieAttrs.insidetextfont,\n outsidetextfont: extendFlat({}, pieAttrs.outsidetextfont, {}),\n textposition: {\n valType: \"enumerated\",\n values: [\n \"top left\",\n \"top center\",\n \"top right\",\n \"middle left\",\n \"middle center\",\n \"middle right\",\n \"bottom left\",\n \"bottom center\",\n \"bottom right\"\n ],\n dflt: \"top left\",\n editType: \"plot\"\n },\n sort: pieAttrs.sort,\n root: sunburstAttrs.root,\n domain: domainAttrs({ name: \"treemap\", trace: true, editType: \"calc\" })\n };\n }\n });\n\n // src/traces/treemap/layout_attributes.js\n var require_layout_attributes14 = __commonJS({\n \"src/traces/treemap/layout_attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n treemapcolorway: {\n valType: \"colorlist\",\n editType: \"calc\"\n },\n extendtreemapcolors: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc\"\n }\n };\n }\n });\n\n // src/traces/treemap/defaults.js\n var require_defaults33 = __commonJS({\n \"src/traces/treemap/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var attributes = require_attributes37();\n var Color2 = require_color();\n var handleDomainDefaults = require_domain().defaults;\n var handleText = require_defaults19().handleText;\n var TEXTPAD = require_constants14().TEXTPAD;\n var handleMarkerDefaults = require_defaults31().handleMarkerDefaults;\n var Colorscale = require_colorscale();\n var hasColorscale = Colorscale.hasColorscale;\n var colorscaleDefaults = Colorscale.handleDefaults;\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var labels = coerce(\"labels\");\n var parents = coerce(\"parents\");\n if (!labels || !labels.length || !parents || !parents.length) {\n traceOut.visible = false;\n return;\n }\n var vals = coerce(\"values\");\n if (vals && vals.length) {\n coerce(\"branchvalues\");\n } else {\n coerce(\"count\");\n }\n coerce(\"level\");\n coerce(\"maxdepth\");\n var packing = coerce(\"tiling.packing\");\n if (packing === \"squarify\") {\n coerce(\"tiling.squarifyratio\");\n }\n coerce(\"tiling.flip\");\n coerce(\"tiling.pad\");\n var text = coerce(\"text\");\n coerce(\"texttemplate\");\n if (!traceOut.texttemplate) coerce(\"textinfo\", Lib.isArrayOrTypedArray(text) ? \"text+label\" : \"label\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n var hasPathbar = coerce(\"pathbar.visible\");\n var textposition = \"auto\";\n handleText(traceIn, traceOut, layout, coerce, textposition, {\n hasPathbar,\n moduleHasSelected: false,\n moduleHasUnselected: false,\n moduleHasConstrain: false,\n moduleHasCliponaxis: false,\n moduleHasTextangle: false,\n moduleHasInsideanchor: false\n });\n coerce(\"textposition\");\n var bottomText = traceOut.textposition.indexOf(\"bottom\") !== -1;\n handleMarkerDefaults(traceIn, traceOut, layout, coerce);\n var withColorscale = traceOut._hasColorscale = hasColorscale(traceIn, \"marker\", \"colors\") || (traceIn.marker || {}).coloraxis;\n if (withColorscale) {\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"marker.\", cLetter: \"c\" });\n } else {\n coerce(\"marker.depthfade\", !(traceOut.marker.colors || []).length);\n }\n var headerSize = traceOut.textfont.size * 2;\n coerce(\"marker.pad.t\", bottomText ? headerSize / 4 : headerSize);\n coerce(\"marker.pad.l\", headerSize / 4);\n coerce(\"marker.pad.r\", headerSize / 4);\n coerce(\"marker.pad.b\", bottomText ? headerSize : headerSize / 4);\n coerce(\"marker.cornerradius\");\n traceOut._hovered = {\n marker: {\n line: {\n width: 2,\n color: Color2.contrast(layout.paper_bgcolor)\n }\n }\n };\n if (hasPathbar) {\n coerce(\"pathbar.thickness\", traceOut.pathbar.textfont.size + 2 * TEXTPAD);\n coerce(\"pathbar.side\");\n coerce(\"pathbar.edgeshape\");\n }\n coerce(\"sort\");\n coerce(\"root.color\");\n handleDomainDefaults(traceOut, layout, coerce);\n traceOut._length = null;\n };\n }\n });\n\n // src/traces/treemap/layout_defaults.js\n var require_layout_defaults13 = __commonJS({\n \"src/traces/treemap/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var layoutAttributes = require_layout_attributes14();\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);\n }\n coerce(\"treemapcolorway\", layoutOut.colorway);\n coerce(\"extendtreemapcolors\");\n };\n }\n });\n\n // src/traces/treemap/calc.js\n var require_calc18 = __commonJS({\n \"src/traces/treemap/calc.js\"(exports) {\n \"use strict\";\n var calc = require_calc17();\n exports.calc = function(gd, trace) {\n return calc.calc(gd, trace);\n };\n exports.crossTraceCalc = function(gd) {\n return calc._runCrossTraceCalc(\"treemap\", gd);\n };\n }\n });\n\n // src/traces/treemap/flip_tree.js\n var require_flip_tree = __commonJS({\n \"src/traces/treemap/flip_tree.js\"(exports, module) {\n \"use strict\";\n module.exports = function flipTree(node, size, opts) {\n var tmp;\n if (opts.swapXY) {\n tmp = node.x0;\n node.x0 = node.y0;\n node.y0 = tmp;\n tmp = node.x1;\n node.x1 = node.y1;\n node.y1 = tmp;\n }\n if (opts.flipX) {\n tmp = node.x0;\n node.x0 = size[0] - node.x1;\n node.x1 = size[0] - tmp;\n }\n if (opts.flipY) {\n tmp = node.y0;\n node.y0 = size[1] - node.y1;\n node.y1 = size[1] - tmp;\n }\n var children = node.children;\n if (children) {\n for (var i = 0; i < children.length; i++) {\n flipTree(children[i], size, opts);\n }\n }\n };\n }\n });\n\n // src/traces/treemap/partition.js\n var require_partition = __commonJS({\n \"src/traces/treemap/partition.js\"(exports, module) {\n \"use strict\";\n var d3Hierarchy = require_d3_hierarchy();\n var flipTree = require_flip_tree();\n module.exports = function partition(entry, size, opts) {\n var flipX = opts.flipX;\n var flipY = opts.flipY;\n var swapXY = opts.packing === \"dice-slice\";\n var top = opts.pad[flipY ? \"bottom\" : \"top\"];\n var left = opts.pad[flipX ? \"right\" : \"left\"];\n var right = opts.pad[flipX ? \"left\" : \"right\"];\n var bottom = opts.pad[flipY ? \"top\" : \"bottom\"];\n var tmp;\n if (swapXY) {\n tmp = left;\n left = top;\n top = tmp;\n tmp = right;\n right = bottom;\n bottom = tmp;\n }\n var result = d3Hierarchy.treemap().tile(getTilingMethod(opts.packing, opts.squarifyratio)).paddingInner(opts.pad.inner).paddingLeft(left).paddingRight(right).paddingTop(top).paddingBottom(bottom).size(\n swapXY ? [size[1], size[0]] : size\n )(entry);\n if (swapXY || flipX || flipY) {\n flipTree(result, size, {\n swapXY,\n flipX,\n flipY\n });\n }\n return result;\n };\n function getTilingMethod(key, squarifyratio) {\n switch (key) {\n case \"squarify\":\n return d3Hierarchy.treemapSquarify.ratio(squarifyratio);\n case \"binary\":\n return d3Hierarchy.treemapBinary;\n case \"dice\":\n return d3Hierarchy.treemapDice;\n case \"slice\":\n return d3Hierarchy.treemapSlice;\n default:\n return d3Hierarchy.treemapSliceDice;\n }\n }\n }\n });\n\n // src/traces/treemap/style.js\n var require_style14 = __commonJS({\n \"src/traces/treemap/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Color2 = require_color();\n var Lib = require_lib();\n var helpers = require_helpers15();\n var resizeText = require_uniform_text().resizeText;\n var fillOne = require_fill_one2();\n function style(gd) {\n var s = gd._fullLayout._treemaplayer.selectAll(\".trace\");\n resizeText(gd, s, \"treemap\");\n s.each(function(cd) {\n var gTrace = d3.select(this);\n var cd0 = cd[0];\n var trace = cd0.trace;\n gTrace.style(\"opacity\", trace.opacity);\n gTrace.selectAll(\"path.surface\").each(function(pt) {\n d3.select(this).call(styleOne, pt, trace, gd, {\n hovered: false\n });\n });\n });\n }\n function styleOne(s, pt, trace, gd, opts) {\n var hovered = (opts || {}).hovered;\n var cdi = pt.data.data;\n var ptNumber = cdi.i;\n var lineColor;\n var lineWidth;\n var fillColor = cdi.color;\n var isRoot = helpers.isHierarchyRoot(pt);\n var opacity = 1;\n if (hovered) {\n lineColor = trace._hovered.marker.line.color;\n lineWidth = trace._hovered.marker.line.width;\n } else {\n if (isRoot && fillColor === trace.root.color) {\n opacity = 100;\n lineColor = \"rgba(0,0,0,0)\";\n lineWidth = 0;\n } else {\n lineColor = Lib.castOption(trace, ptNumber, \"marker.line.color\") || Color2.defaultLine;\n lineWidth = Lib.castOption(trace, ptNumber, \"marker.line.width\") || 0;\n if (!trace._hasColorscale && !pt.onPathbar) {\n var depthfade = trace.marker.depthfade;\n if (depthfade) {\n var fadedColor = Color2.combine(Color2.addOpacity(trace._backgroundColor, 0.75), fillColor);\n var n;\n if (depthfade === true) {\n var maxDepth = helpers.getMaxDepth(trace);\n if (isFinite(maxDepth)) {\n if (helpers.isLeaf(pt)) {\n n = 0;\n } else {\n n = trace._maxVisibleLayers - (pt.data.depth - trace._entryDepth);\n }\n } else {\n n = pt.data.height + 1;\n }\n } else {\n n = pt.data.depth - trace._entryDepth;\n if (!trace._atRootLevel) n++;\n }\n if (n > 0) {\n for (var i = 0; i < n; i++) {\n var ratio = 0.5 * i / n;\n fillColor = Color2.combine(Color2.addOpacity(fadedColor, ratio), fillColor);\n }\n }\n }\n }\n }\n }\n s.call(fillOne, pt, trace, gd, fillColor).style(\"stroke-width\", lineWidth).call(Color2.stroke, lineColor).style(\"opacity\", opacity);\n }\n module.exports = {\n style,\n styleOne\n };\n }\n });\n\n // src/traces/treemap/draw_ancestors.js\n var require_draw_ancestors = __commonJS({\n \"src/traces/treemap/draw_ancestors.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var Drawing = require_drawing();\n var svgTextUtils = require_svg_text_utils();\n var partition = require_partition();\n var styleOne = require_style14().styleOne;\n var constants = require_constants21();\n var helpers = require_helpers15();\n var attachFxHandlers = require_fx2();\n var onPathbar = true;\n module.exports = function drawAncestors(gd, cd, entry, slices, opts) {\n var barDifY = opts.barDifY;\n var width = opts.width;\n var height = opts.height;\n var viewX = opts.viewX;\n var viewY = opts.viewY;\n var pathSlice = opts.pathSlice;\n var toMoveInsideSlice = opts.toMoveInsideSlice;\n var strTransform = opts.strTransform;\n var hasTransition = opts.hasTransition;\n var handleSlicesExit = opts.handleSlicesExit;\n var makeUpdateSliceInterpolator = opts.makeUpdateSliceInterpolator;\n var makeUpdateTextInterpolator = opts.makeUpdateTextInterpolator;\n var refRect = {};\n var isStatic = gd._context.staticPlot;\n var fullLayout = gd._fullLayout;\n var cd0 = cd[0];\n var trace = cd0.trace;\n var hierarchy = cd0.hierarchy;\n var eachWidth = width / trace._entryDepth;\n var pathIds = helpers.listPath(entry.data, \"id\");\n var sliceData = partition(hierarchy.copy(), [width, height], {\n packing: \"dice\",\n pad: {\n inner: 0,\n top: 0,\n left: 0,\n right: 0,\n bottom: 0\n }\n }).descendants();\n sliceData = sliceData.filter(function(pt) {\n var level = pathIds.indexOf(pt.data.id);\n if (level === -1) return false;\n pt.x0 = eachWidth * level;\n pt.x1 = eachWidth * (level + 1);\n pt.y0 = barDifY;\n pt.y1 = barDifY + height;\n pt.onPathbar = true;\n return true;\n });\n sliceData.reverse();\n slices = slices.data(sliceData, helpers.getPtId);\n slices.enter().append(\"g\").classed(\"pathbar\", true);\n handleSlicesExit(slices, onPathbar, refRect, [width, height], pathSlice);\n slices.order();\n var updateSlices = slices;\n if (hasTransition) {\n updateSlices = updateSlices.transition().each(\"end\", function() {\n var sliceTop = d3.select(this);\n helpers.setSliceCursor(sliceTop, gd, {\n hideOnRoot: false,\n hideOnLeaves: false,\n isTransitioning: false\n });\n });\n }\n updateSlices.each(function(pt) {\n pt._x0 = viewX(pt.x0);\n pt._x1 = viewX(pt.x1);\n pt._y0 = viewY(pt.y0);\n pt._y1 = viewY(pt.y1);\n pt._hoverX = viewX(pt.x1 - Math.min(width, height) / 2);\n pt._hoverY = viewY(pt.y1 - height / 2);\n var sliceTop = d3.select(this);\n var slicePath = Lib.ensureSingle(sliceTop, \"path\", \"surface\", function(s) {\n s.style(\"pointer-events\", isStatic ? \"none\" : \"all\");\n });\n if (hasTransition) {\n slicePath.transition().attrTween(\"d\", function(pt2) {\n var interp = makeUpdateSliceInterpolator(pt2, onPathbar, refRect, [width, height]);\n return function(t) {\n return pathSlice(interp(t));\n };\n });\n } else {\n slicePath.attr(\"d\", pathSlice);\n }\n sliceTop.call(attachFxHandlers, entry, gd, cd, {\n styleOne,\n eventDataKeys: constants.eventDataKeys,\n transitionTime: constants.CLICK_TRANSITION_TIME,\n transitionEasing: constants.CLICK_TRANSITION_EASING\n }).call(helpers.setSliceCursor, gd, {\n hideOnRoot: false,\n hideOnLeaves: false,\n isTransitioning: gd._transitioning\n });\n slicePath.call(styleOne, pt, trace, gd, {\n hovered: false\n });\n pt._text = (helpers.getPtLabel(pt) || \"\").split(\"
    \").join(\" \") || \"\";\n var sliceTextGroup = Lib.ensureSingle(sliceTop, \"g\", \"slicetext\");\n var sliceText = Lib.ensureSingle(sliceTextGroup, \"text\", \"\", function(s) {\n s.attr(\"data-notex\", 1);\n });\n var font = Lib.ensureUniformFontSize(gd, helpers.determineTextFont(trace, pt, fullLayout.font, {\n onPathbar: true\n }));\n sliceText.text(pt._text || \" \").classed(\"slicetext\", true).attr(\"text-anchor\", \"start\").call(Drawing.font, font).call(svgTextUtils.convertToTspans, gd);\n pt.textBB = Drawing.bBox(sliceText.node());\n pt.transform = toMoveInsideSlice(pt, {\n fontSize: font.size,\n onPathbar: true\n });\n pt.transform.fontSize = font.size;\n if (hasTransition) {\n sliceText.transition().attrTween(\"transform\", function(pt2) {\n var interp = makeUpdateTextInterpolator(pt2, onPathbar, refRect, [width, height]);\n return function(t) {\n return strTransform(interp(t));\n };\n });\n } else {\n sliceText.attr(\"transform\", strTransform(pt));\n }\n });\n };\n }\n });\n\n // src/traces/treemap/plot_one.js\n var require_plot_one = __commonJS({\n \"src/traces/treemap/plot_one.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var interpolate = (init_src2(), __toCommonJS(src_exports)).interpolate;\n var helpers = require_helpers15();\n var Lib = require_lib();\n var TEXTPAD = require_constants14().TEXTPAD;\n var barPlot = require_plot3();\n var toMoveInsideBar = barPlot.toMoveInsideBar;\n var uniformText = require_uniform_text();\n var recordMinTextSize = uniformText.recordMinTextSize;\n var constants = require_constants21();\n var drawAncestors = require_draw_ancestors();\n function getKey(pt) {\n return helpers.isHierarchyRoot(pt) ? \"\" : (\n // don't use the dummyId\n helpers.getPtId(pt)\n );\n }\n module.exports = function plotOne(gd, cd, element, transitionOpts, drawDescendants) {\n var fullLayout = gd._fullLayout;\n var cd0 = cd[0];\n var trace = cd0.trace;\n var type = trace.type;\n var isIcicle = type === \"icicle\";\n var hierarchy = cd0.hierarchy;\n var entry = helpers.findEntryWithLevel(hierarchy, trace.level);\n var gTrace = d3.select(element);\n var selAncestors = gTrace.selectAll(\"g.pathbar\");\n var selDescendants = gTrace.selectAll(\"g.slice\");\n if (!entry) {\n selAncestors.remove();\n selDescendants.remove();\n return;\n }\n var isRoot = helpers.isHierarchyRoot(entry);\n var hasTransition = !fullLayout.uniformtext.mode && helpers.hasTransition(transitionOpts);\n var maxDepth = helpers.getMaxDepth(trace);\n var hasVisibleDepth = function(pt) {\n return pt.data.depth - entry.data.depth < maxDepth;\n };\n var gs = fullLayout._size;\n var domain = trace.domain;\n var vpw = gs.w * (domain.x[1] - domain.x[0]);\n var vph = gs.h * (domain.y[1] - domain.y[0]);\n var barW = vpw;\n var barH = trace.pathbar.thickness;\n var barPad = trace.marker.line.width + constants.gapWithPathbar;\n var barDifY = !trace.pathbar.visible ? 0 : trace.pathbar.side.indexOf(\"bottom\") > -1 ? vph + barPad : -(barH + barPad);\n var pathbarOrigin = {\n x0: barW,\n // slide to the right\n x1: barW,\n y0: barDifY,\n y1: barDifY + barH\n };\n var findClosestEdge = function(pt, ref, size) {\n var e = trace.tiling.pad;\n var isLeftOfRect = function(x) {\n return x - e <= ref.x0;\n };\n var isRightOfRect = function(x) {\n return x + e >= ref.x1;\n };\n var isBottomOfRect = function(y) {\n return y - e <= ref.y0;\n };\n var isTopOfRect = function(y) {\n return y + e >= ref.y1;\n };\n if (pt.x0 === ref.x0 && pt.x1 === ref.x1 && pt.y0 === ref.y0 && pt.y1 === ref.y1) {\n return {\n x0: pt.x0,\n x1: pt.x1,\n y0: pt.y0,\n y1: pt.y1\n };\n }\n return {\n x0: isLeftOfRect(pt.x0 - e) ? 0 : isRightOfRect(pt.x0 - e) ? size[0] : pt.x0,\n x1: isLeftOfRect(pt.x1 + e) ? 0 : isRightOfRect(pt.x1 + e) ? size[0] : pt.x1,\n y0: isBottomOfRect(pt.y0 - e) ? 0 : isTopOfRect(pt.y0 - e) ? size[1] : pt.y0,\n y1: isBottomOfRect(pt.y1 + e) ? 0 : isTopOfRect(pt.y1 + e) ? size[1] : pt.y1\n };\n };\n var prevEntry = null;\n var prevLookupPathbar = {};\n var prevLookupSlices = {};\n var nextOfPrevEntry = null;\n var getPrev = function(pt, onPathbar) {\n return onPathbar ? prevLookupPathbar[getKey(pt)] : prevLookupSlices[getKey(pt)];\n };\n var getOrigin = function(pt, onPathbar, refRect, size) {\n if (onPathbar) {\n return prevLookupPathbar[getKey(hierarchy)] || pathbarOrigin;\n } else {\n var ref = prevLookupSlices[trace.level] || refRect;\n if (hasVisibleDepth(pt)) {\n return findClosestEdge(pt, ref, size);\n }\n }\n return {};\n };\n if (cd0.hasMultipleRoots && isRoot) {\n maxDepth++;\n }\n trace._maxDepth = maxDepth;\n trace._backgroundColor = fullLayout.paper_bgcolor;\n trace._entryDepth = entry.data.depth;\n trace._atRootLevel = isRoot;\n var cenX = -vpw / 2 + gs.l + gs.w * (domain.x[1] + domain.x[0]) / 2;\n var cenY = -vph / 2 + gs.t + gs.h * (1 - (domain.y[1] + domain.y[0]) / 2);\n var viewMapX = function(x) {\n return cenX + x;\n };\n var viewMapY = function(y) {\n return cenY + y;\n };\n var barY0 = viewMapY(0);\n var barX0 = viewMapX(0);\n var viewBarX = function(x) {\n return barX0 + x;\n };\n var viewBarY = function(y) {\n return barY0 + y;\n };\n function pos(x, y) {\n return x + \",\" + y;\n }\n var xStart = viewBarX(0);\n var limitX0 = function(p) {\n p.x = Math.max(xStart, p.x);\n };\n var edgeshape = trace.pathbar.edgeshape;\n var pathAncestor = function(d) {\n var _x0 = viewBarX(Math.max(Math.min(d.x0, d.x0), 0));\n var _x1 = viewBarX(Math.min(Math.max(d.x1, d.x1), barW));\n var _y0 = viewBarY(d.y0);\n var _y1 = viewBarY(d.y1);\n var halfH = barH / 2;\n var pL = {};\n var pR = {};\n pL.x = _x0;\n pR.x = _x1;\n pL.y = pR.y = (_y0 + _y1) / 2;\n var pA = { x: _x0, y: _y0 };\n var pB = { x: _x1, y: _y0 };\n var pC = { x: _x1, y: _y1 };\n var pD = { x: _x0, y: _y1 };\n if (edgeshape === \">\") {\n pA.x -= halfH;\n pB.x -= halfH;\n pC.x -= halfH;\n pD.x -= halfH;\n } else if (edgeshape === \"/\") {\n pC.x -= halfH;\n pD.x -= halfH;\n pL.x -= halfH / 2;\n pR.x -= halfH / 2;\n } else if (edgeshape === \"\\\\\") {\n pA.x -= halfH;\n pB.x -= halfH;\n pL.x -= halfH / 2;\n pR.x -= halfH / 2;\n } else if (edgeshape === \"<\") {\n pL.x -= halfH;\n pR.x -= halfH;\n }\n limitX0(pA);\n limitX0(pD);\n limitX0(pL);\n limitX0(pB);\n limitX0(pC);\n limitX0(pR);\n return \"M\" + pos(pA.x, pA.y) + \"L\" + pos(pB.x, pB.y) + \"L\" + pos(pR.x, pR.y) + \"L\" + pos(pC.x, pC.y) + \"L\" + pos(pD.x, pD.y) + \"L\" + pos(pL.x, pL.y) + \"Z\";\n };\n var pad = trace[isIcicle ? \"tiling\" : \"marker\"].pad;\n var hasFlag = function(f) {\n return trace.textposition.indexOf(f) !== -1;\n };\n var hasTop = hasFlag(\"top\");\n var hasLeft = hasFlag(\"left\");\n var hasRight = hasFlag(\"right\");\n var hasBottom = hasFlag(\"bottom\");\n var pathDescendant = function(d) {\n var _x0 = viewMapX(d.x0);\n var _x1 = viewMapX(d.x1);\n var _y0 = viewMapY(d.y0);\n var _y1 = viewMapY(d.y1);\n var dx = _x1 - _x0;\n var dy = _y1 - _y0;\n if (!dx || !dy) return \"\";\n var cornerradius = trace.marker.cornerradius || 0;\n var r = Math.min(cornerradius, dx / 2, dy / 2);\n if (r && d.data && d.data.data && d.data.data.label) {\n if (hasTop) r = Math.min(r, pad.t);\n if (hasLeft) r = Math.min(r, pad.l);\n if (hasRight) r = Math.min(r, pad.r);\n if (hasBottom) r = Math.min(r, pad.b);\n }\n var arc = function(rx, ry) {\n return r ? \"a\" + pos(r, r) + \" 0 0 1 \" + pos(rx, ry) : \"\";\n };\n return \"M\" + pos(_x0, _y0 + r) + arc(r, -r) + \"L\" + pos(_x1 - r, _y0) + arc(r, r) + \"L\" + pos(_x1, _y1 - r) + arc(-r, r) + \"L\" + pos(_x0 + r, _y1) + arc(-r, -r) + \"Z\";\n };\n var toMoveInsideSlice = function(pt, opts) {\n var x0 = pt.x0;\n var x1 = pt.x1;\n var y0 = pt.y0;\n var y1 = pt.y1;\n var textBB = pt.textBB;\n var _hasTop = hasTop || opts.isHeader && !hasBottom;\n var anchor = _hasTop ? \"start\" : hasBottom ? \"end\" : \"middle\";\n var _hasRight = hasFlag(\"right\");\n var _hasLeft = hasFlag(\"left\") || opts.onPathbar;\n var leftToRight = _hasLeft ? -1 : _hasRight ? 1 : 0;\n if (opts.isHeader) {\n x0 += (isIcicle ? pad : pad.l) - TEXTPAD;\n x1 -= (isIcicle ? pad : pad.r) - TEXTPAD;\n if (x0 >= x1) {\n var mid = (x0 + x1) / 2;\n x0 = mid;\n x1 = mid;\n }\n var limY;\n if (hasBottom) {\n limY = y1 - (isIcicle ? pad : pad.b);\n if (y0 < limY && limY < y1) y0 = limY;\n } else {\n limY = y0 + (isIcicle ? pad : pad.t);\n if (y0 < limY && limY < y1) y1 = limY;\n }\n }\n var transform = toMoveInsideBar(x0, x1, y0, y1, textBB, {\n isHorizontal: false,\n constrained: true,\n angle: 0,\n anchor,\n leftToRight\n });\n transform.fontSize = opts.fontSize;\n transform.targetX = viewMapX(transform.targetX);\n transform.targetY = viewMapY(transform.targetY);\n if (isNaN(transform.targetX) || isNaN(transform.targetY)) {\n return {};\n }\n if (x0 !== x1 && y0 !== y1) {\n recordMinTextSize(trace.type, transform, fullLayout);\n }\n return {\n scale: transform.scale,\n rotate: transform.rotate,\n textX: transform.textX,\n textY: transform.textY,\n anchorX: transform.anchorX,\n anchorY: transform.anchorY,\n targetX: transform.targetX,\n targetY: transform.targetY\n };\n };\n var interpFromParent = function(pt, onPathbar) {\n var parentPrev;\n var i = 0;\n var Q = pt;\n while (!parentPrev && i < maxDepth) {\n i++;\n Q = Q.parent;\n if (Q) {\n parentPrev = getPrev(Q, onPathbar);\n } else i = maxDepth;\n }\n return parentPrev || {};\n };\n var makeExitSliceInterpolator = function(pt, onPathbar, refRect, size) {\n var prev = getPrev(pt, onPathbar);\n var next;\n if (onPathbar) {\n next = pathbarOrigin;\n } else {\n var entryPrev = getPrev(entry, onPathbar);\n if (entryPrev) {\n next = findClosestEdge(pt, entryPrev, size);\n } else {\n next = {};\n }\n }\n return interpolate(prev, next);\n };\n var makeUpdateSliceInterpolator = function(pt, onPathbar, refRect, size, opts) {\n var prev0 = getPrev(pt, onPathbar);\n var prev;\n if (prev0) {\n prev = prev0;\n } else {\n if (onPathbar) {\n prev = pathbarOrigin;\n } else {\n if (prevEntry) {\n if (pt.parent) {\n var ref = nextOfPrevEntry || refRect;\n if (ref && !onPathbar) {\n prev = findClosestEdge(pt, ref, size);\n } else {\n prev = {};\n Lib.extendFlat(prev, interpFromParent(pt, onPathbar));\n }\n } else {\n prev = Lib.extendFlat({}, pt);\n if (isIcicle) {\n if (opts.orientation === \"h\") {\n if (opts.flipX) prev.x0 = pt.x1;\n else prev.x1 = 0;\n } else {\n if (opts.flipY) prev.y0 = pt.y1;\n else prev.y1 = 0;\n }\n }\n }\n } else {\n prev = {};\n }\n }\n }\n return interpolate(prev, {\n x0: pt.x0,\n x1: pt.x1,\n y0: pt.y0,\n y1: pt.y1\n });\n };\n var makeUpdateTextInterpolator = function(pt, onPathbar, refRect, size) {\n var prev0 = getPrev(pt, onPathbar);\n var prev = {};\n var origin = getOrigin(pt, onPathbar, refRect, size);\n Lib.extendFlat(prev, {\n transform: toMoveInsideSlice({\n x0: origin.x0,\n x1: origin.x1,\n y0: origin.y0,\n y1: origin.y1,\n textBB: pt.textBB,\n _text: pt._text\n }, {\n isHeader: helpers.isHeader(pt, trace)\n })\n });\n if (prev0) {\n prev = prev0;\n } else {\n if (pt.parent) {\n Lib.extendFlat(prev, interpFromParent(pt, onPathbar));\n }\n }\n var transform = pt.transform;\n if (pt.x0 !== pt.x1 && pt.y0 !== pt.y1) {\n recordMinTextSize(trace.type, transform, fullLayout);\n }\n return interpolate(prev, {\n transform: {\n scale: transform.scale,\n rotate: transform.rotate,\n textX: transform.textX,\n textY: transform.textY,\n anchorX: transform.anchorX,\n anchorY: transform.anchorY,\n targetX: transform.targetX,\n targetY: transform.targetY\n }\n });\n };\n var handleSlicesExit = function(slices, onPathbar, refRect, size, pathSlice) {\n var width = size[0];\n var height = size[1];\n if (hasTransition) {\n slices.exit().transition().each(function() {\n var sliceTop = d3.select(this);\n var slicePath = sliceTop.select(\"path.surface\");\n slicePath.transition().attrTween(\"d\", function(pt2) {\n var interp = makeExitSliceInterpolator(pt2, onPathbar, refRect, [width, height]);\n return function(t) {\n return pathSlice(interp(t));\n };\n });\n var sliceTextGroup = sliceTop.select(\"g.slicetext\");\n sliceTextGroup.attr(\"opacity\", 0);\n }).remove();\n } else {\n slices.exit().remove();\n }\n };\n var strTransform = function(d) {\n var transform = d.transform;\n if (d.x0 !== d.x1 && d.y0 !== d.y1) {\n recordMinTextSize(trace.type, transform, fullLayout);\n }\n return Lib.getTextTransform({\n textX: transform.textX,\n textY: transform.textY,\n anchorX: transform.anchorX,\n anchorY: transform.anchorY,\n targetX: transform.targetX,\n targetY: transform.targetY,\n scale: transform.scale,\n rotate: transform.rotate\n });\n };\n if (hasTransition) {\n selAncestors.each(function(pt) {\n prevLookupPathbar[getKey(pt)] = {\n x0: pt.x0,\n x1: pt.x1,\n y0: pt.y0,\n y1: pt.y1\n };\n if (pt.transform) {\n prevLookupPathbar[getKey(pt)].transform = {\n textX: pt.transform.textX,\n textY: pt.transform.textY,\n anchorX: pt.transform.anchorX,\n anchorY: pt.transform.anchorY,\n targetX: pt.transform.targetX,\n targetY: pt.transform.targetY,\n scale: pt.transform.scale,\n rotate: pt.transform.rotate\n };\n }\n });\n selDescendants.each(function(pt) {\n prevLookupSlices[getKey(pt)] = {\n x0: pt.x0,\n x1: pt.x1,\n y0: pt.y0,\n y1: pt.y1\n };\n if (pt.transform) {\n prevLookupSlices[getKey(pt)].transform = {\n textX: pt.transform.textX,\n textY: pt.transform.textY,\n anchorX: pt.transform.anchorX,\n anchorY: pt.transform.anchorY,\n targetX: pt.transform.targetX,\n targetY: pt.transform.targetY,\n scale: pt.transform.scale,\n rotate: pt.transform.rotate\n };\n }\n if (!prevEntry && helpers.isEntry(pt)) {\n prevEntry = pt;\n }\n });\n }\n nextOfPrevEntry = drawDescendants(gd, cd, entry, selDescendants, {\n width: vpw,\n height: vph,\n viewX: viewMapX,\n viewY: viewMapY,\n pathSlice: pathDescendant,\n toMoveInsideSlice,\n prevEntry,\n makeUpdateSliceInterpolator,\n makeUpdateTextInterpolator,\n handleSlicesExit,\n hasTransition,\n strTransform\n });\n if (trace.pathbar.visible) {\n drawAncestors(gd, cd, entry, selAncestors, {\n barDifY,\n width: barW,\n height: barH,\n viewX: viewBarX,\n viewY: viewBarY,\n pathSlice: pathAncestor,\n toMoveInsideSlice,\n makeUpdateSliceInterpolator,\n makeUpdateTextInterpolator,\n handleSlicesExit,\n hasTransition,\n strTransform\n });\n } else {\n selAncestors.remove();\n }\n };\n }\n });\n\n // src/traces/treemap/draw.js\n var require_draw12 = __commonJS({\n \"src/traces/treemap/draw.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var helpers = require_helpers15();\n var uniformText = require_uniform_text();\n var clearMinTextSize = uniformText.clearMinTextSize;\n var resizeText = require_style4().resizeText;\n var plotOne = require_plot_one();\n module.exports = function _plot(gd, cdmodule, transitionOpts, makeOnCompleteCallback, opts) {\n var type = opts.type;\n var drawDescendants = opts.drawDescendants;\n var fullLayout = gd._fullLayout;\n var layer = fullLayout[\"_\" + type + \"layer\"];\n var join, onComplete;\n var isFullReplot = !transitionOpts;\n clearMinTextSize(type, fullLayout);\n join = layer.selectAll(\"g.trace.\" + type).data(cdmodule, function(cd) {\n return cd[0].trace.uid;\n });\n join.enter().append(\"g\").classed(\"trace\", true).classed(type, true);\n join.order();\n if (!fullLayout.uniformtext.mode && helpers.hasTransition(transitionOpts)) {\n if (makeOnCompleteCallback) {\n onComplete = makeOnCompleteCallback();\n }\n var transition = d3.transition().duration(transitionOpts.duration).ease(transitionOpts.easing).each(\"end\", function() {\n onComplete && onComplete();\n }).each(\"interrupt\", function() {\n onComplete && onComplete();\n });\n transition.each(function() {\n layer.selectAll(\"g.trace\").each(function(cd) {\n plotOne(gd, cd, this, transitionOpts, drawDescendants);\n });\n });\n } else {\n join.each(function(cd) {\n plotOne(gd, cd, this, transitionOpts, drawDescendants);\n });\n if (fullLayout.uniformtext.mode) {\n resizeText(gd, layer.selectAll(\".trace\"), type);\n }\n }\n if (isFullReplot) {\n join.exit().remove();\n }\n };\n }\n });\n\n // src/traces/treemap/draw_descendants.js\n var require_draw_descendants = __commonJS({\n \"src/traces/treemap/draw_descendants.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var Drawing = require_drawing();\n var svgTextUtils = require_svg_text_utils();\n var partition = require_partition();\n var styleOne = require_style14().styleOne;\n var constants = require_constants21();\n var helpers = require_helpers15();\n var attachFxHandlers = require_fx2();\n var formatSliceLabel = require_plot13().formatSliceLabel;\n var onPathbar = false;\n module.exports = function drawDescendants(gd, cd, entry, slices, opts) {\n var width = opts.width;\n var height = opts.height;\n var viewX = opts.viewX;\n var viewY = opts.viewY;\n var pathSlice = opts.pathSlice;\n var toMoveInsideSlice = opts.toMoveInsideSlice;\n var strTransform = opts.strTransform;\n var hasTransition = opts.hasTransition;\n var handleSlicesExit = opts.handleSlicesExit;\n var makeUpdateSliceInterpolator = opts.makeUpdateSliceInterpolator;\n var makeUpdateTextInterpolator = opts.makeUpdateTextInterpolator;\n var prevEntry = opts.prevEntry;\n var refRect = {};\n var isStatic = gd._context.staticPlot;\n var fullLayout = gd._fullLayout;\n var cd0 = cd[0];\n var trace = cd0.trace;\n var hasLeft = trace.textposition.indexOf(\"left\") !== -1;\n var hasRight = trace.textposition.indexOf(\"right\") !== -1;\n var hasBottom = trace.textposition.indexOf(\"bottom\") !== -1;\n var noRoomForHeader = !hasBottom && !trace.marker.pad.t || hasBottom && !trace.marker.pad.b;\n var allData = partition(entry, [width, height], {\n packing: trace.tiling.packing,\n squarifyratio: trace.tiling.squarifyratio,\n flipX: trace.tiling.flip.indexOf(\"x\") > -1,\n flipY: trace.tiling.flip.indexOf(\"y\") > -1,\n pad: {\n inner: trace.tiling.pad,\n top: trace.marker.pad.t,\n left: trace.marker.pad.l,\n right: trace.marker.pad.r,\n bottom: trace.marker.pad.b\n }\n });\n var sliceData = allData.descendants();\n var minVisibleDepth = Infinity;\n var maxVisibleDepth = -Infinity;\n sliceData.forEach(function(pt) {\n var depth = pt.depth;\n if (depth >= trace._maxDepth) {\n pt.x0 = pt.x1 = (pt.x0 + pt.x1) / 2;\n pt.y0 = pt.y1 = (pt.y0 + pt.y1) / 2;\n } else {\n minVisibleDepth = Math.min(minVisibleDepth, depth);\n maxVisibleDepth = Math.max(maxVisibleDepth, depth);\n }\n });\n slices = slices.data(sliceData, helpers.getPtId);\n trace._maxVisibleLayers = isFinite(maxVisibleDepth) ? maxVisibleDepth - minVisibleDepth + 1 : 0;\n slices.enter().append(\"g\").classed(\"slice\", true);\n handleSlicesExit(slices, onPathbar, refRect, [width, height], pathSlice);\n slices.order();\n var nextOfPrevEntry = null;\n if (hasTransition && prevEntry) {\n var prevEntryId = helpers.getPtId(prevEntry);\n slices.each(function(pt) {\n if (nextOfPrevEntry === null && helpers.getPtId(pt) === prevEntryId) {\n nextOfPrevEntry = {\n x0: pt.x0,\n x1: pt.x1,\n y0: pt.y0,\n y1: pt.y1\n };\n }\n });\n }\n var getRefRect = function() {\n return nextOfPrevEntry || {\n x0: 0,\n x1: width,\n y0: 0,\n y1: height\n };\n };\n var updateSlices = slices;\n if (hasTransition) {\n updateSlices = updateSlices.transition().each(\"end\", function() {\n var sliceTop = d3.select(this);\n helpers.setSliceCursor(sliceTop, gd, {\n hideOnRoot: true,\n hideOnLeaves: false,\n isTransitioning: false\n });\n });\n }\n updateSlices.each(function(pt) {\n var isHeader = helpers.isHeader(pt, trace);\n pt._x0 = viewX(pt.x0);\n pt._x1 = viewX(pt.x1);\n pt._y0 = viewY(pt.y0);\n pt._y1 = viewY(pt.y1);\n pt._hoverX = viewX(pt.x1 - trace.marker.pad.r), pt._hoverY = hasBottom ? viewY(pt.y1 - trace.marker.pad.b / 2) : viewY(pt.y0 + trace.marker.pad.t / 2);\n var sliceTop = d3.select(this);\n var slicePath = Lib.ensureSingle(sliceTop, \"path\", \"surface\", function(s) {\n s.style(\"pointer-events\", isStatic ? \"none\" : \"all\");\n });\n if (hasTransition) {\n slicePath.transition().attrTween(\"d\", function(pt2) {\n var interp = makeUpdateSliceInterpolator(pt2, onPathbar, getRefRect(), [width, height]);\n return function(t) {\n return pathSlice(interp(t));\n };\n });\n } else {\n slicePath.attr(\"d\", pathSlice);\n }\n sliceTop.call(attachFxHandlers, entry, gd, cd, {\n styleOne,\n eventDataKeys: constants.eventDataKeys,\n transitionTime: constants.CLICK_TRANSITION_TIME,\n transitionEasing: constants.CLICK_TRANSITION_EASING\n }).call(helpers.setSliceCursor, gd, { isTransitioning: gd._transitioning });\n slicePath.call(styleOne, pt, trace, gd, {\n hovered: false\n });\n if (pt.x0 === pt.x1 || pt.y0 === pt.y1) {\n pt._text = \"\";\n } else {\n if (isHeader) {\n pt._text = noRoomForHeader ? \"\" : helpers.getPtLabel(pt) || \"\";\n } else {\n pt._text = formatSliceLabel(pt, entry, trace, cd, fullLayout) || \"\";\n }\n }\n var sliceTextGroup = Lib.ensureSingle(sliceTop, \"g\", \"slicetext\");\n var sliceText = Lib.ensureSingle(sliceTextGroup, \"text\", \"\", function(s) {\n s.attr(\"data-notex\", 1);\n });\n var font = Lib.ensureUniformFontSize(gd, helpers.determineTextFont(trace, pt, fullLayout.font));\n var text = pt._text || \" \";\n var singleLineHeader = isHeader && text.indexOf(\"
    \") === -1;\n sliceText.text(text).classed(\"slicetext\", true).attr(\"text-anchor\", hasRight ? \"end\" : hasLeft || singleLineHeader ? \"start\" : \"middle\").call(Drawing.font, font).call(svgTextUtils.convertToTspans, gd);\n pt.textBB = Drawing.bBox(sliceText.node());\n pt.transform = toMoveInsideSlice(pt, {\n fontSize: font.size,\n isHeader\n });\n pt.transform.fontSize = font.size;\n if (hasTransition) {\n sliceText.transition().attrTween(\"transform\", function(pt2) {\n var interp = makeUpdateTextInterpolator(pt2, onPathbar, getRefRect(), [width, height]);\n return function(t) {\n return strTransform(interp(t));\n };\n });\n } else {\n sliceText.attr(\"transform\", strTransform(pt));\n }\n });\n return nextOfPrevEntry;\n };\n }\n });\n\n // src/traces/treemap/plot.js\n var require_plot14 = __commonJS({\n \"src/traces/treemap/plot.js\"(exports, module) {\n \"use strict\";\n var draw = require_draw12();\n var drawDescendants = require_draw_descendants();\n module.exports = function _plot(gd, cdmodule, transitionOpts, makeOnCompleteCallback) {\n return draw(gd, cdmodule, transitionOpts, makeOnCompleteCallback, {\n type: \"treemap\",\n drawDescendants\n });\n };\n }\n });\n\n // src/traces/treemap/index.js\n var require_treemap = __commonJS({\n \"src/traces/treemap/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"trace\",\n name: \"treemap\",\n basePlotModule: require_base_plot3(),\n categories: [],\n animatable: true,\n attributes: require_attributes37(),\n layoutAttributes: require_layout_attributes14(),\n supplyDefaults: require_defaults33(),\n supplyLayoutDefaults: require_layout_defaults13(),\n calc: require_calc18().calc,\n crossTraceCalc: require_calc18().crossTraceCalc,\n plot: require_plot14(),\n style: require_style14().style,\n colorbar: require_marker_colorbar(),\n meta: {}\n };\n }\n });\n\n // lib/treemap.js\n var require_treemap2 = __commonJS({\n \"lib/treemap.js\"(exports, module) {\n \"use strict\";\n module.exports = require_treemap();\n }\n });\n\n // src/traces/icicle/base_plot.js\n var require_base_plot4 = __commonJS({\n \"src/traces/icicle/base_plot.js\"(exports) {\n \"use strict\";\n var plots = require_plots();\n exports.name = \"icicle\";\n exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) {\n plots.plotBasePlot(exports.name, gd, traces, transitionOpts, makeOnCompleteCallback);\n };\n exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout);\n };\n }\n });\n\n // src/traces/icicle/attributes.js\n var require_attributes38 = __commonJS({\n \"src/traces/icicle/attributes.js\"(exports, module) {\n \"use strict\";\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var colorScaleAttrs = require_attributes8();\n var domainAttrs = require_domain().attributes;\n var pieAttrs = require_attributes35();\n var sunburstAttrs = require_attributes36();\n var treemapAttrs = require_attributes37();\n var constants = require_constants21();\n var extendFlat = require_extend().extendFlat;\n var pattern = require_attributes4().pattern;\n module.exports = {\n labels: sunburstAttrs.labels,\n parents: sunburstAttrs.parents,\n values: sunburstAttrs.values,\n branchvalues: sunburstAttrs.branchvalues,\n count: sunburstAttrs.count,\n level: sunburstAttrs.level,\n maxdepth: sunburstAttrs.maxdepth,\n tiling: {\n orientation: {\n valType: \"enumerated\",\n values: [\"v\", \"h\"],\n dflt: \"h\",\n editType: \"plot\"\n },\n flip: treemapAttrs.tiling.flip,\n pad: {\n valType: \"number\",\n min: 0,\n dflt: 0,\n editType: \"plot\"\n },\n editType: \"calc\"\n },\n marker: extendFlat(\n {\n colors: sunburstAttrs.marker.colors,\n line: sunburstAttrs.marker.line,\n pattern,\n editType: \"calc\"\n },\n colorScaleAttrs(\"marker\", {\n colorAttr: \"colors\",\n anim: false\n // TODO: set to anim: true?\n })\n ),\n leaf: sunburstAttrs.leaf,\n pathbar: treemapAttrs.pathbar,\n text: pieAttrs.text,\n textinfo: sunburstAttrs.textinfo,\n // TODO: incorporate `label` and `value` in the eventData\n texttemplate: texttemplateAttrs({ editType: \"plot\" }, {\n keys: constants.eventDataKeys.concat([\"label\", \"value\"])\n }),\n hovertext: pieAttrs.hovertext,\n hoverinfo: sunburstAttrs.hoverinfo,\n hovertemplate: hovertemplateAttrs({}, {\n keys: constants.eventDataKeys\n }),\n textfont: pieAttrs.textfont,\n insidetextfont: pieAttrs.insidetextfont,\n outsidetextfont: treemapAttrs.outsidetextfont,\n textposition: treemapAttrs.textposition,\n sort: pieAttrs.sort,\n root: sunburstAttrs.root,\n domain: domainAttrs({ name: \"icicle\", trace: true, editType: \"calc\" })\n };\n }\n });\n\n // src/traces/icicle/layout_attributes.js\n var require_layout_attributes15 = __commonJS({\n \"src/traces/icicle/layout_attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n iciclecolorway: {\n valType: \"colorlist\",\n editType: \"calc\"\n },\n extendiciclecolors: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc\"\n }\n };\n }\n });\n\n // src/traces/icicle/defaults.js\n var require_defaults34 = __commonJS({\n \"src/traces/icicle/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var attributes = require_attributes38();\n var Color2 = require_color();\n var handleDomainDefaults = require_domain().defaults;\n var handleText = require_defaults19().handleText;\n var TEXTPAD = require_constants14().TEXTPAD;\n var handleMarkerDefaults = require_defaults31().handleMarkerDefaults;\n var Colorscale = require_colorscale();\n var hasColorscale = Colorscale.hasColorscale;\n var colorscaleDefaults = Colorscale.handleDefaults;\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var labels = coerce(\"labels\");\n var parents = coerce(\"parents\");\n if (!labels || !labels.length || !parents || !parents.length) {\n traceOut.visible = false;\n return;\n }\n var vals = coerce(\"values\");\n if (vals && vals.length) {\n coerce(\"branchvalues\");\n } else {\n coerce(\"count\");\n }\n coerce(\"level\");\n coerce(\"maxdepth\");\n coerce(\"tiling.orientation\");\n coerce(\"tiling.flip\");\n coerce(\"tiling.pad\");\n var text = coerce(\"text\");\n coerce(\"texttemplate\");\n if (!traceOut.texttemplate) coerce(\"textinfo\", Lib.isArrayOrTypedArray(text) ? \"text+label\" : \"label\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n var hasPathbar = coerce(\"pathbar.visible\");\n var textposition = \"auto\";\n handleText(traceIn, traceOut, layout, coerce, textposition, {\n hasPathbar,\n moduleHasSelected: false,\n moduleHasUnselected: false,\n moduleHasConstrain: false,\n moduleHasCliponaxis: false,\n moduleHasTextangle: false,\n moduleHasInsideanchor: false\n });\n coerce(\"textposition\");\n handleMarkerDefaults(traceIn, traceOut, layout, coerce);\n var withColorscale = traceOut._hasColorscale = hasColorscale(traceIn, \"marker\", \"colors\") || (traceIn.marker || {}).coloraxis;\n if (withColorscale) {\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"marker.\", cLetter: \"c\" });\n }\n coerce(\"leaf.opacity\", withColorscale ? 1 : 0.7);\n traceOut._hovered = {\n marker: {\n line: {\n width: 2,\n color: Color2.contrast(layout.paper_bgcolor)\n }\n }\n };\n if (hasPathbar) {\n coerce(\"pathbar.thickness\", traceOut.pathbar.textfont.size + 2 * TEXTPAD);\n coerce(\"pathbar.side\");\n coerce(\"pathbar.edgeshape\");\n }\n coerce(\"sort\");\n coerce(\"root.color\");\n handleDomainDefaults(traceOut, layout, coerce);\n traceOut._length = null;\n };\n }\n });\n\n // src/traces/icicle/layout_defaults.js\n var require_layout_defaults14 = __commonJS({\n \"src/traces/icicle/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var layoutAttributes = require_layout_attributes15();\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);\n }\n coerce(\"iciclecolorway\", layoutOut.colorway);\n coerce(\"extendiciclecolors\");\n };\n }\n });\n\n // src/traces/icicle/calc.js\n var require_calc19 = __commonJS({\n \"src/traces/icicle/calc.js\"(exports) {\n \"use strict\";\n var calc = require_calc17();\n exports.calc = function(gd, trace) {\n return calc.calc(gd, trace);\n };\n exports.crossTraceCalc = function(gd) {\n return calc._runCrossTraceCalc(\"icicle\", gd);\n };\n }\n });\n\n // src/traces/icicle/partition.js\n var require_partition2 = __commonJS({\n \"src/traces/icicle/partition.js\"(exports, module) {\n \"use strict\";\n var d3Hierarchy = require_d3_hierarchy();\n var flipTree = require_flip_tree();\n module.exports = function partition(entry, size, opts) {\n var flipX = opts.flipX;\n var flipY = opts.flipY;\n var swapXY = opts.orientation === \"h\";\n var maxDepth = opts.maxDepth;\n var newWidth = size[0];\n var newHeight = size[1];\n if (maxDepth) {\n newWidth = (entry.height + 1) * size[0] / Math.min(entry.height + 1, maxDepth);\n newHeight = (entry.height + 1) * size[1] / Math.min(entry.height + 1, maxDepth);\n }\n var result = d3Hierarchy.partition().padding(opts.pad.inner).size(\n swapXY ? [size[1], newWidth] : [size[0], newHeight]\n )(entry);\n if (swapXY || flipX || flipY) {\n flipTree(result, size, {\n swapXY,\n flipX,\n flipY\n });\n }\n return result;\n };\n }\n });\n\n // src/traces/icicle/style.js\n var require_style15 = __commonJS({\n \"src/traces/icicle/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Color2 = require_color();\n var Lib = require_lib();\n var resizeText = require_uniform_text().resizeText;\n var fillOne = require_fill_one2();\n function style(gd) {\n var s = gd._fullLayout._iciclelayer.selectAll(\".trace\");\n resizeText(gd, s, \"icicle\");\n s.each(function(cd) {\n var gTrace = d3.select(this);\n var cd0 = cd[0];\n var trace = cd0.trace;\n gTrace.style(\"opacity\", trace.opacity);\n gTrace.selectAll(\"path.surface\").each(function(pt) {\n d3.select(this).call(styleOne, pt, trace, gd);\n });\n });\n }\n function styleOne(s, pt, trace, gd) {\n var cdi = pt.data.data;\n var isLeaf = !pt.children;\n var ptNumber = cdi.i;\n var lineColor = Lib.castOption(trace, ptNumber, \"marker.line.color\") || Color2.defaultLine;\n var lineWidth = Lib.castOption(trace, ptNumber, \"marker.line.width\") || 0;\n s.call(fillOne, pt, trace, gd).style(\"stroke-width\", lineWidth).call(Color2.stroke, lineColor).style(\"opacity\", isLeaf ? trace.leaf.opacity : null);\n }\n module.exports = {\n style,\n styleOne\n };\n }\n });\n\n // src/traces/icicle/draw_descendants.js\n var require_draw_descendants2 = __commonJS({\n \"src/traces/icicle/draw_descendants.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var Drawing = require_drawing();\n var svgTextUtils = require_svg_text_utils();\n var partition = require_partition2();\n var styleOne = require_style15().styleOne;\n var constants = require_constants21();\n var helpers = require_helpers15();\n var attachFxHandlers = require_fx2();\n var formatSliceLabel = require_plot13().formatSliceLabel;\n var onPathbar = false;\n module.exports = function drawDescendants(gd, cd, entry, slices, opts) {\n var width = opts.width;\n var height = opts.height;\n var viewX = opts.viewX;\n var viewY = opts.viewY;\n var pathSlice = opts.pathSlice;\n var toMoveInsideSlice = opts.toMoveInsideSlice;\n var strTransform = opts.strTransform;\n var hasTransition = opts.hasTransition;\n var handleSlicesExit = opts.handleSlicesExit;\n var makeUpdateSliceInterpolator = opts.makeUpdateSliceInterpolator;\n var makeUpdateTextInterpolator = opts.makeUpdateTextInterpolator;\n var prevEntry = opts.prevEntry;\n var refRect = {};\n var isStatic = gd._context.staticPlot;\n var fullLayout = gd._fullLayout;\n var cd0 = cd[0];\n var trace = cd0.trace;\n var hasLeft = trace.textposition.indexOf(\"left\") !== -1;\n var hasRight = trace.textposition.indexOf(\"right\") !== -1;\n var hasBottom = trace.textposition.indexOf(\"bottom\") !== -1;\n var allData = partition(entry, [width, height], {\n flipX: trace.tiling.flip.indexOf(\"x\") > -1,\n flipY: trace.tiling.flip.indexOf(\"y\") > -1,\n orientation: trace.tiling.orientation,\n pad: {\n inner: trace.tiling.pad\n },\n maxDepth: trace._maxDepth\n });\n var sliceData = allData.descendants();\n var minVisibleDepth = Infinity;\n var maxVisibleDepth = -Infinity;\n sliceData.forEach(function(pt) {\n var depth = pt.depth;\n if (depth >= trace._maxDepth) {\n pt.x0 = pt.x1 = (pt.x0 + pt.x1) / 2;\n pt.y0 = pt.y1 = (pt.y0 + pt.y1) / 2;\n } else {\n minVisibleDepth = Math.min(minVisibleDepth, depth);\n maxVisibleDepth = Math.max(maxVisibleDepth, depth);\n }\n });\n slices = slices.data(sliceData, helpers.getPtId);\n trace._maxVisibleLayers = isFinite(maxVisibleDepth) ? maxVisibleDepth - minVisibleDepth + 1 : 0;\n slices.enter().append(\"g\").classed(\"slice\", true);\n handleSlicesExit(slices, onPathbar, refRect, [width, height], pathSlice);\n slices.order();\n var nextOfPrevEntry = null;\n if (hasTransition && prevEntry) {\n var prevEntryId = helpers.getPtId(prevEntry);\n slices.each(function(pt) {\n if (nextOfPrevEntry === null && helpers.getPtId(pt) === prevEntryId) {\n nextOfPrevEntry = {\n x0: pt.x0,\n x1: pt.x1,\n y0: pt.y0,\n y1: pt.y1\n };\n }\n });\n }\n var getRefRect = function() {\n return nextOfPrevEntry || {\n x0: 0,\n x1: width,\n y0: 0,\n y1: height\n };\n };\n var updateSlices = slices;\n if (hasTransition) {\n updateSlices = updateSlices.transition().each(\"end\", function() {\n var sliceTop = d3.select(this);\n helpers.setSliceCursor(sliceTop, gd, {\n hideOnRoot: true,\n hideOnLeaves: false,\n isTransitioning: false\n });\n });\n }\n updateSlices.each(function(pt) {\n pt._x0 = viewX(pt.x0);\n pt._x1 = viewX(pt.x1);\n pt._y0 = viewY(pt.y0);\n pt._y1 = viewY(pt.y1);\n pt._hoverX = viewX(pt.x1 - trace.tiling.pad), pt._hoverY = hasBottom ? viewY(pt.y1 - trace.tiling.pad / 2) : viewY(pt.y0 + trace.tiling.pad / 2);\n var sliceTop = d3.select(this);\n var slicePath = Lib.ensureSingle(sliceTop, \"path\", \"surface\", function(s) {\n s.style(\"pointer-events\", isStatic ? \"none\" : \"all\");\n });\n if (hasTransition) {\n slicePath.transition().attrTween(\"d\", function(pt2) {\n var interp = makeUpdateSliceInterpolator(\n pt2,\n onPathbar,\n getRefRect(),\n [width, height],\n {\n orientation: trace.tiling.orientation,\n flipX: trace.tiling.flip.indexOf(\"x\") > -1,\n flipY: trace.tiling.flip.indexOf(\"y\") > -1\n }\n );\n return function(t) {\n return pathSlice(interp(t));\n };\n });\n } else {\n slicePath.attr(\"d\", pathSlice);\n }\n sliceTop.call(attachFxHandlers, entry, gd, cd, {\n styleOne,\n eventDataKeys: constants.eventDataKeys,\n transitionTime: constants.CLICK_TRANSITION_TIME,\n transitionEasing: constants.CLICK_TRANSITION_EASING\n }).call(helpers.setSliceCursor, gd, { isTransitioning: gd._transitioning });\n slicePath.call(styleOne, pt, trace, gd, {\n hovered: false\n });\n if (pt.x0 === pt.x1 || pt.y0 === pt.y1) {\n pt._text = \"\";\n } else {\n pt._text = formatSliceLabel(pt, entry, trace, cd, fullLayout) || \"\";\n }\n var sliceTextGroup = Lib.ensureSingle(sliceTop, \"g\", \"slicetext\");\n var sliceText = Lib.ensureSingle(sliceTextGroup, \"text\", \"\", function(s) {\n s.attr(\"data-notex\", 1);\n });\n var font = Lib.ensureUniformFontSize(gd, helpers.determineTextFont(trace, pt, fullLayout.font));\n sliceText.text(pt._text || \" \").classed(\"slicetext\", true).attr(\"text-anchor\", hasRight ? \"end\" : hasLeft ? \"start\" : \"middle\").call(Drawing.font, font).call(svgTextUtils.convertToTspans, gd);\n pt.textBB = Drawing.bBox(sliceText.node());\n pt.transform = toMoveInsideSlice(pt, {\n fontSize: font.size\n });\n pt.transform.fontSize = font.size;\n if (hasTransition) {\n sliceText.transition().attrTween(\"transform\", function(pt2) {\n var interp = makeUpdateTextInterpolator(pt2, onPathbar, getRefRect(), [width, height]);\n return function(t) {\n return strTransform(interp(t));\n };\n });\n } else {\n sliceText.attr(\"transform\", strTransform(pt));\n }\n });\n return nextOfPrevEntry;\n };\n }\n });\n\n // src/traces/icicle/plot.js\n var require_plot15 = __commonJS({\n \"src/traces/icicle/plot.js\"(exports, module) {\n \"use strict\";\n var draw = require_draw12();\n var drawDescendants = require_draw_descendants2();\n module.exports = function _plot(gd, cdmodule, transitionOpts, makeOnCompleteCallback) {\n return draw(gd, cdmodule, transitionOpts, makeOnCompleteCallback, {\n type: \"icicle\",\n drawDescendants\n });\n };\n }\n });\n\n // src/traces/icicle/index.js\n var require_icicle = __commonJS({\n \"src/traces/icicle/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"trace\",\n name: \"icicle\",\n basePlotModule: require_base_plot4(),\n categories: [],\n animatable: true,\n attributes: require_attributes38(),\n layoutAttributes: require_layout_attributes15(),\n supplyDefaults: require_defaults34(),\n supplyLayoutDefaults: require_layout_defaults14(),\n calc: require_calc19().calc,\n crossTraceCalc: require_calc19().crossTraceCalc,\n plot: require_plot15(),\n style: require_style15().style,\n colorbar: require_marker_colorbar(),\n meta: {}\n };\n }\n });\n\n // lib/icicle.js\n var require_icicle2 = __commonJS({\n \"lib/icicle.js\"(exports, module) {\n \"use strict\";\n module.exports = require_icicle();\n }\n });\n\n // src/traces/funnelarea/base_plot.js\n var require_base_plot5 = __commonJS({\n \"src/traces/funnelarea/base_plot.js\"(exports) {\n \"use strict\";\n var plots = require_plots();\n exports.name = \"funnelarea\";\n exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) {\n plots.plotBasePlot(exports.name, gd, traces, transitionOpts, makeOnCompleteCallback);\n };\n exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout);\n };\n }\n });\n\n // src/traces/funnelarea/attributes.js\n var require_attributes39 = __commonJS({\n \"src/traces/funnelarea/attributes.js\"(exports, module) {\n \"use strict\";\n var pieAttrs = require_attributes35();\n var baseAttrs = require_attributes2();\n var domainAttrs = require_domain().attributes;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var extendFlat = require_extend().extendFlat;\n module.exports = {\n labels: pieAttrs.labels,\n // equivalent of x0 and dx, if label is missing\n label0: pieAttrs.label0,\n dlabel: pieAttrs.dlabel,\n values: pieAttrs.values,\n marker: {\n colors: pieAttrs.marker.colors,\n line: {\n color: extendFlat({}, pieAttrs.marker.line.color, {\n dflt: null\n }),\n width: extendFlat({}, pieAttrs.marker.line.width, { dflt: 1 }),\n editType: \"calc\"\n },\n pattern: pieAttrs.marker.pattern,\n editType: \"calc\"\n },\n text: pieAttrs.text,\n hovertext: pieAttrs.hovertext,\n scalegroup: extendFlat({}, pieAttrs.scalegroup, {}),\n textinfo: extendFlat({}, pieAttrs.textinfo, {\n flags: [\"label\", \"text\", \"value\", \"percent\"]\n }),\n texttemplate: texttemplateAttrs({ editType: \"plot\" }, {\n keys: [\"label\", \"color\", \"value\", \"text\", \"percent\"]\n }),\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: [\"label\", \"text\", \"value\", \"percent\", \"name\"]\n }),\n hovertemplate: hovertemplateAttrs({}, {\n keys: [\"label\", \"color\", \"value\", \"text\", \"percent\"]\n }),\n textposition: extendFlat({}, pieAttrs.textposition, {\n values: [\"inside\", \"none\"],\n dflt: \"inside\"\n }),\n textfont: pieAttrs.textfont,\n insidetextfont: pieAttrs.insidetextfont,\n title: {\n text: pieAttrs.title.text,\n font: pieAttrs.title.font,\n position: extendFlat({}, pieAttrs.title.position, {\n values: [\"top left\", \"top center\", \"top right\"],\n dflt: \"top center\"\n }),\n editType: \"plot\"\n },\n domain: domainAttrs({ name: \"funnelarea\", trace: true, editType: \"calc\" }),\n aspectratio: {\n valType: \"number\",\n min: 0,\n dflt: 1,\n editType: \"plot\"\n },\n baseratio: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0.333,\n editType: \"plot\"\n }\n };\n }\n });\n\n // src/traces/funnelarea/layout_attributes.js\n var require_layout_attributes16 = __commonJS({\n \"src/traces/funnelarea/layout_attributes.js\"(exports, module) {\n \"use strict\";\n var hiddenlabels = require_layout_attributes12().hiddenlabels;\n module.exports = {\n hiddenlabels,\n funnelareacolorway: {\n valType: \"colorlist\",\n editType: \"calc\"\n },\n extendfunnelareacolors: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc\"\n }\n };\n }\n });\n\n // src/traces/funnelarea/defaults.js\n var require_defaults35 = __commonJS({\n \"src/traces/funnelarea/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var attributes = require_attributes39();\n var handleDomainDefaults = require_domain().defaults;\n var handleText = require_defaults19().handleText;\n var handleLabelsAndValues = require_defaults31().handleLabelsAndValues;\n var handleMarkerDefaults = require_defaults31().handleMarkerDefaults;\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var labels = coerce(\"labels\");\n var values = coerce(\"values\");\n var res = handleLabelsAndValues(labels, values);\n var len = res.len;\n traceOut._hasLabels = res.hasLabels;\n traceOut._hasValues = res.hasValues;\n if (!traceOut._hasLabels && traceOut._hasValues) {\n coerce(\"label0\");\n coerce(\"dlabel\");\n }\n if (!len) {\n traceOut.visible = false;\n return;\n }\n traceOut._length = len;\n handleMarkerDefaults(traceIn, traceOut, layout, coerce);\n coerce(\"scalegroup\");\n var textData = coerce(\"text\");\n var textTemplate = coerce(\"texttemplate\");\n var textInfo;\n if (!textTemplate) textInfo = coerce(\"textinfo\", Array.isArray(textData) ? \"text+percent\" : \"percent\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n if (textTemplate || textInfo && textInfo !== \"none\") {\n var textposition = coerce(\"textposition\");\n handleText(traceIn, traceOut, layout, coerce, textposition, {\n moduleHasSelected: false,\n moduleHasUnselected: false,\n moduleHasConstrain: false,\n moduleHasCliponaxis: false,\n moduleHasTextangle: false,\n moduleHasInsideanchor: false\n });\n } else if (textInfo === \"none\") {\n coerce(\"textposition\", \"none\");\n }\n handleDomainDefaults(traceOut, layout, coerce);\n var title = coerce(\"title.text\");\n if (title) {\n coerce(\"title.position\");\n Lib.coerceFont(coerce, \"title.font\", layout.font);\n }\n coerce(\"aspectratio\");\n coerce(\"baseratio\");\n };\n }\n });\n\n // src/traces/funnelarea/layout_defaults.js\n var require_layout_defaults15 = __commonJS({\n \"src/traces/funnelarea/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var layoutAttributes = require_layout_attributes16();\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);\n }\n coerce(\"hiddenlabels\");\n coerce(\"funnelareacolorway\", layoutOut.colorway);\n coerce(\"extendfunnelareacolors\");\n };\n }\n });\n\n // src/traces/funnelarea/calc.js\n var require_calc20 = __commonJS({\n \"src/traces/funnelarea/calc.js\"(exports, module) {\n \"use strict\";\n var pieCalc = require_calc16();\n function calc(gd, trace) {\n return pieCalc.calc(gd, trace);\n }\n function crossTraceCalc(gd) {\n pieCalc.crossTraceCalc(gd, { type: \"funnelarea\" });\n }\n module.exports = {\n calc,\n crossTraceCalc\n };\n }\n });\n\n // src/traces/funnelarea/plot.js\n var require_plot16 = __commonJS({\n \"src/traces/funnelarea/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Drawing = require_drawing();\n var Lib = require_lib();\n var strScale = Lib.strScale;\n var strTranslate = Lib.strTranslate;\n var svgTextUtils = require_svg_text_utils();\n var barPlot = require_plot3();\n var toMoveInsideBar = barPlot.toMoveInsideBar;\n var uniformText = require_uniform_text();\n var recordMinTextSize = uniformText.recordMinTextSize;\n var clearMinTextSize = uniformText.clearMinTextSize;\n var pieHelpers = require_helpers4();\n var piePlot = require_plot12();\n var attachFxHandlers = piePlot.attachFxHandlers;\n var determineInsideTextFont = piePlot.determineInsideTextFont;\n var layoutAreas = piePlot.layoutAreas;\n var prerenderTitles = piePlot.prerenderTitles;\n var positionTitleOutside = piePlot.positionTitleOutside;\n var formatSliceLabel = piePlot.formatSliceLabel;\n module.exports = function plot(gd, cdModule) {\n var isStatic = gd._context.staticPlot;\n var fullLayout = gd._fullLayout;\n clearMinTextSize(\"funnelarea\", fullLayout);\n prerenderTitles(cdModule, gd);\n layoutAreas(cdModule, fullLayout._size);\n Lib.makeTraceGroups(fullLayout._funnelarealayer, cdModule, \"trace\").each(function(cd) {\n var plotGroup = d3.select(this);\n var cd0 = cd[0];\n var trace = cd0.trace;\n setCoords(cd);\n plotGroup.each(function() {\n var slices = d3.select(this).selectAll(\"g.slice\").data(cd);\n slices.enter().append(\"g\").classed(\"slice\", true);\n slices.exit().remove();\n slices.each(function(pt, i) {\n if (pt.hidden) {\n d3.select(this).selectAll(\"path,g\").remove();\n return;\n }\n pt.pointNumber = pt.i;\n pt.curveNumber = trace.index;\n var cx = cd0.cx;\n var cy = cd0.cy;\n var sliceTop = d3.select(this);\n var slicePath = sliceTop.selectAll(\"path.surface\").data([pt]);\n slicePath.enter().append(\"path\").classed(\"surface\", true).style({ \"pointer-events\": isStatic ? \"none\" : \"all\" });\n sliceTop.call(attachFxHandlers, gd, cd);\n var shape = \"M\" + (cx + pt.TR[0]) + \",\" + (cy + pt.TR[1]) + line(pt.TR, pt.BR) + line(pt.BR, pt.BL) + line(pt.BL, pt.TL) + \"Z\";\n slicePath.attr(\"d\", shape);\n formatSliceLabel(gd, pt, cd0);\n var textPosition = pieHelpers.castOption(trace.textposition, pt.pts);\n var sliceTextGroup = sliceTop.selectAll(\"g.slicetext\").data(pt.text && textPosition !== \"none\" ? [0] : []);\n sliceTextGroup.enter().append(\"g\").classed(\"slicetext\", true);\n sliceTextGroup.exit().remove();\n sliceTextGroup.each(function() {\n var sliceText = Lib.ensureSingle(d3.select(this), \"text\", \"\", function(s) {\n s.attr(\"data-notex\", 1);\n });\n var font = Lib.ensureUniformFontSize(gd, determineInsideTextFont(trace, pt, fullLayout.font));\n sliceText.text(pt.text).attr({\n class: \"slicetext\",\n transform: \"\",\n \"text-anchor\": \"middle\"\n }).call(Drawing.font, font).call(svgTextUtils.convertToTspans, gd);\n var textBB = Drawing.bBox(sliceText.node());\n var transform;\n var x0, x1;\n var y0 = Math.min(pt.BL[1], pt.BR[1]) + cy;\n var y1 = Math.max(pt.TL[1], pt.TR[1]) + cy;\n x0 = Math.max(pt.TL[0], pt.BL[0]) + cx;\n x1 = Math.min(pt.TR[0], pt.BR[0]) + cx;\n transform = toMoveInsideBar(x0, x1, y0, y1, textBB, {\n isHorizontal: true,\n constrained: true,\n angle: 0,\n anchor: \"middle\"\n });\n transform.fontSize = font.size;\n recordMinTextSize(trace.type, transform, fullLayout);\n cd[i].transform = transform;\n Lib.setTransormAndDisplay(sliceText, transform);\n });\n });\n var titleTextGroup = d3.select(this).selectAll(\"g.titletext\").data(trace.title.text ? [0] : []);\n titleTextGroup.enter().append(\"g\").classed(\"titletext\", true);\n titleTextGroup.exit().remove();\n titleTextGroup.each(function() {\n var titleText = Lib.ensureSingle(d3.select(this), \"text\", \"\", function(s) {\n s.attr(\"data-notex\", 1);\n });\n var txt = trace.title.text;\n if (trace._meta) {\n txt = Lib.templateString(txt, trace._meta);\n }\n titleText.text(txt).attr({\n class: \"titletext\",\n transform: \"\",\n \"text-anchor\": \"middle\"\n }).call(Drawing.font, trace.title.font).call(svgTextUtils.convertToTspans, gd);\n var transform = positionTitleOutside(cd0, fullLayout._size);\n titleText.attr(\n \"transform\",\n strTranslate(transform.x, transform.y) + strScale(Math.min(1, transform.scale)) + strTranslate(transform.tx, transform.ty)\n );\n });\n });\n });\n };\n function line(a, b) {\n var dx = b[0] - a[0];\n var dy = b[1] - a[1];\n return \"l\" + dx + \",\" + dy;\n }\n function getBetween(a, b) {\n return [\n 0.5 * (a[0] + b[0]),\n 0.5 * (a[1] + b[1])\n ];\n }\n function setCoords(cd) {\n if (!cd.length) return;\n var cd0 = cd[0];\n var trace = cd0.trace;\n var aspectratio = trace.aspectratio;\n var h = trace.baseratio;\n if (h > 0.999) h = 0.999;\n var h2 = Math.pow(h, 2);\n var v1 = cd0.vTotal;\n var v0 = v1 * h2 / (1 - h2);\n var totalValues = v1;\n var sumSteps = v0 / v1;\n function calcPos() {\n var q = Math.sqrt(sumSteps);\n return {\n x: q,\n y: -q\n };\n }\n function getPoint() {\n var pos = calcPos();\n return [pos.x, pos.y];\n }\n var p;\n var allPoints = [];\n allPoints.push(getPoint());\n var i, cdi;\n for (i = cd.length - 1; i > -1; i--) {\n cdi = cd[i];\n if (cdi.hidden) continue;\n var step = cdi.v / totalValues;\n sumSteps += step;\n allPoints.push(getPoint());\n }\n var minY = Infinity;\n var maxY = -Infinity;\n for (i = 0; i < allPoints.length; i++) {\n p = allPoints[i];\n minY = Math.min(minY, p[1]);\n maxY = Math.max(maxY, p[1]);\n }\n for (i = 0; i < allPoints.length; i++) {\n allPoints[i][1] -= (maxY + minY) / 2;\n }\n var lastX = allPoints[allPoints.length - 1][0];\n var r = cd0.r;\n var rY = (maxY - minY) / 2;\n var scaleX = r / lastX;\n var scaleY = r / rY * aspectratio;\n cd0.r = scaleY * rY;\n for (i = 0; i < allPoints.length; i++) {\n allPoints[i][0] *= scaleX;\n allPoints[i][1] *= scaleY;\n }\n p = allPoints[0];\n var prevLeft = [-p[0], p[1]];\n var prevRight = [p[0], p[1]];\n var n = 0;\n for (i = cd.length - 1; i > -1; i--) {\n cdi = cd[i];\n if (cdi.hidden) continue;\n n += 1;\n var x = allPoints[n][0];\n var y = allPoints[n][1];\n cdi.TL = [-x, y];\n cdi.TR = [x, y];\n cdi.BL = prevLeft;\n cdi.BR = prevRight;\n cdi.pxmid = getBetween(cdi.TR, cdi.BR);\n prevLeft = cdi.TL;\n prevRight = cdi.TR;\n }\n }\n }\n });\n\n // src/traces/funnelarea/style.js\n var require_style16 = __commonJS({\n \"src/traces/funnelarea/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var styleOne = require_style_one();\n var resizeText = require_uniform_text().resizeText;\n module.exports = function style(gd) {\n var s = gd._fullLayout._funnelarealayer.selectAll(\".trace\");\n resizeText(gd, s, \"funnelarea\");\n s.each(function(cd) {\n var cd0 = cd[0];\n var trace = cd0.trace;\n var traceSelection = d3.select(this);\n traceSelection.style({ opacity: trace.opacity });\n traceSelection.selectAll(\"path.surface\").each(function(pt) {\n d3.select(this).call(styleOne, pt, trace, gd);\n });\n });\n };\n }\n });\n\n // src/traces/funnelarea/index.js\n var require_funnelarea = __commonJS({\n \"src/traces/funnelarea/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"trace\",\n name: \"funnelarea\",\n basePlotModule: require_base_plot5(),\n categories: [\"pie-like\", \"funnelarea\", \"showLegend\"],\n attributes: require_attributes39(),\n layoutAttributes: require_layout_attributes16(),\n supplyDefaults: require_defaults35(),\n supplyLayoutDefaults: require_layout_defaults15(),\n calc: require_calc20().calc,\n crossTraceCalc: require_calc20().crossTraceCalc,\n plot: require_plot16(),\n style: require_style16(),\n styleOne: require_style_one(),\n meta: {}\n };\n }\n });\n\n // lib/funnelarea.js\n var require_funnelarea2 = __commonJS({\n \"lib/funnelarea.js\"(exports, module) {\n \"use strict\";\n module.exports = require_funnelarea();\n }\n });\n\n // stackgl_modules/index.js\n var require_stackgl_modules = __commonJS({\n \"stackgl_modules/index.js\"(exports, module) {\n (function() {\n var __webpack_modules__ = {\n /***/\n 1964: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = {\n alpha_shape: __webpack_require__2(3502),\n convex_hull: __webpack_require__2(7352),\n delaunay_triangulate: __webpack_require__2(7642),\n gl_cone3d: __webpack_require__2(6405),\n gl_error3d: __webpack_require__2(9165),\n gl_line3d: __webpack_require__2(5714),\n gl_mesh3d: __webpack_require__2(7201),\n gl_plot3d: __webpack_require__2(4100),\n gl_scatter3d: __webpack_require__2(8418),\n gl_streamtube3d: __webpack_require__2(7815),\n gl_surface3d: __webpack_require__2(9499),\n ndarray: __webpack_require__2(9618),\n ndarray_linear_interpolate: __webpack_require__2(4317)\n };\n }\n ),\n /***/\n 4793: (\n /***/\n function(__unused_webpack_module, exports2, __webpack_require__2) {\n \"use strict\";\n var __webpack_unused_export__;\n function _classCallCheck(a, n) {\n if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\");\n }\n function _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || false, o.configurable = true, \"value\" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n }\n function _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: false }), e;\n }\n function _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n }\n function _toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n }\n function _callSuper(t, o, e) {\n return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));\n }\n function _possibleConstructorReturn(t, e) {\n if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e;\n if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\");\n return _assertThisInitialized(t);\n }\n function _assertThisInitialized(e) {\n if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return e;\n }\n function _isNativeReflectConstruct() {\n try {\n var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {\n }));\n } catch (t4) {\n }\n return (_isNativeReflectConstruct = function _isNativeReflectConstruct2() {\n return !!t;\n })();\n }\n function _getPrototypeOf(t) {\n return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t4) {\n return t4.__proto__ || Object.getPrototypeOf(t4);\n }, _getPrototypeOf(t);\n }\n function _inherits(t, e) {\n if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\");\n t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: true, configurable: true } }), Object.defineProperty(t, \"prototype\", { writable: false }), e && _setPrototypeOf(t, e);\n }\n function _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t4, e2) {\n return t4.__proto__ = e2, t4;\n }, _setPrototypeOf(t, e);\n }\n function _typeof(o) {\n \"@babel/helpers - typeof\";\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(o2) {\n return typeof o2;\n } : function(o2) {\n return o2 && \"function\" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? \"symbol\" : typeof o2;\n }, _typeof(o);\n }\n var base64 = __webpack_require__2(7507);\n var ieee754 = __webpack_require__2(3778);\n var customInspectSymbol = typeof Symbol === \"function\" && typeof Symbol[\"for\"] === \"function\" ? Symbol[\"for\"](\"nodejs.util.inspect.custom\") : null;\n exports2.hp = Buffer2;\n __webpack_unused_export__ = SlowBuffer;\n exports2.IS = 50;\n var K_MAX_LENGTH = 2147483647;\n __webpack_unused_export__ = K_MAX_LENGTH;\n Buffer2.TYPED_ARRAY_SUPPORT = typedArraySupport();\n if (!Buffer2.TYPED_ARRAY_SUPPORT && typeof console !== \"undefined\" && typeof console.error === \"function\") {\n console.error(\"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.\");\n }\n function typedArraySupport() {\n try {\n var arr = new Uint8Array(1);\n var proto = {\n foo: function foo() {\n return 42;\n }\n };\n Object.setPrototypeOf(proto, Uint8Array.prototype);\n Object.setPrototypeOf(arr, proto);\n return arr.foo() === 42;\n } catch (e) {\n return false;\n }\n }\n Object.defineProperty(Buffer2.prototype, \"parent\", {\n enumerable: true,\n get: function get() {\n if (!Buffer2.isBuffer(this)) return void 0;\n return this.buffer;\n }\n });\n Object.defineProperty(Buffer2.prototype, \"offset\", {\n enumerable: true,\n get: function get() {\n if (!Buffer2.isBuffer(this)) return void 0;\n return this.byteOffset;\n }\n });\n function createBuffer(length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"');\n }\n var buf = new Uint8Array(length);\n Object.setPrototypeOf(buf, Buffer2.prototype);\n return buf;\n }\n function Buffer2(arg, encodingOrOffset, length) {\n if (typeof arg === \"number\") {\n if (typeof encodingOrOffset === \"string\") {\n throw new TypeError('The \"string\" argument must be of type string. Received type number');\n }\n return allocUnsafe(arg);\n }\n return from(arg, encodingOrOffset, length);\n }\n Buffer2.poolSize = 8192;\n function from(value, encodingOrOffset, length) {\n if (typeof value === \"string\") {\n return fromString(value, encodingOrOffset);\n }\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value);\n }\n if (value == null) {\n throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \" + _typeof(value));\n }\n if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {\n return fromArrayBuffer(value, encodingOrOffset, length);\n }\n if (typeof SharedArrayBuffer !== \"undefined\" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length);\n }\n if (typeof value === \"number\") {\n throw new TypeError('The \"value\" argument must not be of type number. Received type number');\n }\n var valueOf = value.valueOf && value.valueOf();\n if (valueOf != null && valueOf !== value) {\n return Buffer2.from(valueOf, encodingOrOffset, length);\n }\n var b = fromObject(value);\n if (b) return b;\n if (typeof Symbol !== \"undefined\" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === \"function\") {\n return Buffer2.from(value[Symbol.toPrimitive](\"string\"), encodingOrOffset, length);\n }\n throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \" + _typeof(value));\n }\n Buffer2.from = function(value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length);\n };\n Object.setPrototypeOf(Buffer2.prototype, Uint8Array.prototype);\n Object.setPrototypeOf(Buffer2, Uint8Array);\n function assertSize(size) {\n if (typeof size !== \"number\") {\n throw new TypeError('\"size\" argument must be of type number');\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"');\n }\n }\n function alloc(size, fill, encoding) {\n assertSize(size);\n if (size <= 0) {\n return createBuffer(size);\n }\n if (fill !== void 0) {\n return typeof encoding === \"string\" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);\n }\n return createBuffer(size);\n }\n Buffer2.alloc = function(size, fill, encoding) {\n return alloc(size, fill, encoding);\n };\n function allocUnsafe(size) {\n assertSize(size);\n return createBuffer(size < 0 ? 0 : checked(size) | 0);\n }\n Buffer2.allocUnsafe = function(size) {\n return allocUnsafe(size);\n };\n Buffer2.allocUnsafeSlow = function(size) {\n return allocUnsafe(size);\n };\n function fromString(string, encoding) {\n if (typeof encoding !== \"string\" || encoding === \"\") {\n encoding = \"utf8\";\n }\n if (!Buffer2.isEncoding(encoding)) {\n throw new TypeError(\"Unknown encoding: \" + encoding);\n }\n var length = byteLength(string, encoding) | 0;\n var buf = createBuffer(length);\n var actual = buf.write(string, encoding);\n if (actual !== length) {\n buf = buf.slice(0, actual);\n }\n return buf;\n }\n function fromArrayLike(array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0;\n var buf = createBuffer(length);\n for (var i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255;\n }\n return buf;\n }\n function fromArrayView(arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n var copy = new Uint8Array(arrayView);\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);\n }\n return fromArrayLike(arrayView);\n }\n function fromArrayBuffer(array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds');\n }\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds');\n }\n var buf;\n if (byteOffset === void 0 && length === void 0) {\n buf = new Uint8Array(array);\n } else if (length === void 0) {\n buf = new Uint8Array(array, byteOffset);\n } else {\n buf = new Uint8Array(array, byteOffset, length);\n }\n Object.setPrototypeOf(buf, Buffer2.prototype);\n return buf;\n }\n function fromObject(obj) {\n if (Buffer2.isBuffer(obj)) {\n var len = checked(obj.length) | 0;\n var buf = createBuffer(len);\n if (buf.length === 0) {\n return buf;\n }\n obj.copy(buf, 0, 0, len);\n return buf;\n }\n if (obj.length !== void 0) {\n if (typeof obj.length !== \"number\" || numberIsNaN(obj.length)) {\n return createBuffer(0);\n }\n return fromArrayLike(obj);\n }\n if (obj.type === \"Buffer\" && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data);\n }\n }\n function checked(length) {\n if (length >= K_MAX_LENGTH) {\n throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\" + K_MAX_LENGTH.toString(16) + \" bytes\");\n }\n return length | 0;\n }\n function SlowBuffer(length) {\n if (+length != length) {\n length = 0;\n }\n return Buffer2.alloc(+length);\n }\n Buffer2.isBuffer = function isBuffer(b) {\n return b != null && b._isBuffer === true && b !== Buffer2.prototype;\n };\n Buffer2.compare = function compare(a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer2.from(a, a.offset, a.byteLength);\n if (isInstance(b, Uint8Array)) b = Buffer2.from(b, b.offset, b.byteLength);\n if (!Buffer2.isBuffer(a) || !Buffer2.isBuffer(b)) {\n throw new TypeError('The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array');\n }\n if (a === b) return 0;\n var x = a.length;\n var y = b.length;\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break;\n }\n }\n if (x < y) return -1;\n if (y < x) return 1;\n return 0;\n };\n Buffer2.isEncoding = function isEncoding(encoding) {\n switch (String(encoding).toLowerCase()) {\n case \"hex\":\n case \"utf8\":\n case \"utf-8\":\n case \"ascii\":\n case \"latin1\":\n case \"binary\":\n case \"base64\":\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n return true;\n default:\n return false;\n }\n };\n Buffer2.concat = function concat(list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers');\n }\n if (list.length === 0) {\n return Buffer2.alloc(0);\n }\n var i;\n if (length === void 0) {\n length = 0;\n for (i = 0; i < list.length; ++i) {\n length += list[i].length;\n }\n }\n var buffer = Buffer2.allocUnsafe(length);\n var pos = 0;\n for (i = 0; i < list.length; ++i) {\n var buf = list[i];\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer2.isBuffer(buf)) buf = Buffer2.from(buf);\n buf.copy(buffer, pos);\n } else {\n Uint8Array.prototype.set.call(buffer, buf, pos);\n }\n } else if (!Buffer2.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers');\n } else {\n buf.copy(buffer, pos);\n }\n pos += buf.length;\n }\n return buffer;\n };\n function byteLength(string, encoding) {\n if (Buffer2.isBuffer(string)) {\n return string.length;\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength;\n }\n if (typeof string !== \"string\") {\n throw new TypeError('The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + _typeof(string));\n }\n var len = string.length;\n var mustMatch = arguments.length > 2 && arguments[2] === true;\n if (!mustMatch && len === 0) return 0;\n var loweredCase = false;\n for (; ; ) {\n switch (encoding) {\n case \"ascii\":\n case \"latin1\":\n case \"binary\":\n return len;\n case \"utf8\":\n case \"utf-8\":\n return utf8ToBytes(string).length;\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n return len * 2;\n case \"hex\":\n return len >>> 1;\n case \"base64\":\n return base64ToBytes(string).length;\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length;\n }\n encoding = (\"\" + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n }\n Buffer2.byteLength = byteLength;\n function slowToString(encoding, start, end) {\n var loweredCase = false;\n if (start === void 0 || start < 0) {\n start = 0;\n }\n if (start > this.length) {\n return \"\";\n }\n if (end === void 0 || end > this.length) {\n end = this.length;\n }\n if (end <= 0) {\n return \"\";\n }\n end >>>= 0;\n start >>>= 0;\n if (end <= start) {\n return \"\";\n }\n if (!encoding) encoding = \"utf8\";\n while (true) {\n switch (encoding) {\n case \"hex\":\n return hexSlice(this, start, end);\n case \"utf8\":\n case \"utf-8\":\n return utf8Slice(this, start, end);\n case \"ascii\":\n return asciiSlice(this, start, end);\n case \"latin1\":\n case \"binary\":\n return latin1Slice(this, start, end);\n case \"base64\":\n return base64Slice(this, start, end);\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n return utf16leSlice(this, start, end);\n default:\n if (loweredCase) throw new TypeError(\"Unknown encoding: \" + encoding);\n encoding = (encoding + \"\").toLowerCase();\n loweredCase = true;\n }\n }\n }\n Buffer2.prototype._isBuffer = true;\n function swap(b, n, m) {\n var i = b[n];\n b[n] = b[m];\n b[m] = i;\n }\n Buffer2.prototype.swap16 = function swap16() {\n var len = this.length;\n if (len % 2 !== 0) {\n throw new RangeError(\"Buffer size must be a multiple of 16-bits\");\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1);\n }\n return this;\n };\n Buffer2.prototype.swap32 = function swap32() {\n var len = this.length;\n if (len % 4 !== 0) {\n throw new RangeError(\"Buffer size must be a multiple of 32-bits\");\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3);\n swap(this, i + 1, i + 2);\n }\n return this;\n };\n Buffer2.prototype.swap64 = function swap64() {\n var len = this.length;\n if (len % 8 !== 0) {\n throw new RangeError(\"Buffer size must be a multiple of 64-bits\");\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7);\n swap(this, i + 1, i + 6);\n swap(this, i + 2, i + 5);\n swap(this, i + 3, i + 4);\n }\n return this;\n };\n Buffer2.prototype.toString = function toString() {\n var length = this.length;\n if (length === 0) return \"\";\n if (arguments.length === 0) return utf8Slice(this, 0, length);\n return slowToString.apply(this, arguments);\n };\n Buffer2.prototype.toLocaleString = Buffer2.prototype.toString;\n Buffer2.prototype.equals = function equals(b) {\n if (!Buffer2.isBuffer(b)) throw new TypeError(\"Argument must be a Buffer\");\n if (this === b) return true;\n return Buffer2.compare(this, b) === 0;\n };\n Buffer2.prototype.inspect = function inspect() {\n var str = \"\";\n var max = exports2.IS;\n str = this.toString(\"hex\", 0, max).replace(/(.{2})/g, \"$1 \").trim();\n if (this.length > max) str += \" ... \";\n return \"\";\n };\n if (customInspectSymbol) {\n Buffer2.prototype[customInspectSymbol] = Buffer2.prototype.inspect;\n }\n Buffer2.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer2.from(target, target.offset, target.byteLength);\n }\n if (!Buffer2.isBuffer(target)) {\n throw new TypeError('The \"target\" argument must be one of type Buffer or Uint8Array. Received type ' + _typeof(target));\n }\n if (start === void 0) {\n start = 0;\n }\n if (end === void 0) {\n end = target ? target.length : 0;\n }\n if (thisStart === void 0) {\n thisStart = 0;\n }\n if (thisEnd === void 0) {\n thisEnd = this.length;\n }\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError(\"out of range index\");\n }\n if (thisStart >= thisEnd && start >= end) {\n return 0;\n }\n if (thisStart >= thisEnd) {\n return -1;\n }\n if (start >= end) {\n return 1;\n }\n start >>>= 0;\n end >>>= 0;\n thisStart >>>= 0;\n thisEnd >>>= 0;\n if (this === target) return 0;\n var x = thisEnd - thisStart;\n var y = end - start;\n var len = Math.min(x, y);\n var thisCopy = this.slice(thisStart, thisEnd);\n var targetCopy = target.slice(start, end);\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i];\n y = targetCopy[i];\n break;\n }\n }\n if (x < y) return -1;\n if (y < x) return 1;\n return 0;\n };\n function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {\n if (buffer.length === 0) return -1;\n if (typeof byteOffset === \"string\") {\n encoding = byteOffset;\n byteOffset = 0;\n } else if (byteOffset > 2147483647) {\n byteOffset = 2147483647;\n } else if (byteOffset < -2147483648) {\n byteOffset = -2147483648;\n }\n byteOffset = +byteOffset;\n if (numberIsNaN(byteOffset)) {\n byteOffset = dir ? 0 : buffer.length - 1;\n }\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset;\n if (byteOffset >= buffer.length) {\n if (dir) return -1;\n else byteOffset = buffer.length - 1;\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0;\n else return -1;\n }\n if (typeof val === \"string\") {\n val = Buffer2.from(val, encoding);\n }\n if (Buffer2.isBuffer(val)) {\n if (val.length === 0) {\n return -1;\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir);\n } else if (typeof val === \"number\") {\n val = val & 255;\n if (typeof Uint8Array.prototype.indexOf === \"function\") {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);\n }\n throw new TypeError(\"val must be string, number or Buffer\");\n }\n function arrayIndexOf(arr, val, byteOffset, encoding, dir) {\n var indexSize = 1;\n var arrLength = arr.length;\n var valLength = val.length;\n if (encoding !== void 0) {\n encoding = String(encoding).toLowerCase();\n if (encoding === \"ucs2\" || encoding === \"ucs-2\" || encoding === \"utf16le\" || encoding === \"utf-16le\") {\n if (arr.length < 2 || val.length < 2) {\n return -1;\n }\n indexSize = 2;\n arrLength /= 2;\n valLength /= 2;\n byteOffset /= 2;\n }\n }\n function read(buf, i2) {\n if (indexSize === 1) {\n return buf[i2];\n } else {\n return buf.readUInt16BE(i2 * indexSize);\n }\n }\n var i;\n if (dir) {\n var foundIndex = -1;\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i;\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;\n } else {\n if (foundIndex !== -1) i -= i - foundIndex;\n foundIndex = -1;\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;\n for (i = byteOffset; i >= 0; i--) {\n var found = true;\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false;\n break;\n }\n }\n if (found) return i;\n }\n }\n return -1;\n }\n Buffer2.prototype.includes = function includes(val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1;\n };\n Buffer2.prototype.indexOf = function indexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true);\n };\n Buffer2.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false);\n };\n function hexWrite(buf, string, offset, length) {\n offset = Number(offset) || 0;\n var remaining = buf.length - offset;\n if (!length) {\n length = remaining;\n } else {\n length = Number(length);\n if (length > remaining) {\n length = remaining;\n }\n }\n var strLen = string.length;\n if (length > strLen / 2) {\n length = strLen / 2;\n }\n var i;\n for (i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16);\n if (numberIsNaN(parsed)) return i;\n buf[offset + i] = parsed;\n }\n return i;\n }\n function utf8Write(buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);\n }\n function asciiWrite(buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length);\n }\n function base64Write(buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length);\n }\n function ucs2Write(buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);\n }\n Buffer2.prototype.write = function write(string, offset, length, encoding) {\n if (offset === void 0) {\n encoding = \"utf8\";\n length = this.length;\n offset = 0;\n } else if (length === void 0 && typeof offset === \"string\") {\n encoding = offset;\n length = this.length;\n offset = 0;\n } else if (isFinite(offset)) {\n offset = offset >>> 0;\n if (isFinite(length)) {\n length = length >>> 0;\n if (encoding === void 0) encoding = \"utf8\";\n } else {\n encoding = length;\n length = void 0;\n }\n } else {\n throw new Error(\"Buffer.write(string, encoding, offset[, length]) is no longer supported\");\n }\n var remaining = this.length - offset;\n if (length === void 0 || length > remaining) length = remaining;\n if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {\n throw new RangeError(\"Attempt to write outside buffer bounds\");\n }\n if (!encoding) encoding = \"utf8\";\n var loweredCase = false;\n for (; ; ) {\n switch (encoding) {\n case \"hex\":\n return hexWrite(this, string, offset, length);\n case \"utf8\":\n case \"utf-8\":\n return utf8Write(this, string, offset, length);\n case \"ascii\":\n case \"latin1\":\n case \"binary\":\n return asciiWrite(this, string, offset, length);\n case \"base64\":\n return base64Write(this, string, offset, length);\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n return ucs2Write(this, string, offset, length);\n default:\n if (loweredCase) throw new TypeError(\"Unknown encoding: \" + encoding);\n encoding = (\"\" + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n };\n Buffer2.prototype.toJSON = function toJSON() {\n return {\n type: \"Buffer\",\n data: Array.prototype.slice.call(this._arr || this, 0)\n };\n };\n function base64Slice(buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf);\n } else {\n return base64.fromByteArray(buf.slice(start, end));\n }\n }\n function utf8Slice(buf, start, end) {\n end = Math.min(buf.length, end);\n var res = [];\n var i = start;\n while (i < end) {\n var firstByte = buf[i];\n var codePoint = null;\n var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;\n if (i + bytesPerSequence <= end) {\n var secondByte = void 0, thirdByte = void 0, fourthByte = void 0, tempCodePoint = void 0;\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 128) {\n codePoint = firstByte;\n }\n break;\n case 2:\n secondByte = buf[i + 1];\n if ((secondByte & 192) === 128) {\n tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;\n if (tempCodePoint > 127) {\n codePoint = tempCodePoint;\n }\n }\n break;\n case 3:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {\n tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;\n if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {\n codePoint = tempCodePoint;\n }\n }\n break;\n case 4:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n fourthByte = buf[i + 3];\n if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {\n tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;\n if (tempCodePoint > 65535 && tempCodePoint < 1114112) {\n codePoint = tempCodePoint;\n }\n }\n }\n }\n if (codePoint === null) {\n codePoint = 65533;\n bytesPerSequence = 1;\n } else if (codePoint > 65535) {\n codePoint -= 65536;\n res.push(codePoint >>> 10 & 1023 | 55296);\n codePoint = 56320 | codePoint & 1023;\n }\n res.push(codePoint);\n i += bytesPerSequence;\n }\n return decodeCodePointsArray(res);\n }\n var MAX_ARGUMENTS_LENGTH = 4096;\n function decodeCodePointsArray(codePoints) {\n var len = codePoints.length;\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints);\n }\n var res = \"\";\n var i = 0;\n while (i < len) {\n res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));\n }\n return res;\n }\n function asciiSlice(buf, start, end) {\n var ret = \"\";\n end = Math.min(buf.length, end);\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 127);\n }\n return ret;\n }\n function latin1Slice(buf, start, end) {\n var ret = \"\";\n end = Math.min(buf.length, end);\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i]);\n }\n return ret;\n }\n function hexSlice(buf, start, end) {\n var len = buf.length;\n if (!start || start < 0) start = 0;\n if (!end || end < 0 || end > len) end = len;\n var out = \"\";\n for (var i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]];\n }\n return out;\n }\n function utf16leSlice(buf, start, end) {\n var bytes = buf.slice(start, end);\n var res = \"\";\n for (var i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);\n }\n return res;\n }\n Buffer2.prototype.slice = function slice(start, end) {\n var len = this.length;\n start = ~~start;\n end = end === void 0 ? len : ~~end;\n if (start < 0) {\n start += len;\n if (start < 0) start = 0;\n } else if (start > len) {\n start = len;\n }\n if (end < 0) {\n end += len;\n if (end < 0) end = 0;\n } else if (end > len) {\n end = len;\n }\n if (end < start) end = start;\n var newBuf = this.subarray(start, end);\n Object.setPrototypeOf(newBuf, Buffer2.prototype);\n return newBuf;\n };\n function checkOffset(offset, ext, length) {\n if (offset % 1 !== 0 || offset < 0) throw new RangeError(\"offset is not uint\");\n if (offset + ext > length) throw new RangeError(\"Trying to access beyond buffer length\");\n }\n Buffer2.prototype.readUintLE = Buffer2.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) checkOffset(offset, byteLength2, this.length);\n var val = this[offset];\n var mul = 1;\n var i = 0;\n while (++i < byteLength2 && (mul *= 256)) {\n val += this[offset + i] * mul;\n }\n return val;\n };\n Buffer2.prototype.readUintBE = Buffer2.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n checkOffset(offset, byteLength2, this.length);\n }\n var val = this[offset + --byteLength2];\n var mul = 1;\n while (byteLength2 > 0 && (mul *= 256)) {\n val += this[offset + --byteLength2] * mul;\n }\n return val;\n };\n Buffer2.prototype.readUint8 = Buffer2.prototype.readUInt8 = function readUInt8(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 1, this.length);\n return this[offset];\n };\n Buffer2.prototype.readUint16LE = Buffer2.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n return this[offset] | this[offset + 1] << 8;\n };\n Buffer2.prototype.readUint16BE = Buffer2.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n return this[offset] << 8 | this[offset + 1];\n };\n Buffer2.prototype.readUint32LE = Buffer2.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;\n };\n Buffer2.prototype.readUint32BE = Buffer2.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);\n };\n Buffer2.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, \"offset\");\n var first = this[offset];\n var last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n var lo = first + this[++offset] * Math.pow(2, 8) + this[++offset] * Math.pow(2, 16) + this[++offset] * Math.pow(2, 24);\n var hi = this[++offset] + this[++offset] * Math.pow(2, 8) + this[++offset] * Math.pow(2, 16) + last * Math.pow(2, 24);\n return BigInt(lo) + (BigInt(hi) << BigInt(32));\n });\n Buffer2.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, \"offset\");\n var first = this[offset];\n var last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n var hi = first * Math.pow(2, 24) + this[++offset] * Math.pow(2, 16) + this[++offset] * Math.pow(2, 8) + this[++offset];\n var lo = this[++offset] * Math.pow(2, 24) + this[++offset] * Math.pow(2, 16) + this[++offset] * Math.pow(2, 8) + last;\n return (BigInt(hi) << BigInt(32)) + BigInt(lo);\n });\n Buffer2.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) checkOffset(offset, byteLength2, this.length);\n var val = this[offset];\n var mul = 1;\n var i = 0;\n while (++i < byteLength2 && (mul *= 256)) {\n val += this[offset + i] * mul;\n }\n mul *= 128;\n if (val >= mul) val -= Math.pow(2, 8 * byteLength2);\n return val;\n };\n Buffer2.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) checkOffset(offset, byteLength2, this.length);\n var i = byteLength2;\n var mul = 1;\n var val = this[offset + --i];\n while (i > 0 && (mul *= 256)) {\n val += this[offset + --i] * mul;\n }\n mul *= 128;\n if (val >= mul) val -= Math.pow(2, 8 * byteLength2);\n return val;\n };\n Buffer2.prototype.readInt8 = function readInt8(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 1, this.length);\n if (!(this[offset] & 128)) return this[offset];\n return (255 - this[offset] + 1) * -1;\n };\n Buffer2.prototype.readInt16LE = function readInt16LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n var val = this[offset] | this[offset + 1] << 8;\n return val & 32768 ? val | 4294901760 : val;\n };\n Buffer2.prototype.readInt16BE = function readInt16BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n var val = this[offset + 1] | this[offset] << 8;\n return val & 32768 ? val | 4294901760 : val;\n };\n Buffer2.prototype.readInt32LE = function readInt32LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;\n };\n Buffer2.prototype.readInt32BE = function readInt32BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];\n };\n Buffer2.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, \"offset\");\n var first = this[offset];\n var last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n var val = this[offset + 4] + this[offset + 5] * Math.pow(2, 8) + this[offset + 6] * Math.pow(2, 16) + (last << 24);\n return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * Math.pow(2, 8) + this[++offset] * Math.pow(2, 16) + this[++offset] * Math.pow(2, 24));\n });\n Buffer2.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, \"offset\");\n var first = this[offset];\n var last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n var val = (first << 24) + // Overflow\n this[++offset] * Math.pow(2, 16) + this[++offset] * Math.pow(2, 8) + this[++offset];\n return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * Math.pow(2, 24) + this[++offset] * Math.pow(2, 16) + this[++offset] * Math.pow(2, 8) + last);\n });\n Buffer2.prototype.readFloatLE = function readFloatLE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754.read(this, offset, true, 23, 4);\n };\n Buffer2.prototype.readFloatBE = function readFloatBE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754.read(this, offset, false, 23, 4);\n };\n Buffer2.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754.read(this, offset, true, 52, 8);\n };\n Buffer2.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754.read(this, offset, false, 52, 8);\n };\n function checkInt(buf, value, offset, ext, max, min) {\n if (!Buffer2.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance');\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds');\n if (offset + ext > buf.length) throw new RangeError(\"Index out of range\");\n }\n Buffer2.prototype.writeUintLE = Buffer2.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength2) - 1;\n checkInt(this, value, offset, byteLength2, maxBytes, 0);\n }\n var mul = 1;\n var i = 0;\n this[offset] = value & 255;\n while (++i < byteLength2 && (mul *= 256)) {\n this[offset + i] = value / mul & 255;\n }\n return offset + byteLength2;\n };\n Buffer2.prototype.writeUintBE = Buffer2.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength2) - 1;\n checkInt(this, value, offset, byteLength2, maxBytes, 0);\n }\n var i = byteLength2 - 1;\n var mul = 1;\n this[offset + i] = value & 255;\n while (--i >= 0 && (mul *= 256)) {\n this[offset + i] = value / mul & 255;\n }\n return offset + byteLength2;\n };\n Buffer2.prototype.writeUint8 = Buffer2.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 1, 255, 0);\n this[offset] = value & 255;\n return offset + 1;\n };\n Buffer2.prototype.writeUint16LE = Buffer2.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n return offset + 2;\n };\n Buffer2.prototype.writeUint16BE = Buffer2.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);\n this[offset] = value >>> 8;\n this[offset + 1] = value & 255;\n return offset + 2;\n };\n Buffer2.prototype.writeUint32LE = Buffer2.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);\n this[offset + 3] = value >>> 24;\n this[offset + 2] = value >>> 16;\n this[offset + 1] = value >>> 8;\n this[offset] = value & 255;\n return offset + 4;\n };\n Buffer2.prototype.writeUint32BE = Buffer2.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);\n this[offset] = value >>> 24;\n this[offset + 1] = value >>> 16;\n this[offset + 2] = value >>> 8;\n this[offset + 3] = value & 255;\n return offset + 4;\n };\n function wrtBigUInt64LE(buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7);\n var lo = Number(value & BigInt(4294967295));\n buf[offset++] = lo;\n lo = lo >> 8;\n buf[offset++] = lo;\n lo = lo >> 8;\n buf[offset++] = lo;\n lo = lo >> 8;\n buf[offset++] = lo;\n var hi = Number(value >> BigInt(32) & BigInt(4294967295));\n buf[offset++] = hi;\n hi = hi >> 8;\n buf[offset++] = hi;\n hi = hi >> 8;\n buf[offset++] = hi;\n hi = hi >> 8;\n buf[offset++] = hi;\n return offset;\n }\n function wrtBigUInt64BE(buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7);\n var lo = Number(value & BigInt(4294967295));\n buf[offset + 7] = lo;\n lo = lo >> 8;\n buf[offset + 6] = lo;\n lo = lo >> 8;\n buf[offset + 5] = lo;\n lo = lo >> 8;\n buf[offset + 4] = lo;\n var hi = Number(value >> BigInt(32) & BigInt(4294967295));\n buf[offset + 3] = hi;\n hi = hi >> 8;\n buf[offset + 2] = hi;\n hi = hi >> 8;\n buf[offset + 1] = hi;\n hi = hi >> 8;\n buf[offset] = hi;\n return offset + 8;\n }\n Buffer2.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value) {\n var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt(\"0xffffffffffffffff\"));\n });\n Buffer2.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value) {\n var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt(\"0xffffffffffffffff\"));\n });\n Buffer2.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength2 - 1);\n checkInt(this, value, offset, byteLength2, limit - 1, -limit);\n }\n var i = 0;\n var mul = 1;\n var sub = 0;\n this[offset] = value & 255;\n while (++i < byteLength2 && (mul *= 256)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = (value / mul >> 0) - sub & 255;\n }\n return offset + byteLength2;\n };\n Buffer2.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength2 - 1);\n checkInt(this, value, offset, byteLength2, limit - 1, -limit);\n }\n var i = byteLength2 - 1;\n var mul = 1;\n var sub = 0;\n this[offset + i] = value & 255;\n while (--i >= 0 && (mul *= 256)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = (value / mul >> 0) - sub & 255;\n }\n return offset + byteLength2;\n };\n Buffer2.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 1, 127, -128);\n if (value < 0) value = 255 + value + 1;\n this[offset] = value & 255;\n return offset + 1;\n };\n Buffer2.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n return offset + 2;\n };\n Buffer2.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);\n this[offset] = value >>> 8;\n this[offset + 1] = value & 255;\n return offset + 2;\n };\n Buffer2.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n this[offset + 2] = value >>> 16;\n this[offset + 3] = value >>> 24;\n return offset + 4;\n };\n Buffer2.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);\n if (value < 0) value = 4294967295 + value + 1;\n this[offset] = value >>> 24;\n this[offset + 1] = value >>> 16;\n this[offset + 2] = value >>> 8;\n this[offset + 3] = value & 255;\n return offset + 4;\n };\n Buffer2.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value) {\n var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;\n return wrtBigUInt64LE(this, value, offset, -BigInt(\"0x8000000000000000\"), BigInt(\"0x7fffffffffffffff\"));\n });\n Buffer2.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value) {\n var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;\n return wrtBigUInt64BE(this, value, offset, -BigInt(\"0x8000000000000000\"), BigInt(\"0x7fffffffffffffff\"));\n });\n function checkIEEE754(buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError(\"Index out of range\");\n if (offset < 0) throw new RangeError(\"Index out of range\");\n }\n function writeFloat(buf, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 34028234663852886e22, -34028234663852886e22);\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4);\n return offset + 4;\n }\n Buffer2.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert);\n };\n Buffer2.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert);\n };\n function writeDouble(buf, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 17976931348623157e292, -17976931348623157e292);\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8);\n return offset + 8;\n }\n Buffer2.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert);\n };\n Buffer2.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert);\n };\n Buffer2.prototype.copy = function copy(target, targetStart, start, end) {\n if (!Buffer2.isBuffer(target)) throw new TypeError(\"argument should be a Buffer\");\n if (!start) start = 0;\n if (!end && end !== 0) end = this.length;\n if (targetStart >= target.length) targetStart = target.length;\n if (!targetStart) targetStart = 0;\n if (end > 0 && end < start) end = start;\n if (end === start) return 0;\n if (target.length === 0 || this.length === 0) return 0;\n if (targetStart < 0) {\n throw new RangeError(\"targetStart out of bounds\");\n }\n if (start < 0 || start >= this.length) throw new RangeError(\"Index out of range\");\n if (end < 0) throw new RangeError(\"sourceEnd out of bounds\");\n if (end > this.length) end = this.length;\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start;\n }\n var len = end - start;\n if (this === target && typeof Uint8Array.prototype.copyWithin === \"function\") {\n this.copyWithin(targetStart, start, end);\n } else {\n Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);\n }\n return len;\n };\n Buffer2.prototype.fill = function fill(val, start, end, encoding) {\n if (typeof val === \"string\") {\n if (typeof start === \"string\") {\n encoding = start;\n start = 0;\n end = this.length;\n } else if (typeof end === \"string\") {\n encoding = end;\n end = this.length;\n }\n if (encoding !== void 0 && typeof encoding !== \"string\") {\n throw new TypeError(\"encoding must be a string\");\n }\n if (typeof encoding === \"string\" && !Buffer2.isEncoding(encoding)) {\n throw new TypeError(\"Unknown encoding: \" + encoding);\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0);\n if (encoding === \"utf8\" && code < 128 || encoding === \"latin1\") {\n val = code;\n }\n }\n } else if (typeof val === \"number\") {\n val = val & 255;\n } else if (typeof val === \"boolean\") {\n val = Number(val);\n }\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError(\"Out of range index\");\n }\n if (end <= start) {\n return this;\n }\n start = start >>> 0;\n end = end === void 0 ? this.length : end >>> 0;\n if (!val) val = 0;\n var i;\n if (typeof val === \"number\") {\n for (i = start; i < end; ++i) {\n this[i] = val;\n }\n } else {\n var bytes = Buffer2.isBuffer(val) ? val : Buffer2.from(val, encoding);\n var len = bytes.length;\n if (len === 0) {\n throw new TypeError('The value \"' + val + '\" is invalid for argument \"value\"');\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len];\n }\n }\n return this;\n };\n var errors = {};\n function E2(sym, getMessage, Base) {\n errors[sym] = /* @__PURE__ */ function(_Base) {\n function NodeError() {\n var _this;\n _classCallCheck(this, NodeError);\n _this = _callSuper(this, NodeError);\n Object.defineProperty(_this, \"message\", {\n value: getMessage.apply(_this, arguments),\n writable: true,\n configurable: true\n });\n _this.name = \"\".concat(_this.name, \" [\").concat(sym, \"]\");\n _this.stack;\n delete _this.name;\n return _this;\n }\n _inherits(NodeError, _Base);\n return _createClass(NodeError, [{\n key: \"code\",\n get: function get() {\n return sym;\n },\n set: function set(value) {\n Object.defineProperty(this, \"code\", {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n });\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return \"\".concat(this.name, \" [\").concat(sym, \"]: \").concat(this.message);\n }\n }]);\n }(Base);\n }\n E2(\"ERR_BUFFER_OUT_OF_BOUNDS\", function(name2) {\n if (name2) {\n return \"\".concat(name2, \" is outside of buffer bounds\");\n }\n return \"Attempt to access memory outside buffer bounds\";\n }, RangeError);\n E2(\"ERR_INVALID_ARG_TYPE\", function(name2, actual) {\n return 'The \"'.concat(name2, '\" argument must be of type number. Received type ').concat(_typeof(actual));\n }, TypeError);\n E2(\"ERR_OUT_OF_RANGE\", function(str, range, input) {\n var msg = 'The value of \"'.concat(str, '\" is out of range.');\n var received = input;\n if (Number.isInteger(input) && Math.abs(input) > Math.pow(2, 32)) {\n received = addNumericalSeparator(String(input));\n } else if (typeof input === \"bigint\") {\n received = String(input);\n if (input > Math.pow(BigInt(2), BigInt(32)) || input < -Math.pow(BigInt(2), BigInt(32))) {\n received = addNumericalSeparator(received);\n }\n received += \"n\";\n }\n msg += \" It must be \".concat(range, \". Received \").concat(received);\n return msg;\n }, RangeError);\n function addNumericalSeparator(val) {\n var res = \"\";\n var i = val.length;\n var start = val[0] === \"-\" ? 1 : 0;\n for (; i >= start + 4; i -= 3) {\n res = \"_\".concat(val.slice(i - 3, i)).concat(res);\n }\n return \"\".concat(val.slice(0, i)).concat(res);\n }\n function checkBounds(buf, offset, byteLength2) {\n validateNumber(offset, \"offset\");\n if (buf[offset] === void 0 || buf[offset + byteLength2] === void 0) {\n boundsError(offset, buf.length - (byteLength2 + 1));\n }\n }\n function checkIntBI(value, min, max, buf, offset, byteLength2) {\n if (value > max || value < min) {\n var n = typeof min === \"bigint\" ? \"n\" : \"\";\n var range;\n if (byteLength2 > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = \">= 0\".concat(n, \" and < 2\").concat(n, \" ** \").concat((byteLength2 + 1) * 8).concat(n);\n } else {\n range = \">= -(2\".concat(n, \" ** \").concat((byteLength2 + 1) * 8 - 1).concat(n, \") and < 2 ** \") + \"\".concat((byteLength2 + 1) * 8 - 1).concat(n);\n }\n } else {\n range = \">= \".concat(min).concat(n, \" and <= \").concat(max).concat(n);\n }\n throw new errors.ERR_OUT_OF_RANGE(\"value\", range, value);\n }\n checkBounds(buf, offset, byteLength2);\n }\n function validateNumber(value, name2) {\n if (typeof value !== \"number\") {\n throw new errors.ERR_INVALID_ARG_TYPE(name2, \"number\", value);\n }\n }\n function boundsError(value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type);\n throw new errors.ERR_OUT_OF_RANGE(type || \"offset\", \"an integer\", value);\n }\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS();\n }\n throw new errors.ERR_OUT_OF_RANGE(type || \"offset\", \">= \".concat(type ? 1 : 0, \" and <= \").concat(length), value);\n }\n var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;\n function base64clean(str) {\n str = str.split(\"=\")[0];\n str = str.trim().replace(INVALID_BASE64_RE, \"\");\n if (str.length < 2) return \"\";\n while (str.length % 4 !== 0) {\n str = str + \"=\";\n }\n return str;\n }\n function utf8ToBytes(string, units) {\n units = units || Infinity;\n var codePoint;\n var length = string.length;\n var leadSurrogate = null;\n var bytes = [];\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i);\n if (codePoint > 55295 && codePoint < 57344) {\n if (!leadSurrogate) {\n if (codePoint > 56319) {\n if ((units -= 3) > -1) bytes.push(239, 191, 189);\n continue;\n } else if (i + 1 === length) {\n if ((units -= 3) > -1) bytes.push(239, 191, 189);\n continue;\n }\n leadSurrogate = codePoint;\n continue;\n }\n if (codePoint < 56320) {\n if ((units -= 3) > -1) bytes.push(239, 191, 189);\n leadSurrogate = codePoint;\n continue;\n }\n codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;\n } else if (leadSurrogate) {\n if ((units -= 3) > -1) bytes.push(239, 191, 189);\n }\n leadSurrogate = null;\n if (codePoint < 128) {\n if ((units -= 1) < 0) break;\n bytes.push(codePoint);\n } else if (codePoint < 2048) {\n if ((units -= 2) < 0) break;\n bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);\n } else if (codePoint < 65536) {\n if ((units -= 3) < 0) break;\n bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);\n } else if (codePoint < 1114112) {\n if ((units -= 4) < 0) break;\n bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);\n } else {\n throw new Error(\"Invalid code point\");\n }\n }\n return bytes;\n }\n function asciiToBytes(str) {\n var byteArray = [];\n for (var i = 0; i < str.length; ++i) {\n byteArray.push(str.charCodeAt(i) & 255);\n }\n return byteArray;\n }\n function utf16leToBytes(str, units) {\n var c, hi, lo;\n var byteArray = [];\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break;\n c = str.charCodeAt(i);\n hi = c >> 8;\n lo = c % 256;\n byteArray.push(lo);\n byteArray.push(hi);\n }\n return byteArray;\n }\n function base64ToBytes(str) {\n return base64.toByteArray(base64clean(str));\n }\n function blitBuffer(src, dst, offset, length) {\n var i;\n for (i = 0; i < length; ++i) {\n if (i + offset >= dst.length || i >= src.length) break;\n dst[i + offset] = src[i];\n }\n return i;\n }\n function isInstance(obj, type) {\n return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;\n }\n function numberIsNaN(obj) {\n return obj !== obj;\n }\n var hexSliceLookupTable = function() {\n var alphabet = \"0123456789abcdef\";\n var table = new Array(256);\n for (var i = 0; i < 16; ++i) {\n var i16 = i * 16;\n for (var j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j];\n }\n }\n return table;\n }();\n function defineBigIntMethod(fn) {\n return typeof BigInt === \"undefined\" ? BufferBigIntNotDefined : fn;\n }\n function BufferBigIntNotDefined() {\n throw new Error(\"BigInt not supported\");\n }\n }\n ),\n /***/\n 9216: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = isMobile;\n module2.exports.isMobile = isMobile;\n module2.exports[\"default\"] = isMobile;\n var mobileRE = /(android|bb\\d+|meego).+mobile|armv7l|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i;\n var notMobileRE = /CrOS/;\n var tabletRE = /android|ipad|playbook|silk/i;\n function isMobile(opts) {\n if (!opts) opts = {};\n var ua = opts.ua;\n if (!ua && typeof navigator !== \"undefined\") ua = navigator.userAgent;\n if (ua && ua.headers && typeof ua.headers[\"user-agent\"] === \"string\") {\n ua = ua.headers[\"user-agent\"];\n }\n if (typeof ua !== \"string\") return false;\n var result = mobileRE.test(ua) && !notMobileRE.test(ua) || !!opts.tablet && tabletRE.test(ua);\n if (!result && opts.tablet && opts.featureDetect && navigator && navigator.maxTouchPoints > 1 && ua.indexOf(\"Macintosh\") !== -1 && ua.indexOf(\"Safari\") !== -1) {\n result = true;\n }\n return result;\n }\n }\n ),\n /***/\n 6296: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = createViewController;\n var createTurntable = __webpack_require__2(7261);\n var createOrbit = __webpack_require__2(9977);\n var createMatrix = __webpack_require__2(1811);\n function ViewController(controllers, mode) {\n this._controllerNames = Object.keys(controllers);\n this._controllerList = this._controllerNames.map(function(n) {\n return controllers[n];\n });\n this._mode = mode;\n this._active = controllers[mode];\n if (!this._active) {\n this._mode = \"turntable\";\n this._active = controllers.turntable;\n }\n this.modes = this._controllerNames;\n this.computedMatrix = this._active.computedMatrix;\n this.computedEye = this._active.computedEye;\n this.computedUp = this._active.computedUp;\n this.computedCenter = this._active.computedCenter;\n this.computedRadius = this._active.computedRadius;\n }\n var proto = ViewController.prototype;\n proto.flush = function(a0) {\n var cc = this._controllerList;\n for (var i = 0; i < cc.length; ++i) {\n cc[i].flush(a0);\n }\n };\n proto.idle = function(a0) {\n var cc = this._controllerList;\n for (var i = 0; i < cc.length; ++i) {\n cc[i].idle(a0);\n }\n };\n proto.lookAt = function(a0, a1, a2, a3) {\n var cc = this._controllerList;\n for (var i = 0; i < cc.length; ++i) {\n cc[i].lookAt(a0, a1, a2, a3);\n }\n };\n proto.rotate = function(a0, a1, a2, a3) {\n var cc = this._controllerList;\n for (var i = 0; i < cc.length; ++i) {\n cc[i].rotate(a0, a1, a2, a3);\n }\n };\n proto.pan = function(a0, a1, a2, a3) {\n var cc = this._controllerList;\n for (var i = 0; i < cc.length; ++i) {\n cc[i].pan(a0, a1, a2, a3);\n }\n };\n proto.translate = function(a0, a1, a2, a3) {\n var cc = this._controllerList;\n for (var i = 0; i < cc.length; ++i) {\n cc[i].translate(a0, a1, a2, a3);\n }\n };\n proto.setMatrix = function(a0, a1) {\n var cc = this._controllerList;\n for (var i = 0; i < cc.length; ++i) {\n cc[i].setMatrix(a0, a1);\n }\n };\n proto.setDistanceLimits = function(a0, a1) {\n var cc = this._controllerList;\n for (var i = 0; i < cc.length; ++i) {\n cc[i].setDistanceLimits(a0, a1);\n }\n };\n proto.setDistance = function(a0, a1) {\n var cc = this._controllerList;\n for (var i = 0; i < cc.length; ++i) {\n cc[i].setDistance(a0, a1);\n }\n };\n proto.recalcMatrix = function(t) {\n this._active.recalcMatrix(t);\n };\n proto.getDistance = function(t) {\n return this._active.getDistance(t);\n };\n proto.getDistanceLimits = function(out) {\n return this._active.getDistanceLimits(out);\n };\n proto.lastT = function() {\n return this._active.lastT();\n };\n proto.setMode = function(mode) {\n if (mode === this._mode) {\n return;\n }\n var idx = this._controllerNames.indexOf(mode);\n if (idx < 0) {\n return;\n }\n var prev = this._active;\n var next = this._controllerList[idx];\n var lastT = Math.max(prev.lastT(), next.lastT());\n prev.recalcMatrix(lastT);\n next.setMatrix(lastT, prev.computedMatrix);\n this._active = next;\n this._mode = mode;\n this.computedMatrix = this._active.computedMatrix;\n this.computedEye = this._active.computedEye;\n this.computedUp = this._active.computedUp;\n this.computedCenter = this._active.computedCenter;\n this.computedRadius = this._active.computedRadius;\n };\n proto.getMode = function() {\n return this._mode;\n };\n function createViewController(options) {\n options = options || {};\n var eye = options.eye || [0, 0, 1];\n var center = options.center || [0, 0, 0];\n var up = options.up || [0, 1, 0];\n var limits = options.distanceLimits || [0, Infinity];\n var mode = options.mode || \"turntable\";\n var turntable = createTurntable();\n var orbit = createOrbit();\n var matrix = createMatrix();\n turntable.setDistanceLimits(limits[0], limits[1]);\n turntable.lookAt(0, eye, center, up);\n orbit.setDistanceLimits(limits[0], limits[1]);\n orbit.lookAt(0, eye, center, up);\n matrix.setDistanceLimits(limits[0], limits[1]);\n matrix.lookAt(0, eye, center, up);\n return new ViewController({\n turntable,\n orbit,\n matrix\n }, mode);\n }\n }\n ),\n /***/\n 7169: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var weakMap = typeof WeakMap === \"undefined\" ? __webpack_require__2(1538) : WeakMap;\n var createBuffer = __webpack_require__2(2762);\n var createVAO = __webpack_require__2(8116);\n var TriangleCache = new weakMap();\n function createABigTriangle(gl2) {\n var triangleVAO = TriangleCache.get(gl2);\n var handle = triangleVAO && (triangleVAO._triangleBuffer.handle || triangleVAO._triangleBuffer.buffer);\n if (!handle || !gl2.isBuffer(handle)) {\n var buf = createBuffer(gl2, new Float32Array([-1, -1, -1, 4, 4, -1]));\n triangleVAO = createVAO(gl2, [\n {\n buffer: buf,\n type: gl2.FLOAT,\n size: 2\n }\n ]);\n triangleVAO._triangleBuffer = buf;\n TriangleCache.set(gl2, triangleVAO);\n }\n triangleVAO.bind();\n gl2.drawArrays(gl2.TRIANGLES, 0, 3);\n triangleVAO.unbind();\n }\n module2.exports = createABigTriangle;\n }\n ),\n /***/\n 1085: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n var padLeft = __webpack_require__2(1371);\n module2.exports = addLineNumbers;\n function addLineNumbers(string, start, delim) {\n start = typeof start === \"number\" ? start : 1;\n delim = delim || \": \";\n var lines = string.split(/\\r?\\n/);\n var totalDigits = String(lines.length + start - 1).length;\n return lines.map(function(line, i) {\n var c = i + start;\n var digits = String(c).length;\n var prefix = padLeft(c, totalDigits - digits);\n return prefix + delim + line;\n }).join(\"\\n\");\n }\n }\n ),\n /***/\n 3952: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = affineHull;\n var orient = __webpack_require__2(3250);\n function linearlyIndependent(points, d) {\n var nhull = new Array(d + 1);\n for (var i = 0; i < points.length; ++i) {\n nhull[i] = points[i];\n }\n for (var i = 0; i <= points.length; ++i) {\n for (var j = points.length; j <= d; ++j) {\n var x = new Array(d);\n for (var k = 0; k < d; ++k) {\n x[k] = Math.pow(j + 1 - i, k);\n }\n nhull[j] = x;\n }\n var o = orient.apply(void 0, nhull);\n if (o) {\n return true;\n }\n }\n return false;\n }\n function affineHull(points) {\n var n = points.length;\n if (n === 0) {\n return [];\n }\n if (n === 1) {\n return [0];\n }\n var d = points[0].length;\n var frame = [points[0]];\n var index = [0];\n for (var i = 1; i < n; ++i) {\n frame.push(points[i]);\n if (!linearlyIndependent(frame, d)) {\n frame.pop();\n continue;\n }\n index.push(i);\n if (index.length === d + 1) {\n return index;\n }\n }\n return index;\n }\n }\n ),\n /***/\n 5995: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = alphaComplex;\n var delaunay = __webpack_require__2(7642);\n var circumradius = __webpack_require__2(6037);\n function alphaComplex(alpha, points) {\n return delaunay(points).filter(function(cell) {\n var simplex = new Array(cell.length);\n for (var i = 0; i < cell.length; ++i) {\n simplex[i] = points[cell[i]];\n }\n return circumradius(simplex) * alpha < 1;\n });\n }\n }\n ),\n /***/\n 3502: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = alphaShape;\n var ac = __webpack_require__2(5995);\n var bnd = __webpack_require__2(9127);\n function alphaShape(alpha, points) {\n return bnd(ac(alpha, points));\n }\n }\n ),\n /***/\n 6468: (\n /***/\n function(module2) {\n module2.exports = function _atob(str) {\n return atob(str);\n };\n }\n ),\n /***/\n 2642: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = barycentric;\n var solve = __webpack_require__2(727);\n function reduce(x) {\n var r = 0;\n for (var i = 0; i < x.length; ++i) {\n r += x[i];\n }\n return r;\n }\n function barycentric(simplex, point) {\n var d = point.length;\n var A2 = new Array(d + 1);\n for (var i = 0; i < d; ++i) {\n var row = new Array(d + 1);\n for (var j = 0; j <= d; ++j) {\n row[j] = simplex[j][i];\n }\n A2[i] = row;\n }\n A2[d] = new Array(d + 1);\n for (var i = 0; i <= d; ++i) {\n A2[d][i] = 1;\n }\n var b = new Array(d + 1);\n for (var i = 0; i < d; ++i) {\n b[i] = point[i];\n }\n b[d] = 1;\n var x = solve(A2, b);\n var w = reduce(x[d + 1]);\n if (w === 0) {\n w = 1;\n }\n var y = new Array(d + 1);\n for (var i = 0; i <= d; ++i) {\n y[i] = reduce(x[i]) / w;\n }\n return y;\n }\n }\n ),\n /***/\n 7507: (\n /***/\n function(__unused_webpack_module, exports2) {\n \"use strict\";\n exports2.byteLength = byteLength;\n exports2.toByteArray = toByteArray;\n exports2.fromByteArray = fromByteArray;\n var lookup = [];\n var revLookup = [];\n var Arr = typeof Uint8Array !== \"undefined\" ? Uint8Array : Array;\n var code = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n for (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i];\n revLookup[code.charCodeAt(i)] = i;\n }\n revLookup[\"-\".charCodeAt(0)] = 62;\n revLookup[\"_\".charCodeAt(0)] = 63;\n function getLens(b64) {\n var len2 = b64.length;\n if (len2 % 4 > 0) {\n throw new Error(\"Invalid string. Length must be a multiple of 4\");\n }\n var validLen = b64.indexOf(\"=\");\n if (validLen === -1) validLen = len2;\n var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;\n return [validLen, placeHoldersLen];\n }\n function byteLength(b64) {\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n }\n function _byteLength(b64, validLen, placeHoldersLen) {\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n }\n function toByteArray(b64) {\n var tmp;\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));\n var curByte = 0;\n var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;\n var i2;\n for (i2 = 0; i2 < len2; i2 += 4) {\n tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)];\n arr[curByte++] = tmp >> 16 & 255;\n arr[curByte++] = tmp >> 8 & 255;\n arr[curByte++] = tmp & 255;\n }\n if (placeHoldersLen === 2) {\n tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4;\n arr[curByte++] = tmp & 255;\n }\n if (placeHoldersLen === 1) {\n tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2;\n arr[curByte++] = tmp >> 8 & 255;\n arr[curByte++] = tmp & 255;\n }\n return arr;\n }\n function tripletToBase64(num) {\n return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];\n }\n function encodeChunk(uint8, start, end) {\n var tmp;\n var output = [];\n for (var i2 = start; i2 < end; i2 += 3) {\n tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);\n output.push(tripletToBase64(tmp));\n }\n return output.join(\"\");\n }\n function fromByteArray(uint8) {\n var tmp;\n var len2 = uint8.length;\n var extraBytes = len2 % 3;\n var parts = [];\n var maxChunkLength = 16383;\n for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) {\n parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength));\n }\n if (extraBytes === 1) {\n tmp = uint8[len2 - 1];\n parts.push(\n lookup[tmp >> 2] + lookup[tmp << 4 & 63] + \"==\"\n );\n } else if (extraBytes === 2) {\n tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];\n parts.push(\n lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + \"=\"\n );\n }\n return parts.join(\"\");\n }\n }\n ),\n /***/\n 3865: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var rationalize = __webpack_require__2(869);\n module2.exports = add;\n function add(a, b) {\n return rationalize(\n a[0].mul(b[1]).add(b[0].mul(a[1])),\n a[1].mul(b[1])\n );\n }\n }\n ),\n /***/\n 1318: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = cmp;\n function cmp(a, b) {\n return a[0].mul(b[1]).cmp(b[0].mul(a[1]));\n }\n }\n ),\n /***/\n 8697: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var rationalize = __webpack_require__2(869);\n module2.exports = div;\n function div(a, b) {\n return rationalize(a[0].mul(b[1]), a[1].mul(b[0]));\n }\n }\n ),\n /***/\n 7842: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var isRat = __webpack_require__2(6330);\n var isBN = __webpack_require__2(1533);\n var num2bn = __webpack_require__2(2651);\n var str2bn = __webpack_require__2(6768);\n var rationalize = __webpack_require__2(869);\n var div = __webpack_require__2(8697);\n module2.exports = makeRational;\n function makeRational(numer, denom) {\n if (isRat(numer)) {\n if (denom) {\n return div(numer, makeRational(denom));\n }\n return [numer[0].clone(), numer[1].clone()];\n }\n var shift = 0;\n var a, b;\n if (isBN(numer)) {\n a = numer.clone();\n } else if (typeof numer === \"string\") {\n a = str2bn(numer);\n } else if (numer === 0) {\n return [num2bn(0), num2bn(1)];\n } else if (numer === Math.floor(numer)) {\n a = num2bn(numer);\n } else {\n while (numer !== Math.floor(numer)) {\n numer = numer * Math.pow(2, 256);\n shift -= 256;\n }\n a = num2bn(numer);\n }\n if (isRat(denom)) {\n a.mul(denom[1]);\n b = denom[0].clone();\n } else if (isBN(denom)) {\n b = denom.clone();\n } else if (typeof denom === \"string\") {\n b = str2bn(denom);\n } else if (!denom) {\n b = num2bn(1);\n } else if (denom === Math.floor(denom)) {\n b = num2bn(denom);\n } else {\n while (denom !== Math.floor(denom)) {\n denom = denom * Math.pow(2, 256);\n shift += 256;\n }\n b = num2bn(denom);\n }\n if (shift > 0) {\n a = a.ushln(shift);\n } else if (shift < 0) {\n b = b.ushln(-shift);\n }\n return rationalize(a, b);\n }\n }\n ),\n /***/\n 6330: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var isBN = __webpack_require__2(1533);\n module2.exports = isRat;\n function isRat(x) {\n return Array.isArray(x) && x.length === 2 && isBN(x[0]) && isBN(x[1]);\n }\n }\n ),\n /***/\n 5716: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var BN = __webpack_require__2(6859);\n module2.exports = sign;\n function sign(x) {\n return x.cmp(new BN(0));\n }\n }\n ),\n /***/\n 1369: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var sign = __webpack_require__2(5716);\n module2.exports = bn2num;\n function bn2num(b) {\n var l = b.length;\n var words = b.words;\n var out = 0;\n if (l === 1) {\n out = words[0];\n } else if (l === 2) {\n out = words[0] + words[1] * 67108864;\n } else {\n for (var i = 0; i < l; i++) {\n var w = words[i];\n out += w * Math.pow(67108864, i);\n }\n }\n return sign(b) * out;\n }\n }\n ),\n /***/\n 4025: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var db = __webpack_require__2(2361);\n var ctz = __webpack_require__2(8828).countTrailingZeros;\n module2.exports = ctzNumber;\n function ctzNumber(x) {\n var l = ctz(db.lo(x));\n if (l < 32) {\n return l;\n }\n var h = ctz(db.hi(x));\n if (h > 20) {\n return 52;\n }\n return h + 32;\n }\n }\n ),\n /***/\n 1533: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var BN = __webpack_require__2(6859);\n module2.exports = isBN;\n function isBN(x) {\n return x && typeof x === \"object\" && Boolean(x.words);\n }\n }\n ),\n /***/\n 2651: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var BN = __webpack_require__2(6859);\n var db = __webpack_require__2(2361);\n module2.exports = num2bn;\n function num2bn(x) {\n var e = db.exponent(x);\n if (e < 52) {\n return new BN(x);\n } else {\n return new BN(x * Math.pow(2, 52 - e)).ushln(e - 52);\n }\n }\n }\n ),\n /***/\n 869: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var num2bn = __webpack_require__2(2651);\n var sign = __webpack_require__2(5716);\n module2.exports = rationalize;\n function rationalize(numer, denom) {\n var snumer = sign(numer);\n var sdenom = sign(denom);\n if (snumer === 0) {\n return [num2bn(0), num2bn(1)];\n }\n if (sdenom === 0) {\n return [num2bn(0), num2bn(0)];\n }\n if (sdenom < 0) {\n numer = numer.neg();\n denom = denom.neg();\n }\n var d = numer.gcd(denom);\n if (d.cmpn(1)) {\n return [numer.div(d), denom.div(d)];\n }\n return [numer, denom];\n }\n }\n ),\n /***/\n 6768: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var BN = __webpack_require__2(6859);\n module2.exports = str2BN;\n function str2BN(x) {\n return new BN(x);\n }\n }\n ),\n /***/\n 6504: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var rationalize = __webpack_require__2(869);\n module2.exports = mul;\n function mul(a, b) {\n return rationalize(a[0].mul(b[0]), a[1].mul(b[1]));\n }\n }\n ),\n /***/\n 7721: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var bnsign = __webpack_require__2(5716);\n module2.exports = sign;\n function sign(x) {\n return bnsign(x[0]) * bnsign(x[1]);\n }\n }\n ),\n /***/\n 5572: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var rationalize = __webpack_require__2(869);\n module2.exports = sub;\n function sub(a, b) {\n return rationalize(a[0].mul(b[1]).sub(a[1].mul(b[0])), a[1].mul(b[1]));\n }\n }\n ),\n /***/\n 946: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var bn2num = __webpack_require__2(1369);\n var ctz = __webpack_require__2(4025);\n module2.exports = roundRat;\n function roundRat(f) {\n var a = f[0];\n var b = f[1];\n if (a.cmpn(0) === 0) {\n return 0;\n }\n var h = a.abs().divmod(b.abs());\n var iv = h.div;\n var x = bn2num(iv);\n var ir = h.mod;\n var sgn = a.negative !== b.negative ? -1 : 1;\n if (ir.cmpn(0) === 0) {\n return sgn * x;\n }\n if (x) {\n var s = ctz(x) + 4;\n var y = bn2num(ir.ushln(s).divRound(b));\n return sgn * (x + y * Math.pow(2, -s));\n } else {\n var ybits = b.bitLength() - ir.bitLength() + 53;\n var y = bn2num(ir.ushln(ybits).divRound(b));\n if (ybits < 1023) {\n return sgn * y * Math.pow(2, -ybits);\n }\n y *= Math.pow(2, -1023);\n return sgn * y * Math.pow(2, 1023 - ybits);\n }\n }\n }\n ),\n /***/\n 2478: (\n /***/\n function(module2) {\n \"use strict\";\n function ge(a, y, c, l, h) {\n var i = h + 1;\n while (l <= h) {\n var m = l + h >>> 1, x = a[m];\n var p = c !== void 0 ? c(x, y) : x - y;\n if (p >= 0) {\n i = m;\n h = m - 1;\n } else {\n l = m + 1;\n }\n }\n return i;\n }\n ;\n function gt(a, y, c, l, h) {\n var i = h + 1;\n while (l <= h) {\n var m = l + h >>> 1, x = a[m];\n var p = c !== void 0 ? c(x, y) : x - y;\n if (p > 0) {\n i = m;\n h = m - 1;\n } else {\n l = m + 1;\n }\n }\n return i;\n }\n ;\n function lt(a, y, c, l, h) {\n var i = l - 1;\n while (l <= h) {\n var m = l + h >>> 1, x = a[m];\n var p = c !== void 0 ? c(x, y) : x - y;\n if (p < 0) {\n i = m;\n l = m + 1;\n } else {\n h = m - 1;\n }\n }\n return i;\n }\n ;\n function le(a, y, c, l, h) {\n var i = l - 1;\n while (l <= h) {\n var m = l + h >>> 1, x = a[m];\n var p = c !== void 0 ? c(x, y) : x - y;\n if (p <= 0) {\n i = m;\n l = m + 1;\n } else {\n h = m - 1;\n }\n }\n return i;\n }\n ;\n function eq(a, y, c, l, h) {\n while (l <= h) {\n var m = l + h >>> 1, x = a[m];\n var p = c !== void 0 ? c(x, y) : x - y;\n if (p === 0) {\n return m;\n }\n if (p <= 0) {\n l = m + 1;\n } else {\n h = m - 1;\n }\n }\n return -1;\n }\n ;\n function norm(a, y, c, l, h, f) {\n if (typeof c === \"function\") {\n return f(a, y, c, l === void 0 ? 0 : l | 0, h === void 0 ? a.length - 1 : h | 0);\n }\n return f(a, y, void 0, c === void 0 ? 0 : c | 0, l === void 0 ? a.length - 1 : l | 0);\n }\n module2.exports = {\n ge: function(a, y, c, l, h) {\n return norm(a, y, c, l, h, ge);\n },\n gt: function(a, y, c, l, h) {\n return norm(a, y, c, l, h, gt);\n },\n lt: function(a, y, c, l, h) {\n return norm(a, y, c, l, h, lt);\n },\n le: function(a, y, c, l, h) {\n return norm(a, y, c, l, h, le);\n },\n eq: function(a, y, c, l, h) {\n return norm(a, y, c, l, h, eq);\n }\n };\n }\n ),\n /***/\n 8828: (\n /***/\n function(__unused_webpack_module, exports2) {\n \"use strict\";\n \"use restrict\";\n var INT_BITS = 32;\n exports2.INT_BITS = INT_BITS;\n exports2.INT_MAX = 2147483647;\n exports2.INT_MIN = -1 << INT_BITS - 1;\n exports2.sign = function(v) {\n return (v > 0) - (v < 0);\n };\n exports2.abs = function(v) {\n var mask = v >> INT_BITS - 1;\n return (v ^ mask) - mask;\n };\n exports2.min = function(x, y) {\n return y ^ (x ^ y) & -(x < y);\n };\n exports2.max = function(x, y) {\n return x ^ (x ^ y) & -(x < y);\n };\n exports2.isPow2 = function(v) {\n return !(v & v - 1) && !!v;\n };\n exports2.log2 = function(v) {\n var r, shift;\n r = (v > 65535) << 4;\n v >>>= r;\n shift = (v > 255) << 3;\n v >>>= shift;\n r |= shift;\n shift = (v > 15) << 2;\n v >>>= shift;\n r |= shift;\n shift = (v > 3) << 1;\n v >>>= shift;\n r |= shift;\n return r | v >> 1;\n };\n exports2.log10 = function(v) {\n return v >= 1e9 ? 9 : v >= 1e8 ? 8 : v >= 1e7 ? 7 : v >= 1e6 ? 6 : v >= 1e5 ? 5 : v >= 1e4 ? 4 : v >= 1e3 ? 3 : v >= 100 ? 2 : v >= 10 ? 1 : 0;\n };\n exports2.popCount = function(v) {\n v = v - (v >>> 1 & 1431655765);\n v = (v & 858993459) + (v >>> 2 & 858993459);\n return (v + (v >>> 4) & 252645135) * 16843009 >>> 24;\n };\n function countTrailingZeros(v) {\n var c = 32;\n v &= -v;\n if (v) c--;\n if (v & 65535) c -= 16;\n if (v & 16711935) c -= 8;\n if (v & 252645135) c -= 4;\n if (v & 858993459) c -= 2;\n if (v & 1431655765) c -= 1;\n return c;\n }\n exports2.countTrailingZeros = countTrailingZeros;\n exports2.nextPow2 = function(v) {\n v += v === 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n return v + 1;\n };\n exports2.prevPow2 = function(v) {\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n return v - (v >>> 1);\n };\n exports2.parity = function(v) {\n v ^= v >>> 16;\n v ^= v >>> 8;\n v ^= v >>> 4;\n v &= 15;\n return 27030 >>> v & 1;\n };\n var REVERSE_TABLE = new Array(256);\n (function(tab) {\n for (var i = 0; i < 256; ++i) {\n var v = i, r = i, s = 7;\n for (v >>>= 1; v; v >>>= 1) {\n r <<= 1;\n r |= v & 1;\n --s;\n }\n tab[i] = r << s & 255;\n }\n })(REVERSE_TABLE);\n exports2.reverse = function(v) {\n return REVERSE_TABLE[v & 255] << 24 | REVERSE_TABLE[v >>> 8 & 255] << 16 | REVERSE_TABLE[v >>> 16 & 255] << 8 | REVERSE_TABLE[v >>> 24 & 255];\n };\n exports2.interleave2 = function(x, y) {\n x &= 65535;\n x = (x | x << 8) & 16711935;\n x = (x | x << 4) & 252645135;\n x = (x | x << 2) & 858993459;\n x = (x | x << 1) & 1431655765;\n y &= 65535;\n y = (y | y << 8) & 16711935;\n y = (y | y << 4) & 252645135;\n y = (y | y << 2) & 858993459;\n y = (y | y << 1) & 1431655765;\n return x | y << 1;\n };\n exports2.deinterleave2 = function(v, n) {\n v = v >>> n & 1431655765;\n v = (v | v >>> 1) & 858993459;\n v = (v | v >>> 2) & 252645135;\n v = (v | v >>> 4) & 16711935;\n v = (v | v >>> 16) & 65535;\n return v << 16 >> 16;\n };\n exports2.interleave3 = function(x, y, z) {\n x &= 1023;\n x = (x | x << 16) & 4278190335;\n x = (x | x << 8) & 251719695;\n x = (x | x << 4) & 3272356035;\n x = (x | x << 2) & 1227133513;\n y &= 1023;\n y = (y | y << 16) & 4278190335;\n y = (y | y << 8) & 251719695;\n y = (y | y << 4) & 3272356035;\n y = (y | y << 2) & 1227133513;\n x |= y << 1;\n z &= 1023;\n z = (z | z << 16) & 4278190335;\n z = (z | z << 8) & 251719695;\n z = (z | z << 4) & 3272356035;\n z = (z | z << 2) & 1227133513;\n return x | z << 2;\n };\n exports2.deinterleave3 = function(v, n) {\n v = v >>> n & 1227133513;\n v = (v | v >>> 2) & 3272356035;\n v = (v | v >>> 4) & 251719695;\n v = (v | v >>> 8) & 4278190335;\n v = (v | v >>> 16) & 1023;\n return v << 22 >> 22;\n };\n exports2.nextCombination = function(v) {\n var t = v | v - 1;\n return t + 1 | (~t & -~t) - 1 >>> countTrailingZeros(v) + 1;\n };\n }\n ),\n /***/\n 6859: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2 = __webpack_require__2.nmd(module2);\n (function(module3, exports2) {\n \"use strict\";\n function assert(val, msg) {\n if (!val) throw new Error(msg || \"Assertion failed\");\n }\n function inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function() {\n };\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n function BN(number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n this.negative = 0;\n this.words = null;\n this.length = 0;\n this.red = null;\n if (number !== null) {\n if (base === \"le\" || base === \"be\") {\n endian = base;\n base = 10;\n }\n this._init(number || 0, base || 10, endian || \"be\");\n }\n }\n if (typeof module3 === \"object\") {\n module3.exports = BN;\n } else {\n exports2.BN = BN;\n }\n BN.BN = BN;\n BN.wordSize = 26;\n var Buffer2;\n try {\n if (typeof window !== \"undefined\" && typeof window.Buffer !== \"undefined\") {\n Buffer2 = window.Buffer;\n } else {\n Buffer2 = __webpack_require__2(7790).Buffer;\n }\n } catch (e) {\n }\n BN.isBN = function isBN(num) {\n if (num instanceof BN) {\n return true;\n }\n return num !== null && typeof num === \"object\" && num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n BN.max = function max(left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n BN.min = function min(left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n BN.prototype._init = function init(number, base, endian) {\n if (typeof number === \"number\") {\n return this._initNumber(number, base, endian);\n }\n if (typeof number === \"object\") {\n return this._initArray(number, base, endian);\n }\n if (base === \"hex\") {\n base = 16;\n }\n assert(base === (base | 0) && base >= 2 && base <= 36);\n number = number.toString().replace(/\\s+/g, \"\");\n var start = 0;\n if (number[0] === \"-\") {\n start++;\n this.negative = 1;\n }\n if (start < number.length) {\n if (base === 16) {\n this._parseHex(number, start, endian);\n } else {\n this._parseBase(number, base, start);\n if (endian === \"le\") {\n this._initArray(this.toArray(), base, endian);\n }\n }\n }\n };\n BN.prototype._initNumber = function _initNumber(number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n if (number < 67108864) {\n this.words = [number & 67108863];\n this.length = 1;\n } else if (number < 4503599627370496) {\n this.words = [\n number & 67108863,\n number / 67108864 & 67108863\n ];\n this.length = 2;\n } else {\n assert(number < 9007199254740992);\n this.words = [\n number & 67108863,\n number / 67108864 & 67108863,\n 1\n ];\n this.length = 3;\n }\n if (endian !== \"le\") return;\n this._initArray(this.toArray(), base, endian);\n };\n BN.prototype._initArray = function _initArray(number, base, endian) {\n assert(typeof number.length === \"number\");\n if (number.length <= 0) {\n this.words = [0];\n this.length = 1;\n return this;\n }\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n var j, w;\n var off = 0;\n if (endian === \"be\") {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | number[i - 1] << 8 | number[i - 2] << 16;\n this.words[j] |= w << off & 67108863;\n this.words[j + 1] = w >>> 26 - off & 67108863;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === \"le\") {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | number[i + 1] << 8 | number[i + 2] << 16;\n this.words[j] |= w << off & 67108863;\n this.words[j + 1] = w >>> 26 - off & 67108863;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this.strip();\n };\n function parseHex4Bits(string, index) {\n var c = string.charCodeAt(index);\n if (c >= 65 && c <= 70) {\n return c - 55;\n } else if (c >= 97 && c <= 102) {\n return c - 87;\n } else {\n return c - 48 & 15;\n }\n }\n function parseHexByte(string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n if (index - 1 >= lowerBound) {\n r |= parseHex4Bits(string, index - 1) << 4;\n }\n return r;\n }\n BN.prototype._parseHex = function _parseHex(number, start, endian) {\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n var off = 0;\n var j = 0;\n var w;\n if (endian === \"be\") {\n for (i = number.length - 1; i >= start; i -= 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 67108863;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n } else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 67108863;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n }\n this.strip();\n };\n function parseBase(str, start, end, mul) {\n var r = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n r *= mul;\n if (c >= 49) {\n r += c - 49 + 10;\n } else if (c >= 17) {\n r += c - 17 + 10;\n } else {\n r += c;\n }\n }\n return r;\n }\n BN.prototype._parseBase = function _parseBase(number, base, start) {\n this.words = [0];\n this.length = 1;\n for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) {\n limbLen++;\n }\n limbLen--;\n limbPow = limbPow / base | 0;\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n this.imuln(limbPow);\n if (this.words[0] + word < 67108864) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n this.imuln(pow);\n if (this.words[0] + word < 67108864) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n this.strip();\n };\n BN.prototype.copy = function copy(dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n BN.prototype.clone = function clone() {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n BN.prototype._expand = function _expand(size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n return this;\n };\n BN.prototype.strip = function strip() {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n return this._normSign();\n };\n BN.prototype._normSign = function _normSign() {\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n return this;\n };\n BN.prototype.inspect = function inspect() {\n return (this.red ? \"\";\n };\n var zeros = [\n \"\",\n \"0\",\n \"00\",\n \"000\",\n \"0000\",\n \"00000\",\n \"000000\",\n \"0000000\",\n \"00000000\",\n \"000000000\",\n \"0000000000\",\n \"00000000000\",\n \"000000000000\",\n \"0000000000000\",\n \"00000000000000\",\n \"000000000000000\",\n \"0000000000000000\",\n \"00000000000000000\",\n \"000000000000000000\",\n \"0000000000000000000\",\n \"00000000000000000000\",\n \"000000000000000000000\",\n \"0000000000000000000000\",\n \"00000000000000000000000\",\n \"000000000000000000000000\",\n \"0000000000000000000000000\"\n ];\n var groupSizes = [\n 0,\n 0,\n 25,\n 16,\n 12,\n 11,\n 10,\n 9,\n 8,\n 8,\n 7,\n 7,\n 7,\n 7,\n 6,\n 6,\n 6,\n 6,\n 6,\n 6,\n 6,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5,\n 5\n ];\n var groupBases = [\n 0,\n 0,\n 33554432,\n 43046721,\n 16777216,\n 48828125,\n 60466176,\n 40353607,\n 16777216,\n 43046721,\n 1e7,\n 19487171,\n 35831808,\n 62748517,\n 7529536,\n 11390625,\n 16777216,\n 24137569,\n 34012224,\n 47045881,\n 64e6,\n 4084101,\n 5153632,\n 6436343,\n 7962624,\n 9765625,\n 11881376,\n 14348907,\n 17210368,\n 20511149,\n 243e5,\n 28629151,\n 33554432,\n 39135393,\n 45435424,\n 52521875,\n 60466176\n ];\n BN.prototype.toString = function toString(base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n var out;\n if (base === 16 || base === \"hex\") {\n out = \"\";\n var off = 0;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = ((w << off | carry) & 16777215).toString(16);\n carry = w >>> 24 - off & 16777215;\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n }\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n while (out.length % padding !== 0) {\n out = \"0\" + out;\n }\n if (this.negative !== 0) {\n out = \"-\" + out;\n }\n return out;\n }\n if (base === (base | 0) && base >= 2 && base <= 36) {\n var groupSize = groupSizes[base];\n var groupBase = groupBases[base];\n out = \"\";\n var c = this.clone();\n c.negative = 0;\n while (!c.isZero()) {\n var r = c.modn(groupBase).toString(base);\n c = c.idivn(groupBase);\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n if (this.isZero()) {\n out = \"0\" + out;\n }\n while (out.length % padding !== 0) {\n out = \"0\" + out;\n }\n if (this.negative !== 0) {\n out = \"-\" + out;\n }\n return out;\n }\n assert(false, \"Base should be between 2 and 36\");\n };\n BN.prototype.toNumber = function toNumber() {\n var ret = this.words[0];\n if (this.length === 2) {\n ret += this.words[1] * 67108864;\n } else if (this.length === 3 && this.words[2] === 1) {\n ret += 4503599627370496 + this.words[1] * 67108864;\n } else if (this.length > 2) {\n assert(false, \"Number can only safely store up to 53 bits\");\n }\n return this.negative !== 0 ? -ret : ret;\n };\n BN.prototype.toJSON = function toJSON() {\n return this.toString(16);\n };\n BN.prototype.toBuffer = function toBuffer(endian, length) {\n assert(typeof Buffer2 !== \"undefined\");\n return this.toArrayLike(Buffer2, endian, length);\n };\n BN.prototype.toArray = function toArray(endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, \"byte array longer than desired length\");\n assert(reqLength > 0, \"Requested array length <= 0\");\n this.strip();\n var littleEndian = endian === \"le\";\n var res = new ArrayType(reqLength);\n var b, i;\n var q = this.clone();\n if (!littleEndian) {\n for (i = 0; i < reqLength - byteLength; i++) {\n res[i] = 0;\n }\n for (i = 0; !q.isZero(); i++) {\n b = q.andln(255);\n q.iushrn(8);\n res[reqLength - i - 1] = b;\n }\n } else {\n for (i = 0; !q.isZero(); i++) {\n b = q.andln(255);\n q.iushrn(8);\n res[i] = b;\n }\n for (; i < reqLength; i++) {\n res[i] = 0;\n }\n }\n return res;\n };\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits(w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits(w) {\n var t = w;\n var r = 0;\n if (t >= 4096) {\n r += 13;\n t >>>= 13;\n }\n if (t >= 64) {\n r += 7;\n t >>>= 7;\n }\n if (t >= 8) {\n r += 4;\n t >>>= 4;\n }\n if (t >= 2) {\n r += 2;\n t >>>= 2;\n }\n return r + t;\n };\n }\n BN.prototype._zeroBits = function _zeroBits(w) {\n if (w === 0) return 26;\n var t = w;\n var r = 0;\n if ((t & 8191) === 0) {\n r += 13;\n t >>>= 13;\n }\n if ((t & 127) === 0) {\n r += 7;\n t >>>= 7;\n }\n if ((t & 15) === 0) {\n r += 4;\n t >>>= 4;\n }\n if ((t & 3) === 0) {\n r += 2;\n t >>>= 2;\n }\n if ((t & 1) === 0) {\n r++;\n }\n return r;\n };\n BN.prototype.bitLength = function bitLength() {\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n function toBitArray(num) {\n var w = new Array(num.bitLength());\n for (var bit = 0; bit < w.length; bit++) {\n var off = bit / 26 | 0;\n var wbit = bit % 26;\n w[bit] = (num.words[off] & 1 << wbit) >>> wbit;\n }\n return w;\n }\n BN.prototype.zeroBits = function zeroBits() {\n if (this.isZero()) return 0;\n var r = 0;\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n r += b;\n if (b !== 26) break;\n }\n return r;\n };\n BN.prototype.byteLength = function byteLength() {\n return Math.ceil(this.bitLength() / 8);\n };\n BN.prototype.toTwos = function toTwos(width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n return this.clone();\n };\n BN.prototype.fromTwos = function fromTwos(width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n return this.clone();\n };\n BN.prototype.isNeg = function isNeg() {\n return this.negative !== 0;\n };\n BN.prototype.neg = function neg() {\n return this.clone().ineg();\n };\n BN.prototype.ineg = function ineg() {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n return this;\n };\n BN.prototype.iuor = function iuor(num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n return this.strip();\n };\n BN.prototype.ior = function ior(num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n };\n BN.prototype.or = function or(num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n BN.prototype.uor = function uor(num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n };\n BN.prototype.iuand = function iuand(num) {\n var b;\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n this.length = b.length;\n return this.strip();\n };\n BN.prototype.iand = function iand(num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n };\n BN.prototype.and = function and(num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n BN.prototype.uand = function uand(num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n };\n BN.prototype.iuxor = function iuxor(num) {\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n this.length = a.length;\n return this.strip();\n };\n BN.prototype.ixor = function ixor(num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n };\n BN.prototype.xor = function xor(num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n BN.prototype.uxor = function uxor(num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n };\n BN.prototype.inotn = function inotn(width) {\n assert(typeof width === \"number\" && width >= 0);\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26;\n this._expand(bytesNeeded);\n if (bitsLeft > 0) {\n bytesNeeded--;\n }\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 67108863;\n }\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & 67108863 >> 26 - bitsLeft;\n }\n return this.strip();\n };\n BN.prototype.notn = function notn(width) {\n return this.clone().inotn(width);\n };\n BN.prototype.setn = function setn(bit, val) {\n assert(typeof bit === \"number\" && bit >= 0);\n var off = bit / 26 | 0;\n var wbit = bit % 26;\n this._expand(off + 1);\n if (val) {\n this.words[off] = this.words[off] | 1 << wbit;\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n return this.strip();\n };\n BN.prototype.iadd = function iadd(num) {\n var r;\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign();\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n }\n var a, b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 67108863;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 67108863;\n carry = r >>> 26;\n }\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n return this;\n };\n BN.prototype.add = function add(num) {\n var res;\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n if (this.length > num.length) return this.clone().iadd(num);\n return num.clone().iadd(this);\n };\n BN.prototype.isub = function isub(num) {\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign();\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n }\n var cmp = this.cmp(num);\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n var a, b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 67108863;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 67108863;\n }\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n this.length = Math.max(this.length, i);\n if (a !== this) {\n this.negative = 1;\n }\n return this.strip();\n };\n BN.prototype.sub = function sub(num) {\n return this.clone().isub(num);\n };\n function smallMulTo(self2, num, out) {\n out.negative = num.negative ^ self2.negative;\n var len = self2.length + num.length | 0;\n out.length = len;\n len = len - 1 | 0;\n var a = self2.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n var lo = r & 67108863;\n var carry = r / 67108864 | 0;\n out.words[0] = lo;\n for (var k = 1; k < len; k++) {\n var ncarry = carry >>> 26;\n var rword = carry & 67108863;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self2.length + 1); j <= maxJ; j++) {\n var i = k - j | 0;\n a = self2.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += r / 67108864 | 0;\n rword = r & 67108863;\n }\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n return out.strip();\n }\n var comb10MulTo = function comb10MulTo2(self2, num, out) {\n var a = self2.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 8191;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 8191;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 8191;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 8191;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 8191;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 8191;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 8191;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 8191;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 8191;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 8191;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 8191;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 8191;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 8191;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 8191;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 8191;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 8191;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 8191;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 8191;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 8191;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 8191;\n var bh9 = b9 >>> 13;\n out.negative = self2.negative ^ num.negative;\n out.length = 19;\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = mid + Math.imul(ah0, bl0) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0;\n w0 &= 67108863;\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = mid + Math.imul(ah1, bl0) | 0;\n hi = Math.imul(ah1, bh0);\n lo = lo + Math.imul(al0, bl1) | 0;\n mid = mid + Math.imul(al0, bh1) | 0;\n mid = mid + Math.imul(ah0, bl1) | 0;\n hi = hi + Math.imul(ah0, bh1) | 0;\n var w1 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0;\n w1 &= 67108863;\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = mid + Math.imul(ah2, bl0) | 0;\n hi = Math.imul(ah2, bh0);\n lo = lo + Math.imul(al1, bl1) | 0;\n mid = mid + Math.imul(al1, bh1) | 0;\n mid = mid + Math.imul(ah1, bl1) | 0;\n hi = hi + Math.imul(ah1, bh1) | 0;\n lo = lo + Math.imul(al0, bl2) | 0;\n mid = mid + Math.imul(al0, bh2) | 0;\n mid = mid + Math.imul(ah0, bl2) | 0;\n hi = hi + Math.imul(ah0, bh2) | 0;\n var w2 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0;\n w2 &= 67108863;\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = mid + Math.imul(ah3, bl0) | 0;\n hi = Math.imul(ah3, bh0);\n lo = lo + Math.imul(al2, bl1) | 0;\n mid = mid + Math.imul(al2, bh1) | 0;\n mid = mid + Math.imul(ah2, bl1) | 0;\n hi = hi + Math.imul(ah2, bh1) | 0;\n lo = lo + Math.imul(al1, bl2) | 0;\n mid = mid + Math.imul(al1, bh2) | 0;\n mid = mid + Math.imul(ah1, bl2) | 0;\n hi = hi + Math.imul(ah1, bh2) | 0;\n lo = lo + Math.imul(al0, bl3) | 0;\n mid = mid + Math.imul(al0, bh3) | 0;\n mid = mid + Math.imul(ah0, bl3) | 0;\n hi = hi + Math.imul(ah0, bh3) | 0;\n var w3 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0;\n w3 &= 67108863;\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = mid + Math.imul(ah4, bl0) | 0;\n hi = Math.imul(ah4, bh0);\n lo = lo + Math.imul(al3, bl1) | 0;\n mid = mid + Math.imul(al3, bh1) | 0;\n mid = mid + Math.imul(ah3, bl1) | 0;\n hi = hi + Math.imul(ah3, bh1) | 0;\n lo = lo + Math.imul(al2, bl2) | 0;\n mid = mid + Math.imul(al2, bh2) | 0;\n mid = mid + Math.imul(ah2, bl2) | 0;\n hi = hi + Math.imul(ah2, bh2) | 0;\n lo = lo + Math.imul(al1, bl3) | 0;\n mid = mid + Math.imul(al1, bh3) | 0;\n mid = mid + Math.imul(ah1, bl3) | 0;\n hi = hi + Math.imul(ah1, bh3) | 0;\n lo = lo + Math.imul(al0, bl4) | 0;\n mid = mid + Math.imul(al0, bh4) | 0;\n mid = mid + Math.imul(ah0, bl4) | 0;\n hi = hi + Math.imul(ah0, bh4) | 0;\n var w4 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0;\n w4 &= 67108863;\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = mid + Math.imul(ah5, bl0) | 0;\n hi = Math.imul(ah5, bh0);\n lo = lo + Math.imul(al4, bl1) | 0;\n mid = mid + Math.imul(al4, bh1) | 0;\n mid = mid + Math.imul(ah4, bl1) | 0;\n hi = hi + Math.imul(ah4, bh1) | 0;\n lo = lo + Math.imul(al3, bl2) | 0;\n mid = mid + Math.imul(al3, bh2) | 0;\n mid = mid + Math.imul(ah3, bl2) | 0;\n hi = hi + Math.imul(ah3, bh2) | 0;\n lo = lo + Math.imul(al2, bl3) | 0;\n mid = mid + Math.imul(al2, bh3) | 0;\n mid = mid + Math.imul(ah2, bl3) | 0;\n hi = hi + Math.imul(ah2, bh3) | 0;\n lo = lo + Math.imul(al1, bl4) | 0;\n mid = mid + Math.imul(al1, bh4) | 0;\n mid = mid + Math.imul(ah1, bl4) | 0;\n hi = hi + Math.imul(ah1, bh4) | 0;\n lo = lo + Math.imul(al0, bl5) | 0;\n mid = mid + Math.imul(al0, bh5) | 0;\n mid = mid + Math.imul(ah0, bl5) | 0;\n hi = hi + Math.imul(ah0, bh5) | 0;\n var w5 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0;\n w5 &= 67108863;\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = mid + Math.imul(ah6, bl0) | 0;\n hi = Math.imul(ah6, bh0);\n lo = lo + Math.imul(al5, bl1) | 0;\n mid = mid + Math.imul(al5, bh1) | 0;\n mid = mid + Math.imul(ah5, bl1) | 0;\n hi = hi + Math.imul(ah5, bh1) | 0;\n lo = lo + Math.imul(al4, bl2) | 0;\n mid = mid + Math.imul(al4, bh2) | 0;\n mid = mid + Math.imul(ah4, bl2) | 0;\n hi = hi + Math.imul(ah4, bh2) | 0;\n lo = lo + Math.imul(al3, bl3) | 0;\n mid = mid + Math.imul(al3, bh3) | 0;\n mid = mid + Math.imul(ah3, bl3) | 0;\n hi = hi + Math.imul(ah3, bh3) | 0;\n lo = lo + Math.imul(al2, bl4) | 0;\n mid = mid + Math.imul(al2, bh4) | 0;\n mid = mid + Math.imul(ah2, bl4) | 0;\n hi = hi + Math.imul(ah2, bh4) | 0;\n lo = lo + Math.imul(al1, bl5) | 0;\n mid = mid + Math.imul(al1, bh5) | 0;\n mid = mid + Math.imul(ah1, bl5) | 0;\n hi = hi + Math.imul(ah1, bh5) | 0;\n lo = lo + Math.imul(al0, bl6) | 0;\n mid = mid + Math.imul(al0, bh6) | 0;\n mid = mid + Math.imul(ah0, bl6) | 0;\n hi = hi + Math.imul(ah0, bh6) | 0;\n var w6 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0;\n w6 &= 67108863;\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = mid + Math.imul(ah7, bl0) | 0;\n hi = Math.imul(ah7, bh0);\n lo = lo + Math.imul(al6, bl1) | 0;\n mid = mid + Math.imul(al6, bh1) | 0;\n mid = mid + Math.imul(ah6, bl1) | 0;\n hi = hi + Math.imul(ah6, bh1) | 0;\n lo = lo + Math.imul(al5, bl2) | 0;\n mid = mid + Math.imul(al5, bh2) | 0;\n mid = mid + Math.imul(ah5, bl2) | 0;\n hi = hi + Math.imul(ah5, bh2) | 0;\n lo = lo + Math.imul(al4, bl3) | 0;\n mid = mid + Math.imul(al4, bh3) | 0;\n mid = mid + Math.imul(ah4, bl3) | 0;\n hi = hi + Math.imul(ah4, bh3) | 0;\n lo = lo + Math.imul(al3, bl4) | 0;\n mid = mid + Math.imul(al3, bh4) | 0;\n mid = mid + Math.imul(ah3, bl4) | 0;\n hi = hi + Math.imul(ah3, bh4) | 0;\n lo = lo + Math.imul(al2, bl5) | 0;\n mid = mid + Math.imul(al2, bh5) | 0;\n mid = mid + Math.imul(ah2, bl5) | 0;\n hi = hi + Math.imul(ah2, bh5) | 0;\n lo = lo + Math.imul(al1, bl6) | 0;\n mid = mid + Math.imul(al1, bh6) | 0;\n mid = mid + Math.imul(ah1, bl6) | 0;\n hi = hi + Math.imul(ah1, bh6) | 0;\n lo = lo + Math.imul(al0, bl7) | 0;\n mid = mid + Math.imul(al0, bh7) | 0;\n mid = mid + Math.imul(ah0, bl7) | 0;\n hi = hi + Math.imul(ah0, bh7) | 0;\n var w7 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0;\n w7 &= 67108863;\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = mid + Math.imul(ah8, bl0) | 0;\n hi = Math.imul(ah8, bh0);\n lo = lo + Math.imul(al7, bl1) | 0;\n mid = mid + Math.imul(al7, bh1) | 0;\n mid = mid + Math.imul(ah7, bl1) | 0;\n hi = hi + Math.imul(ah7, bh1) | 0;\n lo = lo + Math.imul(al6, bl2) | 0;\n mid = mid + Math.imul(al6, bh2) | 0;\n mid = mid + Math.imul(ah6, bl2) | 0;\n hi = hi + Math.imul(ah6, bh2) | 0;\n lo = lo + Math.imul(al5, bl3) | 0;\n mid = mid + Math.imul(al5, bh3) | 0;\n mid = mid + Math.imul(ah5, bl3) | 0;\n hi = hi + Math.imul(ah5, bh3) | 0;\n lo = lo + Math.imul(al4, bl4) | 0;\n mid = mid + Math.imul(al4, bh4) | 0;\n mid = mid + Math.imul(ah4, bl4) | 0;\n hi = hi + Math.imul(ah4, bh4) | 0;\n lo = lo + Math.imul(al3, bl5) | 0;\n mid = mid + Math.imul(al3, bh5) | 0;\n mid = mid + Math.imul(ah3, bl5) | 0;\n hi = hi + Math.imul(ah3, bh5) | 0;\n lo = lo + Math.imul(al2, bl6) | 0;\n mid = mid + Math.imul(al2, bh6) | 0;\n mid = mid + Math.imul(ah2, bl6) | 0;\n hi = hi + Math.imul(ah2, bh6) | 0;\n lo = lo + Math.imul(al1, bl7) | 0;\n mid = mid + Math.imul(al1, bh7) | 0;\n mid = mid + Math.imul(ah1, bl7) | 0;\n hi = hi + Math.imul(ah1, bh7) | 0;\n lo = lo + Math.imul(al0, bl8) | 0;\n mid = mid + Math.imul(al0, bh8) | 0;\n mid = mid + Math.imul(ah0, bl8) | 0;\n hi = hi + Math.imul(ah0, bh8) | 0;\n var w8 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0;\n w8 &= 67108863;\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = mid + Math.imul(ah9, bl0) | 0;\n hi = Math.imul(ah9, bh0);\n lo = lo + Math.imul(al8, bl1) | 0;\n mid = mid + Math.imul(al8, bh1) | 0;\n mid = mid + Math.imul(ah8, bl1) | 0;\n hi = hi + Math.imul(ah8, bh1) | 0;\n lo = lo + Math.imul(al7, bl2) | 0;\n mid = mid + Math.imul(al7, bh2) | 0;\n mid = mid + Math.imul(ah7, bl2) | 0;\n hi = hi + Math.imul(ah7, bh2) | 0;\n lo = lo + Math.imul(al6, bl3) | 0;\n mid = mid + Math.imul(al6, bh3) | 0;\n mid = mid + Math.imul(ah6, bl3) | 0;\n hi = hi + Math.imul(ah6, bh3) | 0;\n lo = lo + Math.imul(al5, bl4) | 0;\n mid = mid + Math.imul(al5, bh4) | 0;\n mid = mid + Math.imul(ah5, bl4) | 0;\n hi = hi + Math.imul(ah5, bh4) | 0;\n lo = lo + Math.imul(al4, bl5) | 0;\n mid = mid + Math.imul(al4, bh5) | 0;\n mid = mid + Math.imul(ah4, bl5) | 0;\n hi = hi + Math.imul(ah4, bh5) | 0;\n lo = lo + Math.imul(al3, bl6) | 0;\n mid = mid + Math.imul(al3, bh6) | 0;\n mid = mid + Math.imul(ah3, bl6) | 0;\n hi = hi + Math.imul(ah3, bh6) | 0;\n lo = lo + Math.imul(al2, bl7) | 0;\n mid = mid + Math.imul(al2, bh7) | 0;\n mid = mid + Math.imul(ah2, bl7) | 0;\n hi = hi + Math.imul(ah2, bh7) | 0;\n lo = lo + Math.imul(al1, bl8) | 0;\n mid = mid + Math.imul(al1, bh8) | 0;\n mid = mid + Math.imul(ah1, bl8) | 0;\n hi = hi + Math.imul(ah1, bh8) | 0;\n lo = lo + Math.imul(al0, bl9) | 0;\n mid = mid + Math.imul(al0, bh9) | 0;\n mid = mid + Math.imul(ah0, bl9) | 0;\n hi = hi + Math.imul(ah0, bh9) | 0;\n var w9 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0;\n w9 &= 67108863;\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = mid + Math.imul(ah9, bl1) | 0;\n hi = Math.imul(ah9, bh1);\n lo = lo + Math.imul(al8, bl2) | 0;\n mid = mid + Math.imul(al8, bh2) | 0;\n mid = mid + Math.imul(ah8, bl2) | 0;\n hi = hi + Math.imul(ah8, bh2) | 0;\n lo = lo + Math.imul(al7, bl3) | 0;\n mid = mid + Math.imul(al7, bh3) | 0;\n mid = mid + Math.imul(ah7, bl3) | 0;\n hi = hi + Math.imul(ah7, bh3) | 0;\n lo = lo + Math.imul(al6, bl4) | 0;\n mid = mid + Math.imul(al6, bh4) | 0;\n mid = mid + Math.imul(ah6, bl4) | 0;\n hi = hi + Math.imul(ah6, bh4) | 0;\n lo = lo + Math.imul(al5, bl5) | 0;\n mid = mid + Math.imul(al5, bh5) | 0;\n mid = mid + Math.imul(ah5, bl5) | 0;\n hi = hi + Math.imul(ah5, bh5) | 0;\n lo = lo + Math.imul(al4, bl6) | 0;\n mid = mid + Math.imul(al4, bh6) | 0;\n mid = mid + Math.imul(ah4, bl6) | 0;\n hi = hi + Math.imul(ah4, bh6) | 0;\n lo = lo + Math.imul(al3, bl7) | 0;\n mid = mid + Math.imul(al3, bh7) | 0;\n mid = mid + Math.imul(ah3, bl7) | 0;\n hi = hi + Math.imul(ah3, bh7) | 0;\n lo = lo + Math.imul(al2, bl8) | 0;\n mid = mid + Math.imul(al2, bh8) | 0;\n mid = mid + Math.imul(ah2, bl8) | 0;\n hi = hi + Math.imul(ah2, bh8) | 0;\n lo = lo + Math.imul(al1, bl9) | 0;\n mid = mid + Math.imul(al1, bh9) | 0;\n mid = mid + Math.imul(ah1, bl9) | 0;\n hi = hi + Math.imul(ah1, bh9) | 0;\n var w10 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0;\n w10 &= 67108863;\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = mid + Math.imul(ah9, bl2) | 0;\n hi = Math.imul(ah9, bh2);\n lo = lo + Math.imul(al8, bl3) | 0;\n mid = mid + Math.imul(al8, bh3) | 0;\n mid = mid + Math.imul(ah8, bl3) | 0;\n hi = hi + Math.imul(ah8, bh3) | 0;\n lo = lo + Math.imul(al7, bl4) | 0;\n mid = mid + Math.imul(al7, bh4) | 0;\n mid = mid + Math.imul(ah7, bl4) | 0;\n hi = hi + Math.imul(ah7, bh4) | 0;\n lo = lo + Math.imul(al6, bl5) | 0;\n mid = mid + Math.imul(al6, bh5) | 0;\n mid = mid + Math.imul(ah6, bl5) | 0;\n hi = hi + Math.imul(ah6, bh5) | 0;\n lo = lo + Math.imul(al5, bl6) | 0;\n mid = mid + Math.imul(al5, bh6) | 0;\n mid = mid + Math.imul(ah5, bl6) | 0;\n hi = hi + Math.imul(ah5, bh6) | 0;\n lo = lo + Math.imul(al4, bl7) | 0;\n mid = mid + Math.imul(al4, bh7) | 0;\n mid = mid + Math.imul(ah4, bl7) | 0;\n hi = hi + Math.imul(ah4, bh7) | 0;\n lo = lo + Math.imul(al3, bl8) | 0;\n mid = mid + Math.imul(al3, bh8) | 0;\n mid = mid + Math.imul(ah3, bl8) | 0;\n hi = hi + Math.imul(ah3, bh8) | 0;\n lo = lo + Math.imul(al2, bl9) | 0;\n mid = mid + Math.imul(al2, bh9) | 0;\n mid = mid + Math.imul(ah2, bl9) | 0;\n hi = hi + Math.imul(ah2, bh9) | 0;\n var w11 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0;\n w11 &= 67108863;\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = mid + Math.imul(ah9, bl3) | 0;\n hi = Math.imul(ah9, bh3);\n lo = lo + Math.imul(al8, bl4) | 0;\n mid = mid + Math.imul(al8, bh4) | 0;\n mid = mid + Math.imul(ah8, bl4) | 0;\n hi = hi + Math.imul(ah8, bh4) | 0;\n lo = lo + Math.imul(al7, bl5) | 0;\n mid = mid + Math.imul(al7, bh5) | 0;\n mid = mid + Math.imul(ah7, bl5) | 0;\n hi = hi + Math.imul(ah7, bh5) | 0;\n lo = lo + Math.imul(al6, bl6) | 0;\n mid = mid + Math.imul(al6, bh6) | 0;\n mid = mid + Math.imul(ah6, bl6) | 0;\n hi = hi + Math.imul(ah6, bh6) | 0;\n lo = lo + Math.imul(al5, bl7) | 0;\n mid = mid + Math.imul(al5, bh7) | 0;\n mid = mid + Math.imul(ah5, bl7) | 0;\n hi = hi + Math.imul(ah5, bh7) | 0;\n lo = lo + Math.imul(al4, bl8) | 0;\n mid = mid + Math.imul(al4, bh8) | 0;\n mid = mid + Math.imul(ah4, bl8) | 0;\n hi = hi + Math.imul(ah4, bh8) | 0;\n lo = lo + Math.imul(al3, bl9) | 0;\n mid = mid + Math.imul(al3, bh9) | 0;\n mid = mid + Math.imul(ah3, bl9) | 0;\n hi = hi + Math.imul(ah3, bh9) | 0;\n var w12 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0;\n w12 &= 67108863;\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = mid + Math.imul(ah9, bl4) | 0;\n hi = Math.imul(ah9, bh4);\n lo = lo + Math.imul(al8, bl5) | 0;\n mid = mid + Math.imul(al8, bh5) | 0;\n mid = mid + Math.imul(ah8, bl5) | 0;\n hi = hi + Math.imul(ah8, bh5) | 0;\n lo = lo + Math.imul(al7, bl6) | 0;\n mid = mid + Math.imul(al7, bh6) | 0;\n mid = mid + Math.imul(ah7, bl6) | 0;\n hi = hi + Math.imul(ah7, bh6) | 0;\n lo = lo + Math.imul(al6, bl7) | 0;\n mid = mid + Math.imul(al6, bh7) | 0;\n mid = mid + Math.imul(ah6, bl7) | 0;\n hi = hi + Math.imul(ah6, bh7) | 0;\n lo = lo + Math.imul(al5, bl8) | 0;\n mid = mid + Math.imul(al5, bh8) | 0;\n mid = mid + Math.imul(ah5, bl8) | 0;\n hi = hi + Math.imul(ah5, bh8) | 0;\n lo = lo + Math.imul(al4, bl9) | 0;\n mid = mid + Math.imul(al4, bh9) | 0;\n mid = mid + Math.imul(ah4, bl9) | 0;\n hi = hi + Math.imul(ah4, bh9) | 0;\n var w13 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0;\n w13 &= 67108863;\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = mid + Math.imul(ah9, bl5) | 0;\n hi = Math.imul(ah9, bh5);\n lo = lo + Math.imul(al8, bl6) | 0;\n mid = mid + Math.imul(al8, bh6) | 0;\n mid = mid + Math.imul(ah8, bl6) | 0;\n hi = hi + Math.imul(ah8, bh6) | 0;\n lo = lo + Math.imul(al7, bl7) | 0;\n mid = mid + Math.imul(al7, bh7) | 0;\n mid = mid + Math.imul(ah7, bl7) | 0;\n hi = hi + Math.imul(ah7, bh7) | 0;\n lo = lo + Math.imul(al6, bl8) | 0;\n mid = mid + Math.imul(al6, bh8) | 0;\n mid = mid + Math.imul(ah6, bl8) | 0;\n hi = hi + Math.imul(ah6, bh8) | 0;\n lo = lo + Math.imul(al5, bl9) | 0;\n mid = mid + Math.imul(al5, bh9) | 0;\n mid = mid + Math.imul(ah5, bl9) | 0;\n hi = hi + Math.imul(ah5, bh9) | 0;\n var w14 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0;\n w14 &= 67108863;\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = mid + Math.imul(ah9, bl6) | 0;\n hi = Math.imul(ah9, bh6);\n lo = lo + Math.imul(al8, bl7) | 0;\n mid = mid + Math.imul(al8, bh7) | 0;\n mid = mid + Math.imul(ah8, bl7) | 0;\n hi = hi + Math.imul(ah8, bh7) | 0;\n lo = lo + Math.imul(al7, bl8) | 0;\n mid = mid + Math.imul(al7, bh8) | 0;\n mid = mid + Math.imul(ah7, bl8) | 0;\n hi = hi + Math.imul(ah7, bh8) | 0;\n lo = lo + Math.imul(al6, bl9) | 0;\n mid = mid + Math.imul(al6, bh9) | 0;\n mid = mid + Math.imul(ah6, bl9) | 0;\n hi = hi + Math.imul(ah6, bh9) | 0;\n var w15 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0;\n w15 &= 67108863;\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = mid + Math.imul(ah9, bl7) | 0;\n hi = Math.imul(ah9, bh7);\n lo = lo + Math.imul(al8, bl8) | 0;\n mid = mid + Math.imul(al8, bh8) | 0;\n mid = mid + Math.imul(ah8, bl8) | 0;\n hi = hi + Math.imul(ah8, bh8) | 0;\n lo = lo + Math.imul(al7, bl9) | 0;\n mid = mid + Math.imul(al7, bh9) | 0;\n mid = mid + Math.imul(ah7, bl9) | 0;\n hi = hi + Math.imul(ah7, bh9) | 0;\n var w16 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0;\n w16 &= 67108863;\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = mid + Math.imul(ah9, bl8) | 0;\n hi = Math.imul(ah9, bh8);\n lo = lo + Math.imul(al8, bl9) | 0;\n mid = mid + Math.imul(al8, bh9) | 0;\n mid = mid + Math.imul(ah8, bl9) | 0;\n hi = hi + Math.imul(ah8, bh9) | 0;\n var w17 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0;\n w17 &= 67108863;\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = mid + Math.imul(ah9, bl9) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (c + lo | 0) + ((mid & 8191) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0;\n w18 &= 67108863;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n return out;\n };\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n function bigMulTo(self2, num, out) {\n out.negative = num.negative ^ self2.negative;\n out.length = self2.length + num.length;\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 67108863;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self2.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self2.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n var lo = r & 67108863;\n ncarry = ncarry + (r / 67108864 | 0) | 0;\n lo = lo + rword | 0;\n rword = lo & 67108863;\n ncarry = ncarry + (lo >>> 26) | 0;\n hncarry += ncarry >>> 26;\n ncarry &= 67108863;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n return out.strip();\n }\n function jumboMulTo(self2, num, out) {\n var fftm = new FFTM();\n return fftm.mulp(self2, num, out);\n }\n BN.prototype.mulTo = function mulTo(num, out) {\n var res;\n var len = this.length + num.length;\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n return res;\n };\n function FFTM(x, y) {\n this.x = x;\n this.y = y;\n }\n FFTM.prototype.makeRBT = function makeRBT(N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n return t;\n };\n FFTM.prototype.revBin = function revBin(x, l, N) {\n if (x === 0 || x === N - 1) return x;\n var rb = 0;\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << l - i - 1;\n x >>= 1;\n }\n return rb;\n };\n FFTM.prototype.permute = function permute(rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n FFTM.prototype.transform = function transform(rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n var rx = rtwdf_ * ro - itwdf_ * io;\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n FFTM.prototype.guessLen13b = function guessLen13b(n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n return 1 << i + 1 + odd;\n };\n FFTM.prototype.conjugate = function conjugate(rws, iws, N) {\n if (N <= 1) return;\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n t = iws[i];\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n FFTM.prototype.normalize13b = function normalize13b(ws, N) {\n var carry = 0;\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 8192 + Math.round(ws[2 * i] / N) + carry;\n ws[i] = w & 67108863;\n if (w < 67108864) {\n carry = 0;\n } else {\n carry = w / 67108864 | 0;\n }\n }\n return ws;\n };\n FFTM.prototype.convert13b = function convert13b(ws, len, rws, N) {\n var carry = 0;\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n rws[2 * i] = carry & 8191;\n carry = carry >>> 13;\n rws[2 * i + 1] = carry & 8191;\n carry = carry >>> 13;\n }\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n assert(carry === 0);\n assert((carry & ~8191) === 0);\n };\n FFTM.prototype.stub = function stub(N) {\n var ph = new Array(N);\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n return ph;\n };\n FFTM.prototype.mulp = function mulp(x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n var rbt = this.makeRBT(N);\n var _ = this.stub(N);\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n var rmws = out.words;\n rmws.length = N;\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out.strip();\n };\n BN.prototype.mul = function mul(num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n };\n BN.prototype.mulf = function mulf(num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n };\n BN.prototype.imul = function imul(num) {\n return this.clone().mulTo(num, this);\n };\n BN.prototype.imuln = function imuln(num) {\n assert(typeof num === \"number\");\n assert(num < 67108864);\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 67108863) + (carry & 67108863);\n carry >>= 26;\n carry += w / 67108864 | 0;\n carry += lo >>> 26;\n this.words[i] = lo & 67108863;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n };\n BN.prototype.muln = function muln(num) {\n return this.clone().imuln(num);\n };\n BN.prototype.sqr = function sqr() {\n return this.mul(this);\n };\n BN.prototype.isqr = function isqr() {\n return this.imul(this.clone());\n };\n BN.prototype.pow = function pow(num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1);\n var res = this;\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n res = res.mul(q);\n }\n }\n return res;\n };\n BN.prototype.iushln = function iushln(bits) {\n assert(typeof bits === \"number\" && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = 67108863 >>> 26 - r << 26 - r;\n var i;\n if (r !== 0) {\n var carry = 0;\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = (this.words[i] | 0) - newCarry << r;\n this.words[i] = c | carry;\n carry = newCarry >>> 26 - r;\n }\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n this.length += s;\n }\n return this.strip();\n };\n BN.prototype.ishln = function ishln(bits) {\n assert(this.negative === 0);\n return this.iushln(bits);\n };\n BN.prototype.iushrn = function iushrn(bits, hint, extended) {\n assert(typeof bits === \"number\" && bits >= 0);\n var h;\n if (hint) {\n h = (hint - hint % 26) / 26;\n } else {\n h = 0;\n }\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 67108863 ^ 67108863 >>> r << r;\n var maskedWords = extended;\n h -= s;\n h = Math.max(0, h);\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n maskedWords.length = s;\n }\n if (s === 0) {\n } else if (this.length > s) {\n this.length -= s;\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n var carry = 0;\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = carry << 26 - r | word >>> r;\n carry = word & mask;\n }\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n return this.strip();\n };\n BN.prototype.ishrn = function ishrn(bits, hint, extended) {\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n };\n BN.prototype.shln = function shln(bits) {\n return this.clone().ishln(bits);\n };\n BN.prototype.ushln = function ushln(bits) {\n return this.clone().iushln(bits);\n };\n BN.prototype.shrn = function shrn(bits) {\n return this.clone().ishrn(bits);\n };\n BN.prototype.ushrn = function ushrn(bits) {\n return this.clone().iushrn(bits);\n };\n BN.prototype.testn = function testn(bit) {\n assert(typeof bit === \"number\" && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n if (this.length <= s) return false;\n var w = this.words[s];\n return !!(w & q);\n };\n BN.prototype.imaskn = function imaskn(bits) {\n assert(typeof bits === \"number\" && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n assert(this.negative === 0, \"imaskn works only with positive numbers\");\n if (this.length <= s) {\n return this;\n }\n if (r !== 0) {\n s++;\n }\n this.length = Math.min(s, this.length);\n if (r !== 0) {\n var mask = 67108863 ^ 67108863 >>> r << r;\n this.words[this.length - 1] &= mask;\n }\n return this.strip();\n };\n BN.prototype.maskn = function maskn(bits) {\n return this.clone().imaskn(bits);\n };\n BN.prototype.iaddn = function iaddn(num) {\n assert(typeof num === \"number\");\n assert(num < 67108864);\n if (num < 0) return this.isubn(-num);\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) < num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n }\n return this._iaddn(num);\n };\n BN.prototype._iaddn = function _iaddn(num) {\n this.words[0] += num;\n for (var i = 0; i < this.length && this.words[i] >= 67108864; i++) {\n this.words[i] -= 67108864;\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n this.length = Math.max(this.length, i + 1);\n return this;\n };\n BN.prototype.isubn = function isubn(num) {\n assert(typeof num === \"number\");\n assert(num < 67108864);\n if (num < 0) return this.iaddn(-num);\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n this.words[0] -= num;\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 67108864;\n this.words[i + 1] -= 1;\n }\n }\n return this.strip();\n };\n BN.prototype.addn = function addn(num) {\n return this.clone().iaddn(num);\n };\n BN.prototype.subn = function subn(num) {\n return this.clone().isubn(num);\n };\n BN.prototype.iabs = function iabs() {\n this.negative = 0;\n return this;\n };\n BN.prototype.abs = function abs() {\n return this.clone().iabs();\n };\n BN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) {\n var len = num.length + shift;\n var i;\n this._expand(len);\n var w;\n var carry = 0;\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 67108863;\n carry = (w >> 26) - (right / 67108864 | 0);\n this.words[i + shift] = w & 67108863;\n }\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 67108863;\n }\n if (carry === 0) return this.strip();\n assert(carry === -1);\n carry = 0;\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 67108863;\n }\n this.negative = 1;\n return this.strip();\n };\n BN.prototype._wordDiv = function _wordDiv(num, mode) {\n var shift = this.length - num.length;\n var a = this.clone();\n var b = num;\n var bhi = b.words[b.length - 1] | 0;\n var bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits;\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n }\n var m = a.length - b.length;\n var q;\n if (mode !== \"mod\") {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (diff.negative === 0) {\n a = diff;\n if (q) {\n q.words[m] = 1;\n }\n }\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 67108864 + (a.words[b.length + j - 1] | 0);\n qj = Math.min(qj / bhi | 0, 67108863);\n a._ishlnsubmul(b, qj, j);\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n a._ishlnsubmul(b, 1, j);\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n if (q) {\n q.words[j] = qj;\n }\n }\n if (q) {\n q.strip();\n }\n a.strip();\n if (mode !== \"div\" && shift !== 0) {\n a.iushrn(shift);\n }\n return {\n div: q || null,\n mod: a\n };\n };\n BN.prototype.divmod = function divmod(num, mode, positive) {\n assert(!num.isZero());\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n var div, mod, res;\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n if (mode !== \"mod\") {\n div = res.div.neg();\n }\n if (mode !== \"div\") {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n return {\n div,\n mod\n };\n }\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n if (mode !== \"mod\") {\n div = res.div.neg();\n }\n return {\n div,\n mod: res.mod\n };\n }\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n if (mode !== \"div\") {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n return {\n div: res.div,\n mod\n };\n }\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n }\n if (num.length === 1) {\n if (mode === \"div\") {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n if (mode === \"mod\") {\n return {\n div: null,\n mod: new BN(this.modn(num.words[0]))\n };\n }\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modn(num.words[0]))\n };\n }\n return this._wordDiv(num, mode);\n };\n BN.prototype.div = function div(num) {\n return this.divmod(num, \"div\", false).div;\n };\n BN.prototype.mod = function mod(num) {\n return this.divmod(num, \"mod\", false).mod;\n };\n BN.prototype.umod = function umod(num) {\n return this.divmod(num, \"mod\", true).mod;\n };\n BN.prototype.divRound = function divRound(num) {\n var dm = this.divmod(num);\n if (dm.mod.isZero()) return dm.div;\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n BN.prototype.modn = function modn(num) {\n assert(num <= 67108863);\n var p = (1 << 26) % num;\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n return acc;\n };\n BN.prototype.idivn = function idivn(num) {\n assert(num <= 67108863);\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 67108864;\n this.words[i] = w / num | 0;\n carry = w % num;\n }\n return this.strip();\n };\n BN.prototype.divn = function divn(num) {\n return this.clone().idivn(num);\n };\n BN.prototype.egcd = function egcd(p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n var x = this;\n var y = p.clone();\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n }\n var A2 = new BN(1);\n var B2 = new BN(0);\n var C2 = new BN(0);\n var D2 = new BN(1);\n var g = 0;\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n var yp = y.clone();\n var xp = x.clone();\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1) ;\n if (i > 0) {\n x.iushrn(i);\n while (i-- > 0) {\n if (A2.isOdd() || B2.isOdd()) {\n A2.iadd(yp);\n B2.isub(xp);\n }\n A2.iushrn(1);\n B2.iushrn(1);\n }\n }\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) ;\n if (j > 0) {\n y.iushrn(j);\n while (j-- > 0) {\n if (C2.isOdd() || D2.isOdd()) {\n C2.iadd(yp);\n D2.isub(xp);\n }\n C2.iushrn(1);\n D2.iushrn(1);\n }\n }\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A2.isub(C2);\n B2.isub(D2);\n } else {\n y.isub(x);\n C2.isub(A2);\n D2.isub(B2);\n }\n }\n return {\n a: C2,\n b: D2,\n gcd: y.iushln(g)\n };\n };\n BN.prototype._invmp = function _invmp(p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n var a = this;\n var b = p.clone();\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n var x1 = new BN(1);\n var x2 = new BN(0);\n var delta = b.clone();\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1) ;\n if (i > 0) {\n a.iushrn(i);\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n x1.iushrn(1);\n }\n }\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) ;\n if (j > 0) {\n b.iushrn(j);\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n x2.iushrn(1);\n }\n }\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n var res;\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n return res;\n };\n BN.prototype.gcd = function gcd(num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0;\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n while (b.isEven()) {\n b.iushrn(1);\n }\n var r = a.cmp(b);\n if (r < 0) {\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n a.isub(b);\n } while (true);\n return b.iushln(shift);\n };\n BN.prototype.invm = function invm(num) {\n return this.egcd(num).a.umod(num);\n };\n BN.prototype.isEven = function isEven() {\n return (this.words[0] & 1) === 0;\n };\n BN.prototype.isOdd = function isOdd() {\n return (this.words[0] & 1) === 1;\n };\n BN.prototype.andln = function andln(num) {\n return this.words[0] & num;\n };\n BN.prototype.bincn = function bincn(bit) {\n assert(typeof bit === \"number\");\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n if (this.length <= s) {\n this._expand(s + 1);\n this.words[s] |= q;\n return this;\n }\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 67108863;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n };\n BN.prototype.isZero = function isZero() {\n return this.length === 1 && this.words[0] === 0;\n };\n BN.prototype.cmpn = function cmpn(num) {\n var negative = num < 0;\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n this.strip();\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n assert(num <= 67108863, \"Number is too big\");\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n BN.prototype.cmp = function cmp(num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n BN.prototype.ucmp = function ucmp(num) {\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n if (a === b) continue;\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n break;\n }\n return res;\n };\n BN.prototype.gtn = function gtn(num) {\n return this.cmpn(num) === 1;\n };\n BN.prototype.gt = function gt(num) {\n return this.cmp(num) === 1;\n };\n BN.prototype.gten = function gten(num) {\n return this.cmpn(num) >= 0;\n };\n BN.prototype.gte = function gte(num) {\n return this.cmp(num) >= 0;\n };\n BN.prototype.ltn = function ltn(num) {\n return this.cmpn(num) === -1;\n };\n BN.prototype.lt = function lt(num) {\n return this.cmp(num) === -1;\n };\n BN.prototype.lten = function lten(num) {\n return this.cmpn(num) <= 0;\n };\n BN.prototype.lte = function lte(num) {\n return this.cmp(num) <= 0;\n };\n BN.prototype.eqn = function eqn(num) {\n return this.cmpn(num) === 0;\n };\n BN.prototype.eq = function eq(num) {\n return this.cmp(num) === 0;\n };\n BN.red = function red(num) {\n return new Red(num);\n };\n BN.prototype.toRed = function toRed(ctx) {\n assert(!this.red, \"Already a number in reduction context\");\n assert(this.negative === 0, \"red works only with positives\");\n return ctx.convertTo(this)._forceRed(ctx);\n };\n BN.prototype.fromRed = function fromRed() {\n assert(this.red, \"fromRed works only with numbers in reduction context\");\n return this.red.convertFrom(this);\n };\n BN.prototype._forceRed = function _forceRed(ctx) {\n this.red = ctx;\n return this;\n };\n BN.prototype.forceRed = function forceRed(ctx) {\n assert(!this.red, \"Already a number in reduction context\");\n return this._forceRed(ctx);\n };\n BN.prototype.redAdd = function redAdd(num) {\n assert(this.red, \"redAdd works only with red numbers\");\n return this.red.add(this, num);\n };\n BN.prototype.redIAdd = function redIAdd(num) {\n assert(this.red, \"redIAdd works only with red numbers\");\n return this.red.iadd(this, num);\n };\n BN.prototype.redSub = function redSub(num) {\n assert(this.red, \"redSub works only with red numbers\");\n return this.red.sub(this, num);\n };\n BN.prototype.redISub = function redISub(num) {\n assert(this.red, \"redISub works only with red numbers\");\n return this.red.isub(this, num);\n };\n BN.prototype.redShl = function redShl(num) {\n assert(this.red, \"redShl works only with red numbers\");\n return this.red.shl(this, num);\n };\n BN.prototype.redMul = function redMul(num) {\n assert(this.red, \"redMul works only with red numbers\");\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n };\n BN.prototype.redIMul = function redIMul(num) {\n assert(this.red, \"redMul works only with red numbers\");\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n };\n BN.prototype.redSqr = function redSqr() {\n assert(this.red, \"redSqr works only with red numbers\");\n this.red._verify1(this);\n return this.red.sqr(this);\n };\n BN.prototype.redISqr = function redISqr() {\n assert(this.red, \"redISqr works only with red numbers\");\n this.red._verify1(this);\n return this.red.isqr(this);\n };\n BN.prototype.redSqrt = function redSqrt() {\n assert(this.red, \"redSqrt works only with red numbers\");\n this.red._verify1(this);\n return this.red.sqrt(this);\n };\n BN.prototype.redInvm = function redInvm() {\n assert(this.red, \"redInvm works only with red numbers\");\n this.red._verify1(this);\n return this.red.invm(this);\n };\n BN.prototype.redNeg = function redNeg() {\n assert(this.red, \"redNeg works only with red numbers\");\n this.red._verify1(this);\n return this.red.neg(this);\n };\n BN.prototype.redPow = function redPow(num) {\n assert(this.red && !num.red, \"redPow(normalNum)\");\n this.red._verify1(this);\n return this.red.pow(this, num);\n };\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n function MPrime(name2, p) {\n this.name = name2;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n this.tmp = this._tmp();\n }\n MPrime.prototype._tmp = function _tmp() {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n MPrime.prototype.ireduce = function ireduce(num) {\n var r = num;\n var rlen;\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== void 0) {\n r.strip();\n } else {\n r._strip();\n }\n }\n return r;\n };\n MPrime.prototype.split = function split(input, out) {\n input.iushrn(this.n, 0, out);\n };\n MPrime.prototype.imulK = function imulK(num) {\n return num.imul(this.k);\n };\n function K256() {\n MPrime.call(\n this,\n \"k256\",\n \"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f\"\n );\n }\n inherits(K256, MPrime);\n K256.prototype.split = function split(input, output) {\n var mask = 4194303;\n var outLen = Math.min(input.length, 9);\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n output.length = outLen;\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n }\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = (next & mask) << 4 | prev >>> 22;\n prev = next;\n }\n prev >>>= 22;\n input.words[i - 10] = prev;\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n K256.prototype.imulK = function imulK(num) {\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 977;\n num.words[i] = lo & 67108863;\n lo = w * 64 + (lo / 67108864 | 0);\n }\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n return num;\n };\n function P224() {\n MPrime.call(\n this,\n \"p224\",\n \"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001\"\n );\n }\n inherits(P224, MPrime);\n function P192() {\n MPrime.call(\n this,\n \"p192\",\n \"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff\"\n );\n }\n inherits(P192, MPrime);\n function P25519() {\n MPrime.call(\n this,\n \"25519\",\n \"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\"\n );\n }\n inherits(P25519, MPrime);\n P25519.prototype.imulK = function imulK(num) {\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 19 + carry;\n var lo = hi & 67108863;\n hi >>>= 26;\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n return num;\n };\n BN._prime = function prime(name2) {\n if (primes[name2]) return primes[name2];\n var prime2;\n if (name2 === \"k256\") {\n prime2 = new K256();\n } else if (name2 === \"p224\") {\n prime2 = new P224();\n } else if (name2 === \"p192\") {\n prime2 = new P192();\n } else if (name2 === \"p25519\") {\n prime2 = new P25519();\n } else {\n throw new Error(\"Unknown prime \" + name2);\n }\n primes[name2] = prime2;\n return prime2;\n };\n function Red(m) {\n if (typeof m === \"string\") {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), \"modulus must be greater than 1\");\n this.m = m;\n this.prime = null;\n }\n }\n Red.prototype._verify1 = function _verify1(a) {\n assert(a.negative === 0, \"red works only with positives\");\n assert(a.red, \"red works only with red numbers\");\n };\n Red.prototype._verify2 = function _verify2(a, b) {\n assert((a.negative | b.negative) === 0, \"red works only with positives\");\n assert(\n a.red && a.red === b.red,\n \"red works only with red numbers\"\n );\n };\n Red.prototype.imod = function imod(a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n return a.umod(this.m)._forceRed(this);\n };\n Red.prototype.neg = function neg(a) {\n if (a.isZero()) {\n return a.clone();\n }\n return this.m.sub(a)._forceRed(this);\n };\n Red.prototype.add = function add(a, b) {\n this._verify2(a, b);\n var res = a.add(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res._forceRed(this);\n };\n Red.prototype.iadd = function iadd(a, b) {\n this._verify2(a, b);\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res;\n };\n Red.prototype.sub = function sub(a, b) {\n this._verify2(a, b);\n var res = a.sub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res._forceRed(this);\n };\n Red.prototype.isub = function isub(a, b) {\n this._verify2(a, b);\n var res = a.isub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res;\n };\n Red.prototype.shl = function shl(a, num) {\n this._verify1(a);\n return this.imod(a.ushln(num));\n };\n Red.prototype.imul = function imul(a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n };\n Red.prototype.mul = function mul(a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n };\n Red.prototype.isqr = function isqr(a) {\n return this.imul(a, a.clone());\n };\n Red.prototype.sqr = function sqr(a) {\n return this.mul(a, a);\n };\n Red.prototype.sqrt = function sqrt(a) {\n if (a.isZero()) return a.clone();\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n var q = this.m.subn(1);\n var s = 0;\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n assert(!q.isZero());\n var one2 = new BN(1).toRed(this);\n var nOne = one2.redNeg();\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one2) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one2) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n return r;\n };\n Red.prototype.invm = function invm(a) {\n var inv = a._invmp(this.m);\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n Red.prototype.pow = function pow(a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n if (start === 0) {\n start = 26;\n }\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n for (var j = start - 1; j >= 0; j--) {\n var bit = word >> j & 1;\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n start = 26;\n }\n return res;\n };\n Red.prototype.convertTo = function convertTo(num) {\n var r = num.umod(this.m);\n return r === num ? r.clone() : r;\n };\n Red.prototype.convertFrom = function convertFrom(num) {\n var res = num.clone();\n res.red = null;\n return res;\n };\n BN.mont = function mont(num) {\n return new Mont(num);\n };\n function Mont(m) {\n Red.call(this, m);\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0) {\n this.shift += 26 - this.shift % 26;\n }\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red);\n Mont.prototype.convertTo = function convertTo(num) {\n return this.imod(num.ushln(this.shift));\n };\n Mont.prototype.convertFrom = function convertFrom(num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n Mont.prototype.imul = function imul(a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n return res._forceRed(this);\n };\n Mont.prototype.mul = function mul(a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n return res._forceRed(this);\n };\n Mont.prototype.invm = function invm(a) {\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n })(module2, this);\n }\n ),\n /***/\n 6204: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = boundary;\n function boundary(cells) {\n var i, j, k;\n var n = cells.length;\n var sz = 0;\n for (i = 0; i < n; ++i) {\n sz += cells[i].length;\n }\n var result = new Array(sz);\n var ptr = 0;\n for (i = 0; i < n; ++i) {\n var c = cells[i];\n var d = c.length;\n for (j = 0; j < d; ++j) {\n var b = result[ptr++] = new Array(d - 1);\n var p = 0;\n for (k = 0; k < d; ++k) {\n if (k === j) {\n continue;\n }\n b[p++] = c[k];\n }\n if (j & 1) {\n var tmp = b[1];\n b[1] = b[0];\n b[0] = tmp;\n }\n }\n }\n return result;\n }\n }\n ),\n /***/\n 6867: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = boxIntersectWrapper;\n var pool = __webpack_require__2(1888);\n var sweep = __webpack_require__2(855);\n var boxIntersectIter = __webpack_require__2(7150);\n function boxEmpty(d, box) {\n for (var j = 0; j < d; ++j) {\n if (!(box[j] <= box[j + d])) {\n return true;\n }\n }\n return false;\n }\n function convertBoxes(boxes, d, data, ids) {\n var ptr = 0;\n var count = 0;\n for (var i = 0, n = boxes.length; i < n; ++i) {\n var b = boxes[i];\n if (boxEmpty(d, b)) {\n continue;\n }\n for (var j = 0; j < 2 * d; ++j) {\n data[ptr++] = b[j];\n }\n ids[count++] = i;\n }\n return count;\n }\n function boxIntersect(red, blue, visit, full) {\n var n = red.length;\n var m = blue.length;\n if (n <= 0 || m <= 0) {\n return;\n }\n var d = red[0].length >>> 1;\n if (d <= 0) {\n return;\n }\n var retval;\n var redList = pool.mallocDouble(2 * d * n);\n var redIds = pool.mallocInt32(n);\n n = convertBoxes(red, d, redList, redIds);\n if (n > 0) {\n if (d === 1 && full) {\n sweep.init(n);\n retval = sweep.sweepComplete(\n d,\n visit,\n 0,\n n,\n redList,\n redIds,\n 0,\n n,\n redList,\n redIds\n );\n } else {\n var blueList = pool.mallocDouble(2 * d * m);\n var blueIds = pool.mallocInt32(m);\n m = convertBoxes(blue, d, blueList, blueIds);\n if (m > 0) {\n sweep.init(n + m);\n if (d === 1) {\n retval = sweep.sweepBipartite(\n d,\n visit,\n 0,\n n,\n redList,\n redIds,\n 0,\n m,\n blueList,\n blueIds\n );\n } else {\n retval = boxIntersectIter(\n d,\n visit,\n full,\n n,\n redList,\n redIds,\n m,\n blueList,\n blueIds\n );\n }\n pool.free(blueList);\n pool.free(blueIds);\n }\n }\n pool.free(redList);\n pool.free(redIds);\n }\n return retval;\n }\n var RESULT;\n function appendItem(i, j) {\n RESULT.push([i, j]);\n }\n function intersectFullArray(x) {\n RESULT = [];\n boxIntersect(x, x, appendItem, true);\n return RESULT;\n }\n function intersectBipartiteArray(x, y) {\n RESULT = [];\n boxIntersect(x, y, appendItem, false);\n return RESULT;\n }\n function boxIntersectWrapper(arg0, arg1, arg2) {\n switch (arguments.length) {\n case 1:\n return intersectFullArray(arg0);\n case 2:\n if (typeof arg1 === \"function\") {\n return boxIntersect(arg0, arg0, arg1, true);\n } else {\n return intersectBipartiteArray(arg0, arg1);\n }\n case 3:\n return boxIntersect(arg0, arg1, arg2, false);\n default:\n throw new Error(\"box-intersect: Invalid arguments\");\n }\n }\n }\n ),\n /***/\n 2455: (\n /***/\n function(__unused_webpack_module, exports2) {\n \"use strict\";\n function full() {\n function bruteForceRedFull(d, ax, vv, rs, re, rb, ri, bs, be, bb, bi) {\n var es = 2 * d;\n for (var i = rs, rp = es * rs; i < re; ++i, rp += es) {\n var x0 = rb[ax + rp], x1 = rb[ax + rp + d], xi = ri[i];\n Q: for (var j = bs, bp = es * bs; j < be; ++j, bp += es) {\n var y0 = bb[ax + bp], y1 = bb[ax + bp + d], yi = bi[j];\n if (y1 < x0 || x1 < y0) continue;\n for (var k = ax + 1; k < d; ++k) {\n var r0 = rb[k + rp], r1 = rb[k + d + rp], b0 = bb[k + bp], b1 = bb[k + d + bp];\n if (r1 < b0 || b1 < r0) continue Q;\n }\n var rv = vv(xi, yi);\n if (rv !== void 0) return rv;\n }\n }\n }\n function bruteForceBlueFull(d, ax, vv, rs, re, rb, ri, bs, be, bb, bi) {\n var es = 2 * d;\n for (var j = bs, bp = es * bs; j < be; ++j, bp += es) {\n var y0 = bb[ax + bp], y1 = bb[ax + bp + d], yi = bi[j];\n Q: for (var i = rs, rp = es * rs; i < re; ++i, rp += es) {\n var x0 = rb[ax + rp], x1 = rb[ax + rp + d], xi = ri[i];\n if (y1 < x0 || x1 < y0) continue;\n for (var k = ax + 1; k < d; ++k) {\n var r0 = rb[k + rp], r1 = rb[k + d + rp], b0 = bb[k + bp], b1 = bb[k + d + bp];\n if (r1 < b0 || b1 < r0) continue Q;\n }\n var rv = vv(xi, yi);\n if (rv !== void 0) return rv;\n }\n }\n }\n function bruteForceFull(d, ax, vv, rs, re, rb, ri, bs, be, bb, bi) {\n if (re - rs > be - bs) {\n return bruteForceRedFull(d, ax, vv, rs, re, rb, ri, bs, be, bb, bi);\n } else {\n return bruteForceBlueFull(d, ax, vv, rs, re, rb, ri, bs, be, bb, bi);\n }\n }\n return bruteForceFull;\n }\n function partial() {\n function bruteForceRedFlip(d, ax, vv, rs, re, rb, ri, bs, be, bb, bi) {\n var es = 2 * d;\n for (var i = rs, rp = es * rs; i < re; ++i, rp += es) {\n var x0 = rb[ax + rp], x1 = rb[ax + rp + d], xi = ri[i];\n Q: for (var j = bs, bp = es * bs; j < be; ++j, bp += es) {\n var y0 = bb[ax + bp], yi = bi[j];\n if (y0 <= x0 || x1 < y0) continue;\n for (var k = ax + 1; k < d; ++k) {\n var r0 = rb[k + rp], r1 = rb[k + d + rp], b0 = bb[k + bp], b1 = bb[k + d + bp];\n if (r1 < b0 || b1 < r0) continue Q;\n }\n var rv = vv(yi, xi);\n if (rv !== void 0) return rv;\n }\n }\n }\n function bruteForceRed(d, ax, vv, rs, re, rb, ri, bs, be, bb, bi) {\n var es = 2 * d;\n for (var i = rs, rp = es * rs; i < re; ++i, rp += es) {\n var x0 = rb[ax + rp], x1 = rb[ax + rp + d], xi = ri[i];\n Q: for (var j = bs, bp = es * bs; j < be; ++j, bp += es) {\n var y0 = bb[ax + bp], yi = bi[j];\n if (y0 < x0 || x1 < y0) continue;\n for (var k = ax + 1; k < d; ++k) {\n var r0 = rb[k + rp], r1 = rb[k + d + rp], b0 = bb[k + bp], b1 = bb[k + d + bp];\n if (r1 < b0 || b1 < r0) continue Q;\n }\n var rv = vv(xi, yi);\n if (rv !== void 0) return rv;\n }\n }\n }\n function bruteForceBlueFlip(d, ax, vv, rs, re, rb, ri, bs, be, bb, bi) {\n var es = 2 * d;\n for (var j = bs, bp = es * bs; j < be; ++j, bp += es) {\n var y0 = bb[ax + bp], yi = bi[j];\n Q: for (var i = rs, rp = es * rs; i < re; ++i, rp += es) {\n var x0 = rb[ax + rp], x1 = rb[ax + rp + d], xi = ri[i];\n if (y0 <= x0 || x1 < y0) continue;\n for (var k = ax + 1; k < d; ++k) {\n var r0 = rb[k + rp], r1 = rb[k + d + rp], b0 = bb[k + bp], b1 = bb[k + d + bp];\n if (r1 < b0 || b1 < r0) continue Q;\n }\n var rv = vv(yi, xi);\n if (rv !== void 0) return rv;\n }\n }\n }\n function bruteForceBlue(d, ax, vv, rs, re, rb, ri, bs, be, bb, bi) {\n var es = 2 * d;\n for (var j = bs, bp = es * bs; j < be; ++j, bp += es) {\n var y0 = bb[ax + bp], yi = bi[j];\n Q: for (var i = rs, rp = es * rs; i < re; ++i, rp += es) {\n var x0 = rb[ax + rp], x1 = rb[ax + rp + d], xi = ri[i];\n if (y0 < x0 || x1 < y0) continue;\n for (var k = ax + 1; k < d; ++k) {\n var r0 = rb[k + rp], r1 = rb[k + d + rp], b0 = bb[k + bp], b1 = bb[k + d + bp];\n if (r1 < b0 || b1 < r0) continue Q;\n }\n var rv = vv(xi, yi);\n if (rv !== void 0) return rv;\n }\n }\n }\n function bruteForcePartial(d, ax, vv, fp, rs, re, rb, ri, bs, be, bb, bi) {\n if (re - rs > be - bs) {\n if (fp) {\n return bruteForceRedFlip(d, ax, vv, rs, re, rb, ri, bs, be, bb, bi);\n } else {\n return bruteForceRed(d, ax, vv, rs, re, rb, ri, bs, be, bb, bi);\n }\n } else {\n if (fp) {\n return bruteForceBlueFlip(d, ax, vv, rs, re, rb, ri, bs, be, bb, bi);\n } else {\n return bruteForceBlue(d, ax, vv, rs, re, rb, ri, bs, be, bb, bi);\n }\n }\n }\n return bruteForcePartial;\n }\n function bruteForcePlanner(isFull) {\n return isFull ? full() : partial();\n }\n exports2.partial = bruteForcePlanner(false);\n exports2.full = bruteForcePlanner(true);\n }\n ),\n /***/\n 7150: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = boxIntersectIter;\n var pool = __webpack_require__2(1888);\n var bits = __webpack_require__2(8828);\n var bruteForce = __webpack_require__2(2455);\n var bruteForcePartial = bruteForce.partial;\n var bruteForceFull = bruteForce.full;\n var sweep = __webpack_require__2(855);\n var findMedian = __webpack_require__2(3545);\n var genPartition = __webpack_require__2(8105);\n var BRUTE_FORCE_CUTOFF = 128;\n var SCAN_CUTOFF = 1 << 22;\n var SCAN_COMPLETE_CUTOFF = 1 << 22;\n var partitionInteriorContainsInterval = genPartition(\n \"!(lo>=p0)&&!(p1>=hi)\"\n );\n var partitionStartEqual = genPartition(\n \"lo===p0\"\n );\n var partitionStartLessThan = genPartition(\n \"lo 0) {\n top -= 1;\n var iptr = top * IFRAME_SIZE;\n var axis = BOX_ISTACK[iptr];\n var redStart = BOX_ISTACK[iptr + 1];\n var redEnd = BOX_ISTACK[iptr + 2];\n var blueStart = BOX_ISTACK[iptr + 3];\n var blueEnd = BOX_ISTACK[iptr + 4];\n var state = BOX_ISTACK[iptr + 5];\n var dptr = top * DFRAME_SIZE;\n var lo = BOX_DSTACK[dptr];\n var hi = BOX_DSTACK[dptr + 1];\n var flip = state & 1;\n var full = !!(state & 16);\n var red = xBoxes;\n var redIndex = xIndex;\n var blue = yBoxes;\n var blueIndex = yIndex;\n if (flip) {\n red = yBoxes;\n redIndex = yIndex;\n blue = xBoxes;\n blueIndex = xIndex;\n }\n if (state & 2) {\n redEnd = partitionStartLessThan(\n d,\n axis,\n redStart,\n redEnd,\n red,\n redIndex,\n hi\n );\n if (redStart >= redEnd) {\n continue;\n }\n }\n if (state & 4) {\n redStart = partitionEndLessThanEqual(\n d,\n axis,\n redStart,\n redEnd,\n red,\n redIndex,\n lo\n );\n if (redStart >= redEnd) {\n continue;\n }\n }\n var redCount = redEnd - redStart;\n var blueCount = blueEnd - blueStart;\n if (full) {\n if (d * redCount * (redCount + blueCount) < SCAN_COMPLETE_CUTOFF) {\n retval = sweep.scanComplete(\n d,\n axis,\n visit,\n redStart,\n redEnd,\n red,\n redIndex,\n blueStart,\n blueEnd,\n blue,\n blueIndex\n );\n if (retval !== void 0) {\n return retval;\n }\n continue;\n }\n } else {\n if (d * Math.min(redCount, blueCount) < BRUTE_FORCE_CUTOFF) {\n retval = bruteForcePartial(\n d,\n axis,\n visit,\n flip,\n redStart,\n redEnd,\n red,\n redIndex,\n blueStart,\n blueEnd,\n blue,\n blueIndex\n );\n if (retval !== void 0) {\n return retval;\n }\n continue;\n } else if (d * redCount * blueCount < SCAN_CUTOFF) {\n retval = sweep.scanBipartite(\n d,\n axis,\n visit,\n flip,\n redStart,\n redEnd,\n red,\n redIndex,\n blueStart,\n blueEnd,\n blue,\n blueIndex\n );\n if (retval !== void 0) {\n return retval;\n }\n continue;\n }\n }\n var red0 = partitionInteriorContainsInterval(\n d,\n axis,\n redStart,\n redEnd,\n red,\n redIndex,\n lo,\n hi\n );\n if (redStart < red0) {\n if (d * (red0 - redStart) < BRUTE_FORCE_CUTOFF) {\n retval = bruteForceFull(\n d,\n axis + 1,\n visit,\n redStart,\n red0,\n red,\n redIndex,\n blueStart,\n blueEnd,\n blue,\n blueIndex\n );\n if (retval !== void 0) {\n return retval;\n }\n } else if (axis === d - 2) {\n if (flip) {\n retval = sweep.sweepBipartite(\n d,\n visit,\n blueStart,\n blueEnd,\n blue,\n blueIndex,\n redStart,\n red0,\n red,\n redIndex\n );\n } else {\n retval = sweep.sweepBipartite(\n d,\n visit,\n redStart,\n red0,\n red,\n redIndex,\n blueStart,\n blueEnd,\n blue,\n blueIndex\n );\n }\n if (retval !== void 0) {\n return retval;\n }\n } else {\n iterPush(\n top++,\n axis + 1,\n redStart,\n red0,\n blueStart,\n blueEnd,\n flip,\n -Infinity,\n Infinity\n );\n iterPush(\n top++,\n axis + 1,\n blueStart,\n blueEnd,\n redStart,\n red0,\n flip ^ 1,\n -Infinity,\n Infinity\n );\n }\n }\n if (red0 < redEnd) {\n var blue0 = findMedian(\n d,\n axis,\n blueStart,\n blueEnd,\n blue,\n blueIndex\n );\n var mid = blue[elemSize * blue0 + axis];\n var blue1 = partitionStartEqual(\n d,\n axis,\n blue0,\n blueEnd,\n blue,\n blueIndex,\n mid\n );\n if (blue1 < blueEnd) {\n iterPush(\n top++,\n axis,\n red0,\n redEnd,\n blue1,\n blueEnd,\n (flip | 4) + (full ? 16 : 0),\n mid,\n hi\n );\n }\n if (blueStart < blue0) {\n iterPush(\n top++,\n axis,\n red0,\n redEnd,\n blueStart,\n blue0,\n (flip | 2) + (full ? 16 : 0),\n lo,\n mid\n );\n }\n if (blue0 + 1 === blue1) {\n if (full) {\n retval = onePointFull(\n d,\n axis,\n visit,\n red0,\n redEnd,\n red,\n redIndex,\n blue0,\n blue,\n blueIndex[blue0]\n );\n } else {\n retval = onePointPartial(\n d,\n axis,\n visit,\n flip,\n red0,\n redEnd,\n red,\n redIndex,\n blue0,\n blue,\n blueIndex[blue0]\n );\n }\n if (retval !== void 0) {\n return retval;\n }\n } else if (blue0 < blue1) {\n var red1;\n if (full) {\n red1 = partitionContainsPoint(\n d,\n axis,\n red0,\n redEnd,\n red,\n redIndex,\n mid\n );\n if (red0 < red1) {\n var redX = partitionStartEqual(\n d,\n axis,\n red0,\n red1,\n red,\n redIndex,\n mid\n );\n if (axis === d - 2) {\n if (red0 < redX) {\n retval = sweep.sweepComplete(\n d,\n visit,\n red0,\n redX,\n red,\n redIndex,\n blue0,\n blue1,\n blue,\n blueIndex\n );\n if (retval !== void 0) {\n return retval;\n }\n }\n if (redX < red1) {\n retval = sweep.sweepBipartite(\n d,\n visit,\n redX,\n red1,\n red,\n redIndex,\n blue0,\n blue1,\n blue,\n blueIndex\n );\n if (retval !== void 0) {\n return retval;\n }\n }\n } else {\n if (red0 < redX) {\n iterPush(\n top++,\n axis + 1,\n red0,\n redX,\n blue0,\n blue1,\n 16,\n -Infinity,\n Infinity\n );\n }\n if (redX < red1) {\n iterPush(\n top++,\n axis + 1,\n redX,\n red1,\n blue0,\n blue1,\n 0,\n -Infinity,\n Infinity\n );\n iterPush(\n top++,\n axis + 1,\n blue0,\n blue1,\n redX,\n red1,\n 1,\n -Infinity,\n Infinity\n );\n }\n }\n }\n } else {\n if (flip) {\n red1 = partitionContainsPointProper(\n d,\n axis,\n red0,\n redEnd,\n red,\n redIndex,\n mid\n );\n } else {\n red1 = partitionContainsPoint(\n d,\n axis,\n red0,\n redEnd,\n red,\n redIndex,\n mid\n );\n }\n if (red0 < red1) {\n if (axis === d - 2) {\n if (flip) {\n retval = sweep.sweepBipartite(\n d,\n visit,\n blue0,\n blue1,\n blue,\n blueIndex,\n red0,\n red1,\n red,\n redIndex\n );\n } else {\n retval = sweep.sweepBipartite(\n d,\n visit,\n red0,\n red1,\n red,\n redIndex,\n blue0,\n blue1,\n blue,\n blueIndex\n );\n }\n } else {\n iterPush(\n top++,\n axis + 1,\n red0,\n red1,\n blue0,\n blue1,\n flip,\n -Infinity,\n Infinity\n );\n iterPush(\n top++,\n axis + 1,\n blue0,\n blue1,\n red0,\n red1,\n flip ^ 1,\n -Infinity,\n Infinity\n );\n }\n }\n }\n }\n }\n }\n }\n }\n ),\n /***/\n 3545: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = findMedian;\n var genPartition = __webpack_require__2(8105);\n var partitionStartLessThan = genPartition(\"lo start && boxes[ptr + axis] > x; --j, ptr -= elemSize) {\n var aPtr = ptr;\n var bPtr = ptr + elemSize;\n for (var k = 0; k < elemSize; ++k, ++aPtr, ++bPtr) {\n var y = boxes[aPtr];\n boxes[aPtr] = boxes[bPtr];\n boxes[bPtr] = y;\n }\n var tmp = ids[j];\n ids[j] = ids[j - 1];\n ids[j - 1] = tmp;\n }\n }\n }\n function findMedian(d, axis, start, end, boxes, ids) {\n if (end <= start + 1) {\n return start;\n }\n var lo = start;\n var hi = end;\n var mid = end + start >>> 1;\n var elemSize = 2 * d;\n var pivot = mid;\n var value = boxes[elemSize * mid + axis];\n while (lo < hi) {\n if (hi - lo < PARTITION_THRESHOLD) {\n insertionSort(d, axis, lo, hi, boxes, ids);\n value = boxes[elemSize * mid + axis];\n break;\n }\n var count = hi - lo;\n var pivot0 = Math.random() * count + lo | 0;\n var value0 = boxes[elemSize * pivot0 + axis];\n var pivot1 = Math.random() * count + lo | 0;\n var value1 = boxes[elemSize * pivot1 + axis];\n var pivot2 = Math.random() * count + lo | 0;\n var value2 = boxes[elemSize * pivot2 + axis];\n if (value0 <= value1) {\n if (value2 >= value1) {\n pivot = pivot1;\n value = value1;\n } else if (value0 >= value2) {\n pivot = pivot0;\n value = value0;\n } else {\n pivot = pivot2;\n value = value2;\n }\n } else {\n if (value1 >= value2) {\n pivot = pivot1;\n value = value1;\n } else if (value2 >= value0) {\n pivot = pivot0;\n value = value0;\n } else {\n pivot = pivot2;\n value = value2;\n }\n }\n var aPtr = elemSize * (hi - 1);\n var bPtr = elemSize * pivot;\n for (var i = 0; i < elemSize; ++i, ++aPtr, ++bPtr) {\n var x = boxes[aPtr];\n boxes[aPtr] = boxes[bPtr];\n boxes[bPtr] = x;\n }\n var y = ids[hi - 1];\n ids[hi - 1] = ids[pivot];\n ids[pivot] = y;\n pivot = partitionStartLessThan(\n d,\n axis,\n lo,\n hi - 1,\n boxes,\n ids,\n value\n );\n var aPtr = elemSize * (hi - 1);\n var bPtr = elemSize * pivot;\n for (var i = 0; i < elemSize; ++i, ++aPtr, ++bPtr) {\n var x = boxes[aPtr];\n boxes[aPtr] = boxes[bPtr];\n boxes[bPtr] = x;\n }\n var y = ids[hi - 1];\n ids[hi - 1] = ids[pivot];\n ids[pivot] = y;\n if (mid < pivot) {\n hi = pivot - 1;\n while (lo < hi && boxes[elemSize * (hi - 1) + axis] === value) {\n hi -= 1;\n }\n hi += 1;\n } else if (pivot < mid) {\n lo = pivot + 1;\n while (lo < hi && boxes[elemSize * lo + axis] === value) {\n lo += 1;\n }\n } else {\n break;\n }\n }\n return partitionStartLessThan(\n d,\n axis,\n start,\n mid,\n boxes,\n ids,\n boxes[elemSize * mid + axis]\n );\n }\n }\n ),\n /***/\n 8105: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = genPartition;\n var P2F = {\n \"lo===p0\": lo_equal_p0,\n \"lo=p0)&&!(p1>=hi)\": lo_lessThan_p0_and_p1_lessThan_hi\n };\n function genPartition(predicate) {\n return P2F[predicate];\n }\n function lo_equal_p0(a, b, c, d, e, f, p0) {\n for (var j = 2 * a, k = j * c, l = k, m = c, n = b, o = a + b, p = c; d > p; ++p, k += j) {\n var lo = e[k + n];\n if (lo === p0) if (m === p) m += 1, l += j;\n else {\n for (var s = 0; j > s; ++s) {\n var t = e[k + s];\n e[k + s] = e[l], e[l++] = t;\n }\n var u = f[p];\n f[p] = f[m], f[m++] = u;\n }\n }\n return m;\n }\n function lo_lessThan_p0(a, b, c, d, e, f, p0) {\n for (var j = 2 * a, k = j * c, l = k, m = c, n = b, o = a + b, p = c; d > p; ++p, k += j) {\n var lo = e[k + n];\n if (lo < p0) if (m === p) m += 1, l += j;\n else {\n for (var s = 0; j > s; ++s) {\n var t = e[k + s];\n e[k + s] = e[l], e[l++] = t;\n }\n var u = f[p];\n f[p] = f[m], f[m++] = u;\n }\n }\n return m;\n }\n function lo_lessOrEqual_p0(a, b, c, d, e, f, p0) {\n for (var j = 2 * a, k = j * c, l = k, m = c, n = b, o = a + b, p = c; d > p; ++p, k += j) {\n var hi = e[k + o];\n if (hi <= p0) if (m === p) m += 1, l += j;\n else {\n for (var s = 0; j > s; ++s) {\n var t = e[k + s];\n e[k + s] = e[l], e[l++] = t;\n }\n var u = f[p];\n f[p] = f[m], f[m++] = u;\n }\n }\n return m;\n }\n function hi_lessOrEqual_p0(a, b, c, d, e, f, p0) {\n for (var j = 2 * a, k = j * c, l = k, m = c, n = b, o = a + b, p = c; d > p; ++p, k += j) {\n var hi = e[k + o];\n if (hi <= p0) if (m === p) m += 1, l += j;\n else {\n for (var s = 0; j > s; ++s) {\n var t = e[k + s];\n e[k + s] = e[l], e[l++] = t;\n }\n var u = f[p];\n f[p] = f[m], f[m++] = u;\n }\n }\n return m;\n }\n function lo_lassOrEqual_p0_and_p0_lessOrEqual_hi(a, b, c, d, e, f, p0) {\n for (var j = 2 * a, k = j * c, l = k, m = c, n = b, o = a + b, p = c; d > p; ++p, k += j) {\n var lo = e[k + n], hi = e[k + o];\n if (lo <= p0 && p0 <= hi) if (m === p) m += 1, l += j;\n else {\n for (var s = 0; j > s; ++s) {\n var t = e[k + s];\n e[k + s] = e[l], e[l++] = t;\n }\n var u = f[p];\n f[p] = f[m], f[m++] = u;\n }\n }\n return m;\n }\n function lo_lessThan_p0_and_p0_lessOrEqual_hi(a, b, c, d, e, f, p0) {\n for (var j = 2 * a, k = j * c, l = k, m = c, n = b, o = a + b, p = c; d > p; ++p, k += j) {\n var lo = e[k + n], hi = e[k + o];\n if (lo < p0 && p0 <= hi) if (m === p) m += 1, l += j;\n else {\n for (var s = 0; j > s; ++s) {\n var t = e[k + s];\n e[k + s] = e[l], e[l++] = t;\n }\n var u = f[p];\n f[p] = f[m], f[m++] = u;\n }\n }\n return m;\n }\n function lo_lessThan_p0_and_p1_lessThan_hi(a, b, c, d, e, f, p0, p1) {\n for (var j = 2 * a, k = j * c, l = k, m = c, n = b, o = a + b, p = c; d > p; ++p, k += j) {\n var lo = e[k + n], hi = e[k + o];\n if (!(lo >= p0) && !(p1 >= hi)) if (m === p) m += 1, l += j;\n else {\n for (var s = 0; j > s; ++s) {\n var t = e[k + s];\n e[k + s] = e[l], e[l++] = t;\n }\n var u = f[p];\n f[p] = f[m], f[m++] = u;\n }\n }\n return m;\n }\n }\n ),\n /***/\n 4192: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = wrapper;\n var INSERT_SORT_CUTOFF = 32;\n function wrapper(data, n0) {\n if (n0 <= 4 * INSERT_SORT_CUTOFF) {\n insertionSort(0, n0 - 1, data);\n } else {\n quickSort(0, n0 - 1, data);\n }\n }\n function insertionSort(left, right, data) {\n var ptr = 2 * (left + 1);\n for (var i = left + 1; i <= right; ++i) {\n var a = data[ptr++];\n var b = data[ptr++];\n var j = i;\n var jptr = ptr - 2;\n while (j-- > left) {\n var x = data[jptr - 2];\n var y = data[jptr - 1];\n if (x < a) {\n break;\n } else if (x === a && y < b) {\n break;\n }\n data[jptr] = x;\n data[jptr + 1] = y;\n jptr -= 2;\n }\n data[jptr] = a;\n data[jptr + 1] = b;\n }\n }\n function swap(i, j, data) {\n i *= 2;\n j *= 2;\n var x = data[i];\n var y = data[i + 1];\n data[i] = data[j];\n data[i + 1] = data[j + 1];\n data[j] = x;\n data[j + 1] = y;\n }\n function move(i, j, data) {\n i *= 2;\n j *= 2;\n data[i] = data[j];\n data[i + 1] = data[j + 1];\n }\n function rotate(i, j, k, data) {\n i *= 2;\n j *= 2;\n k *= 2;\n var x = data[i];\n var y = data[i + 1];\n data[i] = data[j];\n data[i + 1] = data[j + 1];\n data[j] = data[k];\n data[j + 1] = data[k + 1];\n data[k] = x;\n data[k + 1] = y;\n }\n function shufflePivot(i, j, px, py, data) {\n i *= 2;\n j *= 2;\n data[i] = data[j];\n data[j] = px;\n data[i + 1] = data[j + 1];\n data[j + 1] = py;\n }\n function compare(i, j, data) {\n i *= 2;\n j *= 2;\n var x = data[i], y = data[j];\n if (x < y) {\n return false;\n } else if (x === y) {\n return data[i + 1] > data[j + 1];\n }\n return true;\n }\n function comparePivot(i, y, b, data) {\n i *= 2;\n var x = data[i];\n if (x < y) {\n return true;\n } else if (x === y) {\n return data[i + 1] < b;\n }\n return false;\n }\n function quickSort(left, right, data) {\n var sixth = (right - left + 1) / 6 | 0, index1 = left + sixth, index5 = right - sixth, index3 = left + right >> 1, index2 = index3 - sixth, index4 = index3 + sixth, el1 = index1, el2 = index2, el3 = index3, el4 = index4, el5 = index5, less = left + 1, great = right - 1, tmp = 0;\n if (compare(el1, el2, data)) {\n tmp = el1;\n el1 = el2;\n el2 = tmp;\n }\n if (compare(el4, el5, data)) {\n tmp = el4;\n el4 = el5;\n el5 = tmp;\n }\n if (compare(el1, el3, data)) {\n tmp = el1;\n el1 = el3;\n el3 = tmp;\n }\n if (compare(el2, el3, data)) {\n tmp = el2;\n el2 = el3;\n el3 = tmp;\n }\n if (compare(el1, el4, data)) {\n tmp = el1;\n el1 = el4;\n el4 = tmp;\n }\n if (compare(el3, el4, data)) {\n tmp = el3;\n el3 = el4;\n el4 = tmp;\n }\n if (compare(el2, el5, data)) {\n tmp = el2;\n el2 = el5;\n el5 = tmp;\n }\n if (compare(el2, el3, data)) {\n tmp = el2;\n el2 = el3;\n el3 = tmp;\n }\n if (compare(el4, el5, data)) {\n tmp = el4;\n el4 = el5;\n el5 = tmp;\n }\n var pivot1X = data[2 * el2];\n var pivot1Y = data[2 * el2 + 1];\n var pivot2X = data[2 * el4];\n var pivot2Y = data[2 * el4 + 1];\n var ptr0 = 2 * el1;\n var ptr2 = 2 * el3;\n var ptr4 = 2 * el5;\n var ptr5 = 2 * index1;\n var ptr6 = 2 * index3;\n var ptr7 = 2 * index5;\n for (var i1 = 0; i1 < 2; ++i1) {\n var x = data[ptr0 + i1];\n var y = data[ptr2 + i1];\n var z = data[ptr4 + i1];\n data[ptr5 + i1] = x;\n data[ptr6 + i1] = y;\n data[ptr7 + i1] = z;\n }\n move(index2, left, data);\n move(index4, right, data);\n for (var k = less; k <= great; ++k) {\n if (comparePivot(k, pivot1X, pivot1Y, data)) {\n if (k !== less) {\n swap(k, less, data);\n }\n ++less;\n } else {\n if (!comparePivot(k, pivot2X, pivot2Y, data)) {\n while (true) {\n if (!comparePivot(great, pivot2X, pivot2Y, data)) {\n if (--great < k) {\n break;\n }\n continue;\n } else {\n if (comparePivot(great, pivot1X, pivot1Y, data)) {\n rotate(k, less, great, data);\n ++less;\n --great;\n } else {\n swap(k, great, data);\n --great;\n }\n break;\n }\n }\n }\n }\n }\n shufflePivot(left, less - 1, pivot1X, pivot1Y, data);\n shufflePivot(right, great + 1, pivot2X, pivot2Y, data);\n if (less - 2 - left <= INSERT_SORT_CUTOFF) {\n insertionSort(left, less - 2, data);\n } else {\n quickSort(left, less - 2, data);\n }\n if (right - (great + 2) <= INSERT_SORT_CUTOFF) {\n insertionSort(great + 2, right, data);\n } else {\n quickSort(great + 2, right, data);\n }\n if (great - less <= INSERT_SORT_CUTOFF) {\n insertionSort(less, great, data);\n } else {\n quickSort(less, great, data);\n }\n }\n }\n ),\n /***/\n 855: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = {\n init: sqInit,\n sweepBipartite,\n sweepComplete,\n scanBipartite,\n scanComplete\n };\n var pool = __webpack_require__2(1888);\n var bits = __webpack_require__2(8828);\n var isort = __webpack_require__2(4192);\n var BLUE_FLAG = 1 << 28;\n var INIT_CAPACITY = 1024;\n var RED_SWEEP_QUEUE = pool.mallocInt32(INIT_CAPACITY);\n var RED_SWEEP_INDEX = pool.mallocInt32(INIT_CAPACITY);\n var BLUE_SWEEP_QUEUE = pool.mallocInt32(INIT_CAPACITY);\n var BLUE_SWEEP_INDEX = pool.mallocInt32(INIT_CAPACITY);\n var COMMON_SWEEP_QUEUE = pool.mallocInt32(INIT_CAPACITY);\n var COMMON_SWEEP_INDEX = pool.mallocInt32(INIT_CAPACITY);\n var SWEEP_EVENTS = pool.mallocDouble(INIT_CAPACITY * 8);\n function sqInit(count) {\n var rcount = bits.nextPow2(count);\n if (RED_SWEEP_QUEUE.length < rcount) {\n pool.free(RED_SWEEP_QUEUE);\n RED_SWEEP_QUEUE = pool.mallocInt32(rcount);\n }\n if (RED_SWEEP_INDEX.length < rcount) {\n pool.free(RED_SWEEP_INDEX);\n RED_SWEEP_INDEX = pool.mallocInt32(rcount);\n }\n if (BLUE_SWEEP_QUEUE.length < rcount) {\n pool.free(BLUE_SWEEP_QUEUE);\n BLUE_SWEEP_QUEUE = pool.mallocInt32(rcount);\n }\n if (BLUE_SWEEP_INDEX.length < rcount) {\n pool.free(BLUE_SWEEP_INDEX);\n BLUE_SWEEP_INDEX = pool.mallocInt32(rcount);\n }\n if (COMMON_SWEEP_QUEUE.length < rcount) {\n pool.free(COMMON_SWEEP_QUEUE);\n COMMON_SWEEP_QUEUE = pool.mallocInt32(rcount);\n }\n if (COMMON_SWEEP_INDEX.length < rcount) {\n pool.free(COMMON_SWEEP_INDEX);\n COMMON_SWEEP_INDEX = pool.mallocInt32(rcount);\n }\n var eventLength = 8 * rcount;\n if (SWEEP_EVENTS.length < eventLength) {\n pool.free(SWEEP_EVENTS);\n SWEEP_EVENTS = pool.mallocDouble(eventLength);\n }\n }\n function sqPop(queue, index, count, item) {\n var idx = index[item];\n var top = queue[count - 1];\n queue[idx] = top;\n index[top] = idx;\n }\n function sqPush(queue, index, count, item) {\n queue[count] = item;\n index[item] = count;\n }\n function sweepBipartite(d, visit, redStart, redEnd, red, redIndex, blueStart, blueEnd, blue, blueIndex) {\n var ptr = 0;\n var elemSize = 2 * d;\n var istart = d - 1;\n var iend = elemSize - 1;\n for (var i = redStart; i < redEnd; ++i) {\n var idx = redIndex[i];\n var redOffset = elemSize * i;\n SWEEP_EVENTS[ptr++] = red[redOffset + istart];\n SWEEP_EVENTS[ptr++] = -(idx + 1);\n SWEEP_EVENTS[ptr++] = red[redOffset + iend];\n SWEEP_EVENTS[ptr++] = idx;\n }\n for (var i = blueStart; i < blueEnd; ++i) {\n var idx = blueIndex[i] + BLUE_FLAG;\n var blueOffset = elemSize * i;\n SWEEP_EVENTS[ptr++] = blue[blueOffset + istart];\n SWEEP_EVENTS[ptr++] = -idx;\n SWEEP_EVENTS[ptr++] = blue[blueOffset + iend];\n SWEEP_EVENTS[ptr++] = idx;\n }\n var n = ptr >>> 1;\n isort(SWEEP_EVENTS, n);\n var redActive = 0;\n var blueActive = 0;\n for (var i = 0; i < n; ++i) {\n var e = SWEEP_EVENTS[2 * i + 1] | 0;\n if (e >= BLUE_FLAG) {\n e = e - BLUE_FLAG | 0;\n sqPop(BLUE_SWEEP_QUEUE, BLUE_SWEEP_INDEX, blueActive--, e);\n } else if (e >= 0) {\n sqPop(RED_SWEEP_QUEUE, RED_SWEEP_INDEX, redActive--, e);\n } else if (e <= -BLUE_FLAG) {\n e = -e - BLUE_FLAG | 0;\n for (var j = 0; j < redActive; ++j) {\n var retval = visit(RED_SWEEP_QUEUE[j], e);\n if (retval !== void 0) {\n return retval;\n }\n }\n sqPush(BLUE_SWEEP_QUEUE, BLUE_SWEEP_INDEX, blueActive++, e);\n } else {\n e = -e - 1 | 0;\n for (var j = 0; j < blueActive; ++j) {\n var retval = visit(e, BLUE_SWEEP_QUEUE[j]);\n if (retval !== void 0) {\n return retval;\n }\n }\n sqPush(RED_SWEEP_QUEUE, RED_SWEEP_INDEX, redActive++, e);\n }\n }\n }\n function sweepComplete(d, visit, redStart, redEnd, red, redIndex, blueStart, blueEnd, blue, blueIndex) {\n var ptr = 0;\n var elemSize = 2 * d;\n var istart = d - 1;\n var iend = elemSize - 1;\n for (var i = redStart; i < redEnd; ++i) {\n var idx = redIndex[i] + 1 << 1;\n var redOffset = elemSize * i;\n SWEEP_EVENTS[ptr++] = red[redOffset + istart];\n SWEEP_EVENTS[ptr++] = -idx;\n SWEEP_EVENTS[ptr++] = red[redOffset + iend];\n SWEEP_EVENTS[ptr++] = idx;\n }\n for (var i = blueStart; i < blueEnd; ++i) {\n var idx = blueIndex[i] + 1 << 1;\n var blueOffset = elemSize * i;\n SWEEP_EVENTS[ptr++] = blue[blueOffset + istart];\n SWEEP_EVENTS[ptr++] = -idx | 1;\n SWEEP_EVENTS[ptr++] = blue[blueOffset + iend];\n SWEEP_EVENTS[ptr++] = idx | 1;\n }\n var n = ptr >>> 1;\n isort(SWEEP_EVENTS, n);\n var redActive = 0;\n var blueActive = 0;\n var commonActive = 0;\n for (var i = 0; i < n; ++i) {\n var e = SWEEP_EVENTS[2 * i + 1] | 0;\n var color2 = e & 1;\n if (i < n - 1 && e >> 1 === SWEEP_EVENTS[2 * i + 3] >> 1) {\n color2 = 2;\n i += 1;\n }\n if (e < 0) {\n var id = -(e >> 1) - 1;\n for (var j = 0; j < commonActive; ++j) {\n var retval = visit(COMMON_SWEEP_QUEUE[j], id);\n if (retval !== void 0) {\n return retval;\n }\n }\n if (color2 !== 0) {\n for (var j = 0; j < redActive; ++j) {\n var retval = visit(RED_SWEEP_QUEUE[j], id);\n if (retval !== void 0) {\n return retval;\n }\n }\n }\n if (color2 !== 1) {\n for (var j = 0; j < blueActive; ++j) {\n var retval = visit(BLUE_SWEEP_QUEUE[j], id);\n if (retval !== void 0) {\n return retval;\n }\n }\n }\n if (color2 === 0) {\n sqPush(RED_SWEEP_QUEUE, RED_SWEEP_INDEX, redActive++, id);\n } else if (color2 === 1) {\n sqPush(BLUE_SWEEP_QUEUE, BLUE_SWEEP_INDEX, blueActive++, id);\n } else if (color2 === 2) {\n sqPush(COMMON_SWEEP_QUEUE, COMMON_SWEEP_INDEX, commonActive++, id);\n }\n } else {\n var id = (e >> 1) - 1;\n if (color2 === 0) {\n sqPop(RED_SWEEP_QUEUE, RED_SWEEP_INDEX, redActive--, id);\n } else if (color2 === 1) {\n sqPop(BLUE_SWEEP_QUEUE, BLUE_SWEEP_INDEX, blueActive--, id);\n } else if (color2 === 2) {\n sqPop(COMMON_SWEEP_QUEUE, COMMON_SWEEP_INDEX, commonActive--, id);\n }\n }\n }\n }\n function scanBipartite(d, axis, visit, flip, redStart, redEnd, red, redIndex, blueStart, blueEnd, blue, blueIndex) {\n var ptr = 0;\n var elemSize = 2 * d;\n var istart = axis;\n var iend = axis + d;\n var redShift = 1;\n var blueShift = 1;\n if (flip) {\n blueShift = BLUE_FLAG;\n } else {\n redShift = BLUE_FLAG;\n }\n for (var i = redStart; i < redEnd; ++i) {\n var idx = i + redShift;\n var redOffset = elemSize * i;\n SWEEP_EVENTS[ptr++] = red[redOffset + istart];\n SWEEP_EVENTS[ptr++] = -idx;\n SWEEP_EVENTS[ptr++] = red[redOffset + iend];\n SWEEP_EVENTS[ptr++] = idx;\n }\n for (var i = blueStart; i < blueEnd; ++i) {\n var idx = i + blueShift;\n var blueOffset = elemSize * i;\n SWEEP_EVENTS[ptr++] = blue[blueOffset + istart];\n SWEEP_EVENTS[ptr++] = -idx;\n }\n var n = ptr >>> 1;\n isort(SWEEP_EVENTS, n);\n var redActive = 0;\n for (var i = 0; i < n; ++i) {\n var e = SWEEP_EVENTS[2 * i + 1] | 0;\n if (e < 0) {\n var idx = -e;\n var isRed = false;\n if (idx >= BLUE_FLAG) {\n isRed = !flip;\n idx -= BLUE_FLAG;\n } else {\n isRed = !!flip;\n idx -= 1;\n }\n if (isRed) {\n sqPush(RED_SWEEP_QUEUE, RED_SWEEP_INDEX, redActive++, idx);\n } else {\n var blueId = blueIndex[idx];\n var bluePtr = elemSize * idx;\n var b0 = blue[bluePtr + axis + 1];\n var b1 = blue[bluePtr + axis + 1 + d];\n red_loop:\n for (var j = 0; j < redActive; ++j) {\n var oidx = RED_SWEEP_QUEUE[j];\n var redPtr = elemSize * oidx;\n if (b1 < red[redPtr + axis + 1] || red[redPtr + axis + 1 + d] < b0) {\n continue;\n }\n for (var k = axis + 2; k < d; ++k) {\n if (blue[bluePtr + k + d] < red[redPtr + k] || red[redPtr + k + d] < blue[bluePtr + k]) {\n continue red_loop;\n }\n }\n var redId = redIndex[oidx];\n var retval;\n if (flip) {\n retval = visit(blueId, redId);\n } else {\n retval = visit(redId, blueId);\n }\n if (retval !== void 0) {\n return retval;\n }\n }\n }\n } else {\n sqPop(RED_SWEEP_QUEUE, RED_SWEEP_INDEX, redActive--, e - redShift);\n }\n }\n }\n function scanComplete(d, axis, visit, redStart, redEnd, red, redIndex, blueStart, blueEnd, blue, blueIndex) {\n var ptr = 0;\n var elemSize = 2 * d;\n var istart = axis;\n var iend = axis + d;\n for (var i = redStart; i < redEnd; ++i) {\n var idx = i + BLUE_FLAG;\n var redOffset = elemSize * i;\n SWEEP_EVENTS[ptr++] = red[redOffset + istart];\n SWEEP_EVENTS[ptr++] = -idx;\n SWEEP_EVENTS[ptr++] = red[redOffset + iend];\n SWEEP_EVENTS[ptr++] = idx;\n }\n for (var i = blueStart; i < blueEnd; ++i) {\n var idx = i + 1;\n var blueOffset = elemSize * i;\n SWEEP_EVENTS[ptr++] = blue[blueOffset + istart];\n SWEEP_EVENTS[ptr++] = -idx;\n }\n var n = ptr >>> 1;\n isort(SWEEP_EVENTS, n);\n var redActive = 0;\n for (var i = 0; i < n; ++i) {\n var e = SWEEP_EVENTS[2 * i + 1] | 0;\n if (e < 0) {\n var idx = -e;\n if (idx >= BLUE_FLAG) {\n RED_SWEEP_QUEUE[redActive++] = idx - BLUE_FLAG;\n } else {\n idx -= 1;\n var blueId = blueIndex[idx];\n var bluePtr = elemSize * idx;\n var b0 = blue[bluePtr + axis + 1];\n var b1 = blue[bluePtr + axis + 1 + d];\n red_loop:\n for (var j = 0; j < redActive; ++j) {\n var oidx = RED_SWEEP_QUEUE[j];\n var redId = redIndex[oidx];\n if (redId === blueId) {\n break;\n }\n var redPtr = elemSize * oidx;\n if (b1 < red[redPtr + axis + 1] || red[redPtr + axis + 1 + d] < b0) {\n continue;\n }\n for (var k = axis + 2; k < d; ++k) {\n if (blue[bluePtr + k + d] < red[redPtr + k] || red[redPtr + k + d] < blue[bluePtr + k]) {\n continue red_loop;\n }\n }\n var retval = visit(redId, blueId);\n if (retval !== void 0) {\n return retval;\n }\n }\n }\n } else {\n var idx = e - BLUE_FLAG;\n for (var j = redActive - 1; j >= 0; --j) {\n if (RED_SWEEP_QUEUE[j] === idx) {\n for (var k = j + 1; k < redActive; ++k) {\n RED_SWEEP_QUEUE[k - 1] = RED_SWEEP_QUEUE[k];\n }\n break;\n }\n }\n --redActive;\n }\n }\n }\n }\n ),\n /***/\n 2538: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var monotoneTriangulate = __webpack_require__2(8902);\n var makeIndex = __webpack_require__2(5542);\n var delaunayFlip = __webpack_require__2(2272);\n var filterTriangulation = __webpack_require__2(5023);\n module2.exports = cdt2d;\n function canonicalizeEdge(e) {\n return [Math.min(e[0], e[1]), Math.max(e[0], e[1])];\n }\n function compareEdge(a, b) {\n return a[0] - b[0] || a[1] - b[1];\n }\n function canonicalizeEdges(edges) {\n return edges.map(canonicalizeEdge).sort(compareEdge);\n }\n function getDefault(options, property, dflt) {\n if (property in options) {\n return options[property];\n }\n return dflt;\n }\n function cdt2d(points, edges, options) {\n if (!Array.isArray(edges)) {\n options = edges || {};\n edges = [];\n } else {\n options = options || {};\n edges = edges || [];\n }\n var delaunay = !!getDefault(options, \"delaunay\", true);\n var interior = !!getDefault(options, \"interior\", true);\n var exterior = !!getDefault(options, \"exterior\", true);\n var infinity = !!getDefault(options, \"infinity\", false);\n if (!interior && !exterior || points.length === 0) {\n return [];\n }\n var cells = monotoneTriangulate(points, edges);\n if (delaunay || interior !== exterior || infinity) {\n var triangulation = makeIndex(points.length, canonicalizeEdges(edges));\n for (var i = 0; i < cells.length; ++i) {\n var f = cells[i];\n triangulation.addTriangle(f[0], f[1], f[2]);\n }\n if (delaunay) {\n delaunayFlip(points, triangulation);\n }\n if (!exterior) {\n return filterTriangulation(triangulation, -1);\n } else if (!interior) {\n return filterTriangulation(triangulation, 1, infinity);\n } else if (infinity) {\n return filterTriangulation(triangulation, 0, infinity);\n } else {\n return triangulation.cells();\n }\n } else {\n return cells;\n }\n }\n }\n ),\n /***/\n 2272: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var inCircle = __webpack_require__2(2646)[4];\n var bsearch = __webpack_require__2(2478);\n module2.exports = delaunayRefine;\n function testFlip(points, triangulation, stack, a, b, x) {\n var y = triangulation.opposite(a, b);\n if (y < 0) {\n return;\n }\n if (b < a) {\n var tmp = a;\n a = b;\n b = tmp;\n tmp = x;\n x = y;\n y = tmp;\n }\n if (triangulation.isConstraint(a, b)) {\n return;\n }\n if (inCircle(points[a], points[b], points[x], points[y]) < 0) {\n stack.push(a, b);\n }\n }\n function delaunayRefine(points, triangulation) {\n var stack = [];\n var numPoints = points.length;\n var stars = triangulation.stars;\n for (var a = 0; a < numPoints; ++a) {\n var star = stars[a];\n for (var j = 1; j < star.length; j += 2) {\n var b = star[j];\n if (b < a) {\n continue;\n }\n if (triangulation.isConstraint(a, b)) {\n continue;\n }\n var x = star[j - 1], y = -1;\n for (var k = 1; k < star.length; k += 2) {\n if (star[k - 1] === b) {\n y = star[k];\n break;\n }\n }\n if (y < 0) {\n continue;\n }\n if (inCircle(points[a], points[b], points[x], points[y]) < 0) {\n stack.push(a, b);\n }\n }\n }\n while (stack.length > 0) {\n var b = stack.pop();\n var a = stack.pop();\n var x = -1, y = -1;\n var star = stars[a];\n for (var i = 1; i < star.length; i += 2) {\n var s = star[i - 1];\n var t = star[i];\n if (s === b) {\n y = t;\n } else if (t === b) {\n x = s;\n }\n }\n if (x < 0 || y < 0) {\n continue;\n }\n if (inCircle(points[a], points[b], points[x], points[y]) >= 0) {\n continue;\n }\n triangulation.flip(a, b);\n testFlip(points, triangulation, stack, x, a, y);\n testFlip(points, triangulation, stack, a, y, x);\n testFlip(points, triangulation, stack, y, b, x);\n testFlip(points, triangulation, stack, b, x, y);\n }\n }\n }\n ),\n /***/\n 5023: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var bsearch = __webpack_require__2(2478);\n module2.exports = classifyFaces;\n function FaceIndex(cells, neighbor, constraint, flags, active, next, boundary) {\n this.cells = cells;\n this.neighbor = neighbor;\n this.flags = flags;\n this.constraint = constraint;\n this.active = active;\n this.next = next;\n this.boundary = boundary;\n }\n var proto = FaceIndex.prototype;\n function compareCell(a, b) {\n return a[0] - b[0] || a[1] - b[1] || a[2] - b[2];\n }\n proto.locate = /* @__PURE__ */ function() {\n var key = [0, 0, 0];\n return function(a, b, c) {\n var x = a, y = b, z = c;\n if (b < c) {\n if (b < a) {\n x = b;\n y = c;\n z = a;\n }\n } else if (c < a) {\n x = c;\n y = a;\n z = b;\n }\n if (x < 0) {\n return -1;\n }\n key[0] = x;\n key[1] = y;\n key[2] = z;\n return bsearch.eq(this.cells, key, compareCell);\n };\n }();\n function indexCells(triangulation, infinity) {\n var cells = triangulation.cells();\n var nc = cells.length;\n for (var i = 0; i < nc; ++i) {\n var c = cells[i];\n var x = c[0], y = c[1], z = c[2];\n if (y < z) {\n if (y < x) {\n c[0] = y;\n c[1] = z;\n c[2] = x;\n }\n } else if (z < x) {\n c[0] = z;\n c[1] = x;\n c[2] = y;\n }\n }\n cells.sort(compareCell);\n var flags = new Array(nc);\n for (var i = 0; i < flags.length; ++i) {\n flags[i] = 0;\n }\n var active = [];\n var next = [];\n var neighbor = new Array(3 * nc);\n var constraint = new Array(3 * nc);\n var boundary = null;\n if (infinity) {\n boundary = [];\n }\n var index = new FaceIndex(\n cells,\n neighbor,\n constraint,\n flags,\n active,\n next,\n boundary\n );\n for (var i = 0; i < nc; ++i) {\n var c = cells[i];\n for (var j = 0; j < 3; ++j) {\n var x = c[j], y = c[(j + 1) % 3];\n var a = neighbor[3 * i + j] = index.locate(y, x, triangulation.opposite(y, x));\n var b = constraint[3 * i + j] = triangulation.isConstraint(x, y);\n if (a < 0) {\n if (b) {\n next.push(i);\n } else {\n active.push(i);\n flags[i] = 1;\n }\n if (infinity) {\n boundary.push([y, x, -1]);\n }\n }\n }\n }\n return index;\n }\n function filterCells(cells, flags, target) {\n var ptr = 0;\n for (var i = 0; i < cells.length; ++i) {\n if (flags[i] === target) {\n cells[ptr++] = cells[i];\n }\n }\n cells.length = ptr;\n return cells;\n }\n function classifyFaces(triangulation, target, infinity) {\n var index = indexCells(triangulation, infinity);\n if (target === 0) {\n if (infinity) {\n return index.cells.concat(index.boundary);\n } else {\n return index.cells;\n }\n }\n var side = 1;\n var active = index.active;\n var next = index.next;\n var flags = index.flags;\n var cells = index.cells;\n var constraint = index.constraint;\n var neighbor = index.neighbor;\n while (active.length > 0 || next.length > 0) {\n while (active.length > 0) {\n var t = active.pop();\n if (flags[t] === -side) {\n continue;\n }\n flags[t] = side;\n var c = cells[t];\n for (var j = 0; j < 3; ++j) {\n var f = neighbor[3 * t + j];\n if (f >= 0 && flags[f] === 0) {\n if (constraint[3 * t + j]) {\n next.push(f);\n } else {\n active.push(f);\n flags[f] = side;\n }\n }\n }\n }\n var tmp = next;\n next = active;\n active = tmp;\n next.length = 0;\n side = -side;\n }\n var result = filterCells(cells, flags, target);\n if (infinity) {\n return result.concat(index.boundary);\n }\n return result;\n }\n }\n ),\n /***/\n 8902: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var bsearch = __webpack_require__2(2478);\n var orient = __webpack_require__2(3250)[3];\n var EVENT_POINT = 0;\n var EVENT_END = 1;\n var EVENT_START = 2;\n module2.exports = monotoneTriangulate;\n function PartialHull(a, b, idx, lowerIds, upperIds) {\n this.a = a;\n this.b = b;\n this.idx = idx;\n this.lowerIds = lowerIds;\n this.upperIds = upperIds;\n }\n function Event(a, b, type, idx) {\n this.a = a;\n this.b = b;\n this.type = type;\n this.idx = idx;\n }\n function compareEvent(a, b) {\n var d = a.a[0] - b.a[0] || a.a[1] - b.a[1] || a.type - b.type;\n if (d) {\n return d;\n }\n if (a.type !== EVENT_POINT) {\n d = orient(a.a, a.b, b.b);\n if (d) {\n return d;\n }\n }\n return a.idx - b.idx;\n }\n function testPoint(hull, p) {\n return orient(hull.a, hull.b, p);\n }\n function addPoint(cells, hulls, points, p, idx) {\n var lo = bsearch.lt(hulls, p, testPoint);\n var hi = bsearch.gt(hulls, p, testPoint);\n for (var i = lo; i < hi; ++i) {\n var hull = hulls[i];\n var lowerIds = hull.lowerIds;\n var m = lowerIds.length;\n while (m > 1 && orient(\n points[lowerIds[m - 2]],\n points[lowerIds[m - 1]],\n p\n ) > 0) {\n cells.push(\n [\n lowerIds[m - 1],\n lowerIds[m - 2],\n idx\n ]\n );\n m -= 1;\n }\n lowerIds.length = m;\n lowerIds.push(idx);\n var upperIds = hull.upperIds;\n var m = upperIds.length;\n while (m > 1 && orient(\n points[upperIds[m - 2]],\n points[upperIds[m - 1]],\n p\n ) < 0) {\n cells.push(\n [\n upperIds[m - 2],\n upperIds[m - 1],\n idx\n ]\n );\n m -= 1;\n }\n upperIds.length = m;\n upperIds.push(idx);\n }\n }\n function findSplit(hull, edge) {\n var d;\n if (hull.a[0] < edge.a[0]) {\n d = orient(hull.a, hull.b, edge.a);\n } else {\n d = orient(edge.b, edge.a, hull.a);\n }\n if (d) {\n return d;\n }\n if (edge.b[0] < hull.b[0]) {\n d = orient(hull.a, hull.b, edge.b);\n } else {\n d = orient(edge.b, edge.a, hull.b);\n }\n return d || hull.idx - edge.idx;\n }\n function splitHulls(hulls, points, event) {\n var splitIdx = bsearch.le(hulls, event, findSplit);\n var hull = hulls[splitIdx];\n var upperIds = hull.upperIds;\n var x = upperIds[upperIds.length - 1];\n hull.upperIds = [x];\n hulls.splice(\n splitIdx + 1,\n 0,\n new PartialHull(event.a, event.b, event.idx, [x], upperIds)\n );\n }\n function mergeHulls(hulls, points, event) {\n var tmp = event.a;\n event.a = event.b;\n event.b = tmp;\n var mergeIdx = bsearch.eq(hulls, event, findSplit);\n var upper = hulls[mergeIdx];\n var lower = hulls[mergeIdx - 1];\n lower.upperIds = upper.upperIds;\n hulls.splice(mergeIdx, 1);\n }\n function monotoneTriangulate(points, edges) {\n var numPoints = points.length;\n var numEdges = edges.length;\n var events = [];\n for (var i = 0; i < numPoints; ++i) {\n events.push(new Event(\n points[i],\n null,\n EVENT_POINT,\n i\n ));\n }\n for (var i = 0; i < numEdges; ++i) {\n var e = edges[i];\n var a = points[e[0]];\n var b = points[e[1]];\n if (a[0] < b[0]) {\n events.push(\n new Event(a, b, EVENT_START, i),\n new Event(b, a, EVENT_END, i)\n );\n } else if (a[0] > b[0]) {\n events.push(\n new Event(b, a, EVENT_START, i),\n new Event(a, b, EVENT_END, i)\n );\n }\n }\n events.sort(compareEvent);\n var minX = events[0].a[0] - (1 + Math.abs(events[0].a[0])) * Math.pow(2, -52);\n var hull = [new PartialHull([minX, 1], [minX, 0], -1, [], [], [], [])];\n var cells = [];\n for (var i = 0, numEvents = events.length; i < numEvents; ++i) {\n var event = events[i];\n var type = event.type;\n if (type === EVENT_POINT) {\n addPoint(cells, hull, points, event.a, event.idx);\n } else if (type === EVENT_START) {\n splitHulls(hull, points, event);\n } else {\n mergeHulls(hull, points, event);\n }\n }\n return cells;\n }\n }\n ),\n /***/\n 5542: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var bsearch = __webpack_require__2(2478);\n module2.exports = createTriangulation;\n function Triangulation(stars, edges) {\n this.stars = stars;\n this.edges = edges;\n }\n var proto = Triangulation.prototype;\n function removePair(list, j, k) {\n for (var i = 1, n = list.length; i < n; i += 2) {\n if (list[i - 1] === j && list[i] === k) {\n list[i - 1] = list[n - 2];\n list[i] = list[n - 1];\n list.length = n - 2;\n return;\n }\n }\n }\n proto.isConstraint = /* @__PURE__ */ function() {\n var e = [0, 0];\n function compareLex(a, b) {\n return a[0] - b[0] || a[1] - b[1];\n }\n return function(i, j) {\n e[0] = Math.min(i, j);\n e[1] = Math.max(i, j);\n return bsearch.eq(this.edges, e, compareLex) >= 0;\n };\n }();\n proto.removeTriangle = function(i, j, k) {\n var stars = this.stars;\n removePair(stars[i], j, k);\n removePair(stars[j], k, i);\n removePair(stars[k], i, j);\n };\n proto.addTriangle = function(i, j, k) {\n var stars = this.stars;\n stars[i].push(j, k);\n stars[j].push(k, i);\n stars[k].push(i, j);\n };\n proto.opposite = function(j, i) {\n var list = this.stars[i];\n for (var k = 1, n = list.length; k < n; k += 2) {\n if (list[k] === j) {\n return list[k - 1];\n }\n }\n return -1;\n };\n proto.flip = function(i, j) {\n var a = this.opposite(i, j);\n var b = this.opposite(j, i);\n this.removeTriangle(i, j, a);\n this.removeTriangle(j, i, b);\n this.addTriangle(i, b, a);\n this.addTriangle(j, a, b);\n };\n proto.edges = function() {\n var stars = this.stars;\n var result = [];\n for (var i = 0, n = stars.length; i < n; ++i) {\n var list = stars[i];\n for (var j = 0, m = list.length; j < m; j += 2) {\n result.push([list[j], list[j + 1]]);\n }\n }\n return result;\n };\n proto.cells = function() {\n var stars = this.stars;\n var result = [];\n for (var i = 0, n = stars.length; i < n; ++i) {\n var list = stars[i];\n for (var j = 0, m = list.length; j < m; j += 2) {\n var s = list[j];\n var t = list[j + 1];\n if (i < Math.min(s, t)) {\n result.push([i, s, t]);\n }\n }\n }\n return result;\n };\n function createTriangulation(numVerts, edges) {\n var stars = new Array(numVerts);\n for (var i = 0; i < numVerts; ++i) {\n stars[i] = [];\n }\n return new Triangulation(stars, edges);\n }\n }\n ),\n /***/\n 2419: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = orientation;\n function orientation(s) {\n var p = 1;\n for (var i = 1; i < s.length; ++i) {\n for (var j = 0; j < i; ++j) {\n if (s[i] < s[j]) {\n p = -p;\n } else if (s[j] === s[i]) {\n return 0;\n }\n }\n }\n return p;\n }\n }\n ),\n /***/\n 3628: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var dup = __webpack_require__2(1338);\n var solve = __webpack_require__2(727);\n function dot(a, b) {\n var s = 0;\n var d = a.length;\n for (var i = 0; i < d; ++i) {\n s += a[i] * b[i];\n }\n return s;\n }\n function barycentricCircumcenter(points) {\n var N = points.length;\n if (N === 0) {\n return [];\n }\n var D2 = points[0].length;\n var A2 = dup([points.length + 1, points.length + 1], 1);\n var b = dup([points.length + 1], 1);\n A2[N][N] = 0;\n for (var i = 0; i < N; ++i) {\n for (var j = 0; j <= i; ++j) {\n A2[j][i] = A2[i][j] = 2 * dot(points[i], points[j]);\n }\n b[i] = dot(points[i], points[i]);\n }\n var x = solve(A2, b);\n var denom = 0;\n var h = x[N + 1];\n for (var i = 0; i < h.length; ++i) {\n denom += h[i];\n }\n var y = new Array(N);\n for (var i = 0; i < N; ++i) {\n var h = x[i];\n var numer = 0;\n for (var j = 0; j < h.length; ++j) {\n numer += h[j];\n }\n y[i] = numer / denom;\n }\n return y;\n }\n function circumcenter(points) {\n if (points.length === 0) {\n return [];\n }\n var D2 = points[0].length;\n var result = dup([D2]);\n var weights = barycentricCircumcenter(points);\n for (var i = 0; i < points.length; ++i) {\n for (var j = 0; j < D2; ++j) {\n result[j] += points[i][j] * weights[i];\n }\n }\n return result;\n }\n circumcenter.barycenetric = barycentricCircumcenter;\n module2.exports = circumcenter;\n }\n ),\n /***/\n 6037: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = circumradius;\n var circumcenter = __webpack_require__2(3628);\n function circumradius(points) {\n var center = circumcenter(points);\n var avgDist = 0;\n for (var i = 0; i < points.length; ++i) {\n var p = points[i];\n for (var j = 0; j < center.length; ++j) {\n avgDist += Math.pow(p[j] - center[j], 2);\n }\n }\n return Math.sqrt(avgDist / points.length);\n }\n }\n ),\n /***/\n 332: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = cleanPSLG;\n var UnionFind = __webpack_require__2(1755);\n var boxIntersect = __webpack_require__2(6867);\n var segseg = __webpack_require__2(1125);\n var rat = __webpack_require__2(7842);\n var ratCmp = __webpack_require__2(1318);\n var ratToFloat = __webpack_require__2(946);\n var ratVec = __webpack_require__2(5838);\n var nextafter = __webpack_require__2(1278);\n var solveIntersection = __webpack_require__2(3637);\n function boundRat(r) {\n var f = ratToFloat(r);\n return [\n nextafter(f, -Infinity),\n nextafter(f, Infinity)\n ];\n }\n function boundEdges(points, edges) {\n var bounds = new Array(edges.length);\n for (var i = 0; i < edges.length; ++i) {\n var e = edges[i];\n var a = points[e[0]];\n var b = points[e[1]];\n bounds[i] = [\n nextafter(Math.min(a[0], b[0]), -Infinity),\n nextafter(Math.min(a[1], b[1]), -Infinity),\n nextafter(Math.max(a[0], b[0]), Infinity),\n nextafter(Math.max(a[1], b[1]), Infinity)\n ];\n }\n return bounds;\n }\n function boundPoints(points) {\n var bounds = new Array(points.length);\n for (var i = 0; i < points.length; ++i) {\n var p = points[i];\n bounds[i] = [\n nextafter(p[0], -Infinity),\n nextafter(p[1], -Infinity),\n nextafter(p[0], Infinity),\n nextafter(p[1], Infinity)\n ];\n }\n return bounds;\n }\n function getCrossings(points, edges, edgeBounds) {\n var result = [];\n boxIntersect(edgeBounds, function(i, j) {\n var e = edges[i];\n var f = edges[j];\n if (e[0] === f[0] || e[0] === f[1] || e[1] === f[0] || e[1] === f[1]) {\n return;\n }\n var a = points[e[0]];\n var b = points[e[1]];\n var c = points[f[0]];\n var d = points[f[1]];\n if (segseg(a, b, c, d)) {\n result.push([i, j]);\n }\n });\n return result;\n }\n function getTJunctions(points, edges, edgeBounds, vertBounds) {\n var result = [];\n boxIntersect(edgeBounds, vertBounds, function(i, v) {\n var e = edges[i];\n if (e[0] === v || e[1] === v) {\n return;\n }\n var p = points[v];\n var a = points[e[0]];\n var b = points[e[1]];\n if (segseg(a, b, p, p)) {\n result.push([i, v]);\n }\n });\n return result;\n }\n function cutEdges(floatPoints, edges, crossings, junctions, useColor) {\n var i, e;\n var ratPoints = floatPoints.map(function(p) {\n return [\n rat(p[0]),\n rat(p[1])\n ];\n });\n for (i = 0; i < crossings.length; ++i) {\n var crossing = crossings[i];\n e = crossing[0];\n var f = crossing[1];\n var ee = edges[e];\n var ef = edges[f];\n var x = solveIntersection(\n ratVec(floatPoints[ee[0]]),\n ratVec(floatPoints[ee[1]]),\n ratVec(floatPoints[ef[0]]),\n ratVec(floatPoints[ef[1]])\n );\n if (!x) {\n continue;\n }\n var idx = floatPoints.length;\n floatPoints.push([ratToFloat(x[0]), ratToFloat(x[1])]);\n ratPoints.push(x);\n junctions.push([e, idx], [f, idx]);\n }\n junctions.sort(function(a2, b2) {\n if (a2[0] !== b2[0]) {\n return a2[0] - b2[0];\n }\n var u = ratPoints[a2[1]];\n var v = ratPoints[b2[1]];\n return ratCmp(u[0], v[0]) || ratCmp(u[1], v[1]);\n });\n for (i = junctions.length - 1; i >= 0; --i) {\n var junction = junctions[i];\n e = junction[0];\n var edge = edges[e];\n var s = edge[0];\n var t = edge[1];\n var a = floatPoints[s];\n var b = floatPoints[t];\n if ((a[0] - b[0] || a[1] - b[1]) < 0) {\n var tmp = s;\n s = t;\n t = tmp;\n }\n edge[0] = s;\n var last = edge[1] = junction[1];\n var color2;\n if (useColor) {\n color2 = edge[2];\n }\n while (i > 0 && junctions[i - 1][0] === e) {\n var junction = junctions[--i];\n var next = junction[1];\n if (useColor) {\n edges.push([last, next, color2]);\n } else {\n edges.push([last, next]);\n }\n last = next;\n }\n if (useColor) {\n edges.push([last, t, color2]);\n } else {\n edges.push([last, t]);\n }\n }\n return ratPoints;\n }\n function dedupPoints(floatPoints, ratPoints, floatBounds) {\n var numPoints = ratPoints.length;\n var uf = new UnionFind(numPoints);\n var bounds = [];\n for (var i = 0; i < ratPoints.length; ++i) {\n var p = ratPoints[i];\n var xb = boundRat(p[0]);\n var yb = boundRat(p[1]);\n bounds.push([\n nextafter(xb[0], -Infinity),\n nextafter(yb[0], -Infinity),\n nextafter(xb[1], Infinity),\n nextafter(yb[1], Infinity)\n ]);\n }\n boxIntersect(bounds, function(i2, j2) {\n uf.link(i2, j2);\n });\n var noDupes = true;\n var labels = new Array(numPoints);\n for (var i = 0; i < numPoints; ++i) {\n var j = uf.find(i);\n if (j !== i) {\n noDupes = false;\n floatPoints[j] = [\n Math.min(floatPoints[i][0], floatPoints[j][0]),\n Math.min(floatPoints[i][1], floatPoints[j][1])\n ];\n }\n }\n if (noDupes) {\n return null;\n }\n var ptr = 0;\n for (var i = 0; i < numPoints; ++i) {\n var j = uf.find(i);\n if (j === i) {\n labels[i] = ptr;\n floatPoints[ptr++] = floatPoints[i];\n } else {\n labels[i] = -1;\n }\n }\n floatPoints.length = ptr;\n for (var i = 0; i < numPoints; ++i) {\n if (labels[i] < 0) {\n labels[i] = labels[uf.find(i)];\n }\n }\n return labels;\n }\n function compareLex2(a, b) {\n return a[0] - b[0] || a[1] - b[1];\n }\n function compareLex3(a, b) {\n var d = a[0] - b[0] || a[1] - b[1];\n if (d) {\n return d;\n }\n if (a[2] < b[2]) {\n return -1;\n } else if (a[2] > b[2]) {\n return 1;\n }\n return 0;\n }\n function dedupEdges(edges, labels, useColor) {\n if (edges.length === 0) {\n return;\n }\n if (labels) {\n for (var i = 0; i < edges.length; ++i) {\n var e = edges[i];\n var a = labels[e[0]];\n var b = labels[e[1]];\n e[0] = Math.min(a, b);\n e[1] = Math.max(a, b);\n }\n } else {\n for (var i = 0; i < edges.length; ++i) {\n var e = edges[i];\n var a = e[0];\n var b = e[1];\n e[0] = Math.min(a, b);\n e[1] = Math.max(a, b);\n }\n }\n if (useColor) {\n edges.sort(compareLex3);\n } else {\n edges.sort(compareLex2);\n }\n var ptr = 1;\n for (var i = 1; i < edges.length; ++i) {\n var prev = edges[i - 1];\n var next = edges[i];\n if (next[0] === prev[0] && next[1] === prev[1] && (!useColor || next[2] === prev[2])) {\n continue;\n }\n edges[ptr++] = next;\n }\n edges.length = ptr;\n }\n function preRound(points, edges, useColor) {\n var labels = dedupPoints(points, [], boundPoints(points));\n dedupEdges(edges, labels, useColor);\n return !!labels;\n }\n function snapRound(points, edges, useColor) {\n var edgeBounds = boundEdges(points, edges);\n var crossings = getCrossings(points, edges, edgeBounds);\n var vertBounds = boundPoints(points);\n var tjunctions = getTJunctions(points, edges, edgeBounds, vertBounds);\n var ratPoints = cutEdges(points, edges, crossings, tjunctions, useColor);\n var labels = dedupPoints(points, ratPoints, vertBounds);\n dedupEdges(edges, labels, useColor);\n if (!labels) {\n return crossings.length > 0 || tjunctions.length > 0;\n }\n return true;\n }\n function cleanPSLG(points, edges, colors) {\n var prevEdges;\n if (colors) {\n prevEdges = edges;\n var augEdges = new Array(edges.length);\n for (var i = 0; i < edges.length; ++i) {\n var e = edges[i];\n augEdges[i] = [e[0], e[1], colors[i]];\n }\n edges = augEdges;\n }\n var modified = preRound(points, edges, !!colors);\n while (snapRound(points, edges, !!colors)) {\n modified = true;\n }\n if (!!colors && modified) {\n prevEdges.length = 0;\n colors.length = 0;\n for (var i = 0; i < edges.length; ++i) {\n var e = edges[i];\n prevEdges.push([e[0], e[1]]);\n colors.push(e[2]);\n }\n }\n return modified;\n }\n }\n ),\n /***/\n 3637: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = solveIntersection;\n var ratMul = __webpack_require__2(6504);\n var ratDiv = __webpack_require__2(8697);\n var ratSub = __webpack_require__2(5572);\n var ratSign = __webpack_require__2(7721);\n var rvSub = __webpack_require__2(544);\n var rvAdd = __webpack_require__2(2653);\n var rvMuls = __webpack_require__2(8987);\n function ratPerp(a, b) {\n return ratSub(ratMul(a[0], b[1]), ratMul(a[1], b[0]));\n }\n function solveIntersection(a, b, c, d) {\n var ba = rvSub(b, a);\n var dc = rvSub(d, c);\n var baXdc = ratPerp(ba, dc);\n if (ratSign(baXdc) === 0) {\n return null;\n }\n var ac = rvSub(a, c);\n var dcXac = ratPerp(dc, ac);\n var t = ratDiv(dcXac, baXdc);\n var s = rvMuls(ba, t);\n var r = rvAdd(a, s);\n return r;\n }\n }\n ),\n /***/\n 3642: (\n /***/\n function(module2) {\n module2.exports = {\n \"jet\": [{ \"index\": 0, \"rgb\": [0, 0, 131] }, { \"index\": 0.125, \"rgb\": [0, 60, 170] }, { \"index\": 0.375, \"rgb\": [5, 255, 255] }, { \"index\": 0.625, \"rgb\": [255, 255, 0] }, { \"index\": 0.875, \"rgb\": [250, 0, 0] }, { \"index\": 1, \"rgb\": [128, 0, 0] }],\n \"hsv\": [{ \"index\": 0, \"rgb\": [255, 0, 0] }, { \"index\": 0.169, \"rgb\": [253, 255, 2] }, { \"index\": 0.173, \"rgb\": [247, 255, 2] }, { \"index\": 0.337, \"rgb\": [0, 252, 4] }, { \"index\": 0.341, \"rgb\": [0, 252, 10] }, { \"index\": 0.506, \"rgb\": [1, 249, 255] }, { \"index\": 0.671, \"rgb\": [2, 0, 253] }, { \"index\": 0.675, \"rgb\": [8, 0, 253] }, { \"index\": 0.839, \"rgb\": [255, 0, 251] }, { \"index\": 0.843, \"rgb\": [255, 0, 245] }, { \"index\": 1, \"rgb\": [255, 0, 6] }],\n \"hot\": [{ \"index\": 0, \"rgb\": [0, 0, 0] }, { \"index\": 0.3, \"rgb\": [230, 0, 0] }, { \"index\": 0.6, \"rgb\": [255, 210, 0] }, { \"index\": 1, \"rgb\": [255, 255, 255] }],\n \"spring\": [{ \"index\": 0, \"rgb\": [255, 0, 255] }, { \"index\": 1, \"rgb\": [255, 255, 0] }],\n \"summer\": [{ \"index\": 0, \"rgb\": [0, 128, 102] }, { \"index\": 1, \"rgb\": [255, 255, 102] }],\n \"autumn\": [{ \"index\": 0, \"rgb\": [255, 0, 0] }, { \"index\": 1, \"rgb\": [255, 255, 0] }],\n \"winter\": [{ \"index\": 0, \"rgb\": [0, 0, 255] }, { \"index\": 1, \"rgb\": [0, 255, 128] }],\n \"bone\": [{ \"index\": 0, \"rgb\": [0, 0, 0] }, { \"index\": 0.376, \"rgb\": [84, 84, 116] }, { \"index\": 0.753, \"rgb\": [169, 200, 200] }, { \"index\": 1, \"rgb\": [255, 255, 255] }],\n \"copper\": [{ \"index\": 0, \"rgb\": [0, 0, 0] }, { \"index\": 0.804, \"rgb\": [255, 160, 102] }, { \"index\": 1, \"rgb\": [255, 199, 127] }],\n \"greys\": [{ \"index\": 0, \"rgb\": [0, 0, 0] }, { \"index\": 1, \"rgb\": [255, 255, 255] }],\n \"yignbu\": [{ \"index\": 0, \"rgb\": [8, 29, 88] }, { \"index\": 0.125, \"rgb\": [37, 52, 148] }, { \"index\": 0.25, \"rgb\": [34, 94, 168] }, { \"index\": 0.375, \"rgb\": [29, 145, 192] }, { \"index\": 0.5, \"rgb\": [65, 182, 196] }, { \"index\": 0.625, \"rgb\": [127, 205, 187] }, { \"index\": 0.75, \"rgb\": [199, 233, 180] }, { \"index\": 0.875, \"rgb\": [237, 248, 217] }, { \"index\": 1, \"rgb\": [255, 255, 217] }],\n \"greens\": [{ \"index\": 0, \"rgb\": [0, 68, 27] }, { \"index\": 0.125, \"rgb\": [0, 109, 44] }, { \"index\": 0.25, \"rgb\": [35, 139, 69] }, { \"index\": 0.375, \"rgb\": [65, 171, 93] }, { \"index\": 0.5, \"rgb\": [116, 196, 118] }, { \"index\": 0.625, \"rgb\": [161, 217, 155] }, { \"index\": 0.75, \"rgb\": [199, 233, 192] }, { \"index\": 0.875, \"rgb\": [229, 245, 224] }, { \"index\": 1, \"rgb\": [247, 252, 245] }],\n \"yiorrd\": [{ \"index\": 0, \"rgb\": [128, 0, 38] }, { \"index\": 0.125, \"rgb\": [189, 0, 38] }, { \"index\": 0.25, \"rgb\": [227, 26, 28] }, { \"index\": 0.375, \"rgb\": [252, 78, 42] }, { \"index\": 0.5, \"rgb\": [253, 141, 60] }, { \"index\": 0.625, \"rgb\": [254, 178, 76] }, { \"index\": 0.75, \"rgb\": [254, 217, 118] }, { \"index\": 0.875, \"rgb\": [255, 237, 160] }, { \"index\": 1, \"rgb\": [255, 255, 204] }],\n \"bluered\": [{ \"index\": 0, \"rgb\": [0, 0, 255] }, { \"index\": 1, \"rgb\": [255, 0, 0] }],\n \"rdbu\": [{ \"index\": 0, \"rgb\": [5, 10, 172] }, { \"index\": 0.35, \"rgb\": [106, 137, 247] }, { \"index\": 0.5, \"rgb\": [190, 190, 190] }, { \"index\": 0.6, \"rgb\": [220, 170, 132] }, { \"index\": 0.7, \"rgb\": [230, 145, 90] }, { \"index\": 1, \"rgb\": [178, 10, 28] }],\n \"picnic\": [{ \"index\": 0, \"rgb\": [0, 0, 255] }, { \"index\": 0.1, \"rgb\": [51, 153, 255] }, { \"index\": 0.2, \"rgb\": [102, 204, 255] }, { \"index\": 0.3, \"rgb\": [153, 204, 255] }, { \"index\": 0.4, \"rgb\": [204, 204, 255] }, { \"index\": 0.5, \"rgb\": [255, 255, 255] }, { \"index\": 0.6, \"rgb\": [255, 204, 255] }, { \"index\": 0.7, \"rgb\": [255, 153, 255] }, { \"index\": 0.8, \"rgb\": [255, 102, 204] }, { \"index\": 0.9, \"rgb\": [255, 102, 102] }, { \"index\": 1, \"rgb\": [255, 0, 0] }],\n \"rainbow\": [{ \"index\": 0, \"rgb\": [150, 0, 90] }, { \"index\": 0.125, \"rgb\": [0, 0, 200] }, { \"index\": 0.25, \"rgb\": [0, 25, 255] }, { \"index\": 0.375, \"rgb\": [0, 152, 255] }, { \"index\": 0.5, \"rgb\": [44, 255, 150] }, { \"index\": 0.625, \"rgb\": [151, 255, 0] }, { \"index\": 0.75, \"rgb\": [255, 234, 0] }, { \"index\": 0.875, \"rgb\": [255, 111, 0] }, { \"index\": 1, \"rgb\": [255, 0, 0] }],\n \"portland\": [{ \"index\": 0, \"rgb\": [12, 51, 131] }, { \"index\": 0.25, \"rgb\": [10, 136, 186] }, { \"index\": 0.5, \"rgb\": [242, 211, 56] }, { \"index\": 0.75, \"rgb\": [242, 143, 56] }, { \"index\": 1, \"rgb\": [217, 30, 30] }],\n \"blackbody\": [{ \"index\": 0, \"rgb\": [0, 0, 0] }, { \"index\": 0.2, \"rgb\": [230, 0, 0] }, { \"index\": 0.4, \"rgb\": [230, 210, 0] }, { \"index\": 0.7, \"rgb\": [255, 255, 255] }, { \"index\": 1, \"rgb\": [160, 200, 255] }],\n \"earth\": [{ \"index\": 0, \"rgb\": [0, 0, 130] }, { \"index\": 0.1, \"rgb\": [0, 180, 180] }, { \"index\": 0.2, \"rgb\": [40, 210, 40] }, { \"index\": 0.4, \"rgb\": [230, 230, 50] }, { \"index\": 0.6, \"rgb\": [120, 70, 20] }, { \"index\": 1, \"rgb\": [255, 255, 255] }],\n \"electric\": [{ \"index\": 0, \"rgb\": [0, 0, 0] }, { \"index\": 0.15, \"rgb\": [30, 0, 100] }, { \"index\": 0.4, \"rgb\": [120, 0, 100] }, { \"index\": 0.6, \"rgb\": [160, 90, 0] }, { \"index\": 0.8, \"rgb\": [230, 200, 0] }, { \"index\": 1, \"rgb\": [255, 250, 220] }],\n \"alpha\": [{ \"index\": 0, \"rgb\": [255, 255, 255, 0] }, { \"index\": 1, \"rgb\": [255, 255, 255, 1] }],\n \"viridis\": [{ \"index\": 0, \"rgb\": [68, 1, 84] }, { \"index\": 0.13, \"rgb\": [71, 44, 122] }, { \"index\": 0.25, \"rgb\": [59, 81, 139] }, { \"index\": 0.38, \"rgb\": [44, 113, 142] }, { \"index\": 0.5, \"rgb\": [33, 144, 141] }, { \"index\": 0.63, \"rgb\": [39, 173, 129] }, { \"index\": 0.75, \"rgb\": [92, 200, 99] }, { \"index\": 0.88, \"rgb\": [170, 220, 50] }, { \"index\": 1, \"rgb\": [253, 231, 37] }],\n \"inferno\": [{ \"index\": 0, \"rgb\": [0, 0, 4] }, { \"index\": 0.13, \"rgb\": [31, 12, 72] }, { \"index\": 0.25, \"rgb\": [85, 15, 109] }, { \"index\": 0.38, \"rgb\": [136, 34, 106] }, { \"index\": 0.5, \"rgb\": [186, 54, 85] }, { \"index\": 0.63, \"rgb\": [227, 89, 51] }, { \"index\": 0.75, \"rgb\": [249, 140, 10] }, { \"index\": 0.88, \"rgb\": [249, 201, 50] }, { \"index\": 1, \"rgb\": [252, 255, 164] }],\n \"magma\": [{ \"index\": 0, \"rgb\": [0, 0, 4] }, { \"index\": 0.13, \"rgb\": [28, 16, 68] }, { \"index\": 0.25, \"rgb\": [79, 18, 123] }, { \"index\": 0.38, \"rgb\": [129, 37, 129] }, { \"index\": 0.5, \"rgb\": [181, 54, 122] }, { \"index\": 0.63, \"rgb\": [229, 80, 100] }, { \"index\": 0.75, \"rgb\": [251, 135, 97] }, { \"index\": 0.88, \"rgb\": [254, 194, 135] }, { \"index\": 1, \"rgb\": [252, 253, 191] }],\n \"plasma\": [{ \"index\": 0, \"rgb\": [13, 8, 135] }, { \"index\": 0.13, \"rgb\": [75, 3, 161] }, { \"index\": 0.25, \"rgb\": [125, 3, 168] }, { \"index\": 0.38, \"rgb\": [168, 34, 150] }, { \"index\": 0.5, \"rgb\": [203, 70, 121] }, { \"index\": 0.63, \"rgb\": [229, 107, 93] }, { \"index\": 0.75, \"rgb\": [248, 148, 65] }, { \"index\": 0.88, \"rgb\": [253, 195, 40] }, { \"index\": 1, \"rgb\": [240, 249, 33] }],\n \"warm\": [{ \"index\": 0, \"rgb\": [125, 0, 179] }, { \"index\": 0.13, \"rgb\": [172, 0, 187] }, { \"index\": 0.25, \"rgb\": [219, 0, 170] }, { \"index\": 0.38, \"rgb\": [255, 0, 130] }, { \"index\": 0.5, \"rgb\": [255, 63, 74] }, { \"index\": 0.63, \"rgb\": [255, 123, 0] }, { \"index\": 0.75, \"rgb\": [234, 176, 0] }, { \"index\": 0.88, \"rgb\": [190, 228, 0] }, { \"index\": 1, \"rgb\": [147, 255, 0] }],\n \"cool\": [{ \"index\": 0, \"rgb\": [125, 0, 179] }, { \"index\": 0.13, \"rgb\": [116, 0, 218] }, { \"index\": 0.25, \"rgb\": [98, 74, 237] }, { \"index\": 0.38, \"rgb\": [68, 146, 231] }, { \"index\": 0.5, \"rgb\": [0, 204, 197] }, { \"index\": 0.63, \"rgb\": [0, 247, 146] }, { \"index\": 0.75, \"rgb\": [0, 255, 88] }, { \"index\": 0.88, \"rgb\": [40, 255, 8] }, { \"index\": 1, \"rgb\": [147, 255, 0] }],\n \"rainbow-soft\": [{ \"index\": 0, \"rgb\": [125, 0, 179] }, { \"index\": 0.1, \"rgb\": [199, 0, 180] }, { \"index\": 0.2, \"rgb\": [255, 0, 121] }, { \"index\": 0.3, \"rgb\": [255, 108, 0] }, { \"index\": 0.4, \"rgb\": [222, 194, 0] }, { \"index\": 0.5, \"rgb\": [150, 255, 0] }, { \"index\": 0.6, \"rgb\": [0, 255, 55] }, { \"index\": 0.7, \"rgb\": [0, 246, 150] }, { \"index\": 0.8, \"rgb\": [50, 167, 222] }, { \"index\": 0.9, \"rgb\": [103, 51, 235] }, { \"index\": 1, \"rgb\": [124, 0, 186] }],\n \"bathymetry\": [{ \"index\": 0, \"rgb\": [40, 26, 44] }, { \"index\": 0.13, \"rgb\": [59, 49, 90] }, { \"index\": 0.25, \"rgb\": [64, 76, 139] }, { \"index\": 0.38, \"rgb\": [63, 110, 151] }, { \"index\": 0.5, \"rgb\": [72, 142, 158] }, { \"index\": 0.63, \"rgb\": [85, 174, 163] }, { \"index\": 0.75, \"rgb\": [120, 206, 163] }, { \"index\": 0.88, \"rgb\": [187, 230, 172] }, { \"index\": 1, \"rgb\": [253, 254, 204] }],\n \"cdom\": [{ \"index\": 0, \"rgb\": [47, 15, 62] }, { \"index\": 0.13, \"rgb\": [87, 23, 86] }, { \"index\": 0.25, \"rgb\": [130, 28, 99] }, { \"index\": 0.38, \"rgb\": [171, 41, 96] }, { \"index\": 0.5, \"rgb\": [206, 67, 86] }, { \"index\": 0.63, \"rgb\": [230, 106, 84] }, { \"index\": 0.75, \"rgb\": [242, 149, 103] }, { \"index\": 0.88, \"rgb\": [249, 193, 135] }, { \"index\": 1, \"rgb\": [254, 237, 176] }],\n \"chlorophyll\": [{ \"index\": 0, \"rgb\": [18, 36, 20] }, { \"index\": 0.13, \"rgb\": [25, 63, 41] }, { \"index\": 0.25, \"rgb\": [24, 91, 59] }, { \"index\": 0.38, \"rgb\": [13, 119, 72] }, { \"index\": 0.5, \"rgb\": [18, 148, 80] }, { \"index\": 0.63, \"rgb\": [80, 173, 89] }, { \"index\": 0.75, \"rgb\": [132, 196, 122] }, { \"index\": 0.88, \"rgb\": [175, 221, 162] }, { \"index\": 1, \"rgb\": [215, 249, 208] }],\n \"density\": [{ \"index\": 0, \"rgb\": [54, 14, 36] }, { \"index\": 0.13, \"rgb\": [89, 23, 80] }, { \"index\": 0.25, \"rgb\": [110, 45, 132] }, { \"index\": 0.38, \"rgb\": [120, 77, 178] }, { \"index\": 0.5, \"rgb\": [120, 113, 213] }, { \"index\": 0.63, \"rgb\": [115, 151, 228] }, { \"index\": 0.75, \"rgb\": [134, 185, 227] }, { \"index\": 0.88, \"rgb\": [177, 214, 227] }, { \"index\": 1, \"rgb\": [230, 241, 241] }],\n \"freesurface-blue\": [{ \"index\": 0, \"rgb\": [30, 4, 110] }, { \"index\": 0.13, \"rgb\": [47, 14, 176] }, { \"index\": 0.25, \"rgb\": [41, 45, 236] }, { \"index\": 0.38, \"rgb\": [25, 99, 212] }, { \"index\": 0.5, \"rgb\": [68, 131, 200] }, { \"index\": 0.63, \"rgb\": [114, 156, 197] }, { \"index\": 0.75, \"rgb\": [157, 181, 203] }, { \"index\": 0.88, \"rgb\": [200, 208, 216] }, { \"index\": 1, \"rgb\": [241, 237, 236] }],\n \"freesurface-red\": [{ \"index\": 0, \"rgb\": [60, 9, 18] }, { \"index\": 0.13, \"rgb\": [100, 17, 27] }, { \"index\": 0.25, \"rgb\": [142, 20, 29] }, { \"index\": 0.38, \"rgb\": [177, 43, 27] }, { \"index\": 0.5, \"rgb\": [192, 87, 63] }, { \"index\": 0.63, \"rgb\": [205, 125, 105] }, { \"index\": 0.75, \"rgb\": [216, 162, 148] }, { \"index\": 0.88, \"rgb\": [227, 199, 193] }, { \"index\": 1, \"rgb\": [241, 237, 236] }],\n \"oxygen\": [{ \"index\": 0, \"rgb\": [64, 5, 5] }, { \"index\": 0.13, \"rgb\": [106, 6, 15] }, { \"index\": 0.25, \"rgb\": [144, 26, 7] }, { \"index\": 0.38, \"rgb\": [168, 64, 3] }, { \"index\": 0.5, \"rgb\": [188, 100, 4] }, { \"index\": 0.63, \"rgb\": [206, 136, 11] }, { \"index\": 0.75, \"rgb\": [220, 174, 25] }, { \"index\": 0.88, \"rgb\": [231, 215, 44] }, { \"index\": 1, \"rgb\": [248, 254, 105] }],\n \"par\": [{ \"index\": 0, \"rgb\": [51, 20, 24] }, { \"index\": 0.13, \"rgb\": [90, 32, 35] }, { \"index\": 0.25, \"rgb\": [129, 44, 34] }, { \"index\": 0.38, \"rgb\": [159, 68, 25] }, { \"index\": 0.5, \"rgb\": [182, 99, 19] }, { \"index\": 0.63, \"rgb\": [199, 134, 22] }, { \"index\": 0.75, \"rgb\": [212, 171, 35] }, { \"index\": 0.88, \"rgb\": [221, 210, 54] }, { \"index\": 1, \"rgb\": [225, 253, 75] }],\n \"phase\": [{ \"index\": 0, \"rgb\": [145, 105, 18] }, { \"index\": 0.13, \"rgb\": [184, 71, 38] }, { \"index\": 0.25, \"rgb\": [186, 58, 115] }, { \"index\": 0.38, \"rgb\": [160, 71, 185] }, { \"index\": 0.5, \"rgb\": [110, 97, 218] }, { \"index\": 0.63, \"rgb\": [50, 123, 164] }, { \"index\": 0.75, \"rgb\": [31, 131, 110] }, { \"index\": 0.88, \"rgb\": [77, 129, 34] }, { \"index\": 1, \"rgb\": [145, 105, 18] }],\n \"salinity\": [{ \"index\": 0, \"rgb\": [42, 24, 108] }, { \"index\": 0.13, \"rgb\": [33, 50, 162] }, { \"index\": 0.25, \"rgb\": [15, 90, 145] }, { \"index\": 0.38, \"rgb\": [40, 118, 137] }, { \"index\": 0.5, \"rgb\": [59, 146, 135] }, { \"index\": 0.63, \"rgb\": [79, 175, 126] }, { \"index\": 0.75, \"rgb\": [120, 203, 104] }, { \"index\": 0.88, \"rgb\": [193, 221, 100] }, { \"index\": 1, \"rgb\": [253, 239, 154] }],\n \"temperature\": [{ \"index\": 0, \"rgb\": [4, 35, 51] }, { \"index\": 0.13, \"rgb\": [23, 51, 122] }, { \"index\": 0.25, \"rgb\": [85, 59, 157] }, { \"index\": 0.38, \"rgb\": [129, 79, 143] }, { \"index\": 0.5, \"rgb\": [175, 95, 130] }, { \"index\": 0.63, \"rgb\": [222, 112, 101] }, { \"index\": 0.75, \"rgb\": [249, 146, 66] }, { \"index\": 0.88, \"rgb\": [249, 196, 65] }, { \"index\": 1, \"rgb\": [232, 250, 91] }],\n \"turbidity\": [{ \"index\": 0, \"rgb\": [34, 31, 27] }, { \"index\": 0.13, \"rgb\": [65, 50, 41] }, { \"index\": 0.25, \"rgb\": [98, 69, 52] }, { \"index\": 0.38, \"rgb\": [131, 89, 57] }, { \"index\": 0.5, \"rgb\": [161, 112, 59] }, { \"index\": 0.63, \"rgb\": [185, 140, 66] }, { \"index\": 0.75, \"rgb\": [202, 174, 88] }, { \"index\": 0.88, \"rgb\": [216, 209, 126] }, { \"index\": 1, \"rgb\": [233, 246, 171] }],\n \"velocity-blue\": [{ \"index\": 0, \"rgb\": [17, 32, 64] }, { \"index\": 0.13, \"rgb\": [35, 52, 116] }, { \"index\": 0.25, \"rgb\": [29, 81, 156] }, { \"index\": 0.38, \"rgb\": [31, 113, 162] }, { \"index\": 0.5, \"rgb\": [50, 144, 169] }, { \"index\": 0.63, \"rgb\": [87, 173, 176] }, { \"index\": 0.75, \"rgb\": [149, 196, 189] }, { \"index\": 0.88, \"rgb\": [203, 221, 211] }, { \"index\": 1, \"rgb\": [254, 251, 230] }],\n \"velocity-green\": [{ \"index\": 0, \"rgb\": [23, 35, 19] }, { \"index\": 0.13, \"rgb\": [24, 64, 38] }, { \"index\": 0.25, \"rgb\": [11, 95, 45] }, { \"index\": 0.38, \"rgb\": [39, 123, 35] }, { \"index\": 0.5, \"rgb\": [95, 146, 12] }, { \"index\": 0.63, \"rgb\": [152, 165, 18] }, { \"index\": 0.75, \"rgb\": [201, 186, 69] }, { \"index\": 0.88, \"rgb\": [233, 216, 137] }, { \"index\": 1, \"rgb\": [255, 253, 205] }],\n \"cubehelix\": [{ \"index\": 0, \"rgb\": [0, 0, 0] }, { \"index\": 0.07, \"rgb\": [22, 5, 59] }, { \"index\": 0.13, \"rgb\": [60, 4, 105] }, { \"index\": 0.2, \"rgb\": [109, 1, 135] }, { \"index\": 0.27, \"rgb\": [161, 0, 147] }, { \"index\": 0.33, \"rgb\": [210, 2, 142] }, { \"index\": 0.4, \"rgb\": [251, 11, 123] }, { \"index\": 0.47, \"rgb\": [255, 29, 97] }, { \"index\": 0.53, \"rgb\": [255, 54, 69] }, { \"index\": 0.6, \"rgb\": [255, 85, 46] }, { \"index\": 0.67, \"rgb\": [255, 120, 34] }, { \"index\": 0.73, \"rgb\": [255, 157, 37] }, { \"index\": 0.8, \"rgb\": [241, 191, 57] }, { \"index\": 0.87, \"rgb\": [224, 220, 93] }, { \"index\": 0.93, \"rgb\": [218, 241, 142] }, { \"index\": 1, \"rgb\": [227, 253, 198] }]\n };\n }\n ),\n /***/\n 6729: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var colorScale = __webpack_require__2(3642);\n var lerp = __webpack_require__2(395);\n module2.exports = createColormap;\n function createColormap(spec) {\n var indicies, fromrgba, torgba, nsteps, cmap, colormap, format, nshades, colors, alpha, i;\n if (!spec) spec = {};\n nshades = (spec.nshades || 72) - 1;\n format = spec.format || \"hex\";\n colormap = spec.colormap;\n if (!colormap) colormap = \"jet\";\n if (typeof colormap === \"string\") {\n colormap = colormap.toLowerCase();\n if (!colorScale[colormap]) {\n throw Error(colormap + \" not a supported colorscale\");\n }\n cmap = colorScale[colormap];\n } else if (Array.isArray(colormap)) {\n cmap = colormap.slice();\n } else {\n throw Error(\"unsupported colormap option\", colormap);\n }\n if (cmap.length > nshades + 1) {\n throw new Error(\n colormap + \" map requires nshades to be at least size \" + cmap.length\n );\n }\n if (!Array.isArray(spec.alpha)) {\n if (typeof spec.alpha === \"number\") {\n alpha = [spec.alpha, spec.alpha];\n } else {\n alpha = [1, 1];\n }\n } else if (spec.alpha.length !== 2) {\n alpha = [1, 1];\n } else {\n alpha = spec.alpha.slice();\n }\n indicies = cmap.map(function(c) {\n return Math.round(c.index * nshades);\n });\n alpha[0] = Math.min(Math.max(alpha[0], 0), 1);\n alpha[1] = Math.min(Math.max(alpha[1], 0), 1);\n var steps = cmap.map(function(c, i2) {\n var index = cmap[i2].index;\n var rgba3 = cmap[i2].rgb.slice();\n if (rgba3.length === 4 && rgba3[3] >= 0 && rgba3[3] <= 1) {\n return rgba3;\n }\n rgba3[3] = alpha[0] + (alpha[1] - alpha[0]) * index;\n return rgba3;\n });\n var colors = [];\n for (i = 0; i < indicies.length - 1; ++i) {\n nsteps = indicies[i + 1] - indicies[i];\n fromrgba = steps[i];\n torgba = steps[i + 1];\n for (var j = 0; j < nsteps; j++) {\n var amt = j / nsteps;\n colors.push([\n Math.round(lerp(fromrgba[0], torgba[0], amt)),\n Math.round(lerp(fromrgba[1], torgba[1], amt)),\n Math.round(lerp(fromrgba[2], torgba[2], amt)),\n lerp(fromrgba[3], torgba[3], amt)\n ]);\n }\n }\n colors.push(cmap[cmap.length - 1].rgb.concat(alpha[1]));\n if (format === \"hex\") colors = colors.map(rgb2hex);\n else if (format === \"rgbaString\") colors = colors.map(rgbaStr);\n else if (format === \"float\") colors = colors.map(rgb2float);\n return colors;\n }\n ;\n function rgb2float(rgba3) {\n return [\n rgba3[0] / 255,\n rgba3[1] / 255,\n rgba3[2] / 255,\n rgba3[3]\n ];\n }\n function rgb2hex(rgba3) {\n var dig, hex2 = \"#\";\n for (var i = 0; i < 3; ++i) {\n dig = rgba3[i];\n dig = dig.toString(16);\n hex2 += (\"00\" + dig).substr(dig.length);\n }\n return hex2;\n }\n function rgbaStr(rgba3) {\n return \"rgba(\" + rgba3.join(\",\") + \")\";\n }\n }\n ),\n /***/\n 3140: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = compareAngle;\n var orient = __webpack_require__2(3250);\n var sgn = __webpack_require__2(8572);\n var twoSum = __webpack_require__2(9362);\n var robustProduct = __webpack_require__2(5382);\n var robustSum = __webpack_require__2(8210);\n function testInterior(a, b, c) {\n var x0 = twoSum(a[0], -b[0]);\n var y0 = twoSum(a[1], -b[1]);\n var x1 = twoSum(c[0], -b[0]);\n var y1 = twoSum(c[1], -b[1]);\n var d = robustSum(\n robustProduct(x0, x1),\n robustProduct(y0, y1)\n );\n return d[d.length - 1] >= 0;\n }\n function compareAngle(a, b, c, d) {\n var bcd = orient(b, c, d);\n if (bcd === 0) {\n var sabc = sgn(orient(a, b, c));\n var sabd = sgn(orient(a, b, d));\n if (sabc === sabd) {\n if (sabc === 0) {\n var ic = testInterior(a, b, c);\n var id = testInterior(a, b, d);\n if (ic === id) {\n return 0;\n } else if (ic) {\n return 1;\n } else {\n return -1;\n }\n }\n return 0;\n } else if (sabd === 0) {\n if (sabc > 0) {\n return -1;\n } else if (testInterior(a, b, d)) {\n return -1;\n } else {\n return 1;\n }\n } else if (sabc === 0) {\n if (sabd > 0) {\n return 1;\n } else if (testInterior(a, b, c)) {\n return 1;\n } else {\n return -1;\n }\n }\n return sgn(sabd - sabc);\n }\n var abc = orient(a, b, c);\n if (abc > 0) {\n if (bcd > 0 && orient(a, b, d) > 0) {\n return 1;\n }\n return -1;\n } else if (abc < 0) {\n if (bcd > 0 || orient(a, b, d) > 0) {\n return 1;\n }\n return -1;\n } else {\n var abd = orient(a, b, d);\n if (abd > 0) {\n return 1;\n } else {\n if (testInterior(a, b, c)) {\n return 1;\n } else {\n return -1;\n }\n }\n }\n }\n }\n ),\n /***/\n 8572: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = function signum(x) {\n if (x < 0) {\n return -1;\n }\n if (x > 0) {\n return 1;\n }\n return 0;\n };\n }\n ),\n /***/\n 8507: (\n /***/\n function(module2) {\n module2.exports = compareCells;\n var min = Math.min;\n function compareInt(a, b) {\n return a - b;\n }\n function compareCells(a, b) {\n var n = a.length, t = a.length - b.length;\n if (t) {\n return t;\n }\n switch (n) {\n case 0:\n return 0;\n case 1:\n return a[0] - b[0];\n case 2:\n return a[0] + a[1] - b[0] - b[1] || min(a[0], a[1]) - min(b[0], b[1]);\n case 3:\n var l1 = a[0] + a[1], m1 = b[0] + b[1];\n t = l1 + a[2] - (m1 + b[2]);\n if (t) {\n return t;\n }\n var l0 = min(a[0], a[1]), m0 = min(b[0], b[1]);\n return min(l0, a[2]) - min(m0, b[2]) || min(l0 + a[2], l1) - min(m0 + b[2], m1);\n case 4:\n var aw = a[0], ax = a[1], ay = a[2], az = a[3], bw = b[0], bx = b[1], by = b[2], bz = b[3];\n return aw + ax + ay + az - (bw + bx + by + bz) || min(aw, ax, ay, az) - min(bw, bx, by, bz, bw) || min(aw + ax, aw + ay, aw + az, ax + ay, ax + az, ay + az) - min(bw + bx, bw + by, bw + bz, bx + by, bx + bz, by + bz) || min(aw + ax + ay, aw + ax + az, aw + ay + az, ax + ay + az) - min(bw + bx + by, bw + bx + bz, bw + by + bz, bx + by + bz);\n default:\n var as = a.slice().sort(compareInt);\n var bs = b.slice().sort(compareInt);\n for (var i = 0; i < n; ++i) {\n t = as[i] - bs[i];\n if (t) {\n return t;\n }\n }\n return 0;\n }\n }\n }\n ),\n /***/\n 3788: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var compareCells = __webpack_require__2(8507);\n var parity = __webpack_require__2(2419);\n module2.exports = compareOrientedCells;\n function compareOrientedCells(a, b) {\n return compareCells(a, b) || parity(a) - parity(b);\n }\n }\n ),\n /***/\n 7352: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var convexHull1d = __webpack_require__2(5721);\n var convexHull2d = __webpack_require__2(4750);\n var convexHullnd = __webpack_require__2(2690);\n module2.exports = convexHull;\n function convexHull(points) {\n var n = points.length;\n if (n === 0) {\n return [];\n } else if (n === 1) {\n return [[0]];\n }\n var d = points[0].length;\n if (d === 0) {\n return [];\n } else if (d === 1) {\n return convexHull1d(points);\n } else if (d === 2) {\n return convexHull2d(points);\n }\n return convexHullnd(points, d);\n }\n }\n ),\n /***/\n 5721: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = convexHull1d;\n function convexHull1d(points) {\n var lo = 0;\n var hi = 0;\n for (var i = 1; i < points.length; ++i) {\n if (points[i][0] < points[lo][0]) {\n lo = i;\n }\n if (points[i][0] > points[hi][0]) {\n hi = i;\n }\n }\n if (lo < hi) {\n return [[lo], [hi]];\n } else if (lo > hi) {\n return [[hi], [lo]];\n } else {\n return [[lo]];\n }\n }\n }\n ),\n /***/\n 4750: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = convexHull2D;\n var monotoneHull = __webpack_require__2(3090);\n function convexHull2D(points) {\n var hull = monotoneHull(points);\n var h = hull.length;\n if (h <= 2) {\n return [];\n }\n var edges = new Array(h);\n var a = hull[h - 1];\n for (var i = 0; i < h; ++i) {\n var b = hull[i];\n edges[i] = [a, b];\n a = b;\n }\n return edges;\n }\n }\n ),\n /***/\n 2690: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = convexHullnD;\n var ich = __webpack_require__2(8954);\n var aff = __webpack_require__2(3952);\n function permute(points, front) {\n var n = points.length;\n var npoints = new Array(n);\n for (var i = 0; i < front.length; ++i) {\n npoints[i] = points[front[i]];\n }\n var ptr = front.length;\n for (var i = 0; i < n; ++i) {\n if (front.indexOf(i) < 0) {\n npoints[ptr++] = points[i];\n }\n }\n return npoints;\n }\n function invPermute(cells, front) {\n var nc = cells.length;\n var nf = front.length;\n for (var i = 0; i < nc; ++i) {\n var c = cells[i];\n for (var j = 0; j < c.length; ++j) {\n var x = c[j];\n if (x < nf) {\n c[j] = front[x];\n } else {\n x = x - nf;\n for (var k = 0; k < nf; ++k) {\n if (x >= front[k]) {\n x += 1;\n }\n }\n c[j] = x;\n }\n }\n }\n return cells;\n }\n function convexHullnD(points, d) {\n try {\n return ich(points, true);\n } catch (e) {\n var ah = aff(points);\n if (ah.length <= d) {\n return [];\n }\n var npoints = permute(points, ah);\n var nhull = ich(npoints, true);\n return invPermute(nhull, ah);\n }\n }\n }\n ),\n /***/\n 4769: (\n /***/\n function(module2) {\n \"use strict\";\n function dcubicHermite(p0, v0, p1, v1, t, f) {\n var dh00 = 6 * t * t - 6 * t, dh10 = 3 * t * t - 4 * t + 1, dh01 = -6 * t * t + 6 * t, dh11 = 3 * t * t - 2 * t;\n if (p0.length) {\n if (!f) {\n f = new Array(p0.length);\n }\n for (var i = p0.length - 1; i >= 0; --i) {\n f[i] = dh00 * p0[i] + dh10 * v0[i] + dh01 * p1[i] + dh11 * v1[i];\n }\n return f;\n }\n return dh00 * p0 + dh10 * v0 + dh01 * p1[i] + dh11 * v1;\n }\n function cubicHermite(p0, v0, p1, v1, t, f) {\n var ti = t - 1, t22 = t * t, ti2 = ti * ti, h00 = (1 + 2 * t) * ti2, h10 = t * ti2, h01 = t22 * (3 - 2 * t), h11 = t22 * ti;\n if (p0.length) {\n if (!f) {\n f = new Array(p0.length);\n }\n for (var i = p0.length - 1; i >= 0; --i) {\n f[i] = h00 * p0[i] + h10 * v0[i] + h01 * p1[i] + h11 * v1[i];\n }\n return f;\n }\n return h00 * p0 + h10 * v0 + h01 * p1 + h11 * v1;\n }\n module2.exports = cubicHermite;\n module2.exports.derivative = dcubicHermite;\n }\n ),\n /***/\n 7642: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var ch = __webpack_require__2(8954);\n var uniq = __webpack_require__2(1682);\n module2.exports = triangulate;\n function LiftedPoint(p, i) {\n this.point = p;\n this.index = i;\n }\n function compareLifted(a, b) {\n var ap = a.point;\n var bp = b.point;\n var d = ap.length;\n for (var i = 0; i < d; ++i) {\n var s = bp[i] - ap[i];\n if (s) {\n return s;\n }\n }\n return 0;\n }\n function triangulate1D(n, points, includePointAtInfinity) {\n if (n === 1) {\n if (includePointAtInfinity) {\n return [[-1, 0]];\n } else {\n return [];\n }\n }\n var lifted = points.map(function(p, i2) {\n return [p[0], i2];\n });\n lifted.sort(function(a2, b2) {\n return a2[0] - b2[0];\n });\n var cells = new Array(n - 1);\n for (var i = 1; i < n; ++i) {\n var a = lifted[i - 1];\n var b = lifted[i];\n cells[i - 1] = [a[1], b[1]];\n }\n if (includePointAtInfinity) {\n cells.push(\n [-1, cells[0][1]],\n [cells[n - 1][1], -1]\n );\n }\n return cells;\n }\n function triangulate(points, includePointAtInfinity) {\n var n = points.length;\n if (n === 0) {\n return [];\n }\n var d = points[0].length;\n if (d < 1) {\n return [];\n }\n if (d === 1) {\n return triangulate1D(n, points, includePointAtInfinity);\n }\n var lifted = new Array(n);\n var upper = 1;\n for (var i = 0; i < n; ++i) {\n var p = points[i];\n var x = new Array(d + 1);\n var l = 0;\n for (var j = 0; j < d; ++j) {\n var v = p[j];\n x[j] = v;\n l += v * v;\n }\n x[d] = l;\n lifted[i] = new LiftedPoint(x, i);\n upper = Math.max(l, upper);\n }\n uniq(lifted, compareLifted);\n n = lifted.length;\n var dpoints = new Array(n + d + 1);\n var dindex = new Array(n + d + 1);\n var u = (d + 1) * (d + 1) * upper;\n var y = new Array(d + 1);\n for (var i = 0; i <= d; ++i) {\n y[i] = 0;\n }\n y[d] = u;\n dpoints[0] = y.slice();\n dindex[0] = -1;\n for (var i = 0; i <= d; ++i) {\n var x = y.slice();\n x[i] = 1;\n dpoints[i + 1] = x;\n dindex[i + 1] = -1;\n }\n for (var i = 0; i < n; ++i) {\n var h = lifted[i];\n dpoints[i + d + 1] = h.point;\n dindex[i + d + 1] = h.index;\n }\n var hull = ch(dpoints, false);\n if (includePointAtInfinity) {\n hull = hull.filter(function(cell) {\n var count = 0;\n for (var j2 = 0; j2 <= d; ++j2) {\n var v2 = dindex[cell[j2]];\n if (v2 < 0) {\n if (++count >= 2) {\n return false;\n }\n }\n cell[j2] = v2;\n }\n return true;\n });\n } else {\n hull = hull.filter(function(cell) {\n for (var i2 = 0; i2 <= d; ++i2) {\n var v2 = dindex[cell[i2]];\n if (v2 < 0) {\n return false;\n }\n cell[i2] = v2;\n }\n return true;\n });\n }\n if (d & 1) {\n for (var i = 0; i < hull.length; ++i) {\n var h = hull[i];\n var x = h[0];\n h[0] = h[1];\n h[1] = x;\n }\n }\n return hull;\n }\n }\n ),\n /***/\n 2361: (\n /***/\n function(module2) {\n var hasTypedArrays = false;\n if (typeof Float64Array !== \"undefined\") {\n var DOUBLE_VIEW = new Float64Array(1), UINT_VIEW = new Uint32Array(DOUBLE_VIEW.buffer);\n DOUBLE_VIEW[0] = 1;\n hasTypedArrays = true;\n if (UINT_VIEW[1] === 1072693248) {\n let toDoubleLE2 = function(lo, hi) {\n UINT_VIEW[0] = lo;\n UINT_VIEW[1] = hi;\n return DOUBLE_VIEW[0];\n }, lowUintLE2 = function(n) {\n DOUBLE_VIEW[0] = n;\n return UINT_VIEW[0];\n }, highUintLE2 = function(n) {\n DOUBLE_VIEW[0] = n;\n return UINT_VIEW[1];\n };\n var toDoubleLE = toDoubleLE2, lowUintLE = lowUintLE2, highUintLE = highUintLE2;\n module2.exports = function doubleBitsLE(n) {\n DOUBLE_VIEW[0] = n;\n return [UINT_VIEW[0], UINT_VIEW[1]];\n };\n module2.exports.pack = toDoubleLE2;\n module2.exports.lo = lowUintLE2;\n module2.exports.hi = highUintLE2;\n } else if (UINT_VIEW[0] === 1072693248) {\n let toDoubleBE2 = function(lo, hi) {\n UINT_VIEW[1] = lo;\n UINT_VIEW[0] = hi;\n return DOUBLE_VIEW[0];\n }, lowUintBE2 = function(n) {\n DOUBLE_VIEW[0] = n;\n return UINT_VIEW[1];\n }, highUintBE2 = function(n) {\n DOUBLE_VIEW[0] = n;\n return UINT_VIEW[0];\n };\n var toDoubleBE = toDoubleBE2, lowUintBE = lowUintBE2, highUintBE = highUintBE2;\n module2.exports = function doubleBitsBE(n) {\n DOUBLE_VIEW[0] = n;\n return [UINT_VIEW[1], UINT_VIEW[0]];\n };\n module2.exports.pack = toDoubleBE2;\n module2.exports.lo = lowUintBE2;\n module2.exports.hi = highUintBE2;\n } else {\n hasTypedArrays = false;\n }\n }\n if (!hasTypedArrays) {\n let toDouble2 = function(lo, hi) {\n buffer.writeUInt32LE(lo, 0, true);\n buffer.writeUInt32LE(hi, 4, true);\n return buffer.readDoubleLE(0, true);\n }, lowUint2 = function(n) {\n buffer.writeDoubleLE(n, 0, true);\n return buffer.readUInt32LE(0, true);\n }, highUint2 = function(n) {\n buffer.writeDoubleLE(n, 0, true);\n return buffer.readUInt32LE(4, true);\n };\n var toDouble = toDouble2, lowUint = lowUint2, highUint = highUint2;\n var buffer = new Buffer(8);\n module2.exports = function doubleBits(n) {\n buffer.writeDoubleLE(n, 0, true);\n return [buffer.readUInt32LE(0, true), buffer.readUInt32LE(4, true)];\n };\n module2.exports.pack = toDouble2;\n module2.exports.lo = lowUint2;\n module2.exports.hi = highUint2;\n }\n module2.exports.sign = function(n) {\n return module2.exports.hi(n) >>> 31;\n };\n module2.exports.exponent = function(n) {\n var b = module2.exports.hi(n);\n return (b << 1 >>> 21) - 1023;\n };\n module2.exports.fraction = function(n) {\n var lo = module2.exports.lo(n);\n var hi = module2.exports.hi(n);\n var b = hi & (1 << 20) - 1;\n if (hi & 2146435072) {\n b += 1 << 20;\n }\n return [lo, b];\n };\n module2.exports.denormalized = function(n) {\n var hi = module2.exports.hi(n);\n return !(hi & 2146435072);\n };\n }\n ),\n /***/\n 1338: (\n /***/\n function(module2) {\n \"use strict\";\n function dupe_array(count, value, i) {\n var c = count[i] | 0;\n if (c <= 0) {\n return [];\n }\n var result = new Array(c), j;\n if (i === count.length - 1) {\n for (j = 0; j < c; ++j) {\n result[j] = value;\n }\n } else {\n for (j = 0; j < c; ++j) {\n result[j] = dupe_array(count, value, i + 1);\n }\n }\n return result;\n }\n function dupe_number(count, value) {\n var result, i;\n result = new Array(count);\n for (i = 0; i < count; ++i) {\n result[i] = value;\n }\n return result;\n }\n function dupe(count, value) {\n if (typeof value === \"undefined\") {\n value = 0;\n }\n switch (typeof count) {\n case \"number\":\n if (count > 0) {\n return dupe_number(count | 0, value);\n }\n break;\n case \"object\":\n if (typeof count.length === \"number\") {\n return dupe_array(count, value, 0);\n }\n break;\n }\n return [];\n }\n module2.exports = dupe;\n }\n ),\n /***/\n 3134: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = edgeToAdjacency;\n var uniq = __webpack_require__2(1682);\n function edgeToAdjacency(edges, numVertices) {\n var numEdges = edges.length;\n if (typeof numVertices !== \"number\") {\n numVertices = 0;\n for (var i = 0; i < numEdges; ++i) {\n var e = edges[i];\n numVertices = Math.max(numVertices, e[0], e[1]);\n }\n numVertices = (numVertices | 0) + 1;\n }\n numVertices = numVertices | 0;\n var adj = new Array(numVertices);\n for (var i = 0; i < numVertices; ++i) {\n adj[i] = [];\n }\n for (var i = 0; i < numEdges; ++i) {\n var e = edges[i];\n adj[e[0]].push(e[1]);\n adj[e[1]].push(e[0]);\n }\n for (var j = 0; j < numVertices; ++j) {\n uniq(adj[j], function(a, b) {\n return a - b;\n });\n }\n return adj;\n }\n }\n ),\n /***/\n 5033: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = extractPlanes;\n function extractPlanes(M, zNear, zFar) {\n var z = zNear || 0;\n var zf = zFar || 1;\n return [\n [M[12] + M[0], M[13] + M[1], M[14] + M[2], M[15] + M[3]],\n [M[12] - M[0], M[13] - M[1], M[14] - M[2], M[15] - M[3]],\n [M[12] + M[4], M[13] + M[5], M[14] + M[6], M[15] + M[7]],\n [M[12] - M[4], M[13] - M[5], M[14] - M[6], M[15] - M[7]],\n [z * M[12] + M[8], z * M[13] + M[9], z * M[14] + M[10], z * M[15] + M[11]],\n [zf * M[12] - M[8], zf * M[13] - M[9], zf * M[14] - M[10], zf * M[15] - M[11]]\n ];\n }\n }\n ),\n /***/\n 9215: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = createFilteredVector;\n var cubicHermite = __webpack_require__2(4769);\n var bsearch = __webpack_require__2(2478);\n function clamp(lo, hi, x) {\n return Math.min(hi, Math.max(lo, x));\n }\n function FilteredVector(state0, velocity0, t02) {\n this.dimension = state0.length;\n this.bounds = [new Array(this.dimension), new Array(this.dimension)];\n for (var i = 0; i < this.dimension; ++i) {\n this.bounds[0][i] = -Infinity;\n this.bounds[1][i] = Infinity;\n }\n this._state = state0.slice().reverse();\n this._velocity = velocity0.slice().reverse();\n this._time = [t02];\n this._scratch = [state0.slice(), state0.slice(), state0.slice(), state0.slice(), state0.slice()];\n }\n var proto = FilteredVector.prototype;\n proto.flush = function(t) {\n var idx = bsearch.gt(this._time, t) - 1;\n if (idx <= 0) {\n return;\n }\n this._time.splice(0, idx);\n this._state.splice(0, idx * this.dimension);\n this._velocity.splice(0, idx * this.dimension);\n };\n proto.curve = function(t) {\n var time = this._time;\n var n = time.length;\n var idx = bsearch.le(time, t);\n var result = this._scratch[0];\n var state = this._state;\n var velocity = this._velocity;\n var d = this.dimension;\n var bounds = this.bounds;\n if (idx < 0) {\n var ptr = d - 1;\n for (var i = 0; i < d; ++i, --ptr) {\n result[i] = state[ptr];\n }\n } else if (idx >= n - 1) {\n var ptr = state.length - 1;\n var tf = t - time[n - 1];\n for (var i = 0; i < d; ++i, --ptr) {\n result[i] = state[ptr] + tf * velocity[ptr];\n }\n } else {\n var ptr = d * (idx + 1) - 1;\n var t02 = time[idx];\n var t12 = time[idx + 1];\n var dt = t12 - t02 || 1;\n var x0 = this._scratch[1];\n var x1 = this._scratch[2];\n var v0 = this._scratch[3];\n var v1 = this._scratch[4];\n var steady = true;\n for (var i = 0; i < d; ++i, --ptr) {\n x0[i] = state[ptr];\n v0[i] = velocity[ptr] * dt;\n x1[i] = state[ptr + d];\n v1[i] = velocity[ptr + d] * dt;\n steady = steady && (x0[i] === x1[i] && v0[i] === v1[i] && v0[i] === 0);\n }\n if (steady) {\n for (var i = 0; i < d; ++i) {\n result[i] = x0[i];\n }\n } else {\n cubicHermite(x0, v0, x1, v1, (t - t02) / dt, result);\n }\n }\n var lo = bounds[0];\n var hi = bounds[1];\n for (var i = 0; i < d; ++i) {\n result[i] = clamp(lo[i], hi[i], result[i]);\n }\n return result;\n };\n proto.dcurve = function(t) {\n var time = this._time;\n var n = time.length;\n var idx = bsearch.le(time, t);\n var result = this._scratch[0];\n var state = this._state;\n var velocity = this._velocity;\n var d = this.dimension;\n if (idx >= n - 1) {\n var ptr = state.length - 1;\n var tf = t - time[n - 1];\n for (var i = 0; i < d; ++i, --ptr) {\n result[i] = velocity[ptr];\n }\n } else {\n var ptr = d * (idx + 1) - 1;\n var t02 = time[idx];\n var t12 = time[idx + 1];\n var dt = t12 - t02 || 1;\n var x0 = this._scratch[1];\n var x1 = this._scratch[2];\n var v0 = this._scratch[3];\n var v1 = this._scratch[4];\n var steady = true;\n for (var i = 0; i < d; ++i, --ptr) {\n x0[i] = state[ptr];\n v0[i] = velocity[ptr] * dt;\n x1[i] = state[ptr + d];\n v1[i] = velocity[ptr + d] * dt;\n steady = steady && (x0[i] === x1[i] && v0[i] === v1[i] && v0[i] === 0);\n }\n if (steady) {\n for (var i = 0; i < d; ++i) {\n result[i] = 0;\n }\n } else {\n cubicHermite.derivative(x0, v0, x1, v1, (t - t02) / dt, result);\n for (var i = 0; i < d; ++i) {\n result[i] /= dt;\n }\n }\n }\n return result;\n };\n proto.lastT = function() {\n var time = this._time;\n return time[time.length - 1];\n };\n proto.stable = function() {\n var velocity = this._velocity;\n var ptr = velocity.length;\n for (var i = this.dimension - 1; i >= 0; --i) {\n if (velocity[--ptr]) {\n return false;\n }\n }\n return true;\n };\n proto.jump = function(t) {\n var t02 = this.lastT();\n var d = this.dimension;\n if (t < t02 || arguments.length !== d + 1) {\n return;\n }\n var state = this._state;\n var velocity = this._velocity;\n var ptr = state.length - this.dimension;\n var bounds = this.bounds;\n var lo = bounds[0];\n var hi = bounds[1];\n this._time.push(t02, t);\n for (var j = 0; j < 2; ++j) {\n for (var i = 0; i < d; ++i) {\n state.push(state[ptr++]);\n velocity.push(0);\n }\n }\n this._time.push(t);\n for (var i = d; i > 0; --i) {\n state.push(clamp(lo[i - 1], hi[i - 1], arguments[i]));\n velocity.push(0);\n }\n };\n proto.push = function(t) {\n var t02 = this.lastT();\n var d = this.dimension;\n if (t < t02 || arguments.length !== d + 1) {\n return;\n }\n var state = this._state;\n var velocity = this._velocity;\n var ptr = state.length - this.dimension;\n var dt = t - t02;\n var bounds = this.bounds;\n var lo = bounds[0];\n var hi = bounds[1];\n var sf = dt > 1e-6 ? 1 / dt : 0;\n this._time.push(t);\n for (var i = d; i > 0; --i) {\n var xc = clamp(lo[i - 1], hi[i - 1], arguments[i]);\n state.push(xc);\n velocity.push((xc - state[ptr++]) * sf);\n }\n };\n proto.set = function(t) {\n var d = this.dimension;\n if (t < this.lastT() || arguments.length !== d + 1) {\n return;\n }\n var state = this._state;\n var velocity = this._velocity;\n var bounds = this.bounds;\n var lo = bounds[0];\n var hi = bounds[1];\n this._time.push(t);\n for (var i = d; i > 0; --i) {\n state.push(clamp(lo[i - 1], hi[i - 1], arguments[i]));\n velocity.push(0);\n }\n };\n proto.move = function(t) {\n var t02 = this.lastT();\n var d = this.dimension;\n if (t <= t02 || arguments.length !== d + 1) {\n return;\n }\n var state = this._state;\n var velocity = this._velocity;\n var statePtr = state.length - this.dimension;\n var bounds = this.bounds;\n var lo = bounds[0];\n var hi = bounds[1];\n var dt = t - t02;\n var sf = dt > 1e-6 ? 1 / dt : 0;\n this._time.push(t);\n for (var i = d; i > 0; --i) {\n var dx = arguments[i];\n state.push(clamp(lo[i - 1], hi[i - 1], state[statePtr++] + dx));\n velocity.push(dx * sf);\n }\n };\n proto.idle = function(t) {\n var t02 = this.lastT();\n if (t < t02) {\n return;\n }\n var d = this.dimension;\n var state = this._state;\n var velocity = this._velocity;\n var statePtr = state.length - d;\n var bounds = this.bounds;\n var lo = bounds[0];\n var hi = bounds[1];\n var dt = t - t02;\n this._time.push(t);\n for (var i = d - 1; i >= 0; --i) {\n state.push(clamp(lo[i], hi[i], state[statePtr] + dt * velocity[statePtr]));\n velocity.push(0);\n statePtr += 1;\n }\n };\n function getZero(d) {\n var result = new Array(d);\n for (var i = 0; i < d; ++i) {\n result[i] = 0;\n }\n return result;\n }\n function createFilteredVector(initState, initVelocity, initTime) {\n switch (arguments.length) {\n case 0:\n return new FilteredVector([0], [0], 0);\n case 1:\n if (typeof initState === \"number\") {\n var zero2 = getZero(initState);\n return new FilteredVector(zero2, zero2, 0);\n } else {\n return new FilteredVector(initState, getZero(initState.length), 0);\n }\n case 2:\n if (typeof initVelocity === \"number\") {\n var zero2 = getZero(initState.length);\n return new FilteredVector(initState, zero2, +initVelocity);\n } else {\n initTime = 0;\n }\n case 3:\n if (initState.length !== initVelocity.length) {\n throw new Error(\"state and velocity lengths must match\");\n }\n return new FilteredVector(initState, initVelocity, initTime);\n }\n }\n }\n ),\n /***/\n 3840: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = createRBTree;\n var RED = 0;\n var BLACK = 1;\n function RBNode(color2, key, value, left, right, count) {\n this._color = color2;\n this.key = key;\n this.value = value;\n this.left = left;\n this.right = right;\n this._count = count;\n }\n function cloneNode(node) {\n return new RBNode(node._color, node.key, node.value, node.left, node.right, node._count);\n }\n function repaint(color2, node) {\n return new RBNode(color2, node.key, node.value, node.left, node.right, node._count);\n }\n function recount(node) {\n node._count = 1 + (node.left ? node.left._count : 0) + (node.right ? node.right._count : 0);\n }\n function RedBlackTree(compare, root) {\n this._compare = compare;\n this.root = root;\n }\n var proto = RedBlackTree.prototype;\n Object.defineProperty(proto, \"keys\", {\n get: function() {\n var result = [];\n this.forEach(function(k, v) {\n result.push(k);\n });\n return result;\n }\n });\n Object.defineProperty(proto, \"values\", {\n get: function() {\n var result = [];\n this.forEach(function(k, v) {\n result.push(v);\n });\n return result;\n }\n });\n Object.defineProperty(proto, \"length\", {\n get: function() {\n if (this.root) {\n return this.root._count;\n }\n return 0;\n }\n });\n proto.insert = function(key, value) {\n var cmp = this._compare;\n var n = this.root;\n var n_stack = [];\n var d_stack = [];\n while (n) {\n var d = cmp(key, n.key);\n n_stack.push(n);\n d_stack.push(d);\n if (d <= 0) {\n n = n.left;\n } else {\n n = n.right;\n }\n }\n n_stack.push(new RBNode(RED, key, value, null, null, 1));\n for (var s = n_stack.length - 2; s >= 0; --s) {\n var n = n_stack[s];\n if (d_stack[s] <= 0) {\n n_stack[s] = new RBNode(n._color, n.key, n.value, n_stack[s + 1], n.right, n._count + 1);\n } else {\n n_stack[s] = new RBNode(n._color, n.key, n.value, n.left, n_stack[s + 1], n._count + 1);\n }\n }\n for (var s = n_stack.length - 1; s > 1; --s) {\n var p = n_stack[s - 1];\n var n = n_stack[s];\n if (p._color === BLACK || n._color === BLACK) {\n break;\n }\n var pp = n_stack[s - 2];\n if (pp.left === p) {\n if (p.left === n) {\n var y = pp.right;\n if (y && y._color === RED) {\n p._color = BLACK;\n pp.right = repaint(BLACK, y);\n pp._color = RED;\n s -= 1;\n } else {\n pp._color = RED;\n pp.left = p.right;\n p._color = BLACK;\n p.right = pp;\n n_stack[s - 2] = p;\n n_stack[s - 1] = n;\n recount(pp);\n recount(p);\n if (s >= 3) {\n var ppp = n_stack[s - 3];\n if (ppp.left === pp) {\n ppp.left = p;\n } else {\n ppp.right = p;\n }\n }\n break;\n }\n } else {\n var y = pp.right;\n if (y && y._color === RED) {\n p._color = BLACK;\n pp.right = repaint(BLACK, y);\n pp._color = RED;\n s -= 1;\n } else {\n p.right = n.left;\n pp._color = RED;\n pp.left = n.right;\n n._color = BLACK;\n n.left = p;\n n.right = pp;\n n_stack[s - 2] = n;\n n_stack[s - 1] = p;\n recount(pp);\n recount(p);\n recount(n);\n if (s >= 3) {\n var ppp = n_stack[s - 3];\n if (ppp.left === pp) {\n ppp.left = n;\n } else {\n ppp.right = n;\n }\n }\n break;\n }\n }\n } else {\n if (p.right === n) {\n var y = pp.left;\n if (y && y._color === RED) {\n p._color = BLACK;\n pp.left = repaint(BLACK, y);\n pp._color = RED;\n s -= 1;\n } else {\n pp._color = RED;\n pp.right = p.left;\n p._color = BLACK;\n p.left = pp;\n n_stack[s - 2] = p;\n n_stack[s - 1] = n;\n recount(pp);\n recount(p);\n if (s >= 3) {\n var ppp = n_stack[s - 3];\n if (ppp.right === pp) {\n ppp.right = p;\n } else {\n ppp.left = p;\n }\n }\n break;\n }\n } else {\n var y = pp.left;\n if (y && y._color === RED) {\n p._color = BLACK;\n pp.left = repaint(BLACK, y);\n pp._color = RED;\n s -= 1;\n } else {\n p.left = n.right;\n pp._color = RED;\n pp.right = n.left;\n n._color = BLACK;\n n.right = p;\n n.left = pp;\n n_stack[s - 2] = n;\n n_stack[s - 1] = p;\n recount(pp);\n recount(p);\n recount(n);\n if (s >= 3) {\n var ppp = n_stack[s - 3];\n if (ppp.right === pp) {\n ppp.right = n;\n } else {\n ppp.left = n;\n }\n }\n break;\n }\n }\n }\n }\n n_stack[0]._color = BLACK;\n return new RedBlackTree(cmp, n_stack[0]);\n };\n function doVisitFull(visit, node) {\n if (node.left) {\n var v = doVisitFull(visit, node.left);\n if (v) {\n return v;\n }\n }\n var v = visit(node.key, node.value);\n if (v) {\n return v;\n }\n if (node.right) {\n return doVisitFull(visit, node.right);\n }\n }\n function doVisitHalf(lo, compare, visit, node) {\n var l = compare(lo, node.key);\n if (l <= 0) {\n if (node.left) {\n var v = doVisitHalf(lo, compare, visit, node.left);\n if (v) {\n return v;\n }\n }\n var v = visit(node.key, node.value);\n if (v) {\n return v;\n }\n }\n if (node.right) {\n return doVisitHalf(lo, compare, visit, node.right);\n }\n }\n function doVisit(lo, hi, compare, visit, node) {\n var l = compare(lo, node.key);\n var h = compare(hi, node.key);\n var v;\n if (l <= 0) {\n if (node.left) {\n v = doVisit(lo, hi, compare, visit, node.left);\n if (v) {\n return v;\n }\n }\n if (h > 0) {\n v = visit(node.key, node.value);\n if (v) {\n return v;\n }\n }\n }\n if (h > 0 && node.right) {\n return doVisit(lo, hi, compare, visit, node.right);\n }\n }\n proto.forEach = function rbTreeForEach(visit, lo, hi) {\n if (!this.root) {\n return;\n }\n switch (arguments.length) {\n case 1:\n return doVisitFull(visit, this.root);\n break;\n case 2:\n return doVisitHalf(lo, this._compare, visit, this.root);\n break;\n case 3:\n if (this._compare(lo, hi) >= 0) {\n return;\n }\n return doVisit(lo, hi, this._compare, visit, this.root);\n break;\n }\n };\n Object.defineProperty(proto, \"begin\", {\n get: function() {\n var stack = [];\n var n = this.root;\n while (n) {\n stack.push(n);\n n = n.left;\n }\n return new RedBlackTreeIterator(this, stack);\n }\n });\n Object.defineProperty(proto, \"end\", {\n get: function() {\n var stack = [];\n var n = this.root;\n while (n) {\n stack.push(n);\n n = n.right;\n }\n return new RedBlackTreeIterator(this, stack);\n }\n });\n proto.at = function(idx) {\n if (idx < 0) {\n return new RedBlackTreeIterator(this, []);\n }\n var n = this.root;\n var stack = [];\n while (true) {\n stack.push(n);\n if (n.left) {\n if (idx < n.left._count) {\n n = n.left;\n continue;\n }\n idx -= n.left._count;\n }\n if (!idx) {\n return new RedBlackTreeIterator(this, stack);\n }\n idx -= 1;\n if (n.right) {\n if (idx >= n.right._count) {\n break;\n }\n n = n.right;\n } else {\n break;\n }\n }\n return new RedBlackTreeIterator(this, []);\n };\n proto.ge = function(key) {\n var cmp = this._compare;\n var n = this.root;\n var stack = [];\n var last_ptr = 0;\n while (n) {\n var d = cmp(key, n.key);\n stack.push(n);\n if (d <= 0) {\n last_ptr = stack.length;\n }\n if (d <= 0) {\n n = n.left;\n } else {\n n = n.right;\n }\n }\n stack.length = last_ptr;\n return new RedBlackTreeIterator(this, stack);\n };\n proto.gt = function(key) {\n var cmp = this._compare;\n var n = this.root;\n var stack = [];\n var last_ptr = 0;\n while (n) {\n var d = cmp(key, n.key);\n stack.push(n);\n if (d < 0) {\n last_ptr = stack.length;\n }\n if (d < 0) {\n n = n.left;\n } else {\n n = n.right;\n }\n }\n stack.length = last_ptr;\n return new RedBlackTreeIterator(this, stack);\n };\n proto.lt = function(key) {\n var cmp = this._compare;\n var n = this.root;\n var stack = [];\n var last_ptr = 0;\n while (n) {\n var d = cmp(key, n.key);\n stack.push(n);\n if (d > 0) {\n last_ptr = stack.length;\n }\n if (d <= 0) {\n n = n.left;\n } else {\n n = n.right;\n }\n }\n stack.length = last_ptr;\n return new RedBlackTreeIterator(this, stack);\n };\n proto.le = function(key) {\n var cmp = this._compare;\n var n = this.root;\n var stack = [];\n var last_ptr = 0;\n while (n) {\n var d = cmp(key, n.key);\n stack.push(n);\n if (d >= 0) {\n last_ptr = stack.length;\n }\n if (d < 0) {\n n = n.left;\n } else {\n n = n.right;\n }\n }\n stack.length = last_ptr;\n return new RedBlackTreeIterator(this, stack);\n };\n proto.find = function(key) {\n var cmp = this._compare;\n var n = this.root;\n var stack = [];\n while (n) {\n var d = cmp(key, n.key);\n stack.push(n);\n if (d === 0) {\n return new RedBlackTreeIterator(this, stack);\n }\n if (d <= 0) {\n n = n.left;\n } else {\n n = n.right;\n }\n }\n return new RedBlackTreeIterator(this, []);\n };\n proto.remove = function(key) {\n var iter = this.find(key);\n if (iter) {\n return iter.remove();\n }\n return this;\n };\n proto.get = function(key) {\n var cmp = this._compare;\n var n = this.root;\n while (n) {\n var d = cmp(key, n.key);\n if (d === 0) {\n return n.value;\n }\n if (d <= 0) {\n n = n.left;\n } else {\n n = n.right;\n }\n }\n return;\n };\n function RedBlackTreeIterator(tree, stack) {\n this.tree = tree;\n this._stack = stack;\n }\n var iproto = RedBlackTreeIterator.prototype;\n Object.defineProperty(iproto, \"valid\", {\n get: function() {\n return this._stack.length > 0;\n }\n });\n Object.defineProperty(iproto, \"node\", {\n get: function() {\n if (this._stack.length > 0) {\n return this._stack[this._stack.length - 1];\n }\n return null;\n },\n enumerable: true\n });\n iproto.clone = function() {\n return new RedBlackTreeIterator(this.tree, this._stack.slice());\n };\n function swapNode(n, v) {\n n.key = v.key;\n n.value = v.value;\n n.left = v.left;\n n.right = v.right;\n n._color = v._color;\n n._count = v._count;\n }\n function fixDoubleBlack(stack) {\n var n, p, s, z;\n for (var i = stack.length - 1; i >= 0; --i) {\n n = stack[i];\n if (i === 0) {\n n._color = BLACK;\n return;\n }\n p = stack[i - 1];\n if (p.left === n) {\n s = p.right;\n if (s.right && s.right._color === RED) {\n s = p.right = cloneNode(s);\n z = s.right = cloneNode(s.right);\n p.right = s.left;\n s.left = p;\n s.right = z;\n s._color = p._color;\n n._color = BLACK;\n p._color = BLACK;\n z._color = BLACK;\n recount(p);\n recount(s);\n if (i > 1) {\n var pp = stack[i - 2];\n if (pp.left === p) {\n pp.left = s;\n } else {\n pp.right = s;\n }\n }\n stack[i - 1] = s;\n return;\n } else if (s.left && s.left._color === RED) {\n s = p.right = cloneNode(s);\n z = s.left = cloneNode(s.left);\n p.right = z.left;\n s.left = z.right;\n z.left = p;\n z.right = s;\n z._color = p._color;\n p._color = BLACK;\n s._color = BLACK;\n n._color = BLACK;\n recount(p);\n recount(s);\n recount(z);\n if (i > 1) {\n var pp = stack[i - 2];\n if (pp.left === p) {\n pp.left = z;\n } else {\n pp.right = z;\n }\n }\n stack[i - 1] = z;\n return;\n }\n if (s._color === BLACK) {\n if (p._color === RED) {\n p._color = BLACK;\n p.right = repaint(RED, s);\n return;\n } else {\n p.right = repaint(RED, s);\n continue;\n }\n } else {\n s = cloneNode(s);\n p.right = s.left;\n s.left = p;\n s._color = p._color;\n p._color = RED;\n recount(p);\n recount(s);\n if (i > 1) {\n var pp = stack[i - 2];\n if (pp.left === p) {\n pp.left = s;\n } else {\n pp.right = s;\n }\n }\n stack[i - 1] = s;\n stack[i] = p;\n if (i + 1 < stack.length) {\n stack[i + 1] = n;\n } else {\n stack.push(n);\n }\n i = i + 2;\n }\n } else {\n s = p.left;\n if (s.left && s.left._color === RED) {\n s = p.left = cloneNode(s);\n z = s.left = cloneNode(s.left);\n p.left = s.right;\n s.right = p;\n s.left = z;\n s._color = p._color;\n n._color = BLACK;\n p._color = BLACK;\n z._color = BLACK;\n recount(p);\n recount(s);\n if (i > 1) {\n var pp = stack[i - 2];\n if (pp.right === p) {\n pp.right = s;\n } else {\n pp.left = s;\n }\n }\n stack[i - 1] = s;\n return;\n } else if (s.right && s.right._color === RED) {\n s = p.left = cloneNode(s);\n z = s.right = cloneNode(s.right);\n p.left = z.right;\n s.right = z.left;\n z.right = p;\n z.left = s;\n z._color = p._color;\n p._color = BLACK;\n s._color = BLACK;\n n._color = BLACK;\n recount(p);\n recount(s);\n recount(z);\n if (i > 1) {\n var pp = stack[i - 2];\n if (pp.right === p) {\n pp.right = z;\n } else {\n pp.left = z;\n }\n }\n stack[i - 1] = z;\n return;\n }\n if (s._color === BLACK) {\n if (p._color === RED) {\n p._color = BLACK;\n p.left = repaint(RED, s);\n return;\n } else {\n p.left = repaint(RED, s);\n continue;\n }\n } else {\n s = cloneNode(s);\n p.left = s.right;\n s.right = p;\n s._color = p._color;\n p._color = RED;\n recount(p);\n recount(s);\n if (i > 1) {\n var pp = stack[i - 2];\n if (pp.right === p) {\n pp.right = s;\n } else {\n pp.left = s;\n }\n }\n stack[i - 1] = s;\n stack[i] = p;\n if (i + 1 < stack.length) {\n stack[i + 1] = n;\n } else {\n stack.push(n);\n }\n i = i + 2;\n }\n }\n }\n }\n iproto.remove = function() {\n var stack = this._stack;\n if (stack.length === 0) {\n return this.tree;\n }\n var cstack = new Array(stack.length);\n var n = stack[stack.length - 1];\n cstack[cstack.length - 1] = new RBNode(n._color, n.key, n.value, n.left, n.right, n._count);\n for (var i = stack.length - 2; i >= 0; --i) {\n var n = stack[i];\n if (n.left === stack[i + 1]) {\n cstack[i] = new RBNode(n._color, n.key, n.value, cstack[i + 1], n.right, n._count);\n } else {\n cstack[i] = new RBNode(n._color, n.key, n.value, n.left, cstack[i + 1], n._count);\n }\n }\n n = cstack[cstack.length - 1];\n if (n.left && n.right) {\n var split = cstack.length;\n n = n.left;\n while (n.right) {\n cstack.push(n);\n n = n.right;\n }\n var v = cstack[split - 1];\n cstack.push(new RBNode(n._color, v.key, v.value, n.left, n.right, n._count));\n cstack[split - 1].key = n.key;\n cstack[split - 1].value = n.value;\n for (var i = cstack.length - 2; i >= split; --i) {\n n = cstack[i];\n cstack[i] = new RBNode(n._color, n.key, n.value, n.left, cstack[i + 1], n._count);\n }\n cstack[split - 1].left = cstack[split];\n }\n n = cstack[cstack.length - 1];\n if (n._color === RED) {\n var p = cstack[cstack.length - 2];\n if (p.left === n) {\n p.left = null;\n } else if (p.right === n) {\n p.right = null;\n }\n cstack.pop();\n for (var i = 0; i < cstack.length; ++i) {\n cstack[i]._count--;\n }\n return new RedBlackTree(this.tree._compare, cstack[0]);\n } else {\n if (n.left || n.right) {\n if (n.left) {\n swapNode(n, n.left);\n } else if (n.right) {\n swapNode(n, n.right);\n }\n n._color = BLACK;\n for (var i = 0; i < cstack.length - 1; ++i) {\n cstack[i]._count--;\n }\n return new RedBlackTree(this.tree._compare, cstack[0]);\n } else if (cstack.length === 1) {\n return new RedBlackTree(this.tree._compare, null);\n } else {\n for (var i = 0; i < cstack.length; ++i) {\n cstack[i]._count--;\n }\n var parent = cstack[cstack.length - 2];\n fixDoubleBlack(cstack);\n if (parent.left === n) {\n parent.left = null;\n } else {\n parent.right = null;\n }\n }\n }\n return new RedBlackTree(this.tree._compare, cstack[0]);\n };\n Object.defineProperty(iproto, \"key\", {\n get: function() {\n if (this._stack.length > 0) {\n return this._stack[this._stack.length - 1].key;\n }\n return;\n },\n enumerable: true\n });\n Object.defineProperty(iproto, \"value\", {\n get: function() {\n if (this._stack.length > 0) {\n return this._stack[this._stack.length - 1].value;\n }\n return;\n },\n enumerable: true\n });\n Object.defineProperty(iproto, \"index\", {\n get: function() {\n var idx = 0;\n var stack = this._stack;\n if (stack.length === 0) {\n var r = this.tree.root;\n if (r) {\n return r._count;\n }\n return 0;\n } else if (stack[stack.length - 1].left) {\n idx = stack[stack.length - 1].left._count;\n }\n for (var s = stack.length - 2; s >= 0; --s) {\n if (stack[s + 1] === stack[s].right) {\n ++idx;\n if (stack[s].left) {\n idx += stack[s].left._count;\n }\n }\n }\n return idx;\n },\n enumerable: true\n });\n iproto.next = function() {\n var stack = this._stack;\n if (stack.length === 0) {\n return;\n }\n var n = stack[stack.length - 1];\n if (n.right) {\n n = n.right;\n while (n) {\n stack.push(n);\n n = n.left;\n }\n } else {\n stack.pop();\n while (stack.length > 0 && stack[stack.length - 1].right === n) {\n n = stack[stack.length - 1];\n stack.pop();\n }\n }\n };\n Object.defineProperty(iproto, \"hasNext\", {\n get: function() {\n var stack = this._stack;\n if (stack.length === 0) {\n return false;\n }\n if (stack[stack.length - 1].right) {\n return true;\n }\n for (var s = stack.length - 1; s > 0; --s) {\n if (stack[s - 1].left === stack[s]) {\n return true;\n }\n }\n return false;\n }\n });\n iproto.update = function(value) {\n var stack = this._stack;\n if (stack.length === 0) {\n throw new Error(\"Can't update empty node!\");\n }\n var cstack = new Array(stack.length);\n var n = stack[stack.length - 1];\n cstack[cstack.length - 1] = new RBNode(n._color, n.key, value, n.left, n.right, n._count);\n for (var i = stack.length - 2; i >= 0; --i) {\n n = stack[i];\n if (n.left === stack[i + 1]) {\n cstack[i] = new RBNode(n._color, n.key, n.value, cstack[i + 1], n.right, n._count);\n } else {\n cstack[i] = new RBNode(n._color, n.key, n.value, n.left, cstack[i + 1], n._count);\n }\n }\n return new RedBlackTree(this.tree._compare, cstack[0]);\n };\n iproto.prev = function() {\n var stack = this._stack;\n if (stack.length === 0) {\n return;\n }\n var n = stack[stack.length - 1];\n if (n.left) {\n n = n.left;\n while (n) {\n stack.push(n);\n n = n.right;\n }\n } else {\n stack.pop();\n while (stack.length > 0 && stack[stack.length - 1].left === n) {\n n = stack[stack.length - 1];\n stack.pop();\n }\n }\n };\n Object.defineProperty(iproto, \"hasPrev\", {\n get: function() {\n var stack = this._stack;\n if (stack.length === 0) {\n return false;\n }\n if (stack[stack.length - 1].left) {\n return true;\n }\n for (var s = stack.length - 1; s > 0; --s) {\n if (stack[s - 1].right === stack[s]) {\n return true;\n }\n }\n return false;\n }\n });\n function defaultCompare(a, b) {\n if (a < b) {\n return -1;\n }\n if (a > b) {\n return 1;\n }\n return 0;\n }\n function createRBTree(compare) {\n return new RedBlackTree(compare || defaultCompare, null);\n }\n }\n ),\n /***/\n 3837: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = createAxes;\n var createText = __webpack_require__2(4935);\n var createLines = __webpack_require__2(501);\n var createBackground = __webpack_require__2(5304);\n var getCubeProperties = __webpack_require__2(6429);\n var Ticks = __webpack_require__2(6444);\n var identity2 = new Float32Array([\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ]);\n var ab = ArrayBuffer;\n var dv = DataView;\n function isTypedArray(a) {\n return ab.isView(a) && !(a instanceof dv);\n }\n function isArrayOrTypedArray(a) {\n return Array.isArray(a) || isTypedArray(a);\n }\n function copyVec3(a, b) {\n a[0] = b[0];\n a[1] = b[1];\n a[2] = b[2];\n return a;\n }\n function Axes(gl2) {\n this.gl = gl2;\n this.pixelRatio = 1;\n this.bounds = [\n [-10, -10, -10],\n [10, 10, 10]\n ];\n this.ticks = [[], [], []];\n this.autoTicks = true;\n this.tickSpacing = [1, 1, 1];\n this.tickEnable = [true, true, true];\n this.tickFont = [\"sans-serif\", \"sans-serif\", \"sans-serif\"];\n this.tickFontStyle = [\"normal\", \"normal\", \"normal\"];\n this.tickFontWeight = [\"normal\", \"normal\", \"normal\"];\n this.tickFontVariant = [\"normal\", \"normal\", \"normal\"];\n this.tickSize = [12, 12, 12];\n this.tickAngle = [0, 0, 0];\n this.tickAlign = [\"auto\", \"auto\", \"auto\"];\n this.tickColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]];\n this.tickPad = [10, 10, 10];\n this.lastCubeProps = {\n cubeEdges: [0, 0, 0],\n axis: [0, 0, 0]\n };\n this.labels = [\"x\", \"y\", \"z\"];\n this.labelEnable = [true, true, true];\n this.labelFont = [\"sans-serif\", \"sans-serif\", \"sans-serif\"];\n this.labelFontStyle = [\"normal\", \"normal\", \"normal\"];\n this.labelFontWeight = [\"normal\", \"normal\", \"normal\"];\n this.labelFontVariant = [\"normal\", \"normal\", \"normal\"];\n this.labelSize = [20, 20, 20];\n this.labelAngle = [0, 0, 0];\n this.labelAlign = [\"auto\", \"auto\", \"auto\"];\n this.labelColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]];\n this.labelPad = [10, 10, 10];\n this.lineEnable = [true, true, true];\n this.lineMirror = [false, false, false];\n this.lineWidth = [1, 1, 1];\n this.lineColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]];\n this.lineTickEnable = [true, true, true];\n this.lineTickMirror = [false, false, false];\n this.lineTickLength = [0, 0, 0];\n this.lineTickWidth = [1, 1, 1];\n this.lineTickColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]];\n this.gridEnable = [true, true, true];\n this.gridWidth = [1, 1, 1];\n this.gridColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]];\n this.zeroEnable = [true, true, true];\n this.zeroLineColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]];\n this.zeroLineWidth = [2, 2, 2];\n this.backgroundEnable = [false, false, false];\n this.backgroundColor = [\n [0.8, 0.8, 0.8, 0.5],\n [0.8, 0.8, 0.8, 0.5],\n [0.8, 0.8, 0.8, 0.5]\n ];\n this._firstInit = true;\n this._text = null;\n this._lines = null;\n this._background = createBackground(gl2);\n }\n var proto = Axes.prototype;\n proto.update = function(options) {\n options = options || {};\n function parseOption(nest, cons, name2) {\n if (name2 in options) {\n var opt = options[name2];\n var prev = this[name2];\n var next;\n if (nest ? isArrayOrTypedArray(opt) && isArrayOrTypedArray(opt[0]) : isArrayOrTypedArray(opt)) {\n this[name2] = next = [cons(opt[0]), cons(opt[1]), cons(opt[2])];\n } else {\n this[name2] = next = [cons(opt), cons(opt), cons(opt)];\n }\n for (var i2 = 0; i2 < 3; ++i2) {\n if (next[i2] !== prev[i2]) {\n return true;\n }\n }\n }\n return false;\n }\n var NUMBER = parseOption.bind(this, false, Number);\n var BOOLEAN = parseOption.bind(this, false, Boolean);\n var STRING = parseOption.bind(this, false, String);\n var COLOR = parseOption.bind(this, true, function(v) {\n if (isArrayOrTypedArray(v)) {\n if (v.length === 3) {\n return [+v[0], +v[1], +v[2], 1];\n } else if (v.length === 4) {\n return [+v[0], +v[1], +v[2], +v[3]];\n }\n }\n return [0, 0, 0, 1];\n });\n var nextTicks;\n var ticksUpdate = false;\n var boundsChanged = false;\n if (\"bounds\" in options) {\n var bounds = options.bounds;\n i_loop:\n for (var i = 0; i < 2; ++i) {\n for (var j = 0; j < 3; ++j) {\n if (bounds[i][j] !== this.bounds[i][j]) {\n boundsChanged = true;\n }\n this.bounds[i][j] = bounds[i][j];\n }\n }\n }\n if (\"ticks\" in options) {\n nextTicks = options.ticks;\n ticksUpdate = true;\n this.autoTicks = false;\n for (var i = 0; i < 3; ++i) {\n this.tickSpacing[i] = 0;\n }\n } else if (NUMBER(\"tickSpacing\")) {\n this.autoTicks = true;\n boundsChanged = true;\n }\n if (this._firstInit) {\n if (!(\"ticks\" in options || \"tickSpacing\" in options)) {\n this.autoTicks = true;\n }\n boundsChanged = true;\n ticksUpdate = true;\n this._firstInit = false;\n }\n if (boundsChanged && this.autoTicks) {\n nextTicks = Ticks.create(this.bounds, this.tickSpacing);\n ticksUpdate = true;\n }\n if (ticksUpdate) {\n for (var i = 0; i < 3; ++i) {\n nextTicks[i].sort(function(a, b) {\n return a.x - b.x;\n });\n }\n if (Ticks.equal(nextTicks, this.ticks)) {\n ticksUpdate = false;\n } else {\n this.ticks = nextTicks;\n }\n }\n BOOLEAN(\"tickEnable\");\n if (STRING(\"tickFont\")) ticksUpdate = true;\n if (STRING(\"tickFontStyle\")) ticksUpdate = true;\n if (STRING(\"tickFontWeight\")) ticksUpdate = true;\n if (STRING(\"tickFontVariant\")) ticksUpdate = true;\n NUMBER(\"tickSize\");\n NUMBER(\"tickAngle\");\n NUMBER(\"tickPad\");\n COLOR(\"tickColor\");\n var labelUpdate = STRING(\"labels\");\n if (STRING(\"labelFont\")) labelUpdate = true;\n if (STRING(\"labelFontStyle\")) labelUpdate = true;\n if (STRING(\"labelFontWeight\")) labelUpdate = true;\n if (STRING(\"labelFontVariant\")) labelUpdate = true;\n BOOLEAN(\"labelEnable\");\n NUMBER(\"labelSize\");\n NUMBER(\"labelPad\");\n COLOR(\"labelColor\");\n BOOLEAN(\"lineEnable\");\n BOOLEAN(\"lineMirror\");\n NUMBER(\"lineWidth\");\n COLOR(\"lineColor\");\n BOOLEAN(\"lineTickEnable\");\n BOOLEAN(\"lineTickMirror\");\n NUMBER(\"lineTickLength\");\n NUMBER(\"lineTickWidth\");\n COLOR(\"lineTickColor\");\n BOOLEAN(\"gridEnable\");\n NUMBER(\"gridWidth\");\n COLOR(\"gridColor\");\n BOOLEAN(\"zeroEnable\");\n COLOR(\"zeroLineColor\");\n NUMBER(\"zeroLineWidth\");\n BOOLEAN(\"backgroundEnable\");\n COLOR(\"backgroundColor\");\n var labelFontOpts = [\n {\n family: this.labelFont[0],\n style: this.labelFontStyle[0],\n weight: this.labelFontWeight[0],\n variant: this.labelFontVariant[0]\n },\n {\n family: this.labelFont[1],\n style: this.labelFontStyle[1],\n weight: this.labelFontWeight[1],\n variant: this.labelFontVariant[1]\n },\n {\n family: this.labelFont[2],\n style: this.labelFontStyle[2],\n weight: this.labelFontWeight[2],\n variant: this.labelFontVariant[2]\n }\n ];\n var tickFontOpts = [\n {\n family: this.tickFont[0],\n style: this.tickFontStyle[0],\n weight: this.tickFontWeight[0],\n variant: this.tickFontVariant[0]\n },\n {\n family: this.tickFont[1],\n style: this.tickFontStyle[1],\n weight: this.tickFontWeight[1],\n variant: this.tickFontVariant[1]\n },\n {\n family: this.tickFont[2],\n style: this.tickFontStyle[2],\n weight: this.tickFontWeight[2],\n variant: this.tickFontVariant[2]\n }\n ];\n if (!this._text) {\n this._text = createText(\n this.gl,\n this.bounds,\n this.labels,\n labelFontOpts,\n this.ticks,\n tickFontOpts\n );\n } else if (this._text && (labelUpdate || ticksUpdate)) {\n this._text.update(\n this.bounds,\n this.labels,\n labelFontOpts,\n this.ticks,\n tickFontOpts\n );\n }\n if (this._lines && ticksUpdate) {\n this._lines.dispose();\n this._lines = null;\n }\n if (!this._lines) {\n this._lines = createLines(this.gl, this.bounds, this.ticks);\n }\n };\n function OffsetInfo() {\n this.primalOffset = [0, 0, 0];\n this.primalMinor = [0, 0, 0];\n this.mirrorOffset = [0, 0, 0];\n this.mirrorMinor = [0, 0, 0];\n }\n var LINE_OFFSET = [new OffsetInfo(), new OffsetInfo(), new OffsetInfo()];\n function computeLineOffset(result, i, bounds, cubeEdges, cubeAxis) {\n var primalOffset = result.primalOffset;\n var primalMinor = result.primalMinor;\n var dualOffset = result.mirrorOffset;\n var dualMinor = result.mirrorMinor;\n var e = cubeEdges[i];\n for (var j = 0; j < 3; ++j) {\n if (i === j) {\n continue;\n }\n var a = primalOffset, b = dualOffset, c = primalMinor, d = dualMinor;\n if (e & 1 << j) {\n a = dualOffset;\n b = primalOffset;\n c = dualMinor;\n d = primalMinor;\n }\n a[j] = bounds[0][j];\n b[j] = bounds[1][j];\n if (cubeAxis[j] > 0) {\n c[j] = -1;\n d[j] = 0;\n } else {\n c[j] = 0;\n d[j] = 1;\n }\n }\n }\n var CUBE_ENABLE = [0, 0, 0];\n var DEFAULT_PARAMS = {\n model: identity2,\n view: identity2,\n projection: identity2,\n _ortho: false\n };\n proto.isOpaque = function() {\n return true;\n };\n proto.isTransparent = function() {\n return false;\n };\n proto.drawTransparent = function(params) {\n };\n var ALIGN_OPTION_AUTO = 0;\n var PRIMAL_MINOR = [0, 0, 0];\n var MIRROR_MINOR = [0, 0, 0];\n var PRIMAL_OFFSET = [0, 0, 0];\n proto.draw = function(params) {\n params = params || DEFAULT_PARAMS;\n var gl2 = this.gl;\n var model = params.model || identity2;\n var view = params.view || identity2;\n var projection = params.projection || identity2;\n var bounds = this.bounds;\n var isOrtho = params._ortho || false;\n var cubeParams = getCubeProperties(model, view, projection, bounds, isOrtho);\n var cubeEdges = cubeParams.cubeEdges;\n var cubeAxis = cubeParams.axis;\n var cx = view[12];\n var cy = view[13];\n var cz = view[14];\n var cw = view[15];\n var orthoFix = isOrtho ? 2 : 1;\n var pixelScaleF = orthoFix * this.pixelRatio * (projection[3] * cx + projection[7] * cy + projection[11] * cz + projection[15] * cw) / gl2.drawingBufferHeight;\n for (var i = 0; i < 3; ++i) {\n this.lastCubeProps.cubeEdges[i] = cubeEdges[i];\n this.lastCubeProps.axis[i] = cubeAxis[i];\n }\n var lineOffset = LINE_OFFSET;\n for (var i = 0; i < 3; ++i) {\n computeLineOffset(\n LINE_OFFSET[i],\n i,\n this.bounds,\n cubeEdges,\n cubeAxis\n );\n }\n var gl2 = this.gl;\n var cubeEnable = CUBE_ENABLE;\n for (var i = 0; i < 3; ++i) {\n if (this.backgroundEnable[i]) {\n cubeEnable[i] = cubeAxis[i];\n } else {\n cubeEnable[i] = 0;\n }\n }\n this._background.draw(\n model,\n view,\n projection,\n bounds,\n cubeEnable,\n this.backgroundColor\n );\n this._lines.bind(\n model,\n view,\n projection,\n this\n );\n for (var i = 0; i < 3; ++i) {\n var x = [0, 0, 0];\n if (cubeAxis[i] > 0) {\n x[i] = bounds[1][i];\n } else {\n x[i] = bounds[0][i];\n }\n for (var j = 0; j < 2; ++j) {\n var u = (i + 1 + j) % 3;\n var v = (i + 1 + (j ^ 1)) % 3;\n if (this.gridEnable[u]) {\n this._lines.drawGrid(u, v, this.bounds, x, this.gridColor[u], this.gridWidth[u] * this.pixelRatio);\n }\n }\n for (var j = 0; j < 2; ++j) {\n var u = (i + 1 + j) % 3;\n var v = (i + 1 + (j ^ 1)) % 3;\n if (this.zeroEnable[v]) {\n if (Math.min(bounds[0][v], bounds[1][v]) <= 0 && Math.max(bounds[0][v], bounds[1][v]) >= 0) {\n this._lines.drawZero(u, v, this.bounds, x, this.zeroLineColor[v], this.zeroLineWidth[v] * this.pixelRatio);\n }\n }\n }\n }\n for (var i = 0; i < 3; ++i) {\n if (this.lineEnable[i]) {\n this._lines.drawAxisLine(i, this.bounds, lineOffset[i].primalOffset, this.lineColor[i], this.lineWidth[i] * this.pixelRatio);\n }\n if (this.lineMirror[i]) {\n this._lines.drawAxisLine(i, this.bounds, lineOffset[i].mirrorOffset, this.lineColor[i], this.lineWidth[i] * this.pixelRatio);\n }\n var primalMinor = copyVec3(PRIMAL_MINOR, lineOffset[i].primalMinor);\n var mirrorMinor = copyVec3(MIRROR_MINOR, lineOffset[i].mirrorMinor);\n var tickLength = this.lineTickLength;\n for (var j = 0; j < 3; ++j) {\n var scaleFactor = pixelScaleF / model[5 * j];\n primalMinor[j] *= tickLength[j] * scaleFactor;\n mirrorMinor[j] *= tickLength[j] * scaleFactor;\n }\n if (this.lineTickEnable[i]) {\n this._lines.drawAxisTicks(i, lineOffset[i].primalOffset, primalMinor, this.lineTickColor[i], this.lineTickWidth[i] * this.pixelRatio);\n }\n if (this.lineTickMirror[i]) {\n this._lines.drawAxisTicks(i, lineOffset[i].mirrorOffset, mirrorMinor, this.lineTickColor[i], this.lineTickWidth[i] * this.pixelRatio);\n }\n }\n this._lines.unbind();\n this._text.bind(\n model,\n view,\n projection,\n this.pixelRatio\n );\n var alignOpt;\n var hv_ratio = 0.5;\n var enableAlign;\n var alignDir;\n function alignTo(i2) {\n alignDir = [0, 0, 0];\n alignDir[i2] = 1;\n }\n function solveTickAlignments(i2, minor2, major2) {\n var i1 = (i2 + 1) % 3;\n var i22 = (i2 + 2) % 3;\n var A2 = minor2[i1];\n var B2 = minor2[i22];\n var C2 = major2[i1];\n var D2 = major2[i22];\n if (A2 > 0 && D2 > 0) {\n alignTo(i1);\n return;\n } else if (A2 > 0 && D2 < 0) {\n alignTo(i1);\n return;\n } else if (A2 < 0 && D2 > 0) {\n alignTo(i1);\n return;\n } else if (A2 < 0 && D2 < 0) {\n alignTo(i1);\n return;\n } else if (B2 > 0 && C2 > 0) {\n alignTo(i22);\n return;\n } else if (B2 > 0 && C2 < 0) {\n alignTo(i22);\n return;\n } else if (B2 < 0 && C2 > 0) {\n alignTo(i22);\n return;\n } else if (B2 < 0 && C2 < 0) {\n alignTo(i22);\n return;\n }\n }\n for (var i = 0; i < 3; ++i) {\n var minor = lineOffset[i].primalMinor;\n var major = lineOffset[i].mirrorMinor;\n var offset = copyVec3(PRIMAL_OFFSET, lineOffset[i].primalOffset);\n for (var j = 0; j < 3; ++j) {\n if (this.lineTickEnable[i]) {\n offset[j] += pixelScaleF * minor[j] * Math.max(this.lineTickLength[j], 0) / model[5 * j];\n }\n }\n var axis = [0, 0, 0];\n axis[i] = 1;\n if (this.tickEnable[i]) {\n if (this.tickAngle[i] === -3600) {\n this.tickAngle[i] = 0;\n this.tickAlign[i] = \"auto\";\n } else {\n this.tickAlign[i] = -1;\n }\n enableAlign = 1;\n alignOpt = [this.tickAlign[i], hv_ratio, enableAlign];\n if (alignOpt[0] === \"auto\") alignOpt[0] = ALIGN_OPTION_AUTO;\n else alignOpt[0] = parseInt(\"\" + alignOpt[0]);\n alignDir = [0, 0, 0];\n solveTickAlignments(i, minor, major);\n for (var j = 0; j < 3; ++j) {\n offset[j] += pixelScaleF * minor[j] * this.tickPad[j] / model[5 * j];\n }\n this._text.drawTicks(\n i,\n this.tickSize[i],\n this.tickAngle[i],\n offset,\n this.tickColor[i],\n axis,\n alignDir,\n alignOpt\n );\n }\n if (this.labelEnable[i]) {\n enableAlign = 0;\n alignDir = [0, 0, 0];\n if (this.labels[i].length > 4) {\n alignTo(i);\n enableAlign = 1;\n }\n alignOpt = [this.labelAlign[i], hv_ratio, enableAlign];\n if (alignOpt[0] === \"auto\") alignOpt[0] = ALIGN_OPTION_AUTO;\n else alignOpt[0] = parseInt(\"\" + alignOpt[0]);\n for (var j = 0; j < 3; ++j) {\n offset[j] += pixelScaleF * minor[j] * this.labelPad[j] / model[5 * j];\n }\n offset[i] += 0.5 * (bounds[0][i] + bounds[1][i]);\n this._text.drawLabel(\n i,\n this.labelSize[i],\n this.labelAngle[i],\n offset,\n this.labelColor[i],\n [0, 0, 0],\n alignDir,\n alignOpt\n );\n }\n }\n this._text.unbind();\n };\n proto.dispose = function() {\n this._text.dispose();\n this._lines.dispose();\n this._background.dispose();\n this._lines = null;\n this._text = null;\n this._background = null;\n this.gl = null;\n };\n function createAxes(gl2, options) {\n var axes = new Axes(gl2);\n axes.update(options);\n return axes;\n }\n }\n ),\n /***/\n 5304: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = createBackgroundCube;\n var createBuffer = __webpack_require__2(2762);\n var createVAO = __webpack_require__2(8116);\n var createShader = __webpack_require__2(1879).bg;\n function BackgroundCube(gl2, buffer, vao, shader) {\n this.gl = gl2;\n this.buffer = buffer;\n this.vao = vao;\n this.shader = shader;\n }\n var proto = BackgroundCube.prototype;\n proto.draw = function(model, view, projection, bounds, enable, colors) {\n var needsBG = false;\n for (var i = 0; i < 3; ++i) {\n needsBG = needsBG || enable[i];\n }\n if (!needsBG) {\n return;\n }\n var gl2 = this.gl;\n gl2.enable(gl2.POLYGON_OFFSET_FILL);\n gl2.polygonOffset(1, 2);\n this.shader.bind();\n this.shader.uniforms = {\n model,\n view,\n projection,\n bounds,\n enable,\n colors\n };\n this.vao.bind();\n this.vao.draw(this.gl.TRIANGLES, 36);\n this.vao.unbind();\n gl2.disable(gl2.POLYGON_OFFSET_FILL);\n };\n proto.dispose = function() {\n this.vao.dispose();\n this.buffer.dispose();\n this.shader.dispose();\n };\n function createBackgroundCube(gl2) {\n var vertices = [];\n var indices = [];\n var ptr = 0;\n for (var d = 0; d < 3; ++d) {\n var u = (d + 1) % 3;\n var v = (d + 2) % 3;\n var x = [0, 0, 0];\n var c = [0, 0, 0];\n for (var s = -1; s <= 1; s += 2) {\n indices.push(\n ptr,\n ptr + 2,\n ptr + 1,\n ptr + 1,\n ptr + 2,\n ptr + 3\n );\n x[d] = s;\n c[d] = s;\n for (var i = -1; i <= 1; i += 2) {\n x[u] = i;\n for (var j = -1; j <= 1; j += 2) {\n x[v] = j;\n vertices.push(\n x[0],\n x[1],\n x[2],\n c[0],\n c[1],\n c[2]\n );\n ptr += 1;\n }\n }\n var tt = u;\n u = v;\n v = tt;\n }\n }\n var buffer = createBuffer(gl2, new Float32Array(vertices));\n var elements = createBuffer(gl2, new Uint16Array(indices), gl2.ELEMENT_ARRAY_BUFFER);\n var vao = createVAO(gl2, [\n {\n buffer,\n type: gl2.FLOAT,\n size: 3,\n offset: 0,\n stride: 24\n },\n {\n buffer,\n type: gl2.FLOAT,\n size: 3,\n offset: 12,\n stride: 24\n }\n ], elements);\n var shader = createShader(gl2);\n shader.attributes.position.location = 0;\n shader.attributes.normal.location = 1;\n return new BackgroundCube(gl2, buffer, vao, shader);\n }\n }\n ),\n /***/\n 6429: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = getCubeEdges;\n var bits = __webpack_require__2(8828);\n var multiply = __webpack_require__2(6760);\n var splitPoly = __webpack_require__2(5202);\n var orient = __webpack_require__2(3250);\n var mvp = new Array(16);\n var pCubeVerts = new Array(8);\n var cubeVerts = new Array(8);\n var x = new Array(3);\n var zero3 = [0, 0, 0];\n (function() {\n for (var i = 0; i < 8; ++i) {\n pCubeVerts[i] = [1, 1, 1, 1];\n cubeVerts[i] = [1, 1, 1];\n }\n })();\n function transformHg(result, x2, mat) {\n for (var i = 0; i < 4; ++i) {\n result[i] = mat[12 + i];\n for (var j = 0; j < 3; ++j) {\n result[i] += x2[j] * mat[4 * j + i];\n }\n }\n }\n var FRUSTUM_PLANES = [\n [0, 0, 1, 0, 0],\n [0, 0, -1, 1, 0],\n [0, -1, 0, 1, 0],\n [0, 1, 0, 1, 0],\n [-1, 0, 0, 1, 0],\n [1, 0, 0, 1, 0]\n ];\n function polygonArea(p) {\n for (var i = 0; i < FRUSTUM_PLANES.length; ++i) {\n p = splitPoly.positive(p, FRUSTUM_PLANES[i]);\n if (p.length < 3) {\n return 0;\n }\n }\n var base = p[0];\n var ax = base[0] / base[3];\n var ay = base[1] / base[3];\n var area = 0;\n for (var i = 1; i + 1 < p.length; ++i) {\n var b = p[i];\n var c = p[i + 1];\n var bx = b[0] / b[3];\n var by = b[1] / b[3];\n var cx = c[0] / c[3];\n var cy = c[1] / c[3];\n var ux = bx - ax;\n var uy = by - ay;\n var vx = cx - ax;\n var vy = cy - ay;\n area += Math.abs(ux * vy - uy * vx);\n }\n return area;\n }\n var CUBE_EDGES = [1, 1, 1];\n var CUBE_AXIS = [0, 0, 0];\n var CUBE_RESULT = {\n cubeEdges: CUBE_EDGES,\n axis: CUBE_AXIS\n };\n function getCubeEdges(model, view, projection, bounds, ortho) {\n multiply(mvp, view, model);\n multiply(mvp, projection, mvp);\n var ptr = 0;\n for (var i = 0; i < 2; ++i) {\n x[2] = bounds[i][2];\n for (var j = 0; j < 2; ++j) {\n x[1] = bounds[j][1];\n for (var k = 0; k < 2; ++k) {\n x[0] = bounds[k][0];\n transformHg(pCubeVerts[ptr], x, mvp);\n ptr += 1;\n }\n }\n }\n var closest = -1;\n for (var i = 0; i < 8; ++i) {\n var w = pCubeVerts[i][3];\n for (var l = 0; l < 3; ++l) {\n cubeVerts[i][l] = pCubeVerts[i][l] / w;\n }\n if (ortho) cubeVerts[i][2] *= -1;\n if (w < 0) {\n if (closest < 0) {\n closest = i;\n } else if (cubeVerts[i][2] < cubeVerts[closest][2]) {\n closest = i;\n }\n }\n }\n if (closest < 0) {\n closest = 0;\n for (var d = 0; d < 3; ++d) {\n var u = (d + 2) % 3;\n var v = (d + 1) % 3;\n var o0 = -1;\n var o1 = -1;\n for (var s = 0; s < 2; ++s) {\n var f0 = s << d;\n var f1 = f0 + (s << u) + (1 - s << v);\n var f2 = f0 + (1 - s << u) + (s << v);\n if (orient(cubeVerts[f0], cubeVerts[f1], cubeVerts[f2], zero3) < 0) {\n continue;\n }\n if (s) {\n o0 = 1;\n } else {\n o1 = 1;\n }\n }\n if (o0 < 0 || o1 < 0) {\n if (o1 > o0) {\n closest |= 1 << d;\n }\n continue;\n }\n for (var s = 0; s < 2; ++s) {\n var f0 = s << d;\n var f1 = f0 + (s << u) + (1 - s << v);\n var f2 = f0 + (1 - s << u) + (s << v);\n var o = polygonArea([\n pCubeVerts[f0],\n pCubeVerts[f1],\n pCubeVerts[f2],\n pCubeVerts[f0 + (1 << u) + (1 << v)]\n ]);\n if (s) {\n o0 = o;\n } else {\n o1 = o;\n }\n }\n if (o1 > o0) {\n closest |= 1 << d;\n continue;\n }\n }\n }\n var farthest = 7 ^ closest;\n var bottom = -1;\n for (var i = 0; i < 8; ++i) {\n if (i === closest || i === farthest) {\n continue;\n }\n if (bottom < 0) {\n bottom = i;\n } else if (cubeVerts[bottom][1] > cubeVerts[i][1]) {\n bottom = i;\n }\n }\n var left = -1;\n for (var i = 0; i < 3; ++i) {\n var idx = bottom ^ 1 << i;\n if (idx === closest || idx === farthest) {\n continue;\n }\n if (left < 0) {\n left = idx;\n }\n var v = cubeVerts[idx];\n if (v[0] < cubeVerts[left][0]) {\n left = idx;\n }\n }\n var right = -1;\n for (var i = 0; i < 3; ++i) {\n var idx = bottom ^ 1 << i;\n if (idx === closest || idx === farthest || idx === left) {\n continue;\n }\n if (right < 0) {\n right = idx;\n }\n var v = cubeVerts[idx];\n if (v[0] > cubeVerts[right][0]) {\n right = idx;\n }\n }\n var cubeEdges = CUBE_EDGES;\n cubeEdges[0] = cubeEdges[1] = cubeEdges[2] = 0;\n cubeEdges[bits.log2(left ^ bottom)] = bottom & left;\n cubeEdges[bits.log2(bottom ^ right)] = bottom & right;\n var top = right ^ 7;\n if (top === closest || top === farthest) {\n top = left ^ 7;\n cubeEdges[bits.log2(right ^ top)] = top & right;\n } else {\n cubeEdges[bits.log2(left ^ top)] = top & left;\n }\n var axis = CUBE_AXIS;\n var cutCorner = closest;\n for (var d = 0; d < 3; ++d) {\n if (cutCorner & 1 << d) {\n axis[d] = -1;\n } else {\n axis[d] = 1;\n }\n }\n return CUBE_RESULT;\n }\n }\n ),\n /***/\n 501: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = createLines;\n var createBuffer = __webpack_require__2(2762);\n var createVAO = __webpack_require__2(8116);\n var createShader = __webpack_require__2(1879).n;\n var MAJOR_AXIS = [0, 0, 0];\n var MINOR_AXIS = [0, 0, 0];\n var SCREEN_AXIS = [0, 0, 0];\n var OFFSET_VEC = [0, 0, 0];\n var SHAPE = [1, 1];\n function zeroVec(a) {\n a[0] = a[1] = a[2] = 0;\n return a;\n }\n function copyVec(a, b) {\n a[0] = b[0];\n a[1] = b[1];\n a[2] = b[2];\n return a;\n }\n function Lines(gl2, vertBuffer, vao, shader, tickCount, tickOffset, gridCount, gridOffset) {\n this.gl = gl2;\n this.vertBuffer = vertBuffer;\n this.vao = vao;\n this.shader = shader;\n this.tickCount = tickCount;\n this.tickOffset = tickOffset;\n this.gridCount = gridCount;\n this.gridOffset = gridOffset;\n }\n var proto = Lines.prototype;\n proto.bind = function(model, view, projection) {\n this.shader.bind();\n this.shader.uniforms.model = model;\n this.shader.uniforms.view = view;\n this.shader.uniforms.projection = projection;\n SHAPE[0] = this.gl.drawingBufferWidth;\n SHAPE[1] = this.gl.drawingBufferHeight;\n this.shader.uniforms.screenShape = SHAPE;\n this.vao.bind();\n };\n proto.unbind = function() {\n this.vao.unbind();\n };\n proto.drawAxisLine = function(j, bounds, offset, color2, lineWidth) {\n var minorAxis = zeroVec(MINOR_AXIS);\n this.shader.uniforms.majorAxis = MINOR_AXIS;\n minorAxis[j] = bounds[1][j] - bounds[0][j];\n this.shader.uniforms.minorAxis = minorAxis;\n var noffset = copyVec(OFFSET_VEC, offset);\n noffset[j] += bounds[0][j];\n this.shader.uniforms.offset = noffset;\n this.shader.uniforms.lineWidth = lineWidth;\n this.shader.uniforms.color = color2;\n var screenAxis = zeroVec(SCREEN_AXIS);\n screenAxis[(j + 2) % 3] = 1;\n this.shader.uniforms.screenAxis = screenAxis;\n this.vao.draw(this.gl.TRIANGLES, 6);\n var screenAxis = zeroVec(SCREEN_AXIS);\n screenAxis[(j + 1) % 3] = 1;\n this.shader.uniforms.screenAxis = screenAxis;\n this.vao.draw(this.gl.TRIANGLES, 6);\n };\n proto.drawAxisTicks = function(j, offset, minorAxis, color2, lineWidth) {\n if (!this.tickCount[j]) {\n return;\n }\n var majorAxis = zeroVec(MAJOR_AXIS);\n majorAxis[j] = 1;\n this.shader.uniforms.majorAxis = majorAxis;\n this.shader.uniforms.offset = offset;\n this.shader.uniforms.minorAxis = minorAxis;\n this.shader.uniforms.color = color2;\n this.shader.uniforms.lineWidth = lineWidth;\n var screenAxis = zeroVec(SCREEN_AXIS);\n screenAxis[j] = 1;\n this.shader.uniforms.screenAxis = screenAxis;\n this.vao.draw(this.gl.TRIANGLES, this.tickCount[j], this.tickOffset[j]);\n };\n proto.drawGrid = function(i, j, bounds, offset, color2, lineWidth) {\n if (!this.gridCount[i]) {\n return;\n }\n var minorAxis = zeroVec(MINOR_AXIS);\n minorAxis[j] = bounds[1][j] - bounds[0][j];\n this.shader.uniforms.minorAxis = minorAxis;\n var noffset = copyVec(OFFSET_VEC, offset);\n noffset[j] += bounds[0][j];\n this.shader.uniforms.offset = noffset;\n var majorAxis = zeroVec(MAJOR_AXIS);\n majorAxis[i] = 1;\n this.shader.uniforms.majorAxis = majorAxis;\n var screenAxis = zeroVec(SCREEN_AXIS);\n screenAxis[i] = 1;\n this.shader.uniforms.screenAxis = screenAxis;\n this.shader.uniforms.lineWidth = lineWidth;\n this.shader.uniforms.color = color2;\n this.vao.draw(this.gl.TRIANGLES, this.gridCount[i], this.gridOffset[i]);\n };\n proto.drawZero = function(j, i, bounds, offset, color2, lineWidth) {\n var minorAxis = zeroVec(MINOR_AXIS);\n this.shader.uniforms.majorAxis = minorAxis;\n minorAxis[j] = bounds[1][j] - bounds[0][j];\n this.shader.uniforms.minorAxis = minorAxis;\n var noffset = copyVec(OFFSET_VEC, offset);\n noffset[j] += bounds[0][j];\n this.shader.uniforms.offset = noffset;\n var screenAxis = zeroVec(SCREEN_AXIS);\n screenAxis[i] = 1;\n this.shader.uniforms.screenAxis = screenAxis;\n this.shader.uniforms.lineWidth = lineWidth;\n this.shader.uniforms.color = color2;\n this.vao.draw(this.gl.TRIANGLES, 6);\n };\n proto.dispose = function() {\n this.vao.dispose();\n this.vertBuffer.dispose();\n this.shader.dispose();\n };\n function createLines(gl2, bounds, ticks) {\n var vertices = [];\n var tickOffset = [0, 0, 0];\n var tickCount = [0, 0, 0];\n var gridOffset = [0, 0, 0];\n var gridCount = [0, 0, 0];\n vertices.push(\n 0,\n 0,\n 1,\n 0,\n 1,\n 1,\n 0,\n 0,\n -1,\n 0,\n 0,\n -1,\n 0,\n 1,\n 1,\n 0,\n 1,\n -1\n );\n for (var i = 0; i < 3; ++i) {\n var start = vertices.length / 3 | 0;\n for (var j = 0; j < ticks[i].length; ++j) {\n var x = +ticks[i][j].x;\n vertices.push(\n x,\n 0,\n 1,\n x,\n 1,\n 1,\n x,\n 0,\n -1,\n x,\n 0,\n -1,\n x,\n 1,\n 1,\n x,\n 1,\n -1\n );\n }\n var end = vertices.length / 3 | 0;\n tickOffset[i] = start;\n tickCount[i] = end - start;\n var start = vertices.length / 3 | 0;\n for (var k = 0; k < ticks[i].length; ++k) {\n var x = +ticks[i][k].x;\n vertices.push(\n x,\n 0,\n 1,\n x,\n 1,\n 1,\n x,\n 0,\n -1,\n x,\n 0,\n -1,\n x,\n 1,\n 1,\n x,\n 1,\n -1\n );\n }\n var end = vertices.length / 3 | 0;\n gridOffset[i] = start;\n gridCount[i] = end - start;\n }\n var vertBuf = createBuffer(gl2, new Float32Array(vertices));\n var vao = createVAO(gl2, [\n {\n \"buffer\": vertBuf,\n \"type\": gl2.FLOAT,\n \"size\": 3,\n \"stride\": 0,\n \"offset\": 0\n }\n ]);\n var shader = createShader(gl2);\n shader.attributes.position.location = 0;\n return new Lines(gl2, vertBuf, vao, shader, tickCount, tickOffset, gridCount, gridOffset);\n }\n }\n ),\n /***/\n 1879: (\n /***/\n function(__unused_webpack_module, exports2, __webpack_require__2) {\n \"use strict\";\n var glslify = __webpack_require__2(3236);\n var createShader = __webpack_require__2(9405);\n var lineVert = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nattribute vec3 position;\\n\\nuniform mat4 model, view, projection;\\nuniform vec3 offset, majorAxis, minorAxis, screenAxis;\\nuniform float lineWidth;\\nuniform vec2 screenShape;\\n\\nvec3 project(vec3 p) {\\n vec4 pp = projection * (view * (model * vec4(p, 1.0)));\\n return pp.xyz / max(pp.w, 0.0001);\\n}\\n\\nvoid main() {\\n vec3 major = position.x * majorAxis;\\n vec3 minor = position.y * minorAxis;\\n\\n vec3 vPosition = major + minor + offset;\\n vec3 pPosition = project(vPosition);\\n vec3 offset = project(vPosition + screenAxis * position.z);\\n\\n vec2 screen = normalize((offset - pPosition).xy * screenShape) / screenShape;\\n\\n gl_Position = vec4(pPosition + vec3(0.5 * screen * lineWidth, 0), 1.0);\\n}\\n\"]);\n var lineFrag = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nuniform vec4 color;\\nvoid main() {\\n gl_FragColor = color;\\n}\"]);\n exports2.n = function(gl2) {\n return createShader(gl2, lineVert, lineFrag, null, [\n { name: \"position\", type: \"vec3\" }\n ]);\n };\n var textVert = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nattribute vec3 position;\\n\\nuniform mat4 model, view, projection;\\nuniform vec3 offset, axis, alignDir, alignOpt;\\nuniform float scale, angle, pixelScale;\\nuniform vec2 resolution;\\n\\nvec3 project(vec3 p) {\\n vec4 pp = projection * (view * (model * vec4(p, 1.0)));\\n return pp.xyz / max(pp.w, 0.0001);\\n}\\n\\nfloat computeViewAngle(vec3 a, vec3 b) {\\n vec3 A = project(a);\\n vec3 B = project(b);\\n\\n return atan(\\n (B.y - A.y) * resolution.y,\\n (B.x - A.x) * resolution.x\\n );\\n}\\n\\nconst float PI = 3.141592;\\nconst float TWO_PI = 2.0 * PI;\\nconst float HALF_PI = 0.5 * PI;\\nconst float ONE_AND_HALF_PI = 1.5 * PI;\\n\\nint option = int(floor(alignOpt.x + 0.001));\\nfloat hv_ratio = alignOpt.y;\\nbool enableAlign = (alignOpt.z != 0.0);\\n\\nfloat mod_angle(float a) {\\n return mod(a, PI);\\n}\\n\\nfloat positive_angle(float a) {\\n return mod_angle((a < 0.0) ?\\n a + TWO_PI :\\n a\\n );\\n}\\n\\nfloat look_upwards(float a) {\\n float b = positive_angle(a);\\n return ((b > HALF_PI) && (b <= ONE_AND_HALF_PI)) ?\\n b - PI :\\n b;\\n}\\n\\nfloat look_horizontal_or_vertical(float a, float ratio) {\\n // ratio controls the ratio between being horizontal to (vertical + horizontal)\\n // if ratio is set to 0.5 then it is 50%, 50%.\\n // when using a higher ratio e.g. 0.75 the result would\\n // likely be more horizontal than vertical.\\n\\n float b = positive_angle(a);\\n\\n return\\n (b < ( ratio) * HALF_PI) ? 0.0 :\\n (b < (2.0 - ratio) * HALF_PI) ? -HALF_PI :\\n (b < (2.0 + ratio) * HALF_PI) ? 0.0 :\\n (b < (4.0 - ratio) * HALF_PI) ? HALF_PI :\\n 0.0;\\n}\\n\\nfloat roundTo(float a, float b) {\\n return float(b * floor((a + 0.5 * b) / b));\\n}\\n\\nfloat look_round_n_directions(float a, int n) {\\n float b = positive_angle(a);\\n float div = TWO_PI / float(n);\\n float c = roundTo(b, div);\\n return look_upwards(c);\\n}\\n\\nfloat applyAlignOption(float rawAngle, float delta) {\\n return\\n (option > 2) ? look_round_n_directions(rawAngle + delta, option) : // option 3-n: round to n directions\\n (option == 2) ? look_horizontal_or_vertical(rawAngle + delta, hv_ratio) : // horizontal or vertical\\n (option == 1) ? rawAngle + delta : // use free angle, and flip to align with one direction of the axis\\n (option == 0) ? look_upwards(rawAngle) : // use free angle, and stay upwards\\n (option ==-1) ? 0.0 : // useful for backward compatibility, all texts remains horizontal\\n rawAngle; // otherwise return back raw input angle\\n}\\n\\nbool isAxisTitle = (axis.x == 0.0) &&\\n (axis.y == 0.0) &&\\n (axis.z == 0.0);\\n\\nvoid main() {\\n //Compute world offset\\n float axisDistance = position.z;\\n vec3 dataPosition = axisDistance * axis + offset;\\n\\n float beta = angle; // i.e. user defined attributes for each tick\\n\\n float axisAngle;\\n float clipAngle;\\n float flip;\\n\\n if (enableAlign) {\\n axisAngle = (isAxisTitle) ? HALF_PI :\\n computeViewAngle(dataPosition, dataPosition + axis);\\n clipAngle = computeViewAngle(dataPosition, dataPosition + alignDir);\\n\\n axisAngle += (sin(axisAngle) < 0.0) ? PI : 0.0;\\n clipAngle += (sin(clipAngle) < 0.0) ? PI : 0.0;\\n\\n flip = (dot(vec2(cos(axisAngle), sin(axisAngle)),\\n vec2(sin(clipAngle),-cos(clipAngle))) > 0.0) ? 1.0 : 0.0;\\n\\n beta += applyAlignOption(clipAngle, flip * PI);\\n }\\n\\n //Compute plane offset\\n vec2 planeCoord = position.xy * pixelScale;\\n\\n mat2 planeXform = scale * mat2(\\n cos(beta), sin(beta),\\n -sin(beta), cos(beta)\\n );\\n\\n vec2 viewOffset = 2.0 * planeXform * planeCoord / resolution;\\n\\n //Compute clip position\\n vec3 clipPosition = project(dataPosition);\\n\\n //Apply text offset in clip coordinates\\n clipPosition += vec3(viewOffset, 0.0);\\n\\n //Done\\n gl_Position = vec4(clipPosition, 1.0);\\n}\\n\"]);\n var textFrag = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nuniform vec4 color;\\nvoid main() {\\n gl_FragColor = color;\\n}\"]);\n exports2.Q = function(gl2) {\n return createShader(gl2, textVert, textFrag, null, [\n { name: \"position\", type: \"vec3\" }\n ]);\n };\n var bgVert = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nattribute vec3 position;\\nattribute vec3 normal;\\n\\nuniform mat4 model, view, projection;\\nuniform vec3 enable;\\nuniform vec3 bounds[2];\\n\\nvarying vec3 colorChannel;\\n\\nvoid main() {\\n\\n vec3 signAxis = sign(bounds[1] - bounds[0]);\\n\\n vec3 realNormal = signAxis * normal;\\n\\n if(dot(realNormal, enable) > 0.0) {\\n vec3 minRange = min(bounds[0], bounds[1]);\\n vec3 maxRange = max(bounds[0], bounds[1]);\\n vec3 nPosition = mix(minRange, maxRange, 0.5 * (position + 1.0));\\n gl_Position = projection * (view * (model * vec4(nPosition, 1.0)));\\n } else {\\n gl_Position = vec4(0,0,0,0);\\n }\\n\\n colorChannel = abs(realNormal);\\n}\\n\"]);\n var bgFrag = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nuniform vec4 colors[3];\\n\\nvarying vec3 colorChannel;\\n\\nvoid main() {\\n gl_FragColor = colorChannel.x * colors[0] +\\n colorChannel.y * colors[1] +\\n colorChannel.z * colors[2];\\n}\"]);\n exports2.bg = function(gl2) {\n return createShader(gl2, bgVert, bgFrag, null, [\n { name: \"position\", type: \"vec3\" },\n { name: \"normal\", type: \"vec3\" }\n ]);\n };\n }\n ),\n /***/\n 4935: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = createTextSprites;\n var createBuffer = __webpack_require__2(2762);\n var createVAO = __webpack_require__2(8116);\n var vectorizeText = __webpack_require__2(4359);\n var createShader = __webpack_require__2(1879).Q;\n var globals = window || process.global || {};\n var __TEXT_CACHE = globals.__TEXT_CACHE || {};\n globals.__TEXT_CACHE = {};\n var VERTEX_SIZE = 3;\n function TextSprites(gl2, shader, buffer, vao) {\n this.gl = gl2;\n this.shader = shader;\n this.buffer = buffer;\n this.vao = vao;\n this.tickOffset = this.tickCount = this.labelOffset = this.labelCount = null;\n }\n var proto = TextSprites.prototype;\n var SHAPE = [0, 0];\n proto.bind = function(model, view, projection, pixelScale) {\n this.vao.bind();\n this.shader.bind();\n var uniforms = this.shader.uniforms;\n uniforms.model = model;\n uniforms.view = view;\n uniforms.projection = projection;\n uniforms.pixelScale = pixelScale;\n SHAPE[0] = this.gl.drawingBufferWidth;\n SHAPE[1] = this.gl.drawingBufferHeight;\n this.shader.uniforms.resolution = SHAPE;\n };\n proto.unbind = function() {\n this.vao.unbind();\n };\n proto.update = function(bounds, labels, labelFont, ticks, tickFont) {\n var data = [];\n function addItem(t, text, font2, size, lineSpacing2, styletags2) {\n var fontKey = [\n font2.style,\n font2.weight,\n font2.variant,\n font2.family\n ].join(\"_\");\n var fontcache = __TEXT_CACHE[fontKey];\n if (!fontcache) {\n fontcache = __TEXT_CACHE[fontKey] = {};\n }\n var mesh = fontcache[text];\n if (!mesh) {\n mesh = fontcache[text] = tryVectorizeText(text, {\n triangles: true,\n font: font2.family,\n fontStyle: font2.style,\n fontWeight: font2.weight,\n fontVariant: font2.variant,\n textAlign: \"center\",\n textBaseline: \"middle\",\n lineSpacing: lineSpacing2,\n styletags: styletags2\n });\n }\n var scale = (size || 12) / 12;\n var positions = mesh.positions;\n var cells = mesh.cells;\n for (var i2 = 0, nc = cells.length; i2 < nc; ++i2) {\n var c = cells[i2];\n for (var j = 2; j >= 0; --j) {\n var p = positions[c[j]];\n data.push(scale * p[0], -scale * p[1], t);\n }\n }\n }\n var tickOffset = [0, 0, 0];\n var tickCount = [0, 0, 0];\n var labelOffset = [0, 0, 0];\n var labelCount = [0, 0, 0];\n var lineSpacing = 1.25;\n var styletags = {\n breaklines: true,\n bolds: true,\n italics: true,\n subscripts: true,\n superscripts: true\n };\n for (var d = 0; d < 3; ++d) {\n labelOffset[d] = data.length / VERTEX_SIZE | 0;\n addItem(\n 0.5 * (bounds[0][d] + bounds[1][d]),\n labels[d],\n labelFont[d],\n 12,\n // labelFontSize\n lineSpacing,\n styletags\n );\n labelCount[d] = (data.length / VERTEX_SIZE | 0) - labelOffset[d];\n tickOffset[d] = data.length / VERTEX_SIZE | 0;\n for (var i = 0; i < ticks[d].length; ++i) {\n if (!ticks[d][i].text) {\n continue;\n }\n var font = {\n family: ticks[d][i].font || tickFont[d].family,\n style: tickFont[d].fontStyle || tickFont[d].style,\n weight: tickFont[d].fontWeight || tickFont[d].weight,\n variant: tickFont[d].fontVariant || tickFont[d].variant\n };\n addItem(\n ticks[d][i].x,\n ticks[d][i].text,\n font,\n ticks[d][i].fontSize || 12,\n lineSpacing,\n styletags\n );\n }\n tickCount[d] = (data.length / VERTEX_SIZE | 0) - tickOffset[d];\n }\n this.buffer.update(data);\n this.tickOffset = tickOffset;\n this.tickCount = tickCount;\n this.labelOffset = labelOffset;\n this.labelCount = labelCount;\n };\n proto.drawTicks = function(d, scale, angle, offset, color2, axis, alignDir, alignOpt) {\n if (!this.tickCount[d]) {\n return;\n }\n this.shader.uniforms.axis = axis;\n this.shader.uniforms.color = color2;\n this.shader.uniforms.angle = angle;\n this.shader.uniforms.scale = scale;\n this.shader.uniforms.offset = offset;\n this.shader.uniforms.alignDir = alignDir;\n this.shader.uniforms.alignOpt = alignOpt;\n this.vao.draw(this.gl.TRIANGLES, this.tickCount[d], this.tickOffset[d]);\n };\n proto.drawLabel = function(d, scale, angle, offset, color2, axis, alignDir, alignOpt) {\n if (!this.labelCount[d]) {\n return;\n }\n this.shader.uniforms.axis = axis;\n this.shader.uniforms.color = color2;\n this.shader.uniforms.angle = angle;\n this.shader.uniforms.scale = scale;\n this.shader.uniforms.offset = offset;\n this.shader.uniforms.alignDir = alignDir;\n this.shader.uniforms.alignOpt = alignOpt;\n this.vao.draw(this.gl.TRIANGLES, this.labelCount[d], this.labelOffset[d]);\n };\n proto.dispose = function() {\n this.shader.dispose();\n this.vao.dispose();\n this.buffer.dispose();\n };\n function tryVectorizeText(text, options) {\n try {\n return vectorizeText(text, options);\n } catch (e) {\n console.warn('error vectorizing text:\"' + text + '\" error:', e);\n return {\n cells: [],\n positions: []\n };\n }\n }\n function createTextSprites(gl2, bounds, labels, labelFont, ticks, tickFont) {\n var buffer = createBuffer(gl2);\n var vao = createVAO(gl2, [\n {\n \"buffer\": buffer,\n \"size\": 3\n }\n ]);\n var shader = createShader(gl2);\n shader.attributes.position.location = 0;\n var result = new TextSprites(\n gl2,\n shader,\n buffer,\n vao\n );\n result.update(bounds, labels, labelFont, ticks, tickFont);\n return result;\n }\n }\n ),\n /***/\n 6444: (\n /***/\n function(__unused_webpack_module, exports2) {\n \"use strict\";\n exports2.create = defaultTicks;\n exports2.equal = ticksEqual;\n function prettyPrint(spacing, i) {\n var stepStr = spacing + \"\";\n var u = stepStr.indexOf(\".\");\n var sigFigs = 0;\n if (u >= 0) {\n sigFigs = stepStr.length - u - 1;\n }\n var shift = Math.pow(10, sigFigs);\n var x = Math.round(spacing * i * shift);\n var xstr = x + \"\";\n if (xstr.indexOf(\"e\") >= 0) {\n return xstr;\n }\n var xi = x / shift, xf = x % shift;\n if (x < 0) {\n xi = -Math.ceil(xi) | 0;\n xf = -xf | 0;\n } else {\n xi = Math.floor(xi) | 0;\n xf = xf | 0;\n }\n var xis = \"\" + xi;\n if (x < 0) {\n xis = \"-\" + xis;\n }\n if (sigFigs) {\n var xs = \"\" + xf;\n while (xs.length < sigFigs) {\n xs = \"0\" + xs;\n }\n return xis + \".\" + xs;\n } else {\n return xis;\n }\n }\n function defaultTicks(bounds, tickSpacing) {\n var array = [];\n for (var d = 0; d < 3; ++d) {\n var ticks = [];\n var m = 0.5 * (bounds[0][d] + bounds[1][d]);\n for (var t = 0; t * tickSpacing[d] <= bounds[1][d]; ++t) {\n ticks.push({ x: t * tickSpacing[d], text: prettyPrint(tickSpacing[d], t) });\n }\n for (var t = -1; t * tickSpacing[d] >= bounds[0][d]; --t) {\n ticks.push({ x: t * tickSpacing[d], text: prettyPrint(tickSpacing[d], t) });\n }\n array.push(ticks);\n }\n return array;\n }\n function ticksEqual(ticksA, ticksB) {\n for (var i = 0; i < 3; ++i) {\n if (ticksA[i].length !== ticksB[i].length) {\n return false;\n }\n for (var j = 0; j < ticksA[i].length; ++j) {\n var a = ticksA[i][j];\n var b = ticksB[i][j];\n if (a.x !== b.x || a.text !== b.text || a.font !== b.font || a.fontColor !== b.fontColor || a.fontSize !== b.fontSize || a.dx !== b.dx || a.dy !== b.dy) {\n return false;\n }\n }\n }\n return true;\n }\n }\n ),\n /***/\n 5445: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = axesProperties;\n var getPlanes = __webpack_require__2(5033);\n var splitPoly = __webpack_require__2(5202);\n var cubeParams = __webpack_require__2(6429);\n var m4mul = __webpack_require__2(6760);\n var m4transpose = __webpack_require__2(5665);\n var v4transformMat4 = __webpack_require__2(5352);\n var identity2 = new Float32Array([\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ]);\n var mvp = new Float32Array(16);\n function AxesRange3D(lo, hi, pixelsPerDataUnit) {\n this.lo = lo;\n this.hi = hi;\n this.pixelsPerDataUnit = pixelsPerDataUnit;\n }\n var SCRATCH_P = [0, 0, 0, 1];\n var SCRATCH_Q = [0, 0, 0, 1];\n function gradient(result, M, v, width, height) {\n for (var i = 0; i < 3; ++i) {\n var p = SCRATCH_P;\n var q = SCRATCH_Q;\n for (var j = 0; j < 3; ++j) {\n q[j] = p[j] = v[j];\n }\n q[3] = p[3] = 1;\n q[i] += 1;\n v4transformMat4(q, q, M);\n if (q[3] < 0) {\n result[i] = Infinity;\n }\n p[i] -= 1;\n v4transformMat4(p, p, M);\n if (p[3] < 0) {\n result[i] = Infinity;\n }\n var dx = (p[0] / p[3] - q[0] / q[3]) * width;\n var dy = (p[1] / p[3] - q[1] / q[3]) * height;\n result[i] = 0.25 * Math.sqrt(dx * dx + dy * dy);\n }\n return result;\n }\n var RANGES = [\n new AxesRange3D(Infinity, -Infinity, Infinity),\n new AxesRange3D(Infinity, -Infinity, Infinity),\n new AxesRange3D(Infinity, -Infinity, Infinity)\n ];\n var SCRATCH_X = [0, 0, 0];\n function axesProperties(axes, camera, width, height, params) {\n var model = camera.model || identity2;\n var view = camera.view || identity2;\n var projection = camera.projection || identity2;\n var isOrtho = camera._ortho || false;\n var bounds = axes.bounds;\n var params = params || cubeParams(model, view, projection, bounds, isOrtho);\n var axis = params.axis;\n m4mul(mvp, view, model);\n m4mul(mvp, projection, mvp);\n var ranges = RANGES;\n for (var i = 0; i < 3; ++i) {\n ranges[i].lo = Infinity;\n ranges[i].hi = -Infinity;\n ranges[i].pixelsPerDataUnit = Infinity;\n }\n var frustum = getPlanes(m4transpose(mvp, mvp));\n m4transpose(mvp, mvp);\n for (var d = 0; d < 3; ++d) {\n var u = (d + 1) % 3;\n var v = (d + 2) % 3;\n var x = SCRATCH_X;\n i_loop:\n for (var i = 0; i < 2; ++i) {\n var poly = [];\n if (axis[d] < 0 === !!i) {\n continue;\n }\n x[d] = bounds[i][d];\n for (var j = 0; j < 2; ++j) {\n x[u] = bounds[j ^ i][u];\n for (var k = 0; k < 2; ++k) {\n x[v] = bounds[k ^ j ^ i][v];\n poly.push(x.slice());\n }\n }\n var Q = isOrtho ? 5 : 4;\n for (var j = Q; j === Q; ++j) {\n if (poly.length === 0) {\n continue i_loop;\n }\n poly = splitPoly.positive(poly, frustum[j]);\n }\n for (var j = 0; j < poly.length; ++j) {\n var v = poly[j];\n var grad = gradient(SCRATCH_X, mvp, v, width, height);\n for (var k = 0; k < 3; ++k) {\n ranges[k].lo = Math.min(ranges[k].lo, v[k]);\n ranges[k].hi = Math.max(ranges[k].hi, v[k]);\n if (k !== d) {\n ranges[k].pixelsPerDataUnit = Math.min(ranges[k].pixelsPerDataUnit, Math.abs(grad[k]));\n }\n }\n }\n }\n }\n return ranges;\n }\n }\n ),\n /***/\n 2762: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var pool = __webpack_require__2(1888);\n var ops = __webpack_require__2(5298);\n var ndarray = __webpack_require__2(9618);\n var SUPPORTED_TYPES = [\n \"uint8\",\n \"uint8_clamped\",\n \"uint16\",\n \"uint32\",\n \"int8\",\n \"int16\",\n \"int32\",\n \"float32\"\n ];\n function GLBuffer(gl2, type, handle, length, usage) {\n this.gl = gl2;\n this.type = type;\n this.handle = handle;\n this.length = length;\n this.usage = usage;\n }\n var proto = GLBuffer.prototype;\n proto.bind = function() {\n this.gl.bindBuffer(this.type, this.handle);\n };\n proto.unbind = function() {\n this.gl.bindBuffer(this.type, null);\n };\n proto.dispose = function() {\n this.gl.deleteBuffer(this.handle);\n };\n function updateTypeArray(gl2, type, len, usage, data, offset) {\n var dataLen = data.length * data.BYTES_PER_ELEMENT;\n if (offset < 0) {\n gl2.bufferData(type, data, usage);\n return dataLen;\n }\n if (dataLen + offset > len) {\n throw new Error(\"gl-buffer: If resizing buffer, must not specify offset\");\n }\n gl2.bufferSubData(type, offset, data);\n return len;\n }\n function makeScratchTypeArray(array, dtype) {\n var res = pool.malloc(array.length, dtype);\n var n = array.length;\n for (var i = 0; i < n; ++i) {\n res[i] = array[i];\n }\n return res;\n }\n function isPacked(shape, stride) {\n var n = 1;\n for (var i = stride.length - 1; i >= 0; --i) {\n if (stride[i] !== n) {\n return false;\n }\n n *= shape[i];\n }\n return true;\n }\n proto.update = function(array, offset) {\n if (typeof offset !== \"number\") {\n offset = -1;\n }\n this.bind();\n if (typeof array === \"object\" && typeof array.shape !== \"undefined\") {\n var dtype = array.dtype;\n if (SUPPORTED_TYPES.indexOf(dtype) < 0) {\n dtype = \"float32\";\n }\n if (this.type === this.gl.ELEMENT_ARRAY_BUFFER) {\n var ext = gl.getExtension(\"OES_element_index_uint\");\n if (ext && dtype !== \"uint16\") {\n dtype = \"uint32\";\n } else {\n dtype = \"uint16\";\n }\n }\n if (dtype === array.dtype && isPacked(array.shape, array.stride)) {\n if (array.offset === 0 && array.data.length === array.shape[0]) {\n this.length = updateTypeArray(this.gl, this.type, this.length, this.usage, array.data, offset);\n } else {\n this.length = updateTypeArray(this.gl, this.type, this.length, this.usage, array.data.subarray(array.offset, array.shape[0]), offset);\n }\n } else {\n var tmp = pool.malloc(array.size, dtype);\n var ndt = ndarray(tmp, array.shape);\n ops.assign(ndt, array);\n if (offset < 0) {\n this.length = updateTypeArray(this.gl, this.type, this.length, this.usage, tmp, offset);\n } else {\n this.length = updateTypeArray(this.gl, this.type, this.length, this.usage, tmp.subarray(0, array.size), offset);\n }\n pool.free(tmp);\n }\n } else if (Array.isArray(array)) {\n var t;\n if (this.type === this.gl.ELEMENT_ARRAY_BUFFER) {\n t = makeScratchTypeArray(array, \"uint16\");\n } else {\n t = makeScratchTypeArray(array, \"float32\");\n }\n if (offset < 0) {\n this.length = updateTypeArray(this.gl, this.type, this.length, this.usage, t, offset);\n } else {\n this.length = updateTypeArray(this.gl, this.type, this.length, this.usage, t.subarray(0, array.length), offset);\n }\n pool.free(t);\n } else if (typeof array === \"object\" && typeof array.length === \"number\") {\n this.length = updateTypeArray(this.gl, this.type, this.length, this.usage, array, offset);\n } else if (typeof array === \"number\" || array === void 0) {\n if (offset >= 0) {\n throw new Error(\"gl-buffer: Cannot specify offset when resizing buffer\");\n }\n array = array | 0;\n if (array <= 0) {\n array = 1;\n }\n this.gl.bufferData(this.type, array | 0, this.usage);\n this.length = array;\n } else {\n throw new Error(\"gl-buffer: Invalid data type\");\n }\n };\n function createBuffer(gl2, data, type, usage) {\n type = type || gl2.ARRAY_BUFFER;\n usage = usage || gl2.DYNAMIC_DRAW;\n if (type !== gl2.ARRAY_BUFFER && type !== gl2.ELEMENT_ARRAY_BUFFER) {\n throw new Error(\"gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER\");\n }\n if (usage !== gl2.DYNAMIC_DRAW && usage !== gl2.STATIC_DRAW && usage !== gl2.STREAM_DRAW) {\n throw new Error(\"gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW\");\n }\n var handle = gl2.createBuffer();\n var result = new GLBuffer(gl2, type, handle, 0, usage);\n result.update(data);\n return result;\n }\n module2.exports = createBuffer;\n }\n ),\n /***/\n 6405: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var vec3 = __webpack_require__2(2931);\n module2.exports = function(vectorfield, bounds) {\n var positions = vectorfield.positions;\n var vectors = vectorfield.vectors;\n var geo = {\n positions: [],\n vertexIntensity: [],\n vertexIntensityBounds: vectorfield.vertexIntensityBounds,\n vectors: [],\n cells: [],\n coneOffset: vectorfield.coneOffset,\n colormap: vectorfield.colormap\n };\n if (vectorfield.positions.length === 0) {\n if (bounds) {\n bounds[0] = [0, 0, 0];\n bounds[1] = [0, 0, 0];\n }\n return geo;\n }\n var maxNorm = 0;\n var minX = Infinity, maxX = -Infinity;\n var minY = Infinity, maxY = -Infinity;\n var minZ = Infinity, maxZ = -Infinity;\n var p2 = null;\n var u2 = null;\n var positionVectors = [];\n var vectorScale = Infinity;\n var skipIt = false;\n var rawSizemodemode = vectorfield.coneSizemode === \"raw\";\n for (var i = 0; i < positions.length; i++) {\n var p = positions[i];\n minX = Math.min(p[0], minX);\n maxX = Math.max(p[0], maxX);\n minY = Math.min(p[1], minY);\n maxY = Math.max(p[1], maxY);\n minZ = Math.min(p[2], minZ);\n maxZ = Math.max(p[2], maxZ);\n var u = vectors[i];\n if (vec3.length(u) > maxNorm) {\n maxNorm = vec3.length(u);\n }\n if (i && !rawSizemodemode) {\n var q = 2 * vec3.distance(p2, p) / (vec3.length(u2) + vec3.length(u));\n if (q) {\n vectorScale = Math.min(vectorScale, q);\n skipIt = false;\n } else {\n skipIt = true;\n }\n }\n if (!skipIt) {\n p2 = p;\n u2 = u;\n }\n positionVectors.push(u);\n }\n var minV = [minX, minY, minZ];\n var maxV = [maxX, maxY, maxZ];\n if (bounds) {\n bounds[0] = minV;\n bounds[1] = maxV;\n }\n if (maxNorm === 0) {\n maxNorm = 1;\n }\n var invertedMaxNorm = 1 / maxNorm;\n if (!isFinite(vectorScale)) {\n vectorScale = 1;\n }\n geo.vectorScale = vectorScale;\n var coneScale = vectorfield.coneSize || (rawSizemodemode ? 1 : 0.5);\n if (vectorfield.absoluteConeSize) {\n coneScale = vectorfield.absoluteConeSize * invertedMaxNorm;\n }\n geo.coneScale = coneScale;\n for (var i = 0, j = 0; i < positions.length; i++) {\n var p = positions[i];\n var x = p[0], y = p[1], z = p[2];\n var d = positionVectors[i];\n var intensity = vec3.length(d) * invertedMaxNorm;\n for (var k = 0, l = 8; k < l; k++) {\n geo.positions.push([x, y, z, j++]);\n geo.positions.push([x, y, z, j++]);\n geo.positions.push([x, y, z, j++]);\n geo.positions.push([x, y, z, j++]);\n geo.positions.push([x, y, z, j++]);\n geo.positions.push([x, y, z, j++]);\n geo.vectors.push(d);\n geo.vectors.push(d);\n geo.vectors.push(d);\n geo.vectors.push(d);\n geo.vectors.push(d);\n geo.vectors.push(d);\n geo.vertexIntensity.push(intensity, intensity, intensity);\n geo.vertexIntensity.push(intensity, intensity, intensity);\n var m = geo.positions.length;\n geo.cells.push([m - 6, m - 5, m - 4], [m - 3, m - 2, m - 1]);\n }\n }\n return geo;\n };\n var shaders = __webpack_require__2(614);\n module2.exports.createMesh = __webpack_require__2(9060);\n module2.exports.createConeMesh = function(gl2, params) {\n return module2.exports.createMesh(gl2, params, {\n shaders,\n traceType: \"cone\"\n });\n };\n }\n ),\n /***/\n 9060: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var createShader = __webpack_require__2(9405);\n var createBuffer = __webpack_require__2(2762);\n var createVAO = __webpack_require__2(8116);\n var createTexture = __webpack_require__2(7766);\n var multiply = __webpack_require__2(6760);\n var invert = __webpack_require__2(7608);\n var ndarray = __webpack_require__2(9618);\n var colormap = __webpack_require__2(6729);\n var IDENTITY = [\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ];\n function VectorMesh(gl2, texture, triShader, pickShader, trianglePositions, triangleVectors, triangleIds, triangleColors, triangleUVs, triangleVAO, traceType) {\n this.gl = gl2;\n this.pixelRatio = 1;\n this.cells = [];\n this.positions = [];\n this.intensity = [];\n this.texture = texture;\n this.dirty = true;\n this.triShader = triShader;\n this.pickShader = pickShader;\n this.trianglePositions = trianglePositions;\n this.triangleVectors = triangleVectors;\n this.triangleColors = triangleColors;\n this.triangleUVs = triangleUVs;\n this.triangleIds = triangleIds;\n this.triangleVAO = triangleVAO;\n this.triangleCount = 0;\n this.pickId = 1;\n this.bounds = [\n [Infinity, Infinity, Infinity],\n [-Infinity, -Infinity, -Infinity]\n ];\n this.clipBounds = [\n [-Infinity, -Infinity, -Infinity],\n [Infinity, Infinity, Infinity]\n ];\n this.lightPosition = [1e5, 1e5, 0];\n this.ambientLight = 0.8;\n this.diffuseLight = 0.8;\n this.specularLight = 2;\n this.roughness = 0.5;\n this.fresnel = 1.5;\n this.opacity = 1;\n this.traceType = traceType;\n this.tubeScale = 1;\n this.coneScale = 2;\n this.vectorScale = 1;\n this.coneOffset = 0.25;\n this._model = IDENTITY;\n this._view = IDENTITY;\n this._projection = IDENTITY;\n this._resolution = [1, 1];\n }\n var proto = VectorMesh.prototype;\n proto.isOpaque = function() {\n return this.opacity >= 1;\n };\n proto.isTransparent = function() {\n return this.opacity < 1;\n };\n proto.pickSlots = 1;\n proto.setPickBase = function(id) {\n this.pickId = id;\n };\n function genColormap(param) {\n var colors = colormap({\n colormap: param,\n nshades: 256,\n format: \"rgba\"\n });\n var result = new Uint8Array(256 * 4);\n for (var i = 0; i < 256; ++i) {\n var c = colors[i];\n for (var j = 0; j < 3; ++j) {\n result[4 * i + j] = c[j];\n }\n result[4 * i + 3] = c[3] * 255;\n }\n return ndarray(result, [256, 256, 4], [4, 0, 1]);\n }\n function takeZComponent(array) {\n var n = array.length;\n var result = new Array(n);\n for (var i = 0; i < n; ++i) {\n result[i] = array[i][2];\n }\n return result;\n }\n proto.update = function(params) {\n params = params || {};\n var gl2 = this.gl;\n this.dirty = true;\n if (\"lightPosition\" in params) {\n this.lightPosition = params.lightPosition;\n }\n if (\"opacity\" in params) {\n this.opacity = params.opacity;\n }\n if (\"ambient\" in params) {\n this.ambientLight = params.ambient;\n }\n if (\"diffuse\" in params) {\n this.diffuseLight = params.diffuse;\n }\n if (\"specular\" in params) {\n this.specularLight = params.specular;\n }\n if (\"roughness\" in params) {\n this.roughness = params.roughness;\n }\n if (\"fresnel\" in params) {\n this.fresnel = params.fresnel;\n }\n if (params.tubeScale !== void 0) {\n this.tubeScale = params.tubeScale;\n }\n if (params.vectorScale !== void 0) {\n this.vectorScale = params.vectorScale;\n }\n if (params.coneScale !== void 0) {\n this.coneScale = params.coneScale;\n }\n if (params.coneOffset !== void 0) {\n this.coneOffset = params.coneOffset;\n }\n if (params.colormap) {\n this.texture.shape = [256, 256];\n this.texture.minFilter = gl2.LINEAR_MIPMAP_LINEAR;\n this.texture.magFilter = gl2.LINEAR;\n this.texture.setPixels(genColormap(params.colormap));\n this.texture.generateMipmap();\n }\n var cells = params.cells;\n var positions = params.positions;\n var vectors = params.vectors;\n if (!positions || !cells || !vectors) {\n return;\n }\n var tPos = [];\n var tVec = [];\n var tCol = [];\n var tUVs = [];\n var tIds = [];\n this.cells = cells;\n this.positions = positions;\n this.vectors = vectors;\n var meshColor = params.meshColor || [1, 1, 1, 1];\n var vertexIntensity = params.vertexIntensity;\n var intensityLo = Infinity;\n var intensityHi = -Infinity;\n if (vertexIntensity) {\n if (params.vertexIntensityBounds) {\n intensityLo = +params.vertexIntensityBounds[0];\n intensityHi = +params.vertexIntensityBounds[1];\n } else {\n for (var i = 0; i < vertexIntensity.length; ++i) {\n var f = vertexIntensity[i];\n intensityLo = Math.min(intensityLo, f);\n intensityHi = Math.max(intensityHi, f);\n }\n }\n } else {\n for (var i = 0; i < positions.length; ++i) {\n var f = positions[i][2];\n intensityLo = Math.min(intensityLo, f);\n intensityHi = Math.max(intensityHi, f);\n }\n }\n if (vertexIntensity) {\n this.intensity = vertexIntensity;\n } else {\n this.intensity = takeZComponent(positions);\n }\n this.bounds = [[Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]];\n for (var i = 0; i < positions.length; ++i) {\n var p = positions[i];\n for (var j = 0; j < 3; ++j) {\n if (isNaN(p[j]) || !isFinite(p[j])) {\n continue;\n }\n this.bounds[0][j] = Math.min(this.bounds[0][j], p[j]);\n this.bounds[1][j] = Math.max(this.bounds[1][j], p[j]);\n }\n }\n var triangleCount = 0;\n fill_loop:\n for (var i = 0; i < cells.length; ++i) {\n var cell = cells[i];\n switch (cell.length) {\n case 3:\n for (var j = 0; j < 3; ++j) {\n var v = cell[j];\n var p = positions[v];\n for (var k = 0; k < 3; ++k) {\n if (isNaN(p[k]) || !isFinite(p[k])) {\n continue fill_loop;\n }\n }\n }\n for (var j = 0; j < 3; ++j) {\n var v = cell[2 - j];\n var p = positions[v];\n tPos.push(p[0], p[1], p[2], p[3]);\n var w = vectors[v];\n tVec.push(w[0], w[1], w[2], w[3] || 0);\n var c = meshColor;\n if (c.length === 3) {\n tCol.push(c[0], c[1], c[2], 1);\n } else {\n tCol.push(c[0], c[1], c[2], c[3]);\n }\n var uv;\n if (vertexIntensity) {\n uv = [\n (vertexIntensity[v] - intensityLo) / (intensityHi - intensityLo),\n 0\n ];\n } else {\n uv = [\n (p[2] - intensityLo) / (intensityHi - intensityLo),\n 0\n ];\n }\n tUVs.push(uv[0], uv[1]);\n tIds.push(i);\n }\n triangleCount += 1;\n break;\n default:\n break;\n }\n }\n this.triangleCount = triangleCount;\n this.trianglePositions.update(tPos);\n this.triangleVectors.update(tVec);\n this.triangleColors.update(tCol);\n this.triangleUVs.update(tUVs);\n this.triangleIds.update(new Uint32Array(tIds));\n };\n proto.drawTransparent = proto.draw = function(params) {\n params = params || {};\n var gl2 = this.gl;\n var model = params.model || IDENTITY;\n var view = params.view || IDENTITY;\n var projection = params.projection || IDENTITY;\n var clipBounds = [[-1e6, -1e6, -1e6], [1e6, 1e6, 1e6]];\n for (var i = 0; i < 3; ++i) {\n clipBounds[0][i] = Math.max(clipBounds[0][i], this.clipBounds[0][i]);\n clipBounds[1][i] = Math.min(clipBounds[1][i], this.clipBounds[1][i]);\n }\n var uniforms = {\n model,\n view,\n projection,\n inverseModel: IDENTITY.slice(),\n clipBounds,\n kambient: this.ambientLight,\n kdiffuse: this.diffuseLight,\n kspecular: this.specularLight,\n roughness: this.roughness,\n fresnel: this.fresnel,\n eyePosition: [0, 0, 0],\n lightPosition: [0, 0, 0],\n opacity: this.opacity,\n tubeScale: this.tubeScale,\n vectorScale: this.vectorScale,\n coneScale: this.coneScale,\n coneOffset: this.coneOffset,\n texture: 0\n };\n uniforms.inverseModel = invert(uniforms.inverseModel, uniforms.model);\n gl2.disable(gl2.CULL_FACE);\n this.texture.bind(0);\n var invCameraMatrix = new Array(16);\n multiply(invCameraMatrix, uniforms.view, uniforms.model);\n multiply(invCameraMatrix, uniforms.projection, invCameraMatrix);\n invert(invCameraMatrix, invCameraMatrix);\n for (var i = 0; i < 3; ++i) {\n uniforms.eyePosition[i] = invCameraMatrix[12 + i] / invCameraMatrix[15];\n }\n var w = invCameraMatrix[15];\n for (var i = 0; i < 3; ++i) {\n w += this.lightPosition[i] * invCameraMatrix[4 * i + 3];\n }\n for (var i = 0; i < 3; ++i) {\n var s = invCameraMatrix[12 + i];\n for (var j = 0; j < 3; ++j) {\n s += invCameraMatrix[4 * j + i] * this.lightPosition[j];\n }\n uniforms.lightPosition[i] = s / w;\n }\n if (this.triangleCount > 0) {\n var shader = this.triShader;\n shader.bind();\n shader.uniforms = uniforms;\n this.triangleVAO.bind();\n gl2.drawArrays(gl2.TRIANGLES, 0, this.triangleCount * 3);\n this.triangleVAO.unbind();\n }\n };\n proto.drawPick = function(params) {\n params = params || {};\n var gl2 = this.gl;\n var model = params.model || IDENTITY;\n var view = params.view || IDENTITY;\n var projection = params.projection || IDENTITY;\n var clipBounds = [[-1e6, -1e6, -1e6], [1e6, 1e6, 1e6]];\n for (var i = 0; i < 3; ++i) {\n clipBounds[0][i] = Math.max(clipBounds[0][i], this.clipBounds[0][i]);\n clipBounds[1][i] = Math.min(clipBounds[1][i], this.clipBounds[1][i]);\n }\n this._model = [].slice.call(model);\n this._view = [].slice.call(view);\n this._projection = [].slice.call(projection);\n this._resolution = [gl2.drawingBufferWidth, gl2.drawingBufferHeight];\n var uniforms = {\n model,\n view,\n projection,\n clipBounds,\n tubeScale: this.tubeScale,\n vectorScale: this.vectorScale,\n coneScale: this.coneScale,\n coneOffset: this.coneOffset,\n pickId: this.pickId / 255\n };\n var shader = this.pickShader;\n shader.bind();\n shader.uniforms = uniforms;\n if (this.triangleCount > 0) {\n this.triangleVAO.bind();\n gl2.drawArrays(gl2.TRIANGLES, 0, this.triangleCount * 3);\n this.triangleVAO.unbind();\n }\n };\n proto.pick = function(pickData) {\n if (!pickData) {\n return null;\n }\n if (pickData.id !== this.pickId) {\n return null;\n }\n var cellId = pickData.value[0] + 256 * pickData.value[1] + 65536 * pickData.value[2];\n var cell = this.cells[cellId];\n var pos = this.positions[cell[1]].slice(0, 3);\n var result = {\n position: pos,\n dataCoordinate: pos,\n index: Math.floor(cell[1] / 48)\n };\n if (this.traceType === \"cone\") {\n result.index = Math.floor(cell[1] / 48);\n } else if (this.traceType === \"streamtube\") {\n result.intensity = this.intensity[cell[1]];\n result.velocity = this.vectors[cell[1]].slice(0, 3);\n result.divergence = this.vectors[cell[1]][3];\n result.index = cellId;\n }\n return result;\n };\n proto.dispose = function() {\n this.texture.dispose();\n this.triShader.dispose();\n this.pickShader.dispose();\n this.triangleVAO.dispose();\n this.trianglePositions.dispose();\n this.triangleVectors.dispose();\n this.triangleColors.dispose();\n this.triangleUVs.dispose();\n this.triangleIds.dispose();\n };\n function createMeshShader(gl2, shaders) {\n var shader = createShader(\n gl2,\n shaders.meshShader.vertex,\n shaders.meshShader.fragment,\n null,\n shaders.meshShader.attributes\n );\n shader.attributes.position.location = 0;\n shader.attributes.color.location = 2;\n shader.attributes.uv.location = 3;\n shader.attributes.vector.location = 4;\n return shader;\n }\n function createPickShader(gl2, shaders) {\n var shader = createShader(\n gl2,\n shaders.pickShader.vertex,\n shaders.pickShader.fragment,\n null,\n shaders.pickShader.attributes\n );\n shader.attributes.position.location = 0;\n shader.attributes.id.location = 1;\n shader.attributes.vector.location = 4;\n return shader;\n }\n function createVectorMesh(gl2, params, opts) {\n var shaders = opts.shaders;\n if (arguments.length === 1) {\n params = gl2;\n gl2 = params.gl;\n }\n var triShader = createMeshShader(gl2, shaders);\n var pickShader = createPickShader(gl2, shaders);\n var meshTexture = createTexture(\n gl2,\n ndarray(new Uint8Array([255, 255, 255, 255]), [1, 1, 4])\n );\n meshTexture.generateMipmap();\n meshTexture.minFilter = gl2.LINEAR_MIPMAP_LINEAR;\n meshTexture.magFilter = gl2.LINEAR;\n var trianglePositions = createBuffer(gl2);\n var triangleVectors = createBuffer(gl2);\n var triangleColors = createBuffer(gl2);\n var triangleUVs = createBuffer(gl2);\n var triangleIds = createBuffer(gl2);\n var triangleVAO = createVAO(gl2, [\n {\n buffer: trianglePositions,\n type: gl2.FLOAT,\n size: 4\n },\n {\n buffer: triangleIds,\n type: gl2.UNSIGNED_BYTE,\n size: 4,\n normalized: true\n },\n {\n buffer: triangleColors,\n type: gl2.FLOAT,\n size: 4\n },\n {\n buffer: triangleUVs,\n type: gl2.FLOAT,\n size: 2\n },\n {\n buffer: triangleVectors,\n type: gl2.FLOAT,\n size: 4\n }\n ]);\n var mesh = new VectorMesh(\n gl2,\n meshTexture,\n triShader,\n pickShader,\n trianglePositions,\n triangleVectors,\n triangleIds,\n triangleColors,\n triangleUVs,\n triangleVAO,\n opts.traceType || \"cone\"\n );\n mesh.update(params);\n return mesh;\n }\n module2.exports = createVectorMesh;\n }\n ),\n /***/\n 614: (\n /***/\n function(__unused_webpack_module, exports2, __webpack_require__2) {\n var glslify = __webpack_require__2(3236);\n var triVertSrc = glslify([\"precision highp float;\\n\\nprecision highp float;\\n#define GLSLIFY 1\\n\\nvec3 getOrthogonalVector(vec3 v) {\\n // Return up-vector for only-z vector.\\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\\n // Assign z = 0, x = -b, y = a:\\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\\n return normalize(vec3(-v.y, v.x, 0.0));\\n } else {\\n return normalize(vec3(0.0, v.z, -v.y));\\n }\\n}\\n\\n// Calculate the cone vertex and normal at the given index.\\n//\\n// The returned vertex is for a cone with its top at origin and height of 1.0,\\n// pointing in the direction of the vector attribute.\\n//\\n// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.\\n// These vertices are used to make up the triangles of the cone by the following:\\n// segment + 0 top vertex\\n// segment + 1 perimeter vertex a+1\\n// segment + 2 perimeter vertex a\\n// segment + 3 center base vertex\\n// segment + 4 perimeter vertex a\\n// segment + 5 perimeter vertex a+1\\n// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.\\n// To go from index to segment, floor(index / 6)\\n// To go from segment to angle, 2*pi * (segment/segmentCount)\\n// To go from index to segment index, index - (segment*6)\\n//\\nvec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) {\\n\\n const float segmentCount = 8.0;\\n\\n float index = rawIndex - floor(rawIndex /\\n (segmentCount * 6.0)) *\\n (segmentCount * 6.0);\\n\\n float segment = floor(0.001 + index/6.0);\\n float segmentIndex = index - (segment*6.0);\\n\\n normal = -normalize(d);\\n\\n if (segmentIndex > 2.99 && segmentIndex < 3.01) {\\n return mix(vec3(0.0), -d, coneOffset);\\n }\\n\\n float nextAngle = (\\n (segmentIndex > 0.99 && segmentIndex < 1.01) ||\\n (segmentIndex > 4.99 && segmentIndex < 5.01)\\n ) ? 1.0 : 0.0;\\n float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);\\n\\n vec3 v1 = mix(d, vec3(0.0), coneOffset);\\n vec3 v2 = v1 - d;\\n\\n vec3 u = getOrthogonalVector(d);\\n vec3 v = normalize(cross(u, d));\\n\\n vec3 x = u * cos(angle) * length(d)*0.25;\\n vec3 y = v * sin(angle) * length(d)*0.25;\\n vec3 v3 = v2 + x + y;\\n if (segmentIndex < 3.0) {\\n vec3 tx = u * sin(angle);\\n vec3 ty = v * -cos(angle);\\n vec3 tangent = tx + ty;\\n normal = normalize(cross(v3 - v1, tangent));\\n }\\n\\n if (segmentIndex == 0.0) {\\n return mix(d, vec3(0.0), coneOffset);\\n }\\n return v3;\\n}\\n\\nattribute vec3 vector;\\nattribute vec4 color, position;\\nattribute vec2 uv;\\n\\nuniform float vectorScale, coneScale, coneOffset;\\nuniform mat4 model, view, projection, inverseModel;\\nuniform vec3 eyePosition, lightPosition;\\n\\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;\\nvarying vec4 f_color;\\nvarying vec2 f_uv;\\n\\nvoid main() {\\n // Scale the vector magnitude to stay constant with\\n // model & view changes.\\n vec3 normal;\\n vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, coneOffset, normal);\\n vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\\n\\n //Lighting geometry parameters\\n vec4 cameraCoordinate = view * conePosition;\\n cameraCoordinate.xyz /= cameraCoordinate.w;\\n f_lightDirection = lightPosition - cameraCoordinate.xyz;\\n f_eyeDirection = eyePosition - cameraCoordinate.xyz;\\n f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz);\\n\\n // vec4 m_position = model * vec4(conePosition, 1.0);\\n vec4 t_position = view * conePosition;\\n gl_Position = projection * t_position;\\n\\n f_color = color;\\n f_data = conePosition.xyz;\\n f_position = position.xyz;\\n f_uv = uv;\\n}\\n\"]);\n var triFragSrc = glslify([\"#extension GL_OES_standard_derivatives : enable\\n\\nprecision highp float;\\n#define GLSLIFY 1\\n\\nfloat beckmannDistribution(float x, float roughness) {\\n float NdotH = max(x, 0.0001);\\n float cos2Alpha = NdotH * NdotH;\\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\\n float roughness2 = roughness * roughness;\\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\\n return exp(tan2Alpha / roughness2) / denom;\\n}\\n\\nfloat cookTorranceSpecular(\\n vec3 lightDirection,\\n vec3 viewDirection,\\n vec3 surfaceNormal,\\n float roughness,\\n float fresnel) {\\n\\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\\n\\n //Half angle vector\\n vec3 H = normalize(lightDirection + viewDirection);\\n\\n //Geometric term\\n float NdotH = max(dot(surfaceNormal, H), 0.0);\\n float VdotH = max(dot(viewDirection, H), 0.000001);\\n float LdotH = max(dot(lightDirection, H), 0.000001);\\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\\n float G = min(1.0, min(G1, G2));\\n \\n //Distribution term\\n float D = beckmannDistribution(NdotH, roughness);\\n\\n //Fresnel term\\n float F = pow(1.0 - VdotN, fresnel);\\n\\n //Multiply terms and done\\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\\n}\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nuniform vec3 clipBounds[2];\\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\\nuniform sampler2D texture;\\n\\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;\\nvarying vec4 f_color;\\nvarying vec2 f_uv;\\n\\nvoid main() {\\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\\n vec3 N = normalize(f_normal);\\n vec3 L = normalize(f_lightDirection);\\n vec3 V = normalize(f_eyeDirection);\\n\\n if(gl_FrontFacing) {\\n N = -N;\\n }\\n\\n float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));\\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\\n\\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\\n\\n gl_FragColor = litColor * opacity;\\n}\\n\"]);\n var pickVertSrc = glslify([\"precision highp float;\\n\\nprecision highp float;\\n#define GLSLIFY 1\\n\\nvec3 getOrthogonalVector(vec3 v) {\\n // Return up-vector for only-z vector.\\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\\n // Assign z = 0, x = -b, y = a:\\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\\n return normalize(vec3(-v.y, v.x, 0.0));\\n } else {\\n return normalize(vec3(0.0, v.z, -v.y));\\n }\\n}\\n\\n// Calculate the cone vertex and normal at the given index.\\n//\\n// The returned vertex is for a cone with its top at origin and height of 1.0,\\n// pointing in the direction of the vector attribute.\\n//\\n// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.\\n// These vertices are used to make up the triangles of the cone by the following:\\n// segment + 0 top vertex\\n// segment + 1 perimeter vertex a+1\\n// segment + 2 perimeter vertex a\\n// segment + 3 center base vertex\\n// segment + 4 perimeter vertex a\\n// segment + 5 perimeter vertex a+1\\n// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.\\n// To go from index to segment, floor(index / 6)\\n// To go from segment to angle, 2*pi * (segment/segmentCount)\\n// To go from index to segment index, index - (segment*6)\\n//\\nvec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) {\\n\\n const float segmentCount = 8.0;\\n\\n float index = rawIndex - floor(rawIndex /\\n (segmentCount * 6.0)) *\\n (segmentCount * 6.0);\\n\\n float segment = floor(0.001 + index/6.0);\\n float segmentIndex = index - (segment*6.0);\\n\\n normal = -normalize(d);\\n\\n if (segmentIndex > 2.99 && segmentIndex < 3.01) {\\n return mix(vec3(0.0), -d, coneOffset);\\n }\\n\\n float nextAngle = (\\n (segmentIndex > 0.99 && segmentIndex < 1.01) ||\\n (segmentIndex > 4.99 && segmentIndex < 5.01)\\n ) ? 1.0 : 0.0;\\n float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);\\n\\n vec3 v1 = mix(d, vec3(0.0), coneOffset);\\n vec3 v2 = v1 - d;\\n\\n vec3 u = getOrthogonalVector(d);\\n vec3 v = normalize(cross(u, d));\\n\\n vec3 x = u * cos(angle) * length(d)*0.25;\\n vec3 y = v * sin(angle) * length(d)*0.25;\\n vec3 v3 = v2 + x + y;\\n if (segmentIndex < 3.0) {\\n vec3 tx = u * sin(angle);\\n vec3 ty = v * -cos(angle);\\n vec3 tangent = tx + ty;\\n normal = normalize(cross(v3 - v1, tangent));\\n }\\n\\n if (segmentIndex == 0.0) {\\n return mix(d, vec3(0.0), coneOffset);\\n }\\n return v3;\\n}\\n\\nattribute vec4 vector;\\nattribute vec4 position;\\nattribute vec4 id;\\n\\nuniform mat4 model, view, projection;\\nuniform float vectorScale, coneScale, coneOffset;\\n\\nvarying vec3 f_position;\\nvarying vec4 f_id;\\n\\nvoid main() {\\n vec3 normal;\\n vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector.xyz), position.w, coneOffset, normal);\\n vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\\n gl_Position = projection * (view * conePosition);\\n f_id = id;\\n f_position = position.xyz;\\n}\\n\"]);\n var pickFragSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nuniform vec3 clipBounds[2];\\nuniform float pickId;\\n\\nvarying vec3 f_position;\\nvarying vec4 f_id;\\n\\nvoid main() {\\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\\n\\n gl_FragColor = vec4(pickId, f_id.xyz);\\n}\"]);\n exports2.meshShader = {\n vertex: triVertSrc,\n fragment: triFragSrc,\n attributes: [\n { name: \"position\", type: \"vec4\" },\n { name: \"color\", type: \"vec4\" },\n { name: \"uv\", type: \"vec2\" },\n { name: \"vector\", type: \"vec3\" }\n ]\n };\n exports2.pickShader = {\n vertex: pickVertSrc,\n fragment: pickFragSrc,\n attributes: [\n { name: \"position\", type: \"vec4\" },\n { name: \"id\", type: \"vec4\" },\n { name: \"vector\", type: \"vec3\" }\n ]\n };\n }\n ),\n /***/\n 737: (\n /***/\n function(module2) {\n module2.exports = {\n 0: \"NONE\",\n 1: \"ONE\",\n 2: \"LINE_LOOP\",\n 3: \"LINE_STRIP\",\n 4: \"TRIANGLES\",\n 5: \"TRIANGLE_STRIP\",\n 6: \"TRIANGLE_FAN\",\n 256: \"DEPTH_BUFFER_BIT\",\n 512: \"NEVER\",\n 513: \"LESS\",\n 514: \"EQUAL\",\n 515: \"LEQUAL\",\n 516: \"GREATER\",\n 517: \"NOTEQUAL\",\n 518: \"GEQUAL\",\n 519: \"ALWAYS\",\n 768: \"SRC_COLOR\",\n 769: \"ONE_MINUS_SRC_COLOR\",\n 770: \"SRC_ALPHA\",\n 771: \"ONE_MINUS_SRC_ALPHA\",\n 772: \"DST_ALPHA\",\n 773: \"ONE_MINUS_DST_ALPHA\",\n 774: \"DST_COLOR\",\n 775: \"ONE_MINUS_DST_COLOR\",\n 776: \"SRC_ALPHA_SATURATE\",\n 1024: \"STENCIL_BUFFER_BIT\",\n 1028: \"FRONT\",\n 1029: \"BACK\",\n 1032: \"FRONT_AND_BACK\",\n 1280: \"INVALID_ENUM\",\n 1281: \"INVALID_VALUE\",\n 1282: \"INVALID_OPERATION\",\n 1285: \"OUT_OF_MEMORY\",\n 1286: \"INVALID_FRAMEBUFFER_OPERATION\",\n 2304: \"CW\",\n 2305: \"CCW\",\n 2849: \"LINE_WIDTH\",\n 2884: \"CULL_FACE\",\n 2885: \"CULL_FACE_MODE\",\n 2886: \"FRONT_FACE\",\n 2928: \"DEPTH_RANGE\",\n 2929: \"DEPTH_TEST\",\n 2930: \"DEPTH_WRITEMASK\",\n 2931: \"DEPTH_CLEAR_VALUE\",\n 2932: \"DEPTH_FUNC\",\n 2960: \"STENCIL_TEST\",\n 2961: \"STENCIL_CLEAR_VALUE\",\n 2962: \"STENCIL_FUNC\",\n 2963: \"STENCIL_VALUE_MASK\",\n 2964: \"STENCIL_FAIL\",\n 2965: \"STENCIL_PASS_DEPTH_FAIL\",\n 2966: \"STENCIL_PASS_DEPTH_PASS\",\n 2967: \"STENCIL_REF\",\n 2968: \"STENCIL_WRITEMASK\",\n 2978: \"VIEWPORT\",\n 3024: \"DITHER\",\n 3042: \"BLEND\",\n 3088: \"SCISSOR_BOX\",\n 3089: \"SCISSOR_TEST\",\n 3106: \"COLOR_CLEAR_VALUE\",\n 3107: \"COLOR_WRITEMASK\",\n 3317: \"UNPACK_ALIGNMENT\",\n 3333: \"PACK_ALIGNMENT\",\n 3379: \"MAX_TEXTURE_SIZE\",\n 3386: \"MAX_VIEWPORT_DIMS\",\n 3408: \"SUBPIXEL_BITS\",\n 3410: \"RED_BITS\",\n 3411: \"GREEN_BITS\",\n 3412: \"BLUE_BITS\",\n 3413: \"ALPHA_BITS\",\n 3414: \"DEPTH_BITS\",\n 3415: \"STENCIL_BITS\",\n 3553: \"TEXTURE_2D\",\n 4352: \"DONT_CARE\",\n 4353: \"FASTEST\",\n 4354: \"NICEST\",\n 5120: \"BYTE\",\n 5121: \"UNSIGNED_BYTE\",\n 5122: \"SHORT\",\n 5123: \"UNSIGNED_SHORT\",\n 5124: \"INT\",\n 5125: \"UNSIGNED_INT\",\n 5126: \"FLOAT\",\n 5386: \"INVERT\",\n 5890: \"TEXTURE\",\n 6401: \"STENCIL_INDEX\",\n 6402: \"DEPTH_COMPONENT\",\n 6406: \"ALPHA\",\n 6407: \"RGB\",\n 6408: \"RGBA\",\n 6409: \"LUMINANCE\",\n 6410: \"LUMINANCE_ALPHA\",\n 7680: \"KEEP\",\n 7681: \"REPLACE\",\n 7682: \"INCR\",\n 7683: \"DECR\",\n 7936: \"VENDOR\",\n 7937: \"RENDERER\",\n 7938: \"VERSION\",\n 9728: \"NEAREST\",\n 9729: \"LINEAR\",\n 9984: \"NEAREST_MIPMAP_NEAREST\",\n 9985: \"LINEAR_MIPMAP_NEAREST\",\n 9986: \"NEAREST_MIPMAP_LINEAR\",\n 9987: \"LINEAR_MIPMAP_LINEAR\",\n 10240: \"TEXTURE_MAG_FILTER\",\n 10241: \"TEXTURE_MIN_FILTER\",\n 10242: \"TEXTURE_WRAP_S\",\n 10243: \"TEXTURE_WRAP_T\",\n 10497: \"REPEAT\",\n 10752: \"POLYGON_OFFSET_UNITS\",\n 16384: \"COLOR_BUFFER_BIT\",\n 32769: \"CONSTANT_COLOR\",\n 32770: \"ONE_MINUS_CONSTANT_COLOR\",\n 32771: \"CONSTANT_ALPHA\",\n 32772: \"ONE_MINUS_CONSTANT_ALPHA\",\n 32773: \"BLEND_COLOR\",\n 32774: \"FUNC_ADD\",\n 32777: \"BLEND_EQUATION_RGB\",\n 32778: \"FUNC_SUBTRACT\",\n 32779: \"FUNC_REVERSE_SUBTRACT\",\n 32819: \"UNSIGNED_SHORT_4_4_4_4\",\n 32820: \"UNSIGNED_SHORT_5_5_5_1\",\n 32823: \"POLYGON_OFFSET_FILL\",\n 32824: \"POLYGON_OFFSET_FACTOR\",\n 32854: \"RGBA4\",\n 32855: \"RGB5_A1\",\n 32873: \"TEXTURE_BINDING_2D\",\n 32926: \"SAMPLE_ALPHA_TO_COVERAGE\",\n 32928: \"SAMPLE_COVERAGE\",\n 32936: \"SAMPLE_BUFFERS\",\n 32937: \"SAMPLES\",\n 32938: \"SAMPLE_COVERAGE_VALUE\",\n 32939: \"SAMPLE_COVERAGE_INVERT\",\n 32968: \"BLEND_DST_RGB\",\n 32969: \"BLEND_SRC_RGB\",\n 32970: \"BLEND_DST_ALPHA\",\n 32971: \"BLEND_SRC_ALPHA\",\n 33071: \"CLAMP_TO_EDGE\",\n 33170: \"GENERATE_MIPMAP_HINT\",\n 33189: \"DEPTH_COMPONENT16\",\n 33306: \"DEPTH_STENCIL_ATTACHMENT\",\n 33635: \"UNSIGNED_SHORT_5_6_5\",\n 33648: \"MIRRORED_REPEAT\",\n 33901: \"ALIASED_POINT_SIZE_RANGE\",\n 33902: \"ALIASED_LINE_WIDTH_RANGE\",\n 33984: \"TEXTURE0\",\n 33985: \"TEXTURE1\",\n 33986: \"TEXTURE2\",\n 33987: \"TEXTURE3\",\n 33988: \"TEXTURE4\",\n 33989: \"TEXTURE5\",\n 33990: \"TEXTURE6\",\n 33991: \"TEXTURE7\",\n 33992: \"TEXTURE8\",\n 33993: \"TEXTURE9\",\n 33994: \"TEXTURE10\",\n 33995: \"TEXTURE11\",\n 33996: \"TEXTURE12\",\n 33997: \"TEXTURE13\",\n 33998: \"TEXTURE14\",\n 33999: \"TEXTURE15\",\n 34e3: \"TEXTURE16\",\n 34001: \"TEXTURE17\",\n 34002: \"TEXTURE18\",\n 34003: \"TEXTURE19\",\n 34004: \"TEXTURE20\",\n 34005: \"TEXTURE21\",\n 34006: \"TEXTURE22\",\n 34007: \"TEXTURE23\",\n 34008: \"TEXTURE24\",\n 34009: \"TEXTURE25\",\n 34010: \"TEXTURE26\",\n 34011: \"TEXTURE27\",\n 34012: \"TEXTURE28\",\n 34013: \"TEXTURE29\",\n 34014: \"TEXTURE30\",\n 34015: \"TEXTURE31\",\n 34016: \"ACTIVE_TEXTURE\",\n 34024: \"MAX_RENDERBUFFER_SIZE\",\n 34041: \"DEPTH_STENCIL\",\n 34055: \"INCR_WRAP\",\n 34056: \"DECR_WRAP\",\n 34067: \"TEXTURE_CUBE_MAP\",\n 34068: \"TEXTURE_BINDING_CUBE_MAP\",\n 34069: \"TEXTURE_CUBE_MAP_POSITIVE_X\",\n 34070: \"TEXTURE_CUBE_MAP_NEGATIVE_X\",\n 34071: \"TEXTURE_CUBE_MAP_POSITIVE_Y\",\n 34072: \"TEXTURE_CUBE_MAP_NEGATIVE_Y\",\n 34073: \"TEXTURE_CUBE_MAP_POSITIVE_Z\",\n 34074: \"TEXTURE_CUBE_MAP_NEGATIVE_Z\",\n 34076: \"MAX_CUBE_MAP_TEXTURE_SIZE\",\n 34338: \"VERTEX_ATTRIB_ARRAY_ENABLED\",\n 34339: \"VERTEX_ATTRIB_ARRAY_SIZE\",\n 34340: \"VERTEX_ATTRIB_ARRAY_STRIDE\",\n 34341: \"VERTEX_ATTRIB_ARRAY_TYPE\",\n 34342: \"CURRENT_VERTEX_ATTRIB\",\n 34373: \"VERTEX_ATTRIB_ARRAY_POINTER\",\n 34466: \"NUM_COMPRESSED_TEXTURE_FORMATS\",\n 34467: \"COMPRESSED_TEXTURE_FORMATS\",\n 34660: \"BUFFER_SIZE\",\n 34661: \"BUFFER_USAGE\",\n 34816: \"STENCIL_BACK_FUNC\",\n 34817: \"STENCIL_BACK_FAIL\",\n 34818: \"STENCIL_BACK_PASS_DEPTH_FAIL\",\n 34819: \"STENCIL_BACK_PASS_DEPTH_PASS\",\n 34877: \"BLEND_EQUATION_ALPHA\",\n 34921: \"MAX_VERTEX_ATTRIBS\",\n 34922: \"VERTEX_ATTRIB_ARRAY_NORMALIZED\",\n 34930: \"MAX_TEXTURE_IMAGE_UNITS\",\n 34962: \"ARRAY_BUFFER\",\n 34963: \"ELEMENT_ARRAY_BUFFER\",\n 34964: \"ARRAY_BUFFER_BINDING\",\n 34965: \"ELEMENT_ARRAY_BUFFER_BINDING\",\n 34975: \"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING\",\n 35040: \"STREAM_DRAW\",\n 35044: \"STATIC_DRAW\",\n 35048: \"DYNAMIC_DRAW\",\n 35632: \"FRAGMENT_SHADER\",\n 35633: \"VERTEX_SHADER\",\n 35660: \"MAX_VERTEX_TEXTURE_IMAGE_UNITS\",\n 35661: \"MAX_COMBINED_TEXTURE_IMAGE_UNITS\",\n 35663: \"SHADER_TYPE\",\n 35664: \"FLOAT_VEC2\",\n 35665: \"FLOAT_VEC3\",\n 35666: \"FLOAT_VEC4\",\n 35667: \"INT_VEC2\",\n 35668: \"INT_VEC3\",\n 35669: \"INT_VEC4\",\n 35670: \"BOOL\",\n 35671: \"BOOL_VEC2\",\n 35672: \"BOOL_VEC3\",\n 35673: \"BOOL_VEC4\",\n 35674: \"FLOAT_MAT2\",\n 35675: \"FLOAT_MAT3\",\n 35676: \"FLOAT_MAT4\",\n 35678: \"SAMPLER_2D\",\n 35680: \"SAMPLER_CUBE\",\n 35712: \"DELETE_STATUS\",\n 35713: \"COMPILE_STATUS\",\n 35714: \"LINK_STATUS\",\n 35715: \"VALIDATE_STATUS\",\n 35716: \"INFO_LOG_LENGTH\",\n 35717: \"ATTACHED_SHADERS\",\n 35718: \"ACTIVE_UNIFORMS\",\n 35719: \"ACTIVE_UNIFORM_MAX_LENGTH\",\n 35720: \"SHADER_SOURCE_LENGTH\",\n 35721: \"ACTIVE_ATTRIBUTES\",\n 35722: \"ACTIVE_ATTRIBUTE_MAX_LENGTH\",\n 35724: \"SHADING_LANGUAGE_VERSION\",\n 35725: \"CURRENT_PROGRAM\",\n 36003: \"STENCIL_BACK_REF\",\n 36004: \"STENCIL_BACK_VALUE_MASK\",\n 36005: \"STENCIL_BACK_WRITEMASK\",\n 36006: \"FRAMEBUFFER_BINDING\",\n 36007: \"RENDERBUFFER_BINDING\",\n 36048: \"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE\",\n 36049: \"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME\",\n 36050: \"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL\",\n 36051: \"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE\",\n 36053: \"FRAMEBUFFER_COMPLETE\",\n 36054: \"FRAMEBUFFER_INCOMPLETE_ATTACHMENT\",\n 36055: \"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\",\n 36057: \"FRAMEBUFFER_INCOMPLETE_DIMENSIONS\",\n 36061: \"FRAMEBUFFER_UNSUPPORTED\",\n 36064: \"COLOR_ATTACHMENT0\",\n 36096: \"DEPTH_ATTACHMENT\",\n 36128: \"STENCIL_ATTACHMENT\",\n 36160: \"FRAMEBUFFER\",\n 36161: \"RENDERBUFFER\",\n 36162: \"RENDERBUFFER_WIDTH\",\n 36163: \"RENDERBUFFER_HEIGHT\",\n 36164: \"RENDERBUFFER_INTERNAL_FORMAT\",\n 36168: \"STENCIL_INDEX8\",\n 36176: \"RENDERBUFFER_RED_SIZE\",\n 36177: \"RENDERBUFFER_GREEN_SIZE\",\n 36178: \"RENDERBUFFER_BLUE_SIZE\",\n 36179: \"RENDERBUFFER_ALPHA_SIZE\",\n 36180: \"RENDERBUFFER_DEPTH_SIZE\",\n 36181: \"RENDERBUFFER_STENCIL_SIZE\",\n 36194: \"RGB565\",\n 36336: \"LOW_FLOAT\",\n 36337: \"MEDIUM_FLOAT\",\n 36338: \"HIGH_FLOAT\",\n 36339: \"LOW_INT\",\n 36340: \"MEDIUM_INT\",\n 36341: \"HIGH_INT\",\n 36346: \"SHADER_COMPILER\",\n 36347: \"MAX_VERTEX_UNIFORM_VECTORS\",\n 36348: \"MAX_VARYING_VECTORS\",\n 36349: \"MAX_FRAGMENT_UNIFORM_VECTORS\",\n 37440: \"UNPACK_FLIP_Y_WEBGL\",\n 37441: \"UNPACK_PREMULTIPLY_ALPHA_WEBGL\",\n 37442: \"CONTEXT_LOST_WEBGL\",\n 37443: \"UNPACK_COLORSPACE_CONVERSION_WEBGL\",\n 37444: \"BROWSER_DEFAULT_WEBGL\"\n };\n }\n ),\n /***/\n 5171: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n var gl10 = __webpack_require__2(737);\n module2.exports = function lookupConstant(number) {\n return gl10[number];\n };\n }\n ),\n /***/\n 9165: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = createErrorBars;\n var createBuffer = __webpack_require__2(2762);\n var createVAO = __webpack_require__2(8116);\n var createShader = __webpack_require__2(3436);\n var IDENTITY = [\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ];\n function ErrorBars(gl2, buffer, vao, shader) {\n this.gl = gl2;\n this.shader = shader;\n this.buffer = buffer;\n this.vao = vao;\n this.pixelRatio = 1;\n this.bounds = [[Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]];\n this.clipBounds = [[-Infinity, -Infinity, -Infinity], [Infinity, Infinity, Infinity]];\n this.lineWidth = [1, 1, 1];\n this.capSize = [10, 10, 10];\n this.lineCount = [0, 0, 0];\n this.lineOffset = [0, 0, 0];\n this.opacity = 1;\n this.hasAlpha = false;\n }\n var proto = ErrorBars.prototype;\n proto.isOpaque = function() {\n return !this.hasAlpha;\n };\n proto.isTransparent = function() {\n return this.hasAlpha;\n };\n proto.drawTransparent = proto.draw = function(cameraParams) {\n var gl2 = this.gl;\n var uniforms = this.shader.uniforms;\n this.shader.bind();\n var view = uniforms.view = cameraParams.view || IDENTITY;\n var projection = uniforms.projection = cameraParams.projection || IDENTITY;\n uniforms.model = cameraParams.model || IDENTITY;\n uniforms.clipBounds = this.clipBounds;\n uniforms.opacity = this.opacity;\n var cx = view[12];\n var cy = view[13];\n var cz = view[14];\n var cw = view[15];\n var isOrtho = cameraParams._ortho || false;\n var orthoFix = isOrtho ? 2 : 1;\n var pixelScaleF = orthoFix * this.pixelRatio * (projection[3] * cx + projection[7] * cy + projection[11] * cz + projection[15] * cw) / gl2.drawingBufferHeight;\n this.vao.bind();\n for (var i = 0; i < 3; ++i) {\n gl2.lineWidth(this.lineWidth[i] * this.pixelRatio);\n uniforms.capSize = this.capSize[i] * pixelScaleF;\n if (this.lineCount[i]) {\n gl2.drawArrays(gl2.LINES, this.lineOffset[i], this.lineCount[i]);\n }\n }\n this.vao.unbind();\n };\n function updateBounds(bounds, point) {\n for (var i = 0; i < 3; ++i) {\n bounds[0][i] = Math.min(bounds[0][i], point[i]);\n bounds[1][i] = Math.max(bounds[1][i], point[i]);\n }\n }\n var FACE_TABLE = function() {\n var table = new Array(3);\n for (var d = 0; d < 3; ++d) {\n var row = [];\n for (var j = 1; j <= 2; ++j) {\n for (var s = -1; s <= 1; s += 2) {\n var u = (j + d) % 3;\n var y = [0, 0, 0];\n y[u] = s;\n row.push(y);\n }\n }\n table[d] = row;\n }\n return table;\n }();\n function emitFace(verts, x, c, d) {\n var offsets = FACE_TABLE[d];\n for (var i = 0; i < offsets.length; ++i) {\n var o = offsets[i];\n verts.push(\n x[0],\n x[1],\n x[2],\n c[0],\n c[1],\n c[2],\n c[3],\n o[0],\n o[1],\n o[2]\n );\n }\n return offsets.length;\n }\n proto.update = function(options) {\n options = options || {};\n if (\"lineWidth\" in options) {\n this.lineWidth = options.lineWidth;\n if (!Array.isArray(this.lineWidth)) {\n this.lineWidth = [this.lineWidth, this.lineWidth, this.lineWidth];\n }\n }\n if (\"capSize\" in options) {\n this.capSize = options.capSize;\n if (!Array.isArray(this.capSize)) {\n this.capSize = [this.capSize, this.capSize, this.capSize];\n }\n }\n this.hasAlpha = false;\n if (\"opacity\" in options) {\n this.opacity = +options.opacity;\n if (this.opacity < 1) {\n this.hasAlpha = true;\n }\n }\n var color2 = options.color || [[0, 0, 0], [0, 0, 0], [0, 0, 0]];\n var position = options.position;\n var error = options.error;\n if (!Array.isArray(color2[0])) {\n color2 = [color2, color2, color2];\n }\n if (position && error) {\n var verts = [];\n var n = position.length;\n var vertexCount = 0;\n this.bounds = [\n [Infinity, Infinity, Infinity],\n [-Infinity, -Infinity, -Infinity]\n ];\n this.lineCount = [0, 0, 0];\n for (var j = 0; j < 3; ++j) {\n this.lineOffset[j] = vertexCount;\n i_loop:\n for (var i = 0; i < n; ++i) {\n var p = position[i];\n for (var k = 0; k < 3; ++k) {\n if (isNaN(p[k]) || !isFinite(p[k])) {\n continue i_loop;\n }\n }\n var e = error[i];\n var c = color2[j];\n if (Array.isArray(c[0])) {\n c = color2[i];\n }\n if (c.length === 3) {\n c = [c[0], c[1], c[2], 1];\n } else if (c.length === 4) {\n c = [c[0], c[1], c[2], c[3]];\n if (!this.hasAlpha && c[3] < 1) this.hasAlpha = true;\n }\n if (isNaN(e[0][j]) || isNaN(e[1][j])) {\n continue;\n }\n if (e[0][j] < 0) {\n var x = p.slice();\n x[j] += e[0][j];\n verts.push(\n p[0],\n p[1],\n p[2],\n c[0],\n c[1],\n c[2],\n c[3],\n 0,\n 0,\n 0,\n x[0],\n x[1],\n x[2],\n c[0],\n c[1],\n c[2],\n c[3],\n 0,\n 0,\n 0\n );\n updateBounds(this.bounds, x);\n vertexCount += 2 + emitFace(verts, x, c, j);\n }\n if (e[1][j] > 0) {\n var x = p.slice();\n x[j] += e[1][j];\n verts.push(\n p[0],\n p[1],\n p[2],\n c[0],\n c[1],\n c[2],\n c[3],\n 0,\n 0,\n 0,\n x[0],\n x[1],\n x[2],\n c[0],\n c[1],\n c[2],\n c[3],\n 0,\n 0,\n 0\n );\n updateBounds(this.bounds, x);\n vertexCount += 2 + emitFace(verts, x, c, j);\n }\n }\n this.lineCount[j] = vertexCount - this.lineOffset[j];\n }\n this.buffer.update(verts);\n }\n };\n proto.dispose = function() {\n this.shader.dispose();\n this.buffer.dispose();\n this.vao.dispose();\n };\n function createErrorBars(options) {\n var gl2 = options.gl;\n var buffer = createBuffer(gl2);\n var vao = createVAO(gl2, [\n {\n buffer,\n type: gl2.FLOAT,\n size: 3,\n offset: 0,\n stride: 40\n },\n {\n buffer,\n type: gl2.FLOAT,\n size: 4,\n offset: 12,\n stride: 40\n },\n {\n buffer,\n type: gl2.FLOAT,\n size: 3,\n offset: 28,\n stride: 40\n }\n ]);\n var shader = createShader(gl2);\n shader.attributes.position.location = 0;\n shader.attributes.color.location = 1;\n shader.attributes.offset.location = 2;\n var result = new ErrorBars(gl2, buffer, vao, shader);\n result.update(options);\n return result;\n }\n }\n ),\n /***/\n 3436: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var glslify = __webpack_require__2(3236);\n var createShader = __webpack_require__2(9405);\n var vertSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nattribute vec3 position, offset;\\nattribute vec4 color;\\nuniform mat4 model, view, projection;\\nuniform float capSize;\\nvarying vec4 fragColor;\\nvarying vec3 fragPosition;\\n\\nvoid main() {\\n vec4 worldPosition = model * vec4(position, 1.0);\\n worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);\\n gl_Position = projection * (view * worldPosition);\\n fragColor = color;\\n fragPosition = position;\\n}\"]);\n var fragSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nuniform vec3 clipBounds[2];\\nuniform float opacity;\\nvarying vec3 fragPosition;\\nvarying vec4 fragColor;\\n\\nvoid main() {\\n if (\\n outOfRange(clipBounds[0], clipBounds[1], fragPosition) ||\\n fragColor.a * opacity == 0.\\n ) discard;\\n\\n gl_FragColor = opacity * fragColor;\\n}\"]);\n module2.exports = function(gl2) {\n return createShader(gl2, vertSrc, fragSrc, null, [\n { name: \"position\", type: \"vec3\" },\n { name: \"color\", type: \"vec4\" },\n { name: \"offset\", type: \"vec3\" }\n ]);\n };\n }\n ),\n /***/\n 2260: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var createTexture = __webpack_require__2(7766);\n module2.exports = createFBO;\n var colorAttachmentArrays = null;\n var FRAMEBUFFER_UNSUPPORTED;\n var FRAMEBUFFER_INCOMPLETE_ATTACHMENT;\n var FRAMEBUFFER_INCOMPLETE_DIMENSIONS;\n var FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;\n function saveFBOState(gl2) {\n var fbo = gl2.getParameter(gl2.FRAMEBUFFER_BINDING);\n var rbo = gl2.getParameter(gl2.RENDERBUFFER_BINDING);\n var tex = gl2.getParameter(gl2.TEXTURE_BINDING_2D);\n return [fbo, rbo, tex];\n }\n function restoreFBOState(gl2, data) {\n gl2.bindFramebuffer(gl2.FRAMEBUFFER, data[0]);\n gl2.bindRenderbuffer(gl2.RENDERBUFFER, data[1]);\n gl2.bindTexture(gl2.TEXTURE_2D, data[2]);\n }\n function lazyInitColorAttachments(gl2, ext) {\n var maxColorAttachments = gl2.getParameter(ext.MAX_COLOR_ATTACHMENTS_WEBGL);\n colorAttachmentArrays = new Array(maxColorAttachments + 1);\n for (var i = 0; i <= maxColorAttachments; ++i) {\n var x = new Array(maxColorAttachments);\n for (var j = 0; j < i; ++j) {\n x[j] = gl2.COLOR_ATTACHMENT0 + j;\n }\n for (var j = i; j < maxColorAttachments; ++j) {\n x[j] = gl2.NONE;\n }\n colorAttachmentArrays[i] = x;\n }\n }\n function throwFBOError(status) {\n switch (status) {\n case FRAMEBUFFER_UNSUPPORTED:\n throw new Error(\"gl-fbo: Framebuffer unsupported\");\n case FRAMEBUFFER_INCOMPLETE_ATTACHMENT:\n throw new Error(\"gl-fbo: Framebuffer incomplete attachment\");\n case FRAMEBUFFER_INCOMPLETE_DIMENSIONS:\n throw new Error(\"gl-fbo: Framebuffer incomplete dimensions\");\n case FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:\n throw new Error(\"gl-fbo: Framebuffer incomplete missing attachment\");\n default:\n throw new Error(\"gl-fbo: Framebuffer failed for unspecified reason\");\n }\n }\n function initTexture(gl2, width, height, type, format, attachment) {\n if (!type) {\n return null;\n }\n var result = createTexture(gl2, width, height, format, type);\n result.magFilter = gl2.NEAREST;\n result.minFilter = gl2.NEAREST;\n result.mipSamples = 1;\n result.bind();\n gl2.framebufferTexture2D(gl2.FRAMEBUFFER, attachment, gl2.TEXTURE_2D, result.handle, 0);\n return result;\n }\n function initRenderBuffer(gl2, width, height, component, attachment) {\n var result = gl2.createRenderbuffer();\n gl2.bindRenderbuffer(gl2.RENDERBUFFER, result);\n gl2.renderbufferStorage(gl2.RENDERBUFFER, component, width, height);\n gl2.framebufferRenderbuffer(gl2.FRAMEBUFFER, attachment, gl2.RENDERBUFFER, result);\n return result;\n }\n function rebuildFBO(fbo) {\n var state = saveFBOState(fbo.gl);\n var gl2 = fbo.gl;\n var handle = fbo.handle = gl2.createFramebuffer();\n var width = fbo._shape[0];\n var height = fbo._shape[1];\n var numColors = fbo.color.length;\n var ext = fbo._ext;\n var useStencil = fbo._useStencil;\n var useDepth = fbo._useDepth;\n var colorType = fbo._colorType;\n gl2.bindFramebuffer(gl2.FRAMEBUFFER, handle);\n for (var i = 0; i < numColors; ++i) {\n fbo.color[i] = initTexture(gl2, width, height, colorType, gl2.RGBA, gl2.COLOR_ATTACHMENT0 + i);\n }\n if (numColors === 0) {\n fbo._color_rb = initRenderBuffer(gl2, width, height, gl2.RGBA4, gl2.COLOR_ATTACHMENT0);\n if (ext) {\n ext.drawBuffersWEBGL(colorAttachmentArrays[0]);\n }\n } else if (numColors > 1) {\n ext.drawBuffersWEBGL(colorAttachmentArrays[numColors]);\n }\n var WEBGL_depth_texture = gl2.getExtension(\"WEBGL_depth_texture\");\n if (WEBGL_depth_texture) {\n if (useStencil) {\n fbo.depth = initTexture(\n gl2,\n width,\n height,\n WEBGL_depth_texture.UNSIGNED_INT_24_8_WEBGL,\n gl2.DEPTH_STENCIL,\n gl2.DEPTH_STENCIL_ATTACHMENT\n );\n } else if (useDepth) {\n fbo.depth = initTexture(\n gl2,\n width,\n height,\n gl2.UNSIGNED_SHORT,\n gl2.DEPTH_COMPONENT,\n gl2.DEPTH_ATTACHMENT\n );\n }\n } else {\n if (useDepth && useStencil) {\n fbo._depth_rb = initRenderBuffer(gl2, width, height, gl2.DEPTH_STENCIL, gl2.DEPTH_STENCIL_ATTACHMENT);\n } else if (useDepth) {\n fbo._depth_rb = initRenderBuffer(gl2, width, height, gl2.DEPTH_COMPONENT16, gl2.DEPTH_ATTACHMENT);\n } else if (useStencil) {\n fbo._depth_rb = initRenderBuffer(gl2, width, height, gl2.STENCIL_INDEX, gl2.STENCIL_ATTACHMENT);\n }\n }\n var status = gl2.checkFramebufferStatus(gl2.FRAMEBUFFER);\n if (status !== gl2.FRAMEBUFFER_COMPLETE) {\n fbo._destroyed = true;\n gl2.bindFramebuffer(gl2.FRAMEBUFFER, null);\n gl2.deleteFramebuffer(fbo.handle);\n fbo.handle = null;\n if (fbo.depth) {\n fbo.depth.dispose();\n fbo.depth = null;\n }\n if (fbo._depth_rb) {\n gl2.deleteRenderbuffer(fbo._depth_rb);\n fbo._depth_rb = null;\n }\n for (var i = 0; i < fbo.color.length; ++i) {\n fbo.color[i].dispose();\n fbo.color[i] = null;\n }\n if (fbo._color_rb) {\n gl2.deleteRenderbuffer(fbo._color_rb);\n fbo._color_rb = null;\n }\n restoreFBOState(gl2, state);\n throwFBOError(status);\n }\n restoreFBOState(gl2, state);\n }\n function Framebuffer(gl2, width, height, colorType, numColors, useDepth, useStencil, ext) {\n this.gl = gl2;\n this._shape = [width | 0, height | 0];\n this._destroyed = false;\n this._ext = ext;\n this.color = new Array(numColors);\n for (var i = 0; i < numColors; ++i) {\n this.color[i] = null;\n }\n this._color_rb = null;\n this.depth = null;\n this._depth_rb = null;\n this._colorType = colorType;\n this._useDepth = useDepth;\n this._useStencil = useStencil;\n var parent = this;\n var shapeVector = [width | 0, height | 0];\n Object.defineProperties(shapeVector, {\n 0: {\n get: function() {\n return parent._shape[0];\n },\n set: function(w) {\n return parent.width = w;\n }\n },\n 1: {\n get: function() {\n return parent._shape[1];\n },\n set: function(h) {\n return parent.height = h;\n }\n }\n });\n this._shapeVector = shapeVector;\n rebuildFBO(this);\n }\n var proto = Framebuffer.prototype;\n function reshapeFBO(fbo, w, h) {\n if (fbo._destroyed) {\n throw new Error(\"gl-fbo: Can't resize destroyed FBO\");\n }\n if (fbo._shape[0] === w && fbo._shape[1] === h) {\n return;\n }\n var gl2 = fbo.gl;\n var maxFBOSize = gl2.getParameter(gl2.MAX_RENDERBUFFER_SIZE);\n if (w < 0 || w > maxFBOSize || h < 0 || h > maxFBOSize) {\n throw new Error(\"gl-fbo: Can't resize FBO, invalid dimensions\");\n }\n fbo._shape[0] = w;\n fbo._shape[1] = h;\n var state = saveFBOState(gl2);\n for (var i = 0; i < fbo.color.length; ++i) {\n fbo.color[i].shape = fbo._shape;\n }\n if (fbo._color_rb) {\n gl2.bindRenderbuffer(gl2.RENDERBUFFER, fbo._color_rb);\n gl2.renderbufferStorage(gl2.RENDERBUFFER, gl2.RGBA4, fbo._shape[0], fbo._shape[1]);\n }\n if (fbo.depth) {\n fbo.depth.shape = fbo._shape;\n }\n if (fbo._depth_rb) {\n gl2.bindRenderbuffer(gl2.RENDERBUFFER, fbo._depth_rb);\n if (fbo._useDepth && fbo._useStencil) {\n gl2.renderbufferStorage(gl2.RENDERBUFFER, gl2.DEPTH_STENCIL, fbo._shape[0], fbo._shape[1]);\n } else if (fbo._useDepth) {\n gl2.renderbufferStorage(gl2.RENDERBUFFER, gl2.DEPTH_COMPONENT16, fbo._shape[0], fbo._shape[1]);\n } else if (fbo._useStencil) {\n gl2.renderbufferStorage(gl2.RENDERBUFFER, gl2.STENCIL_INDEX, fbo._shape[0], fbo._shape[1]);\n }\n }\n gl2.bindFramebuffer(gl2.FRAMEBUFFER, fbo.handle);\n var status = gl2.checkFramebufferStatus(gl2.FRAMEBUFFER);\n if (status !== gl2.FRAMEBUFFER_COMPLETE) {\n fbo.dispose();\n restoreFBOState(gl2, state);\n throwFBOError(status);\n }\n restoreFBOState(gl2, state);\n }\n Object.defineProperties(proto, {\n \"shape\": {\n get: function() {\n if (this._destroyed) {\n return [0, 0];\n }\n return this._shapeVector;\n },\n set: function(x) {\n if (!Array.isArray(x)) {\n x = [x | 0, x | 0];\n }\n if (x.length !== 2) {\n throw new Error(\"gl-fbo: Shape vector must be length 2\");\n }\n var w = x[0] | 0;\n var h = x[1] | 0;\n reshapeFBO(this, w, h);\n return [w, h];\n },\n enumerable: false\n },\n \"width\": {\n get: function() {\n if (this._destroyed) {\n return 0;\n }\n return this._shape[0];\n },\n set: function(w) {\n w = w | 0;\n reshapeFBO(this, w, this._shape[1]);\n return w;\n },\n enumerable: false\n },\n \"height\": {\n get: function() {\n if (this._destroyed) {\n return 0;\n }\n return this._shape[1];\n },\n set: function(h) {\n h = h | 0;\n reshapeFBO(this, this._shape[0], h);\n return h;\n },\n enumerable: false\n }\n });\n proto.bind = function() {\n if (this._destroyed) {\n return;\n }\n var gl2 = this.gl;\n gl2.bindFramebuffer(gl2.FRAMEBUFFER, this.handle);\n gl2.viewport(0, 0, this._shape[0], this._shape[1]);\n };\n proto.dispose = function() {\n if (this._destroyed) {\n return;\n }\n this._destroyed = true;\n var gl2 = this.gl;\n gl2.deleteFramebuffer(this.handle);\n this.handle = null;\n if (this.depth) {\n this.depth.dispose();\n this.depth = null;\n }\n if (this._depth_rb) {\n gl2.deleteRenderbuffer(this._depth_rb);\n this._depth_rb = null;\n }\n for (var i = 0; i < this.color.length; ++i) {\n this.color[i].dispose();\n this.color[i] = null;\n }\n if (this._color_rb) {\n gl2.deleteRenderbuffer(this._color_rb);\n this._color_rb = null;\n }\n };\n function createFBO(gl2, width, height, options) {\n if (!FRAMEBUFFER_UNSUPPORTED) {\n FRAMEBUFFER_UNSUPPORTED = gl2.FRAMEBUFFER_UNSUPPORTED;\n FRAMEBUFFER_INCOMPLETE_ATTACHMENT = gl2.FRAMEBUFFER_INCOMPLETE_ATTACHMENT;\n FRAMEBUFFER_INCOMPLETE_DIMENSIONS = gl2.FRAMEBUFFER_INCOMPLETE_DIMENSIONS;\n FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = gl2.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;\n }\n var WEBGL_draw_buffers = gl2.getExtension(\"WEBGL_draw_buffers\");\n if (!colorAttachmentArrays && WEBGL_draw_buffers) {\n lazyInitColorAttachments(gl2, WEBGL_draw_buffers);\n }\n if (Array.isArray(width)) {\n options = height;\n height = width[1] | 0;\n width = width[0] | 0;\n }\n if (typeof width !== \"number\") {\n throw new Error(\"gl-fbo: Missing shape parameter\");\n }\n var maxFBOSize = gl2.getParameter(gl2.MAX_RENDERBUFFER_SIZE);\n if (width < 0 || width > maxFBOSize || height < 0 || height > maxFBOSize) {\n throw new Error(\"gl-fbo: Parameters are too large for FBO\");\n }\n options = options || {};\n var numColors = 1;\n if (\"color\" in options) {\n numColors = Math.max(options.color | 0, 0);\n if (numColors < 0) {\n throw new Error(\"gl-fbo: Must specify a nonnegative number of colors\");\n }\n if (numColors > 1) {\n if (!WEBGL_draw_buffers) {\n throw new Error(\"gl-fbo: Multiple draw buffer extension not supported\");\n } else if (numColors > gl2.getParameter(WEBGL_draw_buffers.MAX_COLOR_ATTACHMENTS_WEBGL)) {\n throw new Error(\"gl-fbo: Context does not support \" + numColors + \" draw buffers\");\n }\n }\n }\n var colorType = gl2.UNSIGNED_BYTE;\n var OES_texture_float = gl2.getExtension(\"OES_texture_float\");\n if (options.float && numColors > 0) {\n if (!OES_texture_float) {\n throw new Error(\"gl-fbo: Context does not support floating point textures\");\n }\n colorType = gl2.FLOAT;\n } else if (options.preferFloat && numColors > 0) {\n if (OES_texture_float) {\n colorType = gl2.FLOAT;\n }\n }\n var useDepth = true;\n if (\"depth\" in options) {\n useDepth = !!options.depth;\n }\n var useStencil = false;\n if (\"stencil\" in options) {\n useStencil = !!options.stencil;\n }\n return new Framebuffer(\n gl2,\n width,\n height,\n colorType,\n numColors,\n useDepth,\n useStencil,\n WEBGL_draw_buffers\n );\n }\n }\n ),\n /***/\n 2992: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n var sprintf = __webpack_require__2(3387).sprintf;\n var glConstants = __webpack_require__2(5171);\n var shaderName = __webpack_require__2(1848);\n var addLineNumbers = __webpack_require__2(1085);\n module2.exports = formatCompilerError;\n function formatCompilerError(errLog, src, type) {\n \"use strict\";\n var name2 = shaderName(src) || \"of unknown name (see npm glsl-shader-name)\";\n var typeName = \"unknown type\";\n if (type !== void 0) {\n typeName = type === glConstants.FRAGMENT_SHADER ? \"fragment\" : \"vertex\";\n }\n var longForm = sprintf(\"Error compiling %s shader %s:\\n\", typeName, name2);\n var shortForm = sprintf(\"%s%s\", longForm, errLog);\n var errorStrings = errLog.split(\"\\n\");\n var errors = {};\n for (var i = 0; i < errorStrings.length; i++) {\n var errorString = errorStrings[i];\n if (errorString === \"\" || errorString === \"\\0\") continue;\n var lineNo = parseInt(errorString.split(\":\")[2]);\n if (isNaN(lineNo)) {\n throw new Error(sprintf(\"Could not parse error: %s\", errorString));\n }\n errors[lineNo] = errorString;\n }\n var lines = addLineNumbers(src).split(\"\\n\");\n for (var i = 0; i < lines.length; i++) {\n if (!errors[i + 3] && !errors[i + 2] && !errors[i + 1]) continue;\n var line = lines[i];\n longForm += line + \"\\n\";\n if (errors[i + 1]) {\n var e = errors[i + 1];\n e = e.substr(e.split(\":\", 3).join(\":\").length + 1).trim();\n longForm += sprintf(\"^^^ %s\\n\\n\", e);\n }\n }\n return {\n long: longForm.trim(),\n short: shortForm.trim()\n };\n }\n }\n ),\n /***/\n 7319: (\n /***/\n function(__unused_webpack_module, exports2, __webpack_require__2) {\n var glslify = __webpack_require__2(3236);\n var createShader = __webpack_require__2(9405);\n var vertSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nattribute vec3 position, nextPosition;\\nattribute float arcLength, lineWidth;\\nattribute vec4 color;\\n\\nuniform vec2 screenShape;\\nuniform float pixelRatio;\\nuniform mat4 model, view, projection;\\n\\nvarying vec4 fragColor;\\nvarying vec3 worldPosition;\\nvarying float pixelArcLength;\\n\\nvec4 project(vec3 p) {\\n return projection * (view * (model * vec4(p, 1.0)));\\n}\\n\\nvoid main() {\\n vec4 startPoint = project(position);\\n vec4 endPoint = project(nextPosition);\\n\\n vec2 A = startPoint.xy / startPoint.w;\\n vec2 B = endPoint.xy / endPoint.w;\\n\\n float clipAngle = atan(\\n (B.y - A.y) * screenShape.y,\\n (B.x - A.x) * screenShape.x\\n );\\n\\n vec2 offset = 0.5 * pixelRatio * lineWidth * vec2(\\n sin(clipAngle),\\n -cos(clipAngle)\\n ) / screenShape;\\n\\n gl_Position = vec4(startPoint.xy + startPoint.w * offset, startPoint.zw);\\n\\n worldPosition = position;\\n pixelArcLength = arcLength;\\n fragColor = color;\\n}\\n\"]);\n var forwardFrag = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nuniform vec3 clipBounds[2];\\nuniform sampler2D dashTexture;\\nuniform float dashScale;\\nuniform float opacity;\\n\\nvarying vec3 worldPosition;\\nvarying float pixelArcLength;\\nvarying vec4 fragColor;\\n\\nvoid main() {\\n if (\\n outOfRange(clipBounds[0], clipBounds[1], worldPosition) ||\\n fragColor.a * opacity == 0.\\n ) discard;\\n\\n float dashWeight = texture2D(dashTexture, vec2(dashScale * pixelArcLength, 0)).r;\\n if(dashWeight < 0.5) {\\n discard;\\n }\\n gl_FragColor = fragColor * opacity;\\n}\\n\"]);\n var pickFrag = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\n#define FLOAT_MAX 1.70141184e38\\n#define FLOAT_MIN 1.17549435e-38\\n\\n// https://github.com/mikolalysenko/glsl-read-float/blob/master/index.glsl\\nvec4 packFloat(float v) {\\n float av = abs(v);\\n\\n //Handle special cases\\n if(av < FLOAT_MIN) {\\n return vec4(0.0, 0.0, 0.0, 0.0);\\n } else if(v > FLOAT_MAX) {\\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\\n } else if(v < -FLOAT_MAX) {\\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\\n }\\n\\n vec4 c = vec4(0,0,0,0);\\n\\n //Compute exponent and mantissa\\n float e = floor(log2(av));\\n float m = av * pow(2.0, -e) - 1.0;\\n\\n //Unpack mantissa\\n c[1] = floor(128.0 * m);\\n m -= c[1] / 128.0;\\n c[2] = floor(32768.0 * m);\\n m -= c[2] / 32768.0;\\n c[3] = floor(8388608.0 * m);\\n\\n //Unpack exponent\\n float ebias = e + 127.0;\\n c[0] = floor(ebias / 2.0);\\n ebias -= c[0] * 2.0;\\n c[1] += floor(ebias) * 128.0;\\n\\n //Unpack sign bit\\n c[0] += 128.0 * step(0.0, -v);\\n\\n //Scale back to range\\n return c / 255.0;\\n}\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nuniform float pickId;\\nuniform vec3 clipBounds[2];\\n\\nvarying vec3 worldPosition;\\nvarying float pixelArcLength;\\nvarying vec4 fragColor;\\n\\nvoid main() {\\n if (outOfRange(clipBounds[0], clipBounds[1], worldPosition)) discard;\\n\\n gl_FragColor = vec4(pickId/255.0, packFloat(pixelArcLength).xyz);\\n}\"]);\n var ATTRIBUTES = [\n { name: \"position\", type: \"vec3\" },\n { name: \"nextPosition\", type: \"vec3\" },\n { name: \"arcLength\", type: \"float\" },\n { name: \"lineWidth\", type: \"float\" },\n { name: \"color\", type: \"vec4\" }\n ];\n exports2.createShader = function(gl2) {\n return createShader(gl2, vertSrc, forwardFrag, null, ATTRIBUTES);\n };\n exports2.createPickShader = function(gl2) {\n return createShader(gl2, vertSrc, pickFrag, null, ATTRIBUTES);\n };\n }\n ),\n /***/\n 5714: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = createLinePlot;\n var createBuffer = __webpack_require__2(2762);\n var createVAO = __webpack_require__2(8116);\n var createTexture = __webpack_require__2(7766);\n var UINT8_VIEW = new Uint8Array(4);\n var FLOAT_VIEW = new Float32Array(UINT8_VIEW.buffer);\n function unpackFloat(x, y, z, w) {\n UINT8_VIEW[0] = w;\n UINT8_VIEW[1] = z;\n UINT8_VIEW[2] = y;\n UINT8_VIEW[3] = x;\n return FLOAT_VIEW[0];\n }\n var bsearch = __webpack_require__2(2478);\n var ndarray = __webpack_require__2(9618);\n var shaders = __webpack_require__2(7319);\n var createShader = shaders.createShader;\n var createPickShader = shaders.createPickShader;\n var identity2 = [\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ];\n function distance(a, b) {\n var s = 0;\n for (var i = 0; i < 3; ++i) {\n var d = a[i] - b[i];\n s += d * d;\n }\n return Math.sqrt(s);\n }\n function filterClipBounds(bounds) {\n var result = [[-1e6, -1e6, -1e6], [1e6, 1e6, 1e6]];\n for (var i = 0; i < 3; ++i) {\n result[0][i] = Math.max(bounds[0][i], result[0][i]);\n result[1][i] = Math.min(bounds[1][i], result[1][i]);\n }\n return result;\n }\n function PickResult(tau, position, index, dataCoordinate) {\n this.arcLength = tau;\n this.position = position;\n this.index = index;\n this.dataCoordinate = dataCoordinate;\n }\n function LinePlot(gl2, shader, pickShader, buffer, vao, texture) {\n this.gl = gl2;\n this.shader = shader;\n this.pickShader = pickShader;\n this.buffer = buffer;\n this.vao = vao;\n this.clipBounds = [\n [-Infinity, -Infinity, -Infinity],\n [Infinity, Infinity, Infinity]\n ];\n this.points = [];\n this.arcLength = [];\n this.vertexCount = 0;\n this.bounds = [[0, 0, 0], [0, 0, 0]];\n this.pickId = 0;\n this.lineWidth = 1;\n this.texture = texture;\n this.dashScale = 1;\n this.opacity = 1;\n this.hasAlpha = false;\n this.dirty = true;\n this.pixelRatio = 1;\n }\n var proto = LinePlot.prototype;\n proto.isTransparent = function() {\n return this.hasAlpha;\n };\n proto.isOpaque = function() {\n return !this.hasAlpha;\n };\n proto.pickSlots = 1;\n proto.setPickBase = function(id) {\n this.pickId = id;\n };\n proto.drawTransparent = proto.draw = function(camera) {\n if (!this.vertexCount) return;\n var gl2 = this.gl;\n var shader = this.shader;\n var vao = this.vao;\n shader.bind();\n shader.uniforms = {\n model: camera.model || identity2,\n view: camera.view || identity2,\n projection: camera.projection || identity2,\n clipBounds: filterClipBounds(this.clipBounds),\n dashTexture: this.texture.bind(),\n dashScale: this.dashScale / this.arcLength[this.arcLength.length - 1],\n opacity: this.opacity,\n screenShape: [gl2.drawingBufferWidth, gl2.drawingBufferHeight],\n pixelRatio: this.pixelRatio\n };\n vao.bind();\n vao.draw(gl2.TRIANGLE_STRIP, this.vertexCount);\n vao.unbind();\n };\n proto.drawPick = function(camera) {\n if (!this.vertexCount) return;\n var gl2 = this.gl;\n var shader = this.pickShader;\n var vao = this.vao;\n shader.bind();\n shader.uniforms = {\n model: camera.model || identity2,\n view: camera.view || identity2,\n projection: camera.projection || identity2,\n pickId: this.pickId,\n clipBounds: filterClipBounds(this.clipBounds),\n screenShape: [gl2.drawingBufferWidth, gl2.drawingBufferHeight],\n pixelRatio: this.pixelRatio\n };\n vao.bind();\n vao.draw(gl2.TRIANGLE_STRIP, this.vertexCount);\n vao.unbind();\n };\n proto.update = function(options) {\n var i, j;\n this.dirty = true;\n var connectGaps = !!options.connectGaps;\n if (\"dashScale\" in options) {\n this.dashScale = options.dashScale;\n }\n this.hasAlpha = false;\n if (\"opacity\" in options) {\n this.opacity = +options.opacity;\n if (this.opacity < 1) {\n this.hasAlpha = true;\n }\n }\n var buffer = [];\n var arcLengthArray = [];\n var pointArray = [];\n var arcLength = 0;\n var vertexCount = 0;\n var bounds = [\n [Infinity, Infinity, Infinity],\n [-Infinity, -Infinity, -Infinity]\n ];\n var positions = options.position || options.positions;\n if (positions) {\n var colors = options.color || options.colors || [0, 0, 0, 1];\n var lineWidth = options.lineWidth || 1;\n var hadGap = false;\n fill_loop:\n for (i = 1; i < positions.length; ++i) {\n var a = positions[i - 1];\n var b = positions[i];\n arcLengthArray.push(arcLength);\n pointArray.push(a.slice());\n for (j = 0; j < 3; ++j) {\n if (isNaN(a[j]) || isNaN(b[j]) || !isFinite(a[j]) || !isFinite(b[j])) {\n if (!connectGaps && buffer.length > 0) {\n for (var k = 0; k < 24; ++k) {\n buffer.push(buffer[buffer.length - 12]);\n }\n vertexCount += 2;\n hadGap = true;\n }\n continue fill_loop;\n }\n bounds[0][j] = Math.min(bounds[0][j], a[j], b[j]);\n bounds[1][j] = Math.max(bounds[1][j], a[j], b[j]);\n }\n var acolor, bcolor;\n if (Array.isArray(colors[0])) {\n acolor = colors.length > i - 1 ? colors[i - 1] : (\n // using index value\n colors.length > 0 ? colors[colors.length - 1] : (\n // using last item\n [0, 0, 0, 1]\n )\n );\n bcolor = colors.length > i ? colors[i] : (\n // using index value\n colors.length > 0 ? colors[colors.length - 1] : (\n // using last item\n [0, 0, 0, 1]\n )\n );\n } else {\n acolor = bcolor = colors;\n }\n if (acolor.length === 3) {\n acolor = [acolor[0], acolor[1], acolor[2], 1];\n }\n if (bcolor.length === 3) {\n bcolor = [bcolor[0], bcolor[1], bcolor[2], 1];\n }\n if (!this.hasAlpha && acolor[3] < 1) this.hasAlpha = true;\n var w0;\n if (Array.isArray(lineWidth)) {\n w0 = lineWidth.length > i - 1 ? lineWidth[i - 1] : (\n // using index value\n lineWidth.length > 0 ? lineWidth[lineWidth.length - 1] : (\n // using last item\n [0, 0, 0, 1]\n )\n );\n } else {\n w0 = lineWidth;\n }\n var t02 = arcLength;\n arcLength += distance(a, b);\n if (hadGap) {\n for (j = 0; j < 2; ++j) {\n buffer.push(\n a[0],\n a[1],\n a[2],\n b[0],\n b[1],\n b[2],\n t02,\n w0,\n acolor[0],\n acolor[1],\n acolor[2],\n acolor[3]\n );\n }\n vertexCount += 2;\n hadGap = false;\n }\n buffer.push(\n a[0],\n a[1],\n a[2],\n b[0],\n b[1],\n b[2],\n t02,\n w0,\n acolor[0],\n acolor[1],\n acolor[2],\n acolor[3],\n a[0],\n a[1],\n a[2],\n b[0],\n b[1],\n b[2],\n t02,\n -w0,\n acolor[0],\n acolor[1],\n acolor[2],\n acolor[3],\n b[0],\n b[1],\n b[2],\n a[0],\n a[1],\n a[2],\n arcLength,\n -w0,\n bcolor[0],\n bcolor[1],\n bcolor[2],\n bcolor[3],\n b[0],\n b[1],\n b[2],\n a[0],\n a[1],\n a[2],\n arcLength,\n w0,\n bcolor[0],\n bcolor[1],\n bcolor[2],\n bcolor[3]\n );\n vertexCount += 4;\n }\n }\n this.buffer.update(buffer);\n arcLengthArray.push(arcLength);\n pointArray.push(positions[positions.length - 1].slice());\n this.bounds = bounds;\n this.vertexCount = vertexCount;\n this.points = pointArray;\n this.arcLength = arcLengthArray;\n if (\"dashes\" in options) {\n var dashArray = options.dashes;\n var prefixSum = dashArray.slice();\n prefixSum.unshift(0);\n for (i = 1; i < prefixSum.length; ++i) {\n prefixSum[i] = prefixSum[i - 1] + prefixSum[i];\n }\n var dashTexture = ndarray(new Array(256 * 4), [256, 1, 4]);\n for (i = 0; i < 256; ++i) {\n for (j = 0; j < 4; ++j) {\n dashTexture.set(i, 0, j, 0);\n }\n if (bsearch.le(prefixSum, prefixSum[prefixSum.length - 1] * i / 255) & 1) {\n dashTexture.set(i, 0, 0, 0);\n } else {\n dashTexture.set(i, 0, 0, 255);\n }\n }\n this.texture.setPixels(dashTexture);\n }\n };\n proto.dispose = function() {\n this.shader.dispose();\n this.vao.dispose();\n this.buffer.dispose();\n };\n proto.pick = function(selection) {\n if (!selection) {\n return null;\n }\n if (selection.id !== this.pickId) {\n return null;\n }\n var tau = unpackFloat(\n selection.value[0],\n selection.value[1],\n selection.value[2],\n 0\n );\n var index = bsearch.le(this.arcLength, tau);\n if (index < 0) {\n return null;\n }\n if (index === this.arcLength.length - 1) {\n return new PickResult(\n this.arcLength[this.arcLength.length - 1],\n this.points[this.points.length - 1].slice(),\n index\n );\n }\n var a = this.points[index];\n var b = this.points[Math.min(index + 1, this.points.length - 1)];\n var t = (tau - this.arcLength[index]) / (this.arcLength[index + 1] - this.arcLength[index]);\n var ti = 1 - t;\n var x = [0, 0, 0];\n for (var i = 0; i < 3; ++i) {\n x[i] = ti * a[i] + t * b[i];\n }\n var dataIndex = Math.min(t < 0.5 ? index : index + 1, this.points.length - 1);\n return new PickResult(\n tau,\n x,\n dataIndex,\n this.points[dataIndex]\n );\n };\n function createLinePlot(options) {\n var gl2 = options.gl || options.scene && options.scene.gl;\n var shader = createShader(gl2);\n shader.attributes.position.location = 0;\n shader.attributes.nextPosition.location = 1;\n shader.attributes.arcLength.location = 2;\n shader.attributes.lineWidth.location = 3;\n shader.attributes.color.location = 4;\n var pickShader = createPickShader(gl2);\n pickShader.attributes.position.location = 0;\n pickShader.attributes.nextPosition.location = 1;\n pickShader.attributes.arcLength.location = 2;\n pickShader.attributes.lineWidth.location = 3;\n pickShader.attributes.color.location = 4;\n var buffer = createBuffer(gl2);\n var vao = createVAO(gl2, [\n {\n \"buffer\": buffer,\n \"size\": 3,\n \"offset\": 0,\n \"stride\": 48\n },\n {\n \"buffer\": buffer,\n \"size\": 3,\n \"offset\": 12,\n \"stride\": 48\n },\n {\n \"buffer\": buffer,\n \"size\": 1,\n \"offset\": 24,\n \"stride\": 48\n },\n {\n \"buffer\": buffer,\n \"size\": 1,\n \"offset\": 28,\n \"stride\": 48\n },\n {\n \"buffer\": buffer,\n \"size\": 4,\n \"offset\": 32,\n \"stride\": 48\n }\n ]);\n var defaultTexture = ndarray(new Array(256 * 4), [256, 1, 4]);\n for (var i = 0; i < 256 * 4; ++i) {\n defaultTexture.data[i] = 255;\n }\n var texture = createTexture(gl2, defaultTexture);\n texture.wrap = gl2.REPEAT;\n var linePlot = new LinePlot(gl2, shader, pickShader, buffer, vao, texture);\n linePlot.update(options);\n return linePlot;\n }\n }\n ),\n /***/\n 1903: (\n /***/\n function(module2) {\n module2.exports = clone;\n function clone(a) {\n var out = new Float32Array(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n }\n ;\n }\n ),\n /***/\n 6864: (\n /***/\n function(module2) {\n module2.exports = create;\n function create() {\n var out = new Float32Array(16);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n ;\n }\n ),\n /***/\n 9921: (\n /***/\n function(module2) {\n module2.exports = determinant;\n function determinant(a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], b00 = a00 * a11 - a01 * a10, b01 = a00 * a12 - a02 * a10, b02 = a00 * a13 - a03 * a10, b03 = a01 * a12 - a02 * a11, b04 = a01 * a13 - a03 * a11, b05 = a02 * a13 - a03 * a12, b06 = a20 * a31 - a21 * a30, b07 = a20 * a32 - a22 * a30, b08 = a20 * a33 - a23 * a30, b09 = a21 * a32 - a22 * a31, b10 = a21 * a33 - a23 * a31, b11 = a22 * a33 - a23 * a32;\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n }\n ;\n }\n ),\n /***/\n 7399: (\n /***/\n function(module2) {\n module2.exports = fromQuat;\n function fromQuat(out, q) {\n var x = q[0], y = q[1], z = q[2], w = q[3], x2 = x + x, y2 = y + y, z2 = z + z, xx = x * x2, yx = y * x2, yy = y * y2, zx = z * x2, zy = z * y2, zz = z * z2, wx = w * x2, wy = w * y2, wz = w * z2;\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n ;\n }\n ),\n /***/\n 6743: (\n /***/\n function(module2) {\n module2.exports = fromRotationTranslation;\n function fromRotationTranslation(out, q, v) {\n var x = q[0], y = q[1], z = q[2], w = q[3], x2 = x + x, y2 = y + y, z2 = z + z, xx = x * x2, xy = x * y2, xz = x * z2, yy = y * y2, yz = y * z2, zz = z * z2, wx = w * x2, wy = w * y2, wz = w * z2;\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n }\n ;\n }\n ),\n /***/\n 7894: (\n /***/\n function(module2) {\n module2.exports = identity2;\n function identity2(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n ;\n }\n ),\n /***/\n 7608: (\n /***/\n function(module2) {\n module2.exports = invert;\n function invert(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], b00 = a00 * a11 - a01 * a10, b01 = a00 * a12 - a02 * a10, b02 = a00 * a13 - a03 * a10, b03 = a01 * a12 - a02 * a11, b04 = a01 * a13 - a03 * a11, b05 = a02 * a13 - a03 * a12, b06 = a20 * a31 - a21 * a30, b07 = a20 * a32 - a22 * a30, b08 = a20 * a33 - a23 * a30, b09 = a21 * a32 - a22 * a31, b10 = a21 * a33 - a23 * a31, b11 = a22 * a33 - a23 * a32, det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n if (!det) {\n return null;\n }\n det = 1 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n }\n ;\n }\n ),\n /***/\n 6582: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n var identity2 = __webpack_require__2(7894);\n module2.exports = lookAt;\n function lookAt(out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len, eyex = eye[0], eyey = eye[1], eyez = eye[2], upx = up[0], upy = up[1], upz = up[2], centerx = center[0], centery = center[1], centerz = center[2];\n if (Math.abs(eyex - centerx) < 1e-6 && Math.abs(eyey - centery) < 1e-6 && Math.abs(eyez - centerz) < 1e-6) {\n return identity2(out);\n }\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n }\n ;\n }\n ),\n /***/\n 6760: (\n /***/\n function(module2) {\n module2.exports = multiply;\n function multiply(out, a, b) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n }\n ;\n }\n ),\n /***/\n 4040: (\n /***/\n function(module2) {\n module2.exports = ortho;\n function ortho(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right), bt = 1 / (bottom - top), nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n }\n ;\n }\n ),\n /***/\n 4772: (\n /***/\n function(module2) {\n module2.exports = perspective;\n function perspective(out, fovy, aspect, near, far) {\n var f = 1 / Math.tan(fovy / 2), nf = 1 / (near - far);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = 2 * far * near * nf;\n out[15] = 0;\n return out;\n }\n ;\n }\n ),\n /***/\n 6079: (\n /***/\n function(module2) {\n module2.exports = rotate;\n function rotate(out, a, rad, axis) {\n var x = axis[0], y = axis[1], z = axis[2], len = Math.sqrt(x * x + y * y + z * z), s, c, t, a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23, b00, b01, b02, b10, b11, b12, b20, b21, b22;\n if (Math.abs(len) < 1e-6) {\n return null;\n }\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n b00 = x * x * t + c;\n b01 = y * x * t + z * s;\n b02 = z * x * t - y * s;\n b10 = x * y * t - z * s;\n b11 = y * y * t + c;\n b12 = z * y * t + x * s;\n b20 = x * z * t + y * s;\n b21 = y * z * t - x * s;\n b22 = z * z * t + c;\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n if (a !== out) {\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n return out;\n }\n ;\n }\n ),\n /***/\n 5567: (\n /***/\n function(module2) {\n module2.exports = rotateX;\n function rotateX(out, a, rad) {\n var s = Math.sin(rad), c = Math.cos(rad), a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];\n if (a !== out) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n }\n ;\n }\n ),\n /***/\n 2408: (\n /***/\n function(module2) {\n module2.exports = rotateY;\n function rotateY(out, a, rad) {\n var s = Math.sin(rad), c = Math.cos(rad), a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];\n if (a !== out) {\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n }\n ;\n }\n ),\n /***/\n 7089: (\n /***/\n function(module2) {\n module2.exports = rotateZ;\n function rotateZ(out, a, rad) {\n var s = Math.sin(rad), c = Math.cos(rad), a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];\n if (a !== out) {\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n }\n ;\n }\n ),\n /***/\n 2504: (\n /***/\n function(module2) {\n module2.exports = scale;\n function scale(out, a, v) {\n var x = v[0], y = v[1], z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n }\n ;\n }\n ),\n /***/\n 7656: (\n /***/\n function(module2) {\n module2.exports = translate;\n function translate(out, a, v) {\n var x = v[0], y = v[1], z = v[2], a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23;\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n return out;\n }\n ;\n }\n ),\n /***/\n 5665: (\n /***/\n function(module2) {\n module2.exports = transpose;\n function transpose(out, a) {\n if (out === a) {\n var a01 = a[1], a02 = a[2], a03 = a[3], a12 = a[6], a13 = a[7], a23 = a[11];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n return out;\n }\n ;\n }\n ),\n /***/\n 7626: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var barycentric = __webpack_require__2(2642);\n var closestPointToTriangle = __webpack_require__2(9346);\n module2.exports = closestPointToPickLocation;\n function xformMatrix(m, v) {\n var out = [0, 0, 0, 0];\n for (var i = 0; i < 4; ++i) {\n for (var j = 0; j < 4; ++j) {\n out[j] += m[4 * i + j] * v[i];\n }\n }\n return out;\n }\n function projectVertex(v, model, view, projection, resolution) {\n var p = xformMatrix(\n projection,\n xformMatrix(\n view,\n xformMatrix(model, [v[0], v[1], v[2], 1])\n )\n );\n for (var i = 0; i < 3; ++i) {\n p[i] /= p[3];\n }\n return [0.5 * resolution[0] * (1 + p[0]), 0.5 * resolution[1] * (1 - p[1])];\n }\n function barycentricCoord(simplex, point) {\n if (simplex.length === 2) {\n var d0 = 0;\n var d1 = 0;\n for (var i = 0; i < 2; ++i) {\n d0 += Math.pow(point[i] - simplex[0][i], 2);\n d1 += Math.pow(point[i] - simplex[1][i], 2);\n }\n d0 = Math.sqrt(d0);\n d1 = Math.sqrt(d1);\n if (d0 + d1 < 1e-6) {\n return [1, 0];\n }\n return [d1 / (d0 + d1), d0 / (d1 + d0)];\n } else if (simplex.length === 3) {\n var closestPoint = [0, 0];\n closestPointToTriangle(simplex[0], simplex[1], simplex[2], point, closestPoint);\n return barycentric(simplex, closestPoint);\n }\n return [];\n }\n function interpolate(simplex, weights) {\n var result = [0, 0, 0];\n for (var i = 0; i < simplex.length; ++i) {\n var p = simplex[i];\n var w = weights[i];\n for (var j = 0; j < 3; ++j) {\n result[j] += w * p[j];\n }\n }\n return result;\n }\n function closestPointToPickLocation(simplex, pixelCoord, model, view, projection, resolution) {\n if (simplex.length === 1) {\n return [0, simplex[0].slice()];\n }\n var simplex2D = new Array(simplex.length);\n for (var i = 0; i < simplex.length; ++i) {\n simplex2D[i] = projectVertex(simplex[i], model, view, projection, resolution);\n }\n var closestIndex = 0;\n var closestDist = Infinity;\n for (var i = 0; i < simplex2D.length; ++i) {\n var d2 = 0;\n for (var j = 0; j < 2; ++j) {\n d2 += Math.pow(simplex2D[i][j] - pixelCoord[j], 2);\n }\n if (d2 < closestDist) {\n closestDist = d2;\n closestIndex = i;\n }\n }\n var weights = barycentricCoord(simplex2D, pixelCoord);\n var s = 0;\n for (var i = 0; i < 3; ++i) {\n if (weights[i] < -1e-3 || weights[i] > 1.0001) {\n return null;\n }\n s += weights[i];\n }\n if (Math.abs(s - 1) > 1e-3) {\n return null;\n }\n return [closestIndex, interpolate(simplex, weights), weights];\n }\n }\n ),\n /***/\n 840: (\n /***/\n function(__unused_webpack_module, exports2, __webpack_require__2) {\n var glslify = __webpack_require__2(3236);\n var triVertSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nattribute vec3 position, normal;\\nattribute vec4 color;\\nattribute vec2 uv;\\n\\nuniform mat4 model\\n , view\\n , projection\\n , inverseModel;\\nuniform vec3 eyePosition\\n , lightPosition;\\n\\nvarying vec3 f_normal\\n , f_lightDirection\\n , f_eyeDirection\\n , f_data;\\nvarying vec4 f_color;\\nvarying vec2 f_uv;\\n\\nvec4 project(vec3 p) {\\n return projection * (view * (model * vec4(p, 1.0)));\\n}\\n\\nvoid main() {\\n gl_Position = project(position);\\n\\n //Lighting geometry parameters\\n vec4 cameraCoordinate = view * vec4(position , 1.0);\\n cameraCoordinate.xyz /= cameraCoordinate.w;\\n f_lightDirection = lightPosition - cameraCoordinate.xyz;\\n f_eyeDirection = eyePosition - cameraCoordinate.xyz;\\n f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz);\\n\\n f_color = color;\\n f_data = position;\\n f_uv = uv;\\n}\\n\"]);\n var triFragSrc = glslify([\"#extension GL_OES_standard_derivatives : enable\\n\\nprecision highp float;\\n#define GLSLIFY 1\\n\\nfloat beckmannDistribution(float x, float roughness) {\\n float NdotH = max(x, 0.0001);\\n float cos2Alpha = NdotH * NdotH;\\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\\n float roughness2 = roughness * roughness;\\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\\n return exp(tan2Alpha / roughness2) / denom;\\n}\\n\\nfloat cookTorranceSpecular(\\n vec3 lightDirection,\\n vec3 viewDirection,\\n vec3 surfaceNormal,\\n float roughness,\\n float fresnel) {\\n\\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\\n\\n //Half angle vector\\n vec3 H = normalize(lightDirection + viewDirection);\\n\\n //Geometric term\\n float NdotH = max(dot(surfaceNormal, H), 0.0);\\n float VdotH = max(dot(viewDirection, H), 0.000001);\\n float LdotH = max(dot(lightDirection, H), 0.000001);\\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\\n float G = min(1.0, min(G1, G2));\\n \\n //Distribution term\\n float D = beckmannDistribution(NdotH, roughness);\\n\\n //Fresnel term\\n float F = pow(1.0 - VdotN, fresnel);\\n\\n //Multiply terms and done\\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\\n}\\n\\n//#pragma glslify: beckmann = require(glsl-specular-beckmann) // used in gl-surface3d\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nuniform vec3 clipBounds[2];\\nuniform float roughness\\n , fresnel\\n , kambient\\n , kdiffuse\\n , kspecular;\\nuniform sampler2D texture;\\n\\nvarying vec3 f_normal\\n , f_lightDirection\\n , f_eyeDirection\\n , f_data;\\nvarying vec4 f_color;\\nvarying vec2 f_uv;\\n\\nvoid main() {\\n if (f_color.a == 0.0 ||\\n outOfRange(clipBounds[0], clipBounds[1], f_data)\\n ) discard;\\n\\n vec3 N = normalize(f_normal);\\n vec3 L = normalize(f_lightDirection);\\n vec3 V = normalize(f_eyeDirection);\\n\\n if(gl_FrontFacing) {\\n N = -N;\\n }\\n\\n float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));\\n //float specular = max(0.0, beckmann(L, V, N, roughness)); // used in gl-surface3d\\n\\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\\n\\n vec4 surfaceColor = vec4(f_color.rgb, 1.0) * texture2D(texture, f_uv);\\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\\n\\n gl_FragColor = litColor * f_color.a;\\n}\\n\"]);\n var edgeVertSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nattribute vec3 position;\\nattribute vec4 color;\\nattribute vec2 uv;\\n\\nuniform mat4 model, view, projection;\\n\\nvarying vec4 f_color;\\nvarying vec3 f_data;\\nvarying vec2 f_uv;\\n\\nvoid main() {\\n gl_Position = projection * (view * (model * vec4(position, 1.0)));\\n f_color = color;\\n f_data = position;\\n f_uv = uv;\\n}\"]);\n var edgeFragSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nuniform vec3 clipBounds[2];\\nuniform sampler2D texture;\\nuniform float opacity;\\n\\nvarying vec4 f_color;\\nvarying vec3 f_data;\\nvarying vec2 f_uv;\\n\\nvoid main() {\\n if (outOfRange(clipBounds[0], clipBounds[1], f_data)) discard;\\n\\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\\n}\"]);\n var pointVertSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nattribute vec3 position;\\nattribute vec4 color;\\nattribute vec2 uv;\\nattribute float pointSize;\\n\\nuniform mat4 model, view, projection;\\nuniform vec3 clipBounds[2];\\n\\nvarying vec4 f_color;\\nvarying vec2 f_uv;\\n\\nvoid main() {\\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\\n\\n gl_Position = vec4(0.0, 0.0 ,0.0 ,0.0);\\n } else {\\n gl_Position = projection * (view * (model * vec4(position, 1.0)));\\n }\\n gl_PointSize = pointSize;\\n f_color = color;\\n f_uv = uv;\\n}\"]);\n var pointFragSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nuniform sampler2D texture;\\nuniform float opacity;\\n\\nvarying vec4 f_color;\\nvarying vec2 f_uv;\\n\\nvoid main() {\\n vec2 pointR = gl_PointCoord.xy - vec2(0.5, 0.5);\\n if(dot(pointR, pointR) > 0.25) {\\n discard;\\n }\\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\\n}\"]);\n var pickVertSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nattribute vec3 position;\\nattribute vec4 id;\\n\\nuniform mat4 model, view, projection;\\n\\nvarying vec3 f_position;\\nvarying vec4 f_id;\\n\\nvoid main() {\\n gl_Position = projection * (view * (model * vec4(position, 1.0)));\\n f_id = id;\\n f_position = position;\\n}\"]);\n var pickFragSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nuniform vec3 clipBounds[2];\\nuniform float pickId;\\n\\nvarying vec3 f_position;\\nvarying vec4 f_id;\\n\\nvoid main() {\\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\\n\\n gl_FragColor = vec4(pickId, f_id.xyz);\\n}\"]);\n var pickPointVertSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nattribute vec3 position;\\nattribute float pointSize;\\nattribute vec4 id;\\n\\nuniform mat4 model, view, projection;\\nuniform vec3 clipBounds[2];\\n\\nvarying vec3 f_position;\\nvarying vec4 f_id;\\n\\nvoid main() {\\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\\n\\n gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\\n } else {\\n gl_Position = projection * (view * (model * vec4(position, 1.0)));\\n gl_PointSize = pointSize;\\n }\\n f_id = id;\\n f_position = position;\\n}\"]);\n var contourVertSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nattribute vec3 position;\\n\\nuniform mat4 model, view, projection;\\n\\nvoid main() {\\n gl_Position = projection * (view * (model * vec4(position, 1.0)));\\n}\"]);\n var contourFragSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nuniform vec3 contourColor;\\n\\nvoid main() {\\n gl_FragColor = vec4(contourColor, 1.0);\\n}\\n\"]);\n exports2.meshShader = {\n vertex: triVertSrc,\n fragment: triFragSrc,\n attributes: [\n { name: \"position\", type: \"vec3\" },\n { name: \"normal\", type: \"vec3\" },\n { name: \"color\", type: \"vec4\" },\n { name: \"uv\", type: \"vec2\" }\n ]\n };\n exports2.wireShader = {\n vertex: edgeVertSrc,\n fragment: edgeFragSrc,\n attributes: [\n { name: \"position\", type: \"vec3\" },\n { name: \"color\", type: \"vec4\" },\n { name: \"uv\", type: \"vec2\" }\n ]\n };\n exports2.pointShader = {\n vertex: pointVertSrc,\n fragment: pointFragSrc,\n attributes: [\n { name: \"position\", type: \"vec3\" },\n { name: \"color\", type: \"vec4\" },\n { name: \"uv\", type: \"vec2\" },\n { name: \"pointSize\", type: \"float\" }\n ]\n };\n exports2.pickShader = {\n vertex: pickVertSrc,\n fragment: pickFragSrc,\n attributes: [\n { name: \"position\", type: \"vec3\" },\n { name: \"id\", type: \"vec4\" }\n ]\n };\n exports2.pointPickShader = {\n vertex: pickPointVertSrc,\n fragment: pickFragSrc,\n attributes: [\n { name: \"position\", type: \"vec3\" },\n { name: \"pointSize\", type: \"float\" },\n { name: \"id\", type: \"vec4\" }\n ]\n };\n exports2.contourShader = {\n vertex: contourVertSrc,\n fragment: contourFragSrc,\n attributes: [\n { name: \"position\", type: \"vec3\" }\n ]\n };\n }\n ),\n /***/\n 7201: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var DEFAULT_VERTEX_NORMALS_EPSILON = 1e-6;\n var DEFAULT_FACE_NORMALS_EPSILON = 1e-6;\n var createShader = __webpack_require__2(9405);\n var createBuffer = __webpack_require__2(2762);\n var createVAO = __webpack_require__2(8116);\n var createTexture = __webpack_require__2(7766);\n var normals = __webpack_require__2(8406);\n var multiply = __webpack_require__2(6760);\n var invert = __webpack_require__2(7608);\n var ndarray = __webpack_require__2(9618);\n var colormap = __webpack_require__2(6729);\n var getContour = __webpack_require__2(7765);\n var pool = __webpack_require__2(1888);\n var shaders = __webpack_require__2(840);\n var closestPoint = __webpack_require__2(7626);\n var meshShader = shaders.meshShader;\n var wireShader = shaders.wireShader;\n var pointShader = shaders.pointShader;\n var pickShader = shaders.pickShader;\n var pointPickShader = shaders.pointPickShader;\n var contourShader = shaders.contourShader;\n var IDENTITY = [\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ];\n function SimplicialMesh(gl2, texture, triShader, lineShader, pointShader2, pickShader2, pointPickShader2, contourShader2, trianglePositions, triangleIds, triangleColors, triangleUVs, triangleNormals, triangleVAO, edgePositions, edgeIds, edgeColors, edgeUVs, edgeVAO, pointPositions, pointIds, pointColors, pointUVs, pointSizes, pointVAO, contourPositions, contourVAO) {\n this.gl = gl2;\n this.pixelRatio = 1;\n this.cells = [];\n this.positions = [];\n this.intensity = [];\n this.texture = texture;\n this.dirty = true;\n this.triShader = triShader;\n this.lineShader = lineShader;\n this.pointShader = pointShader2;\n this.pickShader = pickShader2;\n this.pointPickShader = pointPickShader2;\n this.contourShader = contourShader2;\n this.trianglePositions = trianglePositions;\n this.triangleColors = triangleColors;\n this.triangleNormals = triangleNormals;\n this.triangleUVs = triangleUVs;\n this.triangleIds = triangleIds;\n this.triangleVAO = triangleVAO;\n this.triangleCount = 0;\n this.lineWidth = 1;\n this.edgePositions = edgePositions;\n this.edgeColors = edgeColors;\n this.edgeUVs = edgeUVs;\n this.edgeIds = edgeIds;\n this.edgeVAO = edgeVAO;\n this.edgeCount = 0;\n this.pointPositions = pointPositions;\n this.pointColors = pointColors;\n this.pointUVs = pointUVs;\n this.pointSizes = pointSizes;\n this.pointIds = pointIds;\n this.pointVAO = pointVAO;\n this.pointCount = 0;\n this.contourLineWidth = 1;\n this.contourPositions = contourPositions;\n this.contourVAO = contourVAO;\n this.contourCount = 0;\n this.contourColor = [0, 0, 0];\n this.contourEnable = true;\n this.pickVertex = true;\n this.pickId = 1;\n this.bounds = [\n [Infinity, Infinity, Infinity],\n [-Infinity, -Infinity, -Infinity]\n ];\n this.clipBounds = [\n [-Infinity, -Infinity, -Infinity],\n [Infinity, Infinity, Infinity]\n ];\n this.lightPosition = [1e5, 1e5, 0];\n this.ambientLight = 0.8;\n this.diffuseLight = 0.8;\n this.specularLight = 2;\n this.roughness = 0.5;\n this.fresnel = 1.5;\n this.opacity = 1;\n this.hasAlpha = false;\n this.opacityscale = false;\n this._model = IDENTITY;\n this._view = IDENTITY;\n this._projection = IDENTITY;\n this._resolution = [1, 1];\n }\n var proto = SimplicialMesh.prototype;\n proto.isOpaque = function() {\n return !this.hasAlpha;\n };\n proto.isTransparent = function() {\n return this.hasAlpha;\n };\n proto.pickSlots = 1;\n proto.setPickBase = function(id) {\n this.pickId = id;\n };\n function getOpacityFromScale(ratio, opacityscale) {\n if (!opacityscale) return 1;\n if (!opacityscale.length) return 1;\n for (var i = 0; i < opacityscale.length; ++i) {\n if (opacityscale.length < 2) return 1;\n if (opacityscale[i][0] === ratio) return opacityscale[i][1];\n if (opacityscale[i][0] > ratio && i > 0) {\n var d = (opacityscale[i][0] - ratio) / (opacityscale[i][0] - opacityscale[i - 1][0]);\n return opacityscale[i][1] * (1 - d) + d * opacityscale[i - 1][1];\n }\n }\n return 1;\n }\n function genColormap(param, opacityscale) {\n var colors = colormap({\n colormap: param,\n nshades: 256,\n format: \"rgba\"\n });\n var result = new Uint8Array(256 * 4);\n for (var i = 0; i < 256; ++i) {\n var c = colors[i];\n for (var j = 0; j < 3; ++j) {\n result[4 * i + j] = c[j];\n }\n if (!opacityscale) {\n result[4 * i + 3] = 255 * c[3];\n } else {\n result[4 * i + 3] = 255 * getOpacityFromScale(i / 255, opacityscale);\n }\n }\n return ndarray(result, [256, 256, 4], [4, 0, 1]);\n }\n function takeZComponent(array) {\n var n = array.length;\n var result = new Array(n);\n for (var i = 0; i < n; ++i) {\n result[i] = array[i][2];\n }\n return result;\n }\n proto.highlight = function(selection) {\n if (!selection || !this.contourEnable) {\n this.contourCount = 0;\n return;\n }\n var level = getContour(this.cells, this.intensity, selection.intensity);\n var cells = level.cells;\n var vertexIds = level.vertexIds;\n var vertexWeights = level.vertexWeights;\n var numCells = cells.length;\n var result = pool.mallocFloat32(2 * 3 * numCells);\n var ptr = 0;\n for (var i = 0; i < numCells; ++i) {\n var c = cells[i];\n for (var j = 0; j < 2; ++j) {\n var v = c[0];\n if (c.length === 2) {\n v = c[j];\n }\n var a = vertexIds[v][0];\n var b = vertexIds[v][1];\n var w = vertexWeights[v];\n var wi = 1 - w;\n var pa = this.positions[a];\n var pb = this.positions[b];\n for (var k = 0; k < 3; ++k) {\n result[ptr++] = w * pa[k] + wi * pb[k];\n }\n }\n }\n this.contourCount = ptr / 3 | 0;\n this.contourPositions.update(result.subarray(0, ptr));\n pool.free(result);\n };\n proto.update = function(params) {\n params = params || {};\n var gl2 = this.gl;\n this.dirty = true;\n if (\"contourEnable\" in params) {\n this.contourEnable = params.contourEnable;\n }\n if (\"contourColor\" in params) {\n this.contourColor = params.contourColor;\n }\n if (\"lineWidth\" in params) {\n this.lineWidth = params.lineWidth;\n }\n if (\"lightPosition\" in params) {\n this.lightPosition = params.lightPosition;\n }\n this.hasAlpha = false;\n if (\"opacity\" in params) {\n this.opacity = params.opacity;\n if (this.opacity < 1) {\n this.hasAlpha = true;\n }\n }\n if (\"opacityscale\" in params) {\n this.opacityscale = params.opacityscale;\n this.hasAlpha = true;\n }\n if (\"ambient\" in params) {\n this.ambientLight = params.ambient;\n }\n if (\"diffuse\" in params) {\n this.diffuseLight = params.diffuse;\n }\n if (\"specular\" in params) {\n this.specularLight = params.specular;\n }\n if (\"roughness\" in params) {\n this.roughness = params.roughness;\n }\n if (\"fresnel\" in params) {\n this.fresnel = params.fresnel;\n }\n if (params.texture) {\n this.texture.dispose();\n this.texture = createTexture(gl2, params.texture);\n } else if (params.colormap) {\n this.texture.shape = [256, 256];\n this.texture.minFilter = gl2.LINEAR_MIPMAP_LINEAR;\n this.texture.magFilter = gl2.LINEAR;\n this.texture.setPixels(genColormap(params.colormap, this.opacityscale));\n this.texture.generateMipmap();\n }\n var cells = params.cells;\n var positions = params.positions;\n if (!positions || !cells) {\n return;\n }\n var tPos = [];\n var tCol = [];\n var tNor = [];\n var tUVs = [];\n var tIds = [];\n var ePos = [];\n var eCol = [];\n var eUVs = [];\n var eIds = [];\n var pPos = [];\n var pCol = [];\n var pUVs = [];\n var pSiz = [];\n var pIds = [];\n this.cells = cells;\n this.positions = positions;\n var vertexNormals = params.vertexNormals;\n var cellNormals = params.cellNormals;\n var vertexNormalsEpsilon = params.vertexNormalsEpsilon === void 0 ? DEFAULT_VERTEX_NORMALS_EPSILON : params.vertexNormalsEpsilon;\n var faceNormalsEpsilon = params.faceNormalsEpsilon === void 0 ? DEFAULT_FACE_NORMALS_EPSILON : params.faceNormalsEpsilon;\n if (params.useFacetNormals && !cellNormals) {\n cellNormals = normals.faceNormals(cells, positions, faceNormalsEpsilon);\n }\n if (!cellNormals && !vertexNormals) {\n vertexNormals = normals.vertexNormals(cells, positions, vertexNormalsEpsilon);\n }\n var vertexColors = params.vertexColors;\n var cellColors = params.cellColors;\n var meshColor = params.meshColor || [1, 1, 1, 1];\n var vertexUVs = params.vertexUVs;\n var vertexIntensity = params.vertexIntensity;\n var cellUVs = params.cellUVs;\n var cellIntensity = params.cellIntensity;\n var intensityLo = Infinity;\n var intensityHi = -Infinity;\n if (!vertexUVs && !cellUVs) {\n if (vertexIntensity) {\n if (params.vertexIntensityBounds) {\n intensityLo = +params.vertexIntensityBounds[0];\n intensityHi = +params.vertexIntensityBounds[1];\n } else {\n for (var i = 0; i < vertexIntensity.length; ++i) {\n var f = vertexIntensity[i];\n intensityLo = Math.min(intensityLo, f);\n intensityHi = Math.max(intensityHi, f);\n }\n }\n } else if (cellIntensity) {\n if (params.cellIntensityBounds) {\n intensityLo = +params.cellIntensityBounds[0];\n intensityHi = +params.cellIntensityBounds[1];\n } else {\n for (var i = 0; i < cellIntensity.length; ++i) {\n var f = cellIntensity[i];\n intensityLo = Math.min(intensityLo, f);\n intensityHi = Math.max(intensityHi, f);\n }\n }\n } else {\n for (var i = 0; i < positions.length; ++i) {\n var f = positions[i][2];\n intensityLo = Math.min(intensityLo, f);\n intensityHi = Math.max(intensityHi, f);\n }\n }\n }\n if (vertexIntensity) {\n this.intensity = vertexIntensity;\n } else if (cellIntensity) {\n this.intensity = cellIntensity;\n } else {\n this.intensity = takeZComponent(positions);\n }\n this.pickVertex = !(cellIntensity || cellColors);\n var pointSizes = params.pointSizes;\n var meshPointSize = params.pointSize || 1;\n this.bounds = [[Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]];\n for (var i = 0; i < positions.length; ++i) {\n var p = positions[i];\n for (var j = 0; j < 3; ++j) {\n if (isNaN(p[j]) || !isFinite(p[j])) {\n continue;\n }\n this.bounds[0][j] = Math.min(this.bounds[0][j], p[j]);\n this.bounds[1][j] = Math.max(this.bounds[1][j], p[j]);\n }\n }\n var triangleCount = 0;\n var edgeCount = 0;\n var pointCount = 0;\n fill_loop:\n for (var i = 0; i < cells.length; ++i) {\n var cell = cells[i];\n switch (cell.length) {\n case 1:\n var v = cell[0];\n var p = positions[v];\n for (var j = 0; j < 3; ++j) {\n if (isNaN(p[j]) || !isFinite(p[j])) {\n continue fill_loop;\n }\n }\n pPos.push(p[0], p[1], p[2]);\n var c;\n if (vertexColors) {\n c = vertexColors[v];\n } else if (cellColors) {\n c = cellColors[i];\n } else {\n c = meshColor;\n }\n if (this.opacityscale && vertexIntensity) {\n tCol.push(\n c[0],\n c[1],\n c[2],\n this.opacity * getOpacityFromScale(\n (vertexIntensity[v] - intensityLo) / (intensityHi - intensityLo),\n this.opacityscale\n )\n );\n } else if (c.length === 3) {\n pCol.push(c[0], c[1], c[2], this.opacity);\n } else {\n pCol.push(c[0], c[1], c[2], c[3] * this.opacity);\n if (c[3] < 1) this.hasAlpha = true;\n }\n var uv;\n if (vertexUVs) {\n uv = vertexUVs[v];\n } else if (vertexIntensity) {\n uv = [\n (vertexIntensity[v] - intensityLo) / (intensityHi - intensityLo),\n 0\n ];\n } else if (cellUVs) {\n uv = cellUVs[i];\n } else if (cellIntensity) {\n uv = [\n (cellIntensity[i] - intensityLo) / (intensityHi - intensityLo),\n 0\n ];\n } else {\n uv = [\n (p[2] - intensityLo) / (intensityHi - intensityLo),\n 0\n ];\n }\n pUVs.push(uv[0], uv[1]);\n if (pointSizes) {\n pSiz.push(pointSizes[v]);\n } else {\n pSiz.push(meshPointSize);\n }\n pIds.push(i);\n pointCount += 1;\n break;\n case 2:\n for (var j = 0; j < 2; ++j) {\n var v = cell[j];\n var p = positions[v];\n for (var k = 0; k < 3; ++k) {\n if (isNaN(p[k]) || !isFinite(p[k])) {\n continue fill_loop;\n }\n }\n }\n for (var j = 0; j < 2; ++j) {\n var v = cell[j];\n var p = positions[v];\n ePos.push(p[0], p[1], p[2]);\n var c;\n if (vertexColors) {\n c = vertexColors[v];\n } else if (cellColors) {\n c = cellColors[i];\n } else {\n c = meshColor;\n }\n if (this.opacityscale && vertexIntensity) {\n tCol.push(\n c[0],\n c[1],\n c[2],\n this.opacity * getOpacityFromScale(\n (vertexIntensity[v] - intensityLo) / (intensityHi - intensityLo),\n this.opacityscale\n )\n );\n } else if (c.length === 3) {\n eCol.push(c[0], c[1], c[2], this.opacity);\n } else {\n eCol.push(c[0], c[1], c[2], c[3] * this.opacity);\n if (c[3] < 1) this.hasAlpha = true;\n }\n var uv;\n if (vertexUVs) {\n uv = vertexUVs[v];\n } else if (vertexIntensity) {\n uv = [\n (vertexIntensity[v] - intensityLo) / (intensityHi - intensityLo),\n 0\n ];\n } else if (cellUVs) {\n uv = cellUVs[i];\n } else if (cellIntensity) {\n uv = [\n (cellIntensity[i] - intensityLo) / (intensityHi - intensityLo),\n 0\n ];\n } else {\n uv = [\n (p[2] - intensityLo) / (intensityHi - intensityLo),\n 0\n ];\n }\n eUVs.push(uv[0], uv[1]);\n eIds.push(i);\n }\n edgeCount += 1;\n break;\n case 3:\n for (var j = 0; j < 3; ++j) {\n var v = cell[j];\n var p = positions[v];\n for (var k = 0; k < 3; ++k) {\n if (isNaN(p[k]) || !isFinite(p[k])) {\n continue fill_loop;\n }\n }\n }\n for (var j = 0; j < 3; ++j) {\n var v = cell[2 - j];\n var p = positions[v];\n tPos.push(p[0], p[1], p[2]);\n var c;\n if (vertexColors) {\n c = vertexColors[v];\n } else if (cellColors) {\n c = cellColors[i];\n } else {\n c = meshColor;\n }\n if (!c) {\n tCol.push(0.5, 0.5, 0.5, 1);\n } else if (this.opacityscale && vertexIntensity) {\n tCol.push(\n c[0],\n c[1],\n c[2],\n this.opacity * getOpacityFromScale(\n (vertexIntensity[v] - intensityLo) / (intensityHi - intensityLo),\n this.opacityscale\n )\n );\n } else if (c.length === 3) {\n tCol.push(c[0], c[1], c[2], this.opacity);\n } else {\n tCol.push(c[0], c[1], c[2], c[3] * this.opacity);\n if (c[3] < 1) this.hasAlpha = true;\n }\n var uv;\n if (vertexUVs) {\n uv = vertexUVs[v];\n } else if (vertexIntensity) {\n uv = [\n (vertexIntensity[v] - intensityLo) / (intensityHi - intensityLo),\n 0\n ];\n } else if (cellUVs) {\n uv = cellUVs[i];\n } else if (cellIntensity) {\n uv = [\n (cellIntensity[i] - intensityLo) / (intensityHi - intensityLo),\n 0\n ];\n } else {\n uv = [\n (p[2] - intensityLo) / (intensityHi - intensityLo),\n 0\n ];\n }\n tUVs.push(uv[0], uv[1]);\n var q;\n if (vertexNormals) {\n q = vertexNormals[v];\n } else {\n q = cellNormals[i];\n }\n tNor.push(q[0], q[1], q[2]);\n tIds.push(i);\n }\n triangleCount += 1;\n break;\n default:\n break;\n }\n }\n this.pointCount = pointCount;\n this.edgeCount = edgeCount;\n this.triangleCount = triangleCount;\n this.pointPositions.update(pPos);\n this.pointColors.update(pCol);\n this.pointUVs.update(pUVs);\n this.pointSizes.update(pSiz);\n this.pointIds.update(new Uint32Array(pIds));\n this.edgePositions.update(ePos);\n this.edgeColors.update(eCol);\n this.edgeUVs.update(eUVs);\n this.edgeIds.update(new Uint32Array(eIds));\n this.trianglePositions.update(tPos);\n this.triangleColors.update(tCol);\n this.triangleUVs.update(tUVs);\n this.triangleNormals.update(tNor);\n this.triangleIds.update(new Uint32Array(tIds));\n };\n proto.drawTransparent = proto.draw = function(params) {\n params = params || {};\n var gl2 = this.gl;\n var model = params.model || IDENTITY;\n var view = params.view || IDENTITY;\n var projection = params.projection || IDENTITY;\n var clipBounds = [[-1e6, -1e6, -1e6], [1e6, 1e6, 1e6]];\n for (var i = 0; i < 3; ++i) {\n clipBounds[0][i] = Math.max(clipBounds[0][i], this.clipBounds[0][i]);\n clipBounds[1][i] = Math.min(clipBounds[1][i], this.clipBounds[1][i]);\n }\n var uniforms = {\n model,\n view,\n projection,\n inverseModel: IDENTITY.slice(),\n clipBounds,\n kambient: this.ambientLight,\n kdiffuse: this.diffuseLight,\n kspecular: this.specularLight,\n roughness: this.roughness,\n fresnel: this.fresnel,\n eyePosition: [0, 0, 0],\n lightPosition: [0, 0, 0],\n contourColor: this.contourColor,\n texture: 0\n };\n uniforms.inverseModel = invert(uniforms.inverseModel, uniforms.model);\n gl2.disable(gl2.CULL_FACE);\n this.texture.bind(0);\n var invCameraMatrix = new Array(16);\n multiply(invCameraMatrix, uniforms.view, uniforms.model);\n multiply(invCameraMatrix, uniforms.projection, invCameraMatrix);\n invert(invCameraMatrix, invCameraMatrix);\n for (var i = 0; i < 3; ++i) {\n uniforms.eyePosition[i] = invCameraMatrix[12 + i] / invCameraMatrix[15];\n }\n var w = invCameraMatrix[15];\n for (var i = 0; i < 3; ++i) {\n w += this.lightPosition[i] * invCameraMatrix[4 * i + 3];\n }\n for (var i = 0; i < 3; ++i) {\n var s = invCameraMatrix[12 + i];\n for (var j = 0; j < 3; ++j) {\n s += invCameraMatrix[4 * j + i] * this.lightPosition[j];\n }\n uniforms.lightPosition[i] = s / w;\n }\n if (this.triangleCount > 0) {\n var shader = this.triShader;\n shader.bind();\n shader.uniforms = uniforms;\n this.triangleVAO.bind();\n gl2.drawArrays(gl2.TRIANGLES, 0, this.triangleCount * 3);\n this.triangleVAO.unbind();\n }\n if (this.edgeCount > 0 && this.lineWidth > 0) {\n var shader = this.lineShader;\n shader.bind();\n shader.uniforms = uniforms;\n this.edgeVAO.bind();\n gl2.lineWidth(this.lineWidth * this.pixelRatio);\n gl2.drawArrays(gl2.LINES, 0, this.edgeCount * 2);\n this.edgeVAO.unbind();\n }\n if (this.pointCount > 0) {\n var shader = this.pointShader;\n shader.bind();\n shader.uniforms = uniforms;\n this.pointVAO.bind();\n gl2.drawArrays(gl2.POINTS, 0, this.pointCount);\n this.pointVAO.unbind();\n }\n if (this.contourEnable && this.contourCount > 0 && this.contourLineWidth > 0) {\n var shader = this.contourShader;\n shader.bind();\n shader.uniforms = uniforms;\n this.contourVAO.bind();\n gl2.drawArrays(gl2.LINES, 0, this.contourCount);\n this.contourVAO.unbind();\n }\n };\n proto.drawPick = function(params) {\n params = params || {};\n var gl2 = this.gl;\n var model = params.model || IDENTITY;\n var view = params.view || IDENTITY;\n var projection = params.projection || IDENTITY;\n var clipBounds = [[-1e6, -1e6, -1e6], [1e6, 1e6, 1e6]];\n for (var i = 0; i < 3; ++i) {\n clipBounds[0][i] = Math.max(clipBounds[0][i], this.clipBounds[0][i]);\n clipBounds[1][i] = Math.min(clipBounds[1][i], this.clipBounds[1][i]);\n }\n this._model = [].slice.call(model);\n this._view = [].slice.call(view);\n this._projection = [].slice.call(projection);\n this._resolution = [gl2.drawingBufferWidth, gl2.drawingBufferHeight];\n var uniforms = {\n model,\n view,\n projection,\n clipBounds,\n pickId: this.pickId / 255\n };\n var shader = this.pickShader;\n shader.bind();\n shader.uniforms = uniforms;\n if (this.triangleCount > 0) {\n this.triangleVAO.bind();\n gl2.drawArrays(gl2.TRIANGLES, 0, this.triangleCount * 3);\n this.triangleVAO.unbind();\n }\n if (this.edgeCount > 0) {\n this.edgeVAO.bind();\n gl2.lineWidth(this.lineWidth * this.pixelRatio);\n gl2.drawArrays(gl2.LINES, 0, this.edgeCount * 2);\n this.edgeVAO.unbind();\n }\n if (this.pointCount > 0) {\n var shader = this.pointPickShader;\n shader.bind();\n shader.uniforms = uniforms;\n this.pointVAO.bind();\n gl2.drawArrays(gl2.POINTS, 0, this.pointCount);\n this.pointVAO.unbind();\n }\n };\n proto.pick = function(pickData) {\n if (!pickData) {\n return null;\n }\n if (pickData.id !== this.pickId) {\n return null;\n }\n var cellId = pickData.value[0] + 256 * pickData.value[1] + 65536 * pickData.value[2];\n var cell = this.cells[cellId];\n var positions = this.positions;\n var simplex = new Array(cell.length);\n for (var i = 0; i < cell.length; ++i) {\n simplex[i] = positions[cell[i]];\n }\n var x = pickData.coord[0];\n var y = pickData.coord[1];\n if (!this.pickVertex) {\n var A2 = this.positions[cell[0]];\n var B2 = this.positions[cell[1]];\n var C2 = this.positions[cell[2]];\n var dataCoordinate = [\n (A2[0] + B2[0] + C2[0]) / 3,\n (A2[1] + B2[1] + C2[1]) / 3,\n (A2[2] + B2[2] + C2[2]) / 3\n ];\n return {\n _cellCenter: true,\n position: [x, y],\n index: cellId,\n cell,\n cellId,\n intensity: this.intensity[cellId],\n dataCoordinate\n };\n }\n var data = closestPoint(\n simplex,\n [x * this.pixelRatio, this._resolution[1] - y * this.pixelRatio],\n this._model,\n this._view,\n this._projection,\n this._resolution\n );\n if (!data) {\n return null;\n }\n var weights = data[2];\n var interpIntensity = 0;\n for (var i = 0; i < cell.length; ++i) {\n interpIntensity += weights[i] * this.intensity[cell[i]];\n }\n return {\n position: data[1],\n index: cell[data[0]],\n cell,\n cellId,\n intensity: interpIntensity,\n dataCoordinate: this.positions[cell[data[0]]]\n };\n };\n proto.dispose = function() {\n this.texture.dispose();\n this.triShader.dispose();\n this.lineShader.dispose();\n this.pointShader.dispose();\n this.pickShader.dispose();\n this.pointPickShader.dispose();\n this.triangleVAO.dispose();\n this.trianglePositions.dispose();\n this.triangleColors.dispose();\n this.triangleUVs.dispose();\n this.triangleNormals.dispose();\n this.triangleIds.dispose();\n this.edgeVAO.dispose();\n this.edgePositions.dispose();\n this.edgeColors.dispose();\n this.edgeUVs.dispose();\n this.edgeIds.dispose();\n this.pointVAO.dispose();\n this.pointPositions.dispose();\n this.pointColors.dispose();\n this.pointUVs.dispose();\n this.pointSizes.dispose();\n this.pointIds.dispose();\n this.contourVAO.dispose();\n this.contourPositions.dispose();\n this.contourShader.dispose();\n };\n function createMeshShader(gl2) {\n var shader = createShader(gl2, meshShader.vertex, meshShader.fragment);\n shader.attributes.position.location = 0;\n shader.attributes.color.location = 2;\n shader.attributes.uv.location = 3;\n shader.attributes.normal.location = 4;\n return shader;\n }\n function createWireShader(gl2) {\n var shader = createShader(gl2, wireShader.vertex, wireShader.fragment);\n shader.attributes.position.location = 0;\n shader.attributes.color.location = 2;\n shader.attributes.uv.location = 3;\n return shader;\n }\n function createPointShader(gl2) {\n var shader = createShader(gl2, pointShader.vertex, pointShader.fragment);\n shader.attributes.position.location = 0;\n shader.attributes.color.location = 2;\n shader.attributes.uv.location = 3;\n shader.attributes.pointSize.location = 4;\n return shader;\n }\n function createPickShader(gl2) {\n var shader = createShader(gl2, pickShader.vertex, pickShader.fragment);\n shader.attributes.position.location = 0;\n shader.attributes.id.location = 1;\n return shader;\n }\n function createPointPickShader(gl2) {\n var shader = createShader(gl2, pointPickShader.vertex, pointPickShader.fragment);\n shader.attributes.position.location = 0;\n shader.attributes.id.location = 1;\n shader.attributes.pointSize.location = 4;\n return shader;\n }\n function createContourShader(gl2) {\n var shader = createShader(gl2, contourShader.vertex, contourShader.fragment);\n shader.attributes.position.location = 0;\n return shader;\n }\n function createSimplicialMesh(gl2, params) {\n if (arguments.length === 1) {\n params = gl2;\n gl2 = params.gl;\n }\n var ext = gl2.getExtension(\"OES_standard_derivatives\") || gl2.getExtension(\"MOZ_OES_standard_derivatives\") || gl2.getExtension(\"WEBKIT_OES_standard_derivatives\");\n if (!ext)\n throw new Error(\"derivatives not supported\");\n var triShader = createMeshShader(gl2);\n var lineShader = createWireShader(gl2);\n var pointShader2 = createPointShader(gl2);\n var pickShader2 = createPickShader(gl2);\n var pointPickShader2 = createPointPickShader(gl2);\n var contourShader2 = createContourShader(gl2);\n var meshTexture = createTexture(\n gl2,\n ndarray(new Uint8Array([255, 255, 255, 255]), [1, 1, 4])\n );\n meshTexture.generateMipmap();\n meshTexture.minFilter = gl2.LINEAR_MIPMAP_LINEAR;\n meshTexture.magFilter = gl2.LINEAR;\n var trianglePositions = createBuffer(gl2);\n var triangleColors = createBuffer(gl2);\n var triangleUVs = createBuffer(gl2);\n var triangleNormals = createBuffer(gl2);\n var triangleIds = createBuffer(gl2);\n var triangleVAO = createVAO(gl2, [\n {\n buffer: trianglePositions,\n type: gl2.FLOAT,\n size: 3\n },\n {\n buffer: triangleIds,\n type: gl2.UNSIGNED_BYTE,\n size: 4,\n normalized: true\n },\n {\n buffer: triangleColors,\n type: gl2.FLOAT,\n size: 4\n },\n {\n buffer: triangleUVs,\n type: gl2.FLOAT,\n size: 2\n },\n {\n buffer: triangleNormals,\n type: gl2.FLOAT,\n size: 3\n }\n ]);\n var edgePositions = createBuffer(gl2);\n var edgeColors = createBuffer(gl2);\n var edgeUVs = createBuffer(gl2);\n var edgeIds = createBuffer(gl2);\n var edgeVAO = createVAO(gl2, [\n {\n buffer: edgePositions,\n type: gl2.FLOAT,\n size: 3\n },\n {\n buffer: edgeIds,\n type: gl2.UNSIGNED_BYTE,\n size: 4,\n normalized: true\n },\n {\n buffer: edgeColors,\n type: gl2.FLOAT,\n size: 4\n },\n {\n buffer: edgeUVs,\n type: gl2.FLOAT,\n size: 2\n }\n ]);\n var pointPositions = createBuffer(gl2);\n var pointColors = createBuffer(gl2);\n var pointUVs = createBuffer(gl2);\n var pointSizes = createBuffer(gl2);\n var pointIds = createBuffer(gl2);\n var pointVAO = createVAO(gl2, [\n {\n buffer: pointPositions,\n type: gl2.FLOAT,\n size: 3\n },\n {\n buffer: pointIds,\n type: gl2.UNSIGNED_BYTE,\n size: 4,\n normalized: true\n },\n {\n buffer: pointColors,\n type: gl2.FLOAT,\n size: 4\n },\n {\n buffer: pointUVs,\n type: gl2.FLOAT,\n size: 2\n },\n {\n buffer: pointSizes,\n type: gl2.FLOAT,\n size: 1\n }\n ]);\n var contourPositions = createBuffer(gl2);\n var contourVAO = createVAO(gl2, [\n {\n buffer: contourPositions,\n type: gl2.FLOAT,\n size: 3\n }\n ]);\n var mesh = new SimplicialMesh(\n gl2,\n meshTexture,\n triShader,\n lineShader,\n pointShader2,\n pickShader2,\n pointPickShader2,\n contourShader2,\n trianglePositions,\n triangleIds,\n triangleColors,\n triangleUVs,\n triangleNormals,\n triangleVAO,\n edgePositions,\n edgeIds,\n edgeColors,\n edgeUVs,\n edgeVAO,\n pointPositions,\n pointIds,\n pointColors,\n pointUVs,\n pointSizes,\n pointVAO,\n contourPositions,\n contourVAO\n );\n mesh.update(params);\n return mesh;\n }\n module2.exports = createSimplicialMesh;\n }\n ),\n /***/\n 4437: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = createCamera;\n var now = __webpack_require__2(3025);\n var createView = __webpack_require__2(6296);\n var mouseChange = __webpack_require__2(351);\n var mouseWheel = __webpack_require__2(8512);\n var mouseOffset = __webpack_require__2(24);\n var hasPassive = __webpack_require__2(7520);\n function createCamera(element, options) {\n element = element || document.body;\n options = options || {};\n var limits = [0.01, Infinity];\n if (\"distanceLimits\" in options) {\n limits[0] = options.distanceLimits[0];\n limits[1] = options.distanceLimits[1];\n }\n if (\"zoomMin\" in options) {\n limits[0] = options.zoomMin;\n }\n if (\"zoomMax\" in options) {\n limits[1] = options.zoomMax;\n }\n var view = createView({\n center: options.center || [0, 0, 0],\n up: options.up || [0, 1, 0],\n eye: options.eye || [0, 0, 10],\n mode: options.mode || \"orbit\",\n distanceLimits: limits\n });\n var pmatrix = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n var distance = 0;\n var width = element.clientWidth;\n var height = element.clientHeight;\n var camera = {\n keyBindingMode: \"rotate\",\n enableWheel: true,\n view,\n element,\n delay: options.delay || 16,\n rotateSpeed: options.rotateSpeed || 1,\n zoomSpeed: options.zoomSpeed || 1,\n translateSpeed: options.translateSpeed || 1,\n flipX: !!options.flipX,\n flipY: !!options.flipY,\n modes: view.modes,\n _ortho: options._ortho || options.projection && options.projection.type === \"orthographic\" || false,\n tick: function() {\n var t = now();\n var delay = this.delay;\n var ctime = t - 2 * delay;\n view.idle(t - delay);\n view.recalcMatrix(ctime);\n view.flush(t - (100 + delay * 2));\n var allEqual = true;\n var matrix = view.computedMatrix;\n for (var i = 0; i < 16; ++i) {\n allEqual = allEqual && pmatrix[i] === matrix[i];\n pmatrix[i] = matrix[i];\n }\n var sizeChanged = element.clientWidth === width && element.clientHeight === height;\n width = element.clientWidth;\n height = element.clientHeight;\n if (allEqual) {\n return !sizeChanged;\n }\n distance = Math.exp(view.computedRadius[0]);\n return true;\n },\n lookAt: function(eye, center, up) {\n view.lookAt(view.lastT(), eye, center, up);\n },\n rotate: function(pitch, yaw, roll) {\n view.rotate(view.lastT(), pitch, yaw, roll);\n },\n pan: function(dx, dy, dz) {\n view.pan(view.lastT(), dx, dy, dz);\n },\n translate: function(dx, dy, dz) {\n view.translate(view.lastT(), dx, dy, dz);\n }\n };\n Object.defineProperties(camera, {\n matrix: {\n get: function() {\n return view.computedMatrix;\n },\n set: function(mat) {\n view.setMatrix(view.lastT(), mat);\n return view.computedMatrix;\n },\n enumerable: true\n },\n mode: {\n get: function() {\n return view.getMode();\n },\n set: function(mode) {\n var curUp = view.computedUp.slice();\n var curEye = view.computedEye.slice();\n var curCenter = view.computedCenter.slice();\n view.setMode(mode);\n if (mode === \"turntable\") {\n var t02 = now();\n view._active.lookAt(t02, curEye, curCenter, curUp);\n view._active.lookAt(t02 + 500, curEye, curCenter, [0, 0, 1]);\n view._active.flush(t02);\n }\n return view.getMode();\n },\n enumerable: true\n },\n center: {\n get: function() {\n return view.computedCenter;\n },\n set: function(ncenter) {\n view.lookAt(view.lastT(), null, ncenter);\n return view.computedCenter;\n },\n enumerable: true\n },\n eye: {\n get: function() {\n return view.computedEye;\n },\n set: function(neye) {\n view.lookAt(view.lastT(), neye);\n return view.computedEye;\n },\n enumerable: true\n },\n up: {\n get: function() {\n return view.computedUp;\n },\n set: function(nup) {\n view.lookAt(view.lastT(), null, null, nup);\n return view.computedUp;\n },\n enumerable: true\n },\n distance: {\n get: function() {\n return distance;\n },\n set: function(d) {\n view.setDistance(view.lastT(), d);\n return d;\n },\n enumerable: true\n },\n distanceLimits: {\n get: function() {\n return view.getDistanceLimits(limits);\n },\n set: function(v) {\n view.setDistanceLimits(v);\n return v;\n },\n enumerable: true\n }\n });\n element.addEventListener(\"contextmenu\", function(ev) {\n ev.preventDefault();\n return false;\n });\n camera._lastX = -1;\n camera._lastY = -1;\n camera._lastMods = { shift: false, control: false, alt: false, meta: false };\n camera.enableMouseListeners = function() {\n camera.mouseListener = mouseChange(element, handleInteraction);\n element.addEventListener(\"touchstart\", function(ev) {\n var xy = mouseOffset(ev.changedTouches[0], element);\n handleInteraction(0, xy[0], xy[1], camera._lastMods);\n handleInteraction(1, xy[0], xy[1], camera._lastMods);\n }, hasPassive ? { passive: true } : false);\n element.addEventListener(\"touchmove\", function(ev) {\n var xy = mouseOffset(ev.changedTouches[0], element);\n handleInteraction(1, xy[0], xy[1], camera._lastMods);\n ev.preventDefault();\n }, hasPassive ? { passive: false } : false);\n element.addEventListener(\"touchend\", function(ev) {\n handleInteraction(0, camera._lastX, camera._lastY, camera._lastMods);\n }, hasPassive ? { passive: true } : false);\n function handleInteraction(buttons, x, y, mods) {\n var keyBindingMode = camera.keyBindingMode;\n if (keyBindingMode === false) return;\n var rotate = keyBindingMode === \"rotate\";\n var pan = keyBindingMode === \"pan\";\n var zoom = keyBindingMode === \"zoom\";\n var ctrl = !!mods.control;\n var alt = !!mods.alt;\n var shift = !!mods.shift;\n var left = !!(buttons & 1);\n var right = !!(buttons & 2);\n var middle = !!(buttons & 4);\n var scale = 1 / element.clientHeight;\n var dx = scale * (x - camera._lastX);\n var dy = scale * (y - camera._lastY);\n var flipX = camera.flipX ? 1 : -1;\n var flipY = camera.flipY ? 1 : -1;\n var drot = Math.PI * camera.rotateSpeed;\n var t = now();\n if (camera._lastX !== -1 && camera._lastY !== -1) {\n if (rotate && left && !ctrl && !alt && !shift || left && !ctrl && !alt && shift) {\n view.rotate(t, flipX * drot * dx, -flipY * drot * dy, 0);\n }\n if (pan && left && !ctrl && !alt && !shift || right || left && ctrl && !alt && !shift) {\n view.pan(t, -camera.translateSpeed * dx * distance, camera.translateSpeed * dy * distance, 0);\n }\n if (zoom && left && !ctrl && !alt && !shift || middle || left && !ctrl && alt && !shift) {\n var kzoom = -camera.zoomSpeed * dy / window.innerHeight * (t - view.lastT()) * 100;\n view.pan(t, 0, 0, distance * (Math.exp(kzoom) - 1));\n }\n }\n camera._lastX = x;\n camera._lastY = y;\n camera._lastMods = mods;\n return true;\n }\n camera.wheelListener = mouseWheel(element, function(dx, dy) {\n if (camera.keyBindingMode === false) return;\n if (!camera.enableWheel) return;\n var flipX = camera.flipX ? 1 : -1;\n var flipY = camera.flipY ? 1 : -1;\n var t = now();\n if (Math.abs(dx) > Math.abs(dy)) {\n view.rotate(t, 0, 0, -dx * flipX * Math.PI * camera.rotateSpeed / window.innerWidth);\n } else {\n if (!camera._ortho) {\n var kzoom = -camera.zoomSpeed * flipY * dy / window.innerHeight * (t - view.lastT()) / 20;\n view.pan(t, 0, 0, distance * (Math.exp(kzoom) - 1));\n }\n }\n }, true);\n };\n camera.enableMouseListeners();\n return camera;\n }\n }\n ),\n /***/\n 799: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n var glslify = __webpack_require__2(3236);\n var createShader = __webpack_require__2(9405);\n var vertSrc = glslify([\"precision mediump float;\\n#define GLSLIFY 1\\nattribute vec2 position;\\nvarying vec2 uv;\\nvoid main() {\\n uv = position;\\n gl_Position = vec4(position, 0, 1);\\n}\"]);\n var fragSrc = glslify([\"precision mediump float;\\n#define GLSLIFY 1\\n\\nuniform sampler2D accumBuffer;\\nvarying vec2 uv;\\n\\nvoid main() {\\n vec4 accum = texture2D(accumBuffer, 0.5 * (uv + 1.0));\\n gl_FragColor = min(vec4(1,1,1,1), accum);\\n}\"]);\n module2.exports = function(gl2) {\n return createShader(gl2, vertSrc, fragSrc, null, [{ name: \"position\", type: \"vec2\" }]);\n };\n }\n ),\n /***/\n 4100: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var createCamera = __webpack_require__2(4437);\n var createAxes = __webpack_require__2(3837);\n var axesRanges = __webpack_require__2(5445);\n var createSpikes = __webpack_require__2(4449);\n var createSelect = __webpack_require__2(3589);\n var createFBO = __webpack_require__2(2260);\n var drawTriangle = __webpack_require__2(7169);\n var mouseChange = __webpack_require__2(351);\n var perspective = __webpack_require__2(4772);\n var ortho = __webpack_require__2(4040);\n var createShader = __webpack_require__2(799);\n var isMobile = __webpack_require__2(9216)({ tablet: true, featureDetect: true });\n module2.exports = {\n createScene,\n createCamera\n };\n function MouseSelect() {\n this.mouse = [-1, -1];\n this.screen = null;\n this.distance = Infinity;\n this.index = null;\n this.dataCoordinate = null;\n this.dataPosition = null;\n this.object = null;\n this.data = null;\n }\n function getContext(canvas, options) {\n var gl2 = null;\n try {\n gl2 = canvas.getContext(\"webgl\", options);\n if (!gl2) {\n gl2 = canvas.getContext(\"experimental-webgl\", options);\n }\n } catch (e) {\n return null;\n }\n return gl2;\n }\n function roundUpPow10(x) {\n var y = Math.round(Math.log(Math.abs(x)) / Math.log(10));\n if (y < 0) {\n var base = Math.round(Math.pow(10, -y));\n return Math.ceil(x * base) / base;\n } else if (y > 0) {\n var base = Math.round(Math.pow(10, y));\n return Math.ceil(x / base) * base;\n }\n return Math.ceil(x);\n }\n function defaultBool(x) {\n if (typeof x === \"boolean\") {\n return x;\n }\n return true;\n }\n function createScene(options) {\n options = options || {};\n options.camera = options.camera || {};\n var canvas = options.canvas;\n if (!canvas) {\n canvas = document.createElement(\"canvas\");\n if (options.container) {\n var container = options.container;\n container.appendChild(canvas);\n } else {\n document.body.appendChild(canvas);\n }\n }\n var gl2 = options.gl;\n if (!gl2) {\n if (options.glOptions) {\n isMobile = !!options.glOptions.preserveDrawingBuffer;\n }\n gl2 = getContext(\n canvas,\n options.glOptions || {\n premultipliedAlpha: true,\n antialias: true,\n preserveDrawingBuffer: isMobile\n }\n );\n }\n if (!gl2) {\n throw new Error(\"webgl not supported\");\n }\n var bounds = options.bounds || [[-10, -10, -10], [10, 10, 10]];\n var selection = new MouseSelect();\n var accumBuffer = createFBO(\n gl2,\n gl2.drawingBufferWidth,\n gl2.drawingBufferHeight,\n {\n preferFloat: !isMobile\n }\n );\n var accumShader = createShader(gl2);\n var isOrtho = options.cameraObject && options.cameraObject._ortho === true || options.camera.projection && options.camera.projection.type === \"orthographic\" || false;\n var cameraOptions = {\n eye: options.camera.eye || [2, 0, 0],\n center: options.camera.center || [0, 0, 0],\n up: options.camera.up || [0, 1, 0],\n zoomMin: options.camera.zoomMax || 0.1,\n zoomMax: options.camera.zoomMin || 100,\n mode: options.camera.mode || \"turntable\",\n _ortho: isOrtho\n };\n var axesOptions = options.axes || {};\n var axes = createAxes(gl2, axesOptions);\n axes.enable = !axesOptions.disable;\n var spikeOptions = options.spikes || {};\n var spikes = createSpikes(gl2, spikeOptions);\n var objects = [];\n var pickBufferIds = [];\n var pickBufferCount = [];\n var pickBuffers = [];\n var dirty = true;\n var pickDirty = true;\n var projection = new Array(16);\n var model = new Array(16);\n var cameraParams = {\n view: null,\n projection,\n model,\n _ortho: false\n };\n var pickDirty = true;\n var viewShape = [gl2.drawingBufferWidth, gl2.drawingBufferHeight];\n var camera = options.cameraObject || createCamera(canvas, cameraOptions);\n var scene = {\n gl: gl2,\n contextLost: false,\n pixelRatio: options.pixelRatio || 1,\n canvas,\n selection,\n camera,\n axes,\n axesPixels: null,\n spikes,\n bounds,\n objects,\n shape: viewShape,\n aspect: options.aspectRatio || [1, 1, 1],\n pickRadius: options.pickRadius || 10,\n zNear: options.zNear || 0.01,\n zFar: options.zFar || 1e3,\n fovy: options.fovy || Math.PI / 4,\n clearColor: options.clearColor || [0, 0, 0, 0],\n autoResize: defaultBool(options.autoResize),\n autoBounds: defaultBool(options.autoBounds),\n autoScale: !!options.autoScale,\n autoCenter: defaultBool(options.autoCenter),\n clipToBounds: defaultBool(options.clipToBounds),\n snapToData: !!options.snapToData,\n onselect: options.onselect || null,\n onrender: options.onrender || null,\n onclick: options.onclick || null,\n cameraParams,\n oncontextloss: null,\n mouseListener: null,\n _stopped: false,\n getAspectratio: function() {\n return {\n x: this.aspect[0],\n y: this.aspect[1],\n z: this.aspect[2]\n };\n },\n setAspectratio: function(aspectratio) {\n this.aspect[0] = aspectratio.x;\n this.aspect[1] = aspectratio.y;\n this.aspect[2] = aspectratio.z;\n pickDirty = true;\n },\n setBounds: function(axisIndex, range) {\n this.bounds[0][axisIndex] = range.min;\n this.bounds[1][axisIndex] = range.max;\n },\n setClearColor: function(clearColor) {\n this.clearColor = clearColor;\n },\n clearRGBA: function() {\n this.gl.clearColor(\n this.clearColor[0],\n this.clearColor[1],\n this.clearColor[2],\n this.clearColor[3]\n );\n this.gl.clear(\n this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT\n );\n }\n };\n var pickShape = [gl2.drawingBufferWidth / scene.pixelRatio | 0, gl2.drawingBufferHeight / scene.pixelRatio | 0];\n function resizeListener() {\n if (scene._stopped) {\n return;\n }\n if (!scene.autoResize) {\n return;\n }\n var parent = canvas.parentNode;\n var width = 1;\n var height = 1;\n if (parent && parent !== document.body) {\n width = parent.clientWidth;\n height = parent.clientHeight;\n } else {\n width = window.innerWidth;\n height = window.innerHeight;\n }\n var nextWidth = Math.ceil(width * scene.pixelRatio) | 0;\n var nextHeight = Math.ceil(height * scene.pixelRatio) | 0;\n if (nextWidth !== canvas.width || nextHeight !== canvas.height) {\n canvas.width = nextWidth;\n canvas.height = nextHeight;\n var style = canvas.style;\n style.position = style.position || \"absolute\";\n style.left = \"0px\";\n style.top = \"0px\";\n style.width = width + \"px\";\n style.height = height + \"px\";\n dirty = true;\n }\n }\n if (scene.autoResize) {\n resizeListener();\n }\n window.addEventListener(\"resize\", resizeListener);\n function reallocPickIds() {\n var numObjs = objects.length;\n var numPick = pickBuffers.length;\n for (var i = 0; i < numPick; ++i) {\n pickBufferCount[i] = 0;\n }\n obj_loop:\n for (var i = 0; i < numObjs; ++i) {\n var obj = objects[i];\n var pickCount = obj.pickSlots;\n if (!pickCount) {\n pickBufferIds[i] = -1;\n continue;\n }\n for (var j = 0; j < numPick; ++j) {\n if (pickBufferCount[j] + pickCount < 255) {\n pickBufferIds[i] = j;\n obj.setPickBase(pickBufferCount[j] + 1);\n pickBufferCount[j] += pickCount;\n continue obj_loop;\n }\n }\n var nbuffer = createSelect(gl2, viewShape);\n pickBufferIds[i] = numPick;\n pickBuffers.push(nbuffer);\n pickBufferCount.push(pickCount);\n obj.setPickBase(1);\n numPick += 1;\n }\n while (numPick > 0 && pickBufferCount[numPick - 1] === 0) {\n pickBufferCount.pop();\n pickBuffers.pop().dispose();\n }\n }\n scene.update = function(options2) {\n if (scene._stopped) {\n return;\n }\n options2 = options2 || {};\n dirty = true;\n pickDirty = true;\n };\n scene.add = function(obj) {\n if (scene._stopped) {\n return;\n }\n obj.axes = axes;\n objects.push(obj);\n pickBufferIds.push(-1);\n dirty = true;\n pickDirty = true;\n reallocPickIds();\n };\n scene.remove = function(obj) {\n if (scene._stopped) {\n return;\n }\n var idx = objects.indexOf(obj);\n if (idx < 0) {\n return;\n }\n objects.splice(idx, 1);\n pickBufferIds.pop();\n dirty = true;\n pickDirty = true;\n reallocPickIds();\n };\n scene.dispose = function() {\n if (scene._stopped) {\n return;\n }\n scene._stopped = true;\n window.removeEventListener(\"resize\", resizeListener);\n canvas.removeEventListener(\"webglcontextlost\", checkContextLoss);\n scene.mouseListener.enabled = false;\n if (scene.contextLost) {\n return;\n }\n axes.dispose();\n spikes.dispose();\n for (var i = 0; i < objects.length; ++i) {\n objects[i].dispose();\n }\n accumBuffer.dispose();\n for (var i = 0; i < pickBuffers.length; ++i) {\n pickBuffers[i].dispose();\n }\n accumShader.dispose();\n gl2 = null;\n axes = null;\n spikes = null;\n objects = [];\n };\n scene._mouseRotating = false;\n scene._prevButtons = 0;\n scene.enableMouseListeners = function() {\n scene.mouseListener = mouseChange(canvas, function(buttons, x, y) {\n if (scene._stopped) {\n return;\n }\n var numPick = pickBuffers.length;\n var numObjs = objects.length;\n var prevObj = selection.object;\n selection.distance = Infinity;\n selection.mouse[0] = x;\n selection.mouse[1] = y;\n selection.object = null;\n selection.screen = null;\n selection.dataCoordinate = selection.dataPosition = null;\n var change = false;\n if (buttons && scene._prevButtons) {\n scene._mouseRotating = true;\n } else {\n if (scene._mouseRotating) {\n pickDirty = true;\n }\n scene._mouseRotating = false;\n for (var i = 0; i < numPick; ++i) {\n var result = pickBuffers[i].query(x, pickShape[1] - y - 1, scene.pickRadius);\n if (result) {\n if (result.distance > selection.distance) {\n continue;\n }\n for (var j = 0; j < numObjs; ++j) {\n var obj = objects[j];\n if (pickBufferIds[j] !== i) {\n continue;\n }\n var objPick = obj.pick(result);\n if (objPick) {\n selection.buttons = buttons;\n selection.screen = result.coord;\n selection.distance = result.distance;\n selection.object = obj;\n selection.index = objPick.distance;\n selection.dataPosition = objPick.position;\n selection.dataCoordinate = objPick.dataCoordinate;\n selection.data = objPick;\n change = true;\n }\n }\n }\n }\n }\n if (prevObj && prevObj !== selection.object) {\n if (prevObj.highlight) {\n prevObj.highlight(null);\n }\n dirty = true;\n }\n if (selection.object) {\n if (selection.object.highlight) {\n selection.object.highlight(selection.data);\n }\n dirty = true;\n }\n change = change || selection.object !== prevObj;\n if (change && scene.onselect) {\n scene.onselect(selection);\n }\n if (buttons & 1 && !(scene._prevButtons & 1) && scene.onclick) {\n scene.onclick(selection);\n }\n scene._prevButtons = buttons;\n });\n };\n function checkContextLoss() {\n if (scene.contextLost) {\n return true;\n }\n if (gl2.isContextLost()) {\n scene.contextLost = true;\n scene.mouseListener.enabled = false;\n scene.selection.object = null;\n if (scene.oncontextloss) {\n scene.oncontextloss();\n }\n }\n }\n canvas.addEventListener(\"webglcontextlost\", checkContextLoss);\n function renderPick() {\n if (checkContextLoss()) {\n return;\n }\n gl2.colorMask(true, true, true, true);\n gl2.depthMask(true);\n gl2.disable(gl2.BLEND);\n gl2.enable(gl2.DEPTH_TEST);\n gl2.depthFunc(gl2.LEQUAL);\n var numObjs = objects.length;\n var numPick = pickBuffers.length;\n for (var j = 0; j < numPick; ++j) {\n var buf = pickBuffers[j];\n buf.shape = pickShape;\n buf.begin();\n for (var i = 0; i < numObjs; ++i) {\n if (pickBufferIds[i] !== j) {\n continue;\n }\n var obj = objects[i];\n if (obj.drawPick) {\n obj.pixelRatio = 1;\n obj.drawPick(cameraParams);\n }\n }\n buf.end();\n }\n }\n var nBounds = [\n [Infinity, Infinity, Infinity],\n [-Infinity, -Infinity, -Infinity]\n ];\n var prevBounds = [nBounds[0].slice(), nBounds[1].slice()];\n function redraw() {\n if (checkContextLoss()) {\n return;\n }\n resizeListener();\n var cameraMoved = scene.camera.tick();\n cameraParams.view = scene.camera.matrix;\n dirty = dirty || cameraMoved;\n pickDirty = pickDirty || cameraMoved;\n axes.pixelRatio = scene.pixelRatio;\n spikes.pixelRatio = scene.pixelRatio;\n var numObjs = objects.length;\n var lo = nBounds[0];\n var hi = nBounds[1];\n lo[0] = lo[1] = lo[2] = Infinity;\n hi[0] = hi[1] = hi[2] = -Infinity;\n for (var i = 0; i < numObjs; ++i) {\n var obj = objects[i];\n obj.pixelRatio = scene.pixelRatio;\n obj.axes = scene.axes;\n dirty = dirty || !!obj.dirty;\n pickDirty = pickDirty || !!obj.dirty;\n var obb = obj.bounds;\n if (obb) {\n var olo = obb[0];\n var ohi = obb[1];\n for (var j = 0; j < 3; ++j) {\n lo[j] = Math.min(lo[j], olo[j]);\n hi[j] = Math.max(hi[j], ohi[j]);\n }\n }\n }\n var bounds2 = scene.bounds;\n if (scene.autoBounds) {\n for (var j = 0; j < 3; ++j) {\n if (hi[j] < lo[j]) {\n lo[j] = -1;\n hi[j] = 1;\n } else {\n if (lo[j] === hi[j]) {\n lo[j] -= 1;\n hi[j] += 1;\n }\n var padding = 0.05 * (hi[j] - lo[j]);\n lo[j] = lo[j] - padding;\n hi[j] = hi[j] + padding;\n }\n bounds2[0][j] = lo[j];\n bounds2[1][j] = hi[j];\n }\n }\n var boundsChanged = false;\n for (var j = 0; j < 3; ++j) {\n boundsChanged = boundsChanged || prevBounds[0][j] !== bounds2[0][j] || prevBounds[1][j] !== bounds2[1][j];\n prevBounds[0][j] = bounds2[0][j];\n prevBounds[1][j] = bounds2[1][j];\n }\n pickDirty = pickDirty || boundsChanged;\n dirty = dirty || boundsChanged;\n if (!dirty) {\n return;\n }\n if (boundsChanged) {\n var tickSpacing = [0, 0, 0];\n for (var i = 0; i < 3; ++i) {\n tickSpacing[i] = roundUpPow10((bounds2[1][i] - bounds2[0][i]) / 10);\n }\n if (axes.autoTicks) {\n axes.update({\n bounds: bounds2,\n tickSpacing\n });\n } else {\n axes.update({\n bounds: bounds2\n });\n }\n }\n var width = gl2.drawingBufferWidth;\n var height = gl2.drawingBufferHeight;\n viewShape[0] = width;\n viewShape[1] = height;\n pickShape[0] = Math.max(width / scene.pixelRatio, 1) | 0;\n pickShape[1] = Math.max(height / scene.pixelRatio, 1) | 0;\n calcCameraParams(scene, isOrtho);\n for (var i = 0; i < numObjs; ++i) {\n var obj = objects[i];\n obj.axesBounds = bounds2;\n if (scene.clipToBounds) {\n obj.clipBounds = bounds2;\n }\n }\n if (selection.object) {\n if (scene.snapToData) {\n spikes.position = selection.dataCoordinate;\n } else {\n spikes.position = selection.dataPosition;\n }\n spikes.bounds = bounds2;\n }\n if (pickDirty) {\n pickDirty = false;\n renderPick();\n }\n scene.axesPixels = axesRanges(scene.axes, cameraParams, width, height);\n if (scene.onrender) {\n scene.onrender();\n }\n gl2.bindFramebuffer(gl2.FRAMEBUFFER, null);\n gl2.viewport(0, 0, width, height);\n scene.clearRGBA();\n gl2.depthMask(true);\n gl2.colorMask(true, true, true, true);\n gl2.enable(gl2.DEPTH_TEST);\n gl2.depthFunc(gl2.LEQUAL);\n gl2.disable(gl2.BLEND);\n gl2.disable(gl2.CULL_FACE);\n var hasTransparent = false;\n if (axes.enable) {\n hasTransparent = hasTransparent || axes.isTransparent();\n axes.draw(cameraParams);\n }\n spikes.axes = axes;\n if (selection.object) {\n spikes.draw(cameraParams);\n }\n gl2.disable(gl2.CULL_FACE);\n for (var i = 0; i < numObjs; ++i) {\n var obj = objects[i];\n obj.axes = axes;\n obj.pixelRatio = scene.pixelRatio;\n if (obj.isOpaque && obj.isOpaque()) {\n obj.draw(cameraParams);\n }\n if (obj.isTransparent && obj.isTransparent()) {\n hasTransparent = true;\n }\n }\n if (hasTransparent) {\n accumBuffer.shape = viewShape;\n accumBuffer.bind();\n gl2.clear(gl2.DEPTH_BUFFER_BIT);\n gl2.colorMask(false, false, false, false);\n gl2.depthMask(true);\n gl2.depthFunc(gl2.LESS);\n if (axes.enable && axes.isTransparent()) {\n axes.drawTransparent(cameraParams);\n }\n for (var i = 0; i < numObjs; ++i) {\n var obj = objects[i];\n if (obj.isOpaque && obj.isOpaque()) {\n obj.draw(cameraParams);\n }\n }\n gl2.enable(gl2.BLEND);\n gl2.blendEquation(gl2.FUNC_ADD);\n gl2.blendFunc(gl2.ONE, gl2.ONE_MINUS_SRC_ALPHA);\n gl2.colorMask(true, true, true, true);\n gl2.depthMask(false);\n gl2.clearColor(0, 0, 0, 0);\n gl2.clear(gl2.COLOR_BUFFER_BIT);\n if (axes.isTransparent()) {\n axes.drawTransparent(cameraParams);\n }\n for (var i = 0; i < numObjs; ++i) {\n var obj = objects[i];\n if (obj.isTransparent && obj.isTransparent()) {\n obj.drawTransparent(cameraParams);\n }\n }\n gl2.bindFramebuffer(gl2.FRAMEBUFFER, null);\n gl2.blendFunc(gl2.ONE, gl2.ONE_MINUS_SRC_ALPHA);\n gl2.disable(gl2.DEPTH_TEST);\n accumShader.bind();\n accumBuffer.color[0].bind(0);\n accumShader.uniforms.accumBuffer = 0;\n drawTriangle(gl2);\n gl2.disable(gl2.BLEND);\n }\n dirty = false;\n for (var i = 0; i < numObjs; ++i) {\n objects[i].dirty = false;\n }\n }\n function render() {\n if (scene._stopped || scene.contextLost) {\n return;\n }\n redraw();\n requestAnimationFrame(render);\n }\n scene.enableMouseListeners();\n render();\n scene.redraw = function() {\n if (scene._stopped) {\n return;\n }\n dirty = true;\n redraw();\n };\n return scene;\n }\n function calcCameraParams(scene, isOrtho) {\n var bounds = scene.bounds;\n var cameraParams = scene.cameraParams;\n var projection = cameraParams.projection;\n var model = cameraParams.model;\n var width = scene.gl.drawingBufferWidth;\n var height = scene.gl.drawingBufferHeight;\n var zNear = scene.zNear;\n var zFar = scene.zFar;\n var fovy = scene.fovy;\n var r = width / height;\n if (isOrtho) {\n ortho(\n projection,\n -r,\n r,\n -1,\n 1,\n zNear,\n zFar\n );\n cameraParams._ortho = true;\n } else {\n perspective(\n projection,\n fovy,\n r,\n zNear,\n zFar\n );\n cameraParams._ortho = false;\n }\n for (var i = 0; i < 16; ++i) {\n model[i] = 0;\n }\n model[15] = 1;\n var maxS = 0;\n for (var i = 0; i < 3; ++i) {\n maxS = Math.max(maxS, bounds[1][i] - bounds[0][i]);\n }\n for (var i = 0; i < 3; ++i) {\n if (scene.autoScale) {\n model[5 * i] = scene.aspect[i] / (bounds[1][i] - bounds[0][i]);\n } else {\n model[5 * i] = 1 / maxS;\n }\n if (scene.autoCenter) {\n model[12 + i] = -model[5 * i] * 0.5 * (bounds[0][i] + bounds[1][i]);\n }\n }\n }\n }\n ),\n /***/\n 783: (\n /***/\n function(module2) {\n module2.exports = slerp;\n function slerp(out, a, b, t) {\n var ax = a[0], ay = a[1], az = a[2], aw = a[3], bx = b[0], by = b[1], bz = b[2], bw = b[3];\n var omega, cosom, sinom, scale0, scale1;\n cosom = ax * bx + ay * by + az * bz + aw * bw;\n if (cosom < 0) {\n cosom = -cosom;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n if (1 - cosom > 1e-6) {\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else {\n scale0 = 1 - t;\n scale1 = t;\n }\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n return out;\n }\n }\n ),\n /***/\n 5964: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = function(a) {\n return !a && a !== 0 ? \"\" : a.toString();\n };\n }\n ),\n /***/\n 9366: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var vectorizeText = __webpack_require__2(4359);\n module2.exports = getGlyph;\n var GLYPH_CACHE = {};\n function getGlyph(symbol, font, pixelRatio) {\n var fontKey = [\n font.style,\n font.weight,\n font.variant,\n font.family\n ].join(\"_\");\n var fontCache = GLYPH_CACHE[fontKey];\n if (!fontCache) {\n fontCache = GLYPH_CACHE[fontKey] = {};\n }\n if (symbol in fontCache) {\n return fontCache[symbol];\n }\n var config = {\n textAlign: \"center\",\n textBaseline: \"middle\",\n lineHeight: 1,\n font: font.family,\n fontStyle: font.style,\n fontWeight: font.weight,\n fontVariant: font.variant,\n lineSpacing: 1.25,\n styletags: {\n breaklines: true,\n bolds: true,\n italics: true,\n subscripts: true,\n superscripts: true\n }\n };\n config.triangles = true;\n var triSymbol = vectorizeText(symbol, config);\n config.triangles = false;\n var lineSymbol = vectorizeText(symbol, config);\n var i, j;\n if (pixelRatio && pixelRatio !== 1) {\n for (i = 0; i < triSymbol.positions.length; ++i) {\n for (j = 0; j < triSymbol.positions[i].length; ++j) {\n triSymbol.positions[i][j] /= pixelRatio;\n }\n }\n for (i = 0; i < lineSymbol.positions.length; ++i) {\n for (j = 0; j < lineSymbol.positions[i].length; ++j) {\n lineSymbol.positions[i][j] /= pixelRatio;\n }\n }\n }\n var bounds = [[Infinity, Infinity], [-Infinity, -Infinity]];\n var n = lineSymbol.positions.length;\n for (i = 0; i < n; ++i) {\n var p = lineSymbol.positions[i];\n for (j = 0; j < 2; ++j) {\n bounds[0][j] = Math.min(bounds[0][j], p[j]);\n bounds[1][j] = Math.max(bounds[1][j], p[j]);\n }\n }\n return fontCache[symbol] = [triSymbol, lineSymbol, bounds];\n }\n }\n ),\n /***/\n 1283: (\n /***/\n function(__unused_webpack_module, exports2, __webpack_require__2) {\n var createShaderWrapper = __webpack_require__2(9405);\n var glslify = __webpack_require__2(3236);\n var perspectiveVertSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nattribute vec3 position;\\nattribute vec4 color;\\nattribute vec2 glyph;\\nattribute vec4 id;\\n\\nuniform vec4 highlightId;\\nuniform float highlightScale;\\nuniform mat4 model, view, projection;\\nuniform vec3 clipBounds[2];\\n\\nvarying vec4 interpColor;\\nvarying vec4 pickId;\\nvarying vec3 dataCoordinate;\\n\\nvoid main() {\\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\\n\\n gl_Position = vec4(0,0,0,0);\\n } else {\\n float scale = 1.0;\\n if(distance(highlightId, id) < 0.0001) {\\n scale = highlightScale;\\n }\\n\\n vec4 worldPosition = model * vec4(position, 1);\\n vec4 viewPosition = view * worldPosition;\\n viewPosition = viewPosition / viewPosition.w;\\n vec4 clipPosition = projection * (viewPosition + scale * vec4(glyph.x, -glyph.y, 0, 0));\\n\\n gl_Position = clipPosition;\\n interpColor = color;\\n pickId = id;\\n dataCoordinate = position;\\n }\\n}\"]);\n var orthographicVertSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nattribute vec3 position;\\nattribute vec4 color;\\nattribute vec2 glyph;\\nattribute vec4 id;\\n\\nuniform mat4 model, view, projection;\\nuniform vec2 screenSize;\\nuniform vec3 clipBounds[2];\\nuniform float highlightScale, pixelRatio;\\nuniform vec4 highlightId;\\n\\nvarying vec4 interpColor;\\nvarying vec4 pickId;\\nvarying vec3 dataCoordinate;\\n\\nvoid main() {\\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\\n\\n gl_Position = vec4(0,0,0,0);\\n } else {\\n float scale = pixelRatio;\\n if(distance(highlightId.bgr, id.bgr) < 0.001) {\\n scale *= highlightScale;\\n }\\n\\n vec4 worldPosition = model * vec4(position, 1.0);\\n vec4 viewPosition = view * worldPosition;\\n vec4 clipPosition = projection * viewPosition;\\n clipPosition /= clipPosition.w;\\n\\n gl_Position = clipPosition + vec4(screenSize * scale * vec2(glyph.x, -glyph.y), 0.0, 0.0);\\n interpColor = color;\\n pickId = id;\\n dataCoordinate = position;\\n }\\n}\"]);\n var projectionVertSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nattribute vec3 position;\\nattribute vec4 color;\\nattribute vec2 glyph;\\nattribute vec4 id;\\n\\nuniform float highlightScale;\\nuniform vec4 highlightId;\\nuniform vec3 axes[2];\\nuniform mat4 model, view, projection;\\nuniform vec2 screenSize;\\nuniform vec3 clipBounds[2];\\nuniform float scale, pixelRatio;\\n\\nvarying vec4 interpColor;\\nvarying vec4 pickId;\\nvarying vec3 dataCoordinate;\\n\\nvoid main() {\\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\\n\\n gl_Position = vec4(0,0,0,0);\\n } else {\\n float lscale = pixelRatio * scale;\\n if(distance(highlightId, id) < 0.0001) {\\n lscale *= highlightScale;\\n }\\n\\n vec4 clipCenter = projection * (view * (model * vec4(position, 1)));\\n vec3 dataPosition = position + 0.5*lscale*(axes[0] * glyph.x + axes[1] * glyph.y) * clipCenter.w * screenSize.y;\\n vec4 clipPosition = projection * (view * (model * vec4(dataPosition, 1)));\\n\\n gl_Position = clipPosition;\\n interpColor = color;\\n pickId = id;\\n dataCoordinate = dataPosition;\\n }\\n}\\n\"]);\n var drawFragSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nuniform vec3 fragClipBounds[2];\\nuniform float opacity;\\n\\nvarying vec4 interpColor;\\nvarying vec3 dataCoordinate;\\n\\nvoid main() {\\n if (\\n outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate) ||\\n interpColor.a * opacity == 0.\\n ) discard;\\n gl_FragColor = interpColor * opacity;\\n}\\n\"]);\n var pickFragSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nuniform vec3 fragClipBounds[2];\\nuniform float pickGroup;\\n\\nvarying vec4 pickId;\\nvarying vec3 dataCoordinate;\\n\\nvoid main() {\\n if (outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate)) discard;\\n\\n gl_FragColor = vec4(pickGroup, pickId.bgr);\\n}\"]);\n var ATTRIBUTES = [\n { name: \"position\", type: \"vec3\" },\n { name: \"color\", type: \"vec4\" },\n { name: \"glyph\", type: \"vec2\" },\n { name: \"id\", type: \"vec4\" }\n ];\n var perspective = {\n vertex: perspectiveVertSrc,\n fragment: drawFragSrc,\n attributes: ATTRIBUTES\n }, ortho = {\n vertex: orthographicVertSrc,\n fragment: drawFragSrc,\n attributes: ATTRIBUTES\n }, project = {\n vertex: projectionVertSrc,\n fragment: drawFragSrc,\n attributes: ATTRIBUTES\n }, pickPerspective = {\n vertex: perspectiveVertSrc,\n fragment: pickFragSrc,\n attributes: ATTRIBUTES\n }, pickOrtho = {\n vertex: orthographicVertSrc,\n fragment: pickFragSrc,\n attributes: ATTRIBUTES\n }, pickProject = {\n vertex: projectionVertSrc,\n fragment: pickFragSrc,\n attributes: ATTRIBUTES\n };\n function createShader(gl2, src) {\n var shader = createShaderWrapper(gl2, src);\n var attr = shader.attributes;\n attr.position.location = 0;\n attr.color.location = 1;\n attr.glyph.location = 2;\n attr.id.location = 3;\n return shader;\n }\n exports2.createPerspective = function(gl2) {\n return createShader(gl2, perspective);\n };\n exports2.createOrtho = function(gl2) {\n return createShader(gl2, ortho);\n };\n exports2.createProject = function(gl2) {\n return createShader(gl2, project);\n };\n exports2.createPickPerspective = function(gl2) {\n return createShader(gl2, pickPerspective);\n };\n exports2.createPickOrtho = function(gl2) {\n return createShader(gl2, pickOrtho);\n };\n exports2.createPickProject = function(gl2) {\n return createShader(gl2, pickProject);\n };\n }\n ),\n /***/\n 8418: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var isAllBlank = __webpack_require__2(5219);\n var createBuffer = __webpack_require__2(2762);\n var createVAO = __webpack_require__2(8116);\n var pool = __webpack_require__2(1888);\n var mat4mult = __webpack_require__2(6760);\n var shaders = __webpack_require__2(1283);\n var getGlyph = __webpack_require__2(9366);\n var getSimpleString = __webpack_require__2(5964);\n var IDENTITY = [\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ];\n var ab = ArrayBuffer;\n var dv = DataView;\n function isTypedArray(a) {\n return ab.isView(a) && !(a instanceof dv);\n }\n function isArrayOrTypedArray(a) {\n return Array.isArray(a) || isTypedArray(a);\n }\n module2.exports = createPointCloud;\n function transformMat4(x, m) {\n var x0 = x[0];\n var x1 = x[1];\n var x2 = x[2];\n var x3 = x[3];\n x[0] = m[0] * x0 + m[4] * x1 + m[8] * x2 + m[12] * x3;\n x[1] = m[1] * x0 + m[5] * x1 + m[9] * x2 + m[13] * x3;\n x[2] = m[2] * x0 + m[6] * x1 + m[10] * x2 + m[14] * x3;\n x[3] = m[3] * x0 + m[7] * x1 + m[11] * x2 + m[15] * x3;\n return x;\n }\n function project(p, v, m, x) {\n transformMat4(x, x, m);\n transformMat4(x, x, v);\n return transformMat4(x, x, p);\n }\n function ScatterPlotPickResult(index, position) {\n this.index = index;\n this.dataCoordinate = this.position = position;\n }\n function fixOpacity(a) {\n if (a === true) return 1;\n if (a > 1) return 1;\n return a;\n }\n function PointCloud(gl2, shader, orthoShader, projectShader, pointBuffer, colorBuffer, glyphBuffer, idBuffer, vao, pickPerspectiveShader, pickOrthoShader, pickProjectShader) {\n this.gl = gl2;\n this.pixelRatio = 1;\n this.shader = shader;\n this.orthoShader = orthoShader;\n this.projectShader = projectShader;\n this.pointBuffer = pointBuffer;\n this.colorBuffer = colorBuffer;\n this.glyphBuffer = glyphBuffer;\n this.idBuffer = idBuffer;\n this.vao = vao;\n this.vertexCount = 0;\n this.lineVertexCount = 0;\n this.opacity = 1;\n this.hasAlpha = false;\n this.lineWidth = 0;\n this.projectScale = [2 / 3, 2 / 3, 2 / 3];\n this.projectOpacity = [1, 1, 1];\n this.projectHasAlpha = false;\n this.pickId = 0;\n this.pickPerspectiveShader = pickPerspectiveShader;\n this.pickOrthoShader = pickOrthoShader;\n this.pickProjectShader = pickProjectShader;\n this.points = [];\n this._selectResult = new ScatterPlotPickResult(0, [0, 0, 0]);\n this.useOrtho = true;\n this.bounds = [\n [Infinity, Infinity, Infinity],\n [-Infinity, -Infinity, -Infinity]\n ];\n this.axesProject = [true, true, true];\n this.axesBounds = [\n [-Infinity, -Infinity, -Infinity],\n [Infinity, Infinity, Infinity]\n ];\n this.highlightId = [1, 1, 1, 1];\n this.highlightScale = 2;\n this.clipBounds = [\n [-Infinity, -Infinity, -Infinity],\n [Infinity, Infinity, Infinity]\n ];\n this.dirty = true;\n }\n var proto = PointCloud.prototype;\n proto.pickSlots = 1;\n proto.setPickBase = function(pickBase) {\n this.pickId = pickBase;\n };\n proto.isTransparent = function() {\n if (this.hasAlpha) {\n return true;\n }\n for (var i = 0; i < 3; ++i) {\n if (this.axesProject[i] && this.projectHasAlpha) {\n return true;\n }\n }\n return false;\n };\n proto.isOpaque = function() {\n if (!this.hasAlpha) {\n return true;\n }\n for (var i = 0; i < 3; ++i) {\n if (this.axesProject[i] && !this.projectHasAlpha) {\n return true;\n }\n }\n return false;\n };\n var VIEW_SHAPE = [0, 0];\n var U_VEC = [0, 0, 0];\n var V_VEC = [0, 0, 0];\n var MU_VEC = [0, 0, 0, 1];\n var MV_VEC = [0, 0, 0, 1];\n var SCRATCH_MATRIX = IDENTITY.slice();\n var SCRATCH_VEC = [0, 0, 0];\n var CLIP_BOUNDS = [[0, 0, 0], [0, 0, 0]];\n function zeroVec(a) {\n a[0] = a[1] = a[2] = 0;\n return a;\n }\n function augment(hg, af) {\n hg[0] = af[0];\n hg[1] = af[1];\n hg[2] = af[2];\n hg[3] = 1;\n return hg;\n }\n function setComponent(out, v, i, x) {\n out[0] = v[0];\n out[1] = v[1];\n out[2] = v[2];\n out[i] = x;\n return out;\n }\n function getClipBounds(bounds) {\n var result = CLIP_BOUNDS;\n for (var i = 0; i < 2; ++i) {\n for (var j = 0; j < 3; ++j) {\n result[i][j] = Math.max(Math.min(bounds[i][j], 1e8), -1e8);\n }\n }\n return result;\n }\n function drawProject(shader, points, camera, pixelRatio) {\n var axesProject = points.axesProject;\n var gl2 = points.gl;\n var uniforms = shader.uniforms;\n var model = camera.model || IDENTITY;\n var view = camera.view || IDENTITY;\n var projection = camera.projection || IDENTITY;\n var bounds = points.axesBounds;\n var clipBounds = getClipBounds(points.clipBounds);\n var cubeAxis;\n if (points.axes && points.axes.lastCubeProps) {\n cubeAxis = points.axes.lastCubeProps.axis;\n } else {\n cubeAxis = [1, 1, 1];\n }\n VIEW_SHAPE[0] = 2 / gl2.drawingBufferWidth;\n VIEW_SHAPE[1] = 2 / gl2.drawingBufferHeight;\n shader.bind();\n uniforms.view = view;\n uniforms.projection = projection;\n uniforms.screenSize = VIEW_SHAPE;\n uniforms.highlightId = points.highlightId;\n uniforms.highlightScale = points.highlightScale;\n uniforms.clipBounds = clipBounds;\n uniforms.pickGroup = points.pickId / 255;\n uniforms.pixelRatio = pixelRatio;\n for (var i = 0; i < 3; ++i) {\n if (!axesProject[i]) {\n continue;\n }\n uniforms.scale = points.projectScale[i];\n uniforms.opacity = points.projectOpacity[i];\n var pmodel = SCRATCH_MATRIX;\n for (var j = 0; j < 16; ++j) {\n pmodel[j] = 0;\n }\n for (var j = 0; j < 4; ++j) {\n pmodel[5 * j] = 1;\n }\n pmodel[5 * i] = 0;\n if (cubeAxis[i] < 0) {\n pmodel[12 + i] = bounds[0][i];\n } else {\n pmodel[12 + i] = bounds[1][i];\n }\n mat4mult(pmodel, model, pmodel);\n uniforms.model = pmodel;\n var u = (i + 1) % 3;\n var v = (i + 2) % 3;\n var du = zeroVec(U_VEC);\n var dv2 = zeroVec(V_VEC);\n du[u] = 1;\n dv2[v] = 1;\n var mdu = project(projection, view, model, augment(MU_VEC, du));\n var mdv = project(projection, view, model, augment(MV_VEC, dv2));\n if (Math.abs(mdu[1]) > Math.abs(mdv[1])) {\n var tmp = mdu;\n mdu = mdv;\n mdv = tmp;\n tmp = du;\n du = dv2;\n dv2 = tmp;\n var t = u;\n u = v;\n v = t;\n }\n if (mdu[0] < 0) {\n du[u] = -1;\n }\n if (mdv[1] > 0) {\n dv2[v] = -1;\n }\n var su = 0;\n var sv = 0;\n for (var j = 0; j < 4; ++j) {\n su += Math.pow(model[4 * u + j], 2);\n sv += Math.pow(model[4 * v + j], 2);\n }\n du[u] /= Math.sqrt(su);\n dv2[v] /= Math.sqrt(sv);\n uniforms.axes[0] = du;\n uniforms.axes[1] = dv2;\n uniforms.fragClipBounds[0] = setComponent(SCRATCH_VEC, clipBounds[0], i, -1e8);\n uniforms.fragClipBounds[1] = setComponent(SCRATCH_VEC, clipBounds[1], i, 1e8);\n points.vao.bind();\n points.vao.draw(gl2.TRIANGLES, points.vertexCount);\n if (points.lineWidth > 0) {\n gl2.lineWidth(points.lineWidth * pixelRatio);\n points.vao.draw(gl2.LINES, points.lineVertexCount, points.vertexCount);\n }\n points.vao.unbind();\n }\n }\n var NEG_INFINITY3 = [-1e8, -1e8, -1e8];\n var POS_INFINITY3 = [1e8, 1e8, 1e8];\n var CLIP_GROUP = [NEG_INFINITY3, POS_INFINITY3];\n function drawFull(shader, pshader, points, camera, pixelRatio, transparent, forceDraw) {\n var gl2 = points.gl;\n if (transparent === points.projectHasAlpha || forceDraw) {\n drawProject(pshader, points, camera, pixelRatio);\n }\n if (transparent === points.hasAlpha || forceDraw) {\n shader.bind();\n var uniforms = shader.uniforms;\n uniforms.model = camera.model || IDENTITY;\n uniforms.view = camera.view || IDENTITY;\n uniforms.projection = camera.projection || IDENTITY;\n VIEW_SHAPE[0] = 2 / gl2.drawingBufferWidth;\n VIEW_SHAPE[1] = 2 / gl2.drawingBufferHeight;\n uniforms.screenSize = VIEW_SHAPE;\n uniforms.highlightId = points.highlightId;\n uniforms.highlightScale = points.highlightScale;\n uniforms.fragClipBounds = CLIP_GROUP;\n uniforms.clipBounds = points.axes.bounds;\n uniforms.opacity = points.opacity;\n uniforms.pickGroup = points.pickId / 255;\n uniforms.pixelRatio = pixelRatio;\n points.vao.bind();\n points.vao.draw(gl2.TRIANGLES, points.vertexCount);\n if (points.lineWidth > 0) {\n gl2.lineWidth(points.lineWidth * pixelRatio);\n points.vao.draw(gl2.LINES, points.lineVertexCount, points.vertexCount);\n }\n points.vao.unbind();\n }\n }\n proto.draw = function(camera) {\n var shader = this.useOrtho ? this.orthoShader : this.shader;\n drawFull(shader, this.projectShader, this, camera, this.pixelRatio, false, false);\n };\n proto.drawTransparent = function(camera) {\n var shader = this.useOrtho ? this.orthoShader : this.shader;\n drawFull(shader, this.projectShader, this, camera, this.pixelRatio, true, false);\n };\n proto.drawPick = function(camera) {\n var shader = this.useOrtho ? this.pickOrthoShader : this.pickPerspectiveShader;\n drawFull(shader, this.pickProjectShader, this, camera, 1, true, true);\n };\n proto.pick = function(selected) {\n if (!selected) {\n return null;\n }\n if (selected.id !== this.pickId) {\n return null;\n }\n var x = selected.value[2] + (selected.value[1] << 8) + (selected.value[0] << 16);\n if (x >= this.pointCount || x < 0) {\n return null;\n }\n var coord = this.points[x];\n var result = this._selectResult;\n result.index = x;\n for (var i = 0; i < 3; ++i) {\n result.position[i] = result.dataCoordinate[i] = coord[i];\n }\n return result;\n };\n proto.highlight = function(selection) {\n if (!selection) {\n this.highlightId = [1, 1, 1, 1];\n } else {\n var pointId = selection.index;\n var a0 = pointId & 255;\n var a1 = pointId >> 8 & 255;\n var a2 = pointId >> 16 & 255;\n this.highlightId = [a0 / 255, a1 / 255, a2 / 255, 0];\n }\n };\n function get_glyphData(glyphs, index, font, pixelRatio) {\n var str;\n if (isArrayOrTypedArray(glyphs)) {\n if (index < glyphs.length) {\n str = glyphs[index];\n } else {\n str = void 0;\n }\n } else {\n str = glyphs;\n }\n str = getSimpleString(str);\n var visible = true;\n if (isAllBlank(str)) {\n str = \"\\u25BC\";\n visible = false;\n }\n if (!font) font = {};\n var family = font.family;\n if (isArrayOrTypedArray(family)) family = family[index];\n if (!family) family = \"normal\";\n var weight = font.weight;\n if (isArrayOrTypedArray(weight)) weight = weight[index];\n if (!weight) weight = \"normal\";\n var style = font.style;\n if (isArrayOrTypedArray(style)) style = style[index];\n if (!style) style = \"normal\";\n var variant = font.variant;\n if (isArrayOrTypedArray(variant)) variant = variant[index];\n if (!variant) variant = \"normal\";\n var glyph = getGlyph(str, {\n family,\n weight,\n style,\n variant\n }, pixelRatio);\n var glyph = getGlyph(str, font, pixelRatio);\n return {\n mesh: glyph[0],\n lines: glyph[1],\n bounds: glyph[2],\n visible\n };\n }\n proto.update = function(options) {\n options = options || {};\n if (\"perspective\" in options) {\n this.useOrtho = !options.perspective;\n }\n if (\"orthographic\" in options) {\n this.useOrtho = !!options.orthographic;\n }\n if (\"lineWidth\" in options) {\n this.lineWidth = options.lineWidth;\n }\n if (\"project\" in options) {\n if (isArrayOrTypedArray(options.project)) {\n this.axesProject = options.project;\n } else {\n var v = !!options.project;\n this.axesProject = [v, v, v];\n }\n }\n if (\"projectScale\" in options) {\n if (isArrayOrTypedArray(options.projectScale)) {\n this.projectScale = options.projectScale.slice();\n } else {\n var s = +options.projectScale;\n this.projectScale = [s, s, s];\n }\n }\n this.projectHasAlpha = false;\n if (\"projectOpacity\" in options) {\n if (isArrayOrTypedArray(options.projectOpacity)) {\n this.projectOpacity = options.projectOpacity.slice();\n } else {\n var s = +options.projectOpacity;\n this.projectOpacity = [s, s, s];\n }\n for (var i = 0; i < 3; ++i) {\n this.projectOpacity[i] = fixOpacity(this.projectOpacity[i]);\n if (this.projectOpacity[i] < 1) {\n this.projectHasAlpha = true;\n }\n }\n }\n this.hasAlpha = false;\n if (\"opacity\" in options) {\n this.opacity = fixOpacity(options.opacity);\n if (this.opacity < 1) {\n this.hasAlpha = true;\n }\n }\n this.dirty = true;\n var points = options.position;\n var font = {\n family: options.font || \"normal\",\n style: options.fontStyle || \"normal\",\n weight: options.fontWeight || \"normal\",\n variant: options.fontVariant || \"normal\"\n };\n var alignment = options.alignment || [0, 0];\n var alignmentX;\n var alignmentY;\n if (alignment.length === 2) {\n alignmentX = alignment[0];\n alignmentY = alignment[1];\n } else {\n alignmentX = [];\n alignmentY = [];\n for (var i = 0; i < alignment.length; ++i) {\n alignmentX[i] = alignment[i][0];\n alignmentY[i] = alignment[i][1];\n }\n }\n var lowerBound = [Infinity, Infinity, Infinity];\n var upperBound = [-Infinity, -Infinity, -Infinity];\n var glyphs = options.glyph;\n var colors = options.color;\n var sizes = options.size;\n var angles = options.angle;\n var lineColors = options.lineColor;\n var pickCounter = -1;\n var triVertexCount = 0;\n var lineVertexCount = 0;\n var numPoints = 0;\n if (points.length) {\n numPoints = points.length;\n count_loop:\n for (var i = 0; i < numPoints; ++i) {\n var x = points[i];\n for (var j = 0; j < 3; ++j) {\n if (isNaN(x[j]) || !isFinite(x[j])) {\n continue count_loop;\n }\n }\n var glyphData = get_glyphData(glyphs, i, font, this.pixelRatio);\n var glyphMesh = glyphData.mesh;\n var glyphLines = glyphData.lines;\n var glyphBounds = glyphData.bounds;\n triVertexCount += glyphMesh.cells.length * 3;\n lineVertexCount += glyphLines.edges.length * 2;\n }\n }\n var vertexCount = triVertexCount + lineVertexCount;\n var positionArray = pool.mallocFloat(3 * vertexCount);\n var colorArray = pool.mallocFloat(4 * vertexCount);\n var glyphArray = pool.mallocFloat(2 * vertexCount);\n var idArray = pool.mallocUint32(vertexCount);\n if (vertexCount > 0) {\n var triOffset = 0;\n var lineOffset = triVertexCount;\n var color2 = [0, 0, 0, 1];\n var lineColor = [0, 0, 0, 1];\n var isColorArray = isArrayOrTypedArray(colors) && isArrayOrTypedArray(colors[0]);\n var isLineColorArray = isArrayOrTypedArray(lineColors) && isArrayOrTypedArray(lineColors[0]);\n fill_loop:\n for (var i = 0; i < numPoints; ++i) {\n pickCounter += 1;\n var x = points[i];\n for (var j = 0; j < 3; ++j) {\n if (isNaN(x[j]) || !isFinite(x[j])) {\n continue fill_loop;\n }\n upperBound[j] = Math.max(upperBound[j], x[j]);\n lowerBound[j] = Math.min(lowerBound[j], x[j]);\n }\n var glyphData = get_glyphData(glyphs, i, font, this.pixelRatio);\n var glyphMesh = glyphData.mesh;\n var glyphLines = glyphData.lines;\n var glyphBounds = glyphData.bounds;\n var glyphVisible = glyphData.visible;\n if (!glyphVisible) color2 = [1, 1, 1, 0];\n else if (isArrayOrTypedArray(colors)) {\n var c;\n if (isColorArray) {\n if (i < colors.length) {\n c = colors[i];\n } else {\n c = [0, 0, 0, 0];\n }\n } else {\n c = colors;\n }\n if (c.length === 3) {\n for (var j = 0; j < 3; ++j) {\n color2[j] = c[j];\n }\n color2[3] = 1;\n } else if (c.length === 4) {\n for (var j = 0; j < 4; ++j) {\n color2[j] = c[j];\n }\n if (!this.hasAlpha && c[3] < 1) this.hasAlpha = true;\n }\n } else {\n color2[0] = color2[1] = color2[2] = 0;\n color2[3] = 1;\n }\n if (!glyphVisible) lineColor = [1, 1, 1, 0];\n else if (isArrayOrTypedArray(lineColors)) {\n var c;\n if (isLineColorArray) {\n if (i < lineColors.length) {\n c = lineColors[i];\n } else {\n c = [0, 0, 0, 0];\n }\n } else {\n c = lineColors;\n }\n if (c.length === 3) {\n for (var j = 0; j < 3; ++j) {\n lineColor[j] = c[j];\n }\n lineColor[j] = 1;\n } else if (c.length === 4) {\n for (var j = 0; j < 4; ++j) {\n lineColor[j] = c[j];\n }\n if (!this.hasAlpha && c[3] < 1) this.hasAlpha = true;\n }\n } else {\n lineColor[0] = lineColor[1] = lineColor[2] = 0;\n lineColor[3] = 1;\n }\n var size = 0.5;\n if (!glyphVisible) size = 0;\n else if (isArrayOrTypedArray(sizes)) {\n if (i < sizes.length) {\n size = +sizes[i];\n } else {\n size = 12;\n }\n } else if (sizes) {\n size = +sizes;\n } else if (this.useOrtho) {\n size = 12;\n }\n var angle = 0;\n if (isArrayOrTypedArray(angles)) {\n if (i < angles.length) {\n angle = +angles[i];\n } else {\n angle = 0;\n }\n } else if (angles) {\n angle = +angles;\n }\n var cos = Math.cos(angle);\n var sin = Math.sin(angle);\n var x = points[i];\n for (var j = 0; j < 3; ++j) {\n upperBound[j] = Math.max(upperBound[j], x[j]);\n lowerBound[j] = Math.min(lowerBound[j], x[j]);\n }\n var textOffsetX = alignmentX;\n var textOffsetY = alignmentY;\n var textOffsetX = 0;\n if (isArrayOrTypedArray(alignmentX)) {\n if (i < alignmentX.length) {\n textOffsetX = alignmentX[i];\n } else {\n textOffsetX = 0;\n }\n } else if (alignmentX) {\n textOffsetX = alignmentX;\n }\n var textOffsetY = 0;\n if (isArrayOrTypedArray(alignmentY)) {\n if (i < alignmentY.length) {\n textOffsetY = alignmentY[i];\n } else {\n textOffsetY = 0;\n }\n } else if (alignmentY) {\n textOffsetY = alignmentY;\n }\n textOffsetX *= textOffsetX > 0 ? 1 - glyphBounds[0][0] : textOffsetX < 0 ? 1 + glyphBounds[1][0] : 1;\n textOffsetY *= textOffsetY > 0 ? 1 - glyphBounds[0][1] : textOffsetY < 0 ? 1 + glyphBounds[1][1] : 1;\n var textOffset = [textOffsetX, textOffsetY];\n var cells = glyphMesh.cells || [];\n var verts = glyphMesh.positions || [];\n for (var j = 0; j < cells.length; ++j) {\n var cell = cells[j];\n for (var k = 0; k < 3; ++k) {\n for (var l = 0; l < 3; ++l) {\n positionArray[3 * triOffset + l] = x[l];\n }\n for (var l = 0; l < 4; ++l) {\n colorArray[4 * triOffset + l] = color2[l];\n }\n idArray[triOffset] = pickCounter;\n var p = verts[cell[k]];\n glyphArray[2 * triOffset] = size * (cos * p[0] - sin * p[1] + textOffset[0]);\n glyphArray[2 * triOffset + 1] = size * (sin * p[0] + cos * p[1] + textOffset[1]);\n triOffset += 1;\n }\n }\n var cells = glyphLines.edges;\n var verts = glyphLines.positions;\n for (var j = 0; j < cells.length; ++j) {\n var cell = cells[j];\n for (var k = 0; k < 2; ++k) {\n for (var l = 0; l < 3; ++l) {\n positionArray[3 * lineOffset + l] = x[l];\n }\n for (var l = 0; l < 4; ++l) {\n colorArray[4 * lineOffset + l] = lineColor[l];\n }\n idArray[lineOffset] = pickCounter;\n var p = verts[cell[k]];\n glyphArray[2 * lineOffset] = size * (cos * p[0] - sin * p[1] + textOffset[0]);\n glyphArray[2 * lineOffset + 1] = size * (sin * p[0] + cos * p[1] + textOffset[1]);\n lineOffset += 1;\n }\n }\n }\n }\n this.bounds = [lowerBound, upperBound];\n this.points = points;\n this.pointCount = points.length;\n this.vertexCount = triVertexCount;\n this.lineVertexCount = lineVertexCount;\n this.pointBuffer.update(positionArray);\n this.colorBuffer.update(colorArray);\n this.glyphBuffer.update(glyphArray);\n this.idBuffer.update(idArray);\n pool.free(positionArray);\n pool.free(colorArray);\n pool.free(glyphArray);\n pool.free(idArray);\n };\n proto.dispose = function() {\n this.shader.dispose();\n this.orthoShader.dispose();\n this.pickPerspectiveShader.dispose();\n this.pickOrthoShader.dispose();\n this.vao.dispose();\n this.pointBuffer.dispose();\n this.colorBuffer.dispose();\n this.glyphBuffer.dispose();\n this.idBuffer.dispose();\n };\n function createPointCloud(options) {\n var gl2 = options.gl;\n var shader = shaders.createPerspective(gl2);\n var orthoShader = shaders.createOrtho(gl2);\n var projectShader = shaders.createProject(gl2);\n var pickPerspectiveShader = shaders.createPickPerspective(gl2);\n var pickOrthoShader = shaders.createPickOrtho(gl2);\n var pickProjectShader = shaders.createPickProject(gl2);\n var pointBuffer = createBuffer(gl2);\n var colorBuffer = createBuffer(gl2);\n var glyphBuffer = createBuffer(gl2);\n var idBuffer = createBuffer(gl2);\n var vao = createVAO(gl2, [\n {\n buffer: pointBuffer,\n size: 3,\n type: gl2.FLOAT\n },\n {\n buffer: colorBuffer,\n size: 4,\n type: gl2.FLOAT\n },\n {\n buffer: glyphBuffer,\n size: 2,\n type: gl2.FLOAT\n },\n {\n buffer: idBuffer,\n size: 4,\n type: gl2.UNSIGNED_BYTE,\n normalized: true\n }\n ]);\n var pointCloud = new PointCloud(\n gl2,\n shader,\n orthoShader,\n projectShader,\n pointBuffer,\n colorBuffer,\n glyphBuffer,\n idBuffer,\n vao,\n pickPerspectiveShader,\n pickOrthoShader,\n pickProjectShader\n );\n pointCloud.update(options);\n return pointCloud;\n }\n }\n ),\n /***/\n 3589: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = createSelectBuffer;\n var createFBO = __webpack_require__2(2260);\n var pool = __webpack_require__2(1888);\n var ndarray = __webpack_require__2(9618);\n var nextPow2 = __webpack_require__2(8828).nextPow2;\n var selectRange = function(arr, x, y) {\n var closestD2 = 1e8;\n var closestX = -1;\n var closestY = -1;\n var ni = arr.shape[0];\n var nj = arr.shape[1];\n for (var i = 0; i < ni; i++) {\n for (var j = 0; j < nj; j++) {\n var r = arr.get(i, j, 0);\n var g = arr.get(i, j, 1);\n var b = arr.get(i, j, 2);\n var a = arr.get(i, j, 3);\n if (r < 255 || g < 255 || b < 255 || a < 255) {\n var dx = x - i;\n var dy = y - j;\n var d2 = dx * dx + dy * dy;\n if (d2 < closestD2) {\n closestD2 = d2;\n closestX = i;\n closestY = j;\n }\n }\n }\n }\n return [closestX, closestY, closestD2];\n };\n function SelectResult(x, y, id, value, distance) {\n this.coord = [x, y];\n this.id = id;\n this.value = value;\n this.distance = distance;\n }\n function SelectBuffer(gl2, fbo, buffer) {\n this.gl = gl2;\n this.fbo = fbo;\n this.buffer = buffer;\n this._readTimeout = null;\n var self2 = this;\n this._readCallback = function() {\n if (!self2.gl) {\n return;\n }\n fbo.bind();\n gl2.readPixels(0, 0, fbo.shape[0], fbo.shape[1], gl2.RGBA, gl2.UNSIGNED_BYTE, self2.buffer);\n self2._readTimeout = null;\n };\n }\n var proto = SelectBuffer.prototype;\n Object.defineProperty(proto, \"shape\", {\n get: function() {\n if (!this.gl) {\n return [0, 0];\n }\n return this.fbo.shape.slice();\n },\n set: function(v) {\n if (!this.gl) {\n return;\n }\n this.fbo.shape = v;\n var c = this.fbo.shape[0];\n var r = this.fbo.shape[1];\n if (r * c * 4 > this.buffer.length) {\n pool.free(this.buffer);\n var buffer = this.buffer = pool.mallocUint8(nextPow2(r * c * 4));\n for (var i = 0; i < r * c * 4; ++i) {\n buffer[i] = 255;\n }\n }\n return v;\n }\n });\n proto.begin = function() {\n var gl2 = this.gl;\n var shape = this.shape;\n if (!gl2) {\n return;\n }\n this.fbo.bind();\n gl2.clearColor(1, 1, 1, 1);\n gl2.clear(gl2.COLOR_BUFFER_BIT | gl2.DEPTH_BUFFER_BIT);\n };\n proto.end = function() {\n var gl2 = this.gl;\n if (!gl2) {\n return;\n }\n gl2.bindFramebuffer(gl2.FRAMEBUFFER, null);\n if (!this._readTimeout) {\n clearTimeout(this._readTimeout);\n }\n this._readTimeout = setTimeout(this._readCallback, 1);\n };\n proto.query = function(x, y, radius) {\n if (!this.gl) {\n return null;\n }\n var shape = this.fbo.shape.slice();\n x = x | 0;\n y = y | 0;\n if (typeof radius !== \"number\") {\n radius = 1;\n }\n var x0 = Math.min(Math.max(x - radius, 0), shape[0]) | 0;\n var x1 = Math.min(Math.max(x + radius, 0), shape[0]) | 0;\n var y0 = Math.min(Math.max(y - radius, 0), shape[1]) | 0;\n var y1 = Math.min(Math.max(y + radius, 0), shape[1]) | 0;\n if (x1 <= x0 || y1 <= y0) {\n return null;\n }\n var dims = [x1 - x0, y1 - y0];\n var region = ndarray(\n this.buffer,\n [dims[0], dims[1], 4],\n [4, shape[0] * 4, 1],\n 4 * (x0 + shape[0] * y0)\n );\n var closest = selectRange(region.hi(dims[0], dims[1], 1), radius, radius);\n var dx = closest[0];\n var dy = closest[1];\n if (dx < 0 || Math.pow(this.radius, 2) < closest[2]) {\n return null;\n }\n var c0 = region.get(dx, dy, 0);\n var c1 = region.get(dx, dy, 1);\n var c2 = region.get(dx, dy, 2);\n var c3 = region.get(dx, dy, 3);\n return new SelectResult(\n dx + x0 | 0,\n dy + y0 | 0,\n c0,\n [c1, c2, c3],\n Math.sqrt(closest[2])\n );\n };\n proto.dispose = function() {\n if (!this.gl) {\n return;\n }\n this.fbo.dispose();\n pool.free(this.buffer);\n this.gl = null;\n if (this._readTimeout) {\n clearTimeout(this._readTimeout);\n }\n };\n function createSelectBuffer(gl2, shape) {\n var width = shape[0];\n var height = shape[1];\n var options = {};\n var fbo = createFBO(gl2, width, height, options);\n var buffer = pool.mallocUint8(width * height * 4);\n return new SelectBuffer(gl2, fbo, buffer);\n }\n }\n ),\n /***/\n 9405: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var createUniformWrapper = __webpack_require__2(3327);\n var createAttributeWrapper = __webpack_require__2(8731);\n var makeReflect = __webpack_require__2(216);\n var shaderCache = __webpack_require__2(5091);\n var runtime = __webpack_require__2(2145);\n var GLError = __webpack_require__2(8866);\n function Shader(gl2) {\n this.gl = gl2;\n this.gl.lastAttribCount = 0;\n this._vref = this._fref = this._relink = this.vertShader = this.fragShader = this.program = this.attributes = this.uniforms = this.types = null;\n }\n var proto = Shader.prototype;\n proto.bind = function() {\n if (!this.program) {\n this._relink();\n }\n var i;\n var newAttribCount = this.gl.getProgramParameter(this.program, this.gl.ACTIVE_ATTRIBUTES);\n var oldAttribCount = this.gl.lastAttribCount;\n if (newAttribCount > oldAttribCount) {\n for (i = oldAttribCount; i < newAttribCount; i++) {\n this.gl.enableVertexAttribArray(i);\n }\n } else if (oldAttribCount > newAttribCount) {\n for (i = newAttribCount; i < oldAttribCount; i++) {\n this.gl.disableVertexAttribArray(i);\n }\n }\n this.gl.lastAttribCount = newAttribCount;\n this.gl.useProgram(this.program);\n };\n proto.dispose = function() {\n var oldAttribCount = this.gl.lastAttribCount;\n for (var i = 0; i < oldAttribCount; i++) {\n this.gl.disableVertexAttribArray(i);\n }\n this.gl.lastAttribCount = 0;\n if (this._fref) {\n this._fref.dispose();\n }\n if (this._vref) {\n this._vref.dispose();\n }\n this.attributes = this.types = this.vertShader = this.fragShader = this.program = this._relink = this._fref = this._vref = null;\n };\n function compareAttributes(a, b) {\n if (a.name < b.name) {\n return -1;\n }\n return 1;\n }\n proto.update = function(vertSource, fragSource, uniforms, attributes) {\n if (!fragSource || arguments.length === 1) {\n var obj = vertSource;\n vertSource = obj.vertex;\n fragSource = obj.fragment;\n uniforms = obj.uniforms;\n attributes = obj.attributes;\n }\n var wrapper = this;\n var gl2 = wrapper.gl;\n var pvref = wrapper._vref;\n wrapper._vref = shaderCache.shader(gl2, gl2.VERTEX_SHADER, vertSource);\n if (pvref) {\n pvref.dispose();\n }\n wrapper.vertShader = wrapper._vref.shader;\n var pfref = this._fref;\n wrapper._fref = shaderCache.shader(gl2, gl2.FRAGMENT_SHADER, fragSource);\n if (pfref) {\n pfref.dispose();\n }\n wrapper.fragShader = wrapper._fref.shader;\n if (!uniforms || !attributes) {\n var testProgram = gl2.createProgram();\n gl2.attachShader(testProgram, wrapper.fragShader);\n gl2.attachShader(testProgram, wrapper.vertShader);\n gl2.linkProgram(testProgram);\n if (!gl2.getProgramParameter(testProgram, gl2.LINK_STATUS)) {\n var errLog = gl2.getProgramInfoLog(testProgram);\n throw new GLError(errLog, \"Error linking program:\" + errLog);\n }\n uniforms = uniforms || runtime.uniforms(gl2, testProgram);\n attributes = attributes || runtime.attributes(gl2, testProgram);\n gl2.deleteProgram(testProgram);\n }\n attributes = attributes.slice();\n attributes.sort(compareAttributes);\n var attributeUnpacked = [];\n var attributeNames = [];\n var attributeLocations = [];\n var i;\n for (i = 0; i < attributes.length; ++i) {\n var attr = attributes[i];\n if (attr.type.indexOf(\"mat\") >= 0) {\n var size = attr.type.charAt(attr.type.length - 1) | 0;\n var locVector = new Array(size);\n for (var j = 0; j < size; ++j) {\n locVector[j] = attributeLocations.length;\n attributeNames.push(attr.name + \"[\" + j + \"]\");\n if (typeof attr.location === \"number\") {\n attributeLocations.push(attr.location + j);\n } else if (Array.isArray(attr.location) && attr.location.length === size && typeof attr.location[j] === \"number\") {\n attributeLocations.push(attr.location[j] | 0);\n } else {\n attributeLocations.push(-1);\n }\n }\n attributeUnpacked.push({\n name: attr.name,\n type: attr.type,\n locations: locVector\n });\n } else {\n attributeUnpacked.push({\n name: attr.name,\n type: attr.type,\n locations: [attributeLocations.length]\n });\n attributeNames.push(attr.name);\n if (typeof attr.location === \"number\") {\n attributeLocations.push(attr.location | 0);\n } else {\n attributeLocations.push(-1);\n }\n }\n }\n var curLocation = 0;\n for (i = 0; i < attributeLocations.length; ++i) {\n if (attributeLocations[i] < 0) {\n while (attributeLocations.indexOf(curLocation) >= 0) {\n curLocation += 1;\n }\n attributeLocations[i] = curLocation;\n }\n }\n var uniformLocations = new Array(uniforms.length);\n function relink() {\n wrapper.program = shaderCache.program(\n gl2,\n wrapper._vref,\n wrapper._fref,\n attributeNames,\n attributeLocations\n );\n for (var i2 = 0; i2 < uniforms.length; ++i2) {\n uniformLocations[i2] = gl2.getUniformLocation(\n wrapper.program,\n uniforms[i2].name\n );\n }\n }\n relink();\n wrapper._relink = relink;\n wrapper.types = {\n uniforms: makeReflect(uniforms),\n attributes: makeReflect(attributes)\n };\n wrapper.attributes = createAttributeWrapper(\n gl2,\n wrapper,\n attributeUnpacked,\n attributeLocations\n );\n Object.defineProperty(wrapper, \"uniforms\", createUniformWrapper(\n gl2,\n wrapper,\n uniforms,\n uniformLocations\n ));\n };\n function createShader(gl2, vertSource, fragSource, uniforms, attributes) {\n var shader = new Shader(gl2);\n shader.update(\n vertSource,\n fragSource,\n uniforms,\n attributes\n );\n return shader;\n }\n module2.exports = createShader;\n }\n ),\n /***/\n 8866: (\n /***/\n function(module2) {\n function GLError(rawError, shortMessage, longMessage) {\n this.shortMessage = shortMessage || \"\";\n this.longMessage = longMessage || \"\";\n this.rawError = rawError || \"\";\n this.message = \"gl-shader: \" + (shortMessage || rawError || \"\") + (longMessage ? \"\\n\" + longMessage : \"\");\n this.stack = new Error().stack;\n }\n GLError.prototype = new Error();\n GLError.prototype.name = \"GLError\";\n GLError.prototype.constructor = GLError;\n module2.exports = GLError;\n }\n ),\n /***/\n 8731: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = createAttributeWrapper;\n var GLError = __webpack_require__2(8866);\n function ShaderAttribute(gl2, wrapper, index, locations, dimension, constFunc) {\n this._gl = gl2;\n this._wrapper = wrapper;\n this._index = index;\n this._locations = locations;\n this._dimension = dimension;\n this._constFunc = constFunc;\n }\n var proto = ShaderAttribute.prototype;\n proto.pointer = function setAttribPointer(type, normalized, stride, offset) {\n var self2 = this;\n var gl2 = self2._gl;\n var location2 = self2._locations[self2._index];\n gl2.vertexAttribPointer(\n location2,\n self2._dimension,\n type || gl2.FLOAT,\n !!normalized,\n stride || 0,\n offset || 0\n );\n gl2.enableVertexAttribArray(location2);\n };\n proto.set = function(x0, x1, x2, x3) {\n return this._constFunc(this._locations[this._index], x0, x1, x2, x3);\n };\n Object.defineProperty(proto, \"location\", {\n get: function() {\n return this._locations[this._index];\n },\n set: function(v) {\n if (v !== this._locations[this._index]) {\n this._locations[this._index] = v | 0;\n this._wrapper.program = null;\n }\n return v | 0;\n }\n });\n var allFns = [\n function(gl2, v, x0) {\n if (x0.length === void 0) {\n return gl2.vertexAttrib1f(v, x0);\n } else {\n return gl2.vertexAttrib1fv(v, x0);\n }\n },\n function(gl2, v, x0, x1) {\n if (x0.length === void 0) {\n return gl2.vertexAttrib2f(v, x0, x1);\n } else {\n return gl2.vertexAttrib2fv(v, x0);\n }\n },\n function(gl2, v, x0, x1, x2) {\n if (x0.length === void 0) {\n return gl2.vertexAttrib3f(v, x0, x1, x2);\n } else {\n return gl2.vertexAttrib3fv(v, x0);\n }\n },\n function(gl2, v, x0, x1, x2, x3) {\n if (x0.length === void 0) {\n return gl2.vertexAttrib4f(v, x0, x1, x2, x3);\n } else {\n return gl2.vertexAttrib4fv(v, x0);\n }\n }\n ];\n function addVectorAttribute(gl2, wrapper, index, locations, dimension, obj, name2) {\n var constFunc = allFns[dimension];\n var attr = new ShaderAttribute(\n gl2,\n wrapper,\n index,\n locations,\n dimension,\n constFunc\n );\n Object.defineProperty(obj, name2, {\n set: function(x) {\n gl2.disableVertexAttribArray(locations[index]);\n constFunc(gl2, locations[index], x);\n return x;\n },\n get: function() {\n return attr;\n },\n enumerable: true\n });\n }\n function addMatrixAttribute(gl2, wrapper, index, locations, dimension, obj, name2) {\n var parts = new Array(dimension);\n var attrs = new Array(dimension);\n for (var i = 0; i < dimension; ++i) {\n addVectorAttribute(\n gl2,\n wrapper,\n index[i],\n locations,\n dimension,\n parts,\n i\n );\n attrs[i] = parts[i];\n }\n Object.defineProperty(parts, \"location\", {\n set: function(v) {\n if (Array.isArray(v)) {\n for (var i2 = 0; i2 < dimension; ++i2) {\n attrs[i2].location = v[i2];\n }\n } else {\n for (var i2 = 0; i2 < dimension; ++i2) {\n attrs[i2].location = v + i2;\n }\n }\n return v;\n },\n get: function() {\n var result = new Array(dimension);\n for (var i2 = 0; i2 < dimension; ++i2) {\n result[i2] = locations[index[i2]];\n }\n return result;\n },\n enumerable: true\n });\n parts.pointer = function(type, normalized, stride, offset) {\n type = type || gl2.FLOAT;\n normalized = !!normalized;\n stride = stride || dimension * dimension;\n offset = offset || 0;\n for (var i2 = 0; i2 < dimension; ++i2) {\n var location2 = locations[index[i2]];\n gl2.vertexAttribPointer(\n location2,\n dimension,\n type,\n normalized,\n stride,\n offset + i2 * dimension\n );\n gl2.enableVertexAttribArray(location2);\n }\n };\n var scratch = new Array(dimension);\n var vertexAttrib = gl2[\"vertexAttrib\" + dimension + \"fv\"];\n Object.defineProperty(obj, name2, {\n set: function(x) {\n for (var i2 = 0; i2 < dimension; ++i2) {\n var loc = locations[index[i2]];\n gl2.disableVertexAttribArray(loc);\n if (Array.isArray(x[0])) {\n vertexAttrib.call(gl2, loc, x[i2]);\n } else {\n for (var j = 0; j < dimension; ++j) {\n scratch[j] = x[dimension * i2 + j];\n }\n vertexAttrib.call(gl2, loc, scratch);\n }\n }\n return x;\n },\n get: function() {\n return parts;\n },\n enumerable: true\n });\n }\n function createAttributeWrapper(gl2, wrapper, attributes, locations) {\n var obj = {};\n for (var i = 0, n = attributes.length; i < n; ++i) {\n var a = attributes[i];\n var name2 = a.name;\n var type = a.type;\n var locs = a.locations;\n switch (type) {\n case \"bool\":\n case \"int\":\n case \"float\":\n addVectorAttribute(\n gl2,\n wrapper,\n locs[0],\n locations,\n 1,\n obj,\n name2\n );\n break;\n default:\n if (type.indexOf(\"vec\") >= 0) {\n var d = type.charCodeAt(type.length - 1) - 48;\n if (d < 2 || d > 4) {\n throw new GLError(\"\", \"Invalid data type for attribute \" + name2 + \": \" + type);\n }\n addVectorAttribute(\n gl2,\n wrapper,\n locs[0],\n locations,\n d,\n obj,\n name2\n );\n } else if (type.indexOf(\"mat\") >= 0) {\n var d = type.charCodeAt(type.length - 1) - 48;\n if (d < 2 || d > 4) {\n throw new GLError(\"\", \"Invalid data type for attribute \" + name2 + \": \" + type);\n }\n addMatrixAttribute(\n gl2,\n wrapper,\n locs,\n locations,\n d,\n obj,\n name2\n );\n } else {\n throw new GLError(\"\", \"Unknown data type for attribute \" + name2 + \": \" + type);\n }\n break;\n }\n }\n return obj;\n }\n }\n ),\n /***/\n 3327: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var coallesceUniforms = __webpack_require__2(216);\n var GLError = __webpack_require__2(8866);\n module2.exports = createUniformWrapper;\n function identity2(x) {\n return function() {\n return x;\n };\n }\n function makeVector(length, fill) {\n var result = new Array(length);\n for (var i = 0; i < length; ++i) {\n result[i] = fill;\n }\n return result;\n }\n function createUniformWrapper(gl2, wrapper, uniforms, locations) {\n function makeGetter(idx) {\n return function(gl3, wrapper2, locations2) {\n return gl3.getUniform(wrapper2.program, locations2[idx]);\n };\n }\n function makeSetter(type) {\n return function updateProperty(obj) {\n var indices = enumerateIndices(\"\", type);\n for (var i = 0; i < indices.length; ++i) {\n var item = indices[i];\n var path = item[0];\n var idx = item[1];\n if (locations[idx]) {\n var objPath = obj;\n if (typeof path === \"string\" && (path.indexOf(\".\") === 0 || path.indexOf(\"[\") === 0)) {\n var key = path;\n if (path.indexOf(\".\") === 0) {\n key = path.slice(1);\n }\n if (key.indexOf(\"]\") === key.length - 1) {\n var j = key.indexOf(\"[\");\n var k1 = key.slice(0, j);\n var k2 = key.slice(j + 1, key.length - 1);\n objPath = k1 ? obj[k1][k2] : obj[k2];\n } else {\n objPath = obj[key];\n }\n }\n var t = uniforms[idx].type;\n var d;\n switch (t) {\n case \"bool\":\n case \"int\":\n case \"sampler2D\":\n case \"samplerCube\":\n gl2.uniform1i(locations[idx], objPath);\n break;\n case \"float\":\n gl2.uniform1f(locations[idx], objPath);\n break;\n default:\n var vidx = t.indexOf(\"vec\");\n if (0 <= vidx && vidx <= 1 && t.length === 4 + vidx) {\n d = t.charCodeAt(t.length - 1) - 48;\n if (d < 2 || d > 4) {\n throw new GLError(\"\", \"Invalid data type\");\n }\n switch (t.charAt(0)) {\n case \"b\":\n case \"i\":\n gl2[\"uniform\" + d + \"iv\"](locations[idx], objPath);\n break;\n case \"v\":\n gl2[\"uniform\" + d + \"fv\"](locations[idx], objPath);\n break;\n default:\n throw new GLError(\"\", \"Unrecognized data type for vector \" + name + \": \" + t);\n }\n } else if (t.indexOf(\"mat\") === 0 && t.length === 4) {\n d = t.charCodeAt(t.length - 1) - 48;\n if (d < 2 || d > 4) {\n throw new GLError(\"\", \"Invalid uniform dimension type for matrix \" + name + \": \" + t);\n }\n gl2[\"uniformMatrix\" + d + \"fv\"](locations[idx], false, objPath);\n break;\n } else {\n throw new GLError(\"\", \"Unknown uniform data type for \" + name + \": \" + t);\n }\n }\n }\n }\n };\n }\n function enumerateIndices(prefix, type) {\n if (typeof type !== \"object\") {\n return [[prefix, type]];\n }\n var indices = [];\n for (var id in type) {\n var prop = type[id];\n var tprefix = prefix;\n if (parseInt(id) + \"\" === id) {\n tprefix += \"[\" + id + \"]\";\n } else {\n tprefix += \".\" + id;\n }\n if (typeof prop === \"object\") {\n indices.push.apply(indices, enumerateIndices(tprefix, prop));\n } else {\n indices.push([tprefix, prop]);\n }\n }\n return indices;\n }\n function defaultValue(type) {\n switch (type) {\n case \"bool\":\n return false;\n case \"int\":\n case \"sampler2D\":\n case \"samplerCube\":\n return 0;\n case \"float\":\n return 0;\n default:\n var vidx = type.indexOf(\"vec\");\n if (0 <= vidx && vidx <= 1 && type.length === 4 + vidx) {\n var d = type.charCodeAt(type.length - 1) - 48;\n if (d < 2 || d > 4) {\n throw new GLError(\"\", \"Invalid data type\");\n }\n if (type.charAt(0) === \"b\") {\n return makeVector(d, false);\n }\n return makeVector(d, 0);\n } else if (type.indexOf(\"mat\") === 0 && type.length === 4) {\n var d = type.charCodeAt(type.length - 1) - 48;\n if (d < 2 || d > 4) {\n throw new GLError(\"\", \"Invalid uniform dimension type for matrix \" + name + \": \" + type);\n }\n return makeVector(d * d, 0);\n } else {\n throw new GLError(\"\", \"Unknown uniform data type for \" + name + \": \" + type);\n }\n }\n }\n function storeProperty(obj, prop, type) {\n if (typeof type === \"object\") {\n var child = processObject(type);\n Object.defineProperty(obj, prop, {\n get: identity2(child),\n set: makeSetter(type),\n enumerable: true,\n configurable: false\n });\n } else {\n if (locations[type]) {\n Object.defineProperty(obj, prop, {\n get: makeGetter(type),\n set: makeSetter(type),\n enumerable: true,\n configurable: false\n });\n } else {\n obj[prop] = defaultValue(uniforms[type].type);\n }\n }\n }\n function processObject(obj) {\n var result;\n if (Array.isArray(obj)) {\n result = new Array(obj.length);\n for (var i = 0; i < obj.length; ++i) {\n storeProperty(result, i, obj[i]);\n }\n } else {\n result = {};\n for (var id in obj) {\n storeProperty(result, id, obj[id]);\n }\n }\n return result;\n }\n var coallesced = coallesceUniforms(uniforms, true);\n return {\n get: identity2(processObject(coallesced)),\n set: makeSetter(coallesced),\n enumerable: true,\n configurable: true\n };\n }\n }\n ),\n /***/\n 216: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = makeReflectTypes;\n function makeReflectTypes(uniforms, useIndex) {\n var obj = {};\n for (var i = 0; i < uniforms.length; ++i) {\n var n = uniforms[i].name;\n var parts = n.split(\".\");\n var o = obj;\n for (var j = 0; j < parts.length; ++j) {\n var x = parts[j].split(\"[\");\n if (x.length > 1) {\n if (!(x[0] in o)) {\n o[x[0]] = [];\n }\n o = o[x[0]];\n for (var k = 1; k < x.length; ++k) {\n var y = parseInt(x[k]);\n if (k < x.length - 1 || j < parts.length - 1) {\n if (!(y in o)) {\n if (k < x.length - 1) {\n o[y] = [];\n } else {\n o[y] = {};\n }\n }\n o = o[y];\n } else {\n if (useIndex) {\n o[y] = i;\n } else {\n o[y] = uniforms[i].type;\n }\n }\n }\n } else if (j < parts.length - 1) {\n if (!(x[0] in o)) {\n o[x[0]] = {};\n }\n o = o[x[0]];\n } else {\n if (useIndex) {\n o[x[0]] = i;\n } else {\n o[x[0]] = uniforms[i].type;\n }\n }\n }\n }\n return obj;\n }\n }\n ),\n /***/\n 2145: (\n /***/\n function(__unused_webpack_module, exports2) {\n \"use strict\";\n exports2.uniforms = runtimeUniforms;\n exports2.attributes = runtimeAttributes;\n var GL_TO_GLSL_TYPES = {\n \"FLOAT\": \"float\",\n \"FLOAT_VEC2\": \"vec2\",\n \"FLOAT_VEC3\": \"vec3\",\n \"FLOAT_VEC4\": \"vec4\",\n \"INT\": \"int\",\n \"INT_VEC2\": \"ivec2\",\n \"INT_VEC3\": \"ivec3\",\n \"INT_VEC4\": \"ivec4\",\n \"BOOL\": \"bool\",\n \"BOOL_VEC2\": \"bvec2\",\n \"BOOL_VEC3\": \"bvec3\",\n \"BOOL_VEC4\": \"bvec4\",\n \"FLOAT_MAT2\": \"mat2\",\n \"FLOAT_MAT3\": \"mat3\",\n \"FLOAT_MAT4\": \"mat4\",\n \"SAMPLER_2D\": \"sampler2D\",\n \"SAMPLER_CUBE\": \"samplerCube\"\n };\n var GL_TABLE = null;\n function getType(gl2, type) {\n if (!GL_TABLE) {\n var typeNames = Object.keys(GL_TO_GLSL_TYPES);\n GL_TABLE = {};\n for (var i = 0; i < typeNames.length; ++i) {\n var tn = typeNames[i];\n GL_TABLE[gl2[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n return GL_TABLE[type];\n }\n function runtimeUniforms(gl2, program) {\n var numUniforms = gl2.getProgramParameter(program, gl2.ACTIVE_UNIFORMS);\n var result = [];\n for (var i = 0; i < numUniforms; ++i) {\n var info = gl2.getActiveUniform(program, i);\n if (info) {\n var type = getType(gl2, info.type);\n if (info.size > 1) {\n for (var j = 0; j < info.size; ++j) {\n result.push({\n name: info.name.replace(\"[0]\", \"[\" + j + \"]\"),\n type\n });\n }\n } else {\n result.push({\n name: info.name,\n type\n });\n }\n }\n }\n return result;\n }\n function runtimeAttributes(gl2, program) {\n var numAttributes = gl2.getProgramParameter(program, gl2.ACTIVE_ATTRIBUTES);\n var result = [];\n for (var i = 0; i < numAttributes; ++i) {\n var info = gl2.getActiveAttrib(program, i);\n if (info) {\n result.push({\n name: info.name,\n type: getType(gl2, info.type)\n });\n }\n }\n return result;\n }\n }\n ),\n /***/\n 5091: (\n /***/\n function(__unused_webpack_module, exports2, __webpack_require__2) {\n \"use strict\";\n exports2.shader = getShaderReference;\n exports2.program = createProgram;\n var GLError = __webpack_require__2(8866);\n var formatCompilerError = __webpack_require__2(2992);\n var weakMap = typeof WeakMap === \"undefined\" ? __webpack_require__2(606) : WeakMap;\n var CACHE = new weakMap();\n var SHADER_COUNTER = 0;\n function ShaderReference(id, src, type, shader, programs, count, cache) {\n this.id = id;\n this.src = src;\n this.type = type;\n this.shader = shader;\n this.count = count;\n this.programs = [];\n this.cache = cache;\n }\n ShaderReference.prototype.dispose = function() {\n if (--this.count === 0) {\n var cache = this.cache;\n var gl2 = cache.gl;\n var programs = this.programs;\n for (var i = 0, n = programs.length; i < n; ++i) {\n var p = cache.programs[programs[i]];\n if (p) {\n delete cache.programs[i];\n gl2.deleteProgram(p);\n }\n }\n gl2.deleteShader(this.shader);\n delete cache.shaders[this.type === gl2.FRAGMENT_SHADER | 0][this.src];\n }\n };\n function ContextCache(gl2) {\n this.gl = gl2;\n this.shaders = [{}, {}];\n this.programs = {};\n }\n var proto = ContextCache.prototype;\n function compileShader(gl2, type, src) {\n var shader = gl2.createShader(type);\n gl2.shaderSource(shader, src);\n gl2.compileShader(shader);\n if (!gl2.getShaderParameter(shader, gl2.COMPILE_STATUS)) {\n var errLog = gl2.getShaderInfoLog(shader);\n try {\n var fmt = formatCompilerError(errLog, src, type);\n } catch (e) {\n console.warn(\"Failed to format compiler error: \" + e);\n throw new GLError(errLog, \"Error compiling shader:\\n\" + errLog);\n }\n throw new GLError(errLog, fmt.short, fmt.long);\n }\n return shader;\n }\n proto.getShaderReference = function(type, src) {\n var gl2 = this.gl;\n var shaders = this.shaders[type === gl2.FRAGMENT_SHADER | 0];\n var shader = shaders[src];\n if (!shader || !gl2.isShader(shader.shader)) {\n var shaderObj = compileShader(gl2, type, src);\n shader = shaders[src] = new ShaderReference(\n SHADER_COUNTER++,\n src,\n type,\n shaderObj,\n [],\n 1,\n this\n );\n } else {\n shader.count += 1;\n }\n return shader;\n };\n function linkProgram(gl2, vshader, fshader, attribs, locations) {\n var program = gl2.createProgram();\n gl2.attachShader(program, vshader);\n gl2.attachShader(program, fshader);\n for (var i = 0; i < attribs.length; ++i) {\n gl2.bindAttribLocation(program, locations[i], attribs[i]);\n }\n gl2.linkProgram(program);\n if (!gl2.getProgramParameter(program, gl2.LINK_STATUS)) {\n var errLog = gl2.getProgramInfoLog(program);\n throw new GLError(errLog, \"Error linking program: \" + errLog);\n }\n return program;\n }\n proto.getProgram = function(vref, fref, attribs, locations) {\n var token = [vref.id, fref.id, attribs.join(\":\"), locations.join(\":\")].join(\"@\");\n var prog = this.programs[token];\n if (!prog || !this.gl.isProgram(prog)) {\n this.programs[token] = prog = linkProgram(\n this.gl,\n vref.shader,\n fref.shader,\n attribs,\n locations\n );\n vref.programs.push(token);\n fref.programs.push(token);\n }\n return prog;\n };\n function getCache(gl2) {\n var ctxCache = CACHE.get(gl2);\n if (!ctxCache) {\n ctxCache = new ContextCache(gl2);\n CACHE.set(gl2, ctxCache);\n }\n return ctxCache;\n }\n function getShaderReference(gl2, type, src) {\n return getCache(gl2).getShaderReference(type, src);\n }\n function createProgram(gl2, vref, fref, attribs, locations) {\n return getCache(gl2).getProgram(vref, fref, attribs, locations);\n }\n }\n ),\n /***/\n 1493: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var glslify = __webpack_require__2(3236);\n var createShader = __webpack_require__2(9405);\n var vertSrc = glslify([\"precision mediump float;\\n#define GLSLIFY 1\\n\\nattribute vec3 position, color;\\nattribute float weight;\\n\\nuniform mat4 model, view, projection;\\nuniform vec3 coordinates[3];\\nuniform vec4 colors[3];\\nuniform vec2 screenShape;\\nuniform float lineWidth;\\n\\nvarying vec4 fragColor;\\n\\nvoid main() {\\n vec3 vertexPosition = mix(coordinates[0],\\n mix(coordinates[2], coordinates[1], 0.5 * (position + 1.0)), abs(position));\\n\\n vec4 clipPos = projection * (view * (model * vec4(vertexPosition, 1.0)));\\n vec2 clipOffset = (projection * (view * (model * vec4(color, 0.0)))).xy;\\n vec2 delta = weight * clipOffset * screenShape;\\n vec2 lineOffset = normalize(vec2(delta.y, -delta.x)) / screenShape;\\n\\n gl_Position = vec4(clipPos.xy + clipPos.w * 0.5 * lineWidth * lineOffset, clipPos.z, clipPos.w);\\n fragColor = color.x * colors[0] + color.y * colors[1] + color.z * colors[2];\\n}\\n\"]);\n var fragSrc = glslify([\"precision mediump float;\\n#define GLSLIFY 1\\n\\nvarying vec4 fragColor;\\n\\nvoid main() {\\n gl_FragColor = fragColor;\\n}\"]);\n module2.exports = function(gl2) {\n return createShader(gl2, vertSrc, fragSrc, null, [\n { name: \"position\", type: \"vec3\" },\n { name: \"color\", type: \"vec3\" },\n { name: \"weight\", type: \"float\" }\n ]);\n };\n }\n ),\n /***/\n 4449: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var createBuffer = __webpack_require__2(2762);\n var createVAO = __webpack_require__2(8116);\n var createShader = __webpack_require__2(1493);\n module2.exports = createSpikes;\n var identity2 = [\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ];\n function AxisSpikes(gl2, buffer, vao, shader) {\n this.gl = gl2;\n this.buffer = buffer;\n this.vao = vao;\n this.shader = shader;\n this.pixelRatio = 1;\n this.bounds = [[-1e3, -1e3, -1e3], [1e3, 1e3, 1e3]];\n this.position = [0, 0, 0];\n this.lineWidth = [2, 2, 2];\n this.colors = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]];\n this.enabled = [true, true, true];\n this.drawSides = [true, true, true];\n this.axes = null;\n }\n var proto = AxisSpikes.prototype;\n var OUTER_FACE = [0, 0, 0];\n var INNER_FACE = [0, 0, 0];\n var SHAPE = [0, 0];\n proto.isTransparent = function() {\n return false;\n };\n proto.drawTransparent = function(camera) {\n };\n proto.draw = function(camera) {\n var gl2 = this.gl;\n var vao = this.vao;\n var shader = this.shader;\n vao.bind();\n shader.bind();\n var model = camera.model || identity2;\n var view = camera.view || identity2;\n var projection = camera.projection || identity2;\n var axis;\n if (this.axes) {\n axis = this.axes.lastCubeProps.axis;\n }\n var outerFace = OUTER_FACE;\n var innerFace = INNER_FACE;\n for (var i = 0; i < 3; ++i) {\n if (axis && axis[i] < 0) {\n outerFace[i] = this.bounds[0][i];\n innerFace[i] = this.bounds[1][i];\n } else {\n outerFace[i] = this.bounds[1][i];\n innerFace[i] = this.bounds[0][i];\n }\n }\n SHAPE[0] = gl2.drawingBufferWidth;\n SHAPE[1] = gl2.drawingBufferHeight;\n shader.uniforms.model = model;\n shader.uniforms.view = view;\n shader.uniforms.projection = projection;\n shader.uniforms.coordinates = [this.position, outerFace, innerFace];\n shader.uniforms.colors = this.colors;\n shader.uniforms.screenShape = SHAPE;\n for (var i = 0; i < 3; ++i) {\n shader.uniforms.lineWidth = this.lineWidth[i] * this.pixelRatio;\n if (this.enabled[i]) {\n vao.draw(gl2.TRIANGLES, 6, 6 * i);\n if (this.drawSides[i]) {\n vao.draw(gl2.TRIANGLES, 12, 18 + 12 * i);\n }\n }\n }\n vao.unbind();\n };\n proto.update = function(options) {\n if (!options) {\n return;\n }\n if (\"bounds\" in options) {\n this.bounds = options.bounds;\n }\n if (\"position\" in options) {\n this.position = options.position;\n }\n if (\"lineWidth\" in options) {\n this.lineWidth = options.lineWidth;\n }\n if (\"colors\" in options) {\n this.colors = options.colors;\n }\n if (\"enabled\" in options) {\n this.enabled = options.enabled;\n }\n if (\"drawSides\" in options) {\n this.drawSides = options.drawSides;\n }\n };\n proto.dispose = function() {\n this.vao.dispose();\n this.buffer.dispose();\n this.shader.dispose();\n };\n function createSpikes(gl2, options) {\n var data = [];\n function line(x, y, z, i, l, h) {\n var row = [x, y, z, 0, 0, 0, 1];\n row[i + 3] = 1;\n row[i] = l;\n data.push.apply(data, row);\n row[6] = -1;\n data.push.apply(data, row);\n row[i] = h;\n data.push.apply(data, row);\n data.push.apply(data, row);\n row[6] = 1;\n data.push.apply(data, row);\n row[i] = l;\n data.push.apply(data, row);\n }\n line(0, 0, 0, 0, 0, 1);\n line(0, 0, 0, 1, 0, 1);\n line(0, 0, 0, 2, 0, 1);\n line(1, 0, 0, 1, -1, 1);\n line(1, 0, 0, 2, -1, 1);\n line(0, 1, 0, 0, -1, 1);\n line(0, 1, 0, 2, -1, 1);\n line(0, 0, 1, 0, -1, 1);\n line(0, 0, 1, 1, -1, 1);\n var buffer = createBuffer(gl2, data);\n var vao = createVAO(gl2, [{\n type: gl2.FLOAT,\n buffer,\n size: 3,\n offset: 0,\n stride: 28\n }, {\n type: gl2.FLOAT,\n buffer,\n size: 3,\n offset: 12,\n stride: 28\n }, {\n type: gl2.FLOAT,\n buffer,\n size: 1,\n offset: 24,\n stride: 28\n }]);\n var shader = createShader(gl2);\n shader.attributes.position.location = 0;\n shader.attributes.color.location = 1;\n shader.attributes.weight.location = 2;\n var spikes = new AxisSpikes(gl2, buffer, vao, shader);\n spikes.update(options);\n return spikes;\n }\n }\n ),\n /***/\n 6740: (\n /***/\n function(__unused_webpack_module, exports2, __webpack_require__2) {\n var glslify = __webpack_require__2(3236);\n var triVertSrc = glslify([\"precision highp float;\\n\\nprecision highp float;\\n#define GLSLIFY 1\\n\\nvec3 getOrthogonalVector(vec3 v) {\\n // Return up-vector for only-z vector.\\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\\n // Assign z = 0, x = -b, y = a:\\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\\n return normalize(vec3(-v.y, v.x, 0.0));\\n } else {\\n return normalize(vec3(0.0, v.z, -v.y));\\n }\\n}\\n\\n// Calculate the tube vertex and normal at the given index.\\n//\\n// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d.\\n//\\n// Each tube segment is made up of a ring of vertices.\\n// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array.\\n// The indexes of tube segments run from 0 to 8.\\n//\\nvec3 getTubePosition(vec3 d, float index, out vec3 normal) {\\n float segmentCount = 8.0;\\n\\n float angle = 2.0 * 3.14159 * (index / segmentCount);\\n\\n vec3 u = getOrthogonalVector(d);\\n vec3 v = normalize(cross(u, d));\\n\\n vec3 x = u * cos(angle) * length(d);\\n vec3 y = v * sin(angle) * length(d);\\n vec3 v3 = x + y;\\n\\n normal = normalize(v3);\\n\\n return v3;\\n}\\n\\nattribute vec4 vector;\\nattribute vec4 color, position;\\nattribute vec2 uv;\\n\\nuniform float vectorScale, tubeScale;\\nuniform mat4 model, view, projection, inverseModel;\\nuniform vec3 eyePosition, lightPosition;\\n\\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;\\nvarying vec4 f_color;\\nvarying vec2 f_uv;\\n\\nvoid main() {\\n // Scale the vector magnitude to stay constant with\\n // model & view changes.\\n vec3 normal;\\n vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal);\\n vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\\n\\n //Lighting geometry parameters\\n vec4 cameraCoordinate = view * tubePosition;\\n cameraCoordinate.xyz /= cameraCoordinate.w;\\n f_lightDirection = lightPosition - cameraCoordinate.xyz;\\n f_eyeDirection = eyePosition - cameraCoordinate.xyz;\\n f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz);\\n\\n // vec4 m_position = model * vec4(tubePosition, 1.0);\\n vec4 t_position = view * tubePosition;\\n gl_Position = projection * t_position;\\n\\n f_color = color;\\n f_data = tubePosition.xyz;\\n f_position = position.xyz;\\n f_uv = uv;\\n}\\n\"]);\n var triFragSrc = glslify([\"#extension GL_OES_standard_derivatives : enable\\n\\nprecision highp float;\\n#define GLSLIFY 1\\n\\nfloat beckmannDistribution(float x, float roughness) {\\n float NdotH = max(x, 0.0001);\\n float cos2Alpha = NdotH * NdotH;\\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\\n float roughness2 = roughness * roughness;\\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\\n return exp(tan2Alpha / roughness2) / denom;\\n}\\n\\nfloat cookTorranceSpecular(\\n vec3 lightDirection,\\n vec3 viewDirection,\\n vec3 surfaceNormal,\\n float roughness,\\n float fresnel) {\\n\\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\\n\\n //Half angle vector\\n vec3 H = normalize(lightDirection + viewDirection);\\n\\n //Geometric term\\n float NdotH = max(dot(surfaceNormal, H), 0.0);\\n float VdotH = max(dot(viewDirection, H), 0.000001);\\n float LdotH = max(dot(lightDirection, H), 0.000001);\\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\\n float G = min(1.0, min(G1, G2));\\n \\n //Distribution term\\n float D = beckmannDistribution(NdotH, roughness);\\n\\n //Fresnel term\\n float F = pow(1.0 - VdotN, fresnel);\\n\\n //Multiply terms and done\\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\\n}\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nuniform vec3 clipBounds[2];\\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\\nuniform sampler2D texture;\\n\\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;\\nvarying vec4 f_color;\\nvarying vec2 f_uv;\\n\\nvoid main() {\\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\\n vec3 N = normalize(f_normal);\\n vec3 L = normalize(f_lightDirection);\\n vec3 V = normalize(f_eyeDirection);\\n\\n if(gl_FrontFacing) {\\n N = -N;\\n }\\n\\n float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));\\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\\n\\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\\n\\n gl_FragColor = litColor * opacity;\\n}\\n\"]);\n var pickVertSrc = glslify([\"precision highp float;\\n\\nprecision highp float;\\n#define GLSLIFY 1\\n\\nvec3 getOrthogonalVector(vec3 v) {\\n // Return up-vector for only-z vector.\\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\\n // Assign z = 0, x = -b, y = a:\\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\\n return normalize(vec3(-v.y, v.x, 0.0));\\n } else {\\n return normalize(vec3(0.0, v.z, -v.y));\\n }\\n}\\n\\n// Calculate the tube vertex and normal at the given index.\\n//\\n// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d.\\n//\\n// Each tube segment is made up of a ring of vertices.\\n// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array.\\n// The indexes of tube segments run from 0 to 8.\\n//\\nvec3 getTubePosition(vec3 d, float index, out vec3 normal) {\\n float segmentCount = 8.0;\\n\\n float angle = 2.0 * 3.14159 * (index / segmentCount);\\n\\n vec3 u = getOrthogonalVector(d);\\n vec3 v = normalize(cross(u, d));\\n\\n vec3 x = u * cos(angle) * length(d);\\n vec3 y = v * sin(angle) * length(d);\\n vec3 v3 = x + y;\\n\\n normal = normalize(v3);\\n\\n return v3;\\n}\\n\\nattribute vec4 vector;\\nattribute vec4 position;\\nattribute vec4 id;\\n\\nuniform mat4 model, view, projection;\\nuniform float tubeScale;\\n\\nvarying vec3 f_position;\\nvarying vec4 f_id;\\n\\nvoid main() {\\n vec3 normal;\\n vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal);\\n vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\\n\\n gl_Position = projection * (view * tubePosition);\\n f_id = id;\\n f_position = position.xyz;\\n}\\n\"]);\n var pickFragSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nuniform vec3 clipBounds[2];\\nuniform float pickId;\\n\\nvarying vec3 f_position;\\nvarying vec4 f_id;\\n\\nvoid main() {\\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\\n\\n gl_FragColor = vec4(pickId, f_id.xyz);\\n}\"]);\n exports2.meshShader = {\n vertex: triVertSrc,\n fragment: triFragSrc,\n attributes: [\n { name: \"position\", type: \"vec4\" },\n { name: \"color\", type: \"vec4\" },\n { name: \"uv\", type: \"vec2\" },\n { name: \"vector\", type: \"vec4\" }\n ]\n };\n exports2.pickShader = {\n vertex: pickVertSrc,\n fragment: pickFragSrc,\n attributes: [\n { name: \"position\", type: \"vec4\" },\n { name: \"id\", type: \"vec4\" },\n { name: \"vector\", type: \"vec4\" }\n ]\n };\n }\n ),\n /***/\n 7815: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var vec3 = __webpack_require__2(2931);\n var vec4 = __webpack_require__2(9970);\n var GRID_TYPES = [\"xyz\", \"xzy\", \"yxz\", \"yzx\", \"zxy\", \"zyx\"];\n var streamToTube = function(stream, maxDivergence, minDistance, maxNorm) {\n var points = stream.points;\n var velocities = stream.velocities;\n var divergences = stream.divergences;\n var verts = [];\n var faces = [];\n var vectors = [];\n var previousVerts = [];\n var currentVerts = [];\n var intensities = [];\n var previousIntensity = 0;\n var currentIntensity = 0;\n var currentVector = vec4.create();\n var previousVector = vec4.create();\n var facets = 8;\n for (var i = 0; i < points.length; i++) {\n var p = points[i];\n var fwd = velocities[i];\n var r = divergences[i];\n if (maxDivergence === 0) {\n r = minDistance * 0.05;\n }\n currentIntensity = vec3.length(fwd) / maxNorm;\n currentVector = vec4.create();\n vec3.copy(currentVector, fwd);\n currentVector[3] = r;\n for (var a = 0; a < facets; a++) {\n currentVerts[a] = [p[0], p[1], p[2], a];\n }\n if (previousVerts.length > 0) {\n for (var a = 0; a < facets; a++) {\n var a1 = (a + 1) % facets;\n verts.push(\n previousVerts[a],\n currentVerts[a],\n currentVerts[a1],\n currentVerts[a1],\n previousVerts[a1],\n previousVerts[a]\n );\n vectors.push(\n previousVector,\n currentVector,\n currentVector,\n currentVector,\n previousVector,\n previousVector\n );\n intensities.push(\n previousIntensity,\n currentIntensity,\n currentIntensity,\n currentIntensity,\n previousIntensity,\n previousIntensity\n );\n var len = verts.length;\n faces.push(\n [len - 6, len - 5, len - 4],\n [len - 3, len - 2, len - 1]\n );\n }\n }\n var tmp1 = previousVerts;\n previousVerts = currentVerts;\n currentVerts = tmp1;\n var tmp2 = previousVector;\n previousVector = currentVector;\n currentVector = tmp2;\n var tmp3 = previousIntensity;\n previousIntensity = currentIntensity;\n currentIntensity = tmp3;\n }\n return {\n positions: verts,\n cells: faces,\n vectors,\n vertexIntensity: intensities\n };\n };\n var createTubes = function(streams, colormap, maxDivergence, minDistance) {\n var maxNorm = 0;\n for (var i = 0; i < streams.length; i++) {\n var velocities = streams[i].velocities;\n for (var j = 0; j < velocities.length; j++) {\n maxNorm = Math.max(\n maxNorm,\n vec3.length(velocities[j])\n );\n }\n }\n var tubes = streams.map(function(s) {\n return streamToTube(s, maxDivergence, minDistance, maxNorm);\n });\n var positions = [];\n var cells = [];\n var vectors = [];\n var vertexIntensity = [];\n for (var i = 0; i < tubes.length; i++) {\n var tube = tubes[i];\n var offset = positions.length;\n positions = positions.concat(tube.positions);\n vectors = vectors.concat(tube.vectors);\n vertexIntensity = vertexIntensity.concat(tube.vertexIntensity);\n for (var j = 0; j < tube.cells.length; j++) {\n var cell = tube.cells[j];\n var newCell = [];\n cells.push(newCell);\n for (var k = 0; k < cell.length; k++) {\n newCell.push(cell[k] + offset);\n }\n }\n }\n return {\n positions,\n cells,\n vectors,\n vertexIntensity,\n colormap\n };\n };\n var findLastSmallerIndex = function(points, v) {\n var len = points.length;\n var i;\n for (i = 0; i < len; i++) {\n var p = points[i];\n if (p === v) return i;\n else if (p > v) return i - 1;\n }\n return i;\n };\n var clamp = function(v, min, max) {\n return v < min ? min : v > max ? max : v;\n };\n var sampleMeshgrid = function(point, vectorField, gridInfo) {\n var vectors = vectorField.vectors;\n var meshgrid = vectorField.meshgrid;\n var x = point[0];\n var y = point[1];\n var z = point[2];\n var w = meshgrid[0].length;\n var h = meshgrid[1].length;\n var d = meshgrid[2].length;\n var x0 = findLastSmallerIndex(meshgrid[0], x);\n var y0 = findLastSmallerIndex(meshgrid[1], y);\n var z0 = findLastSmallerIndex(meshgrid[2], z);\n var x1 = x0 + 1;\n var y1 = y0 + 1;\n var z1 = z0 + 1;\n x0 = clamp(x0, 0, w - 1);\n x1 = clamp(x1, 0, w - 1);\n y0 = clamp(y0, 0, h - 1);\n y1 = clamp(y1, 0, h - 1);\n z0 = clamp(z0, 0, d - 1);\n z1 = clamp(z1, 0, d - 1);\n if (x0 < 0 || y0 < 0 || z0 < 0 || x1 > w - 1 || y1 > h - 1 || z1 > d - 1) {\n return vec3.create();\n }\n var mX0 = meshgrid[0][x0];\n var mX1 = meshgrid[0][x1];\n var mY0 = meshgrid[1][y0];\n var mY1 = meshgrid[1][y1];\n var mZ0 = meshgrid[2][z0];\n var mZ1 = meshgrid[2][z1];\n var xf = (x - mX0) / (mX1 - mX0);\n var yf = (y - mY0) / (mY1 - mY0);\n var zf = (z - mZ0) / (mZ1 - mZ0);\n if (!isFinite(xf)) xf = 0.5;\n if (!isFinite(yf)) yf = 0.5;\n if (!isFinite(zf)) zf = 0.5;\n var x0off;\n var x1off;\n var y0off;\n var y1off;\n var z0off;\n var z1off;\n if (gridInfo.reversedX) {\n x0 = w - 1 - x0;\n x1 = w - 1 - x1;\n }\n if (gridInfo.reversedY) {\n y0 = h - 1 - y0;\n y1 = h - 1 - y1;\n }\n if (gridInfo.reversedZ) {\n z0 = d - 1 - z0;\n z1 = d - 1 - z1;\n }\n switch (gridInfo.filled) {\n case 5:\n z0off = z0;\n z1off = z1;\n y0off = y0 * d;\n y1off = y1 * d;\n x0off = x0 * d * h;\n x1off = x1 * d * h;\n break;\n case 4:\n z0off = z0;\n z1off = z1;\n x0off = x0 * d;\n x1off = x1 * d;\n y0off = y0 * d * w;\n y1off = y1 * d * w;\n break;\n case 3:\n y0off = y0;\n y1off = y1;\n z0off = z0 * h;\n z1off = z1 * h;\n x0off = x0 * h * d;\n x1off = x1 * h * d;\n break;\n case 2:\n y0off = y0;\n y1off = y1;\n x0off = x0 * h;\n x1off = x1 * h;\n z0off = z0 * h * w;\n z1off = z1 * h * w;\n break;\n case 1:\n x0off = x0;\n x1off = x1;\n z0off = z0 * w;\n z1off = z1 * w;\n y0off = y0 * w * d;\n y1off = y1 * w * d;\n break;\n default:\n x0off = x0;\n x1off = x1;\n y0off = y0 * w;\n y1off = y1 * w;\n z0off = z0 * w * h;\n z1off = z1 * w * h;\n break;\n }\n var v000 = vectors[x0off + y0off + z0off];\n var v001 = vectors[x0off + y0off + z1off];\n var v010 = vectors[x0off + y1off + z0off];\n var v011 = vectors[x0off + y1off + z1off];\n var v100 = vectors[x1off + y0off + z0off];\n var v101 = vectors[x1off + y0off + z1off];\n var v110 = vectors[x1off + y1off + z0off];\n var v111 = vectors[x1off + y1off + z1off];\n var c00 = vec3.create();\n var c01 = vec3.create();\n var c10 = vec3.create();\n var c11 = vec3.create();\n vec3.lerp(c00, v000, v100, xf);\n vec3.lerp(c01, v001, v101, xf);\n vec3.lerp(c10, v010, v110, xf);\n vec3.lerp(c11, v011, v111, xf);\n var c0 = vec3.create();\n var c1 = vec3.create();\n vec3.lerp(c0, c00, c10, yf);\n vec3.lerp(c1, c01, c11, yf);\n var c = vec3.create();\n vec3.lerp(c, c0, c1, zf);\n return c;\n };\n var vabs = function(dst, v) {\n var x = v[0];\n var y = v[1];\n var z = v[2];\n dst[0] = x < 0 ? -x : x;\n dst[1] = y < 0 ? -y : y;\n dst[2] = z < 0 ? -z : z;\n return dst;\n };\n var findMinSeparation = function(xs) {\n var minSeparation = Infinity;\n xs.sort(function(a, b) {\n return a - b;\n });\n var len = xs.length;\n for (var i = 1; i < len; i++) {\n var d = Math.abs(xs[i] - xs[i - 1]);\n if (d < minSeparation) {\n minSeparation = d;\n }\n }\n return minSeparation;\n };\n var calculateMinPositionDistance = function(positions) {\n var xs = [], ys = [], zs = [];\n var xi = {}, yi = {}, zi = {};\n var len = positions.length;\n for (var i = 0; i < len; i++) {\n var p = positions[i];\n var x = p[0], y = p[1], z = p[2];\n if (!xi[x]) {\n xs.push(x);\n xi[x] = true;\n }\n if (!yi[y]) {\n ys.push(y);\n yi[y] = true;\n }\n if (!zi[z]) {\n zs.push(z);\n zi[z] = true;\n }\n }\n var xSep = findMinSeparation(xs);\n var ySep = findMinSeparation(ys);\n var zSep = findMinSeparation(zs);\n var minSeparation = Math.min(xSep, ySep, zSep);\n return isFinite(minSeparation) ? minSeparation : 1;\n };\n module2.exports = function(vectorField, bounds) {\n var positions = vectorField.startingPositions;\n var maxLength = vectorField.maxLength || 1e3;\n var tubeSize = vectorField.tubeSize || 1;\n var absoluteTubeSize = vectorField.absoluteTubeSize;\n var gridFill = vectorField.gridFill || \"+x+y+z\";\n var gridInfo = {};\n if (gridFill.indexOf(\"-x\") !== -1) {\n gridInfo.reversedX = true;\n }\n if (gridFill.indexOf(\"-y\") !== -1) {\n gridInfo.reversedY = true;\n }\n if (gridFill.indexOf(\"-z\") !== -1) {\n gridInfo.reversedZ = true;\n }\n gridInfo.filled = GRID_TYPES.indexOf(gridFill.replace(/-/g, \"\").replace(/\\+/g, \"\"));\n var getVelocity = vectorField.getVelocity || function(p2) {\n return sampleMeshgrid(p2, vectorField, gridInfo);\n };\n var getDivergence = vectorField.getDivergence || function(p2, v0) {\n var dp = vec3.create();\n var e = 1e-4;\n vec3.add(dp, p2, [e, 0, 0]);\n var vx = getVelocity(dp);\n vec3.subtract(vx, vx, v0);\n vec3.scale(vx, vx, 1 / e);\n vec3.add(dp, p2, [0, e, 0]);\n var vy = getVelocity(dp);\n vec3.subtract(vy, vy, v0);\n vec3.scale(vy, vy, 1 / e);\n vec3.add(dp, p2, [0, 0, e]);\n var vz = getVelocity(dp);\n vec3.subtract(vz, vz, v0);\n vec3.scale(vz, vz, 1 / e);\n vec3.add(dp, vx, vy);\n vec3.add(dp, dp, vz);\n return dp;\n };\n var streams = [];\n var minX = bounds[0][0], minY = bounds[0][1], minZ = bounds[0][2];\n var maxX = bounds[1][0], maxY = bounds[1][1], maxZ = bounds[1][2];\n var inBounds = function(p2) {\n var x = p2[0];\n var y = p2[1];\n var z = p2[2];\n return !(x < minX || x > maxX || y < minY || y > maxY || z < minZ || z > maxZ);\n };\n var boundsSize = vec3.distance(bounds[0], bounds[1]);\n var maxStepSize = 10 * boundsSize / maxLength;\n var maxStepSizeSq = maxStepSize * maxStepSize;\n var minDistance = 1;\n var maxDivergence = 0;\n var len = positions.length;\n if (len > 1) {\n minDistance = calculateMinPositionDistance(positions);\n }\n for (var i = 0; i < len; i++) {\n var p = vec3.create();\n vec3.copy(p, positions[i]);\n var stream = [p];\n var velocities = [];\n var v = getVelocity(p);\n var op = p;\n velocities.push(v);\n var divergences = [];\n var dv = getDivergence(p, v);\n var dvLength = vec3.length(dv);\n if (isFinite(dvLength) && dvLength > maxDivergence) {\n maxDivergence = dvLength;\n }\n divergences.push(dvLength);\n streams.push({ points: stream, velocities, divergences });\n var j = 0;\n while (j < maxLength * 100 && stream.length < maxLength && inBounds(p)) {\n j++;\n var np = vec3.clone(v);\n var sqLen = vec3.squaredLength(np);\n if (sqLen === 0) {\n break;\n } else if (sqLen > maxStepSizeSq) {\n vec3.scale(np, np, maxStepSize / Math.sqrt(sqLen));\n }\n vec3.add(np, np, p);\n v = getVelocity(np);\n if (vec3.squaredDistance(op, np) - maxStepSizeSq > -1e-4 * maxStepSizeSq) {\n stream.push(np);\n op = np;\n velocities.push(v);\n var dv = getDivergence(np, v);\n var dvLength = vec3.length(dv);\n if (isFinite(dvLength) && dvLength > maxDivergence) {\n maxDivergence = dvLength;\n }\n divergences.push(dvLength);\n }\n p = np;\n }\n }\n var tubes = createTubes(streams, vectorField.colormap, maxDivergence, minDistance);\n if (absoluteTubeSize) {\n tubes.tubeScale = absoluteTubeSize;\n } else {\n if (maxDivergence === 0) {\n maxDivergence = 1;\n }\n tubes.tubeScale = tubeSize * 0.5 * minDistance / maxDivergence;\n }\n return tubes;\n };\n var shaders = __webpack_require__2(6740);\n var createMesh = __webpack_require__2(6405).createMesh;\n module2.exports.createTubeMesh = function(gl2, params) {\n return createMesh(gl2, params, {\n shaders,\n traceType: \"streamtube\"\n });\n };\n }\n ),\n /***/\n 990: (\n /***/\n function(__unused_webpack_module, exports2, __webpack_require__2) {\n var createShader = __webpack_require__2(9405);\n var glslify = __webpack_require__2(3236);\n var vertSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nattribute vec4 uv;\\nattribute vec3 f;\\nattribute vec3 normal;\\n\\nuniform vec3 objectOffset;\\nuniform mat4 model, view, projection, inverseModel;\\nuniform vec3 lightPosition, eyePosition;\\nuniform sampler2D colormap;\\n\\nvarying float value, kill;\\nvarying vec3 worldCoordinate;\\nvarying vec2 planeCoordinate;\\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\\nvarying vec4 vColor;\\n\\nvoid main() {\\n vec3 localCoordinate = vec3(uv.zw, f.x);\\n worldCoordinate = objectOffset + localCoordinate;\\n mat4 objectOffsetTranslation = mat4(1.0) + mat4(vec4(0), vec4(0), vec4(0), vec4(objectOffset, 0));\\n vec4 worldPosition = (model * objectOffsetTranslation) * vec4(localCoordinate, 1.0);\\n vec4 clipPosition = projection * (view * worldPosition);\\n gl_Position = clipPosition;\\n kill = f.y;\\n value = f.z;\\n planeCoordinate = uv.xy;\\n\\n vColor = texture2D(colormap, vec2(value, value));\\n\\n //Lighting geometry parameters\\n vec4 cameraCoordinate = view * worldPosition;\\n cameraCoordinate.xyz /= cameraCoordinate.w;\\n lightDirection = lightPosition - cameraCoordinate.xyz;\\n eyeDirection = eyePosition - cameraCoordinate.xyz;\\n surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);\\n}\\n\"]);\n var fragSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nfloat beckmannDistribution(float x, float roughness) {\\n float NdotH = max(x, 0.0001);\\n float cos2Alpha = NdotH * NdotH;\\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\\n float roughness2 = roughness * roughness;\\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\\n return exp(tan2Alpha / roughness2) / denom;\\n}\\n\\nfloat beckmannSpecular(\\n vec3 lightDirection,\\n vec3 viewDirection,\\n vec3 surfaceNormal,\\n float roughness) {\\n return beckmannDistribution(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\\n}\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nuniform vec3 lowerBound, upperBound;\\nuniform float contourTint;\\nuniform vec4 contourColor;\\nuniform sampler2D colormap;\\nuniform vec3 clipBounds[2];\\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\\nuniform float vertexColor;\\n\\nvarying float value, kill;\\nvarying vec3 worldCoordinate;\\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\\nvarying vec4 vColor;\\n\\nvoid main() {\\n if (\\n kill > 0.0 ||\\n vColor.a == 0.0 ||\\n outOfRange(clipBounds[0], clipBounds[1], worldCoordinate)\\n ) discard;\\n\\n vec3 N = normalize(surfaceNormal);\\n vec3 V = normalize(eyeDirection);\\n vec3 L = normalize(lightDirection);\\n\\n if(gl_FrontFacing) {\\n N = -N;\\n }\\n\\n float specular = max(beckmannSpecular(L, V, N, roughness), 0.);\\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\\n\\n //decide how to interpolate color \\u2014 in vertex or in fragment\\n vec4 surfaceColor =\\n step(vertexColor, .5) * texture2D(colormap, vec2(value, value)) +\\n step(.5, vertexColor) * vColor;\\n\\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\\n\\n gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;\\n}\\n\"]);\n var contourVertSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nattribute vec4 uv;\\nattribute float f;\\n\\nuniform vec3 objectOffset;\\nuniform mat3 permutation;\\nuniform mat4 model, view, projection;\\nuniform float height, zOffset;\\nuniform sampler2D colormap;\\n\\nvarying float value, kill;\\nvarying vec3 worldCoordinate;\\nvarying vec2 planeCoordinate;\\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\\nvarying vec4 vColor;\\n\\nvoid main() {\\n vec3 dataCoordinate = permutation * vec3(uv.xy, height);\\n worldCoordinate = objectOffset + dataCoordinate;\\n mat4 objectOffsetTranslation = mat4(1.0) + mat4(vec4(0), vec4(0), vec4(0), vec4(objectOffset, 0));\\n vec4 worldPosition = (model * objectOffsetTranslation) * vec4(dataCoordinate, 1.0);\\n\\n vec4 clipPosition = projection * (view * worldPosition);\\n clipPosition.z += zOffset;\\n\\n gl_Position = clipPosition;\\n value = f + objectOffset.z;\\n kill = -1.0;\\n planeCoordinate = uv.zw;\\n\\n vColor = texture2D(colormap, vec2(value, value));\\n\\n //Don't do lighting for contours\\n surfaceNormal = vec3(1,0,0);\\n eyeDirection = vec3(0,1,0);\\n lightDirection = vec3(0,0,1);\\n}\\n\"]);\n var pickSrc = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nbool outOfRange(float a, float b, float p) {\\n return ((p > max(a, b)) || \\n (p < min(a, b)));\\n}\\n\\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y));\\n}\\n\\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\\n return (outOfRange(a.x, b.x, p.x) ||\\n outOfRange(a.y, b.y, p.y) ||\\n outOfRange(a.z, b.z, p.z));\\n}\\n\\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\\n return outOfRange(a.xyz, b.xyz, p.xyz);\\n}\\n\\nuniform vec2 shape;\\nuniform vec3 clipBounds[2];\\nuniform float pickId;\\n\\nvarying float value, kill;\\nvarying vec3 worldCoordinate;\\nvarying vec2 planeCoordinate;\\nvarying vec3 surfaceNormal;\\n\\nvec2 splitFloat(float v) {\\n float vh = 255.0 * v;\\n float upper = floor(vh);\\n float lower = fract(vh);\\n return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\\n}\\n\\nvoid main() {\\n if ((kill > 0.0) ||\\n (outOfRange(clipBounds[0], clipBounds[1], worldCoordinate))) discard;\\n\\n vec2 ux = splitFloat(planeCoordinate.x / shape.x);\\n vec2 uy = splitFloat(planeCoordinate.y / shape.y);\\n gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\\n}\\n\"]);\n exports2.createShader = function(gl2) {\n var shader = createShader(gl2, vertSrc, fragSrc, null, [\n { name: \"uv\", type: \"vec4\" },\n { name: \"f\", type: \"vec3\" },\n { name: \"normal\", type: \"vec3\" }\n ]);\n shader.attributes.uv.location = 0;\n shader.attributes.f.location = 1;\n shader.attributes.normal.location = 2;\n return shader;\n };\n exports2.createPickShader = function(gl2) {\n var shader = createShader(gl2, vertSrc, pickSrc, null, [\n { name: \"uv\", type: \"vec4\" },\n { name: \"f\", type: \"vec3\" },\n { name: \"normal\", type: \"vec3\" }\n ]);\n shader.attributes.uv.location = 0;\n shader.attributes.f.location = 1;\n shader.attributes.normal.location = 2;\n return shader;\n };\n exports2.createContourShader = function(gl2) {\n var shader = createShader(gl2, contourVertSrc, fragSrc, null, [\n { name: \"uv\", type: \"vec4\" },\n { name: \"f\", type: \"float\" }\n ]);\n shader.attributes.uv.location = 0;\n shader.attributes.f.location = 1;\n return shader;\n };\n exports2.createPickContourShader = function(gl2) {\n var shader = createShader(gl2, contourVertSrc, pickSrc, null, [\n { name: \"uv\", type: \"vec4\" },\n { name: \"f\", type: \"float\" }\n ]);\n shader.attributes.uv.location = 0;\n shader.attributes.f.location = 1;\n return shader;\n };\n }\n ),\n /***/\n 9499: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = createSurfacePlot;\n var bits = __webpack_require__2(8828);\n var createBuffer = __webpack_require__2(2762);\n var createVAO = __webpack_require__2(8116);\n var createTexture = __webpack_require__2(7766);\n var pool = __webpack_require__2(1888);\n var colormap = __webpack_require__2(6729);\n var ops = __webpack_require__2(5298);\n var pack = __webpack_require__2(9994);\n var ndarray = __webpack_require__2(9618);\n var surfaceNets = __webpack_require__2(3711);\n var multiply = __webpack_require__2(6760);\n var invert = __webpack_require__2(7608);\n var bsearch = __webpack_require__2(2478);\n var gradient = __webpack_require__2(6199);\n var shaders = __webpack_require__2(990);\n var createShader = shaders.createShader;\n var createContourShader = shaders.createContourShader;\n var createPickShader = shaders.createPickShader;\n var createPickContourShader = shaders.createPickContourShader;\n var SURFACE_VERTEX_SIZE = 4 * (4 + 3 + 3);\n var IDENTITY = [\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ];\n var QUAD = [\n [0, 0],\n [0, 1],\n [1, 0],\n [1, 1],\n [1, 0],\n [0, 1]\n ];\n var PERMUTATIONS = [\n [0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0]\n ];\n (function() {\n for (var i = 0; i < 3; ++i) {\n var p = PERMUTATIONS[i];\n var u = (i + 1) % 3;\n var v = (i + 2) % 3;\n p[u + 0] = 1;\n p[v + 3] = 1;\n p[i + 6] = 1;\n }\n })();\n function SurfacePickResult(position, index, uv, level, dataCoordinate) {\n this.position = position;\n this.index = index;\n this.uv = uv;\n this.level = level;\n this.dataCoordinate = dataCoordinate;\n }\n var N_COLORS = 256;\n function SurfacePlot(gl2, shape, bounds, shader, pickShader, coordinates, vao, colorMap, contourShader, contourPickShader, contourBuffer, contourVAO, dynamicBuffer, dynamicVAO, objectOffset) {\n this.gl = gl2;\n this.shape = shape;\n this.bounds = bounds;\n this.objectOffset = objectOffset;\n this.intensityBounds = [];\n this._shader = shader;\n this._pickShader = pickShader;\n this._coordinateBuffer = coordinates;\n this._vao = vao;\n this._colorMap = colorMap;\n this._contourShader = contourShader;\n this._contourPickShader = contourPickShader;\n this._contourBuffer = contourBuffer;\n this._contourVAO = contourVAO;\n this._contourOffsets = [[], [], []];\n this._contourCounts = [[], [], []];\n this._vertexCount = 0;\n this._pickResult = new SurfacePickResult([0, 0, 0], [0, 0], [0, 0], [0, 0, 0], [0, 0, 0]);\n this._dynamicBuffer = dynamicBuffer;\n this._dynamicVAO = dynamicVAO;\n this._dynamicOffsets = [0, 0, 0];\n this._dynamicCounts = [0, 0, 0];\n this.contourWidth = [1, 1, 1];\n this.contourLevels = [[1], [1], [1]];\n this.contourTint = [0, 0, 0];\n this.contourColor = [[0.5, 0.5, 0.5, 1], [0.5, 0.5, 0.5, 1], [0.5, 0.5, 0.5, 1]];\n this.showContour = true;\n this.showSurface = true;\n this.enableHighlight = [true, true, true];\n this.highlightColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]];\n this.highlightTint = [1, 1, 1];\n this.highlightLevel = [-1, -1, -1];\n this.enableDynamic = [true, true, true];\n this.dynamicLevel = [NaN, NaN, NaN];\n this.dynamicColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]];\n this.dynamicTint = [1, 1, 1];\n this.dynamicWidth = [1, 1, 1];\n this.axesBounds = [[Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]];\n this.surfaceProject = [false, false, false];\n this.contourProject = [\n [false, false, false],\n [false, false, false],\n [false, false, false]\n ];\n this.colorBounds = [false, false];\n this._field = [\n ndarray(pool.mallocFloat(1024), [0, 0]),\n ndarray(pool.mallocFloat(1024), [0, 0]),\n ndarray(pool.mallocFloat(1024), [0, 0])\n ];\n this.pickId = 1;\n this.clipBounds = [[-Infinity, -Infinity, -Infinity], [Infinity, Infinity, Infinity]];\n this.snapToData = false;\n this.pixelRatio = 1;\n this.opacity = 1;\n this.lightPosition = [10, 1e4, 0];\n this.ambientLight = 0.8;\n this.diffuseLight = 0.8;\n this.specularLight = 2;\n this.roughness = 0.5;\n this.fresnel = 1.5;\n this.vertexColor = 0;\n this.dirty = true;\n }\n var proto = SurfacePlot.prototype;\n proto.genColormap = function(name2, opacityscale) {\n var hasAlpha = false;\n var x = pack([colormap({\n colormap: name2,\n nshades: N_COLORS,\n format: \"rgba\"\n }).map(function(c, i) {\n var a = opacityscale ? getOpacityFromScale(i / 255, opacityscale) : c[3];\n if (a < 1) hasAlpha = true;\n return [c[0], c[1], c[2], 255 * a];\n })]);\n ops.divseq(x, 255);\n this.hasAlphaScale = hasAlpha;\n return x;\n };\n proto.isTransparent = function() {\n return this.opacity < 1 || this.hasAlphaScale;\n };\n proto.isOpaque = function() {\n return !this.isTransparent();\n };\n proto.pickSlots = 1;\n proto.setPickBase = function(id) {\n this.pickId = id;\n };\n function getOpacityFromScale(ratio, opacityscale) {\n if (!opacityscale) return 1;\n if (!opacityscale.length) return 1;\n for (var i = 0; i < opacityscale.length; ++i) {\n if (opacityscale.length < 2) return 1;\n if (opacityscale[i][0] === ratio) return opacityscale[i][1];\n if (opacityscale[i][0] > ratio && i > 0) {\n var d = (opacityscale[i][0] - ratio) / (opacityscale[i][0] - opacityscale[i - 1][0]);\n return opacityscale[i][1] * (1 - d) + d * opacityscale[i - 1][1];\n }\n }\n return 1;\n }\n var ZERO_VEC = [0, 0, 0];\n var PROJECT_DATA = {\n showSurface: false,\n showContour: false,\n projections: [IDENTITY.slice(), IDENTITY.slice(), IDENTITY.slice()],\n clipBounds: [\n [[0, 0, 0], [0, 0, 0]],\n [[0, 0, 0], [0, 0, 0]],\n [[0, 0, 0], [0, 0, 0]]\n ]\n };\n function computeProjectionData(camera, obj) {\n var i, j, k;\n var cubeAxis = obj.axes && obj.axes.lastCubeProps.axis || ZERO_VEC;\n var showSurface = obj.showSurface;\n var showContour = obj.showContour;\n for (i = 0; i < 3; ++i) {\n showSurface = showSurface || obj.surfaceProject[i];\n for (j = 0; j < 3; ++j) {\n showContour = showContour || obj.contourProject[i][j];\n }\n }\n for (i = 0; i < 3; ++i) {\n var axisSquish = PROJECT_DATA.projections[i];\n for (j = 0; j < 16; ++j) {\n axisSquish[j] = 0;\n }\n for (j = 0; j < 4; ++j) {\n axisSquish[5 * j] = 1;\n }\n axisSquish[5 * i] = 0;\n axisSquish[12 + i] = obj.axesBounds[+(cubeAxis[i] > 0)][i];\n multiply(axisSquish, camera.model, axisSquish);\n var nclipBounds = PROJECT_DATA.clipBounds[i];\n for (k = 0; k < 2; ++k) {\n for (j = 0; j < 3; ++j) {\n nclipBounds[k][j] = camera.clipBounds[k][j];\n }\n }\n nclipBounds[0][i] = -1e8;\n nclipBounds[1][i] = 1e8;\n }\n PROJECT_DATA.showSurface = showSurface;\n PROJECT_DATA.showContour = showContour;\n return PROJECT_DATA;\n }\n var UNIFORMS = {\n model: IDENTITY,\n view: IDENTITY,\n projection: IDENTITY,\n inverseModel: IDENTITY.slice(),\n lowerBound: [0, 0, 0],\n upperBound: [0, 0, 0],\n colorMap: 0,\n clipBounds: [[0, 0, 0], [0, 0, 0]],\n height: 0,\n contourTint: 0,\n contourColor: [0, 0, 0, 1],\n permutation: [1, 0, 0, 0, 1, 0, 0, 0, 1],\n zOffset: -1e-4,\n objectOffset: [0, 0, 0],\n kambient: 1,\n kdiffuse: 1,\n kspecular: 1,\n lightPosition: [1e3, 1e3, 1e3],\n eyePosition: [0, 0, 0],\n roughness: 1,\n fresnel: 1,\n opacity: 1,\n vertexColor: 0\n };\n var MATRIX_INVERSE = IDENTITY.slice();\n var DEFAULT_PERM = [1, 0, 0, 0, 1, 0, 0, 0, 1];\n function drawCore(params, transparent) {\n params = params || {};\n var gl2 = this.gl;\n gl2.disable(gl2.CULL_FACE);\n this._colorMap.bind(0);\n var uniforms = UNIFORMS;\n uniforms.model = params.model || IDENTITY;\n uniforms.view = params.view || IDENTITY;\n uniforms.projection = params.projection || IDENTITY;\n uniforms.lowerBound = [this.bounds[0][0], this.bounds[0][1], this.colorBounds[0] || this.bounds[0][2]];\n uniforms.upperBound = [this.bounds[1][0], this.bounds[1][1], this.colorBounds[1] || this.bounds[1][2]];\n uniforms.objectOffset = this.objectOffset;\n uniforms.contourColor = this.contourColor[0];\n uniforms.inverseModel = invert(uniforms.inverseModel, uniforms.model);\n for (var i = 0; i < 2; ++i) {\n var clipClamped = uniforms.clipBounds[i];\n for (var j = 0; j < 3; ++j) {\n clipClamped[j] = Math.min(Math.max(this.clipBounds[i][j], -1e8), 1e8);\n }\n }\n uniforms.kambient = this.ambientLight;\n uniforms.kdiffuse = this.diffuseLight;\n uniforms.kspecular = this.specularLight;\n uniforms.roughness = this.roughness;\n uniforms.fresnel = this.fresnel;\n uniforms.opacity = this.opacity;\n uniforms.height = 0;\n uniforms.permutation = DEFAULT_PERM;\n uniforms.vertexColor = this.vertexColor;\n var invCameraMatrix = MATRIX_INVERSE;\n multiply(invCameraMatrix, uniforms.view, uniforms.model);\n multiply(invCameraMatrix, uniforms.projection, invCameraMatrix);\n invert(invCameraMatrix, invCameraMatrix);\n for (i = 0; i < 3; ++i) {\n uniforms.eyePosition[i] = invCameraMatrix[12 + i] / invCameraMatrix[15];\n }\n var w = invCameraMatrix[15];\n for (i = 0; i < 3; ++i) {\n w += this.lightPosition[i] * invCameraMatrix[4 * i + 3];\n }\n for (i = 0; i < 3; ++i) {\n var s = invCameraMatrix[12 + i];\n for (j = 0; j < 3; ++j) {\n s += invCameraMatrix[4 * j + i] * this.lightPosition[j];\n }\n uniforms.lightPosition[i] = s / w;\n }\n var projectData = computeProjectionData(uniforms, this);\n if (projectData.showSurface) {\n this._shader.bind();\n this._shader.uniforms = uniforms;\n this._vao.bind();\n if (this.showSurface && this._vertexCount) {\n this._vao.draw(gl2.TRIANGLES, this._vertexCount);\n }\n for (i = 0; i < 3; ++i) {\n if (!this.surfaceProject[i] || !this.vertexCount) {\n continue;\n }\n this._shader.uniforms.model = projectData.projections[i];\n this._shader.uniforms.clipBounds = projectData.clipBounds[i];\n this._vao.draw(gl2.TRIANGLES, this._vertexCount);\n }\n this._vao.unbind();\n }\n if (projectData.showContour) {\n var shader = this._contourShader;\n uniforms.kambient = 1;\n uniforms.kdiffuse = 0;\n uniforms.kspecular = 0;\n uniforms.opacity = 1;\n shader.bind();\n shader.uniforms = uniforms;\n var vao = this._contourVAO;\n vao.bind();\n for (i = 0; i < 3; ++i) {\n shader.uniforms.permutation = PERMUTATIONS[i];\n gl2.lineWidth(this.contourWidth[i] * this.pixelRatio);\n for (j = 0; j < this.contourLevels[i].length; ++j) {\n if (j === this.highlightLevel[i]) {\n shader.uniforms.contourColor = this.highlightColor[i];\n shader.uniforms.contourTint = this.highlightTint[i];\n } else if (j === 0 || j - 1 === this.highlightLevel[i]) {\n shader.uniforms.contourColor = this.contourColor[i];\n shader.uniforms.contourTint = this.contourTint[i];\n }\n if (!this._contourCounts[i][j]) {\n continue;\n }\n shader.uniforms.height = this.contourLevels[i][j];\n vao.draw(gl2.LINES, this._contourCounts[i][j], this._contourOffsets[i][j]);\n }\n }\n for (i = 0; i < 3; ++i) {\n shader.uniforms.model = projectData.projections[i];\n shader.uniforms.clipBounds = projectData.clipBounds[i];\n for (j = 0; j < 3; ++j) {\n if (!this.contourProject[i][j]) {\n continue;\n }\n shader.uniforms.permutation = PERMUTATIONS[j];\n gl2.lineWidth(this.contourWidth[j] * this.pixelRatio);\n for (var k = 0; k < this.contourLevels[j].length; ++k) {\n if (k === this.highlightLevel[j]) {\n shader.uniforms.contourColor = this.highlightColor[j];\n shader.uniforms.contourTint = this.highlightTint[j];\n } else if (k === 0 || k - 1 === this.highlightLevel[j]) {\n shader.uniforms.contourColor = this.contourColor[j];\n shader.uniforms.contourTint = this.contourTint[j];\n }\n if (!this._contourCounts[j][k]) {\n continue;\n }\n shader.uniforms.height = this.contourLevels[j][k];\n vao.draw(gl2.LINES, this._contourCounts[j][k], this._contourOffsets[j][k]);\n }\n }\n }\n vao.unbind();\n vao = this._dynamicVAO;\n vao.bind();\n for (i = 0; i < 3; ++i) {\n if (this._dynamicCounts[i] === 0) {\n continue;\n }\n shader.uniforms.model = uniforms.model;\n shader.uniforms.clipBounds = uniforms.clipBounds;\n shader.uniforms.permutation = PERMUTATIONS[i];\n gl2.lineWidth(this.dynamicWidth[i] * this.pixelRatio);\n shader.uniforms.contourColor = this.dynamicColor[i];\n shader.uniforms.contourTint = this.dynamicTint[i];\n shader.uniforms.height = this.dynamicLevel[i];\n vao.draw(gl2.LINES, this._dynamicCounts[i], this._dynamicOffsets[i]);\n for (j = 0; j < 3; ++j) {\n if (!this.contourProject[j][i]) {\n continue;\n }\n shader.uniforms.model = projectData.projections[j];\n shader.uniforms.clipBounds = projectData.clipBounds[j];\n vao.draw(gl2.LINES, this._dynamicCounts[i], this._dynamicOffsets[i]);\n }\n }\n vao.unbind();\n }\n }\n proto.draw = function(params) {\n return drawCore.call(this, params, false);\n };\n proto.drawTransparent = function(params) {\n return drawCore.call(this, params, true);\n };\n var PICK_UNIFORMS = {\n model: IDENTITY,\n view: IDENTITY,\n projection: IDENTITY,\n inverseModel: IDENTITY,\n clipBounds: [[0, 0, 0], [0, 0, 0]],\n height: 0,\n shape: [0, 0],\n pickId: 0,\n lowerBound: [0, 0, 0],\n upperBound: [0, 0, 0],\n zOffset: 0,\n objectOffset: [0, 0, 0],\n permutation: [1, 0, 0, 0, 1, 0, 0, 0, 1],\n lightPosition: [0, 0, 0],\n eyePosition: [0, 0, 0]\n };\n proto.drawPick = function(params) {\n params = params || {};\n var gl2 = this.gl;\n gl2.disable(gl2.CULL_FACE);\n var uniforms = PICK_UNIFORMS;\n uniforms.model = params.model || IDENTITY;\n uniforms.view = params.view || IDENTITY;\n uniforms.projection = params.projection || IDENTITY;\n uniforms.shape = this._field[2].shape;\n uniforms.pickId = this.pickId / 255;\n uniforms.lowerBound = this.bounds[0];\n uniforms.upperBound = this.bounds[1];\n uniforms.objectOffset = this.objectOffset;\n uniforms.permutation = DEFAULT_PERM;\n for (var i = 0; i < 2; ++i) {\n var clipClamped = uniforms.clipBounds[i];\n for (var j = 0; j < 3; ++j) {\n clipClamped[j] = Math.min(Math.max(this.clipBounds[i][j], -1e8), 1e8);\n }\n }\n var projectData = computeProjectionData(uniforms, this);\n if (projectData.showSurface) {\n this._pickShader.bind();\n this._pickShader.uniforms = uniforms;\n this._vao.bind();\n this._vao.draw(gl2.TRIANGLES, this._vertexCount);\n for (i = 0; i < 3; ++i) {\n if (!this.surfaceProject[i]) {\n continue;\n }\n this._pickShader.uniforms.model = projectData.projections[i];\n this._pickShader.uniforms.clipBounds = projectData.clipBounds[i];\n this._vao.draw(gl2.TRIANGLES, this._vertexCount);\n }\n this._vao.unbind();\n }\n if (projectData.showContour) {\n var shader = this._contourPickShader;\n shader.bind();\n shader.uniforms = uniforms;\n var vao = this._contourVAO;\n vao.bind();\n for (j = 0; j < 3; ++j) {\n gl2.lineWidth(this.contourWidth[j] * this.pixelRatio);\n shader.uniforms.permutation = PERMUTATIONS[j];\n for (i = 0; i < this.contourLevels[j].length; ++i) {\n if (this._contourCounts[j][i]) {\n shader.uniforms.height = this.contourLevels[j][i];\n vao.draw(gl2.LINES, this._contourCounts[j][i], this._contourOffsets[j][i]);\n }\n }\n }\n for (i = 0; i < 3; ++i) {\n shader.uniforms.model = projectData.projections[i];\n shader.uniforms.clipBounds = projectData.clipBounds[i];\n for (j = 0; j < 3; ++j) {\n if (!this.contourProject[i][j]) {\n continue;\n }\n shader.uniforms.permutation = PERMUTATIONS[j];\n gl2.lineWidth(this.contourWidth[j] * this.pixelRatio);\n for (var k = 0; k < this.contourLevels[j].length; ++k) {\n if (this._contourCounts[j][k]) {\n shader.uniforms.height = this.contourLevels[j][k];\n vao.draw(gl2.LINES, this._contourCounts[j][k], this._contourOffsets[j][k]);\n }\n }\n }\n }\n vao.unbind();\n }\n };\n proto.pick = function(selection) {\n if (!selection) {\n return null;\n }\n if (selection.id !== this.pickId) {\n return null;\n }\n var shape = this._field[2].shape;\n var result = this._pickResult;\n var x = shape[0] * (selection.value[0] + (selection.value[2] >> 4) / 16) / 255;\n var ix = Math.floor(x);\n var fx = x - ix;\n var y = shape[1] * (selection.value[1] + (selection.value[2] & 15) / 16) / 255;\n var iy = Math.floor(y);\n var fy = y - iy;\n ix += 1;\n iy += 1;\n var pos = result.position;\n pos[0] = pos[1] = pos[2] = 0;\n for (var dx = 0; dx < 2; ++dx) {\n var s = dx ? fx : 1 - fx;\n for (var dy = 0; dy < 2; ++dy) {\n var t = dy ? fy : 1 - fy;\n var r = ix + dx;\n var c = iy + dy;\n var w = s * t;\n for (var i = 0; i < 3; ++i) {\n pos[i] += this._field[i].get(r, c) * w;\n }\n }\n }\n var levelIndex = this._pickResult.level;\n for (var j = 0; j < 3; ++j) {\n levelIndex[j] = bsearch.le(this.contourLevels[j], pos[j]);\n if (levelIndex[j] < 0) {\n if (this.contourLevels[j].length > 0) {\n levelIndex[j] = 0;\n }\n } else if (levelIndex[j] < this.contourLevels[j].length - 1) {\n var a = this.contourLevels[j][levelIndex[j]];\n var b = this.contourLevels[j][levelIndex[j] + 1];\n if (Math.abs(a - pos[j]) > Math.abs(b - pos[j])) {\n levelIndex[j] += 1;\n }\n }\n }\n result.index[0] = fx < 0.5 ? ix : ix + 1;\n result.index[1] = fy < 0.5 ? iy : iy + 1;\n result.uv[0] = x / shape[0];\n result.uv[1] = y / shape[1];\n for (i = 0; i < 3; ++i) {\n result.dataCoordinate[i] = this._field[i].get(result.index[0], result.index[1]);\n }\n return result;\n };\n proto.padField = function(dstField, srcField) {\n var srcShape = srcField.shape.slice();\n var dstShape = dstField.shape.slice();\n ops.assign(dstField.lo(1, 1).hi(srcShape[0], srcShape[1]), srcField);\n ops.assign(\n dstField.lo(1).hi(srcShape[0], 1),\n srcField.hi(srcShape[0], 1)\n );\n ops.assign(\n dstField.lo(1, dstShape[1] - 1).hi(srcShape[0], 1),\n srcField.lo(0, srcShape[1] - 1).hi(srcShape[0], 1)\n );\n ops.assign(\n dstField.lo(0, 1).hi(1, srcShape[1]),\n srcField.hi(1)\n );\n ops.assign(\n dstField.lo(dstShape[0] - 1, 1).hi(1, srcShape[1]),\n srcField.lo(srcShape[0] - 1)\n );\n dstField.set(0, 0, srcField.get(0, 0));\n dstField.set(0, dstShape[1] - 1, srcField.get(0, srcShape[1] - 1));\n dstField.set(dstShape[0] - 1, 0, srcField.get(srcShape[0] - 1, 0));\n dstField.set(dstShape[0] - 1, dstShape[1] - 1, srcField.get(srcShape[0] - 1, srcShape[1] - 1));\n };\n function handleArray(param, ctor) {\n if (Array.isArray(param)) {\n return [ctor(param[0]), ctor(param[1]), ctor(param[2])];\n }\n return [ctor(param), ctor(param), ctor(param)];\n }\n function toColor(x) {\n if (Array.isArray(x)) {\n if (x.length === 3) {\n return [x[0], x[1], x[2], 1];\n }\n return [x[0], x[1], x[2], x[3]];\n }\n return [0, 0, 0, 1];\n }\n function handleColor(param) {\n if (Array.isArray(param)) {\n if (Array.isArray(param)) {\n return [\n toColor(param[0]),\n toColor(param[1]),\n toColor(param[2])\n ];\n } else {\n var c = toColor(param);\n return [\n c.slice(),\n c.slice(),\n c.slice()\n ];\n }\n }\n }\n proto.update = function(params) {\n params = params || {};\n this.objectOffset = params.objectOffset || this.objectOffset;\n this.dirty = true;\n if (\"contourWidth\" in params) {\n this.contourWidth = handleArray(params.contourWidth, Number);\n }\n if (\"showContour\" in params) {\n this.showContour = handleArray(params.showContour, Boolean);\n }\n if (\"showSurface\" in params) {\n this.showSurface = !!params.showSurface;\n }\n if (\"contourTint\" in params) {\n this.contourTint = handleArray(params.contourTint, Boolean);\n }\n if (\"contourColor\" in params) {\n this.contourColor = handleColor(params.contourColor);\n }\n if (\"contourProject\" in params) {\n this.contourProject = handleArray(params.contourProject, function(x2) {\n return handleArray(x2, Boolean);\n });\n }\n if (\"surfaceProject\" in params) {\n this.surfaceProject = params.surfaceProject;\n }\n if (\"dynamicColor\" in params) {\n this.dynamicColor = handleColor(params.dynamicColor);\n }\n if (\"dynamicTint\" in params) {\n this.dynamicTint = handleArray(params.dynamicTint, Number);\n }\n if (\"dynamicWidth\" in params) {\n this.dynamicWidth = handleArray(params.dynamicWidth, Number);\n }\n if (\"opacity\" in params) {\n this.opacity = params.opacity;\n }\n if (\"opacityscale\" in params) {\n this.opacityscale = params.opacityscale;\n }\n if (\"colorBounds\" in params) {\n this.colorBounds = params.colorBounds;\n }\n if (\"vertexColor\" in params) {\n this.vertexColor = params.vertexColor ? 1 : 0;\n }\n if (\"colormap\" in params) {\n this._colorMap.setPixels(this.genColormap(params.colormap, this.opacityscale));\n }\n var field = params.field || params.coords && params.coords[2] || null;\n var levelsChanged = false;\n if (!field) {\n if (this._field[2].shape[0] || this._field[2].shape[2]) {\n field = this._field[2].lo(1, 1).hi(this._field[2].shape[0] - 2, this._field[2].shape[1] - 2);\n } else {\n field = this._field[2].hi(0, 0);\n }\n }\n if (\"field\" in params || \"coords\" in params) {\n var fsize = (field.shape[0] + 2) * (field.shape[1] + 2);\n if (fsize > this._field[2].data.length) {\n pool.freeFloat(this._field[2].data);\n this._field[2].data = pool.mallocFloat(bits.nextPow2(fsize));\n }\n this._field[2] = ndarray(this._field[2].data, [field.shape[0] + 2, field.shape[1] + 2]);\n this.padField(this._field[2], field);\n this.shape = field.shape.slice();\n var shape = this.shape;\n for (var i = 0; i < 2; ++i) {\n if (this._field[2].size > this._field[i].data.length) {\n pool.freeFloat(this._field[i].data);\n this._field[i].data = pool.mallocFloat(this._field[2].size);\n }\n this._field[i] = ndarray(this._field[i].data, [shape[0] + 2, shape[1] + 2]);\n }\n if (params.coords) {\n var coords = params.coords;\n if (!Array.isArray(coords) || coords.length !== 3) {\n throw new Error(\"gl-surface: invalid coordinates for x/y\");\n }\n for (i = 0; i < 2; ++i) {\n var coord = coords[i];\n for (j = 0; j < 2; ++j) {\n if (coord.shape[j] !== shape[j]) {\n throw new Error(\"gl-surface: coords have incorrect shape\");\n }\n }\n this.padField(this._field[i], coord);\n }\n } else if (params.ticks) {\n var ticks = params.ticks;\n if (!Array.isArray(ticks) || ticks.length !== 2) {\n throw new Error(\"gl-surface: invalid ticks\");\n }\n for (i = 0; i < 2; ++i) {\n var tick = ticks[i];\n if (Array.isArray(tick) || tick.length) {\n tick = ndarray(tick);\n }\n if (tick.shape[0] !== shape[i]) {\n throw new Error(\"gl-surface: invalid tick length\");\n }\n var tick2 = ndarray(tick.data, shape);\n tick2.stride[i] = tick.stride[0];\n tick2.stride[i ^ 1] = 0;\n this.padField(this._field[i], tick2);\n }\n } else {\n for (i = 0; i < 2; ++i) {\n var offset = [0, 0];\n offset[i] = 1;\n this._field[i] = ndarray(this._field[i].data, [shape[0] + 2, shape[1] + 2], offset, 0);\n }\n this._field[0].set(0, 0, 0);\n for (var j = 0; j < shape[0]; ++j) {\n this._field[0].set(j + 1, 0, j);\n }\n this._field[0].set(shape[0] + 1, 0, shape[0] - 1);\n this._field[1].set(0, 0, 0);\n for (j = 0; j < shape[1]; ++j) {\n this._field[1].set(0, j + 1, j);\n }\n this._field[1].set(0, shape[1] + 1, shape[1] - 1);\n }\n var fields = this._field;\n var dfields = ndarray(pool.mallocFloat(fields[2].size * 3 * 2), [3, shape[0] + 2, shape[1] + 2, 2]);\n for (i = 0; i < 3; ++i) {\n gradient(dfields.pick(i), fields[i], \"mirror\");\n }\n var normals = ndarray(pool.mallocFloat(fields[2].size * 3), [shape[0] + 2, shape[1] + 2, 3]);\n for (i = 0; i < shape[0] + 2; ++i) {\n for (j = 0; j < shape[1] + 2; ++j) {\n var dxdu = dfields.get(0, i, j, 0);\n var dxdv = dfields.get(0, i, j, 1);\n var dydu = dfields.get(1, i, j, 0);\n var dydv = dfields.get(1, i, j, 1);\n var dzdu = dfields.get(2, i, j, 0);\n var dzdv = dfields.get(2, i, j, 1);\n var nx = dydu * dzdv - dydv * dzdu;\n var ny = dzdu * dxdv - dzdv * dxdu;\n var nz = dxdu * dydv - dxdv * dydu;\n var nl = Math.sqrt(nx * nx + ny * ny + nz * nz);\n if (nl < 1e-8) {\n nl = Math.max(Math.abs(nx), Math.abs(ny), Math.abs(nz));\n if (nl < 1e-8) {\n nz = 1;\n ny = nx = 0;\n nl = 1;\n } else {\n nl = 1 / nl;\n }\n } else {\n nl = 1 / Math.sqrt(nl);\n }\n normals.set(i, j, 0, nx * nl);\n normals.set(i, j, 1, ny * nl);\n normals.set(i, j, 2, nz * nl);\n }\n }\n pool.free(dfields.data);\n var lo = [Infinity, Infinity, Infinity];\n var hi = [-Infinity, -Infinity, -Infinity];\n var lo_intensity = Infinity;\n var hi_intensity = -Infinity;\n var count = (shape[0] - 1) * (shape[1] - 1) * 6;\n var tverts = pool.mallocFloat(bits.nextPow2(10 * count));\n var tptr = 0;\n var vertexCount = 0;\n for (i = 0; i < shape[0] - 1; ++i) {\n j_loop:\n for (j = 0; j < shape[1] - 1; ++j) {\n for (var dx = 0; dx < 2; ++dx) {\n for (var dy = 0; dy < 2; ++dy) {\n for (var k = 0; k < 3; ++k) {\n var f = this._field[k].get(1 + i + dx, 1 + j + dy);\n if (isNaN(f) || !isFinite(f)) {\n continue j_loop;\n }\n }\n }\n }\n for (k = 0; k < 6; ++k) {\n var r = i + QUAD[k][0];\n var c = j + QUAD[k][1];\n var tx = this._field[0].get(r + 1, c + 1);\n var ty = this._field[1].get(r + 1, c + 1);\n f = this._field[2].get(r + 1, c + 1);\n nx = normals.get(r + 1, c + 1, 0);\n ny = normals.get(r + 1, c + 1, 1);\n nz = normals.get(r + 1, c + 1, 2);\n if (params.intensity) {\n vf = params.intensity.get(r, c);\n }\n var vf = params.intensity ? params.intensity.get(r, c) : f + this.objectOffset[2];\n tverts[tptr++] = r;\n tverts[tptr++] = c;\n tverts[tptr++] = tx;\n tverts[tptr++] = ty;\n tverts[tptr++] = f;\n tverts[tptr++] = 0;\n tverts[tptr++] = vf;\n tverts[tptr++] = nx;\n tverts[tptr++] = ny;\n tverts[tptr++] = nz;\n lo[0] = Math.min(lo[0], tx + this.objectOffset[0]);\n lo[1] = Math.min(lo[1], ty + this.objectOffset[1]);\n lo[2] = Math.min(lo[2], f + this.objectOffset[2]);\n lo_intensity = Math.min(lo_intensity, vf);\n hi[0] = Math.max(hi[0], tx + this.objectOffset[0]);\n hi[1] = Math.max(hi[1], ty + this.objectOffset[1]);\n hi[2] = Math.max(hi[2], f + this.objectOffset[2]);\n hi_intensity = Math.max(hi_intensity, vf);\n vertexCount += 1;\n }\n }\n }\n if (params.intensityBounds) {\n lo_intensity = +params.intensityBounds[0];\n hi_intensity = +params.intensityBounds[1];\n }\n for (i = 6; i < tptr; i += 10) {\n tverts[i] = (tverts[i] - lo_intensity) / (hi_intensity - lo_intensity);\n }\n this._vertexCount = vertexCount;\n this._coordinateBuffer.update(tverts.subarray(0, tptr));\n pool.freeFloat(tverts);\n pool.free(normals.data);\n this.bounds = [lo, hi];\n this.intensity = params.intensity || this._field[2];\n if (this.intensityBounds[0] !== lo_intensity || this.intensityBounds[1] !== hi_intensity) {\n levelsChanged = true;\n }\n this.intensityBounds = [lo_intensity, hi_intensity];\n }\n if (\"levels\" in params) {\n var levels = params.levels;\n if (!Array.isArray(levels[0])) {\n levels = [[], [], levels];\n } else {\n levels = levels.slice();\n }\n for (i = 0; i < 3; ++i) {\n levels[i] = levels[i].slice();\n levels[i].sort(function(a, b) {\n return a - b;\n });\n }\n for (i = 0; i < 3; ++i) {\n for (j = 0; j < levels[i].length; ++j) {\n levels[i][j] -= this.objectOffset[i];\n }\n }\n change_test:\n for (i = 0; i < 3; ++i) {\n if (levels[i].length !== this.contourLevels[i].length) {\n levelsChanged = true;\n break;\n }\n for (j = 0; j < levels[i].length; ++j) {\n if (levels[i][j] !== this.contourLevels[i][j]) {\n levelsChanged = true;\n break change_test;\n }\n }\n }\n this.contourLevels = levels;\n }\n if (levelsChanged) {\n fields = this._field;\n shape = this.shape;\n var contourVerts = [];\n for (var dim = 0; dim < 3; ++dim) {\n var contourLevel = this.contourLevels[dim];\n var levelOffsets = [];\n var levelCounts = [];\n var parts = [0, 0, 0];\n for (i = 0; i < contourLevel.length; ++i) {\n var graph = surfaceNets(this._field[dim], contourLevel[i]);\n levelOffsets.push(contourVerts.length / 5 | 0);\n vertexCount = 0;\n edge_loop:\n for (j = 0; j < graph.cells.length; ++j) {\n var e = graph.cells[j];\n for (k = 0; k < 2; ++k) {\n var p = graph.positions[e[k]];\n var x = p[0];\n var ix = Math.floor(x) | 0;\n var fx = x - ix;\n var y = p[1];\n var iy = Math.floor(y) | 0;\n var fy = y - iy;\n var hole = false;\n axis_loop:\n for (var axis = 0; axis < 3; ++axis) {\n parts[axis] = 0;\n var iu = (dim + axis + 1) % 3;\n for (dx = 0; dx < 2; ++dx) {\n var s = dx ? fx : 1 - fx;\n r = Math.min(Math.max(ix + dx, 0), shape[0]) | 0;\n for (dy = 0; dy < 2; ++dy) {\n var t = dy ? fy : 1 - fy;\n c = Math.min(Math.max(iy + dy, 0), shape[1]) | 0;\n if (axis < 2) {\n f = this._field[iu].get(r, c);\n } else {\n f = (this.intensity.get(r, c) - this.intensityBounds[0]) / (this.intensityBounds[1] - this.intensityBounds[0]);\n }\n if (!isFinite(f) || isNaN(f)) {\n hole = true;\n break axis_loop;\n }\n var w = s * t;\n parts[axis] += w * f;\n }\n }\n }\n if (!hole) {\n contourVerts.push(\n parts[0],\n parts[1],\n p[0],\n p[1],\n parts[2]\n );\n vertexCount += 1;\n } else {\n if (k > 0) {\n for (var l = 0; l < 5; ++l) {\n contourVerts.pop();\n }\n vertexCount -= 1;\n }\n continue edge_loop;\n }\n }\n }\n levelCounts.push(vertexCount);\n }\n this._contourOffsets[dim] = levelOffsets;\n this._contourCounts[dim] = levelCounts;\n }\n var floatBuffer = pool.mallocFloat(contourVerts.length);\n for (i = 0; i < contourVerts.length; ++i) {\n floatBuffer[i] = contourVerts[i];\n }\n this._contourBuffer.update(floatBuffer);\n pool.freeFloat(floatBuffer);\n }\n };\n proto.dispose = function() {\n this._shader.dispose();\n this._vao.dispose();\n this._coordinateBuffer.dispose();\n this._colorMap.dispose();\n this._contourBuffer.dispose();\n this._contourVAO.dispose();\n this._contourShader.dispose();\n this._contourPickShader.dispose();\n this._dynamicBuffer.dispose();\n this._dynamicVAO.dispose();\n for (var i = 0; i < 3; ++i) {\n pool.freeFloat(this._field[i].data);\n }\n };\n proto.highlight = function(selection) {\n var i;\n if (!selection) {\n this._dynamicCounts = [0, 0, 0];\n this.dyanamicLevel = [NaN, NaN, NaN];\n this.highlightLevel = [-1, -1, -1];\n return;\n }\n for (i = 0; i < 3; ++i) {\n if (this.enableHighlight[i]) {\n this.highlightLevel[i] = selection.level[i];\n } else {\n this.highlightLevel[i] = -1;\n }\n }\n var levels;\n if (this.snapToData) {\n levels = selection.dataCoordinate;\n } else {\n levels = selection.position;\n }\n for (i = 0; i < 3; ++i) {\n levels[i] -= this.objectOffset[i];\n }\n if ((!this.enableDynamic[0] || levels[0] === this.dynamicLevel[0]) && (!this.enableDynamic[1] || levels[1] === this.dynamicLevel[1]) && (!this.enableDynamic[2] || levels[2] === this.dynamicLevel[2])) {\n return;\n }\n var vertexCount = 0;\n var shape = this.shape;\n var scratchBuffer = pool.mallocFloat(12 * shape[0] * shape[1]);\n for (var d = 0; d < 3; ++d) {\n if (!this.enableDynamic[d]) {\n this.dynamicLevel[d] = NaN;\n this._dynamicCounts[d] = 0;\n continue;\n }\n this.dynamicLevel[d] = levels[d];\n var u = (d + 1) % 3;\n var v = (d + 2) % 3;\n var f = this._field[d];\n var g = this._field[u];\n var h = this._field[v];\n var graph = surfaceNets(f, levels[d]);\n var edges = graph.cells;\n var positions = graph.positions;\n this._dynamicOffsets[d] = vertexCount;\n for (i = 0; i < edges.length; ++i) {\n var e = edges[i];\n for (var j = 0; j < 2; ++j) {\n var p = positions[e[j]];\n var x = +p[0];\n var ix = x | 0;\n var jx = Math.min(ix + 1, shape[0]) | 0;\n var fx = x - ix;\n var hx = 1 - fx;\n var y = +p[1];\n var iy = y | 0;\n var jy = Math.min(iy + 1, shape[1]) | 0;\n var fy = y - iy;\n var hy = 1 - fy;\n var w00 = hx * hy;\n var w01 = hx * fy;\n var w10 = fx * hy;\n var w11 = fx * fy;\n var cu = w00 * g.get(ix, iy) + w01 * g.get(ix, jy) + w10 * g.get(jx, iy) + w11 * g.get(jx, jy);\n var cv = w00 * h.get(ix, iy) + w01 * h.get(ix, jy) + w10 * h.get(jx, iy) + w11 * h.get(jx, jy);\n if (isNaN(cu) || isNaN(cv)) {\n if (j) {\n vertexCount -= 1;\n }\n break;\n }\n scratchBuffer[2 * vertexCount + 0] = cu;\n scratchBuffer[2 * vertexCount + 1] = cv;\n vertexCount += 1;\n }\n }\n this._dynamicCounts[d] = vertexCount - this._dynamicOffsets[d];\n }\n this._dynamicBuffer.update(scratchBuffer.subarray(0, 2 * vertexCount));\n pool.freeFloat(scratchBuffer);\n };\n function createSurfacePlot(params) {\n var gl2 = params.gl;\n var shader = createShader(gl2);\n var pickShader = createPickShader(gl2);\n var contourShader = createContourShader(gl2);\n var contourPickShader = createPickContourShader(gl2);\n var coordinateBuffer = createBuffer(gl2);\n var vao = createVAO(gl2, [\n {\n buffer: coordinateBuffer,\n size: 4,\n stride: SURFACE_VERTEX_SIZE,\n offset: 0\n },\n {\n buffer: coordinateBuffer,\n size: 3,\n stride: SURFACE_VERTEX_SIZE,\n offset: 16\n },\n {\n buffer: coordinateBuffer,\n size: 3,\n stride: SURFACE_VERTEX_SIZE,\n offset: 28\n }\n ]);\n var contourBuffer = createBuffer(gl2);\n var contourVAO = createVAO(gl2, [\n {\n buffer: contourBuffer,\n size: 4,\n stride: 20,\n offset: 0\n },\n {\n buffer: contourBuffer,\n size: 1,\n stride: 20,\n offset: 16\n }\n ]);\n var dynamicBuffer = createBuffer(gl2);\n var dynamicVAO = createVAO(gl2, [\n {\n buffer: dynamicBuffer,\n size: 2,\n type: gl2.FLOAT\n }\n ]);\n var cmap = createTexture(gl2, 1, N_COLORS, gl2.RGBA, gl2.UNSIGNED_BYTE);\n cmap.minFilter = gl2.LINEAR;\n cmap.magFilter = gl2.LINEAR;\n var surface = new SurfacePlot(\n gl2,\n [0, 0],\n // shape\n [[0, 0, 0], [0, 0, 0]],\n // bounds\n shader,\n pickShader,\n coordinateBuffer,\n vao,\n cmap,\n contourShader,\n contourPickShader,\n contourBuffer,\n contourVAO,\n dynamicBuffer,\n dynamicVAO,\n [0, 0, 0]\n // objectOffset\n );\n var nparams = {\n levels: [[], [], []]\n };\n for (var id in params) {\n nparams[id] = params[id];\n }\n nparams.colormap = nparams.colormap || \"jet\";\n surface.update(nparams);\n return surface;\n }\n }\n ),\n /***/\n 7766: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var ndarray = __webpack_require__2(9618);\n var ops = __webpack_require__2(5298);\n var pool = __webpack_require__2(1888);\n module2.exports = createTexture2D;\n var linearTypes = null;\n var filterTypes = null;\n var wrapTypes = null;\n function lazyInitLinearTypes(gl2) {\n linearTypes = [\n gl2.LINEAR,\n gl2.NEAREST_MIPMAP_LINEAR,\n gl2.LINEAR_MIPMAP_NEAREST,\n gl2.LINEAR_MIPMAP_NEAREST\n ];\n filterTypes = [\n gl2.NEAREST,\n gl2.LINEAR,\n gl2.NEAREST_MIPMAP_NEAREST,\n gl2.NEAREST_MIPMAP_LINEAR,\n gl2.LINEAR_MIPMAP_NEAREST,\n gl2.LINEAR_MIPMAP_LINEAR\n ];\n wrapTypes = [\n gl2.REPEAT,\n gl2.CLAMP_TO_EDGE,\n gl2.MIRRORED_REPEAT\n ];\n }\n function acceptTextureDOM(obj) {\n return \"undefined\" != typeof HTMLCanvasElement && obj instanceof HTMLCanvasElement || \"undefined\" != typeof HTMLImageElement && obj instanceof HTMLImageElement || \"undefined\" != typeof HTMLVideoElement && obj instanceof HTMLVideoElement || \"undefined\" != typeof ImageData && obj instanceof ImageData;\n }\n var convertFloatToUint8 = function(out, inp) {\n ops.muls(out, inp, 255);\n };\n function reshapeTexture(tex, w, h) {\n var gl2 = tex.gl;\n var maxSize = gl2.getParameter(gl2.MAX_TEXTURE_SIZE);\n if (w < 0 || w > maxSize || h < 0 || h > maxSize) {\n throw new Error(\"gl-texture2d: Invalid texture size\");\n }\n tex._shape = [w, h];\n tex.bind();\n gl2.texImage2D(gl2.TEXTURE_2D, 0, tex.format, w, h, 0, tex.format, tex.type, null);\n tex._mipLevels = [0];\n return tex;\n }\n function Texture2D(gl2, handle, width, height, format, type) {\n this.gl = gl2;\n this.handle = handle;\n this.format = format;\n this.type = type;\n this._shape = [width, height];\n this._mipLevels = [0];\n this._magFilter = gl2.NEAREST;\n this._minFilter = gl2.NEAREST;\n this._wrapS = gl2.CLAMP_TO_EDGE;\n this._wrapT = gl2.CLAMP_TO_EDGE;\n this._anisoSamples = 1;\n var parent = this;\n var wrapVector = [this._wrapS, this._wrapT];\n Object.defineProperties(wrapVector, [\n {\n get: function() {\n return parent._wrapS;\n },\n set: function(v) {\n return parent.wrapS = v;\n }\n },\n {\n get: function() {\n return parent._wrapT;\n },\n set: function(v) {\n return parent.wrapT = v;\n }\n }\n ]);\n this._wrapVector = wrapVector;\n var shapeVector = [this._shape[0], this._shape[1]];\n Object.defineProperties(shapeVector, [\n {\n get: function() {\n return parent._shape[0];\n },\n set: function(v) {\n return parent.width = v;\n }\n },\n {\n get: function() {\n return parent._shape[1];\n },\n set: function(v) {\n return parent.height = v;\n }\n }\n ]);\n this._shapeVector = shapeVector;\n }\n var proto = Texture2D.prototype;\n Object.defineProperties(proto, {\n minFilter: {\n get: function() {\n return this._minFilter;\n },\n set: function(v) {\n this.bind();\n var gl2 = this.gl;\n if (this.type === gl2.FLOAT && linearTypes.indexOf(v) >= 0) {\n if (!gl2.getExtension(\"OES_texture_float_linear\")) {\n v = gl2.NEAREST;\n }\n }\n if (filterTypes.indexOf(v) < 0) {\n throw new Error(\"gl-texture2d: Unknown filter mode \" + v);\n }\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_MIN_FILTER, v);\n return this._minFilter = v;\n }\n },\n magFilter: {\n get: function() {\n return this._magFilter;\n },\n set: function(v) {\n this.bind();\n var gl2 = this.gl;\n if (this.type === gl2.FLOAT && linearTypes.indexOf(v) >= 0) {\n if (!gl2.getExtension(\"OES_texture_float_linear\")) {\n v = gl2.NEAREST;\n }\n }\n if (filterTypes.indexOf(v) < 0) {\n throw new Error(\"gl-texture2d: Unknown filter mode \" + v);\n }\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_MAG_FILTER, v);\n return this._magFilter = v;\n }\n },\n mipSamples: {\n get: function() {\n return this._anisoSamples;\n },\n set: function(i) {\n var psamples = this._anisoSamples;\n this._anisoSamples = Math.max(i, 1) | 0;\n if (psamples !== this._anisoSamples) {\n var ext = this.gl.getExtension(\"EXT_texture_filter_anisotropic\");\n if (ext) {\n this.gl.texParameterf(this.gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, this._anisoSamples);\n }\n }\n return this._anisoSamples;\n }\n },\n wrapS: {\n get: function() {\n return this._wrapS;\n },\n set: function(v) {\n this.bind();\n if (wrapTypes.indexOf(v) < 0) {\n throw new Error(\"gl-texture2d: Unknown wrap mode \" + v);\n }\n this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, v);\n return this._wrapS = v;\n }\n },\n wrapT: {\n get: function() {\n return this._wrapT;\n },\n set: function(v) {\n this.bind();\n if (wrapTypes.indexOf(v) < 0) {\n throw new Error(\"gl-texture2d: Unknown wrap mode \" + v);\n }\n this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, v);\n return this._wrapT = v;\n }\n },\n wrap: {\n get: function() {\n return this._wrapVector;\n },\n set: function(v) {\n if (!Array.isArray(v)) {\n v = [v, v];\n }\n if (v.length !== 2) {\n throw new Error(\"gl-texture2d: Must specify wrap mode for rows and columns\");\n }\n for (var i = 0; i < 2; ++i) {\n if (wrapTypes.indexOf(v[i]) < 0) {\n throw new Error(\"gl-texture2d: Unknown wrap mode \" + v);\n }\n }\n this._wrapS = v[0];\n this._wrapT = v[1];\n var gl2 = this.gl;\n this.bind();\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_WRAP_S, this._wrapS);\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_WRAP_T, this._wrapT);\n return v;\n }\n },\n shape: {\n get: function() {\n return this._shapeVector;\n },\n set: function(x) {\n if (!Array.isArray(x)) {\n x = [x | 0, x | 0];\n } else {\n if (x.length !== 2) {\n throw new Error(\"gl-texture2d: Invalid texture shape\");\n }\n }\n reshapeTexture(this, x[0] | 0, x[1] | 0);\n return [x[0] | 0, x[1] | 0];\n }\n },\n width: {\n get: function() {\n return this._shape[0];\n },\n set: function(w) {\n w = w | 0;\n reshapeTexture(this, w, this._shape[1]);\n return w;\n }\n },\n height: {\n get: function() {\n return this._shape[1];\n },\n set: function(h) {\n h = h | 0;\n reshapeTexture(this, this._shape[0], h);\n return h;\n }\n }\n });\n proto.bind = function(unit) {\n var gl2 = this.gl;\n if (unit !== void 0) {\n gl2.activeTexture(gl2.TEXTURE0 + (unit | 0));\n }\n gl2.bindTexture(gl2.TEXTURE_2D, this.handle);\n if (unit !== void 0) {\n return unit | 0;\n }\n return gl2.getParameter(gl2.ACTIVE_TEXTURE) - gl2.TEXTURE0;\n };\n proto.dispose = function() {\n this.gl.deleteTexture(this.handle);\n };\n proto.generateMipmap = function() {\n this.bind();\n this.gl.generateMipmap(this.gl.TEXTURE_2D);\n var l = Math.min(this._shape[0], this._shape[1]);\n for (var i = 0; l > 0; ++i, l >>>= 1) {\n if (this._mipLevels.indexOf(i) < 0) {\n this._mipLevels.push(i);\n }\n }\n };\n proto.setPixels = function(data, x_off, y_off, mip_level) {\n var gl2 = this.gl;\n this.bind();\n if (Array.isArray(x_off)) {\n mip_level = y_off;\n y_off = x_off[1] | 0;\n x_off = x_off[0] | 0;\n } else {\n x_off = x_off || 0;\n y_off = y_off || 0;\n }\n mip_level = mip_level || 0;\n var directData = acceptTextureDOM(data) ? data : data.raw;\n if (directData) {\n var needsMip = this._mipLevels.indexOf(mip_level) < 0;\n if (needsMip) {\n gl2.texImage2D(gl2.TEXTURE_2D, 0, this.format, this.format, this.type, directData);\n this._mipLevels.push(mip_level);\n } else {\n gl2.texSubImage2D(gl2.TEXTURE_2D, mip_level, x_off, y_off, this.format, this.type, directData);\n }\n } else if (data.shape && data.stride && data.data) {\n if (data.shape.length < 2 || x_off + data.shape[1] > this._shape[1] >>> mip_level || y_off + data.shape[0] > this._shape[0] >>> mip_level || x_off < 0 || y_off < 0) {\n throw new Error(\"gl-texture2d: Texture dimensions are out of bounds\");\n }\n texSubImageArray(gl2, x_off, y_off, mip_level, this.format, this.type, this._mipLevels, data);\n } else {\n throw new Error(\"gl-texture2d: Unsupported data type\");\n }\n };\n function isPacked(shape, stride) {\n if (shape.length === 3) {\n return stride[2] === 1 && stride[1] === shape[0] * shape[2] && stride[0] === shape[2];\n }\n return stride[0] === 1 && stride[1] === shape[0];\n }\n function texSubImageArray(gl2, x_off, y_off, mip_level, cformat, ctype, mipLevels, array) {\n var dtype = array.dtype;\n var shape = array.shape.slice();\n if (shape.length < 2 || shape.length > 3) {\n throw new Error(\"gl-texture2d: Invalid ndarray, must be 2d or 3d\");\n }\n var type = 0, format = 0;\n var packed = isPacked(shape, array.stride.slice());\n if (dtype === \"float32\") {\n type = gl2.FLOAT;\n } else if (dtype === \"float64\") {\n type = gl2.FLOAT;\n packed = false;\n dtype = \"float32\";\n } else if (dtype === \"uint8\") {\n type = gl2.UNSIGNED_BYTE;\n } else {\n type = gl2.UNSIGNED_BYTE;\n packed = false;\n dtype = \"uint8\";\n }\n var channels = 1;\n if (shape.length === 2) {\n format = gl2.LUMINANCE;\n shape = [shape[0], shape[1], 1];\n array = ndarray(array.data, shape, [array.stride[0], array.stride[1], 1], array.offset);\n } else if (shape.length === 3) {\n if (shape[2] === 1) {\n format = gl2.ALPHA;\n } else if (shape[2] === 2) {\n format = gl2.LUMINANCE_ALPHA;\n } else if (shape[2] === 3) {\n format = gl2.RGB;\n } else if (shape[2] === 4) {\n format = gl2.RGBA;\n } else {\n throw new Error(\"gl-texture2d: Invalid shape for pixel coords\");\n }\n channels = shape[2];\n } else {\n throw new Error(\"gl-texture2d: Invalid shape for texture\");\n }\n if ((format === gl2.LUMINANCE || format === gl2.ALPHA) && (cformat === gl2.LUMINANCE || cformat === gl2.ALPHA)) {\n format = cformat;\n }\n if (format !== cformat) {\n throw new Error(\"gl-texture2d: Incompatible texture format for setPixels\");\n }\n var size = array.size;\n var needsMip = mipLevels.indexOf(mip_level) < 0;\n if (needsMip) {\n mipLevels.push(mip_level);\n }\n if (type === ctype && packed) {\n if (array.offset === 0 && array.data.length === size) {\n if (needsMip) {\n gl2.texImage2D(gl2.TEXTURE_2D, mip_level, cformat, shape[0], shape[1], 0, cformat, ctype, array.data);\n } else {\n gl2.texSubImage2D(gl2.TEXTURE_2D, mip_level, x_off, y_off, shape[0], shape[1], cformat, ctype, array.data);\n }\n } else {\n if (needsMip) {\n gl2.texImage2D(gl2.TEXTURE_2D, mip_level, cformat, shape[0], shape[1], 0, cformat, ctype, array.data.subarray(array.offset, array.offset + size));\n } else {\n gl2.texSubImage2D(gl2.TEXTURE_2D, mip_level, x_off, y_off, shape[0], shape[1], cformat, ctype, array.data.subarray(array.offset, array.offset + size));\n }\n }\n } else {\n var pack_buffer;\n if (ctype === gl2.FLOAT) {\n pack_buffer = pool.mallocFloat32(size);\n } else {\n pack_buffer = pool.mallocUint8(size);\n }\n var pack_view = ndarray(pack_buffer, shape, [shape[2], shape[2] * shape[0], 1]);\n if (type === gl2.FLOAT && ctype === gl2.UNSIGNED_BYTE) {\n convertFloatToUint8(pack_view, array);\n } else {\n ops.assign(pack_view, array);\n }\n if (needsMip) {\n gl2.texImage2D(gl2.TEXTURE_2D, mip_level, cformat, shape[0], shape[1], 0, cformat, ctype, pack_buffer.subarray(0, size));\n } else {\n gl2.texSubImage2D(gl2.TEXTURE_2D, mip_level, x_off, y_off, shape[0], shape[1], cformat, ctype, pack_buffer.subarray(0, size));\n }\n if (ctype === gl2.FLOAT) {\n pool.freeFloat32(pack_buffer);\n } else {\n pool.freeUint8(pack_buffer);\n }\n }\n }\n function initTexture(gl2) {\n var tex = gl2.createTexture();\n gl2.bindTexture(gl2.TEXTURE_2D, tex);\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_MIN_FILTER, gl2.NEAREST);\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_MAG_FILTER, gl2.NEAREST);\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_WRAP_S, gl2.CLAMP_TO_EDGE);\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_WRAP_T, gl2.CLAMP_TO_EDGE);\n return tex;\n }\n function createTextureShape(gl2, width, height, format, type) {\n var maxTextureSize = gl2.getParameter(gl2.MAX_TEXTURE_SIZE);\n if (width < 0 || width > maxTextureSize || height < 0 || height > maxTextureSize) {\n throw new Error(\"gl-texture2d: Invalid texture shape\");\n }\n if (type === gl2.FLOAT && !gl2.getExtension(\"OES_texture_float\")) {\n throw new Error(\"gl-texture2d: Floating point textures not supported on this platform\");\n }\n var tex = initTexture(gl2);\n gl2.texImage2D(gl2.TEXTURE_2D, 0, format, width, height, 0, format, type, null);\n return new Texture2D(gl2, tex, width, height, format, type);\n }\n function createTextureDOM(gl2, directData, width, height, format, type) {\n var tex = initTexture(gl2);\n gl2.texImage2D(gl2.TEXTURE_2D, 0, format, format, type, directData);\n return new Texture2D(gl2, tex, width, height, format, type);\n }\n function createTextureArray(gl2, array) {\n var dtype = array.dtype;\n var shape = array.shape.slice();\n var maxSize = gl2.getParameter(gl2.MAX_TEXTURE_SIZE);\n if (shape[0] < 0 || shape[0] > maxSize || shape[1] < 0 || shape[1] > maxSize) {\n throw new Error(\"gl-texture2d: Invalid texture size\");\n }\n var packed = isPacked(shape, array.stride.slice());\n var type = 0;\n if (dtype === \"float32\") {\n type = gl2.FLOAT;\n } else if (dtype === \"float64\") {\n type = gl2.FLOAT;\n packed = false;\n dtype = \"float32\";\n } else if (dtype === \"uint8\") {\n type = gl2.UNSIGNED_BYTE;\n } else {\n type = gl2.UNSIGNED_BYTE;\n packed = false;\n dtype = \"uint8\";\n }\n var format = 0;\n if (shape.length === 2) {\n format = gl2.LUMINANCE;\n shape = [shape[0], shape[1], 1];\n array = ndarray(array.data, shape, [array.stride[0], array.stride[1], 1], array.offset);\n } else if (shape.length === 3) {\n if (shape[2] === 1) {\n format = gl2.ALPHA;\n } else if (shape[2] === 2) {\n format = gl2.LUMINANCE_ALPHA;\n } else if (shape[2] === 3) {\n format = gl2.RGB;\n } else if (shape[2] === 4) {\n format = gl2.RGBA;\n } else {\n throw new Error(\"gl-texture2d: Invalid shape for pixel coords\");\n }\n } else {\n throw new Error(\"gl-texture2d: Invalid shape for texture\");\n }\n if (type === gl2.FLOAT && !gl2.getExtension(\"OES_texture_float\")) {\n type = gl2.UNSIGNED_BYTE;\n packed = false;\n }\n var buffer, buf_store;\n var size = array.size;\n if (!packed) {\n var stride = [shape[2], shape[2] * shape[0], 1];\n buf_store = pool.malloc(size, dtype);\n var buf_array = ndarray(buf_store, shape, stride, 0);\n if ((dtype === \"float32\" || dtype === \"float64\") && type === gl2.UNSIGNED_BYTE) {\n convertFloatToUint8(buf_array, array);\n } else {\n ops.assign(buf_array, array);\n }\n buffer = buf_store.subarray(0, size);\n } else if (array.offset === 0 && array.data.length === size) {\n buffer = array.data;\n } else {\n buffer = array.data.subarray(array.offset, array.offset + size);\n }\n var tex = initTexture(gl2);\n gl2.texImage2D(gl2.TEXTURE_2D, 0, format, shape[0], shape[1], 0, format, type, buffer);\n if (!packed) {\n pool.free(buf_store);\n }\n return new Texture2D(gl2, tex, shape[0], shape[1], format, type);\n }\n function createTexture2D(gl2) {\n if (arguments.length <= 1) {\n throw new Error(\"gl-texture2d: Missing arguments for texture2d constructor\");\n }\n if (!linearTypes) {\n lazyInitLinearTypes(gl2);\n }\n if (typeof arguments[1] === \"number\") {\n return createTextureShape(gl2, arguments[1], arguments[2], arguments[3] || gl2.RGBA, arguments[4] || gl2.UNSIGNED_BYTE);\n }\n if (Array.isArray(arguments[1])) {\n return createTextureShape(gl2, arguments[1][0] | 0, arguments[1][1] | 0, arguments[2] || gl2.RGBA, arguments[3] || gl2.UNSIGNED_BYTE);\n }\n if (typeof arguments[1] === \"object\") {\n var obj = arguments[1];\n var directData = acceptTextureDOM(obj) ? obj : obj.raw;\n if (directData) {\n return createTextureDOM(gl2, directData, obj.width | 0, obj.height | 0, arguments[2] || gl2.RGBA, arguments[3] || gl2.UNSIGNED_BYTE);\n } else if (obj.shape && obj.data && obj.stride) {\n return createTextureArray(gl2, obj);\n }\n }\n throw new Error(\"gl-texture2d: Invalid arguments for texture2d constructor\");\n }\n }\n ),\n /***/\n 1433: (\n /***/\n function(module2) {\n \"use strict\";\n function doBind(gl2, elements, attributes) {\n if (elements) {\n elements.bind();\n } else {\n gl2.bindBuffer(gl2.ELEMENT_ARRAY_BUFFER, null);\n }\n var nattribs = gl2.getParameter(gl2.MAX_VERTEX_ATTRIBS) | 0;\n if (attributes) {\n if (attributes.length > nattribs) {\n throw new Error(\"gl-vao: Too many vertex attributes\");\n }\n for (var i = 0; i < attributes.length; ++i) {\n var attrib = attributes[i];\n if (attrib.buffer) {\n var buffer = attrib.buffer;\n var size = attrib.size || 4;\n var type = attrib.type || gl2.FLOAT;\n var normalized = !!attrib.normalized;\n var stride = attrib.stride || 0;\n var offset = attrib.offset || 0;\n buffer.bind();\n gl2.enableVertexAttribArray(i);\n gl2.vertexAttribPointer(i, size, type, normalized, stride, offset);\n } else {\n if (typeof attrib === \"number\") {\n gl2.vertexAttrib1f(i, attrib);\n } else if (attrib.length === 1) {\n gl2.vertexAttrib1f(i, attrib[0]);\n } else if (attrib.length === 2) {\n gl2.vertexAttrib2f(i, attrib[0], attrib[1]);\n } else if (attrib.length === 3) {\n gl2.vertexAttrib3f(i, attrib[0], attrib[1], attrib[2]);\n } else if (attrib.length === 4) {\n gl2.vertexAttrib4f(i, attrib[0], attrib[1], attrib[2], attrib[3]);\n } else {\n throw new Error(\"gl-vao: Invalid vertex attribute\");\n }\n gl2.disableVertexAttribArray(i);\n }\n }\n for (; i < nattribs; ++i) {\n gl2.disableVertexAttribArray(i);\n }\n } else {\n gl2.bindBuffer(gl2.ARRAY_BUFFER, null);\n for (var i = 0; i < nattribs; ++i) {\n gl2.disableVertexAttribArray(i);\n }\n }\n }\n module2.exports = doBind;\n }\n ),\n /***/\n 870: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var bindAttribs = __webpack_require__2(1433);\n function VAOEmulated(gl2) {\n this.gl = gl2;\n this._elements = null;\n this._attributes = null;\n this._elementsType = gl2.UNSIGNED_SHORT;\n }\n VAOEmulated.prototype.bind = function() {\n bindAttribs(this.gl, this._elements, this._attributes);\n };\n VAOEmulated.prototype.update = function(attributes, elements, elementsType) {\n this._elements = elements;\n this._attributes = attributes;\n this._elementsType = elementsType || this.gl.UNSIGNED_SHORT;\n };\n VAOEmulated.prototype.dispose = function() {\n };\n VAOEmulated.prototype.unbind = function() {\n };\n VAOEmulated.prototype.draw = function(mode, count, offset) {\n offset = offset || 0;\n var gl2 = this.gl;\n if (this._elements) {\n gl2.drawElements(mode, count, this._elementsType, offset);\n } else {\n gl2.drawArrays(mode, offset, count);\n }\n };\n function createVAOEmulated(gl2) {\n return new VAOEmulated(gl2);\n }\n module2.exports = createVAOEmulated;\n }\n ),\n /***/\n 7518: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var bindAttribs = __webpack_require__2(1433);\n function VertexAttribute(location2, dimension, a, b, c, d) {\n this.location = location2;\n this.dimension = dimension;\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n }\n VertexAttribute.prototype.bind = function(gl2) {\n switch (this.dimension) {\n case 1:\n gl2.vertexAttrib1f(this.location, this.a);\n break;\n case 2:\n gl2.vertexAttrib2f(this.location, this.a, this.b);\n break;\n case 3:\n gl2.vertexAttrib3f(this.location, this.a, this.b, this.c);\n break;\n case 4:\n gl2.vertexAttrib4f(this.location, this.a, this.b, this.c, this.d);\n break;\n }\n };\n function VAONative(gl2, ext, handle) {\n this.gl = gl2;\n this._ext = ext;\n this.handle = handle;\n this._attribs = [];\n this._useElements = false;\n this._elementsType = gl2.UNSIGNED_SHORT;\n }\n VAONative.prototype.bind = function() {\n this._ext.bindVertexArrayOES(this.handle);\n for (var i = 0; i < this._attribs.length; ++i) {\n this._attribs[i].bind(this.gl);\n }\n };\n VAONative.prototype.unbind = function() {\n this._ext.bindVertexArrayOES(null);\n };\n VAONative.prototype.dispose = function() {\n this._ext.deleteVertexArrayOES(this.handle);\n };\n VAONative.prototype.update = function(attributes, elements, elementsType) {\n this.bind();\n bindAttribs(this.gl, elements, attributes);\n this.unbind();\n this._attribs.length = 0;\n if (attributes)\n for (var i = 0; i < attributes.length; ++i) {\n var a = attributes[i];\n if (typeof a === \"number\") {\n this._attribs.push(new VertexAttribute(i, 1, a));\n } else if (Array.isArray(a)) {\n this._attribs.push(new VertexAttribute(i, a.length, a[0], a[1], a[2], a[3]));\n }\n }\n this._useElements = !!elements;\n this._elementsType = elementsType || this.gl.UNSIGNED_SHORT;\n };\n VAONative.prototype.draw = function(mode, count, offset) {\n offset = offset || 0;\n var gl2 = this.gl;\n if (this._useElements) {\n gl2.drawElements(mode, count, this._elementsType, offset);\n } else {\n gl2.drawArrays(mode, offset, count);\n }\n };\n function createVAONative(gl2, ext) {\n return new VAONative(gl2, ext, ext.createVertexArrayOES());\n }\n module2.exports = createVAONative;\n }\n ),\n /***/\n 8116: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var createVAONative = __webpack_require__2(7518);\n var createVAOEmulated = __webpack_require__2(870);\n function ExtensionShim(gl2) {\n this.bindVertexArrayOES = gl2.bindVertexArray.bind(gl2);\n this.createVertexArrayOES = gl2.createVertexArray.bind(gl2);\n this.deleteVertexArrayOES = gl2.deleteVertexArray.bind(gl2);\n }\n function createVAO(gl2, attributes, elements, elementsType) {\n var ext = gl2.createVertexArray ? new ExtensionShim(gl2) : gl2.getExtension(\"OES_vertex_array_object\");\n var vao;\n if (ext) {\n vao = createVAONative(gl2, ext);\n } else {\n vao = createVAOEmulated(gl2);\n }\n vao.update(attributes, elements, elementsType);\n return vao;\n }\n module2.exports = createVAO;\n }\n ),\n /***/\n 5632: (\n /***/\n function(module2) {\n module2.exports = add;\n function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n }\n }\n ),\n /***/\n 8192: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = angle;\n var fromValues = __webpack_require__2(2825);\n var normalize = __webpack_require__2(3536);\n var dot = __webpack_require__2(244);\n function angle(a, b) {\n var tempA = fromValues(a[0], a[1], a[2]);\n var tempB = fromValues(b[0], b[1], b[2]);\n normalize(tempA, tempA);\n normalize(tempB, tempB);\n var cosine = dot(tempA, tempB);\n if (cosine > 1) {\n return 0;\n } else {\n return Math.acos(cosine);\n }\n }\n }\n ),\n /***/\n 9226: (\n /***/\n function(module2) {\n module2.exports = ceil;\n function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n return out;\n }\n }\n ),\n /***/\n 3126: (\n /***/\n function(module2) {\n module2.exports = clone;\n function clone(a) {\n var out = new Float32Array(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n }\n }\n ),\n /***/\n 3990: (\n /***/\n function(module2) {\n module2.exports = copy;\n function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n }\n }\n ),\n /***/\n 1091: (\n /***/\n function(module2) {\n module2.exports = create;\n function create() {\n var out = new Float32Array(3);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n return out;\n }\n }\n ),\n /***/\n 5911: (\n /***/\n function(module2) {\n module2.exports = cross;\n function cross(out, a, b) {\n var ax = a[0], ay = a[1], az = a[2], bx = b[0], by = b[1], bz = b[2];\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n }\n }\n ),\n /***/\n 5455: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = __webpack_require__2(7056);\n }\n ),\n /***/\n 7056: (\n /***/\n function(module2) {\n module2.exports = distance;\n function distance(a, b) {\n var x = b[0] - a[0], y = b[1] - a[1], z = b[2] - a[2];\n return Math.sqrt(x * x + y * y + z * z);\n }\n }\n ),\n /***/\n 4008: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = __webpack_require__2(6690);\n }\n ),\n /***/\n 6690: (\n /***/\n function(module2) {\n module2.exports = divide;\n function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n }\n }\n ),\n /***/\n 244: (\n /***/\n function(module2) {\n module2.exports = dot;\n function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n }\n }\n ),\n /***/\n 2613: (\n /***/\n function(module2) {\n module2.exports = 1e-6;\n }\n ),\n /***/\n 9922: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = equals;\n var EPSILON = __webpack_require__2(2613);\n function equals(a, b) {\n var a0 = a[0];\n var a1 = a[1];\n var a2 = a[2];\n var b0 = b[0];\n var b1 = b[1];\n var b2 = b[2];\n return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2));\n }\n }\n ),\n /***/\n 9265: (\n /***/\n function(module2) {\n module2.exports = exactEquals;\n function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n }\n }\n ),\n /***/\n 2681: (\n /***/\n function(module2) {\n module2.exports = floor;\n function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n return out;\n }\n }\n ),\n /***/\n 5137: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = forEach;\n var vec = __webpack_require__2(1091)();\n function forEach(a, stride, offset, count, fn, arg) {\n var i, l;\n if (!stride) {\n stride = 3;\n }\n if (!offset) {\n offset = 0;\n }\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n }\n return a;\n }\n }\n ),\n /***/\n 2825: (\n /***/\n function(module2) {\n module2.exports = fromValues;\n function fromValues(x, y, z) {\n var out = new Float32Array(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n }\n }\n ),\n /***/\n 2931: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = {\n EPSILON: __webpack_require__2(2613),\n create: __webpack_require__2(1091),\n clone: __webpack_require__2(3126),\n angle: __webpack_require__2(8192),\n fromValues: __webpack_require__2(2825),\n copy: __webpack_require__2(3990),\n set: __webpack_require__2(1463),\n equals: __webpack_require__2(9922),\n exactEquals: __webpack_require__2(9265),\n add: __webpack_require__2(5632),\n subtract: __webpack_require__2(6843),\n sub: __webpack_require__2(2229),\n multiply: __webpack_require__2(5847),\n mul: __webpack_require__2(4505),\n divide: __webpack_require__2(6690),\n div: __webpack_require__2(4008),\n min: __webpack_require__2(8107),\n max: __webpack_require__2(7417),\n floor: __webpack_require__2(2681),\n ceil: __webpack_require__2(9226),\n round: __webpack_require__2(2447),\n scale: __webpack_require__2(6621),\n scaleAndAdd: __webpack_require__2(8489),\n distance: __webpack_require__2(7056),\n dist: __webpack_require__2(5455),\n squaredDistance: __webpack_require__2(2953),\n sqrDist: __webpack_require__2(6141),\n length: __webpack_require__2(1387),\n len: __webpack_require__2(868),\n squaredLength: __webpack_require__2(3066),\n sqrLen: __webpack_require__2(5486),\n negate: __webpack_require__2(5093),\n inverse: __webpack_require__2(811),\n normalize: __webpack_require__2(3536),\n dot: __webpack_require__2(244),\n cross: __webpack_require__2(5911),\n lerp: __webpack_require__2(6658),\n random: __webpack_require__2(7636),\n transformMat4: __webpack_require__2(5673),\n transformMat3: __webpack_require__2(492),\n transformQuat: __webpack_require__2(264),\n rotateX: __webpack_require__2(6894),\n rotateY: __webpack_require__2(109),\n rotateZ: __webpack_require__2(8692),\n forEach: __webpack_require__2(5137)\n };\n }\n ),\n /***/\n 811: (\n /***/\n function(module2) {\n module2.exports = inverse;\n function inverse(out, a) {\n out[0] = 1 / a[0];\n out[1] = 1 / a[1];\n out[2] = 1 / a[2];\n return out;\n }\n }\n ),\n /***/\n 868: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = __webpack_require__2(1387);\n }\n ),\n /***/\n 1387: (\n /***/\n function(module2) {\n module2.exports = length;\n function length(a) {\n var x = a[0], y = a[1], z = a[2];\n return Math.sqrt(x * x + y * y + z * z);\n }\n }\n ),\n /***/\n 6658: (\n /***/\n function(module2) {\n module2.exports = lerp;\n function lerp(out, a, b, t) {\n var ax = a[0], ay = a[1], az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n }\n }\n ),\n /***/\n 7417: (\n /***/\n function(module2) {\n module2.exports = max;\n function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n }\n }\n ),\n /***/\n 8107: (\n /***/\n function(module2) {\n module2.exports = min;\n function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n }\n }\n ),\n /***/\n 4505: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = __webpack_require__2(5847);\n }\n ),\n /***/\n 5847: (\n /***/\n function(module2) {\n module2.exports = multiply;\n function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n }\n }\n ),\n /***/\n 5093: (\n /***/\n function(module2) {\n module2.exports = negate;\n function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n }\n }\n ),\n /***/\n 3536: (\n /***/\n function(module2) {\n module2.exports = normalize;\n function normalize(out, a) {\n var x = a[0], y = a[1], z = a[2];\n var len = x * x + y * y + z * z;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n }\n return out;\n }\n }\n ),\n /***/\n 7636: (\n /***/\n function(module2) {\n module2.exports = random;\n function random(out, scale) {\n scale = scale || 1;\n var r = Math.random() * 2 * Math.PI;\n var z = Math.random() * 2 - 1;\n var zScale = Math.sqrt(1 - z * z) * scale;\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n }\n }\n ),\n /***/\n 6894: (\n /***/\n function(module2) {\n module2.exports = rotateX;\n function rotateX(out, a, b, c) {\n var by = b[1];\n var bz = b[2];\n var py = a[1] - by;\n var pz = a[2] - bz;\n var sc = Math.sin(c);\n var cc = Math.cos(c);\n out[0] = a[0];\n out[1] = by + py * cc - pz * sc;\n out[2] = bz + py * sc + pz * cc;\n return out;\n }\n }\n ),\n /***/\n 109: (\n /***/\n function(module2) {\n module2.exports = rotateY;\n function rotateY(out, a, b, c) {\n var bx = b[0];\n var bz = b[2];\n var px = a[0] - bx;\n var pz = a[2] - bz;\n var sc = Math.sin(c);\n var cc = Math.cos(c);\n out[0] = bx + pz * sc + px * cc;\n out[1] = a[1];\n out[2] = bz + pz * cc - px * sc;\n return out;\n }\n }\n ),\n /***/\n 8692: (\n /***/\n function(module2) {\n module2.exports = rotateZ;\n function rotateZ(out, a, b, c) {\n var bx = b[0];\n var by = b[1];\n var px = a[0] - bx;\n var py = a[1] - by;\n var sc = Math.sin(c);\n var cc = Math.cos(c);\n out[0] = bx + px * cc - py * sc;\n out[1] = by + px * sc + py * cc;\n out[2] = a[2];\n return out;\n }\n }\n ),\n /***/\n 2447: (\n /***/\n function(module2) {\n module2.exports = round;\n function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n return out;\n }\n }\n ),\n /***/\n 6621: (\n /***/\n function(module2) {\n module2.exports = scale;\n function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n }\n }\n ),\n /***/\n 8489: (\n /***/\n function(module2) {\n module2.exports = scaleAndAdd;\n function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n return out;\n }\n }\n ),\n /***/\n 1463: (\n /***/\n function(module2) {\n module2.exports = set;\n function set(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n }\n }\n ),\n /***/\n 6141: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = __webpack_require__2(2953);\n }\n ),\n /***/\n 5486: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = __webpack_require__2(3066);\n }\n ),\n /***/\n 2953: (\n /***/\n function(module2) {\n module2.exports = squaredDistance;\n function squaredDistance(a, b) {\n var x = b[0] - a[0], y = b[1] - a[1], z = b[2] - a[2];\n return x * x + y * y + z * z;\n }\n }\n ),\n /***/\n 3066: (\n /***/\n function(module2) {\n module2.exports = squaredLength;\n function squaredLength(a) {\n var x = a[0], y = a[1], z = a[2];\n return x * x + y * y + z * z;\n }\n }\n ),\n /***/\n 2229: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = __webpack_require__2(6843);\n }\n ),\n /***/\n 6843: (\n /***/\n function(module2) {\n module2.exports = subtract;\n function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n }\n }\n ),\n /***/\n 492: (\n /***/\n function(module2) {\n module2.exports = transformMat3;\n function transformMat3(out, a, m) {\n var x = a[0], y = a[1], z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n }\n }\n ),\n /***/\n 5673: (\n /***/\n function(module2) {\n module2.exports = transformMat4;\n function transformMat4(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n }\n }\n ),\n /***/\n 264: (\n /***/\n function(module2) {\n module2.exports = transformQuat;\n function transformQuat(out, a, q) {\n var x = a[0], y = a[1], z = a[2], qx = q[0], qy = q[1], qz = q[2], qw = q[3], ix = qw * x + qy * z - qz * y, iy = qw * y + qz * x - qx * z, iz = qw * z + qx * y - qy * x, iw = -qx * x - qy * y - qz * z;\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n return out;\n }\n }\n ),\n /***/\n 4361: (\n /***/\n function(module2) {\n module2.exports = add;\n function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n }\n }\n ),\n /***/\n 2335: (\n /***/\n function(module2) {\n module2.exports = clone;\n function clone(a) {\n var out = new Float32Array(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n }\n }\n ),\n /***/\n 2933: (\n /***/\n function(module2) {\n module2.exports = copy;\n function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n }\n }\n ),\n /***/\n 7536: (\n /***/\n function(module2) {\n module2.exports = create;\n function create() {\n var out = new Float32Array(4);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n return out;\n }\n }\n ),\n /***/\n 4691: (\n /***/\n function(module2) {\n module2.exports = distance;\n function distance(a, b) {\n var x = b[0] - a[0], y = b[1] - a[1], z = b[2] - a[2], w = b[3] - a[3];\n return Math.sqrt(x * x + y * y + z * z + w * w);\n }\n }\n ),\n /***/\n 1373: (\n /***/\n function(module2) {\n module2.exports = divide;\n function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n }\n }\n ),\n /***/\n 3750: (\n /***/\n function(module2) {\n module2.exports = dot;\n function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n }\n }\n ),\n /***/\n 3390: (\n /***/\n function(module2) {\n module2.exports = fromValues;\n function fromValues(x, y, z, w) {\n var out = new Float32Array(4);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n }\n }\n ),\n /***/\n 9970: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = {\n create: __webpack_require__2(7536),\n clone: __webpack_require__2(2335),\n fromValues: __webpack_require__2(3390),\n copy: __webpack_require__2(2933),\n set: __webpack_require__2(4578),\n add: __webpack_require__2(4361),\n subtract: __webpack_require__2(6860),\n multiply: __webpack_require__2(3576),\n divide: __webpack_require__2(1373),\n min: __webpack_require__2(2334),\n max: __webpack_require__2(160),\n scale: __webpack_require__2(9288),\n scaleAndAdd: __webpack_require__2(4844),\n distance: __webpack_require__2(4691),\n squaredDistance: __webpack_require__2(7960),\n length: __webpack_require__2(6808),\n squaredLength: __webpack_require__2(483),\n negate: __webpack_require__2(1498),\n inverse: __webpack_require__2(4494),\n normalize: __webpack_require__2(5177),\n dot: __webpack_require__2(3750),\n lerp: __webpack_require__2(2573),\n random: __webpack_require__2(9131),\n transformMat4: __webpack_require__2(5352),\n transformQuat: __webpack_require__2(4041)\n };\n }\n ),\n /***/\n 4494: (\n /***/\n function(module2) {\n module2.exports = inverse;\n function inverse(out, a) {\n out[0] = 1 / a[0];\n out[1] = 1 / a[1];\n out[2] = 1 / a[2];\n out[3] = 1 / a[3];\n return out;\n }\n }\n ),\n /***/\n 6808: (\n /***/\n function(module2) {\n module2.exports = length;\n function length(a) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n return Math.sqrt(x * x + y * y + z * z + w * w);\n }\n }\n ),\n /***/\n 2573: (\n /***/\n function(module2) {\n module2.exports = lerp;\n function lerp(out, a, b, t) {\n var ax = a[0], ay = a[1], az = a[2], aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n }\n }\n ),\n /***/\n 160: (\n /***/\n function(module2) {\n module2.exports = max;\n function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n }\n }\n ),\n /***/\n 2334: (\n /***/\n function(module2) {\n module2.exports = min;\n function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n }\n }\n ),\n /***/\n 3576: (\n /***/\n function(module2) {\n module2.exports = multiply;\n function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n }\n }\n ),\n /***/\n 1498: (\n /***/\n function(module2) {\n module2.exports = negate;\n function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n }\n }\n ),\n /***/\n 5177: (\n /***/\n function(module2) {\n module2.exports = normalize;\n function normalize(out, a) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n var len = x * x + y * y + z * z + w * w;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n }\n return out;\n }\n }\n ),\n /***/\n 9131: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n var vecNormalize = __webpack_require__2(5177);\n var vecScale = __webpack_require__2(9288);\n module2.exports = random;\n function random(out, scale) {\n scale = scale || 1;\n out[0] = Math.random();\n out[1] = Math.random();\n out[2] = Math.random();\n out[3] = Math.random();\n vecNormalize(out, out);\n vecScale(out, out, scale);\n return out;\n }\n }\n ),\n /***/\n 9288: (\n /***/\n function(module2) {\n module2.exports = scale;\n function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n }\n }\n ),\n /***/\n 4844: (\n /***/\n function(module2) {\n module2.exports = scaleAndAdd;\n function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n }\n }\n ),\n /***/\n 4578: (\n /***/\n function(module2) {\n module2.exports = set;\n function set(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n }\n }\n ),\n /***/\n 7960: (\n /***/\n function(module2) {\n module2.exports = squaredDistance;\n function squaredDistance(a, b) {\n var x = b[0] - a[0], y = b[1] - a[1], z = b[2] - a[2], w = b[3] - a[3];\n return x * x + y * y + z * z + w * w;\n }\n }\n ),\n /***/\n 483: (\n /***/\n function(module2) {\n module2.exports = squaredLength;\n function squaredLength(a) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n return x * x + y * y + z * z + w * w;\n }\n }\n ),\n /***/\n 6860: (\n /***/\n function(module2) {\n module2.exports = subtract;\n function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n }\n }\n ),\n /***/\n 5352: (\n /***/\n function(module2) {\n module2.exports = transformMat4;\n function transformMat4(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n }\n }\n ),\n /***/\n 4041: (\n /***/\n function(module2) {\n module2.exports = transformQuat;\n function transformQuat(out, a, q) {\n var x = a[0], y = a[1], z = a[2], qx = q[0], qy = q[1], qz = q[2], qw = q[3], ix = qw * x + qy * z - qz * y, iy = qw * y + qz * x - qx * z, iz = qw * z + qx * y - qy * x, iw = -qx * x - qy * y - qz * z;\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n }\n }\n ),\n /***/\n 1848: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n var tokenize = __webpack_require__2(4905);\n var atob2 = __webpack_require__2(6468);\n module2.exports = getName;\n function getName(src) {\n var tokens = Array.isArray(src) ? src : tokenize(src);\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n if (token.type !== \"preprocessor\") continue;\n var match = token.data.match(/\\#define\\s+SHADER_NAME(_B64)?\\s+(.+)$/);\n if (!match) continue;\n if (!match[2]) continue;\n var b64 = match[1];\n var name2 = match[2];\n return (b64 ? atob2(name2) : name2).trim();\n }\n }\n }\n ),\n /***/\n 5874: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = tokenize;\n var literals100 = __webpack_require__2(620), operators = __webpack_require__2(7827), builtins100 = __webpack_require__2(6852), literals300es = __webpack_require__2(7932), builtins300es = __webpack_require__2(3508);\n var NORMAL = 999, TOKEN = 9999, BLOCK_COMMENT = 0, LINE_COMMENT = 1, PREPROCESSOR = 2, OPERATOR = 3, INTEGER = 4, FLOAT = 5, IDENT = 6, BUILTIN = 7, KEYWORD = 8, WHITESPACE = 9, EOF = 10, HEX = 11;\n var map = [\n \"block-comment\",\n \"line-comment\",\n \"preprocessor\",\n \"operator\",\n \"integer\",\n \"float\",\n \"ident\",\n \"builtin\",\n \"keyword\",\n \"whitespace\",\n \"eof\",\n \"integer\"\n ];\n function tokenize(opt) {\n var i = 0, total = 0, mode = NORMAL, c, last, content = [], tokens = [], token_idx = 0, token_offs = 0, line = 1, col = 0, start = 0, isnum = false, isoperator = false, input = \"\", len;\n opt = opt || {};\n var allBuiltins = builtins100;\n var allLiterals = literals100;\n if (opt.version === \"300 es\") {\n allBuiltins = builtins300es;\n allLiterals = literals300es;\n }\n var builtinsDict = {}, literalsDict = {};\n for (var i = 0; i < allBuiltins.length; i++) {\n builtinsDict[allBuiltins[i]] = true;\n }\n for (var i = 0; i < allLiterals.length; i++) {\n literalsDict[allLiterals[i]] = true;\n }\n return function(data) {\n tokens = [];\n if (data !== null) return write(data);\n return end();\n };\n function token(data) {\n if (data.length) {\n tokens.push({\n type: map[mode],\n data,\n position: start,\n line,\n column: col\n });\n }\n }\n function write(chunk) {\n i = 0;\n if (chunk.toString) chunk = chunk.toString();\n input += chunk.replace(/\\r\\n/g, \"\\n\");\n len = input.length;\n var last2;\n while (c = input[i], i < len) {\n last2 = i;\n switch (mode) {\n case BLOCK_COMMENT:\n i = block_comment();\n break;\n case LINE_COMMENT:\n i = line_comment();\n break;\n case PREPROCESSOR:\n i = preprocessor();\n break;\n case OPERATOR:\n i = operator();\n break;\n case INTEGER:\n i = integer();\n break;\n case HEX:\n i = hex2();\n break;\n case FLOAT:\n i = decimal();\n break;\n case TOKEN:\n i = readtoken();\n break;\n case WHITESPACE:\n i = whitespace();\n break;\n case NORMAL:\n i = normal();\n break;\n }\n if (last2 !== i) {\n switch (input[last2]) {\n case \"\\n\":\n col = 0;\n ++line;\n break;\n default:\n ++col;\n break;\n }\n }\n }\n total += i;\n input = input.slice(i);\n return tokens;\n }\n function end(chunk) {\n if (content.length) {\n token(content.join(\"\"));\n }\n mode = EOF;\n token(\"(eof)\");\n return tokens;\n }\n function normal() {\n content = content.length ? [] : content;\n if (last === \"/\" && c === \"*\") {\n start = total + i - 1;\n mode = BLOCK_COMMENT;\n last = c;\n return i + 1;\n }\n if (last === \"/\" && c === \"/\") {\n start = total + i - 1;\n mode = LINE_COMMENT;\n last = c;\n return i + 1;\n }\n if (c === \"#\") {\n mode = PREPROCESSOR;\n start = total + i;\n return i;\n }\n if (/\\s/.test(c)) {\n mode = WHITESPACE;\n start = total + i;\n return i;\n }\n isnum = /\\d/.test(c);\n isoperator = /[^\\w_]/.test(c);\n start = total + i;\n mode = isnum ? INTEGER : isoperator ? OPERATOR : TOKEN;\n return i;\n }\n function whitespace() {\n if (/[^\\s]/g.test(c)) {\n token(content.join(\"\"));\n mode = NORMAL;\n return i;\n }\n content.push(c);\n last = c;\n return i + 1;\n }\n function preprocessor() {\n if ((c === \"\\r\" || c === \"\\n\") && last !== \"\\\\\") {\n token(content.join(\"\"));\n mode = NORMAL;\n return i;\n }\n content.push(c);\n last = c;\n return i + 1;\n }\n function line_comment() {\n return preprocessor();\n }\n function block_comment() {\n if (c === \"/\" && last === \"*\") {\n content.push(c);\n token(content.join(\"\"));\n mode = NORMAL;\n return i + 1;\n }\n content.push(c);\n last = c;\n return i + 1;\n }\n function operator() {\n if (last === \".\" && /\\d/.test(c)) {\n mode = FLOAT;\n return i;\n }\n if (last === \"/\" && c === \"*\") {\n mode = BLOCK_COMMENT;\n return i;\n }\n if (last === \"/\" && c === \"/\") {\n mode = LINE_COMMENT;\n return i;\n }\n if (c === \".\" && content.length) {\n while (determine_operator(content)) ;\n mode = FLOAT;\n return i;\n }\n if (c === \";\" || c === \")\" || c === \"(\") {\n if (content.length) while (determine_operator(content)) ;\n token(c);\n mode = NORMAL;\n return i + 1;\n }\n var is_composite_operator = content.length === 2 && c !== \"=\";\n if (/[\\w_\\d\\s]/.test(c) || is_composite_operator) {\n while (determine_operator(content)) ;\n mode = NORMAL;\n return i;\n }\n content.push(c);\n last = c;\n return i + 1;\n }\n function determine_operator(buf) {\n var j = 0, idx, res;\n do {\n idx = operators.indexOf(buf.slice(0, buf.length + j).join(\"\"));\n res = operators[idx];\n if (idx === -1) {\n if (j-- + buf.length > 0) continue;\n res = buf.slice(0, 1).join(\"\");\n }\n token(res);\n start += res.length;\n content = content.slice(res.length);\n return content.length;\n } while (1);\n }\n function hex2() {\n if (/[^a-fA-F0-9]/.test(c)) {\n token(content.join(\"\"));\n mode = NORMAL;\n return i;\n }\n content.push(c);\n last = c;\n return i + 1;\n }\n function integer() {\n if (c === \".\") {\n content.push(c);\n mode = FLOAT;\n last = c;\n return i + 1;\n }\n if (/[eE]/.test(c)) {\n content.push(c);\n mode = FLOAT;\n last = c;\n return i + 1;\n }\n if (c === \"x\" && content.length === 1 && content[0] === \"0\") {\n mode = HEX;\n content.push(c);\n last = c;\n return i + 1;\n }\n if (/[^\\d]/.test(c)) {\n token(content.join(\"\"));\n mode = NORMAL;\n return i;\n }\n content.push(c);\n last = c;\n return i + 1;\n }\n function decimal() {\n if (c === \"f\") {\n content.push(c);\n last = c;\n i += 1;\n }\n if (/[eE]/.test(c)) {\n content.push(c);\n last = c;\n return i + 1;\n }\n if ((c === \"-\" || c === \"+\") && /[eE]/.test(last)) {\n content.push(c);\n last = c;\n return i + 1;\n }\n if (/[^\\d]/.test(c)) {\n token(content.join(\"\"));\n mode = NORMAL;\n return i;\n }\n content.push(c);\n last = c;\n return i + 1;\n }\n function readtoken() {\n if (/[^\\d\\w_]/.test(c)) {\n var contentstr = content.join(\"\");\n if (literalsDict[contentstr]) {\n mode = KEYWORD;\n } else if (builtinsDict[contentstr]) {\n mode = BUILTIN;\n } else {\n mode = IDENT;\n }\n token(content.join(\"\"));\n mode = NORMAL;\n return i;\n }\n content.push(c);\n last = c;\n return i + 1;\n }\n }\n }\n ),\n /***/\n 3508: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n var v100 = __webpack_require__2(6852);\n v100 = v100.slice().filter(function(b) {\n return !/^(gl\\_|texture)/.test(b);\n });\n module2.exports = v100.concat([\n // the updated gl_ constants\n \"gl_VertexID\",\n \"gl_InstanceID\",\n \"gl_Position\",\n \"gl_PointSize\",\n \"gl_FragCoord\",\n \"gl_FrontFacing\",\n \"gl_FragDepth\",\n \"gl_PointCoord\",\n \"gl_MaxVertexAttribs\",\n \"gl_MaxVertexUniformVectors\",\n \"gl_MaxVertexOutputVectors\",\n \"gl_MaxFragmentInputVectors\",\n \"gl_MaxVertexTextureImageUnits\",\n \"gl_MaxCombinedTextureImageUnits\",\n \"gl_MaxTextureImageUnits\",\n \"gl_MaxFragmentUniformVectors\",\n \"gl_MaxDrawBuffers\",\n \"gl_MinProgramTexelOffset\",\n \"gl_MaxProgramTexelOffset\",\n \"gl_DepthRangeParameters\",\n \"gl_DepthRange\",\n \"trunc\",\n \"round\",\n \"roundEven\",\n \"isnan\",\n \"isinf\",\n \"floatBitsToInt\",\n \"floatBitsToUint\",\n \"intBitsToFloat\",\n \"uintBitsToFloat\",\n \"packSnorm2x16\",\n \"unpackSnorm2x16\",\n \"packUnorm2x16\",\n \"unpackUnorm2x16\",\n \"packHalf2x16\",\n \"unpackHalf2x16\",\n \"outerProduct\",\n \"transpose\",\n \"determinant\",\n \"inverse\",\n \"texture\",\n \"textureSize\",\n \"textureProj\",\n \"textureLod\",\n \"textureOffset\",\n \"texelFetch\",\n \"texelFetchOffset\",\n \"textureProjOffset\",\n \"textureLodOffset\",\n \"textureProjLod\",\n \"textureProjLodOffset\",\n \"textureGrad\",\n \"textureGradOffset\",\n \"textureProjGrad\",\n \"textureProjGradOffset\"\n ]);\n }\n ),\n /***/\n 6852: (\n /***/\n function(module2) {\n module2.exports = [\n // Keep this list sorted\n \"abs\",\n \"acos\",\n \"all\",\n \"any\",\n \"asin\",\n \"atan\",\n \"ceil\",\n \"clamp\",\n \"cos\",\n \"cross\",\n \"dFdx\",\n \"dFdy\",\n \"degrees\",\n \"distance\",\n \"dot\",\n \"equal\",\n \"exp\",\n \"exp2\",\n \"faceforward\",\n \"floor\",\n \"fract\",\n \"gl_BackColor\",\n \"gl_BackLightModelProduct\",\n \"gl_BackLightProduct\",\n \"gl_BackMaterial\",\n \"gl_BackSecondaryColor\",\n \"gl_ClipPlane\",\n \"gl_ClipVertex\",\n \"gl_Color\",\n \"gl_DepthRange\",\n \"gl_DepthRangeParameters\",\n \"gl_EyePlaneQ\",\n \"gl_EyePlaneR\",\n \"gl_EyePlaneS\",\n \"gl_EyePlaneT\",\n \"gl_Fog\",\n \"gl_FogCoord\",\n \"gl_FogFragCoord\",\n \"gl_FogParameters\",\n \"gl_FragColor\",\n \"gl_FragCoord\",\n \"gl_FragData\",\n \"gl_FragDepth\",\n \"gl_FragDepthEXT\",\n \"gl_FrontColor\",\n \"gl_FrontFacing\",\n \"gl_FrontLightModelProduct\",\n \"gl_FrontLightProduct\",\n \"gl_FrontMaterial\",\n \"gl_FrontSecondaryColor\",\n \"gl_LightModel\",\n \"gl_LightModelParameters\",\n \"gl_LightModelProducts\",\n \"gl_LightProducts\",\n \"gl_LightSource\",\n \"gl_LightSourceParameters\",\n \"gl_MaterialParameters\",\n \"gl_MaxClipPlanes\",\n \"gl_MaxCombinedTextureImageUnits\",\n \"gl_MaxDrawBuffers\",\n \"gl_MaxFragmentUniformComponents\",\n \"gl_MaxLights\",\n \"gl_MaxTextureCoords\",\n \"gl_MaxTextureImageUnits\",\n \"gl_MaxTextureUnits\",\n \"gl_MaxVaryingFloats\",\n \"gl_MaxVertexAttribs\",\n \"gl_MaxVertexTextureImageUnits\",\n \"gl_MaxVertexUniformComponents\",\n \"gl_ModelViewMatrix\",\n \"gl_ModelViewMatrixInverse\",\n \"gl_ModelViewMatrixInverseTranspose\",\n \"gl_ModelViewMatrixTranspose\",\n \"gl_ModelViewProjectionMatrix\",\n \"gl_ModelViewProjectionMatrixInverse\",\n \"gl_ModelViewProjectionMatrixInverseTranspose\",\n \"gl_ModelViewProjectionMatrixTranspose\",\n \"gl_MultiTexCoord0\",\n \"gl_MultiTexCoord1\",\n \"gl_MultiTexCoord2\",\n \"gl_MultiTexCoord3\",\n \"gl_MultiTexCoord4\",\n \"gl_MultiTexCoord5\",\n \"gl_MultiTexCoord6\",\n \"gl_MultiTexCoord7\",\n \"gl_Normal\",\n \"gl_NormalMatrix\",\n \"gl_NormalScale\",\n \"gl_ObjectPlaneQ\",\n \"gl_ObjectPlaneR\",\n \"gl_ObjectPlaneS\",\n \"gl_ObjectPlaneT\",\n \"gl_Point\",\n \"gl_PointCoord\",\n \"gl_PointParameters\",\n \"gl_PointSize\",\n \"gl_Position\",\n \"gl_ProjectionMatrix\",\n \"gl_ProjectionMatrixInverse\",\n \"gl_ProjectionMatrixInverseTranspose\",\n \"gl_ProjectionMatrixTranspose\",\n \"gl_SecondaryColor\",\n \"gl_TexCoord\",\n \"gl_TextureEnvColor\",\n \"gl_TextureMatrix\",\n \"gl_TextureMatrixInverse\",\n \"gl_TextureMatrixInverseTranspose\",\n \"gl_TextureMatrixTranspose\",\n \"gl_Vertex\",\n \"greaterThan\",\n \"greaterThanEqual\",\n \"inversesqrt\",\n \"length\",\n \"lessThan\",\n \"lessThanEqual\",\n \"log\",\n \"log2\",\n \"matrixCompMult\",\n \"max\",\n \"min\",\n \"mix\",\n \"mod\",\n \"normalize\",\n \"not\",\n \"notEqual\",\n \"pow\",\n \"radians\",\n \"reflect\",\n \"refract\",\n \"sign\",\n \"sin\",\n \"smoothstep\",\n \"sqrt\",\n \"step\",\n \"tan\",\n \"texture2D\",\n \"texture2DLod\",\n \"texture2DProj\",\n \"texture2DProjLod\",\n \"textureCube\",\n \"textureCubeLod\",\n \"texture2DLodEXT\",\n \"texture2DProjLodEXT\",\n \"textureCubeLodEXT\",\n \"texture2DGradEXT\",\n \"texture2DProjGradEXT\",\n \"textureCubeGradEXT\"\n ];\n }\n ),\n /***/\n 7932: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n var v100 = __webpack_require__2(620);\n module2.exports = v100.slice().concat([\n \"layout\",\n \"centroid\",\n \"smooth\",\n \"case\",\n \"mat2x2\",\n \"mat2x3\",\n \"mat2x4\",\n \"mat3x2\",\n \"mat3x3\",\n \"mat3x4\",\n \"mat4x2\",\n \"mat4x3\",\n \"mat4x4\",\n \"uvec2\",\n \"uvec3\",\n \"uvec4\",\n \"samplerCubeShadow\",\n \"sampler2DArray\",\n \"sampler2DArrayShadow\",\n \"isampler2D\",\n \"isampler3D\",\n \"isamplerCube\",\n \"isampler2DArray\",\n \"usampler2D\",\n \"usampler3D\",\n \"usamplerCube\",\n \"usampler2DArray\",\n \"coherent\",\n \"restrict\",\n \"readonly\",\n \"writeonly\",\n \"resource\",\n \"atomic_uint\",\n \"noperspective\",\n \"patch\",\n \"sample\",\n \"subroutine\",\n \"common\",\n \"partition\",\n \"active\",\n \"filter\",\n \"image1D\",\n \"image2D\",\n \"image3D\",\n \"imageCube\",\n \"iimage1D\",\n \"iimage2D\",\n \"iimage3D\",\n \"iimageCube\",\n \"uimage1D\",\n \"uimage2D\",\n \"uimage3D\",\n \"uimageCube\",\n \"image1DArray\",\n \"image2DArray\",\n \"iimage1DArray\",\n \"iimage2DArray\",\n \"uimage1DArray\",\n \"uimage2DArray\",\n \"image1DShadow\",\n \"image2DShadow\",\n \"image1DArrayShadow\",\n \"image2DArrayShadow\",\n \"imageBuffer\",\n \"iimageBuffer\",\n \"uimageBuffer\",\n \"sampler1DArray\",\n \"sampler1DArrayShadow\",\n \"isampler1D\",\n \"isampler1DArray\",\n \"usampler1D\",\n \"usampler1DArray\",\n \"isampler2DRect\",\n \"usampler2DRect\",\n \"samplerBuffer\",\n \"isamplerBuffer\",\n \"usamplerBuffer\",\n \"sampler2DMS\",\n \"isampler2DMS\",\n \"usampler2DMS\",\n \"sampler2DMSArray\",\n \"isampler2DMSArray\",\n \"usampler2DMSArray\"\n ]);\n }\n ),\n /***/\n 620: (\n /***/\n function(module2) {\n module2.exports = [\n // current\n \"precision\",\n \"highp\",\n \"mediump\",\n \"lowp\",\n \"attribute\",\n \"const\",\n \"uniform\",\n \"varying\",\n \"break\",\n \"continue\",\n \"do\",\n \"for\",\n \"while\",\n \"if\",\n \"else\",\n \"in\",\n \"out\",\n \"inout\",\n \"float\",\n \"int\",\n \"uint\",\n \"void\",\n \"bool\",\n \"true\",\n \"false\",\n \"discard\",\n \"return\",\n \"mat2\",\n \"mat3\",\n \"mat4\",\n \"vec2\",\n \"vec3\",\n \"vec4\",\n \"ivec2\",\n \"ivec3\",\n \"ivec4\",\n \"bvec2\",\n \"bvec3\",\n \"bvec4\",\n \"sampler1D\",\n \"sampler2D\",\n \"sampler3D\",\n \"samplerCube\",\n \"sampler1DShadow\",\n \"sampler2DShadow\",\n \"struct\",\n \"asm\",\n \"class\",\n \"union\",\n \"enum\",\n \"typedef\",\n \"template\",\n \"this\",\n \"packed\",\n \"goto\",\n \"switch\",\n \"default\",\n \"inline\",\n \"noinline\",\n \"volatile\",\n \"public\",\n \"static\",\n \"extern\",\n \"external\",\n \"interface\",\n \"long\",\n \"short\",\n \"double\",\n \"half\",\n \"fixed\",\n \"unsigned\",\n \"input\",\n \"output\",\n \"hvec2\",\n \"hvec3\",\n \"hvec4\",\n \"dvec2\",\n \"dvec3\",\n \"dvec4\",\n \"fvec2\",\n \"fvec3\",\n \"fvec4\",\n \"sampler2DRect\",\n \"sampler3DRect\",\n \"sampler2DRectShadow\",\n \"sizeof\",\n \"cast\",\n \"namespace\",\n \"using\"\n ];\n }\n ),\n /***/\n 7827: (\n /***/\n function(module2) {\n module2.exports = [\n \"<<=\",\n \">>=\",\n \"++\",\n \"--\",\n \"<<\",\n \">>\",\n \"<=\",\n \">=\",\n \"==\",\n \"!=\",\n \"&&\",\n \"||\",\n \"+=\",\n \"-=\",\n \"*=\",\n \"/=\",\n \"%=\",\n \"&=\",\n \"^^\",\n \"^=\",\n \"|=\",\n \"(\",\n \")\",\n \"[\",\n \"]\",\n \".\",\n \"!\",\n \"~\",\n \"*\",\n \"/\",\n \"%\",\n \"+\",\n \"-\",\n \"<\",\n \">\",\n \"&\",\n \"^\",\n \"|\",\n \"?\",\n \":\",\n \"=\",\n \",\",\n \";\",\n \"{\",\n \"}\"\n ];\n }\n ),\n /***/\n 4905: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n var tokenize = __webpack_require__2(5874);\n module2.exports = tokenizeString;\n function tokenizeString(str, opt) {\n var generator = tokenize(opt);\n var tokens = [];\n tokens = tokens.concat(generator(str));\n tokens = tokens.concat(generator(null));\n return tokens;\n }\n }\n ),\n /***/\n 3236: (\n /***/\n function(module2) {\n module2.exports = function(strings) {\n if (typeof strings === \"string\") strings = [strings];\n var exprs = [].slice.call(arguments, 1);\n var parts = [];\n for (var i = 0; i < strings.length - 1; i++) {\n parts.push(strings[i], exprs[i] || \"\");\n }\n parts.push(strings[i]);\n return parts.join(\"\");\n };\n }\n ),\n /***/\n 7520: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var isBrowser = __webpack_require__2(9507);\n function detect() {\n var supported = false;\n try {\n var opts = Object.defineProperty({}, \"passive\", {\n get: function() {\n supported = true;\n }\n });\n window.addEventListener(\"test\", null, opts);\n window.removeEventListener(\"test\", null, opts);\n } catch (e) {\n supported = false;\n }\n return supported;\n }\n module2.exports = isBrowser && detect();\n }\n ),\n /***/\n 3778: (\n /***/\n function(__unused_webpack_module, exports2) {\n exports2.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 i += d;\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 exports2.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 value = Math.abs(value);\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 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 for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {\n }\n e = e << mLen | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {\n }\n buffer[offset + i - d] |= s * 128;\n };\n }\n ),\n /***/\n 8954: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = incrementalConvexHull;\n var orient = __webpack_require__2(3250);\n var compareCell = __webpack_require__2(6803).Fw;\n function Simplex(vertices, adjacent, boundary) {\n this.vertices = vertices;\n this.adjacent = adjacent;\n this.boundary = boundary;\n this.lastVisited = -1;\n }\n Simplex.prototype.flip = function() {\n var t = this.vertices[0];\n this.vertices[0] = this.vertices[1];\n this.vertices[1] = t;\n var u = this.adjacent[0];\n this.adjacent[0] = this.adjacent[1];\n this.adjacent[1] = u;\n };\n function GlueFacet(vertices, cell, index) {\n this.vertices = vertices;\n this.cell = cell;\n this.index = index;\n }\n function compareGlue(a, b) {\n return compareCell(a.vertices, b.vertices);\n }\n function wrapper(test) {\n return function() {\n var tuple = this.tuple;\n return test.apply(this, tuple);\n };\n }\n function bakeOrient(d) {\n var test = orient[d + 1];\n if (!test) {\n test = orient;\n }\n return wrapper(test);\n }\n var BAKED = [];\n function Triangulation(dimension, vertices, simplices) {\n this.dimension = dimension;\n this.vertices = vertices;\n this.simplices = simplices;\n this.interior = simplices.filter(function(c) {\n return !c.boundary;\n });\n this.tuple = new Array(dimension + 1);\n for (var i = 0; i <= dimension; ++i) {\n this.tuple[i] = this.vertices[i];\n }\n var o = BAKED[dimension];\n if (!o) {\n o = BAKED[dimension] = bakeOrient(dimension);\n }\n this.orient = o;\n }\n var proto = Triangulation.prototype;\n proto.handleBoundaryDegeneracy = function(cell, point) {\n var d = this.dimension;\n var n = this.vertices.length - 1;\n var tuple = this.tuple;\n var verts = this.vertices;\n var toVisit = [cell];\n cell.lastVisited = -n;\n while (toVisit.length > 0) {\n cell = toVisit.pop();\n var cellAdj = cell.adjacent;\n for (var i = 0; i <= d; ++i) {\n var neighbor = cellAdj[i];\n if (!neighbor.boundary || neighbor.lastVisited <= -n) {\n continue;\n }\n var nv = neighbor.vertices;\n for (var j = 0; j <= d; ++j) {\n var vv = nv[j];\n if (vv < 0) {\n tuple[j] = point;\n } else {\n tuple[j] = verts[vv];\n }\n }\n var o = this.orient();\n if (o > 0) {\n return neighbor;\n }\n neighbor.lastVisited = -n;\n if (o === 0) {\n toVisit.push(neighbor);\n }\n }\n }\n return null;\n };\n proto.walk = function(point, random) {\n var n = this.vertices.length - 1;\n var d = this.dimension;\n var verts = this.vertices;\n var tuple = this.tuple;\n var initIndex = random ? this.interior.length * Math.random() | 0 : this.interior.length - 1;\n var cell = this.interior[initIndex];\n outerLoop:\n while (!cell.boundary) {\n var cellVerts = cell.vertices;\n var cellAdj = cell.adjacent;\n for (var i = 0; i <= d; ++i) {\n tuple[i] = verts[cellVerts[i]];\n }\n cell.lastVisited = n;\n for (var i = 0; i <= d; ++i) {\n var neighbor = cellAdj[i];\n if (neighbor.lastVisited >= n) {\n continue;\n }\n var prev = tuple[i];\n tuple[i] = point;\n var o = this.orient();\n tuple[i] = prev;\n if (o < 0) {\n cell = neighbor;\n continue outerLoop;\n } else {\n if (!neighbor.boundary) {\n neighbor.lastVisited = n;\n } else {\n neighbor.lastVisited = -n;\n }\n }\n }\n return;\n }\n return cell;\n };\n proto.addPeaks = function(point, cell) {\n var n = this.vertices.length - 1;\n var d = this.dimension;\n var verts = this.vertices;\n var tuple = this.tuple;\n var interior = this.interior;\n var simplices = this.simplices;\n var tovisit = [cell];\n cell.lastVisited = n;\n cell.vertices[cell.vertices.indexOf(-1)] = n;\n cell.boundary = false;\n interior.push(cell);\n var glueFacets = [];\n while (tovisit.length > 0) {\n var cell = tovisit.pop();\n var cellVerts = cell.vertices;\n var cellAdj = cell.adjacent;\n var indexOfN = cellVerts.indexOf(n);\n if (indexOfN < 0) {\n continue;\n }\n for (var i = 0; i <= d; ++i) {\n if (i === indexOfN) {\n continue;\n }\n var neighbor = cellAdj[i];\n if (!neighbor.boundary || neighbor.lastVisited >= n) {\n continue;\n }\n var nv = neighbor.vertices;\n if (neighbor.lastVisited !== -n) {\n var indexOfNeg1 = 0;\n for (var j = 0; j <= d; ++j) {\n if (nv[j] < 0) {\n indexOfNeg1 = j;\n tuple[j] = point;\n } else {\n tuple[j] = verts[nv[j]];\n }\n }\n var o = this.orient();\n if (o > 0) {\n nv[indexOfNeg1] = n;\n neighbor.boundary = false;\n interior.push(neighbor);\n tovisit.push(neighbor);\n neighbor.lastVisited = n;\n continue;\n } else {\n neighbor.lastVisited = -n;\n }\n }\n var na = neighbor.adjacent;\n var vverts = cellVerts.slice();\n var vadj = cellAdj.slice();\n var ncell = new Simplex(vverts, vadj, true);\n simplices.push(ncell);\n var opposite = na.indexOf(cell);\n if (opposite < 0) {\n continue;\n }\n na[opposite] = ncell;\n vadj[indexOfN] = neighbor;\n vverts[i] = -1;\n vadj[i] = cell;\n cellAdj[i] = ncell;\n ncell.flip();\n for (var j = 0; j <= d; ++j) {\n var uu = vverts[j];\n if (uu < 0 || uu === n) {\n continue;\n }\n var nface = new Array(d - 1);\n var nptr = 0;\n for (var k = 0; k <= d; ++k) {\n var vv = vverts[k];\n if (vv < 0 || k === j) {\n continue;\n }\n nface[nptr++] = vv;\n }\n glueFacets.push(new GlueFacet(nface, ncell, j));\n }\n }\n }\n glueFacets.sort(compareGlue);\n for (var i = 0; i + 1 < glueFacets.length; i += 2) {\n var a = glueFacets[i];\n var b = glueFacets[i + 1];\n var ai = a.index;\n var bi = b.index;\n if (ai < 0 || bi < 0) {\n continue;\n }\n a.cell.adjacent[a.index] = b.cell;\n b.cell.adjacent[b.index] = a.cell;\n }\n };\n proto.insert = function(point, random) {\n var verts = this.vertices;\n verts.push(point);\n var cell = this.walk(point, random);\n if (!cell) {\n return;\n }\n var d = this.dimension;\n var tuple = this.tuple;\n for (var i = 0; i <= d; ++i) {\n var vv = cell.vertices[i];\n if (vv < 0) {\n tuple[i] = point;\n } else {\n tuple[i] = verts[vv];\n }\n }\n var o = this.orient(tuple);\n if (o < 0) {\n return;\n } else if (o === 0) {\n cell = this.handleBoundaryDegeneracy(cell, point);\n if (!cell) {\n return;\n }\n }\n this.addPeaks(point, cell);\n };\n proto.boundary = function() {\n var d = this.dimension;\n var boundary = [];\n var cells = this.simplices;\n var nc = cells.length;\n for (var i = 0; i < nc; ++i) {\n var c = cells[i];\n if (c.boundary) {\n var bcell = new Array(d);\n var cv = c.vertices;\n var ptr = 0;\n var parity = 0;\n for (var j = 0; j <= d; ++j) {\n if (cv[j] >= 0) {\n bcell[ptr++] = cv[j];\n } else {\n parity = j & 1;\n }\n }\n if (parity === (d & 1)) {\n var t = bcell[0];\n bcell[0] = bcell[1];\n bcell[1] = t;\n }\n boundary.push(bcell);\n }\n }\n return boundary;\n };\n function incrementalConvexHull(points, randomSearch) {\n var n = points.length;\n if (n === 0) {\n throw new Error(\"Must have at least d+1 points\");\n }\n var d = points[0].length;\n if (n <= d) {\n throw new Error(\"Must input at least d+1 points\");\n }\n var initialSimplex = points.slice(0, d + 1);\n var o = orient.apply(void 0, initialSimplex);\n if (o === 0) {\n throw new Error(\"Input not in general position\");\n }\n var initialCoords = new Array(d + 1);\n for (var i = 0; i <= d; ++i) {\n initialCoords[i] = i;\n }\n if (o < 0) {\n initialCoords[0] = 1;\n initialCoords[1] = 0;\n }\n var initialCell = new Simplex(initialCoords, new Array(d + 1), false);\n var boundary = initialCell.adjacent;\n var list = new Array(d + 2);\n for (var i = 0; i <= d; ++i) {\n var verts = initialCoords.slice();\n for (var j = 0; j <= d; ++j) {\n if (j === i) {\n verts[j] = -1;\n }\n }\n var t = verts[0];\n verts[0] = verts[1];\n verts[1] = t;\n var cell = new Simplex(verts, new Array(d + 1), true);\n boundary[i] = cell;\n list[i] = cell;\n }\n list[d + 1] = initialCell;\n for (var i = 0; i <= d; ++i) {\n var verts = boundary[i].vertices;\n var adj = boundary[i].adjacent;\n for (var j = 0; j <= d; ++j) {\n var v = verts[j];\n if (v < 0) {\n adj[j] = initialCell;\n continue;\n }\n for (var k = 0; k <= d; ++k) {\n if (boundary[k].vertices.indexOf(v) < 0) {\n adj[j] = boundary[k];\n }\n }\n }\n }\n var triangles = new Triangulation(d, initialSimplex, list);\n var useRandom = !!randomSearch;\n for (var i = d + 1; i < n; ++i) {\n triangles.insert(points[i], useRandom);\n }\n return triangles.boundary();\n }\n }\n ),\n /***/\n 3352: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var bounds = __webpack_require__2(2478);\n var NOT_FOUND = 0;\n var SUCCESS = 1;\n var EMPTY = 2;\n module2.exports = createWrapper;\n function IntervalTreeNode(mid, left, right, leftPoints, rightPoints) {\n this.mid = mid;\n this.left = left;\n this.right = right;\n this.leftPoints = leftPoints;\n this.rightPoints = rightPoints;\n this.count = (left ? left.count : 0) + (right ? right.count : 0) + leftPoints.length;\n }\n var proto = IntervalTreeNode.prototype;\n function copy(a, b) {\n a.mid = b.mid;\n a.left = b.left;\n a.right = b.right;\n a.leftPoints = b.leftPoints;\n a.rightPoints = b.rightPoints;\n a.count = b.count;\n }\n function rebuild(node, intervals) {\n var ntree = createIntervalTree(intervals);\n node.mid = ntree.mid;\n node.left = ntree.left;\n node.right = ntree.right;\n node.leftPoints = ntree.leftPoints;\n node.rightPoints = ntree.rightPoints;\n node.count = ntree.count;\n }\n function rebuildWithInterval(node, interval) {\n var intervals = node.intervals([]);\n intervals.push(interval);\n rebuild(node, intervals);\n }\n function rebuildWithoutInterval(node, interval) {\n var intervals = node.intervals([]);\n var idx = intervals.indexOf(interval);\n if (idx < 0) {\n return NOT_FOUND;\n }\n intervals.splice(idx, 1);\n rebuild(node, intervals);\n return SUCCESS;\n }\n proto.intervals = function(result) {\n result.push.apply(result, this.leftPoints);\n if (this.left) {\n this.left.intervals(result);\n }\n if (this.right) {\n this.right.intervals(result);\n }\n return result;\n };\n proto.insert = function(interval) {\n var weight = this.count - this.leftPoints.length;\n this.count += 1;\n if (interval[1] < this.mid) {\n if (this.left) {\n if (4 * (this.left.count + 1) > 3 * (weight + 1)) {\n rebuildWithInterval(this, interval);\n } else {\n this.left.insert(interval);\n }\n } else {\n this.left = createIntervalTree([interval]);\n }\n } else if (interval[0] > this.mid) {\n if (this.right) {\n if (4 * (this.right.count + 1) > 3 * (weight + 1)) {\n rebuildWithInterval(this, interval);\n } else {\n this.right.insert(interval);\n }\n } else {\n this.right = createIntervalTree([interval]);\n }\n } else {\n var l = bounds.ge(this.leftPoints, interval, compareBegin);\n var r = bounds.ge(this.rightPoints, interval, compareEnd);\n this.leftPoints.splice(l, 0, interval);\n this.rightPoints.splice(r, 0, interval);\n }\n };\n proto.remove = function(interval) {\n var weight = this.count - this.leftPoints;\n if (interval[1] < this.mid) {\n if (!this.left) {\n return NOT_FOUND;\n }\n var rw = this.right ? this.right.count : 0;\n if (4 * rw > 3 * (weight - 1)) {\n return rebuildWithoutInterval(this, interval);\n }\n var r = this.left.remove(interval);\n if (r === EMPTY) {\n this.left = null;\n this.count -= 1;\n return SUCCESS;\n } else if (r === SUCCESS) {\n this.count -= 1;\n }\n return r;\n } else if (interval[0] > this.mid) {\n if (!this.right) {\n return NOT_FOUND;\n }\n var lw = this.left ? this.left.count : 0;\n if (4 * lw > 3 * (weight - 1)) {\n return rebuildWithoutInterval(this, interval);\n }\n var r = this.right.remove(interval);\n if (r === EMPTY) {\n this.right = null;\n this.count -= 1;\n return SUCCESS;\n } else if (r === SUCCESS) {\n this.count -= 1;\n }\n return r;\n } else {\n if (this.count === 1) {\n if (this.leftPoints[0] === interval) {\n return EMPTY;\n } else {\n return NOT_FOUND;\n }\n }\n if (this.leftPoints.length === 1 && this.leftPoints[0] === interval) {\n if (this.left && this.right) {\n var p = this;\n var n = this.left;\n while (n.right) {\n p = n;\n n = n.right;\n }\n if (p === this) {\n n.right = this.right;\n } else {\n var l = this.left;\n var r = this.right;\n p.count -= n.count;\n p.right = n.left;\n n.left = l;\n n.right = r;\n }\n copy(this, n);\n this.count = (this.left ? this.left.count : 0) + (this.right ? this.right.count : 0) + this.leftPoints.length;\n } else if (this.left) {\n copy(this, this.left);\n } else {\n copy(this, this.right);\n }\n return SUCCESS;\n }\n for (var l = bounds.ge(this.leftPoints, interval, compareBegin); l < this.leftPoints.length; ++l) {\n if (this.leftPoints[l][0] !== interval[0]) {\n break;\n }\n if (this.leftPoints[l] === interval) {\n this.count -= 1;\n this.leftPoints.splice(l, 1);\n for (var r = bounds.ge(this.rightPoints, interval, compareEnd); r < this.rightPoints.length; ++r) {\n if (this.rightPoints[r][1] !== interval[1]) {\n break;\n } else if (this.rightPoints[r] === interval) {\n this.rightPoints.splice(r, 1);\n return SUCCESS;\n }\n }\n }\n }\n return NOT_FOUND;\n }\n };\n function reportLeftRange(arr, hi, cb) {\n for (var i = 0; i < arr.length && arr[i][0] <= hi; ++i) {\n var r = cb(arr[i]);\n if (r) {\n return r;\n }\n }\n }\n function reportRightRange(arr, lo, cb) {\n for (var i = arr.length - 1; i >= 0 && arr[i][1] >= lo; --i) {\n var r = cb(arr[i]);\n if (r) {\n return r;\n }\n }\n }\n function reportRange(arr, cb) {\n for (var i = 0; i < arr.length; ++i) {\n var r = cb(arr[i]);\n if (r) {\n return r;\n }\n }\n }\n proto.queryPoint = function(x, cb) {\n if (x < this.mid) {\n if (this.left) {\n var r = this.left.queryPoint(x, cb);\n if (r) {\n return r;\n }\n }\n return reportLeftRange(this.leftPoints, x, cb);\n } else if (x > this.mid) {\n if (this.right) {\n var r = this.right.queryPoint(x, cb);\n if (r) {\n return r;\n }\n }\n return reportRightRange(this.rightPoints, x, cb);\n } else {\n return reportRange(this.leftPoints, cb);\n }\n };\n proto.queryInterval = function(lo, hi, cb) {\n if (lo < this.mid && this.left) {\n var r = this.left.queryInterval(lo, hi, cb);\n if (r) {\n return r;\n }\n }\n if (hi > this.mid && this.right) {\n var r = this.right.queryInterval(lo, hi, cb);\n if (r) {\n return r;\n }\n }\n if (hi < this.mid) {\n return reportLeftRange(this.leftPoints, hi, cb);\n } else if (lo > this.mid) {\n return reportRightRange(this.rightPoints, lo, cb);\n } else {\n return reportRange(this.leftPoints, cb);\n }\n };\n function compareNumbers(a, b) {\n return a - b;\n }\n function compareBegin(a, b) {\n var d = a[0] - b[0];\n if (d) {\n return d;\n }\n return a[1] - b[1];\n }\n function compareEnd(a, b) {\n var d = a[1] - b[1];\n if (d) {\n return d;\n }\n return a[0] - b[0];\n }\n function createIntervalTree(intervals) {\n if (intervals.length === 0) {\n return null;\n }\n var pts = [];\n for (var i = 0; i < intervals.length; ++i) {\n pts.push(intervals[i][0], intervals[i][1]);\n }\n pts.sort(compareNumbers);\n var mid = pts[pts.length >> 1];\n var leftIntervals = [];\n var rightIntervals = [];\n var centerIntervals = [];\n for (var i = 0; i < intervals.length; ++i) {\n var s = intervals[i];\n if (s[1] < mid) {\n leftIntervals.push(s);\n } else if (mid < s[0]) {\n rightIntervals.push(s);\n } else {\n centerIntervals.push(s);\n }\n }\n var leftPoints = centerIntervals;\n var rightPoints = centerIntervals.slice();\n leftPoints.sort(compareBegin);\n rightPoints.sort(compareEnd);\n return new IntervalTreeNode(\n mid,\n createIntervalTree(leftIntervals),\n createIntervalTree(rightIntervals),\n leftPoints,\n rightPoints\n );\n }\n function IntervalTree(root) {\n this.root = root;\n }\n var tproto = IntervalTree.prototype;\n tproto.insert = function(interval) {\n if (this.root) {\n this.root.insert(interval);\n } else {\n this.root = new IntervalTreeNode(interval[0], null, null, [interval], [interval]);\n }\n };\n tproto.remove = function(interval) {\n if (this.root) {\n var r = this.root.remove(interval);\n if (r === EMPTY) {\n this.root = null;\n }\n return r !== NOT_FOUND;\n }\n return false;\n };\n tproto.queryPoint = function(p, cb) {\n if (this.root) {\n return this.root.queryPoint(p, cb);\n }\n };\n tproto.queryInterval = function(lo, hi, cb) {\n if (lo <= hi && this.root) {\n return this.root.queryInterval(lo, hi, cb);\n }\n };\n Object.defineProperty(tproto, \"count\", {\n get: function() {\n if (this.root) {\n return this.root.count;\n }\n return 0;\n }\n });\n Object.defineProperty(tproto, \"intervals\", {\n get: function() {\n if (this.root) {\n return this.root.intervals([]);\n }\n return [];\n }\n });\n function createWrapper(intervals) {\n if (!intervals || intervals.length === 0) {\n return new IntervalTree(null);\n }\n return new IntervalTree(createIntervalTree(intervals));\n }\n }\n ),\n /***/\n 9507: (\n /***/\n function(module2) {\n module2.exports = true;\n }\n ),\n /***/\n 7163: (\n /***/\n function(module2) {\n module2.exports = function(obj) {\n return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer);\n };\n function isBuffer(obj) {\n return !!obj.constructor && typeof obj.constructor.isBuffer === \"function\" && obj.constructor.isBuffer(obj);\n }\n function isSlowBuffer(obj) {\n return typeof obj.readFloatLE === \"function\" && typeof obj.slice === \"function\" && isBuffer(obj.slice(0, 0));\n }\n }\n ),\n /***/\n 5219: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = function(str) {\n var l = str.length, a;\n for (var i = 0; i < l; i++) {\n a = str.charCodeAt(i);\n if ((a < 9 || a > 13) && a !== 32 && a !== 133 && a !== 160 && a !== 5760 && a !== 6158 && (a < 8192 || a > 8205) && a !== 8232 && a !== 8233 && a !== 8239 && a !== 8287 && a !== 8288 && a !== 12288 && a !== 65279) {\n return false;\n }\n }\n return true;\n };\n }\n ),\n /***/\n 395: (\n /***/\n function(module2) {\n function lerp(v0, v1, t) {\n return v0 * (1 - t) + v1 * t;\n }\n module2.exports = lerp;\n }\n ),\n /***/\n 2652: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n var normalize = __webpack_require__2(4335);\n var create = __webpack_require__2(6864);\n var clone = __webpack_require__2(1903);\n var determinant = __webpack_require__2(9921);\n var invert = __webpack_require__2(7608);\n var transpose = __webpack_require__2(5665);\n var vec3 = {\n length: __webpack_require__2(1387),\n normalize: __webpack_require__2(3536),\n dot: __webpack_require__2(244),\n cross: __webpack_require__2(5911)\n };\n var tmp = create();\n var perspectiveMatrix = create();\n var tmpVec4 = [0, 0, 0, 0];\n var row = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];\n var pdum3 = [0, 0, 0];\n module2.exports = function decomposeMat4(matrix, translation, scale, skew, perspective, quaternion) {\n if (!translation) translation = [0, 0, 0];\n if (!scale) scale = [0, 0, 0];\n if (!skew) skew = [0, 0, 0];\n if (!perspective) perspective = [0, 0, 0, 1];\n if (!quaternion) quaternion = [0, 0, 0, 1];\n if (!normalize(tmp, matrix))\n return false;\n clone(perspectiveMatrix, tmp);\n perspectiveMatrix[3] = 0;\n perspectiveMatrix[7] = 0;\n perspectiveMatrix[11] = 0;\n perspectiveMatrix[15] = 1;\n if (Math.abs(determinant(perspectiveMatrix) < 1e-8))\n return false;\n var a03 = tmp[3], a13 = tmp[7], a23 = tmp[11], a30 = tmp[12], a31 = tmp[13], a32 = tmp[14], a33 = tmp[15];\n if (a03 !== 0 || a13 !== 0 || a23 !== 0) {\n tmpVec4[0] = a03;\n tmpVec4[1] = a13;\n tmpVec4[2] = a23;\n tmpVec4[3] = a33;\n var ret = invert(perspectiveMatrix, perspectiveMatrix);\n if (!ret) return false;\n transpose(perspectiveMatrix, perspectiveMatrix);\n vec4multMat4(perspective, tmpVec4, perspectiveMatrix);\n } else {\n perspective[0] = perspective[1] = perspective[2] = 0;\n perspective[3] = 1;\n }\n translation[0] = a30;\n translation[1] = a31;\n translation[2] = a32;\n mat3from4(row, tmp);\n scale[0] = vec3.length(row[0]);\n vec3.normalize(row[0], row[0]);\n skew[0] = vec3.dot(row[0], row[1]);\n combine(row[1], row[1], row[0], 1, -skew[0]);\n scale[1] = vec3.length(row[1]);\n vec3.normalize(row[1], row[1]);\n skew[0] /= scale[1];\n skew[1] = vec3.dot(row[0], row[2]);\n combine(row[2], row[2], row[0], 1, -skew[1]);\n skew[2] = vec3.dot(row[1], row[2]);\n combine(row[2], row[2], row[1], 1, -skew[2]);\n scale[2] = vec3.length(row[2]);\n vec3.normalize(row[2], row[2]);\n skew[1] /= scale[2];\n skew[2] /= scale[2];\n vec3.cross(pdum3, row[1], row[2]);\n if (vec3.dot(row[0], pdum3) < 0) {\n for (var i = 0; i < 3; i++) {\n scale[i] *= -1;\n row[i][0] *= -1;\n row[i][1] *= -1;\n row[i][2] *= -1;\n }\n }\n quaternion[0] = 0.5 * Math.sqrt(Math.max(1 + row[0][0] - row[1][1] - row[2][2], 0));\n quaternion[1] = 0.5 * Math.sqrt(Math.max(1 - row[0][0] + row[1][1] - row[2][2], 0));\n quaternion[2] = 0.5 * Math.sqrt(Math.max(1 - row[0][0] - row[1][1] + row[2][2], 0));\n quaternion[3] = 0.5 * Math.sqrt(Math.max(1 + row[0][0] + row[1][1] + row[2][2], 0));\n if (row[2][1] > row[1][2])\n quaternion[0] = -quaternion[0];\n if (row[0][2] > row[2][0])\n quaternion[1] = -quaternion[1];\n if (row[1][0] > row[0][1])\n quaternion[2] = -quaternion[2];\n return true;\n };\n function vec4multMat4(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n }\n function mat3from4(out, mat4x4) {\n out[0][0] = mat4x4[0];\n out[0][1] = mat4x4[1];\n out[0][2] = mat4x4[2];\n out[1][0] = mat4x4[4];\n out[1][1] = mat4x4[5];\n out[1][2] = mat4x4[6];\n out[2][0] = mat4x4[8];\n out[2][1] = mat4x4[9];\n out[2][2] = mat4x4[10];\n }\n function combine(out, a, b, scale1, scale2) {\n out[0] = a[0] * scale1 + b[0] * scale2;\n out[1] = a[1] * scale1 + b[1] * scale2;\n out[2] = a[2] * scale1 + b[2] * scale2;\n }\n }\n ),\n /***/\n 4335: (\n /***/\n function(module2) {\n module2.exports = function normalize(out, mat) {\n var m44 = mat[15];\n if (m44 === 0)\n return false;\n var scale = 1 / m44;\n for (var i = 0; i < 16; i++)\n out[i] = mat[i] * scale;\n return true;\n };\n }\n ),\n /***/\n 7442: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n var lerp = __webpack_require__2(6658);\n var recompose = __webpack_require__2(7182);\n var decompose = __webpack_require__2(2652);\n var determinant = __webpack_require__2(9921);\n var slerp = __webpack_require__2(8648);\n var state0 = state();\n var state1 = state();\n var tmp = state();\n module2.exports = interpolate;\n function interpolate(out, start, end, alpha) {\n if (determinant(start) === 0 || determinant(end) === 0)\n return false;\n var r0 = decompose(start, state0.translate, state0.scale, state0.skew, state0.perspective, state0.quaternion);\n var r1 = decompose(end, state1.translate, state1.scale, state1.skew, state1.perspective, state1.quaternion);\n if (!r0 || !r1)\n return false;\n lerp(tmp.translate, state0.translate, state1.translate, alpha);\n lerp(tmp.skew, state0.skew, state1.skew, alpha);\n lerp(tmp.scale, state0.scale, state1.scale, alpha);\n lerp(tmp.perspective, state0.perspective, state1.perspective, alpha);\n slerp(tmp.quaternion, state0.quaternion, state1.quaternion, alpha);\n recompose(out, tmp.translate, tmp.scale, tmp.skew, tmp.perspective, tmp.quaternion);\n return true;\n }\n function state() {\n return {\n translate: vec3(),\n scale: vec3(1),\n skew: vec3(),\n perspective: vec4(),\n quaternion: vec4()\n };\n }\n function vec3(n) {\n return [n || 0, n || 0, n || 0];\n }\n function vec4() {\n return [0, 0, 0, 1];\n }\n }\n ),\n /***/\n 7182: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n var mat4 = {\n identity: __webpack_require__2(7894),\n translate: __webpack_require__2(7656),\n multiply: __webpack_require__2(6760),\n create: __webpack_require__2(6864),\n scale: __webpack_require__2(2504),\n fromRotationTranslation: __webpack_require__2(6743)\n };\n var rotationMatrix = mat4.create();\n var temp = mat4.create();\n module2.exports = function recomposeMat4(matrix, translation, scale, skew, perspective, quaternion) {\n mat4.identity(matrix);\n mat4.fromRotationTranslation(matrix, quaternion, translation);\n matrix[3] = perspective[0];\n matrix[7] = perspective[1];\n matrix[11] = perspective[2];\n matrix[15] = perspective[3];\n mat4.identity(temp);\n if (skew[2] !== 0) {\n temp[9] = skew[2];\n mat4.multiply(matrix, matrix, temp);\n }\n if (skew[1] !== 0) {\n temp[9] = 0;\n temp[8] = skew[1];\n mat4.multiply(matrix, matrix, temp);\n }\n if (skew[0] !== 0) {\n temp[8] = 0;\n temp[4] = skew[0];\n mat4.multiply(matrix, matrix, temp);\n }\n mat4.scale(matrix, matrix, scale);\n return matrix;\n };\n }\n ),\n /***/\n 1811: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var bsearch = __webpack_require__2(2478);\n var m4interp = __webpack_require__2(7442);\n var invert44 = __webpack_require__2(7608);\n var rotateX = __webpack_require__2(5567);\n var rotateY = __webpack_require__2(2408);\n var rotateZ = __webpack_require__2(7089);\n var lookAt = __webpack_require__2(6582);\n var translate = __webpack_require__2(7656);\n var scale = __webpack_require__2(2504);\n var normalize = __webpack_require__2(3536);\n var DEFAULT_CENTER = [0, 0, 0];\n module2.exports = createMatrixCameraController;\n function MatrixCameraController(initialMatrix) {\n this._components = initialMatrix.slice();\n this._time = [0];\n this.prevMatrix = initialMatrix.slice();\n this.nextMatrix = initialMatrix.slice();\n this.computedMatrix = initialMatrix.slice();\n this.computedInverse = initialMatrix.slice();\n this.computedEye = [0, 0, 0];\n this.computedUp = [0, 0, 0];\n this.computedCenter = [0, 0, 0];\n this.computedRadius = [0];\n this._limits = [-Infinity, Infinity];\n }\n var proto = MatrixCameraController.prototype;\n proto.recalcMatrix = function(t) {\n var time = this._time;\n var tidx = bsearch.le(time, t);\n var mat = this.computedMatrix;\n if (tidx < 0) {\n return;\n }\n var comps = this._components;\n if (tidx === time.length - 1) {\n var ptr = 16 * tidx;\n for (var i = 0; i < 16; ++i) {\n mat[i] = comps[ptr++];\n }\n } else {\n var dt = time[tidx + 1] - time[tidx];\n var ptr = 16 * tidx;\n var prev = this.prevMatrix;\n var allEqual = true;\n for (var i = 0; i < 16; ++i) {\n prev[i] = comps[ptr++];\n }\n var next = this.nextMatrix;\n for (var i = 0; i < 16; ++i) {\n next[i] = comps[ptr++];\n allEqual = allEqual && prev[i] === next[i];\n }\n if (dt < 1e-6 || allEqual) {\n for (var i = 0; i < 16; ++i) {\n mat[i] = prev[i];\n }\n } else {\n m4interp(mat, prev, next, (t - time[tidx]) / dt);\n }\n }\n var up = this.computedUp;\n up[0] = mat[1];\n up[1] = mat[5];\n up[2] = mat[9];\n normalize(up, up);\n var imat = this.computedInverse;\n invert44(imat, mat);\n var eye = this.computedEye;\n var w = imat[15];\n eye[0] = imat[12] / w;\n eye[1] = imat[13] / w;\n eye[2] = imat[14] / w;\n var center = this.computedCenter;\n var radius = Math.exp(this.computedRadius[0]);\n for (var i = 0; i < 3; ++i) {\n center[i] = eye[i] - mat[2 + 4 * i] * radius;\n }\n };\n proto.idle = function(t) {\n if (t < this.lastT()) {\n return;\n }\n var mc = this._components;\n var ptr = mc.length - 16;\n for (var i = 0; i < 16; ++i) {\n mc.push(mc[ptr++]);\n }\n this._time.push(t);\n };\n proto.flush = function(t) {\n var idx = bsearch.gt(this._time, t) - 2;\n if (idx < 0) {\n return;\n }\n this._time.splice(0, idx);\n this._components.splice(0, 16 * idx);\n };\n proto.lastT = function() {\n return this._time[this._time.length - 1];\n };\n proto.lookAt = function(t, eye, center, up) {\n this.recalcMatrix(t);\n eye = eye || this.computedEye;\n center = center || DEFAULT_CENTER;\n up = up || this.computedUp;\n this.setMatrix(t, lookAt(this.computedMatrix, eye, center, up));\n var d2 = 0;\n for (var i = 0; i < 3; ++i) {\n d2 += Math.pow(center[i] - eye[i], 2);\n }\n d2 = Math.log(Math.sqrt(d2));\n this.computedRadius[0] = d2;\n };\n proto.rotate = function(t, yaw, pitch, roll) {\n this.recalcMatrix(t);\n var mat = this.computedInverse;\n if (yaw) rotateY(mat, mat, yaw);\n if (pitch) rotateX(mat, mat, pitch);\n if (roll) rotateZ(mat, mat, roll);\n this.setMatrix(t, invert44(this.computedMatrix, mat));\n };\n var tvec = [0, 0, 0];\n proto.pan = function(t, dx, dy, dz) {\n tvec[0] = -(dx || 0);\n tvec[1] = -(dy || 0);\n tvec[2] = -(dz || 0);\n this.recalcMatrix(t);\n var mat = this.computedInverse;\n translate(mat, mat, tvec);\n this.setMatrix(t, invert44(mat, mat));\n };\n proto.translate = function(t, dx, dy, dz) {\n tvec[0] = dx || 0;\n tvec[1] = dy || 0;\n tvec[2] = dz || 0;\n this.recalcMatrix(t);\n var mat = this.computedMatrix;\n translate(mat, mat, tvec);\n this.setMatrix(t, mat);\n };\n proto.setMatrix = function(t, mat) {\n if (t < this.lastT()) {\n return;\n }\n this._time.push(t);\n for (var i = 0; i < 16; ++i) {\n this._components.push(mat[i]);\n }\n };\n proto.setDistance = function(t, d) {\n this.computedRadius[0] = d;\n };\n proto.setDistanceLimits = function(a, b) {\n var lim = this._limits;\n lim[0] = a;\n lim[1] = b;\n };\n proto.getDistanceLimits = function(out) {\n var lim = this._limits;\n if (out) {\n out[0] = lim[0];\n out[1] = lim[1];\n return out;\n }\n return lim;\n };\n function createMatrixCameraController(options) {\n options = options || {};\n var matrix = options.matrix || [\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ];\n return new MatrixCameraController(matrix);\n }\n }\n ),\n /***/\n 3090: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = monotoneConvexHull2D;\n var orient = __webpack_require__2(3250)[3];\n function monotoneConvexHull2D(points) {\n var n = points.length;\n if (n < 3) {\n var result = new Array(n);\n for (var i = 0; i < n; ++i) {\n result[i] = i;\n }\n if (n === 2 && points[0][0] === points[1][0] && points[0][1] === points[1][1]) {\n return [0];\n }\n return result;\n }\n var sorted = new Array(n);\n for (var i = 0; i < n; ++i) {\n sorted[i] = i;\n }\n sorted.sort(function(a, b) {\n var d = points[a][0] - points[b][0];\n if (d) {\n return d;\n }\n return points[a][1] - points[b][1];\n });\n var lower = [sorted[0], sorted[1]];\n var upper = [sorted[0], sorted[1]];\n for (var i = 2; i < n; ++i) {\n var idx = sorted[i];\n var p = points[idx];\n var m = lower.length;\n while (m > 1 && orient(\n points[lower[m - 2]],\n points[lower[m - 1]],\n p\n ) <= 0) {\n m -= 1;\n lower.pop();\n }\n lower.push(idx);\n m = upper.length;\n while (m > 1 && orient(\n points[upper[m - 2]],\n points[upper[m - 1]],\n p\n ) >= 0) {\n m -= 1;\n upper.pop();\n }\n upper.push(idx);\n }\n var result = new Array(upper.length + lower.length - 2);\n var ptr = 0;\n for (var i = 0, nl = lower.length; i < nl; ++i) {\n result[ptr++] = lower[i];\n }\n for (var j = upper.length - 2; j > 0; --j) {\n result[ptr++] = upper[j];\n }\n return result;\n }\n }\n ),\n /***/\n 351: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = mouseListen;\n var mouse = __webpack_require__2(4687);\n function mouseListen(element, callback) {\n if (!callback) {\n callback = element;\n element = window;\n }\n var buttonState = 0;\n var x = 0;\n var y = 0;\n var mods = {\n shift: false,\n alt: false,\n control: false,\n meta: false\n };\n var attached = false;\n function updateMods(ev) {\n var changed = false;\n if (\"altKey\" in ev) {\n changed = changed || ev.altKey !== mods.alt;\n mods.alt = !!ev.altKey;\n }\n if (\"shiftKey\" in ev) {\n changed = changed || ev.shiftKey !== mods.shift;\n mods.shift = !!ev.shiftKey;\n }\n if (\"ctrlKey\" in ev) {\n changed = changed || ev.ctrlKey !== mods.control;\n mods.control = !!ev.ctrlKey;\n }\n if (\"metaKey\" in ev) {\n changed = changed || ev.metaKey !== mods.meta;\n mods.meta = !!ev.metaKey;\n }\n return changed;\n }\n function handleEvent(nextButtons, ev) {\n var nextX = mouse.x(ev);\n var nextY = mouse.y(ev);\n if (\"buttons\" in ev) {\n nextButtons = ev.buttons | 0;\n }\n if (nextButtons !== buttonState || nextX !== x || nextY !== y || updateMods(ev)) {\n buttonState = nextButtons | 0;\n x = nextX || 0;\n y = nextY || 0;\n callback && callback(buttonState, x, y, mods);\n }\n }\n function clearState(ev) {\n handleEvent(0, ev);\n }\n function handleBlur() {\n if (buttonState || x || y || mods.shift || mods.alt || mods.meta || mods.control) {\n x = y = 0;\n buttonState = 0;\n mods.shift = mods.alt = mods.control = mods.meta = false;\n callback && callback(0, 0, 0, mods);\n }\n }\n function handleMods(ev) {\n if (updateMods(ev)) {\n callback && callback(buttonState, x, y, mods);\n }\n }\n function handleMouseMove(ev) {\n if (mouse.buttons(ev) === 0) {\n handleEvent(0, ev);\n } else {\n handleEvent(buttonState, ev);\n }\n }\n function handleMouseDown(ev) {\n handleEvent(buttonState | mouse.buttons(ev), ev);\n }\n function handleMouseUp(ev) {\n handleEvent(buttonState & ~mouse.buttons(ev), ev);\n }\n function attachListeners() {\n if (attached) {\n return;\n }\n attached = true;\n element.addEventListener(\"mousemove\", handleMouseMove);\n element.addEventListener(\"mousedown\", handleMouseDown);\n element.addEventListener(\"mouseup\", handleMouseUp);\n element.addEventListener(\"mouseleave\", clearState);\n element.addEventListener(\"mouseenter\", clearState);\n element.addEventListener(\"mouseout\", clearState);\n element.addEventListener(\"mouseover\", clearState);\n element.addEventListener(\"blur\", handleBlur);\n element.addEventListener(\"keyup\", handleMods);\n element.addEventListener(\"keydown\", handleMods);\n element.addEventListener(\"keypress\", handleMods);\n if (element !== window) {\n window.addEventListener(\"blur\", handleBlur);\n window.addEventListener(\"keyup\", handleMods);\n window.addEventListener(\"keydown\", handleMods);\n window.addEventListener(\"keypress\", handleMods);\n }\n }\n function detachListeners() {\n if (!attached) {\n return;\n }\n attached = false;\n element.removeEventListener(\"mousemove\", handleMouseMove);\n element.removeEventListener(\"mousedown\", handleMouseDown);\n element.removeEventListener(\"mouseup\", handleMouseUp);\n element.removeEventListener(\"mouseleave\", clearState);\n element.removeEventListener(\"mouseenter\", clearState);\n element.removeEventListener(\"mouseout\", clearState);\n element.removeEventListener(\"mouseover\", clearState);\n element.removeEventListener(\"blur\", handleBlur);\n element.removeEventListener(\"keyup\", handleMods);\n element.removeEventListener(\"keydown\", handleMods);\n element.removeEventListener(\"keypress\", handleMods);\n if (element !== window) {\n window.removeEventListener(\"blur\", handleBlur);\n window.removeEventListener(\"keyup\", handleMods);\n window.removeEventListener(\"keydown\", handleMods);\n window.removeEventListener(\"keypress\", handleMods);\n }\n }\n attachListeners();\n var result = {\n element\n };\n Object.defineProperties(result, {\n enabled: {\n get: function() {\n return attached;\n },\n set: function(f) {\n if (f) {\n attachListeners();\n } else {\n detachListeners();\n }\n },\n enumerable: true\n },\n buttons: {\n get: function() {\n return buttonState;\n },\n enumerable: true\n },\n x: {\n get: function() {\n return x;\n },\n enumerable: true\n },\n y: {\n get: function() {\n return y;\n },\n enumerable: true\n },\n mods: {\n get: function() {\n return mods;\n },\n enumerable: true\n }\n });\n return result;\n }\n }\n ),\n /***/\n 24: (\n /***/\n function(module2) {\n var rootPosition = { left: 0, top: 0 };\n module2.exports = mouseEventOffset;\n function mouseEventOffset(ev, target, out) {\n target = target || ev.currentTarget || ev.srcElement;\n if (!Array.isArray(out)) {\n out = [0, 0];\n }\n var cx = ev.clientX || 0;\n var cy = ev.clientY || 0;\n var rect = getBoundingClientOffset(target);\n out[0] = cx - rect.left;\n out[1] = cy - rect.top;\n return out;\n }\n function getBoundingClientOffset(element) {\n if (element === window || element === document || element === document.body) {\n return rootPosition;\n } else {\n return element.getBoundingClientRect();\n }\n }\n }\n ),\n /***/\n 4687: (\n /***/\n function(__unused_webpack_module, exports2) {\n \"use strict\";\n function mouseButtons(ev) {\n if (typeof ev === \"object\") {\n if (\"buttons\" in ev) {\n return ev.buttons;\n } else if (\"which\" in ev) {\n var b = ev.which;\n if (b === 2) {\n return 4;\n } else if (b === 3) {\n return 2;\n } else if (b > 0) {\n return 1 << b - 1;\n }\n } else if (\"button\" in ev) {\n var b = ev.button;\n if (b === 1) {\n return 4;\n } else if (b === 2) {\n return 2;\n } else if (b >= 0) {\n return 1 << b;\n }\n }\n }\n return 0;\n }\n exports2.buttons = mouseButtons;\n function mouseElement(ev) {\n return ev.target || ev.srcElement || window;\n }\n exports2.element = mouseElement;\n function mouseRelativeX(ev) {\n if (typeof ev === \"object\") {\n if (\"offsetX\" in ev) {\n return ev.offsetX;\n }\n var target = mouseElement(ev);\n var bounds = target.getBoundingClientRect();\n return ev.clientX - bounds.left;\n }\n return 0;\n }\n exports2.x = mouseRelativeX;\n function mouseRelativeY(ev) {\n if (typeof ev === \"object\") {\n if (\"offsetY\" in ev) {\n return ev.offsetY;\n }\n var target = mouseElement(ev);\n var bounds = target.getBoundingClientRect();\n return ev.clientY - bounds.top;\n }\n return 0;\n }\n exports2.y = mouseRelativeY;\n }\n ),\n /***/\n 8512: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var toPX = __webpack_require__2(665);\n module2.exports = mouseWheelListen;\n function mouseWheelListen(element, callback, noScroll) {\n if (typeof element === \"function\") {\n noScroll = !!callback;\n callback = element;\n element = window;\n }\n var lineHeight = toPX(\"ex\", element);\n var listener = function(ev) {\n if (noScroll) {\n ev.preventDefault();\n }\n var dx = ev.deltaX || 0;\n var dy = ev.deltaY || 0;\n var dz = ev.deltaZ || 0;\n var mode = ev.deltaMode;\n var scale = 1;\n switch (mode) {\n case 1:\n scale = lineHeight;\n break;\n case 2:\n scale = window.innerHeight;\n break;\n }\n dx *= scale;\n dy *= scale;\n dz *= scale;\n if (dx || dy || dz) {\n return callback(dx, dy, dz, ev);\n }\n };\n element.addEventListener(\"wheel\", listener);\n return listener;\n }\n }\n ),\n /***/\n 2640: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var pool = __webpack_require__2(1888);\n module2.exports = createSurfaceExtractor;\n var allFns = {\n \"false,0,1\": function surfaceProcedure(vertex, face, phase, mallocUint32, freeUint32) {\n return function extractContour0_1(a0, x0, x1, x2) {\n var s0 = a0.shape[0] | 0, s1 = a0.shape[1] | 0, d0 = a0.data, o0 = a0.offset | 0, t0_0 = a0.stride[0] | 0, t0_1 = a0.stride[1] | 0, p0 = o0, c0_0, d0_1 = -t0_0 | 0, c0_1 = 0, d0_2 = -t0_1 | 0, c0_2 = 0, d0_3 = -t0_0 - t0_1 | 0, c0_3 = 0, u0_0 = t0_0 | 0, u0_1 = t0_1 - t0_0 * s0 | 0, i0 = 0, i1 = 0, N = 0, Q = 2 * s0 | 0, P = mallocUint32(Q), V = mallocUint32(Q), X = 0, b0 = 0, e1 = -1 | 0, y1 = -1 | 0, b1 = 0, e2 = -s0 | 0, y2 = s0 | 0, b2 = 0, e3 = -s0 - 1 | 0, y3 = s0 - 1 | 0, b3 = 0, v0 = 0, T = 0;\n for (i0 = 0; i0 < s0; ++i0) {\n P[X++] = phase(d0[p0], x0, x1, x2);\n p0 += u0_0;\n }\n p0 += u0_1;\n if (s1 > 0) {\n i1 = 1;\n P[X++] = phase(d0[p0], x0, x1, x2);\n p0 += u0_0;\n if (s0 > 0) {\n i0 = 1;\n c0_0 = d0[p0];\n b0 = P[X] = phase(c0_0, x0, x1, x2);\n b1 = P[X + e1];\n b2 = P[X + e2];\n b3 = P[X + e3];\n if (b0 !== b1 || b0 !== b2 || b0 !== b3) {\n c0_1 = d0[p0 + d0_1];\n c0_2 = d0[p0 + d0_2];\n c0_3 = d0[p0 + d0_3];\n vertex(i0, i1, c0_0, c0_1, c0_2, c0_3, b0, b1, b2, b3, x0, x1, x2);\n v0 = V[X] = N++;\n }\n X += 1;\n p0 += u0_0;\n for (i0 = 2; i0 < s0; ++i0) {\n c0_0 = d0[p0];\n b0 = P[X] = phase(c0_0, x0, x1, x2);\n b1 = P[X + e1];\n b2 = P[X + e2];\n b3 = P[X + e3];\n if (b0 !== b1 || b0 !== b2 || b0 !== b3) {\n c0_1 = d0[p0 + d0_1];\n c0_2 = d0[p0 + d0_2];\n c0_3 = d0[p0 + d0_3];\n vertex(i0, i1, c0_0, c0_1, c0_2, c0_3, b0, b1, b2, b3, x0, x1, x2);\n v0 = V[X] = N++;\n if (b3 !== b1) {\n face(V[X + e1], v0, c0_3, c0_1, b3, b1, x0, x1, x2);\n }\n }\n X += 1;\n p0 += u0_0;\n }\n }\n p0 += u0_1;\n X = 0;\n T = e1;\n e1 = y1;\n y1 = T;\n T = e2;\n e2 = y2;\n y2 = T;\n T = e3;\n e3 = y3;\n y3 = T;\n for (i1 = 2; i1 < s1; ++i1) {\n P[X++] = phase(d0[p0], x0, x1, x2);\n p0 += u0_0;\n if (s0 > 0) {\n i0 = 1;\n c0_0 = d0[p0];\n b0 = P[X] = phase(c0_0, x0, x1, x2);\n b1 = P[X + e1];\n b2 = P[X + e2];\n b3 = P[X + e3];\n if (b0 !== b1 || b0 !== b2 || b0 !== b3) {\n c0_1 = d0[p0 + d0_1];\n c0_2 = d0[p0 + d0_2];\n c0_3 = d0[p0 + d0_3];\n vertex(i0, i1, c0_0, c0_1, c0_2, c0_3, b0, b1, b2, b3, x0, x1, x2);\n v0 = V[X] = N++;\n if (b3 !== b2) {\n face(V[X + e2], v0, c0_2, c0_3, b2, b3, x0, x1, x2);\n }\n }\n X += 1;\n p0 += u0_0;\n for (i0 = 2; i0 < s0; ++i0) {\n c0_0 = d0[p0];\n b0 = P[X] = phase(c0_0, x0, x1, x2);\n b1 = P[X + e1];\n b2 = P[X + e2];\n b3 = P[X + e3];\n if (b0 !== b1 || b0 !== b2 || b0 !== b3) {\n c0_1 = d0[p0 + d0_1];\n c0_2 = d0[p0 + d0_2];\n c0_3 = d0[p0 + d0_3];\n vertex(i0, i1, c0_0, c0_1, c0_2, c0_3, b0, b1, b2, b3, x0, x1, x2);\n v0 = V[X] = N++;\n if (b3 !== b2) {\n face(V[X + e2], v0, c0_2, c0_3, b2, b3, x0, x1, x2);\n }\n if (b3 !== b1) {\n face(V[X + e1], v0, c0_3, c0_1, b3, b1, x0, x1, x2);\n }\n }\n X += 1;\n p0 += u0_0;\n }\n }\n if (i1 & 1) {\n X = 0;\n }\n T = e1;\n e1 = y1;\n y1 = T;\n T = e2;\n e2 = y2;\n y2 = T;\n T = e3;\n e3 = y3;\n y3 = T;\n p0 += u0_1;\n }\n }\n freeUint32(V);\n freeUint32(P);\n };\n },\n \"false,1,0\": function anonymous(vertex, face, phase, mallocUint32, freeUint32) {\n return function extractContour1_0(a0, x0, x1, x2) {\n var s0 = a0.shape[0] | 0, s1 = a0.shape[1] | 0, d0 = a0.data, o0 = a0.offset | 0, t0_0 = a0.stride[0] | 0, t0_1 = a0.stride[1] | 0, p0 = o0, c0_0, d0_1 = -t0_0 | 0, c0_1 = 0, d0_2 = -t0_1 | 0, c0_2 = 0, d0_3 = -t0_0 - t0_1 | 0, c0_3 = 0, u0_1 = t0_1 | 0, u0_0 = t0_0 - t0_1 * s1 | 0, i0 = 0, i1 = 0, N = 0, Q = 2 * s1 | 0, P = mallocUint32(Q), V = mallocUint32(Q), X = 0, b0 = 0, e2 = -1 | 0, y2 = -1 | 0, b2 = 0, e1 = -s1 | 0, y1 = s1 | 0, b1 = 0, e3 = -s1 - 1 | 0, y3 = s1 - 1 | 0, b3 = 0, v0 = 0, T = 0;\n for (i1 = 0; i1 < s1; ++i1) {\n P[X++] = phase(d0[p0], x0, x1, x2);\n p0 += u0_1;\n }\n p0 += u0_0;\n if (s0 > 0) {\n i0 = 1;\n P[X++] = phase(d0[p0], x0, x1, x2);\n p0 += u0_1;\n if (s1 > 0) {\n i1 = 1;\n c0_0 = d0[p0];\n b0 = P[X] = phase(c0_0, x0, x1, x2);\n b1 = P[X + e1];\n b2 = P[X + e2];\n b3 = P[X + e3];\n if (b0 !== b1 || b0 !== b2 || b0 !== b3) {\n c0_1 = d0[p0 + d0_1];\n c0_2 = d0[p0 + d0_2];\n c0_3 = d0[p0 + d0_3];\n vertex(i0, i1, c0_0, c0_1, c0_2, c0_3, b0, b1, b2, b3, x0, x1, x2);\n v0 = V[X] = N++;\n }\n X += 1;\n p0 += u0_1;\n for (i1 = 2; i1 < s1; ++i1) {\n c0_0 = d0[p0];\n b0 = P[X] = phase(c0_0, x0, x1, x2);\n b1 = P[X + e1];\n b2 = P[X + e2];\n b3 = P[X + e3];\n if (b0 !== b1 || b0 !== b2 || b0 !== b3) {\n c0_1 = d0[p0 + d0_1];\n c0_2 = d0[p0 + d0_2];\n c0_3 = d0[p0 + d0_3];\n vertex(i0, i1, c0_0, c0_1, c0_2, c0_3, b0, b1, b2, b3, x0, x1, x2);\n v0 = V[X] = N++;\n if (b3 !== b2) {\n face(V[X + e2], v0, c0_2, c0_3, b2, b3, x0, x1, x2);\n }\n }\n X += 1;\n p0 += u0_1;\n }\n }\n p0 += u0_0;\n X = 0;\n T = e1;\n e1 = y1;\n y1 = T;\n T = e2;\n e2 = y2;\n y2 = T;\n T = e3;\n e3 = y3;\n y3 = T;\n for (i0 = 2; i0 < s0; ++i0) {\n P[X++] = phase(d0[p0], x0, x1, x2);\n p0 += u0_1;\n if (s1 > 0) {\n i1 = 1;\n c0_0 = d0[p0];\n b0 = P[X] = phase(c0_0, x0, x1, x2);\n b1 = P[X + e1];\n b2 = P[X + e2];\n b3 = P[X + e3];\n if (b0 !== b1 || b0 !== b2 || b0 !== b3) {\n c0_1 = d0[p0 + d0_1];\n c0_2 = d0[p0 + d0_2];\n c0_3 = d0[p0 + d0_3];\n vertex(i0, i1, c0_0, c0_1, c0_2, c0_3, b0, b1, b2, b3, x0, x1, x2);\n v0 = V[X] = N++;\n if (b3 !== b1) {\n face(V[X + e1], v0, c0_3, c0_1, b3, b1, x0, x1, x2);\n }\n }\n X += 1;\n p0 += u0_1;\n for (i1 = 2; i1 < s1; ++i1) {\n c0_0 = d0[p0];\n b0 = P[X] = phase(c0_0, x0, x1, x2);\n b1 = P[X + e1];\n b2 = P[X + e2];\n b3 = P[X + e3];\n if (b0 !== b1 || b0 !== b2 || b0 !== b3) {\n c0_1 = d0[p0 + d0_1];\n c0_2 = d0[p0 + d0_2];\n c0_3 = d0[p0 + d0_3];\n vertex(i0, i1, c0_0, c0_1, c0_2, c0_3, b0, b1, b2, b3, x0, x1, x2);\n v0 = V[X] = N++;\n if (b3 !== b2) {\n face(V[X + e2], v0, c0_2, c0_3, b2, b3, x0, x1, x2);\n }\n if (b3 !== b1) {\n face(V[X + e1], v0, c0_3, c0_1, b3, b1, x0, x1, x2);\n }\n }\n X += 1;\n p0 += u0_1;\n }\n }\n if (i0 & 1) {\n X = 0;\n }\n T = e1;\n e1 = y1;\n y1 = T;\n T = e2;\n e2 = y2;\n y2 = T;\n T = e3;\n e3 = y3;\n y3 = T;\n p0 += u0_0;\n }\n }\n freeUint32(V);\n freeUint32(P);\n };\n }\n };\n function compileSurfaceProcedure(vertexFunc, faceFunc, phaseFunc, scalarArgs, order, typesig) {\n var key = [typesig, order].join(\",\");\n var proc = allFns[key];\n return proc(\n vertexFunc,\n faceFunc,\n phaseFunc,\n pool.mallocUint32,\n pool.freeUint32\n );\n }\n function createSurfaceExtractor(args) {\n function error(msg) {\n throw new Error(\"ndarray-extract-contour: \" + msg);\n }\n if (typeof args !== \"object\") {\n error(\"Must specify arguments\");\n }\n var order = args.order;\n if (!Array.isArray(order)) {\n error(\"Must specify order\");\n }\n var arrays = args.arrayArguments || 1;\n if (arrays < 1) {\n error(\"Must have at least one array argument\");\n }\n var scalars = args.scalarArguments || 0;\n if (scalars < 0) {\n error(\"Scalar arg count must be > 0\");\n }\n if (typeof args.vertex !== \"function\") {\n error(\"Must specify vertex creation function\");\n }\n if (typeof args.cell !== \"function\") {\n error(\"Must specify cell creation function\");\n }\n if (typeof args.phase !== \"function\") {\n error(\"Must specify phase function\");\n }\n var getters = args.getters || [];\n var typesig = new Array(arrays);\n for (var i = 0; i < arrays; ++i) {\n if (getters.indexOf(i) >= 0) {\n typesig[i] = true;\n } else {\n typesig[i] = false;\n }\n }\n return compileSurfaceProcedure(\n args.vertex,\n args.cell,\n args.phase,\n scalars,\n order,\n typesig\n );\n }\n }\n ),\n /***/\n 6199: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var dup = __webpack_require__2(1338);\n var CACHED_CWiseOp = {\n zero: function(SS, a0, t02, p0) {\n var s0 = SS[0], t0p0 = t02[0];\n p0 |= 0;\n var i0 = 0, d0s0 = t0p0;\n for (i0 = 0; i0 < s0; ++i0) {\n a0[p0] = 0;\n p0 += d0s0;\n }\n },\n fdTemplate1: function(SS, a0, t02, p0, a1, t12, p1) {\n var s0 = SS[0], t0p0 = t02[0], t1p0 = t12[0], q0 = -1 * t0p0, q1 = t0p0;\n p0 |= 0;\n p1 |= 0;\n var i0 = 0, d0s0 = t0p0, d1s0 = t1p0;\n for (i0 = 0; i0 < s0; ++i0) {\n a1[p1] = 0.5 * (a0[p0 + q0] - a0[p0 + q1]);\n p0 += d0s0;\n p1 += d1s0;\n }\n },\n fdTemplate2: function(SS, a0, t02, p0, a1, t12, p1, a2, t22, p2) {\n var s0 = SS[0], s1 = SS[1], t0p0 = t02[0], t0p1 = t02[1], t1p0 = t12[0], t1p1 = t12[1], t2p0 = t22[0], t2p1 = t22[1], q0 = -1 * t0p0, q1 = t0p0, q2 = -1 * t0p1, q3 = t0p1;\n p0 |= 0;\n p1 |= 0;\n p2 |= 0;\n var i0 = 0, i1 = 0, d0s0 = t0p1, d0s1 = t0p0 - s1 * t0p1, d1s0 = t1p1, d1s1 = t1p0 - s1 * t1p1, d2s0 = t2p1, d2s1 = t2p0 - s1 * t2p1;\n for (i1 = 0; i1 < s0; ++i1) {\n for (i0 = 0; i0 < s1; ++i0) {\n a1[p1] = 0.5 * (a0[p0 + q0] - a0[p0 + q1]);\n a2[p2] = 0.5 * (a0[p0 + q2] - a0[p0 + q3]);\n p0 += d0s0;\n p1 += d1s0;\n p2 += d2s0;\n }\n p0 += d0s1;\n p1 += d1s1;\n p2 += d2s1;\n }\n }\n };\n var CACHED_thunk = {\n cdiff: function(compile2) {\n var CACHED = {};\n return function cdiff_cwise_thunk(array0, array1, array2) {\n var t02 = array0.dtype, r0 = array0.order, t12 = array1.dtype, r1 = array1.order, t22 = array2.dtype, r2 = array2.order, type = [t02, r0.join(), t12, r1.join(), t22, r2.join()].join(), proc = CACHED[type];\n if (!proc) {\n CACHED[type] = proc = compile2([t02, r0, t12, r1, t22, r2]);\n }\n return proc(array0.shape.slice(0), array0.data, array0.stride, array0.offset | 0, array1.data, array1.stride, array1.offset | 0, array2.data, array2.stride, array2.offset | 0);\n };\n },\n zero: function(compile2) {\n var CACHED = {};\n return function zero_cwise_thunk(array0) {\n var t02 = array0.dtype, r0 = array0.order, type = [t02, r0.join()].join(), proc = CACHED[type];\n if (!proc) {\n CACHED[type] = proc = compile2([t02, r0]);\n }\n return proc(array0.shape.slice(0), array0.data, array0.stride, array0.offset | 0);\n };\n },\n fdTemplate1: function(compile2) {\n var CACHED = {};\n return function fdTemplate1_cwise_thunk(array0, array1) {\n var t02 = array0.dtype, r0 = array0.order, t12 = array1.dtype, r1 = array1.order, type = [t02, r0.join(), t12, r1.join()].join(), proc = CACHED[type];\n if (!proc) {\n CACHED[type] = proc = compile2([t02, r0, t12, r1]);\n }\n return proc(array0.shape.slice(0), array0.data, array0.stride, array0.offset | 0, array1.data, array1.stride, array1.offset | 0);\n };\n },\n fdTemplate2: function(compile2) {\n var CACHED = {};\n return function fdTemplate2_cwise_thunk(array0, array1, array4) {\n var t02 = array0.dtype, r0 = array0.order, t12 = array1.dtype, r1 = array1.order, t4 = array4.dtype, r4 = array4.order, type = [t02, r0.join(), t12, r1.join(), t4, r4.join()].join(), proc = CACHED[type];\n if (!proc) {\n CACHED[type] = proc = compile2([t02, r0, t12, r1, t4, r4]);\n }\n return proc(array0.shape.slice(0), array0.data, array0.stride, array0.offset | 0, array1.data, array1.stride, array1.offset | 0, array4.data, array4.stride, array4.offset | 0);\n };\n }\n };\n function createThunk(proc) {\n var thunk = CACHED_thunk[proc.funcName];\n return thunk(compile.bind(void 0, proc));\n }\n function compile(proc) {\n return CACHED_CWiseOp[proc.funcName];\n }\n function cwiseCompiler(user_args) {\n return createThunk({\n funcName: user_args.funcName\n });\n }\n var TEMPLATE_CACHE = {};\n var GRADIENT_CACHE = {};\n var EmptyProc = {\n body: \"\",\n args: [],\n thisVars: [],\n localVars: []\n };\n var centralDiff = cwiseCompiler({\n funcName: \"cdiff\"\n });\n var zeroOut = cwiseCompiler({\n funcName: \"zero\"\n });\n function generateTemplate(d) {\n if (d in TEMPLATE_CACHE) {\n return TEMPLATE_CACHE[d];\n }\n return TEMPLATE_CACHE[d] = cwiseCompiler({\n funcName: \"fdTemplate\" + d\n });\n }\n function CACHED_link(diff, zero2, grad1, grad2) {\n return function(dst, src) {\n var s = src.shape.slice();\n if (s[0] > 2 && s[1] > 2) {\n grad2(\n src.pick(-1, -1).lo(1, 1).hi(s[0] - 2, s[1] - 2),\n dst.pick(-1, -1, 0).lo(1, 1).hi(s[0] - 2, s[1] - 2),\n dst.pick(-1, -1, 1).lo(1, 1).hi(s[0] - 2, s[1] - 2)\n );\n }\n if (s[1] > 2) {\n grad1(\n src.pick(0, -1).lo(1).hi(s[1] - 2),\n dst.pick(0, -1, 1).lo(1).hi(s[1] - 2)\n );\n zero2(\n dst.pick(0, -1, 0).lo(1).hi(s[1] - 2)\n );\n }\n if (s[1] > 2) {\n grad1(\n src.pick(s[0] - 1, -1).lo(1).hi(s[1] - 2),\n dst.pick(s[0] - 1, -1, 1).lo(1).hi(s[1] - 2)\n );\n zero2(\n dst.pick(s[0] - 1, -1, 0).lo(1).hi(s[1] - 2)\n );\n }\n if (s[0] > 2) {\n grad1(\n src.pick(-1, 0).lo(1).hi(s[0] - 2),\n dst.pick(-1, 0, 0).lo(1).hi(s[0] - 2)\n );\n zero2(\n dst.pick(-1, 0, 1).lo(1).hi(s[0] - 2)\n );\n }\n if (s[0] > 2) {\n grad1(\n src.pick(-1, s[1] - 1).lo(1).hi(s[0] - 2),\n dst.pick(-1, s[1] - 1, 0).lo(1).hi(s[0] - 2)\n );\n zero2(\n dst.pick(-1, s[1] - 1, 1).lo(1).hi(s[0] - 2)\n );\n }\n dst.set(0, 0, 0, 0);\n dst.set(0, 0, 1, 0);\n dst.set(s[0] - 1, 0, 0, 0);\n dst.set(s[0] - 1, 0, 1, 0);\n dst.set(0, s[1] - 1, 0, 0);\n dst.set(0, s[1] - 1, 1, 0);\n dst.set(s[0] - 1, s[1] - 1, 0, 0);\n dst.set(s[0] - 1, s[1] - 1, 1, 0);\n return dst;\n };\n }\n function generateGradient(boundaryConditions) {\n var token = boundaryConditions.join();\n var proc = GRADIENT_CACHE[token];\n if (proc) {\n return proc;\n }\n var d = boundaryConditions.length;\n var linkArgs = [centralDiff, zeroOut];\n for (var i = 1; i <= d; ++i) {\n linkArgs.push(generateTemplate(i));\n }\n var link = CACHED_link;\n var proc = link.apply(void 0, linkArgs);\n GRADIENT_CACHE[token] = proc;\n return proc;\n }\n module2.exports = function gradient(out, inp, bc) {\n if (!Array.isArray(bc)) {\n if (typeof bc === \"string\") {\n bc = dup(inp.dimension, bc);\n } else {\n bc = dup(inp.dimension, \"clamp\");\n }\n }\n if (inp.size === 0) {\n return out;\n }\n if (inp.dimension === 0) {\n out.set(0);\n return out;\n }\n var cached = generateGradient(bc);\n return cached(out, inp);\n };\n }\n ),\n /***/\n 4317: (\n /***/\n function(module2) {\n \"use strict\";\n function interp1d(arr, x) {\n var ix = Math.floor(x), fx = x - ix, s0 = 0 <= ix && ix < arr.shape[0], s1 = 0 <= ix + 1 && ix + 1 < arr.shape[0], w0 = s0 ? +arr.get(ix) : 0, w1 = s1 ? +arr.get(ix + 1) : 0;\n return (1 - fx) * w0 + fx * w1;\n }\n function interp2d(arr, x, y) {\n var ix = Math.floor(x), fx = x - ix, s0 = 0 <= ix && ix < arr.shape[0], s1 = 0 <= ix + 1 && ix + 1 < arr.shape[0], iy = Math.floor(y), fy = y - iy, t02 = 0 <= iy && iy < arr.shape[1], t12 = 0 <= iy + 1 && iy + 1 < arr.shape[1], w00 = s0 && t02 ? arr.get(ix, iy) : 0, w01 = s0 && t12 ? arr.get(ix, iy + 1) : 0, w10 = s1 && t02 ? arr.get(ix + 1, iy) : 0, w11 = s1 && t12 ? arr.get(ix + 1, iy + 1) : 0;\n return (1 - fy) * ((1 - fx) * w00 + fx * w10) + fy * ((1 - fx) * w01 + fx * w11);\n }\n function interp3d(arr, x, y, z) {\n var ix = Math.floor(x), fx = x - ix, s0 = 0 <= ix && ix < arr.shape[0], s1 = 0 <= ix + 1 && ix + 1 < arr.shape[0], iy = Math.floor(y), fy = y - iy, t02 = 0 <= iy && iy < arr.shape[1], t12 = 0 <= iy + 1 && iy + 1 < arr.shape[1], iz = Math.floor(z), fz = z - iz, u0 = 0 <= iz && iz < arr.shape[2], u1 = 0 <= iz + 1 && iz + 1 < arr.shape[2], w000 = s0 && t02 && u0 ? arr.get(ix, iy, iz) : 0, w010 = s0 && t12 && u0 ? arr.get(ix, iy + 1, iz) : 0, w100 = s1 && t02 && u0 ? arr.get(ix + 1, iy, iz) : 0, w110 = s1 && t12 && u0 ? arr.get(ix + 1, iy + 1, iz) : 0, w001 = s0 && t02 && u1 ? arr.get(ix, iy, iz + 1) : 0, w011 = s0 && t12 && u1 ? arr.get(ix, iy + 1, iz + 1) : 0, w101 = s1 && t02 && u1 ? arr.get(ix + 1, iy, iz + 1) : 0, w111 = s1 && t12 && u1 ? arr.get(ix + 1, iy + 1, iz + 1) : 0;\n return (1 - fz) * ((1 - fy) * ((1 - fx) * w000 + fx * w100) + fy * ((1 - fx) * w010 + fx * w110)) + fz * ((1 - fy) * ((1 - fx) * w001 + fx * w101) + fy * ((1 - fx) * w011 + fx * w111));\n }\n function interpNd(arr) {\n var d = arr.shape.length | 0, ix = new Array(d), fx = new Array(d), s0 = new Array(d), s1 = new Array(d), i, t;\n for (i = 0; i < d; ++i) {\n t = +arguments[i + 1];\n ix[i] = Math.floor(t);\n fx[i] = t - ix[i];\n s0[i] = 0 <= ix[i] && ix[i] < arr.shape[i];\n s1[i] = 0 <= ix[i] + 1 && ix[i] + 1 < arr.shape[i];\n }\n var r = 0, j, w, idx;\n i_loop:\n for (i = 0; i < 1 << d; ++i) {\n w = 1;\n idx = arr.offset;\n for (j = 0; j < d; ++j) {\n if (i & 1 << j) {\n if (!s1[j]) {\n continue i_loop;\n }\n w *= fx[j];\n idx += arr.stride[j] * (ix[j] + 1);\n } else {\n if (!s0[j]) {\n continue i_loop;\n }\n w *= 1 - fx[j];\n idx += arr.stride[j] * ix[j];\n }\n }\n r += w * arr.data[idx];\n }\n return r;\n }\n function interpolate(arr, x, y, z) {\n switch (arr.shape.length) {\n case 0:\n return 0;\n case 1:\n return interp1d(arr, x);\n case 2:\n return interp2d(arr, x, y);\n case 3:\n return interp3d(arr, x, y, z);\n default:\n return interpNd.apply(void 0, arguments);\n }\n }\n module2.exports = interpolate;\n module2.exports.d1 = interp1d;\n module2.exports.d2 = interp2d;\n module2.exports.d3 = interp3d;\n }\n ),\n /***/\n 5298: (\n /***/\n function(__unused_webpack_module, exports2) {\n \"use strict\";\n var CACHED_CWiseOp = {\n \"float64,2,1,0\": function() {\n return function divseq_cwise_loop_2s1s0m3f64(SS, a0, t02, p0, Y0) {\n var s0 = SS[0], s1 = SS[1], s2 = SS[2], t0p0 = t02[0], t0p1 = t02[1], t0p2 = t02[2];\n p0 |= 0;\n var i0 = 0, i1 = 0, i2 = 0, d0s0 = t0p2, d0s1 = t0p1 - s2 * t0p2, d0s2 = t0p0 - s1 * t0p1;\n for (i2 = 0; i2 < s0; ++i2) {\n for (i1 = 0; i1 < s1; ++i1) {\n for (i0 = 0; i0 < s2; ++i0) {\n a0[p0] /= Y0;\n p0 += d0s0;\n }\n p0 += d0s1;\n }\n p0 += d0s2;\n }\n };\n },\n \"uint8,2,0,1,float64,2,1,0\": function() {\n return function muls_cwise_loop_2s0s1m1u8f64(SS, a0, t02, p0, a1, t12, p1, Y0) {\n var s0 = SS[0], s1 = SS[1], s2 = SS[2], t0p0 = t02[0], t0p1 = t02[1], t0p2 = t02[2], t1p0 = t12[0], t1p1 = t12[1], t1p2 = t12[2];\n p0 |= 0;\n p1 |= 0;\n var offset0 = p0;\n var offset1 = p1;\n for (var j1 = SS[0] | 0; j1 > 0; ) {\n if (j1 < 64) {\n s0 = j1;\n j1 = 0;\n } else {\n s0 = 64;\n j1 -= 64;\n }\n for (var j2 = SS[1] | 0; j2 > 0; ) {\n if (j2 < 64) {\n s1 = j2;\n j2 = 0;\n } else {\n s1 = 64;\n j2 -= 64;\n }\n p0 = offset0 + j1 * t0p0 + j2 * t0p1;\n p1 = offset1 + j1 * t1p0 + j2 * t1p1;\n var i0 = 0, i1 = 0, i2 = 0, d0s0 = t0p2, d0s1 = t0p0 - s2 * t0p2, d0s2 = t0p1 - s0 * t0p0, d1s0 = t1p2, d1s1 = t1p0 - s2 * t1p2, d1s2 = t1p1 - s0 * t1p0;\n for (i2 = 0; i2 < s1; ++i2) {\n for (i1 = 0; i1 < s0; ++i1) {\n for (i0 = 0; i0 < s2; ++i0) {\n a0[p0] = a1[p1] * Y0;\n p0 += d0s0;\n p1 += d1s0;\n }\n p0 += d0s1;\n p1 += d1s1;\n }\n p0 += d0s2;\n p1 += d1s2;\n }\n }\n }\n };\n },\n \"float32,1,0,float32,1,0\": function() {\n return function assign_cwise_loop_1s0m2f32(SS, a0, t02, p0, a1, t12, p1) {\n var s0 = SS[0], s1 = SS[1], t0p0 = t02[0], t0p1 = t02[1], t1p0 = t12[0], t1p1 = t12[1];\n p0 |= 0;\n p1 |= 0;\n var i0 = 0, i1 = 0, d0s0 = t0p1, d0s1 = t0p0 - s1 * t0p1, d1s0 = t1p1, d1s1 = t1p0 - s1 * t1p1;\n for (i1 = 0; i1 < s0; ++i1) {\n for (i0 = 0; i0 < s1; ++i0) {\n a0[p0] = a1[p1];\n p0 += d0s0;\n p1 += d1s0;\n }\n p0 += d0s1;\n p1 += d1s1;\n }\n };\n },\n \"float32,1,0,float32,0,1\": function() {\n return function assign_cwise_loop_1s0m0f32(SS, a0, t02, p0, a1, t12, p1) {\n var s0 = SS[0], s1 = SS[1], t0p0 = t02[0], t0p1 = t02[1], t1p0 = t12[0], t1p1 = t12[1];\n p0 |= 0;\n p1 |= 0;\n var offset0 = p0;\n var offset1 = p1;\n for (var j0 = SS[1] | 0; j0 > 0; ) {\n if (j0 < 64) {\n s1 = j0;\n j0 = 0;\n } else {\n s1 = 64;\n j0 -= 64;\n }\n for (var j1 = SS[0] | 0; j1 > 0; ) {\n if (j1 < 64) {\n s0 = j1;\n j1 = 0;\n } else {\n s0 = 64;\n j1 -= 64;\n }\n p0 = offset0 + j0 * t0p1 + j1 * t0p0;\n p1 = offset1 + j0 * t1p1 + j1 * t1p0;\n var i0 = 0, i1 = 0, d0s0 = t0p1, d0s1 = t0p0 - s1 * t0p1, d1s0 = t1p1, d1s1 = t1p0 - s1 * t1p1;\n for (i1 = 0; i1 < s0; ++i1) {\n for (i0 = 0; i0 < s1; ++i0) {\n a0[p0] = a1[p1];\n p0 += d0s0;\n p1 += d1s0;\n }\n p0 += d0s1;\n p1 += d1s1;\n }\n }\n }\n };\n },\n \"uint8,2,0,1,uint8,1,2,0\": function() {\n return function assign_cwise_loop_2s0s1m0u8(SS, a0, t02, p0, a1, t12, p1) {\n var s0 = SS[0], s1 = SS[1], s2 = SS[2], t0p0 = t02[0], t0p1 = t02[1], t0p2 = t02[2], t1p0 = t12[0], t1p1 = t12[1], t1p2 = t12[2];\n p0 |= 0;\n p1 |= 0;\n var offset0 = p0;\n var offset1 = p1;\n for (var j0 = SS[2] | 0; j0 > 0; ) {\n if (j0 < 64) {\n s2 = j0;\n j0 = 0;\n } else {\n s2 = 64;\n j0 -= 64;\n }\n for (var j1 = SS[0] | 0; j1 > 0; ) {\n if (j1 < 64) {\n s0 = j1;\n j1 = 0;\n } else {\n s0 = 64;\n j1 -= 64;\n }\n for (var j2 = SS[1] | 0; j2 > 0; ) {\n if (j2 < 64) {\n s1 = j2;\n j2 = 0;\n } else {\n s1 = 64;\n j2 -= 64;\n }\n p0 = offset0 + j0 * t0p2 + j1 * t0p0 + j2 * t0p1;\n p1 = offset1 + j0 * t1p2 + j1 * t1p0 + j2 * t1p1;\n var i0 = 0, i1 = 0, i2 = 0, d0s0 = t0p2, d0s1 = t0p0 - s2 * t0p2, d0s2 = t0p1 - s0 * t0p0, d1s0 = t1p2, d1s1 = t1p0 - s2 * t1p2, d1s2 = t1p1 - s0 * t1p0;\n for (i2 = 0; i2 < s1; ++i2) {\n for (i1 = 0; i1 < s0; ++i1) {\n for (i0 = 0; i0 < s2; ++i0) {\n a0[p0] = a1[p1];\n p0 += d0s0;\n p1 += d1s0;\n }\n p0 += d0s1;\n p1 += d1s1;\n }\n p0 += d0s2;\n p1 += d1s2;\n }\n }\n }\n }\n };\n },\n \"uint8,2,0,1,array,2,0,1\": function() {\n return function assign_cwise_loop_2s0s1m3u8a(SS, a0, t02, p0, a1, t12, p1) {\n var s0 = SS[0], s1 = SS[1], s2 = SS[2], t0p0 = t02[0], t0p1 = t02[1], t0p2 = t02[2], t1p0 = t12[0], t1p1 = t12[1], t1p2 = t12[2];\n p0 |= 0;\n p1 |= 0;\n var i0 = 0, i1 = 0, i2 = 0, d0s0 = t0p2, d0s1 = t0p0 - s2 * t0p2, d0s2 = t0p1 - s0 * t0p0, d1s0 = t1p2, d1s1 = t1p0 - s2 * t1p2, d1s2 = t1p1 - s0 * t1p0;\n for (i2 = 0; i2 < s1; ++i2) {\n for (i1 = 0; i1 < s0; ++i1) {\n for (i0 = 0; i0 < s2; ++i0) {\n a0[p0] = a1[p1];\n p0 += d0s0;\n p1 += d1s0;\n }\n p0 += d0s1;\n p1 += d1s1;\n }\n p0 += d0s2;\n p1 += d1s2;\n }\n };\n }\n };\n function generateCWiseOp(proc, typesig) {\n var key = typesig.join(\",\");\n var f = CACHED_CWiseOp[key];\n return f();\n }\n var compile = generateCWiseOp;\n var CACHED_thunk = {\n mul: function(compile2) {\n var CACHED = {};\n return function mul_cwise_thunk(array0, array1, array2) {\n var t02 = array0.dtype, r0 = array0.order, t12 = array1.dtype, r1 = array1.order, t22 = array2.dtype, r2 = array2.order, type = [t02, r0.join(), t12, r1.join(), t22, r2.join()].join(), proc = CACHED[type];\n if (!proc) {\n CACHED[type] = proc = compile2([t02, r0, t12, r1, t22, r2]);\n }\n return proc(\n array0.shape.slice(0),\n array0.data,\n array0.stride,\n array0.offset | 0,\n array1.data,\n array1.stride,\n array1.offset | 0,\n array2.data,\n array2.stride,\n array2.offset | 0\n );\n };\n },\n muls: function(compile2) {\n var CACHED = {};\n return function muls_cwise_thunk(array0, array1, scalar2) {\n var t02 = array0.dtype, r0 = array0.order, t12 = array1.dtype, r1 = array1.order, type = [t02, r0.join(), t12, r1.join()].join(), proc = CACHED[type];\n if (!proc) {\n CACHED[type] = proc = compile2([t02, r0, t12, r1]);\n }\n return proc(\n array0.shape.slice(0),\n array0.data,\n array0.stride,\n array0.offset | 0,\n array1.data,\n array1.stride,\n array1.offset | 0,\n scalar2\n );\n };\n },\n mulseq: function(compile2) {\n var CACHED = {};\n return function mulseq_cwise_thunk(array0, scalar1) {\n var t02 = array0.dtype, r0 = array0.order, type = [t02, r0.join()].join(), proc = CACHED[type];\n if (!proc) {\n CACHED[type] = proc = compile2([t02, r0]);\n }\n return proc(array0.shape.slice(0), array0.data, array0.stride, array0.offset | 0, scalar1);\n };\n },\n div: function(compile2) {\n var CACHED = {};\n return function div_cwise_thunk(array0, array1, array2) {\n var t02 = array0.dtype, r0 = array0.order, t12 = array1.dtype, r1 = array1.order, t22 = array2.dtype, r2 = array2.order, type = [t02, r0.join(), t12, r1.join(), t22, r2.join()].join(), proc = CACHED[type];\n if (!proc) {\n CACHED[type] = proc = compile2([t02, r0, t12, r1, t22, r2]);\n }\n return proc(\n array0.shape.slice(0),\n array0.data,\n array0.stride,\n array0.offset | 0,\n array1.data,\n array1.stride,\n array1.offset | 0,\n array2.data,\n array2.stride,\n array2.offset | 0\n );\n };\n },\n divs: function(compile2) {\n var CACHED = {};\n return function divs_cwise_thunk(array0, array1, scalar2) {\n var t02 = array0.dtype, r0 = array0.order, t12 = array1.dtype, r1 = array1.order, type = [t02, r0.join(), t12, r1.join()].join(), proc = CACHED[type];\n if (!proc) {\n CACHED[type] = proc = compile2([t02, r0, t12, r1]);\n }\n return proc(\n array0.shape.slice(0),\n array0.data,\n array0.stride,\n array0.offset | 0,\n array1.data,\n array1.stride,\n array1.offset | 0,\n scalar2\n );\n };\n },\n divseq: function(compile2) {\n var CACHED = {};\n return function divseq_cwise_thunk(array0, scalar1) {\n var t02 = array0.dtype, r0 = array0.order, type = [t02, r0.join()].join(), proc = CACHED[type];\n if (!proc) {\n CACHED[type] = proc = compile2([t02, r0]);\n }\n return proc(array0.shape.slice(0), array0.data, array0.stride, array0.offset | 0, scalar1);\n };\n },\n assign: function(compile2) {\n var CACHED = {};\n return function assign_cwise_thunk(array0, array1) {\n var t02 = array0.dtype, r0 = array0.order, t12 = array1.dtype, r1 = array1.order, type = [t02, r0.join(), t12, r1.join()].join(), proc = CACHED[type];\n if (!proc) {\n CACHED[type] = proc = compile2([t02, r0, t12, r1]);\n }\n return proc(\n array0.shape.slice(0),\n array0.data,\n array0.stride,\n array0.offset | 0,\n array1.data,\n array1.stride,\n array1.offset | 0\n );\n };\n }\n };\n function createThunk(proc) {\n var thunk = CACHED_thunk[proc.funcName];\n return thunk(compile.bind(void 0, proc));\n }\n function makeOp(user_args) {\n return createThunk({\n funcName: user_args.funcName\n });\n }\n var assign_ops = {\n mul: \"*\",\n div: \"/\"\n };\n (function() {\n for (var id in assign_ops) {\n exports2[id] = makeOp({\n funcName: id\n });\n exports2[id + \"s\"] = makeOp({\n funcName: id + \"s\"\n });\n exports2[id + \"seq\"] = makeOp({\n funcName: id + \"seq\"\n });\n }\n })();\n exports2.assign = makeOp({\n funcName: \"assign\"\n });\n }\n ),\n /***/\n 9994: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var ndarray = __webpack_require__2(9618);\n var do_convert = __webpack_require__2(8277);\n module2.exports = function convert(arr, result) {\n var shape = [], c = arr, sz = 1;\n while (Array.isArray(c)) {\n shape.push(c.length);\n sz *= c.length;\n c = c[0];\n }\n if (shape.length === 0) {\n return ndarray();\n }\n if (!result) {\n result = ndarray(new Float64Array(sz), shape);\n }\n do_convert(result, arr);\n return result;\n };\n }\n ),\n /***/\n 8277: (\n /***/\n function(module2) {\n \"use strict\";\n function CwiseOp() {\n return function(SS, a0, t02, p0, Y0) {\n var s0 = SS[0], s1 = SS[1], s2 = SS[2], t0p0 = t02[0], t0p1 = t02[1], t0p2 = t02[2], index = [0, 0, 0];\n p0 |= 0;\n var i0 = 0, i1 = 0, i2 = 0, d0s0 = t0p2, d0s1 = t0p1 - s2 * t0p2, d0s2 = t0p0 - s1 * t0p1;\n for (i2 = 0; i2 < s0; ++i2) {\n for (i1 = 0; i1 < s1; ++i1) {\n for (i0 = 0; i0 < s2; ++i0) {\n {\n var _inline_1_v = Y0, _inline_1_i;\n for (_inline_1_i = 0; _inline_1_i < index.length - 1; ++_inline_1_i) {\n _inline_1_v = _inline_1_v[index[_inline_1_i]];\n }\n a0[p0] = _inline_1_v[index[index.length - 1]];\n }\n p0 += d0s0;\n ++index[2];\n }\n p0 += d0s1;\n index[2] -= s2;\n ++index[1];\n }\n p0 += d0s2;\n index[1] -= s1;\n ++index[0];\n }\n };\n }\n function generateCWiseOp() {\n return CwiseOp();\n }\n var compile = generateCWiseOp;\n function thunk(compile2) {\n var CACHED = {};\n return function convert_cwise_thunk(array0, scalar1) {\n var t02 = array0.dtype, r0 = array0.order, type = [t02, r0.join()].join(), proc = CACHED[type];\n if (!proc) {\n CACHED[type] = proc = compile2([t02, r0]);\n }\n return proc(\n array0.shape.slice(0),\n array0.data,\n array0.stride,\n array0.offset | 0,\n scalar1\n );\n };\n }\n function createThunk(proc) {\n return thunk(compile.bind(void 0, proc));\n }\n function compileCwise(user_args) {\n return createThunk({\n funcName: user_args.funcName\n });\n }\n module2.exports = compileCwise({\n funcName: \"convert\"\n });\n }\n ),\n /***/\n 7640: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var pool = __webpack_require__2(1888);\n function getMallocFree(dtype) {\n switch (dtype) {\n case \"uint32\":\n return [pool.mallocUint32, pool.freeUint32];\n default:\n return null;\n }\n }\n var CACHED_insertionSort = {\n \"uint32,1,0\": function(malloc, free) {\n return function ndarrayInsertionSort1d0uint32(left, right, data, offset, s0, s1, n0, n1, d1, e1, f1) {\n var i, j, cptr, ptr = left * s0 + offset, i1, scratch = malloc(n1), dptr, sptr, a, b;\n for (i = left + 1; i <= right; ++i) {\n j = i;\n ptr += s0;\n cptr = ptr;\n dptr = 0;\n sptr = ptr;\n for (i1 = 0; i1 < n1; ++i1) {\n scratch[dptr++] = data[sptr];\n sptr += d1;\n }\n __g: while (j-- > left) {\n dptr = 0;\n sptr = cptr - s0;\n __l: for (i1 = 0; i1 < n1; ++i1) {\n a = data[sptr];\n b = scratch[dptr];\n if (a < b) {\n break __g;\n }\n if (a > b) {\n break __l;\n }\n sptr += e1;\n dptr += f1;\n }\n dptr = cptr;\n sptr = cptr - s0;\n for (i1 = 0; i1 < n1; ++i1) {\n data[dptr] = data[sptr];\n dptr += d1;\n sptr += d1;\n }\n cptr -= s0;\n }\n dptr = cptr;\n sptr = 0;\n for (i1 = 0; i1 < n1; ++i1) {\n data[dptr] = scratch[sptr++];\n dptr += d1;\n }\n }\n free(scratch);\n };\n }\n };\n function createInsertionSort(order, dtype) {\n var allocator = getMallocFree(dtype);\n var key = [dtype, order].join(\",\");\n var result = CACHED_insertionSort[key];\n if (allocator) {\n return result(allocator[0], allocator[1]);\n } else {\n return result();\n }\n }\n var CACHED_quickSort = {\n \"uint32,1,0\": function(insertionSort, malloc, free) {\n return function ndarrayQuickSort1d0uint32(left, right, data, offset, s0, s1, n0, n1, d1, e1, f1) {\n var sixth = (right - left + 1) / 6 | 0, index1 = left + sixth, index5 = right - sixth, index3 = left + right >> 1, index2 = index3 - sixth, index4 = index3 + sixth, el1 = index1, el2 = index2, el3 = index3, el4 = index4, el5 = index5, less = left + 1, great = right - 1, pivots_are_equal = true, tmp, tmp0, x, y, z, k, ptr0, ptr1, ptr2, comp_pivot1 = 0, comp_pivot2 = 0, comp = 0, i1, b_ptr0, b_ptr1, b_ptr2, b_ptr3, b_ptr4, b_ptr5, b_ptr6, b_ptr7, ptr3, ptr4, ptr5, ptr6, ptr7, pivot_ptr, ptr_shift, elementSize = n1, pivot1 = malloc(elementSize), pivot2 = malloc(elementSize);\n b_ptr0 = s0 * el1;\n b_ptr1 = s0 * el2;\n ptr_shift = offset;\n __l1: for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n comp = data[ptr0] - data[ptr1];\n if (comp > 0) {\n tmp0 = el1;\n el1 = el2;\n el2 = tmp0;\n break __l1;\n }\n if (comp < 0) {\n break __l1;\n }\n ptr_shift += e1;\n }\n b_ptr0 = s0 * el4;\n b_ptr1 = s0 * el5;\n ptr_shift = offset;\n __l2: for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n comp = data[ptr0] - data[ptr1];\n if (comp > 0) {\n tmp0 = el4;\n el4 = el5;\n el5 = tmp0;\n break __l2;\n }\n if (comp < 0) {\n break __l2;\n }\n ptr_shift += e1;\n }\n b_ptr0 = s0 * el1;\n b_ptr1 = s0 * el3;\n ptr_shift = offset;\n __l3: for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n comp = data[ptr0] - data[ptr1];\n if (comp > 0) {\n tmp0 = el1;\n el1 = el3;\n el3 = tmp0;\n break __l3;\n }\n if (comp < 0) {\n break __l3;\n }\n ptr_shift += e1;\n }\n b_ptr0 = s0 * el2;\n b_ptr1 = s0 * el3;\n ptr_shift = offset;\n __l4: for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n comp = data[ptr0] - data[ptr1];\n if (comp > 0) {\n tmp0 = el2;\n el2 = el3;\n el3 = tmp0;\n break __l4;\n }\n if (comp < 0) {\n break __l4;\n }\n ptr_shift += e1;\n }\n b_ptr0 = s0 * el1;\n b_ptr1 = s0 * el4;\n ptr_shift = offset;\n __l5: for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n comp = data[ptr0] - data[ptr1];\n if (comp > 0) {\n tmp0 = el1;\n el1 = el4;\n el4 = tmp0;\n break __l5;\n }\n if (comp < 0) {\n break __l5;\n }\n ptr_shift += e1;\n }\n b_ptr0 = s0 * el3;\n b_ptr1 = s0 * el4;\n ptr_shift = offset;\n __l6: for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n comp = data[ptr0] - data[ptr1];\n if (comp > 0) {\n tmp0 = el3;\n el3 = el4;\n el4 = tmp0;\n break __l6;\n }\n if (comp < 0) {\n break __l6;\n }\n ptr_shift += e1;\n }\n b_ptr0 = s0 * el2;\n b_ptr1 = s0 * el5;\n ptr_shift = offset;\n __l7: for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n comp = data[ptr0] - data[ptr1];\n if (comp > 0) {\n tmp0 = el2;\n el2 = el5;\n el5 = tmp0;\n break __l7;\n }\n if (comp < 0) {\n break __l7;\n }\n ptr_shift += e1;\n }\n b_ptr0 = s0 * el2;\n b_ptr1 = s0 * el3;\n ptr_shift = offset;\n __l8: for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n comp = data[ptr0] - data[ptr1];\n if (comp > 0) {\n tmp0 = el2;\n el2 = el3;\n el3 = tmp0;\n break __l8;\n }\n if (comp < 0) {\n break __l8;\n }\n ptr_shift += e1;\n }\n b_ptr0 = s0 * el4;\n b_ptr1 = s0 * el5;\n ptr_shift = offset;\n __l9: for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n comp = data[ptr0] - data[ptr1];\n if (comp > 0) {\n tmp0 = el4;\n el4 = el5;\n el5 = tmp0;\n break __l9;\n }\n if (comp < 0) {\n break __l9;\n }\n ptr_shift += e1;\n }\n b_ptr0 = s0 * el1;\n b_ptr1 = s0 * el2;\n b_ptr2 = s0 * el3;\n b_ptr3 = s0 * el4;\n b_ptr4 = s0 * el5;\n b_ptr5 = s0 * index1;\n b_ptr6 = s0 * index3;\n b_ptr7 = s0 * index5;\n pivot_ptr = 0;\n ptr_shift = offset;\n for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n ptr2 = b_ptr2 + ptr_shift;\n ptr3 = b_ptr3 + ptr_shift;\n ptr4 = b_ptr4 + ptr_shift;\n ptr5 = b_ptr5 + ptr_shift;\n ptr6 = b_ptr6 + ptr_shift;\n ptr7 = b_ptr7 + ptr_shift;\n pivot1[pivot_ptr] = data[ptr1];\n pivot2[pivot_ptr] = data[ptr3];\n pivots_are_equal = pivots_are_equal && pivot1[pivot_ptr] === pivot2[pivot_ptr];\n x = data[ptr0];\n y = data[ptr2];\n z = data[ptr4];\n data[ptr5] = x;\n data[ptr6] = y;\n data[ptr7] = z;\n ++pivot_ptr;\n ptr_shift += d1;\n }\n b_ptr0 = s0 * index2;\n b_ptr1 = s0 * left;\n ptr_shift = offset;\n for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n data[ptr0] = data[ptr1];\n ptr_shift += d1;\n }\n b_ptr0 = s0 * index4;\n b_ptr1 = s0 * right;\n ptr_shift = offset;\n for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n data[ptr0] = data[ptr1];\n ptr_shift += d1;\n }\n if (pivots_are_equal) {\n for (k = less; k <= great; ++k) {\n ptr0 = offset + k * s0;\n pivot_ptr = 0;\n __l10: for (i1 = 0; i1 < n1; ++i1) {\n comp = data[ptr0] - pivot1[pivot_ptr];\n if (comp !== 0) {\n break __l10;\n }\n pivot_ptr += f1;\n ptr0 += e1;\n }\n if (comp === 0) {\n continue;\n }\n if (comp < 0) {\n if (k !== less) {\n b_ptr0 = s0 * k;\n b_ptr1 = s0 * less;\n ptr_shift = offset;\n for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n tmp = data[ptr0];\n data[ptr0] = data[ptr1];\n data[ptr1] = tmp;\n ptr_shift += d1;\n }\n }\n ++less;\n } else {\n while (true) {\n ptr0 = offset + great * s0;\n pivot_ptr = 0;\n __l11: for (i1 = 0; i1 < n1; ++i1) {\n comp = data[ptr0] - pivot1[pivot_ptr];\n if (comp !== 0) {\n break __l11;\n }\n pivot_ptr += f1;\n ptr0 += e1;\n }\n if (comp > 0) {\n great--;\n } else if (comp < 0) {\n b_ptr0 = s0 * k;\n b_ptr1 = s0 * less;\n b_ptr2 = s0 * great;\n ptr_shift = offset;\n for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n ptr2 = b_ptr2 + ptr_shift;\n tmp = data[ptr0];\n data[ptr0] = data[ptr1];\n data[ptr1] = data[ptr2];\n data[ptr2] = tmp;\n ptr_shift += d1;\n }\n ++less;\n --great;\n break;\n } else {\n b_ptr0 = s0 * k;\n b_ptr1 = s0 * great;\n ptr_shift = offset;\n for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n tmp = data[ptr0];\n data[ptr0] = data[ptr1];\n data[ptr1] = tmp;\n ptr_shift += d1;\n }\n --great;\n break;\n }\n }\n }\n }\n } else {\n for (k = less; k <= great; ++k) {\n ptr0 = offset + k * s0;\n pivot_ptr = 0;\n __l12: for (i1 = 0; i1 < n1; ++i1) {\n comp_pivot1 = data[ptr0] - pivot1[pivot_ptr];\n if (comp_pivot1 !== 0) {\n break __l12;\n }\n pivot_ptr += f1;\n ptr0 += e1;\n }\n if (comp_pivot1 < 0) {\n if (k !== less) {\n b_ptr0 = s0 * k;\n b_ptr1 = s0 * less;\n ptr_shift = offset;\n for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n tmp = data[ptr0];\n data[ptr0] = data[ptr1];\n data[ptr1] = tmp;\n ptr_shift += d1;\n }\n }\n ++less;\n } else {\n ptr0 = offset + k * s0;\n pivot_ptr = 0;\n __l13: for (i1 = 0; i1 < n1; ++i1) {\n comp_pivot2 = data[ptr0] - pivot2[pivot_ptr];\n if (comp_pivot2 !== 0) {\n break __l13;\n }\n pivot_ptr += f1;\n ptr0 += e1;\n }\n if (comp_pivot2 > 0) {\n while (true) {\n ptr0 = offset + great * s0;\n pivot_ptr = 0;\n __l14: for (i1 = 0; i1 < n1; ++i1) {\n comp = data[ptr0] - pivot2[pivot_ptr];\n if (comp !== 0) {\n break __l14;\n }\n pivot_ptr += f1;\n ptr0 += e1;\n }\n if (comp > 0) {\n if (--great < k) {\n break;\n }\n continue;\n } else {\n ptr0 = offset + great * s0;\n pivot_ptr = 0;\n __l15: for (i1 = 0; i1 < n1; ++i1) {\n comp = data[ptr0] - pivot1[pivot_ptr];\n if (comp !== 0) {\n break __l15;\n }\n pivot_ptr += f1;\n ptr0 += e1;\n }\n if (comp < 0) {\n b_ptr0 = s0 * k;\n b_ptr1 = s0 * less;\n b_ptr2 = s0 * great;\n ptr_shift = offset;\n for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n ptr2 = b_ptr2 + ptr_shift;\n tmp = data[ptr0];\n data[ptr0] = data[ptr1];\n data[ptr1] = data[ptr2];\n data[ptr2] = tmp;\n ptr_shift += d1;\n }\n ++less;\n --great;\n } else {\n b_ptr0 = s0 * k;\n b_ptr1 = s0 * great;\n ptr_shift = offset;\n for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n tmp = data[ptr0];\n data[ptr0] = data[ptr1];\n data[ptr1] = tmp;\n ptr_shift += d1;\n }\n --great;\n }\n break;\n }\n }\n }\n }\n }\n }\n b_ptr0 = s0 * left;\n b_ptr1 = s0 * (less - 1);\n pivot_ptr = 0;\n ptr_shift = offset;\n for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n data[ptr0] = data[ptr1];\n data[ptr1] = pivot1[pivot_ptr];\n ++pivot_ptr;\n ptr_shift += d1;\n }\n b_ptr0 = s0 * right;\n b_ptr1 = s0 * (great + 1);\n pivot_ptr = 0;\n ptr_shift = offset;\n for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n data[ptr0] = data[ptr1];\n data[ptr1] = pivot2[pivot_ptr];\n ++pivot_ptr;\n ptr_shift += d1;\n }\n if (less - 2 - left <= 32) {\n insertionSort(left, less - 2, data, offset, s0, s1, n0, n1, d1, e1, f1);\n } else {\n ndarrayQuickSort1d0uint32(left, less - 2, data, offset, s0, s1, n0, n1, d1, e1, f1);\n }\n if (right - (great + 2) <= 32) {\n insertionSort(great + 2, right, data, offset, s0, s1, n0, n1, d1, e1, f1);\n } else {\n ndarrayQuickSort1d0uint32(great + 2, right, data, offset, s0, s1, n0, n1, d1, e1, f1);\n }\n if (pivots_are_equal) {\n free(pivot1);\n free(pivot2);\n return;\n }\n if (less < index1 && great > index5) {\n __l16: while (true) {\n ptr0 = offset + less * s0;\n pivot_ptr = 0;\n ptr_shift = offset;\n for (i1 = 0; i1 < n1; ++i1) {\n if (data[ptr0] !== pivot1[pivot_ptr]) {\n break __l16;\n }\n ++pivot_ptr;\n ptr0 += d1;\n }\n ++less;\n }\n __l17: while (true) {\n ptr0 = offset + great * s0;\n pivot_ptr = 0;\n ptr_shift = offset;\n for (i1 = 0; i1 < n1; ++i1) {\n if (data[ptr0] !== pivot2[pivot_ptr]) {\n break __l17;\n }\n ++pivot_ptr;\n ptr0 += d1;\n }\n --great;\n }\n for (k = less; k <= great; ++k) {\n ptr0 = offset + k * s0;\n pivot_ptr = 0;\n __l18: for (i1 = 0; i1 < n1; ++i1) {\n comp_pivot1 = data[ptr0] - pivot1[pivot_ptr];\n if (comp_pivot1 !== 0) {\n break __l18;\n }\n pivot_ptr += f1;\n ptr0 += e1;\n }\n if (comp_pivot1 === 0) {\n if (k !== less) {\n b_ptr0 = s0 * k;\n b_ptr1 = s0 * less;\n ptr_shift = offset;\n for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n tmp = data[ptr0];\n data[ptr0] = data[ptr1];\n data[ptr1] = tmp;\n ptr_shift += d1;\n }\n }\n ++less;\n } else {\n ptr0 = offset + k * s0;\n pivot_ptr = 0;\n __l19: for (i1 = 0; i1 < n1; ++i1) {\n comp_pivot2 = data[ptr0] - pivot2[pivot_ptr];\n if (comp_pivot2 !== 0) {\n break __l19;\n }\n pivot_ptr += f1;\n ptr0 += e1;\n }\n if (comp_pivot2 === 0) {\n while (true) {\n ptr0 = offset + great * s0;\n pivot_ptr = 0;\n __l20: for (i1 = 0; i1 < n1; ++i1) {\n comp = data[ptr0] - pivot2[pivot_ptr];\n if (comp !== 0) {\n break __l20;\n }\n pivot_ptr += f1;\n ptr0 += e1;\n }\n if (comp === 0) {\n if (--great < k) {\n break;\n }\n continue;\n } else {\n ptr0 = offset + great * s0;\n pivot_ptr = 0;\n __l21: for (i1 = 0; i1 < n1; ++i1) {\n comp = data[ptr0] - pivot1[pivot_ptr];\n if (comp !== 0) {\n break __l21;\n }\n pivot_ptr += f1;\n ptr0 += e1;\n }\n if (comp < 0) {\n b_ptr0 = s0 * k;\n b_ptr1 = s0 * less;\n b_ptr2 = s0 * great;\n ptr_shift = offset;\n for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n ptr2 = b_ptr2 + ptr_shift;\n tmp = data[ptr0];\n data[ptr0] = data[ptr1];\n data[ptr1] = data[ptr2];\n data[ptr2] = tmp;\n ptr_shift += d1;\n }\n ++less;\n --great;\n } else {\n b_ptr0 = s0 * k;\n b_ptr1 = s0 * great;\n ptr_shift = offset;\n for (i1 = 0; i1 < n1; ++i1) {\n ptr0 = b_ptr0 + ptr_shift;\n ptr1 = b_ptr1 + ptr_shift;\n tmp = data[ptr0];\n data[ptr0] = data[ptr1];\n data[ptr1] = tmp;\n ptr_shift += d1;\n }\n --great;\n }\n break;\n }\n }\n }\n }\n }\n }\n free(pivot1);\n free(pivot2);\n if (great - less <= 32) {\n insertionSort(less, great, data, offset, s0, s1, n0, n1, d1, e1, f1);\n } else {\n ndarrayQuickSort1d0uint32(less, great, data, offset, s0, s1, n0, n1, d1, e1, f1);\n }\n };\n }\n };\n function createQuickSort(order, dtype, insertionSort) {\n var allocator = getMallocFree(dtype);\n var key = [dtype, order].join(\",\");\n var result = CACHED_quickSort[key];\n if (order.length > 1 && allocator) {\n return result(insertionSort, allocator[0], allocator[1]);\n } else {\n return result(insertionSort);\n }\n }\n var CACHED_sort = {\n \"uint32,1,0\": function(insertionSort, quickSort) {\n return function(array) {\n var data = array.data, offset = array.offset | 0, shape = array.shape, stride = array.stride, s0 = stride[0] | 0, n0 = shape[0] | 0, s1 = stride[1] | 0, n1 = shape[1] | 0, d1 = s1, e1 = s1, f1 = 1;\n if (n0 <= 32) {\n insertionSort(0, n0 - 1, data, offset, s0, s1, n0, n1, d1, e1, f1);\n } else {\n quickSort(0, n0 - 1, data, offset, s0, s1, n0, n1, d1, e1, f1);\n }\n };\n }\n };\n function compileSort(order, dtype) {\n var key = [dtype, order].join(\",\");\n var result = CACHED_sort[key];\n var insertionSort = createInsertionSort(order, dtype);\n var quickSort = createQuickSort(order, dtype, insertionSort);\n return result(insertionSort, quickSort);\n }\n module2.exports = compileSort;\n }\n ),\n /***/\n 446: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var compile = __webpack_require__2(7640);\n var CACHE = {};\n function sort(array) {\n var order = array.order;\n var dtype = array.dtype;\n var typeSig = [order, dtype];\n var typeName = typeSig.join(\":\");\n var compiled = CACHE[typeName];\n if (!compiled) {\n CACHE[typeName] = compiled = compile(order, dtype);\n }\n compiled(array);\n return array;\n }\n module2.exports = sort;\n }\n ),\n /***/\n 9618: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n var isBuffer = __webpack_require__2(7163);\n var hasTypedArrays = typeof Float64Array !== \"undefined\";\n function compare1st(a, b) {\n return a[0] - b[0];\n }\n function order() {\n var stride = this.stride;\n var terms = new Array(stride.length);\n var i;\n for (i = 0; i < terms.length; ++i) {\n terms[i] = [Math.abs(stride[i]), i];\n }\n terms.sort(compare1st);\n var result = new Array(terms.length);\n for (i = 0; i < result.length; ++i) {\n result[i] = terms[i][1];\n }\n return result;\n }\n var allFns = {\n // Special case for trivial arrays\n T: function(dtype) {\n function View(a) {\n this.data = a;\n }\n var proto = View.prototype;\n proto.dtype = dtype;\n proto.index = function() {\n return -1;\n };\n proto.size = 0;\n proto.dimension = -1;\n proto.shape = proto.stride = proto.order = [];\n proto.lo = proto.hi = proto.transpose = proto.step = function() {\n return new View(this.data);\n };\n proto.get = proto.set = function() {\n };\n proto.pick = function() {\n return null;\n };\n return function construct(a) {\n return new View(a);\n };\n },\n // Special case for 0d arrays\n 0: function(dtype, TrivialArray) {\n function View(a, d) {\n this.data = a;\n this.offset = d;\n }\n var proto = View.prototype;\n proto.dtype = dtype;\n proto.index = function() {\n return this.offset;\n };\n proto.dimension = 0;\n proto.size = 1;\n proto.shape = proto.stride = proto.order = [];\n proto.lo = proto.hi = proto.transpose = proto.step = function copy() {\n return new View(this.data, this.offset);\n };\n proto.pick = function pick() {\n return TrivialArray(this.data);\n };\n proto.valueOf = proto.get = function get() {\n return dtype === \"generic\" ? this.data.get(this.offset) : this.data[this.offset];\n };\n proto.set = function set(v) {\n return dtype === \"generic\" ? this.data.set(this.offset, v) : this.data[this.offset] = v;\n };\n return function construct(a, b, c, d) {\n return new View(a, d);\n };\n },\n 1: function(dtype, CTOR_LIST, ORDER) {\n function View(a, b0, c0, d) {\n this.data = a;\n this.shape = [b0];\n this.stride = [c0];\n this.offset = d | 0;\n }\n var proto = View.prototype;\n proto.dtype = dtype;\n proto.dimension = 1;\n Object.defineProperty(proto, \"size\", {\n get: function size() {\n return this.shape[0];\n }\n });\n proto.order = [0];\n proto.set = function set(i0, v) {\n return dtype === \"generic\" ? this.data.set(this.offset + this.stride[0] * i0, v) : this.data[this.offset + this.stride[0] * i0] = v;\n };\n proto.get = function get(i0) {\n return dtype === \"generic\" ? this.data.get(this.offset + this.stride[0] * i0) : this.data[this.offset + this.stride[0] * i0];\n };\n proto.index = function index(i0) {\n return this.offset + this.stride[0] * i0;\n };\n proto.hi = function hi(i0) {\n return new View(this.data, typeof i0 !== \"number\" || i0 < 0 ? this.shape[0] : i0 | 0, this.stride[0], this.offset);\n };\n proto.lo = function lo(i0) {\n var b = this.offset, d = 0, a0 = this.shape[0], c0 = this.stride[0];\n if (typeof i0 === \"number\" && i0 >= 0) {\n d = i0 | 0;\n b += c0 * d;\n a0 -= d;\n }\n return new View(this.data, a0, c0, b);\n };\n proto.step = function step(i0) {\n var a0 = this.shape[0], b0 = this.stride[0], c = this.offset, d = 0, ceil = Math.ceil;\n if (typeof i0 === \"number\") {\n d = i0 | 0;\n if (d < 0) {\n c += b0 * (a0 - 1);\n a0 = ceil(-a0 / d);\n } else {\n a0 = ceil(a0 / d);\n }\n b0 *= d;\n }\n return new View(this.data, a0, b0, c);\n };\n proto.transpose = function transpose(i0) {\n i0 = i0 === void 0 ? 0 : i0 | 0;\n var a = this.shape, b = this.stride;\n return new View(this.data, a[i0], b[i0], this.offset);\n };\n proto.pick = function pick(i0) {\n var a = [], b = [], c = this.offset;\n if (typeof i0 === \"number\" && i0 >= 0) {\n c = c + this.stride[0] * i0 | 0;\n } else {\n a.push(this.shape[0]);\n b.push(this.stride[0]);\n }\n var ctor = CTOR_LIST[a.length + 1];\n return ctor(this.data, a, b, c);\n };\n return function construct(data, shape, stride, offset) {\n return new View(data, shape[0], stride[0], offset);\n };\n },\n 2: function(dtype, CTOR_LIST, ORDER) {\n function View(a, b0, b1, c0, c1, d) {\n this.data = a;\n this.shape = [b0, b1];\n this.stride = [c0, c1];\n this.offset = d | 0;\n }\n var proto = View.prototype;\n proto.dtype = dtype;\n proto.dimension = 2;\n Object.defineProperty(proto, \"size\", {\n get: function size() {\n return this.shape[0] * this.shape[1];\n }\n });\n Object.defineProperty(proto, \"order\", {\n get: function order2() {\n return Math.abs(this.stride[0]) > Math.abs(this.stride[1]) ? [1, 0] : [0, 1];\n }\n });\n proto.set = function set(i0, i1, v) {\n return dtype === \"generic\" ? this.data.set(this.offset + this.stride[0] * i0 + this.stride[1] * i1, v) : this.data[this.offset + this.stride[0] * i0 + this.stride[1] * i1] = v;\n };\n proto.get = function get(i0, i1) {\n return dtype === \"generic\" ? this.data.get(this.offset + this.stride[0] * i0 + this.stride[1] * i1) : this.data[this.offset + this.stride[0] * i0 + this.stride[1] * i1];\n };\n proto.index = function index(i0, i1) {\n return this.offset + this.stride[0] * i0 + this.stride[1] * i1;\n };\n proto.hi = function hi(i0, i1) {\n return new View(\n this.data,\n typeof i0 !== \"number\" || i0 < 0 ? this.shape[0] : i0 | 0,\n typeof i1 !== \"number\" || i1 < 0 ? this.shape[1] : i1 | 0,\n this.stride[0],\n this.stride[1],\n this.offset\n );\n };\n proto.lo = function lo(i0, i1) {\n var b = this.offset, d = 0, a0 = this.shape[0], a1 = this.shape[1], c0 = this.stride[0], c1 = this.stride[1];\n if (typeof i0 === \"number\" && i0 >= 0) {\n d = i0 | 0;\n b += c0 * d;\n a0 -= d;\n }\n if (typeof i1 === \"number\" && i1 >= 0) {\n d = i1 | 0;\n b += c1 * d;\n a1 -= d;\n }\n return new View(this.data, a0, a1, c0, c1, b);\n };\n proto.step = function step(i0, i1) {\n var a0 = this.shape[0], a1 = this.shape[1], b0 = this.stride[0], b1 = this.stride[1], c = this.offset, d = 0, ceil = Math.ceil;\n if (typeof i0 === \"number\") {\n d = i0 | 0;\n if (d < 0) {\n c += b0 * (a0 - 1);\n a0 = ceil(-a0 / d);\n } else {\n a0 = ceil(a0 / d);\n }\n b0 *= d;\n }\n if (typeof i1 === \"number\") {\n d = i1 | 0;\n if (d < 0) {\n c += b1 * (a1 - 1);\n a1 = ceil(-a1 / d);\n } else {\n a1 = ceil(a1 / d);\n }\n b1 *= d;\n }\n return new View(this.data, a0, a1, b0, b1, c);\n };\n proto.transpose = function transpose(i0, i1) {\n i0 = i0 === void 0 ? 0 : i0 | 0;\n i1 = i1 === void 0 ? 1 : i1 | 0;\n var a = this.shape, b = this.stride;\n return new View(this.data, a[i0], a[i1], b[i0], b[i1], this.offset);\n };\n proto.pick = function pick(i0, i1) {\n var a = [], b = [], c = this.offset;\n if (typeof i0 === \"number\" && i0 >= 0) {\n c = c + this.stride[0] * i0 | 0;\n } else {\n a.push(this.shape[0]);\n b.push(this.stride[0]);\n }\n if (typeof i1 === \"number\" && i1 >= 0) {\n c = c + this.stride[1] * i1 | 0;\n } else {\n a.push(this.shape[1]);\n b.push(this.stride[1]);\n }\n var ctor = CTOR_LIST[a.length + 1];\n return ctor(this.data, a, b, c);\n };\n return function construct(data, shape, stride, offset) {\n return new View(data, shape[0], shape[1], stride[0], stride[1], offset);\n };\n },\n 3: function(dtype, CTOR_LIST, ORDER) {\n function View(a, b0, b1, b2, c0, c1, c2, d) {\n this.data = a;\n this.shape = [b0, b1, b2];\n this.stride = [c0, c1, c2];\n this.offset = d | 0;\n }\n var proto = View.prototype;\n proto.dtype = dtype;\n proto.dimension = 3;\n Object.defineProperty(proto, \"size\", {\n get: function size() {\n return this.shape[0] * this.shape[1] * this.shape[2];\n }\n });\n Object.defineProperty(proto, \"order\", {\n get: function order2() {\n var s0 = Math.abs(this.stride[0]), s1 = Math.abs(this.stride[1]), s2 = Math.abs(this.stride[2]);\n if (s0 > s1) {\n if (s1 > s2) {\n return [2, 1, 0];\n } else if (s0 > s2) {\n return [1, 2, 0];\n } else {\n return [1, 0, 2];\n }\n } else if (s0 > s2) {\n return [2, 0, 1];\n } else if (s2 > s1) {\n return [0, 1, 2];\n } else {\n return [0, 2, 1];\n }\n }\n });\n proto.set = function set(i0, i1, i2, v) {\n return dtype === \"generic\" ? this.data.set(this.offset + this.stride[0] * i0 + this.stride[1] * i1 + this.stride[2] * i2, v) : this.data[this.offset + this.stride[0] * i0 + this.stride[1] * i1 + this.stride[2] * i2] = v;\n };\n proto.get = function get(i0, i1, i2) {\n return dtype === \"generic\" ? this.data.get(this.offset + this.stride[0] * i0 + this.stride[1] * i1 + this.stride[2] * i2) : this.data[this.offset + this.stride[0] * i0 + this.stride[1] * i1 + this.stride[2] * i2];\n };\n proto.index = function index(i0, i1, i2) {\n return this.offset + this.stride[0] * i0 + this.stride[1] * i1 + this.stride[2] * i2;\n };\n proto.hi = function hi(i0, i1, i2) {\n return new View(\n this.data,\n typeof i0 !== \"number\" || i0 < 0 ? this.shape[0] : i0 | 0,\n typeof i1 !== \"number\" || i1 < 0 ? this.shape[1] : i1 | 0,\n typeof i2 !== \"number\" || i2 < 0 ? this.shape[2] : i2 | 0,\n this.stride[0],\n this.stride[1],\n this.stride[2],\n this.offset\n );\n };\n proto.lo = function lo(i0, i1, i2) {\n var b = this.offset, d = 0, a0 = this.shape[0], a1 = this.shape[1], a2 = this.shape[2], c0 = this.stride[0], c1 = this.stride[1], c2 = this.stride[2];\n if (typeof i0 === \"number\" && i0 >= 0) {\n d = i0 | 0;\n b += c0 * d;\n a0 -= d;\n }\n if (typeof i1 === \"number\" && i1 >= 0) {\n d = i1 | 0;\n b += c1 * d;\n a1 -= d;\n }\n if (typeof i2 === \"number\" && i2 >= 0) {\n d = i2 | 0;\n b += c2 * d;\n a2 -= d;\n }\n return new View(this.data, a0, a1, a2, c0, c1, c2, b);\n };\n proto.step = function step(i0, i1, i2) {\n var a0 = this.shape[0], a1 = this.shape[1], a2 = this.shape[2], b0 = this.stride[0], b1 = this.stride[1], b2 = this.stride[2], c = this.offset, d = 0, ceil = Math.ceil;\n if (typeof i0 === \"number\") {\n d = i0 | 0;\n if (d < 0) {\n c += b0 * (a0 - 1);\n a0 = ceil(-a0 / d);\n } else {\n a0 = ceil(a0 / d);\n }\n b0 *= d;\n }\n if (typeof i1 === \"number\") {\n d = i1 | 0;\n if (d < 0) {\n c += b1 * (a1 - 1);\n a1 = ceil(-a1 / d);\n } else {\n a1 = ceil(a1 / d);\n }\n b1 *= d;\n }\n if (typeof i2 === \"number\") {\n d = i2 | 0;\n if (d < 0) {\n c += b2 * (a2 - 1);\n a2 = ceil(-a2 / d);\n } else {\n a2 = ceil(a2 / d);\n }\n b2 *= d;\n }\n return new View(this.data, a0, a1, a2, b0, b1, b2, c);\n };\n proto.transpose = function transpose(i0, i1, i2) {\n i0 = i0 === void 0 ? 0 : i0 | 0;\n i1 = i1 === void 0 ? 1 : i1 | 0;\n i2 = i2 === void 0 ? 2 : i2 | 0;\n var a = this.shape, b = this.stride;\n return new View(this.data, a[i0], a[i1], a[i2], b[i0], b[i1], b[i2], this.offset);\n };\n proto.pick = function pick(i0, i1, i2) {\n var a = [], b = [], c = this.offset;\n if (typeof i0 === \"number\" && i0 >= 0) {\n c = c + this.stride[0] * i0 | 0;\n } else {\n a.push(this.shape[0]);\n b.push(this.stride[0]);\n }\n if (typeof i1 === \"number\" && i1 >= 0) {\n c = c + this.stride[1] * i1 | 0;\n } else {\n a.push(this.shape[1]);\n b.push(this.stride[1]);\n }\n if (typeof i2 === \"number\" && i2 >= 0) {\n c = c + this.stride[2] * i2 | 0;\n } else {\n a.push(this.shape[2]);\n b.push(this.stride[2]);\n }\n var ctor = CTOR_LIST[a.length + 1];\n return ctor(this.data, a, b, c);\n };\n return function construct(data, shape, stride, offset) {\n return new View(data, shape[0], shape[1], shape[2], stride[0], stride[1], stride[2], offset);\n };\n },\n 4: function(dtype, CTOR_LIST, ORDER) {\n function View(a, b0, b1, b2, b3, c0, c1, c2, c3, d) {\n this.data = a;\n this.shape = [b0, b1, b2, b3];\n this.stride = [c0, c1, c2, c3];\n this.offset = d | 0;\n }\n var proto = View.prototype;\n proto.dtype = dtype;\n proto.dimension = 4;\n Object.defineProperty(proto, \"size\", {\n get: function size() {\n return this.shape[0] * this.shape[1] * this.shape[2] * this.shape[3];\n }\n });\n Object.defineProperty(proto, \"order\", { get: ORDER });\n proto.set = function set(i0, i1, i2, i3, v) {\n return dtype === \"generic\" ? this.data.set(this.offset + this.stride[0] * i0 + this.stride[1] * i1 + this.stride[2] * i2 + this.stride[3] * i3, v) : this.data[this.offset + this.stride[0] * i0 + this.stride[1] * i1 + this.stride[2] * i2 + this.stride[3] * i3] = v;\n };\n proto.get = function get(i0, i1, i2, i3) {\n return dtype === \"generic\" ? this.data.get(this.offset + this.stride[0] * i0 + this.stride[1] * i1 + this.stride[2] * i2 + this.stride[3] * i3) : this.data[this.offset + this.stride[0] * i0 + this.stride[1] * i1 + this.stride[2] * i2 + this.stride[3] * i3];\n };\n proto.index = function index(i0, i1, i2, i3) {\n return this.offset + this.stride[0] * i0 + this.stride[1] * i1 + this.stride[2] * i2 + this.stride[3] * i3;\n };\n proto.hi = function hi(i0, i1, i2, i3) {\n return new View(\n this.data,\n typeof i0 !== \"number\" || i0 < 0 ? this.shape[0] : i0 | 0,\n typeof i1 !== \"number\" || i1 < 0 ? this.shape[1] : i1 | 0,\n typeof i2 !== \"number\" || i2 < 0 ? this.shape[2] : i2 | 0,\n typeof i3 !== \"number\" || i3 < 0 ? this.shape[3] : i3 | 0,\n this.stride[0],\n this.stride[1],\n this.stride[2],\n this.stride[3],\n this.offset\n );\n };\n proto.lo = function lo(i0, i1, i2, i3) {\n var b = this.offset, d = 0, a0 = this.shape[0], a1 = this.shape[1], a2 = this.shape[2], a3 = this.shape[3], c0 = this.stride[0], c1 = this.stride[1], c2 = this.stride[2], c3 = this.stride[3];\n if (typeof i0 === \"number\" && i0 >= 0) {\n d = i0 | 0;\n b += c0 * d;\n a0 -= d;\n }\n if (typeof i1 === \"number\" && i1 >= 0) {\n d = i1 | 0;\n b += c1 * d;\n a1 -= d;\n }\n if (typeof i2 === \"number\" && i2 >= 0) {\n d = i2 | 0;\n b += c2 * d;\n a2 -= d;\n }\n if (typeof i3 === \"number\" && i3 >= 0) {\n d = i3 | 0;\n b += c3 * d;\n a3 -= d;\n }\n return new View(this.data, a0, a1, a2, a3, c0, c1, c2, c3, b);\n };\n proto.step = function step(i0, i1, i2, i3) {\n var a0 = this.shape[0], a1 = this.shape[1], a2 = this.shape[2], a3 = this.shape[3], b0 = this.stride[0], b1 = this.stride[1], b2 = this.stride[2], b3 = this.stride[3], c = this.offset, d = 0, ceil = Math.ceil;\n if (typeof i0 === \"number\") {\n d = i0 | 0;\n if (d < 0) {\n c += b0 * (a0 - 1);\n a0 = ceil(-a0 / d);\n } else {\n a0 = ceil(a0 / d);\n }\n b0 *= d;\n }\n if (typeof i1 === \"number\") {\n d = i1 | 0;\n if (d < 0) {\n c += b1 * (a1 - 1);\n a1 = ceil(-a1 / d);\n } else {\n a1 = ceil(a1 / d);\n }\n b1 *= d;\n }\n if (typeof i2 === \"number\") {\n d = i2 | 0;\n if (d < 0) {\n c += b2 * (a2 - 1);\n a2 = ceil(-a2 / d);\n } else {\n a2 = ceil(a2 / d);\n }\n b2 *= d;\n }\n if (typeof i3 === \"number\") {\n d = i3 | 0;\n if (d < 0) {\n c += b3 * (a3 - 1);\n a3 = ceil(-a3 / d);\n } else {\n a3 = ceil(a3 / d);\n }\n b3 *= d;\n }\n return new View(this.data, a0, a1, a2, a3, b0, b1, b2, b3, c);\n };\n proto.transpose = function transpose(i0, i1, i2, i3) {\n i0 = i0 === void 0 ? 0 : i0 | 0;\n i1 = i1 === void 0 ? 1 : i1 | 0;\n i2 = i2 === void 0 ? 2 : i2 | 0;\n i3 = i3 === void 0 ? 3 : i3 | 0;\n var a = this.shape, b = this.stride;\n return new View(this.data, a[i0], a[i1], a[i2], a[i3], b[i0], b[i1], b[i2], b[i3], this.offset);\n };\n proto.pick = function pick(i0, i1, i2, i3) {\n var a = [], b = [], c = this.offset;\n if (typeof i0 === \"number\" && i0 >= 0) {\n c = c + this.stride[0] * i0 | 0;\n } else {\n a.push(this.shape[0]);\n b.push(this.stride[0]);\n }\n if (typeof i1 === \"number\" && i1 >= 0) {\n c = c + this.stride[1] * i1 | 0;\n } else {\n a.push(this.shape[1]);\n b.push(this.stride[1]);\n }\n if (typeof i2 === \"number\" && i2 >= 0) {\n c = c + this.stride[2] * i2 | 0;\n } else {\n a.push(this.shape[2]);\n b.push(this.stride[2]);\n }\n if (typeof i3 === \"number\" && i3 >= 0) {\n c = c + this.stride[3] * i3 | 0;\n } else {\n a.push(this.shape[3]);\n b.push(this.stride[3]);\n }\n var ctor = CTOR_LIST[a.length + 1];\n return ctor(this.data, a, b, c);\n };\n return function construct(data, shape, stride, offset) {\n return new View(data, shape[0], shape[1], shape[2], shape[3], stride[0], stride[1], stride[2], stride[3], offset);\n };\n },\n 5: function anonymous(dtype, CTOR_LIST, ORDER) {\n function View(a, b0, b1, b2, b3, b4, c0, c1, c2, c3, c4, d) {\n this.data = a;\n this.shape = [b0, b1, b2, b3, b4];\n this.stride = [c0, c1, c2, c3, c4];\n this.offset = d | 0;\n }\n var proto = View.prototype;\n proto.dtype = dtype;\n proto.dimension = 5;\n Object.defineProperty(proto, \"size\", {\n get: function size() {\n return this.shape[0] * this.shape[1] * this.shape[2] * this.shape[3] * this.shape[4];\n }\n });\n Object.defineProperty(proto, \"order\", { get: ORDER });\n proto.set = function set(i0, i1, i2, i3, i4, v) {\n return dtype === \"generic\" ? this.data.set(\n this.offset + this.stride[0] * i0 + this.stride[1] * i1 + this.stride[2] * i2 + this.stride[3] * i3 + this.stride[4] * i4,\n v\n ) : this.data[this.offset + this.stride[0] * i0 + this.stride[1] * i1 + this.stride[2] * i2 + this.stride[3] * i3 + this.stride[4] * i4] = v;\n };\n proto.get = function get(i0, i1, i2, i3, i4) {\n return dtype === \"generic\" ? this.data.get(\n this.offset + this.stride[0] * i0 + this.stride[1] * i1 + this.stride[2] * i2 + this.stride[3] * i3 + this.stride[4] * i4\n ) : this.data[this.offset + this.stride[0] * i0 + this.stride[1] * i1 + this.stride[2] * i2 + this.stride[3] * i3 + this.stride[4] * i4];\n };\n proto.index = function index(i0, i1, i2, i3, i4) {\n return this.offset + this.stride[0] * i0 + this.stride[1] * i1 + this.stride[2] * i2 + this.stride[3] * i3 + this.stride[4] * i4;\n };\n proto.hi = function hi(i0, i1, i2, i3, i4) {\n return new View(\n this.data,\n typeof i0 !== \"number\" || i0 < 0 ? this.shape[0] : i0 | 0,\n typeof i1 !== \"number\" || i1 < 0 ? this.shape[1] : i1 | 0,\n typeof i2 !== \"number\" || i2 < 0 ? this.shape[2] : i2 | 0,\n typeof i3 !== \"number\" || i3 < 0 ? this.shape[3] : i3 | 0,\n typeof i4 !== \"number\" || i4 < 0 ? this.shape[4] : i4 | 0,\n this.stride[0],\n this.stride[1],\n this.stride[2],\n this.stride[3],\n this.stride[4],\n this.offset\n );\n };\n proto.lo = function lo(i0, i1, i2, i3, i4) {\n var b = this.offset, d = 0, a0 = this.shape[0], a1 = this.shape[1], a2 = this.shape[2], a3 = this.shape[3], a4 = this.shape[4], c0 = this.stride[0], c1 = this.stride[1], c2 = this.stride[2], c3 = this.stride[3], c4 = this.stride[4];\n if (typeof i0 === \"number\" && i0 >= 0) {\n d = i0 | 0;\n b += c0 * d;\n a0 -= d;\n }\n if (typeof i1 === \"number\" && i1 >= 0) {\n d = i1 | 0;\n b += c1 * d;\n a1 -= d;\n }\n if (typeof i2 === \"number\" && i2 >= 0) {\n d = i2 | 0;\n b += c2 * d;\n a2 -= d;\n }\n if (typeof i3 === \"number\" && i3 >= 0) {\n d = i3 | 0;\n b += c3 * d;\n a3 -= d;\n }\n if (typeof i4 === \"number\" && i4 >= 0) {\n d = i4 | 0;\n b += c4 * d;\n a4 -= d;\n }\n return new View(this.data, a0, a1, a2, a3, a4, c0, c1, c2, c3, c4, b);\n };\n proto.step = function step(i0, i1, i2, i3, i4) {\n var a0 = this.shape[0], a1 = this.shape[1], a2 = this.shape[2], a3 = this.shape[3], a4 = this.shape[4], b0 = this.stride[0], b1 = this.stride[1], b2 = this.stride[2], b3 = this.stride[3], b4 = this.stride[4], c = this.offset, d = 0, ceil = Math.ceil;\n if (typeof i0 === \"number\") {\n d = i0 | 0;\n if (d < 0) {\n c += b0 * (a0 - 1);\n a0 = ceil(-a0 / d);\n } else {\n a0 = ceil(a0 / d);\n }\n b0 *= d;\n }\n if (typeof i1 === \"number\") {\n d = i1 | 0;\n if (d < 0) {\n c += b1 * (a1 - 1);\n a1 = ceil(-a1 / d);\n } else {\n a1 = ceil(a1 / d);\n }\n b1 *= d;\n }\n if (typeof i2 === \"number\") {\n d = i2 | 0;\n if (d < 0) {\n c += b2 * (a2 - 1);\n a2 = ceil(-a2 / d);\n } else {\n a2 = ceil(a2 / d);\n }\n b2 *= d;\n }\n if (typeof i3 === \"number\") {\n d = i3 | 0;\n if (d < 0) {\n c += b3 * (a3 - 1);\n a3 = ceil(-a3 / d);\n } else {\n a3 = ceil(a3 / d);\n }\n b3 *= d;\n }\n if (typeof i4 === \"number\") {\n d = i4 | 0;\n if (d < 0) {\n c += b4 * (a4 - 1);\n a4 = ceil(-a4 / d);\n } else {\n a4 = ceil(a4 / d);\n }\n b4 *= d;\n }\n return new View(this.data, a0, a1, a2, a3, a4, b0, b1, b2, b3, b4, c);\n };\n proto.transpose = function transpose(i0, i1, i2, i3, i4) {\n i0 = i0 === void 0 ? 0 : i0 | 0;\n i1 = i1 === void 0 ? 1 : i1 | 0;\n i2 = i2 === void 0 ? 2 : i2 | 0;\n i3 = i3 === void 0 ? 3 : i3 | 0;\n i4 = i4 === void 0 ? 4 : i4 | 0;\n var a = this.shape, b = this.stride;\n return new View(this.data, a[i0], a[i1], a[i2], a[i3], a[i4], b[i0], b[i1], b[i2], b[i3], b[i4], this.offset);\n };\n proto.pick = function pick(i0, i1, i2, i3, i4) {\n var a = [], b = [], c = this.offset;\n if (typeof i0 === \"number\" && i0 >= 0) {\n c = c + this.stride[0] * i0 | 0;\n } else {\n a.push(this.shape[0]);\n b.push(this.stride[0]);\n }\n if (typeof i1 === \"number\" && i1 >= 0) {\n c = c + this.stride[1] * i1 | 0;\n } else {\n a.push(this.shape[1]);\n b.push(this.stride[1]);\n }\n if (typeof i2 === \"number\" && i2 >= 0) {\n c = c + this.stride[2] * i2 | 0;\n } else {\n a.push(this.shape[2]);\n b.push(this.stride[2]);\n }\n if (typeof i3 === \"number\" && i3 >= 0) {\n c = c + this.stride[3] * i3 | 0;\n } else {\n a.push(this.shape[3]);\n b.push(this.stride[3]);\n }\n if (typeof i4 === \"number\" && i4 >= 0) {\n c = c + this.stride[4] * i4 | 0;\n } else {\n a.push(this.shape[4]);\n b.push(this.stride[4]);\n }\n var ctor = CTOR_LIST[a.length + 1];\n return ctor(this.data, a, b, c);\n };\n return function construct(data, shape, stride, offset) {\n return new View(\n data,\n shape[0],\n shape[1],\n shape[2],\n shape[3],\n shape[4],\n stride[0],\n stride[1],\n stride[2],\n stride[3],\n stride[4],\n offset\n );\n };\n }\n };\n function compileConstructor(inType, inDimension) {\n var dKey = inDimension === -1 ? \"T\" : String(inDimension);\n var procedure = allFns[dKey];\n if (inDimension === -1) {\n return procedure(inType);\n } else if (inDimension === 0) {\n return procedure(inType, CACHED_CONSTRUCTORS[inType][0]);\n }\n return procedure(inType, CACHED_CONSTRUCTORS[inType], order);\n }\n function arrayDType(data) {\n if (isBuffer(data)) {\n return \"buffer\";\n }\n if (hasTypedArrays) {\n switch (Object.prototype.toString.call(data)) {\n case \"[object Float64Array]\":\n return \"float64\";\n case \"[object Float32Array]\":\n return \"float32\";\n case \"[object Int8Array]\":\n return \"int8\";\n case \"[object Int16Array]\":\n return \"int16\";\n case \"[object Int32Array]\":\n return \"int32\";\n case \"[object Uint8ClampedArray]\":\n return \"uint8_clamped\";\n case \"[object Uint8Array]\":\n return \"uint8\";\n case \"[object Uint16Array]\":\n return \"uint16\";\n case \"[object Uint32Array]\":\n return \"uint32\";\n case \"[object BigInt64Array]\":\n return \"bigint64\";\n case \"[object BigUint64Array]\":\n return \"biguint64\";\n }\n }\n if (Array.isArray(data)) {\n return \"array\";\n }\n return \"generic\";\n }\n var CACHED_CONSTRUCTORS = {\n \"generic\": [],\n \"buffer\": [],\n \"array\": [],\n // typed arrays\n \"float32\": [],\n \"float64\": [],\n \"int8\": [],\n \"int16\": [],\n \"int32\": [],\n \"uint8_clamped\": [],\n \"uint8\": [],\n \"uint16\": [],\n \"uint32\": [],\n \"bigint64\": [],\n \"biguint64\": []\n };\n (function() {\n for (var id in CACHED_CONSTRUCTORS) {\n CACHED_CONSTRUCTORS[id].push(compileConstructor(id, -1));\n }\n });\n function wrappedNDArrayCtor(data, shape, stride, offset) {\n if (data === void 0) {\n var ctor = CACHED_CONSTRUCTORS.array[0];\n return ctor([]);\n } else if (typeof data === \"number\") {\n data = [data];\n }\n if (shape === void 0) {\n shape = [data.length];\n }\n var d = shape.length;\n if (stride === void 0) {\n stride = new Array(d);\n for (var i = d - 1, sz = 1; i >= 0; --i) {\n stride[i] = sz;\n sz *= shape[i];\n }\n }\n if (offset === void 0) {\n offset = 0;\n for (var i = 0; i < d; ++i) {\n if (stride[i] < 0) {\n offset -= (shape[i] - 1) * stride[i];\n }\n }\n }\n var inType = arrayDType(data);\n var ctor_list = CACHED_CONSTRUCTORS[inType];\n while (ctor_list.length <= d + 1) {\n ctor_list.push(compileConstructor(inType, ctor_list.length - 1));\n }\n var ctor = ctor_list[d + 1];\n return ctor(data, shape, stride, offset);\n }\n module2.exports = wrappedNDArrayCtor;\n }\n ),\n /***/\n 1278: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var doubleBits = __webpack_require__2(2361);\n var SMALLEST_DENORM = Math.pow(2, -1074);\n var UINT_MAX = -1 >>> 0;\n module2.exports = nextafter;\n function nextafter(x, y) {\n if (isNaN(x) || isNaN(y)) {\n return NaN;\n }\n if (x === y) {\n return x;\n }\n if (x === 0) {\n if (y < 0) {\n return -SMALLEST_DENORM;\n } else {\n return SMALLEST_DENORM;\n }\n }\n var hi = doubleBits.hi(x);\n var lo = doubleBits.lo(x);\n if (y > x === x > 0) {\n if (lo === UINT_MAX) {\n hi += 1;\n lo = 0;\n } else {\n lo += 1;\n }\n } else {\n if (lo === 0) {\n lo = UINT_MAX;\n hi -= 1;\n } else {\n lo -= 1;\n }\n }\n return doubleBits.pack(lo, hi);\n }\n }\n ),\n /***/\n 8406: (\n /***/\n function(__unused_webpack_module, exports2) {\n var DEFAULT_NORMALS_EPSILON = 1e-6;\n var DEFAULT_FACE_EPSILON = 1e-6;\n exports2.vertexNormals = function(faces, positions, specifiedEpsilon) {\n var N = positions.length;\n var normals = new Array(N);\n var epsilon = specifiedEpsilon === void 0 ? DEFAULT_NORMALS_EPSILON : specifiedEpsilon;\n for (var i = 0; i < N; ++i) {\n normals[i] = [0, 0, 0];\n }\n for (var i = 0; i < faces.length; ++i) {\n var f = faces[i];\n var p = 0;\n var c = f[f.length - 1];\n var n = f[0];\n for (var j = 0; j < f.length; ++j) {\n p = c;\n c = n;\n n = f[(j + 1) % f.length];\n var v0 = positions[p];\n var v1 = positions[c];\n var v2 = positions[n];\n var d01 = new Array(3);\n var m01 = 0;\n var d21 = new Array(3);\n var m21 = 0;\n for (var k = 0; k < 3; ++k) {\n d01[k] = v0[k] - v1[k];\n m01 += d01[k] * d01[k];\n d21[k] = v2[k] - v1[k];\n m21 += d21[k] * d21[k];\n }\n if (m01 * m21 > epsilon) {\n var norm = normals[c];\n var w = 1 / Math.sqrt(m01 * m21);\n for (var k = 0; k < 3; ++k) {\n var u = (k + 1) % 3;\n var v = (k + 2) % 3;\n norm[k] += w * (d21[u] * d01[v] - d21[v] * d01[u]);\n }\n }\n }\n }\n for (var i = 0; i < N; ++i) {\n var norm = normals[i];\n var m = 0;\n for (var k = 0; k < 3; ++k) {\n m += norm[k] * norm[k];\n }\n if (m > epsilon) {\n var w = 1 / Math.sqrt(m);\n for (var k = 0; k < 3; ++k) {\n norm[k] *= w;\n }\n } else {\n for (var k = 0; k < 3; ++k) {\n norm[k] = 0;\n }\n }\n }\n return normals;\n };\n exports2.faceNormals = function(faces, positions, specifiedEpsilon) {\n var N = faces.length;\n var normals = new Array(N);\n var epsilon = specifiedEpsilon === void 0 ? DEFAULT_FACE_EPSILON : specifiedEpsilon;\n for (var i = 0; i < N; ++i) {\n var f = faces[i];\n var pos = new Array(3);\n for (var j = 0; j < 3; ++j) {\n pos[j] = positions[f[j]];\n }\n var d01 = new Array(3);\n var d21 = new Array(3);\n for (var j = 0; j < 3; ++j) {\n d01[j] = pos[1][j] - pos[0][j];\n d21[j] = pos[2][j] - pos[0][j];\n }\n var n = new Array(3);\n var l = 0;\n for (var j = 0; j < 3; ++j) {\n var u = (j + 1) % 3;\n var v = (j + 2) % 3;\n n[j] = d01[u] * d21[v] - d01[v] * d21[u];\n l += n[j] * n[j];\n }\n if (l > epsilon) {\n l = 1 / Math.sqrt(l);\n } else {\n l = 0;\n }\n for (var j = 0; j < 3; ++j) {\n n[j] *= l;\n }\n normals[i] = n;\n }\n return normals;\n };\n }\n ),\n /***/\n 4081: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = quatFromFrame;\n function quatFromFrame(out, rx, ry, rz, ux, uy, uz, fx, fy, fz) {\n var tr = rx + uy + fz;\n if (l > 0) {\n var l = Math.sqrt(tr + 1);\n out[0] = 0.5 * (uz - fy) / l;\n out[1] = 0.5 * (fx - rz) / l;\n out[2] = 0.5 * (ry - uy) / l;\n out[3] = 0.5 * l;\n } else {\n var tf = Math.max(rx, uy, fz);\n var l = Math.sqrt(2 * tf - tr + 1);\n if (rx >= tf) {\n out[0] = 0.5 * l;\n out[1] = 0.5 * (ux + ry) / l;\n out[2] = 0.5 * (fx + rz) / l;\n out[3] = 0.5 * (uz - fy) / l;\n } else if (uy >= tf) {\n out[0] = 0.5 * (ry + ux) / l;\n out[1] = 0.5 * l;\n out[2] = 0.5 * (fy + uz) / l;\n out[3] = 0.5 * (fx - rz) / l;\n } else {\n out[0] = 0.5 * (rz + fx) / l;\n out[1] = 0.5 * (uz + fy) / l;\n out[2] = 0.5 * l;\n out[3] = 0.5 * (ry - ux) / l;\n }\n }\n return out;\n }\n }\n ),\n /***/\n 9977: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = createOrbitController;\n var filterVector = __webpack_require__2(9215);\n var lookAt = __webpack_require__2(6582);\n var mat4FromQuat = __webpack_require__2(7399);\n var invert44 = __webpack_require__2(7608);\n var quatFromFrame = __webpack_require__2(4081);\n function len3(x, y, z) {\n return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2));\n }\n function len4(w, x, y, z) {\n return Math.sqrt(Math.pow(w, 2) + Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2));\n }\n function normalize4(out, a) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n var aw = a[3];\n var al = len4(ax, ay, az, aw);\n if (al > 1e-6) {\n out[0] = ax / al;\n out[1] = ay / al;\n out[2] = az / al;\n out[3] = aw / al;\n } else {\n out[0] = out[1] = out[2] = 0;\n out[3] = 1;\n }\n }\n function OrbitCameraController(initQuat, initCenter, initRadius) {\n this.radius = filterVector([initRadius]);\n this.center = filterVector(initCenter);\n this.rotation = filterVector(initQuat);\n this.computedRadius = this.radius.curve(0);\n this.computedCenter = this.center.curve(0);\n this.computedRotation = this.rotation.curve(0);\n this.computedUp = [0.1, 0, 0];\n this.computedEye = [0.1, 0, 0];\n this.computedMatrix = [0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n this.recalcMatrix(0);\n }\n var proto = OrbitCameraController.prototype;\n proto.lastT = function() {\n return Math.max(\n this.radius.lastT(),\n this.center.lastT(),\n this.rotation.lastT()\n );\n };\n proto.recalcMatrix = function(t) {\n this.radius.curve(t);\n this.center.curve(t);\n this.rotation.curve(t);\n var quat = this.computedRotation;\n normalize4(quat, quat);\n var mat = this.computedMatrix;\n mat4FromQuat(mat, quat);\n var center = this.computedCenter;\n var eye = this.computedEye;\n var up = this.computedUp;\n var radius = Math.exp(this.computedRadius[0]);\n eye[0] = center[0] + radius * mat[2];\n eye[1] = center[1] + radius * mat[6];\n eye[2] = center[2] + radius * mat[10];\n up[0] = mat[1];\n up[1] = mat[5];\n up[2] = mat[9];\n for (var i = 0; i < 3; ++i) {\n var rr = 0;\n for (var j = 0; j < 3; ++j) {\n rr += mat[i + 4 * j] * eye[j];\n }\n mat[12 + i] = -rr;\n }\n };\n proto.getMatrix = function(t, result) {\n this.recalcMatrix(t);\n var m = this.computedMatrix;\n if (result) {\n for (var i = 0; i < 16; ++i) {\n result[i] = m[i];\n }\n return result;\n }\n return m;\n };\n proto.idle = function(t) {\n this.center.idle(t);\n this.radius.idle(t);\n this.rotation.idle(t);\n };\n proto.flush = function(t) {\n this.center.flush(t);\n this.radius.flush(t);\n this.rotation.flush(t);\n };\n proto.pan = function(t, dx, dy, dz) {\n dx = dx || 0;\n dy = dy || 0;\n dz = dz || 0;\n this.recalcMatrix(t);\n var mat = this.computedMatrix;\n var ux = mat[1];\n var uy = mat[5];\n var uz = mat[9];\n var ul = len3(ux, uy, uz);\n ux /= ul;\n uy /= ul;\n uz /= ul;\n var rx = mat[0];\n var ry = mat[4];\n var rz = mat[8];\n var ru = rx * ux + ry * uy + rz * uz;\n rx -= ux * ru;\n ry -= uy * ru;\n rz -= uz * ru;\n var rl = len3(rx, ry, rz);\n rx /= rl;\n ry /= rl;\n rz /= rl;\n var fx = mat[2];\n var fy = mat[6];\n var fz = mat[10];\n var fu = fx * ux + fy * uy + fz * uz;\n var fr = fx * rx + fy * ry + fz * rz;\n fx -= fu * ux + fr * rx;\n fy -= fu * uy + fr * ry;\n fz -= fu * uz + fr * rz;\n var fl = len3(fx, fy, fz);\n fx /= fl;\n fy /= fl;\n fz /= fl;\n var vx = rx * dx + ux * dy;\n var vy = ry * dx + uy * dy;\n var vz = rz * dx + uz * dy;\n this.center.move(t, vx, vy, vz);\n var radius = Math.exp(this.computedRadius[0]);\n radius = Math.max(1e-4, radius + dz);\n this.radius.set(t, Math.log(radius));\n };\n proto.rotate = function(t, dx, dy, dz) {\n this.recalcMatrix(t);\n dx = dx || 0;\n dy = dy || 0;\n var mat = this.computedMatrix;\n var rx = mat[0];\n var ry = mat[4];\n var rz = mat[8];\n var ux = mat[1];\n var uy = mat[5];\n var uz = mat[9];\n var fx = mat[2];\n var fy = mat[6];\n var fz = mat[10];\n var qx = dx * rx + dy * ux;\n var qy = dx * ry + dy * uy;\n var qz = dx * rz + dy * uz;\n var bx = -(fy * qz - fz * qy);\n var by = -(fz * qx - fx * qz);\n var bz = -(fx * qy - fy * qx);\n var bw = Math.sqrt(Math.max(0, 1 - Math.pow(bx, 2) - Math.pow(by, 2) - Math.pow(bz, 2)));\n var bl = len4(bx, by, bz, bw);\n if (bl > 1e-6) {\n bx /= bl;\n by /= bl;\n bz /= bl;\n bw /= bl;\n } else {\n bx = by = bz = 0;\n bw = 1;\n }\n var rotation = this.computedRotation;\n var ax = rotation[0];\n var ay = rotation[1];\n var az = rotation[2];\n var aw = rotation[3];\n var cx = ax * bw + aw * bx + ay * bz - az * by;\n var cy = ay * bw + aw * by + az * bx - ax * bz;\n var cz = az * bw + aw * bz + ax * by - ay * bx;\n var cw = aw * bw - ax * bx - ay * by - az * bz;\n if (dz) {\n bx = fx;\n by = fy;\n bz = fz;\n var s = Math.sin(dz) / len3(bx, by, bz);\n bx *= s;\n by *= s;\n bz *= s;\n bw = Math.cos(dx);\n cx = cx * bw + cw * bx + cy * bz - cz * by;\n cy = cy * bw + cw * by + cz * bx - cx * bz;\n cz = cz * bw + cw * bz + cx * by - cy * bx;\n cw = cw * bw - cx * bx - cy * by - cz * bz;\n }\n var cl = len4(cx, cy, cz, cw);\n if (cl > 1e-6) {\n cx /= cl;\n cy /= cl;\n cz /= cl;\n cw /= cl;\n } else {\n cx = cy = cz = 0;\n cw = 1;\n }\n this.rotation.set(t, cx, cy, cz, cw);\n };\n proto.lookAt = function(t, eye, center, up) {\n this.recalcMatrix(t);\n center = center || this.computedCenter;\n eye = eye || this.computedEye;\n up = up || this.computedUp;\n var mat = this.computedMatrix;\n lookAt(mat, eye, center, up);\n var rotation = this.computedRotation;\n quatFromFrame(\n rotation,\n mat[0],\n mat[1],\n mat[2],\n mat[4],\n mat[5],\n mat[6],\n mat[8],\n mat[9],\n mat[10]\n );\n normalize4(rotation, rotation);\n this.rotation.set(t, rotation[0], rotation[1], rotation[2], rotation[3]);\n var fl = 0;\n for (var i = 0; i < 3; ++i) {\n fl += Math.pow(center[i] - eye[i], 2);\n }\n this.radius.set(t, 0.5 * Math.log(Math.max(fl, 1e-6)));\n this.center.set(t, center[0], center[1], center[2]);\n };\n proto.translate = function(t, dx, dy, dz) {\n this.center.move(\n t,\n dx || 0,\n dy || 0,\n dz || 0\n );\n };\n proto.setMatrix = function(t, matrix) {\n var rotation = this.computedRotation;\n quatFromFrame(\n rotation,\n matrix[0],\n matrix[1],\n matrix[2],\n matrix[4],\n matrix[5],\n matrix[6],\n matrix[8],\n matrix[9],\n matrix[10]\n );\n normalize4(rotation, rotation);\n this.rotation.set(t, rotation[0], rotation[1], rotation[2], rotation[3]);\n var mat = this.computedMatrix;\n invert44(mat, matrix);\n var w = mat[15];\n if (Math.abs(w) > 1e-6) {\n var cx = mat[12] / w;\n var cy = mat[13] / w;\n var cz = mat[14] / w;\n this.recalcMatrix(t);\n var r = Math.exp(this.computedRadius[0]);\n this.center.set(t, cx - mat[2] * r, cy - mat[6] * r, cz - mat[10] * r);\n this.radius.idle(t);\n } else {\n this.center.idle(t);\n this.radius.idle(t);\n }\n };\n proto.setDistance = function(t, d) {\n if (d > 0) {\n this.radius.set(t, Math.log(d));\n }\n };\n proto.setDistanceLimits = function(lo, hi) {\n if (lo > 0) {\n lo = Math.log(lo);\n } else {\n lo = -Infinity;\n }\n if (hi > 0) {\n hi = Math.log(hi);\n } else {\n hi = Infinity;\n }\n hi = Math.max(hi, lo);\n this.radius.bounds[0][0] = lo;\n this.radius.bounds[1][0] = hi;\n };\n proto.getDistanceLimits = function(out) {\n var bounds = this.radius.bounds;\n if (out) {\n out[0] = Math.exp(bounds[0][0]);\n out[1] = Math.exp(bounds[1][0]);\n return out;\n }\n return [Math.exp(bounds[0][0]), Math.exp(bounds[1][0])];\n };\n proto.toJSON = function() {\n this.recalcMatrix(this.lastT());\n return {\n center: this.computedCenter.slice(),\n rotation: this.computedRotation.slice(),\n distance: Math.log(this.computedRadius[0]),\n zoomMin: this.radius.bounds[0][0],\n zoomMax: this.radius.bounds[1][0]\n };\n };\n proto.fromJSON = function(options) {\n var t = this.lastT();\n var c = options.center;\n if (c) {\n this.center.set(t, c[0], c[1], c[2]);\n }\n var r = options.rotation;\n if (r) {\n this.rotation.set(t, r[0], r[1], r[2], r[3]);\n }\n var d = options.distance;\n if (d && d > 0) {\n this.radius.set(t, Math.log(d));\n }\n this.setDistanceLimits(options.zoomMin, options.zoomMax);\n };\n function createOrbitController(options) {\n options = options || {};\n var center = options.center || [0, 0, 0];\n var rotation = options.rotation || [0, 0, 0, 1];\n var radius = options.radius || 1;\n center = [].slice.call(center, 0, 3);\n rotation = [].slice.call(rotation, 0, 4);\n normalize4(rotation, rotation);\n var result = new OrbitCameraController(\n rotation,\n center,\n Math.log(radius)\n );\n result.setDistanceLimits(options.zoomMin, options.zoomMax);\n if (\"eye\" in options || \"up\" in options) {\n result.lookAt(0, options.eye, options.center, options.up);\n }\n return result;\n }\n }\n ),\n /***/\n 1371: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var repeat = __webpack_require__2(3233);\n module2.exports = function padLeft(str, num, ch) {\n ch = typeof ch !== \"undefined\" ? ch + \"\" : \" \";\n return repeat(ch, num) + str;\n };\n }\n ),\n /***/\n 3202: (\n /***/\n function(module2) {\n module2.exports = function parseUnit(str, out) {\n if (!out)\n out = [0, \"\"];\n str = String(str);\n var num = parseFloat(str, 10);\n out[0] = num;\n out[1] = str.match(/[\\d.\\-\\+]*\\s*(.*)/)[1] || \"\";\n return out;\n };\n }\n ),\n /***/\n 3088: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = planarDual;\n var compareAngle = __webpack_require__2(3140);\n function planarDual(cells, positions) {\n var numVertices = positions.length | 0;\n var numEdges = cells.length;\n var adj = [new Array(numVertices), new Array(numVertices)];\n for (var i = 0; i < numVertices; ++i) {\n adj[0][i] = [];\n adj[1][i] = [];\n }\n for (var i = 0; i < numEdges; ++i) {\n var c = cells[i];\n adj[0][c[0]].push(c);\n adj[1][c[1]].push(c);\n }\n var cycles = [];\n for (var i = 0; i < numVertices; ++i) {\n if (adj[0][i].length + adj[1][i].length === 0) {\n cycles.push([i]);\n }\n }\n function cut(c2, i2) {\n var a = adj[i2][c2[i2]];\n a.splice(a.indexOf(c2), 1);\n }\n function next(a, b, noCut) {\n var nextCell, nextVertex, nextDir;\n for (var i2 = 0; i2 < 2; ++i2) {\n if (adj[i2][b].length > 0) {\n nextCell = adj[i2][b][0];\n nextDir = i2;\n break;\n }\n }\n nextVertex = nextCell[nextDir ^ 1];\n for (var dir = 0; dir < 2; ++dir) {\n var nbhd = adj[dir][b];\n for (var k = 0; k < nbhd.length; ++k) {\n var e = nbhd[k];\n var p = e[dir ^ 1];\n var cmp = compareAngle(\n positions[a],\n positions[b],\n positions[nextVertex],\n positions[p]\n );\n if (cmp > 0) {\n nextCell = e;\n nextVertex = p;\n nextDir = dir;\n }\n }\n }\n if (noCut) {\n return nextVertex;\n }\n if (nextCell) {\n cut(nextCell, nextDir);\n }\n return nextVertex;\n }\n function extractCycle(v, dir) {\n var e0 = adj[dir][v][0];\n var cycle = [v];\n cut(e0, dir);\n var u = e0[dir ^ 1];\n var d0 = dir;\n while (true) {\n while (u !== v) {\n cycle.push(u);\n u = next(cycle[cycle.length - 2], u, false);\n }\n if (adj[0][v].length + adj[1][v].length === 0) {\n break;\n }\n var a = cycle[cycle.length - 1];\n var b = v;\n var c2 = cycle[1];\n var d = next(a, b, true);\n if (compareAngle(positions[a], positions[b], positions[c2], positions[d]) < 0) {\n break;\n }\n cycle.push(v);\n u = next(a, b);\n }\n return cycle;\n }\n function shouldGlue(pcycle2, ncycle2) {\n return ncycle2[1] === ncycle2[ncycle2.length - 1];\n }\n for (var i = 0; i < numVertices; ++i) {\n for (var j = 0; j < 2; ++j) {\n var pcycle = [];\n while (adj[j][i].length > 0) {\n var ni = adj[0][i].length;\n var ncycle = extractCycle(i, j);\n if (shouldGlue(pcycle, ncycle)) {\n pcycle.push.apply(pcycle, ncycle);\n } else {\n if (pcycle.length > 0) {\n cycles.push(pcycle);\n }\n pcycle = ncycle;\n }\n }\n if (pcycle.length > 0) {\n cycles.push(pcycle);\n }\n }\n }\n return cycles;\n }\n }\n ),\n /***/\n 5609: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = trimLeaves;\n var e2a = __webpack_require__2(3134);\n function trimLeaves(edges, positions) {\n var adj = e2a(edges, positions.length);\n var live = new Array(positions.length);\n var nbhd = new Array(positions.length);\n var dead = [];\n for (var i = 0; i < positions.length; ++i) {\n var count = adj[i].length;\n nbhd[i] = count;\n live[i] = true;\n if (count <= 1) {\n dead.push(i);\n }\n }\n while (dead.length > 0) {\n var v = dead.pop();\n live[v] = false;\n var n = adj[v];\n for (var i = 0; i < n.length; ++i) {\n var u = n[i];\n if (--nbhd[u] === 0) {\n dead.push(u);\n }\n }\n }\n var newIndex = new Array(positions.length);\n var npositions = [];\n for (var i = 0; i < positions.length; ++i) {\n if (live[i]) {\n var v = npositions.length;\n newIndex[i] = v;\n npositions.push(positions[i]);\n } else {\n newIndex[i] = -1;\n }\n }\n var nedges = [];\n for (var i = 0; i < edges.length; ++i) {\n var e = edges[i];\n if (live[e[0]] && live[e[1]]) {\n nedges.push([newIndex[e[0]], newIndex[e[1]]]);\n }\n }\n return [nedges, npositions];\n }\n }\n ),\n /***/\n 2095: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = planarGraphToPolyline;\n var e2a = __webpack_require__2(3134);\n var planarDual = __webpack_require__2(3088);\n var preprocessPolygon = __webpack_require__2(5085);\n var twoProduct = __webpack_require__2(5250);\n var robustSum = __webpack_require__2(8210);\n var uniq = __webpack_require__2(1682);\n var trimLeaves = __webpack_require__2(5609);\n function makeArray(length, fill) {\n var result = new Array(length);\n for (var i = 0; i < length; ++i) {\n result[i] = fill;\n }\n return result;\n }\n function makeArrayOfArrays(length) {\n var result = new Array(length);\n for (var i = 0; i < length; ++i) {\n result[i] = [];\n }\n return result;\n }\n function planarGraphToPolyline(edges, positions) {\n var result = trimLeaves(edges, positions);\n edges = result[0];\n positions = result[1];\n var numVertices = positions.length;\n var numEdges = edges.length;\n var adj = e2a(edges, positions.length);\n for (var i = 0; i < numVertices; ++i) {\n if (adj[i].length % 2 === 1) {\n throw new Error(\"planar-graph-to-polyline: graph must be manifold\");\n }\n }\n var faces = planarDual(edges, positions);\n function ccw(c2) {\n var n2 = c2.length;\n var area = [0];\n for (var j2 = 0; j2 < n2; ++j2) {\n var a2 = positions[c2[j2]];\n var b2 = positions[c2[(j2 + 1) % n2]];\n var t00 = twoProduct(-a2[0], a2[1]);\n var t01 = twoProduct(-a2[0], b2[1]);\n var t10 = twoProduct(b2[0], a2[1]);\n var t11 = twoProduct(b2[0], b2[1]);\n area = robustSum(area, robustSum(robustSum(t00, t01), robustSum(t10, t11)));\n }\n return area[area.length - 1] > 0;\n }\n faces = faces.filter(ccw);\n var numFaces = faces.length;\n var parent = new Array(numFaces);\n var containment = new Array(numFaces);\n for (var i = 0; i < numFaces; ++i) {\n parent[i] = i;\n var row = new Array(numFaces);\n var loopVertices = faces[i].map(function(v) {\n return positions[v];\n });\n var pmc = preprocessPolygon([loopVertices]);\n var count = 0;\n outer:\n for (var j = 0; j < numFaces; ++j) {\n row[j] = 0;\n if (i === j) {\n continue;\n }\n var c = faces[j];\n var n = c.length;\n for (var k = 0; k < n; ++k) {\n var d = pmc(positions[c[k]]);\n if (d !== 0) {\n if (d < 0) {\n row[j] = 1;\n count += 1;\n }\n continue outer;\n }\n }\n row[j] = 1;\n count += 1;\n }\n containment[i] = [count, i, row];\n }\n containment.sort(function(a2, b2) {\n return b2[0] - a2[0];\n });\n for (var i = 0; i < numFaces; ++i) {\n var row = containment[i];\n var idx = row[1];\n var children = row[2];\n for (var j = 0; j < numFaces; ++j) {\n if (children[j]) {\n parent[j] = idx;\n }\n }\n }\n var fadj = makeArrayOfArrays(numFaces);\n for (var i = 0; i < numFaces; ++i) {\n fadj[i].push(parent[i]);\n fadj[parent[i]].push(i);\n }\n var edgeAdjacency = {};\n var internalVertices = makeArray(numVertices, false);\n for (var i = 0; i < numFaces; ++i) {\n var c = faces[i];\n var n = c.length;\n for (var j = 0; j < n; ++j) {\n var a = c[j];\n var b = c[(j + 1) % n];\n var key = Math.min(a, b) + \":\" + Math.max(a, b);\n if (key in edgeAdjacency) {\n var neighbor = edgeAdjacency[key];\n fadj[neighbor].push(i);\n fadj[i].push(neighbor);\n internalVertices[a] = internalVertices[b] = true;\n } else {\n edgeAdjacency[key] = i;\n }\n }\n }\n function sharedBoundary(c2) {\n var n2 = c2.length;\n for (var i2 = 0; i2 < n2; ++i2) {\n if (!internalVertices[c2[i2]]) {\n return false;\n }\n }\n return true;\n }\n var toVisit = [];\n var parity = makeArray(numFaces, -1);\n for (var i = 0; i < numFaces; ++i) {\n if (parent[i] === i && !sharedBoundary(faces[i])) {\n toVisit.push(i);\n parity[i] = 0;\n } else {\n parity[i] = -1;\n }\n }\n var result = [];\n while (toVisit.length > 0) {\n var top = toVisit.pop();\n var nbhd = fadj[top];\n uniq(nbhd, function(a2, b2) {\n return a2 - b2;\n });\n var nnbhr = nbhd.length;\n var p = parity[top];\n var polyline;\n if (p === 0) {\n var c = faces[top];\n polyline = [c];\n }\n for (var i = 0; i < nnbhr; ++i) {\n var f = nbhd[i];\n if (parity[f] >= 0) {\n continue;\n }\n parity[f] = p ^ 1;\n toVisit.push(f);\n if (p === 0) {\n var c = faces[f];\n if (!sharedBoundary(c)) {\n c.reverse();\n polyline.push(c);\n }\n }\n }\n if (p === 0) {\n result.push(polyline);\n }\n }\n return result;\n }\n }\n ),\n /***/\n 5085: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = preprocessPolygon;\n var orient = __webpack_require__2(3250)[3];\n var makeSlabs = __webpack_require__2(4209);\n var makeIntervalTree = __webpack_require__2(3352);\n var bsearch = __webpack_require__2(2478);\n function visitInterval() {\n return true;\n }\n function intervalSearch(table) {\n return function(x, y) {\n var tree = table[x];\n if (tree) {\n return !!tree.queryPoint(y, visitInterval);\n }\n return false;\n };\n }\n function buildVerticalIndex(segments) {\n var table = {};\n for (var i = 0; i < segments.length; ++i) {\n var s = segments[i];\n var x = s[0][0];\n var y0 = s[0][1];\n var y1 = s[1][1];\n var p = [Math.min(y0, y1), Math.max(y0, y1)];\n if (x in table) {\n table[x].push(p);\n } else {\n table[x] = [p];\n }\n }\n var intervalTable = {};\n var keys = Object.keys(table);\n for (var i = 0; i < keys.length; ++i) {\n var segs = table[keys[i]];\n intervalTable[keys[i]] = makeIntervalTree(segs);\n }\n return intervalSearch(intervalTable);\n }\n function buildSlabSearch(slabs, coordinates) {\n return function(p) {\n var bucket = bsearch.le(coordinates, p[0]);\n if (bucket < 0) {\n return 1;\n }\n var root = slabs[bucket];\n if (!root) {\n if (bucket > 0 && coordinates[bucket] === p[0]) {\n root = slabs[bucket - 1];\n } else {\n return 1;\n }\n }\n var lastOrientation = 1;\n while (root) {\n var s = root.key;\n var o = orient(p, s[0], s[1]);\n if (s[0][0] < s[1][0]) {\n if (o < 0) {\n root = root.left;\n } else if (o > 0) {\n lastOrientation = -1;\n root = root.right;\n } else {\n return 0;\n }\n } else {\n if (o > 0) {\n root = root.left;\n } else if (o < 0) {\n lastOrientation = 1;\n root = root.right;\n } else {\n return 0;\n }\n }\n }\n return lastOrientation;\n };\n }\n function classifyEmpty(p) {\n return 1;\n }\n function createClassifyVertical(testVertical) {\n return function classify(p) {\n if (testVertical(p[0], p[1])) {\n return 0;\n }\n return 1;\n };\n }\n function createClassifyPointDegen(testVertical, testNormal) {\n return function classify(p) {\n if (testVertical(p[0], p[1])) {\n return 0;\n }\n return testNormal(p);\n };\n }\n function preprocessPolygon(loops) {\n var numLoops = loops.length;\n var segments = [];\n var vsegments = [];\n var ptr = 0;\n for (var i = 0; i < numLoops; ++i) {\n var loop = loops[i];\n var numVertices = loop.length;\n for (var s = numVertices - 1, t = 0; t < numVertices; s = t++) {\n var a = loop[s];\n var b = loop[t];\n if (a[0] === b[0]) {\n vsegments.push([a, b]);\n } else {\n segments.push([a, b]);\n }\n }\n }\n if (segments.length === 0) {\n if (vsegments.length === 0) {\n return classifyEmpty;\n } else {\n return createClassifyVertical(buildVerticalIndex(vsegments));\n }\n }\n var slabs = makeSlabs(segments);\n var testSlab = buildSlabSearch(slabs.slabs, slabs.coordinates);\n if (vsegments.length === 0) {\n return testSlab;\n } else {\n return createClassifyPointDegen(\n buildVerticalIndex(vsegments),\n testSlab\n );\n }\n }\n }\n ),\n /***/\n 9346: (\n /***/\n function(module2) {\n \"use strict\";\n var diff = new Float64Array(4);\n var edge0 = new Float64Array(4);\n var edge1 = new Float64Array(4);\n function closestPoint2d(V0, V1, V2, point, result) {\n if (diff.length < point.length) {\n diff = new Float64Array(point.length);\n edge0 = new Float64Array(point.length);\n edge1 = new Float64Array(point.length);\n }\n for (var i = 0; i < point.length; ++i) {\n diff[i] = V0[i] - point[i];\n edge0[i] = V1[i] - V0[i];\n edge1[i] = V2[i] - V0[i];\n }\n var a00 = 0, a01 = 0, a11 = 0, b0 = 0, b1 = 0, c = 0;\n for (var i = 0; i < point.length; ++i) {\n var e0 = edge0[i], e1 = edge1[i], d = diff[i];\n a00 += e0 * e0;\n a01 += e0 * e1;\n a11 += e1 * e1;\n b0 += d * e0;\n b1 += d * e1;\n c += d * d;\n }\n var det = Math.abs(a00 * a11 - a01 * a01);\n var s = a01 * b1 - a11 * b0;\n var t = a01 * b0 - a00 * b1;\n var sqrDistance;\n if (s + t <= det) {\n if (s < 0) {\n if (t < 0) {\n if (b0 < 0) {\n t = 0;\n if (-b0 >= a00) {\n s = 1;\n sqrDistance = a00 + 2 * b0 + c;\n } else {\n s = -b0 / a00;\n sqrDistance = b0 * s + c;\n }\n } else {\n s = 0;\n if (b1 >= 0) {\n t = 0;\n sqrDistance = c;\n } else if (-b1 >= a11) {\n t = 1;\n sqrDistance = a11 + 2 * b1 + c;\n } else {\n t = -b1 / a11;\n sqrDistance = b1 * t + c;\n }\n }\n } else {\n s = 0;\n if (b1 >= 0) {\n t = 0;\n sqrDistance = c;\n } else if (-b1 >= a11) {\n t = 1;\n sqrDistance = a11 + 2 * b1 + c;\n } else {\n t = -b1 / a11;\n sqrDistance = b1 * t + c;\n }\n }\n } else if (t < 0) {\n t = 0;\n if (b0 >= 0) {\n s = 0;\n sqrDistance = c;\n } else if (-b0 >= a00) {\n s = 1;\n sqrDistance = a00 + 2 * b0 + c;\n } else {\n s = -b0 / a00;\n sqrDistance = b0 * s + c;\n }\n } else {\n var invDet = 1 / det;\n s *= invDet;\n t *= invDet;\n sqrDistance = s * (a00 * s + a01 * t + 2 * b0) + t * (a01 * s + a11 * t + 2 * b1) + c;\n }\n } else {\n var tmp0, tmp1, numer, denom;\n if (s < 0) {\n tmp0 = a01 + b0;\n tmp1 = a11 + b1;\n if (tmp1 > tmp0) {\n numer = tmp1 - tmp0;\n denom = a00 - 2 * a01 + a11;\n if (numer >= denom) {\n s = 1;\n t = 0;\n sqrDistance = a00 + 2 * b0 + c;\n } else {\n s = numer / denom;\n t = 1 - s;\n sqrDistance = s * (a00 * s + a01 * t + 2 * b0) + t * (a01 * s + a11 * t + 2 * b1) + c;\n }\n } else {\n s = 0;\n if (tmp1 <= 0) {\n t = 1;\n sqrDistance = a11 + 2 * b1 + c;\n } else if (b1 >= 0) {\n t = 0;\n sqrDistance = c;\n } else {\n t = -b1 / a11;\n sqrDistance = b1 * t + c;\n }\n }\n } else if (t < 0) {\n tmp0 = a01 + b1;\n tmp1 = a00 + b0;\n if (tmp1 > tmp0) {\n numer = tmp1 - tmp0;\n denom = a00 - 2 * a01 + a11;\n if (numer >= denom) {\n t = 1;\n s = 0;\n sqrDistance = a11 + 2 * b1 + c;\n } else {\n t = numer / denom;\n s = 1 - t;\n sqrDistance = s * (a00 * s + a01 * t + 2 * b0) + t * (a01 * s + a11 * t + 2 * b1) + c;\n }\n } else {\n t = 0;\n if (tmp1 <= 0) {\n s = 1;\n sqrDistance = a00 + 2 * b0 + c;\n } else if (b0 >= 0) {\n s = 0;\n sqrDistance = c;\n } else {\n s = -b0 / a00;\n sqrDistance = b0 * s + c;\n }\n }\n } else {\n numer = a11 + b1 - a01 - b0;\n if (numer <= 0) {\n s = 0;\n t = 1;\n sqrDistance = a11 + 2 * b1 + c;\n } else {\n denom = a00 - 2 * a01 + a11;\n if (numer >= denom) {\n s = 1;\n t = 0;\n sqrDistance = a00 + 2 * b0 + c;\n } else {\n s = numer / denom;\n t = 1 - s;\n sqrDistance = s * (a00 * s + a01 * t + 2 * b0) + t * (a01 * s + a11 * t + 2 * b1) + c;\n }\n }\n }\n }\n var u = 1 - s - t;\n for (var i = 0; i < point.length; ++i) {\n result[i] = u * V0[i] + s * V1[i] + t * V2[i];\n }\n if (sqrDistance < 0) {\n return 0;\n }\n return sqrDistance;\n }\n module2.exports = closestPoint2d;\n }\n ),\n /***/\n 8648: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = __webpack_require__2(783);\n }\n ),\n /***/\n 2653: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var bnadd = __webpack_require__2(3865);\n module2.exports = add;\n function add(a, b) {\n var n = a.length;\n var r = new Array(n);\n for (var i = 0; i < n; ++i) {\n r[i] = bnadd(a[i], b[i]);\n }\n return r;\n }\n }\n ),\n /***/\n 5838: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = float2rat;\n var rat = __webpack_require__2(7842);\n function float2rat(v) {\n var result = new Array(v.length);\n for (var i = 0; i < v.length; ++i) {\n result[i] = rat(v[i]);\n }\n return result;\n }\n }\n ),\n /***/\n 8987: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var rat = __webpack_require__2(7842);\n var mul = __webpack_require__2(6504);\n module2.exports = muls;\n function muls(a, x) {\n var s = rat(x);\n var n = a.length;\n var r = new Array(n);\n for (var i = 0; i < n; ++i) {\n r[i] = mul(a[i], s);\n }\n return r;\n }\n }\n ),\n /***/\n 544: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var bnsub = __webpack_require__2(5572);\n module2.exports = sub;\n function sub(a, b) {\n var n = a.length;\n var r = new Array(n);\n for (var i = 0; i < n; ++i) {\n r[i] = bnsub(a[i], b[i]);\n }\n return r;\n }\n }\n ),\n /***/\n 5771: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var compareCell = __webpack_require__2(8507);\n var compareOrientedCell = __webpack_require__2(3788);\n var orientation = __webpack_require__2(2419);\n module2.exports = reduceCellComplex;\n function reduceCellComplex(cells) {\n cells.sort(compareOrientedCell);\n var n = cells.length;\n var ptr = 0;\n for (var i = 0; i < n; ++i) {\n var c = cells[i];\n var o = orientation(c);\n if (o === 0) {\n continue;\n }\n if (ptr > 0) {\n var f = cells[ptr - 1];\n if (compareCell(c, f) === 0 && orientation(f) !== o) {\n ptr -= 1;\n continue;\n }\n }\n cells[ptr++] = c;\n }\n cells.length = ptr;\n return cells;\n }\n }\n ),\n /***/\n 3233: (\n /***/\n function(module2) {\n \"use strict\";\n var res = \"\";\n var cache;\n module2.exports = repeat;\n function repeat(str, num) {\n if (typeof str !== \"string\") {\n throw new TypeError(\"expected a string\");\n }\n if (num === 1) return str;\n if (num === 2) return str + str;\n var max = str.length * num;\n if (cache !== str || typeof cache === \"undefined\") {\n cache = str;\n res = \"\";\n } else if (res.length >= max) {\n return res.substr(0, max);\n }\n while (max > res.length && num > 1) {\n if (num & 1) {\n res += str;\n }\n num >>= 1;\n str += str;\n }\n res += str;\n res = res.substr(0, max);\n return res;\n }\n }\n ),\n /***/\n 3025: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = __webpack_require__2.g.performance && __webpack_require__2.g.performance.now ? function now() {\n return performance.now();\n } : Date.now || function now() {\n return +/* @__PURE__ */ new Date();\n };\n }\n ),\n /***/\n 7004: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = compressExpansion;\n function compressExpansion(e) {\n var m = e.length;\n var Q = e[e.length - 1];\n var bottom = m;\n for (var i = m - 2; i >= 0; --i) {\n var a = Q;\n var b = e[i];\n Q = a + b;\n var bv = Q - a;\n var q = b - bv;\n if (q) {\n e[--bottom] = Q;\n Q = q;\n }\n }\n var top = 0;\n for (var i = bottom; i < m; ++i) {\n var a = e[i];\n var b = Q;\n Q = a + b;\n var bv = Q - a;\n var q = b - bv;\n if (q) {\n e[top++] = q;\n }\n }\n e[top++] = Q;\n e.length = top;\n return e;\n }\n }\n ),\n /***/\n 2962: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var twoProduct = __webpack_require__2(5250);\n var robustSum = __webpack_require__2(8210);\n var robustScale = __webpack_require__2(3012);\n var compress = __webpack_require__2(7004);\n var NUM_EXPANDED = 6;\n function determinant_2(sum, scale, prod, compress2) {\n return function robustDeterminant2(m) {\n return compress2(sum(prod(m[0][0], m[1][1]), prod(-m[0][1], m[1][0])));\n };\n }\n function determinant_3(sum, scale, prod, compress2) {\n return function robustDeterminant3(m) {\n return compress2(sum(scale(sum(prod(m[1][1], m[2][2]), prod(-m[1][2], m[2][1])), m[0][0]), sum(scale(sum(prod(m[1][0], m[2][2]), prod(-m[1][2], m[2][0])), -m[0][1]), scale(sum(prod(m[1][0], m[2][1]), prod(-m[1][1], m[2][0])), m[0][2]))));\n };\n }\n function determinant_4(sum, scale, prod, compress2) {\n return function robustDeterminant4(m) {\n return compress2(sum(sum(scale(sum(scale(sum(prod(m[2][2], m[3][3]), prod(-m[2][3], m[3][2])), m[1][1]), sum(scale(sum(prod(m[2][1], m[3][3]), prod(-m[2][3], m[3][1])), -m[1][2]), scale(sum(prod(m[2][1], m[3][2]), prod(-m[2][2], m[3][1])), m[1][3]))), m[0][0]), scale(sum(scale(sum(prod(m[2][2], m[3][3]), prod(-m[2][3], m[3][2])), m[1][0]), sum(scale(sum(prod(m[2][0], m[3][3]), prod(-m[2][3], m[3][0])), -m[1][2]), scale(sum(prod(m[2][0], m[3][2]), prod(-m[2][2], m[3][0])), m[1][3]))), -m[0][1])), sum(scale(sum(scale(sum(prod(m[2][1], m[3][3]), prod(-m[2][3], m[3][1])), m[1][0]), sum(scale(sum(prod(m[2][0], m[3][3]), prod(-m[2][3], m[3][0])), -m[1][1]), scale(sum(prod(m[2][0], m[3][1]), prod(-m[2][1], m[3][0])), m[1][3]))), m[0][2]), scale(sum(scale(sum(prod(m[2][1], m[3][2]), prod(-m[2][2], m[3][1])), m[1][0]), sum(scale(sum(prod(m[2][0], m[3][2]), prod(-m[2][2], m[3][0])), -m[1][1]), scale(sum(prod(m[2][0], m[3][1]), prod(-m[2][1], m[3][0])), m[1][2]))), -m[0][3]))));\n };\n }\n function determinant_5(sum, scale, prod, compress2) {\n return function robustDeterminant5(m) {\n return compress2(sum(sum(scale(sum(sum(scale(sum(scale(sum(prod(m[3][3], m[4][4]), prod(-m[3][4], m[4][3])), m[2][2]), sum(scale(sum(prod(m[3][2], m[4][4]), prod(-m[3][4], m[4][2])), -m[2][3]), scale(sum(prod(m[3][2], m[4][3]), prod(-m[3][3], m[4][2])), m[2][4]))), m[1][1]), scale(sum(scale(sum(prod(m[3][3], m[4][4]), prod(-m[3][4], m[4][3])), m[2][1]), sum(scale(sum(prod(m[3][1], m[4][4]), prod(-m[3][4], m[4][1])), -m[2][3]), scale(sum(prod(m[3][1], m[4][3]), prod(-m[3][3], m[4][1])), m[2][4]))), -m[1][2])), sum(scale(sum(scale(sum(prod(m[3][2], m[4][4]), prod(-m[3][4], m[4][2])), m[2][1]), sum(scale(sum(prod(m[3][1], m[4][4]), prod(-m[3][4], m[4][1])), -m[2][2]), scale(sum(prod(m[3][1], m[4][2]), prod(-m[3][2], m[4][1])), m[2][4]))), m[1][3]), scale(sum(scale(sum(prod(m[3][2], m[4][3]), prod(-m[3][3], m[4][2])), m[2][1]), sum(scale(sum(prod(m[3][1], m[4][3]), prod(-m[3][3], m[4][1])), -m[2][2]), scale(sum(prod(m[3][1], m[4][2]), prod(-m[3][2], m[4][1])), m[2][3]))), -m[1][4]))), m[0][0]), scale(sum(sum(scale(sum(scale(sum(prod(m[3][3], m[4][4]), prod(-m[3][4], m[4][3])), m[2][2]), sum(scale(sum(prod(m[3][2], m[4][4]), prod(-m[3][4], m[4][2])), -m[2][3]), scale(sum(prod(m[3][2], m[4][3]), prod(-m[3][3], m[4][2])), m[2][4]))), m[1][0]), scale(sum(scale(sum(prod(m[3][3], m[4][4]), prod(-m[3][4], m[4][3])), m[2][0]), sum(scale(sum(prod(m[3][0], m[4][4]), prod(-m[3][4], m[4][0])), -m[2][3]), scale(sum(prod(m[3][0], m[4][3]), prod(-m[3][3], m[4][0])), m[2][4]))), -m[1][2])), sum(scale(sum(scale(sum(prod(m[3][2], m[4][4]), prod(-m[3][4], m[4][2])), m[2][0]), sum(scale(sum(prod(m[3][0], m[4][4]), prod(-m[3][4], m[4][0])), -m[2][2]), scale(sum(prod(m[3][0], m[4][2]), prod(-m[3][2], m[4][0])), m[2][4]))), m[1][3]), scale(sum(scale(sum(prod(m[3][2], m[4][3]), prod(-m[3][3], m[4][2])), m[2][0]), sum(scale(sum(prod(m[3][0], m[4][3]), prod(-m[3][3], m[4][0])), -m[2][2]), scale(sum(prod(m[3][0], m[4][2]), prod(-m[3][2], m[4][0])), m[2][3]))), -m[1][4]))), -m[0][1])), sum(scale(sum(sum(scale(sum(scale(sum(prod(m[3][3], m[4][4]), prod(-m[3][4], m[4][3])), m[2][1]), sum(scale(sum(prod(m[3][1], m[4][4]), prod(-m[3][4], m[4][1])), -m[2][3]), scale(sum(prod(m[3][1], m[4][3]), prod(-m[3][3], m[4][1])), m[2][4]))), m[1][0]), scale(sum(scale(sum(prod(m[3][3], m[4][4]), prod(-m[3][4], m[4][3])), m[2][0]), sum(scale(sum(prod(m[3][0], m[4][4]), prod(-m[3][4], m[4][0])), -m[2][3]), scale(sum(prod(m[3][0], m[4][3]), prod(-m[3][3], m[4][0])), m[2][4]))), -m[1][1])), sum(scale(sum(scale(sum(prod(m[3][1], m[4][4]), prod(-m[3][4], m[4][1])), m[2][0]), sum(scale(sum(prod(m[3][0], m[4][4]), prod(-m[3][4], m[4][0])), -m[2][1]), scale(sum(prod(m[3][0], m[4][1]), prod(-m[3][1], m[4][0])), m[2][4]))), m[1][3]), scale(sum(scale(sum(prod(m[3][1], m[4][3]), prod(-m[3][3], m[4][1])), m[2][0]), sum(scale(sum(prod(m[3][0], m[4][3]), prod(-m[3][3], m[4][0])), -m[2][1]), scale(sum(prod(m[3][0], m[4][1]), prod(-m[3][1], m[4][0])), m[2][3]))), -m[1][4]))), m[0][2]), sum(scale(sum(sum(scale(sum(scale(sum(prod(m[3][2], m[4][4]), prod(-m[3][4], m[4][2])), m[2][1]), sum(scale(sum(prod(m[3][1], m[4][4]), prod(-m[3][4], m[4][1])), -m[2][2]), scale(sum(prod(m[3][1], m[4][2]), prod(-m[3][2], m[4][1])), m[2][4]))), m[1][0]), scale(sum(scale(sum(prod(m[3][2], m[4][4]), prod(-m[3][4], m[4][2])), m[2][0]), sum(scale(sum(prod(m[3][0], m[4][4]), prod(-m[3][4], m[4][0])), -m[2][2]), scale(sum(prod(m[3][0], m[4][2]), prod(-m[3][2], m[4][0])), m[2][4]))), -m[1][1])), sum(scale(sum(scale(sum(prod(m[3][1], m[4][4]), prod(-m[3][4], m[4][1])), m[2][0]), sum(scale(sum(prod(m[3][0], m[4][4]), prod(-m[3][4], m[4][0])), -m[2][1]), scale(sum(prod(m[3][0], m[4][1]), prod(-m[3][1], m[4][0])), m[2][4]))), m[1][2]), scale(sum(scale(sum(prod(m[3][1], m[4][2]), prod(-m[3][2], m[4][1])), m[2][0]), sum(scale(sum(prod(m[3][0], m[4][2]), prod(-m[3][2], m[4][0])), -m[2][1]), scale(sum(prod(m[3][0], m[4][1]), prod(-m[3][1], m[4][0])), m[2][2]))), -m[1][4]))), -m[0][3]), scale(sum(sum(scale(sum(scale(sum(prod(m[3][2], m[4][3]), prod(-m[3][3], m[4][2])), m[2][1]), sum(scale(sum(prod(m[3][1], m[4][3]), prod(-m[3][3], m[4][1])), -m[2][2]), scale(sum(prod(m[3][1], m[4][2]), prod(-m[3][2], m[4][1])), m[2][3]))), m[1][0]), scale(sum(scale(sum(prod(m[3][2], m[4][3]), prod(-m[3][3], m[4][2])), m[2][0]), sum(scale(sum(prod(m[3][0], m[4][3]), prod(-m[3][3], m[4][0])), -m[2][2]), scale(sum(prod(m[3][0], m[4][2]), prod(-m[3][2], m[4][0])), m[2][3]))), -m[1][1])), sum(scale(sum(scale(sum(prod(m[3][1], m[4][3]), prod(-m[3][3], m[4][1])), m[2][0]), sum(scale(sum(prod(m[3][0], m[4][3]), prod(-m[3][3], m[4][0])), -m[2][1]), scale(sum(prod(m[3][0], m[4][1]), prod(-m[3][1], m[4][0])), m[2][3]))), m[1][2]), scale(sum(scale(sum(prod(m[3][1], m[4][2]), prod(-m[3][2], m[4][1])), m[2][0]), sum(scale(sum(prod(m[3][0], m[4][2]), prod(-m[3][2], m[4][0])), -m[2][1]), scale(sum(prod(m[3][0], m[4][1]), prod(-m[3][1], m[4][0])), m[2][2]))), -m[1][3]))), m[0][4])))));\n };\n }\n function compileDeterminant(n) {\n var fn = n === 2 ? determinant_2 : n === 3 ? determinant_3 : n === 4 ? determinant_4 : n === 5 ? determinant_5 : void 0;\n return fn(robustSum, robustScale, twoProduct, compress);\n }\n var CACHE = [\n function robustDeterminant0() {\n return [0];\n },\n function robustDeterminant1(m) {\n return [m[0][0]];\n }\n ];\n function proc(det0, det1, det2, det3, det4, det5, CACHE2, gen) {\n return function robustDeterminant(m) {\n switch (m.length) {\n case 0:\n return det0(m);\n case 1:\n return det1(m);\n case 2:\n return det2(m);\n case 3:\n return det3(m);\n case 4:\n return det4(m);\n case 5:\n return det5(m);\n }\n var det = CACHE2[m.length];\n if (!det) det = CACHE2[m.length] = gen(m.length);\n return det(m);\n };\n }\n function generateDispatch() {\n while (CACHE.length < NUM_EXPANDED) {\n CACHE.push(compileDeterminant(CACHE.length));\n }\n module2.exports = proc.apply(void 0, CACHE.concat([CACHE, compileDeterminant]));\n for (var i = 0; i < CACHE.length; ++i) {\n module2.exports[i] = CACHE[i];\n }\n }\n generateDispatch();\n }\n ),\n /***/\n 1944: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var twoProduct = __webpack_require__2(5250);\n var robustSum = __webpack_require__2(8210);\n module2.exports = robustDotProduct;\n function robustDotProduct(a, b) {\n var r = twoProduct(a[0], b[0]);\n for (var i = 1; i < a.length; ++i) {\n r = robustSum(r, twoProduct(a[i], b[i]));\n }\n return r;\n }\n }\n ),\n /***/\n 2646: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var twoProduct = __webpack_require__2(5250);\n var robustSum = __webpack_require__2(8210);\n var robustDiff = __webpack_require__2(8545);\n var robustScale = __webpack_require__2(3012);\n var NUM_EXPAND = 6;\n function orientation(n) {\n var fn = n === 3 ? inSphere3 : n === 4 ? inSphere4 : n === 5 ? inSphere5 : inSphere6;\n return fn(robustSum, robustDiff, twoProduct, robustScale);\n }\n function inSphere0() {\n return 0;\n }\n function inSphere1() {\n return 0;\n }\n function inSphere2() {\n return 0;\n }\n function inSphere3(sum, diff, prod, scale) {\n function exactInSphere3(m0, m1, m2) {\n var w0 = prod(m0[0], m0[0]);\n var w0m1 = scale(w0, m1[0]);\n var w0m2 = scale(w0, m2[0]);\n var w1 = prod(m1[0], m1[0]);\n var w1m0 = scale(w1, m0[0]);\n var w1m2 = scale(w1, m2[0]);\n var w2 = prod(m2[0], m2[0]);\n var w2m0 = scale(w2, m0[0]);\n var w2m1 = scale(w2, m1[0]);\n var p = sum(diff(w2m1, w1m2), diff(w1m0, w0m1));\n var n = diff(w2m0, w0m2);\n var d = diff(p, n);\n return d[d.length - 1];\n }\n return exactInSphere3;\n }\n function inSphere4(sum, diff, prod, scale) {\n function exactInSphere4(m0, m1, m2, m3) {\n var w0 = sum(prod(m0[0], m0[0]), prod(m0[1], m0[1]));\n var w0m1 = scale(w0, m1[0]);\n var w0m2 = scale(w0, m2[0]);\n var w0m3 = scale(w0, m3[0]);\n var w1 = sum(prod(m1[0], m1[0]), prod(m1[1], m1[1]));\n var w1m0 = scale(w1, m0[0]);\n var w1m2 = scale(w1, m2[0]);\n var w1m3 = scale(w1, m3[0]);\n var w2 = sum(prod(m2[0], m2[0]), prod(m2[1], m2[1]));\n var w2m0 = scale(w2, m0[0]);\n var w2m1 = scale(w2, m1[0]);\n var w2m3 = scale(w2, m3[0]);\n var w3 = sum(prod(m3[0], m3[0]), prod(m3[1], m3[1]));\n var w3m0 = scale(w3, m0[0]);\n var w3m1 = scale(w3, m1[0]);\n var w3m2 = scale(w3, m2[0]);\n var p = sum(sum(scale(diff(w3m2, w2m3), m1[1]), sum(scale(diff(w3m1, w1m3), -m2[1]), scale(diff(w2m1, w1m2), m3[1]))), sum(scale(diff(w3m1, w1m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m1[1]), scale(diff(w1m0, w0m1), m3[1]))));\n var n = sum(sum(scale(diff(w3m2, w2m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m2[1]), scale(diff(w2m0, w0m2), m3[1]))), sum(scale(diff(w2m1, w1m2), m0[1]), sum(scale(diff(w2m0, w0m2), -m1[1]), scale(diff(w1m0, w0m1), m2[1]))));\n var d = diff(p, n);\n return d[d.length - 1];\n }\n return exactInSphere4;\n }\n function inSphere5(sum, diff, prod, scale) {\n function exactInSphere5(m0, m1, m2, m3, m4) {\n var w0 = sum(prod(m0[0], m0[0]), sum(prod(m0[1], m0[1]), prod(m0[2], m0[2])));\n var w0m1 = scale(w0, m1[0]);\n var w0m2 = scale(w0, m2[0]);\n var w0m3 = scale(w0, m3[0]);\n var w0m4 = scale(w0, m4[0]);\n var w1 = sum(prod(m1[0], m1[0]), sum(prod(m1[1], m1[1]), prod(m1[2], m1[2])));\n var w1m0 = scale(w1, m0[0]);\n var w1m2 = scale(w1, m2[0]);\n var w1m3 = scale(w1, m3[0]);\n var w1m4 = scale(w1, m4[0]);\n var w2 = sum(prod(m2[0], m2[0]), sum(prod(m2[1], m2[1]), prod(m2[2], m2[2])));\n var w2m0 = scale(w2, m0[0]);\n var w2m1 = scale(w2, m1[0]);\n var w2m3 = scale(w2, m3[0]);\n var w2m4 = scale(w2, m4[0]);\n var w3 = sum(prod(m3[0], m3[0]), sum(prod(m3[1], m3[1]), prod(m3[2], m3[2])));\n var w3m0 = scale(w3, m0[0]);\n var w3m1 = scale(w3, m1[0]);\n var w3m2 = scale(w3, m2[0]);\n var w3m4 = scale(w3, m4[0]);\n var w4 = sum(prod(m4[0], m4[0]), sum(prod(m4[1], m4[1]), prod(m4[2], m4[2])));\n var w4m0 = scale(w4, m0[0]);\n var w4m1 = scale(w4, m1[0]);\n var w4m2 = scale(w4, m2[0]);\n var w4m3 = scale(w4, m3[0]);\n var p = sum(sum(sum(scale(sum(scale(diff(w4m3, w3m4), m2[1]), sum(scale(diff(w4m2, w2m4), -m3[1]), scale(diff(w3m2, w2m3), m4[1]))), m1[2]), sum(scale(sum(scale(diff(w4m3, w3m4), m1[1]), sum(scale(diff(w4m1, w1m4), -m3[1]), scale(diff(w3m1, w1m3), m4[1]))), -m2[2]), scale(sum(scale(diff(w4m2, w2m4), m1[1]), sum(scale(diff(w4m1, w1m4), -m2[1]), scale(diff(w2m1, w1m2), m4[1]))), m3[2]))), sum(scale(sum(scale(diff(w3m2, w2m3), m1[1]), sum(scale(diff(w3m1, w1m3), -m2[1]), scale(diff(w2m1, w1m2), m3[1]))), -m4[2]), sum(scale(sum(scale(diff(w4m3, w3m4), m1[1]), sum(scale(diff(w4m1, w1m4), -m3[1]), scale(diff(w3m1, w1m3), m4[1]))), m0[2]), scale(sum(scale(diff(w4m3, w3m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m3[1]), scale(diff(w3m0, w0m3), m4[1]))), -m1[2])))), sum(sum(scale(sum(scale(diff(w4m1, w1m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m1[1]), scale(diff(w1m0, w0m1), m4[1]))), m3[2]), sum(scale(sum(scale(diff(w3m1, w1m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m1[1]), scale(diff(w1m0, w0m1), m3[1]))), -m4[2]), scale(sum(scale(diff(w3m2, w2m3), m1[1]), sum(scale(diff(w3m1, w1m3), -m2[1]), scale(diff(w2m1, w1m2), m3[1]))), m0[2]))), sum(scale(sum(scale(diff(w3m2, w2m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m2[1]), scale(diff(w2m0, w0m2), m3[1]))), -m1[2]), sum(scale(sum(scale(diff(w3m1, w1m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m1[1]), scale(diff(w1m0, w0m1), m3[1]))), m2[2]), scale(sum(scale(diff(w2m1, w1m2), m0[1]), sum(scale(diff(w2m0, w0m2), -m1[1]), scale(diff(w1m0, w0m1), m2[1]))), -m3[2])))));\n var n = sum(sum(sum(scale(sum(scale(diff(w4m3, w3m4), m2[1]), sum(scale(diff(w4m2, w2m4), -m3[1]), scale(diff(w3m2, w2m3), m4[1]))), m0[2]), scale(sum(scale(diff(w4m3, w3m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m3[1]), scale(diff(w3m0, w0m3), m4[1]))), -m2[2])), sum(scale(sum(scale(diff(w4m2, w2m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m2[1]), scale(diff(w2m0, w0m2), m4[1]))), m3[2]), scale(sum(scale(diff(w3m2, w2m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m2[1]), scale(diff(w2m0, w0m2), m3[1]))), -m4[2]))), sum(sum(scale(sum(scale(diff(w4m2, w2m4), m1[1]), sum(scale(diff(w4m1, w1m4), -m2[1]), scale(diff(w2m1, w1m2), m4[1]))), m0[2]), scale(sum(scale(diff(w4m2, w2m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m2[1]), scale(diff(w2m0, w0m2), m4[1]))), -m1[2])), sum(scale(sum(scale(diff(w4m1, w1m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m1[1]), scale(diff(w1m0, w0m1), m4[1]))), m2[2]), scale(sum(scale(diff(w2m1, w1m2), m0[1]), sum(scale(diff(w2m0, w0m2), -m1[1]), scale(diff(w1m0, w0m1), m2[1]))), -m4[2]))));\n var d = diff(p, n);\n return d[d.length - 1];\n }\n return exactInSphere5;\n }\n function inSphere6(sum, diff, prod, scale) {\n function exactInSphere6(m0, m1, m2, m3, m4, m5) {\n var w0 = sum(sum(prod(m0[0], m0[0]), prod(m0[1], m0[1])), sum(prod(m0[2], m0[2]), prod(m0[3], m0[3])));\n var w0m1 = scale(w0, m1[0]);\n var w0m2 = scale(w0, m2[0]);\n var w0m3 = scale(w0, m3[0]);\n var w0m4 = scale(w0, m4[0]);\n var w0m5 = scale(w0, m5[0]);\n var w1 = sum(sum(prod(m1[0], m1[0]), prod(m1[1], m1[1])), sum(prod(m1[2], m1[2]), prod(m1[3], m1[3])));\n var w1m0 = scale(w1, m0[0]);\n var w1m2 = scale(w1, m2[0]);\n var w1m3 = scale(w1, m3[0]);\n var w1m4 = scale(w1, m4[0]);\n var w1m5 = scale(w1, m5[0]);\n var w2 = sum(sum(prod(m2[0], m2[0]), prod(m2[1], m2[1])), sum(prod(m2[2], m2[2]), prod(m2[3], m2[3])));\n var w2m0 = scale(w2, m0[0]);\n var w2m1 = scale(w2, m1[0]);\n var w2m3 = scale(w2, m3[0]);\n var w2m4 = scale(w2, m4[0]);\n var w2m5 = scale(w2, m5[0]);\n var w3 = sum(sum(prod(m3[0], m3[0]), prod(m3[1], m3[1])), sum(prod(m3[2], m3[2]), prod(m3[3], m3[3])));\n var w3m0 = scale(w3, m0[0]);\n var w3m1 = scale(w3, m1[0]);\n var w3m2 = scale(w3, m2[0]);\n var w3m4 = scale(w3, m4[0]);\n var w3m5 = scale(w3, m5[0]);\n var w4 = sum(sum(prod(m4[0], m4[0]), prod(m4[1], m4[1])), sum(prod(m4[2], m4[2]), prod(m4[3], m4[3])));\n var w4m0 = scale(w4, m0[0]);\n var w4m1 = scale(w4, m1[0]);\n var w4m2 = scale(w4, m2[0]);\n var w4m3 = scale(w4, m3[0]);\n var w4m5 = scale(w4, m5[0]);\n var w5 = sum(sum(prod(m5[0], m5[0]), prod(m5[1], m5[1])), sum(prod(m5[2], m5[2]), prod(m5[3], m5[3])));\n var w5m0 = scale(w5, m0[0]);\n var w5m1 = scale(w5, m1[0]);\n var w5m2 = scale(w5, m2[0]);\n var w5m3 = scale(w5, m3[0]);\n var w5m4 = scale(w5, m4[0]);\n var p = sum(sum(sum(scale(sum(sum(scale(sum(scale(diff(w5m4, w4m5), m3[1]), sum(scale(diff(w5m3, w3m5), -m4[1]), scale(diff(w4m3, w3m4), m5[1]))), m2[2]), scale(sum(scale(diff(w5m4, w4m5), m2[1]), sum(scale(diff(w5m2, w2m5), -m4[1]), scale(diff(w4m2, w2m4), m5[1]))), -m3[2])), sum(scale(sum(scale(diff(w5m3, w3m5), m2[1]), sum(scale(diff(w5m2, w2m5), -m3[1]), scale(diff(w3m2, w2m3), m5[1]))), m4[2]), scale(sum(scale(diff(w4m3, w3m4), m2[1]), sum(scale(diff(w4m2, w2m4), -m3[1]), scale(diff(w3m2, w2m3), m4[1]))), -m5[2]))), m1[3]), sum(scale(sum(sum(scale(sum(scale(diff(w5m4, w4m5), m3[1]), sum(scale(diff(w5m3, w3m5), -m4[1]), scale(diff(w4m3, w3m4), m5[1]))), m1[2]), scale(sum(scale(diff(w5m4, w4m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m4[1]), scale(diff(w4m1, w1m4), m5[1]))), -m3[2])), sum(scale(sum(scale(diff(w5m3, w3m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m3[1]), scale(diff(w3m1, w1m3), m5[1]))), m4[2]), scale(sum(scale(diff(w4m3, w3m4), m1[1]), sum(scale(diff(w4m1, w1m4), -m3[1]), scale(diff(w3m1, w1m3), m4[1]))), -m5[2]))), -m2[3]), scale(sum(sum(scale(sum(scale(diff(w5m4, w4m5), m2[1]), sum(scale(diff(w5m2, w2m5), -m4[1]), scale(diff(w4m2, w2m4), m5[1]))), m1[2]), scale(sum(scale(diff(w5m4, w4m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m4[1]), scale(diff(w4m1, w1m4), m5[1]))), -m2[2])), sum(scale(sum(scale(diff(w5m2, w2m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m2[1]), scale(diff(w2m1, w1m2), m5[1]))), m4[2]), scale(sum(scale(diff(w4m2, w2m4), m1[1]), sum(scale(diff(w4m1, w1m4), -m2[1]), scale(diff(w2m1, w1m2), m4[1]))), -m5[2]))), m3[3]))), sum(sum(scale(sum(sum(scale(sum(scale(diff(w5m3, w3m5), m2[1]), sum(scale(diff(w5m2, w2m5), -m3[1]), scale(diff(w3m2, w2m3), m5[1]))), m1[2]), scale(sum(scale(diff(w5m3, w3m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m3[1]), scale(diff(w3m1, w1m3), m5[1]))), -m2[2])), sum(scale(sum(scale(diff(w5m2, w2m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m2[1]), scale(diff(w2m1, w1m2), m5[1]))), m3[2]), scale(sum(scale(diff(w3m2, w2m3), m1[1]), sum(scale(diff(w3m1, w1m3), -m2[1]), scale(diff(w2m1, w1m2), m3[1]))), -m5[2]))), -m4[3]), scale(sum(sum(scale(sum(scale(diff(w4m3, w3m4), m2[1]), sum(scale(diff(w4m2, w2m4), -m3[1]), scale(diff(w3m2, w2m3), m4[1]))), m1[2]), scale(sum(scale(diff(w4m3, w3m4), m1[1]), sum(scale(diff(w4m1, w1m4), -m3[1]), scale(diff(w3m1, w1m3), m4[1]))), -m2[2])), sum(scale(sum(scale(diff(w4m2, w2m4), m1[1]), sum(scale(diff(w4m1, w1m4), -m2[1]), scale(diff(w2m1, w1m2), m4[1]))), m3[2]), scale(sum(scale(diff(w3m2, w2m3), m1[1]), sum(scale(diff(w3m1, w1m3), -m2[1]), scale(diff(w2m1, w1m2), m3[1]))), -m4[2]))), m5[3])), sum(scale(sum(sum(scale(sum(scale(diff(w5m4, w4m5), m3[1]), sum(scale(diff(w5m3, w3m5), -m4[1]), scale(diff(w4m3, w3m4), m5[1]))), m1[2]), scale(sum(scale(diff(w5m4, w4m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m4[1]), scale(diff(w4m1, w1m4), m5[1]))), -m3[2])), sum(scale(sum(scale(diff(w5m3, w3m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m3[1]), scale(diff(w3m1, w1m3), m5[1]))), m4[2]), scale(sum(scale(diff(w4m3, w3m4), m1[1]), sum(scale(diff(w4m1, w1m4), -m3[1]), scale(diff(w3m1, w1m3), m4[1]))), -m5[2]))), m0[3]), scale(sum(sum(scale(sum(scale(diff(w5m4, w4m5), m3[1]), sum(scale(diff(w5m3, w3m5), -m4[1]), scale(diff(w4m3, w3m4), m5[1]))), m0[2]), scale(sum(scale(diff(w5m4, w4m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m4[1]), scale(diff(w4m0, w0m4), m5[1]))), -m3[2])), sum(scale(sum(scale(diff(w5m3, w3m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m3[1]), scale(diff(w3m0, w0m3), m5[1]))), m4[2]), scale(sum(scale(diff(w4m3, w3m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m3[1]), scale(diff(w3m0, w0m3), m4[1]))), -m5[2]))), -m1[3])))), sum(sum(sum(scale(sum(sum(scale(sum(scale(diff(w5m4, w4m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m4[1]), scale(diff(w4m1, w1m4), m5[1]))), m0[2]), scale(sum(scale(diff(w5m4, w4m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m4[1]), scale(diff(w4m0, w0m4), m5[1]))), -m1[2])), sum(scale(sum(scale(diff(w5m1, w1m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m1[1]), scale(diff(w1m0, w0m1), m5[1]))), m4[2]), scale(sum(scale(diff(w4m1, w1m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m1[1]), scale(diff(w1m0, w0m1), m4[1]))), -m5[2]))), m3[3]), scale(sum(sum(scale(sum(scale(diff(w5m3, w3m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m3[1]), scale(diff(w3m1, w1m3), m5[1]))), m0[2]), scale(sum(scale(diff(w5m3, w3m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m3[1]), scale(diff(w3m0, w0m3), m5[1]))), -m1[2])), sum(scale(sum(scale(diff(w5m1, w1m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m1[1]), scale(diff(w1m0, w0m1), m5[1]))), m3[2]), scale(sum(scale(diff(w3m1, w1m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m1[1]), scale(diff(w1m0, w0m1), m3[1]))), -m5[2]))), -m4[3])), sum(scale(sum(sum(scale(sum(scale(diff(w4m3, w3m4), m1[1]), sum(scale(diff(w4m1, w1m4), -m3[1]), scale(diff(w3m1, w1m3), m4[1]))), m0[2]), scale(sum(scale(diff(w4m3, w3m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m3[1]), scale(diff(w3m0, w0m3), m4[1]))), -m1[2])), sum(scale(sum(scale(diff(w4m1, w1m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m1[1]), scale(diff(w1m0, w0m1), m4[1]))), m3[2]), scale(sum(scale(diff(w3m1, w1m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m1[1]), scale(diff(w1m0, w0m1), m3[1]))), -m4[2]))), m5[3]), scale(sum(sum(scale(sum(scale(diff(w5m3, w3m5), m2[1]), sum(scale(diff(w5m2, w2m5), -m3[1]), scale(diff(w3m2, w2m3), m5[1]))), m1[2]), scale(sum(scale(diff(w5m3, w3m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m3[1]), scale(diff(w3m1, w1m3), m5[1]))), -m2[2])), sum(scale(sum(scale(diff(w5m2, w2m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m2[1]), scale(diff(w2m1, w1m2), m5[1]))), m3[2]), scale(sum(scale(diff(w3m2, w2m3), m1[1]), sum(scale(diff(w3m1, w1m3), -m2[1]), scale(diff(w2m1, w1m2), m3[1]))), -m5[2]))), m0[3]))), sum(sum(scale(sum(sum(scale(sum(scale(diff(w5m3, w3m5), m2[1]), sum(scale(diff(w5m2, w2m5), -m3[1]), scale(diff(w3m2, w2m3), m5[1]))), m0[2]), scale(sum(scale(diff(w5m3, w3m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m3[1]), scale(diff(w3m0, w0m3), m5[1]))), -m2[2])), sum(scale(sum(scale(diff(w5m2, w2m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m2[1]), scale(diff(w2m0, w0m2), m5[1]))), m3[2]), scale(sum(scale(diff(w3m2, w2m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m2[1]), scale(diff(w2m0, w0m2), m3[1]))), -m5[2]))), -m1[3]), scale(sum(sum(scale(sum(scale(diff(w5m3, w3m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m3[1]), scale(diff(w3m1, w1m3), m5[1]))), m0[2]), scale(sum(scale(diff(w5m3, w3m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m3[1]), scale(diff(w3m0, w0m3), m5[1]))), -m1[2])), sum(scale(sum(scale(diff(w5m1, w1m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m1[1]), scale(diff(w1m0, w0m1), m5[1]))), m3[2]), scale(sum(scale(diff(w3m1, w1m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m1[1]), scale(diff(w1m0, w0m1), m3[1]))), -m5[2]))), m2[3])), sum(scale(sum(sum(scale(sum(scale(diff(w5m2, w2m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m2[1]), scale(diff(w2m1, w1m2), m5[1]))), m0[2]), scale(sum(scale(diff(w5m2, w2m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m2[1]), scale(diff(w2m0, w0m2), m5[1]))), -m1[2])), sum(scale(sum(scale(diff(w5m1, w1m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m1[1]), scale(diff(w1m0, w0m1), m5[1]))), m2[2]), scale(sum(scale(diff(w2m1, w1m2), m0[1]), sum(scale(diff(w2m0, w0m2), -m1[1]), scale(diff(w1m0, w0m1), m2[1]))), -m5[2]))), -m3[3]), scale(sum(sum(scale(sum(scale(diff(w3m2, w2m3), m1[1]), sum(scale(diff(w3m1, w1m3), -m2[1]), scale(diff(w2m1, w1m2), m3[1]))), m0[2]), scale(sum(scale(diff(w3m2, w2m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m2[1]), scale(diff(w2m0, w0m2), m3[1]))), -m1[2])), sum(scale(sum(scale(diff(w3m1, w1m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m1[1]), scale(diff(w1m0, w0m1), m3[1]))), m2[2]), scale(sum(scale(diff(w2m1, w1m2), m0[1]), sum(scale(diff(w2m0, w0m2), -m1[1]), scale(diff(w1m0, w0m1), m2[1]))), -m3[2]))), m5[3])))));\n var n = sum(sum(sum(scale(sum(sum(scale(sum(scale(diff(w5m4, w4m5), m3[1]), sum(scale(diff(w5m3, w3m5), -m4[1]), scale(diff(w4m3, w3m4), m5[1]))), m2[2]), scale(sum(scale(diff(w5m4, w4m5), m2[1]), sum(scale(diff(w5m2, w2m5), -m4[1]), scale(diff(w4m2, w2m4), m5[1]))), -m3[2])), sum(scale(sum(scale(diff(w5m3, w3m5), m2[1]), sum(scale(diff(w5m2, w2m5), -m3[1]), scale(diff(w3m2, w2m3), m5[1]))), m4[2]), scale(sum(scale(diff(w4m3, w3m4), m2[1]), sum(scale(diff(w4m2, w2m4), -m3[1]), scale(diff(w3m2, w2m3), m4[1]))), -m5[2]))), m0[3]), sum(scale(sum(sum(scale(sum(scale(diff(w5m4, w4m5), m3[1]), sum(scale(diff(w5m3, w3m5), -m4[1]), scale(diff(w4m3, w3m4), m5[1]))), m0[2]), scale(sum(scale(diff(w5m4, w4m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m4[1]), scale(diff(w4m0, w0m4), m5[1]))), -m3[2])), sum(scale(sum(scale(diff(w5m3, w3m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m3[1]), scale(diff(w3m0, w0m3), m5[1]))), m4[2]), scale(sum(scale(diff(w4m3, w3m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m3[1]), scale(diff(w3m0, w0m3), m4[1]))), -m5[2]))), -m2[3]), scale(sum(sum(scale(sum(scale(diff(w5m4, w4m5), m2[1]), sum(scale(diff(w5m2, w2m5), -m4[1]), scale(diff(w4m2, w2m4), m5[1]))), m0[2]), scale(sum(scale(diff(w5m4, w4m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m4[1]), scale(diff(w4m0, w0m4), m5[1]))), -m2[2])), sum(scale(sum(scale(diff(w5m2, w2m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m2[1]), scale(diff(w2m0, w0m2), m5[1]))), m4[2]), scale(sum(scale(diff(w4m2, w2m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m2[1]), scale(diff(w2m0, w0m2), m4[1]))), -m5[2]))), m3[3]))), sum(sum(scale(sum(sum(scale(sum(scale(diff(w5m3, w3m5), m2[1]), sum(scale(diff(w5m2, w2m5), -m3[1]), scale(diff(w3m2, w2m3), m5[1]))), m0[2]), scale(sum(scale(diff(w5m3, w3m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m3[1]), scale(diff(w3m0, w0m3), m5[1]))), -m2[2])), sum(scale(sum(scale(diff(w5m2, w2m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m2[1]), scale(diff(w2m0, w0m2), m5[1]))), m3[2]), scale(sum(scale(diff(w3m2, w2m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m2[1]), scale(diff(w2m0, w0m2), m3[1]))), -m5[2]))), -m4[3]), scale(sum(sum(scale(sum(scale(diff(w4m3, w3m4), m2[1]), sum(scale(diff(w4m2, w2m4), -m3[1]), scale(diff(w3m2, w2m3), m4[1]))), m0[2]), scale(sum(scale(diff(w4m3, w3m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m3[1]), scale(diff(w3m0, w0m3), m4[1]))), -m2[2])), sum(scale(sum(scale(diff(w4m2, w2m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m2[1]), scale(diff(w2m0, w0m2), m4[1]))), m3[2]), scale(sum(scale(diff(w3m2, w2m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m2[1]), scale(diff(w2m0, w0m2), m3[1]))), -m4[2]))), m5[3])), sum(scale(sum(sum(scale(sum(scale(diff(w5m4, w4m5), m2[1]), sum(scale(diff(w5m2, w2m5), -m4[1]), scale(diff(w4m2, w2m4), m5[1]))), m1[2]), scale(sum(scale(diff(w5m4, w4m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m4[1]), scale(diff(w4m1, w1m4), m5[1]))), -m2[2])), sum(scale(sum(scale(diff(w5m2, w2m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m2[1]), scale(diff(w2m1, w1m2), m5[1]))), m4[2]), scale(sum(scale(diff(w4m2, w2m4), m1[1]), sum(scale(diff(w4m1, w1m4), -m2[1]), scale(diff(w2m1, w1m2), m4[1]))), -m5[2]))), m0[3]), scale(sum(sum(scale(sum(scale(diff(w5m4, w4m5), m2[1]), sum(scale(diff(w5m2, w2m5), -m4[1]), scale(diff(w4m2, w2m4), m5[1]))), m0[2]), scale(sum(scale(diff(w5m4, w4m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m4[1]), scale(diff(w4m0, w0m4), m5[1]))), -m2[2])), sum(scale(sum(scale(diff(w5m2, w2m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m2[1]), scale(diff(w2m0, w0m2), m5[1]))), m4[2]), scale(sum(scale(diff(w4m2, w2m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m2[1]), scale(diff(w2m0, w0m2), m4[1]))), -m5[2]))), -m1[3])))), sum(sum(sum(scale(sum(sum(scale(sum(scale(diff(w5m4, w4m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m4[1]), scale(diff(w4m1, w1m4), m5[1]))), m0[2]), scale(sum(scale(diff(w5m4, w4m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m4[1]), scale(diff(w4m0, w0m4), m5[1]))), -m1[2])), sum(scale(sum(scale(diff(w5m1, w1m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m1[1]), scale(diff(w1m0, w0m1), m5[1]))), m4[2]), scale(sum(scale(diff(w4m1, w1m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m1[1]), scale(diff(w1m0, w0m1), m4[1]))), -m5[2]))), m2[3]), scale(sum(sum(scale(sum(scale(diff(w5m2, w2m5), m1[1]), sum(scale(diff(w5m1, w1m5), -m2[1]), scale(diff(w2m1, w1m2), m5[1]))), m0[2]), scale(sum(scale(diff(w5m2, w2m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m2[1]), scale(diff(w2m0, w0m2), m5[1]))), -m1[2])), sum(scale(sum(scale(diff(w5m1, w1m5), m0[1]), sum(scale(diff(w5m0, w0m5), -m1[1]), scale(diff(w1m0, w0m1), m5[1]))), m2[2]), scale(sum(scale(diff(w2m1, w1m2), m0[1]), sum(scale(diff(w2m0, w0m2), -m1[1]), scale(diff(w1m0, w0m1), m2[1]))), -m5[2]))), -m4[3])), sum(scale(sum(sum(scale(sum(scale(diff(w4m2, w2m4), m1[1]), sum(scale(diff(w4m1, w1m4), -m2[1]), scale(diff(w2m1, w1m2), m4[1]))), m0[2]), scale(sum(scale(diff(w4m2, w2m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m2[1]), scale(diff(w2m0, w0m2), m4[1]))), -m1[2])), sum(scale(sum(scale(diff(w4m1, w1m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m1[1]), scale(diff(w1m0, w0m1), m4[1]))), m2[2]), scale(sum(scale(diff(w2m1, w1m2), m0[1]), sum(scale(diff(w2m0, w0m2), -m1[1]), scale(diff(w1m0, w0m1), m2[1]))), -m4[2]))), m5[3]), scale(sum(sum(scale(sum(scale(diff(w4m3, w3m4), m2[1]), sum(scale(diff(w4m2, w2m4), -m3[1]), scale(diff(w3m2, w2m3), m4[1]))), m1[2]), scale(sum(scale(diff(w4m3, w3m4), m1[1]), sum(scale(diff(w4m1, w1m4), -m3[1]), scale(diff(w3m1, w1m3), m4[1]))), -m2[2])), sum(scale(sum(scale(diff(w4m2, w2m4), m1[1]), sum(scale(diff(w4m1, w1m4), -m2[1]), scale(diff(w2m1, w1m2), m4[1]))), m3[2]), scale(sum(scale(diff(w3m2, w2m3), m1[1]), sum(scale(diff(w3m1, w1m3), -m2[1]), scale(diff(w2m1, w1m2), m3[1]))), -m4[2]))), m0[3]))), sum(sum(scale(sum(sum(scale(sum(scale(diff(w4m3, w3m4), m2[1]), sum(scale(diff(w4m2, w2m4), -m3[1]), scale(diff(w3m2, w2m3), m4[1]))), m0[2]), scale(sum(scale(diff(w4m3, w3m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m3[1]), scale(diff(w3m0, w0m3), m4[1]))), -m2[2])), sum(scale(sum(scale(diff(w4m2, w2m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m2[1]), scale(diff(w2m0, w0m2), m4[1]))), m3[2]), scale(sum(scale(diff(w3m2, w2m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m2[1]), scale(diff(w2m0, w0m2), m3[1]))), -m4[2]))), -m1[3]), scale(sum(sum(scale(sum(scale(diff(w4m3, w3m4), m1[1]), sum(scale(diff(w4m1, w1m4), -m3[1]), scale(diff(w3m1, w1m3), m4[1]))), m0[2]), scale(sum(scale(diff(w4m3, w3m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m3[1]), scale(diff(w3m0, w0m3), m4[1]))), -m1[2])), sum(scale(sum(scale(diff(w4m1, w1m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m1[1]), scale(diff(w1m0, w0m1), m4[1]))), m3[2]), scale(sum(scale(diff(w3m1, w1m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m1[1]), scale(diff(w1m0, w0m1), m3[1]))), -m4[2]))), m2[3])), sum(scale(sum(sum(scale(sum(scale(diff(w4m2, w2m4), m1[1]), sum(scale(diff(w4m1, w1m4), -m2[1]), scale(diff(w2m1, w1m2), m4[1]))), m0[2]), scale(sum(scale(diff(w4m2, w2m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m2[1]), scale(diff(w2m0, w0m2), m4[1]))), -m1[2])), sum(scale(sum(scale(diff(w4m1, w1m4), m0[1]), sum(scale(diff(w4m0, w0m4), -m1[1]), scale(diff(w1m0, w0m1), m4[1]))), m2[2]), scale(sum(scale(diff(w2m1, w1m2), m0[1]), sum(scale(diff(w2m0, w0m2), -m1[1]), scale(diff(w1m0, w0m1), m2[1]))), -m4[2]))), -m3[3]), scale(sum(sum(scale(sum(scale(diff(w3m2, w2m3), m1[1]), sum(scale(diff(w3m1, w1m3), -m2[1]), scale(diff(w2m1, w1m2), m3[1]))), m0[2]), scale(sum(scale(diff(w3m2, w2m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m2[1]), scale(diff(w2m0, w0m2), m3[1]))), -m1[2])), sum(scale(sum(scale(diff(w3m1, w1m3), m0[1]), sum(scale(diff(w3m0, w0m3), -m1[1]), scale(diff(w1m0, w0m1), m3[1]))), m2[2]), scale(sum(scale(diff(w2m1, w1m2), m0[1]), sum(scale(diff(w2m0, w0m2), -m1[1]), scale(diff(w1m0, w0m1), m2[1]))), -m3[2]))), m4[3])))));\n var d = diff(p, n);\n return d[d.length - 1];\n }\n return exactInSphere6;\n }\n var CACHED = [\n inSphere0,\n inSphere1,\n inSphere2\n ];\n function slowInSphere(args) {\n var proc2 = CACHED[args.length];\n if (!proc2) {\n proc2 = CACHED[args.length] = orientation(args.length);\n }\n return proc2.apply(void 0, args);\n }\n function proc(slow, o0, o1, o2, o3, o4, o5, o6) {\n function testInSphere(a0, a1, a2, a3, a4, a5) {\n switch (arguments.length) {\n case 0:\n case 1:\n return 0;\n case 2:\n return o2(a0, a1);\n case 3:\n return o3(a0, a1, a2);\n case 4:\n return o4(a0, a1, a2, a3);\n case 5:\n return o5(a0, a1, a2, a3, a4);\n case 6:\n return o6(a0, a1, a2, a3, a4, a5);\n }\n var s = new Array(arguments.length);\n for (var i = 0; i < arguments.length; ++i) {\n s[i] = arguments[i];\n }\n return slow(s);\n }\n return testInSphere;\n }\n function generateInSphereTest() {\n while (CACHED.length <= NUM_EXPAND) {\n CACHED.push(orientation(CACHED.length));\n }\n module2.exports = proc.apply(void 0, [slowInSphere].concat(CACHED));\n for (var i = 0; i <= NUM_EXPAND; ++i) {\n module2.exports[i] = CACHED[i];\n }\n }\n generateInSphereTest();\n }\n ),\n /***/\n 727: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var determinant = __webpack_require__2(2962);\n var NUM_EXPAND = 6;\n function generateSolver(n) {\n var fn = n === 2 ? solve2d : n === 3 ? solve3d : n === 4 ? solve4d : n === 5 ? solve5d : solve6d;\n if (n < 6) {\n return fn(determinant[n]);\n }\n return fn(determinant);\n }\n function robustLinearSolve0d() {\n return [[0]];\n }\n function robustLinearSolve1d(A2, b) {\n return [[b[0]], [A2[0][0]]];\n }\n function solve2d(det) {\n return function robustLinearSolve2d(A2, b) {\n return [det([[+b[0], +A2[0][1]], [+b[1], +A2[1][1]]]), det([[+A2[0][0], +b[0]], [+A2[1][0], +b[1]]]), det(A2)];\n };\n }\n function solve3d(det) {\n return function robustLinearSolve3d(A2, b) {\n return [det([[+b[0], +A2[0][1], +A2[0][2]], [+b[1], +A2[1][1], +A2[1][2]], [+b[2], +A2[2][1], +A2[2][2]]]), det([[+A2[0][0], +b[0], +A2[0][2]], [+A2[1][0], +b[1], +A2[1][2]], [+A2[2][0], +b[2], +A2[2][2]]]), det([[+A2[0][0], +A2[0][1], +b[0]], [+A2[1][0], +A2[1][1], +b[1]], [+A2[2][0], +A2[2][1], +b[2]]]), det(A2)];\n };\n }\n function solve4d(det) {\n return function robustLinearSolve4d(A2, b) {\n return [det([[+b[0], +A2[0][1], +A2[0][2], +A2[0][3]], [+b[1], +A2[1][1], +A2[1][2], +A2[1][3]], [+b[2], +A2[2][1], +A2[2][2], +A2[2][3]], [+b[3], +A2[3][1], +A2[3][2], +A2[3][3]]]), det([[+A2[0][0], +b[0], +A2[0][2], +A2[0][3]], [+A2[1][0], +b[1], +A2[1][2], +A2[1][3]], [+A2[2][0], +b[2], +A2[2][2], +A2[2][3]], [+A2[3][0], +b[3], +A2[3][2], +A2[3][3]]]), det([[+A2[0][0], +A2[0][1], +b[0], +A2[0][3]], [+A2[1][0], +A2[1][1], +b[1], +A2[1][3]], [+A2[2][0], +A2[2][1], +b[2], +A2[2][3]], [+A2[3][0], +A2[3][1], +b[3], +A2[3][3]]]), det([[+A2[0][0], +A2[0][1], +A2[0][2], +b[0]], [+A2[1][0], +A2[1][1], +A2[1][2], +b[1]], [+A2[2][0], +A2[2][1], +A2[2][2], +b[2]], [+A2[3][0], +A2[3][1], +A2[3][2], +b[3]]]), det(A2)];\n };\n }\n function solve5d(det) {\n return function robustLinearSolve5d(A2, b) {\n return [det([[+b[0], +A2[0][1], +A2[0][2], +A2[0][3], +A2[0][4]], [+b[1], +A2[1][1], +A2[1][2], +A2[1][3], +A2[1][4]], [+b[2], +A2[2][1], +A2[2][2], +A2[2][3], +A2[2][4]], [+b[3], +A2[3][1], +A2[3][2], +A2[3][3], +A2[3][4]], [+b[4], +A2[4][1], +A2[4][2], +A2[4][3], +A2[4][4]]]), det([[+A2[0][0], +b[0], +A2[0][2], +A2[0][3], +A2[0][4]], [+A2[1][0], +b[1], +A2[1][2], +A2[1][3], +A2[1][4]], [+A2[2][0], +b[2], +A2[2][2], +A2[2][3], +A2[2][4]], [+A2[3][0], +b[3], +A2[3][2], +A2[3][3], +A2[3][4]], [+A2[4][0], +b[4], +A2[4][2], +A2[4][3], +A2[4][4]]]), det([[+A2[0][0], +A2[0][1], +b[0], +A2[0][3], +A2[0][4]], [+A2[1][0], +A2[1][1], +b[1], +A2[1][3], +A2[1][4]], [+A2[2][0], +A2[2][1], +b[2], +A2[2][3], +A2[2][4]], [+A2[3][0], +A2[3][1], +b[3], +A2[3][3], +A2[3][4]], [+A2[4][0], +A2[4][1], +b[4], +A2[4][3], +A2[4][4]]]), det([[+A2[0][0], +A2[0][1], +A2[0][2], +b[0], +A2[0][4]], [+A2[1][0], +A2[1][1], +A2[1][2], +b[1], +A2[1][4]], [+A2[2][0], +A2[2][1], +A2[2][2], +b[2], +A2[2][4]], [+A2[3][0], +A2[3][1], +A2[3][2], +b[3], +A2[3][4]], [+A2[4][0], +A2[4][1], +A2[4][2], +b[4], +A2[4][4]]]), det([[+A2[0][0], +A2[0][1], +A2[0][2], +A2[0][3], +b[0]], [+A2[1][0], +A2[1][1], +A2[1][2], +A2[1][3], +b[1]], [+A2[2][0], +A2[2][1], +A2[2][2], +A2[2][3], +b[2]], [+A2[3][0], +A2[3][1], +A2[3][2], +A2[3][3], +b[3]], [+A2[4][0], +A2[4][1], +A2[4][2], +A2[4][3], +b[4]]]), det(A2)];\n };\n }\n function solve6d(det) {\n return function robustLinearSolve6d(A2, b) {\n return [det([[+b[0], +A2[0][1], +A2[0][2], +A2[0][3], +A2[0][4], +A2[0][5]], [+b[1], +A2[1][1], +A2[1][2], +A2[1][3], +A2[1][4], +A2[1][5]], [+b[2], +A2[2][1], +A2[2][2], +A2[2][3], +A2[2][4], +A2[2][5]], [+b[3], +A2[3][1], +A2[3][2], +A2[3][3], +A2[3][4], +A2[3][5]], [+b[4], +A2[4][1], +A2[4][2], +A2[4][3], +A2[4][4], +A2[4][5]], [+b[5], +A2[5][1], +A2[5][2], +A2[5][3], +A2[5][4], +A2[5][5]]]), det([[+A2[0][0], +b[0], +A2[0][2], +A2[0][3], +A2[0][4], +A2[0][5]], [+A2[1][0], +b[1], +A2[1][2], +A2[1][3], +A2[1][4], +A2[1][5]], [+A2[2][0], +b[2], +A2[2][2], +A2[2][3], +A2[2][4], +A2[2][5]], [+A2[3][0], +b[3], +A2[3][2], +A2[3][3], +A2[3][4], +A2[3][5]], [+A2[4][0], +b[4], +A2[4][2], +A2[4][3], +A2[4][4], +A2[4][5]], [+A2[5][0], +b[5], +A2[5][2], +A2[5][3], +A2[5][4], +A2[5][5]]]), det([[+A2[0][0], +A2[0][1], +b[0], +A2[0][3], +A2[0][4], +A2[0][5]], [+A2[1][0], +A2[1][1], +b[1], +A2[1][3], +A2[1][4], +A2[1][5]], [+A2[2][0], +A2[2][1], +b[2], +A2[2][3], +A2[2][4], +A2[2][5]], [+A2[3][0], +A2[3][1], +b[3], +A2[3][3], +A2[3][4], +A2[3][5]], [+A2[4][0], +A2[4][1], +b[4], +A2[4][3], +A2[4][4], +A2[4][5]], [+A2[5][0], +A2[5][1], +b[5], +A2[5][3], +A2[5][4], +A2[5][5]]]), det([[+A2[0][0], +A2[0][1], +A2[0][2], +b[0], +A2[0][4], +A2[0][5]], [+A2[1][0], +A2[1][1], +A2[1][2], +b[1], +A2[1][4], +A2[1][5]], [+A2[2][0], +A2[2][1], +A2[2][2], +b[2], +A2[2][4], +A2[2][5]], [+A2[3][0], +A2[3][1], +A2[3][2], +b[3], +A2[3][4], +A2[3][5]], [+A2[4][0], +A2[4][1], +A2[4][2], +b[4], +A2[4][4], +A2[4][5]], [+A2[5][0], +A2[5][1], +A2[5][2], +b[5], +A2[5][4], +A2[5][5]]]), det([[+A2[0][0], +A2[0][1], +A2[0][2], +A2[0][3], +b[0], +A2[0][5]], [+A2[1][0], +A2[1][1], +A2[1][2], +A2[1][3], +b[1], +A2[1][5]], [+A2[2][0], +A2[2][1], +A2[2][2], +A2[2][3], +b[2], +A2[2][5]], [+A2[3][0], +A2[3][1], +A2[3][2], +A2[3][3], +b[3], +A2[3][5]], [+A2[4][0], +A2[4][1], +A2[4][2], +A2[4][3], +b[4], +A2[4][5]], [+A2[5][0], +A2[5][1], +A2[5][2], +A2[5][3], +b[5], +A2[5][5]]]), det([[+A2[0][0], +A2[0][1], +A2[0][2], +A2[0][3], +A2[0][4], +b[0]], [+A2[1][0], +A2[1][1], +A2[1][2], +A2[1][3], +A2[1][4], +b[1]], [+A2[2][0], +A2[2][1], +A2[2][2], +A2[2][3], +A2[2][4], +b[2]], [+A2[3][0], +A2[3][1], +A2[3][2], +A2[3][3], +A2[3][4], +b[3]], [+A2[4][0], +A2[4][1], +A2[4][2], +A2[4][3], +A2[4][4], +b[4]], [+A2[5][0], +A2[5][1], +A2[5][2], +A2[5][3], +A2[5][4], +b[5]]]), det(A2)];\n };\n }\n var CACHE = [\n robustLinearSolve0d,\n robustLinearSolve1d\n ];\n function proc(s0, s1, s2, s3, s4, s5, CACHE2, g) {\n return function dispatchLinearSolve(A2, b) {\n switch (A2.length) {\n case 0:\n return s0(A2, b);\n case 1:\n return s1(A2, b);\n case 2:\n return s2(A2, b);\n case 3:\n return s3(A2, b);\n case 4:\n return s4(A2, b);\n case 5:\n return s5(A2, b);\n }\n var s = CACHE2[A2.length];\n if (!s) s = CACHE2[A2.length] = g(A2.length);\n return s(A2, b);\n };\n }\n function generateDispatch() {\n while (CACHE.length < NUM_EXPAND) {\n CACHE.push(generateSolver(CACHE.length));\n }\n module2.exports = proc.apply(void 0, CACHE.concat([CACHE, generateSolver]));\n for (var i = 0; i < NUM_EXPAND; ++i) {\n module2.exports[i] = CACHE[i];\n }\n }\n generateDispatch();\n }\n ),\n /***/\n 3250: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var twoProduct = __webpack_require__2(5250);\n var robustSum = __webpack_require__2(8210);\n var robustScale = __webpack_require__2(3012);\n var robustSubtract = __webpack_require__2(8545);\n var NUM_EXPAND = 5;\n var EPSILON = 11102230246251565e-32;\n var ERRBOUND3 = (3 + 16 * EPSILON) * EPSILON;\n var ERRBOUND4 = (7 + 56 * EPSILON) * EPSILON;\n function orientation_3(sum, prod, scale, sub) {\n return function orientation3Exact2(m0, m1, m2) {\n var p = sum(sum(prod(m1[1], m2[0]), prod(-m2[1], m1[0])), sum(prod(m0[1], m1[0]), prod(-m1[1], m0[0])));\n var n = sum(prod(m0[1], m2[0]), prod(-m2[1], m0[0]));\n var d = sub(p, n);\n return d[d.length - 1];\n };\n }\n function orientation_4(sum, prod, scale, sub) {\n return function orientation4Exact2(m0, m1, m2, m3) {\n var p = sum(sum(scale(sum(prod(m2[1], m3[0]), prod(-m3[1], m2[0])), m1[2]), sum(scale(sum(prod(m1[1], m3[0]), prod(-m3[1], m1[0])), -m2[2]), scale(sum(prod(m1[1], m2[0]), prod(-m2[1], m1[0])), m3[2]))), sum(scale(sum(prod(m1[1], m3[0]), prod(-m3[1], m1[0])), m0[2]), sum(scale(sum(prod(m0[1], m3[0]), prod(-m3[1], m0[0])), -m1[2]), scale(sum(prod(m0[1], m1[0]), prod(-m1[1], m0[0])), m3[2]))));\n var n = sum(sum(scale(sum(prod(m2[1], m3[0]), prod(-m3[1], m2[0])), m0[2]), sum(scale(sum(prod(m0[1], m3[0]), prod(-m3[1], m0[0])), -m2[2]), scale(sum(prod(m0[1], m2[0]), prod(-m2[1], m0[0])), m3[2]))), sum(scale(sum(prod(m1[1], m2[0]), prod(-m2[1], m1[0])), m0[2]), sum(scale(sum(prod(m0[1], m2[0]), prod(-m2[1], m0[0])), -m1[2]), scale(sum(prod(m0[1], m1[0]), prod(-m1[1], m0[0])), m2[2]))));\n var d = sub(p, n);\n return d[d.length - 1];\n };\n }\n function orientation_5(sum, prod, scale, sub) {\n return function orientation5Exact(m0, m1, m2, m3, m4) {\n var p = sum(sum(sum(scale(sum(scale(sum(prod(m3[1], m4[0]), prod(-m4[1], m3[0])), m2[2]), sum(scale(sum(prod(m2[1], m4[0]), prod(-m4[1], m2[0])), -m3[2]), scale(sum(prod(m2[1], m3[0]), prod(-m3[1], m2[0])), m4[2]))), m1[3]), sum(scale(sum(scale(sum(prod(m3[1], m4[0]), prod(-m4[1], m3[0])), m1[2]), sum(scale(sum(prod(m1[1], m4[0]), prod(-m4[1], m1[0])), -m3[2]), scale(sum(prod(m1[1], m3[0]), prod(-m3[1], m1[0])), m4[2]))), -m2[3]), scale(sum(scale(sum(prod(m2[1], m4[0]), prod(-m4[1], m2[0])), m1[2]), sum(scale(sum(prod(m1[1], m4[0]), prod(-m4[1], m1[0])), -m2[2]), scale(sum(prod(m1[1], m2[0]), prod(-m2[1], m1[0])), m4[2]))), m3[3]))), sum(scale(sum(scale(sum(prod(m2[1], m3[0]), prod(-m3[1], m2[0])), m1[2]), sum(scale(sum(prod(m1[1], m3[0]), prod(-m3[1], m1[0])), -m2[2]), scale(sum(prod(m1[1], m2[0]), prod(-m2[1], m1[0])), m3[2]))), -m4[3]), sum(scale(sum(scale(sum(prod(m3[1], m4[0]), prod(-m4[1], m3[0])), m1[2]), sum(scale(sum(prod(m1[1], m4[0]), prod(-m4[1], m1[0])), -m3[2]), scale(sum(prod(m1[1], m3[0]), prod(-m3[1], m1[0])), m4[2]))), m0[3]), scale(sum(scale(sum(prod(m3[1], m4[0]), prod(-m4[1], m3[0])), m0[2]), sum(scale(sum(prod(m0[1], m4[0]), prod(-m4[1], m0[0])), -m3[2]), scale(sum(prod(m0[1], m3[0]), prod(-m3[1], m0[0])), m4[2]))), -m1[3])))), sum(sum(scale(sum(scale(sum(prod(m1[1], m4[0]), prod(-m4[1], m1[0])), m0[2]), sum(scale(sum(prod(m0[1], m4[0]), prod(-m4[1], m0[0])), -m1[2]), scale(sum(prod(m0[1], m1[0]), prod(-m1[1], m0[0])), m4[2]))), m3[3]), sum(scale(sum(scale(sum(prod(m1[1], m3[0]), prod(-m3[1], m1[0])), m0[2]), sum(scale(sum(prod(m0[1], m3[0]), prod(-m3[1], m0[0])), -m1[2]), scale(sum(prod(m0[1], m1[0]), prod(-m1[1], m0[0])), m3[2]))), -m4[3]), scale(sum(scale(sum(prod(m2[1], m3[0]), prod(-m3[1], m2[0])), m1[2]), sum(scale(sum(prod(m1[1], m3[0]), prod(-m3[1], m1[0])), -m2[2]), scale(sum(prod(m1[1], m2[0]), prod(-m2[1], m1[0])), m3[2]))), m0[3]))), sum(scale(sum(scale(sum(prod(m2[1], m3[0]), prod(-m3[1], m2[0])), m0[2]), sum(scale(sum(prod(m0[1], m3[0]), prod(-m3[1], m0[0])), -m2[2]), scale(sum(prod(m0[1], m2[0]), prod(-m2[1], m0[0])), m3[2]))), -m1[3]), sum(scale(sum(scale(sum(prod(m1[1], m3[0]), prod(-m3[1], m1[0])), m0[2]), sum(scale(sum(prod(m0[1], m3[0]), prod(-m3[1], m0[0])), -m1[2]), scale(sum(prod(m0[1], m1[0]), prod(-m1[1], m0[0])), m3[2]))), m2[3]), scale(sum(scale(sum(prod(m1[1], m2[0]), prod(-m2[1], m1[0])), m0[2]), sum(scale(sum(prod(m0[1], m2[0]), prod(-m2[1], m0[0])), -m1[2]), scale(sum(prod(m0[1], m1[0]), prod(-m1[1], m0[0])), m2[2]))), -m3[3])))));\n var n = sum(sum(sum(scale(sum(scale(sum(prod(m3[1], m4[0]), prod(-m4[1], m3[0])), m2[2]), sum(scale(sum(prod(m2[1], m4[0]), prod(-m4[1], m2[0])), -m3[2]), scale(sum(prod(m2[1], m3[0]), prod(-m3[1], m2[0])), m4[2]))), m0[3]), scale(sum(scale(sum(prod(m3[1], m4[0]), prod(-m4[1], m3[0])), m0[2]), sum(scale(sum(prod(m0[1], m4[0]), prod(-m4[1], m0[0])), -m3[2]), scale(sum(prod(m0[1], m3[0]), prod(-m3[1], m0[0])), m4[2]))), -m2[3])), sum(scale(sum(scale(sum(prod(m2[1], m4[0]), prod(-m4[1], m2[0])), m0[2]), sum(scale(sum(prod(m0[1], m4[0]), prod(-m4[1], m0[0])), -m2[2]), scale(sum(prod(m0[1], m2[0]), prod(-m2[1], m0[0])), m4[2]))), m3[3]), scale(sum(scale(sum(prod(m2[1], m3[0]), prod(-m3[1], m2[0])), m0[2]), sum(scale(sum(prod(m0[1], m3[0]), prod(-m3[1], m0[0])), -m2[2]), scale(sum(prod(m0[1], m2[0]), prod(-m2[1], m0[0])), m3[2]))), -m4[3]))), sum(sum(scale(sum(scale(sum(prod(m2[1], m4[0]), prod(-m4[1], m2[0])), m1[2]), sum(scale(sum(prod(m1[1], m4[0]), prod(-m4[1], m1[0])), -m2[2]), scale(sum(prod(m1[1], m2[0]), prod(-m2[1], m1[0])), m4[2]))), m0[3]), scale(sum(scale(sum(prod(m2[1], m4[0]), prod(-m4[1], m2[0])), m0[2]), sum(scale(sum(prod(m0[1], m4[0]), prod(-m4[1], m0[0])), -m2[2]), scale(sum(prod(m0[1], m2[0]), prod(-m2[1], m0[0])), m4[2]))), -m1[3])), sum(scale(sum(scale(sum(prod(m1[1], m4[0]), prod(-m4[1], m1[0])), m0[2]), sum(scale(sum(prod(m0[1], m4[0]), prod(-m4[1], m0[0])), -m1[2]), scale(sum(prod(m0[1], m1[0]), prod(-m1[1], m0[0])), m4[2]))), m2[3]), scale(sum(scale(sum(prod(m1[1], m2[0]), prod(-m2[1], m1[0])), m0[2]), sum(scale(sum(prod(m0[1], m2[0]), prod(-m2[1], m0[0])), -m1[2]), scale(sum(prod(m0[1], m1[0]), prod(-m1[1], m0[0])), m2[2]))), -m4[3]))));\n var d = sub(p, n);\n return d[d.length - 1];\n };\n }\n function orientation(n) {\n var fn = n === 3 ? orientation_3 : n === 4 ? orientation_4 : orientation_5;\n return fn(robustSum, twoProduct, robustScale, robustSubtract);\n }\n var orientation3Exact = orientation(3);\n var orientation4Exact = orientation(4);\n var CACHED = [\n function orientation0() {\n return 0;\n },\n function orientation1() {\n return 0;\n },\n function orientation2(a, b) {\n return b[0] - a[0];\n },\n function orientation3(a, b, c) {\n var l = (a[1] - c[1]) * (b[0] - c[0]);\n var r = (a[0] - c[0]) * (b[1] - c[1]);\n var det = l - r;\n var s;\n if (l > 0) {\n if (r <= 0) {\n return det;\n } else {\n s = l + r;\n }\n } else if (l < 0) {\n if (r >= 0) {\n return det;\n } else {\n s = -(l + r);\n }\n } else {\n return det;\n }\n var tol = ERRBOUND3 * s;\n if (det >= tol || det <= -tol) {\n return det;\n }\n return orientation3Exact(a, b, c);\n },\n function orientation4(a, b, c, d) {\n var adx = a[0] - d[0];\n var bdx = b[0] - d[0];\n var cdx = c[0] - d[0];\n var ady = a[1] - d[1];\n var bdy = b[1] - d[1];\n var cdy = c[1] - d[1];\n var adz = a[2] - d[2];\n var bdz = b[2] - d[2];\n var cdz = c[2] - d[2];\n var bdxcdy = bdx * cdy;\n var cdxbdy = cdx * bdy;\n var cdxady = cdx * ady;\n var adxcdy = adx * cdy;\n var adxbdy = adx * bdy;\n var bdxady = bdx * ady;\n var det = adz * (bdxcdy - cdxbdy) + bdz * (cdxady - adxcdy) + cdz * (adxbdy - bdxady);\n var permanent = (Math.abs(bdxcdy) + Math.abs(cdxbdy)) * Math.abs(adz) + (Math.abs(cdxady) + Math.abs(adxcdy)) * Math.abs(bdz) + (Math.abs(adxbdy) + Math.abs(bdxady)) * Math.abs(cdz);\n var tol = ERRBOUND4 * permanent;\n if (det > tol || -det > tol) {\n return det;\n }\n return orientation4Exact(a, b, c, d);\n }\n ];\n function slowOrient(args) {\n var proc2 = CACHED[args.length];\n if (!proc2) {\n proc2 = CACHED[args.length] = orientation(args.length);\n }\n return proc2.apply(void 0, args);\n }\n function proc(slow, o0, o1, o2, o3, o4, o5) {\n return function getOrientation(a0, a1, a2, a3, a4) {\n switch (arguments.length) {\n case 0:\n case 1:\n return 0;\n case 2:\n return o2(a0, a1);\n case 3:\n return o3(a0, a1, a2);\n case 4:\n return o4(a0, a1, a2, a3);\n case 5:\n return o5(a0, a1, a2, a3, a4);\n }\n var s = new Array(arguments.length);\n for (var i = 0; i < arguments.length; ++i) {\n s[i] = arguments[i];\n }\n return slow(s);\n };\n }\n function generateOrientationProc() {\n while (CACHED.length <= NUM_EXPAND) {\n CACHED.push(orientation(CACHED.length));\n }\n module2.exports = proc.apply(void 0, [slowOrient].concat(CACHED));\n for (var i = 0; i <= NUM_EXPAND; ++i) {\n module2.exports[i] = CACHED[i];\n }\n }\n generateOrientationProc();\n }\n ),\n /***/\n 5382: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var robustSum = __webpack_require__2(8210);\n var robustScale = __webpack_require__2(3012);\n module2.exports = robustProduct;\n function robustProduct(a, b) {\n if (a.length === 1) {\n return robustScale(b, a[0]);\n }\n if (b.length === 1) {\n return robustScale(a, b[0]);\n }\n if (a.length === 0 || b.length === 0) {\n return [0];\n }\n var r = [0];\n if (a.length < b.length) {\n for (var i = 0; i < a.length; ++i) {\n r = robustSum(r, robustScale(b, a[i]));\n }\n } else {\n for (var i = 0; i < b.length; ++i) {\n r = robustSum(r, robustScale(a, b[i]));\n }\n }\n return r;\n }\n }\n ),\n /***/\n 3012: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var twoProduct = __webpack_require__2(5250);\n var twoSum = __webpack_require__2(9362);\n module2.exports = scaleLinearExpansion;\n function scaleLinearExpansion(e, scale) {\n var n = e.length;\n if (n === 1) {\n var ts = twoProduct(e[0], scale);\n if (ts[0]) {\n return ts;\n }\n return [ts[1]];\n }\n var g = new Array(2 * n);\n var q = [0.1, 0.1];\n var t = [0.1, 0.1];\n var count = 0;\n twoProduct(e[0], scale, q);\n if (q[0]) {\n g[count++] = q[0];\n }\n for (var i = 1; i < n; ++i) {\n twoProduct(e[i], scale, t);\n var pq = q[1];\n twoSum(pq, t[0], q);\n if (q[0]) {\n g[count++] = q[0];\n }\n var a = t[1];\n var b = q[1];\n var x = a + b;\n var bv = x - a;\n var y = b - bv;\n q[1] = x;\n if (y) {\n g[count++] = y;\n }\n }\n if (q[1]) {\n g[count++] = q[1];\n }\n if (count === 0) {\n g[count++] = 0;\n }\n g.length = count;\n return g;\n }\n }\n ),\n /***/\n 1125: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = segmentsIntersect;\n var orient = __webpack_require__2(3250)[3];\n function checkCollinear(a0, a1, b0, b1) {\n for (var d = 0; d < 2; ++d) {\n var x0 = a0[d];\n var y0 = a1[d];\n var l0 = Math.min(x0, y0);\n var h0 = Math.max(x0, y0);\n var x1 = b0[d];\n var y1 = b1[d];\n var l1 = Math.min(x1, y1);\n var h1 = Math.max(x1, y1);\n if (h1 < l0 || h0 < l1) {\n return false;\n }\n }\n return true;\n }\n function segmentsIntersect(a0, a1, b0, b1) {\n var x0 = orient(a0, b0, b1);\n var y0 = orient(a1, b0, b1);\n if (x0 > 0 && y0 > 0 || x0 < 0 && y0 < 0) {\n return false;\n }\n var x1 = orient(b0, a0, a1);\n var y1 = orient(b1, a0, a1);\n if (x1 > 0 && y1 > 0 || x1 < 0 && y1 < 0) {\n return false;\n }\n if (x0 === 0 && y0 === 0 && x1 === 0 && y1 === 0) {\n return checkCollinear(a0, a1, b0, b1);\n }\n return true;\n }\n }\n ),\n /***/\n 8545: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = robustSubtract;\n function scalarScalar(a, b) {\n var x = a + b;\n var bv = x - a;\n var av = x - bv;\n var br = b - bv;\n var ar = a - av;\n var y = ar + br;\n if (y) {\n return [y, x];\n }\n return [x];\n }\n function robustSubtract(e, f) {\n var ne = e.length | 0;\n var nf = f.length | 0;\n if (ne === 1 && nf === 1) {\n return scalarScalar(e[0], -f[0]);\n }\n var n = ne + nf;\n var g = new Array(n);\n var count = 0;\n var eptr = 0;\n var fptr = 0;\n var abs = Math.abs;\n var ei = e[eptr];\n var ea = abs(ei);\n var fi = -f[fptr];\n var fa = abs(fi);\n var a, b;\n if (ea < fa) {\n b = ei;\n eptr += 1;\n if (eptr < ne) {\n ei = e[eptr];\n ea = abs(ei);\n }\n } else {\n b = fi;\n fptr += 1;\n if (fptr < nf) {\n fi = -f[fptr];\n fa = abs(fi);\n }\n }\n if (eptr < ne && ea < fa || fptr >= nf) {\n a = ei;\n eptr += 1;\n if (eptr < ne) {\n ei = e[eptr];\n ea = abs(ei);\n }\n } else {\n a = fi;\n fptr += 1;\n if (fptr < nf) {\n fi = -f[fptr];\n fa = abs(fi);\n }\n }\n var x = a + b;\n var bv = x - a;\n var y = b - bv;\n var q0 = y;\n var q1 = x;\n var _x, _bv, _av, _br, _ar;\n while (eptr < ne && fptr < nf) {\n if (ea < fa) {\n a = ei;\n eptr += 1;\n if (eptr < ne) {\n ei = e[eptr];\n ea = abs(ei);\n }\n } else {\n a = fi;\n fptr += 1;\n if (fptr < nf) {\n fi = -f[fptr];\n fa = abs(fi);\n }\n }\n b = q0;\n x = a + b;\n bv = x - a;\n y = b - bv;\n if (y) {\n g[count++] = y;\n }\n _x = q1 + x;\n _bv = _x - q1;\n _av = _x - _bv;\n _br = x - _bv;\n _ar = q1 - _av;\n q0 = _ar + _br;\n q1 = _x;\n }\n while (eptr < ne) {\n a = ei;\n b = q0;\n x = a + b;\n bv = x - a;\n y = b - bv;\n if (y) {\n g[count++] = y;\n }\n _x = q1 + x;\n _bv = _x - q1;\n _av = _x - _bv;\n _br = x - _bv;\n _ar = q1 - _av;\n q0 = _ar + _br;\n q1 = _x;\n eptr += 1;\n if (eptr < ne) {\n ei = e[eptr];\n }\n }\n while (fptr < nf) {\n a = fi;\n b = q0;\n x = a + b;\n bv = x - a;\n y = b - bv;\n if (y) {\n g[count++] = y;\n }\n _x = q1 + x;\n _bv = _x - q1;\n _av = _x - _bv;\n _br = x - _bv;\n _ar = q1 - _av;\n q0 = _ar + _br;\n q1 = _x;\n fptr += 1;\n if (fptr < nf) {\n fi = -f[fptr];\n }\n }\n if (q0) {\n g[count++] = q0;\n }\n if (q1) {\n g[count++] = q1;\n }\n if (!count) {\n g[count++] = 0;\n }\n g.length = count;\n return g;\n }\n }\n ),\n /***/\n 8210: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = linearExpansionSum;\n function scalarScalar(a, b) {\n var x = a + b;\n var bv = x - a;\n var av = x - bv;\n var br = b - bv;\n var ar = a - av;\n var y = ar + br;\n if (y) {\n return [y, x];\n }\n return [x];\n }\n function linearExpansionSum(e, f) {\n var ne = e.length | 0;\n var nf = f.length | 0;\n if (ne === 1 && nf === 1) {\n return scalarScalar(e[0], f[0]);\n }\n var n = ne + nf;\n var g = new Array(n);\n var count = 0;\n var eptr = 0;\n var fptr = 0;\n var abs = Math.abs;\n var ei = e[eptr];\n var ea = abs(ei);\n var fi = f[fptr];\n var fa = abs(fi);\n var a, b;\n if (ea < fa) {\n b = ei;\n eptr += 1;\n if (eptr < ne) {\n ei = e[eptr];\n ea = abs(ei);\n }\n } else {\n b = fi;\n fptr += 1;\n if (fptr < nf) {\n fi = f[fptr];\n fa = abs(fi);\n }\n }\n if (eptr < ne && ea < fa || fptr >= nf) {\n a = ei;\n eptr += 1;\n if (eptr < ne) {\n ei = e[eptr];\n ea = abs(ei);\n }\n } else {\n a = fi;\n fptr += 1;\n if (fptr < nf) {\n fi = f[fptr];\n fa = abs(fi);\n }\n }\n var x = a + b;\n var bv = x - a;\n var y = b - bv;\n var q0 = y;\n var q1 = x;\n var _x, _bv, _av, _br, _ar;\n while (eptr < ne && fptr < nf) {\n if (ea < fa) {\n a = ei;\n eptr += 1;\n if (eptr < ne) {\n ei = e[eptr];\n ea = abs(ei);\n }\n } else {\n a = fi;\n fptr += 1;\n if (fptr < nf) {\n fi = f[fptr];\n fa = abs(fi);\n }\n }\n b = q0;\n x = a + b;\n bv = x - a;\n y = b - bv;\n if (y) {\n g[count++] = y;\n }\n _x = q1 + x;\n _bv = _x - q1;\n _av = _x - _bv;\n _br = x - _bv;\n _ar = q1 - _av;\n q0 = _ar + _br;\n q1 = _x;\n }\n while (eptr < ne) {\n a = ei;\n b = q0;\n x = a + b;\n bv = x - a;\n y = b - bv;\n if (y) {\n g[count++] = y;\n }\n _x = q1 + x;\n _bv = _x - q1;\n _av = _x - _bv;\n _br = x - _bv;\n _ar = q1 - _av;\n q0 = _ar + _br;\n q1 = _x;\n eptr += 1;\n if (eptr < ne) {\n ei = e[eptr];\n }\n }\n while (fptr < nf) {\n a = fi;\n b = q0;\n x = a + b;\n bv = x - a;\n y = b - bv;\n if (y) {\n g[count++] = y;\n }\n _x = q1 + x;\n _bv = _x - q1;\n _av = _x - _bv;\n _br = x - _bv;\n _ar = q1 - _av;\n q0 = _ar + _br;\n q1 = _x;\n fptr += 1;\n if (fptr < nf) {\n fi = f[fptr];\n }\n }\n if (q0) {\n g[count++] = q0;\n }\n if (q1) {\n g[count++] = q1;\n }\n if (!count) {\n g[count++] = 0;\n }\n g.length = count;\n return g;\n }\n }\n ),\n /***/\n 9127: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = boundary;\n var bnd = __webpack_require__2(6204);\n var reduce = __webpack_require__2(5771);\n function boundary(cells) {\n return reduce(bnd(cells));\n }\n }\n ),\n /***/\n 7765: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = extractContour;\n var ndarray = __webpack_require__2(9618);\n var pool = __webpack_require__2(1888);\n var ndsort = __webpack_require__2(446);\n var contourAlgorithm = __webpack_require__2(1570);\n function getDimension(cells) {\n var numCells = cells.length;\n var d = 0;\n for (var i = 0; i < numCells; ++i) {\n d = Math.max(d, cells[i].length) | 0;\n }\n return d - 1;\n }\n function getSigns(values, level) {\n var numVerts = values.length;\n var vertexSigns = pool.mallocUint8(numVerts);\n for (var i = 0; i < numVerts; ++i) {\n vertexSigns[i] = values[i] < level | 0;\n }\n return vertexSigns;\n }\n function getEdges(cells, d) {\n var numCells = cells.length;\n var maxEdges = d * (d + 1) / 2 * numCells | 0;\n var edges = pool.mallocUint32(maxEdges * 2);\n var ePtr = 0;\n for (var i = 0; i < numCells; ++i) {\n var c = cells[i];\n var d = c.length;\n for (var j = 0; j < d; ++j) {\n for (var k = 0; k < j; ++k) {\n var a = c[k];\n var b = c[j];\n edges[ePtr++] = Math.min(a, b) | 0;\n edges[ePtr++] = Math.max(a, b) | 0;\n }\n }\n }\n var nedges = ePtr / 2 | 0;\n ndsort(ndarray(edges, [nedges, 2]));\n var ptr = 2;\n for (var i = 2; i < ePtr; i += 2) {\n if (edges[i - 2] === edges[i] && edges[i - 1] === edges[i + 1]) {\n continue;\n }\n edges[ptr++] = edges[i];\n edges[ptr++] = edges[i + 1];\n }\n return ndarray(edges, [ptr / 2 | 0, 2]);\n }\n function getCrossingWeights(edges, values, signs, level) {\n var edata = edges.data;\n var numEdges = edges.shape[0];\n var weights = pool.mallocDouble(numEdges);\n var ptr = 0;\n for (var i = 0; i < numEdges; ++i) {\n var a = edata[2 * i];\n var b = edata[2 * i + 1];\n if (signs[a] === signs[b]) {\n continue;\n }\n var va = values[a];\n var vb = values[b];\n edata[2 * ptr] = a;\n edata[2 * ptr + 1] = b;\n weights[ptr++] = (vb - level) / (vb - va);\n }\n edges.shape[0] = ptr;\n return ndarray(weights, [ptr]);\n }\n function getCascade(edges, numVerts) {\n var result = pool.mallocInt32(numVerts * 2);\n var numEdges = edges.shape[0];\n var edata = edges.data;\n result[0] = 0;\n var lastV = 0;\n for (var i = 0; i < numEdges; ++i) {\n var a = edata[2 * i];\n if (a !== lastV) {\n result[2 * lastV + 1] = i;\n while (++lastV < a) {\n result[2 * lastV] = i;\n result[2 * lastV + 1] = i;\n }\n result[2 * lastV] = i;\n }\n }\n result[2 * lastV + 1] = numEdges;\n while (++lastV < numVerts) {\n result[2 * lastV] = result[2 * lastV + 1] = numEdges;\n }\n return result;\n }\n function unpackEdges(edges) {\n var ne = edges.shape[0] | 0;\n var edata = edges.data;\n var result = new Array(ne);\n for (var i = 0; i < ne; ++i) {\n result[i] = [edata[2 * i], edata[2 * i + 1]];\n }\n return result;\n }\n function extractContour(cells, values, level, d) {\n level = level || 0;\n if (typeof d === \"undefined\") {\n d = getDimension(cells);\n }\n var numCells = cells.length;\n if (numCells === 0 || d < 1) {\n return {\n cells: [],\n vertexIds: [],\n vertexWeights: []\n };\n }\n var vertexSigns = getSigns(values, +level);\n var edges = getEdges(cells, d);\n var weights = getCrossingWeights(edges, values, vertexSigns, +level);\n var vcascade = getCascade(edges, values.length | 0);\n var faces = contourAlgorithm(d)(cells, edges.data, vcascade, vertexSigns);\n var uedges = unpackEdges(edges);\n var uweights = [].slice.call(weights.data, 0, weights.shape[0]);\n pool.free(vertexSigns);\n pool.free(edges.data);\n pool.free(weights.data);\n pool.free(vcascade);\n return {\n cells: faces,\n vertexIds: uedges,\n vertexWeights: uweights\n };\n }\n }\n ),\n /***/\n 1570: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = getPolygonizer;\n var allFns = [\n function cellPolygonizer_0() {\n function B2(C2, E2, i, j) {\n var a = Math.min(i, j) | 0, b = Math.max(i, j) | 0, l = C2[2 * a], h = C2[2 * a + 1];\n while (l < h) {\n var m = l + h >> 1, v = E2[2 * m + 1];\n if (v === b) {\n return m;\n }\n if (b < v) {\n h = m;\n } else {\n l = m + 1;\n }\n }\n return l;\n }\n function getContour0d(F, E2, C2, S) {\n var n = F.length, R = [];\n for (var i = 0; i < n; ++i) {\n var c = F[i], l = c.length;\n }\n return R;\n }\n return getContour0d;\n },\n function cellPolygonizer_1() {\n function B2(C2, E2, i, j) {\n var a = Math.min(i, j) | 0, b = Math.max(i, j) | 0, l = C2[2 * a], h = C2[2 * a + 1];\n while (l < h) {\n var m = l + h >> 1, v = E2[2 * m + 1];\n if (v === b) {\n return m;\n }\n if (b < v) {\n h = m;\n } else {\n l = m + 1;\n }\n }\n return l;\n }\n function getContour1d(F, E2, C2, S) {\n var n = F.length, R = [];\n for (var i = 0; i < n; ++i) {\n var c = F[i], l = c.length;\n if (l === 2) {\n var M = (S[c[0]] << 0) + (S[c[1]] << 1);\n if (M === 0 || M === 3) {\n continue;\n }\n switch (M) {\n case 0:\n break;\n case 1:\n R.push([B2(C2, E2, c[0], c[1])]);\n break;\n case 2:\n R.push([B2(C2, E2, c[1], c[0])]);\n break;\n case 3:\n break;\n }\n }\n }\n return R;\n }\n return getContour1d;\n },\n function cellPolygonizer_2() {\n function B2(C2, E2, i, j) {\n var a = Math.min(i, j) | 0, b = Math.max(i, j) | 0, l = C2[2 * a], h = C2[2 * a + 1];\n while (l < h) {\n var m = l + h >> 1, v = E2[2 * m + 1];\n if (v === b) {\n return m;\n }\n if (b < v) {\n h = m;\n } else {\n l = m + 1;\n }\n }\n return l;\n }\n function getContour2d(F, E2, C2, S) {\n var n = F.length, R = [];\n for (var i = 0; i < n; ++i) {\n var c = F[i], l = c.length;\n if (l === 3) {\n var M = (S[c[0]] << 0) + (S[c[1]] << 1) + (S[c[2]] << 2);\n if (M === 0 || M === 7) {\n continue;\n }\n switch (M) {\n case 0:\n break;\n case 1:\n R.push([B2(C2, E2, c[0], c[2]), B2(C2, E2, c[0], c[1])]);\n break;\n case 2:\n R.push([B2(C2, E2, c[1], c[0]), B2(C2, E2, c[1], c[2])]);\n break;\n case 3:\n R.push([B2(C2, E2, c[0], c[2]), B2(C2, E2, c[1], c[2])]);\n break;\n case 4:\n R.push([B2(C2, E2, c[2], c[1]), B2(C2, E2, c[2], c[0])]);\n break;\n case 5:\n R.push([B2(C2, E2, c[2], c[1]), B2(C2, E2, c[0], c[1])]);\n break;\n case 6:\n R.push([B2(C2, E2, c[1], c[0]), B2(C2, E2, c[2], c[0])]);\n break;\n case 7:\n break;\n }\n } else if (l === 2) {\n var M = (S[c[0]] << 0) + (S[c[1]] << 1);\n if (M === 0 || M === 3) {\n continue;\n }\n switch (M) {\n case 0:\n break;\n case 1:\n R.push([B2(C2, E2, c[0], c[1])]);\n break;\n case 2:\n R.push([B2(C2, E2, c[1], c[0])]);\n break;\n case 3:\n break;\n }\n }\n }\n return R;\n }\n return getContour2d;\n },\n function cellPolygonizer_3() {\n function B2(C2, E2, i, j) {\n var a = Math.min(i, j) | 0, b = Math.max(i, j) | 0, l = C2[2 * a], h = C2[2 * a + 1];\n while (l < h) {\n var m = l + h >> 1, v = E2[2 * m + 1];\n if (v === b) {\n return m;\n }\n if (b < v) {\n h = m;\n } else {\n l = m + 1;\n }\n }\n return l;\n }\n function getContour3d(F, E2, C2, S) {\n var n = F.length, R = [];\n for (var i = 0; i < n; ++i) {\n var c = F[i], l = c.length;\n if (l === 4) {\n var M = (S[c[0]] << 0) + (S[c[1]] << 1) + (S[c[2]] << 2) + (S[c[3]] << 3);\n if (M === 0 || M === 15) {\n continue;\n }\n switch (M) {\n case 0:\n break;\n case 1:\n R.push([B2(C2, E2, c[0], c[1]), B2(C2, E2, c[0], c[2]), B2(C2, E2, c[0], c[3])]);\n break;\n case 2:\n R.push([B2(C2, E2, c[1], c[2]), B2(C2, E2, c[1], c[0]), B2(C2, E2, c[1], c[3])]);\n break;\n case 3:\n R.push([B2(C2, E2, c[1], c[2]), B2(C2, E2, c[0], c[2]), B2(C2, E2, c[0], c[3])], [B2(C2, E2, c[1], c[3]), B2(C2, E2, c[1], c[2]), B2(C2, E2, c[0], c[3])]);\n break;\n case 4:\n R.push([B2(C2, E2, c[2], c[0]), B2(C2, E2, c[2], c[1]), B2(C2, E2, c[2], c[3])]);\n break;\n case 5:\n R.push([B2(C2, E2, c[0], c[1]), B2(C2, E2, c[2], c[1]), B2(C2, E2, c[0], c[3])], [B2(C2, E2, c[2], c[1]), B2(C2, E2, c[2], c[3]), B2(C2, E2, c[0], c[3])]);\n break;\n case 6:\n R.push([B2(C2, E2, c[2], c[0]), B2(C2, E2, c[1], c[0]), B2(C2, E2, c[1], c[3])], [B2(C2, E2, c[2], c[3]), B2(C2, E2, c[2], c[0]), B2(C2, E2, c[1], c[3])]);\n break;\n case 7:\n R.push([B2(C2, E2, c[0], c[3]), B2(C2, E2, c[1], c[3]), B2(C2, E2, c[2], c[3])]);\n break;\n case 8:\n R.push([B2(C2, E2, c[3], c[1]), B2(C2, E2, c[3], c[0]), B2(C2, E2, c[3], c[2])]);\n break;\n case 9:\n R.push([B2(C2, E2, c[3], c[1]), B2(C2, E2, c[0], c[1]), B2(C2, E2, c[0], c[2])], [B2(C2, E2, c[3], c[2]), B2(C2, E2, c[3], c[1]), B2(C2, E2, c[0], c[2])]);\n break;\n case 10:\n R.push([B2(C2, E2, c[1], c[0]), B2(C2, E2, c[3], c[0]), B2(C2, E2, c[1], c[2])], [B2(C2, E2, c[3], c[0]), B2(C2, E2, c[3], c[2]), B2(C2, E2, c[1], c[2])]);\n break;\n case 11:\n R.push([B2(C2, E2, c[1], c[2]), B2(C2, E2, c[0], c[2]), B2(C2, E2, c[3], c[2])]);\n break;\n case 12:\n R.push([B2(C2, E2, c[3], c[0]), B2(C2, E2, c[2], c[0]), B2(C2, E2, c[2], c[1])], [B2(C2, E2, c[3], c[1]), B2(C2, E2, c[3], c[0]), B2(C2, E2, c[2], c[1])]);\n break;\n case 13:\n R.push([B2(C2, E2, c[0], c[1]), B2(C2, E2, c[2], c[1]), B2(C2, E2, c[3], c[1])]);\n break;\n case 14:\n R.push([B2(C2, E2, c[2], c[0]), B2(C2, E2, c[1], c[0]), B2(C2, E2, c[3], c[0])]);\n break;\n case 15:\n break;\n }\n } else if (l === 3) {\n var M = (S[c[0]] << 0) + (S[c[1]] << 1) + (S[c[2]] << 2);\n if (M === 0 || M === 7) {\n continue;\n }\n switch (M) {\n case 0:\n break;\n case 1:\n R.push([B2(C2, E2, c[0], c[2]), B2(C2, E2, c[0], c[1])]);\n break;\n case 2:\n R.push([B2(C2, E2, c[1], c[0]), B2(C2, E2, c[1], c[2])]);\n break;\n case 3:\n R.push([B2(C2, E2, c[0], c[2]), B2(C2, E2, c[1], c[2])]);\n break;\n case 4:\n R.push([B2(C2, E2, c[2], c[1]), B2(C2, E2, c[2], c[0])]);\n break;\n case 5:\n R.push([B2(C2, E2, c[2], c[1]), B2(C2, E2, c[0], c[1])]);\n break;\n case 6:\n R.push([B2(C2, E2, c[1], c[0]), B2(C2, E2, c[2], c[0])]);\n break;\n case 7:\n break;\n }\n } else if (l === 2) {\n var M = (S[c[0]] << 0) + (S[c[1]] << 1);\n if (M === 0 || M === 3) {\n continue;\n }\n switch (M) {\n case 0:\n break;\n case 1:\n R.push([B2(C2, E2, c[0], c[1])]);\n break;\n case 2:\n R.push([B2(C2, E2, c[1], c[0])]);\n break;\n case 3:\n break;\n }\n }\n }\n return R;\n }\n return getContour3d;\n }\n ];\n function getPolygonizer(d) {\n return allFns[d]();\n }\n }\n ),\n /***/\n 6803: (\n /***/\n function(__unused_webpack_module, exports2, __webpack_require__2) {\n \"use strict\";\n var __webpack_unused_export__;\n \"use restrict\";\n var bits = __webpack_require__2(8828), UnionFind = __webpack_require__2(1755);\n function dimension(cells) {\n var d = 0, max = Math.max;\n for (var i = 0, il = cells.length; i < il; ++i) {\n d = max(d, cells[i].length);\n }\n return d - 1;\n }\n __webpack_unused_export__ = dimension;\n function countVertices(cells) {\n var vc = -1, max = Math.max;\n for (var i = 0, il = cells.length; i < il; ++i) {\n var c = cells[i];\n for (var j = 0, jl = c.length; j < jl; ++j) {\n vc = max(vc, c[j]);\n }\n }\n return vc + 1;\n }\n __webpack_unused_export__ = countVertices;\n function cloneCells(cells) {\n var ncells = new Array(cells.length);\n for (var i = 0, il = cells.length; i < il; ++i) {\n ncells[i] = cells[i].slice(0);\n }\n return ncells;\n }\n __webpack_unused_export__ = cloneCells;\n function compareCells(a, b) {\n var n = a.length, t = a.length - b.length, min = Math.min;\n if (t) {\n return t;\n }\n switch (n) {\n case 0:\n return 0;\n case 1:\n return a[0] - b[0];\n case 2:\n var d = a[0] + a[1] - b[0] - b[1];\n if (d) {\n return d;\n }\n return min(a[0], a[1]) - min(b[0], b[1]);\n case 3:\n var l1 = a[0] + a[1], m1 = b[0] + b[1];\n d = l1 + a[2] - (m1 + b[2]);\n if (d) {\n return d;\n }\n var l0 = min(a[0], a[1]), m0 = min(b[0], b[1]), d = min(l0, a[2]) - min(m0, b[2]);\n if (d) {\n return d;\n }\n return min(l0 + a[2], l1) - min(m0 + b[2], m1);\n //TODO: Maybe optimize n=4 as well?\n default:\n var as = a.slice(0);\n as.sort();\n var bs = b.slice(0);\n bs.sort();\n for (var i = 0; i < n; ++i) {\n t = as[i] - bs[i];\n if (t) {\n return t;\n }\n }\n return 0;\n }\n }\n exports2.Fw = compareCells;\n function compareZipped(a, b) {\n return compareCells(a[0], b[0]);\n }\n function normalize(cells, attr) {\n if (attr) {\n var len = cells.length;\n var zipped = new Array(len);\n for (var i = 0; i < len; ++i) {\n zipped[i] = [cells[i], attr[i]];\n }\n zipped.sort(compareZipped);\n for (var i = 0; i < len; ++i) {\n cells[i] = zipped[i][0];\n attr[i] = zipped[i][1];\n }\n return cells;\n } else {\n cells.sort(compareCells);\n return cells;\n }\n }\n __webpack_unused_export__ = normalize;\n function unique(cells) {\n if (cells.length === 0) {\n return [];\n }\n var ptr = 1, len = cells.length;\n for (var i = 1; i < len; ++i) {\n var a = cells[i];\n if (compareCells(a, cells[i - 1])) {\n if (i === ptr) {\n ptr++;\n continue;\n }\n cells[ptr++] = a;\n }\n }\n cells.length = ptr;\n return cells;\n }\n __webpack_unused_export__ = unique;\n function findCell(cells, c) {\n var lo = 0, hi = cells.length - 1, r = -1;\n while (lo <= hi) {\n var mid = lo + hi >> 1, s = compareCells(cells[mid], c);\n if (s <= 0) {\n if (s === 0) {\n r = mid;\n }\n lo = mid + 1;\n } else if (s > 0) {\n hi = mid - 1;\n }\n }\n return r;\n }\n __webpack_unused_export__ = findCell;\n function incidence(from_cells, to_cells) {\n var index = new Array(from_cells.length);\n for (var i = 0, il = index.length; i < il; ++i) {\n index[i] = [];\n }\n var b = [];\n for (var i = 0, n = to_cells.length; i < n; ++i) {\n var c = to_cells[i];\n var cl = c.length;\n for (var k = 1, kn = 1 << cl; k < kn; ++k) {\n b.length = bits.popCount(k);\n var l = 0;\n for (var j = 0; j < cl; ++j) {\n if (k & 1 << j) {\n b[l++] = c[j];\n }\n }\n var idx = findCell(from_cells, b);\n if (idx < 0) {\n continue;\n }\n while (true) {\n index[idx++].push(i);\n if (idx >= from_cells.length || compareCells(from_cells[idx], b) !== 0) {\n break;\n }\n }\n }\n }\n return index;\n }\n __webpack_unused_export__ = incidence;\n function dual(cells, vertex_count) {\n if (!vertex_count) {\n return incidence(unique(skeleton(cells, 0)), cells, 0);\n }\n var res = new Array(vertex_count);\n for (var i = 0; i < vertex_count; ++i) {\n res[i] = [];\n }\n for (var i = 0, len = cells.length; i < len; ++i) {\n var c = cells[i];\n for (var j = 0, cl = c.length; j < cl; ++j) {\n res[c[j]].push(i);\n }\n }\n return res;\n }\n __webpack_unused_export__ = dual;\n function explode(cells) {\n var result = [];\n for (var i = 0, il = cells.length; i < il; ++i) {\n var c = cells[i], cl = c.length | 0;\n for (var j = 1, jl = 1 << cl; j < jl; ++j) {\n var b = [];\n for (var k = 0; k < cl; ++k) {\n if (j >>> k & 1) {\n b.push(c[k]);\n }\n }\n result.push(b);\n }\n }\n return normalize(result);\n }\n __webpack_unused_export__ = explode;\n function skeleton(cells, n) {\n if (n < 0) {\n return [];\n }\n var result = [], k0 = (1 << n + 1) - 1;\n for (var i = 0; i < cells.length; ++i) {\n var c = cells[i];\n for (var k = k0; k < 1 << c.length; k = bits.nextCombination(k)) {\n var b = new Array(n + 1), l = 0;\n for (var j = 0; j < c.length; ++j) {\n if (k & 1 << j) {\n b[l++] = c[j];\n }\n }\n result.push(b);\n }\n }\n return normalize(result);\n }\n __webpack_unused_export__ = skeleton;\n function boundary(cells) {\n var res = [];\n for (var i = 0, il = cells.length; i < il; ++i) {\n var c = cells[i];\n for (var j = 0, cl = c.length; j < cl; ++j) {\n var b = new Array(c.length - 1);\n for (var k = 0, l = 0; k < cl; ++k) {\n if (k !== j) {\n b[l++] = c[k];\n }\n }\n res.push(b);\n }\n }\n return normalize(res);\n }\n __webpack_unused_export__ = boundary;\n function connectedComponents_dense(cells, vertex_count) {\n var labels = new UnionFind(vertex_count);\n for (var i = 0; i < cells.length; ++i) {\n var c = cells[i];\n for (var j = 0; j < c.length; ++j) {\n for (var k = j + 1; k < c.length; ++k) {\n labels.link(c[j], c[k]);\n }\n }\n }\n var components = [], component_labels = labels.ranks;\n for (var i = 0; i < component_labels.length; ++i) {\n component_labels[i] = -1;\n }\n for (var i = 0; i < cells.length; ++i) {\n var l = labels.find(cells[i][0]);\n if (component_labels[l] < 0) {\n component_labels[l] = components.length;\n components.push([cells[i].slice(0)]);\n } else {\n components[component_labels[l]].push(cells[i].slice(0));\n }\n }\n return components;\n }\n function connectedComponents_sparse(cells) {\n var vertices = unique(normalize(skeleton(cells, 0))), labels = new UnionFind(vertices.length);\n for (var i = 0; i < cells.length; ++i) {\n var c = cells[i];\n for (var j = 0; j < c.length; ++j) {\n var vj = findCell(vertices, [c[j]]);\n for (var k = j + 1; k < c.length; ++k) {\n labels.link(vj, findCell(vertices, [c[k]]));\n }\n }\n }\n var components = [], component_labels = labels.ranks;\n for (var i = 0; i < component_labels.length; ++i) {\n component_labels[i] = -1;\n }\n for (var i = 0; i < cells.length; ++i) {\n var l = labels.find(findCell(vertices, [cells[i][0]]));\n if (component_labels[l] < 0) {\n component_labels[l] = components.length;\n components.push([cells[i].slice(0)]);\n } else {\n components[component_labels[l]].push(cells[i].slice(0));\n }\n }\n return components;\n }\n function connectedComponents(cells, vertex_count) {\n if (vertex_count) {\n return connectedComponents_dense(cells, vertex_count);\n }\n return connectedComponents_sparse(cells);\n }\n __webpack_unused_export__ = connectedComponents;\n }\n ),\n /***/\n 3105: (\n /***/\n function(__unused_webpack_module, exports2) {\n \"use strict\";\n \"use restrict\";\n var INT_BITS = 32;\n exports2.INT_BITS = INT_BITS;\n exports2.INT_MAX = 2147483647;\n exports2.INT_MIN = -1 << INT_BITS - 1;\n exports2.sign = function(v) {\n return (v > 0) - (v < 0);\n };\n exports2.abs = function(v) {\n var mask = v >> INT_BITS - 1;\n return (v ^ mask) - mask;\n };\n exports2.min = function(x, y) {\n return y ^ (x ^ y) & -(x < y);\n };\n exports2.max = function(x, y) {\n return x ^ (x ^ y) & -(x < y);\n };\n exports2.isPow2 = function(v) {\n return !(v & v - 1) && !!v;\n };\n exports2.log2 = function(v) {\n var r, shift;\n r = (v > 65535) << 4;\n v >>>= r;\n shift = (v > 255) << 3;\n v >>>= shift;\n r |= shift;\n shift = (v > 15) << 2;\n v >>>= shift;\n r |= shift;\n shift = (v > 3) << 1;\n v >>>= shift;\n r |= shift;\n return r | v >> 1;\n };\n exports2.log10 = function(v) {\n return v >= 1e9 ? 9 : v >= 1e8 ? 8 : v >= 1e7 ? 7 : v >= 1e6 ? 6 : v >= 1e5 ? 5 : v >= 1e4 ? 4 : v >= 1e3 ? 3 : v >= 100 ? 2 : v >= 10 ? 1 : 0;\n };\n exports2.popCount = function(v) {\n v = v - (v >>> 1 & 1431655765);\n v = (v & 858993459) + (v >>> 2 & 858993459);\n return (v + (v >>> 4) & 252645135) * 16843009 >>> 24;\n };\n function countTrailingZeros(v) {\n var c = 32;\n v &= -v;\n if (v) c--;\n if (v & 65535) c -= 16;\n if (v & 16711935) c -= 8;\n if (v & 252645135) c -= 4;\n if (v & 858993459) c -= 2;\n if (v & 1431655765) c -= 1;\n return c;\n }\n exports2.countTrailingZeros = countTrailingZeros;\n exports2.nextPow2 = function(v) {\n v += v === 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n return v + 1;\n };\n exports2.prevPow2 = function(v) {\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n return v - (v >>> 1);\n };\n exports2.parity = function(v) {\n v ^= v >>> 16;\n v ^= v >>> 8;\n v ^= v >>> 4;\n v &= 15;\n return 27030 >>> v & 1;\n };\n var REVERSE_TABLE = new Array(256);\n (function(tab) {\n for (var i = 0; i < 256; ++i) {\n var v = i, r = i, s = 7;\n for (v >>>= 1; v; v >>>= 1) {\n r <<= 1;\n r |= v & 1;\n --s;\n }\n tab[i] = r << s & 255;\n }\n })(REVERSE_TABLE);\n exports2.reverse = function(v) {\n return REVERSE_TABLE[v & 255] << 24 | REVERSE_TABLE[v >>> 8 & 255] << 16 | REVERSE_TABLE[v >>> 16 & 255] << 8 | REVERSE_TABLE[v >>> 24 & 255];\n };\n exports2.interleave2 = function(x, y) {\n x &= 65535;\n x = (x | x << 8) & 16711935;\n x = (x | x << 4) & 252645135;\n x = (x | x << 2) & 858993459;\n x = (x | x << 1) & 1431655765;\n y &= 65535;\n y = (y | y << 8) & 16711935;\n y = (y | y << 4) & 252645135;\n y = (y | y << 2) & 858993459;\n y = (y | y << 1) & 1431655765;\n return x | y << 1;\n };\n exports2.deinterleave2 = function(v, n) {\n v = v >>> n & 1431655765;\n v = (v | v >>> 1) & 858993459;\n v = (v | v >>> 2) & 252645135;\n v = (v | v >>> 4) & 16711935;\n v = (v | v >>> 16) & 65535;\n return v << 16 >> 16;\n };\n exports2.interleave3 = function(x, y, z) {\n x &= 1023;\n x = (x | x << 16) & 4278190335;\n x = (x | x << 8) & 251719695;\n x = (x | x << 4) & 3272356035;\n x = (x | x << 2) & 1227133513;\n y &= 1023;\n y = (y | y << 16) & 4278190335;\n y = (y | y << 8) & 251719695;\n y = (y | y << 4) & 3272356035;\n y = (y | y << 2) & 1227133513;\n x |= y << 1;\n z &= 1023;\n z = (z | z << 16) & 4278190335;\n z = (z | z << 8) & 251719695;\n z = (z | z << 4) & 3272356035;\n z = (z | z << 2) & 1227133513;\n return x | z << 2;\n };\n exports2.deinterleave3 = function(v, n) {\n v = v >>> n & 1227133513;\n v = (v | v >>> 2) & 3272356035;\n v = (v | v >>> 4) & 251719695;\n v = (v | v >>> 8) & 4278190335;\n v = (v | v >>> 16) & 1023;\n return v << 22 >> 22;\n };\n exports2.nextCombination = function(v) {\n var t = v | v - 1;\n return t + 1 | (~t & -~t) - 1 >>> countTrailingZeros(v) + 1;\n };\n }\n ),\n /***/\n 2014: (\n /***/\n function(__unused_webpack_module, exports2, __webpack_require__2) {\n \"use strict\";\n \"use restrict\";\n var bits = __webpack_require__2(3105), UnionFind = __webpack_require__2(4623);\n function dimension(cells) {\n var d = 0, max = Math.max;\n for (var i = 0, il = cells.length; i < il; ++i) {\n d = max(d, cells[i].length);\n }\n return d - 1;\n }\n exports2.dimension = dimension;\n function countVertices(cells) {\n var vc = -1, max = Math.max;\n for (var i = 0, il = cells.length; i < il; ++i) {\n var c = cells[i];\n for (var j = 0, jl = c.length; j < jl; ++j) {\n vc = max(vc, c[j]);\n }\n }\n return vc + 1;\n }\n exports2.countVertices = countVertices;\n function cloneCells(cells) {\n var ncells = new Array(cells.length);\n for (var i = 0, il = cells.length; i < il; ++i) {\n ncells[i] = cells[i].slice(0);\n }\n return ncells;\n }\n exports2.cloneCells = cloneCells;\n function compareCells(a, b) {\n var n = a.length, t = a.length - b.length, min = Math.min;\n if (t) {\n return t;\n }\n switch (n) {\n case 0:\n return 0;\n case 1:\n return a[0] - b[0];\n case 2:\n var d = a[0] + a[1] - b[0] - b[1];\n if (d) {\n return d;\n }\n return min(a[0], a[1]) - min(b[0], b[1]);\n case 3:\n var l1 = a[0] + a[1], m1 = b[0] + b[1];\n d = l1 + a[2] - (m1 + b[2]);\n if (d) {\n return d;\n }\n var l0 = min(a[0], a[1]), m0 = min(b[0], b[1]), d = min(l0, a[2]) - min(m0, b[2]);\n if (d) {\n return d;\n }\n return min(l0 + a[2], l1) - min(m0 + b[2], m1);\n //TODO: Maybe optimize n=4 as well?\n default:\n var as = a.slice(0);\n as.sort();\n var bs = b.slice(0);\n bs.sort();\n for (var i = 0; i < n; ++i) {\n t = as[i] - bs[i];\n if (t) {\n return t;\n }\n }\n return 0;\n }\n }\n exports2.compareCells = compareCells;\n function compareZipped(a, b) {\n return compareCells(a[0], b[0]);\n }\n function normalize(cells, attr) {\n if (attr) {\n var len = cells.length;\n var zipped = new Array(len);\n for (var i = 0; i < len; ++i) {\n zipped[i] = [cells[i], attr[i]];\n }\n zipped.sort(compareZipped);\n for (var i = 0; i < len; ++i) {\n cells[i] = zipped[i][0];\n attr[i] = zipped[i][1];\n }\n return cells;\n } else {\n cells.sort(compareCells);\n return cells;\n }\n }\n exports2.normalize = normalize;\n function unique(cells) {\n if (cells.length === 0) {\n return [];\n }\n var ptr = 1, len = cells.length;\n for (var i = 1; i < len; ++i) {\n var a = cells[i];\n if (compareCells(a, cells[i - 1])) {\n if (i === ptr) {\n ptr++;\n continue;\n }\n cells[ptr++] = a;\n }\n }\n cells.length = ptr;\n return cells;\n }\n exports2.unique = unique;\n function findCell(cells, c) {\n var lo = 0, hi = cells.length - 1, r = -1;\n while (lo <= hi) {\n var mid = lo + hi >> 1, s = compareCells(cells[mid], c);\n if (s <= 0) {\n if (s === 0) {\n r = mid;\n }\n lo = mid + 1;\n } else if (s > 0) {\n hi = mid - 1;\n }\n }\n return r;\n }\n exports2.findCell = findCell;\n function incidence(from_cells, to_cells) {\n var index = new Array(from_cells.length);\n for (var i = 0, il = index.length; i < il; ++i) {\n index[i] = [];\n }\n var b = [];\n for (var i = 0, n = to_cells.length; i < n; ++i) {\n var c = to_cells[i];\n var cl = c.length;\n for (var k = 1, kn = 1 << cl; k < kn; ++k) {\n b.length = bits.popCount(k);\n var l = 0;\n for (var j = 0; j < cl; ++j) {\n if (k & 1 << j) {\n b[l++] = c[j];\n }\n }\n var idx = findCell(from_cells, b);\n if (idx < 0) {\n continue;\n }\n while (true) {\n index[idx++].push(i);\n if (idx >= from_cells.length || compareCells(from_cells[idx], b) !== 0) {\n break;\n }\n }\n }\n }\n return index;\n }\n exports2.incidence = incidence;\n function dual(cells, vertex_count) {\n if (!vertex_count) {\n return incidence(unique(skeleton(cells, 0)), cells, 0);\n }\n var res = new Array(vertex_count);\n for (var i = 0; i < vertex_count; ++i) {\n res[i] = [];\n }\n for (var i = 0, len = cells.length; i < len; ++i) {\n var c = cells[i];\n for (var j = 0, cl = c.length; j < cl; ++j) {\n res[c[j]].push(i);\n }\n }\n return res;\n }\n exports2.dual = dual;\n function explode(cells) {\n var result = [];\n for (var i = 0, il = cells.length; i < il; ++i) {\n var c = cells[i], cl = c.length | 0;\n for (var j = 1, jl = 1 << cl; j < jl; ++j) {\n var b = [];\n for (var k = 0; k < cl; ++k) {\n if (j >>> k & 1) {\n b.push(c[k]);\n }\n }\n result.push(b);\n }\n }\n return normalize(result);\n }\n exports2.explode = explode;\n function skeleton(cells, n) {\n if (n < 0) {\n return [];\n }\n var result = [], k0 = (1 << n + 1) - 1;\n for (var i = 0; i < cells.length; ++i) {\n var c = cells[i];\n for (var k = k0; k < 1 << c.length; k = bits.nextCombination(k)) {\n var b = new Array(n + 1), l = 0;\n for (var j = 0; j < c.length; ++j) {\n if (k & 1 << j) {\n b[l++] = c[j];\n }\n }\n result.push(b);\n }\n }\n return normalize(result);\n }\n exports2.skeleton = skeleton;\n function boundary(cells) {\n var res = [];\n for (var i = 0, il = cells.length; i < il; ++i) {\n var c = cells[i];\n for (var j = 0, cl = c.length; j < cl; ++j) {\n var b = new Array(c.length - 1);\n for (var k = 0, l = 0; k < cl; ++k) {\n if (k !== j) {\n b[l++] = c[k];\n }\n }\n res.push(b);\n }\n }\n return normalize(res);\n }\n exports2.boundary = boundary;\n function connectedComponents_dense(cells, vertex_count) {\n var labels = new UnionFind(vertex_count);\n for (var i = 0; i < cells.length; ++i) {\n var c = cells[i];\n for (var j = 0; j < c.length; ++j) {\n for (var k = j + 1; k < c.length; ++k) {\n labels.link(c[j], c[k]);\n }\n }\n }\n var components = [], component_labels = labels.ranks;\n for (var i = 0; i < component_labels.length; ++i) {\n component_labels[i] = -1;\n }\n for (var i = 0; i < cells.length; ++i) {\n var l = labels.find(cells[i][0]);\n if (component_labels[l] < 0) {\n component_labels[l] = components.length;\n components.push([cells[i].slice(0)]);\n } else {\n components[component_labels[l]].push(cells[i].slice(0));\n }\n }\n return components;\n }\n function connectedComponents_sparse(cells) {\n var vertices = unique(normalize(skeleton(cells, 0))), labels = new UnionFind(vertices.length);\n for (var i = 0; i < cells.length; ++i) {\n var c = cells[i];\n for (var j = 0; j < c.length; ++j) {\n var vj = findCell(vertices, [c[j]]);\n for (var k = j + 1; k < c.length; ++k) {\n labels.link(vj, findCell(vertices, [c[k]]));\n }\n }\n }\n var components = [], component_labels = labels.ranks;\n for (var i = 0; i < component_labels.length; ++i) {\n component_labels[i] = -1;\n }\n for (var i = 0; i < cells.length; ++i) {\n var l = labels.find(findCell(vertices, [cells[i][0]]));\n if (component_labels[l] < 0) {\n component_labels[l] = components.length;\n components.push([cells[i].slice(0)]);\n } else {\n components[component_labels[l]].push(cells[i].slice(0));\n }\n }\n return components;\n }\n function connectedComponents(cells, vertex_count) {\n if (vertex_count) {\n return connectedComponents_dense(cells, vertex_count);\n }\n return connectedComponents_sparse(cells);\n }\n exports2.connectedComponents = connectedComponents;\n }\n ),\n /***/\n 4623: (\n /***/\n function(module2) {\n \"use strict\";\n \"use restrict\";\n module2.exports = UnionFind;\n function UnionFind(count) {\n this.roots = new Array(count);\n this.ranks = new Array(count);\n for (var i = 0; i < count; ++i) {\n this.roots[i] = i;\n this.ranks[i] = 0;\n }\n }\n UnionFind.prototype.length = function() {\n return this.roots.length;\n };\n UnionFind.prototype.makeSet = function() {\n var n = this.roots.length;\n this.roots.push(n);\n this.ranks.push(0);\n return n;\n };\n UnionFind.prototype.find = function(x) {\n var roots = this.roots;\n while (roots[x] !== x) {\n var y = roots[x];\n roots[x] = roots[y];\n x = y;\n }\n return x;\n };\n UnionFind.prototype.link = function(x, y) {\n var xr = this.find(x), yr = this.find(y);\n if (xr === yr) {\n return;\n }\n var ranks = this.ranks, roots = this.roots, xd = ranks[xr], yd = ranks[yr];\n if (xd < yd) {\n roots[xr] = yr;\n } else if (yd < xd) {\n roots[yr] = xr;\n } else {\n roots[yr] = xr;\n ++ranks[xr];\n }\n };\n }\n ),\n /***/\n 5878: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = simplifyPolygon;\n var orient = __webpack_require__2(3250);\n var sc = __webpack_require__2(2014);\n function errorWeight(base, a, b) {\n var area = Math.abs(orient(base, a, b));\n var perim = Math.sqrt(Math.pow(a[0] - b[0], 2) + Math.pow(a[1] - b[1], 2));\n return area / perim;\n }\n function simplifyPolygon(cells, positions, minArea) {\n var n = positions.length;\n var nc = cells.length;\n var inv = new Array(n);\n var outv = new Array(n);\n var weights = new Array(n);\n var dead = new Array(n);\n for (var i = 0; i < n; ++i) {\n inv[i] = outv[i] = -1;\n weights[i] = Infinity;\n dead[i] = false;\n }\n for (var i = 0; i < nc; ++i) {\n var c = cells[i];\n if (c.length !== 2) {\n throw new Error(\"Input must be a graph\");\n }\n var s = c[1];\n var t = c[0];\n if (outv[t] !== -1) {\n outv[t] = -2;\n } else {\n outv[t] = s;\n }\n if (inv[s] !== -1) {\n inv[s] = -2;\n } else {\n inv[s] = t;\n }\n }\n function computeWeight(i2) {\n if (dead[i2]) {\n return Infinity;\n }\n var s2 = inv[i2];\n var t4 = outv[i2];\n if (s2 < 0 || t4 < 0) {\n return Infinity;\n } else {\n return errorWeight(positions[i2], positions[s2], positions[t4]);\n }\n }\n function heapSwap(i2, j) {\n var a = heap[i2];\n var b = heap[j];\n heap[i2] = b;\n heap[j] = a;\n index[a] = j;\n index[b] = i2;\n }\n function heapWeight(i2) {\n return weights[heap[i2]];\n }\n function heapParent(i2) {\n if (i2 & 1) {\n return i2 - 1 >> 1;\n }\n return (i2 >> 1) - 1;\n }\n function heapDown(i2) {\n var w2 = heapWeight(i2);\n while (true) {\n var tw = w2;\n var left = 2 * i2 + 1;\n var right = 2 * (i2 + 1);\n var next = i2;\n if (left < heapCount) {\n var lw = heapWeight(left);\n if (lw < tw) {\n next = left;\n tw = lw;\n }\n }\n if (right < heapCount) {\n var rw = heapWeight(right);\n if (rw < tw) {\n next = right;\n }\n }\n if (next === i2) {\n return i2;\n }\n heapSwap(i2, next);\n i2 = next;\n }\n }\n function heapUp(i2) {\n var w2 = heapWeight(i2);\n while (i2 > 0) {\n var parent = heapParent(i2);\n if (parent >= 0) {\n var pw = heapWeight(parent);\n if (w2 < pw) {\n heapSwap(i2, parent);\n i2 = parent;\n continue;\n }\n }\n return i2;\n }\n }\n function heapPop() {\n if (heapCount > 0) {\n var head = heap[0];\n heapSwap(0, heapCount - 1);\n heapCount -= 1;\n heapDown(0);\n return head;\n }\n return -1;\n }\n function heapUpdate(i2, w2) {\n var a = heap[i2];\n if (weights[a] === w2) {\n return i2;\n }\n weights[a] = -Infinity;\n heapUp(i2);\n heapPop();\n weights[a] = w2;\n heapCount += 1;\n return heapUp(heapCount - 1);\n }\n function kill(i2) {\n if (dead[i2]) {\n return;\n }\n dead[i2] = true;\n var s2 = inv[i2];\n var t4 = outv[i2];\n if (inv[t4] >= 0) {\n inv[t4] = s2;\n }\n if (outv[s2] >= 0) {\n outv[s2] = t4;\n }\n if (index[s2] >= 0) {\n heapUpdate(index[s2], computeWeight(s2));\n }\n if (index[t4] >= 0) {\n heapUpdate(index[t4], computeWeight(t4));\n }\n }\n var heap = [];\n var index = new Array(n);\n for (var i = 0; i < n; ++i) {\n var w = weights[i] = computeWeight(i);\n if (w < Infinity) {\n index[i] = heap.length;\n heap.push(i);\n } else {\n index[i] = -1;\n }\n }\n var heapCount = heap.length;\n for (var i = heapCount >> 1; i >= 0; --i) {\n heapDown(i);\n }\n while (true) {\n var hmin = heapPop();\n if (hmin < 0 || weights[hmin] > minArea) {\n break;\n }\n kill(hmin);\n }\n var npositions = [];\n for (var i = 0; i < n; ++i) {\n if (!dead[i]) {\n index[i] = npositions.length;\n npositions.push(positions[i].slice());\n }\n }\n var nv = npositions.length;\n function tortoiseHare(seq, start) {\n if (seq[start] < 0) {\n return start;\n }\n var t4 = start;\n var h = start;\n do {\n var nh = seq[h];\n if (!dead[h] || nh < 0 || nh === h) {\n break;\n }\n h = nh;\n nh = seq[h];\n if (!dead[h] || nh < 0 || nh === h) {\n break;\n }\n h = nh;\n t4 = seq[t4];\n } while (t4 !== h);\n for (var v = start; v !== h; v = seq[v]) {\n seq[v] = h;\n }\n return h;\n }\n var ncells = [];\n cells.forEach(function(c2) {\n var tin = tortoiseHare(inv, c2[0]);\n var tout = tortoiseHare(outv, c2[1]);\n if (tin >= 0 && tout >= 0 && tin !== tout) {\n var cin = index[tin];\n var cout = index[tout];\n if (cin !== cout) {\n ncells.push([cin, cout]);\n }\n }\n });\n sc.unique(sc.normalize(ncells));\n return {\n positions: npositions,\n edges: ncells\n };\n }\n }\n ),\n /***/\n 1303: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = orderSegments;\n var orient = __webpack_require__2(3250);\n function horizontalOrder(a, b) {\n var bl, br;\n if (b[0][0] < b[1][0]) {\n bl = b[0];\n br = b[1];\n } else if (b[0][0] > b[1][0]) {\n bl = b[1];\n br = b[0];\n } else {\n var alo = Math.min(a[0][1], a[1][1]);\n var ahi = Math.max(a[0][1], a[1][1]);\n var blo = Math.min(b[0][1], b[1][1]);\n var bhi = Math.max(b[0][1], b[1][1]);\n if (ahi < blo) {\n return ahi - blo;\n }\n if (alo > bhi) {\n return alo - bhi;\n }\n return ahi - bhi;\n }\n var al, ar;\n if (a[0][1] < a[1][1]) {\n al = a[0];\n ar = a[1];\n } else {\n al = a[1];\n ar = a[0];\n }\n var d = orient(br, bl, al);\n if (d) {\n return d;\n }\n d = orient(br, bl, ar);\n if (d) {\n return d;\n }\n return ar - br;\n }\n function orderSegments(b, a) {\n var al, ar;\n if (a[0][0] < a[1][0]) {\n al = a[0];\n ar = a[1];\n } else if (a[0][0] > a[1][0]) {\n al = a[1];\n ar = a[0];\n } else {\n return horizontalOrder(a, b);\n }\n var bl, br;\n if (b[0][0] < b[1][0]) {\n bl = b[0];\n br = b[1];\n } else if (b[0][0] > b[1][0]) {\n bl = b[1];\n br = b[0];\n } else {\n return -horizontalOrder(b, a);\n }\n var d1 = orient(al, ar, br);\n var d2 = orient(al, ar, bl);\n if (d1 < 0) {\n if (d2 <= 0) {\n return d1;\n }\n } else if (d1 > 0) {\n if (d2 >= 0) {\n return d1;\n }\n } else if (d2) {\n return d2;\n }\n d1 = orient(br, bl, ar);\n d2 = orient(br, bl, al);\n if (d1 < 0) {\n if (d2 <= 0) {\n return d1;\n }\n } else if (d1 > 0) {\n if (d2 >= 0) {\n return d1;\n }\n } else if (d2) {\n return d2;\n }\n return ar[0] - br[0];\n }\n }\n ),\n /***/\n 4209: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = createSlabDecomposition;\n var bounds = __webpack_require__2(2478);\n var createRBTree = __webpack_require__2(3840);\n var orient = __webpack_require__2(3250);\n var orderSegments = __webpack_require__2(1303);\n function SlabDecomposition(slabs, coordinates, horizontal) {\n this.slabs = slabs;\n this.coordinates = coordinates;\n this.horizontal = horizontal;\n }\n var proto = SlabDecomposition.prototype;\n function compareHorizontal(e, y) {\n return e.y - y;\n }\n function searchBucket(root, p) {\n var lastNode = null;\n while (root) {\n var seg = root.key;\n var l, r;\n if (seg[0][0] < seg[1][0]) {\n l = seg[0];\n r = seg[1];\n } else {\n l = seg[1];\n r = seg[0];\n }\n var o = orient(l, r, p);\n if (o < 0) {\n root = root.left;\n } else if (o > 0) {\n if (p[0] !== seg[1][0]) {\n lastNode = root;\n root = root.right;\n } else {\n var val = searchBucket(root.right, p);\n if (val) {\n return val;\n }\n root = root.left;\n }\n } else {\n if (p[0] !== seg[1][0]) {\n return root;\n } else {\n var val = searchBucket(root.right, p);\n if (val) {\n return val;\n }\n root = root.left;\n }\n }\n }\n return lastNode;\n }\n proto.castUp = function(p) {\n var bucket = bounds.le(this.coordinates, p[0]);\n if (bucket < 0) {\n return -1;\n }\n var root = this.slabs[bucket];\n var hitNode = searchBucket(this.slabs[bucket], p);\n var lastHit = -1;\n if (hitNode) {\n lastHit = hitNode.value;\n }\n if (this.coordinates[bucket] === p[0]) {\n var lastSegment = null;\n if (hitNode) {\n lastSegment = hitNode.key;\n }\n if (bucket > 0) {\n var otherHitNode = searchBucket(this.slabs[bucket - 1], p);\n if (otherHitNode) {\n if (lastSegment) {\n if (orderSegments(otherHitNode.key, lastSegment) > 0) {\n lastSegment = otherHitNode.key;\n lastHit = otherHitNode.value;\n }\n } else {\n lastHit = otherHitNode.value;\n lastSegment = otherHitNode.key;\n }\n }\n }\n var horiz = this.horizontal[bucket];\n if (horiz.length > 0) {\n var hbucket = bounds.ge(horiz, p[1], compareHorizontal);\n if (hbucket < horiz.length) {\n var e = horiz[hbucket];\n if (p[1] === e.y) {\n if (e.closed) {\n return e.index;\n } else {\n while (hbucket < horiz.length - 1 && horiz[hbucket + 1].y === p[1]) {\n hbucket = hbucket + 1;\n e = horiz[hbucket];\n if (e.closed) {\n return e.index;\n }\n }\n if (e.y === p[1] && !e.start) {\n hbucket = hbucket + 1;\n if (hbucket >= horiz.length) {\n return lastHit;\n }\n e = horiz[hbucket];\n }\n }\n }\n if (e.start) {\n if (lastSegment) {\n var o = orient(lastSegment[0], lastSegment[1], [p[0], e.y]);\n if (lastSegment[0][0] > lastSegment[1][0]) {\n o = -o;\n }\n if (o > 0) {\n lastHit = e.index;\n }\n } else {\n lastHit = e.index;\n }\n } else if (e.y !== p[1]) {\n lastHit = e.index;\n }\n }\n }\n }\n return lastHit;\n };\n function IntervalSegment(y, index, start, closed) {\n this.y = y;\n this.index = index;\n this.start = start;\n this.closed = closed;\n }\n function Event(x, segment, create, index) {\n this.x = x;\n this.segment = segment;\n this.create = create;\n this.index = index;\n }\n function createSlabDecomposition(segments) {\n var numSegments = segments.length;\n var numEvents = 2 * numSegments;\n var events = new Array(numEvents);\n for (var i = 0; i < numSegments; ++i) {\n var s = segments[i];\n var f = s[0][0] < s[1][0];\n events[2 * i] = new Event(s[0][0], s, f, i);\n events[2 * i + 1] = new Event(s[1][0], s, !f, i);\n }\n events.sort(function(a, b) {\n var d = a.x - b.x;\n if (d) {\n return d;\n }\n d = a.create - b.create;\n if (d) {\n return d;\n }\n return Math.min(a.segment[0][1], a.segment[1][1]) - Math.min(b.segment[0][1], b.segment[1][1]);\n });\n var tree = createRBTree(orderSegments);\n var slabs = [];\n var lines = [];\n var horizontal = [];\n var lastX = -Infinity;\n for (var i = 0; i < numEvents; ) {\n var x = events[i].x;\n var horiz = [];\n while (i < numEvents) {\n var e = events[i];\n if (e.x !== x) {\n break;\n }\n i += 1;\n if (e.segment[0][0] === e.x && e.segment[1][0] === e.x) {\n if (e.create) {\n if (e.segment[0][1] < e.segment[1][1]) {\n horiz.push(new IntervalSegment(\n e.segment[0][1],\n e.index,\n true,\n true\n ));\n horiz.push(new IntervalSegment(\n e.segment[1][1],\n e.index,\n false,\n false\n ));\n } else {\n horiz.push(new IntervalSegment(\n e.segment[1][1],\n e.index,\n true,\n false\n ));\n horiz.push(new IntervalSegment(\n e.segment[0][1],\n e.index,\n false,\n true\n ));\n }\n }\n } else {\n if (e.create) {\n tree = tree.insert(e.segment, e.index);\n } else {\n tree = tree.remove(e.segment);\n }\n }\n }\n slabs.push(tree.root);\n lines.push(x);\n horizontal.push(horiz);\n }\n return new SlabDecomposition(slabs, lines, horizontal);\n }\n }\n ),\n /***/\n 5202: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var robustDot = __webpack_require__2(1944);\n var robustSum = __webpack_require__2(8210);\n module2.exports = splitPolygon;\n module2.exports.positive = positive;\n module2.exports.negative = negative;\n function planeT(p, plane) {\n var r = robustSum(robustDot(p, plane), [plane[plane.length - 1]]);\n return r[r.length - 1];\n }\n function lerpW(a, wa, b, wb) {\n var d = wb - wa;\n var t = -wa / d;\n if (t < 0) {\n t = 0;\n } else if (t > 1) {\n t = 1;\n }\n var ti = 1 - t;\n var n = a.length;\n var r = new Array(n);\n for (var i = 0; i < n; ++i) {\n r[i] = t * a[i] + ti * b[i];\n }\n return r;\n }\n function splitPolygon(points, plane) {\n var pos = [];\n var neg = [];\n var a = planeT(points[points.length - 1], plane);\n for (var s = points[points.length - 1], t = points[0], i = 0; i < points.length; ++i, s = t) {\n t = points[i];\n var b = planeT(t, plane);\n if (a < 0 && b > 0 || a > 0 && b < 0) {\n var p = lerpW(s, b, t, a);\n pos.push(p);\n neg.push(p.slice());\n }\n if (b < 0) {\n neg.push(t.slice());\n } else if (b > 0) {\n pos.push(t.slice());\n } else {\n pos.push(t.slice());\n neg.push(t.slice());\n }\n a = b;\n }\n return { positive: pos, negative: neg };\n }\n function positive(points, plane) {\n var pos = [];\n var a = planeT(points[points.length - 1], plane);\n for (var s = points[points.length - 1], t = points[0], i = 0; i < points.length; ++i, s = t) {\n t = points[i];\n var b = planeT(t, plane);\n if (a < 0 && b > 0 || a > 0 && b < 0) {\n pos.push(lerpW(s, b, t, a));\n }\n if (b >= 0) {\n pos.push(t.slice());\n }\n a = b;\n }\n return pos;\n }\n function negative(points, plane) {\n var neg = [];\n var a = planeT(points[points.length - 1], plane);\n for (var s = points[points.length - 1], t = points[0], i = 0; i < points.length; ++i, s = t) {\n t = points[i];\n var b = planeT(t, plane);\n if (a < 0 && b > 0 || a > 0 && b < 0) {\n neg.push(lerpW(s, b, t, a));\n }\n if (b <= 0) {\n neg.push(t.slice());\n }\n a = b;\n }\n return neg;\n }\n }\n ),\n /***/\n 3387: (\n /***/\n function(module2, exports2, __webpack_require__2) {\n var __WEBPACK_AMD_DEFINE_RESULT__;\n !function() {\n \"use strict\";\n var re = {\n not_string: /[^s]/,\n not_bool: /[^t]/,\n not_type: /[^T]/,\n not_primitive: /[^v]/,\n number: /[diefg]/,\n numeric_arg: /[bcdiefguxX]/,\n json: /[j]/,\n not_json: /[^j]/,\n text: /^[^\\x25]+/,\n modulo: /^\\x25{2}/,\n placeholder: /^\\x25(?:([1-9]\\d*)\\$|\\(([^)]+)\\))?(\\+)?(0|'[^$])?(-)?(\\d+)?(?:\\.(\\d+))?([b-gijostTuvxX])/,\n key: /^([a-z_][a-z_\\d]*)/i,\n key_access: /^\\.([a-z_][a-z_\\d]*)/i,\n index_access: /^\\[(\\d+)\\]/,\n sign: /^[+-]/\n };\n function sprintf(key) {\n return sprintf_format(sprintf_parse(key), arguments);\n }\n function vsprintf(fmt, argv) {\n return sprintf.apply(null, [fmt].concat(argv || []));\n }\n function sprintf_format(parse_tree, argv) {\n var cursor = 1, tree_length = parse_tree.length, arg, output = \"\", i, k, ph, pad, pad_character, pad_length, is_positive, sign;\n for (i = 0; i < tree_length; i++) {\n if (typeof parse_tree[i] === \"string\") {\n output += parse_tree[i];\n } else if (typeof parse_tree[i] === \"object\") {\n ph = parse_tree[i];\n if (ph.keys) {\n arg = argv[cursor];\n for (k = 0; k < ph.keys.length; k++) {\n if (arg == void 0) {\n throw new Error(sprintf('[sprintf] Cannot access property \"%s\" of undefined value \"%s\"', ph.keys[k], ph.keys[k - 1]));\n }\n arg = arg[ph.keys[k]];\n }\n } else if (ph.param_no) {\n arg = argv[ph.param_no];\n } else {\n arg = argv[cursor++];\n }\n if (re.not_type.test(ph.type) && re.not_primitive.test(ph.type) && arg instanceof Function) {\n arg = arg();\n }\n if (re.numeric_arg.test(ph.type) && (typeof arg !== \"number\" && isNaN(arg))) {\n throw new TypeError(sprintf(\"[sprintf] expecting number but found %T\", arg));\n }\n if (re.number.test(ph.type)) {\n is_positive = arg >= 0;\n }\n switch (ph.type) {\n case \"b\":\n arg = parseInt(arg, 10).toString(2);\n break;\n case \"c\":\n arg = String.fromCharCode(parseInt(arg, 10));\n break;\n case \"d\":\n case \"i\":\n arg = parseInt(arg, 10);\n break;\n case \"j\":\n arg = JSON.stringify(arg, null, ph.width ? parseInt(ph.width) : 0);\n break;\n case \"e\":\n arg = ph.precision ? parseFloat(arg).toExponential(ph.precision) : parseFloat(arg).toExponential();\n break;\n case \"f\":\n arg = ph.precision ? parseFloat(arg).toFixed(ph.precision) : parseFloat(arg);\n break;\n case \"g\":\n arg = ph.precision ? String(Number(arg.toPrecision(ph.precision))) : parseFloat(arg);\n break;\n case \"o\":\n arg = (parseInt(arg, 10) >>> 0).toString(8);\n break;\n case \"s\":\n arg = String(arg);\n arg = ph.precision ? arg.substring(0, ph.precision) : arg;\n break;\n case \"t\":\n arg = String(!!arg);\n arg = ph.precision ? arg.substring(0, ph.precision) : arg;\n break;\n case \"T\":\n arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase();\n arg = ph.precision ? arg.substring(0, ph.precision) : arg;\n break;\n case \"u\":\n arg = parseInt(arg, 10) >>> 0;\n break;\n case \"v\":\n arg = arg.valueOf();\n arg = ph.precision ? arg.substring(0, ph.precision) : arg;\n break;\n case \"x\":\n arg = (parseInt(arg, 10) >>> 0).toString(16);\n break;\n case \"X\":\n arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase();\n break;\n }\n if (re.json.test(ph.type)) {\n output += arg;\n } else {\n if (re.number.test(ph.type) && (!is_positive || ph.sign)) {\n sign = is_positive ? \"+\" : \"-\";\n arg = arg.toString().replace(re.sign, \"\");\n } else {\n sign = \"\";\n }\n pad_character = ph.pad_char ? ph.pad_char === \"0\" ? \"0\" : ph.pad_char.charAt(1) : \" \";\n pad_length = ph.width - (sign + arg).length;\n pad = ph.width ? pad_length > 0 ? pad_character.repeat(pad_length) : \"\" : \"\";\n output += ph.align ? sign + arg + pad : pad_character === \"0\" ? sign + pad + arg : pad + sign + arg;\n }\n }\n }\n return output;\n }\n var sprintf_cache = /* @__PURE__ */ Object.create(null);\n function sprintf_parse(fmt) {\n if (sprintf_cache[fmt]) {\n return sprintf_cache[fmt];\n }\n var _fmt = fmt, match, parse_tree = [], arg_names = 0;\n while (_fmt) {\n if ((match = re.text.exec(_fmt)) !== null) {\n parse_tree.push(match[0]);\n } else if ((match = re.modulo.exec(_fmt)) !== null) {\n parse_tree.push(\"%\");\n } else if ((match = re.placeholder.exec(_fmt)) !== null) {\n if (match[2]) {\n arg_names |= 1;\n var field_list = [], replacement_field = match[2], field_match = [];\n if ((field_match = re.key.exec(replacement_field)) !== null) {\n field_list.push(field_match[1]);\n while ((replacement_field = replacement_field.substring(field_match[0].length)) !== \"\") {\n if ((field_match = re.key_access.exec(replacement_field)) !== null) {\n field_list.push(field_match[1]);\n } else if ((field_match = re.index_access.exec(replacement_field)) !== null) {\n field_list.push(field_match[1]);\n } else {\n throw new SyntaxError(\"[sprintf] failed to parse named argument key\");\n }\n }\n } else {\n throw new SyntaxError(\"[sprintf] failed to parse named argument key\");\n }\n match[2] = field_list;\n } else {\n arg_names |= 2;\n }\n if (arg_names === 3) {\n throw new Error(\"[sprintf] mixing positional and named placeholders is not (yet) supported\");\n }\n parse_tree.push(\n {\n placeholder: match[0],\n param_no: match[1],\n keys: match[2],\n sign: match[3],\n pad_char: match[4],\n align: match[5],\n width: match[6],\n precision: match[7],\n type: match[8]\n }\n );\n } else {\n throw new SyntaxError(\"[sprintf] unexpected placeholder\");\n }\n _fmt = _fmt.substring(match[0].length);\n }\n return sprintf_cache[fmt] = parse_tree;\n }\n if (true) {\n exports2.sprintf = sprintf;\n exports2.vsprintf = vsprintf;\n }\n if (typeof window !== \"undefined\") {\n window[\"sprintf\"] = sprintf;\n window[\"vsprintf\"] = vsprintf;\n if (true) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = function() {\n return {\n \"sprintf\": sprintf,\n \"vsprintf\": vsprintf\n };\n }.call(exports2, __webpack_require__2, exports2, module2), __WEBPACK_AMD_DEFINE_RESULT__ !== void 0 && (module2.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n }\n }\n }();\n }\n ),\n /***/\n 3711: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = surfaceNets;\n var generateContourExtractor = __webpack_require__2(2640);\n var zeroCrossings = __webpack_require__2(781);\n var allFns = {\n \"2d\": function(genContour, order, dtype) {\n var contour = genContour({\n order,\n scalarArguments: 3,\n getters: dtype === \"generic\" ? [0] : void 0,\n phase: function phaseFunc(p, a, b, c) {\n return p > c | 0;\n },\n vertex: function vertexFunc(d0, d1, v0, v1, v2, v3, p0, p1, p2, p3, a, b, c) {\n var m = (p0 << 0) + (p1 << 1) + (p2 << 2) + (p3 << 3) | 0;\n if (m === 0 || m === 15) {\n return;\n }\n switch (m) {\n case 0:\n a.push([d0 - 0.5, d1 - 0.5]);\n break;\n case 1:\n a.push([d0 - 0.25 - 0.25 * (v1 + v0 - 2 * c) / (v0 - v1), d1 - 0.25 - 0.25 * (v2 + v0 - 2 * c) / (v0 - v2)]);\n break;\n case 2:\n a.push([d0 - 0.75 - 0.25 * (-v1 - v0 + 2 * c) / (v1 - v0), d1 - 0.25 - 0.25 * (v3 + v1 - 2 * c) / (v1 - v3)]);\n break;\n case 3:\n a.push([d0 - 0.5, d1 - 0.5 - 0.5 * (v2 + v0 + v3 + v1 - 4 * c) / (v0 - v2 + v1 - v3)]);\n break;\n case 4:\n a.push([d0 - 0.25 - 0.25 * (v3 + v2 - 2 * c) / (v2 - v3), d1 - 0.75 - 0.25 * (-v2 - v0 + 2 * c) / (v2 - v0)]);\n break;\n case 5:\n a.push([d0 - 0.5 - 0.5 * (v1 + v0 + v3 + v2 - 4 * c) / (v0 - v1 + v2 - v3), d1 - 0.5]);\n break;\n case 6:\n a.push([d0 - 0.5 - 0.25 * (-v1 - v0 + v3 + v2) / (v1 - v0 + v2 - v3), d1 - 0.5 - 0.25 * (-v2 - v0 + v3 + v1) / (v2 - v0 + v1 - v3)]);\n break;\n case 7:\n a.push([d0 - 0.75 - 0.25 * (v3 + v2 - 2 * c) / (v2 - v3), d1 - 0.75 - 0.25 * (v3 + v1 - 2 * c) / (v1 - v3)]);\n break;\n case 8:\n a.push([d0 - 0.75 - 0.25 * (-v3 - v2 + 2 * c) / (v3 - v2), d1 - 0.75 - 0.25 * (-v3 - v1 + 2 * c) / (v3 - v1)]);\n break;\n case 9:\n a.push([d0 - 0.5 - 0.25 * (v1 + v0 + -v3 - v2) / (v0 - v1 + v3 - v2), d1 - 0.5 - 0.25 * (v2 + v0 + -v3 - v1) / (v0 - v2 + v3 - v1)]);\n break;\n case 10:\n a.push([d0 - 0.5 - 0.5 * (-v1 - v0 + -v3 - v2 + 4 * c) / (v1 - v0 + v3 - v2), d1 - 0.5]);\n break;\n case 11:\n a.push([d0 - 0.25 - 0.25 * (-v3 - v2 + 2 * c) / (v3 - v2), d1 - 0.75 - 0.25 * (v2 + v0 - 2 * c) / (v0 - v2)]);\n break;\n case 12:\n a.push([d0 - 0.5, d1 - 0.5 - 0.5 * (-v2 - v0 + -v3 - v1 + 4 * c) / (v2 - v0 + v3 - v1)]);\n break;\n case 13:\n a.push([d0 - 0.75 - 0.25 * (v1 + v0 - 2 * c) / (v0 - v1), d1 - 0.25 - 0.25 * (-v3 - v1 + 2 * c) / (v3 - v1)]);\n break;\n case 14:\n a.push([d0 - 0.25 - 0.25 * (-v1 - v0 + 2 * c) / (v1 - v0), d1 - 0.25 - 0.25 * (-v2 - v0 + 2 * c) / (v2 - v0)]);\n break;\n case 15:\n a.push([d0 - 0.5, d1 - 0.5]);\n break;\n }\n },\n cell: function cellFunc(v0, v1, c0, c1, p0, p1, a, b, c) {\n if (p0) {\n b.push([v0, v1]);\n } else {\n b.push([v1, v0]);\n }\n }\n });\n return function(array, level) {\n var verts = [], cells = [];\n contour(array, verts, cells, level);\n return { positions: verts, cells };\n };\n }\n };\n function buildSurfaceNets(order, dtype) {\n var inKey = order.length + \"d\";\n var fn = allFns[inKey];\n if (fn) return fn(generateContourExtractor, order, dtype);\n }\n function mesh1D(array, level) {\n var zc = zeroCrossings(array, level);\n var n = zc.length;\n var npos = new Array(n);\n var ncel = new Array(n);\n for (var i = 0; i < n; ++i) {\n npos[i] = [zc[i]];\n ncel[i] = [i];\n }\n return {\n positions: npos,\n cells: ncel\n };\n }\n var CACHE = {};\n function surfaceNets(array, level) {\n if (array.dimension <= 0) {\n return { positions: [], cells: [] };\n } else if (array.dimension === 1) {\n return mesh1D(array, level);\n }\n var typesig = array.order.join() + \"-\" + array.dtype;\n var proc = CACHE[typesig];\n var level = +level || 0;\n if (!proc) {\n proc = CACHE[typesig] = buildSurfaceNets(array.order, array.dtype);\n }\n return proc(array, level);\n }\n }\n ),\n /***/\n 665: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n var parseUnit = __webpack_require__2(3202);\n module2.exports = toPX;\n var PIXELS_PER_INCH = 96;\n function getPropertyInPX(element, prop) {\n var parts = parseUnit(getComputedStyle(element).getPropertyValue(prop));\n return parts[0] * toPX(parts[1], element);\n }\n function getSizeBrutal(unit, element) {\n var testDIV = document.createElement(\"div\");\n testDIV.style[\"font-size\"] = \"128\" + unit;\n element.appendChild(testDIV);\n var size = getPropertyInPX(testDIV, \"font-size\") / 128;\n element.removeChild(testDIV);\n return size;\n }\n function toPX(str, element) {\n element = element || document.body;\n str = (str || \"px\").trim().toLowerCase();\n if (element === window || element === document) {\n element = document.body;\n }\n switch (str) {\n case \"%\":\n return element.clientHeight / 100;\n case \"ch\":\n case \"ex\":\n return getSizeBrutal(str, element);\n case \"em\":\n return getPropertyInPX(element, \"font-size\");\n case \"rem\":\n return getPropertyInPX(document.body, \"font-size\");\n case \"vw\":\n return window.innerWidth / 100;\n case \"vh\":\n return window.innerHeight / 100;\n case \"vmin\":\n return Math.min(window.innerWidth, window.innerHeight) / 100;\n case \"vmax\":\n return Math.max(window.innerWidth, window.innerHeight) / 100;\n case \"in\":\n return PIXELS_PER_INCH;\n case \"cm\":\n return PIXELS_PER_INCH / 2.54;\n case \"mm\":\n return PIXELS_PER_INCH / 25.4;\n case \"pt\":\n return PIXELS_PER_INCH / 72;\n case \"pc\":\n return PIXELS_PER_INCH / 6;\n }\n return 1;\n }\n }\n ),\n /***/\n 7261: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = createTurntableController;\n var filterVector = __webpack_require__2(9215);\n var invert44 = __webpack_require__2(7608);\n var rotateM = __webpack_require__2(6079);\n var cross = __webpack_require__2(5911);\n var normalize3 = __webpack_require__2(3536);\n var dot3 = __webpack_require__2(244);\n function len3(x, y, z) {\n return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2));\n }\n function clamp1(x) {\n return Math.min(1, Math.max(-1, x));\n }\n function findOrthoPair(v) {\n var vx = Math.abs(v[0]);\n var vy = Math.abs(v[1]);\n var vz = Math.abs(v[2]);\n var u = [0, 0, 0];\n if (vx > Math.max(vy, vz)) {\n u[2] = 1;\n } else if (vy > Math.max(vx, vz)) {\n u[0] = 1;\n } else {\n u[1] = 1;\n }\n var vv = 0;\n var uv = 0;\n for (var i = 0; i < 3; ++i) {\n vv += v[i] * v[i];\n uv += u[i] * v[i];\n }\n for (var i = 0; i < 3; ++i) {\n u[i] -= uv / vv * v[i];\n }\n normalize3(u, u);\n return u;\n }\n function TurntableController(zoomMin, zoomMax, center, up, right, radius, theta, phi) {\n this.center = filterVector(center);\n this.up = filterVector(up);\n this.right = filterVector(right);\n this.radius = filterVector([radius]);\n this.angle = filterVector([theta, phi]);\n this.angle.bounds = [[-Infinity, -Math.PI / 2], [Infinity, Math.PI / 2]];\n this.setDistanceLimits(zoomMin, zoomMax);\n this.computedCenter = this.center.curve(0);\n this.computedUp = this.up.curve(0);\n this.computedRight = this.right.curve(0);\n this.computedRadius = this.radius.curve(0);\n this.computedAngle = this.angle.curve(0);\n this.computedToward = [0, 0, 0];\n this.computedEye = [0, 0, 0];\n this.computedMatrix = new Array(16);\n for (var i = 0; i < 16; ++i) {\n this.computedMatrix[i] = 0.5;\n }\n this.recalcMatrix(0);\n }\n var proto = TurntableController.prototype;\n proto.setDistanceLimits = function(minDist, maxDist) {\n if (minDist > 0) {\n minDist = Math.log(minDist);\n } else {\n minDist = -Infinity;\n }\n if (maxDist > 0) {\n maxDist = Math.log(maxDist);\n } else {\n maxDist = Infinity;\n }\n maxDist = Math.max(maxDist, minDist);\n this.radius.bounds[0][0] = minDist;\n this.radius.bounds[1][0] = maxDist;\n };\n proto.getDistanceLimits = function(out) {\n var bounds = this.radius.bounds[0];\n if (out) {\n out[0] = Math.exp(bounds[0][0]);\n out[1] = Math.exp(bounds[1][0]);\n return out;\n }\n return [Math.exp(bounds[0][0]), Math.exp(bounds[1][0])];\n };\n proto.recalcMatrix = function(t) {\n this.center.curve(t);\n this.up.curve(t);\n this.right.curve(t);\n this.radius.curve(t);\n this.angle.curve(t);\n var up = this.computedUp;\n var right = this.computedRight;\n var uu = 0;\n var ur = 0;\n for (var i = 0; i < 3; ++i) {\n ur += up[i] * right[i];\n uu += up[i] * up[i];\n }\n var ul = Math.sqrt(uu);\n var rr = 0;\n for (var i = 0; i < 3; ++i) {\n right[i] -= up[i] * ur / uu;\n rr += right[i] * right[i];\n up[i] /= ul;\n }\n var rl = Math.sqrt(rr);\n for (var i = 0; i < 3; ++i) {\n right[i] /= rl;\n }\n var toward = this.computedToward;\n cross(toward, up, right);\n normalize3(toward, toward);\n var radius = Math.exp(this.computedRadius[0]);\n var theta = this.computedAngle[0];\n var phi = this.computedAngle[1];\n var ctheta = Math.cos(theta);\n var stheta = Math.sin(theta);\n var cphi = Math.cos(phi);\n var sphi = Math.sin(phi);\n var center = this.computedCenter;\n var wx = ctheta * cphi;\n var wy = stheta * cphi;\n var wz = sphi;\n var sx = -ctheta * sphi;\n var sy = -stheta * sphi;\n var sz = cphi;\n var eye = this.computedEye;\n var mat = this.computedMatrix;\n for (var i = 0; i < 3; ++i) {\n var x = wx * right[i] + wy * toward[i] + wz * up[i];\n mat[4 * i + 1] = sx * right[i] + sy * toward[i] + sz * up[i];\n mat[4 * i + 2] = x;\n mat[4 * i + 3] = 0;\n }\n var ax = mat[1];\n var ay = mat[5];\n var az = mat[9];\n var bx = mat[2];\n var by = mat[6];\n var bz = mat[10];\n var cx = ay * bz - az * by;\n var cy = az * bx - ax * bz;\n var cz = ax * by - ay * bx;\n var cl = len3(cx, cy, cz);\n cx /= cl;\n cy /= cl;\n cz /= cl;\n mat[0] = cx;\n mat[4] = cy;\n mat[8] = cz;\n for (var i = 0; i < 3; ++i) {\n eye[i] = center[i] + mat[2 + 4 * i] * radius;\n }\n for (var i = 0; i < 3; ++i) {\n var rr = 0;\n for (var j = 0; j < 3; ++j) {\n rr += mat[i + 4 * j] * eye[j];\n }\n mat[12 + i] = -rr;\n }\n mat[15] = 1;\n };\n proto.getMatrix = function(t, result) {\n this.recalcMatrix(t);\n var mat = this.computedMatrix;\n if (result) {\n for (var i = 0; i < 16; ++i) {\n result[i] = mat[i];\n }\n return result;\n }\n return mat;\n };\n var zAxis = [0, 0, 0];\n proto.rotate = function(t, dtheta, dphi, droll) {\n this.angle.move(t, dtheta, dphi);\n if (droll) {\n this.recalcMatrix(t);\n var mat = this.computedMatrix;\n zAxis[0] = mat[2];\n zAxis[1] = mat[6];\n zAxis[2] = mat[10];\n var up = this.computedUp;\n var right = this.computedRight;\n var toward = this.computedToward;\n for (var i = 0; i < 3; ++i) {\n mat[4 * i] = up[i];\n mat[4 * i + 1] = right[i];\n mat[4 * i + 2] = toward[i];\n }\n rotateM(mat, mat, droll, zAxis);\n for (var i = 0; i < 3; ++i) {\n up[i] = mat[4 * i];\n right[i] = mat[4 * i + 1];\n }\n this.up.set(t, up[0], up[1], up[2]);\n this.right.set(t, right[0], right[1], right[2]);\n }\n };\n proto.pan = function(t, dx, dy, dz) {\n dx = dx || 0;\n dy = dy || 0;\n dz = dz || 0;\n this.recalcMatrix(t);\n var mat = this.computedMatrix;\n var dist = Math.exp(this.computedRadius[0]);\n var ux = mat[1];\n var uy = mat[5];\n var uz = mat[9];\n var ul = len3(ux, uy, uz);\n ux /= ul;\n uy /= ul;\n uz /= ul;\n var rx = mat[0];\n var ry = mat[4];\n var rz = mat[8];\n var ru = rx * ux + ry * uy + rz * uz;\n rx -= ux * ru;\n ry -= uy * ru;\n rz -= uz * ru;\n var rl = len3(rx, ry, rz);\n rx /= rl;\n ry /= rl;\n rz /= rl;\n var vx = rx * dx + ux * dy;\n var vy = ry * dx + uy * dy;\n var vz = rz * dx + uz * dy;\n this.center.move(t, vx, vy, vz);\n var radius = Math.exp(this.computedRadius[0]);\n radius = Math.max(1e-4, radius + dz);\n this.radius.set(t, Math.log(radius));\n };\n proto.translate = function(t, dx, dy, dz) {\n this.center.move(\n t,\n dx || 0,\n dy || 0,\n dz || 0\n );\n };\n proto.setMatrix = function(t, mat, axes, noSnap) {\n var ushift = 1;\n if (typeof axes === \"number\") {\n ushift = axes | 0;\n }\n if (ushift < 0 || ushift > 3) {\n ushift = 1;\n }\n var vshift = (ushift + 2) % 3;\n var fshift = (ushift + 1) % 3;\n if (!mat) {\n this.recalcMatrix(t);\n mat = this.computedMatrix;\n }\n var ux = mat[ushift];\n var uy = mat[ushift + 4];\n var uz = mat[ushift + 8];\n if (!noSnap) {\n var ul = len3(ux, uy, uz);\n ux /= ul;\n uy /= ul;\n uz /= ul;\n } else {\n var ax = Math.abs(ux);\n var ay = Math.abs(uy);\n var az = Math.abs(uz);\n var am = Math.max(ax, ay, az);\n if (ax === am) {\n ux = ux < 0 ? -1 : 1;\n uy = uz = 0;\n } else if (az === am) {\n uz = uz < 0 ? -1 : 1;\n ux = uy = 0;\n } else {\n uy = uy < 0 ? -1 : 1;\n ux = uz = 0;\n }\n }\n var rx = mat[vshift];\n var ry = mat[vshift + 4];\n var rz = mat[vshift + 8];\n var ru = rx * ux + ry * uy + rz * uz;\n rx -= ux * ru;\n ry -= uy * ru;\n rz -= uz * ru;\n var rl = len3(rx, ry, rz);\n rx /= rl;\n ry /= rl;\n rz /= rl;\n var fx = uy * rz - uz * ry;\n var fy = uz * rx - ux * rz;\n var fz = ux * ry - uy * rx;\n var fl = len3(fx, fy, fz);\n fx /= fl;\n fy /= fl;\n fz /= fl;\n this.center.jump(t, ex, ey, ez);\n this.radius.idle(t);\n this.up.jump(t, ux, uy, uz);\n this.right.jump(t, rx, ry, rz);\n var phi, theta;\n if (ushift === 2) {\n var cx = mat[1];\n var cy = mat[5];\n var cz = mat[9];\n var cr = cx * rx + cy * ry + cz * rz;\n var cf = cx * fx + cy * fy + cz * fz;\n if (tu < 0) {\n phi = -Math.PI / 2;\n } else {\n phi = Math.PI / 2;\n }\n theta = Math.atan2(cf, cr);\n } else {\n var tx = mat[2];\n var ty = mat[6];\n var tz = mat[10];\n var tu = tx * ux + ty * uy + tz * uz;\n var tr = tx * rx + ty * ry + tz * rz;\n var tf = tx * fx + ty * fy + tz * fz;\n phi = Math.asin(clamp1(tu));\n theta = Math.atan2(tf, tr);\n }\n this.angle.jump(t, theta, phi);\n this.recalcMatrix(t);\n var dx = mat[2];\n var dy = mat[6];\n var dz = mat[10];\n var imat = this.computedMatrix;\n invert44(imat, mat);\n var w = imat[15];\n var ex = imat[12] / w;\n var ey = imat[13] / w;\n var ez = imat[14] / w;\n var gs = Math.exp(this.computedRadius[0]);\n this.center.jump(t, ex - dx * gs, ey - dy * gs, ez - dz * gs);\n };\n proto.lastT = function() {\n return Math.max(\n this.center.lastT(),\n this.up.lastT(),\n this.right.lastT(),\n this.radius.lastT(),\n this.angle.lastT()\n );\n };\n proto.idle = function(t) {\n this.center.idle(t);\n this.up.idle(t);\n this.right.idle(t);\n this.radius.idle(t);\n this.angle.idle(t);\n };\n proto.flush = function(t) {\n this.center.flush(t);\n this.up.flush(t);\n this.right.flush(t);\n this.radius.flush(t);\n this.angle.flush(t);\n };\n proto.setDistance = function(t, d) {\n if (d > 0) {\n this.radius.set(t, Math.log(d));\n }\n };\n proto.lookAt = function(t, eye, center, up) {\n this.recalcMatrix(t);\n eye = eye || this.computedEye;\n center = center || this.computedCenter;\n up = up || this.computedUp;\n var ux = up[0];\n var uy = up[1];\n var uz = up[2];\n var ul = len3(ux, uy, uz);\n if (ul < 1e-6) {\n return;\n }\n ux /= ul;\n uy /= ul;\n uz /= ul;\n var tx = eye[0] - center[0];\n var ty = eye[1] - center[1];\n var tz = eye[2] - center[2];\n var tl = len3(tx, ty, tz);\n if (tl < 1e-6) {\n return;\n }\n tx /= tl;\n ty /= tl;\n tz /= tl;\n var right = this.computedRight;\n var rx = right[0];\n var ry = right[1];\n var rz = right[2];\n var ru = ux * rx + uy * ry + uz * rz;\n rx -= ru * ux;\n ry -= ru * uy;\n rz -= ru * uz;\n var rl = len3(rx, ry, rz);\n if (rl < 0.01) {\n rx = uy * tz - uz * ty;\n ry = uz * tx - ux * tz;\n rz = ux * ty - uy * tx;\n rl = len3(rx, ry, rz);\n if (rl < 1e-6) {\n return;\n }\n }\n rx /= rl;\n ry /= rl;\n rz /= rl;\n this.up.set(t, ux, uy, uz);\n this.right.set(t, rx, ry, rz);\n this.center.set(t, center[0], center[1], center[2]);\n this.radius.set(t, Math.log(tl));\n var fx = uy * rz - uz * ry;\n var fy = uz * rx - ux * rz;\n var fz = ux * ry - uy * rx;\n var fl = len3(fx, fy, fz);\n fx /= fl;\n fy /= fl;\n fz /= fl;\n var tu = ux * tx + uy * ty + uz * tz;\n var tr = rx * tx + ry * ty + rz * tz;\n var tf = fx * tx + fy * ty + fz * tz;\n var phi = Math.asin(clamp1(tu));\n var theta = Math.atan2(tf, tr);\n var angleState = this.angle._state;\n var lastTheta = angleState[angleState.length - 1];\n var lastPhi = angleState[angleState.length - 2];\n lastTheta = lastTheta % (2 * Math.PI);\n var dp = Math.abs(lastTheta + 2 * Math.PI - theta);\n var d0 = Math.abs(lastTheta - theta);\n var dn = Math.abs(lastTheta - 2 * Math.PI - theta);\n if (dp < d0) {\n lastTheta += 2 * Math.PI;\n }\n if (dn < d0) {\n lastTheta -= 2 * Math.PI;\n }\n this.angle.jump(this.angle.lastT(), lastTheta, lastPhi);\n this.angle.set(t, theta, phi);\n };\n function createTurntableController(options) {\n options = options || {};\n var center = options.center || [0, 0, 0];\n var up = options.up || [0, 1, 0];\n var right = options.right || findOrthoPair(up);\n var radius = options.radius || 1;\n var theta = options.theta || 0;\n var phi = options.phi || 0;\n center = [].slice.call(center, 0, 3);\n up = [].slice.call(up, 0, 3);\n normalize3(up, up);\n right = [].slice.call(right, 0, 3);\n normalize3(right, right);\n if (\"eye\" in options) {\n var eye = options.eye;\n var toward = [\n eye[0] - center[0],\n eye[1] - center[1],\n eye[2] - center[2]\n ];\n cross(right, toward, up);\n if (len3(right[0], right[1], right[2]) < 1e-6) {\n right = findOrthoPair(up);\n } else {\n normalize3(right, right);\n }\n radius = len3(toward[0], toward[1], toward[2]);\n var ut = dot3(up, toward) / radius;\n var rt = dot3(right, toward) / radius;\n phi = Math.acos(ut);\n theta = Math.acos(rt);\n }\n radius = Math.log(radius);\n return new TurntableController(\n options.zoomMin,\n options.zoomMax,\n center,\n up,\n right,\n radius,\n theta,\n phi\n );\n }\n }\n ),\n /***/\n 5250: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = twoProduct;\n var SPLITTER = +(Math.pow(2, 27) + 1);\n function twoProduct(a, b, result) {\n var x = a * b;\n var c = SPLITTER * a;\n var abig = c - a;\n var ahi = c - abig;\n var alo = a - ahi;\n var d = SPLITTER * b;\n var bbig = d - b;\n var bhi = d - bbig;\n var blo = b - bhi;\n var err1 = x - ahi * bhi;\n var err2 = err1 - alo * bhi;\n var err3 = err2 - ahi * blo;\n var y = alo * blo - err3;\n if (result) {\n result[0] = y;\n result[1] = x;\n return result;\n }\n return [y, x];\n }\n }\n ),\n /***/\n 9362: (\n /***/\n function(module2) {\n \"use strict\";\n module2.exports = fastTwoSum;\n function fastTwoSum(a, b, result) {\n var x = a + b;\n var bv = x - a;\n var av = x - bv;\n var br = b - bv;\n var ar = a - av;\n if (result) {\n result[0] = ar + br;\n result[1] = x;\n return result;\n }\n return [ar + br, x];\n }\n }\n ),\n /***/\n 1888: (\n /***/\n function(__unused_webpack_module, exports2, __webpack_require__2) {\n \"use strict\";\n var bits = __webpack_require__2(8828);\n var dup = __webpack_require__2(1338);\n var Buffer2 = __webpack_require__2(4793).hp;\n if (!__webpack_require__2.g.__TYPEDARRAY_POOL) {\n __webpack_require__2.g.__TYPEDARRAY_POOL = {\n UINT8: dup([32, 0]),\n UINT16: dup([32, 0]),\n UINT32: dup([32, 0]),\n BIGUINT64: dup([32, 0]),\n INT8: dup([32, 0]),\n INT16: dup([32, 0]),\n INT32: dup([32, 0]),\n BIGINT64: dup([32, 0]),\n FLOAT: dup([32, 0]),\n DOUBLE: dup([32, 0]),\n DATA: dup([32, 0]),\n UINT8C: dup([32, 0]),\n BUFFER: dup([32, 0])\n };\n }\n var hasUint8C = typeof Uint8ClampedArray !== \"undefined\";\n var hasBigUint64 = typeof BigUint64Array !== \"undefined\";\n var hasBigInt64 = typeof BigInt64Array !== \"undefined\";\n var POOL = __webpack_require__2.g.__TYPEDARRAY_POOL;\n if (!POOL.UINT8C) {\n POOL.UINT8C = dup([32, 0]);\n }\n if (!POOL.BIGUINT64) {\n POOL.BIGUINT64 = dup([32, 0]);\n }\n if (!POOL.BIGINT64) {\n POOL.BIGINT64 = dup([32, 0]);\n }\n if (!POOL.BUFFER) {\n POOL.BUFFER = dup([32, 0]);\n }\n var DATA = POOL.DATA, BUFFER = POOL.BUFFER;\n exports2.free = function free(array) {\n if (Buffer2.isBuffer(array)) {\n BUFFER[bits.log2(array.length)].push(array);\n } else {\n if (Object.prototype.toString.call(array) !== \"[object ArrayBuffer]\") {\n array = array.buffer;\n }\n if (!array) {\n return;\n }\n var n = array.length || array.byteLength;\n var log_n = bits.log2(n) | 0;\n DATA[log_n].push(array);\n }\n };\n function freeArrayBuffer(buffer) {\n if (!buffer) {\n return;\n }\n var n = buffer.length || buffer.byteLength;\n var log_n = bits.log2(n);\n DATA[log_n].push(buffer);\n }\n function freeTypedArray(array) {\n freeArrayBuffer(array.buffer);\n }\n exports2.freeUint8 = exports2.freeUint16 = exports2.freeUint32 = exports2.freeBigUint64 = exports2.freeInt8 = exports2.freeInt16 = exports2.freeInt32 = exports2.freeBigInt64 = exports2.freeFloat32 = exports2.freeFloat = exports2.freeFloat64 = exports2.freeDouble = exports2.freeUint8Clamped = exports2.freeDataView = freeTypedArray;\n exports2.freeArrayBuffer = freeArrayBuffer;\n exports2.freeBuffer = function freeBuffer(array) {\n BUFFER[bits.log2(array.length)].push(array);\n };\n exports2.malloc = function malloc(n, dtype) {\n if (dtype === void 0 || dtype === \"arraybuffer\") {\n return mallocArrayBuffer(n);\n } else {\n switch (dtype) {\n case \"uint8\":\n return mallocUint8(n);\n case \"uint16\":\n return mallocUint16(n);\n case \"uint32\":\n return mallocUint32(n);\n case \"int8\":\n return mallocInt8(n);\n case \"int16\":\n return mallocInt16(n);\n case \"int32\":\n return mallocInt32(n);\n case \"float\":\n case \"float32\":\n return mallocFloat(n);\n case \"double\":\n case \"float64\":\n return mallocDouble(n);\n case \"uint8_clamped\":\n return mallocUint8Clamped(n);\n case \"bigint64\":\n return mallocBigInt64(n);\n case \"biguint64\":\n return mallocBigUint64(n);\n case \"buffer\":\n return mallocBuffer(n);\n case \"data\":\n case \"dataview\":\n return mallocDataView(n);\n default:\n return null;\n }\n }\n return null;\n };\n function mallocArrayBuffer(n) {\n var n = bits.nextPow2(n);\n var log_n = bits.log2(n);\n var d = DATA[log_n];\n if (d.length > 0) {\n return d.pop();\n }\n return new ArrayBuffer(n);\n }\n exports2.mallocArrayBuffer = mallocArrayBuffer;\n function mallocUint8(n) {\n return new Uint8Array(mallocArrayBuffer(n), 0, n);\n }\n exports2.mallocUint8 = mallocUint8;\n function mallocUint16(n) {\n return new Uint16Array(mallocArrayBuffer(2 * n), 0, n);\n }\n exports2.mallocUint16 = mallocUint16;\n function mallocUint32(n) {\n return new Uint32Array(mallocArrayBuffer(4 * n), 0, n);\n }\n exports2.mallocUint32 = mallocUint32;\n function mallocInt8(n) {\n return new Int8Array(mallocArrayBuffer(n), 0, n);\n }\n exports2.mallocInt8 = mallocInt8;\n function mallocInt16(n) {\n return new Int16Array(mallocArrayBuffer(2 * n), 0, n);\n }\n exports2.mallocInt16 = mallocInt16;\n function mallocInt32(n) {\n return new Int32Array(mallocArrayBuffer(4 * n), 0, n);\n }\n exports2.mallocInt32 = mallocInt32;\n function mallocFloat(n) {\n return new Float32Array(mallocArrayBuffer(4 * n), 0, n);\n }\n exports2.mallocFloat32 = exports2.mallocFloat = mallocFloat;\n function mallocDouble(n) {\n return new Float64Array(mallocArrayBuffer(8 * n), 0, n);\n }\n exports2.mallocFloat64 = exports2.mallocDouble = mallocDouble;\n function mallocUint8Clamped(n) {\n if (hasUint8C) {\n return new Uint8ClampedArray(mallocArrayBuffer(n), 0, n);\n } else {\n return mallocUint8(n);\n }\n }\n exports2.mallocUint8Clamped = mallocUint8Clamped;\n function mallocBigUint64(n) {\n if (hasBigUint64) {\n return new BigUint64Array(mallocArrayBuffer(8 * n), 0, n);\n } else {\n return null;\n }\n }\n exports2.mallocBigUint64 = mallocBigUint64;\n function mallocBigInt64(n) {\n if (hasBigInt64) {\n return new BigInt64Array(mallocArrayBuffer(8 * n), 0, n);\n } else {\n return null;\n }\n }\n exports2.mallocBigInt64 = mallocBigInt64;\n function mallocDataView(n) {\n return new DataView(mallocArrayBuffer(n), 0, n);\n }\n exports2.mallocDataView = mallocDataView;\n function mallocBuffer(n) {\n n = bits.nextPow2(n);\n var log_n = bits.log2(n);\n var cache = BUFFER[log_n];\n if (cache.length > 0) {\n return cache.pop();\n }\n return new Buffer2(n);\n }\n exports2.mallocBuffer = mallocBuffer;\n exports2.clearCache = function clearCache() {\n for (var i = 0; i < 32; ++i) {\n POOL.UINT8[i].length = 0;\n POOL.UINT16[i].length = 0;\n POOL.UINT32[i].length = 0;\n POOL.INT8[i].length = 0;\n POOL.INT16[i].length = 0;\n POOL.INT32[i].length = 0;\n POOL.FLOAT[i].length = 0;\n POOL.DOUBLE[i].length = 0;\n POOL.BIGUINT64[i].length = 0;\n POOL.BIGINT64[i].length = 0;\n POOL.UINT8C[i].length = 0;\n DATA[i].length = 0;\n BUFFER[i].length = 0;\n }\n };\n }\n ),\n /***/\n 1755: (\n /***/\n function(module2) {\n \"use strict\";\n \"use restrict\";\n module2.exports = UnionFind;\n function UnionFind(count) {\n this.roots = new Array(count);\n this.ranks = new Array(count);\n for (var i = 0; i < count; ++i) {\n this.roots[i] = i;\n this.ranks[i] = 0;\n }\n }\n var proto = UnionFind.prototype;\n Object.defineProperty(proto, \"length\", {\n \"get\": function() {\n return this.roots.length;\n }\n });\n proto.makeSet = function() {\n var n = this.roots.length;\n this.roots.push(n);\n this.ranks.push(0);\n return n;\n };\n proto.find = function(x) {\n var x0 = x;\n var roots = this.roots;\n while (roots[x] !== x) {\n x = roots[x];\n }\n while (roots[x0] !== x) {\n var y = roots[x0];\n roots[x0] = x;\n x0 = y;\n }\n return x;\n };\n proto.link = function(x, y) {\n var xr = this.find(x), yr = this.find(y);\n if (xr === yr) {\n return;\n }\n var ranks = this.ranks, roots = this.roots, xd = ranks[xr], yd = ranks[yr];\n if (xd < yd) {\n roots[xr] = yr;\n } else if (yd < xd) {\n roots[yr] = xr;\n } else {\n roots[yr] = xr;\n ++ranks[xr];\n }\n };\n }\n ),\n /***/\n 1682: (\n /***/\n function(module2) {\n \"use strict\";\n function unique_pred(list, compare) {\n var ptr = 1, len = list.length, a = list[0], b = list[0];\n for (var i = 1; i < len; ++i) {\n b = a;\n a = list[i];\n if (compare(a, b)) {\n if (i === ptr) {\n ptr++;\n continue;\n }\n list[ptr++] = a;\n }\n }\n list.length = ptr;\n return list;\n }\n function unique_eq(list) {\n var ptr = 1, len = list.length, a = list[0], b = list[0];\n for (var i = 1; i < len; ++i, b = a) {\n b = a;\n a = list[i];\n if (a !== b) {\n if (i === ptr) {\n ptr++;\n continue;\n }\n list[ptr++] = a;\n }\n }\n list.length = ptr;\n return list;\n }\n function unique(list, compare, sorted) {\n if (list.length === 0) {\n return list;\n }\n if (compare) {\n if (!sorted) {\n list.sort(compare);\n }\n return unique_pred(list, compare);\n }\n if (!sorted) {\n list.sort();\n }\n return unique_eq(list);\n }\n module2.exports = unique;\n }\n ),\n /***/\n 4359: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = createText;\n var vectorizeText = __webpack_require__2(7718);\n var defaultCanvas = null;\n var defaultContext = null;\n if (typeof document !== \"undefined\") {\n defaultCanvas = document.createElement(\"canvas\");\n defaultCanvas.width = 8192;\n defaultCanvas.height = 1024;\n defaultContext = defaultCanvas.getContext(\"2d\");\n }\n function createText(str, options) {\n if (typeof options !== \"object\" || options === null) {\n options = {};\n }\n return vectorizeText(\n str,\n options.canvas || defaultCanvas,\n options.context || defaultContext,\n options\n );\n }\n }\n ),\n /***/\n 7718: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n module2.exports = vectorizeText;\n module2.exports.processPixels = processPixels;\n var surfaceNets = __webpack_require__2(3711);\n var ndarray = __webpack_require__2(9618);\n var simplify = __webpack_require__2(5878);\n var cleanPSLG = __webpack_require__2(332);\n var cdt2d = __webpack_require__2(2538);\n var toPolygonCrappy = __webpack_require__2(2095);\n var TAG_bold = \"b\";\n var CHR_bold = \"b|\";\n var TAG_italic = \"i\";\n var CHR_italic = \"i|\";\n var TAG_super = \"sup\";\n var CHR_super0 = \"+\";\n var CHR_super = \"+1\";\n var TAG_sub = \"sub\";\n var CHR_sub0 = \"-\";\n var CHR_sub = \"-1\";\n function parseTag(tag, TAG_CHR, str, map) {\n var opnTag = \"<\" + tag + \">\";\n var clsTag = \"\";\n var nOPN = opnTag.length;\n var nCLS = clsTag.length;\n var isRecursive = TAG_CHR[0] === CHR_super0 || TAG_CHR[0] === CHR_sub0;\n var a = 0;\n var b = -nCLS;\n while (a > -1) {\n a = str.indexOf(opnTag, a);\n if (a === -1) break;\n b = str.indexOf(clsTag, a + nOPN);\n if (b === -1) break;\n if (b <= a) break;\n for (var i = a; i < b + nCLS; ++i) {\n if (i < a + nOPN || i >= b) {\n map[i] = null;\n str = str.substr(0, i) + \" \" + str.substr(i + 1);\n } else {\n if (map[i] !== null) {\n var pos = map[i].indexOf(TAG_CHR[0]);\n if (pos === -1) {\n map[i] += TAG_CHR;\n } else {\n if (isRecursive) {\n map[i] = map[i].substr(0, pos + 1) + (1 + parseInt(map[i][pos + 1])) + map[i].substr(pos + 2);\n }\n }\n }\n }\n }\n var start = a + nOPN;\n var remainingStr = str.substr(start, b - start);\n var c = remainingStr.indexOf(opnTag);\n if (c !== -1) a = c;\n else a = b + nCLS;\n }\n return map;\n }\n function transformPositions(positions, options, size) {\n var align = options.textAlign || \"start\";\n var baseline = options.textBaseline || \"alphabetic\";\n var lo = [1 << 30, 1 << 30];\n var hi = [0, 0];\n var n = positions.length;\n for (var i = 0; i < n; ++i) {\n var p = positions[i];\n for (var j = 0; j < 2; ++j) {\n lo[j] = Math.min(lo[j], p[j]) | 0;\n hi[j] = Math.max(hi[j], p[j]) | 0;\n }\n }\n var xShift = 0;\n switch (align) {\n case \"center\":\n xShift = -0.5 * (lo[0] + hi[0]);\n break;\n case \"right\":\n case \"end\":\n xShift = -hi[0];\n break;\n case \"left\":\n case \"start\":\n xShift = -lo[0];\n break;\n default:\n throw new Error(\"vectorize-text: Unrecognized textAlign: '\" + align + \"'\");\n }\n var yShift = 0;\n switch (baseline) {\n case \"hanging\":\n case \"top\":\n yShift = -lo[1];\n break;\n case \"middle\":\n yShift = -0.5 * (lo[1] + hi[1]);\n break;\n case \"alphabetic\":\n case \"ideographic\":\n yShift = -3 * size;\n break;\n case \"bottom\":\n yShift = -hi[1];\n break;\n default:\n throw new Error(\"vectorize-text: Unrecoginized textBaseline: '\" + baseline + \"'\");\n }\n var scale = 1 / size;\n if (\"lineHeight\" in options) {\n scale *= +options.lineHeight;\n } else if (\"width\" in options) {\n scale = options.width / (hi[0] - lo[0]);\n } else if (\"height\" in options) {\n scale = options.height / (hi[1] - lo[1]);\n }\n return positions.map(function(p2) {\n return [scale * (p2[0] + xShift), scale * (p2[1] + yShift)];\n });\n }\n function getPixels(canvas, context, rawString, fontSize, lineSpacing, styletags) {\n rawString = rawString.replace(/\\n/g, \"\");\n if (styletags.breaklines === true) {\n rawString = rawString.replace(/\\/g, \"\\n\");\n } else {\n rawString = rawString.replace(/\\/g, \" \");\n }\n var activeStyle = \"\";\n var map = [];\n for (j = 0; j < rawString.length; ++j) {\n map[j] = activeStyle;\n }\n if (styletags.bolds === true) map = parseTag(TAG_bold, CHR_bold, rawString, map);\n if (styletags.italics === true) map = parseTag(TAG_italic, CHR_italic, rawString, map);\n if (styletags.superscripts === true) map = parseTag(TAG_super, CHR_super, rawString, map);\n if (styletags.subscripts === true) map = parseTag(TAG_sub, CHR_sub, rawString, map);\n var allStyles = [];\n var plainText = \"\";\n for (j = 0; j < rawString.length; ++j) {\n if (map[j] !== null) {\n plainText += rawString[j];\n allStyles.push(map[j]);\n }\n }\n var allTexts = plainText.split(\"\\n\");\n var numberOfLines = allTexts.length;\n var lineHeight = Math.round(lineSpacing * fontSize);\n var offsetX = fontSize;\n var offsetY = fontSize * 2;\n var maxWidth = 0;\n var minHeight = numberOfLines * lineHeight + offsetY;\n if (canvas.height < minHeight) {\n canvas.height = minHeight;\n }\n context.fillStyle = \"#000\";\n context.fillRect(0, 0, canvas.width, canvas.height);\n context.fillStyle = \"#fff\";\n var i, j, xPos, yPos, zPos;\n var nDone = 0;\n var buffer = \"\";\n function writeBuffer() {\n if (buffer !== \"\") {\n var delta = context.measureText(buffer).width;\n context.fillText(buffer, offsetX + xPos, offsetY + yPos);\n xPos += delta;\n }\n }\n function getTextFontSize() {\n return \"\" + Math.round(zPos) + \"px \";\n }\n function changeStyle(oldStyle, newStyle) {\n var ctxFont = \"\" + context.font;\n if (styletags.subscripts === true) {\n var oldIndex_Sub = oldStyle.indexOf(CHR_sub0);\n var newIndex_Sub = newStyle.indexOf(CHR_sub0);\n var oldSub = oldIndex_Sub > -1 ? parseInt(oldStyle[1 + oldIndex_Sub]) : 0;\n var newSub = newIndex_Sub > -1 ? parseInt(newStyle[1 + newIndex_Sub]) : 0;\n if (oldSub !== newSub) {\n ctxFont = ctxFont.replace(getTextFontSize(), \"?px \");\n zPos *= Math.pow(0.75, newSub - oldSub);\n ctxFont = ctxFont.replace(\"?px \", getTextFontSize());\n }\n yPos += 0.25 * lineHeight * (newSub - oldSub);\n }\n if (styletags.superscripts === true) {\n var oldIndex_Super = oldStyle.indexOf(CHR_super0);\n var newIndex_Super = newStyle.indexOf(CHR_super0);\n var oldSuper = oldIndex_Super > -1 ? parseInt(oldStyle[1 + oldIndex_Super]) : 0;\n var newSuper = newIndex_Super > -1 ? parseInt(newStyle[1 + newIndex_Super]) : 0;\n if (oldSuper !== newSuper) {\n ctxFont = ctxFont.replace(getTextFontSize(), \"?px \");\n zPos *= Math.pow(0.75, newSuper - oldSuper);\n ctxFont = ctxFont.replace(\"?px \", getTextFontSize());\n }\n yPos -= 0.25 * lineHeight * (newSuper - oldSuper);\n }\n if (styletags.bolds === true) {\n var wasBold = oldStyle.indexOf(CHR_bold) > -1;\n var is_Bold = newStyle.indexOf(CHR_bold) > -1;\n if (!wasBold && is_Bold) {\n if (wasItalic) {\n ctxFont = ctxFont.replace(\"italic \", \"italic bold \");\n } else {\n ctxFont = \"bold \" + ctxFont;\n }\n }\n if (wasBold && !is_Bold) {\n ctxFont = ctxFont.replace(\"bold \", \"\");\n }\n }\n if (styletags.italics === true) {\n var wasItalic = oldStyle.indexOf(CHR_italic) > -1;\n var is_Italic = newStyle.indexOf(CHR_italic) > -1;\n if (!wasItalic && is_Italic) {\n ctxFont = \"italic \" + ctxFont;\n }\n if (wasItalic && !is_Italic) {\n ctxFont = ctxFont.replace(\"italic \", \"\");\n }\n }\n context.font = ctxFont;\n }\n for (i = 0; i < numberOfLines; ++i) {\n var txt = allTexts[i] + \"\\n\";\n xPos = 0;\n yPos = i * lineHeight;\n zPos = fontSize;\n buffer = \"\";\n for (j = 0; j < txt.length; ++j) {\n var style = j + nDone < allStyles.length ? allStyles[j + nDone] : allStyles[allStyles.length - 1];\n if (activeStyle === style) {\n buffer += txt[j];\n } else {\n writeBuffer();\n buffer = txt[j];\n if (style !== void 0) {\n changeStyle(activeStyle, style);\n activeStyle = style;\n }\n }\n }\n writeBuffer();\n nDone += txt.length;\n var width = Math.round(xPos + 2 * offsetX) | 0;\n if (maxWidth < width) maxWidth = width;\n }\n var xCut = maxWidth;\n var yCut = offsetY + lineHeight * numberOfLines;\n var pixels = ndarray(context.getImageData(0, 0, xCut, yCut).data, [yCut, xCut, 4]);\n return pixels.pick(-1, -1, 0).transpose(1, 0);\n }\n function getContour(pixels, doSimplify) {\n var contour = surfaceNets(pixels, 128);\n if (doSimplify) {\n return simplify(contour.cells, contour.positions, 0.25);\n }\n return {\n edges: contour.cells,\n positions: contour.positions\n };\n }\n function processPixelsImpl(pixels, options, size, simplify2) {\n var contour = getContour(pixels, simplify2);\n var positions = transformPositions(contour.positions, options, size);\n var edges = contour.edges;\n var flip = \"ccw\" === options.orientation;\n cleanPSLG(positions, edges);\n if (options.polygons || options.polygon || options.polyline) {\n var result = toPolygonCrappy(edges, positions);\n var nresult = new Array(result.length);\n for (var i = 0; i < result.length; ++i) {\n var loops = result[i];\n var nloops = new Array(loops.length);\n for (var j = 0; j < loops.length; ++j) {\n var loop = loops[j];\n var nloop = new Array(loop.length);\n for (var k = 0; k < loop.length; ++k) {\n nloop[k] = positions[loop[k]].slice();\n }\n if (flip) {\n nloop.reverse();\n }\n nloops[j] = nloop;\n }\n nresult[i] = nloops;\n }\n return nresult;\n } else if (options.triangles || options.triangulate || options.triangle) {\n return {\n cells: cdt2d(positions, edges, {\n delaunay: false,\n exterior: false,\n interior: true\n }),\n positions\n };\n } else {\n return {\n edges,\n positions\n };\n }\n }\n function processPixels(pixels, options, size) {\n try {\n return processPixelsImpl(pixels, options, size, true);\n } catch (e) {\n }\n try {\n return processPixelsImpl(pixels, options, size, false);\n } catch (e) {\n }\n if (options.polygons || options.polyline || options.polygon) {\n return [];\n }\n if (options.triangles || options.triangulate || options.triangle) {\n return {\n cells: [],\n positions: []\n };\n }\n return {\n edges: [],\n positions: []\n };\n }\n function vectorizeText(str, canvas, context, options) {\n var size = 64;\n var lineSpacing = 1.25;\n var styletags = {\n breaklines: false,\n bolds: false,\n italics: false,\n subscripts: false,\n superscripts: false\n };\n if (options) {\n if (options.size && options.size > 0) size = options.size;\n if (options.lineSpacing && options.lineSpacing > 0) lineSpacing = options.lineSpacing;\n if (options.styletags && options.styletags.breaklines) styletags.breaklines = options.styletags.breaklines ? true : false;\n if (options.styletags && options.styletags.bolds) styletags.bolds = options.styletags.bolds ? true : false;\n if (options.styletags && options.styletags.italics) styletags.italics = options.styletags.italics ? true : false;\n if (options.styletags && options.styletags.subscripts) styletags.subscripts = options.styletags.subscripts ? true : false;\n if (options.styletags && options.styletags.superscripts) styletags.superscripts = options.styletags.superscripts ? true : false;\n }\n context.font = [\n options.fontStyle,\n options.fontVariant,\n options.fontWeight,\n size + \"px\",\n options.font\n ].filter(function(d) {\n return d;\n }).join(\" \");\n context.textAlign = \"start\";\n context.textBaseline = \"alphabetic\";\n context.direction = \"ltr\";\n var pixels = getPixels(canvas, context, str, size, lineSpacing, styletags);\n return processPixels(pixels, options, size);\n }\n }\n ),\n /***/\n 1538: (\n /***/\n function(module2) {\n (function WeakMapModule() {\n \"use strict\";\n if (typeof ses !== \"undefined\" && ses.ok && !ses.ok()) {\n return;\n }\n function weakMapPermitHostObjects(map) {\n if (map.permitHostObjects___) {\n map.permitHostObjects___(weakMapPermitHostObjects);\n }\n }\n if (typeof ses !== \"undefined\") {\n ses.weakMapPermitHostObjects = weakMapPermitHostObjects;\n }\n var doubleWeakMapCheckSilentFailure = false;\n if (typeof WeakMap === \"function\") {\n var HostWeakMap = WeakMap;\n if (typeof navigator !== \"undefined\" && /Firefox/.test(navigator.userAgent)) {\n } else {\n var testMap = new HostWeakMap();\n var testObject = Object.freeze({});\n testMap.set(testObject, 1);\n if (testMap.get(testObject) !== 1) {\n doubleWeakMapCheckSilentFailure = true;\n } else {\n module2.exports = WeakMap;\n return;\n }\n }\n }\n var hop = Object.prototype.hasOwnProperty;\n var gopn = Object.getOwnPropertyNames;\n var defProp = Object.defineProperty;\n var isExtensible = Object.isExtensible;\n var HIDDEN_NAME_PREFIX = \"weakmap:\";\n var HIDDEN_NAME = HIDDEN_NAME_PREFIX + \"ident:\" + Math.random() + \"___\";\n if (typeof crypto !== \"undefined\" && typeof crypto.getRandomValues === \"function\" && typeof ArrayBuffer === \"function\" && typeof Uint8Array === \"function\") {\n var ab = new ArrayBuffer(25);\n var u8s = new Uint8Array(ab);\n crypto.getRandomValues(u8s);\n HIDDEN_NAME = HIDDEN_NAME_PREFIX + \"rand:\" + Array.prototype.map.call(u8s, function(u8) {\n return (u8 % 36).toString(36);\n }).join(\"\") + \"___\";\n }\n function isNotHiddenName(name2) {\n return !(name2.substr(0, HIDDEN_NAME_PREFIX.length) == HIDDEN_NAME_PREFIX && name2.substr(name2.length - 3) === \"___\");\n }\n defProp(Object, \"getOwnPropertyNames\", {\n value: function fakeGetOwnPropertyNames(obj) {\n return gopn(obj).filter(isNotHiddenName);\n }\n });\n if (\"getPropertyNames\" in Object) {\n var originalGetPropertyNames = Object.getPropertyNames;\n defProp(Object, \"getPropertyNames\", {\n value: function fakeGetPropertyNames(obj) {\n return originalGetPropertyNames(obj).filter(isNotHiddenName);\n }\n });\n }\n function getHiddenRecord(key) {\n if (key !== Object(key)) {\n throw new TypeError(\"Not an object: \" + key);\n }\n var hiddenRecord = key[HIDDEN_NAME];\n if (hiddenRecord && hiddenRecord.key === key) {\n return hiddenRecord;\n }\n if (!isExtensible(key)) {\n return void 0;\n }\n hiddenRecord = { key };\n try {\n defProp(key, HIDDEN_NAME, {\n value: hiddenRecord,\n writable: false,\n enumerable: false,\n configurable: false\n });\n return hiddenRecord;\n } catch (error) {\n return void 0;\n }\n }\n (function() {\n var oldFreeze = Object.freeze;\n defProp(Object, \"freeze\", {\n value: function identifyingFreeze(obj) {\n getHiddenRecord(obj);\n return oldFreeze(obj);\n }\n });\n var oldSeal = Object.seal;\n defProp(Object, \"seal\", {\n value: function identifyingSeal(obj) {\n getHiddenRecord(obj);\n return oldSeal(obj);\n }\n });\n var oldPreventExtensions = Object.preventExtensions;\n defProp(Object, \"preventExtensions\", {\n value: function identifyingPreventExtensions(obj) {\n getHiddenRecord(obj);\n return oldPreventExtensions(obj);\n }\n });\n })();\n function constFunc(func) {\n func.prototype = null;\n return Object.freeze(func);\n }\n var calledAsFunctionWarningDone = false;\n function calledAsFunctionWarning() {\n if (!calledAsFunctionWarningDone && typeof console !== \"undefined\") {\n calledAsFunctionWarningDone = true;\n console.warn(\"WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future.\");\n }\n }\n var nextId = 0;\n var OurWeakMap = function() {\n if (!(this instanceof OurWeakMap)) {\n calledAsFunctionWarning();\n }\n var keys = [];\n var values = [];\n var id = nextId++;\n function get___(key, opt_default) {\n var index;\n var hiddenRecord = getHiddenRecord(key);\n if (hiddenRecord) {\n return id in hiddenRecord ? hiddenRecord[id] : opt_default;\n } else {\n index = keys.indexOf(key);\n return index >= 0 ? values[index] : opt_default;\n }\n }\n function has___(key) {\n var hiddenRecord = getHiddenRecord(key);\n if (hiddenRecord) {\n return id in hiddenRecord;\n } else {\n return keys.indexOf(key) >= 0;\n }\n }\n function set___(key, value) {\n var index;\n var hiddenRecord = getHiddenRecord(key);\n if (hiddenRecord) {\n hiddenRecord[id] = value;\n } else {\n index = keys.indexOf(key);\n if (index >= 0) {\n values[index] = value;\n } else {\n index = keys.length;\n values[index] = value;\n keys[index] = key;\n }\n }\n return this;\n }\n function delete___(key) {\n var hiddenRecord = getHiddenRecord(key);\n var index, lastIndex;\n if (hiddenRecord) {\n return id in hiddenRecord && delete hiddenRecord[id];\n } else {\n index = keys.indexOf(key);\n if (index < 0) {\n return false;\n }\n lastIndex = keys.length - 1;\n keys[index] = void 0;\n values[index] = values[lastIndex];\n keys[index] = keys[lastIndex];\n keys.length = lastIndex;\n values.length = lastIndex;\n return true;\n }\n }\n return Object.create(OurWeakMap.prototype, {\n get___: { value: constFunc(get___) },\n has___: { value: constFunc(has___) },\n set___: { value: constFunc(set___) },\n delete___: { value: constFunc(delete___) }\n });\n };\n OurWeakMap.prototype = Object.create(Object.prototype, {\n get: {\n /**\n * Return the value most recently associated with key, or\n * opt_default if none.\n */\n value: function get(key, opt_default) {\n return this.get___(key, opt_default);\n },\n writable: true,\n configurable: true\n },\n has: {\n /**\n * Is there a value associated with key in this WeakMap?\n */\n value: function has(key) {\n return this.has___(key);\n },\n writable: true,\n configurable: true\n },\n set: {\n /**\n * Associate value with key in this WeakMap, overwriting any\n * previous association if present.\n */\n value: function set(key, value) {\n return this.set___(key, value);\n },\n writable: true,\n configurable: true\n },\n \"delete\": {\n /**\n * Remove any association for key in this WeakMap, returning\n * whether there was one.\n *\n *

    Note that the boolean return here does not work like the\n * {@code delete} operator. The {@code delete} operator returns\n * whether the deletion succeeds at bringing about a state in\n * which the deleted property is absent. The {@code delete}\n * operator therefore returns true if the property was already\n * absent, whereas this {@code delete} method returns false if\n * the association was already absent.\n */\n value: function remove(key) {\n return this.delete___(key);\n },\n writable: true,\n configurable: true\n }\n });\n if (typeof HostWeakMap === \"function\") {\n (function() {\n if (doubleWeakMapCheckSilentFailure && typeof Proxy !== \"undefined\") {\n Proxy = void 0;\n }\n function DoubleWeakMap() {\n if (!(this instanceof OurWeakMap)) {\n calledAsFunctionWarning();\n }\n var hmap = new HostWeakMap();\n var omap = void 0;\n var enableSwitching = false;\n function dget(key, opt_default) {\n if (omap) {\n return hmap.has(key) ? hmap.get(key) : omap.get___(key, opt_default);\n } else {\n return hmap.get(key, opt_default);\n }\n }\n function dhas(key) {\n return hmap.has(key) || (omap ? omap.has___(key) : false);\n }\n var dset;\n if (doubleWeakMapCheckSilentFailure) {\n dset = function(key, value) {\n hmap.set(key, value);\n if (!hmap.has(key)) {\n if (!omap) {\n omap = new OurWeakMap();\n }\n omap.set(key, value);\n }\n return this;\n };\n } else {\n dset = function(key, value) {\n if (enableSwitching) {\n try {\n hmap.set(key, value);\n } catch (e) {\n if (!omap) {\n omap = new OurWeakMap();\n }\n omap.set___(key, value);\n }\n } else {\n hmap.set(key, value);\n }\n return this;\n };\n }\n function ddelete(key) {\n var result = !!hmap[\"delete\"](key);\n if (omap) {\n return omap.delete___(key) || result;\n }\n return result;\n }\n return Object.create(OurWeakMap.prototype, {\n get___: { value: constFunc(dget) },\n has___: { value: constFunc(dhas) },\n set___: { value: constFunc(dset) },\n delete___: { value: constFunc(ddelete) },\n permitHostObjects___: { value: constFunc(function(token) {\n if (token === weakMapPermitHostObjects) {\n enableSwitching = true;\n } else {\n throw new Error(\"bogus call to permitHostObjects___\");\n }\n }) }\n });\n }\n DoubleWeakMap.prototype = OurWeakMap.prototype;\n module2.exports = DoubleWeakMap;\n Object.defineProperty(WeakMap.prototype, \"constructor\", {\n value: WeakMap,\n enumerable: false,\n // as default .constructor is\n configurable: true,\n writable: true\n });\n })();\n } else {\n if (typeof Proxy !== \"undefined\") {\n Proxy = void 0;\n }\n module2.exports = OurWeakMap;\n }\n })();\n }\n ),\n /***/\n 236: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n var hiddenStore = __webpack_require__2(8284);\n module2.exports = createStore;\n function createStore() {\n var key = {};\n return function(obj) {\n if ((typeof obj !== \"object\" || obj === null) && typeof obj !== \"function\") {\n throw new Error(\"Weakmap-shim: Key must be object\");\n }\n var store = obj.valueOf(key);\n return store && store.identity === key ? store : hiddenStore(obj, key);\n };\n }\n }\n ),\n /***/\n 8284: (\n /***/\n function(module2) {\n module2.exports = hiddenStore;\n function hiddenStore(obj, key) {\n var store = { identity: key };\n var valueOf = obj.valueOf;\n Object.defineProperty(obj, \"valueOf\", {\n value: function(value) {\n return value !== key ? valueOf.apply(this, arguments) : store;\n },\n writable: true\n });\n return store;\n }\n }\n ),\n /***/\n 606: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n var createStore = __webpack_require__2(236);\n module2.exports = weakMap;\n function weakMap() {\n var privates = createStore();\n return {\n \"get\": function(key, fallback) {\n var store = privates(key);\n return store.hasOwnProperty(\"value\") ? store.value : fallback;\n },\n \"set\": function(key, value) {\n privates(key).value = value;\n return this;\n },\n \"has\": function(key) {\n return \"value\" in privates(key);\n },\n \"delete\": function(key) {\n return delete privates(key).value;\n }\n };\n }\n }\n ),\n /***/\n 3349: (\n /***/\n function(module2) {\n \"use strict\";\n function CWiseOp() {\n return function(SS, a0, t02, p0, Y0, Y1) {\n var s0 = SS[0], t0p0 = t02[0], index = [0], q0 = t0p0;\n p0 |= 0;\n var i0 = 0, d0s0 = t0p0;\n for (i0 = 0; i0 < s0; ++i0) {\n {\n var da = a0[p0] - Y1;\n var db = a0[p0 + q0] - Y1;\n if (da >= 0 !== db >= 0) {\n Y0.push(index[0] + 0.5 + 0.5 * (da + db) / (da - db));\n }\n }\n p0 += d0s0;\n ++index[0];\n }\n };\n }\n function generateCWiseOp() {\n return CWiseOp();\n }\n var compile = generateCWiseOp;\n function thunk(compile2) {\n var CACHED = {};\n return function zeroCrossings_cwise_thunk(array0, scalar2, scalar3) {\n var t02 = array0.dtype, r0 = array0.order, type = [t02, r0.join()].join(), proc = CACHED[type];\n if (!proc) {\n CACHED[type] = proc = compile2([t02, r0]);\n }\n return proc(array0.shape.slice(0), array0.data, array0.stride, array0.offset | 0, scalar2, scalar3);\n };\n }\n function createThunk(proc) {\n return thunk(compile.bind(void 0, proc));\n }\n function compileCwise(user_args) {\n return createThunk({\n funcName: user_args.funcName\n });\n }\n module2.exports = compileCwise({\n funcName: \"zeroCrossings\"\n });\n }\n ),\n /***/\n 781: (\n /***/\n function(module2, __unused_webpack_exports, __webpack_require__2) {\n \"use strict\";\n module2.exports = findZeroCrossings;\n var core = __webpack_require__2(3349);\n function findZeroCrossings(array, level) {\n var cross = [];\n level = +level || 0;\n core(array.hi(array.shape[0] - 1), cross, level);\n return cross;\n }\n }\n ),\n /***/\n 7790: (\n /***/\n function() {\n }\n )\n /******/\n };\n var __webpack_module_cache__ = {};\n function __webpack_require__(moduleId) {\n var cachedModule = __webpack_module_cache__[moduleId];\n if (cachedModule !== void 0) {\n return cachedModule.exports;\n }\n var module2 = __webpack_module_cache__[moduleId] = {\n /******/\n id: moduleId,\n /******/\n loaded: false,\n /******/\n exports: {}\n /******/\n };\n __webpack_modules__[moduleId].call(module2.exports, module2, module2.exports, __webpack_require__);\n module2.loaded = true;\n return module2.exports;\n }\n !function() {\n __webpack_require__.g = function() {\n if (typeof globalThis === \"object\") return globalThis;\n try {\n return this || new Function(\"return this\")();\n } catch (e) {\n if (typeof window === \"object\") return window;\n }\n }();\n }();\n !function() {\n __webpack_require__.nmd = function(module2) {\n module2.paths = [];\n if (!module2.children) module2.children = [];\n return module2;\n };\n }();\n var __webpack_exports__ = __webpack_require__(1964);\n module.exports = __webpack_exports__;\n })();\n }\n });\n\n // node_modules/color-name/index.js\n var require_color_name = __commonJS({\n \"node_modules/color-name/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n \"aliceblue\": [240, 248, 255],\n \"antiquewhite\": [250, 235, 215],\n \"aqua\": [0, 255, 255],\n \"aquamarine\": [127, 255, 212],\n \"azure\": [240, 255, 255],\n \"beige\": [245, 245, 220],\n \"bisque\": [255, 228, 196],\n \"black\": [0, 0, 0],\n \"blanchedalmond\": [255, 235, 205],\n \"blue\": [0, 0, 255],\n \"blueviolet\": [138, 43, 226],\n \"brown\": [165, 42, 42],\n \"burlywood\": [222, 184, 135],\n \"cadetblue\": [95, 158, 160],\n \"chartreuse\": [127, 255, 0],\n \"chocolate\": [210, 105, 30],\n \"coral\": [255, 127, 80],\n \"cornflowerblue\": [100, 149, 237],\n \"cornsilk\": [255, 248, 220],\n \"crimson\": [220, 20, 60],\n \"cyan\": [0, 255, 255],\n \"darkblue\": [0, 0, 139],\n \"darkcyan\": [0, 139, 139],\n \"darkgoldenrod\": [184, 134, 11],\n \"darkgray\": [169, 169, 169],\n \"darkgreen\": [0, 100, 0],\n \"darkgrey\": [169, 169, 169],\n \"darkkhaki\": [189, 183, 107],\n \"darkmagenta\": [139, 0, 139],\n \"darkolivegreen\": [85, 107, 47],\n \"darkorange\": [255, 140, 0],\n \"darkorchid\": [153, 50, 204],\n \"darkred\": [139, 0, 0],\n \"darksalmon\": [233, 150, 122],\n \"darkseagreen\": [143, 188, 143],\n \"darkslateblue\": [72, 61, 139],\n \"darkslategray\": [47, 79, 79],\n \"darkslategrey\": [47, 79, 79],\n \"darkturquoise\": [0, 206, 209],\n \"darkviolet\": [148, 0, 211],\n \"deeppink\": [255, 20, 147],\n \"deepskyblue\": [0, 191, 255],\n \"dimgray\": [105, 105, 105],\n \"dimgrey\": [105, 105, 105],\n \"dodgerblue\": [30, 144, 255],\n \"firebrick\": [178, 34, 34],\n \"floralwhite\": [255, 250, 240],\n \"forestgreen\": [34, 139, 34],\n \"fuchsia\": [255, 0, 255],\n \"gainsboro\": [220, 220, 220],\n \"ghostwhite\": [248, 248, 255],\n \"gold\": [255, 215, 0],\n \"goldenrod\": [218, 165, 32],\n \"gray\": [128, 128, 128],\n \"green\": [0, 128, 0],\n \"greenyellow\": [173, 255, 47],\n \"grey\": [128, 128, 128],\n \"honeydew\": [240, 255, 240],\n \"hotpink\": [255, 105, 180],\n \"indianred\": [205, 92, 92],\n \"indigo\": [75, 0, 130],\n \"ivory\": [255, 255, 240],\n \"khaki\": [240, 230, 140],\n \"lavender\": [230, 230, 250],\n \"lavenderblush\": [255, 240, 245],\n \"lawngreen\": [124, 252, 0],\n \"lemonchiffon\": [255, 250, 205],\n \"lightblue\": [173, 216, 230],\n \"lightcoral\": [240, 128, 128],\n \"lightcyan\": [224, 255, 255],\n \"lightgoldenrodyellow\": [250, 250, 210],\n \"lightgray\": [211, 211, 211],\n \"lightgreen\": [144, 238, 144],\n \"lightgrey\": [211, 211, 211],\n \"lightpink\": [255, 182, 193],\n \"lightsalmon\": [255, 160, 122],\n \"lightseagreen\": [32, 178, 170],\n \"lightskyblue\": [135, 206, 250],\n \"lightslategray\": [119, 136, 153],\n \"lightslategrey\": [119, 136, 153],\n \"lightsteelblue\": [176, 196, 222],\n \"lightyellow\": [255, 255, 224],\n \"lime\": [0, 255, 0],\n \"limegreen\": [50, 205, 50],\n \"linen\": [250, 240, 230],\n \"magenta\": [255, 0, 255],\n \"maroon\": [128, 0, 0],\n \"mediumaquamarine\": [102, 205, 170],\n \"mediumblue\": [0, 0, 205],\n \"mediumorchid\": [186, 85, 211],\n \"mediumpurple\": [147, 112, 219],\n \"mediumseagreen\": [60, 179, 113],\n \"mediumslateblue\": [123, 104, 238],\n \"mediumspringgreen\": [0, 250, 154],\n \"mediumturquoise\": [72, 209, 204],\n \"mediumvioletred\": [199, 21, 133],\n \"midnightblue\": [25, 25, 112],\n \"mintcream\": [245, 255, 250],\n \"mistyrose\": [255, 228, 225],\n \"moccasin\": [255, 228, 181],\n \"navajowhite\": [255, 222, 173],\n \"navy\": [0, 0, 128],\n \"oldlace\": [253, 245, 230],\n \"olive\": [128, 128, 0],\n \"olivedrab\": [107, 142, 35],\n \"orange\": [255, 165, 0],\n \"orangered\": [255, 69, 0],\n \"orchid\": [218, 112, 214],\n \"palegoldenrod\": [238, 232, 170],\n \"palegreen\": [152, 251, 152],\n \"paleturquoise\": [175, 238, 238],\n \"palevioletred\": [219, 112, 147],\n \"papayawhip\": [255, 239, 213],\n \"peachpuff\": [255, 218, 185],\n \"peru\": [205, 133, 63],\n \"pink\": [255, 192, 203],\n \"plum\": [221, 160, 221],\n \"powderblue\": [176, 224, 230],\n \"purple\": [128, 0, 128],\n \"rebeccapurple\": [102, 51, 153],\n \"red\": [255, 0, 0],\n \"rosybrown\": [188, 143, 143],\n \"royalblue\": [65, 105, 225],\n \"saddlebrown\": [139, 69, 19],\n \"salmon\": [250, 128, 114],\n \"sandybrown\": [244, 164, 96],\n \"seagreen\": [46, 139, 87],\n \"seashell\": [255, 245, 238],\n \"sienna\": [160, 82, 45],\n \"silver\": [192, 192, 192],\n \"skyblue\": [135, 206, 235],\n \"slateblue\": [106, 90, 205],\n \"slategray\": [112, 128, 144],\n \"slategrey\": [112, 128, 144],\n \"snow\": [255, 250, 250],\n \"springgreen\": [0, 255, 127],\n \"steelblue\": [70, 130, 180],\n \"tan\": [210, 180, 140],\n \"teal\": [0, 128, 128],\n \"thistle\": [216, 191, 216],\n \"tomato\": [255, 99, 71],\n \"turquoise\": [64, 224, 208],\n \"violet\": [238, 130, 238],\n \"wheat\": [245, 222, 179],\n \"white\": [255, 255, 255],\n \"whitesmoke\": [245, 245, 245],\n \"yellow\": [255, 255, 0],\n \"yellowgreen\": [154, 205, 50]\n };\n }\n });\n\n // node_modules/color-normalize/node_modules/color-parse/index.js\n var require_color_parse = __commonJS({\n \"node_modules/color-normalize/node_modules/color-parse/index.js\"(exports, module) {\n \"use strict\";\n var names2 = require_color_name();\n module.exports = parse2;\n var baseHues2 = {\n red: 0,\n orange: 60,\n yellow: 120,\n green: 180,\n blue: 240,\n purple: 300\n };\n function parse2(cstr) {\n var m, parts = [], alpha = 1, space;\n if (typeof cstr === \"string\") {\n cstr = cstr.toLowerCase();\n if (names2[cstr]) {\n parts = names2[cstr].slice();\n space = \"rgb\";\n } else if (cstr === \"transparent\") {\n alpha = 0;\n space = \"rgb\";\n parts = [0, 0, 0];\n } else if (/^#[A-Fa-f0-9]+$/.test(cstr)) {\n var base = cstr.slice(1);\n var size = base.length;\n var isShort = size <= 4;\n alpha = 1;\n if (isShort) {\n parts = [\n parseInt(base[0] + base[0], 16),\n parseInt(base[1] + base[1], 16),\n parseInt(base[2] + base[2], 16)\n ];\n if (size === 4) {\n alpha = parseInt(base[3] + base[3], 16) / 255;\n }\n } else {\n parts = [\n parseInt(base[0] + base[1], 16),\n parseInt(base[2] + base[3], 16),\n parseInt(base[4] + base[5], 16)\n ];\n if (size === 8) {\n alpha = parseInt(base[6] + base[7], 16) / 255;\n }\n }\n if (!parts[0]) parts[0] = 0;\n if (!parts[1]) parts[1] = 0;\n if (!parts[2]) parts[2] = 0;\n space = \"rgb\";\n } else if (m = /^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\\s*\\(([^\\)]*)\\)/.exec(cstr)) {\n var name2 = m[1];\n var isRGB = name2 === \"rgb\";\n var base = name2.replace(/a$/, \"\");\n space = base;\n var size = base === \"cmyk\" ? 4 : base === \"gray\" ? 1 : 3;\n parts = m[2].trim().split(/\\s*[,\\/]\\s*|\\s+/).map(function(x, i) {\n if (/%$/.test(x)) {\n if (i === size) return parseFloat(x) / 100;\n if (base === \"rgb\") return parseFloat(x) * 255 / 100;\n return parseFloat(x);\n } else if (base[i] === \"h\") {\n if (/deg$/.test(x)) {\n return parseFloat(x);\n } else if (baseHues2[x] !== void 0) {\n return baseHues2[x];\n }\n }\n return parseFloat(x);\n });\n if (name2 === base) parts.push(1);\n alpha = isRGB ? 1 : parts[size] === void 0 ? 1 : parts[size];\n parts = parts.slice(0, size);\n } else if (cstr.length > 10 && /[0-9](?:\\s|\\/)/.test(cstr)) {\n parts = cstr.match(/([0-9]+)/g).map(function(value) {\n return parseFloat(value);\n });\n space = cstr.match(/([a-z])/ig).join(\"\").toLowerCase();\n }\n } else if (!isNaN(cstr)) {\n space = \"rgb\";\n parts = [cstr >>> 16, (cstr & 65280) >>> 8, cstr & 255];\n } else if (Array.isArray(cstr) || cstr.length) {\n parts = [cstr[0], cstr[1], cstr[2]];\n space = \"rgb\";\n alpha = cstr.length === 4 ? cstr[3] : 1;\n } else if (cstr instanceof Object) {\n if (cstr.r != null || cstr.red != null || cstr.R != null) {\n space = \"rgb\";\n parts = [\n cstr.r || cstr.red || cstr.R || 0,\n cstr.g || cstr.green || cstr.G || 0,\n cstr.b || cstr.blue || cstr.B || 0\n ];\n } else {\n space = \"hsl\";\n parts = [\n cstr.h || cstr.hue || cstr.H || 0,\n cstr.s || cstr.saturation || cstr.S || 0,\n cstr.l || cstr.lightness || cstr.L || cstr.b || cstr.brightness\n ];\n }\n alpha = cstr.a || cstr.alpha || cstr.opacity || 1;\n if (cstr.opacity != null) alpha /= 100;\n }\n return {\n space,\n values: parts,\n alpha\n };\n }\n }\n });\n\n // node_modules/color-normalize/node_modules/color-rgba/index.js\n var require_color_rgba = __commonJS({\n \"node_modules/color-normalize/node_modules/color-rgba/index.js\"(exports, module) {\n \"use strict\";\n var parse2 = require_color_parse();\n module.exports = function rgba3(color2) {\n if (Array.isArray(color2) && color2.raw) color2 = String.raw.apply(null, arguments);\n var values, i, l;\n var parsed = parse2(color2);\n if (!parsed.space) return [];\n var min = [0, 0, 0], max = parsed.space[0] === \"h\" ? [360, 100, 100] : [255, 255, 255];\n values = Array(3);\n values[0] = Math.min(Math.max(parsed.values[0], min[0]), max[0]);\n values[1] = Math.min(Math.max(parsed.values[1], min[1]), max[1]);\n values[2] = Math.min(Math.max(parsed.values[2], min[2]), max[2]);\n if (parsed.space[0] === \"h\") values = hsl2rgb2(values);\n values.push(Math.min(Math.max(parsed.alpha, 0), 1));\n return values;\n };\n function hsl2rgb2(hsl3) {\n var h = hsl3[0] / 360, s = hsl3[1] / 100, l = hsl3[2] / 100, t12, t22, t32, rgb2, val, i = 0;\n if (s === 0) return val = l * 255, [val, val, val];\n t22 = l < 0.5 ? l * (1 + s) : l + s - l * s;\n t12 = 2 * l - t22;\n rgb2 = [0, 0, 0];\n for (; i < 3; ) {\n t32 = h + 1 / 3 * -(i - 1);\n t32 < 0 ? t32++ : t32 > 1 && t32--;\n val = 6 * t32 < 1 ? t12 + (t22 - t12) * 6 * t32 : 2 * t32 < 1 ? t22 : 3 * t32 < 2 ? t12 + (t22 - t12) * (2 / 3 - t32) * 6 : t12;\n rgb2[i++] = val * 255;\n }\n return rgb2;\n }\n }\n });\n\n // node_modules/clamp/index.js\n var require_clamp = __commonJS({\n \"node_modules/clamp/index.js\"(exports, module) {\n module.exports = clamp;\n function clamp(value, min, max) {\n return min < max ? value < min ? min : value > max ? max : value : value < max ? max : value > min ? min : value;\n }\n }\n });\n\n // node_modules/dtype/index.js\n var require_dtype = __commonJS({\n \"node_modules/dtype/index.js\"(exports, module) {\n module.exports = function(dtype) {\n switch (dtype) {\n case \"int8\":\n return Int8Array;\n case \"int16\":\n return Int16Array;\n case \"int32\":\n return Int32Array;\n case \"uint8\":\n return Uint8Array;\n case \"uint16\":\n return Uint16Array;\n case \"uint32\":\n return Uint32Array;\n case \"float32\":\n return Float32Array;\n case \"float64\":\n return Float64Array;\n case \"array\":\n return Array;\n case \"uint8_clamped\":\n return Uint8ClampedArray;\n }\n };\n }\n });\n\n // node_modules/color-normalize/index.js\n var require_color_normalize = __commonJS({\n \"node_modules/color-normalize/index.js\"(exports, module) {\n \"use strict\";\n var rgba3 = require_color_rgba();\n var clamp = require_clamp();\n var dtype = require_dtype();\n module.exports = function normalize(color2, type) {\n if (type === \"float\" || !type) type = \"array\";\n if (type === \"uint\") type = \"uint8\";\n if (type === \"uint_clamped\") type = \"uint8_clamped\";\n var Ctor = dtype(type);\n var output = new Ctor(4);\n var normalize2 = type !== \"uint8\" && type !== \"uint8_clamped\";\n if (!color2.length || typeof color2 === \"string\") {\n color2 = rgba3(color2);\n color2[0] /= 255;\n color2[1] /= 255;\n color2[2] /= 255;\n }\n if (isInt(color2)) {\n output[0] = color2[0];\n output[1] = color2[1];\n output[2] = color2[2];\n output[3] = color2[3] != null ? color2[3] : 255;\n if (normalize2) {\n output[0] /= 255;\n output[1] /= 255;\n output[2] /= 255;\n output[3] /= 255;\n }\n return output;\n }\n if (!normalize2) {\n output[0] = clamp(Math.floor(color2[0] * 255), 0, 255);\n output[1] = clamp(Math.floor(color2[1] * 255), 0, 255);\n output[2] = clamp(Math.floor(color2[2] * 255), 0, 255);\n output[3] = color2[3] == null ? 255 : clamp(Math.floor(color2[3] * 255), 0, 255);\n } else {\n output[0] = color2[0];\n output[1] = color2[1];\n output[2] = color2[2];\n output[3] = color2[3] != null ? color2[3] : 1;\n }\n return output;\n };\n function isInt(color2) {\n if (color2 instanceof Uint8Array || color2 instanceof Uint8ClampedArray) return true;\n if (Array.isArray(color2) && (color2[0] > 1 || color2[0] === 0) && (color2[1] > 1 || color2[1] === 0) && (color2[2] > 1 || color2[2] === 0) && (!color2[3] || color2[3] > 1)) return true;\n return false;\n }\n }\n });\n\n // src/lib/str2rgbarray.js\n var require_str2rgbarray = __commonJS({\n \"src/lib/str2rgbarray.js\"(exports, module) {\n \"use strict\";\n var rgba3 = require_color_normalize();\n function str2RgbaArray(color2) {\n if (!color2) return [0, 0, 0, 1];\n return rgba3(color2);\n }\n module.exports = str2RgbaArray;\n }\n });\n\n // src/lib/gl_format_color.js\n var require_gl_format_color = __commonJS({\n \"src/lib/gl_format_color.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var tinycolor = require_tinycolor();\n var rgba3 = require_color_normalize();\n var Colorscale = require_colorscale();\n var colorDflt = require_attributes3().defaultLine;\n var isArrayOrTypedArray = require_array().isArrayOrTypedArray;\n var colorDfltRgba = rgba3(colorDflt);\n var opacityDflt = 1;\n function calculateColor(colorIn, opacityIn) {\n var colorOut = colorIn;\n colorOut[3] *= opacityIn;\n return colorOut;\n }\n function validateColor(colorIn) {\n if (isNumeric(colorIn)) return colorDfltRgba;\n var colorOut = rgba3(colorIn);\n return colorOut.length ? colorOut : colorDfltRgba;\n }\n function validateOpacity(opacityIn) {\n return isNumeric(opacityIn) ? opacityIn : opacityDflt;\n }\n function formatColor(containerIn, opacityIn, len) {\n var colorIn = containerIn.color;\n if (colorIn && colorIn._inputArray) colorIn = colorIn._inputArray;\n var isArrayColorIn = isArrayOrTypedArray(colorIn);\n var isArrayOpacityIn = isArrayOrTypedArray(opacityIn);\n var cOpts = Colorscale.extractOpts(containerIn);\n var colorOut = [];\n var sclFunc, getColor, getOpacity, colori, opacityi;\n if (cOpts.colorscale !== void 0) {\n sclFunc = Colorscale.makeColorScaleFuncFromTrace(containerIn);\n } else {\n sclFunc = validateColor;\n }\n if (isArrayColorIn) {\n getColor = function(c, i2) {\n return c[i2] === void 0 ? colorDfltRgba : rgba3(sclFunc(c[i2]));\n };\n } else getColor = validateColor;\n if (isArrayOpacityIn) {\n getOpacity = function(o, i2) {\n return o[i2] === void 0 ? opacityDflt : validateOpacity(o[i2]);\n };\n } else getOpacity = validateOpacity;\n if (isArrayColorIn || isArrayOpacityIn) {\n for (var i = 0; i < len; i++) {\n colori = getColor(colorIn, i);\n opacityi = getOpacity(opacityIn, i);\n colorOut[i] = calculateColor(colori, opacityi);\n }\n } else colorOut = calculateColor(rgba3(colorIn), opacityIn);\n return colorOut;\n }\n function parseColorScale(cont) {\n var cOpts = Colorscale.extractOpts(cont);\n var colorscale = cOpts.colorscale;\n if (cOpts.reversescale) colorscale = Colorscale.flipScale(cOpts.colorscale);\n return colorscale.map(function(elem) {\n var index = elem[0];\n var color2 = tinycolor(elem[1]);\n var rgb2 = color2.toRgb();\n return {\n index,\n rgb: [rgb2.r, rgb2.g, rgb2.b, rgb2.a]\n };\n });\n }\n module.exports = {\n formatColor,\n parseColorScale\n };\n }\n });\n\n // src/constants/gl3d_dashes.js\n var require_gl3d_dashes = __commonJS({\n \"src/constants/gl3d_dashes.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n solid: [[], 0],\n dot: [[0.5, 1], 200],\n dash: [[0.5, 1], 50],\n longdash: [[0.5, 1], 10],\n dashdot: [[0.5, 0.625, 0.875, 1], 50],\n longdashdot: [[0.5, 0.7, 0.8, 1], 10]\n };\n }\n });\n\n // src/constants/gl3d_markers.js\n var require_gl3d_markers = __commonJS({\n \"src/constants/gl3d_markers.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n circle: \"\\u25CF\",\n \"circle-open\": \"\\u25CB\",\n square: \"\\u25A0\",\n \"square-open\": \"\\u25A1\",\n diamond: \"\\u25C6\",\n \"diamond-open\": \"\\u25C7\",\n cross: \"+\",\n x: \"\\u274C\"\n };\n }\n });\n\n // src/traces/scatter3d/calc_errors.js\n var require_calc_errors = __commonJS({\n \"src/traces/scatter3d/calc_errors.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n function calculateAxisErrors(data, params, scaleFactor, axis) {\n if (!params || !params.visible) return null;\n var computeError = Registry.getComponentMethod(\"errorbars\", \"makeComputeError\")(params);\n var result = new Array(data.length);\n for (var i = 0; i < data.length; i++) {\n var errors = computeError(+data[i], i);\n if (axis.type === \"log\") {\n var point = axis.c2l(data[i]);\n var min = data[i] - errors[0];\n var max = data[i] + errors[1];\n result[i] = [\n (axis.c2l(min, true) - point) * scaleFactor,\n (axis.c2l(max, true) - point) * scaleFactor\n ];\n if (min > 0) {\n var lower = axis.c2l(min);\n if (!axis._lowerLogErrorBound) axis._lowerLogErrorBound = lower;\n axis._lowerErrorBound = Math.min(axis._lowerLogErrorBound, lower);\n }\n } else {\n result[i] = [\n -errors[0] * scaleFactor,\n errors[1] * scaleFactor\n ];\n }\n }\n return result;\n }\n function dataLength(array) {\n for (var i = 0; i < array.length; i++) {\n if (array[i]) return array[i].length;\n }\n return 0;\n }\n function calculateErrors(data, scaleFactor, sceneLayout) {\n var errors = [\n calculateAxisErrors(data.x, data.error_x, scaleFactor[0], sceneLayout.xaxis),\n calculateAxisErrors(data.y, data.error_y, scaleFactor[1], sceneLayout.yaxis),\n calculateAxisErrors(data.z, data.error_z, scaleFactor[2], sceneLayout.zaxis)\n ];\n var n = dataLength(errors);\n if (n === 0) return null;\n var errorBounds = new Array(n);\n for (var i = 0; i < n; i++) {\n var bound = [[0, 0, 0], [0, 0, 0]];\n for (var j = 0; j < 3; j++) {\n if (errors[j]) {\n for (var k = 0; k < 2; k++) {\n bound[k][j] = errors[j][i][k];\n }\n }\n }\n errorBounds[i] = bound;\n }\n return errorBounds;\n }\n module.exports = calculateErrors;\n }\n });\n\n // src/traces/scatter3d/convert.js\n var require_convert2 = __commonJS({\n \"src/traces/scatter3d/convert.js\"(exports, module) {\n \"use strict\";\n var createLinePlot = require_stackgl_modules().gl_line3d;\n var createScatterPlot = require_stackgl_modules().gl_scatter3d;\n var createErrorBars = require_stackgl_modules().gl_error3d;\n var createMesh = require_stackgl_modules().gl_mesh3d;\n var triangulate = require_stackgl_modules().delaunay_triangulate;\n var Lib = require_lib();\n var str2RgbaArray = require_str2rgbarray();\n var formatColor = require_gl_format_color().formatColor;\n var makeBubbleSizeFn = require_make_bubble_size_func();\n var DASH_PATTERNS = require_gl3d_dashes();\n var MARKER_SYMBOLS = require_gl3d_markers();\n var Axes = require_axes();\n var appendArrayPointValue = require_helpers2().appendArrayPointValue;\n var calculateError = require_calc_errors();\n function LineWithMarkers(scene, uid) {\n this.scene = scene;\n this.uid = uid;\n this.linePlot = null;\n this.scatterPlot = null;\n this.errorBars = null;\n this.textMarkers = null;\n this.delaunayMesh = null;\n this.color = null;\n this.mode = \"\";\n this.dataPoints = [];\n this.axesBounds = [\n [-Infinity, -Infinity, -Infinity],\n [Infinity, Infinity, Infinity]\n ];\n this.textLabels = null;\n this.data = null;\n }\n var proto = LineWithMarkers.prototype;\n proto.handlePick = function(selection) {\n if (selection.object && (selection.object === this.linePlot || selection.object === this.delaunayMesh || selection.object === this.textMarkers || selection.object === this.scatterPlot)) {\n var ind = selection.index = selection.data.index;\n if (selection.object.highlight) {\n selection.object.highlight(null);\n }\n if (this.scatterPlot) {\n selection.object = this.scatterPlot;\n this.scatterPlot.highlight(selection.data);\n }\n selection.textLabel = \"\";\n if (this.textLabels) {\n if (Lib.isArrayOrTypedArray(this.textLabels)) {\n if (this.textLabels[ind] || this.textLabels[ind] === 0) {\n selection.textLabel = this.textLabels[ind];\n }\n } else {\n selection.textLabel = this.textLabels;\n }\n }\n selection.traceCoordinate = [\n this.data.x[ind],\n this.data.y[ind],\n this.data.z[ind]\n ];\n return true;\n }\n };\n function constructDelaunay(points, color2, axis) {\n var u = (axis + 1) % 3;\n var v = (axis + 2) % 3;\n var filteredPoints = [];\n var filteredIds = [];\n var i;\n for (i = 0; i < points.length; ++i) {\n var p = points[i];\n if (isNaN(p[u]) || !isFinite(p[u]) || isNaN(p[v]) || !isFinite(p[v])) {\n continue;\n }\n filteredPoints.push([p[u], p[v]]);\n filteredIds.push(i);\n }\n var cells = triangulate(filteredPoints);\n for (i = 0; i < cells.length; ++i) {\n var c = cells[i];\n for (var j = 0; j < c.length; ++j) {\n c[j] = filteredIds[c[j]];\n }\n }\n return {\n positions: points,\n cells,\n meshColor: color2\n };\n }\n function calculateErrorParams(errors) {\n var capSize = [0, 0, 0];\n var color2 = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];\n var lineWidth = [1, 1, 1];\n for (var i = 0; i < 3; i++) {\n var e = errors[i];\n if (e && e.copy_zstyle !== false && errors[2].visible !== false) e = errors[2];\n if (!e || !e.visible) continue;\n capSize[i] = e.width / 2;\n color2[i] = str2RgbaArray(e.color);\n lineWidth[i] = e.thickness;\n }\n return { capSize, color: color2, lineWidth };\n }\n function parseAlignmentX(a) {\n if (a === null || a === void 0) return 0;\n return a.indexOf(\"left\") > -1 ? -1 : a.indexOf(\"right\") > -1 ? 1 : 0;\n }\n function parseAlignmentY(a) {\n if (a === null || a === void 0) return 0;\n return a.indexOf(\"top\") > -1 ? -1 : a.indexOf(\"bottom\") > -1 ? 1 : 0;\n }\n function calculateTextOffset(tp) {\n var defaultAlignmentX = 0;\n var defaultAlignmentY = 0;\n var textOffset = [\n defaultAlignmentX,\n defaultAlignmentY\n ];\n if (Array.isArray(tp)) {\n for (var i = 0; i < tp.length; i++) {\n textOffset[i] = [\n defaultAlignmentX,\n defaultAlignmentY\n ];\n if (tp[i]) {\n textOffset[i][0] = parseAlignmentX(tp[i]);\n textOffset[i][1] = parseAlignmentY(tp[i]);\n }\n }\n } else {\n textOffset[0] = parseAlignmentX(tp);\n textOffset[1] = parseAlignmentY(tp);\n }\n return textOffset;\n }\n function calculateSize(sizeIn, sizeFn) {\n return sizeFn(sizeIn * 4);\n }\n function calculateSymbol(symbolIn) {\n return MARKER_SYMBOLS[symbolIn];\n }\n function formatParam(paramIn, len, calculate, dflt, extraFn) {\n var paramOut = null;\n if (Lib.isArrayOrTypedArray(paramIn)) {\n paramOut = [];\n for (var i = 0; i < len; i++) {\n if (paramIn[i] === void 0) paramOut[i] = dflt;\n else paramOut[i] = calculate(paramIn[i], extraFn);\n }\n } else paramOut = calculate(paramIn, Lib.identity);\n return paramOut;\n }\n function convertPlotlyOptions(scene, data) {\n var points = [];\n var sceneLayout = scene.fullSceneLayout;\n var scaleFactor = scene.dataScale;\n var xaxis = sceneLayout.xaxis;\n var yaxis = sceneLayout.yaxis;\n var zaxis = sceneLayout.zaxis;\n var marker = data.marker;\n var line = data.line;\n var x = data.x || [];\n var y = data.y || [];\n var z = data.z || [];\n var len = x.length;\n var xcalendar = data.xcalendar;\n var ycalendar = data.ycalendar;\n var zcalendar = data.zcalendar;\n var xc, yc, zc;\n var params, i;\n var text;\n for (i = 0; i < len; i++) {\n xc = xaxis.d2l(x[i], 0, xcalendar) * scaleFactor[0];\n yc = yaxis.d2l(y[i], 0, ycalendar) * scaleFactor[1];\n zc = zaxis.d2l(z[i], 0, zcalendar) * scaleFactor[2];\n points[i] = [xc, yc, zc];\n }\n if (Array.isArray(data.text)) {\n text = data.text;\n } else if (Lib.isTypedArray(data.text)) {\n text = Array.from(data.text);\n } else if (data.text !== void 0) {\n text = new Array(len);\n for (i = 0; i < len; i++) text[i] = data.text;\n }\n function formatter(axName, val) {\n var ax = sceneLayout[axName];\n return Axes.tickText(ax, ax.d2l(val), true).text;\n }\n var texttemplate = data.texttemplate;\n if (texttemplate) {\n var fullLayout = scene.fullLayout;\n var d3locale = fullLayout._d3locale;\n var isArray = Array.isArray(texttemplate);\n var N = isArray ? Math.min(texttemplate.length, len) : len;\n var txt = isArray ? function(i2) {\n return texttemplate[i2];\n } : function() {\n return texttemplate;\n };\n text = new Array(N);\n for (i = 0; i < N; i++) {\n var d = { x: x[i], y: y[i], z: z[i] };\n var labels = {\n xLabel: formatter(\"xaxis\", x[i]),\n yLabel: formatter(\"yaxis\", y[i]),\n zLabel: formatter(\"zaxis\", z[i])\n };\n var pointValues = {};\n appendArrayPointValue(pointValues, data, i);\n var meta = data._meta || {};\n text[i] = Lib.texttemplateString(txt(i), labels, d3locale, pointValues, d, meta);\n }\n }\n params = {\n position: points,\n mode: data.mode,\n text\n };\n if (\"line\" in data) {\n params.lineColor = formatColor(line, 1, len);\n params.lineWidth = line.width;\n params.lineDashes = line.dash;\n }\n if (\"marker\" in data) {\n var sizeFn = makeBubbleSizeFn(data);\n params.scatterColor = formatColor(marker, 1, len);\n params.scatterSize = formatParam(marker.size, len, calculateSize, 20, sizeFn);\n params.scatterMarker = formatParam(marker.symbol, len, calculateSymbol, \"\\u25CF\");\n params.scatterLineWidth = marker.line.width;\n params.scatterLineColor = formatColor(marker.line, 1, len);\n params.scatterAngle = 0;\n }\n if (\"textposition\" in data) {\n params.textOffset = calculateTextOffset(data.textposition);\n params.textColor = formatColor(data.textfont, 1, len);\n params.textSize = formatParam(data.textfont.size, len, Lib.identity, 12);\n params.textFontFamily = data.textfont.family;\n params.textFontWeight = data.textfont.weight;\n params.textFontStyle = data.textfont.style;\n params.textFontVariant = data.textfont.variant;\n params.textAngle = 0;\n }\n var dims = [\"x\", \"y\", \"z\"];\n params.project = [false, false, false];\n params.projectScale = [1, 1, 1];\n params.projectOpacity = [1, 1, 1];\n for (i = 0; i < 3; ++i) {\n var projection = data.projection[dims[i]];\n if (params.project[i] = projection.show) {\n params.projectOpacity[i] = projection.opacity;\n params.projectScale[i] = projection.scale;\n }\n }\n params.errorBounds = calculateError(data, scaleFactor, sceneLayout);\n var errorParams = calculateErrorParams([data.error_x, data.error_y, data.error_z]);\n params.errorColor = errorParams.color;\n params.errorLineWidth = errorParams.lineWidth;\n params.errorCapSize = errorParams.capSize;\n params.delaunayAxis = data.surfaceaxis;\n params.delaunayColor = str2RgbaArray(data.surfacecolor);\n return params;\n }\n function _arrayToColor(color2) {\n if (Lib.isArrayOrTypedArray(color2)) {\n var c = color2[0];\n if (Lib.isArrayOrTypedArray(c)) color2 = c;\n return \"rgb(\" + color2.slice(0, 3).map(function(x) {\n return Math.round(x * 255);\n }) + \")\";\n }\n return null;\n }\n function arrayToColor(colors) {\n if (!Lib.isArrayOrTypedArray(colors)) {\n return null;\n }\n if (colors.length === 4 && typeof colors[0] === \"number\") {\n return _arrayToColor(colors);\n }\n return colors.map(_arrayToColor);\n }\n proto.update = function(data) {\n var gl2 = this.scene.glplot.gl;\n var lineOptions;\n var scatterOptions;\n var errorOptions;\n var textOptions;\n var dashPattern = DASH_PATTERNS.solid;\n this.data = data;\n var options = convertPlotlyOptions(this.scene, data);\n if (\"mode\" in options) {\n this.mode = options.mode;\n }\n if (\"lineDashes\" in options) {\n if (options.lineDashes in DASH_PATTERNS) {\n dashPattern = DASH_PATTERNS[options.lineDashes];\n }\n }\n this.color = arrayToColor(options.scatterColor) || arrayToColor(options.lineColor);\n this.dataPoints = options.position;\n lineOptions = {\n gl: this.scene.glplot.gl,\n position: options.position,\n color: options.lineColor,\n lineWidth: options.lineWidth || 1,\n dashes: dashPattern[0],\n dashScale: dashPattern[1],\n opacity: data.opacity,\n connectGaps: data.connectgaps\n };\n if (this.mode.indexOf(\"lines\") !== -1) {\n if (this.linePlot) this.linePlot.update(lineOptions);\n else {\n this.linePlot = createLinePlot(lineOptions);\n this.linePlot._trace = this;\n this.scene.glplot.add(this.linePlot);\n }\n } else if (this.linePlot) {\n this.scene.glplot.remove(this.linePlot);\n this.linePlot.dispose();\n this.linePlot = null;\n }\n var scatterOpacity = data.opacity;\n if (data.marker && data.marker.opacity !== void 0) scatterOpacity *= data.marker.opacity;\n scatterOptions = {\n gl: this.scene.glplot.gl,\n position: options.position,\n color: options.scatterColor,\n size: options.scatterSize,\n glyph: options.scatterMarker,\n opacity: scatterOpacity,\n orthographic: true,\n lineWidth: options.scatterLineWidth,\n lineColor: options.scatterLineColor,\n project: options.project,\n projectScale: options.projectScale,\n projectOpacity: options.projectOpacity\n };\n if (this.mode.indexOf(\"markers\") !== -1) {\n if (this.scatterPlot) this.scatterPlot.update(scatterOptions);\n else {\n this.scatterPlot = createScatterPlot(scatterOptions);\n this.scatterPlot._trace = this;\n this.scatterPlot.highlightScale = 1;\n this.scene.glplot.add(this.scatterPlot);\n }\n } else if (this.scatterPlot) {\n this.scene.glplot.remove(this.scatterPlot);\n this.scatterPlot.dispose();\n this.scatterPlot = null;\n }\n textOptions = {\n gl: this.scene.glplot.gl,\n position: options.position,\n glyph: options.text,\n color: options.textColor,\n size: options.textSize,\n angle: options.textAngle,\n alignment: options.textOffset,\n font: options.textFontFamily,\n fontWeight: options.textFontWeight,\n fontStyle: options.textFontStyle,\n fontVariant: options.textFontVariant,\n orthographic: true,\n lineWidth: 0,\n project: false,\n opacity: data.opacity\n };\n this.textLabels = data.hovertext || data.text;\n if (this.mode.indexOf(\"text\") !== -1) {\n if (this.textMarkers) this.textMarkers.update(textOptions);\n else {\n this.textMarkers = createScatterPlot(textOptions);\n this.textMarkers._trace = this;\n this.textMarkers.highlightScale = 1;\n this.scene.glplot.add(this.textMarkers);\n }\n } else if (this.textMarkers) {\n this.scene.glplot.remove(this.textMarkers);\n this.textMarkers.dispose();\n this.textMarkers = null;\n }\n errorOptions = {\n gl: this.scene.glplot.gl,\n position: options.position,\n color: options.errorColor,\n error: options.errorBounds,\n lineWidth: options.errorLineWidth,\n capSize: options.errorCapSize,\n opacity: data.opacity\n };\n if (this.errorBars) {\n if (options.errorBounds) {\n this.errorBars.update(errorOptions);\n } else {\n this.scene.glplot.remove(this.errorBars);\n this.errorBars.dispose();\n this.errorBars = null;\n }\n } else if (options.errorBounds) {\n this.errorBars = createErrorBars(errorOptions);\n this.errorBars._trace = this;\n this.scene.glplot.add(this.errorBars);\n }\n if (options.delaunayAxis >= 0) {\n var delaunayOptions = constructDelaunay(\n options.position,\n options.delaunayColor,\n options.delaunayAxis\n );\n delaunayOptions.opacity = data.opacity;\n if (this.delaunayMesh) {\n this.delaunayMesh.update(delaunayOptions);\n } else {\n delaunayOptions.gl = gl2;\n this.delaunayMesh = createMesh(delaunayOptions);\n this.delaunayMesh._trace = this;\n this.scene.glplot.add(this.delaunayMesh);\n }\n } else if (this.delaunayMesh) {\n this.scene.glplot.remove(this.delaunayMesh);\n this.delaunayMesh.dispose();\n this.delaunayMesh = null;\n }\n };\n proto.dispose = function() {\n if (this.linePlot) {\n this.scene.glplot.remove(this.linePlot);\n this.linePlot.dispose();\n }\n if (this.scatterPlot) {\n this.scene.glplot.remove(this.scatterPlot);\n this.scatterPlot.dispose();\n }\n if (this.errorBars) {\n this.scene.glplot.remove(this.errorBars);\n this.errorBars.dispose();\n }\n if (this.textMarkers) {\n this.scene.glplot.remove(this.textMarkers);\n this.textMarkers.dispose();\n }\n if (this.delaunayMesh) {\n this.scene.glplot.remove(this.delaunayMesh);\n this.delaunayMesh.dispose();\n }\n };\n function createLineWithMarkers(scene, data) {\n var plot = new LineWithMarkers(scene, data.uid);\n plot.update(data);\n return plot;\n }\n module.exports = createLineWithMarkers;\n }\n });\n\n // src/traces/scatter3d/attributes.js\n var require_attributes40 = __commonJS({\n \"src/traces/scatter3d/attributes.js\"(exports, module) {\n \"use strict\";\n var scatterAttrs = require_attributes12();\n var fontAttrs = require_font_attributes();\n var colorAttributes = require_attributes8();\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var baseAttrs = require_attributes2();\n var DASHES = require_gl3d_dashes();\n var MARKER_SYMBOLS = require_gl3d_markers();\n var extendFlat = require_extend().extendFlat;\n var overrideAll = require_edit_types().overrideAll;\n var sortObjectKeys = require_sort_object_keys();\n var scatterLineAttrs = scatterAttrs.line;\n var scatterMarkerAttrs = scatterAttrs.marker;\n var scatterMarkerLineAttrs = scatterMarkerAttrs.line;\n var lineAttrs = extendFlat({\n width: scatterLineAttrs.width,\n dash: {\n valType: \"enumerated\",\n values: sortObjectKeys(DASHES),\n dflt: \"solid\"\n }\n }, colorAttributes(\"line\"));\n function makeProjectionAttr(axLetter) {\n return {\n show: {\n valType: \"boolean\",\n dflt: false\n },\n opacity: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 1\n },\n scale: {\n valType: \"number\",\n min: 0,\n max: 10,\n dflt: 2 / 3\n }\n };\n }\n var attrs = module.exports = overrideAll({\n x: scatterAttrs.x,\n y: scatterAttrs.y,\n z: {\n valType: \"data_array\"\n },\n text: extendFlat({}, scatterAttrs.text, {}),\n texttemplate: texttemplateAttrs({}, {}),\n hovertext: extendFlat({}, scatterAttrs.hovertext, {}),\n hovertemplate: hovertemplateAttrs(),\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n zhoverformat: axisHoverFormat(\"z\"),\n mode: extendFlat(\n {},\n scatterAttrs.mode,\n // shouldn't this be on-par with 2D?\n { dflt: \"lines+markers\" }\n ),\n surfaceaxis: {\n valType: \"enumerated\",\n values: [-1, 0, 1, 2],\n dflt: -1\n },\n surfacecolor: {\n valType: \"color\"\n },\n projection: {\n x: makeProjectionAttr(\"x\"),\n y: makeProjectionAttr(\"y\"),\n z: makeProjectionAttr(\"z\")\n },\n connectgaps: scatterAttrs.connectgaps,\n line: lineAttrs,\n marker: extendFlat(\n {\n // Parity with scatter.js?\n symbol: {\n valType: \"enumerated\",\n values: sortObjectKeys(MARKER_SYMBOLS),\n dflt: \"circle\",\n arrayOk: true\n },\n size: extendFlat({}, scatterMarkerAttrs.size, { dflt: 8 }),\n sizeref: scatterMarkerAttrs.sizeref,\n sizemin: scatterMarkerAttrs.sizemin,\n sizemode: scatterMarkerAttrs.sizemode,\n opacity: extendFlat({}, scatterMarkerAttrs.opacity, {\n arrayOk: false\n }),\n colorbar: scatterMarkerAttrs.colorbar,\n line: extendFlat(\n {\n width: extendFlat({}, scatterMarkerLineAttrs.width, { arrayOk: false })\n },\n colorAttributes(\"marker.line\")\n )\n },\n colorAttributes(\"marker\")\n ),\n textposition: extendFlat({}, scatterAttrs.textposition, { dflt: \"top center\" }),\n textfont: fontAttrs({\n noFontShadow: true,\n noFontLineposition: true,\n noFontTextcase: true,\n editType: \"calc\",\n colorEditType: \"style\",\n arrayOk: true,\n variantValues: [\"normal\", \"small-caps\"]\n }),\n opacity: baseAttrs.opacity,\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo)\n }, \"calc\", \"nested\");\n attrs.x.editType = attrs.y.editType = attrs.z.editType = \"calc+clearAxisTypes\";\n }\n });\n\n // src/traces/scatter3d/defaults.js\n var require_defaults36 = __commonJS({\n \"src/traces/scatter3d/defaults.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var Lib = require_lib();\n var subTypes = require_subtypes();\n var handleMarkerDefaults = require_marker_defaults();\n var handleLineDefaults = require_line_defaults();\n var handleTextDefaults = require_text_defaults();\n var attributes = require_attributes40();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var len = handleXYZDefaults(traceIn, traceOut, coerce, layout);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n coerce(\"zhoverformat\");\n coerce(\"mode\");\n if (subTypes.hasMarkers(traceOut)) {\n handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, { noSelect: true, noAngle: true });\n }\n if (subTypes.hasLines(traceOut)) {\n coerce(\"connectgaps\");\n handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce);\n }\n if (subTypes.hasText(traceOut)) {\n coerce(\"texttemplate\");\n handleTextDefaults(traceIn, traceOut, layout, coerce, {\n noSelect: true,\n noFontShadow: true,\n noFontLineposition: true,\n noFontTextcase: true\n });\n }\n var lineColor = (traceOut.line || {}).color;\n var markerColor = (traceOut.marker || {}).color;\n if (coerce(\"surfaceaxis\") >= 0) coerce(\"surfacecolor\", lineColor || markerColor);\n var dims = [\"x\", \"y\", \"z\"];\n for (var i = 0; i < 3; ++i) {\n var projection = \"projection.\" + dims[i];\n if (coerce(projection + \".show\")) {\n coerce(projection + \".opacity\");\n coerce(projection + \".scale\");\n }\n }\n var errorBarsSupplyDefaults = Registry.getComponentMethod(\"errorbars\", \"supplyDefaults\");\n errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, { axis: \"z\" });\n errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, { axis: \"y\", inherit: \"z\" });\n errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, { axis: \"x\", inherit: \"z\" });\n };\n function handleXYZDefaults(traceIn, traceOut, coerce, layout) {\n var len = 0;\n var x = coerce(\"x\");\n var y = coerce(\"y\");\n var z = coerce(\"z\");\n var handleCalendarDefaults = Registry.getComponentMethod(\"calendars\", \"handleTraceDefaults\");\n handleCalendarDefaults(traceIn, traceOut, [\"x\", \"y\", \"z\"], layout);\n if (x && y && z) {\n len = Math.min(x.length, y.length, z.length);\n traceOut._length = traceOut._xlength = traceOut._ylength = traceOut._zlength = len;\n }\n return len;\n }\n }\n });\n\n // src/traces/scatter3d/calc.js\n var require_calc21 = __commonJS({\n \"src/traces/scatter3d/calc.js\"(exports, module) {\n \"use strict\";\n var arraysToCalcdata = require_arrays_to_calcdata();\n var calcColorscale = require_colorscale_calc();\n module.exports = function calc(gd, trace) {\n var cd = [{ x: false, y: false, trace, t: {} }];\n arraysToCalcdata(cd, trace);\n calcColorscale(gd, trace);\n return cd;\n };\n }\n });\n\n // node_modules/get-canvas-context/index.js\n var require_get_canvas_context = __commonJS({\n \"node_modules/get-canvas-context/index.js\"(exports, module) {\n module.exports = getCanvasContext;\n function getCanvasContext(type, opts) {\n if (typeof type !== \"string\") {\n throw new TypeError(\"must specify type string\");\n }\n opts = opts || {};\n if (typeof document === \"undefined\" && !opts.canvas) {\n return null;\n }\n var canvas = opts.canvas || document.createElement(\"canvas\");\n if (typeof opts.width === \"number\") {\n canvas.width = opts.width;\n }\n if (typeof opts.height === \"number\") {\n canvas.height = opts.height;\n }\n var attribs = opts;\n var gl2;\n try {\n var names2 = [type];\n if (type.indexOf(\"webgl\") === 0) {\n names2.push(\"experimental-\" + type);\n }\n for (var i = 0; i < names2.length; i++) {\n gl2 = canvas.getContext(names2[i], attribs);\n if (gl2) return gl2;\n }\n } catch (e) {\n gl2 = null;\n }\n return gl2 || null;\n }\n }\n });\n\n // node_modules/webgl-context/index.js\n var require_webgl_context = __commonJS({\n \"node_modules/webgl-context/index.js\"(exports, module) {\n var getContext = require_get_canvas_context();\n module.exports = function getWebGLContext(opt) {\n return getContext(\"webgl\", opt);\n };\n }\n });\n\n // src/lib/show_no_webgl_msg.js\n var require_show_no_webgl_msg = __commonJS({\n \"src/lib/show_no_webgl_msg.js\"(exports, module) {\n \"use strict\";\n var Color2 = require_color();\n var noop = function() {\n };\n module.exports = function showNoWebGlMsg(scene) {\n for (var prop in scene) {\n if (typeof scene[prop] === \"function\") scene[prop] = noop;\n }\n scene.destroy = function() {\n scene.container.parentNode.removeChild(scene.container);\n };\n var div = document.createElement(\"div\");\n div.className = \"no-webgl\";\n div.style.cursor = \"pointer\";\n div.style.fontSize = \"24px\";\n div.style.color = Color2.defaults[0];\n div.style.position = \"absolute\";\n div.style.left = div.style.top = \"0px\";\n div.style.width = div.style.height = \"100%\";\n div.style[\"background-color\"] = Color2.lightLine;\n div.style[\"z-index\"] = 30;\n var p = document.createElement(\"p\");\n p.textContent = \"WebGL is not supported by your browser - visit https://get.webgl.org for more info\";\n p.style.position = \"relative\";\n p.style.top = \"50%\";\n p.style.left = \"50%\";\n p.style.height = \"30%\";\n p.style.width = \"50%\";\n p.style.margin = \"-15% 0 0 -25%\";\n div.appendChild(p);\n scene.container.appendChild(div);\n scene.container.style.background = \"#FFFFFF\";\n scene.container.onclick = function() {\n window.open(\"https://get.webgl.org\");\n };\n return false;\n };\n }\n });\n\n // src/plots/gl3d/layout/convert.js\n var require_convert3 = __commonJS({\n \"src/plots/gl3d/layout/convert.js\"(exports, module) {\n \"use strict\";\n var str2RgbaArray = require_str2rgbarray();\n var Lib = require_lib();\n var AXES_NAMES = [\"xaxis\", \"yaxis\", \"zaxis\"];\n function AxesOptions() {\n this.bounds = [\n [-10, -10, -10],\n [10, 10, 10]\n ];\n this.ticks = [[], [], []];\n this.tickEnable = [true, true, true];\n this.tickFont = [\"sans-serif\", \"sans-serif\", \"sans-serif\"];\n this.tickSize = [12, 12, 12];\n this.tickFontWeight = [\"normal\", \"normal\", \"normal\", \"normal\"];\n this.tickFontStyle = [\"normal\", \"normal\", \"normal\", \"normal\"];\n this.tickFontVariant = [\"normal\", \"normal\", \"normal\", \"normal\"];\n this.tickAngle = [0, 0, 0];\n this.tickColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]];\n this.tickPad = [18, 18, 18];\n this.labels = [\"x\", \"y\", \"z\"];\n this.labelEnable = [true, true, true];\n this.labelFont = [\"Open Sans\", \"Open Sans\", \"Open Sans\"];\n this.labelSize = [20, 20, 20];\n this.labelFontWeight = [\"normal\", \"normal\", \"normal\", \"normal\"];\n this.labelFontStyle = [\"normal\", \"normal\", \"normal\", \"normal\"];\n this.labelFontVariant = [\"normal\", \"normal\", \"normal\", \"normal\"];\n this.labelColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]];\n this.labelPad = [30, 30, 30];\n this.lineEnable = [true, true, true];\n this.lineMirror = [false, false, false];\n this.lineWidth = [1, 1, 1];\n this.lineColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]];\n this.lineTickEnable = [true, true, true];\n this.lineTickMirror = [false, false, false];\n this.lineTickLength = [10, 10, 10];\n this.lineTickWidth = [1, 1, 1];\n this.lineTickColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]];\n this.gridEnable = [true, true, true];\n this.gridWidth = [1, 1, 1];\n this.gridColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]];\n this.zeroEnable = [true, true, true];\n this.zeroLineColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]];\n this.zeroLineWidth = [2, 2, 2];\n this.backgroundEnable = [true, true, true];\n this.backgroundColor = [\n [0.8, 0.8, 0.8, 0.5],\n [0.8, 0.8, 0.8, 0.5],\n [0.8, 0.8, 0.8, 0.5]\n ];\n this._defaultTickPad = this.tickPad.slice();\n this._defaultLabelPad = this.labelPad.slice();\n this._defaultLineTickLength = this.lineTickLength.slice();\n }\n var proto = AxesOptions.prototype;\n proto.merge = function(fullLayout, sceneLayout) {\n var opts = this;\n for (var i = 0; i < 3; ++i) {\n var axes = sceneLayout[AXES_NAMES[i]];\n if (!axes.visible) {\n opts.tickEnable[i] = false;\n opts.labelEnable[i] = false;\n opts.lineEnable[i] = false;\n opts.lineTickEnable[i] = false;\n opts.gridEnable[i] = false;\n opts.zeroEnable[i] = false;\n opts.backgroundEnable[i] = false;\n continue;\n }\n opts.labels[i] = fullLayout._meta ? Lib.templateString(axes.title.text, fullLayout._meta) : axes.title.text;\n if (\"font\" in axes.title) {\n if (axes.title.font.color) opts.labelColor[i] = str2RgbaArray(axes.title.font.color);\n if (axes.title.font.family) opts.labelFont[i] = axes.title.font.family;\n if (axes.title.font.size) opts.labelSize[i] = axes.title.font.size;\n if (axes.title.font.weight) opts.labelFontWeight[i] = axes.title.font.weight;\n if (axes.title.font.style) opts.labelFontStyle[i] = axes.title.font.style;\n if (axes.title.font.variant) opts.labelFontVariant[i] = axes.title.font.variant;\n }\n if (\"showline\" in axes) opts.lineEnable[i] = axes.showline;\n if (\"linecolor\" in axes) opts.lineColor[i] = str2RgbaArray(axes.linecolor);\n if (\"linewidth\" in axes) opts.lineWidth[i] = axes.linewidth;\n if (\"showgrid\" in axes) opts.gridEnable[i] = axes.showgrid;\n if (\"gridcolor\" in axes) opts.gridColor[i] = str2RgbaArray(axes.gridcolor);\n if (\"gridwidth\" in axes) opts.gridWidth[i] = axes.gridwidth;\n if (axes.type === \"log\") opts.zeroEnable[i] = false;\n else if (\"zeroline\" in axes) opts.zeroEnable[i] = axes.zeroline;\n if (\"zerolinecolor\" in axes) opts.zeroLineColor[i] = str2RgbaArray(axes.zerolinecolor);\n if (\"zerolinewidth\" in axes) opts.zeroLineWidth[i] = axes.zerolinewidth;\n if (\"ticks\" in axes && !!axes.ticks) opts.lineTickEnable[i] = true;\n else opts.lineTickEnable[i] = false;\n if (\"ticklen\" in axes) {\n opts.lineTickLength[i] = opts._defaultLineTickLength[i] = axes.ticklen;\n }\n if (\"tickcolor\" in axes) opts.lineTickColor[i] = str2RgbaArray(axes.tickcolor);\n if (\"tickwidth\" in axes) opts.lineTickWidth[i] = axes.tickwidth;\n if (\"tickangle\" in axes) {\n opts.tickAngle[i] = axes.tickangle === \"auto\" ? -3600 : (\n // i.e. special number to set auto option\n Math.PI * -axes.tickangle / 180\n );\n }\n if (\"showticklabels\" in axes) opts.tickEnable[i] = axes.showticklabels;\n if (\"tickfont\" in axes) {\n if (axes.tickfont.color) opts.tickColor[i] = str2RgbaArray(axes.tickfont.color);\n if (axes.tickfont.family) opts.tickFont[i] = axes.tickfont.family;\n if (axes.tickfont.size) opts.tickSize[i] = axes.tickfont.size;\n if (axes.tickfont.weight) opts.tickFontWeight[i] = axes.tickfont.weight;\n if (axes.tickfont.style) opts.tickFontStyle[i] = axes.tickfont.style;\n if (axes.tickfont.variant) opts.tickFontVariant[i] = axes.tickfont.variant;\n }\n if (\"mirror\" in axes) {\n if ([\"ticks\", \"all\", \"allticks\"].indexOf(axes.mirror) !== -1) {\n opts.lineTickMirror[i] = true;\n opts.lineMirror[i] = true;\n } else if (axes.mirror === true) {\n opts.lineTickMirror[i] = false;\n opts.lineMirror[i] = true;\n } else {\n opts.lineTickMirror[i] = false;\n opts.lineMirror[i] = false;\n }\n } else opts.lineMirror[i] = false;\n if (\"showbackground\" in axes && axes.showbackground !== false) {\n opts.backgroundEnable[i] = true;\n opts.backgroundColor[i] = str2RgbaArray(axes.backgroundcolor);\n } else opts.backgroundEnable[i] = false;\n }\n };\n function createAxesOptions(fullLayout, sceneLayout) {\n var result = new AxesOptions();\n result.merge(fullLayout, sceneLayout);\n return result;\n }\n module.exports = createAxesOptions;\n }\n });\n\n // src/plots/gl3d/layout/spikes.js\n var require_spikes = __commonJS({\n \"src/plots/gl3d/layout/spikes.js\"(exports, module) {\n \"use strict\";\n var str2RGBArray = require_str2rgbarray();\n var AXES_NAMES = [\"xaxis\", \"yaxis\", \"zaxis\"];\n function SpikeOptions() {\n this.enabled = [true, true, true];\n this.colors = [\n [0, 0, 0, 1],\n [0, 0, 0, 1],\n [0, 0, 0, 1]\n ];\n this.drawSides = [true, true, true];\n this.lineWidth = [1, 1, 1];\n }\n var proto = SpikeOptions.prototype;\n proto.merge = function(sceneLayout) {\n for (var i = 0; i < 3; ++i) {\n var axes = sceneLayout[AXES_NAMES[i]];\n if (!axes.visible) {\n this.enabled[i] = false;\n this.drawSides[i] = false;\n continue;\n }\n this.enabled[i] = axes.showspikes;\n this.colors[i] = str2RGBArray(axes.spikecolor);\n this.drawSides[i] = axes.spikesides;\n this.lineWidth[i] = axes.spikethickness;\n }\n };\n function createSpikeOptions(layout) {\n var result = new SpikeOptions();\n result.merge(layout);\n return result;\n }\n module.exports = createSpikeOptions;\n }\n });\n\n // src/plots/gl3d/layout/tick_marks.js\n var require_tick_marks = __commonJS({\n \"src/plots/gl3d/layout/tick_marks.js\"(exports, module) {\n \"use strict\";\n module.exports = computeTickMarks;\n var Axes = require_axes();\n var Lib = require_lib();\n var AXES_NAMES = [\"xaxis\", \"yaxis\", \"zaxis\"];\n var centerPoint = [0, 0, 0];\n function contourLevelsFromTicks(ticks) {\n var result = new Array(3);\n for (var i = 0; i < 3; ++i) {\n var tlevel = ticks[i];\n var clevel = new Array(tlevel.length);\n for (var j = 0; j < tlevel.length; ++j) {\n clevel[j] = tlevel[j].x;\n }\n result[i] = clevel;\n }\n return result;\n }\n function computeTickMarks(scene) {\n var axesOptions = scene.axesOptions;\n var glRange = scene.glplot.axesPixels;\n var sceneLayout = scene.fullSceneLayout;\n var ticks = [[], [], []];\n for (var i = 0; i < 3; ++i) {\n var axes = sceneLayout[AXES_NAMES[i]];\n axes._length = (glRange[i].hi - glRange[i].lo) * glRange[i].pixelsPerDataUnit / scene.dataScale[i];\n if (Math.abs(axes._length) === Infinity || isNaN(axes._length)) {\n ticks[i] = [];\n } else {\n axes._input_range = axes.range.slice();\n axes.range[0] = glRange[i].lo / scene.dataScale[i];\n axes.range[1] = glRange[i].hi / scene.dataScale[i];\n axes._m = 1 / (scene.dataScale[i] * glRange[i].pixelsPerDataUnit);\n if (axes.range[0] === axes.range[1]) {\n axes.range[0] -= 1;\n axes.range[1] += 1;\n }\n var tickModeCached = axes.tickmode;\n if (axes.tickmode === \"auto\") {\n axes.tickmode = \"linear\";\n var nticks = axes.nticks || Lib.constrain(axes._length / 40, 4, 9);\n Axes.autoTicks(axes, Math.abs(axes.range[1] - axes.range[0]) / nticks);\n }\n var dataTicks = Axes.calcTicks(axes, { msUTC: true });\n for (var j = 0; j < dataTicks.length; ++j) {\n dataTicks[j].x = dataTicks[j].x * scene.dataScale[i];\n if (axes.type === \"date\") {\n dataTicks[j].text = dataTicks[j].text.replace(/\\/g, \" \");\n }\n }\n ticks[i] = dataTicks;\n axes.tickmode = tickModeCached;\n }\n }\n axesOptions.ticks = ticks;\n for (var i = 0; i < 3; ++i) {\n centerPoint[i] = 0.5 * (scene.glplot.bounds[0][i] + scene.glplot.bounds[1][i]);\n for (var j = 0; j < 2; ++j) {\n axesOptions.bounds[j][i] = scene.glplot.bounds[j][i];\n }\n }\n scene.contourLevels = contourLevelsFromTicks(ticks);\n }\n }\n });\n\n // src/plots/gl3d/scene.js\n var require_scene = __commonJS({\n \"src/plots/gl3d/scene.js\"(exports, module) {\n \"use strict\";\n var glPlot3d = require_stackgl_modules().gl_plot3d;\n var createCamera = glPlot3d.createCamera;\n var createPlot = glPlot3d.createScene;\n var getContext = require_webgl_context();\n var passiveSupported = require_has_passive_events();\n var Registry = require_registry();\n var Lib = require_lib();\n var preserveDrawingBuffer = Lib.preserveDrawingBuffer();\n var Axes = require_axes();\n var Fx = require_fx();\n var str2RGBAarray = require_str2rgbarray();\n var showNoWebGlMsg = require_show_no_webgl_msg();\n var project = require_project();\n var createAxesOptions = require_convert3();\n var createSpikeOptions = require_spikes();\n var computeTickMarks = require_tick_marks();\n var applyAutorangeOptions = require_autorange().applyAutorangeOptions;\n var STATIC_CANVAS;\n var STATIC_CONTEXT;\n var tabletmode = false;\n function Scene(options, fullLayout) {\n var sceneContainer = document.createElement(\"div\");\n var plotContainer = options.container;\n this.graphDiv = options.graphDiv;\n var svgContainer = document.createElementNS(\n \"http://www.w3.org/2000/svg\",\n \"svg\"\n );\n svgContainer.style.position = \"absolute\";\n svgContainer.style.top = svgContainer.style.left = \"0px\";\n svgContainer.style.width = svgContainer.style.height = \"100%\";\n svgContainer.style[\"z-index\"] = 20;\n svgContainer.style[\"pointer-events\"] = \"none\";\n sceneContainer.appendChild(svgContainer);\n this.svgContainer = svgContainer;\n sceneContainer.id = options.id;\n sceneContainer.style.position = \"absolute\";\n sceneContainer.style.top = sceneContainer.style.left = \"0px\";\n sceneContainer.style.width = sceneContainer.style.height = \"100%\";\n plotContainer.appendChild(sceneContainer);\n this.fullLayout = fullLayout;\n this.id = options.id || \"scene\";\n this.fullSceneLayout = fullLayout[this.id];\n this.plotArgs = [[], {}, {}];\n this.axesOptions = createAxesOptions(fullLayout, fullLayout[this.id]);\n this.spikeOptions = createSpikeOptions(fullLayout[this.id]);\n this.container = sceneContainer;\n this.staticMode = !!options.staticPlot;\n this.pixelRatio = this.pixelRatio || options.plotGlPixelRatio || 2;\n this.dataScale = [1, 1, 1];\n this.contourLevels = [[], [], []];\n this.convertAnnotations = Registry.getComponentMethod(\"annotations3d\", \"convert\");\n this.drawAnnotations = Registry.getComponentMethod(\"annotations3d\", \"draw\");\n this.initializeGLPlot();\n }\n var proto = Scene.prototype;\n proto.prepareOptions = function() {\n var scene = this;\n var opts = {\n canvas: scene.canvas,\n gl: scene.gl,\n glOptions: {\n preserveDrawingBuffer,\n premultipliedAlpha: true,\n antialias: true\n },\n container: scene.container,\n axes: scene.axesOptions,\n spikes: scene.spikeOptions,\n pickRadius: 10,\n snapToData: true,\n autoScale: true,\n autoBounds: false,\n cameraObject: scene.camera,\n pixelRatio: scene.pixelRatio\n };\n if (scene.staticMode) {\n if (!STATIC_CONTEXT) {\n STATIC_CANVAS = document.createElement(\"canvas\");\n STATIC_CONTEXT = getContext({\n canvas: STATIC_CANVAS,\n preserveDrawingBuffer: true,\n premultipliedAlpha: true,\n antialias: true\n });\n if (!STATIC_CONTEXT) {\n throw new Error(\"error creating static canvas/context for image server\");\n }\n }\n opts.gl = STATIC_CONTEXT;\n opts.canvas = STATIC_CANVAS;\n }\n return opts;\n };\n var firstInit = true;\n proto.tryCreatePlot = function() {\n var scene = this;\n var opts = scene.prepareOptions();\n var success = true;\n try {\n scene.glplot = createPlot(opts);\n } catch (e) {\n if (scene.staticMode || !firstInit || preserveDrawingBuffer) {\n success = false;\n } else {\n Lib.warn([\n \"webgl setup failed possibly due to\",\n \"false preserveDrawingBuffer config.\",\n \"The mobile/tablet device may not be detected by is-mobile module.\",\n \"Enabling preserveDrawingBuffer in second attempt to create webgl scene...\"\n ].join(\" \"));\n try {\n preserveDrawingBuffer = opts.glOptions.preserveDrawingBuffer = true;\n scene.glplot = createPlot(opts);\n } catch (e2) {\n preserveDrawingBuffer = opts.glOptions.preserveDrawingBuffer = false;\n success = false;\n }\n }\n }\n firstInit = false;\n return success;\n };\n proto.initializeGLCamera = function() {\n var scene = this;\n var cameraData = scene.fullSceneLayout.camera;\n var isOrtho = cameraData.projection.type === \"orthographic\";\n scene.camera = createCamera(scene.container, {\n center: [cameraData.center.x, cameraData.center.y, cameraData.center.z],\n eye: [cameraData.eye.x, cameraData.eye.y, cameraData.eye.z],\n up: [cameraData.up.x, cameraData.up.y, cameraData.up.z],\n _ortho: isOrtho,\n zoomMin: 0.01,\n zoomMax: 100,\n mode: \"orbit\"\n });\n };\n proto.initializeGLPlot = function() {\n var scene = this;\n scene.initializeGLCamera();\n var success = scene.tryCreatePlot();\n if (!success) return showNoWebGlMsg(scene);\n scene.traces = {};\n scene.make4thDimension();\n var gd = scene.graphDiv;\n var layout = gd.layout;\n var makeUpdate = function() {\n var update = {};\n if (scene.isCameraChanged(layout)) {\n update[scene.id + \".camera\"] = scene.getCamera();\n }\n if (scene.isAspectChanged(layout)) {\n update[scene.id + \".aspectratio\"] = scene.glplot.getAspectratio();\n if (layout[scene.id].aspectmode !== \"manual\") {\n scene.fullSceneLayout.aspectmode = layout[scene.id].aspectmode = update[scene.id + \".aspectmode\"] = \"manual\";\n }\n }\n return update;\n };\n var relayoutCallback = function(scene2) {\n if (scene2.fullSceneLayout.dragmode === false) return;\n var update = makeUpdate();\n scene2.saveLayout(layout);\n scene2.graphDiv.emit(\"plotly_relayout\", update);\n };\n if (scene.glplot.canvas) {\n scene.glplot.canvas.addEventListener(\"mouseup\", function() {\n relayoutCallback(scene);\n });\n scene.glplot.canvas.addEventListener(\"touchstart\", function() {\n tabletmode = true;\n });\n scene.glplot.canvas.addEventListener(\"wheel\", function(e) {\n if (gd._context._scrollZoom.gl3d) {\n if (scene.camera._ortho) {\n var s = e.deltaX > e.deltaY ? 1.1 : 1 / 1.1;\n var o = scene.glplot.getAspectratio();\n scene.glplot.setAspectratio({\n x: s * o.x,\n y: s * o.y,\n z: s * o.z\n });\n }\n relayoutCallback(scene);\n }\n }, passiveSupported ? { passive: false } : false);\n scene.glplot.canvas.addEventListener(\"mousemove\", function() {\n if (scene.fullSceneLayout.dragmode === false) return;\n if (scene.camera.mouseListener.buttons === 0) return;\n var update = makeUpdate();\n scene.graphDiv.emit(\"plotly_relayouting\", update);\n });\n if (!scene.staticMode) {\n scene.glplot.canvas.addEventListener(\"webglcontextlost\", function(event) {\n if (gd && gd.emit) {\n gd.emit(\"plotly_webglcontextlost\", {\n event,\n layer: scene.id\n });\n }\n }, false);\n }\n }\n scene.glplot.oncontextloss = function() {\n scene.recoverContext();\n };\n scene.glplot.onrender = function() {\n scene.render();\n };\n return true;\n };\n proto.render = function() {\n var scene = this;\n var gd = scene.graphDiv;\n var trace;\n var svgContainer = scene.svgContainer;\n var clientRect = scene.container.getBoundingClientRect();\n gd._fullLayout._calcInverseTransform(gd);\n var scaleX = gd._fullLayout._invScaleX;\n var scaleY = gd._fullLayout._invScaleY;\n var width = clientRect.width * scaleX;\n var height = clientRect.height * scaleY;\n svgContainer.setAttributeNS(null, \"viewBox\", \"0 0 \" + width + \" \" + height);\n svgContainer.setAttributeNS(null, \"width\", width);\n svgContainer.setAttributeNS(null, \"height\", height);\n computeTickMarks(scene);\n scene.glplot.axes.update(scene.axesOptions);\n var keys = Object.keys(scene.traces);\n var lastPicked = null;\n var selection = scene.glplot.selection;\n for (var i = 0; i < keys.length; ++i) {\n trace = scene.traces[keys[i]];\n if (trace.data.hoverinfo !== \"skip\" && trace.handlePick(selection)) {\n lastPicked = trace;\n }\n if (trace.setContourLevels) trace.setContourLevels();\n }\n function formatter(axLetter, val, hoverformat) {\n var ax = scene.fullSceneLayout[axLetter + \"axis\"];\n if (ax.type !== \"log\") {\n val = ax.d2l(val);\n }\n return Axes.hoverLabelText(ax, val, hoverformat);\n }\n if (lastPicked !== null) {\n var pdata = project(scene.glplot.cameraParams, selection.dataCoordinate);\n trace = lastPicked.data;\n var traceNow = gd._fullData[trace.index];\n var ptNumber = selection.index;\n var labels = {\n xLabel: formatter(\"x\", selection.traceCoordinate[0], trace.xhoverformat),\n yLabel: formatter(\"y\", selection.traceCoordinate[1], trace.yhoverformat),\n zLabel: formatter(\"z\", selection.traceCoordinate[2], trace.zhoverformat)\n };\n var hoverinfo = Fx.castHoverinfo(traceNow, scene.fullLayout, ptNumber);\n var hoverinfoParts = (hoverinfo || \"\").split(\"+\");\n var isHoverinfoAll = hoverinfo && hoverinfo === \"all\";\n if (!traceNow.hovertemplate && !isHoverinfoAll) {\n if (hoverinfoParts.indexOf(\"x\") === -1) labels.xLabel = void 0;\n if (hoverinfoParts.indexOf(\"y\") === -1) labels.yLabel = void 0;\n if (hoverinfoParts.indexOf(\"z\") === -1) labels.zLabel = void 0;\n if (hoverinfoParts.indexOf(\"text\") === -1) selection.textLabel = void 0;\n if (hoverinfoParts.indexOf(\"name\") === -1) lastPicked.name = void 0;\n }\n var tx;\n var vectorTx = [];\n if (trace.type === \"cone\" || trace.type === \"streamtube\") {\n labels.uLabel = formatter(\"x\", selection.traceCoordinate[3], trace.uhoverformat);\n if (isHoverinfoAll || hoverinfoParts.indexOf(\"u\") !== -1) {\n vectorTx.push(\"u: \" + labels.uLabel);\n }\n labels.vLabel = formatter(\"y\", selection.traceCoordinate[4], trace.vhoverformat);\n if (isHoverinfoAll || hoverinfoParts.indexOf(\"v\") !== -1) {\n vectorTx.push(\"v: \" + labels.vLabel);\n }\n labels.wLabel = formatter(\"z\", selection.traceCoordinate[5], trace.whoverformat);\n if (isHoverinfoAll || hoverinfoParts.indexOf(\"w\") !== -1) {\n vectorTx.push(\"w: \" + labels.wLabel);\n }\n labels.normLabel = selection.traceCoordinate[6].toPrecision(3);\n if (isHoverinfoAll || hoverinfoParts.indexOf(\"norm\") !== -1) {\n vectorTx.push(\"norm: \" + labels.normLabel);\n }\n if (trace.type === \"streamtube\") {\n labels.divergenceLabel = selection.traceCoordinate[7].toPrecision(3);\n if (isHoverinfoAll || hoverinfoParts.indexOf(\"divergence\") !== -1) {\n vectorTx.push(\"divergence: \" + labels.divergenceLabel);\n }\n }\n if (selection.textLabel) {\n vectorTx.push(selection.textLabel);\n }\n tx = vectorTx.join(\"
    \");\n } else if (trace.type === \"isosurface\" || trace.type === \"volume\") {\n labels.valueLabel = Axes.hoverLabelText(scene._mockAxis, scene._mockAxis.d2l(selection.traceCoordinate[3]), trace.valuehoverformat);\n vectorTx.push(\"value: \" + labels.valueLabel);\n if (selection.textLabel) {\n vectorTx.push(selection.textLabel);\n }\n tx = vectorTx.join(\"
    \");\n } else {\n tx = selection.textLabel;\n }\n var pointData = {\n x: selection.traceCoordinate[0],\n y: selection.traceCoordinate[1],\n z: selection.traceCoordinate[2],\n data: traceNow._input,\n fullData: traceNow,\n curveNumber: traceNow.index,\n pointNumber: ptNumber\n };\n Fx.appendArrayPointValue(pointData, traceNow, ptNumber);\n if (trace._module.eventData) {\n pointData = traceNow._module.eventData(pointData, selection, traceNow, {}, ptNumber);\n }\n var eventData = { points: [pointData] };\n if (scene.fullSceneLayout.hovermode) {\n var bbox = [];\n Fx.loneHover({\n trace: traceNow,\n x: (0.5 + 0.5 * pdata[0] / pdata[3]) * width,\n y: (0.5 - 0.5 * pdata[1] / pdata[3]) * height,\n xLabel: labels.xLabel,\n yLabel: labels.yLabel,\n zLabel: labels.zLabel,\n text: tx,\n name: lastPicked.name,\n color: Fx.castHoverOption(traceNow, ptNumber, \"bgcolor\") || lastPicked.color,\n borderColor: Fx.castHoverOption(traceNow, ptNumber, \"bordercolor\"),\n fontFamily: Fx.castHoverOption(traceNow, ptNumber, \"font.family\"),\n fontSize: Fx.castHoverOption(traceNow, ptNumber, \"font.size\"),\n fontColor: Fx.castHoverOption(traceNow, ptNumber, \"font.color\"),\n nameLength: Fx.castHoverOption(traceNow, ptNumber, \"namelength\"),\n textAlign: Fx.castHoverOption(traceNow, ptNumber, \"align\"),\n hovertemplate: Lib.castOption(traceNow, ptNumber, \"hovertemplate\"),\n hovertemplateLabels: Lib.extendFlat({}, pointData, labels),\n eventData: [pointData]\n }, {\n container: svgContainer,\n gd,\n inOut_bbox: bbox\n });\n pointData.bbox = bbox[0];\n }\n if (selection.distance < 5 && (selection.buttons || tabletmode)) {\n gd.emit(\"plotly_click\", eventData);\n } else {\n gd.emit(\"plotly_hover\", eventData);\n }\n this.oldEventData = eventData;\n } else {\n Fx.loneUnhover(svgContainer);\n if (this.oldEventData) gd.emit(\"plotly_unhover\", this.oldEventData);\n this.oldEventData = void 0;\n }\n scene.drawAnnotations(scene);\n };\n proto.recoverContext = function() {\n var scene = this;\n scene.glplot.dispose();\n var tryRecover = function() {\n if (scene.glplot.gl.isContextLost()) {\n requestAnimationFrame(tryRecover);\n return;\n }\n if (!scene.initializeGLPlot()) {\n Lib.error(\"Catastrophic and unrecoverable WebGL error. Context lost.\");\n return;\n }\n scene.plot.apply(scene, scene.plotArgs);\n };\n requestAnimationFrame(tryRecover);\n };\n var axisProperties = [\"xaxis\", \"yaxis\", \"zaxis\"];\n function computeTraceBounds(scene, trace, bounds) {\n var fullSceneLayout = scene.fullSceneLayout;\n for (var d = 0; d < 3; d++) {\n var axisName = axisProperties[d];\n var axLetter = axisName.charAt(0);\n var ax = fullSceneLayout[axisName];\n var coords = trace[axLetter];\n var calendar = trace[axLetter + \"calendar\"];\n var len = trace[\"_\" + axLetter + \"length\"];\n if (!Lib.isArrayOrTypedArray(coords)) {\n bounds[0][d] = Math.min(bounds[0][d], 0);\n bounds[1][d] = Math.max(bounds[1][d], len - 1);\n } else {\n var v;\n for (var i = 0; i < (len || coords.length); i++) {\n if (Lib.isArrayOrTypedArray(coords[i])) {\n for (var j = 0; j < coords[i].length; ++j) {\n v = ax.d2l(coords[i][j], 0, calendar);\n if (!isNaN(v) && isFinite(v)) {\n bounds[0][d] = Math.min(bounds[0][d], v);\n bounds[1][d] = Math.max(bounds[1][d], v);\n }\n }\n } else {\n v = ax.d2l(coords[i], 0, calendar);\n if (!isNaN(v) && isFinite(v)) {\n bounds[0][d] = Math.min(bounds[0][d], v);\n bounds[1][d] = Math.max(bounds[1][d], v);\n }\n }\n }\n }\n }\n }\n function computeAnnotationBounds(scene, bounds) {\n var fullSceneLayout = scene.fullSceneLayout;\n var annotations = fullSceneLayout.annotations || [];\n for (var d = 0; d < 3; d++) {\n var axisName = axisProperties[d];\n var axLetter = axisName.charAt(0);\n var ax = fullSceneLayout[axisName];\n for (var j = 0; j < annotations.length; j++) {\n var ann = annotations[j];\n if (ann.visible) {\n var pos = ax.r2l(ann[axLetter]);\n if (!isNaN(pos) && isFinite(pos)) {\n bounds[0][d] = Math.min(bounds[0][d], pos);\n bounds[1][d] = Math.max(bounds[1][d], pos);\n }\n }\n }\n }\n }\n proto.plot = function(sceneData, fullLayout, layout) {\n var scene = this;\n scene.plotArgs = [sceneData, fullLayout, layout];\n if (scene.glplot.contextLost) return;\n var data, trace;\n var i, j, axis, axisType;\n var fullSceneLayout = fullLayout[scene.id];\n var sceneLayout = layout[scene.id];\n scene.fullLayout = fullLayout;\n scene.fullSceneLayout = fullSceneLayout;\n scene.axesOptions.merge(fullLayout, fullSceneLayout);\n scene.spikeOptions.merge(fullSceneLayout);\n scene.setViewport(fullSceneLayout);\n scene.updateFx(fullSceneLayout.dragmode, fullSceneLayout.hovermode);\n scene.camera.enableWheel = scene.graphDiv._context._scrollZoom.gl3d;\n scene.glplot.setClearColor(str2RGBAarray(fullSceneLayout.bgcolor));\n scene.setConvert(axis);\n if (!sceneData) sceneData = [];\n else if (!Array.isArray(sceneData)) sceneData = [sceneData];\n var dataBounds = [\n [Infinity, Infinity, Infinity],\n [-Infinity, -Infinity, -Infinity]\n ];\n for (i = 0; i < sceneData.length; ++i) {\n data = sceneData[i];\n if (data.visible !== true || data._length === 0) continue;\n computeTraceBounds(this, data, dataBounds);\n }\n computeAnnotationBounds(this, dataBounds);\n var dataScale = [1, 1, 1];\n for (j = 0; j < 3; ++j) {\n if (dataBounds[1][j] === dataBounds[0][j]) {\n dataScale[j] = 1;\n } else {\n dataScale[j] = 1 / (dataBounds[1][j] - dataBounds[0][j]);\n }\n }\n scene.dataScale = dataScale;\n scene.convertAnnotations(this);\n for (i = 0; i < sceneData.length; ++i) {\n data = sceneData[i];\n if (data.visible !== true || data._length === 0) {\n continue;\n }\n trace = scene.traces[data.uid];\n if (trace) {\n if (trace.data.type === data.type) {\n trace.update(data);\n } else {\n trace.dispose();\n trace = data._module.plot(this, data);\n scene.traces[data.uid] = trace;\n }\n } else {\n trace = data._module.plot(this, data);\n scene.traces[data.uid] = trace;\n }\n trace.name = data.name;\n }\n var traceIds = Object.keys(scene.traces);\n traceIdLoop:\n for (i = 0; i < traceIds.length; ++i) {\n for (j = 0; j < sceneData.length; ++j) {\n if (sceneData[j].uid === traceIds[i] && (sceneData[j].visible === true && sceneData[j]._length !== 0)) {\n continue traceIdLoop;\n }\n }\n trace = scene.traces[traceIds[i]];\n trace.dispose();\n delete scene.traces[traceIds[i]];\n }\n scene.glplot.objects.sort(function(a, b) {\n return a._trace.data.index - b._trace.data.index;\n });\n var sceneBounds = [[0, 0, 0], [0, 0, 0]];\n var axisDataRange = [];\n var axisTypeRatios = {};\n for (i = 0; i < 3; ++i) {\n axis = fullSceneLayout[axisProperties[i]];\n axisType = axis.type;\n if (axisType in axisTypeRatios) {\n axisTypeRatios[axisType].acc *= dataScale[i];\n axisTypeRatios[axisType].count += 1;\n } else {\n axisTypeRatios[axisType] = {\n acc: dataScale[i],\n count: 1\n };\n }\n var range;\n if (axis.autorange) {\n sceneBounds[0][i] = Infinity;\n sceneBounds[1][i] = -Infinity;\n var objects = scene.glplot.objects;\n var annotations = scene.fullSceneLayout.annotations || [];\n var axLetter = axis._name.charAt(0);\n for (j = 0; j < objects.length; j++) {\n var obj = objects[j];\n var objBounds = obj.bounds;\n var pad = obj._trace.data._pad || 0;\n if (obj.constructor.name === \"ErrorBars\" && axis._lowerLogErrorBound) {\n sceneBounds[0][i] = Math.min(sceneBounds[0][i], axis._lowerLogErrorBound);\n } else {\n sceneBounds[0][i] = Math.min(sceneBounds[0][i], objBounds[0][i] / dataScale[i] - pad);\n }\n sceneBounds[1][i] = Math.max(sceneBounds[1][i], objBounds[1][i] / dataScale[i] + pad);\n }\n for (j = 0; j < annotations.length; j++) {\n var ann = annotations[j];\n if (ann.visible) {\n var pos = axis.r2l(ann[axLetter]);\n sceneBounds[0][i] = Math.min(sceneBounds[0][i], pos);\n sceneBounds[1][i] = Math.max(sceneBounds[1][i], pos);\n }\n }\n if (\"rangemode\" in axis && axis.rangemode === \"tozero\") {\n sceneBounds[0][i] = Math.min(sceneBounds[0][i], 0);\n sceneBounds[1][i] = Math.max(sceneBounds[1][i], 0);\n }\n if (sceneBounds[0][i] > sceneBounds[1][i]) {\n sceneBounds[0][i] = -1;\n sceneBounds[1][i] = 1;\n } else {\n var d = sceneBounds[1][i] - sceneBounds[0][i];\n sceneBounds[0][i] -= d / 32;\n sceneBounds[1][i] += d / 32;\n }\n range = [\n sceneBounds[0][i],\n sceneBounds[1][i]\n ];\n range = applyAutorangeOptions(range, axis);\n sceneBounds[0][i] = range[0];\n sceneBounds[1][i] = range[1];\n if (axis.isReversed()) {\n var tmp = sceneBounds[0][i];\n sceneBounds[0][i] = sceneBounds[1][i];\n sceneBounds[1][i] = tmp;\n }\n } else {\n range = axis.range;\n sceneBounds[0][i] = axis.r2l(range[0]);\n sceneBounds[1][i] = axis.r2l(range[1]);\n }\n if (sceneBounds[0][i] === sceneBounds[1][i]) {\n sceneBounds[0][i] -= 1;\n sceneBounds[1][i] += 1;\n }\n axisDataRange[i] = sceneBounds[1][i] - sceneBounds[0][i];\n axis.range = [\n sceneBounds[0][i],\n sceneBounds[1][i]\n ];\n axis.limitRange();\n scene.glplot.setBounds(i, {\n min: axis.range[0] * dataScale[i],\n max: axis.range[1] * dataScale[i]\n });\n }\n var aspectRatio;\n var aspectmode = fullSceneLayout.aspectmode;\n if (aspectmode === \"cube\") {\n aspectRatio = [1, 1, 1];\n } else if (aspectmode === \"manual\") {\n var userRatio = fullSceneLayout.aspectratio;\n aspectRatio = [userRatio.x, userRatio.y, userRatio.z];\n } else if (aspectmode === \"auto\" || aspectmode === \"data\") {\n var axesScaleRatio = [1, 1, 1];\n for (i = 0; i < 3; ++i) {\n axis = fullSceneLayout[axisProperties[i]];\n axisType = axis.type;\n var axisRatio = axisTypeRatios[axisType];\n axesScaleRatio[i] = Math.pow(axisRatio.acc, 1 / axisRatio.count) / dataScale[i];\n }\n if (aspectmode === \"data\") {\n aspectRatio = axesScaleRatio;\n } else {\n if (Math.max.apply(null, axesScaleRatio) / Math.min.apply(null, axesScaleRatio) <= 4) {\n aspectRatio = axesScaleRatio;\n } else {\n aspectRatio = [1, 1, 1];\n }\n }\n } else {\n throw new Error(\"scene.js aspectRatio was not one of the enumerated types\");\n }\n fullSceneLayout.aspectratio.x = sceneLayout.aspectratio.x = aspectRatio[0];\n fullSceneLayout.aspectratio.y = sceneLayout.aspectratio.y = aspectRatio[1];\n fullSceneLayout.aspectratio.z = sceneLayout.aspectratio.z = aspectRatio[2];\n scene.glplot.setAspectratio(fullSceneLayout.aspectratio);\n if (!scene.viewInitial.aspectratio) {\n scene.viewInitial.aspectratio = {\n x: fullSceneLayout.aspectratio.x,\n y: fullSceneLayout.aspectratio.y,\n z: fullSceneLayout.aspectratio.z\n };\n }\n if (!scene.viewInitial.aspectmode) {\n scene.viewInitial.aspectmode = fullSceneLayout.aspectmode;\n }\n var domain = fullSceneLayout.domain || null;\n var size = fullLayout._size || null;\n if (domain && size) {\n var containerStyle = scene.container.style;\n containerStyle.position = \"absolute\";\n containerStyle.left = size.l + domain.x[0] * size.w + \"px\";\n containerStyle.top = size.t + (1 - domain.y[1]) * size.h + \"px\";\n containerStyle.width = size.w * (domain.x[1] - domain.x[0]) + \"px\";\n containerStyle.height = size.h * (domain.y[1] - domain.y[0]) + \"px\";\n }\n scene.glplot.redraw();\n };\n proto.destroy = function() {\n var scene = this;\n if (!scene.glplot) return;\n scene.camera.mouseListener.enabled = false;\n scene.container.removeEventListener(\"wheel\", scene.camera.wheelListener);\n scene.camera = null;\n scene.glplot.dispose();\n scene.container.parentNode.removeChild(scene.container);\n scene.glplot = null;\n };\n function getCameraArrays(camera) {\n return [\n [camera.eye.x, camera.eye.y, camera.eye.z],\n [camera.center.x, camera.center.y, camera.center.z],\n [camera.up.x, camera.up.y, camera.up.z]\n ];\n }\n function getLayoutCamera(camera) {\n return {\n up: { x: camera.up[0], y: camera.up[1], z: camera.up[2] },\n center: { x: camera.center[0], y: camera.center[1], z: camera.center[2] },\n eye: { x: camera.eye[0], y: camera.eye[1], z: camera.eye[2] },\n projection: { type: camera._ortho === true ? \"orthographic\" : \"perspective\" }\n };\n }\n proto.getCamera = function() {\n var scene = this;\n scene.camera.view.recalcMatrix(scene.camera.view.lastT());\n return getLayoutCamera(scene.camera);\n };\n proto.setViewport = function(sceneLayout) {\n var scene = this;\n var cameraData = sceneLayout.camera;\n scene.camera.lookAt.apply(this, getCameraArrays(cameraData));\n scene.glplot.setAspectratio(sceneLayout.aspectratio);\n var newOrtho = cameraData.projection.type === \"orthographic\";\n var oldOrtho = scene.camera._ortho;\n if (newOrtho !== oldOrtho) {\n scene.glplot.redraw();\n scene.glplot.clearRGBA();\n scene.glplot.dispose();\n scene.initializeGLPlot();\n }\n };\n proto.isCameraChanged = function(layout) {\n var scene = this;\n var cameraData = scene.getCamera();\n var cameraNestedProp = Lib.nestedProperty(layout, scene.id + \".camera\");\n var cameraDataLastSave = cameraNestedProp.get();\n function same(x, y, i2, j2) {\n var vectors = [\"up\", \"center\", \"eye\"];\n var components = [\"x\", \"y\", \"z\"];\n return y[vectors[i2]] && x[vectors[i2]][components[j2]] === y[vectors[i2]][components[j2]];\n }\n var changed = false;\n if (cameraDataLastSave === void 0) {\n changed = true;\n } else {\n for (var i = 0; i < 3; i++) {\n for (var j = 0; j < 3; j++) {\n if (!same(cameraData, cameraDataLastSave, i, j)) {\n changed = true;\n break;\n }\n }\n }\n if (!cameraDataLastSave.projection || cameraData.projection && cameraData.projection.type !== cameraDataLastSave.projection.type) {\n changed = true;\n }\n }\n return changed;\n };\n proto.isAspectChanged = function(layout) {\n var scene = this;\n var aspectData = scene.glplot.getAspectratio();\n var aspectNestedProp = Lib.nestedProperty(layout, scene.id + \".aspectratio\");\n var aspectDataLastSave = aspectNestedProp.get();\n return aspectDataLastSave === void 0 || (aspectDataLastSave.x !== aspectData.x || aspectDataLastSave.y !== aspectData.y || aspectDataLastSave.z !== aspectData.z);\n };\n proto.saveLayout = function(layout) {\n var scene = this;\n var fullLayout = scene.fullLayout;\n var cameraData;\n var cameraNestedProp;\n var cameraDataLastSave;\n var aspectData;\n var aspectNestedProp;\n var aspectDataLastSave;\n var cameraChanged = scene.isCameraChanged(layout);\n var aspectChanged = scene.isAspectChanged(layout);\n var hasChanged = cameraChanged || aspectChanged;\n if (hasChanged) {\n var preGUI = {};\n if (cameraChanged) {\n cameraData = scene.getCamera();\n cameraNestedProp = Lib.nestedProperty(layout, scene.id + \".camera\");\n cameraDataLastSave = cameraNestedProp.get();\n preGUI[scene.id + \".camera\"] = cameraDataLastSave;\n }\n if (aspectChanged) {\n aspectData = scene.glplot.getAspectratio();\n aspectNestedProp = Lib.nestedProperty(layout, scene.id + \".aspectratio\");\n aspectDataLastSave = aspectNestedProp.get();\n preGUI[scene.id + \".aspectratio\"] = aspectDataLastSave;\n }\n Registry.call(\"_storeDirectGUIEdit\", layout, fullLayout._preGUI, preGUI);\n if (cameraChanged) {\n cameraNestedProp.set(cameraData);\n var cameraFullNP = Lib.nestedProperty(fullLayout, scene.id + \".camera\");\n cameraFullNP.set(cameraData);\n }\n if (aspectChanged) {\n aspectNestedProp.set(aspectData);\n var aspectFullNP = Lib.nestedProperty(fullLayout, scene.id + \".aspectratio\");\n aspectFullNP.set(aspectData);\n scene.glplot.redraw();\n }\n }\n return hasChanged;\n };\n proto.updateFx = function(dragmode, hovermode) {\n var scene = this;\n var camera = scene.camera;\n if (camera) {\n if (dragmode === \"orbit\") {\n camera.mode = \"orbit\";\n camera.keyBindingMode = \"rotate\";\n } else if (dragmode === \"turntable\") {\n camera.up = [0, 0, 1];\n camera.mode = \"turntable\";\n camera.keyBindingMode = \"rotate\";\n var gd = scene.graphDiv;\n var fullLayout = gd._fullLayout;\n var fullCamera = scene.fullSceneLayout.camera;\n var x = fullCamera.up.x;\n var y = fullCamera.up.y;\n var z = fullCamera.up.z;\n if (z / Math.sqrt(x * x + y * y + z * z) < 0.999) {\n var attr = scene.id + \".camera.up\";\n var zUp = { x: 0, y: 0, z: 1 };\n var edits = {};\n edits[attr] = zUp;\n var layout = gd.layout;\n Registry.call(\"_storeDirectGUIEdit\", layout, fullLayout._preGUI, edits);\n fullCamera.up = zUp;\n Lib.nestedProperty(layout, attr).set(zUp);\n }\n } else {\n camera.keyBindingMode = dragmode;\n }\n }\n scene.fullSceneLayout.hovermode = hovermode;\n };\n function flipPixels(pixels, w, h) {\n for (var i = 0, q = h - 1; i < q; ++i, --q) {\n for (var j = 0; j < w; ++j) {\n for (var k = 0; k < 4; ++k) {\n var a = 4 * (w * i + j) + k;\n var b = 4 * (w * q + j) + k;\n var tmp = pixels[a];\n pixels[a] = pixels[b];\n pixels[b] = tmp;\n }\n }\n }\n }\n function correctRGB(pixels, w, h) {\n for (var i = 0; i < h; ++i) {\n for (var j = 0; j < w; ++j) {\n var k = 4 * (w * i + j);\n var a = pixels[k + 3];\n if (a > 0) {\n var q = 255 / a;\n for (var l = 0; l < 3; ++l) {\n pixels[k + l] = Math.min(q * pixels[k + l], 255);\n }\n }\n }\n }\n }\n proto.toImage = function(format) {\n var scene = this;\n if (!format) format = \"png\";\n if (scene.staticMode) scene.container.appendChild(STATIC_CANVAS);\n scene.glplot.redraw();\n var gl2 = scene.glplot.gl;\n var w = gl2.drawingBufferWidth;\n var h = gl2.drawingBufferHeight;\n gl2.bindFramebuffer(gl2.FRAMEBUFFER, null);\n var pixels = new Uint8Array(w * h * 4);\n gl2.readPixels(0, 0, w, h, gl2.RGBA, gl2.UNSIGNED_BYTE, pixels);\n flipPixels(pixels, w, h);\n correctRGB(pixels, w, h);\n var canvas = document.createElement(\"canvas\");\n canvas.width = w;\n canvas.height = h;\n var context = canvas.getContext(\"2d\", { willReadFrequently: true });\n var imageData = context.createImageData(w, h);\n imageData.data.set(pixels);\n context.putImageData(imageData, 0, 0);\n var dataURL;\n switch (format) {\n case \"jpeg\":\n dataURL = canvas.toDataURL(\"image/jpeg\");\n break;\n case \"webp\":\n dataURL = canvas.toDataURL(\"image/webp\");\n break;\n default:\n dataURL = canvas.toDataURL(\"image/png\");\n }\n if (scene.staticMode) scene.container.removeChild(STATIC_CANVAS);\n return dataURL;\n };\n proto.setConvert = function() {\n var scene = this;\n for (var i = 0; i < 3; i++) {\n var ax = scene.fullSceneLayout[axisProperties[i]];\n Axes.setConvert(ax, scene.fullLayout);\n ax.setScale = Lib.noop;\n }\n };\n proto.make4thDimension = function() {\n var scene = this;\n var gd = scene.graphDiv;\n var fullLayout = gd._fullLayout;\n scene._mockAxis = {\n type: \"linear\",\n showexponent: \"all\",\n exponentformat: \"B\"\n };\n Axes.setConvert(scene._mockAxis, fullLayout);\n };\n module.exports = Scene;\n }\n });\n\n // src/plots/gl3d/layout/attributes.js\n var require_attributes41 = __commonJS({\n \"src/plots/gl3d/layout/attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n scene: {\n valType: \"subplotid\",\n dflt: \"scene\",\n editType: \"calc+clearAxisTypes\"\n }\n };\n }\n });\n\n // src/plots/gl3d/layout/axis_attributes.js\n var require_axis_attributes = __commonJS({\n \"src/plots/gl3d/layout/axis_attributes.js\"(exports, module) {\n \"use strict\";\n var Color2 = require_color();\n var axesAttrs = require_layout_attributes4();\n var extendFlat = require_extend().extendFlat;\n var overrideAll = require_edit_types().overrideAll;\n module.exports = overrideAll({\n visible: axesAttrs.visible,\n showspikes: {\n valType: \"boolean\",\n dflt: true\n },\n spikesides: {\n valType: \"boolean\",\n dflt: true\n },\n spikethickness: {\n valType: \"number\",\n min: 0,\n dflt: 2\n },\n spikecolor: {\n valType: \"color\",\n dflt: Color2.defaultLine\n },\n showbackground: {\n valType: \"boolean\",\n dflt: false\n },\n backgroundcolor: {\n valType: \"color\",\n dflt: \"rgba(204, 204, 204, 0.5)\"\n },\n showaxeslabels: {\n valType: \"boolean\",\n dflt: true\n },\n color: axesAttrs.color,\n categoryorder: axesAttrs.categoryorder,\n categoryarray: axesAttrs.categoryarray,\n title: {\n text: axesAttrs.title.text,\n font: axesAttrs.title.font\n },\n type: extendFlat({}, axesAttrs.type, {\n values: [\"-\", \"linear\", \"log\", \"date\", \"category\"]\n }),\n autotypenumbers: axesAttrs.autotypenumbers,\n autorange: axesAttrs.autorange,\n autorangeoptions: {\n minallowed: axesAttrs.autorangeoptions.minallowed,\n maxallowed: axesAttrs.autorangeoptions.maxallowed,\n clipmin: axesAttrs.autorangeoptions.clipmin,\n clipmax: axesAttrs.autorangeoptions.clipmax,\n include: axesAttrs.autorangeoptions.include,\n editType: \"plot\"\n },\n rangemode: axesAttrs.rangemode,\n minallowed: axesAttrs.minallowed,\n maxallowed: axesAttrs.maxallowed,\n range: extendFlat({}, axesAttrs.range, {\n items: [\n { valType: \"any\", editType: \"plot\", impliedEdits: { \"^autorange\": false } },\n { valType: \"any\", editType: \"plot\", impliedEdits: { \"^autorange\": false } }\n ],\n anim: false\n }),\n // ticks\n tickmode: axesAttrs.minor.tickmode,\n nticks: axesAttrs.nticks,\n tick0: axesAttrs.tick0,\n dtick: axesAttrs.dtick,\n tickvals: axesAttrs.tickvals,\n ticktext: axesAttrs.ticktext,\n ticks: axesAttrs.ticks,\n mirror: axesAttrs.mirror,\n ticklen: axesAttrs.ticklen,\n tickwidth: axesAttrs.tickwidth,\n tickcolor: axesAttrs.tickcolor,\n showticklabels: axesAttrs.showticklabels,\n labelalias: axesAttrs.labelalias,\n tickfont: axesAttrs.tickfont,\n tickangle: axesAttrs.tickangle,\n tickprefix: axesAttrs.tickprefix,\n showtickprefix: axesAttrs.showtickprefix,\n ticksuffix: axesAttrs.ticksuffix,\n showticksuffix: axesAttrs.showticksuffix,\n showexponent: axesAttrs.showexponent,\n exponentformat: axesAttrs.exponentformat,\n minexponent: axesAttrs.minexponent,\n separatethousands: axesAttrs.separatethousands,\n tickformat: axesAttrs.tickformat,\n tickformatstops: axesAttrs.tickformatstops,\n hoverformat: axesAttrs.hoverformat,\n // lines and grids\n showline: axesAttrs.showline,\n linecolor: axesAttrs.linecolor,\n linewidth: axesAttrs.linewidth,\n showgrid: axesAttrs.showgrid,\n gridcolor: extendFlat(\n {},\n axesAttrs.gridcolor,\n // shouldn't this be on-par with 2D?\n { dflt: \"rgb(204, 204, 204)\" }\n ),\n gridwidth: axesAttrs.gridwidth,\n zeroline: axesAttrs.zeroline,\n zerolinecolor: axesAttrs.zerolinecolor,\n zerolinewidth: axesAttrs.zerolinewidth\n }, \"plot\", \"from-root\");\n }\n });\n\n // src/plots/gl3d/layout/layout_attributes.js\n var require_layout_attributes17 = __commonJS({\n \"src/plots/gl3d/layout/layout_attributes.js\"(exports, module) {\n \"use strict\";\n var gl3dAxisAttrs = require_axis_attributes();\n var domainAttrs = require_domain().attributes;\n var extendFlat = require_extend().extendFlat;\n var counterRegex = require_lib().counterRegex;\n function makeCameraVector(x, y, z) {\n return {\n x: {\n valType: \"number\",\n dflt: x,\n editType: \"camera\"\n },\n y: {\n valType: \"number\",\n dflt: y,\n editType: \"camera\"\n },\n z: {\n valType: \"number\",\n dflt: z,\n editType: \"camera\"\n },\n editType: \"camera\"\n };\n }\n module.exports = {\n _arrayAttrRegexps: [counterRegex(\"scene\", \".annotations\", true)],\n bgcolor: {\n valType: \"color\",\n dflt: \"rgba(0,0,0,0)\",\n editType: \"plot\"\n },\n camera: {\n up: extendFlat(makeCameraVector(0, 0, 1), {}),\n center: extendFlat(makeCameraVector(0, 0, 0), {}),\n eye: extendFlat(makeCameraVector(1.25, 1.25, 1.25), {}),\n projection: {\n type: {\n valType: \"enumerated\",\n values: [\"perspective\", \"orthographic\"],\n dflt: \"perspective\",\n editType: \"calc\"\n },\n editType: \"calc\"\n },\n editType: \"camera\"\n },\n domain: domainAttrs({ name: \"scene\", editType: \"plot\" }),\n aspectmode: {\n valType: \"enumerated\",\n values: [\"auto\", \"cube\", \"data\", \"manual\"],\n dflt: \"auto\",\n editType: \"plot\",\n impliedEdits: {\n \"aspectratio.x\": void 0,\n \"aspectratio.y\": void 0,\n \"aspectratio.z\": void 0\n }\n },\n aspectratio: {\n // must be positive (0's are coerced to 1)\n x: {\n valType: \"number\",\n min: 0,\n editType: \"plot\",\n impliedEdits: { \"^aspectmode\": \"manual\" }\n },\n y: {\n valType: \"number\",\n min: 0,\n editType: \"plot\",\n impliedEdits: { \"^aspectmode\": \"manual\" }\n },\n z: {\n valType: \"number\",\n min: 0,\n editType: \"plot\",\n impliedEdits: { \"^aspectmode\": \"manual\" }\n },\n editType: \"plot\",\n impliedEdits: { aspectmode: \"manual\" }\n },\n xaxis: gl3dAxisAttrs,\n yaxis: gl3dAxisAttrs,\n zaxis: gl3dAxisAttrs,\n dragmode: {\n valType: \"enumerated\",\n values: [\"orbit\", \"turntable\", \"zoom\", \"pan\", false],\n editType: \"plot\"\n },\n hovermode: {\n valType: \"enumerated\",\n values: [\"closest\", false],\n dflt: \"closest\",\n editType: \"modebar\"\n },\n uirevision: {\n valType: \"any\",\n editType: \"none\"\n },\n editType: \"plot\"\n };\n }\n });\n\n // src/plots/gl3d/layout/axis_defaults.js\n var require_axis_defaults2 = __commonJS({\n \"src/plots/gl3d/layout/axis_defaults.js\"(exports, module) {\n \"use strict\";\n var colorMix = require_tinycolor().mix;\n var Lib = require_lib();\n var Template = require_plot_template();\n var layoutAttributes = require_axis_attributes();\n var handleTypeDefaults = require_type_defaults();\n var handleAxisDefaults = require_axis_defaults();\n var axesNames = [\"xaxis\", \"yaxis\", \"zaxis\"];\n var gridLightness = 100 * (204 - 68) / (255 - 68);\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) {\n var containerIn, containerOut;\n function coerce(attr, dflt) {\n return Lib.coerce(containerIn, containerOut, layoutAttributes, attr, dflt);\n }\n for (var j = 0; j < axesNames.length; j++) {\n var axName = axesNames[j];\n containerIn = layoutIn[axName] || {};\n containerOut = Template.newContainer(layoutOut, axName);\n containerOut._id = axName[0] + options.scene;\n containerOut._name = axName;\n handleTypeDefaults(containerIn, containerOut, coerce, options);\n handleAxisDefaults(\n containerIn,\n containerOut,\n coerce,\n {\n font: options.font,\n letter: axName[0],\n data: options.data,\n showGrid: true,\n noAutotickangles: true,\n noTicklabelindex: true,\n noTickson: true,\n noTicklabelmode: true,\n noTicklabelshift: true,\n noTicklabelstandoff: true,\n noTicklabelstep: true,\n noTicklabelposition: true,\n noTicklabeloverflow: true,\n noInsiderange: true,\n bgColor: options.bgColor,\n calendar: options.calendar\n },\n options.fullLayout\n );\n coerce(\"gridcolor\", colorMix(containerOut.color, options.bgColor, gridLightness).toRgbString());\n coerce(\"title.text\", axName[0]);\n containerOut.setScale = Lib.noop;\n if (coerce(\"showspikes\")) {\n coerce(\"spikesides\");\n coerce(\"spikethickness\");\n coerce(\"spikecolor\", containerOut.color);\n }\n coerce(\"showaxeslabels\");\n if (coerce(\"showbackground\")) coerce(\"backgroundcolor\");\n }\n };\n }\n });\n\n // src/plots/gl3d/layout/defaults.js\n var require_defaults37 = __commonJS({\n \"src/plots/gl3d/layout/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Color2 = require_color();\n var Registry = require_registry();\n var handleSubplotDefaults = require_subplot_defaults();\n var supplyGl3dAxisLayoutDefaults = require_axis_defaults2();\n var layoutAttributes = require_layout_attributes17();\n var getSubplotData = require_get_data().getSubplotData;\n var GL3D = \"gl3d\";\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {\n var hasNon3D = layoutOut._basePlotModules.length > 1;\n function getDfltFromLayout(attr) {\n if (hasNon3D) return;\n var isValid = Lib.validate(layoutIn[attr], layoutAttributes[attr]);\n if (isValid) return layoutIn[attr];\n }\n handleSubplotDefaults(layoutIn, layoutOut, fullData, {\n type: GL3D,\n attributes: layoutAttributes,\n handleDefaults: handleGl3dDefaults,\n fullLayout: layoutOut,\n font: layoutOut.font,\n fullData,\n getDfltFromLayout,\n autotypenumbersDflt: layoutOut.autotypenumbers,\n paper_bgcolor: layoutOut.paper_bgcolor,\n calendar: layoutOut.calendar\n });\n };\n function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) {\n var bgcolor = coerce(\"bgcolor\");\n var bgColorCombined = Color2.combine(bgcolor, opts.paper_bgcolor);\n var cameraKeys = [\"up\", \"center\", \"eye\"];\n for (var j = 0; j < cameraKeys.length; j++) {\n coerce(\"camera.\" + cameraKeys[j] + \".x\");\n coerce(\"camera.\" + cameraKeys[j] + \".y\");\n coerce(\"camera.\" + cameraKeys[j] + \".z\");\n }\n coerce(\"camera.projection.type\");\n var hasAspect = !!coerce(\"aspectratio.x\") && !!coerce(\"aspectratio.y\") && !!coerce(\"aspectratio.z\");\n var defaultAspectMode = hasAspect ? \"manual\" : \"auto\";\n var aspectMode = coerce(\"aspectmode\", defaultAspectMode);\n if (!hasAspect) {\n sceneLayoutIn.aspectratio = sceneLayoutOut.aspectratio = { x: 1, y: 1, z: 1 };\n if (aspectMode === \"manual\") sceneLayoutOut.aspectmode = \"auto\";\n sceneLayoutIn.aspectmode = sceneLayoutOut.aspectmode;\n }\n var fullGl3dData = getSubplotData(opts.fullData, GL3D, opts.id);\n supplyGl3dAxisLayoutDefaults(sceneLayoutIn, sceneLayoutOut, {\n font: opts.font,\n scene: opts.id,\n data: fullGl3dData,\n bgColor: bgColorCombined,\n calendar: opts.calendar,\n autotypenumbersDflt: opts.autotypenumbersDflt,\n fullLayout: opts.fullLayout\n });\n Registry.getComponentMethod(\"annotations3d\", \"handleDefaults\")(\n sceneLayoutIn,\n sceneLayoutOut,\n opts\n );\n var dragmode = opts.getDfltFromLayout(\"dragmode\");\n if (dragmode !== false) {\n if (!dragmode) {\n dragmode = \"orbit\";\n if (sceneLayoutIn.camera && sceneLayoutIn.camera.up) {\n var x = sceneLayoutIn.camera.up.x;\n var y = sceneLayoutIn.camera.up.y;\n var z = sceneLayoutIn.camera.up.z;\n if (z !== 0) {\n if (!x || !y || !z) {\n dragmode = \"turntable\";\n } else if (z / Math.sqrt(x * x + y * y + z * z) > 0.999) {\n dragmode = \"turntable\";\n }\n }\n } else {\n dragmode = \"turntable\";\n }\n }\n }\n coerce(\"dragmode\", dragmode);\n coerce(\"hovermode\", opts.getDfltFromLayout(\"hovermode\"));\n }\n }\n });\n\n // src/plots/gl3d/index.js\n var require_gl3d = __commonJS({\n \"src/plots/gl3d/index.js\"(exports) {\n \"use strict\";\n var overrideAll = require_edit_types().overrideAll;\n var fxAttrs = require_layout_attributes();\n var Scene = require_scene();\n var getSubplotData = require_get_data().getSubplotData;\n var Lib = require_lib();\n var xmlnsNamespaces = require_xmlns_namespaces();\n var GL3D = \"gl3d\";\n var SCENE = \"scene\";\n exports.name = GL3D;\n exports.attr = SCENE;\n exports.idRoot = SCENE;\n exports.idRegex = exports.attrRegex = Lib.counterRegex(\"scene\");\n exports.attributes = require_attributes41();\n exports.layoutAttributes = require_layout_attributes17();\n exports.baseLayoutAttrOverrides = overrideAll({\n hoverlabel: fxAttrs.hoverlabel\n }, \"plot\", \"nested\");\n exports.supplyLayoutDefaults = require_defaults37();\n exports.plot = function plot(gd) {\n var fullLayout = gd._fullLayout;\n var fullData = gd._fullData;\n var sceneIds = fullLayout._subplots[GL3D];\n for (var i = 0; i < sceneIds.length; i++) {\n var sceneId = sceneIds[i];\n var fullSceneData = getSubplotData(fullData, GL3D, sceneId);\n var sceneLayout = fullLayout[sceneId];\n var camera = sceneLayout.camera;\n var scene = sceneLayout._scene;\n if (!scene) {\n scene = new Scene(\n {\n id: sceneId,\n graphDiv: gd,\n container: gd.querySelector(\".gl-container\"),\n staticPlot: gd._context.staticPlot,\n plotGlPixelRatio: gd._context.plotGlPixelRatio,\n camera\n },\n fullLayout\n );\n sceneLayout._scene = scene;\n }\n if (!scene.viewInitial) {\n scene.viewInitial = {\n up: {\n x: camera.up.x,\n y: camera.up.y,\n z: camera.up.z\n },\n eye: {\n x: camera.eye.x,\n y: camera.eye.y,\n z: camera.eye.z\n },\n center: {\n x: camera.center.x,\n y: camera.center.y,\n z: camera.center.z\n }\n };\n }\n scene.plot(fullSceneData, fullLayout, gd.layout);\n }\n };\n exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var oldSceneKeys = oldFullLayout._subplots[GL3D] || [];\n for (var i = 0; i < oldSceneKeys.length; i++) {\n var oldSceneKey = oldSceneKeys[i];\n if (!newFullLayout[oldSceneKey] && !!oldFullLayout[oldSceneKey]._scene) {\n oldFullLayout[oldSceneKey]._scene.destroy();\n if (oldFullLayout._infolayer) {\n oldFullLayout._infolayer.selectAll(\".annotation-\" + oldSceneKey).remove();\n }\n }\n }\n };\n exports.toSVG = function(gd) {\n var fullLayout = gd._fullLayout;\n var sceneIds = fullLayout._subplots[GL3D];\n var size = fullLayout._size;\n for (var i = 0; i < sceneIds.length; i++) {\n var sceneLayout = fullLayout[sceneIds[i]];\n var domain = sceneLayout.domain;\n var scene = sceneLayout._scene;\n var imageData = scene.toImage(\"png\");\n var image = fullLayout._glimages.append(\"svg:image\");\n image.attr({\n xmlns: xmlnsNamespaces.svg,\n \"xlink:href\": imageData,\n x: size.l + size.w * domain.x[0],\n y: size.t + size.h * (1 - domain.y[1]),\n width: size.w * (domain.x[1] - domain.x[0]),\n height: size.h * (domain.y[1] - domain.y[0]),\n preserveAspectRatio: \"none\"\n });\n scene.destroy();\n }\n };\n exports.cleanId = function cleanId(id) {\n if (!id.match(/^scene[0-9]*$/)) return;\n var sceneNum = id.substr(5);\n if (sceneNum === \"1\") sceneNum = \"\";\n return SCENE + sceneNum;\n };\n exports.updateFx = function(gd) {\n var fullLayout = gd._fullLayout;\n var subplotIds = fullLayout._subplots[GL3D];\n for (var i = 0; i < subplotIds.length; i++) {\n var subplotObj = fullLayout[subplotIds[i]]._scene;\n subplotObj.updateFx(fullLayout.dragmode, fullLayout.hovermode);\n }\n };\n }\n });\n\n // src/traces/scatter3d/index.js\n var require_scatter3d = __commonJS({\n \"src/traces/scatter3d/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n plot: require_convert2(),\n attributes: require_attributes40(),\n markerSymbols: require_gl3d_markers(),\n supplyDefaults: require_defaults36(),\n colorbar: [\n {\n container: \"marker\",\n min: \"cmin\",\n max: \"cmax\"\n },\n {\n container: \"line\",\n min: \"cmin\",\n max: \"cmax\"\n }\n ],\n calc: require_calc21(),\n moduleType: \"trace\",\n name: \"scatter3d\",\n basePlotModule: require_gl3d(),\n categories: [\"gl3d\", \"symbols\", \"showLegend\", \"scatter-like\"],\n meta: {}\n };\n }\n });\n\n // lib/scatter3d.js\n var require_scatter3d2 = __commonJS({\n \"lib/scatter3d.js\"(exports, module) {\n \"use strict\";\n module.exports = require_scatter3d();\n }\n });\n\n // src/traces/surface/attributes.js\n var require_attributes42 = __commonJS({\n \"src/traces/surface/attributes.js\"(exports, module) {\n \"use strict\";\n var Color2 = require_color();\n var colorScaleAttrs = require_attributes8();\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var baseAttrs = require_attributes2();\n var extendFlat = require_extend().extendFlat;\n var overrideAll = require_edit_types().overrideAll;\n function makeContourProjAttr(axLetter) {\n return {\n valType: \"boolean\",\n dflt: false\n };\n }\n function makeContourAttr(axLetter) {\n return {\n show: {\n valType: \"boolean\",\n dflt: false\n },\n start: {\n valType: \"number\",\n dflt: null,\n editType: \"plot\"\n // impliedEdits: {'^autocontour': false},\n },\n end: {\n valType: \"number\",\n dflt: null,\n editType: \"plot\"\n // impliedEdits: {'^autocontour': false},\n },\n size: {\n valType: \"number\",\n dflt: null,\n min: 0,\n editType: \"plot\"\n // impliedEdits: {'^autocontour': false},\n },\n project: {\n x: makeContourProjAttr(\"x\"),\n y: makeContourProjAttr(\"y\"),\n z: makeContourProjAttr(\"z\")\n },\n color: {\n valType: \"color\",\n dflt: Color2.defaultLine\n },\n usecolormap: {\n valType: \"boolean\",\n dflt: false\n },\n width: {\n valType: \"number\",\n min: 1,\n max: 16,\n dflt: 2\n },\n highlight: {\n valType: \"boolean\",\n dflt: true\n },\n highlightcolor: {\n valType: \"color\",\n dflt: Color2.defaultLine\n },\n highlightwidth: {\n valType: \"number\",\n min: 1,\n max: 16,\n dflt: 2\n }\n };\n }\n var attrs = module.exports = overrideAll(extendFlat(\n {\n z: {\n valType: \"data_array\"\n },\n x: {\n valType: \"data_array\"\n },\n y: {\n valType: \"data_array\"\n },\n text: {\n valType: \"string\",\n dflt: \"\",\n arrayOk: true\n },\n hovertext: {\n valType: \"string\",\n dflt: \"\",\n arrayOk: true\n },\n hovertemplate: hovertemplateAttrs(),\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n zhoverformat: axisHoverFormat(\"z\"),\n connectgaps: {\n valType: \"boolean\",\n dflt: false,\n editType: \"calc\"\n },\n surfacecolor: {\n valType: \"data_array\"\n }\n },\n colorScaleAttrs(\"\", {\n colorAttr: \"z or surfacecolor\",\n showScaleDflt: true,\n autoColorDflt: false,\n editTypeOverride: \"calc\"\n }),\n {\n contours: {\n x: makeContourAttr(\"x\"),\n y: makeContourAttr(\"y\"),\n z: makeContourAttr(\"z\")\n },\n hidesurface: {\n valType: \"boolean\",\n dflt: false\n },\n lightposition: {\n x: {\n valType: \"number\",\n min: -1e5,\n max: 1e5,\n dflt: 10\n },\n y: {\n valType: \"number\",\n min: -1e5,\n max: 1e5,\n dflt: 1e4\n },\n z: {\n valType: \"number\",\n min: -1e5,\n max: 1e5,\n dflt: 0\n }\n },\n lighting: {\n ambient: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0.8\n },\n diffuse: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0.8\n },\n specular: {\n valType: \"number\",\n min: 0,\n max: 2,\n dflt: 0.05\n },\n roughness: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0.5\n },\n fresnel: {\n valType: \"number\",\n min: 0,\n max: 5,\n dflt: 0.2\n }\n },\n opacity: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 1\n },\n opacityscale: {\n valType: \"any\",\n editType: \"calc\"\n },\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo),\n showlegend: extendFlat({}, baseAttrs.showlegend, { dflt: false })\n }\n ), \"calc\", \"nested\");\n attrs.x.editType = attrs.y.editType = attrs.z.editType = \"calc+clearAxisTypes\";\n }\n });\n\n // src/traces/surface/defaults.js\n var require_defaults38 = __commonJS({\n \"src/traces/surface/defaults.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var Lib = require_lib();\n var colorscaleDefaults = require_defaults2();\n var attributes = require_attributes42();\n var MIN = 0.1;\n function createWave(n, minOpacity) {\n var arr = [];\n var steps = 32;\n for (var i = 0; i < steps; i++) {\n var u = i / (steps - 1);\n var v = minOpacity + (1 - minOpacity) * (1 - Math.pow(Math.sin(n * u * Math.PI), 2));\n arr.push([\n u,\n Math.max(0, Math.min(1, v))\n ]);\n }\n return arr;\n }\n function isValidScaleArray(scl) {\n var highestVal = 0;\n if (!Array.isArray(scl) || scl.length < 2) return false;\n if (!scl[0] || !scl[scl.length - 1]) return false;\n if (+scl[0][0] !== 0 || +scl[scl.length - 1][0] !== 1) return false;\n for (var i = 0; i < scl.length; i++) {\n var si = scl[i];\n if (si.length !== 2 || +si[0] < highestVal) {\n return false;\n }\n highestVal = +si[0];\n }\n return true;\n }\n function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n var i, j;\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var x = coerce(\"x\");\n var y = coerce(\"y\");\n var z = coerce(\"z\");\n if (!z || !z.length || (x ? x.length < 1 : false) || (y ? y.length < 1 : false)) {\n traceOut.visible = false;\n return;\n }\n traceOut._xlength = Array.isArray(x) && Lib.isArrayOrTypedArray(x[0]) ? z.length : z[0].length;\n traceOut._ylength = z.length;\n var handleCalendarDefaults = Registry.getComponentMethod(\"calendars\", \"handleTraceDefaults\");\n handleCalendarDefaults(traceIn, traceOut, [\"x\", \"y\", \"z\"], layout);\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n coerce(\"zhoverformat\");\n [\n \"lighting.ambient\",\n \"lighting.diffuse\",\n \"lighting.specular\",\n \"lighting.roughness\",\n \"lighting.fresnel\",\n \"lightposition.x\",\n \"lightposition.y\",\n \"lightposition.z\",\n \"hidesurface\",\n \"connectgaps\",\n \"opacity\"\n ].forEach(function(x2) {\n coerce(x2);\n });\n var surfaceColor = coerce(\"surfacecolor\");\n var dims = [\"x\", \"y\", \"z\"];\n for (i = 0; i < 3; ++i) {\n var contourDim = \"contours.\" + dims[i];\n var show = coerce(contourDim + \".show\");\n var highlight = coerce(contourDim + \".highlight\");\n if (show || highlight) {\n for (j = 0; j < 3; ++j) {\n coerce(contourDim + \".project.\" + dims[j]);\n }\n }\n if (show) {\n coerce(contourDim + \".color\");\n coerce(contourDim + \".width\");\n coerce(contourDim + \".usecolormap\");\n }\n if (highlight) {\n coerce(contourDim + \".highlightcolor\");\n coerce(contourDim + \".highlightwidth\");\n }\n coerce(contourDim + \".start\");\n coerce(contourDim + \".end\");\n coerce(contourDim + \".size\");\n }\n colorscaleDefaults(\n traceIn,\n traceOut,\n layout,\n coerce,\n { prefix: \"\", cLetter: \"c\" }\n );\n opacityscaleDefaults(traceIn, traceOut, layout, coerce);\n traceOut._length = null;\n }\n function opacityscaleDefaults(traceIn, traceOut, layout, coerce) {\n var opacityscale = coerce(\"opacityscale\");\n if (opacityscale === \"max\") {\n traceOut.opacityscale = [[0, MIN], [1, 1]];\n } else if (opacityscale === \"min\") {\n traceOut.opacityscale = [[0, 1], [1, MIN]];\n } else if (opacityscale === \"extremes\") {\n traceOut.opacityscale = createWave(1, MIN);\n } else if (!isValidScaleArray(opacityscale)) {\n traceOut.opacityscale = void 0;\n }\n }\n module.exports = {\n supplyDefaults,\n opacityscaleDefaults\n };\n }\n });\n\n // src/traces/surface/calc.js\n var require_calc22 = __commonJS({\n \"src/traces/surface/calc.js\"(exports, module) {\n \"use strict\";\n var colorscaleCalc = require_calc();\n module.exports = function calc(gd, trace) {\n if (trace.surfacecolor) {\n colorscaleCalc(gd, trace, {\n vals: trace.surfacecolor,\n containerStr: \"\",\n cLetter: \"c\"\n });\n } else {\n colorscaleCalc(gd, trace, {\n vals: trace.z,\n containerStr: \"\",\n cLetter: \"c\"\n });\n }\n };\n }\n });\n\n // src/traces/surface/convert.js\n var require_convert4 = __commonJS({\n \"src/traces/surface/convert.js\"(exports, module) {\n \"use strict\";\n var createSurface = require_stackgl_modules().gl_surface3d;\n var ndarray = require_stackgl_modules().ndarray;\n var ndarrayInterp2d = require_stackgl_modules().ndarray_linear_interpolate.d2;\n var interp2d = require_interp2d();\n var findEmpties = require_find_empties();\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n var parseColorScale = require_gl_format_color().parseColorScale;\n var str2RgbaArray = require_str2rgbarray();\n var extractOpts = require_colorscale().extractOpts;\n function SurfaceTrace(scene, surface, uid) {\n this.scene = scene;\n this.uid = uid;\n this.surface = surface;\n this.data = null;\n this.showContour = [false, false, false];\n this.contourStart = [null, null, null];\n this.contourEnd = [null, null, null];\n this.contourSize = [0, 0, 0];\n this.minValues = [Infinity, Infinity, Infinity];\n this.maxValues = [-Infinity, -Infinity, -Infinity];\n this.dataScaleX = 1;\n this.dataScaleY = 1;\n this.refineData = true;\n this.objectOffset = [0, 0, 0];\n }\n var proto = SurfaceTrace.prototype;\n proto.getXat = function(a, b, calendar, axis) {\n var v = !isArrayOrTypedArray(this.data.x) ? a : isArrayOrTypedArray(this.data.x[0]) ? this.data.x[b][a] : this.data.x[a];\n return calendar === void 0 ? v : axis.d2l(v, 0, calendar);\n };\n proto.getYat = function(a, b, calendar, axis) {\n var v = !isArrayOrTypedArray(this.data.y) ? b : isArrayOrTypedArray(this.data.y[0]) ? this.data.y[b][a] : this.data.y[b];\n return calendar === void 0 ? v : axis.d2l(v, 0, calendar);\n };\n proto.getZat = function(a, b, calendar, axis) {\n var v = this.data.z[b][a];\n if (v === null && this.data.connectgaps && this.data._interpolatedZ) {\n v = this.data._interpolatedZ[b][a];\n }\n return calendar === void 0 ? v : axis.d2l(v, 0, calendar);\n };\n proto.handlePick = function(selection) {\n if (selection.object === this.surface) {\n var xRatio = (selection.data.index[0] - 1) / this.dataScaleX - 1;\n var yRatio = (selection.data.index[1] - 1) / this.dataScaleY - 1;\n var j = Math.max(Math.min(Math.round(xRatio), this.data.z[0].length - 1), 0);\n var k = Math.max(Math.min(Math.round(yRatio), this.data._ylength - 1), 0);\n selection.index = [j, k];\n selection.traceCoordinate = [\n this.getXat(j, k),\n this.getYat(j, k),\n this.getZat(j, k)\n ];\n selection.dataCoordinate = [\n this.getXat(j, k, this.data.xcalendar, this.scene.fullSceneLayout.xaxis),\n this.getYat(j, k, this.data.ycalendar, this.scene.fullSceneLayout.yaxis),\n this.getZat(j, k, this.data.zcalendar, this.scene.fullSceneLayout.zaxis)\n ];\n for (var i = 0; i < 3; i++) {\n var v = selection.dataCoordinate[i];\n if (v !== null && v !== void 0) {\n selection.dataCoordinate[i] *= this.scene.dataScale[i];\n }\n }\n var text = this.data.hovertext || this.data.text;\n if (isArrayOrTypedArray(text) && text[k] && text[k][j] !== void 0) {\n selection.textLabel = text[k][j];\n } else if (text) {\n selection.textLabel = text;\n } else {\n selection.textLabel = \"\";\n }\n selection.data.dataCoordinate = selection.dataCoordinate.slice();\n this.surface.highlight(selection.data);\n this.scene.glplot.spikes.position = selection.dataCoordinate;\n return true;\n }\n };\n function isColormapCircular(colormap) {\n var first = colormap[0].rgb;\n var last = colormap[colormap.length - 1].rgb;\n return first[0] === last[0] && first[1] === last[1] && first[2] === last[2] && first[3] === last[3];\n }\n var shortPrimes = [\n 2,\n 3,\n 5,\n 7,\n 11,\n 13,\n 17,\n 19,\n 23,\n 29,\n 31,\n 37,\n 41,\n 43,\n 47,\n 53,\n 59,\n 61,\n 67,\n 71,\n 73,\n 79,\n 83,\n 89,\n 97,\n 101,\n 103,\n 107,\n 109,\n 113,\n 127,\n 131,\n 137,\n 139,\n 149,\n 151,\n 157,\n 163,\n 167,\n 173,\n 179,\n 181,\n 191,\n 193,\n 197,\n 199,\n 211,\n 223,\n 227,\n 229,\n 233,\n 239,\n 241,\n 251,\n 257,\n 263,\n 269,\n 271,\n 277,\n 281,\n 283,\n 293,\n 307,\n 311,\n 313,\n 317,\n 331,\n 337,\n 347,\n 349,\n 353,\n 359,\n 367,\n 373,\n 379,\n 383,\n 389,\n 397,\n 401,\n 409,\n 419,\n 421,\n 431,\n 433,\n 439,\n 443,\n 449,\n 457,\n 461,\n 463,\n 467,\n 479,\n 487,\n 491,\n 499,\n 503,\n 509,\n 521,\n 523,\n 541,\n 547,\n 557,\n 563,\n 569,\n 571,\n 577,\n 587,\n 593,\n 599,\n 601,\n 607,\n 613,\n 617,\n 619,\n 631,\n 641,\n 643,\n 647,\n 653,\n 659,\n 661,\n 673,\n 677,\n 683,\n 691,\n 701,\n 709,\n 719,\n 727,\n 733,\n 739,\n 743,\n 751,\n 757,\n 761,\n 769,\n 773,\n 787,\n 797,\n 809,\n 811,\n 821,\n 823,\n 827,\n 829,\n 839,\n 853,\n 857,\n 859,\n 863,\n 877,\n 881,\n 883,\n 887,\n 907,\n 911,\n 919,\n 929,\n 937,\n 941,\n 947,\n 953,\n 967,\n 971,\n 977,\n 983,\n 991,\n 997,\n 1009,\n 1013,\n 1019,\n 1021,\n 1031,\n 1033,\n 1039,\n 1049,\n 1051,\n 1061,\n 1063,\n 1069,\n 1087,\n 1091,\n 1093,\n 1097,\n 1103,\n 1109,\n 1117,\n 1123,\n 1129,\n 1151,\n 1153,\n 1163,\n 1171,\n 1181,\n 1187,\n 1193,\n 1201,\n 1213,\n 1217,\n 1223,\n 1229,\n 1231,\n 1237,\n 1249,\n 1259,\n 1277,\n 1279,\n 1283,\n 1289,\n 1291,\n 1297,\n 1301,\n 1303,\n 1307,\n 1319,\n 1321,\n 1327,\n 1361,\n 1367,\n 1373,\n 1381,\n 1399,\n 1409,\n 1423,\n 1427,\n 1429,\n 1433,\n 1439,\n 1447,\n 1451,\n 1453,\n 1459,\n 1471,\n 1481,\n 1483,\n 1487,\n 1489,\n 1493,\n 1499,\n 1511,\n 1523,\n 1531,\n 1543,\n 1549,\n 1553,\n 1559,\n 1567,\n 1571,\n 1579,\n 1583,\n 1597,\n 1601,\n 1607,\n 1609,\n 1613,\n 1619,\n 1621,\n 1627,\n 1637,\n 1657,\n 1663,\n 1667,\n 1669,\n 1693,\n 1697,\n 1699,\n 1709,\n 1721,\n 1723,\n 1733,\n 1741,\n 1747,\n 1753,\n 1759,\n 1777,\n 1783,\n 1787,\n 1789,\n 1801,\n 1811,\n 1823,\n 1831,\n 1847,\n 1861,\n 1867,\n 1871,\n 1873,\n 1877,\n 1879,\n 1889,\n 1901,\n 1907,\n 1913,\n 1931,\n 1933,\n 1949,\n 1951,\n 1973,\n 1979,\n 1987,\n 1993,\n 1997,\n 1999,\n 2003,\n 2011,\n 2017,\n 2027,\n 2029,\n 2039,\n 2053,\n 2063,\n 2069,\n 2081,\n 2083,\n 2087,\n 2089,\n 2099,\n 2111,\n 2113,\n 2129,\n 2131,\n 2137,\n 2141,\n 2143,\n 2153,\n 2161,\n 2179,\n 2203,\n 2207,\n 2213,\n 2221,\n 2237,\n 2239,\n 2243,\n 2251,\n 2267,\n 2269,\n 2273,\n 2281,\n 2287,\n 2293,\n 2297,\n 2309,\n 2311,\n 2333,\n 2339,\n 2341,\n 2347,\n 2351,\n 2357,\n 2371,\n 2377,\n 2381,\n 2383,\n 2389,\n 2393,\n 2399,\n 2411,\n 2417,\n 2423,\n 2437,\n 2441,\n 2447,\n 2459,\n 2467,\n 2473,\n 2477,\n 2503,\n 2521,\n 2531,\n 2539,\n 2543,\n 2549,\n 2551,\n 2557,\n 2579,\n 2591,\n 2593,\n 2609,\n 2617,\n 2621,\n 2633,\n 2647,\n 2657,\n 2659,\n 2663,\n 2671,\n 2677,\n 2683,\n 2687,\n 2689,\n 2693,\n 2699,\n 2707,\n 2711,\n 2713,\n 2719,\n 2729,\n 2731,\n 2741,\n 2749,\n 2753,\n 2767,\n 2777,\n 2789,\n 2791,\n 2797,\n 2801,\n 2803,\n 2819,\n 2833,\n 2837,\n 2843,\n 2851,\n 2857,\n 2861,\n 2879,\n 2887,\n 2897,\n 2903,\n 2909,\n 2917,\n 2927,\n 2939,\n 2953,\n 2957,\n 2963,\n 2969,\n 2971,\n 2999\n ];\n function getPow(a, b) {\n if (a < b) return 0;\n var n = 0;\n while (Math.floor(a % b) === 0) {\n a /= b;\n n++;\n }\n return n;\n }\n function getFactors(a) {\n var powers = [];\n for (var i = 0; i < shortPrimes.length; i++) {\n var b = shortPrimes[i];\n powers.push(\n getPow(a, b)\n );\n }\n return powers;\n }\n function smallestDivisor(a) {\n var A2 = getFactors(a);\n var result = a;\n for (var i = 0; i < shortPrimes.length; i++) {\n if (A2[i] > 0) {\n result = shortPrimes[i];\n break;\n }\n }\n return result;\n }\n function leastCommonMultiple(a, b) {\n if (a < 1 || b < 1) return void 0;\n var A2 = getFactors(a);\n var B2 = getFactors(b);\n var n = 1;\n for (var i = 0; i < shortPrimes.length; i++) {\n n *= Math.pow(\n shortPrimes[i],\n Math.max(A2[i], B2[i])\n );\n }\n return n;\n }\n function arrayLCM(A2) {\n if (A2.length === 0) return void 0;\n var n = 1;\n for (var i = 0; i < A2.length; i++) {\n n = leastCommonMultiple(n, A2[i]);\n }\n return n;\n }\n proto.calcXnums = function(xlen) {\n var i;\n var nums = [];\n for (i = 1; i < xlen; i++) {\n var a = this.getXat(i - 1, 0);\n var b = this.getXat(i, 0);\n if (b !== a && a !== void 0 && a !== null && b !== void 0 && b !== null) {\n nums[i - 1] = Math.abs(b - a);\n } else {\n nums[i - 1] = 0;\n }\n }\n var totalDist = 0;\n for (i = 1; i < xlen; i++) {\n totalDist += nums[i - 1];\n }\n for (i = 1; i < xlen; i++) {\n if (nums[i - 1] === 0) {\n nums[i - 1] = 1;\n } else {\n nums[i - 1] = Math.round(totalDist / nums[i - 1]);\n }\n }\n return nums;\n };\n proto.calcYnums = function(ylen) {\n var i;\n var nums = [];\n for (i = 1; i < ylen; i++) {\n var a = this.getYat(0, i - 1);\n var b = this.getYat(0, i);\n if (b !== a && a !== void 0 && a !== null && b !== void 0 && b !== null) {\n nums[i - 1] = Math.abs(b - a);\n } else {\n nums[i - 1] = 0;\n }\n }\n var totalDist = 0;\n for (i = 1; i < ylen; i++) {\n totalDist += nums[i - 1];\n }\n for (i = 1; i < ylen; i++) {\n if (nums[i - 1] === 0) {\n nums[i - 1] = 1;\n } else {\n nums[i - 1] = Math.round(totalDist / nums[i - 1]);\n }\n }\n return nums;\n };\n var highlyComposites = [1, 2, 4, 6, 12, 24, 36, 48, 60, 120, 180, 240, 360, 720, 840, 1260];\n var MIN_RESOLUTION = highlyComposites[9];\n var MAX_RESOLUTION = highlyComposites[13];\n proto.estimateScale = function(resSrc, axis) {\n var nums = axis === 0 ? this.calcXnums(resSrc) : this.calcYnums(resSrc);\n var resDst = 1 + arrayLCM(nums);\n while (resDst < MIN_RESOLUTION) {\n resDst *= 2;\n }\n while (resDst > MAX_RESOLUTION) {\n resDst--;\n resDst /= smallestDivisor(resDst);\n resDst++;\n if (resDst < MIN_RESOLUTION) {\n resDst = MAX_RESOLUTION;\n }\n }\n var scale = Math.round(resDst / resSrc);\n return scale > 1 ? scale : 1;\n };\n function fnHomography(out, inp, X) {\n var w = X[8] + X[2] * inp[0] + X[5] * inp[1];\n out[0] = (X[6] + X[0] * inp[0] + X[3] * inp[1]) / w;\n out[1] = (X[7] + X[1] * inp[0] + X[4] * inp[1]) / w;\n return out;\n }\n function homography(dest, src, X) {\n warp(dest, src, fnHomography, X);\n return dest;\n }\n function warp(dest, src, func, X) {\n var warped = [0, 0];\n var ni = dest.shape[0];\n var nj = dest.shape[1];\n for (var i = 0; i < ni; i++) {\n for (var j = 0; j < nj; j++) {\n func(warped, [i, j], X);\n dest.set(i, j, ndarrayInterp2d(src, warped[0], warped[1]));\n }\n }\n return dest;\n }\n proto.refineCoords = function(coords) {\n var scaleW = this.dataScaleX;\n var scaleH = this.dataScaleY;\n var width = coords[0].shape[0];\n var height = coords[0].shape[1];\n var newWidth = Math.floor(coords[0].shape[0] * scaleW + 1) | 0;\n var newHeight = Math.floor(coords[0].shape[1] * scaleH + 1) | 0;\n var padWidth = 1 + width + 1;\n var padHeight = 1 + height + 1;\n var padImg = ndarray(new Float32Array(padWidth * padHeight), [padWidth, padHeight]);\n var X = [\n 1 / scaleW,\n 0,\n 0,\n 0,\n 1 / scaleH,\n 0,\n 0,\n 0,\n 1\n ];\n for (var i = 0; i < coords.length; ++i) {\n this.surface.padField(padImg, coords[i]);\n var scaledImg = ndarray(new Float32Array(newWidth * newHeight), [newWidth, newHeight]);\n homography(scaledImg, padImg, X);\n coords[i] = scaledImg;\n }\n };\n function insertIfNewLevel(arr, newValue) {\n var found = false;\n for (var k = 0; k < arr.length; k++) {\n if (newValue === arr[k]) {\n found = true;\n break;\n }\n }\n if (found === false) arr.push(newValue);\n }\n proto.setContourLevels = function() {\n var newLevels = [[], [], []];\n var useNewLevels = [false, false, false];\n var needsUpdate = false;\n var i, j, value;\n for (i = 0; i < 3; ++i) {\n if (this.showContour[i]) {\n needsUpdate = true;\n if (this.contourSize[i] > 0 && this.contourStart[i] !== null && this.contourEnd[i] !== null && this.contourEnd[i] > this.contourStart[i]) {\n useNewLevels[i] = true;\n for (j = this.contourStart[i]; j < this.contourEnd[i]; j += this.contourSize[i]) {\n value = j * this.scene.dataScale[i];\n insertIfNewLevel(newLevels[i], value);\n }\n }\n }\n }\n if (needsUpdate) {\n var allLevels = [[], [], []];\n for (i = 0; i < 3; ++i) {\n if (this.showContour[i]) {\n allLevels[i] = useNewLevels[i] ? newLevels[i] : this.scene.contourLevels[i];\n }\n }\n this.surface.update({ levels: allLevels });\n }\n };\n proto.update = function(data) {\n var scene = this.scene;\n var sceneLayout = scene.fullSceneLayout;\n var surface = this.surface;\n var colormap = parseColorScale(data);\n var scaleFactor = scene.dataScale;\n var xlen = data.z[0].length;\n var ylen = data._ylength;\n var contourLevels = scene.contourLevels;\n this.data = data;\n var i, j, k, v;\n var rawCoords = [];\n for (i = 0; i < 3; i++) {\n rawCoords[i] = [];\n for (j = 0; j < xlen; j++) {\n rawCoords[i][j] = [];\n }\n }\n for (j = 0; j < xlen; j++) {\n for (k = 0; k < ylen; k++) {\n rawCoords[0][j][k] = this.getXat(j, k, data.xcalendar, sceneLayout.xaxis);\n rawCoords[1][j][k] = this.getYat(j, k, data.ycalendar, sceneLayout.yaxis);\n rawCoords[2][j][k] = this.getZat(j, k, data.zcalendar, sceneLayout.zaxis);\n }\n }\n if (data.connectgaps) {\n data._emptypoints = findEmpties(rawCoords[2]);\n interp2d(rawCoords[2], data._emptypoints);\n data._interpolatedZ = [];\n for (j = 0; j < xlen; j++) {\n data._interpolatedZ[j] = [];\n for (k = 0; k < ylen; k++) {\n data._interpolatedZ[j][k] = rawCoords[2][j][k];\n }\n }\n }\n for (i = 0; i < 3; i++) {\n for (j = 0; j < xlen; j++) {\n for (k = 0; k < ylen; k++) {\n v = rawCoords[i][j][k];\n if (v === null || v === void 0) {\n rawCoords[i][j][k] = NaN;\n } else {\n v = rawCoords[i][j][k] *= scaleFactor[i];\n }\n }\n }\n }\n for (i = 0; i < 3; i++) {\n for (j = 0; j < xlen; j++) {\n for (k = 0; k < ylen; k++) {\n v = rawCoords[i][j][k];\n if (v !== null && v !== void 0) {\n if (this.minValues[i] > v) {\n this.minValues[i] = v;\n }\n if (this.maxValues[i] < v) {\n this.maxValues[i] = v;\n }\n }\n }\n }\n }\n for (i = 0; i < 3; i++) {\n this.objectOffset[i] = 0.5 * (this.minValues[i] + this.maxValues[i]);\n }\n for (i = 0; i < 3; i++) {\n for (j = 0; j < xlen; j++) {\n for (k = 0; k < ylen; k++) {\n v = rawCoords[i][j][k];\n if (v !== null && v !== void 0) {\n rawCoords[i][j][k] -= this.objectOffset[i];\n }\n }\n }\n }\n var coords = [\n ndarray(new Float32Array(xlen * ylen), [xlen, ylen]),\n ndarray(new Float32Array(xlen * ylen), [xlen, ylen]),\n ndarray(new Float32Array(xlen * ylen), [xlen, ylen])\n ];\n for (i = 0; i < 3; i++) {\n for (j = 0; j < xlen; j++) {\n for (k = 0; k < ylen; k++) {\n coords[i].set(j, k, rawCoords[i][j][k]);\n }\n }\n }\n rawCoords = [];\n var params = {\n colormap,\n levels: [[], [], []],\n showContour: [true, true, true],\n showSurface: !data.hidesurface,\n contourProject: [\n [false, false, false],\n [false, false, false],\n [false, false, false]\n ],\n contourWidth: [1, 1, 1],\n contourColor: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],\n contourTint: [1, 1, 1],\n dynamicColor: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],\n dynamicWidth: [1, 1, 1],\n dynamicTint: [1, 1, 1],\n opacityscale: data.opacityscale,\n opacity: data.opacity\n };\n var cOpts = extractOpts(data);\n params.intensityBounds = [cOpts.min, cOpts.max];\n if (data.surfacecolor) {\n var intensity = ndarray(new Float32Array(xlen * ylen), [xlen, ylen]);\n for (j = 0; j < xlen; j++) {\n for (k = 0; k < ylen; k++) {\n intensity.set(j, k, data.surfacecolor[k][j]);\n }\n }\n coords.push(intensity);\n } else {\n params.intensityBounds[0] *= scaleFactor[2];\n params.intensityBounds[1] *= scaleFactor[2];\n }\n if (MAX_RESOLUTION < coords[0].shape[0] || MAX_RESOLUTION < coords[0].shape[1]) {\n this.refineData = false;\n }\n if (this.refineData === true) {\n this.dataScaleX = this.estimateScale(coords[0].shape[0], 0);\n this.dataScaleY = this.estimateScale(coords[0].shape[1], 1);\n if (this.dataScaleX !== 1 || this.dataScaleY !== 1) {\n this.refineCoords(coords);\n }\n }\n if (data.surfacecolor) {\n params.intensity = coords.pop();\n }\n var highlightEnable = [true, true, true];\n var axis = [\"x\", \"y\", \"z\"];\n for (i = 0; i < 3; ++i) {\n var contourParams = data.contours[axis[i]];\n highlightEnable[i] = contourParams.highlight;\n params.showContour[i] = contourParams.show || contourParams.highlight;\n if (!params.showContour[i]) continue;\n params.contourProject[i] = [\n contourParams.project.x,\n contourParams.project.y,\n contourParams.project.z\n ];\n if (contourParams.show) {\n this.showContour[i] = true;\n params.levels[i] = contourLevels[i];\n surface.highlightColor[i] = params.contourColor[i] = str2RgbaArray(contourParams.color);\n if (contourParams.usecolormap) {\n surface.highlightTint[i] = params.contourTint[i] = 0;\n } else {\n surface.highlightTint[i] = params.contourTint[i] = 1;\n }\n params.contourWidth[i] = contourParams.width;\n this.contourStart[i] = contourParams.start;\n this.contourEnd[i] = contourParams.end;\n this.contourSize[i] = contourParams.size;\n } else {\n this.showContour[i] = false;\n this.contourStart[i] = null;\n this.contourEnd[i] = null;\n this.contourSize[i] = 0;\n }\n if (contourParams.highlight) {\n params.dynamicColor[i] = str2RgbaArray(contourParams.highlightcolor);\n params.dynamicWidth[i] = contourParams.highlightwidth;\n }\n }\n if (isColormapCircular(colormap)) {\n params.vertexColor = true;\n }\n params.objectOffset = this.objectOffset;\n params.coords = coords;\n surface.update(params);\n surface.visible = data.visible;\n surface.enableDynamic = highlightEnable;\n surface.enableHighlight = highlightEnable;\n surface.snapToData = true;\n if (\"lighting\" in data) {\n surface.ambientLight = data.lighting.ambient;\n surface.diffuseLight = data.lighting.diffuse;\n surface.specularLight = data.lighting.specular;\n surface.roughness = data.lighting.roughness;\n surface.fresnel = data.lighting.fresnel;\n }\n if (\"lightposition\" in data) {\n surface.lightPosition = [data.lightposition.x, data.lightposition.y, data.lightposition.z];\n }\n };\n proto.dispose = function() {\n this.scene.glplot.remove(this.surface);\n this.surface.dispose();\n };\n function createSurfaceTrace(scene, data) {\n var gl2 = scene.glplot.gl;\n var surface = createSurface({ gl: gl2 });\n var result = new SurfaceTrace(scene, surface, data.uid);\n surface._trace = result;\n result.update(data);\n scene.glplot.add(surface);\n return result;\n }\n module.exports = createSurfaceTrace;\n }\n });\n\n // src/traces/surface/index.js\n var require_surface = __commonJS({\n \"src/traces/surface/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes42(),\n supplyDefaults: require_defaults38().supplyDefaults,\n colorbar: {\n min: \"cmin\",\n max: \"cmax\"\n },\n calc: require_calc22(),\n plot: require_convert4(),\n moduleType: \"trace\",\n name: \"surface\",\n basePlotModule: require_gl3d(),\n categories: [\"gl3d\", \"2dMap\", \"showLegend\"],\n meta: {}\n };\n }\n });\n\n // lib/surface.js\n var require_surface2 = __commonJS({\n \"lib/surface.js\"(exports, module) {\n \"use strict\";\n module.exports = require_surface();\n }\n });\n\n // src/traces/mesh3d/attributes.js\n var require_attributes43 = __commonJS({\n \"src/traces/mesh3d/attributes.js\"(exports, module) {\n \"use strict\";\n var colorScaleAttrs = require_attributes8();\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var surfaceAttrs = require_attributes42();\n var baseAttrs = require_attributes2();\n var extendFlat = require_extend().extendFlat;\n module.exports = extendFlat(\n {\n x: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n y: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n z: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n i: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n j: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n k: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n text: {\n valType: \"string\",\n dflt: \"\",\n arrayOk: true,\n editType: \"calc\"\n },\n hovertext: {\n valType: \"string\",\n dflt: \"\",\n arrayOk: true,\n editType: \"calc\"\n },\n hovertemplate: hovertemplateAttrs({ editType: \"calc\" }),\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n zhoverformat: axisHoverFormat(\"z\"),\n delaunayaxis: {\n valType: \"enumerated\",\n values: [\"x\", \"y\", \"z\"],\n dflt: \"z\",\n editType: \"calc\"\n },\n alphahull: {\n valType: \"number\",\n dflt: -1,\n editType: \"calc\"\n },\n intensity: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n intensitymode: {\n valType: \"enumerated\",\n values: [\"vertex\", \"cell\"],\n dflt: \"vertex\",\n editType: \"calc\"\n },\n // Color field\n color: {\n valType: \"color\",\n editType: \"calc\"\n },\n vertexcolor: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n facecolor: {\n valType: \"data_array\",\n editType: \"calc\"\n }\n },\n colorScaleAttrs(\"\", {\n colorAttr: \"`intensity`\",\n showScaleDflt: true,\n editTypeOverride: \"calc\"\n }),\n {\n opacity: surfaceAttrs.opacity,\n // Flat shaded mode\n flatshading: {\n valType: \"boolean\",\n dflt: false,\n editType: \"calc\"\n },\n contour: {\n show: extendFlat({}, surfaceAttrs.contours.x.show, {}),\n color: surfaceAttrs.contours.x.color,\n width: surfaceAttrs.contours.x.width,\n editType: \"calc\"\n },\n lightposition: {\n x: extendFlat({}, surfaceAttrs.lightposition.x, { dflt: 1e5 }),\n y: extendFlat({}, surfaceAttrs.lightposition.y, { dflt: 1e5 }),\n z: extendFlat({}, surfaceAttrs.lightposition.z, { dflt: 0 }),\n editType: \"calc\"\n },\n lighting: extendFlat({\n vertexnormalsepsilon: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 1e-12,\n // otherwise finely tessellated things eg. the brain will have no specular light reflection\n editType: \"calc\"\n },\n facenormalsepsilon: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 1e-6,\n // even the brain model doesn't appear to need finer than this\n editType: \"calc\"\n },\n editType: \"calc\"\n }, surfaceAttrs.lighting),\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, { editType: \"calc\" }),\n showlegend: extendFlat({}, baseAttrs.showlegend, { dflt: false })\n }\n );\n }\n });\n\n // src/traces/isosurface/attributes.js\n var require_attributes44 = __commonJS({\n \"src/traces/isosurface/attributes.js\"(exports, module) {\n \"use strict\";\n var colorScaleAttrs = require_attributes8();\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var meshAttrs = require_attributes43();\n var baseAttrs = require_attributes2();\n var extendFlat = require_extend().extendFlat;\n var overrideAll = require_edit_types().overrideAll;\n function makeSliceAttr(axLetter) {\n return {\n show: {\n valType: \"boolean\",\n dflt: false\n },\n locations: {\n valType: \"data_array\",\n dflt: []\n },\n fill: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 1\n }\n };\n }\n function makeCapAttr(axLetter) {\n return {\n show: {\n valType: \"boolean\",\n dflt: true\n },\n fill: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 1\n }\n };\n }\n var attrs = module.exports = overrideAll(extendFlat(\n {\n x: {\n valType: \"data_array\"\n },\n y: {\n valType: \"data_array\"\n },\n z: {\n valType: \"data_array\"\n },\n value: {\n valType: \"data_array\"\n },\n isomin: {\n valType: \"number\"\n },\n isomax: {\n valType: \"number\"\n },\n surface: {\n show: {\n valType: \"boolean\",\n dflt: true\n },\n count: {\n valType: \"integer\",\n dflt: 2,\n min: 1\n },\n fill: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 1\n },\n pattern: {\n valType: \"flaglist\",\n flags: [\"A\", \"B\", \"C\", \"D\", \"E\"],\n extras: [\"all\", \"odd\", \"even\"],\n dflt: \"all\"\n }\n },\n spaceframe: {\n show: {\n valType: \"boolean\",\n dflt: false\n },\n fill: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0.15\n }\n },\n slices: {\n x: makeSliceAttr(\"x\"),\n y: makeSliceAttr(\"y\"),\n z: makeSliceAttr(\"z\")\n },\n caps: {\n x: makeCapAttr(\"x\"),\n y: makeCapAttr(\"y\"),\n z: makeCapAttr(\"z\")\n },\n text: {\n valType: \"string\",\n dflt: \"\",\n arrayOk: true\n },\n hovertext: {\n valType: \"string\",\n dflt: \"\",\n arrayOk: true\n },\n hovertemplate: hovertemplateAttrs(),\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n zhoverformat: axisHoverFormat(\"z\"),\n valuehoverformat: axisHoverFormat(\"value\", 1),\n showlegend: extendFlat({}, baseAttrs.showlegend, { dflt: false })\n },\n colorScaleAttrs(\"\", {\n colorAttr: \"`value`\",\n showScaleDflt: true,\n editTypeOverride: \"calc\"\n }),\n {\n opacity: meshAttrs.opacity,\n lightposition: meshAttrs.lightposition,\n lighting: meshAttrs.lighting,\n flatshading: meshAttrs.flatshading,\n contour: meshAttrs.contour,\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo)\n }\n ), \"calc\", \"nested\");\n attrs.flatshading.dflt = true;\n attrs.lighting.facenormalsepsilon.dflt = 0;\n attrs.x.editType = attrs.y.editType = attrs.z.editType = attrs.value.editType = \"calc+clearAxisTypes\";\n }\n });\n\n // src/traces/isosurface/defaults.js\n var require_defaults39 = __commonJS({\n \"src/traces/isosurface/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Registry = require_registry();\n var attributes = require_attributes44();\n var colorscaleDefaults = require_defaults2();\n function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n supplyIsoDefaults(traceIn, traceOut, defaultColor, layout, coerce);\n }\n function supplyIsoDefaults(traceIn, traceOut, defaultColor, layout, coerce) {\n var isomin = coerce(\"isomin\");\n var isomax = coerce(\"isomax\");\n if (isomax !== void 0 && isomax !== null && isomin !== void 0 && isomin !== null && isomin > isomax) {\n traceOut.isomin = null;\n traceOut.isomax = null;\n }\n var x = coerce(\"x\");\n var y = coerce(\"y\");\n var z = coerce(\"z\");\n var value = coerce(\"value\");\n if (!x || !x.length || !y || !y.length || !z || !z.length || !value || !value.length) {\n traceOut.visible = false;\n return;\n }\n var handleCalendarDefaults = Registry.getComponentMethod(\"calendars\", \"handleTraceDefaults\");\n handleCalendarDefaults(traceIn, traceOut, [\"x\", \"y\", \"z\"], layout);\n coerce(\"valuehoverformat\");\n [\"x\", \"y\", \"z\"].forEach(function(dim) {\n coerce(dim + \"hoverformat\");\n var capDim = \"caps.\" + dim;\n var showCap = coerce(capDim + \".show\");\n if (showCap) {\n coerce(capDim + \".fill\");\n }\n var sliceDim = \"slices.\" + dim;\n var showSlice = coerce(sliceDim + \".show\");\n if (showSlice) {\n coerce(sliceDim + \".fill\");\n coerce(sliceDim + \".locations\");\n }\n });\n var showSpaceframe = coerce(\"spaceframe.show\");\n if (showSpaceframe) {\n coerce(\"spaceframe.fill\");\n }\n var showSurface = coerce(\"surface.show\");\n if (showSurface) {\n coerce(\"surface.count\");\n coerce(\"surface.fill\");\n coerce(\"surface.pattern\");\n }\n var showContour = coerce(\"contour.show\");\n if (showContour) {\n coerce(\"contour.color\");\n coerce(\"contour.width\");\n }\n [\n \"text\",\n \"hovertext\",\n \"hovertemplate\",\n \"lighting.ambient\",\n \"lighting.diffuse\",\n \"lighting.specular\",\n \"lighting.roughness\",\n \"lighting.fresnel\",\n \"lighting.vertexnormalsepsilon\",\n \"lighting.facenormalsepsilon\",\n \"lightposition.x\",\n \"lightposition.y\",\n \"lightposition.z\",\n \"flatshading\",\n \"opacity\"\n ].forEach(function(x2) {\n coerce(x2);\n });\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"\", cLetter: \"c\" });\n traceOut._length = null;\n }\n module.exports = {\n supplyDefaults,\n supplyIsoDefaults\n };\n }\n });\n\n // src/traces/streamtube/calc.js\n var require_calc23 = __commonJS({\n \"src/traces/streamtube/calc.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var colorscaleCalc = require_calc();\n function calc(gd, trace) {\n trace._len = Math.min(\n trace.u.length,\n trace.v.length,\n trace.w.length,\n trace.x.length,\n trace.y.length,\n trace.z.length\n );\n trace._u = filter(trace.u, trace._len);\n trace._v = filter(trace.v, trace._len);\n trace._w = filter(trace.w, trace._len);\n trace._x = filter(trace.x, trace._len);\n trace._y = filter(trace.y, trace._len);\n trace._z = filter(trace.z, trace._len);\n var grid = processGrid(trace);\n trace._gridFill = grid.fill;\n trace._Xs = grid.Xs;\n trace._Ys = grid.Ys;\n trace._Zs = grid.Zs;\n trace._len = grid.len;\n var slen = 0;\n var startx, starty, startz;\n if (trace.starts) {\n startx = filter(trace.starts.x || []);\n starty = filter(trace.starts.y || []);\n startz = filter(trace.starts.z || []);\n slen = Math.min(startx.length, starty.length, startz.length);\n }\n trace._startsX = startx || [];\n trace._startsY = starty || [];\n trace._startsZ = startz || [];\n var normMax = 0;\n var normMin = Infinity;\n var i;\n for (i = 0; i < trace._len; i++) {\n var u = trace._u[i];\n var v = trace._v[i];\n var w = trace._w[i];\n var norm = Math.sqrt(u * u + v * v + w * w);\n normMax = Math.max(normMax, norm);\n normMin = Math.min(normMin, norm);\n }\n colorscaleCalc(gd, trace, {\n vals: [normMin, normMax],\n containerStr: \"\",\n cLetter: \"c\"\n });\n for (i = 0; i < slen; i++) {\n var sx = startx[i];\n grid.xMax = Math.max(grid.xMax, sx);\n grid.xMin = Math.min(grid.xMin, sx);\n var sy = starty[i];\n grid.yMax = Math.max(grid.yMax, sy);\n grid.yMin = Math.min(grid.yMin, sy);\n var sz = startz[i];\n grid.zMax = Math.max(grid.zMax, sz);\n grid.zMin = Math.min(grid.zMin, sz);\n }\n trace._slen = slen;\n trace._normMax = normMax;\n trace._xbnds = [grid.xMin, grid.xMax];\n trace._ybnds = [grid.yMin, grid.yMax];\n trace._zbnds = [grid.zMin, grid.zMax];\n }\n function processGrid(trace) {\n var x = trace._x;\n var y = trace._y;\n var z = trace._z;\n var len = trace._len;\n var i, j, k;\n var xMax = -Infinity;\n var xMin = Infinity;\n var yMax = -Infinity;\n var yMin = Infinity;\n var zMax = -Infinity;\n var zMin = Infinity;\n var gridFill = \"\";\n var filledX;\n var filledY;\n var filledZ;\n var firstX, lastX;\n var firstY, lastY;\n var firstZ, lastZ;\n if (len) {\n firstX = x[0];\n firstY = y[0];\n firstZ = z[0];\n }\n if (len > 1) {\n lastX = x[len - 1];\n lastY = y[len - 1];\n lastZ = z[len - 1];\n }\n for (i = 0; i < len; i++) {\n xMax = Math.max(xMax, x[i]);\n xMin = Math.min(xMin, x[i]);\n yMax = Math.max(yMax, y[i]);\n yMin = Math.min(yMin, y[i]);\n zMax = Math.max(zMax, z[i]);\n zMin = Math.min(zMin, z[i]);\n if (!filledX && x[i] !== firstX) {\n filledX = true;\n gridFill += \"x\";\n }\n if (!filledY && y[i] !== firstY) {\n filledY = true;\n gridFill += \"y\";\n }\n if (!filledZ && z[i] !== firstZ) {\n filledZ = true;\n gridFill += \"z\";\n }\n }\n if (!filledX) gridFill += \"x\";\n if (!filledY) gridFill += \"y\";\n if (!filledZ) gridFill += \"z\";\n var Xs = distinctVals(trace._x);\n var Ys = distinctVals(trace._y);\n var Zs = distinctVals(trace._z);\n gridFill = gridFill.replace(\"x\", (firstX > lastX ? \"-\" : \"+\") + \"x\");\n gridFill = gridFill.replace(\"y\", (firstY > lastY ? \"-\" : \"+\") + \"y\");\n gridFill = gridFill.replace(\"z\", (firstZ > lastZ ? \"-\" : \"+\") + \"z\");\n var empty = function() {\n len = 0;\n Xs = [];\n Ys = [];\n Zs = [];\n };\n if (!len || len < Xs.length * Ys.length * Zs.length) empty();\n var getArray = function(c) {\n return c === \"x\" ? x : c === \"y\" ? y : z;\n };\n var getVals = function(c) {\n return c === \"x\" ? Xs : c === \"y\" ? Ys : Zs;\n };\n var getDir = function(c) {\n return c[len - 1] < c[0] ? -1 : 1;\n };\n var arrK = getArray(gridFill[1]);\n var arrJ = getArray(gridFill[3]);\n var arrI = getArray(gridFill[5]);\n var nk = getVals(gridFill[1]).length;\n var nj = getVals(gridFill[3]).length;\n var ni = getVals(gridFill[5]).length;\n var arbitrary = false;\n var getIndex = function(_i, _j, _k) {\n return nk * (nj * _i + _j) + _k;\n };\n var dirK = getDir(getArray(gridFill[1]));\n var dirJ = getDir(getArray(gridFill[3]));\n var dirI = getDir(getArray(gridFill[5]));\n for (i = 0; i < ni - 1; i++) {\n for (j = 0; j < nj - 1; j++) {\n for (k = 0; k < nk - 1; k++) {\n var q000 = getIndex(i, j, k);\n var q001 = getIndex(i, j, k + 1);\n var q010 = getIndex(i, j + 1, k);\n var q100 = getIndex(i + 1, j, k);\n if (!(arrK[q000] * dirK < arrK[q001] * dirK) || !(arrJ[q000] * dirJ < arrJ[q010] * dirJ) || !(arrI[q000] * dirI < arrI[q100] * dirI)) {\n arbitrary = true;\n }\n if (arbitrary) break;\n }\n if (arbitrary) break;\n }\n if (arbitrary) break;\n }\n if (arbitrary) {\n Lib.warn(\"Encountered arbitrary coordinates! Unable to input data grid.\");\n empty();\n }\n return {\n xMin,\n yMin,\n zMin,\n xMax,\n yMax,\n zMax,\n Xs,\n Ys,\n Zs,\n len,\n fill: gridFill\n };\n }\n function distinctVals(col) {\n return Lib.distinctVals(col).vals;\n }\n function filter(arr, len) {\n if (len === void 0) len = arr.length;\n if (Lib.isTypedArray(arr)) return arr.subarray(0, len);\n var values = [];\n for (var i = 0; i < len; i++) {\n values[i] = +arr[i];\n }\n return values;\n }\n module.exports = {\n calc,\n filter,\n processGrid\n };\n }\n });\n\n // src/traces/isosurface/calc.js\n var require_calc24 = __commonJS({\n \"src/traces/isosurface/calc.js\"(exports, module) {\n \"use strict\";\n var colorscaleCalc = require_calc();\n var processGrid = require_calc23().processGrid;\n var filter = require_calc23().filter;\n module.exports = function calc(gd, trace) {\n trace._len = Math.min(\n trace.x.length,\n trace.y.length,\n trace.z.length,\n trace.value.length\n );\n trace._x = filter(trace.x, trace._len);\n trace._y = filter(trace.y, trace._len);\n trace._z = filter(trace.z, trace._len);\n trace._value = filter(trace.value, trace._len);\n var grid = processGrid(trace);\n trace._gridFill = grid.fill;\n trace._Xs = grid.Xs;\n trace._Ys = grid.Ys;\n trace._Zs = grid.Zs;\n trace._len = grid.len;\n var min = Infinity;\n var max = -Infinity;\n for (var i = 0; i < trace._len; i++) {\n var v = trace._value[i];\n min = Math.min(min, v);\n max = Math.max(max, v);\n }\n trace._minValues = min;\n trace._maxValues = max;\n trace._vMin = trace.isomin === void 0 || trace.isomin === null ? min : trace.isomin;\n trace._vMax = trace.isomax === void 0 || trace.isomax === null ? max : trace.isomax;\n colorscaleCalc(gd, trace, {\n vals: [trace._vMin, trace._vMax],\n containerStr: \"\",\n cLetter: \"c\"\n });\n };\n }\n });\n\n // src/plots/gl3d/zip3.js\n var require_zip3 = __commonJS({\n \"src/plots/gl3d/zip3.js\"(exports, module) {\n \"use strict\";\n module.exports = function zip3(x, y, z, len) {\n len = len || x.length;\n var result = new Array(len);\n for (var i = 0; i < len; i++) {\n result[i] = [x[i], y[i], z[i]];\n }\n return result;\n };\n }\n });\n\n // src/traces/isosurface/convert.js\n var require_convert5 = __commonJS({\n \"src/traces/isosurface/convert.js\"(exports, module) {\n \"use strict\";\n var createMesh = require_stackgl_modules().gl_mesh3d;\n var parseColorScale = require_gl_format_color().parseColorScale;\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n var str2RgbaArray = require_str2rgbarray();\n var extractOpts = require_colorscale().extractOpts;\n var zip3 = require_zip3();\n var findNearestOnAxis = function(w, arr) {\n for (var q = arr.length - 1; q > 0; q--) {\n var min = Math.min(arr[q], arr[q - 1]);\n var max = Math.max(arr[q], arr[q - 1]);\n if (max > min && min < w && w <= max) {\n return {\n id: q,\n distRatio: (max - w) / (max - min)\n };\n }\n }\n return {\n id: 0,\n distRatio: 0\n };\n };\n function IsosurfaceTrace(scene, mesh, uid) {\n this.scene = scene;\n this.uid = uid;\n this.mesh = mesh;\n this.name = \"\";\n this.data = null;\n this.showContour = false;\n }\n var proto = IsosurfaceTrace.prototype;\n proto.handlePick = function(selection) {\n if (selection.object === this.mesh) {\n var rawId = selection.data.index;\n var x = this.data._meshX[rawId];\n var y = this.data._meshY[rawId];\n var z = this.data._meshZ[rawId];\n var height = this.data._Ys.length;\n var depth = this.data._Zs.length;\n var i = findNearestOnAxis(x, this.data._Xs).id;\n var j = findNearestOnAxis(y, this.data._Ys).id;\n var k = findNearestOnAxis(z, this.data._Zs).id;\n var selectIndex = selection.index = k + depth * j + depth * height * i;\n selection.traceCoordinate = [\n this.data._meshX[selectIndex],\n this.data._meshY[selectIndex],\n this.data._meshZ[selectIndex],\n this.data._value[selectIndex]\n ];\n var text = this.data.hovertext || this.data.text;\n if (isArrayOrTypedArray(text) && text[selectIndex] !== void 0) {\n selection.textLabel = text[selectIndex];\n } else if (text) {\n selection.textLabel = text;\n }\n return true;\n }\n };\n proto.update = function(data) {\n var scene = this.scene;\n var layout = scene.fullSceneLayout;\n this.data = generateIsoMeshes(data);\n function toDataCoords(axis, coord, scale, calendar) {\n return coord.map(function(x) {\n return axis.d2l(x, 0, calendar) * scale;\n });\n }\n var positions = zip3(\n toDataCoords(layout.xaxis, data._meshX, scene.dataScale[0], data.xcalendar),\n toDataCoords(layout.yaxis, data._meshY, scene.dataScale[1], data.ycalendar),\n toDataCoords(layout.zaxis, data._meshZ, scene.dataScale[2], data.zcalendar)\n );\n var cells = zip3(data._meshI, data._meshJ, data._meshK);\n var config = {\n positions,\n cells,\n lightPosition: [data.lightposition.x, data.lightposition.y, data.lightposition.z],\n ambient: data.lighting.ambient,\n diffuse: data.lighting.diffuse,\n specular: data.lighting.specular,\n roughness: data.lighting.roughness,\n fresnel: data.lighting.fresnel,\n vertexNormalsEpsilon: data.lighting.vertexnormalsepsilon,\n faceNormalsEpsilon: data.lighting.facenormalsepsilon,\n opacity: data.opacity,\n contourEnable: data.contour.show,\n contourColor: str2RgbaArray(data.contour.color).slice(0, 3),\n contourWidth: data.contour.width,\n useFacetNormals: data.flatshading\n };\n var cOpts = extractOpts(data);\n config.vertexIntensity = data._meshIntensity;\n config.vertexIntensityBounds = [cOpts.min, cOpts.max];\n config.colormap = parseColorScale(data);\n this.mesh.update(config);\n };\n proto.dispose = function() {\n this.scene.glplot.remove(this.mesh);\n this.mesh.dispose();\n };\n var GRID_TYPES = [\"xyz\", \"xzy\", \"yxz\", \"yzx\", \"zxy\", \"zyx\"];\n function generateIsoMeshes(data) {\n data._meshI = [];\n data._meshJ = [];\n data._meshK = [];\n var showSurface = data.surface.show;\n var showSpaceframe = data.spaceframe.show;\n var surfaceFill = data.surface.fill;\n var spaceframeFill = data.spaceframe.fill;\n var drawingSurface = false;\n var drawingSpaceframe = false;\n var numFaces = 0;\n var numVertices;\n var beginVertextLength;\n var Xs = data._Xs;\n var Ys = data._Ys;\n var Zs = data._Zs;\n var width = Xs.length;\n var height = Ys.length;\n var depth = Zs.length;\n var filled = GRID_TYPES.indexOf(data._gridFill.replace(/-/g, \"\").replace(/\\+/g, \"\"));\n var getIndex = function(i, j, k) {\n switch (filled) {\n case 5:\n return k + depth * j + depth * height * i;\n case 4:\n return k + depth * i + depth * width * j;\n case 3:\n return j + height * k + height * depth * i;\n case 2:\n return j + height * i + height * width * k;\n case 1:\n return i + width * k + width * depth * j;\n default:\n return i + width * j + width * height * k;\n }\n };\n var minValues = data._minValues;\n var maxValues = data._maxValues;\n var vMin = data._vMin;\n var vMax = data._vMax;\n var allXs;\n var allYs;\n var allZs;\n var allVs;\n function findVertexId(x, y, z) {\n var len = allVs.length;\n for (var f = beginVertextLength; f < len; f++) {\n if (x === allXs[f] && y === allYs[f] && z === allZs[f]) {\n return f;\n }\n }\n return -1;\n }\n function beginGroup() {\n beginVertextLength = numVertices;\n }\n function emptyVertices() {\n allXs = [];\n allYs = [];\n allZs = [];\n allVs = [];\n numVertices = 0;\n beginGroup();\n }\n function addVertex(x, y, z, v) {\n allXs.push(x);\n allYs.push(y);\n allZs.push(z);\n allVs.push(v);\n numVertices++;\n return numVertices - 1;\n }\n function addFace(a, b, c) {\n data._meshI.push(a);\n data._meshJ.push(b);\n data._meshK.push(c);\n numFaces++;\n return numFaces - 1;\n }\n function getCenter(A2, B2, C2) {\n var M = [];\n for (var i = 0; i < A2.length; i++) {\n M[i] = (A2[i] + B2[i] + C2[i]) / 3;\n }\n return M;\n }\n function getBetween(A2, B2, r) {\n var M = [];\n for (var i = 0; i < A2.length; i++) {\n M[i] = A2[i] * (1 - r) + r * B2[i];\n }\n return M;\n }\n var activeFill;\n function setFill(fill) {\n activeFill = fill;\n }\n function createOpenTri(xyzv, abc) {\n var A2 = xyzv[0];\n var B2 = xyzv[1];\n var C2 = xyzv[2];\n var G = getCenter(A2, B2, C2);\n var r = Math.sqrt(1 - activeFill);\n var p1 = getBetween(G, A2, r);\n var p2 = getBetween(G, B2, r);\n var p3 = getBetween(G, C2, r);\n var a = abc[0];\n var b = abc[1];\n var c = abc[2];\n return {\n xyzv: [\n [A2, B2, p2],\n [p2, p1, A2],\n [B2, C2, p3],\n [p3, p2, B2],\n [C2, A2, p1],\n [p1, p3, C2]\n ],\n abc: [\n [a, b, -1],\n [-1, -1, a],\n [b, c, -1],\n [-1, -1, b],\n [c, a, -1],\n [-1, -1, c]\n ]\n };\n }\n function styleIncludes(style, char) {\n if (style === \"all\" || style === null) return true;\n return style.indexOf(char) > -1;\n }\n function mapValue(style, value) {\n if (style === null) return value;\n return style;\n }\n function drawTri(style, xyzv, abc) {\n beginGroup();\n var allXYZVs = [xyzv];\n var allABCs = [abc];\n if (activeFill >= 1) {\n allXYZVs = [xyzv];\n allABCs = [abc];\n } else if (activeFill > 0) {\n var openTri = createOpenTri(xyzv, abc);\n allXYZVs = openTri.xyzv;\n allABCs = openTri.abc;\n }\n for (var f = 0; f < allXYZVs.length; f++) {\n xyzv = allXYZVs[f];\n abc = allABCs[f];\n var pnts = [];\n for (var i = 0; i < 3; i++) {\n var x = xyzv[i][0];\n var y = xyzv[i][1];\n var z = xyzv[i][2];\n var v = xyzv[i][3];\n var id = abc[i] > -1 ? abc[i] : findVertexId(x, y, z);\n if (id > -1) {\n pnts[i] = id;\n } else {\n pnts[i] = addVertex(x, y, z, mapValue(style, v));\n }\n }\n addFace(pnts[0], pnts[1], pnts[2]);\n }\n }\n function drawQuad(style, xyzv, abcd) {\n var makeTri = function(i, j, k) {\n drawTri(style, [xyzv[i], xyzv[j], xyzv[k]], [abcd[i], abcd[j], abcd[k]]);\n };\n makeTri(0, 1, 2);\n makeTri(2, 3, 0);\n }\n function drawTetra(style, xyzv, abcd) {\n var makeTri = function(i, j, k) {\n drawTri(style, [xyzv[i], xyzv[j], xyzv[k]], [abcd[i], abcd[j], abcd[k]]);\n };\n makeTri(0, 1, 2);\n makeTri(3, 0, 1);\n makeTri(2, 3, 0);\n makeTri(1, 2, 3);\n }\n function calcIntersection(pointOut, pointIn, min, max) {\n var value = pointOut[3];\n if (value < min) value = min;\n if (value > max) value = max;\n var ratio = (pointOut[3] - value) / (pointOut[3] - pointIn[3] + 1e-9);\n var result = [];\n for (var s = 0; s < 4; s++) {\n result[s] = (1 - ratio) * pointOut[s] + ratio * pointIn[s];\n }\n return result;\n }\n function inRange(value, min, max) {\n return value >= min && value <= max;\n }\n function almostInFinalRange(value) {\n var vErr = 1e-3 * (vMax - vMin);\n return value >= vMin - vErr && value <= vMax + vErr;\n }\n function getXYZV(indecies) {\n var xyzv = [];\n for (var q = 0; q < 4; q++) {\n var index = indecies[q];\n xyzv.push(\n [\n data._x[index],\n data._y[index],\n data._z[index],\n data._value[index]\n ]\n );\n }\n return xyzv;\n }\n var MAX_PASS = 3;\n function tryCreateTri(style, xyzv, abc, min, max, nPass) {\n if (!nPass) nPass = 1;\n abc = [-1, -1, -1];\n var result = false;\n var ok = [\n inRange(xyzv[0][3], min, max),\n inRange(xyzv[1][3], min, max),\n inRange(xyzv[2][3], min, max)\n ];\n if (!ok[0] && !ok[1] && !ok[2]) {\n return false;\n }\n var tryDrawTri = function(style2, xyzv2, abc2) {\n if (\n // we check here if the points are in `real` iso-min/max range\n almostInFinalRange(xyzv2[0][3]) && almostInFinalRange(xyzv2[1][3]) && almostInFinalRange(xyzv2[2][3])\n ) {\n drawTri(style2, xyzv2, abc2);\n return true;\n } else if (nPass < MAX_PASS) {\n return tryCreateTri(style2, xyzv2, abc2, vMin, vMax, ++nPass);\n }\n return false;\n };\n if (ok[0] && ok[1] && ok[2]) {\n return tryDrawTri(style, xyzv, abc) || result;\n }\n var interpolated = false;\n [\n [0, 1, 2],\n [2, 0, 1],\n [1, 2, 0]\n ].forEach(function(e) {\n if (ok[e[0]] && ok[e[1]] && !ok[e[2]]) {\n var A2 = xyzv[e[0]];\n var B2 = xyzv[e[1]];\n var C2 = xyzv[e[2]];\n var p1 = calcIntersection(C2, A2, min, max);\n var p2 = calcIntersection(C2, B2, min, max);\n result = tryDrawTri(style, [p2, p1, A2], [-1, -1, abc[e[0]]]) || result;\n result = tryDrawTri(style, [A2, B2, p2], [abc[e[0]], abc[e[1]], -1]) || result;\n interpolated = true;\n }\n });\n if (interpolated) return result;\n [\n [0, 1, 2],\n [1, 2, 0],\n [2, 0, 1]\n ].forEach(function(e) {\n if (ok[e[0]] && !ok[e[1]] && !ok[e[2]]) {\n var A2 = xyzv[e[0]];\n var B2 = xyzv[e[1]];\n var C2 = xyzv[e[2]];\n var p1 = calcIntersection(B2, A2, min, max);\n var p2 = calcIntersection(C2, A2, min, max);\n result = tryDrawTri(style, [p2, p1, A2], [-1, -1, abc[e[0]]]) || result;\n interpolated = true;\n }\n });\n return result;\n }\n function tryCreateTetra(style, abcd, min, max) {\n var result = false;\n var xyzv = getXYZV(abcd);\n var ok = [\n inRange(xyzv[0][3], min, max),\n inRange(xyzv[1][3], min, max),\n inRange(xyzv[2][3], min, max),\n inRange(xyzv[3][3], min, max)\n ];\n if (!ok[0] && !ok[1] && !ok[2] && !ok[3]) {\n return result;\n }\n if (ok[0] && ok[1] && ok[2] && ok[3]) {\n if (drawingSpaceframe) {\n result = drawTetra(style, xyzv, abcd) || result;\n }\n return result;\n }\n var interpolated = false;\n [\n [0, 1, 2, 3],\n [3, 0, 1, 2],\n [2, 3, 0, 1],\n [1, 2, 3, 0]\n ].forEach(function(e) {\n if (ok[e[0]] && ok[e[1]] && ok[e[2]] && !ok[e[3]]) {\n var A2 = xyzv[e[0]];\n var B2 = xyzv[e[1]];\n var C2 = xyzv[e[2]];\n var D2 = xyzv[e[3]];\n if (drawingSpaceframe) {\n result = drawTri(style, [A2, B2, C2], [abcd[e[0]], abcd[e[1]], abcd[e[2]]]) || result;\n } else {\n var p1 = calcIntersection(D2, A2, min, max);\n var p2 = calcIntersection(D2, B2, min, max);\n var p3 = calcIntersection(D2, C2, min, max);\n result = drawTri(null, [p1, p2, p3], [-1, -1, -1]) || result;\n }\n interpolated = true;\n }\n });\n if (interpolated) return result;\n [\n [0, 1, 2, 3],\n [1, 2, 3, 0],\n [2, 3, 0, 1],\n [3, 0, 1, 2],\n [0, 2, 3, 1],\n [1, 3, 2, 0]\n ].forEach(function(e) {\n if (ok[e[0]] && ok[e[1]] && !ok[e[2]] && !ok[e[3]]) {\n var A2 = xyzv[e[0]];\n var B2 = xyzv[e[1]];\n var C2 = xyzv[e[2]];\n var D2 = xyzv[e[3]];\n var p1 = calcIntersection(C2, A2, min, max);\n var p2 = calcIntersection(C2, B2, min, max);\n var p3 = calcIntersection(D2, B2, min, max);\n var p4 = calcIntersection(D2, A2, min, max);\n if (drawingSpaceframe) {\n result = drawTri(style, [A2, p4, p1], [abcd[e[0]], -1, -1]) || result;\n result = drawTri(style, [B2, p2, p3], [abcd[e[1]], -1, -1]) || result;\n } else {\n result = drawQuad(null, [p1, p2, p3, p4], [-1, -1, -1, -1]) || result;\n }\n interpolated = true;\n }\n });\n if (interpolated) return result;\n [\n [0, 1, 2, 3],\n [1, 2, 3, 0],\n [2, 3, 0, 1],\n [3, 0, 1, 2]\n ].forEach(function(e) {\n if (ok[e[0]] && !ok[e[1]] && !ok[e[2]] && !ok[e[3]]) {\n var A2 = xyzv[e[0]];\n var B2 = xyzv[e[1]];\n var C2 = xyzv[e[2]];\n var D2 = xyzv[e[3]];\n var p1 = calcIntersection(B2, A2, min, max);\n var p2 = calcIntersection(C2, A2, min, max);\n var p3 = calcIntersection(D2, A2, min, max);\n if (drawingSpaceframe) {\n result = drawTri(style, [A2, p1, p2], [abcd[e[0]], -1, -1]) || result;\n result = drawTri(style, [A2, p2, p3], [abcd[e[0]], -1, -1]) || result;\n result = drawTri(style, [A2, p3, p1], [abcd[e[0]], -1, -1]) || result;\n } else {\n result = drawTri(null, [p1, p2, p3], [-1, -1, -1]) || result;\n }\n interpolated = true;\n }\n });\n return result;\n }\n function addCube(style, p000, p001, p010, p011, p100, p101, p110, p111, min, max) {\n var result = false;\n if (drawingSurface) {\n if (styleIncludes(style, \"A\")) {\n result = tryCreateTetra(null, [p000, p001, p010, p100], min, max) || result;\n }\n if (styleIncludes(style, \"B\")) {\n result = tryCreateTetra(null, [p001, p010, p011, p111], min, max) || result;\n }\n if (styleIncludes(style, \"C\")) {\n result = tryCreateTetra(null, [p001, p100, p101, p111], min, max) || result;\n }\n if (styleIncludes(style, \"D\")) {\n result = tryCreateTetra(null, [p010, p100, p110, p111], min, max) || result;\n }\n if (styleIncludes(style, \"E\")) {\n result = tryCreateTetra(null, [p001, p010, p100, p111], min, max) || result;\n }\n }\n if (drawingSpaceframe) {\n result = tryCreateTetra(style, [p001, p010, p100, p111], min, max) || result;\n }\n return result;\n }\n function addRect(style, a, b, c, d, min, max, previousResult) {\n return [\n previousResult[0] === true ? true : tryCreateTri(style, getXYZV([a, b, c]), [a, b, c], min, max),\n previousResult[1] === true ? true : tryCreateTri(style, getXYZV([c, d, a]), [c, d, a], min, max)\n ];\n }\n function begin2dCell(style, p00, p01, p10, p11, min, max, isEven, previousResult) {\n if (isEven) {\n return addRect(style, p00, p01, p11, p10, min, max, previousResult);\n } else {\n return addRect(style, p01, p11, p10, p00, min, max, previousResult);\n }\n }\n function beginSection(style, i, j, k, min, max, distRatios) {\n var result = false;\n var A2, B2, C2, D2;\n var makeSection = function() {\n result = tryCreateTri(style, [A2, B2, C2], [-1, -1, -1], min, max) || result;\n result = tryCreateTri(style, [C2, D2, A2], [-1, -1, -1], min, max) || result;\n };\n var rX = distRatios[0];\n var rY = distRatios[1];\n var rZ = distRatios[2];\n if (rX) {\n A2 = getBetween(getXYZV([getIndex(i, j - 0, k - 0)])[0], getXYZV([getIndex(i - 1, j - 0, k - 0)])[0], rX);\n B2 = getBetween(getXYZV([getIndex(i, j - 0, k - 1)])[0], getXYZV([getIndex(i - 1, j - 0, k - 1)])[0], rX);\n C2 = getBetween(getXYZV([getIndex(i, j - 1, k - 1)])[0], getXYZV([getIndex(i - 1, j - 1, k - 1)])[0], rX);\n D2 = getBetween(getXYZV([getIndex(i, j - 1, k - 0)])[0], getXYZV([getIndex(i - 1, j - 1, k - 0)])[0], rX);\n makeSection();\n }\n if (rY) {\n A2 = getBetween(getXYZV([getIndex(i - 0, j, k - 0)])[0], getXYZV([getIndex(i - 0, j - 1, k - 0)])[0], rY);\n B2 = getBetween(getXYZV([getIndex(i - 0, j, k - 1)])[0], getXYZV([getIndex(i - 0, j - 1, k - 1)])[0], rY);\n C2 = getBetween(getXYZV([getIndex(i - 1, j, k - 1)])[0], getXYZV([getIndex(i - 1, j - 1, k - 1)])[0], rY);\n D2 = getBetween(getXYZV([getIndex(i - 1, j, k - 0)])[0], getXYZV([getIndex(i - 1, j - 1, k - 0)])[0], rY);\n makeSection();\n }\n if (rZ) {\n A2 = getBetween(getXYZV([getIndex(i - 0, j - 0, k)])[0], getXYZV([getIndex(i - 0, j - 0, k - 1)])[0], rZ);\n B2 = getBetween(getXYZV([getIndex(i - 0, j - 1, k)])[0], getXYZV([getIndex(i - 0, j - 1, k - 1)])[0], rZ);\n C2 = getBetween(getXYZV([getIndex(i - 1, j - 1, k)])[0], getXYZV([getIndex(i - 1, j - 1, k - 1)])[0], rZ);\n D2 = getBetween(getXYZV([getIndex(i - 1, j - 0, k)])[0], getXYZV([getIndex(i - 1, j - 0, k - 1)])[0], rZ);\n makeSection();\n }\n return result;\n }\n function begin3dCell(style, p000, p001, p010, p011, p100, p101, p110, p111, min, max, isEven) {\n var cellStyle = style;\n if (isEven) {\n if (drawingSurface && style === \"even\") cellStyle = null;\n return addCube(cellStyle, p000, p001, p010, p011, p100, p101, p110, p111, min, max);\n } else {\n if (drawingSurface && style === \"odd\") cellStyle = null;\n return addCube(cellStyle, p111, p110, p101, p100, p011, p010, p001, p000, min, max);\n }\n }\n function draw2dX(style, items, min, max, previousResult) {\n var result = [];\n var n = 0;\n for (var q = 0; q < items.length; q++) {\n var i = items[q];\n for (var k = 1; k < depth; k++) {\n for (var j = 1; j < height; j++) {\n result.push(\n begin2dCell(\n style,\n getIndex(i, j - 1, k - 1),\n getIndex(i, j - 1, k),\n getIndex(i, j, k - 1),\n getIndex(i, j, k),\n min,\n max,\n (i + j + k) % 2,\n previousResult && previousResult[n] ? previousResult[n] : []\n )\n );\n n++;\n }\n }\n }\n return result;\n }\n function draw2dY(style, items, min, max, previousResult) {\n var result = [];\n var n = 0;\n for (var q = 0; q < items.length; q++) {\n var j = items[q];\n for (var i = 1; i < width; i++) {\n for (var k = 1; k < depth; k++) {\n result.push(\n begin2dCell(\n style,\n getIndex(i - 1, j, k - 1),\n getIndex(i, j, k - 1),\n getIndex(i - 1, j, k),\n getIndex(i, j, k),\n min,\n max,\n (i + j + k) % 2,\n previousResult && previousResult[n] ? previousResult[n] : []\n )\n );\n n++;\n }\n }\n }\n return result;\n }\n function draw2dZ(style, items, min, max, previousResult) {\n var result = [];\n var n = 0;\n for (var q = 0; q < items.length; q++) {\n var k = items[q];\n for (var j = 1; j < height; j++) {\n for (var i = 1; i < width; i++) {\n result.push(\n begin2dCell(\n style,\n getIndex(i - 1, j - 1, k),\n getIndex(i - 1, j, k),\n getIndex(i, j - 1, k),\n getIndex(i, j, k),\n min,\n max,\n (i + j + k) % 2,\n previousResult && previousResult[n] ? previousResult[n] : []\n )\n );\n n++;\n }\n }\n }\n return result;\n }\n function draw3d(style, min, max) {\n for (var k = 1; k < depth; k++) {\n for (var j = 1; j < height; j++) {\n for (var i = 1; i < width; i++) {\n begin3dCell(\n style,\n getIndex(i - 1, j - 1, k - 1),\n getIndex(i - 1, j - 1, k),\n getIndex(i - 1, j, k - 1),\n getIndex(i - 1, j, k),\n getIndex(i, j - 1, k - 1),\n getIndex(i, j - 1, k),\n getIndex(i, j, k - 1),\n getIndex(i, j, k),\n min,\n max,\n (i + j + k) % 2\n );\n }\n }\n }\n }\n function drawSpaceframe(style, min, max) {\n drawingSpaceframe = true;\n draw3d(style, min, max);\n drawingSpaceframe = false;\n }\n function drawSurface(style, min, max) {\n drawingSurface = true;\n draw3d(style, min, max);\n drawingSurface = false;\n }\n function drawSectionX(style, items, min, max, distRatios, previousResult) {\n var result = [];\n var n = 0;\n for (var q = 0; q < items.length; q++) {\n var i = items[q];\n for (var k = 1; k < depth; k++) {\n for (var j = 1; j < height; j++) {\n result.push(\n beginSection(\n style,\n i,\n j,\n k,\n min,\n max,\n distRatios[q],\n previousResult && previousResult[n] ? previousResult[n] : []\n )\n );\n n++;\n }\n }\n }\n return result;\n }\n function drawSectionY(style, items, min, max, distRatios, previousResult) {\n var result = [];\n var n = 0;\n for (var q = 0; q < items.length; q++) {\n var j = items[q];\n for (var i = 1; i < width; i++) {\n for (var k = 1; k < depth; k++) {\n result.push(\n beginSection(\n style,\n i,\n j,\n k,\n min,\n max,\n distRatios[q],\n previousResult && previousResult[n] ? previousResult[n] : []\n )\n );\n n++;\n }\n }\n }\n return result;\n }\n function drawSectionZ(style, items, min, max, distRatios, previousResult) {\n var result = [];\n var n = 0;\n for (var q = 0; q < items.length; q++) {\n var k = items[q];\n for (var j = 1; j < height; j++) {\n for (var i = 1; i < width; i++) {\n result.push(\n beginSection(\n style,\n i,\n j,\n k,\n min,\n max,\n distRatios[q],\n previousResult && previousResult[n] ? previousResult[n] : []\n )\n );\n n++;\n }\n }\n }\n return result;\n }\n function createRange(a, b) {\n var range = [];\n for (var q = a; q < b; q++) {\n range.push(q);\n }\n return range;\n }\n function insertGridPoints() {\n for (var i = 0; i < width; i++) {\n for (var j = 0; j < height; j++) {\n for (var k = 0; k < depth; k++) {\n var index = getIndex(i, j, k);\n addVertex(\n data._x[index],\n data._y[index],\n data._z[index],\n data._value[index]\n );\n }\n }\n }\n }\n function drawAll() {\n emptyVertices();\n insertGridPoints();\n var activeStyle = null;\n if (showSpaceframe && spaceframeFill) {\n setFill(spaceframeFill);\n drawSpaceframe(activeStyle, vMin, vMax);\n }\n if (showSurface && surfaceFill) {\n setFill(surfaceFill);\n var surfacePattern = data.surface.pattern;\n var surfaceCount = data.surface.count;\n for (var q = 0; q < surfaceCount; q++) {\n var ratio = surfaceCount === 1 ? 0.5 : q / (surfaceCount - 1);\n var level = (1 - ratio) * vMin + ratio * vMax;\n var d1 = Math.abs(level - minValues);\n var d2 = Math.abs(level - maxValues);\n var ranges = d1 > d2 ? [minValues, level] : [level, maxValues];\n drawSurface(surfacePattern, ranges[0], ranges[1]);\n }\n }\n var setupMinMax = [\n [Math.min(vMin, maxValues), Math.max(vMin, maxValues)],\n [Math.min(minValues, vMax), Math.max(minValues, vMax)]\n ];\n [\"x\", \"y\", \"z\"].forEach(function(e) {\n var preRes = [];\n for (var s = 0; s < setupMinMax.length; s++) {\n var count = 0;\n var activeMin = setupMinMax[s][0];\n var activeMax = setupMinMax[s][1];\n var slice = data.slices[e];\n if (slice.show && slice.fill) {\n setFill(slice.fill);\n var exactIndices = [];\n var ceilIndices = [];\n var distRatios = [];\n if (slice.locations.length) {\n for (var q2 = 0; q2 < slice.locations.length; q2++) {\n var near = findNearestOnAxis(\n slice.locations[q2],\n e === \"x\" ? Xs : e === \"y\" ? Ys : Zs\n );\n if (near.distRatio === 0) {\n exactIndices.push(near.id);\n } else if (near.id > 0) {\n ceilIndices.push(near.id);\n if (e === \"x\") {\n distRatios.push([near.distRatio, 0, 0]);\n } else if (e === \"y\") {\n distRatios.push([0, near.distRatio, 0]);\n } else {\n distRatios.push([0, 0, near.distRatio]);\n }\n }\n }\n } else {\n if (e === \"x\") {\n exactIndices = createRange(1, width - 1);\n } else if (e === \"y\") {\n exactIndices = createRange(1, height - 1);\n } else {\n exactIndices = createRange(1, depth - 1);\n }\n }\n if (ceilIndices.length > 0) {\n if (e === \"x\") {\n preRes[count] = drawSectionX(activeStyle, ceilIndices, activeMin, activeMax, distRatios, preRes[count]);\n } else if (e === \"y\") {\n preRes[count] = drawSectionY(activeStyle, ceilIndices, activeMin, activeMax, distRatios, preRes[count]);\n } else {\n preRes[count] = drawSectionZ(activeStyle, ceilIndices, activeMin, activeMax, distRatios, preRes[count]);\n }\n count++;\n }\n if (exactIndices.length > 0) {\n if (e === \"x\") {\n preRes[count] = draw2dX(activeStyle, exactIndices, activeMin, activeMax, preRes[count]);\n } else if (e === \"y\") {\n preRes[count] = draw2dY(activeStyle, exactIndices, activeMin, activeMax, preRes[count]);\n } else {\n preRes[count] = draw2dZ(activeStyle, exactIndices, activeMin, activeMax, preRes[count]);\n }\n count++;\n }\n }\n var cap = data.caps[e];\n if (cap.show && cap.fill) {\n setFill(cap.fill);\n if (e === \"x\") {\n preRes[count] = draw2dX(activeStyle, [0, width - 1], activeMin, activeMax, preRes[count]);\n } else if (e === \"y\") {\n preRes[count] = draw2dY(activeStyle, [0, height - 1], activeMin, activeMax, preRes[count]);\n } else {\n preRes[count] = draw2dZ(activeStyle, [0, depth - 1], activeMin, activeMax, preRes[count]);\n }\n count++;\n }\n }\n });\n if (numFaces === 0) {\n emptyVertices();\n }\n data._meshX = allXs;\n data._meshY = allYs;\n data._meshZ = allZs;\n data._meshIntensity = allVs;\n data._Xs = Xs;\n data._Ys = Ys;\n data._Zs = Zs;\n }\n drawAll();\n return data;\n }\n function createIsosurfaceTrace(scene, data) {\n var gl2 = scene.glplot.gl;\n var mesh = createMesh({ gl: gl2 });\n var result = new IsosurfaceTrace(scene, mesh, data.uid);\n mesh._trace = result;\n result.update(data);\n scene.glplot.add(mesh);\n return result;\n }\n module.exports = {\n findNearestOnAxis,\n generateIsoMeshes,\n createIsosurfaceTrace\n };\n }\n });\n\n // src/traces/isosurface/index.js\n var require_isosurface = __commonJS({\n \"src/traces/isosurface/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes44(),\n supplyDefaults: require_defaults39().supplyDefaults,\n calc: require_calc24(),\n colorbar: {\n min: \"cmin\",\n max: \"cmax\"\n },\n plot: require_convert5().createIsosurfaceTrace,\n moduleType: \"trace\",\n name: \"isosurface\",\n basePlotModule: require_gl3d(),\n categories: [\"gl3d\", \"showLegend\"],\n meta: {}\n };\n }\n });\n\n // lib/isosurface.js\n var require_isosurface2 = __commonJS({\n \"lib/isosurface.js\"(exports, module) {\n \"use strict\";\n module.exports = require_isosurface();\n }\n });\n\n // src/traces/volume/attributes.js\n var require_attributes45 = __commonJS({\n \"src/traces/volume/attributes.js\"(exports, module) {\n \"use strict\";\n var colorScaleAttrs = require_attributes8();\n var isosurfaceAttrs = require_attributes44();\n var surfaceAttrs = require_attributes42();\n var baseAttrs = require_attributes2();\n var extendFlat = require_extend().extendFlat;\n var overrideAll = require_edit_types().overrideAll;\n var attrs = module.exports = overrideAll(extendFlat(\n {\n x: isosurfaceAttrs.x,\n y: isosurfaceAttrs.y,\n z: isosurfaceAttrs.z,\n value: isosurfaceAttrs.value,\n isomin: isosurfaceAttrs.isomin,\n isomax: isosurfaceAttrs.isomax,\n surface: isosurfaceAttrs.surface,\n spaceframe: {\n show: {\n valType: \"boolean\",\n dflt: false\n },\n fill: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 1\n }\n },\n slices: isosurfaceAttrs.slices,\n caps: isosurfaceAttrs.caps,\n text: isosurfaceAttrs.text,\n hovertext: isosurfaceAttrs.hovertext,\n xhoverformat: isosurfaceAttrs.xhoverformat,\n yhoverformat: isosurfaceAttrs.yhoverformat,\n zhoverformat: isosurfaceAttrs.zhoverformat,\n valuehoverformat: isosurfaceAttrs.valuehoverformat,\n hovertemplate: isosurfaceAttrs.hovertemplate\n },\n colorScaleAttrs(\"\", {\n colorAttr: \"`value`\",\n showScaleDflt: true,\n editTypeOverride: \"calc\"\n }),\n {\n colorbar: isosurfaceAttrs.colorbar,\n opacity: isosurfaceAttrs.opacity,\n opacityscale: surfaceAttrs.opacityscale,\n lightposition: isosurfaceAttrs.lightposition,\n lighting: isosurfaceAttrs.lighting,\n flatshading: isosurfaceAttrs.flatshading,\n contour: isosurfaceAttrs.contour,\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo),\n showlegend: extendFlat({}, baseAttrs.showlegend, { dflt: false })\n }\n ), \"calc\", \"nested\");\n attrs.x.editType = attrs.y.editType = attrs.z.editType = attrs.value.editType = \"calc+clearAxisTypes\";\n }\n });\n\n // src/traces/volume/defaults.js\n var require_defaults40 = __commonJS({\n \"src/traces/volume/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var attributes = require_attributes45();\n var supplyIsoDefaults = require_defaults39().supplyIsoDefaults;\n var opacityscaleDefaults = require_defaults38().opacityscaleDefaults;\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n supplyIsoDefaults(traceIn, traceOut, defaultColor, layout, coerce);\n opacityscaleDefaults(traceIn, traceOut, layout, coerce);\n };\n }\n });\n\n // src/traces/volume/convert.js\n var require_convert6 = __commonJS({\n \"src/traces/volume/convert.js\"(exports, module) {\n \"use strict\";\n var createMesh = require_stackgl_modules().gl_mesh3d;\n var parseColorScale = require_gl_format_color().parseColorScale;\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n var str2RgbaArray = require_str2rgbarray();\n var extractOpts = require_colorscale().extractOpts;\n var zip3 = require_zip3();\n var findNearestOnAxis = require_convert5().findNearestOnAxis;\n var generateIsoMeshes = require_convert5().generateIsoMeshes;\n function VolumeTrace(scene, mesh, uid) {\n this.scene = scene;\n this.uid = uid;\n this.mesh = mesh;\n this.name = \"\";\n this.data = null;\n this.showContour = false;\n }\n var proto = VolumeTrace.prototype;\n proto.handlePick = function(selection) {\n if (selection.object === this.mesh) {\n var rawId = selection.data.index;\n var x = this.data._meshX[rawId];\n var y = this.data._meshY[rawId];\n var z = this.data._meshZ[rawId];\n var height = this.data._Ys.length;\n var depth = this.data._Zs.length;\n var i = findNearestOnAxis(x, this.data._Xs).id;\n var j = findNearestOnAxis(y, this.data._Ys).id;\n var k = findNearestOnAxis(z, this.data._Zs).id;\n var selectIndex = selection.index = k + depth * j + depth * height * i;\n selection.traceCoordinate = [\n this.data._meshX[selectIndex],\n this.data._meshY[selectIndex],\n this.data._meshZ[selectIndex],\n this.data._value[selectIndex]\n ];\n var text = this.data.hovertext || this.data.text;\n if (isArrayOrTypedArray(text) && text[selectIndex] !== void 0) {\n selection.textLabel = text[selectIndex];\n } else if (text) {\n selection.textLabel = text;\n }\n return true;\n }\n };\n proto.update = function(data) {\n var scene = this.scene;\n var layout = scene.fullSceneLayout;\n this.data = generateIsoMeshes(data);\n function toDataCoords(axis, coord, scale, calendar) {\n return coord.map(function(x) {\n return axis.d2l(x, 0, calendar) * scale;\n });\n }\n var positions = zip3(\n toDataCoords(layout.xaxis, data._meshX, scene.dataScale[0], data.xcalendar),\n toDataCoords(layout.yaxis, data._meshY, scene.dataScale[1], data.ycalendar),\n toDataCoords(layout.zaxis, data._meshZ, scene.dataScale[2], data.zcalendar)\n );\n var cells = zip3(data._meshI, data._meshJ, data._meshK);\n var config = {\n positions,\n cells,\n lightPosition: [data.lightposition.x, data.lightposition.y, data.lightposition.z],\n ambient: data.lighting.ambient,\n diffuse: data.lighting.diffuse,\n specular: data.lighting.specular,\n roughness: data.lighting.roughness,\n fresnel: data.lighting.fresnel,\n vertexNormalsEpsilon: data.lighting.vertexnormalsepsilon,\n faceNormalsEpsilon: data.lighting.facenormalsepsilon,\n opacity: data.opacity,\n opacityscale: data.opacityscale,\n contourEnable: data.contour.show,\n contourColor: str2RgbaArray(data.contour.color).slice(0, 3),\n contourWidth: data.contour.width,\n useFacetNormals: data.flatshading\n };\n var cOpts = extractOpts(data);\n config.vertexIntensity = data._meshIntensity;\n config.vertexIntensityBounds = [cOpts.min, cOpts.max];\n config.colormap = parseColorScale(data);\n this.mesh.update(config);\n };\n proto.dispose = function() {\n this.scene.glplot.remove(this.mesh);\n this.mesh.dispose();\n };\n function createVolumeTrace(scene, data) {\n var gl2 = scene.glplot.gl;\n var mesh = createMesh({ gl: gl2 });\n var result = new VolumeTrace(scene, mesh, data.uid);\n mesh._trace = result;\n result.update(data);\n scene.glplot.add(mesh);\n return result;\n }\n module.exports = createVolumeTrace;\n }\n });\n\n // src/traces/volume/index.js\n var require_volume = __commonJS({\n \"src/traces/volume/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes45(),\n supplyDefaults: require_defaults40(),\n calc: require_calc24(),\n colorbar: {\n min: \"cmin\",\n max: \"cmax\"\n },\n plot: require_convert6(),\n moduleType: \"trace\",\n name: \"volume\",\n basePlotModule: require_gl3d(),\n categories: [\"gl3d\", \"showLegend\"],\n meta: {}\n };\n }\n });\n\n // lib/volume.js\n var require_volume2 = __commonJS({\n \"lib/volume.js\"(exports, module) {\n \"use strict\";\n module.exports = require_volume();\n }\n });\n\n // src/traces/mesh3d/defaults.js\n var require_defaults41 = __commonJS({\n \"src/traces/mesh3d/defaults.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var Lib = require_lib();\n var colorscaleDefaults = require_defaults2();\n var attributes = require_attributes43();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n function readComponents(array) {\n var ret = array.map(function(attr) {\n var result = coerce(attr);\n if (result && Lib.isArrayOrTypedArray(result)) return result;\n return null;\n });\n return ret.every(function(x) {\n return x && x.length === ret[0].length;\n }) && ret;\n }\n var coords = readComponents([\"x\", \"y\", \"z\"]);\n if (!coords) {\n traceOut.visible = false;\n return;\n }\n readComponents([\"i\", \"j\", \"k\"]);\n if (traceOut.i && (!traceOut.j || !traceOut.k) || traceOut.j && (!traceOut.k || !traceOut.i) || traceOut.k && (!traceOut.i || !traceOut.j)) {\n traceOut.visible = false;\n return;\n }\n var handleCalendarDefaults = Registry.getComponentMethod(\"calendars\", \"handleTraceDefaults\");\n handleCalendarDefaults(traceIn, traceOut, [\"x\", \"y\", \"z\"], layout);\n [\n \"lighting.ambient\",\n \"lighting.diffuse\",\n \"lighting.specular\",\n \"lighting.roughness\",\n \"lighting.fresnel\",\n \"lighting.vertexnormalsepsilon\",\n \"lighting.facenormalsepsilon\",\n \"lightposition.x\",\n \"lightposition.y\",\n \"lightposition.z\",\n \"flatshading\",\n \"alphahull\",\n \"delaunayaxis\",\n \"opacity\"\n ].forEach(function(x) {\n coerce(x);\n });\n var showContour = coerce(\"contour.show\");\n if (showContour) {\n coerce(\"contour.color\");\n coerce(\"contour.width\");\n }\n if (\"intensity\" in traceIn) {\n coerce(\"intensity\");\n coerce(\"intensitymode\");\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"\", cLetter: \"c\" });\n } else {\n traceOut.showscale = false;\n if (\"facecolor\" in traceIn) coerce(\"facecolor\");\n else if (\"vertexcolor\" in traceIn) coerce(\"vertexcolor\");\n else coerce(\"color\", defaultColor);\n }\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n coerce(\"zhoverformat\");\n traceOut._length = null;\n };\n }\n });\n\n // src/traces/mesh3d/calc.js\n var require_calc25 = __commonJS({\n \"src/traces/mesh3d/calc.js\"(exports, module) {\n \"use strict\";\n var colorscaleCalc = require_calc();\n module.exports = function calc(gd, trace) {\n if (trace.intensity) {\n colorscaleCalc(gd, trace, {\n vals: trace.intensity,\n containerStr: \"\",\n cLetter: \"c\"\n });\n }\n };\n }\n });\n\n // src/traces/mesh3d/convert.js\n var require_convert7 = __commonJS({\n \"src/traces/mesh3d/convert.js\"(exports, module) {\n \"use strict\";\n var createMesh = require_stackgl_modules().gl_mesh3d;\n var triangulate = require_stackgl_modules().delaunay_triangulate;\n var alphaShape = require_stackgl_modules().alpha_shape;\n var convexHull = require_stackgl_modules().convex_hull;\n var parseColorScale = require_gl_format_color().parseColorScale;\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n var str2RgbaArray = require_str2rgbarray();\n var extractOpts = require_colorscale().extractOpts;\n var zip3 = require_zip3();\n function Mesh3DTrace(scene, mesh, uid) {\n this.scene = scene;\n this.uid = uid;\n this.mesh = mesh;\n this.name = \"\";\n this.color = \"#fff\";\n this.data = null;\n this.showContour = false;\n }\n var proto = Mesh3DTrace.prototype;\n proto.handlePick = function(selection) {\n if (selection.object === this.mesh) {\n var selectIndex = selection.index = selection.data.index;\n if (selection.data._cellCenter) {\n selection.traceCoordinate = selection.data.dataCoordinate;\n } else {\n selection.traceCoordinate = [\n this.data.x[selectIndex],\n this.data.y[selectIndex],\n this.data.z[selectIndex]\n ];\n }\n var text = this.data.hovertext || this.data.text;\n if (isArrayOrTypedArray(text) && text[selectIndex] !== void 0) {\n selection.textLabel = text[selectIndex];\n } else if (text) {\n selection.textLabel = text;\n }\n return true;\n }\n };\n function parseColorArray(colors) {\n var b = [];\n var len = colors.length;\n for (var i = 0; i < len; i++) {\n b[i] = str2RgbaArray(colors[i]);\n }\n return b;\n }\n function toDataCoords(axis, coord, scale, calendar) {\n var b = [];\n var len = coord.length;\n for (var i = 0; i < len; i++) {\n b[i] = axis.d2l(coord[i], 0, calendar) * scale;\n }\n return b;\n }\n function toRoundIndex(a) {\n var b = [];\n var len = a.length;\n for (var i = 0; i < len; i++) {\n b[i] = Math.round(a[i]);\n }\n return b;\n }\n function delaunayCells(delaunayaxis, positions) {\n var d = [\"x\", \"y\", \"z\"].indexOf(delaunayaxis);\n var b = [];\n var len = positions.length;\n for (var i = 0; i < len; i++) {\n b[i] = [positions[i][(d + 1) % 3], positions[i][(d + 2) % 3]];\n }\n return triangulate(b);\n }\n function hasValidIndices(list, numVertices) {\n var len = list.length;\n for (var i = 0; i < len; i++) {\n if (list[i] <= -0.5 || list[i] >= numVertices - 0.5) {\n return false;\n }\n }\n return true;\n }\n proto.update = function(data) {\n var scene = this.scene;\n var layout = scene.fullSceneLayout;\n this.data = data;\n var numVertices = data.x.length;\n var positions = zip3(\n toDataCoords(layout.xaxis, data.x, scene.dataScale[0], data.xcalendar),\n toDataCoords(layout.yaxis, data.y, scene.dataScale[1], data.ycalendar),\n toDataCoords(layout.zaxis, data.z, scene.dataScale[2], data.zcalendar)\n );\n var cells;\n if (data.i && data.j && data.k) {\n if (data.i.length !== data.j.length || data.j.length !== data.k.length || !hasValidIndices(data.i, numVertices) || !hasValidIndices(data.j, numVertices) || !hasValidIndices(data.k, numVertices)) {\n return;\n }\n cells = zip3(\n toRoundIndex(data.i),\n toRoundIndex(data.j),\n toRoundIndex(data.k)\n );\n } else if (data.alphahull === 0) {\n cells = convexHull(positions);\n } else if (data.alphahull > 0) {\n cells = alphaShape(data.alphahull, positions);\n } else {\n cells = delaunayCells(data.delaunayaxis, positions);\n }\n var config = {\n positions,\n cells,\n lightPosition: [data.lightposition.x, data.lightposition.y, data.lightposition.z],\n ambient: data.lighting.ambient,\n diffuse: data.lighting.diffuse,\n specular: data.lighting.specular,\n roughness: data.lighting.roughness,\n fresnel: data.lighting.fresnel,\n vertexNormalsEpsilon: data.lighting.vertexnormalsepsilon,\n faceNormalsEpsilon: data.lighting.facenormalsepsilon,\n opacity: data.opacity,\n contourEnable: data.contour.show,\n contourColor: str2RgbaArray(data.contour.color).slice(0, 3),\n contourWidth: data.contour.width,\n useFacetNormals: data.flatshading\n };\n if (data.intensity) {\n var cOpts = extractOpts(data);\n this.color = \"#fff\";\n var mode = data.intensitymode;\n config[mode + \"Intensity\"] = data.intensity;\n config[mode + \"IntensityBounds\"] = [cOpts.min, cOpts.max];\n config.colormap = parseColorScale(data);\n } else if (data.vertexcolor) {\n this.color = data.vertexcolor[0];\n config.vertexColors = parseColorArray(data.vertexcolor);\n } else if (data.facecolor) {\n this.color = data.facecolor[0];\n config.cellColors = parseColorArray(data.facecolor);\n } else {\n this.color = data.color;\n config.meshColor = str2RgbaArray(data.color);\n }\n this.mesh.update(config);\n };\n proto.dispose = function() {\n this.scene.glplot.remove(this.mesh);\n this.mesh.dispose();\n };\n function createMesh3DTrace(scene, data) {\n var gl2 = scene.glplot.gl;\n var mesh = createMesh({ gl: gl2 });\n var result = new Mesh3DTrace(scene, mesh, data.uid);\n mesh._trace = result;\n result.update(data);\n scene.glplot.add(mesh);\n return result;\n }\n module.exports = createMesh3DTrace;\n }\n });\n\n // src/traces/mesh3d/index.js\n var require_mesh3d = __commonJS({\n \"src/traces/mesh3d/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes43(),\n supplyDefaults: require_defaults41(),\n calc: require_calc25(),\n colorbar: {\n min: \"cmin\",\n max: \"cmax\"\n },\n plot: require_convert7(),\n moduleType: \"trace\",\n name: \"mesh3d\",\n basePlotModule: require_gl3d(),\n categories: [\"gl3d\", \"showLegend\"],\n meta: {}\n };\n }\n });\n\n // lib/mesh3d.js\n var require_mesh3d2 = __commonJS({\n \"lib/mesh3d.js\"(exports, module) {\n \"use strict\";\n module.exports = require_mesh3d();\n }\n });\n\n // src/traces/cone/attributes.js\n var require_attributes46 = __commonJS({\n \"src/traces/cone/attributes.js\"(exports, module) {\n \"use strict\";\n var colorScaleAttrs = require_attributes8();\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var mesh3dAttrs = require_attributes43();\n var baseAttrs = require_attributes2();\n var extendFlat = require_extend().extendFlat;\n var attrs = {\n x: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n y: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n z: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n u: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n v: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n w: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n // TODO add way to specify cone positions independently of the vector field\n // provided, similar to MATLAB's coneplot Cx/Cy/Cz meshgrids,\n // see https://www.mathworks.com/help/matlab/ref/coneplot.html\n //\n // Alternatively, if our goal is only to 'fill in gaps' in the vector data,\n // we could try to extend the heatmap 'connectgaps' algorithm to 3D.\n // From AJ: this particular algorithm which amounts to a Poisson equation,\n // both for interpolation and extrapolation - is the right one to use for\n // cones too. It makes a field with zero divergence, which is a good\n // baseline assumption for vector fields.\n //\n // cones: {\n // // potential attributes to add:\n // //\n // // - meshmode: 'cartesian-product', 'pts', 'grid'\n // //\n // // under `meshmode: 'grid'`\n // // - (x|y|z)grid.start\n // // - (x|y|z)grid.end\n // // - (x|y|z)grid.size\n //\n // x: {\n // valType: 'data_array',\n // editType: 'calc',\n //\n // },\n // y: {\n // valType: 'data_array',\n // editType: 'calc',\n //\n // },\n // z: {\n // valType: 'data_array',\n // editType: 'calc',\n //\n // },\n //\n // editType: 'calc',\n //\n // },\n sizemode: {\n valType: \"enumerated\",\n values: [\"scaled\", \"absolute\", \"raw\"],\n editType: \"calc\",\n dflt: \"scaled\"\n },\n sizeref: {\n valType: \"number\",\n editType: \"calc\",\n min: 0\n },\n anchor: {\n valType: \"enumerated\",\n editType: \"calc\",\n values: [\"tip\", \"tail\", \"cm\", \"center\"],\n dflt: \"cm\"\n },\n text: {\n valType: \"string\",\n dflt: \"\",\n arrayOk: true,\n editType: \"calc\"\n },\n hovertext: {\n valType: \"string\",\n dflt: \"\",\n arrayOk: true,\n editType: \"calc\"\n },\n hovertemplate: hovertemplateAttrs({ editType: \"calc\" }, { keys: [\"norm\"] }),\n uhoverformat: axisHoverFormat(\"u\", 1),\n vhoverformat: axisHoverFormat(\"v\", 1),\n whoverformat: axisHoverFormat(\"w\", 1),\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n zhoverformat: axisHoverFormat(\"z\"),\n showlegend: extendFlat({}, baseAttrs.showlegend, { dflt: false })\n };\n extendFlat(attrs, colorScaleAttrs(\"\", {\n colorAttr: \"u/v/w norm\",\n showScaleDflt: true,\n editTypeOverride: \"calc\"\n }));\n var fromMesh3d = [\"opacity\", \"lightposition\", \"lighting\"];\n fromMesh3d.forEach(function(k) {\n attrs[k] = mesh3dAttrs[k];\n });\n attrs.hoverinfo = extendFlat({}, baseAttrs.hoverinfo, {\n editType: \"calc\",\n flags: [\"x\", \"y\", \"z\", \"u\", \"v\", \"w\", \"norm\", \"text\", \"name\"],\n dflt: \"x+y+z+norm+text+name\"\n });\n module.exports = attrs;\n }\n });\n\n // src/traces/cone/defaults.js\n var require_defaults42 = __commonJS({\n \"src/traces/cone/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var colorscaleDefaults = require_defaults2();\n var attributes = require_attributes46();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var u = coerce(\"u\");\n var v = coerce(\"v\");\n var w = coerce(\"w\");\n var x = coerce(\"x\");\n var y = coerce(\"y\");\n var z = coerce(\"z\");\n if (!u || !u.length || !v || !v.length || !w || !w.length || !x || !x.length || !y || !y.length || !z || !z.length) {\n traceOut.visible = false;\n return;\n }\n var sizemode = coerce(\"sizemode\");\n coerce(\"sizeref\", sizemode === \"raw\" ? 1 : 0.5);\n coerce(\"anchor\");\n coerce(\"lighting.ambient\");\n coerce(\"lighting.diffuse\");\n coerce(\"lighting.specular\");\n coerce(\"lighting.roughness\");\n coerce(\"lighting.fresnel\");\n coerce(\"lightposition.x\");\n coerce(\"lightposition.y\");\n coerce(\"lightposition.z\");\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"\", cLetter: \"c\" });\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n coerce(\"uhoverformat\");\n coerce(\"vhoverformat\");\n coerce(\"whoverformat\");\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n coerce(\"zhoverformat\");\n traceOut._length = null;\n };\n }\n });\n\n // src/traces/cone/calc.js\n var require_calc26 = __commonJS({\n \"src/traces/cone/calc.js\"(exports, module) {\n \"use strict\";\n var colorscaleCalc = require_calc();\n module.exports = function calc(gd, trace) {\n var u = trace.u;\n var v = trace.v;\n var w = trace.w;\n var len = Math.min(\n trace.x.length,\n trace.y.length,\n trace.z.length,\n u.length,\n v.length,\n w.length\n );\n var normMax = -Infinity;\n var normMin = Infinity;\n for (var i = 0; i < len; i++) {\n var uu = u[i];\n var vv = v[i];\n var ww = w[i];\n var norm = Math.sqrt(uu * uu + vv * vv + ww * ww);\n normMax = Math.max(normMax, norm);\n normMin = Math.min(normMin, norm);\n }\n trace._len = len;\n trace._normMax = normMax;\n colorscaleCalc(gd, trace, {\n vals: [normMin, normMax],\n containerStr: \"\",\n cLetter: \"c\"\n });\n };\n }\n });\n\n // src/traces/cone/convert.js\n var require_convert8 = __commonJS({\n \"src/traces/cone/convert.js\"(exports, module) {\n \"use strict\";\n var conePlot = require_stackgl_modules().gl_cone3d;\n var createConeMesh = require_stackgl_modules().gl_cone3d.createConeMesh;\n var simpleMap = require_lib().simpleMap;\n var parseColorScale = require_gl_format_color().parseColorScale;\n var extractOpts = require_colorscale().extractOpts;\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n var zip3 = require_zip3();\n function Cone(scene, uid) {\n this.scene = scene;\n this.uid = uid;\n this.mesh = null;\n this.data = null;\n }\n var proto = Cone.prototype;\n proto.handlePick = function(selection) {\n if (selection.object === this.mesh) {\n var selectIndex = selection.index = selection.data.index;\n var xx = this.data.x[selectIndex];\n var yy = this.data.y[selectIndex];\n var zz = this.data.z[selectIndex];\n var uu = this.data.u[selectIndex];\n var vv = this.data.v[selectIndex];\n var ww = this.data.w[selectIndex];\n selection.traceCoordinate = [\n xx,\n yy,\n zz,\n uu,\n vv,\n ww,\n Math.sqrt(uu * uu + vv * vv + ww * ww)\n ];\n var text = this.data.hovertext || this.data.text;\n if (isArrayOrTypedArray(text) && text[selectIndex] !== void 0) {\n selection.textLabel = text[selectIndex];\n } else if (text) {\n selection.textLabel = text;\n }\n return true;\n }\n };\n var axisName2scaleIndex = { xaxis: 0, yaxis: 1, zaxis: 2 };\n var anchor2coneOffset = { tip: 1, tail: 0, cm: 0.25, center: 0.5 };\n var anchor2coneSpan = { tip: 1, tail: 1, cm: 0.75, center: 0.5 };\n function convert(scene, trace) {\n var sceneLayout = scene.fullSceneLayout;\n var dataScale = scene.dataScale;\n var coneOpts = {};\n function toDataCoords(arr, axisName) {\n var ax = sceneLayout[axisName];\n var scale = dataScale[axisName2scaleIndex[axisName]];\n return simpleMap(arr, function(v) {\n return ax.d2l(v) * scale;\n });\n }\n coneOpts.vectors = zip3(\n toDataCoords(trace.u, \"xaxis\"),\n toDataCoords(trace.v, \"yaxis\"),\n toDataCoords(trace.w, \"zaxis\"),\n trace._len\n );\n coneOpts.positions = zip3(\n toDataCoords(trace.x, \"xaxis\"),\n toDataCoords(trace.y, \"yaxis\"),\n toDataCoords(trace.z, \"zaxis\"),\n trace._len\n );\n var cOpts = extractOpts(trace);\n coneOpts.colormap = parseColorScale(trace);\n coneOpts.vertexIntensityBounds = [cOpts.min / trace._normMax, cOpts.max / trace._normMax];\n coneOpts.coneOffset = anchor2coneOffset[trace.anchor];\n var sizemode = trace.sizemode;\n if (sizemode === \"scaled\") {\n coneOpts.coneSize = trace.sizeref || 0.5;\n } else if (sizemode === \"absolute\") {\n coneOpts.coneSize = trace.sizeref && trace._normMax ? trace.sizeref / trace._normMax : 0.5;\n } else if (sizemode === \"raw\") {\n coneOpts.coneSize = trace.sizeref;\n }\n coneOpts.coneSizemode = sizemode;\n var meshData = conePlot(coneOpts);\n var lp = trace.lightposition;\n meshData.lightPosition = [lp.x, lp.y, lp.z];\n meshData.ambient = trace.lighting.ambient;\n meshData.diffuse = trace.lighting.diffuse;\n meshData.specular = trace.lighting.specular;\n meshData.roughness = trace.lighting.roughness;\n meshData.fresnel = trace.lighting.fresnel;\n meshData.opacity = trace.opacity;\n trace._pad = anchor2coneSpan[trace.anchor] * meshData.vectorScale * meshData.coneScale * trace._normMax;\n return meshData;\n }\n proto.update = function(data) {\n this.data = data;\n var meshData = convert(this.scene, data);\n this.mesh.update(meshData);\n };\n proto.dispose = function() {\n this.scene.glplot.remove(this.mesh);\n this.mesh.dispose();\n };\n function createConeTrace(scene, data) {\n var gl2 = scene.glplot.gl;\n var meshData = convert(scene, data);\n var mesh = createConeMesh(gl2, meshData);\n var cone = new Cone(scene, data.uid);\n cone.mesh = mesh;\n cone.data = data;\n mesh._trace = cone;\n scene.glplot.add(mesh);\n return cone;\n }\n module.exports = createConeTrace;\n }\n });\n\n // src/traces/cone/index.js\n var require_cone = __commonJS({\n \"src/traces/cone/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"trace\",\n name: \"cone\",\n basePlotModule: require_gl3d(),\n categories: [\"gl3d\", \"showLegend\"],\n attributes: require_attributes46(),\n supplyDefaults: require_defaults42(),\n colorbar: {\n min: \"cmin\",\n max: \"cmax\"\n },\n calc: require_calc26(),\n plot: require_convert8(),\n eventData: function(out, pt) {\n out.norm = pt.traceCoordinate[6];\n return out;\n },\n meta: {}\n };\n }\n });\n\n // lib/cone.js\n var require_cone2 = __commonJS({\n \"lib/cone.js\"(exports, module) {\n \"use strict\";\n module.exports = require_cone();\n }\n });\n\n // src/traces/streamtube/attributes.js\n var require_attributes47 = __commonJS({\n \"src/traces/streamtube/attributes.js\"(exports, module) {\n \"use strict\";\n var colorScaleAttrs = require_attributes8();\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var mesh3dAttrs = require_attributes43();\n var baseAttrs = require_attributes2();\n var extendFlat = require_extend().extendFlat;\n var attrs = {\n x: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n y: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n z: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n u: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n v: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n w: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n starts: {\n x: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n y: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n z: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n editType: \"calc\"\n },\n maxdisplayed: {\n valType: \"integer\",\n min: 0,\n dflt: 1e3,\n editType: \"calc\"\n },\n // TODO\n //\n // Should add 'absolute' (like cone traces have), but currently gl-streamtube3d's\n // `absoluteTubeSize` doesn't behave well enough for our needs.\n //\n // 'fixed' would be a nice addition to plot stream 'lines', see\n // https://github.com/plotly/plotly.js/commit/812be20750e21e0a1831975001c248d365850f73#r29129877\n //\n // sizemode: {\n // valType: 'enumerated',\n // values: ['scaled', 'absolute', 'fixed'],\n // dflt: 'scaled',\n // editType: 'calc',\n //\n // },\n sizeref: {\n valType: \"number\",\n editType: \"calc\",\n min: 0,\n dflt: 1\n },\n text: {\n valType: \"string\",\n dflt: \"\",\n editType: \"calc\"\n },\n hovertext: {\n valType: \"string\",\n dflt: \"\",\n editType: \"calc\"\n },\n hovertemplate: hovertemplateAttrs({ editType: \"calc\" }, {\n keys: [\n \"tubex\",\n \"tubey\",\n \"tubez\",\n \"tubeu\",\n \"tubev\",\n \"tubew\",\n \"norm\",\n \"divergence\"\n ]\n }),\n uhoverformat: axisHoverFormat(\"u\", 1),\n vhoverformat: axisHoverFormat(\"v\", 1),\n whoverformat: axisHoverFormat(\"w\", 1),\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n zhoverformat: axisHoverFormat(\"z\"),\n showlegend: extendFlat({}, baseAttrs.showlegend, { dflt: false })\n };\n extendFlat(attrs, colorScaleAttrs(\"\", {\n colorAttr: \"u/v/w norm\",\n showScaleDflt: true,\n editTypeOverride: \"calc\"\n }));\n var fromMesh3d = [\"opacity\", \"lightposition\", \"lighting\"];\n fromMesh3d.forEach(function(k) {\n attrs[k] = mesh3dAttrs[k];\n });\n attrs.hoverinfo = extendFlat({}, baseAttrs.hoverinfo, {\n editType: \"calc\",\n flags: [\"x\", \"y\", \"z\", \"u\", \"v\", \"w\", \"norm\", \"divergence\", \"text\", \"name\"],\n dflt: \"x+y+z+norm+text+name\"\n });\n module.exports = attrs;\n }\n });\n\n // src/traces/streamtube/defaults.js\n var require_defaults43 = __commonJS({\n \"src/traces/streamtube/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var colorscaleDefaults = require_defaults2();\n var attributes = require_attributes47();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var u = coerce(\"u\");\n var v = coerce(\"v\");\n var w = coerce(\"w\");\n var x = coerce(\"x\");\n var y = coerce(\"y\");\n var z = coerce(\"z\");\n if (!u || !u.length || !v || !v.length || !w || !w.length || !x || !x.length || !y || !y.length || !z || !z.length) {\n traceOut.visible = false;\n return;\n }\n coerce(\"starts.x\");\n coerce(\"starts.y\");\n coerce(\"starts.z\");\n coerce(\"maxdisplayed\");\n coerce(\"sizeref\");\n coerce(\"lighting.ambient\");\n coerce(\"lighting.diffuse\");\n coerce(\"lighting.specular\");\n coerce(\"lighting.roughness\");\n coerce(\"lighting.fresnel\");\n coerce(\"lightposition.x\");\n coerce(\"lightposition.y\");\n coerce(\"lightposition.z\");\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"\", cLetter: \"c\" });\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n coerce(\"uhoverformat\");\n coerce(\"vhoverformat\");\n coerce(\"whoverformat\");\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n coerce(\"zhoverformat\");\n traceOut._length = null;\n };\n }\n });\n\n // src/traces/streamtube/convert.js\n var require_convert9 = __commonJS({\n \"src/traces/streamtube/convert.js\"(exports, module) {\n \"use strict\";\n var tube2mesh = require_stackgl_modules().gl_streamtube3d;\n var createTubeMesh = tube2mesh.createTubeMesh;\n var Lib = require_lib();\n var parseColorScale = require_gl_format_color().parseColorScale;\n var extractOpts = require_colorscale().extractOpts;\n var zip3 = require_zip3();\n var axisName2scaleIndex = { xaxis: 0, yaxis: 1, zaxis: 2 };\n function Streamtube(scene, uid) {\n this.scene = scene;\n this.uid = uid;\n this.mesh = null;\n this.data = null;\n }\n var proto = Streamtube.prototype;\n proto.handlePick = function(selection) {\n var sceneLayout = this.scene.fullSceneLayout;\n var dataScale = this.scene.dataScale;\n function fromDataScale(v, axisName) {\n var ax = sceneLayout[axisName];\n var scale = dataScale[axisName2scaleIndex[axisName]];\n return ax.l2c(v) / scale;\n }\n if (selection.object === this.mesh) {\n var pos = selection.data.position;\n var uvx = selection.data.velocity;\n selection.traceCoordinate = [\n fromDataScale(pos[0], \"xaxis\"),\n fromDataScale(pos[1], \"yaxis\"),\n fromDataScale(pos[2], \"zaxis\"),\n fromDataScale(uvx[0], \"xaxis\"),\n fromDataScale(uvx[1], \"yaxis\"),\n fromDataScale(uvx[2], \"zaxis\"),\n // u/v/w norm\n selection.data.intensity * this.data._normMax,\n // divergence\n selection.data.divergence\n ];\n selection.textLabel = this.data.hovertext || this.data.text;\n return true;\n }\n };\n function getDfltStartingPositions(vec) {\n var len = vec.length;\n var s;\n if (len > 2) {\n s = vec.slice(1, len - 1);\n } else if (len === 2) {\n s = [(vec[0] + vec[1]) / 2];\n } else {\n s = vec;\n }\n return s;\n }\n function getBoundPads(vec) {\n var len = vec.length;\n if (len === 1) {\n return [0.5, 0.5];\n } else {\n return [vec[1] - vec[0], vec[len - 1] - vec[len - 2]];\n }\n }\n function convert(scene, trace) {\n var sceneLayout = scene.fullSceneLayout;\n var dataScale = scene.dataScale;\n var len = trace._len;\n var tubeOpts = {};\n function toDataCoords(arr, axisName) {\n var ax = sceneLayout[axisName];\n var scale = dataScale[axisName2scaleIndex[axisName]];\n return Lib.simpleMap(arr, function(v) {\n return ax.d2l(v) * scale;\n });\n }\n tubeOpts.vectors = zip3(\n toDataCoords(trace._u, \"xaxis\"),\n toDataCoords(trace._v, \"yaxis\"),\n toDataCoords(trace._w, \"zaxis\"),\n len\n );\n if (!len) {\n return {\n positions: [],\n cells: []\n };\n }\n var meshx = toDataCoords(trace._Xs, \"xaxis\");\n var meshy = toDataCoords(trace._Ys, \"yaxis\");\n var meshz = toDataCoords(trace._Zs, \"zaxis\");\n tubeOpts.meshgrid = [meshx, meshy, meshz];\n tubeOpts.gridFill = trace._gridFill;\n var slen = trace._slen;\n if (slen) {\n tubeOpts.startingPositions = zip3(\n toDataCoords(trace._startsX, \"xaxis\"),\n toDataCoords(trace._startsY, \"yaxis\"),\n toDataCoords(trace._startsZ, \"zaxis\")\n );\n } else {\n var sy0 = meshy[0];\n var sx = getDfltStartingPositions(meshx);\n var sz = getDfltStartingPositions(meshz);\n var startingPositions = new Array(sx.length * sz.length);\n var m = 0;\n for (var i = 0; i < sx.length; i++) {\n for (var k = 0; k < sz.length; k++) {\n startingPositions[m++] = [sx[i], sy0, sz[k]];\n }\n }\n tubeOpts.startingPositions = startingPositions;\n }\n tubeOpts.colormap = parseColorScale(trace);\n tubeOpts.tubeSize = trace.sizeref;\n tubeOpts.maxLength = trace.maxdisplayed;\n var xbnds = toDataCoords(trace._xbnds, \"xaxis\");\n var ybnds = toDataCoords(trace._ybnds, \"yaxis\");\n var zbnds = toDataCoords(trace._zbnds, \"zaxis\");\n var xpads = getBoundPads(meshx);\n var ypads = getBoundPads(meshy);\n var zpads = getBoundPads(meshz);\n var bounds = [\n [xbnds[0] - xpads[0], ybnds[0] - ypads[0], zbnds[0] - zpads[0]],\n [xbnds[1] + xpads[1], ybnds[1] + ypads[1], zbnds[1] + zpads[1]]\n ];\n var meshData = tube2mesh(tubeOpts, bounds);\n var cOpts = extractOpts(trace);\n meshData.vertexIntensityBounds = [cOpts.min / trace._normMax, cOpts.max / trace._normMax];\n var lp = trace.lightposition;\n meshData.lightPosition = [lp.x, lp.y, lp.z];\n meshData.ambient = trace.lighting.ambient;\n meshData.diffuse = trace.lighting.diffuse;\n meshData.specular = trace.lighting.specular;\n meshData.roughness = trace.lighting.roughness;\n meshData.fresnel = trace.lighting.fresnel;\n meshData.opacity = trace.opacity;\n trace._pad = meshData.tubeScale * trace.sizeref * 2;\n return meshData;\n }\n proto.update = function(data) {\n this.data = data;\n var meshData = convert(this.scene, data);\n this.mesh.update(meshData);\n };\n proto.dispose = function() {\n this.scene.glplot.remove(this.mesh);\n this.mesh.dispose();\n };\n function createStreamtubeTrace(scene, data) {\n var gl2 = scene.glplot.gl;\n var meshData = convert(scene, data);\n var mesh = createTubeMesh(gl2, meshData);\n var streamtube = new Streamtube(scene, data.uid);\n streamtube.mesh = mesh;\n streamtube.data = data;\n mesh._trace = streamtube;\n scene.glplot.add(mesh);\n return streamtube;\n }\n module.exports = createStreamtubeTrace;\n }\n });\n\n // src/traces/streamtube/index.js\n var require_streamtube = __commonJS({\n \"src/traces/streamtube/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"trace\",\n name: \"streamtube\",\n basePlotModule: require_gl3d(),\n categories: [\"gl3d\", \"showLegend\"],\n attributes: require_attributes47(),\n supplyDefaults: require_defaults43(),\n colorbar: {\n min: \"cmin\",\n max: \"cmax\"\n },\n calc: require_calc23().calc,\n plot: require_convert9(),\n eventData: function(out, pt) {\n out.tubex = out.x;\n out.tubey = out.y;\n out.tubez = out.z;\n out.tubeu = pt.traceCoordinate[3];\n out.tubev = pt.traceCoordinate[4];\n out.tubew = pt.traceCoordinate[5];\n out.norm = pt.traceCoordinate[6];\n out.divergence = pt.traceCoordinate[7];\n delete out.x;\n delete out.y;\n delete out.z;\n return out;\n },\n meta: {}\n };\n }\n });\n\n // lib/streamtube.js\n var require_streamtube2 = __commonJS({\n \"lib/streamtube.js\"(exports, module) {\n \"use strict\";\n module.exports = require_streamtube();\n }\n });\n\n // src/traces/scattergeo/attributes.js\n var require_attributes48 = __commonJS({\n \"src/traces/scattergeo/attributes.js\"(exports, module) {\n \"use strict\";\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var makeFillcolorAttr = require_fillcolor_attribute();\n var scatterAttrs = require_attributes12();\n var baseAttrs = require_attributes2();\n var colorAttributes = require_attributes8();\n var dash = require_attributes4().dash;\n var extendFlat = require_extend().extendFlat;\n var overrideAll = require_edit_types().overrideAll;\n var scatterMarkerAttrs = scatterAttrs.marker;\n var scatterLineAttrs = scatterAttrs.line;\n var scatterMarkerLineAttrs = scatterMarkerAttrs.line;\n module.exports = overrideAll({\n lon: {\n valType: \"data_array\"\n },\n lat: {\n valType: \"data_array\"\n },\n locations: {\n valType: \"data_array\"\n },\n locationmode: {\n valType: \"enumerated\",\n values: [\"ISO-3\", \"USA-states\", \"country names\", \"geojson-id\"],\n dflt: \"ISO-3\"\n },\n geojson: {\n valType: \"any\",\n editType: \"calc\"\n },\n featureidkey: {\n valType: \"string\",\n editType: \"calc\",\n dflt: \"id\"\n },\n mode: extendFlat({}, scatterAttrs.mode, { dflt: \"markers\" }),\n text: extendFlat({}, scatterAttrs.text, {}),\n texttemplate: texttemplateAttrs({ editType: \"plot\" }, {\n keys: [\"lat\", \"lon\", \"location\", \"text\"]\n }),\n hovertext: extendFlat({}, scatterAttrs.hovertext, {}),\n textfont: scatterAttrs.textfont,\n textposition: scatterAttrs.textposition,\n line: {\n color: scatterLineAttrs.color,\n width: scatterLineAttrs.width,\n dash\n },\n connectgaps: scatterAttrs.connectgaps,\n marker: extendFlat(\n {\n symbol: scatterMarkerAttrs.symbol,\n opacity: scatterMarkerAttrs.opacity,\n angle: scatterMarkerAttrs.angle,\n angleref: extendFlat({}, scatterMarkerAttrs.angleref, {\n values: [\"previous\", \"up\", \"north\"]\n }),\n standoff: scatterMarkerAttrs.standoff,\n size: scatterMarkerAttrs.size,\n sizeref: scatterMarkerAttrs.sizeref,\n sizemin: scatterMarkerAttrs.sizemin,\n sizemode: scatterMarkerAttrs.sizemode,\n colorbar: scatterMarkerAttrs.colorbar,\n line: extendFlat(\n {\n width: scatterMarkerLineAttrs.width\n },\n colorAttributes(\"marker.line\")\n ),\n gradient: scatterMarkerAttrs.gradient\n },\n colorAttributes(\"marker\")\n ),\n fill: {\n valType: \"enumerated\",\n values: [\"none\", \"toself\"],\n dflt: \"none\"\n },\n fillcolor: makeFillcolorAttr(),\n selected: scatterAttrs.selected,\n unselected: scatterAttrs.unselected,\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: [\"lon\", \"lat\", \"location\", \"text\", \"name\"]\n }),\n hovertemplate: hovertemplateAttrs()\n }, \"calc\", \"nested\");\n }\n });\n\n // src/traces/scattergeo/defaults.js\n var require_defaults44 = __commonJS({\n \"src/traces/scattergeo/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var subTypes = require_subtypes();\n var handleMarkerDefaults = require_marker_defaults();\n var handleLineDefaults = require_line_defaults();\n var handleTextDefaults = require_text_defaults();\n var handleFillColorDefaults = require_fillcolor_defaults();\n var attributes = require_attributes48();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var locations = coerce(\"locations\");\n var len;\n if (locations && locations.length) {\n var geojson = coerce(\"geojson\");\n var locationmodeDflt;\n if (typeof geojson === \"string\" && geojson !== \"\" || Lib.isPlainObject(geojson)) {\n locationmodeDflt = \"geojson-id\";\n }\n var locationMode = coerce(\"locationmode\", locationmodeDflt);\n if (locationMode === \"geojson-id\") {\n coerce(\"featureidkey\");\n }\n len = locations.length;\n } else {\n var lon = coerce(\"lon\") || [];\n var lat = coerce(\"lat\") || [];\n len = Math.min(lon.length, lat.length);\n }\n if (!len) {\n traceOut.visible = false;\n return;\n }\n traceOut._length = len;\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n coerce(\"mode\");\n if (subTypes.hasMarkers(traceOut)) {\n handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, { gradient: true });\n }\n if (subTypes.hasLines(traceOut)) {\n handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce);\n coerce(\"connectgaps\");\n }\n if (subTypes.hasText(traceOut)) {\n coerce(\"texttemplate\");\n handleTextDefaults(traceIn, traceOut, layout, coerce);\n }\n coerce(\"fill\");\n if (traceOut.fill !== \"none\") {\n handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce);\n }\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n };\n }\n });\n\n // src/traces/scattergeo/format_labels.js\n var require_format_labels3 = __commonJS({\n \"src/traces/scattergeo/format_labels.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n module.exports = function formatLabels(cdi, trace, fullLayout) {\n var labels = {};\n var geo = fullLayout[trace.geo]._subplot;\n var ax = geo.mockAxis;\n var lonlat = cdi.lonlat;\n labels.lonLabel = Axes.tickText(ax, ax.c2l(lonlat[0]), true).text;\n labels.latLabel = Axes.tickText(ax, ax.c2l(lonlat[1]), true).text;\n return labels;\n };\n }\n });\n\n // src/traces/scattergeo/calc.js\n var require_calc27 = __commonJS({\n \"src/traces/scattergeo/calc.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var BADNUM = require_numerical().BADNUM;\n var calcMarkerColorscale = require_colorscale_calc();\n var arraysToCalcdata = require_arrays_to_calcdata();\n var calcSelection = require_calc_selection();\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n var _ = require_lib()._;\n function isNonBlankString(v) {\n return v && typeof v === \"string\";\n }\n module.exports = function calc(gd, trace) {\n var hasLocationData = isArrayOrTypedArray(trace.locations);\n var len = hasLocationData ? trace.locations.length : trace._length;\n var calcTrace = new Array(len);\n var isValidLoc;\n if (trace.geojson) {\n isValidLoc = function(v) {\n return isNonBlankString(v) || isNumeric(v);\n };\n } else {\n isValidLoc = isNonBlankString;\n }\n for (var i = 0; i < len; i++) {\n var calcPt = calcTrace[i] = {};\n if (hasLocationData) {\n var loc = trace.locations[i];\n calcPt.loc = isValidLoc(loc) ? loc : null;\n } else {\n var lon = trace.lon[i];\n var lat = trace.lat[i];\n if (isNumeric(lon) && isNumeric(lat)) calcPt.lonlat = [+lon, +lat];\n else calcPt.lonlat = [BADNUM, BADNUM];\n }\n }\n arraysToCalcdata(calcTrace, trace);\n calcMarkerColorscale(gd, trace);\n calcSelection(calcTrace, trace);\n if (len) {\n calcTrace[0].t = {\n labels: {\n lat: _(gd, \"lat:\") + \" \",\n lon: _(gd, \"lon:\") + \" \"\n }\n };\n }\n return calcTrace;\n };\n }\n });\n\n // src/plots/geo/constants.js\n var require_constants22 = __commonJS({\n \"src/plots/geo/constants.js\"(exports) {\n \"use strict\";\n exports.projNames = {\n airy: \"airy\",\n aitoff: \"aitoff\",\n \"albers usa\": \"albersUsa\",\n albers: \"albers\",\n // 'armadillo': 'armadillo',\n august: \"august\",\n \"azimuthal equal area\": \"azimuthalEqualArea\",\n \"azimuthal equidistant\": \"azimuthalEquidistant\",\n baker: \"baker\",\n // 'berghaus': 'berghaus',\n bertin1953: \"bertin1953\",\n boggs: \"boggs\",\n bonne: \"bonne\",\n bottomley: \"bottomley\",\n bromley: \"bromley\",\n // 'chamberlin africa': 'chamberlinAfrica',\n // 'chamberlin': 'chamberlin',\n collignon: \"collignon\",\n \"conic conformal\": \"conicConformal\",\n \"conic equal area\": \"conicEqualArea\",\n \"conic equidistant\": \"conicEquidistant\",\n craig: \"craig\",\n craster: \"craster\",\n \"cylindrical equal area\": \"cylindricalEqualArea\",\n \"cylindrical stereographic\": \"cylindricalStereographic\",\n eckert1: \"eckert1\",\n eckert2: \"eckert2\",\n eckert3: \"eckert3\",\n eckert4: \"eckert4\",\n eckert5: \"eckert5\",\n eckert6: \"eckert6\",\n eisenlohr: \"eisenlohr\",\n \"equal earth\": \"equalEarth\",\n equirectangular: \"equirectangular\",\n fahey: \"fahey\",\n \"foucaut sinusoidal\": \"foucautSinusoidal\",\n foucaut: \"foucaut\",\n // 'gilbert': 'gilbert',\n // 'gingery': 'gingery',\n ginzburg4: \"ginzburg4\",\n ginzburg5: \"ginzburg5\",\n ginzburg6: \"ginzburg6\",\n ginzburg8: \"ginzburg8\",\n ginzburg9: \"ginzburg9\",\n gnomonic: \"gnomonic\",\n \"gringorten quincuncial\": \"gringortenQuincuncial\",\n gringorten: \"gringorten\",\n guyou: \"guyou\",\n // 'hammer retroazimuthal': 'hammerRetroazimuthal',\n hammer: \"hammer\",\n // 'healpix': 'healpix',\n hill: \"hill\",\n homolosine: \"homolosine\",\n hufnagel: \"hufnagel\",\n hyperelliptical: \"hyperelliptical\",\n // 'interrupted boggs': 'interruptedBoggs',\n // 'interrupted homolosine': 'interruptedHomolosine',\n // 'interrupted mollweide hemispheres': 'interruptedMollweideHemispheres',\n // 'interrupted mollweide': 'interruptedMollweide',\n // 'interrupted quartic authalic': 'interruptedQuarticAuthalic',\n // 'interrupted sinu mollweide': 'interruptedSinuMollweide',\n // 'interrupted sinusoidal': 'interruptedSinusoidal',\n kavrayskiy7: \"kavrayskiy7\",\n lagrange: \"lagrange\",\n larrivee: \"larrivee\",\n laskowski: \"laskowski\",\n // 'littrow': 'littrow',\n loximuthal: \"loximuthal\",\n mercator: \"mercator\",\n miller: \"miller\",\n // 'modified stereographic alaska': 'modifiedStereographicAlaska',\n // 'modified stereographic gs48': 'modifiedStereographicGs48',\n // 'modified stereographic gs50': 'modifiedStereographicGs50',\n // 'modified stereographic lee': 'modifiedStereographicLee',\n // 'modified stereographic miller': 'modifiedStereographicMiller',\n // 'modified stereographic': 'modifiedStereographic',\n mollweide: \"mollweide\",\n \"mt flat polar parabolic\": \"mtFlatPolarParabolic\",\n \"mt flat polar quartic\": \"mtFlatPolarQuartic\",\n \"mt flat polar sinusoidal\": \"mtFlatPolarSinusoidal\",\n \"natural earth\": \"naturalEarth\",\n \"natural earth1\": \"naturalEarth1\",\n \"natural earth2\": \"naturalEarth2\",\n \"nell hammer\": \"nellHammer\",\n nicolosi: \"nicolosi\",\n orthographic: \"orthographic\",\n patterson: \"patterson\",\n \"peirce quincuncial\": \"peirceQuincuncial\",\n polyconic: \"polyconic\",\n // 'polyhedral butterfly': 'polyhedralButterfly',\n // 'polyhedral collignon': 'polyhedralCollignon',\n // 'polyhedral waterman': 'polyhedralWaterman',\n \"rectangular polyconic\": \"rectangularPolyconic\",\n robinson: \"robinson\",\n satellite: \"satellite\",\n \"sinu mollweide\": \"sinuMollweide\",\n sinusoidal: \"sinusoidal\",\n stereographic: \"stereographic\",\n times: \"times\",\n \"transverse mercator\": \"transverseMercator\",\n // 'two point azimuthalUsa': 'twoPointAzimuthalUsa',\n // 'two point azimuthal': 'twoPointAzimuthal',\n // 'two point equidistantUsa': 'twoPointEquidistantUsa',\n // 'two point equidistant': 'twoPointEquidistant',\n \"van der grinten\": \"vanDerGrinten\",\n \"van der grinten2\": \"vanDerGrinten2\",\n \"van der grinten3\": \"vanDerGrinten3\",\n \"van der grinten4\": \"vanDerGrinten4\",\n wagner4: \"wagner4\",\n wagner6: \"wagner6\",\n // 'wagner7': 'wagner7',\n // 'wagner': 'wagner',\n wiechel: \"wiechel\",\n \"winkel tripel\": \"winkel3\",\n winkel3: \"winkel3\"\n };\n exports.axesNames = [\"lonaxis\", \"lataxis\"];\n exports.lonaxisSpan = {\n orthographic: 180,\n \"azimuthal equal area\": 360,\n \"azimuthal equidistant\": 360,\n \"conic conformal\": 180,\n gnomonic: 160,\n stereographic: 180,\n \"transverse mercator\": 180,\n \"*\": 360\n };\n exports.lataxisSpan = {\n \"conic conformal\": 150,\n stereographic: 179.5,\n \"*\": 180\n };\n exports.scopeDefaults = {\n world: {\n lonaxisRange: [-180, 180],\n lataxisRange: [-90, 90],\n projType: \"equirectangular\",\n projRotate: [0, 0, 0]\n },\n usa: {\n lonaxisRange: [-180, -50],\n lataxisRange: [15, 80],\n projType: \"albers usa\"\n },\n europe: {\n lonaxisRange: [-30, 60],\n lataxisRange: [30, 85],\n projType: \"conic conformal\",\n projRotate: [15, 0, 0],\n projParallels: [0, 60]\n },\n asia: {\n lonaxisRange: [22, 160],\n lataxisRange: [-15, 55],\n projType: \"mercator\",\n projRotate: [0, 0, 0]\n },\n africa: {\n lonaxisRange: [-30, 60],\n lataxisRange: [-40, 40],\n projType: \"mercator\",\n projRotate: [0, 0, 0]\n },\n \"north america\": {\n lonaxisRange: [-180, -45],\n lataxisRange: [5, 85],\n projType: \"conic conformal\",\n projRotate: [-100, 0, 0],\n projParallels: [29.5, 45.5]\n },\n \"south america\": {\n lonaxisRange: [-100, -30],\n lataxisRange: [-60, 15],\n projType: \"mercator\",\n projRotate: [0, 0, 0]\n }\n };\n exports.clipPad = 1e-3;\n exports.precision = 0.1;\n exports.landColor = \"#F0DC82\";\n exports.waterColor = \"#3399FF\";\n exports.locationmodeToLayer = {\n \"ISO-3\": \"countries\",\n \"USA-states\": \"subunits\",\n \"country names\": \"countries\"\n };\n exports.sphereSVG = { type: \"Sphere\" };\n exports.fillLayers = {\n ocean: 1,\n land: 1,\n lakes: 1\n };\n exports.lineLayers = {\n subunits: 1,\n countries: 1,\n coastlines: 1,\n rivers: 1,\n frame: 1\n };\n exports.layers = [\n \"bg\",\n \"ocean\",\n \"land\",\n \"lakes\",\n \"subunits\",\n \"countries\",\n \"coastlines\",\n \"rivers\",\n \"lataxis\",\n \"lonaxis\",\n \"frame\",\n \"backplot\",\n \"frontplot\"\n ];\n exports.layersForChoropleth = [\n \"bg\",\n \"ocean\",\n \"land\",\n \"subunits\",\n \"countries\",\n \"coastlines\",\n \"lataxis\",\n \"lonaxis\",\n \"frame\",\n \"backplot\",\n \"rivers\",\n \"lakes\",\n \"frontplot\"\n ];\n exports.layerNameToAdjective = {\n ocean: \"ocean\",\n land: \"land\",\n lakes: \"lake\",\n subunits: \"subunit\",\n countries: \"country\",\n coastlines: \"coastline\",\n rivers: \"river\",\n frame: \"frame\"\n };\n }\n });\n\n // node_modules/topojson-client/dist/topojson-client.js\n var require_topojson_client = __commonJS({\n \"node_modules/topojson-client/dist/topojson-client.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports) : typeof define === \"function\" && false ? define([\"exports\"], factory) : (global2 = global2 || self, factory(global2.topojson = global2.topojson || {}));\n })(exports, function(exports2) {\n \"use strict\";\n function identity2(x) {\n return x;\n }\n function transform(transform2) {\n if (transform2 == null) return identity2;\n var x0, y0, kx = transform2.scale[0], ky = transform2.scale[1], dx = transform2.translate[0], dy = transform2.translate[1];\n return function(input, i) {\n if (!i) x0 = y0 = 0;\n var j = 2, n = input.length, output = new Array(n);\n output[0] = (x0 += input[0]) * kx + dx;\n output[1] = (y0 += input[1]) * ky + dy;\n while (j < n) output[j] = input[j], ++j;\n return output;\n };\n }\n function bbox(topology) {\n var t = transform(topology.transform), key, x0 = Infinity, y0 = x0, x1 = -x0, y1 = -x0;\n function bboxPoint(p) {\n p = t(p);\n if (p[0] < x0) x0 = p[0];\n if (p[0] > x1) x1 = p[0];\n if (p[1] < y0) y0 = p[1];\n if (p[1] > y1) y1 = p[1];\n }\n function bboxGeometry(o) {\n switch (o.type) {\n case \"GeometryCollection\":\n o.geometries.forEach(bboxGeometry);\n break;\n case \"Point\":\n bboxPoint(o.coordinates);\n break;\n case \"MultiPoint\":\n o.coordinates.forEach(bboxPoint);\n break;\n }\n }\n topology.arcs.forEach(function(arc) {\n var i = -1, n = arc.length, p;\n while (++i < n) {\n p = t(arc[i], i);\n if (p[0] < x0) x0 = p[0];\n if (p[0] > x1) x1 = p[0];\n if (p[1] < y0) y0 = p[1];\n if (p[1] > y1) y1 = p[1];\n }\n });\n for (key in topology.objects) {\n bboxGeometry(topology.objects[key]);\n }\n return [x0, y0, x1, y1];\n }\n function reverse(array, n) {\n var t, j = array.length, i = j - n;\n while (i < --j) t = array[i], array[i++] = array[j], array[j] = t;\n }\n function feature(topology, o) {\n if (typeof o === \"string\") o = topology.objects[o];\n return o.type === \"GeometryCollection\" ? { type: \"FeatureCollection\", features: o.geometries.map(function(o2) {\n return feature$1(topology, o2);\n }) } : feature$1(topology, o);\n }\n function feature$1(topology, o) {\n var id = o.id, bbox2 = o.bbox, properties = o.properties == null ? {} : o.properties, geometry = object(topology, o);\n return id == null && bbox2 == null ? { type: \"Feature\", properties, geometry } : bbox2 == null ? { type: \"Feature\", id, properties, geometry } : { type: \"Feature\", id, bbox: bbox2, properties, geometry };\n }\n function object(topology, o) {\n var transformPoint = transform(topology.transform), arcs = topology.arcs;\n function arc(i, points) {\n if (points.length) points.pop();\n for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) {\n points.push(transformPoint(a[k], k));\n }\n if (i < 0) reverse(points, n);\n }\n function point(p) {\n return transformPoint(p);\n }\n function line(arcs2) {\n var points = [];\n for (var i = 0, n = arcs2.length; i < n; ++i) arc(arcs2[i], points);\n if (points.length < 2) points.push(points[0]);\n return points;\n }\n function ring(arcs2) {\n var points = line(arcs2);\n while (points.length < 4) points.push(points[0]);\n return points;\n }\n function polygon(arcs2) {\n return arcs2.map(ring);\n }\n function geometry(o2) {\n var type = o2.type, coordinates;\n switch (type) {\n case \"GeometryCollection\":\n return { type, geometries: o2.geometries.map(geometry) };\n case \"Point\":\n coordinates = point(o2.coordinates);\n break;\n case \"MultiPoint\":\n coordinates = o2.coordinates.map(point);\n break;\n case \"LineString\":\n coordinates = line(o2.arcs);\n break;\n case \"MultiLineString\":\n coordinates = o2.arcs.map(line);\n break;\n case \"Polygon\":\n coordinates = polygon(o2.arcs);\n break;\n case \"MultiPolygon\":\n coordinates = o2.arcs.map(polygon);\n break;\n default:\n return null;\n }\n return { type, coordinates };\n }\n return geometry(o);\n }\n function stitch(topology, arcs) {\n var stitchedArcs = {}, fragmentByStart = {}, fragmentByEnd = {}, fragments = [], emptyIndex = -1;\n arcs.forEach(function(i, j) {\n var arc = topology.arcs[i < 0 ? ~i : i], t;\n if (arc.length < 3 && !arc[1][0] && !arc[1][1]) {\n t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t;\n }\n });\n arcs.forEach(function(i) {\n var e = ends(i), start = e[0], end = e[1], f, g;\n if (f = fragmentByEnd[start]) {\n delete fragmentByEnd[f.end];\n f.push(i);\n f.end = end;\n if (g = fragmentByStart[end]) {\n delete fragmentByStart[g.start];\n var fg = g === f ? f : f.concat(g);\n fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg;\n } else {\n fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n }\n } else if (f = fragmentByStart[end]) {\n delete fragmentByStart[f.start];\n f.unshift(i);\n f.start = start;\n if (g = fragmentByEnd[start]) {\n delete fragmentByEnd[g.end];\n var gf = g === f ? f : g.concat(f);\n fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf;\n } else {\n fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n }\n } else {\n f = [i];\n fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f;\n }\n });\n function ends(i) {\n var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1;\n if (topology.transform) p1 = [0, 0], arc.forEach(function(dp) {\n p1[0] += dp[0], p1[1] += dp[1];\n });\n else p1 = arc[arc.length - 1];\n return i < 0 ? [p1, p0] : [p0, p1];\n }\n function flush(fragmentByEnd2, fragmentByStart2) {\n for (var k in fragmentByEnd2) {\n var f = fragmentByEnd2[k];\n delete fragmentByStart2[f.start];\n delete f.start;\n delete f.end;\n f.forEach(function(i) {\n stitchedArcs[i < 0 ? ~i : i] = 1;\n });\n fragments.push(f);\n }\n }\n flush(fragmentByEnd, fragmentByStart);\n flush(fragmentByStart, fragmentByEnd);\n arcs.forEach(function(i) {\n if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]);\n });\n return fragments;\n }\n function mesh(topology) {\n return object(topology, meshArcs.apply(this, arguments));\n }\n function meshArcs(topology, object2, filter) {\n var arcs, i, n;\n if (arguments.length > 1) arcs = extractArcs(topology, object2, filter);\n else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i;\n return { type: \"MultiLineString\", arcs: stitch(topology, arcs) };\n }\n function extractArcs(topology, object2, filter) {\n var arcs = [], geomsByArc = [], geom;\n function extract0(i) {\n var j = i < 0 ? ~i : i;\n (geomsByArc[j] || (geomsByArc[j] = [])).push({ i, g: geom });\n }\n function extract1(arcs2) {\n arcs2.forEach(extract0);\n }\n function extract2(arcs2) {\n arcs2.forEach(extract1);\n }\n function extract3(arcs2) {\n arcs2.forEach(extract2);\n }\n function geometry(o) {\n switch (geom = o, o.type) {\n case \"GeometryCollection\":\n o.geometries.forEach(geometry);\n break;\n case \"LineString\":\n extract1(o.arcs);\n break;\n case \"MultiLineString\":\n case \"Polygon\":\n extract2(o.arcs);\n break;\n case \"MultiPolygon\":\n extract3(o.arcs);\n break;\n }\n }\n geometry(object2);\n geomsByArc.forEach(filter == null ? function(geoms) {\n arcs.push(geoms[0].i);\n } : function(geoms) {\n if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i);\n });\n return arcs;\n }\n function planarRingArea(ring) {\n var i = -1, n = ring.length, a, b = ring[n - 1], area = 0;\n while (++i < n) a = b, b = ring[i], area += a[0] * b[1] - a[1] * b[0];\n return Math.abs(area);\n }\n function merge(topology) {\n return object(topology, mergeArcs.apply(this, arguments));\n }\n function mergeArcs(topology, objects) {\n var polygonsByArc = {}, polygons = [], groups = [];\n objects.forEach(geometry);\n function geometry(o) {\n switch (o.type) {\n case \"GeometryCollection\":\n o.geometries.forEach(geometry);\n break;\n case \"Polygon\":\n extract(o.arcs);\n break;\n case \"MultiPolygon\":\n o.arcs.forEach(extract);\n break;\n }\n }\n function extract(polygon) {\n polygon.forEach(function(ring) {\n ring.forEach(function(arc) {\n (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon);\n });\n });\n polygons.push(polygon);\n }\n function area(ring) {\n return planarRingArea(object(topology, { type: \"Polygon\", arcs: [ring] }).coordinates[0]);\n }\n polygons.forEach(function(polygon) {\n if (!polygon._) {\n var group = [], neighbors2 = [polygon];\n polygon._ = 1;\n groups.push(group);\n while (polygon = neighbors2.pop()) {\n group.push(polygon);\n polygon.forEach(function(ring) {\n ring.forEach(function(arc) {\n polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon2) {\n if (!polygon2._) {\n polygon2._ = 1;\n neighbors2.push(polygon2);\n }\n });\n });\n });\n }\n }\n });\n polygons.forEach(function(polygon) {\n delete polygon._;\n });\n return {\n type: \"MultiPolygon\",\n arcs: groups.map(function(polygons2) {\n var arcs = [], n;\n polygons2.forEach(function(polygon) {\n polygon.forEach(function(ring) {\n ring.forEach(function(arc) {\n if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) {\n arcs.push(arc);\n }\n });\n });\n });\n arcs = stitch(topology, arcs);\n if ((n = arcs.length) > 1) {\n for (var i = 1, k = area(arcs[0]), ki, t; i < n; ++i) {\n if ((ki = area(arcs[i])) > k) {\n t = arcs[0], arcs[0] = arcs[i], arcs[i] = t, k = ki;\n }\n }\n }\n return arcs;\n }).filter(function(arcs) {\n return arcs.length > 0;\n })\n };\n }\n function bisect(a, x) {\n var lo = 0, hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (a[mid] < x) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n }\n function neighbors(objects) {\n var indexesByArc = {}, neighbors2 = objects.map(function() {\n return [];\n });\n function line(arcs, i2) {\n arcs.forEach(function(a) {\n if (a < 0) a = ~a;\n var o = indexesByArc[a];\n if (o) o.push(i2);\n else indexesByArc[a] = [i2];\n });\n }\n function polygon(arcs, i2) {\n arcs.forEach(function(arc) {\n line(arc, i2);\n });\n }\n function geometry(o, i2) {\n if (o.type === \"GeometryCollection\") o.geometries.forEach(function(o2) {\n geometry(o2, i2);\n });\n else if (o.type in geometryType) geometryType[o.type](o.arcs, i2);\n }\n var geometryType = {\n LineString: line,\n MultiLineString: polygon,\n Polygon: polygon,\n MultiPolygon: function(arcs, i2) {\n arcs.forEach(function(arc) {\n polygon(arc, i2);\n });\n }\n };\n objects.forEach(geometry);\n for (var i in indexesByArc) {\n for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) {\n for (var k = j + 1; k < m; ++k) {\n var ij = indexes[j], ik = indexes[k], n;\n if ((n = neighbors2[ij])[i = bisect(n, ik)] !== ik) n.splice(i, 0, ik);\n if ((n = neighbors2[ik])[i = bisect(n, ij)] !== ij) n.splice(i, 0, ij);\n }\n }\n }\n return neighbors2;\n }\n function untransform(transform2) {\n if (transform2 == null) return identity2;\n var x0, y0, kx = transform2.scale[0], ky = transform2.scale[1], dx = transform2.translate[0], dy = transform2.translate[1];\n return function(input, i) {\n if (!i) x0 = y0 = 0;\n var j = 2, n = input.length, output = new Array(n), x1 = Math.round((input[0] - dx) / kx), y1 = Math.round((input[1] - dy) / ky);\n output[0] = x1 - x0, x0 = x1;\n output[1] = y1 - y0, y0 = y1;\n while (j < n) output[j] = input[j], ++j;\n return output;\n };\n }\n function quantize(topology, transform2) {\n if (topology.transform) throw new Error(\"already quantized\");\n if (!transform2 || !transform2.scale) {\n if (!((n = Math.floor(transform2)) >= 2)) throw new Error(\"n must be \\u22652\");\n box = topology.bbox || bbox(topology);\n var x0 = box[0], y0 = box[1], x1 = box[2], y1 = box[3], n;\n transform2 = { scale: [x1 - x0 ? (x1 - x0) / (n - 1) : 1, y1 - y0 ? (y1 - y0) / (n - 1) : 1], translate: [x0, y0] };\n } else {\n box = topology.bbox;\n }\n var t = untransform(transform2), box, key, inputs = topology.objects, outputs = {};\n function quantizePoint(point) {\n return t(point);\n }\n function quantizeGeometry(input) {\n var output;\n switch (input.type) {\n case \"GeometryCollection\":\n output = { type: \"GeometryCollection\", geometries: input.geometries.map(quantizeGeometry) };\n break;\n case \"Point\":\n output = { type: \"Point\", coordinates: quantizePoint(input.coordinates) };\n break;\n case \"MultiPoint\":\n output = { type: \"MultiPoint\", coordinates: input.coordinates.map(quantizePoint) };\n break;\n default:\n return input;\n }\n if (input.id != null) output.id = input.id;\n if (input.bbox != null) output.bbox = input.bbox;\n if (input.properties != null) output.properties = input.properties;\n return output;\n }\n function quantizeArc(input) {\n var i = 0, j = 1, n2 = input.length, p, output = new Array(n2);\n output[0] = t(input[0], 0);\n while (++i < n2) if ((p = t(input[i], i))[0] || p[1]) output[j++] = p;\n if (j === 1) output[j++] = [0, 0];\n output.length = j;\n return output;\n }\n for (key in inputs) outputs[key] = quantizeGeometry(inputs[key]);\n return {\n type: \"Topology\",\n bbox: box,\n transform: transform2,\n objects: outputs,\n arcs: topology.arcs.map(quantizeArc)\n };\n }\n exports2.bbox = bbox;\n exports2.feature = feature;\n exports2.merge = merge;\n exports2.mergeArcs = mergeArcs;\n exports2.mesh = mesh;\n exports2.meshArcs = meshArcs;\n exports2.neighbors = neighbors;\n exports2.quantize = quantize;\n exports2.transform = transform;\n exports2.untransform = untransform;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // src/lib/topojson_utils.js\n var require_topojson_utils = __commonJS({\n \"src/lib/topojson_utils.js\"(exports, module) {\n \"use strict\";\n var topojsonUtils = module.exports = {};\n var locationmodeToLayer = require_constants22().locationmodeToLayer;\n var topojsonFeature = require_topojson_client().feature;\n topojsonUtils.getTopojsonName = function(geoLayout) {\n return [\n geoLayout.scope.replace(/ /g, \"-\"),\n \"_\",\n geoLayout.resolution.toString(),\n \"m\"\n ].join(\"\");\n };\n topojsonUtils.getTopojsonPath = function(topojsonURL, topojsonName) {\n return topojsonURL + topojsonName + \".json\";\n };\n topojsonUtils.getTopojsonFeatures = function(trace, topojson) {\n var layer = locationmodeToLayer[trace.locationmode];\n var obj = topojson.objects[layer];\n return topojsonFeature(topojson, obj).features;\n };\n }\n });\n\n // src/lib/geojson_utils.js\n var require_geojson_utils = __commonJS({\n \"src/lib/geojson_utils.js\"(exports) {\n \"use strict\";\n var BADNUM = require_numerical().BADNUM;\n exports.calcTraceToLineCoords = function(calcTrace) {\n var trace = calcTrace[0].trace;\n var connectgaps = trace.connectgaps;\n var coords = [];\n var lineString = [];\n for (var i = 0; i < calcTrace.length; i++) {\n var calcPt = calcTrace[i];\n var lonlat = calcPt.lonlat;\n if (lonlat[0] !== BADNUM) {\n lineString.push(lonlat);\n } else if (!connectgaps && lineString.length > 0) {\n coords.push(lineString);\n lineString = [];\n }\n }\n if (lineString.length > 0) {\n coords.push(lineString);\n }\n return coords;\n };\n exports.makeLine = function(coords) {\n if (coords.length === 1) {\n return {\n type: \"LineString\",\n coordinates: coords[0]\n };\n } else {\n return {\n type: \"MultiLineString\",\n coordinates: coords\n };\n }\n };\n exports.makePolygon = function(coords) {\n if (coords.length === 1) {\n return {\n type: \"Polygon\",\n coordinates: coords\n };\n } else {\n var _coords = new Array(coords.length);\n for (var i = 0; i < coords.length; i++) {\n _coords[i] = [coords[i]];\n }\n return {\n type: \"MultiPolygon\",\n coordinates: _coords\n };\n }\n };\n exports.makeBlank = function() {\n return {\n type: \"Point\",\n coordinates: []\n };\n };\n }\n });\n\n // node_modules/country-regex/index.js\n var require_country_regex = __commonJS({\n \"node_modules/country-regex/index.js\"(exports, module) {\n module.exports = {\n AFG: \"afghan\",\n ALA: \"\\\\b\\\\wland\",\n ALB: \"albania\",\n DZA: \"algeria\",\n ASM: \"^(?=.*americ).*samoa\",\n AND: \"andorra\",\n AGO: \"angola\",\n AIA: \"anguill?a\",\n ATA: \"antarctica\",\n ATG: \"antigua\",\n ARG: \"argentin\",\n ARM: \"armenia\",\n ABW: \"^(?!.*bonaire).*\\\\baruba\",\n AUS: \"australia\",\n AUT: \"^(?!.*hungary).*austria|\\\\baustri.*\\\\bemp\",\n AZE: \"azerbaijan\",\n BHS: \"bahamas\",\n BHR: \"bahrain\",\n BGD: \"bangladesh|^(?=.*east).*paki?stan\",\n BRB: \"barbados\",\n BLR: \"belarus|byelo\",\n BEL: \"^(?!.*luxem).*belgium\",\n BLZ: \"belize|^(?=.*british).*honduras\",\n BEN: \"benin|dahome\",\n BMU: \"bermuda\",\n BTN: \"bhutan\",\n BOL: \"bolivia\",\n BES: \"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\\\bbes.?islands\",\n BIH: \"herzegovina|bosnia\",\n BWA: \"botswana|bechuana\",\n BVT: \"bouvet\",\n BRA: \"brazil\",\n IOT: \"british.?indian.?ocean\",\n BRN: \"brunei\",\n BGR: \"bulgaria\",\n BFA: \"burkina|\\\\bfaso|upper.?volta\",\n BDI: \"burundi\",\n CPV: \"verde\",\n KHM: \"cambodia|kampuchea|khmer\",\n CMR: \"cameroon\",\n CAN: \"canada\",\n CYM: \"cayman\",\n CAF: \"\\\\bcentral.african.republic\",\n TCD: \"\\\\bchad\",\n CHL: \"\\\\bchile\",\n CHN: \"^(?!.*\\\\bmac)(?!.*\\\\bhong)(?!.*\\\\btai)(?!.*\\\\brep).*china|^(?=.*peo)(?=.*rep).*china\",\n CXR: \"christmas\",\n CCK: \"\\\\bcocos|keeling\",\n COL: \"colombia\",\n COM: \"comoro\",\n COG: \"^(?!.*\\\\bdem)(?!.*\\\\bd[\\\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\\\bcongo\",\n COK: \"\\\\bcook\",\n CRI: \"costa.?rica\",\n CIV: \"ivoire|ivory\",\n HRV: \"croatia\",\n CUB: \"\\\\bcuba\",\n CUW: \"^(?!.*bonaire).*\\\\bcura(c|\\xE7)ao\",\n CYP: \"cyprus\",\n CSK: \"czechoslovakia\",\n CZE: \"^(?=.*rep).*czech|czechia|bohemia\",\n COD: \"\\\\bdem.*congo|congo.*\\\\bdem|congo.*\\\\bd[\\\\.]?r|\\\\bd[\\\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc\",\n DNK: \"denmark\",\n DJI: \"djibouti\",\n DMA: \"dominica(?!n)\",\n DOM: \"dominican.rep\",\n ECU: \"ecuador\",\n EGY: \"egypt\",\n SLV: \"el.?salvador\",\n GNQ: \"guine.*eq|eq.*guine|^(?=.*span).*guinea\",\n ERI: \"eritrea\",\n EST: \"estonia\",\n ETH: \"ethiopia|abyssinia\",\n FLK: \"falkland|malvinas\",\n FRO: \"faroe|faeroe\",\n FJI: \"fiji\",\n FIN: \"finland\",\n FRA: \"^(?!.*\\\\bdep)(?!.*martinique).*france|french.?republic|\\\\bgaul\",\n GUF: \"^(?=.*french).*guiana\",\n PYF: \"french.?polynesia|tahiti\",\n ATF: \"french.?southern\",\n GAB: \"gabon\",\n GMB: \"gambia\",\n GEO: \"^(?!.*south).*georgia\",\n DDR: \"german.?democratic.?republic|democratic.?republic.*germany|east.germany\",\n DEU: \"^(?!.*east).*germany|^(?=.*\\\\bfed.*\\\\brep).*german\",\n GHA: \"ghana|gold.?coast\",\n GIB: \"gibraltar\",\n GRC: \"greece|hellenic|hellas\",\n GRL: \"greenland\",\n GRD: \"grenada\",\n GLP: \"guadeloupe\",\n GUM: \"\\\\bguam\",\n GTM: \"guatemala\",\n GGY: \"guernsey\",\n GIN: \"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea\",\n GNB: \"bissau|^(?=.*portu).*guinea\",\n GUY: \"guyana|british.?guiana\",\n HTI: \"haiti\",\n HMD: \"heard.*mcdonald\",\n VAT: \"holy.?see|vatican|papal.?st\",\n HND: \"^(?!.*brit).*honduras\",\n HKG: \"hong.?kong\",\n HUN: \"^(?!.*austr).*hungary\",\n ISL: \"iceland\",\n IND: \"india(?!.*ocea)\",\n IDN: \"indonesia\",\n IRN: \"\\\\biran|persia\",\n IRQ: \"\\\\biraq|mesopotamia\",\n IRL: \"(^ireland)|(^republic.*ireland)\",\n IMN: \"^(?=.*isle).*\\\\bman\",\n ISR: \"israel\",\n ITA: \"italy\",\n JAM: \"jamaica\",\n JPN: \"japan\",\n JEY: \"jersey\",\n JOR: \"jordan\",\n KAZ: \"kazak\",\n KEN: \"kenya|british.?east.?africa|east.?africa.?prot\",\n KIR: \"kiribati\",\n PRK: \"^(?=.*democrat|people|north|d.*p.*.r).*\\\\bkorea|dprk|korea.*(d.*p.*r)\",\n KWT: \"kuwait\",\n KGZ: \"kyrgyz|kirghiz\",\n LAO: \"\\\\blaos?\\\\b\",\n LVA: \"latvia\",\n LBN: \"lebanon\",\n LSO: \"lesotho|basuto\",\n LBR: \"liberia\",\n LBY: \"libya\",\n LIE: \"liechtenstein\",\n LTU: \"lithuania\",\n LUX: \"^(?!.*belg).*luxem\",\n MAC: \"maca(o|u)\",\n MDG: \"madagascar|malagasy\",\n MWI: \"malawi|nyasa\",\n MYS: \"malaysia\",\n MDV: \"maldive\",\n MLI: \"\\\\bmali\\\\b\",\n MLT: \"\\\\bmalta\",\n MHL: \"marshall\",\n MTQ: \"martinique\",\n MRT: \"mauritania\",\n MUS: \"mauritius\",\n MYT: \"\\\\bmayotte\",\n MEX: \"\\\\bmexic\",\n FSM: \"fed.*micronesia|micronesia.*fed\",\n MCO: \"monaco\",\n MNG: \"mongolia\",\n MNE: \"^(?!.*serbia).*montenegro\",\n MSR: \"montserrat\",\n MAR: \"morocco|\\\\bmaroc\",\n MOZ: \"mozambique\",\n MMR: \"myanmar|burma\",\n NAM: \"namibia\",\n NRU: \"nauru\",\n NPL: \"nepal\",\n NLD: \"^(?!.*\\\\bant)(?!.*\\\\bcarib).*netherlands\",\n ANT: \"^(?=.*\\\\bant).*(nether|dutch)\",\n NCL: \"new.?caledonia\",\n NZL: \"new.?zealand\",\n NIC: \"nicaragua\",\n NER: \"\\\\bniger(?!ia)\",\n NGA: \"nigeria\",\n NIU: \"niue\",\n NFK: \"norfolk\",\n MNP: \"mariana\",\n NOR: \"norway\",\n OMN: \"\\\\boman|trucial\",\n PAK: \"^(?!.*east).*paki?stan\",\n PLW: \"palau\",\n PSE: \"palestin|\\\\bgaza|west.?bank\",\n PAN: \"panama\",\n PNG: \"papua|new.?guinea\",\n PRY: \"paraguay\",\n PER: \"peru\",\n PHL: \"philippines\",\n PCN: \"pitcairn\",\n POL: \"poland\",\n PRT: \"portugal\",\n PRI: \"puerto.?rico\",\n QAT: \"qatar\",\n KOR: \"^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\\\bkorea(?!.*d.*p.*r)\",\n MDA: \"moldov|b(a|e)ssarabia\",\n REU: \"r(e|\\xE9)union\",\n ROU: \"r(o|u|ou)mania\",\n RUS: \"\\\\brussia|soviet.?union|u\\\\.?s\\\\.?s\\\\.?r|socialist.?republics\",\n RWA: \"rwanda\",\n BLM: \"barth(e|\\xE9)lemy\",\n SHN: \"helena\",\n KNA: \"kitts|\\\\bnevis\",\n LCA: \"\\\\blucia\",\n MAF: \"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)\",\n SPM: \"miquelon\",\n VCT: \"vincent\",\n WSM: \"^(?!.*amer).*samoa\",\n SMR: \"san.?marino\",\n STP: \"\\\\bs(a|\\xE3)o.?tom(e|\\xE9)\",\n SAU: \"\\\\bsa\\\\w*.?arabia\",\n SEN: \"senegal\",\n SRB: \"^(?!.*monte).*serbia\",\n SYC: \"seychell\",\n SLE: \"sierra\",\n SGP: \"singapore\",\n SXM: \"^(?!.*martin)(?!.*saba).*maarten\",\n SVK: \"^(?!.*cze).*slovak\",\n SVN: \"slovenia\",\n SLB: \"solomon\",\n SOM: \"somali\",\n ZAF: \"south.africa|s\\\\\\\\..?africa\",\n SGS: \"south.?georgia|sandwich\",\n SSD: \"\\\\bs\\\\w*.?sudan\",\n ESP: \"spain\",\n LKA: \"sri.?lanka|ceylon\",\n SDN: \"^(?!.*\\\\bs(?!u)).*sudan\",\n SUR: \"surinam|dutch.?guiana\",\n SJM: \"svalbard\",\n SWZ: \"swaziland\",\n SWE: \"sweden\",\n CHE: \"switz|swiss\",\n SYR: \"syria\",\n TWN: \"taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china\",\n TJK: \"tajik\",\n THA: \"thailand|\\\\bsiam\",\n MKD: \"macedonia|fyrom\",\n TLS: \"^(?=.*leste).*timor|^(?=.*east).*timor\",\n TGO: \"togo\",\n TKL: \"tokelau\",\n TON: \"tonga\",\n TTO: \"trinidad|tobago\",\n TUN: \"tunisia\",\n TUR: \"turkey\",\n TKM: \"turkmen\",\n TCA: \"turks\",\n TUV: \"tuvalu\",\n UGA: \"uganda\",\n UKR: \"ukrain\",\n ARE: \"emirates|^u\\\\.?a\\\\.?e\\\\.?$|united.?arab.?em\",\n GBR: \"united.?kingdom|britain|^u\\\\.?k\\\\.?$\",\n TZA: \"tanzania\",\n USA: \"united.?states\\\\b(?!.*islands)|\\\\bu\\\\.?s\\\\.?a\\\\.?\\\\b|^\\\\s*u\\\\.?s\\\\.?\\\\b(?!.*islands)\",\n UMI: \"minor.?outlying.?is\",\n URY: \"uruguay\",\n UZB: \"uzbek\",\n VUT: \"vanuatu|new.?hebrides\",\n VEN: \"venezuela\",\n VNM: \"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam\",\n VGB: \"^(?=.*\\\\bu\\\\.?\\\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin\",\n VIR: \"^(?=.*\\\\bu\\\\.?\\\\s?s).*virgin|^(?=.*states).*virgin\",\n WLF: \"futuna|wallis\",\n ESH: \"western.sahara\",\n YEM: \"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\\\bp\\\\.?d\\\\.?r).*yemen\",\n YMD: \"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\\\bp\\\\.?d\\\\.?r).*yemen\",\n YUG: \"yugoslavia\",\n ZMB: \"zambia|northern.?rhodesia\",\n EAZ: \"zanzibar\",\n ZWE: \"zimbabwe|^(?!.*northern).*rhodesia\"\n };\n }\n });\n\n // node_modules/@turf/helpers/dist/cjs/index.cjs\n var require_cjs = __commonJS({\n \"node_modules/@turf/helpers/dist/cjs/index.cjs\"(exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var earthRadius = 63710088e-1;\n var factors = {\n centimeters: earthRadius * 100,\n centimetres: earthRadius * 100,\n degrees: 360 / (2 * Math.PI),\n feet: earthRadius * 3.28084,\n inches: earthRadius * 39.37,\n kilometers: earthRadius / 1e3,\n kilometres: earthRadius / 1e3,\n meters: earthRadius,\n metres: earthRadius,\n miles: earthRadius / 1609.344,\n millimeters: earthRadius * 1e3,\n millimetres: earthRadius * 1e3,\n nauticalmiles: earthRadius / 1852,\n radians: 1,\n yards: earthRadius * 1.0936\n };\n var areaFactors = {\n acres: 247105e-9,\n centimeters: 1e4,\n centimetres: 1e4,\n feet: 10.763910417,\n hectares: 1e-4,\n inches: 1550.003100006,\n kilometers: 1e-6,\n kilometres: 1e-6,\n meters: 1,\n metres: 1,\n miles: 386e-9,\n nauticalmiles: 29155334959812285e-23,\n millimeters: 1e6,\n millimetres: 1e6,\n yards: 1.195990046\n };\n function feature(geom, properties, options = {}) {\n const feat = { type: \"Feature\" };\n if (options.id === 0 || options.id) {\n feat.id = options.id;\n }\n if (options.bbox) {\n feat.bbox = options.bbox;\n }\n feat.properties = properties || {};\n feat.geometry = geom;\n return feat;\n }\n function geometry(type, coordinates, _options = {}) {\n switch (type) {\n case \"Point\":\n return point(coordinates).geometry;\n case \"LineString\":\n return lineString(coordinates).geometry;\n case \"Polygon\":\n return polygon(coordinates).geometry;\n case \"MultiPoint\":\n return multiPoint(coordinates).geometry;\n case \"MultiLineString\":\n return multiLineString(coordinates).geometry;\n case \"MultiPolygon\":\n return multiPolygon(coordinates).geometry;\n default:\n throw new Error(type + \" is invalid\");\n }\n }\n function point(coordinates, properties, options = {}) {\n if (!coordinates) {\n throw new Error(\"coordinates is required\");\n }\n if (!Array.isArray(coordinates)) {\n throw new Error(\"coordinates must be an Array\");\n }\n if (coordinates.length < 2) {\n throw new Error(\"coordinates must be at least 2 numbers long\");\n }\n if (!isNumber(coordinates[0]) || !isNumber(coordinates[1])) {\n throw new Error(\"coordinates must contain numbers\");\n }\n const geom = {\n type: \"Point\",\n coordinates\n };\n return feature(geom, properties, options);\n }\n function points(coordinates, properties, options = {}) {\n return featureCollection(\n coordinates.map((coords) => {\n return point(coords, properties);\n }),\n options\n );\n }\n function polygon(coordinates, properties, options = {}) {\n for (const ring of coordinates) {\n if (ring.length < 4) {\n throw new Error(\n \"Each LinearRing of a Polygon must have 4 or more Positions.\"\n );\n }\n if (ring[ring.length - 1].length !== ring[0].length) {\n throw new Error(\"First and last Position are not equivalent.\");\n }\n for (let j = 0; j < ring[ring.length - 1].length; j++) {\n if (ring[ring.length - 1][j] !== ring[0][j]) {\n throw new Error(\"First and last Position are not equivalent.\");\n }\n }\n }\n const geom = {\n type: \"Polygon\",\n coordinates\n };\n return feature(geom, properties, options);\n }\n function polygons(coordinates, properties, options = {}) {\n return featureCollection(\n coordinates.map((coords) => {\n return polygon(coords, properties);\n }),\n options\n );\n }\n function lineString(coordinates, properties, options = {}) {\n if (coordinates.length < 2) {\n throw new Error(\"coordinates must be an array of two or more positions\");\n }\n const geom = {\n type: \"LineString\",\n coordinates\n };\n return feature(geom, properties, options);\n }\n function lineStrings(coordinates, properties, options = {}) {\n return featureCollection(\n coordinates.map((coords) => {\n return lineString(coords, properties);\n }),\n options\n );\n }\n function featureCollection(features, options = {}) {\n const fc = { type: \"FeatureCollection\" };\n if (options.id) {\n fc.id = options.id;\n }\n if (options.bbox) {\n fc.bbox = options.bbox;\n }\n fc.features = features;\n return fc;\n }\n function multiLineString(coordinates, properties, options = {}) {\n const geom = {\n type: \"MultiLineString\",\n coordinates\n };\n return feature(geom, properties, options);\n }\n function multiPoint(coordinates, properties, options = {}) {\n const geom = {\n type: \"MultiPoint\",\n coordinates\n };\n return feature(geom, properties, options);\n }\n function multiPolygon(coordinates, properties, options = {}) {\n const geom = {\n type: \"MultiPolygon\",\n coordinates\n };\n return feature(geom, properties, options);\n }\n function geometryCollection(geometries, properties, options = {}) {\n const geom = {\n type: \"GeometryCollection\",\n geometries\n };\n return feature(geom, properties, options);\n }\n function round(num, precision = 0) {\n if (precision && !(precision >= 0)) {\n throw new Error(\"precision must be a positive number\");\n }\n const multiplier = Math.pow(10, precision || 0);\n return Math.round(num * multiplier) / multiplier;\n }\n function radiansToLength(radians2, units = \"kilometers\") {\n const factor = factors[units];\n if (!factor) {\n throw new Error(units + \" units is invalid\");\n }\n return radians2 * factor;\n }\n function lengthToRadians(distance, units = \"kilometers\") {\n const factor = factors[units];\n if (!factor) {\n throw new Error(units + \" units is invalid\");\n }\n return distance / factor;\n }\n function lengthToDegrees(distance, units) {\n return radiansToDegrees(lengthToRadians(distance, units));\n }\n function bearingToAzimuth(bearing) {\n let angle = bearing % 360;\n if (angle < 0) {\n angle += 360;\n }\n return angle;\n }\n function azimuthToBearing(angle) {\n angle = angle % 360;\n if (angle > 0)\n return angle > 180 ? angle - 360 : angle;\n return angle < -180 ? angle + 360 : angle;\n }\n function radiansToDegrees(radians2) {\n const degrees3 = radians2 % (2 * Math.PI);\n return degrees3 * 180 / Math.PI;\n }\n function degreesToRadians(degrees3) {\n const radians2 = degrees3 % 360;\n return radians2 * Math.PI / 180;\n }\n function convertLength(length, originalUnit = \"kilometers\", finalUnit = \"kilometers\") {\n if (!(length >= 0)) {\n throw new Error(\"length must be a positive number\");\n }\n return radiansToLength(lengthToRadians(length, originalUnit), finalUnit);\n }\n function convertArea(area, originalUnit = \"meters\", finalUnit = \"kilometers\") {\n if (!(area >= 0)) {\n throw new Error(\"area must be a positive number\");\n }\n const startFactor = areaFactors[originalUnit];\n if (!startFactor) {\n throw new Error(\"invalid original units\");\n }\n const finalFactor = areaFactors[finalUnit];\n if (!finalFactor) {\n throw new Error(\"invalid final units\");\n }\n return area / startFactor * finalFactor;\n }\n function isNumber(num) {\n return !isNaN(num) && num !== null && !Array.isArray(num);\n }\n function isObject(input) {\n return input !== null && typeof input === \"object\" && !Array.isArray(input);\n }\n function validateBBox(bbox) {\n if (!bbox) {\n throw new Error(\"bbox is required\");\n }\n if (!Array.isArray(bbox)) {\n throw new Error(\"bbox must be an Array\");\n }\n if (bbox.length !== 4 && bbox.length !== 6) {\n throw new Error(\"bbox must be an Array of 4 or 6 numbers\");\n }\n bbox.forEach((num) => {\n if (!isNumber(num)) {\n throw new Error(\"bbox must only contain numbers\");\n }\n });\n }\n function validateId(id) {\n if (!id) {\n throw new Error(\"id is required\");\n }\n if ([\"string\", \"number\"].indexOf(typeof id) === -1) {\n throw new Error(\"id must be a number or a string\");\n }\n }\n exports.areaFactors = areaFactors;\n exports.azimuthToBearing = azimuthToBearing;\n exports.bearingToAzimuth = bearingToAzimuth;\n exports.convertArea = convertArea;\n exports.convertLength = convertLength;\n exports.degreesToRadians = degreesToRadians;\n exports.earthRadius = earthRadius;\n exports.factors = factors;\n exports.feature = feature;\n exports.featureCollection = featureCollection;\n exports.geometry = geometry;\n exports.geometryCollection = geometryCollection;\n exports.isNumber = isNumber;\n exports.isObject = isObject;\n exports.lengthToDegrees = lengthToDegrees;\n exports.lengthToRadians = lengthToRadians;\n exports.lineString = lineString;\n exports.lineStrings = lineStrings;\n exports.multiLineString = multiLineString;\n exports.multiPoint = multiPoint;\n exports.multiPolygon = multiPolygon;\n exports.point = point;\n exports.points = points;\n exports.polygon = polygon;\n exports.polygons = polygons;\n exports.radiansToDegrees = radiansToDegrees;\n exports.radiansToLength = radiansToLength;\n exports.round = round;\n exports.validateBBox = validateBBox;\n exports.validateId = validateId;\n }\n });\n\n // node_modules/@turf/meta/dist/cjs/index.cjs\n var require_cjs2 = __commonJS({\n \"node_modules/@turf/meta/dist/cjs/index.cjs\"(exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var _helpers = require_cjs();\n function coordEach(geojson, callback, excludeWrapCoord) {\n if (geojson === null)\n return;\n var j, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === \"FeatureCollection\", isFeature = type === \"Feature\", stop = isFeatureCollection ? geojson.features.length : 1;\n for (var featureIndex = 0; featureIndex < stop; featureIndex++) {\n geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;\n isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === \"GeometryCollection\" : false;\n stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;\n for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {\n var multiFeatureIndex = 0;\n var geometryIndex = 0;\n geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;\n if (geometry === null)\n continue;\n coords = geometry.coordinates;\n var geomType = geometry.type;\n wrapShrink = excludeWrapCoord && (geomType === \"Polygon\" || geomType === \"MultiPolygon\") ? 1 : 0;\n switch (geomType) {\n case null:\n break;\n case \"Point\":\n if (callback(\n coords,\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false)\n return false;\n coordIndex++;\n multiFeatureIndex++;\n break;\n case \"LineString\":\n case \"MultiPoint\":\n for (j = 0; j < coords.length; j++) {\n if (callback(\n coords[j],\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false)\n return false;\n coordIndex++;\n if (geomType === \"MultiPoint\")\n multiFeatureIndex++;\n }\n if (geomType === \"LineString\")\n multiFeatureIndex++;\n break;\n case \"Polygon\":\n case \"MultiLineString\":\n for (j = 0; j < coords.length; j++) {\n for (k = 0; k < coords[j].length - wrapShrink; k++) {\n if (callback(\n coords[j][k],\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false)\n return false;\n coordIndex++;\n }\n if (geomType === \"MultiLineString\")\n multiFeatureIndex++;\n if (geomType === \"Polygon\")\n geometryIndex++;\n }\n if (geomType === \"Polygon\")\n multiFeatureIndex++;\n break;\n case \"MultiPolygon\":\n for (j = 0; j < coords.length; j++) {\n geometryIndex = 0;\n for (k = 0; k < coords[j].length; k++) {\n for (l = 0; l < coords[j][k].length - wrapShrink; l++) {\n if (callback(\n coords[j][k][l],\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false)\n return false;\n coordIndex++;\n }\n geometryIndex++;\n }\n multiFeatureIndex++;\n }\n break;\n case \"GeometryCollection\":\n for (j = 0; j < geometry.geometries.length; j++)\n if (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false)\n return false;\n break;\n default:\n throw new Error(\"Unknown Geometry Type\");\n }\n }\n }\n }\n function coordReduce(geojson, callback, initialValue, excludeWrapCoord) {\n var previousValue = initialValue;\n coordEach(\n geojson,\n function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {\n if (coordIndex === 0 && initialValue === void 0)\n previousValue = currentCoord;\n else\n previousValue = callback(\n previousValue,\n currentCoord,\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n );\n },\n excludeWrapCoord\n );\n return previousValue;\n }\n function propEach(geojson, callback) {\n var i;\n switch (geojson.type) {\n case \"FeatureCollection\":\n for (i = 0; i < geojson.features.length; i++) {\n if (callback(geojson.features[i].properties, i) === false)\n break;\n }\n break;\n case \"Feature\":\n callback(geojson.properties, 0);\n break;\n }\n }\n function propReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n propEach(geojson, function(currentProperties, featureIndex) {\n if (featureIndex === 0 && initialValue === void 0)\n previousValue = currentProperties;\n else\n previousValue = callback(previousValue, currentProperties, featureIndex);\n });\n return previousValue;\n }\n function featureEach(geojson, callback) {\n if (geojson.type === \"Feature\") {\n callback(geojson, 0);\n } else if (geojson.type === \"FeatureCollection\") {\n for (var i = 0; i < geojson.features.length; i++) {\n if (callback(geojson.features[i], i) === false)\n break;\n }\n }\n }\n function featureReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n featureEach(geojson, function(currentFeature, featureIndex) {\n if (featureIndex === 0 && initialValue === void 0)\n previousValue = currentFeature;\n else\n previousValue = callback(previousValue, currentFeature, featureIndex);\n });\n return previousValue;\n }\n function coordAll(geojson) {\n var coords = [];\n coordEach(geojson, function(coord) {\n coords.push(coord);\n });\n return coords;\n }\n function geomEach(geojson, callback) {\n var i, j, g, geometry, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId, featureIndex = 0, isFeatureCollection = geojson.type === \"FeatureCollection\", isFeature = geojson.type === \"Feature\", stop = isFeatureCollection ? geojson.features.length : 1;\n for (i = 0; i < stop; i++) {\n geometryMaybeCollection = isFeatureCollection ? geojson.features[i].geometry : isFeature ? geojson.geometry : geojson;\n featureProperties = isFeatureCollection ? geojson.features[i].properties : isFeature ? geojson.properties : {};\n featureBBox = isFeatureCollection ? geojson.features[i].bbox : isFeature ? geojson.bbox : void 0;\n featureId = isFeatureCollection ? geojson.features[i].id : isFeature ? geojson.id : void 0;\n isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === \"GeometryCollection\" : false;\n stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;\n for (g = 0; g < stopG; g++) {\n geometry = isGeometryCollection ? geometryMaybeCollection.geometries[g] : geometryMaybeCollection;\n if (geometry === null) {\n if (callback(\n null,\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n ) === false)\n return false;\n continue;\n }\n switch (geometry.type) {\n case \"Point\":\n case \"LineString\":\n case \"MultiPoint\":\n case \"Polygon\":\n case \"MultiLineString\":\n case \"MultiPolygon\": {\n if (callback(\n geometry,\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n ) === false)\n return false;\n break;\n }\n case \"GeometryCollection\": {\n for (j = 0; j < geometry.geometries.length; j++) {\n if (callback(\n geometry.geometries[j],\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n ) === false)\n return false;\n }\n break;\n }\n default:\n throw new Error(\"Unknown Geometry Type\");\n }\n }\n featureIndex++;\n }\n }\n function geomReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n geomEach(\n geojson,\n function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId) {\n if (featureIndex === 0 && initialValue === void 0)\n previousValue = currentGeometry;\n else\n previousValue = callback(\n previousValue,\n currentGeometry,\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n );\n }\n );\n return previousValue;\n }\n function flattenEach(geojson, callback) {\n geomEach(geojson, function(geometry, featureIndex, properties, bbox, id) {\n var type = geometry === null ? null : geometry.type;\n switch (type) {\n case null:\n case \"Point\":\n case \"LineString\":\n case \"Polygon\":\n if (callback(\n _helpers.feature.call(void 0, geometry, properties, { bbox, id }),\n featureIndex,\n 0\n ) === false)\n return false;\n return;\n }\n var geomType;\n switch (type) {\n case \"MultiPoint\":\n geomType = \"Point\";\n break;\n case \"MultiLineString\":\n geomType = \"LineString\";\n break;\n case \"MultiPolygon\":\n geomType = \"Polygon\";\n break;\n }\n for (var multiFeatureIndex = 0; multiFeatureIndex < geometry.coordinates.length; multiFeatureIndex++) {\n var coordinate = geometry.coordinates[multiFeatureIndex];\n var geom = {\n type: geomType,\n coordinates: coordinate\n };\n if (callback(_helpers.feature.call(void 0, geom, properties), featureIndex, multiFeatureIndex) === false)\n return false;\n }\n });\n }\n function flattenReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n flattenEach(\n geojson,\n function(currentFeature, featureIndex, multiFeatureIndex) {\n if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)\n previousValue = currentFeature;\n else\n previousValue = callback(\n previousValue,\n currentFeature,\n featureIndex,\n multiFeatureIndex\n );\n }\n );\n return previousValue;\n }\n function segmentEach(geojson, callback) {\n flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {\n var segmentIndex = 0;\n if (!feature2.geometry)\n return;\n var type = feature2.geometry.type;\n if (type === \"Point\" || type === \"MultiPoint\")\n return;\n var previousCoords;\n var previousFeatureIndex = 0;\n var previousMultiIndex = 0;\n var prevGeomIndex = 0;\n if (coordEach(\n feature2,\n function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {\n if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {\n previousCoords = currentCoord;\n previousFeatureIndex = featureIndex;\n previousMultiIndex = multiPartIndexCoord;\n prevGeomIndex = geometryIndex;\n segmentIndex = 0;\n return;\n }\n var currentSegment = _helpers.lineString.call(\n void 0,\n [previousCoords, currentCoord],\n feature2.properties\n );\n if (callback(\n currentSegment,\n featureIndex,\n multiFeatureIndex,\n geometryIndex,\n segmentIndex\n ) === false)\n return false;\n segmentIndex++;\n previousCoords = currentCoord;\n }\n ) === false)\n return false;\n });\n }\n function segmentReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n var started = false;\n segmentEach(\n geojson,\n function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {\n if (started === false && initialValue === void 0)\n previousValue = currentSegment;\n else\n previousValue = callback(\n previousValue,\n currentSegment,\n featureIndex,\n multiFeatureIndex,\n geometryIndex,\n segmentIndex\n );\n started = true;\n }\n );\n return previousValue;\n }\n function lineEach(geojson, callback) {\n if (!geojson)\n throw new Error(\"geojson is required\");\n flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {\n if (feature2.geometry === null)\n return;\n var type = feature2.geometry.type;\n var coords = feature2.geometry.coordinates;\n switch (type) {\n case \"LineString\":\n if (callback(feature2, featureIndex, multiFeatureIndex, 0, 0) === false)\n return false;\n break;\n case \"Polygon\":\n for (var geometryIndex = 0; geometryIndex < coords.length; geometryIndex++) {\n if (callback(\n _helpers.lineString.call(void 0, coords[geometryIndex], feature2.properties),\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false)\n return false;\n }\n break;\n }\n });\n }\n function lineReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n lineEach(\n geojson,\n function(currentLine, featureIndex, multiFeatureIndex, geometryIndex) {\n if (featureIndex === 0 && initialValue === void 0)\n previousValue = currentLine;\n else\n previousValue = callback(\n previousValue,\n currentLine,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n );\n }\n );\n return previousValue;\n }\n function findSegment(geojson, options) {\n options = options || {};\n if (!_helpers.isObject.call(void 0, options))\n throw new Error(\"options is invalid\");\n var featureIndex = options.featureIndex || 0;\n var multiFeatureIndex = options.multiFeatureIndex || 0;\n var geometryIndex = options.geometryIndex || 0;\n var segmentIndex = options.segmentIndex || 0;\n var properties = options.properties;\n var geometry;\n switch (geojson.type) {\n case \"FeatureCollection\":\n if (featureIndex < 0)\n featureIndex = geojson.features.length + featureIndex;\n properties = properties || geojson.features[featureIndex].properties;\n geometry = geojson.features[featureIndex].geometry;\n break;\n case \"Feature\":\n properties = properties || geojson.properties;\n geometry = geojson.geometry;\n break;\n case \"Point\":\n case \"MultiPoint\":\n return null;\n case \"LineString\":\n case \"Polygon\":\n case \"MultiLineString\":\n case \"MultiPolygon\":\n geometry = geojson;\n break;\n default:\n throw new Error(\"geojson is invalid\");\n }\n if (geometry === null)\n return null;\n var coords = geometry.coordinates;\n switch (geometry.type) {\n case \"Point\":\n case \"MultiPoint\":\n return null;\n case \"LineString\":\n if (segmentIndex < 0)\n segmentIndex = coords.length + segmentIndex - 1;\n return _helpers.lineString.call(\n void 0,\n [coords[segmentIndex], coords[segmentIndex + 1]],\n properties,\n options\n );\n case \"Polygon\":\n if (geometryIndex < 0)\n geometryIndex = coords.length + geometryIndex;\n if (segmentIndex < 0)\n segmentIndex = coords[geometryIndex].length + segmentIndex - 1;\n return _helpers.lineString.call(\n void 0,\n [\n coords[geometryIndex][segmentIndex],\n coords[geometryIndex][segmentIndex + 1]\n ],\n properties,\n options\n );\n case \"MultiLineString\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (segmentIndex < 0)\n segmentIndex = coords[multiFeatureIndex].length + segmentIndex - 1;\n return _helpers.lineString.call(\n void 0,\n [\n coords[multiFeatureIndex][segmentIndex],\n coords[multiFeatureIndex][segmentIndex + 1]\n ],\n properties,\n options\n );\n case \"MultiPolygon\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (geometryIndex < 0)\n geometryIndex = coords[multiFeatureIndex].length + geometryIndex;\n if (segmentIndex < 0)\n segmentIndex = coords[multiFeatureIndex][geometryIndex].length - segmentIndex - 1;\n return _helpers.lineString.call(\n void 0,\n [\n coords[multiFeatureIndex][geometryIndex][segmentIndex],\n coords[multiFeatureIndex][geometryIndex][segmentIndex + 1]\n ],\n properties,\n options\n );\n }\n throw new Error(\"geojson is invalid\");\n }\n function findPoint(geojson, options) {\n options = options || {};\n if (!_helpers.isObject.call(void 0, options))\n throw new Error(\"options is invalid\");\n var featureIndex = options.featureIndex || 0;\n var multiFeatureIndex = options.multiFeatureIndex || 0;\n var geometryIndex = options.geometryIndex || 0;\n var coordIndex = options.coordIndex || 0;\n var properties = options.properties;\n var geometry;\n switch (geojson.type) {\n case \"FeatureCollection\":\n if (featureIndex < 0)\n featureIndex = geojson.features.length + featureIndex;\n properties = properties || geojson.features[featureIndex].properties;\n geometry = geojson.features[featureIndex].geometry;\n break;\n case \"Feature\":\n properties = properties || geojson.properties;\n geometry = geojson.geometry;\n break;\n case \"Point\":\n case \"MultiPoint\":\n return null;\n case \"LineString\":\n case \"Polygon\":\n case \"MultiLineString\":\n case \"MultiPolygon\":\n geometry = geojson;\n break;\n default:\n throw new Error(\"geojson is invalid\");\n }\n if (geometry === null)\n return null;\n var coords = geometry.coordinates;\n switch (geometry.type) {\n case \"Point\":\n return _helpers.point.call(void 0, coords, properties, options);\n case \"MultiPoint\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n return _helpers.point.call(void 0, coords[multiFeatureIndex], properties, options);\n case \"LineString\":\n if (coordIndex < 0)\n coordIndex = coords.length + coordIndex;\n return _helpers.point.call(void 0, coords[coordIndex], properties, options);\n case \"Polygon\":\n if (geometryIndex < 0)\n geometryIndex = coords.length + geometryIndex;\n if (coordIndex < 0)\n coordIndex = coords[geometryIndex].length + coordIndex;\n return _helpers.point.call(void 0, coords[geometryIndex][coordIndex], properties, options);\n case \"MultiLineString\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (coordIndex < 0)\n coordIndex = coords[multiFeatureIndex].length + coordIndex;\n return _helpers.point.call(void 0, coords[multiFeatureIndex][coordIndex], properties, options);\n case \"MultiPolygon\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (geometryIndex < 0)\n geometryIndex = coords[multiFeatureIndex].length + geometryIndex;\n if (coordIndex < 0)\n coordIndex = coords[multiFeatureIndex][geometryIndex].length - coordIndex;\n return _helpers.point.call(\n void 0,\n coords[multiFeatureIndex][geometryIndex][coordIndex],\n properties,\n options\n );\n }\n throw new Error(\"geojson is invalid\");\n }\n exports.coordAll = coordAll;\n exports.coordEach = coordEach;\n exports.coordReduce = coordReduce;\n exports.featureEach = featureEach;\n exports.featureReduce = featureReduce;\n exports.findPoint = findPoint;\n exports.findSegment = findSegment;\n exports.flattenEach = flattenEach;\n exports.flattenReduce = flattenReduce;\n exports.geomEach = geomEach;\n exports.geomReduce = geomReduce;\n exports.lineEach = lineEach;\n exports.lineReduce = lineReduce;\n exports.propEach = propEach;\n exports.propReduce = propReduce;\n exports.segmentEach = segmentEach;\n exports.segmentReduce = segmentReduce;\n }\n });\n\n // node_modules/@turf/area/dist/cjs/index.cjs\n var require_cjs3 = __commonJS({\n \"node_modules/@turf/area/dist/cjs/index.cjs\"(exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var _helpers = require_cjs();\n var _meta = require_cjs2();\n function area(geojson) {\n return _meta.geomReduce.call(\n void 0,\n geojson,\n (value, geom) => {\n return value + calculateArea(geom);\n },\n 0\n );\n }\n function calculateArea(geom) {\n let total = 0;\n let i;\n switch (geom.type) {\n case \"Polygon\":\n return polygonArea(geom.coordinates);\n case \"MultiPolygon\":\n for (i = 0; i < geom.coordinates.length; i++) {\n total += polygonArea(geom.coordinates[i]);\n }\n return total;\n case \"Point\":\n case \"MultiPoint\":\n case \"LineString\":\n case \"MultiLineString\":\n return 0;\n }\n return 0;\n }\n function polygonArea(coords) {\n let total = 0;\n if (coords && coords.length > 0) {\n total += Math.abs(ringArea(coords[0]));\n for (let i = 1; i < coords.length; i++) {\n total -= Math.abs(ringArea(coords[i]));\n }\n }\n return total;\n }\n var FACTOR = _helpers.earthRadius * _helpers.earthRadius / 2;\n var PI_OVER_180 = Math.PI / 180;\n function ringArea(coords) {\n const coordsLength = coords.length - 1;\n if (coordsLength <= 2)\n return 0;\n let total = 0;\n let i = 0;\n while (i < coordsLength) {\n const lower = coords[i];\n const middle = coords[i + 1 === coordsLength ? 0 : i + 1];\n const upper = coords[i + 2 >= coordsLength ? (i + 2) % coordsLength : i + 2];\n const lowerX = lower[0] * PI_OVER_180;\n const middleY = middle[1] * PI_OVER_180;\n const upperX = upper[0] * PI_OVER_180;\n total += (upperX - lowerX) * Math.sin(middleY);\n i++;\n }\n return total * FACTOR;\n }\n var turf_area_default = area;\n exports.area = area;\n exports.default = turf_area_default;\n }\n });\n\n // node_modules/@turf/centroid/dist/cjs/index.cjs\n var require_cjs4 = __commonJS({\n \"node_modules/@turf/centroid/dist/cjs/index.cjs\"(exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var _helpers = require_cjs();\n var _meta = require_cjs2();\n function centroid(geojson, options = {}) {\n let xSum = 0;\n let ySum = 0;\n let len = 0;\n _meta.coordEach.call(\n void 0,\n geojson,\n function(coord) {\n xSum += coord[0];\n ySum += coord[1];\n len++;\n },\n true\n );\n return _helpers.point.call(void 0, [xSum / len, ySum / len], options.properties);\n }\n var turf_centroid_default = centroid;\n exports.centroid = centroid;\n exports.default = turf_centroid_default;\n }\n });\n\n // node_modules/@turf/bbox/dist/cjs/index.cjs\n var require_cjs5 = __commonJS({\n \"node_modules/@turf/bbox/dist/cjs/index.cjs\"(exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var _meta = require_cjs2();\n function bbox(geojson, options = {}) {\n if (geojson.bbox != null && true !== options.recompute) {\n return geojson.bbox;\n }\n const result = [Infinity, Infinity, -Infinity, -Infinity];\n _meta.coordEach.call(void 0, geojson, (coord) => {\n if (result[0] > coord[0]) {\n result[0] = coord[0];\n }\n if (result[1] > coord[1]) {\n result[1] = coord[1];\n }\n if (result[2] < coord[0]) {\n result[2] = coord[0];\n }\n if (result[3] < coord[1]) {\n result[3] = coord[1];\n }\n });\n return result;\n }\n var turf_bbox_default = bbox;\n exports.bbox = bbox;\n exports.default = turf_bbox_default;\n }\n });\n\n // src/lib/geo_location_utils.js\n var require_geo_location_utils = __commonJS({\n \"src/lib/geo_location_utils.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var countryRegex = require_country_regex();\n var { area: turfArea } = require_cjs3();\n var { centroid: turfCentroid } = require_cjs4();\n var { bbox: turfBbox } = require_cjs5();\n var identity2 = require_identity2();\n var loggers = require_loggers();\n var isPlainObject = require_is_plain_object();\n var nestedProperty = require_nested_property();\n var polygon = require_polygon();\n var countryIds = Object.keys(countryRegex);\n var locationmodeToIdFinder = {\n \"ISO-3\": identity2,\n \"USA-states\": identity2,\n \"country names\": countryNameToISO3\n };\n function countryNameToISO3(countryName) {\n for (var i = 0; i < countryIds.length; i++) {\n var iso3 = countryIds[i];\n var regex = new RegExp(countryRegex[iso3]);\n if (regex.test(countryName.trim().toLowerCase())) return iso3;\n }\n loggers.log(\"Unrecognized country name: \" + countryName + \".\");\n return false;\n }\n function locationToFeature(locationmode, location2, features) {\n if (!location2 || typeof location2 !== \"string\") return false;\n var locationId = locationmodeToIdFinder[locationmode](location2);\n var filteredFeatures;\n var f, i;\n if (locationId) {\n if (locationmode === \"USA-states\") {\n filteredFeatures = [];\n for (i = 0; i < features.length; i++) {\n f = features[i];\n if (f.properties && f.properties.gu && f.properties.gu === \"USA\") {\n filteredFeatures.push(f);\n }\n }\n } else {\n filteredFeatures = features;\n }\n for (i = 0; i < filteredFeatures.length; i++) {\n f = filteredFeatures[i];\n if (f.id === locationId) return f;\n }\n loggers.log([\n \"Location with id\",\n locationId,\n \"does not have a matching topojson feature at this resolution.\"\n ].join(\" \"));\n }\n return false;\n }\n function feature2polygons(feature) {\n var geometry = feature.geometry;\n var coords = geometry.coordinates;\n var loc = feature.id;\n var polygons = [];\n var appendPolygon, j, k, m;\n function doesCrossAntiMerdian(pts) {\n for (var l = 0; l < pts.length - 1; l++) {\n if (pts[l][0] > 0 && pts[l + 1][0] < 0) return l;\n }\n return null;\n }\n if (loc === \"RUS\" || loc === \"FJI\") {\n appendPolygon = function(_pts) {\n var pts;\n if (doesCrossAntiMerdian(_pts) === null) {\n pts = _pts;\n } else {\n pts = new Array(_pts.length);\n for (m = 0; m < _pts.length; m++) {\n pts[m] = [\n _pts[m][0] < 0 ? _pts[m][0] + 360 : _pts[m][0],\n _pts[m][1]\n ];\n }\n }\n polygons.push(polygon.tester(pts));\n };\n } else if (loc === \"ATA\") {\n appendPolygon = function(pts) {\n var crossAntiMeridianIndex = doesCrossAntiMerdian(pts);\n if (crossAntiMeridianIndex === null) {\n return polygons.push(polygon.tester(pts));\n }\n var stitch = new Array(pts.length + 1);\n var si = 0;\n for (m = 0; m < pts.length; m++) {\n if (m > crossAntiMeridianIndex) {\n stitch[si++] = [pts[m][0] + 360, pts[m][1]];\n } else if (m === crossAntiMeridianIndex) {\n stitch[si++] = pts[m];\n stitch[si++] = [pts[m][0], -90];\n } else {\n stitch[si++] = pts[m];\n }\n }\n var tester = polygon.tester(stitch);\n tester.pts.pop();\n polygons.push(tester);\n };\n } else {\n appendPolygon = function(pts) {\n polygons.push(polygon.tester(pts));\n };\n }\n switch (geometry.type) {\n case \"MultiPolygon\":\n for (j = 0; j < coords.length; j++) {\n for (k = 0; k < coords[j].length; k++) {\n appendPolygon(coords[j][k]);\n }\n }\n break;\n case \"Polygon\":\n for (j = 0; j < coords.length; j++) {\n appendPolygon(coords[j]);\n }\n break;\n }\n return polygons;\n }\n function getTraceGeojson(trace) {\n var g = trace.geojson;\n var PlotlyGeoAssets2 = window.PlotlyGeoAssets || {};\n var geojsonIn = typeof g === \"string\" ? PlotlyGeoAssets2[g] : g;\n if (!isPlainObject(geojsonIn)) {\n loggers.error(\"Oops ... something went wrong when fetching \" + g);\n return false;\n }\n return geojsonIn;\n }\n function extractTraceFeature(calcTrace) {\n var trace = calcTrace[0].trace;\n var geojsonIn = getTraceGeojson(trace);\n if (!geojsonIn) return false;\n var lookup = {};\n var featuresOut = [];\n var i;\n for (i = 0; i < trace._length; i++) {\n var cdi = calcTrace[i];\n if (cdi.loc || cdi.loc === 0) {\n lookup[cdi.loc] = cdi;\n }\n }\n function appendFeature(fIn) {\n var id = nestedProperty(fIn, trace.featureidkey || \"id\").get();\n var cdi2 = lookup[id];\n if (cdi2) {\n var geometry = fIn.geometry;\n if (geometry.type === \"Polygon\" || geometry.type === \"MultiPolygon\") {\n var fOut = {\n type: \"Feature\",\n id,\n geometry,\n properties: {}\n };\n if (fOut.geometry.coordinates.length > 0) {\n fOut.properties.ct = findCentroid(fOut);\n } else {\n fOut.properties.ct = [NaN, NaN];\n }\n cdi2.fIn = fIn;\n cdi2.fOut = fOut;\n featuresOut.push(fOut);\n } else {\n loggers.log([\n \"Location\",\n cdi2.loc,\n \"does not have a valid GeoJSON geometry.\",\n \"Traces with locationmode *geojson-id* only support\",\n \"*Polygon* and *MultiPolygon* geometries.\"\n ].join(\" \"));\n }\n }\n delete lookup[id];\n }\n switch (geojsonIn.type) {\n case \"FeatureCollection\":\n var featuresIn = geojsonIn.features;\n for (i = 0; i < featuresIn.length; i++) {\n appendFeature(featuresIn[i]);\n }\n break;\n case \"Feature\":\n appendFeature(geojsonIn);\n break;\n default:\n loggers.warn([\n \"Invalid GeoJSON type\",\n (geojsonIn.type || \"none\") + \".\",\n \"Traces with locationmode *geojson-id* only support\",\n \"*FeatureCollection* and *Feature* types.\"\n ].join(\" \"));\n return false;\n }\n for (var loc in lookup) {\n loggers.log([\n \"Location *\" + loc + \"*\",\n \"does not have a matching feature with id-key\",\n \"*\" + trace.featureidkey + \"*.\"\n ].join(\" \"));\n }\n return featuresOut;\n }\n function findCentroid(feature) {\n var geometry = feature.geometry;\n var poly;\n if (geometry.type === \"MultiPolygon\") {\n var coords = geometry.coordinates;\n var maxArea = 0;\n for (var i = 0; i < coords.length; i++) {\n var polyi = { type: \"Polygon\", coordinates: coords[i] };\n var area = turfArea(polyi);\n if (area > maxArea) {\n maxArea = area;\n poly = polyi;\n }\n }\n } else {\n poly = geometry;\n }\n return turfCentroid(poly).geometry.coordinates;\n }\n function fetchTraceGeoData(calcData) {\n var PlotlyGeoAssets2 = window.PlotlyGeoAssets || {};\n var promises = [];\n function fetch2(url2) {\n return new Promise(function(resolve, reject) {\n d3.json(url2, function(err, d) {\n if (err) {\n delete PlotlyGeoAssets2[url2];\n var msg = err.status === 404 ? 'GeoJSON at URL \"' + url2 + '\" does not exist.' : \"Unexpected error while fetching from \" + url2;\n return reject(new Error(msg));\n }\n PlotlyGeoAssets2[url2] = d;\n return resolve(d);\n });\n });\n }\n function wait(url2) {\n return new Promise(function(resolve, reject) {\n var cnt = 0;\n var interval = setInterval(function() {\n if (PlotlyGeoAssets2[url2] && PlotlyGeoAssets2[url2] !== \"pending\") {\n clearInterval(interval);\n return resolve(PlotlyGeoAssets2[url2]);\n }\n if (cnt > 100) {\n clearInterval(interval);\n return reject(\"Unexpected error while fetching from \" + url2);\n }\n cnt++;\n }, 50);\n });\n }\n for (var i = 0; i < calcData.length; i++) {\n var trace = calcData[i][0].trace;\n var url = trace.geojson;\n if (typeof url === \"string\") {\n if (!PlotlyGeoAssets2[url]) {\n PlotlyGeoAssets2[url] = \"pending\";\n promises.push(fetch2(url));\n } else if (PlotlyGeoAssets2[url] === \"pending\") {\n promises.push(wait(url));\n }\n }\n }\n return promises;\n }\n function computeBbox(d) {\n return turfBbox(d);\n }\n module.exports = {\n locationToFeature,\n feature2polygons,\n getTraceGeojson,\n extractTraceFeature,\n fetchTraceGeoData,\n computeBbox\n };\n }\n });\n\n // src/traces/scattergeo/style.js\n var require_style17 = __commonJS({\n \"src/traces/scattergeo/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Drawing = require_drawing();\n var Color2 = require_color();\n var scatterStyle = require_style2();\n var stylePoints = scatterStyle.stylePoints;\n var styleText = scatterStyle.styleText;\n module.exports = function style(gd, calcTrace) {\n if (calcTrace) styleTrace(gd, calcTrace);\n };\n function styleTrace(gd, calcTrace) {\n var trace = calcTrace[0].trace;\n var s = calcTrace[0].node3;\n s.style(\"opacity\", calcTrace[0].trace.opacity);\n stylePoints(s, trace, gd);\n styleText(s, trace, gd);\n s.selectAll(\"path.js-line\").style(\"fill\", \"none\").each(function(d) {\n var path = d3.select(this);\n var trace2 = d.trace;\n var line = trace2.line || {};\n path.call(Color2.stroke, line.color).call(Drawing.dashLine, line.dash || \"\", line.width || 0);\n if (trace2.fill !== \"none\") {\n path.call(Color2.fill, trace2.fillcolor);\n }\n });\n }\n }\n });\n\n // src/traces/scattergeo/plot.js\n var require_plot17 = __commonJS({\n \"src/traces/scattergeo/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var getTopojsonFeatures = require_topojson_utils().getTopojsonFeatures;\n var geoJsonUtils = require_geojson_utils();\n var geoUtils = require_geo_location_utils();\n var findExtremes = require_autorange().findExtremes;\n var BADNUM = require_numerical().BADNUM;\n var calcMarkerSize = require_calc3().calcMarkerSize;\n var subTypes = require_subtypes();\n var style = require_style17();\n function plot(gd, geo, calcData) {\n var scatterLayer = geo.layers.frontplot.select(\".scatterlayer\");\n var gTraces = Lib.makeTraceGroups(scatterLayer, calcData, \"trace scattergeo\");\n function removeBADNUM(d, node) {\n if (d.lonlat[0] === BADNUM) {\n d3.select(node).remove();\n }\n }\n gTraces.selectAll(\"*\").remove();\n gTraces.each(function(calcTrace) {\n var s = d3.select(this);\n var trace = calcTrace[0].trace;\n if (subTypes.hasLines(trace) || trace.fill !== \"none\") {\n var lineCoords = geoJsonUtils.calcTraceToLineCoords(calcTrace);\n var lineData = trace.fill !== \"none\" ? geoJsonUtils.makePolygon(lineCoords) : geoJsonUtils.makeLine(lineCoords);\n s.selectAll(\"path.js-line\").data([{ geojson: lineData, trace }]).enter().append(\"path\").classed(\"js-line\", true).style(\"stroke-miterlimit\", 2);\n }\n if (subTypes.hasMarkers(trace)) {\n s.selectAll(\"path.point\").data(Lib.identity).enter().append(\"path\").classed(\"point\", true).each(function(calcPt) {\n removeBADNUM(calcPt, this);\n });\n }\n if (subTypes.hasText(trace)) {\n s.selectAll(\"g\").data(Lib.identity).enter().append(\"g\").append(\"text\").each(function(calcPt) {\n removeBADNUM(calcPt, this);\n });\n }\n style(gd, calcTrace);\n });\n }\n function calcGeoJSON(calcTrace, fullLayout) {\n var trace = calcTrace[0].trace;\n var geoLayout = fullLayout[trace.geo];\n var geo = geoLayout._subplot;\n var len = trace._length;\n var i, calcPt;\n if (Lib.isArrayOrTypedArray(trace.locations)) {\n var locationmode = trace.locationmode;\n var features = locationmode === \"geojson-id\" ? geoUtils.extractTraceFeature(calcTrace) : getTopojsonFeatures(trace, geo.topojson);\n for (i = 0; i < len; i++) {\n calcPt = calcTrace[i];\n var feature = locationmode === \"geojson-id\" ? calcPt.fOut : geoUtils.locationToFeature(locationmode, calcPt.loc, features);\n calcPt.lonlat = feature ? feature.properties.ct : [BADNUM, BADNUM];\n }\n }\n var opts = { padded: true };\n var lonArray;\n var latArray;\n if (geoLayout.fitbounds === \"geojson\" && trace.locationmode === \"geojson-id\") {\n var bboxGeojson = geoUtils.computeBbox(geoUtils.getTraceGeojson(trace));\n lonArray = [bboxGeojson[0], bboxGeojson[2]];\n latArray = [bboxGeojson[1], bboxGeojson[3]];\n } else {\n lonArray = new Array(len);\n latArray = new Array(len);\n for (i = 0; i < len; i++) {\n calcPt = calcTrace[i];\n lonArray[i] = calcPt.lonlat[0];\n latArray[i] = calcPt.lonlat[1];\n }\n opts.ppad = calcMarkerSize(trace, len);\n }\n trace._extremes.lon = findExtremes(geoLayout.lonaxis._ax, lonArray, opts);\n trace._extremes.lat = findExtremes(geoLayout.lataxis._ax, latArray, opts);\n }\n module.exports = {\n calcGeoJSON,\n plot\n };\n }\n });\n\n // src/traces/scattergeo/hover.js\n var require_hover14 = __commonJS({\n \"src/traces/scattergeo/hover.js\"(exports, module) {\n \"use strict\";\n var Fx = require_fx();\n var BADNUM = require_numerical().BADNUM;\n var getTraceColor = require_get_trace_color();\n var fillText = require_lib().fillText;\n var attributes = require_attributes48();\n module.exports = function hoverPoints(pointData, xval, yval) {\n var cd = pointData.cd;\n var trace = cd[0].trace;\n var xa = pointData.xa;\n var ya = pointData.ya;\n var geo = pointData.subplot;\n var isLonLatOverEdges = geo.projection.isLonLatOverEdges;\n var project = geo.project;\n function distFn(d) {\n var lonlat2 = d.lonlat;\n if (lonlat2[0] === BADNUM) return Infinity;\n if (isLonLatOverEdges(lonlat2)) return Infinity;\n var pt = project(lonlat2);\n var px = project([xval, yval]);\n var dx = Math.abs(pt[0] - px[0]);\n var dy = Math.abs(pt[1] - px[1]);\n var rad2 = Math.max(3, d.mrc || 0);\n return Math.max(Math.sqrt(dx * dx + dy * dy) - rad2, 1 - 3 / rad2);\n }\n Fx.getClosest(cd, distFn, pointData);\n if (pointData.index === false) return;\n var di = cd[pointData.index];\n var lonlat = di.lonlat;\n var pos = [xa.c2p(lonlat), ya.c2p(lonlat)];\n var rad = di.mrc || 1;\n pointData.x0 = pos[0] - rad;\n pointData.x1 = pos[0] + rad;\n pointData.y0 = pos[1] - rad;\n pointData.y1 = pos[1] + rad;\n pointData.loc = di.loc;\n pointData.lon = lonlat[0];\n pointData.lat = lonlat[1];\n var fullLayout = {};\n fullLayout[trace.geo] = { _subplot: geo };\n var labels = trace._module.formatLabels(di, trace, fullLayout);\n pointData.lonLabel = labels.lonLabel;\n pointData.latLabel = labels.latLabel;\n pointData.color = getTraceColor(trace, di);\n pointData.extraText = getExtraText(trace, di, pointData, cd[0].t.labels);\n pointData.hovertemplate = trace.hovertemplate;\n return [pointData];\n };\n function getExtraText(trace, pt, pointData, labels) {\n if (trace.hovertemplate) return;\n var hoverinfo = pt.hi || trace.hoverinfo;\n var parts = hoverinfo === \"all\" ? attributes.hoverinfo.flags : hoverinfo.split(\"+\");\n var hasLocation = parts.indexOf(\"location\") !== -1 && Array.isArray(trace.locations);\n var hasLon = parts.indexOf(\"lon\") !== -1;\n var hasLat = parts.indexOf(\"lat\") !== -1;\n var hasText = parts.indexOf(\"text\") !== -1;\n var text = [];\n function format(val) {\n return val + \"\\xB0\";\n }\n if (hasLocation) {\n text.push(pt.loc);\n } else if (hasLon && hasLat) {\n text.push(\"(\" + format(pointData.latLabel) + \", \" + format(pointData.lonLabel) + \")\");\n } else if (hasLon) {\n text.push(labels.lon + format(pointData.lonLabel));\n } else if (hasLat) {\n text.push(labels.lat + format(pointData.latLabel));\n }\n if (hasText) {\n fillText(pt, trace, text);\n }\n return text.join(\"
    \");\n }\n }\n });\n\n // src/traces/scattergeo/event_data.js\n var require_event_data9 = __commonJS({\n \"src/traces/scattergeo/event_data.js\"(exports, module) {\n \"use strict\";\n module.exports = function eventData(out, pt, trace, cd, pointNumber) {\n out.lon = pt.lon;\n out.lat = pt.lat;\n out.location = pt.loc ? pt.loc : null;\n var cdi = cd[pointNumber];\n if (cdi.fIn && cdi.fIn.properties) {\n out.properties = cdi.fIn.properties;\n }\n return out;\n };\n }\n });\n\n // src/traces/scattergeo/select.js\n var require_select5 = __commonJS({\n \"src/traces/scattergeo/select.js\"(exports, module) {\n \"use strict\";\n var subtypes = require_subtypes();\n var BADNUM = require_numerical().BADNUM;\n module.exports = function selectPoints(searchInfo, selectionTester) {\n var cd = searchInfo.cd;\n var xa = searchInfo.xaxis;\n var ya = searchInfo.yaxis;\n var selection = [];\n var trace = cd[0].trace;\n var di, lonlat, x, y, i;\n var hasOnlyLines = !subtypes.hasMarkers(trace) && !subtypes.hasText(trace);\n if (hasOnlyLines) return [];\n if (selectionTester === false) {\n for (i = 0; i < cd.length; i++) {\n cd[i].selected = 0;\n }\n } else {\n for (i = 0; i < cd.length; i++) {\n di = cd[i];\n lonlat = di.lonlat;\n if (lonlat[0] === BADNUM) continue;\n x = xa.c2p(lonlat);\n y = ya.c2p(lonlat);\n if (selectionTester.contains([x, y], null, i, searchInfo)) {\n selection.push({\n pointNumber: i,\n lon: lonlat[0],\n lat: lonlat[1]\n });\n di.selected = 1;\n } else {\n di.selected = 0;\n }\n }\n }\n return selection;\n };\n }\n });\n\n // node_modules/d3-array/dist/d3-array.js\n var require_d3_array = __commonJS({\n \"node_modules/d3-array/dist/d3-array.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports) : typeof define === \"function\" && false ? define([\"exports\"], factory) : factory(global2.d3 = global2.d3 || {});\n })(exports, function(exports2) {\n \"use strict\";\n function ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n }\n function bisector(compare) {\n if (compare.length === 1) compare = ascendingComparator(compare);\n return {\n left: function(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (compare(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n },\n right: function(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (compare(a[mid], x) > 0) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n }\n };\n }\n function ascendingComparator(f) {\n return function(d, x) {\n return ascending(f(d), x);\n };\n }\n var ascendingBisect = bisector(ascending);\n var bisectRight = ascendingBisect.right;\n var bisectLeft = ascendingBisect.left;\n function pairs(array2, f) {\n if (f == null) f = pair;\n var i = 0, n = array2.length - 1, p = array2[0], pairs2 = new Array(n < 0 ? 0 : n);\n while (i < n) pairs2[i] = f(p, p = array2[++i]);\n return pairs2;\n }\n function pair(a, b) {\n return [a, b];\n }\n function cross(values0, values1, reduce) {\n var n0 = values0.length, n1 = values1.length, values = new Array(n0 * n1), i0, i1, i, value0;\n if (reduce == null) reduce = pair;\n for (i0 = i = 0; i0 < n0; ++i0) {\n for (value0 = values0[i0], i1 = 0; i1 < n1; ++i1, ++i) {\n values[i] = reduce(value0, values1[i1]);\n }\n }\n return values;\n }\n function descending(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n }\n function number(x) {\n return x === null ? NaN : +x;\n }\n function variance(values, valueof) {\n var n = values.length, m = 0, i = -1, mean2 = 0, value, delta, sum2 = 0;\n if (valueof == null) {\n while (++i < n) {\n if (!isNaN(value = number(values[i]))) {\n delta = value - mean2;\n mean2 += delta / ++m;\n sum2 += delta * (value - mean2);\n }\n }\n } else {\n while (++i < n) {\n if (!isNaN(value = number(valueof(values[i], i, values)))) {\n delta = value - mean2;\n mean2 += delta / ++m;\n sum2 += delta * (value - mean2);\n }\n }\n }\n if (m > 1) return sum2 / (m - 1);\n }\n function deviation(array2, f) {\n var v = variance(array2, f);\n return v ? Math.sqrt(v) : v;\n }\n function extent(values, valueof) {\n var n = values.length, i = -1, value, min2, max2;\n if (valueof == null) {\n while (++i < n) {\n if ((value = values[i]) != null && value >= value) {\n min2 = max2 = value;\n while (++i < n) {\n if ((value = values[i]) != null) {\n if (min2 > value) min2 = value;\n if (max2 < value) max2 = value;\n }\n }\n }\n }\n } else {\n while (++i < n) {\n if ((value = valueof(values[i], i, values)) != null && value >= value) {\n min2 = max2 = value;\n while (++i < n) {\n if ((value = valueof(values[i], i, values)) != null) {\n if (min2 > value) min2 = value;\n if (max2 < value) max2 = value;\n }\n }\n }\n }\n }\n return [min2, max2];\n }\n var array = Array.prototype;\n var slice = array.slice;\n var map = array.map;\n function constant(x) {\n return function() {\n return x;\n };\n }\n function identity2(x) {\n return x;\n }\n function range(start, stop, step) {\n start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;\n var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range2 = new Array(n);\n while (++i < n) {\n range2[i] = start + i * step;\n }\n return range2;\n }\n var e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2);\n function ticks(start, stop, count) {\n var reverse, i = -1, n, ticks2, step;\n stop = +stop, start = +start, count = +count;\n if (start === stop && count > 0) return [start];\n if (reverse = stop < start) n = start, start = stop, stop = n;\n if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];\n if (step > 0) {\n start = Math.ceil(start / step);\n stop = Math.floor(stop / step);\n ticks2 = new Array(n = Math.ceil(stop - start + 1));\n while (++i < n) ticks2[i] = (start + i) * step;\n } else {\n start = Math.floor(start * step);\n stop = Math.ceil(stop * step);\n ticks2 = new Array(n = Math.ceil(start - stop + 1));\n while (++i < n) ticks2[i] = (start - i) / step;\n }\n if (reverse) ticks2.reverse();\n return ticks2;\n }\n function tickIncrement(start, stop, count) {\n var step = (stop - start) / Math.max(0, count), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power);\n return power >= 0 ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);\n }\n function tickStep(start, stop, count) {\n var step0 = Math.abs(stop - start) / Math.max(0, count), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1;\n if (error >= e10) step1 *= 10;\n else if (error >= e5) step1 *= 5;\n else if (error >= e2) step1 *= 2;\n return stop < start ? -step1 : step1;\n }\n function sturges(values) {\n return Math.ceil(Math.log(values.length) / Math.LN2) + 1;\n }\n function histogram() {\n var value = identity2, domain = extent, threshold = sturges;\n function histogram2(data) {\n var i, n = data.length, x, values = new Array(n);\n for (i = 0; i < n; ++i) {\n values[i] = value(data[i], i, data);\n }\n var xz = domain(values), x0 = xz[0], x1 = xz[1], tz = threshold(values, x0, x1);\n if (!Array.isArray(tz)) {\n tz = tickStep(x0, x1, tz);\n tz = range(Math.ceil(x0 / tz) * tz, x1, tz);\n }\n var m = tz.length;\n while (tz[0] <= x0) tz.shift(), --m;\n while (tz[m - 1] > x1) tz.pop(), --m;\n var bins = new Array(m + 1), bin;\n for (i = 0; i <= m; ++i) {\n bin = bins[i] = [];\n bin.x0 = i > 0 ? tz[i - 1] : x0;\n bin.x1 = i < m ? tz[i] : x1;\n }\n for (i = 0; i < n; ++i) {\n x = values[i];\n if (x0 <= x && x <= x1) {\n bins[bisectRight(tz, x, 0, m)].push(data[i]);\n }\n }\n return bins;\n }\n histogram2.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(_), histogram2) : value;\n };\n histogram2.domain = function(_) {\n return arguments.length ? (domain = typeof _ === \"function\" ? _ : constant([_[0], _[1]]), histogram2) : domain;\n };\n histogram2.thresholds = function(_) {\n return arguments.length ? (threshold = typeof _ === \"function\" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram2) : threshold;\n };\n return histogram2;\n }\n function quantile(values, p, valueof) {\n if (valueof == null) valueof = number;\n if (!(n = values.length)) return;\n if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values);\n if (p >= 1) return +valueof(values[n - 1], n - 1, values);\n var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values[i0], i0, values), value1 = +valueof(values[i0 + 1], i0 + 1, values);\n return value0 + (value1 - value0) * (i - i0);\n }\n function freedmanDiaconis(values, min2, max2) {\n values = map.call(values, number).sort(ascending);\n return Math.ceil((max2 - min2) / (2 * (quantile(values, 0.75) - quantile(values, 0.25)) * Math.pow(values.length, -1 / 3)));\n }\n function scott(values, min2, max2) {\n return Math.ceil((max2 - min2) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3)));\n }\n function max(values, valueof) {\n var n = values.length, i = -1, value, max2;\n if (valueof == null) {\n while (++i < n) {\n if ((value = values[i]) != null && value >= value) {\n max2 = value;\n while (++i < n) {\n if ((value = values[i]) != null && value > max2) {\n max2 = value;\n }\n }\n }\n }\n } else {\n while (++i < n) {\n if ((value = valueof(values[i], i, values)) != null && value >= value) {\n max2 = value;\n while (++i < n) {\n if ((value = valueof(values[i], i, values)) != null && value > max2) {\n max2 = value;\n }\n }\n }\n }\n }\n return max2;\n }\n function mean(values, valueof) {\n var n = values.length, m = n, i = -1, value, sum2 = 0;\n if (valueof == null) {\n while (++i < n) {\n if (!isNaN(value = number(values[i]))) sum2 += value;\n else --m;\n }\n } else {\n while (++i < n) {\n if (!isNaN(value = number(valueof(values[i], i, values)))) sum2 += value;\n else --m;\n }\n }\n if (m) return sum2 / m;\n }\n function median(values, valueof) {\n var n = values.length, i = -1, value, numbers = [];\n if (valueof == null) {\n while (++i < n) {\n if (!isNaN(value = number(values[i]))) {\n numbers.push(value);\n }\n }\n } else {\n while (++i < n) {\n if (!isNaN(value = number(valueof(values[i], i, values)))) {\n numbers.push(value);\n }\n }\n }\n return quantile(numbers.sort(ascending), 0.5);\n }\n function merge(arrays) {\n var n = arrays.length, m, i = -1, j = 0, merged, array2;\n while (++i < n) j += arrays[i].length;\n merged = new Array(j);\n while (--n >= 0) {\n array2 = arrays[n];\n m = array2.length;\n while (--m >= 0) {\n merged[--j] = array2[m];\n }\n }\n return merged;\n }\n function min(values, valueof) {\n var n = values.length, i = -1, value, min2;\n if (valueof == null) {\n while (++i < n) {\n if ((value = values[i]) != null && value >= value) {\n min2 = value;\n while (++i < n) {\n if ((value = values[i]) != null && min2 > value) {\n min2 = value;\n }\n }\n }\n }\n } else {\n while (++i < n) {\n if ((value = valueof(values[i], i, values)) != null && value >= value) {\n min2 = value;\n while (++i < n) {\n if ((value = valueof(values[i], i, values)) != null && min2 > value) {\n min2 = value;\n }\n }\n }\n }\n }\n return min2;\n }\n function permute(array2, indexes) {\n var i = indexes.length, permutes = new Array(i);\n while (i--) permutes[i] = array2[indexes[i]];\n return permutes;\n }\n function scan(values, compare) {\n if (!(n = values.length)) return;\n var n, i = 0, j = 0, xi, xj = values[j];\n if (compare == null) compare = ascending;\n while (++i < n) {\n if (compare(xi = values[i], xj) < 0 || compare(xj, xj) !== 0) {\n xj = xi, j = i;\n }\n }\n if (compare(xj, xj) === 0) return j;\n }\n function shuffle(array2, i0, i1) {\n var m = (i1 == null ? array2.length : i1) - (i0 = i0 == null ? 0 : +i0), t, i;\n while (m) {\n i = Math.random() * m-- | 0;\n t = array2[m + i0];\n array2[m + i0] = array2[i + i0];\n array2[i + i0] = t;\n }\n return array2;\n }\n function sum(values, valueof) {\n var n = values.length, i = -1, value, sum2 = 0;\n if (valueof == null) {\n while (++i < n) {\n if (value = +values[i]) sum2 += value;\n }\n } else {\n while (++i < n) {\n if (value = +valueof(values[i], i, values)) sum2 += value;\n }\n }\n return sum2;\n }\n function transpose(matrix) {\n if (!(n = matrix.length)) return [];\n for (var i = -1, m = min(matrix, length), transpose2 = new Array(m); ++i < m; ) {\n for (var j = -1, n, row = transpose2[i] = new Array(n); ++j < n; ) {\n row[j] = matrix[j][i];\n }\n }\n return transpose2;\n }\n function length(d) {\n return d.length;\n }\n function zip() {\n return transpose(arguments);\n }\n exports2.bisect = bisectRight;\n exports2.bisectRight = bisectRight;\n exports2.bisectLeft = bisectLeft;\n exports2.ascending = ascending;\n exports2.bisector = bisector;\n exports2.cross = cross;\n exports2.descending = descending;\n exports2.deviation = deviation;\n exports2.extent = extent;\n exports2.histogram = histogram;\n exports2.thresholdFreedmanDiaconis = freedmanDiaconis;\n exports2.thresholdScott = scott;\n exports2.thresholdSturges = sturges;\n exports2.max = max;\n exports2.mean = mean;\n exports2.median = median;\n exports2.merge = merge;\n exports2.min = min;\n exports2.pairs = pairs;\n exports2.permute = permute;\n exports2.quantile = quantile;\n exports2.range = range;\n exports2.scan = scan;\n exports2.shuffle = shuffle;\n exports2.sum = sum;\n exports2.ticks = ticks;\n exports2.tickIncrement = tickIncrement;\n exports2.tickStep = tickStep;\n exports2.transpose = transpose;\n exports2.variance = variance;\n exports2.zip = zip;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // node_modules/d3-geo/dist/d3-geo.js\n var require_d3_geo = __commonJS({\n \"node_modules/d3-geo/dist/d3-geo.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports, require_d3_array()) : typeof define === \"function\" && false ? define([\"exports\", \"d3-array\"], factory) : (global2 = global2 || self, factory(global2.d3 = global2.d3 || {}, global2.d3));\n })(exports, function(exports2, d3Array) {\n \"use strict\";\n function adder() {\n return new Adder();\n }\n function Adder() {\n this.reset();\n }\n Adder.prototype = {\n constructor: Adder,\n reset: function() {\n this.s = // rounded value\n this.t = 0;\n },\n add: function(y) {\n add(temp, y, this.t);\n add(this, temp.s, this.s);\n if (this.s) this.t += temp.t;\n else this.s = temp.t;\n },\n valueOf: function() {\n return this.s;\n }\n };\n var temp = new Adder();\n function add(adder2, a, b) {\n var x = adder2.s = a + b, bv = x - a, av = x - bv;\n adder2.t = a - av + (b - bv);\n }\n var epsilon = 1e-6;\n var epsilon22 = 1e-12;\n var pi = Math.PI;\n var halfPi = pi / 2;\n var quarterPi = pi / 4;\n var tau = pi * 2;\n var degrees3 = 180 / pi;\n var radians2 = pi / 180;\n var abs = Math.abs;\n var atan = Math.atan;\n var atan2 = Math.atan2;\n var cos = Math.cos;\n var ceil = Math.ceil;\n var exp = Math.exp;\n var log = Math.log;\n var pow = Math.pow;\n var sin = Math.sin;\n var sign = Math.sign || function(x) {\n return x > 0 ? 1 : x < 0 ? -1 : 0;\n };\n var sqrt = Math.sqrt;\n var tan = Math.tan;\n function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n }\n function asin(x) {\n return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);\n }\n function haversin(x) {\n return (x = sin(x / 2)) * x;\n }\n function noop() {\n }\n function streamGeometry(geometry, stream) {\n if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {\n streamGeometryType[geometry.type](geometry, stream);\n }\n }\n var streamObjectType = {\n Feature: function(object2, stream) {\n streamGeometry(object2.geometry, stream);\n },\n FeatureCollection: function(object2, stream) {\n var features = object2.features, i = -1, n = features.length;\n while (++i < n) streamGeometry(features[i].geometry, stream);\n }\n };\n var streamGeometryType = {\n Sphere: function(object2, stream) {\n stream.sphere();\n },\n Point: function(object2, stream) {\n object2 = object2.coordinates;\n stream.point(object2[0], object2[1], object2[2]);\n },\n MultiPoint: function(object2, stream) {\n var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length;\n while (++i < n) object2 = coordinates2[i], stream.point(object2[0], object2[1], object2[2]);\n },\n LineString: function(object2, stream) {\n streamLine(object2.coordinates, stream, 0);\n },\n MultiLineString: function(object2, stream) {\n var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length;\n while (++i < n) streamLine(coordinates2[i], stream, 0);\n },\n Polygon: function(object2, stream) {\n streamPolygon(object2.coordinates, stream);\n },\n MultiPolygon: function(object2, stream) {\n var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length;\n while (++i < n) streamPolygon(coordinates2[i], stream);\n },\n GeometryCollection: function(object2, stream) {\n var geometries = object2.geometries, i = -1, n = geometries.length;\n while (++i < n) streamGeometry(geometries[i], stream);\n }\n };\n function streamLine(coordinates2, stream, closed) {\n var i = -1, n = coordinates2.length - closed, coordinate;\n stream.lineStart();\n while (++i < n) coordinate = coordinates2[i], stream.point(coordinate[0], coordinate[1], coordinate[2]);\n stream.lineEnd();\n }\n function streamPolygon(coordinates2, stream) {\n var i = -1, n = coordinates2.length;\n stream.polygonStart();\n while (++i < n) streamLine(coordinates2[i], stream, 1);\n stream.polygonEnd();\n }\n function geoStream(object2, stream) {\n if (object2 && streamObjectType.hasOwnProperty(object2.type)) {\n streamObjectType[object2.type](object2, stream);\n } else {\n streamGeometry(object2, stream);\n }\n }\n var areaRingSum = adder();\n var areaSum = adder(), lambda00, phi00, lambda0, cosPhi0, sinPhi0;\n var areaStream = {\n point: noop,\n lineStart: noop,\n lineEnd: noop,\n polygonStart: function() {\n areaRingSum.reset();\n areaStream.lineStart = areaRingStart;\n areaStream.lineEnd = areaRingEnd;\n },\n polygonEnd: function() {\n var areaRing = +areaRingSum;\n areaSum.add(areaRing < 0 ? tau + areaRing : areaRing);\n this.lineStart = this.lineEnd = this.point = noop;\n },\n sphere: function() {\n areaSum.add(tau);\n }\n };\n function areaRingStart() {\n areaStream.point = areaPointFirst;\n }\n function areaRingEnd() {\n areaPoint(lambda00, phi00);\n }\n function areaPointFirst(lambda, phi) {\n areaStream.point = areaPoint;\n lambda00 = lambda, phi00 = phi;\n lambda *= radians2, phi *= radians2;\n lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi);\n }\n function areaPoint(lambda, phi) {\n lambda *= radians2, phi *= radians2;\n phi = phi / 2 + quarterPi;\n var dLambda = lambda - lambda0, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = cos(phi), sinPhi = sin(phi), k = sinPhi0 * sinPhi, u = cosPhi0 * cosPhi + k * cos(adLambda), v = k * sdLambda * sin(adLambda);\n areaRingSum.add(atan2(v, u));\n lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;\n }\n function area(object2) {\n areaSum.reset();\n geoStream(object2, areaStream);\n return areaSum * 2;\n }\n function spherical(cartesian2) {\n return [atan2(cartesian2[1], cartesian2[0]), asin(cartesian2[2])];\n }\n function cartesian(spherical2) {\n var lambda = spherical2[0], phi = spherical2[1], cosPhi = cos(phi);\n return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];\n }\n function cartesianDot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n }\n function cartesianCross(a, b) {\n return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];\n }\n function cartesianAddInPlace(a, b) {\n a[0] += b[0], a[1] += b[1], a[2] += b[2];\n }\n function cartesianScale(vector, k) {\n return [vector[0] * k, vector[1] * k, vector[2] * k];\n }\n function cartesianNormalizeInPlace(d) {\n var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);\n d[0] /= l, d[1] /= l, d[2] /= l;\n }\n var lambda0$1, phi0, lambda1, phi1, lambda2, lambda00$1, phi00$1, p0, deltaSum = adder(), ranges, range;\n var boundsStream = {\n point: boundsPoint,\n lineStart: boundsLineStart,\n lineEnd: boundsLineEnd,\n polygonStart: function() {\n boundsStream.point = boundsRingPoint;\n boundsStream.lineStart = boundsRingStart;\n boundsStream.lineEnd = boundsRingEnd;\n deltaSum.reset();\n areaStream.polygonStart();\n },\n polygonEnd: function() {\n areaStream.polygonEnd();\n boundsStream.point = boundsPoint;\n boundsStream.lineStart = boundsLineStart;\n boundsStream.lineEnd = boundsLineEnd;\n if (areaRingSum < 0) lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90);\n else if (deltaSum > epsilon) phi1 = 90;\n else if (deltaSum < -epsilon) phi0 = -90;\n range[0] = lambda0$1, range[1] = lambda1;\n },\n sphere: function() {\n lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90);\n }\n };\n function boundsPoint(lambda, phi) {\n ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]);\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n }\n function linePoint(lambda, phi) {\n var p = cartesian([lambda * radians2, phi * radians2]);\n if (p0) {\n var normal = cartesianCross(p0, p), equatorial = [normal[1], -normal[0], 0], inflection = cartesianCross(equatorial, normal);\n cartesianNormalizeInPlace(inflection);\n inflection = spherical(inflection);\n var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees3 * sign2, phii, antimeridian = abs(delta) > 180;\n if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {\n phii = inflection[1] * degrees3;\n if (phii > phi1) phi1 = phii;\n } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {\n phii = -inflection[1] * degrees3;\n if (phii < phi0) phi0 = phii;\n } else {\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n }\n if (antimeridian) {\n if (lambda < lambda2) {\n if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda;\n } else {\n if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda;\n }\n } else {\n if (lambda1 >= lambda0$1) {\n if (lambda < lambda0$1) lambda0$1 = lambda;\n if (lambda > lambda1) lambda1 = lambda;\n } else {\n if (lambda > lambda2) {\n if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda;\n } else {\n if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda;\n }\n }\n }\n } else {\n ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]);\n }\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n p0 = p, lambda2 = lambda;\n }\n function boundsLineStart() {\n boundsStream.point = linePoint;\n }\n function boundsLineEnd() {\n range[0] = lambda0$1, range[1] = lambda1;\n boundsStream.point = boundsPoint;\n p0 = null;\n }\n function boundsRingPoint(lambda, phi) {\n if (p0) {\n var delta = lambda - lambda2;\n deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);\n } else {\n lambda00$1 = lambda, phi00$1 = phi;\n }\n areaStream.point(lambda, phi);\n linePoint(lambda, phi);\n }\n function boundsRingStart() {\n areaStream.lineStart();\n }\n function boundsRingEnd() {\n boundsRingPoint(lambda00$1, phi00$1);\n areaStream.lineEnd();\n if (abs(deltaSum) > epsilon) lambda0$1 = -(lambda1 = 180);\n range[0] = lambda0$1, range[1] = lambda1;\n p0 = null;\n }\n function angle(lambda02, lambda12) {\n return (lambda12 -= lambda02) < 0 ? lambda12 + 360 : lambda12;\n }\n function rangeCompare(a, b) {\n return a[0] - b[0];\n }\n function rangeContains(range2, x) {\n return range2[0] <= range2[1] ? range2[0] <= x && x <= range2[1] : x < range2[0] || range2[1] < x;\n }\n function bounds(feature) {\n var i, n, a, b, merged, deltaMax, delta;\n phi1 = lambda1 = -(lambda0$1 = phi0 = Infinity);\n ranges = [];\n geoStream(feature, boundsStream);\n if (n = ranges.length) {\n ranges.sort(rangeCompare);\n for (i = 1, a = ranges[0], merged = [a]; i < n; ++i) {\n b = ranges[i];\n if (rangeContains(a, b[0]) || rangeContains(a, b[1])) {\n if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1];\n if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0];\n } else {\n merged.push(a = b);\n }\n }\n for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i) {\n b = merged[i];\n if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0$1 = b[0], lambda1 = a[1];\n }\n }\n ranges = range = null;\n return lambda0$1 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda0$1, phi0], [lambda1, phi1]];\n }\n var W0, W1, X0, Y0, Z0, X1, Y1, Z1, X2, Y2, Z2, lambda00$2, phi00$2, x0, y0, z0;\n var centroidStream = {\n sphere: noop,\n point: centroidPoint,\n lineStart: centroidLineStart,\n lineEnd: centroidLineEnd,\n polygonStart: function() {\n centroidStream.lineStart = centroidRingStart;\n centroidStream.lineEnd = centroidRingEnd;\n },\n polygonEnd: function() {\n centroidStream.lineStart = centroidLineStart;\n centroidStream.lineEnd = centroidLineEnd;\n }\n };\n function centroidPoint(lambda, phi) {\n lambda *= radians2, phi *= radians2;\n var cosPhi = cos(phi);\n centroidPointCartesian(cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi));\n }\n function centroidPointCartesian(x, y, z) {\n ++W0;\n X0 += (x - X0) / W0;\n Y0 += (y - Y0) / W0;\n Z0 += (z - Z0) / W0;\n }\n function centroidLineStart() {\n centroidStream.point = centroidLinePointFirst;\n }\n function centroidLinePointFirst(lambda, phi) {\n lambda *= radians2, phi *= radians2;\n var cosPhi = cos(phi);\n x0 = cosPhi * cos(lambda);\n y0 = cosPhi * sin(lambda);\n z0 = sin(phi);\n centroidStream.point = centroidLinePoint;\n centroidPointCartesian(x0, y0, z0);\n }\n function centroidLinePoint(lambda, phi) {\n lambda *= radians2, phi *= radians2;\n var cosPhi = cos(phi), x = cosPhi * cos(lambda), y = cosPhi * sin(lambda), z = sin(phi), w = atan2(sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z);\n W1 += w;\n X1 += w * (x0 + (x0 = x));\n Y1 += w * (y0 + (y0 = y));\n Z1 += w * (z0 + (z0 = z));\n centroidPointCartesian(x0, y0, z0);\n }\n function centroidLineEnd() {\n centroidStream.point = centroidPoint;\n }\n function centroidRingStart() {\n centroidStream.point = centroidRingPointFirst;\n }\n function centroidRingEnd() {\n centroidRingPoint(lambda00$2, phi00$2);\n centroidStream.point = centroidPoint;\n }\n function centroidRingPointFirst(lambda, phi) {\n lambda00$2 = lambda, phi00$2 = phi;\n lambda *= radians2, phi *= radians2;\n centroidStream.point = centroidRingPoint;\n var cosPhi = cos(phi);\n x0 = cosPhi * cos(lambda);\n y0 = cosPhi * sin(lambda);\n z0 = sin(phi);\n centroidPointCartesian(x0, y0, z0);\n }\n function centroidRingPoint(lambda, phi) {\n lambda *= radians2, phi *= radians2;\n var cosPhi = cos(phi), x = cosPhi * cos(lambda), y = cosPhi * sin(lambda), z = sin(phi), cx = y0 * z - z0 * y, cy = z0 * x - x0 * z, cz = x0 * y - y0 * x, m = sqrt(cx * cx + cy * cy + cz * cz), w = asin(m), v = m && -w / m;\n X2 += v * cx;\n Y2 += v * cy;\n Z2 += v * cz;\n W1 += w;\n X1 += w * (x0 + (x0 = x));\n Y1 += w * (y0 + (y0 = y));\n Z1 += w * (z0 + (z0 = z));\n centroidPointCartesian(x0, y0, z0);\n }\n function centroid(object2) {\n W0 = W1 = X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;\n geoStream(object2, centroidStream);\n var x = X2, y = Y2, z = Z2, m = x * x + y * y + z * z;\n if (m < epsilon22) {\n x = X1, y = Y1, z = Z1;\n if (W1 < epsilon) x = X0, y = Y0, z = Z0;\n m = x * x + y * y + z * z;\n if (m < epsilon22) return [NaN, NaN];\n }\n return [atan2(y, x) * degrees3, asin(z / sqrt(m)) * degrees3];\n }\n function constant(x) {\n return function() {\n return x;\n };\n }\n function compose(a, b) {\n function compose2(x, y) {\n return x = a(x, y), b(x[0], x[1]);\n }\n if (a.invert && b.invert) compose2.invert = function(x, y) {\n return x = b.invert(x, y), x && a.invert(x[0], x[1]);\n };\n return compose2;\n }\n function rotationIdentity(lambda, phi) {\n return [abs(lambda) > pi ? lambda + Math.round(-lambda / tau) * tau : lambda, phi];\n }\n rotationIdentity.invert = rotationIdentity;\n function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {\n return (deltaLambda %= tau) ? deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;\n }\n function forwardRotationLambda(deltaLambda) {\n return function(lambda, phi) {\n return lambda += deltaLambda, [lambda > pi ? lambda - tau : lambda < -pi ? lambda + tau : lambda, phi];\n };\n }\n function rotationLambda(deltaLambda) {\n var rotation2 = forwardRotationLambda(deltaLambda);\n rotation2.invert = forwardRotationLambda(-deltaLambda);\n return rotation2;\n }\n function rotationPhiGamma(deltaPhi, deltaGamma) {\n var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma);\n function rotation2(lambda, phi) {\n var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaPhi + x * sinDeltaPhi;\n return [\n atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi),\n asin(k * cosDeltaGamma + y * sinDeltaGamma)\n ];\n }\n rotation2.invert = function(lambda, phi) {\n var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaGamma - y * sinDeltaGamma;\n return [\n atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi),\n asin(k * cosDeltaPhi - x * sinDeltaPhi)\n ];\n };\n return rotation2;\n }\n function rotation(rotate) {\n rotate = rotateRadians(rotate[0] * radians2, rotate[1] * radians2, rotate.length > 2 ? rotate[2] * radians2 : 0);\n function forward(coordinates2) {\n coordinates2 = rotate(coordinates2[0] * radians2, coordinates2[1] * radians2);\n return coordinates2[0] *= degrees3, coordinates2[1] *= degrees3, coordinates2;\n }\n forward.invert = function(coordinates2) {\n coordinates2 = rotate.invert(coordinates2[0] * radians2, coordinates2[1] * radians2);\n return coordinates2[0] *= degrees3, coordinates2[1] *= degrees3, coordinates2;\n };\n return forward;\n }\n function circleStream(stream, radius, delta, direction, t02, t12) {\n if (!delta) return;\n var cosRadius = cos(radius), sinRadius = sin(radius), step = direction * delta;\n if (t02 == null) {\n t02 = radius + direction * tau;\n t12 = radius - step / 2;\n } else {\n t02 = circleRadius(cosRadius, t02);\n t12 = circleRadius(cosRadius, t12);\n if (direction > 0 ? t02 < t12 : t02 > t12) t02 += direction * tau;\n }\n for (var point, t = t02; direction > 0 ? t > t12 : t < t12; t -= step) {\n point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]);\n stream.point(point[0], point[1]);\n }\n }\n function circleRadius(cosRadius, point) {\n point = cartesian(point), point[0] -= cosRadius;\n cartesianNormalizeInPlace(point);\n var radius = acos(-point[1]);\n return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau;\n }\n function circle() {\n var center = constant([0, 0]), radius = constant(90), precision = constant(6), ring, rotate, stream = { point };\n function point(x, y) {\n ring.push(x = rotate(x, y));\n x[0] *= degrees3, x[1] *= degrees3;\n }\n function circle2() {\n var c = center.apply(this, arguments), r = radius.apply(this, arguments) * radians2, p = precision.apply(this, arguments) * radians2;\n ring = [];\n rotate = rotateRadians(-c[0] * radians2, -c[1] * radians2, 0).invert;\n circleStream(stream, r, p, 1);\n c = { type: \"Polygon\", coordinates: [ring] };\n ring = rotate = null;\n return c;\n }\n circle2.center = function(_) {\n return arguments.length ? (center = typeof _ === \"function\" ? _ : constant([+_[0], +_[1]]), circle2) : center;\n };\n circle2.radius = function(_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant(+_), circle2) : radius;\n };\n circle2.precision = function(_) {\n return arguments.length ? (precision = typeof _ === \"function\" ? _ : constant(+_), circle2) : precision;\n };\n return circle2;\n }\n function clipBuffer() {\n var lines = [], line;\n return {\n point: function(x, y, m) {\n line.push([x, y, m]);\n },\n lineStart: function() {\n lines.push(line = []);\n },\n lineEnd: noop,\n rejoin: function() {\n if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));\n },\n result: function() {\n var result = lines;\n lines = [];\n line = null;\n return result;\n }\n };\n }\n function pointEqual(a, b) {\n return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon;\n }\n function Intersection(point, points, other, entry) {\n this.x = point;\n this.z = points;\n this.o = other;\n this.e = entry;\n this.v = false;\n this.n = this.p = null;\n }\n function clipRejoin(segments, compareIntersection2, startInside, interpolate2, stream) {\n var subject = [], clip2 = [], i, n;\n segments.forEach(function(segment) {\n if ((n2 = segment.length - 1) <= 0) return;\n var n2, p02 = segment[0], p1 = segment[n2], x;\n if (pointEqual(p02, p1)) {\n if (!p02[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n2; ++i) stream.point((p02 = segment[i])[0], p02[1]);\n stream.lineEnd();\n return;\n }\n p1[0] += 2 * epsilon;\n }\n subject.push(x = new Intersection(p02, segment, null, true));\n clip2.push(x.o = new Intersection(p02, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip2.push(x.o = new Intersection(p1, null, x, true));\n });\n if (!subject.length) return;\n clip2.sort(compareIntersection2);\n link(subject);\n link(clip2);\n for (i = 0, n = clip2.length; i < n; ++i) {\n clip2[i].e = startInside = !startInside;\n }\n var start = subject[0], points, point;\n while (1) {\n var current = start, isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate2(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate2(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n }\n function link(array) {\n if (!(n = array.length)) return;\n var n, i = 0, a = array[0], b;\n while (++i < n) {\n a.n = b = array[i];\n b.p = a;\n a = b;\n }\n a.n = b = array[0];\n b.p = a;\n }\n var sum = adder();\n function longitude(point) {\n if (abs(point[0]) <= pi)\n return point[0];\n else\n return sign(point[0]) * ((abs(point[0]) + pi) % tau - pi);\n }\n function polygonContains(polygon, point) {\n var lambda = longitude(point), phi = point[1], sinPhi = sin(phi), normal = [sin(lambda), -cos(lambda), 0], angle2 = 0, winding = 0;\n sum.reset();\n if (sinPhi === 1) phi = halfPi + epsilon;\n else if (sinPhi === -1) phi = -halfPi - epsilon;\n for (var i = 0, n = polygon.length; i < n; ++i) {\n if (!(m = (ring = polygon[i]).length)) continue;\n var ring, m, point0 = ring[m - 1], lambda02 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi02 = sin(phi02), cosPhi02 = cos(phi02);\n for (var j = 0; j < m; ++j, lambda02 = lambda12, sinPhi02 = sinPhi1, cosPhi02 = cosPhi1, point0 = point1) {\n var point1 = ring[j], lambda12 = longitude(point1), phi12 = point1[1] / 2 + quarterPi, sinPhi1 = sin(phi12), cosPhi1 = cos(phi12), delta = lambda12 - lambda02, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi, k = sinPhi02 * sinPhi1;\n sum.add(atan2(k * sign2 * sin(absDelta), cosPhi02 * cosPhi1 + k * cos(absDelta)));\n angle2 += antimeridian ? delta + sign2 * tau : delta;\n if (antimeridian ^ lambda02 >= lambda ^ lambda12 >= lambda) {\n var arc = cartesianCross(cartesian(point0), cartesian(point1));\n cartesianNormalizeInPlace(arc);\n var intersection = cartesianCross(normal, arc);\n cartesianNormalizeInPlace(intersection);\n var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);\n if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {\n winding += antimeridian ^ delta >= 0 ? 1 : -1;\n }\n }\n }\n }\n return (angle2 < -epsilon || angle2 < epsilon && sum < -epsilon) ^ winding & 1;\n }\n function clip(pointVisible, clipLine2, interpolate2, start) {\n return function(sink) {\n var line = clipLine2(sink), ringBuffer = clipBuffer(), ringSink = clipLine2(ringBuffer), polygonStarted = false, polygon, segments, ring;\n var clip2 = {\n point,\n lineStart,\n lineEnd,\n polygonStart: function() {\n clip2.point = pointRing;\n clip2.lineStart = ringStart;\n clip2.lineEnd = ringEnd;\n segments = [];\n polygon = [];\n },\n polygonEnd: function() {\n clip2.point = point;\n clip2.lineStart = lineStart;\n clip2.lineEnd = lineEnd;\n segments = d3Array.merge(segments);\n var startInside = polygonContains(polygon, start);\n if (segments.length) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n clipRejoin(segments, compareIntersection, startInside, interpolate2, sink);\n } else if (startInside) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n sink.lineStart();\n interpolate2(null, null, 1, sink);\n sink.lineEnd();\n }\n if (polygonStarted) sink.polygonEnd(), polygonStarted = false;\n segments = polygon = null;\n },\n sphere: function() {\n sink.polygonStart();\n sink.lineStart();\n interpolate2(null, null, 1, sink);\n sink.lineEnd();\n sink.polygonEnd();\n }\n };\n function point(lambda, phi) {\n if (pointVisible(lambda, phi)) sink.point(lambda, phi);\n }\n function pointLine(lambda, phi) {\n line.point(lambda, phi);\n }\n function lineStart() {\n clip2.point = pointLine;\n line.lineStart();\n }\n function lineEnd() {\n clip2.point = point;\n line.lineEnd();\n }\n function pointRing(lambda, phi) {\n ring.push([lambda, phi]);\n ringSink.point(lambda, phi);\n }\n function ringStart() {\n ringSink.lineStart();\n ring = [];\n }\n function ringEnd() {\n pointRing(ring[0][0], ring[0][1]);\n ringSink.lineEnd();\n var clean = ringSink.clean(), ringSegments = ringBuffer.result(), i, n = ringSegments.length, m, segment, point2;\n ring.pop();\n polygon.push(ring);\n ring = null;\n if (!n) return;\n if (clean & 1) {\n segment = ringSegments[0];\n if ((m = segment.length - 1) > 0) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n sink.lineStart();\n for (i = 0; i < m; ++i) sink.point((point2 = segment[i])[0], point2[1]);\n sink.lineEnd();\n }\n return;\n }\n if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));\n segments.push(ringSegments.filter(validSegment));\n }\n return clip2;\n };\n }\n function validSegment(segment) {\n return segment.length > 1;\n }\n function compareIntersection(a, b) {\n return ((a = a.x)[0] < 0 ? a[1] - halfPi - epsilon : halfPi - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfPi - epsilon : halfPi - b[1]);\n }\n var clipAntimeridian = clip(\n function() {\n return true;\n },\n clipAntimeridianLine,\n clipAntimeridianInterpolate,\n [-pi, -halfPi]\n );\n function clipAntimeridianLine(stream) {\n var lambda02 = NaN, phi02 = NaN, sign0 = NaN, clean;\n return {\n lineStart: function() {\n stream.lineStart();\n clean = 1;\n },\n point: function(lambda12, phi12) {\n var sign1 = lambda12 > 0 ? pi : -pi, delta = abs(lambda12 - lambda02);\n if (abs(delta - pi) < epsilon) {\n stream.point(lambda02, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi : -halfPi);\n stream.point(sign0, phi02);\n stream.lineEnd();\n stream.lineStart();\n stream.point(sign1, phi02);\n stream.point(lambda12, phi02);\n clean = 0;\n } else if (sign0 !== sign1 && delta >= pi) {\n if (abs(lambda02 - sign0) < epsilon) lambda02 -= sign0 * epsilon;\n if (abs(lambda12 - sign1) < epsilon) lambda12 -= sign1 * epsilon;\n phi02 = clipAntimeridianIntersect(lambda02, phi02, lambda12, phi12);\n stream.point(sign0, phi02);\n stream.lineEnd();\n stream.lineStart();\n stream.point(sign1, phi02);\n clean = 0;\n }\n stream.point(lambda02 = lambda12, phi02 = phi12);\n sign0 = sign1;\n },\n lineEnd: function() {\n stream.lineEnd();\n lambda02 = phi02 = NaN;\n },\n clean: function() {\n return 2 - clean;\n }\n };\n }\n function clipAntimeridianIntersect(lambda02, phi02, lambda12, phi12) {\n var cosPhi02, cosPhi1, sinLambda0Lambda1 = sin(lambda02 - lambda12);\n return abs(sinLambda0Lambda1) > epsilon ? atan((sin(phi02) * (cosPhi1 = cos(phi12)) * sin(lambda12) - sin(phi12) * (cosPhi02 = cos(phi02)) * sin(lambda02)) / (cosPhi02 * cosPhi1 * sinLambda0Lambda1)) : (phi02 + phi12) / 2;\n }\n function clipAntimeridianInterpolate(from, to, direction, stream) {\n var phi;\n if (from == null) {\n phi = direction * halfPi;\n stream.point(-pi, phi);\n stream.point(0, phi);\n stream.point(pi, phi);\n stream.point(pi, 0);\n stream.point(pi, -phi);\n stream.point(0, -phi);\n stream.point(-pi, -phi);\n stream.point(-pi, 0);\n stream.point(-pi, phi);\n } else if (abs(from[0] - to[0]) > epsilon) {\n var lambda = from[0] < to[0] ? pi : -pi;\n phi = direction * lambda / 2;\n stream.point(-lambda, phi);\n stream.point(0, phi);\n stream.point(lambda, phi);\n } else {\n stream.point(to[0], to[1]);\n }\n }\n function clipCircle(radius) {\n var cr = cos(radius), delta = 6 * radians2, smallRadius = cr > 0, notHemisphere = abs(cr) > epsilon;\n function interpolate2(from, to, direction, stream) {\n circleStream(stream, radius, delta, direction, from, to);\n }\n function visible(lambda, phi) {\n return cos(lambda) * cos(phi) > cr;\n }\n function clipLine2(stream) {\n var point0, c0, v0, v00, clean;\n return {\n lineStart: function() {\n v00 = v0 = false;\n clean = 1;\n },\n point: function(lambda, phi) {\n var point1 = [lambda, phi], point2, v = visible(lambda, phi), c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;\n if (!point0 && (v00 = v0 = v)) stream.lineStart();\n if (v !== v0) {\n point2 = intersect(point0, point1);\n if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2))\n point1[2] = 1;\n }\n if (v !== v0) {\n clean = 0;\n if (v) {\n stream.lineStart();\n point2 = intersect(point1, point0);\n stream.point(point2[0], point2[1]);\n } else {\n point2 = intersect(point0, point1);\n stream.point(point2[0], point2[1], 2);\n stream.lineEnd();\n }\n point0 = point2;\n } else if (notHemisphere && point0 && smallRadius ^ v) {\n var t;\n if (!(c & c0) && (t = intersect(point1, point0, true))) {\n clean = 0;\n if (smallRadius) {\n stream.lineStart();\n stream.point(t[0][0], t[0][1]);\n stream.point(t[1][0], t[1][1]);\n stream.lineEnd();\n } else {\n stream.point(t[1][0], t[1][1]);\n stream.lineEnd();\n stream.lineStart();\n stream.point(t[0][0], t[0][1], 3);\n }\n }\n }\n if (v && (!point0 || !pointEqual(point0, point1))) {\n stream.point(point1[0], point1[1]);\n }\n point0 = point1, v0 = v, c0 = c;\n },\n lineEnd: function() {\n if (v0) stream.lineEnd();\n point0 = null;\n },\n // Rejoin first and last segments if there were intersections and the first\n // and last points were visible.\n clean: function() {\n return clean | (v00 && v0) << 1;\n }\n };\n }\n function intersect(a, b, two) {\n var pa = cartesian(a), pb = cartesian(b);\n var n1 = [1, 0, 0], n2 = cartesianCross(pa, pb), n2n2 = cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;\n if (!determinant) return !two && a;\n var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A5 = cartesianScale(n1, c1), B2 = cartesianScale(n2, c2);\n cartesianAddInPlace(A5, B2);\n var u = n1xn2, w = cartesianDot(A5, u), uu = cartesianDot(u, u), t22 = w * w - uu * (cartesianDot(A5, A5) - 1);\n if (t22 < 0) return;\n var t = sqrt(t22), q = cartesianScale(u, (-w - t) / uu);\n cartesianAddInPlace(q, A5);\n q = spherical(q);\n if (!two) return q;\n var lambda02 = a[0], lambda12 = b[0], phi02 = a[1], phi12 = b[1], z;\n if (lambda12 < lambda02) z = lambda02, lambda02 = lambda12, lambda12 = z;\n var delta2 = lambda12 - lambda02, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon;\n if (!polar && phi12 < phi02) z = phi02, phi02 = phi12, phi12 = z;\n if (meridian ? polar ? phi02 + phi12 > 0 ^ q[1] < (abs(q[0] - lambda02) < epsilon ? phi02 : phi12) : phi02 <= q[1] && q[1] <= phi12 : delta2 > pi ^ (lambda02 <= q[0] && q[0] <= lambda12)) {\n var q1 = cartesianScale(u, (-w + t) / uu);\n cartesianAddInPlace(q1, A5);\n return [q, spherical(q1)];\n }\n }\n function code(lambda, phi) {\n var r = smallRadius ? radius : pi - radius, code2 = 0;\n if (lambda < -r) code2 |= 1;\n else if (lambda > r) code2 |= 2;\n if (phi < -r) code2 |= 4;\n else if (phi > r) code2 |= 8;\n return code2;\n }\n return clip(visible, clipLine2, interpolate2, smallRadius ? [0, -radius] : [-pi, radius - pi]);\n }\n function clipLine(a, b, x02, y02, x12, y12) {\n var ax = a[0], ay = a[1], bx = b[0], by = b[1], t02 = 0, t12 = 1, dx = bx - ax, dy = by - ay, r;\n r = x02 - ax;\n if (!dx && r > 0) return;\n r /= dx;\n if (dx < 0) {\n if (r < t02) return;\n if (r < t12) t12 = r;\n } else if (dx > 0) {\n if (r > t12) return;\n if (r > t02) t02 = r;\n }\n r = x12 - ax;\n if (!dx && r < 0) return;\n r /= dx;\n if (dx < 0) {\n if (r > t12) return;\n if (r > t02) t02 = r;\n } else if (dx > 0) {\n if (r < t02) return;\n if (r < t12) t12 = r;\n }\n r = y02 - ay;\n if (!dy && r > 0) return;\n r /= dy;\n if (dy < 0) {\n if (r < t02) return;\n if (r < t12) t12 = r;\n } else if (dy > 0) {\n if (r > t12) return;\n if (r > t02) t02 = r;\n }\n r = y12 - ay;\n if (!dy && r < 0) return;\n r /= dy;\n if (dy < 0) {\n if (r > t12) return;\n if (r > t02) t02 = r;\n } else if (dy > 0) {\n if (r < t02) return;\n if (r < t12) t12 = r;\n }\n if (t02 > 0) a[0] = ax + t02 * dx, a[1] = ay + t02 * dy;\n if (t12 < 1) b[0] = ax + t12 * dx, b[1] = ay + t12 * dy;\n return true;\n }\n var clipMax = 1e9, clipMin = -clipMax;\n function clipRectangle(x02, y02, x12, y12) {\n function visible(x, y) {\n return x02 <= x && x <= x12 && y02 <= y && y <= y12;\n }\n function interpolate2(from, to, direction, stream) {\n var a = 0, a1 = 0;\n if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {\n do\n stream.point(a === 0 || a === 3 ? x02 : x12, a > 1 ? y12 : y02);\n while ((a = (a + direction + 4) % 4) !== a1);\n } else {\n stream.point(to[0], to[1]);\n }\n }\n function corner(p, direction) {\n return abs(p[0] - x02) < epsilon ? direction > 0 ? 0 : 3 : abs(p[0] - x12) < epsilon ? direction > 0 ? 2 : 1 : abs(p[1] - y02) < epsilon ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2;\n }\n function compareIntersection2(a, b) {\n return comparePoint(a.x, b.x);\n }\n function comparePoint(a, b) {\n var ca = corner(a, 1), cb = corner(b, 1);\n return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0];\n }\n return function(stream) {\n var activeStream = stream, bufferStream = clipBuffer(), segments, polygon, ring, x__, y__, v__, x_, y_, v_, first, clean;\n var clipStream = {\n point,\n lineStart,\n lineEnd,\n polygonStart,\n polygonEnd\n };\n function point(x, y) {\n if (visible(x, y)) activeStream.point(x, y);\n }\n function polygonInside() {\n var winding = 0;\n for (var i = 0, n = polygon.length; i < n; ++i) {\n for (var ring2 = polygon[i], j = 1, m = ring2.length, point2 = ring2[0], a0, a1, b0 = point2[0], b1 = point2[1]; j < m; ++j) {\n a0 = b0, a1 = b1, point2 = ring2[j], b0 = point2[0], b1 = point2[1];\n if (a1 <= y12) {\n if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x02 - a0)) ++winding;\n } else {\n if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x02 - a0)) --winding;\n }\n }\n }\n return winding;\n }\n function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }\n function polygonEnd() {\n var startInside = polygonInside(), cleanInside = clean && startInside, visible2 = (segments = d3Array.merge(segments)).length;\n if (cleanInside || visible2) {\n stream.polygonStart();\n if (cleanInside) {\n stream.lineStart();\n interpolate2(null, null, 1, stream);\n stream.lineEnd();\n }\n if (visible2) {\n clipRejoin(segments, compareIntersection2, startInside, interpolate2, stream);\n }\n stream.polygonEnd();\n }\n activeStream = stream, segments = polygon = ring = null;\n }\n function lineStart() {\n clipStream.point = linePoint2;\n if (polygon) polygon.push(ring = []);\n first = true;\n v_ = false;\n x_ = y_ = NaN;\n }\n function lineEnd() {\n if (segments) {\n linePoint2(x__, y__);\n if (v__ && v_) bufferStream.rejoin();\n segments.push(bufferStream.result());\n }\n clipStream.point = point;\n if (v_) activeStream.lineEnd();\n }\n function linePoint2(x, y) {\n var v = visible(x, y);\n if (polygon) ring.push([x, y]);\n if (first) {\n x__ = x, y__ = y, v__ = v;\n first = false;\n if (v) {\n activeStream.lineStart();\n activeStream.point(x, y);\n }\n } else {\n if (v && v_) activeStream.point(x, y);\n else {\n var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))];\n if (clipLine(a, b, x02, y02, x12, y12)) {\n if (!v_) {\n activeStream.lineStart();\n activeStream.point(a[0], a[1]);\n }\n activeStream.point(b[0], b[1]);\n if (!v) activeStream.lineEnd();\n clean = false;\n } else if (v) {\n activeStream.lineStart();\n activeStream.point(x, y);\n clean = false;\n }\n }\n }\n x_ = x, y_ = y, v_ = v;\n }\n return clipStream;\n };\n }\n function extent() {\n var x02 = 0, y02 = 0, x12 = 960, y12 = 500, cache, cacheStream, clip2;\n return clip2 = {\n stream: function(stream) {\n return cache && cacheStream === stream ? cache : cache = clipRectangle(x02, y02, x12, y12)(cacheStream = stream);\n },\n extent: function(_) {\n return arguments.length ? (x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1], cache = cacheStream = null, clip2) : [[x02, y02], [x12, y12]];\n }\n };\n }\n var lengthSum = adder(), lambda0$2, sinPhi0$1, cosPhi0$1;\n var lengthStream = {\n sphere: noop,\n point: noop,\n lineStart: lengthLineStart,\n lineEnd: noop,\n polygonStart: noop,\n polygonEnd: noop\n };\n function lengthLineStart() {\n lengthStream.point = lengthPointFirst;\n lengthStream.lineEnd = lengthLineEnd;\n }\n function lengthLineEnd() {\n lengthStream.point = lengthStream.lineEnd = noop;\n }\n function lengthPointFirst(lambda, phi) {\n lambda *= radians2, phi *= radians2;\n lambda0$2 = lambda, sinPhi0$1 = sin(phi), cosPhi0$1 = cos(phi);\n lengthStream.point = lengthPoint;\n }\n function lengthPoint(lambda, phi) {\n lambda *= radians2, phi *= radians2;\n var sinPhi = sin(phi), cosPhi = cos(phi), delta = abs(lambda - lambda0$2), cosDelta = cos(delta), sinDelta = sin(delta), x = cosPhi * sinDelta, y = cosPhi0$1 * sinPhi - sinPhi0$1 * cosPhi * cosDelta, z = sinPhi0$1 * sinPhi + cosPhi0$1 * cosPhi * cosDelta;\n lengthSum.add(atan2(sqrt(x * x + y * y), z));\n lambda0$2 = lambda, sinPhi0$1 = sinPhi, cosPhi0$1 = cosPhi;\n }\n function length(object2) {\n lengthSum.reset();\n geoStream(object2, lengthStream);\n return +lengthSum;\n }\n var coordinates = [null, null], object = { type: \"LineString\", coordinates };\n function distance(a, b) {\n coordinates[0] = a;\n coordinates[1] = b;\n return length(object);\n }\n var containsObjectType = {\n Feature: function(object2, point) {\n return containsGeometry(object2.geometry, point);\n },\n FeatureCollection: function(object2, point) {\n var features = object2.features, i = -1, n = features.length;\n while (++i < n) if (containsGeometry(features[i].geometry, point)) return true;\n return false;\n }\n };\n var containsGeometryType = {\n Sphere: function() {\n return true;\n },\n Point: function(object2, point) {\n return containsPoint(object2.coordinates, point);\n },\n MultiPoint: function(object2, point) {\n var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length;\n while (++i < n) if (containsPoint(coordinates2[i], point)) return true;\n return false;\n },\n LineString: function(object2, point) {\n return containsLine(object2.coordinates, point);\n },\n MultiLineString: function(object2, point) {\n var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length;\n while (++i < n) if (containsLine(coordinates2[i], point)) return true;\n return false;\n },\n Polygon: function(object2, point) {\n return containsPolygon(object2.coordinates, point);\n },\n MultiPolygon: function(object2, point) {\n var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length;\n while (++i < n) if (containsPolygon(coordinates2[i], point)) return true;\n return false;\n },\n GeometryCollection: function(object2, point) {\n var geometries = object2.geometries, i = -1, n = geometries.length;\n while (++i < n) if (containsGeometry(geometries[i], point)) return true;\n return false;\n }\n };\n function containsGeometry(geometry, point) {\n return geometry && containsGeometryType.hasOwnProperty(geometry.type) ? containsGeometryType[geometry.type](geometry, point) : false;\n }\n function containsPoint(coordinates2, point) {\n return distance(coordinates2, point) === 0;\n }\n function containsLine(coordinates2, point) {\n var ao, bo, ab;\n for (var i = 0, n = coordinates2.length; i < n; i++) {\n bo = distance(coordinates2[i], point);\n if (bo === 0) return true;\n if (i > 0) {\n ab = distance(coordinates2[i], coordinates2[i - 1]);\n if (ab > 0 && ao <= ab && bo <= ab && (ao + bo - ab) * (1 - Math.pow((ao - bo) / ab, 2)) < epsilon22 * ab)\n return true;\n }\n ao = bo;\n }\n return false;\n }\n function containsPolygon(coordinates2, point) {\n return !!polygonContains(coordinates2.map(ringRadians), pointRadians(point));\n }\n function ringRadians(ring) {\n return ring = ring.map(pointRadians), ring.pop(), ring;\n }\n function pointRadians(point) {\n return [point[0] * radians2, point[1] * radians2];\n }\n function contains(object2, point) {\n return (object2 && containsObjectType.hasOwnProperty(object2.type) ? containsObjectType[object2.type] : containsGeometry)(object2, point);\n }\n function graticuleX(y02, y12, dy) {\n var y = d3Array.range(y02, y12 - epsilon, dy).concat(y12);\n return function(x) {\n return y.map(function(y2) {\n return [x, y2];\n });\n };\n }\n function graticuleY(x02, x12, dx) {\n var x = d3Array.range(x02, x12 - epsilon, dx).concat(x12);\n return function(y) {\n return x.map(function(x2) {\n return [x2, y];\n });\n };\n }\n function graticule() {\n var x12, x02, X12, X02, y12, y02, Y12, Y02, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5;\n function graticule2() {\n return { type: \"MultiLineString\", coordinates: lines() };\n }\n function lines() {\n return d3Array.range(ceil(X02 / DX) * DX, X12, DX).map(X).concat(d3Array.range(ceil(Y02 / DY) * DY, Y12, DY).map(Y)).concat(d3Array.range(ceil(x02 / dx) * dx, x12, dx).filter(function(x2) {\n return abs(x2 % DX) > epsilon;\n }).map(x)).concat(d3Array.range(ceil(y02 / dy) * dy, y12, dy).filter(function(y2) {\n return abs(y2 % DY) > epsilon;\n }).map(y));\n }\n graticule2.lines = function() {\n return lines().map(function(coordinates2) {\n return { type: \"LineString\", coordinates: coordinates2 };\n });\n };\n graticule2.outline = function() {\n return {\n type: \"Polygon\",\n coordinates: [\n X(X02).concat(\n Y(Y12).slice(1),\n X(X12).reverse().slice(1),\n Y(Y02).reverse().slice(1)\n )\n ]\n };\n };\n graticule2.extent = function(_) {\n if (!arguments.length) return graticule2.extentMinor();\n return graticule2.extentMajor(_).extentMinor(_);\n };\n graticule2.extentMajor = function(_) {\n if (!arguments.length) return [[X02, Y02], [X12, Y12]];\n X02 = +_[0][0], X12 = +_[1][0];\n Y02 = +_[0][1], Y12 = +_[1][1];\n if (X02 > X12) _ = X02, X02 = X12, X12 = _;\n if (Y02 > Y12) _ = Y02, Y02 = Y12, Y12 = _;\n return graticule2.precision(precision);\n };\n graticule2.extentMinor = function(_) {\n if (!arguments.length) return [[x02, y02], [x12, y12]];\n x02 = +_[0][0], x12 = +_[1][0];\n y02 = +_[0][1], y12 = +_[1][1];\n if (x02 > x12) _ = x02, x02 = x12, x12 = _;\n if (y02 > y12) _ = y02, y02 = y12, y12 = _;\n return graticule2.precision(precision);\n };\n graticule2.step = function(_) {\n if (!arguments.length) return graticule2.stepMinor();\n return graticule2.stepMajor(_).stepMinor(_);\n };\n graticule2.stepMajor = function(_) {\n if (!arguments.length) return [DX, DY];\n DX = +_[0], DY = +_[1];\n return graticule2;\n };\n graticule2.stepMinor = function(_) {\n if (!arguments.length) return [dx, dy];\n dx = +_[0], dy = +_[1];\n return graticule2;\n };\n graticule2.precision = function(_) {\n if (!arguments.length) return precision;\n precision = +_;\n x = graticuleX(y02, y12, 90);\n y = graticuleY(x02, x12, precision);\n X = graticuleX(Y02, Y12, 90);\n Y = graticuleY(X02, X12, precision);\n return graticule2;\n };\n return graticule2.extentMajor([[-180, -90 + epsilon], [180, 90 - epsilon]]).extentMinor([[-180, -80 - epsilon], [180, 80 + epsilon]]);\n }\n function graticule10() {\n return graticule()();\n }\n function interpolate(a, b) {\n var x02 = a[0] * radians2, y02 = a[1] * radians2, x12 = b[0] * radians2, y12 = b[1] * radians2, cy0 = cos(y02), sy0 = sin(y02), cy1 = cos(y12), sy1 = sin(y12), kx0 = cy0 * cos(x02), ky0 = cy0 * sin(x02), kx1 = cy1 * cos(x12), ky1 = cy1 * sin(x12), d = 2 * asin(sqrt(haversin(y12 - y02) + cy0 * cy1 * haversin(x12 - x02))), k = sin(d);\n var interpolate2 = d ? function(t) {\n var B2 = sin(t *= d) / k, A5 = sin(d - t) / k, x = A5 * kx0 + B2 * kx1, y = A5 * ky0 + B2 * ky1, z = A5 * sy0 + B2 * sy1;\n return [\n atan2(y, x) * degrees3,\n atan2(z, sqrt(x * x + y * y)) * degrees3\n ];\n } : function() {\n return [x02 * degrees3, y02 * degrees3];\n };\n interpolate2.distance = d;\n return interpolate2;\n }\n function identity2(x) {\n return x;\n }\n var areaSum$1 = adder(), areaRingSum$1 = adder(), x00, y00, x0$1, y0$1;\n var areaStream$1 = {\n point: noop,\n lineStart: noop,\n lineEnd: noop,\n polygonStart: function() {\n areaStream$1.lineStart = areaRingStart$1;\n areaStream$1.lineEnd = areaRingEnd$1;\n },\n polygonEnd: function() {\n areaStream$1.lineStart = areaStream$1.lineEnd = areaStream$1.point = noop;\n areaSum$1.add(abs(areaRingSum$1));\n areaRingSum$1.reset();\n },\n result: function() {\n var area2 = areaSum$1 / 2;\n areaSum$1.reset();\n return area2;\n }\n };\n function areaRingStart$1() {\n areaStream$1.point = areaPointFirst$1;\n }\n function areaPointFirst$1(x, y) {\n areaStream$1.point = areaPoint$1;\n x00 = x0$1 = x, y00 = y0$1 = y;\n }\n function areaPoint$1(x, y) {\n areaRingSum$1.add(y0$1 * x - x0$1 * y);\n x0$1 = x, y0$1 = y;\n }\n function areaRingEnd$1() {\n areaPoint$1(x00, y00);\n }\n var x0$2 = Infinity, y0$2 = x0$2, x1 = -x0$2, y1 = x1;\n var boundsStream$1 = {\n point: boundsPoint$1,\n lineStart: noop,\n lineEnd: noop,\n polygonStart: noop,\n polygonEnd: noop,\n result: function() {\n var bounds2 = [[x0$2, y0$2], [x1, y1]];\n x1 = y1 = -(y0$2 = x0$2 = Infinity);\n return bounds2;\n }\n };\n function boundsPoint$1(x, y) {\n if (x < x0$2) x0$2 = x;\n if (x > x1) x1 = x;\n if (y < y0$2) y0$2 = y;\n if (y > y1) y1 = y;\n }\n var X0$1 = 0, Y0$1 = 0, Z0$1 = 0, X1$1 = 0, Y1$1 = 0, Z1$1 = 0, X2$1 = 0, Y2$1 = 0, Z2$1 = 0, x00$1, y00$1, x0$3, y0$3;\n var centroidStream$1 = {\n point: centroidPoint$1,\n lineStart: centroidLineStart$1,\n lineEnd: centroidLineEnd$1,\n polygonStart: function() {\n centroidStream$1.lineStart = centroidRingStart$1;\n centroidStream$1.lineEnd = centroidRingEnd$1;\n },\n polygonEnd: function() {\n centroidStream$1.point = centroidPoint$1;\n centroidStream$1.lineStart = centroidLineStart$1;\n centroidStream$1.lineEnd = centroidLineEnd$1;\n },\n result: function() {\n var centroid2 = Z2$1 ? [X2$1 / Z2$1, Y2$1 / Z2$1] : Z1$1 ? [X1$1 / Z1$1, Y1$1 / Z1$1] : Z0$1 ? [X0$1 / Z0$1, Y0$1 / Z0$1] : [NaN, NaN];\n X0$1 = Y0$1 = Z0$1 = X1$1 = Y1$1 = Z1$1 = X2$1 = Y2$1 = Z2$1 = 0;\n return centroid2;\n }\n };\n function centroidPoint$1(x, y) {\n X0$1 += x;\n Y0$1 += y;\n ++Z0$1;\n }\n function centroidLineStart$1() {\n centroidStream$1.point = centroidPointFirstLine;\n }\n function centroidPointFirstLine(x, y) {\n centroidStream$1.point = centroidPointLine;\n centroidPoint$1(x0$3 = x, y0$3 = y);\n }\n function centroidPointLine(x, y) {\n var dx = x - x0$3, dy = y - y0$3, z = sqrt(dx * dx + dy * dy);\n X1$1 += z * (x0$3 + x) / 2;\n Y1$1 += z * (y0$3 + y) / 2;\n Z1$1 += z;\n centroidPoint$1(x0$3 = x, y0$3 = y);\n }\n function centroidLineEnd$1() {\n centroidStream$1.point = centroidPoint$1;\n }\n function centroidRingStart$1() {\n centroidStream$1.point = centroidPointFirstRing;\n }\n function centroidRingEnd$1() {\n centroidPointRing(x00$1, y00$1);\n }\n function centroidPointFirstRing(x, y) {\n centroidStream$1.point = centroidPointRing;\n centroidPoint$1(x00$1 = x0$3 = x, y00$1 = y0$3 = y);\n }\n function centroidPointRing(x, y) {\n var dx = x - x0$3, dy = y - y0$3, z = sqrt(dx * dx + dy * dy);\n X1$1 += z * (x0$3 + x) / 2;\n Y1$1 += z * (y0$3 + y) / 2;\n Z1$1 += z;\n z = y0$3 * x - x0$3 * y;\n X2$1 += z * (x0$3 + x);\n Y2$1 += z * (y0$3 + y);\n Z2$1 += z * 3;\n centroidPoint$1(x0$3 = x, y0$3 = y);\n }\n function PathContext(context) {\n this._context = context;\n }\n PathContext.prototype = {\n _radius: 4.5,\n pointRadius: function(_) {\n return this._radius = _, this;\n },\n polygonStart: function() {\n this._line = 0;\n },\n polygonEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line === 0) this._context.closePath();\n this._point = NaN;\n },\n point: function(x, y) {\n switch (this._point) {\n case 0: {\n this._context.moveTo(x, y);\n this._point = 1;\n break;\n }\n case 1: {\n this._context.lineTo(x, y);\n break;\n }\n default: {\n this._context.moveTo(x + this._radius, y);\n this._context.arc(x, y, this._radius, 0, tau);\n break;\n }\n }\n },\n result: noop\n };\n var lengthSum$1 = adder(), lengthRing, x00$2, y00$2, x0$4, y0$4;\n var lengthStream$1 = {\n point: noop,\n lineStart: function() {\n lengthStream$1.point = lengthPointFirst$1;\n },\n lineEnd: function() {\n if (lengthRing) lengthPoint$1(x00$2, y00$2);\n lengthStream$1.point = noop;\n },\n polygonStart: function() {\n lengthRing = true;\n },\n polygonEnd: function() {\n lengthRing = null;\n },\n result: function() {\n var length2 = +lengthSum$1;\n lengthSum$1.reset();\n return length2;\n }\n };\n function lengthPointFirst$1(x, y) {\n lengthStream$1.point = lengthPoint$1;\n x00$2 = x0$4 = x, y00$2 = y0$4 = y;\n }\n function lengthPoint$1(x, y) {\n x0$4 -= x, y0$4 -= y;\n lengthSum$1.add(sqrt(x0$4 * x0$4 + y0$4 * y0$4));\n x0$4 = x, y0$4 = y;\n }\n function PathString() {\n this._string = [];\n }\n PathString.prototype = {\n _radius: 4.5,\n _circle: circle$1(4.5),\n pointRadius: function(_) {\n if ((_ = +_) !== this._radius) this._radius = _, this._circle = null;\n return this;\n },\n polygonStart: function() {\n this._line = 0;\n },\n polygonEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line === 0) this._string.push(\"Z\");\n this._point = NaN;\n },\n point: function(x, y) {\n switch (this._point) {\n case 0: {\n this._string.push(\"M\", x, \",\", y);\n this._point = 1;\n break;\n }\n case 1: {\n this._string.push(\"L\", x, \",\", y);\n break;\n }\n default: {\n if (this._circle == null) this._circle = circle$1(this._radius);\n this._string.push(\"M\", x, \",\", y, this._circle);\n break;\n }\n }\n },\n result: function() {\n if (this._string.length) {\n var result = this._string.join(\"\");\n this._string = [];\n return result;\n } else {\n return null;\n }\n }\n };\n function circle$1(radius) {\n return \"m0,\" + radius + \"a\" + radius + \",\" + radius + \" 0 1,1 0,\" + -2 * radius + \"a\" + radius + \",\" + radius + \" 0 1,1 0,\" + 2 * radius + \"z\";\n }\n function index(projection2, context) {\n var pointRadius = 4.5, projectionStream, contextStream;\n function path(object2) {\n if (object2) {\n if (typeof pointRadius === \"function\") contextStream.pointRadius(+pointRadius.apply(this, arguments));\n geoStream(object2, projectionStream(contextStream));\n }\n return contextStream.result();\n }\n path.area = function(object2) {\n geoStream(object2, projectionStream(areaStream$1));\n return areaStream$1.result();\n };\n path.measure = function(object2) {\n geoStream(object2, projectionStream(lengthStream$1));\n return lengthStream$1.result();\n };\n path.bounds = function(object2) {\n geoStream(object2, projectionStream(boundsStream$1));\n return boundsStream$1.result();\n };\n path.centroid = function(object2) {\n geoStream(object2, projectionStream(centroidStream$1));\n return centroidStream$1.result();\n };\n path.projection = function(_) {\n return arguments.length ? (projectionStream = _ == null ? (projection2 = null, identity2) : (projection2 = _).stream, path) : projection2;\n };\n path.context = function(_) {\n if (!arguments.length) return context;\n contextStream = _ == null ? (context = null, new PathString()) : new PathContext(context = _);\n if (typeof pointRadius !== \"function\") contextStream.pointRadius(pointRadius);\n return path;\n };\n path.pointRadius = function(_) {\n if (!arguments.length) return pointRadius;\n pointRadius = typeof _ === \"function\" ? _ : (contextStream.pointRadius(+_), +_);\n return path;\n };\n return path.projection(projection2).context(context);\n }\n function transform(methods) {\n return {\n stream: transformer(methods)\n };\n }\n function transformer(methods) {\n return function(stream) {\n var s = new TransformStream();\n for (var key in methods) s[key] = methods[key];\n s.stream = stream;\n return s;\n };\n }\n function TransformStream() {\n }\n TransformStream.prototype = {\n constructor: TransformStream,\n point: function(x, y) {\n this.stream.point(x, y);\n },\n sphere: function() {\n this.stream.sphere();\n },\n lineStart: function() {\n this.stream.lineStart();\n },\n lineEnd: function() {\n this.stream.lineEnd();\n },\n polygonStart: function() {\n this.stream.polygonStart();\n },\n polygonEnd: function() {\n this.stream.polygonEnd();\n }\n };\n function fit(projection2, fitBounds, object2) {\n var clip2 = projection2.clipExtent && projection2.clipExtent();\n projection2.scale(150).translate([0, 0]);\n if (clip2 != null) projection2.clipExtent(null);\n geoStream(object2, projection2.stream(boundsStream$1));\n fitBounds(boundsStream$1.result());\n if (clip2 != null) projection2.clipExtent(clip2);\n return projection2;\n }\n function fitExtent(projection2, extent2, object2) {\n return fit(projection2, function(b) {\n var w = extent2[1][0] - extent2[0][0], h = extent2[1][1] - extent2[0][1], k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x = +extent2[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, y = +extent2[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;\n projection2.scale(150 * k).translate([x, y]);\n }, object2);\n }\n function fitSize(projection2, size, object2) {\n return fitExtent(projection2, [[0, 0], size], object2);\n }\n function fitWidth(projection2, width, object2) {\n return fit(projection2, function(b) {\n var w = +width, k = w / (b[1][0] - b[0][0]), x = (w - k * (b[1][0] + b[0][0])) / 2, y = -k * b[0][1];\n projection2.scale(150 * k).translate([x, y]);\n }, object2);\n }\n function fitHeight(projection2, height, object2) {\n return fit(projection2, function(b) {\n var h = +height, k = h / (b[1][1] - b[0][1]), x = -k * b[0][0], y = (h - k * (b[1][1] + b[0][1])) / 2;\n projection2.scale(150 * k).translate([x, y]);\n }, object2);\n }\n var maxDepth = 16, cosMinDistance = cos(30 * radians2);\n function resample(project, delta2) {\n return +delta2 ? resample$1(project, delta2) : resampleNone(project);\n }\n function resampleNone(project) {\n return transformer({\n point: function(x, y) {\n x = project(x, y);\n this.stream.point(x[0], x[1]);\n }\n });\n }\n function resample$1(project, delta2) {\n function resampleLineTo(x02, y02, lambda02, a0, b0, c0, x12, y12, lambda12, a1, b1, c1, depth, stream) {\n var dx = x12 - x02, dy = y12 - y02, d2 = dx * dx + dy * dy;\n if (d2 > 4 * delta2 && depth--) {\n var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = sqrt(a * a + b * b + c * c), phi2 = asin(c /= m), lambda22 = abs(abs(c) - 1) < epsilon || abs(lambda02 - lambda12) < epsilon ? (lambda02 + lambda12) / 2 : atan2(b, a), p = project(lambda22, phi2), x2 = p[0], y2 = p[1], dx2 = x2 - x02, dy2 = y2 - y02, dz = dy * dx2 - dx * dy2;\n if (dz * dz / d2 > delta2 || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {\n resampleLineTo(x02, y02, lambda02, a0, b0, c0, x2, y2, lambda22, a /= m, b /= m, c, depth, stream);\n stream.point(x2, y2);\n resampleLineTo(x2, y2, lambda22, a, b, c, x12, y12, lambda12, a1, b1, c1, depth, stream);\n }\n }\n }\n return function(stream) {\n var lambda002, x002, y002, a00, b00, c00, lambda02, x02, y02, a0, b0, c0;\n var resampleStream = {\n point,\n lineStart,\n lineEnd,\n polygonStart: function() {\n stream.polygonStart();\n resampleStream.lineStart = ringStart;\n },\n polygonEnd: function() {\n stream.polygonEnd();\n resampleStream.lineStart = lineStart;\n }\n };\n function point(x, y) {\n x = project(x, y);\n stream.point(x[0], x[1]);\n }\n function lineStart() {\n x02 = NaN;\n resampleStream.point = linePoint2;\n stream.lineStart();\n }\n function linePoint2(lambda, phi) {\n var c = cartesian([lambda, phi]), p = project(lambda, phi);\n resampleLineTo(x02, y02, lambda02, a0, b0, c0, x02 = p[0], y02 = p[1], lambda02 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);\n stream.point(x02, y02);\n }\n function lineEnd() {\n resampleStream.point = point;\n stream.lineEnd();\n }\n function ringStart() {\n lineStart();\n resampleStream.point = ringPoint;\n resampleStream.lineEnd = ringEnd;\n }\n function ringPoint(lambda, phi) {\n linePoint2(lambda002 = lambda, phi), x002 = x02, y002 = y02, a00 = a0, b00 = b0, c00 = c0;\n resampleStream.point = linePoint2;\n }\n function ringEnd() {\n resampleLineTo(x02, y02, lambda02, a0, b0, c0, x002, y002, lambda002, a00, b00, c00, maxDepth, stream);\n resampleStream.lineEnd = lineEnd;\n lineEnd();\n }\n return resampleStream;\n };\n }\n var transformRadians = transformer({\n point: function(x, y) {\n this.stream.point(x * radians2, y * radians2);\n }\n });\n function transformRotate(rotate) {\n return transformer({\n point: function(x, y) {\n var r = rotate(x, y);\n return this.stream.point(r[0], r[1]);\n }\n });\n }\n function scaleTranslate(k, dx, dy, sx, sy) {\n function transform2(x, y) {\n x *= sx;\n y *= sy;\n return [dx + k * x, dy - k * y];\n }\n transform2.invert = function(x, y) {\n return [(x - dx) / k * sx, (dy - y) / k * sy];\n };\n return transform2;\n }\n function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) {\n var cosAlpha = cos(alpha), sinAlpha = sin(alpha), a = cosAlpha * k, b = sinAlpha * k, ai = cosAlpha / k, bi = sinAlpha / k, ci = (sinAlpha * dy - cosAlpha * dx) / k, fi = (sinAlpha * dx + cosAlpha * dy) / k;\n function transform2(x, y) {\n x *= sx;\n y *= sy;\n return [a * x - b * y + dx, dy - b * x - a * y];\n }\n transform2.invert = function(x, y) {\n return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)];\n };\n return transform2;\n }\n function projection(project) {\n return projectionMutator(function() {\n return project;\n })();\n }\n function projectionMutator(projectAt) {\n var project, k = 150, x = 480, y = 250, lambda = 0, phi = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, alpha = 0, sx = 1, sy = 1, theta = null, preclip = clipAntimeridian, x02 = null, y02, x12, y12, postclip = identity2, delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache, cacheStream;\n function projection2(point) {\n return projectRotateTransform(point[0] * radians2, point[1] * radians2);\n }\n function invert(point) {\n point = projectRotateTransform.invert(point[0], point[1]);\n return point && [point[0] * degrees3, point[1] * degrees3];\n }\n projection2.stream = function(stream) {\n return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));\n };\n projection2.preclip = function(_) {\n return arguments.length ? (preclip = _, theta = void 0, reset()) : preclip;\n };\n projection2.postclip = function(_) {\n return arguments.length ? (postclip = _, x02 = y02 = x12 = y12 = null, reset()) : postclip;\n };\n projection2.clipAngle = function(_) {\n return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians2) : (theta = null, clipAntimeridian), reset()) : theta * degrees3;\n };\n projection2.clipExtent = function(_) {\n return arguments.length ? (postclip = _ == null ? (x02 = y02 = x12 = y12 = null, identity2) : clipRectangle(x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset()) : x02 == null ? null : [[x02, y02], [x12, y12]];\n };\n projection2.scale = function(_) {\n return arguments.length ? (k = +_, recenter()) : k;\n };\n projection2.translate = function(_) {\n return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];\n };\n projection2.center = function(_) {\n return arguments.length ? (lambda = _[0] % 360 * radians2, phi = _[1] % 360 * radians2, recenter()) : [lambda * degrees3, phi * degrees3];\n };\n projection2.rotate = function(_) {\n return arguments.length ? (deltaLambda = _[0] % 360 * radians2, deltaPhi = _[1] % 360 * radians2, deltaGamma = _.length > 2 ? _[2] % 360 * radians2 : 0, recenter()) : [deltaLambda * degrees3, deltaPhi * degrees3, deltaGamma * degrees3];\n };\n projection2.angle = function(_) {\n return arguments.length ? (alpha = _ % 360 * radians2, recenter()) : alpha * degrees3;\n };\n projection2.reflectX = function(_) {\n return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0;\n };\n projection2.reflectY = function(_) {\n return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0;\n };\n projection2.precision = function(_) {\n return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);\n };\n projection2.fitExtent = function(extent2, object2) {\n return fitExtent(projection2, extent2, object2);\n };\n projection2.fitSize = function(size, object2) {\n return fitSize(projection2, size, object2);\n };\n projection2.fitWidth = function(width, object2) {\n return fitWidth(projection2, width, object2);\n };\n projection2.fitHeight = function(height, object2) {\n return fitHeight(projection2, height, object2);\n };\n function recenter() {\n var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform2 = (alpha ? scaleTranslateRotate : scaleTranslate)(k, x - center[0], y - center[1], sx, sy, alpha);\n rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);\n projectTransform = compose(project, transform2);\n projectRotateTransform = compose(rotate, projectTransform);\n projectResample = resample(projectTransform, delta2);\n return reset();\n }\n function reset() {\n cache = cacheStream = null;\n return projection2;\n }\n return function() {\n project = projectAt.apply(this, arguments);\n projection2.invert = project.invert && invert;\n return recenter();\n };\n }\n function conicProjection(projectAt) {\n var phi02 = 0, phi12 = pi / 3, m = projectionMutator(projectAt), p = m(phi02, phi12);\n p.parallels = function(_) {\n return arguments.length ? m(phi02 = _[0] * radians2, phi12 = _[1] * radians2) : [phi02 * degrees3, phi12 * degrees3];\n };\n return p;\n }\n function cylindricalEqualAreaRaw(phi02) {\n var cosPhi02 = cos(phi02);\n function forward(lambda, phi) {\n return [lambda * cosPhi02, sin(phi) / cosPhi02];\n }\n forward.invert = function(x, y) {\n return [x / cosPhi02, asin(y * cosPhi02)];\n };\n return forward;\n }\n function conicEqualAreaRaw(y02, y12) {\n var sy0 = sin(y02), n = (sy0 + sin(y12)) / 2;\n if (abs(n) < epsilon) return cylindricalEqualAreaRaw(y02);\n var c = 1 + sy0 * (2 * n - sy0), r0 = sqrt(c) / n;\n function project(x, y) {\n var r = sqrt(c - 2 * n * sin(y)) / n;\n return [r * sin(x *= n), r0 - r * cos(x)];\n }\n project.invert = function(x, y) {\n var r0y = r0 - y, l = atan2(x, abs(r0y)) * sign(r0y);\n if (r0y * n < 0)\n l -= pi * sign(x) * sign(r0y);\n return [l / n, asin((c - (x * x + r0y * r0y) * n * n) / (2 * n))];\n };\n return project;\n }\n function conicEqualArea() {\n return conicProjection(conicEqualAreaRaw).scale(155.424).center([0, 33.6442]);\n }\n function albers() {\n return conicEqualArea().parallels([29.5, 45.5]).scale(1070).translate([480, 250]).rotate([96, 0]).center([-0.6, 38.7]);\n }\n function multiplex(streams) {\n var n = streams.length;\n return {\n point: function(x, y) {\n var i = -1;\n while (++i < n) streams[i].point(x, y);\n },\n sphere: function() {\n var i = -1;\n while (++i < n) streams[i].sphere();\n },\n lineStart: function() {\n var i = -1;\n while (++i < n) streams[i].lineStart();\n },\n lineEnd: function() {\n var i = -1;\n while (++i < n) streams[i].lineEnd();\n },\n polygonStart: function() {\n var i = -1;\n while (++i < n) streams[i].polygonStart();\n },\n polygonEnd: function() {\n var i = -1;\n while (++i < n) streams[i].polygonEnd();\n }\n };\n }\n function albersUsa() {\n var cache, cacheStream, lower48 = albers(), lower48Point, alaska = conicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, hawaii = conicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, point, pointStream = { point: function(x, y) {\n point = [x, y];\n } };\n function albersUsa2(coordinates2) {\n var x = coordinates2[0], y = coordinates2[1];\n return point = null, (lower48Point.point(x, y), point) || (alaskaPoint.point(x, y), point) || (hawaiiPoint.point(x, y), point);\n }\n albersUsa2.invert = function(coordinates2) {\n var k = lower48.scale(), t = lower48.translate(), x = (coordinates2[0] - t[0]) / k, y = (coordinates2[1] - t[1]) / k;\n return (y >= 0.12 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii : lower48).invert(coordinates2);\n };\n albersUsa2.stream = function(stream) {\n return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]);\n };\n albersUsa2.precision = function(_) {\n if (!arguments.length) return lower48.precision();\n lower48.precision(_), alaska.precision(_), hawaii.precision(_);\n return reset();\n };\n albersUsa2.scale = function(_) {\n if (!arguments.length) return lower48.scale();\n lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_);\n return albersUsa2.translate(lower48.translate());\n };\n albersUsa2.translate = function(_) {\n if (!arguments.length) return lower48.translate();\n var k = lower48.scale(), x = +_[0], y = +_[1];\n lower48Point = lower48.translate(_).clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]]).stream(pointStream);\n alaskaPoint = alaska.translate([x - 0.307 * k, y + 0.201 * k]).clipExtent([[x - 0.425 * k + epsilon, y + 0.12 * k + epsilon], [x - 0.214 * k - epsilon, y + 0.234 * k - epsilon]]).stream(pointStream);\n hawaiiPoint = hawaii.translate([x - 0.205 * k, y + 0.212 * k]).clipExtent([[x - 0.214 * k + epsilon, y + 0.166 * k + epsilon], [x - 0.115 * k - epsilon, y + 0.234 * k - epsilon]]).stream(pointStream);\n return reset();\n };\n albersUsa2.fitExtent = function(extent2, object2) {\n return fitExtent(albersUsa2, extent2, object2);\n };\n albersUsa2.fitSize = function(size, object2) {\n return fitSize(albersUsa2, size, object2);\n };\n albersUsa2.fitWidth = function(width, object2) {\n return fitWidth(albersUsa2, width, object2);\n };\n albersUsa2.fitHeight = function(height, object2) {\n return fitHeight(albersUsa2, height, object2);\n };\n function reset() {\n cache = cacheStream = null;\n return albersUsa2;\n }\n return albersUsa2.scale(1070);\n }\n function azimuthalRaw(scale) {\n return function(x, y) {\n var cx = cos(x), cy = cos(y), k = scale(cx * cy);\n return [\n k * cy * sin(x),\n k * sin(y)\n ];\n };\n }\n function azimuthalInvert(angle2) {\n return function(x, y) {\n var z = sqrt(x * x + y * y), c = angle2(z), sc = sin(c), cc = cos(c);\n return [\n atan2(x * sc, z * cc),\n asin(z && y * sc / z)\n ];\n };\n }\n var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) {\n return sqrt(2 / (1 + cxcy));\n });\n azimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) {\n return 2 * asin(z / 2);\n });\n function azimuthalEqualArea() {\n return projection(azimuthalEqualAreaRaw).scale(124.75).clipAngle(180 - 1e-3);\n }\n var azimuthalEquidistantRaw = azimuthalRaw(function(c) {\n return (c = acos(c)) && c / sin(c);\n });\n azimuthalEquidistantRaw.invert = azimuthalInvert(function(z) {\n return z;\n });\n function azimuthalEquidistant() {\n return projection(azimuthalEquidistantRaw).scale(79.4188).clipAngle(180 - 1e-3);\n }\n function mercatorRaw(lambda, phi) {\n return [lambda, log(tan((halfPi + phi) / 2))];\n }\n mercatorRaw.invert = function(x, y) {\n return [x, 2 * atan(exp(y)) - halfPi];\n };\n function mercator() {\n return mercatorProjection(mercatorRaw).scale(961 / tau);\n }\n function mercatorProjection(project) {\n var m = projection(project), center = m.center, scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, x02 = null, y02, x12, y12;\n m.scale = function(_) {\n return arguments.length ? (scale(_), reclip()) : scale();\n };\n m.translate = function(_) {\n return arguments.length ? (translate(_), reclip()) : translate();\n };\n m.center = function(_) {\n return arguments.length ? (center(_), reclip()) : center();\n };\n m.clipExtent = function(_) {\n return arguments.length ? (_ == null ? x02 = y02 = x12 = y12 = null : (x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reclip()) : x02 == null ? null : [[x02, y02], [x12, y12]];\n };\n function reclip() {\n var k = pi * scale(), t = m(rotation(m.rotate()).invert([0, 0]));\n return clipExtent(x02 == null ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw ? [[Math.max(t[0] - k, x02), y02], [Math.min(t[0] + k, x12), y12]] : [[x02, Math.max(t[1] - k, y02)], [x12, Math.min(t[1] + k, y12)]]);\n }\n return reclip();\n }\n function tany(y) {\n return tan((halfPi + y) / 2);\n }\n function conicConformalRaw(y02, y12) {\n var cy0 = cos(y02), n = y02 === y12 ? sin(y02) : log(cy0 / cos(y12)) / log(tany(y12) / tany(y02)), f = cy0 * pow(tany(y02), n) / n;\n if (!n) return mercatorRaw;\n function project(x, y) {\n if (f > 0) {\n if (y < -halfPi + epsilon) y = -halfPi + epsilon;\n } else {\n if (y > halfPi - epsilon) y = halfPi - epsilon;\n }\n var r = f / pow(tany(y), n);\n return [r * sin(n * x), f - r * cos(n * x)];\n }\n project.invert = function(x, y) {\n var fy = f - y, r = sign(n) * sqrt(x * x + fy * fy), l = atan2(x, abs(fy)) * sign(fy);\n if (fy * n < 0)\n l -= pi * sign(x) * sign(fy);\n return [l / n, 2 * atan(pow(f / r, 1 / n)) - halfPi];\n };\n return project;\n }\n function conicConformal() {\n return conicProjection(conicConformalRaw).scale(109.5).parallels([30, 30]);\n }\n function equirectangularRaw(lambda, phi) {\n return [lambda, phi];\n }\n equirectangularRaw.invert = equirectangularRaw;\n function equirectangular() {\n return projection(equirectangularRaw).scale(152.63);\n }\n function conicEquidistantRaw(y02, y12) {\n var cy0 = cos(y02), n = y02 === y12 ? sin(y02) : (cy0 - cos(y12)) / (y12 - y02), g = cy0 / n + y02;\n if (abs(n) < epsilon) return equirectangularRaw;\n function project(x, y) {\n var gy = g - y, nx = n * x;\n return [gy * sin(nx), g - gy * cos(nx)];\n }\n project.invert = function(x, y) {\n var gy = g - y, l = atan2(x, abs(gy)) * sign(gy);\n if (gy * n < 0)\n l -= pi * sign(x) * sign(gy);\n return [l / n, g - sign(n) * sqrt(x * x + gy * gy)];\n };\n return project;\n }\n function conicEquidistant() {\n return conicProjection(conicEquidistantRaw).scale(131.154).center([0, 13.9389]);\n }\n var A1 = 1.340264, A2 = -0.081106, A3 = 893e-6, A4 = 3796e-6, M = sqrt(3) / 2, iterations = 12;\n function equalEarthRaw(lambda, phi) {\n var l = asin(M * sin(phi)), l2 = l * l, l6 = l2 * l2 * l2;\n return [\n lambda * cos(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))),\n l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2))\n ];\n }\n equalEarthRaw.invert = function(x, y) {\n var l = y, l2 = l * l, l6 = l2 * l2 * l2;\n for (var i = 0, delta, fy, fpy; i < iterations; ++i) {\n fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y;\n fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2);\n l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2;\n if (abs(delta) < epsilon22) break;\n }\n return [\n M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos(l),\n asin(sin(l) / M)\n ];\n };\n function equalEarth() {\n return projection(equalEarthRaw).scale(177.158);\n }\n function gnomonicRaw(x, y) {\n var cy = cos(y), k = cos(x) * cy;\n return [cy * sin(x) / k, sin(y) / k];\n }\n gnomonicRaw.invert = azimuthalInvert(atan);\n function gnomonic() {\n return projection(gnomonicRaw).scale(144.049).clipAngle(60);\n }\n function identity$1() {\n var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, alpha = 0, ca, sa, x02 = null, y02, x12, y12, kx = 1, ky = 1, transform2 = transformer({\n point: function(x, y) {\n var p = projection2([x, y]);\n this.stream.point(p[0], p[1]);\n }\n }), postclip = identity2, cache, cacheStream;\n function reset() {\n kx = k * sx;\n ky = k * sy;\n cache = cacheStream = null;\n return projection2;\n }\n function projection2(p) {\n var x = p[0] * kx, y = p[1] * ky;\n if (alpha) {\n var t = y * ca - x * sa;\n x = x * ca + y * sa;\n y = t;\n }\n return [x + tx, y + ty];\n }\n projection2.invert = function(p) {\n var x = p[0] - tx, y = p[1] - ty;\n if (alpha) {\n var t = y * ca + x * sa;\n x = x * ca - y * sa;\n y = t;\n }\n return [x / kx, y / ky];\n };\n projection2.stream = function(stream) {\n return cache && cacheStream === stream ? cache : cache = transform2(postclip(cacheStream = stream));\n };\n projection2.postclip = function(_) {\n return arguments.length ? (postclip = _, x02 = y02 = x12 = y12 = null, reset()) : postclip;\n };\n projection2.clipExtent = function(_) {\n return arguments.length ? (postclip = _ == null ? (x02 = y02 = x12 = y12 = null, identity2) : clipRectangle(x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset()) : x02 == null ? null : [[x02, y02], [x12, y12]];\n };\n projection2.scale = function(_) {\n return arguments.length ? (k = +_, reset()) : k;\n };\n projection2.translate = function(_) {\n return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [tx, ty];\n };\n projection2.angle = function(_) {\n return arguments.length ? (alpha = _ % 360 * radians2, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees3;\n };\n projection2.reflectX = function(_) {\n return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0;\n };\n projection2.reflectY = function(_) {\n return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0;\n };\n projection2.fitExtent = function(extent2, object2) {\n return fitExtent(projection2, extent2, object2);\n };\n projection2.fitSize = function(size, object2) {\n return fitSize(projection2, size, object2);\n };\n projection2.fitWidth = function(width, object2) {\n return fitWidth(projection2, width, object2);\n };\n projection2.fitHeight = function(height, object2) {\n return fitHeight(projection2, height, object2);\n };\n return projection2;\n }\n function naturalEarth1Raw(lambda, phi) {\n var phi2 = phi * phi, phi4 = phi2 * phi2;\n return [\n lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (3971e-6 * phi2 - 1529e-6 * phi4))),\n phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 5916e-6 * phi4)))\n ];\n }\n naturalEarth1Raw.invert = function(x, y) {\n var phi = y, i = 25, delta;\n do {\n var phi2 = phi * phi, phi4 = phi2 * phi2;\n phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 5916e-6 * phi4))) - y) / (1.007226 + phi2 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi2 - 5916e-6 * 11 * phi4)));\n } while (abs(delta) > epsilon && --i > 0);\n return [\n x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (3971e-6 - 1529e-6 * phi2)))),\n phi\n ];\n };\n function naturalEarth1() {\n return projection(naturalEarth1Raw).scale(175.295);\n }\n function orthographicRaw(x, y) {\n return [cos(y) * sin(x), sin(y)];\n }\n orthographicRaw.invert = azimuthalInvert(asin);\n function orthographic() {\n return projection(orthographicRaw).scale(249.5).clipAngle(90 + epsilon);\n }\n function stereographicRaw(x, y) {\n var cy = cos(y), k = 1 + cos(x) * cy;\n return [cy * sin(x) / k, sin(y) / k];\n }\n stereographicRaw.invert = azimuthalInvert(function(z) {\n return 2 * atan(z);\n });\n function stereographic() {\n return projection(stereographicRaw).scale(250).clipAngle(142);\n }\n function transverseMercatorRaw(lambda, phi) {\n return [log(tan((halfPi + phi) / 2)), -lambda];\n }\n transverseMercatorRaw.invert = function(x, y) {\n return [-y, 2 * atan(exp(x)) - halfPi];\n };\n function transverseMercator() {\n var m = mercatorProjection(transverseMercatorRaw), center = m.center, rotate = m.rotate;\n m.center = function(_) {\n return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]);\n };\n m.rotate = function(_) {\n return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]);\n };\n return rotate([0, 0, 90]).scale(159.155);\n }\n exports2.geoAlbers = albers;\n exports2.geoAlbersUsa = albersUsa;\n exports2.geoArea = area;\n exports2.geoAzimuthalEqualArea = azimuthalEqualArea;\n exports2.geoAzimuthalEqualAreaRaw = azimuthalEqualAreaRaw;\n exports2.geoAzimuthalEquidistant = azimuthalEquidistant;\n exports2.geoAzimuthalEquidistantRaw = azimuthalEquidistantRaw;\n exports2.geoBounds = bounds;\n exports2.geoCentroid = centroid;\n exports2.geoCircle = circle;\n exports2.geoClipAntimeridian = clipAntimeridian;\n exports2.geoClipCircle = clipCircle;\n exports2.geoClipExtent = extent;\n exports2.geoClipRectangle = clipRectangle;\n exports2.geoConicConformal = conicConformal;\n exports2.geoConicConformalRaw = conicConformalRaw;\n exports2.geoConicEqualArea = conicEqualArea;\n exports2.geoConicEqualAreaRaw = conicEqualAreaRaw;\n exports2.geoConicEquidistant = conicEquidistant;\n exports2.geoConicEquidistantRaw = conicEquidistantRaw;\n exports2.geoContains = contains;\n exports2.geoDistance = distance;\n exports2.geoEqualEarth = equalEarth;\n exports2.geoEqualEarthRaw = equalEarthRaw;\n exports2.geoEquirectangular = equirectangular;\n exports2.geoEquirectangularRaw = equirectangularRaw;\n exports2.geoGnomonic = gnomonic;\n exports2.geoGnomonicRaw = gnomonicRaw;\n exports2.geoGraticule = graticule;\n exports2.geoGraticule10 = graticule10;\n exports2.geoIdentity = identity$1;\n exports2.geoInterpolate = interpolate;\n exports2.geoLength = length;\n exports2.geoMercator = mercator;\n exports2.geoMercatorRaw = mercatorRaw;\n exports2.geoNaturalEarth1 = naturalEarth1;\n exports2.geoNaturalEarth1Raw = naturalEarth1Raw;\n exports2.geoOrthographic = orthographic;\n exports2.geoOrthographicRaw = orthographicRaw;\n exports2.geoPath = index;\n exports2.geoProjection = projection;\n exports2.geoProjectionMutator = projectionMutator;\n exports2.geoRotation = rotation;\n exports2.geoStereographic = stereographic;\n exports2.geoStereographicRaw = stereographicRaw;\n exports2.geoStream = geoStream;\n exports2.geoTransform = transform;\n exports2.geoTransverseMercator = transverseMercator;\n exports2.geoTransverseMercatorRaw = transverseMercatorRaw;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // node_modules/d3-geo-projection/dist/d3-geo-projection.js\n var require_d3_geo_projection = __commonJS({\n \"node_modules/d3-geo-projection/dist/d3-geo-projection.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports, require_d3_geo(), require_d3_array()) : typeof define === \"function\" && false ? define([\"exports\", \"d3-geo\", \"d3-array\"], factory) : factory(global2.d3 = global2.d3 || {}, global2.d3, global2.d3);\n })(exports, function(exports2, d3Geo, d3Array) {\n \"use strict\";\n var abs = Math.abs;\n var atan = Math.atan;\n var atan2 = Math.atan2;\n var cos = Math.cos;\n var exp = Math.exp;\n var floor = Math.floor;\n var log = Math.log;\n var max = Math.max;\n var min = Math.min;\n var pow = Math.pow;\n var round = Math.round;\n var sign = Math.sign || function(x) {\n return x > 0 ? 1 : x < 0 ? -1 : 0;\n };\n var sin = Math.sin;\n var tan = Math.tan;\n var epsilon = 1e-6;\n var epsilon22 = 1e-12;\n var pi = Math.PI;\n var halfPi = pi / 2;\n var quarterPi = pi / 4;\n var sqrt1_2 = Math.SQRT1_2;\n var sqrt2 = sqrt(2);\n var sqrtPi = sqrt(pi);\n var tau = pi * 2;\n var degrees3 = 180 / pi;\n var radians2 = pi / 180;\n function sinci(x) {\n return x ? x / Math.sin(x) : 1;\n }\n function asin(x) {\n return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);\n }\n function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n }\n function sqrt(x) {\n return x > 0 ? Math.sqrt(x) : 0;\n }\n function tanh2(x) {\n x = exp(2 * x);\n return (x - 1) / (x + 1);\n }\n function sinh2(x) {\n return (exp(x) - exp(-x)) / 2;\n }\n function cosh2(x) {\n return (exp(x) + exp(-x)) / 2;\n }\n function arsinh(x) {\n return log(x + sqrt(x * x + 1));\n }\n function arcosh(x) {\n return log(x + sqrt(x * x - 1));\n }\n function airyRaw(beta) {\n var tanBeta_2 = tan(beta / 2), b = 2 * log(cos(beta / 2)) / (tanBeta_2 * tanBeta_2);\n function forward(x, y) {\n var cosx = cos(x), cosy = cos(y), siny = sin(y), cosz = cosy * cosx, k2 = -((1 - cosz ? log((1 + cosz) / 2) / (1 - cosz) : -0.5) + b / (1 + cosz));\n return [k2 * cosy * sin(x), k2 * siny];\n }\n forward.invert = function(x, y) {\n var r = sqrt(x * x + y * y), z = -beta / 2, i = 50, delta;\n if (!r) return [0, 0];\n do {\n var z_2 = z / 2, cosz_2 = cos(z_2), sinz_2 = sin(z_2), tanz_2 = sinz_2 / cosz_2, lnsecz_2 = -log(abs(cosz_2));\n z -= delta = (2 / tanz_2 * lnsecz_2 - b * tanz_2 - r) / (-lnsecz_2 / (sinz_2 * sinz_2) + 1 - b / (2 * cosz_2 * cosz_2)) * (cosz_2 < 0 ? 0.7 : 1);\n } while (abs(delta) > epsilon && --i > 0);\n var sinz = sin(z);\n return [atan2(x * sinz, r * cos(z)), asin(y * sinz / r)];\n };\n return forward;\n }\n function airy() {\n var beta = halfPi, m = d3Geo.geoProjectionMutator(airyRaw), p = m(beta);\n p.radius = function(_) {\n return arguments.length ? m(beta = _ * radians2) : beta * degrees3;\n };\n return p.scale(179.976).clipAngle(147);\n }\n function aitoffRaw(x, y) {\n var cosy = cos(y), sincia = sinci(acos(cosy * cos(x /= 2)));\n return [2 * cosy * sin(x) * sincia, sin(y) * sincia];\n }\n aitoffRaw.invert = function(x, y) {\n if (x * x + 4 * y * y > pi * pi + epsilon) return;\n var x12 = x, y12 = y, i = 25;\n do {\n var sinx = sin(x12), sinx_2 = sin(x12 / 2), cosx_2 = cos(x12 / 2), siny = sin(y12), cosy = cos(y12), sin_2y = sin(2 * y12), sin2y = siny * siny, cos2y = cosy * cosy, sin2x_2 = sinx_2 * sinx_2, c = 1 - cos2y * cosx_2 * cosx_2, e = c ? acos(cosy * cosx_2) * sqrt(f = 1 / c) : f = 0, f, fx = 2 * e * cosy * sinx_2 - x, fy = e * siny - y, dxdx = f * (cos2y * sin2x_2 + e * cosy * cosx_2 * sin2y), dxdy = f * (0.5 * sinx * sin_2y - e * 2 * siny * sinx_2), dydx = f * 0.25 * (sin_2y * sinx_2 - e * siny * cos2y * sinx), dydy = f * (sin2y * cosx_2 + e * sin2x_2 * cosy), z = dxdy * dydx - dydy * dxdx;\n if (!z) break;\n var dx = (fy * dxdy - fx * dydy) / z, dy = (fx * dydx - fy * dxdx) / z;\n x12 -= dx, y12 -= dy;\n } while ((abs(dx) > epsilon || abs(dy) > epsilon) && --i > 0);\n return [x12, y12];\n };\n function aitoff() {\n return d3Geo.geoProjection(aitoffRaw).scale(152.63);\n }\n function armadilloRaw(phi02) {\n var sinPhi0 = sin(phi02), cosPhi0 = cos(phi02), sPhi0 = phi02 >= 0 ? 1 : -1, tanPhi0 = tan(sPhi0 * phi02), k2 = (1 + sinPhi0 - cosPhi0) / 2;\n function forward(lambda, phi) {\n var cosPhi = cos(phi), cosLambda = cos(lambda /= 2);\n return [\n (1 + cosPhi) * sin(lambda),\n (sPhi0 * phi > -atan2(cosLambda, tanPhi0) - 1e-3 ? 0 : -sPhi0 * 10) + k2 + sin(phi) * cosPhi0 - (1 + cosPhi) * sinPhi0 * cosLambda\n // TODO D3 core should allow null or [NaN, NaN] to be returned.\n ];\n }\n forward.invert = function(x, y) {\n var lambda = 0, phi = 0, i = 50;\n do {\n var cosLambda = cos(lambda), sinLambda = sin(lambda), cosPhi = cos(phi), sinPhi = sin(phi), A3 = 1 + cosPhi, fx = A3 * sinLambda - x, fy = k2 + sinPhi * cosPhi0 - A3 * sinPhi0 * cosLambda - y, dxdLambda = A3 * cosLambda / 2, dxdPhi = -sinLambda * sinPhi, dydLambda = sinPhi0 * A3 * sinLambda / 2, dydPhi = cosPhi0 * cosPhi + sinPhi0 * cosLambda * sinPhi, denominator = dxdPhi * dydLambda - dydPhi * dxdLambda, dLambda = (fy * dxdPhi - fx * dydPhi) / denominator / 2, dPhi = (fx * dydLambda - fy * dxdLambda) / denominator;\n if (abs(dPhi) > 2) dPhi /= 2;\n lambda -= dLambda, phi -= dPhi;\n } while ((abs(dLambda) > epsilon || abs(dPhi) > epsilon) && --i > 0);\n return sPhi0 * phi > -atan2(cos(lambda), tanPhi0) - 1e-3 ? [lambda * 2, phi] : null;\n };\n return forward;\n }\n function armadillo() {\n var phi02 = 20 * radians2, sPhi0 = phi02 >= 0 ? 1 : -1, tanPhi0 = tan(sPhi0 * phi02), m = d3Geo.geoProjectionMutator(armadilloRaw), p = m(phi02), stream_ = p.stream;\n p.parallel = function(_) {\n if (!arguments.length) return phi02 * degrees3;\n tanPhi0 = tan((sPhi0 = (phi02 = _ * radians2) >= 0 ? 1 : -1) * phi02);\n return m(phi02);\n };\n p.stream = function(stream) {\n var rotate = p.rotate(), rotateStream = stream_(stream), sphereStream = (p.rotate([0, 0]), stream_(stream)), precision = p.precision();\n p.rotate(rotate);\n rotateStream.sphere = function() {\n sphereStream.polygonStart(), sphereStream.lineStart();\n for (var lambda = sPhi0 * -180; sPhi0 * lambda < 180; lambda += sPhi0 * 90)\n sphereStream.point(lambda, sPhi0 * 90);\n if (phi02) while (sPhi0 * (lambda -= 3 * sPhi0 * precision) >= -180) {\n sphereStream.point(lambda, sPhi0 * -atan2(cos(lambda * radians2 / 2), tanPhi0) * degrees3);\n }\n sphereStream.lineEnd(), sphereStream.polygonEnd();\n };\n return rotateStream;\n };\n return p.scale(218.695).center([0, 28.0974]);\n }\n function augustRaw(lambda, phi) {\n var tanPhi = tan(phi / 2), k2 = sqrt(1 - tanPhi * tanPhi), c = 1 + k2 * cos(lambda /= 2), x = sin(lambda) * k2 / c, y = tanPhi / c, x2 = x * x, y2 = y * y;\n return [\n 4 / 3 * x * (3 + x2 - 3 * y2),\n 4 / 3 * y * (3 + 3 * x2 - y2)\n ];\n }\n augustRaw.invert = function(x, y) {\n x *= 3 / 8, y *= 3 / 8;\n if (!x && abs(y) > 1) return null;\n var x2 = x * x, y2 = y * y, s = 1 + x2 + y2, sin3Eta = sqrt((s - sqrt(s * s - 4 * y * y)) / 2), eta = asin(sin3Eta) / 3, xi = sin3Eta ? arcosh(abs(y / sin3Eta)) / 3 : arsinh(abs(x)) / 3, cosEta = cos(eta), coshXi = cosh2(xi), d = coshXi * coshXi - cosEta * cosEta;\n return [\n sign(x) * 2 * atan2(sinh2(xi) * cosEta, 0.25 - d),\n sign(y) * 2 * atan2(coshXi * sin(eta), 0.25 + d)\n ];\n };\n function august() {\n return d3Geo.geoProjection(augustRaw).scale(66.1603);\n }\n var sqrt8 = sqrt(8), phi0 = log(1 + sqrt2);\n function bakerRaw(lambda, phi) {\n var phi02 = abs(phi);\n return phi02 < quarterPi ? [lambda, log(tan(quarterPi + phi / 2))] : [lambda * cos(phi02) * (2 * sqrt2 - 1 / sin(phi02)), sign(phi) * (2 * sqrt2 * (phi02 - quarterPi) - log(tan(phi02 / 2)))];\n }\n bakerRaw.invert = function(x, y) {\n if ((y02 = abs(y)) < phi0) return [x, 2 * atan(exp(y)) - halfPi];\n var phi = quarterPi, i = 25, delta, y02;\n do {\n var cosPhi_2 = cos(phi / 2), tanPhi_2 = tan(phi / 2);\n phi -= delta = (sqrt8 * (phi - quarterPi) - log(tanPhi_2) - y02) / (sqrt8 - cosPhi_2 * cosPhi_2 / (2 * tanPhi_2));\n } while (abs(delta) > epsilon22 && --i > 0);\n return [x / (cos(phi) * (sqrt8 - 1 / sin(phi))), sign(y) * phi];\n };\n function baker() {\n return d3Geo.geoProjection(bakerRaw).scale(112.314);\n }\n function berghausRaw(lobes2) {\n var k2 = 2 * pi / lobes2;\n function forward(lambda, phi) {\n var p = d3Geo.geoAzimuthalEquidistantRaw(lambda, phi);\n if (abs(lambda) > halfPi) {\n var theta = atan2(p[1], p[0]), r = sqrt(p[0] * p[0] + p[1] * p[1]), theta0 = k2 * round((theta - halfPi) / k2) + halfPi, alpha = atan2(sin(theta -= theta0), 2 - cos(theta));\n theta = theta0 + asin(pi / r * sin(alpha)) - alpha;\n p[0] = r * cos(theta);\n p[1] = r * sin(theta);\n }\n return p;\n }\n forward.invert = function(x, y) {\n var r = sqrt(x * x + y * y);\n if (r > halfPi) {\n var theta = atan2(y, x), theta0 = k2 * round((theta - halfPi) / k2) + halfPi, s = theta > theta0 ? -1 : 1, A3 = r * cos(theta0 - theta), cotAlpha = 1 / tan(s * acos((A3 - pi) / sqrt(pi * (pi - 2 * A3) + r * r)));\n theta = theta0 + 2 * atan((cotAlpha + s * sqrt(cotAlpha * cotAlpha - 3)) / 3);\n x = r * cos(theta), y = r * sin(theta);\n }\n return d3Geo.geoAzimuthalEquidistantRaw.invert(x, y);\n };\n return forward;\n }\n function berghaus() {\n var lobes2 = 5, m = d3Geo.geoProjectionMutator(berghausRaw), p = m(lobes2), projectionStream = p.stream, epsilon$$1 = 0.01, cr = -cos(epsilon$$1 * radians2), sr = sin(epsilon$$1 * radians2);\n p.lobes = function(_) {\n return arguments.length ? m(lobes2 = +_) : lobes2;\n };\n p.stream = function(stream) {\n var rotate = p.rotate(), rotateStream = projectionStream(stream), sphereStream = (p.rotate([0, 0]), projectionStream(stream));\n p.rotate(rotate);\n rotateStream.sphere = function() {\n sphereStream.polygonStart(), sphereStream.lineStart();\n for (var i = 0, delta = 360 / lobes2, delta0 = 2 * pi / lobes2, phi = 90 - 180 / lobes2, phi02 = halfPi; i < lobes2; ++i, phi -= delta, phi02 -= delta0) {\n sphereStream.point(atan2(sr * cos(phi02), cr) * degrees3, asin(sr * sin(phi02)) * degrees3);\n if (phi < -90) {\n sphereStream.point(-90, -180 - phi - epsilon$$1);\n sphereStream.point(-90, -180 - phi + epsilon$$1);\n } else {\n sphereStream.point(90, phi + epsilon$$1);\n sphereStream.point(90, phi - epsilon$$1);\n }\n }\n sphereStream.lineEnd(), sphereStream.polygonEnd();\n };\n return rotateStream;\n };\n return p.scale(87.8076).center([0, 17.1875]).clipAngle(180 - 1e-3);\n }\n function hammerRaw(A3, B3) {\n if (arguments.length < 2) B3 = A3;\n if (B3 === 1) return d3Geo.geoAzimuthalEqualAreaRaw;\n if (B3 === Infinity) return hammerQuarticAuthalicRaw;\n function forward(lambda, phi) {\n var coordinates = d3Geo.geoAzimuthalEqualAreaRaw(lambda / B3, phi);\n coordinates[0] *= A3;\n return coordinates;\n }\n forward.invert = function(x, y) {\n var coordinates = d3Geo.geoAzimuthalEqualAreaRaw.invert(x / A3, y);\n coordinates[0] *= B3;\n return coordinates;\n };\n return forward;\n }\n function hammerQuarticAuthalicRaw(lambda, phi) {\n return [\n lambda * cos(phi) / cos(phi /= 2),\n 2 * sin(phi)\n ];\n }\n hammerQuarticAuthalicRaw.invert = function(x, y) {\n var phi = 2 * asin(y / 2);\n return [\n x * cos(phi / 2) / cos(phi),\n phi\n ];\n };\n function hammer() {\n var B3 = 2, m = d3Geo.geoProjectionMutator(hammerRaw), p = m(B3);\n p.coefficient = function(_) {\n if (!arguments.length) return B3;\n return m(B3 = +_);\n };\n return p.scale(169.529);\n }\n function solve(f, y, x) {\n var steps = 100, delta, f0, f1;\n x = x === void 0 ? 0 : +x;\n y = +y;\n do {\n f0 = f(x);\n f1 = f(x + epsilon);\n if (f0 === f1) f1 = f0 + epsilon;\n x -= delta = -1 * epsilon * (f0 - y) / (f0 - f1);\n } while (steps-- > 0 && abs(delta) > epsilon);\n return steps < 0 ? NaN : x;\n }\n function solve2d(f, MAX_ITERATIONS, eps) {\n if (MAX_ITERATIONS === void 0) MAX_ITERATIONS = 40;\n if (eps === void 0) eps = epsilon22;\n return function(x, y, a, b) {\n var err2, da, db;\n a = a === void 0 ? 0 : +a;\n b = b === void 0 ? 0 : +b;\n for (var i = 0; i < MAX_ITERATIONS; i++) {\n var p = f(a, b), tx = p[0] - x, ty = p[1] - y;\n if (abs(tx) < eps && abs(ty) < eps) break;\n var h = tx * tx + ty * ty;\n if (h > err2) {\n a -= da /= 2;\n b -= db /= 2;\n continue;\n }\n err2 = h;\n var ea = (a > 0 ? -1 : 1) * eps, eb = (b > 0 ? -1 : 1) * eps, pa = f(a + ea, b), pb = f(a, b + eb), dxa = (pa[0] - p[0]) / ea, dya = (pa[1] - p[1]) / ea, dxb = (pb[0] - p[0]) / eb, dyb = (pb[1] - p[1]) / eb, D2 = dyb * dxa - dya * dxb, l = (abs(D2) < 0.5 ? 0.5 : 1) / D2;\n da = (ty * dxb - tx * dyb) * l;\n db = (tx * dya - ty * dxa) * l;\n a += da;\n b += db;\n if (abs(da) < eps && abs(db) < eps) break;\n }\n return [a, b];\n };\n }\n function bertin1953Raw() {\n var hammer$$1 = hammerRaw(1.68, 2), fu = 1.4, k2 = 12;\n function forward(lambda, phi) {\n if (lambda + phi < -fu) {\n var u = (lambda - phi + 1.6) * (lambda + phi + fu) / 8;\n lambda += u;\n phi -= 0.8 * u * sin(phi + pi / 2);\n }\n var r = hammer$$1(lambda, phi);\n var d = (1 - cos(lambda * phi)) / k2;\n if (r[1] < 0) {\n r[0] *= 1 + d;\n }\n if (r[1] > 0) {\n r[1] *= 1 + d / 1.5 * r[0] * r[0];\n }\n return r;\n }\n forward.invert = solve2d(forward);\n return forward;\n }\n function bertin() {\n return d3Geo.geoProjection(bertin1953Raw()).rotate([-16.5, -42]).scale(176.57).center([7.93, 0.09]);\n }\n function mollweideBromleyTheta(cp, phi) {\n var cpsinPhi = cp * sin(phi), i = 30, delta;\n do\n phi -= delta = (phi + sin(phi) - cpsinPhi) / (1 + cos(phi));\n while (abs(delta) > epsilon && --i > 0);\n return phi / 2;\n }\n function mollweideBromleyRaw(cx, cy, cp) {\n function forward(lambda, phi) {\n return [cx * lambda * cos(phi = mollweideBromleyTheta(cp, phi)), cy * sin(phi)];\n }\n forward.invert = function(x, y) {\n return y = asin(y / cy), [x / (cx * cos(y)), asin((2 * y + sin(2 * y)) / cp)];\n };\n return forward;\n }\n var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi, sqrt2, pi);\n function mollweide() {\n return d3Geo.geoProjection(mollweideRaw).scale(169.529);\n }\n var k = 2.00276, w = 1.11072;\n function boggsRaw(lambda, phi) {\n var theta = mollweideBromleyTheta(pi, phi);\n return [k * lambda / (1 / cos(phi) + w / cos(theta)), (phi + sqrt2 * sin(theta)) / k];\n }\n boggsRaw.invert = function(x, y) {\n var ky = k * y, theta = y < 0 ? -quarterPi : quarterPi, i = 25, delta, phi;\n do {\n phi = ky - sqrt2 * sin(theta);\n theta -= delta = (sin(2 * theta) + 2 * theta - pi * sin(phi)) / (2 * cos(2 * theta) + 2 + pi * cos(phi) * sqrt2 * cos(theta));\n } while (abs(delta) > epsilon && --i > 0);\n phi = ky - sqrt2 * sin(theta);\n return [x * (1 / cos(phi) + w / cos(theta)) / k, phi];\n };\n function boggs() {\n return d3Geo.geoProjection(boggsRaw).scale(160.857);\n }\n function parallel1(projectAt) {\n var phi02 = 0, m = d3Geo.geoProjectionMutator(projectAt), p = m(phi02);\n p.parallel = function(_) {\n return arguments.length ? m(phi02 = _ * radians2) : phi02 * degrees3;\n };\n return p;\n }\n function sinusoidalRaw(lambda, phi) {\n return [lambda * cos(phi), phi];\n }\n sinusoidalRaw.invert = function(x, y) {\n return [x / cos(y), y];\n };\n function sinusoidal() {\n return d3Geo.geoProjection(sinusoidalRaw).scale(152.63);\n }\n function bonneRaw(phi02) {\n if (!phi02) return sinusoidalRaw;\n var cotPhi0 = 1 / tan(phi02);\n function forward(lambda, phi) {\n var rho = cotPhi0 + phi02 - phi, e = rho ? lambda * cos(phi) / rho : rho;\n return [rho * sin(e), cotPhi0 - rho * cos(e)];\n }\n forward.invert = function(x, y) {\n var rho = sqrt(x * x + (y = cotPhi0 - y) * y), phi = cotPhi0 + phi02 - rho;\n return [rho / cos(phi) * atan2(x, y), phi];\n };\n return forward;\n }\n function bonne() {\n return parallel1(bonneRaw).scale(123.082).center([0, 26.1441]).parallel(45);\n }\n function bottomleyRaw(sinPsi) {\n function forward(lambda, phi) {\n var rho = halfPi - phi, eta = rho ? lambda * sinPsi * sin(rho) / rho : rho;\n return [rho * sin(eta) / sinPsi, halfPi - rho * cos(eta)];\n }\n forward.invert = function(x, y) {\n var x12 = x * sinPsi, y12 = halfPi - y, rho = sqrt(x12 * x12 + y12 * y12), eta = atan2(x12, y12);\n return [(rho ? rho / sin(rho) : 1) * eta / sinPsi, halfPi - rho];\n };\n return forward;\n }\n function bottomley() {\n var sinPsi = 0.5, m = d3Geo.geoProjectionMutator(bottomleyRaw), p = m(sinPsi);\n p.fraction = function(_) {\n return arguments.length ? m(sinPsi = +_) : sinPsi;\n };\n return p.scale(158.837);\n }\n var bromleyRaw = mollweideBromleyRaw(1, 4 / pi, pi);\n function bromley() {\n return d3Geo.geoProjection(bromleyRaw).scale(152.63);\n }\n function distance(dPhi, c1, s1, c2, s2, dLambda) {\n var cosdLambda = cos(dLambda), r;\n if (abs(dPhi) > 1 || abs(dLambda) > 1) {\n r = acos(s1 * s2 + c1 * c2 * cosdLambda);\n } else {\n var sindPhi = sin(dPhi / 2), sindLambda = sin(dLambda / 2);\n r = 2 * asin(sqrt(sindPhi * sindPhi + c1 * c2 * sindLambda * sindLambda));\n }\n return abs(r) > epsilon ? [r, atan2(c2 * sin(dLambda), c1 * s2 - s1 * c2 * cosdLambda)] : [0, 0];\n }\n function angle(b, c, a) {\n return acos((b * b + c * c - a * a) / (2 * b * c));\n }\n function longitude(lambda) {\n return lambda - 2 * pi * floor((lambda + pi) / (2 * pi));\n }\n function chamberlinRaw(p0, p1, p2) {\n var points2 = [\n [p0[0], p0[1], sin(p0[1]), cos(p0[1])],\n [p1[0], p1[1], sin(p1[1]), cos(p1[1])],\n [p2[0], p2[1], sin(p2[1]), cos(p2[1])]\n ];\n for (var a = points2[2], b, i = 0; i < 3; ++i, a = b) {\n b = points2[i];\n a.v = distance(b[1] - a[1], a[3], a[2], b[3], b[2], b[0] - a[0]);\n a.point = [0, 0];\n }\n var beta0 = angle(points2[0].v[0], points2[2].v[0], points2[1].v[0]), beta1 = angle(points2[0].v[0], points2[1].v[0], points2[2].v[0]), beta2 = pi - beta0;\n points2[2].point[1] = 0;\n points2[0].point[0] = -(points2[1].point[0] = points2[0].v[0] / 2);\n var mean = [\n points2[2].point[0] = points2[0].point[0] + points2[2].v[0] * cos(beta0),\n 2 * (points2[0].point[1] = points2[1].point[1] = points2[2].v[0] * sin(beta0))\n ];\n function forward(lambda, phi) {\n var sinPhi = sin(phi), cosPhi = cos(phi), v = new Array(3), i2;\n for (i2 = 0; i2 < 3; ++i2) {\n var p = points2[i2];\n v[i2] = distance(phi - p[1], p[3], p[2], cosPhi, sinPhi, lambda - p[0]);\n if (!v[i2][0]) return p.point;\n v[i2][1] = longitude(v[i2][1] - p.v[1]);\n }\n var point = mean.slice();\n for (i2 = 0; i2 < 3; ++i2) {\n var j = i2 == 2 ? 0 : i2 + 1;\n var a2 = angle(points2[i2].v[0], v[i2][0], v[j][0]);\n if (v[i2][1] < 0) a2 = -a2;\n if (!i2) {\n point[0] += v[i2][0] * cos(a2);\n point[1] -= v[i2][0] * sin(a2);\n } else if (i2 == 1) {\n a2 = beta1 - a2;\n point[0] -= v[i2][0] * cos(a2);\n point[1] -= v[i2][0] * sin(a2);\n } else {\n a2 = beta2 - a2;\n point[0] += v[i2][0] * cos(a2);\n point[1] += v[i2][0] * sin(a2);\n }\n }\n point[0] /= 3, point[1] /= 3;\n return point;\n }\n return forward;\n }\n function pointRadians(p) {\n return p[0] *= radians2, p[1] *= radians2, p;\n }\n function chamberlinAfrica() {\n return chamberlin([0, 22], [45, 22], [22.5, -22]).scale(380).center([22.5, 2]);\n }\n function chamberlin(p0, p1, p2) {\n var c = d3Geo.geoCentroid({ type: \"MultiPoint\", coordinates: [p0, p1, p2] }), R = [-c[0], -c[1]], r = d3Geo.geoRotation(R), f = chamberlinRaw(pointRadians(r(p0)), pointRadians(r(p1)), pointRadians(r(p2)));\n f.invert = solve2d(f);\n var p = d3Geo.geoProjection(f).rotate(R), center = p.center;\n delete p.rotate;\n p.center = function(_) {\n return arguments.length ? center(r(_)) : r.invert(center());\n };\n return p.clipAngle(90);\n }\n function collignonRaw(lambda, phi) {\n var alpha = sqrt(1 - sin(phi));\n return [2 / sqrtPi * lambda * alpha, sqrtPi * (1 - alpha)];\n }\n collignonRaw.invert = function(x, y) {\n var lambda = (lambda = y / sqrtPi - 1) * lambda;\n return [lambda > 0 ? x * sqrt(pi / lambda) / 2 : 0, asin(1 - lambda)];\n };\n function collignon() {\n return d3Geo.geoProjection(collignonRaw).scale(95.6464).center([0, 30]);\n }\n function craigRaw(phi02) {\n var tanPhi0 = tan(phi02);\n function forward(lambda, phi) {\n return [lambda, (lambda ? lambda / sin(lambda) : 1) * (sin(phi) * cos(lambda) - tanPhi0 * cos(phi))];\n }\n forward.invert = tanPhi0 ? function(x, y) {\n if (x) y *= sin(x) / x;\n var cosLambda = cos(x);\n return [x, 2 * atan2(sqrt(cosLambda * cosLambda + tanPhi0 * tanPhi0 - y * y) - cosLambda, tanPhi0 - y)];\n } : function(x, y) {\n return [x, asin(x ? y * tan(x) / x : y)];\n };\n return forward;\n }\n function craig() {\n return parallel1(craigRaw).scale(249.828).clipAngle(90);\n }\n var sqrt3 = sqrt(3);\n function crasterRaw(lambda, phi) {\n return [sqrt3 * lambda * (2 * cos(2 * phi / 3) - 1) / sqrtPi, sqrt3 * sqrtPi * sin(phi / 3)];\n }\n crasterRaw.invert = function(x, y) {\n var phi = 3 * asin(y / (sqrt3 * sqrtPi));\n return [sqrtPi * x / (sqrt3 * (2 * cos(2 * phi / 3) - 1)), phi];\n };\n function craster() {\n return d3Geo.geoProjection(crasterRaw).scale(156.19);\n }\n function cylindricalEqualAreaRaw(phi02) {\n var cosPhi0 = cos(phi02);\n function forward(lambda, phi) {\n return [lambda * cosPhi0, sin(phi) / cosPhi0];\n }\n forward.invert = function(x, y) {\n return [x / cosPhi0, asin(y * cosPhi0)];\n };\n return forward;\n }\n function cylindricalEqualArea() {\n return parallel1(cylindricalEqualAreaRaw).parallel(38.58).scale(195.044);\n }\n function cylindricalStereographicRaw(phi02) {\n var cosPhi0 = cos(phi02);\n function forward(lambda, phi) {\n return [lambda * cosPhi0, (1 + cosPhi0) * tan(phi / 2)];\n }\n forward.invert = function(x, y) {\n return [x / cosPhi0, atan(y / (1 + cosPhi0)) * 2];\n };\n return forward;\n }\n function cylindricalStereographic() {\n return parallel1(cylindricalStereographicRaw).scale(124.75);\n }\n function eckert1Raw(lambda, phi) {\n var alpha = sqrt(8 / (3 * pi));\n return [\n alpha * lambda * (1 - abs(phi) / pi),\n alpha * phi\n ];\n }\n eckert1Raw.invert = function(x, y) {\n var alpha = sqrt(8 / (3 * pi)), phi = y / alpha;\n return [\n x / (alpha * (1 - abs(phi) / pi)),\n phi\n ];\n };\n function eckert1() {\n return d3Geo.geoProjection(eckert1Raw).scale(165.664);\n }\n function eckert2Raw(lambda, phi) {\n var alpha = sqrt(4 - 3 * sin(abs(phi)));\n return [\n 2 / sqrt(6 * pi) * lambda * alpha,\n sign(phi) * sqrt(2 * pi / 3) * (2 - alpha)\n ];\n }\n eckert2Raw.invert = function(x, y) {\n var alpha = 2 - abs(y) / sqrt(2 * pi / 3);\n return [\n x * sqrt(6 * pi) / (2 * alpha),\n sign(y) * asin((4 - alpha * alpha) / 3)\n ];\n };\n function eckert2() {\n return d3Geo.geoProjection(eckert2Raw).scale(165.664);\n }\n function eckert3Raw(lambda, phi) {\n var k2 = sqrt(pi * (4 + pi));\n return [\n 2 / k2 * lambda * (1 + sqrt(1 - 4 * phi * phi / (pi * pi))),\n 4 / k2 * phi\n ];\n }\n eckert3Raw.invert = function(x, y) {\n var k2 = sqrt(pi * (4 + pi)) / 2;\n return [\n x * k2 / (1 + sqrt(1 - y * y * (4 + pi) / (4 * pi))),\n y * k2 / 2\n ];\n };\n function eckert3() {\n return d3Geo.geoProjection(eckert3Raw).scale(180.739);\n }\n function eckert4Raw(lambda, phi) {\n var k2 = (2 + halfPi) * sin(phi);\n phi /= 2;\n for (var i = 0, delta = Infinity; i < 10 && abs(delta) > epsilon; i++) {\n var cosPhi = cos(phi);\n phi -= delta = (phi + sin(phi) * (cosPhi + 2) - k2) / (2 * cosPhi * (1 + cosPhi));\n }\n return [\n 2 / sqrt(pi * (4 + pi)) * lambda * (1 + cos(phi)),\n 2 * sqrt(pi / (4 + pi)) * sin(phi)\n ];\n }\n eckert4Raw.invert = function(x, y) {\n var A3 = y * sqrt((4 + pi) / pi) / 2, k2 = asin(A3), c = cos(k2);\n return [\n x / (2 / sqrt(pi * (4 + pi)) * (1 + c)),\n asin((k2 + A3 * (c + 2)) / (2 + halfPi))\n ];\n };\n function eckert4() {\n return d3Geo.geoProjection(eckert4Raw).scale(180.739);\n }\n function eckert5Raw(lambda, phi) {\n return [\n lambda * (1 + cos(phi)) / sqrt(2 + pi),\n 2 * phi / sqrt(2 + pi)\n ];\n }\n eckert5Raw.invert = function(x, y) {\n var k2 = sqrt(2 + pi), phi = y * k2 / 2;\n return [\n k2 * x / (1 + cos(phi)),\n phi\n ];\n };\n function eckert5() {\n return d3Geo.geoProjection(eckert5Raw).scale(173.044);\n }\n function eckert6Raw(lambda, phi) {\n var k2 = (1 + halfPi) * sin(phi);\n for (var i = 0, delta = Infinity; i < 10 && abs(delta) > epsilon; i++) {\n phi -= delta = (phi + sin(phi) - k2) / (1 + cos(phi));\n }\n k2 = sqrt(2 + pi);\n return [\n lambda * (1 + cos(phi)) / k2,\n 2 * phi / k2\n ];\n }\n eckert6Raw.invert = function(x, y) {\n var j = 1 + halfPi, k2 = sqrt(j / 2);\n return [\n x * 2 * k2 / (1 + cos(y *= k2)),\n asin((y + sin(y)) / j)\n ];\n };\n function eckert6() {\n return d3Geo.geoProjection(eckert6Raw).scale(173.044);\n }\n var eisenlohrK = 3 + 2 * sqrt2;\n function eisenlohrRaw(lambda, phi) {\n var s0 = sin(lambda /= 2), c0 = cos(lambda), k2 = sqrt(cos(phi)), c1 = cos(phi /= 2), t = sin(phi) / (c1 + sqrt2 * c0 * k2), c = sqrt(2 / (1 + t * t)), v = sqrt((sqrt2 * c1 + (c0 + s0) * k2) / (sqrt2 * c1 + (c0 - s0) * k2));\n return [\n eisenlohrK * (c * (v - 1 / v) - 2 * log(v)),\n eisenlohrK * (c * t * (v + 1 / v) - 2 * atan(t))\n ];\n }\n eisenlohrRaw.invert = function(x, y) {\n if (!(p = augustRaw.invert(x / 1.2, y * 1.065))) return null;\n var lambda = p[0], phi = p[1], i = 20, p;\n x /= eisenlohrK, y /= eisenlohrK;\n do {\n var _0 = lambda / 2, _1 = phi / 2, s0 = sin(_0), c0 = cos(_0), s1 = sin(_1), c1 = cos(_1), cos1 = cos(phi), k2 = sqrt(cos1), t = s1 / (c1 + sqrt2 * c0 * k2), t22 = t * t, c = sqrt(2 / (1 + t22)), v0 = sqrt2 * c1 + (c0 + s0) * k2, v1 = sqrt2 * c1 + (c0 - s0) * k2, v2 = v0 / v1, v = sqrt(v2), vm1v = v - 1 / v, vp1v = v + 1 / v, fx = c * vm1v - 2 * log(v) - x, fy = c * t * vp1v - 2 * atan(t) - y, deltatDeltaLambda = s1 && sqrt1_2 * k2 * s0 * t22 / s1, deltatDeltaPhi = (sqrt2 * c0 * c1 + k2) / (2 * (c1 + sqrt2 * c0 * k2) * (c1 + sqrt2 * c0 * k2) * k2), deltacDeltat = -0.5 * t * c * c * c, deltacDeltaLambda = deltacDeltat * deltatDeltaLambda, deltacDeltaPhi = deltacDeltat * deltatDeltaPhi, A3 = (A3 = 2 * c1 + sqrt2 * k2 * (c0 - s0)) * A3 * v, deltavDeltaLambda = (sqrt2 * c0 * c1 * k2 + cos1) / A3, deltavDeltaPhi = -(sqrt2 * s0 * s1) / (k2 * A3), deltaxDeltaLambda = vm1v * deltacDeltaLambda - 2 * deltavDeltaLambda / v + c * (deltavDeltaLambda + deltavDeltaLambda / v2), deltaxDeltaPhi = vm1v * deltacDeltaPhi - 2 * deltavDeltaPhi / v + c * (deltavDeltaPhi + deltavDeltaPhi / v2), deltayDeltaLambda = t * vp1v * deltacDeltaLambda - 2 * deltatDeltaLambda / (1 + t22) + c * vp1v * deltatDeltaLambda + c * t * (deltavDeltaLambda - deltavDeltaLambda / v2), deltayDeltaPhi = t * vp1v * deltacDeltaPhi - 2 * deltatDeltaPhi / (1 + t22) + c * vp1v * deltatDeltaPhi + c * t * (deltavDeltaPhi - deltavDeltaPhi / v2), denominator = deltaxDeltaPhi * deltayDeltaLambda - deltayDeltaPhi * deltaxDeltaLambda;\n if (!denominator) break;\n var deltaLambda = (fy * deltaxDeltaPhi - fx * deltayDeltaPhi) / denominator, deltaPhi = (fx * deltayDeltaLambda - fy * deltaxDeltaLambda) / denominator;\n lambda -= deltaLambda;\n phi = max(-halfPi, min(halfPi, phi - deltaPhi));\n } while ((abs(deltaLambda) > epsilon || abs(deltaPhi) > epsilon) && --i > 0);\n return abs(abs(phi) - halfPi) < epsilon ? [0, phi] : i && [lambda, phi];\n };\n function eisenlohr() {\n return d3Geo.geoProjection(eisenlohrRaw).scale(62.5271);\n }\n var faheyK = cos(35 * radians2);\n function faheyRaw(lambda, phi) {\n var t = tan(phi / 2);\n return [lambda * faheyK * sqrt(1 - t * t), (1 + faheyK) * t];\n }\n faheyRaw.invert = function(x, y) {\n var t = y / (1 + faheyK);\n return [x && x / (faheyK * sqrt(1 - t * t)), 2 * atan(t)];\n };\n function fahey() {\n return d3Geo.geoProjection(faheyRaw).scale(137.152);\n }\n function foucautRaw(lambda, phi) {\n var k2 = phi / 2, cosk = cos(k2);\n return [2 * lambda / sqrtPi * cos(phi) * cosk * cosk, sqrtPi * tan(k2)];\n }\n foucautRaw.invert = function(x, y) {\n var k2 = atan(y / sqrtPi), cosk = cos(k2), phi = 2 * k2;\n return [x * sqrtPi / 2 / (cos(phi) * cosk * cosk), phi];\n };\n function foucaut() {\n return d3Geo.geoProjection(foucautRaw).scale(135.264);\n }\n function foucautSinusoidalRaw(alpha) {\n var beta = 1 - alpha, equatorial = raw(pi, 0)[0] - raw(-pi, 0)[0], polar = raw(0, halfPi)[1] - raw(0, -halfPi)[1], ratio = sqrt(2 * polar / equatorial);\n function raw(lambda, phi) {\n var cosphi = cos(phi), sinphi = sin(phi);\n return [\n cosphi / (beta + alpha * cosphi) * lambda,\n beta * phi + alpha * sinphi\n ];\n }\n function forward(lambda, phi) {\n var p = raw(lambda, phi);\n return [p[0] * ratio, p[1] / ratio];\n }\n function forwardMeridian(phi) {\n return forward(0, phi)[1];\n }\n forward.invert = function(x, y) {\n var phi = solve(forwardMeridian, y), lambda = x / ratio * (alpha + beta / cos(phi));\n return [lambda, phi];\n };\n return forward;\n }\n function foucautSinusoidal() {\n var alpha = 0.5, m = d3Geo.geoProjectionMutator(foucautSinusoidalRaw), p = m(alpha);\n p.alpha = function(_) {\n return arguments.length ? m(alpha = +_) : alpha;\n };\n return p.scale(168.725);\n }\n function gilbertForward(point) {\n return [point[0] / 2, asin(tan(point[1] / 2 * radians2)) * degrees3];\n }\n function gilbertInvert(point) {\n return [point[0] * 2, 2 * atan(sin(point[1] * radians2)) * degrees3];\n }\n function gilbert(projectionType) {\n if (projectionType == null) projectionType = d3Geo.geoOrthographic;\n var projection = projectionType(), equirectangular = d3Geo.geoEquirectangular().scale(degrees3).precision(0).clipAngle(null).translate([0, 0]);\n function gilbert2(point) {\n return projection(gilbertForward(point));\n }\n if (projection.invert) gilbert2.invert = function(point) {\n return gilbertInvert(projection.invert(point));\n };\n gilbert2.stream = function(stream) {\n var s1 = projection.stream(stream), s0 = equirectangular.stream({\n point: function(lambda, phi) {\n s1.point(lambda / 2, asin(tan(-phi / 2 * radians2)) * degrees3);\n },\n lineStart: function() {\n s1.lineStart();\n },\n lineEnd: function() {\n s1.lineEnd();\n },\n polygonStart: function() {\n s1.polygonStart();\n },\n polygonEnd: function() {\n s1.polygonEnd();\n }\n });\n s0.sphere = s1.sphere;\n return s0;\n };\n function property(name2) {\n gilbert2[name2] = function() {\n return arguments.length ? (projection[name2].apply(projection, arguments), gilbert2) : projection[name2]();\n };\n }\n gilbert2.rotate = function(_) {\n return arguments.length ? (equirectangular.rotate(_), gilbert2) : equirectangular.rotate();\n };\n gilbert2.center = function(_) {\n return arguments.length ? (projection.center(gilbertForward(_)), gilbert2) : gilbertInvert(projection.center());\n };\n property(\"angle\");\n property(\"clipAngle\");\n property(\"clipExtent\");\n property(\"fitExtent\");\n property(\"fitHeight\");\n property(\"fitSize\");\n property(\"fitWidth\");\n property(\"scale\");\n property(\"translate\");\n property(\"precision\");\n return gilbert2.scale(249.5);\n }\n function gingeryRaw(rho, n) {\n var k2 = 2 * pi / n, rho2 = rho * rho;\n function forward(lambda, phi) {\n var p = d3Geo.geoAzimuthalEquidistantRaw(lambda, phi), x = p[0], y = p[1], r2 = x * x + y * y;\n if (r2 > rho2) {\n var r = sqrt(r2), theta = atan2(y, x), theta0 = k2 * round(theta / k2), alpha = theta - theta0, rhoCosAlpha = rho * cos(alpha), k_ = (rho * sin(alpha) - alpha * sin(rhoCosAlpha)) / (halfPi - rhoCosAlpha), s_ = gingeryLength(alpha, k_), e = (pi - rho) / gingeryIntegrate(s_, rhoCosAlpha, pi);\n x = r;\n var i = 50, delta;\n do {\n x -= delta = (rho + gingeryIntegrate(s_, rhoCosAlpha, x) * e - r) / (s_(x) * e);\n } while (abs(delta) > epsilon && --i > 0);\n y = alpha * sin(x);\n if (x < halfPi) y -= k_ * (x - halfPi);\n var s = sin(theta0), c = cos(theta0);\n p[0] = x * c - y * s;\n p[1] = x * s + y * c;\n }\n return p;\n }\n forward.invert = function(x, y) {\n var r2 = x * x + y * y;\n if (r2 > rho2) {\n var r = sqrt(r2), theta = atan2(y, x), theta0 = k2 * round(theta / k2), dTheta = theta - theta0;\n x = r * cos(dTheta);\n y = r * sin(dTheta);\n var x_halfPi = x - halfPi, sinx = sin(x), alpha = y / sinx, delta = x < halfPi ? Infinity : 0, i = 10;\n while (true) {\n var rhosinAlpha = rho * sin(alpha), rhoCosAlpha = rho * cos(alpha), sinRhoCosAlpha = sin(rhoCosAlpha), halfPi_RhoCosAlpha = halfPi - rhoCosAlpha, k_ = (rhosinAlpha - alpha * sinRhoCosAlpha) / halfPi_RhoCosAlpha, s_ = gingeryLength(alpha, k_);\n if (abs(delta) < epsilon22 || !--i) break;\n alpha -= delta = (alpha * sinx - k_ * x_halfPi - y) / (sinx - x_halfPi * 2 * (halfPi_RhoCosAlpha * (rhoCosAlpha + alpha * rhosinAlpha * cos(rhoCosAlpha) - sinRhoCosAlpha) - rhosinAlpha * (rhosinAlpha - alpha * sinRhoCosAlpha)) / (halfPi_RhoCosAlpha * halfPi_RhoCosAlpha));\n }\n r = rho + gingeryIntegrate(s_, rhoCosAlpha, x) * (pi - rho) / gingeryIntegrate(s_, rhoCosAlpha, pi);\n theta = theta0 + alpha;\n x = r * cos(theta);\n y = r * sin(theta);\n }\n return d3Geo.geoAzimuthalEquidistantRaw.invert(x, y);\n };\n return forward;\n }\n function gingeryLength(alpha, k2) {\n return function(x) {\n var y_ = alpha * cos(x);\n if (x < halfPi) y_ -= k2;\n return sqrt(1 + y_ * y_);\n };\n }\n function gingeryIntegrate(f, a, b) {\n var n = 50, h = (b - a) / n, s = f(a) + f(b);\n for (var i = 1, x = a; i < n; ++i) s += 2 * f(x += h);\n return s * 0.5 * h;\n }\n function gingery() {\n var n = 6, rho = 30 * radians2, cRho = cos(rho), sRho = sin(rho), m = d3Geo.geoProjectionMutator(gingeryRaw), p = m(rho, n), stream_ = p.stream, epsilon$$1 = 0.01, cr = -cos(epsilon$$1 * radians2), sr = sin(epsilon$$1 * radians2);\n p.radius = function(_) {\n if (!arguments.length) return rho * degrees3;\n cRho = cos(rho = _ * radians2);\n sRho = sin(rho);\n return m(rho, n);\n };\n p.lobes = function(_) {\n if (!arguments.length) return n;\n return m(rho, n = +_);\n };\n p.stream = function(stream) {\n var rotate = p.rotate(), rotateStream = stream_(stream), sphereStream = (p.rotate([0, 0]), stream_(stream));\n p.rotate(rotate);\n rotateStream.sphere = function() {\n sphereStream.polygonStart(), sphereStream.lineStart();\n for (var i = 0, delta = 2 * pi / n, phi = 0; i < n; ++i, phi -= delta) {\n sphereStream.point(atan2(sr * cos(phi), cr) * degrees3, asin(sr * sin(phi)) * degrees3);\n sphereStream.point(atan2(sRho * cos(phi - delta / 2), cRho) * degrees3, asin(sRho * sin(phi - delta / 2)) * degrees3);\n }\n sphereStream.lineEnd(), sphereStream.polygonEnd();\n };\n return rotateStream;\n };\n return p.rotate([90, -40]).scale(91.7095).clipAngle(180 - 1e-3);\n }\n function ginzburgPolyconicRaw(a, b, c, d, e, f, g, h) {\n if (arguments.length < 8) h = 0;\n function forward(lambda, phi) {\n if (!phi) return [a * lambda / pi, 0];\n var phi2 = phi * phi, xB = a + phi2 * (b + phi2 * (c + phi2 * d)), yB = phi * (e - 1 + phi2 * (f - h + phi2 * g)), m = (xB * xB + yB * yB) / (2 * yB), alpha = lambda * asin(xB / m) / pi;\n return [m * sin(alpha), phi * (1 + phi2 * h) + m * (1 - cos(alpha))];\n }\n forward.invert = function(x, y) {\n var lambda = pi * x / a, phi = y, deltaLambda, deltaPhi, i = 50;\n do {\n var phi2 = phi * phi, xB = a + phi2 * (b + phi2 * (c + phi2 * d)), yB = phi * (e - 1 + phi2 * (f - h + phi2 * g)), p = xB * xB + yB * yB, q = 2 * yB, m = p / q, m2 = m * m, dAlphadLambda = asin(xB / m) / pi, alpha = lambda * dAlphadLambda, xB2 = xB * xB, dxBdPhi = (2 * b + phi2 * (4 * c + phi2 * 6 * d)) * phi, dyBdPhi = e + phi2 * (3 * f + phi2 * 5 * g), dpdPhi = 2 * (xB * dxBdPhi + yB * (dyBdPhi - 1)), dqdPhi = 2 * (dyBdPhi - 1), dmdPhi = (dpdPhi * q - p * dqdPhi) / (q * q), cosAlpha = cos(alpha), sinAlpha = sin(alpha), mcosAlpha = m * cosAlpha, msinAlpha = m * sinAlpha, dAlphadPhi = lambda / pi * (1 / sqrt(1 - xB2 / m2)) * (dxBdPhi * m - xB * dmdPhi) / m2, fx = msinAlpha - x, fy = phi * (1 + phi2 * h) + m - mcosAlpha - y, deltaxDeltaPhi = dmdPhi * sinAlpha + mcosAlpha * dAlphadPhi, deltaxDeltaLambda = mcosAlpha * dAlphadLambda, deltayDeltaPhi = 1 + dmdPhi - (dmdPhi * cosAlpha - msinAlpha * dAlphadPhi), deltayDeltaLambda = msinAlpha * dAlphadLambda, denominator = deltaxDeltaPhi * deltayDeltaLambda - deltayDeltaPhi * deltaxDeltaLambda;\n if (!denominator) break;\n lambda -= deltaLambda = (fy * deltaxDeltaPhi - fx * deltayDeltaPhi) / denominator;\n phi -= deltaPhi = (fx * deltayDeltaLambda - fy * deltaxDeltaLambda) / denominator;\n } while ((abs(deltaLambda) > epsilon || abs(deltaPhi) > epsilon) && --i > 0);\n return [lambda, phi];\n };\n return forward;\n }\n var ginzburg4Raw = ginzburgPolyconicRaw(2.8284, -1.6988, 0.75432, -0.18071, 1.76003, -0.38914, 0.042555);\n function ginzburg4() {\n return d3Geo.geoProjection(ginzburg4Raw).scale(149.995);\n }\n var ginzburg5Raw = ginzburgPolyconicRaw(2.583819, -0.835827, 0.170354, -0.038094, 1.543313, -0.411435, 0.082742);\n function ginzburg5() {\n return d3Geo.geoProjection(ginzburg5Raw).scale(153.93);\n }\n var ginzburg6Raw = ginzburgPolyconicRaw(5 / 6 * pi, -0.62636, -0.0344, 0, 1.3493, -0.05524, 0, 0.045);\n function ginzburg6() {\n return d3Geo.geoProjection(ginzburg6Raw).scale(130.945);\n }\n function ginzburg8Raw(lambda, phi) {\n var lambda2 = lambda * lambda, phi2 = phi * phi;\n return [\n lambda * (1 - 0.162388 * phi2) * (0.87 - 952426e-9 * lambda2 * lambda2),\n phi * (1 + phi2 / 12)\n ];\n }\n ginzburg8Raw.invert = function(x, y) {\n var lambda = x, phi = y, i = 50, delta;\n do {\n var phi2 = phi * phi;\n phi -= delta = (phi * (1 + phi2 / 12) - y) / (1 + phi2 / 4);\n } while (abs(delta) > epsilon && --i > 0);\n i = 50;\n x /= 1 - 0.162388 * phi2;\n do {\n var lambda4 = (lambda4 = lambda * lambda) * lambda4;\n lambda -= delta = (lambda * (0.87 - 952426e-9 * lambda4) - x) / (0.87 - 476213e-8 * lambda4);\n } while (abs(delta) > epsilon && --i > 0);\n return [lambda, phi];\n };\n function ginzburg8() {\n return d3Geo.geoProjection(ginzburg8Raw).scale(131.747);\n }\n var ginzburg9Raw = ginzburgPolyconicRaw(2.6516, -0.76534, 0.19123, -0.047094, 1.36289, -0.13965, 0.031762);\n function ginzburg9() {\n return d3Geo.geoProjection(ginzburg9Raw).scale(131.087);\n }\n function squareRaw(project) {\n var dx = project(halfPi, 0)[0] - project(-halfPi, 0)[0];\n function projectSquare(lambda, phi) {\n var s = lambda > 0 ? -0.5 : 0.5, point = project(lambda + s * pi, phi);\n point[0] -= s * dx;\n return point;\n }\n if (project.invert) projectSquare.invert = function(x, y) {\n var s = x > 0 ? -0.5 : 0.5, location2 = project.invert(x + s * dx, y), lambda = location2[0] - s * pi;\n if (lambda < -pi) lambda += 2 * pi;\n else if (lambda > pi) lambda -= 2 * pi;\n location2[0] = lambda;\n return location2;\n };\n return projectSquare;\n }\n function gringortenRaw(lambda, phi) {\n var sLambda = sign(lambda), sPhi = sign(phi), cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(sPhi * phi);\n lambda = abs(atan2(y, z));\n phi = asin(x);\n if (abs(lambda - halfPi) > epsilon) lambda %= halfPi;\n var point = gringortenHexadecant(lambda > pi / 4 ? halfPi - lambda : lambda, phi);\n if (lambda > pi / 4) z = point[0], point[0] = -point[1], point[1] = -z;\n return point[0] *= sLambda, point[1] *= -sPhi, point;\n }\n gringortenRaw.invert = function(x, y) {\n if (abs(x) > 1) x = sign(x) * 2 - x;\n if (abs(y) > 1) y = sign(y) * 2 - y;\n var sx = sign(x), sy = sign(y), x02 = -sx * x, y02 = -sy * y, t = y02 / x02 < 1, p = gringortenHexadecantInvert(t ? y02 : x02, t ? x02 : y02), lambda = p[0], phi = p[1], cosPhi = cos(phi);\n if (t) lambda = -halfPi - lambda;\n return [sx * (atan2(sin(lambda) * cosPhi, -sin(phi)) + pi), sy * asin(cos(lambda) * cosPhi)];\n };\n function gringortenHexadecant(lambda, phi) {\n if (phi === halfPi) return [0, 0];\n var sinPhi = sin(phi), r = sinPhi * sinPhi, r2 = r * r, j = 1 + r2, k2 = 1 + 3 * r2, q = 1 - r2, z = asin(1 / sqrt(j)), v = q + r * j * z, p2 = (1 - sinPhi) / v, p = sqrt(p2), a2 = p2 * j, a = sqrt(a2), h = p * q, x, i;\n if (lambda === 0) return [0, -(h + r * a)];\n var cosPhi = cos(phi), secPhi = 1 / cosPhi, drdPhi = 2 * sinPhi * cosPhi, dvdPhi = (-3 * r + z * k2) * drdPhi, dp2dPhi = (-v * cosPhi - (1 - sinPhi) * dvdPhi) / (v * v), dpdPhi = 0.5 * dp2dPhi / p, dhdPhi = q * dpdPhi - 2 * r * p * drdPhi, dra2dPhi = r * j * dp2dPhi + p2 * k2 * drdPhi, mu = -secPhi * drdPhi, nu = -secPhi * dra2dPhi, zeta = -2 * secPhi * dhdPhi, lambda1 = 4 * lambda / pi, delta;\n if (lambda > 0.222 * pi || phi < pi / 4 && lambda > 0.175 * pi) {\n x = (h + r * sqrt(a2 * (1 + r2) - h * h)) / (1 + r2);\n if (lambda > pi / 4) return [x, x];\n var x12 = x, x02 = 0.5 * x;\n x = 0.5 * (x02 + x12), i = 50;\n do {\n var g = sqrt(a2 - x * x), f = x * (zeta + mu * g) + nu * asin(x / a) - lambda1;\n if (!f) break;\n if (f < 0) x02 = x;\n else x12 = x;\n x = 0.5 * (x02 + x12);\n } while (abs(x12 - x02) > epsilon && --i > 0);\n } else {\n x = epsilon, i = 25;\n do {\n var x2 = x * x, g2 = sqrt(a2 - x2), zetaMug = zeta + mu * g2, f2 = x * zetaMug + nu * asin(x / a) - lambda1, df = zetaMug + (nu - mu * x2) / g2;\n x -= delta = g2 ? f2 / df : 0;\n } while (abs(delta) > epsilon && --i > 0);\n }\n return [x, -h - r * sqrt(a2 - x * x)];\n }\n function gringortenHexadecantInvert(x, y) {\n var x02 = 0, x12 = 1, r = 0.5, i = 50;\n while (true) {\n var r2 = r * r, sinPhi = sqrt(r), z = asin(1 / sqrt(1 + r2)), v = 1 - r2 + r * (1 + r2) * z, p2 = (1 - sinPhi) / v, p = sqrt(p2), a2 = p2 * (1 + r2), h = p * (1 - r2), g2 = a2 - x * x, g = sqrt(g2), y02 = y + h + r * g;\n if (abs(x12 - x02) < epsilon22 || --i === 0 || y02 === 0) break;\n if (y02 > 0) x02 = r;\n else x12 = r;\n r = 0.5 * (x02 + x12);\n }\n if (!i) return null;\n var phi = asin(sinPhi), cosPhi = cos(phi), secPhi = 1 / cosPhi, drdPhi = 2 * sinPhi * cosPhi, dvdPhi = (-3 * r + z * (1 + 3 * r2)) * drdPhi, dp2dPhi = (-v * cosPhi - (1 - sinPhi) * dvdPhi) / (v * v), dpdPhi = 0.5 * dp2dPhi / p, dhdPhi = (1 - r2) * dpdPhi - 2 * r * p * drdPhi, zeta = -2 * secPhi * dhdPhi, mu = -secPhi * drdPhi, nu = -secPhi * (r * (1 + r2) * dp2dPhi + p2 * (1 + 3 * r2) * drdPhi);\n return [pi / 4 * (x * (zeta + mu * g) + nu * asin(x / sqrt(a2))), phi];\n }\n function gringorten() {\n return d3Geo.geoProjection(squareRaw(gringortenRaw)).scale(239.75);\n }\n function ellipticJi(u, v, m) {\n var a, b, c;\n if (!u) {\n b = ellipticJ(v, 1 - m);\n return [\n [0, b[0] / b[1]],\n [1 / b[1], 0],\n [b[2] / b[1], 0]\n ];\n }\n a = ellipticJ(u, m);\n if (!v) return [[a[0], 0], [a[1], 0], [a[2], 0]];\n b = ellipticJ(v, 1 - m);\n c = b[1] * b[1] + m * a[0] * a[0] * b[0] * b[0];\n return [\n [a[0] * b[2] / c, a[1] * a[2] * b[0] * b[1] / c],\n [a[1] * b[1] / c, -a[0] * a[2] * b[0] * b[2] / c],\n [a[2] * b[1] * b[2] / c, -m * a[0] * a[1] * b[0] / c]\n ];\n }\n function ellipticJ(u, m) {\n var ai, b, phi, t, twon;\n if (m < epsilon) {\n t = sin(u);\n b = cos(u);\n ai = m * (u - t * b) / 4;\n return [\n t - ai * b,\n b + ai * t,\n 1 - m * t * t / 2,\n u - ai\n ];\n }\n if (m >= 1 - epsilon) {\n ai = (1 - m) / 4;\n b = cosh2(u);\n t = tanh2(u);\n phi = 1 / b;\n twon = b * sinh2(u);\n return [\n t + ai * (twon - u) / (b * b),\n phi - ai * t * phi * (twon - u),\n phi + ai * t * phi * (twon + u),\n 2 * atan(exp(u)) - halfPi + ai * (twon - u) / b\n ];\n }\n var a = [1, 0, 0, 0, 0, 0, 0, 0, 0], c = [sqrt(m), 0, 0, 0, 0, 0, 0, 0, 0], i = 0;\n b = sqrt(1 - m);\n twon = 1;\n while (abs(c[i] / a[i]) > epsilon && i < 8) {\n ai = a[i++];\n c[i] = (ai - b) / 2;\n a[i] = (ai + b) / 2;\n b = sqrt(ai * b);\n twon *= 2;\n }\n phi = twon * a[i] * u;\n do {\n t = c[i] * sin(b = phi) / a[i];\n phi = (asin(t) + phi) / 2;\n } while (--i);\n return [sin(phi), t = cos(phi), t / cos(phi - b), phi];\n }\n function ellipticFi(phi, psi, m) {\n var r = abs(phi), i = abs(psi), sinhPsi = sinh2(i);\n if (r) {\n var cscPhi = 1 / sin(r), cotPhi2 = 1 / (tan(r) * tan(r)), b = -(cotPhi2 + m * (sinhPsi * sinhPsi * cscPhi * cscPhi) - 1 + m), c = (m - 1) * cotPhi2, cotLambda2 = (-b + sqrt(b * b - 4 * c)) / 2;\n return [\n ellipticF(atan(1 / sqrt(cotLambda2)), m) * sign(phi),\n ellipticF(atan(sqrt((cotLambda2 / cotPhi2 - 1) / m)), 1 - m) * sign(psi)\n ];\n }\n return [\n 0,\n ellipticF(atan(sinhPsi), 1 - m) * sign(psi)\n ];\n }\n function ellipticF(phi, m) {\n if (!m) return phi;\n if (m === 1) return log(tan(phi / 2 + quarterPi));\n var a = 1, b = sqrt(1 - m), c = sqrt(m);\n for (var i = 0; abs(c) > epsilon; i++) {\n if (phi % pi) {\n var dPhi = atan(b * tan(phi) / a);\n if (dPhi < 0) dPhi += pi;\n phi += dPhi + ~~(phi / pi) * pi;\n } else phi += phi;\n c = (a + b) / 2;\n b = sqrt(a * b);\n c = ((a = c) - b) / 2;\n }\n return phi / (pow(2, i) * a);\n }\n function guyouRaw(lambda, phi) {\n var k_ = (sqrt2 - 1) / (sqrt2 + 1), k2 = sqrt(1 - k_ * k_), K3 = ellipticF(halfPi, k2 * k2), f = -1, psi = log(tan(pi / 4 + abs(phi) / 2)), r = exp(f * psi) / sqrt(k_), at = guyouComplexAtan(r * cos(f * lambda), r * sin(f * lambda)), t = ellipticFi(at[0], at[1], k2 * k2);\n return [-t[1], (phi >= 0 ? 1 : -1) * (0.5 * K3 - t[0])];\n }\n function guyouComplexAtan(x, y) {\n var x2 = x * x, y_1 = y + 1, t = 1 - x2 - y * y;\n return [\n 0.5 * ((x >= 0 ? halfPi : -halfPi) - atan2(t, 2 * x)),\n -0.25 * log(t * t + 4 * x2) + 0.5 * log(y_1 * y_1 + x2)\n ];\n }\n function guyouComplexDivide(a, b) {\n var denominator = b[0] * b[0] + b[1] * b[1];\n return [\n (a[0] * b[0] + a[1] * b[1]) / denominator,\n (a[1] * b[0] - a[0] * b[1]) / denominator\n ];\n }\n guyouRaw.invert = function(x, y) {\n var k_ = (sqrt2 - 1) / (sqrt2 + 1), k2 = sqrt(1 - k_ * k_), K3 = ellipticF(halfPi, k2 * k2), f = -1, j = ellipticJi(0.5 * K3 - y, -x, k2 * k2), tn = guyouComplexDivide(j[0], j[1]), lambda = atan2(tn[1], tn[0]) / f;\n return [\n lambda,\n 2 * atan(exp(0.5 / f * log(k_ * tn[0] * tn[0] + k_ * tn[1] * tn[1]))) - halfPi\n ];\n };\n function guyou() {\n return d3Geo.geoProjection(squareRaw(guyouRaw)).scale(151.496);\n }\n function hammerRetroazimuthalRaw(phi02) {\n var sinPhi0 = sin(phi02), cosPhi0 = cos(phi02), rotate = hammerRetroazimuthalRotation(phi02);\n rotate.invert = hammerRetroazimuthalRotation(-phi02);\n function forward(lambda, phi) {\n var p = rotate(lambda, phi);\n lambda = p[0], phi = p[1];\n var sinPhi = sin(phi), cosPhi = cos(phi), cosLambda = cos(lambda), z = acos(sinPhi0 * sinPhi + cosPhi0 * cosPhi * cosLambda), sinz = sin(z), K3 = abs(sinz) > epsilon ? z / sinz : 1;\n return [\n K3 * cosPhi0 * sin(lambda),\n (abs(lambda) > halfPi ? K3 : -K3) * (sinPhi0 * cosPhi - cosPhi0 * sinPhi * cosLambda)\n ];\n }\n forward.invert = function(x, y) {\n var rho = sqrt(x * x + y * y), sinz = -sin(rho), cosz = cos(rho), a = rho * cosz, b = -y * sinz, c = rho * sinPhi0, d = sqrt(a * a + b * b - c * c), phi = atan2(a * c + b * d, b * c - a * d), lambda = (rho > halfPi ? -1 : 1) * atan2(x * sinz, rho * cos(phi) * cosz + y * sin(phi) * sinz);\n return rotate.invert(lambda, phi);\n };\n return forward;\n }\n function hammerRetroazimuthalRotation(phi02) {\n var sinPhi0 = sin(phi02), cosPhi0 = cos(phi02);\n return function(lambda, phi) {\n var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi);\n return [\n atan2(y, x * cosPhi0 - z * sinPhi0),\n asin(z * cosPhi0 + x * sinPhi0)\n ];\n };\n }\n function hammerRetroazimuthal() {\n var phi02 = 0, m = d3Geo.geoProjectionMutator(hammerRetroazimuthalRaw), p = m(phi02), rotate_ = p.rotate, stream_ = p.stream, circle = d3Geo.geoCircle();\n p.parallel = function(_) {\n if (!arguments.length) return phi02 * degrees3;\n var r = p.rotate();\n return m(phi02 = _ * radians2).rotate(r);\n };\n p.rotate = function(_) {\n if (!arguments.length) return _ = rotate_.call(p), _[1] += phi02 * degrees3, _;\n rotate_.call(p, [_[0], _[1] - phi02 * degrees3]);\n circle.center([-_[0], -_[1]]);\n return p;\n };\n p.stream = function(stream) {\n stream = stream_(stream);\n stream.sphere = function() {\n stream.polygonStart();\n var epsilon$$1 = 0.01, ring = circle.radius(90 - epsilon$$1)().coordinates[0], n = ring.length - 1, i = -1, p2;\n stream.lineStart();\n while (++i < n) stream.point((p2 = ring[i])[0], p2[1]);\n stream.lineEnd();\n ring = circle.radius(90 + epsilon$$1)().coordinates[0];\n n = ring.length - 1;\n stream.lineStart();\n while (--i >= 0) stream.point((p2 = ring[i])[0], p2[1]);\n stream.lineEnd();\n stream.polygonEnd();\n };\n return stream;\n };\n return p.scale(79.4187).parallel(45).clipAngle(180 - 1e-3);\n }\n var K2 = 3, healpixParallel = asin(1 - 1 / K2) * degrees3, healpixLambert = cylindricalEqualAreaRaw(0);\n function healpixRaw(H) {\n var phi02 = healpixParallel * radians2, dx = collignonRaw(pi, phi02)[0] - collignonRaw(-pi, phi02)[0], y02 = healpixLambert(0, phi02)[1], y12 = collignonRaw(0, phi02)[1], dy1 = sqrtPi - y12, k2 = tau / H, w2 = 4 / tau, h = y02 + dy1 * dy1 * 4 / tau;\n function forward(lambda, phi) {\n var point, phi2 = abs(phi);\n if (phi2 > phi02) {\n var i = min(H - 1, max(0, floor((lambda + pi) / k2)));\n lambda += pi * (H - 1) / H - i * k2;\n point = collignonRaw(lambda, phi2);\n point[0] = point[0] * tau / dx - tau * (H - 1) / (2 * H) + i * tau / H;\n point[1] = y02 + (point[1] - y12) * 4 * dy1 / tau;\n if (phi < 0) point[1] = -point[1];\n } else {\n point = healpixLambert(lambda, phi);\n }\n point[0] *= w2, point[1] /= h;\n return point;\n }\n forward.invert = function(x, y) {\n x /= w2, y *= h;\n var y2 = abs(y);\n if (y2 > y02) {\n var i = min(H - 1, max(0, floor((x + pi) / k2)));\n x = (x + pi * (H - 1) / H - i * k2) * dx / tau;\n var point = collignonRaw.invert(x, 0.25 * (y2 - y02) * tau / dy1 + y12);\n point[0] -= pi * (H - 1) / H - i * k2;\n if (y < 0) point[1] = -point[1];\n return point;\n }\n return healpixLambert.invert(x, y);\n };\n return forward;\n }\n function sphereTop(x, i) {\n return [x, i & 1 ? 90 - epsilon : healpixParallel];\n }\n function sphereBottom(x, i) {\n return [x, i & 1 ? -90 + epsilon : -healpixParallel];\n }\n function sphereNudge(d) {\n return [d[0] * (1 - epsilon), d[1]];\n }\n function sphere(step) {\n var c = [].concat(\n d3Array.range(-180, 180 + step / 2, step).map(sphereTop),\n d3Array.range(180, -180 - step / 2, -step).map(sphereBottom)\n );\n return {\n type: \"Polygon\",\n coordinates: [step === 180 ? c.map(sphereNudge) : c]\n };\n }\n function healpix() {\n var H = 4, m = d3Geo.geoProjectionMutator(healpixRaw), p = m(H), stream_ = p.stream;\n p.lobes = function(_) {\n return arguments.length ? m(H = +_) : H;\n };\n p.stream = function(stream) {\n var rotate = p.rotate(), rotateStream = stream_(stream), sphereStream = (p.rotate([0, 0]), stream_(stream));\n p.rotate(rotate);\n rotateStream.sphere = function() {\n d3Geo.geoStream(sphere(180 / H), sphereStream);\n };\n return rotateStream;\n };\n return p.scale(239.75);\n }\n function hillRaw(K3) {\n var L = 1 + K3, sinBt = sin(1 / L), Bt = asin(sinBt), A3 = 2 * sqrt(pi / (B3 = pi + 4 * Bt * L)), B3, rho0 = 0.5 * A3 * (L + sqrt(K3 * (2 + K3))), K22 = K3 * K3, L2 = L * L;\n function forward(lambda, phi) {\n var t = 1 - sin(phi), rho, omega;\n if (t && t < 2) {\n var theta = halfPi - phi, i = 25, delta;\n do {\n var sinTheta = sin(theta), cosTheta = cos(theta), Bt_Bt1 = Bt + atan2(sinTheta, L - cosTheta), C2 = 1 + L2 - 2 * L * cosTheta;\n theta -= delta = (theta - K22 * Bt - L * sinTheta + C2 * Bt_Bt1 - 0.5 * t * B3) / (2 * L * sinTheta * Bt_Bt1);\n } while (abs(delta) > epsilon22 && --i > 0);\n rho = A3 * sqrt(C2);\n omega = lambda * Bt_Bt1 / pi;\n } else {\n rho = A3 * (K3 + t);\n omega = lambda * Bt / pi;\n }\n return [\n rho * sin(omega),\n rho0 - rho * cos(omega)\n ];\n }\n forward.invert = function(x, y) {\n var rho2 = x * x + (y -= rho0) * y, cosTheta = (1 + L2 - rho2 / (A3 * A3)) / (2 * L), theta = acos(cosTheta), sinTheta = sin(theta), Bt_Bt1 = Bt + atan2(sinTheta, L - cosTheta);\n return [\n asin(x / sqrt(rho2)) * pi / Bt_Bt1,\n asin(1 - 2 * (theta - K22 * Bt - L * sinTheta + (1 + L2 - 2 * L * cosTheta) * Bt_Bt1) / B3)\n ];\n };\n return forward;\n }\n function hill() {\n var K3 = 1, m = d3Geo.geoProjectionMutator(hillRaw), p = m(K3);\n p.ratio = function(_) {\n return arguments.length ? m(K3 = +_) : K3;\n };\n return p.scale(167.774).center([0, 18.67]);\n }\n var sinuMollweidePhi = 0.7109889596207567;\n var sinuMollweideY = 0.0528035274542;\n function sinuMollweideRaw(lambda, phi) {\n return phi > -sinuMollweidePhi ? (lambda = mollweideRaw(lambda, phi), lambda[1] += sinuMollweideY, lambda) : sinusoidalRaw(lambda, phi);\n }\n sinuMollweideRaw.invert = function(x, y) {\n return y > -sinuMollweidePhi ? mollweideRaw.invert(x, y - sinuMollweideY) : sinusoidalRaw.invert(x, y);\n };\n function sinuMollweide() {\n return d3Geo.geoProjection(sinuMollweideRaw).rotate([-20, -55]).scale(164.263).center([0, -5.4036]);\n }\n function homolosineRaw(lambda, phi) {\n return abs(phi) > sinuMollweidePhi ? (lambda = mollweideRaw(lambda, phi), lambda[1] -= phi > 0 ? sinuMollweideY : -sinuMollweideY, lambda) : sinusoidalRaw(lambda, phi);\n }\n homolosineRaw.invert = function(x, y) {\n return abs(y) > sinuMollweidePhi ? mollweideRaw.invert(x, y + (y > 0 ? sinuMollweideY : -sinuMollweideY)) : sinusoidalRaw.invert(x, y);\n };\n function homolosine() {\n return d3Geo.geoProjection(homolosineRaw).scale(152.63);\n }\n function hufnagelRaw(a, b, psiMax, ratio) {\n var k2 = sqrt(\n 4 * pi / (2 * psiMax + (1 + a - b / 2) * sin(2 * psiMax) + (a + b) / 2 * sin(4 * psiMax) + b / 2 * sin(6 * psiMax))\n ), c = sqrt(\n ratio * sin(psiMax) * sqrt((1 + a * cos(2 * psiMax) + b * cos(4 * psiMax)) / (1 + a + b))\n ), M = psiMax * mapping(1);\n function radius(psi) {\n return sqrt(1 + a * cos(2 * psi) + b * cos(4 * psi));\n }\n function mapping(t) {\n var psi = t * psiMax;\n return (2 * psi + (1 + a - b / 2) * sin(2 * psi) + (a + b) / 2 * sin(4 * psi) + b / 2 * sin(6 * psi)) / psiMax;\n }\n function inversemapping(psi) {\n return radius(psi) * sin(psi);\n }\n var forward = function(lambda, phi) {\n var psi = psiMax * solve(mapping, M * sin(phi) / psiMax, phi / pi);\n if (isNaN(psi)) psi = psiMax * sign(phi);\n var kr = k2 * radius(psi);\n return [kr * c * lambda / pi * cos(psi), kr / c * sin(psi)];\n };\n forward.invert = function(x, y) {\n var psi = solve(inversemapping, y * c / k2);\n return [\n x * pi / (cos(psi) * k2 * c * radius(psi)),\n asin(psiMax * mapping(psi / psiMax) / M)\n ];\n };\n if (psiMax === 0) {\n k2 = sqrt(ratio / pi);\n forward = function(lambda, phi) {\n return [lambda * k2, sin(phi) / k2];\n };\n forward.invert = function(x, y) {\n return [x / k2, asin(y * k2)];\n };\n }\n return forward;\n }\n function hufnagel() {\n var a = 1, b = 0, psiMax = 45 * radians2, ratio = 2, mutate = d3Geo.geoProjectionMutator(hufnagelRaw), projection = mutate(a, b, psiMax, ratio);\n projection.a = function(_) {\n return arguments.length ? mutate(a = +_, b, psiMax, ratio) : a;\n };\n projection.b = function(_) {\n return arguments.length ? mutate(a, b = +_, psiMax, ratio) : b;\n };\n projection.psiMax = function(_) {\n return arguments.length ? mutate(a, b, psiMax = +_ * radians2, ratio) : psiMax * degrees3;\n };\n projection.ratio = function(_) {\n return arguments.length ? mutate(a, b, psiMax, ratio = +_) : ratio;\n };\n return projection.scale(180.739);\n }\n function adsimp(f, a, b, fa, fm, fb, V0, tol, maxdepth, depth, state) {\n if (state.nanEncountered) {\n return NaN;\n }\n var h, f1, f2, sl, sr, s2, m, V1, V2, err;\n h = b - a;\n f1 = f(a + h * 0.25);\n f2 = f(b - h * 0.25);\n if (isNaN(f1)) {\n state.nanEncountered = true;\n return;\n }\n if (isNaN(f2)) {\n state.nanEncountered = true;\n return;\n }\n sl = h * (fa + 4 * f1 + fm) / 12;\n sr = h * (fm + 4 * f2 + fb) / 12;\n s2 = sl + sr;\n err = (s2 - V0) / 15;\n if (depth > maxdepth) {\n state.maxDepthCount++;\n return s2 + err;\n } else if (Math.abs(err) < tol) {\n return s2 + err;\n } else {\n m = a + h * 0.5;\n V1 = adsimp(f, a, m, fa, f1, fm, sl, tol * 0.5, maxdepth, depth + 1, state);\n if (isNaN(V1)) {\n state.nanEncountered = true;\n return NaN;\n }\n V2 = adsimp(f, m, b, fm, f2, fb, sr, tol * 0.5, maxdepth, depth + 1, state);\n if (isNaN(V2)) {\n state.nanEncountered = true;\n return NaN;\n }\n return V1 + V2;\n }\n }\n function integrate(f, a, b, tol, maxdepth) {\n var state = {\n maxDepthCount: 0,\n nanEncountered: false\n };\n if (tol === void 0) {\n tol = 1e-8;\n }\n if (maxdepth === void 0) {\n maxdepth = 20;\n }\n var fa = f(a);\n var fm = f(0.5 * (a + b));\n var fb = f(b);\n var V0 = (fa + 4 * fm + fb) * (b - a) / 6;\n var result = adsimp(f, a, b, fa, fm, fb, V0, tol, maxdepth, 1, state);\n return result;\n }\n function hyperellipticalRaw(alpha, k2, gamma2) {\n function elliptic(f) {\n return alpha + (1 - alpha) * pow(1 - pow(f, k2), 1 / k2);\n }\n function z(f) {\n return integrate(elliptic, 0, f, 1e-4);\n }\n var G = 1 / z(1), n = 1e3, m = (1 + 1e-8) * G, approx = [];\n for (var i = 0; i <= n; i++)\n approx.push(z(i / n) * m);\n function Y(sinphi) {\n var rmin = 0, rmax = n, r = n >> 1;\n do {\n if (approx[r] > sinphi) rmax = r;\n else rmin = r;\n r = rmin + rmax >> 1;\n } while (r > rmin);\n var u = approx[r + 1] - approx[r];\n if (u) u = (sinphi - approx[r + 1]) / u;\n return (r + 1 + u) / n;\n }\n var ratio = 2 * Y(1) / pi * G / gamma2;\n var forward = function(lambda, phi) {\n var y = Y(abs(sin(phi))), x = elliptic(y) * lambda;\n y /= ratio;\n return [x, phi >= 0 ? y : -y];\n };\n forward.invert = function(x, y) {\n var phi;\n y *= ratio;\n if (abs(y) < 1) phi = sign(y) * asin(z(abs(y)) * G);\n return [x / elliptic(abs(y)), phi];\n };\n return forward;\n }\n function hyperelliptical() {\n var alpha = 0, k2 = 2.5, gamma2 = 1.183136, m = d3Geo.geoProjectionMutator(hyperellipticalRaw), p = m(alpha, k2, gamma2);\n p.alpha = function(_) {\n return arguments.length ? m(alpha = +_, k2, gamma2) : alpha;\n };\n p.k = function(_) {\n return arguments.length ? m(alpha, k2 = +_, gamma2) : k2;\n };\n p.gamma = function(_) {\n return arguments.length ? m(alpha, k2, gamma2 = +_) : gamma2;\n };\n return p.scale(152.63);\n }\n function pointEqual(a, b) {\n return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon;\n }\n function interpolateLine(coordinates, m) {\n var i = -1, n = coordinates.length, p0 = coordinates[0], p1, dx, dy, resampled = [];\n while (++i < n) {\n p1 = coordinates[i];\n dx = (p1[0] - p0[0]) / m;\n dy = (p1[1] - p0[1]) / m;\n for (var j = 0; j < m; ++j) resampled.push([p0[0] + j * dx, p0[1] + j * dy]);\n p0 = p1;\n }\n resampled.push(p1);\n return resampled;\n }\n function interpolateSphere(lobes2) {\n var coordinates = [], lobe, lambda0, phi02, phi1, lambda2, phi2, i, n = lobes2[0].length;\n for (i = 0; i < n; ++i) {\n lobe = lobes2[0][i];\n lambda0 = lobe[0][0], phi02 = lobe[0][1], phi1 = lobe[1][1];\n lambda2 = lobe[2][0], phi2 = lobe[2][1];\n coordinates.push(interpolateLine([\n [lambda0 + epsilon, phi02 + epsilon],\n [lambda0 + epsilon, phi1 - epsilon],\n [lambda2 - epsilon, phi1 - epsilon],\n [lambda2 - epsilon, phi2 + epsilon]\n ], 30));\n }\n for (i = lobes2[1].length - 1; i >= 0; --i) {\n lobe = lobes2[1][i];\n lambda0 = lobe[0][0], phi02 = lobe[0][1], phi1 = lobe[1][1];\n lambda2 = lobe[2][0], phi2 = lobe[2][1];\n coordinates.push(interpolateLine([\n [lambda2 - epsilon, phi2 - epsilon],\n [lambda2 - epsilon, phi1 + epsilon],\n [lambda0 + epsilon, phi1 + epsilon],\n [lambda0 + epsilon, phi02 - epsilon]\n ], 30));\n }\n return {\n type: \"Polygon\",\n coordinates: [d3Array.merge(coordinates)]\n };\n }\n function interrupt(project, lobes2, inverse2) {\n var sphere2, bounds;\n function forward(lambda, phi) {\n var sign$$1 = phi < 0 ? -1 : 1, lobe = lobes2[+(phi < 0)];\n for (var i = 0, n = lobe.length - 1; i < n && lambda > lobe[i][2][0]; ++i) ;\n var p2 = project(lambda - lobe[i][1][0], phi);\n p2[0] += project(lobe[i][1][0], sign$$1 * phi > sign$$1 * lobe[i][0][1] ? lobe[i][0][1] : phi)[0];\n return p2;\n }\n if (inverse2) {\n forward.invert = inverse2(forward);\n } else if (project.invert) {\n forward.invert = function(x, y) {\n var bound = bounds[+(y < 0)], lobe = lobes2[+(y < 0)];\n for (var i = 0, n = bound.length; i < n; ++i) {\n var b = bound[i];\n if (b[0][0] <= x && x < b[1][0] && b[0][1] <= y && y < b[1][1]) {\n var p2 = project.invert(x - project(lobe[i][1][0], 0)[0], y);\n p2[0] += lobe[i][1][0];\n return pointEqual(forward(p2[0], p2[1]), [x, y]) ? p2 : null;\n }\n }\n };\n }\n var p = d3Geo.geoProjection(forward), stream_ = p.stream;\n p.stream = function(stream) {\n var rotate = p.rotate(), rotateStream = stream_(stream), sphereStream = (p.rotate([0, 0]), stream_(stream));\n p.rotate(rotate);\n rotateStream.sphere = function() {\n d3Geo.geoStream(sphere2, sphereStream);\n };\n return rotateStream;\n };\n p.lobes = function(_) {\n if (!arguments.length) return lobes2.map(function(lobe) {\n return lobe.map(function(l) {\n return [\n [l[0][0] * degrees3, l[0][1] * degrees3],\n [l[1][0] * degrees3, l[1][1] * degrees3],\n [l[2][0] * degrees3, l[2][1] * degrees3]\n ];\n });\n });\n sphere2 = interpolateSphere(_);\n lobes2 = _.map(function(lobe) {\n return lobe.map(function(l) {\n return [\n [l[0][0] * radians2, l[0][1] * radians2],\n [l[1][0] * radians2, l[1][1] * radians2],\n [l[2][0] * radians2, l[2][1] * radians2]\n ];\n });\n });\n bounds = lobes2.map(function(lobe) {\n return lobe.map(function(l) {\n var x02 = project(l[0][0], l[0][1])[0], x12 = project(l[2][0], l[2][1])[0], y02 = project(l[1][0], l[0][1])[1], y12 = project(l[1][0], l[1][1])[1], t;\n if (y02 > y12) t = y02, y02 = y12, y12 = t;\n return [[x02, y02], [x12, y12]];\n });\n });\n return p;\n };\n if (lobes2 != null) p.lobes(lobes2);\n return p;\n }\n var lobes = [[\n // northern hemisphere\n [[-180, 0], [-100, 90], [-40, 0]],\n [[-40, 0], [30, 90], [180, 0]]\n ], [\n // southern hemisphere\n [[-180, 0], [-160, -90], [-100, 0]],\n [[-100, 0], [-60, -90], [-20, 0]],\n [[-20, 0], [20, -90], [80, 0]],\n [[80, 0], [140, -90], [180, 0]]\n ]];\n function boggs$1() {\n return interrupt(boggsRaw, lobes).scale(160.857);\n }\n var lobes$1 = [[\n // northern hemisphere\n [[-180, 0], [-100, 90], [-40, 0]],\n [[-40, 0], [30, 90], [180, 0]]\n ], [\n // southern hemisphere\n [[-180, 0], [-160, -90], [-100, 0]],\n [[-100, 0], [-60, -90], [-20, 0]],\n [[-20, 0], [20, -90], [80, 0]],\n [[80, 0], [140, -90], [180, 0]]\n ]];\n function homolosine$1() {\n return interrupt(homolosineRaw, lobes$1).scale(152.63);\n }\n var lobes$2 = [[\n // northern hemisphere\n [[-180, 0], [-100, 90], [-40, 0]],\n [[-40, 0], [30, 90], [180, 0]]\n ], [\n // southern hemisphere\n [[-180, 0], [-160, -90], [-100, 0]],\n [[-100, 0], [-60, -90], [-20, 0]],\n [[-20, 0], [20, -90], [80, 0]],\n [[80, 0], [140, -90], [180, 0]]\n ]];\n function mollweide$1() {\n return interrupt(mollweideRaw, lobes$2).scale(169.529);\n }\n var lobes$3 = [[\n // northern hemisphere\n [[-180, 0], [-90, 90], [0, 0]],\n [[0, 0], [90, 90], [180, 0]]\n ], [\n // southern hemisphere\n [[-180, 0], [-90, -90], [0, 0]],\n [[0, 0], [90, -90], [180, 0]]\n ]];\n function mollweideHemispheres() {\n return interrupt(mollweideRaw, lobes$3).scale(169.529).rotate([20, 0]);\n }\n var lobes$4 = [[\n // northern hemisphere\n [[-180, 35], [-30, 90], [0, 35]],\n [[0, 35], [30, 90], [180, 35]]\n ], [\n // southern hemisphere\n [[-180, -10], [-102, -90], [-65, -10]],\n [[-65, -10], [5, -90], [77, -10]],\n [[77, -10], [103, -90], [180, -10]]\n ]];\n function sinuMollweide$1() {\n return interrupt(sinuMollweideRaw, lobes$4, solve2d).rotate([-20, -55]).scale(164.263).center([0, -5.4036]);\n }\n var lobes$5 = [[\n // northern hemisphere\n [[-180, 0], [-110, 90], [-40, 0]],\n [[-40, 0], [0, 90], [40, 0]],\n [[40, 0], [110, 90], [180, 0]]\n ], [\n // southern hemisphere\n [[-180, 0], [-110, -90], [-40, 0]],\n [[-40, 0], [0, -90], [40, 0]],\n [[40, 0], [110, -90], [180, 0]]\n ]];\n function sinusoidal$1() {\n return interrupt(sinusoidalRaw, lobes$5).scale(152.63).rotate([-20, 0]);\n }\n function kavrayskiy7Raw(lambda, phi) {\n return [3 / tau * lambda * sqrt(pi * pi / 3 - phi * phi), phi];\n }\n kavrayskiy7Raw.invert = function(x, y) {\n return [tau / 3 * x / sqrt(pi * pi / 3 - y * y), y];\n };\n function kavrayskiy7() {\n return d3Geo.geoProjection(kavrayskiy7Raw).scale(158.837);\n }\n function lagrangeRaw(n) {\n function forward(lambda, phi) {\n if (abs(abs(phi) - halfPi) < epsilon) return [0, phi < 0 ? -2 : 2];\n var sinPhi = sin(phi), v = pow((1 + sinPhi) / (1 - sinPhi), n / 2), c = 0.5 * (v + 1 / v) + cos(lambda *= n);\n return [\n 2 * sin(lambda) / c,\n (v - 1 / v) / c\n ];\n }\n forward.invert = function(x, y) {\n var y02 = abs(y);\n if (abs(y02 - 2) < epsilon) return x ? null : [0, sign(y) * halfPi];\n if (y02 > 2) return null;\n x /= 2, y /= 2;\n var x2 = x * x, y2 = y * y, t = 2 * y / (1 + x2 + y2);\n t = pow((1 + t) / (1 - t), 1 / n);\n return [\n atan2(2 * x, 1 - x2 - y2) / n,\n asin((t - 1) / (t + 1))\n ];\n };\n return forward;\n }\n function lagrange() {\n var n = 0.5, m = d3Geo.geoProjectionMutator(lagrangeRaw), p = m(n);\n p.spacing = function(_) {\n return arguments.length ? m(n = +_) : n;\n };\n return p.scale(124.75);\n }\n var pi_sqrt2 = pi / sqrt2;\n function larriveeRaw(lambda, phi) {\n return [\n lambda * (1 + sqrt(cos(phi))) / 2,\n phi / (cos(phi / 2) * cos(lambda / 6))\n ];\n }\n larriveeRaw.invert = function(x, y) {\n var x02 = abs(x), y02 = abs(y), lambda = epsilon, phi = halfPi;\n if (y02 < pi_sqrt2) phi *= y02 / pi_sqrt2;\n else lambda += 6 * acos(pi_sqrt2 / y02);\n for (var i = 0; i < 25; i++) {\n var sinPhi = sin(phi), sqrtcosPhi = sqrt(cos(phi)), sinPhi_2 = sin(phi / 2), cosPhi_2 = cos(phi / 2), sinLambda_6 = sin(lambda / 6), cosLambda_6 = cos(lambda / 6), f0 = 0.5 * lambda * (1 + sqrtcosPhi) - x02, f1 = phi / (cosPhi_2 * cosLambda_6) - y02, df0dPhi = sqrtcosPhi ? -0.25 * lambda * sinPhi / sqrtcosPhi : 0, df0dLambda = 0.5 * (1 + sqrtcosPhi), df1dPhi = (1 + 0.5 * phi * sinPhi_2 / cosPhi_2) / (cosPhi_2 * cosLambda_6), df1dLambda = phi / cosPhi_2 * (sinLambda_6 / 6) / (cosLambda_6 * cosLambda_6), denom = df0dPhi * df1dLambda - df1dPhi * df0dLambda, dPhi = (f0 * df1dLambda - f1 * df0dLambda) / denom, dLambda = (f1 * df0dPhi - f0 * df1dPhi) / denom;\n phi -= dPhi;\n lambda -= dLambda;\n if (abs(dPhi) < epsilon && abs(dLambda) < epsilon) break;\n }\n return [x < 0 ? -lambda : lambda, y < 0 ? -phi : phi];\n };\n function larrivee() {\n return d3Geo.geoProjection(larriveeRaw).scale(97.2672);\n }\n function laskowskiRaw(lambda, phi) {\n var lambda2 = lambda * lambda, phi2 = phi * phi;\n return [\n lambda * (0.975534 + phi2 * (-0.119161 + lambda2 * -0.0143059 + phi2 * -0.0547009)),\n phi * (1.00384 + lambda2 * (0.0802894 + phi2 * -0.02855 + lambda2 * 199025e-9) + phi2 * (0.0998909 + phi2 * -0.0491032))\n ];\n }\n laskowskiRaw.invert = function(x, y) {\n var lambda = sign(x) * pi, phi = y / 2, i = 50;\n do {\n var lambda2 = lambda * lambda, phi2 = phi * phi, lambdaPhi = lambda * phi, fx = lambda * (0.975534 + phi2 * (-0.119161 + lambda2 * -0.0143059 + phi2 * -0.0547009)) - x, fy = phi * (1.00384 + lambda2 * (0.0802894 + phi2 * -0.02855 + lambda2 * 199025e-9) + phi2 * (0.0998909 + phi2 * -0.0491032)) - y, deltaxDeltaLambda = 0.975534 - phi2 * (0.119161 + 3 * lambda2 * 0.0143059 + phi2 * 0.0547009), deltaxDeltaPhi = -lambdaPhi * (2 * 0.119161 + 4 * 0.0547009 * phi2 + 2 * 0.0143059 * lambda2), deltayDeltaLambda = lambdaPhi * (2 * 0.0802894 + 4 * 199025e-9 * lambda2 + 2 * -0.02855 * phi2), deltayDeltaPhi = 1.00384 + lambda2 * (0.0802894 + 199025e-9 * lambda2) + phi2 * (3 * (0.0998909 - 0.02855 * lambda2) - 5 * 0.0491032 * phi2), denominator = deltaxDeltaPhi * deltayDeltaLambda - deltayDeltaPhi * deltaxDeltaLambda, deltaLambda = (fy * deltaxDeltaPhi - fx * deltayDeltaPhi) / denominator, deltaPhi = (fx * deltayDeltaLambda - fy * deltaxDeltaLambda) / denominator;\n lambda -= deltaLambda, phi -= deltaPhi;\n } while ((abs(deltaLambda) > epsilon || abs(deltaPhi) > epsilon) && --i > 0);\n return i && [lambda, phi];\n };\n function laskowski() {\n return d3Geo.geoProjection(laskowskiRaw).scale(139.98);\n }\n function littrowRaw(lambda, phi) {\n return [\n sin(lambda) / cos(phi),\n tan(phi) * cos(lambda)\n ];\n }\n littrowRaw.invert = function(x, y) {\n var x2 = x * x, y2 = y * y, y2_1 = y2 + 1, x2_y2_1 = x2 + y2_1, cosPhi = x ? sqrt1_2 * sqrt((x2_y2_1 - sqrt(x2_y2_1 * x2_y2_1 - 4 * x2)) / x2) : 1 / sqrt(y2_1);\n return [\n asin(x * cosPhi),\n sign(y) * acos(cosPhi)\n ];\n };\n function littrow() {\n return d3Geo.geoProjection(littrowRaw).scale(144.049).clipAngle(90 - 1e-3);\n }\n function loximuthalRaw(phi02) {\n var cosPhi0 = cos(phi02), tanPhi0 = tan(quarterPi + phi02 / 2);\n function forward(lambda, phi) {\n var y = phi - phi02, x = abs(y) < epsilon ? lambda * cosPhi0 : abs(x = quarterPi + phi / 2) < epsilon || abs(abs(x) - halfPi) < epsilon ? 0 : lambda * y / log(tan(x) / tanPhi0);\n return [x, y];\n }\n forward.invert = function(x, y) {\n var lambda, phi = y + phi02;\n return [\n abs(y) < epsilon ? x / cosPhi0 : abs(lambda = quarterPi + phi / 2) < epsilon || abs(abs(lambda) - halfPi) < epsilon ? 0 : x * log(tan(lambda) / tanPhi0) / y,\n phi\n ];\n };\n return forward;\n }\n function loximuthal() {\n return parallel1(loximuthalRaw).parallel(40).scale(158.837);\n }\n function millerRaw(lambda, phi) {\n return [lambda, 1.25 * log(tan(quarterPi + 0.4 * phi))];\n }\n millerRaw.invert = function(x, y) {\n return [x, 2.5 * atan(exp(0.8 * y)) - 0.625 * pi];\n };\n function miller() {\n return d3Geo.geoProjection(millerRaw).scale(108.318);\n }\n function modifiedStereographicRaw(C2) {\n var m = C2.length - 1;\n function forward(lambda, phi) {\n var cosPhi = cos(phi), k2 = 2 / (1 + cosPhi * cos(lambda)), zr = k2 * cosPhi * sin(lambda), zi = k2 * sin(phi), i = m, w2 = C2[i], ar = w2[0], ai = w2[1], t;\n while (--i >= 0) {\n w2 = C2[i];\n ar = w2[0] + zr * (t = ar) - zi * ai;\n ai = w2[1] + zr * ai + zi * t;\n }\n ar = zr * (t = ar) - zi * ai;\n ai = zr * ai + zi * t;\n return [ar, ai];\n }\n forward.invert = function(x, y) {\n var i = 20, zr = x, zi = y;\n do {\n var j = m, w2 = C2[j], ar = w2[0], ai = w2[1], br = 0, bi = 0, t;\n while (--j >= 0) {\n w2 = C2[j];\n br = ar + zr * (t = br) - zi * bi;\n bi = ai + zr * bi + zi * t;\n ar = w2[0] + zr * (t = ar) - zi * ai;\n ai = w2[1] + zr * ai + zi * t;\n }\n br = ar + zr * (t = br) - zi * bi;\n bi = ai + zr * bi + zi * t;\n ar = zr * (t = ar) - zi * ai - x;\n ai = zr * ai + zi * t - y;\n var denominator = br * br + bi * bi, deltar, deltai;\n zr -= deltar = (ar * br + ai * bi) / denominator;\n zi -= deltai = (ai * br - ar * bi) / denominator;\n } while (abs(deltar) + abs(deltai) > epsilon * epsilon && --i > 0);\n if (i) {\n var rho = sqrt(zr * zr + zi * zi), c = 2 * atan(rho * 0.5), sinc = sin(c);\n return [atan2(zr * sinc, rho * cos(c)), rho ? asin(zi * sinc / rho) : 0];\n }\n };\n return forward;\n }\n var alaska = [[0.9972523, 0], [52513e-7, -41175e-7], [74606e-7, 48125e-7], [-0.0153783, -0.1968253], [0.0636871, -0.1408027], [0.3660976, -0.2937382]], gs48 = [[0.98879, 0], [0, 0], [-0.050909, 0], [0, 0], [0.075528, 0]], gs50 = [[0.984299, 0], [0.0211642, 37608e-7], [-0.1036018, -0.0575102], [-0.0329095, -0.0320119], [0.0499471, 0.1223335], [0.026046, 0.0899805], [7388e-7, -0.1435792], [75848e-7, -0.1334108], [-0.0216473, 0.0776645], [-0.0225161, 0.0853673]], miller$1 = [[0.9245, 0], [0, 0], [0.01943, 0]], lee = [[0.721316, 0], [0, 0], [-881625e-8, -617325e-8]];\n function modifiedStereographicAlaska() {\n return modifiedStereographic(alaska, [152, -64]).scale(1400).center([-160.908, 62.4864]).clipAngle(30).angle(7.8);\n }\n function modifiedStereographicGs48() {\n return modifiedStereographic(gs48, [95, -38]).scale(1e3).clipAngle(55).center([-96.5563, 38.8675]);\n }\n function modifiedStereographicGs50() {\n return modifiedStereographic(gs50, [120, -45]).scale(359.513).clipAngle(55).center([-117.474, 53.0628]);\n }\n function modifiedStereographicMiller() {\n return modifiedStereographic(miller$1, [-20, -18]).scale(209.091).center([20, 16.7214]).clipAngle(82);\n }\n function modifiedStereographicLee() {\n return modifiedStereographic(lee, [165, 10]).scale(250).clipAngle(130).center([-165, -10]);\n }\n function modifiedStereographic(coefficients, rotate) {\n var p = d3Geo.geoProjection(modifiedStereographicRaw(coefficients)).rotate(rotate).clipAngle(90), r = d3Geo.geoRotation(rotate), center = p.center;\n delete p.rotate;\n p.center = function(_) {\n return arguments.length ? center(r(_)) : r.invert(center());\n };\n return p;\n }\n var sqrt6 = sqrt(6), sqrt7 = sqrt(7);\n function mtFlatPolarParabolicRaw(lambda, phi) {\n var theta = asin(7 * sin(phi) / (3 * sqrt6));\n return [\n sqrt6 * lambda * (2 * cos(2 * theta / 3) - 1) / sqrt7,\n 9 * sin(theta / 3) / sqrt7\n ];\n }\n mtFlatPolarParabolicRaw.invert = function(x, y) {\n var theta = 3 * asin(y * sqrt7 / 9);\n return [\n x * sqrt7 / (sqrt6 * (2 * cos(2 * theta / 3) - 1)),\n asin(sin(theta) * 3 * sqrt6 / 7)\n ];\n };\n function mtFlatPolarParabolic() {\n return d3Geo.geoProjection(mtFlatPolarParabolicRaw).scale(164.859);\n }\n function mtFlatPolarQuarticRaw(lambda, phi) {\n var k2 = (1 + sqrt1_2) * sin(phi), theta = phi;\n for (var i = 0, delta; i < 25; i++) {\n theta -= delta = (sin(theta / 2) + sin(theta) - k2) / (0.5 * cos(theta / 2) + cos(theta));\n if (abs(delta) < epsilon) break;\n }\n return [\n lambda * (1 + 2 * cos(theta) / cos(theta / 2)) / (3 * sqrt2),\n 2 * sqrt(3) * sin(theta / 2) / sqrt(2 + sqrt2)\n ];\n }\n mtFlatPolarQuarticRaw.invert = function(x, y) {\n var sinTheta_2 = y * sqrt(2 + sqrt2) / (2 * sqrt(3)), theta = 2 * asin(sinTheta_2);\n return [\n 3 * sqrt2 * x / (1 + 2 * cos(theta) / cos(theta / 2)),\n asin((sinTheta_2 + sin(theta)) / (1 + sqrt1_2))\n ];\n };\n function mtFlatPolarQuartic() {\n return d3Geo.geoProjection(mtFlatPolarQuarticRaw).scale(188.209);\n }\n function mtFlatPolarSinusoidalRaw(lambda, phi) {\n var A3 = sqrt(6 / (4 + pi)), k2 = (1 + pi / 4) * sin(phi), theta = phi / 2;\n for (var i = 0, delta; i < 25; i++) {\n theta -= delta = (theta / 2 + sin(theta) - k2) / (0.5 + cos(theta));\n if (abs(delta) < epsilon) break;\n }\n return [\n A3 * (0.5 + cos(theta)) * lambda / 1.5,\n A3 * theta\n ];\n }\n mtFlatPolarSinusoidalRaw.invert = function(x, y) {\n var A3 = sqrt(6 / (4 + pi)), theta = y / A3;\n if (abs(abs(theta) - halfPi) < epsilon) theta = theta < 0 ? -halfPi : halfPi;\n return [\n 1.5 * x / (A3 * (0.5 + cos(theta))),\n asin((theta / 2 + sin(theta)) / (1 + pi / 4))\n ];\n };\n function mtFlatPolarSinusoidal() {\n return d3Geo.geoProjection(mtFlatPolarSinusoidalRaw).scale(166.518);\n }\n function naturalEarth2Raw(lambda, phi) {\n var phi2 = phi * phi, phi4 = phi2 * phi2, phi6 = phi2 * phi4;\n return [\n lambda * (0.84719 - 0.13063 * phi2 + phi6 * phi6 * (-0.04515 + 0.05494 * phi2 - 0.02326 * phi4 + 331e-5 * phi6)),\n phi * (1.01183 + phi4 * phi4 * (-0.02625 + 0.01926 * phi2 - 396e-5 * phi4))\n ];\n }\n naturalEarth2Raw.invert = function(x, y) {\n var phi = y, i = 25, delta, phi2, phi4, phi6;\n do {\n phi2 = phi * phi;\n phi4 = phi2 * phi2;\n phi -= delta = (phi * (1.01183 + phi4 * phi4 * (-0.02625 + 0.01926 * phi2 - 396e-5 * phi4)) - y) / (1.01183 + phi4 * phi4 * (9 * -0.02625 + 11 * 0.01926 * phi2 + 13 * -396e-5 * phi4));\n } while (abs(delta) > epsilon22 && --i > 0);\n phi2 = phi * phi;\n phi4 = phi2 * phi2;\n phi6 = phi2 * phi4;\n return [\n x / (0.84719 - 0.13063 * phi2 + phi6 * phi6 * (-0.04515 + 0.05494 * phi2 - 0.02326 * phi4 + 331e-5 * phi6)),\n phi\n ];\n };\n function naturalEarth2() {\n return d3Geo.geoProjection(naturalEarth2Raw).scale(175.295);\n }\n function nellHammerRaw(lambda, phi) {\n return [\n lambda * (1 + cos(phi)) / 2,\n 2 * (phi - tan(phi / 2))\n ];\n }\n nellHammerRaw.invert = function(x, y) {\n var p = y / 2;\n for (var i = 0, delta = Infinity; i < 10 && abs(delta) > epsilon; ++i) {\n var c = cos(y / 2);\n y -= delta = (y - tan(y / 2) - p) / (1 - 0.5 / (c * c));\n }\n return [\n 2 * x / (1 + cos(y)),\n y\n ];\n };\n function nellHammer() {\n return d3Geo.geoProjection(nellHammerRaw).scale(152.63);\n }\n var lobes$6 = [[\n // northern hemisphere\n [[-180, 0], [-90, 90], [0, 0]],\n [[0, 0], [90, 90], [180, 0]]\n ], [\n // southern hemisphere\n [[-180, 0], [-90, -90], [0, 0]],\n [[0, 0], [90, -90], [180, 0]]\n ]];\n function quarticAuthalic() {\n return interrupt(hammerRaw(Infinity), lobes$6).rotate([20, 0]).scale(152.63);\n }\n function nicolosiRaw(lambda, phi) {\n var sinPhi = sin(phi), q = cos(phi), s = sign(lambda);\n if (lambda === 0 || abs(phi) === halfPi) return [0, phi];\n else if (phi === 0) return [lambda, 0];\n else if (abs(lambda) === halfPi) return [lambda * q, halfPi * sinPhi];\n var b = pi / (2 * lambda) - 2 * lambda / pi, c = 2 * phi / pi, d = (1 - c * c) / (sinPhi - c);\n var b2 = b * b, d2 = d * d, b2d2 = 1 + b2 / d2, d2b2 = 1 + d2 / b2;\n var M = (b * sinPhi / d - b / 2) / b2d2, N = (d2 * sinPhi / b2 + d / 2) / d2b2, m = M * M + q * q / b2d2, n = N * N - (d2 * sinPhi * sinPhi / b2 + d * sinPhi - 1) / d2b2;\n return [\n halfPi * (M + sqrt(m) * s),\n halfPi * (N + sqrt(n < 0 ? 0 : n) * sign(-phi * b) * s)\n ];\n }\n nicolosiRaw.invert = function(x, y) {\n x /= halfPi;\n y /= halfPi;\n var x2 = x * x, y2 = y * y, x2y2 = x2 + y2, pi2 = pi * pi;\n return [\n x ? (x2y2 - 1 + sqrt((1 - x2y2) * (1 - x2y2) + 4 * x2)) / (2 * x) * halfPi : 0,\n solve(function(phi) {\n return x2y2 * (pi * sin(phi) - 2 * phi) * pi + 4 * phi * phi * (y - sin(phi)) + 2 * pi * phi - pi2 * y;\n }, 0)\n ];\n };\n function nicolosi() {\n return d3Geo.geoProjection(nicolosiRaw).scale(127.267);\n }\n var pattersonK1 = 1.0148, pattersonK2 = 0.23185, pattersonK3 = -0.14499, pattersonK4 = 0.02406, pattersonC1 = pattersonK1, pattersonC2 = 5 * pattersonK2, pattersonC3 = 7 * pattersonK3, pattersonC4 = 9 * pattersonK4, pattersonYmax = 1.790857183;\n function pattersonRaw(lambda, phi) {\n var phi2 = phi * phi;\n return [\n lambda,\n phi * (pattersonK1 + phi2 * phi2 * (pattersonK2 + phi2 * (pattersonK3 + pattersonK4 * phi2)))\n ];\n }\n pattersonRaw.invert = function(x, y) {\n if (y > pattersonYmax) y = pattersonYmax;\n else if (y < -pattersonYmax) y = -pattersonYmax;\n var yc = y, delta;\n do {\n var y2 = yc * yc;\n yc -= delta = (yc * (pattersonK1 + y2 * y2 * (pattersonK2 + y2 * (pattersonK3 + pattersonK4 * y2))) - y) / (pattersonC1 + y2 * y2 * (pattersonC2 + y2 * (pattersonC3 + pattersonC4 * y2)));\n } while (abs(delta) > epsilon);\n return [x, yc];\n };\n function patterson() {\n return d3Geo.geoProjection(pattersonRaw).scale(139.319);\n }\n function polyconicRaw(lambda, phi) {\n if (abs(phi) < epsilon) return [lambda, 0];\n var tanPhi = tan(phi), k2 = lambda * sin(phi);\n return [\n sin(k2) / tanPhi,\n phi + (1 - cos(k2)) / tanPhi\n ];\n }\n polyconicRaw.invert = function(x, y) {\n if (abs(y) < epsilon) return [x, 0];\n var k2 = x * x + y * y, phi = y * 0.5, i = 10, delta;\n do {\n var tanPhi = tan(phi), secPhi = 1 / cos(phi), j = k2 - 2 * y * phi + phi * phi;\n phi -= delta = (tanPhi * j + 2 * (phi - y)) / (2 + j * secPhi * secPhi + 2 * (phi - y) * tanPhi);\n } while (abs(delta) > epsilon && --i > 0);\n tanPhi = tan(phi);\n return [\n (abs(y) < abs(phi + 1 / tanPhi) ? asin(x * tanPhi) : sign(y) * sign(x) * (acos(abs(x * tanPhi)) + halfPi)) / sin(phi),\n phi\n ];\n };\n function polyconic() {\n return d3Geo.geoProjection(polyconicRaw).scale(103.74);\n }\n function matrix(a, b) {\n var u = subtract(a[1], a[0]), v = subtract(b[1], b[0]), phi = angle$1(u, v), s = length(u) / length(v);\n return multiply([\n 1,\n 0,\n a[0][0],\n 0,\n 1,\n a[0][1]\n ], multiply([\n s,\n 0,\n 0,\n 0,\n s,\n 0\n ], multiply([\n cos(phi),\n sin(phi),\n 0,\n -sin(phi),\n cos(phi),\n 0\n ], [\n 1,\n 0,\n -b[0][0],\n 0,\n 1,\n -b[0][1]\n ])));\n }\n function inverse(m) {\n var k2 = 1 / (m[0] * m[4] - m[1] * m[3]);\n return [\n k2 * m[4],\n -k2 * m[1],\n k2 * (m[1] * m[5] - m[2] * m[4]),\n -k2 * m[3],\n k2 * m[0],\n k2 * (m[2] * m[3] - m[0] * m[5])\n ];\n }\n function multiply(a, b) {\n return [\n a[0] * b[0] + a[1] * b[3],\n a[0] * b[1] + a[1] * b[4],\n a[0] * b[2] + a[1] * b[5] + a[2],\n a[3] * b[0] + a[4] * b[3],\n a[3] * b[1] + a[4] * b[4],\n a[3] * b[2] + a[4] * b[5] + a[5]\n ];\n }\n function subtract(a, b) {\n return [a[0] - b[0], a[1] - b[1]];\n }\n function length(v) {\n return sqrt(v[0] * v[0] + v[1] * v[1]);\n }\n function angle$1(a, b) {\n return atan2(a[0] * b[1] - a[1] * b[0], a[0] * b[0] + a[1] * b[1]);\n }\n function polyhedral(root, face, r) {\n recurse(root, { transform: null });\n function recurse(node, parent) {\n node.edges = faceEdges(node.face);\n if (parent.face) {\n var shared = node.shared = sharedEdge(node.face, parent.face), m = matrix(shared.map(parent.project), shared.map(node.project));\n node.transform = parent.transform ? multiply(parent.transform, m) : m;\n var edges = parent.edges;\n for (var i = 0, n = edges.length; i < n; ++i) {\n if (pointEqual$1(shared[0], edges[i][1]) && pointEqual$1(shared[1], edges[i][0])) edges[i] = node;\n if (pointEqual$1(shared[0], edges[i][0]) && pointEqual$1(shared[1], edges[i][1])) edges[i] = node;\n }\n edges = node.edges;\n for (i = 0, n = edges.length; i < n; ++i) {\n if (pointEqual$1(shared[0], edges[i][0]) && pointEqual$1(shared[1], edges[i][1])) edges[i] = parent;\n if (pointEqual$1(shared[0], edges[i][1]) && pointEqual$1(shared[1], edges[i][0])) edges[i] = parent;\n }\n } else {\n node.transform = parent.transform;\n }\n if (node.children) {\n node.children.forEach(function(child) {\n recurse(child, node);\n });\n }\n return node;\n }\n function forward(lambda, phi) {\n var node = face(lambda, phi), point = node.project([lambda * degrees3, phi * degrees3]), t;\n if (t = node.transform) {\n return [\n t[0] * point[0] + t[1] * point[1] + t[2],\n -(t[3] * point[0] + t[4] * point[1] + t[5])\n ];\n }\n point[1] = -point[1];\n return point;\n }\n if (hasInverse(root)) forward.invert = function(x, y) {\n var coordinates = faceInvert(root, [x, -y]);\n return coordinates && (coordinates[0] *= radians2, coordinates[1] *= radians2, coordinates);\n };\n function faceInvert(node, coordinates) {\n var invert = node.project.invert, t = node.transform, point = coordinates;\n if (t) {\n t = inverse(t);\n point = [\n t[0] * point[0] + t[1] * point[1] + t[2],\n t[3] * point[0] + t[4] * point[1] + t[5]\n ];\n }\n if (invert && node === faceDegrees(p = invert(point))) return p;\n var p, children = node.children;\n for (var i = 0, n = children && children.length; i < n; ++i) {\n if (p = faceInvert(children[i], coordinates)) return p;\n }\n }\n function faceDegrees(coordinates) {\n return face(coordinates[0] * radians2, coordinates[1] * radians2);\n }\n var proj = d3Geo.geoProjection(forward), stream_ = proj.stream;\n proj.stream = function(stream) {\n var rotate = proj.rotate(), rotateStream = stream_(stream), sphereStream = (proj.rotate([0, 0]), stream_(stream));\n proj.rotate(rotate);\n rotateStream.sphere = function() {\n sphereStream.polygonStart();\n sphereStream.lineStart();\n outline(sphereStream, root);\n sphereStream.lineEnd();\n sphereStream.polygonEnd();\n };\n return rotateStream;\n };\n return proj.angle(r == null ? -30 : r * degrees3);\n }\n function outline(stream, node, parent) {\n var point, edges = node.edges, n = edges.length, edge, multiPoint = { type: \"MultiPoint\", coordinates: node.face }, notPoles = node.face.filter(function(d) {\n return abs(d[1]) !== 90;\n }), b = d3Geo.geoBounds({ type: \"MultiPoint\", coordinates: notPoles }), inside = false, j = -1, dx = b[1][0] - b[0][0];\n var c = dx === 180 || dx === 360 ? [(b[0][0] + b[1][0]) / 2, (b[0][1] + b[1][1]) / 2] : d3Geo.geoCentroid(multiPoint);\n if (parent) while (++j < n) {\n if (edges[j] === parent) break;\n }\n ++j;\n for (var i = 0; i < n; ++i) {\n edge = edges[(i + j) % n];\n if (Array.isArray(edge)) {\n if (!inside) {\n stream.point((point = d3Geo.geoInterpolate(edge[0], c)(epsilon))[0], point[1]);\n inside = true;\n }\n stream.point((point = d3Geo.geoInterpolate(edge[1], c)(epsilon))[0], point[1]);\n } else {\n inside = false;\n if (edge !== parent) outline(stream, edge, node);\n }\n }\n }\n function pointEqual$1(a, b) {\n return a && b && a[0] === b[0] && a[1] === b[1];\n }\n function sharedEdge(a, b) {\n var x, y, n = a.length, found = null;\n for (var i = 0; i < n; ++i) {\n x = a[i];\n for (var j = b.length; --j >= 0; ) {\n y = b[j];\n if (x[0] === y[0] && x[1] === y[1]) {\n if (found) return [found, x];\n found = x;\n }\n }\n }\n }\n function faceEdges(face) {\n var n = face.length, edges = [];\n for (var a = face[n - 1], i = 0; i < n; ++i) edges.push([a, a = face[i]]);\n return edges;\n }\n function hasInverse(node) {\n return node.project.invert || node.children && node.children.some(hasInverse);\n }\n var octahedron = [\n [0, 90],\n [-90, 0],\n [0, 0],\n [90, 0],\n [180, 0],\n [0, -90]\n ];\n var octahedron$1 = [\n [0, 2, 1],\n [0, 3, 2],\n [5, 1, 2],\n [5, 2, 3],\n [0, 1, 4],\n [0, 4, 3],\n [5, 4, 1],\n [5, 3, 4]\n ].map(function(face) {\n return face.map(function(i) {\n return octahedron[i];\n });\n });\n function butterfly(faceProjection) {\n faceProjection = faceProjection || function(face) {\n var c = d3Geo.geoCentroid({ type: \"MultiPoint\", coordinates: face });\n return d3Geo.geoGnomonic().scale(1).translate([0, 0]).rotate([-c[0], -c[1]]);\n };\n var faces = octahedron$1.map(function(face) {\n return { face, project: faceProjection(face) };\n });\n [-1, 0, 0, 1, 0, 1, 4, 5].forEach(function(d, i) {\n var node = faces[d];\n node && (node.children || (node.children = [])).push(faces[i]);\n });\n return polyhedral(faces[0], function(lambda, phi) {\n return faces[lambda < -pi / 2 ? phi < 0 ? 6 : 4 : lambda < 0 ? phi < 0 ? 2 : 0 : lambda < pi / 2 ? phi < 0 ? 3 : 1 : phi < 0 ? 7 : 5];\n }).angle(-30).scale(101.858).center([0, 45]);\n }\n var kx = 2 / sqrt(3);\n function collignonK(a, b) {\n var p = collignonRaw(a, b);\n return [p[0] * kx, p[1]];\n }\n collignonK.invert = function(x, y) {\n return collignonRaw.invert(x / kx, y);\n };\n function collignon$1(faceProjection) {\n faceProjection = faceProjection || function(face) {\n var c = d3Geo.geoCentroid({ type: \"MultiPoint\", coordinates: face });\n return d3Geo.geoProjection(collignonK).translate([0, 0]).scale(1).rotate(c[1] > 0 ? [-c[0], 0] : [180 - c[0], 180]);\n };\n var faces = octahedron$1.map(function(face) {\n return { face, project: faceProjection(face) };\n });\n [-1, 0, 0, 1, 0, 1, 4, 5].forEach(function(d, i) {\n var node = faces[d];\n node && (node.children || (node.children = [])).push(faces[i]);\n });\n return polyhedral(faces[0], function(lambda, phi) {\n return faces[lambda < -pi / 2 ? phi < 0 ? 6 : 4 : lambda < 0 ? phi < 0 ? 2 : 0 : lambda < pi / 2 ? phi < 0 ? 3 : 1 : phi < 0 ? 7 : 5];\n }).angle(-30).scale(121.906).center([0, 48.5904]);\n }\n function waterman(faceProjection) {\n faceProjection = faceProjection || function(face2) {\n var c = face2.length === 6 ? d3Geo.geoCentroid({ type: \"MultiPoint\", coordinates: face2 }) : face2[0];\n return d3Geo.geoGnomonic().scale(1).translate([0, 0]).rotate([-c[0], -c[1]]);\n };\n var w5 = octahedron$1.map(function(face2) {\n var xyz = face2.map(cartesian), n = xyz.length, a = xyz[n - 1], b, hexagon = [];\n for (var i = 0; i < n; ++i) {\n b = xyz[i];\n hexagon.push(spherical([\n a[0] * 0.9486832980505138 + b[0] * 0.31622776601683794,\n a[1] * 0.9486832980505138 + b[1] * 0.31622776601683794,\n a[2] * 0.9486832980505138 + b[2] * 0.31622776601683794\n ]), spherical([\n b[0] * 0.9486832980505138 + a[0] * 0.31622776601683794,\n b[1] * 0.9486832980505138 + a[1] * 0.31622776601683794,\n b[2] * 0.9486832980505138 + a[2] * 0.31622776601683794\n ]));\n a = b;\n }\n return hexagon;\n });\n var cornerNormals = [];\n var parents = [-1, 0, 0, 1, 0, 1, 4, 5];\n w5.forEach(function(hexagon, j) {\n var face2 = octahedron$1[j], n = face2.length, normals = cornerNormals[j] = [];\n for (var i = 0; i < n; ++i) {\n w5.push([\n face2[i],\n hexagon[(i * 2 + 2) % (2 * n)],\n hexagon[(i * 2 + 1) % (2 * n)]\n ]);\n parents.push(j);\n normals.push(cross(\n cartesian(hexagon[(i * 2 + 2) % (2 * n)]),\n cartesian(hexagon[(i * 2 + 1) % (2 * n)])\n ));\n }\n });\n var faces = w5.map(function(face2) {\n return {\n project: faceProjection(face2),\n face: face2\n };\n });\n parents.forEach(function(d, i) {\n var parent = faces[d];\n parent && (parent.children || (parent.children = [])).push(faces[i]);\n });\n function face(lambda, phi) {\n var cosphi = cos(phi), p = [cosphi * cos(lambda), cosphi * sin(lambda), sin(phi)];\n var hexagon = lambda < -pi / 2 ? phi < 0 ? 6 : 4 : lambda < 0 ? phi < 0 ? 2 : 0 : lambda < pi / 2 ? phi < 0 ? 3 : 1 : phi < 0 ? 7 : 5;\n var n = cornerNormals[hexagon];\n return faces[dot(n[0], p) < 0 ? 8 + 3 * hexagon : dot(n[1], p) < 0 ? 8 + 3 * hexagon + 1 : dot(n[2], p) < 0 ? 8 + 3 * hexagon + 2 : hexagon];\n }\n return polyhedral(faces[0], face).angle(-30).scale(110.625).center([0, 45]);\n }\n function dot(a, b) {\n for (var i = 0, n = a.length, s = 0; i < n; ++i) s += a[i] * b[i];\n return s;\n }\n function cross(a, b) {\n return [\n a[1] * b[2] - a[2] * b[1],\n a[2] * b[0] - a[0] * b[2],\n a[0] * b[1] - a[1] * b[0]\n ];\n }\n function spherical(cartesian2) {\n return [\n atan2(cartesian2[1], cartesian2[0]) * degrees3,\n asin(max(-1, min(1, cartesian2[2]))) * degrees3\n ];\n }\n function cartesian(coordinates) {\n var lambda = coordinates[0] * radians2, phi = coordinates[1] * radians2, cosphi = cos(phi);\n return [\n cosphi * cos(lambda),\n cosphi * sin(lambda),\n sin(phi)\n ];\n }\n function noop() {\n }\n function clockwise(ring) {\n if ((n = ring.length) < 4) return false;\n var i = 0, n, area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1];\n while (++i < n) area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1];\n return area <= 0;\n }\n function contains(ring, point) {\n var x = point[0], y = point[1], contains2 = false;\n for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) {\n var pi2 = ring[i], xi = pi2[0], yi = pi2[1], pj = ring[j], xj = pj[0], yj = pj[1];\n if (yi > y ^ yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) contains2 = !contains2;\n }\n return contains2;\n }\n function index(object, projection) {\n var stream = projection.stream, project;\n if (!stream) throw new Error(\"invalid projection\");\n switch (object && object.type) {\n case \"Feature\":\n project = projectFeature;\n break;\n case \"FeatureCollection\":\n project = projectFeatureCollection;\n break;\n default:\n project = projectGeometry;\n break;\n }\n return project(object, stream);\n }\n function projectFeatureCollection(o, stream) {\n return {\n type: \"FeatureCollection\",\n features: o.features.map(function(f) {\n return projectFeature(f, stream);\n })\n };\n }\n function projectFeature(o, stream) {\n return {\n type: \"Feature\",\n id: o.id,\n properties: o.properties,\n geometry: projectGeometry(o.geometry, stream)\n };\n }\n function projectGeometryCollection(o, stream) {\n return {\n type: \"GeometryCollection\",\n geometries: o.geometries.map(function(o2) {\n return projectGeometry(o2, stream);\n })\n };\n }\n function projectGeometry(o, stream) {\n if (!o) return null;\n if (o.type === \"GeometryCollection\") return projectGeometryCollection(o, stream);\n var sink;\n switch (o.type) {\n case \"Point\":\n sink = sinkPoint;\n break;\n case \"MultiPoint\":\n sink = sinkPoint;\n break;\n case \"LineString\":\n sink = sinkLine;\n break;\n case \"MultiLineString\":\n sink = sinkLine;\n break;\n case \"Polygon\":\n sink = sinkPolygon;\n break;\n case \"MultiPolygon\":\n sink = sinkPolygon;\n break;\n case \"Sphere\":\n sink = sinkPolygon;\n break;\n default:\n return null;\n }\n d3Geo.geoStream(o, stream(sink));\n return sink.result();\n }\n var points = [], lines = [];\n var sinkPoint = {\n point: function(x, y) {\n points.push([x, y]);\n },\n result: function() {\n var result = !points.length ? null : points.length < 2 ? { type: \"Point\", coordinates: points[0] } : { type: \"MultiPoint\", coordinates: points };\n points = [];\n return result;\n }\n };\n var sinkLine = {\n lineStart: noop,\n point: function(x, y) {\n points.push([x, y]);\n },\n lineEnd: function() {\n if (points.length) lines.push(points), points = [];\n },\n result: function() {\n var result = !lines.length ? null : lines.length < 2 ? { type: \"LineString\", coordinates: lines[0] } : { type: \"MultiLineString\", coordinates: lines };\n lines = [];\n return result;\n }\n };\n var sinkPolygon = {\n polygonStart: noop,\n lineStart: noop,\n point: function(x, y) {\n points.push([x, y]);\n },\n lineEnd: function() {\n var n = points.length;\n if (n) {\n do\n points.push(points[0].slice());\n while (++n < 4);\n lines.push(points), points = [];\n }\n },\n polygonEnd: noop,\n result: function() {\n if (!lines.length) return null;\n var polygons = [], holes = [];\n lines.forEach(function(ring) {\n if (clockwise(ring)) polygons.push([ring]);\n else holes.push(ring);\n });\n holes.forEach(function(hole) {\n var point = hole[0];\n polygons.some(function(polygon) {\n if (contains(polygon[0], point)) {\n polygon.push(hole);\n return true;\n }\n }) || polygons.push([hole]);\n });\n lines = [];\n return !polygons.length ? null : polygons.length > 1 ? { type: \"MultiPolygon\", coordinates: polygons } : { type: \"Polygon\", coordinates: polygons[0] };\n }\n };\n function quincuncial(project) {\n var dx = project(halfPi, 0)[0] - project(-halfPi, 0)[0];\n function projectQuincuncial(lambda, phi) {\n var t = abs(lambda) < halfPi, p = project(t ? lambda : lambda > 0 ? lambda - pi : lambda + pi, phi), x = (p[0] - p[1]) * sqrt1_2, y = (p[0] + p[1]) * sqrt1_2;\n if (t) return [x, y];\n var d = dx * sqrt1_2, s = x > 0 ^ y > 0 ? -1 : 1;\n return [s * x - sign(y) * d, s * y - sign(x) * d];\n }\n if (project.invert) projectQuincuncial.invert = function(x02, y02) {\n var x = (x02 + y02) * sqrt1_2, y = (y02 - x02) * sqrt1_2, t = abs(x) < 0.5 * dx && abs(y) < 0.5 * dx;\n if (!t) {\n var d = dx * sqrt1_2, s = x > 0 ^ y > 0 ? -1 : 1, x12 = -s * x02 + (y > 0 ? 1 : -1) * d, y12 = -s * y02 + (x > 0 ? 1 : -1) * d;\n x = (-x12 - y12) * sqrt1_2;\n y = (x12 - y12) * sqrt1_2;\n }\n var p = project.invert(x, y);\n if (!t) p[0] += x > 0 ? pi : -pi;\n return p;\n };\n return d3Geo.geoProjection(projectQuincuncial).rotate([-90, -90, 45]).clipAngle(180 - 1e-3);\n }\n function gringorten$1() {\n return quincuncial(gringortenRaw).scale(176.423);\n }\n function peirce() {\n return quincuncial(guyouRaw).scale(111.48);\n }\n function quantize(input, digits) {\n if (!(0 <= (digits = +digits) && digits <= 20)) throw new Error(\"invalid digits\");\n function quantizePoint(input2) {\n var n = input2.length, i = 2, output2 = new Array(n);\n output2[0] = +input2[0].toFixed(digits);\n output2[1] = +input2[1].toFixed(digits);\n while (i < n) output2[i] = input2[i], ++i;\n return output2;\n }\n function quantizePoints(input2) {\n return input2.map(quantizePoint);\n }\n function quantizePointsNoDuplicates(input2) {\n var point0 = quantizePoint(input2[0]);\n var output2 = [point0];\n for (var i = 1; i < input2.length; i++) {\n var point = quantizePoint(input2[i]);\n if (point.length > 2 || point[0] != point0[0] || point[1] != point0[1]) {\n output2.push(point);\n point0 = point;\n }\n }\n if (output2.length === 1 && input2.length > 1) {\n output2.push(quantizePoint(input2[input2.length - 1]));\n }\n return output2;\n }\n function quantizePolygon(input2) {\n return input2.map(quantizePointsNoDuplicates);\n }\n function quantizeGeometry(input2) {\n if (input2 == null) return input2;\n var output2;\n switch (input2.type) {\n case \"GeometryCollection\":\n output2 = { type: \"GeometryCollection\", geometries: input2.geometries.map(quantizeGeometry) };\n break;\n case \"Point\":\n output2 = { type: \"Point\", coordinates: quantizePoint(input2.coordinates) };\n break;\n case \"MultiPoint\":\n output2 = { type: input2.type, coordinates: quantizePoints(input2.coordinates) };\n break;\n case \"LineString\":\n output2 = { type: input2.type, coordinates: quantizePointsNoDuplicates(input2.coordinates) };\n break;\n case \"MultiLineString\":\n case \"Polygon\":\n output2 = { type: input2.type, coordinates: quantizePolygon(input2.coordinates) };\n break;\n case \"MultiPolygon\":\n output2 = { type: \"MultiPolygon\", coordinates: input2.coordinates.map(quantizePolygon) };\n break;\n default:\n return input2;\n }\n if (input2.bbox != null) output2.bbox = input2.bbox;\n return output2;\n }\n function quantizeFeature(input2) {\n var output2 = { type: \"Feature\", properties: input2.properties, geometry: quantizeGeometry(input2.geometry) };\n if (input2.id != null) output2.id = input2.id;\n if (input2.bbox != null) output2.bbox = input2.bbox;\n return output2;\n }\n if (input != null) switch (input.type) {\n case \"Feature\":\n return quantizeFeature(input);\n case \"FeatureCollection\": {\n var output = { type: \"FeatureCollection\", features: input.features.map(quantizeFeature) };\n if (input.bbox != null) output.bbox = input.bbox;\n return output;\n }\n default:\n return quantizeGeometry(input);\n }\n return input;\n }\n function rectangularPolyconicRaw(phi02) {\n var sinPhi0 = sin(phi02);\n function forward(lambda, phi) {\n var A3 = sinPhi0 ? tan(lambda * sinPhi0 / 2) / sinPhi0 : lambda / 2;\n if (!phi) return [2 * A3, -phi02];\n var E2 = 2 * atan(A3 * sin(phi)), cotPhi = 1 / tan(phi);\n return [\n sin(E2) * cotPhi,\n phi + (1 - cos(E2)) * cotPhi - phi02\n ];\n }\n forward.invert = function(x, y) {\n if (abs(y += phi02) < epsilon) return [sinPhi0 ? 2 * atan(sinPhi0 * x / 2) / sinPhi0 : x, 0];\n var k2 = x * x + y * y, phi = 0, i = 10, delta;\n do {\n var tanPhi = tan(phi), secPhi = 1 / cos(phi), j = k2 - 2 * y * phi + phi * phi;\n phi -= delta = (tanPhi * j + 2 * (phi - y)) / (2 + j * secPhi * secPhi + 2 * (phi - y) * tanPhi);\n } while (abs(delta) > epsilon && --i > 0);\n var E2 = x * (tanPhi = tan(phi)), A3 = tan(abs(y) < abs(phi + 1 / tanPhi) ? asin(E2) * 0.5 : acos(E2) * 0.5 + pi / 4) / sin(phi);\n return [\n sinPhi0 ? 2 * atan(sinPhi0 * A3) / sinPhi0 : 2 * A3,\n phi\n ];\n };\n return forward;\n }\n function rectangularPolyconic() {\n return parallel1(rectangularPolyconicRaw).scale(131.215);\n }\n var K$1 = [\n [0.9986, -0.062],\n [1, 0],\n [0.9986, 0.062],\n [0.9954, 0.124],\n [0.99, 0.186],\n [0.9822, 0.248],\n [0.973, 0.31],\n [0.96, 0.372],\n [0.9427, 0.434],\n [0.9216, 0.4958],\n [0.8962, 0.5571],\n [0.8679, 0.6176],\n [0.835, 0.6769],\n [0.7986, 0.7346],\n [0.7597, 0.7903],\n [0.7186, 0.8435],\n [0.6732, 0.8936],\n [0.6213, 0.9394],\n [0.5722, 0.9761],\n [0.5322, 1]\n ];\n K$1.forEach(function(d) {\n d[1] *= 1.0144;\n });\n function robinsonRaw(lambda, phi) {\n var i = min(18, abs(phi) * 36 / pi), i0 = floor(i), di = i - i0, ax = (k2 = K$1[i0])[0], ay = k2[1], bx = (k2 = K$1[++i0])[0], by = k2[1], cx = (k2 = K$1[min(19, ++i0)])[0], cy = k2[1], k2;\n return [\n lambda * (bx + di * (cx - ax) / 2 + di * di * (cx - 2 * bx + ax) / 2),\n (phi > 0 ? halfPi : -halfPi) * (by + di * (cy - ay) / 2 + di * di * (cy - 2 * by + ay) / 2)\n ];\n }\n robinsonRaw.invert = function(x, y) {\n var yy = y / halfPi, phi = yy * 90, i = min(18, abs(phi / 5)), i0 = max(0, floor(i));\n do {\n var ay = K$1[i0][1], by = K$1[i0 + 1][1], cy = K$1[min(19, i0 + 2)][1], u = cy - ay, v = cy - 2 * by + ay, t = 2 * (abs(yy) - by) / u, c = v / u, di = t * (1 - c * t * (1 - 2 * c * t));\n if (di >= 0 || i0 === 1) {\n phi = (y >= 0 ? 5 : -5) * (di + i);\n var j = 50, delta;\n do {\n i = min(18, abs(phi) / 5);\n i0 = floor(i);\n di = i - i0;\n ay = K$1[i0][1];\n by = K$1[i0 + 1][1];\n cy = K$1[min(19, i0 + 2)][1];\n phi -= (delta = (y >= 0 ? halfPi : -halfPi) * (by + di * (cy - ay) / 2 + di * di * (cy - 2 * by + ay) / 2) - y) * degrees3;\n } while (abs(delta) > epsilon22 && --j > 0);\n break;\n }\n } while (--i0 >= 0);\n var ax = K$1[i0][0], bx = K$1[i0 + 1][0], cx = K$1[min(19, i0 + 2)][0];\n return [\n x / (bx + di * (cx - ax) / 2 + di * di * (cx - 2 * bx + ax) / 2),\n phi * radians2\n ];\n };\n function robinson() {\n return d3Geo.geoProjection(robinsonRaw).scale(152.63);\n }\n function satelliteVerticalRaw(P) {\n function forward(lambda, phi) {\n var cosPhi = cos(phi), k2 = (P - 1) / (P - cosPhi * cos(lambda));\n return [\n k2 * cosPhi * sin(lambda),\n k2 * sin(phi)\n ];\n }\n forward.invert = function(x, y) {\n var rho2 = x * x + y * y, rho = sqrt(rho2), sinc = (P - sqrt(1 - rho2 * (P + 1) / (P - 1))) / ((P - 1) / rho + rho / (P - 1));\n return [\n atan2(x * sinc, rho * sqrt(1 - sinc * sinc)),\n rho ? asin(y * sinc / rho) : 0\n ];\n };\n return forward;\n }\n function satelliteRaw(P, omega) {\n var vertical = satelliteVerticalRaw(P);\n if (!omega) return vertical;\n var cosOmega = cos(omega), sinOmega = sin(omega);\n function forward(lambda, phi) {\n var coordinates = vertical(lambda, phi), y = coordinates[1], A3 = y * sinOmega / (P - 1) + cosOmega;\n return [\n coordinates[0] * cosOmega / A3,\n y / A3\n ];\n }\n forward.invert = function(x, y) {\n var k2 = (P - 1) / (P - 1 - y * sinOmega);\n return vertical.invert(k2 * x, k2 * y * cosOmega);\n };\n return forward;\n }\n function satellite() {\n var distance2 = 2, omega = 0, m = d3Geo.geoProjectionMutator(satelliteRaw), p = m(distance2, omega);\n p.distance = function(_) {\n if (!arguments.length) return distance2;\n return m(distance2 = +_, omega);\n };\n p.tilt = function(_) {\n if (!arguments.length) return omega * degrees3;\n return m(distance2, omega = _ * radians2);\n };\n return p.scale(432.147).clipAngle(acos(1 / distance2) * degrees3 - 1e-6);\n }\n var epsilon$1 = 1e-4, epsilonInverse = 1e4, x0 = -180, x0e = x0 + epsilon$1, x1 = 180, x1e = x1 - epsilon$1, y0 = -90, y0e = y0 + epsilon$1, y1 = 90, y1e = y1 - epsilon$1;\n function nonempty(coordinates) {\n return coordinates.length > 0;\n }\n function quantize$1(x) {\n return Math.floor(x * epsilonInverse) / epsilonInverse;\n }\n function normalizePoint(y) {\n return y === y0 || y === y1 ? [0, y] : [x0, quantize$1(y)];\n }\n function clampPoint(p) {\n var x = p[0], y = p[1], clamped = false;\n if (x <= x0e) x = x0, clamped = true;\n else if (x >= x1e) x = x1, clamped = true;\n if (y <= y0e) y = y0, clamped = true;\n else if (y >= y1e) y = y1, clamped = true;\n return clamped ? [x, y] : p;\n }\n function clampPoints(points2) {\n return points2.map(clampPoint);\n }\n function extractFragments(rings, polygon, fragments) {\n for (var j = 0, m = rings.length; j < m; ++j) {\n var ring = rings[j].slice();\n fragments.push({ index: -1, polygon, ring });\n for (var i = 0, n = ring.length; i < n; ++i) {\n var point = ring[i], x = point[0], y = point[1];\n if (x <= x0e || x >= x1e || y <= y0e || y >= y1e) {\n ring[i] = clampPoint(point);\n for (var k2 = i + 1; k2 < n; ++k2) {\n var pointk = ring[k2], xk = pointk[0], yk = pointk[1];\n if (xk > x0e && xk < x1e && yk > y0e && yk < y1e) break;\n }\n if (k2 === i + 1) continue;\n if (i) {\n var fragmentBefore = { index: -1, polygon, ring: ring.slice(0, i + 1) };\n fragmentBefore.ring[fragmentBefore.ring.length - 1] = normalizePoint(y);\n fragments[fragments.length - 1] = fragmentBefore;\n } else fragments.pop();\n if (k2 >= n) break;\n fragments.push({ index: -1, polygon, ring: ring = ring.slice(k2 - 1) });\n ring[0] = normalizePoint(ring[0][1]);\n i = -1;\n n = ring.length;\n }\n }\n }\n }\n function stitchFragments(fragments) {\n var i, n = fragments.length;\n var fragmentByStart = {}, fragmentByEnd = {}, fragment, start, startFragment, end, endFragment;\n for (i = 0; i < n; ++i) {\n fragment = fragments[i];\n start = fragment.ring[0];\n end = fragment.ring[fragment.ring.length - 1];\n if (start[0] === end[0] && start[1] === end[1]) {\n fragment.polygon.push(fragment.ring);\n fragments[i] = null;\n continue;\n }\n fragment.index = i;\n fragmentByStart[start] = fragmentByEnd[end] = fragment;\n }\n for (i = 0; i < n; ++i) {\n fragment = fragments[i];\n if (fragment) {\n start = fragment.ring[0];\n end = fragment.ring[fragment.ring.length - 1];\n startFragment = fragmentByEnd[start];\n endFragment = fragmentByStart[end];\n delete fragmentByStart[start];\n delete fragmentByEnd[end];\n if (start[0] === end[0] && start[1] === end[1]) {\n fragment.polygon.push(fragment.ring);\n continue;\n }\n if (startFragment) {\n delete fragmentByEnd[start];\n delete fragmentByStart[startFragment.ring[0]];\n startFragment.ring.pop();\n fragments[startFragment.index] = null;\n fragment = { index: -1, polygon: startFragment.polygon, ring: startFragment.ring.concat(fragment.ring) };\n if (startFragment === endFragment) {\n fragment.polygon.push(fragment.ring);\n } else {\n fragment.index = n++;\n fragments.push(fragmentByStart[fragment.ring[0]] = fragmentByEnd[fragment.ring[fragment.ring.length - 1]] = fragment);\n }\n } else if (endFragment) {\n delete fragmentByStart[end];\n delete fragmentByEnd[endFragment.ring[endFragment.ring.length - 1]];\n fragment.ring.pop();\n fragment = { index: n++, polygon: endFragment.polygon, ring: fragment.ring.concat(endFragment.ring) };\n fragments[endFragment.index] = null;\n fragments.push(fragmentByStart[fragment.ring[0]] = fragmentByEnd[fragment.ring[fragment.ring.length - 1]] = fragment);\n } else {\n fragment.ring.push(fragment.ring[0]);\n fragment.polygon.push(fragment.ring);\n }\n }\n }\n }\n function stitchFeature(input) {\n var output = { type: \"Feature\", geometry: stitchGeometry(input.geometry) };\n if (input.id != null) output.id = input.id;\n if (input.bbox != null) output.bbox = input.bbox;\n if (input.properties != null) output.properties = input.properties;\n return output;\n }\n function stitchGeometry(input) {\n if (input == null) return input;\n var output, fragments, i, n;\n switch (input.type) {\n case \"GeometryCollection\":\n output = { type: \"GeometryCollection\", geometries: input.geometries.map(stitchGeometry) };\n break;\n case \"Point\":\n output = { type: \"Point\", coordinates: clampPoint(input.coordinates) };\n break;\n case \"MultiPoint\":\n case \"LineString\":\n output = { type: input.type, coordinates: clampPoints(input.coordinates) };\n break;\n case \"MultiLineString\":\n output = { type: \"MultiLineString\", coordinates: input.coordinates.map(clampPoints) };\n break;\n case \"Polygon\": {\n var polygon = [];\n extractFragments(input.coordinates, polygon, fragments = []);\n stitchFragments(fragments);\n output = { type: \"Polygon\", coordinates: polygon };\n break;\n }\n case \"MultiPolygon\": {\n fragments = [], i = -1, n = input.coordinates.length;\n var polygons = new Array(n);\n while (++i < n) extractFragments(input.coordinates[i], polygons[i] = [], fragments);\n stitchFragments(fragments);\n output = { type: \"MultiPolygon\", coordinates: polygons.filter(nonempty) };\n break;\n }\n default:\n return input;\n }\n if (input.bbox != null) output.bbox = input.bbox;\n return output;\n }\n function stitch(input) {\n if (input == null) return input;\n switch (input.type) {\n case \"Feature\":\n return stitchFeature(input);\n case \"FeatureCollection\": {\n var output = { type: \"FeatureCollection\", features: input.features.map(stitchFeature) };\n if (input.bbox != null) output.bbox = input.bbox;\n return output;\n }\n default:\n return stitchGeometry(input);\n }\n }\n function timesRaw(lambda, phi) {\n var t = tan(phi / 2), s = sin(quarterPi * t);\n return [\n lambda * (0.74482 - 0.34588 * s * s),\n 1.70711 * t\n ];\n }\n timesRaw.invert = function(x, y) {\n var t = y / 1.70711, s = sin(quarterPi * t);\n return [\n x / (0.74482 - 0.34588 * s * s),\n 2 * atan(t)\n ];\n };\n function times() {\n return d3Geo.geoProjection(timesRaw).scale(146.153);\n }\n function twoPoint(raw, p0, p1) {\n var i = d3Geo.geoInterpolate(p0, p1), o = i(0.5), a = d3Geo.geoRotation([-o[0], -o[1]])(p0), b = i.distance / 2, y = -asin(sin(a[1] * radians2) / sin(b)), R = [-o[0], -o[1], -(a[0] > 0 ? pi - y : y) * degrees3], p = d3Geo.geoProjection(raw(b)).rotate(R), r = d3Geo.geoRotation(R), center = p.center;\n delete p.rotate;\n p.center = function(_) {\n return arguments.length ? center(r(_)) : r.invert(center());\n };\n return p.clipAngle(90);\n }\n function twoPointAzimuthalRaw(d) {\n var cosd = cos(d);\n function forward(lambda, phi) {\n var coordinates = d3Geo.geoGnomonicRaw(lambda, phi);\n coordinates[0] *= cosd;\n return coordinates;\n }\n forward.invert = function(x, y) {\n return d3Geo.geoGnomonicRaw.invert(x / cosd, y);\n };\n return forward;\n }\n function twoPointAzimuthalUsa() {\n return twoPointAzimuthal([-158, 21.5], [-77, 39]).clipAngle(60).scale(400);\n }\n function twoPointAzimuthal(p0, p1) {\n return twoPoint(twoPointAzimuthalRaw, p0, p1);\n }\n function twoPointEquidistantRaw(z0) {\n if (!(z0 *= 2)) return d3Geo.geoAzimuthalEquidistantRaw;\n var lambdaa = -z0 / 2, lambdab = -lambdaa, z02 = z0 * z0, tanLambda0 = tan(lambdab), S = 0.5 / sin(lambdab);\n function forward(lambda, phi) {\n var za = acos(cos(phi) * cos(lambda - lambdaa)), zb = acos(cos(phi) * cos(lambda - lambdab)), ys = phi < 0 ? -1 : 1;\n za *= za, zb *= zb;\n return [\n (za - zb) / (2 * z0),\n ys * sqrt(4 * z02 * zb - (z02 - za + zb) * (z02 - za + zb)) / (2 * z0)\n ];\n }\n forward.invert = function(x, y) {\n var y2 = y * y, cosza = cos(sqrt(y2 + (t = x + lambdaa) * t)), coszb = cos(sqrt(y2 + (t = x + lambdab) * t)), t, d;\n return [\n atan2(d = cosza - coszb, t = (cosza + coszb) * tanLambda0),\n (y < 0 ? -1 : 1) * acos(sqrt(t * t + d * d) * S)\n ];\n };\n return forward;\n }\n function twoPointEquidistantUsa() {\n return twoPointEquidistant([-158, 21.5], [-77, 39]).clipAngle(130).scale(122.571);\n }\n function twoPointEquidistant(p0, p1) {\n return twoPoint(twoPointEquidistantRaw, p0, p1);\n }\n function vanDerGrintenRaw(lambda, phi) {\n if (abs(phi) < epsilon) return [lambda, 0];\n var sinTheta = abs(phi / halfPi), theta = asin(sinTheta);\n if (abs(lambda) < epsilon || abs(abs(phi) - halfPi) < epsilon) return [0, sign(phi) * pi * tan(theta / 2)];\n var cosTheta = cos(theta), A3 = abs(pi / lambda - lambda / pi) / 2, A22 = A3 * A3, G = cosTheta / (sinTheta + cosTheta - 1), P = G * (2 / sinTheta - 1), P2 = P * P, P2_A2 = P2 + A22, G_P2 = G - P2, Q = A22 + G;\n return [\n sign(lambda) * pi * (A3 * G_P2 + sqrt(A22 * G_P2 * G_P2 - P2_A2 * (G * G - P2))) / P2_A2,\n sign(phi) * pi * (P * Q - A3 * sqrt((A22 + 1) * P2_A2 - Q * Q)) / P2_A2\n ];\n }\n vanDerGrintenRaw.invert = function(x, y) {\n if (abs(y) < epsilon) return [x, 0];\n if (abs(x) < epsilon) return [0, halfPi * sin(2 * atan(y / pi))];\n var x2 = (x /= pi) * x, y2 = (y /= pi) * y, x2_y2 = x2 + y2, z = x2_y2 * x2_y2, c1 = -abs(y) * (1 + x2_y2), c2 = c1 - 2 * y2 + x2, c3 = -2 * c1 + 1 + 2 * y2 + z, d = y2 / c3 + (2 * c2 * c2 * c2 / (c3 * c3 * c3) - 9 * c1 * c2 / (c3 * c3)) / 27, a1 = (c1 - c2 * c2 / (3 * c3)) / c3, m1 = 2 * sqrt(-a1 / 3), theta1 = acos(3 * d / (a1 * m1)) / 3;\n return [\n pi * (x2_y2 - 1 + sqrt(1 + 2 * (x2 - y2) + z)) / (2 * x),\n sign(y) * pi * (-m1 * cos(theta1 + pi / 3) - c2 / (3 * c3))\n ];\n };\n function vanDerGrinten() {\n return d3Geo.geoProjection(vanDerGrintenRaw).scale(79.4183);\n }\n function vanDerGrinten2Raw(lambda, phi) {\n if (abs(phi) < epsilon) return [lambda, 0];\n var sinTheta = abs(phi / halfPi), theta = asin(sinTheta);\n if (abs(lambda) < epsilon || abs(abs(phi) - halfPi) < epsilon) return [0, sign(phi) * pi * tan(theta / 2)];\n var cosTheta = cos(theta), A3 = abs(pi / lambda - lambda / pi) / 2, A22 = A3 * A3, x12 = cosTheta * (sqrt(1 + A22) - A3 * cosTheta) / (1 + A22 * sinTheta * sinTheta);\n return [\n sign(lambda) * pi * x12,\n sign(phi) * pi * sqrt(1 - x12 * (2 * A3 + x12))\n ];\n }\n vanDerGrinten2Raw.invert = function(x, y) {\n if (!x) return [0, halfPi * sin(2 * atan(y / pi))];\n var x12 = abs(x / pi), A3 = (1 - x12 * x12 - (y /= pi) * y) / (2 * x12), A22 = A3 * A3, B3 = sqrt(A22 + 1);\n return [\n sign(x) * pi * (B3 - A3),\n sign(y) * halfPi * sin(2 * atan2(sqrt((1 - 2 * A3 * x12) * (A3 + B3) - x12), sqrt(B3 + A3 + x12)))\n ];\n };\n function vanDerGrinten2() {\n return d3Geo.geoProjection(vanDerGrinten2Raw).scale(79.4183);\n }\n function vanDerGrinten3Raw(lambda, phi) {\n if (abs(phi) < epsilon) return [lambda, 0];\n var sinTheta = phi / halfPi, theta = asin(sinTheta);\n if (abs(lambda) < epsilon || abs(abs(phi) - halfPi) < epsilon) return [0, pi * tan(theta / 2)];\n var A3 = (pi / lambda - lambda / pi) / 2, y12 = sinTheta / (1 + cos(theta));\n return [\n pi * (sign(lambda) * sqrt(A3 * A3 + 1 - y12 * y12) - A3),\n pi * y12\n ];\n }\n vanDerGrinten3Raw.invert = function(x, y) {\n if (!y) return [x, 0];\n var y12 = y / pi, A3 = (pi * pi * (1 - y12 * y12) - x * x) / (2 * pi * x);\n return [\n x ? pi * (sign(x) * sqrt(A3 * A3 + 1) - A3) : 0,\n halfPi * sin(2 * atan(y12))\n ];\n };\n function vanDerGrinten3() {\n return d3Geo.geoProjection(vanDerGrinten3Raw).scale(79.4183);\n }\n function vanDerGrinten4Raw(lambda, phi) {\n if (!phi) return [lambda, 0];\n var phi02 = abs(phi);\n if (!lambda || phi02 === halfPi) return [0, phi];\n var B3 = phi02 / halfPi, B22 = B3 * B3, C2 = (8 * B3 - B22 * (B22 + 2) - 5) / (2 * B22 * (B3 - 1)), C22 = C2 * C2, BC = B3 * C2, B_C2 = B22 + C22 + 2 * BC, B_3C = B3 + 3 * C2, lambda0 = lambda / halfPi, lambda1 = lambda0 + 1 / lambda0, D2 = sign(abs(lambda) - halfPi) * sqrt(lambda1 * lambda1 - 4), D22 = D2 * D2, F = B_C2 * (B22 + C22 * D22 - 1) + (1 - B22) * (B22 * (B_3C * B_3C + 4 * C22) + 12 * BC * C22 + 4 * C22 * C22), x12 = (D2 * (B_C2 + C22 - 1) + 2 * sqrt(F)) / (4 * B_C2 + D22);\n return [\n sign(lambda) * halfPi * x12,\n sign(phi) * halfPi * sqrt(1 + D2 * abs(x12) - x12 * x12)\n ];\n }\n vanDerGrinten4Raw.invert = function(x, y) {\n var delta;\n if (!x || !y) return [x, y];\n y /= pi;\n var x12 = sign(x) * x / halfPi, D2 = (x12 * x12 - 1 + 4 * y * y) / abs(x12), D22 = D2 * D2, B3 = 2 * y, i = 50;\n do {\n var B22 = B3 * B3, C2 = (8 * B3 - B22 * (B22 + 2) - 5) / (2 * B22 * (B3 - 1)), C_ = (3 * B3 - B22 * B3 - 10) / (2 * B22 * B3), C22 = C2 * C2, BC = B3 * C2, B_C = B3 + C2, B_C2 = B_C * B_C, B_3C = B3 + 3 * C2, F = B_C2 * (B22 + C22 * D22 - 1) + (1 - B22) * (B22 * (B_3C * B_3C + 4 * C22) + C22 * (12 * BC + 4 * C22)), F_ = -2 * B_C * (4 * BC * C22 + (1 - 4 * B22 + 3 * B22 * B22) * (1 + C_) + C22 * (-6 + 14 * B22 - D22 + (-8 + 8 * B22 - 2 * D22) * C_) + BC * (-8 + 12 * B22 + (-10 + 10 * B22 - D22) * C_)), sqrtF = sqrt(F), f = D2 * (B_C2 + C22 - 1) + 2 * sqrtF - x12 * (4 * B_C2 + D22), f_ = D2 * (2 * C2 * C_ + 2 * B_C * (1 + C_)) + F_ / sqrtF - 8 * B_C * (D2 * (-1 + C22 + B_C2) + 2 * sqrtF) * (1 + C_) / (D22 + 4 * B_C2);\n B3 -= delta = f / f_;\n } while (delta > epsilon && --i > 0);\n return [\n sign(x) * (sqrt(D2 * D2 + 4) + D2) * pi / 4,\n halfPi * B3\n ];\n };\n function vanDerGrinten4() {\n return d3Geo.geoProjection(vanDerGrinten4Raw).scale(127.16);\n }\n function wagnerFormula(cx, cy, m1, m2, n) {\n function forward(lambda, phi) {\n var s = m1 * sin(m2 * phi), c0 = sqrt(1 - s * s), c1 = sqrt(2 / (1 + c0 * cos(lambda *= n)));\n return [\n cx * c0 * c1 * sin(lambda),\n cy * s * c1\n ];\n }\n forward.invert = function(x, y) {\n var t12 = x / cx, t22 = y / cy, p = sqrt(t12 * t12 + t22 * t22), c = 2 * asin(p / 2);\n return [\n atan2(x * tan(c), cx * p) / n,\n p && asin(y * sin(c) / (cy * m1 * p)) / m2\n ];\n };\n return forward;\n }\n function wagnerRaw(poleline, parallels, inflation, ratio) {\n var phi1 = pi / 3;\n poleline = max(poleline, epsilon);\n parallels = max(parallels, epsilon);\n poleline = min(poleline, halfPi);\n parallels = min(parallels, pi - epsilon);\n inflation = max(inflation, 0);\n inflation = min(inflation, 100 - epsilon);\n ratio = max(ratio, epsilon);\n var vinflation = inflation / 100 + 1;\n var vratio = ratio / 100;\n var m2 = acos(vinflation * cos(phi1)) / phi1, m1 = sin(poleline) / sin(m2 * halfPi), n = parallels / pi, k2 = sqrt(vratio * sin(poleline / 2) / sin(parallels / 2)), cx = k2 / sqrt(n * m1 * m2), cy = 1 / (k2 * sqrt(n * m1 * m2));\n return wagnerFormula(cx, cy, m1, m2, n);\n }\n function wagner() {\n var poleline = 65 * radians2, parallels = 60 * radians2, inflation = 20, ratio = 200, mutate = d3Geo.geoProjectionMutator(wagnerRaw), projection = mutate(poleline, parallels, inflation, ratio);\n projection.poleline = function(_) {\n return arguments.length ? mutate(poleline = +_ * radians2, parallels, inflation, ratio) : poleline * degrees3;\n };\n projection.parallels = function(_) {\n return arguments.length ? mutate(poleline, parallels = +_ * radians2, inflation, ratio) : parallels * degrees3;\n };\n projection.inflation = function(_) {\n return arguments.length ? mutate(poleline, parallels, inflation = +_, ratio) : inflation;\n };\n projection.ratio = function(_) {\n return arguments.length ? mutate(poleline, parallels, inflation, ratio = +_) : ratio;\n };\n return projection.scale(163.775);\n }\n function wagner7() {\n return wagner().poleline(65).parallels(60).inflation(0).ratio(200).scale(172.633);\n }\n var A2 = 4 * pi + 3 * sqrt(3), B2 = 2 * sqrt(2 * pi * sqrt(3) / A2);\n var wagner4Raw = mollweideBromleyRaw(B2 * sqrt(3) / pi, B2, A2 / 6);\n function wagner4() {\n return d3Geo.geoProjection(wagner4Raw).scale(176.84);\n }\n function wagner6Raw(lambda, phi) {\n return [lambda * sqrt(1 - 3 * phi * phi / (pi * pi)), phi];\n }\n wagner6Raw.invert = function(x, y) {\n return [x / sqrt(1 - 3 * y * y / (pi * pi)), y];\n };\n function wagner6() {\n return d3Geo.geoProjection(wagner6Raw).scale(152.63);\n }\n function wiechelRaw(lambda, phi) {\n var cosPhi = cos(phi), sinPhi = cos(lambda) * cosPhi, sin1_Phi = 1 - sinPhi, cosLambda = cos(lambda = atan2(sin(lambda) * cosPhi, -sin(phi))), sinLambda = sin(lambda);\n cosPhi = sqrt(1 - sinPhi * sinPhi);\n return [\n sinLambda * cosPhi - cosLambda * sin1_Phi,\n -cosLambda * cosPhi - sinLambda * sin1_Phi\n ];\n }\n wiechelRaw.invert = function(x, y) {\n var w2 = (x * x + y * y) / -2, k2 = sqrt(-w2 * (2 + w2)), b = y * w2 + x * k2, a = x * w2 - y * k2, D2 = sqrt(a * a + b * b);\n return [\n atan2(k2 * b, D2 * (1 + w2)),\n D2 ? -asin(k2 * a / D2) : 0\n ];\n };\n function wiechel() {\n return d3Geo.geoProjection(wiechelRaw).rotate([0, -90, 45]).scale(124.75).clipAngle(180 - 1e-3);\n }\n function winkel3Raw(lambda, phi) {\n var coordinates = aitoffRaw(lambda, phi);\n return [\n (coordinates[0] + lambda / halfPi) / 2,\n (coordinates[1] + phi) / 2\n ];\n }\n winkel3Raw.invert = function(x, y) {\n var lambda = x, phi = y, i = 25;\n do {\n var cosphi = cos(phi), sinphi = sin(phi), sin_2phi = sin(2 * phi), sin2phi = sinphi * sinphi, cos2phi = cosphi * cosphi, sinlambda = sin(lambda), coslambda_2 = cos(lambda / 2), sinlambda_2 = sin(lambda / 2), sin2lambda_2 = sinlambda_2 * sinlambda_2, C2 = 1 - cos2phi * coslambda_2 * coslambda_2, E2 = C2 ? acos(cosphi * coslambda_2) * sqrt(F = 1 / C2) : F = 0, F, fx = 0.5 * (2 * E2 * cosphi * sinlambda_2 + lambda / halfPi) - x, fy = 0.5 * (E2 * sinphi + phi) - y, dxdlambda = 0.5 * F * (cos2phi * sin2lambda_2 + E2 * cosphi * coslambda_2 * sin2phi) + 0.5 / halfPi, dxdphi = F * (sinlambda * sin_2phi / 4 - E2 * sinphi * sinlambda_2), dydlambda = 0.125 * F * (sin_2phi * sinlambda_2 - E2 * sinphi * cos2phi * sinlambda), dydphi = 0.5 * F * (sin2phi * coslambda_2 + E2 * sin2lambda_2 * cosphi) + 0.5, denominator = dxdphi * dydlambda - dydphi * dxdlambda, dlambda = (fy * dxdphi - fx * dydphi) / denominator, dphi = (fx * dydlambda - fy * dxdlambda) / denominator;\n lambda -= dlambda, phi -= dphi;\n } while ((abs(dlambda) > epsilon || abs(dphi) > epsilon) && --i > 0);\n return [lambda, phi];\n };\n function winkel3() {\n return d3Geo.geoProjection(winkel3Raw).scale(158.837);\n }\n exports2.geoNaturalEarth = d3Geo.geoNaturalEarth1;\n exports2.geoNaturalEarthRaw = d3Geo.geoNaturalEarth1Raw;\n exports2.geoAiry = airy;\n exports2.geoAiryRaw = airyRaw;\n exports2.geoAitoff = aitoff;\n exports2.geoAitoffRaw = aitoffRaw;\n exports2.geoArmadillo = armadillo;\n exports2.geoArmadilloRaw = armadilloRaw;\n exports2.geoAugust = august;\n exports2.geoAugustRaw = augustRaw;\n exports2.geoBaker = baker;\n exports2.geoBakerRaw = bakerRaw;\n exports2.geoBerghaus = berghaus;\n exports2.geoBerghausRaw = berghausRaw;\n exports2.geoBertin1953 = bertin;\n exports2.geoBertin1953Raw = bertin1953Raw;\n exports2.geoBoggs = boggs;\n exports2.geoBoggsRaw = boggsRaw;\n exports2.geoBonne = bonne;\n exports2.geoBonneRaw = bonneRaw;\n exports2.geoBottomley = bottomley;\n exports2.geoBottomleyRaw = bottomleyRaw;\n exports2.geoBromley = bromley;\n exports2.geoBromleyRaw = bromleyRaw;\n exports2.geoChamberlin = chamberlin;\n exports2.geoChamberlinRaw = chamberlinRaw;\n exports2.geoChamberlinAfrica = chamberlinAfrica;\n exports2.geoCollignon = collignon;\n exports2.geoCollignonRaw = collignonRaw;\n exports2.geoCraig = craig;\n exports2.geoCraigRaw = craigRaw;\n exports2.geoCraster = craster;\n exports2.geoCrasterRaw = crasterRaw;\n exports2.geoCylindricalEqualArea = cylindricalEqualArea;\n exports2.geoCylindricalEqualAreaRaw = cylindricalEqualAreaRaw;\n exports2.geoCylindricalStereographic = cylindricalStereographic;\n exports2.geoCylindricalStereographicRaw = cylindricalStereographicRaw;\n exports2.geoEckert1 = eckert1;\n exports2.geoEckert1Raw = eckert1Raw;\n exports2.geoEckert2 = eckert2;\n exports2.geoEckert2Raw = eckert2Raw;\n exports2.geoEckert3 = eckert3;\n exports2.geoEckert3Raw = eckert3Raw;\n exports2.geoEckert4 = eckert4;\n exports2.geoEckert4Raw = eckert4Raw;\n exports2.geoEckert5 = eckert5;\n exports2.geoEckert5Raw = eckert5Raw;\n exports2.geoEckert6 = eckert6;\n exports2.geoEckert6Raw = eckert6Raw;\n exports2.geoEisenlohr = eisenlohr;\n exports2.geoEisenlohrRaw = eisenlohrRaw;\n exports2.geoFahey = fahey;\n exports2.geoFaheyRaw = faheyRaw;\n exports2.geoFoucaut = foucaut;\n exports2.geoFoucautRaw = foucautRaw;\n exports2.geoFoucautSinusoidal = foucautSinusoidal;\n exports2.geoFoucautSinusoidalRaw = foucautSinusoidalRaw;\n exports2.geoGilbert = gilbert;\n exports2.geoGingery = gingery;\n exports2.geoGingeryRaw = gingeryRaw;\n exports2.geoGinzburg4 = ginzburg4;\n exports2.geoGinzburg4Raw = ginzburg4Raw;\n exports2.geoGinzburg5 = ginzburg5;\n exports2.geoGinzburg5Raw = ginzburg5Raw;\n exports2.geoGinzburg6 = ginzburg6;\n exports2.geoGinzburg6Raw = ginzburg6Raw;\n exports2.geoGinzburg8 = ginzburg8;\n exports2.geoGinzburg8Raw = ginzburg8Raw;\n exports2.geoGinzburg9 = ginzburg9;\n exports2.geoGinzburg9Raw = ginzburg9Raw;\n exports2.geoGringorten = gringorten;\n exports2.geoGringortenRaw = gringortenRaw;\n exports2.geoGuyou = guyou;\n exports2.geoGuyouRaw = guyouRaw;\n exports2.geoHammer = hammer;\n exports2.geoHammerRaw = hammerRaw;\n exports2.geoHammerRetroazimuthal = hammerRetroazimuthal;\n exports2.geoHammerRetroazimuthalRaw = hammerRetroazimuthalRaw;\n exports2.geoHealpix = healpix;\n exports2.geoHealpixRaw = healpixRaw;\n exports2.geoHill = hill;\n exports2.geoHillRaw = hillRaw;\n exports2.geoHomolosine = homolosine;\n exports2.geoHomolosineRaw = homolosineRaw;\n exports2.geoHufnagel = hufnagel;\n exports2.geoHufnagelRaw = hufnagelRaw;\n exports2.geoHyperelliptical = hyperelliptical;\n exports2.geoHyperellipticalRaw = hyperellipticalRaw;\n exports2.geoInterrupt = interrupt;\n exports2.geoInterruptedBoggs = boggs$1;\n exports2.geoInterruptedHomolosine = homolosine$1;\n exports2.geoInterruptedMollweide = mollweide$1;\n exports2.geoInterruptedMollweideHemispheres = mollweideHemispheres;\n exports2.geoInterruptedSinuMollweide = sinuMollweide$1;\n exports2.geoInterruptedSinusoidal = sinusoidal$1;\n exports2.geoKavrayskiy7 = kavrayskiy7;\n exports2.geoKavrayskiy7Raw = kavrayskiy7Raw;\n exports2.geoLagrange = lagrange;\n exports2.geoLagrangeRaw = lagrangeRaw;\n exports2.geoLarrivee = larrivee;\n exports2.geoLarriveeRaw = larriveeRaw;\n exports2.geoLaskowski = laskowski;\n exports2.geoLaskowskiRaw = laskowskiRaw;\n exports2.geoLittrow = littrow;\n exports2.geoLittrowRaw = littrowRaw;\n exports2.geoLoximuthal = loximuthal;\n exports2.geoLoximuthalRaw = loximuthalRaw;\n exports2.geoMiller = miller;\n exports2.geoMillerRaw = millerRaw;\n exports2.geoModifiedStereographic = modifiedStereographic;\n exports2.geoModifiedStereographicRaw = modifiedStereographicRaw;\n exports2.geoModifiedStereographicAlaska = modifiedStereographicAlaska;\n exports2.geoModifiedStereographicGs48 = modifiedStereographicGs48;\n exports2.geoModifiedStereographicGs50 = modifiedStereographicGs50;\n exports2.geoModifiedStereographicMiller = modifiedStereographicMiller;\n exports2.geoModifiedStereographicLee = modifiedStereographicLee;\n exports2.geoMollweide = mollweide;\n exports2.geoMollweideRaw = mollweideRaw;\n exports2.geoMtFlatPolarParabolic = mtFlatPolarParabolic;\n exports2.geoMtFlatPolarParabolicRaw = mtFlatPolarParabolicRaw;\n exports2.geoMtFlatPolarQuartic = mtFlatPolarQuartic;\n exports2.geoMtFlatPolarQuarticRaw = mtFlatPolarQuarticRaw;\n exports2.geoMtFlatPolarSinusoidal = mtFlatPolarSinusoidal;\n exports2.geoMtFlatPolarSinusoidalRaw = mtFlatPolarSinusoidalRaw;\n exports2.geoNaturalEarth2 = naturalEarth2;\n exports2.geoNaturalEarth2Raw = naturalEarth2Raw;\n exports2.geoNellHammer = nellHammer;\n exports2.geoNellHammerRaw = nellHammerRaw;\n exports2.geoInterruptedQuarticAuthalic = quarticAuthalic;\n exports2.geoNicolosi = nicolosi;\n exports2.geoNicolosiRaw = nicolosiRaw;\n exports2.geoPatterson = patterson;\n exports2.geoPattersonRaw = pattersonRaw;\n exports2.geoPolyconic = polyconic;\n exports2.geoPolyconicRaw = polyconicRaw;\n exports2.geoPolyhedral = polyhedral;\n exports2.geoPolyhedralButterfly = butterfly;\n exports2.geoPolyhedralCollignon = collignon$1;\n exports2.geoPolyhedralWaterman = waterman;\n exports2.geoProject = index;\n exports2.geoGringortenQuincuncial = gringorten$1;\n exports2.geoPeirceQuincuncial = peirce;\n exports2.geoPierceQuincuncial = peirce;\n exports2.geoQuantize = quantize;\n exports2.geoQuincuncial = quincuncial;\n exports2.geoRectangularPolyconic = rectangularPolyconic;\n exports2.geoRectangularPolyconicRaw = rectangularPolyconicRaw;\n exports2.geoRobinson = robinson;\n exports2.geoRobinsonRaw = robinsonRaw;\n exports2.geoSatellite = satellite;\n exports2.geoSatelliteRaw = satelliteRaw;\n exports2.geoSinuMollweide = sinuMollweide;\n exports2.geoSinuMollweideRaw = sinuMollweideRaw;\n exports2.geoSinusoidal = sinusoidal;\n exports2.geoSinusoidalRaw = sinusoidalRaw;\n exports2.geoStitch = stitch;\n exports2.geoTimes = times;\n exports2.geoTimesRaw = timesRaw;\n exports2.geoTwoPointAzimuthal = twoPointAzimuthal;\n exports2.geoTwoPointAzimuthalRaw = twoPointAzimuthalRaw;\n exports2.geoTwoPointAzimuthalUsa = twoPointAzimuthalUsa;\n exports2.geoTwoPointEquidistant = twoPointEquidistant;\n exports2.geoTwoPointEquidistantRaw = twoPointEquidistantRaw;\n exports2.geoTwoPointEquidistantUsa = twoPointEquidistantUsa;\n exports2.geoVanDerGrinten = vanDerGrinten;\n exports2.geoVanDerGrintenRaw = vanDerGrintenRaw;\n exports2.geoVanDerGrinten2 = vanDerGrinten2;\n exports2.geoVanDerGrinten2Raw = vanDerGrinten2Raw;\n exports2.geoVanDerGrinten3 = vanDerGrinten3;\n exports2.geoVanDerGrinten3Raw = vanDerGrinten3Raw;\n exports2.geoVanDerGrinten4 = vanDerGrinten4;\n exports2.geoVanDerGrinten4Raw = vanDerGrinten4Raw;\n exports2.geoWagner = wagner;\n exports2.geoWagner7 = wagner7;\n exports2.geoWagnerRaw = wagnerRaw;\n exports2.geoWagner4 = wagner4;\n exports2.geoWagner4Raw = wagner4Raw;\n exports2.geoWagner6 = wagner6;\n exports2.geoWagner6Raw = wagner6Raw;\n exports2.geoWiechel = wiechel;\n exports2.geoWiechelRaw = wiechelRaw;\n exports2.geoWinkel3 = winkel3;\n exports2.geoWinkel3Raw = winkel3Raw;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // src/plots/geo/zoom.js\n var require_zoom = __commonJS({\n \"src/plots/geo/zoom.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var Registry = require_registry();\n var radians2 = Math.PI / 180;\n var degrees3 = 180 / Math.PI;\n var zoomstartStyle = { cursor: \"pointer\" };\n var zoomendStyle = { cursor: \"auto\" };\n function createGeoZoom(geo, geoLayout) {\n var projection = geo.projection;\n var zoomConstructor;\n if (geoLayout._isScoped) {\n zoomConstructor = zoomScoped;\n } else if (geoLayout._isClipped) {\n zoomConstructor = zoomClipped;\n } else {\n zoomConstructor = zoomNonClipped;\n }\n return zoomConstructor(geo, projection);\n }\n module.exports = createGeoZoom;\n function initZoom(geo, projection) {\n return d3.behavior.zoom().translate(projection.translate()).scale(projection.scale());\n }\n function sync(geo, projection, cb) {\n var id = geo.id;\n var gd = geo.graphDiv;\n var layout = gd.layout;\n var userOpts = layout[id];\n var fullLayout = gd._fullLayout;\n var fullOpts = fullLayout[id];\n var preGUI = {};\n var eventData = {};\n function set(propStr, val) {\n preGUI[id + \".\" + propStr] = Lib.nestedProperty(userOpts, propStr).get();\n Registry.call(\"_storeDirectGUIEdit\", layout, fullLayout._preGUI, preGUI);\n var fullNp = Lib.nestedProperty(fullOpts, propStr);\n if (fullNp.get() !== val) {\n fullNp.set(val);\n Lib.nestedProperty(userOpts, propStr).set(val);\n eventData[id + \".\" + propStr] = val;\n }\n }\n cb(set);\n set(\"projection.scale\", projection.scale() / geo.fitScale);\n set(\"fitbounds\", false);\n gd.emit(\"plotly_relayout\", eventData);\n }\n function zoomScoped(geo, projection) {\n var zoom = initZoom(geo, projection);\n function handleZoomstart() {\n d3.select(this).style(zoomstartStyle);\n }\n function handleZoom() {\n projection.scale(d3.event.scale).translate(d3.event.translate);\n geo.render(true);\n var center = projection.invert(geo.midPt);\n geo.graphDiv.emit(\"plotly_relayouting\", {\n \"geo.projection.scale\": projection.scale() / geo.fitScale,\n \"geo.center.lon\": center[0],\n \"geo.center.lat\": center[1]\n });\n }\n function syncCb(set) {\n var center = projection.invert(geo.midPt);\n set(\"center.lon\", center[0]);\n set(\"center.lat\", center[1]);\n }\n function handleZoomend() {\n d3.select(this).style(zoomendStyle);\n sync(geo, projection, syncCb);\n }\n zoom.on(\"zoomstart\", handleZoomstart).on(\"zoom\", handleZoom).on(\"zoomend\", handleZoomend);\n return zoom;\n }\n function zoomNonClipped(geo, projection) {\n var zoom = initZoom(geo, projection);\n var INSIDETOLORANCEPXS = 2;\n var mouse0, rotate0, translate0, lastRotate, zoomPoint, mouse1, rotate1, point1, didZoom;\n function position2(x) {\n return projection.invert(x);\n }\n function outside(x) {\n var pos = position2(x);\n if (!pos) return true;\n var pt = projection(pos);\n return Math.abs(pt[0] - x[0]) > INSIDETOLORANCEPXS || Math.abs(pt[1] - x[1]) > INSIDETOLORANCEPXS;\n }\n function handleZoomstart() {\n d3.select(this).style(zoomstartStyle);\n mouse0 = d3.mouse(this);\n rotate0 = projection.rotate();\n translate0 = projection.translate();\n lastRotate = rotate0;\n zoomPoint = position2(mouse0);\n }\n function handleZoom() {\n mouse1 = d3.mouse(this);\n if (outside(mouse0)) {\n zoom.scale(projection.scale());\n zoom.translate(projection.translate());\n return;\n }\n projection.scale(d3.event.scale);\n projection.translate([translate0[0], d3.event.translate[1]]);\n if (!zoomPoint) {\n mouse0 = mouse1;\n zoomPoint = position2(mouse0);\n } else if (position2(mouse1)) {\n point1 = position2(mouse1);\n rotate1 = [lastRotate[0] + (point1[0] - zoomPoint[0]), rotate0[1], rotate0[2]];\n projection.rotate(rotate1);\n lastRotate = rotate1;\n }\n didZoom = true;\n geo.render(true);\n var rotate = projection.rotate();\n var center = projection.invert(geo.midPt);\n geo.graphDiv.emit(\"plotly_relayouting\", {\n \"geo.projection.scale\": projection.scale() / geo.fitScale,\n \"geo.center.lon\": center[0],\n \"geo.center.lat\": center[1],\n \"geo.projection.rotation.lon\": -rotate[0]\n });\n }\n function handleZoomend() {\n d3.select(this).style(zoomendStyle);\n if (didZoom) sync(geo, projection, syncCb);\n }\n function syncCb(set) {\n var rotate = projection.rotate();\n var center = projection.invert(geo.midPt);\n set(\"projection.rotation.lon\", -rotate[0]);\n set(\"center.lon\", center[0]);\n set(\"center.lat\", center[1]);\n }\n zoom.on(\"zoomstart\", handleZoomstart).on(\"zoom\", handleZoom).on(\"zoomend\", handleZoomend);\n return zoom;\n }\n function zoomClipped(geo, projection) {\n var view = { r: projection.rotate(), k: projection.scale() };\n var zoom = initZoom(geo, projection);\n var event = d3eventDispatch(zoom, \"zoomstart\", \"zoom\", \"zoomend\");\n var zooming = 0;\n var zoomOn = zoom.on;\n var zoomPoint;\n zoom.on(\"zoomstart\", function() {\n d3.select(this).style(zoomstartStyle);\n var mouse0 = d3.mouse(this);\n var rotate0 = projection.rotate();\n var lastRotate = rotate0;\n var translate0 = projection.translate();\n var q = quaternionFromEuler(rotate0);\n zoomPoint = position(projection, mouse0);\n zoomOn.call(zoom, \"zoom\", function() {\n var mouse1 = d3.mouse(this);\n projection.scale(view.k = d3.event.scale);\n if (!zoomPoint) {\n mouse0 = mouse1;\n zoomPoint = position(projection, mouse0);\n } else if (position(projection, mouse1)) {\n projection.rotate(rotate0).translate(translate0);\n var point1 = position(projection, mouse1);\n var between = rotateBetween(zoomPoint, point1);\n var newEuler = eulerFromQuaternion(multiply(q, between));\n var rotateAngles = view.r = unRoll(newEuler, zoomPoint, lastRotate);\n if (!isFinite(rotateAngles[0]) || !isFinite(rotateAngles[1]) || !isFinite(rotateAngles[2])) {\n rotateAngles = lastRotate;\n }\n projection.rotate(rotateAngles);\n lastRotate = rotateAngles;\n }\n zoomed(event.of(this, arguments));\n });\n zoomstarted(event.of(this, arguments));\n }).on(\"zoomend\", function() {\n d3.select(this).style(zoomendStyle);\n zoomOn.call(zoom, \"zoom\", null);\n zoomended(event.of(this, arguments));\n sync(geo, projection, syncCb);\n }).on(\"zoom.redraw\", function() {\n geo.render(true);\n var _rotate = projection.rotate();\n geo.graphDiv.emit(\"plotly_relayouting\", {\n \"geo.projection.scale\": projection.scale() / geo.fitScale,\n \"geo.projection.rotation.lon\": -_rotate[0],\n \"geo.projection.rotation.lat\": -_rotate[1]\n });\n });\n function zoomstarted(dispatch) {\n if (!zooming++) dispatch({ type: \"zoomstart\" });\n }\n function zoomed(dispatch) {\n dispatch({ type: \"zoom\" });\n }\n function zoomended(dispatch) {\n if (!--zooming) dispatch({ type: \"zoomend\" });\n }\n function syncCb(set) {\n var _rotate = projection.rotate();\n set(\"projection.rotation.lon\", -_rotate[0]);\n set(\"projection.rotation.lat\", -_rotate[1]);\n }\n return d3.rebind(zoom, event, \"on\");\n }\n function position(projection, point) {\n var spherical = projection.invert(point);\n return spherical && isFinite(spherical[0]) && isFinite(spherical[1]) && cartesian(spherical);\n }\n function quaternionFromEuler(euler) {\n var lambda = 0.5 * euler[0] * radians2;\n var phi = 0.5 * euler[1] * radians2;\n var gamma2 = 0.5 * euler[2] * radians2;\n var sinLambda = Math.sin(lambda);\n var cosLambda = Math.cos(lambda);\n var sinPhi = Math.sin(phi);\n var cosPhi = Math.cos(phi);\n var sinGamma = Math.sin(gamma2);\n var cosGamma = Math.cos(gamma2);\n return [\n cosLambda * cosPhi * cosGamma + sinLambda * sinPhi * sinGamma,\n sinLambda * cosPhi * cosGamma - cosLambda * sinPhi * sinGamma,\n cosLambda * sinPhi * cosGamma + sinLambda * cosPhi * sinGamma,\n cosLambda * cosPhi * sinGamma - sinLambda * sinPhi * cosGamma\n ];\n }\n function multiply(a, b) {\n var a0 = a[0];\n var a1 = a[1];\n var a2 = a[2];\n var a3 = a[3];\n var b0 = b[0];\n var b1 = b[1];\n var b2 = b[2];\n var b3 = b[3];\n return [\n a0 * b0 - a1 * b1 - a2 * b2 - a3 * b3,\n a0 * b1 + a1 * b0 + a2 * b3 - a3 * b2,\n a0 * b2 - a1 * b3 + a2 * b0 + a3 * b1,\n a0 * b3 + a1 * b2 - a2 * b1 + a3 * b0\n ];\n }\n function rotateBetween(a, b) {\n if (!a || !b) return;\n var axis = cross(a, b);\n var norm = Math.sqrt(dot(axis, axis));\n var halfgamma = 0.5 * Math.acos(Math.max(-1, Math.min(1, dot(a, b))));\n var k = Math.sin(halfgamma) / norm;\n return norm && [Math.cos(halfgamma), axis[2] * k, -axis[1] * k, axis[0] * k];\n }\n function unRoll(rotateAngles, pt, lastRotate) {\n var ptRotated = rotateCartesian(pt, 2, rotateAngles[0]);\n ptRotated = rotateCartesian(ptRotated, 1, rotateAngles[1]);\n ptRotated = rotateCartesian(ptRotated, 0, rotateAngles[2] - lastRotate[2]);\n var x = pt[0];\n var y = pt[1];\n var z = pt[2];\n var f = ptRotated[0];\n var g = ptRotated[1];\n var h = ptRotated[2];\n var theta = Math.atan2(y, x) * degrees3;\n var a = Math.sqrt(x * x + y * y);\n var b;\n var newYaw1;\n if (Math.abs(g) > a) {\n newYaw1 = (g > 0 ? 90 : -90) - theta;\n b = 0;\n } else {\n newYaw1 = Math.asin(g / a) * degrees3 - theta;\n b = Math.sqrt(a * a - g * g);\n }\n var newYaw2 = 180 - newYaw1 - 2 * theta;\n var newPitch1 = (Math.atan2(h, f) - Math.atan2(z, b)) * degrees3;\n var newPitch2 = (Math.atan2(h, f) - Math.atan2(z, -b)) * degrees3;\n var dist1 = angleDistance(lastRotate[0], lastRotate[1], newYaw1, newPitch1);\n var dist2 = angleDistance(lastRotate[0], lastRotate[1], newYaw2, newPitch2);\n if (dist1 <= dist2) return [newYaw1, newPitch1, lastRotate[2]];\n else return [newYaw2, newPitch2, lastRotate[2]];\n }\n function angleDistance(yaw0, pitch0, yaw1, pitch1) {\n var dYaw = angleMod(yaw1 - yaw0);\n var dPitch = angleMod(pitch1 - pitch0);\n return Math.sqrt(dYaw * dYaw + dPitch * dPitch);\n }\n function angleMod(angle) {\n return (angle % 360 + 540) % 360 - 180;\n }\n function rotateCartesian(vector, axis, angle) {\n var angleRads = angle * radians2;\n var vectorOut = vector.slice();\n var ax1 = axis === 0 ? 1 : 0;\n var ax2 = axis === 2 ? 1 : 2;\n var cosa = Math.cos(angleRads);\n var sina = Math.sin(angleRads);\n vectorOut[ax1] = vector[ax1] * cosa - vector[ax2] * sina;\n vectorOut[ax2] = vector[ax2] * cosa + vector[ax1] * sina;\n return vectorOut;\n }\n function eulerFromQuaternion(q) {\n return [\n Math.atan2(2 * (q[0] * q[1] + q[2] * q[3]), 1 - 2 * (q[1] * q[1] + q[2] * q[2])) * degrees3,\n Math.asin(Math.max(-1, Math.min(1, 2 * (q[0] * q[2] - q[3] * q[1])))) * degrees3,\n Math.atan2(2 * (q[0] * q[3] + q[1] * q[2]), 1 - 2 * (q[2] * q[2] + q[3] * q[3])) * degrees3\n ];\n }\n function cartesian(spherical) {\n var lambda = spherical[0] * radians2;\n var phi = spherical[1] * radians2;\n var cosPhi = Math.cos(phi);\n return [\n cosPhi * Math.cos(lambda),\n cosPhi * Math.sin(lambda),\n Math.sin(phi)\n ];\n }\n function dot(a, b) {\n var s = 0;\n for (var i = 0, n = a.length; i < n; ++i) s += a[i] * b[i];\n return s;\n }\n function cross(a, b) {\n return [\n a[1] * b[2] - a[2] * b[1],\n a[2] * b[0] - a[0] * b[2],\n a[0] * b[1] - a[1] * b[0]\n ];\n }\n function d3eventDispatch(target) {\n var i = 0;\n var n = arguments.length;\n var argumentz = [];\n while (++i < n) argumentz.push(arguments[i]);\n var dispatch = d3.dispatch.apply(null, argumentz);\n dispatch.of = function(thiz, argumentz2) {\n return function(e1) {\n var e0;\n try {\n e0 = e1.sourceEvent = d3.event;\n e1.target = target;\n d3.event = e1;\n dispatch[e1.type].apply(thiz, argumentz2);\n } finally {\n d3.event = e0;\n }\n };\n };\n return dispatch;\n }\n }\n });\n\n // src/plots/geo/geo.js\n var require_geo = __commonJS({\n \"src/plots/geo/geo.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var geo = require_d3_geo();\n var geoPath = geo.geoPath;\n var geoDistance = geo.geoDistance;\n var geoProjection = require_d3_geo_projection();\n var Registry = require_registry();\n var Lib = require_lib();\n var strTranslate = Lib.strTranslate;\n var Color2 = require_color();\n var Drawing = require_drawing();\n var Fx = require_fx();\n var Plots = require_plots();\n var Axes = require_axes();\n var getAutoRange = require_autorange().getAutoRange;\n var dragElement = require_dragelement();\n var prepSelect = require_selections().prepSelect;\n var clearOutline = require_selections().clearOutline;\n var selectOnClick = require_selections().selectOnClick;\n var createGeoZoom = require_zoom();\n var constants = require_constants22();\n var geoUtils = require_geo_location_utils();\n var topojsonUtils = require_topojson_utils();\n var topojsonFeature = require_topojson_client().feature;\n function Geo(opts) {\n this.id = opts.id;\n this.graphDiv = opts.graphDiv;\n this.container = opts.container;\n this.topojsonURL = opts.topojsonURL;\n this.isStatic = opts.staticPlot;\n this.topojsonName = null;\n this.topojson = null;\n this.projection = null;\n this.scope = null;\n this.viewInitial = null;\n this.fitScale = null;\n this.bounds = null;\n this.midPt = null;\n this.hasChoropleth = false;\n this.traceHash = {};\n this.layers = {};\n this.basePaths = {};\n this.dataPaths = {};\n this.dataPoints = {};\n this.clipDef = null;\n this.clipRect = null;\n this.bgRect = null;\n this.makeFramework();\n }\n var proto = Geo.prototype;\n module.exports = function createGeo(opts) {\n return new Geo(opts);\n };\n proto.plot = function(geoCalcData, fullLayout, promises, replot) {\n var _this = this;\n if (replot) return _this.update(geoCalcData, fullLayout, true);\n _this._geoCalcData = geoCalcData;\n _this._fullLayout = fullLayout;\n var geoLayout = fullLayout[this.id];\n var geoPromises = [];\n var needsTopojson = false;\n for (var k in constants.layerNameToAdjective) {\n if (k !== \"frame\" && geoLayout[\"show\" + k]) {\n needsTopojson = true;\n break;\n }\n }\n var hasMarkerAngles = false;\n for (var i = 0; i < geoCalcData.length; i++) {\n var trace = geoCalcData[0][0].trace;\n trace._geo = _this;\n if (trace.locationmode) {\n needsTopojson = true;\n }\n var marker = trace.marker;\n if (marker) {\n var angle = marker.angle;\n var angleref = marker.angleref;\n if (angle || angleref === \"north\" || angleref === \"previous\") hasMarkerAngles = true;\n }\n }\n this._hasMarkerAngles = hasMarkerAngles;\n if (needsTopojson) {\n var topojsonNameNew = topojsonUtils.getTopojsonName(geoLayout);\n if (_this.topojson === null || topojsonNameNew !== _this.topojsonName) {\n _this.topojsonName = topojsonNameNew;\n if (PlotlyGeoAssets.topojson[_this.topojsonName] === void 0) {\n geoPromises.push(_this.fetchTopojson());\n }\n }\n }\n geoPromises = geoPromises.concat(geoUtils.fetchTraceGeoData(geoCalcData));\n promises.push(new Promise(function(resolve, reject) {\n Promise.all(geoPromises).then(function() {\n _this.topojson = PlotlyGeoAssets.topojson[_this.topojsonName];\n _this.update(geoCalcData, fullLayout);\n resolve();\n }).catch(reject);\n }));\n };\n proto.fetchTopojson = function() {\n var _this = this;\n var topojsonPath = topojsonUtils.getTopojsonPath(_this.topojsonURL, _this.topojsonName);\n return new Promise(function(resolve, reject) {\n d3.json(topojsonPath, function(err, topojson) {\n if (err) {\n if (err.status === 404) {\n return reject(new Error([\n \"plotly.js could not find topojson file at\",\n topojsonPath + \".\",\n \"Make sure the *topojsonURL* plot config option\",\n \"is set properly.\"\n ].join(\" \")));\n } else {\n return reject(new Error([\n \"unexpected error while fetching topojson file at\",\n topojsonPath\n ].join(\" \")));\n }\n }\n PlotlyGeoAssets.topojson[_this.topojsonName] = topojson;\n resolve();\n });\n });\n };\n proto.update = function(geoCalcData, fullLayout, replot) {\n var geoLayout = fullLayout[this.id];\n this.hasChoropleth = false;\n for (var i = 0; i < geoCalcData.length; i++) {\n var calcTrace = geoCalcData[i];\n var trace = calcTrace[0].trace;\n if (trace.type === \"choropleth\") {\n this.hasChoropleth = true;\n }\n if (trace.visible === true && trace._length > 0) {\n trace._module.calcGeoJSON(calcTrace, fullLayout);\n }\n }\n if (!replot) {\n var hasInvalidBounds = this.updateProjection(geoCalcData, fullLayout);\n if (hasInvalidBounds) return;\n if (!this.viewInitial || this.scope !== geoLayout.scope) {\n this.saveViewInitial(geoLayout);\n }\n }\n this.scope = geoLayout.scope;\n this.updateBaseLayers(fullLayout, geoLayout);\n this.updateDims(fullLayout, geoLayout);\n this.updateFx(fullLayout, geoLayout);\n Plots.generalUpdatePerTraceModule(this.graphDiv, this, geoCalcData, geoLayout);\n var scatterLayer = this.layers.frontplot.select(\".scatterlayer\");\n this.dataPoints.point = scatterLayer.selectAll(\".point\");\n this.dataPoints.text = scatterLayer.selectAll(\"text\");\n this.dataPaths.line = scatterLayer.selectAll(\".js-line\");\n var choroplethLayer = this.layers.backplot.select(\".choroplethlayer\");\n this.dataPaths.choropleth = choroplethLayer.selectAll(\"path\");\n this._render();\n };\n proto.updateProjection = function(geoCalcData, fullLayout) {\n var gd = this.graphDiv;\n var geoLayout = fullLayout[this.id];\n var gs = fullLayout._size;\n var domain = geoLayout.domain;\n var projLayout = geoLayout.projection;\n var lonaxis = geoLayout.lonaxis;\n var lataxis = geoLayout.lataxis;\n var axLon = lonaxis._ax;\n var axLat = lataxis._ax;\n var projection = this.projection = getProjection(geoLayout);\n var extent = [[\n gs.l + gs.w * domain.x[0],\n gs.t + gs.h * (1 - domain.y[1])\n ], [\n gs.l + gs.w * domain.x[1],\n gs.t + gs.h * (1 - domain.y[0])\n ]];\n var center = geoLayout.center || {};\n var rotation = projLayout.rotation || {};\n var lonaxisRange = lonaxis.range || [];\n var lataxisRange = lataxis.range || [];\n if (geoLayout.fitbounds) {\n axLon._length = extent[1][0] - extent[0][0];\n axLat._length = extent[1][1] - extent[0][1];\n axLon.range = getAutoRange(gd, axLon);\n axLat.range = getAutoRange(gd, axLat);\n var midLon = (axLon.range[0] + axLon.range[1]) / 2;\n var midLat = (axLat.range[0] + axLat.range[1]) / 2;\n if (geoLayout._isScoped) {\n center = { lon: midLon, lat: midLat };\n } else if (geoLayout._isClipped) {\n center = { lon: midLon, lat: midLat };\n rotation = { lon: midLon, lat: midLat, roll: rotation.roll };\n var projType = projLayout.type;\n var lonHalfSpan = constants.lonaxisSpan[projType] / 2 || 180;\n var latHalfSpan = constants.lataxisSpan[projType] / 2 || 90;\n lonaxisRange = [midLon - lonHalfSpan, midLon + lonHalfSpan];\n lataxisRange = [midLat - latHalfSpan, midLat + latHalfSpan];\n } else {\n center = { lon: midLon, lat: midLat };\n rotation = { lon: midLon, lat: rotation.lat, roll: rotation.roll };\n }\n }\n projection.center([center.lon - rotation.lon, center.lat - rotation.lat]).rotate([-rotation.lon, -rotation.lat, rotation.roll]).parallels(projLayout.parallels);\n var rangeBox = makeRangeBox(lonaxisRange, lataxisRange);\n projection.fitExtent(extent, rangeBox);\n var b = this.bounds = projection.getBounds(rangeBox);\n var s = this.fitScale = projection.scale();\n var t = projection.translate();\n if (geoLayout.fitbounds) {\n var b2 = projection.getBounds(makeRangeBox(axLon.range, axLat.range));\n var k2 = Math.min(\n (b[1][0] - b[0][0]) / (b2[1][0] - b2[0][0]),\n (b[1][1] - b[0][1]) / (b2[1][1] - b2[0][1])\n );\n if (isFinite(k2)) {\n projection.scale(k2 * s);\n } else {\n Lib.warn(\"Something went wrong during\" + this.id + \"fitbounds computations.\");\n }\n } else {\n projection.scale(projLayout.scale * s);\n }\n var midPt = this.midPt = [\n (b[0][0] + b[1][0]) / 2,\n (b[0][1] + b[1][1]) / 2\n ];\n projection.translate([t[0] + (midPt[0] - t[0]), t[1] + (midPt[1] - t[1])]).clipExtent(b);\n if (geoLayout._isAlbersUsa) {\n var centerPx = projection([center.lon, center.lat]);\n var tt = projection.translate();\n projection.translate([\n tt[0] - (centerPx[0] - tt[0]),\n tt[1] - (centerPx[1] - tt[1])\n ]);\n }\n };\n proto.updateBaseLayers = function(fullLayout, geoLayout) {\n var _this = this;\n var topojson = _this.topojson;\n var layers = _this.layers;\n var basePaths = _this.basePaths;\n function isAxisLayer(d) {\n return d === \"lonaxis\" || d === \"lataxis\";\n }\n function isLineLayer(d) {\n return Boolean(constants.lineLayers[d]);\n }\n function isFillLayer(d) {\n return Boolean(constants.fillLayers[d]);\n }\n var allLayers = this.hasChoropleth ? constants.layersForChoropleth : constants.layers;\n var layerData = allLayers.filter(function(d) {\n return isLineLayer(d) || isFillLayer(d) ? geoLayout[\"show\" + d] : isAxisLayer(d) ? geoLayout[d].showgrid : true;\n });\n var join = _this.framework.selectAll(\".layer\").data(layerData, String);\n join.exit().each(function(d) {\n delete layers[d];\n delete basePaths[d];\n d3.select(this).remove();\n });\n join.enter().append(\"g\").attr(\"class\", function(d) {\n return \"layer \" + d;\n }).each(function(d) {\n var layer = layers[d] = d3.select(this);\n if (d === \"bg\") {\n _this.bgRect = layer.append(\"rect\").style(\"pointer-events\", \"all\");\n } else if (isAxisLayer(d)) {\n basePaths[d] = layer.append(\"path\").style(\"fill\", \"none\");\n } else if (d === \"backplot\") {\n layer.append(\"g\").classed(\"choroplethlayer\", true);\n } else if (d === \"frontplot\") {\n layer.append(\"g\").classed(\"scatterlayer\", true);\n } else if (isLineLayer(d)) {\n basePaths[d] = layer.append(\"path\").style(\"fill\", \"none\").style(\"stroke-miterlimit\", 2);\n } else if (isFillLayer(d)) {\n basePaths[d] = layer.append(\"path\").style(\"stroke\", \"none\");\n }\n });\n join.order();\n join.each(function(d) {\n var path = basePaths[d];\n var adj = constants.layerNameToAdjective[d];\n if (d === \"frame\") {\n path.datum(constants.sphereSVG);\n } else if (isLineLayer(d) || isFillLayer(d)) {\n path.datum(topojsonFeature(topojson, topojson.objects[d]));\n } else if (isAxisLayer(d)) {\n path.datum(makeGraticule(d, geoLayout, fullLayout)).call(Color2.stroke, geoLayout[d].gridcolor).call(Drawing.dashLine, geoLayout[d].griddash, geoLayout[d].gridwidth);\n }\n if (isLineLayer(d)) {\n path.call(Color2.stroke, geoLayout[adj + \"color\"]).call(Drawing.dashLine, \"\", geoLayout[adj + \"width\"]);\n } else if (isFillLayer(d)) {\n path.call(Color2.fill, geoLayout[adj + \"color\"]);\n }\n });\n };\n proto.updateDims = function(fullLayout, geoLayout) {\n var b = this.bounds;\n var hFrameWidth = (geoLayout.framewidth || 0) / 2;\n var l = b[0][0] - hFrameWidth;\n var t = b[0][1] - hFrameWidth;\n var w = b[1][0] - l + hFrameWidth;\n var h = b[1][1] - t + hFrameWidth;\n Drawing.setRect(this.clipRect, l, t, w, h);\n this.bgRect.call(Drawing.setRect, l, t, w, h).call(Color2.fill, geoLayout.bgcolor);\n this.xaxis._offset = l;\n this.xaxis._length = w;\n this.yaxis._offset = t;\n this.yaxis._length = h;\n };\n proto.updateFx = function(fullLayout, geoLayout) {\n var _this = this;\n var gd = _this.graphDiv;\n var bgRect = _this.bgRect;\n var dragMode = fullLayout.dragmode;\n var clickMode = fullLayout.clickmode;\n if (_this.isStatic) return;\n function zoomReset() {\n var viewInitial = _this.viewInitial;\n var updateObj = {};\n for (var k in viewInitial) {\n updateObj[_this.id + \".\" + k] = viewInitial[k];\n }\n Registry.call(\"_guiRelayout\", gd, updateObj);\n gd.emit(\"plotly_doubleclick\", null);\n }\n function invert(lonlat) {\n return _this.projection.invert([\n lonlat[0] + _this.xaxis._offset,\n lonlat[1] + _this.yaxis._offset\n ]);\n }\n var fillRangeItems = function(eventData, poly) {\n if (poly.isRect) {\n var ranges = eventData.range = {};\n ranges[_this.id] = [\n invert([poly.xmin, poly.ymin]),\n invert([poly.xmax, poly.ymax])\n ];\n } else {\n var dataPts = eventData.lassoPoints = {};\n dataPts[_this.id] = poly.map(invert);\n }\n };\n var dragOptions = {\n element: _this.bgRect.node(),\n gd,\n plotinfo: {\n id: _this.id,\n xaxis: _this.xaxis,\n yaxis: _this.yaxis,\n fillRangeItems\n },\n xaxes: [_this.xaxis],\n yaxes: [_this.yaxis],\n subplot: _this.id,\n clickFn: function(numClicks) {\n if (numClicks === 2) {\n clearOutline(gd);\n }\n }\n };\n if (dragMode === \"pan\") {\n bgRect.node().onmousedown = null;\n bgRect.call(createGeoZoom(_this, geoLayout));\n bgRect.on(\"dblclick.zoom\", zoomReset);\n if (!gd._context._scrollZoom.geo) {\n bgRect.on(\"wheel.zoom\", null);\n }\n } else if (dragMode === \"select\" || dragMode === \"lasso\") {\n bgRect.on(\".zoom\", null);\n dragOptions.prepFn = function(e, startX, startY) {\n prepSelect(e, startX, startY, dragOptions, dragMode);\n };\n dragElement.init(dragOptions);\n }\n bgRect.on(\"mousemove\", function() {\n var lonlat = _this.projection.invert(Lib.getPositionFromD3Event());\n if (!lonlat) {\n return dragElement.unhover(gd, d3.event);\n }\n _this.xaxis.p2c = function() {\n return lonlat[0];\n };\n _this.yaxis.p2c = function() {\n return lonlat[1];\n };\n Fx.hover(gd, d3.event, _this.id);\n });\n bgRect.on(\"mouseout\", function() {\n if (gd._dragging) return;\n dragElement.unhover(gd, d3.event);\n });\n bgRect.on(\"click\", function() {\n if (dragMode !== \"select\" && dragMode !== \"lasso\") {\n if (clickMode.indexOf(\"select\") > -1) {\n selectOnClick(\n d3.event,\n gd,\n [_this.xaxis],\n [_this.yaxis],\n _this.id,\n dragOptions\n );\n }\n if (clickMode.indexOf(\"event\") > -1) {\n Fx.click(gd, d3.event);\n }\n }\n });\n };\n proto.makeFramework = function() {\n var _this = this;\n var gd = _this.graphDiv;\n var fullLayout = gd._fullLayout;\n var clipId = \"clip\" + fullLayout._uid + _this.id;\n _this.clipDef = fullLayout._clips.append(\"clipPath\").attr(\"id\", clipId);\n _this.clipRect = _this.clipDef.append(\"rect\");\n _this.framework = d3.select(_this.container).append(\"g\").attr(\"class\", \"geo \" + _this.id).call(Drawing.setClipUrl, clipId, gd);\n _this.project = function(v) {\n var px = _this.projection(v);\n return px ? [px[0] - _this.xaxis._offset, px[1] - _this.yaxis._offset] : [null, null];\n };\n _this.xaxis = {\n _id: \"x\",\n c2p: function(v) {\n return _this.project(v)[0];\n }\n };\n _this.yaxis = {\n _id: \"y\",\n c2p: function(v) {\n return _this.project(v)[1];\n }\n };\n _this.mockAxis = {\n type: \"linear\",\n showexponent: \"all\",\n exponentformat: \"B\"\n };\n Axes.setConvert(_this.mockAxis, fullLayout);\n };\n proto.saveViewInitial = function(geoLayout) {\n var center = geoLayout.center || {};\n var projLayout = geoLayout.projection;\n var rotation = projLayout.rotation || {};\n this.viewInitial = {\n fitbounds: geoLayout.fitbounds,\n \"projection.scale\": projLayout.scale\n };\n var extra;\n if (geoLayout._isScoped) {\n extra = {\n \"center.lon\": center.lon,\n \"center.lat\": center.lat\n };\n } else if (geoLayout._isClipped) {\n extra = {\n \"projection.rotation.lon\": rotation.lon,\n \"projection.rotation.lat\": rotation.lat\n };\n } else {\n extra = {\n \"center.lon\": center.lon,\n \"center.lat\": center.lat,\n \"projection.rotation.lon\": rotation.lon\n };\n }\n Lib.extendFlat(this.viewInitial, extra);\n };\n proto.render = function(mayRedrawOnUpdates) {\n if (this._hasMarkerAngles && mayRedrawOnUpdates) {\n this.plot(this._geoCalcData, this._fullLayout, [], true);\n } else {\n this._render();\n }\n };\n proto._render = function() {\n var projection = this.projection;\n var pathFn = projection.getPath();\n var k;\n function translatePoints(d) {\n var lonlatPx = projection(d.lonlat);\n return lonlatPx ? strTranslate(lonlatPx[0], lonlatPx[1]) : null;\n }\n function hideShowPoints(d) {\n return projection.isLonLatOverEdges(d.lonlat) ? \"none\" : null;\n }\n for (k in this.basePaths) {\n this.basePaths[k].attr(\"d\", pathFn);\n }\n for (k in this.dataPaths) {\n this.dataPaths[k].attr(\"d\", function(d) {\n return pathFn(d.geojson);\n });\n }\n for (k in this.dataPoints) {\n this.dataPoints[k].attr(\"display\", hideShowPoints).attr(\"transform\", translatePoints);\n }\n };\n function getProjection(geoLayout) {\n var projLayout = geoLayout.projection;\n var projType = projLayout.type;\n var projName = constants.projNames[projType];\n projName = \"geo\" + Lib.titleCase(projName);\n var projFn = geo[projName] || geoProjection[projName];\n var projection = projFn();\n var clipAngle = geoLayout._isSatellite ? Math.acos(1 / projLayout.distance) * 180 / Math.PI : geoLayout._isClipped ? constants.lonaxisSpan[projType] / 2 : null;\n var methods = [\"center\", \"rotate\", \"parallels\", \"clipExtent\"];\n var dummyFn = function(_) {\n return _ ? projection : [];\n };\n for (var i = 0; i < methods.length; i++) {\n var m = methods[i];\n if (typeof projection[m] !== \"function\") {\n projection[m] = dummyFn;\n }\n }\n projection.isLonLatOverEdges = function(lonlat) {\n if (projection(lonlat) === null) {\n return true;\n }\n if (clipAngle) {\n var r = projection.rotate();\n var angle = geoDistance(lonlat, [-r[0], -r[1]]);\n var maxAngle = clipAngle * Math.PI / 180;\n return angle > maxAngle;\n } else {\n return false;\n }\n };\n projection.getPath = function() {\n return geoPath().projection(projection);\n };\n projection.getBounds = function(object) {\n return projection.getPath().bounds(object);\n };\n projection.precision(constants.precision);\n if (geoLayout._isSatellite) {\n projection.tilt(projLayout.tilt).distance(projLayout.distance);\n }\n if (clipAngle) {\n projection.clipAngle(clipAngle - constants.clipPad);\n }\n return projection;\n }\n function makeGraticule(axisName, geoLayout, fullLayout) {\n var epsilon = 1e-6;\n var precision = 2.5;\n var axLayout = geoLayout[axisName];\n var scopeDefaults = constants.scopeDefaults[geoLayout.scope];\n var rng;\n var oppRng;\n var coordFn;\n if (axisName === \"lonaxis\") {\n rng = scopeDefaults.lonaxisRange;\n oppRng = scopeDefaults.lataxisRange;\n coordFn = function(v2, l2) {\n return [v2, l2];\n };\n } else if (axisName === \"lataxis\") {\n rng = scopeDefaults.lataxisRange;\n oppRng = scopeDefaults.lonaxisRange;\n coordFn = function(v2, l2) {\n return [l2, v2];\n };\n }\n var dummyAx = {\n type: \"linear\",\n range: [rng[0], rng[1] - epsilon],\n tick0: axLayout.tick0,\n dtick: axLayout.dtick\n };\n Axes.setConvert(dummyAx, fullLayout);\n var vals = Axes.calcTicks(dummyAx);\n if (!geoLayout.isScoped && axisName === \"lonaxis\") {\n vals.pop();\n }\n var len = vals.length;\n var coords = new Array(len);\n for (var i = 0; i < len; i++) {\n var v = vals[i].x;\n var line = coords[i] = [];\n for (var l = oppRng[0]; l < oppRng[1] + precision; l += precision) {\n line.push(coordFn(v, l));\n }\n }\n return {\n type: \"MultiLineString\",\n coordinates: coords\n };\n }\n function makeRangeBox(lon, lat) {\n var clipPad = constants.clipPad;\n var lon0 = lon[0] + clipPad;\n var lon1 = lon[1] - clipPad;\n var lat0 = lat[0] + clipPad;\n var lat1 = lat[1] - clipPad;\n if (lon0 > 0 && lon1 < 0) lon1 += 360;\n var dlon4 = (lon1 - lon0) / 4;\n return {\n type: \"Polygon\",\n coordinates: [[\n [lon0, lat0],\n [lon0, lat1],\n [lon0 + dlon4, lat1],\n [lon0 + 2 * dlon4, lat1],\n [lon0 + 3 * dlon4, lat1],\n [lon1, lat1],\n [lon1, lat0],\n [lon1 - dlon4, lat0],\n [lon1 - 2 * dlon4, lat0],\n [lon1 - 3 * dlon4, lat0],\n [lon0, lat0]\n ]]\n };\n }\n }\n });\n\n // src/plots/geo/layout_attributes.js\n var require_layout_attributes18 = __commonJS({\n \"src/plots/geo/layout_attributes.js\"(exports, module) {\n \"use strict\";\n var colorAttrs = require_attributes3();\n var domainAttrs = require_domain().attributes;\n var dash = require_attributes4().dash;\n var constants = require_constants22();\n var overrideAll = require_edit_types().overrideAll;\n var sortObjectKeys = require_sort_object_keys();\n var geoAxesAttrs = {\n range: {\n valType: \"info_array\",\n items: [\n { valType: \"number\" },\n { valType: \"number\" }\n ]\n },\n showgrid: {\n valType: \"boolean\",\n dflt: false\n },\n tick0: {\n valType: \"number\",\n dflt: 0\n },\n dtick: {\n valType: \"number\"\n },\n gridcolor: {\n valType: \"color\",\n dflt: colorAttrs.lightLine\n },\n gridwidth: {\n valType: \"number\",\n min: 0,\n dflt: 1\n },\n griddash: dash\n };\n var attrs = module.exports = overrideAll({\n domain: domainAttrs({ name: \"geo\" }, {}),\n fitbounds: {\n valType: \"enumerated\",\n values: [false, \"locations\", \"geojson\"],\n dflt: false,\n editType: \"plot\"\n },\n resolution: {\n valType: \"enumerated\",\n values: [110, 50],\n dflt: 110,\n coerceNumber: true\n },\n scope: {\n valType: \"enumerated\",\n values: sortObjectKeys(constants.scopeDefaults),\n dflt: \"world\"\n },\n projection: {\n type: {\n valType: \"enumerated\",\n values: sortObjectKeys(constants.projNames)\n },\n rotation: {\n lon: {\n valType: \"number\"\n },\n lat: {\n valType: \"number\"\n },\n roll: {\n valType: \"number\"\n }\n },\n tilt: {\n valType: \"number\",\n dflt: 0\n },\n distance: {\n valType: \"number\",\n min: 1.001,\n dflt: 2\n },\n parallels: {\n valType: \"info_array\",\n items: [\n { valType: \"number\" },\n { valType: \"number\" }\n ]\n },\n scale: {\n valType: \"number\",\n min: 0,\n dflt: 1\n }\n },\n center: {\n lon: {\n valType: \"number\"\n },\n lat: {\n valType: \"number\"\n }\n },\n visible: {\n valType: \"boolean\",\n dflt: true\n },\n showcoastlines: {\n valType: \"boolean\"\n },\n coastlinecolor: {\n valType: \"color\",\n dflt: colorAttrs.defaultLine\n },\n coastlinewidth: {\n valType: \"number\",\n min: 0,\n dflt: 1\n },\n showland: {\n valType: \"boolean\",\n dflt: false\n },\n landcolor: {\n valType: \"color\",\n dflt: constants.landColor\n },\n showocean: {\n valType: \"boolean\",\n dflt: false\n },\n oceancolor: {\n valType: \"color\",\n dflt: constants.waterColor\n },\n showlakes: {\n valType: \"boolean\",\n dflt: false\n },\n lakecolor: {\n valType: \"color\",\n dflt: constants.waterColor\n },\n showrivers: {\n valType: \"boolean\",\n dflt: false\n },\n rivercolor: {\n valType: \"color\",\n dflt: constants.waterColor\n },\n riverwidth: {\n valType: \"number\",\n min: 0,\n dflt: 1\n },\n showcountries: {\n valType: \"boolean\"\n },\n countrycolor: {\n valType: \"color\",\n dflt: colorAttrs.defaultLine\n },\n countrywidth: {\n valType: \"number\",\n min: 0,\n dflt: 1\n },\n showsubunits: {\n valType: \"boolean\"\n },\n subunitcolor: {\n valType: \"color\",\n dflt: colorAttrs.defaultLine\n },\n subunitwidth: {\n valType: \"number\",\n min: 0,\n dflt: 1\n },\n showframe: {\n valType: \"boolean\"\n },\n framecolor: {\n valType: \"color\",\n dflt: colorAttrs.defaultLine\n },\n framewidth: {\n valType: \"number\",\n min: 0,\n dflt: 1\n },\n bgcolor: {\n valType: \"color\",\n dflt: colorAttrs.background\n },\n lonaxis: geoAxesAttrs,\n lataxis: geoAxesAttrs\n }, \"plot\", \"from-root\");\n attrs.uirevision = {\n valType: \"any\",\n editType: \"none\"\n };\n }\n });\n\n // src/plots/geo/layout_defaults.js\n var require_layout_defaults16 = __commonJS({\n \"src/plots/geo/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleSubplotDefaults = require_subplot_defaults();\n var getSubplotData = require_get_data().getSubplotData;\n var constants = require_constants22();\n var layoutAttributes = require_layout_attributes18();\n var axesNames = constants.axesNames;\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {\n handleSubplotDefaults(layoutIn, layoutOut, fullData, {\n type: \"geo\",\n attributes: layoutAttributes,\n handleDefaults: handleGeoDefaults,\n fullData,\n partition: \"y\"\n });\n };\n function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce, opts) {\n var subplotData = getSubplotData(opts.fullData, \"geo\", opts.id);\n var traceIndices = subplotData.map(function(t) {\n return t.index;\n });\n var resolution = coerce(\"resolution\");\n var scope = coerce(\"scope\");\n var scopeParams = constants.scopeDefaults[scope];\n var projType = coerce(\"projection.type\", scopeParams.projType);\n var isAlbersUsa = geoLayoutOut._isAlbersUsa = projType === \"albers usa\";\n if (isAlbersUsa) scope = geoLayoutOut.scope = \"usa\";\n var isScoped = geoLayoutOut._isScoped = scope !== \"world\";\n var isSatellite = geoLayoutOut._isSatellite = projType === \"satellite\";\n var isConic = geoLayoutOut._isConic = projType.indexOf(\"conic\") !== -1 || projType === \"albers\";\n var isClipped = geoLayoutOut._isClipped = !!constants.lonaxisSpan[projType];\n if (geoLayoutIn.visible === false) {\n var newTemplate = Lib.extendDeep({}, geoLayoutOut._template);\n newTemplate.showcoastlines = false;\n newTemplate.showcountries = false;\n newTemplate.showframe = false;\n newTemplate.showlakes = false;\n newTemplate.showland = false;\n newTemplate.showocean = false;\n newTemplate.showrivers = false;\n newTemplate.showsubunits = false;\n if (newTemplate.lonaxis) newTemplate.lonaxis.showgrid = false;\n if (newTemplate.lataxis) newTemplate.lataxis.showgrid = false;\n geoLayoutOut._template = newTemplate;\n }\n var visible = coerce(\"visible\");\n var show;\n for (var i = 0; i < axesNames.length; i++) {\n var axisName = axesNames[i];\n var dtickDflt = [30, 10][i];\n var rangeDflt;\n if (isScoped) {\n rangeDflt = scopeParams[axisName + \"Range\"];\n } else {\n var dfltSpans = constants[axisName + \"Span\"];\n var hSpan = (dfltSpans[projType] || dfltSpans[\"*\"]) / 2;\n var rot = coerce(\n \"projection.rotation.\" + axisName.substr(0, 3),\n scopeParams.projRotate[i]\n );\n rangeDflt = [rot - hSpan, rot + hSpan];\n }\n var range = coerce(axisName + \".range\", rangeDflt);\n coerce(axisName + \".tick0\");\n coerce(axisName + \".dtick\", dtickDflt);\n show = coerce(axisName + \".showgrid\", !visible ? false : void 0);\n if (show) {\n coerce(axisName + \".gridcolor\");\n coerce(axisName + \".gridwidth\");\n coerce(axisName + \".griddash\");\n }\n geoLayoutOut[axisName]._ax = {\n type: \"linear\",\n _id: axisName.slice(0, 3),\n _traceIndices: traceIndices,\n setScale: Lib.identity,\n c2l: Lib.identity,\n r2l: Lib.identity,\n autorange: true,\n range: range.slice(),\n _m: 1,\n _input: {}\n };\n }\n var lonRange = geoLayoutOut.lonaxis.range;\n var latRange = geoLayoutOut.lataxis.range;\n var lon0 = lonRange[0];\n var lon1 = lonRange[1];\n if (lon0 > 0 && lon1 < 0) lon1 += 360;\n var centerLon = (lon0 + lon1) / 2;\n var projLon;\n if (!isAlbersUsa) {\n var dfltProjRotate = isScoped ? scopeParams.projRotate : [centerLon, 0, 0];\n projLon = coerce(\"projection.rotation.lon\", dfltProjRotate[0]);\n coerce(\"projection.rotation.lat\", dfltProjRotate[1]);\n coerce(\"projection.rotation.roll\", dfltProjRotate[2]);\n show = coerce(\"showcoastlines\", !isScoped && visible);\n if (show) {\n coerce(\"coastlinecolor\");\n coerce(\"coastlinewidth\");\n }\n show = coerce(\"showocean\", !visible ? false : void 0);\n if (show) coerce(\"oceancolor\");\n }\n var centerLonDflt;\n var centerLatDflt;\n if (isAlbersUsa) {\n centerLonDflt = -96.6;\n centerLatDflt = 38.7;\n } else {\n centerLonDflt = isScoped ? centerLon : projLon;\n centerLatDflt = (latRange[0] + latRange[1]) / 2;\n }\n coerce(\"center.lon\", centerLonDflt);\n coerce(\"center.lat\", centerLatDflt);\n if (isSatellite) {\n coerce(\"projection.tilt\");\n coerce(\"projection.distance\");\n }\n if (isConic) {\n var dfltProjParallels = scopeParams.projParallels || [0, 60];\n coerce(\"projection.parallels\", dfltProjParallels);\n }\n coerce(\"projection.scale\");\n show = coerce(\"showland\", !visible ? false : void 0);\n if (show) coerce(\"landcolor\");\n show = coerce(\"showlakes\", !visible ? false : void 0);\n if (show) coerce(\"lakecolor\");\n show = coerce(\"showrivers\", !visible ? false : void 0);\n if (show) {\n coerce(\"rivercolor\");\n coerce(\"riverwidth\");\n }\n show = coerce(\"showcountries\", isScoped && scope !== \"usa\" && visible);\n if (show) {\n coerce(\"countrycolor\");\n coerce(\"countrywidth\");\n }\n if (scope === \"usa\" || scope === \"north america\" && resolution === 50) {\n coerce(\"showsubunits\", visible);\n coerce(\"subunitcolor\");\n coerce(\"subunitwidth\");\n }\n if (!isScoped) {\n show = coerce(\"showframe\", visible);\n if (show) {\n coerce(\"framecolor\");\n coerce(\"framewidth\");\n }\n }\n coerce(\"bgcolor\");\n var fitBounds = coerce(\"fitbounds\");\n if (fitBounds) {\n delete geoLayoutOut.projection.scale;\n if (isScoped) {\n delete geoLayoutOut.center.lon;\n delete geoLayoutOut.center.lat;\n } else if (isClipped) {\n delete geoLayoutOut.center.lon;\n delete geoLayoutOut.center.lat;\n delete geoLayoutOut.projection.rotation.lon;\n delete geoLayoutOut.projection.rotation.lat;\n delete geoLayoutOut.lonaxis.range;\n delete geoLayoutOut.lataxis.range;\n } else {\n delete geoLayoutOut.center.lon;\n delete geoLayoutOut.center.lat;\n delete geoLayoutOut.projection.rotation.lon;\n }\n }\n }\n }\n });\n\n // src/plots/geo/index.js\n var require_geo2 = __commonJS({\n \"src/plots/geo/index.js\"(exports, module) {\n \"use strict\";\n var getSubplotCalcData = require_get_data().getSubplotCalcData;\n var counterRegex = require_lib().counterRegex;\n var createGeo = require_geo();\n var GEO = \"geo\";\n var counter = counterRegex(GEO);\n var attributes = {};\n attributes[GEO] = {\n valType: \"subplotid\",\n dflt: GEO,\n editType: \"calc\"\n };\n function plotGeo(gd) {\n var fullLayout = gd._fullLayout;\n var calcData = gd.calcdata;\n var geoIds = fullLayout._subplots[GEO];\n for (var i = 0; i < geoIds.length; i++) {\n var geoId = geoIds[i];\n var geoCalcData = getSubplotCalcData(calcData, GEO, geoId);\n var geoLayout = fullLayout[geoId];\n var geo = geoLayout._subplot;\n if (!geo) {\n geo = createGeo({\n id: geoId,\n graphDiv: gd,\n container: fullLayout._geolayer.node(),\n topojsonURL: gd._context.topojsonURL,\n staticPlot: gd._context.staticPlot\n });\n fullLayout[geoId]._subplot = geo;\n }\n geo.plot(geoCalcData, fullLayout, gd._promises);\n }\n }\n function clean(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var oldGeoKeys = oldFullLayout._subplots[GEO] || [];\n for (var i = 0; i < oldGeoKeys.length; i++) {\n var oldGeoKey = oldGeoKeys[i];\n var oldGeo = oldFullLayout[oldGeoKey]._subplot;\n if (!newFullLayout[oldGeoKey] && !!oldGeo) {\n oldGeo.framework.remove();\n oldGeo.clipDef.remove();\n }\n }\n }\n function updateFx(gd) {\n var fullLayout = gd._fullLayout;\n var subplotIds = fullLayout._subplots[GEO];\n for (var i = 0; i < subplotIds.length; i++) {\n var subplotLayout = fullLayout[subplotIds[i]];\n var subplotObj = subplotLayout._subplot;\n subplotObj.updateFx(fullLayout, subplotLayout);\n }\n }\n module.exports = {\n attr: GEO,\n name: GEO,\n idRoot: GEO,\n idRegex: counter,\n attrRegex: counter,\n attributes,\n layoutAttributes: require_layout_attributes18(),\n supplyLayoutDefaults: require_layout_defaults16(),\n plot: plotGeo,\n updateFx,\n clean\n };\n }\n });\n\n // src/traces/scattergeo/index.js\n var require_scattergeo = __commonJS({\n \"src/traces/scattergeo/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes48(),\n supplyDefaults: require_defaults44(),\n colorbar: require_marker_colorbar(),\n formatLabels: require_format_labels3(),\n calc: require_calc27(),\n calcGeoJSON: require_plot17().calcGeoJSON,\n plot: require_plot17().plot,\n style: require_style17(),\n styleOnSelect: require_style2().styleOnSelect,\n hoverPoints: require_hover14(),\n eventData: require_event_data9(),\n selectPoints: require_select5(),\n moduleType: \"trace\",\n name: \"scattergeo\",\n basePlotModule: require_geo2(),\n categories: [\"geo\", \"symbols\", \"showLegend\", \"scatter-like\"],\n meta: {}\n };\n }\n });\n\n // lib/scattergeo.js\n var require_scattergeo2 = __commonJS({\n \"lib/scattergeo.js\"(exports, module) {\n \"use strict\";\n module.exports = require_scattergeo();\n }\n });\n\n // src/traces/choropleth/attributes.js\n var require_attributes49 = __commonJS({\n \"src/traces/choropleth/attributes.js\"(exports, module) {\n \"use strict\";\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var scatterGeoAttrs = require_attributes48();\n var colorScaleAttrs = require_attributes8();\n var baseAttrs = require_attributes2();\n var defaultLine = require_attributes3().defaultLine;\n var extendFlat = require_extend().extendFlat;\n var scatterGeoMarkerLineAttrs = scatterGeoAttrs.marker.line;\n module.exports = extendFlat(\n {\n locations: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n locationmode: scatterGeoAttrs.locationmode,\n z: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n geojson: extendFlat({}, scatterGeoAttrs.geojson, {}),\n featureidkey: scatterGeoAttrs.featureidkey,\n text: extendFlat({}, scatterGeoAttrs.text, {}),\n hovertext: extendFlat({}, scatterGeoAttrs.hovertext, {}),\n marker: {\n line: {\n color: extendFlat({}, scatterGeoMarkerLineAttrs.color, { dflt: defaultLine }),\n width: extendFlat({}, scatterGeoMarkerLineAttrs.width, { dflt: 1 }),\n editType: \"calc\"\n },\n opacity: {\n valType: \"number\",\n arrayOk: true,\n min: 0,\n max: 1,\n dflt: 1,\n editType: \"style\"\n },\n editType: \"calc\"\n },\n selected: {\n marker: {\n opacity: scatterGeoAttrs.selected.marker.opacity,\n editType: \"plot\"\n },\n editType: \"plot\"\n },\n unselected: {\n marker: {\n opacity: scatterGeoAttrs.unselected.marker.opacity,\n editType: \"plot\"\n },\n editType: \"plot\"\n },\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n editType: \"calc\",\n flags: [\"location\", \"z\", \"text\", \"name\"]\n }),\n hovertemplate: hovertemplateAttrs(),\n showlegend: extendFlat({}, baseAttrs.showlegend, { dflt: false })\n },\n colorScaleAttrs(\"\", {\n cLetter: \"z\",\n editTypeOverride: \"calc\"\n })\n );\n }\n });\n\n // src/traces/choropleth/defaults.js\n var require_defaults45 = __commonJS({\n \"src/traces/choropleth/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var colorscaleDefaults = require_defaults2();\n var attributes = require_attributes49();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var locations = coerce(\"locations\");\n var z = coerce(\"z\");\n if (!(locations && locations.length && Lib.isArrayOrTypedArray(z) && z.length)) {\n traceOut.visible = false;\n return;\n }\n traceOut._length = Math.min(locations.length, z.length);\n var geojson = coerce(\"geojson\");\n var locationmodeDflt;\n if (typeof geojson === \"string\" && geojson !== \"\" || Lib.isPlainObject(geojson)) {\n locationmodeDflt = \"geojson-id\";\n }\n var locationMode = coerce(\"locationmode\", locationmodeDflt);\n if (locationMode === \"geojson-id\") {\n coerce(\"featureidkey\");\n }\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n var mlw = coerce(\"marker.line.width\");\n if (mlw) coerce(\"marker.line.color\");\n coerce(\"marker.opacity\");\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"\", cLetter: \"z\" });\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n };\n }\n });\n\n // src/traces/choropleth/calc.js\n var require_calc28 = __commonJS({\n \"src/traces/choropleth/calc.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var BADNUM = require_numerical().BADNUM;\n var colorscaleCalc = require_calc();\n var arraysToCalcdata = require_arrays_to_calcdata();\n var calcSelection = require_calc_selection();\n function isNonBlankString(v) {\n return v && typeof v === \"string\";\n }\n module.exports = function calc(gd, trace) {\n var len = trace._length;\n var calcTrace = new Array(len);\n var isValidLoc;\n if (trace.geojson) {\n isValidLoc = function(v) {\n return isNonBlankString(v) || isNumeric(v);\n };\n } else {\n isValidLoc = isNonBlankString;\n }\n for (var i = 0; i < len; i++) {\n var calcPt = calcTrace[i] = {};\n var loc = trace.locations[i];\n var z = trace.z[i];\n if (isValidLoc(loc) && isNumeric(z)) {\n calcPt.loc = loc;\n calcPt.z = z;\n } else {\n calcPt.loc = null;\n calcPt.z = BADNUM;\n }\n calcPt.index = i;\n }\n arraysToCalcdata(calcTrace, trace);\n colorscaleCalc(gd, trace, {\n vals: trace.z,\n containerStr: \"\",\n cLetter: \"z\"\n });\n calcSelection(calcTrace, trace);\n return calcTrace;\n };\n }\n });\n\n // src/traces/choropleth/style.js\n var require_style18 = __commonJS({\n \"src/traces/choropleth/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Color2 = require_color();\n var Drawing = require_drawing();\n var Colorscale = require_colorscale();\n function style(gd, calcTrace) {\n if (calcTrace) styleTrace(gd, calcTrace);\n }\n function styleTrace(gd, calcTrace) {\n var trace = calcTrace[0].trace;\n var s = calcTrace[0].node3;\n var locs = s.selectAll(\".choroplethlocation\");\n var marker = trace.marker || {};\n var markerLine = marker.line || {};\n var sclFunc = Colorscale.makeColorScaleFuncFromTrace(trace);\n locs.each(function(d) {\n d3.select(this).attr(\"fill\", sclFunc(d.z)).call(Color2.stroke, d.mlc || markerLine.color).call(Drawing.dashLine, \"\", d.mlw || markerLine.width || 0).style(\"opacity\", marker.opacity);\n });\n Drawing.selectedPointStyle(locs, trace);\n }\n function styleOnSelect(gd, calcTrace) {\n var s = calcTrace[0].node3;\n var trace = calcTrace[0].trace;\n if (trace.selectedpoints) {\n Drawing.selectedPointStyle(s.selectAll(\".choroplethlocation\"), trace);\n } else {\n styleTrace(gd, calcTrace);\n }\n }\n module.exports = {\n style,\n styleOnSelect\n };\n }\n });\n\n // src/traces/choropleth/plot.js\n var require_plot18 = __commonJS({\n \"src/traces/choropleth/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var geoUtils = require_geo_location_utils();\n var getTopojsonFeatures = require_topojson_utils().getTopojsonFeatures;\n var findExtremes = require_autorange().findExtremes;\n var style = require_style18().style;\n function plot(gd, geo, calcData) {\n var choroplethLayer = geo.layers.backplot.select(\".choroplethlayer\");\n Lib.makeTraceGroups(choroplethLayer, calcData, \"trace choropleth\").each(function(calcTrace) {\n var sel = d3.select(this);\n var paths = sel.selectAll(\"path.choroplethlocation\").data(Lib.identity);\n paths.enter().append(\"path\").classed(\"choroplethlocation\", true);\n paths.exit().remove();\n style(gd, calcTrace);\n });\n }\n function calcGeoJSON(calcTrace, fullLayout) {\n var trace = calcTrace[0].trace;\n var geoLayout = fullLayout[trace.geo];\n var geo = geoLayout._subplot;\n var locationmode = trace.locationmode;\n var len = trace._length;\n var features = locationmode === \"geojson-id\" ? geoUtils.extractTraceFeature(calcTrace) : getTopojsonFeatures(trace, geo.topojson);\n var lonArray = [];\n var latArray = [];\n for (var i = 0; i < len; i++) {\n var calcPt = calcTrace[i];\n var feature = locationmode === \"geojson-id\" ? calcPt.fOut : geoUtils.locationToFeature(locationmode, calcPt.loc, features);\n if (feature) {\n calcPt.geojson = feature;\n calcPt.ct = feature.properties.ct;\n calcPt._polygons = geoUtils.feature2polygons(feature);\n var bboxFeature = geoUtils.computeBbox(feature);\n lonArray.push(bboxFeature[0], bboxFeature[2]);\n latArray.push(bboxFeature[1], bboxFeature[3]);\n } else {\n calcPt.geojson = null;\n }\n }\n if (geoLayout.fitbounds === \"geojson\" && locationmode === \"geojson-id\") {\n var bboxGeojson = geoUtils.computeBbox(geoUtils.getTraceGeojson(trace));\n lonArray = [bboxGeojson[0], bboxGeojson[2]];\n latArray = [bboxGeojson[1], bboxGeojson[3]];\n }\n var opts = { padded: true };\n trace._extremes.lon = findExtremes(geoLayout.lonaxis._ax, lonArray, opts);\n trace._extremes.lat = findExtremes(geoLayout.lataxis._ax, latArray, opts);\n }\n module.exports = {\n calcGeoJSON,\n plot\n };\n }\n });\n\n // src/traces/choropleth/hover.js\n var require_hover15 = __commonJS({\n \"src/traces/choropleth/hover.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n var attributes = require_attributes49();\n var fillText = require_lib().fillText;\n module.exports = function hoverPoints(pointData, xval, yval) {\n var cd = pointData.cd;\n var trace = cd[0].trace;\n var geo = pointData.subplot;\n var pt, i, j, isInside;\n var xy = [xval, yval];\n var altXy = [xval + 360, yval];\n for (i = 0; i < cd.length; i++) {\n pt = cd[i];\n isInside = false;\n if (pt._polygons) {\n for (j = 0; j < pt._polygons.length; j++) {\n if (pt._polygons[j].contains(xy)) {\n isInside = !isInside;\n }\n if (pt._polygons[j].contains(altXy)) {\n isInside = !isInside;\n }\n }\n if (isInside) break;\n }\n }\n if (!isInside || !pt) return;\n pointData.x0 = pointData.x1 = pointData.xa.c2p(pt.ct);\n pointData.y0 = pointData.y1 = pointData.ya.c2p(pt.ct);\n pointData.index = pt.index;\n pointData.location = pt.loc;\n pointData.z = pt.z;\n pointData.zLabel = Axes.tickText(geo.mockAxis, geo.mockAxis.c2l(pt.z), \"hover\").text;\n pointData.hovertemplate = pt.hovertemplate;\n makeHoverInfo(pointData, trace, pt);\n return [pointData];\n };\n function makeHoverInfo(pointData, trace, pt) {\n if (trace.hovertemplate) return;\n var hoverinfo = pt.hi || trace.hoverinfo;\n var loc = String(pt.loc);\n var parts = hoverinfo === \"all\" ? attributes.hoverinfo.flags : hoverinfo.split(\"+\");\n var hasName = parts.indexOf(\"name\") !== -1;\n var hasLocation = parts.indexOf(\"location\") !== -1;\n var hasZ = parts.indexOf(\"z\") !== -1;\n var hasText = parts.indexOf(\"text\") !== -1;\n var hasIdAsNameLabel = !hasName && hasLocation;\n var text = [];\n if (hasIdAsNameLabel) {\n pointData.nameOverride = loc;\n } else {\n if (hasName) pointData.nameOverride = trace.name;\n if (hasLocation) text.push(loc);\n }\n if (hasZ) {\n text.push(pointData.zLabel);\n }\n if (hasText) {\n fillText(pt, trace, text);\n }\n pointData.extraText = text.join(\"
    \");\n }\n }\n });\n\n // src/traces/choropleth/event_data.js\n var require_event_data10 = __commonJS({\n \"src/traces/choropleth/event_data.js\"(exports, module) {\n \"use strict\";\n module.exports = function eventData(out, pt, trace, cd, pointNumber) {\n out.location = pt.location;\n out.z = pt.z;\n var cdi = cd[pointNumber];\n if (cdi.fIn && cdi.fIn.properties) {\n out.properties = cdi.fIn.properties;\n }\n out.ct = cdi.ct;\n return out;\n };\n }\n });\n\n // src/traces/choropleth/select.js\n var require_select6 = __commonJS({\n \"src/traces/choropleth/select.js\"(exports, module) {\n \"use strict\";\n module.exports = function selectPoints(searchInfo, selectionTester) {\n var cd = searchInfo.cd;\n var xa = searchInfo.xaxis;\n var ya = searchInfo.yaxis;\n var selection = [];\n var i, di, ct, x, y;\n if (selectionTester === false) {\n for (i = 0; i < cd.length; i++) {\n cd[i].selected = 0;\n }\n } else {\n for (i = 0; i < cd.length; i++) {\n di = cd[i];\n ct = di.ct;\n if (!ct) continue;\n x = xa.c2p(ct);\n y = ya.c2p(ct);\n if (selectionTester.contains([x, y], null, i, searchInfo)) {\n selection.push({\n pointNumber: i,\n lon: ct[0],\n lat: ct[1]\n });\n di.selected = 1;\n } else {\n di.selected = 0;\n }\n }\n }\n return selection;\n };\n }\n });\n\n // src/traces/choropleth/index.js\n var require_choropleth = __commonJS({\n \"src/traces/choropleth/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes49(),\n supplyDefaults: require_defaults45(),\n colorbar: require_colorbar2(),\n calc: require_calc28(),\n calcGeoJSON: require_plot18().calcGeoJSON,\n plot: require_plot18().plot,\n style: require_style18().style,\n styleOnSelect: require_style18().styleOnSelect,\n hoverPoints: require_hover15(),\n eventData: require_event_data10(),\n selectPoints: require_select6(),\n moduleType: \"trace\",\n name: \"choropleth\",\n basePlotModule: require_geo2(),\n categories: [\"geo\", \"noOpacity\", \"showLegend\"],\n meta: {}\n };\n }\n });\n\n // lib/choropleth.js\n var require_choropleth2 = __commonJS({\n \"lib/choropleth.js\"(exports, module) {\n \"use strict\";\n module.exports = require_choropleth();\n }\n });\n\n // src/traces/scattergl/hover.js\n var require_hover16 = __commonJS({\n \"src/traces/scattergl/hover.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var Lib = require_lib();\n var getTraceColor = require_get_trace_color();\n function hoverPoints(pointData, xval, yval, hovermode) {\n var cd = pointData.cd;\n var stash = cd[0].t;\n var trace = cd[0].trace;\n var xa = pointData.xa;\n var ya = pointData.ya;\n var x = stash.x;\n var y = stash.y;\n var xpx = xa.c2p(xval);\n var ypx = ya.c2p(yval);\n var maxDistance = pointData.distance;\n var ids;\n if (stash.tree) {\n var xl = xa.p2c(xpx - maxDistance);\n var xr = xa.p2c(xpx + maxDistance);\n var yl = ya.p2c(ypx - maxDistance);\n var yr = ya.p2c(ypx + maxDistance);\n if (hovermode === \"x\") {\n ids = stash.tree.range(\n Math.min(xl, xr),\n Math.min(ya._rl[0], ya._rl[1]),\n Math.max(xl, xr),\n Math.max(ya._rl[0], ya._rl[1])\n );\n } else {\n ids = stash.tree.range(\n Math.min(xl, xr),\n Math.min(yl, yr),\n Math.max(xl, xr),\n Math.max(yl, yr)\n );\n }\n } else {\n ids = stash.ids;\n }\n var k, closestId, ptx, pty, i, dx, dy, dist, dxy;\n var minDist = maxDistance;\n if (hovermode === \"x\") {\n var xPeriod = !!trace.xperiodalignment;\n var yPeriod = !!trace.yperiodalignment;\n for (i = 0; i < ids.length; i++) {\n k = ids[i];\n ptx = x[k];\n dx = Math.abs(xa.c2p(ptx) - xpx);\n if (xPeriod) {\n var x0 = xa.c2p(trace._xStarts[k]);\n var x1 = xa.c2p(trace._xEnds[k]);\n dx = xpx >= Math.min(x0, x1) && xpx <= Math.max(x0, x1) ? 0 : Infinity;\n }\n if (dx < minDist) {\n minDist = dx;\n pty = y[k];\n dy = ya.c2p(pty) - ypx;\n if (yPeriod) {\n var y0 = ya.c2p(trace._yStarts[k]);\n var y1 = ya.c2p(trace._yEnds[k]);\n dy = ypx >= Math.min(y0, y1) && ypx <= Math.max(y0, y1) ? 0 : Infinity;\n }\n dxy = Math.sqrt(dx * dx + dy * dy);\n closestId = ids[i];\n }\n }\n } else {\n for (i = ids.length - 1; i > -1; i--) {\n k = ids[i];\n ptx = x[k];\n pty = y[k];\n dx = xa.c2p(ptx) - xpx;\n dy = ya.c2p(pty) - ypx;\n dist = Math.sqrt(dx * dx + dy * dy);\n if (dist < minDist) {\n minDist = dxy = dist;\n closestId = k;\n }\n }\n }\n pointData.index = closestId;\n pointData.distance = minDist;\n pointData.dxy = dxy;\n if (closestId === void 0) return [pointData];\n return [calcHover(pointData, x, y, trace)];\n }\n function calcHover(pointData, x, y, trace) {\n var xa = pointData.xa;\n var ya = pointData.ya;\n var minDist = pointData.distance;\n var dxy = pointData.dxy;\n var id = pointData.index;\n var di = {\n pointNumber: id,\n x: x[id],\n y: y[id]\n };\n di.tx = Lib.isArrayOrTypedArray(trace.text) ? trace.text[id] : trace.text;\n di.htx = Array.isArray(trace.hovertext) ? trace.hovertext[id] : trace.hovertext;\n di.data = Array.isArray(trace.customdata) ? trace.customdata[id] : trace.customdata;\n di.tp = Array.isArray(trace.textposition) ? trace.textposition[id] : trace.textposition;\n var font = trace.textfont;\n if (font) {\n di.ts = Lib.isArrayOrTypedArray(font.size) ? font.size[id] : font.size;\n di.tc = Lib.isArrayOrTypedArray(font.color) ? font.color[id] : font.color;\n di.tf = Array.isArray(font.family) ? font.family[id] : font.family;\n di.tw = Array.isArray(font.weight) ? font.weight[id] : font.weight;\n di.ty = Array.isArray(font.style) ? font.style[id] : font.style;\n di.tv = Array.isArray(font.variant) ? font.variant[id] : font.variant;\n }\n var marker = trace.marker;\n if (marker) {\n di.ms = Lib.isArrayOrTypedArray(marker.size) ? marker.size[id] : marker.size;\n di.mo = Lib.isArrayOrTypedArray(marker.opacity) ? marker.opacity[id] : marker.opacity;\n di.mx = Lib.isArrayOrTypedArray(marker.symbol) ? marker.symbol[id] : marker.symbol;\n di.ma = Lib.isArrayOrTypedArray(marker.angle) ? marker.angle[id] : marker.angle;\n di.mc = Lib.isArrayOrTypedArray(marker.color) ? marker.color[id] : marker.color;\n }\n var line = marker && marker.line;\n if (line) {\n di.mlc = Array.isArray(line.color) ? line.color[id] : line.color;\n di.mlw = Lib.isArrayOrTypedArray(line.width) ? line.width[id] : line.width;\n }\n var grad = marker && marker.gradient;\n if (grad && grad.type !== \"none\") {\n di.mgt = Array.isArray(grad.type) ? grad.type[id] : grad.type;\n di.mgc = Array.isArray(grad.color) ? grad.color[id] : grad.color;\n }\n var xp = xa.c2p(di.x, true);\n var yp = ya.c2p(di.y, true);\n var rad = di.mrc || 1;\n var hoverlabel = trace.hoverlabel;\n if (hoverlabel) {\n di.hbg = Array.isArray(hoverlabel.bgcolor) ? hoverlabel.bgcolor[id] : hoverlabel.bgcolor;\n di.hbc = Array.isArray(hoverlabel.bordercolor) ? hoverlabel.bordercolor[id] : hoverlabel.bordercolor;\n di.hts = Lib.isArrayOrTypedArray(hoverlabel.font.size) ? hoverlabel.font.size[id] : hoverlabel.font.size;\n di.htc = Array.isArray(hoverlabel.font.color) ? hoverlabel.font.color[id] : hoverlabel.font.color;\n di.htf = Array.isArray(hoverlabel.font.family) ? hoverlabel.font.family[id] : hoverlabel.font.family;\n di.hnl = Lib.isArrayOrTypedArray(hoverlabel.namelength) ? hoverlabel.namelength[id] : hoverlabel.namelength;\n }\n var hoverinfo = trace.hoverinfo;\n if (hoverinfo) {\n di.hi = Array.isArray(hoverinfo) ? hoverinfo[id] : hoverinfo;\n }\n var hovertemplate = trace.hovertemplate;\n if (hovertemplate) {\n di.ht = Array.isArray(hovertemplate) ? hovertemplate[id] : hovertemplate;\n }\n var fakeCd = {};\n fakeCd[pointData.index] = di;\n var origX = trace._origX;\n var origY = trace._origY;\n var pointData2 = Lib.extendFlat({}, pointData, {\n color: getTraceColor(trace, di),\n x0: xp - rad,\n x1: xp + rad,\n xLabelVal: origX ? origX[id] : di.x,\n y0: yp - rad,\n y1: yp + rad,\n yLabelVal: origY ? origY[id] : di.y,\n cd: fakeCd,\n distance: minDist,\n spikeDistance: dxy,\n hovertemplate: di.ht\n });\n if (di.htx) pointData2.text = di.htx;\n else if (di.tx) pointData2.text = di.tx;\n else if (trace.text) pointData2.text = trace.text;\n Lib.fillText(di, trace, pointData2);\n Registry.getComponentMethod(\"errorbars\", \"hoverInfo\")(di, trace, pointData2);\n return pointData2;\n }\n module.exports = {\n hoverPoints,\n calcHover\n };\n }\n });\n\n // src/traces/scattergl/constants.js\n var require_constants23 = __commonJS({\n \"src/traces/scattergl/constants.js\"(exports, module) {\n \"use strict\";\n var SYMBOL_SIZE = 20;\n module.exports = {\n TOO_MANY_POINTS: 1e5,\n SYMBOL_SDF_SIZE: 200,\n SYMBOL_SIZE,\n SYMBOL_STROKE: SYMBOL_SIZE / 20,\n DOT_RE: /-dot/,\n OPEN_RE: /-open/,\n DASHES: {\n solid: [1],\n dot: [1, 1],\n dash: [4, 1],\n longdash: [8, 1],\n dashdot: [4, 1, 1, 1],\n longdashdot: [8, 1, 1, 1]\n }\n };\n }\n });\n\n // src/traces/scattergl/attributes.js\n var require_attributes50 = __commonJS({\n \"src/traces/scattergl/attributes.js\"(exports, module) {\n \"use strict\";\n var baseAttrs = require_attributes2();\n var fontAttrs = require_font_attributes();\n var makeFillcolorAttr = require_fillcolor_attribute();\n var scatterAttrs = require_attributes12();\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var colorScaleAttrs = require_attributes8();\n var sortObjectKeys = require_sort_object_keys();\n var extendFlat = require_extend().extendFlat;\n var overrideAll = require_edit_types().overrideAll;\n var DASHES = require_constants23().DASHES;\n var scatterLineAttrs = scatterAttrs.line;\n var scatterMarkerAttrs = scatterAttrs.marker;\n var scatterMarkerLineAttrs = scatterMarkerAttrs.line;\n var attrs = module.exports = overrideAll({\n x: scatterAttrs.x,\n x0: scatterAttrs.x0,\n dx: scatterAttrs.dx,\n y: scatterAttrs.y,\n y0: scatterAttrs.y0,\n dy: scatterAttrs.dy,\n xperiod: scatterAttrs.xperiod,\n yperiod: scatterAttrs.yperiod,\n xperiod0: scatterAttrs.xperiod0,\n yperiod0: scatterAttrs.yperiod0,\n xperiodalignment: scatterAttrs.xperiodalignment,\n yperiodalignment: scatterAttrs.yperiodalignment,\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n text: scatterAttrs.text,\n hovertext: scatterAttrs.hovertext,\n textposition: scatterAttrs.textposition,\n textfont: fontAttrs({\n noFontShadow: true,\n noFontLineposition: true,\n noFontTextcase: true,\n editType: \"calc\",\n colorEditType: \"style\",\n arrayOk: true,\n noNumericWeightValues: true,\n variantValues: [\"normal\", \"small-caps\"]\n }),\n mode: {\n valType: \"flaglist\",\n flags: [\"lines\", \"markers\", \"text\"],\n extras: [\"none\"]\n },\n line: {\n color: scatterLineAttrs.color,\n width: scatterLineAttrs.width,\n shape: {\n valType: \"enumerated\",\n values: [\"linear\", \"hv\", \"vh\", \"hvh\", \"vhv\"],\n dflt: \"linear\",\n editType: \"plot\"\n },\n dash: {\n valType: \"enumerated\",\n values: sortObjectKeys(DASHES),\n dflt: \"solid\"\n }\n },\n marker: extendFlat({}, colorScaleAttrs(\"marker\"), {\n symbol: scatterMarkerAttrs.symbol,\n angle: scatterMarkerAttrs.angle,\n size: scatterMarkerAttrs.size,\n sizeref: scatterMarkerAttrs.sizeref,\n sizemin: scatterMarkerAttrs.sizemin,\n sizemode: scatterMarkerAttrs.sizemode,\n opacity: scatterMarkerAttrs.opacity,\n colorbar: scatterMarkerAttrs.colorbar,\n line: extendFlat({}, colorScaleAttrs(\"marker.line\"), {\n width: scatterMarkerLineAttrs.width\n })\n }),\n connectgaps: scatterAttrs.connectgaps,\n fill: extendFlat({}, scatterAttrs.fill, { dflt: \"none\" }),\n fillcolor: makeFillcolorAttr(),\n // no hoveron\n selected: {\n marker: scatterAttrs.selected.marker,\n textfont: scatterAttrs.selected.textfont\n },\n unselected: {\n marker: scatterAttrs.unselected.marker,\n textfont: scatterAttrs.unselected.textfont\n },\n opacity: baseAttrs.opacity\n }, \"calc\", \"nested\");\n attrs.x.editType = attrs.y.editType = attrs.x0.editType = attrs.y0.editType = \"calc+clearAxisTypes\";\n attrs.hovertemplate = scatterAttrs.hovertemplate;\n attrs.texttemplate = scatterAttrs.texttemplate;\n }\n });\n\n // src/traces/scattergl/helpers.js\n var require_helpers16 = __commonJS({\n \"src/traces/scattergl/helpers.js\"(exports) {\n \"use strict\";\n var constants = require_constants23();\n exports.isOpenSymbol = function(symbol) {\n return typeof symbol === \"string\" ? constants.OPEN_RE.test(symbol) : symbol % 200 > 100;\n };\n exports.isDotSymbol = function(symbol) {\n return typeof symbol === \"string\" ? constants.DOT_RE.test(symbol) : symbol > 200;\n };\n }\n });\n\n // src/traces/scattergl/defaults.js\n var require_defaults46 = __commonJS({\n \"src/traces/scattergl/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Registry = require_registry();\n var helpers = require_helpers16();\n var attributes = require_attributes50();\n var constants = require_constants8();\n var subTypes = require_subtypes();\n var handleXYDefaults = require_xy_defaults();\n var handlePeriodDefaults = require_period_defaults();\n var handleMarkerDefaults = require_marker_defaults();\n var handleLineDefaults = require_line_defaults();\n var handleFillColorDefaults = require_fillcolor_defaults();\n var handleTextDefaults = require_text_defaults();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var isOpen = traceIn.marker ? helpers.isOpenSymbol(traceIn.marker.symbol) : false;\n var isBubble = subTypes.isBubble(traceIn);\n var len = handleXYDefaults(traceIn, traceOut, layout, coerce);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n handlePeriodDefaults(traceIn, traceOut, layout, coerce);\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n var defaultMode = len < constants.PTS_LINESONLY ? \"lines+markers\" : \"lines\";\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n coerce(\"mode\", defaultMode);\n if (subTypes.hasMarkers(traceOut)) {\n handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, { noAngleRef: true, noStandOff: true });\n coerce(\"marker.line.width\", isOpen || isBubble ? 1 : 0);\n }\n if (subTypes.hasLines(traceOut)) {\n coerce(\"connectgaps\");\n handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce);\n coerce(\"line.shape\");\n }\n if (subTypes.hasText(traceOut)) {\n coerce(\"texttemplate\");\n handleTextDefaults(traceIn, traceOut, layout, coerce, {\n noFontShadow: true,\n noFontLineposition: true,\n noFontTextcase: true\n });\n }\n var lineColor = (traceOut.line || {}).color;\n var markerColor = (traceOut.marker || {}).color;\n coerce(\"fill\");\n if (traceOut.fill !== \"none\") {\n handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce);\n }\n var errorBarsSupplyDefaults = Registry.getComponentMethod(\"errorbars\", \"supplyDefaults\");\n errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, { axis: \"y\" });\n errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, { axis: \"x\", inherit: \"y\" });\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n };\n }\n });\n\n // src/traces/scattergl/format_labels.js\n var require_format_labels4 = __commonJS({\n \"src/traces/scattergl/format_labels.js\"(exports, module) {\n \"use strict\";\n var scatterFormatLabels = require_format_labels();\n module.exports = function formatLabels(cdi, trace, fullLayout) {\n var i = cdi.i;\n if (!(\"x\" in cdi)) cdi.x = trace._x[i];\n if (!(\"y\" in cdi)) cdi.y = trace._y[i];\n return scatterFormatLabels(cdi, trace, fullLayout);\n };\n }\n });\n\n // node_modules/binary-search-bounds/search-bounds.js\n var require_search_bounds = __commonJS({\n \"node_modules/binary-search-bounds/search-bounds.js\"(exports, module) {\n \"use strict\";\n function ge(a, y, c, l, h) {\n var i = h + 1;\n while (l <= h) {\n var m = l + h >>> 1, x = a[m];\n var p = c !== void 0 ? c(x, y) : x - y;\n if (p >= 0) {\n i = m;\n h = m - 1;\n } else {\n l = m + 1;\n }\n }\n return i;\n }\n function gt(a, y, c, l, h) {\n var i = h + 1;\n while (l <= h) {\n var m = l + h >>> 1, x = a[m];\n var p = c !== void 0 ? c(x, y) : x - y;\n if (p > 0) {\n i = m;\n h = m - 1;\n } else {\n l = m + 1;\n }\n }\n return i;\n }\n function lt(a, y, c, l, h) {\n var i = l - 1;\n while (l <= h) {\n var m = l + h >>> 1, x = a[m];\n var p = c !== void 0 ? c(x, y) : x - y;\n if (p < 0) {\n i = m;\n l = m + 1;\n } else {\n h = m - 1;\n }\n }\n return i;\n }\n function le(a, y, c, l, h) {\n var i = l - 1;\n while (l <= h) {\n var m = l + h >>> 1, x = a[m];\n var p = c !== void 0 ? c(x, y) : x - y;\n if (p <= 0) {\n i = m;\n l = m + 1;\n } else {\n h = m - 1;\n }\n }\n return i;\n }\n function eq(a, y, c, l, h) {\n while (l <= h) {\n var m = l + h >>> 1, x = a[m];\n var p = c !== void 0 ? c(x, y) : x - y;\n if (p === 0) {\n return m;\n }\n if (p <= 0) {\n l = m + 1;\n } else {\n h = m - 1;\n }\n }\n return -1;\n }\n function norm(a, y, c, l, h, f) {\n if (typeof c === \"function\") {\n return f(a, y, c, l === void 0 ? 0 : l | 0, h === void 0 ? a.length - 1 : h | 0);\n }\n return f(a, y, void 0, c === void 0 ? 0 : c | 0, l === void 0 ? a.length - 1 : l | 0);\n }\n module.exports = {\n ge: function(a, y, c, l, h) {\n return norm(a, y, c, l, h, ge);\n },\n gt: function(a, y, c, l, h) {\n return norm(a, y, c, l, h, gt);\n },\n lt: function(a, y, c, l, h) {\n return norm(a, y, c, l, h, lt);\n },\n le: function(a, y, c, l, h) {\n return norm(a, y, c, l, h, le);\n },\n eq: function(a, y, c, l, h) {\n return norm(a, y, c, l, h, eq);\n }\n };\n }\n });\n\n // node_modules/pick-by-alias/index.js\n var require_pick_by_alias = __commonJS({\n \"node_modules/pick-by-alias/index.js\"(exports, module) {\n \"use strict\";\n module.exports = function pick(src, props, keepRest) {\n var result = {}, prop, i;\n if (typeof props === \"string\") props = toList(props);\n if (Array.isArray(props)) {\n var res = {};\n for (i = 0; i < props.length; i++) {\n res[props[i]] = true;\n }\n props = res;\n }\n for (prop in props) {\n props[prop] = toList(props[prop]);\n }\n var occupied = {};\n for (prop in props) {\n var aliases = props[prop];\n if (Array.isArray(aliases)) {\n for (i = 0; i < aliases.length; i++) {\n var alias = aliases[i];\n if (keepRest) {\n occupied[alias] = true;\n }\n if (alias in src) {\n result[prop] = src[alias];\n if (keepRest) {\n for (var j = i; j < aliases.length; j++) {\n occupied[aliases[j]] = true;\n }\n }\n break;\n }\n }\n } else if (prop in src) {\n if (props[prop]) {\n result[prop] = src[prop];\n }\n if (keepRest) {\n occupied[prop] = true;\n }\n }\n }\n if (keepRest) {\n for (prop in src) {\n if (occupied[prop]) continue;\n result[prop] = src[prop];\n }\n }\n return result;\n };\n var CACHE = {};\n function toList(arg) {\n if (CACHE[arg]) return CACHE[arg];\n if (typeof arg === \"string\") {\n arg = CACHE[arg] = arg.split(/\\s*,\\s*|\\s+/);\n }\n return arg;\n }\n }\n });\n\n // node_modules/parse-rect/index.js\n var require_parse_rect = __commonJS({\n \"node_modules/parse-rect/index.js\"(exports, module) {\n \"use strict\";\n var pick = require_pick_by_alias();\n module.exports = parseRect;\n function parseRect(arg) {\n var rect;\n if (arguments.length > 1) {\n arg = arguments;\n }\n if (typeof arg === \"string\") {\n arg = arg.split(/\\s/).map(parseFloat);\n } else if (typeof arg === \"number\") {\n arg = [arg];\n }\n if (arg.length && typeof arg[0] === \"number\") {\n if (arg.length === 1) {\n rect = {\n width: arg[0],\n height: arg[0],\n x: 0,\n y: 0\n };\n } else if (arg.length === 2) {\n rect = {\n width: arg[0],\n height: arg[1],\n x: 0,\n y: 0\n };\n } else {\n rect = {\n x: arg[0],\n y: arg[1],\n width: arg[2] - arg[0] || 0,\n height: arg[3] - arg[1] || 0\n };\n }\n } else if (arg) {\n arg = pick(arg, {\n left: \"x l left Left\",\n top: \"y t top Top\",\n width: \"w width W Width\",\n height: \"h height W Width\",\n bottom: \"b bottom Bottom\",\n right: \"r right Right\"\n });\n rect = {\n x: arg.left || 0,\n y: arg.top || 0\n };\n if (arg.width == null) {\n if (arg.right) rect.width = arg.right - rect.x;\n else rect.width = 0;\n } else {\n rect.width = arg.width;\n }\n if (arg.height == null) {\n if (arg.bottom) rect.height = arg.bottom - rect.y;\n else rect.height = 0;\n } else {\n rect.height = arg.height;\n }\n }\n return rect;\n }\n }\n });\n\n // node_modules/array-bounds/index.js\n var require_array_bounds = __commonJS({\n \"node_modules/array-bounds/index.js\"(exports, module) {\n \"use strict\";\n module.exports = normalize;\n function normalize(arr, dim) {\n if (!arr || arr.length == null) throw Error(\"Argument should be an array\");\n if (dim == null) dim = 1;\n else dim = Math.floor(dim);\n var bounds = Array(dim * 2);\n for (var offset = 0; offset < dim; offset++) {\n var max = -Infinity, min = Infinity, i = offset, l = arr.length;\n for (; i < l; i += dim) {\n if (arr[i] > max) max = arr[i];\n if (arr[i] < min) min = arr[i];\n }\n bounds[offset] = min;\n bounds[dim + offset] = max;\n }\n return bounds;\n }\n }\n });\n\n // node_modules/defined/index.js\n var require_defined = __commonJS({\n \"node_modules/defined/index.js\"(exports, module) {\n module.exports = function() {\n for (var i = 0; i < arguments.length; i++) {\n if (arguments[i] !== void 0) return arguments[i];\n }\n };\n }\n });\n\n // node_modules/flatten-vertex-data/index.js\n var require_flatten_vertex_data = __commonJS({\n \"node_modules/flatten-vertex-data/index.js\"(exports, module) {\n var dtype = require_dtype();\n module.exports = flattenVertexData;\n function flattenVertexData(data, output, offset) {\n if (!data) throw new TypeError(\"must specify data as first parameter\");\n offset = +(offset || 0) | 0;\n if (Array.isArray(data) && (data[0] && typeof data[0][0] === \"number\")) {\n var dim = data[0].length;\n var length = data.length * dim;\n var i, j, k, l;\n if (!output || typeof output === \"string\") {\n output = new (dtype(output || \"float32\"))(length + offset);\n }\n var dstLength = output.length - offset;\n if (length !== dstLength) {\n throw new Error(\"source length \" + length + \" (\" + dim + \"x\" + data.length + \") does not match destination length \" + dstLength);\n }\n for (i = 0, k = offset; i < data.length; i++) {\n for (j = 0; j < dim; j++) {\n output[k++] = data[i][j] === null ? NaN : data[i][j];\n }\n }\n } else {\n if (!output || typeof output === \"string\") {\n var Ctor = dtype(output || \"float32\");\n if (Array.isArray(data) || output === \"array\") {\n output = new Ctor(data.length + offset);\n for (i = 0, k = offset, l = output.length; k < l; k++, i++) {\n output[k] = data[i] === null ? NaN : data[i];\n }\n } else {\n if (offset === 0) {\n output = new Ctor(data);\n } else {\n output = new Ctor(data.length + offset);\n output.set(data, offset);\n }\n }\n } else {\n output.set(data, offset);\n }\n }\n return output;\n }\n }\n });\n\n // node_modules/is-obj/index.js\n var require_is_obj = __commonJS({\n \"node_modules/is-obj/index.js\"(exports, module) {\n \"use strict\";\n module.exports = function(x) {\n var type = typeof x;\n return x !== null && (type === \"object\" || type === \"function\");\n };\n }\n });\n\n // node_modules/math-log2/index.js\n var require_math_log2 = __commonJS({\n \"node_modules/math-log2/index.js\"(exports, module) {\n \"use strict\";\n module.exports = Math.log2 || function(x) {\n return Math.log(x) * Math.LOG2E;\n };\n }\n });\n\n // node_modules/@plotly/point-cluster/quad.js\n var require_quad = __commonJS({\n \"node_modules/@plotly/point-cluster/quad.js\"(exports, module) {\n \"use strict\";\n var search = require_search_bounds();\n var clamp = require_clamp();\n var rect = require_parse_rect();\n var getBounds = require_array_bounds();\n var pick = require_pick_by_alias();\n var defined = require_defined();\n var flatten = require_flatten_vertex_data();\n var isObj = require_is_obj();\n var dtype = require_dtype();\n var log2 = require_math_log2();\n var MAX_GROUP_ID = 1073741824;\n module.exports = function cluster(srcPoints, options) {\n if (!options) options = {};\n srcPoints = flatten(srcPoints, \"float64\");\n options = pick(options, {\n bounds: \"range bounds dataBox databox\",\n maxDepth: \"depth maxDepth maxdepth level maxLevel maxlevel levels\",\n dtype: \"type dtype format out dst output destination\"\n // sort: 'sortBy sortby sort',\n // pick: 'pick levelPoint',\n // nodeSize: 'node nodeSize minNodeSize minSize size'\n });\n let maxDepth = defined(options.maxDepth, 255);\n let bounds = defined(options.bounds, getBounds(srcPoints, 2));\n if (bounds[0] === bounds[2]) bounds[2]++;\n if (bounds[1] === bounds[3]) bounds[3]++;\n let points = normalize(srcPoints, bounds);\n let n = srcPoints.length >>> 1;\n let ids;\n if (!options.dtype) options.dtype = \"array\";\n if (typeof options.dtype === \"string\") {\n ids = new (dtype(options.dtype))(n);\n } else if (options.dtype) {\n ids = options.dtype;\n if (Array.isArray(ids)) ids.length = n;\n }\n for (let i = 0; i < n; ++i) {\n ids[i] = i;\n }\n let levels = [];\n let sublevels = [];\n let groups = [];\n let offsets = [];\n sort(0, 0, 1, ids, 0, 1);\n let offset = 0;\n for (let level = 0; level < levels.length; level++) {\n let levelItems = levels[level];\n if (ids.set) ids.set(levelItems, offset);\n else {\n for (let i = 0, l = levelItems.length; i < l; i++) {\n ids[i + offset] = levelItems[i];\n }\n }\n let nextOffset = offset + levels[level].length;\n offsets[level] = [offset, nextOffset];\n offset = nextOffset;\n }\n ids.range = range;\n return ids;\n function sort(x, y, diam, ids2, level, group2) {\n if (!ids2.length) return null;\n let levelItems = levels[level] || (levels[level] = []);\n let levelGroups = groups[level] || (groups[level] = []);\n let sublevel = sublevels[level] || (sublevels[level] = []);\n let offset2 = levelItems.length;\n level++;\n if (level > maxDepth || group2 > MAX_GROUP_ID) {\n for (let i = 0; i < ids2.length; i++) {\n levelItems.push(ids2[i]);\n levelGroups.push(group2);\n sublevel.push(null, null, null, null);\n }\n return offset2;\n }\n levelItems.push(ids2[0]);\n levelGroups.push(group2);\n if (ids2.length <= 1) {\n sublevel.push(null, null, null, null);\n return offset2;\n }\n let d2 = diam * 0.5;\n let cx = x + d2, cy = y + d2;\n let lolo = [], lohi = [], hilo = [], hihi = [];\n for (let i = 1, l = ids2.length; i < l; i++) {\n let idx = ids2[i], x2 = points[idx * 2], y2 = points[idx * 2 + 1];\n x2 < cx ? y2 < cy ? lolo.push(idx) : lohi.push(idx) : y2 < cy ? hilo.push(idx) : hihi.push(idx);\n }\n group2 <<= 2;\n sublevel.push(\n sort(x, y, d2, lolo, level, group2),\n sort(x, cy, d2, lohi, level, group2 + 1),\n sort(cx, y, d2, hilo, level, group2 + 2),\n sort(cx, cy, d2, hihi, level, group2 + 3)\n );\n return offset2;\n }\n function range(...args) {\n let options2;\n if (isObj(args[args.length - 1])) {\n let arg = args.pop();\n if (!args.length && (arg.x != null || arg.l != null || arg.left != null)) {\n args = [arg];\n options2 = {};\n }\n options2 = pick(arg, {\n level: \"level maxLevel\",\n d: \"d diam diameter r radius px pxSize pixel pixelSize maxD size minSize\",\n lod: \"lod details ranges offsets\"\n });\n } else {\n options2 = {};\n }\n if (!args.length) args = bounds;\n let box = rect(...args);\n let [minX, minY, maxX, maxY] = [\n Math.min(box.x, box.x + box.width),\n Math.min(box.y, box.y + box.height),\n Math.max(box.x, box.x + box.width),\n Math.max(box.y, box.y + box.height)\n ];\n let [nminX, nminY, nmaxX, nmaxY] = normalize([minX, minY, maxX, maxY], bounds);\n let maxLevel = defined(options2.level, levels.length);\n if (options2.d != null) {\n let d;\n if (typeof options2.d === \"number\") d = [options2.d, options2.d];\n else if (options2.d.length) d = options2.d;\n maxLevel = Math.min(\n Math.max(\n Math.ceil(-log2(Math.abs(d[0]) / (bounds[2] - bounds[0]))),\n Math.ceil(-log2(Math.abs(d[1]) / (bounds[3] - bounds[1])))\n ),\n maxLevel\n );\n }\n maxLevel = Math.min(maxLevel, levels.length);\n if (options2.lod) {\n return lod(nminX, nminY, nmaxX, nmaxY, maxLevel);\n }\n let selection = [];\n select(0, 0, 1, 0, 0, 1);\n function select(lox, loy, d, level, from, to) {\n if (from === null || to === null) return;\n let hix = lox + d;\n let hiy = loy + d;\n if (nminX > hix || nminY > hiy || nmaxX < lox || nmaxY < loy) return;\n if (level >= maxLevel) return;\n if (from === to) return;\n let levelItems = levels[level];\n if (to === void 0) to = levelItems.length;\n for (let i = from; i < to; i++) {\n let id = levelItems[i];\n let px = srcPoints[id * 2];\n let py = srcPoints[id * 2 + 1];\n if (px >= minX && px <= maxX && py >= minY && py <= maxY) {\n selection.push(id);\n }\n }\n let offsets2 = sublevels[level];\n let off0 = offsets2[from * 4 + 0];\n let off1 = offsets2[from * 4 + 1];\n let off2 = offsets2[from * 4 + 2];\n let off3 = offsets2[from * 4 + 3];\n let end = nextOffset(offsets2, from + 1);\n let d2 = d * 0.5;\n let nextLevel = level + 1;\n select(lox, loy, d2, nextLevel, off0, off1 || off2 || off3 || end);\n select(lox, loy + d2, d2, nextLevel, off1, off2 || off3 || end);\n select(lox + d2, loy, d2, nextLevel, off2, off3 || end);\n select(lox + d2, loy + d2, d2, nextLevel, off3, end);\n }\n function nextOffset(offsets2, from) {\n let offset2 = null, i = 0;\n while (offset2 === null) {\n offset2 = offsets2[from * 4 + i];\n i++;\n if (i > offsets2.length) return null;\n }\n return offset2;\n }\n return selection;\n }\n function lod(lox, loy, hix, hiy, maxLevel) {\n let ranges = [];\n for (let level = 0; level < maxLevel; level++) {\n let levelGroups = groups[level];\n let from = offsets[level][0];\n let levelGroupStart = group(lox, loy, level);\n let levelGroupEnd = group(hix, hiy, level);\n let startOffset = search.ge(levelGroups, levelGroupStart);\n let endOffset = search.gt(levelGroups, levelGroupEnd, startOffset, levelGroups.length - 1);\n ranges[level] = [startOffset + from, endOffset + from];\n }\n return ranges;\n }\n function group(x, y, level) {\n let group2 = 1;\n let cx = 0.5, cy = 0.5;\n let diam = 0.5;\n for (let i = 0; i < level; i++) {\n group2 <<= 2;\n group2 += x < cx ? y < cy ? 0 : 1 : y < cy ? 2 : 3;\n diam *= 0.5;\n cx += x < cx ? -diam : diam;\n cy += y < cy ? -diam : diam;\n }\n return group2;\n }\n };\n function normalize(pts, bounds) {\n let [lox, loy, hix, hiy] = bounds;\n let scaleX = 1 / (hix - lox);\n let scaleY = 1 / (hiy - loy);\n let result = new Array(pts.length);\n for (let i = 0, n = pts.length / 2; i < n; i++) {\n result[2 * i] = clamp((pts[2 * i] - lox) * scaleX, 0, 1);\n result[2 * i + 1] = clamp((pts[2 * i + 1] - loy) * scaleY, 0, 1);\n }\n return result;\n }\n }\n });\n\n // node_modules/@plotly/point-cluster/index.js\n var require_point_cluster = __commonJS({\n \"node_modules/@plotly/point-cluster/index.js\"(exports, module) {\n \"use strict\";\n module.exports = require_quad();\n }\n });\n\n // node_modules/abs-svg-path/index.js\n var require_abs_svg_path = __commonJS({\n \"node_modules/abs-svg-path/index.js\"(exports, module) {\n module.exports = absolutize;\n function absolutize(path) {\n var startX = 0;\n var startY = 0;\n var x = 0;\n var y = 0;\n return path.map(function(seg) {\n seg = seg.slice();\n var type = seg[0];\n var command = type.toUpperCase();\n if (type != command) {\n seg[0] = command;\n switch (type) {\n case \"a\":\n seg[6] += x;\n seg[7] += y;\n break;\n case \"v\":\n seg[1] += y;\n break;\n case \"h\":\n seg[1] += x;\n break;\n default:\n for (var i = 1; i < seg.length; ) {\n seg[i++] += x;\n seg[i++] += y;\n }\n }\n }\n switch (command) {\n case \"Z\":\n x = startX;\n y = startY;\n break;\n case \"H\":\n x = seg[1];\n break;\n case \"V\":\n y = seg[1];\n break;\n case \"M\":\n x = startX = seg[1];\n y = startY = seg[2];\n break;\n default:\n x = seg[seg.length - 2];\n y = seg[seg.length - 1];\n }\n return seg;\n });\n }\n }\n });\n\n // node_modules/svg-arc-to-cubic-bezier/cjs/index.js\n var require_cjs6 = __commonJS({\n \"node_modules/svg-arc-to-cubic-bezier/cjs/index.js\"(exports, module) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n var _slicedToArray = /* @__PURE__ */ function() {\n function sliceIterator(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = void 0;\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"]) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n return _arr;\n }\n return function(arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n };\n }();\n var TAU = Math.PI * 2;\n var mapToEllipse = function mapToEllipse2(_ref, rx, ry, cosphi, sinphi, centerx, centery) {\n var x = _ref.x, y = _ref.y;\n x *= rx;\n y *= ry;\n var xp = cosphi * x - sinphi * y;\n var yp = sinphi * x + cosphi * y;\n return {\n x: xp + centerx,\n y: yp + centery\n };\n };\n var approxUnitArc = function approxUnitArc2(ang1, ang2) {\n var a = ang2 === 1.5707963267948966 ? 0.551915024494 : ang2 === -1.5707963267948966 ? -0.551915024494 : 4 / 3 * Math.tan(ang2 / 4);\n var x1 = Math.cos(ang1);\n var y1 = Math.sin(ang1);\n var x2 = Math.cos(ang1 + ang2);\n var y2 = Math.sin(ang1 + ang2);\n return [{\n x: x1 - y1 * a,\n y: y1 + x1 * a\n }, {\n x: x2 + y2 * a,\n y: y2 - x2 * a\n }, {\n x: x2,\n y: y2\n }];\n };\n var vectorAngle = function vectorAngle2(ux, uy, vx, vy) {\n var sign = ux * vy - uy * vx < 0 ? -1 : 1;\n var dot = ux * vx + uy * vy;\n if (dot > 1) {\n dot = 1;\n }\n if (dot < -1) {\n dot = -1;\n }\n return sign * Math.acos(dot);\n };\n var getArcCenter = function getArcCenter2(px, py, cx, cy, rx, ry, largeArcFlag, sweepFlag, sinphi, cosphi, pxp, pyp) {\n var rxsq = Math.pow(rx, 2);\n var rysq = Math.pow(ry, 2);\n var pxpsq = Math.pow(pxp, 2);\n var pypsq = Math.pow(pyp, 2);\n var radicant = rxsq * rysq - rxsq * pypsq - rysq * pxpsq;\n if (radicant < 0) {\n radicant = 0;\n }\n radicant /= rxsq * pypsq + rysq * pxpsq;\n radicant = Math.sqrt(radicant) * (largeArcFlag === sweepFlag ? -1 : 1);\n var centerxp = radicant * rx / ry * pyp;\n var centeryp = radicant * -ry / rx * pxp;\n var centerx = cosphi * centerxp - sinphi * centeryp + (px + cx) / 2;\n var centery = sinphi * centerxp + cosphi * centeryp + (py + cy) / 2;\n var vx1 = (pxp - centerxp) / rx;\n var vy1 = (pyp - centeryp) / ry;\n var vx2 = (-pxp - centerxp) / rx;\n var vy2 = (-pyp - centeryp) / ry;\n var ang1 = vectorAngle(1, 0, vx1, vy1);\n var ang2 = vectorAngle(vx1, vy1, vx2, vy2);\n if (sweepFlag === 0 && ang2 > 0) {\n ang2 -= TAU;\n }\n if (sweepFlag === 1 && ang2 < 0) {\n ang2 += TAU;\n }\n return [centerx, centery, ang1, ang2];\n };\n var arcToBezier = function arcToBezier2(_ref2) {\n var px = _ref2.px, py = _ref2.py, cx = _ref2.cx, cy = _ref2.cy, rx = _ref2.rx, ry = _ref2.ry, _ref2$xAxisRotation = _ref2.xAxisRotation, xAxisRotation = _ref2$xAxisRotation === void 0 ? 0 : _ref2$xAxisRotation, _ref2$largeArcFlag = _ref2.largeArcFlag, largeArcFlag = _ref2$largeArcFlag === void 0 ? 0 : _ref2$largeArcFlag, _ref2$sweepFlag = _ref2.sweepFlag, sweepFlag = _ref2$sweepFlag === void 0 ? 0 : _ref2$sweepFlag;\n var curves = [];\n if (rx === 0 || ry === 0) {\n return [];\n }\n var sinphi = Math.sin(xAxisRotation * TAU / 360);\n var cosphi = Math.cos(xAxisRotation * TAU / 360);\n var pxp = cosphi * (px - cx) / 2 + sinphi * (py - cy) / 2;\n var pyp = -sinphi * (px - cx) / 2 + cosphi * (py - cy) / 2;\n if (pxp === 0 && pyp === 0) {\n return [];\n }\n rx = Math.abs(rx);\n ry = Math.abs(ry);\n var lambda = Math.pow(pxp, 2) / Math.pow(rx, 2) + Math.pow(pyp, 2) / Math.pow(ry, 2);\n if (lambda > 1) {\n rx *= Math.sqrt(lambda);\n ry *= Math.sqrt(lambda);\n }\n var _getArcCenter = getArcCenter(px, py, cx, cy, rx, ry, largeArcFlag, sweepFlag, sinphi, cosphi, pxp, pyp), _getArcCenter2 = _slicedToArray(_getArcCenter, 4), centerx = _getArcCenter2[0], centery = _getArcCenter2[1], ang1 = _getArcCenter2[2], ang2 = _getArcCenter2[3];\n var ratio = Math.abs(ang2) / (TAU / 4);\n if (Math.abs(1 - ratio) < 1e-7) {\n ratio = 1;\n }\n var segments = Math.max(Math.ceil(ratio), 1);\n ang2 /= segments;\n for (var i = 0; i < segments; i++) {\n curves.push(approxUnitArc(ang1, ang2));\n ang1 += ang2;\n }\n return curves.map(function(curve) {\n var _mapToEllipse = mapToEllipse(curve[0], rx, ry, cosphi, sinphi, centerx, centery), x1 = _mapToEllipse.x, y1 = _mapToEllipse.y;\n var _mapToEllipse2 = mapToEllipse(curve[1], rx, ry, cosphi, sinphi, centerx, centery), x2 = _mapToEllipse2.x, y2 = _mapToEllipse2.y;\n var _mapToEllipse3 = mapToEllipse(curve[2], rx, ry, cosphi, sinphi, centerx, centery), x = _mapToEllipse3.x, y = _mapToEllipse3.y;\n return { x1, y1, x2, y2, x, y };\n });\n };\n exports.default = arcToBezier;\n module.exports = exports.default;\n }\n });\n\n // node_modules/svg-path-bounds/node_modules/normalize-svg-path/index.js\n var require_normalize_svg_path = __commonJS({\n \"node_modules/svg-path-bounds/node_modules/normalize-svg-path/index.js\"(exports, module) {\n \"use strict\";\n module.exports = normalize;\n var arcToCurve = require_cjs6();\n function normalize(path) {\n var prev;\n var result = [];\n var bezierX = 0;\n var bezierY = 0;\n var startX = 0;\n var startY = 0;\n var quadX = null;\n var quadY = null;\n var x = 0;\n var y = 0;\n for (var i = 0, len = path.length; i < len; i++) {\n var seg = path[i];\n var command = seg[0];\n switch (command) {\n case \"M\":\n startX = seg[1];\n startY = seg[2];\n break;\n case \"A\":\n var curves = arcToCurve({\n px: x,\n py: y,\n cx: seg[6],\n cy: seg[7],\n rx: seg[1],\n ry: seg[2],\n xAxisRotation: seg[3],\n largeArcFlag: seg[4],\n sweepFlag: seg[5]\n });\n if (!curves.length) continue;\n for (var j = 0, c; j < curves.length; j++) {\n c = curves[j];\n seg = [\"C\", c.x1, c.y1, c.x2, c.y2, c.x, c.y];\n if (j < curves.length - 1) result.push(seg);\n }\n break;\n case \"S\":\n var cx = x;\n var cy = y;\n if (prev == \"C\" || prev == \"S\") {\n cx += cx - bezierX;\n cy += cy - bezierY;\n }\n seg = [\"C\", cx, cy, seg[1], seg[2], seg[3], seg[4]];\n break;\n case \"T\":\n if (prev == \"Q\" || prev == \"T\") {\n quadX = x * 2 - quadX;\n quadY = y * 2 - quadY;\n } else {\n quadX = x;\n quadY = y;\n }\n seg = quadratic(x, y, quadX, quadY, seg[1], seg[2]);\n break;\n case \"Q\":\n quadX = seg[1];\n quadY = seg[2];\n seg = quadratic(x, y, seg[1], seg[2], seg[3], seg[4]);\n break;\n case \"L\":\n seg = line(x, y, seg[1], seg[2]);\n break;\n case \"H\":\n seg = line(x, y, seg[1], y);\n break;\n case \"V\":\n seg = line(x, y, x, seg[1]);\n break;\n case \"Z\":\n seg = line(x, y, startX, startY);\n break;\n }\n prev = command;\n x = seg[seg.length - 2];\n y = seg[seg.length - 1];\n if (seg.length > 4) {\n bezierX = seg[seg.length - 4];\n bezierY = seg[seg.length - 3];\n } else {\n bezierX = x;\n bezierY = y;\n }\n result.push(seg);\n }\n return result;\n }\n function line(x1, y1, x2, y2) {\n return [\"C\", x1, y1, x2, y2, x2, y2];\n }\n function quadratic(x1, y1, cx, cy, x2, y2) {\n return [\n \"C\",\n x1 / 3 + 2 / 3 * cx,\n y1 / 3 + 2 / 3 * cy,\n x2 / 3 + 2 / 3 * cx,\n y2 / 3 + 2 / 3 * cy,\n x2,\n y2\n ];\n }\n }\n });\n\n // node_modules/is-svg-path/index.js\n var require_is_svg_path = __commonJS({\n \"node_modules/is-svg-path/index.js\"(exports, module) {\n \"use strict\";\n module.exports = function isPath(str) {\n if (typeof str !== \"string\") return false;\n str = str.trim();\n if (/^[mzlhvcsqta]\\s*[-+.0-9][^mlhvzcsqta]+/i.test(str) && /[\\dz]$/i.test(str) && str.length > 4) return true;\n return false;\n };\n }\n });\n\n // node_modules/svg-path-bounds/index.js\n var require_svg_path_bounds = __commonJS({\n \"node_modules/svg-path-bounds/index.js\"(exports, module) {\n \"use strict\";\n var parse2 = require_parse_svg_path();\n var abs = require_abs_svg_path();\n var normalize = require_normalize_svg_path();\n var isSvgPath = require_is_svg_path();\n var assert = require_assert();\n module.exports = pathBounds;\n function pathBounds(path) {\n if (Array.isArray(path) && path.length === 1 && typeof path[0] === \"string\") path = path[0];\n if (typeof path === \"string\") {\n assert(isSvgPath(path), \"String is not an SVG path.\");\n path = parse2(path);\n }\n assert(Array.isArray(path), \"Argument should be a string or an array of path segments.\");\n path = abs(path);\n path = normalize(path);\n if (!path.length) return [0, 0, 0, 0];\n var bounds = [Infinity, Infinity, -Infinity, -Infinity];\n for (var i = 0, l = path.length; i < l; i++) {\n var points = path[i].slice(1);\n for (var j = 0; j < points.length; j += 2) {\n if (points[j + 0] < bounds[0]) bounds[0] = points[j + 0];\n if (points[j + 1] < bounds[1]) bounds[1] = points[j + 1];\n if (points[j + 0] > bounds[2]) bounds[2] = points[j + 0];\n if (points[j + 1] > bounds[3]) bounds[3] = points[j + 1];\n }\n }\n return bounds;\n }\n }\n });\n\n // node_modules/normalize-svg-path/index.js\n var require_normalize_svg_path2 = __commonJS({\n \"node_modules/normalize-svg-path/index.js\"(exports, module) {\n var \\u03C0 = Math.PI;\n var _120 = radians2(120);\n module.exports = normalize;\n function normalize(path) {\n var prev;\n var result = [];\n var bezierX = 0;\n var bezierY = 0;\n var startX = 0;\n var startY = 0;\n var quadX = null;\n var quadY = null;\n var x = 0;\n var y = 0;\n for (var i = 0, len = path.length; i < len; i++) {\n var seg = path[i];\n var command = seg[0];\n switch (command) {\n case \"M\":\n startX = seg[1];\n startY = seg[2];\n break;\n case \"A\":\n seg = arc(x, y, seg[1], seg[2], radians2(seg[3]), seg[4], seg[5], seg[6], seg[7]);\n seg.unshift(\"C\");\n if (seg.length > 7) {\n result.push(seg.splice(0, 7));\n seg.unshift(\"C\");\n }\n break;\n case \"S\":\n var cx = x;\n var cy = y;\n if (prev == \"C\" || prev == \"S\") {\n cx += cx - bezierX;\n cy += cy - bezierY;\n }\n seg = [\"C\", cx, cy, seg[1], seg[2], seg[3], seg[4]];\n break;\n case \"T\":\n if (prev == \"Q\" || prev == \"T\") {\n quadX = x * 2 - quadX;\n quadY = y * 2 - quadY;\n } else {\n quadX = x;\n quadY = y;\n }\n seg = quadratic(x, y, quadX, quadY, seg[1], seg[2]);\n break;\n case \"Q\":\n quadX = seg[1];\n quadY = seg[2];\n seg = quadratic(x, y, seg[1], seg[2], seg[3], seg[4]);\n break;\n case \"L\":\n seg = line(x, y, seg[1], seg[2]);\n break;\n case \"H\":\n seg = line(x, y, seg[1], y);\n break;\n case \"V\":\n seg = line(x, y, x, seg[1]);\n break;\n case \"Z\":\n seg = line(x, y, startX, startY);\n break;\n }\n prev = command;\n x = seg[seg.length - 2];\n y = seg[seg.length - 1];\n if (seg.length > 4) {\n bezierX = seg[seg.length - 4];\n bezierY = seg[seg.length - 3];\n } else {\n bezierX = x;\n bezierY = y;\n }\n result.push(seg);\n }\n return result;\n }\n function line(x1, y1, x2, y2) {\n return [\"C\", x1, y1, x2, y2, x2, y2];\n }\n function quadratic(x1, y1, cx, cy, x2, y2) {\n return [\n \"C\",\n x1 / 3 + 2 / 3 * cx,\n y1 / 3 + 2 / 3 * cy,\n x2 / 3 + 2 / 3 * cx,\n y2 / 3 + 2 / 3 * cy,\n x2,\n y2\n ];\n }\n function arc(x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) {\n if (!recursive) {\n var xy = rotate(x1, y1, -angle);\n x1 = xy.x;\n y1 = xy.y;\n xy = rotate(x2, y2, -angle);\n x2 = xy.x;\n y2 = xy.y;\n var x = (x1 - x2) / 2;\n var y = (y1 - y2) / 2;\n var h = x * x / (rx * rx) + y * y / (ry * ry);\n if (h > 1) {\n h = Math.sqrt(h);\n rx = h * rx;\n ry = h * ry;\n }\n var rx2 = rx * rx;\n var ry2 = ry * ry;\n var k = (large_arc_flag == sweep_flag ? -1 : 1) * Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x)));\n if (k == Infinity) k = 1;\n var cx = k * rx * y / ry + (x1 + x2) / 2;\n var cy = k * -ry * x / rx + (y1 + y2) / 2;\n var f1 = Math.asin(((y1 - cy) / ry).toFixed(9));\n var f2 = Math.asin(((y2 - cy) / ry).toFixed(9));\n f1 = x1 < cx ? \\u03C0 - f1 : f1;\n f2 = x2 < cx ? \\u03C0 - f2 : f2;\n if (f1 < 0) f1 = \\u03C0 * 2 + f1;\n if (f2 < 0) f2 = \\u03C0 * 2 + f2;\n if (sweep_flag && f1 > f2) f1 = f1 - \\u03C0 * 2;\n if (!sweep_flag && f2 > f1) f2 = f2 - \\u03C0 * 2;\n } else {\n f1 = recursive[0];\n f2 = recursive[1];\n cx = recursive[2];\n cy = recursive[3];\n }\n if (Math.abs(f2 - f1) > _120) {\n var f2old = f2;\n var x2old = x2;\n var y2old = y2;\n f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1);\n x2 = cx + rx * Math.cos(f2);\n y2 = cy + ry * Math.sin(f2);\n var res = arc(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]);\n }\n var t = Math.tan((f2 - f1) / 4);\n var hx = 4 / 3 * rx * t;\n var hy = 4 / 3 * ry * t;\n var curve = [\n 2 * x1 - (x1 + hx * Math.sin(f1)),\n 2 * y1 - (y1 - hy * Math.cos(f1)),\n x2 + hx * Math.sin(f2),\n y2 - hy * Math.cos(f2),\n x2,\n y2\n ];\n if (recursive) return curve;\n if (res) curve = curve.concat(res);\n for (var i = 0; i < curve.length; ) {\n var rot = rotate(curve[i], curve[i + 1], angle);\n curve[i++] = rot.x;\n curve[i++] = rot.y;\n }\n return curve;\n }\n function rotate(x, y, rad) {\n return {\n x: x * Math.cos(rad) - y * Math.sin(rad),\n y: x * Math.sin(rad) + y * Math.cos(rad)\n };\n }\n function radians2(degress) {\n return degress * (\\u03C0 / 180);\n }\n }\n });\n\n // node_modules/draw-svg-path/index.js\n var require_draw_svg_path = __commonJS({\n \"node_modules/draw-svg-path/index.js\"(exports, module) {\n var abs = require_abs_svg_path();\n var normalize = require_normalize_svg_path2();\n var methods = {\n \"M\": \"moveTo\",\n \"C\": \"bezierCurveTo\"\n };\n module.exports = function(context, segments) {\n context.beginPath();\n normalize(abs(segments)).forEach(\n function(segment) {\n var command = segment[0];\n var args = segment.slice(1);\n context[methods[command]].apply(context, args);\n }\n );\n context.closePath();\n };\n }\n });\n\n // node_modules/bitmap-sdf/index.js\n var require_bitmap_sdf = __commonJS({\n \"node_modules/bitmap-sdf/index.js\"(exports, module) {\n \"use strict\";\n var clamp = require_clamp();\n module.exports = calcSDF;\n var INF = 1e20;\n function calcSDF(src, options) {\n if (!options) options = {};\n var cutoff = options.cutoff == null ? 0.25 : options.cutoff;\n var radius = options.radius == null ? 8 : options.radius;\n var channel = options.channel || 0;\n var w, h, size, data, intData, stride, ctx, canvas, imgData, i, l;\n if (ArrayBuffer.isView(src) || Array.isArray(src)) {\n if (!options.width || !options.height) throw Error(\"For raw data width and height should be provided by options\");\n w = options.width, h = options.height;\n data = src;\n if (!options.stride) stride = Math.floor(src.length / w / h);\n else stride = options.stride;\n } else {\n if (window.HTMLCanvasElement && src instanceof window.HTMLCanvasElement) {\n canvas = src;\n ctx = canvas.getContext(\"2d\");\n w = canvas.width, h = canvas.height;\n imgData = ctx.getImageData(0, 0, w, h);\n data = imgData.data;\n stride = 4;\n } else if (window.CanvasRenderingContext2D && src instanceof window.CanvasRenderingContext2D) {\n canvas = src.canvas;\n ctx = src;\n w = canvas.width, h = canvas.height;\n imgData = ctx.getImageData(0, 0, w, h);\n data = imgData.data;\n stride = 4;\n } else if (window.ImageData && src instanceof window.ImageData) {\n imgData = src;\n w = src.width, h = src.height;\n data = imgData.data;\n stride = 4;\n }\n }\n size = Math.max(w, h);\n if (window.Uint8ClampedArray && data instanceof window.Uint8ClampedArray || window.Uint8Array && data instanceof window.Uint8Array) {\n intData = data;\n data = Array(w * h);\n for (i = 0, l = intData.length; i < l; i++) {\n data[i] = intData[i * stride + channel] / 255;\n }\n } else {\n if (stride !== 1) throw Error(\"Raw data can have only 1 value per pixel\");\n }\n var gridOuter = Array(w * h);\n var gridInner = Array(w * h);\n var f = Array(size);\n var d = Array(size);\n var z = Array(size + 1);\n var v = Array(size);\n for (i = 0, l = w * h; i < l; i++) {\n var a = data[i];\n gridOuter[i] = a === 1 ? 0 : a === 0 ? INF : Math.pow(Math.max(0, 0.5 - a), 2);\n gridInner[i] = a === 1 ? INF : a === 0 ? 0 : Math.pow(Math.max(0, a - 0.5), 2);\n }\n edt(gridOuter, w, h, f, d, v, z);\n edt(gridInner, w, h, f, d, v, z);\n var dist = window.Float32Array ? new Float32Array(w * h) : new Array(w * h);\n for (i = 0, l = w * h; i < l; i++) {\n dist[i] = clamp(1 - ((gridOuter[i] - gridInner[i]) / radius + cutoff), 0, 1);\n }\n return dist;\n }\n function edt(data, width, height, f, d, v, z) {\n for (var x = 0; x < width; x++) {\n for (var y = 0; y < height; y++) {\n f[y] = data[y * width + x];\n }\n edt1d(f, d, v, z, height);\n for (y = 0; y < height; y++) {\n data[y * width + x] = d[y];\n }\n }\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n f[x] = data[y * width + x];\n }\n edt1d(f, d, v, z, width);\n for (x = 0; x < width; x++) {\n data[y * width + x] = Math.sqrt(d[x]);\n }\n }\n }\n function edt1d(f, d, v, z, n) {\n v[0] = 0;\n z[0] = -INF;\n z[1] = +INF;\n for (var q = 1, k = 0; q < n; q++) {\n var s = (f[q] + q * q - (f[v[k]] + v[k] * v[k])) / (2 * q - 2 * v[k]);\n while (s <= z[k]) {\n k--;\n s = (f[q] + q * q - (f[v[k]] + v[k] * v[k])) / (2 * q - 2 * v[k]);\n }\n k++;\n v[k] = q;\n z[k] = s;\n z[k + 1] = +INF;\n }\n for (q = 0, k = 0; q < n; q++) {\n while (z[k + 1] < q) k++;\n d[q] = (q - v[k]) * (q - v[k]) + f[v[k]];\n }\n }\n }\n });\n\n // node_modules/svg-path-sdf/index.js\n var require_svg_path_sdf = __commonJS({\n \"node_modules/svg-path-sdf/index.js\"(exports, module) {\n \"use strict\";\n var pathBounds = require_svg_path_bounds();\n var parsePath = require_parse_svg_path();\n var drawPath = require_draw_svg_path();\n var isSvgPath = require_is_svg_path();\n var bitmapSdf = require_bitmap_sdf();\n var canvas = document.createElement(\"canvas\");\n var ctx = canvas.getContext(\"2d\");\n module.exports = pathSdf;\n function pathSdf(path, options) {\n if (!isSvgPath(path)) throw Error(\"Argument should be valid svg path string\");\n if (!options) options = {};\n var w, h;\n if (options.shape) {\n w = options.shape[0];\n h = options.shape[1];\n } else {\n w = canvas.width = options.w || options.width || 200;\n h = canvas.height = options.h || options.height || 200;\n }\n var size = Math.min(w, h);\n var stroke = options.stroke || 0;\n var viewbox = options.viewbox || options.viewBox || pathBounds(path);\n var scale = [w / (viewbox[2] - viewbox[0]), h / (viewbox[3] - viewbox[1])];\n var maxScale = Math.min(scale[0] || 0, scale[1] || 0) / 2;\n ctx.fillStyle = \"black\";\n ctx.fillRect(0, 0, w, h);\n ctx.fillStyle = \"white\";\n if (stroke) {\n if (typeof stroke != \"number\") stroke = 1;\n if (stroke > 0) {\n ctx.strokeStyle = \"white\";\n } else {\n ctx.strokeStyle = \"black\";\n }\n ctx.lineWidth = Math.abs(stroke);\n }\n ctx.translate(w * 0.5, h * 0.5);\n ctx.scale(maxScale, maxScale);\n if (isPath2DSupported()) {\n var path2d = new Path2D(path);\n ctx.fill(path2d);\n stroke && ctx.stroke(path2d);\n } else {\n var segments = parsePath(path);\n drawPath(ctx, segments);\n ctx.fill();\n stroke && ctx.stroke();\n }\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n var data = bitmapSdf(ctx, {\n cutoff: options.cutoff != null ? options.cutoff : 0.5,\n radius: options.radius != null ? options.radius : size * 0.5\n });\n return data;\n }\n var path2DSupported;\n function isPath2DSupported() {\n if (path2DSupported != null) return path2DSupported;\n var ctx2 = document.createElement(\"canvas\").getContext(\"2d\");\n ctx2.canvas.width = ctx2.canvas.height = 1;\n if (!window.Path2D) return path2DSupported = false;\n var path = new Path2D(\"M0,0h1v1h-1v-1Z\");\n ctx2.fillStyle = \"black\";\n ctx2.fill(path);\n var idata = ctx2.getImageData(0, 0, 1, 1);\n return path2DSupported = idata && idata.data && idata.data[3] === 255;\n }\n }\n });\n\n // src/traces/scattergl/convert.js\n var require_convert10 = __commonJS({\n \"src/traces/scattergl/convert.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var svgSdf = require_svg_path_sdf();\n var rgba3 = require_color_normalize();\n var Registry = require_registry();\n var Lib = require_lib();\n var isArrayOrTypedArray = Lib.isArrayOrTypedArray;\n var Drawing = require_drawing();\n var AxisIDs = require_axis_ids();\n var formatColor = require_gl_format_color().formatColor;\n var subTypes = require_subtypes();\n var makeBubbleSizeFn = require_make_bubble_size_func();\n var helpers = require_helpers16();\n var constants = require_constants23();\n var DESELECTDIM = require_interactions().DESELECTDIM;\n var TEXTOFFSETSIGN = {\n start: 1,\n left: 1,\n end: -1,\n right: -1,\n middle: 0,\n center: 0,\n bottom: 1,\n top: -1\n };\n var appendArrayPointValue = require_helpers2().appendArrayPointValue;\n function convertStyle(gd, trace) {\n var i;\n var opts = {\n marker: void 0,\n markerSel: void 0,\n markerUnsel: void 0,\n line: void 0,\n fill: void 0,\n errorX: void 0,\n errorY: void 0,\n text: void 0,\n textSel: void 0,\n textUnsel: void 0\n };\n var plotGlPixelRatio = gd._context.plotGlPixelRatio;\n if (trace.visible !== true) return opts;\n if (subTypes.hasText(trace)) {\n opts.text = convertTextStyle(gd, trace);\n opts.textSel = convertTextSelection(gd, trace, trace.selected);\n opts.textUnsel = convertTextSelection(gd, trace, trace.unselected);\n }\n if (subTypes.hasMarkers(trace)) {\n opts.marker = convertMarkerStyle(gd, trace);\n opts.markerSel = convertMarkerSelection(gd, trace, trace.selected);\n opts.markerUnsel = convertMarkerSelection(gd, trace, trace.unselected);\n if (!trace.unselected && isArrayOrTypedArray(trace.marker.opacity)) {\n var mo = trace.marker.opacity;\n opts.markerUnsel.opacity = new Array(mo.length);\n for (i = 0; i < mo.length; i++) {\n opts.markerUnsel.opacity[i] = DESELECTDIM * mo[i];\n }\n }\n }\n if (subTypes.hasLines(trace)) {\n opts.line = {\n overlay: true,\n thickness: trace.line.width * plotGlPixelRatio,\n color: trace.line.color,\n opacity: trace.opacity\n };\n var dashes = (constants.DASHES[trace.line.dash] || [1]).slice();\n for (i = 0; i < dashes.length; ++i) {\n dashes[i] *= trace.line.width * plotGlPixelRatio;\n }\n opts.line.dashes = dashes;\n }\n if (trace.error_x && trace.error_x.visible) {\n opts.errorX = convertErrorBarStyle(trace, trace.error_x, plotGlPixelRatio);\n }\n if (trace.error_y && trace.error_y.visible) {\n opts.errorY = convertErrorBarStyle(trace, trace.error_y, plotGlPixelRatio);\n }\n if (!!trace.fill && trace.fill !== \"none\") {\n opts.fill = {\n closed: true,\n fill: trace.fillcolor,\n thickness: 0\n };\n }\n return opts;\n }\n function convertTextStyle(gd, trace) {\n var fullLayout = gd._fullLayout;\n var count = trace._length;\n var textfontIn = trace.textfont;\n var textpositionIn = trace.textposition;\n var textPos = isArrayOrTypedArray(textpositionIn) ? textpositionIn : [textpositionIn];\n var tfc = textfontIn.color;\n var tfs = textfontIn.size;\n var tff = textfontIn.family;\n var tfw = textfontIn.weight;\n var tfy = textfontIn.style;\n var tfv = textfontIn.variant;\n var optsOut = {};\n var i;\n var plotGlPixelRatio = gd._context.plotGlPixelRatio;\n var texttemplate = trace.texttemplate;\n if (texttemplate) {\n optsOut.text = [];\n var d3locale = fullLayout._d3locale;\n var isArray = Array.isArray(texttemplate);\n var N = isArray ? Math.min(texttemplate.length, count) : count;\n var txt = isArray ? function(i2) {\n return texttemplate[i2];\n } : function() {\n return texttemplate;\n };\n for (i = 0; i < N; i++) {\n var d = { i };\n var labels = trace._module.formatLabels(d, trace, fullLayout);\n var pointValues = {};\n appendArrayPointValue(pointValues, trace, i);\n var meta = trace._meta || {};\n optsOut.text.push(Lib.texttemplateString(txt(i), labels, d3locale, pointValues, d, meta));\n }\n } else {\n if (isArrayOrTypedArray(trace.text) && trace.text.length < count) {\n optsOut.text = trace.text.slice();\n } else {\n optsOut.text = trace.text;\n }\n }\n if (isArrayOrTypedArray(optsOut.text)) {\n for (i = optsOut.text.length; i < count; i++) {\n optsOut.text[i] = \"\";\n }\n }\n optsOut.opacity = trace.opacity;\n optsOut.font = {};\n optsOut.align = [];\n optsOut.baseline = [];\n for (i = 0; i < textPos.length; i++) {\n var tp = textPos[i].split(/\\s+/);\n switch (tp[1]) {\n case \"left\":\n optsOut.align.push(\"right\");\n break;\n case \"right\":\n optsOut.align.push(\"left\");\n break;\n default:\n optsOut.align.push(tp[1]);\n }\n switch (tp[0]) {\n case \"top\":\n optsOut.baseline.push(\"bottom\");\n break;\n case \"bottom\":\n optsOut.baseline.push(\"top\");\n break;\n default:\n optsOut.baseline.push(tp[0]);\n }\n }\n if (isArrayOrTypedArray(tfc)) {\n optsOut.color = new Array(count);\n for (i = 0; i < count; i++) {\n optsOut.color[i] = tfc[i];\n }\n } else {\n optsOut.color = tfc;\n }\n if (isArrayOrTypedArray(tfs) || Array.isArray(tff) || isArrayOrTypedArray(tfw) || Array.isArray(tfy) || Array.isArray(tfv)) {\n optsOut.font = new Array(count);\n for (i = 0; i < count; i++) {\n var fonti = optsOut.font[i] = {};\n fonti.size = (Lib.isTypedArray(tfs) ? tfs[i] : isArrayOrTypedArray(tfs) ? isNumeric(tfs[i]) ? tfs[i] : 0 : tfs) * plotGlPixelRatio;\n fonti.family = Array.isArray(tff) ? tff[i] : tff;\n fonti.weight = weightFallBack(isArrayOrTypedArray(tfw) ? tfw[i] : tfw);\n fonti.style = Array.isArray(tfy) ? tfy[i] : tfy;\n fonti.variant = Array.isArray(tfv) ? tfv[i] : tfv;\n }\n } else {\n optsOut.font = {\n size: tfs * plotGlPixelRatio,\n family: tff,\n weight: weightFallBack(tfw),\n style: tfy,\n variant: tfv\n };\n }\n return optsOut;\n }\n function weightFallBack(w) {\n if (w <= 1e3) {\n return w > 500 ? \"bold\" : \"normal\";\n }\n return w;\n }\n function convertMarkerStyle(gd, trace) {\n var count = trace._length;\n var optsIn = trace.marker;\n var optsOut = {};\n var i;\n var multiSymbol = isArrayOrTypedArray(optsIn.symbol);\n var multiAngle = isArrayOrTypedArray(optsIn.angle);\n var multiColor = isArrayOrTypedArray(optsIn.color);\n var multiLineColor = isArrayOrTypedArray(optsIn.line.color);\n var multiOpacity = isArrayOrTypedArray(optsIn.opacity);\n var multiSize = isArrayOrTypedArray(optsIn.size);\n var multiLineWidth = isArrayOrTypedArray(optsIn.line.width);\n var isOpen;\n if (!multiSymbol) isOpen = helpers.isOpenSymbol(optsIn.symbol);\n if (multiSymbol || multiColor || multiLineColor || multiOpacity || multiAngle) {\n optsOut.symbols = new Array(count);\n optsOut.angles = new Array(count);\n optsOut.colors = new Array(count);\n optsOut.borderColors = new Array(count);\n var symbols = optsIn.symbol;\n var angles = optsIn.angle;\n var colors = formatColor(optsIn, optsIn.opacity, count);\n var borderColors = formatColor(optsIn.line, optsIn.opacity, count);\n if (!isArrayOrTypedArray(borderColors[0])) {\n var borderColor = borderColors;\n borderColors = Array(count);\n for (i = 0; i < count; i++) {\n borderColors[i] = borderColor;\n }\n }\n if (!isArrayOrTypedArray(colors[0])) {\n var color2 = colors;\n colors = Array(count);\n for (i = 0; i < count; i++) {\n colors[i] = color2;\n }\n }\n if (!isArrayOrTypedArray(symbols)) {\n var symbol = symbols;\n symbols = Array(count);\n for (i = 0; i < count; i++) {\n symbols[i] = symbol;\n }\n }\n if (!isArrayOrTypedArray(angles)) {\n var angle = angles;\n angles = Array(count);\n for (i = 0; i < count; i++) {\n angles[i] = angle;\n }\n }\n optsOut.symbols = symbols;\n optsOut.angles = angles;\n optsOut.colors = colors;\n optsOut.borderColors = borderColors;\n for (i = 0; i < count; i++) {\n if (multiSymbol) {\n isOpen = helpers.isOpenSymbol(optsIn.symbol[i]);\n }\n if (isOpen) {\n borderColors[i] = colors[i].slice();\n colors[i] = colors[i].slice();\n colors[i][3] = 0;\n }\n }\n optsOut.opacity = trace.opacity;\n optsOut.markers = new Array(count);\n for (i = 0; i < count; i++) {\n optsOut.markers[i] = getSymbolSdf({\n mx: optsOut.symbols[i],\n ma: optsOut.angles[i]\n }, trace);\n }\n } else {\n if (isOpen) {\n optsOut.color = rgba3(optsIn.color, \"uint8\");\n optsOut.color[3] = 0;\n optsOut.borderColor = rgba3(optsIn.color, \"uint8\");\n } else {\n optsOut.color = rgba3(optsIn.color, \"uint8\");\n optsOut.borderColor = rgba3(optsIn.line.color, \"uint8\");\n }\n optsOut.opacity = trace.opacity * optsIn.opacity;\n optsOut.marker = getSymbolSdf({\n mx: optsIn.symbol,\n ma: optsIn.angle\n }, trace);\n }\n var sizeFactor = 1;\n var markerSizeFunc = makeBubbleSizeFn(trace, sizeFactor);\n var s;\n if (multiSize || multiLineWidth) {\n var sizes = optsOut.sizes = new Array(count);\n var borderSizes = optsOut.borderSizes = new Array(count);\n var sizeTotal = 0;\n var sizeAvg;\n if (multiSize) {\n for (i = 0; i < count; i++) {\n sizes[i] = markerSizeFunc(optsIn.size[i]);\n sizeTotal += sizes[i];\n }\n sizeAvg = sizeTotal / count;\n } else {\n s = markerSizeFunc(optsIn.size);\n for (i = 0; i < count; i++) {\n sizes[i] = s;\n }\n }\n if (multiLineWidth) {\n for (i = 0; i < count; i++) {\n borderSizes[i] = optsIn.line.width[i];\n }\n } else {\n s = optsIn.line.width;\n for (i = 0; i < count; i++) {\n borderSizes[i] = s;\n }\n }\n optsOut.sizeAvg = sizeAvg;\n } else {\n optsOut.size = markerSizeFunc(optsIn && optsIn.size || 10);\n optsOut.borderSizes = markerSizeFunc(optsIn.line.width);\n }\n return optsOut;\n }\n function convertMarkerSelection(gd, trace, target) {\n var optsIn = trace.marker;\n var optsOut = {};\n if (!target) return optsOut;\n if (target.marker && target.marker.symbol) {\n optsOut = convertMarkerStyle(gd, Lib.extendFlat({}, optsIn, target.marker));\n } else if (target.marker) {\n if (target.marker.size) optsOut.size = target.marker.size;\n if (target.marker.color) optsOut.colors = target.marker.color;\n if (target.marker.opacity !== void 0) optsOut.opacity = target.marker.opacity;\n }\n return optsOut;\n }\n function convertTextSelection(gd, trace, target) {\n var optsOut = {};\n if (!target) return optsOut;\n if (target.textfont) {\n var optsIn = {\n opacity: 1,\n text: trace.text,\n texttemplate: trace.texttemplate,\n textposition: trace.textposition,\n textfont: Lib.extendFlat({}, trace.textfont)\n };\n if (target.textfont) {\n Lib.extendFlat(optsIn.textfont, target.textfont);\n }\n optsOut = convertTextStyle(gd, optsIn);\n }\n return optsOut;\n }\n function convertErrorBarStyle(trace, target, plotGlPixelRatio) {\n var optsOut = {\n capSize: target.width * 2 * plotGlPixelRatio,\n lineWidth: target.thickness * plotGlPixelRatio,\n color: target.color\n };\n if (target.copy_ystyle) {\n optsOut = trace.error_y;\n }\n return optsOut;\n }\n var SYMBOL_SDF_SIZE = constants.SYMBOL_SDF_SIZE;\n var SYMBOL_SIZE = constants.SYMBOL_SIZE;\n var SYMBOL_STROKE = constants.SYMBOL_STROKE;\n var SYMBOL_SDF = {};\n var SYMBOL_SVG_CIRCLE = Drawing.symbolFuncs[0](SYMBOL_SIZE * 0.05);\n function getSymbolSdf(d, trace) {\n var symbol = d.mx;\n if (symbol === \"circle\") return null;\n var symbolPath, symbolSdf;\n var symbolNumber = Drawing.symbolNumber(symbol);\n var symbolFunc = Drawing.symbolFuncs[symbolNumber % 100];\n var symbolNoDot = !!Drawing.symbolNoDot[symbolNumber % 100];\n var symbolNoFill = !!Drawing.symbolNoFill[symbolNumber % 100];\n var isDot = helpers.isDotSymbol(symbol);\n if (d.ma) symbol += \"_\" + d.ma;\n if (SYMBOL_SDF[symbol]) return SYMBOL_SDF[symbol];\n var angle = Drawing.getMarkerAngle(d, trace);\n if (isDot && !symbolNoDot) {\n symbolPath = symbolFunc(SYMBOL_SIZE * 1.1, angle) + SYMBOL_SVG_CIRCLE;\n } else {\n symbolPath = symbolFunc(SYMBOL_SIZE, angle);\n }\n symbolSdf = svgSdf(symbolPath, {\n w: SYMBOL_SDF_SIZE,\n h: SYMBOL_SDF_SIZE,\n viewBox: [-SYMBOL_SIZE, -SYMBOL_SIZE, SYMBOL_SIZE, SYMBOL_SIZE],\n stroke: symbolNoFill ? SYMBOL_STROKE : -SYMBOL_STROKE\n });\n SYMBOL_SDF[symbol] = symbolSdf;\n return symbolSdf || null;\n }\n function convertLinePositions(gd, trace, positions) {\n var len = positions.length;\n var count = len / 2;\n var linePositions;\n var i;\n if (subTypes.hasLines(trace) && count) {\n if (trace.line.shape === \"hv\") {\n linePositions = [];\n for (i = 0; i < count - 1; i++) {\n if (isNaN(positions[i * 2]) || isNaN(positions[i * 2 + 1])) {\n linePositions.push(NaN, NaN, NaN, NaN);\n } else {\n linePositions.push(positions[i * 2], positions[i * 2 + 1]);\n if (!isNaN(positions[i * 2 + 2]) && !isNaN(positions[i * 2 + 3])) {\n linePositions.push(positions[i * 2 + 2], positions[i * 2 + 1]);\n } else {\n linePositions.push(NaN, NaN);\n }\n }\n }\n linePositions.push(positions[len - 2], positions[len - 1]);\n } else if (trace.line.shape === \"hvh\") {\n linePositions = [];\n for (i = 0; i < count - 1; i++) {\n if (isNaN(positions[i * 2]) || isNaN(positions[i * 2 + 1]) || isNaN(positions[i * 2 + 2]) || isNaN(positions[i * 2 + 3])) {\n if (!isNaN(positions[i * 2]) && !isNaN(positions[i * 2 + 1])) {\n linePositions.push(positions[i * 2], positions[i * 2 + 1]);\n } else {\n linePositions.push(NaN, NaN);\n }\n linePositions.push(NaN, NaN);\n } else {\n var midPtX = (positions[i * 2] + positions[i * 2 + 2]) / 2;\n linePositions.push(\n positions[i * 2],\n positions[i * 2 + 1],\n midPtX,\n positions[i * 2 + 1],\n midPtX,\n positions[i * 2 + 3]\n );\n }\n }\n linePositions.push(positions[len - 2], positions[len - 1]);\n } else if (trace.line.shape === \"vhv\") {\n linePositions = [];\n for (i = 0; i < count - 1; i++) {\n if (isNaN(positions[i * 2]) || isNaN(positions[i * 2 + 1]) || isNaN(positions[i * 2 + 2]) || isNaN(positions[i * 2 + 3])) {\n if (!isNaN(positions[i * 2]) && !isNaN(positions[i * 2 + 1])) {\n linePositions.push(positions[i * 2], positions[i * 2 + 1]);\n } else {\n linePositions.push(NaN, NaN);\n }\n linePositions.push(NaN, NaN);\n } else {\n var midPtY = (positions[i * 2 + 1] + positions[i * 2 + 3]) / 2;\n linePositions.push(\n positions[i * 2],\n positions[i * 2 + 1],\n positions[i * 2],\n midPtY,\n positions[i * 2 + 2],\n midPtY\n );\n }\n }\n linePositions.push(positions[len - 2], positions[len - 1]);\n } else if (trace.line.shape === \"vh\") {\n linePositions = [];\n for (i = 0; i < count - 1; i++) {\n if (isNaN(positions[i * 2]) || isNaN(positions[i * 2 + 1])) {\n linePositions.push(NaN, NaN, NaN, NaN);\n } else {\n linePositions.push(positions[i * 2], positions[i * 2 + 1]);\n if (!isNaN(positions[i * 2 + 2]) && !isNaN(positions[i * 2 + 3])) {\n linePositions.push(positions[i * 2], positions[i * 2 + 3]);\n } else {\n linePositions.push(NaN, NaN);\n }\n }\n }\n linePositions.push(positions[len - 2], positions[len - 1]);\n } else {\n linePositions = positions;\n }\n }\n var hasNaN = false;\n for (i = 0; i < linePositions.length; i++) {\n if (isNaN(linePositions[i])) {\n hasNaN = true;\n break;\n }\n }\n var join = hasNaN || linePositions.length > constants.TOO_MANY_POINTS ? \"rect\" : subTypes.hasMarkers(trace) ? \"rect\" : \"round\";\n if (hasNaN && trace.connectgaps) {\n var lastX = linePositions[0];\n var lastY = linePositions[1];\n for (i = 0; i < linePositions.length; i += 2) {\n if (isNaN(linePositions[i]) || isNaN(linePositions[i + 1])) {\n linePositions[i] = lastX;\n linePositions[i + 1] = lastY;\n } else {\n lastX = linePositions[i];\n lastY = linePositions[i + 1];\n }\n }\n }\n return {\n join,\n positions: linePositions\n };\n }\n function convertErrorBarPositions(gd, trace, positions, x, y) {\n var makeComputeError = Registry.getComponentMethod(\"errorbars\", \"makeComputeError\");\n var xa = AxisIDs.getFromId(gd, trace.xaxis, \"x\");\n var ya = AxisIDs.getFromId(gd, trace.yaxis, \"y\");\n var count = positions.length / 2;\n var out = {};\n function convertOneAxis(coords, ax) {\n var axLetter = ax._id.charAt(0);\n var opts = trace[\"error_\" + axLetter];\n if (opts && opts.visible && (ax.type === \"linear\" || ax.type === \"log\")) {\n var computeError = makeComputeError(opts);\n var pOffset = { x: 0, y: 1 }[axLetter];\n var eOffset = { x: [0, 1, 2, 3], y: [2, 3, 0, 1] }[axLetter];\n var errors = new Float64Array(4 * count);\n var minShoe = Infinity;\n var maxHat = -Infinity;\n for (var i = 0, j = 0; i < count; i++, j += 4) {\n var dc = coords[i];\n if (isNumeric(dc)) {\n var dl = positions[i * 2 + pOffset];\n var vals = computeError(dc, i);\n var lv = vals[0];\n var hv = vals[1];\n if (isNumeric(lv) && isNumeric(hv)) {\n var shoe = dc - lv;\n var hat = dc + hv;\n errors[j + eOffset[0]] = dl - ax.c2l(shoe);\n errors[j + eOffset[1]] = ax.c2l(hat) - dl;\n errors[j + eOffset[2]] = 0;\n errors[j + eOffset[3]] = 0;\n minShoe = Math.min(minShoe, dc - lv);\n maxHat = Math.max(maxHat, dc + hv);\n }\n }\n }\n out[axLetter] = {\n positions,\n errors,\n _bnds: [minShoe, maxHat]\n };\n }\n }\n convertOneAxis(x, xa);\n convertOneAxis(y, ya);\n return out;\n }\n function convertTextPosition(gd, trace, textOpts, markerOpts) {\n var count = trace._length;\n var out = {};\n var i;\n if (subTypes.hasMarkers(trace)) {\n var fontOpts = textOpts.font;\n var align = textOpts.align;\n var baseline = textOpts.baseline;\n out.offset = new Array(count);\n for (i = 0; i < count; i++) {\n var ms = markerOpts.sizes ? markerOpts.sizes[i] : markerOpts.size;\n var fs = isArrayOrTypedArray(fontOpts) ? fontOpts[i].size : fontOpts.size;\n var a = isArrayOrTypedArray(align) ? align.length > 1 ? align[i] : align[0] : align;\n var b = isArrayOrTypedArray(baseline) ? baseline.length > 1 ? baseline[i] : baseline[0] : baseline;\n var hSign = TEXTOFFSETSIGN[a];\n var vSign = TEXTOFFSETSIGN[b];\n var xPad = ms ? ms / 0.8 + 1 : 0;\n var yPad = -vSign * xPad - vSign * 0.5;\n out.offset[i] = [hSign * xPad / fs, yPad / fs];\n }\n }\n return out;\n }\n module.exports = {\n style: convertStyle,\n markerStyle: convertMarkerStyle,\n markerSelection: convertMarkerSelection,\n linePositions: convertLinePositions,\n errorBarPositions: convertErrorBarPositions,\n textPosition: convertTextPosition\n };\n }\n });\n\n // src/traces/scattergl/scene_update.js\n var require_scene_update = __commonJS({\n \"src/traces/scattergl/scene_update.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n module.exports = function sceneUpdate(gd, subplot) {\n var scene = subplot._scene;\n var resetOpts = {\n // number of traces in subplot, since scene:subplot -> 1:1\n count: 0,\n // whether scene requires init hook in plot call (dirty plot call)\n dirty: true,\n // last used options\n lineOptions: [],\n fillOptions: [],\n markerOptions: [],\n markerSelectedOptions: [],\n markerUnselectedOptions: [],\n errorXOptions: [],\n errorYOptions: [],\n textOptions: [],\n textSelectedOptions: [],\n textUnselectedOptions: [],\n // selection batches\n selectBatch: [],\n unselectBatch: []\n };\n var initOpts = {\n fill2d: false,\n scatter2d: false,\n error2d: false,\n line2d: false,\n glText: false,\n select2d: false\n };\n if (!subplot._scene) {\n scene = subplot._scene = {};\n scene.init = function init() {\n Lib.extendFlat(scene, initOpts, resetOpts);\n };\n scene.init();\n scene.update = function update(opt) {\n var opts = Lib.repeat(opt, scene.count);\n if (scene.fill2d) scene.fill2d.update(opts);\n if (scene.scatter2d) scene.scatter2d.update(opts);\n if (scene.line2d) scene.line2d.update(opts);\n if (scene.error2d) scene.error2d.update(opts.concat(opts));\n if (scene.select2d) scene.select2d.update(opts);\n if (scene.glText) {\n for (var i = 0; i < scene.count; i++) {\n scene.glText[i].update(opt);\n }\n }\n };\n scene.draw = function draw() {\n var count = scene.count;\n var fill2d = scene.fill2d;\n var error2d = scene.error2d;\n var line2d = scene.line2d;\n var scatter2d = scene.scatter2d;\n var glText = scene.glText;\n var select2d = scene.select2d;\n var selectBatch = scene.selectBatch;\n var unselectBatch = scene.unselectBatch;\n for (var i = 0; i < count; i++) {\n if (fill2d && scene.fillOrder[i]) {\n fill2d.draw(scene.fillOrder[i]);\n }\n if (line2d && scene.lineOptions[i]) {\n line2d.draw(i);\n }\n if (error2d) {\n if (scene.errorXOptions[i]) error2d.draw(i);\n if (scene.errorYOptions[i]) error2d.draw(i + count);\n }\n if (scatter2d && scene.markerOptions[i]) {\n if (unselectBatch[i].length) {\n var arg = Lib.repeat([], scene.count);\n arg[i] = unselectBatch[i];\n scatter2d.draw(arg);\n } else if (!selectBatch[i].length) {\n scatter2d.draw(i);\n }\n }\n if (glText[i] && scene.textOptions[i]) {\n glText[i].render();\n }\n }\n if (select2d) {\n select2d.draw(selectBatch);\n }\n scene.dirty = false;\n };\n scene.destroy = function destroy() {\n if (scene.fill2d && scene.fill2d.destroy) scene.fill2d.destroy();\n if (scene.scatter2d && scene.scatter2d.destroy) scene.scatter2d.destroy();\n if (scene.error2d && scene.error2d.destroy) scene.error2d.destroy();\n if (scene.line2d && scene.line2d.destroy) scene.line2d.destroy();\n if (scene.select2d && scene.select2d.destroy) scene.select2d.destroy();\n if (scene.glText) {\n scene.glText.forEach(function(text) {\n if (text.destroy) text.destroy();\n });\n }\n scene.lineOptions = null;\n scene.fillOptions = null;\n scene.markerOptions = null;\n scene.markerSelectedOptions = null;\n scene.markerUnselectedOptions = null;\n scene.errorXOptions = null;\n scene.errorYOptions = null;\n scene.textOptions = null;\n scene.textSelectedOptions = null;\n scene.textUnselectedOptions = null;\n scene.selectBatch = null;\n scene.unselectBatch = null;\n subplot._scene = null;\n };\n }\n if (!scene.dirty) {\n Lib.extendFlat(scene, resetOpts);\n }\n return scene;\n };\n }\n });\n\n // src/traces/scattergl/calc.js\n var require_calc29 = __commonJS({\n \"src/traces/scattergl/calc.js\"(exports, module) {\n \"use strict\";\n var cluster = require_point_cluster();\n var Lib = require_lib();\n var AxisIDs = require_axis_ids();\n var findExtremes = require_autorange().findExtremes;\n var alignPeriod = require_align_period();\n var scatterCalc = require_calc3();\n var calcMarkerSize = scatterCalc.calcMarkerSize;\n var calcAxisExpansion = scatterCalc.calcAxisExpansion;\n var setFirstScatter = scatterCalc.setFirstScatter;\n var calcColorscale = require_colorscale_calc();\n var convert = require_convert10();\n var sceneUpdate = require_scene_update();\n var BADNUM = require_numerical().BADNUM;\n var TOO_MANY_POINTS = require_constants23().TOO_MANY_POINTS;\n module.exports = function calc(gd, trace) {\n var fullLayout = gd._fullLayout;\n var xa = trace._xA = AxisIDs.getFromId(gd, trace.xaxis, \"x\");\n var ya = trace._yA = AxisIDs.getFromId(gd, trace.yaxis, \"y\");\n var subplot = fullLayout._plots[trace.xaxis + trace.yaxis];\n var len = trace._length;\n var hasTooManyPoints = len >= TOO_MANY_POINTS;\n var len2 = len * 2;\n var stash = {};\n var i;\n var origX = xa.makeCalcdata(trace, \"x\");\n var origY = ya.makeCalcdata(trace, \"y\");\n var xObj = alignPeriod(trace, xa, \"x\", origX);\n var yObj = alignPeriod(trace, ya, \"y\", origY);\n var x = xObj.vals;\n var y = yObj.vals;\n trace._x = x;\n trace._y = y;\n if (trace.xperiodalignment) {\n trace._origX = origX;\n trace._xStarts = xObj.starts;\n trace._xEnds = xObj.ends;\n }\n if (trace.yperiodalignment) {\n trace._origY = origY;\n trace._yStarts = yObj.starts;\n trace._yEnds = yObj.ends;\n }\n var positions = new Array(len2);\n var _ids = new Array(len);\n for (i = 0; i < len; i++) {\n positions[i * 2] = x[i] === BADNUM ? NaN : x[i];\n positions[i * 2 + 1] = y[i] === BADNUM ? NaN : y[i];\n _ids[i] = i;\n }\n if (xa.type === \"log\") {\n for (i = 0; i < len2; i += 2) {\n positions[i] = xa.c2l(positions[i]);\n }\n }\n if (ya.type === \"log\") {\n for (i = 1; i < len2; i += 2) {\n positions[i] = ya.c2l(positions[i]);\n }\n }\n if (hasTooManyPoints && (xa.type !== \"log\" && ya.type !== \"log\")) {\n stash.tree = cluster(positions);\n } else {\n stash.ids = _ids;\n }\n calcColorscale(gd, trace);\n var opts = sceneOptions(gd, subplot, trace, positions, x, y);\n var scene = sceneUpdate(gd, subplot);\n setFirstScatter(fullLayout, trace);\n var ppad;\n if (!hasTooManyPoints) {\n ppad = calcMarkerSize(trace, len);\n } else if (opts.marker) {\n ppad = opts.marker.sizeAvg || Math.max(opts.marker.size, 3);\n }\n calcAxisExpansion(gd, trace, xa, ya, x, y, ppad);\n if (opts.errorX) expandForErrorBars(trace, xa, opts.errorX);\n if (opts.errorY) expandForErrorBars(trace, ya, opts.errorY);\n if (opts.fill && !scene.fill2d) scene.fill2d = true;\n if (opts.marker && !scene.scatter2d) scene.scatter2d = true;\n if (opts.line && !scene.line2d) scene.line2d = true;\n if ((opts.errorX || opts.errorY) && !scene.error2d) scene.error2d = true;\n if (opts.text && !scene.glText) scene.glText = true;\n if (opts.marker) opts.marker.snap = len;\n scene.lineOptions.push(opts.line);\n scene.errorXOptions.push(opts.errorX);\n scene.errorYOptions.push(opts.errorY);\n scene.fillOptions.push(opts.fill);\n scene.markerOptions.push(opts.marker);\n scene.markerSelectedOptions.push(opts.markerSel);\n scene.markerUnselectedOptions.push(opts.markerUnsel);\n scene.textOptions.push(opts.text);\n scene.textSelectedOptions.push(opts.textSel);\n scene.textUnselectedOptions.push(opts.textUnsel);\n scene.selectBatch.push([]);\n scene.unselectBatch.push([]);\n stash._scene = scene;\n stash.index = scene.count;\n stash.x = x;\n stash.y = y;\n stash.positions = positions;\n scene.count++;\n return [{ x: false, y: false, t: stash, trace }];\n };\n function expandForErrorBars(trace, ax, opts) {\n var extremes = trace._extremes[ax._id];\n var errExt = findExtremes(ax, opts._bnds, { padded: true });\n extremes.min = extremes.min.concat(errExt.min);\n extremes.max = extremes.max.concat(errExt.max);\n }\n function sceneOptions(gd, subplot, trace, positions, x, y) {\n var opts = convert.style(gd, trace);\n if (opts.marker) {\n opts.marker.positions = positions;\n }\n if (opts.line && positions.length > 1) {\n Lib.extendFlat(\n opts.line,\n convert.linePositions(gd, trace, positions)\n );\n }\n if (opts.errorX || opts.errorY) {\n var errors = convert.errorBarPositions(gd, trace, positions, x, y);\n if (opts.errorX) {\n Lib.extendFlat(opts.errorX, errors.x);\n }\n if (opts.errorY) {\n Lib.extendFlat(opts.errorY, errors.y);\n }\n }\n if (opts.text) {\n Lib.extendFlat(\n opts.text,\n { positions },\n convert.textPosition(gd, trace, opts.text, opts.marker)\n );\n Lib.extendFlat(\n opts.textSel,\n { positions },\n convert.textPosition(gd, trace, opts.text, opts.markerSel)\n );\n Lib.extendFlat(\n opts.textUnsel,\n { positions },\n convert.textPosition(gd, trace, opts.text, opts.markerUnsel)\n );\n }\n return opts;\n }\n }\n });\n\n // src/traces/scattergl/edit_style.js\n var require_edit_style = __commonJS({\n \"src/traces/scattergl/edit_style.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Color2 = require_color();\n var DESELECTDIM = require_interactions().DESELECTDIM;\n function styleTextSelection(cd) {\n var cd0 = cd[0];\n var trace = cd0.trace;\n var stash = cd0.t;\n var scene = stash._scene;\n var index = stash.index;\n var els = scene.selectBatch[index];\n var unels = scene.unselectBatch[index];\n var baseOpts = scene.textOptions[index];\n var selOpts = scene.textSelectedOptions[index] || {};\n var unselOpts = scene.textUnselectedOptions[index] || {};\n var opts = Lib.extendFlat({}, baseOpts);\n var i, j;\n if (els.length || unels.length) {\n var stc = selOpts.color;\n var utc = unselOpts.color;\n var base = baseOpts.color;\n var hasArrayBase = Lib.isArrayOrTypedArray(base);\n opts.color = new Array(trace._length);\n for (i = 0; i < els.length; i++) {\n j = els[i];\n opts.color[j] = stc || (hasArrayBase ? base[j] : base);\n }\n for (i = 0; i < unels.length; i++) {\n j = unels[i];\n var basej = hasArrayBase ? base[j] : base;\n opts.color[j] = utc ? utc : stc ? basej : Color2.addOpacity(basej, DESELECTDIM);\n }\n }\n scene.glText[index].update(opts);\n }\n module.exports = {\n styleTextSelection\n };\n }\n });\n\n // src/traces/scattergl/select.js\n var require_select7 = __commonJS({\n \"src/traces/scattergl/select.js\"(exports, module) {\n \"use strict\";\n var subTypes = require_subtypes();\n var styleTextSelection = require_edit_style().styleTextSelection;\n module.exports = function select(searchInfo, selectionTester) {\n var cd = searchInfo.cd;\n var xa = searchInfo.xaxis;\n var ya = searchInfo.yaxis;\n var selection = [];\n var trace = cd[0].trace;\n var stash = cd[0].t;\n var len = trace._length;\n var x = stash.x;\n var y = stash.y;\n var scene = stash._scene;\n var index = stash.index;\n if (!scene) return selection;\n var hasText = subTypes.hasText(trace);\n var hasMarkers = subTypes.hasMarkers(trace);\n var hasOnlyLines = !hasMarkers && !hasText;\n if (trace.visible !== true || hasOnlyLines) return selection;\n var els = [];\n var unels = [];\n if (selectionTester !== false && !selectionTester.degenerate) {\n for (var i = 0; i < len; i++) {\n if (selectionTester.contains([stash.xpx[i], stash.ypx[i]], false, i, searchInfo)) {\n els.push(i);\n selection.push({\n pointNumber: i,\n x: xa.c2d(x[i]),\n y: ya.c2d(y[i])\n });\n } else {\n unels.push(i);\n }\n }\n }\n if (hasMarkers) {\n var scatter2d = scene.scatter2d;\n if (!els.length && !unels.length) {\n var baseOpts = new Array(scene.count);\n baseOpts[index] = scene.markerOptions[index];\n scatter2d.update.apply(scatter2d, baseOpts);\n } else if (!scene.selectBatch[index].length && !scene.unselectBatch[index].length) {\n var unselOpts = new Array(scene.count);\n unselOpts[index] = scene.markerUnselectedOptions[index];\n scatter2d.update.apply(scatter2d, unselOpts);\n }\n }\n scene.selectBatch[index] = els;\n scene.unselectBatch[index] = unels;\n if (hasText) {\n styleTextSelection(cd);\n }\n return selection;\n };\n }\n });\n\n // src/traces/scattergl/base_index.js\n var require_base_index = __commonJS({\n \"src/traces/scattergl/base_index.js\"(exports, module) {\n \"use strict\";\n var hover = require_hover16();\n module.exports = {\n moduleType: \"trace\",\n name: \"scattergl\",\n basePlotModule: require_cartesian(),\n categories: [\"gl\", \"regl\", \"cartesian\", \"symbols\", \"errorBarsOK\", \"showLegend\", \"scatter-like\"],\n attributes: require_attributes50(),\n supplyDefaults: require_defaults46(),\n crossTraceDefaults: require_cross_trace_defaults2(),\n colorbar: require_marker_colorbar(),\n formatLabels: require_format_labels4(),\n calc: require_calc29(),\n hoverPoints: hover.hoverPoints,\n selectPoints: require_select7(),\n meta: {}\n };\n }\n });\n\n // node_modules/color-id/index.js\n var require_color_id = __commonJS({\n \"node_modules/color-id/index.js\"(exports, module) {\n \"use strict\";\n var clamp = require_clamp();\n module.exports = toNumber;\n module.exports.to = toNumber;\n module.exports.from = fromNumber;\n function toNumber(rgba3, normalized) {\n if (normalized == null) normalized = true;\n var r = rgba3[0], g = rgba3[1], b = rgba3[2], a = rgba3[3];\n if (a == null) a = normalized ? 1 : 255;\n if (normalized) {\n r *= 255;\n g *= 255;\n b *= 255;\n a *= 255;\n }\n r = clamp(r, 0, 255) & 255;\n g = clamp(g, 0, 255) & 255;\n b = clamp(b, 0, 255) & 255;\n a = clamp(a, 0, 255) & 255;\n var n = r * 16777216 + (g << 16) + (b << 8) + a;\n return n;\n }\n function fromNumber(n, normalized) {\n n = +n;\n var r = n >>> 24;\n var g = (n & 16711680) >>> 16;\n var b = (n & 65280) >>> 8;\n var a = n & 255;\n if (normalized === false) return [r, g, b, a];\n return [r / 255, g / 255, b / 255, a / 255];\n }\n }\n });\n\n // node_modules/object-assign/index.js\n var require_object_assign = __commonJS({\n \"node_modules/object-assign/index.js\"(exports, module) {\n \"use strict\";\n var getOwnPropertySymbols = Object.getOwnPropertySymbols;\n var hasOwnProperty2 = Object.prototype.hasOwnProperty;\n var propIsEnumerable = Object.prototype.propertyIsEnumerable;\n function toObject(val) {\n if (val === null || val === void 0) {\n throw new TypeError(\"Object.assign cannot be called with null or undefined\");\n }\n return Object(val);\n }\n function shouldUseNative() {\n try {\n if (!Object.assign) {\n return false;\n }\n var test1 = new String(\"abc\");\n test1[5] = \"de\";\n if (Object.getOwnPropertyNames(test1)[0] === \"5\") {\n return false;\n }\n var test2 = {};\n for (var i = 0; i < 10; i++) {\n test2[\"_\" + String.fromCharCode(i)] = i;\n }\n var order2 = Object.getOwnPropertyNames(test2).map(function(n) {\n return test2[n];\n });\n if (order2.join(\"\") !== \"0123456789\") {\n return false;\n }\n var test3 = {};\n \"abcdefghijklmnopqrst\".split(\"\").forEach(function(letter) {\n test3[letter] = letter;\n });\n if (Object.keys(Object.assign({}, test3)).join(\"\") !== \"abcdefghijklmnopqrst\") {\n return false;\n }\n return true;\n } catch (err) {\n return false;\n }\n }\n module.exports = shouldUseNative() ? Object.assign : function(target, source) {\n var from;\n var to = toObject(target);\n var symbols;\n for (var s = 1; s < arguments.length; s++) {\n from = Object(arguments[s]);\n for (var key in from) {\n if (hasOwnProperty2.call(from, key)) {\n to[key] = from[key];\n }\n }\n if (getOwnPropertySymbols) {\n symbols = getOwnPropertySymbols(from);\n for (var i = 0; i < symbols.length; i++) {\n if (propIsEnumerable.call(from, symbols[i])) {\n to[symbols[i]] = from[symbols[i]];\n }\n }\n }\n }\n return to;\n };\n }\n });\n\n // node_modules/glslify/browser.js\n var require_browser3 = __commonJS({\n \"node_modules/glslify/browser.js\"(exports, module) {\n module.exports = function(strings) {\n if (typeof strings === \"string\") strings = [strings];\n var exprs = [].slice.call(arguments, 1);\n var parts = [];\n for (var i = 0; i < strings.length - 1; i++) {\n parts.push(strings[i], exprs[i] || \"\");\n }\n parts.push(strings[i]);\n return parts.join(\"\");\n };\n }\n });\n\n // node_modules/update-diff/index.js\n var require_update_diff = __commonJS({\n \"node_modules/update-diff/index.js\"(exports, module) {\n \"use strict\";\n module.exports = function updateDiff(obj, diff, mappers) {\n if (!Array.isArray(mappers)) mappers = [].slice.call(arguments, 2);\n for (var i = 0, l = mappers.length; i < l; i++) {\n var dict = mappers[i];\n for (var prop in dict) {\n if (diff[prop] !== void 0 && !Array.isArray(diff[prop]) && obj[prop] === diff[prop]) continue;\n if (prop in diff) {\n var result;\n if (dict[prop] === true) result = diff[prop];\n else if (dict[prop] === false) continue;\n else if (typeof dict[prop] === \"function\") {\n result = dict[prop](diff[prop], obj, diff);\n if (result === void 0) continue;\n }\n obj[prop] = result;\n }\n }\n }\n return obj;\n };\n }\n });\n\n // node_modules/is-iexplorer/index.js\n var require_is_iexplorer = __commonJS({\n \"node_modules/is-iexplorer/index.js\"(exports, module) {\n \"use strict\";\n module.exports = typeof navigator !== \"undefined\" && (/MSIE/.test(navigator.userAgent) || /Trident\\//.test(navigator.appVersion));\n }\n });\n\n // node_modules/to-float32/index.js\n var require_to_float32 = __commonJS({\n \"node_modules/to-float32/index.js\"(exports, module) {\n \"use strict\";\n module.exports = float32;\n module.exports.float32 = module.exports.float = float32;\n module.exports.fract32 = module.exports.fract = fract32;\n var narr = new Float32Array(1);\n function fract32(arr, fract) {\n if (arr.length) {\n if (arr instanceof Float32Array) return new Float32Array(arr.length);\n if (!(fract instanceof Float32Array)) fract = float32(arr);\n for (var i = 0, l = fract.length; i < l; i++) {\n fract[i] = arr[i] - fract[i];\n }\n return fract;\n }\n return float32(arr - float32(arr));\n }\n function float32(arr) {\n if (arr.length) {\n if (arr instanceof Float32Array) return arr;\n return new Float32Array(arr);\n }\n narr[0] = arr;\n return narr[0];\n }\n }\n });\n\n // node_modules/regl-scatter2d/bundle.js\n var require_bundle = __commonJS({\n \"node_modules/regl-scatter2d/bundle.js\"(exports, module) {\n \"use strict\";\n function _iterableToArrayLimit(arr, i) {\n var _i = null == arr ? null : \"undefined\" != typeof Symbol && arr[Symbol.iterator] || arr[\"@@iterator\"];\n if (null != _i) {\n var _s, _e, _x, _r, _arr = [], _n = true, _d = false;\n try {\n if (_x = (_i = _i.call(arr)).next, 0 === i) {\n if (Object(_i) !== _i) return;\n _n = false;\n } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = true) ;\n } catch (err) {\n _d = true, _e = err;\n } finally {\n try {\n if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;\n } finally {\n if (_d) throw _e;\n }\n }\n return _arr;\n }\n }\n function _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n }\n function _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n }\n function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n }\n function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n }\n function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n }\n function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n }\n function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n return arr2;\n }\n function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n var rgba3 = require_color_normalize();\n var getBounds = require_array_bounds();\n var colorId = require_color_id();\n var cluster = require_point_cluster();\n var extend2 = require_object_assign();\n var glslify = require_browser3();\n var pick = require_pick_by_alias();\n var updateDiff = require_update_diff();\n var flatten = require_flatten_vertex_data();\n var ie = require_is_iexplorer();\n var f32 = require_to_float32();\n var parseRect = require_parse_rect();\n var scatter = Scatter;\n function Scatter(regl, options) {\n var _this = this;\n if (!(this instanceof Scatter)) return new Scatter(regl, options);\n if (typeof regl === \"function\") {\n if (!options) options = {};\n options.regl = regl;\n } else {\n options = regl;\n regl = null;\n }\n if (options && options.length) options.positions = options;\n regl = options.regl;\n var gl2 = regl._gl, paletteTexture, palette = [], paletteIds = {}, groups = [], markerTextures = [null], markerCache = [null];\n var maxColors = 255, maxSize = 100;\n this.tooManyColors = ie;\n paletteTexture = regl.texture({\n data: new Uint8Array(maxColors * 4),\n width: maxColors,\n height: 1,\n type: \"uint8\",\n format: \"rgba\",\n wrapS: \"clamp\",\n wrapT: \"clamp\",\n mag: \"nearest\",\n min: \"nearest\"\n });\n extend2(this, {\n regl,\n gl: gl2,\n groups,\n markerCache,\n markerTextures,\n palette,\n paletteIds,\n paletteTexture,\n maxColors,\n maxSize,\n canvas: gl2.canvas\n });\n this.update(options);\n var shaderOptions = {\n uniforms: {\n constPointSize: !!options.constPointSize,\n opacity: regl.prop(\"opacity\"),\n paletteSize: function paletteSize(ctx, prop) {\n return [_this.tooManyColors ? 0 : maxColors, paletteTexture.height];\n },\n pixelRatio: regl.context(\"pixelRatio\"),\n scale: regl.prop(\"scale\"),\n scaleFract: regl.prop(\"scaleFract\"),\n translate: regl.prop(\"translate\"),\n translateFract: regl.prop(\"translateFract\"),\n markerTexture: regl.prop(\"markerTexture\"),\n paletteTexture\n },\n attributes: {\n // FIXME: optimize these parts\n x: function x(ctx, prop) {\n return prop.xAttr || {\n buffer: prop.positionBuffer,\n stride: 8,\n offset: 0\n };\n },\n y: function y(ctx, prop) {\n return prop.yAttr || {\n buffer: prop.positionBuffer,\n stride: 8,\n offset: 4\n };\n },\n xFract: function xFract(ctx, prop) {\n return prop.xAttr ? {\n constant: [0, 0]\n } : {\n buffer: prop.positionFractBuffer,\n stride: 8,\n offset: 0\n };\n },\n yFract: function yFract(ctx, prop) {\n return prop.yAttr ? {\n constant: [0, 0]\n } : {\n buffer: prop.positionFractBuffer,\n stride: 8,\n offset: 4\n };\n },\n size: function size(ctx, prop) {\n return prop.size.length ? {\n buffer: prop.sizeBuffer,\n stride: 2,\n offset: 0\n } : {\n constant: [Math.round(prop.size * 255 / _this.maxSize)]\n };\n },\n borderSize: function borderSize(ctx, prop) {\n return prop.borderSize.length ? {\n buffer: prop.sizeBuffer,\n stride: 2,\n offset: 1\n } : {\n constant: [Math.round(prop.borderSize * 255 / _this.maxSize)]\n };\n },\n colorId: function colorId2(ctx, prop) {\n return prop.color.length ? {\n buffer: prop.colorBuffer,\n stride: _this.tooManyColors ? 8 : 4,\n offset: 0\n } : {\n constant: _this.tooManyColors ? palette.slice(prop.color * 4, prop.color * 4 + 4) : [prop.color]\n };\n },\n borderColorId: function borderColorId(ctx, prop) {\n return prop.borderColor.length ? {\n buffer: prop.colorBuffer,\n stride: _this.tooManyColors ? 8 : 4,\n offset: _this.tooManyColors ? 4 : 2\n } : {\n constant: _this.tooManyColors ? palette.slice(prop.borderColor * 4, prop.borderColor * 4 + 4) : [prop.borderColor]\n };\n },\n isActive: function isActive(ctx, prop) {\n return prop.activation === true ? {\n constant: [1]\n } : prop.activation ? prop.activation : {\n constant: [0]\n };\n }\n },\n blend: {\n enable: true,\n color: [0, 0, 0, 1],\n // photoshop blending\n func: {\n srcRGB: \"src alpha\",\n dstRGB: \"one minus src alpha\",\n srcAlpha: \"one minus dst alpha\",\n dstAlpha: \"one\"\n }\n },\n scissor: {\n enable: true,\n box: regl.prop(\"viewport\")\n },\n viewport: regl.prop(\"viewport\"),\n stencil: {\n enable: false\n },\n depth: {\n enable: false\n },\n elements: regl.prop(\"elements\"),\n count: regl.prop(\"count\"),\n offset: regl.prop(\"offset\"),\n primitive: \"points\"\n };\n var markerOptions = extend2({}, shaderOptions);\n markerOptions.frag = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nuniform float opacity;\\nuniform sampler2D markerTexture;\\n\\nvarying vec4 fragColor, fragBorderColor;\\nvarying float fragWidth, fragBorderColorLevel, fragColorLevel;\\n\\nfloat smoothStep(float x, float y) {\\n return 1.0 / (1.0 + exp(50.0*(x - y)));\\n}\\n\\nvoid main() {\\n float dist = texture2D(markerTexture, gl_PointCoord).r, delta = fragWidth;\\n\\n // max-distance alpha\\n if (dist < 0.003) discard;\\n\\n // null-border case\\n if (fragBorderColorLevel == fragColorLevel || fragBorderColor.a == 0.) {\\n float colorAmt = smoothstep(.5 - delta, .5 + delta, dist);\\n gl_FragColor = vec4(fragColor.rgb, colorAmt * fragColor.a * opacity);\\n }\\n else {\\n float borderColorAmt = smoothstep(fragBorderColorLevel - delta, fragBorderColorLevel + delta, dist);\\n float colorAmt = smoothstep(fragColorLevel - delta, fragColorLevel + delta, dist);\\n\\n vec4 color = fragBorderColor;\\n color.a *= borderColorAmt;\\n color = mix(color, fragColor, colorAmt);\\n color.a *= opacity;\\n\\n gl_FragColor = color;\\n }\\n\\n}\\n\"]);\n markerOptions.vert = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nattribute float x, y, xFract, yFract;\\nattribute float size, borderSize;\\nattribute vec4 colorId, borderColorId;\\nattribute float isActive;\\n\\n// `invariant` effectively turns off optimizations for the position.\\n// We need this because -fast-math on M1 Macs is re-ordering\\n// floating point operations in a way that causes floating point\\n// precision limits to put points in the wrong locations.\\ninvariant gl_Position;\\n\\nuniform bool constPointSize;\\nuniform float pixelRatio;\\nuniform vec2 scale, scaleFract, translate, translateFract, paletteSize;\\nuniform sampler2D paletteTexture;\\n\\nconst float maxSize = 100.;\\nconst float borderLevel = .5;\\n\\nvarying vec4 fragColor, fragBorderColor;\\nvarying float fragPointSize, fragBorderRadius, fragWidth, fragBorderColorLevel, fragColorLevel;\\n\\nfloat pointSizeScale = (constPointSize) ? 2. : pixelRatio;\\n\\nbool isDirect = (paletteSize.x < 1.);\\n\\nvec4 getColor(vec4 id) {\\n return isDirect ? id / 255. : texture2D(paletteTexture,\\n vec2(\\n (id.x + .5) / paletteSize.x,\\n (id.y + .5) / paletteSize.y\\n )\\n );\\n}\\n\\nvoid main() {\\n // ignore inactive points\\n if (isActive == 0.) return;\\n\\n vec2 position = vec2(x, y);\\n vec2 positionFract = vec2(xFract, yFract);\\n\\n vec4 color = getColor(colorId);\\n vec4 borderColor = getColor(borderColorId);\\n\\n float size = size * maxSize / 255.;\\n float borderSize = borderSize * maxSize / 255.;\\n\\n gl_PointSize = 2. * size * pointSizeScale;\\n fragPointSize = size * pixelRatio;\\n\\n vec2 pos = (position + translate) * scale\\n + (positionFract + translateFract) * scale\\n + (position + translate) * scaleFract\\n + (positionFract + translateFract) * scaleFract;\\n\\n gl_Position = vec4(pos * 2. - 1., 0., 1.);\\n\\n fragColor = color;\\n fragBorderColor = borderColor;\\n fragWidth = 1. / gl_PointSize;\\n\\n fragBorderColorLevel = clamp(borderLevel - borderLevel * borderSize / size, 0., 1.);\\n fragColorLevel = clamp(borderLevel + (1. - borderLevel) * borderSize / size, 0., 1.);\\n}\\n\"]);\n this.drawMarker = regl(markerOptions);\n var circleOptions = extend2({}, shaderOptions);\n circleOptions.frag = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nvarying vec4 fragColor, fragBorderColor;\\nvarying float fragBorderRadius, fragWidth;\\n\\nuniform float opacity;\\n\\nfloat smoothStep(float edge0, float edge1, float x) {\\n\tfloat t;\\n\tt = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\\n\treturn t * t * (3.0 - 2.0 * t);\\n}\\n\\nvoid main() {\\n\tfloat radius, alpha = 1.0, delta = fragWidth;\\n\\n\tradius = length(2.0 * gl_PointCoord.xy - 1.0);\\n\\n\tif (radius > 1.0 + delta) {\\n\t\tdiscard;\\n\t}\\n\\n\talpha -= smoothstep(1.0 - delta, 1.0 + delta, radius);\\n\\n\tfloat borderRadius = fragBorderRadius;\\n\tfloat ratio = smoothstep(borderRadius - delta, borderRadius + delta, radius);\\n\tvec4 color = mix(fragColor, fragBorderColor, ratio);\\n\tcolor.a *= alpha * opacity;\\n\tgl_FragColor = color;\\n}\\n\"]);\n circleOptions.vert = glslify([\"precision highp float;\\n#define GLSLIFY 1\\n\\nattribute float x, y, xFract, yFract;\\nattribute float size, borderSize;\\nattribute vec4 colorId, borderColorId;\\nattribute float isActive;\\n\\n// `invariant` effectively turns off optimizations for the position.\\n// We need this because -fast-math on M1 Macs is re-ordering\\n// floating point operations in a way that causes floating point\\n// precision limits to put points in the wrong locations.\\ninvariant gl_Position;\\n\\nuniform bool constPointSize;\\nuniform float pixelRatio;\\nuniform vec2 paletteSize, scale, scaleFract, translate, translateFract;\\nuniform sampler2D paletteTexture;\\n\\nconst float maxSize = 100.;\\n\\nvarying vec4 fragColor, fragBorderColor;\\nvarying float fragBorderRadius, fragWidth;\\n\\nfloat pointSizeScale = (constPointSize) ? 2. : pixelRatio;\\n\\nbool isDirect = (paletteSize.x < 1.);\\n\\nvec4 getColor(vec4 id) {\\n return isDirect ? id / 255. : texture2D(paletteTexture,\\n vec2(\\n (id.x + .5) / paletteSize.x,\\n (id.y + .5) / paletteSize.y\\n )\\n );\\n}\\n\\nvoid main() {\\n // ignore inactive points\\n if (isActive == 0.) return;\\n\\n vec2 position = vec2(x, y);\\n vec2 positionFract = vec2(xFract, yFract);\\n\\n vec4 color = getColor(colorId);\\n vec4 borderColor = getColor(borderColorId);\\n\\n float size = size * maxSize / 255.;\\n float borderSize = borderSize * maxSize / 255.;\\n\\n gl_PointSize = (size + borderSize) * pointSizeScale;\\n\\n vec2 pos = (position + translate) * scale\\n + (positionFract + translateFract) * scale\\n + (position + translate) * scaleFract\\n + (positionFract + translateFract) * scaleFract;\\n\\n gl_Position = vec4(pos * 2. - 1., 0., 1.);\\n\\n fragBorderRadius = 1. - 2. * borderSize / (size + borderSize);\\n fragColor = color;\\n fragBorderColor = borderColor.a == 0. || borderSize == 0. ? vec4(color.rgb, 0.) : borderColor;\\n fragWidth = 1. / gl_PointSize;\\n}\\n\"]);\n if (ie) {\n circleOptions.frag = circleOptions.frag.replace(\"smoothstep\", \"smoothStep\");\n markerOptions.frag = markerOptions.frag.replace(\"smoothstep\", \"smoothStep\");\n }\n this.drawCircle = regl(circleOptions);\n }\n Scatter.defaults = {\n color: \"black\",\n borderColor: \"transparent\",\n borderSize: 0,\n size: 12,\n opacity: 1,\n marker: void 0,\n viewport: null,\n range: null,\n pixelSize: null,\n count: 0,\n offset: 0,\n bounds: null,\n positions: [],\n snap: 1e4\n };\n Scatter.prototype.render = function() {\n if (arguments.length) {\n this.update.apply(this, arguments);\n }\n this.draw();\n return this;\n };\n Scatter.prototype.draw = function() {\n var _this2 = this;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n var groups = this.groups;\n if (args.length === 1 && Array.isArray(args[0]) && (args[0][0] === null || Array.isArray(args[0][0]))) {\n args = args[0];\n }\n this.regl._refresh();\n if (args.length) {\n for (var i = 0; i < args.length; i++) {\n this.drawItem(i, args[i]);\n }\n } else {\n groups.forEach(function(group, i2) {\n _this2.drawItem(i2);\n });\n }\n return this;\n };\n Scatter.prototype.drawItem = function(id, els) {\n var groups = this.groups;\n var group = groups[id];\n if (typeof els === \"number\") {\n id = els;\n group = groups[els];\n els = null;\n }\n if (!(group && group.count && group.opacity)) return;\n if (group.activation[0]) {\n this.drawCircle(this.getMarkerDrawOptions(0, group, els));\n }\n var batch = [];\n for (var i = 1; i < group.activation.length; i++) {\n if (!group.activation[i] || group.activation[i] !== true && !group.activation[i].data.length) continue;\n batch.push.apply(batch, _toConsumableArray(this.getMarkerDrawOptions(i, group, els)));\n }\n if (batch.length) {\n this.drawMarker(batch);\n }\n };\n Scatter.prototype.getMarkerDrawOptions = function(markerId, group, elements) {\n var range = group.range, tree = group.tree, viewport = group.viewport, activation = group.activation, selectionBuffer = group.selectionBuffer, count = group.count;\n var regl = this.regl;\n if (!tree) {\n if (elements) {\n return [extend2({}, group, {\n markerTexture: this.markerTextures[markerId],\n activation: activation[markerId],\n count: elements.length,\n elements,\n offset: 0\n })];\n }\n return [extend2({}, group, {\n markerTexture: this.markerTextures[markerId],\n activation: activation[markerId],\n offset: 0\n })];\n }\n var batch = [];\n var lod = tree.range(range, {\n lod: true,\n px: [(range[2] - range[0]) / viewport.width, (range[3] - range[1]) / viewport.height]\n });\n if (elements) {\n var markerActivation = activation[markerId];\n var mask = markerActivation.data;\n var data = new Uint8Array(count);\n for (var i = 0; i < elements.length; i++) {\n var id = elements[i];\n data[id] = mask ? mask[id] : 1;\n }\n selectionBuffer.subdata(data);\n }\n for (var l = lod.length; l--; ) {\n var _lod$l = _slicedToArray(lod[l], 2), from = _lod$l[0], to = _lod$l[1];\n batch.push(extend2({}, group, {\n markerTexture: this.markerTextures[markerId],\n activation: elements ? selectionBuffer : activation[markerId],\n offset: from,\n count: to - from\n }));\n }\n return batch;\n };\n Scatter.prototype.update = function() {\n var _this3 = this;\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n if (!args.length) return;\n if (args.length === 1 && Array.isArray(args[0])) args = args[0];\n var groups = this.groups, gl2 = this.gl, regl = this.regl, maxSize = this.maxSize, maxColors = this.maxColors, palette = this.palette;\n this.groups = groups = args.map(function(options, i) {\n var group = groups[i];\n if (options === void 0) return group;\n if (options === null) options = {\n positions: null\n };\n else if (typeof options === \"function\") options = {\n ondraw: options\n };\n else if (typeof options[0] === \"number\") options = {\n positions: options\n };\n options = pick(options, {\n positions: \"positions data points\",\n snap: \"snap cluster lod tree\",\n size: \"sizes size radius\",\n borderSize: \"borderSizes borderSize border-size bordersize borderWidth borderWidths border-width borderwidth stroke-width strokeWidth strokewidth outline\",\n color: \"colors color fill fill-color fillColor\",\n borderColor: \"borderColors borderColor stroke stroke-color strokeColor\",\n marker: \"markers marker shape\",\n range: \"range dataBox databox\",\n viewport: \"viewport viewPort viewBox viewbox\",\n opacity: \"opacity alpha transparency\",\n bounds: \"bound bounds boundaries limits\",\n tooManyColors: \"tooManyColors palette paletteMode optimizePalette enablePalette\"\n });\n if (options.positions === null) options.positions = [];\n if (options.tooManyColors != null) _this3.tooManyColors = options.tooManyColors;\n if (!group) {\n groups[i] = group = {\n id: i,\n scale: null,\n translate: null,\n scaleFract: null,\n translateFract: null,\n // buffers for active markers\n activation: [],\n // buffer for filtered markers\n selectionBuffer: regl.buffer({\n data: new Uint8Array(0),\n usage: \"stream\",\n type: \"uint8\"\n }),\n // buffers with data: it is faster to switch them per-pass\n // than provide one congregate buffer\n sizeBuffer: regl.buffer({\n data: new Uint8Array(0),\n usage: \"dynamic\",\n type: \"uint8\"\n }),\n colorBuffer: regl.buffer({\n data: new Uint8Array(0),\n usage: \"dynamic\",\n type: \"uint8\"\n }),\n positionBuffer: regl.buffer({\n data: new Uint8Array(0),\n usage: \"dynamic\",\n type: \"float\"\n }),\n positionFractBuffer: regl.buffer({\n data: new Uint8Array(0),\n usage: \"dynamic\",\n type: \"float\"\n })\n };\n options = extend2({}, Scatter.defaults, options);\n }\n if (options.positions && !(\"marker\" in options)) {\n options.marker = group.marker;\n delete group.marker;\n }\n if (options.marker && !(\"positions\" in options)) {\n options.positions = group.positions;\n delete group.positions;\n }\n var hasSize = 0, hasColor = 0;\n updateDiff(group, options, [{\n snap: true,\n size: function size2(s, group2) {\n if (s == null) s = Scatter.defaults.size;\n hasSize += s && s.length ? 1 : 0;\n return s;\n },\n borderSize: function borderSize2(s, group2) {\n if (s == null) s = Scatter.defaults.borderSize;\n hasSize += s && s.length ? 1 : 0;\n return s;\n },\n opacity: parseFloat,\n // add colors to palette, save references\n color: function color3(c, group2) {\n if (c == null) c = Scatter.defaults.color;\n c = _this3.updateColor(c);\n hasColor++;\n return c;\n },\n borderColor: function borderColor2(c, group2) {\n if (c == null) c = Scatter.defaults.borderColor;\n c = _this3.updateColor(c);\n hasColor++;\n return c;\n },\n bounds: function bounds(_bounds, group2, options2) {\n if (!(\"range\" in options2)) options2.range = null;\n return _bounds;\n },\n positions: function positions(_positions, group2, options2) {\n var snap = group2.snap;\n var positionBuffer = group2.positionBuffer, positionFractBuffer = group2.positionFractBuffer, selectionBuffer = group2.selectionBuffer;\n if (_positions.x || _positions.y) {\n if (_positions.x.length) {\n group2.xAttr = {\n buffer: regl.buffer(_positions.x),\n offset: 0,\n stride: 4,\n count: _positions.x.length\n };\n } else {\n group2.xAttr = {\n buffer: _positions.x.buffer,\n offset: _positions.x.offset * 4 || 0,\n stride: (_positions.x.stride || 1) * 4,\n count: _positions.x.count\n };\n }\n if (_positions.y.length) {\n group2.yAttr = {\n buffer: regl.buffer(_positions.y),\n offset: 0,\n stride: 4,\n count: _positions.y.length\n };\n } else {\n group2.yAttr = {\n buffer: _positions.y.buffer,\n offset: _positions.y.offset * 4 || 0,\n stride: (_positions.y.stride || 1) * 4,\n count: _positions.y.count\n };\n }\n group2.count = Math.max(group2.xAttr.count, group2.yAttr.count);\n return _positions;\n }\n _positions = flatten(_positions, \"float64\");\n var count2 = group2.count = Math.floor(_positions.length / 2);\n var bounds = group2.bounds = count2 ? getBounds(_positions, 2) : null;\n if (!options2.range && !group2.range) {\n delete group2.range;\n options2.range = bounds;\n }\n if (!options2.marker && !group2.marker) {\n delete group2.marker;\n options2.marker = null;\n }\n if (snap && (snap === true || count2 > snap)) {\n group2.tree = cluster(_positions, {\n bounds\n });\n } else if (snap && snap.length) {\n group2.tree = snap;\n }\n if (group2.tree) {\n var opts = {\n primitive: \"points\",\n usage: \"static\",\n data: group2.tree,\n type: \"uint32\"\n };\n if (group2.elements) group2.elements(opts);\n else group2.elements = regl.elements(opts);\n }\n var float_data = f32.float32(_positions);\n positionBuffer({\n data: float_data,\n usage: \"dynamic\"\n });\n var frac_data = f32.fract32(_positions, float_data);\n positionFractBuffer({\n data: frac_data,\n usage: \"dynamic\"\n });\n selectionBuffer({\n data: new Uint8Array(count2),\n type: \"uint8\",\n usage: \"stream\"\n });\n return _positions;\n }\n }, {\n // create marker ids corresponding to known marker textures\n marker: function marker(markers, group2, options2) {\n var activation = group2.activation;\n activation.forEach(function(buffer) {\n return buffer && buffer.destroy && buffer.destroy();\n });\n activation.length = 0;\n if (!markers || typeof markers[0] === \"number\") {\n var id = _this3.addMarker(markers);\n activation[id] = true;\n } else {\n var markerMasks = [];\n for (var _i = 0, l = Math.min(markers.length, group2.count); _i < l; _i++) {\n var _id = _this3.addMarker(markers[_i]);\n if (!markerMasks[_id]) markerMasks[_id] = new Uint8Array(group2.count);\n markerMasks[_id][_i] = 1;\n }\n for (var _id2 = 0; _id2 < markerMasks.length; _id2++) {\n if (!markerMasks[_id2]) continue;\n var opts = {\n data: markerMasks[_id2],\n type: \"uint8\",\n usage: \"static\"\n };\n if (!activation[_id2]) {\n activation[_id2] = regl.buffer(opts);\n } else {\n activation[_id2](opts);\n }\n activation[_id2].data = markerMasks[_id2];\n }\n }\n return markers;\n },\n range: function range(_range, group2, options2) {\n var bounds = group2.bounds;\n if (!bounds) return;\n if (!_range) _range = bounds;\n group2.scale = [1 / (_range[2] - _range[0]), 1 / (_range[3] - _range[1])];\n group2.translate = [-_range[0], -_range[1]];\n group2.scaleFract = f32.fract(group2.scale);\n group2.translateFract = f32.fract(group2.translate);\n return _range;\n },\n viewport: function viewport(vp) {\n var rect = parseRect(vp || [gl2.drawingBufferWidth, gl2.drawingBufferHeight]);\n return rect;\n }\n }]);\n if (hasSize) {\n var _group = group, count = _group.count, size = _group.size, borderSize = _group.borderSize, sizeBuffer = _group.sizeBuffer;\n var sizes = new Uint8Array(count * 2);\n if (size.length || borderSize.length) {\n for (var _i2 = 0; _i2 < count; _i2++) {\n sizes[_i2 * 2] = Math.round((size[_i2] == null ? size : size[_i2]) * 255 / maxSize);\n sizes[_i2 * 2 + 1] = Math.round((borderSize[_i2] == null ? borderSize : borderSize[_i2]) * 255 / maxSize);\n }\n }\n sizeBuffer({\n data: sizes,\n usage: \"dynamic\"\n });\n }\n if (hasColor) {\n var _group2 = group, _count = _group2.count, color2 = _group2.color, borderColor = _group2.borderColor, colorBuffer = _group2.colorBuffer;\n var colors;\n if (_this3.tooManyColors) {\n if (color2.length || borderColor.length) {\n colors = new Uint8Array(_count * 8);\n for (var _i3 = 0; _i3 < _count; _i3++) {\n var _colorId = color2[_i3];\n colors[_i3 * 8] = palette[_colorId * 4];\n colors[_i3 * 8 + 1] = palette[_colorId * 4 + 1];\n colors[_i3 * 8 + 2] = palette[_colorId * 4 + 2];\n colors[_i3 * 8 + 3] = palette[_colorId * 4 + 3];\n var borderColorId = borderColor[_i3];\n colors[_i3 * 8 + 4] = palette[borderColorId * 4];\n colors[_i3 * 8 + 5] = palette[borderColorId * 4 + 1];\n colors[_i3 * 8 + 6] = palette[borderColorId * 4 + 2];\n colors[_i3 * 8 + 7] = palette[borderColorId * 4 + 3];\n }\n }\n } else {\n if (color2.length || borderColor.length) {\n colors = new Uint8Array(_count * 4 + 2);\n for (var _i4 = 0; _i4 < _count; _i4++) {\n if (color2[_i4] != null) {\n colors[_i4 * 4] = color2[_i4] % maxColors;\n colors[_i4 * 4 + 1] = Math.floor(color2[_i4] / maxColors);\n }\n if (borderColor[_i4] != null) {\n colors[_i4 * 4 + 2] = borderColor[_i4] % maxColors;\n colors[_i4 * 4 + 3] = Math.floor(borderColor[_i4] / maxColors);\n }\n }\n }\n }\n colorBuffer({\n data: colors || new Uint8Array(0),\n type: \"uint8\",\n usage: \"dynamic\"\n });\n }\n return group;\n });\n };\n Scatter.prototype.addMarker = function(sdf) {\n var markerTextures = this.markerTextures, regl = this.regl, markerCache = this.markerCache;\n var pos = sdf == null ? 0 : markerCache.indexOf(sdf);\n if (pos >= 0) return pos;\n var distArr;\n if (sdf instanceof Uint8Array || sdf instanceof Uint8ClampedArray) {\n distArr = sdf;\n } else {\n distArr = new Uint8Array(sdf.length);\n for (var i = 0, l = sdf.length; i < l; i++) {\n distArr[i] = sdf[i] * 255;\n }\n }\n var radius = Math.floor(Math.sqrt(distArr.length));\n pos = markerTextures.length;\n markerCache.push(sdf);\n markerTextures.push(regl.texture({\n channels: 1,\n data: distArr,\n radius,\n mag: \"linear\",\n min: \"linear\"\n }));\n return pos;\n };\n Scatter.prototype.updateColor = function(colors) {\n var paletteIds = this.paletteIds, palette = this.palette, maxColors = this.maxColors;\n if (!Array.isArray(colors)) {\n colors = [colors];\n }\n var idx = [];\n if (typeof colors[0] === \"number\") {\n var grouped = [];\n if (Array.isArray(colors)) {\n for (var i = 0; i < colors.length; i += 4) {\n grouped.push(colors.slice(i, i + 4));\n }\n } else {\n for (var _i5 = 0; _i5 < colors.length; _i5 += 4) {\n grouped.push(colors.subarray(_i5, _i5 + 4));\n }\n }\n colors = grouped;\n }\n for (var _i6 = 0; _i6 < colors.length; _i6++) {\n var color2 = colors[_i6];\n color2 = rgba3(color2, \"uint8\");\n var id = colorId(color2, false);\n if (paletteIds[id] == null) {\n var pos = palette.length;\n paletteIds[id] = Math.floor(pos / 4);\n palette[pos] = color2[0];\n palette[pos + 1] = color2[1];\n palette[pos + 2] = color2[2];\n palette[pos + 3] = color2[3];\n }\n idx[_i6] = paletteIds[id];\n }\n if (!this.tooManyColors && palette.length > maxColors * 4) this.tooManyColors = true;\n this.updatePalette(palette);\n return idx.length === 1 ? idx[0] : idx;\n };\n Scatter.prototype.updatePalette = function(palette) {\n if (this.tooManyColors) return;\n var maxColors = this.maxColors, paletteTexture = this.paletteTexture;\n var requiredHeight = Math.ceil(palette.length * 0.25 / maxColors);\n if (requiredHeight > 1) {\n palette = palette.slice();\n for (var i = palette.length * 0.25 % maxColors; i < requiredHeight * maxColors; i++) {\n palette.push(0, 0, 0, 0);\n }\n }\n if (paletteTexture.height < requiredHeight) {\n paletteTexture.resize(maxColors, requiredHeight);\n }\n paletteTexture.subimage({\n width: Math.min(palette.length * 0.25, maxColors),\n height: requiredHeight,\n data: palette\n }, 0, 0);\n };\n Scatter.prototype.destroy = function() {\n this.groups.forEach(function(group) {\n group.sizeBuffer.destroy();\n group.positionBuffer.destroy();\n group.positionFractBuffer.destroy();\n group.colorBuffer.destroy();\n group.activation.forEach(function(b) {\n return b && b.destroy && b.destroy();\n });\n group.selectionBuffer.destroy();\n if (group.elements) group.elements.destroy();\n });\n this.groups.length = 0;\n this.paletteTexture.destroy();\n this.markerTextures.forEach(function(txt) {\n return txt && txt.destroy && txt.destroy();\n });\n return this;\n };\n var extend$1 = require_object_assign();\n var reglScatter2d = function reglScatter2d2(regl, options) {\n var scatter$1 = new scatter(regl, options);\n var render = scatter$1.render.bind(scatter$1);\n extend$1(render, {\n render,\n update: scatter$1.update.bind(scatter$1),\n draw: scatter$1.draw.bind(scatter$1),\n destroy: scatter$1.destroy.bind(scatter$1),\n regl: scatter$1.regl,\n gl: scatter$1.gl,\n canvas: scatter$1.gl.canvas,\n groups: scatter$1.groups,\n markers: scatter$1.markerCache,\n palette: scatter$1.palette\n });\n return render;\n };\n module.exports = reglScatter2d;\n }\n });\n\n // node_modules/earcut/src/earcut.js\n var require_earcut = __commonJS({\n \"node_modules/earcut/src/earcut.js\"(exports, module) {\n \"use strict\";\n module.exports = earcut;\n module.exports.default = earcut;\n function earcut(data, holeIndices, dim) {\n dim = dim || 2;\n var hasHoles = holeIndices && holeIndices.length, outerLen = hasHoles ? holeIndices[0] * dim : data.length, outerNode = linkedList(data, 0, outerLen, dim, true), triangles = [];\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n var minX, minY, maxX, maxY, x, y, invSize;\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\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 invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 32767 / invSize : 0;\n }\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);\n return triangles;\n }\n function linkedList(data, start, end, dim, clockwise) {\n var i, last;\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 if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n return last;\n }\n function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n var p = start, again;\n do {\n again = false;\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 } else {\n p = p.next;\n }\n } while (again || p !== end);\n return end;\n }\n function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n var stop = ear, prev, next;\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n triangles.push(prev.i / dim | 0);\n triangles.push(ear.i / dim | 0);\n triangles.push(next.i / dim | 0);\n removeNode(ear);\n ear = next.next;\n stop = next.next;\n continue;\n }\n ear = next;\n if (ear === stop) {\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n break;\n }\n }\n }\n function isEar(ear) {\n var a = ear.prev, b = ear, c = ear.next;\n if (area(a, b, c) >= 0) return false;\n var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;\n var p = c.next;\n while (p !== a) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n return true;\n }\n function isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev, b = ear, c = ear.next;\n if (area(a, b, c) >= 0) return false;\n var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;\n var minZ = zOrder(x0, y0, minX, minY, invSize), maxZ = zOrder(x1, y1, minX, minY, invSize);\n var p = ear.prevZ, n = ear.nextZ;\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 && 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 if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && 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 while (p && p.z >= minZ) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && 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 while (n && n.z <= maxZ) {\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && 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 return true;\n }\n function cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev, b = p.next.next;\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n triangles.push(a.i / dim | 0);\n triangles.push(p.i / dim | 0);\n triangles.push(b.i / dim | 0);\n removeNode(p);\n removeNode(p.next);\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n return filterPoints(p);\n }\n function splitEarcut(start, triangles, dim, minX, minY, invSize) {\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 var c = splitPolygon(a, b);\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\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 function eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [], i, len, start, end, list;\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 queue.sort(compareX);\n for (i = 0; i < queue.length; i++) {\n outerNode = eliminateHole(queue[i], outerNode);\n }\n return outerNode;\n }\n function compareX(a, b) {\n return a.x - b.x;\n }\n function eliminateHole(hole, outerNode) {\n var bridge = findHoleBridge(hole, outerNode);\n if (!bridge) {\n return outerNode;\n }\n var bridgeReverse = splitPolygon(bridge, hole);\n filterPoints(bridgeReverse, bridgeReverse.next);\n return filterPoints(bridge, bridge.next);\n }\n function findHoleBridge(hole, outerNode) {\n var p = outerNode, hx = hole.x, hy = hole.y, qx = -Infinity, m;\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;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n if (!m) return null;\n var stop = m, mx = m.x, my = m.y, tanMin = Infinity, tan;\n p = m;\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n tan = Math.abs(hy - p.y) / (hx - p.x);\n if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) {\n m = p;\n tanMin = tan;\n }\n }\n p = p.next;\n } while (p !== stop);\n return m;\n }\n function sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n }\n function 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 p.prevZ.nextZ = null;\n p.prevZ = null;\n sortLinked(p);\n }\n function sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize, inSize = 1;\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\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 while (pSize > 0 || qSize > 0 && q) {\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 if (tail) tail.nextZ = e;\n else list = e;\n e.prevZ = tail;\n tail = e;\n }\n p = q;\n }\n tail.nextZ = null;\n inSize *= 2;\n } while (numMerges > 1);\n return list;\n }\n function zOrder(x, y, minX, minY, invSize) {\n x = (x - minX) * invSize | 0;\n y = (y - minY) * invSize | 0;\n x = (x | x << 8) & 16711935;\n x = (x | x << 4) & 252645135;\n x = (x | x << 2) & 858993459;\n x = (x | x << 1) & 1431655765;\n y = (y | y << 8) & 16711935;\n y = (y | y << 4) & 252645135;\n y = (y | y << 2) & 858993459;\n y = (y | y << 1) & 1431655765;\n return x | y << 1;\n }\n function getLeftmost(start) {\n var p = start, 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 return leftmost;\n }\n function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);\n }\n function 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);\n }\n function area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n }\n function equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n }\n function 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 if (o1 !== o2 && o3 !== o4) return true;\n if (o1 === 0 && onSegment(p1, p2, q1)) return true;\n if (o2 === 0 && onSegment(p1, q2, q1)) return true;\n if (o3 === 0 && onSegment(p2, p1, q2)) return true;\n if (o4 === 0 && onSegment(p2, q1, q2)) return true;\n return false;\n }\n function 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 function sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n }\n function 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 && intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n return false;\n }\n function locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n }\n function middleInside(a, b) {\n var p = a, inside = false, px = (a.x + b.x) / 2, py = (a.y + b.y) / 2;\n do {\n if (p.y > py !== p.next.y > py && p.next.y !== p.y && 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 return inside;\n }\n function splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y), b2 = new Node(b.i, b.x, b.y), an = a.next, bp = b.prev;\n a.next = b;\n b.prev = a;\n a2.next = an;\n an.prev = a2;\n b2.next = a2;\n a2.prev = b2;\n bp.next = b2;\n b2.prev = bp;\n return b2;\n }\n function insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n if (!last) {\n p.prev = p;\n p.next = p;\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 function removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n }\n function Node(i, x, y) {\n this.i = i;\n this.x = x;\n this.y = y;\n this.prev = null;\n this.next = null;\n this.z = 0;\n this.prevZ = null;\n this.nextZ = null;\n this.steiner = false;\n }\n earcut.deviation = function(data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\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 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]) - (data[a] - data[b]) * (data[c + 1] - data[a + 1])\n );\n }\n return polygonArea === 0 && trianglesArea === 0 ? 0 : Math.abs((trianglesArea - polygonArea) / polygonArea);\n };\n function 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 earcut.flatten = function(data) {\n var dim = data[0][0].length, result = { vertices: [], holes: [], dimensions: dim }, holeIndex = 0;\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 }\n });\n\n // node_modules/array-normalize/index.js\n var require_array_normalize = __commonJS({\n \"node_modules/array-normalize/index.js\"(exports, module) {\n \"use strict\";\n var getBounds = require_array_bounds();\n module.exports = normalize;\n function normalize(arr, dim, bounds) {\n if (!arr || arr.length == null) throw Error(\"Argument should be an array\");\n if (dim == null) dim = 1;\n if (bounds == null) bounds = getBounds(arr, dim);\n for (var offset = 0; offset < dim; offset++) {\n var max = bounds[dim + offset], min = bounds[offset], i = offset, l = arr.length;\n if (max === Infinity && min === -Infinity) {\n for (i = offset; i < l; i += dim) {\n arr[i] = arr[i] === max ? 1 : arr[i] === min ? 0 : 0.5;\n }\n } else if (max === Infinity) {\n for (i = offset; i < l; i += dim) {\n arr[i] = arr[i] === max ? 1 : 0;\n }\n } else if (min === -Infinity) {\n for (i = offset; i < l; i += dim) {\n arr[i] = arr[i] === min ? 0 : 1;\n }\n } else {\n var range = max - min;\n for (i = offset; i < l; i += dim) {\n if (!isNaN(arr[i])) {\n arr[i] = range === 0 ? 0.5 : (arr[i] - min) / range;\n }\n }\n }\n }\n return arr;\n }\n }\n });\n\n // node_modules/es6-weak-map/is-implemented.js\n var require_is_implemented = __commonJS({\n \"node_modules/es6-weak-map/is-implemented.js\"(exports, module) {\n \"use strict\";\n module.exports = function() {\n var weakMap, obj;\n if (typeof WeakMap !== \"function\") return false;\n try {\n weakMap = new WeakMap([[obj = {}, \"one\"], [{}, \"two\"], [{}, \"three\"]]);\n } catch (e) {\n return false;\n }\n if (String(weakMap) !== \"[object WeakMap]\") return false;\n if (typeof weakMap.set !== \"function\") return false;\n if (weakMap.set({}, 1) !== weakMap) return false;\n if (typeof weakMap.delete !== \"function\") return false;\n if (typeof weakMap.has !== \"function\") return false;\n if (weakMap.get(obj) !== \"one\") return false;\n return true;\n };\n }\n });\n\n // node_modules/es5-ext/function/noop.js\n var require_noop2 = __commonJS({\n \"node_modules/es5-ext/function/noop.js\"(exports, module) {\n \"use strict\";\n module.exports = function() {\n };\n }\n });\n\n // node_modules/es5-ext/object/is-value.js\n var require_is_value = __commonJS({\n \"node_modules/es5-ext/object/is-value.js\"(exports, module) {\n \"use strict\";\n var _undefined = require_noop2()();\n module.exports = function(val) {\n return val !== _undefined && val !== null;\n };\n }\n });\n\n // node_modules/es5-ext/object/set-prototype-of/is-implemented.js\n var require_is_implemented2 = __commonJS({\n \"node_modules/es5-ext/object/set-prototype-of/is-implemented.js\"(exports, module) {\n \"use strict\";\n var create = Object.create;\n var getPrototypeOf = Object.getPrototypeOf;\n var plainObject = {};\n module.exports = function() {\n var setPrototypeOf = Object.setPrototypeOf, customCreate = arguments[0] || create;\n if (typeof setPrototypeOf !== \"function\") return false;\n return getPrototypeOf(setPrototypeOf(customCreate(null), plainObject)) === plainObject;\n };\n }\n });\n\n // node_modules/es5-ext/object/is-object.js\n var require_is_object = __commonJS({\n \"node_modules/es5-ext/object/is-object.js\"(exports, module) {\n \"use strict\";\n var isValue = require_is_value();\n var map = { function: true, object: true };\n module.exports = function(value) {\n return isValue(value) && map[typeof value] || false;\n };\n }\n });\n\n // node_modules/es5-ext/object/valid-value.js\n var require_valid_value = __commonJS({\n \"node_modules/es5-ext/object/valid-value.js\"(exports, module) {\n \"use strict\";\n var isValue = require_is_value();\n module.exports = function(value) {\n if (!isValue(value)) throw new TypeError(\"Cannot use null or undefined\");\n return value;\n };\n }\n });\n\n // node_modules/es5-ext/object/create.js\n var require_create2 = __commonJS({\n \"node_modules/es5-ext/object/create.js\"(exports, module) {\n \"use strict\";\n var create = Object.create;\n var shim;\n if (!require_is_implemented2()()) {\n shim = require_shim3();\n }\n module.exports = function() {\n var nullObject, polyProps, desc;\n if (!shim) return create;\n if (shim.level !== 1) return create;\n nullObject = {};\n polyProps = {};\n desc = { configurable: false, enumerable: false, writable: true, value: void 0 };\n Object.getOwnPropertyNames(Object.prototype).forEach(function(name2) {\n if (name2 === \"__proto__\") {\n polyProps[name2] = {\n configurable: true,\n enumerable: false,\n writable: true,\n value: void 0\n };\n return;\n }\n polyProps[name2] = desc;\n });\n Object.defineProperties(nullObject, polyProps);\n Object.defineProperty(shim, \"nullPolyfill\", {\n configurable: false,\n enumerable: false,\n writable: false,\n value: nullObject\n });\n return function(prototype, props) {\n return create(prototype === null ? nullObject : prototype, props);\n };\n }();\n }\n });\n\n // node_modules/es5-ext/object/set-prototype-of/shim.js\n var require_shim3 = __commonJS({\n \"node_modules/es5-ext/object/set-prototype-of/shim.js\"(exports, module) {\n \"use strict\";\n var isObject = require_is_object();\n var value = require_valid_value();\n var objIsPrototypeOf = Object.prototype.isPrototypeOf;\n var defineProperty = Object.defineProperty;\n var nullDesc = { configurable: true, enumerable: false, writable: true, value: void 0 };\n var validate;\n validate = function(obj, prototype) {\n value(obj);\n if (prototype === null || isObject(prototype)) return obj;\n throw new TypeError(\"Prototype must be null or an object\");\n };\n module.exports = function(status) {\n var fn, set;\n if (!status) return null;\n if (status.level === 2) {\n if (status.set) {\n set = status.set;\n fn = function(obj, prototype) {\n set.call(validate(obj, prototype), prototype);\n return obj;\n };\n } else {\n fn = function(obj, prototype) {\n validate(obj, prototype).__proto__ = prototype;\n return obj;\n };\n }\n } else {\n fn = function self2(obj, prototype) {\n var isNullBase;\n validate(obj, prototype);\n isNullBase = objIsPrototypeOf.call(self2.nullPolyfill, obj);\n if (isNullBase) delete self2.nullPolyfill.__proto__;\n if (prototype === null) prototype = self2.nullPolyfill;\n obj.__proto__ = prototype;\n if (isNullBase) defineProperty(self2.nullPolyfill, \"__proto__\", nullDesc);\n return obj;\n };\n }\n return Object.defineProperty(fn, \"level\", {\n configurable: false,\n enumerable: false,\n writable: false,\n value: status.level\n });\n }(\n function() {\n var tmpObj1 = /* @__PURE__ */ Object.create(null), tmpObj2 = {}, set, desc = Object.getOwnPropertyDescriptor(Object.prototype, \"__proto__\");\n if (desc) {\n try {\n set = desc.set;\n set.call(tmpObj1, tmpObj2);\n } catch (ignore) {\n }\n if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return { set, level: 2 };\n }\n tmpObj1.__proto__ = tmpObj2;\n if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return { level: 2 };\n tmpObj1 = {};\n tmpObj1.__proto__ = tmpObj2;\n if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return { level: 1 };\n return false;\n }()\n );\n require_create2();\n }\n });\n\n // node_modules/es5-ext/object/set-prototype-of/index.js\n var require_set_prototype_of = __commonJS({\n \"node_modules/es5-ext/object/set-prototype-of/index.js\"(exports, module) {\n \"use strict\";\n module.exports = require_is_implemented2()() ? Object.setPrototypeOf : require_shim3();\n }\n });\n\n // node_modules/es5-ext/object/valid-object.js\n var require_valid_object = __commonJS({\n \"node_modules/es5-ext/object/valid-object.js\"(exports, module) {\n \"use strict\";\n var isObject = require_is_object();\n module.exports = function(value) {\n if (!isObject(value)) throw new TypeError(value + \" is not an Object\");\n return value;\n };\n }\n });\n\n // node_modules/es5-ext/string/random-uniq.js\n var require_random_uniq = __commonJS({\n \"node_modules/es5-ext/string/random-uniq.js\"(exports, module) {\n \"use strict\";\n var generated = /* @__PURE__ */ Object.create(null);\n var random = Math.random;\n module.exports = function() {\n var str;\n do {\n str = random().toString(36).slice(2);\n } while (generated[str]);\n return str;\n };\n }\n });\n\n // node_modules/type/value/is.js\n var require_is = __commonJS({\n \"node_modules/type/value/is.js\"(exports, module) {\n \"use strict\";\n var _undefined = void 0;\n module.exports = function(value) {\n return value !== _undefined && value !== null;\n };\n }\n });\n\n // node_modules/type/object/is.js\n var require_is2 = __commonJS({\n \"node_modules/type/object/is.js\"(exports, module) {\n \"use strict\";\n var isValue = require_is();\n var possibleTypes = {\n \"object\": true,\n \"function\": true,\n \"undefined\": true\n /* document.all */\n };\n module.exports = function(value) {\n if (!isValue(value)) return false;\n return hasOwnProperty.call(possibleTypes, typeof value);\n };\n }\n });\n\n // node_modules/type/prototype/is.js\n var require_is3 = __commonJS({\n \"node_modules/type/prototype/is.js\"(exports, module) {\n \"use strict\";\n var isObject = require_is2();\n module.exports = function(value) {\n if (!isObject(value)) return false;\n try {\n if (!value.constructor) return false;\n return value.constructor.prototype === value;\n } catch (error) {\n return false;\n }\n };\n }\n });\n\n // node_modules/type/function/is.js\n var require_is4 = __commonJS({\n \"node_modules/type/function/is.js\"(exports, module) {\n \"use strict\";\n var isPrototype = require_is3();\n module.exports = function(value) {\n if (typeof value !== \"function\") return false;\n if (!hasOwnProperty.call(value, \"length\")) return false;\n try {\n if (typeof value.length !== \"number\") return false;\n if (typeof value.call !== \"function\") return false;\n if (typeof value.apply !== \"function\") return false;\n } catch (error) {\n return false;\n }\n return !isPrototype(value);\n };\n }\n });\n\n // node_modules/type/plain-function/is.js\n var require_is5 = __commonJS({\n \"node_modules/type/plain-function/is.js\"(exports, module) {\n \"use strict\";\n var isFunction = require_is4();\n var classRe = /^\\s*class[\\s{/}]/;\n var functionToString = Function.prototype.toString;\n module.exports = function(value) {\n if (!isFunction(value)) return false;\n if (classRe.test(functionToString.call(value))) return false;\n return true;\n };\n }\n });\n\n // node_modules/es5-ext/object/assign/is-implemented.js\n var require_is_implemented3 = __commonJS({\n \"node_modules/es5-ext/object/assign/is-implemented.js\"(exports, module) {\n \"use strict\";\n module.exports = function() {\n var assign = Object.assign, obj;\n if (typeof assign !== \"function\") return false;\n obj = { foo: \"raz\" };\n assign(obj, { bar: \"dwa\" }, { trzy: \"trzy\" });\n return obj.foo + obj.bar + obj.trzy === \"razdwatrzy\";\n };\n }\n });\n\n // node_modules/es5-ext/object/keys/is-implemented.js\n var require_is_implemented4 = __commonJS({\n \"node_modules/es5-ext/object/keys/is-implemented.js\"(exports, module) {\n \"use strict\";\n module.exports = function() {\n try {\n Object.keys(\"primitive\");\n return true;\n } catch (e) {\n return false;\n }\n };\n }\n });\n\n // node_modules/es5-ext/object/keys/shim.js\n var require_shim4 = __commonJS({\n \"node_modules/es5-ext/object/keys/shim.js\"(exports, module) {\n \"use strict\";\n var isValue = require_is_value();\n var keys = Object.keys;\n module.exports = function(object) {\n return keys(isValue(object) ? Object(object) : object);\n };\n }\n });\n\n // node_modules/es5-ext/object/keys/index.js\n var require_keys = __commonJS({\n \"node_modules/es5-ext/object/keys/index.js\"(exports, module) {\n \"use strict\";\n module.exports = require_is_implemented4()() ? Object.keys : require_shim4();\n }\n });\n\n // node_modules/es5-ext/object/assign/shim.js\n var require_shim5 = __commonJS({\n \"node_modules/es5-ext/object/assign/shim.js\"(exports, module) {\n \"use strict\";\n var keys = require_keys();\n var value = require_valid_value();\n var max = Math.max;\n module.exports = function(dest, src) {\n var error, i, length = max(arguments.length, 2), assign;\n dest = Object(value(dest));\n assign = function(key) {\n try {\n dest[key] = src[key];\n } catch (e) {\n if (!error) error = e;\n }\n };\n for (i = 1; i < length; ++i) {\n src = arguments[i];\n keys(src).forEach(assign);\n }\n if (error !== void 0) throw error;\n return dest;\n };\n }\n });\n\n // node_modules/es5-ext/object/assign/index.js\n var require_assign = __commonJS({\n \"node_modules/es5-ext/object/assign/index.js\"(exports, module) {\n \"use strict\";\n module.exports = require_is_implemented3()() ? Object.assign : require_shim5();\n }\n });\n\n // node_modules/es5-ext/object/normalize-options.js\n var require_normalize_options = __commonJS({\n \"node_modules/es5-ext/object/normalize-options.js\"(exports, module) {\n \"use strict\";\n var isValue = require_is_value();\n var forEach = Array.prototype.forEach;\n var create = Object.create;\n var process2 = function(src, obj) {\n var key;\n for (key in src) obj[key] = src[key];\n };\n module.exports = function(opts1) {\n var result = create(null);\n forEach.call(arguments, function(options) {\n if (!isValue(options)) return;\n process2(Object(options), result);\n });\n return result;\n };\n }\n });\n\n // node_modules/es5-ext/string/#/contains/is-implemented.js\n var require_is_implemented5 = __commonJS({\n \"node_modules/es5-ext/string/#/contains/is-implemented.js\"(exports, module) {\n \"use strict\";\n var str = \"razdwatrzy\";\n module.exports = function() {\n if (typeof str.contains !== \"function\") return false;\n return str.contains(\"dwa\") === true && str.contains(\"foo\") === false;\n };\n }\n });\n\n // node_modules/es5-ext/string/#/contains/shim.js\n var require_shim6 = __commonJS({\n \"node_modules/es5-ext/string/#/contains/shim.js\"(exports, module) {\n \"use strict\";\n var indexOf = String.prototype.indexOf;\n module.exports = function(searchString) {\n return indexOf.call(this, searchString, arguments[1]) > -1;\n };\n }\n });\n\n // node_modules/es5-ext/string/#/contains/index.js\n var require_contains = __commonJS({\n \"node_modules/es5-ext/string/#/contains/index.js\"(exports, module) {\n \"use strict\";\n module.exports = require_is_implemented5()() ? String.prototype.contains : require_shim6();\n }\n });\n\n // node_modules/d/index.js\n var require_d = __commonJS({\n \"node_modules/d/index.js\"(exports, module) {\n \"use strict\";\n var isValue = require_is();\n var isPlainFunction = require_is5();\n var assign = require_assign();\n var normalizeOpts = require_normalize_options();\n var contains = require_contains();\n var d = module.exports = function(dscr, value) {\n var c, e, w, options, desc;\n if (arguments.length < 2 || typeof dscr !== \"string\") {\n options = value;\n value = dscr;\n dscr = null;\n } else {\n options = arguments[2];\n }\n if (isValue(dscr)) {\n c = contains.call(dscr, \"c\");\n e = contains.call(dscr, \"e\");\n w = contains.call(dscr, \"w\");\n } else {\n c = w = true;\n e = false;\n }\n desc = { value, configurable: c, enumerable: e, writable: w };\n return !options ? desc : assign(normalizeOpts(options), desc);\n };\n d.gs = function(dscr, get, set) {\n var c, e, options, desc;\n if (typeof dscr !== \"string\") {\n options = set;\n set = get;\n get = dscr;\n dscr = null;\n } else {\n options = arguments[3];\n }\n if (!isValue(get)) {\n get = void 0;\n } else if (!isPlainFunction(get)) {\n options = get;\n get = set = void 0;\n } else if (!isValue(set)) {\n set = void 0;\n } else if (!isPlainFunction(set)) {\n options = set;\n set = void 0;\n }\n if (isValue(dscr)) {\n c = contains.call(dscr, \"c\");\n e = contains.call(dscr, \"e\");\n } else {\n c = true;\n e = false;\n }\n desc = { get, set, configurable: c, enumerable: e };\n return !options ? desc : assign(normalizeOpts(options), desc);\n };\n }\n });\n\n // node_modules/es5-ext/function/is-arguments.js\n var require_is_arguments2 = __commonJS({\n \"node_modules/es5-ext/function/is-arguments.js\"(exports, module) {\n \"use strict\";\n var objToString = Object.prototype.toString;\n var id = objToString.call(/* @__PURE__ */ function() {\n return arguments;\n }());\n module.exports = function(value) {\n return objToString.call(value) === id;\n };\n }\n });\n\n // node_modules/es5-ext/string/is-string.js\n var require_is_string = __commonJS({\n \"node_modules/es5-ext/string/is-string.js\"(exports, module) {\n \"use strict\";\n var objToString = Object.prototype.toString;\n var id = objToString.call(\"\");\n module.exports = function(value) {\n return typeof value === \"string\" || value && typeof value === \"object\" && (value instanceof String || objToString.call(value) === id) || false;\n };\n }\n });\n\n // node_modules/ext/global-this/is-implemented.js\n var require_is_implemented6 = __commonJS({\n \"node_modules/ext/global-this/is-implemented.js\"(exports, module) {\n \"use strict\";\n module.exports = function() {\n if (typeof globalThis !== \"object\") return false;\n if (!globalThis) return false;\n return globalThis.Array === Array;\n };\n }\n });\n\n // node_modules/ext/global-this/implementation.js\n var require_implementation6 = __commonJS({\n \"node_modules/ext/global-this/implementation.js\"(exports, module) {\n var naiveFallback = function() {\n if (typeof self === \"object\" && self) return self;\n if (typeof window === \"object\" && window) return window;\n throw new Error(\"Unable to resolve global `this`\");\n };\n module.exports = function() {\n if (this) return this;\n try {\n Object.defineProperty(Object.prototype, \"__global__\", {\n get: function() {\n return this;\n },\n configurable: true\n });\n } catch (error) {\n return naiveFallback();\n }\n try {\n if (!__global__) return naiveFallback();\n return __global__;\n } finally {\n delete Object.prototype.__global__;\n }\n }();\n }\n });\n\n // node_modules/ext/global-this/index.js\n var require_global_this = __commonJS({\n \"node_modules/ext/global-this/index.js\"(exports, module) {\n \"use strict\";\n module.exports = require_is_implemented6()() ? globalThis : require_implementation6();\n }\n });\n\n // node_modules/es6-symbol/is-implemented.js\n var require_is_implemented7 = __commonJS({\n \"node_modules/es6-symbol/is-implemented.js\"(exports, module) {\n \"use strict\";\n var global2 = require_global_this();\n var validTypes = { object: true, symbol: true };\n module.exports = function() {\n var Symbol2 = global2.Symbol;\n var symbol;\n if (typeof Symbol2 !== \"function\") return false;\n symbol = Symbol2(\"test symbol\");\n try {\n String(symbol);\n } catch (e) {\n return false;\n }\n if (!validTypes[typeof Symbol2.iterator]) return false;\n if (!validTypes[typeof Symbol2.toPrimitive]) return false;\n if (!validTypes[typeof Symbol2.toStringTag]) return false;\n return true;\n };\n }\n });\n\n // node_modules/es6-symbol/is-symbol.js\n var require_is_symbol = __commonJS({\n \"node_modules/es6-symbol/is-symbol.js\"(exports, module) {\n \"use strict\";\n module.exports = function(value) {\n if (!value) return false;\n if (typeof value === \"symbol\") return true;\n if (!value.constructor) return false;\n if (value.constructor.name !== \"Symbol\") return false;\n return value[value.constructor.toStringTag] === \"Symbol\";\n };\n }\n });\n\n // node_modules/es6-symbol/validate-symbol.js\n var require_validate_symbol = __commonJS({\n \"node_modules/es6-symbol/validate-symbol.js\"(exports, module) {\n \"use strict\";\n var isSymbol = require_is_symbol();\n module.exports = function(value) {\n if (!isSymbol(value)) throw new TypeError(value + \" is not a symbol\");\n return value;\n };\n }\n });\n\n // node_modules/es6-symbol/lib/private/generate-name.js\n var require_generate_name = __commonJS({\n \"node_modules/es6-symbol/lib/private/generate-name.js\"(exports, module) {\n \"use strict\";\n var d = require_d();\n var create = Object.create;\n var defineProperty = Object.defineProperty;\n var objPrototype = Object.prototype;\n var created = create(null);\n module.exports = function(desc) {\n var postfix = 0, name2, ie11BugWorkaround;\n while (created[desc + (postfix || \"\")]) ++postfix;\n desc += postfix || \"\";\n created[desc] = true;\n name2 = \"@@\" + desc;\n defineProperty(\n objPrototype,\n name2,\n d.gs(null, function(value) {\n if (ie11BugWorkaround) return;\n ie11BugWorkaround = true;\n defineProperty(this, name2, d(value));\n ie11BugWorkaround = false;\n })\n );\n return name2;\n };\n }\n });\n\n // node_modules/es6-symbol/lib/private/setup/standard-symbols.js\n var require_standard_symbols = __commonJS({\n \"node_modules/es6-symbol/lib/private/setup/standard-symbols.js\"(exports, module) {\n \"use strict\";\n var d = require_d();\n var NativeSymbol = require_global_this().Symbol;\n module.exports = function(SymbolPolyfill) {\n return Object.defineProperties(SymbolPolyfill, {\n // To ensure proper interoperability with other native functions (e.g. Array.from)\n // fallback to eventual native implementation of given symbol\n hasInstance: d(\n \"\",\n NativeSymbol && NativeSymbol.hasInstance || SymbolPolyfill(\"hasInstance\")\n ),\n isConcatSpreadable: d(\n \"\",\n NativeSymbol && NativeSymbol.isConcatSpreadable || SymbolPolyfill(\"isConcatSpreadable\")\n ),\n iterator: d(\"\", NativeSymbol && NativeSymbol.iterator || SymbolPolyfill(\"iterator\")),\n match: d(\"\", NativeSymbol && NativeSymbol.match || SymbolPolyfill(\"match\")),\n replace: d(\"\", NativeSymbol && NativeSymbol.replace || SymbolPolyfill(\"replace\")),\n search: d(\"\", NativeSymbol && NativeSymbol.search || SymbolPolyfill(\"search\")),\n species: d(\"\", NativeSymbol && NativeSymbol.species || SymbolPolyfill(\"species\")),\n split: d(\"\", NativeSymbol && NativeSymbol.split || SymbolPolyfill(\"split\")),\n toPrimitive: d(\n \"\",\n NativeSymbol && NativeSymbol.toPrimitive || SymbolPolyfill(\"toPrimitive\")\n ),\n toStringTag: d(\n \"\",\n NativeSymbol && NativeSymbol.toStringTag || SymbolPolyfill(\"toStringTag\")\n ),\n unscopables: d(\n \"\",\n NativeSymbol && NativeSymbol.unscopables || SymbolPolyfill(\"unscopables\")\n )\n });\n };\n }\n });\n\n // node_modules/es6-symbol/lib/private/setup/symbol-registry.js\n var require_symbol_registry = __commonJS({\n \"node_modules/es6-symbol/lib/private/setup/symbol-registry.js\"(exports, module) {\n \"use strict\";\n var d = require_d();\n var validateSymbol = require_validate_symbol();\n var registry = /* @__PURE__ */ Object.create(null);\n module.exports = function(SymbolPolyfill) {\n return Object.defineProperties(SymbolPolyfill, {\n for: d(function(key) {\n if (registry[key]) return registry[key];\n return registry[key] = SymbolPolyfill(String(key));\n }),\n keyFor: d(function(symbol) {\n var key;\n validateSymbol(symbol);\n for (key in registry) {\n if (registry[key] === symbol) return key;\n }\n return void 0;\n })\n });\n };\n }\n });\n\n // node_modules/es6-symbol/polyfill.js\n var require_polyfill4 = __commonJS({\n \"node_modules/es6-symbol/polyfill.js\"(exports, module) {\n \"use strict\";\n var d = require_d();\n var validateSymbol = require_validate_symbol();\n var NativeSymbol = require_global_this().Symbol;\n var generateName = require_generate_name();\n var setupStandardSymbols = require_standard_symbols();\n var setupSymbolRegistry = require_symbol_registry();\n var create = Object.create;\n var defineProperties = Object.defineProperties;\n var defineProperty = Object.defineProperty;\n var SymbolPolyfill;\n var HiddenSymbol;\n var isNativeSafe;\n if (typeof NativeSymbol === \"function\") {\n try {\n String(NativeSymbol());\n isNativeSafe = true;\n } catch (ignore) {\n }\n } else {\n NativeSymbol = null;\n }\n HiddenSymbol = function Symbol2(description) {\n if (this instanceof HiddenSymbol) throw new TypeError(\"Symbol is not a constructor\");\n return SymbolPolyfill(description);\n };\n module.exports = SymbolPolyfill = function Symbol2(description) {\n var symbol;\n if (this instanceof Symbol2) throw new TypeError(\"Symbol is not a constructor\");\n if (isNativeSafe) return NativeSymbol(description);\n symbol = create(HiddenSymbol.prototype);\n description = description === void 0 ? \"\" : String(description);\n return defineProperties(symbol, {\n __description__: d(\"\", description),\n __name__: d(\"\", generateName(description))\n });\n };\n setupStandardSymbols(SymbolPolyfill);\n setupSymbolRegistry(SymbolPolyfill);\n defineProperties(HiddenSymbol.prototype, {\n constructor: d(SymbolPolyfill),\n toString: d(\"\", function() {\n return this.__name__;\n })\n });\n defineProperties(SymbolPolyfill.prototype, {\n toString: d(function() {\n return \"Symbol (\" + validateSymbol(this).__description__ + \")\";\n }),\n valueOf: d(function() {\n return validateSymbol(this);\n })\n });\n defineProperty(\n SymbolPolyfill.prototype,\n SymbolPolyfill.toPrimitive,\n d(\"\", function() {\n var symbol = validateSymbol(this);\n if (typeof symbol === \"symbol\") return symbol;\n return symbol.toString();\n })\n );\n defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d(\"c\", \"Symbol\"));\n defineProperty(\n HiddenSymbol.prototype,\n SymbolPolyfill.toStringTag,\n d(\"c\", SymbolPolyfill.prototype[SymbolPolyfill.toStringTag])\n );\n defineProperty(\n HiddenSymbol.prototype,\n SymbolPolyfill.toPrimitive,\n d(\"c\", SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive])\n );\n }\n });\n\n // node_modules/es6-symbol/index.js\n var require_es6_symbol = __commonJS({\n \"node_modules/es6-symbol/index.js\"(exports, module) {\n \"use strict\";\n module.exports = require_is_implemented7()() ? require_global_this().Symbol : require_polyfill4();\n }\n });\n\n // node_modules/es5-ext/array/#/clear.js\n var require_clear = __commonJS({\n \"node_modules/es5-ext/array/#/clear.js\"(exports, module) {\n \"use strict\";\n var value = require_valid_value();\n module.exports = function() {\n value(this).length = 0;\n return this;\n };\n }\n });\n\n // node_modules/es5-ext/object/valid-callable.js\n var require_valid_callable = __commonJS({\n \"node_modules/es5-ext/object/valid-callable.js\"(exports, module) {\n \"use strict\";\n module.exports = function(fn) {\n if (typeof fn !== \"function\") throw new TypeError(fn + \" is not a function\");\n return fn;\n };\n }\n });\n\n // node_modules/type/string/coerce.js\n var require_coerce2 = __commonJS({\n \"node_modules/type/string/coerce.js\"(exports, module) {\n \"use strict\";\n var isValue = require_is();\n var isObject = require_is2();\n var objectToString = Object.prototype.toString;\n module.exports = function(value) {\n if (!isValue(value)) return null;\n if (isObject(value)) {\n var valueToString = value.toString;\n if (typeof valueToString !== \"function\") return null;\n if (valueToString === objectToString) return null;\n }\n try {\n return \"\" + value;\n } catch (error) {\n return null;\n }\n };\n }\n });\n\n // node_modules/type/lib/safe-to-string.js\n var require_safe_to_string = __commonJS({\n \"node_modules/type/lib/safe-to-string.js\"(exports, module) {\n \"use strict\";\n module.exports = function(value) {\n try {\n return value.toString();\n } catch (error) {\n try {\n return String(value);\n } catch (error2) {\n return null;\n }\n }\n };\n }\n });\n\n // node_modules/type/lib/to-short-string.js\n var require_to_short_string = __commonJS({\n \"node_modules/type/lib/to-short-string.js\"(exports, module) {\n \"use strict\";\n var safeToString = require_safe_to_string();\n var reNewLine = /[\\n\\r\\u2028\\u2029]/g;\n module.exports = function(value) {\n var string = safeToString(value);\n if (string === null) return \"\";\n if (string.length > 100) string = string.slice(0, 99) + \"\\u2026\";\n string = string.replace(reNewLine, function(char) {\n switch (char) {\n case \"\\n\":\n return \"\\\\n\";\n case \"\\r\":\n return \"\\\\r\";\n case \"\\u2028\":\n return \"\\\\u2028\";\n case \"\\u2029\":\n return \"\\\\u2029\";\n /* istanbul ignore next */\n default:\n throw new Error(\"Unexpected character\");\n }\n });\n return string;\n };\n }\n });\n\n // node_modules/type/lib/resolve-exception.js\n var require_resolve_exception = __commonJS({\n \"node_modules/type/lib/resolve-exception.js\"(exports, module) {\n \"use strict\";\n var isValue = require_is();\n var isObject = require_is2();\n var stringCoerce = require_coerce2();\n var toShortString = require_to_short_string();\n var resolveMessage = function(message, value) {\n return message.replace(\"%v\", toShortString(value));\n };\n module.exports = function(value, defaultMessage, inputOptions) {\n if (!isObject(inputOptions)) throw new TypeError(resolveMessage(defaultMessage, value));\n if (!isValue(value)) {\n if (\"default\" in inputOptions) return inputOptions[\"default\"];\n if (inputOptions.isOptional) return null;\n }\n var errorMessage = stringCoerce(inputOptions.errorMessage);\n if (!isValue(errorMessage)) errorMessage = defaultMessage;\n throw new TypeError(resolveMessage(errorMessage, value));\n };\n }\n });\n\n // node_modules/type/value/ensure.js\n var require_ensure = __commonJS({\n \"node_modules/type/value/ensure.js\"(exports, module) {\n \"use strict\";\n var resolveException = require_resolve_exception();\n var is = require_is();\n module.exports = function(value) {\n if (is(value)) return value;\n return resolveException(value, \"Cannot use %v\", arguments[1]);\n };\n }\n });\n\n // node_modules/type/plain-function/ensure.js\n var require_ensure2 = __commonJS({\n \"node_modules/type/plain-function/ensure.js\"(exports, module) {\n \"use strict\";\n var resolveException = require_resolve_exception();\n var is = require_is5();\n module.exports = function(value) {\n if (is(value)) return value;\n return resolveException(value, \"%v is not a plain function\", arguments[1]);\n };\n }\n });\n\n // node_modules/es5-ext/array/from/is-implemented.js\n var require_is_implemented8 = __commonJS({\n \"node_modules/es5-ext/array/from/is-implemented.js\"(exports, module) {\n \"use strict\";\n module.exports = function() {\n var from = Array.from, arr, result;\n if (typeof from !== \"function\") return false;\n arr = [\"raz\", \"dwa\"];\n result = from(arr);\n return Boolean(result && result !== arr && result[1] === \"dwa\");\n };\n }\n });\n\n // node_modules/es5-ext/function/is-function.js\n var require_is_function = __commonJS({\n \"node_modules/es5-ext/function/is-function.js\"(exports, module) {\n \"use strict\";\n var objToString = Object.prototype.toString;\n var isFunctionStringTag = RegExp.prototype.test.bind(/^[object [A-Za-z0-9]*Function]$/);\n module.exports = function(value) {\n return typeof value === \"function\" && isFunctionStringTag(objToString.call(value));\n };\n }\n });\n\n // node_modules/es5-ext/math/sign/is-implemented.js\n var require_is_implemented9 = __commonJS({\n \"node_modules/es5-ext/math/sign/is-implemented.js\"(exports, module) {\n \"use strict\";\n module.exports = function() {\n var sign = Math.sign;\n if (typeof sign !== \"function\") return false;\n return sign(10) === 1 && sign(-20) === -1;\n };\n }\n });\n\n // node_modules/es5-ext/math/sign/shim.js\n var require_shim7 = __commonJS({\n \"node_modules/es5-ext/math/sign/shim.js\"(exports, module) {\n \"use strict\";\n module.exports = function(value) {\n value = Number(value);\n if (isNaN(value) || value === 0) return value;\n return value > 0 ? 1 : -1;\n };\n }\n });\n\n // node_modules/es5-ext/math/sign/index.js\n var require_sign = __commonJS({\n \"node_modules/es5-ext/math/sign/index.js\"(exports, module) {\n \"use strict\";\n module.exports = require_is_implemented9()() ? Math.sign : require_shim7();\n }\n });\n\n // node_modules/es5-ext/number/to-integer.js\n var require_to_integer = __commonJS({\n \"node_modules/es5-ext/number/to-integer.js\"(exports, module) {\n \"use strict\";\n var sign = require_sign();\n var abs = Math.abs;\n var floor = Math.floor;\n module.exports = function(value) {\n if (isNaN(value)) return 0;\n value = Number(value);\n if (value === 0 || !isFinite(value)) return value;\n return sign(value) * floor(abs(value));\n };\n }\n });\n\n // node_modules/es5-ext/number/to-pos-integer.js\n var require_to_pos_integer = __commonJS({\n \"node_modules/es5-ext/number/to-pos-integer.js\"(exports, module) {\n \"use strict\";\n var toInteger = require_to_integer();\n var max = Math.max;\n module.exports = function(value) {\n return max(0, toInteger(value));\n };\n }\n });\n\n // node_modules/es5-ext/array/from/shim.js\n var require_shim8 = __commonJS({\n \"node_modules/es5-ext/array/from/shim.js\"(exports, module) {\n \"use strict\";\n var iteratorSymbol = require_es6_symbol().iterator;\n var isArguments = require_is_arguments2();\n var isFunction = require_is_function();\n var toPosInt = require_to_pos_integer();\n var callable = require_valid_callable();\n var validValue = require_valid_value();\n var isValue = require_is_value();\n var isString = require_is_string();\n var isArray = Array.isArray;\n var call = Function.prototype.call;\n var desc = { configurable: true, enumerable: true, writable: true, value: null };\n var defineProperty = Object.defineProperty;\n module.exports = function(arrayLike) {\n var mapFn = arguments[1], thisArg = arguments[2], Context, i, j, arr, length, code, iterator, result, getIterator, value;\n arrayLike = Object(validValue(arrayLike));\n if (isValue(mapFn)) callable(mapFn);\n if (!this || this === Array || !isFunction(this)) {\n if (!mapFn) {\n if (isArguments(arrayLike)) {\n length = arrayLike.length;\n if (length !== 1) return Array.apply(null, arrayLike);\n arr = new Array(1);\n arr[0] = arrayLike[0];\n return arr;\n }\n if (isArray(arrayLike)) {\n arr = new Array(length = arrayLike.length);\n for (i = 0; i < length; ++i) arr[i] = arrayLike[i];\n return arr;\n }\n }\n arr = [];\n } else {\n Context = this;\n }\n if (!isArray(arrayLike)) {\n if ((getIterator = arrayLike[iteratorSymbol]) !== void 0) {\n iterator = callable(getIterator).call(arrayLike);\n if (Context) arr = new Context();\n result = iterator.next();\n i = 0;\n while (!result.done) {\n value = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value;\n if (Context) {\n desc.value = value;\n defineProperty(arr, i, desc);\n } else {\n arr[i] = value;\n }\n result = iterator.next();\n ++i;\n }\n length = i;\n } else if (isString(arrayLike)) {\n length = arrayLike.length;\n if (Context) arr = new Context();\n for (i = 0, j = 0; i < length; ++i) {\n value = arrayLike[i];\n if (i + 1 < length) {\n code = value.charCodeAt(0);\n if (code >= 55296 && code <= 56319) value += arrayLike[++i];\n }\n value = mapFn ? call.call(mapFn, thisArg, value, j) : value;\n if (Context) {\n desc.value = value;\n defineProperty(arr, j, desc);\n } else {\n arr[j] = value;\n }\n ++j;\n }\n length = j;\n }\n }\n if (length === void 0) {\n length = toPosInt(arrayLike.length);\n if (Context) arr = new Context(length);\n for (i = 0; i < length; ++i) {\n value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i];\n if (Context) {\n desc.value = value;\n defineProperty(arr, i, desc);\n } else {\n arr[i] = value;\n }\n }\n }\n if (Context) {\n desc.value = null;\n arr.length = length;\n }\n return arr;\n };\n }\n });\n\n // node_modules/es5-ext/array/from/index.js\n var require_from = __commonJS({\n \"node_modules/es5-ext/array/from/index.js\"(exports, module) {\n \"use strict\";\n module.exports = require_is_implemented8()() ? Array.from : require_shim8();\n }\n });\n\n // node_modules/es5-ext/object/copy.js\n var require_copy2 = __commonJS({\n \"node_modules/es5-ext/object/copy.js\"(exports, module) {\n \"use strict\";\n var aFrom = require_from();\n var assign = require_assign();\n var value = require_valid_value();\n module.exports = function(obj) {\n var copy = Object(value(obj)), propertyNames = arguments[1], options = Object(arguments[2]);\n if (copy !== obj && !propertyNames) return copy;\n var result = {};\n if (propertyNames) {\n aFrom(propertyNames, function(propertyName) {\n if (options.ensure || propertyName in obj) result[propertyName] = obj[propertyName];\n });\n } else {\n assign(result, obj);\n }\n return result;\n };\n }\n });\n\n // node_modules/es5-ext/object/_iterate.js\n var require_iterate = __commonJS({\n \"node_modules/es5-ext/object/_iterate.js\"(exports, module) {\n \"use strict\";\n var callable = require_valid_callable();\n var value = require_valid_value();\n var bind = Function.prototype.bind;\n var call = Function.prototype.call;\n var keys = Object.keys;\n var objPropertyIsEnumerable = Object.prototype.propertyIsEnumerable;\n module.exports = function(method, defVal) {\n return function(obj, cb) {\n var list, thisArg = arguments[2], compareFn = arguments[3];\n obj = Object(value(obj));\n callable(cb);\n list = keys(obj);\n if (compareFn) {\n list.sort(typeof compareFn === \"function\" ? bind.call(compareFn, obj) : void 0);\n }\n if (typeof method !== \"function\") method = list[method];\n return call.call(method, list, function(key, index) {\n if (!objPropertyIsEnumerable.call(obj, key)) return defVal;\n return call.call(cb, thisArg, obj[key], key, obj, index);\n });\n };\n };\n }\n });\n\n // node_modules/es5-ext/object/for-each.js\n var require_for_each2 = __commonJS({\n \"node_modules/es5-ext/object/for-each.js\"(exports, module) {\n \"use strict\";\n module.exports = require_iterate()(\"forEach\");\n }\n });\n\n // node_modules/es5-ext/object/map.js\n var require_map = __commonJS({\n \"node_modules/es5-ext/object/map.js\"(exports, module) {\n \"use strict\";\n var callable = require_valid_callable();\n var forEach = require_for_each2();\n var call = Function.prototype.call;\n module.exports = function(obj, cb) {\n var result = {}, thisArg = arguments[2];\n callable(cb);\n forEach(obj, function(value, key, targetObj, index) {\n result[key] = call.call(cb, thisArg, value, key, targetObj, index);\n });\n return result;\n };\n }\n });\n\n // node_modules/d/auto-bind.js\n var require_auto_bind = __commonJS({\n \"node_modules/d/auto-bind.js\"(exports, module) {\n \"use strict\";\n var isValue = require_is();\n var ensureValue = require_ensure();\n var ensurePlainFunction = require_ensure2();\n var copy = require_copy2();\n var normalizeOptions = require_normalize_options();\n var map = require_map();\n var bind = Function.prototype.bind;\n var defineProperty = Object.defineProperty;\n var hasOwnProperty2 = Object.prototype.hasOwnProperty;\n var define2;\n define2 = function(name2, desc, options) {\n var value = ensureValue(desc) && ensurePlainFunction(desc.value), dgs;\n dgs = copy(desc);\n delete dgs.writable;\n delete dgs.value;\n dgs.get = function() {\n if (!options.overwriteDefinition && hasOwnProperty2.call(this, name2)) return value;\n desc.value = bind.call(value, options.resolveContext ? options.resolveContext(this) : this);\n defineProperty(this, name2, desc);\n return this[name2];\n };\n return dgs;\n };\n module.exports = function(props) {\n var options = normalizeOptions(arguments[1]);\n if (isValue(options.resolveContext)) ensurePlainFunction(options.resolveContext);\n return map(props, function(desc, name2) {\n return define2(name2, desc, options);\n });\n };\n }\n });\n\n // node_modules/es6-iterator/index.js\n var require_es6_iterator = __commonJS({\n \"node_modules/es6-iterator/index.js\"(exports, module) {\n \"use strict\";\n var clear = require_clear();\n var assign = require_assign();\n var callable = require_valid_callable();\n var value = require_valid_value();\n var d = require_d();\n var autoBind = require_auto_bind();\n var Symbol2 = require_es6_symbol();\n var defineProperty = Object.defineProperty;\n var defineProperties = Object.defineProperties;\n var Iterator;\n module.exports = Iterator = function(list, context) {\n if (!(this instanceof Iterator)) throw new TypeError(\"Constructor requires 'new'\");\n defineProperties(this, {\n __list__: d(\"w\", value(list)),\n __context__: d(\"w\", context),\n __nextIndex__: d(\"w\", 0)\n });\n if (!context) return;\n callable(context.on);\n context.on(\"_add\", this._onAdd);\n context.on(\"_delete\", this._onDelete);\n context.on(\"_clear\", this._onClear);\n };\n delete Iterator.prototype.constructor;\n defineProperties(\n Iterator.prototype,\n assign(\n {\n _next: d(function() {\n var i;\n if (!this.__list__) return void 0;\n if (this.__redo__) {\n i = this.__redo__.shift();\n if (i !== void 0) return i;\n }\n if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++;\n this._unBind();\n return void 0;\n }),\n next: d(function() {\n return this._createResult(this._next());\n }),\n _createResult: d(function(i) {\n if (i === void 0) return { done: true, value: void 0 };\n return { done: false, value: this._resolve(i) };\n }),\n _resolve: d(function(i) {\n return this.__list__[i];\n }),\n _unBind: d(function() {\n this.__list__ = null;\n delete this.__redo__;\n if (!this.__context__) return;\n this.__context__.off(\"_add\", this._onAdd);\n this.__context__.off(\"_delete\", this._onDelete);\n this.__context__.off(\"_clear\", this._onClear);\n this.__context__ = null;\n }),\n toString: d(function() {\n return \"[object \" + (this[Symbol2.toStringTag] || \"Object\") + \"]\";\n })\n },\n autoBind({\n _onAdd: d(function(index) {\n if (index >= this.__nextIndex__) return;\n ++this.__nextIndex__;\n if (!this.__redo__) {\n defineProperty(this, \"__redo__\", d(\"c\", [index]));\n return;\n }\n this.__redo__.forEach(function(redo, i) {\n if (redo >= index) this.__redo__[i] = ++redo;\n }, this);\n this.__redo__.push(index);\n }),\n _onDelete: d(function(index) {\n var i;\n if (index >= this.__nextIndex__) return;\n --this.__nextIndex__;\n if (!this.__redo__) return;\n i = this.__redo__.indexOf(index);\n if (i !== -1) this.__redo__.splice(i, 1);\n this.__redo__.forEach(function(redo, j) {\n if (redo > index) this.__redo__[j] = --redo;\n }, this);\n }),\n _onClear: d(function() {\n if (this.__redo__) clear.call(this.__redo__);\n this.__nextIndex__ = 0;\n })\n })\n )\n );\n defineProperty(\n Iterator.prototype,\n Symbol2.iterator,\n d(function() {\n return this;\n })\n );\n }\n });\n\n // node_modules/es6-iterator/array.js\n var require_array2 = __commonJS({\n \"node_modules/es6-iterator/array.js\"(exports, module) {\n \"use strict\";\n var setPrototypeOf = require_set_prototype_of();\n var contains = require_contains();\n var d = require_d();\n var Symbol2 = require_es6_symbol();\n var Iterator = require_es6_iterator();\n var defineProperty = Object.defineProperty;\n var ArrayIterator;\n ArrayIterator = module.exports = function(arr, kind) {\n if (!(this instanceof ArrayIterator)) throw new TypeError(\"Constructor requires 'new'\");\n Iterator.call(this, arr);\n if (!kind) kind = \"value\";\n else if (contains.call(kind, \"key+value\")) kind = \"key+value\";\n else if (contains.call(kind, \"key\")) kind = \"key\";\n else kind = \"value\";\n defineProperty(this, \"__kind__\", d(\"\", kind));\n };\n if (setPrototypeOf) setPrototypeOf(ArrayIterator, Iterator);\n delete ArrayIterator.prototype.constructor;\n ArrayIterator.prototype = Object.create(Iterator.prototype, {\n _resolve: d(function(i) {\n if (this.__kind__ === \"value\") return this.__list__[i];\n if (this.__kind__ === \"key+value\") return [i, this.__list__[i]];\n return i;\n })\n });\n defineProperty(ArrayIterator.prototype, Symbol2.toStringTag, d(\"c\", \"Array Iterator\"));\n }\n });\n\n // node_modules/es6-iterator/string.js\n var require_string = __commonJS({\n \"node_modules/es6-iterator/string.js\"(exports, module) {\n \"use strict\";\n var setPrototypeOf = require_set_prototype_of();\n var d = require_d();\n var Symbol2 = require_es6_symbol();\n var Iterator = require_es6_iterator();\n var defineProperty = Object.defineProperty;\n var StringIterator;\n StringIterator = module.exports = function(str) {\n if (!(this instanceof StringIterator)) throw new TypeError(\"Constructor requires 'new'\");\n str = String(str);\n Iterator.call(this, str);\n defineProperty(this, \"__length__\", d(\"\", str.length));\n };\n if (setPrototypeOf) setPrototypeOf(StringIterator, Iterator);\n delete StringIterator.prototype.constructor;\n StringIterator.prototype = Object.create(Iterator.prototype, {\n _next: d(function() {\n if (!this.__list__) return void 0;\n if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++;\n this._unBind();\n return void 0;\n }),\n _resolve: d(function(i) {\n var char = this.__list__[i], code;\n if (this.__nextIndex__ === this.__length__) return char;\n code = char.charCodeAt(0);\n if (code >= 55296 && code <= 56319) return char + this.__list__[this.__nextIndex__++];\n return char;\n })\n });\n defineProperty(StringIterator.prototype, Symbol2.toStringTag, d(\"c\", \"String Iterator\"));\n }\n });\n\n // node_modules/es6-iterator/is-iterable.js\n var require_is_iterable = __commonJS({\n \"node_modules/es6-iterator/is-iterable.js\"(exports, module) {\n \"use strict\";\n var isArguments = require_is_arguments2();\n var isValue = require_is_value();\n var isString = require_is_string();\n var iteratorSymbol = require_es6_symbol().iterator;\n var isArray = Array.isArray;\n module.exports = function(value) {\n if (!isValue(value)) return false;\n if (isArray(value)) return true;\n if (isString(value)) return true;\n if (isArguments(value)) return true;\n return typeof value[iteratorSymbol] === \"function\";\n };\n }\n });\n\n // node_modules/es6-iterator/valid-iterable.js\n var require_valid_iterable = __commonJS({\n \"node_modules/es6-iterator/valid-iterable.js\"(exports, module) {\n \"use strict\";\n var isIterable = require_is_iterable();\n module.exports = function(value) {\n if (!isIterable(value)) throw new TypeError(value + \" is not iterable\");\n return value;\n };\n }\n });\n\n // node_modules/es6-iterator/get.js\n var require_get = __commonJS({\n \"node_modules/es6-iterator/get.js\"(exports, module) {\n \"use strict\";\n var isArguments = require_is_arguments2();\n var isString = require_is_string();\n var ArrayIterator = require_array2();\n var StringIterator = require_string();\n var iterable = require_valid_iterable();\n var iteratorSymbol = require_es6_symbol().iterator;\n module.exports = function(obj) {\n if (typeof iterable(obj)[iteratorSymbol] === \"function\") return obj[iteratorSymbol]();\n if (isArguments(obj)) return new ArrayIterator(obj);\n if (isString(obj)) return new StringIterator(obj);\n return new ArrayIterator(obj);\n };\n }\n });\n\n // node_modules/es6-iterator/for-of.js\n var require_for_of = __commonJS({\n \"node_modules/es6-iterator/for-of.js\"(exports, module) {\n \"use strict\";\n var isArguments = require_is_arguments2();\n var callable = require_valid_callable();\n var isString = require_is_string();\n var get = require_get();\n var isArray = Array.isArray;\n var call = Function.prototype.call;\n var some = Array.prototype.some;\n module.exports = function(iterable, cb) {\n var mode, thisArg = arguments[2], result, doBreak, broken, i, length, char, code;\n if (isArray(iterable) || isArguments(iterable)) mode = \"array\";\n else if (isString(iterable)) mode = \"string\";\n else iterable = get(iterable);\n callable(cb);\n doBreak = function() {\n broken = true;\n };\n if (mode === \"array\") {\n some.call(iterable, function(value) {\n call.call(cb, thisArg, value, doBreak);\n return broken;\n });\n return;\n }\n if (mode === \"string\") {\n length = iterable.length;\n for (i = 0; i < length; ++i) {\n char = iterable[i];\n if (i + 1 < length) {\n code = char.charCodeAt(0);\n if (code >= 55296 && code <= 56319) char += iterable[++i];\n }\n call.call(cb, thisArg, char, doBreak);\n if (broken) break;\n }\n return;\n }\n result = iterable.next();\n while (!result.done) {\n call.call(cb, thisArg, result.value, doBreak);\n if (broken) return;\n result = iterable.next();\n }\n };\n }\n });\n\n // node_modules/es6-weak-map/is-native-implemented.js\n var require_is_native_implemented = __commonJS({\n \"node_modules/es6-weak-map/is-native-implemented.js\"(exports, module) {\n \"use strict\";\n module.exports = function() {\n if (typeof WeakMap !== \"function\") return false;\n return Object.prototype.toString.call(/* @__PURE__ */ new WeakMap()) === \"[object WeakMap]\";\n }();\n }\n });\n\n // node_modules/es6-weak-map/polyfill.js\n var require_polyfill5 = __commonJS({\n \"node_modules/es6-weak-map/polyfill.js\"(exports, module) {\n \"use strict\";\n var isValue = require_is_value();\n var setPrototypeOf = require_set_prototype_of();\n var object = require_valid_object();\n var ensureValue = require_valid_value();\n var randomUniq = require_random_uniq();\n var d = require_d();\n var getIterator = require_get();\n var forOf = require_for_of();\n var toStringTagSymbol = require_es6_symbol().toStringTag;\n var isNative = require_is_native_implemented();\n var isArray = Array.isArray;\n var defineProperty = Object.defineProperty;\n var objHasOwnProperty = Object.prototype.hasOwnProperty;\n var getPrototypeOf = Object.getPrototypeOf;\n var WeakMapPoly;\n module.exports = WeakMapPoly = function() {\n var iterable = arguments[0], self2;\n if (!(this instanceof WeakMapPoly)) throw new TypeError(\"Constructor requires 'new'\");\n self2 = isNative && setPrototypeOf && WeakMap !== WeakMapPoly ? setPrototypeOf(/* @__PURE__ */ new WeakMap(), getPrototypeOf(this)) : this;\n if (isValue(iterable)) {\n if (!isArray(iterable)) iterable = getIterator(iterable);\n }\n defineProperty(self2, \"__weakMapData__\", d(\"c\", \"$weakMap$\" + randomUniq()));\n if (!iterable) return self2;\n forOf(iterable, function(val) {\n ensureValue(val);\n self2.set(val[0], val[1]);\n });\n return self2;\n };\n if (isNative) {\n if (setPrototypeOf) setPrototypeOf(WeakMapPoly, WeakMap);\n WeakMapPoly.prototype = Object.create(WeakMap.prototype, { constructor: d(WeakMapPoly) });\n }\n Object.defineProperties(WeakMapPoly.prototype, {\n delete: d(function(key) {\n if (objHasOwnProperty.call(object(key), this.__weakMapData__)) {\n delete key[this.__weakMapData__];\n return true;\n }\n return false;\n }),\n get: d(function(key) {\n if (!objHasOwnProperty.call(object(key), this.__weakMapData__)) return void 0;\n return key[this.__weakMapData__];\n }),\n has: d(function(key) {\n return objHasOwnProperty.call(object(key), this.__weakMapData__);\n }),\n set: d(function(key, value) {\n defineProperty(object(key), this.__weakMapData__, d(\"c\", value));\n return this;\n }),\n toString: d(function() {\n return \"[object WeakMap]\";\n })\n });\n defineProperty(WeakMapPoly.prototype, toStringTagSymbol, d(\"c\", \"WeakMap\"));\n }\n });\n\n // node_modules/es6-weak-map/index.js\n var require_es6_weak_map = __commonJS({\n \"node_modules/es6-weak-map/index.js\"(exports, module) {\n \"use strict\";\n module.exports = require_is_implemented()() ? WeakMap : require_polyfill5();\n }\n });\n\n // node_modules/array-find-index/index.js\n var require_array_find_index = __commonJS({\n \"node_modules/array-find-index/index.js\"(exports, module) {\n \"use strict\";\n module.exports = function(arr, predicate, ctx) {\n if (typeof Array.prototype.findIndex === \"function\") {\n return arr.findIndex(predicate, ctx);\n }\n if (typeof predicate !== \"function\") {\n throw new TypeError(\"predicate must be a function\");\n }\n var list = Object(arr);\n var len = list.length;\n if (len === 0) {\n return -1;\n }\n for (var i = 0; i < len; i++) {\n if (predicate.call(ctx, list[i], i, list)) {\n return i;\n }\n }\n return -1;\n };\n }\n });\n\n // node_modules/regl-line2d/index.js\n var require_regl_line2d = __commonJS({\n \"node_modules/regl-line2d/index.js\"(exports, module) {\n \"use strict\";\n var rgba3 = require_color_normalize();\n var getBounds = require_array_bounds();\n var extend2 = require_object_assign();\n var pick = require_pick_by_alias();\n var flatten = require_flatten_vertex_data();\n var triangulate = require_earcut();\n var normalize = require_array_normalize();\n var { float32, fract32 } = require_to_float32();\n var WeakMap2 = require_es6_weak_map();\n var parseRect = require_parse_rect();\n var findIndex = require_array_find_index();\n var rectVert = `\nprecision highp float;\n\nattribute vec2 aCoord, bCoord, aCoordFract, bCoordFract;\nattribute vec4 color;\nattribute float lineEnd, lineTop;\n\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float thickness, pixelRatio, id, depth;\nuniform vec4 viewport;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\n\nvec2 project(vec2 position, vec2 positionFract, vec2 scale, vec2 scaleFract, vec2 translate, vec2 translateFract) {\n\t// the order is important\n\treturn position * scale + translate\n + positionFract * scale + translateFract\n + position * scaleFract\n + positionFract * scaleFract;\n}\n\nvoid main() {\n\tfloat lineStart = 1. - lineEnd;\n\tfloat lineOffset = lineTop * 2. - 1.;\n\n\tvec2 diff = (bCoord + bCoordFract - aCoord - aCoordFract);\n\ttangent = normalize(diff * scale * viewport.zw);\n\tvec2 normal = vec2(-tangent.y, tangent.x);\n\n\tvec2 position = project(aCoord, aCoordFract, scale, scaleFract, translate, translateFract) * lineStart\n\t\t+ project(bCoord, bCoordFract, scale, scaleFract, translate, translateFract) * lineEnd\n\n\t\t+ thickness * normal * .5 * lineOffset / viewport.zw;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tfragColor = color / 255.;\n}\n`;\n var rectFrag = `\nprecision highp float;\n\nuniform float dashLength, pixelRatio, thickness, opacity, id;\nuniform sampler2D dashTexture;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\n\nvoid main() {\n\tfloat alpha = 1.;\n\n\tfloat t = fract(dot(tangent, gl_FragCoord.xy) / dashLength) * .5 + .25;\n\tfloat dash = texture2D(dashTexture, vec2(t, .5)).r;\n\n\tgl_FragColor = fragColor;\n\tgl_FragColor.a *= alpha * opacity * dash;\n}\n`;\n var fillVert = `\nprecision highp float;\n\nattribute vec2 position, positionFract;\n\nuniform vec4 color;\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio, id;\nuniform vec4 viewport;\nuniform float opacity;\n\nvarying vec4 fragColor;\n\nconst float MAX_LINES = 256.;\n\nvoid main() {\n\tfloat depth = (MAX_LINES - 4. - id) / (MAX_LINES);\n\n\tvec2 position = position * scale + translate\n + positionFract * scale + translateFract\n + position * scaleFract\n + positionFract * scaleFract;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tfragColor = color / 255.;\n\tfragColor.a *= opacity;\n}\n`;\n var fillFrag = `\nprecision highp float;\nvarying vec4 fragColor;\n\nvoid main() {\n\tgl_FragColor = fragColor;\n}\n`;\n var milterVert = `\nprecision highp float;\n\nattribute vec2 aCoord, bCoord, nextCoord, prevCoord;\nattribute vec4 aColor, bColor;\nattribute float lineEnd, lineTop;\n\nuniform vec2 scale, translate;\nuniform float thickness, pixelRatio, id, depth;\nuniform vec4 viewport;\nuniform float miterLimit, miterMode;\n\nvarying vec4 fragColor;\nvarying vec4 startCutoff, endCutoff;\nvarying vec2 tangent;\nvarying vec2 startCoord, endCoord;\nvarying float enableStartMiter, enableEndMiter;\n\nconst float REVERSE_THRESHOLD = -.875;\nconst float MIN_DIFF = 1e-6;\n\n// TODO: possible optimizations: avoid overcalculating all for vertices and calc just one instead\n// TODO: precalculate dot products, normalize things beforehead etc.\n// TODO: refactor to rectangular algorithm\n\nfloat distToLine(vec2 p, vec2 a, vec2 b) {\n\tvec2 diff = b - a;\n\tvec2 perp = normalize(vec2(-diff.y, diff.x));\n\treturn dot(p - a, perp);\n}\n\nbool isNaN( float val ){\n return ( val < 0.0 || 0.0 < val || val == 0.0 ) ? false : true;\n}\n\nvoid main() {\n\tvec2 aCoord = aCoord, bCoord = bCoord, prevCoord = prevCoord, nextCoord = nextCoord;\n\n vec2 adjustedScale;\n adjustedScale.x = (abs(scale.x) < MIN_DIFF) ? MIN_DIFF : scale.x;\n adjustedScale.y = (abs(scale.y) < MIN_DIFF) ? MIN_DIFF : scale.y;\n\n vec2 scaleRatio = adjustedScale * viewport.zw;\n\tvec2 normalWidth = thickness / scaleRatio;\n\n\tfloat lineStart = 1. - lineEnd;\n\tfloat lineBot = 1. - lineTop;\n\n\tfragColor = (lineStart * aColor + lineEnd * bColor) / 255.;\n\n\tif (isNaN(aCoord.x) || isNaN(aCoord.y) || isNaN(bCoord.x) || isNaN(bCoord.y)) return;\n\n\tif (aCoord == prevCoord) prevCoord = aCoord + normalize(bCoord - aCoord);\n\tif (bCoord == nextCoord) nextCoord = bCoord - normalize(bCoord - aCoord);\n\n\n\tvec2 prevDiff = aCoord - prevCoord;\n\tvec2 currDiff = bCoord - aCoord;\n\tvec2 nextDiff = nextCoord - bCoord;\n\n\tvec2 prevTangent = normalize(prevDiff * scaleRatio);\n\tvec2 currTangent = normalize(currDiff * scaleRatio);\n\tvec2 nextTangent = normalize(nextDiff * scaleRatio);\n\n\tvec2 prevNormal = vec2(-prevTangent.y, prevTangent.x);\n\tvec2 currNormal = vec2(-currTangent.y, currTangent.x);\n\tvec2 nextNormal = vec2(-nextTangent.y, nextTangent.x);\n\n\tvec2 startJoinDirection = normalize(prevTangent - currTangent);\n\tvec2 endJoinDirection = normalize(currTangent - nextTangent);\n\n\t// collapsed/unidirectional segment cases\n\t// FIXME: there should be more elegant solution\n\tvec2 prevTanDiff = abs(prevTangent - currTangent);\n\tvec2 nextTanDiff = abs(nextTangent - currTangent);\n\tif (max(prevTanDiff.x, prevTanDiff.y) < MIN_DIFF) {\n\t\tstartJoinDirection = currNormal;\n\t}\n\tif (max(nextTanDiff.x, nextTanDiff.y) < MIN_DIFF) {\n\t\tendJoinDirection = currNormal;\n\t}\n\tif (aCoord == bCoord) {\n\t\tendJoinDirection = startJoinDirection;\n\t\tcurrNormal = prevNormal;\n\t\tcurrTangent = prevTangent;\n\t}\n\n\ttangent = currTangent;\n\n\t//calculate join shifts relative to normals\n\tfloat startJoinShift = dot(currNormal, startJoinDirection);\n\tfloat endJoinShift = dot(currNormal, endJoinDirection);\n\n\tfloat startMiterRatio = abs(1. / startJoinShift);\n\tfloat endMiterRatio = abs(1. / endJoinShift);\n\n\tvec2 startJoin = startJoinDirection * startMiterRatio;\n\tvec2 endJoin = endJoinDirection * endMiterRatio;\n\n\tvec2 startTopJoin, startBotJoin, endTopJoin, endBotJoin;\n\tstartTopJoin = sign(startJoinShift) * startJoin * .5;\n\tstartBotJoin = -startTopJoin;\n\n\tendTopJoin = sign(endJoinShift) * endJoin * .5;\n\tendBotJoin = -endTopJoin;\n\n\tvec2 aTopCoord = aCoord + normalWidth * startTopJoin;\n\tvec2 bTopCoord = bCoord + normalWidth * endTopJoin;\n\tvec2 aBotCoord = aCoord + normalWidth * startBotJoin;\n\tvec2 bBotCoord = bCoord + normalWidth * endBotJoin;\n\n\t//miter anti-clipping\n\tfloat baClipping = distToLine(bCoord, aCoord, aBotCoord) / dot(normalize(normalWidth * endBotJoin), normalize(normalWidth.yx * vec2(-startBotJoin.y, startBotJoin.x)));\n\tfloat abClipping = distToLine(aCoord, bCoord, bTopCoord) / dot(normalize(normalWidth * startBotJoin), normalize(normalWidth.yx * vec2(-endBotJoin.y, endBotJoin.x)));\n\n\t//prevent close to reverse direction switch\n\tbool prevReverse = dot(currTangent, prevTangent) <= REVERSE_THRESHOLD && abs(dot(currTangent, prevNormal)) * min(length(prevDiff), length(currDiff)) < length(normalWidth * currNormal);\n\tbool nextReverse = dot(currTangent, nextTangent) <= REVERSE_THRESHOLD && abs(dot(currTangent, nextNormal)) * min(length(nextDiff), length(currDiff)) < length(normalWidth * currNormal);\n\n\tif (prevReverse) {\n\t\t//make join rectangular\n\t\tvec2 miterShift = normalWidth * startJoinDirection * miterLimit * .5;\n\t\tfloat normalAdjust = 1. - min(miterLimit / startMiterRatio, 1.);\n\t\taBotCoord = aCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;\n\t\taTopCoord = aCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;\n\t}\n\telse if (!nextReverse && baClipping > 0. && baClipping < length(normalWidth * endBotJoin)) {\n\t\t//handle miter clipping\n\t\tbTopCoord -= normalWidth * endTopJoin;\n\t\tbTopCoord += normalize(endTopJoin * normalWidth) * baClipping;\n\t}\n\n\tif (nextReverse) {\n\t\t//make join rectangular\n\t\tvec2 miterShift = normalWidth * endJoinDirection * miterLimit * .5;\n\t\tfloat normalAdjust = 1. - min(miterLimit / endMiterRatio, 1.);\n\t\tbBotCoord = bCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;\n\t\tbTopCoord = bCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;\n\t}\n\telse if (!prevReverse && abClipping > 0. && abClipping < length(normalWidth * startBotJoin)) {\n\t\t//handle miter clipping\n\t\taBotCoord -= normalWidth * startBotJoin;\n\t\taBotCoord += normalize(startBotJoin * normalWidth) * abClipping;\n\t}\n\n\tvec2 aTopPosition = (aTopCoord) * adjustedScale + translate;\n\tvec2 aBotPosition = (aBotCoord) * adjustedScale + translate;\n\n\tvec2 bTopPosition = (bTopCoord) * adjustedScale + translate;\n\tvec2 bBotPosition = (bBotCoord) * adjustedScale + translate;\n\n\t//position is normalized 0..1 coord on the screen\n\tvec2 position = (aTopPosition * lineTop + aBotPosition * lineBot) * lineStart + (bTopPosition * lineTop + bBotPosition * lineBot) * lineEnd;\n\n\tstartCoord = aCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\tendCoord = bCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tenableStartMiter = step(dot(currTangent, prevTangent), .5);\n\tenableEndMiter = step(dot(currTangent, nextTangent), .5);\n\n\t//bevel miter cutoffs\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * miterLimit * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * miterLimit * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n\n\t//round miter cutoffs\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * abs(dot(startJoinDirection, currNormal)) * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * abs(dot(endJoinDirection, currNormal)) * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n}\n`;\n var milterFrag = `\nprecision highp float;\n\nuniform float dashLength, pixelRatio, thickness, opacity, id, miterMode;\nuniform sampler2D dashTexture;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\nvarying vec4 startCutoff, endCutoff;\nvarying vec2 startCoord, endCoord;\nvarying float enableStartMiter, enableEndMiter;\n\nfloat distToLine(vec2 p, vec2 a, vec2 b) {\n\tvec2 diff = b - a;\n\tvec2 perp = normalize(vec2(-diff.y, diff.x));\n\treturn dot(p - a, perp);\n}\n\nvoid main() {\n\tfloat alpha = 1., distToStart, distToEnd;\n\tfloat cutoff = thickness * .5;\n\n\t//bevel miter\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToStart + 1., 0.), 1.);\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToEnd + 1., 0.), 1.);\n\t\t}\n\t}\n\n\t// round miter\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - startCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - endCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\t}\n\n\tfloat t = fract(dot(tangent, gl_FragCoord.xy) / dashLength) * .5 + .25;\n\tfloat dash = texture2D(dashTexture, vec2(t, .5)).r;\n\n\tgl_FragColor = fragColor;\n\tgl_FragColor.a *= alpha * opacity * dash;\n}\n`;\n module.exports = Line2D;\n function Line2D(regl, options) {\n if (!(this instanceof Line2D)) return new Line2D(regl, options);\n if (typeof regl === \"function\") {\n if (!options) options = {};\n options.regl = regl;\n } else {\n options = regl;\n }\n if (options.length) options.positions = options;\n regl = options.regl;\n if (!regl.hasExtension(\"ANGLE_instanced_arrays\")) {\n throw Error(\"regl-error2d: `ANGLE_instanced_arrays` extension should be enabled\");\n }\n this.gl = regl._gl;\n this.regl = regl;\n this.passes = [];\n this.shaders = Line2D.shaders.has(regl) ? Line2D.shaders.get(regl) : Line2D.shaders.set(regl, Line2D.createShaders(regl)).get(regl);\n this.update(options);\n }\n Line2D.dashMult = 2;\n Line2D.maxPatternLength = 256;\n Line2D.precisionThreshold = 3e6;\n Line2D.maxPoints = 1e4;\n Line2D.maxLines = 2048;\n Line2D.shaders = new WeakMap2();\n Line2D.createShaders = function(regl) {\n let offsetBuffer = regl.buffer({\n usage: \"static\",\n type: \"float\",\n data: [0, 1, 0, 0, 1, 1, 1, 0]\n });\n let shaderOptions = {\n primitive: \"triangle strip\",\n instances: regl.prop(\"count\"),\n count: 4,\n offset: 0,\n uniforms: {\n miterMode: (ctx, prop) => prop.join === \"round\" ? 2 : 1,\n miterLimit: regl.prop(\"miterLimit\"),\n scale: regl.prop(\"scale\"),\n scaleFract: regl.prop(\"scaleFract\"),\n translateFract: regl.prop(\"translateFract\"),\n translate: regl.prop(\"translate\"),\n thickness: regl.prop(\"thickness\"),\n dashTexture: regl.prop(\"dashTexture\"),\n opacity: regl.prop(\"opacity\"),\n pixelRatio: regl.context(\"pixelRatio\"),\n id: regl.prop(\"id\"),\n dashLength: regl.prop(\"dashLength\"),\n viewport: (c, p) => [p.viewport.x, p.viewport.y, c.viewportWidth, c.viewportHeight],\n depth: regl.prop(\"depth\")\n },\n blend: {\n enable: true,\n color: [0, 0, 0, 0],\n equation: {\n rgb: \"add\",\n alpha: \"add\"\n },\n func: {\n srcRGB: \"src alpha\",\n dstRGB: \"one minus src alpha\",\n srcAlpha: \"one minus dst alpha\",\n dstAlpha: \"one\"\n }\n },\n depth: {\n enable: (c, p) => {\n return !p.overlay;\n }\n },\n stencil: { enable: false },\n scissor: {\n enable: true,\n box: regl.prop(\"viewport\")\n },\n viewport: regl.prop(\"viewport\")\n };\n let drawRectLine = regl(extend2({\n vert: rectVert,\n frag: rectFrag,\n attributes: {\n // if point is at the end of segment\n lineEnd: {\n buffer: offsetBuffer,\n divisor: 0,\n stride: 8,\n offset: 0\n },\n // if point is at the top of segment\n lineTop: {\n buffer: offsetBuffer,\n divisor: 0,\n stride: 8,\n offset: 4\n },\n // beginning of line coordinate\n aCoord: {\n buffer: regl.prop(\"positionBuffer\"),\n stride: 8,\n offset: 8,\n divisor: 1\n },\n // end of line coordinate\n bCoord: {\n buffer: regl.prop(\"positionBuffer\"),\n stride: 8,\n offset: 16,\n divisor: 1\n },\n aCoordFract: {\n buffer: regl.prop(\"positionFractBuffer\"),\n stride: 8,\n offset: 8,\n divisor: 1\n },\n bCoordFract: {\n buffer: regl.prop(\"positionFractBuffer\"),\n stride: 8,\n offset: 16,\n divisor: 1\n },\n color: {\n buffer: regl.prop(\"colorBuffer\"),\n stride: 4,\n offset: 0,\n divisor: 1\n }\n }\n }, shaderOptions));\n let drawMiterLine;\n try {\n drawMiterLine = regl(extend2({\n // culling removes polygon creasing\n cull: {\n enable: true,\n face: \"back\"\n },\n vert: milterVert,\n frag: milterFrag,\n attributes: {\n // is line end\n lineEnd: {\n buffer: offsetBuffer,\n divisor: 0,\n stride: 8,\n offset: 0\n },\n // is line top\n lineTop: {\n buffer: offsetBuffer,\n divisor: 0,\n stride: 8,\n offset: 4\n },\n // left color\n aColor: {\n buffer: regl.prop(\"colorBuffer\"),\n stride: 4,\n offset: 0,\n divisor: 1\n },\n // right color\n bColor: {\n buffer: regl.prop(\"colorBuffer\"),\n stride: 4,\n offset: 4,\n divisor: 1\n },\n prevCoord: {\n buffer: regl.prop(\"positionBuffer\"),\n stride: 8,\n offset: 0,\n divisor: 1\n },\n aCoord: {\n buffer: regl.prop(\"positionBuffer\"),\n stride: 8,\n offset: 8,\n divisor: 1\n },\n bCoord: {\n buffer: regl.prop(\"positionBuffer\"),\n stride: 8,\n offset: 16,\n divisor: 1\n },\n nextCoord: {\n buffer: regl.prop(\"positionBuffer\"),\n stride: 8,\n offset: 24,\n divisor: 1\n }\n }\n }, shaderOptions));\n } catch (e) {\n drawMiterLine = drawRectLine;\n }\n let drawFill = regl({\n primitive: \"triangle\",\n elements: (ctx, prop) => prop.triangles,\n offset: 0,\n vert: fillVert,\n frag: fillFrag,\n uniforms: {\n scale: regl.prop(\"scale\"),\n color: regl.prop(\"fill\"),\n scaleFract: regl.prop(\"scaleFract\"),\n translateFract: regl.prop(\"translateFract\"),\n translate: regl.prop(\"translate\"),\n opacity: regl.prop(\"opacity\"),\n pixelRatio: regl.context(\"pixelRatio\"),\n id: regl.prop(\"id\"),\n viewport: (ctx, prop) => [prop.viewport.x, prop.viewport.y, ctx.viewportWidth, ctx.viewportHeight]\n },\n attributes: {\n position: {\n buffer: regl.prop(\"positionBuffer\"),\n stride: 8,\n offset: 8\n },\n positionFract: {\n buffer: regl.prop(\"positionFractBuffer\"),\n stride: 8,\n offset: 8\n }\n },\n blend: shaderOptions.blend,\n depth: { enable: false },\n scissor: shaderOptions.scissor,\n stencil: shaderOptions.stencil,\n viewport: shaderOptions.viewport\n });\n return {\n fill: drawFill,\n rect: drawRectLine,\n miter: drawMiterLine\n };\n };\n Line2D.defaults = {\n dashes: null,\n join: \"miter\",\n miterLimit: 1,\n thickness: 10,\n cap: \"square\",\n color: \"black\",\n opacity: 1,\n overlay: false,\n viewport: null,\n range: null,\n close: false,\n fill: null\n };\n Line2D.prototype.render = function(...args) {\n if (args.length) {\n this.update(...args);\n }\n this.draw();\n };\n Line2D.prototype.draw = function(...args) {\n (args.length ? args : this.passes).forEach((s, i) => {\n if (s && Array.isArray(s)) return this.draw(...s);\n if (typeof s === \"number\") s = this.passes[s];\n if (!(s && s.count > 1 && s.opacity)) return;\n this.regl._refresh();\n if (s.fill && s.triangles && s.triangles.length > 2) {\n this.shaders.fill(s);\n }\n if (!s.thickness) return;\n if (s.scale[0] * s.viewport.width > Line2D.precisionThreshold || s.scale[1] * s.viewport.height > Line2D.precisionThreshold) {\n this.shaders.rect(s);\n } else if (s.join === \"rect\" || !s.join && (s.thickness <= 2 || s.count >= Line2D.maxPoints)) {\n this.shaders.rect(s);\n } else {\n this.shaders.miter(s);\n }\n });\n return this;\n };\n Line2D.prototype.update = function(options) {\n if (!options) return;\n if (options.length != null) {\n if (typeof options[0] === \"number\") options = [{ positions: options }];\n } else if (!Array.isArray(options)) options = [options];\n let { regl, gl: gl2 } = this;\n options.forEach((o, i) => {\n let state = this.passes[i];\n if (o === void 0) return;\n if (o === null) {\n this.passes[i] = null;\n return;\n }\n if (typeof o[0] === \"number\") o = { positions: o };\n o = pick(o, {\n positions: \"positions points data coords\",\n thickness: \"thickness lineWidth lineWidths line-width linewidth width stroke-width strokewidth strokeWidth\",\n join: \"lineJoin linejoin join type mode\",\n miterLimit: \"miterlimit miterLimit\",\n dashes: \"dash dashes dasharray dash-array dashArray\",\n color: \"color colour stroke colors colours stroke-color strokeColor\",\n fill: \"fill fill-color fillColor\",\n opacity: \"alpha opacity\",\n overlay: \"overlay crease overlap intersect\",\n close: \"closed close closed-path closePath\",\n range: \"range dataBox\",\n viewport: \"viewport viewBox\",\n hole: \"holes hole hollow\",\n splitNull: \"splitNull\"\n });\n if (!state) {\n this.passes[i] = state = {\n id: i,\n scale: null,\n scaleFract: null,\n translate: null,\n translateFract: null,\n count: 0,\n hole: [],\n depth: 0,\n dashLength: 1,\n dashTexture: regl.texture({\n channels: 1,\n data: new Uint8Array([255]),\n width: 1,\n height: 1,\n mag: \"linear\",\n min: \"linear\"\n }),\n colorBuffer: regl.buffer({\n usage: \"dynamic\",\n type: \"uint8\",\n data: new Uint8Array()\n }),\n positionBuffer: regl.buffer({\n usage: \"dynamic\",\n type: \"float\",\n data: new Uint8Array()\n }),\n positionFractBuffer: regl.buffer({\n usage: \"dynamic\",\n type: \"float\",\n data: new Uint8Array()\n })\n };\n o = extend2({}, Line2D.defaults, o);\n }\n if (o.thickness != null) state.thickness = parseFloat(o.thickness);\n if (o.opacity != null) state.opacity = parseFloat(o.opacity);\n if (o.miterLimit != null) state.miterLimit = parseFloat(o.miterLimit);\n if (o.overlay != null) {\n state.overlay = !!o.overlay;\n if (i < Line2D.maxLines) {\n state.depth = 2 * (Line2D.maxLines - 1 - i % Line2D.maxLines) / Line2D.maxLines - 1;\n }\n }\n if (o.join != null) state.join = o.join;\n if (o.hole != null) state.hole = o.hole;\n if (o.fill != null) state.fill = !o.fill ? null : rgba3(o.fill, \"uint8\");\n if (o.viewport != null) state.viewport = parseRect(o.viewport);\n if (!state.viewport) {\n state.viewport = parseRect([\n gl2.drawingBufferWidth,\n gl2.drawingBufferHeight\n ]);\n }\n if (o.close != null) state.close = o.close;\n if (o.positions === null) o.positions = [];\n if (o.positions) {\n let positions, count;\n if (o.positions.x && o.positions.y) {\n let xPos = o.positions.x;\n let yPos = o.positions.y;\n count = state.count = Math.max(\n xPos.length,\n yPos.length\n );\n positions = new Float64Array(count * 2);\n for (let i2 = 0; i2 < count; i2++) {\n positions[i2 * 2] = xPos[i2];\n positions[i2 * 2 + 1] = yPos[i2];\n }\n } else {\n positions = flatten(o.positions, \"float64\");\n count = state.count = Math.floor(positions.length / 2);\n }\n let bounds = state.bounds = getBounds(positions, 2);\n if (state.fill) {\n let pos = [];\n let ids = {};\n let lastId = 0;\n for (let i2 = 0, ptr = 0, l = state.count; i2 < l; i2++) {\n let x = positions[i2 * 2];\n let y = positions[i2 * 2 + 1];\n if (isNaN(x) || isNaN(y) || x == null || y == null) {\n x = positions[lastId * 2];\n y = positions[lastId * 2 + 1];\n ids[i2] = lastId;\n } else {\n lastId = i2;\n }\n pos[ptr++] = x;\n pos[ptr++] = y;\n }\n if (o.splitNull) {\n if (!(state.count - 1 in ids)) ids[state.count] = state.count - 1;\n let splits = Object.keys(ids).map(Number).sort((a, b) => a - b);\n let split_triangles = [];\n let base = 0;\n let hole_base = state.hole != null ? state.hole[0] : null;\n if (hole_base != null) {\n let last_id = findIndex(splits, (e) => e >= hole_base);\n splits = splits.slice(0, last_id);\n splits.push(hole_base);\n }\n for (let i2 = 0; i2 < splits.length; i2++) {\n let seg_pos = pos.slice(base * 2, splits[i2] * 2).concat(\n hole_base ? pos.slice(hole_base * 2) : []\n );\n let hole = (state.hole || []).map((e) => e - hole_base + (splits[i2] - base));\n let triangles = triangulate(seg_pos, hole);\n triangles = triangles.map(\n (e) => e + base + (e + base < splits[i2] ? 0 : hole_base - splits[i2])\n );\n split_triangles.push(...triangles);\n base = splits[i2] + 1;\n }\n for (let i2 = 0, l = split_triangles.length; i2 < l; i2++) {\n if (ids[split_triangles[i2]] != null) split_triangles[i2] = ids[split_triangles[i2]];\n }\n state.triangles = split_triangles;\n } else {\n let triangles = triangulate(pos, state.hole || []);\n for (let i2 = 0, l = triangles.length; i2 < l; i2++) {\n if (ids[triangles[i2]] != null) triangles[i2] = ids[triangles[i2]];\n }\n state.triangles = triangles;\n }\n }\n let npos = new Float64Array(positions);\n normalize(npos, 2, bounds);\n let positionData = new Float64Array(count * 2 + 6);\n if (state.close) {\n if (positions[0] === positions[count * 2 - 2] && positions[1] === positions[count * 2 - 1]) {\n positionData[0] = npos[count * 2 - 4];\n positionData[1] = npos[count * 2 - 3];\n } else {\n positionData[0] = npos[count * 2 - 2];\n positionData[1] = npos[count * 2 - 1];\n }\n } else {\n positionData[0] = npos[0];\n positionData[1] = npos[1];\n }\n positionData.set(npos, 2);\n if (state.close) {\n if (positions[0] === positions[count * 2 - 2] && positions[1] === positions[count * 2 - 1]) {\n positionData[count * 2 + 2] = npos[2];\n positionData[count * 2 + 3] = npos[3];\n state.count -= 1;\n } else {\n positionData[count * 2 + 2] = npos[0];\n positionData[count * 2 + 3] = npos[1];\n positionData[count * 2 + 4] = npos[2];\n positionData[count * 2 + 5] = npos[3];\n }\n } else {\n positionData[count * 2 + 2] = npos[count * 2 - 2];\n positionData[count * 2 + 3] = npos[count * 2 - 1];\n positionData[count * 2 + 4] = npos[count * 2 - 2];\n positionData[count * 2 + 5] = npos[count * 2 - 1];\n }\n var float_data = float32(positionData);\n state.positionBuffer(float_data);\n var frac_data = fract32(positionData, float_data);\n state.positionFractBuffer(frac_data);\n }\n if (o.range) {\n state.range = o.range;\n } else if (!state.range) {\n state.range = state.bounds;\n }\n if ((o.range || o.positions) && state.count) {\n let bounds = state.bounds;\n let boundsW = bounds[2] - bounds[0], boundsH = bounds[3] - bounds[1];\n let rangeW = state.range[2] - state.range[0], rangeH = state.range[3] - state.range[1];\n state.scale = [\n boundsW / rangeW,\n boundsH / rangeH\n ];\n state.translate = [\n -state.range[0] / rangeW + bounds[0] / rangeW || 0,\n -state.range[1] / rangeH + bounds[1] / rangeH || 0\n ];\n state.scaleFract = fract32(state.scale);\n state.translateFract = fract32(state.translate);\n }\n if (o.dashes) {\n let dashLength = 0, dashData;\n if (!o.dashes || o.dashes.length < 2) {\n dashLength = 1;\n dashData = new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255]);\n } else {\n dashLength = 0;\n for (let i2 = 0; i2 < o.dashes.length; ++i2) {\n dashLength += o.dashes[i2];\n }\n dashData = new Uint8Array(dashLength * Line2D.dashMult);\n let ptr = 0;\n let fillColor = 255;\n for (let k = 0; k < 2; k++) {\n for (let i2 = 0; i2 < o.dashes.length; ++i2) {\n for (let j = 0, l = o.dashes[i2] * Line2D.dashMult * 0.5; j < l; ++j) {\n dashData[ptr++] = fillColor;\n }\n fillColor ^= 255;\n }\n }\n }\n state.dashLength = dashLength;\n state.dashTexture({\n channels: 1,\n data: dashData,\n width: dashData.length,\n height: 1,\n mag: \"linear\",\n min: \"linear\"\n }, 0, 0);\n }\n if (o.color) {\n let count = state.count;\n let colors = o.color;\n if (!colors) colors = \"transparent\";\n let colorData = new Uint8Array(count * 4 + 4);\n if (!Array.isArray(colors) || typeof colors[0] === \"number\") {\n let c = rgba3(colors, \"uint8\");\n for (let i2 = 0; i2 < count + 1; i2++) {\n colorData.set(c, i2 * 4);\n }\n } else {\n for (let i2 = 0; i2 < count; i2++) {\n let c = rgba3(colors[i2], \"uint8\");\n colorData.set(c, i2 * 4);\n }\n colorData.set(rgba3(colors[0], \"uint8\"), count * 4);\n }\n state.colorBuffer({\n usage: \"dynamic\",\n type: \"uint8\",\n data: colorData\n });\n }\n });\n if (options.length < this.passes.length) {\n for (let i = options.length; i < this.passes.length; i++) {\n let pass = this.passes[i];\n if (!pass) continue;\n pass.colorBuffer.destroy();\n pass.positionBuffer.destroy();\n pass.dashTexture.destroy();\n }\n this.passes.length = options.length;\n }\n let passes = [];\n for (let i = 0; i < this.passes.length; i++) {\n if (this.passes[i] !== null) passes.push(this.passes[i]);\n }\n this.passes = passes;\n return this;\n };\n Line2D.prototype.destroy = function() {\n this.passes.forEach((pass) => {\n pass.colorBuffer.destroy();\n pass.positionBuffer.destroy();\n pass.dashTexture.destroy();\n });\n this.passes.length = 0;\n return this;\n };\n }\n });\n\n // node_modules/regl-error2d/index.js\n var require_regl_error2d = __commonJS({\n \"node_modules/regl-error2d/index.js\"(exports, module) {\n \"use strict\";\n var getBounds = require_array_bounds();\n var rgba3 = require_color_normalize();\n var updateDiff = require_update_diff();\n var pick = require_pick_by_alias();\n var extend2 = require_object_assign();\n var flatten = require_flatten_vertex_data();\n var { float32, fract32 } = require_to_float32();\n module.exports = Error2D;\n var WEIGHTS = [\n //direction, lineWidth shift, capSize shift\n // x-error bar\n [1, 0, 0, 1, 0, 0],\n [1, 0, 0, -1, 0, 0],\n [-1, 0, 0, -1, 0, 0],\n [-1, 0, 0, -1, 0, 0],\n [-1, 0, 0, 1, 0, 0],\n [1, 0, 0, 1, 0, 0],\n // x-error right cap\n [1, 0, -1, 0, 0, 1],\n [1, 0, -1, 0, 0, -1],\n [1, 0, 1, 0, 0, -1],\n [1, 0, 1, 0, 0, -1],\n [1, 0, 1, 0, 0, 1],\n [1, 0, -1, 0, 0, 1],\n // x-error left cap\n [-1, 0, -1, 0, 0, 1],\n [-1, 0, -1, 0, 0, -1],\n [-1, 0, 1, 0, 0, -1],\n [-1, 0, 1, 0, 0, -1],\n [-1, 0, 1, 0, 0, 1],\n [-1, 0, -1, 0, 0, 1],\n // y-error bar\n [0, 1, 1, 0, 0, 0],\n [0, 1, -1, 0, 0, 0],\n [0, -1, -1, 0, 0, 0],\n [0, -1, -1, 0, 0, 0],\n [0, 1, 1, 0, 0, 0],\n [0, -1, 1, 0, 0, 0],\n // y-error top cap\n [0, 1, 0, -1, 1, 0],\n [0, 1, 0, -1, -1, 0],\n [0, 1, 0, 1, -1, 0],\n [0, 1, 0, 1, 1, 0],\n [0, 1, 0, -1, 1, 0],\n [0, 1, 0, 1, -1, 0],\n // y-error bottom cap\n [0, -1, 0, -1, 1, 0],\n [0, -1, 0, -1, -1, 0],\n [0, -1, 0, 1, -1, 0],\n [0, -1, 0, 1, 1, 0],\n [0, -1, 0, -1, 1, 0],\n [0, -1, 0, 1, -1, 0]\n ];\n function Error2D(regl, options) {\n if (typeof regl === \"function\") {\n if (!options) options = {};\n options.regl = regl;\n } else {\n options = regl;\n }\n if (options.length) options.positions = options;\n regl = options.regl;\n if (!regl.hasExtension(\"ANGLE_instanced_arrays\")) {\n throw Error(\"regl-error2d: `ANGLE_instanced_arrays` extension should be enabled\");\n }\n let gl2 = regl._gl, drawErrors, positionBuffer, positionFractBuffer, colorBuffer, errorBuffer, meshBuffer, defaults = {\n color: \"black\",\n capSize: 5,\n lineWidth: 1,\n opacity: 1,\n viewport: null,\n range: null,\n offset: 0,\n count: 0,\n bounds: null,\n positions: [],\n errors: []\n }, groups = [];\n colorBuffer = regl.buffer({\n usage: \"dynamic\",\n type: \"uint8\",\n data: new Uint8Array(0)\n });\n positionBuffer = regl.buffer({\n usage: \"dynamic\",\n type: \"float\",\n data: new Uint8Array(0)\n });\n positionFractBuffer = regl.buffer({\n usage: \"dynamic\",\n type: \"float\",\n data: new Uint8Array(0)\n });\n errorBuffer = regl.buffer({\n usage: \"dynamic\",\n type: \"float\",\n data: new Uint8Array(0)\n });\n meshBuffer = regl.buffer({\n usage: \"static\",\n type: \"float\",\n data: WEIGHTS\n });\n update(options);\n drawErrors = regl({\n vert: `\n\t\tprecision highp float;\n\n\t\tattribute vec2 position, positionFract;\n\t\tattribute vec4 error;\n\t\tattribute vec4 color;\n\n\t\tattribute vec2 direction, lineOffset, capOffset;\n\n\t\tuniform vec4 viewport;\n\t\tuniform float lineWidth, capSize;\n\t\tuniform vec2 scale, scaleFract, translate, translateFract;\n\n\t\tvarying vec4 fragColor;\n\n\t\tvoid main() {\n\t\t\tfragColor = color / 255.;\n\n\t\t\tvec2 pixelOffset = lineWidth * lineOffset + (capSize + lineWidth) * capOffset;\n\n\t\t\tvec2 dxy = -step(.5, direction.xy) * error.xz + step(direction.xy, vec2(-.5)) * error.yw;\n\n\t\t\tvec2 position = position + dxy;\n\n\t\t\tvec2 pos = (position + translate) * scale\n\t\t\t\t+ (positionFract + translateFract) * scale\n\t\t\t\t+ (position + translate) * scaleFract\n\t\t\t\t+ (positionFract + translateFract) * scaleFract;\n\n\t\t\tpos += pixelOffset / viewport.zw;\n\n\t\t\tgl_Position = vec4(pos * 2. - 1., 0, 1);\n\t\t}\n\t\t`,\n frag: `\n\t\tprecision highp float;\n\n\t\tvarying vec4 fragColor;\n\n\t\tuniform float opacity;\n\n\t\tvoid main() {\n\t\t\tgl_FragColor = fragColor;\n\t\t\tgl_FragColor.a *= opacity;\n\t\t}\n\t\t`,\n uniforms: {\n range: regl.prop(\"range\"),\n lineWidth: regl.prop(\"lineWidth\"),\n capSize: regl.prop(\"capSize\"),\n opacity: regl.prop(\"opacity\"),\n scale: regl.prop(\"scale\"),\n translate: regl.prop(\"translate\"),\n scaleFract: regl.prop(\"scaleFract\"),\n translateFract: regl.prop(\"translateFract\"),\n viewport: (ctx, prop) => [prop.viewport.x, prop.viewport.y, ctx.viewportWidth, ctx.viewportHeight]\n },\n attributes: {\n //dynamic attributes\n color: {\n buffer: colorBuffer,\n offset: (ctx, prop) => prop.offset * 4,\n divisor: 1\n },\n position: {\n buffer: positionBuffer,\n offset: (ctx, prop) => prop.offset * 8,\n divisor: 1\n },\n positionFract: {\n buffer: positionFractBuffer,\n offset: (ctx, prop) => prop.offset * 8,\n divisor: 1\n },\n error: {\n buffer: errorBuffer,\n offset: (ctx, prop) => prop.offset * 16,\n divisor: 1\n },\n //static attributes\n direction: {\n buffer: meshBuffer,\n stride: 24,\n offset: 0\n },\n lineOffset: {\n buffer: meshBuffer,\n stride: 24,\n offset: 8\n },\n capOffset: {\n buffer: meshBuffer,\n stride: 24,\n offset: 16\n }\n },\n primitive: \"triangles\",\n blend: {\n enable: true,\n color: [0, 0, 0, 0],\n equation: {\n rgb: \"add\",\n alpha: \"add\"\n },\n func: {\n srcRGB: \"src alpha\",\n dstRGB: \"one minus src alpha\",\n srcAlpha: \"one minus dst alpha\",\n dstAlpha: \"one\"\n }\n },\n depth: {\n enable: false\n },\n scissor: {\n enable: true,\n box: regl.prop(\"viewport\")\n },\n viewport: regl.prop(\"viewport\"),\n stencil: false,\n instances: regl.prop(\"count\"),\n count: WEIGHTS.length\n });\n extend2(error2d, {\n update,\n draw,\n destroy,\n regl,\n gl: gl2,\n canvas: gl2.canvas,\n groups\n });\n return error2d;\n function error2d(opts) {\n if (opts) {\n update(opts);\n } else if (opts === null) {\n destroy();\n }\n draw();\n }\n function draw(options2) {\n if (typeof options2 === \"number\") return drawGroup(options2);\n if (options2 && !Array.isArray(options2)) options2 = [options2];\n regl._refresh();\n groups.forEach((s, i) => {\n if (!s) return;\n if (options2) {\n if (!options2[i]) s.draw = false;\n else s.draw = true;\n }\n if (!s.draw) {\n s.draw = true;\n return;\n }\n drawGroup(i);\n });\n }\n function drawGroup(s) {\n if (typeof s === \"number\") s = groups[s];\n if (s == null) return;\n if (!(s && s.count && s.color && s.opacity && s.positions && s.positions.length > 1)) return;\n s.scaleRatio = [\n s.scale[0] * s.viewport.width,\n s.scale[1] * s.viewport.height\n ];\n drawErrors(s);\n if (s.after) s.after(s);\n }\n function update(options2) {\n if (!options2) return;\n if (options2.length != null) {\n if (typeof options2[0] === \"number\") options2 = [{ positions: options2 }];\n } else if (!Array.isArray(options2)) options2 = [options2];\n let pointCount = 0, errorCount = 0;\n error2d.groups = groups = options2.map((options3, i) => {\n let group = groups[i];\n if (!options3) return group;\n else if (typeof options3 === \"function\") options3 = { after: options3 };\n else if (typeof options3[0] === \"number\") options3 = { positions: options3 };\n options3 = pick(options3, {\n color: \"color colors fill\",\n capSize: \"capSize cap capsize cap-size\",\n lineWidth: \"lineWidth line-width width line thickness\",\n opacity: \"opacity alpha\",\n range: \"range dataBox\",\n viewport: \"viewport viewBox\",\n errors: \"errors error\",\n positions: \"positions position data points\"\n });\n if (!group) {\n groups[i] = group = {\n id: i,\n scale: null,\n translate: null,\n scaleFract: null,\n translateFract: null,\n draw: true\n };\n options3 = extend2({}, defaults, options3);\n }\n updateDiff(group, options3, [{\n lineWidth: (v) => +v * 0.5,\n capSize: (v) => +v * 0.5,\n opacity: parseFloat,\n errors: (errors) => {\n errors = flatten(errors);\n errorCount += errors.length;\n return errors;\n },\n positions: (positions, state) => {\n positions = flatten(positions, \"float64\");\n state.count = Math.floor(positions.length / 2);\n state.bounds = getBounds(positions, 2);\n state.offset = pointCount;\n pointCount += state.count;\n return positions;\n }\n }, {\n color: (colors, state) => {\n let count = state.count;\n if (!colors) colors = \"transparent\";\n if (!Array.isArray(colors) || typeof colors[0] === \"number\") {\n let color2 = colors;\n colors = Array(count);\n for (let i2 = 0; i2 < count; i2++) {\n colors[i2] = color2;\n }\n }\n if (colors.length < count) throw Error(\"Not enough colors\");\n let colorData = new Uint8Array(count * 4);\n for (let i2 = 0; i2 < count; i2++) {\n let c = rgba3(colors[i2], \"uint8\");\n colorData.set(c, i2 * 4);\n }\n return colorData;\n },\n range: (range, state, options4) => {\n let bounds = state.bounds;\n if (!range) range = bounds;\n state.scale = [1 / (range[2] - range[0]), 1 / (range[3] - range[1])];\n state.translate = [-range[0], -range[1]];\n state.scaleFract = fract32(state.scale);\n state.translateFract = fract32(state.translate);\n return range;\n },\n viewport: (vp) => {\n let viewport;\n if (Array.isArray(vp)) {\n viewport = {\n x: vp[0],\n y: vp[1],\n width: vp[2] - vp[0],\n height: vp[3] - vp[1]\n };\n } else if (vp) {\n viewport = {\n x: vp.x || vp.left || 0,\n y: vp.y || vp.top || 0\n };\n if (vp.right) viewport.width = vp.right - viewport.x;\n else viewport.width = vp.w || vp.width || 0;\n if (vp.bottom) viewport.height = vp.bottom - viewport.y;\n else viewport.height = vp.h || vp.height || 0;\n } else {\n viewport = {\n x: 0,\n y: 0,\n width: gl2.drawingBufferWidth,\n height: gl2.drawingBufferHeight\n };\n }\n return viewport;\n }\n }]);\n return group;\n });\n if (pointCount || errorCount) {\n let len = groups.reduce((acc, group, i) => {\n return acc + (group ? group.count : 0);\n }, 0);\n let positionData = new Float64Array(len * 2);\n let colorData = new Uint8Array(len * 4);\n let errorData = new Float32Array(len * 4);\n groups.forEach((group, i) => {\n if (!group) return;\n let { positions, count, offset, color: color2, errors } = group;\n if (!count) return;\n colorData.set(color2, offset * 4);\n errorData.set(errors, offset * 4);\n positionData.set(positions, offset * 2);\n });\n var float_data = float32(positionData);\n positionBuffer(float_data);\n var frac_data = fract32(positionData, float_data);\n positionFractBuffer(frac_data);\n colorBuffer(colorData);\n errorBuffer(errorData);\n }\n }\n function destroy() {\n positionBuffer.destroy();\n positionFractBuffer.destroy();\n colorBuffer.destroy();\n errorBuffer.destroy();\n meshBuffer.destroy();\n }\n }\n }\n });\n\n // node_modules/unquote/index.js\n var require_unquote = __commonJS({\n \"node_modules/unquote/index.js\"(exports, module) {\n var reg = /[\\'\\\"]/;\n module.exports = function unquote(str) {\n if (!str) {\n return \"\";\n }\n if (reg.test(str.charAt(0))) {\n str = str.substr(1);\n }\n if (reg.test(str.charAt(str.length - 1))) {\n str = str.substr(0, str.length - 1);\n }\n return str;\n };\n }\n });\n\n // node_modules/css-global-keywords/index.json\n var require_css_global_keywords = __commonJS({\n \"node_modules/css-global-keywords/index.json\"() {\n }\n });\n\n // node_modules/css-system-font-keywords/index.json\n var require_css_system_font_keywords = __commonJS({\n \"node_modules/css-system-font-keywords/index.json\"() {\n }\n });\n\n // node_modules/css-font-weight-keywords/index.json\n var require_css_font_weight_keywords = __commonJS({\n \"node_modules/css-font-weight-keywords/index.json\"() {\n }\n });\n\n // node_modules/css-font-style-keywords/index.json\n var require_css_font_style_keywords = __commonJS({\n \"node_modules/css-font-style-keywords/index.json\"() {\n }\n });\n\n // node_modules/css-font-stretch-keywords/index.json\n var require_css_font_stretch_keywords = __commonJS({\n \"node_modules/css-font-stretch-keywords/index.json\"() {\n }\n });\n\n // node_modules/parenthesis/index.js\n var require_parenthesis = __commonJS({\n \"node_modules/parenthesis/index.js\"(exports, module) {\n \"use strict\";\n function parse2(str, opts) {\n if (typeof str !== \"string\") return [str];\n var res = [str];\n if (typeof opts === \"string\" || Array.isArray(opts)) {\n opts = { brackets: opts };\n } else if (!opts) opts = {};\n var brackets = opts.brackets ? Array.isArray(opts.brackets) ? opts.brackets : [opts.brackets] : [\"{}\", \"[]\", \"()\"];\n var escape2 = opts.escape || \"___\";\n var flat = !!opts.flat;\n brackets.forEach(function(bracket) {\n var pRE = new RegExp([\"\\\\\", bracket[0], \"[^\\\\\", bracket[0], \"\\\\\", bracket[1], \"]*\\\\\", bracket[1]].join(\"\"));\n var ids = [];\n function replaceToken(token, idx, str2) {\n var refId = res.push(token.slice(bracket[0].length, -bracket[1].length)) - 1;\n ids.push(refId);\n return escape2 + refId + escape2;\n }\n res.forEach(function(str2, i) {\n var prevStr;\n var a = 0;\n while (str2 != prevStr) {\n prevStr = str2;\n str2 = str2.replace(pRE, replaceToken);\n if (a++ > 1e4) throw Error(\"References have circular dependency. Please, check them.\");\n }\n res[i] = str2;\n });\n ids = ids.reverse();\n res = res.map(function(str2) {\n ids.forEach(function(id) {\n str2 = str2.replace(new RegExp(\"(\\\\\" + escape2 + id + \"\\\\\" + escape2 + \")\", \"g\"), bracket[0] + \"$1\" + bracket[1]);\n });\n return str2;\n });\n });\n var re = new RegExp(\"\\\\\" + escape2 + \"([0-9]+)\\\\\" + escape2);\n function nest(str2, refs, escape3) {\n var res2 = [], match;\n var a = 0;\n while (match = re.exec(str2)) {\n if (a++ > 1e4) throw Error(\"Circular references in parenthesis\");\n res2.push(str2.slice(0, match.index));\n res2.push(nest(refs[match[1]], refs));\n str2 = str2.slice(match.index + match[0].length);\n }\n res2.push(str2);\n return res2;\n }\n return flat ? res : nest(res[0], res);\n }\n function stringify(arg, opts) {\n if (opts && opts.flat) {\n var escape2 = opts && opts.escape || \"___\";\n var str = arg[0], prevStr;\n if (!str) return \"\";\n var re = new RegExp(\"\\\\\" + escape2 + \"([0-9]+)\\\\\" + escape2);\n var a = 0;\n while (str != prevStr) {\n if (a++ > 1e4) throw Error(\"Circular references in \" + arg);\n prevStr = str;\n str = str.replace(re, replaceRef);\n }\n return str;\n }\n return arg.reduce(function f(prev, curr) {\n if (Array.isArray(curr)) {\n curr = curr.reduce(f, \"\");\n }\n return prev + curr;\n }, \"\");\n function replaceRef(match, idx) {\n if (arg[idx] == null) throw Error(\"Reference \" + idx + \"is undefined\");\n return arg[idx];\n }\n }\n function parenthesis(arg, opts) {\n if (Array.isArray(arg)) {\n return stringify(arg, opts);\n } else {\n return parse2(arg, opts);\n }\n }\n parenthesis.parse = parse2;\n parenthesis.stringify = stringify;\n module.exports = parenthesis;\n }\n });\n\n // node_modules/string-split-by/index.js\n var require_string_split_by = __commonJS({\n \"node_modules/string-split-by/index.js\"(exports, module) {\n \"use strict\";\n var paren = require_parenthesis();\n module.exports = function splitBy(string, separator, o) {\n if (string == null) throw Error(\"First argument should be a string\");\n if (separator == null) throw Error(\"Separator should be a string or a RegExp\");\n if (!o) o = {};\n else if (typeof o === \"string\" || Array.isArray(o)) {\n o = { ignore: o };\n }\n if (o.escape == null) o.escape = true;\n if (o.ignore == null) o.ignore = [\"[]\", \"()\", \"{}\", \"<>\", '\"\"', \"''\", \"``\", \"\\u201C\\u201D\", \"\\xAB\\xBB\"];\n else {\n if (typeof o.ignore === \"string\") {\n o.ignore = [o.ignore];\n }\n o.ignore = o.ignore.map(function(pair) {\n if (pair.length === 1) pair = pair + pair;\n return pair;\n });\n }\n var tokens = paren.parse(string, { flat: true, brackets: o.ignore });\n var str = tokens[0];\n var parts = str.split(separator);\n if (o.escape) {\n var cleanParts = [];\n for (var i = 0; i < parts.length; i++) {\n var prev = parts[i];\n var part = parts[i + 1];\n if (prev[prev.length - 1] === \"\\\\\" && prev[prev.length - 2] !== \"\\\\\") {\n cleanParts.push(prev + separator + part);\n i++;\n } else {\n cleanParts.push(prev);\n }\n }\n parts = cleanParts;\n }\n for (var i = 0; i < parts.length; i++) {\n tokens[0] = parts[i];\n parts[i] = paren.stringify(tokens, { flat: true });\n }\n return parts;\n };\n }\n });\n\n // node_modules/css-font-size-keywords/index.json\n var require_css_font_size_keywords = __commonJS({\n \"node_modules/css-font-size-keywords/index.json\"() {\n }\n });\n\n // node_modules/css-font/lib/util.js\n var require_util3 = __commonJS({\n \"node_modules/css-font/lib/util.js\"(exports, module) {\n \"use strict\";\n var sizes = require_css_font_size_keywords();\n module.exports = {\n isSize: function isSize(value) {\n return /^[\\d\\.]/.test(value) || value.indexOf(\"/\") !== -1 || sizes.indexOf(value) !== -1;\n }\n };\n }\n });\n\n // node_modules/css-font/parse.js\n var require_parse = __commonJS({\n \"node_modules/css-font/parse.js\"(exports, module) {\n \"use strict\";\n var unquote = require_unquote();\n var globalKeywords = require_css_global_keywords();\n var systemFontKeywords = require_css_system_font_keywords();\n var fontWeightKeywords = require_css_font_weight_keywords();\n var fontStyleKeywords = require_css_font_style_keywords();\n var fontStretchKeywords = require_css_font_stretch_keywords();\n var splitBy = require_string_split_by();\n var isSize = require_util3().isSize;\n module.exports = parseFont;\n var cache = parseFont.cache = {};\n function parseFont(value) {\n if (typeof value !== \"string\") throw new Error(\"Font argument must be a string.\");\n if (cache[value]) return cache[value];\n if (value === \"\") {\n throw new Error(\"Cannot parse an empty string.\");\n }\n if (systemFontKeywords.indexOf(value) !== -1) {\n return cache[value] = { system: value };\n }\n var font = {\n style: \"normal\",\n variant: \"normal\",\n weight: \"normal\",\n stretch: \"normal\",\n lineHeight: \"normal\",\n size: \"1rem\",\n family: [\"serif\"]\n };\n var tokens = splitBy(value, /\\s+/);\n var token;\n while (token = tokens.shift()) {\n if (globalKeywords.indexOf(token) !== -1) {\n [\"style\", \"variant\", \"weight\", \"stretch\"].forEach(function(prop) {\n font[prop] = token;\n });\n return cache[value] = font;\n }\n if (fontStyleKeywords.indexOf(token) !== -1) {\n font.style = token;\n continue;\n }\n if (token === \"normal\" || token === \"small-caps\") {\n font.variant = token;\n continue;\n }\n if (fontStretchKeywords.indexOf(token) !== -1) {\n font.stretch = token;\n continue;\n }\n if (fontWeightKeywords.indexOf(token) !== -1) {\n font.weight = token;\n continue;\n }\n if (isSize(token)) {\n var parts = splitBy(token, \"/\");\n font.size = parts[0];\n if (parts[1] != null) {\n font.lineHeight = parseLineHeight(parts[1]);\n } else if (tokens[0] === \"/\") {\n tokens.shift();\n font.lineHeight = parseLineHeight(tokens.shift());\n }\n if (!tokens.length) {\n throw new Error(\"Missing required font-family.\");\n }\n font.family = splitBy(tokens.join(\" \"), /\\s*,\\s*/).map(unquote);\n return cache[value] = font;\n }\n throw new Error(\"Unknown or unsupported font token: \" + token);\n }\n throw new Error(\"Missing required font-size.\");\n }\n function parseLineHeight(value) {\n var parsed = parseFloat(value);\n if (parsed.toString() === value) {\n return parsed;\n }\n return value;\n }\n }\n });\n\n // node_modules/css-font/stringify.js\n var require_stringify = __commonJS({\n \"node_modules/css-font/stringify.js\"(exports, module) {\n \"use strict\";\n var pick = require_pick_by_alias();\n var isSize = require_util3().isSize;\n var globals = a2o(require_css_global_keywords());\n var systems = a2o(require_css_system_font_keywords());\n var weights = a2o(require_css_font_weight_keywords());\n var styles = a2o(require_css_font_style_keywords());\n var stretches = a2o(require_css_font_stretch_keywords());\n var variants = { \"normal\": 1, \"small-caps\": 1 };\n var fams = {\n \"serif\": 1,\n \"sans-serif\": 1,\n \"monospace\": 1,\n \"cursive\": 1,\n \"fantasy\": 1,\n \"system-ui\": 1\n };\n var defaults = {\n style: \"normal\",\n variant: \"normal\",\n weight: \"normal\",\n stretch: \"normal\",\n size: \"1rem\",\n lineHeight: \"normal\",\n family: \"serif\"\n };\n module.exports = function stringifyFont(o) {\n o = pick(o, {\n style: \"style fontstyle fontStyle font-style slope distinction\",\n variant: \"variant font-variant fontVariant fontvariant var capitalization\",\n weight: \"weight w font-weight fontWeight fontweight\",\n stretch: \"stretch font-stretch fontStretch fontstretch width\",\n size: \"size s font-size fontSize fontsize height em emSize\",\n lineHeight: \"lh line-height lineHeight lineheight leading\",\n family: \"font family fontFamily font-family fontfamily type typeface face\",\n system: \"system reserved default global\"\n });\n if (o.system) {\n if (o.system) verify(o.system, systems);\n return o.system;\n }\n verify(o.style, styles);\n verify(o.variant, variants);\n verify(o.weight, weights);\n verify(o.stretch, stretches);\n if (o.size == null) o.size = defaults.size;\n if (typeof o.size === \"number\") o.size += \"px\";\n if (!isSize) throw Error(\"Bad size value `\" + o.size + \"`\");\n if (!o.family) o.family = defaults.family;\n if (Array.isArray(o.family)) {\n if (!o.family.length) o.family = [defaults.family];\n o.family = o.family.map(function(f) {\n return fams[f] ? f : '\"' + f + '\"';\n }).join(\", \");\n }\n var result = [];\n result.push(o.style);\n if (o.variant !== o.style) result.push(o.variant);\n if (o.weight !== o.variant && o.weight !== o.style) result.push(o.weight);\n if (o.stretch !== o.weight && o.stretch !== o.variant && o.stretch !== o.style) result.push(o.stretch);\n result.push(o.size + (o.lineHeight == null || o.lineHeight === \"normal\" || o.lineHeight + \"\" === \"1\" ? \"\" : \"/\" + o.lineHeight));\n result.push(o.family);\n return result.filter(Boolean).join(\" \");\n };\n function verify(value, values) {\n if (value && !values[value] && !globals[value]) throw Error(\"Unknown keyword `\" + value + \"`\");\n return value;\n }\n function a2o(a) {\n var o = {};\n for (var i = 0; i < a.length; i++) {\n o[a[i]] = 1;\n }\n return o;\n }\n }\n });\n\n // node_modules/css-font/index.js\n var require_css_font = __commonJS({\n \"node_modules/css-font/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n parse: require_parse(),\n stringify: require_stringify()\n };\n }\n });\n\n // node_modules/regl/dist/regl.unchecked.js\n var require_regl_unchecked = __commonJS({\n \"node_modules/regl/dist/regl.unchecked.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? module.exports = factory() : typeof define === \"function\" && false ? define(factory) : global2.createREGL = factory();\n })(exports, function() {\n \"use strict\";\n var extend2 = function(base, opts) {\n var keys = Object.keys(opts);\n for (var i = 0; i < keys.length; ++i) {\n base[keys[i]] = opts[keys[i]];\n }\n return base;\n };\n var VARIABLE_COUNTER = 0;\n var DYN_FUNC = 0;\n var DYN_CONSTANT = 5;\n var DYN_ARRAY = 6;\n function DynamicVariable(type, data) {\n this.id = VARIABLE_COUNTER++;\n this.type = type;\n this.data = data;\n }\n function escapeStr(str) {\n return str.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"');\n }\n function splitParts(str) {\n if (str.length === 0) {\n return [];\n }\n var firstChar = str.charAt(0);\n var lastChar = str.charAt(str.length - 1);\n if (str.length > 1 && firstChar === lastChar && (firstChar === '\"' || firstChar === \"'\")) {\n return ['\"' + escapeStr(str.substr(1, str.length - 2)) + '\"'];\n }\n var parts = /\\[(false|true|null|\\d+|'[^']*'|\"[^\"]*\")\\]/.exec(str);\n if (parts) {\n return splitParts(str.substr(0, parts.index)).concat(splitParts(parts[1])).concat(splitParts(str.substr(parts.index + parts[0].length)));\n }\n var subparts = str.split(\".\");\n if (subparts.length === 1) {\n return ['\"' + escapeStr(str) + '\"'];\n }\n var result = [];\n for (var i = 0; i < subparts.length; ++i) {\n result = result.concat(splitParts(subparts[i]));\n }\n return result;\n }\n function toAccessorString(str) {\n return \"[\" + splitParts(str).join(\"][\") + \"]\";\n }\n function defineDynamic(type, data) {\n return new DynamicVariable(type, toAccessorString(data + \"\"));\n }\n function isDynamic(x) {\n return typeof x === \"function\" && !x._reglType || x instanceof DynamicVariable;\n }\n function unbox(x, path) {\n if (typeof x === \"function\") {\n return new DynamicVariable(DYN_FUNC, x);\n } else if (typeof x === \"number\" || typeof x === \"boolean\") {\n return new DynamicVariable(DYN_CONSTANT, x);\n } else if (Array.isArray(x)) {\n return new DynamicVariable(DYN_ARRAY, x.map(function(y, i) {\n return unbox(y, path + \"[\" + i + \"]\");\n }));\n } else if (x instanceof DynamicVariable) {\n return x;\n }\n }\n var dynamic = {\n DynamicVariable,\n define: defineDynamic,\n isDynamic,\n unbox,\n accessor: toAccessorString\n };\n var raf = {\n next: typeof requestAnimationFrame === \"function\" ? function(cb) {\n return requestAnimationFrame(cb);\n } : function(cb) {\n return setTimeout(cb, 16);\n },\n cancel: typeof cancelAnimationFrame === \"function\" ? function(raf2) {\n return cancelAnimationFrame(raf2);\n } : clearTimeout\n };\n var clock = typeof performance !== \"undefined\" && performance.now ? function() {\n return performance.now();\n } : function() {\n return +/* @__PURE__ */ new Date();\n };\n function createStringStore() {\n var stringIds = { \"\": 0 };\n var stringValues = [\"\"];\n return {\n id: function(str) {\n var result = stringIds[str];\n if (result) {\n return result;\n }\n result = stringIds[str] = stringValues.length;\n stringValues.push(str);\n return result;\n },\n str: function(id) {\n return stringValues[id];\n }\n };\n }\n function createCanvas(element, onDone, pixelRatio) {\n var canvas = document.createElement(\"canvas\");\n extend2(canvas.style, {\n border: 0,\n margin: 0,\n padding: 0,\n top: 0,\n left: 0,\n width: \"100%\",\n height: \"100%\"\n });\n element.appendChild(canvas);\n if (element === document.body) {\n canvas.style.position = \"absolute\";\n extend2(element.style, {\n margin: 0,\n padding: 0\n });\n }\n function resize() {\n var w = window.innerWidth;\n var h = window.innerHeight;\n if (element !== document.body) {\n var bounds = canvas.getBoundingClientRect();\n w = bounds.right - bounds.left;\n h = bounds.bottom - bounds.top;\n }\n canvas.width = pixelRatio * w;\n canvas.height = pixelRatio * h;\n }\n var resizeObserver;\n if (element !== document.body && typeof ResizeObserver === \"function\") {\n resizeObserver = new ResizeObserver(function() {\n setTimeout(resize);\n });\n resizeObserver.observe(element);\n } else {\n window.addEventListener(\"resize\", resize, false);\n }\n function onDestroy() {\n if (resizeObserver) {\n resizeObserver.disconnect();\n } else {\n window.removeEventListener(\"resize\", resize);\n }\n element.removeChild(canvas);\n }\n resize();\n return {\n canvas,\n onDestroy\n };\n }\n function createContext(canvas, contextAttributes) {\n function get(name2) {\n try {\n return canvas.getContext(name2, contextAttributes);\n } catch (e) {\n return null;\n }\n }\n return get(\"webgl\") || get(\"experimental-webgl\") || get(\"webgl-experimental\");\n }\n function isHTMLElement(obj) {\n return typeof obj.nodeName === \"string\" && typeof obj.appendChild === \"function\" && typeof obj.getBoundingClientRect === \"function\";\n }\n function isWebGLContext(obj) {\n return typeof obj.drawArrays === \"function\" || typeof obj.drawElements === \"function\";\n }\n function parseExtensions(input) {\n if (typeof input === \"string\") {\n return input.split();\n }\n return input;\n }\n function getElement(desc) {\n if (typeof desc === \"string\") {\n return document.querySelector(desc);\n }\n return desc;\n }\n function parseArgs(args_) {\n var args = args_ || {};\n var element, container, canvas, gl2;\n var contextAttributes = {};\n var extensions = [];\n var optionalExtensions = [];\n var pixelRatio = typeof window === \"undefined\" ? 1 : window.devicePixelRatio;\n var profile = false;\n var cachedCode = {};\n var onDone = function(err) {\n if (err) {\n }\n };\n var onDestroy = function() {\n };\n if (typeof args === \"string\") {\n element = document.querySelector(args);\n } else if (typeof args === \"object\") {\n if (isHTMLElement(args)) {\n element = args;\n } else if (isWebGLContext(args)) {\n gl2 = args;\n canvas = gl2.canvas;\n } else {\n if (\"gl\" in args) {\n gl2 = args.gl;\n } else if (\"canvas\" in args) {\n canvas = getElement(args.canvas);\n } else if (\"container\" in args) {\n container = getElement(args.container);\n }\n if (\"attributes\" in args) {\n contextAttributes = args.attributes;\n }\n if (\"extensions\" in args) {\n extensions = parseExtensions(args.extensions);\n }\n if (\"optionalExtensions\" in args) {\n optionalExtensions = parseExtensions(args.optionalExtensions);\n }\n if (\"onDone\" in args) {\n onDone = args.onDone;\n }\n if (\"profile\" in args) {\n profile = !!args.profile;\n }\n if (\"pixelRatio\" in args) {\n pixelRatio = +args.pixelRatio;\n }\n if (\"cachedCode\" in args) {\n cachedCode = args.cachedCode;\n }\n }\n } else {\n }\n if (element) {\n if (element.nodeName.toLowerCase() === \"canvas\") {\n canvas = element;\n } else {\n container = element;\n }\n }\n if (!gl2) {\n if (!canvas) {\n var result = createCanvas(container || document.body, onDone, pixelRatio);\n if (!result) {\n return null;\n }\n canvas = result.canvas;\n onDestroy = result.onDestroy;\n }\n if (contextAttributes.premultipliedAlpha === void 0) contextAttributes.premultipliedAlpha = true;\n gl2 = createContext(canvas, contextAttributes);\n }\n if (!gl2) {\n onDestroy();\n onDone(\"webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org\");\n return null;\n }\n return {\n gl: gl2,\n canvas,\n container,\n extensions,\n optionalExtensions,\n pixelRatio,\n profile,\n cachedCode,\n onDone,\n onDestroy\n };\n }\n function createExtensionCache(gl2, config) {\n var extensions = {};\n function tryLoadExtension(name_) {\n var name3 = name_.toLowerCase();\n var ext;\n try {\n ext = extensions[name3] = gl2.getExtension(name3);\n } catch (e) {\n }\n return !!ext;\n }\n for (var i = 0; i < config.extensions.length; ++i) {\n var name2 = config.extensions[i];\n if (!tryLoadExtension(name2)) {\n config.onDestroy();\n config.onDone('\"' + name2 + '\" extension is not supported by the current WebGL context, try upgrading your system or a different browser');\n return null;\n }\n }\n config.optionalExtensions.forEach(tryLoadExtension);\n return {\n extensions,\n restore: function() {\n Object.keys(extensions).forEach(function(name3) {\n if (extensions[name3] && !tryLoadExtension(name3)) {\n throw new Error(\"(regl): error restoring extension \" + name3);\n }\n });\n }\n };\n }\n function loop(n, f) {\n var result = Array(n);\n for (var i = 0; i < n; ++i) {\n result[i] = f(i);\n }\n return result;\n }\n var GL_BYTE = 5120;\n var GL_UNSIGNED_BYTE$1 = 5121;\n var GL_SHORT = 5122;\n var GL_UNSIGNED_SHORT = 5123;\n var GL_INT = 5124;\n var GL_UNSIGNED_INT = 5125;\n var GL_FLOAT$1 = 5126;\n function nextPow16(v) {\n for (var i = 16; i <= 1 << 28; i *= 16) {\n if (v <= i) {\n return i;\n }\n }\n return 0;\n }\n function log2(v) {\n var r, shift;\n r = (v > 65535) << 4;\n v >>>= r;\n shift = (v > 255) << 3;\n v >>>= shift;\n r |= shift;\n shift = (v > 15) << 2;\n v >>>= shift;\n r |= shift;\n shift = (v > 3) << 1;\n v >>>= shift;\n r |= shift;\n return r | v >> 1;\n }\n function createPool() {\n var bufferPool = loop(8, function() {\n return [];\n });\n function alloc(n) {\n var sz = nextPow16(n);\n var bin = bufferPool[log2(sz) >> 2];\n if (bin.length > 0) {\n return bin.pop();\n }\n return new ArrayBuffer(sz);\n }\n function free(buf) {\n bufferPool[log2(buf.byteLength) >> 2].push(buf);\n }\n function allocType(type, n) {\n var result = null;\n switch (type) {\n case GL_BYTE:\n result = new Int8Array(alloc(n), 0, n);\n break;\n case GL_UNSIGNED_BYTE$1:\n result = new Uint8Array(alloc(n), 0, n);\n break;\n case GL_SHORT:\n result = new Int16Array(alloc(2 * n), 0, n);\n break;\n case GL_UNSIGNED_SHORT:\n result = new Uint16Array(alloc(2 * n), 0, n);\n break;\n case GL_INT:\n result = new Int32Array(alloc(4 * n), 0, n);\n break;\n case GL_UNSIGNED_INT:\n result = new Uint32Array(alloc(4 * n), 0, n);\n break;\n case GL_FLOAT$1:\n result = new Float32Array(alloc(4 * n), 0, n);\n break;\n default:\n return null;\n }\n if (result.length !== n) {\n return result.subarray(0, n);\n }\n return result;\n }\n function freeType(array) {\n free(array.buffer);\n }\n return {\n alloc,\n free,\n allocType,\n freeType\n };\n }\n var pool = createPool();\n pool.zero = createPool();\n var GL_SUBPIXEL_BITS = 3408;\n var GL_RED_BITS = 3410;\n var GL_GREEN_BITS = 3411;\n var GL_BLUE_BITS = 3412;\n var GL_ALPHA_BITS = 3413;\n var GL_DEPTH_BITS = 3414;\n var GL_STENCIL_BITS = 3415;\n var GL_ALIASED_POINT_SIZE_RANGE = 33901;\n var GL_ALIASED_LINE_WIDTH_RANGE = 33902;\n var GL_MAX_TEXTURE_SIZE = 3379;\n var GL_MAX_VIEWPORT_DIMS = 3386;\n var GL_MAX_VERTEX_ATTRIBS = 34921;\n var GL_MAX_VERTEX_UNIFORM_VECTORS = 36347;\n var GL_MAX_VARYING_VECTORS = 36348;\n var GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 35661;\n var GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 35660;\n var GL_MAX_TEXTURE_IMAGE_UNITS = 34930;\n var GL_MAX_FRAGMENT_UNIFORM_VECTORS = 36349;\n var GL_MAX_CUBE_MAP_TEXTURE_SIZE = 34076;\n var GL_MAX_RENDERBUFFER_SIZE = 34024;\n var GL_VENDOR = 7936;\n var GL_RENDERER = 7937;\n var GL_VERSION = 7938;\n var GL_SHADING_LANGUAGE_VERSION = 35724;\n var GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 34047;\n var GL_MAX_COLOR_ATTACHMENTS_WEBGL = 36063;\n var GL_MAX_DRAW_BUFFERS_WEBGL = 34852;\n var GL_TEXTURE_2D = 3553;\n var GL_TEXTURE_CUBE_MAP = 34067;\n var GL_TEXTURE_CUBE_MAP_POSITIVE_X = 34069;\n var GL_TEXTURE0 = 33984;\n var GL_RGBA = 6408;\n var GL_FLOAT = 5126;\n var GL_UNSIGNED_BYTE = 5121;\n var GL_FRAMEBUFFER = 36160;\n var GL_FRAMEBUFFER_COMPLETE = 36053;\n var GL_COLOR_ATTACHMENT0 = 36064;\n var GL_COLOR_BUFFER_BIT$1 = 16384;\n var wrapLimits = function(gl2, extensions) {\n var maxAnisotropic = 1;\n if (extensions.ext_texture_filter_anisotropic) {\n maxAnisotropic = gl2.getParameter(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT);\n }\n var maxDrawbuffers = 1;\n var maxColorAttachments = 1;\n if (extensions.webgl_draw_buffers) {\n maxDrawbuffers = gl2.getParameter(GL_MAX_DRAW_BUFFERS_WEBGL);\n maxColorAttachments = gl2.getParameter(GL_MAX_COLOR_ATTACHMENTS_WEBGL);\n }\n var readFloat = !!extensions.oes_texture_float;\n if (readFloat) {\n var readFloatTexture = gl2.createTexture();\n gl2.bindTexture(GL_TEXTURE_2D, readFloatTexture);\n gl2.texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_FLOAT, null);\n var fbo = gl2.createFramebuffer();\n gl2.bindFramebuffer(GL_FRAMEBUFFER, fbo);\n gl2.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, readFloatTexture, 0);\n gl2.bindTexture(GL_TEXTURE_2D, null);\n if (gl2.checkFramebufferStatus(GL_FRAMEBUFFER) !== GL_FRAMEBUFFER_COMPLETE) readFloat = false;\n else {\n gl2.viewport(0, 0, 1, 1);\n gl2.clearColor(1, 0, 0, 1);\n gl2.clear(GL_COLOR_BUFFER_BIT$1);\n var pixels = pool.allocType(GL_FLOAT, 4);\n gl2.readPixels(0, 0, 1, 1, GL_RGBA, GL_FLOAT, pixels);\n if (gl2.getError()) readFloat = false;\n else {\n gl2.deleteFramebuffer(fbo);\n gl2.deleteTexture(readFloatTexture);\n readFloat = pixels[0] === 1;\n }\n pool.freeType(pixels);\n }\n }\n var isIE = typeof navigator !== \"undefined\" && (/MSIE/.test(navigator.userAgent) || /Trident\\//.test(navigator.appVersion) || /Edge/.test(navigator.userAgent));\n var npotTextureCube = true;\n if (!isIE) {\n var cubeTexture = gl2.createTexture();\n var data = pool.allocType(GL_UNSIGNED_BYTE, 36);\n gl2.activeTexture(GL_TEXTURE0);\n gl2.bindTexture(GL_TEXTURE_CUBE_MAP, cubeTexture);\n gl2.texImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA, 3, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n pool.freeType(data);\n gl2.bindTexture(GL_TEXTURE_CUBE_MAP, null);\n gl2.deleteTexture(cubeTexture);\n npotTextureCube = !gl2.getError();\n }\n return {\n // drawing buffer bit depth\n colorBits: [\n gl2.getParameter(GL_RED_BITS),\n gl2.getParameter(GL_GREEN_BITS),\n gl2.getParameter(GL_BLUE_BITS),\n gl2.getParameter(GL_ALPHA_BITS)\n ],\n depthBits: gl2.getParameter(GL_DEPTH_BITS),\n stencilBits: gl2.getParameter(GL_STENCIL_BITS),\n subpixelBits: gl2.getParameter(GL_SUBPIXEL_BITS),\n // supported extensions\n extensions: Object.keys(extensions).filter(function(ext) {\n return !!extensions[ext];\n }),\n // max aniso samples\n maxAnisotropic,\n // max draw buffers\n maxDrawbuffers,\n maxColorAttachments,\n // point and line size ranges\n pointSizeDims: gl2.getParameter(GL_ALIASED_POINT_SIZE_RANGE),\n lineWidthDims: gl2.getParameter(GL_ALIASED_LINE_WIDTH_RANGE),\n maxViewportDims: gl2.getParameter(GL_MAX_VIEWPORT_DIMS),\n maxCombinedTextureUnits: gl2.getParameter(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS),\n maxCubeMapSize: gl2.getParameter(GL_MAX_CUBE_MAP_TEXTURE_SIZE),\n maxRenderbufferSize: gl2.getParameter(GL_MAX_RENDERBUFFER_SIZE),\n maxTextureUnits: gl2.getParameter(GL_MAX_TEXTURE_IMAGE_UNITS),\n maxTextureSize: gl2.getParameter(GL_MAX_TEXTURE_SIZE),\n maxAttributes: gl2.getParameter(GL_MAX_VERTEX_ATTRIBS),\n maxVertexUniforms: gl2.getParameter(GL_MAX_VERTEX_UNIFORM_VECTORS),\n maxVertexTextureUnits: gl2.getParameter(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS),\n maxVaryingVectors: gl2.getParameter(GL_MAX_VARYING_VECTORS),\n maxFragmentUniforms: gl2.getParameter(GL_MAX_FRAGMENT_UNIFORM_VECTORS),\n // vendor info\n glsl: gl2.getParameter(GL_SHADING_LANGUAGE_VERSION),\n renderer: gl2.getParameter(GL_RENDERER),\n vendor: gl2.getParameter(GL_VENDOR),\n version: gl2.getParameter(GL_VERSION),\n // quirks\n readFloat,\n npotTextureCube\n };\n };\n var isTypedArray = function(x) {\n return x instanceof Uint8Array || x instanceof Uint16Array || x instanceof Uint32Array || x instanceof Int8Array || x instanceof Int16Array || x instanceof Int32Array || x instanceof Float32Array || x instanceof Float64Array || x instanceof Uint8ClampedArray;\n };\n function isNDArrayLike(obj) {\n return !!obj && typeof obj === \"object\" && Array.isArray(obj.shape) && Array.isArray(obj.stride) && typeof obj.offset === \"number\" && obj.shape.length === obj.stride.length && (Array.isArray(obj.data) || isTypedArray(obj.data));\n }\n var values = function(obj) {\n return Object.keys(obj).map(function(key) {\n return obj[key];\n });\n };\n var flattenUtils = {\n shape: arrayShape$1,\n flatten: flattenArray\n };\n function flatten1D(array, nx, out) {\n for (var i = 0; i < nx; ++i) {\n out[i] = array[i];\n }\n }\n function flatten2D(array, nx, ny, out) {\n var ptr = 0;\n for (var i = 0; i < nx; ++i) {\n var row = array[i];\n for (var j = 0; j < ny; ++j) {\n out[ptr++] = row[j];\n }\n }\n }\n function flatten3D(array, nx, ny, nz, out, ptr_) {\n var ptr = ptr_;\n for (var i = 0; i < nx; ++i) {\n var row = array[i];\n for (var j = 0; j < ny; ++j) {\n var col = row[j];\n for (var k = 0; k < nz; ++k) {\n out[ptr++] = col[k];\n }\n }\n }\n }\n function flattenRec(array, shape, level, out, ptr) {\n var stride = 1;\n for (var i = level + 1; i < shape.length; ++i) {\n stride *= shape[i];\n }\n var n = shape[level];\n if (shape.length - level === 4) {\n var nx = shape[level + 1];\n var ny = shape[level + 2];\n var nz = shape[level + 3];\n for (i = 0; i < n; ++i) {\n flatten3D(array[i], nx, ny, nz, out, ptr);\n ptr += stride;\n }\n } else {\n for (i = 0; i < n; ++i) {\n flattenRec(array[i], shape, level + 1, out, ptr);\n ptr += stride;\n }\n }\n }\n function flattenArray(array, shape, type, out_) {\n var sz = 1;\n if (shape.length) {\n for (var i = 0; i < shape.length; ++i) {\n sz *= shape[i];\n }\n } else {\n sz = 0;\n }\n var out = out_ || pool.allocType(type, sz);\n switch (shape.length) {\n case 0:\n break;\n case 1:\n flatten1D(array, shape[0], out);\n break;\n case 2:\n flatten2D(array, shape[0], shape[1], out);\n break;\n case 3:\n flatten3D(array, shape[0], shape[1], shape[2], out, 0);\n break;\n default:\n flattenRec(array, shape, 0, out, 0);\n }\n return out;\n }\n function arrayShape$1(array_) {\n var shape = [];\n for (var array = array_; array.length; array = array[0]) {\n shape.push(array.length);\n }\n return shape;\n }\n var arrayTypes = {\n \"[object Int8Array]\": 5120,\n \"[object Int16Array]\": 5122,\n \"[object Int32Array]\": 5124,\n \"[object Uint8Array]\": 5121,\n \"[object Uint8ClampedArray]\": 5121,\n \"[object Uint16Array]\": 5123,\n \"[object Uint32Array]\": 5125,\n \"[object Float32Array]\": 5126,\n \"[object Float64Array]\": 5121,\n \"[object ArrayBuffer]\": 5121\n };\n var int8 = 5120;\n var int16 = 5122;\n var int32 = 5124;\n var uint8 = 5121;\n var uint16 = 5123;\n var uint32 = 5125;\n var float = 5126;\n var float32 = 5126;\n var glTypes = {\n int8,\n int16,\n int32,\n uint8,\n uint16,\n uint32,\n float,\n float32\n };\n var dynamic$1 = 35048;\n var stream = 35040;\n var usageTypes = {\n dynamic: dynamic$1,\n stream,\n \"static\": 35044\n };\n var arrayFlatten = flattenUtils.flatten;\n var arrayShape = flattenUtils.shape;\n var GL_STATIC_DRAW = 35044;\n var GL_STREAM_DRAW = 35040;\n var GL_UNSIGNED_BYTE$2 = 5121;\n var GL_FLOAT$2 = 5126;\n var DTYPES_SIZES = [];\n DTYPES_SIZES[5120] = 1;\n DTYPES_SIZES[5122] = 2;\n DTYPES_SIZES[5124] = 4;\n DTYPES_SIZES[5121] = 1;\n DTYPES_SIZES[5123] = 2;\n DTYPES_SIZES[5125] = 4;\n DTYPES_SIZES[5126] = 4;\n function typedArrayCode(data) {\n return arrayTypes[Object.prototype.toString.call(data)] | 0;\n }\n function copyArray(out, inp) {\n for (var i = 0; i < inp.length; ++i) {\n out[i] = inp[i];\n }\n }\n function transpose(result, data, shapeX, shapeY, strideX, strideY, offset) {\n var ptr = 0;\n for (var i = 0; i < shapeX; ++i) {\n for (var j = 0; j < shapeY; ++j) {\n result[ptr++] = data[strideX * i + strideY * j + offset];\n }\n }\n }\n function wrapBufferState(gl2, stats2, config, destroyBuffer) {\n var bufferCount = 0;\n var bufferSet = {};\n function REGLBuffer(type) {\n this.id = bufferCount++;\n this.buffer = gl2.createBuffer();\n this.type = type;\n this.usage = GL_STATIC_DRAW;\n this.byteLength = 0;\n this.dimension = 1;\n this.dtype = GL_UNSIGNED_BYTE$2;\n this.persistentData = null;\n if (config.profile) {\n this.stats = { size: 0 };\n }\n }\n REGLBuffer.prototype.bind = function() {\n gl2.bindBuffer(this.type, this.buffer);\n };\n REGLBuffer.prototype.destroy = function() {\n destroy(this);\n };\n var streamPool = [];\n function createStream(type, data) {\n var buffer = streamPool.pop();\n if (!buffer) {\n buffer = new REGLBuffer(type);\n }\n buffer.bind();\n initBufferFromData(buffer, data, GL_STREAM_DRAW, 0, 1, false);\n return buffer;\n }\n function destroyStream(stream$$1) {\n streamPool.push(stream$$1);\n }\n function initBufferFromTypedArray(buffer, data, usage) {\n buffer.byteLength = data.byteLength;\n gl2.bufferData(buffer.type, data, usage);\n }\n function initBufferFromData(buffer, data, usage, dtype, dimension, persist) {\n var shape;\n buffer.usage = usage;\n if (Array.isArray(data)) {\n buffer.dtype = dtype || GL_FLOAT$2;\n if (data.length > 0) {\n var flatData;\n if (Array.isArray(data[0])) {\n shape = arrayShape(data);\n var dim = 1;\n for (var i = 1; i < shape.length; ++i) {\n dim *= shape[i];\n }\n buffer.dimension = dim;\n flatData = arrayFlatten(data, shape, buffer.dtype);\n initBufferFromTypedArray(buffer, flatData, usage);\n if (persist) {\n buffer.persistentData = flatData;\n } else {\n pool.freeType(flatData);\n }\n } else if (typeof data[0] === \"number\") {\n buffer.dimension = dimension;\n var typedData = pool.allocType(buffer.dtype, data.length);\n copyArray(typedData, data);\n initBufferFromTypedArray(buffer, typedData, usage);\n if (persist) {\n buffer.persistentData = typedData;\n } else {\n pool.freeType(typedData);\n }\n } else if (isTypedArray(data[0])) {\n buffer.dimension = data[0].length;\n buffer.dtype = dtype || typedArrayCode(data[0]) || GL_FLOAT$2;\n flatData = arrayFlatten(\n data,\n [data.length, data[0].length],\n buffer.dtype\n );\n initBufferFromTypedArray(buffer, flatData, usage);\n if (persist) {\n buffer.persistentData = flatData;\n } else {\n pool.freeType(flatData);\n }\n } else {\n }\n }\n } else if (isTypedArray(data)) {\n buffer.dtype = dtype || typedArrayCode(data);\n buffer.dimension = dimension;\n initBufferFromTypedArray(buffer, data, usage);\n if (persist) {\n buffer.persistentData = new Uint8Array(new Uint8Array(data.buffer));\n }\n } else if (isNDArrayLike(data)) {\n shape = data.shape;\n var stride = data.stride;\n var offset = data.offset;\n var shapeX = 0;\n var shapeY = 0;\n var strideX = 0;\n var strideY = 0;\n if (shape.length === 1) {\n shapeX = shape[0];\n shapeY = 1;\n strideX = stride[0];\n strideY = 0;\n } else if (shape.length === 2) {\n shapeX = shape[0];\n shapeY = shape[1];\n strideX = stride[0];\n strideY = stride[1];\n } else {\n }\n buffer.dtype = dtype || typedArrayCode(data.data) || GL_FLOAT$2;\n buffer.dimension = shapeY;\n var transposeData2 = pool.allocType(buffer.dtype, shapeX * shapeY);\n transpose(\n transposeData2,\n data.data,\n shapeX,\n shapeY,\n strideX,\n strideY,\n offset\n );\n initBufferFromTypedArray(buffer, transposeData2, usage);\n if (persist) {\n buffer.persistentData = transposeData2;\n } else {\n pool.freeType(transposeData2);\n }\n } else if (data instanceof ArrayBuffer) {\n buffer.dtype = GL_UNSIGNED_BYTE$2;\n buffer.dimension = dimension;\n initBufferFromTypedArray(buffer, data, usage);\n if (persist) {\n buffer.persistentData = new Uint8Array(new Uint8Array(data));\n }\n } else {\n }\n }\n function destroy(buffer) {\n stats2.bufferCount--;\n destroyBuffer(buffer);\n var handle = buffer.buffer;\n gl2.deleteBuffer(handle);\n buffer.buffer = null;\n delete bufferSet[buffer.id];\n }\n function createBuffer(options, type, deferInit, persistent) {\n stats2.bufferCount++;\n var buffer = new REGLBuffer(type);\n bufferSet[buffer.id] = buffer;\n function reglBuffer(options2) {\n var usage = GL_STATIC_DRAW;\n var data = null;\n var byteLength = 0;\n var dtype = 0;\n var dimension = 1;\n if (Array.isArray(options2) || isTypedArray(options2) || isNDArrayLike(options2) || options2 instanceof ArrayBuffer) {\n data = options2;\n } else if (typeof options2 === \"number\") {\n byteLength = options2 | 0;\n } else if (options2) {\n if (\"data\" in options2) {\n data = options2.data;\n }\n if (\"usage\" in options2) {\n usage = usageTypes[options2.usage];\n }\n if (\"type\" in options2) {\n dtype = glTypes[options2.type];\n }\n if (\"dimension\" in options2) {\n dimension = options2.dimension | 0;\n }\n if (\"length\" in options2) {\n byteLength = options2.length | 0;\n }\n }\n buffer.bind();\n if (!data) {\n if (byteLength) gl2.bufferData(buffer.type, byteLength, usage);\n buffer.dtype = dtype || GL_UNSIGNED_BYTE$2;\n buffer.usage = usage;\n buffer.dimension = dimension;\n buffer.byteLength = byteLength;\n } else {\n initBufferFromData(buffer, data, usage, dtype, dimension, persistent);\n }\n if (config.profile) {\n buffer.stats.size = buffer.byteLength * DTYPES_SIZES[buffer.dtype];\n }\n return reglBuffer;\n }\n function setSubData(data, offset) {\n gl2.bufferSubData(buffer.type, offset, data);\n }\n function subdata(data, offset_) {\n var offset = (offset_ || 0) | 0;\n var shape;\n buffer.bind();\n if (isTypedArray(data) || data instanceof ArrayBuffer) {\n setSubData(data, offset);\n } else if (Array.isArray(data)) {\n if (data.length > 0) {\n if (typeof data[0] === \"number\") {\n var converted = pool.allocType(buffer.dtype, data.length);\n copyArray(converted, data);\n setSubData(converted, offset);\n pool.freeType(converted);\n } else if (Array.isArray(data[0]) || isTypedArray(data[0])) {\n shape = arrayShape(data);\n var flatData = arrayFlatten(data, shape, buffer.dtype);\n setSubData(flatData, offset);\n pool.freeType(flatData);\n } else {\n }\n }\n } else if (isNDArrayLike(data)) {\n shape = data.shape;\n var stride = data.stride;\n var shapeX = 0;\n var shapeY = 0;\n var strideX = 0;\n var strideY = 0;\n if (shape.length === 1) {\n shapeX = shape[0];\n shapeY = 1;\n strideX = stride[0];\n strideY = 0;\n } else if (shape.length === 2) {\n shapeX = shape[0];\n shapeY = shape[1];\n strideX = stride[0];\n strideY = stride[1];\n } else {\n }\n var dtype = Array.isArray(data.data) ? buffer.dtype : typedArrayCode(data.data);\n var transposeData2 = pool.allocType(dtype, shapeX * shapeY);\n transpose(\n transposeData2,\n data.data,\n shapeX,\n shapeY,\n strideX,\n strideY,\n data.offset\n );\n setSubData(transposeData2, offset);\n pool.freeType(transposeData2);\n } else {\n }\n return reglBuffer;\n }\n if (!deferInit) {\n reglBuffer(options);\n }\n reglBuffer._reglType = \"buffer\";\n reglBuffer._buffer = buffer;\n reglBuffer.subdata = subdata;\n if (config.profile) {\n reglBuffer.stats = buffer.stats;\n }\n reglBuffer.destroy = function() {\n destroy(buffer);\n };\n return reglBuffer;\n }\n function restoreBuffers() {\n values(bufferSet).forEach(function(buffer) {\n buffer.buffer = gl2.createBuffer();\n gl2.bindBuffer(buffer.type, buffer.buffer);\n gl2.bufferData(\n buffer.type,\n buffer.persistentData || buffer.byteLength,\n buffer.usage\n );\n });\n }\n if (config.profile) {\n stats2.getTotalBufferSize = function() {\n var total = 0;\n Object.keys(bufferSet).forEach(function(key) {\n total += bufferSet[key].stats.size;\n });\n return total;\n };\n }\n return {\n create: createBuffer,\n createStream,\n destroyStream,\n clear: function() {\n values(bufferSet).forEach(destroy);\n streamPool.forEach(destroy);\n },\n getBuffer: function(wrapper) {\n if (wrapper && wrapper._buffer instanceof REGLBuffer) {\n return wrapper._buffer;\n }\n return null;\n },\n restore: restoreBuffers,\n _initBuffer: initBufferFromData\n };\n }\n var points = 0;\n var point = 0;\n var lines = 1;\n var line = 1;\n var triangles = 4;\n var triangle = 4;\n var primTypes = {\n points,\n point,\n lines,\n line,\n triangles,\n triangle,\n \"line loop\": 2,\n \"line strip\": 3,\n \"triangle strip\": 5,\n \"triangle fan\": 6\n };\n var GL_POINTS = 0;\n var GL_LINES = 1;\n var GL_TRIANGLES = 4;\n var GL_BYTE$1 = 5120;\n var GL_UNSIGNED_BYTE$3 = 5121;\n var GL_SHORT$1 = 5122;\n var GL_UNSIGNED_SHORT$1 = 5123;\n var GL_INT$1 = 5124;\n var GL_UNSIGNED_INT$1 = 5125;\n var GL_ELEMENT_ARRAY_BUFFER = 34963;\n var GL_STREAM_DRAW$1 = 35040;\n var GL_STATIC_DRAW$1 = 35044;\n function wrapElementsState(gl2, extensions, bufferState, stats2) {\n var elementSet = {};\n var elementCount = 0;\n var elementTypes = {\n \"uint8\": GL_UNSIGNED_BYTE$3,\n \"uint16\": GL_UNSIGNED_SHORT$1\n };\n if (extensions.oes_element_index_uint) {\n elementTypes.uint32 = GL_UNSIGNED_INT$1;\n }\n function REGLElementBuffer(buffer) {\n this.id = elementCount++;\n elementSet[this.id] = this;\n this.buffer = buffer;\n this.primType = GL_TRIANGLES;\n this.vertCount = 0;\n this.type = 0;\n }\n REGLElementBuffer.prototype.bind = function() {\n this.buffer.bind();\n };\n var bufferPool = [];\n function createElementStream(data) {\n var result = bufferPool.pop();\n if (!result) {\n result = new REGLElementBuffer(bufferState.create(\n null,\n GL_ELEMENT_ARRAY_BUFFER,\n true,\n false\n )._buffer);\n }\n initElements(result, data, GL_STREAM_DRAW$1, -1, -1, 0, 0);\n return result;\n }\n function destroyElementStream(elements) {\n bufferPool.push(elements);\n }\n function initElements(elements, data, usage, prim, count, byteLength, type) {\n elements.buffer.bind();\n var dtype;\n if (data) {\n var predictedType = type;\n if (!type && (!isTypedArray(data) || isNDArrayLike(data) && !isTypedArray(data.data))) {\n predictedType = extensions.oes_element_index_uint ? GL_UNSIGNED_INT$1 : GL_UNSIGNED_SHORT$1;\n }\n bufferState._initBuffer(\n elements.buffer,\n data,\n usage,\n predictedType,\n 3\n );\n } else {\n gl2.bufferData(GL_ELEMENT_ARRAY_BUFFER, byteLength, usage);\n elements.buffer.dtype = dtype || GL_UNSIGNED_BYTE$3;\n elements.buffer.usage = usage;\n elements.buffer.dimension = 3;\n elements.buffer.byteLength = byteLength;\n }\n dtype = type;\n if (!type) {\n switch (elements.buffer.dtype) {\n case GL_UNSIGNED_BYTE$3:\n case GL_BYTE$1:\n dtype = GL_UNSIGNED_BYTE$3;\n break;\n case GL_UNSIGNED_SHORT$1:\n case GL_SHORT$1:\n dtype = GL_UNSIGNED_SHORT$1;\n break;\n case GL_UNSIGNED_INT$1:\n case GL_INT$1:\n dtype = GL_UNSIGNED_INT$1;\n break;\n default:\n }\n elements.buffer.dtype = dtype;\n }\n elements.type = dtype;\n var vertCount = count;\n if (vertCount < 0) {\n vertCount = elements.buffer.byteLength;\n if (dtype === GL_UNSIGNED_SHORT$1) {\n vertCount >>= 1;\n } else if (dtype === GL_UNSIGNED_INT$1) {\n vertCount >>= 2;\n }\n }\n elements.vertCount = vertCount;\n var primType = prim;\n if (prim < 0) {\n primType = GL_TRIANGLES;\n var dimension = elements.buffer.dimension;\n if (dimension === 1) primType = GL_POINTS;\n if (dimension === 2) primType = GL_LINES;\n if (dimension === 3) primType = GL_TRIANGLES;\n }\n elements.primType = primType;\n }\n function destroyElements(elements) {\n stats2.elementsCount--;\n delete elementSet[elements.id];\n elements.buffer.destroy();\n elements.buffer = null;\n }\n function createElements(options, persistent) {\n var buffer = bufferState.create(null, GL_ELEMENT_ARRAY_BUFFER, true);\n var elements = new REGLElementBuffer(buffer._buffer);\n stats2.elementsCount++;\n function reglElements(options2) {\n if (!options2) {\n buffer();\n elements.primType = GL_TRIANGLES;\n elements.vertCount = 0;\n elements.type = GL_UNSIGNED_BYTE$3;\n } else if (typeof options2 === \"number\") {\n buffer(options2);\n elements.primType = GL_TRIANGLES;\n elements.vertCount = options2 | 0;\n elements.type = GL_UNSIGNED_BYTE$3;\n } else {\n var data = null;\n var usage = GL_STATIC_DRAW$1;\n var primType = -1;\n var vertCount = -1;\n var byteLength = 0;\n var dtype = 0;\n if (Array.isArray(options2) || isTypedArray(options2) || isNDArrayLike(options2)) {\n data = options2;\n } else {\n if (\"data\" in options2) {\n data = options2.data;\n }\n if (\"usage\" in options2) {\n usage = usageTypes[options2.usage];\n }\n if (\"primitive\" in options2) {\n primType = primTypes[options2.primitive];\n }\n if (\"count\" in options2) {\n vertCount = options2.count | 0;\n }\n if (\"type\" in options2) {\n dtype = elementTypes[options2.type];\n }\n if (\"length\" in options2) {\n byteLength = options2.length | 0;\n } else {\n byteLength = vertCount;\n if (dtype === GL_UNSIGNED_SHORT$1 || dtype === GL_SHORT$1) {\n byteLength *= 2;\n } else if (dtype === GL_UNSIGNED_INT$1 || dtype === GL_INT$1) {\n byteLength *= 4;\n }\n }\n }\n initElements(\n elements,\n data,\n usage,\n primType,\n vertCount,\n byteLength,\n dtype\n );\n }\n return reglElements;\n }\n reglElements(options);\n reglElements._reglType = \"elements\";\n reglElements._elements = elements;\n reglElements.subdata = function(data, offset) {\n buffer.subdata(data, offset);\n return reglElements;\n };\n reglElements.destroy = function() {\n destroyElements(elements);\n };\n return reglElements;\n }\n return {\n create: createElements,\n createStream: createElementStream,\n destroyStream: destroyElementStream,\n getElements: function(elements) {\n if (typeof elements === \"function\" && elements._elements instanceof REGLElementBuffer) {\n return elements._elements;\n }\n return null;\n },\n clear: function() {\n values(elementSet).forEach(destroyElements);\n }\n };\n }\n var FLOAT = new Float32Array(1);\n var INT = new Uint32Array(FLOAT.buffer);\n var GL_UNSIGNED_SHORT$3 = 5123;\n function convertToHalfFloat(array) {\n var ushorts = pool.allocType(GL_UNSIGNED_SHORT$3, array.length);\n for (var i = 0; i < array.length; ++i) {\n if (isNaN(array[i])) {\n ushorts[i] = 65535;\n } else if (array[i] === Infinity) {\n ushorts[i] = 31744;\n } else if (array[i] === -Infinity) {\n ushorts[i] = 64512;\n } else {\n FLOAT[0] = array[i];\n var x = INT[0];\n var sgn = x >>> 31 << 15;\n var exp = (x << 1 >>> 24) - 127;\n var frac = x >> 13 & (1 << 10) - 1;\n if (exp < -24) {\n ushorts[i] = sgn;\n } else if (exp < -14) {\n var s = -14 - exp;\n ushorts[i] = sgn + (frac + (1 << 10) >> s);\n } else if (exp > 15) {\n ushorts[i] = sgn + 31744;\n } else {\n ushorts[i] = sgn + (exp + 15 << 10) + frac;\n }\n }\n }\n return ushorts;\n }\n function isArrayLike(s) {\n return Array.isArray(s) || isTypedArray(s);\n }\n var GL_COMPRESSED_TEXTURE_FORMATS = 34467;\n var GL_TEXTURE_2D$1 = 3553;\n var GL_TEXTURE_CUBE_MAP$1 = 34067;\n var GL_TEXTURE_CUBE_MAP_POSITIVE_X$1 = 34069;\n var GL_RGBA$1 = 6408;\n var GL_ALPHA = 6406;\n var GL_RGB = 6407;\n var GL_LUMINANCE = 6409;\n var GL_LUMINANCE_ALPHA = 6410;\n var GL_RGBA4 = 32854;\n var GL_RGB5_A1 = 32855;\n var GL_RGB565 = 36194;\n var GL_UNSIGNED_SHORT_4_4_4_4 = 32819;\n var GL_UNSIGNED_SHORT_5_5_5_1 = 32820;\n var GL_UNSIGNED_SHORT_5_6_5 = 33635;\n var GL_UNSIGNED_INT_24_8_WEBGL = 34042;\n var GL_DEPTH_COMPONENT = 6402;\n var GL_DEPTH_STENCIL = 34041;\n var GL_SRGB_EXT = 35904;\n var GL_SRGB_ALPHA_EXT = 35906;\n var GL_HALF_FLOAT_OES = 36193;\n var GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 33776;\n var GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777;\n var GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778;\n var GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779;\n var GL_COMPRESSED_RGB_ATC_WEBGL = 35986;\n var GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 35987;\n var GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 34798;\n var GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840;\n var GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841;\n var GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842;\n var GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843;\n var GL_COMPRESSED_RGB_ETC1_WEBGL = 36196;\n var GL_UNSIGNED_BYTE$4 = 5121;\n var GL_UNSIGNED_SHORT$2 = 5123;\n var GL_UNSIGNED_INT$2 = 5125;\n var GL_FLOAT$3 = 5126;\n var GL_TEXTURE_WRAP_S = 10242;\n var GL_TEXTURE_WRAP_T = 10243;\n var GL_REPEAT = 10497;\n var GL_CLAMP_TO_EDGE = 33071;\n var GL_MIRRORED_REPEAT = 33648;\n var GL_TEXTURE_MAG_FILTER = 10240;\n var GL_TEXTURE_MIN_FILTER = 10241;\n var GL_NEAREST = 9728;\n var GL_LINEAR = 9729;\n var GL_NEAREST_MIPMAP_NEAREST = 9984;\n var GL_LINEAR_MIPMAP_NEAREST = 9985;\n var GL_NEAREST_MIPMAP_LINEAR = 9986;\n var GL_LINEAR_MIPMAP_LINEAR = 9987;\n var GL_GENERATE_MIPMAP_HINT = 33170;\n var GL_DONT_CARE = 4352;\n var GL_FASTEST = 4353;\n var GL_NICEST = 4354;\n var GL_TEXTURE_MAX_ANISOTROPY_EXT = 34046;\n var GL_UNPACK_ALIGNMENT = 3317;\n var GL_UNPACK_FLIP_Y_WEBGL = 37440;\n var GL_UNPACK_PREMULTIPLY_ALPHA_WEBGL = 37441;\n var GL_UNPACK_COLORSPACE_CONVERSION_WEBGL = 37443;\n var GL_BROWSER_DEFAULT_WEBGL = 37444;\n var GL_TEXTURE0$1 = 33984;\n var MIPMAP_FILTERS = [\n GL_NEAREST_MIPMAP_NEAREST,\n GL_NEAREST_MIPMAP_LINEAR,\n GL_LINEAR_MIPMAP_NEAREST,\n GL_LINEAR_MIPMAP_LINEAR\n ];\n var CHANNELS_FORMAT = [\n 0,\n GL_LUMINANCE,\n GL_LUMINANCE_ALPHA,\n GL_RGB,\n GL_RGBA$1\n ];\n var FORMAT_CHANNELS = {};\n FORMAT_CHANNELS[GL_LUMINANCE] = FORMAT_CHANNELS[GL_ALPHA] = FORMAT_CHANNELS[GL_DEPTH_COMPONENT] = 1;\n FORMAT_CHANNELS[GL_DEPTH_STENCIL] = FORMAT_CHANNELS[GL_LUMINANCE_ALPHA] = 2;\n FORMAT_CHANNELS[GL_RGB] = FORMAT_CHANNELS[GL_SRGB_EXT] = 3;\n FORMAT_CHANNELS[GL_RGBA$1] = FORMAT_CHANNELS[GL_SRGB_ALPHA_EXT] = 4;\n function objectName(str) {\n return \"[object \" + str + \"]\";\n }\n var CANVAS_CLASS = objectName(\"HTMLCanvasElement\");\n var OFFSCREENCANVAS_CLASS = objectName(\"OffscreenCanvas\");\n var CONTEXT2D_CLASS = objectName(\"CanvasRenderingContext2D\");\n var BITMAP_CLASS = objectName(\"ImageBitmap\");\n var IMAGE_CLASS = objectName(\"HTMLImageElement\");\n var VIDEO_CLASS = objectName(\"HTMLVideoElement\");\n var PIXEL_CLASSES = Object.keys(arrayTypes).concat([\n CANVAS_CLASS,\n OFFSCREENCANVAS_CLASS,\n CONTEXT2D_CLASS,\n BITMAP_CLASS,\n IMAGE_CLASS,\n VIDEO_CLASS\n ]);\n var TYPE_SIZES = [];\n TYPE_SIZES[GL_UNSIGNED_BYTE$4] = 1;\n TYPE_SIZES[GL_FLOAT$3] = 4;\n TYPE_SIZES[GL_HALF_FLOAT_OES] = 2;\n TYPE_SIZES[GL_UNSIGNED_SHORT$2] = 2;\n TYPE_SIZES[GL_UNSIGNED_INT$2] = 4;\n var FORMAT_SIZES_SPECIAL = [];\n FORMAT_SIZES_SPECIAL[GL_RGBA4] = 2;\n FORMAT_SIZES_SPECIAL[GL_RGB5_A1] = 2;\n FORMAT_SIZES_SPECIAL[GL_RGB565] = 2;\n FORMAT_SIZES_SPECIAL[GL_DEPTH_STENCIL] = 4;\n FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGB_S3TC_DXT1_EXT] = 0.5;\n FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_S3TC_DXT1_EXT] = 0.5;\n FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_S3TC_DXT3_EXT] = 1;\n FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_S3TC_DXT5_EXT] = 1;\n FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGB_ATC_WEBGL] = 0.5;\n FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL] = 1;\n FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL] = 1;\n FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG] = 0.5;\n FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG] = 0.25;\n FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG] = 0.5;\n FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG] = 0.25;\n FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGB_ETC1_WEBGL] = 0.5;\n function isNumericArray(arr) {\n return Array.isArray(arr) && (arr.length === 0 || typeof arr[0] === \"number\");\n }\n function isRectArray(arr) {\n if (!Array.isArray(arr)) {\n return false;\n }\n var width = arr.length;\n if (width === 0 || !isArrayLike(arr[0])) {\n return false;\n }\n return true;\n }\n function classString(x) {\n return Object.prototype.toString.call(x);\n }\n function isCanvasElement(object) {\n return classString(object) === CANVAS_CLASS;\n }\n function isOffscreenCanvas(object) {\n return classString(object) === OFFSCREENCANVAS_CLASS;\n }\n function isContext2D(object) {\n return classString(object) === CONTEXT2D_CLASS;\n }\n function isBitmap(object) {\n return classString(object) === BITMAP_CLASS;\n }\n function isImageElement(object) {\n return classString(object) === IMAGE_CLASS;\n }\n function isVideoElement(object) {\n return classString(object) === VIDEO_CLASS;\n }\n function isPixelData(object) {\n if (!object) {\n return false;\n }\n var className = classString(object);\n if (PIXEL_CLASSES.indexOf(className) >= 0) {\n return true;\n }\n return isNumericArray(object) || isRectArray(object) || isNDArrayLike(object);\n }\n function typedArrayCode$1(data) {\n return arrayTypes[Object.prototype.toString.call(data)] | 0;\n }\n function convertData(result, data) {\n var n = data.length;\n switch (result.type) {\n case GL_UNSIGNED_BYTE$4:\n case GL_UNSIGNED_SHORT$2:\n case GL_UNSIGNED_INT$2:\n case GL_FLOAT$3:\n var converted = pool.allocType(result.type, n);\n converted.set(data);\n result.data = converted;\n break;\n case GL_HALF_FLOAT_OES:\n result.data = convertToHalfFloat(data);\n break;\n default:\n }\n }\n function preConvert(image, n) {\n return pool.allocType(\n image.type === GL_HALF_FLOAT_OES ? GL_FLOAT$3 : image.type,\n n\n );\n }\n function postConvert(image, data) {\n if (image.type === GL_HALF_FLOAT_OES) {\n image.data = convertToHalfFloat(data);\n pool.freeType(data);\n } else {\n image.data = data;\n }\n }\n function transposeData(image, array, strideX, strideY, strideC, offset) {\n var w = image.width;\n var h = image.height;\n var c = image.channels;\n var n = w * h * c;\n var data = preConvert(image, n);\n var p = 0;\n for (var i = 0; i < h; ++i) {\n for (var j = 0; j < w; ++j) {\n for (var k = 0; k < c; ++k) {\n data[p++] = array[strideX * j + strideY * i + strideC * k + offset];\n }\n }\n }\n postConvert(image, data);\n }\n function getTextureSize(format, type, width, height, isMipmap, isCube) {\n var s;\n if (typeof FORMAT_SIZES_SPECIAL[format] !== \"undefined\") {\n s = FORMAT_SIZES_SPECIAL[format];\n } else {\n s = FORMAT_CHANNELS[format] * TYPE_SIZES[type];\n }\n if (isCube) {\n s *= 6;\n }\n if (isMipmap) {\n var total = 0;\n var w = width;\n while (w >= 1) {\n total += s * w * w;\n w /= 2;\n }\n return total;\n } else {\n return s * width * height;\n }\n }\n function createTextureSet(gl2, extensions, limits, reglPoll, contextState, stats2, config) {\n var mipmapHint = {\n \"don't care\": GL_DONT_CARE,\n \"dont care\": GL_DONT_CARE,\n \"nice\": GL_NICEST,\n \"fast\": GL_FASTEST\n };\n var wrapModes = {\n \"repeat\": GL_REPEAT,\n \"clamp\": GL_CLAMP_TO_EDGE,\n \"mirror\": GL_MIRRORED_REPEAT\n };\n var magFilters = {\n \"nearest\": GL_NEAREST,\n \"linear\": GL_LINEAR\n };\n var minFilters = extend2({\n \"mipmap\": GL_LINEAR_MIPMAP_LINEAR,\n \"nearest mipmap nearest\": GL_NEAREST_MIPMAP_NEAREST,\n \"linear mipmap nearest\": GL_LINEAR_MIPMAP_NEAREST,\n \"nearest mipmap linear\": GL_NEAREST_MIPMAP_LINEAR,\n \"linear mipmap linear\": GL_LINEAR_MIPMAP_LINEAR\n }, magFilters);\n var colorSpace = {\n \"none\": 0,\n \"browser\": GL_BROWSER_DEFAULT_WEBGL\n };\n var textureTypes = {\n \"uint8\": GL_UNSIGNED_BYTE$4,\n \"rgba4\": GL_UNSIGNED_SHORT_4_4_4_4,\n \"rgb565\": GL_UNSIGNED_SHORT_5_6_5,\n \"rgb5 a1\": GL_UNSIGNED_SHORT_5_5_5_1\n };\n var textureFormats = {\n \"alpha\": GL_ALPHA,\n \"luminance\": GL_LUMINANCE,\n \"luminance alpha\": GL_LUMINANCE_ALPHA,\n \"rgb\": GL_RGB,\n \"rgba\": GL_RGBA$1,\n \"rgba4\": GL_RGBA4,\n \"rgb5 a1\": GL_RGB5_A1,\n \"rgb565\": GL_RGB565\n };\n var compressedTextureFormats = {};\n if (extensions.ext_srgb) {\n textureFormats.srgb = GL_SRGB_EXT;\n textureFormats.srgba = GL_SRGB_ALPHA_EXT;\n }\n if (extensions.oes_texture_float) {\n textureTypes.float32 = textureTypes.float = GL_FLOAT$3;\n }\n if (extensions.oes_texture_half_float) {\n textureTypes[\"float16\"] = textureTypes[\"half float\"] = GL_HALF_FLOAT_OES;\n }\n if (extensions.webgl_depth_texture) {\n extend2(textureFormats, {\n \"depth\": GL_DEPTH_COMPONENT,\n \"depth stencil\": GL_DEPTH_STENCIL\n });\n extend2(textureTypes, {\n \"uint16\": GL_UNSIGNED_SHORT$2,\n \"uint32\": GL_UNSIGNED_INT$2,\n \"depth stencil\": GL_UNSIGNED_INT_24_8_WEBGL\n });\n }\n if (extensions.webgl_compressed_texture_s3tc) {\n extend2(compressedTextureFormats, {\n \"rgb s3tc dxt1\": GL_COMPRESSED_RGB_S3TC_DXT1_EXT,\n \"rgba s3tc dxt1\": GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,\n \"rgba s3tc dxt3\": GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,\n \"rgba s3tc dxt5\": GL_COMPRESSED_RGBA_S3TC_DXT5_EXT\n });\n }\n if (extensions.webgl_compressed_texture_atc) {\n extend2(compressedTextureFormats, {\n \"rgb atc\": GL_COMPRESSED_RGB_ATC_WEBGL,\n \"rgba atc explicit alpha\": GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,\n \"rgba atc interpolated alpha\": GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL\n });\n }\n if (extensions.webgl_compressed_texture_pvrtc) {\n extend2(compressedTextureFormats, {\n \"rgb pvrtc 4bppv1\": GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,\n \"rgb pvrtc 2bppv1\": GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,\n \"rgba pvrtc 4bppv1\": GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,\n \"rgba pvrtc 2bppv1\": GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG\n });\n }\n if (extensions.webgl_compressed_texture_etc1) {\n compressedTextureFormats[\"rgb etc1\"] = GL_COMPRESSED_RGB_ETC1_WEBGL;\n }\n var supportedCompressedFormats = Array.prototype.slice.call(\n gl2.getParameter(GL_COMPRESSED_TEXTURE_FORMATS)\n );\n Object.keys(compressedTextureFormats).forEach(function(name2) {\n var format = compressedTextureFormats[name2];\n if (supportedCompressedFormats.indexOf(format) >= 0) {\n textureFormats[name2] = format;\n }\n });\n var supportedFormats = Object.keys(textureFormats);\n limits.textureFormats = supportedFormats;\n var textureFormatsInvert = [];\n Object.keys(textureFormats).forEach(function(key) {\n var val = textureFormats[key];\n textureFormatsInvert[val] = key;\n });\n var textureTypesInvert = [];\n Object.keys(textureTypes).forEach(function(key) {\n var val = textureTypes[key];\n textureTypesInvert[val] = key;\n });\n var magFiltersInvert = [];\n Object.keys(magFilters).forEach(function(key) {\n var val = magFilters[key];\n magFiltersInvert[val] = key;\n });\n var minFiltersInvert = [];\n Object.keys(minFilters).forEach(function(key) {\n var val = minFilters[key];\n minFiltersInvert[val] = key;\n });\n var wrapModesInvert = [];\n Object.keys(wrapModes).forEach(function(key) {\n var val = wrapModes[key];\n wrapModesInvert[val] = key;\n });\n var colorFormats = supportedFormats.reduce(function(color2, key) {\n var glenum = textureFormats[key];\n if (glenum === GL_LUMINANCE || glenum === GL_ALPHA || glenum === GL_LUMINANCE || glenum === GL_LUMINANCE_ALPHA || glenum === GL_DEPTH_COMPONENT || glenum === GL_DEPTH_STENCIL || extensions.ext_srgb && (glenum === GL_SRGB_EXT || glenum === GL_SRGB_ALPHA_EXT)) {\n color2[glenum] = glenum;\n } else if (glenum === GL_RGB5_A1 || key.indexOf(\"rgba\") >= 0) {\n color2[glenum] = GL_RGBA$1;\n } else {\n color2[glenum] = GL_RGB;\n }\n return color2;\n }, {});\n function TexFlags() {\n this.internalformat = GL_RGBA$1;\n this.format = GL_RGBA$1;\n this.type = GL_UNSIGNED_BYTE$4;\n this.compressed = false;\n this.premultiplyAlpha = false;\n this.flipY = false;\n this.unpackAlignment = 1;\n this.colorSpace = GL_BROWSER_DEFAULT_WEBGL;\n this.width = 0;\n this.height = 0;\n this.channels = 0;\n }\n function copyFlags(result, other) {\n result.internalformat = other.internalformat;\n result.format = other.format;\n result.type = other.type;\n result.compressed = other.compressed;\n result.premultiplyAlpha = other.premultiplyAlpha;\n result.flipY = other.flipY;\n result.unpackAlignment = other.unpackAlignment;\n result.colorSpace = other.colorSpace;\n result.width = other.width;\n result.height = other.height;\n result.channels = other.channels;\n }\n function parseFlags(flags, options) {\n if (typeof options !== \"object\" || !options) {\n return;\n }\n if (\"premultiplyAlpha\" in options) {\n flags.premultiplyAlpha = options.premultiplyAlpha;\n }\n if (\"flipY\" in options) {\n flags.flipY = options.flipY;\n }\n if (\"alignment\" in options) {\n flags.unpackAlignment = options.alignment;\n }\n if (\"colorSpace\" in options) {\n flags.colorSpace = colorSpace[options.colorSpace];\n }\n if (\"type\" in options) {\n var type = options.type;\n flags.type = textureTypes[type];\n }\n var w = flags.width;\n var h = flags.height;\n var c = flags.channels;\n var hasChannels = false;\n if (\"shape\" in options) {\n w = options.shape[0];\n h = options.shape[1];\n if (options.shape.length === 3) {\n c = options.shape[2];\n hasChannels = true;\n }\n } else {\n if (\"radius\" in options) {\n w = h = options.radius;\n }\n if (\"width\" in options) {\n w = options.width;\n }\n if (\"height\" in options) {\n h = options.height;\n }\n if (\"channels\" in options) {\n c = options.channels;\n hasChannels = true;\n }\n }\n flags.width = w | 0;\n flags.height = h | 0;\n flags.channels = c | 0;\n var hasFormat = false;\n if (\"format\" in options) {\n var formatStr = options.format;\n var internalformat = flags.internalformat = textureFormats[formatStr];\n flags.format = colorFormats[internalformat];\n if (formatStr in textureTypes) {\n if (!(\"type\" in options)) {\n flags.type = textureTypes[formatStr];\n }\n }\n if (formatStr in compressedTextureFormats) {\n flags.compressed = true;\n }\n hasFormat = true;\n }\n if (!hasChannels && hasFormat) {\n flags.channels = FORMAT_CHANNELS[flags.format];\n } else if (hasChannels && !hasFormat) {\n if (flags.channels !== CHANNELS_FORMAT[flags.format]) {\n flags.format = flags.internalformat = CHANNELS_FORMAT[flags.channels];\n }\n } else if (hasFormat && hasChannels) {\n }\n }\n function setFlags(flags) {\n gl2.pixelStorei(GL_UNPACK_FLIP_Y_WEBGL, flags.flipY);\n gl2.pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_WEBGL, flags.premultiplyAlpha);\n gl2.pixelStorei(GL_UNPACK_COLORSPACE_CONVERSION_WEBGL, flags.colorSpace);\n gl2.pixelStorei(GL_UNPACK_ALIGNMENT, flags.unpackAlignment);\n }\n function TexImage() {\n TexFlags.call(this);\n this.xOffset = 0;\n this.yOffset = 0;\n this.data = null;\n this.needsFree = false;\n this.element = null;\n this.needsCopy = false;\n }\n function parseImage(image, options) {\n var data = null;\n if (isPixelData(options)) {\n data = options;\n } else if (options) {\n parseFlags(image, options);\n if (\"x\" in options) {\n image.xOffset = options.x | 0;\n }\n if (\"y\" in options) {\n image.yOffset = options.y | 0;\n }\n if (isPixelData(options.data)) {\n data = options.data;\n }\n }\n if (options.copy) {\n var viewW = contextState.viewportWidth;\n var viewH = contextState.viewportHeight;\n image.width = image.width || viewW - image.xOffset;\n image.height = image.height || viewH - image.yOffset;\n image.needsCopy = true;\n } else if (!data) {\n image.width = image.width || 1;\n image.height = image.height || 1;\n image.channels = image.channels || 4;\n } else if (isTypedArray(data)) {\n image.channels = image.channels || 4;\n image.data = data;\n if (!(\"type\" in options) && image.type === GL_UNSIGNED_BYTE$4) {\n image.type = typedArrayCode$1(data);\n }\n } else if (isNumericArray(data)) {\n image.channels = image.channels || 4;\n convertData(image, data);\n image.alignment = 1;\n image.needsFree = true;\n } else if (isNDArrayLike(data)) {\n var array = data.data;\n if (!Array.isArray(array) && image.type === GL_UNSIGNED_BYTE$4) {\n image.type = typedArrayCode$1(array);\n }\n var shape = data.shape;\n var stride = data.stride;\n var shapeX, shapeY, shapeC, strideX, strideY, strideC;\n if (shape.length === 3) {\n shapeC = shape[2];\n strideC = stride[2];\n } else {\n shapeC = 1;\n strideC = 1;\n }\n shapeX = shape[0];\n shapeY = shape[1];\n strideX = stride[0];\n strideY = stride[1];\n image.alignment = 1;\n image.width = shapeX;\n image.height = shapeY;\n image.channels = shapeC;\n image.format = image.internalformat = CHANNELS_FORMAT[shapeC];\n image.needsFree = true;\n transposeData(image, array, strideX, strideY, strideC, data.offset);\n } else if (isCanvasElement(data) || isOffscreenCanvas(data) || isContext2D(data)) {\n if (isCanvasElement(data) || isOffscreenCanvas(data)) {\n image.element = data;\n } else {\n image.element = data.canvas;\n }\n image.width = image.element.width;\n image.height = image.element.height;\n image.channels = 4;\n } else if (isBitmap(data)) {\n image.element = data;\n image.width = data.width;\n image.height = data.height;\n image.channels = 4;\n } else if (isImageElement(data)) {\n image.element = data;\n image.width = data.naturalWidth;\n image.height = data.naturalHeight;\n image.channels = 4;\n } else if (isVideoElement(data)) {\n image.element = data;\n image.width = data.videoWidth;\n image.height = data.videoHeight;\n image.channels = 4;\n } else if (isRectArray(data)) {\n var w = image.width || data[0].length;\n var h = image.height || data.length;\n var c = image.channels;\n if (isArrayLike(data[0][0])) {\n c = c || data[0][0].length;\n } else {\n c = c || 1;\n }\n var arrayShape2 = flattenUtils.shape(data);\n var n = 1;\n for (var dd = 0; dd < arrayShape2.length; ++dd) {\n n *= arrayShape2[dd];\n }\n var allocData = preConvert(image, n);\n flattenUtils.flatten(data, arrayShape2, \"\", allocData);\n postConvert(image, allocData);\n image.alignment = 1;\n image.width = w;\n image.height = h;\n image.channels = c;\n image.format = image.internalformat = CHANNELS_FORMAT[c];\n image.needsFree = true;\n }\n if (image.type === GL_FLOAT$3) {\n } else if (image.type === GL_HALF_FLOAT_OES) {\n }\n }\n function setImage(info, target, miplevel) {\n var element = info.element;\n var data = info.data;\n var internalformat = info.internalformat;\n var format = info.format;\n var type = info.type;\n var width = info.width;\n var height = info.height;\n setFlags(info);\n if (element) {\n gl2.texImage2D(target, miplevel, format, format, type, element);\n } else if (info.compressed) {\n gl2.compressedTexImage2D(target, miplevel, internalformat, width, height, 0, data);\n } else if (info.needsCopy) {\n reglPoll();\n gl2.copyTexImage2D(\n target,\n miplevel,\n format,\n info.xOffset,\n info.yOffset,\n width,\n height,\n 0\n );\n } else {\n gl2.texImage2D(target, miplevel, format, width, height, 0, format, type, data || null);\n }\n }\n function setSubImage(info, target, x, y, miplevel) {\n var element = info.element;\n var data = info.data;\n var internalformat = info.internalformat;\n var format = info.format;\n var type = info.type;\n var width = info.width;\n var height = info.height;\n setFlags(info);\n if (element) {\n gl2.texSubImage2D(\n target,\n miplevel,\n x,\n y,\n format,\n type,\n element\n );\n } else if (info.compressed) {\n gl2.compressedTexSubImage2D(\n target,\n miplevel,\n x,\n y,\n internalformat,\n width,\n height,\n data\n );\n } else if (info.needsCopy) {\n reglPoll();\n gl2.copyTexSubImage2D(\n target,\n miplevel,\n x,\n y,\n info.xOffset,\n info.yOffset,\n width,\n height\n );\n } else {\n gl2.texSubImage2D(\n target,\n miplevel,\n x,\n y,\n width,\n height,\n format,\n type,\n data\n );\n }\n }\n var imagePool = [];\n function allocImage() {\n return imagePool.pop() || new TexImage();\n }\n function freeImage(image) {\n if (image.needsFree) {\n pool.freeType(image.data);\n }\n TexImage.call(image);\n imagePool.push(image);\n }\n function MipMap() {\n TexFlags.call(this);\n this.genMipmaps = false;\n this.mipmapHint = GL_DONT_CARE;\n this.mipmask = 0;\n this.images = Array(16);\n }\n function parseMipMapFromShape(mipmap, width, height) {\n var img = mipmap.images[0] = allocImage();\n mipmap.mipmask = 1;\n img.width = mipmap.width = width;\n img.height = mipmap.height = height;\n img.channels = mipmap.channels = 4;\n }\n function parseMipMapFromObject(mipmap, options) {\n var imgData = null;\n if (isPixelData(options)) {\n imgData = mipmap.images[0] = allocImage();\n copyFlags(imgData, mipmap);\n parseImage(imgData, options);\n mipmap.mipmask = 1;\n } else {\n parseFlags(mipmap, options);\n if (Array.isArray(options.mipmap)) {\n var mipData = options.mipmap;\n for (var i = 0; i < mipData.length; ++i) {\n imgData = mipmap.images[i] = allocImage();\n copyFlags(imgData, mipmap);\n imgData.width >>= i;\n imgData.height >>= i;\n parseImage(imgData, mipData[i]);\n mipmap.mipmask |= 1 << i;\n }\n } else {\n imgData = mipmap.images[0] = allocImage();\n copyFlags(imgData, mipmap);\n parseImage(imgData, options);\n mipmap.mipmask = 1;\n }\n }\n copyFlags(mipmap, mipmap.images[0]);\n if (mipmap.compressed && (mipmap.internalformat === GL_COMPRESSED_RGB_S3TC_DXT1_EXT || mipmap.internalformat === GL_COMPRESSED_RGBA_S3TC_DXT1_EXT || mipmap.internalformat === GL_COMPRESSED_RGBA_S3TC_DXT3_EXT || mipmap.internalformat === GL_COMPRESSED_RGBA_S3TC_DXT5_EXT)) {\n }\n }\n function setMipMap(mipmap, target) {\n var images = mipmap.images;\n for (var i = 0; i < images.length; ++i) {\n if (!images[i]) {\n return;\n }\n setImage(images[i], target, i);\n }\n }\n var mipPool = [];\n function allocMipMap() {\n var result = mipPool.pop() || new MipMap();\n TexFlags.call(result);\n result.mipmask = 0;\n for (var i = 0; i < 16; ++i) {\n result.images[i] = null;\n }\n return result;\n }\n function freeMipMap(mipmap) {\n var images = mipmap.images;\n for (var i = 0; i < images.length; ++i) {\n if (images[i]) {\n freeImage(images[i]);\n }\n images[i] = null;\n }\n mipPool.push(mipmap);\n }\n function TexInfo() {\n this.minFilter = GL_NEAREST;\n this.magFilter = GL_NEAREST;\n this.wrapS = GL_CLAMP_TO_EDGE;\n this.wrapT = GL_CLAMP_TO_EDGE;\n this.anisotropic = 1;\n this.genMipmaps = false;\n this.mipmapHint = GL_DONT_CARE;\n }\n function parseTexInfo(info, options) {\n if (\"min\" in options) {\n var minFilter = options.min;\n info.minFilter = minFilters[minFilter];\n if (MIPMAP_FILTERS.indexOf(info.minFilter) >= 0 && !(\"faces\" in options)) {\n info.genMipmaps = true;\n }\n }\n if (\"mag\" in options) {\n var magFilter = options.mag;\n info.magFilter = magFilters[magFilter];\n }\n var wrapS = info.wrapS;\n var wrapT = info.wrapT;\n if (\"wrap\" in options) {\n var wrap = options.wrap;\n if (typeof wrap === \"string\") {\n wrapS = wrapT = wrapModes[wrap];\n } else if (Array.isArray(wrap)) {\n wrapS = wrapModes[wrap[0]];\n wrapT = wrapModes[wrap[1]];\n }\n } else {\n if (\"wrapS\" in options) {\n var optWrapS = options.wrapS;\n wrapS = wrapModes[optWrapS];\n }\n if (\"wrapT\" in options) {\n var optWrapT = options.wrapT;\n wrapT = wrapModes[optWrapT];\n }\n }\n info.wrapS = wrapS;\n info.wrapT = wrapT;\n if (\"anisotropic\" in options) {\n var anisotropic = options.anisotropic;\n info.anisotropic = options.anisotropic;\n }\n if (\"mipmap\" in options) {\n var hasMipMap = false;\n switch (typeof options.mipmap) {\n case \"string\":\n info.mipmapHint = mipmapHint[options.mipmap];\n info.genMipmaps = true;\n hasMipMap = true;\n break;\n case \"boolean\":\n hasMipMap = info.genMipmaps = options.mipmap;\n break;\n case \"object\":\n info.genMipmaps = false;\n hasMipMap = true;\n break;\n default:\n }\n if (hasMipMap && !(\"min\" in options)) {\n info.minFilter = GL_NEAREST_MIPMAP_NEAREST;\n }\n }\n }\n function setTexInfo(info, target) {\n gl2.texParameteri(target, GL_TEXTURE_MIN_FILTER, info.minFilter);\n gl2.texParameteri(target, GL_TEXTURE_MAG_FILTER, info.magFilter);\n gl2.texParameteri(target, GL_TEXTURE_WRAP_S, info.wrapS);\n gl2.texParameteri(target, GL_TEXTURE_WRAP_T, info.wrapT);\n if (extensions.ext_texture_filter_anisotropic) {\n gl2.texParameteri(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, info.anisotropic);\n }\n if (info.genMipmaps) {\n gl2.hint(GL_GENERATE_MIPMAP_HINT, info.mipmapHint);\n gl2.generateMipmap(target);\n }\n }\n var textureCount = 0;\n var textureSet = {};\n var numTexUnits = limits.maxTextureUnits;\n var textureUnits = Array(numTexUnits).map(function() {\n return null;\n });\n function REGLTexture(target) {\n TexFlags.call(this);\n this.mipmask = 0;\n this.internalformat = GL_RGBA$1;\n this.id = textureCount++;\n this.refCount = 1;\n this.target = target;\n this.texture = gl2.createTexture();\n this.unit = -1;\n this.bindCount = 0;\n this.texInfo = new TexInfo();\n if (config.profile) {\n this.stats = { size: 0 };\n }\n }\n function tempBind(texture) {\n gl2.activeTexture(GL_TEXTURE0$1);\n gl2.bindTexture(texture.target, texture.texture);\n }\n function tempRestore() {\n var prev = textureUnits[0];\n if (prev) {\n gl2.bindTexture(prev.target, prev.texture);\n } else {\n gl2.bindTexture(GL_TEXTURE_2D$1, null);\n }\n }\n function destroy(texture) {\n var handle = texture.texture;\n var unit = texture.unit;\n var target = texture.target;\n if (unit >= 0) {\n gl2.activeTexture(GL_TEXTURE0$1 + unit);\n gl2.bindTexture(target, null);\n textureUnits[unit] = null;\n }\n gl2.deleteTexture(handle);\n texture.texture = null;\n texture.params = null;\n texture.pixels = null;\n texture.refCount = 0;\n delete textureSet[texture.id];\n stats2.textureCount--;\n }\n extend2(REGLTexture.prototype, {\n bind: function() {\n var texture = this;\n texture.bindCount += 1;\n var unit = texture.unit;\n if (unit < 0) {\n for (var i = 0; i < numTexUnits; ++i) {\n var other = textureUnits[i];\n if (other) {\n if (other.bindCount > 0) {\n continue;\n }\n other.unit = -1;\n }\n textureUnits[i] = texture;\n unit = i;\n break;\n }\n if (unit >= numTexUnits) {\n }\n if (config.profile && stats2.maxTextureUnits < unit + 1) {\n stats2.maxTextureUnits = unit + 1;\n }\n texture.unit = unit;\n gl2.activeTexture(GL_TEXTURE0$1 + unit);\n gl2.bindTexture(texture.target, texture.texture);\n }\n return unit;\n },\n unbind: function() {\n this.bindCount -= 1;\n },\n decRef: function() {\n if (--this.refCount <= 0) {\n destroy(this);\n }\n }\n });\n function createTexture2D(a, b) {\n var texture = new REGLTexture(GL_TEXTURE_2D$1);\n textureSet[texture.id] = texture;\n stats2.textureCount++;\n function reglTexture2D(a2, b2) {\n var texInfo = texture.texInfo;\n TexInfo.call(texInfo);\n var mipData = allocMipMap();\n if (typeof a2 === \"number\") {\n if (typeof b2 === \"number\") {\n parseMipMapFromShape(mipData, a2 | 0, b2 | 0);\n } else {\n parseMipMapFromShape(mipData, a2 | 0, a2 | 0);\n }\n } else if (a2) {\n parseTexInfo(texInfo, a2);\n parseMipMapFromObject(mipData, a2);\n } else {\n parseMipMapFromShape(mipData, 1, 1);\n }\n if (texInfo.genMipmaps) {\n mipData.mipmask = (mipData.width << 1) - 1;\n }\n texture.mipmask = mipData.mipmask;\n copyFlags(texture, mipData);\n texture.internalformat = mipData.internalformat;\n reglTexture2D.width = mipData.width;\n reglTexture2D.height = mipData.height;\n tempBind(texture);\n setMipMap(mipData, GL_TEXTURE_2D$1);\n setTexInfo(texInfo, GL_TEXTURE_2D$1);\n tempRestore();\n freeMipMap(mipData);\n if (config.profile) {\n texture.stats.size = getTextureSize(\n texture.internalformat,\n texture.type,\n mipData.width,\n mipData.height,\n texInfo.genMipmaps,\n false\n );\n }\n reglTexture2D.format = textureFormatsInvert[texture.internalformat];\n reglTexture2D.type = textureTypesInvert[texture.type];\n reglTexture2D.mag = magFiltersInvert[texInfo.magFilter];\n reglTexture2D.min = minFiltersInvert[texInfo.minFilter];\n reglTexture2D.wrapS = wrapModesInvert[texInfo.wrapS];\n reglTexture2D.wrapT = wrapModesInvert[texInfo.wrapT];\n return reglTexture2D;\n }\n function subimage(image, x_, y_, level_) {\n var x = x_ | 0;\n var y = y_ | 0;\n var level = level_ | 0;\n var imageData = allocImage();\n copyFlags(imageData, texture);\n imageData.width = 0;\n imageData.height = 0;\n parseImage(imageData, image);\n imageData.width = imageData.width || (texture.width >> level) - x;\n imageData.height = imageData.height || (texture.height >> level) - y;\n tempBind(texture);\n setSubImage(imageData, GL_TEXTURE_2D$1, x, y, level);\n tempRestore();\n freeImage(imageData);\n return reglTexture2D;\n }\n function resize(w_, h_) {\n var w = w_ | 0;\n var h = h_ | 0 || w;\n if (w === texture.width && h === texture.height) {\n return reglTexture2D;\n }\n reglTexture2D.width = texture.width = w;\n reglTexture2D.height = texture.height = h;\n tempBind(texture);\n for (var i = 0; texture.mipmask >> i; ++i) {\n var _w = w >> i;\n var _h = h >> i;\n if (!_w || !_h) break;\n gl2.texImage2D(\n GL_TEXTURE_2D$1,\n i,\n texture.format,\n _w,\n _h,\n 0,\n texture.format,\n texture.type,\n null\n );\n }\n tempRestore();\n if (config.profile) {\n texture.stats.size = getTextureSize(\n texture.internalformat,\n texture.type,\n w,\n h,\n false,\n false\n );\n }\n return reglTexture2D;\n }\n reglTexture2D(a, b);\n reglTexture2D.subimage = subimage;\n reglTexture2D.resize = resize;\n reglTexture2D._reglType = \"texture2d\";\n reglTexture2D._texture = texture;\n if (config.profile) {\n reglTexture2D.stats = texture.stats;\n }\n reglTexture2D.destroy = function() {\n texture.decRef();\n };\n return reglTexture2D;\n }\n function createTextureCube(a0, a1, a2, a3, a4, a5) {\n var texture = new REGLTexture(GL_TEXTURE_CUBE_MAP$1);\n textureSet[texture.id] = texture;\n stats2.cubeCount++;\n var faces = new Array(6);\n function reglTextureCube(a02, a12, a22, a32, a42, a52) {\n var i;\n var texInfo = texture.texInfo;\n TexInfo.call(texInfo);\n for (i = 0; i < 6; ++i) {\n faces[i] = allocMipMap();\n }\n if (typeof a02 === \"number\" || !a02) {\n var s = a02 | 0 || 1;\n for (i = 0; i < 6; ++i) {\n parseMipMapFromShape(faces[i], s, s);\n }\n } else if (typeof a02 === \"object\") {\n if (a12) {\n parseMipMapFromObject(faces[0], a02);\n parseMipMapFromObject(faces[1], a12);\n parseMipMapFromObject(faces[2], a22);\n parseMipMapFromObject(faces[3], a32);\n parseMipMapFromObject(faces[4], a42);\n parseMipMapFromObject(faces[5], a52);\n } else {\n parseTexInfo(texInfo, a02);\n parseFlags(texture, a02);\n if (\"faces\" in a02) {\n var faceInput = a02.faces;\n for (i = 0; i < 6; ++i) {\n copyFlags(faces[i], texture);\n parseMipMapFromObject(faces[i], faceInput[i]);\n }\n } else {\n for (i = 0; i < 6; ++i) {\n parseMipMapFromObject(faces[i], a02);\n }\n }\n }\n } else {\n }\n copyFlags(texture, faces[0]);\n if (texInfo.genMipmaps) {\n texture.mipmask = (faces[0].width << 1) - 1;\n } else {\n texture.mipmask = faces[0].mipmask;\n }\n texture.internalformat = faces[0].internalformat;\n reglTextureCube.width = faces[0].width;\n reglTextureCube.height = faces[0].height;\n tempBind(texture);\n for (i = 0; i < 6; ++i) {\n setMipMap(faces[i], GL_TEXTURE_CUBE_MAP_POSITIVE_X$1 + i);\n }\n setTexInfo(texInfo, GL_TEXTURE_CUBE_MAP$1);\n tempRestore();\n if (config.profile) {\n texture.stats.size = getTextureSize(\n texture.internalformat,\n texture.type,\n reglTextureCube.width,\n reglTextureCube.height,\n texInfo.genMipmaps,\n true\n );\n }\n reglTextureCube.format = textureFormatsInvert[texture.internalformat];\n reglTextureCube.type = textureTypesInvert[texture.type];\n reglTextureCube.mag = magFiltersInvert[texInfo.magFilter];\n reglTextureCube.min = minFiltersInvert[texInfo.minFilter];\n reglTextureCube.wrapS = wrapModesInvert[texInfo.wrapS];\n reglTextureCube.wrapT = wrapModesInvert[texInfo.wrapT];\n for (i = 0; i < 6; ++i) {\n freeMipMap(faces[i]);\n }\n return reglTextureCube;\n }\n function subimage(face, image, x_, y_, level_) {\n var x = x_ | 0;\n var y = y_ | 0;\n var level = level_ | 0;\n var imageData = allocImage();\n copyFlags(imageData, texture);\n imageData.width = 0;\n imageData.height = 0;\n parseImage(imageData, image);\n imageData.width = imageData.width || (texture.width >> level) - x;\n imageData.height = imageData.height || (texture.height >> level) - y;\n tempBind(texture);\n setSubImage(imageData, GL_TEXTURE_CUBE_MAP_POSITIVE_X$1 + face, x, y, level);\n tempRestore();\n freeImage(imageData);\n return reglTextureCube;\n }\n function resize(radius_) {\n var radius = radius_ | 0;\n if (radius === texture.width) {\n return;\n }\n reglTextureCube.width = texture.width = radius;\n reglTextureCube.height = texture.height = radius;\n tempBind(texture);\n for (var i = 0; i < 6; ++i) {\n for (var j = 0; texture.mipmask >> j; ++j) {\n gl2.texImage2D(\n GL_TEXTURE_CUBE_MAP_POSITIVE_X$1 + i,\n j,\n texture.format,\n radius >> j,\n radius >> j,\n 0,\n texture.format,\n texture.type,\n null\n );\n }\n }\n tempRestore();\n if (config.profile) {\n texture.stats.size = getTextureSize(\n texture.internalformat,\n texture.type,\n reglTextureCube.width,\n reglTextureCube.height,\n false,\n true\n );\n }\n return reglTextureCube;\n }\n reglTextureCube(a0, a1, a2, a3, a4, a5);\n reglTextureCube.subimage = subimage;\n reglTextureCube.resize = resize;\n reglTextureCube._reglType = \"textureCube\";\n reglTextureCube._texture = texture;\n if (config.profile) {\n reglTextureCube.stats = texture.stats;\n }\n reglTextureCube.destroy = function() {\n texture.decRef();\n };\n return reglTextureCube;\n }\n function destroyTextures() {\n for (var i = 0; i < numTexUnits; ++i) {\n gl2.activeTexture(GL_TEXTURE0$1 + i);\n gl2.bindTexture(GL_TEXTURE_2D$1, null);\n textureUnits[i] = null;\n }\n values(textureSet).forEach(destroy);\n stats2.cubeCount = 0;\n stats2.textureCount = 0;\n }\n if (config.profile) {\n stats2.getTotalTextureSize = function() {\n var total = 0;\n Object.keys(textureSet).forEach(function(key) {\n total += textureSet[key].stats.size;\n });\n return total;\n };\n }\n function restoreTextures() {\n for (var i = 0; i < numTexUnits; ++i) {\n var tex = textureUnits[i];\n if (tex) {\n tex.bindCount = 0;\n tex.unit = -1;\n textureUnits[i] = null;\n }\n }\n values(textureSet).forEach(function(texture) {\n texture.texture = gl2.createTexture();\n gl2.bindTexture(texture.target, texture.texture);\n for (var i2 = 0; i2 < 32; ++i2) {\n if ((texture.mipmask & 1 << i2) === 0) {\n continue;\n }\n if (texture.target === GL_TEXTURE_2D$1) {\n gl2.texImage2D(\n GL_TEXTURE_2D$1,\n i2,\n texture.internalformat,\n texture.width >> i2,\n texture.height >> i2,\n 0,\n texture.internalformat,\n texture.type,\n null\n );\n } else {\n for (var j = 0; j < 6; ++j) {\n gl2.texImage2D(\n GL_TEXTURE_CUBE_MAP_POSITIVE_X$1 + j,\n i2,\n texture.internalformat,\n texture.width >> i2,\n texture.height >> i2,\n 0,\n texture.internalformat,\n texture.type,\n null\n );\n }\n }\n }\n setTexInfo(texture.texInfo, texture.target);\n });\n }\n function refreshTextures() {\n for (var i = 0; i < numTexUnits; ++i) {\n var tex = textureUnits[i];\n if (tex) {\n tex.bindCount = 0;\n tex.unit = -1;\n textureUnits[i] = null;\n }\n gl2.activeTexture(GL_TEXTURE0$1 + i);\n gl2.bindTexture(GL_TEXTURE_2D$1, null);\n gl2.bindTexture(GL_TEXTURE_CUBE_MAP$1, null);\n }\n }\n return {\n create2D: createTexture2D,\n createCube: createTextureCube,\n clear: destroyTextures,\n getTexture: function(wrapper) {\n return null;\n },\n restore: restoreTextures,\n refresh: refreshTextures\n };\n }\n var GL_RENDERBUFFER = 36161;\n var GL_RGBA4$1 = 32854;\n var GL_RGB5_A1$1 = 32855;\n var GL_RGB565$1 = 36194;\n var GL_DEPTH_COMPONENT16 = 33189;\n var GL_STENCIL_INDEX8 = 36168;\n var GL_DEPTH_STENCIL$1 = 34041;\n var GL_SRGB8_ALPHA8_EXT = 35907;\n var GL_RGBA32F_EXT = 34836;\n var GL_RGBA16F_EXT = 34842;\n var GL_RGB16F_EXT = 34843;\n var FORMAT_SIZES = [];\n FORMAT_SIZES[GL_RGBA4$1] = 2;\n FORMAT_SIZES[GL_RGB5_A1$1] = 2;\n FORMAT_SIZES[GL_RGB565$1] = 2;\n FORMAT_SIZES[GL_DEPTH_COMPONENT16] = 2;\n FORMAT_SIZES[GL_STENCIL_INDEX8] = 1;\n FORMAT_SIZES[GL_DEPTH_STENCIL$1] = 4;\n FORMAT_SIZES[GL_SRGB8_ALPHA8_EXT] = 4;\n FORMAT_SIZES[GL_RGBA32F_EXT] = 16;\n FORMAT_SIZES[GL_RGBA16F_EXT] = 8;\n FORMAT_SIZES[GL_RGB16F_EXT] = 6;\n function getRenderbufferSize(format, width, height) {\n return FORMAT_SIZES[format] * width * height;\n }\n var wrapRenderbuffers = function(gl2, extensions, limits, stats2, config) {\n var formatTypes = {\n \"rgba4\": GL_RGBA4$1,\n \"rgb565\": GL_RGB565$1,\n \"rgb5 a1\": GL_RGB5_A1$1,\n \"depth\": GL_DEPTH_COMPONENT16,\n \"stencil\": GL_STENCIL_INDEX8,\n \"depth stencil\": GL_DEPTH_STENCIL$1\n };\n if (extensions.ext_srgb) {\n formatTypes[\"srgba\"] = GL_SRGB8_ALPHA8_EXT;\n }\n if (extensions.ext_color_buffer_half_float) {\n formatTypes[\"rgba16f\"] = GL_RGBA16F_EXT;\n formatTypes[\"rgb16f\"] = GL_RGB16F_EXT;\n }\n if (extensions.webgl_color_buffer_float) {\n formatTypes[\"rgba32f\"] = GL_RGBA32F_EXT;\n }\n var formatTypesInvert = [];\n Object.keys(formatTypes).forEach(function(key) {\n var val = formatTypes[key];\n formatTypesInvert[val] = key;\n });\n var renderbufferCount = 0;\n var renderbufferSet = {};\n function REGLRenderbuffer(renderbuffer) {\n this.id = renderbufferCount++;\n this.refCount = 1;\n this.renderbuffer = renderbuffer;\n this.format = GL_RGBA4$1;\n this.width = 0;\n this.height = 0;\n if (config.profile) {\n this.stats = { size: 0 };\n }\n }\n REGLRenderbuffer.prototype.decRef = function() {\n if (--this.refCount <= 0) {\n destroy(this);\n }\n };\n function destroy(rb) {\n var handle = rb.renderbuffer;\n gl2.bindRenderbuffer(GL_RENDERBUFFER, null);\n gl2.deleteRenderbuffer(handle);\n rb.renderbuffer = null;\n rb.refCount = 0;\n delete renderbufferSet[rb.id];\n stats2.renderbufferCount--;\n }\n function createRenderbuffer(a, b) {\n var renderbuffer = new REGLRenderbuffer(gl2.createRenderbuffer());\n renderbufferSet[renderbuffer.id] = renderbuffer;\n stats2.renderbufferCount++;\n function reglRenderbuffer(a2, b2) {\n var w = 0;\n var h = 0;\n var format = GL_RGBA4$1;\n if (typeof a2 === \"object\" && a2) {\n var options = a2;\n if (\"shape\" in options) {\n var shape = options.shape;\n w = shape[0] | 0;\n h = shape[1] | 0;\n } else {\n if (\"radius\" in options) {\n w = h = options.radius | 0;\n }\n if (\"width\" in options) {\n w = options.width | 0;\n }\n if (\"height\" in options) {\n h = options.height | 0;\n }\n }\n if (\"format\" in options) {\n format = formatTypes[options.format];\n }\n } else if (typeof a2 === \"number\") {\n w = a2 | 0;\n if (typeof b2 === \"number\") {\n h = b2 | 0;\n } else {\n h = w;\n }\n } else if (!a2) {\n w = h = 1;\n } else {\n }\n if (w === renderbuffer.width && h === renderbuffer.height && format === renderbuffer.format) {\n return;\n }\n reglRenderbuffer.width = renderbuffer.width = w;\n reglRenderbuffer.height = renderbuffer.height = h;\n renderbuffer.format = format;\n gl2.bindRenderbuffer(GL_RENDERBUFFER, renderbuffer.renderbuffer);\n gl2.renderbufferStorage(GL_RENDERBUFFER, format, w, h);\n if (config.profile) {\n renderbuffer.stats.size = getRenderbufferSize(renderbuffer.format, renderbuffer.width, renderbuffer.height);\n }\n reglRenderbuffer.format = formatTypesInvert[renderbuffer.format];\n return reglRenderbuffer;\n }\n function resize(w_, h_) {\n var w = w_ | 0;\n var h = h_ | 0 || w;\n if (w === renderbuffer.width && h === renderbuffer.height) {\n return reglRenderbuffer;\n }\n reglRenderbuffer.width = renderbuffer.width = w;\n reglRenderbuffer.height = renderbuffer.height = h;\n gl2.bindRenderbuffer(GL_RENDERBUFFER, renderbuffer.renderbuffer);\n gl2.renderbufferStorage(GL_RENDERBUFFER, renderbuffer.format, w, h);\n if (config.profile) {\n renderbuffer.stats.size = getRenderbufferSize(\n renderbuffer.format,\n renderbuffer.width,\n renderbuffer.height\n );\n }\n return reglRenderbuffer;\n }\n reglRenderbuffer(a, b);\n reglRenderbuffer.resize = resize;\n reglRenderbuffer._reglType = \"renderbuffer\";\n reglRenderbuffer._renderbuffer = renderbuffer;\n if (config.profile) {\n reglRenderbuffer.stats = renderbuffer.stats;\n }\n reglRenderbuffer.destroy = function() {\n renderbuffer.decRef();\n };\n return reglRenderbuffer;\n }\n if (config.profile) {\n stats2.getTotalRenderbufferSize = function() {\n var total = 0;\n Object.keys(renderbufferSet).forEach(function(key) {\n total += renderbufferSet[key].stats.size;\n });\n return total;\n };\n }\n function restoreRenderbuffers() {\n values(renderbufferSet).forEach(function(rb) {\n rb.renderbuffer = gl2.createRenderbuffer();\n gl2.bindRenderbuffer(GL_RENDERBUFFER, rb.renderbuffer);\n gl2.renderbufferStorage(GL_RENDERBUFFER, rb.format, rb.width, rb.height);\n });\n gl2.bindRenderbuffer(GL_RENDERBUFFER, null);\n }\n return {\n create: createRenderbuffer,\n clear: function() {\n values(renderbufferSet).forEach(destroy);\n },\n restore: restoreRenderbuffers\n };\n };\n var GL_FRAMEBUFFER$1 = 36160;\n var GL_RENDERBUFFER$1 = 36161;\n var GL_TEXTURE_2D$2 = 3553;\n var GL_TEXTURE_CUBE_MAP_POSITIVE_X$2 = 34069;\n var GL_COLOR_ATTACHMENT0$1 = 36064;\n var GL_DEPTH_ATTACHMENT = 36096;\n var GL_STENCIL_ATTACHMENT = 36128;\n var GL_DEPTH_STENCIL_ATTACHMENT = 33306;\n var GL_FRAMEBUFFER_COMPLETE$1 = 36053;\n var GL_HALF_FLOAT_OES$1 = 36193;\n var GL_UNSIGNED_BYTE$5 = 5121;\n var GL_FLOAT$4 = 5126;\n var GL_RGB$1 = 6407;\n var GL_RGBA$2 = 6408;\n var textureFormatChannels = [];\n textureFormatChannels[GL_RGBA$2] = 4;\n textureFormatChannels[GL_RGB$1] = 3;\n var textureTypeSizes = [];\n textureTypeSizes[GL_UNSIGNED_BYTE$5] = 1;\n textureTypeSizes[GL_FLOAT$4] = 4;\n textureTypeSizes[GL_HALF_FLOAT_OES$1] = 2;\n function wrapFBOState(gl2, extensions, limits, textureState, renderbufferState, stats2) {\n var framebufferState = {\n cur: null,\n next: null,\n dirty: false,\n setFBO: null\n };\n var colorTextureFormats = [\"rgba\"];\n var colorRenderbufferFormats = [\"rgba4\", \"rgb565\", \"rgb5 a1\"];\n if (extensions.ext_srgb) {\n colorRenderbufferFormats.push(\"srgba\");\n }\n if (extensions.ext_color_buffer_half_float) {\n colorRenderbufferFormats.push(\"rgba16f\", \"rgb16f\");\n }\n if (extensions.webgl_color_buffer_float) {\n colorRenderbufferFormats.push(\"rgba32f\");\n }\n var colorTypes = [\"uint8\"];\n if (extensions.oes_texture_half_float) {\n colorTypes.push(\"half float\", \"float16\");\n }\n if (extensions.oes_texture_float) {\n colorTypes.push(\"float\", \"float32\");\n }\n function FramebufferAttachment(target, texture, renderbuffer) {\n this.target = target;\n this.texture = texture;\n this.renderbuffer = renderbuffer;\n var w = 0;\n var h = 0;\n if (texture) {\n w = texture.width;\n h = texture.height;\n } else if (renderbuffer) {\n w = renderbuffer.width;\n h = renderbuffer.height;\n }\n this.width = w;\n this.height = h;\n }\n function decRef(attachment) {\n if (attachment) {\n if (attachment.texture) {\n attachment.texture._texture.decRef();\n }\n if (attachment.renderbuffer) {\n attachment.renderbuffer._renderbuffer.decRef();\n }\n }\n }\n function incRefAndCheckShape(attachment, width, height) {\n if (!attachment) {\n return;\n }\n if (attachment.texture) {\n var texture = attachment.texture._texture;\n var tw = Math.max(1, texture.width);\n var th = Math.max(1, texture.height);\n texture.refCount += 1;\n } else {\n var renderbuffer = attachment.renderbuffer._renderbuffer;\n renderbuffer.refCount += 1;\n }\n }\n function attach(location2, attachment) {\n if (attachment) {\n if (attachment.texture) {\n gl2.framebufferTexture2D(\n GL_FRAMEBUFFER$1,\n location2,\n attachment.target,\n attachment.texture._texture.texture,\n 0\n );\n } else {\n gl2.framebufferRenderbuffer(\n GL_FRAMEBUFFER$1,\n location2,\n GL_RENDERBUFFER$1,\n attachment.renderbuffer._renderbuffer.renderbuffer\n );\n }\n }\n }\n function parseAttachment(attachment) {\n var target = GL_TEXTURE_2D$2;\n var texture = null;\n var renderbuffer = null;\n var data = attachment;\n if (typeof attachment === \"object\") {\n data = attachment.data;\n if (\"target\" in attachment) {\n target = attachment.target | 0;\n }\n }\n var type = data._reglType;\n if (type === \"texture2d\") {\n texture = data;\n } else if (type === \"textureCube\") {\n texture = data;\n } else if (type === \"renderbuffer\") {\n renderbuffer = data;\n target = GL_RENDERBUFFER$1;\n } else {\n }\n return new FramebufferAttachment(target, texture, renderbuffer);\n }\n function allocAttachment(width, height, isTexture, format, type) {\n if (isTexture) {\n var texture = textureState.create2D({\n width,\n height,\n format,\n type\n });\n texture._texture.refCount = 0;\n return new FramebufferAttachment(GL_TEXTURE_2D$2, texture, null);\n } else {\n var rb = renderbufferState.create({\n width,\n height,\n format\n });\n rb._renderbuffer.refCount = 0;\n return new FramebufferAttachment(GL_RENDERBUFFER$1, null, rb);\n }\n }\n function unwrapAttachment(attachment) {\n return attachment && (attachment.texture || attachment.renderbuffer);\n }\n function resizeAttachment(attachment, w, h) {\n if (attachment) {\n if (attachment.texture) {\n attachment.texture.resize(w, h);\n } else if (attachment.renderbuffer) {\n attachment.renderbuffer.resize(w, h);\n }\n attachment.width = w;\n attachment.height = h;\n }\n }\n var framebufferCount = 0;\n var framebufferSet = {};\n function REGLFramebuffer() {\n this.id = framebufferCount++;\n framebufferSet[this.id] = this;\n this.framebuffer = gl2.createFramebuffer();\n this.width = 0;\n this.height = 0;\n this.colorAttachments = [];\n this.depthAttachment = null;\n this.stencilAttachment = null;\n this.depthStencilAttachment = null;\n }\n function decFBORefs(framebuffer) {\n framebuffer.colorAttachments.forEach(decRef);\n decRef(framebuffer.depthAttachment);\n decRef(framebuffer.stencilAttachment);\n decRef(framebuffer.depthStencilAttachment);\n }\n function destroy(framebuffer) {\n var handle = framebuffer.framebuffer;\n gl2.deleteFramebuffer(handle);\n framebuffer.framebuffer = null;\n stats2.framebufferCount--;\n delete framebufferSet[framebuffer.id];\n }\n function updateFramebuffer(framebuffer) {\n var i;\n gl2.bindFramebuffer(GL_FRAMEBUFFER$1, framebuffer.framebuffer);\n var colorAttachments = framebuffer.colorAttachments;\n for (i = 0; i < colorAttachments.length; ++i) {\n attach(GL_COLOR_ATTACHMENT0$1 + i, colorAttachments[i]);\n }\n for (i = colorAttachments.length; i < limits.maxColorAttachments; ++i) {\n gl2.framebufferTexture2D(\n GL_FRAMEBUFFER$1,\n GL_COLOR_ATTACHMENT0$1 + i,\n GL_TEXTURE_2D$2,\n null,\n 0\n );\n }\n gl2.framebufferTexture2D(\n GL_FRAMEBUFFER$1,\n GL_DEPTH_STENCIL_ATTACHMENT,\n GL_TEXTURE_2D$2,\n null,\n 0\n );\n gl2.framebufferTexture2D(\n GL_FRAMEBUFFER$1,\n GL_DEPTH_ATTACHMENT,\n GL_TEXTURE_2D$2,\n null,\n 0\n );\n gl2.framebufferTexture2D(\n GL_FRAMEBUFFER$1,\n GL_STENCIL_ATTACHMENT,\n GL_TEXTURE_2D$2,\n null,\n 0\n );\n attach(GL_DEPTH_ATTACHMENT, framebuffer.depthAttachment);\n attach(GL_STENCIL_ATTACHMENT, framebuffer.stencilAttachment);\n attach(GL_DEPTH_STENCIL_ATTACHMENT, framebuffer.depthStencilAttachment);\n var status = gl2.checkFramebufferStatus(GL_FRAMEBUFFER$1);\n if (!gl2.isContextLost() && status !== GL_FRAMEBUFFER_COMPLETE$1) {\n }\n gl2.bindFramebuffer(GL_FRAMEBUFFER$1, framebufferState.next ? framebufferState.next.framebuffer : null);\n framebufferState.cur = framebufferState.next;\n gl2.getError();\n }\n function createFBO(a0, a1) {\n var framebuffer = new REGLFramebuffer();\n stats2.framebufferCount++;\n function reglFramebuffer(a, b) {\n var i;\n var width = 0;\n var height = 0;\n var needsDepth = true;\n var needsStencil = true;\n var colorBuffer = null;\n var colorTexture = true;\n var colorFormat = \"rgba\";\n var colorType = \"uint8\";\n var colorCount = 1;\n var depthBuffer = null;\n var stencilBuffer = null;\n var depthStencilBuffer = null;\n var depthStencilTexture = false;\n if (typeof a === \"number\") {\n width = a | 0;\n height = b | 0 || width;\n } else if (!a) {\n width = height = 1;\n } else {\n var options = a;\n if (\"shape\" in options) {\n var shape = options.shape;\n width = shape[0];\n height = shape[1];\n } else {\n if (\"radius\" in options) {\n width = height = options.radius;\n }\n if (\"width\" in options) {\n width = options.width;\n }\n if (\"height\" in options) {\n height = options.height;\n }\n }\n if (\"color\" in options || \"colors\" in options) {\n colorBuffer = options.color || options.colors;\n if (Array.isArray(colorBuffer)) {\n }\n }\n if (!colorBuffer) {\n if (\"colorCount\" in options) {\n colorCount = options.colorCount | 0;\n }\n if (\"colorTexture\" in options) {\n colorTexture = !!options.colorTexture;\n colorFormat = \"rgba4\";\n }\n if (\"colorType\" in options) {\n colorType = options.colorType;\n if (!colorTexture) {\n if (colorType === \"half float\" || colorType === \"float16\") {\n colorFormat = \"rgba16f\";\n } else if (colorType === \"float\" || colorType === \"float32\") {\n colorFormat = \"rgba32f\";\n }\n } else {\n }\n }\n if (\"colorFormat\" in options) {\n colorFormat = options.colorFormat;\n if (colorTextureFormats.indexOf(colorFormat) >= 0) {\n colorTexture = true;\n } else if (colorRenderbufferFormats.indexOf(colorFormat) >= 0) {\n colorTexture = false;\n } else {\n }\n }\n }\n if (\"depthTexture\" in options || \"depthStencilTexture\" in options) {\n depthStencilTexture = !!(options.depthTexture || options.depthStencilTexture);\n }\n if (\"depth\" in options) {\n if (typeof options.depth === \"boolean\") {\n needsDepth = options.depth;\n } else {\n depthBuffer = options.depth;\n needsStencil = false;\n }\n }\n if (\"stencil\" in options) {\n if (typeof options.stencil === \"boolean\") {\n needsStencil = options.stencil;\n } else {\n stencilBuffer = options.stencil;\n needsDepth = false;\n }\n }\n if (\"depthStencil\" in options) {\n if (typeof options.depthStencil === \"boolean\") {\n needsDepth = needsStencil = options.depthStencil;\n } else {\n depthStencilBuffer = options.depthStencil;\n needsDepth = false;\n needsStencil = false;\n }\n }\n }\n var colorAttachments = null;\n var depthAttachment = null;\n var stencilAttachment = null;\n var depthStencilAttachment = null;\n if (Array.isArray(colorBuffer)) {\n colorAttachments = colorBuffer.map(parseAttachment);\n } else if (colorBuffer) {\n colorAttachments = [parseAttachment(colorBuffer)];\n } else {\n colorAttachments = new Array(colorCount);\n for (i = 0; i < colorCount; ++i) {\n colorAttachments[i] = allocAttachment(\n width,\n height,\n colorTexture,\n colorFormat,\n colorType\n );\n }\n }\n width = width || colorAttachments[0].width;\n height = height || colorAttachments[0].height;\n if (depthBuffer) {\n depthAttachment = parseAttachment(depthBuffer);\n } else if (needsDepth && !needsStencil) {\n depthAttachment = allocAttachment(\n width,\n height,\n depthStencilTexture,\n \"depth\",\n \"uint32\"\n );\n }\n if (stencilBuffer) {\n stencilAttachment = parseAttachment(stencilBuffer);\n } else if (needsStencil && !needsDepth) {\n stencilAttachment = allocAttachment(\n width,\n height,\n false,\n \"stencil\",\n \"uint8\"\n );\n }\n if (depthStencilBuffer) {\n depthStencilAttachment = parseAttachment(depthStencilBuffer);\n } else if (!depthBuffer && !stencilBuffer && needsStencil && needsDepth) {\n depthStencilAttachment = allocAttachment(\n width,\n height,\n depthStencilTexture,\n \"depth stencil\",\n \"depth stencil\"\n );\n }\n var commonColorAttachmentSize = null;\n for (i = 0; i < colorAttachments.length; ++i) {\n incRefAndCheckShape(colorAttachments[i], width, height);\n if (colorAttachments[i] && colorAttachments[i].texture) {\n var colorAttachmentSize = textureFormatChannels[colorAttachments[i].texture._texture.format] * textureTypeSizes[colorAttachments[i].texture._texture.type];\n if (commonColorAttachmentSize === null) {\n commonColorAttachmentSize = colorAttachmentSize;\n } else {\n }\n }\n }\n incRefAndCheckShape(depthAttachment, width, height);\n incRefAndCheckShape(stencilAttachment, width, height);\n incRefAndCheckShape(depthStencilAttachment, width, height);\n decFBORefs(framebuffer);\n framebuffer.width = width;\n framebuffer.height = height;\n framebuffer.colorAttachments = colorAttachments;\n framebuffer.depthAttachment = depthAttachment;\n framebuffer.stencilAttachment = stencilAttachment;\n framebuffer.depthStencilAttachment = depthStencilAttachment;\n reglFramebuffer.color = colorAttachments.map(unwrapAttachment);\n reglFramebuffer.depth = unwrapAttachment(depthAttachment);\n reglFramebuffer.stencil = unwrapAttachment(stencilAttachment);\n reglFramebuffer.depthStencil = unwrapAttachment(depthStencilAttachment);\n reglFramebuffer.width = framebuffer.width;\n reglFramebuffer.height = framebuffer.height;\n updateFramebuffer(framebuffer);\n return reglFramebuffer;\n }\n function resize(w_, h_) {\n var w = Math.max(w_ | 0, 1);\n var h = Math.max(h_ | 0 || w, 1);\n if (w === framebuffer.width && h === framebuffer.height) {\n return reglFramebuffer;\n }\n var colorAttachments = framebuffer.colorAttachments;\n for (var i = 0; i < colorAttachments.length; ++i) {\n resizeAttachment(colorAttachments[i], w, h);\n }\n resizeAttachment(framebuffer.depthAttachment, w, h);\n resizeAttachment(framebuffer.stencilAttachment, w, h);\n resizeAttachment(framebuffer.depthStencilAttachment, w, h);\n framebuffer.width = reglFramebuffer.width = w;\n framebuffer.height = reglFramebuffer.height = h;\n updateFramebuffer(framebuffer);\n return reglFramebuffer;\n }\n reglFramebuffer(a0, a1);\n return extend2(reglFramebuffer, {\n resize,\n _reglType: \"framebuffer\",\n _framebuffer: framebuffer,\n destroy: function() {\n destroy(framebuffer);\n decFBORefs(framebuffer);\n },\n use: function(block) {\n framebufferState.setFBO({\n framebuffer: reglFramebuffer\n }, block);\n }\n });\n }\n function createCubeFBO(options) {\n var faces = Array(6);\n function reglFramebufferCube(a) {\n var i;\n var params = {\n color: null\n };\n var radius = 0;\n var colorBuffer = null;\n var colorFormat = \"rgba\";\n var colorType = \"uint8\";\n var colorCount = 1;\n if (typeof a === \"number\") {\n radius = a | 0;\n } else if (!a) {\n radius = 1;\n } else {\n var options2 = a;\n if (\"shape\" in options2) {\n var shape = options2.shape;\n radius = shape[0];\n } else {\n if (\"radius\" in options2) {\n radius = options2.radius | 0;\n }\n if (\"width\" in options2) {\n radius = options2.width | 0;\n if (\"height\" in options2) {\n }\n } else if (\"height\" in options2) {\n radius = options2.height | 0;\n }\n }\n if (\"color\" in options2 || \"colors\" in options2) {\n colorBuffer = options2.color || options2.colors;\n if (Array.isArray(colorBuffer)) {\n }\n }\n if (!colorBuffer) {\n if (\"colorCount\" in options2) {\n colorCount = options2.colorCount | 0;\n }\n if (\"colorType\" in options2) {\n colorType = options2.colorType;\n }\n if (\"colorFormat\" in options2) {\n colorFormat = options2.colorFormat;\n }\n }\n if (\"depth\" in options2) {\n params.depth = options2.depth;\n }\n if (\"stencil\" in options2) {\n params.stencil = options2.stencil;\n }\n if (\"depthStencil\" in options2) {\n params.depthStencil = options2.depthStencil;\n }\n }\n var colorCubes;\n if (colorBuffer) {\n if (Array.isArray(colorBuffer)) {\n colorCubes = [];\n for (i = 0; i < colorBuffer.length; ++i) {\n colorCubes[i] = colorBuffer[i];\n }\n } else {\n colorCubes = [colorBuffer];\n }\n } else {\n colorCubes = Array(colorCount);\n var cubeMapParams = {\n radius,\n format: colorFormat,\n type: colorType\n };\n for (i = 0; i < colorCount; ++i) {\n colorCubes[i] = textureState.createCube(cubeMapParams);\n }\n }\n params.color = Array(colorCubes.length);\n for (i = 0; i < colorCubes.length; ++i) {\n var cube = colorCubes[i];\n radius = radius || cube.width;\n params.color[i] = {\n target: GL_TEXTURE_CUBE_MAP_POSITIVE_X$2,\n data: colorCubes[i]\n };\n }\n for (i = 0; i < 6; ++i) {\n for (var j = 0; j < colorCubes.length; ++j) {\n params.color[j].target = GL_TEXTURE_CUBE_MAP_POSITIVE_X$2 + i;\n }\n if (i > 0) {\n params.depth = faces[0].depth;\n params.stencil = faces[0].stencil;\n params.depthStencil = faces[0].depthStencil;\n }\n if (faces[i]) {\n faces[i](params);\n } else {\n faces[i] = createFBO(params);\n }\n }\n return extend2(reglFramebufferCube, {\n width: radius,\n height: radius,\n color: colorCubes\n });\n }\n function resize(radius_) {\n var i;\n var radius = radius_ | 0;\n if (radius === reglFramebufferCube.width) {\n return reglFramebufferCube;\n }\n var colors = reglFramebufferCube.color;\n for (i = 0; i < colors.length; ++i) {\n colors[i].resize(radius);\n }\n for (i = 0; i < 6; ++i) {\n faces[i].resize(radius);\n }\n reglFramebufferCube.width = reglFramebufferCube.height = radius;\n return reglFramebufferCube;\n }\n reglFramebufferCube(options);\n return extend2(reglFramebufferCube, {\n faces,\n resize,\n _reglType: \"framebufferCube\",\n destroy: function() {\n faces.forEach(function(f) {\n f.destroy();\n });\n }\n });\n }\n function restoreFramebuffers() {\n framebufferState.cur = null;\n framebufferState.next = null;\n framebufferState.dirty = true;\n values(framebufferSet).forEach(function(fb) {\n fb.framebuffer = gl2.createFramebuffer();\n updateFramebuffer(fb);\n });\n }\n return extend2(framebufferState, {\n getFramebuffer: function(object) {\n if (typeof object === \"function\" && object._reglType === \"framebuffer\") {\n var fbo = object._framebuffer;\n if (fbo instanceof REGLFramebuffer) {\n return fbo;\n }\n }\n return null;\n },\n create: createFBO,\n createCube: createCubeFBO,\n clear: function() {\n values(framebufferSet).forEach(destroy);\n },\n restore: restoreFramebuffers\n });\n }\n var GL_FLOAT$5 = 5126;\n var GL_ARRAY_BUFFER$1 = 34962;\n var GL_ELEMENT_ARRAY_BUFFER$1 = 34963;\n function AttributeRecord() {\n this.state = 0;\n this.x = 0;\n this.y = 0;\n this.z = 0;\n this.w = 0;\n this.buffer = null;\n this.size = 0;\n this.normalized = false;\n this.type = GL_FLOAT$5;\n this.offset = 0;\n this.stride = 0;\n this.divisor = 0;\n }\n function wrapAttributeState(gl2, extensions, limits, stats2, bufferState, elementState, drawState) {\n var NUM_ATTRIBUTES = limits.maxAttributes;\n var attributeBindings = new Array(NUM_ATTRIBUTES);\n for (var i = 0; i < NUM_ATTRIBUTES; ++i) {\n attributeBindings[i] = new AttributeRecord();\n }\n var vaoCount = 0;\n var vaoSet = {};\n var state = {\n Record: AttributeRecord,\n scope: {},\n state: attributeBindings,\n currentVAO: null,\n targetVAO: null,\n restore: extVAO() ? restoreVAO : function() {\n },\n createVAO,\n getVAO,\n destroyBuffer,\n setVAO: extVAO() ? setVAOEXT : setVAOEmulated,\n clear: extVAO() ? destroyVAOEXT : function() {\n }\n };\n function destroyBuffer(buffer) {\n for (var i2 = 0; i2 < attributeBindings.length; ++i2) {\n var record = attributeBindings[i2];\n if (record.buffer === buffer) {\n gl2.disableVertexAttribArray(i2);\n record.buffer = null;\n }\n }\n }\n function extVAO() {\n return extensions.oes_vertex_array_object;\n }\n function extInstanced() {\n return extensions.angle_instanced_arrays;\n }\n function getVAO(vao) {\n if (typeof vao === \"function\" && vao._vao) {\n return vao._vao;\n }\n return null;\n }\n function setVAOEXT(vao) {\n if (vao === state.currentVAO) {\n return;\n }\n var ext = extVAO();\n if (vao) {\n ext.bindVertexArrayOES(vao.vao);\n } else {\n ext.bindVertexArrayOES(null);\n }\n state.currentVAO = vao;\n }\n function setVAOEmulated(vao) {\n if (vao === state.currentVAO) {\n return;\n }\n if (vao) {\n vao.bindAttrs();\n } else {\n var exti = extInstanced();\n for (var i2 = 0; i2 < attributeBindings.length; ++i2) {\n var binding = attributeBindings[i2];\n if (binding.buffer) {\n gl2.enableVertexAttribArray(i2);\n binding.buffer.bind();\n gl2.vertexAttribPointer(i2, binding.size, binding.type, binding.normalized, binding.stride, binding.offfset);\n if (exti && binding.divisor) {\n exti.vertexAttribDivisorANGLE(i2, binding.divisor);\n }\n } else {\n gl2.disableVertexAttribArray(i2);\n gl2.vertexAttrib4f(i2, binding.x, binding.y, binding.z, binding.w);\n }\n }\n if (drawState.elements) {\n gl2.bindBuffer(GL_ELEMENT_ARRAY_BUFFER$1, drawState.elements.buffer.buffer);\n } else {\n gl2.bindBuffer(GL_ELEMENT_ARRAY_BUFFER$1, null);\n }\n }\n state.currentVAO = vao;\n }\n function destroyVAOEXT() {\n values(vaoSet).forEach(function(vao) {\n vao.destroy();\n });\n }\n function REGLVAO() {\n this.id = ++vaoCount;\n this.attributes = [];\n this.elements = null;\n this.ownsElements = false;\n this.count = 0;\n this.offset = 0;\n this.instances = -1;\n this.primitive = 4;\n var extension = extVAO();\n if (extension) {\n this.vao = extension.createVertexArrayOES();\n } else {\n this.vao = null;\n }\n vaoSet[this.id] = this;\n this.buffers = [];\n }\n REGLVAO.prototype.bindAttrs = function() {\n var exti = extInstanced();\n var attributes = this.attributes;\n for (var i2 = 0; i2 < attributes.length; ++i2) {\n var attr = attributes[i2];\n if (attr.buffer) {\n gl2.enableVertexAttribArray(i2);\n gl2.bindBuffer(GL_ARRAY_BUFFER$1, attr.buffer.buffer);\n gl2.vertexAttribPointer(i2, attr.size, attr.type, attr.normalized, attr.stride, attr.offset);\n if (exti && attr.divisor) {\n exti.vertexAttribDivisorANGLE(i2, attr.divisor);\n }\n } else {\n gl2.disableVertexAttribArray(i2);\n gl2.vertexAttrib4f(i2, attr.x, attr.y, attr.z, attr.w);\n }\n }\n for (var j = attributes.length; j < NUM_ATTRIBUTES; ++j) {\n gl2.disableVertexAttribArray(j);\n }\n var elements = elementState.getElements(this.elements);\n if (elements) {\n gl2.bindBuffer(GL_ELEMENT_ARRAY_BUFFER$1, elements.buffer.buffer);\n } else {\n gl2.bindBuffer(GL_ELEMENT_ARRAY_BUFFER$1, null);\n }\n };\n REGLVAO.prototype.refresh = function() {\n var ext = extVAO();\n if (ext) {\n ext.bindVertexArrayOES(this.vao);\n this.bindAttrs();\n state.currentVAO = null;\n ext.bindVertexArrayOES(null);\n }\n };\n REGLVAO.prototype.destroy = function() {\n if (this.vao) {\n var extension = extVAO();\n if (this === state.currentVAO) {\n state.currentVAO = null;\n extension.bindVertexArrayOES(null);\n }\n extension.deleteVertexArrayOES(this.vao);\n this.vao = null;\n }\n if (this.ownsElements) {\n this.elements.destroy();\n this.elements = null;\n this.ownsElements = false;\n }\n if (vaoSet[this.id]) {\n delete vaoSet[this.id];\n stats2.vaoCount -= 1;\n }\n };\n function restoreVAO() {\n var ext = extVAO();\n if (ext) {\n values(vaoSet).forEach(function(vao) {\n vao.refresh();\n });\n }\n }\n function createVAO(_attr) {\n var vao = new REGLVAO();\n stats2.vaoCount += 1;\n function updateVAO(options) {\n var attributes;\n if (Array.isArray(options)) {\n attributes = options;\n if (vao.elements && vao.ownsElements) {\n vao.elements.destroy();\n }\n vao.elements = null;\n vao.ownsElements = false;\n vao.offset = 0;\n vao.count = 0;\n vao.instances = -1;\n vao.primitive = 4;\n } else {\n if (options.elements) {\n var elements = options.elements;\n if (vao.ownsElements) {\n if (typeof elements === \"function\" && elements._reglType === \"elements\") {\n vao.elements.destroy();\n vao.ownsElements = false;\n } else {\n vao.elements(elements);\n vao.ownsElements = false;\n }\n } else if (elementState.getElements(options.elements)) {\n vao.elements = options.elements;\n vao.ownsElements = false;\n } else {\n vao.elements = elementState.create(options.elements);\n vao.ownsElements = true;\n }\n } else {\n vao.elements = null;\n vao.ownsElements = false;\n }\n attributes = options.attributes;\n vao.offset = 0;\n vao.count = -1;\n vao.instances = -1;\n vao.primitive = 4;\n if (vao.elements) {\n vao.count = vao.elements._elements.vertCount;\n vao.primitive = vao.elements._elements.primType;\n }\n if (\"offset\" in options) {\n vao.offset = options.offset | 0;\n }\n if (\"count\" in options) {\n vao.count = options.count | 0;\n }\n if (\"instances\" in options) {\n vao.instances = options.instances | 0;\n }\n if (\"primitive\" in options) {\n vao.primitive = primTypes[options.primitive];\n }\n }\n var bufUpdated = {};\n var nattributes = vao.attributes;\n nattributes.length = attributes.length;\n for (var i2 = 0; i2 < attributes.length; ++i2) {\n var spec = attributes[i2];\n var rec = nattributes[i2] = new AttributeRecord();\n var data = spec.data || spec;\n if (Array.isArray(data) || isTypedArray(data) || isNDArrayLike(data)) {\n var buf;\n if (vao.buffers[i2]) {\n buf = vao.buffers[i2];\n if (isTypedArray(data) && buf._buffer.byteLength >= data.byteLength) {\n buf.subdata(data);\n } else {\n buf.destroy();\n vao.buffers[i2] = null;\n }\n }\n if (!vao.buffers[i2]) {\n buf = vao.buffers[i2] = bufferState.create(spec, GL_ARRAY_BUFFER$1, false, true);\n }\n rec.buffer = bufferState.getBuffer(buf);\n rec.size = rec.buffer.dimension | 0;\n rec.normalized = false;\n rec.type = rec.buffer.dtype;\n rec.offset = 0;\n rec.stride = 0;\n rec.divisor = 0;\n rec.state = 1;\n bufUpdated[i2] = 1;\n } else if (bufferState.getBuffer(spec)) {\n rec.buffer = bufferState.getBuffer(spec);\n rec.size = rec.buffer.dimension | 0;\n rec.normalized = false;\n rec.type = rec.buffer.dtype;\n rec.offset = 0;\n rec.stride = 0;\n rec.divisor = 0;\n rec.state = 1;\n } else if (bufferState.getBuffer(spec.buffer)) {\n rec.buffer = bufferState.getBuffer(spec.buffer);\n rec.size = (+spec.size || rec.buffer.dimension) | 0;\n rec.normalized = !!spec.normalized || false;\n if (\"type\" in spec) {\n rec.type = glTypes[spec.type];\n } else {\n rec.type = rec.buffer.dtype;\n }\n rec.offset = (spec.offset || 0) | 0;\n rec.stride = (spec.stride || 0) | 0;\n rec.divisor = (spec.divisor || 0) | 0;\n rec.state = 1;\n } else if (\"x\" in spec) {\n rec.x = +spec.x || 0;\n rec.y = +spec.y || 0;\n rec.z = +spec.z || 0;\n rec.w = +spec.w || 0;\n rec.state = 2;\n } else {\n }\n }\n for (var j = 0; j < vao.buffers.length; ++j) {\n if (!bufUpdated[j] && vao.buffers[j]) {\n vao.buffers[j].destroy();\n vao.buffers[j] = null;\n }\n }\n vao.refresh();\n return updateVAO;\n }\n updateVAO.destroy = function() {\n for (var j = 0; j < vao.buffers.length; ++j) {\n if (vao.buffers[j]) {\n vao.buffers[j].destroy();\n }\n }\n vao.buffers.length = 0;\n if (vao.ownsElements) {\n vao.elements.destroy();\n vao.elements = null;\n vao.ownsElements = false;\n }\n vao.destroy();\n };\n updateVAO._vao = vao;\n updateVAO._reglType = \"vao\";\n return updateVAO(_attr);\n }\n return state;\n }\n var GL_FRAGMENT_SHADER = 35632;\n var GL_VERTEX_SHADER = 35633;\n var GL_ACTIVE_UNIFORMS = 35718;\n var GL_ACTIVE_ATTRIBUTES = 35721;\n function wrapShaderState(gl2, stringStore, stats2, config) {\n var fragShaders = {};\n var vertShaders = {};\n function ActiveInfo(name2, id, location2, info) {\n this.name = name2;\n this.id = id;\n this.location = location2;\n this.info = info;\n }\n function insertActiveInfo(list, info) {\n for (var i = 0; i < list.length; ++i) {\n if (list[i].id === info.id) {\n list[i].location = info.location;\n return;\n }\n }\n list.push(info);\n }\n function getShader(type, id, command) {\n var cache = type === GL_FRAGMENT_SHADER ? fragShaders : vertShaders;\n var shader = cache[id];\n if (!shader) {\n var source = stringStore.str(id);\n shader = gl2.createShader(type);\n gl2.shaderSource(shader, source);\n gl2.compileShader(shader);\n cache[id] = shader;\n }\n return shader;\n }\n var programCache = {};\n var programList = [];\n var PROGRAM_COUNTER = 0;\n function REGLProgram(fragId, vertId) {\n this.id = PROGRAM_COUNTER++;\n this.fragId = fragId;\n this.vertId = vertId;\n this.program = null;\n this.uniforms = [];\n this.attributes = [];\n this.refCount = 1;\n if (config.profile) {\n this.stats = {\n uniformsCount: 0,\n attributesCount: 0\n };\n }\n }\n function linkProgram(desc, command, attributeLocations) {\n var i, info;\n var fragShader = getShader(GL_FRAGMENT_SHADER, desc.fragId);\n var vertShader = getShader(GL_VERTEX_SHADER, desc.vertId);\n var program = desc.program = gl2.createProgram();\n gl2.attachShader(program, fragShader);\n gl2.attachShader(program, vertShader);\n if (attributeLocations) {\n for (i = 0; i < attributeLocations.length; ++i) {\n var binding = attributeLocations[i];\n gl2.bindAttribLocation(program, binding[0], binding[1]);\n }\n }\n gl2.linkProgram(program);\n var numUniforms = gl2.getProgramParameter(program, GL_ACTIVE_UNIFORMS);\n if (config.profile) {\n desc.stats.uniformsCount = numUniforms;\n }\n var uniforms = desc.uniforms;\n for (i = 0; i < numUniforms; ++i) {\n info = gl2.getActiveUniform(program, i);\n if (info) {\n if (info.size > 1) {\n for (var j = 0; j < info.size; ++j) {\n var name2 = info.name.replace(\"[0]\", \"[\" + j + \"]\");\n insertActiveInfo(uniforms, new ActiveInfo(\n name2,\n stringStore.id(name2),\n gl2.getUniformLocation(program, name2),\n info\n ));\n }\n } else {\n insertActiveInfo(uniforms, new ActiveInfo(\n info.name,\n stringStore.id(info.name),\n gl2.getUniformLocation(program, info.name),\n info\n ));\n }\n }\n }\n var numAttributes = gl2.getProgramParameter(program, GL_ACTIVE_ATTRIBUTES);\n if (config.profile) {\n desc.stats.attributesCount = numAttributes;\n }\n var attributes = desc.attributes;\n for (i = 0; i < numAttributes; ++i) {\n info = gl2.getActiveAttrib(program, i);\n if (info) {\n insertActiveInfo(attributes, new ActiveInfo(\n info.name,\n stringStore.id(info.name),\n gl2.getAttribLocation(program, info.name),\n info\n ));\n }\n }\n }\n if (config.profile) {\n stats2.getMaxUniformsCount = function() {\n var m = 0;\n programList.forEach(function(desc) {\n if (desc.stats.uniformsCount > m) {\n m = desc.stats.uniformsCount;\n }\n });\n return m;\n };\n stats2.getMaxAttributesCount = function() {\n var m = 0;\n programList.forEach(function(desc) {\n if (desc.stats.attributesCount > m) {\n m = desc.stats.attributesCount;\n }\n });\n return m;\n };\n }\n function restoreShaders() {\n fragShaders = {};\n vertShaders = {};\n for (var i = 0; i < programList.length; ++i) {\n linkProgram(programList[i], null, programList[i].attributes.map(function(info) {\n return [info.location, info.name];\n }));\n }\n }\n return {\n clear: function() {\n var deleteShader = gl2.deleteShader.bind(gl2);\n values(fragShaders).forEach(deleteShader);\n fragShaders = {};\n values(vertShaders).forEach(deleteShader);\n vertShaders = {};\n programList.forEach(function(desc) {\n gl2.deleteProgram(desc.program);\n });\n programList.length = 0;\n programCache = {};\n stats2.shaderCount = 0;\n },\n program: function(vertId, fragId, command, attribLocations) {\n var cache = programCache[fragId];\n if (!cache) {\n cache = programCache[fragId] = {};\n }\n var prevProgram = cache[vertId];\n if (prevProgram) {\n prevProgram.refCount++;\n if (!attribLocations) {\n return prevProgram;\n }\n }\n var program = new REGLProgram(fragId, vertId);\n stats2.shaderCount++;\n linkProgram(program, command, attribLocations);\n if (!prevProgram) {\n cache[vertId] = program;\n }\n programList.push(program);\n return extend2(program, {\n destroy: function() {\n program.refCount--;\n if (program.refCount <= 0) {\n gl2.deleteProgram(program.program);\n var idx = programList.indexOf(program);\n programList.splice(idx, 1);\n stats2.shaderCount--;\n }\n if (cache[program.vertId].refCount <= 0) {\n gl2.deleteShader(vertShaders[program.vertId]);\n delete vertShaders[program.vertId];\n delete programCache[program.fragId][program.vertId];\n }\n if (!Object.keys(programCache[program.fragId]).length) {\n gl2.deleteShader(fragShaders[program.fragId]);\n delete fragShaders[program.fragId];\n delete programCache[program.fragId];\n }\n }\n });\n },\n restore: restoreShaders,\n shader: getShader,\n frag: -1,\n vert: -1\n };\n }\n var GL_RGBA$3 = 6408;\n var GL_UNSIGNED_BYTE$6 = 5121;\n var GL_PACK_ALIGNMENT = 3333;\n var GL_FLOAT$6 = 5126;\n function wrapReadPixels(gl2, framebufferState, reglPoll, context, glAttributes, extensions, limits) {\n function readPixelsImpl(input) {\n var type;\n if (framebufferState.next === null) {\n type = GL_UNSIGNED_BYTE$6;\n } else {\n type = framebufferState.next.colorAttachments[0].texture._texture.type;\n }\n var x = 0;\n var y = 0;\n var width = context.framebufferWidth;\n var height = context.framebufferHeight;\n var data = null;\n if (isTypedArray(input)) {\n data = input;\n } else if (input) {\n x = input.x | 0;\n y = input.y | 0;\n width = (input.width || context.framebufferWidth - x) | 0;\n height = (input.height || context.framebufferHeight - y) | 0;\n data = input.data || null;\n }\n if (data) {\n if (type === GL_UNSIGNED_BYTE$6) {\n } else if (type === GL_FLOAT$6) {\n }\n }\n reglPoll();\n var size = width * height * 4;\n if (!data) {\n if (type === GL_UNSIGNED_BYTE$6) {\n data = new Uint8Array(size);\n } else if (type === GL_FLOAT$6) {\n data = data || new Float32Array(size);\n }\n }\n gl2.pixelStorei(GL_PACK_ALIGNMENT, 4);\n gl2.readPixels(\n x,\n y,\n width,\n height,\n GL_RGBA$3,\n type,\n data\n );\n return data;\n }\n function readPixelsFBO(options) {\n var result;\n framebufferState.setFBO({\n framebuffer: options.framebuffer\n }, function() {\n result = readPixelsImpl(options);\n });\n return result;\n }\n function readPixels(options) {\n if (!options || !(\"framebuffer\" in options)) {\n return readPixelsImpl(options);\n } else {\n return readPixelsFBO(options);\n }\n }\n return readPixels;\n }\n var hexcase = 0;\n var b64pad = \"\";\n function hex_sha256(s) {\n return rstr2hex(rstr_sha256(str2rstr_utf8(s)));\n }\n function rstr_sha256(s) {\n return binb2rstr(binb_sha256(rstr2binb(s), s.length * 8));\n }\n function rstr_hmac_sha256(key, data) {\n var bkey = rstr2binb(key);\n if (bkey.length > 16) bkey = binb_sha256(bkey, key.length * 8);\n var ipad = Array(16), opad = Array(16);\n for (var i = 0; i < 16; i++) {\n ipad[i] = bkey[i] ^ 909522486;\n opad[i] = bkey[i] ^ 1549556828;\n }\n var hash = binb_sha256(ipad.concat(rstr2binb(data)), 512 + data.length * 8);\n return binb2rstr(binb_sha256(opad.concat(hash), 512 + 256));\n }\n function rstr2hex(input) {\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var output = \"\";\n var x;\n for (var i = 0; i < input.length; i++) {\n x = input.charCodeAt(i);\n output += hex_tab.charAt(x >>> 4 & 15) + hex_tab.charAt(x & 15);\n }\n return output;\n }\n function rstr2b64(input) {\n var tab = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n var output = \"\";\n var len = input.length;\n for (var i = 0; i < len; i += 3) {\n var triplet = input.charCodeAt(i) << 16 | (i + 1 < len ? input.charCodeAt(i + 1) << 8 : 0) | (i + 2 < len ? input.charCodeAt(i + 2) : 0);\n for (var j = 0; j < 4; j++) {\n if (i * 8 + j * 6 > input.length * 8) output += b64pad;\n else output += tab.charAt(triplet >>> 6 * (3 - j) & 63);\n }\n }\n return output;\n }\n function rstr2any(input, encoding) {\n var divisor = encoding.length;\n var remainders = Array();\n var i, q, x, quotient;\n var dividend = Array(Math.ceil(input.length / 2));\n for (i = 0; i < dividend.length; i++) {\n dividend[i] = input.charCodeAt(i * 2) << 8 | input.charCodeAt(i * 2 + 1);\n }\n while (dividend.length > 0) {\n quotient = Array();\n x = 0;\n for (i = 0; i < dividend.length; i++) {\n x = (x << 16) + dividend[i];\n q = Math.floor(x / divisor);\n x -= q * divisor;\n if (quotient.length > 0 || q > 0)\n quotient[quotient.length] = q;\n }\n remainders[remainders.length] = x;\n dividend = quotient;\n }\n var output = \"\";\n for (i = remainders.length - 1; i >= 0; i--)\n output += encoding.charAt(remainders[i]);\n var full_length = Math.ceil(input.length * 8 / (Math.log(encoding.length) / Math.log(2)));\n for (i = output.length; i < full_length; i++)\n output = encoding[0] + output;\n return output;\n }\n function str2rstr_utf8(input) {\n var output = \"\";\n var i = -1;\n var x, y;\n while (++i < input.length) {\n x = input.charCodeAt(i);\n y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;\n if (55296 <= x && x <= 56319 && 56320 <= y && y <= 57343) {\n x = 65536 + ((x & 1023) << 10) + (y & 1023);\n i++;\n }\n if (x <= 127)\n output += String.fromCharCode(x);\n else if (x <= 2047)\n output += String.fromCharCode(\n 192 | x >>> 6 & 31,\n 128 | x & 63\n );\n else if (x <= 65535)\n output += String.fromCharCode(\n 224 | x >>> 12 & 15,\n 128 | x >>> 6 & 63,\n 128 | x & 63\n );\n else if (x <= 2097151)\n output += String.fromCharCode(\n 240 | x >>> 18 & 7,\n 128 | x >>> 12 & 63,\n 128 | x >>> 6 & 63,\n 128 | x & 63\n );\n }\n return output;\n }\n function rstr2binb(input) {\n var output = Array(input.length >> 2);\n for (var i = 0; i < output.length; i++)\n output[i] = 0;\n for (var i = 0; i < input.length * 8; i += 8)\n output[i >> 5] |= (input.charCodeAt(i / 8) & 255) << 24 - i % 32;\n return output;\n }\n function binb2rstr(input) {\n var output = \"\";\n for (var i = 0; i < input.length * 32; i += 8)\n output += String.fromCharCode(input[i >> 5] >>> 24 - i % 32 & 255);\n return output;\n }\n function sha256_S(X, n) {\n return X >>> n | X << 32 - n;\n }\n function sha256_R(X, n) {\n return X >>> n;\n }\n function sha256_Ch(x, y, z) {\n return x & y ^ ~x & z;\n }\n function sha256_Maj(x, y, z) {\n return x & y ^ x & z ^ y & z;\n }\n function sha256_Sigma0256(x) {\n return sha256_S(x, 2) ^ sha256_S(x, 13) ^ sha256_S(x, 22);\n }\n function sha256_Sigma1256(x) {\n return sha256_S(x, 6) ^ sha256_S(x, 11) ^ sha256_S(x, 25);\n }\n function sha256_Gamma0256(x) {\n return sha256_S(x, 7) ^ sha256_S(x, 18) ^ sha256_R(x, 3);\n }\n function sha256_Gamma1256(x) {\n return sha256_S(x, 17) ^ sha256_S(x, 19) ^ sha256_R(x, 10);\n }\n var sha256_K = new Array(\n 1116352408,\n 1899447441,\n -1245643825,\n -373957723,\n 961987163,\n 1508970993,\n -1841331548,\n -1424204075,\n -670586216,\n 310598401,\n 607225278,\n 1426881987,\n 1925078388,\n -2132889090,\n -1680079193,\n -1046744716,\n -459576895,\n -272742522,\n 264347078,\n 604807628,\n 770255983,\n 1249150122,\n 1555081692,\n 1996064986,\n -1740746414,\n -1473132947,\n -1341970488,\n -1084653625,\n -958395405,\n -710438585,\n 113926993,\n 338241895,\n 666307205,\n 773529912,\n 1294757372,\n 1396182291,\n 1695183700,\n 1986661051,\n -2117940946,\n -1838011259,\n -1564481375,\n -1474664885,\n -1035236496,\n -949202525,\n -778901479,\n -694614492,\n -200395387,\n 275423344,\n 430227734,\n 506948616,\n 659060556,\n 883997877,\n 958139571,\n 1322822218,\n 1537002063,\n 1747873779,\n 1955562222,\n 2024104815,\n -2067236844,\n -1933114872,\n -1866530822,\n -1538233109,\n -1090935817,\n -965641998\n );\n function binb_sha256(m, l) {\n var HASH = new Array(\n 1779033703,\n -1150833019,\n 1013904242,\n -1521486534,\n 1359893119,\n -1694144372,\n 528734635,\n 1541459225\n );\n var W = new Array(64);\n var a, b, c, d, e, f, g, h;\n var i, j, T1, T2;\n m[l >> 5] |= 128 << 24 - l % 32;\n m[(l + 64 >> 9 << 4) + 15] = l;\n for (i = 0; i < m.length; i += 16) {\n a = HASH[0];\n b = HASH[1];\n c = HASH[2];\n d = HASH[3];\n e = HASH[4];\n f = HASH[5];\n g = HASH[6];\n h = HASH[7];\n for (j = 0; j < 64; j++) {\n if (j < 16) W[j] = m[j + i];\n else W[j] = safe_add(safe_add(\n safe_add(sha256_Gamma1256(W[j - 2]), W[j - 7]),\n sha256_Gamma0256(W[j - 15])\n ), W[j - 16]);\n T1 = safe_add(safe_add(\n safe_add(safe_add(h, sha256_Sigma1256(e)), sha256_Ch(e, f, g)),\n sha256_K[j]\n ), W[j]);\n T2 = safe_add(sha256_Sigma0256(a), sha256_Maj(a, b, c));\n h = g;\n g = f;\n f = e;\n e = safe_add(d, T1);\n d = c;\n c = b;\n b = a;\n a = safe_add(T1, T2);\n }\n HASH[0] = safe_add(a, HASH[0]);\n HASH[1] = safe_add(b, HASH[1]);\n HASH[2] = safe_add(c, HASH[2]);\n HASH[3] = safe_add(d, HASH[3]);\n HASH[4] = safe_add(e, HASH[4]);\n HASH[5] = safe_add(f, HASH[5]);\n HASH[6] = safe_add(g, HASH[6]);\n HASH[7] = safe_add(h, HASH[7]);\n }\n return HASH;\n }\n function safe_add(x, y) {\n var lsw = (x & 65535) + (y & 65535);\n var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return msw << 16 | lsw & 65535;\n }\n function slice(x) {\n return Array.prototype.slice.call(x);\n }\n function join(x) {\n return slice(x).join(\"\");\n }\n function createEnvironment(options) {\n var cache = options && options.cache;\n var varCounter = 0;\n var linkedNames = [];\n var linkedValues = [];\n var isStable = [];\n function link(value, options2) {\n var stable = options2 && options2.stable;\n if (!stable) {\n for (var i = 0; i < linkedValues.length; ++i) {\n if (linkedValues[i] === value && !isStable[i]) {\n return linkedNames[i];\n }\n }\n }\n var name2 = \"g\" + varCounter++;\n linkedNames.push(name2);\n linkedValues.push(value);\n isStable.push(stable);\n return name2;\n }\n function block() {\n var code = [];\n function push() {\n code.push.apply(code, slice(arguments));\n }\n var vars = [];\n function def() {\n var name2 = \"v\" + varCounter++;\n vars.push(name2);\n if (arguments.length > 0) {\n code.push(name2, \"=\");\n code.push.apply(code, slice(arguments));\n code.push(\";\");\n }\n return name2;\n }\n return extend2(push, {\n def,\n toString: function() {\n return join([\n vars.length > 0 ? \"var \" + vars.join(\",\") + \";\" : \"\",\n join(code)\n ]);\n }\n });\n }\n function scope() {\n var entry = block();\n var exit = block();\n var entryToString = entry.toString;\n var exitToString = exit.toString;\n function save(object, prop) {\n exit(object, prop, \"=\", entry.def(object, prop), \";\");\n }\n return extend2(function() {\n entry.apply(entry, slice(arguments));\n }, {\n def: entry.def,\n entry,\n exit,\n save,\n set: function(object, prop, value) {\n save(object, prop);\n entry(object, prop, \"=\", value, \";\");\n },\n toString: function() {\n return entryToString() + exitToString();\n }\n });\n }\n function conditional() {\n var pred = join(arguments);\n var thenBlock = scope();\n var elseBlock = scope();\n var thenToString = thenBlock.toString;\n var elseToString = elseBlock.toString;\n return extend2(thenBlock, {\n then: function() {\n thenBlock.apply(thenBlock, slice(arguments));\n return this;\n },\n else: function() {\n elseBlock.apply(elseBlock, slice(arguments));\n return this;\n },\n toString: function() {\n var elseClause = elseToString();\n if (elseClause) {\n elseClause = \"else{\" + elseClause + \"}\";\n }\n return join([\n \"if(\",\n pred,\n \"){\",\n thenToString(),\n \"}\",\n elseClause\n ]);\n }\n });\n }\n var globalBlock = block();\n var procedures = {};\n function proc(name2, count) {\n var args = [];\n function arg() {\n var name3 = \"a\" + args.length;\n args.push(name3);\n return name3;\n }\n count = count || 0;\n for (var i = 0; i < count; ++i) {\n arg();\n }\n var body = scope();\n var bodyToString = body.toString;\n var result = procedures[name2] = extend2(body, {\n arg,\n toString: function() {\n return join([\n \"function(\",\n args.join(),\n \"){\",\n bodyToString(),\n \"}\"\n ]);\n }\n });\n return result;\n }\n function compile() {\n var code = [\n '\"use strict\";',\n globalBlock,\n \"return {\"\n ];\n Object.keys(procedures).forEach(function(name2) {\n code.push('\"', name2, '\":', procedures[name2].toString(), \",\");\n });\n code.push(\"}\");\n var src = join(code).replace(/;/g, \";\\n\").replace(/}/g, \"}\\n\").replace(/{/g, \"{\\n\");\n var key;\n if (cache) {\n key = hex_sha256(src);\n if (cache[key]) {\n return cache[key].apply(null, linkedValues);\n }\n }\n var proc2 = Function.apply(null, linkedNames.concat(src));\n if (cache) {\n cache[key] = proc2;\n }\n return proc2.apply(null, linkedValues);\n }\n return {\n global: globalBlock,\n link,\n block,\n proc,\n scope,\n cond: conditional,\n compile\n };\n }\n var CUTE_COMPONENTS = \"xyzw\".split(\"\");\n var GL_UNSIGNED_BYTE$7 = 5121;\n var ATTRIB_STATE_POINTER = 1;\n var ATTRIB_STATE_CONSTANT = 2;\n var DYN_FUNC$1 = 0;\n var DYN_PROP$1 = 1;\n var DYN_CONTEXT$1 = 2;\n var DYN_STATE$1 = 3;\n var DYN_THUNK = 4;\n var DYN_CONSTANT$1 = 5;\n var DYN_ARRAY$1 = 6;\n var S_DITHER = \"dither\";\n var S_BLEND_ENABLE = \"blend.enable\";\n var S_BLEND_COLOR = \"blend.color\";\n var S_BLEND_EQUATION = \"blend.equation\";\n var S_BLEND_FUNC = \"blend.func\";\n var S_DEPTH_ENABLE = \"depth.enable\";\n var S_DEPTH_FUNC = \"depth.func\";\n var S_DEPTH_RANGE = \"depth.range\";\n var S_DEPTH_MASK = \"depth.mask\";\n var S_COLOR_MASK = \"colorMask\";\n var S_CULL_ENABLE = \"cull.enable\";\n var S_CULL_FACE = \"cull.face\";\n var S_FRONT_FACE = \"frontFace\";\n var S_LINE_WIDTH = \"lineWidth\";\n var S_POLYGON_OFFSET_ENABLE = \"polygonOffset.enable\";\n var S_POLYGON_OFFSET_OFFSET = \"polygonOffset.offset\";\n var S_SAMPLE_ALPHA = \"sample.alpha\";\n var S_SAMPLE_ENABLE = \"sample.enable\";\n var S_SAMPLE_COVERAGE = \"sample.coverage\";\n var S_STENCIL_ENABLE = \"stencil.enable\";\n var S_STENCIL_MASK = \"stencil.mask\";\n var S_STENCIL_FUNC = \"stencil.func\";\n var S_STENCIL_OPFRONT = \"stencil.opFront\";\n var S_STENCIL_OPBACK = \"stencil.opBack\";\n var S_SCISSOR_ENABLE = \"scissor.enable\";\n var S_SCISSOR_BOX = \"scissor.box\";\n var S_VIEWPORT = \"viewport\";\n var S_PROFILE = \"profile\";\n var S_FRAMEBUFFER = \"framebuffer\";\n var S_VERT = \"vert\";\n var S_FRAG = \"frag\";\n var S_ELEMENTS = \"elements\";\n var S_PRIMITIVE = \"primitive\";\n var S_COUNT = \"count\";\n var S_OFFSET = \"offset\";\n var S_INSTANCES = \"instances\";\n var S_VAO = \"vao\";\n var SUFFIX_WIDTH = \"Width\";\n var SUFFIX_HEIGHT = \"Height\";\n var S_FRAMEBUFFER_WIDTH = S_FRAMEBUFFER + SUFFIX_WIDTH;\n var S_FRAMEBUFFER_HEIGHT = S_FRAMEBUFFER + SUFFIX_HEIGHT;\n var S_VIEWPORT_WIDTH = S_VIEWPORT + SUFFIX_WIDTH;\n var S_VIEWPORT_HEIGHT = S_VIEWPORT + SUFFIX_HEIGHT;\n var S_DRAWINGBUFFER = \"drawingBuffer\";\n var S_DRAWINGBUFFER_WIDTH = S_DRAWINGBUFFER + SUFFIX_WIDTH;\n var S_DRAWINGBUFFER_HEIGHT = S_DRAWINGBUFFER + SUFFIX_HEIGHT;\n var NESTED_OPTIONS = [\n S_BLEND_FUNC,\n S_BLEND_EQUATION,\n S_STENCIL_FUNC,\n S_STENCIL_OPFRONT,\n S_STENCIL_OPBACK,\n S_SAMPLE_COVERAGE,\n S_VIEWPORT,\n S_SCISSOR_BOX,\n S_POLYGON_OFFSET_OFFSET\n ];\n var GL_ARRAY_BUFFER$2 = 34962;\n var GL_ELEMENT_ARRAY_BUFFER$2 = 34963;\n var GL_CULL_FACE = 2884;\n var GL_BLEND = 3042;\n var GL_DITHER = 3024;\n var GL_STENCIL_TEST = 2960;\n var GL_DEPTH_TEST = 2929;\n var GL_SCISSOR_TEST = 3089;\n var GL_POLYGON_OFFSET_FILL = 32823;\n var GL_SAMPLE_ALPHA_TO_COVERAGE = 32926;\n var GL_SAMPLE_COVERAGE = 32928;\n var GL_FLOAT$7 = 5126;\n var GL_FLOAT_VEC2 = 35664;\n var GL_FLOAT_VEC3 = 35665;\n var GL_FLOAT_VEC4 = 35666;\n var GL_INT$2 = 5124;\n var GL_INT_VEC2 = 35667;\n var GL_INT_VEC3 = 35668;\n var GL_INT_VEC4 = 35669;\n var GL_BOOL = 35670;\n var GL_BOOL_VEC2 = 35671;\n var GL_BOOL_VEC3 = 35672;\n var GL_BOOL_VEC4 = 35673;\n var GL_FLOAT_MAT2 = 35674;\n var GL_FLOAT_MAT3 = 35675;\n var GL_FLOAT_MAT4 = 35676;\n var GL_SAMPLER_2D = 35678;\n var GL_SAMPLER_CUBE = 35680;\n var GL_TRIANGLES$1 = 4;\n var GL_FRONT = 1028;\n var GL_BACK = 1029;\n var GL_CW = 2304;\n var GL_CCW = 2305;\n var GL_MIN_EXT = 32775;\n var GL_MAX_EXT = 32776;\n var GL_ALWAYS = 519;\n var GL_KEEP = 7680;\n var GL_ZERO = 0;\n var GL_ONE = 1;\n var GL_FUNC_ADD = 32774;\n var GL_LESS = 513;\n var GL_FRAMEBUFFER$2 = 36160;\n var GL_COLOR_ATTACHMENT0$2 = 36064;\n var blendFuncs = {\n \"0\": 0,\n \"1\": 1,\n \"zero\": 0,\n \"one\": 1,\n \"src color\": 768,\n \"one minus src color\": 769,\n \"src alpha\": 770,\n \"one minus src alpha\": 771,\n \"dst color\": 774,\n \"one minus dst color\": 775,\n \"dst alpha\": 772,\n \"one minus dst alpha\": 773,\n \"constant color\": 32769,\n \"one minus constant color\": 32770,\n \"constant alpha\": 32771,\n \"one minus constant alpha\": 32772,\n \"src alpha saturate\": 776\n };\n var compareFuncs = {\n \"never\": 512,\n \"less\": 513,\n \"<\": 513,\n \"equal\": 514,\n \"=\": 514,\n \"==\": 514,\n \"===\": 514,\n \"lequal\": 515,\n \"<=\": 515,\n \"greater\": 516,\n \">\": 516,\n \"notequal\": 517,\n \"!=\": 517,\n \"!==\": 517,\n \"gequal\": 518,\n \">=\": 518,\n \"always\": 519\n };\n var stencilOps = {\n \"0\": 0,\n \"zero\": 0,\n \"keep\": 7680,\n \"replace\": 7681,\n \"increment\": 7682,\n \"decrement\": 7683,\n \"increment wrap\": 34055,\n \"decrement wrap\": 34056,\n \"invert\": 5386\n };\n var orientationType = {\n \"cw\": GL_CW,\n \"ccw\": GL_CCW\n };\n function isBufferArgs(x) {\n return Array.isArray(x) || isTypedArray(x) || isNDArrayLike(x);\n }\n function sortState(state) {\n return state.sort(function(a, b) {\n if (a === S_VIEWPORT) {\n return -1;\n } else if (b === S_VIEWPORT) {\n return 1;\n }\n return a < b ? -1 : 1;\n });\n }\n function Declaration(thisDep, contextDep, propDep, append) {\n this.thisDep = thisDep;\n this.contextDep = contextDep;\n this.propDep = propDep;\n this.append = append;\n }\n function isStatic(decl) {\n return decl && !(decl.thisDep || decl.contextDep || decl.propDep);\n }\n function createStaticDecl(append) {\n return new Declaration(false, false, false, append);\n }\n function createDynamicDecl(dyn, append) {\n var type = dyn.type;\n if (type === DYN_FUNC$1) {\n var numArgs = dyn.data.length;\n return new Declaration(\n true,\n numArgs >= 1,\n numArgs >= 2,\n append\n );\n } else if (type === DYN_THUNK) {\n var data = dyn.data;\n return new Declaration(\n data.thisDep,\n data.contextDep,\n data.propDep,\n append\n );\n } else if (type === DYN_CONSTANT$1) {\n return new Declaration(\n false,\n false,\n false,\n append\n );\n } else if (type === DYN_ARRAY$1) {\n var thisDep = false;\n var contextDep = false;\n var propDep = false;\n for (var i = 0; i < dyn.data.length; ++i) {\n var subDyn = dyn.data[i];\n if (subDyn.type === DYN_PROP$1) {\n propDep = true;\n } else if (subDyn.type === DYN_CONTEXT$1) {\n contextDep = true;\n } else if (subDyn.type === DYN_STATE$1) {\n thisDep = true;\n } else if (subDyn.type === DYN_FUNC$1) {\n thisDep = true;\n var subArgs = subDyn.data;\n if (subArgs >= 1) {\n contextDep = true;\n }\n if (subArgs >= 2) {\n propDep = true;\n }\n } else if (subDyn.type === DYN_THUNK) {\n thisDep = thisDep || subDyn.data.thisDep;\n contextDep = contextDep || subDyn.data.contextDep;\n propDep = propDep || subDyn.data.propDep;\n }\n }\n return new Declaration(\n thisDep,\n contextDep,\n propDep,\n append\n );\n } else {\n return new Declaration(\n type === DYN_STATE$1,\n type === DYN_CONTEXT$1,\n type === DYN_PROP$1,\n append\n );\n }\n }\n var SCOPE_DECL = new Declaration(false, false, false, function() {\n });\n function reglCore(gl2, stringStore, extensions, limits, bufferState, elementState, textureState, framebufferState, uniformState, attributeState, shaderState, drawState, contextState, timer, cachedCode, config) {\n var AttributeRecord2 = attributeState.Record;\n var blendEquations = {\n \"add\": 32774,\n \"subtract\": 32778,\n \"reverse subtract\": 32779\n };\n if (extensions.ext_blend_minmax) {\n blendEquations.min = GL_MIN_EXT;\n blendEquations.max = GL_MAX_EXT;\n }\n var extInstancing = extensions.angle_instanced_arrays;\n var extDrawBuffers = extensions.webgl_draw_buffers;\n var extVertexArrays = extensions.oes_vertex_array_object;\n var currentState = {\n dirty: true,\n profile: config.profile\n };\n var nextState = {};\n var GL_STATE_NAMES = [];\n var GL_FLAGS = {};\n var GL_VARIABLES = {};\n function propName(name2) {\n return name2.replace(\".\", \"_\");\n }\n function stateFlag(sname, cap, init) {\n var name2 = propName(sname);\n GL_STATE_NAMES.push(sname);\n nextState[name2] = currentState[name2] = !!init;\n GL_FLAGS[name2] = cap;\n }\n function stateVariable(sname, func, init) {\n var name2 = propName(sname);\n GL_STATE_NAMES.push(sname);\n if (Array.isArray(init)) {\n currentState[name2] = init.slice();\n nextState[name2] = init.slice();\n } else {\n currentState[name2] = nextState[name2] = init;\n }\n GL_VARIABLES[name2] = func;\n }\n function hasVariableReference(exp) {\n if (!isNaN(exp)) {\n return false;\n }\n return true;\n }\n stateFlag(S_DITHER, GL_DITHER);\n stateFlag(S_BLEND_ENABLE, GL_BLEND);\n stateVariable(S_BLEND_COLOR, \"blendColor\", [0, 0, 0, 0]);\n stateVariable(\n S_BLEND_EQUATION,\n \"blendEquationSeparate\",\n [GL_FUNC_ADD, GL_FUNC_ADD]\n );\n stateVariable(\n S_BLEND_FUNC,\n \"blendFuncSeparate\",\n [GL_ONE, GL_ZERO, GL_ONE, GL_ZERO]\n );\n stateFlag(S_DEPTH_ENABLE, GL_DEPTH_TEST, true);\n stateVariable(S_DEPTH_FUNC, \"depthFunc\", GL_LESS);\n stateVariable(S_DEPTH_RANGE, \"depthRange\", [0, 1]);\n stateVariable(S_DEPTH_MASK, \"depthMask\", true);\n stateVariable(S_COLOR_MASK, S_COLOR_MASK, [true, true, true, true]);\n stateFlag(S_CULL_ENABLE, GL_CULL_FACE);\n stateVariable(S_CULL_FACE, \"cullFace\", GL_BACK);\n stateVariable(S_FRONT_FACE, S_FRONT_FACE, GL_CCW);\n stateVariable(S_LINE_WIDTH, S_LINE_WIDTH, 1);\n stateFlag(S_POLYGON_OFFSET_ENABLE, GL_POLYGON_OFFSET_FILL);\n stateVariable(S_POLYGON_OFFSET_OFFSET, \"polygonOffset\", [0, 0]);\n stateFlag(S_SAMPLE_ALPHA, GL_SAMPLE_ALPHA_TO_COVERAGE);\n stateFlag(S_SAMPLE_ENABLE, GL_SAMPLE_COVERAGE);\n stateVariable(S_SAMPLE_COVERAGE, \"sampleCoverage\", [1, false]);\n stateFlag(S_STENCIL_ENABLE, GL_STENCIL_TEST);\n stateVariable(S_STENCIL_MASK, \"stencilMask\", -1);\n stateVariable(S_STENCIL_FUNC, \"stencilFunc\", [GL_ALWAYS, 0, -1]);\n stateVariable(\n S_STENCIL_OPFRONT,\n \"stencilOpSeparate\",\n [GL_FRONT, GL_KEEP, GL_KEEP, GL_KEEP]\n );\n stateVariable(\n S_STENCIL_OPBACK,\n \"stencilOpSeparate\",\n [GL_BACK, GL_KEEP, GL_KEEP, GL_KEEP]\n );\n stateFlag(S_SCISSOR_ENABLE, GL_SCISSOR_TEST);\n stateVariable(\n S_SCISSOR_BOX,\n \"scissor\",\n [0, 0, gl2.drawingBufferWidth, gl2.drawingBufferHeight]\n );\n stateVariable(\n S_VIEWPORT,\n S_VIEWPORT,\n [0, 0, gl2.drawingBufferWidth, gl2.drawingBufferHeight]\n );\n var sharedState = {\n gl: gl2,\n context: contextState,\n strings: stringStore,\n next: nextState,\n current: currentState,\n draw: drawState,\n elements: elementState,\n buffer: bufferState,\n shader: shaderState,\n attributes: attributeState.state,\n vao: attributeState,\n uniforms: uniformState,\n framebuffer: framebufferState,\n extensions,\n timer,\n isBufferArgs\n };\n var sharedConstants = {\n primTypes,\n compareFuncs,\n blendFuncs,\n blendEquations,\n stencilOps,\n glTypes,\n orientationType\n };\n if (extDrawBuffers) {\n sharedConstants.backBuffer = [GL_BACK];\n sharedConstants.drawBuffer = loop(limits.maxDrawbuffers, function(i) {\n if (i === 0) {\n return [0];\n }\n return loop(i, function(j) {\n return GL_COLOR_ATTACHMENT0$2 + j;\n });\n });\n }\n var drawCallCounter = 0;\n function createREGLEnvironment() {\n var env = createEnvironment({ cache: cachedCode });\n var link = env.link;\n var global2 = env.global;\n env.id = drawCallCounter++;\n env.batchId = \"0\";\n var SHARED = link(sharedState);\n var shared = env.shared = {\n props: \"a0\"\n };\n Object.keys(sharedState).forEach(function(prop) {\n shared[prop] = global2.def(SHARED, \".\", prop);\n });\n var nextVars = env.next = {};\n var currentVars = env.current = {};\n Object.keys(GL_VARIABLES).forEach(function(variable) {\n if (Array.isArray(currentState[variable])) {\n nextVars[variable] = global2.def(shared.next, \".\", variable);\n currentVars[variable] = global2.def(shared.current, \".\", variable);\n }\n });\n var constants = env.constants = {};\n Object.keys(sharedConstants).forEach(function(name2) {\n constants[name2] = global2.def(JSON.stringify(sharedConstants[name2]));\n });\n env.invoke = function(block, x) {\n switch (x.type) {\n case DYN_FUNC$1:\n var argList = [\n \"this\",\n shared.context,\n shared.props,\n env.batchId\n ];\n return block.def(\n link(x.data),\n \".call(\",\n argList.slice(0, Math.max(x.data.length + 1, 4)),\n \")\"\n );\n case DYN_PROP$1:\n return block.def(shared.props, x.data);\n case DYN_CONTEXT$1:\n return block.def(shared.context, x.data);\n case DYN_STATE$1:\n return block.def(\"this\", x.data);\n case DYN_THUNK:\n x.data.append(env, block);\n return x.data.ref;\n case DYN_CONSTANT$1:\n return x.data.toString();\n case DYN_ARRAY$1:\n return x.data.map(function(y) {\n return env.invoke(block, y);\n });\n }\n };\n env.attribCache = {};\n var scopeAttribs = {};\n env.scopeAttrib = function(name2) {\n var id = stringStore.id(name2);\n if (id in scopeAttribs) {\n return scopeAttribs[id];\n }\n var binding = attributeState.scope[id];\n if (!binding) {\n binding = attributeState.scope[id] = new AttributeRecord2();\n }\n var result = scopeAttribs[id] = link(binding);\n return result;\n };\n return env;\n }\n function parseProfile(options) {\n var staticOptions = options.static;\n var dynamicOptions = options.dynamic;\n var profileEnable;\n if (S_PROFILE in staticOptions) {\n var value = !!staticOptions[S_PROFILE];\n profileEnable = createStaticDecl(function(env, scope) {\n return value;\n });\n profileEnable.enable = value;\n } else if (S_PROFILE in dynamicOptions) {\n var dyn = dynamicOptions[S_PROFILE];\n profileEnable = createDynamicDecl(dyn, function(env, scope) {\n return env.invoke(scope, dyn);\n });\n }\n return profileEnable;\n }\n function parseFramebuffer(options, env) {\n var staticOptions = options.static;\n var dynamicOptions = options.dynamic;\n if (S_FRAMEBUFFER in staticOptions) {\n var framebuffer = staticOptions[S_FRAMEBUFFER];\n if (framebuffer) {\n framebuffer = framebufferState.getFramebuffer(framebuffer);\n return createStaticDecl(function(env2, block) {\n var FRAMEBUFFER = env2.link(framebuffer);\n var shared = env2.shared;\n block.set(\n shared.framebuffer,\n \".next\",\n FRAMEBUFFER\n );\n var CONTEXT = shared.context;\n block.set(\n CONTEXT,\n \".\" + S_FRAMEBUFFER_WIDTH,\n FRAMEBUFFER + \".width\"\n );\n block.set(\n CONTEXT,\n \".\" + S_FRAMEBUFFER_HEIGHT,\n FRAMEBUFFER + \".height\"\n );\n return FRAMEBUFFER;\n });\n } else {\n return createStaticDecl(function(env2, scope) {\n var shared = env2.shared;\n scope.set(\n shared.framebuffer,\n \".next\",\n \"null\"\n );\n var CONTEXT = shared.context;\n scope.set(\n CONTEXT,\n \".\" + S_FRAMEBUFFER_WIDTH,\n CONTEXT + \".\" + S_DRAWINGBUFFER_WIDTH\n );\n scope.set(\n CONTEXT,\n \".\" + S_FRAMEBUFFER_HEIGHT,\n CONTEXT + \".\" + S_DRAWINGBUFFER_HEIGHT\n );\n return \"null\";\n });\n }\n } else if (S_FRAMEBUFFER in dynamicOptions) {\n var dyn = dynamicOptions[S_FRAMEBUFFER];\n return createDynamicDecl(dyn, function(env2, scope) {\n var FRAMEBUFFER_FUNC = env2.invoke(scope, dyn);\n var shared = env2.shared;\n var FRAMEBUFFER_STATE = shared.framebuffer;\n var FRAMEBUFFER = scope.def(\n FRAMEBUFFER_STATE,\n \".getFramebuffer(\",\n FRAMEBUFFER_FUNC,\n \")\"\n );\n scope.set(\n FRAMEBUFFER_STATE,\n \".next\",\n FRAMEBUFFER\n );\n var CONTEXT = shared.context;\n scope.set(\n CONTEXT,\n \".\" + S_FRAMEBUFFER_WIDTH,\n FRAMEBUFFER + \"?\" + FRAMEBUFFER + \".width:\" + CONTEXT + \".\" + S_DRAWINGBUFFER_WIDTH\n );\n scope.set(\n CONTEXT,\n \".\" + S_FRAMEBUFFER_HEIGHT,\n FRAMEBUFFER + \"?\" + FRAMEBUFFER + \".height:\" + CONTEXT + \".\" + S_DRAWINGBUFFER_HEIGHT\n );\n return FRAMEBUFFER;\n });\n } else {\n return null;\n }\n }\n function parseViewportScissor(options, framebuffer, env) {\n var staticOptions = options.static;\n var dynamicOptions = options.dynamic;\n function parseBox(param) {\n if (param in staticOptions) {\n var box = staticOptions[param];\n var isStatic2 = true;\n var x = box.x | 0;\n var y = box.y | 0;\n var w, h;\n if (\"width\" in box) {\n w = box.width | 0;\n } else {\n isStatic2 = false;\n }\n if (\"height\" in box) {\n h = box.height | 0;\n } else {\n isStatic2 = false;\n }\n return new Declaration(\n !isStatic2 && framebuffer && framebuffer.thisDep,\n !isStatic2 && framebuffer && framebuffer.contextDep,\n !isStatic2 && framebuffer && framebuffer.propDep,\n function(env2, scope) {\n var CONTEXT = env2.shared.context;\n var BOX_W = w;\n if (!(\"width\" in box)) {\n BOX_W = scope.def(CONTEXT, \".\", S_FRAMEBUFFER_WIDTH, \"-\", x);\n }\n var BOX_H = h;\n if (!(\"height\" in box)) {\n BOX_H = scope.def(CONTEXT, \".\", S_FRAMEBUFFER_HEIGHT, \"-\", y);\n }\n return [x, y, BOX_W, BOX_H];\n }\n );\n } else if (param in dynamicOptions) {\n var dynBox = dynamicOptions[param];\n var result = createDynamicDecl(dynBox, function(env2, scope) {\n var BOX = env2.invoke(scope, dynBox);\n var CONTEXT = env2.shared.context;\n var BOX_X = scope.def(BOX, \".x|0\");\n var BOX_Y = scope.def(BOX, \".y|0\");\n var BOX_W = scope.def(\n '\"width\" in ',\n BOX,\n \"?\",\n BOX,\n \".width|0:\",\n \"(\",\n CONTEXT,\n \".\",\n S_FRAMEBUFFER_WIDTH,\n \"-\",\n BOX_X,\n \")\"\n );\n var BOX_H = scope.def(\n '\"height\" in ',\n BOX,\n \"?\",\n BOX,\n \".height|0:\",\n \"(\",\n CONTEXT,\n \".\",\n S_FRAMEBUFFER_HEIGHT,\n \"-\",\n BOX_Y,\n \")\"\n );\n return [BOX_X, BOX_Y, BOX_W, BOX_H];\n });\n if (framebuffer) {\n result.thisDep = result.thisDep || framebuffer.thisDep;\n result.contextDep = result.contextDep || framebuffer.contextDep;\n result.propDep = result.propDep || framebuffer.propDep;\n }\n return result;\n } else if (framebuffer) {\n return new Declaration(\n framebuffer.thisDep,\n framebuffer.contextDep,\n framebuffer.propDep,\n function(env2, scope) {\n var CONTEXT = env2.shared.context;\n return [\n 0,\n 0,\n scope.def(CONTEXT, \".\", S_FRAMEBUFFER_WIDTH),\n scope.def(CONTEXT, \".\", S_FRAMEBUFFER_HEIGHT)\n ];\n }\n );\n } else {\n return null;\n }\n }\n var viewport = parseBox(S_VIEWPORT);\n if (viewport) {\n var prevViewport = viewport;\n viewport = new Declaration(\n viewport.thisDep,\n viewport.contextDep,\n viewport.propDep,\n function(env2, scope) {\n var VIEWPORT = prevViewport.append(env2, scope);\n var CONTEXT = env2.shared.context;\n scope.set(\n CONTEXT,\n \".\" + S_VIEWPORT_WIDTH,\n VIEWPORT[2]\n );\n scope.set(\n CONTEXT,\n \".\" + S_VIEWPORT_HEIGHT,\n VIEWPORT[3]\n );\n return VIEWPORT;\n }\n );\n }\n return {\n viewport,\n scissor_box: parseBox(S_SCISSOR_BOX)\n };\n }\n function parseAttribLocations(options, attributes) {\n var staticOptions = options.static;\n var staticProgram = typeof staticOptions[S_FRAG] === \"string\" && typeof staticOptions[S_VERT] === \"string\";\n if (staticProgram) {\n if (Object.keys(attributes.dynamic).length > 0) {\n return null;\n }\n var staticAttributes = attributes.static;\n var sAttributes = Object.keys(staticAttributes);\n if (sAttributes.length > 0 && typeof staticAttributes[sAttributes[0]] === \"number\") {\n var bindings = [];\n for (var i = 0; i < sAttributes.length; ++i) {\n bindings.push([staticAttributes[sAttributes[i]] | 0, sAttributes[i]]);\n }\n return bindings;\n }\n }\n return null;\n }\n function parseProgram(options, env, attribLocations) {\n var staticOptions = options.static;\n var dynamicOptions = options.dynamic;\n function parseShader(name2) {\n if (name2 in staticOptions) {\n var id = stringStore.id(staticOptions[name2]);\n var result = createStaticDecl(function() {\n return id;\n });\n result.id = id;\n return result;\n } else if (name2 in dynamicOptions) {\n var dyn = dynamicOptions[name2];\n return createDynamicDecl(dyn, function(env2, scope) {\n var str = env2.invoke(scope, dyn);\n var id2 = scope.def(env2.shared.strings, \".id(\", str, \")\");\n return id2;\n });\n }\n return null;\n }\n var frag = parseShader(S_FRAG);\n var vert = parseShader(S_VERT);\n var program = null;\n var progVar;\n if (isStatic(frag) && isStatic(vert)) {\n program = shaderState.program(vert.id, frag.id, null, attribLocations);\n progVar = createStaticDecl(function(env2, scope) {\n return env2.link(program);\n });\n } else {\n progVar = new Declaration(\n frag && frag.thisDep || vert && vert.thisDep,\n frag && frag.contextDep || vert && vert.contextDep,\n frag && frag.propDep || vert && vert.propDep,\n function(env2, scope) {\n var SHADER_STATE = env2.shared.shader;\n var fragId;\n if (frag) {\n fragId = frag.append(env2, scope);\n } else {\n fragId = scope.def(SHADER_STATE, \".\", S_FRAG);\n }\n var vertId;\n if (vert) {\n vertId = vert.append(env2, scope);\n } else {\n vertId = scope.def(SHADER_STATE, \".\", S_VERT);\n }\n var progDef = SHADER_STATE + \".program(\" + vertId + \",\" + fragId;\n return scope.def(progDef + \")\");\n }\n );\n }\n return {\n frag,\n vert,\n progVar,\n program\n };\n }\n function parseDraw(options, env) {\n var staticOptions = options.static;\n var dynamicOptions = options.dynamic;\n var staticDraw = {};\n var vaoActive = false;\n function parseVAO() {\n if (S_VAO in staticOptions) {\n var vao2 = staticOptions[S_VAO];\n if (vao2 !== null && attributeState.getVAO(vao2) === null) {\n vao2 = attributeState.createVAO(vao2);\n }\n vaoActive = true;\n staticDraw.vao = vao2;\n return createStaticDecl(function(env2) {\n var vaoRef = attributeState.getVAO(vao2);\n if (vaoRef) {\n return env2.link(vaoRef);\n } else {\n return \"null\";\n }\n });\n } else if (S_VAO in dynamicOptions) {\n vaoActive = true;\n var dyn = dynamicOptions[S_VAO];\n return createDynamicDecl(dyn, function(env2, scope) {\n var vaoRef = env2.invoke(scope, dyn);\n return scope.def(env2.shared.vao + \".getVAO(\" + vaoRef + \")\");\n });\n }\n return null;\n }\n var vao = parseVAO();\n var elementsActive = false;\n function parseElements() {\n if (S_ELEMENTS in staticOptions) {\n var elements2 = staticOptions[S_ELEMENTS];\n staticDraw.elements = elements2;\n if (isBufferArgs(elements2)) {\n var e = staticDraw.elements = elementState.create(elements2, true);\n elements2 = elementState.getElements(e);\n elementsActive = true;\n } else if (elements2) {\n elements2 = elementState.getElements(elements2);\n elementsActive = true;\n }\n var result = createStaticDecl(function(env2, scope) {\n if (elements2) {\n var result2 = env2.link(elements2);\n env2.ELEMENTS = result2;\n return result2;\n }\n env2.ELEMENTS = null;\n return null;\n });\n result.value = elements2;\n return result;\n } else if (S_ELEMENTS in dynamicOptions) {\n elementsActive = true;\n var dyn = dynamicOptions[S_ELEMENTS];\n return createDynamicDecl(dyn, function(env2, scope) {\n var shared = env2.shared;\n var IS_BUFFER_ARGS = shared.isBufferArgs;\n var ELEMENT_STATE = shared.elements;\n var elementDefn = env2.invoke(scope, dyn);\n var elements3 = scope.def(\"null\");\n var elementStream = scope.def(IS_BUFFER_ARGS, \"(\", elementDefn, \")\");\n var ifte = env2.cond(elementStream).then(elements3, \"=\", ELEMENT_STATE, \".createStream(\", elementDefn, \");\").else(elements3, \"=\", ELEMENT_STATE, \".getElements(\", elementDefn, \");\");\n scope.entry(ifte);\n scope.exit(\n env2.cond(elementStream).then(ELEMENT_STATE, \".destroyStream(\", elements3, \");\")\n );\n env2.ELEMENTS = elements3;\n return elements3;\n });\n } else if (vaoActive) {\n return new Declaration(\n vao.thisDep,\n vao.contextDep,\n vao.propDep,\n function(env2, scope) {\n return scope.def(env2.shared.vao + \".currentVAO?\" + env2.shared.elements + \".getElements(\" + env2.shared.vao + \".currentVAO.elements):null\");\n }\n );\n }\n return null;\n }\n var elements = parseElements();\n function parsePrimitive() {\n if (S_PRIMITIVE in staticOptions) {\n var primitive2 = staticOptions[S_PRIMITIVE];\n staticDraw.primitive = primitive2;\n return createStaticDecl(function(env2, scope) {\n return primTypes[primitive2];\n });\n } else if (S_PRIMITIVE in dynamicOptions) {\n var dynPrimitive = dynamicOptions[S_PRIMITIVE];\n return createDynamicDecl(dynPrimitive, function(env2, scope) {\n var PRIM_TYPES = env2.constants.primTypes;\n var prim = env2.invoke(scope, dynPrimitive);\n return scope.def(PRIM_TYPES, \"[\", prim, \"]\");\n });\n } else if (elementsActive) {\n if (isStatic(elements)) {\n if (elements.value) {\n return createStaticDecl(function(env2, scope) {\n return scope.def(env2.ELEMENTS, \".primType\");\n });\n } else {\n return createStaticDecl(function() {\n return GL_TRIANGLES$1;\n });\n }\n } else {\n return new Declaration(\n elements.thisDep,\n elements.contextDep,\n elements.propDep,\n function(env2, scope) {\n var elements2 = env2.ELEMENTS;\n return scope.def(elements2, \"?\", elements2, \".primType:\", GL_TRIANGLES$1);\n }\n );\n }\n } else if (vaoActive) {\n return new Declaration(\n vao.thisDep,\n vao.contextDep,\n vao.propDep,\n function(env2, scope) {\n return scope.def(env2.shared.vao + \".currentVAO?\" + env2.shared.vao + \".currentVAO.primitive:\" + GL_TRIANGLES$1);\n }\n );\n }\n return null;\n }\n function parseParam(param, isOffset) {\n if (param in staticOptions) {\n var value = staticOptions[param] | 0;\n if (isOffset) {\n staticDraw.offset = value;\n } else {\n staticDraw.instances = value;\n }\n return createStaticDecl(function(env2, scope) {\n if (isOffset) {\n env2.OFFSET = value;\n }\n return value;\n });\n } else if (param in dynamicOptions) {\n var dynValue = dynamicOptions[param];\n return createDynamicDecl(dynValue, function(env2, scope) {\n var result = env2.invoke(scope, dynValue);\n if (isOffset) {\n env2.OFFSET = result;\n }\n return result;\n });\n } else if (isOffset) {\n if (elementsActive) {\n return createStaticDecl(function(env2, scope) {\n env2.OFFSET = 0;\n return 0;\n });\n } else if (vaoActive) {\n return new Declaration(\n vao.thisDep,\n vao.contextDep,\n vao.propDep,\n function(env2, scope) {\n return scope.def(env2.shared.vao + \".currentVAO?\" + env2.shared.vao + \".currentVAO.offset:0\");\n }\n );\n }\n } else if (vaoActive) {\n return new Declaration(\n vao.thisDep,\n vao.contextDep,\n vao.propDep,\n function(env2, scope) {\n return scope.def(env2.shared.vao + \".currentVAO?\" + env2.shared.vao + \".currentVAO.instances:-1\");\n }\n );\n }\n return null;\n }\n var OFFSET = parseParam(S_OFFSET, true);\n function parseVertCount() {\n if (S_COUNT in staticOptions) {\n var count2 = staticOptions[S_COUNT] | 0;\n staticDraw.count = count2;\n return createStaticDecl(function() {\n return count2;\n });\n } else if (S_COUNT in dynamicOptions) {\n var dynCount = dynamicOptions[S_COUNT];\n return createDynamicDecl(dynCount, function(env2, scope) {\n var result2 = env2.invoke(scope, dynCount);\n return result2;\n });\n } else if (elementsActive) {\n if (isStatic(elements)) {\n if (elements) {\n if (OFFSET) {\n return new Declaration(\n OFFSET.thisDep,\n OFFSET.contextDep,\n OFFSET.propDep,\n function(env2, scope) {\n var result2 = scope.def(\n env2.ELEMENTS,\n \".vertCount-\",\n env2.OFFSET\n );\n return result2;\n }\n );\n } else {\n return createStaticDecl(function(env2, scope) {\n return scope.def(env2.ELEMENTS, \".vertCount\");\n });\n }\n } else {\n var result = createStaticDecl(function() {\n return -1;\n });\n return result;\n }\n } else {\n var variable = new Declaration(\n elements.thisDep || OFFSET.thisDep,\n elements.contextDep || OFFSET.contextDep,\n elements.propDep || OFFSET.propDep,\n function(env2, scope) {\n var elements2 = env2.ELEMENTS;\n if (env2.OFFSET) {\n return scope.def(\n elements2,\n \"?\",\n elements2,\n \".vertCount-\",\n env2.OFFSET,\n \":-1\"\n );\n }\n return scope.def(elements2, \"?\", elements2, \".vertCount:-1\");\n }\n );\n return variable;\n }\n } else if (vaoActive) {\n var countVariable = new Declaration(\n vao.thisDep,\n vao.contextDep,\n vao.propDep,\n function(env2, scope) {\n return scope.def(env2.shared.vao, \".currentVAO?\", env2.shared.vao, \".currentVAO.count:-1\");\n }\n );\n return countVariable;\n }\n return null;\n }\n var primitive = parsePrimitive();\n var count = parseVertCount();\n var instances = parseParam(S_INSTANCES, false);\n return {\n elements,\n primitive,\n count,\n instances,\n offset: OFFSET,\n vao,\n vaoActive,\n elementsActive,\n // static draw props\n static: staticDraw\n };\n }\n function parseGLState(options, env) {\n var staticOptions = options.static;\n var dynamicOptions = options.dynamic;\n var STATE = {};\n GL_STATE_NAMES.forEach(function(prop) {\n var param = propName(prop);\n function parseParam(parseStatic, parseDynamic) {\n if (prop in staticOptions) {\n var value = parseStatic(staticOptions[prop]);\n STATE[param] = createStaticDecl(function() {\n return value;\n });\n } else if (prop in dynamicOptions) {\n var dyn = dynamicOptions[prop];\n STATE[param] = createDynamicDecl(dyn, function(env2, scope) {\n return parseDynamic(env2, scope, env2.invoke(scope, dyn));\n });\n }\n }\n switch (prop) {\n case S_CULL_ENABLE:\n case S_BLEND_ENABLE:\n case S_DITHER:\n case S_STENCIL_ENABLE:\n case S_DEPTH_ENABLE:\n case S_SCISSOR_ENABLE:\n case S_POLYGON_OFFSET_ENABLE:\n case S_SAMPLE_ALPHA:\n case S_SAMPLE_ENABLE:\n case S_DEPTH_MASK:\n return parseParam(\n function(value) {\n return value;\n },\n function(env2, scope, value) {\n return value;\n }\n );\n case S_DEPTH_FUNC:\n return parseParam(\n function(value) {\n return compareFuncs[value];\n },\n function(env2, scope, value) {\n var COMPARE_FUNCS = env2.constants.compareFuncs;\n return scope.def(COMPARE_FUNCS, \"[\", value, \"]\");\n }\n );\n case S_DEPTH_RANGE:\n return parseParam(\n function(value) {\n return value;\n },\n function(env2, scope, value) {\n var Z_NEAR = scope.def(\"+\", value, \"[0]\");\n var Z_FAR = scope.def(\"+\", value, \"[1]\");\n return [Z_NEAR, Z_FAR];\n }\n );\n case S_BLEND_FUNC:\n return parseParam(\n function(value) {\n var srcRGB = \"srcRGB\" in value ? value.srcRGB : value.src;\n var srcAlpha = \"srcAlpha\" in value ? value.srcAlpha : value.src;\n var dstRGB = \"dstRGB\" in value ? value.dstRGB : value.dst;\n var dstAlpha = \"dstAlpha\" in value ? value.dstAlpha : value.dst;\n return [\n blendFuncs[srcRGB],\n blendFuncs[dstRGB],\n blendFuncs[srcAlpha],\n blendFuncs[dstAlpha]\n ];\n },\n function(env2, scope, value) {\n var BLEND_FUNCS = env2.constants.blendFuncs;\n function read(prefix, suffix) {\n var func = scope.def(\n '\"',\n prefix,\n suffix,\n '\" in ',\n value,\n \"?\",\n value,\n \".\",\n prefix,\n suffix,\n \":\",\n value,\n \".\",\n prefix\n );\n return func;\n }\n var srcRGB = read(\"src\", \"RGB\");\n var dstRGB = read(\"dst\", \"RGB\");\n var SRC_RGB = scope.def(BLEND_FUNCS, \"[\", srcRGB, \"]\");\n var SRC_ALPHA = scope.def(BLEND_FUNCS, \"[\", read(\"src\", \"Alpha\"), \"]\");\n var DST_RGB = scope.def(BLEND_FUNCS, \"[\", dstRGB, \"]\");\n var DST_ALPHA = scope.def(BLEND_FUNCS, \"[\", read(\"dst\", \"Alpha\"), \"]\");\n return [SRC_RGB, DST_RGB, SRC_ALPHA, DST_ALPHA];\n }\n );\n case S_BLEND_EQUATION:\n return parseParam(\n function(value) {\n if (typeof value === \"string\") {\n return [\n blendEquations[value],\n blendEquations[value]\n ];\n } else if (typeof value === \"object\") {\n return [\n blendEquations[value.rgb],\n blendEquations[value.alpha]\n ];\n } else {\n }\n },\n function(env2, scope, value) {\n var BLEND_EQUATIONS = env2.constants.blendEquations;\n var RGB = scope.def();\n var ALPHA = scope.def();\n var ifte = env2.cond(\"typeof \", value, '===\"string\"');\n ifte.then(\n RGB,\n \"=\",\n ALPHA,\n \"=\",\n BLEND_EQUATIONS,\n \"[\",\n value,\n \"];\"\n );\n ifte.else(\n RGB,\n \"=\",\n BLEND_EQUATIONS,\n \"[\",\n value,\n \".rgb];\",\n ALPHA,\n \"=\",\n BLEND_EQUATIONS,\n \"[\",\n value,\n \".alpha];\"\n );\n scope(ifte);\n return [RGB, ALPHA];\n }\n );\n case S_BLEND_COLOR:\n return parseParam(\n function(value) {\n return loop(4, function(i) {\n return +value[i];\n });\n },\n function(env2, scope, value) {\n return loop(4, function(i) {\n return scope.def(\"+\", value, \"[\", i, \"]\");\n });\n }\n );\n case S_STENCIL_MASK:\n return parseParam(\n function(value) {\n return value | 0;\n },\n function(env2, scope, value) {\n return scope.def(value, \"|0\");\n }\n );\n case S_STENCIL_FUNC:\n return parseParam(\n function(value) {\n var cmp = value.cmp || \"keep\";\n var ref = value.ref || 0;\n var mask = \"mask\" in value ? value.mask : -1;\n return [\n compareFuncs[cmp],\n ref,\n mask\n ];\n },\n function(env2, scope, value) {\n var COMPARE_FUNCS = env2.constants.compareFuncs;\n var cmp = scope.def(\n '\"cmp\" in ',\n value,\n \"?\",\n COMPARE_FUNCS,\n \"[\",\n value,\n \".cmp]\",\n \":\",\n GL_KEEP\n );\n var ref = scope.def(value, \".ref|0\");\n var mask = scope.def(\n '\"mask\" in ',\n value,\n \"?\",\n value,\n \".mask|0:-1\"\n );\n return [cmp, ref, mask];\n }\n );\n case S_STENCIL_OPFRONT:\n case S_STENCIL_OPBACK:\n return parseParam(\n function(value) {\n var fail = value.fail || \"keep\";\n var zfail = value.zfail || \"keep\";\n var zpass = value.zpass || \"keep\";\n return [\n prop === S_STENCIL_OPBACK ? GL_BACK : GL_FRONT,\n stencilOps[fail],\n stencilOps[zfail],\n stencilOps[zpass]\n ];\n },\n function(env2, scope, value) {\n var STENCIL_OPS = env2.constants.stencilOps;\n function read(name2) {\n return scope.def(\n '\"',\n name2,\n '\" in ',\n value,\n \"?\",\n STENCIL_OPS,\n \"[\",\n value,\n \".\",\n name2,\n \"]:\",\n GL_KEEP\n );\n }\n return [\n prop === S_STENCIL_OPBACK ? GL_BACK : GL_FRONT,\n read(\"fail\"),\n read(\"zfail\"),\n read(\"zpass\")\n ];\n }\n );\n case S_POLYGON_OFFSET_OFFSET:\n return parseParam(\n function(value) {\n var factor = value.factor | 0;\n var units = value.units | 0;\n return [factor, units];\n },\n function(env2, scope, value) {\n var FACTOR = scope.def(value, \".factor|0\");\n var UNITS = scope.def(value, \".units|0\");\n return [FACTOR, UNITS];\n }\n );\n case S_CULL_FACE:\n return parseParam(\n function(value) {\n var face = 0;\n if (value === \"front\") {\n face = GL_FRONT;\n } else if (value === \"back\") {\n face = GL_BACK;\n }\n return face;\n },\n function(env2, scope, value) {\n return scope.def(value, '===\"front\"?', GL_FRONT, \":\", GL_BACK);\n }\n );\n case S_LINE_WIDTH:\n return parseParam(\n function(value) {\n return value;\n },\n function(env2, scope, value) {\n return value;\n }\n );\n case S_FRONT_FACE:\n return parseParam(\n function(value) {\n return orientationType[value];\n },\n function(env2, scope, value) {\n return scope.def(value + '===\"cw\"?' + GL_CW + \":\" + GL_CCW);\n }\n );\n case S_COLOR_MASK:\n return parseParam(\n function(value) {\n return value.map(function(v) {\n return !!v;\n });\n },\n function(env2, scope, value) {\n return loop(4, function(i) {\n return \"!!\" + value + \"[\" + i + \"]\";\n });\n }\n );\n case S_SAMPLE_COVERAGE:\n return parseParam(\n function(value) {\n var sampleValue = \"value\" in value ? value.value : 1;\n var sampleInvert = !!value.invert;\n return [sampleValue, sampleInvert];\n },\n function(env2, scope, value) {\n var VALUE = scope.def(\n '\"value\" in ',\n value,\n \"?+\",\n value,\n \".value:1\"\n );\n var INVERT = scope.def(\"!!\", value, \".invert\");\n return [VALUE, INVERT];\n }\n );\n }\n });\n return STATE;\n }\n function parseUniforms(uniforms, env) {\n var staticUniforms = uniforms.static;\n var dynamicUniforms = uniforms.dynamic;\n var UNIFORMS = {};\n Object.keys(staticUniforms).forEach(function(name2) {\n var value = staticUniforms[name2];\n var result;\n if (typeof value === \"number\" || typeof value === \"boolean\") {\n result = createStaticDecl(function() {\n return value;\n });\n } else if (typeof value === \"function\") {\n var reglType = value._reglType;\n if (reglType === \"texture2d\" || reglType === \"textureCube\") {\n result = createStaticDecl(function(env2) {\n return env2.link(value);\n });\n } else if (reglType === \"framebuffer\" || reglType === \"framebufferCube\") {\n result = createStaticDecl(function(env2) {\n return env2.link(value.color[0]);\n });\n } else {\n }\n } else if (isArrayLike(value)) {\n result = createStaticDecl(function(env2) {\n var ITEM = env2.global.def(\n \"[\",\n loop(value.length, function(i) {\n return value[i];\n }),\n \"]\"\n );\n return ITEM;\n });\n } else {\n }\n result.value = value;\n UNIFORMS[name2] = result;\n });\n Object.keys(dynamicUniforms).forEach(function(key) {\n var dyn = dynamicUniforms[key];\n UNIFORMS[key] = createDynamicDecl(dyn, function(env2, scope) {\n return env2.invoke(scope, dyn);\n });\n });\n return UNIFORMS;\n }\n function parseAttributes(attributes, env) {\n var staticAttributes = attributes.static;\n var dynamicAttributes = attributes.dynamic;\n var attributeDefs = {};\n Object.keys(staticAttributes).forEach(function(attribute) {\n var value = staticAttributes[attribute];\n var id = stringStore.id(attribute);\n var record = new AttributeRecord2();\n if (isBufferArgs(value)) {\n record.state = ATTRIB_STATE_POINTER;\n record.buffer = bufferState.getBuffer(\n bufferState.create(value, GL_ARRAY_BUFFER$2, false, true)\n );\n record.type = 0;\n } else {\n var buffer = bufferState.getBuffer(value);\n if (buffer) {\n record.state = ATTRIB_STATE_POINTER;\n record.buffer = buffer;\n record.type = 0;\n } else {\n if (\"constant\" in value) {\n var constant = value.constant;\n record.buffer = \"null\";\n record.state = ATTRIB_STATE_CONSTANT;\n if (typeof constant === \"number\") {\n record.x = constant;\n } else {\n CUTE_COMPONENTS.forEach(function(c, i) {\n if (i < constant.length) {\n record[c] = constant[i];\n }\n });\n }\n } else {\n if (isBufferArgs(value.buffer)) {\n buffer = bufferState.getBuffer(\n bufferState.create(value.buffer, GL_ARRAY_BUFFER$2, false, true)\n );\n } else {\n buffer = bufferState.getBuffer(value.buffer);\n }\n var offset = value.offset | 0;\n var stride = value.stride | 0;\n var size = value.size | 0;\n var normalized = !!value.normalized;\n var type = 0;\n if (\"type\" in value) {\n type = glTypes[value.type];\n }\n var divisor = value.divisor | 0;\n record.buffer = buffer;\n record.state = ATTRIB_STATE_POINTER;\n record.size = size;\n record.normalized = normalized;\n record.type = type || buffer.dtype;\n record.offset = offset;\n record.stride = stride;\n record.divisor = divisor;\n }\n }\n }\n attributeDefs[attribute] = createStaticDecl(function(env2, scope) {\n var cache = env2.attribCache;\n if (id in cache) {\n return cache[id];\n }\n var result = {\n isStream: false\n };\n Object.keys(record).forEach(function(key) {\n result[key] = record[key];\n });\n if (record.buffer) {\n result.buffer = env2.link(record.buffer);\n result.type = result.type || result.buffer + \".dtype\";\n }\n cache[id] = result;\n return result;\n });\n });\n Object.keys(dynamicAttributes).forEach(function(attribute) {\n var dyn = dynamicAttributes[attribute];\n function appendAttributeCode(env2, block) {\n var VALUE = env2.invoke(block, dyn);\n var shared = env2.shared;\n var constants = env2.constants;\n var IS_BUFFER_ARGS = shared.isBufferArgs;\n var BUFFER_STATE = shared.buffer;\n var result = {\n isStream: block.def(false)\n };\n var defaultRecord = new AttributeRecord2();\n defaultRecord.state = ATTRIB_STATE_POINTER;\n Object.keys(defaultRecord).forEach(function(key) {\n result[key] = block.def(\"\" + defaultRecord[key]);\n });\n var BUFFER = result.buffer;\n var TYPE = result.type;\n block(\n \"if(\",\n IS_BUFFER_ARGS,\n \"(\",\n VALUE,\n \")){\",\n result.isStream,\n \"=true;\",\n BUFFER,\n \"=\",\n BUFFER_STATE,\n \".createStream(\",\n GL_ARRAY_BUFFER$2,\n \",\",\n VALUE,\n \");\",\n TYPE,\n \"=\",\n BUFFER,\n \".dtype;\",\n \"}else{\",\n BUFFER,\n \"=\",\n BUFFER_STATE,\n \".getBuffer(\",\n VALUE,\n \");\",\n \"if(\",\n BUFFER,\n \"){\",\n TYPE,\n \"=\",\n BUFFER,\n \".dtype;\",\n '}else if(\"constant\" in ',\n VALUE,\n \"){\",\n result.state,\n \"=\",\n ATTRIB_STATE_CONSTANT,\n \";\",\n \"if(typeof \" + VALUE + '.constant === \"number\"){',\n result[CUTE_COMPONENTS[0]],\n \"=\",\n VALUE,\n \".constant;\",\n CUTE_COMPONENTS.slice(1).map(function(n) {\n return result[n];\n }).join(\"=\"),\n \"=0;\",\n \"}else{\",\n CUTE_COMPONENTS.map(function(name2, i) {\n return result[name2] + \"=\" + VALUE + \".constant.length>\" + i + \"?\" + VALUE + \".constant[\" + i + \"]:0;\";\n }).join(\"\"),\n \"}}else{\",\n \"if(\",\n IS_BUFFER_ARGS,\n \"(\",\n VALUE,\n \".buffer)){\",\n BUFFER,\n \"=\",\n BUFFER_STATE,\n \".createStream(\",\n GL_ARRAY_BUFFER$2,\n \",\",\n VALUE,\n \".buffer);\",\n \"}else{\",\n BUFFER,\n \"=\",\n BUFFER_STATE,\n \".getBuffer(\",\n VALUE,\n \".buffer);\",\n \"}\",\n TYPE,\n '=\"type\" in ',\n VALUE,\n \"?\",\n constants.glTypes,\n \"[\",\n VALUE,\n \".type]:\",\n BUFFER,\n \".dtype;\",\n result.normalized,\n \"=!!\",\n VALUE,\n \".normalized;\"\n );\n function emitReadRecord(name2) {\n block(result[name2], \"=\", VALUE, \".\", name2, \"|0;\");\n }\n emitReadRecord(\"size\");\n emitReadRecord(\"offset\");\n emitReadRecord(\"stride\");\n emitReadRecord(\"divisor\");\n block(\"}}\");\n block.exit(\n \"if(\",\n result.isStream,\n \"){\",\n BUFFER_STATE,\n \".destroyStream(\",\n BUFFER,\n \");\",\n \"}\"\n );\n return result;\n }\n attributeDefs[attribute] = createDynamicDecl(dyn, appendAttributeCode);\n });\n return attributeDefs;\n }\n function parseContext(context) {\n var staticContext = context.static;\n var dynamicContext = context.dynamic;\n var result = {};\n Object.keys(staticContext).forEach(function(name2) {\n var value = staticContext[name2];\n result[name2] = createStaticDecl(function(env, scope) {\n if (typeof value === \"number\" || typeof value === \"boolean\") {\n return \"\" + value;\n } else {\n return env.link(value);\n }\n });\n });\n Object.keys(dynamicContext).forEach(function(name2) {\n var dyn = dynamicContext[name2];\n result[name2] = createDynamicDecl(dyn, function(env, scope) {\n return env.invoke(scope, dyn);\n });\n });\n return result;\n }\n function parseArguments(options, attributes, uniforms, context, env) {\n var staticOptions = options.static;\n var dynamicOptions = options.dynamic;\n var attribLocations = parseAttribLocations(options, attributes);\n var framebuffer = parseFramebuffer(options, env);\n var viewportAndScissor = parseViewportScissor(options, framebuffer, env);\n var draw = parseDraw(options, env);\n var state = parseGLState(options, env);\n var shader = parseProgram(options, env, attribLocations);\n function copyBox(name2) {\n var defn = viewportAndScissor[name2];\n if (defn) {\n state[name2] = defn;\n }\n }\n copyBox(S_VIEWPORT);\n copyBox(propName(S_SCISSOR_BOX));\n var dirty = Object.keys(state).length > 0;\n var result = {\n framebuffer,\n draw,\n shader,\n state,\n dirty,\n scopeVAO: null,\n drawVAO: null,\n useVAO: false,\n attributes: {}\n };\n result.profile = parseProfile(options, env);\n result.uniforms = parseUniforms(uniforms, env);\n result.drawVAO = result.scopeVAO = draw.vao;\n if (!result.drawVAO && shader.program && !attribLocations && extensions.angle_instanced_arrays && draw.static.elements) {\n var useVAO = true;\n var staticBindings = shader.program.attributes.map(function(attr) {\n var binding = attributes.static[attr];\n useVAO = useVAO && !!binding;\n return binding;\n });\n if (useVAO && staticBindings.length > 0) {\n var vao = attributeState.getVAO(attributeState.createVAO({\n attributes: staticBindings,\n elements: draw.static.elements\n }));\n result.drawVAO = new Declaration(null, null, null, function(env2, scope) {\n return env2.link(vao);\n });\n result.useVAO = true;\n }\n }\n if (attribLocations) {\n result.useVAO = true;\n } else {\n result.attributes = parseAttributes(attributes, env);\n }\n result.context = parseContext(context, env);\n return result;\n }\n function emitContext(env, scope, context) {\n var shared = env.shared;\n var CONTEXT = shared.context;\n var contextEnter = env.scope();\n Object.keys(context).forEach(function(name2) {\n scope.save(CONTEXT, \".\" + name2);\n var defn = context[name2];\n var value = defn.append(env, scope);\n if (Array.isArray(value)) {\n contextEnter(CONTEXT, \".\", name2, \"=[\", value.join(), \"];\");\n } else {\n contextEnter(CONTEXT, \".\", name2, \"=\", value, \";\");\n }\n });\n scope(contextEnter);\n }\n function emitPollFramebuffer(env, scope, framebuffer, skipCheck) {\n var shared = env.shared;\n var GL = shared.gl;\n var FRAMEBUFFER_STATE = shared.framebuffer;\n var EXT_DRAW_BUFFERS;\n if (extDrawBuffers) {\n EXT_DRAW_BUFFERS = scope.def(shared.extensions, \".webgl_draw_buffers\");\n }\n var constants = env.constants;\n var DRAW_BUFFERS = constants.drawBuffer;\n var BACK_BUFFER = constants.backBuffer;\n var NEXT;\n if (framebuffer) {\n NEXT = framebuffer.append(env, scope);\n } else {\n NEXT = scope.def(FRAMEBUFFER_STATE, \".next\");\n }\n if (!skipCheck) {\n scope(\"if(\", NEXT, \"!==\", FRAMEBUFFER_STATE, \".cur){\");\n }\n scope(\n \"if(\",\n NEXT,\n \"){\",\n GL,\n \".bindFramebuffer(\",\n GL_FRAMEBUFFER$2,\n \",\",\n NEXT,\n \".framebuffer);\"\n );\n if (extDrawBuffers) {\n scope(\n EXT_DRAW_BUFFERS,\n \".drawBuffersWEBGL(\",\n DRAW_BUFFERS,\n \"[\",\n NEXT,\n \".colorAttachments.length]);\"\n );\n }\n scope(\n \"}else{\",\n GL,\n \".bindFramebuffer(\",\n GL_FRAMEBUFFER$2,\n \",null);\"\n );\n if (extDrawBuffers) {\n scope(EXT_DRAW_BUFFERS, \".drawBuffersWEBGL(\", BACK_BUFFER, \");\");\n }\n scope(\n \"}\",\n FRAMEBUFFER_STATE,\n \".cur=\",\n NEXT,\n \";\"\n );\n if (!skipCheck) {\n scope(\"}\");\n }\n }\n function emitPollState(env, scope, args) {\n var shared = env.shared;\n var GL = shared.gl;\n var CURRENT_VARS = env.current;\n var NEXT_VARS = env.next;\n var CURRENT_STATE = shared.current;\n var NEXT_STATE = shared.next;\n var block = env.cond(CURRENT_STATE, \".dirty\");\n GL_STATE_NAMES.forEach(function(prop) {\n var param = propName(prop);\n if (param in args.state) {\n return;\n }\n var NEXT, CURRENT;\n if (param in NEXT_VARS) {\n NEXT = NEXT_VARS[param];\n CURRENT = CURRENT_VARS[param];\n var parts = loop(currentState[param].length, function(i) {\n return block.def(NEXT, \"[\", i, \"]\");\n });\n block(env.cond(parts.map(function(p, i) {\n return p + \"!==\" + CURRENT + \"[\" + i + \"]\";\n }).join(\"||\")).then(\n GL,\n \".\",\n GL_VARIABLES[param],\n \"(\",\n parts,\n \");\",\n parts.map(function(p, i) {\n return CURRENT + \"[\" + i + \"]=\" + p;\n }).join(\";\"),\n \";\"\n ));\n } else {\n NEXT = block.def(NEXT_STATE, \".\", param);\n var ifte = env.cond(NEXT, \"!==\", CURRENT_STATE, \".\", param);\n block(ifte);\n if (param in GL_FLAGS) {\n ifte(\n env.cond(NEXT).then(GL, \".enable(\", GL_FLAGS[param], \");\").else(GL, \".disable(\", GL_FLAGS[param], \");\"),\n CURRENT_STATE,\n \".\",\n param,\n \"=\",\n NEXT,\n \";\"\n );\n } else {\n ifte(\n GL,\n \".\",\n GL_VARIABLES[param],\n \"(\",\n NEXT,\n \");\",\n CURRENT_STATE,\n \".\",\n param,\n \"=\",\n NEXT,\n \";\"\n );\n }\n }\n });\n if (Object.keys(args.state).length === 0) {\n block(CURRENT_STATE, \".dirty=false;\");\n }\n scope(block);\n }\n function emitSetOptions(env, scope, options, filter) {\n var shared = env.shared;\n var CURRENT_VARS = env.current;\n var CURRENT_STATE = shared.current;\n var GL = shared.gl;\n var VALUE;\n sortState(Object.keys(options)).forEach(function(param) {\n var defn = options[param];\n if (filter && !filter(defn)) {\n return;\n }\n var variable = defn.append(env, scope);\n if (GL_FLAGS[param]) {\n var flag = GL_FLAGS[param];\n if (isStatic(defn)) {\n VALUE = env.link(variable, { stable: true });\n scope(env.cond(VALUE).then(GL, \".enable(\", flag, \");\").else(GL, \".disable(\", flag, \");\"));\n scope(CURRENT_STATE, \".\", param, \"=\", VALUE, \";\");\n } else {\n scope(env.cond(variable).then(GL, \".enable(\", flag, \");\").else(GL, \".disable(\", flag, \");\"));\n scope(CURRENT_STATE, \".\", param, \"=\", variable, \";\");\n }\n } else if (isArrayLike(variable)) {\n var CURRENT = CURRENT_VARS[param];\n scope(\n GL,\n \".\",\n GL_VARIABLES[param],\n \"(\",\n variable,\n \");\",\n variable.map(function(v, i) {\n return CURRENT + \"[\" + i + \"]=\" + v;\n }).join(\";\"),\n \";\"\n );\n } else {\n if (isStatic(defn)) {\n VALUE = env.link(variable, { stable: true });\n scope(\n GL,\n \".\",\n GL_VARIABLES[param],\n \"(\",\n VALUE,\n \");\",\n CURRENT_STATE,\n \".\",\n param,\n \"=\",\n VALUE,\n \";\"\n );\n } else {\n scope(\n GL,\n \".\",\n GL_VARIABLES[param],\n \"(\",\n variable,\n \");\",\n CURRENT_STATE,\n \".\",\n param,\n \"=\",\n variable,\n \";\"\n );\n }\n }\n });\n }\n function injectExtensions(env, scope) {\n if (extInstancing) {\n env.instancing = scope.def(\n env.shared.extensions,\n \".angle_instanced_arrays\"\n );\n }\n }\n function emitProfile(env, scope, args, useScope, incrementCounter) {\n var shared = env.shared;\n var STATS = env.stats;\n var CURRENT_STATE = shared.current;\n var TIMER = shared.timer;\n var profileArg = args.profile;\n function perfCounter() {\n if (typeof performance === \"undefined\") {\n return \"Date.now()\";\n } else {\n return \"performance.now()\";\n }\n }\n var CPU_START, QUERY_COUNTER;\n function emitProfileStart(block) {\n CPU_START = scope.def();\n block(CPU_START, \"=\", perfCounter(), \";\");\n if (typeof incrementCounter === \"string\") {\n block(STATS, \".count+=\", incrementCounter, \";\");\n } else {\n block(STATS, \".count++;\");\n }\n if (timer) {\n if (useScope) {\n QUERY_COUNTER = scope.def();\n block(QUERY_COUNTER, \"=\", TIMER, \".getNumPendingQueries();\");\n } else {\n block(TIMER, \".beginQuery(\", STATS, \");\");\n }\n }\n }\n function emitProfileEnd(block) {\n block(STATS, \".cpuTime+=\", perfCounter(), \"-\", CPU_START, \";\");\n if (timer) {\n if (useScope) {\n block(\n TIMER,\n \".pushScopeStats(\",\n QUERY_COUNTER,\n \",\",\n TIMER,\n \".getNumPendingQueries(),\",\n STATS,\n \");\"\n );\n } else {\n block(TIMER, \".endQuery();\");\n }\n }\n }\n function scopeProfile(value) {\n var prev = scope.def(CURRENT_STATE, \".profile\");\n scope(CURRENT_STATE, \".profile=\", value, \";\");\n scope.exit(CURRENT_STATE, \".profile=\", prev, \";\");\n }\n var USE_PROFILE;\n if (profileArg) {\n if (isStatic(profileArg)) {\n if (profileArg.enable) {\n emitProfileStart(scope);\n emitProfileEnd(scope.exit);\n scopeProfile(\"true\");\n } else {\n scopeProfile(\"false\");\n }\n return;\n }\n USE_PROFILE = profileArg.append(env, scope);\n scopeProfile(USE_PROFILE);\n } else {\n USE_PROFILE = scope.def(CURRENT_STATE, \".profile\");\n }\n var start = env.block();\n emitProfileStart(start);\n scope(\"if(\", USE_PROFILE, \"){\", start, \"}\");\n var end = env.block();\n emitProfileEnd(end);\n scope.exit(\"if(\", USE_PROFILE, \"){\", end, \"}\");\n }\n function emitAttributes(env, scope, args, attributes, filter) {\n var shared = env.shared;\n function typeLength(x) {\n switch (x) {\n case GL_FLOAT_VEC2:\n case GL_INT_VEC2:\n case GL_BOOL_VEC2:\n return 2;\n case GL_FLOAT_VEC3:\n case GL_INT_VEC3:\n case GL_BOOL_VEC3:\n return 3;\n case GL_FLOAT_VEC4:\n case GL_INT_VEC4:\n case GL_BOOL_VEC4:\n return 4;\n default:\n return 1;\n }\n }\n function emitBindAttribute(ATTRIBUTE, size, record) {\n var GL = shared.gl;\n var LOCATION = scope.def(ATTRIBUTE, \".location\");\n var BINDING = scope.def(shared.attributes, \"[\", LOCATION, \"]\");\n var STATE = record.state;\n var BUFFER = record.buffer;\n var CONST_COMPONENTS = [\n record.x,\n record.y,\n record.z,\n record.w\n ];\n var COMMON_KEYS = [\n \"buffer\",\n \"normalized\",\n \"offset\",\n \"stride\"\n ];\n function emitBuffer() {\n scope(\n \"if(!\",\n BINDING,\n \".buffer){\",\n GL,\n \".enableVertexAttribArray(\",\n LOCATION,\n \");}\"\n );\n var TYPE = record.type;\n var SIZE;\n if (!record.size) {\n SIZE = size;\n } else {\n SIZE = scope.def(record.size, \"||\", size);\n }\n scope(\n \"if(\",\n BINDING,\n \".type!==\",\n TYPE,\n \"||\",\n BINDING,\n \".size!==\",\n SIZE,\n \"||\",\n COMMON_KEYS.map(function(key) {\n return BINDING + \".\" + key + \"!==\" + record[key];\n }).join(\"||\"),\n \"){\",\n GL,\n \".bindBuffer(\",\n GL_ARRAY_BUFFER$2,\n \",\",\n BUFFER,\n \".buffer);\",\n GL,\n \".vertexAttribPointer(\",\n [\n LOCATION,\n SIZE,\n TYPE,\n record.normalized,\n record.stride,\n record.offset\n ],\n \");\",\n BINDING,\n \".type=\",\n TYPE,\n \";\",\n BINDING,\n \".size=\",\n SIZE,\n \";\",\n COMMON_KEYS.map(function(key) {\n return BINDING + \".\" + key + \"=\" + record[key] + \";\";\n }).join(\"\"),\n \"}\"\n );\n if (extInstancing) {\n var DIVISOR = record.divisor;\n scope(\n \"if(\",\n BINDING,\n \".divisor!==\",\n DIVISOR,\n \"){\",\n env.instancing,\n \".vertexAttribDivisorANGLE(\",\n [LOCATION, DIVISOR],\n \");\",\n BINDING,\n \".divisor=\",\n DIVISOR,\n \";}\"\n );\n }\n }\n function emitConstant() {\n scope(\n \"if(\",\n BINDING,\n \".buffer){\",\n GL,\n \".disableVertexAttribArray(\",\n LOCATION,\n \");\",\n BINDING,\n \".buffer=null;\",\n \"}if(\",\n CUTE_COMPONENTS.map(function(c, i) {\n return BINDING + \".\" + c + \"!==\" + CONST_COMPONENTS[i];\n }).join(\"||\"),\n \"){\",\n GL,\n \".vertexAttrib4f(\",\n LOCATION,\n \",\",\n CONST_COMPONENTS,\n \");\",\n CUTE_COMPONENTS.map(function(c, i) {\n return BINDING + \".\" + c + \"=\" + CONST_COMPONENTS[i] + \";\";\n }).join(\"\"),\n \"}\"\n );\n }\n if (STATE === ATTRIB_STATE_POINTER) {\n emitBuffer();\n } else if (STATE === ATTRIB_STATE_CONSTANT) {\n emitConstant();\n } else {\n scope(\"if(\", STATE, \"===\", ATTRIB_STATE_POINTER, \"){\");\n emitBuffer();\n scope(\"}else{\");\n emitConstant();\n scope(\"}\");\n }\n }\n attributes.forEach(function(attribute) {\n var name2 = attribute.name;\n var arg = args.attributes[name2];\n var record;\n if (arg) {\n if (!filter(arg)) {\n return;\n }\n record = arg.append(env, scope);\n } else {\n if (!filter(SCOPE_DECL)) {\n return;\n }\n var scopeAttrib = env.scopeAttrib(name2);\n record = {};\n Object.keys(new AttributeRecord2()).forEach(function(key) {\n record[key] = scope.def(scopeAttrib, \".\", key);\n });\n }\n emitBindAttribute(\n env.link(attribute),\n typeLength(attribute.info.type),\n record\n );\n });\n }\n function emitUniforms(env, scope, args, uniforms, filter, isBatchInnerLoop) {\n var shared = env.shared;\n var GL = shared.gl;\n var infix;\n for (var i = 0; i < uniforms.length; ++i) {\n var uniform = uniforms[i];\n var name2 = uniform.name;\n var type = uniform.info.type;\n var arg = args.uniforms[name2];\n var UNIFORM = env.link(uniform);\n var LOCATION = UNIFORM + \".location\";\n var VALUE;\n if (arg) {\n if (!filter(arg)) {\n continue;\n }\n if (isStatic(arg)) {\n var value = arg.value;\n if (type === GL_SAMPLER_2D || type === GL_SAMPLER_CUBE) {\n var TEX_VALUE = env.link(value._texture || value.color[0]._texture);\n scope(GL, \".uniform1i(\", LOCATION, \",\", TEX_VALUE + \".bind());\");\n scope.exit(TEX_VALUE, \".unbind();\");\n } else if (type === GL_FLOAT_MAT2 || type === GL_FLOAT_MAT3 || type === GL_FLOAT_MAT4) {\n var MAT_VALUE = env.global.def(\"new Float32Array([\" + Array.prototype.slice.call(value) + \"])\");\n var dim = 2;\n if (type === GL_FLOAT_MAT3) {\n dim = 3;\n } else if (type === GL_FLOAT_MAT4) {\n dim = 4;\n }\n scope(\n GL,\n \".uniformMatrix\",\n dim,\n \"fv(\",\n LOCATION,\n \",false,\",\n MAT_VALUE,\n \");\"\n );\n } else {\n switch (type) {\n case GL_FLOAT$7:\n infix = \"1f\";\n break;\n case GL_FLOAT_VEC2:\n infix = \"2f\";\n break;\n case GL_FLOAT_VEC3:\n infix = \"3f\";\n break;\n case GL_FLOAT_VEC4:\n infix = \"4f\";\n break;\n case GL_BOOL:\n infix = \"1i\";\n break;\n case GL_INT$2:\n infix = \"1i\";\n break;\n case GL_BOOL_VEC2:\n infix = \"2i\";\n break;\n case GL_INT_VEC2:\n infix = \"2i\";\n break;\n case GL_BOOL_VEC3:\n infix = \"3i\";\n break;\n case GL_INT_VEC3:\n infix = \"3i\";\n break;\n case GL_BOOL_VEC4:\n infix = \"4i\";\n break;\n case GL_INT_VEC4:\n infix = \"4i\";\n break;\n }\n scope(\n GL,\n \".uniform\",\n infix,\n \"(\",\n LOCATION,\n \",\",\n isArrayLike(value) ? Array.prototype.slice.call(value) : value,\n \");\"\n );\n }\n continue;\n } else {\n VALUE = arg.append(env, scope);\n }\n } else {\n if (!filter(SCOPE_DECL)) {\n continue;\n }\n VALUE = scope.def(shared.uniforms, \"[\", stringStore.id(name2), \"]\");\n }\n if (type === GL_SAMPLER_2D) {\n scope(\n \"if(\",\n VALUE,\n \"&&\",\n VALUE,\n '._reglType===\"framebuffer\"){',\n VALUE,\n \"=\",\n VALUE,\n \".color[0];\",\n \"}\"\n );\n } else if (type === GL_SAMPLER_CUBE) {\n scope(\n \"if(\",\n VALUE,\n \"&&\",\n VALUE,\n '._reglType===\"framebufferCube\"){',\n VALUE,\n \"=\",\n VALUE,\n \".color[0];\",\n \"}\"\n );\n }\n var unroll = 1;\n switch (type) {\n case GL_SAMPLER_2D:\n case GL_SAMPLER_CUBE:\n var TEX = scope.def(VALUE, \"._texture\");\n scope(GL, \".uniform1i(\", LOCATION, \",\", TEX, \".bind());\");\n scope.exit(TEX, \".unbind();\");\n continue;\n case GL_INT$2:\n case GL_BOOL:\n infix = \"1i\";\n break;\n case GL_INT_VEC2:\n case GL_BOOL_VEC2:\n infix = \"2i\";\n unroll = 2;\n break;\n case GL_INT_VEC3:\n case GL_BOOL_VEC3:\n infix = \"3i\";\n unroll = 3;\n break;\n case GL_INT_VEC4:\n case GL_BOOL_VEC4:\n infix = \"4i\";\n unroll = 4;\n break;\n case GL_FLOAT$7:\n infix = \"1f\";\n break;\n case GL_FLOAT_VEC2:\n infix = \"2f\";\n unroll = 2;\n break;\n case GL_FLOAT_VEC3:\n infix = \"3f\";\n unroll = 3;\n break;\n case GL_FLOAT_VEC4:\n infix = \"4f\";\n unroll = 4;\n break;\n case GL_FLOAT_MAT2:\n infix = \"Matrix2fv\";\n break;\n case GL_FLOAT_MAT3:\n infix = \"Matrix3fv\";\n break;\n case GL_FLOAT_MAT4:\n infix = \"Matrix4fv\";\n break;\n }\n if (infix.charAt(0) === \"M\") {\n scope(GL, \".uniform\", infix, \"(\", LOCATION, \",\");\n var matSize = Math.pow(type - GL_FLOAT_MAT2 + 2, 2);\n var STORAGE = env.global.def(\"new Float32Array(\", matSize, \")\");\n if (Array.isArray(VALUE)) {\n scope(\n \"false,(\",\n loop(matSize, function(i2) {\n return STORAGE + \"[\" + i2 + \"]=\" + VALUE[i2];\n }),\n \",\",\n STORAGE,\n \")\"\n );\n } else {\n scope(\n \"false,(Array.isArray(\",\n VALUE,\n \")||\",\n VALUE,\n \" instanceof Float32Array)?\",\n VALUE,\n \":(\",\n loop(matSize, function(i2) {\n return STORAGE + \"[\" + i2 + \"]=\" + VALUE + \"[\" + i2 + \"]\";\n }),\n \",\",\n STORAGE,\n \")\"\n );\n }\n scope(\");\");\n } else if (unroll > 1) {\n var prev = [];\n var cur = [];\n for (var j = 0; j < unroll; ++j) {\n if (Array.isArray(VALUE)) {\n cur.push(VALUE[j]);\n } else {\n cur.push(scope.def(VALUE + \"[\" + j + \"]\"));\n }\n if (isBatchInnerLoop) {\n prev.push(scope.def());\n }\n }\n if (isBatchInnerLoop) {\n scope(\"if(!\", env.batchId, \"||\", prev.map(function(p, i2) {\n return p + \"!==\" + cur[i2];\n }).join(\"||\"), \"){\", prev.map(function(p, i2) {\n return p + \"=\" + cur[i2] + \";\";\n }).join(\"\"));\n }\n scope(GL, \".uniform\", infix, \"(\", LOCATION, \",\", cur.join(\",\"), \");\");\n if (isBatchInnerLoop) {\n scope(\"}\");\n }\n } else {\n if (isBatchInnerLoop) {\n var prevS = scope.def();\n scope(\n \"if(!\",\n env.batchId,\n \"||\",\n prevS,\n \"!==\",\n VALUE,\n \"){\",\n prevS,\n \"=\",\n VALUE,\n \";\"\n );\n }\n scope(GL, \".uniform\", infix, \"(\", LOCATION, \",\", VALUE, \");\");\n if (isBatchInnerLoop) {\n scope(\"}\");\n }\n }\n }\n }\n function emitDraw(env, outer, inner, args) {\n var shared = env.shared;\n var GL = shared.gl;\n var DRAW_STATE = shared.draw;\n var drawOptions = args.draw;\n function emitElements() {\n var defn = drawOptions.elements;\n var ELEMENTS2;\n var scope = outer;\n if (defn) {\n if (defn.contextDep && args.contextDynamic || defn.propDep) {\n scope = inner;\n }\n ELEMENTS2 = defn.append(env, scope);\n if (drawOptions.elementsActive) {\n scope(\n \"if(\" + ELEMENTS2 + \")\" + GL + \".bindBuffer(\" + GL_ELEMENT_ARRAY_BUFFER$2 + \",\" + ELEMENTS2 + \".buffer.buffer);\"\n );\n }\n } else {\n ELEMENTS2 = scope.def();\n scope(\n ELEMENTS2,\n \"=\",\n DRAW_STATE,\n \".\",\n S_ELEMENTS,\n \";\",\n \"if(\",\n ELEMENTS2,\n \"){\",\n GL,\n \".bindBuffer(\",\n GL_ELEMENT_ARRAY_BUFFER$2,\n \",\",\n ELEMENTS2,\n \".buffer.buffer);}\",\n \"else if(\",\n shared.vao,\n \".currentVAO){\",\n ELEMENTS2,\n \"=\",\n env.shared.elements + \".getElements(\" + shared.vao,\n \".currentVAO.elements);\",\n !extVertexArrays ? \"if(\" + ELEMENTS2 + \")\" + GL + \".bindBuffer(\" + GL_ELEMENT_ARRAY_BUFFER$2 + \",\" + ELEMENTS2 + \".buffer.buffer);\" : \"\",\n \"}\"\n );\n }\n return ELEMENTS2;\n }\n function emitCount() {\n var defn = drawOptions.count;\n var COUNT2;\n var scope = outer;\n if (defn) {\n if (defn.contextDep && args.contextDynamic || defn.propDep) {\n scope = inner;\n }\n COUNT2 = defn.append(env, scope);\n } else {\n COUNT2 = scope.def(DRAW_STATE, \".\", S_COUNT);\n }\n return COUNT2;\n }\n var ELEMENTS = emitElements();\n function emitValue(name2) {\n var defn = drawOptions[name2];\n if (defn) {\n if (defn.contextDep && args.contextDynamic || defn.propDep) {\n return defn.append(env, inner);\n } else {\n return defn.append(env, outer);\n }\n } else {\n return outer.def(DRAW_STATE, \".\", name2);\n }\n }\n var PRIMITIVE = emitValue(S_PRIMITIVE);\n var OFFSET = emitValue(S_OFFSET);\n var COUNT = emitCount();\n if (typeof COUNT === \"number\") {\n if (COUNT === 0) {\n return;\n }\n } else {\n inner(\"if(\", COUNT, \"){\");\n inner.exit(\"}\");\n }\n var INSTANCES, EXT_INSTANCING;\n if (extInstancing) {\n INSTANCES = emitValue(S_INSTANCES);\n EXT_INSTANCING = env.instancing;\n }\n var ELEMENT_TYPE = ELEMENTS + \".type\";\n var elementsStatic = drawOptions.elements && isStatic(drawOptions.elements) && !drawOptions.vaoActive;\n function emitInstancing() {\n function drawElements() {\n inner(EXT_INSTANCING, \".drawElementsInstancedANGLE(\", [\n PRIMITIVE,\n COUNT,\n ELEMENT_TYPE,\n OFFSET + \"<<((\" + ELEMENT_TYPE + \"-\" + GL_UNSIGNED_BYTE$7 + \")>>1)\",\n INSTANCES\n ], \");\");\n }\n function drawArrays() {\n inner(\n EXT_INSTANCING,\n \".drawArraysInstancedANGLE(\",\n [PRIMITIVE, OFFSET, COUNT, INSTANCES],\n \");\"\n );\n }\n if (ELEMENTS && ELEMENTS !== \"null\") {\n if (!elementsStatic) {\n inner(\"if(\", ELEMENTS, \"){\");\n drawElements();\n inner(\"}else{\");\n drawArrays();\n inner(\"}\");\n } else {\n drawElements();\n }\n } else {\n drawArrays();\n }\n }\n function emitRegular() {\n function drawElements() {\n inner(GL + \".drawElements(\" + [\n PRIMITIVE,\n COUNT,\n ELEMENT_TYPE,\n OFFSET + \"<<((\" + ELEMENT_TYPE + \"-\" + GL_UNSIGNED_BYTE$7 + \")>>1)\"\n ] + \");\");\n }\n function drawArrays() {\n inner(GL + \".drawArrays(\" + [PRIMITIVE, OFFSET, COUNT] + \");\");\n }\n if (ELEMENTS && ELEMENTS !== \"null\") {\n if (!elementsStatic) {\n inner(\"if(\", ELEMENTS, \"){\");\n drawElements();\n inner(\"}else{\");\n drawArrays();\n inner(\"}\");\n } else {\n drawElements();\n }\n } else {\n drawArrays();\n }\n }\n if (extInstancing && (typeof INSTANCES !== \"number\" || INSTANCES >= 0)) {\n if (typeof INSTANCES === \"string\") {\n inner(\"if(\", INSTANCES, \">0){\");\n emitInstancing();\n inner(\"}else if(\", INSTANCES, \"<0){\");\n emitRegular();\n inner(\"}\");\n } else {\n emitInstancing();\n }\n } else {\n emitRegular();\n }\n }\n function createBody(emitBody, parentEnv, args, program, count) {\n var env = createREGLEnvironment();\n var scope = env.proc(\"body\", count);\n if (extInstancing) {\n env.instancing = scope.def(\n env.shared.extensions,\n \".angle_instanced_arrays\"\n );\n }\n emitBody(env, scope, args, program);\n return env.compile().body;\n }\n function emitDrawBody(env, draw, args, program) {\n injectExtensions(env, draw);\n if (args.useVAO) {\n if (args.drawVAO) {\n draw(env.shared.vao, \".setVAO(\", args.drawVAO.append(env, draw), \");\");\n } else {\n draw(env.shared.vao, \".setVAO(\", env.shared.vao, \".targetVAO);\");\n }\n } else {\n draw(env.shared.vao, \".setVAO(null);\");\n emitAttributes(env, draw, args, program.attributes, function() {\n return true;\n });\n }\n emitUniforms(env, draw, args, program.uniforms, function() {\n return true;\n }, false);\n emitDraw(env, draw, draw, args);\n }\n function emitDrawProc(env, args) {\n var draw = env.proc(\"draw\", 1);\n injectExtensions(env, draw);\n emitContext(env, draw, args.context);\n emitPollFramebuffer(env, draw, args.framebuffer);\n emitPollState(env, draw, args);\n emitSetOptions(env, draw, args.state);\n emitProfile(env, draw, args, false, true);\n var program = args.shader.progVar.append(env, draw);\n draw(env.shared.gl, \".useProgram(\", program, \".program);\");\n if (args.shader.program) {\n emitDrawBody(env, draw, args, args.shader.program);\n } else {\n draw(env.shared.vao, \".setVAO(null);\");\n var drawCache = env.global.def(\"{}\");\n var PROG_ID = draw.def(program, \".id\");\n var CACHED_PROC = draw.def(drawCache, \"[\", PROG_ID, \"]\");\n draw(\n env.cond(CACHED_PROC).then(CACHED_PROC, \".call(this,a0);\").else(\n CACHED_PROC,\n \"=\",\n drawCache,\n \"[\",\n PROG_ID,\n \"]=\",\n env.link(function(program2) {\n return createBody(emitDrawBody, env, args, program2, 1);\n }),\n \"(\",\n program,\n \");\",\n CACHED_PROC,\n \".call(this,a0);\"\n )\n );\n }\n if (Object.keys(args.state).length > 0) {\n draw(env.shared.current, \".dirty=true;\");\n }\n if (env.shared.vao) {\n draw(env.shared.vao, \".setVAO(null);\");\n }\n }\n function emitBatchDynamicShaderBody(env, scope, args, program) {\n env.batchId = \"a1\";\n injectExtensions(env, scope);\n function all() {\n return true;\n }\n emitAttributes(env, scope, args, program.attributes, all);\n emitUniforms(env, scope, args, program.uniforms, all, false);\n emitDraw(env, scope, scope, args);\n }\n function emitBatchBody(env, scope, args, program) {\n injectExtensions(env, scope);\n var contextDynamic = args.contextDep;\n var BATCH_ID = scope.def();\n var PROP_LIST = \"a0\";\n var NUM_PROPS = \"a1\";\n var PROPS = scope.def();\n env.shared.props = PROPS;\n env.batchId = BATCH_ID;\n var outer = env.scope();\n var inner = env.scope();\n scope(\n outer.entry,\n \"for(\",\n BATCH_ID,\n \"=0;\",\n BATCH_ID,\n \"<\",\n NUM_PROPS,\n \";++\",\n BATCH_ID,\n \"){\",\n PROPS,\n \"=\",\n PROP_LIST,\n \"[\",\n BATCH_ID,\n \"];\",\n inner,\n \"}\",\n outer.exit\n );\n function isInnerDefn(defn) {\n return defn.contextDep && contextDynamic || defn.propDep;\n }\n function isOuterDefn(defn) {\n return !isInnerDefn(defn);\n }\n if (args.needsContext) {\n emitContext(env, inner, args.context);\n }\n if (args.needsFramebuffer) {\n emitPollFramebuffer(env, inner, args.framebuffer);\n }\n emitSetOptions(env, inner, args.state, isInnerDefn);\n if (args.profile && isInnerDefn(args.profile)) {\n emitProfile(env, inner, args, false, true);\n }\n if (!program) {\n var progCache = env.global.def(\"{}\");\n var PROGRAM = args.shader.progVar.append(env, inner);\n var PROG_ID = inner.def(PROGRAM, \".id\");\n var CACHED_PROC = inner.def(progCache, \"[\", PROG_ID, \"]\");\n inner(\n env.shared.gl,\n \".useProgram(\",\n PROGRAM,\n \".program);\",\n \"if(!\",\n CACHED_PROC,\n \"){\",\n CACHED_PROC,\n \"=\",\n progCache,\n \"[\",\n PROG_ID,\n \"]=\",\n env.link(function(program2) {\n return createBody(\n emitBatchDynamicShaderBody,\n env,\n args,\n program2,\n 2\n );\n }),\n \"(\",\n PROGRAM,\n \");}\",\n CACHED_PROC,\n \".call(this,a0[\",\n BATCH_ID,\n \"],\",\n BATCH_ID,\n \");\"\n );\n } else {\n if (args.useVAO) {\n if (args.drawVAO) {\n if (isInnerDefn(args.drawVAO)) {\n inner(env.shared.vao, \".setVAO(\", args.drawVAO.append(env, inner), \");\");\n } else {\n outer(env.shared.vao, \".setVAO(\", args.drawVAO.append(env, outer), \");\");\n }\n } else {\n outer(env.shared.vao, \".setVAO(\", env.shared.vao, \".targetVAO);\");\n }\n } else {\n outer(env.shared.vao, \".setVAO(null);\");\n emitAttributes(env, outer, args, program.attributes, isOuterDefn);\n emitAttributes(env, inner, args, program.attributes, isInnerDefn);\n }\n emitUniforms(env, outer, args, program.uniforms, isOuterDefn, false);\n emitUniforms(env, inner, args, program.uniforms, isInnerDefn, true);\n emitDraw(env, outer, inner, args);\n }\n }\n function emitBatchProc(env, args) {\n var batch = env.proc(\"batch\", 2);\n env.batchId = \"0\";\n injectExtensions(env, batch);\n var contextDynamic = false;\n var needsContext = true;\n Object.keys(args.context).forEach(function(name2) {\n contextDynamic = contextDynamic || args.context[name2].propDep;\n });\n if (!contextDynamic) {\n emitContext(env, batch, args.context);\n needsContext = false;\n }\n var framebuffer = args.framebuffer;\n var needsFramebuffer = false;\n if (framebuffer) {\n if (framebuffer.propDep) {\n contextDynamic = needsFramebuffer = true;\n } else if (framebuffer.contextDep && contextDynamic) {\n needsFramebuffer = true;\n }\n if (!needsFramebuffer) {\n emitPollFramebuffer(env, batch, framebuffer);\n }\n } else {\n emitPollFramebuffer(env, batch, null);\n }\n if (args.state.viewport && args.state.viewport.propDep) {\n contextDynamic = true;\n }\n function isInnerDefn(defn) {\n return defn.contextDep && contextDynamic || defn.propDep;\n }\n emitPollState(env, batch, args);\n emitSetOptions(env, batch, args.state, function(defn) {\n return !isInnerDefn(defn);\n });\n if (!args.profile || !isInnerDefn(args.profile)) {\n emitProfile(env, batch, args, false, \"a1\");\n }\n args.contextDep = contextDynamic;\n args.needsContext = needsContext;\n args.needsFramebuffer = needsFramebuffer;\n var progDefn = args.shader.progVar;\n if (progDefn.contextDep && contextDynamic || progDefn.propDep) {\n emitBatchBody(\n env,\n batch,\n args,\n null\n );\n } else {\n var PROGRAM = progDefn.append(env, batch);\n batch(env.shared.gl, \".useProgram(\", PROGRAM, \".program);\");\n if (args.shader.program) {\n emitBatchBody(\n env,\n batch,\n args,\n args.shader.program\n );\n } else {\n batch(env.shared.vao, \".setVAO(null);\");\n var batchCache = env.global.def(\"{}\");\n var PROG_ID = batch.def(PROGRAM, \".id\");\n var CACHED_PROC = batch.def(batchCache, \"[\", PROG_ID, \"]\");\n batch(\n env.cond(CACHED_PROC).then(CACHED_PROC, \".call(this,a0,a1);\").else(\n CACHED_PROC,\n \"=\",\n batchCache,\n \"[\",\n PROG_ID,\n \"]=\",\n env.link(function(program) {\n return createBody(emitBatchBody, env, args, program, 2);\n }),\n \"(\",\n PROGRAM,\n \");\",\n CACHED_PROC,\n \".call(this,a0,a1);\"\n )\n );\n }\n }\n if (Object.keys(args.state).length > 0) {\n batch(env.shared.current, \".dirty=true;\");\n }\n if (env.shared.vao) {\n batch(env.shared.vao, \".setVAO(null);\");\n }\n }\n function emitScopeProc(env, args) {\n var scope = env.proc(\"scope\", 3);\n env.batchId = \"a2\";\n var shared = env.shared;\n var CURRENT_STATE = shared.current;\n emitContext(env, scope, args.context);\n if (args.framebuffer) {\n args.framebuffer.append(env, scope);\n }\n sortState(Object.keys(args.state)).forEach(function(name2) {\n var defn = args.state[name2];\n var value = defn.append(env, scope);\n if (isArrayLike(value)) {\n value.forEach(function(v, i) {\n if (hasVariableReference(v)) {\n scope.set(env.next[name2], \"[\" + i + \"]\", v);\n } else {\n scope.set(env.next[name2], \"[\" + i + \"]\", env.link(v, { stable: true }));\n }\n });\n } else {\n if (isStatic(defn)) {\n scope.set(shared.next, \".\" + name2, env.link(value, { stable: true }));\n } else {\n scope.set(shared.next, \".\" + name2, value);\n }\n }\n });\n emitProfile(env, scope, args, true, true);\n [S_ELEMENTS, S_OFFSET, S_COUNT, S_INSTANCES, S_PRIMITIVE].forEach(\n function(opt) {\n var variable = args.draw[opt];\n if (!variable) {\n return;\n }\n var VARIABLE2 = variable.append(env, scope);\n if (hasVariableReference(VARIABLE2)) {\n scope.set(shared.draw, \".\" + opt, VARIABLE2);\n } else {\n scope.set(shared.draw, \".\" + opt, env.link(VARIABLE2), { stable: true });\n }\n }\n );\n Object.keys(args.uniforms).forEach(function(opt) {\n var value = args.uniforms[opt].append(env, scope);\n if (Array.isArray(value)) {\n value = \"[\" + value.map(function(v) {\n if (hasVariableReference(v)) {\n return v;\n } else {\n return env.link(v, { stable: true });\n }\n }) + \"]\";\n }\n scope.set(\n shared.uniforms,\n \"[\" + env.link(stringStore.id(opt), { stable: true }) + \"]\",\n value\n );\n });\n Object.keys(args.attributes).forEach(function(name2) {\n var record = args.attributes[name2].append(env, scope);\n var scopeAttrib = env.scopeAttrib(name2);\n Object.keys(new AttributeRecord2()).forEach(function(prop) {\n scope.set(scopeAttrib, \".\" + prop, record[prop]);\n });\n });\n if (args.scopeVAO) {\n var VARIABLE = args.scopeVAO.append(env, scope);\n if (hasVariableReference(VARIABLE)) {\n scope.set(shared.vao, \".targetVAO\", VARIABLE);\n } else {\n scope.set(shared.vao, \".targetVAO\", env.link(VARIABLE, { stable: true }));\n }\n }\n function saveShader(name2) {\n var shader = args.shader[name2];\n if (shader) {\n var VARIABLE2 = shader.append(env, scope);\n if (hasVariableReference(VARIABLE2)) {\n scope.set(shared.shader, \".\" + name2, VARIABLE2);\n } else {\n scope.set(shared.shader, \".\" + name2, env.link(VARIABLE2, { stable: true }));\n }\n }\n }\n saveShader(S_VERT);\n saveShader(S_FRAG);\n if (Object.keys(args.state).length > 0) {\n scope(CURRENT_STATE, \".dirty=true;\");\n scope.exit(CURRENT_STATE, \".dirty=true;\");\n }\n scope(\"a1(\", env.shared.context, \",a0,\", env.batchId, \");\");\n }\n function isDynamicObject(object) {\n if (typeof object !== \"object\" || isArrayLike(object)) {\n return;\n }\n var props = Object.keys(object);\n for (var i = 0; i < props.length; ++i) {\n if (dynamic.isDynamic(object[props[i]])) {\n return true;\n }\n }\n return false;\n }\n function splatObject(env, options, name2) {\n var object = options.static[name2];\n if (!object || !isDynamicObject(object)) {\n return;\n }\n var globals = env.global;\n var keys = Object.keys(object);\n var thisDep = false;\n var contextDep = false;\n var propDep = false;\n var objectRef = env.global.def(\"{}\");\n keys.forEach(function(key) {\n var value = object[key];\n if (dynamic.isDynamic(value)) {\n if (typeof value === \"function\") {\n value = object[key] = dynamic.unbox(value);\n }\n var deps = createDynamicDecl(value, null);\n thisDep = thisDep || deps.thisDep;\n propDep = propDep || deps.propDep;\n contextDep = contextDep || deps.contextDep;\n } else {\n globals(objectRef, \".\", key, \"=\");\n switch (typeof value) {\n case \"number\":\n globals(value);\n break;\n case \"string\":\n globals('\"', value, '\"');\n break;\n case \"object\":\n if (Array.isArray(value)) {\n globals(\"[\", value.join(), \"]\");\n }\n break;\n default:\n globals(env.link(value));\n break;\n }\n globals(\";\");\n }\n });\n function appendBlock(env2, block) {\n keys.forEach(function(key) {\n var value = object[key];\n if (!dynamic.isDynamic(value)) {\n return;\n }\n var ref = env2.invoke(block, value);\n block(objectRef, \".\", key, \"=\", ref, \";\");\n });\n }\n options.dynamic[name2] = new dynamic.DynamicVariable(DYN_THUNK, {\n thisDep,\n contextDep,\n propDep,\n ref: objectRef,\n append: appendBlock\n });\n delete options.static[name2];\n }\n function compileCommand(options, attributes, uniforms, context, stats2) {\n var env = createREGLEnvironment();\n env.stats = env.link(stats2);\n Object.keys(attributes.static).forEach(function(key) {\n splatObject(env, attributes, key);\n });\n NESTED_OPTIONS.forEach(function(name2) {\n splatObject(env, options, name2);\n });\n var args = parseArguments(options, attributes, uniforms, context, env);\n if (args.shader.program) {\n args.shader.program.attributes.sort(function(a, b) {\n return a.name < b.name ? -1 : 1;\n });\n args.shader.program.uniforms.sort(function(a, b) {\n return a.name < b.name ? -1 : 1;\n });\n }\n emitDrawProc(env, args);\n emitScopeProc(env, args);\n emitBatchProc(env, args);\n return extend2(env.compile(), {\n destroy: function() {\n args.shader.program.destroy();\n }\n });\n }\n return {\n next: nextState,\n current: currentState,\n procs: function() {\n var env = createREGLEnvironment();\n var poll = env.proc(\"poll\");\n var refresh = env.proc(\"refresh\");\n var common = env.block();\n poll(common);\n refresh(common);\n var shared = env.shared;\n var GL = shared.gl;\n var NEXT_STATE = shared.next;\n var CURRENT_STATE = shared.current;\n common(CURRENT_STATE, \".dirty=false;\");\n emitPollFramebuffer(env, poll);\n emitPollFramebuffer(env, refresh, null, true);\n var INSTANCING;\n if (extInstancing) {\n INSTANCING = env.link(extInstancing);\n }\n if (extensions.oes_vertex_array_object) {\n refresh(env.link(extensions.oes_vertex_array_object), \".bindVertexArrayOES(null);\");\n }\n var BINDING = refresh.def(shared.attributes);\n var TEMP_BINDING = refresh.def(0);\n var ifte = env.cond(TEMP_BINDING, \".buffer\");\n ifte.then(\n GL,\n \".enableVertexAttribArray(i);\",\n GL,\n \".bindBuffer(\",\n GL_ARRAY_BUFFER$2,\n \",\",\n TEMP_BINDING,\n \".buffer.buffer);\",\n GL,\n \".vertexAttribPointer(i,\",\n TEMP_BINDING,\n \".size,\",\n TEMP_BINDING,\n \".type,\",\n TEMP_BINDING,\n \".normalized,\",\n TEMP_BINDING,\n \".stride,\",\n TEMP_BINDING,\n \".offset);\"\n ).else(\n GL,\n \".disableVertexAttribArray(i);\",\n GL,\n \".vertexAttrib4f(i,\",\n TEMP_BINDING,\n \".x,\",\n TEMP_BINDING,\n \".y,\",\n TEMP_BINDING,\n \".z,\",\n TEMP_BINDING,\n \".w);\",\n TEMP_BINDING,\n \".buffer=null;\"\n );\n var MAX_ATTRIBUTES = env.link(limits.maxAttributes, { stable: true });\n refresh(\n \"for(var i=0;i<\",\n MAX_ATTRIBUTES,\n \";++i){\",\n TEMP_BINDING,\n \"=\",\n BINDING,\n \"[i];\",\n ifte,\n \"}\"\n );\n if (extInstancing) {\n refresh(\n \"for(var i=0;i<\",\n MAX_ATTRIBUTES,\n \";++i){\",\n INSTANCING,\n \".vertexAttribDivisorANGLE(i,\",\n BINDING,\n \"[i].divisor);\",\n \"}\"\n );\n }\n refresh(\n env.shared.vao,\n \".currentVAO=null;\",\n env.shared.vao,\n \".setVAO(\",\n env.shared.vao,\n \".targetVAO);\"\n );\n Object.keys(GL_FLAGS).forEach(function(flag) {\n var cap = GL_FLAGS[flag];\n var NEXT = common.def(NEXT_STATE, \".\", flag);\n var block = env.block();\n block(\n \"if(\",\n NEXT,\n \"){\",\n GL,\n \".enable(\",\n cap,\n \")}else{\",\n GL,\n \".disable(\",\n cap,\n \")}\",\n CURRENT_STATE,\n \".\",\n flag,\n \"=\",\n NEXT,\n \";\"\n );\n refresh(block);\n poll(\n \"if(\",\n NEXT,\n \"!==\",\n CURRENT_STATE,\n \".\",\n flag,\n \"){\",\n block,\n \"}\"\n );\n });\n Object.keys(GL_VARIABLES).forEach(function(name2) {\n var func = GL_VARIABLES[name2];\n var init = currentState[name2];\n var NEXT, CURRENT;\n var block = env.block();\n block(GL, \".\", func, \"(\");\n if (isArrayLike(init)) {\n var n = init.length;\n NEXT = env.global.def(NEXT_STATE, \".\", name2);\n CURRENT = env.global.def(CURRENT_STATE, \".\", name2);\n block(\n loop(n, function(i) {\n return NEXT + \"[\" + i + \"]\";\n }),\n \");\",\n loop(n, function(i) {\n return CURRENT + \"[\" + i + \"]=\" + NEXT + \"[\" + i + \"];\";\n }).join(\"\")\n );\n poll(\n \"if(\",\n loop(n, function(i) {\n return NEXT + \"[\" + i + \"]!==\" + CURRENT + \"[\" + i + \"]\";\n }).join(\"||\"),\n \"){\",\n block,\n \"}\"\n );\n } else {\n NEXT = common.def(NEXT_STATE, \".\", name2);\n CURRENT = common.def(CURRENT_STATE, \".\", name2);\n block(\n NEXT,\n \");\",\n CURRENT_STATE,\n \".\",\n name2,\n \"=\",\n NEXT,\n \";\"\n );\n poll(\n \"if(\",\n NEXT,\n \"!==\",\n CURRENT,\n \"){\",\n block,\n \"}\"\n );\n }\n refresh(block);\n });\n return env.compile();\n }(),\n compile: compileCommand\n };\n }\n function stats() {\n return {\n vaoCount: 0,\n bufferCount: 0,\n elementsCount: 0,\n framebufferCount: 0,\n shaderCount: 0,\n textureCount: 0,\n cubeCount: 0,\n renderbufferCount: 0,\n maxTextureUnits: 0\n };\n }\n var GL_QUERY_RESULT_EXT = 34918;\n var GL_QUERY_RESULT_AVAILABLE_EXT = 34919;\n var GL_TIME_ELAPSED_EXT = 35007;\n var createTimer = function(gl2, extensions) {\n if (!extensions.ext_disjoint_timer_query) {\n return null;\n }\n var queryPool = [];\n function allocQuery() {\n return queryPool.pop() || extensions.ext_disjoint_timer_query.createQueryEXT();\n }\n function freeQuery(query) {\n queryPool.push(query);\n }\n var pendingQueries = [];\n function beginQuery(stats2) {\n var query = allocQuery();\n extensions.ext_disjoint_timer_query.beginQueryEXT(GL_TIME_ELAPSED_EXT, query);\n pendingQueries.push(query);\n pushScopeStats(pendingQueries.length - 1, pendingQueries.length, stats2);\n }\n function endQuery() {\n extensions.ext_disjoint_timer_query.endQueryEXT(GL_TIME_ELAPSED_EXT);\n }\n function PendingStats() {\n this.startQueryIndex = -1;\n this.endQueryIndex = -1;\n this.sum = 0;\n this.stats = null;\n }\n var pendingStatsPool = [];\n function allocPendingStats() {\n return pendingStatsPool.pop() || new PendingStats();\n }\n function freePendingStats(pendingStats2) {\n pendingStatsPool.push(pendingStats2);\n }\n var pendingStats = [];\n function pushScopeStats(start, end, stats2) {\n var ps = allocPendingStats();\n ps.startQueryIndex = start;\n ps.endQueryIndex = end;\n ps.sum = 0;\n ps.stats = stats2;\n pendingStats.push(ps);\n }\n var timeSum = [];\n var queryPtr = [];\n function update() {\n var ptr, i;\n var n = pendingQueries.length;\n if (n === 0) {\n return;\n }\n queryPtr.length = Math.max(queryPtr.length, n + 1);\n timeSum.length = Math.max(timeSum.length, n + 1);\n timeSum[0] = 0;\n queryPtr[0] = 0;\n var queryTime = 0;\n ptr = 0;\n for (i = 0; i < pendingQueries.length; ++i) {\n var query = pendingQueries[i];\n if (extensions.ext_disjoint_timer_query.getQueryObjectEXT(query, GL_QUERY_RESULT_AVAILABLE_EXT)) {\n queryTime += extensions.ext_disjoint_timer_query.getQueryObjectEXT(query, GL_QUERY_RESULT_EXT);\n freeQuery(query);\n } else {\n pendingQueries[ptr++] = query;\n }\n timeSum[i + 1] = queryTime;\n queryPtr[i + 1] = ptr;\n }\n pendingQueries.length = ptr;\n ptr = 0;\n for (i = 0; i < pendingStats.length; ++i) {\n var stats2 = pendingStats[i];\n var start = stats2.startQueryIndex;\n var end = stats2.endQueryIndex;\n stats2.sum += timeSum[end] - timeSum[start];\n var startPtr = queryPtr[start];\n var endPtr = queryPtr[end];\n if (endPtr === startPtr) {\n stats2.stats.gpuTime += stats2.sum / 1e6;\n freePendingStats(stats2);\n } else {\n stats2.startQueryIndex = startPtr;\n stats2.endQueryIndex = endPtr;\n pendingStats[ptr++] = stats2;\n }\n }\n pendingStats.length = ptr;\n }\n return {\n beginQuery,\n endQuery,\n pushScopeStats,\n update,\n getNumPendingQueries: function() {\n return pendingQueries.length;\n },\n clear: function() {\n queryPool.push.apply(queryPool, pendingQueries);\n for (var i = 0; i < queryPool.length; i++) {\n extensions.ext_disjoint_timer_query.deleteQueryEXT(queryPool[i]);\n }\n pendingQueries.length = 0;\n queryPool.length = 0;\n },\n restore: function() {\n pendingQueries.length = 0;\n queryPool.length = 0;\n }\n };\n };\n var GL_COLOR_BUFFER_BIT = 16384;\n var GL_DEPTH_BUFFER_BIT = 256;\n var GL_STENCIL_BUFFER_BIT = 1024;\n var GL_ARRAY_BUFFER = 34962;\n var CONTEXT_LOST_EVENT = \"webglcontextlost\";\n var CONTEXT_RESTORED_EVENT = \"webglcontextrestored\";\n var DYN_PROP = 1;\n var DYN_CONTEXT = 2;\n var DYN_STATE = 3;\n function find(haystack, needle) {\n for (var i = 0; i < haystack.length; ++i) {\n if (haystack[i] === needle) {\n return i;\n }\n }\n return -1;\n }\n function wrapREGL(args) {\n var config = parseArgs(args);\n if (!config) {\n return null;\n }\n var gl2 = config.gl;\n var glAttributes = gl2.getContextAttributes();\n var contextLost = gl2.isContextLost();\n var extensionState = createExtensionCache(gl2, config);\n if (!extensionState) {\n return null;\n }\n var stringStore = createStringStore();\n var stats$$1 = stats();\n var cachedCode = config.cachedCode || {};\n var extensions = extensionState.extensions;\n var timer = createTimer(gl2, extensions);\n var START_TIME = clock();\n var WIDTH = gl2.drawingBufferWidth;\n var HEIGHT = gl2.drawingBufferHeight;\n var contextState = {\n tick: 0,\n time: 0,\n viewportWidth: WIDTH,\n viewportHeight: HEIGHT,\n framebufferWidth: WIDTH,\n framebufferHeight: HEIGHT,\n drawingBufferWidth: WIDTH,\n drawingBufferHeight: HEIGHT,\n pixelRatio: config.pixelRatio\n };\n var uniformState = {};\n var drawState = {\n elements: null,\n primitive: 4,\n // GL_TRIANGLES\n count: -1,\n offset: 0,\n instances: -1\n };\n var limits = wrapLimits(gl2, extensions);\n var bufferState = wrapBufferState(\n gl2,\n stats$$1,\n config,\n destroyBuffer\n );\n var elementState = wrapElementsState(gl2, extensions, bufferState, stats$$1);\n var attributeState = wrapAttributeState(\n gl2,\n extensions,\n limits,\n stats$$1,\n bufferState,\n elementState,\n drawState\n );\n function destroyBuffer(buffer) {\n return attributeState.destroyBuffer(buffer);\n }\n var shaderState = wrapShaderState(gl2, stringStore, stats$$1, config);\n var textureState = createTextureSet(\n gl2,\n extensions,\n limits,\n function() {\n core.procs.poll();\n },\n contextState,\n stats$$1,\n config\n );\n var renderbufferState = wrapRenderbuffers(gl2, extensions, limits, stats$$1, config);\n var framebufferState = wrapFBOState(\n gl2,\n extensions,\n limits,\n textureState,\n renderbufferState,\n stats$$1\n );\n var core = reglCore(\n gl2,\n stringStore,\n extensions,\n limits,\n bufferState,\n elementState,\n textureState,\n framebufferState,\n uniformState,\n attributeState,\n shaderState,\n drawState,\n contextState,\n timer,\n cachedCode,\n config\n );\n var readPixels = wrapReadPixels(\n gl2,\n framebufferState,\n core.procs.poll,\n contextState,\n glAttributes,\n extensions,\n limits\n );\n var nextState = core.next;\n var canvas = gl2.canvas;\n var rafCallbacks = [];\n var lossCallbacks = [];\n var restoreCallbacks = [];\n var destroyCallbacks = [config.onDestroy];\n var activeRAF = null;\n function handleRAF() {\n if (rafCallbacks.length === 0) {\n if (timer) {\n timer.update();\n }\n activeRAF = null;\n return;\n }\n activeRAF = raf.next(handleRAF);\n poll();\n for (var i = rafCallbacks.length - 1; i >= 0; --i) {\n var cb = rafCallbacks[i];\n if (cb) {\n cb(contextState, null, 0);\n }\n }\n gl2.flush();\n if (timer) {\n timer.update();\n }\n }\n function startRAF() {\n if (!activeRAF && rafCallbacks.length > 0) {\n activeRAF = raf.next(handleRAF);\n }\n }\n function stopRAF() {\n if (activeRAF) {\n raf.cancel(handleRAF);\n activeRAF = null;\n }\n }\n function handleContextLoss(event) {\n event.preventDefault();\n contextLost = true;\n stopRAF();\n lossCallbacks.forEach(function(cb) {\n cb();\n });\n }\n function handleContextRestored(event) {\n gl2.getError();\n contextLost = false;\n extensionState.restore();\n shaderState.restore();\n bufferState.restore();\n textureState.restore();\n renderbufferState.restore();\n framebufferState.restore();\n attributeState.restore();\n if (timer) {\n timer.restore();\n }\n core.procs.refresh();\n startRAF();\n restoreCallbacks.forEach(function(cb) {\n cb();\n });\n }\n if (canvas) {\n canvas.addEventListener(CONTEXT_LOST_EVENT, handleContextLoss, false);\n canvas.addEventListener(CONTEXT_RESTORED_EVENT, handleContextRestored, false);\n }\n function destroy() {\n rafCallbacks.length = 0;\n stopRAF();\n if (canvas) {\n canvas.removeEventListener(CONTEXT_LOST_EVENT, handleContextLoss);\n canvas.removeEventListener(CONTEXT_RESTORED_EVENT, handleContextRestored);\n }\n shaderState.clear();\n framebufferState.clear();\n renderbufferState.clear();\n attributeState.clear();\n textureState.clear();\n elementState.clear();\n bufferState.clear();\n if (timer) {\n timer.clear();\n }\n destroyCallbacks.forEach(function(cb) {\n cb();\n });\n }\n function compileProcedure(options) {\n function flattenNestedOptions(options2) {\n var result = extend2({}, options2);\n delete result.uniforms;\n delete result.attributes;\n delete result.context;\n delete result.vao;\n if (\"stencil\" in result && result.stencil.op) {\n result.stencil.opBack = result.stencil.opFront = result.stencil.op;\n delete result.stencil.op;\n }\n function merge(name2) {\n if (name2 in result) {\n var child = result[name2];\n delete result[name2];\n Object.keys(child).forEach(function(prop) {\n result[name2 + \".\" + prop] = child[prop];\n });\n }\n }\n merge(\"blend\");\n merge(\"depth\");\n merge(\"cull\");\n merge(\"stencil\");\n merge(\"polygonOffset\");\n merge(\"scissor\");\n merge(\"sample\");\n if (\"vao\" in options2) {\n result.vao = options2.vao;\n }\n return result;\n }\n function separateDynamic(object, useArrays) {\n var staticItems = {};\n var dynamicItems = {};\n Object.keys(object).forEach(function(option) {\n var value = object[option];\n if (dynamic.isDynamic(value)) {\n dynamicItems[option] = dynamic.unbox(value, option);\n return;\n } else if (useArrays && Array.isArray(value)) {\n for (var i = 0; i < value.length; ++i) {\n if (dynamic.isDynamic(value[i])) {\n dynamicItems[option] = dynamic.unbox(value, option);\n return;\n }\n }\n }\n staticItems[option] = value;\n });\n return {\n dynamic: dynamicItems,\n static: staticItems\n };\n }\n var context = separateDynamic(options.context || {}, true);\n var uniforms = separateDynamic(options.uniforms || {}, true);\n var attributes = separateDynamic(options.attributes || {}, false);\n var opts = separateDynamic(flattenNestedOptions(options), false);\n var stats$$12 = {\n gpuTime: 0,\n cpuTime: 0,\n count: 0\n };\n var compiled = core.compile(opts, attributes, uniforms, context, stats$$12);\n var draw = compiled.draw;\n var batch = compiled.batch;\n var scope = compiled.scope;\n var EMPTY_ARRAY = [];\n function reserve(count) {\n while (EMPTY_ARRAY.length < count) {\n EMPTY_ARRAY.push(null);\n }\n return EMPTY_ARRAY;\n }\n function REGLCommand(args2, body) {\n var i;\n if (contextLost) {\n }\n if (typeof args2 === \"function\") {\n return scope.call(this, null, args2, 0);\n } else if (typeof body === \"function\") {\n if (typeof args2 === \"number\") {\n for (i = 0; i < args2; ++i) {\n scope.call(this, null, body, i);\n }\n } else if (Array.isArray(args2)) {\n for (i = 0; i < args2.length; ++i) {\n scope.call(this, args2[i], body, i);\n }\n } else {\n return scope.call(this, args2, body, 0);\n }\n } else if (typeof args2 === \"number\") {\n if (args2 > 0) {\n return batch.call(this, reserve(args2 | 0), args2 | 0);\n }\n } else if (Array.isArray(args2)) {\n if (args2.length) {\n return batch.call(this, args2, args2.length);\n }\n } else {\n return draw.call(this, args2);\n }\n }\n return extend2(REGLCommand, {\n stats: stats$$12,\n destroy: function() {\n compiled.destroy();\n }\n });\n }\n var setFBO = framebufferState.setFBO = compileProcedure({\n framebuffer: dynamic.define.call(null, DYN_PROP, \"framebuffer\")\n });\n function clearImpl(_, options) {\n var clearFlags = 0;\n core.procs.poll();\n var c = options.color;\n if (c) {\n gl2.clearColor(+c[0] || 0, +c[1] || 0, +c[2] || 0, +c[3] || 0);\n clearFlags |= GL_COLOR_BUFFER_BIT;\n }\n if (\"depth\" in options) {\n gl2.clearDepth(+options.depth);\n clearFlags |= GL_DEPTH_BUFFER_BIT;\n }\n if (\"stencil\" in options) {\n gl2.clearStencil(options.stencil | 0);\n clearFlags |= GL_STENCIL_BUFFER_BIT;\n }\n gl2.clear(clearFlags);\n }\n function clear(options) {\n if (\"framebuffer\" in options) {\n if (options.framebuffer && options.framebuffer_reglType === \"framebufferCube\") {\n for (var i = 0; i < 6; ++i) {\n setFBO(extend2({\n framebuffer: options.framebuffer.faces[i]\n }, options), clearImpl);\n }\n } else {\n setFBO(options, clearImpl);\n }\n } else {\n clearImpl(null, options);\n }\n }\n function frame(cb) {\n rafCallbacks.push(cb);\n function cancel() {\n var i = find(rafCallbacks, cb);\n function pendingCancel() {\n var index = find(rafCallbacks, pendingCancel);\n rafCallbacks[index] = rafCallbacks[rafCallbacks.length - 1];\n rafCallbacks.length -= 1;\n if (rafCallbacks.length <= 0) {\n stopRAF();\n }\n }\n rafCallbacks[i] = pendingCancel;\n }\n startRAF();\n return {\n cancel\n };\n }\n function pollViewport() {\n var viewport = nextState.viewport;\n var scissorBox = nextState.scissor_box;\n viewport[0] = viewport[1] = scissorBox[0] = scissorBox[1] = 0;\n contextState.viewportWidth = contextState.framebufferWidth = contextState.drawingBufferWidth = viewport[2] = scissorBox[2] = gl2.drawingBufferWidth;\n contextState.viewportHeight = contextState.framebufferHeight = contextState.drawingBufferHeight = viewport[3] = scissorBox[3] = gl2.drawingBufferHeight;\n }\n function poll() {\n contextState.tick += 1;\n contextState.time = now();\n pollViewport();\n core.procs.poll();\n }\n function refresh() {\n textureState.refresh();\n pollViewport();\n core.procs.refresh();\n if (timer) {\n timer.update();\n }\n }\n function now() {\n return (clock() - START_TIME) / 1e3;\n }\n refresh();\n function addListener(event, callback) {\n var callbacks;\n switch (event) {\n case \"frame\":\n return frame(callback);\n case \"lost\":\n callbacks = lossCallbacks;\n break;\n case \"restore\":\n callbacks = restoreCallbacks;\n break;\n case \"destroy\":\n callbacks = destroyCallbacks;\n break;\n default:\n }\n callbacks.push(callback);\n return {\n cancel: function() {\n for (var i = 0; i < callbacks.length; ++i) {\n if (callbacks[i] === callback) {\n callbacks[i] = callbacks[callbacks.length - 1];\n callbacks.pop();\n return;\n }\n }\n }\n };\n }\n function getCachedCode() {\n return cachedCode;\n }\n function preloadCachedCode(moreCache) {\n Object.entries(moreCache).forEach(function(kv) {\n cachedCode[kv[0]] = kv[1];\n });\n }\n var regl = extend2(compileProcedure, {\n // Clear current FBO\n clear,\n // Short cuts for dynamic variables\n prop: dynamic.define.bind(null, DYN_PROP),\n context: dynamic.define.bind(null, DYN_CONTEXT),\n this: dynamic.define.bind(null, DYN_STATE),\n // executes an empty draw command\n draw: compileProcedure({}),\n // Resources\n buffer: function(options) {\n return bufferState.create(options, GL_ARRAY_BUFFER, false, false);\n },\n elements: function(options) {\n return elementState.create(options, false);\n },\n texture: textureState.create2D,\n cube: textureState.createCube,\n renderbuffer: renderbufferState.create,\n framebuffer: framebufferState.create,\n framebufferCube: framebufferState.createCube,\n vao: attributeState.createVAO,\n // Expose context attributes\n attributes: glAttributes,\n // Frame rendering\n frame,\n on: addListener,\n // System limits\n limits,\n hasExtension: function(name2) {\n return limits.extensions.indexOf(name2.toLowerCase()) >= 0;\n },\n // Read pixels\n read: readPixels,\n // Destroy regl and all associated resources\n destroy,\n // Direct GL state manipulation\n _gl: gl2,\n _refresh: refresh,\n poll: function() {\n poll();\n if (timer) {\n timer.update();\n }\n },\n // Current time\n now,\n // regl Statistics Information\n stats: stats$$1,\n // cache generated code\n getCachedCode,\n preloadCachedCode\n });\n config.onDone(null, regl);\n return regl;\n }\n return wrapREGL;\n });\n }\n });\n\n // node_modules/gl-util/context.js\n var require_context = __commonJS({\n \"node_modules/gl-util/context.js\"(exports, module) {\n \"use strict\";\n var pick = require_pick_by_alias();\n module.exports = function setContext(o) {\n if (!o) o = {};\n else if (typeof o === \"string\") o = { container: o };\n if (isCanvas(o)) {\n o = { container: o };\n } else if (isElement(o)) {\n o = { container: o };\n } else if (isContext(o)) {\n o = { gl: o };\n } else {\n o = pick(o, {\n container: \"container target element el canvas holder parent parentNode wrapper use ref root node\",\n gl: \"gl context webgl glContext\",\n attrs: \"attributes attrs contextAttributes\",\n pixelRatio: \"pixelRatio pxRatio px ratio pxratio pixelratio\",\n width: \"w width\",\n height: \"h height\"\n }, true);\n }\n if (!o.pixelRatio) o.pixelRatio = window.pixelRatio || 1;\n if (o.gl) {\n return o.gl;\n }\n if (o.canvas) {\n o.container = o.canvas.parentNode;\n }\n if (o.container) {\n if (typeof o.container === \"string\") {\n var c = document.querySelector(o.container);\n if (!c) throw Error(\"Element \" + o.container + \" is not found\");\n o.container = c;\n }\n if (isCanvas(o.container)) {\n o.canvas = o.container;\n o.container = o.canvas.parentNode;\n } else if (!o.canvas) {\n o.canvas = createCanvas();\n o.container.appendChild(o.canvas);\n resize(o);\n }\n } else if (!o.canvas) {\n if (typeof document !== \"undefined\") {\n o.container = document.body || document.documentElement;\n o.canvas = createCanvas();\n o.container.appendChild(o.canvas);\n resize(o);\n } else {\n throw Error(\"Not DOM environment. Use headless-gl.\");\n }\n }\n if (!o.gl) {\n [\"webgl\", \"experimental-webgl\", \"webgl-experimental\"].some(function(c2) {\n try {\n o.gl = o.canvas.getContext(c2, o.attrs);\n } catch (e) {\n }\n return o.gl;\n });\n }\n return o.gl;\n };\n function resize(o) {\n if (o.container) {\n if (o.container == document.body) {\n if (!document.body.style.width) o.canvas.width = o.width || o.pixelRatio * window.innerWidth;\n if (!document.body.style.height) o.canvas.height = o.height || o.pixelRatio * window.innerHeight;\n } else {\n var bounds = o.container.getBoundingClientRect();\n o.canvas.width = o.width || bounds.right - bounds.left;\n o.canvas.height = o.height || bounds.bottom - bounds.top;\n }\n }\n }\n function isCanvas(e) {\n return typeof e.getContext === \"function\" && \"width\" in e && \"height\" in e;\n }\n function isElement(e) {\n return typeof e.nodeName === \"string\" && typeof e.appendChild === \"function\" && typeof e.getBoundingClientRect === \"function\";\n }\n function isContext(e) {\n return typeof e.drawArrays === \"function\" || typeof e.drawElements === \"function\";\n }\n function createCanvas() {\n var canvas = document.createElement(\"canvas\");\n canvas.style.position = \"absolute\";\n canvas.style.top = 0;\n canvas.style.left = 0;\n return canvas;\n }\n }\n });\n\n // node_modules/font-atlas/index.js\n var require_font_atlas = __commonJS({\n \"node_modules/font-atlas/index.js\"(exports, module) {\n \"use strict\";\n var stringifyFont = require_stringify();\n var defaultChars = [32, 126];\n module.exports = atlas;\n function atlas(options) {\n options = options || {};\n var shape = options.shape ? options.shape : options.canvas ? [options.canvas.width, options.canvas.height] : [512, 512];\n var canvas = options.canvas || document.createElement(\"canvas\");\n var font = options.font;\n var step = typeof options.step === \"number\" ? [options.step, options.step] : options.step || [32, 32];\n var chars = options.chars || defaultChars;\n if (font && typeof font !== \"string\") font = stringifyFont(font);\n if (!Array.isArray(chars)) {\n chars = String(chars).split(\"\");\n } else if (chars.length === 2 && typeof chars[0] === \"number\" && typeof chars[1] === \"number\") {\n var newchars = [];\n for (var i = chars[0], j = 0; i <= chars[1]; i++) {\n newchars[j++] = String.fromCharCode(i);\n }\n chars = newchars;\n }\n shape = shape.slice();\n canvas.width = shape[0];\n canvas.height = shape[1];\n var ctx = canvas.getContext(\"2d\");\n ctx.fillStyle = \"#000\";\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n ctx.font = font;\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.fillStyle = \"#fff\";\n var x = step[0] / 2;\n var y = step[1] / 2;\n for (var i = 0; i < chars.length; i++) {\n ctx.fillText(chars[i], x, y);\n if ((x += step[0]) > shape[0] - step[0] / 2) x = step[0] / 2, y += step[1];\n }\n return canvas;\n }\n }\n });\n\n // node_modules/bit-twiddle/twiddle.js\n var require_twiddle = __commonJS({\n \"node_modules/bit-twiddle/twiddle.js\"(exports) {\n \"use strict\";\n \"use restrict\";\n var INT_BITS = 32;\n exports.INT_BITS = INT_BITS;\n exports.INT_MAX = 2147483647;\n exports.INT_MIN = -1 << INT_BITS - 1;\n exports.sign = function(v) {\n return (v > 0) - (v < 0);\n };\n exports.abs = function(v) {\n var mask = v >> INT_BITS - 1;\n return (v ^ mask) - mask;\n };\n exports.min = function(x, y) {\n return y ^ (x ^ y) & -(x < y);\n };\n exports.max = function(x, y) {\n return x ^ (x ^ y) & -(x < y);\n };\n exports.isPow2 = function(v) {\n return !(v & v - 1) && !!v;\n };\n exports.log2 = function(v) {\n var r, shift;\n r = (v > 65535) << 4;\n v >>>= r;\n shift = (v > 255) << 3;\n v >>>= shift;\n r |= shift;\n shift = (v > 15) << 2;\n v >>>= shift;\n r |= shift;\n shift = (v > 3) << 1;\n v >>>= shift;\n r |= shift;\n return r | v >> 1;\n };\n exports.log10 = function(v) {\n return v >= 1e9 ? 9 : v >= 1e8 ? 8 : v >= 1e7 ? 7 : v >= 1e6 ? 6 : v >= 1e5 ? 5 : v >= 1e4 ? 4 : v >= 1e3 ? 3 : v >= 100 ? 2 : v >= 10 ? 1 : 0;\n };\n exports.popCount = function(v) {\n v = v - (v >>> 1 & 1431655765);\n v = (v & 858993459) + (v >>> 2 & 858993459);\n return (v + (v >>> 4) & 252645135) * 16843009 >>> 24;\n };\n function countTrailingZeros(v) {\n var c = 32;\n v &= -v;\n if (v) c--;\n if (v & 65535) c -= 16;\n if (v & 16711935) c -= 8;\n if (v & 252645135) c -= 4;\n if (v & 858993459) c -= 2;\n if (v & 1431655765) c -= 1;\n return c;\n }\n exports.countTrailingZeros = countTrailingZeros;\n exports.nextPow2 = function(v) {\n v += v === 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n return v + 1;\n };\n exports.prevPow2 = function(v) {\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n return v - (v >>> 1);\n };\n exports.parity = function(v) {\n v ^= v >>> 16;\n v ^= v >>> 8;\n v ^= v >>> 4;\n v &= 15;\n return 27030 >>> v & 1;\n };\n var REVERSE_TABLE = new Array(256);\n (function(tab) {\n for (var i = 0; i < 256; ++i) {\n var v = i, r = i, s = 7;\n for (v >>>= 1; v; v >>>= 1) {\n r <<= 1;\n r |= v & 1;\n --s;\n }\n tab[i] = r << s & 255;\n }\n })(REVERSE_TABLE);\n exports.reverse = function(v) {\n return REVERSE_TABLE[v & 255] << 24 | REVERSE_TABLE[v >>> 8 & 255] << 16 | REVERSE_TABLE[v >>> 16 & 255] << 8 | REVERSE_TABLE[v >>> 24 & 255];\n };\n exports.interleave2 = function(x, y) {\n x &= 65535;\n x = (x | x << 8) & 16711935;\n x = (x | x << 4) & 252645135;\n x = (x | x << 2) & 858993459;\n x = (x | x << 1) & 1431655765;\n y &= 65535;\n y = (y | y << 8) & 16711935;\n y = (y | y << 4) & 252645135;\n y = (y | y << 2) & 858993459;\n y = (y | y << 1) & 1431655765;\n return x | y << 1;\n };\n exports.deinterleave2 = function(v, n) {\n v = v >>> n & 1431655765;\n v = (v | v >>> 1) & 858993459;\n v = (v | v >>> 2) & 252645135;\n v = (v | v >>> 4) & 16711935;\n v = (v | v >>> 16) & 65535;\n return v << 16 >> 16;\n };\n exports.interleave3 = function(x, y, z) {\n x &= 1023;\n x = (x | x << 16) & 4278190335;\n x = (x | x << 8) & 251719695;\n x = (x | x << 4) & 3272356035;\n x = (x | x << 2) & 1227133513;\n y &= 1023;\n y = (y | y << 16) & 4278190335;\n y = (y | y << 8) & 251719695;\n y = (y | y << 4) & 3272356035;\n y = (y | y << 2) & 1227133513;\n x |= y << 1;\n z &= 1023;\n z = (z | z << 16) & 4278190335;\n z = (z | z << 8) & 251719695;\n z = (z | z << 4) & 3272356035;\n z = (z | z << 2) & 1227133513;\n return x | z << 2;\n };\n exports.deinterleave3 = function(v, n) {\n v = v >>> n & 1227133513;\n v = (v | v >>> 2) & 3272356035;\n v = (v | v >>> 4) & 251719695;\n v = (v | v >>> 8) & 4278190335;\n v = (v | v >>> 16) & 1023;\n return v << 22 >> 22;\n };\n exports.nextCombination = function(v) {\n var t = v | v - 1;\n return t + 1 | (~t & -~t) - 1 >>> countTrailingZeros(v) + 1;\n };\n }\n });\n\n // node_modules/dup/dup.js\n var require_dup = __commonJS({\n \"node_modules/dup/dup.js\"(exports, module) {\n \"use strict\";\n function dupe_array(count, value, i) {\n var c = count[i] | 0;\n if (c <= 0) {\n return [];\n }\n var result = new Array(c), j;\n if (i === count.length - 1) {\n for (j = 0; j < c; ++j) {\n result[j] = value;\n }\n } else {\n for (j = 0; j < c; ++j) {\n result[j] = dupe_array(count, value, i + 1);\n }\n }\n return result;\n }\n function dupe_number(count, value) {\n var result, i;\n result = new Array(count);\n for (i = 0; i < count; ++i) {\n result[i] = value;\n }\n return result;\n }\n function dupe(count, value) {\n if (typeof value === \"undefined\") {\n value = 0;\n }\n switch (typeof count) {\n case \"number\":\n if (count > 0) {\n return dupe_number(count | 0, value);\n }\n break;\n case \"object\":\n if (typeof count.length === \"number\") {\n return dupe_array(count, value, 0);\n }\n break;\n }\n return [];\n }\n module.exports = dupe;\n }\n });\n\n // node_modules/typedarray-pool/pool.js\n var require_pool = __commonJS({\n \"node_modules/typedarray-pool/pool.js\"(exports) {\n \"use strict\";\n var bits = require_twiddle();\n var dup = require_dup();\n var Buffer2 = require_buffer().Buffer;\n if (!window.__TYPEDARRAY_POOL) {\n window.__TYPEDARRAY_POOL = {\n UINT8: dup([32, 0]),\n UINT16: dup([32, 0]),\n UINT32: dup([32, 0]),\n BIGUINT64: dup([32, 0]),\n INT8: dup([32, 0]),\n INT16: dup([32, 0]),\n INT32: dup([32, 0]),\n BIGINT64: dup([32, 0]),\n FLOAT: dup([32, 0]),\n DOUBLE: dup([32, 0]),\n DATA: dup([32, 0]),\n UINT8C: dup([32, 0]),\n BUFFER: dup([32, 0])\n };\n }\n var hasUint8C = typeof Uint8ClampedArray !== \"undefined\";\n var hasBigUint64 = typeof BigUint64Array !== \"undefined\";\n var hasBigInt64 = typeof BigInt64Array !== \"undefined\";\n var POOL = window.__TYPEDARRAY_POOL;\n if (!POOL.UINT8C) {\n POOL.UINT8C = dup([32, 0]);\n }\n if (!POOL.BIGUINT64) {\n POOL.BIGUINT64 = dup([32, 0]);\n }\n if (!POOL.BIGINT64) {\n POOL.BIGINT64 = dup([32, 0]);\n }\n if (!POOL.BUFFER) {\n POOL.BUFFER = dup([32, 0]);\n }\n var DATA = POOL.DATA;\n var BUFFER = POOL.BUFFER;\n exports.free = function free(array) {\n if (Buffer2.isBuffer(array)) {\n BUFFER[bits.log2(array.length)].push(array);\n } else {\n if (Object.prototype.toString.call(array) !== \"[object ArrayBuffer]\") {\n array = array.buffer;\n }\n if (!array) {\n return;\n }\n var n = array.length || array.byteLength;\n var log_n = bits.log2(n) | 0;\n DATA[log_n].push(array);\n }\n };\n function freeArrayBuffer(buffer) {\n if (!buffer) {\n return;\n }\n var n = buffer.length || buffer.byteLength;\n var log_n = bits.log2(n);\n DATA[log_n].push(buffer);\n }\n function freeTypedArray(array) {\n freeArrayBuffer(array.buffer);\n }\n exports.freeUint8 = exports.freeUint16 = exports.freeUint32 = exports.freeBigUint64 = exports.freeInt8 = exports.freeInt16 = exports.freeInt32 = exports.freeBigInt64 = exports.freeFloat32 = exports.freeFloat = exports.freeFloat64 = exports.freeDouble = exports.freeUint8Clamped = exports.freeDataView = freeTypedArray;\n exports.freeArrayBuffer = freeArrayBuffer;\n exports.freeBuffer = function freeBuffer(array) {\n BUFFER[bits.log2(array.length)].push(array);\n };\n exports.malloc = function malloc(n, dtype) {\n if (dtype === void 0 || dtype === \"arraybuffer\") {\n return mallocArrayBuffer(n);\n } else {\n switch (dtype) {\n case \"uint8\":\n return mallocUint8(n);\n case \"uint16\":\n return mallocUint16(n);\n case \"uint32\":\n return mallocUint32(n);\n case \"int8\":\n return mallocInt8(n);\n case \"int16\":\n return mallocInt16(n);\n case \"int32\":\n return mallocInt32(n);\n case \"float\":\n case \"float32\":\n return mallocFloat(n);\n case \"double\":\n case \"float64\":\n return mallocDouble(n);\n case \"uint8_clamped\":\n return mallocUint8Clamped(n);\n case \"bigint64\":\n return mallocBigInt64(n);\n case \"biguint64\":\n return mallocBigUint64(n);\n case \"buffer\":\n return mallocBuffer(n);\n case \"data\":\n case \"dataview\":\n return mallocDataView(n);\n default:\n return null;\n }\n }\n return null;\n };\n function mallocArrayBuffer(n) {\n var n = bits.nextPow2(n);\n var log_n = bits.log2(n);\n var d = DATA[log_n];\n if (d.length > 0) {\n return d.pop();\n }\n return new ArrayBuffer(n);\n }\n exports.mallocArrayBuffer = mallocArrayBuffer;\n function mallocUint8(n) {\n return new Uint8Array(mallocArrayBuffer(n), 0, n);\n }\n exports.mallocUint8 = mallocUint8;\n function mallocUint16(n) {\n return new Uint16Array(mallocArrayBuffer(2 * n), 0, n);\n }\n exports.mallocUint16 = mallocUint16;\n function mallocUint32(n) {\n return new Uint32Array(mallocArrayBuffer(4 * n), 0, n);\n }\n exports.mallocUint32 = mallocUint32;\n function mallocInt8(n) {\n return new Int8Array(mallocArrayBuffer(n), 0, n);\n }\n exports.mallocInt8 = mallocInt8;\n function mallocInt16(n) {\n return new Int16Array(mallocArrayBuffer(2 * n), 0, n);\n }\n exports.mallocInt16 = mallocInt16;\n function mallocInt32(n) {\n return new Int32Array(mallocArrayBuffer(4 * n), 0, n);\n }\n exports.mallocInt32 = mallocInt32;\n function mallocFloat(n) {\n return new Float32Array(mallocArrayBuffer(4 * n), 0, n);\n }\n exports.mallocFloat32 = exports.mallocFloat = mallocFloat;\n function mallocDouble(n) {\n return new Float64Array(mallocArrayBuffer(8 * n), 0, n);\n }\n exports.mallocFloat64 = exports.mallocDouble = mallocDouble;\n function mallocUint8Clamped(n) {\n if (hasUint8C) {\n return new Uint8ClampedArray(mallocArrayBuffer(n), 0, n);\n } else {\n return mallocUint8(n);\n }\n }\n exports.mallocUint8Clamped = mallocUint8Clamped;\n function mallocBigUint64(n) {\n if (hasBigUint64) {\n return new BigUint64Array(mallocArrayBuffer(8 * n), 0, n);\n } else {\n return null;\n }\n }\n exports.mallocBigUint64 = mallocBigUint64;\n function mallocBigInt64(n) {\n if (hasBigInt64) {\n return new BigInt64Array(mallocArrayBuffer(8 * n), 0, n);\n } else {\n return null;\n }\n }\n exports.mallocBigInt64 = mallocBigInt64;\n function mallocDataView(n) {\n return new DataView(mallocArrayBuffer(n), 0, n);\n }\n exports.mallocDataView = mallocDataView;\n function mallocBuffer(n) {\n n = bits.nextPow2(n);\n var log_n = bits.log2(n);\n var cache = BUFFER[log_n];\n if (cache.length > 0) {\n return cache.pop();\n }\n return new Buffer2(n);\n }\n exports.mallocBuffer = mallocBuffer;\n exports.clearCache = function clearCache() {\n for (var i = 0; i < 32; ++i) {\n POOL.UINT8[i].length = 0;\n POOL.UINT16[i].length = 0;\n POOL.UINT32[i].length = 0;\n POOL.INT8[i].length = 0;\n POOL.INT16[i].length = 0;\n POOL.INT32[i].length = 0;\n POOL.FLOAT[i].length = 0;\n POOL.DOUBLE[i].length = 0;\n POOL.BIGUINT64[i].length = 0;\n POOL.BIGINT64[i].length = 0;\n POOL.UINT8C[i].length = 0;\n DATA[i].length = 0;\n BUFFER[i].length = 0;\n }\n };\n }\n });\n\n // node_modules/is-plain-obj/index.js\n var require_is_plain_obj = __commonJS({\n \"node_modules/is-plain-obj/index.js\"(exports, module) {\n \"use strict\";\n var toString = Object.prototype.toString;\n module.exports = function(x) {\n var prototype;\n return toString.call(x) === \"[object Object]\" && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({}));\n };\n }\n });\n\n // node_modules/parse-unit/index.js\n var require_parse_unit = __commonJS({\n \"node_modules/parse-unit/index.js\"(exports, module) {\n module.exports = function parseUnit(str, out) {\n if (!out)\n out = [0, \"\"];\n str = String(str);\n var num = parseFloat(str, 10);\n out[0] = num;\n out[1] = str.match(/[\\d.\\-\\+]*\\s*(.*)/)[1] || \"\";\n return out;\n };\n }\n });\n\n // node_modules/to-px/topx.js\n var require_topx = __commonJS({\n \"node_modules/to-px/topx.js\"(exports, module) {\n \"use strict\";\n var parseUnit = require_parse_unit();\n module.exports = toPX;\n var PIXELS_PER_INCH = 96;\n function getPropertyInPX(element, prop) {\n var parts = parseUnit(getComputedStyle(element).getPropertyValue(prop));\n return parts[0] * toPX(parts[1], element);\n }\n function getSizeBrutal(unit, element) {\n var testDIV = document.createElement(\"div\");\n testDIV.style[\"font-size\"] = \"128\" + unit;\n element.appendChild(testDIV);\n var size = getPropertyInPX(testDIV, \"font-size\") / 128;\n element.removeChild(testDIV);\n return size;\n }\n function toPX(str, element) {\n element = element || document.body;\n str = (str || \"px\").trim().toLowerCase();\n if (element === window || element === document) {\n element = document.body;\n }\n switch (str) {\n case \"%\":\n return element.clientHeight / 100;\n case \"ch\":\n case \"ex\":\n return getSizeBrutal(str, element);\n case \"em\":\n return getPropertyInPX(element, \"font-size\");\n case \"rem\":\n return getPropertyInPX(document.body, \"font-size\");\n case \"vw\":\n return window.innerWidth / 100;\n case \"vh\":\n return window.innerHeight / 100;\n case \"vmin\":\n return Math.min(window.innerWidth, window.innerHeight) / 100;\n case \"vmax\":\n return Math.max(window.innerWidth, window.innerHeight) / 100;\n case \"in\":\n return PIXELS_PER_INCH;\n case \"cm\":\n return PIXELS_PER_INCH / 2.54;\n case \"mm\":\n return PIXELS_PER_INCH / 25.4;\n case \"pt\":\n return PIXELS_PER_INCH / 72;\n case \"pc\":\n return PIXELS_PER_INCH / 6;\n }\n return 1;\n }\n }\n });\n\n // node_modules/detect-kerning/index.js\n var require_detect_kerning = __commonJS({\n \"node_modules/detect-kerning/index.js\"(exports, module) {\n \"use strict\";\n module.exports = kerning;\n var canvas = kerning.canvas = document.createElement(\"canvas\");\n var ctx = canvas.getContext(\"2d\");\n var asciiPairs = createPairs([32, 126]);\n kerning.createPairs = createPairs;\n kerning.ascii = asciiPairs;\n function kerning(family, o) {\n if (Array.isArray(family)) family = family.join(\", \");\n var table = {}, pairs, fs = 16, threshold = 0.05;\n if (o) {\n if (o.length === 2 && typeof o[0] === \"number\") {\n pairs = createPairs(o);\n } else if (Array.isArray(o)) {\n pairs = o;\n } else {\n if (o.o) pairs = createPairs(o.o);\n else if (o.pairs) pairs = o.pairs;\n if (o.fontSize) fs = o.fontSize;\n if (o.threshold != null) threshold = o.threshold;\n }\n }\n if (!pairs) pairs = asciiPairs;\n ctx.font = fs + \"px \" + family;\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i];\n var width = ctx.measureText(pair[0]).width + ctx.measureText(pair[1]).width;\n var kerningWidth = ctx.measureText(pair).width;\n if (Math.abs(width - kerningWidth) > fs * threshold) {\n var emWidth = (kerningWidth - width) / fs;\n table[pair] = emWidth * 1e3;\n }\n }\n return table;\n }\n function createPairs(range) {\n var pairs = [];\n for (var i = range[0]; i <= range[1]; i++) {\n var leftChar = String.fromCharCode(i);\n for (var j = range[0]; j < range[1]; j++) {\n var rightChar = String.fromCharCode(j);\n var pair = leftChar + rightChar;\n pairs.push(pair);\n }\n }\n return pairs;\n }\n }\n });\n\n // node_modules/font-measure/index.js\n var require_font_measure = __commonJS({\n \"node_modules/font-measure/index.js\"(exports, module) {\n \"use strict\";\n module.exports = measure;\n measure.canvas = document.createElement(\"canvas\");\n measure.cache = {};\n function measure(font, o) {\n if (!o) o = {};\n if (typeof font === \"string\" || Array.isArray(font)) {\n o.family = font;\n }\n var family = Array.isArray(o.family) ? o.family.join(\", \") : o.family;\n if (!family) throw Error(\"`family` must be defined\");\n var fs = o.size || o.fontSize || o.em || 48;\n var weight = o.weight || o.fontWeight || \"\";\n var style = o.style || o.fontStyle || \"\";\n var font = [style, weight, fs].join(\" \") + \"px \" + family;\n var origin = o.origin || \"top\";\n if (measure.cache[family]) {\n if (fs <= measure.cache[family].em) {\n return applyOrigin(measure.cache[family], origin);\n }\n }\n var canvas = o.canvas || measure.canvas;\n var ctx = canvas.getContext(\"2d\");\n var chars = {\n upper: o.upper !== void 0 ? o.upper : \"H\",\n lower: o.lower !== void 0 ? o.lower : \"x\",\n descent: o.descent !== void 0 ? o.descent : \"p\",\n ascent: o.ascent !== void 0 ? o.ascent : \"h\",\n tittle: o.tittle !== void 0 ? o.tittle : \"i\",\n overshoot: o.overshoot !== void 0 ? o.overshoot : \"O\"\n };\n var l = Math.ceil(fs * 1.5);\n canvas.height = l;\n canvas.width = l * 0.5;\n ctx.font = font;\n var char = \"H\";\n var result = {\n top: 0\n };\n ctx.clearRect(0, 0, l, l);\n ctx.textBaseline = \"top\";\n ctx.fillStyle = \"black\";\n ctx.fillText(char, 0, 0);\n var topPx = firstTop(ctx.getImageData(0, 0, l, l));\n ctx.clearRect(0, 0, l, l);\n ctx.textBaseline = \"bottom\";\n ctx.fillText(char, 0, l);\n var bottomPx = firstTop(ctx.getImageData(0, 0, l, l));\n result.lineHeight = result.bottom = l - bottomPx + topPx;\n ctx.clearRect(0, 0, l, l);\n ctx.textBaseline = \"alphabetic\";\n ctx.fillText(char, 0, l);\n var baselinePx = firstTop(ctx.getImageData(0, 0, l, l));\n var baseline = l - baselinePx - 1 + topPx;\n result.baseline = result.alphabetic = baseline;\n ctx.clearRect(0, 0, l, l);\n ctx.textBaseline = \"middle\";\n ctx.fillText(char, 0, l * 0.5);\n var medianPx = firstTop(ctx.getImageData(0, 0, l, l));\n result.median = result.middle = l - medianPx - 1 + topPx - l * 0.5;\n ctx.clearRect(0, 0, l, l);\n ctx.textBaseline = \"hanging\";\n ctx.fillText(char, 0, l * 0.5);\n var hangingPx = firstTop(ctx.getImageData(0, 0, l, l));\n result.hanging = l - hangingPx - 1 + topPx - l * 0.5;\n ctx.clearRect(0, 0, l, l);\n ctx.textBaseline = \"ideographic\";\n ctx.fillText(char, 0, l);\n var ideographicPx = firstTop(ctx.getImageData(0, 0, l, l));\n result.ideographic = l - ideographicPx - 1 + topPx;\n if (chars.upper) {\n ctx.clearRect(0, 0, l, l);\n ctx.textBaseline = \"top\";\n ctx.fillText(chars.upper, 0, 0);\n result.upper = firstTop(ctx.getImageData(0, 0, l, l));\n result.capHeight = result.baseline - result.upper;\n }\n if (chars.lower) {\n ctx.clearRect(0, 0, l, l);\n ctx.textBaseline = \"top\";\n ctx.fillText(chars.lower, 0, 0);\n result.lower = firstTop(ctx.getImageData(0, 0, l, l));\n result.xHeight = result.baseline - result.lower;\n }\n if (chars.tittle) {\n ctx.clearRect(0, 0, l, l);\n ctx.textBaseline = \"top\";\n ctx.fillText(chars.tittle, 0, 0);\n result.tittle = firstTop(ctx.getImageData(0, 0, l, l));\n }\n if (chars.ascent) {\n ctx.clearRect(0, 0, l, l);\n ctx.textBaseline = \"top\";\n ctx.fillText(chars.ascent, 0, 0);\n result.ascent = firstTop(ctx.getImageData(0, 0, l, l));\n }\n if (chars.descent) {\n ctx.clearRect(0, 0, l, l);\n ctx.textBaseline = \"top\";\n ctx.fillText(chars.descent, 0, 0);\n result.descent = firstBottom(ctx.getImageData(0, 0, l, l));\n }\n if (chars.overshoot) {\n ctx.clearRect(0, 0, l, l);\n ctx.textBaseline = \"top\";\n ctx.fillText(chars.overshoot, 0, 0);\n var overshootPx = firstBottom(ctx.getImageData(0, 0, l, l));\n result.overshoot = overshootPx - baseline;\n }\n for (var name2 in result) {\n result[name2] /= fs;\n }\n result.em = fs;\n measure.cache[family] = result;\n return applyOrigin(result, origin);\n }\n function applyOrigin(obj, origin) {\n var res = {};\n if (typeof origin === \"string\") origin = obj[origin];\n for (var name2 in obj) {\n if (name2 === \"em\") continue;\n res[name2] = obj[name2] - origin;\n }\n return res;\n }\n function firstTop(iData) {\n var l = iData.height;\n var data = iData.data;\n for (var i = 3; i < data.length; i += 4) {\n if (data[i] !== 0) {\n return Math.floor((i - 3) * 0.25 / l);\n }\n }\n }\n function firstBottom(iData) {\n var l = iData.height;\n var data = iData.data;\n for (var i = data.length - 1; i > 0; i -= 4) {\n if (data[i] !== 0) {\n return Math.floor((i - 3) * 0.25 / l);\n }\n }\n }\n }\n });\n\n // node_modules/gl-text/dist.js\n var require_dist = __commonJS({\n \"node_modules/gl-text/dist.js\"(exports, module) {\n \"use strict\";\n var Font = require_css_font();\n var pick = require_pick_by_alias();\n var createRegl = require_regl_unchecked();\n var createGl = require_context();\n var WeakMap2 = require_es6_weak_map();\n var rgba3 = require_color_normalize();\n var fontAtlas = require_font_atlas();\n var pool = require_pool();\n var parseRect = require_parse_rect();\n var isObj = require_is_plain_obj();\n var parseUnit = require_parse_unit();\n var px = require_topx();\n var kerning = require_detect_kerning();\n var extend2 = require_object_assign();\n var metrics = require_font_measure();\n var flatten = require_flatten_vertex_data();\n var ref = require_twiddle();\n var nextPow2 = ref.nextPow2;\n var shaderCache = new WeakMap2();\n var isStretchSupported = false;\n if (document.body) {\n el = document.body.appendChild(document.createElement(\"div\"));\n el.style.font = \"italic small-caps bold condensed 16px/2 cursive\";\n if (getComputedStyle(el).fontStretch) {\n isStretchSupported = true;\n }\n document.body.removeChild(el);\n }\n var el;\n var GlText = function GlText2(o) {\n if (isRegl(o)) {\n o = { regl: o };\n this.gl = o.regl._gl;\n } else {\n this.gl = createGl(o);\n }\n this.shader = shaderCache.get(this.gl);\n if (!this.shader) {\n this.regl = o.regl || createRegl({ gl: this.gl });\n } else {\n this.regl = this.shader.regl;\n }\n this.charBuffer = this.regl.buffer({ type: \"uint8\", usage: \"stream\" });\n this.sizeBuffer = this.regl.buffer({ type: \"float\", usage: \"stream\" });\n if (!this.shader) {\n this.shader = this.createShader();\n shaderCache.set(this.gl, this.shader);\n }\n this.batch = [];\n this.fontSize = [];\n this.font = [];\n this.fontAtlas = [];\n this.draw = this.shader.draw.bind(this);\n this.render = function() {\n this.regl._refresh();\n this.draw(this.batch);\n };\n this.canvas = this.gl.canvas;\n this.update(isObj(o) ? o : {});\n };\n GlText.prototype.createShader = function createShader() {\n var regl = this.regl;\n var draw = regl({\n blend: {\n enable: true,\n color: [0, 0, 0, 1],\n func: {\n srcRGB: \"src alpha\",\n dstRGB: \"one minus src alpha\",\n srcAlpha: \"one minus dst alpha\",\n dstAlpha: \"one\"\n }\n },\n stencil: { enable: false },\n depth: { enable: false },\n count: regl.prop(\"count\"),\n offset: regl.prop(\"offset\"),\n attributes: {\n charOffset: {\n offset: 4,\n stride: 8,\n buffer: regl.this(\"sizeBuffer\")\n },\n width: {\n offset: 0,\n stride: 8,\n buffer: regl.this(\"sizeBuffer\")\n },\n char: regl.this(\"charBuffer\"),\n position: regl.this(\"position\")\n },\n uniforms: {\n atlasSize: function(c, p) {\n return [p.atlas.width, p.atlas.height];\n },\n atlasDim: function(c, p) {\n return [p.atlas.cols, p.atlas.rows];\n },\n atlas: function(c, p) {\n return p.atlas.texture;\n },\n charStep: function(c, p) {\n return p.atlas.step;\n },\n em: function(c, p) {\n return p.atlas.em;\n },\n color: regl.prop(\"color\"),\n opacity: regl.prop(\"opacity\"),\n viewport: regl.this(\"viewportArray\"),\n scale: regl.this(\"scale\"),\n align: regl.prop(\"align\"),\n baseline: regl.prop(\"baseline\"),\n translate: regl.this(\"translate\"),\n positionOffset: regl.prop(\"positionOffset\")\n },\n primitive: \"points\",\n viewport: regl.this(\"viewport\"),\n vert: \"\\n\t\t\tprecision highp float;\\n\t\t\tattribute float width, charOffset, char;\\n\t\t\tattribute vec2 position;\\n\t\t\tuniform float fontSize, charStep, em, align, baseline;\\n\t\t\tuniform vec4 viewport;\\n\t\t\tuniform vec4 color;\\n\t\t\tuniform vec2 atlasSize, atlasDim, scale, translate, positionOffset;\\n\t\t\tvarying vec2 charCoord, charId;\\n\t\t\tvarying float charWidth;\\n\t\t\tvarying vec4 fontColor;\\n\t\t\tvoid main () {\\n\t\t\t\tvec2 offset = floor(em * (vec2(align + charOffset, baseline)\\n\t\t\t\t\t+ vec2(positionOffset.x, -positionOffset.y)))\\n\t\t\t\t\t/ (viewport.zw * scale.xy);\\n\\n\t\t\t\tvec2 position = (position + translate) * scale;\\n\t\t\t\tposition += offset * scale;\\n\\n\t\t\t\tcharCoord = position * viewport.zw + viewport.xy;\\n\\n\t\t\t\tgl_Position = vec4(position * 2. - 1., 0, 1);\\n\\n\t\t\t\tgl_PointSize = charStep;\\n\\n\t\t\t\tcharId.x = mod(char, atlasDim.x);\\n\t\t\t\tcharId.y = floor(char / atlasDim.x);\\n\\n\t\t\t\tcharWidth = width * em;\\n\\n\t\t\t\tfontColor = color / 255.;\\n\t\t\t}\",\n frag: \"\\n\t\t\tprecision highp float;\\n\t\t\tuniform float fontSize, charStep, opacity;\\n\t\t\tuniform vec2 atlasSize;\\n\t\t\tuniform vec4 viewport;\\n\t\t\tuniform sampler2D atlas;\\n\t\t\tvarying vec4 fontColor;\\n\t\t\tvarying vec2 charCoord, charId;\\n\t\t\tvarying float charWidth;\\n\\n\t\t\tfloat lightness(vec4 color) {\\n\t\t\t\treturn color.r * 0.299 + color.g * 0.587 + color.b * 0.114;\\n\t\t\t}\\n\\n\t\t\tvoid main () {\\n\t\t\t\tvec2 uv = gl_FragCoord.xy - charCoord + charStep * .5;\\n\t\t\t\tfloat halfCharStep = floor(charStep * .5 + .5);\\n\\n\t\t\t\t// invert y and shift by 1px (FF expecially needs that)\\n\t\t\t\tuv.y = charStep - uv.y;\\n\\n\t\t\t\t// ignore points outside of character bounding box\\n\t\t\t\tfloat halfCharWidth = ceil(charWidth * .5);\\n\t\t\t\tif (floor(uv.x) > halfCharStep + halfCharWidth ||\\n\t\t\t\t\tfloor(uv.x) < halfCharStep - halfCharWidth) return;\\n\\n\t\t\t\tuv += charId * charStep;\\n\t\t\t\tuv = uv / atlasSize;\\n\\n\t\t\t\tvec4 color = fontColor;\\n\t\t\t\tvec4 mask = texture2D(atlas, uv);\\n\\n\t\t\t\tfloat maskY = lightness(mask);\\n\t\t\t\t// float colorY = lightness(color);\\n\t\t\t\tcolor.a *= maskY;\\n\t\t\t\tcolor.a *= opacity;\\n\\n\t\t\t\t// color.a += .1;\\n\\n\t\t\t\t// antialiasing, see yiq color space y-channel formula\\n\t\t\t\t// color.rgb += (1. - color.rgb) * (1. - mask.rgb);\\n\\n\t\t\t\tgl_FragColor = color;\\n\t\t\t}\"\n });\n var atlas = {};\n return { regl, draw, atlas };\n };\n GlText.prototype.update = function update(o) {\n var this$1 = this;\n if (typeof o === \"string\") {\n o = { text: o };\n } else if (!o) {\n return;\n }\n o = pick(o, {\n position: \"position positions coord coords coordinates\",\n font: \"font fontFace fontface typeface cssFont css-font family fontFamily\",\n fontSize: \"fontSize fontsize size font-size\",\n text: \"text texts chars characters value values symbols\",\n align: \"align alignment textAlign textbaseline\",\n baseline: \"baseline textBaseline textbaseline\",\n direction: \"dir direction textDirection\",\n color: \"color colour fill fill-color fillColor textColor textcolor\",\n kerning: \"kerning kern\",\n range: \"range dataBox\",\n viewport: \"vp viewport viewBox viewbox viewPort\",\n opacity: \"opacity alpha transparency visible visibility opaque\",\n offset: \"offset positionOffset padding shift indent indentation\"\n }, true);\n if (o.opacity != null) {\n if (Array.isArray(o.opacity)) {\n this.opacity = o.opacity.map(function(o2) {\n return parseFloat(o2);\n });\n } else {\n this.opacity = parseFloat(o.opacity);\n }\n }\n if (o.viewport != null) {\n this.viewport = parseRect(o.viewport);\n this.viewportArray = [this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height];\n }\n if (this.viewport == null) {\n this.viewport = {\n x: 0,\n y: 0,\n width: this.gl.drawingBufferWidth,\n height: this.gl.drawingBufferHeight\n };\n this.viewportArray = [this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height];\n }\n if (o.kerning != null) {\n this.kerning = o.kerning;\n }\n if (o.offset != null) {\n if (typeof o.offset === \"number\") {\n o.offset = [o.offset, 0];\n }\n this.positionOffset = flatten(o.offset);\n }\n if (o.direction) {\n this.direction = o.direction;\n }\n if (o.range) {\n this.range = o.range;\n this.scale = [1 / (o.range[2] - o.range[0]), 1 / (o.range[3] - o.range[1])];\n this.translate = [-o.range[0], -o.range[1]];\n }\n if (o.scale) {\n this.scale = o.scale;\n }\n if (o.translate) {\n this.translate = o.translate;\n }\n if (!this.scale) {\n this.scale = [1 / this.viewport.width, 1 / this.viewport.height];\n }\n if (!this.translate) {\n this.translate = [0, 0];\n }\n if (!this.font.length && !o.font) {\n o.font = GlText.baseFontSize + \"px sans-serif\";\n }\n var newFont = false, newFontSize = false;\n if (o.font) {\n (Array.isArray(o.font) ? o.font : [o.font]).forEach(function(font2, i2) {\n if (typeof font2 === \"string\") {\n try {\n font2 = Font.parse(font2);\n } catch (e) {\n font2 = Font.parse(GlText.baseFontSize + \"px \" + font2);\n }\n } else {\n var fontStyle = font2.style;\n var fontWeight = font2.weight;\n var fontStretch = font2.stretch;\n var fontVariant = font2.variant;\n font2 = Font.parse(Font.stringify(font2));\n if (fontStyle) font2.style = fontStyle;\n if (fontWeight) font2.weight = fontWeight;\n if (fontStretch) font2.stretch = fontStretch;\n if (fontVariant) font2.variant = fontVariant;\n }\n var baseString = Font.stringify({\n size: GlText.baseFontSize,\n family: font2.family,\n stretch: isStretchSupported ? font2.stretch : void 0,\n variant: font2.variant,\n weight: font2.weight,\n style: font2.style\n });\n var unit = parseUnit(font2.size);\n var fs = Math.round(unit[0] * px(unit[1]));\n if (fs !== this$1.fontSize[i2]) {\n newFontSize = true;\n this$1.fontSize[i2] = fs;\n }\n if (!this$1.font[i2] || baseString != this$1.font[i2].baseString) {\n newFont = true;\n this$1.font[i2] = GlText.fonts[baseString];\n if (!this$1.font[i2]) {\n var family = font2.family.join(\", \");\n var style = [font2.style];\n if (font2.style != font2.variant) {\n style.push(font2.variant);\n }\n if (font2.variant != font2.weight) {\n style.push(font2.weight);\n }\n if (isStretchSupported && font2.weight != font2.stretch) {\n style.push(font2.stretch);\n }\n this$1.font[i2] = {\n baseString,\n // typeface\n family,\n weight: font2.weight,\n stretch: font2.stretch,\n style: font2.style,\n variant: font2.variant,\n // widths of characters\n width: {},\n // kernin pairs offsets\n kerning: {},\n metrics: metrics(family, {\n origin: \"top\",\n fontSize: GlText.baseFontSize,\n fontStyle: style.join(\" \")\n })\n };\n GlText.fonts[baseString] = this$1.font[i2];\n }\n }\n });\n }\n if (newFont || newFontSize) {\n this.font.forEach(function(font2, i2) {\n var fontString = Font.stringify({\n size: this$1.fontSize[i2],\n family: font2.family,\n stretch: isStretchSupported ? font2.stretch : void 0,\n variant: font2.variant,\n weight: font2.weight,\n style: font2.style\n });\n this$1.fontAtlas[i2] = this$1.shader.atlas[fontString];\n if (!this$1.fontAtlas[i2]) {\n var metrics2 = font2.metrics;\n this$1.shader.atlas[fontString] = this$1.fontAtlas[i2] = {\n fontString,\n // even step is better for rendered characters\n step: Math.ceil(this$1.fontSize[i2] * metrics2.bottom * 0.5) * 2,\n em: this$1.fontSize[i2],\n cols: 0,\n rows: 0,\n height: 0,\n width: 0,\n chars: [],\n ids: {},\n texture: this$1.regl.texture()\n };\n }\n if (o.text == null) {\n o.text = this$1.text;\n }\n });\n }\n if (typeof o.text === \"string\" && o.position && o.position.length > 2) {\n var textArray = Array(o.position.length * 0.5);\n for (var i = 0; i < textArray.length; i++) {\n textArray[i] = o.text;\n }\n o.text = textArray;\n }\n var newAtlasChars;\n if (o.text != null || newFont) {\n this.textOffsets = [0];\n if (Array.isArray(o.text)) {\n this.count = o.text[0].length;\n this.counts = [this.count];\n for (var i$1 = 1; i$1 < o.text.length; i$1++) {\n this.textOffsets[i$1] = this.textOffsets[i$1 - 1] + o.text[i$1 - 1].length;\n this.count += o.text[i$1].length;\n this.counts.push(o.text[i$1].length);\n }\n this.text = o.text.join(\"\");\n } else {\n this.text = o.text;\n this.count = this.text.length;\n this.counts = [this.count];\n }\n newAtlasChars = [];\n this.font.forEach(function(font2, idx) {\n GlText.atlasContext.font = font2.baseString;\n var atlas2 = this$1.fontAtlas[idx];\n for (var i2 = 0; i2 < this$1.text.length; i2++) {\n var char2 = this$1.text.charAt(i2);\n if (atlas2.ids[char2] == null) {\n atlas2.ids[char2] = atlas2.chars.length;\n atlas2.chars.push(char2);\n newAtlasChars.push(char2);\n }\n if (font2.width[char2] == null) {\n font2.width[char2] = GlText.atlasContext.measureText(char2).width / GlText.baseFontSize;\n if (this$1.kerning) {\n var pairs = [];\n for (var baseChar in font2.width) {\n pairs.push(baseChar + char2, char2 + baseChar);\n }\n extend2(font2.kerning, kerning(font2.family, {\n pairs\n }));\n }\n }\n }\n });\n }\n if (o.position) {\n if (o.position.length > 2) {\n var flat = !o.position[0].length;\n var positionData = pool.mallocFloat(this.count * 2);\n for (var i$2 = 0, ptr = 0; i$2 < this.counts.length; i$2++) {\n var count = this.counts[i$2];\n if (flat) {\n for (var j = 0; j < count; j++) {\n positionData[ptr++] = o.position[i$2 * 2];\n positionData[ptr++] = o.position[i$2 * 2 + 1];\n }\n } else {\n for (var j$1 = 0; j$1 < count; j$1++) {\n positionData[ptr++] = o.position[i$2][0];\n positionData[ptr++] = o.position[i$2][1];\n }\n }\n }\n if (this.position.call) {\n this.position({\n type: \"float\",\n data: positionData\n });\n } else {\n this.position = this.regl.buffer({\n type: \"float\",\n data: positionData\n });\n }\n pool.freeFloat(positionData);\n } else {\n if (this.position.destroy) {\n this.position.destroy();\n }\n this.position = {\n constant: o.position\n };\n }\n }\n if (o.text || newFont) {\n var charIds = pool.mallocUint8(this.count);\n var sizeData = pool.mallocFloat(this.count * 2);\n this.textWidth = [];\n for (var i$3 = 0, ptr$1 = 0; i$3 < this.counts.length; i$3++) {\n var count$1 = this.counts[i$3];\n var font = this.font[i$3] || this.font[0];\n var atlas = this.fontAtlas[i$3] || this.fontAtlas[0];\n for (var j$2 = 0; j$2 < count$1; j$2++) {\n var char = this.text.charAt(ptr$1);\n var prevChar = this.text.charAt(ptr$1 - 1);\n charIds[ptr$1] = atlas.ids[char];\n sizeData[ptr$1 * 2] = font.width[char];\n if (j$2) {\n var prevWidth = sizeData[ptr$1 * 2 - 2];\n var currWidth = sizeData[ptr$1 * 2];\n var prevOffset = sizeData[ptr$1 * 2 - 1];\n var offset = prevOffset + prevWidth * 0.5 + currWidth * 0.5;\n if (this.kerning) {\n var kerning$1 = font.kerning[prevChar + char];\n if (kerning$1) {\n offset += kerning$1 * 1e-3;\n }\n }\n sizeData[ptr$1 * 2 + 1] = offset;\n } else {\n sizeData[ptr$1 * 2 + 1] = sizeData[ptr$1 * 2] * 0.5;\n }\n ptr$1++;\n }\n this.textWidth.push(\n !sizeData.length ? 0 : (\n // last offset + half last width\n sizeData[ptr$1 * 2 - 2] * 0.5 + sizeData[ptr$1 * 2 - 1]\n )\n );\n }\n if (!o.align) {\n o.align = this.align;\n }\n this.charBuffer({ data: charIds, type: \"uint8\", usage: \"stream\" });\n this.sizeBuffer({ data: sizeData, type: \"float\", usage: \"stream\" });\n pool.freeUint8(charIds);\n pool.freeFloat(sizeData);\n if (newAtlasChars.length) {\n this.font.forEach(function(font2, i2) {\n var atlas2 = this$1.fontAtlas[i2];\n var step = atlas2.step;\n var maxCols = Math.floor(GlText.maxAtlasSize / step);\n var cols = Math.min(maxCols, atlas2.chars.length);\n var rows = Math.ceil(atlas2.chars.length / cols);\n var atlasWidth = nextPow2(cols * step);\n var atlasHeight = nextPow2(rows * step);\n atlas2.width = atlasWidth;\n atlas2.height = atlasHeight;\n atlas2.rows = rows;\n atlas2.cols = cols;\n if (!atlas2.em) {\n return;\n }\n atlas2.texture({\n data: fontAtlas({\n canvas: GlText.atlasCanvas,\n font: atlas2.fontString,\n chars: atlas2.chars,\n shape: [atlasWidth, atlasHeight],\n step: [step, step]\n })\n });\n });\n }\n }\n if (o.align) {\n this.align = o.align;\n this.alignOffset = this.textWidth.map(function(textWidth, i2) {\n var align = !Array.isArray(this$1.align) ? this$1.align : this$1.align.length > 1 ? this$1.align[i2] : this$1.align[0];\n if (typeof align === \"number\") {\n return align;\n }\n switch (align) {\n case \"right\":\n case \"end\":\n return -textWidth;\n case \"center\":\n case \"centre\":\n case \"middle\":\n return -textWidth * 0.5;\n }\n return 0;\n });\n }\n if (this.baseline == null && o.baseline == null) {\n o.baseline = 0;\n }\n if (o.baseline != null) {\n this.baseline = o.baseline;\n if (!Array.isArray(this.baseline)) {\n this.baseline = [this.baseline];\n }\n this.baselineOffset = this.baseline.map(function(baseline, i2) {\n var m = (this$1.font[i2] || this$1.font[0]).metrics;\n var base = 0;\n base += m.bottom * 0.5;\n if (typeof baseline === \"number\") {\n base += baseline - m.baseline;\n } else {\n base += -m[baseline];\n }\n base *= -1;\n return base;\n });\n }\n if (o.color != null) {\n if (!o.color) {\n o.color = \"transparent\";\n }\n if (typeof o.color === \"string\" || !isNaN(o.color)) {\n this.color = rgba3(o.color, \"uint8\");\n } else {\n var colorData;\n if (typeof o.color[0] === \"number\" && o.color.length > this.counts.length) {\n var l = o.color.length;\n colorData = pool.mallocUint8(l);\n var sub = (o.color.subarray || o.color.slice).bind(o.color);\n for (var i$4 = 0; i$4 < l; i$4 += 4) {\n colorData.set(rgba3(sub(i$4, i$4 + 4), \"uint8\"), i$4);\n }\n } else {\n var l$1 = o.color.length;\n colorData = pool.mallocUint8(l$1 * 4);\n for (var i$5 = 0; i$5 < l$1; i$5++) {\n colorData.set(rgba3(o.color[i$5] || 0, \"uint8\"), i$5 * 4);\n }\n }\n this.color = colorData;\n }\n }\n if (o.position || o.text || o.color || o.baseline || o.align || o.font || o.offset || o.opacity) {\n var isBatch = this.color.length > 4 || this.baselineOffset.length > 1 || this.align && this.align.length > 1 || this.fontAtlas.length > 1 || this.positionOffset.length > 2;\n if (isBatch) {\n var length = Math.max(\n this.position.length * 0.5 || 0,\n this.color.length * 0.25 || 0,\n this.baselineOffset.length || 0,\n this.alignOffset.length || 0,\n this.font.length || 0,\n this.opacity.length || 0,\n this.positionOffset.length * 0.5 || 0\n );\n this.batch = Array(length);\n for (var i$6 = 0; i$6 < this.batch.length; i$6++) {\n this.batch[i$6] = {\n count: this.counts.length > 1 ? this.counts[i$6] : this.counts[0],\n offset: this.textOffsets.length > 1 ? this.textOffsets[i$6] : this.textOffsets[0],\n color: !this.color ? [0, 0, 0, 255] : this.color.length <= 4 ? this.color : this.color.subarray(i$6 * 4, i$6 * 4 + 4),\n opacity: Array.isArray(this.opacity) ? this.opacity[i$6] : this.opacity,\n baseline: this.baselineOffset[i$6] != null ? this.baselineOffset[i$6] : this.baselineOffset[0],\n align: !this.align ? 0 : this.alignOffset[i$6] != null ? this.alignOffset[i$6] : this.alignOffset[0],\n atlas: this.fontAtlas[i$6] || this.fontAtlas[0],\n positionOffset: this.positionOffset.length > 2 ? this.positionOffset.subarray(i$6 * 2, i$6 * 2 + 2) : this.positionOffset\n };\n }\n } else {\n if (this.count) {\n this.batch = [{\n count: this.count,\n offset: 0,\n color: this.color || [0, 0, 0, 255],\n opacity: Array.isArray(this.opacity) ? this.opacity[0] : this.opacity,\n baseline: this.baselineOffset[0],\n align: this.alignOffset ? this.alignOffset[0] : 0,\n atlas: this.fontAtlas[0],\n positionOffset: this.positionOffset\n }];\n } else {\n this.batch = [];\n }\n }\n }\n };\n GlText.prototype.destroy = function destroy() {\n };\n GlText.prototype.kerning = true;\n GlText.prototype.position = { constant: new Float32Array(2) };\n GlText.prototype.translate = null;\n GlText.prototype.scale = null;\n GlText.prototype.font = null;\n GlText.prototype.text = \"\";\n GlText.prototype.positionOffset = [0, 0];\n GlText.prototype.opacity = 1;\n GlText.prototype.color = new Uint8Array([0, 0, 0, 255]);\n GlText.prototype.alignOffset = [0, 0];\n GlText.maxAtlasSize = 1024;\n GlText.atlasCanvas = document.createElement(\"canvas\");\n GlText.atlasContext = GlText.atlasCanvas.getContext(\"2d\", { alpha: false });\n GlText.baseFontSize = 64;\n GlText.fonts = {};\n function isRegl(o) {\n return typeof o === \"function\" && o._gl && o.prop && o.texture && o.buffer;\n }\n module.exports = GlText;\n }\n });\n\n // src/lib/prepare_regl.js\n var require_prepare_regl = __commonJS({\n \"src/lib/prepare_regl.js\"(exports, module) {\n \"use strict\";\n var showNoWebGlMsg = require_show_no_webgl_msg();\n var createRegl = require_regl_unchecked();\n module.exports = function prepareRegl(gd, extensions, reglPrecompiled) {\n var fullLayout = gd._fullLayout;\n var success = true;\n fullLayout._glcanvas.each(function(d) {\n if (d.regl) {\n d.regl.preloadCachedCode(reglPrecompiled);\n return;\n }\n if (d.pick && !fullLayout._has(\"parcoords\")) return;\n try {\n d.regl = createRegl({\n canvas: this,\n attributes: {\n antialias: !d.pick,\n preserveDrawingBuffer: true\n },\n pixelRatio: gd._context.plotGlPixelRatio || window.devicePixelRatio,\n extensions: extensions || [],\n cachedCode: reglPrecompiled || {}\n });\n } catch (e) {\n success = false;\n }\n if (!d.regl) success = false;\n if (success) {\n this.addEventListener(\"webglcontextlost\", function(event) {\n if (gd && gd.emit) {\n gd.emit(\"plotly_webglcontextlost\", {\n event,\n layer: d.key\n });\n }\n }, false);\n }\n });\n if (!success) {\n showNoWebGlMsg({ container: fullLayout._glcontainer.node() });\n }\n return success;\n };\n }\n });\n\n // src/traces/scattergl/plot.js\n var require_plot19 = __commonJS({\n \"src/traces/scattergl/plot.js\"(exports, module) {\n \"use strict\";\n var createScatter = require_bundle();\n var createLine = require_regl_line2d();\n var createError = require_regl_error2d();\n var Text = require_dist();\n var Lib = require_lib();\n var selectMode = require_helpers5().selectMode;\n var prepareRegl = require_prepare_regl();\n var subTypes = require_subtypes();\n var linkTraces = require_link_traces();\n var styleTextSelection = require_edit_style().styleTextSelection;\n var reglPrecompiled = {};\n function getViewport(fullLayout, xaxis, yaxis, plotGlPixelRatio) {\n var gs = fullLayout._size;\n var width = fullLayout.width * plotGlPixelRatio;\n var height = fullLayout.height * plotGlPixelRatio;\n var l = gs.l * plotGlPixelRatio;\n var b = gs.b * plotGlPixelRatio;\n var r = gs.r * plotGlPixelRatio;\n var t = gs.t * plotGlPixelRatio;\n var w = gs.w * plotGlPixelRatio;\n var h = gs.h * plotGlPixelRatio;\n return [\n l + xaxis.domain[0] * w,\n b + yaxis.domain[0] * h,\n width - r - (1 - xaxis.domain[1]) * w,\n height - t - (1 - yaxis.domain[1]) * h\n ];\n }\n var exports = module.exports = function plot(gd, subplot, cdata) {\n if (!cdata.length) return;\n var fullLayout = gd._fullLayout;\n var scene = subplot._scene;\n var xaxis = subplot.xaxis;\n var yaxis = subplot.yaxis;\n var i, j;\n if (!scene) return;\n var success = prepareRegl(gd, [\"ANGLE_instanced_arrays\", \"OES_element_index_uint\"], reglPrecompiled);\n if (!success) {\n scene.init();\n return;\n }\n var count = scene.count;\n var regl = fullLayout._glcanvas.data()[0].regl;\n linkTraces(gd, subplot, cdata);\n if (scene.dirty) {\n if ((scene.line2d || scene.error2d) && !(scene.scatter2d || scene.fill2d || scene.glText)) {\n regl.clear({});\n }\n if (scene.error2d === true) {\n scene.error2d = createError(regl);\n }\n if (scene.line2d === true) {\n scene.line2d = createLine(regl);\n }\n if (scene.scatter2d === true) {\n scene.scatter2d = createScatter(regl);\n }\n if (scene.fill2d === true) {\n scene.fill2d = createLine(regl);\n }\n if (scene.glText === true) {\n scene.glText = new Array(count);\n for (i = 0; i < count; i++) {\n scene.glText[i] = new Text(regl);\n }\n }\n if (scene.glText) {\n if (count > scene.glText.length) {\n var textsToAdd = count - scene.glText.length;\n for (i = 0; i < textsToAdd; i++) {\n scene.glText.push(new Text(regl));\n }\n } else if (count < scene.glText.length) {\n var textsToRemove = scene.glText.length - count;\n var removedTexts = scene.glText.splice(count, textsToRemove);\n removedTexts.forEach(function(text) {\n text.destroy();\n });\n }\n for (i = 0; i < count; i++) {\n scene.glText[i].update(scene.textOptions[i]);\n }\n }\n if (scene.line2d) {\n scene.line2d.update(scene.lineOptions);\n scene.lineOptions = scene.lineOptions.map(function(lineOptions) {\n if (lineOptions && lineOptions.positions) {\n var srcPos = lineOptions.positions;\n var firstptdef = 0;\n while (firstptdef < srcPos.length && (isNaN(srcPos[firstptdef]) || isNaN(srcPos[firstptdef + 1]))) {\n firstptdef += 2;\n }\n var lastptdef = srcPos.length - 2;\n while (lastptdef > firstptdef && (isNaN(srcPos[lastptdef]) || isNaN(srcPos[lastptdef + 1]))) {\n lastptdef -= 2;\n }\n lineOptions.positions = srcPos.slice(firstptdef, lastptdef + 2);\n }\n return lineOptions;\n });\n scene.line2d.update(scene.lineOptions);\n }\n if (scene.error2d) {\n var errorBatch = (scene.errorXOptions || []).concat(scene.errorYOptions || []);\n scene.error2d.update(errorBatch);\n }\n if (scene.scatter2d) {\n scene.scatter2d.update(scene.markerOptions);\n }\n scene.fillOrder = Lib.repeat(null, count);\n if (scene.fill2d) {\n scene.fillOptions = scene.fillOptions.map(function(fillOptions, i2) {\n var cdscatter = cdata[i2];\n if (!fillOptions || !cdscatter || !cdscatter[0] || !cdscatter[0].trace) return;\n var cd = cdscatter[0];\n var trace2 = cd.trace;\n var stash2 = cd.t;\n var lineOptions = scene.lineOptions[i2];\n var last, j2;\n var fillData = [];\n if (trace2._ownfill) fillData.push(i2);\n if (trace2._nexttrace) fillData.push(i2 + 1);\n if (fillData.length) scene.fillOrder[i2] = fillData;\n var pos = [];\n var srcPos = lineOptions && lineOptions.positions || stash2.positions;\n var firstptdef, lastptdef;\n if (trace2.fill === \"tozeroy\") {\n firstptdef = 0;\n while (firstptdef < srcPos.length && isNaN(srcPos[firstptdef + 1])) {\n firstptdef += 2;\n }\n lastptdef = srcPos.length - 2;\n while (lastptdef > firstptdef && isNaN(srcPos[lastptdef + 1])) {\n lastptdef -= 2;\n }\n if (srcPos[firstptdef + 1] !== 0) {\n pos = [srcPos[firstptdef], 0];\n }\n pos = pos.concat(srcPos.slice(firstptdef, lastptdef + 2));\n if (srcPos[lastptdef + 1] !== 0) {\n pos = pos.concat([srcPos[lastptdef], 0]);\n }\n } else if (trace2.fill === \"tozerox\") {\n firstptdef = 0;\n while (firstptdef < srcPos.length && isNaN(srcPos[firstptdef])) {\n firstptdef += 2;\n }\n lastptdef = srcPos.length - 2;\n while (lastptdef > firstptdef && isNaN(srcPos[lastptdef])) {\n lastptdef -= 2;\n }\n if (srcPos[firstptdef] !== 0) {\n pos = [0, srcPos[firstptdef + 1]];\n }\n pos = pos.concat(srcPos.slice(firstptdef, lastptdef + 2));\n if (srcPos[lastptdef] !== 0) {\n pos = pos.concat([0, srcPos[lastptdef + 1]]);\n }\n } else if (trace2.fill === \"toself\" || trace2.fill === \"tonext\") {\n pos = [];\n last = 0;\n fillOptions.splitNull = true;\n for (j2 = 0; j2 < srcPos.length; j2 += 2) {\n if (isNaN(srcPos[j2]) || isNaN(srcPos[j2 + 1])) {\n pos = pos.concat(srcPos.slice(last, j2));\n pos.push(srcPos[last], srcPos[last + 1]);\n pos.push(null, null);\n last = j2 + 2;\n }\n }\n pos = pos.concat(srcPos.slice(last));\n if (last) {\n pos.push(srcPos[last], srcPos[last + 1]);\n }\n } else {\n var nextTrace = trace2._nexttrace;\n if (nextTrace) {\n var nextOptions = scene.lineOptions[i2 + 1];\n if (nextOptions) {\n var nextPos = nextOptions.positions;\n if (trace2.fill === \"tonexty\") {\n pos = srcPos.slice();\n for (i2 = Math.floor(nextPos.length / 2); i2--; ) {\n var xx = nextPos[i2 * 2];\n var yy = nextPos[i2 * 2 + 1];\n if (isNaN(xx) || isNaN(yy)) continue;\n pos.push(xx, yy);\n }\n fillOptions.fill = nextTrace.fillcolor;\n }\n }\n }\n }\n if (trace2._prevtrace && trace2._prevtrace.fill === \"tonext\") {\n var prevLinePos = scene.lineOptions[i2 - 1].positions;\n var offset = pos.length / 2;\n last = offset;\n var hole = [last];\n for (j2 = 0; j2 < prevLinePos.length; j2 += 2) {\n if (isNaN(prevLinePos[j2]) || isNaN(prevLinePos[j2 + 1])) {\n hole.push(j2 / 2 + offset + 1);\n last = j2 + 2;\n }\n }\n pos = pos.concat(prevLinePos);\n fillOptions.hole = hole;\n }\n fillOptions.fillmode = trace2.fill;\n fillOptions.opacity = trace2.opacity;\n fillOptions.positions = pos;\n return fillOptions;\n });\n scene.fill2d.update(scene.fillOptions);\n }\n }\n var dragmode = fullLayout.dragmode;\n var isSelectMode = selectMode(dragmode);\n var clickSelectEnabled = fullLayout.clickmode.indexOf(\"select\") > -1;\n for (i = 0; i < count; i++) {\n var cd0 = cdata[i][0];\n var trace = cd0.trace;\n var stash = cd0.t;\n var index = stash.index;\n var len = trace._length;\n var x = stash.x;\n var y = stash.y;\n if (trace.selectedpoints || isSelectMode || clickSelectEnabled) {\n if (!isSelectMode) isSelectMode = true;\n if (trace.selectedpoints) {\n var selPts = scene.selectBatch[index] = Lib.selIndices2selPoints(trace);\n var selDict = {};\n for (j = 0; j < selPts.length; j++) {\n selDict[selPts[j]] = 1;\n }\n var unselPts = [];\n for (j = 0; j < len; j++) {\n if (!selDict[j]) unselPts.push(j);\n }\n scene.unselectBatch[index] = unselPts;\n }\n var xpx = stash.xpx = new Array(len);\n var ypx = stash.ypx = new Array(len);\n for (j = 0; j < len; j++) {\n xpx[j] = xaxis.c2p(x[j]);\n ypx[j] = yaxis.c2p(y[j]);\n }\n } else {\n stash.xpx = stash.ypx = null;\n }\n }\n if (isSelectMode) {\n if (!scene.select2d) {\n scene.select2d = createScatter(fullLayout._glcanvas.data()[1].regl);\n }\n if (scene.scatter2d) {\n var unselOpts = new Array(count);\n for (i = 0; i < count; i++) {\n unselOpts[i] = scene.selectBatch[i].length || scene.unselectBatch[i].length ? scene.markerUnselectedOptions[i] : {};\n }\n scene.scatter2d.update(unselOpts);\n }\n if (scene.select2d) {\n scene.select2d.update(scene.markerOptions);\n scene.select2d.update(scene.markerSelectedOptions);\n }\n if (scene.glText) {\n cdata.forEach(function(cdscatter) {\n var trace2 = ((cdscatter || [])[0] || {}).trace || {};\n if (subTypes.hasText(trace2)) {\n styleTextSelection(cdscatter);\n }\n });\n }\n } else {\n if (scene.scatter2d) {\n scene.scatter2d.update(scene.markerOptions);\n }\n }\n var vpRange0 = {\n viewport: getViewport(fullLayout, xaxis, yaxis, gd._context.plotGlPixelRatio),\n // TODO do we need those fallbacks?\n range: [\n (xaxis._rl || xaxis.range)[0],\n (yaxis._rl || yaxis.range)[0],\n (xaxis._rl || xaxis.range)[1],\n (yaxis._rl || yaxis.range)[1]\n ]\n };\n var vpRange = Lib.repeat(vpRange0, scene.count);\n if (scene.fill2d) {\n scene.fill2d.update(vpRange);\n }\n if (scene.line2d) {\n scene.line2d.update(vpRange);\n }\n if (scene.error2d) {\n scene.error2d.update(vpRange.concat(vpRange));\n }\n if (scene.scatter2d) {\n scene.scatter2d.update(vpRange);\n }\n if (scene.select2d) {\n scene.select2d.update(vpRange);\n }\n if (scene.glText) {\n scene.glText.forEach(function(text) {\n text.update(vpRange0);\n });\n }\n };\n exports.reglPrecompiled = reglPrecompiled;\n }\n });\n\n // src/traces/scattergl/index.js\n var require_scattergl = __commonJS({\n \"src/traces/scattergl/index.js\"(exports, module) {\n \"use strict\";\n var index = require_base_index();\n index.plot = require_plot19();\n module.exports = index;\n }\n });\n\n // lib/scattergl.js\n var require_scattergl2 = __commonJS({\n \"lib/scattergl.js\"(exports, module) {\n \"use strict\";\n module.exports = require_scattergl();\n }\n });\n\n // src/traces/splom/attributes.js\n var require_attributes51 = __commonJS({\n \"src/traces/splom/attributes.js\"(exports, module) {\n \"use strict\";\n var scatterAttrs = require_attributes12();\n var colorScaleAttrs = require_attributes8();\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var scatterGlAttrs = require_attributes50();\n var cartesianIdRegex = require_constants2().idRegex;\n var templatedArray = require_plot_template().templatedArray;\n var extendFlat = require_extend().extendFlat;\n var scatterMarkerAttrs = scatterAttrs.marker;\n var scatterMarkerLineAttrs = scatterMarkerAttrs.line;\n var markerLineAttrs = extendFlat(colorScaleAttrs(\"marker.line\", { editTypeOverride: \"calc\" }), {\n width: extendFlat({}, scatterMarkerLineAttrs.width, { editType: \"calc\" }),\n editType: \"calc\"\n });\n var markerAttrs = extendFlat(colorScaleAttrs(\"marker\"), {\n symbol: scatterMarkerAttrs.symbol,\n angle: scatterMarkerAttrs.angle,\n size: extendFlat({}, scatterMarkerAttrs.size, { editType: \"markerSize\" }),\n sizeref: scatterMarkerAttrs.sizeref,\n sizemin: scatterMarkerAttrs.sizemin,\n sizemode: scatterMarkerAttrs.sizemode,\n opacity: scatterMarkerAttrs.opacity,\n colorbar: scatterMarkerAttrs.colorbar,\n line: markerLineAttrs,\n editType: \"calc\"\n });\n markerAttrs.color.editType = markerAttrs.cmin.editType = markerAttrs.cmax.editType = \"style\";\n function makeAxesValObject(axLetter) {\n return {\n valType: \"info_array\",\n freeLength: true,\n editType: \"calc\",\n items: {\n valType: \"subplotid\",\n regex: cartesianIdRegex[axLetter],\n editType: \"plot\"\n }\n };\n }\n module.exports = {\n dimensions: templatedArray(\"dimension\", {\n visible: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc\"\n },\n label: {\n valType: \"string\",\n editType: \"calc\"\n },\n values: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n axis: {\n type: {\n valType: \"enumerated\",\n values: [\"linear\", \"log\", \"date\", \"category\"],\n editType: \"calc+clearAxisTypes\"\n },\n // TODO make 'true' the default in v3?\n matches: {\n valType: \"boolean\",\n dflt: false,\n editType: \"calc\"\n },\n editType: \"calc+clearAxisTypes\"\n },\n // TODO should add an attribute to pin down x only vars and y only vars\n // like https://seaborn.pydata.org/generated/seaborn.pairplot.html\n // x_vars and y_vars\n // maybe more axis defaulting option e.g. `showgrid: false`\n editType: \"calc+clearAxisTypes\"\n }),\n // mode: {}, (only 'markers' for now)\n text: extendFlat({}, scatterGlAttrs.text, {}),\n hovertext: extendFlat({}, scatterGlAttrs.hovertext, {}),\n hovertemplate: hovertemplateAttrs(),\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n marker: markerAttrs,\n xaxes: makeAxesValObject(\"x\"),\n yaxes: makeAxesValObject(\"y\"),\n diagonal: {\n visible: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc\"\n },\n // type: 'scattergl' | 'histogram' | 'box' | 'violin'\n // ...\n // more options\n editType: \"calc\"\n },\n showupperhalf: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc\"\n },\n showlowerhalf: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc\"\n },\n selected: {\n marker: scatterGlAttrs.selected.marker,\n editType: \"calc\"\n },\n unselected: {\n marker: scatterGlAttrs.unselected.marker,\n editType: \"calc\"\n },\n opacity: scatterGlAttrs.opacity\n };\n }\n });\n\n // src/traces/parcoords/merge_length.js\n var require_merge_length = __commonJS({\n \"src/traces/parcoords/merge_length.js\"(exports, module) {\n \"use strict\";\n module.exports = function(traceOut, dimensions, dataAttr, len) {\n if (!len) len = Infinity;\n var i, dimi;\n for (i = 0; i < dimensions.length; i++) {\n dimi = dimensions[i];\n if (dimi.visible) len = Math.min(len, dimi[dataAttr].length);\n }\n if (len === Infinity) len = 0;\n traceOut._length = len;\n for (i = 0; i < dimensions.length; i++) {\n dimi = dimensions[i];\n if (dimi.visible) dimi._length = len;\n }\n return len;\n };\n }\n });\n\n // src/traces/splom/defaults.js\n var require_defaults47 = __commonJS({\n \"src/traces/splom/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleArrayContainerDefaults = require_array_container_defaults();\n var attributes = require_attributes51();\n var subTypes = require_subtypes();\n var handleMarkerDefaults = require_marker_defaults();\n var mergeLength = require_merge_length();\n var isOpenSymbol = require_helpers16().isOpenSymbol;\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var dimensions = handleArrayContainerDefaults(traceIn, traceOut, {\n name: \"dimensions\",\n handleItemDefaults: dimensionDefaults\n });\n var showDiag = coerce(\"diagonal.visible\");\n var showUpper = coerce(\"showupperhalf\");\n var showLower = coerce(\"showlowerhalf\");\n var dimLength = mergeLength(traceOut, dimensions, \"values\");\n if (!dimLength || !showDiag && !showUpper && !showLower) {\n traceOut.visible = false;\n return;\n }\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, { noAngleRef: true, noStandOff: true });\n var isOpen = isOpenSymbol(traceOut.marker.symbol);\n var isBubble = subTypes.isBubble(traceOut);\n coerce(\"marker.line.width\", isOpen || isBubble ? 1 : 0);\n handleAxisDefaults(traceIn, traceOut, layout, coerce);\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n };\n function dimensionDefaults(dimIn, dimOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(dimIn, dimOut, attributes.dimensions, attr, dflt);\n }\n coerce(\"label\");\n var values = coerce(\"values\");\n if (!(values && values.length)) dimOut.visible = false;\n else coerce(\"visible\");\n coerce(\"axis.type\");\n coerce(\"axis.matches\");\n }\n function handleAxisDefaults(traceIn, traceOut, layout, coerce) {\n var dimensions = traceOut.dimensions;\n var dimLength = dimensions.length;\n var showUpper = traceOut.showupperhalf;\n var showLower = traceOut.showlowerhalf;\n var showDiag = traceOut.diagonal.visible;\n var i, j;\n var xAxesDflt = new Array(dimLength);\n var yAxesDflt = new Array(dimLength);\n for (i = 0; i < dimLength; i++) {\n var suffix = i ? i + 1 : \"\";\n xAxesDflt[i] = \"x\" + suffix;\n yAxesDflt[i] = \"y\" + suffix;\n }\n var xaxes = coerce(\"xaxes\", xAxesDflt);\n var yaxes = coerce(\"yaxes\", yAxesDflt);\n var diag = traceOut._diag = new Array(dimLength);\n traceOut._xaxes = {};\n traceOut._yaxes = {};\n var xList = [];\n var yList = [];\n function fillAxisStashes(axId, counterAxId, dim2, list) {\n if (!axId) return;\n var axLetter = axId.charAt(0);\n var stash = layout._splomAxes[axLetter];\n traceOut[\"_\" + axLetter + \"axes\"][axId] = 1;\n list.push(axId);\n if (!(axId in stash)) {\n var s = stash[axId] = {};\n if (dim2) {\n s.label = dim2.label || \"\";\n if (dim2.visible && dim2.axis) {\n if (dim2.axis.type) s.type = dim2.axis.type;\n if (dim2.axis.matches) s.matches = counterAxId;\n }\n }\n }\n }\n var mustShiftX = !showDiag && !showLower;\n var mustShiftY = !showDiag && !showUpper;\n traceOut._axesDim = {};\n for (i = 0; i < dimLength; i++) {\n var dim = dimensions[i];\n var i0 = i === 0;\n var iN = i === dimLength - 1;\n var xaId = i0 && mustShiftX || iN && mustShiftY ? void 0 : xaxes[i];\n var yaId = i0 && mustShiftY || iN && mustShiftX ? void 0 : yaxes[i];\n fillAxisStashes(xaId, yaId, dim, xList);\n fillAxisStashes(yaId, xaId, dim, yList);\n diag[i] = [xaId, yaId];\n traceOut._axesDim[xaId] = i;\n traceOut._axesDim[yaId] = i;\n }\n for (i = 0; i < xList.length; i++) {\n for (j = 0; j < yList.length; j++) {\n var id = xList[i] + yList[j];\n if (i > j && showUpper) {\n layout._splomSubplots[id] = 1;\n } else if (i < j && showLower) {\n layout._splomSubplots[id] = 1;\n } else if (i === j && (showDiag || !showLower || !showUpper)) {\n layout._splomSubplots[id] = 1;\n }\n }\n }\n if (!showLower || !showDiag && showUpper && showLower) {\n layout._splomGridDflt.xside = \"bottom\";\n layout._splomGridDflt.yside = \"left\";\n }\n }\n }\n });\n\n // src/traces/splom/scene_update.js\n var require_scene_update2 = __commonJS({\n \"src/traces/splom/scene_update.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n module.exports = function sceneUpdate(gd, trace) {\n var fullLayout = gd._fullLayout;\n var uid = trace.uid;\n var splomScenes = fullLayout._splomScenes;\n if (!splomScenes) splomScenes = fullLayout._splomScenes = {};\n var reset = {\n dirty: true,\n selectBatch: [],\n unselectBatch: []\n };\n var first = {\n matrix: false,\n selectBatch: [],\n unselectBatch: []\n };\n var scene = splomScenes[trace.uid];\n if (!scene) {\n scene = splomScenes[uid] = Lib.extendFlat({}, reset, first);\n scene.draw = function draw() {\n if (scene.matrix && scene.matrix.draw) {\n if (scene.selectBatch.length || scene.unselectBatch.length) {\n scene.matrix.draw(scene.unselectBatch, scene.selectBatch);\n } else {\n scene.matrix.draw();\n }\n }\n scene.dirty = false;\n };\n scene.destroy = function destroy() {\n if (scene.matrix && scene.matrix.destroy) {\n scene.matrix.destroy();\n }\n scene.matrixOptions = null;\n scene.selectBatch = null;\n scene.unselectBatch = null;\n scene = null;\n };\n }\n if (!scene.dirty) {\n Lib.extendFlat(scene, reset);\n }\n return scene;\n };\n }\n });\n\n // src/traces/splom/calc.js\n var require_calc30 = __commonJS({\n \"src/traces/splom/calc.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var AxisIDs = require_axis_ids();\n var calcMarkerSize = require_calc3().calcMarkerSize;\n var calcAxisExpansion = require_calc3().calcAxisExpansion;\n var calcColorscale = require_colorscale_calc();\n var convertMarkerSelection = require_convert10().markerSelection;\n var convertMarkerStyle = require_convert10().markerStyle;\n var sceneUpdate = require_scene_update2();\n var BADNUM = require_numerical().BADNUM;\n var TOO_MANY_POINTS = require_constants23().TOO_MANY_POINTS;\n module.exports = function calc(gd, trace) {\n var dimensions = trace.dimensions;\n var commonLength = trace._length;\n var opts = {};\n var cdata = opts.cdata = [];\n var ldata = opts.data = [];\n var visibleDims = trace._visibleDims = [];\n var i, k, dim, xa, ya;\n function makeCalcdata(ax, dim2) {\n var ccol = ax.makeCalcdata({\n v: dim2.values,\n vcalendar: trace.calendar\n }, \"v\");\n for (var j = 0; j < ccol.length; j++) {\n ccol[j] = ccol[j] === BADNUM ? NaN : ccol[j];\n }\n cdata.push(ccol);\n ldata.push(ax.type === \"log\" ? Lib.simpleMap(ccol, ax.c2l) : ccol);\n }\n for (i = 0; i < dimensions.length; i++) {\n dim = dimensions[i];\n if (dim.visible) {\n xa = AxisIDs.getFromId(gd, trace._diag[i][0]);\n ya = AxisIDs.getFromId(gd, trace._diag[i][1]);\n if (xa && ya && xa.type !== ya.type) {\n Lib.log(\"Skipping splom dimension \" + i + \" with conflicting axis types\");\n continue;\n }\n if (xa) {\n makeCalcdata(xa, dim);\n if (ya && ya.type === \"category\") {\n ya._categories = xa._categories.slice();\n }\n } else {\n makeCalcdata(ya, dim);\n }\n visibleDims.push(i);\n }\n }\n calcColorscale(gd, trace);\n Lib.extendFlat(opts, convertMarkerStyle(gd, trace));\n var visibleLength = cdata.length;\n var hasTooManyPoints = visibleLength * commonLength > TOO_MANY_POINTS;\n var ppad;\n if (hasTooManyPoints) {\n ppad = opts.sizeAvg || Math.max(opts.size, 3);\n } else {\n ppad = calcMarkerSize(trace, commonLength);\n }\n for (k = 0; k < visibleDims.length; k++) {\n i = visibleDims[k];\n dim = dimensions[i];\n xa = AxisIDs.getFromId(gd, trace._diag[i][0]) || {};\n ya = AxisIDs.getFromId(gd, trace._diag[i][1]) || {};\n calcAxisExpansion(gd, trace, xa, ya, cdata[k], cdata[k], ppad);\n }\n var scene = sceneUpdate(gd, trace);\n if (!scene.matrix) scene.matrix = true;\n scene.matrixOptions = opts;\n scene.selectedOptions = convertMarkerSelection(gd, trace, trace.selected);\n scene.unselectedOptions = convertMarkerSelection(gd, trace, trace.unselected);\n return [{ x: false, y: false, t: {}, trace }];\n };\n }\n });\n\n // node_modules/performance-now/lib/performance-now.js\n var require_performance_now = __commonJS({\n \"node_modules/performance-now/lib/performance-now.js\"(exports, module) {\n (function() {\n var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime;\n if (typeof performance !== \"undefined\" && performance !== null && performance.now) {\n module.exports = function() {\n return performance.now();\n };\n } else if (typeof process !== \"undefined\" && process !== null && process.hrtime) {\n module.exports = function() {\n return (getNanoSeconds() - nodeLoadTime) / 1e6;\n };\n hrtime = process.hrtime;\n getNanoSeconds = function() {\n var hr;\n hr = hrtime();\n return hr[0] * 1e9 + hr[1];\n };\n moduleLoadTime = getNanoSeconds();\n upTime = process.uptime() * 1e9;\n nodeLoadTime = moduleLoadTime - upTime;\n } else if (Date.now) {\n module.exports = function() {\n return Date.now() - loadTime;\n };\n loadTime = Date.now();\n } else {\n module.exports = function() {\n return (/* @__PURE__ */ new Date()).getTime() - loadTime;\n };\n loadTime = (/* @__PURE__ */ new Date()).getTime();\n }\n }).call(exports);\n }\n });\n\n // node_modules/raf/index.js\n var require_raf = __commonJS({\n \"node_modules/raf/index.js\"(exports, module) {\n var now = require_performance_now();\n var root = typeof window === \"undefined\" ? window : window;\n var vendors = [\"moz\", \"webkit\"];\n var suffix = \"AnimationFrame\";\n var raf = root[\"request\" + suffix];\n var caf = root[\"cancel\" + suffix] || root[\"cancelRequest\" + suffix];\n for (i = 0; !raf && i < vendors.length; i++) {\n raf = root[vendors[i] + \"Request\" + suffix];\n caf = root[vendors[i] + \"Cancel\" + suffix] || root[vendors[i] + \"CancelRequest\" + suffix];\n }\n var i;\n if (!raf || !caf) {\n last = 0, id = 0, queue = [], frameDuration = 1e3 / 60;\n raf = function(callback) {\n if (queue.length === 0) {\n var _now = now(), next = Math.max(0, frameDuration - (_now - last));\n last = next + _now;\n setTimeout(function() {\n var cp = queue.slice(0);\n queue.length = 0;\n for (var i2 = 0; i2 < cp.length; i2++) {\n if (!cp[i2].cancelled) {\n try {\n cp[i2].callback(last);\n } catch (e) {\n setTimeout(function() {\n throw e;\n }, 0);\n }\n }\n }\n }, Math.round(next));\n }\n queue.push({\n handle: ++id,\n callback,\n cancelled: false\n });\n return id;\n };\n caf = function(handle) {\n for (var i2 = 0; i2 < queue.length; i2++) {\n if (queue[i2].handle === handle) {\n queue[i2].cancelled = true;\n }\n }\n };\n }\n var last;\n var id;\n var queue;\n var frameDuration;\n module.exports = function(fn) {\n return raf.call(root, fn);\n };\n module.exports.cancel = function() {\n caf.apply(root, arguments);\n };\n module.exports.polyfill = function(object) {\n if (!object) {\n object = root;\n }\n object.requestAnimationFrame = raf;\n object.cancelAnimationFrame = caf;\n };\n }\n });\n\n // node_modules/array-range/index.js\n var require_array_range = __commonJS({\n \"node_modules/array-range/index.js\"(exports, module) {\n module.exports = function newArray(start, end) {\n var n0 = typeof start === \"number\", n1 = typeof end === \"number\";\n if (n0 && !n1) {\n end = start;\n start = 0;\n } else if (!n0 && !n1) {\n start = 0;\n end = 0;\n }\n start = start | 0;\n end = end | 0;\n var len = end - start;\n if (len < 0)\n throw new Error(\"array length must be positive\");\n var a = new Array(len);\n for (var i = 0, c = start; i < len; i++, c++)\n a[i] = c;\n return a;\n };\n }\n });\n\n // node_modules/regl-splom/index.js\n var require_regl_splom = __commonJS({\n \"node_modules/regl-splom/index.js\"(exports, module) {\n \"use strict\";\n var createScatter = require_bundle();\n var pick = require_pick_by_alias();\n var getBounds = require_array_bounds();\n var raf = require_raf();\n var arrRange = require_array_range();\n var rect = require_parse_rect();\n var flatten = require_flatten_vertex_data();\n module.exports = SPLOM;\n function SPLOM(regl, options) {\n if (!(this instanceof SPLOM)) return new SPLOM(regl, options);\n this.traces = [];\n this.passes = {};\n this.regl = regl;\n this.scatter = createScatter(regl);\n this.canvas = this.scatter.canvas;\n }\n SPLOM.prototype.render = function(...args) {\n if (args.length) {\n this.update(...args);\n }\n if (this.regl.attributes.preserveDrawingBuffer) return this.draw();\n if (this.dirty) {\n if (this.planned == null) {\n this.planned = raf(() => {\n this.draw();\n this.dirty = true;\n this.planned = null;\n });\n }\n } else {\n this.draw();\n this.dirty = true;\n raf(() => {\n this.dirty = false;\n });\n }\n return this;\n };\n SPLOM.prototype.update = function(...args) {\n if (!args.length) return;\n for (let i = 0; i < args.length; i++) {\n this.updateItem(i, args[i]);\n }\n this.traces = this.traces.filter(Boolean);\n let passes = [];\n let offset = 0;\n for (let i = 0; i < this.traces.length; i++) {\n let trace = this.traces[i];\n let tracePasses = this.traces[i].passes;\n for (let j = 0; j < tracePasses.length; j++) {\n passes.push(this.passes[tracePasses[j]]);\n }\n trace.passOffset = offset;\n offset += trace.passes.length;\n }\n this.scatter.update(...passes);\n return this;\n };\n SPLOM.prototype.updateItem = function(i, options) {\n let { regl } = this;\n if (options === null) {\n this.traces[i] = null;\n return this;\n }\n if (!options) return this;\n let o = pick(options, {\n data: \"data items columns rows values dimensions samples x\",\n snap: \"snap cluster\",\n size: \"sizes size radius\",\n color: \"colors color fill fill-color fillColor\",\n opacity: \"opacity alpha transparency opaque\",\n borderSize: \"borderSizes borderSize border-size bordersize borderWidth borderWidths border-width borderwidth stroke-width strokeWidth strokewidth outline\",\n borderColor: \"borderColors borderColor bordercolor stroke stroke-color strokeColor\",\n marker: \"markers marker shape\",\n range: \"range ranges databox dataBox\",\n viewport: \"viewport viewBox viewbox\",\n domain: \"domain domains area areas\",\n padding: \"pad padding paddings pads margin margins\",\n transpose: \"transpose transposed\",\n diagonal: \"diagonal diag showDiagonal\",\n upper: \"upper up top upperhalf upperHalf showupperhalf showUpper showUpperHalf\",\n lower: \"lower low bottom lowerhalf lowerHalf showlowerhalf showLowerHalf showLower\"\n });\n let trace = this.traces[i] || (this.traces[i] = {\n id: i,\n buffer: regl.buffer({\n usage: \"dynamic\",\n type: \"float\",\n data: new Uint8Array()\n }),\n color: \"black\",\n marker: null,\n size: 12,\n borderColor: \"transparent\",\n borderSize: 1,\n viewport: rect([regl._gl.drawingBufferWidth, regl._gl.drawingBufferHeight]),\n padding: [0, 0, 0, 0],\n opacity: 1,\n diagonal: true,\n upper: true,\n lower: true\n });\n if (o.color != null) {\n trace.color = o.color;\n }\n if (o.size != null) {\n trace.size = o.size;\n }\n if (o.marker != null) {\n trace.marker = o.marker;\n }\n if (o.borderColor != null) {\n trace.borderColor = o.borderColor;\n }\n if (o.borderSize != null) {\n trace.borderSize = o.borderSize;\n }\n if (o.opacity != null) {\n trace.opacity = o.opacity;\n }\n if (o.viewport) {\n trace.viewport = rect(o.viewport);\n }\n if (o.diagonal != null) trace.diagonal = o.diagonal;\n if (o.upper != null) trace.upper = o.upper;\n if (o.lower != null) trace.lower = o.lower;\n if (o.data) {\n trace.buffer(flatten(o.data));\n trace.columns = o.data.length;\n trace.count = o.data[0].length;\n trace.bounds = [];\n for (let i2 = 0; i2 < trace.columns; i2++) {\n trace.bounds[i2] = getBounds(o.data[i2], 1);\n }\n }\n let multirange;\n if (o.range) {\n trace.range = o.range;\n multirange = trace.range && typeof trace.range[0] !== \"number\";\n }\n if (o.domain) {\n trace.domain = o.domain;\n }\n let multipadding = false;\n if (o.padding != null) {\n if (Array.isArray(o.padding) && o.padding.length === trace.columns && typeof o.padding[o.padding.length - 1] === \"number\") {\n trace.padding = o.padding.map(getPad);\n multipadding = true;\n } else {\n trace.padding = getPad(o.padding);\n }\n }\n let m = trace.columns;\n let n = trace.count;\n let w = trace.viewport.width;\n let h = trace.viewport.height;\n let left = trace.viewport.x;\n let top = trace.viewport.y;\n let iw = w / m;\n let ih = h / m;\n trace.passes = [];\n for (let i2 = 0; i2 < m; i2++) {\n for (let j = 0; j < m; j++) {\n if (!trace.diagonal && j === i2) continue;\n if (!trace.upper && i2 > j) continue;\n if (!trace.lower && i2 < j) continue;\n let key = passId(trace.id, i2, j);\n let pass = this.passes[key] || (this.passes[key] = {});\n if (o.data) {\n if (o.transpose) {\n pass.positions = {\n x: { buffer: trace.buffer, offset: j, count: n, stride: m },\n y: { buffer: trace.buffer, offset: i2, count: n, stride: m }\n };\n } else {\n pass.positions = {\n x: { buffer: trace.buffer, offset: j * n, count: n },\n y: { buffer: trace.buffer, offset: i2 * n, count: n }\n };\n }\n pass.bounds = getBox(trace.bounds, i2, j);\n }\n if (o.domain || o.viewport || o.data) {\n let pad = multipadding ? getBox(trace.padding, i2, j) : trace.padding;\n if (trace.domain) {\n let [lox, loy, hix, hiy] = getBox(trace.domain, i2, j);\n pass.viewport = [\n left + lox * w + pad[0],\n top + loy * h + pad[1],\n left + hix * w - pad[2],\n top + hiy * h - pad[3]\n ];\n } else {\n pass.viewport = [\n left + j * iw + iw * pad[0],\n top + i2 * ih + ih * pad[1],\n left + (j + 1) * iw - iw * pad[2],\n top + (i2 + 1) * ih - ih * pad[3]\n ];\n }\n }\n if (o.color) pass.color = trace.color;\n if (o.size) pass.size = trace.size;\n if (o.marker) pass.marker = trace.marker;\n if (o.borderSize) pass.borderSize = trace.borderSize;\n if (o.borderColor) pass.borderColor = trace.borderColor;\n if (o.opacity) pass.opacity = trace.opacity;\n if (o.range) {\n pass.range = multirange ? getBox(trace.range, i2, j) : trace.range || pass.bounds;\n }\n trace.passes.push(key);\n }\n }\n return this;\n };\n SPLOM.prototype.draw = function(...args) {\n if (!args.length) {\n this.scatter.draw();\n } else {\n let idx = [];\n for (let i = 0; i < args.length; i++) {\n if (typeof args[i] === \"number\") {\n let { passes, passOffset } = this.traces[args[i]];\n idx.push(...arrRange(passOffset, passOffset + passes.length));\n } else if (args[i].length) {\n let els = args[i];\n let { passes, passOffset } = this.traces[i];\n passes = passes.map((passId2, i2) => {\n idx[passOffset + i2] = els;\n });\n }\n }\n this.scatter.draw(...idx);\n }\n return this;\n };\n SPLOM.prototype.destroy = function() {\n this.traces.forEach((trace) => {\n if (trace.buffer && trace.buffer.destroy) trace.buffer.destroy();\n });\n this.traces = null;\n this.passes = null;\n this.scatter.destroy();\n return this;\n };\n function passId(trace, i, j) {\n let id = trace.id != null ? trace.id : trace;\n let n = i;\n let m = j;\n let key = id << 16 | (n & 255) << 8 | m & 255;\n return key;\n }\n function getBox(items, i, j) {\n let ilox, iloy, ihix, ihiy, jlox, jloy, jhix, jhiy;\n let iitem = items[i], jitem = items[j];\n if (iitem.length > 2) {\n ilox = iitem[0];\n ihix = iitem[2];\n iloy = iitem[1];\n ihiy = iitem[3];\n } else if (iitem.length) {\n ilox = iloy = iitem[0];\n ihix = ihiy = iitem[1];\n } else {\n ilox = iitem.x;\n iloy = iitem.y;\n ihix = iitem.x + iitem.width;\n ihiy = iitem.y + iitem.height;\n }\n if (jitem.length > 2) {\n jlox = jitem[0];\n jhix = jitem[2];\n jloy = jitem[1];\n jhiy = jitem[3];\n } else if (jitem.length) {\n jlox = jloy = jitem[0];\n jhix = jhiy = jitem[1];\n } else {\n jlox = jitem.x;\n jloy = jitem.y;\n jhix = jitem.x + jitem.width;\n jhiy = jitem.y + jitem.height;\n }\n return [jlox, iloy, jhix, ihiy];\n }\n function getPad(arg) {\n if (typeof arg === \"number\") return [arg, arg, arg, arg];\n else if (arg.length === 2) return [arg[0], arg[1], arg[0], arg[1]];\n else {\n let box = rect(arg);\n return [box.x, box.y, box.x + box.width, box.y + box.height];\n }\n }\n }\n });\n\n // src/traces/splom/plot.js\n var require_plot20 = __commonJS({\n \"src/traces/splom/plot.js\"(exports, module) {\n \"use strict\";\n var createMatrix = require_regl_splom();\n var Lib = require_lib();\n var AxisIDs = require_axis_ids();\n var selectMode = require_helpers5().selectMode;\n module.exports = function plot(gd, _, splomCalcData) {\n if (!splomCalcData.length) return;\n for (var i = 0; i < splomCalcData.length; i++) {\n plotOne(gd, splomCalcData[i][0]);\n }\n };\n function plotOne(gd, cd0) {\n var fullLayout = gd._fullLayout;\n var gs = fullLayout._size;\n var trace = cd0.trace;\n var stash = cd0.t;\n var scene = fullLayout._splomScenes[trace.uid];\n var matrixOpts = scene.matrixOptions;\n var cdata = matrixOpts.cdata;\n var regl = fullLayout._glcanvas.data()[0].regl;\n var dragmode = fullLayout.dragmode;\n var xa, ya;\n var i, j, k;\n if (cdata.length === 0) return;\n matrixOpts.lower = trace.showupperhalf;\n matrixOpts.upper = trace.showlowerhalf;\n matrixOpts.diagonal = trace.diagonal.visible;\n var visibleDims = trace._visibleDims;\n var visibleLength = cdata.length;\n var viewOpts = scene.viewOpts = {};\n viewOpts.ranges = new Array(visibleLength);\n viewOpts.domains = new Array(visibleLength);\n for (k = 0; k < visibleDims.length; k++) {\n i = visibleDims[k];\n var rng = viewOpts.ranges[k] = new Array(4);\n var dmn = viewOpts.domains[k] = new Array(4);\n xa = AxisIDs.getFromId(gd, trace._diag[i][0]);\n if (xa) {\n rng[0] = xa._rl[0];\n rng[2] = xa._rl[1];\n dmn[0] = xa.domain[0];\n dmn[2] = xa.domain[1];\n }\n ya = AxisIDs.getFromId(gd, trace._diag[i][1]);\n if (ya) {\n rng[1] = ya._rl[0];\n rng[3] = ya._rl[1];\n dmn[1] = ya.domain[0];\n dmn[3] = ya.domain[1];\n }\n }\n var plotGlPixelRatio = gd._context.plotGlPixelRatio;\n var l = gs.l * plotGlPixelRatio;\n var b = gs.b * plotGlPixelRatio;\n var w = gs.w * plotGlPixelRatio;\n var h = gs.h * plotGlPixelRatio;\n viewOpts.viewport = [l, b, w + l, h + b];\n if (scene.matrix === true) {\n scene.matrix = createMatrix(regl);\n }\n var clickSelectEnabled = fullLayout.clickmode.indexOf(\"select\") > -1;\n var isSelectMode = selectMode(dragmode) || !!trace.selectedpoints || clickSelectEnabled;\n var needsBaseUpdate = true;\n if (isSelectMode) {\n var commonLength = trace._length;\n if (trace.selectedpoints) {\n scene.selectBatch = trace.selectedpoints;\n var selPts = trace.selectedpoints;\n var selDict = {};\n for (i = 0; i < selPts.length; i++) {\n selDict[selPts[i]] = true;\n }\n var unselPts = [];\n for (i = 0; i < commonLength; i++) {\n if (!selDict[i]) unselPts.push(i);\n }\n scene.unselectBatch = unselPts;\n }\n var xpx = stash.xpx = new Array(visibleLength);\n var ypx = stash.ypx = new Array(visibleLength);\n for (k = 0; k < visibleDims.length; k++) {\n i = visibleDims[k];\n xa = AxisIDs.getFromId(gd, trace._diag[i][0]);\n if (xa) {\n xpx[k] = new Array(commonLength);\n for (j = 0; j < commonLength; j++) {\n xpx[k][j] = xa.c2p(cdata[k][j]);\n }\n }\n ya = AxisIDs.getFromId(gd, trace._diag[i][1]);\n if (ya) {\n ypx[k] = new Array(commonLength);\n for (j = 0; j < commonLength; j++) {\n ypx[k][j] = ya.c2p(cdata[k][j]);\n }\n }\n }\n if (scene.selectBatch.length || scene.unselectBatch.length) {\n var unselOpts = Lib.extendFlat({}, matrixOpts, scene.unselectedOptions, viewOpts);\n var selOpts = Lib.extendFlat({}, matrixOpts, scene.selectedOptions, viewOpts);\n scene.matrix.update(unselOpts, selOpts);\n needsBaseUpdate = false;\n }\n } else {\n stash.xpx = stash.ypx = null;\n }\n if (needsBaseUpdate) {\n var opts = Lib.extendFlat({}, matrixOpts, viewOpts);\n scene.matrix.update(opts, null);\n }\n }\n }\n });\n\n // src/traces/splom/helpers.js\n var require_helpers17 = __commonJS({\n \"src/traces/splom/helpers.js\"(exports) {\n \"use strict\";\n exports.getDimIndex = function getDimIndex(trace, ax) {\n var axId = ax._id;\n var axLetter = axId.charAt(0);\n var ind = { x: 0, y: 1 }[axLetter];\n var visibleDims = trace._visibleDims;\n for (var k = 0; k < visibleDims.length; k++) {\n var i = visibleDims[k];\n if (trace._diag[i][ind] === axId) return k;\n }\n return false;\n };\n }\n });\n\n // src/traces/splom/hover.js\n var require_hover17 = __commonJS({\n \"src/traces/splom/hover.js\"(exports, module) {\n \"use strict\";\n var helpers = require_helpers17();\n var calcHover = require_hover16().calcHover;\n var getFromId = require_axes().getFromId;\n var extendFlat = require_extend().extendFlat;\n function hoverPoints(pointData, xval, yval, hovermode, opts) {\n if (!opts) opts = {};\n var hovermodeHasX = (hovermode || \"\").charAt(0) === \"x\";\n var hovermodeHasY = (hovermode || \"\").charAt(0) === \"y\";\n var points = _hoverPoints(pointData, xval, yval);\n if ((hovermodeHasX || hovermodeHasY) && opts.hoversubplots === \"axis\" && points[0]) {\n var subplotsWith = (hovermodeHasX ? pointData.xa : pointData.ya)._subplotsWith;\n var gd = opts.gd;\n var _pointData = extendFlat({}, pointData);\n for (var i = 0; i < subplotsWith.length; i++) {\n var spId = subplotsWith[i];\n if (spId === pointData.xa._id + pointData.ya._id) continue;\n if (hovermodeHasY) {\n _pointData.xa = getFromId(gd, spId, \"x\");\n } else {\n _pointData.ya = getFromId(gd, spId, \"y\");\n }\n var axisHoversubplots = hovermodeHasX || hovermodeHasY;\n var newPoints = _hoverPoints(_pointData, xval, yval, axisHoversubplots);\n points = points.concat(newPoints);\n }\n }\n return points;\n }\n function _hoverPoints(pointData, xval, yval, axisHoversubplots) {\n var cd = pointData.cd;\n var trace = cd[0].trace;\n var scene = pointData.scene;\n var cdata = scene.matrixOptions.cdata;\n var xa = pointData.xa;\n var ya = pointData.ya;\n var xpx = xa.c2p(xval);\n var ypx = ya.c2p(yval);\n var maxDistance = pointData.distance;\n var xi = helpers.getDimIndex(trace, xa);\n var yi = helpers.getDimIndex(trace, ya);\n if (xi === false || yi === false) return [pointData];\n var x = cdata[xi];\n var y = cdata[yi];\n var id, dxy;\n var minDist = maxDistance;\n for (var i = 0; i < x.length; i++) {\n if (axisHoversubplots && i !== pointData.index) continue;\n var ptx = x[i];\n var pty = y[i];\n var dx = xa.c2p(ptx) - xpx;\n var dy = ya.c2p(pty) - ypx;\n var dist = Math.sqrt(dx * dx + dy * dy);\n if (axisHoversubplots || dist < minDist) {\n minDist = dxy = dist;\n id = i;\n }\n }\n pointData.index = id;\n pointData.distance = minDist;\n pointData.dxy = dxy;\n if (id === void 0) return [pointData];\n return [calcHover(pointData, x, y, trace)];\n }\n module.exports = {\n hoverPoints\n };\n }\n });\n\n // src/traces/splom/select.js\n var require_select8 = __commonJS({\n \"src/traces/splom/select.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var pushUnique = Lib.pushUnique;\n var subTypes = require_subtypes();\n var helpers = require_helpers17();\n module.exports = function select(searchInfo, selectionTester) {\n var cd = searchInfo.cd;\n var trace = cd[0].trace;\n var stash = cd[0].t;\n var scene = searchInfo.scene;\n var cdata = scene.matrixOptions.cdata;\n var xa = searchInfo.xaxis;\n var ya = searchInfo.yaxis;\n var selection = [];\n if (!scene) return selection;\n var hasOnlyLines = !subTypes.hasMarkers(trace) && !subTypes.hasText(trace);\n if (trace.visible !== true || hasOnlyLines) return selection;\n var xi = helpers.getDimIndex(trace, xa);\n var yi = helpers.getDimIndex(trace, ya);\n if (xi === false || yi === false) return selection;\n var xpx = stash.xpx[xi];\n var ypx = stash.ypx[yi];\n var x = cdata[xi];\n var y = cdata[yi];\n var els = (searchInfo.scene.selectBatch || []).slice();\n var unels = [];\n if (selectionTester !== false && !selectionTester.degenerate) {\n for (var i = 0; i < x.length; i++) {\n if (selectionTester.contains([xpx[i], ypx[i]], null, i, searchInfo)) {\n selection.push({\n pointNumber: i,\n x: x[i],\n y: y[i]\n });\n pushUnique(els, i);\n } else if (els.indexOf(i) !== -1) {\n pushUnique(els, i);\n } else {\n unels.push(i);\n }\n }\n }\n var matrixOpts = scene.matrixOptions;\n if (!els.length && !unels.length) {\n scene.matrix.update(matrixOpts, null);\n } else if (!scene.selectBatch.length && !scene.unselectBatch.length) {\n scene.matrix.update(\n scene.unselectedOptions,\n Lib.extendFlat({}, matrixOpts, scene.selectedOptions, scene.viewOpts)\n );\n }\n scene.selectBatch = els;\n scene.unselectBatch = unels;\n return selection;\n };\n }\n });\n\n // src/traces/splom/edit_style.js\n var require_edit_style2 = __commonJS({\n \"src/traces/splom/edit_style.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var calcColorscale = require_colorscale_calc();\n var convertMarkerStyle = require_convert10().markerStyle;\n module.exports = function editStyle(gd, cd0) {\n var trace = cd0.trace;\n var scene = gd._fullLayout._splomScenes[trace.uid];\n if (scene) {\n calcColorscale(gd, trace);\n Lib.extendFlat(scene.matrixOptions, convertMarkerStyle(gd, trace));\n var opts = Lib.extendFlat({}, scene.matrixOptions, scene.viewOpts);\n scene.matrix.update(opts, null);\n }\n };\n }\n });\n\n // src/traces/splom/base_index.js\n var require_base_index2 = __commonJS({\n \"src/traces/splom/base_index.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var Grid = require_grid();\n module.exports = {\n moduleType: \"trace\",\n name: \"splom\",\n categories: [\"gl\", \"regl\", \"cartesian\", \"symbols\", \"showLegend\", \"scatter-like\"],\n attributes: require_attributes51(),\n supplyDefaults: require_defaults47(),\n colorbar: require_marker_colorbar(),\n calc: require_calc30(),\n plot: require_plot20(),\n hoverPoints: require_hover17().hoverPoints,\n selectPoints: require_select8(),\n editStyle: require_edit_style2(),\n meta: {}\n };\n Registry.register(Grid);\n }\n });\n\n // src/traces/splom/base_plot.js\n var require_base_plot6 = __commonJS({\n \"src/traces/splom/base_plot.js\"(exports, module) {\n \"use strict\";\n var createLine = require_regl_line2d();\n var Registry = require_registry();\n var prepareRegl = require_prepare_regl();\n var getModuleCalcData = require_get_data().getModuleCalcData;\n var Cartesian = require_cartesian();\n var getFromId = require_axis_ids().getFromId;\n var shouldShowZeroLine = require_axes().shouldShowZeroLine;\n var SPLOM = \"splom\";\n var reglPrecompiled = {};\n function plot(gd) {\n var fullLayout = gd._fullLayout;\n var _module = Registry.getModule(SPLOM);\n var splomCalcData = getModuleCalcData(gd.calcdata, _module)[0];\n var success = prepareRegl(gd, [\"ANGLE_instanced_arrays\", \"OES_element_index_uint\"], reglPrecompiled);\n if (!success) return;\n if (fullLayout._hasOnlyLargeSploms) {\n updateGrid(gd);\n }\n _module.plot(gd, {}, splomCalcData);\n }\n function drag(gd) {\n var cd = gd.calcdata;\n var fullLayout = gd._fullLayout;\n if (fullLayout._hasOnlyLargeSploms) {\n updateGrid(gd);\n }\n for (var i = 0; i < cd.length; i++) {\n var cd0 = cd[i][0];\n var trace = cd0.trace;\n var scene = fullLayout._splomScenes[trace.uid];\n if (trace.type === \"splom\" && scene && scene.matrix) {\n dragOne(gd, trace, scene);\n }\n }\n }\n function dragOne(gd, trace, scene) {\n var visibleLength = scene.matrixOptions.data.length;\n var visibleDims = trace._visibleDims;\n var ranges = scene.viewOpts.ranges = new Array(visibleLength);\n for (var k = 0; k < visibleDims.length; k++) {\n var i = visibleDims[k];\n var rng = ranges[k] = new Array(4);\n var xa = getFromId(gd, trace._diag[i][0]);\n if (xa) {\n rng[0] = xa.r2l(xa.range[0]);\n rng[2] = xa.r2l(xa.range[1]);\n }\n var ya = getFromId(gd, trace._diag[i][1]);\n if (ya) {\n rng[1] = ya.r2l(ya.range[0]);\n rng[3] = ya.r2l(ya.range[1]);\n }\n }\n if (scene.selectBatch.length || scene.unselectBatch.length) {\n scene.matrix.update({ ranges }, { ranges });\n } else {\n scene.matrix.update({ ranges });\n }\n }\n function updateGrid(gd) {\n var fullLayout = gd._fullLayout;\n var regl = fullLayout._glcanvas.data()[0].regl;\n var splomGrid = fullLayout._splomGrid;\n if (!splomGrid) {\n splomGrid = fullLayout._splomGrid = createLine(regl);\n }\n splomGrid.update(makeGridData(gd));\n }\n function makeGridData(gd) {\n var plotGlPixelRatio = gd._context.plotGlPixelRatio;\n var fullLayout = gd._fullLayout;\n var gs = fullLayout._size;\n var fullView = [\n 0,\n 0,\n fullLayout.width * plotGlPixelRatio,\n fullLayout.height * plotGlPixelRatio\n ];\n var lookup = {};\n var k;\n function push(prefix, ax, x0, x1, y0, y1) {\n x0 *= plotGlPixelRatio;\n x1 *= plotGlPixelRatio;\n y0 *= plotGlPixelRatio;\n y1 *= plotGlPixelRatio;\n var lcolor = ax[prefix + \"color\"];\n var lwidth = ax[prefix + \"width\"];\n var key = String(lcolor + lwidth);\n if (key in lookup) {\n lookup[key].data.push(NaN, NaN, x0, x1, y0, y1);\n } else {\n lookup[key] = {\n data: [x0, x1, y0, y1],\n join: \"rect\",\n thickness: lwidth * plotGlPixelRatio,\n color: lcolor,\n viewport: fullView,\n range: fullView,\n overlay: false\n };\n }\n }\n for (k in fullLayout._splomSubplots) {\n var sp = fullLayout._plots[k];\n var xa = sp.xaxis;\n var ya = sp.yaxis;\n var xVals = xa._gridVals;\n var yVals = ya._gridVals;\n var xOffset = xa._offset;\n var xLength = xa._length;\n var yLength = ya._length;\n var yOffset = gs.b + ya.domain[0] * gs.h;\n var ym = -ya._m;\n var yb = -ym * ya.r2l(ya.range[0], ya.calendar);\n var x, y;\n if (xa.showgrid) {\n for (k = 0; k < xVals.length; k++) {\n x = xOffset + xa.l2p(xVals[k].x);\n push(\"grid\", xa, x, yOffset, x, yOffset + yLength);\n }\n }\n if (ya.showgrid) {\n for (k = 0; k < yVals.length; k++) {\n y = yOffset + yb + ym * yVals[k].x;\n push(\"grid\", ya, xOffset, y, xOffset + xLength, y);\n }\n }\n if (shouldShowZeroLine(gd, xa, ya)) {\n x = xOffset + xa.l2p(0);\n push(\"zeroline\", xa, x, yOffset, x, yOffset + yLength);\n }\n if (shouldShowZeroLine(gd, ya, xa)) {\n y = yOffset + yb + 0;\n push(\"zeroline\", ya, xOffset, y, xOffset + xLength, y);\n }\n }\n var gridBatches = [];\n for (k in lookup) {\n gridBatches.push(lookup[k]);\n }\n return gridBatches;\n }\n function clean(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var lookup = {};\n var i;\n if (oldFullLayout._splomScenes) {\n for (i = 0; i < newFullData.length; i++) {\n var newTrace = newFullData[i];\n if (newTrace.type === \"splom\") {\n lookup[newTrace.uid] = 1;\n }\n }\n for (i = 0; i < oldFullData.length; i++) {\n var oldTrace = oldFullData[i];\n if (!lookup[oldTrace.uid]) {\n var scene = oldFullLayout._splomScenes[oldTrace.uid];\n if (scene && scene.destroy) scene.destroy();\n oldFullLayout._splomScenes[oldTrace.uid] = null;\n delete oldFullLayout._splomScenes[oldTrace.uid];\n }\n }\n }\n if (Object.keys(oldFullLayout._splomScenes || {}).length === 0) {\n delete oldFullLayout._splomScenes;\n }\n if (oldFullLayout._splomGrid && (!newFullLayout._hasOnlyLargeSploms && oldFullLayout._hasOnlyLargeSploms)) {\n oldFullLayout._splomGrid.destroy();\n oldFullLayout._splomGrid = null;\n delete oldFullLayout._splomGrid;\n }\n Cartesian.clean(newFullData, newFullLayout, oldFullData, oldFullLayout);\n }\n module.exports = {\n name: SPLOM,\n attr: Cartesian.attr,\n attrRegex: Cartesian.attrRegex,\n layoutAttributes: Cartesian.layoutAttributes,\n supplyLayoutDefaults: Cartesian.supplyLayoutDefaults,\n drawFramework: Cartesian.drawFramework,\n plot,\n drag,\n updateGrid,\n clean,\n updateFx: Cartesian.updateFx,\n toSVG: Cartesian.toSVG,\n reglPrecompiled\n };\n }\n });\n\n // src/traces/splom/index.js\n var require_splom = __commonJS({\n \"src/traces/splom/index.js\"(exports, module) {\n \"use strict\";\n var index = require_base_index2();\n index.basePlotModule = require_base_plot6(), module.exports = index;\n }\n });\n\n // lib/splom.js\n var require_splom2 = __commonJS({\n \"lib/splom.js\"(exports, module) {\n \"use strict\";\n module.exports = require_splom();\n }\n });\n\n // src/traces/parcoords/attributes.js\n var require_attributes52 = __commonJS({\n \"src/traces/parcoords/attributes.js\"(exports, module) {\n \"use strict\";\n var colorScaleAttrs = require_attributes8();\n var axesAttrs = require_layout_attributes4();\n var fontAttrs = require_font_attributes();\n var domainAttrs = require_domain().attributes;\n var extendFlat = require_extend().extendFlat;\n var templatedArray = require_plot_template().templatedArray;\n module.exports = {\n domain: domainAttrs({ name: \"parcoords\", trace: true, editType: \"plot\" }),\n labelangle: {\n valType: \"angle\",\n dflt: 0,\n editType: \"plot\"\n },\n labelside: {\n valType: \"enumerated\",\n values: [\"top\", \"bottom\"],\n dflt: \"top\",\n editType: \"plot\"\n },\n labelfont: fontAttrs({\n editType: \"plot\"\n }),\n tickfont: fontAttrs({\n autoShadowDflt: true,\n editType: \"plot\"\n }),\n rangefont: fontAttrs({\n editType: \"plot\"\n }),\n dimensions: templatedArray(\"dimension\", {\n label: {\n valType: \"string\",\n editType: \"plot\"\n },\n // TODO: better way to determine ordinal vs continuous axes,\n // so users can use tickvals/ticktext with a continuous axis.\n tickvals: extendFlat({}, axesAttrs.tickvals, {\n editType: \"plot\"\n }),\n ticktext: extendFlat({}, axesAttrs.ticktext, {\n editType: \"plot\"\n }),\n tickformat: extendFlat({}, axesAttrs.tickformat, {\n editType: \"plot\"\n }),\n visible: {\n valType: \"boolean\",\n dflt: true,\n editType: \"plot\"\n },\n range: {\n valType: \"info_array\",\n items: [\n { valType: \"number\", editType: \"plot\" },\n { valType: \"number\", editType: \"plot\" }\n ],\n editType: \"plot\"\n },\n constraintrange: {\n valType: \"info_array\",\n freeLength: true,\n dimensions: \"1-2\",\n items: [\n { valType: \"any\", editType: \"plot\" },\n { valType: \"any\", editType: \"plot\" }\n ],\n editType: \"plot\"\n },\n multiselect: {\n valType: \"boolean\",\n dflt: true,\n editType: \"plot\"\n },\n values: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n editType: \"calc\"\n }),\n line: extendFlat(\n { editType: \"calc\" },\n colorScaleAttrs(\"line\", {\n // the default autocolorscale isn't quite usable for parcoords due to context ambiguity around 0 (grey, off-white)\n // autocolorscale therefore defaults to false too, to avoid being overridden by the blue-white-red autocolor palette\n colorscaleDflt: \"Viridis\",\n autoColorDflt: false,\n editTypeOverride: \"calc\"\n })\n ),\n unselected: {\n line: {\n color: {\n valType: \"color\",\n dflt: \"#7f7f7f\",\n editType: \"plot\"\n },\n opacity: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: \"auto\",\n editType: \"plot\"\n },\n editType: \"plot\"\n },\n editType: \"plot\"\n }\n };\n }\n });\n\n // src/traces/parcoords/constants.js\n var require_constants24 = __commonJS({\n \"src/traces/parcoords/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n maxDimensionCount: 60,\n // this cannot be increased without WebGL code refactoring\n overdrag: 45,\n verticalPadding: 2,\n // otherwise, horizontal lines on top or bottom are of lower width\n tickDistance: 50,\n canvasPixelRatio: 1,\n blockLineCount: 5e3,\n layers: [\"contextLineLayer\", \"focusLineLayer\", \"pickLineLayer\"],\n axisTitleOffset: 28,\n axisExtentOffset: 10,\n bar: {\n width: 4,\n // Visible width of the filter bar\n captureWidth: 10,\n // Mouse-sensitive width for interaction (Fitts law)\n fillColor: \"magenta\",\n // Color of the filter bar fill\n fillOpacity: 1,\n // Filter bar fill opacity\n snapDuration: 150,\n // tween duration in ms for brush snap for ordinal axes\n snapRatio: 0.25,\n // ratio of bar extension relative to the distance between two adjacent ordinal values\n snapClose: 0.01,\n // fraction of inter-value distance to snap to the closer one, even if you're not over it\n strokeOpacity: 1,\n // Filter bar side stroke opacity\n strokeWidth: 1,\n // Filter bar side stroke width in pixels\n handleHeight: 8,\n // Height of the filter bar vertical resize areas on top and bottom\n handleOpacity: 1,\n // Opacity of the filter bar vertical resize areas on top and bottom\n handleOverlap: 0\n // A larger than 0 value causes overlaps with the filter bar, represented as pixels\n },\n cn: {\n axisExtentText: \"axis-extent-text\",\n parcoordsLineLayers: \"parcoords-line-layers\",\n parcoordsLineLayer: \"parcoords-lines\",\n parcoords: \"parcoords\",\n parcoordsControlView: \"parcoords-control-view\",\n yAxis: \"y-axis\",\n axisOverlays: \"axis-overlays\",\n axis: \"axis\",\n axisHeading: \"axis-heading\",\n axisTitle: \"axis-title\",\n axisExtent: \"axis-extent\",\n axisExtentTop: \"axis-extent-top\",\n axisExtentTopText: \"axis-extent-top-text\",\n axisExtentBottom: \"axis-extent-bottom\",\n axisExtentBottomText: \"axis-extent-bottom-text\",\n axisBrush: \"axis-brush\"\n },\n id: {\n filterBarPattern: \"filter-bar-pattern\"\n }\n };\n }\n });\n\n // src/lib/gup.js\n var require_gup = __commonJS({\n \"src/lib/gup.js\"(exports, module) {\n \"use strict\";\n var identity2 = require_identity2();\n function wrap(d) {\n return [d];\n }\n module.exports = {\n // The D3 data binding concept and the General Update Pattern promotes the idea of\n // traversing into the scenegraph by using the `.data(fun, keyFun)` call.\n // The `fun` is most often a `repeat`, ie. the elements beneath a `` element need\n // access to the same data, or a `descend`, which fans a scenegraph node into a bunch of\n // of elements, e.g. points, lines, rows, requiring an array as input.\n // The role of the `keyFun` is to identify what elements are being entered/exited/updated,\n // otherwise D3 reverts to using a plain index which would screw up `transition`s.\n keyFun: function(d) {\n return d.key;\n },\n repeat: wrap,\n descend: identity2,\n // Plotly.js uses a convention of storing the actual contents of the `calcData` as the\n // element zero of a container array. These helpers are just used for clarity as a\n // newcomer to the codebase may not know what the `[0]` is, and whether there can be further\n // elements (not atm).\n wrap,\n unwrap: function(d) {\n return d[0];\n }\n };\n }\n });\n\n // src/traces/parcoords/axisbrush.js\n var require_axisbrush = __commonJS({\n \"src/traces/parcoords/axisbrush.js\"(exports, module) {\n \"use strict\";\n var c = require_constants24();\n var d3 = require_d3();\n var keyFun = require_gup().keyFun;\n var repeat = require_gup().repeat;\n var sortAsc = require_lib().sorterAsc;\n var strTranslate = require_lib().strTranslate;\n var snapRatio = c.bar.snapRatio;\n function snapOvershoot(v, vAdjacent) {\n return v * (1 - snapRatio) + vAdjacent * snapRatio;\n }\n var snapClose = c.bar.snapClose;\n function closeToCovering(v, vAdjacent) {\n return v * (1 - snapClose) + vAdjacent * snapClose;\n }\n function ordinalScaleSnap(isHigh, a, v, existingRanges) {\n if (overlappingExisting(v, existingRanges)) return v;\n var dir = isHigh ? -1 : 1;\n var first = 0;\n var last = a.length - 1;\n if (dir < 0) {\n var tmp = first;\n first = last;\n last = tmp;\n }\n var aHere = a[first];\n var aPrev = aHere;\n for (var i = first; dir * i < dir * last; i += dir) {\n var nextI = i + dir;\n var aNext = a[nextI];\n if (dir * v < dir * closeToCovering(aHere, aNext)) return snapOvershoot(aHere, aPrev);\n if (dir * v < dir * aNext || nextI === last) return snapOvershoot(aNext, aHere);\n aPrev = aHere;\n aHere = aNext;\n }\n }\n function overlappingExisting(v, existingRanges) {\n for (var i = 0; i < existingRanges.length; i++) {\n if (v >= existingRanges[i][0] && v <= existingRanges[i][1]) return true;\n }\n return false;\n }\n function barHorizontalSetup(selection) {\n selection.attr(\"x\", -c.bar.captureWidth / 2).attr(\"width\", c.bar.captureWidth);\n }\n function backgroundBarHorizontalSetup(selection) {\n selection.attr(\"visibility\", \"visible\").style(\"visibility\", \"visible\").attr(\"fill\", \"yellow\").attr(\"opacity\", 0);\n }\n function setHighlight(d) {\n if (!d.brush.filterSpecified) {\n return \"0,\" + d.height;\n }\n var pixelRanges = unitToPx(d.brush.filter.getConsolidated(), d.height);\n var dashArray = [0];\n var p, sectionHeight, iNext;\n var currentGap = pixelRanges.length ? pixelRanges[0][0] : null;\n for (var i = 0; i < pixelRanges.length; i++) {\n p = pixelRanges[i];\n sectionHeight = p[1] - p[0];\n dashArray.push(currentGap);\n dashArray.push(sectionHeight);\n iNext = i + 1;\n if (iNext < pixelRanges.length) {\n currentGap = pixelRanges[iNext][0] - p[1];\n }\n }\n dashArray.push(d.height);\n return dashArray;\n }\n function unitToPx(unitRanges, height) {\n return unitRanges.map(function(pr) {\n return pr.map(function(v) {\n return Math.max(0, v * height);\n }).sort(sortAsc);\n });\n }\n function getRegion(fPix, y) {\n var pad = c.bar.handleHeight;\n if (y > fPix[1] + pad || y < fPix[0] - pad) return;\n if (y >= 0.9 * fPix[1] + 0.1 * fPix[0]) return \"n\";\n if (y <= 0.9 * fPix[0] + 0.1 * fPix[1]) return \"s\";\n return \"ns\";\n }\n function clearCursor() {\n d3.select(document.body).style(\"cursor\", null);\n }\n function styleHighlight(selection) {\n selection.attr(\"stroke-dasharray\", setHighlight);\n }\n function renderHighlight(root, tweenCallback) {\n var bar = d3.select(root).selectAll(\".highlight, .highlight-shadow\");\n var barToStyle = tweenCallback ? bar.transition().duration(c.bar.snapDuration).each(\"end\", tweenCallback) : bar;\n styleHighlight(barToStyle);\n }\n function getInterval(d, y) {\n var b = d.brush;\n var active = b.filterSpecified;\n var closestInterval = NaN;\n var out = {};\n var i;\n if (active) {\n var height = d.height;\n var intervals = b.filter.getConsolidated();\n var pixIntervals = unitToPx(intervals, height);\n var hoveredInterval = NaN;\n var previousInterval = NaN;\n var nextInterval = NaN;\n for (i = 0; i <= pixIntervals.length; i++) {\n var p = pixIntervals[i];\n if (p && p[0] <= y && y <= p[1]) {\n hoveredInterval = i;\n break;\n } else {\n previousInterval = i ? i - 1 : NaN;\n if (p && p[0] > y) {\n nextInterval = i;\n break;\n }\n }\n }\n closestInterval = hoveredInterval;\n if (isNaN(closestInterval)) {\n if (isNaN(previousInterval) || isNaN(nextInterval)) {\n closestInterval = isNaN(previousInterval) ? nextInterval : previousInterval;\n } else {\n closestInterval = y - pixIntervals[previousInterval][1] < pixIntervals[nextInterval][0] - y ? previousInterval : nextInterval;\n }\n }\n if (!isNaN(closestInterval)) {\n var fPix = pixIntervals[closestInterval];\n var region = getRegion(fPix, y);\n if (region) {\n out.interval = intervals[closestInterval];\n out.intervalPix = fPix;\n out.region = region;\n }\n }\n }\n if (d.ordinal && !out.region) {\n var a = d.unitTickvals;\n var unitLocation = d.unitToPaddedPx.invert(y);\n for (i = 0; i < a.length; i++) {\n var rangei = [\n a[Math.max(i - 1, 0)] * 0.25 + a[i] * 0.75,\n a[Math.min(i + 1, a.length - 1)] * 0.25 + a[i] * 0.75\n ];\n if (unitLocation >= rangei[0] && unitLocation <= rangei[1]) {\n out.clickableOrdinalRange = rangei;\n break;\n }\n }\n }\n return out;\n }\n function dragstart(lThis, d) {\n d3.event.sourceEvent.stopPropagation();\n var y = d.height - d3.mouse(lThis)[1] - 2 * c.verticalPadding;\n var unitLocation = d.unitToPaddedPx.invert(y);\n var b = d.brush;\n var interval = getInterval(d, y);\n var unitRange = interval.interval;\n var s = b.svgBrush;\n s.wasDragged = false;\n s.grabbingBar = interval.region === \"ns\";\n if (s.grabbingBar) {\n var pixelRange = unitRange.map(d.unitToPaddedPx);\n s.grabPoint = y - pixelRange[0] - c.verticalPadding;\n s.barLength = pixelRange[1] - pixelRange[0];\n }\n s.clickableOrdinalRange = interval.clickableOrdinalRange;\n s.stayingIntervals = d.multiselect && b.filterSpecified ? b.filter.getConsolidated() : [];\n if (unitRange) {\n s.stayingIntervals = s.stayingIntervals.filter(function(int2) {\n return int2[0] !== unitRange[0] && int2[1] !== unitRange[1];\n });\n }\n s.startExtent = interval.region ? unitRange[interval.region === \"s\" ? 1 : 0] : unitLocation;\n d.parent.inBrushDrag = true;\n s.brushStartCallback();\n }\n function drag(lThis, d) {\n d3.event.sourceEvent.stopPropagation();\n var y = d.height - d3.mouse(lThis)[1] - 2 * c.verticalPadding;\n var s = d.brush.svgBrush;\n s.wasDragged = true;\n s._dragging = true;\n if (s.grabbingBar) {\n s.newExtent = [y - s.grabPoint, y + s.barLength - s.grabPoint].map(d.unitToPaddedPx.invert);\n } else {\n s.newExtent = [s.startExtent, d.unitToPaddedPx.invert(y)].sort(sortAsc);\n }\n d.brush.filterSpecified = true;\n s.extent = s.stayingIntervals.concat([s.newExtent]);\n s.brushCallback(d);\n renderHighlight(lThis.parentNode);\n }\n function dragend(lThis, d) {\n var brush = d.brush;\n var filter = brush.filter;\n var s = brush.svgBrush;\n if (!s._dragging) {\n mousemove(lThis, d);\n drag(lThis, d);\n d.brush.svgBrush.wasDragged = false;\n }\n s._dragging = false;\n var e = d3.event;\n e.sourceEvent.stopPropagation();\n var grabbingBar = s.grabbingBar;\n s.grabbingBar = false;\n s.grabLocation = void 0;\n d.parent.inBrushDrag = false;\n clearCursor();\n if (!s.wasDragged) {\n s.wasDragged = void 0;\n if (s.clickableOrdinalRange) {\n if (brush.filterSpecified && d.multiselect) {\n s.extent.push(s.clickableOrdinalRange);\n } else {\n s.extent = [s.clickableOrdinalRange];\n brush.filterSpecified = true;\n }\n } else if (grabbingBar) {\n s.extent = s.stayingIntervals;\n if (s.extent.length === 0) {\n brushClear(brush);\n }\n } else {\n brushClear(brush);\n }\n s.brushCallback(d);\n renderHighlight(lThis.parentNode);\n s.brushEndCallback(brush.filterSpecified ? filter.getConsolidated() : []);\n return;\n }\n var mergeIntervals = function() {\n filter.set(filter.getConsolidated());\n };\n if (d.ordinal) {\n var a = d.unitTickvals;\n if (a[a.length - 1] < a[0]) a.reverse();\n s.newExtent = [\n ordinalScaleSnap(0, a, s.newExtent[0], s.stayingIntervals),\n ordinalScaleSnap(1, a, s.newExtent[1], s.stayingIntervals)\n ];\n var hasNewExtent = s.newExtent[1] > s.newExtent[0];\n s.extent = s.stayingIntervals.concat(hasNewExtent ? [s.newExtent] : []);\n if (!s.extent.length) {\n brushClear(brush);\n }\n s.brushCallback(d);\n if (hasNewExtent) {\n renderHighlight(lThis.parentNode, mergeIntervals);\n } else {\n mergeIntervals();\n renderHighlight(lThis.parentNode);\n }\n } else {\n mergeIntervals();\n }\n s.brushEndCallback(brush.filterSpecified ? filter.getConsolidated() : []);\n }\n function mousemove(lThis, d) {\n var y = d.height - d3.mouse(lThis)[1] - 2 * c.verticalPadding;\n var interval = getInterval(d, y);\n var cursor = \"crosshair\";\n if (interval.clickableOrdinalRange) cursor = \"pointer\";\n else if (interval.region) cursor = interval.region + \"-resize\";\n d3.select(document.body).style(\"cursor\", cursor);\n }\n function attachDragBehavior(selection) {\n selection.on(\"mousemove\", function(d) {\n d3.event.preventDefault();\n if (!d.parent.inBrushDrag) mousemove(this, d);\n }).on(\"mouseleave\", function(d) {\n if (!d.parent.inBrushDrag) clearCursor();\n }).call(\n d3.behavior.drag().on(\"dragstart\", function(d) {\n dragstart(this, d);\n }).on(\"drag\", function(d) {\n drag(this, d);\n }).on(\"dragend\", function(d) {\n dragend(this, d);\n })\n );\n }\n function startAsc(a, b) {\n return a[0] - b[0];\n }\n function renderAxisBrush(axisBrush, paperColor, gd) {\n var isStatic = gd._context.staticPlot;\n var background = axisBrush.selectAll(\".background\").data(repeat);\n background.enter().append(\"rect\").classed(\"background\", true).call(barHorizontalSetup).call(backgroundBarHorizontalSetup).style(\"pointer-events\", isStatic ? \"none\" : \"auto\").attr(\"transform\", strTranslate(0, c.verticalPadding));\n background.call(attachDragBehavior).attr(\"height\", function(d) {\n return d.height - c.verticalPadding;\n });\n var highlightShadow = axisBrush.selectAll(\".highlight-shadow\").data(repeat);\n highlightShadow.enter().append(\"line\").classed(\"highlight-shadow\", true).attr(\"x\", -c.bar.width / 2).attr(\"stroke-width\", c.bar.width + c.bar.strokeWidth).attr(\"stroke\", paperColor).attr(\"opacity\", c.bar.strokeOpacity).attr(\"stroke-linecap\", \"butt\");\n highlightShadow.attr(\"y1\", function(d) {\n return d.height;\n }).call(styleHighlight);\n var highlight = axisBrush.selectAll(\".highlight\").data(repeat);\n highlight.enter().append(\"line\").classed(\"highlight\", true).attr(\"x\", -c.bar.width / 2).attr(\"stroke-width\", c.bar.width - c.bar.strokeWidth).attr(\"stroke\", c.bar.fillColor).attr(\"opacity\", c.bar.fillOpacity).attr(\"stroke-linecap\", \"butt\");\n highlight.attr(\"y1\", function(d) {\n return d.height;\n }).call(styleHighlight);\n }\n function ensureAxisBrush(axisOverlays, paperColor, gd) {\n var axisBrush = axisOverlays.selectAll(\".\" + c.cn.axisBrush).data(repeat, keyFun);\n axisBrush.enter().append(\"g\").classed(c.cn.axisBrush, true);\n renderAxisBrush(axisBrush, paperColor, gd);\n }\n function getBrushExtent(brush) {\n return brush.svgBrush.extent.map(function(e) {\n return e.slice();\n });\n }\n function brushClear(brush) {\n brush.filterSpecified = false;\n brush.svgBrush.extent = [[-Infinity, Infinity]];\n }\n function axisBrushMoved(callback) {\n return function axisBrushMoved2(dimension) {\n var brush = dimension.brush;\n var extent = getBrushExtent(brush);\n var newExtent = extent.slice();\n brush.filter.set(newExtent);\n callback();\n };\n }\n function dedupeRealRanges(intervals) {\n var queue = intervals.slice();\n var result = [];\n var currentInterval;\n var current = queue.shift();\n while (current) {\n currentInterval = current.slice();\n while ((current = queue.shift()) && current[0] <= /* right-open interval would need `<` */\n currentInterval[1]) {\n currentInterval[1] = Math.max(currentInterval[1], current[1]);\n }\n result.push(currentInterval);\n }\n if (result.length === 1 && result[0][0] > result[0][1]) {\n result = [];\n }\n return result;\n }\n function makeFilter() {\n var filter = [];\n var consolidated;\n var bounds;\n return {\n set: function(a) {\n filter = a.map(function(d) {\n return d.slice().sort(sortAsc);\n }).sort(startAsc);\n if (filter.length === 1 && filter[0][0] === -Infinity && filter[0][1] === Infinity) {\n filter = [[0, -1]];\n }\n consolidated = dedupeRealRanges(filter);\n bounds = filter.reduce(function(p, n) {\n return [Math.min(p[0], n[0]), Math.max(p[1], n[1])];\n }, [Infinity, -Infinity]);\n },\n get: function() {\n return filter.slice();\n },\n getConsolidated: function() {\n return consolidated;\n },\n getBounds: function() {\n return bounds;\n }\n };\n }\n function makeBrush(state, rangeSpecified, initialRange, brushStartCallback, brushCallback, brushEndCallback) {\n var filter = makeFilter();\n filter.set(initialRange);\n return {\n filter,\n filterSpecified: rangeSpecified,\n // there's a difference between not filtering and filtering a non-proper subset\n svgBrush: {\n extent: [],\n // this is where the svgBrush writes contents into\n brushStartCallback,\n brushCallback: axisBrushMoved(brushCallback),\n brushEndCallback\n }\n };\n }\n function cleanRanges(ranges, dimension) {\n if (Array.isArray(ranges[0])) {\n ranges = ranges.map(function(ri) {\n return ri.sort(sortAsc);\n });\n if (!dimension.multiselect) ranges = [ranges[0]];\n else ranges = dedupeRealRanges(ranges.sort(startAsc));\n } else ranges = [ranges.sort(sortAsc)];\n if (dimension.tickvals) {\n var sortedTickVals = dimension.tickvals.slice().sort(sortAsc);\n ranges = ranges.map(function(ri) {\n var rSnapped = [\n ordinalScaleSnap(0, sortedTickVals, ri[0], []),\n ordinalScaleSnap(1, sortedTickVals, ri[1], [])\n ];\n if (rSnapped[1] > rSnapped[0]) return rSnapped;\n }).filter(function(ri) {\n return ri;\n });\n if (!ranges.length) return;\n }\n return ranges.length > 1 ? ranges : ranges[0];\n }\n module.exports = {\n makeBrush,\n ensureAxisBrush,\n cleanRanges\n };\n }\n });\n\n // src/traces/parcoords/defaults.js\n var require_defaults48 = __commonJS({\n \"src/traces/parcoords/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var hasColorscale = require_helpers().hasColorscale;\n var colorscaleDefaults = require_defaults2();\n var handleDomainDefaults = require_domain().defaults;\n var handleArrayContainerDefaults = require_array_container_defaults();\n var Axes = require_axes();\n var attributes = require_attributes52();\n var axisBrush = require_axisbrush();\n var maxDimensionCount = require_constants24().maxDimensionCount;\n var mergeLength = require_merge_length();\n function handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce) {\n var lineColor = coerce(\"line.color\", defaultColor);\n if (hasColorscale(traceIn, \"line\") && Lib.isArrayOrTypedArray(lineColor)) {\n if (lineColor.length) {\n coerce(\"line.colorscale\");\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"line.\", cLetter: \"c\" });\n return lineColor.length;\n } else {\n traceOut.line.color = defaultColor;\n }\n }\n return Infinity;\n }\n function dimensionDefaults(dimensionIn, dimensionOut, parentOut, opts) {\n function coerce(attr, dflt) {\n return Lib.coerce(dimensionIn, dimensionOut, attributes.dimensions, attr, dflt);\n }\n var values = coerce(\"values\");\n var visible = coerce(\"visible\");\n if (!(values && values.length)) {\n visible = dimensionOut.visible = false;\n }\n if (visible) {\n coerce(\"label\");\n coerce(\"tickvals\");\n coerce(\"ticktext\");\n coerce(\"tickformat\");\n var range = coerce(\"range\");\n dimensionOut._ax = {\n _id: \"y\",\n type: \"linear\",\n showexponent: \"all\",\n exponentformat: \"B\",\n range\n };\n Axes.setConvert(dimensionOut._ax, opts.layout);\n coerce(\"multiselect\");\n var constraintRange = coerce(\"constraintrange\");\n if (constraintRange) {\n dimensionOut.constraintrange = axisBrush.cleanRanges(constraintRange, dimensionOut);\n }\n }\n }\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var dimensionsIn = traceIn.dimensions;\n if (Array.isArray(dimensionsIn) && dimensionsIn.length > maxDimensionCount) {\n Lib.log(\"parcoords traces support up to \" + maxDimensionCount + \" dimensions at the moment\");\n dimensionsIn.splice(maxDimensionCount);\n }\n var dimensions = handleArrayContainerDefaults(traceIn, traceOut, {\n name: \"dimensions\",\n layout,\n handleItemDefaults: dimensionDefaults\n });\n var len = handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce);\n handleDomainDefaults(traceOut, layout, coerce);\n if (!Array.isArray(dimensions) || !dimensions.length) {\n traceOut.visible = false;\n }\n mergeLength(traceOut, dimensions, \"values\", len);\n var fontDflt = Lib.extendFlat({}, layout.font, {\n size: Math.round(layout.font.size / 1.2)\n });\n Lib.coerceFont(coerce, \"labelfont\", fontDflt);\n Lib.coerceFont(coerce, \"tickfont\", fontDflt, { autoShadowDflt: true });\n Lib.coerceFont(coerce, \"rangefont\", fontDflt);\n coerce(\"labelangle\");\n coerce(\"labelside\");\n coerce(\"unselected.line.color\");\n coerce(\"unselected.line.opacity\");\n };\n }\n });\n\n // src/traces/parcoords/calc.js\n var require_calc31 = __commonJS({\n \"src/traces/parcoords/calc.js\"(exports, module) {\n \"use strict\";\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n var Colorscale = require_colorscale();\n var wrap = require_gup().wrap;\n module.exports = function calc(gd, trace) {\n var lineColor;\n var cscale;\n if (Colorscale.hasColorscale(trace, \"line\") && isArrayOrTypedArray(trace.line.color)) {\n lineColor = trace.line.color;\n cscale = Colorscale.extractOpts(trace.line).colorscale;\n Colorscale.calc(gd, trace, {\n vals: lineColor,\n containerStr: \"line\",\n cLetter: \"c\"\n });\n } else {\n lineColor = constHalf(trace._length);\n cscale = [[0, trace.line.color], [1, trace.line.color]];\n }\n return wrap({ lineColor, cscale });\n };\n function constHalf(len) {\n var out = new Array(len);\n for (var i = 0; i < len; i++) {\n out[i] = 0.5;\n }\n return out;\n }\n }\n });\n\n // node_modules/color-parse/index.js\n function parse(cstr) {\n var _a, _b;\n var m, parts = [], alpha = 1, space;\n if (typeof cstr === \"number\") {\n return { space: \"rgb\", values: [cstr >>> 16, (cstr & 65280) >>> 8, cstr & 255], alpha: 1 };\n }\n if (typeof cstr === \"number\") return { space: \"rgb\", values: [cstr >>> 16, (cstr & 65280) >>> 8, cstr & 255], alpha: 1 };\n cstr = String(cstr).toLowerCase();\n if (import_color_name.default[cstr]) {\n parts = import_color_name.default[cstr].slice();\n space = \"rgb\";\n } else if (cstr === \"transparent\") {\n alpha = 0;\n space = \"rgb\";\n parts = [0, 0, 0];\n } else if (cstr[0] === \"#\") {\n var base = cstr.slice(1);\n var size = base.length;\n var isShort = size <= 4;\n alpha = 1;\n if (isShort) {\n parts = [\n parseInt(base[0] + base[0], 16),\n parseInt(base[1] + base[1], 16),\n parseInt(base[2] + base[2], 16)\n ];\n if (size === 4) {\n alpha = parseInt(base[3] + base[3], 16) / 255;\n }\n } else {\n parts = [\n parseInt(base[0] + base[1], 16),\n parseInt(base[2] + base[3], 16),\n parseInt(base[4] + base[5], 16)\n ];\n if (size === 8) {\n alpha = parseInt(base[6] + base[7], 16) / 255;\n }\n }\n if (!parts[0]) parts[0] = 0;\n if (!parts[1]) parts[1] = 0;\n if (!parts[2]) parts[2] = 0;\n space = \"rgb\";\n } else if (m = /^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\\s*\\(([^\\)]*)\\)/.exec(cstr)) {\n var name2 = m[1];\n space = name2.replace(/a$/, \"\");\n var dims = space === \"cmyk\" ? 4 : space === \"gray\" ? 1 : 3;\n parts = m[2].trim().split(/\\s*[,\\/]\\s*|\\s+/);\n if (space === \"color\") space = parts.shift();\n parts = parts.map(function(x, i) {\n if (x[x.length - 1] === \"%\") {\n x = parseFloat(x) / 100;\n if (i === 3) return x;\n if (space === \"rgb\") return x * 255;\n if (space[0] === \"h\") return x * 100;\n if (space[0] === \"l\" && !i) return x * 100;\n if (space === \"lab\") return x * 125;\n if (space === \"lch\") return i < 2 ? x * 150 : x * 360;\n if (space[0] === \"o\" && !i) return x;\n if (space === \"oklab\") return x * 0.4;\n if (space === \"oklch\") return i < 2 ? x * 0.4 : x * 360;\n return x;\n }\n if (space[i] === \"h\" || i === 2 && space[space.length - 1] === \"h\") {\n if (baseHues[x] !== void 0) return baseHues[x];\n if (x.endsWith(\"deg\")) return parseFloat(x);\n if (x.endsWith(\"turn\")) return parseFloat(x) * 360;\n if (x.endsWith(\"grad\")) return parseFloat(x) * 360 / 400;\n if (x.endsWith(\"rad\")) return parseFloat(x) * 180 / Math.PI;\n }\n if (x === \"none\") return 0;\n return parseFloat(x);\n });\n alpha = parts.length > dims ? parts.pop() : 1;\n } else if (/[0-9](?:\\s|\\/|,)/.test(cstr)) {\n parts = cstr.match(/([0-9]+)/g).map(function(value) {\n return parseFloat(value);\n });\n space = ((_b = (_a = cstr.match(/([a-z])/ig)) == null ? void 0 : _a.join(\"\")) == null ? void 0 : _b.toLowerCase()) || \"rgb\";\n }\n return {\n space,\n values: parts,\n alpha\n };\n }\n var import_color_name, color_parse_default, baseHues;\n var init_color_parse = __esm({\n \"node_modules/color-parse/index.js\"() {\n import_color_name = __toESM(require_color_name(), 1);\n color_parse_default = parse;\n baseHues = {\n red: 0,\n orange: 60,\n yellow: 120,\n green: 180,\n blue: 240,\n purple: 300\n };\n }\n });\n\n // node_modules/color-space/rgb.js\n var rgb_default2;\n var init_rgb2 = __esm({\n \"node_modules/color-space/rgb.js\"() {\n rgb_default2 = {\n name: \"rgb\",\n min: [0, 0, 0],\n max: [255, 255, 255],\n channel: [\"red\", \"green\", \"blue\"],\n alias: [\"RGB\"]\n };\n }\n });\n\n // node_modules/color-space/hsl.js\n var hsl_default2;\n var init_hsl2 = __esm({\n \"node_modules/color-space/hsl.js\"() {\n init_rgb2();\n hsl_default2 = {\n name: \"hsl\",\n min: [0, 0, 0],\n max: [360, 100, 100],\n channel: [\"hue\", \"saturation\", \"lightness\"],\n alias: [\"HSL\"],\n rgb: function(hsl3) {\n var h = hsl3[0] / 360, s = hsl3[1] / 100, l = hsl3[2] / 100, t12, t22, t32, rgb2, val, i = 0;\n if (s === 0) return val = l * 255, [val, val, val];\n t22 = l < 0.5 ? l * (1 + s) : l + s - l * s;\n t12 = 2 * l - t22;\n rgb2 = [0, 0, 0];\n for (; i < 3; ) {\n t32 = h + 1 / 3 * -(i - 1);\n t32 < 0 ? t32++ : t32 > 1 && t32--;\n val = 6 * t32 < 1 ? t12 + (t22 - t12) * 6 * t32 : 2 * t32 < 1 ? t22 : 3 * t32 < 2 ? t12 + (t22 - t12) * (2 / 3 - t32) * 6 : t12;\n rgb2[i++] = val * 255;\n }\n return rgb2;\n }\n };\n rgb_default2.hsl = function(rgb2) {\n var r = rgb2[0] / 255, g = rgb2[1] / 255, b = rgb2[2] / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), delta = max - min, h, s, l;\n if (max === min) {\n h = 0;\n } else if (r === max) {\n h = (g - b) / delta;\n } else if (g === max) {\n h = 2 + (b - r) / delta;\n } else if (b === max) {\n h = 4 + (r - g) / delta;\n }\n h = Math.min(h * 60, 360);\n if (h < 0) {\n h += 360;\n }\n l = (min + max) / 2;\n if (max === min) {\n s = 0;\n } else if (l <= 0.5) {\n s = delta / (max + min);\n } else {\n s = delta / (2 - max - min);\n }\n return [h, s * 100, l * 100];\n };\n }\n });\n\n // node_modules/color-rgba/index.js\n var color_rgba_exports = {};\n __export(color_rgba_exports, {\n default: () => rgba2\n });\n function rgba2(color2) {\n if (Array.isArray(color2) && color2.raw) color2 = String.raw(...arguments);\n if (color2 instanceof Number) color2 = +color2;\n var values, i, l;\n var parsed = color_parse_default(color2);\n if (!parsed.space) return [];\n const min = parsed.space[0] === \"h\" ? hsl_default2.min : rgb_default2.min;\n const max = parsed.space[0] === \"h\" ? hsl_default2.max : rgb_default2.max;\n values = Array(3);\n values[0] = Math.min(Math.max(parsed.values[0], min[0]), max[0]);\n values[1] = Math.min(Math.max(parsed.values[1], min[1]), max[1]);\n values[2] = Math.min(Math.max(parsed.values[2], min[2]), max[2]);\n if (parsed.space[0] === \"h\") {\n values = hsl_default2.rgb(values);\n }\n values.push(Math.min(Math.max(parsed.alpha, 0), 1));\n return values;\n }\n var init_color_rgba = __esm({\n \"node_modules/color-rgba/index.js\"() {\n init_color_parse();\n init_rgb2();\n init_hsl2();\n }\n });\n\n // src/traces/parcoords/helpers.js\n var require_helpers18 = __commonJS({\n \"src/traces/parcoords/helpers.js\"(exports) {\n \"use strict\";\n var isTypedArray = require_lib().isTypedArray;\n exports.convertTypedArray = function(a) {\n return isTypedArray(a) ? Array.prototype.slice.call(a) : a;\n };\n exports.isOrdinal = function(dimension) {\n return !!dimension.tickvals;\n };\n exports.isVisible = function(dimension) {\n return dimension.visible || !(\"visible\" in dimension);\n };\n }\n });\n\n // src/traces/parcoords/lines.js\n var require_lines = __commonJS({\n \"src/traces/parcoords/lines.js\"(exports, module) {\n \"use strict\";\n var vertexShaderSource = [\n \"precision highp float;\",\n \"\",\n \"varying vec4 fragColor;\",\n \"\",\n \"attribute vec4 p01_04, p05_08, p09_12, p13_16,\",\n \" p17_20, p21_24, p25_28, p29_32,\",\n \" p33_36, p37_40, p41_44, p45_48,\",\n \" p49_52, p53_56, p57_60, colors;\",\n \"\",\n \"uniform mat4 dim0A, dim1A, dim0B, dim1B, dim0C, dim1C, dim0D, dim1D,\",\n \" loA, hiA, loB, hiB, loC, hiC, loD, hiD;\",\n \"\",\n \"uniform vec2 resolution, viewBoxPos, viewBoxSize;\",\n \"uniform float maskHeight;\",\n \"uniform float drwLayer; // 0: context, 1: focus, 2: pick\",\n \"uniform vec4 contextColor;\",\n \"uniform sampler2D maskTexture, palette;\",\n \"\",\n \"bool isPick = (drwLayer > 1.5);\",\n \"bool isContext = (drwLayer < 0.5);\",\n \"\",\n \"const vec4 ZEROS = vec4(0.0, 0.0, 0.0, 0.0);\",\n \"const vec4 UNITS = vec4(1.0, 1.0, 1.0, 1.0);\",\n \"\",\n \"float val(mat4 p, mat4 v) {\",\n \" return dot(matrixCompMult(p, v) * UNITS, UNITS);\",\n \"}\",\n \"\",\n \"float axisY(float ratio, mat4 A, mat4 B, mat4 C, mat4 D) {\",\n \" float y1 = val(A, dim0A) + val(B, dim0B) + val(C, dim0C) + val(D, dim0D);\",\n \" float y2 = val(A, dim1A) + val(B, dim1B) + val(C, dim1C) + val(D, dim1D);\",\n \" return y1 * (1.0 - ratio) + y2 * ratio;\",\n \"}\",\n \"\",\n \"int iMod(int a, int b) {\",\n \" return a - b * (a / b);\",\n \"}\",\n \"\",\n \"bool fOutside(float p, float lo, float hi) {\",\n \" return (lo < hi) && (lo > p || p > hi);\",\n \"}\",\n \"\",\n \"bool vOutside(vec4 p, vec4 lo, vec4 hi) {\",\n \" return (\",\n \" fOutside(p[0], lo[0], hi[0]) ||\",\n \" fOutside(p[1], lo[1], hi[1]) ||\",\n \" fOutside(p[2], lo[2], hi[2]) ||\",\n \" fOutside(p[3], lo[3], hi[3])\",\n \" );\",\n \"}\",\n \"\",\n \"bool mOutside(mat4 p, mat4 lo, mat4 hi) {\",\n \" return (\",\n \" vOutside(p[0], lo[0], hi[0]) ||\",\n \" vOutside(p[1], lo[1], hi[1]) ||\",\n \" vOutside(p[2], lo[2], hi[2]) ||\",\n \" vOutside(p[3], lo[3], hi[3])\",\n \" );\",\n \"}\",\n \"\",\n \"bool outsideBoundingBox(mat4 A, mat4 B, mat4 C, mat4 D) {\",\n \" return mOutside(A, loA, hiA) ||\",\n \" mOutside(B, loB, hiB) ||\",\n \" mOutside(C, loC, hiC) ||\",\n \" mOutside(D, loD, hiD);\",\n \"}\",\n \"\",\n \"bool outsideRasterMask(mat4 A, mat4 B, mat4 C, mat4 D) {\",\n \" mat4 pnts[4];\",\n \" pnts[0] = A;\",\n \" pnts[1] = B;\",\n \" pnts[2] = C;\",\n \" pnts[3] = D;\",\n \"\",\n \" for(int i = 0; i < 4; ++i) {\",\n \" for(int j = 0; j < 4; ++j) {\",\n \" for(int k = 0; k < 4; ++k) {\",\n \" if(0 == iMod(\",\n \" int(255.0 * texture2D(maskTexture,\",\n \" vec2(\",\n \" (float(i * 2 + j / 2) + 0.5) / 8.0,\",\n \" (pnts[i][j][k] * (maskHeight - 1.0) + 1.0) / maskHeight\",\n \" ))[3]\",\n \" ) / int(pow(2.0, float(iMod(j * 4 + k, 8)))),\",\n \" 2\",\n \" )) return true;\",\n \" }\",\n \" }\",\n \" }\",\n \" return false;\",\n \"}\",\n \"\",\n \"vec4 position(bool isContext, float v, mat4 A, mat4 B, mat4 C, mat4 D) {\",\n \" float x = 0.5 * sign(v) + 0.5;\",\n \" float y = axisY(x, A, B, C, D);\",\n \" float z = 1.0 - abs(v);\",\n \"\",\n \" z += isContext ? 0.0 : 2.0 * float(\",\n \" outsideBoundingBox(A, B, C, D) ||\",\n \" outsideRasterMask(A, B, C, D)\",\n \" );\",\n \"\",\n \" return vec4(\",\n \" 2.0 * (vec2(x, y) * viewBoxSize + viewBoxPos) / resolution - 1.0,\",\n \" z,\",\n \" 1.0\",\n \" );\",\n \"}\",\n \"\",\n \"void main() {\",\n \" mat4 A = mat4(p01_04, p05_08, p09_12, p13_16);\",\n \" mat4 B = mat4(p17_20, p21_24, p25_28, p29_32);\",\n \" mat4 C = mat4(p33_36, p37_40, p41_44, p45_48);\",\n \" mat4 D = mat4(p49_52, p53_56, p57_60, ZEROS);\",\n \"\",\n \" float v = colors[3];\",\n \"\",\n \" gl_Position = position(isContext, v, A, B, C, D);\",\n \"\",\n \" fragColor =\",\n \" isContext ? vec4(contextColor) :\",\n \" isPick ? vec4(colors.rgb, 1.0) : texture2D(palette, vec2(abs(v), 0.5));\",\n \"}\"\n ].join(\"\\n\");\n var fragmentShaderSource = [\n \"precision highp float;\",\n \"\",\n \"varying vec4 fragColor;\",\n \"\",\n \"void main() {\",\n \" gl_FragColor = fragColor;\",\n \"}\"\n ].join(\"\\n\");\n var maxDim = require_constants24().maxDimensionCount;\n var Lib = require_lib();\n var depthLimitEpsilon = 1e-6;\n var maskHeight = 2048;\n var dummyPixel = new Uint8Array(4);\n var dataPixel = new Uint8Array(4);\n var paletteTextureConfig = {\n shape: [256, 1],\n format: \"rgba\",\n type: \"uint8\",\n mag: \"nearest\",\n min: \"nearest\"\n };\n function ensureDraw(regl) {\n regl.read({\n x: 0,\n y: 0,\n width: 1,\n height: 1,\n data: dummyPixel\n });\n }\n function clear(regl, x, y, width, height) {\n var gl2 = regl._gl;\n gl2.enable(gl2.SCISSOR_TEST);\n gl2.scissor(x, y, width, height);\n regl.clear({ color: [0, 0, 0, 0], depth: 1 });\n }\n function renderBlock(regl, glAes, renderState, blockLineCount, sampleCount, item) {\n var rafKey = item.key;\n function render(blockNumber) {\n var count = Math.min(blockLineCount, sampleCount - blockNumber * blockLineCount);\n if (blockNumber === 0) {\n window.cancelAnimationFrame(renderState.currentRafs[rafKey]);\n delete renderState.currentRafs[rafKey];\n clear(regl, item.scissorX, item.scissorY, item.scissorWidth, item.viewBoxSize[1]);\n }\n if (renderState.clearOnly) {\n return;\n }\n item.count = 2 * count;\n item.offset = 2 * blockNumber * blockLineCount;\n glAes(item);\n if (blockNumber * blockLineCount + count < sampleCount) {\n renderState.currentRafs[rafKey] = window.requestAnimationFrame(function() {\n render(blockNumber + 1);\n });\n }\n renderState.drawCompleted = false;\n }\n if (!renderState.drawCompleted) {\n ensureDraw(regl);\n renderState.drawCompleted = true;\n }\n render(0);\n }\n function adjustDepth(d) {\n return Math.max(depthLimitEpsilon, Math.min(1 - depthLimitEpsilon, d));\n }\n function palette(unitToColor, opacity) {\n var result = new Array(256);\n for (var i = 0; i < 256; i++) {\n result[i] = unitToColor(i / 255).concat(opacity);\n }\n return result;\n }\n function calcPickColor(i, rgbIndex) {\n return (i >>> 8 * rgbIndex) % 256 / 255;\n }\n function makePoints(sampleCount, dims, color2) {\n var points = new Array(sampleCount * (maxDim + 4));\n var n = 0;\n for (var i = 0; i < sampleCount; i++) {\n for (var k = 0; k < maxDim; k++) {\n points[n++] = k < dims.length ? dims[k].paddedUnitValues[i] : 0.5;\n }\n points[n++] = calcPickColor(i, 2);\n points[n++] = calcPickColor(i, 1);\n points[n++] = calcPickColor(i, 0);\n points[n++] = adjustDepth(color2[i]);\n }\n return points;\n }\n function makeVecAttr(vecIndex, sampleCount, points) {\n var pointPairs = new Array(sampleCount * 8);\n var n = 0;\n for (var i = 0; i < sampleCount; i++) {\n for (var j = 0; j < 2; j++) {\n for (var k = 0; k < 4; k++) {\n var q = vecIndex * 4 + k;\n var v = points[i * 64 + q];\n if (q === 63 && j === 0) {\n v *= -1;\n }\n pointPairs[n++] = v;\n }\n }\n }\n return pointPairs;\n }\n function pad2(num) {\n var s = \"0\" + num;\n return s.substr(s.length - 2);\n }\n function getAttrName(i) {\n return i < maxDim ? \"p\" + pad2(i + 1) + \"_\" + pad2(i + 4) : \"colors\";\n }\n function setAttributes(attributes, sampleCount, points) {\n for (var i = 0; i <= maxDim; i += 4) {\n attributes[getAttrName(i)](makeVecAttr(i / 4, sampleCount, points));\n }\n }\n function emptyAttributes(regl) {\n var attributes = {};\n for (var i = 0; i <= maxDim; i += 4) {\n attributes[getAttrName(i)] = regl.buffer({ usage: \"dynamic\", type: \"float\", data: new Uint8Array(0) });\n }\n return attributes;\n }\n function makeItem(model, leftmost, rightmost, itemNumber, i0, i1, x, y, panelSizeX, panelSizeY, crossfilterDimensionIndex, drwLayer, constraints, plotGlPixelRatio) {\n var dims = [[], []];\n for (var k = 0; k < 64; k++) {\n dims[0][k] = k === i0 ? 1 : 0;\n dims[1][k] = k === i1 ? 1 : 0;\n }\n x *= plotGlPixelRatio;\n y *= plotGlPixelRatio;\n panelSizeX *= plotGlPixelRatio;\n panelSizeY *= plotGlPixelRatio;\n var overdrag = model.lines.canvasOverdrag * plotGlPixelRatio;\n var domain = model.domain;\n var canvasWidth = model.canvasWidth * plotGlPixelRatio;\n var canvasHeight = model.canvasHeight * plotGlPixelRatio;\n var padL = model.pad.l * plotGlPixelRatio;\n var padB = model.pad.b * plotGlPixelRatio;\n var layoutHeight = model.layoutHeight * plotGlPixelRatio;\n var layoutWidth = model.layoutWidth * plotGlPixelRatio;\n var deselectedLinesColor = model.deselectedLines.color;\n var deselectedLinesOpacity = model.deselectedLines.opacity;\n var itemModel = Lib.extendFlat({\n key: crossfilterDimensionIndex,\n resolution: [canvasWidth, canvasHeight],\n viewBoxPos: [x + overdrag, y],\n viewBoxSize: [panelSizeX, panelSizeY],\n i0,\n i1,\n dim0A: dims[0].slice(0, 16),\n dim0B: dims[0].slice(16, 32),\n dim0C: dims[0].slice(32, 48),\n dim0D: dims[0].slice(48, 64),\n dim1A: dims[1].slice(0, 16),\n dim1B: dims[1].slice(16, 32),\n dim1C: dims[1].slice(32, 48),\n dim1D: dims[1].slice(48, 64),\n drwLayer,\n contextColor: [\n deselectedLinesColor[0] / 255,\n deselectedLinesColor[1] / 255,\n deselectedLinesColor[2] / 255,\n deselectedLinesOpacity !== \"auto\" ? deselectedLinesColor[3] * deselectedLinesOpacity : Math.max(1 / 255, Math.pow(1 / model.lines.color.length, 1 / 3))\n ],\n scissorX: (itemNumber === leftmost ? 0 : x + overdrag) + (padL - overdrag) + layoutWidth * domain.x[0],\n scissorWidth: (itemNumber === rightmost ? canvasWidth - x + overdrag : panelSizeX + 0.5) + (itemNumber === leftmost ? x + overdrag : 0),\n scissorY: y + padB + layoutHeight * domain.y[0],\n scissorHeight: panelSizeY,\n viewportX: padL - overdrag + layoutWidth * domain.x[0],\n viewportY: padB + layoutHeight * domain.y[0],\n viewportWidth: canvasWidth,\n viewportHeight: canvasHeight\n }, constraints);\n return itemModel;\n }\n function expandedPixelRange(bounds) {\n var dh = maskHeight - 1;\n var a = Math.max(0, Math.floor(bounds[0] * dh), 0);\n var b = Math.min(dh, Math.ceil(bounds[1] * dh), dh);\n return [\n Math.min(a, b),\n Math.max(a, b)\n ];\n }\n module.exports = function(canvasGL, d) {\n var isContext = d.context;\n var isPick = d.pick;\n var regl = d.regl;\n var gl2 = regl._gl;\n var supportedLineWidth = gl2.getParameter(gl2.ALIASED_LINE_WIDTH_RANGE);\n var plotGlPixelRatio = Math.max(\n supportedLineWidth[0],\n Math.min(\n supportedLineWidth[1],\n d.viewModel.plotGlPixelRatio\n )\n );\n var renderState = {\n currentRafs: {},\n drawCompleted: true,\n clearOnly: false\n };\n var model;\n var vm;\n var initialDims;\n var sampleCount;\n var attributes = emptyAttributes(regl);\n var maskTexture;\n var paletteTexture = regl.texture(paletteTextureConfig);\n var prevAxisOrder = [];\n update(d);\n var glAes = regl({\n profile: false,\n blend: {\n enable: isContext,\n func: {\n srcRGB: \"src alpha\",\n dstRGB: \"one minus src alpha\",\n srcAlpha: 1,\n dstAlpha: 1\n // 'one minus src alpha'\n },\n equation: {\n rgb: \"add\",\n alpha: \"add\"\n },\n color: [0, 0, 0, 0]\n },\n depth: {\n enable: !isContext,\n mask: true,\n func: \"less\",\n range: [0, 1]\n },\n // for polygons\n cull: {\n enable: true,\n face: \"back\"\n },\n scissor: {\n enable: true,\n box: {\n x: regl.prop(\"scissorX\"),\n y: regl.prop(\"scissorY\"),\n width: regl.prop(\"scissorWidth\"),\n height: regl.prop(\"scissorHeight\")\n }\n },\n viewport: {\n x: regl.prop(\"viewportX\"),\n y: regl.prop(\"viewportY\"),\n width: regl.prop(\"viewportWidth\"),\n height: regl.prop(\"viewportHeight\")\n },\n dither: false,\n vert: vertexShaderSource,\n frag: fragmentShaderSource,\n primitive: \"lines\",\n lineWidth: plotGlPixelRatio,\n attributes,\n uniforms: {\n resolution: regl.prop(\"resolution\"),\n viewBoxPos: regl.prop(\"viewBoxPos\"),\n viewBoxSize: regl.prop(\"viewBoxSize\"),\n dim0A: regl.prop(\"dim0A\"),\n dim1A: regl.prop(\"dim1A\"),\n dim0B: regl.prop(\"dim0B\"),\n dim1B: regl.prop(\"dim1B\"),\n dim0C: regl.prop(\"dim0C\"),\n dim1C: regl.prop(\"dim1C\"),\n dim0D: regl.prop(\"dim0D\"),\n dim1D: regl.prop(\"dim1D\"),\n loA: regl.prop(\"loA\"),\n hiA: regl.prop(\"hiA\"),\n loB: regl.prop(\"loB\"),\n hiB: regl.prop(\"hiB\"),\n loC: regl.prop(\"loC\"),\n hiC: regl.prop(\"hiC\"),\n loD: regl.prop(\"loD\"),\n hiD: regl.prop(\"hiD\"),\n palette: paletteTexture,\n contextColor: regl.prop(\"contextColor\"),\n maskTexture: regl.prop(\"maskTexture\"),\n drwLayer: regl.prop(\"drwLayer\"),\n maskHeight: regl.prop(\"maskHeight\")\n },\n offset: regl.prop(\"offset\"),\n count: regl.prop(\"count\")\n });\n function update(dNew) {\n model = dNew.model;\n vm = dNew.viewModel;\n initialDims = vm.dimensions.slice();\n sampleCount = initialDims[0] ? initialDims[0].values.length : 0;\n var lines = model.lines;\n var color2 = isPick ? lines.color.map(function(_, i) {\n return i / lines.color.length;\n }) : lines.color;\n var points = makePoints(sampleCount, initialDims, color2);\n setAttributes(attributes, sampleCount, points);\n if (!isContext && !isPick) {\n paletteTexture = regl.texture(Lib.extendFlat({\n data: palette(model.unitToColor, 255)\n }, paletteTextureConfig));\n }\n }\n function makeConstraints(isContext2) {\n var i, j, k;\n var limits = [[], []];\n for (k = 0; k < 64; k++) {\n var p = !isContext2 && k < initialDims.length ? initialDims[k].brush.filter.getBounds() : [-Infinity, Infinity];\n limits[0][k] = p[0];\n limits[1][k] = p[1];\n }\n var len = maskHeight * 8;\n var mask = new Array(len);\n for (i = 0; i < len; i++) {\n mask[i] = 255;\n }\n if (!isContext2) {\n for (i = 0; i < initialDims.length; i++) {\n var u = i % 8;\n var v = (i - u) / 8;\n var bitMask = Math.pow(2, u);\n var dim = initialDims[i];\n var ranges = dim.brush.filter.get();\n if (ranges.length < 2) continue;\n var prevEnd = expandedPixelRange(ranges[0])[1];\n for (j = 1; j < ranges.length; j++) {\n var nextRange = expandedPixelRange(ranges[j]);\n for (k = prevEnd + 1; k < nextRange[0]; k++) {\n mask[k * 8 + v] &= ~bitMask;\n }\n prevEnd = Math.max(prevEnd, nextRange[1]);\n }\n }\n }\n var textureData = {\n // 8 units x 8 bits = 64 bits, just sufficient for the almost 64 dimensions we support\n shape: [8, maskHeight],\n format: \"alpha\",\n type: \"uint8\",\n mag: \"nearest\",\n min: \"nearest\",\n data: mask\n };\n if (maskTexture) maskTexture(textureData);\n else maskTexture = regl.texture(textureData);\n return {\n maskTexture,\n maskHeight,\n loA: limits[0].slice(0, 16),\n loB: limits[0].slice(16, 32),\n loC: limits[0].slice(32, 48),\n loD: limits[0].slice(48, 64),\n hiA: limits[1].slice(0, 16),\n hiB: limits[1].slice(16, 32),\n hiC: limits[1].slice(32, 48),\n hiD: limits[1].slice(48, 64)\n };\n }\n function renderGLParcoords(panels, setChanged, clearOnly) {\n var panelCount = panels.length;\n var i;\n var leftmost;\n var rightmost;\n var lowestX = Infinity;\n var highestX = -Infinity;\n for (i = 0; i < panelCount; i++) {\n if (panels[i].dim0.canvasX < lowestX) {\n lowestX = panels[i].dim0.canvasX;\n leftmost = i;\n }\n if (panels[i].dim1.canvasX > highestX) {\n highestX = panels[i].dim1.canvasX;\n rightmost = i;\n }\n }\n if (panelCount === 0) {\n clear(regl, 0, 0, model.canvasWidth, model.canvasHeight);\n }\n var constraints = makeConstraints(isContext);\n for (i = 0; i < panelCount; i++) {\n var p = panels[i];\n var i0 = p.dim0.crossfilterDimensionIndex;\n var i1 = p.dim1.crossfilterDimensionIndex;\n var x = p.canvasX;\n var y = p.canvasY;\n var nextX = x + p.panelSizeX;\n var plotGlPixelRatio2 = p.plotGlPixelRatio;\n if (setChanged || !prevAxisOrder[i0] || prevAxisOrder[i0][0] !== x || prevAxisOrder[i0][1] !== nextX) {\n prevAxisOrder[i0] = [x, nextX];\n var item = makeItem(\n model,\n leftmost,\n rightmost,\n i,\n i0,\n i1,\n x,\n y,\n p.panelSizeX,\n p.panelSizeY,\n p.dim0.crossfilterDimensionIndex,\n isContext ? 0 : isPick ? 2 : 1,\n constraints,\n plotGlPixelRatio2\n );\n renderState.clearOnly = clearOnly;\n var blockLineCount = setChanged ? model.lines.blockLineCount : sampleCount;\n renderBlock(\n regl,\n glAes,\n renderState,\n blockLineCount,\n sampleCount,\n item\n );\n }\n }\n }\n function readPixel(canvasX, canvasY) {\n regl.read({\n x: canvasX,\n y: canvasY,\n width: 1,\n height: 1,\n data: dataPixel\n });\n return dataPixel;\n }\n function readPixels(canvasX, canvasY, width, height) {\n var pixelArray = new Uint8Array(4 * width * height);\n regl.read({\n x: canvasX,\n y: canvasY,\n width,\n height,\n data: pixelArray\n });\n return pixelArray;\n }\n function destroy() {\n canvasGL.style[\"pointer-events\"] = \"none\";\n paletteTexture.destroy();\n if (maskTexture) maskTexture.destroy();\n for (var k in attributes) attributes[k].destroy();\n }\n return {\n render: renderGLParcoords,\n readPixel,\n readPixels,\n destroy,\n update\n };\n };\n }\n });\n\n // src/traces/parcoords/parcoords.js\n var require_parcoords = __commonJS({\n \"src/traces/parcoords/parcoords.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var isArrayOrTypedArray = Lib.isArrayOrTypedArray;\n var numberFormat = Lib.numberFormat;\n var rgba3 = (init_color_rgba(), __toCommonJS(color_rgba_exports)).default;\n var Axes = require_axes();\n var strRotate = Lib.strRotate;\n var strTranslate = Lib.strTranslate;\n var svgTextUtils = require_svg_text_utils();\n var Drawing = require_drawing();\n var Colorscale = require_colorscale();\n var gup = require_gup();\n var keyFun = gup.keyFun;\n var repeat = gup.repeat;\n var unwrap = gup.unwrap;\n var helpers = require_helpers18();\n var c = require_constants24();\n var brush = require_axisbrush();\n var lineLayerMaker = require_lines();\n function findExtreme(fn, values, len) {\n return Lib.aggNums(fn, null, values, len);\n }\n function findExtremes(values, len) {\n return fixExtremes(\n findExtreme(Math.min, values, len),\n findExtreme(Math.max, values, len)\n );\n }\n function dimensionExtent(dimension) {\n var range = dimension.range;\n return range ? fixExtremes(range[0], range[1]) : findExtremes(dimension.values, dimension._length);\n }\n function fixExtremes(lo, hi) {\n if (isNaN(lo) || !isFinite(lo)) {\n lo = 0;\n }\n if (isNaN(hi) || !isFinite(hi)) {\n hi = 0;\n }\n if (lo === hi) {\n if (lo === 0) {\n lo -= 1;\n hi += 1;\n } else {\n lo *= 0.9;\n hi *= 1.1;\n }\n }\n return [lo, hi];\n }\n function toText(formatter, texts) {\n if (texts) {\n return function(v, i) {\n var text = texts[i];\n if (text === null || text === void 0) return formatter(v);\n return text;\n };\n }\n return formatter;\n }\n function domainScale(height, padding, dimension, tickvals, ticktext) {\n var extent = dimensionExtent(dimension);\n if (tickvals) {\n return d3.scale.ordinal().domain(tickvals.map(toText(numberFormat(dimension.tickformat), ticktext))).range(\n tickvals.map(function(d) {\n var unitVal = (d - extent[0]) / (extent[1] - extent[0]);\n return height - padding + unitVal * (2 * padding - height);\n })\n );\n }\n return d3.scale.linear().domain(extent).range([height - padding, padding]);\n }\n function unitToPaddedPx(height, padding) {\n return d3.scale.linear().range([padding, height - padding]);\n }\n function domainToPaddedUnitScale(dimension, padFraction) {\n return d3.scale.linear().domain(dimensionExtent(dimension)).range([padFraction, 1 - padFraction]);\n }\n function ordinalScale(dimension) {\n if (!dimension.tickvals) return;\n var extent = dimensionExtent(dimension);\n return d3.scale.ordinal().domain(dimension.tickvals).range(dimension.tickvals.map(function(d) {\n return (d - extent[0]) / (extent[1] - extent[0]);\n }));\n }\n function unitToColorScale(cscale) {\n var colorStops = cscale.map(function(d) {\n return d[0];\n });\n var colorTuples = cscale.map(function(d) {\n var RGBA = rgba3(d[1]);\n return d3.rgb(\"rgb(\" + RGBA[0] + \",\" + RGBA[1] + \",\" + RGBA[2] + \")\");\n });\n var prop = function(n) {\n return function(o) {\n return o[n];\n };\n };\n var polylinearUnitScales = \"rgb\".split(\"\").map(function(key) {\n return d3.scale.linear().clamp(true).domain(colorStops).range(colorTuples.map(prop(key)));\n });\n return function(d) {\n return polylinearUnitScales.map(function(s) {\n return s(d);\n });\n };\n }\n function someFiltersActive(view) {\n return view.dimensions.some(function(p) {\n return p.brush.filterSpecified;\n });\n }\n function model(layout, d, i) {\n var cd0 = unwrap(d);\n var trace = cd0.trace;\n var lineColor = helpers.convertTypedArray(cd0.lineColor);\n var line = trace.line;\n var deselectedLines = {\n color: rgba3(trace.unselected.line.color),\n opacity: trace.unselected.line.opacity\n };\n var cOpts = Colorscale.extractOpts(line);\n var cscale = cOpts.reversescale ? Colorscale.flipScale(cd0.cscale) : cd0.cscale;\n var domain = trace.domain;\n var dimensions = trace.dimensions;\n var width = layout.width;\n var labelAngle = trace.labelangle;\n var labelSide = trace.labelside;\n var labelFont = trace.labelfont;\n var tickFont = trace.tickfont;\n var rangeFont = trace.rangefont;\n var lines = Lib.extendDeepNoArrays({}, line, {\n color: lineColor.map(d3.scale.linear().domain(\n dimensionExtent({\n values: lineColor,\n range: [cOpts.min, cOpts.max],\n _length: trace._length\n })\n )),\n blockLineCount: c.blockLineCount,\n canvasOverdrag: c.overdrag * c.canvasPixelRatio\n });\n var groupWidth = Math.floor(width * (domain.x[1] - domain.x[0]));\n var groupHeight = Math.floor(layout.height * (domain.y[1] - domain.y[0]));\n var pad = layout.margin || { l: 80, r: 80, t: 100, b: 80 };\n var rowContentWidth = groupWidth;\n var rowHeight = groupHeight;\n return {\n key: i,\n colCount: dimensions.filter(helpers.isVisible).length,\n dimensions,\n tickDistance: c.tickDistance,\n unitToColor: unitToColorScale(cscale),\n lines,\n deselectedLines,\n labelAngle,\n labelSide,\n labelFont,\n tickFont,\n rangeFont,\n layoutWidth: width,\n layoutHeight: layout.height,\n domain,\n translateX: domain.x[0] * width,\n translateY: layout.height - domain.y[1] * layout.height,\n pad,\n canvasWidth: rowContentWidth * c.canvasPixelRatio + 2 * lines.canvasOverdrag,\n canvasHeight: rowHeight * c.canvasPixelRatio,\n width: rowContentWidth,\n height: rowHeight,\n canvasPixelRatio: c.canvasPixelRatio\n };\n }\n function viewModel(state, callbacks, model2) {\n var width = model2.width;\n var height = model2.height;\n var dimensions = model2.dimensions;\n var canvasPixelRatio = model2.canvasPixelRatio;\n var xScale = function(d) {\n return width * d / Math.max(1, model2.colCount - 1);\n };\n var unitPad = c.verticalPadding / height;\n var _unitToPaddedPx = unitToPaddedPx(height, c.verticalPadding);\n var vm = {\n key: model2.key,\n xScale,\n model: model2,\n inBrushDrag: false\n // consider factoring it out and putting it in a centralized global-ish gesture state object\n };\n var uniqueKeys = {};\n vm.dimensions = dimensions.filter(helpers.isVisible).map(function(dimension, i) {\n var domainToPaddedUnit = domainToPaddedUnitScale(dimension, unitPad);\n var foundKey = uniqueKeys[dimension.label];\n uniqueKeys[dimension.label] = (foundKey || 0) + 1;\n var key = dimension.label + (foundKey ? \"__\" + foundKey : \"\");\n var specifiedConstraint = dimension.constraintrange;\n var filterRangeSpecified = specifiedConstraint && specifiedConstraint.length;\n if (filterRangeSpecified && !isArrayOrTypedArray(specifiedConstraint[0])) {\n specifiedConstraint = [specifiedConstraint];\n }\n var filterRange = filterRangeSpecified ? specifiedConstraint.map(function(d) {\n return d.map(domainToPaddedUnit);\n }) : [[-Infinity, Infinity]];\n var brushMove = function() {\n var p = vm;\n p.focusLayer && p.focusLayer.render(p.panels, true);\n var filtersActive = someFiltersActive(p);\n if (!state.contextShown() && filtersActive) {\n p.contextLayer && p.contextLayer.render(p.panels, true);\n state.contextShown(true);\n } else if (state.contextShown() && !filtersActive) {\n p.contextLayer && p.contextLayer.render(p.panels, true, true);\n state.contextShown(false);\n }\n };\n var truncatedValues = dimension.values;\n if (truncatedValues.length > dimension._length) {\n truncatedValues = truncatedValues.slice(0, dimension._length);\n }\n var tickvals = dimension.tickvals;\n var ticktext;\n function makeTickItem(v, i2) {\n return { val: v, text: ticktext[i2] };\n }\n function sortTickItem(a, b) {\n return a.val - b.val;\n }\n if (isArrayOrTypedArray(tickvals) && tickvals.length) {\n if (Lib.isTypedArray(tickvals)) tickvals = Array.from(tickvals);\n ticktext = dimension.ticktext;\n if (!isArrayOrTypedArray(ticktext) || !ticktext.length) {\n ticktext = tickvals.map(numberFormat(dimension.tickformat));\n } else if (ticktext.length > tickvals.length) {\n ticktext = ticktext.slice(0, tickvals.length);\n } else if (tickvals.length > ticktext.length) {\n tickvals = tickvals.slice(0, ticktext.length);\n }\n for (var j = 1; j < tickvals.length; j++) {\n if (tickvals[j] < tickvals[j - 1]) {\n var tickItems = tickvals.map(makeTickItem).sort(sortTickItem);\n for (var k = 0; k < tickvals.length; k++) {\n tickvals[k] = tickItems[k].val;\n ticktext[k] = tickItems[k].text;\n }\n break;\n }\n }\n } else tickvals = void 0;\n truncatedValues = helpers.convertTypedArray(truncatedValues);\n return {\n key,\n label: dimension.label,\n tickFormat: dimension.tickformat,\n tickvals,\n ticktext,\n ordinal: helpers.isOrdinal(dimension),\n multiselect: dimension.multiselect,\n xIndex: i,\n crossfilterDimensionIndex: i,\n visibleIndex: dimension._index,\n height,\n values: truncatedValues,\n paddedUnitValues: truncatedValues.map(domainToPaddedUnit),\n unitTickvals: tickvals && tickvals.map(domainToPaddedUnit),\n xScale,\n x: xScale(i),\n canvasX: xScale(i) * canvasPixelRatio,\n unitToPaddedPx: _unitToPaddedPx,\n domainScale: domainScale(height, c.verticalPadding, dimension, tickvals, ticktext),\n ordinalScale: ordinalScale(dimension),\n parent: vm,\n model: model2,\n brush: brush.makeBrush(\n state,\n filterRangeSpecified,\n filterRange,\n function() {\n state.linePickActive(false);\n },\n brushMove,\n function(f) {\n vm.focusLayer.render(vm.panels, true);\n vm.pickLayer && vm.pickLayer.render(vm.panels, true);\n state.linePickActive(true);\n if (callbacks && callbacks.filterChanged) {\n var invScale = domainToPaddedUnit.invert;\n var newRanges = f.map(function(r) {\n return r.map(invScale).sort(Lib.sorterAsc);\n }).sort(function(a, b) {\n return a[0] - b[0];\n });\n callbacks.filterChanged(vm.key, dimension._index, newRanges);\n }\n }\n )\n };\n });\n return vm;\n }\n function styleExtentTexts(selection) {\n selection.classed(c.cn.axisExtentText, true).attr(\"text-anchor\", \"middle\").style(\"cursor\", \"default\");\n }\n function parcoordsInteractionState() {\n var linePickActive = true;\n var contextShown = false;\n return {\n linePickActive: function(val) {\n return arguments.length ? linePickActive = !!val : linePickActive;\n },\n contextShown: function(val) {\n return arguments.length ? contextShown = !!val : contextShown;\n }\n };\n }\n function calcTilt(angle, position) {\n var dir = position === \"top\" ? 1 : -1;\n var radians2 = angle * Math.PI / 180;\n var dx = Math.sin(radians2);\n var dy = Math.cos(radians2);\n return {\n dir,\n dx,\n dy,\n degrees: angle\n };\n }\n function updatePanelLayout(yAxis, vm, plotGlPixelRatio) {\n var panels = vm.panels || (vm.panels = []);\n var data = yAxis.data();\n for (var i = 0; i < data.length - 1; i++) {\n var p = panels[i] || (panels[i] = {});\n var dim0 = data[i];\n var dim1 = data[i + 1];\n p.dim0 = dim0;\n p.dim1 = dim1;\n p.canvasX = dim0.canvasX;\n p.panelSizeX = dim1.canvasX - dim0.canvasX;\n p.panelSizeY = vm.model.canvasHeight;\n p.y = 0;\n p.canvasY = 0;\n p.plotGlPixelRatio = plotGlPixelRatio;\n }\n }\n function calcAllTicks(cd) {\n for (var i = 0; i < cd.length; i++) {\n for (var j = 0; j < cd[i].length; j++) {\n var trace = cd[i][j].trace;\n var dimensions = trace.dimensions;\n for (var k = 0; k < dimensions.length; k++) {\n var values = dimensions[k].values;\n var dim = dimensions[k]._ax;\n if (dim) {\n if (!dim.range) {\n dim.range = findExtremes(values, trace._length);\n } else {\n dim.range = fixExtremes(dim.range[0], dim.range[1]);\n }\n if (!dim.dtick) {\n dim.dtick = 0.01 * (Math.abs(dim.range[1] - dim.range[0]) || 1);\n }\n dim.tickformat = dimensions[k].tickformat;\n Axes.calcTicks(dim);\n dim.cleanRange();\n }\n }\n }\n }\n }\n function linearFormat(dim, v) {\n return Axes.tickText(dim._ax, v, false).text;\n }\n function extremeText(d, isTop) {\n if (d.ordinal) return \"\";\n var domain = d.domainScale.domain();\n var v = domain[isTop ? domain.length - 1 : 0];\n return linearFormat(d.model.dimensions[d.visibleIndex], v);\n }\n module.exports = function parcoords(gd, cdModule, layout, callbacks) {\n var isStatic = gd._context.staticPlot;\n var fullLayout = gd._fullLayout;\n var svg = fullLayout._toppaper;\n var glContainer = fullLayout._glcontainer;\n var plotGlPixelRatio = gd._context.plotGlPixelRatio;\n var paperColor = gd._fullLayout.paper_bgcolor;\n calcAllTicks(cdModule);\n var state = parcoordsInteractionState();\n var vm = cdModule.filter(function(d) {\n return unwrap(d).trace.visible;\n }).map(model.bind(0, layout)).map(viewModel.bind(0, state, callbacks));\n glContainer.each(function(d, i) {\n return Lib.extendFlat(d, vm[i]);\n });\n var glLayers = glContainer.selectAll(\".gl-canvas\").each(function(d) {\n d.viewModel = vm[0];\n d.viewModel.plotGlPixelRatio = plotGlPixelRatio;\n d.viewModel.paperColor = paperColor;\n d.model = d.viewModel ? d.viewModel.model : null;\n });\n var lastHovered = null;\n var pickLayer = glLayers.filter(function(d) {\n return d.pick;\n });\n pickLayer.style(\"pointer-events\", isStatic ? \"none\" : \"auto\").on(\"mousemove\", function(d) {\n if (state.linePickActive() && d.lineLayer && callbacks && callbacks.hover) {\n var event = d3.event;\n var cw = this.width;\n var ch = this.height;\n var pointer = d3.mouse(this);\n var x = pointer[0];\n var y = pointer[1];\n if (x < 0 || y < 0 || x >= cw || y >= ch) {\n return;\n }\n var pixel = d.lineLayer.readPixel(x, ch - 1 - y);\n var found = pixel[3] !== 0;\n var curveNumber = found ? pixel[2] + 256 * (pixel[1] + 256 * pixel[0]) : null;\n var eventData = {\n x,\n y,\n clientX: event.clientX,\n clientY: event.clientY,\n dataIndex: d.model.key,\n curveNumber\n };\n if (curveNumber !== lastHovered) {\n if (found) {\n callbacks.hover(eventData);\n } else if (callbacks.unhover) {\n callbacks.unhover(eventData);\n }\n lastHovered = curveNumber;\n }\n }\n });\n glLayers.style(\"opacity\", function(d) {\n return d.pick ? 0 : 1;\n });\n svg.style(\"background\", \"rgba(255, 255, 255, 0)\");\n var controlOverlay = svg.selectAll(\".\" + c.cn.parcoords).data(vm, keyFun);\n controlOverlay.exit().remove();\n controlOverlay.enter().append(\"g\").classed(c.cn.parcoords, true).style(\"shape-rendering\", \"crispEdges\").style(\"pointer-events\", \"none\");\n controlOverlay.attr(\"transform\", function(d) {\n return strTranslate(d.model.translateX, d.model.translateY);\n });\n var parcoordsControlView = controlOverlay.selectAll(\".\" + c.cn.parcoordsControlView).data(repeat, keyFun);\n parcoordsControlView.enter().append(\"g\").classed(c.cn.parcoordsControlView, true);\n parcoordsControlView.attr(\"transform\", function(d) {\n return strTranslate(d.model.pad.l, d.model.pad.t);\n });\n var yAxis = parcoordsControlView.selectAll(\".\" + c.cn.yAxis).data(function(p) {\n return p.dimensions;\n }, keyFun);\n yAxis.enter().append(\"g\").classed(c.cn.yAxis, true);\n parcoordsControlView.each(function(p) {\n updatePanelLayout(yAxis, p, plotGlPixelRatio);\n });\n glLayers.each(function(d) {\n if (d.viewModel) {\n if (!d.lineLayer || callbacks) {\n d.lineLayer = lineLayerMaker(this, d);\n } else d.lineLayer.update(d);\n if (d.key || d.key === 0) d.viewModel[d.key] = d.lineLayer;\n var setChanged = !d.context || // don't update background\n callbacks;\n d.lineLayer.render(d.viewModel.panels, setChanged);\n }\n });\n yAxis.attr(\"transform\", function(d) {\n return strTranslate(d.xScale(d.xIndex), 0);\n });\n yAxis.call(\n d3.behavior.drag().origin(function(d) {\n return d;\n }).on(\"drag\", function(d) {\n var p = d.parent;\n state.linePickActive(false);\n d.x = Math.max(-c.overdrag, Math.min(d.model.width + c.overdrag, d3.event.x));\n d.canvasX = d.x * d.model.canvasPixelRatio;\n yAxis.sort(function(a, b) {\n return a.x - b.x;\n }).each(function(e, i) {\n e.xIndex = i;\n e.x = d === e ? e.x : e.xScale(e.xIndex);\n e.canvasX = e.x * e.model.canvasPixelRatio;\n });\n updatePanelLayout(yAxis, p, plotGlPixelRatio);\n yAxis.filter(function(e) {\n return Math.abs(d.xIndex - e.xIndex) !== 0;\n }).attr(\"transform\", function(d2) {\n return strTranslate(d2.xScale(d2.xIndex), 0);\n });\n d3.select(this).attr(\"transform\", strTranslate(d.x, 0));\n yAxis.each(function(e, i0, i1) {\n if (i1 === d.parent.key) p.dimensions[i0] = e;\n });\n p.contextLayer && p.contextLayer.render(p.panels, false, !someFiltersActive(p));\n p.focusLayer.render && p.focusLayer.render(p.panels);\n }).on(\"dragend\", function(d) {\n var p = d.parent;\n d.x = d.xScale(d.xIndex);\n d.canvasX = d.x * d.model.canvasPixelRatio;\n updatePanelLayout(yAxis, p, plotGlPixelRatio);\n d3.select(this).attr(\"transform\", function(d2) {\n return strTranslate(d2.x, 0);\n });\n p.contextLayer && p.contextLayer.render(p.panels, false, !someFiltersActive(p));\n p.focusLayer && p.focusLayer.render(p.panels);\n p.pickLayer && p.pickLayer.render(p.panels, true);\n state.linePickActive(true);\n if (callbacks && callbacks.axesMoved) {\n callbacks.axesMoved(p.key, p.dimensions.map(function(e) {\n return e.crossfilterDimensionIndex;\n }));\n }\n })\n );\n yAxis.exit().remove();\n var axisOverlays = yAxis.selectAll(\".\" + c.cn.axisOverlays).data(repeat, keyFun);\n axisOverlays.enter().append(\"g\").classed(c.cn.axisOverlays, true);\n axisOverlays.selectAll(\".\" + c.cn.axis).remove();\n var axis = axisOverlays.selectAll(\".\" + c.cn.axis).data(repeat, keyFun);\n axis.enter().append(\"g\").classed(c.cn.axis, true);\n axis.each(function(d) {\n var wantedTickCount = d.model.height / d.model.tickDistance;\n var scale = d.domainScale;\n var sdom = scale.domain();\n d3.select(this).call(d3.svg.axis().orient(\"left\").tickSize(4).outerTickSize(2).ticks(wantedTickCount, d.tickFormat).tickValues(d.ordinal ? (\n // and this works for ordinal scales\n sdom\n ) : null).tickFormat(function(v) {\n return helpers.isOrdinal(d) ? v : linearFormat(d.model.dimensions[d.visibleIndex], v);\n }).scale(scale));\n Drawing.font(axis.selectAll(\"text\"), d.model.tickFont);\n });\n axis.selectAll(\".domain, .tick>line\").attr(\"fill\", \"none\").attr(\"stroke\", \"black\").attr(\"stroke-opacity\", 0.25).attr(\"stroke-width\", \"1px\");\n axis.selectAll(\"text\").style(\"cursor\", \"default\");\n var axisHeading = axisOverlays.selectAll(\".\" + c.cn.axisHeading).data(repeat, keyFun);\n axisHeading.enter().append(\"g\").classed(c.cn.axisHeading, true);\n var axisTitle = axisHeading.selectAll(\".\" + c.cn.axisTitle).data(repeat, keyFun);\n axisTitle.enter().append(\"text\").classed(c.cn.axisTitle, true).attr(\"text-anchor\", \"middle\").style(\"cursor\", \"ew-resize\").style(\"pointer-events\", isStatic ? \"none\" : \"auto\");\n axisTitle.text(function(d) {\n return d.label;\n }).each(function(d) {\n var e = d3.select(this);\n Drawing.font(e, d.model.labelFont);\n svgTextUtils.convertToTspans(e, gd);\n }).attr(\"transform\", function(d) {\n var tilt = calcTilt(d.model.labelAngle, d.model.labelSide);\n var r = c.axisTitleOffset;\n return (tilt.dir > 0 ? \"\" : strTranslate(0, 2 * r + d.model.height)) + strRotate(tilt.degrees) + strTranslate(-r * tilt.dx, -r * tilt.dy);\n }).attr(\"text-anchor\", function(d) {\n var tilt = calcTilt(d.model.labelAngle, d.model.labelSide);\n var adx = Math.abs(tilt.dx);\n var ady = Math.abs(tilt.dy);\n if (2 * adx > ady) {\n return tilt.dir * tilt.dx < 0 ? \"start\" : \"end\";\n } else {\n return \"middle\";\n }\n });\n var axisExtent = axisOverlays.selectAll(\".\" + c.cn.axisExtent).data(repeat, keyFun);\n axisExtent.enter().append(\"g\").classed(c.cn.axisExtent, true);\n var axisExtentTop = axisExtent.selectAll(\".\" + c.cn.axisExtentTop).data(repeat, keyFun);\n axisExtentTop.enter().append(\"g\").classed(c.cn.axisExtentTop, true);\n axisExtentTop.attr(\"transform\", strTranslate(0, -c.axisExtentOffset));\n var axisExtentTopText = axisExtentTop.selectAll(\".\" + c.cn.axisExtentTopText).data(repeat, keyFun);\n axisExtentTopText.enter().append(\"text\").classed(c.cn.axisExtentTopText, true).call(styleExtentTexts);\n axisExtentTopText.text(function(d) {\n return extremeText(d, true);\n }).each(function(d) {\n Drawing.font(d3.select(this), d.model.rangeFont);\n });\n var axisExtentBottom = axisExtent.selectAll(\".\" + c.cn.axisExtentBottom).data(repeat, keyFun);\n axisExtentBottom.enter().append(\"g\").classed(c.cn.axisExtentBottom, true);\n axisExtentBottom.attr(\"transform\", function(d) {\n return strTranslate(0, d.model.height + c.axisExtentOffset);\n });\n var axisExtentBottomText = axisExtentBottom.selectAll(\".\" + c.cn.axisExtentBottomText).data(repeat, keyFun);\n axisExtentBottomText.enter().append(\"text\").classed(c.cn.axisExtentBottomText, true).attr(\"dy\", \"0.75em\").call(styleExtentTexts);\n axisExtentBottomText.text(function(d) {\n return extremeText(d, false);\n }).each(function(d) {\n Drawing.font(d3.select(this), d.model.rangeFont);\n });\n brush.ensureAxisBrush(axisOverlays, paperColor, gd);\n };\n }\n });\n\n // src/traces/parcoords/plot.js\n var require_plot21 = __commonJS({\n \"src/traces/parcoords/plot.js\"(exports, module) {\n \"use strict\";\n var parcoords = require_parcoords();\n var prepareRegl = require_prepare_regl();\n var isVisible = require_helpers18().isVisible;\n var reglPrecompiled = {};\n function newIndex(visibleIndices, orig, dim) {\n var origIndex = orig.indexOf(dim);\n var currentIndex = visibleIndices.indexOf(origIndex);\n if (currentIndex === -1) {\n currentIndex += orig.length;\n }\n return currentIndex;\n }\n function sorter(visibleIndices, orig) {\n return function sorter2(d1, d2) {\n return newIndex(visibleIndices, orig, d1) - newIndex(visibleIndices, orig, d2);\n };\n }\n var exports = module.exports = function plot(gd, cdModule) {\n var fullLayout = gd._fullLayout;\n var success = prepareRegl(gd, [], reglPrecompiled);\n if (!success) return;\n var currentDims = {};\n var initialDims = {};\n var fullIndices = {};\n var inputIndices = {};\n var size = fullLayout._size;\n cdModule.forEach(function(d, i) {\n var trace = d[0].trace;\n fullIndices[i] = trace.index;\n var iIn = inputIndices[i] = trace.index;\n currentDims[i] = gd.data[iIn].dimensions;\n initialDims[i] = gd.data[iIn].dimensions.slice();\n });\n var filterChanged = function(i, initialDimIndex, newRanges) {\n var dim = initialDims[i][initialDimIndex];\n var newConstraints = newRanges.map(function(r) {\n return r.slice();\n });\n var aStr = \"dimensions[\" + initialDimIndex + \"].constraintrange\";\n var preGUI = fullLayout._tracePreGUI[gd._fullData[fullIndices[i]]._fullInput.uid];\n if (preGUI[aStr] === void 0) {\n var initialVal = dim.constraintrange;\n preGUI[aStr] = initialVal || null;\n }\n var fullDimension = gd._fullData[fullIndices[i]].dimensions[initialDimIndex];\n if (!newConstraints.length) {\n delete dim.constraintrange;\n delete fullDimension.constraintrange;\n newConstraints = null;\n } else {\n if (newConstraints.length === 1) newConstraints = newConstraints[0];\n dim.constraintrange = newConstraints;\n fullDimension.constraintrange = newConstraints.slice();\n newConstraints = [newConstraints];\n }\n var restyleData = {};\n restyleData[aStr] = newConstraints;\n gd.emit(\"plotly_restyle\", [restyleData, [inputIndices[i]]]);\n };\n var hover = function(eventData) {\n gd.emit(\"plotly_hover\", eventData);\n };\n var unhover = function(eventData) {\n gd.emit(\"plotly_unhover\", eventData);\n };\n var axesMoved = function(i, visibleIndices) {\n var orig = sorter(visibleIndices, initialDims[i].filter(isVisible));\n currentDims[i].sort(orig);\n initialDims[i].filter(function(d) {\n return !isVisible(d);\n }).sort(function(d) {\n return initialDims[i].indexOf(d);\n }).forEach(function(d) {\n currentDims[i].splice(currentDims[i].indexOf(d), 1);\n currentDims[i].splice(initialDims[i].indexOf(d), 0, d);\n });\n gd.emit(\"plotly_restyle\", [{ dimensions: [currentDims[i]] }, [inputIndices[i]]]);\n };\n parcoords(\n gd,\n cdModule,\n {\n // layout\n width: size.w,\n height: size.h,\n margin: {\n t: size.t,\n r: size.r,\n b: size.b,\n l: size.l\n }\n },\n {\n // callbacks\n filterChanged,\n hover,\n unhover,\n axesMoved\n }\n );\n };\n exports.reglPrecompiled = reglPrecompiled;\n }\n });\n\n // src/traces/parcoords/base_plot.js\n var require_base_plot7 = __commonJS({\n \"src/traces/parcoords/base_plot.js\"(exports) {\n \"use strict\";\n var d3 = require_d3();\n var getModuleCalcData = require_get_data().getModuleCalcData;\n var parcoordsPlot = require_plot21();\n var xmlnsNamespaces = require_xmlns_namespaces();\n exports.name = \"parcoords\";\n exports.plot = function(gd) {\n var calcData = getModuleCalcData(gd.calcdata, \"parcoords\")[0];\n if (calcData.length) parcoordsPlot(gd, calcData);\n };\n exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var hadParcoords = oldFullLayout._has && oldFullLayout._has(\"parcoords\");\n var hasParcoords = newFullLayout._has && newFullLayout._has(\"parcoords\");\n if (hadParcoords && !hasParcoords) {\n oldFullLayout._paperdiv.selectAll(\".parcoords\").remove();\n oldFullLayout._glimages.selectAll(\"*\").remove();\n }\n };\n exports.toSVG = function(gd) {\n var imageRoot = gd._fullLayout._glimages;\n var root = d3.select(gd).selectAll(\".svg-container\");\n var canvases = root.filter(function(d, i) {\n return i === root.size() - 1;\n }).selectAll(\".gl-canvas-context, .gl-canvas-focus\");\n function canvasToImage() {\n var canvas = this;\n var imageData = canvas.toDataURL(\"image/png\");\n var image = imageRoot.append(\"svg:image\");\n image.attr({\n xmlns: xmlnsNamespaces.svg,\n \"xlink:href\": imageData,\n preserveAspectRatio: \"none\",\n x: 0,\n y: 0,\n width: canvas.style.width,\n height: canvas.style.height\n });\n }\n canvases.each(canvasToImage);\n window.setTimeout(function() {\n d3.selectAll(\"#filterBarPattern\").attr(\"id\", \"filterBarPattern\");\n }, 60);\n };\n }\n });\n\n // src/traces/parcoords/base_index.js\n var require_base_index3 = __commonJS({\n \"src/traces/parcoords/base_index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes52(),\n supplyDefaults: require_defaults48(),\n calc: require_calc31(),\n colorbar: {\n container: \"line\",\n min: \"cmin\",\n max: \"cmax\"\n },\n moduleType: \"trace\",\n name: \"parcoords\",\n basePlotModule: require_base_plot7(),\n categories: [\"gl\", \"regl\", \"noOpacity\", \"noHover\"],\n meta: {}\n };\n }\n });\n\n // src/traces/parcoords/index.js\n var require_parcoords2 = __commonJS({\n \"src/traces/parcoords/index.js\"(exports, module) {\n \"use strict\";\n var index = require_base_index3();\n index.plot = require_plot21();\n module.exports = index;\n }\n });\n\n // lib/parcoords.js\n var require_parcoords3 = __commonJS({\n \"lib/parcoords.js\"(exports, module) {\n \"use strict\";\n module.exports = require_parcoords2();\n }\n });\n\n // src/traces/parcats/attributes.js\n var require_attributes53 = __commonJS({\n \"src/traces/parcats/attributes.js\"(exports, module) {\n \"use strict\";\n var extendFlat = require_extend().extendFlat;\n var baseAttrs = require_attributes2();\n var fontAttrs = require_font_attributes();\n var colorScaleAttrs = require_attributes8();\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var domainAttrs = require_domain().attributes;\n var line = extendFlat(\n { editType: \"calc\" },\n colorScaleAttrs(\"line\", { editTypeOverride: \"calc\" }),\n {\n shape: {\n valType: \"enumerated\",\n values: [\"linear\", \"hspline\"],\n dflt: \"linear\",\n editType: \"plot\"\n },\n hovertemplate: hovertemplateAttrs({\n editType: \"plot\",\n arrayOk: false\n }, {\n keys: [\"count\", \"probability\"]\n })\n }\n );\n module.exports = {\n domain: domainAttrs({ name: \"parcats\", trace: true, editType: \"calc\" }),\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: [\"count\", \"probability\"],\n editType: \"plot\",\n arrayOk: false\n }),\n hoveron: {\n valType: \"enumerated\",\n values: [\"category\", \"color\", \"dimension\"],\n dflt: \"category\",\n editType: \"plot\"\n },\n hovertemplate: hovertemplateAttrs({\n editType: \"plot\",\n arrayOk: false\n }, {\n keys: [\n \"count\",\n \"probability\",\n \"category\",\n \"categorycount\",\n \"colorcount\",\n \"bandcolorcount\"\n ]\n }),\n arrangement: {\n valType: \"enumerated\",\n values: [\"perpendicular\", \"freeform\", \"fixed\"],\n dflt: \"perpendicular\",\n editType: \"plot\"\n },\n bundlecolors: {\n valType: \"boolean\",\n dflt: true,\n editType: \"plot\"\n },\n sortpaths: {\n valType: \"enumerated\",\n values: [\"forward\", \"backward\"],\n dflt: \"forward\",\n editType: \"plot\"\n },\n labelfont: fontAttrs({\n editType: \"calc\"\n }),\n tickfont: fontAttrs({\n autoShadowDflt: true,\n editType: \"calc\"\n }),\n dimensions: {\n _isLinkedToArray: \"dimension\",\n label: {\n valType: \"string\",\n editType: \"calc\"\n },\n categoryorder: {\n valType: \"enumerated\",\n values: [\n \"trace\",\n \"category ascending\",\n \"category descending\",\n \"array\"\n ],\n dflt: \"trace\",\n editType: \"calc\"\n },\n categoryarray: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n ticktext: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n values: {\n valType: \"data_array\",\n dflt: [],\n editType: \"calc\"\n },\n displayindex: {\n valType: \"integer\",\n editType: \"calc\"\n },\n editType: \"calc\",\n visible: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc\"\n }\n },\n line,\n counts: {\n valType: \"number\",\n min: 0,\n dflt: 1,\n arrayOk: true,\n editType: \"calc\"\n },\n // Hide unsupported top-level properties from plot-schema\n customdata: void 0,\n hoverlabel: void 0,\n ids: void 0,\n legend: void 0,\n legendgroup: void 0,\n legendrank: void 0,\n opacity: void 0,\n selectedpoints: void 0,\n showlegend: void 0\n };\n }\n });\n\n // src/traces/parcats/defaults.js\n var require_defaults49 = __commonJS({\n \"src/traces/parcats/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var hasColorscale = require_helpers().hasColorscale;\n var colorscaleDefaults = require_defaults2();\n var handleDomainDefaults = require_domain().defaults;\n var handleArrayContainerDefaults = require_array_container_defaults();\n var attributes = require_attributes53();\n var mergeLength = require_merge_length();\n var isTypedArraySpec = require_array().isTypedArraySpec;\n function handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce) {\n coerce(\"line.shape\");\n coerce(\"line.hovertemplate\");\n var lineColor = coerce(\"line.color\", layout.colorway[0]);\n if (hasColorscale(traceIn, \"line\") && Lib.isArrayOrTypedArray(lineColor)) {\n if (lineColor.length) {\n coerce(\"line.colorscale\");\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"line.\", cLetter: \"c\" });\n return lineColor.length;\n } else {\n traceOut.line.color = defaultColor;\n }\n }\n return Infinity;\n }\n function dimensionDefaults(dimensionIn, dimensionOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(dimensionIn, dimensionOut, attributes.dimensions, attr, dflt);\n }\n var values = coerce(\"values\");\n var visible = coerce(\"visible\");\n if (!(values && values.length)) {\n visible = dimensionOut.visible = false;\n }\n if (visible) {\n coerce(\"label\");\n coerce(\"displayindex\", dimensionOut._index);\n var arrayIn = dimensionIn.categoryarray;\n var isValidArray = Lib.isArrayOrTypedArray(arrayIn) && arrayIn.length > 0 || isTypedArraySpec(arrayIn);\n var orderDefault;\n if (isValidArray) orderDefault = \"array\";\n var order = coerce(\"categoryorder\", orderDefault);\n if (order === \"array\") {\n coerce(\"categoryarray\");\n coerce(\"ticktext\");\n } else {\n delete dimensionIn.categoryarray;\n delete dimensionIn.ticktext;\n }\n if (!isValidArray && order === \"array\") {\n dimensionOut.categoryorder = \"trace\";\n }\n }\n }\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var dimensions = handleArrayContainerDefaults(traceIn, traceOut, {\n name: \"dimensions\",\n handleItemDefaults: dimensionDefaults\n });\n var len = handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce);\n handleDomainDefaults(traceOut, layout, coerce);\n if (!Array.isArray(dimensions) || !dimensions.length) {\n traceOut.visible = false;\n }\n mergeLength(traceOut, dimensions, \"values\", len);\n coerce(\"hoveron\");\n coerce(\"hovertemplate\");\n coerce(\"arrangement\");\n coerce(\"bundlecolors\");\n coerce(\"sortpaths\");\n coerce(\"counts\");\n var layoutFont = layout.font;\n Lib.coerceFont(coerce, \"labelfont\", layoutFont, {\n overrideDflt: {\n size: Math.round(layoutFont.size)\n }\n });\n Lib.coerceFont(coerce, \"tickfont\", layoutFont, {\n autoShadowDflt: true,\n overrideDflt: {\n size: Math.round(layoutFont.size / 1.2)\n }\n });\n };\n }\n });\n\n // src/traces/parcats/calc.js\n var require_calc32 = __commonJS({\n \"src/traces/parcats/calc.js\"(exports, module) {\n \"use strict\";\n var wrap = require_gup().wrap;\n var hasColorscale = require_helpers().hasColorscale;\n var colorscaleCalc = require_calc();\n var filterUnique = require_filter_unique();\n var Drawing = require_drawing();\n var Lib = require_lib();\n var isNumeric = require_fast_isnumeric();\n module.exports = function calc(gd, trace) {\n var visibleDims = Lib.filterVisible(trace.dimensions);\n if (visibleDims.length === 0) return [];\n var uniqueInfoDims = visibleDims.map(function(dim) {\n var categoryValues;\n if (dim.categoryorder === \"trace\") {\n categoryValues = null;\n } else if (dim.categoryorder === \"array\") {\n categoryValues = dim.categoryarray;\n } else {\n categoryValues = filterUnique(dim.values);\n var allNumeric = true;\n for (var i = 0; i < categoryValues.length; i++) {\n if (!isNumeric(categoryValues[i])) {\n allNumeric = false;\n break;\n }\n }\n categoryValues.sort(allNumeric ? Lib.sorterAsc : void 0);\n if (dim.categoryorder === \"category descending\") {\n categoryValues = categoryValues.reverse();\n }\n }\n return getUniqueInfo(dim.values, categoryValues);\n });\n var counts, count, totalCount;\n if (Lib.isArrayOrTypedArray(trace.counts)) {\n counts = trace.counts;\n } else {\n counts = [trace.counts];\n }\n validateDimensionDisplayInds(visibleDims);\n visibleDims.forEach(function(dim, dimInd) {\n validateCategoryProperties(dim, uniqueInfoDims[dimInd]);\n });\n var line = trace.line;\n var markerColorscale;\n if (line) {\n if (hasColorscale(trace, \"line\")) {\n colorscaleCalc(gd, trace, {\n vals: trace.line.color,\n containerStr: \"line\",\n cLetter: \"c\"\n });\n }\n markerColorscale = Drawing.tryColorscale(line);\n } else {\n markerColorscale = Lib.identity;\n }\n function getMarkerColorInfo(index) {\n var value, rawColor;\n if (Lib.isArrayOrTypedArray(line.color)) {\n value = line.color[index % line.color.length];\n rawColor = value;\n } else {\n value = line.color;\n }\n return { color: markerColorscale(value), rawColor };\n }\n var numValues = visibleDims[0].values.length;\n var pathModels = {};\n var categoryIndsDims = uniqueInfoDims.map(function(di) {\n return di.inds;\n });\n totalCount = 0;\n var valueInd;\n var d;\n for (valueInd = 0; valueInd < numValues; valueInd++) {\n var categoryIndsPath = [];\n for (d = 0; d < categoryIndsDims.length; d++) {\n categoryIndsPath.push(categoryIndsDims[d][valueInd]);\n }\n count = counts[valueInd % counts.length];\n totalCount += count;\n var pathColorInfo = getMarkerColorInfo(valueInd);\n var pathKey = categoryIndsPath + \"-\" + pathColorInfo.rawColor;\n if (pathModels[pathKey] === void 0) {\n pathModels[pathKey] = createPathModel(\n categoryIndsPath,\n pathColorInfo.color,\n pathColorInfo.rawColor\n );\n }\n updatePathModel(pathModels[pathKey], valueInd, count);\n }\n var dimensionModels = visibleDims.map(function(di, i) {\n return createDimensionModel(i, di._index, di._displayindex, di.label, totalCount);\n });\n for (valueInd = 0; valueInd < numValues; valueInd++) {\n count = counts[valueInd % counts.length];\n for (d = 0; d < dimensionModels.length; d++) {\n var containerInd = dimensionModels[d].containerInd;\n var catInd = uniqueInfoDims[d].inds[valueInd];\n var cats = dimensionModels[d].categories;\n if (cats[catInd] === void 0) {\n var catValue = trace.dimensions[containerInd]._categoryarray[catInd];\n var catLabel = trace.dimensions[containerInd]._ticktext[catInd];\n cats[catInd] = createCategoryModel(d, catInd, catValue, catLabel);\n }\n updateCategoryModel(cats[catInd], valueInd, count);\n }\n }\n return wrap(createParcatsModel(dimensionModels, pathModels, totalCount));\n };\n function createParcatsModel(dimensions, paths, count) {\n var maxCats = dimensions.map(function(d) {\n return d.categories.length;\n }).reduce(function(v1, v2) {\n return Math.max(v1, v2);\n });\n return { dimensions, paths, trace: void 0, maxCats, count };\n }\n function createDimensionModel(dimensionInd, containerInd, displayInd, dimensionLabel, count) {\n return {\n dimensionInd,\n containerInd,\n displayInd,\n dimensionLabel,\n count,\n categories: [],\n dragX: null\n };\n }\n function createCategoryModel(dimensionInd, categoryInd, categoryValue, categoryLabel) {\n return {\n dimensionInd,\n categoryInd,\n categoryValue,\n displayInd: categoryInd,\n categoryLabel,\n valueInds: [],\n count: 0,\n dragY: null\n };\n }\n function updateCategoryModel(categoryModel, valueInd, count) {\n categoryModel.valueInds.push(valueInd);\n categoryModel.count += count;\n }\n function createPathModel(categoryInds, color2, rawColor) {\n return {\n categoryInds,\n color: color2,\n rawColor,\n valueInds: [],\n count: 0\n };\n }\n function updatePathModel(pathModel, valueInd, count) {\n pathModel.valueInds.push(valueInd);\n pathModel.count += count;\n }\n function getUniqueInfo(values, uniqueValues) {\n if (uniqueValues === void 0 || uniqueValues === null) {\n uniqueValues = [];\n } else {\n uniqueValues = uniqueValues.map(function(e) {\n return e;\n });\n }\n var uniqueValueCounts = {};\n var uniqueValueInds = {};\n var inds = [];\n uniqueValues.forEach(function(uniqueVal, valInd) {\n uniqueValueCounts[uniqueVal] = 0;\n uniqueValueInds[uniqueVal] = valInd;\n });\n for (var i = 0; i < values.length; i++) {\n var item = values[i];\n var itemInd;\n if (uniqueValueCounts[item] === void 0) {\n uniqueValueCounts[item] = 1;\n itemInd = uniqueValues.push(item) - 1;\n uniqueValueInds[item] = itemInd;\n } else {\n uniqueValueCounts[item]++;\n itemInd = uniqueValueInds[item];\n }\n inds.push(itemInd);\n }\n var uniqueCounts = uniqueValues.map(function(v) {\n return uniqueValueCounts[v];\n });\n return {\n uniqueValues,\n uniqueCounts,\n inds\n };\n }\n function validateDimensionDisplayInds(visibleDims) {\n var displayInds = visibleDims.map(function(d) {\n return d.displayindex;\n });\n var i;\n if (isRangePermutation(displayInds)) {\n for (i = 0; i < visibleDims.length; i++) {\n visibleDims[i]._displayindex = visibleDims[i].displayindex;\n }\n } else {\n for (i = 0; i < visibleDims.length; i++) {\n visibleDims[i]._displayindex = i;\n }\n }\n }\n function validateCategoryProperties(dim, uniqueInfoDim) {\n dim._categoryarray = uniqueInfoDim.uniqueValues;\n if (dim.ticktext === null || dim.ticktext === void 0) {\n dim._ticktext = [];\n } else {\n dim._ticktext = dim.ticktext.slice();\n }\n for (var i = dim._ticktext.length; i < uniqueInfoDim.uniqueValues.length; i++) {\n dim._ticktext.push(uniqueInfoDim.uniqueValues[i]);\n }\n }\n function isRangePermutation(inds) {\n var indsSpecified = new Array(inds.length);\n for (var i = 0; i < inds.length; i++) {\n if (inds[i] < 0 || inds[i] >= inds.length) {\n return false;\n }\n if (indsSpecified[inds[i]] !== void 0) {\n return false;\n }\n indsSpecified[inds[i]] = true;\n }\n return true;\n }\n }\n });\n\n // src/traces/parcats/parcats.js\n var require_parcats = __commonJS({\n \"src/traces/parcats/parcats.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var interpolateNumber = (init_src2(), __toCommonJS(src_exports)).interpolateNumber;\n var Plotly = require_plot_api();\n var Fx = require_fx();\n var Lib = require_lib();\n var strTranslate = Lib.strTranslate;\n var Drawing = require_drawing();\n var tinycolor = require_tinycolor();\n var svgTextUtils = require_svg_text_utils();\n function performPlot(parcatsModels, graphDiv, layout, svg) {\n var isStatic = graphDiv._context.staticPlot;\n var viewModels = parcatsModels.map(createParcatsViewModel.bind(0, graphDiv, layout));\n var layerSelection = svg.selectAll(\"g.parcatslayer\").data([null]);\n layerSelection.enter().append(\"g\").attr(\"class\", \"parcatslayer\").style(\"pointer-events\", isStatic ? \"none\" : \"all\");\n var traceSelection = layerSelection.selectAll(\"g.trace.parcats\").data(viewModels, key);\n var traceEnter = traceSelection.enter().append(\"g\").attr(\"class\", \"trace parcats\");\n traceSelection.attr(\"transform\", function(d) {\n return strTranslate(d.x, d.y);\n });\n traceEnter.append(\"g\").attr(\"class\", \"paths\");\n var pathsSelection = traceSelection.select(\"g.paths\");\n var pathSelection = pathsSelection.selectAll(\"path.path\").data(function(d) {\n return d.paths;\n }, key);\n pathSelection.attr(\"fill\", function(d) {\n return d.model.color;\n });\n var pathSelectionEnter = pathSelection.enter().append(\"path\").attr(\"class\", \"path\").attr(\"stroke-opacity\", 0).attr(\"fill\", function(d) {\n return d.model.color;\n }).attr(\"fill-opacity\", 0);\n stylePathsNoHover(pathSelectionEnter);\n pathSelection.attr(\"d\", function(d) {\n return d.svgD;\n });\n if (!pathSelectionEnter.empty()) {\n pathSelection.sort(compareRawColor);\n }\n pathSelection.exit().remove();\n pathSelection.on(\"mouseover\", mouseoverPath).on(\"mouseout\", mouseoutPath).on(\"click\", clickPath);\n traceEnter.append(\"g\").attr(\"class\", \"dimensions\");\n var dimensionsSelection = traceSelection.select(\"g.dimensions\");\n var dimensionSelection = dimensionsSelection.selectAll(\"g.dimension\").data(function(d) {\n return d.dimensions;\n }, key);\n dimensionSelection.enter().append(\"g\").attr(\"class\", \"dimension\");\n dimensionSelection.attr(\"transform\", function(d) {\n return strTranslate(d.x, 0);\n });\n dimensionSelection.exit().remove();\n var categorySelection = dimensionSelection.selectAll(\"g.category\").data(function(d) {\n return d.categories;\n }, key);\n var categoryGroupEnterSelection = categorySelection.enter().append(\"g\").attr(\"class\", \"category\");\n categorySelection.attr(\"transform\", function(d) {\n return strTranslate(0, d.y);\n });\n categoryGroupEnterSelection.append(\"rect\").attr(\"class\", \"catrect\").attr(\"pointer-events\", \"none\");\n categorySelection.select(\"rect.catrect\").attr(\"fill\", \"none\").attr(\"width\", function(d) {\n return d.width;\n }).attr(\"height\", function(d) {\n return d.height;\n });\n styleCategoriesNoHover(categoryGroupEnterSelection);\n var bandSelection = categorySelection.selectAll(\"rect.bandrect\").data(\n /** @param {CategoryViewModel} catViewModel*/\n function(catViewModel) {\n return catViewModel.bands;\n },\n key\n );\n bandSelection.each(function() {\n Lib.raiseToTop(this);\n });\n bandSelection.attr(\"fill\", function(d) {\n return d.color;\n });\n var bandsSelectionEnter = bandSelection.enter().append(\"rect\").attr(\"class\", \"bandrect\").attr(\"stroke-opacity\", 0).attr(\"fill\", function(d) {\n return d.color;\n }).attr(\"fill-opacity\", 0);\n bandSelection.attr(\"fill\", function(d) {\n return d.color;\n }).attr(\"width\", function(d) {\n return d.width;\n }).attr(\"height\", function(d) {\n return d.height;\n }).attr(\"y\", function(d) {\n return d.y;\n }).attr(\n \"cursor\",\n /** @param {CategoryBandViewModel} bandModel*/\n function(bandModel) {\n if (bandModel.parcatsViewModel.arrangement === \"fixed\") {\n return \"default\";\n } else if (bandModel.parcatsViewModel.arrangement === \"perpendicular\") {\n return \"ns-resize\";\n } else {\n return \"move\";\n }\n }\n );\n styleBandsNoHover(bandsSelectionEnter);\n bandSelection.exit().remove();\n categoryGroupEnterSelection.append(\"text\").attr(\"class\", \"catlabel\").attr(\"pointer-events\", \"none\");\n categorySelection.select(\"text.catlabel\").attr(\n \"text-anchor\",\n function(d) {\n if (catInRightDim(d)) {\n return \"start\";\n } else {\n return \"end\";\n }\n }\n ).attr(\"alignment-baseline\", \"middle\").style(\"fill\", \"rgb(0, 0, 0)\").attr(\n \"x\",\n function(d) {\n if (catInRightDim(d)) {\n return d.width + 5;\n } else {\n return -5;\n }\n }\n ).attr(\"y\", function(d) {\n return d.height / 2;\n }).text(function(d) {\n return d.model.categoryLabel;\n }).each(\n /** @param {CategoryViewModel} catModel*/\n function(catModel) {\n Drawing.font(d3.select(this), catModel.parcatsViewModel.categorylabelfont);\n svgTextUtils.convertToTspans(d3.select(this), graphDiv);\n }\n );\n categoryGroupEnterSelection.append(\"text\").attr(\"class\", \"dimlabel\");\n categorySelection.select(\"text.dimlabel\").attr(\"text-anchor\", \"middle\").attr(\"alignment-baseline\", \"baseline\").attr(\n \"cursor\",\n /** @param {CategoryViewModel} catModel*/\n function(catModel) {\n if (catModel.parcatsViewModel.arrangement === \"fixed\") {\n return \"default\";\n } else {\n return \"ew-resize\";\n }\n }\n ).attr(\"x\", function(d) {\n return d.width / 2;\n }).attr(\"y\", -5).text(function(d, i) {\n if (i === 0) {\n return d.parcatsViewModel.model.dimensions[d.model.dimensionInd].dimensionLabel;\n } else {\n return null;\n }\n }).each(\n /** @param {CategoryViewModel} catModel*/\n function(catModel) {\n Drawing.font(d3.select(this), catModel.parcatsViewModel.labelfont);\n }\n );\n categorySelection.selectAll(\"rect.bandrect\").on(\"mouseover\", mouseoverCategoryBand).on(\"mouseout\", mouseoutCategory);\n categorySelection.exit().remove();\n dimensionSelection.call(d3.behavior.drag().origin(function(d) {\n return { x: d.x, y: 0 };\n }).on(\"dragstart\", dragDimensionStart).on(\"drag\", dragDimension).on(\"dragend\", dragDimensionEnd));\n traceSelection.each(function(d) {\n d.traceSelection = d3.select(this);\n d.pathSelection = d3.select(this).selectAll(\"g.paths\").selectAll(\"path.path\");\n d.dimensionSelection = d3.select(this).selectAll(\"g.dimensions\").selectAll(\"g.dimension\");\n });\n traceSelection.exit().remove();\n }\n module.exports = function(graphDiv, svg, parcatsModels, layout) {\n performPlot(parcatsModels, graphDiv, layout, svg);\n };\n function key(d) {\n return d.key;\n }\n function catInRightDim(d) {\n var numDims = d.parcatsViewModel.dimensions.length;\n var leftDimInd = d.parcatsViewModel.dimensions[numDims - 1].model.dimensionInd;\n return d.model.dimensionInd === leftDimInd;\n }\n function compareRawColor(a, b) {\n if (a.model.rawColor > b.model.rawColor) {\n return 1;\n } else if (a.model.rawColor < b.model.rawColor) {\n return -1;\n } else {\n return 0;\n }\n }\n function mouseoverPath(d) {\n if (!d.parcatsViewModel.dragDimension) {\n if (d.parcatsViewModel.hoverinfoItems.indexOf(\"skip\") === -1) {\n Lib.raiseToTop(this);\n stylePathsHover(d3.select(this));\n var points = buildPointsArrayForPath(d);\n var constraints = buildConstraintsForPath(d);\n d.parcatsViewModel.graphDiv.emit(\"plotly_hover\", {\n points,\n event: d3.event,\n constraints\n });\n if (d.parcatsViewModel.hoverinfoItems.indexOf(\"none\") === -1) {\n var hoverX = d3.mouse(this)[0];\n var gd = d.parcatsViewModel.graphDiv;\n var trace = d.parcatsViewModel.trace;\n var fullLayout = gd._fullLayout;\n var rootBBox = fullLayout._paperdiv.node().getBoundingClientRect();\n var graphDivBBox = d.parcatsViewModel.graphDiv.getBoundingClientRect();\n var pathCenterX, pathCenterY, dimInd;\n for (dimInd = 0; dimInd < d.leftXs.length - 1; dimInd++) {\n if (d.leftXs[dimInd] + d.dimWidths[dimInd] - 2 <= hoverX && hoverX <= d.leftXs[dimInd + 1] + 2) {\n var leftDim = d.parcatsViewModel.dimensions[dimInd];\n var rightDim = d.parcatsViewModel.dimensions[dimInd + 1];\n pathCenterX = (leftDim.x + leftDim.width + rightDim.x) / 2;\n pathCenterY = (d.topYs[dimInd] + d.topYs[dimInd + 1] + d.height) / 2;\n break;\n }\n }\n var hoverCenterX = d.parcatsViewModel.x + pathCenterX;\n var hoverCenterY = d.parcatsViewModel.y + pathCenterY;\n var textColor = tinycolor.mostReadable(d.model.color, [\"black\", \"white\"]);\n var count = d.model.count;\n var prob = count / d.parcatsViewModel.model.count;\n var labels = {\n countLabel: count,\n probabilityLabel: prob.toFixed(3)\n };\n var hovertextParts = [];\n if (d.parcatsViewModel.hoverinfoItems.indexOf(\"count\") !== -1) {\n hovertextParts.push([\"Count:\", labels.countLabel].join(\" \"));\n }\n if (d.parcatsViewModel.hoverinfoItems.indexOf(\"probability\") !== -1) {\n hovertextParts.push([\"P:\", labels.probabilityLabel].join(\" \"));\n }\n var hovertext = hovertextParts.join(\"
    \");\n var mouseX = d3.mouse(gd)[0];\n Fx.loneHover({\n trace,\n x: hoverCenterX - rootBBox.left + graphDivBBox.left,\n y: hoverCenterY - rootBBox.top + graphDivBBox.top,\n text: hovertext,\n color: d.model.color,\n borderColor: \"black\",\n fontFamily: 'Monaco, \"Courier New\", monospace',\n fontSize: 10,\n fontColor: textColor,\n idealAlign: mouseX < hoverCenterX ? \"right\" : \"left\",\n hovertemplate: (trace.line || {}).hovertemplate,\n hovertemplateLabels: labels,\n eventData: [{\n data: trace._input,\n fullData: trace,\n count,\n probability: prob\n }]\n }, {\n container: fullLayout._hoverlayer.node(),\n outerContainer: fullLayout._paper.node(),\n gd\n });\n }\n }\n }\n }\n function mouseoutPath(d) {\n if (!d.parcatsViewModel.dragDimension) {\n stylePathsNoHover(d3.select(this));\n Fx.loneUnhover(d.parcatsViewModel.graphDiv._fullLayout._hoverlayer.node());\n d.parcatsViewModel.pathSelection.sort(compareRawColor);\n if (d.parcatsViewModel.hoverinfoItems.indexOf(\"skip\") === -1) {\n var points = buildPointsArrayForPath(d);\n var constraints = buildConstraintsForPath(d);\n d.parcatsViewModel.graphDiv.emit(\"plotly_unhover\", {\n points,\n event: d3.event,\n constraints\n });\n }\n }\n }\n function buildPointsArrayForPath(d) {\n var points = [];\n var curveNumber = getTraceIndex(d.parcatsViewModel);\n for (var i = 0; i < d.model.valueInds.length; i++) {\n var pointNumber = d.model.valueInds[i];\n points.push({\n curveNumber,\n pointNumber\n });\n }\n return points;\n }\n function buildConstraintsForPath(d) {\n var constraints = {};\n var dimensions = d.parcatsViewModel.model.dimensions;\n for (var i = 0; i < dimensions.length; i++) {\n var dimension = dimensions[i];\n var category = dimension.categories[d.model.categoryInds[i]];\n constraints[dimension.containerInd] = category.categoryValue;\n }\n if (d.model.rawColor !== void 0) {\n constraints.color = d.model.rawColor;\n }\n return constraints;\n }\n function clickPath(d) {\n if (d.parcatsViewModel.hoverinfoItems.indexOf(\"skip\") === -1) {\n var points = buildPointsArrayForPath(d);\n var constraints = buildConstraintsForPath(d);\n d.parcatsViewModel.graphDiv.emit(\"plotly_click\", {\n points,\n event: d3.event,\n constraints\n });\n }\n }\n function stylePathsNoHover(pathSelection) {\n pathSelection.attr(\"fill\", function(d) {\n return d.model.color;\n }).attr(\"fill-opacity\", 0.6).attr(\"stroke\", \"lightgray\").attr(\"stroke-width\", 0.2).attr(\"stroke-opacity\", 1);\n }\n function stylePathsHover(pathSelection) {\n pathSelection.attr(\"fill-opacity\", 0.8).attr(\"stroke\", function(d) {\n return tinycolor.mostReadable(d.model.color, [\"black\", \"white\"]);\n }).attr(\"stroke-width\", 0.3);\n }\n function styleCategoryHover(categorySelection) {\n categorySelection.select(\"rect.catrect\").attr(\"stroke\", \"black\").attr(\"stroke-width\", 2.5);\n }\n function styleCategoriesNoHover(categorySelection) {\n categorySelection.select(\"rect.catrect\").attr(\"stroke\", \"black\").attr(\"stroke-width\", 1).attr(\"stroke-opacity\", 1);\n }\n function styleBandsHover(bandsSelection) {\n bandsSelection.attr(\"stroke\", \"black\").attr(\"stroke-width\", 1.5);\n }\n function styleBandsNoHover(bandsSelection) {\n bandsSelection.attr(\"stroke\", \"black\").attr(\"stroke-width\", 0.2).attr(\"stroke-opacity\", 1).attr(\"fill-opacity\", 1);\n }\n function selectPathsThroughCategoryBandColor(catBandViewModel) {\n var allPaths = catBandViewModel.parcatsViewModel.pathSelection;\n var dimInd = catBandViewModel.categoryViewModel.model.dimensionInd;\n var catInd = catBandViewModel.categoryViewModel.model.categoryInd;\n return allPaths.filter(\n /** @param {PathViewModel} pathViewModel */\n function(pathViewModel) {\n return pathViewModel.model.categoryInds[dimInd] === catInd && pathViewModel.model.color === catBandViewModel.color;\n }\n );\n }\n function styleForCategoryHovermode(bandElement) {\n var bandSel = d3.select(bandElement.parentNode).selectAll(\"rect.bandrect\");\n bandSel.each(function(bvm) {\n var paths = selectPathsThroughCategoryBandColor(bvm);\n stylePathsHover(paths);\n paths.each(function() {\n Lib.raiseToTop(this);\n });\n });\n styleCategoryHover(d3.select(bandElement.parentNode));\n }\n function styleForColorHovermode(bandElement) {\n var bandViewModel = d3.select(bandElement).datum();\n var catPaths = selectPathsThroughCategoryBandColor(bandViewModel);\n stylePathsHover(catPaths);\n catPaths.each(function() {\n Lib.raiseToTop(this);\n });\n d3.select(bandElement.parentNode).selectAll(\"rect.bandrect\").filter(function(b) {\n return b.color === bandViewModel.color;\n }).each(function() {\n Lib.raiseToTop(this);\n styleBandsHover(d3.select(this));\n });\n }\n function emitPointsEventCategoryHovermode(bandElement, eventName, event) {\n var bandViewModel = d3.select(bandElement).datum();\n var categoryModel = bandViewModel.categoryViewModel.model;\n var gd = bandViewModel.parcatsViewModel.graphDiv;\n var bandSel = d3.select(bandElement.parentNode).selectAll(\"rect.bandrect\");\n var points = [];\n bandSel.each(function(bvm) {\n var paths = selectPathsThroughCategoryBandColor(bvm);\n paths.each(function(pathViewModel) {\n Array.prototype.push.apply(points, buildPointsArrayForPath(pathViewModel));\n });\n });\n var constraints = {};\n constraints[categoryModel.dimensionInd] = categoryModel.categoryValue;\n gd.emit(eventName, {\n points,\n event,\n constraints\n });\n }\n function emitPointsEventColorHovermode(bandElement, eventName, event) {\n var bandViewModel = d3.select(bandElement).datum();\n var categoryModel = bandViewModel.categoryViewModel.model;\n var gd = bandViewModel.parcatsViewModel.graphDiv;\n var paths = selectPathsThroughCategoryBandColor(bandViewModel);\n var points = [];\n paths.each(function(pathViewModel) {\n Array.prototype.push.apply(points, buildPointsArrayForPath(pathViewModel));\n });\n var constraints = {};\n constraints[categoryModel.dimensionInd] = categoryModel.categoryValue;\n if (bandViewModel.rawColor !== void 0) {\n constraints.color = bandViewModel.rawColor;\n }\n gd.emit(eventName, {\n points,\n event,\n constraints\n });\n }\n function createHoverLabelForCategoryHovermode(gd, rootBBox, bandElement) {\n gd._fullLayout._calcInverseTransform(gd);\n var scaleX = gd._fullLayout._invScaleX;\n var scaleY = gd._fullLayout._invScaleY;\n var rectSelection = d3.select(bandElement.parentNode).select(\"rect.catrect\");\n var rectBoundingBox = rectSelection.node().getBoundingClientRect();\n var catViewModel = rectSelection.datum();\n var parcatsViewModel = catViewModel.parcatsViewModel;\n var dimensionModel = parcatsViewModel.model.dimensions[catViewModel.model.dimensionInd];\n var trace = parcatsViewModel.trace;\n var hoverCenterY = rectBoundingBox.top + rectBoundingBox.height / 2;\n var hoverCenterX, hoverLabelIdealAlign;\n if (parcatsViewModel.dimensions.length > 1 && dimensionModel.displayInd === parcatsViewModel.dimensions.length - 1) {\n hoverCenterX = rectBoundingBox.left;\n hoverLabelIdealAlign = \"left\";\n } else {\n hoverCenterX = rectBoundingBox.left + rectBoundingBox.width;\n hoverLabelIdealAlign = \"right\";\n }\n var count = catViewModel.model.count;\n var catLabel = catViewModel.model.categoryLabel;\n var prob = count / catViewModel.parcatsViewModel.model.count;\n var labels = {\n countLabel: count,\n categoryLabel: catLabel,\n probabilityLabel: prob.toFixed(3)\n };\n var hoverinfoParts = [];\n if (catViewModel.parcatsViewModel.hoverinfoItems.indexOf(\"count\") !== -1) {\n hoverinfoParts.push([\"Count:\", labels.countLabel].join(\" \"));\n }\n if (catViewModel.parcatsViewModel.hoverinfoItems.indexOf(\"probability\") !== -1) {\n hoverinfoParts.push([\"P(\" + labels.categoryLabel + \"):\", labels.probabilityLabel].join(\" \"));\n }\n var hovertext = hoverinfoParts.join(\"
    \");\n return {\n trace,\n x: scaleX * (hoverCenterX - rootBBox.left),\n y: scaleY * (hoverCenterY - rootBBox.top),\n text: hovertext,\n color: \"lightgray\",\n borderColor: \"black\",\n fontFamily: 'Monaco, \"Courier New\", monospace',\n fontSize: 12,\n fontColor: \"black\",\n idealAlign: hoverLabelIdealAlign,\n hovertemplate: trace.hovertemplate,\n hovertemplateLabels: labels,\n eventData: [{\n data: trace._input,\n fullData: trace,\n count,\n category: catLabel,\n probability: prob\n }]\n };\n }\n function createHoverLabelForDimensionHovermode(gd, rootBBox, bandElement) {\n var allHoverlabels = [];\n d3.select(bandElement.parentNode.parentNode).selectAll(\"g.category\").select(\"rect.catrect\").each(function() {\n var bandNode = this;\n allHoverlabels.push(createHoverLabelForCategoryHovermode(gd, rootBBox, bandNode));\n });\n return allHoverlabels;\n }\n function createHoverLabelForColorHovermode(gd, rootBBox, bandElement) {\n gd._fullLayout._calcInverseTransform(gd);\n var scaleX = gd._fullLayout._invScaleX;\n var scaleY = gd._fullLayout._invScaleY;\n var bandBoundingBox = bandElement.getBoundingClientRect();\n var bandViewModel = d3.select(bandElement).datum();\n var catViewModel = bandViewModel.categoryViewModel;\n var parcatsViewModel = catViewModel.parcatsViewModel;\n var dimensionModel = parcatsViewModel.model.dimensions[catViewModel.model.dimensionInd];\n var trace = parcatsViewModel.trace;\n var hoverCenterY = bandBoundingBox.y + bandBoundingBox.height / 2;\n var hoverCenterX, hoverLabelIdealAlign;\n if (parcatsViewModel.dimensions.length > 1 && dimensionModel.displayInd === parcatsViewModel.dimensions.length - 1) {\n hoverCenterX = bandBoundingBox.left;\n hoverLabelIdealAlign = \"left\";\n } else {\n hoverCenterX = bandBoundingBox.left + bandBoundingBox.width;\n hoverLabelIdealAlign = \"right\";\n }\n var catLabel = catViewModel.model.categoryLabel;\n var totalCount = bandViewModel.parcatsViewModel.model.count;\n var bandColorCount = 0;\n bandViewModel.categoryViewModel.bands.forEach(function(b) {\n if (b.color === bandViewModel.color) {\n bandColorCount += b.count;\n }\n });\n var catCount = catViewModel.model.count;\n var colorCount = 0;\n parcatsViewModel.pathSelection.each(\n /** @param {PathViewModel} pathViewModel */\n function(pathViewModel) {\n if (pathViewModel.model.color === bandViewModel.color) {\n colorCount += pathViewModel.model.count;\n }\n }\n );\n var pColorAndCat = bandColorCount / totalCount;\n var pCatGivenColor = bandColorCount / colorCount;\n var pColorGivenCat = bandColorCount / catCount;\n var labels = {\n countLabel: bandColorCount,\n categoryLabel: catLabel,\n probabilityLabel: pColorAndCat.toFixed(3)\n };\n var hoverinfoParts = [];\n if (catViewModel.parcatsViewModel.hoverinfoItems.indexOf(\"count\") !== -1) {\n hoverinfoParts.push([\"Count:\", labels.countLabel].join(\" \"));\n }\n if (catViewModel.parcatsViewModel.hoverinfoItems.indexOf(\"probability\") !== -1) {\n hoverinfoParts.push(\"P(color \\u2229 \" + catLabel + \"): \" + labels.probabilityLabel);\n hoverinfoParts.push(\"P(\" + catLabel + \" | color): \" + pCatGivenColor.toFixed(3));\n hoverinfoParts.push(\"P(color | \" + catLabel + \"): \" + pColorGivenCat.toFixed(3));\n }\n var hovertext = hoverinfoParts.join(\"
    \");\n var textColor = tinycolor.mostReadable(bandViewModel.color, [\"black\", \"white\"]);\n return {\n trace,\n x: scaleX * (hoverCenterX - rootBBox.left),\n y: scaleY * (hoverCenterY - rootBBox.top),\n // name: 'NAME',\n text: hovertext,\n color: bandViewModel.color,\n borderColor: \"black\",\n fontFamily: 'Monaco, \"Courier New\", monospace',\n fontColor: textColor,\n fontSize: 10,\n idealAlign: hoverLabelIdealAlign,\n hovertemplate: trace.hovertemplate,\n hovertemplateLabels: labels,\n eventData: [{\n data: trace._input,\n fullData: trace,\n category: catLabel,\n count: totalCount,\n probability: pColorAndCat,\n categorycount: catCount,\n colorcount: colorCount,\n bandcolorcount: bandColorCount\n }]\n };\n }\n function mouseoverCategoryBand(bandViewModel) {\n if (!bandViewModel.parcatsViewModel.dragDimension) {\n if (bandViewModel.parcatsViewModel.hoverinfoItems.indexOf(\"skip\") === -1) {\n var mouseY = d3.mouse(this)[1];\n if (mouseY < -1) {\n return;\n }\n var gd = bandViewModel.parcatsViewModel.graphDiv;\n var fullLayout = gd._fullLayout;\n var rootBBox = fullLayout._paperdiv.node().getBoundingClientRect();\n var hoveron = bandViewModel.parcatsViewModel.hoveron;\n var bandElement = this;\n if (hoveron === \"color\") {\n styleForColorHovermode(bandElement);\n emitPointsEventColorHovermode(bandElement, \"plotly_hover\", d3.event);\n } else {\n styleForCategoryHovermode(bandElement);\n emitPointsEventCategoryHovermode(bandElement, \"plotly_hover\", d3.event);\n }\n if (bandViewModel.parcatsViewModel.hoverinfoItems.indexOf(\"none\") === -1) {\n var hoverItems;\n if (hoveron === \"category\") {\n hoverItems = createHoverLabelForCategoryHovermode(gd, rootBBox, bandElement);\n } else if (hoveron === \"color\") {\n hoverItems = createHoverLabelForColorHovermode(gd, rootBBox, bandElement);\n } else if (hoveron === \"dimension\") {\n hoverItems = createHoverLabelForDimensionHovermode(gd, rootBBox, bandElement);\n }\n if (hoverItems) {\n Fx.loneHover(hoverItems, {\n container: fullLayout._hoverlayer.node(),\n outerContainer: fullLayout._paper.node(),\n gd\n });\n }\n }\n }\n }\n }\n function mouseoutCategory(bandViewModel) {\n var parcatsViewModel = bandViewModel.parcatsViewModel;\n if (!parcatsViewModel.dragDimension) {\n stylePathsNoHover(parcatsViewModel.pathSelection);\n styleCategoriesNoHover(parcatsViewModel.dimensionSelection.selectAll(\"g.category\"));\n styleBandsNoHover(parcatsViewModel.dimensionSelection.selectAll(\"g.category\").selectAll(\"rect.bandrect\"));\n Fx.loneUnhover(parcatsViewModel.graphDiv._fullLayout._hoverlayer.node());\n parcatsViewModel.pathSelection.sort(compareRawColor);\n if (parcatsViewModel.hoverinfoItems.indexOf(\"skip\") === -1) {\n var hoveron = bandViewModel.parcatsViewModel.hoveron;\n var bandElement = this;\n if (hoveron === \"color\") {\n emitPointsEventColorHovermode(bandElement, \"plotly_unhover\", d3.event);\n } else {\n emitPointsEventCategoryHovermode(bandElement, \"plotly_unhover\", d3.event);\n }\n }\n }\n }\n function dragDimensionStart(d) {\n if (d.parcatsViewModel.arrangement === \"fixed\") {\n return;\n }\n d.dragDimensionDisplayInd = d.model.displayInd;\n d.initialDragDimensionDisplayInds = d.parcatsViewModel.model.dimensions.map(function(d2) {\n return d2.displayInd;\n });\n d.dragHasMoved = false;\n d.dragCategoryDisplayInd = null;\n d3.select(this).selectAll(\"g.category\").select(\"rect.catrect\").each(\n /** @param {CategoryViewModel} catViewModel */\n function(catViewModel) {\n var catMouseX = d3.mouse(this)[0];\n var catMouseY = d3.mouse(this)[1];\n if (-2 <= catMouseX && catMouseX <= catViewModel.width + 2 && -2 <= catMouseY && catMouseY <= catViewModel.height + 2) {\n d.dragCategoryDisplayInd = catViewModel.model.displayInd;\n d.initialDragCategoryDisplayInds = d.model.categories.map(function(c) {\n return c.displayInd;\n });\n catViewModel.model.dragY = catViewModel.y;\n Lib.raiseToTop(this.parentNode);\n d3.select(this.parentNode).selectAll(\"rect.bandrect\").each(function(bandViewModel) {\n if (bandViewModel.y < catMouseY && catMouseY <= bandViewModel.y + bandViewModel.height) {\n d.potentialClickBand = this;\n }\n });\n }\n }\n );\n d.parcatsViewModel.dragDimension = d;\n Fx.loneUnhover(d.parcatsViewModel.graphDiv._fullLayout._hoverlayer.node());\n }\n function dragDimension(d) {\n if (d.parcatsViewModel.arrangement === \"fixed\") {\n return;\n }\n d.dragHasMoved = true;\n if (d.dragDimensionDisplayInd === null) {\n return;\n }\n var dragDimInd = d.dragDimensionDisplayInd;\n var prevDimInd = dragDimInd - 1;\n var nextDimInd = dragDimInd + 1;\n var dragDimension2 = d.parcatsViewModel.dimensions[dragDimInd];\n if (d.dragCategoryDisplayInd !== null) {\n var dragCategory = dragDimension2.categories[d.dragCategoryDisplayInd];\n dragCategory.model.dragY += d3.event.dy;\n var categoryY = dragCategory.model.dragY;\n var catDisplayInd = dragCategory.model.displayInd;\n var dimCategoryViews = dragDimension2.categories;\n var catAbove = dimCategoryViews[catDisplayInd - 1];\n var catBelow = dimCategoryViews[catDisplayInd + 1];\n if (catAbove !== void 0) {\n if (categoryY < catAbove.y + catAbove.height / 2) {\n dragCategory.model.displayInd = catAbove.model.displayInd;\n catAbove.model.displayInd = catDisplayInd;\n }\n }\n if (catBelow !== void 0) {\n if (categoryY + dragCategory.height > catBelow.y + catBelow.height / 2) {\n dragCategory.model.displayInd = catBelow.model.displayInd;\n catBelow.model.displayInd = catDisplayInd;\n }\n }\n d.dragCategoryDisplayInd = dragCategory.model.displayInd;\n }\n if (d.dragCategoryDisplayInd === null || d.parcatsViewModel.arrangement === \"freeform\") {\n dragDimension2.model.dragX = d3.event.x;\n var prevDimension = d.parcatsViewModel.dimensions[prevDimInd];\n var nextDimension = d.parcatsViewModel.dimensions[nextDimInd];\n if (prevDimension !== void 0) {\n if (dragDimension2.model.dragX < prevDimension.x + prevDimension.width) {\n dragDimension2.model.displayInd = prevDimension.model.displayInd;\n prevDimension.model.displayInd = dragDimInd;\n }\n }\n if (nextDimension !== void 0) {\n if (dragDimension2.model.dragX + dragDimension2.width > nextDimension.x) {\n dragDimension2.model.displayInd = nextDimension.model.displayInd;\n nextDimension.model.displayInd = d.dragDimensionDisplayInd;\n }\n }\n d.dragDimensionDisplayInd = dragDimension2.model.displayInd;\n }\n updateDimensionViewModels(d.parcatsViewModel);\n updatePathViewModels(d.parcatsViewModel);\n updateSvgCategories(d.parcatsViewModel);\n updateSvgPaths(d.parcatsViewModel);\n }\n function dragDimensionEnd(d) {\n if (d.parcatsViewModel.arrangement === \"fixed\") {\n return;\n }\n if (d.dragDimensionDisplayInd === null) {\n return;\n }\n d3.select(this).selectAll(\"text\").attr(\"font-weight\", \"normal\");\n var restyleData = {};\n var traceInd = getTraceIndex(d.parcatsViewModel);\n var finalDragDimensionDisplayInds = d.parcatsViewModel.model.dimensions.map(function(d2) {\n return d2.displayInd;\n });\n var anyDimsReordered = d.initialDragDimensionDisplayInds.some(function(initDimDisplay, dimInd) {\n return initDimDisplay !== finalDragDimensionDisplayInds[dimInd];\n });\n if (anyDimsReordered) {\n finalDragDimensionDisplayInds.forEach(function(finalDimDisplay, dimInd) {\n var containerInd = d.parcatsViewModel.model.dimensions[dimInd].containerInd;\n restyleData[\"dimensions[\" + containerInd + \"].displayindex\"] = finalDimDisplay;\n });\n }\n var anyCatsReordered = false;\n if (d.dragCategoryDisplayInd !== null) {\n var finalDragCategoryDisplayInds = d.model.categories.map(function(c) {\n return c.displayInd;\n });\n anyCatsReordered = d.initialDragCategoryDisplayInds.some(function(initCatDisplay, catInd) {\n return initCatDisplay !== finalDragCategoryDisplayInds[catInd];\n });\n if (anyCatsReordered) {\n var sortedCategoryModels = d.model.categories.slice().sort(\n function(a, b) {\n return a.displayInd - b.displayInd;\n }\n );\n var newCategoryArray = sortedCategoryModels.map(function(v) {\n return v.categoryValue;\n });\n var newCategoryLabels = sortedCategoryModels.map(function(v) {\n return v.categoryLabel;\n });\n restyleData[\"dimensions[\" + d.model.containerInd + \"].categoryarray\"] = [newCategoryArray];\n restyleData[\"dimensions[\" + d.model.containerInd + \"].ticktext\"] = [newCategoryLabels];\n restyleData[\"dimensions[\" + d.model.containerInd + \"].categoryorder\"] = \"array\";\n }\n }\n if (d.parcatsViewModel.hoverinfoItems.indexOf(\"skip\") === -1) {\n if (!d.dragHasMoved && d.potentialClickBand) {\n if (d.parcatsViewModel.hoveron === \"color\") {\n emitPointsEventColorHovermode(d.potentialClickBand, \"plotly_click\", d3.event.sourceEvent);\n } else {\n emitPointsEventCategoryHovermode(d.potentialClickBand, \"plotly_click\", d3.event.sourceEvent);\n }\n }\n }\n d.model.dragX = null;\n if (d.dragCategoryDisplayInd !== null) {\n var dragCategory = d.parcatsViewModel.dimensions[d.dragDimensionDisplayInd].categories[d.dragCategoryDisplayInd];\n dragCategory.model.dragY = null;\n d.dragCategoryDisplayInd = null;\n }\n d.dragDimensionDisplayInd = null;\n d.parcatsViewModel.dragDimension = null;\n d.dragHasMoved = null;\n d.potentialClickBand = null;\n updateDimensionViewModels(d.parcatsViewModel);\n updatePathViewModels(d.parcatsViewModel);\n var transition = d3.transition().duration(300).ease(\"cubic-in-out\");\n transition.each(function() {\n updateSvgCategories(d.parcatsViewModel, true);\n updateSvgPaths(d.parcatsViewModel, true);\n }).each(\"end\", function() {\n if (anyDimsReordered || anyCatsReordered) {\n Plotly.restyle(d.parcatsViewModel.graphDiv, restyleData, [traceInd]);\n }\n });\n }\n function getTraceIndex(parcatsViewModel) {\n var traceInd;\n var allTraces = parcatsViewModel.graphDiv._fullData;\n for (var i = 0; i < allTraces.length; i++) {\n if (parcatsViewModel.key === allTraces[i].uid) {\n traceInd = i;\n break;\n }\n }\n return traceInd;\n }\n function updateSvgPaths(parcatsViewModel, hasTransition) {\n if (hasTransition === void 0) {\n hasTransition = false;\n }\n function transition(selection) {\n return hasTransition ? selection.transition() : selection;\n }\n parcatsViewModel.pathSelection.data(function(d) {\n return d.paths;\n }, key);\n transition(parcatsViewModel.pathSelection).attr(\"d\", function(d) {\n return d.svgD;\n });\n }\n function updateSvgCategories(parcatsViewModel, hasTransition) {\n if (hasTransition === void 0) {\n hasTransition = false;\n }\n function transition(selection) {\n return hasTransition ? selection.transition() : selection;\n }\n parcatsViewModel.dimensionSelection.data(function(d) {\n return d.dimensions;\n }, key);\n var categorySelection = parcatsViewModel.dimensionSelection.selectAll(\"g.category\").data(function(d) {\n return d.categories;\n }, key);\n transition(parcatsViewModel.dimensionSelection).attr(\"transform\", function(d) {\n return strTranslate(d.x, 0);\n });\n transition(categorySelection).attr(\"transform\", function(d) {\n return strTranslate(0, d.y);\n });\n var dimLabelSelection = categorySelection.select(\".dimlabel\");\n dimLabelSelection.text(function(d, i) {\n if (i === 0) {\n return d.parcatsViewModel.model.dimensions[d.model.dimensionInd].dimensionLabel;\n } else {\n return null;\n }\n });\n var catLabelSelection = categorySelection.select(\".catlabel\");\n catLabelSelection.attr(\n \"text-anchor\",\n function(d) {\n if (catInRightDim(d)) {\n return \"start\";\n } else {\n return \"end\";\n }\n }\n ).attr(\n \"x\",\n function(d) {\n if (catInRightDim(d)) {\n return d.width + 5;\n } else {\n return -5;\n }\n }\n ).each(function(d) {\n var newX;\n var newAnchor;\n if (catInRightDim(d)) {\n newX = d.width + 5;\n newAnchor = \"start\";\n } else {\n newX = -5;\n newAnchor = \"end\";\n }\n d3.select(this).selectAll(\"tspan\").attr(\"x\", newX).attr(\"text-anchor\", newAnchor);\n });\n var bandSelection = categorySelection.selectAll(\"rect.bandrect\").data(\n /** @param {CategoryViewModel} catViewModel*/\n function(catViewModel) {\n return catViewModel.bands;\n },\n key\n );\n var bandsSelectionEnter = bandSelection.enter().append(\"rect\").attr(\"class\", \"bandrect\").attr(\"cursor\", \"move\").attr(\"stroke-opacity\", 0).attr(\"fill\", function(d) {\n return d.color;\n }).attr(\"fill-opacity\", 0);\n bandSelection.attr(\"fill\", function(d) {\n return d.color;\n }).attr(\"width\", function(d) {\n return d.width;\n }).attr(\"height\", function(d) {\n return d.height;\n }).attr(\"y\", function(d) {\n return d.y;\n });\n styleBandsNoHover(bandsSelectionEnter);\n bandSelection.each(function() {\n Lib.raiseToTop(this);\n });\n bandSelection.exit().remove();\n }\n function createParcatsViewModel(graphDiv, layout, wrappedParcatsModel) {\n var parcatsModel = wrappedParcatsModel[0];\n var margin = layout.margin || { l: 80, r: 80, t: 100, b: 80 };\n var trace = parcatsModel.trace;\n var domain = trace.domain;\n var figureWidth = layout.width;\n var figureHeight = layout.height;\n var traceWidth = Math.floor(figureWidth * (domain.x[1] - domain.x[0]));\n var traceHeight = Math.floor(figureHeight * (domain.y[1] - domain.y[0]));\n var traceX = domain.x[0] * figureWidth + margin.l;\n var traceY = layout.height - domain.y[1] * layout.height + margin.t;\n var pathShape = trace.line.shape;\n var hoverinfoItems;\n if (trace.hoverinfo === \"all\") {\n hoverinfoItems = [\"count\", \"probability\"];\n } else {\n hoverinfoItems = (trace.hoverinfo || \"\").split(\"+\");\n }\n var parcatsViewModel = {\n trace,\n key: trace.uid,\n model: parcatsModel,\n x: traceX,\n y: traceY,\n width: traceWidth,\n height: traceHeight,\n hoveron: trace.hoveron,\n hoverinfoItems,\n arrangement: trace.arrangement,\n bundlecolors: trace.bundlecolors,\n sortpaths: trace.sortpaths,\n labelfont: trace.labelfont,\n categorylabelfont: trace.tickfont,\n pathShape,\n dragDimension: null,\n margin,\n paths: [],\n dimensions: [],\n graphDiv,\n traceSelection: null,\n pathSelection: null,\n dimensionSelection: null\n };\n if (parcatsModel.dimensions) {\n updateDimensionViewModels(parcatsViewModel);\n updatePathViewModels(parcatsViewModel);\n }\n return parcatsViewModel;\n }\n function buildSvgPath(leftXPositions, pathYs, dimWidths, pathHeight, curvature) {\n var xRefPoints1 = [];\n var xRefPoints2 = [];\n var refInterpolator;\n var d;\n for (d = 0; d < dimWidths.length - 1; d++) {\n refInterpolator = interpolateNumber(dimWidths[d] + leftXPositions[d], leftXPositions[d + 1]);\n xRefPoints1.push(refInterpolator(curvature));\n xRefPoints2.push(refInterpolator(1 - curvature));\n }\n var svgD = \"M \" + leftXPositions[0] + \",\" + pathYs[0];\n svgD += \"l\" + dimWidths[0] + \",0 \";\n for (d = 1; d < dimWidths.length; d++) {\n svgD += \"C\" + xRefPoints1[d - 1] + \",\" + pathYs[d - 1] + \" \" + xRefPoints2[d - 1] + \",\" + pathYs[d] + \" \" + leftXPositions[d] + \",\" + pathYs[d];\n svgD += \"l\" + dimWidths[d] + \",0 \";\n }\n svgD += \"l0,\" + pathHeight + \" \";\n svgD += \"l -\" + dimWidths[dimWidths.length - 1] + \",0 \";\n for (d = dimWidths.length - 2; d >= 0; d--) {\n svgD += \"C\" + xRefPoints2[d] + \",\" + (pathYs[d + 1] + pathHeight) + \" \" + xRefPoints1[d] + \",\" + (pathYs[d] + pathHeight) + \" \" + (leftXPositions[d] + dimWidths[d]) + \",\" + (pathYs[d] + pathHeight);\n svgD += \"l-\" + dimWidths[d] + \",0 \";\n }\n svgD += \"Z\";\n return svgD;\n }\n function updatePathViewModels(parcatsViewModel) {\n var dimensionViewModels = parcatsViewModel.dimensions;\n var parcatsModel = parcatsViewModel.model;\n var nextYPositions = dimensionViewModels.map(\n function(d2) {\n return d2.categories.map(\n function(c) {\n return c.y;\n }\n );\n }\n );\n var catToDisplayIndPerDim = parcatsViewModel.model.dimensions.map(\n function(d2) {\n return d2.categories.map(function(c) {\n return c.displayInd;\n });\n }\n );\n var dimToDisplayInd = parcatsViewModel.model.dimensions.map(function(d2) {\n return d2.displayInd;\n });\n var displayToDimInd = parcatsViewModel.dimensions.map(function(d2) {\n return d2.model.dimensionInd;\n });\n var leftXPositions = dimensionViewModels.map(\n function(d2) {\n return d2.x;\n }\n );\n var dimWidths = dimensionViewModels.map(function(d2) {\n return d2.width;\n });\n var pathModels = [];\n for (var p in parcatsModel.paths) {\n if (parcatsModel.paths.hasOwnProperty(p)) {\n pathModels.push(parcatsModel.paths[p]);\n }\n }\n function pathDisplayCategoryInds(pathModel2) {\n var dimensionInds = pathModel2.categoryInds.map(function(catInd2, dimInd) {\n return catToDisplayIndPerDim[dimInd][catInd2];\n });\n var displayInds = displayToDimInd.map(function(dimInd) {\n return dimensionInds[dimInd];\n });\n return displayInds;\n }\n pathModels.sort(function(v1, v2) {\n var sortArray1 = pathDisplayCategoryInds(v1);\n var sortArray2 = pathDisplayCategoryInds(v2);\n if (parcatsViewModel.sortpaths === \"backward\") {\n sortArray1.reverse();\n sortArray2.reverse();\n }\n sortArray1.push(v1.valueInds[0]);\n sortArray2.push(v2.valueInds[0]);\n if (parcatsViewModel.bundlecolors) {\n sortArray1.unshift(v1.rawColor);\n sortArray2.unshift(v2.rawColor);\n }\n if (sortArray1 < sortArray2) {\n return -1;\n }\n if (sortArray1 > sortArray2) {\n return 1;\n }\n return 0;\n });\n var pathViewModels = new Array(pathModels.length);\n var totalCount = dimensionViewModels[0].model.count;\n var totalHeight = dimensionViewModels[0].categories.map(function(c) {\n return c.height;\n }).reduce(function(v1, v2) {\n return v1 + v2;\n });\n for (var pathNumber = 0; pathNumber < pathModels.length; pathNumber++) {\n var pathModel = pathModels[pathNumber];\n var pathHeight;\n if (totalCount > 0) {\n pathHeight = totalHeight * (pathModel.count / totalCount);\n } else {\n pathHeight = 0;\n }\n var pathYs = new Array(nextYPositions.length);\n for (var d = 0; d < pathModel.categoryInds.length; d++) {\n var catInd = pathModel.categoryInds[d];\n var catDisplayInd = catToDisplayIndPerDim[d][catInd];\n var dimDisplayInd = dimToDisplayInd[d];\n pathYs[dimDisplayInd] = nextYPositions[dimDisplayInd][catDisplayInd];\n nextYPositions[dimDisplayInd][catDisplayInd] += pathHeight;\n var catViewModle = parcatsViewModel.dimensions[dimDisplayInd].categories[catDisplayInd];\n var numBands = catViewModle.bands.length;\n var lastCatBand = catViewModle.bands[numBands - 1];\n if (lastCatBand === void 0 || pathModel.rawColor !== lastCatBand.rawColor) {\n var bandY = lastCatBand === void 0 ? 0 : lastCatBand.y + lastCatBand.height;\n catViewModle.bands.push({\n key: bandY,\n color: pathModel.color,\n rawColor: pathModel.rawColor,\n height: pathHeight,\n width: catViewModle.width,\n count: pathModel.count,\n y: bandY,\n categoryViewModel: catViewModle,\n parcatsViewModel\n });\n } else {\n var currentBand = catViewModle.bands[numBands - 1];\n currentBand.height += pathHeight;\n currentBand.count += pathModel.count;\n }\n }\n var svgD;\n if (parcatsViewModel.pathShape === \"hspline\") {\n svgD = buildSvgPath(leftXPositions, pathYs, dimWidths, pathHeight, 0.5);\n } else {\n svgD = buildSvgPath(leftXPositions, pathYs, dimWidths, pathHeight, 0);\n }\n pathViewModels[pathNumber] = {\n key: pathModel.valueInds[0],\n model: pathModel,\n height: pathHeight,\n leftXs: leftXPositions,\n topYs: pathYs,\n dimWidths,\n svgD,\n parcatsViewModel\n };\n }\n parcatsViewModel.paths = pathViewModels;\n }\n function updateDimensionViewModels(parcatsViewModel) {\n var dimensionsIndInfo = parcatsViewModel.model.dimensions.map(function(d) {\n return { displayInd: d.displayInd, dimensionInd: d.dimensionInd };\n });\n dimensionsIndInfo.sort(function(a, b) {\n return a.displayInd - b.displayInd;\n });\n var dimensions = [];\n for (var displayInd in dimensionsIndInfo) {\n var dimensionInd = dimensionsIndInfo[displayInd].dimensionInd;\n var dimModel = parcatsViewModel.model.dimensions[dimensionInd];\n dimensions.push(createDimensionViewModel(parcatsViewModel, dimModel));\n }\n parcatsViewModel.dimensions = dimensions;\n }\n function createDimensionViewModel(parcatsViewModel, dimensionModel) {\n var categoryLabelPad = 40;\n var dimWidth = 16;\n var numDimensions = parcatsViewModel.model.dimensions.length;\n var displayInd = dimensionModel.displayInd;\n var dimDx;\n var dimX0;\n var dimX;\n if (numDimensions > 1) {\n dimDx = (parcatsViewModel.width - 2 * categoryLabelPad - dimWidth) / (numDimensions - 1);\n } else {\n dimDx = 0;\n }\n dimX0 = categoryLabelPad;\n dimX = dimX0 + dimDx * displayInd;\n var categories = [];\n var maxCats = parcatsViewModel.model.maxCats;\n var numCats = dimensionModel.categories.length;\n var catSpacing = 8;\n var totalCount = dimensionModel.count;\n var totalHeight = parcatsViewModel.height - catSpacing * (maxCats - 1);\n var nextCatHeight;\n var nextCatModel;\n var nextCat;\n var catInd;\n var catDisplayInd;\n var nextCatY = (maxCats - numCats) * catSpacing / 2;\n var categoryIndInfo = dimensionModel.categories.map(function(c) {\n return { displayInd: c.displayInd, categoryInd: c.categoryInd };\n });\n categoryIndInfo.sort(function(a, b) {\n return a.displayInd - b.displayInd;\n });\n for (catDisplayInd = 0; catDisplayInd < numCats; catDisplayInd++) {\n catInd = categoryIndInfo[catDisplayInd].categoryInd;\n nextCatModel = dimensionModel.categories[catInd];\n if (totalCount > 0) {\n nextCatHeight = nextCatModel.count / totalCount * totalHeight;\n } else {\n nextCatHeight = 0;\n }\n nextCat = {\n key: nextCatModel.valueInds[0],\n model: nextCatModel,\n width: dimWidth,\n height: nextCatHeight,\n y: nextCatModel.dragY !== null ? nextCatModel.dragY : nextCatY,\n bands: [],\n parcatsViewModel\n };\n nextCatY = nextCatY + nextCatHeight + catSpacing;\n categories.push(nextCat);\n }\n return {\n key: dimensionModel.dimensionInd,\n x: dimensionModel.dragX !== null ? dimensionModel.dragX : dimX,\n y: 0,\n width: dimWidth,\n model: dimensionModel,\n categories,\n parcatsViewModel,\n dragCategoryDisplayInd: null,\n dragDimensionDisplayInd: null,\n initialDragDimensionDisplayInds: null,\n initialDragCategoryDisplayInds: null,\n dragHasMoved: null,\n potentialClickBand: null\n };\n }\n }\n });\n\n // src/traces/parcats/plot.js\n var require_plot22 = __commonJS({\n \"src/traces/parcats/plot.js\"(exports, module) {\n \"use strict\";\n var parcats = require_parcats();\n module.exports = function plot(graphDiv, parcatsModels, transitionOpts, makeOnCompleteCallback) {\n var fullLayout = graphDiv._fullLayout;\n var svg = fullLayout._paper;\n var size = fullLayout._size;\n parcats(\n graphDiv,\n svg,\n parcatsModels,\n {\n width: size.w,\n height: size.h,\n margin: {\n t: size.t,\n r: size.r,\n b: size.b,\n l: size.l\n }\n },\n transitionOpts,\n makeOnCompleteCallback\n );\n };\n }\n });\n\n // src/traces/parcats/base_plot.js\n var require_base_plot8 = __commonJS({\n \"src/traces/parcats/base_plot.js\"(exports) {\n \"use strict\";\n var getModuleCalcData = require_get_data().getModuleCalcData;\n var parcatsPlot = require_plot22();\n var PARCATS = \"parcats\";\n exports.name = PARCATS;\n exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) {\n var cdModuleAndOthers = getModuleCalcData(gd.calcdata, PARCATS);\n if (cdModuleAndOthers.length) {\n var calcData = cdModuleAndOthers[0];\n parcatsPlot(gd, calcData, transitionOpts, makeOnCompleteCallback);\n }\n };\n exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var hadTable = oldFullLayout._has && oldFullLayout._has(\"parcats\");\n var hasTable = newFullLayout._has && newFullLayout._has(\"parcats\");\n if (hadTable && !hasTable) {\n oldFullLayout._paperdiv.selectAll(\".parcats\").remove();\n }\n };\n }\n });\n\n // src/traces/parcats/index.js\n var require_parcats2 = __commonJS({\n \"src/traces/parcats/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes53(),\n supplyDefaults: require_defaults49(),\n calc: require_calc32(),\n plot: require_plot22(),\n colorbar: {\n container: \"line\",\n min: \"cmin\",\n max: \"cmax\"\n },\n moduleType: \"trace\",\n name: \"parcats\",\n basePlotModule: require_base_plot8(),\n categories: [\"noOpacity\"],\n meta: {}\n };\n }\n });\n\n // lib/parcats.js\n var require_parcats3 = __commonJS({\n \"lib/parcats.js\"(exports, module) {\n \"use strict\";\n module.exports = require_parcats2();\n }\n });\n\n // src/plots/mapbox/constants.js\n var require_constants25 = __commonJS({\n \"src/plots/mapbox/constants.js\"(exports, module) {\n \"use strict\";\n var sortObjectKeys = require_sort_object_keys();\n var requiredVersion = \"1.13.4\";\n var OSM = '\\xA9 OpenStreetMap contributors';\n var carto = [\n '\\xA9 Carto',\n OSM\n ].join(\" \");\n var stamenTerrainOrToner = [\n 'Map tiles by Stamen Design',\n 'under CC BY 3.0',\n \"|\",\n 'Data by OpenStreetMap contributors',\n 'under ODbL'\n ].join(\" \");\n var stamenWaterColor = [\n 'Map tiles by Stamen Design',\n 'under CC BY 3.0',\n \"|\",\n 'Data by OpenStreetMap contributors',\n 'under CC BY SA'\n ].join(\" \");\n var stylesNonMapbox = {\n \"open-street-map\": {\n id: \"osm\",\n version: 8,\n sources: {\n \"plotly-osm-tiles\": {\n type: \"raster\",\n attribution: OSM,\n tiles: [\n \"https://a.tile.openstreetmap.org/{z}/{x}/{y}.png\",\n \"https://b.tile.openstreetmap.org/{z}/{x}/{y}.png\"\n ],\n tileSize: 256\n }\n },\n layers: [{\n id: \"plotly-osm-tiles\",\n type: \"raster\",\n source: \"plotly-osm-tiles\",\n minzoom: 0,\n maxzoom: 22\n }],\n glyphs: \"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf\"\n },\n \"white-bg\": {\n id: \"white-bg\",\n version: 8,\n sources: {},\n layers: [{\n id: \"white-bg\",\n type: \"background\",\n paint: { \"background-color\": \"#FFFFFF\" },\n minzoom: 0,\n maxzoom: 22\n }],\n glyphs: \"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf\"\n },\n \"carto-positron\": {\n id: \"carto-positron\",\n version: 8,\n sources: {\n \"plotly-carto-positron\": {\n type: \"raster\",\n attribution: carto,\n tiles: [\"https://cartodb-basemaps-c.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png\"],\n tileSize: 256\n }\n },\n layers: [{\n id: \"plotly-carto-positron\",\n type: \"raster\",\n source: \"plotly-carto-positron\",\n minzoom: 0,\n maxzoom: 22\n }],\n glyphs: \"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf\"\n },\n \"carto-darkmatter\": {\n id: \"carto-darkmatter\",\n version: 8,\n sources: {\n \"plotly-carto-darkmatter\": {\n type: \"raster\",\n attribution: carto,\n tiles: [\"https://cartodb-basemaps-c.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png\"],\n tileSize: 256\n }\n },\n layers: [{\n id: \"plotly-carto-darkmatter\",\n type: \"raster\",\n source: \"plotly-carto-darkmatter\",\n minzoom: 0,\n maxzoom: 22\n }],\n glyphs: \"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf\"\n },\n \"stamen-terrain\": {\n id: \"stamen-terrain\",\n version: 8,\n sources: {\n \"plotly-stamen-terrain\": {\n type: \"raster\",\n attribution: stamenTerrainOrToner,\n tiles: [\"https://tiles.stadiamaps.com/tiles/stamen_terrain/{z}/{x}/{y}.png?api_key=\"],\n tileSize: 256\n }\n },\n layers: [{\n id: \"plotly-stamen-terrain\",\n type: \"raster\",\n source: \"plotly-stamen-terrain\",\n minzoom: 0,\n maxzoom: 22\n }],\n glyphs: \"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf\"\n },\n \"stamen-toner\": {\n id: \"stamen-toner\",\n version: 8,\n sources: {\n \"plotly-stamen-toner\": {\n type: \"raster\",\n attribution: stamenTerrainOrToner,\n tiles: [\"https://tiles.stadiamaps.com/tiles/stamen_toner/{z}/{x}/{y}.png?api_key=\"],\n tileSize: 256\n }\n },\n layers: [{\n id: \"plotly-stamen-toner\",\n type: \"raster\",\n source: \"plotly-stamen-toner\",\n minzoom: 0,\n maxzoom: 22\n }],\n glyphs: \"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf\"\n },\n \"stamen-watercolor\": {\n id: \"stamen-watercolor\",\n version: 8,\n sources: {\n \"plotly-stamen-watercolor\": {\n type: \"raster\",\n attribution: stamenWaterColor,\n tiles: [\"https://tiles.stadiamaps.com/tiles/stamen_watercolor/{z}/{x}/{y}.jpg?api_key=\"],\n tileSize: 256\n }\n },\n layers: [{\n id: \"plotly-stamen-watercolor\",\n type: \"raster\",\n source: \"plotly-stamen-watercolor\",\n minzoom: 0,\n maxzoom: 22\n }],\n glyphs: \"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf\"\n }\n };\n var styleValuesNonMapbox = sortObjectKeys(stylesNonMapbox);\n module.exports = {\n requiredVersion,\n styleUrlPrefix: \"mapbox://styles/mapbox/\",\n styleUrlSuffix: \"v9\",\n styleValuesMapbox: [\"basic\", \"streets\", \"outdoors\", \"light\", \"dark\", \"satellite\", \"satellite-streets\"],\n styleValueDflt: \"basic\",\n stylesNonMapbox,\n styleValuesNonMapbox,\n traceLayerPrefix: \"plotly-trace-layer-\",\n layoutLayerPrefix: \"plotly-layout-layer-\",\n wrongVersionErrorMsg: [\n \"Your custom plotly.js bundle is not using the correct mapbox-gl version\",\n \"Please install @plotly/mapbox-gl@\" + requiredVersion + \".\"\n ].join(\"\\n\"),\n noAccessTokenErrorMsg: [\n \"Missing Mapbox access token.\",\n \"Mapbox trace type require a Mapbox access token to be registered.\",\n \"For example:\",\n \" Plotly.newPlot(gd, data, layout, { mapboxAccessToken: 'my-access-token' });\",\n \"More info here: https://www.mapbox.com/help/define-access-token/\"\n ].join(\"\\n\"),\n missingStyleErrorMsg: [\n \"No valid mapbox style found, please set `mapbox.style` to one of:\",\n styleValuesNonMapbox.join(\", \"),\n \"or register a Mapbox access token to use a Mapbox-served style.\"\n ].join(\"\\n\"),\n multipleTokensErrorMsg: [\n \"Set multiple mapbox access token across different mapbox subplot,\",\n \"using first token found as mapbox-gl does not allow multipleaccess tokens on the same page.\"\n ].join(\"\\n\"),\n mapOnErrorMsg: \"Mapbox error.\",\n // Mapbox logo for static export\n mapboxLogo: {\n path0: \"m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z\",\n path1: \"M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z\",\n path2: \"M 14.74,6.25 C 12.9,4.41 9.98,4.35 8.23,6.1 5.07,9.27 6.09,14.91 6.09,14.91 c 0,0 5.64,1.02 8.81,-2.14 C 16.64,11 16.59,8.09 14.74,6.25 Z m -2.27,4.09 -0.91,1.87 -0.9,-1.87 -1.86,-0.91 1.86,-0.9 0.9,-1.87 0.91,1.87 1.86,0.9 z\",\n polygon: \"11.56,12.21 10.66,10.34 8.8,9.43 10.66,8.53 11.56,6.66 12.47,8.53 14.33,9.43 12.47,10.34\"\n },\n // a subset of node_modules/mapbox-gl/dist/mapbox-gl.css\n styleRules: {\n map: \"overflow:hidden;position:relative;\",\n \"missing-css\": \"display:none;\",\n canary: \"background-color:salmon;\",\n // Reusing CSS directives from: https://api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.css\n \"ctrl-bottom-left\": \"position: absolute; pointer-events: none; z-index: 2; bottom: 0; left: 0;\",\n \"ctrl-bottom-right\": \"position: absolute; pointer-events: none; z-index: 2; right: 0; bottom: 0;\",\n ctrl: \"clear: both; pointer-events: auto; transform: translate(0, 0);\",\n // Compact ctrl\n \"ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner\": \"display: none;\",\n \"ctrl-attrib.mapboxgl-compact:hover .mapboxgl-ctrl-attrib-inner\": \"display: block; margin-top:2px\",\n \"ctrl-attrib.mapboxgl-compact:hover\": \"padding: 2px 24px 2px 4px; visibility: visible; margin-top: 6px;\",\n \"ctrl-attrib.mapboxgl-compact::after\": `content: \"\"; cursor: pointer; position: absolute; background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"%3E %3Cpath fill=\"%23333333\" fill-rule=\"evenodd\" d=\"M4,10a6,6 0 1,0 12,0a6,6 0 1,0 -12,0 M9,7a1,1 0 1,0 2,0a1,1 0 1,0 -2,0 M9,10a1,1 0 1,1 2,0l0,3a1,1 0 1,1 -2,0\"/%3E %3C/svg%3E'); background-color: rgba(255, 255, 255, 0.5); width: 24px; height: 24px; box-sizing: border-box; border-radius: 12px;`,\n \"ctrl-attrib.mapboxgl-compact\": \"min-height: 20px; padding: 0; margin: 10px; position: relative; background-color: #fff; border-radius: 3px 12px 12px 3px;\",\n \"ctrl-bottom-right > .mapboxgl-ctrl-attrib.mapboxgl-compact::after\": \"bottom: 0; right: 0\",\n \"ctrl-bottom-left > .mapboxgl-ctrl-attrib.mapboxgl-compact::after\": \"bottom: 0; left: 0\",\n \"ctrl-bottom-left .mapboxgl-ctrl\": \"margin: 0 0 10px 10px; float: left;\",\n \"ctrl-bottom-right .mapboxgl-ctrl\": \"margin: 0 10px 10px 0; float: right;\",\n \"ctrl-attrib\": \"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px\",\n \"ctrl-attrib a\": \"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px\",\n \"ctrl-attrib a:hover\": \"color: inherit; text-decoration: underline;\",\n \"ctrl-attrib .mapbox-improve-map\": \"font-weight: bold; margin-left: 2px;\",\n \"attrib-empty\": \"display: none;\",\n // Compact Mapbox logo without text\n \"ctrl-logo\": `display:block; width: 21px; height: 21px; background-image: url('data:image/svg+xml;charset=utf-8,%3C?xml version=\"1.0\" encoding=\"utf-8\"?%3E %3Csvg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" viewBox=\"0 0 21 21\" style=\"enable-background:new 0 0 21 21;\" xml:space=\"preserve\"%3E%3Cg transform=\"translate(0,0.01)\"%3E%3Cpath d=\"m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z\" style=\"opacity:0.9;fill:%23ffffff;enable-background:new\" class=\"st0\"/%3E%3Cpath d=\"M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z\" style=\"opacity:0.35;enable-background:new\" class=\"st1\"/%3E%3Cpath d=\"M 14.74,6.25 C 12.9,4.41 9.98,4.35 8.23,6.1 5.07,9.27 6.09,14.91 6.09,14.91 c 0,0 5.64,1.02 8.81,-2.14 C 16.64,11 16.59,8.09 14.74,6.25 Z m -2.27,4.09 -0.91,1.87 -0.9,-1.87 -1.86,-0.91 1.86,-0.9 0.9,-1.87 0.91,1.87 1.86,0.9 z\" style=\"opacity:0.35;enable-background:new\" class=\"st1\"/%3E%3Cpolygon points=\"11.56,12.21 10.66,10.34 8.8,9.43 10.66,8.53 11.56,6.66 12.47,8.53 14.33,9.43 12.47,10.34 \" style=\"opacity:0.9;fill:%23ffffff;enable-background:new\" class=\"st0\"/%3E%3C/g%3E%3C/svg%3E')`\n // Mapbox logo WITH text below (commented out for now)\n // 'ctrl-logo': 'width: 85px; height: 21px; margin: 0 0 -3px -3px; display: block; background-repeat: no-repeat; cursor: pointer; background-image: url(\\'data:image/svg+xml;charset=utf-8,%3C?xml version=\"1.0\" encoding=\"utf-8\"?%3E%3Csvg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" viewBox=\"0 0 84.49 21\" style=\"enable-background:new 0 0 84.49 21;\" xml:space=\"preserve\"%3E%3Cg%3E %3Cpath class=\"st0\" style=\"opacity:0.9; fill: %23FFFFFF; enable-background: new;\" d=\"M83.25,14.26c0,0.12-0.09,0.21-0.21,0.21h-1.61c-0.13,0-0.24-0.06-0.3-0.17l-1.44-2.39l-1.44,2.39 c-0.06,0.11-0.18,0.17-0.3,0.17h-1.61c-0.04,0-0.08-0.01-0.12-0.03c-0.09-0.06-0.13-0.19-0.06-0.28l0,0l2.43-3.68L76.2,6.84 c-0.02-0.03-0.03-0.07-0.03-0.12c0-0.12,0.09-0.21,0.21-0.21h1.61c0.13,0,0.24,0.06,0.3,0.17l1.41,2.36l1.4-2.35 c0.06-0.11,0.18-0.17,0.3-0.17H83c0.04,0,0.08,0.01,0.12,0.03c0.09,0.06,0.13,0.19,0.06,0.28l0,0l-2.37,3.63l2.43,3.67 C83.24,14.18,83.25,14.22,83.25,14.26z\"/%3E %3Cpath class=\"st0\" style=\"opacity:0.9; fill: %23FFFFFF; enable-background: new;\" d=\"M66.24,9.59c-0.39-1.88-1.96-3.28-3.84-3.28c-1.03,0-2.03,0.42-2.73,1.18V3.51c0-0.13-0.1-0.23-0.23-0.23h-1.4 c-0.13,0-0.23,0.11-0.23,0.23v10.72c0,0.13,0.1,0.23,0.23,0.23h1.4c0.13,0,0.23-0.11,0.23-0.23V13.5c0.71,0.75,1.7,1.18,2.73,1.18 c1.88,0,3.45-1.41,3.84-3.29C66.37,10.79,66.37,10.18,66.24,9.59L66.24,9.59z M62.08,13c-1.32,0-2.39-1.11-2.41-2.48v-0.06 c0.02-1.38,1.09-2.48,2.41-2.48s2.42,1.12,2.42,2.51S63.41,13,62.08,13z\"/%3E %3Cpath class=\"st0\" style=\"opacity:0.9; fill: %23FFFFFF; enable-background: new;\" d=\"M71.67,6.32c-1.98-0.01-3.72,1.35-4.16,3.29c-0.13,0.59-0.13,1.19,0,1.77c0.44,1.94,2.17,3.32,4.17,3.3 c2.35,0,4.26-1.87,4.26-4.19S74.04,6.32,71.67,6.32z M71.65,13.01c-1.33,0-2.42-1.12-2.42-2.51s1.08-2.52,2.42-2.52 c1.33,0,2.42,1.12,2.42,2.51S72.99,13,71.65,13.01L71.65,13.01z\"/%3E %3Cpath class=\"st1\" style=\"opacity:0.35; enable-background:new;\" d=\"M62.08,7.98c-1.32,0-2.39,1.11-2.41,2.48v0.06C59.68,11.9,60.75,13,62.08,13s2.42-1.12,2.42-2.51 S63.41,7.98,62.08,7.98z M62.08,11.76c-0.63,0-1.14-0.56-1.17-1.25v-0.04c0.01-0.69,0.54-1.25,1.17-1.25 c0.63,0,1.17,0.57,1.17,1.27C63.24,11.2,62.73,11.76,62.08,11.76z\"/%3E %3Cpath class=\"st1\" style=\"opacity:0.35; enable-background:new;\" d=\"M71.65,7.98c-1.33,0-2.42,1.12-2.42,2.51S70.32,13,71.65,13s2.42-1.12,2.42-2.51S72.99,7.98,71.65,7.98z M71.65,11.76c-0.64,0-1.17-0.57-1.17-1.27c0-0.7,0.53-1.26,1.17-1.26s1.17,0.57,1.17,1.27C72.82,11.21,72.29,11.76,71.65,11.76z\"/%3E %3Cpath class=\"st0\" style=\"opacity:0.9; fill: %23FFFFFF; enable-background: new;\" d=\"M45.74,6.53h-1.4c-0.13,0-0.23,0.11-0.23,0.23v0.73c-0.71-0.75-1.7-1.18-2.73-1.18 c-2.17,0-3.94,1.87-3.94,4.19s1.77,4.19,3.94,4.19c1.04,0,2.03-0.43,2.73-1.19v0.73c0,0.13,0.1,0.23,0.23,0.23h1.4 c0.13,0,0.23-0.11,0.23-0.23V6.74c0-0.12-0.09-0.22-0.22-0.22C45.75,6.53,45.75,6.53,45.74,6.53z M44.12,10.53 C44.11,11.9,43.03,13,41.71,13s-2.42-1.12-2.42-2.51s1.08-2.52,2.4-2.52c1.33,0,2.39,1.11,2.41,2.48L44.12,10.53z\"/%3E %3Cpath class=\"st1\" style=\"opacity:0.35; enable-background:new;\" d=\"M41.71,7.98c-1.33,0-2.42,1.12-2.42,2.51S40.37,13,41.71,13s2.39-1.11,2.41-2.48v-0.06 C44.1,9.09,43.03,7.98,41.71,7.98z M40.55,10.49c0-0.7,0.52-1.27,1.17-1.27c0.64,0,1.14,0.56,1.17,1.25v0.04 c-0.01,0.68-0.53,1.24-1.17,1.24C41.08,11.75,40.55,11.19,40.55,10.49z\"/%3E %3Cpath class=\"st0\" style=\"opacity:0.9; fill: %23FFFFFF; enable-background: new;\" d=\"M52.41,6.32c-1.03,0-2.03,0.42-2.73,1.18V6.75c0-0.13-0.1-0.23-0.23-0.23h-1.4c-0.13,0-0.23,0.11-0.23,0.23 v10.72c0,0.13,0.1,0.23,0.23,0.23h1.4c0.13,0,0.23-0.1,0.23-0.23V13.5c0.71,0.75,1.7,1.18,2.74,1.18c2.17,0,3.94-1.87,3.94-4.19 S54.58,6.32,52.41,6.32z M52.08,13.01c-1.32,0-2.39-1.11-2.42-2.48v-0.07c0.02-1.38,1.09-2.49,2.4-2.49c1.32,0,2.41,1.12,2.41,2.51 S53.4,13,52.08,13.01L52.08,13.01z\"/%3E %3Cpath class=\"st1\" style=\"opacity:0.35; enable-background:new;\" d=\"M52.08,7.98c-1.32,0-2.39,1.11-2.42,2.48v0.06c0.03,1.38,1.1,2.48,2.42,2.48s2.41-1.12,2.41-2.51 S53.4,7.98,52.08,7.98z M52.08,11.76c-0.63,0-1.14-0.56-1.17-1.25v-0.04c0.01-0.69,0.54-1.25,1.17-1.25c0.63,0,1.17,0.58,1.17,1.27 S52.72,11.76,52.08,11.76z\"/%3E %3Cpath class=\"st0\" style=\"opacity:0.9; fill: %23FFFFFF; enable-background: new;\" d=\"M36.08,14.24c0,0.13-0.1,0.23-0.23,0.23h-1.41c-0.13,0-0.23-0.11-0.23-0.23V9.68c0-0.98-0.74-1.71-1.62-1.71 c-0.8,0-1.46,0.7-1.59,1.62l0.01,4.66c0,0.13-0.11,0.23-0.23,0.23h-1.41c-0.13,0-0.23-0.11-0.23-0.23V9.68 c0-0.98-0.74-1.71-1.62-1.71c-0.85,0-1.54,0.79-1.6,1.8v4.48c0,0.13-0.1,0.23-0.23,0.23h-1.4c-0.13,0-0.23-0.11-0.23-0.23V6.74 c0.01-0.13,0.1-0.22,0.23-0.22h1.4c0.13,0,0.22,0.11,0.23,0.22V7.4c0.5-0.68,1.3-1.09,2.16-1.1h0.03c1.09,0,2.09,0.6,2.6,1.55 c0.45-0.95,1.4-1.55,2.44-1.56c1.62,0,2.93,1.25,2.9,2.78L36.08,14.24z\"/%3E %3Cpath class=\"st1\" style=\"opacity:0.35; enable-background:new;\" d=\"M84.34,13.59l-0.07-0.13l-1.96-2.99l1.94-2.95c0.44-0.67,0.26-1.56-0.41-2.02c-0.02,0-0.03,0-0.04-0.01 c-0.23-0.15-0.5-0.22-0.78-0.22h-1.61c-0.56,0-1.08,0.29-1.37,0.78L79.72,6.6l-0.34-0.56C79.09,5.56,78.57,5.27,78,5.27h-1.6 c-0.6,0-1.13,0.37-1.35,0.92c-2.19-1.66-5.28-1.47-7.26,0.45c-0.35,0.34-0.65,0.72-0.89,1.14c-0.9-1.62-2.58-2.72-4.5-2.72 c-0.5,0-1.01,0.07-1.48,0.23V3.51c0-0.82-0.66-1.48-1.47-1.48h-1.4c-0.81,0-1.47,0.66-1.47,1.47v3.75 c-0.95-1.36-2.5-2.18-4.17-2.19c-0.74,0-1.46,0.16-2.12,0.47c-0.24-0.17-0.54-0.26-0.84-0.26h-1.4c-0.45,0-0.87,0.21-1.15,0.56 c-0.02-0.03-0.04-0.05-0.07-0.08c-0.28-0.3-0.68-0.47-1.09-0.47h-1.39c-0.3,0-0.6,0.09-0.84,0.26c-0.67-0.3-1.39-0.46-2.12-0.46 c-1.83,0-3.43,1-4.37,2.5c-0.2-0.46-0.48-0.89-0.83-1.25c-0.8-0.81-1.89-1.25-3.02-1.25h-0.01c-0.89,0.01-1.75,0.33-2.46,0.88 c-0.74-0.57-1.64-0.88-2.57-0.88H28.1c-0.29,0-0.58,0.03-0.86,0.11c-0.28,0.06-0.56,0.16-0.82,0.28c-0.21-0.12-0.45-0.18-0.7-0.18 h-1.4c-0.82,0-1.47,0.66-1.47,1.47v7.5c0,0.82,0.66,1.47,1.47,1.47h1.4c0.82,0,1.48-0.66,1.48-1.48l0,0V9.79 c0.03-0.36,0.23-0.59,0.36-0.59c0.18,0,0.38,0.18,0.38,0.47v4.57c0,0.82,0.66,1.47,1.47,1.47h1.41c0.82,0,1.47-0.66,1.47-1.47 l-0.01-4.57c0.06-0.32,0.25-0.47,0.35-0.47c0.18,0,0.38,0.18,0.38,0.47v4.57c0,0.82,0.66,1.47,1.47,1.47h1.41 c0.82,0,1.47-0.66,1.47-1.47v-0.38c0.96,1.29,2.46,2.06,4.06,2.06c0.74,0,1.46-0.16,2.12-0.47c0.24,0.17,0.54,0.26,0.84,0.26h1.39 c0.3,0,0.6-0.09,0.84-0.26v2.01c0,0.82,0.66,1.47,1.47,1.47h1.4c0.82,0,1.47-0.66,1.47-1.47v-1.77c0.48,0.15,0.99,0.23,1.49,0.22 c1.7,0,3.22-0.87,4.17-2.2v0.52c0,0.82,0.66,1.47,1.47,1.47h1.4c0.3,0,0.6-0.09,0.84-0.26c0.66,0.31,1.39,0.47,2.12,0.47 c1.92,0,3.6-1.1,4.49-2.73c1.54,2.65,4.95,3.53,7.58,1.98c0.18-0.11,0.36-0.22,0.53-0.36c0.22,0.55,0.76,0.91,1.35,0.9H78 c0.56,0,1.08-0.29,1.37-0.78l0.37-0.61l0.37,0.61c0.29,0.48,0.81,0.78,1.38,0.78h1.6c0.81,0,1.46-0.66,1.45-1.46 C84.49,14.02,84.44,13.8,84.34,13.59L84.34,13.59z M35.86,14.47h-1.41c-0.13,0-0.23-0.11-0.23-0.23V9.68 c0-0.98-0.74-1.71-1.62-1.71c-0.8,0-1.46,0.7-1.59,1.62l0.01,4.66c0,0.13-0.1,0.23-0.23,0.23h-1.41c-0.13,0-0.23-0.11-0.23-0.23 V9.68c0-0.98-0.74-1.71-1.62-1.71c-0.85,0-1.54,0.79-1.6,1.8v4.48c0,0.13-0.1,0.23-0.23,0.23h-1.4c-0.13,0-0.23-0.11-0.23-0.23 V6.74c0.01-0.13,0.11-0.22,0.23-0.22h1.4c0.13,0,0.22,0.11,0.23,0.22V7.4c0.5-0.68,1.3-1.09,2.16-1.1h0.03 c1.09,0,2.09,0.6,2.6,1.55c0.45-0.95,1.4-1.55,2.44-1.56c1.62,0,2.93,1.25,2.9,2.78l0.01,5.16C36.09,14.36,35.98,14.46,35.86,14.47 L35.86,14.47z M45.97,14.24c0,0.13-0.1,0.23-0.23,0.23h-1.4c-0.13,0-0.23-0.11-0.23-0.23V13.5c-0.7,0.76-1.69,1.18-2.72,1.18 c-2.17,0-3.94-1.87-3.94-4.19s1.77-4.19,3.94-4.19c1.03,0,2.02,0.43,2.73,1.18V6.74c0-0.13,0.1-0.23,0.23-0.23h1.4 c0.12-0.01,0.22,0.08,0.23,0.21c0,0.01,0,0.01,0,0.02v7.51h-0.01V14.24z M52.41,14.67c-1.03,0-2.02-0.43-2.73-1.18v3.97 c0,0.13-0.1,0.23-0.23,0.23h-1.4c-0.13,0-0.23-0.1-0.23-0.23V6.75c0-0.13,0.1-0.22,0.23-0.22h1.4c0.13,0,0.23,0.11,0.23,0.23v0.73 c0.71-0.76,1.7-1.18,2.73-1.18c2.17,0,3.94,1.86,3.94,4.18S54.58,14.67,52.41,14.67z M66.24,11.39c-0.39,1.87-1.96,3.29-3.84,3.29 c-1.03,0-2.02-0.43-2.73-1.18v0.73c0,0.13-0.1,0.23-0.23,0.23h-1.4c-0.13,0-0.23-0.11-0.23-0.23V3.51c0-0.13,0.1-0.23,0.23-0.23 h1.4c0.13,0,0.23,0.11,0.23,0.23v3.97c0.71-0.75,1.7-1.18,2.73-1.17c1.88,0,3.45,1.4,3.84,3.28C66.37,10.19,66.37,10.8,66.24,11.39 L66.24,11.39L66.24,11.39z M71.67,14.68c-2,0.01-3.73-1.35-4.17-3.3c-0.13-0.59-0.13-1.19,0-1.77c0.44-1.94,2.17-3.31,4.17-3.3 c2.36,0,4.26,1.87,4.26,4.19S74.03,14.68,71.67,14.68L71.67,14.68z M83.04,14.47h-1.61c-0.13,0-0.24-0.06-0.3-0.17l-1.44-2.39 l-1.44,2.39c-0.06,0.11-0.18,0.17-0.3,0.17h-1.61c-0.04,0-0.08-0.01-0.12-0.03c-0.09-0.06-0.13-0.19-0.06-0.28l0,0l2.43-3.68 L76.2,6.84c-0.02-0.03-0.03-0.07-0.03-0.12c0-0.12,0.09-0.21,0.21-0.21h1.61c0.13,0,0.24,0.06,0.3,0.17l1.41,2.36l1.41-2.36 c0.06-0.11,0.18-0.17,0.3-0.17h1.61c0.04,0,0.08,0.01,0.12,0.03c0.09,0.06,0.13,0.19,0.06,0.28l0,0l-2.38,3.64l2.43,3.67 c0.02,0.03,0.03,0.07,0.03,0.12C83.25,14.38,83.16,14.47,83.04,14.47L83.04,14.47L83.04,14.47z\"/%3E %3Cpath class=\"st0\" style=\"opacity:0.9; fill: %23FFFFFF; enable-background: new;\" d=\"M10.5,1.24c-5.11,0-9.25,4.15-9.25,9.25s4.15,9.25,9.25,9.25s9.25-4.15,9.25-9.25 C19.75,5.38,15.61,1.24,10.5,1.24z M14.89,12.77c-1.93,1.93-4.78,2.31-6.7,2.31c-0.7,0-1.41-0.05-2.1-0.16c0,0-1.02-5.64,2.14-8.81 c0.83-0.83,1.95-1.28,3.13-1.28c1.27,0,2.49,0.51,3.39,1.42C16.59,8.09,16.64,11,14.89,12.77z\"/%3E %3Cpath class=\"st1\" style=\"opacity:0.35; enable-background:new;\" d=\"M10.5-0.01C4.7-0.01,0,4.7,0,10.49s4.7,10.5,10.5,10.5S21,16.29,21,10.49C20.99,4.7,16.3-0.01,10.5-0.01z M10.5,19.74c-5.11,0-9.25-4.15-9.25-9.25s4.14-9.26,9.25-9.26s9.25,4.15,9.25,9.25C19.75,15.61,15.61,19.74,10.5,19.74z\"/%3E %3Cpath class=\"st1\" style=\"opacity:0.35; enable-background:new;\" d=\"M14.74,6.25C12.9,4.41,9.98,4.35,8.23,6.1c-3.16,3.17-2.14,8.81-2.14,8.81s5.64,1.02,8.81-2.14 C16.64,11,16.59,8.09,14.74,6.25z M12.47,10.34l-0.91,1.87l-0.9-1.87L8.8,9.43l1.86-0.9l0.9-1.87l0.91,1.87l1.86,0.9L12.47,10.34z\"/%3E %3Cpolygon class=\"st0\" style=\"opacity:0.9; fill: %23FFFFFF; enable-background: new;\" points=\"14.33,9.43 12.47,10.34 11.56,12.21 10.66,10.34 8.8,9.43 10.66,8.53 11.56,6.66 12.47,8.53 \"/%3E%3C/g%3E%3C/svg%3E\\');'\n }\n };\n }\n });\n\n // src/plots/mapbox/layout_attributes.js\n var require_layout_attributes19 = __commonJS({\n \"src/plots/mapbox/layout_attributes.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var defaultLine = require_color().defaultLine;\n var domainAttrs = require_domain().attributes;\n var fontAttrs = require_font_attributes();\n var textposition = require_attributes12().textposition;\n var overrideAll = require_edit_types().overrideAll;\n var templatedArray = require_plot_template().templatedArray;\n var constants = require_constants25();\n var fontAttr = fontAttrs({\n noFontVariant: true,\n noFontShadow: true,\n noFontLineposition: true,\n noFontTextcase: true\n });\n fontAttr.family.dflt = \"Open Sans Regular, Arial Unicode MS Regular\";\n var attrs = module.exports = overrideAll({\n _arrayAttrRegexps: [Lib.counterRegex(\"mapbox\", \".layers\", true)],\n domain: domainAttrs({ name: \"mapbox\" }),\n accesstoken: {\n valType: \"string\",\n noBlank: true,\n strict: true\n },\n style: {\n valType: \"any\",\n values: constants.styleValuesMapbox.concat(constants.styleValuesNonMapbox),\n dflt: constants.styleValueDflt\n },\n center: {\n lon: {\n valType: \"number\",\n dflt: 0\n },\n lat: {\n valType: \"number\",\n dflt: 0\n }\n },\n zoom: {\n valType: \"number\",\n dflt: 1\n },\n bearing: {\n valType: \"number\",\n dflt: 0\n },\n pitch: {\n valType: \"number\",\n dflt: 0\n },\n bounds: {\n west: {\n valType: \"number\"\n },\n east: {\n valType: \"number\"\n },\n south: {\n valType: \"number\"\n },\n north: {\n valType: \"number\"\n }\n },\n layers: templatedArray(\"layer\", {\n visible: {\n valType: \"boolean\",\n dflt: true\n },\n sourcetype: {\n valType: \"enumerated\",\n values: [\"geojson\", \"vector\", \"raster\", \"image\"],\n dflt: \"geojson\"\n },\n source: {\n valType: \"any\"\n },\n sourcelayer: {\n valType: \"string\",\n dflt: \"\"\n },\n sourceattribution: {\n valType: \"string\"\n },\n type: {\n valType: \"enumerated\",\n values: [\"circle\", \"line\", \"fill\", \"symbol\", \"raster\"],\n dflt: \"circle\"\n },\n coordinates: {\n valType: \"any\"\n },\n // attributes shared between all types\n below: {\n valType: \"string\"\n },\n color: {\n valType: \"color\",\n dflt: defaultLine\n },\n opacity: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 1\n },\n minzoom: {\n valType: \"number\",\n min: 0,\n max: 24,\n dflt: 0\n },\n maxzoom: {\n valType: \"number\",\n min: 0,\n max: 24,\n dflt: 24\n },\n // type-specific style attributes\n circle: {\n radius: {\n valType: \"number\",\n dflt: 15\n }\n },\n line: {\n width: {\n valType: \"number\",\n dflt: 2\n },\n dash: {\n valType: \"data_array\"\n }\n },\n fill: {\n outlinecolor: {\n valType: \"color\",\n dflt: defaultLine\n }\n },\n symbol: {\n icon: {\n valType: \"string\",\n dflt: \"marker\"\n },\n iconsize: {\n valType: \"number\",\n dflt: 10\n },\n text: {\n valType: \"string\",\n dflt: \"\"\n },\n placement: {\n valType: \"enumerated\",\n values: [\"point\", \"line\", \"line-center\"],\n dflt: \"point\"\n },\n textfont: fontAttr,\n textposition: Lib.extendFlat({}, textposition, { arrayOk: false })\n }\n })\n }, \"plot\", \"from-root\");\n attrs.uirevision = {\n valType: \"any\",\n editType: \"none\"\n };\n }\n });\n\n // src/traces/scattermapbox/attributes.js\n var require_attributes54 = __commonJS({\n \"src/traces/scattermapbox/attributes.js\"(exports, module) {\n \"use strict\";\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var makeFillcolorAttr = require_fillcolor_attribute();\n var scatterGeoAttrs = require_attributes48();\n var scatterAttrs = require_attributes12();\n var mapboxAttrs = require_layout_attributes19();\n var baseAttrs = require_attributes2();\n var colorScaleAttrs = require_attributes8();\n var extendFlat = require_extend().extendFlat;\n var overrideAll = require_edit_types().overrideAll;\n var mapboxLayoutAtributes = require_layout_attributes19();\n var lineAttrs = scatterGeoAttrs.line;\n var markerAttrs = scatterGeoAttrs.marker;\n module.exports = overrideAll({\n lon: scatterGeoAttrs.lon,\n lat: scatterGeoAttrs.lat,\n cluster: {\n enabled: {\n valType: \"boolean\"\n },\n maxzoom: extendFlat({}, mapboxLayoutAtributes.layers.maxzoom, {}),\n step: {\n valType: \"number\",\n arrayOk: true,\n dflt: -1,\n min: -1\n },\n size: {\n valType: \"number\",\n arrayOk: true,\n dflt: 20,\n min: 0\n },\n color: {\n valType: \"color\",\n arrayOk: true\n },\n opacity: extendFlat({}, markerAttrs.opacity, {\n dflt: 1\n })\n },\n // locations\n // locationmode\n mode: extendFlat({}, scatterAttrs.mode, {\n dflt: \"markers\"\n }),\n text: extendFlat({}, scatterAttrs.text, {}),\n texttemplate: texttemplateAttrs({ editType: \"plot\" }, {\n keys: [\"lat\", \"lon\", \"text\"]\n }),\n hovertext: extendFlat({}, scatterAttrs.hovertext, {}),\n line: {\n color: lineAttrs.color,\n width: lineAttrs.width\n // TODO\n // dash: dash\n },\n connectgaps: scatterAttrs.connectgaps,\n marker: extendFlat(\n {\n symbol: {\n valType: \"string\",\n dflt: \"circle\",\n arrayOk: true\n },\n angle: {\n valType: \"number\",\n dflt: \"auto\",\n arrayOk: true\n },\n allowoverlap: {\n valType: \"boolean\",\n dflt: false\n },\n opacity: markerAttrs.opacity,\n size: markerAttrs.size,\n sizeref: markerAttrs.sizeref,\n sizemin: markerAttrs.sizemin,\n sizemode: markerAttrs.sizemode\n },\n colorScaleAttrs(\"marker\")\n // line\n ),\n fill: scatterGeoAttrs.fill,\n fillcolor: makeFillcolorAttr(),\n textfont: mapboxAttrs.layers.symbol.textfont,\n textposition: mapboxAttrs.layers.symbol.textposition,\n below: {\n valType: \"string\"\n },\n selected: {\n marker: scatterAttrs.selected.marker\n },\n unselected: {\n marker: scatterAttrs.unselected.marker\n },\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: [\"lon\", \"lat\", \"text\", \"name\"]\n }),\n hovertemplate: hovertemplateAttrs()\n }, \"calc\", \"nested\");\n }\n });\n\n // src/traces/scattermapbox/constants.js\n var require_constants26 = __commonJS({\n \"src/traces/scattermapbox/constants.js\"(exports, module) {\n \"use strict\";\n var supportedFonts = [\n \"Metropolis Black Italic\",\n \"Metropolis Black\",\n \"Metropolis Bold Italic\",\n \"Metropolis Bold\",\n \"Metropolis Extra Bold Italic\",\n \"Metropolis Extra Bold\",\n \"Metropolis Extra Light Italic\",\n \"Metropolis Extra Light\",\n \"Metropolis Light Italic\",\n \"Metropolis Light\",\n \"Metropolis Medium Italic\",\n \"Metropolis Medium\",\n \"Metropolis Regular Italic\",\n \"Metropolis Regular\",\n \"Metropolis Semi Bold Italic\",\n \"Metropolis Semi Bold\",\n \"Metropolis Thin Italic\",\n \"Metropolis Thin\",\n \"Open Sans Bold Italic\",\n \"Open Sans Bold\",\n \"Open Sans Extrabold Italic\",\n \"Open Sans Extrabold\",\n \"Open Sans Italic\",\n \"Open Sans Light Italic\",\n \"Open Sans Light\",\n \"Open Sans Regular\",\n \"Open Sans Semibold Italic\",\n \"Open Sans Semibold\",\n \"Klokantech Noto Sans Bold\",\n \"Klokantech Noto Sans CJK Bold\",\n \"Klokantech Noto Sans CJK Regular\",\n \"Klokantech Noto Sans Italic\",\n \"Klokantech Noto Sans Regular\"\n ];\n module.exports = {\n isSupportedFont: function(a) {\n return supportedFonts.indexOf(a) !== -1;\n }\n };\n }\n });\n\n // src/traces/scattermapbox/defaults.js\n var require_defaults50 = __commonJS({\n \"src/traces/scattermapbox/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var subTypes = require_subtypes();\n var handleMarkerDefaults = require_marker_defaults();\n var handleLineDefaults = require_line_defaults();\n var handleTextDefaults = require_text_defaults();\n var handleFillColorDefaults = require_fillcolor_defaults();\n var attributes = require_attributes54();\n var isSupportedFont = require_constants26().isSupportedFont;\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n function coerce2(attr, dflt) {\n return Lib.coerce2(traceIn, traceOut, attributes, attr, dflt);\n }\n var len = handleLonLatDefaults(traceIn, traceOut, coerce);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n coerce(\"text\");\n coerce(\"texttemplate\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n coerce(\"mode\");\n coerce(\"below\");\n if (subTypes.hasMarkers(traceOut)) {\n handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, { noLine: true, noAngle: true });\n coerce(\"marker.allowoverlap\");\n coerce(\"marker.angle\");\n var marker = traceOut.marker;\n if (marker.symbol !== \"circle\") {\n if (Lib.isArrayOrTypedArray(marker.size)) marker.size = marker.size[0];\n if (Lib.isArrayOrTypedArray(marker.color)) marker.color = marker.color[0];\n }\n }\n if (subTypes.hasLines(traceOut)) {\n handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce, { noDash: true });\n coerce(\"connectgaps\");\n }\n var clusterMaxzoom = coerce2(\"cluster.maxzoom\");\n var clusterStep = coerce2(\"cluster.step\");\n var clusterColor = coerce2(\"cluster.color\", traceOut.marker && traceOut.marker.color || defaultColor);\n var clusterSize = coerce2(\"cluster.size\");\n var clusterOpacity = coerce2(\"cluster.opacity\");\n var clusterEnabledDflt = clusterMaxzoom !== false || clusterStep !== false || clusterColor !== false || clusterSize !== false || clusterOpacity !== false;\n var clusterEnabled = coerce(\"cluster.enabled\", clusterEnabledDflt);\n if (clusterEnabled || subTypes.hasText(traceOut)) {\n var layoutFontFamily = layout.font.family;\n handleTextDefaults(\n traceIn,\n traceOut,\n layout,\n coerce,\n {\n noSelect: true,\n noFontVariant: true,\n noFontShadow: true,\n noFontLineposition: true,\n noFontTextcase: true,\n font: {\n family: isSupportedFont(layoutFontFamily) ? layoutFontFamily : \"Open Sans Regular\",\n weight: layout.font.weight,\n style: layout.font.style,\n size: layout.font.size,\n color: layout.font.color\n }\n }\n );\n }\n coerce(\"fill\");\n if (traceOut.fill !== \"none\") {\n handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce);\n }\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n };\n function handleLonLatDefaults(traceIn, traceOut, coerce) {\n var lon = coerce(\"lon\") || [];\n var lat = coerce(\"lat\") || [];\n var len = Math.min(lon.length, lat.length);\n traceOut._length = len;\n return len;\n }\n }\n });\n\n // src/traces/scattermapbox/format_labels.js\n var require_format_labels5 = __commonJS({\n \"src/traces/scattermapbox/format_labels.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n module.exports = function formatLabels(cdi, trace, fullLayout) {\n var labels = {};\n var subplot = fullLayout[trace.subplot]._subplot;\n var ax = subplot.mockAxis;\n var lonlat = cdi.lonlat;\n labels.lonLabel = Axes.tickText(ax, ax.c2l(lonlat[0]), true).text;\n labels.latLabel = Axes.tickText(ax, ax.c2l(lonlat[1]), true).text;\n return labels;\n };\n }\n });\n\n // src/plots/mapbox/convert_text_opts.js\n var require_convert_text_opts = __commonJS({\n \"src/plots/mapbox/convert_text_opts.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n module.exports = function convertTextOpts(textposition, iconSize) {\n var parts = textposition.split(\" \");\n var vPos = parts[0];\n var hPos = parts[1];\n var factor = Lib.isArrayOrTypedArray(iconSize) ? Lib.mean(iconSize) : iconSize;\n var xInc = 0.5 + factor / 100;\n var yInc = 1.5 + factor / 100;\n var anchorVals = [\"\", \"\"];\n var offset = [0, 0];\n switch (vPos) {\n case \"top\":\n anchorVals[0] = \"top\";\n offset[1] = -yInc;\n break;\n case \"bottom\":\n anchorVals[0] = \"bottom\";\n offset[1] = yInc;\n break;\n }\n switch (hPos) {\n case \"left\":\n anchorVals[1] = \"right\";\n offset[0] = -xInc;\n break;\n case \"right\":\n anchorVals[1] = \"left\";\n offset[0] = xInc;\n break;\n }\n var anchor;\n if (anchorVals[0] && anchorVals[1]) anchor = anchorVals.join(\"-\");\n else if (anchorVals[0]) anchor = anchorVals[0];\n else if (anchorVals[1]) anchor = anchorVals[1];\n else anchor = \"center\";\n return { anchor, offset };\n };\n }\n });\n\n // src/traces/scattermapbox/convert.js\n var require_convert11 = __commonJS({\n \"src/traces/scattermapbox/convert.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var BADNUM = require_numerical().BADNUM;\n var geoJsonUtils = require_geojson_utils();\n var Colorscale = require_colorscale();\n var Drawing = require_drawing();\n var makeBubbleSizeFn = require_make_bubble_size_func();\n var subTypes = require_subtypes();\n var isSupportedFont = require_constants26().isSupportedFont;\n var convertTextOpts = require_convert_text_opts();\n var appendArrayPointValue = require_helpers2().appendArrayPointValue;\n var NEWLINES = require_svg_text_utils().NEWLINES;\n var BR_TAG_ALL = require_svg_text_utils().BR_TAG_ALL;\n module.exports = function convert(gd, calcTrace) {\n var trace = calcTrace[0].trace;\n var isVisible = trace.visible === true && trace._length !== 0;\n var hasFill = trace.fill !== \"none\";\n var hasLines = subTypes.hasLines(trace);\n var hasMarkers = subTypes.hasMarkers(trace);\n var hasText = subTypes.hasText(trace);\n var hasCircles = hasMarkers && trace.marker.symbol === \"circle\";\n var hasSymbols = hasMarkers && trace.marker.symbol !== \"circle\";\n var hasCluster = trace.cluster && trace.cluster.enabled;\n var fill = initContainer(\"fill\");\n var line = initContainer(\"line\");\n var circle = initContainer(\"circle\");\n var symbol = initContainer(\"symbol\");\n var opts = {\n fill,\n line,\n circle,\n symbol\n };\n if (!isVisible) return opts;\n var lineCoords;\n if (hasFill || hasLines) {\n lineCoords = geoJsonUtils.calcTraceToLineCoords(calcTrace);\n }\n if (hasFill) {\n fill.geojson = geoJsonUtils.makePolygon(lineCoords);\n fill.layout.visibility = \"visible\";\n Lib.extendFlat(fill.paint, {\n \"fill-color\": trace.fillcolor\n });\n }\n if (hasLines) {\n line.geojson = geoJsonUtils.makeLine(lineCoords);\n line.layout.visibility = \"visible\";\n Lib.extendFlat(line.paint, {\n \"line-width\": trace.line.width,\n \"line-color\": trace.line.color,\n \"line-opacity\": trace.opacity\n });\n }\n if (hasCircles) {\n var circleOpts = makeCircleOpts(calcTrace);\n circle.geojson = circleOpts.geojson;\n circle.layout.visibility = \"visible\";\n if (hasCluster) {\n circle.filter = [\"!\", [\"has\", \"point_count\"]];\n opts.cluster = {\n type: \"circle\",\n filter: [\"has\", \"point_count\"],\n layout: { visibility: \"visible\" },\n paint: {\n \"circle-color\": arrayifyAttribute(trace.cluster.color, trace.cluster.step),\n \"circle-radius\": arrayifyAttribute(trace.cluster.size, trace.cluster.step),\n \"circle-opacity\": arrayifyAttribute(trace.cluster.opacity, trace.cluster.step)\n }\n };\n opts.clusterCount = {\n type: \"symbol\",\n filter: [\"has\", \"point_count\"],\n paint: {},\n layout: {\n \"text-field\": \"{point_count_abbreviated}\",\n \"text-font\": getTextFont(trace),\n \"text-size\": 12\n }\n };\n }\n Lib.extendFlat(circle.paint, {\n \"circle-color\": circleOpts.mcc,\n \"circle-radius\": circleOpts.mrc,\n \"circle-opacity\": circleOpts.mo\n });\n }\n if (hasCircles && hasCluster) {\n circle.filter = [\"!\", [\"has\", \"point_count\"]];\n }\n if (hasSymbols || hasText) {\n symbol.geojson = makeSymbolGeoJSON(calcTrace, gd);\n Lib.extendFlat(symbol.layout, {\n visibility: \"visible\",\n \"icon-image\": \"{symbol}-15\",\n \"text-field\": \"{text}\"\n });\n if (hasSymbols) {\n Lib.extendFlat(symbol.layout, {\n \"icon-size\": trace.marker.size / 10\n });\n if (\"angle\" in trace.marker && trace.marker.angle !== \"auto\") {\n Lib.extendFlat(symbol.layout, {\n // unfortunately cant use {angle} do to this issue:\n // https://github.com/mapbox/mapbox-gl-js/issues/873\n \"icon-rotate\": {\n type: \"identity\",\n property: \"angle\"\n },\n \"icon-rotation-alignment\": \"map\"\n });\n }\n symbol.layout[\"icon-allow-overlap\"] = trace.marker.allowoverlap;\n Lib.extendFlat(symbol.paint, {\n \"icon-opacity\": trace.opacity * trace.marker.opacity,\n // TODO does not work ??\n \"icon-color\": trace.marker.color\n });\n }\n if (hasText) {\n var iconSize = (trace.marker || {}).size;\n var textOpts = convertTextOpts(trace.textposition, iconSize);\n Lib.extendFlat(symbol.layout, {\n \"text-size\": trace.textfont.size,\n \"text-anchor\": textOpts.anchor,\n \"text-offset\": textOpts.offset,\n \"text-font\": getTextFont(trace)\n });\n Lib.extendFlat(symbol.paint, {\n \"text-color\": trace.textfont.color,\n \"text-opacity\": trace.opacity\n });\n }\n }\n return opts;\n };\n function initContainer(type) {\n return {\n type,\n geojson: geoJsonUtils.makeBlank(),\n layout: { visibility: \"none\" },\n filter: null,\n paint: {}\n };\n }\n function makeCircleOpts(calcTrace) {\n var trace = calcTrace[0].trace;\n var marker = trace.marker;\n var selectedpoints = trace.selectedpoints;\n var arrayColor = Lib.isArrayOrTypedArray(marker.color);\n var arraySize = Lib.isArrayOrTypedArray(marker.size);\n var arrayOpacity = Lib.isArrayOrTypedArray(marker.opacity);\n var i;\n function addTraceOpacity(o) {\n return trace.opacity * o;\n }\n function size2radius(s) {\n return s / 2;\n }\n var colorFn;\n if (arrayColor) {\n if (Colorscale.hasColorscale(trace, \"marker\")) {\n colorFn = Colorscale.makeColorScaleFuncFromTrace(marker);\n } else {\n colorFn = Lib.identity;\n }\n }\n var sizeFn;\n if (arraySize) {\n sizeFn = makeBubbleSizeFn(trace);\n }\n var opacityFn;\n if (arrayOpacity) {\n opacityFn = function(mo) {\n var mo2 = isNumeric(mo) ? +Lib.constrain(mo, 0, 1) : 0;\n return addTraceOpacity(mo2);\n };\n }\n var features = [];\n for (i = 0; i < calcTrace.length; i++) {\n var calcPt = calcTrace[i];\n var lonlat = calcPt.lonlat;\n if (isBADNUM(lonlat)) continue;\n var props = {};\n if (colorFn) props.mcc = calcPt.mcc = colorFn(calcPt.mc);\n if (sizeFn) props.mrc = calcPt.mrc = sizeFn(calcPt.ms);\n if (opacityFn) props.mo = opacityFn(calcPt.mo);\n if (selectedpoints) props.selected = calcPt.selected || 0;\n features.push({\n type: \"Feature\",\n id: i + 1,\n geometry: { type: \"Point\", coordinates: lonlat },\n properties: props\n });\n }\n var fns;\n if (selectedpoints) {\n fns = Drawing.makeSelectedPointStyleFns(trace);\n for (i = 0; i < features.length; i++) {\n var d = features[i].properties;\n if (fns.selectedOpacityFn) {\n d.mo = addTraceOpacity(fns.selectedOpacityFn(d));\n }\n if (fns.selectedColorFn) {\n d.mcc = fns.selectedColorFn(d);\n }\n if (fns.selectedSizeFn) {\n d.mrc = fns.selectedSizeFn(d);\n }\n }\n }\n return {\n geojson: { type: \"FeatureCollection\", features },\n mcc: arrayColor || fns && fns.selectedColorFn ? { type: \"identity\", property: \"mcc\" } : marker.color,\n mrc: arraySize || fns && fns.selectedSizeFn ? { type: \"identity\", property: \"mrc\" } : size2radius(marker.size),\n mo: arrayOpacity || fns && fns.selectedOpacityFn ? { type: \"identity\", property: \"mo\" } : addTraceOpacity(marker.opacity)\n };\n }\n function makeSymbolGeoJSON(calcTrace, gd) {\n var fullLayout = gd._fullLayout;\n var trace = calcTrace[0].trace;\n var marker = trace.marker || {};\n var symbol = marker.symbol;\n var angle = marker.angle;\n var fillSymbol = symbol !== \"circle\" ? getFillFunc(symbol) : blankFillFunc;\n var fillAngle = angle !== \"auto\" ? getFillFunc(angle, true) : blankFillFunc;\n var fillText = subTypes.hasText(trace) ? getFillFunc(trace.text) : blankFillFunc;\n var features = [];\n for (var i = 0; i < calcTrace.length; i++) {\n var calcPt = calcTrace[i];\n if (isBADNUM(calcPt.lonlat)) continue;\n var texttemplate = trace.texttemplate;\n var text;\n if (texttemplate) {\n var tt = Array.isArray(texttemplate) ? texttemplate[i] || \"\" : texttemplate;\n var labels = trace._module.formatLabels(calcPt, trace, fullLayout);\n var pointValues = {};\n appendArrayPointValue(pointValues, trace, calcPt.i);\n var meta = trace._meta || {};\n text = Lib.texttemplateString(tt, labels, fullLayout._d3locale, pointValues, calcPt, meta);\n } else {\n text = fillText(i);\n }\n if (text) {\n text = text.replace(NEWLINES, \"\").replace(BR_TAG_ALL, \"\\n\");\n }\n features.push({\n type: \"Feature\",\n geometry: {\n type: \"Point\",\n coordinates: calcPt.lonlat\n },\n properties: {\n symbol: fillSymbol(i),\n angle: fillAngle(i),\n text\n }\n });\n }\n return {\n type: \"FeatureCollection\",\n features\n };\n }\n function getFillFunc(attr, numeric) {\n if (Lib.isArrayOrTypedArray(attr)) {\n if (numeric) {\n return function(i) {\n return isNumeric(attr[i]) ? +attr[i] : 0;\n };\n }\n return function(i) {\n return attr[i];\n };\n } else if (attr) {\n return function() {\n return attr;\n };\n } else {\n return blankFillFunc;\n }\n }\n function blankFillFunc() {\n return \"\";\n }\n function isBADNUM(lonlat) {\n return lonlat[0] === BADNUM;\n }\n function arrayifyAttribute(values, step) {\n var newAttribute;\n if (Lib.isArrayOrTypedArray(values) && Lib.isArrayOrTypedArray(step)) {\n newAttribute = [\"step\", [\"get\", \"point_count\"], values[0]];\n for (var idx = 1; idx < values.length; idx++) {\n newAttribute.push(step[idx - 1], values[idx]);\n }\n } else {\n newAttribute = values;\n }\n return newAttribute;\n }\n function getTextFont(trace) {\n var font = trace.textfont;\n var family = font.family;\n var style = font.style;\n var weight = font.weight;\n var parts = family.split(\" \");\n var isItalic = parts[parts.length - 1] === \"Italic\";\n if (isItalic) parts.pop();\n isItalic = isItalic || style === \"italic\";\n var str = parts.join(\" \");\n if (weight === \"bold\" && parts.indexOf(\"Bold\") === -1) {\n str += \" Bold\";\n } else if (weight <= 1e3) {\n if (parts[0] === \"Metropolis\") {\n str = \"Metropolis\";\n if (weight > 850) str += \" Black\";\n else if (weight > 750) str += \" Extra Bold\";\n else if (weight > 650) str += \" Bold\";\n else if (weight > 550) str += \" Semi Bold\";\n else if (weight > 450) str += \" Medium\";\n else if (weight > 350) str += \" Regular\";\n else if (weight > 250) str += \" Light\";\n else if (weight > 150) str += \" Extra Light\";\n else str += \" Thin\";\n } else if (parts.slice(0, 2).join(\" \") === \"Open Sans\") {\n str = \"Open Sans\";\n if (weight > 750) str += \" Extrabold\";\n else if (weight > 650) str += \" Bold\";\n else if (weight > 550) str += \" Semibold\";\n else if (weight > 350) str += \" Regular\";\n else str += \" Light\";\n } else if (parts.slice(0, 3).join(\" \") === \"Klokantech Noto Sans\") {\n str = \"Klokantech Noto Sans\";\n if (parts[3] === \"CJK\") str += \" CJK\";\n str += weight > 500 ? \" Bold\" : \" Regular\";\n }\n }\n if (isItalic) str += \" Italic\";\n if (str === \"Open Sans Regular Italic\") str = \"Open Sans Italic\";\n else if (str === \"Open Sans Regular Bold\") str = \"Open Sans Bold\";\n else if (str === \"Open Sans Regular Bold Italic\") str = \"Open Sans Bold Italic\";\n else if (str === \"Klokantech Noto Sans Regular Italic\") str = \"Klokantech Noto Sans Italic\";\n if (!isSupportedFont(str)) {\n str = family;\n }\n var textFont = str.split(\", \");\n return textFont;\n }\n }\n });\n\n // src/traces/scattermapbox/plot.js\n var require_plot23 = __commonJS({\n \"src/traces/scattermapbox/plot.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var convert = require_convert11();\n var LAYER_PREFIX = require_constants25().traceLayerPrefix;\n var ORDER = {\n cluster: [\"cluster\", \"clusterCount\", \"circle\"],\n nonCluster: [\"fill\", \"line\", \"circle\", \"symbol\"]\n };\n function ScatterMapbox(subplot, uid, clusterEnabled, isHidden) {\n this.type = \"scattermapbox\";\n this.subplot = subplot;\n this.uid = uid;\n this.clusterEnabled = clusterEnabled;\n this.isHidden = isHidden;\n this.sourceIds = {\n fill: \"source-\" + uid + \"-fill\",\n line: \"source-\" + uid + \"-line\",\n circle: \"source-\" + uid + \"-circle\",\n symbol: \"source-\" + uid + \"-symbol\",\n cluster: \"source-\" + uid + \"-circle\",\n clusterCount: \"source-\" + uid + \"-circle\"\n };\n this.layerIds = {\n fill: LAYER_PREFIX + uid + \"-fill\",\n line: LAYER_PREFIX + uid + \"-line\",\n circle: LAYER_PREFIX + uid + \"-circle\",\n symbol: LAYER_PREFIX + uid + \"-symbol\",\n cluster: LAYER_PREFIX + uid + \"-cluster\",\n clusterCount: LAYER_PREFIX + uid + \"-cluster-count\"\n };\n this.below = null;\n }\n var proto = ScatterMapbox.prototype;\n proto.addSource = function(k, opts, cluster) {\n var sourceOpts = {\n type: \"geojson\",\n data: opts.geojson\n };\n if (cluster && cluster.enabled) {\n Lib.extendFlat(sourceOpts, {\n cluster: true,\n clusterMaxZoom: cluster.maxzoom\n });\n }\n var isSourceExists = this.subplot.map.getSource(this.sourceIds[k]);\n if (isSourceExists) {\n isSourceExists.setData(opts.geojson);\n } else {\n this.subplot.map.addSource(this.sourceIds[k], sourceOpts);\n }\n };\n proto.setSourceData = function(k, opts) {\n this.subplot.map.getSource(this.sourceIds[k]).setData(opts.geojson);\n };\n proto.addLayer = function(k, opts, below) {\n var source = {\n type: opts.type,\n id: this.layerIds[k],\n source: this.sourceIds[k],\n layout: opts.layout,\n paint: opts.paint\n };\n if (opts.filter) {\n source.filter = opts.filter;\n }\n var currentLayerId = this.layerIds[k];\n var layerExist;\n var layers = this.subplot.getMapLayers();\n for (var i = 0; i < layers.length; i++) {\n if (layers[i].id === currentLayerId) {\n layerExist = true;\n break;\n }\n }\n if (layerExist) {\n this.subplot.setOptions(currentLayerId, \"setLayoutProperty\", source.layout);\n if (source.layout.visibility === \"visible\") {\n this.subplot.setOptions(currentLayerId, \"setPaintProperty\", source.paint);\n }\n } else {\n this.subplot.addLayer(source, below);\n }\n };\n proto.update = function update(calcTrace) {\n var trace = calcTrace[0].trace;\n var subplot = this.subplot;\n var map = subplot.map;\n var optsAll = convert(subplot.gd, calcTrace);\n var below = subplot.belowLookup[\"trace-\" + this.uid];\n var hasCluster = !!(trace.cluster && trace.cluster.enabled);\n var hadCluster = !!this.clusterEnabled;\n var lThis = this;\n function addCluster(noSource) {\n if (!noSource) lThis.addSource(\"circle\", optsAll.circle, trace.cluster);\n var order = ORDER.cluster;\n for (var i = 0; i < order.length; i++) {\n var k = order[i];\n var opts = optsAll[k];\n lThis.addLayer(k, opts, below);\n }\n }\n function removeCluster(noSource) {\n var order = ORDER.cluster;\n for (var i = order.length - 1; i >= 0; i--) {\n var k = order[i];\n map.removeLayer(lThis.layerIds[k]);\n }\n if (!noSource) map.removeSource(lThis.sourceIds.circle);\n }\n function addNonCluster(noSource) {\n var order = ORDER.nonCluster;\n for (var i = 0; i < order.length; i++) {\n var k = order[i];\n var opts = optsAll[k];\n if (!noSource) lThis.addSource(k, opts);\n lThis.addLayer(k, opts, below);\n }\n }\n function removeNonCluster(noSource) {\n var order = ORDER.nonCluster;\n for (var i = order.length - 1; i >= 0; i--) {\n var k = order[i];\n map.removeLayer(lThis.layerIds[k]);\n if (!noSource) map.removeSource(lThis.sourceIds[k]);\n }\n }\n function remove(noSource) {\n if (hadCluster) removeCluster(noSource);\n else removeNonCluster(noSource);\n }\n function add(noSource) {\n if (hasCluster) addCluster(noSource);\n else addNonCluster(noSource);\n }\n function repaint() {\n var order = hasCluster ? ORDER.cluster : ORDER.nonCluster;\n for (var i = 0; i < order.length; i++) {\n var k = order[i];\n var opts = optsAll[k];\n if (!opts) continue;\n subplot.setOptions(lThis.layerIds[k], \"setLayoutProperty\", opts.layout);\n if (opts.layout.visibility === \"visible\") {\n if (k !== \"cluster\") {\n lThis.setSourceData(k, opts);\n }\n subplot.setOptions(lThis.layerIds[k], \"setPaintProperty\", opts.paint);\n }\n }\n }\n var wasHidden = this.isHidden;\n var isHidden = trace.visible !== true;\n if (isHidden) {\n if (!wasHidden) remove();\n } else if (wasHidden) {\n if (!isHidden) add();\n } else if (hadCluster !== hasCluster) {\n remove();\n add();\n } else if (this.below !== below) {\n remove(true);\n add(true);\n repaint();\n } else {\n repaint();\n }\n this.clusterEnabled = hasCluster;\n this.isHidden = isHidden;\n this.below = below;\n calcTrace[0].trace._glTrace = this;\n };\n proto.dispose = function dispose() {\n var map = this.subplot.map;\n var order = this.clusterEnabled ? ORDER.cluster : ORDER.nonCluster;\n for (var i = order.length - 1; i >= 0; i--) {\n var k = order[i];\n map.removeLayer(this.layerIds[k]);\n map.removeSource(this.sourceIds[k]);\n }\n };\n module.exports = function createScatterMapbox(subplot, calcTrace) {\n var trace = calcTrace[0].trace;\n var hasCluster = trace.cluster && trace.cluster.enabled;\n var isHidden = trace.visible !== true;\n var scatterMapbox = new ScatterMapbox(\n subplot,\n trace.uid,\n hasCluster,\n isHidden\n );\n var optsAll = convert(subplot.gd, calcTrace);\n var below = scatterMapbox.below = subplot.belowLookup[\"trace-\" + trace.uid];\n var i, k, opts;\n if (hasCluster) {\n scatterMapbox.addSource(\"circle\", optsAll.circle, trace.cluster);\n for (i = 0; i < ORDER.cluster.length; i++) {\n k = ORDER.cluster[i];\n opts = optsAll[k];\n scatterMapbox.addLayer(k, opts, below);\n }\n } else {\n for (i = 0; i < ORDER.nonCluster.length; i++) {\n k = ORDER.nonCluster[i];\n opts = optsAll[k];\n scatterMapbox.addSource(k, opts, trace.cluster);\n scatterMapbox.addLayer(k, opts, below);\n }\n }\n calcTrace[0].trace._glTrace = scatterMapbox;\n return scatterMapbox;\n };\n }\n });\n\n // src/traces/scattermapbox/hover.js\n var require_hover18 = __commonJS({\n \"src/traces/scattermapbox/hover.js\"(exports, module) {\n \"use strict\";\n var Fx = require_fx();\n var Lib = require_lib();\n var getTraceColor = require_get_trace_color();\n var fillText = Lib.fillText;\n var BADNUM = require_numerical().BADNUM;\n var LAYER_PREFIX = require_constants25().traceLayerPrefix;\n function hoverPoints(pointData, xval, yval) {\n var cd = pointData.cd;\n var trace = cd[0].trace;\n var xa = pointData.xa;\n var ya = pointData.ya;\n var subplot = pointData.subplot;\n var clusteredPointsIds = [];\n var layer = LAYER_PREFIX + trace.uid + \"-circle\";\n var hasCluster = trace.cluster && trace.cluster.enabled;\n if (hasCluster) {\n var elems = subplot.map.queryRenderedFeatures(null, { layers: [layer] });\n clusteredPointsIds = elems.map(function(elem) {\n return elem.id;\n });\n }\n var winding = xval >= 0 ? Math.floor((xval + 180) / 360) : Math.ceil((xval - 180) / 360);\n var lonShift = winding * 360;\n var xval2 = xval - lonShift;\n function distFn(d) {\n var lonlat2 = d.lonlat;\n if (lonlat2[0] === BADNUM) return Infinity;\n if (hasCluster && clusteredPointsIds.indexOf(d.i + 1) === -1) return Infinity;\n var lon = Lib.modHalf(lonlat2[0], 360);\n var lat = lonlat2[1];\n var pt = subplot.project([lon, lat]);\n var dx = pt.x - xa.c2p([xval2, lat]);\n var dy = pt.y - ya.c2p([lon, yval]);\n var rad2 = Math.max(3, d.mrc || 0);\n return Math.max(Math.sqrt(dx * dx + dy * dy) - rad2, 1 - 3 / rad2);\n }\n Fx.getClosest(cd, distFn, pointData);\n if (pointData.index === false) return;\n var di = cd[pointData.index];\n var lonlat = di.lonlat;\n var lonlatShifted = [Lib.modHalf(lonlat[0], 360) + lonShift, lonlat[1]];\n var xc = xa.c2p(lonlatShifted);\n var yc = ya.c2p(lonlatShifted);\n var rad = di.mrc || 1;\n pointData.x0 = xc - rad;\n pointData.x1 = xc + rad;\n pointData.y0 = yc - rad;\n pointData.y1 = yc + rad;\n var fullLayout = {};\n fullLayout[trace.subplot] = { _subplot: subplot };\n var labels = trace._module.formatLabels(di, trace, fullLayout);\n pointData.lonLabel = labels.lonLabel;\n pointData.latLabel = labels.latLabel;\n pointData.color = getTraceColor(trace, di);\n pointData.extraText = getExtraText(trace, di, cd[0].t.labels);\n pointData.hovertemplate = trace.hovertemplate;\n return [pointData];\n }\n function getExtraText(trace, di, labels) {\n if (trace.hovertemplate) return;\n var hoverinfo = di.hi || trace.hoverinfo;\n var parts = hoverinfo.split(\"+\");\n var isAll = parts.indexOf(\"all\") !== -1;\n var hasLon = parts.indexOf(\"lon\") !== -1;\n var hasLat = parts.indexOf(\"lat\") !== -1;\n var lonlat = di.lonlat;\n var text = [];\n function format(v) {\n return v + \"\\xB0\";\n }\n if (isAll || hasLon && hasLat) {\n text.push(\"(\" + format(lonlat[1]) + \", \" + format(lonlat[0]) + \")\");\n } else if (hasLon) {\n text.push(labels.lon + format(lonlat[0]));\n } else if (hasLat) {\n text.push(labels.lat + format(lonlat[1]));\n }\n if (isAll || parts.indexOf(\"text\") !== -1) {\n fillText(di, trace, text);\n }\n return text.join(\"
    \");\n }\n module.exports = {\n hoverPoints,\n getExtraText\n };\n }\n });\n\n // src/traces/scattermapbox/event_data.js\n var require_event_data11 = __commonJS({\n \"src/traces/scattermapbox/event_data.js\"(exports, module) {\n \"use strict\";\n module.exports = function eventData(out, pt) {\n out.lon = pt.lon;\n out.lat = pt.lat;\n return out;\n };\n }\n });\n\n // src/traces/scattermapbox/select.js\n var require_select9 = __commonJS({\n \"src/traces/scattermapbox/select.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var subtypes = require_subtypes();\n var BADNUM = require_numerical().BADNUM;\n module.exports = function selectPoints(searchInfo, selectionTester) {\n var cd = searchInfo.cd;\n var xa = searchInfo.xaxis;\n var ya = searchInfo.yaxis;\n var selection = [];\n var trace = cd[0].trace;\n var i;\n if (!subtypes.hasMarkers(trace)) return [];\n if (selectionTester === false) {\n for (i = 0; i < cd.length; i++) {\n cd[i].selected = 0;\n }\n } else {\n for (i = 0; i < cd.length; i++) {\n var di = cd[i];\n var lonlat = di.lonlat;\n if (lonlat[0] !== BADNUM) {\n var lonlat2 = [Lib.modHalf(lonlat[0], 360), lonlat[1]];\n var xy = [xa.c2p(lonlat2), ya.c2p(lonlat2)];\n if (selectionTester.contains(xy, null, i, searchInfo)) {\n selection.push({\n pointNumber: i,\n lon: lonlat[0],\n lat: lonlat[1]\n });\n di.selected = 1;\n } else {\n di.selected = 0;\n }\n }\n }\n }\n return selection;\n };\n }\n });\n\n // node_modules/@plotly/mapbox-gl/dist/mapbox-gl-unminified.js\n var require_mapbox_gl_unminified = __commonJS({\n \"node_modules/@plotly/mapbox-gl/dist/mapbox-gl-unminified.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? module.exports = factory() : typeof define === \"function\" && false ? define(factory) : (global2 = global2 || self, global2.mapboxgl = factory());\n })(exports, function() {\n \"use strict\";\n var shared, worker, mapboxgl;\n function define2(_, chunk) {\n if (!shared) {\n shared = chunk;\n } else if (!worker) {\n worker = chunk;\n } else {\n var workerBundleString = \"var sharedChunk = {}; (\" + shared + \")(sharedChunk); (\" + worker + \")(sharedChunk);\";\n var sharedChunk = {};\n shared(sharedChunk);\n mapboxgl = chunk(sharedChunk);\n if (typeof window !== \"undefined\") {\n mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: \"text/javascript\" }));\n }\n }\n }\n define2([\"exports\"], function(exports2) {\n \"use strict\";\n function createCommonjsModule(fn, module2) {\n return module2 = { exports: {} }, fn(module2, module2.exports), module2.exports;\n }\n var version = \"1.13.4\";\n var unitbezier = UnitBezier;\n function UnitBezier(p1x, p1y, p2x, p2y) {\n this.cx = 3 * p1x;\n this.bx = 3 * (p2x - p1x) - this.cx;\n this.ax = 1 - this.cx - this.bx;\n this.cy = 3 * p1y;\n this.by = 3 * (p2y - p1y) - this.cy;\n this.ay = 1 - this.cy - this.by;\n this.p1x = p1x;\n this.p1y = p2y;\n this.p2x = p2x;\n this.p2y = p2y;\n }\n UnitBezier.prototype.sampleCurveX = function(t) {\n return ((this.ax * t + this.bx) * t + this.cx) * t;\n };\n UnitBezier.prototype.sampleCurveY = function(t) {\n return ((this.ay * t + this.by) * t + this.cy) * t;\n };\n UnitBezier.prototype.sampleCurveDerivativeX = function(t) {\n return (3 * this.ax * t + 2 * this.bx) * t + this.cx;\n };\n UnitBezier.prototype.solveCurveX = function(x, epsilon) {\n if (typeof epsilon === \"undefined\") {\n epsilon = 1e-6;\n }\n var t03, t13, t23, x2, i;\n for (t23 = x, i = 0; i < 8; i++) {\n x2 = this.sampleCurveX(t23) - x;\n if (Math.abs(x2) < epsilon) {\n return t23;\n }\n var d2 = this.sampleCurveDerivativeX(t23);\n if (Math.abs(d2) < 1e-6) {\n break;\n }\n t23 = t23 - x2 / d2;\n }\n t03 = 0;\n t13 = 1;\n t23 = x;\n if (t23 < t03) {\n return t03;\n }\n if (t23 > t13) {\n return t13;\n }\n while (t03 < t13) {\n x2 = this.sampleCurveX(t23);\n if (Math.abs(x2 - x) < epsilon) {\n return t23;\n }\n if (x > x2) {\n t03 = t23;\n } else {\n t13 = t23;\n }\n t23 = (t13 - t03) * 0.5 + t03;\n }\n return t23;\n };\n UnitBezier.prototype.solve = function(x, epsilon) {\n return this.sampleCurveY(this.solveCurveX(x, epsilon));\n };\n var pointGeometry = Point;\n function Point(x, y) {\n this.x = x;\n this.y = y;\n }\n Point.prototype = {\n clone: function() {\n return new Point(this.x, this.y);\n },\n add: function(p) {\n return this.clone()._add(p);\n },\n sub: function(p) {\n return this.clone()._sub(p);\n },\n multByPoint: function(p) {\n return this.clone()._multByPoint(p);\n },\n divByPoint: function(p) {\n return this.clone()._divByPoint(p);\n },\n mult: function(k) {\n return this.clone()._mult(k);\n },\n div: function(k) {\n return this.clone()._div(k);\n },\n rotate: function(a) {\n return this.clone()._rotate(a);\n },\n rotateAround: function(a, p) {\n return this.clone()._rotateAround(a, p);\n },\n matMult: function(m) {\n return this.clone()._matMult(m);\n },\n unit: function() {\n return this.clone()._unit();\n },\n perp: function() {\n return this.clone()._perp();\n },\n round: function() {\n return this.clone()._round();\n },\n mag: function() {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n },\n equals: function(other) {\n return this.x === other.x && this.y === other.y;\n },\n dist: function(p) {\n return Math.sqrt(this.distSqr(p));\n },\n distSqr: function(p) {\n var dx = p.x - this.x, dy = p.y - this.y;\n return dx * dx + dy * dy;\n },\n angle: function() {\n return Math.atan2(this.y, this.x);\n },\n angleTo: function(b) {\n return Math.atan2(this.y - b.y, this.x - b.x);\n },\n angleWith: function(b) {\n return this.angleWithSep(b.x, b.y);\n },\n angleWithSep: function(x, y) {\n return Math.atan2(this.x * y - this.y * x, this.x * x + this.y * y);\n },\n _matMult: function(m) {\n var x = m[0] * this.x + m[1] * this.y, y = m[2] * this.x + m[3] * this.y;\n this.x = x;\n this.y = y;\n return this;\n },\n _add: function(p) {\n this.x += p.x;\n this.y += p.y;\n return this;\n },\n _sub: function(p) {\n this.x -= p.x;\n this.y -= p.y;\n return this;\n },\n _mult: function(k) {\n this.x *= k;\n this.y *= k;\n return this;\n },\n _div: function(k) {\n this.x /= k;\n this.y /= k;\n return this;\n },\n _multByPoint: function(p) {\n this.x *= p.x;\n this.y *= p.y;\n return this;\n },\n _divByPoint: function(p) {\n this.x /= p.x;\n this.y /= p.y;\n return this;\n },\n _unit: function() {\n this._div(this.mag());\n return this;\n },\n _perp: function() {\n var y = this.y;\n this.y = this.x;\n this.x = -y;\n return this;\n },\n _rotate: function(angle) {\n var cos = Math.cos(angle), sin = Math.sin(angle), x = cos * this.x - sin * this.y, y = sin * this.x + cos * this.y;\n this.x = x;\n this.y = y;\n return this;\n },\n _rotateAround: function(angle, p) {\n var cos = Math.cos(angle), sin = Math.sin(angle), x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y), y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);\n this.x = x;\n this.y = y;\n return this;\n },\n _round: function() {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n return this;\n }\n };\n Point.convert = function(a) {\n if (a instanceof Point) {\n return a;\n }\n if (Array.isArray(a)) {\n return new Point(a[0], a[1]);\n }\n return a;\n };\n var window$1 = typeof self !== \"undefined\" ? self : {};\n function deepEqual(a, b) {\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) {\n return false;\n }\n for (var i = 0; i < a.length; i++) {\n if (!deepEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n if (typeof a === \"object\" && a !== null && b !== null) {\n if (!(typeof b === \"object\")) {\n return false;\n }\n var keys = Object.keys(a);\n if (keys.length !== Object.keys(b).length) {\n return false;\n }\n for (var key in a) {\n if (!deepEqual(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n return a === b;\n }\n var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;\n function easeCubicInOut(t) {\n if (t <= 0) {\n return 0;\n }\n if (t >= 1) {\n return 1;\n }\n var t23 = t * t, t33 = t23 * t;\n return 4 * (t < 0.5 ? t33 : 3 * (t - t23) + t33 - 0.75);\n }\n function bezier(p1x, p1y, p2x, p2y) {\n var bezier2 = new unitbezier(p1x, p1y, p2x, p2y);\n return function(t) {\n return bezier2.solve(t);\n };\n }\n var ease = bezier(0.25, 0.1, 0.25, 1);\n function clamp(n, min, max) {\n return Math.min(max, Math.max(min, n));\n }\n function wrap(n, min, max) {\n var d = max - min;\n var w = ((n - min) % d + d) % d + min;\n return w === min ? max : w;\n }\n function asyncAll(array2, fn, callback) {\n if (!array2.length) {\n return callback(null, []);\n }\n var remaining = array2.length;\n var results = new Array(array2.length);\n var error2 = null;\n array2.forEach(function(item, i) {\n fn(item, function(err, result) {\n if (err) {\n error2 = err;\n }\n results[i] = result;\n if (--remaining === 0) {\n callback(error2, results);\n }\n });\n });\n }\n function values(obj) {\n var result = [];\n for (var k in obj) {\n result.push(obj[k]);\n }\n return result;\n }\n function keysDifference(obj, other) {\n var difference = [];\n for (var i in obj) {\n if (!(i in other)) {\n difference.push(i);\n }\n }\n return difference;\n }\n function extend2(dest) {\n var sources2 = [], len = arguments.length - 1;\n while (len-- > 0)\n sources2[len] = arguments[len + 1];\n for (var i = 0, list = sources2; i < list.length; i += 1) {\n var src = list[i];\n for (var k in src) {\n dest[k] = src[k];\n }\n }\n return dest;\n }\n function pick(src, properties2) {\n var result = {};\n for (var i = 0; i < properties2.length; i++) {\n var k = properties2[i];\n if (k in src) {\n result[k] = src[k];\n }\n }\n return result;\n }\n var id = 1;\n function uniqueId() {\n return id++;\n }\n function uuid() {\n function b(a) {\n return a ? (a ^ Math.random() * 16 >> a / 4).toString(16) : ([1e7] + -[1e3] + -4e3 + -8e3 + -1e11).replace(/[018]/g, b);\n }\n return b();\n }\n function nextPowerOfTwo(value) {\n if (value <= 1) {\n return 1;\n }\n return Math.pow(2, Math.ceil(Math.log(value) / Math.LN2));\n }\n function validateUuid(str) {\n return str ? /^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(str) : false;\n }\n function bindAll(fns, context) {\n fns.forEach(function(fn) {\n if (!context[fn]) {\n return;\n }\n context[fn] = context[fn].bind(context);\n });\n }\n function endsWith(string, suffix) {\n return string.indexOf(suffix, string.length - suffix.length) !== -1;\n }\n function mapObject(input, iterator, context) {\n var output = {};\n for (var key in input) {\n output[key] = iterator.call(context || this, input[key], key, input);\n }\n return output;\n }\n function filterObject(input, iterator, context) {\n var output = {};\n for (var key in input) {\n if (iterator.call(context || this, input[key], key, input)) {\n output[key] = input[key];\n }\n }\n return output;\n }\n function clone(input) {\n if (Array.isArray(input)) {\n return input.map(clone);\n } else if (typeof input === \"object\" && input) {\n return mapObject(input, clone);\n } else {\n return input;\n }\n }\n function arraysIntersect(a, b) {\n for (var l = 0; l < a.length; l++) {\n if (b.indexOf(a[l]) >= 0) {\n return true;\n }\n }\n return false;\n }\n var warnOnceHistory = {};\n function warnOnce(message) {\n if (!warnOnceHistory[message]) {\n if (typeof console !== \"undefined\") {\n console.warn(message);\n }\n warnOnceHistory[message] = true;\n }\n }\n function isCounterClockwise(a, b, c) {\n return (c.y - a.y) * (b.x - a.x) > (b.y - a.y) * (c.x - a.x);\n }\n function calculateSignedArea(ring) {\n var sum = 0;\n for (var i = 0, len = ring.length, j = len - 1, p1 = void 0, p2 = void 0; i < len; j = i++) {\n p1 = ring[i];\n p2 = ring[j];\n sum += (p2.x - p1.x) * (p1.y + p2.y);\n }\n return sum;\n }\n function sphericalToCartesian(ref) {\n var r = ref[0];\n var azimuthal = ref[1];\n var polar = ref[2];\n azimuthal += 90;\n azimuthal *= Math.PI / 180;\n polar *= Math.PI / 180;\n return {\n x: r * Math.cos(azimuthal) * Math.sin(polar),\n y: r * Math.sin(azimuthal) * Math.sin(polar),\n z: r * Math.cos(polar)\n };\n }\n function isWorker() {\n return typeof WorkerGlobalScope !== \"undefined\" && typeof self !== \"undefined\" && self instanceof WorkerGlobalScope;\n }\n function parseCacheControl(cacheControl) {\n var re = /(?:^|(?:\\s*\\,\\s*))([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)(?:\\=(?:([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)|(?:\\\"((?:[^\"\\\\]|\\\\.)*)\\\")))?/g;\n var header = {};\n cacheControl.replace(re, function($0, $1, $2, $3) {\n var value = $2 || $3;\n header[$1] = value ? value.toLowerCase() : true;\n return \"\";\n });\n if (header[\"max-age\"]) {\n var maxAge = parseInt(header[\"max-age\"], 10);\n if (isNaN(maxAge)) {\n delete header[\"max-age\"];\n } else {\n header[\"max-age\"] = maxAge;\n }\n }\n return header;\n }\n var _isSafari = null;\n function isSafari(scope) {\n if (_isSafari == null) {\n var userAgent = scope.navigator ? scope.navigator.userAgent : null;\n _isSafari = !!scope.safari || !!(userAgent && (/\\b(iPad|iPhone|iPod)\\b/.test(userAgent) || !!userAgent.match(\"Safari\") && !userAgent.match(\"Chrome\")));\n }\n return _isSafari;\n }\n function storageAvailable(type) {\n try {\n var storage = window$1[type];\n storage.setItem(\"_mapbox_test_\", 1);\n storage.removeItem(\"_mapbox_test_\");\n return true;\n } catch (e) {\n return false;\n }\n }\n function b64EncodeUnicode(str) {\n return window$1.btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function(match, p1) {\n return String.fromCharCode(Number(\"0x\" + p1));\n }));\n }\n function b64DecodeUnicode(str) {\n return decodeURIComponent(window$1.atob(str).split(\"\").map(function(c) {\n return \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(\"\"));\n }\n var now = window$1.performance && window$1.performance.now ? window$1.performance.now.bind(window$1.performance) : Date.now.bind(Date);\n var raf = window$1.requestAnimationFrame || window$1.mozRequestAnimationFrame || window$1.webkitRequestAnimationFrame || window$1.msRequestAnimationFrame;\n var cancel = window$1.cancelAnimationFrame || window$1.mozCancelAnimationFrame || window$1.webkitCancelAnimationFrame || window$1.msCancelAnimationFrame;\n var linkEl;\n var reducedMotionQuery;\n var exported = {\n now,\n frame: function frame(fn) {\n var frame2 = raf(fn);\n return {\n cancel: function() {\n return cancel(frame2);\n }\n };\n },\n getImageData: function getImageData(img, padding) {\n if (padding === void 0)\n padding = 0;\n var canvas = window$1.document.createElement(\"canvas\");\n var context = canvas.getContext(\"2d\");\n if (!context) {\n throw new Error(\"failed to create canvas 2d context\");\n }\n canvas.width = img.width;\n canvas.height = img.height;\n context.drawImage(img, 0, 0, img.width, img.height);\n return context.getImageData(-padding, -padding, img.width + 2 * padding, img.height + 2 * padding);\n },\n resolveURL: function resolveURL(path) {\n if (!linkEl) {\n linkEl = window$1.document.createElement(\"a\");\n }\n linkEl.href = path;\n return linkEl.href;\n },\n hardwareConcurrency: window$1.navigator && window$1.navigator.hardwareConcurrency || 4,\n get devicePixelRatio() {\n return window$1.devicePixelRatio;\n },\n get prefersReducedMotion() {\n if (!window$1.matchMedia) {\n return false;\n }\n if (reducedMotionQuery == null) {\n reducedMotionQuery = window$1.matchMedia(\"(prefers-reduced-motion: reduce)\");\n }\n return reducedMotionQuery.matches;\n }\n };\n var config = {\n API_URL: \"https://api.mapbox.com\",\n get EVENTS_URL() {\n if (!this.API_URL) {\n return null;\n }\n if (this.API_URL.indexOf(\"https://api.mapbox.cn\") === 0) {\n return \"https://events.mapbox.cn/events/v2\";\n } else if (this.API_URL.indexOf(\"https://api.mapbox.com\") === 0) {\n return \"https://events.mapbox.com/events/v2\";\n } else {\n return null;\n }\n },\n FEEDBACK_URL: \"https://apps.mapbox.com/feedback\",\n REQUIRE_ACCESS_TOKEN: true,\n ACCESS_TOKEN: null,\n MAX_PARALLEL_IMAGE_REQUESTS: 16\n };\n var exported$1 = {\n supported: false,\n testSupport\n };\n var glForTesting;\n var webpCheckComplete = false;\n var webpImgTest;\n var webpImgTestOnloadComplete = false;\n if (window$1.document) {\n webpImgTest = window$1.document.createElement(\"img\");\n webpImgTest.onload = function() {\n if (glForTesting) {\n testWebpTextureUpload(glForTesting);\n }\n glForTesting = null;\n webpImgTestOnloadComplete = true;\n };\n webpImgTest.onerror = function() {\n webpCheckComplete = true;\n glForTesting = null;\n };\n webpImgTest.src = \"data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=\";\n }\n function testSupport(gl2) {\n if (webpCheckComplete || !webpImgTest) {\n return;\n }\n if (webpImgTestOnloadComplete) {\n testWebpTextureUpload(gl2);\n } else {\n glForTesting = gl2;\n }\n }\n function testWebpTextureUpload(gl2) {\n var texture = gl2.createTexture();\n gl2.bindTexture(gl2.TEXTURE_2D, texture);\n try {\n gl2.texImage2D(gl2.TEXTURE_2D, 0, gl2.RGBA, gl2.RGBA, gl2.UNSIGNED_BYTE, webpImgTest);\n if (gl2.isContextLost()) {\n return;\n }\n exported$1.supported = true;\n } catch (e) {\n }\n gl2.deleteTexture(texture);\n webpCheckComplete = true;\n }\n var SKU_ID = \"01\";\n function createSkuToken() {\n var TOKEN_VERSION = \"1\";\n var base62chars = \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n var sessionRandomizer = \"\";\n for (var i = 0; i < 10; i++) {\n sessionRandomizer += base62chars[Math.floor(Math.random() * 62)];\n }\n var expiration = 12 * 60 * 60 * 1e3;\n var token = [\n TOKEN_VERSION,\n SKU_ID,\n sessionRandomizer\n ].join(\"\");\n var tokenExpiresAt = Date.now() + expiration;\n return {\n token,\n tokenExpiresAt\n };\n }\n var RequestManager = function RequestManager2(transformRequestFn, customAccessToken) {\n this._transformRequestFn = transformRequestFn;\n this._customAccessToken = customAccessToken;\n this._createSkuToken();\n };\n RequestManager.prototype._createSkuToken = function _createSkuToken() {\n var skuToken = createSkuToken();\n this._skuToken = skuToken.token;\n this._skuTokenExpiresAt = skuToken.tokenExpiresAt;\n };\n RequestManager.prototype._isSkuTokenExpired = function _isSkuTokenExpired() {\n return Date.now() > this._skuTokenExpiresAt;\n };\n RequestManager.prototype.transformRequest = function transformRequest(url, type) {\n if (this._transformRequestFn) {\n return this._transformRequestFn(url, type) || { url };\n }\n return { url };\n };\n RequestManager.prototype.normalizeStyleURL = function normalizeStyleURL(url, accessToken) {\n if (!isMapboxURL(url)) {\n return url;\n }\n var urlObject = parseUrl(url);\n urlObject.path = \"/styles/v1\" + urlObject.path;\n return this._makeAPIURL(urlObject, this._customAccessToken || accessToken);\n };\n RequestManager.prototype.normalizeGlyphsURL = function normalizeGlyphsURL(url, accessToken) {\n if (!isMapboxURL(url)) {\n return url;\n }\n var urlObject = parseUrl(url);\n urlObject.path = \"/fonts/v1\" + urlObject.path;\n return this._makeAPIURL(urlObject, this._customAccessToken || accessToken);\n };\n RequestManager.prototype.normalizeSourceURL = function normalizeSourceURL(url, accessToken) {\n if (!isMapboxURL(url)) {\n return url;\n }\n var urlObject = parseUrl(url);\n urlObject.path = \"/v4/\" + urlObject.authority + \".json\";\n urlObject.params.push(\"secure\");\n return this._makeAPIURL(urlObject, this._customAccessToken || accessToken);\n };\n RequestManager.prototype.normalizeSpriteURL = function normalizeSpriteURL(url, format, extension, accessToken) {\n var urlObject = parseUrl(url);\n if (!isMapboxURL(url)) {\n urlObject.path += \"\" + format + extension;\n return formatUrl(urlObject);\n }\n urlObject.path = \"/styles/v1\" + urlObject.path + \"/sprite\" + format + extension;\n return this._makeAPIURL(urlObject, this._customAccessToken || accessToken);\n };\n RequestManager.prototype.normalizeTileURL = function normalizeTileURL(tileURL, tileSize) {\n if (this._isSkuTokenExpired()) {\n this._createSkuToken();\n }\n if (tileURL && !isMapboxURL(tileURL)) {\n return tileURL;\n }\n var urlObject = parseUrl(tileURL);\n var imageExtensionRe = /(\\.(png|jpg)\\d*)(?=$)/;\n var tileURLAPIPrefixRe = /^.+\\/v4\\//;\n var suffix = exported.devicePixelRatio >= 2 || tileSize === 512 ? \"@2x\" : \"\";\n var extension = exported$1.supported ? \".webp\" : \"$1\";\n urlObject.path = urlObject.path.replace(imageExtensionRe, \"\" + suffix + extension);\n urlObject.path = urlObject.path.replace(tileURLAPIPrefixRe, \"/\");\n urlObject.path = \"/v4\" + urlObject.path;\n var accessToken = this._customAccessToken || getAccessToken(urlObject.params) || config.ACCESS_TOKEN;\n if (config.REQUIRE_ACCESS_TOKEN && accessToken && this._skuToken) {\n urlObject.params.push(\"sku=\" + this._skuToken);\n }\n return this._makeAPIURL(urlObject, accessToken);\n };\n RequestManager.prototype.canonicalizeTileURL = function canonicalizeTileURL(url, removeAccessToken) {\n var version2 = \"/v4/\";\n var extensionRe = /\\.[\\w]+$/;\n var urlObject = parseUrl(url);\n if (!urlObject.path.match(/(^\\/v4\\/)/) || !urlObject.path.match(extensionRe)) {\n return url;\n }\n var result = \"mapbox://tiles/\";\n result += urlObject.path.replace(version2, \"\");\n var params = urlObject.params;\n if (removeAccessToken) {\n params = params.filter(function(p) {\n return !p.match(/^access_token=/);\n });\n }\n if (params.length) {\n result += \"?\" + params.join(\"&\");\n }\n return result;\n };\n RequestManager.prototype.canonicalizeTileset = function canonicalizeTileset(tileJSON, sourceURL) {\n var removeAccessToken = sourceURL ? isMapboxURL(sourceURL) : false;\n var canonical = [];\n for (var i = 0, list = tileJSON.tiles || []; i < list.length; i += 1) {\n var url = list[i];\n if (isMapboxHTTPURL(url)) {\n canonical.push(this.canonicalizeTileURL(url, removeAccessToken));\n } else {\n canonical.push(url);\n }\n }\n return canonical;\n };\n RequestManager.prototype._makeAPIURL = function _makeAPIURL(urlObject, accessToken) {\n var help = \"See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes\";\n var apiUrlObject = parseUrl(config.API_URL);\n urlObject.protocol = apiUrlObject.protocol;\n urlObject.authority = apiUrlObject.authority;\n if (urlObject.protocol === \"http\") {\n var i = urlObject.params.indexOf(\"secure\");\n if (i >= 0) {\n urlObject.params.splice(i, 1);\n }\n }\n if (apiUrlObject.path !== \"/\") {\n urlObject.path = \"\" + apiUrlObject.path + urlObject.path;\n }\n if (!config.REQUIRE_ACCESS_TOKEN) {\n return formatUrl(urlObject);\n }\n accessToken = accessToken || config.ACCESS_TOKEN;\n if (!accessToken) {\n throw new Error(\"An API access token is required to use Mapbox GL. \" + help);\n }\n if (accessToken[0] === \"s\") {\n throw new Error(\"Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). \" + help);\n }\n urlObject.params = urlObject.params.filter(function(d) {\n return d.indexOf(\"access_token\") === -1;\n });\n urlObject.params.push(\"access_token=\" + accessToken);\n return formatUrl(urlObject);\n };\n function isMapboxURL(url) {\n return url.indexOf(\"mapbox:\") === 0;\n }\n var mapboxHTTPURLRe = /^((https?:)?\\/\\/)?([^\\/]+\\.)?mapbox\\.c(n|om)(\\/|\\?|$)/i;\n function isMapboxHTTPURL(url) {\n return mapboxHTTPURLRe.test(url);\n }\n function hasCacheDefeatingSku(url) {\n return url.indexOf(\"sku=\") > 0 && isMapboxHTTPURL(url);\n }\n function getAccessToken(params) {\n for (var i = 0, list = params; i < list.length; i += 1) {\n var param = list[i];\n var match = param.match(/^access_token=(.*)$/);\n if (match) {\n return match[1];\n }\n }\n return null;\n }\n var urlRe = /^(\\w+):\\/\\/([^/?]*)(\\/[^?]+)?\\??(.+)?/;\n function parseUrl(url) {\n var parts = url.match(urlRe);\n if (!parts) {\n throw new Error(\"Unable to parse URL object\");\n }\n return {\n protocol: parts[1],\n authority: parts[2],\n path: parts[3] || \"/\",\n params: parts[4] ? parts[4].split(\"&\") : []\n };\n }\n function formatUrl(obj) {\n var params = obj.params.length ? \"?\" + obj.params.join(\"&\") : \"\";\n return obj.protocol + \"://\" + obj.authority + obj.path + params;\n }\n var telemEventKey = \"mapbox.eventData\";\n function parseAccessToken(accessToken) {\n if (!accessToken) {\n return null;\n }\n var parts = accessToken.split(\".\");\n if (!parts || parts.length !== 3) {\n return null;\n }\n try {\n var jsonData = JSON.parse(b64DecodeUnicode(parts[1]));\n return jsonData;\n } catch (e) {\n return null;\n }\n }\n var TelemetryEvent = function TelemetryEvent2(type) {\n this.type = type;\n this.anonId = null;\n this.eventData = {};\n this.queue = [];\n this.pendingRequest = null;\n };\n TelemetryEvent.prototype.getStorageKey = function getStorageKey(domain) {\n var tokenData = parseAccessToken(config.ACCESS_TOKEN);\n var u = \"\";\n if (tokenData && tokenData[\"u\"]) {\n u = b64EncodeUnicode(tokenData[\"u\"]);\n } else {\n u = config.ACCESS_TOKEN || \"\";\n }\n return domain ? telemEventKey + \".\" + domain + \":\" + u : telemEventKey + \":\" + u;\n };\n TelemetryEvent.prototype.fetchEventData = function fetchEventData() {\n var isLocalStorageAvailable = storageAvailable(\"localStorage\");\n var storageKey = this.getStorageKey();\n var uuidKey = this.getStorageKey(\"uuid\");\n if (isLocalStorageAvailable) {\n try {\n var data = window$1.localStorage.getItem(storageKey);\n if (data) {\n this.eventData = JSON.parse(data);\n }\n var uuid2 = window$1.localStorage.getItem(uuidKey);\n if (uuid2) {\n this.anonId = uuid2;\n }\n } catch (e) {\n warnOnce(\"Unable to read from LocalStorage\");\n }\n }\n };\n TelemetryEvent.prototype.saveEventData = function saveEventData() {\n var isLocalStorageAvailable = storageAvailable(\"localStorage\");\n var storageKey = this.getStorageKey();\n var uuidKey = this.getStorageKey(\"uuid\");\n if (isLocalStorageAvailable) {\n try {\n window$1.localStorage.setItem(uuidKey, this.anonId);\n if (Object.keys(this.eventData).length >= 1) {\n window$1.localStorage.setItem(storageKey, JSON.stringify(this.eventData));\n }\n } catch (e) {\n warnOnce(\"Unable to write to LocalStorage\");\n }\n }\n };\n TelemetryEvent.prototype.processRequests = function processRequests(_) {\n };\n TelemetryEvent.prototype.postEvent = function postEvent(timestamp, additionalPayload, callback, customAccessToken) {\n var this$1 = this;\n if (!config.EVENTS_URL) {\n return;\n }\n var eventsUrlObject = parseUrl(config.EVENTS_URL);\n eventsUrlObject.params.push(\"access_token=\" + (customAccessToken || config.ACCESS_TOKEN || \"\"));\n var payload = {\n event: this.type,\n created: new Date(timestamp).toISOString(),\n sdkIdentifier: \"mapbox-gl-js\",\n sdkVersion: version,\n skuId: SKU_ID,\n userId: this.anonId\n };\n var finalPayload = additionalPayload ? extend2(payload, additionalPayload) : payload;\n var request = {\n url: formatUrl(eventsUrlObject),\n headers: { \"Content-Type\": \"text/plain\" },\n body: JSON.stringify([finalPayload])\n };\n this.pendingRequest = postData(request, function(error2) {\n this$1.pendingRequest = null;\n callback(error2);\n this$1.saveEventData();\n this$1.processRequests(customAccessToken);\n });\n };\n TelemetryEvent.prototype.queueRequest = function queueRequest(event, customAccessToken) {\n this.queue.push(event);\n this.processRequests(customAccessToken);\n };\n var MapLoadEvent = function(TelemetryEvent2) {\n function MapLoadEvent2() {\n TelemetryEvent2.call(this, \"map.load\");\n this.success = {};\n this.skuToken = \"\";\n }\n if (TelemetryEvent2)\n MapLoadEvent2.__proto__ = TelemetryEvent2;\n MapLoadEvent2.prototype = Object.create(TelemetryEvent2 && TelemetryEvent2.prototype);\n MapLoadEvent2.prototype.constructor = MapLoadEvent2;\n MapLoadEvent2.prototype.postMapLoadEvent = function postMapLoadEvent2(tileUrls, mapId, skuToken, customAccessToken) {\n this.skuToken = skuToken;\n if (config.EVENTS_URL && customAccessToken || config.ACCESS_TOKEN && Array.isArray(tileUrls) && tileUrls.some(function(url) {\n return isMapboxURL(url) || isMapboxHTTPURL(url);\n })) {\n this.queueRequest({\n id: mapId,\n timestamp: Date.now()\n }, customAccessToken);\n }\n };\n MapLoadEvent2.prototype.processRequests = function processRequests(customAccessToken) {\n var this$1 = this;\n if (this.pendingRequest || this.queue.length === 0) {\n return;\n }\n var ref = this.queue.shift();\n var id2 = ref.id;\n var timestamp = ref.timestamp;\n if (id2 && this.success[id2]) {\n return;\n }\n if (!this.anonId) {\n this.fetchEventData();\n }\n if (!validateUuid(this.anonId)) {\n this.anonId = uuid();\n }\n this.postEvent(timestamp, { skuToken: this.skuToken }, function(err) {\n if (!err) {\n if (id2) {\n this$1.success[id2] = true;\n }\n }\n }, customAccessToken);\n };\n return MapLoadEvent2;\n }(TelemetryEvent);\n var TurnstileEvent = function(TelemetryEvent2) {\n function TurnstileEvent2(customAccessToken) {\n TelemetryEvent2.call(this, \"appUserTurnstile\");\n this._customAccessToken = customAccessToken;\n }\n if (TelemetryEvent2)\n TurnstileEvent2.__proto__ = TelemetryEvent2;\n TurnstileEvent2.prototype = Object.create(TelemetryEvent2 && TelemetryEvent2.prototype);\n TurnstileEvent2.prototype.constructor = TurnstileEvent2;\n TurnstileEvent2.prototype.postTurnstileEvent = function postTurnstileEvent2(tileUrls, customAccessToken) {\n if (config.EVENTS_URL && config.ACCESS_TOKEN && Array.isArray(tileUrls) && tileUrls.some(function(url) {\n return isMapboxURL(url) || isMapboxHTTPURL(url);\n })) {\n this.queueRequest(Date.now(), customAccessToken);\n }\n };\n TurnstileEvent2.prototype.processRequests = function processRequests(customAccessToken) {\n var this$1 = this;\n if (this.pendingRequest || this.queue.length === 0) {\n return;\n }\n if (!this.anonId || !this.eventData.lastSuccess || !this.eventData.tokenU) {\n this.fetchEventData();\n }\n var tokenData = parseAccessToken(config.ACCESS_TOKEN);\n var tokenU = tokenData ? tokenData[\"u\"] : config.ACCESS_TOKEN;\n var dueForEvent = tokenU !== this.eventData.tokenU;\n if (!validateUuid(this.anonId)) {\n this.anonId = uuid();\n dueForEvent = true;\n }\n var nextUpdate = this.queue.shift();\n if (this.eventData.lastSuccess) {\n var lastUpdate = new Date(this.eventData.lastSuccess);\n var nextDate = new Date(nextUpdate);\n var daysElapsed = (nextUpdate - this.eventData.lastSuccess) / (24 * 60 * 60 * 1e3);\n dueForEvent = dueForEvent || daysElapsed >= 1 || daysElapsed < -1 || lastUpdate.getDate() !== nextDate.getDate();\n } else {\n dueForEvent = true;\n }\n if (!dueForEvent) {\n return this.processRequests();\n }\n this.postEvent(nextUpdate, { \"enabled.telemetry\": false }, function(err) {\n if (!err) {\n this$1.eventData.lastSuccess = nextUpdate;\n this$1.eventData.tokenU = tokenU;\n }\n }, customAccessToken);\n };\n return TurnstileEvent2;\n }(TelemetryEvent);\n var turnstileEvent_ = new TurnstileEvent();\n var postTurnstileEvent = turnstileEvent_.postTurnstileEvent.bind(turnstileEvent_);\n var mapLoadEvent_ = new MapLoadEvent();\n var postMapLoadEvent = mapLoadEvent_.postMapLoadEvent.bind(mapLoadEvent_);\n var CACHE_NAME = \"mapbox-tiles\";\n var cacheLimit = 500;\n var cacheCheckThreshold = 50;\n var MIN_TIME_UNTIL_EXPIRY = 1e3 * 60 * 7;\n var sharedCache;\n function cacheOpen() {\n if (window$1.caches && !sharedCache) {\n sharedCache = window$1.caches.open(CACHE_NAME);\n }\n }\n var responseConstructorSupportsReadableStream;\n function prepareBody(response, callback) {\n if (responseConstructorSupportsReadableStream === void 0) {\n try {\n new Response(new ReadableStream());\n responseConstructorSupportsReadableStream = true;\n } catch (e) {\n responseConstructorSupportsReadableStream = false;\n }\n }\n if (responseConstructorSupportsReadableStream) {\n callback(response.body);\n } else {\n response.blob().then(callback);\n }\n }\n function cachePut(request, response, requestTime) {\n cacheOpen();\n if (!sharedCache) {\n return;\n }\n var options = {\n status: response.status,\n statusText: response.statusText,\n headers: new window$1.Headers()\n };\n response.headers.forEach(function(v, k) {\n return options.headers.set(k, v);\n });\n var cacheControl = parseCacheControl(response.headers.get(\"Cache-Control\") || \"\");\n if (cacheControl[\"no-store\"]) {\n return;\n }\n if (cacheControl[\"max-age\"]) {\n options.headers.set(\"Expires\", new Date(requestTime + cacheControl[\"max-age\"] * 1e3).toUTCString());\n }\n var timeUntilExpiry = new Date(options.headers.get(\"Expires\")).getTime() - requestTime;\n if (timeUntilExpiry < MIN_TIME_UNTIL_EXPIRY) {\n return;\n }\n prepareBody(response, function(body) {\n var clonedResponse = new window$1.Response(body, options);\n cacheOpen();\n if (!sharedCache) {\n return;\n }\n sharedCache.then(function(cache) {\n return cache.put(stripQueryParameters(request.url), clonedResponse);\n }).catch(function(e) {\n return warnOnce(e.message);\n });\n });\n }\n function stripQueryParameters(url) {\n var start = url.indexOf(\"?\");\n return start < 0 ? url : url.slice(0, start);\n }\n function cacheGet(request, callback) {\n cacheOpen();\n if (!sharedCache) {\n return callback(null);\n }\n var strippedURL = stripQueryParameters(request.url);\n sharedCache.then(function(cache) {\n cache.match(strippedURL).then(function(response) {\n var fresh = isFresh(response);\n cache.delete(strippedURL);\n if (fresh) {\n cache.put(strippedURL, response.clone());\n }\n callback(null, response, fresh);\n }).catch(callback);\n }).catch(callback);\n }\n function isFresh(response) {\n if (!response) {\n return false;\n }\n var expires = new Date(response.headers.get(\"Expires\") || 0);\n var cacheControl = parseCacheControl(response.headers.get(\"Cache-Control\") || \"\");\n return expires > Date.now() && !cacheControl[\"no-cache\"];\n }\n var globalEntryCounter = Infinity;\n function cacheEntryPossiblyAdded(dispatcher) {\n globalEntryCounter++;\n if (globalEntryCounter > cacheCheckThreshold) {\n dispatcher.getActor().send(\"enforceCacheSizeLimit\", cacheLimit);\n globalEntryCounter = 0;\n }\n }\n function enforceCacheSizeLimit(limit) {\n cacheOpen();\n if (!sharedCache) {\n return;\n }\n sharedCache.then(function(cache) {\n cache.keys().then(function(keys) {\n for (var i = 0; i < keys.length - limit; i++) {\n cache.delete(keys[i]);\n }\n });\n });\n }\n function clearTileCache(callback) {\n var promise = window$1.caches.delete(CACHE_NAME);\n if (callback) {\n promise.catch(callback).then(function() {\n return callback();\n });\n }\n }\n function setCacheLimits(limit, checkThreshold) {\n cacheLimit = limit;\n cacheCheckThreshold = checkThreshold;\n }\n var supportsOffscreenCanvas;\n function offscreenCanvasSupported() {\n if (supportsOffscreenCanvas == null) {\n supportsOffscreenCanvas = window$1.OffscreenCanvas && new window$1.OffscreenCanvas(1, 1).getContext(\"2d\") && typeof window$1.createImageBitmap === \"function\";\n }\n return supportsOffscreenCanvas;\n }\n var ResourceType = {\n Unknown: \"Unknown\",\n Style: \"Style\",\n Source: \"Source\",\n Tile: \"Tile\",\n Glyphs: \"Glyphs\",\n SpriteImage: \"SpriteImage\",\n SpriteJSON: \"SpriteJSON\",\n Image: \"Image\"\n };\n if (typeof Object.freeze == \"function\") {\n Object.freeze(ResourceType);\n }\n var AJAXError = function(Error2) {\n function AJAXError2(message, status2, url) {\n if (status2 === 401 && isMapboxHTTPURL(url)) {\n message += \": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes\";\n }\n Error2.call(this, message);\n this.status = status2;\n this.url = url;\n this.name = this.constructor.name;\n this.message = message;\n }\n if (Error2)\n AJAXError2.__proto__ = Error2;\n AJAXError2.prototype = Object.create(Error2 && Error2.prototype);\n AJAXError2.prototype.constructor = AJAXError2;\n AJAXError2.prototype.toString = function toString2() {\n return this.name + \": \" + this.message + \" (\" + this.status + \"): \" + this.url;\n };\n return AJAXError2;\n }(Error);\n var getReferrer = isWorker() ? function() {\n return self.worker && self.worker.referrer;\n } : function() {\n return (window$1.location.protocol === \"blob:\" ? window$1.parent : window$1).location.href;\n };\n var isFileURL = function(url) {\n return /^file:/.test(url) || /^file:/.test(getReferrer()) && !/^\\w+:/.test(url);\n };\n function makeFetchRequest(requestParameters, callback) {\n var controller = new window$1.AbortController();\n var request = new window$1.Request(requestParameters.url, {\n method: requestParameters.method || \"GET\",\n body: requestParameters.body,\n credentials: requestParameters.credentials,\n headers: requestParameters.headers,\n referrer: getReferrer(),\n signal: controller.signal\n });\n var complete = false;\n var aborted = false;\n var cacheIgnoringSearch = hasCacheDefeatingSku(request.url);\n if (requestParameters.type === \"json\") {\n request.headers.set(\"Accept\", \"application/json\");\n }\n var validateOrFetch = function(err, cachedResponse, responseIsFresh) {\n if (aborted) {\n return;\n }\n if (err) {\n if (err.message !== \"SecurityError\") {\n warnOnce(err);\n }\n }\n if (cachedResponse && responseIsFresh) {\n return finishRequest(cachedResponse);\n }\n var requestTime = Date.now();\n window$1.fetch(request).then(function(response) {\n if (response.ok) {\n var cacheableResponse = cacheIgnoringSearch ? response.clone() : null;\n return finishRequest(response, cacheableResponse, requestTime);\n } else {\n return callback(new AJAXError(response.statusText, response.status, requestParameters.url));\n }\n }).catch(function(error2) {\n if (error2.code === 20) {\n return;\n }\n callback(new Error(error2.message));\n });\n };\n var finishRequest = function(response, cacheableResponse, requestTime) {\n (requestParameters.type === \"arrayBuffer\" ? response.arrayBuffer() : requestParameters.type === \"json\" ? response.json() : response.text()).then(function(result) {\n if (aborted) {\n return;\n }\n if (cacheableResponse && requestTime) {\n cachePut(request, cacheableResponse, requestTime);\n }\n complete = true;\n callback(null, result, response.headers.get(\"Cache-Control\"), response.headers.get(\"Expires\"));\n }).catch(function(err) {\n if (!aborted) {\n callback(new Error(err.message));\n }\n });\n };\n if (cacheIgnoringSearch) {\n cacheGet(request, validateOrFetch);\n } else {\n validateOrFetch(null, null);\n }\n return {\n cancel: function() {\n aborted = true;\n if (!complete) {\n controller.abort();\n }\n }\n };\n }\n function makeXMLHttpRequest(requestParameters, callback) {\n var xhr = new window$1.XMLHttpRequest();\n xhr.open(requestParameters.method || \"GET\", requestParameters.url, true);\n if (requestParameters.type === \"arrayBuffer\") {\n xhr.responseType = \"arraybuffer\";\n }\n for (var k in requestParameters.headers) {\n xhr.setRequestHeader(k, requestParameters.headers[k]);\n }\n if (requestParameters.type === \"json\") {\n xhr.responseType = \"text\";\n xhr.setRequestHeader(\"Accept\", \"application/json\");\n }\n xhr.withCredentials = requestParameters.credentials === \"include\";\n xhr.onerror = function() {\n callback(new Error(xhr.statusText));\n };\n xhr.onload = function() {\n if ((xhr.status >= 200 && xhr.status < 300 || xhr.status === 0) && xhr.response !== null) {\n var data = xhr.response;\n if (requestParameters.type === \"json\") {\n try {\n data = JSON.parse(xhr.response);\n } catch (err) {\n return callback(err);\n }\n }\n callback(null, data, xhr.getResponseHeader(\"Cache-Control\"), xhr.getResponseHeader(\"Expires\"));\n } else {\n callback(new AJAXError(xhr.statusText, xhr.status, requestParameters.url));\n }\n };\n xhr.send(requestParameters.body);\n return {\n cancel: function() {\n return xhr.abort();\n }\n };\n }\n var makeRequest = function(requestParameters, callback) {\n if (!isFileURL(requestParameters.url)) {\n if (window$1.fetch && window$1.Request && window$1.AbortController && window$1.Request.prototype.hasOwnProperty(\"signal\")) {\n return makeFetchRequest(requestParameters, callback);\n }\n if (isWorker() && self.worker && self.worker.actor) {\n var queueOnMainThread = true;\n return self.worker.actor.send(\"getResource\", requestParameters, callback, void 0, queueOnMainThread);\n }\n }\n return makeXMLHttpRequest(requestParameters, callback);\n };\n var getJSON = function(requestParameters, callback) {\n return makeRequest(extend2(requestParameters, { type: \"json\" }), callback);\n };\n var getArrayBuffer = function(requestParameters, callback) {\n return makeRequest(extend2(requestParameters, { type: \"arrayBuffer\" }), callback);\n };\n var postData = function(requestParameters, callback) {\n return makeRequest(extend2(requestParameters, { method: \"POST\" }), callback);\n };\n function sameOrigin(url) {\n var a = window$1.document.createElement(\"a\");\n a.href = url;\n return a.protocol === window$1.document.location.protocol && a.host === window$1.document.location.host;\n }\n var transparentPngUrl = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=\";\n function arrayBufferToImage(data, callback, cacheControl, expires) {\n var img = new window$1.Image();\n var URL2 = window$1.URL;\n img.onload = function() {\n callback(null, img);\n URL2.revokeObjectURL(img.src);\n img.onload = null;\n window$1.requestAnimationFrame(function() {\n img.src = transparentPngUrl;\n });\n };\n img.onerror = function() {\n return callback(new Error(\"Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.\"));\n };\n var blob = new window$1.Blob([new Uint8Array(data)], { type: \"image/png\" });\n img.cacheControl = cacheControl;\n img.expires = expires;\n img.src = data.byteLength ? URL2.createObjectURL(blob) : transparentPngUrl;\n }\n function arrayBufferToImageBitmap(data, callback) {\n var blob = new window$1.Blob([new Uint8Array(data)], { type: \"image/png\" });\n window$1.createImageBitmap(blob).then(function(imgBitmap) {\n callback(null, imgBitmap);\n }).catch(function(e) {\n callback(new Error(\"Could not load image because of \" + e.message + \". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.\"));\n });\n }\n var imageQueue, numImageRequests;\n var resetImageRequestQueue = function() {\n imageQueue = [];\n numImageRequests = 0;\n };\n resetImageRequestQueue();\n var getImage = function(requestParameters, callback) {\n if (exported$1.supported) {\n if (!requestParameters.headers) {\n requestParameters.headers = {};\n }\n requestParameters.headers.accept = \"image/webp,*/*\";\n }\n if (numImageRequests >= config.MAX_PARALLEL_IMAGE_REQUESTS) {\n var queued = {\n requestParameters,\n callback,\n cancelled: false,\n cancel: function cancel2() {\n this.cancelled = true;\n }\n };\n imageQueue.push(queued);\n return queued;\n }\n numImageRequests++;\n var advanced = false;\n var advanceImageRequestQueue = function() {\n if (advanced) {\n return;\n }\n advanced = true;\n numImageRequests--;\n while (imageQueue.length && numImageRequests < config.MAX_PARALLEL_IMAGE_REQUESTS) {\n var request2 = imageQueue.shift();\n var requestParameters2 = request2.requestParameters;\n var callback2 = request2.callback;\n var cancelled = request2.cancelled;\n if (!cancelled) {\n request2.cancel = getImage(requestParameters2, callback2).cancel;\n }\n }\n };\n var request = getArrayBuffer(requestParameters, function(err, data, cacheControl, expires) {\n advanceImageRequestQueue();\n if (err) {\n callback(err);\n } else if (data) {\n if (offscreenCanvasSupported()) {\n arrayBufferToImageBitmap(data, callback);\n } else {\n arrayBufferToImage(data, callback, cacheControl, expires);\n }\n }\n });\n return {\n cancel: function() {\n request.cancel();\n advanceImageRequestQueue();\n }\n };\n };\n var getVideo = function(urls, callback) {\n var video = window$1.document.createElement(\"video\");\n video.muted = true;\n video.onloadstart = function() {\n callback(null, video);\n };\n for (var i = 0; i < urls.length; i++) {\n var s = window$1.document.createElement(\"source\");\n if (!sameOrigin(urls[i])) {\n video.crossOrigin = \"Anonymous\";\n }\n s.src = urls[i];\n video.appendChild(s);\n }\n return {\n cancel: function() {\n }\n };\n };\n function _addEventListener(type, listener, listenerList) {\n var listenerExists = listenerList[type] && listenerList[type].indexOf(listener) !== -1;\n if (!listenerExists) {\n listenerList[type] = listenerList[type] || [];\n listenerList[type].push(listener);\n }\n }\n function _removeEventListener(type, listener, listenerList) {\n if (listenerList && listenerList[type]) {\n var index = listenerList[type].indexOf(listener);\n if (index !== -1) {\n listenerList[type].splice(index, 1);\n }\n }\n }\n var Event = function Event2(type, data) {\n if (data === void 0)\n data = {};\n extend2(this, data);\n this.type = type;\n };\n var ErrorEvent = function(Event2) {\n function ErrorEvent2(error2, data) {\n if (data === void 0)\n data = {};\n Event2.call(this, \"error\", extend2({ error: error2 }, data));\n }\n if (Event2)\n ErrorEvent2.__proto__ = Event2;\n ErrorEvent2.prototype = Object.create(Event2 && Event2.prototype);\n ErrorEvent2.prototype.constructor = ErrorEvent2;\n return ErrorEvent2;\n }(Event);\n var Evented = function Evented2() {\n };\n Evented.prototype.on = function on(type, listener) {\n this._listeners = this._listeners || {};\n _addEventListener(type, listener, this._listeners);\n return this;\n };\n Evented.prototype.off = function off(type, listener) {\n _removeEventListener(type, listener, this._listeners);\n _removeEventListener(type, listener, this._oneTimeListeners);\n return this;\n };\n Evented.prototype.once = function once(type, listener) {\n this._oneTimeListeners = this._oneTimeListeners || {};\n _addEventListener(type, listener, this._oneTimeListeners);\n return this;\n };\n Evented.prototype.fire = function fire(event, properties2) {\n if (typeof event === \"string\") {\n event = new Event(event, properties2 || {});\n }\n var type = event.type;\n if (this.listens(type)) {\n event.target = this;\n var listeners = this._listeners && this._listeners[type] ? this._listeners[type].slice() : [];\n for (var i = 0, list = listeners; i < list.length; i += 1) {\n var listener = list[i];\n listener.call(this, event);\n }\n var oneTimeListeners = this._oneTimeListeners && this._oneTimeListeners[type] ? this._oneTimeListeners[type].slice() : [];\n for (var i$1 = 0, list$1 = oneTimeListeners; i$1 < list$1.length; i$1 += 1) {\n var listener$1 = list$1[i$1];\n _removeEventListener(type, listener$1, this._oneTimeListeners);\n listener$1.call(this, event);\n }\n var parent = this._eventedParent;\n if (parent) {\n extend2(event, typeof this._eventedParentData === \"function\" ? this._eventedParentData() : this._eventedParentData);\n parent.fire(event);\n }\n } else if (event instanceof ErrorEvent) {\n console.error(event.error);\n }\n return this;\n };\n Evented.prototype.listens = function listens(type) {\n return this._listeners && this._listeners[type] && this._listeners[type].length > 0 || this._oneTimeListeners && this._oneTimeListeners[type] && this._oneTimeListeners[type].length > 0 || this._eventedParent && this._eventedParent.listens(type);\n };\n Evented.prototype.setEventedParent = function setEventedParent(parent, data) {\n this._eventedParent = parent;\n this._eventedParentData = data;\n return this;\n };\n var $version = 8;\n var $root = {\n version: {\n required: true,\n type: \"enum\",\n values: [\n 8\n ]\n },\n name: {\n type: \"string\"\n },\n metadata: {\n type: \"*\"\n },\n center: {\n type: \"array\",\n value: \"number\"\n },\n zoom: {\n type: \"number\"\n },\n bearing: {\n type: \"number\",\n \"default\": 0,\n period: 360,\n units: \"degrees\"\n },\n pitch: {\n type: \"number\",\n \"default\": 0,\n units: \"degrees\"\n },\n light: {\n type: \"light\"\n },\n sources: {\n required: true,\n type: \"sources\"\n },\n sprite: {\n type: \"string\"\n },\n glyphs: {\n type: \"string\"\n },\n transition: {\n type: \"transition\"\n },\n layers: {\n required: true,\n type: \"array\",\n value: \"layer\"\n }\n };\n var sources = {\n \"*\": {\n type: \"source\"\n }\n };\n var source = [\n \"source_vector\",\n \"source_raster\",\n \"source_raster_dem\",\n \"source_geojson\",\n \"source_video\",\n \"source_image\"\n ];\n var source_vector = {\n type: {\n required: true,\n type: \"enum\",\n values: {\n vector: {}\n }\n },\n url: {\n type: \"string\"\n },\n tiles: {\n type: \"array\",\n value: \"string\"\n },\n bounds: {\n type: \"array\",\n value: \"number\",\n length: 4,\n \"default\": [\n -180,\n -85.051129,\n 180,\n 85.051129\n ]\n },\n scheme: {\n type: \"enum\",\n values: {\n xyz: {},\n tms: {}\n },\n \"default\": \"xyz\"\n },\n minzoom: {\n type: \"number\",\n \"default\": 0\n },\n maxzoom: {\n type: \"number\",\n \"default\": 22\n },\n attribution: {\n type: \"string\"\n },\n promoteId: {\n type: \"promoteId\"\n },\n volatile: {\n type: \"boolean\",\n \"default\": false\n },\n \"*\": {\n type: \"*\"\n }\n };\n var source_raster = {\n type: {\n required: true,\n type: \"enum\",\n values: {\n raster: {}\n }\n },\n url: {\n type: \"string\"\n },\n tiles: {\n type: \"array\",\n value: \"string\"\n },\n bounds: {\n type: \"array\",\n value: \"number\",\n length: 4,\n \"default\": [\n -180,\n -85.051129,\n 180,\n 85.051129\n ]\n },\n minzoom: {\n type: \"number\",\n \"default\": 0\n },\n maxzoom: {\n type: \"number\",\n \"default\": 22\n },\n tileSize: {\n type: \"number\",\n \"default\": 512,\n units: \"pixels\"\n },\n scheme: {\n type: \"enum\",\n values: {\n xyz: {},\n tms: {}\n },\n \"default\": \"xyz\"\n },\n attribution: {\n type: \"string\"\n },\n volatile: {\n type: \"boolean\",\n \"default\": false\n },\n \"*\": {\n type: \"*\"\n }\n };\n var source_raster_dem = {\n type: {\n required: true,\n type: \"enum\",\n values: {\n \"raster-dem\": {}\n }\n },\n url: {\n type: \"string\"\n },\n tiles: {\n type: \"array\",\n value: \"string\"\n },\n bounds: {\n type: \"array\",\n value: \"number\",\n length: 4,\n \"default\": [\n -180,\n -85.051129,\n 180,\n 85.051129\n ]\n },\n minzoom: {\n type: \"number\",\n \"default\": 0\n },\n maxzoom: {\n type: \"number\",\n \"default\": 22\n },\n tileSize: {\n type: \"number\",\n \"default\": 512,\n units: \"pixels\"\n },\n attribution: {\n type: \"string\"\n },\n encoding: {\n type: \"enum\",\n values: {\n terrarium: {},\n mapbox: {}\n },\n \"default\": \"mapbox\"\n },\n volatile: {\n type: \"boolean\",\n \"default\": false\n },\n \"*\": {\n type: \"*\"\n }\n };\n var source_geojson = {\n type: {\n required: true,\n type: \"enum\",\n values: {\n geojson: {}\n }\n },\n data: {\n type: \"*\"\n },\n maxzoom: {\n type: \"number\",\n \"default\": 18\n },\n attribution: {\n type: \"string\"\n },\n buffer: {\n type: \"number\",\n \"default\": 128,\n maximum: 512,\n minimum: 0\n },\n filter: {\n type: \"*\"\n },\n tolerance: {\n type: \"number\",\n \"default\": 0.375\n },\n cluster: {\n type: \"boolean\",\n \"default\": false\n },\n clusterRadius: {\n type: \"number\",\n \"default\": 50,\n minimum: 0\n },\n clusterMaxZoom: {\n type: \"number\"\n },\n clusterMinPoints: {\n type: \"number\"\n },\n clusterProperties: {\n type: \"*\"\n },\n lineMetrics: {\n type: \"boolean\",\n \"default\": false\n },\n generateId: {\n type: \"boolean\",\n \"default\": false\n },\n promoteId: {\n type: \"promoteId\"\n }\n };\n var source_video = {\n type: {\n required: true,\n type: \"enum\",\n values: {\n video: {}\n }\n },\n urls: {\n required: true,\n type: \"array\",\n value: \"string\"\n },\n coordinates: {\n required: true,\n type: \"array\",\n length: 4,\n value: {\n type: \"array\",\n length: 2,\n value: \"number\"\n }\n }\n };\n var source_image = {\n type: {\n required: true,\n type: \"enum\",\n values: {\n image: {}\n }\n },\n url: {\n required: true,\n type: \"string\"\n },\n coordinates: {\n required: true,\n type: \"array\",\n length: 4,\n value: {\n type: \"array\",\n length: 2,\n value: \"number\"\n }\n }\n };\n var layer = {\n id: {\n type: \"string\",\n required: true\n },\n type: {\n type: \"enum\",\n values: {\n fill: {},\n line: {},\n symbol: {},\n circle: {},\n heatmap: {},\n \"fill-extrusion\": {},\n raster: {},\n hillshade: {},\n background: {}\n },\n required: true\n },\n metadata: {\n type: \"*\"\n },\n source: {\n type: \"string\"\n },\n \"source-layer\": {\n type: \"string\"\n },\n minzoom: {\n type: \"number\",\n minimum: 0,\n maximum: 24\n },\n maxzoom: {\n type: \"number\",\n minimum: 0,\n maximum: 24\n },\n filter: {\n type: \"filter\"\n },\n layout: {\n type: \"layout\"\n },\n paint: {\n type: \"paint\"\n }\n };\n var layout = [\n \"layout_fill\",\n \"layout_line\",\n \"layout_circle\",\n \"layout_heatmap\",\n \"layout_fill-extrusion\",\n \"layout_symbol\",\n \"layout_raster\",\n \"layout_hillshade\",\n \"layout_background\"\n ];\n var layout_background = {\n visibility: {\n type: \"enum\",\n values: {\n visible: {},\n none: {}\n },\n \"default\": \"visible\",\n \"property-type\": \"constant\"\n }\n };\n var layout_fill = {\n \"fill-sort-key\": {\n type: \"number\",\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n visibility: {\n type: \"enum\",\n values: {\n visible: {},\n none: {}\n },\n \"default\": \"visible\",\n \"property-type\": \"constant\"\n }\n };\n var layout_circle = {\n \"circle-sort-key\": {\n type: \"number\",\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n visibility: {\n type: \"enum\",\n values: {\n visible: {},\n none: {}\n },\n \"default\": \"visible\",\n \"property-type\": \"constant\"\n }\n };\n var layout_heatmap = {\n visibility: {\n type: \"enum\",\n values: {\n visible: {},\n none: {}\n },\n \"default\": \"visible\",\n \"property-type\": \"constant\"\n }\n };\n var layout_line = {\n \"line-cap\": {\n type: \"enum\",\n values: {\n butt: {},\n round: {},\n square: {}\n },\n \"default\": \"butt\",\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"line-join\": {\n type: \"enum\",\n values: {\n bevel: {},\n round: {},\n miter: {}\n },\n \"default\": \"miter\",\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"line-miter-limit\": {\n type: \"number\",\n \"default\": 2,\n requires: [\n {\n \"line-join\": \"miter\"\n }\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"line-round-limit\": {\n type: \"number\",\n \"default\": 1.05,\n requires: [\n {\n \"line-join\": \"round\"\n }\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"line-sort-key\": {\n type: \"number\",\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n visibility: {\n type: \"enum\",\n values: {\n visible: {},\n none: {}\n },\n \"default\": \"visible\",\n \"property-type\": \"constant\"\n }\n };\n var layout_symbol = {\n \"symbol-placement\": {\n type: \"enum\",\n values: {\n point: {},\n line: {},\n \"line-center\": {}\n },\n \"default\": \"point\",\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"symbol-spacing\": {\n type: \"number\",\n \"default\": 250,\n minimum: 1,\n units: \"pixels\",\n requires: [\n {\n \"symbol-placement\": \"line\"\n }\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"symbol-avoid-edges\": {\n type: \"boolean\",\n \"default\": false,\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"symbol-sort-key\": {\n type: \"number\",\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"symbol-z-order\": {\n type: \"enum\",\n values: {\n auto: {},\n \"viewport-y\": {},\n source: {}\n },\n \"default\": \"auto\",\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"icon-allow-overlap\": {\n type: \"boolean\",\n \"default\": false,\n requires: [\n \"icon-image\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"icon-ignore-placement\": {\n type: \"boolean\",\n \"default\": false,\n requires: [\n \"icon-image\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"icon-optional\": {\n type: \"boolean\",\n \"default\": false,\n requires: [\n \"icon-image\",\n \"text-field\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"icon-rotation-alignment\": {\n type: \"enum\",\n values: {\n map: {},\n viewport: {},\n auto: {}\n },\n \"default\": \"auto\",\n requires: [\n \"icon-image\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"icon-size\": {\n type: \"number\",\n \"default\": 1,\n minimum: 0,\n units: \"factor of the original icon size\",\n requires: [\n \"icon-image\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"icon-text-fit\": {\n type: \"enum\",\n values: {\n none: {},\n width: {},\n height: {},\n both: {}\n },\n \"default\": \"none\",\n requires: [\n \"icon-image\",\n \"text-field\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"icon-text-fit-padding\": {\n type: \"array\",\n value: \"number\",\n length: 4,\n \"default\": [\n 0,\n 0,\n 0,\n 0\n ],\n units: \"pixels\",\n requires: [\n \"icon-image\",\n \"text-field\",\n {\n \"icon-text-fit\": [\n \"both\",\n \"width\",\n \"height\"\n ]\n }\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"icon-image\": {\n type: \"resolvedImage\",\n tokens: true,\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"icon-rotate\": {\n type: \"number\",\n \"default\": 0,\n period: 360,\n units: \"degrees\",\n requires: [\n \"icon-image\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"icon-padding\": {\n type: \"number\",\n \"default\": 2,\n minimum: 0,\n units: \"pixels\",\n requires: [\n \"icon-image\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"icon-keep-upright\": {\n type: \"boolean\",\n \"default\": false,\n requires: [\n \"icon-image\",\n {\n \"icon-rotation-alignment\": \"map\"\n },\n {\n \"symbol-placement\": [\n \"line\",\n \"line-center\"\n ]\n }\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"icon-offset\": {\n type: \"array\",\n value: \"number\",\n length: 2,\n \"default\": [\n 0,\n 0\n ],\n requires: [\n \"icon-image\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"icon-anchor\": {\n type: \"enum\",\n values: {\n center: {},\n left: {},\n right: {},\n top: {},\n bottom: {},\n \"top-left\": {},\n \"top-right\": {},\n \"bottom-left\": {},\n \"bottom-right\": {}\n },\n \"default\": \"center\",\n requires: [\n \"icon-image\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"icon-pitch-alignment\": {\n type: \"enum\",\n values: {\n map: {},\n viewport: {},\n auto: {}\n },\n \"default\": \"auto\",\n requires: [\n \"icon-image\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"text-pitch-alignment\": {\n type: \"enum\",\n values: {\n map: {},\n viewport: {},\n auto: {}\n },\n \"default\": \"auto\",\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"text-rotation-alignment\": {\n type: \"enum\",\n values: {\n map: {},\n viewport: {},\n auto: {}\n },\n \"default\": \"auto\",\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"text-field\": {\n type: \"formatted\",\n \"default\": \"\",\n tokens: true,\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"text-font\": {\n type: \"array\",\n value: \"string\",\n \"default\": [\n \"Open Sans Regular\",\n \"Arial Unicode MS Regular\"\n ],\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"text-size\": {\n type: \"number\",\n \"default\": 16,\n minimum: 0,\n units: \"pixels\",\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"text-max-width\": {\n type: \"number\",\n \"default\": 10,\n minimum: 0,\n units: \"ems\",\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"text-line-height\": {\n type: \"number\",\n \"default\": 1.2,\n units: \"ems\",\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"text-letter-spacing\": {\n type: \"number\",\n \"default\": 0,\n units: \"ems\",\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"text-justify\": {\n type: \"enum\",\n values: {\n auto: {},\n left: {},\n center: {},\n right: {}\n },\n \"default\": \"center\",\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"text-radial-offset\": {\n type: \"number\",\n units: \"ems\",\n \"default\": 0,\n requires: [\n \"text-field\"\n ],\n \"property-type\": \"data-driven\",\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n }\n },\n \"text-variable-anchor\": {\n type: \"array\",\n value: \"enum\",\n values: {\n center: {},\n left: {},\n right: {},\n top: {},\n bottom: {},\n \"top-left\": {},\n \"top-right\": {},\n \"bottom-left\": {},\n \"bottom-right\": {}\n },\n requires: [\n \"text-field\",\n {\n \"symbol-placement\": [\n \"point\"\n ]\n }\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"text-anchor\": {\n type: \"enum\",\n values: {\n center: {},\n left: {},\n right: {},\n top: {},\n bottom: {},\n \"top-left\": {},\n \"top-right\": {},\n \"bottom-left\": {},\n \"bottom-right\": {}\n },\n \"default\": \"center\",\n requires: [\n \"text-field\",\n {\n \"!\": \"text-variable-anchor\"\n }\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"text-max-angle\": {\n type: \"number\",\n \"default\": 45,\n units: \"degrees\",\n requires: [\n \"text-field\",\n {\n \"symbol-placement\": [\n \"line\",\n \"line-center\"\n ]\n }\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"text-writing-mode\": {\n type: \"array\",\n value: \"enum\",\n values: {\n horizontal: {},\n vertical: {}\n },\n requires: [\n \"text-field\",\n {\n \"symbol-placement\": [\n \"point\"\n ]\n }\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"text-rotate\": {\n type: \"number\",\n \"default\": 0,\n period: 360,\n units: \"degrees\",\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"text-padding\": {\n type: \"number\",\n \"default\": 2,\n minimum: 0,\n units: \"pixels\",\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"text-keep-upright\": {\n type: \"boolean\",\n \"default\": true,\n requires: [\n \"text-field\",\n {\n \"text-rotation-alignment\": \"map\"\n },\n {\n \"symbol-placement\": [\n \"line\",\n \"line-center\"\n ]\n }\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"text-transform\": {\n type: \"enum\",\n values: {\n none: {},\n uppercase: {},\n lowercase: {}\n },\n \"default\": \"none\",\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"text-offset\": {\n type: \"array\",\n value: \"number\",\n units: \"ems\",\n length: 2,\n \"default\": [\n 0,\n 0\n ],\n requires: [\n \"text-field\",\n {\n \"!\": \"text-radial-offset\"\n }\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"text-allow-overlap\": {\n type: \"boolean\",\n \"default\": false,\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"text-ignore-placement\": {\n type: \"boolean\",\n \"default\": false,\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"text-optional\": {\n type: \"boolean\",\n \"default\": false,\n requires: [\n \"text-field\",\n \"icon-image\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n visibility: {\n type: \"enum\",\n values: {\n visible: {},\n none: {}\n },\n \"default\": \"visible\",\n \"property-type\": \"constant\"\n }\n };\n var layout_raster = {\n visibility: {\n type: \"enum\",\n values: {\n visible: {},\n none: {}\n },\n \"default\": \"visible\",\n \"property-type\": \"constant\"\n }\n };\n var layout_hillshade = {\n visibility: {\n type: \"enum\",\n values: {\n visible: {},\n none: {}\n },\n \"default\": \"visible\",\n \"property-type\": \"constant\"\n }\n };\n var filter = {\n type: \"array\",\n value: \"*\"\n };\n var filter_operator = {\n type: \"enum\",\n values: {\n \"==\": {},\n \"!=\": {},\n \">\": {},\n \">=\": {},\n \"<\": {},\n \"<=\": {},\n \"in\": {},\n \"!in\": {},\n all: {},\n any: {},\n none: {},\n has: {},\n \"!has\": {},\n within: {}\n }\n };\n var geometry_type = {\n type: \"enum\",\n values: {\n Point: {},\n LineString: {},\n Polygon: {}\n }\n };\n var function_stop = {\n type: \"array\",\n minimum: 0,\n maximum: 24,\n value: [\n \"number\",\n \"color\"\n ],\n length: 2\n };\n var expression = {\n type: \"array\",\n value: \"*\",\n minimum: 1\n };\n var light = {\n anchor: {\n type: \"enum\",\n \"default\": \"viewport\",\n values: {\n map: {},\n viewport: {}\n },\n \"property-type\": \"data-constant\",\n transition: false,\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n }\n },\n position: {\n type: \"array\",\n \"default\": [\n 1.15,\n 210,\n 30\n ],\n length: 3,\n value: \"number\",\n \"property-type\": \"data-constant\",\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n }\n },\n color: {\n type: \"color\",\n \"property-type\": \"data-constant\",\n \"default\": \"#ffffff\",\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n transition: true\n },\n intensity: {\n type: \"number\",\n \"property-type\": \"data-constant\",\n \"default\": 0.5,\n minimum: 0,\n maximum: 1,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n transition: true\n }\n };\n var paint = [\n \"paint_fill\",\n \"paint_line\",\n \"paint_circle\",\n \"paint_heatmap\",\n \"paint_fill-extrusion\",\n \"paint_symbol\",\n \"paint_raster\",\n \"paint_hillshade\",\n \"paint_background\"\n ];\n var paint_fill = {\n \"fill-antialias\": {\n type: \"boolean\",\n \"default\": true,\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"fill-opacity\": {\n type: \"number\",\n \"default\": 1,\n minimum: 0,\n maximum: 1,\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"fill-color\": {\n type: \"color\",\n \"default\": \"#000000\",\n transition: true,\n requires: [\n {\n \"!\": \"fill-pattern\"\n }\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"fill-outline-color\": {\n type: \"color\",\n transition: true,\n requires: [\n {\n \"!\": \"fill-pattern\"\n },\n {\n \"fill-antialias\": true\n }\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"fill-translate\": {\n type: \"array\",\n value: \"number\",\n length: 2,\n \"default\": [\n 0,\n 0\n ],\n transition: true,\n units: \"pixels\",\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"fill-translate-anchor\": {\n type: \"enum\",\n values: {\n map: {},\n viewport: {}\n },\n \"default\": \"map\",\n requires: [\n \"fill-translate\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"fill-pattern\": {\n type: \"resolvedImage\",\n transition: true,\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"cross-faded-data-driven\"\n }\n };\n var paint_line = {\n \"line-opacity\": {\n type: \"number\",\n \"default\": 1,\n minimum: 0,\n maximum: 1,\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"line-color\": {\n type: \"color\",\n \"default\": \"#000000\",\n transition: true,\n requires: [\n {\n \"!\": \"line-pattern\"\n }\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"line-translate\": {\n type: \"array\",\n value: \"number\",\n length: 2,\n \"default\": [\n 0,\n 0\n ],\n transition: true,\n units: \"pixels\",\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"line-translate-anchor\": {\n type: \"enum\",\n values: {\n map: {},\n viewport: {}\n },\n \"default\": \"map\",\n requires: [\n \"line-translate\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"line-width\": {\n type: \"number\",\n \"default\": 1,\n minimum: 0,\n transition: true,\n units: \"pixels\",\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"line-gap-width\": {\n type: \"number\",\n \"default\": 0,\n minimum: 0,\n transition: true,\n units: \"pixels\",\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"line-offset\": {\n type: \"number\",\n \"default\": 0,\n transition: true,\n units: \"pixels\",\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"line-blur\": {\n type: \"number\",\n \"default\": 0,\n minimum: 0,\n transition: true,\n units: \"pixels\",\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"line-dasharray\": {\n type: \"array\",\n value: \"number\",\n minimum: 0,\n transition: true,\n units: \"line widths\",\n requires: [\n {\n \"!\": \"line-pattern\"\n }\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"cross-faded\"\n },\n \"line-pattern\": {\n type: \"resolvedImage\",\n transition: true,\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"cross-faded-data-driven\"\n },\n \"line-gradient\": {\n type: \"color\",\n transition: false,\n requires: [\n {\n \"!\": \"line-dasharray\"\n },\n {\n \"!\": \"line-pattern\"\n },\n {\n source: \"geojson\",\n has: {\n lineMetrics: true\n }\n }\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"line-progress\"\n ]\n },\n \"property-type\": \"color-ramp\"\n }\n };\n var paint_circle = {\n \"circle-radius\": {\n type: \"number\",\n \"default\": 5,\n minimum: 0,\n transition: true,\n units: \"pixels\",\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"circle-color\": {\n type: \"color\",\n \"default\": \"#000000\",\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"circle-blur\": {\n type: \"number\",\n \"default\": 0,\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"circle-opacity\": {\n type: \"number\",\n \"default\": 1,\n minimum: 0,\n maximum: 1,\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"circle-translate\": {\n type: \"array\",\n value: \"number\",\n length: 2,\n \"default\": [\n 0,\n 0\n ],\n transition: true,\n units: \"pixels\",\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"circle-translate-anchor\": {\n type: \"enum\",\n values: {\n map: {},\n viewport: {}\n },\n \"default\": \"map\",\n requires: [\n \"circle-translate\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"circle-pitch-scale\": {\n type: \"enum\",\n values: {\n map: {},\n viewport: {}\n },\n \"default\": \"map\",\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"circle-pitch-alignment\": {\n type: \"enum\",\n values: {\n map: {},\n viewport: {}\n },\n \"default\": \"viewport\",\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"circle-stroke-width\": {\n type: \"number\",\n \"default\": 0,\n minimum: 0,\n transition: true,\n units: \"pixels\",\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"circle-stroke-color\": {\n type: \"color\",\n \"default\": \"#000000\",\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"circle-stroke-opacity\": {\n type: \"number\",\n \"default\": 1,\n minimum: 0,\n maximum: 1,\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n }\n };\n var paint_heatmap = {\n \"heatmap-radius\": {\n type: \"number\",\n \"default\": 30,\n minimum: 1,\n transition: true,\n units: \"pixels\",\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"heatmap-weight\": {\n type: \"number\",\n \"default\": 1,\n minimum: 0,\n transition: false,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"heatmap-intensity\": {\n type: \"number\",\n \"default\": 1,\n minimum: 0,\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"heatmap-color\": {\n type: \"color\",\n \"default\": [\n \"interpolate\",\n [\n \"linear\"\n ],\n [\n \"heatmap-density\"\n ],\n 0,\n \"rgba(0, 0, 255, 0)\",\n 0.1,\n \"royalblue\",\n 0.3,\n \"cyan\",\n 0.5,\n \"lime\",\n 0.7,\n \"yellow\",\n 1,\n \"red\"\n ],\n transition: false,\n expression: {\n interpolated: true,\n parameters: [\n \"heatmap-density\"\n ]\n },\n \"property-type\": \"color-ramp\"\n },\n \"heatmap-opacity\": {\n type: \"number\",\n \"default\": 1,\n minimum: 0,\n maximum: 1,\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n }\n };\n var paint_symbol = {\n \"icon-opacity\": {\n type: \"number\",\n \"default\": 1,\n minimum: 0,\n maximum: 1,\n transition: true,\n requires: [\n \"icon-image\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"icon-color\": {\n type: \"color\",\n \"default\": \"#000000\",\n transition: true,\n requires: [\n \"icon-image\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"icon-halo-color\": {\n type: \"color\",\n \"default\": \"rgba(0, 0, 0, 0)\",\n transition: true,\n requires: [\n \"icon-image\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"icon-halo-width\": {\n type: \"number\",\n \"default\": 0,\n minimum: 0,\n transition: true,\n units: \"pixels\",\n requires: [\n \"icon-image\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"icon-halo-blur\": {\n type: \"number\",\n \"default\": 0,\n minimum: 0,\n transition: true,\n units: \"pixels\",\n requires: [\n \"icon-image\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"icon-translate\": {\n type: \"array\",\n value: \"number\",\n length: 2,\n \"default\": [\n 0,\n 0\n ],\n transition: true,\n units: \"pixels\",\n requires: [\n \"icon-image\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"icon-translate-anchor\": {\n type: \"enum\",\n values: {\n map: {},\n viewport: {}\n },\n \"default\": \"map\",\n requires: [\n \"icon-image\",\n \"icon-translate\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"text-opacity\": {\n type: \"number\",\n \"default\": 1,\n minimum: 0,\n maximum: 1,\n transition: true,\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"text-color\": {\n type: \"color\",\n \"default\": \"#000000\",\n transition: true,\n overridable: true,\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"text-halo-color\": {\n type: \"color\",\n \"default\": \"rgba(0, 0, 0, 0)\",\n transition: true,\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"text-halo-width\": {\n type: \"number\",\n \"default\": 0,\n minimum: 0,\n transition: true,\n units: \"pixels\",\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"text-halo-blur\": {\n type: \"number\",\n \"default\": 0,\n minimum: 0,\n transition: true,\n units: \"pixels\",\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"text-translate\": {\n type: \"array\",\n value: \"number\",\n length: 2,\n \"default\": [\n 0,\n 0\n ],\n transition: true,\n units: \"pixels\",\n requires: [\n \"text-field\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"text-translate-anchor\": {\n type: \"enum\",\n values: {\n map: {},\n viewport: {}\n },\n \"default\": \"map\",\n requires: [\n \"text-field\",\n \"text-translate\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n }\n };\n var paint_raster = {\n \"raster-opacity\": {\n type: \"number\",\n \"default\": 1,\n minimum: 0,\n maximum: 1,\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"raster-hue-rotate\": {\n type: \"number\",\n \"default\": 0,\n period: 360,\n transition: true,\n units: \"degrees\",\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"raster-brightness-min\": {\n type: \"number\",\n \"default\": 0,\n minimum: 0,\n maximum: 1,\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"raster-brightness-max\": {\n type: \"number\",\n \"default\": 1,\n minimum: 0,\n maximum: 1,\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"raster-saturation\": {\n type: \"number\",\n \"default\": 0,\n minimum: -1,\n maximum: 1,\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"raster-contrast\": {\n type: \"number\",\n \"default\": 0,\n minimum: -1,\n maximum: 1,\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"raster-resampling\": {\n type: \"enum\",\n values: {\n linear: {},\n nearest: {}\n },\n \"default\": \"linear\",\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"raster-fade-duration\": {\n type: \"number\",\n \"default\": 300,\n minimum: 0,\n transition: false,\n units: \"milliseconds\",\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n }\n };\n var paint_hillshade = {\n \"hillshade-illumination-direction\": {\n type: \"number\",\n \"default\": 335,\n minimum: 0,\n maximum: 359,\n transition: false,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"hillshade-illumination-anchor\": {\n type: \"enum\",\n values: {\n map: {},\n viewport: {}\n },\n \"default\": \"viewport\",\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"hillshade-exaggeration\": {\n type: \"number\",\n \"default\": 0.5,\n minimum: 0,\n maximum: 1,\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"hillshade-shadow-color\": {\n type: \"color\",\n \"default\": \"#000000\",\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"hillshade-highlight-color\": {\n type: \"color\",\n \"default\": \"#FFFFFF\",\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"hillshade-accent-color\": {\n type: \"color\",\n \"default\": \"#000000\",\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n }\n };\n var paint_background = {\n \"background-color\": {\n type: \"color\",\n \"default\": \"#000000\",\n transition: true,\n requires: [\n {\n \"!\": \"background-pattern\"\n }\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"background-pattern\": {\n type: \"resolvedImage\",\n transition: true,\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"cross-faded\"\n },\n \"background-opacity\": {\n type: \"number\",\n \"default\": 1,\n minimum: 0,\n maximum: 1,\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n }\n };\n var transition = {\n duration: {\n type: \"number\",\n \"default\": 300,\n minimum: 0,\n units: \"milliseconds\"\n },\n delay: {\n type: \"number\",\n \"default\": 0,\n minimum: 0,\n units: \"milliseconds\"\n }\n };\n var promoteId = {\n \"*\": {\n type: \"string\"\n }\n };\n var spec = {\n $version,\n $root,\n sources,\n source,\n source_vector,\n source_raster,\n source_raster_dem,\n source_geojson,\n source_video,\n source_image,\n layer,\n layout,\n layout_background,\n layout_fill,\n layout_circle,\n layout_heatmap,\n \"layout_fill-extrusion\": {\n visibility: {\n type: \"enum\",\n values: {\n visible: {},\n none: {}\n },\n \"default\": \"visible\",\n \"property-type\": \"constant\"\n }\n },\n layout_line,\n layout_symbol,\n layout_raster,\n layout_hillshade,\n filter,\n filter_operator,\n geometry_type,\n \"function\": {\n expression: {\n type: \"expression\"\n },\n stops: {\n type: \"array\",\n value: \"function_stop\"\n },\n base: {\n type: \"number\",\n \"default\": 1,\n minimum: 0\n },\n property: {\n type: \"string\",\n \"default\": \"$zoom\"\n },\n type: {\n type: \"enum\",\n values: {\n identity: {},\n exponential: {},\n interval: {},\n categorical: {}\n },\n \"default\": \"exponential\"\n },\n colorSpace: {\n type: \"enum\",\n values: {\n rgb: {},\n lab: {},\n hcl: {}\n },\n \"default\": \"rgb\"\n },\n \"default\": {\n type: \"*\",\n required: false\n }\n },\n function_stop,\n expression,\n light,\n paint,\n paint_fill,\n \"paint_fill-extrusion\": {\n \"fill-extrusion-opacity\": {\n type: \"number\",\n \"default\": 1,\n minimum: 0,\n maximum: 1,\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"fill-extrusion-color\": {\n type: \"color\",\n \"default\": \"#000000\",\n transition: true,\n requires: [\n {\n \"!\": \"fill-extrusion-pattern\"\n }\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"fill-extrusion-translate\": {\n type: \"array\",\n value: \"number\",\n length: 2,\n \"default\": [\n 0,\n 0\n ],\n transition: true,\n units: \"pixels\",\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"fill-extrusion-translate-anchor\": {\n type: \"enum\",\n values: {\n map: {},\n viewport: {}\n },\n \"default\": \"map\",\n requires: [\n \"fill-extrusion-translate\"\n ],\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n },\n \"fill-extrusion-pattern\": {\n type: \"resolvedImage\",\n transition: true,\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\",\n \"feature\"\n ]\n },\n \"property-type\": \"cross-faded-data-driven\"\n },\n \"fill-extrusion-height\": {\n type: \"number\",\n \"default\": 0,\n minimum: 0,\n units: \"meters\",\n transition: true,\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"fill-extrusion-base\": {\n type: \"number\",\n \"default\": 0,\n minimum: 0,\n units: \"meters\",\n transition: true,\n requires: [\n \"fill-extrusion-height\"\n ],\n expression: {\n interpolated: true,\n parameters: [\n \"zoom\",\n \"feature\",\n \"feature-state\"\n ]\n },\n \"property-type\": \"data-driven\"\n },\n \"fill-extrusion-vertical-gradient\": {\n type: \"boolean\",\n \"default\": true,\n transition: false,\n expression: {\n interpolated: false,\n parameters: [\n \"zoom\"\n ]\n },\n \"property-type\": \"data-constant\"\n }\n },\n paint_line,\n paint_circle,\n paint_heatmap,\n paint_symbol,\n paint_raster,\n paint_hillshade,\n paint_background,\n transition,\n \"property-type\": {\n \"data-driven\": {\n type: \"property-type\"\n },\n \"cross-faded\": {\n type: \"property-type\"\n },\n \"cross-faded-data-driven\": {\n type: \"property-type\"\n },\n \"color-ramp\": {\n type: \"property-type\"\n },\n \"data-constant\": {\n type: \"property-type\"\n },\n constant: {\n type: \"property-type\"\n }\n },\n promoteId\n };\n var ValidationError = function ValidationError2(key, value, message, identifier) {\n this.message = (key ? key + \": \" : \"\") + message;\n if (identifier) {\n this.identifier = identifier;\n }\n if (value !== null && value !== void 0 && value.__line__) {\n this.line = value.__line__;\n }\n };\n function validateConstants(options) {\n var key = options.key;\n var constants = options.value;\n if (constants) {\n return [new ValidationError(key, constants, \"constants have been deprecated as of v8\")];\n } else {\n return [];\n }\n }\n function extend$1(output) {\n var inputs = [], len = arguments.length - 1;\n while (len-- > 0)\n inputs[len] = arguments[len + 1];\n for (var i = 0, list = inputs; i < list.length; i += 1) {\n var input = list[i];\n for (var k in input) {\n output[k] = input[k];\n }\n }\n return output;\n }\n function unbundle(value) {\n if (value instanceof Number || value instanceof String || value instanceof Boolean) {\n return value.valueOf();\n } else {\n return value;\n }\n }\n function deepUnbundle(value) {\n if (Array.isArray(value)) {\n return value.map(deepUnbundle);\n } else if (value instanceof Object && !(value instanceof Number || value instanceof String || value instanceof Boolean)) {\n var unbundledValue = {};\n for (var key in value) {\n unbundledValue[key] = deepUnbundle(value[key]);\n }\n return unbundledValue;\n }\n return unbundle(value);\n }\n var ParsingError = function(Error2) {\n function ParsingError2(key, message) {\n Error2.call(this, message);\n this.message = message;\n this.key = key;\n }\n if (Error2)\n ParsingError2.__proto__ = Error2;\n ParsingError2.prototype = Object.create(Error2 && Error2.prototype);\n ParsingError2.prototype.constructor = ParsingError2;\n return ParsingError2;\n }(Error);\n var Scope = function Scope2(parent, bindings) {\n if (bindings === void 0)\n bindings = [];\n this.parent = parent;\n this.bindings = {};\n for (var i = 0, list = bindings; i < list.length; i += 1) {\n var ref = list[i];\n var name3 = ref[0];\n var expression2 = ref[1];\n this.bindings[name3] = expression2;\n }\n };\n Scope.prototype.concat = function concat(bindings) {\n return new Scope(this, bindings);\n };\n Scope.prototype.get = function get2(name3) {\n if (this.bindings[name3]) {\n return this.bindings[name3];\n }\n if (this.parent) {\n return this.parent.get(name3);\n }\n throw new Error(name3 + \" not found in scope.\");\n };\n Scope.prototype.has = function has2(name3) {\n if (this.bindings[name3]) {\n return true;\n }\n return this.parent ? this.parent.has(name3) : false;\n };\n var NullType = { kind: \"null\" };\n var NumberType = { kind: \"number\" };\n var StringType = { kind: \"string\" };\n var BooleanType = { kind: \"boolean\" };\n var ColorType = { kind: \"color\" };\n var ObjectType = { kind: \"object\" };\n var ValueType = { kind: \"value\" };\n var ErrorType = { kind: \"error\" };\n var CollatorType = { kind: \"collator\" };\n var FormattedType = { kind: \"formatted\" };\n var ResolvedImageType = { kind: \"resolvedImage\" };\n function array(itemType, N) {\n return {\n kind: \"array\",\n itemType,\n N\n };\n }\n function toString(type) {\n if (type.kind === \"array\") {\n var itemType = toString(type.itemType);\n return typeof type.N === \"number\" ? \"array<\" + itemType + \", \" + type.N + \">\" : type.itemType.kind === \"value\" ? \"array\" : \"array<\" + itemType + \">\";\n } else {\n return type.kind;\n }\n }\n var valueMemberTypes = [\n NullType,\n NumberType,\n StringType,\n BooleanType,\n ColorType,\n FormattedType,\n ObjectType,\n array(ValueType),\n ResolvedImageType\n ];\n function checkSubtype(expected, t) {\n if (t.kind === \"error\") {\n return null;\n } else if (expected.kind === \"array\") {\n if (t.kind === \"array\" && (t.N === 0 && t.itemType.kind === \"value\" || !checkSubtype(expected.itemType, t.itemType)) && (typeof expected.N !== \"number\" || expected.N === t.N)) {\n return null;\n }\n } else if (expected.kind === t.kind) {\n return null;\n } else if (expected.kind === \"value\") {\n for (var i = 0, list = valueMemberTypes; i < list.length; i += 1) {\n var memberType = list[i];\n if (!checkSubtype(memberType, t)) {\n return null;\n }\n }\n }\n return \"Expected \" + toString(expected) + \" but found \" + toString(t) + \" instead.\";\n }\n function isValidType(provided, allowedTypes) {\n return allowedTypes.some(function(t) {\n return t.kind === provided.kind;\n });\n }\n function isValidNativeType(provided, allowedTypes) {\n return allowedTypes.some(function(t) {\n if (t === \"null\") {\n return provided === null;\n } else if (t === \"array\") {\n return Array.isArray(provided);\n } else if (t === \"object\") {\n return provided && !Array.isArray(provided) && typeof provided === \"object\";\n } else {\n return t === typeof provided;\n }\n });\n }\n var csscolorparser = createCommonjsModule(function(module2, exports3) {\n var kCSSColorTable = {\n \"transparent\": [\n 0,\n 0,\n 0,\n 0\n ],\n \"aliceblue\": [\n 240,\n 248,\n 255,\n 1\n ],\n \"antiquewhite\": [\n 250,\n 235,\n 215,\n 1\n ],\n \"aqua\": [\n 0,\n 255,\n 255,\n 1\n ],\n \"aquamarine\": [\n 127,\n 255,\n 212,\n 1\n ],\n \"azure\": [\n 240,\n 255,\n 255,\n 1\n ],\n \"beige\": [\n 245,\n 245,\n 220,\n 1\n ],\n \"bisque\": [\n 255,\n 228,\n 196,\n 1\n ],\n \"black\": [\n 0,\n 0,\n 0,\n 1\n ],\n \"blanchedalmond\": [\n 255,\n 235,\n 205,\n 1\n ],\n \"blue\": [\n 0,\n 0,\n 255,\n 1\n ],\n \"blueviolet\": [\n 138,\n 43,\n 226,\n 1\n ],\n \"brown\": [\n 165,\n 42,\n 42,\n 1\n ],\n \"burlywood\": [\n 222,\n 184,\n 135,\n 1\n ],\n \"cadetblue\": [\n 95,\n 158,\n 160,\n 1\n ],\n \"chartreuse\": [\n 127,\n 255,\n 0,\n 1\n ],\n \"chocolate\": [\n 210,\n 105,\n 30,\n 1\n ],\n \"coral\": [\n 255,\n 127,\n 80,\n 1\n ],\n \"cornflowerblue\": [\n 100,\n 149,\n 237,\n 1\n ],\n \"cornsilk\": [\n 255,\n 248,\n 220,\n 1\n ],\n \"crimson\": [\n 220,\n 20,\n 60,\n 1\n ],\n \"cyan\": [\n 0,\n 255,\n 255,\n 1\n ],\n \"darkblue\": [\n 0,\n 0,\n 139,\n 1\n ],\n \"darkcyan\": [\n 0,\n 139,\n 139,\n 1\n ],\n \"darkgoldenrod\": [\n 184,\n 134,\n 11,\n 1\n ],\n \"darkgray\": [\n 169,\n 169,\n 169,\n 1\n ],\n \"darkgreen\": [\n 0,\n 100,\n 0,\n 1\n ],\n \"darkgrey\": [\n 169,\n 169,\n 169,\n 1\n ],\n \"darkkhaki\": [\n 189,\n 183,\n 107,\n 1\n ],\n \"darkmagenta\": [\n 139,\n 0,\n 139,\n 1\n ],\n \"darkolivegreen\": [\n 85,\n 107,\n 47,\n 1\n ],\n \"darkorange\": [\n 255,\n 140,\n 0,\n 1\n ],\n \"darkorchid\": [\n 153,\n 50,\n 204,\n 1\n ],\n \"darkred\": [\n 139,\n 0,\n 0,\n 1\n ],\n \"darksalmon\": [\n 233,\n 150,\n 122,\n 1\n ],\n \"darkseagreen\": [\n 143,\n 188,\n 143,\n 1\n ],\n \"darkslateblue\": [\n 72,\n 61,\n 139,\n 1\n ],\n \"darkslategray\": [\n 47,\n 79,\n 79,\n 1\n ],\n \"darkslategrey\": [\n 47,\n 79,\n 79,\n 1\n ],\n \"darkturquoise\": [\n 0,\n 206,\n 209,\n 1\n ],\n \"darkviolet\": [\n 148,\n 0,\n 211,\n 1\n ],\n \"deeppink\": [\n 255,\n 20,\n 147,\n 1\n ],\n \"deepskyblue\": [\n 0,\n 191,\n 255,\n 1\n ],\n \"dimgray\": [\n 105,\n 105,\n 105,\n 1\n ],\n \"dimgrey\": [\n 105,\n 105,\n 105,\n 1\n ],\n \"dodgerblue\": [\n 30,\n 144,\n 255,\n 1\n ],\n \"firebrick\": [\n 178,\n 34,\n 34,\n 1\n ],\n \"floralwhite\": [\n 255,\n 250,\n 240,\n 1\n ],\n \"forestgreen\": [\n 34,\n 139,\n 34,\n 1\n ],\n \"fuchsia\": [\n 255,\n 0,\n 255,\n 1\n ],\n \"gainsboro\": [\n 220,\n 220,\n 220,\n 1\n ],\n \"ghostwhite\": [\n 248,\n 248,\n 255,\n 1\n ],\n \"gold\": [\n 255,\n 215,\n 0,\n 1\n ],\n \"goldenrod\": [\n 218,\n 165,\n 32,\n 1\n ],\n \"gray\": [\n 128,\n 128,\n 128,\n 1\n ],\n \"green\": [\n 0,\n 128,\n 0,\n 1\n ],\n \"greenyellow\": [\n 173,\n 255,\n 47,\n 1\n ],\n \"grey\": [\n 128,\n 128,\n 128,\n 1\n ],\n \"honeydew\": [\n 240,\n 255,\n 240,\n 1\n ],\n \"hotpink\": [\n 255,\n 105,\n 180,\n 1\n ],\n \"indianred\": [\n 205,\n 92,\n 92,\n 1\n ],\n \"indigo\": [\n 75,\n 0,\n 130,\n 1\n ],\n \"ivory\": [\n 255,\n 255,\n 240,\n 1\n ],\n \"khaki\": [\n 240,\n 230,\n 140,\n 1\n ],\n \"lavender\": [\n 230,\n 230,\n 250,\n 1\n ],\n \"lavenderblush\": [\n 255,\n 240,\n 245,\n 1\n ],\n \"lawngreen\": [\n 124,\n 252,\n 0,\n 1\n ],\n \"lemonchiffon\": [\n 255,\n 250,\n 205,\n 1\n ],\n \"lightblue\": [\n 173,\n 216,\n 230,\n 1\n ],\n \"lightcoral\": [\n 240,\n 128,\n 128,\n 1\n ],\n \"lightcyan\": [\n 224,\n 255,\n 255,\n 1\n ],\n \"lightgoldenrodyellow\": [\n 250,\n 250,\n 210,\n 1\n ],\n \"lightgray\": [\n 211,\n 211,\n 211,\n 1\n ],\n \"lightgreen\": [\n 144,\n 238,\n 144,\n 1\n ],\n \"lightgrey\": [\n 211,\n 211,\n 211,\n 1\n ],\n \"lightpink\": [\n 255,\n 182,\n 193,\n 1\n ],\n \"lightsalmon\": [\n 255,\n 160,\n 122,\n 1\n ],\n \"lightseagreen\": [\n 32,\n 178,\n 170,\n 1\n ],\n \"lightskyblue\": [\n 135,\n 206,\n 250,\n 1\n ],\n \"lightslategray\": [\n 119,\n 136,\n 153,\n 1\n ],\n \"lightslategrey\": [\n 119,\n 136,\n 153,\n 1\n ],\n \"lightsteelblue\": [\n 176,\n 196,\n 222,\n 1\n ],\n \"lightyellow\": [\n 255,\n 255,\n 224,\n 1\n ],\n \"lime\": [\n 0,\n 255,\n 0,\n 1\n ],\n \"limegreen\": [\n 50,\n 205,\n 50,\n 1\n ],\n \"linen\": [\n 250,\n 240,\n 230,\n 1\n ],\n \"magenta\": [\n 255,\n 0,\n 255,\n 1\n ],\n \"maroon\": [\n 128,\n 0,\n 0,\n 1\n ],\n \"mediumaquamarine\": [\n 102,\n 205,\n 170,\n 1\n ],\n \"mediumblue\": [\n 0,\n 0,\n 205,\n 1\n ],\n \"mediumorchid\": [\n 186,\n 85,\n 211,\n 1\n ],\n \"mediumpurple\": [\n 147,\n 112,\n 219,\n 1\n ],\n \"mediumseagreen\": [\n 60,\n 179,\n 113,\n 1\n ],\n \"mediumslateblue\": [\n 123,\n 104,\n 238,\n 1\n ],\n \"mediumspringgreen\": [\n 0,\n 250,\n 154,\n 1\n ],\n \"mediumturquoise\": [\n 72,\n 209,\n 204,\n 1\n ],\n \"mediumvioletred\": [\n 199,\n 21,\n 133,\n 1\n ],\n \"midnightblue\": [\n 25,\n 25,\n 112,\n 1\n ],\n \"mintcream\": [\n 245,\n 255,\n 250,\n 1\n ],\n \"mistyrose\": [\n 255,\n 228,\n 225,\n 1\n ],\n \"moccasin\": [\n 255,\n 228,\n 181,\n 1\n ],\n \"navajowhite\": [\n 255,\n 222,\n 173,\n 1\n ],\n \"navy\": [\n 0,\n 0,\n 128,\n 1\n ],\n \"oldlace\": [\n 253,\n 245,\n 230,\n 1\n ],\n \"olive\": [\n 128,\n 128,\n 0,\n 1\n ],\n \"olivedrab\": [\n 107,\n 142,\n 35,\n 1\n ],\n \"orange\": [\n 255,\n 165,\n 0,\n 1\n ],\n \"orangered\": [\n 255,\n 69,\n 0,\n 1\n ],\n \"orchid\": [\n 218,\n 112,\n 214,\n 1\n ],\n \"palegoldenrod\": [\n 238,\n 232,\n 170,\n 1\n ],\n \"palegreen\": [\n 152,\n 251,\n 152,\n 1\n ],\n \"paleturquoise\": [\n 175,\n 238,\n 238,\n 1\n ],\n \"palevioletred\": [\n 219,\n 112,\n 147,\n 1\n ],\n \"papayawhip\": [\n 255,\n 239,\n 213,\n 1\n ],\n \"peachpuff\": [\n 255,\n 218,\n 185,\n 1\n ],\n \"peru\": [\n 205,\n 133,\n 63,\n 1\n ],\n \"pink\": [\n 255,\n 192,\n 203,\n 1\n ],\n \"plum\": [\n 221,\n 160,\n 221,\n 1\n ],\n \"powderblue\": [\n 176,\n 224,\n 230,\n 1\n ],\n \"purple\": [\n 128,\n 0,\n 128,\n 1\n ],\n \"rebeccapurple\": [\n 102,\n 51,\n 153,\n 1\n ],\n \"red\": [\n 255,\n 0,\n 0,\n 1\n ],\n \"rosybrown\": [\n 188,\n 143,\n 143,\n 1\n ],\n \"royalblue\": [\n 65,\n 105,\n 225,\n 1\n ],\n \"saddlebrown\": [\n 139,\n 69,\n 19,\n 1\n ],\n \"salmon\": [\n 250,\n 128,\n 114,\n 1\n ],\n \"sandybrown\": [\n 244,\n 164,\n 96,\n 1\n ],\n \"seagreen\": [\n 46,\n 139,\n 87,\n 1\n ],\n \"seashell\": [\n 255,\n 245,\n 238,\n 1\n ],\n \"sienna\": [\n 160,\n 82,\n 45,\n 1\n ],\n \"silver\": [\n 192,\n 192,\n 192,\n 1\n ],\n \"skyblue\": [\n 135,\n 206,\n 235,\n 1\n ],\n \"slateblue\": [\n 106,\n 90,\n 205,\n 1\n ],\n \"slategray\": [\n 112,\n 128,\n 144,\n 1\n ],\n \"slategrey\": [\n 112,\n 128,\n 144,\n 1\n ],\n \"snow\": [\n 255,\n 250,\n 250,\n 1\n ],\n \"springgreen\": [\n 0,\n 255,\n 127,\n 1\n ],\n \"steelblue\": [\n 70,\n 130,\n 180,\n 1\n ],\n \"tan\": [\n 210,\n 180,\n 140,\n 1\n ],\n \"teal\": [\n 0,\n 128,\n 128,\n 1\n ],\n \"thistle\": [\n 216,\n 191,\n 216,\n 1\n ],\n \"tomato\": [\n 255,\n 99,\n 71,\n 1\n ],\n \"turquoise\": [\n 64,\n 224,\n 208,\n 1\n ],\n \"violet\": [\n 238,\n 130,\n 238,\n 1\n ],\n \"wheat\": [\n 245,\n 222,\n 179,\n 1\n ],\n \"white\": [\n 255,\n 255,\n 255,\n 1\n ],\n \"whitesmoke\": [\n 245,\n 245,\n 245,\n 1\n ],\n \"yellow\": [\n 255,\n 255,\n 0,\n 1\n ],\n \"yellowgreen\": [\n 154,\n 205,\n 50,\n 1\n ]\n };\n function clamp_css_byte(i) {\n i = Math.round(i);\n return i < 0 ? 0 : i > 255 ? 255 : i;\n }\n function clamp_css_float(f) {\n return f < 0 ? 0 : f > 1 ? 1 : f;\n }\n function parse_css_int(str) {\n if (str[str.length - 1] === \"%\") {\n return clamp_css_byte(parseFloat(str) / 100 * 255);\n }\n return clamp_css_byte(parseInt(str));\n }\n function parse_css_float(str) {\n if (str[str.length - 1] === \"%\") {\n return clamp_css_float(parseFloat(str) / 100);\n }\n return clamp_css_float(parseFloat(str));\n }\n function css_hue_to_rgb(m1, m2, h) {\n if (h < 0) {\n h += 1;\n } else if (h > 1) {\n h -= 1;\n }\n if (h * 6 < 1) {\n return m1 + (m2 - m1) * h * 6;\n }\n if (h * 2 < 1) {\n return m2;\n }\n if (h * 3 < 2) {\n return m1 + (m2 - m1) * (2 / 3 - h) * 6;\n }\n return m1;\n }\n function parseCSSColor(css_str) {\n var str = css_str.replace(/ /g, \"\").toLowerCase();\n if (str in kCSSColorTable) {\n return kCSSColorTable[str].slice();\n }\n if (str[0] === \"#\") {\n if (str.length === 4) {\n var iv = parseInt(str.substr(1), 16);\n if (!(iv >= 0 && iv <= 4095)) {\n return null;\n }\n return [\n (iv & 3840) >> 4 | (iv & 3840) >> 8,\n iv & 240 | (iv & 240) >> 4,\n iv & 15 | (iv & 15) << 4,\n 1\n ];\n } else if (str.length === 7) {\n var iv = parseInt(str.substr(1), 16);\n if (!(iv >= 0 && iv <= 16777215)) {\n return null;\n }\n return [\n (iv & 16711680) >> 16,\n (iv & 65280) >> 8,\n iv & 255,\n 1\n ];\n }\n return null;\n }\n var op = str.indexOf(\"(\"), ep = str.indexOf(\")\");\n if (op !== -1 && ep + 1 === str.length) {\n var fname = str.substr(0, op);\n var params = str.substr(op + 1, ep - (op + 1)).split(\",\");\n var alpha = 1;\n switch (fname) {\n case \"rgba\":\n if (params.length !== 4) {\n return null;\n }\n alpha = parse_css_float(params.pop());\n case \"rgb\":\n if (params.length !== 3) {\n return null;\n }\n return [\n parse_css_int(params[0]),\n parse_css_int(params[1]),\n parse_css_int(params[2]),\n alpha\n ];\n case \"hsla\":\n if (params.length !== 4) {\n return null;\n }\n alpha = parse_css_float(params.pop());\n case \"hsl\":\n if (params.length !== 3) {\n return null;\n }\n var h = (parseFloat(params[0]) % 360 + 360) % 360 / 360;\n var s = parse_css_float(params[1]);\n var l = parse_css_float(params[2]);\n var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;\n var m1 = l * 2 - m2;\n return [\n clamp_css_byte(css_hue_to_rgb(m1, m2, h + 1 / 3) * 255),\n clamp_css_byte(css_hue_to_rgb(m1, m2, h) * 255),\n clamp_css_byte(css_hue_to_rgb(m1, m2, h - 1 / 3) * 255),\n alpha\n ];\n default:\n return null;\n }\n }\n return null;\n }\n try {\n exports3.parseCSSColor = parseCSSColor;\n } catch (e) {\n }\n });\n var csscolorparser_1 = csscolorparser.parseCSSColor;\n var Color2 = function Color3(r, g, b, a) {\n if (a === void 0)\n a = 1;\n this.r = r;\n this.g = g;\n this.b = b;\n this.a = a;\n };\n Color2.parse = function parse2(input) {\n if (!input) {\n return void 0;\n }\n if (input instanceof Color2) {\n return input;\n }\n if (typeof input !== \"string\") {\n return void 0;\n }\n var rgba4 = csscolorparser_1(input);\n if (!rgba4) {\n return void 0;\n }\n return new Color2(rgba4[0] / 255 * rgba4[3], rgba4[1] / 255 * rgba4[3], rgba4[2] / 255 * rgba4[3], rgba4[3]);\n };\n Color2.prototype.toString = function toString2() {\n var ref = this.toArray();\n var r = ref[0];\n var g = ref[1];\n var b = ref[2];\n var a = ref[3];\n return \"rgba(\" + Math.round(r) + \",\" + Math.round(g) + \",\" + Math.round(b) + \",\" + a + \")\";\n };\n Color2.prototype.toArray = function toArray() {\n var ref = this;\n var r = ref.r;\n var g = ref.g;\n var b = ref.b;\n var a = ref.a;\n return a === 0 ? [\n 0,\n 0,\n 0,\n 0\n ] : [\n r * 255 / a,\n g * 255 / a,\n b * 255 / a,\n a\n ];\n };\n Color2.black = new Color2(0, 0, 0, 1);\n Color2.white = new Color2(1, 1, 1, 1);\n Color2.transparent = new Color2(0, 0, 0, 0);\n Color2.red = new Color2(1, 0, 0, 1);\n var Collator = function Collator2(caseSensitive, diacriticSensitive, locale) {\n if (caseSensitive) {\n this.sensitivity = diacriticSensitive ? \"variant\" : \"case\";\n } else {\n this.sensitivity = diacriticSensitive ? \"accent\" : \"base\";\n }\n this.locale = locale;\n this.collator = new Intl.Collator(this.locale ? this.locale : [], {\n sensitivity: this.sensitivity,\n usage: \"search\"\n });\n };\n Collator.prototype.compare = function compare2(lhs, rhs) {\n return this.collator.compare(lhs, rhs);\n };\n Collator.prototype.resolvedLocale = function resolvedLocale() {\n return new Intl.Collator(this.locale ? this.locale : []).resolvedOptions().locale;\n };\n var FormattedSection = function FormattedSection2(text, image, scale2, fontStack, textColor) {\n this.text = text;\n this.image = image;\n this.scale = scale2;\n this.fontStack = fontStack;\n this.textColor = textColor;\n };\n var Formatted = function Formatted2(sections) {\n this.sections = sections;\n };\n Formatted.fromString = function fromString(unformatted) {\n return new Formatted([new FormattedSection(unformatted, null, null, null, null)]);\n };\n Formatted.prototype.isEmpty = function isEmpty2() {\n if (this.sections.length === 0) {\n return true;\n }\n return !this.sections.some(function(section) {\n return section.text.length !== 0 || section.image && section.image.name.length !== 0;\n });\n };\n Formatted.factory = function factory(text) {\n if (text instanceof Formatted) {\n return text;\n } else {\n return Formatted.fromString(text);\n }\n };\n Formatted.prototype.toString = function toString2() {\n if (this.sections.length === 0) {\n return \"\";\n }\n return this.sections.map(function(section) {\n return section.text;\n }).join(\"\");\n };\n Formatted.prototype.serialize = function serialize2() {\n var serialized = [\"format\"];\n for (var i = 0, list = this.sections; i < list.length; i += 1) {\n var section = list[i];\n if (section.image) {\n serialized.push([\n \"image\",\n section.image.name\n ]);\n continue;\n }\n serialized.push(section.text);\n var options = {};\n if (section.fontStack) {\n options[\"text-font\"] = [\n \"literal\",\n section.fontStack.split(\",\")\n ];\n }\n if (section.scale) {\n options[\"font-scale\"] = section.scale;\n }\n if (section.textColor) {\n options[\"text-color\"] = [\"rgba\"].concat(section.textColor.toArray());\n }\n serialized.push(options);\n }\n return serialized;\n };\n var ResolvedImage = function ResolvedImage2(options) {\n this.name = options.name;\n this.available = options.available;\n };\n ResolvedImage.prototype.toString = function toString2() {\n return this.name;\n };\n ResolvedImage.fromString = function fromString(name3) {\n if (!name3) {\n return null;\n }\n return new ResolvedImage({\n name: name3,\n available: false\n });\n };\n ResolvedImage.prototype.serialize = function serialize2() {\n return [\n \"image\",\n this.name\n ];\n };\n function validateRGBA(r, g, b, a) {\n if (!(typeof r === \"number\" && r >= 0 && r <= 255 && typeof g === \"number\" && g >= 0 && g <= 255 && typeof b === \"number\" && b >= 0 && b <= 255)) {\n var value = typeof a === \"number\" ? [\n r,\n g,\n b,\n a\n ] : [\n r,\n g,\n b\n ];\n return \"Invalid rgba value [\" + value.join(\", \") + \"]: 'r', 'g', and 'b' must be between 0 and 255.\";\n }\n if (!(typeof a === \"undefined\" || typeof a === \"number\" && a >= 0 && a <= 1)) {\n return \"Invalid rgba value [\" + [\n r,\n g,\n b,\n a\n ].join(\", \") + \"]: 'a' must be between 0 and 1.\";\n }\n return null;\n }\n function isValue(mixed) {\n if (mixed === null) {\n return true;\n } else if (typeof mixed === \"string\") {\n return true;\n } else if (typeof mixed === \"boolean\") {\n return true;\n } else if (typeof mixed === \"number\") {\n return true;\n } else if (mixed instanceof Color2) {\n return true;\n } else if (mixed instanceof Collator) {\n return true;\n } else if (mixed instanceof Formatted) {\n return true;\n } else if (mixed instanceof ResolvedImage) {\n return true;\n } else if (Array.isArray(mixed)) {\n for (var i = 0, list = mixed; i < list.length; i += 1) {\n var item = list[i];\n if (!isValue(item)) {\n return false;\n }\n }\n return true;\n } else if (typeof mixed === \"object\") {\n for (var key in mixed) {\n if (!isValue(mixed[key])) {\n return false;\n }\n }\n return true;\n } else {\n return false;\n }\n }\n function typeOf(value) {\n if (value === null) {\n return NullType;\n } else if (typeof value === \"string\") {\n return StringType;\n } else if (typeof value === \"boolean\") {\n return BooleanType;\n } else if (typeof value === \"number\") {\n return NumberType;\n } else if (value instanceof Color2) {\n return ColorType;\n } else if (value instanceof Collator) {\n return CollatorType;\n } else if (value instanceof Formatted) {\n return FormattedType;\n } else if (value instanceof ResolvedImage) {\n return ResolvedImageType;\n } else if (Array.isArray(value)) {\n var length = value.length;\n var itemType;\n for (var i = 0, list = value; i < list.length; i += 1) {\n var item = list[i];\n var t = typeOf(item);\n if (!itemType) {\n itemType = t;\n } else if (itemType === t) {\n continue;\n } else {\n itemType = ValueType;\n break;\n }\n }\n return array(itemType || ValueType, length);\n } else {\n return ObjectType;\n }\n }\n function toString$1(value) {\n var type = typeof value;\n if (value === null) {\n return \"\";\n } else if (type === \"string\" || type === \"number\" || type === \"boolean\") {\n return String(value);\n } else if (value instanceof Color2 || value instanceof Formatted || value instanceof ResolvedImage) {\n return value.toString();\n } else {\n return JSON.stringify(value);\n }\n }\n var Literal = function Literal2(type, value) {\n this.type = type;\n this.value = value;\n };\n Literal.parse = function parse2(args, context) {\n if (args.length !== 2) {\n return context.error(\"'literal' expression requires exactly one argument, but found \" + (args.length - 1) + \" instead.\");\n }\n if (!isValue(args[1])) {\n return context.error(\"invalid value\");\n }\n var value = args[1];\n var type = typeOf(value);\n var expected = context.expectedType;\n if (type.kind === \"array\" && type.N === 0 && expected && expected.kind === \"array\" && (typeof expected.N !== \"number\" || expected.N === 0)) {\n type = expected;\n }\n return new Literal(type, value);\n };\n Literal.prototype.evaluate = function evaluate() {\n return this.value;\n };\n Literal.prototype.eachChild = function eachChild() {\n };\n Literal.prototype.outputDefined = function outputDefined() {\n return true;\n };\n Literal.prototype.serialize = function serialize2() {\n if (this.type.kind === \"array\" || this.type.kind === \"object\") {\n return [\n \"literal\",\n this.value\n ];\n } else if (this.value instanceof Color2) {\n return [\"rgba\"].concat(this.value.toArray());\n } else if (this.value instanceof Formatted) {\n return this.value.serialize();\n } else {\n return this.value;\n }\n };\n var RuntimeError = function RuntimeError2(message) {\n this.name = \"ExpressionEvaluationError\";\n this.message = message;\n };\n RuntimeError.prototype.toJSON = function toJSON() {\n return this.message;\n };\n var types = {\n string: StringType,\n number: NumberType,\n boolean: BooleanType,\n object: ObjectType\n };\n var Assertion = function Assertion2(type, args) {\n this.type = type;\n this.args = args;\n };\n Assertion.parse = function parse2(args, context) {\n if (args.length < 2) {\n return context.error(\"Expected at least one argument.\");\n }\n var i = 1;\n var type;\n var name3 = args[0];\n if (name3 === \"array\") {\n var itemType;\n if (args.length > 2) {\n var type$1 = args[1];\n if (typeof type$1 !== \"string\" || !(type$1 in types) || type$1 === \"object\") {\n return context.error('The item type argument of \"array\" must be one of string, number, boolean', 1);\n }\n itemType = types[type$1];\n i++;\n } else {\n itemType = ValueType;\n }\n var N;\n if (args.length > 3) {\n if (args[2] !== null && (typeof args[2] !== \"number\" || args[2] < 0 || args[2] !== Math.floor(args[2]))) {\n return context.error('The length argument to \"array\" must be a positive integer literal', 2);\n }\n N = args[2];\n i++;\n }\n type = array(itemType, N);\n } else {\n type = types[name3];\n }\n var parsed = [];\n for (; i < args.length; i++) {\n var input = context.parse(args[i], i, ValueType);\n if (!input) {\n return null;\n }\n parsed.push(input);\n }\n return new Assertion(type, parsed);\n };\n Assertion.prototype.evaluate = function evaluate(ctx) {\n for (var i = 0; i < this.args.length; i++) {\n var value = this.args[i].evaluate(ctx);\n var error2 = checkSubtype(this.type, typeOf(value));\n if (!error2) {\n return value;\n } else if (i === this.args.length - 1) {\n throw new RuntimeError(\"Expected value to be of type \" + toString(this.type) + \", but found \" + toString(typeOf(value)) + \" instead.\");\n }\n }\n return null;\n };\n Assertion.prototype.eachChild = function eachChild(fn) {\n this.args.forEach(fn);\n };\n Assertion.prototype.outputDefined = function outputDefined() {\n return this.args.every(function(arg) {\n return arg.outputDefined();\n });\n };\n Assertion.prototype.serialize = function serialize2() {\n var type = this.type;\n var serialized = [type.kind];\n if (type.kind === \"array\") {\n var itemType = type.itemType;\n if (itemType.kind === \"string\" || itemType.kind === \"number\" || itemType.kind === \"boolean\") {\n serialized.push(itemType.kind);\n var N = type.N;\n if (typeof N === \"number\" || this.args.length > 1) {\n serialized.push(N);\n }\n }\n }\n return serialized.concat(this.args.map(function(arg) {\n return arg.serialize();\n }));\n };\n var FormatExpression = function FormatExpression2(sections) {\n this.type = FormattedType;\n this.sections = sections;\n };\n FormatExpression.parse = function parse2(args, context) {\n if (args.length < 2) {\n return context.error(\"Expected at least one argument.\");\n }\n var firstArg = args[1];\n if (!Array.isArray(firstArg) && typeof firstArg === \"object\") {\n return context.error(\"First argument must be an image or text section.\");\n }\n var sections = [];\n var nextTokenMayBeObject = false;\n for (var i = 1; i <= args.length - 1; ++i) {\n var arg = args[i];\n if (nextTokenMayBeObject && typeof arg === \"object\" && !Array.isArray(arg)) {\n nextTokenMayBeObject = false;\n var scale2 = null;\n if (arg[\"font-scale\"]) {\n scale2 = context.parse(arg[\"font-scale\"], 1, NumberType);\n if (!scale2) {\n return null;\n }\n }\n var font = null;\n if (arg[\"text-font\"]) {\n font = context.parse(arg[\"text-font\"], 1, array(StringType));\n if (!font) {\n return null;\n }\n }\n var textColor = null;\n if (arg[\"text-color\"]) {\n textColor = context.parse(arg[\"text-color\"], 1, ColorType);\n if (!textColor) {\n return null;\n }\n }\n var lastExpression = sections[sections.length - 1];\n lastExpression.scale = scale2;\n lastExpression.font = font;\n lastExpression.textColor = textColor;\n } else {\n var content = context.parse(args[i], 1, ValueType);\n if (!content) {\n return null;\n }\n var kind = content.type.kind;\n if (kind !== \"string\" && kind !== \"value\" && kind !== \"null\" && kind !== \"resolvedImage\") {\n return context.error(\"Formatted text type must be 'string', 'value', 'image' or 'null'.\");\n }\n nextTokenMayBeObject = true;\n sections.push({\n content,\n scale: null,\n font: null,\n textColor: null\n });\n }\n }\n return new FormatExpression(sections);\n };\n FormatExpression.prototype.evaluate = function evaluate(ctx) {\n var evaluateSection = function(section) {\n var evaluatedContent = section.content.evaluate(ctx);\n if (typeOf(evaluatedContent) === ResolvedImageType) {\n return new FormattedSection(\"\", evaluatedContent, null, null, null);\n }\n return new FormattedSection(toString$1(evaluatedContent), null, section.scale ? section.scale.evaluate(ctx) : null, section.font ? section.font.evaluate(ctx).join(\",\") : null, section.textColor ? section.textColor.evaluate(ctx) : null);\n };\n return new Formatted(this.sections.map(evaluateSection));\n };\n FormatExpression.prototype.eachChild = function eachChild(fn) {\n for (var i = 0, list = this.sections; i < list.length; i += 1) {\n var section = list[i];\n fn(section.content);\n if (section.scale) {\n fn(section.scale);\n }\n if (section.font) {\n fn(section.font);\n }\n if (section.textColor) {\n fn(section.textColor);\n }\n }\n };\n FormatExpression.prototype.outputDefined = function outputDefined() {\n return false;\n };\n FormatExpression.prototype.serialize = function serialize2() {\n var serialized = [\"format\"];\n for (var i = 0, list = this.sections; i < list.length; i += 1) {\n var section = list[i];\n serialized.push(section.content.serialize());\n var options = {};\n if (section.scale) {\n options[\"font-scale\"] = section.scale.serialize();\n }\n if (section.font) {\n options[\"text-font\"] = section.font.serialize();\n }\n if (section.textColor) {\n options[\"text-color\"] = section.textColor.serialize();\n }\n serialized.push(options);\n }\n return serialized;\n };\n var ImageExpression = function ImageExpression2(input) {\n this.type = ResolvedImageType;\n this.input = input;\n };\n ImageExpression.parse = function parse2(args, context) {\n if (args.length !== 2) {\n return context.error(\"Expected two arguments.\");\n }\n var name3 = context.parse(args[1], 1, StringType);\n if (!name3) {\n return context.error(\"No image name provided.\");\n }\n return new ImageExpression(name3);\n };\n ImageExpression.prototype.evaluate = function evaluate(ctx) {\n var evaluatedImageName = this.input.evaluate(ctx);\n var value = ResolvedImage.fromString(evaluatedImageName);\n if (value && ctx.availableImages) {\n value.available = ctx.availableImages.indexOf(evaluatedImageName) > -1;\n }\n return value;\n };\n ImageExpression.prototype.eachChild = function eachChild(fn) {\n fn(this.input);\n };\n ImageExpression.prototype.outputDefined = function outputDefined() {\n return false;\n };\n ImageExpression.prototype.serialize = function serialize2() {\n return [\n \"image\",\n this.input.serialize()\n ];\n };\n var types$1 = {\n \"to-boolean\": BooleanType,\n \"to-color\": ColorType,\n \"to-number\": NumberType,\n \"to-string\": StringType\n };\n var Coercion = function Coercion2(type, args) {\n this.type = type;\n this.args = args;\n };\n Coercion.parse = function parse2(args, context) {\n if (args.length < 2) {\n return context.error(\"Expected at least one argument.\");\n }\n var name3 = args[0];\n if ((name3 === \"to-boolean\" || name3 === \"to-string\") && args.length !== 2) {\n return context.error(\"Expected one argument.\");\n }\n var type = types$1[name3];\n var parsed = [];\n for (var i = 1; i < args.length; i++) {\n var input = context.parse(args[i], i, ValueType);\n if (!input) {\n return null;\n }\n parsed.push(input);\n }\n return new Coercion(type, parsed);\n };\n Coercion.prototype.evaluate = function evaluate(ctx) {\n if (this.type.kind === \"boolean\") {\n return Boolean(this.args[0].evaluate(ctx));\n } else if (this.type.kind === \"color\") {\n var input;\n var error2;\n for (var i = 0, list = this.args; i < list.length; i += 1) {\n var arg = list[i];\n input = arg.evaluate(ctx);\n error2 = null;\n if (input instanceof Color2) {\n return input;\n } else if (typeof input === \"string\") {\n var c = ctx.parseColor(input);\n if (c) {\n return c;\n }\n } else if (Array.isArray(input)) {\n if (input.length < 3 || input.length > 4) {\n error2 = \"Invalid rbga value \" + JSON.stringify(input) + \": expected an array containing either three or four numeric values.\";\n } else {\n error2 = validateRGBA(input[0], input[1], input[2], input[3]);\n }\n if (!error2) {\n return new Color2(input[0] / 255, input[1] / 255, input[2] / 255, input[3]);\n }\n }\n }\n throw new RuntimeError(error2 || \"Could not parse color from value '\" + (typeof input === \"string\" ? input : String(JSON.stringify(input))) + \"'\");\n } else if (this.type.kind === \"number\") {\n var value = null;\n for (var i$1 = 0, list$1 = this.args; i$1 < list$1.length; i$1 += 1) {\n var arg$1 = list$1[i$1];\n value = arg$1.evaluate(ctx);\n if (value === null) {\n return 0;\n }\n var num = Number(value);\n if (isNaN(num)) {\n continue;\n }\n return num;\n }\n throw new RuntimeError(\"Could not convert \" + JSON.stringify(value) + \" to number.\");\n } else if (this.type.kind === \"formatted\") {\n return Formatted.fromString(toString$1(this.args[0].evaluate(ctx)));\n } else if (this.type.kind === \"resolvedImage\") {\n return ResolvedImage.fromString(toString$1(this.args[0].evaluate(ctx)));\n } else {\n return toString$1(this.args[0].evaluate(ctx));\n }\n };\n Coercion.prototype.eachChild = function eachChild(fn) {\n this.args.forEach(fn);\n };\n Coercion.prototype.outputDefined = function outputDefined() {\n return this.args.every(function(arg) {\n return arg.outputDefined();\n });\n };\n Coercion.prototype.serialize = function serialize2() {\n if (this.type.kind === \"formatted\") {\n return new FormatExpression([{\n content: this.args[0],\n scale: null,\n font: null,\n textColor: null\n }]).serialize();\n }\n if (this.type.kind === \"resolvedImage\") {\n return new ImageExpression(this.args[0]).serialize();\n }\n var serialized = [\"to-\" + this.type.kind];\n this.eachChild(function(child) {\n serialized.push(child.serialize());\n });\n return serialized;\n };\n var geometryTypes = [\n \"Unknown\",\n \"Point\",\n \"LineString\",\n \"Polygon\"\n ];\n var EvaluationContext = function EvaluationContext2() {\n this.globals = null;\n this.feature = null;\n this.featureState = null;\n this.formattedSection = null;\n this._parseColorCache = {};\n this.availableImages = null;\n this.canonical = null;\n };\n EvaluationContext.prototype.id = function id2() {\n return this.feature && \"id\" in this.feature ? this.feature.id : null;\n };\n EvaluationContext.prototype.geometryType = function geometryType() {\n return this.feature ? typeof this.feature.type === \"number\" ? geometryTypes[this.feature.type] : this.feature.type : null;\n };\n EvaluationContext.prototype.geometry = function geometry() {\n return this.feature && \"geometry\" in this.feature ? this.feature.geometry : null;\n };\n EvaluationContext.prototype.canonicalID = function canonicalID() {\n return this.canonical;\n };\n EvaluationContext.prototype.properties = function properties2() {\n return this.feature && this.feature.properties || {};\n };\n EvaluationContext.prototype.parseColor = function parseColor(input) {\n var cached = this._parseColorCache[input];\n if (!cached) {\n cached = this._parseColorCache[input] = Color2.parse(input);\n }\n return cached;\n };\n var CompoundExpression = function CompoundExpression2(name3, type, evaluate, args) {\n this.name = name3;\n this.type = type;\n this._evaluate = evaluate;\n this.args = args;\n };\n CompoundExpression.prototype.evaluate = function evaluate(ctx) {\n return this._evaluate(ctx, this.args);\n };\n CompoundExpression.prototype.eachChild = function eachChild(fn) {\n this.args.forEach(fn);\n };\n CompoundExpression.prototype.outputDefined = function outputDefined() {\n return false;\n };\n CompoundExpression.prototype.serialize = function serialize2() {\n return [this.name].concat(this.args.map(function(arg) {\n return arg.serialize();\n }));\n };\n CompoundExpression.parse = function parse2(args, context) {\n var ref$1;\n var op = args[0];\n var definition = CompoundExpression.definitions[op];\n if (!definition) {\n return context.error('Unknown expression \"' + op + '\". If you wanted a literal array, use [\"literal\", [...]].', 0);\n }\n var type = Array.isArray(definition) ? definition[0] : definition.type;\n var availableOverloads = Array.isArray(definition) ? [[\n definition[1],\n definition[2]\n ]] : definition.overloads;\n var overloads = availableOverloads.filter(function(ref2) {\n var signature = ref2[0];\n return !Array.isArray(signature) || signature.length === args.length - 1;\n });\n var signatureContext = null;\n for (var i$3 = 0, list = overloads; i$3 < list.length; i$3 += 1) {\n var ref = list[i$3];\n var params = ref[0];\n var evaluate = ref[1];\n signatureContext = new ParsingContext(context.registry, context.path, null, context.scope);\n var parsedArgs = [];\n var argParseFailed = false;\n for (var i = 1; i < args.length; i++) {\n var arg = args[i];\n var expectedType = Array.isArray(params) ? params[i - 1] : params.type;\n var parsed = signatureContext.parse(arg, 1 + parsedArgs.length, expectedType);\n if (!parsed) {\n argParseFailed = true;\n break;\n }\n parsedArgs.push(parsed);\n }\n if (argParseFailed) {\n continue;\n }\n if (Array.isArray(params)) {\n if (params.length !== parsedArgs.length) {\n signatureContext.error(\"Expected \" + params.length + \" arguments, but found \" + parsedArgs.length + \" instead.\");\n continue;\n }\n }\n for (var i$1 = 0; i$1 < parsedArgs.length; i$1++) {\n var expected = Array.isArray(params) ? params[i$1] : params.type;\n var arg$1 = parsedArgs[i$1];\n signatureContext.concat(i$1 + 1).checkSubtype(expected, arg$1.type);\n }\n if (signatureContext.errors.length === 0) {\n return new CompoundExpression(op, type, evaluate, parsedArgs);\n }\n }\n if (overloads.length === 1) {\n (ref$1 = context.errors).push.apply(ref$1, signatureContext.errors);\n } else {\n var expected$1 = overloads.length ? overloads : availableOverloads;\n var signatures = expected$1.map(function(ref2) {\n var params2 = ref2[0];\n return stringifySignature(params2);\n }).join(\" | \");\n var actualTypes = [];\n for (var i$2 = 1; i$2 < args.length; i$2++) {\n var parsed$1 = context.parse(args[i$2], 1 + actualTypes.length);\n if (!parsed$1) {\n return null;\n }\n actualTypes.push(toString(parsed$1.type));\n }\n context.error(\"Expected arguments of type \" + signatures + \", but found (\" + actualTypes.join(\", \") + \") instead.\");\n }\n return null;\n };\n CompoundExpression.register = function register2(registry2, definitions) {\n CompoundExpression.definitions = definitions;\n for (var name3 in definitions) {\n registry2[name3] = CompoundExpression;\n }\n };\n function stringifySignature(signature) {\n if (Array.isArray(signature)) {\n return \"(\" + signature.map(toString).join(\", \") + \")\";\n } else {\n return \"(\" + toString(signature.type) + \"...)\";\n }\n }\n var CollatorExpression = function CollatorExpression2(caseSensitive, diacriticSensitive, locale) {\n this.type = CollatorType;\n this.locale = locale;\n this.caseSensitive = caseSensitive;\n this.diacriticSensitive = diacriticSensitive;\n };\n CollatorExpression.parse = function parse2(args, context) {\n if (args.length !== 2) {\n return context.error(\"Expected one argument.\");\n }\n var options = args[1];\n if (typeof options !== \"object\" || Array.isArray(options)) {\n return context.error(\"Collator options argument must be an object.\");\n }\n var caseSensitive = context.parse(options[\"case-sensitive\"] === void 0 ? false : options[\"case-sensitive\"], 1, BooleanType);\n if (!caseSensitive) {\n return null;\n }\n var diacriticSensitive = context.parse(options[\"diacritic-sensitive\"] === void 0 ? false : options[\"diacritic-sensitive\"], 1, BooleanType);\n if (!diacriticSensitive) {\n return null;\n }\n var locale = null;\n if (options[\"locale\"]) {\n locale = context.parse(options[\"locale\"], 1, StringType);\n if (!locale) {\n return null;\n }\n }\n return new CollatorExpression(caseSensitive, diacriticSensitive, locale);\n };\n CollatorExpression.prototype.evaluate = function evaluate(ctx) {\n return new Collator(this.caseSensitive.evaluate(ctx), this.diacriticSensitive.evaluate(ctx), this.locale ? this.locale.evaluate(ctx) : null);\n };\n CollatorExpression.prototype.eachChild = function eachChild(fn) {\n fn(this.caseSensitive);\n fn(this.diacriticSensitive);\n if (this.locale) {\n fn(this.locale);\n }\n };\n CollatorExpression.prototype.outputDefined = function outputDefined() {\n return false;\n };\n CollatorExpression.prototype.serialize = function serialize2() {\n var options = {};\n options[\"case-sensitive\"] = this.caseSensitive.serialize();\n options[\"diacritic-sensitive\"] = this.diacriticSensitive.serialize();\n if (this.locale) {\n options[\"locale\"] = this.locale.serialize();\n }\n return [\n \"collator\",\n options\n ];\n };\n var EXTENT = 8192;\n function updateBBox(bbox, coord) {\n bbox[0] = Math.min(bbox[0], coord[0]);\n bbox[1] = Math.min(bbox[1], coord[1]);\n bbox[2] = Math.max(bbox[2], coord[0]);\n bbox[3] = Math.max(bbox[3], coord[1]);\n }\n function mercatorXfromLng(lng) {\n return (180 + lng) / 360;\n }\n function mercatorYfromLat(lat) {\n return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360))) / 360;\n }\n function boxWithinBox(bbox1, bbox2) {\n if (bbox1[0] <= bbox2[0]) {\n return false;\n }\n if (bbox1[2] >= bbox2[2]) {\n return false;\n }\n if (bbox1[1] <= bbox2[1]) {\n return false;\n }\n if (bbox1[3] >= bbox2[3]) {\n return false;\n }\n return true;\n }\n function getTileCoordinates(p, canonical) {\n var x = mercatorXfromLng(p[0]);\n var y = mercatorYfromLat(p[1]);\n var tilesAtZoom = Math.pow(2, canonical.z);\n return [\n Math.round(x * tilesAtZoom * EXTENT),\n Math.round(y * tilesAtZoom * EXTENT)\n ];\n }\n function onBoundary(p, p1, p2) {\n var x1 = p[0] - p1[0];\n var y1 = p[1] - p1[1];\n var x2 = p[0] - p2[0];\n var y2 = p[1] - p2[1];\n return x1 * y2 - x2 * y1 === 0 && x1 * x2 <= 0 && y1 * y2 <= 0;\n }\n function rayIntersect(p, p1, p2) {\n return p1[1] > p[1] !== p2[1] > p[1] && p[0] < (p2[0] - p1[0]) * (p[1] - p1[1]) / (p2[1] - p1[1]) + p1[0];\n }\n function pointWithinPolygon(point, rings) {\n var inside = false;\n for (var i = 0, len = rings.length; i < len; i++) {\n var ring = rings[i];\n for (var j = 0, len2 = ring.length; j < len2 - 1; j++) {\n if (onBoundary(point, ring[j], ring[j + 1])) {\n return false;\n }\n if (rayIntersect(point, ring[j], ring[j + 1])) {\n inside = !inside;\n }\n }\n }\n return inside;\n }\n function pointWithinPolygons(point, polygons) {\n for (var i = 0; i < polygons.length; i++) {\n if (pointWithinPolygon(point, polygons[i])) {\n return true;\n }\n }\n return false;\n }\n function perp(v1, v2) {\n return v1[0] * v2[1] - v1[1] * v2[0];\n }\n function twoSided(p1, p2, q1, q2) {\n var x1 = p1[0] - q1[0];\n var y1 = p1[1] - q1[1];\n var x2 = p2[0] - q1[0];\n var y2 = p2[1] - q1[1];\n var x3 = q2[0] - q1[0];\n var y3 = q2[1] - q1[1];\n var det1 = x1 * y3 - x3 * y1;\n var det2 = x2 * y3 - x3 * y2;\n if (det1 > 0 && det2 < 0 || det1 < 0 && det2 > 0) {\n return true;\n }\n return false;\n }\n function lineIntersectLine(a, b, c, d) {\n var vectorP = [\n b[0] - a[0],\n b[1] - a[1]\n ];\n var vectorQ = [\n d[0] - c[0],\n d[1] - c[1]\n ];\n if (perp(vectorQ, vectorP) === 0) {\n return false;\n }\n if (twoSided(a, b, c, d) && twoSided(c, d, a, b)) {\n return true;\n }\n return false;\n }\n function lineIntersectPolygon(p1, p2, polygon) {\n for (var i = 0, list = polygon; i < list.length; i += 1) {\n var ring = list[i];\n for (var j = 0; j < ring.length - 1; ++j) {\n if (lineIntersectLine(p1, p2, ring[j], ring[j + 1])) {\n return true;\n }\n }\n }\n return false;\n }\n function lineStringWithinPolygon(line, polygon) {\n for (var i = 0; i < line.length; ++i) {\n if (!pointWithinPolygon(line[i], polygon)) {\n return false;\n }\n }\n for (var i$1 = 0; i$1 < line.length - 1; ++i$1) {\n if (lineIntersectPolygon(line[i$1], line[i$1 + 1], polygon)) {\n return false;\n }\n }\n return true;\n }\n function lineStringWithinPolygons(line, polygons) {\n for (var i = 0; i < polygons.length; i++) {\n if (lineStringWithinPolygon(line, polygons[i])) {\n return true;\n }\n }\n return false;\n }\n function getTilePolygon(coordinates, bbox, canonical) {\n var polygon = [];\n for (var i = 0; i < coordinates.length; i++) {\n var ring = [];\n for (var j = 0; j < coordinates[i].length; j++) {\n var coord = getTileCoordinates(coordinates[i][j], canonical);\n updateBBox(bbox, coord);\n ring.push(coord);\n }\n polygon.push(ring);\n }\n return polygon;\n }\n function getTilePolygons(coordinates, bbox, canonical) {\n var polygons = [];\n for (var i = 0; i < coordinates.length; i++) {\n var polygon = getTilePolygon(coordinates[i], bbox, canonical);\n polygons.push(polygon);\n }\n return polygons;\n }\n function updatePoint(p, bbox, polyBBox, worldSize) {\n if (p[0] < polyBBox[0] || p[0] > polyBBox[2]) {\n var halfWorldSize = worldSize * 0.5;\n var shift = p[0] - polyBBox[0] > halfWorldSize ? -worldSize : polyBBox[0] - p[0] > halfWorldSize ? worldSize : 0;\n if (shift === 0) {\n shift = p[0] - polyBBox[2] > halfWorldSize ? -worldSize : polyBBox[2] - p[0] > halfWorldSize ? worldSize : 0;\n }\n p[0] += shift;\n }\n updateBBox(bbox, p);\n }\n function resetBBox(bbox) {\n bbox[0] = bbox[1] = Infinity;\n bbox[2] = bbox[3] = -Infinity;\n }\n function getTilePoints(geometry, pointBBox, polyBBox, canonical) {\n var worldSize = Math.pow(2, canonical.z) * EXTENT;\n var shifts = [\n canonical.x * EXTENT,\n canonical.y * EXTENT\n ];\n var tilePoints = [];\n for (var i$1 = 0, list$1 = geometry; i$1 < list$1.length; i$1 += 1) {\n var points = list$1[i$1];\n for (var i = 0, list = points; i < list.length; i += 1) {\n var point = list[i];\n var p = [\n point.x + shifts[0],\n point.y + shifts[1]\n ];\n updatePoint(p, pointBBox, polyBBox, worldSize);\n tilePoints.push(p);\n }\n }\n return tilePoints;\n }\n function getTileLines(geometry, lineBBox, polyBBox, canonical) {\n var worldSize = Math.pow(2, canonical.z) * EXTENT;\n var shifts = [\n canonical.x * EXTENT,\n canonical.y * EXTENT\n ];\n var tileLines = [];\n for (var i$1 = 0, list$1 = geometry; i$1 < list$1.length; i$1 += 1) {\n var line = list$1[i$1];\n var tileLine = [];\n for (var i = 0, list = line; i < list.length; i += 1) {\n var point = list[i];\n var p = [\n point.x + shifts[0],\n point.y + shifts[1]\n ];\n updateBBox(lineBBox, p);\n tileLine.push(p);\n }\n tileLines.push(tileLine);\n }\n if (lineBBox[2] - lineBBox[0] <= worldSize / 2) {\n resetBBox(lineBBox);\n for (var i$3 = 0, list$3 = tileLines; i$3 < list$3.length; i$3 += 1) {\n var line$1 = list$3[i$3];\n for (var i$2 = 0, list$2 = line$1; i$2 < list$2.length; i$2 += 1) {\n var p$1 = list$2[i$2];\n updatePoint(p$1, lineBBox, polyBBox, worldSize);\n }\n }\n }\n return tileLines;\n }\n function pointsWithinPolygons(ctx, polygonGeometry) {\n var pointBBox = [\n Infinity,\n Infinity,\n -Infinity,\n -Infinity\n ];\n var polyBBox = [\n Infinity,\n Infinity,\n -Infinity,\n -Infinity\n ];\n var canonical = ctx.canonicalID();\n if (polygonGeometry.type === \"Polygon\") {\n var tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);\n var tilePoints = getTilePoints(ctx.geometry(), pointBBox, polyBBox, canonical);\n if (!boxWithinBox(pointBBox, polyBBox)) {\n return false;\n }\n for (var i = 0, list = tilePoints; i < list.length; i += 1) {\n var point = list[i];\n if (!pointWithinPolygon(point, tilePolygon)) {\n return false;\n }\n }\n }\n if (polygonGeometry.type === \"MultiPolygon\") {\n var tilePolygons = getTilePolygons(polygonGeometry.coordinates, polyBBox, canonical);\n var tilePoints$1 = getTilePoints(ctx.geometry(), pointBBox, polyBBox, canonical);\n if (!boxWithinBox(pointBBox, polyBBox)) {\n return false;\n }\n for (var i$1 = 0, list$1 = tilePoints$1; i$1 < list$1.length; i$1 += 1) {\n var point$1 = list$1[i$1];\n if (!pointWithinPolygons(point$1, tilePolygons)) {\n return false;\n }\n }\n }\n return true;\n }\n function linesWithinPolygons(ctx, polygonGeometry) {\n var lineBBox = [\n Infinity,\n Infinity,\n -Infinity,\n -Infinity\n ];\n var polyBBox = [\n Infinity,\n Infinity,\n -Infinity,\n -Infinity\n ];\n var canonical = ctx.canonicalID();\n if (polygonGeometry.type === \"Polygon\") {\n var tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);\n var tileLines = getTileLines(ctx.geometry(), lineBBox, polyBBox, canonical);\n if (!boxWithinBox(lineBBox, polyBBox)) {\n return false;\n }\n for (var i = 0, list = tileLines; i < list.length; i += 1) {\n var line = list[i];\n if (!lineStringWithinPolygon(line, tilePolygon)) {\n return false;\n }\n }\n }\n if (polygonGeometry.type === \"MultiPolygon\") {\n var tilePolygons = getTilePolygons(polygonGeometry.coordinates, polyBBox, canonical);\n var tileLines$1 = getTileLines(ctx.geometry(), lineBBox, polyBBox, canonical);\n if (!boxWithinBox(lineBBox, polyBBox)) {\n return false;\n }\n for (var i$1 = 0, list$1 = tileLines$1; i$1 < list$1.length; i$1 += 1) {\n var line$1 = list$1[i$1];\n if (!lineStringWithinPolygons(line$1, tilePolygons)) {\n return false;\n }\n }\n }\n return true;\n }\n var Within = function Within2(geojson, geometries) {\n this.type = BooleanType;\n this.geojson = geojson;\n this.geometries = geometries;\n };\n Within.parse = function parse2(args, context) {\n if (args.length !== 2) {\n return context.error(\"'within' expression requires exactly one argument, but found \" + (args.length - 1) + \" instead.\");\n }\n if (isValue(args[1])) {\n var geojson = args[1];\n if (geojson.type === \"FeatureCollection\") {\n for (var i = 0; i < geojson.features.length; ++i) {\n var type = geojson.features[i].geometry.type;\n if (type === \"Polygon\" || type === \"MultiPolygon\") {\n return new Within(geojson, geojson.features[i].geometry);\n }\n }\n } else if (geojson.type === \"Feature\") {\n var type$1 = geojson.geometry.type;\n if (type$1 === \"Polygon\" || type$1 === \"MultiPolygon\") {\n return new Within(geojson, geojson.geometry);\n }\n } else if (geojson.type === \"Polygon\" || geojson.type === \"MultiPolygon\") {\n return new Within(geojson, geojson);\n }\n }\n return context.error(\"'within' expression requires valid geojson object that contains polygon geometry type.\");\n };\n Within.prototype.evaluate = function evaluate(ctx) {\n if (ctx.geometry() != null && ctx.canonicalID() != null) {\n if (ctx.geometryType() === \"Point\") {\n return pointsWithinPolygons(ctx, this.geometries);\n } else if (ctx.geometryType() === \"LineString\") {\n return linesWithinPolygons(ctx, this.geometries);\n }\n }\n return false;\n };\n Within.prototype.eachChild = function eachChild() {\n };\n Within.prototype.outputDefined = function outputDefined() {\n return true;\n };\n Within.prototype.serialize = function serialize2() {\n return [\n \"within\",\n this.geojson\n ];\n };\n function isFeatureConstant(e) {\n if (e instanceof CompoundExpression) {\n if (e.name === \"get\" && e.args.length === 1) {\n return false;\n } else if (e.name === \"feature-state\") {\n return false;\n } else if (e.name === \"has\" && e.args.length === 1) {\n return false;\n } else if (e.name === \"properties\" || e.name === \"geometry-type\" || e.name === \"id\") {\n return false;\n } else if (/^filter-/.test(e.name)) {\n return false;\n }\n }\n if (e instanceof Within) {\n return false;\n }\n var result = true;\n e.eachChild(function(arg) {\n if (result && !isFeatureConstant(arg)) {\n result = false;\n }\n });\n return result;\n }\n function isStateConstant(e) {\n if (e instanceof CompoundExpression) {\n if (e.name === \"feature-state\") {\n return false;\n }\n }\n var result = true;\n e.eachChild(function(arg) {\n if (result && !isStateConstant(arg)) {\n result = false;\n }\n });\n return result;\n }\n function isGlobalPropertyConstant(e, properties2) {\n if (e instanceof CompoundExpression && properties2.indexOf(e.name) >= 0) {\n return false;\n }\n var result = true;\n e.eachChild(function(arg) {\n if (result && !isGlobalPropertyConstant(arg, properties2)) {\n result = false;\n }\n });\n return result;\n }\n var Var = function Var2(name3, boundExpression) {\n this.type = boundExpression.type;\n this.name = name3;\n this.boundExpression = boundExpression;\n };\n Var.parse = function parse2(args, context) {\n if (args.length !== 2 || typeof args[1] !== \"string\") {\n return context.error(\"'var' expression requires exactly one string literal argument.\");\n }\n var name3 = args[1];\n if (!context.scope.has(name3)) {\n return context.error('Unknown variable \"' + name3 + '\". Make sure \"' + name3 + '\" has been bound in an enclosing \"let\" expression before using it.', 1);\n }\n return new Var(name3, context.scope.get(name3));\n };\n Var.prototype.evaluate = function evaluate(ctx) {\n return this.boundExpression.evaluate(ctx);\n };\n Var.prototype.eachChild = function eachChild() {\n };\n Var.prototype.outputDefined = function outputDefined() {\n return false;\n };\n Var.prototype.serialize = function serialize2() {\n return [\n \"var\",\n this.name\n ];\n };\n var ParsingContext = function ParsingContext2(registry2, path, expectedType, scope, errors) {\n if (path === void 0)\n path = [];\n if (scope === void 0)\n scope = new Scope();\n if (errors === void 0)\n errors = [];\n this.registry = registry2;\n this.path = path;\n this.key = path.map(function(part) {\n return \"[\" + part + \"]\";\n }).join(\"\");\n this.scope = scope;\n this.errors = errors;\n this.expectedType = expectedType;\n };\n ParsingContext.prototype.parse = function parse2(expr, index, expectedType, bindings, options) {\n if (options === void 0)\n options = {};\n if (index) {\n return this.concat(index, expectedType, bindings)._parse(expr, options);\n }\n return this._parse(expr, options);\n };\n ParsingContext.prototype._parse = function _parse(expr, options) {\n if (expr === null || typeof expr === \"string\" || typeof expr === \"boolean\" || typeof expr === \"number\") {\n expr = [\n \"literal\",\n expr\n ];\n }\n function annotate(parsed2, type, typeAnnotation) {\n if (typeAnnotation === \"assert\") {\n return new Assertion(type, [parsed2]);\n } else if (typeAnnotation === \"coerce\") {\n return new Coercion(type, [parsed2]);\n } else {\n return parsed2;\n }\n }\n if (Array.isArray(expr)) {\n if (expr.length === 0) {\n return this.error('Expected an array with at least one element. If you wanted a literal array, use [\"literal\", []].');\n }\n var op = expr[0];\n if (typeof op !== \"string\") {\n this.error(\"Expression name must be a string, but found \" + typeof op + ' instead. If you wanted a literal array, use [\"literal\", [...]].', 0);\n return null;\n }\n var Expr = this.registry[op];\n if (Expr) {\n var parsed = Expr.parse(expr, this);\n if (!parsed) {\n return null;\n }\n if (this.expectedType) {\n var expected = this.expectedType;\n var actual = parsed.type;\n if ((expected.kind === \"string\" || expected.kind === \"number\" || expected.kind === \"boolean\" || expected.kind === \"object\" || expected.kind === \"array\") && actual.kind === \"value\") {\n parsed = annotate(parsed, expected, options.typeAnnotation || \"assert\");\n } else if ((expected.kind === \"color\" || expected.kind === \"formatted\" || expected.kind === \"resolvedImage\") && (actual.kind === \"value\" || actual.kind === \"string\")) {\n parsed = annotate(parsed, expected, options.typeAnnotation || \"coerce\");\n } else if (this.checkSubtype(expected, actual)) {\n return null;\n }\n }\n if (!(parsed instanceof Literal) && parsed.type.kind !== \"resolvedImage\" && isConstant(parsed)) {\n var ec = new EvaluationContext();\n try {\n parsed = new Literal(parsed.type, parsed.evaluate(ec));\n } catch (e) {\n this.error(e.message);\n return null;\n }\n }\n return parsed;\n }\n return this.error('Unknown expression \"' + op + '\". If you wanted a literal array, use [\"literal\", [...]].', 0);\n } else if (typeof expr === \"undefined\") {\n return this.error(\"'undefined' value invalid. Use null instead.\");\n } else if (typeof expr === \"object\") {\n return this.error('Bare objects invalid. Use [\"literal\", {...}] instead.');\n } else {\n return this.error(\"Expected an array, but found \" + typeof expr + \" instead.\");\n }\n };\n ParsingContext.prototype.concat = function concat(index, expectedType, bindings) {\n var path = typeof index === \"number\" ? this.path.concat(index) : this.path;\n var scope = bindings ? this.scope.concat(bindings) : this.scope;\n return new ParsingContext(this.registry, path, expectedType || null, scope, this.errors);\n };\n ParsingContext.prototype.error = function error2(error$1) {\n var keys = [], len = arguments.length - 1;\n while (len-- > 0)\n keys[len] = arguments[len + 1];\n var key = \"\" + this.key + keys.map(function(k) {\n return \"[\" + k + \"]\";\n }).join(\"\");\n this.errors.push(new ParsingError(key, error$1));\n };\n ParsingContext.prototype.checkSubtype = function checkSubtype$1(expected, t) {\n var error2 = checkSubtype(expected, t);\n if (error2) {\n this.error(error2);\n }\n return error2;\n };\n function isConstant(expression2) {\n if (expression2 instanceof Var) {\n return isConstant(expression2.boundExpression);\n } else if (expression2 instanceof CompoundExpression && expression2.name === \"error\") {\n return false;\n } else if (expression2 instanceof CollatorExpression) {\n return false;\n } else if (expression2 instanceof Within) {\n return false;\n }\n var isTypeAnnotation = expression2 instanceof Coercion || expression2 instanceof Assertion;\n var childrenConstant = true;\n expression2.eachChild(function(child) {\n if (isTypeAnnotation) {\n childrenConstant = childrenConstant && isConstant(child);\n } else {\n childrenConstant = childrenConstant && child instanceof Literal;\n }\n });\n if (!childrenConstant) {\n return false;\n }\n return isFeatureConstant(expression2) && isGlobalPropertyConstant(expression2, [\n \"zoom\",\n \"heatmap-density\",\n \"line-progress\",\n \"accumulated\",\n \"is-supported-script\"\n ]);\n }\n function findStopLessThanOrEqualTo(stops, input) {\n var lastIndex = stops.length - 1;\n var lowerIndex = 0;\n var upperIndex = lastIndex;\n var currentIndex = 0;\n var currentValue, nextValue;\n while (lowerIndex <= upperIndex) {\n currentIndex = Math.floor((lowerIndex + upperIndex) / 2);\n currentValue = stops[currentIndex];\n nextValue = stops[currentIndex + 1];\n if (currentValue <= input) {\n if (currentIndex === lastIndex || input < nextValue) {\n return currentIndex;\n }\n lowerIndex = currentIndex + 1;\n } else if (currentValue > input) {\n upperIndex = currentIndex - 1;\n } else {\n throw new RuntimeError(\"Input is not a number.\");\n }\n }\n return 0;\n }\n var Step = function Step2(type, input, stops) {\n this.type = type;\n this.input = input;\n this.labels = [];\n this.outputs = [];\n for (var i = 0, list = stops; i < list.length; i += 1) {\n var ref = list[i];\n var label = ref[0];\n var expression2 = ref[1];\n this.labels.push(label);\n this.outputs.push(expression2);\n }\n };\n Step.parse = function parse2(args, context) {\n if (args.length - 1 < 4) {\n return context.error(\"Expected at least 4 arguments, but found only \" + (args.length - 1) + \".\");\n }\n if ((args.length - 1) % 2 !== 0) {\n return context.error(\"Expected an even number of arguments.\");\n }\n var input = context.parse(args[1], 1, NumberType);\n if (!input) {\n return null;\n }\n var stops = [];\n var outputType = null;\n if (context.expectedType && context.expectedType.kind !== \"value\") {\n outputType = context.expectedType;\n }\n for (var i = 1; i < args.length; i += 2) {\n var label = i === 1 ? -Infinity : args[i];\n var value = args[i + 1];\n var labelKey = i;\n var valueKey = i + 1;\n if (typeof label !== \"number\") {\n return context.error('Input/output pairs for \"step\" expressions must be defined using literal numeric values (not computed expressions) for the input values.', labelKey);\n }\n if (stops.length && stops[stops.length - 1][0] >= label) {\n return context.error('Input/output pairs for \"step\" expressions must be arranged with input values in strictly ascending order.', labelKey);\n }\n var parsed = context.parse(value, valueKey, outputType);\n if (!parsed) {\n return null;\n }\n outputType = outputType || parsed.type;\n stops.push([\n label,\n parsed\n ]);\n }\n return new Step(outputType, input, stops);\n };\n Step.prototype.evaluate = function evaluate(ctx) {\n var labels = this.labels;\n var outputs = this.outputs;\n if (labels.length === 1) {\n return outputs[0].evaluate(ctx);\n }\n var value = this.input.evaluate(ctx);\n if (value <= labels[0]) {\n return outputs[0].evaluate(ctx);\n }\n var stopCount = labels.length;\n if (value >= labels[stopCount - 1]) {\n return outputs[stopCount - 1].evaluate(ctx);\n }\n var index = findStopLessThanOrEqualTo(labels, value);\n return outputs[index].evaluate(ctx);\n };\n Step.prototype.eachChild = function eachChild(fn) {\n fn(this.input);\n for (var i = 0, list = this.outputs; i < list.length; i += 1) {\n var expression2 = list[i];\n fn(expression2);\n }\n };\n Step.prototype.outputDefined = function outputDefined() {\n return this.outputs.every(function(out) {\n return out.outputDefined();\n });\n };\n Step.prototype.serialize = function serialize2() {\n var serialized = [\n \"step\",\n this.input.serialize()\n ];\n for (var i = 0; i < this.labels.length; i++) {\n if (i > 0) {\n serialized.push(this.labels[i]);\n }\n serialized.push(this.outputs[i].serialize());\n }\n return serialized;\n };\n function number(a, b, t) {\n return a * (1 - t) + b * t;\n }\n function color2(from, to, t) {\n return new Color2(number(from.r, to.r, t), number(from.g, to.g, t), number(from.b, to.b, t), number(from.a, to.a, t));\n }\n function array$1(from, to, t) {\n return from.map(function(d, i) {\n return number(d, to[i], t);\n });\n }\n var interpolate = /* @__PURE__ */ Object.freeze({\n __proto__: null,\n number,\n color: color2,\n array: array$1\n });\n var Xn2 = 0.95047, Yn2 = 1, Zn2 = 1.08883, t02 = 4 / 29, t12 = 6 / 29, t22 = 3 * t12 * t12, t32 = t12 * t12 * t12, deg2rad = Math.PI / 180, rad2deg = 180 / Math.PI;\n function xyz2lab2(t) {\n return t > t32 ? Math.pow(t, 1 / 3) : t / t22 + t02;\n }\n function lab2xyz2(t) {\n return t > t12 ? t * t * t : t22 * (t - t02);\n }\n function xyz2rgb(x) {\n return 255 * (x <= 31308e-7 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n }\n function rgb2xyz(x) {\n x /= 255;\n return x <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n }\n function rgbToLab(rgbColor) {\n var b = rgb2xyz(rgbColor.r), a = rgb2xyz(rgbColor.g), l = rgb2xyz(rgbColor.b), x = xyz2lab2((0.4124564 * b + 0.3575761 * a + 0.1804375 * l) / Xn2), y = xyz2lab2((0.2126729 * b + 0.7151522 * a + 0.072175 * l) / Yn2), z = xyz2lab2((0.0193339 * b + 0.119192 * a + 0.9503041 * l) / Zn2);\n return {\n l: 116 * y - 16,\n a: 500 * (x - y),\n b: 200 * (y - z),\n alpha: rgbColor.a\n };\n }\n function labToRgb(labColor) {\n var y = (labColor.l + 16) / 116, x = isNaN(labColor.a) ? y : y + labColor.a / 500, z = isNaN(labColor.b) ? y : y - labColor.b / 200;\n y = Yn2 * lab2xyz2(y);\n x = Xn2 * lab2xyz2(x);\n z = Zn2 * lab2xyz2(z);\n return new Color2(xyz2rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z), xyz2rgb(-0.969266 * x + 1.8760108 * y + 0.041556 * z), xyz2rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z), labColor.alpha);\n }\n function interpolateLab(from, to, t) {\n return {\n l: number(from.l, to.l, t),\n a: number(from.a, to.a, t),\n b: number(from.b, to.b, t),\n alpha: number(from.alpha, to.alpha, t)\n };\n }\n function rgbToHcl(rgbColor) {\n var ref = rgbToLab(rgbColor);\n var l = ref.l;\n var a = ref.a;\n var b = ref.b;\n var h = Math.atan2(b, a) * rad2deg;\n return {\n h: h < 0 ? h + 360 : h,\n c: Math.sqrt(a * a + b * b),\n l,\n alpha: rgbColor.a\n };\n }\n function hclToRgb(hclColor) {\n var h = hclColor.h * deg2rad, c = hclColor.c, l = hclColor.l;\n return labToRgb({\n l,\n a: Math.cos(h) * c,\n b: Math.sin(h) * c,\n alpha: hclColor.alpha\n });\n }\n function interpolateHue(a, b, t) {\n var d = b - a;\n return a + t * (d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d);\n }\n function interpolateHcl(from, to, t) {\n return {\n h: interpolateHue(from.h, to.h, t),\n c: number(from.c, to.c, t),\n l: number(from.l, to.l, t),\n alpha: number(from.alpha, to.alpha, t)\n };\n }\n var lab3 = {\n forward: rgbToLab,\n reverse: labToRgb,\n interpolate: interpolateLab\n };\n var hcl3 = {\n forward: rgbToHcl,\n reverse: hclToRgb,\n interpolate: interpolateHcl\n };\n var colorSpaces = /* @__PURE__ */ Object.freeze({\n __proto__: null,\n lab: lab3,\n hcl: hcl3\n });\n var Interpolate = function Interpolate2(type, operator, interpolation, input, stops) {\n this.type = type;\n this.operator = operator;\n this.interpolation = interpolation;\n this.input = input;\n this.labels = [];\n this.outputs = [];\n for (var i = 0, list = stops; i < list.length; i += 1) {\n var ref = list[i];\n var label = ref[0];\n var expression2 = ref[1];\n this.labels.push(label);\n this.outputs.push(expression2);\n }\n };\n Interpolate.interpolationFactor = function interpolationFactor2(interpolation, input, lower, upper) {\n var t = 0;\n if (interpolation.name === \"exponential\") {\n t = exponentialInterpolation(input, interpolation.base, lower, upper);\n } else if (interpolation.name === \"linear\") {\n t = exponentialInterpolation(input, 1, lower, upper);\n } else if (interpolation.name === \"cubic-bezier\") {\n var c = interpolation.controlPoints;\n var ub = new unitbezier(c[0], c[1], c[2], c[3]);\n t = ub.solve(exponentialInterpolation(input, 1, lower, upper));\n }\n return t;\n };\n Interpolate.parse = function parse2(args, context) {\n var operator = args[0];\n var interpolation = args[1];\n var input = args[2];\n var rest = args.slice(3);\n if (!Array.isArray(interpolation) || interpolation.length === 0) {\n return context.error(\"Expected an interpolation type expression.\", 1);\n }\n if (interpolation[0] === \"linear\") {\n interpolation = { name: \"linear\" };\n } else if (interpolation[0] === \"exponential\") {\n var base = interpolation[1];\n if (typeof base !== \"number\") {\n return context.error(\"Exponential interpolation requires a numeric base.\", 1, 1);\n }\n interpolation = {\n name: \"exponential\",\n base\n };\n } else if (interpolation[0] === \"cubic-bezier\") {\n var controlPoints = interpolation.slice(1);\n if (controlPoints.length !== 4 || controlPoints.some(function(t) {\n return typeof t !== \"number\" || t < 0 || t > 1;\n })) {\n return context.error(\"Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.\", 1);\n }\n interpolation = {\n name: \"cubic-bezier\",\n controlPoints\n };\n } else {\n return context.error(\"Unknown interpolation type \" + String(interpolation[0]), 1, 0);\n }\n if (args.length - 1 < 4) {\n return context.error(\"Expected at least 4 arguments, but found only \" + (args.length - 1) + \".\");\n }\n if ((args.length - 1) % 2 !== 0) {\n return context.error(\"Expected an even number of arguments.\");\n }\n input = context.parse(input, 2, NumberType);\n if (!input) {\n return null;\n }\n var stops = [];\n var outputType = null;\n if (operator === \"interpolate-hcl\" || operator === \"interpolate-lab\") {\n outputType = ColorType;\n } else if (context.expectedType && context.expectedType.kind !== \"value\") {\n outputType = context.expectedType;\n }\n for (var i = 0; i < rest.length; i += 2) {\n var label = rest[i];\n var value = rest[i + 1];\n var labelKey = i + 3;\n var valueKey = i + 4;\n if (typeof label !== \"number\") {\n return context.error('Input/output pairs for \"interpolate\" expressions must be defined using literal numeric values (not computed expressions) for the input values.', labelKey);\n }\n if (stops.length && stops[stops.length - 1][0] >= label) {\n return context.error('Input/output pairs for \"interpolate\" expressions must be arranged with input values in strictly ascending order.', labelKey);\n }\n var parsed = context.parse(value, valueKey, outputType);\n if (!parsed) {\n return null;\n }\n outputType = outputType || parsed.type;\n stops.push([\n label,\n parsed\n ]);\n }\n if (outputType.kind !== \"number\" && outputType.kind !== \"color\" && !(outputType.kind === \"array\" && outputType.itemType.kind === \"number\" && typeof outputType.N === \"number\")) {\n return context.error(\"Type \" + toString(outputType) + \" is not interpolatable.\");\n }\n return new Interpolate(outputType, operator, interpolation, input, stops);\n };\n Interpolate.prototype.evaluate = function evaluate(ctx) {\n var labels = this.labels;\n var outputs = this.outputs;\n if (labels.length === 1) {\n return outputs[0].evaluate(ctx);\n }\n var value = this.input.evaluate(ctx);\n if (value <= labels[0]) {\n return outputs[0].evaluate(ctx);\n }\n var stopCount = labels.length;\n if (value >= labels[stopCount - 1]) {\n return outputs[stopCount - 1].evaluate(ctx);\n }\n var index = findStopLessThanOrEqualTo(labels, value);\n var lower = labels[index];\n var upper = labels[index + 1];\n var t = Interpolate.interpolationFactor(this.interpolation, value, lower, upper);\n var outputLower = outputs[index].evaluate(ctx);\n var outputUpper = outputs[index + 1].evaluate(ctx);\n if (this.operator === \"interpolate\") {\n return interpolate[this.type.kind.toLowerCase()](outputLower, outputUpper, t);\n } else if (this.operator === \"interpolate-hcl\") {\n return hcl3.reverse(hcl3.interpolate(hcl3.forward(outputLower), hcl3.forward(outputUpper), t));\n } else {\n return lab3.reverse(lab3.interpolate(lab3.forward(outputLower), lab3.forward(outputUpper), t));\n }\n };\n Interpolate.prototype.eachChild = function eachChild(fn) {\n fn(this.input);\n for (var i = 0, list = this.outputs; i < list.length; i += 1) {\n var expression2 = list[i];\n fn(expression2);\n }\n };\n Interpolate.prototype.outputDefined = function outputDefined() {\n return this.outputs.every(function(out) {\n return out.outputDefined();\n });\n };\n Interpolate.prototype.serialize = function serialize2() {\n var interpolation;\n if (this.interpolation.name === \"linear\") {\n interpolation = [\"linear\"];\n } else if (this.interpolation.name === \"exponential\") {\n if (this.interpolation.base === 1) {\n interpolation = [\"linear\"];\n } else {\n interpolation = [\n \"exponential\",\n this.interpolation.base\n ];\n }\n } else {\n interpolation = [\"cubic-bezier\"].concat(this.interpolation.controlPoints);\n }\n var serialized = [\n this.operator,\n interpolation,\n this.input.serialize()\n ];\n for (var i = 0; i < this.labels.length; i++) {\n serialized.push(this.labels[i], this.outputs[i].serialize());\n }\n return serialized;\n };\n function exponentialInterpolation(input, base, lowerValue, upperValue) {\n var difference = upperValue - lowerValue;\n var progress = input - lowerValue;\n if (difference === 0) {\n return 0;\n } else if (base === 1) {\n return progress / difference;\n } else {\n return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);\n }\n }\n var Coalesce = function Coalesce2(type, args) {\n this.type = type;\n this.args = args;\n };\n Coalesce.parse = function parse2(args, context) {\n if (args.length < 2) {\n return context.error(\"Expectected at least one argument.\");\n }\n var outputType = null;\n var expectedType = context.expectedType;\n if (expectedType && expectedType.kind !== \"value\") {\n outputType = expectedType;\n }\n var parsedArgs = [];\n for (var i = 0, list = args.slice(1); i < list.length; i += 1) {\n var arg = list[i];\n var parsed = context.parse(arg, 1 + parsedArgs.length, outputType, void 0, { typeAnnotation: \"omit\" });\n if (!parsed) {\n return null;\n }\n outputType = outputType || parsed.type;\n parsedArgs.push(parsed);\n }\n var needsAnnotation = expectedType && parsedArgs.some(function(arg2) {\n return checkSubtype(expectedType, arg2.type);\n });\n return needsAnnotation ? new Coalesce(ValueType, parsedArgs) : new Coalesce(outputType, parsedArgs);\n };\n Coalesce.prototype.evaluate = function evaluate(ctx) {\n var result = null;\n var argCount = 0;\n var requestedImageName;\n for (var i = 0, list = this.args; i < list.length; i += 1) {\n var arg = list[i];\n argCount++;\n result = arg.evaluate(ctx);\n if (result && result instanceof ResolvedImage && !result.available) {\n if (!requestedImageName) {\n requestedImageName = result.name;\n }\n result = null;\n if (argCount === this.args.length) {\n result = requestedImageName;\n }\n }\n if (result !== null) {\n break;\n }\n }\n return result;\n };\n Coalesce.prototype.eachChild = function eachChild(fn) {\n this.args.forEach(fn);\n };\n Coalesce.prototype.outputDefined = function outputDefined() {\n return this.args.every(function(arg) {\n return arg.outputDefined();\n });\n };\n Coalesce.prototype.serialize = function serialize2() {\n var serialized = [\"coalesce\"];\n this.eachChild(function(child) {\n serialized.push(child.serialize());\n });\n return serialized;\n };\n var Let = function Let2(bindings, result) {\n this.type = result.type;\n this.bindings = [].concat(bindings);\n this.result = result;\n };\n Let.prototype.evaluate = function evaluate(ctx) {\n return this.result.evaluate(ctx);\n };\n Let.prototype.eachChild = function eachChild(fn) {\n for (var i = 0, list = this.bindings; i < list.length; i += 1) {\n var binding = list[i];\n fn(binding[1]);\n }\n fn(this.result);\n };\n Let.parse = function parse2(args, context) {\n if (args.length < 4) {\n return context.error(\"Expected at least 3 arguments, but found \" + (args.length - 1) + \" instead.\");\n }\n var bindings = [];\n for (var i = 1; i < args.length - 1; i += 2) {\n var name3 = args[i];\n if (typeof name3 !== \"string\") {\n return context.error(\"Expected string, but found \" + typeof name3 + \" instead.\", i);\n }\n if (/[^a-zA-Z0-9_]/.test(name3)) {\n return context.error(\"Variable names must contain only alphanumeric characters or '_'.\", i);\n }\n var value = context.parse(args[i + 1], i + 1);\n if (!value) {\n return null;\n }\n bindings.push([\n name3,\n value\n ]);\n }\n var result = context.parse(args[args.length - 1], args.length - 1, context.expectedType, bindings);\n if (!result) {\n return null;\n }\n return new Let(bindings, result);\n };\n Let.prototype.outputDefined = function outputDefined() {\n return this.result.outputDefined();\n };\n Let.prototype.serialize = function serialize2() {\n var serialized = [\"let\"];\n for (var i = 0, list = this.bindings; i < list.length; i += 1) {\n var ref = list[i];\n var name3 = ref[0];\n var expr = ref[1];\n serialized.push(name3, expr.serialize());\n }\n serialized.push(this.result.serialize());\n return serialized;\n };\n var At = function At2(type, index, input) {\n this.type = type;\n this.index = index;\n this.input = input;\n };\n At.parse = function parse2(args, context) {\n if (args.length !== 3) {\n return context.error(\"Expected 2 arguments, but found \" + (args.length - 1) + \" instead.\");\n }\n var index = context.parse(args[1], 1, NumberType);\n var input = context.parse(args[2], 2, array(context.expectedType || ValueType));\n if (!index || !input) {\n return null;\n }\n var t = input.type;\n return new At(t.itemType, index, input);\n };\n At.prototype.evaluate = function evaluate(ctx) {\n var index = this.index.evaluate(ctx);\n var array2 = this.input.evaluate(ctx);\n if (index < 0) {\n throw new RuntimeError(\"Array index out of bounds: \" + index + \" < 0.\");\n }\n if (index >= array2.length) {\n throw new RuntimeError(\"Array index out of bounds: \" + index + \" > \" + (array2.length - 1) + \".\");\n }\n if (index !== Math.floor(index)) {\n throw new RuntimeError(\"Array index must be an integer, but found \" + index + \" instead.\");\n }\n return array2[index];\n };\n At.prototype.eachChild = function eachChild(fn) {\n fn(this.index);\n fn(this.input);\n };\n At.prototype.outputDefined = function outputDefined() {\n return false;\n };\n At.prototype.serialize = function serialize2() {\n return [\n \"at\",\n this.index.serialize(),\n this.input.serialize()\n ];\n };\n var In = function In2(needle, haystack) {\n this.type = BooleanType;\n this.needle = needle;\n this.haystack = haystack;\n };\n In.parse = function parse2(args, context) {\n if (args.length !== 3) {\n return context.error(\"Expected 2 arguments, but found \" + (args.length - 1) + \" instead.\");\n }\n var needle = context.parse(args[1], 1, ValueType);\n var haystack = context.parse(args[2], 2, ValueType);\n if (!needle || !haystack) {\n return null;\n }\n if (!isValidType(needle.type, [\n BooleanType,\n StringType,\n NumberType,\n NullType,\n ValueType\n ])) {\n return context.error(\"Expected first argument to be of type boolean, string, number or null, but found \" + toString(needle.type) + \" instead\");\n }\n return new In(needle, haystack);\n };\n In.prototype.evaluate = function evaluate(ctx) {\n var needle = this.needle.evaluate(ctx);\n var haystack = this.haystack.evaluate(ctx);\n if (!haystack) {\n return false;\n }\n if (!isValidNativeType(needle, [\n \"boolean\",\n \"string\",\n \"number\",\n \"null\"\n ])) {\n throw new RuntimeError(\"Expected first argument to be of type boolean, string, number or null, but found \" + toString(typeOf(needle)) + \" instead.\");\n }\n if (!isValidNativeType(haystack, [\n \"string\",\n \"array\"\n ])) {\n throw new RuntimeError(\"Expected second argument to be of type array or string, but found \" + toString(typeOf(haystack)) + \" instead.\");\n }\n return haystack.indexOf(needle) >= 0;\n };\n In.prototype.eachChild = function eachChild(fn) {\n fn(this.needle);\n fn(this.haystack);\n };\n In.prototype.outputDefined = function outputDefined() {\n return true;\n };\n In.prototype.serialize = function serialize2() {\n return [\n \"in\",\n this.needle.serialize(),\n this.haystack.serialize()\n ];\n };\n var IndexOf = function IndexOf2(needle, haystack, fromIndex) {\n this.type = NumberType;\n this.needle = needle;\n this.haystack = haystack;\n this.fromIndex = fromIndex;\n };\n IndexOf.parse = function parse2(args, context) {\n if (args.length <= 2 || args.length >= 5) {\n return context.error(\"Expected 3 or 4 arguments, but found \" + (args.length - 1) + \" instead.\");\n }\n var needle = context.parse(args[1], 1, ValueType);\n var haystack = context.parse(args[2], 2, ValueType);\n if (!needle || !haystack) {\n return null;\n }\n if (!isValidType(needle.type, [\n BooleanType,\n StringType,\n NumberType,\n NullType,\n ValueType\n ])) {\n return context.error(\"Expected first argument to be of type boolean, string, number or null, but found \" + toString(needle.type) + \" instead\");\n }\n if (args.length === 4) {\n var fromIndex = context.parse(args[3], 3, NumberType);\n if (!fromIndex) {\n return null;\n }\n return new IndexOf(needle, haystack, fromIndex);\n } else {\n return new IndexOf(needle, haystack);\n }\n };\n IndexOf.prototype.evaluate = function evaluate(ctx) {\n var needle = this.needle.evaluate(ctx);\n var haystack = this.haystack.evaluate(ctx);\n if (!isValidNativeType(needle, [\n \"boolean\",\n \"string\",\n \"number\",\n \"null\"\n ])) {\n throw new RuntimeError(\"Expected first argument to be of type boolean, string, number or null, but found \" + toString(typeOf(needle)) + \" instead.\");\n }\n if (!isValidNativeType(haystack, [\n \"string\",\n \"array\"\n ])) {\n throw new RuntimeError(\"Expected second argument to be of type array or string, but found \" + toString(typeOf(haystack)) + \" instead.\");\n }\n if (this.fromIndex) {\n var fromIndex = this.fromIndex.evaluate(ctx);\n return haystack.indexOf(needle, fromIndex);\n }\n return haystack.indexOf(needle);\n };\n IndexOf.prototype.eachChild = function eachChild(fn) {\n fn(this.needle);\n fn(this.haystack);\n if (this.fromIndex) {\n fn(this.fromIndex);\n }\n };\n IndexOf.prototype.outputDefined = function outputDefined() {\n return false;\n };\n IndexOf.prototype.serialize = function serialize2() {\n if (this.fromIndex != null && this.fromIndex !== void 0) {\n var fromIndex = this.fromIndex.serialize();\n return [\n \"index-of\",\n this.needle.serialize(),\n this.haystack.serialize(),\n fromIndex\n ];\n }\n return [\n \"index-of\",\n this.needle.serialize(),\n this.haystack.serialize()\n ];\n };\n var Match = function Match2(inputType, outputType, input, cases, outputs, otherwise) {\n this.inputType = inputType;\n this.type = outputType;\n this.input = input;\n this.cases = cases;\n this.outputs = outputs;\n this.otherwise = otherwise;\n };\n Match.parse = function parse2(args, context) {\n if (args.length < 5) {\n return context.error(\"Expected at least 4 arguments, but found only \" + (args.length - 1) + \".\");\n }\n if (args.length % 2 !== 1) {\n return context.error(\"Expected an even number of arguments.\");\n }\n var inputType;\n var outputType;\n if (context.expectedType && context.expectedType.kind !== \"value\") {\n outputType = context.expectedType;\n }\n var cases = {};\n var outputs = [];\n for (var i = 2; i < args.length - 1; i += 2) {\n var labels = args[i];\n var value = args[i + 1];\n if (!Array.isArray(labels)) {\n labels = [labels];\n }\n var labelContext = context.concat(i);\n if (labels.length === 0) {\n return labelContext.error(\"Expected at least one branch label.\");\n }\n for (var i$1 = 0, list = labels; i$1 < list.length; i$1 += 1) {\n var label = list[i$1];\n if (typeof label !== \"number\" && typeof label !== \"string\") {\n return labelContext.error(\"Branch labels must be numbers or strings.\");\n } else if (typeof label === \"number\" && Math.abs(label) > Number.MAX_SAFE_INTEGER) {\n return labelContext.error(\"Branch labels must be integers no larger than \" + Number.MAX_SAFE_INTEGER + \".\");\n } else if (typeof label === \"number\" && Math.floor(label) !== label) {\n return labelContext.error(\"Numeric branch labels must be integer values.\");\n } else if (!inputType) {\n inputType = typeOf(label);\n } else if (labelContext.checkSubtype(inputType, typeOf(label))) {\n return null;\n }\n if (typeof cases[String(label)] !== \"undefined\") {\n return labelContext.error(\"Branch labels must be unique.\");\n }\n cases[String(label)] = outputs.length;\n }\n var result = context.parse(value, i, outputType);\n if (!result) {\n return null;\n }\n outputType = outputType || result.type;\n outputs.push(result);\n }\n var input = context.parse(args[1], 1, ValueType);\n if (!input) {\n return null;\n }\n var otherwise = context.parse(args[args.length - 1], args.length - 1, outputType);\n if (!otherwise) {\n return null;\n }\n if (input.type.kind !== \"value\" && context.concat(1).checkSubtype(inputType, input.type)) {\n return null;\n }\n return new Match(inputType, outputType, input, cases, outputs, otherwise);\n };\n Match.prototype.evaluate = function evaluate(ctx) {\n var input = this.input.evaluate(ctx);\n var output = typeOf(input) === this.inputType && this.outputs[this.cases[input]] || this.otherwise;\n return output.evaluate(ctx);\n };\n Match.prototype.eachChild = function eachChild(fn) {\n fn(this.input);\n this.outputs.forEach(fn);\n fn(this.otherwise);\n };\n Match.prototype.outputDefined = function outputDefined() {\n return this.outputs.every(function(out) {\n return out.outputDefined();\n }) && this.otherwise.outputDefined();\n };\n Match.prototype.serialize = function serialize2() {\n var this$1 = this;\n var serialized = [\n \"match\",\n this.input.serialize()\n ];\n var sortedLabels = Object.keys(this.cases).sort();\n var groupedByOutput = [];\n var outputLookup = {};\n for (var i = 0, list = sortedLabels; i < list.length; i += 1) {\n var label = list[i];\n var outputIndex = outputLookup[this.cases[label]];\n if (outputIndex === void 0) {\n outputLookup[this.cases[label]] = groupedByOutput.length;\n groupedByOutput.push([\n this.cases[label],\n [label]\n ]);\n } else {\n groupedByOutput[outputIndex][1].push(label);\n }\n }\n var coerceLabel = function(label2) {\n return this$1.inputType.kind === \"number\" ? Number(label2) : label2;\n };\n for (var i$1 = 0, list$1 = groupedByOutput; i$1 < list$1.length; i$1 += 1) {\n var ref = list$1[i$1];\n var outputIndex = ref[0];\n var labels = ref[1];\n if (labels.length === 1) {\n serialized.push(coerceLabel(labels[0]));\n } else {\n serialized.push(labels.map(coerceLabel));\n }\n serialized.push(this.outputs[outputIndex$1].serialize());\n }\n serialized.push(this.otherwise.serialize());\n return serialized;\n };\n var Case = function Case2(type, branches, otherwise) {\n this.type = type;\n this.branches = branches;\n this.otherwise = otherwise;\n };\n Case.parse = function parse2(args, context) {\n if (args.length < 4) {\n return context.error(\"Expected at least 3 arguments, but found only \" + (args.length - 1) + \".\");\n }\n if (args.length % 2 !== 0) {\n return context.error(\"Expected an odd number of arguments.\");\n }\n var outputType;\n if (context.expectedType && context.expectedType.kind !== \"value\") {\n outputType = context.expectedType;\n }\n var branches = [];\n for (var i = 1; i < args.length - 1; i += 2) {\n var test = context.parse(args[i], i, BooleanType);\n if (!test) {\n return null;\n }\n var result = context.parse(args[i + 1], i + 1, outputType);\n if (!result) {\n return null;\n }\n branches.push([\n test,\n result\n ]);\n outputType = outputType || result.type;\n }\n var otherwise = context.parse(args[args.length - 1], args.length - 1, outputType);\n if (!otherwise) {\n return null;\n }\n return new Case(outputType, branches, otherwise);\n };\n Case.prototype.evaluate = function evaluate(ctx) {\n for (var i = 0, list = this.branches; i < list.length; i += 1) {\n var ref = list[i];\n var test = ref[0];\n var expression2 = ref[1];\n if (test.evaluate(ctx)) {\n return expression2.evaluate(ctx);\n }\n }\n return this.otherwise.evaluate(ctx);\n };\n Case.prototype.eachChild = function eachChild(fn) {\n for (var i = 0, list = this.branches; i < list.length; i += 1) {\n var ref = list[i];\n var test = ref[0];\n var expression2 = ref[1];\n fn(test);\n fn(expression2);\n }\n fn(this.otherwise);\n };\n Case.prototype.outputDefined = function outputDefined() {\n return this.branches.every(function(ref) {\n var _ = ref[0];\n var out = ref[1];\n return out.outputDefined();\n }) && this.otherwise.outputDefined();\n };\n Case.prototype.serialize = function serialize2() {\n var serialized = [\"case\"];\n this.eachChild(function(child) {\n serialized.push(child.serialize());\n });\n return serialized;\n };\n var Slice = function Slice2(type, input, beginIndex, endIndex) {\n this.type = type;\n this.input = input;\n this.beginIndex = beginIndex;\n this.endIndex = endIndex;\n };\n Slice.parse = function parse2(args, context) {\n if (args.length <= 2 || args.length >= 5) {\n return context.error(\"Expected 3 or 4 arguments, but found \" + (args.length - 1) + \" instead.\");\n }\n var input = context.parse(args[1], 1, ValueType);\n var beginIndex = context.parse(args[2], 2, NumberType);\n if (!input || !beginIndex) {\n return null;\n }\n if (!isValidType(input.type, [\n array(ValueType),\n StringType,\n ValueType\n ])) {\n return context.error(\"Expected first argument to be of type array or string, but found \" + toString(input.type) + \" instead\");\n }\n if (args.length === 4) {\n var endIndex = context.parse(args[3], 3, NumberType);\n if (!endIndex) {\n return null;\n }\n return new Slice(input.type, input, beginIndex, endIndex);\n } else {\n return new Slice(input.type, input, beginIndex);\n }\n };\n Slice.prototype.evaluate = function evaluate(ctx) {\n var input = this.input.evaluate(ctx);\n var beginIndex = this.beginIndex.evaluate(ctx);\n if (!isValidNativeType(input, [\n \"string\",\n \"array\"\n ])) {\n throw new RuntimeError(\"Expected first argument to be of type array or string, but found \" + toString(typeOf(input)) + \" instead.\");\n }\n if (this.endIndex) {\n var endIndex = this.endIndex.evaluate(ctx);\n return input.slice(beginIndex, endIndex);\n }\n return input.slice(beginIndex);\n };\n Slice.prototype.eachChild = function eachChild(fn) {\n fn(this.input);\n fn(this.beginIndex);\n if (this.endIndex) {\n fn(this.endIndex);\n }\n };\n Slice.prototype.outputDefined = function outputDefined() {\n return false;\n };\n Slice.prototype.serialize = function serialize2() {\n if (this.endIndex != null && this.endIndex !== void 0) {\n var endIndex = this.endIndex.serialize();\n return [\n \"slice\",\n this.input.serialize(),\n this.beginIndex.serialize(),\n endIndex\n ];\n }\n return [\n \"slice\",\n this.input.serialize(),\n this.beginIndex.serialize()\n ];\n };\n function isComparableType(op, type) {\n if (op === \"==\" || op === \"!=\") {\n return type.kind === \"boolean\" || type.kind === \"string\" || type.kind === \"number\" || type.kind === \"null\" || type.kind === \"value\";\n } else {\n return type.kind === \"string\" || type.kind === \"number\" || type.kind === \"value\";\n }\n }\n function eq(ctx, a, b) {\n return a === b;\n }\n function neq(ctx, a, b) {\n return a !== b;\n }\n function lt(ctx, a, b) {\n return a < b;\n }\n function gt(ctx, a, b) {\n return a > b;\n }\n function lteq(ctx, a, b) {\n return a <= b;\n }\n function gteq(ctx, a, b) {\n return a >= b;\n }\n function eqCollate(ctx, a, b, c) {\n return c.compare(a, b) === 0;\n }\n function neqCollate(ctx, a, b, c) {\n return !eqCollate(ctx, a, b, c);\n }\n function ltCollate(ctx, a, b, c) {\n return c.compare(a, b) < 0;\n }\n function gtCollate(ctx, a, b, c) {\n return c.compare(a, b) > 0;\n }\n function lteqCollate(ctx, a, b, c) {\n return c.compare(a, b) <= 0;\n }\n function gteqCollate(ctx, a, b, c) {\n return c.compare(a, b) >= 0;\n }\n function makeComparison(op, compareBasic, compareWithCollator) {\n var isOrderComparison = op !== \"==\" && op !== \"!=\";\n return function() {\n function Comparison(lhs, rhs, collator) {\n this.type = BooleanType;\n this.lhs = lhs;\n this.rhs = rhs;\n this.collator = collator;\n this.hasUntypedArgument = lhs.type.kind === \"value\" || rhs.type.kind === \"value\";\n }\n Comparison.parse = function parse2(args, context) {\n if (args.length !== 3 && args.length !== 4) {\n return context.error(\"Expected two or three arguments.\");\n }\n var op2 = args[0];\n var lhs = context.parse(args[1], 1, ValueType);\n if (!lhs) {\n return null;\n }\n if (!isComparableType(op2, lhs.type)) {\n return context.concat(1).error('\"' + op2 + `\" comparisons are not supported for type '` + toString(lhs.type) + \"'.\");\n }\n var rhs = context.parse(args[2], 2, ValueType);\n if (!rhs) {\n return null;\n }\n if (!isComparableType(op2, rhs.type)) {\n return context.concat(2).error('\"' + op2 + `\" comparisons are not supported for type '` + toString(rhs.type) + \"'.\");\n }\n if (lhs.type.kind !== rhs.type.kind && lhs.type.kind !== \"value\" && rhs.type.kind !== \"value\") {\n return context.error(\"Cannot compare types '\" + toString(lhs.type) + \"' and '\" + toString(rhs.type) + \"'.\");\n }\n if (isOrderComparison) {\n if (lhs.type.kind === \"value\" && rhs.type.kind !== \"value\") {\n lhs = new Assertion(rhs.type, [lhs]);\n } else if (lhs.type.kind !== \"value\" && rhs.type.kind === \"value\") {\n rhs = new Assertion(lhs.type, [rhs]);\n }\n }\n var collator = null;\n if (args.length === 4) {\n if (lhs.type.kind !== \"string\" && rhs.type.kind !== \"string\" && lhs.type.kind !== \"value\" && rhs.type.kind !== \"value\") {\n return context.error(\"Cannot use collator to compare non-string types.\");\n }\n collator = context.parse(args[3], 3, CollatorType);\n if (!collator) {\n return null;\n }\n }\n return new Comparison(lhs, rhs, collator);\n };\n Comparison.prototype.evaluate = function evaluate(ctx) {\n var lhs = this.lhs.evaluate(ctx);\n var rhs = this.rhs.evaluate(ctx);\n if (isOrderComparison && this.hasUntypedArgument) {\n var lt2 = typeOf(lhs);\n var rt = typeOf(rhs);\n if (lt2.kind !== rt.kind || !(lt2.kind === \"string\" || lt2.kind === \"number\")) {\n throw new RuntimeError('Expected arguments for \"' + op + '\" to be (string, string) or (number, number), but found (' + lt2.kind + \", \" + rt.kind + \") instead.\");\n }\n }\n if (this.collator && !isOrderComparison && this.hasUntypedArgument) {\n var lt$1 = typeOf(lhs);\n var rt$1 = typeOf(rhs);\n if (lt$1.kind !== \"string\" || rt$1.kind !== \"string\") {\n return compareBasic(ctx, lhs, rhs);\n }\n }\n return this.collator ? compareWithCollator(ctx, lhs, rhs, this.collator.evaluate(ctx)) : compareBasic(ctx, lhs, rhs);\n };\n Comparison.prototype.eachChild = function eachChild(fn) {\n fn(this.lhs);\n fn(this.rhs);\n if (this.collator) {\n fn(this.collator);\n }\n };\n Comparison.prototype.outputDefined = function outputDefined() {\n return true;\n };\n Comparison.prototype.serialize = function serialize2() {\n var serialized = [op];\n this.eachChild(function(child) {\n serialized.push(child.serialize());\n });\n return serialized;\n };\n return Comparison;\n }();\n }\n var Equals = makeComparison(\"==\", eq, eqCollate);\n var NotEquals = makeComparison(\"!=\", neq, neqCollate);\n var LessThan = makeComparison(\"<\", lt, ltCollate);\n var GreaterThan = makeComparison(\">\", gt, gtCollate);\n var LessThanOrEqual = makeComparison(\"<=\", lteq, lteqCollate);\n var GreaterThanOrEqual = makeComparison(\">=\", gteq, gteqCollate);\n var NumberFormat = function NumberFormat2(number2, locale, currency, minFractionDigits, maxFractionDigits) {\n this.type = StringType;\n this.number = number2;\n this.locale = locale;\n this.currency = currency;\n this.minFractionDigits = minFractionDigits;\n this.maxFractionDigits = maxFractionDigits;\n };\n NumberFormat.parse = function parse2(args, context) {\n if (args.length !== 3) {\n return context.error(\"Expected two arguments.\");\n }\n var number2 = context.parse(args[1], 1, NumberType);\n if (!number2) {\n return null;\n }\n var options = args[2];\n if (typeof options !== \"object\" || Array.isArray(options)) {\n return context.error(\"NumberFormat options argument must be an object.\");\n }\n var locale = null;\n if (options[\"locale\"]) {\n locale = context.parse(options[\"locale\"], 1, StringType);\n if (!locale) {\n return null;\n }\n }\n var currency = null;\n if (options[\"currency\"]) {\n currency = context.parse(options[\"currency\"], 1, StringType);\n if (!currency) {\n return null;\n }\n }\n var minFractionDigits = null;\n if (options[\"min-fraction-digits\"]) {\n minFractionDigits = context.parse(options[\"min-fraction-digits\"], 1, NumberType);\n if (!minFractionDigits) {\n return null;\n }\n }\n var maxFractionDigits = null;\n if (options[\"max-fraction-digits\"]) {\n maxFractionDigits = context.parse(options[\"max-fraction-digits\"], 1, NumberType);\n if (!maxFractionDigits) {\n return null;\n }\n }\n return new NumberFormat(number2, locale, currency, minFractionDigits, maxFractionDigits);\n };\n NumberFormat.prototype.evaluate = function evaluate(ctx) {\n return new Intl.NumberFormat(this.locale ? this.locale.evaluate(ctx) : [], {\n style: this.currency ? \"currency\" : \"decimal\",\n currency: this.currency ? this.currency.evaluate(ctx) : void 0,\n minimumFractionDigits: this.minFractionDigits ? this.minFractionDigits.evaluate(ctx) : void 0,\n maximumFractionDigits: this.maxFractionDigits ? this.maxFractionDigits.evaluate(ctx) : void 0\n }).format(this.number.evaluate(ctx));\n };\n NumberFormat.prototype.eachChild = function eachChild(fn) {\n fn(this.number);\n if (this.locale) {\n fn(this.locale);\n }\n if (this.currency) {\n fn(this.currency);\n }\n if (this.minFractionDigits) {\n fn(this.minFractionDigits);\n }\n if (this.maxFractionDigits) {\n fn(this.maxFractionDigits);\n }\n };\n NumberFormat.prototype.outputDefined = function outputDefined() {\n return false;\n };\n NumberFormat.prototype.serialize = function serialize2() {\n var options = {};\n if (this.locale) {\n options[\"locale\"] = this.locale.serialize();\n }\n if (this.currency) {\n options[\"currency\"] = this.currency.serialize();\n }\n if (this.minFractionDigits) {\n options[\"min-fraction-digits\"] = this.minFractionDigits.serialize();\n }\n if (this.maxFractionDigits) {\n options[\"max-fraction-digits\"] = this.maxFractionDigits.serialize();\n }\n return [\n \"number-format\",\n this.number.serialize(),\n options\n ];\n };\n var Length = function Length2(input) {\n this.type = NumberType;\n this.input = input;\n };\n Length.parse = function parse2(args, context) {\n if (args.length !== 2) {\n return context.error(\"Expected 1 argument, but found \" + (args.length - 1) + \" instead.\");\n }\n var input = context.parse(args[1], 1);\n if (!input) {\n return null;\n }\n if (input.type.kind !== \"array\" && input.type.kind !== \"string\" && input.type.kind !== \"value\") {\n return context.error(\"Expected argument of type string or array, but found \" + toString(input.type) + \" instead.\");\n }\n return new Length(input);\n };\n Length.prototype.evaluate = function evaluate(ctx) {\n var input = this.input.evaluate(ctx);\n if (typeof input === \"string\") {\n return input.length;\n } else if (Array.isArray(input)) {\n return input.length;\n } else {\n throw new RuntimeError(\"Expected value to be of type string or array, but found \" + toString(typeOf(input)) + \" instead.\");\n }\n };\n Length.prototype.eachChild = function eachChild(fn) {\n fn(this.input);\n };\n Length.prototype.outputDefined = function outputDefined() {\n return false;\n };\n Length.prototype.serialize = function serialize2() {\n var serialized = [\"length\"];\n this.eachChild(function(child) {\n serialized.push(child.serialize());\n });\n return serialized;\n };\n var expressions = {\n \"==\": Equals,\n \"!=\": NotEquals,\n \">\": GreaterThan,\n \"<\": LessThan,\n \">=\": GreaterThanOrEqual,\n \"<=\": LessThanOrEqual,\n \"array\": Assertion,\n \"at\": At,\n \"boolean\": Assertion,\n \"case\": Case,\n \"coalesce\": Coalesce,\n \"collator\": CollatorExpression,\n \"format\": FormatExpression,\n \"image\": ImageExpression,\n \"in\": In,\n \"index-of\": IndexOf,\n \"interpolate\": Interpolate,\n \"interpolate-hcl\": Interpolate,\n \"interpolate-lab\": Interpolate,\n \"length\": Length,\n \"let\": Let,\n \"literal\": Literal,\n \"match\": Match,\n \"number\": Assertion,\n \"number-format\": NumberFormat,\n \"object\": Assertion,\n \"slice\": Slice,\n \"step\": Step,\n \"string\": Assertion,\n \"to-boolean\": Coercion,\n \"to-color\": Coercion,\n \"to-number\": Coercion,\n \"to-string\": Coercion,\n \"var\": Var,\n \"within\": Within\n };\n function rgba3(ctx, ref) {\n var r = ref[0];\n var g = ref[1];\n var b = ref[2];\n var a = ref[3];\n r = r.evaluate(ctx);\n g = g.evaluate(ctx);\n b = b.evaluate(ctx);\n var alpha = a ? a.evaluate(ctx) : 1;\n var error2 = validateRGBA(r, g, b, alpha);\n if (error2) {\n throw new RuntimeError(error2);\n }\n return new Color2(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);\n }\n function has(key, obj) {\n return key in obj;\n }\n function get(key, obj) {\n var v = obj[key];\n return typeof v === \"undefined\" ? null : v;\n }\n function binarySearch(v, a, i, j) {\n while (i <= j) {\n var m = i + j >> 1;\n if (a[m] === v) {\n return true;\n }\n if (a[m] > v) {\n j = m - 1;\n } else {\n i = m + 1;\n }\n }\n return false;\n }\n function varargs(type) {\n return { type };\n }\n CompoundExpression.register(expressions, {\n \"error\": [\n ErrorType,\n [StringType],\n function(ctx, ref) {\n var v = ref[0];\n throw new RuntimeError(v.evaluate(ctx));\n }\n ],\n \"typeof\": [\n StringType,\n [ValueType],\n function(ctx, ref) {\n var v = ref[0];\n return toString(typeOf(v.evaluate(ctx)));\n }\n ],\n \"to-rgba\": [\n array(NumberType, 4),\n [ColorType],\n function(ctx, ref) {\n var v = ref[0];\n return v.evaluate(ctx).toArray();\n }\n ],\n \"rgb\": [\n ColorType,\n [\n NumberType,\n NumberType,\n NumberType\n ],\n rgba3\n ],\n \"rgba\": [\n ColorType,\n [\n NumberType,\n NumberType,\n NumberType,\n NumberType\n ],\n rgba3\n ],\n \"has\": {\n type: BooleanType,\n overloads: [\n [\n [StringType],\n function(ctx, ref) {\n var key = ref[0];\n return has(key.evaluate(ctx), ctx.properties());\n }\n ],\n [\n [\n StringType,\n ObjectType\n ],\n function(ctx, ref) {\n var key = ref[0];\n var obj = ref[1];\n return has(key.evaluate(ctx), obj.evaluate(ctx));\n }\n ]\n ]\n },\n \"get\": {\n type: ValueType,\n overloads: [\n [\n [StringType],\n function(ctx, ref) {\n var key = ref[0];\n return get(key.evaluate(ctx), ctx.properties());\n }\n ],\n [\n [\n StringType,\n ObjectType\n ],\n function(ctx, ref) {\n var key = ref[0];\n var obj = ref[1];\n return get(key.evaluate(ctx), obj.evaluate(ctx));\n }\n ]\n ]\n },\n \"feature-state\": [\n ValueType,\n [StringType],\n function(ctx, ref) {\n var key = ref[0];\n return get(key.evaluate(ctx), ctx.featureState || {});\n }\n ],\n \"properties\": [\n ObjectType,\n [],\n function(ctx) {\n return ctx.properties();\n }\n ],\n \"geometry-type\": [\n StringType,\n [],\n function(ctx) {\n return ctx.geometryType();\n }\n ],\n \"id\": [\n ValueType,\n [],\n function(ctx) {\n return ctx.id();\n }\n ],\n \"zoom\": [\n NumberType,\n [],\n function(ctx) {\n return ctx.globals.zoom;\n }\n ],\n \"heatmap-density\": [\n NumberType,\n [],\n function(ctx) {\n return ctx.globals.heatmapDensity || 0;\n }\n ],\n \"line-progress\": [\n NumberType,\n [],\n function(ctx) {\n return ctx.globals.lineProgress || 0;\n }\n ],\n \"accumulated\": [\n ValueType,\n [],\n function(ctx) {\n return ctx.globals.accumulated === void 0 ? null : ctx.globals.accumulated;\n }\n ],\n \"+\": [\n NumberType,\n varargs(NumberType),\n function(ctx, args) {\n var result = 0;\n for (var i = 0, list = args; i < list.length; i += 1) {\n var arg = list[i];\n result += arg.evaluate(ctx);\n }\n return result;\n }\n ],\n \"*\": [\n NumberType,\n varargs(NumberType),\n function(ctx, args) {\n var result = 1;\n for (var i = 0, list = args; i < list.length; i += 1) {\n var arg = list[i];\n result *= arg.evaluate(ctx);\n }\n return result;\n }\n ],\n \"-\": {\n type: NumberType,\n overloads: [\n [\n [\n NumberType,\n NumberType\n ],\n function(ctx, ref) {\n var a = ref[0];\n var b = ref[1];\n return a.evaluate(ctx) - b.evaluate(ctx);\n }\n ],\n [\n [NumberType],\n function(ctx, ref) {\n var a = ref[0];\n return -a.evaluate(ctx);\n }\n ]\n ]\n },\n \"/\": [\n NumberType,\n [\n NumberType,\n NumberType\n ],\n function(ctx, ref) {\n var a = ref[0];\n var b = ref[1];\n return a.evaluate(ctx) / b.evaluate(ctx);\n }\n ],\n \"%\": [\n NumberType,\n [\n NumberType,\n NumberType\n ],\n function(ctx, ref) {\n var a = ref[0];\n var b = ref[1];\n return a.evaluate(ctx) % b.evaluate(ctx);\n }\n ],\n \"ln2\": [\n NumberType,\n [],\n function() {\n return Math.LN2;\n }\n ],\n \"pi\": [\n NumberType,\n [],\n function() {\n return Math.PI;\n }\n ],\n \"e\": [\n NumberType,\n [],\n function() {\n return Math.E;\n }\n ],\n \"^\": [\n NumberType,\n [\n NumberType,\n NumberType\n ],\n function(ctx, ref) {\n var b = ref[0];\n var e = ref[1];\n return Math.pow(b.evaluate(ctx), e.evaluate(ctx));\n }\n ],\n \"sqrt\": [\n NumberType,\n [NumberType],\n function(ctx, ref) {\n var x = ref[0];\n return Math.sqrt(x.evaluate(ctx));\n }\n ],\n \"log10\": [\n NumberType,\n [NumberType],\n function(ctx, ref) {\n var n = ref[0];\n return Math.log(n.evaluate(ctx)) / Math.LN10;\n }\n ],\n \"ln\": [\n NumberType,\n [NumberType],\n function(ctx, ref) {\n var n = ref[0];\n return Math.log(n.evaluate(ctx));\n }\n ],\n \"log2\": [\n NumberType,\n [NumberType],\n function(ctx, ref) {\n var n = ref[0];\n return Math.log(n.evaluate(ctx)) / Math.LN2;\n }\n ],\n \"sin\": [\n NumberType,\n [NumberType],\n function(ctx, ref) {\n var n = ref[0];\n return Math.sin(n.evaluate(ctx));\n }\n ],\n \"cos\": [\n NumberType,\n [NumberType],\n function(ctx, ref) {\n var n = ref[0];\n return Math.cos(n.evaluate(ctx));\n }\n ],\n \"tan\": [\n NumberType,\n [NumberType],\n function(ctx, ref) {\n var n = ref[0];\n return Math.tan(n.evaluate(ctx));\n }\n ],\n \"asin\": [\n NumberType,\n [NumberType],\n function(ctx, ref) {\n var n = ref[0];\n return Math.asin(n.evaluate(ctx));\n }\n ],\n \"acos\": [\n NumberType,\n [NumberType],\n function(ctx, ref) {\n var n = ref[0];\n return Math.acos(n.evaluate(ctx));\n }\n ],\n \"atan\": [\n NumberType,\n [NumberType],\n function(ctx, ref) {\n var n = ref[0];\n return Math.atan(n.evaluate(ctx));\n }\n ],\n \"min\": [\n NumberType,\n varargs(NumberType),\n function(ctx, args) {\n return Math.min.apply(Math, args.map(function(arg) {\n return arg.evaluate(ctx);\n }));\n }\n ],\n \"max\": [\n NumberType,\n varargs(NumberType),\n function(ctx, args) {\n return Math.max.apply(Math, args.map(function(arg) {\n return arg.evaluate(ctx);\n }));\n }\n ],\n \"abs\": [\n NumberType,\n [NumberType],\n function(ctx, ref) {\n var n = ref[0];\n return Math.abs(n.evaluate(ctx));\n }\n ],\n \"round\": [\n NumberType,\n [NumberType],\n function(ctx, ref) {\n var n = ref[0];\n var v = n.evaluate(ctx);\n return v < 0 ? -Math.round(-v) : Math.round(v);\n }\n ],\n \"floor\": [\n NumberType,\n [NumberType],\n function(ctx, ref) {\n var n = ref[0];\n return Math.floor(n.evaluate(ctx));\n }\n ],\n \"ceil\": [\n NumberType,\n [NumberType],\n function(ctx, ref) {\n var n = ref[0];\n return Math.ceil(n.evaluate(ctx));\n }\n ],\n \"filter-==\": [\n BooleanType,\n [\n StringType,\n ValueType\n ],\n function(ctx, ref) {\n var k = ref[0];\n var v = ref[1];\n return ctx.properties()[k.value] === v.value;\n }\n ],\n \"filter-id-==\": [\n BooleanType,\n [ValueType],\n function(ctx, ref) {\n var v = ref[0];\n return ctx.id() === v.value;\n }\n ],\n \"filter-type-==\": [\n BooleanType,\n [StringType],\n function(ctx, ref) {\n var v = ref[0];\n return ctx.geometryType() === v.value;\n }\n ],\n \"filter-<\": [\n BooleanType,\n [\n StringType,\n ValueType\n ],\n function(ctx, ref) {\n var k = ref[0];\n var v = ref[1];\n var a = ctx.properties()[k.value];\n var b = v.value;\n return typeof a === typeof b && a < b;\n }\n ],\n \"filter-id-<\": [\n BooleanType,\n [ValueType],\n function(ctx, ref) {\n var v = ref[0];\n var a = ctx.id();\n var b = v.value;\n return typeof a === typeof b && a < b;\n }\n ],\n \"filter->\": [\n BooleanType,\n [\n StringType,\n ValueType\n ],\n function(ctx, ref) {\n var k = ref[0];\n var v = ref[1];\n var a = ctx.properties()[k.value];\n var b = v.value;\n return typeof a === typeof b && a > b;\n }\n ],\n \"filter-id->\": [\n BooleanType,\n [ValueType],\n function(ctx, ref) {\n var v = ref[0];\n var a = ctx.id();\n var b = v.value;\n return typeof a === typeof b && a > b;\n }\n ],\n \"filter-<=\": [\n BooleanType,\n [\n StringType,\n ValueType\n ],\n function(ctx, ref) {\n var k = ref[0];\n var v = ref[1];\n var a = ctx.properties()[k.value];\n var b = v.value;\n return typeof a === typeof b && a <= b;\n }\n ],\n \"filter-id-<=\": [\n BooleanType,\n [ValueType],\n function(ctx, ref) {\n var v = ref[0];\n var a = ctx.id();\n var b = v.value;\n return typeof a === typeof b && a <= b;\n }\n ],\n \"filter->=\": [\n BooleanType,\n [\n StringType,\n ValueType\n ],\n function(ctx, ref) {\n var k = ref[0];\n var v = ref[1];\n var a = ctx.properties()[k.value];\n var b = v.value;\n return typeof a === typeof b && a >= b;\n }\n ],\n \"filter-id->=\": [\n BooleanType,\n [ValueType],\n function(ctx, ref) {\n var v = ref[0];\n var a = ctx.id();\n var b = v.value;\n return typeof a === typeof b && a >= b;\n }\n ],\n \"filter-has\": [\n BooleanType,\n [ValueType],\n function(ctx, ref) {\n var k = ref[0];\n return k.value in ctx.properties();\n }\n ],\n \"filter-has-id\": [\n BooleanType,\n [],\n function(ctx) {\n return ctx.id() !== null && ctx.id() !== void 0;\n }\n ],\n \"filter-type-in\": [\n BooleanType,\n [array(StringType)],\n function(ctx, ref) {\n var v = ref[0];\n return v.value.indexOf(ctx.geometryType()) >= 0;\n }\n ],\n \"filter-id-in\": [\n BooleanType,\n [array(ValueType)],\n function(ctx, ref) {\n var v = ref[0];\n return v.value.indexOf(ctx.id()) >= 0;\n }\n ],\n \"filter-in-small\": [\n BooleanType,\n [\n StringType,\n array(ValueType)\n ],\n function(ctx, ref) {\n var k = ref[0];\n var v = ref[1];\n return v.value.indexOf(ctx.properties()[k.value]) >= 0;\n }\n ],\n \"filter-in-large\": [\n BooleanType,\n [\n StringType,\n array(ValueType)\n ],\n function(ctx, ref) {\n var k = ref[0];\n var v = ref[1];\n return binarySearch(ctx.properties()[k.value], v.value, 0, v.value.length - 1);\n }\n ],\n \"all\": {\n type: BooleanType,\n overloads: [\n [\n [\n BooleanType,\n BooleanType\n ],\n function(ctx, ref) {\n var a = ref[0];\n var b = ref[1];\n return a.evaluate(ctx) && b.evaluate(ctx);\n }\n ],\n [\n varargs(BooleanType),\n function(ctx, args) {\n for (var i = 0, list = args; i < list.length; i += 1) {\n var arg = list[i];\n if (!arg.evaluate(ctx)) {\n return false;\n }\n }\n return true;\n }\n ]\n ]\n },\n \"any\": {\n type: BooleanType,\n overloads: [\n [\n [\n BooleanType,\n BooleanType\n ],\n function(ctx, ref) {\n var a = ref[0];\n var b = ref[1];\n return a.evaluate(ctx) || b.evaluate(ctx);\n }\n ],\n [\n varargs(BooleanType),\n function(ctx, args) {\n for (var i = 0, list = args; i < list.length; i += 1) {\n var arg = list[i];\n if (arg.evaluate(ctx)) {\n return true;\n }\n }\n return false;\n }\n ]\n ]\n },\n \"!\": [\n BooleanType,\n [BooleanType],\n function(ctx, ref) {\n var b = ref[0];\n return !b.evaluate(ctx);\n }\n ],\n \"is-supported-script\": [\n BooleanType,\n [StringType],\n function(ctx, ref) {\n var s = ref[0];\n var isSupportedScript = ctx.globals && ctx.globals.isSupportedScript;\n if (isSupportedScript) {\n return isSupportedScript(s.evaluate(ctx));\n }\n return true;\n }\n ],\n \"upcase\": [\n StringType,\n [StringType],\n function(ctx, ref) {\n var s = ref[0];\n return s.evaluate(ctx).toUpperCase();\n }\n ],\n \"downcase\": [\n StringType,\n [StringType],\n function(ctx, ref) {\n var s = ref[0];\n return s.evaluate(ctx).toLowerCase();\n }\n ],\n \"concat\": [\n StringType,\n varargs(ValueType),\n function(ctx, args) {\n return args.map(function(arg) {\n return toString$1(arg.evaluate(ctx));\n }).join(\"\");\n }\n ],\n \"resolved-locale\": [\n StringType,\n [CollatorType],\n function(ctx, ref) {\n var collator = ref[0];\n return collator.evaluate(ctx).resolvedLocale();\n }\n ]\n });\n function success(value) {\n return {\n result: \"success\",\n value\n };\n }\n function error(value) {\n return {\n result: \"error\",\n value\n };\n }\n function supportsPropertyExpression(spec2) {\n return spec2[\"property-type\"] === \"data-driven\" || spec2[\"property-type\"] === \"cross-faded-data-driven\";\n }\n function supportsZoomExpression(spec2) {\n return !!spec2.expression && spec2.expression.parameters.indexOf(\"zoom\") > -1;\n }\n function supportsInterpolation(spec2) {\n return !!spec2.expression && spec2.expression.interpolated;\n }\n function getType(val) {\n if (val instanceof Number) {\n return \"number\";\n } else if (val instanceof String) {\n return \"string\";\n } else if (val instanceof Boolean) {\n return \"boolean\";\n } else if (Array.isArray(val)) {\n return \"array\";\n } else if (val === null) {\n return \"null\";\n } else {\n return typeof val;\n }\n }\n function isFunction(value) {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n }\n function identityFunction(x) {\n return x;\n }\n function createFunction(parameters, propertySpec) {\n var isColor = propertySpec.type === \"color\";\n var zoomAndFeatureDependent = parameters.stops && typeof parameters.stops[0][0] === \"object\";\n var featureDependent = zoomAndFeatureDependent || parameters.property !== void 0;\n var zoomDependent = zoomAndFeatureDependent || !featureDependent;\n var type = parameters.type || (supportsInterpolation(propertySpec) ? \"exponential\" : \"interval\");\n if (isColor) {\n parameters = extend$1({}, parameters);\n if (parameters.stops) {\n parameters.stops = parameters.stops.map(function(stop2) {\n return [\n stop2[0],\n Color2.parse(stop2[1])\n ];\n });\n }\n if (parameters.default) {\n parameters.default = Color2.parse(parameters.default);\n } else {\n parameters.default = Color2.parse(propertySpec.default);\n }\n }\n if (parameters.colorSpace && parameters.colorSpace !== \"rgb\" && !colorSpaces[parameters.colorSpace]) {\n throw new Error(\"Unknown color space: \" + parameters.colorSpace);\n }\n var innerFun;\n var hashedStops;\n var categoricalKeyType;\n if (type === \"exponential\") {\n innerFun = evaluateExponentialFunction;\n } else if (type === \"interval\") {\n innerFun = evaluateIntervalFunction;\n } else if (type === \"categorical\") {\n innerFun = evaluateCategoricalFunction;\n hashedStops = /* @__PURE__ */ Object.create(null);\n for (var i = 0, list = parameters.stops; i < list.length; i += 1) {\n var stop = list[i];\n hashedStops[stop[0]] = stop[1];\n }\n categoricalKeyType = typeof parameters.stops[0][0];\n } else if (type === \"identity\") {\n innerFun = evaluateIdentityFunction;\n } else {\n throw new Error('Unknown function type \"' + type + '\"');\n }\n if (zoomAndFeatureDependent) {\n var featureFunctions = {};\n var zoomStops = [];\n for (var s = 0; s < parameters.stops.length; s++) {\n var stop$1 = parameters.stops[s];\n var zoom = stop$1[0].zoom;\n if (featureFunctions[zoom] === void 0) {\n featureFunctions[zoom] = {\n zoom,\n type: parameters.type,\n property: parameters.property,\n default: parameters.default,\n stops: []\n };\n zoomStops.push(zoom);\n }\n featureFunctions[zoom].stops.push([\n stop$1[0].value,\n stop$1[1]\n ]);\n }\n var featureFunctionStops = [];\n for (var i$1 = 0, list$1 = zoomStops; i$1 < list$1.length; i$1 += 1) {\n var z = list$1[i$1];\n featureFunctionStops.push([\n featureFunctions[z].zoom,\n createFunction(featureFunctions[z], propertySpec)\n ]);\n }\n var interpolationType = { name: \"linear\" };\n return {\n kind: \"composite\",\n interpolationType,\n interpolationFactor: Interpolate.interpolationFactor.bind(void 0, interpolationType),\n zoomStops: featureFunctionStops.map(function(s2) {\n return s2[0];\n }),\n evaluate: function evaluate(ref, properties2) {\n var zoom2 = ref.zoom;\n return evaluateExponentialFunction({\n stops: featureFunctionStops,\n base: parameters.base\n }, propertySpec, zoom2).evaluate(zoom2, properties2);\n }\n };\n } else if (zoomDependent) {\n var interpolationType$1 = type === \"exponential\" ? {\n name: \"exponential\",\n base: parameters.base !== void 0 ? parameters.base : 1\n } : null;\n return {\n kind: \"camera\",\n interpolationType: interpolationType$1,\n interpolationFactor: Interpolate.interpolationFactor.bind(void 0, interpolationType$1),\n zoomStops: parameters.stops.map(function(s2) {\n return s2[0];\n }),\n evaluate: function(ref) {\n var zoom2 = ref.zoom;\n return innerFun(parameters, propertySpec, zoom2, hashedStops, categoricalKeyType);\n }\n };\n } else {\n return {\n kind: \"source\",\n evaluate: function evaluate(_, feature) {\n var value = feature && feature.properties ? feature.properties[parameters.property] : void 0;\n if (value === void 0) {\n return coalesce(parameters.default, propertySpec.default);\n }\n return innerFun(parameters, propertySpec, value, hashedStops, categoricalKeyType);\n }\n };\n }\n }\n function coalesce(a, b, c) {\n if (a !== void 0) {\n return a;\n }\n if (b !== void 0) {\n return b;\n }\n if (c !== void 0) {\n return c;\n }\n }\n function evaluateCategoricalFunction(parameters, propertySpec, input, hashedStops, keyType) {\n var evaluated = typeof input === keyType ? hashedStops[input] : void 0;\n return coalesce(evaluated, parameters.default, propertySpec.default);\n }\n function evaluateIntervalFunction(parameters, propertySpec, input) {\n if (getType(input) !== \"number\") {\n return coalesce(parameters.default, propertySpec.default);\n }\n var n = parameters.stops.length;\n if (n === 1) {\n return parameters.stops[0][1];\n }\n if (input <= parameters.stops[0][0]) {\n return parameters.stops[0][1];\n }\n if (input >= parameters.stops[n - 1][0]) {\n return parameters.stops[n - 1][1];\n }\n var index = findStopLessThanOrEqualTo(parameters.stops.map(function(stop) {\n return stop[0];\n }), input);\n return parameters.stops[index][1];\n }\n function evaluateExponentialFunction(parameters, propertySpec, input) {\n var base = parameters.base !== void 0 ? parameters.base : 1;\n if (getType(input) !== \"number\") {\n return coalesce(parameters.default, propertySpec.default);\n }\n var n = parameters.stops.length;\n if (n === 1) {\n return parameters.stops[0][1];\n }\n if (input <= parameters.stops[0][0]) {\n return parameters.stops[0][1];\n }\n if (input >= parameters.stops[n - 1][0]) {\n return parameters.stops[n - 1][1];\n }\n var index = findStopLessThanOrEqualTo(parameters.stops.map(function(stop) {\n return stop[0];\n }), input);\n var t = interpolationFactor(input, base, parameters.stops[index][0], parameters.stops[index + 1][0]);\n var outputLower = parameters.stops[index][1];\n var outputUpper = parameters.stops[index + 1][1];\n var interp = interpolate[propertySpec.type] || identityFunction;\n if (parameters.colorSpace && parameters.colorSpace !== \"rgb\") {\n var colorspace = colorSpaces[parameters.colorSpace];\n interp = function(a, b) {\n return colorspace.reverse(colorspace.interpolate(colorspace.forward(a), colorspace.forward(b), t));\n };\n }\n if (typeof outputLower.evaluate === \"function\") {\n return {\n evaluate: function evaluate() {\n var args = [], len = arguments.length;\n while (len--)\n args[len] = arguments[len];\n var evaluatedLower = outputLower.evaluate.apply(void 0, args);\n var evaluatedUpper = outputUpper.evaluate.apply(void 0, args);\n if (evaluatedLower === void 0 || evaluatedUpper === void 0) {\n return void 0;\n }\n return interp(evaluatedLower, evaluatedUpper, t);\n }\n };\n }\n return interp(outputLower, outputUpper, t);\n }\n function evaluateIdentityFunction(parameters, propertySpec, input) {\n if (propertySpec.type === \"color\") {\n input = Color2.parse(input);\n } else if (propertySpec.type === \"formatted\") {\n input = Formatted.fromString(input.toString());\n } else if (propertySpec.type === \"resolvedImage\") {\n input = ResolvedImage.fromString(input.toString());\n } else if (getType(input) !== propertySpec.type && (propertySpec.type !== \"enum\" || !propertySpec.values[input])) {\n input = void 0;\n }\n return coalesce(input, parameters.default, propertySpec.default);\n }\n function interpolationFactor(input, base, lowerValue, upperValue) {\n var difference = upperValue - lowerValue;\n var progress = input - lowerValue;\n if (difference === 0) {\n return 0;\n } else if (base === 1) {\n return progress / difference;\n } else {\n return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);\n }\n }\n var StyleExpression = function StyleExpression2(expression2, propertySpec) {\n this.expression = expression2;\n this._warningHistory = {};\n this._evaluator = new EvaluationContext();\n this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;\n this._enumValues = propertySpec && propertySpec.type === \"enum\" ? propertySpec.values : null;\n };\n StyleExpression.prototype.evaluateWithoutErrorHandling = function evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {\n this._evaluator.globals = globals;\n this._evaluator.feature = feature;\n this._evaluator.featureState = featureState;\n this._evaluator.canonical = canonical;\n this._evaluator.availableImages = availableImages || null;\n this._evaluator.formattedSection = formattedSection;\n return this.expression.evaluate(this._evaluator);\n };\n StyleExpression.prototype.evaluate = function evaluate(globals, feature, featureState, canonical, availableImages, formattedSection) {\n this._evaluator.globals = globals;\n this._evaluator.feature = feature || null;\n this._evaluator.featureState = featureState || null;\n this._evaluator.canonical = canonical;\n this._evaluator.availableImages = availableImages || null;\n this._evaluator.formattedSection = formattedSection || null;\n try {\n var val = this.expression.evaluate(this._evaluator);\n if (val === null || val === void 0 || typeof val === \"number\" && val !== val) {\n return this._defaultValue;\n }\n if (this._enumValues && !(val in this._enumValues)) {\n throw new RuntimeError(\"Expected value to be one of \" + Object.keys(this._enumValues).map(function(v) {\n return JSON.stringify(v);\n }).join(\", \") + \", but found \" + JSON.stringify(val) + \" instead.\");\n }\n return val;\n } catch (e) {\n if (!this._warningHistory[e.message]) {\n this._warningHistory[e.message] = true;\n if (typeof console !== \"undefined\") {\n console.warn(e.message);\n }\n }\n return this._defaultValue;\n }\n };\n function isExpression(expression2) {\n return Array.isArray(expression2) && expression2.length > 0 && typeof expression2[0] === \"string\" && expression2[0] in expressions;\n }\n function createExpression(expression2, propertySpec) {\n var parser = new ParsingContext(expressions, [], propertySpec ? getExpectedType(propertySpec) : void 0);\n var parsed = parser.parse(expression2, void 0, void 0, void 0, propertySpec && propertySpec.type === \"string\" ? { typeAnnotation: \"coerce\" } : void 0);\n if (!parsed) {\n return error(parser.errors);\n }\n return success(new StyleExpression(parsed, propertySpec));\n }\n var ZoomConstantExpression = function ZoomConstantExpression2(kind, expression2) {\n this.kind = kind;\n this._styleExpression = expression2;\n this.isStateDependent = kind !== \"constant\" && !isStateConstant(expression2.expression);\n };\n ZoomConstantExpression.prototype.evaluateWithoutErrorHandling = function evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {\n return this._styleExpression.evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection);\n };\n ZoomConstantExpression.prototype.evaluate = function evaluate(globals, feature, featureState, canonical, availableImages, formattedSection) {\n return this._styleExpression.evaluate(globals, feature, featureState, canonical, availableImages, formattedSection);\n };\n var ZoomDependentExpression = function ZoomDependentExpression2(kind, expression2, zoomStops, interpolationType) {\n this.kind = kind;\n this.zoomStops = zoomStops;\n this._styleExpression = expression2;\n this.isStateDependent = kind !== \"camera\" && !isStateConstant(expression2.expression);\n this.interpolationType = interpolationType;\n };\n ZoomDependentExpression.prototype.evaluateWithoutErrorHandling = function evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {\n return this._styleExpression.evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection);\n };\n ZoomDependentExpression.prototype.evaluate = function evaluate(globals, feature, featureState, canonical, availableImages, formattedSection) {\n return this._styleExpression.evaluate(globals, feature, featureState, canonical, availableImages, formattedSection);\n };\n ZoomDependentExpression.prototype.interpolationFactor = function interpolationFactor2(input, lower, upper) {\n if (this.interpolationType) {\n return Interpolate.interpolationFactor(this.interpolationType, input, lower, upper);\n } else {\n return 0;\n }\n };\n function createPropertyExpression(expression2, propertySpec) {\n expression2 = createExpression(expression2, propertySpec);\n if (expression2.result === \"error\") {\n return expression2;\n }\n var parsed = expression2.value.expression;\n var isFeatureConstant$1 = isFeatureConstant(parsed);\n if (!isFeatureConstant$1 && !supportsPropertyExpression(propertySpec)) {\n return error([new ParsingError(\"\", \"data expressions not supported\")]);\n }\n var isZoomConstant = isGlobalPropertyConstant(parsed, [\"zoom\"]);\n if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {\n return error([new ParsingError(\"\", \"zoom expressions not supported\")]);\n }\n var zoomCurve = findZoomCurve(parsed);\n if (!zoomCurve && !isZoomConstant) {\n return error([new ParsingError(\"\", '\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.')]);\n } else if (zoomCurve instanceof ParsingError) {\n return error([zoomCurve]);\n } else if (zoomCurve instanceof Interpolate && !supportsInterpolation(propertySpec)) {\n return error([new ParsingError(\"\", '\"interpolate\" expressions cannot be used with this property')]);\n }\n if (!zoomCurve) {\n return success(isFeatureConstant$1 ? new ZoomConstantExpression(\"constant\", expression2.value) : new ZoomConstantExpression(\"source\", expression2.value));\n }\n var interpolationType = zoomCurve instanceof Interpolate ? zoomCurve.interpolation : void 0;\n return success(isFeatureConstant$1 ? new ZoomDependentExpression(\"camera\", expression2.value, zoomCurve.labels, interpolationType) : new ZoomDependentExpression(\"composite\", expression2.value, zoomCurve.labels, interpolationType));\n }\n var StylePropertyFunction = function StylePropertyFunction2(parameters, specification) {\n this._parameters = parameters;\n this._specification = specification;\n extend$1(this, createFunction(this._parameters, this._specification));\n };\n StylePropertyFunction.deserialize = function deserialize2(serialized) {\n return new StylePropertyFunction(serialized._parameters, serialized._specification);\n };\n StylePropertyFunction.serialize = function serialize2(input) {\n return {\n _parameters: input._parameters,\n _specification: input._specification\n };\n };\n function normalizePropertyExpression(value, specification) {\n if (isFunction(value)) {\n return new StylePropertyFunction(value, specification);\n } else if (isExpression(value)) {\n var expression2 = createPropertyExpression(value, specification);\n if (expression2.result === \"error\") {\n throw new Error(expression2.value.map(function(err) {\n return err.key + \": \" + err.message;\n }).join(\", \"));\n }\n return expression2.value;\n } else {\n var constant = value;\n if (typeof value === \"string\" && specification.type === \"color\") {\n constant = Color2.parse(value);\n }\n return {\n kind: \"constant\",\n evaluate: function() {\n return constant;\n }\n };\n }\n }\n function findZoomCurve(expression2) {\n var result = null;\n if (expression2 instanceof Let) {\n result = findZoomCurve(expression2.result);\n } else if (expression2 instanceof Coalesce) {\n for (var i = 0, list = expression2.args; i < list.length; i += 1) {\n var arg = list[i];\n result = findZoomCurve(arg);\n if (result) {\n break;\n }\n }\n } else if ((expression2 instanceof Step || expression2 instanceof Interpolate) && expression2.input instanceof CompoundExpression && expression2.input.name === \"zoom\") {\n result = expression2;\n }\n if (result instanceof ParsingError) {\n return result;\n }\n expression2.eachChild(function(child) {\n var childResult = findZoomCurve(child);\n if (childResult instanceof ParsingError) {\n result = childResult;\n } else if (!result && childResult) {\n result = new ParsingError(\"\", '\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.');\n } else if (result && childResult && result !== childResult) {\n result = new ParsingError(\"\", 'Only one zoom-based \"step\" or \"interpolate\" subexpression may be used in an expression.');\n }\n });\n return result;\n }\n function getExpectedType(spec2) {\n var types2 = {\n color: ColorType,\n string: StringType,\n number: NumberType,\n enum: StringType,\n boolean: BooleanType,\n formatted: FormattedType,\n resolvedImage: ResolvedImageType\n };\n if (spec2.type === \"array\") {\n return array(types2[spec2.value] || ValueType, spec2.length);\n }\n return types2[spec2.type];\n }\n function getDefaultValue(spec2) {\n if (spec2.type === \"color\" && isFunction(spec2.default)) {\n return new Color2(0, 0, 0, 0);\n } else if (spec2.type === \"color\") {\n return Color2.parse(spec2.default) || null;\n } else if (spec2.default === void 0) {\n return null;\n } else {\n return spec2.default;\n }\n }\n function validateObject(options) {\n var key = options.key;\n var object = options.value;\n var elementSpecs = options.valueSpec || {};\n var elementValidators = options.objectElementValidators || {};\n var style = options.style;\n var styleSpec = options.styleSpec;\n var errors = [];\n var type = getType(object);\n if (type !== \"object\") {\n return [new ValidationError(key, object, \"object expected, \" + type + \" found\")];\n }\n for (var objectKey in object) {\n var elementSpecKey = objectKey.split(\".\")[0];\n var elementSpec = elementSpecs[elementSpecKey] || elementSpecs[\"*\"];\n var validateElement = void 0;\n if (elementValidators[elementSpecKey]) {\n validateElement = elementValidators[elementSpecKey];\n } else if (elementSpecs[elementSpecKey]) {\n validateElement = validate;\n } else if (elementValidators[\"*\"]) {\n validateElement = elementValidators[\"*\"];\n } else if (elementSpecs[\"*\"]) {\n validateElement = validate;\n } else {\n errors.push(new ValidationError(key, object[objectKey], 'unknown property \"' + objectKey + '\"'));\n continue;\n }\n errors = errors.concat(validateElement({\n key: (key ? key + \".\" : key) + objectKey,\n value: object[objectKey],\n valueSpec: elementSpec,\n style,\n styleSpec,\n object,\n objectKey\n }, object));\n }\n for (var elementSpecKey$1 in elementSpecs) {\n if (elementValidators[elementSpecKey$1]) {\n continue;\n }\n if (elementSpecs[elementSpecKey$1].required && elementSpecs[elementSpecKey$1][\"default\"] === void 0 && object[elementSpecKey$1] === void 0) {\n errors.push(new ValidationError(key, object, 'missing required property \"' + elementSpecKey$1 + '\"'));\n }\n }\n return errors;\n }\n function validateArray(options) {\n var array2 = options.value;\n var arraySpec = options.valueSpec;\n var style = options.style;\n var styleSpec = options.styleSpec;\n var key = options.key;\n var validateArrayElement = options.arrayElementValidator || validate;\n if (getType(array2) !== \"array\") {\n return [new ValidationError(key, array2, \"array expected, \" + getType(array2) + \" found\")];\n }\n if (arraySpec.length && array2.length !== arraySpec.length) {\n return [new ValidationError(key, array2, \"array length \" + arraySpec.length + \" expected, length \" + array2.length + \" found\")];\n }\n if (arraySpec[\"min-length\"] && array2.length < arraySpec[\"min-length\"]) {\n return [new ValidationError(key, array2, \"array length at least \" + arraySpec[\"min-length\"] + \" expected, length \" + array2.length + \" found\")];\n }\n var arrayElementSpec = {\n \"type\": arraySpec.value,\n \"values\": arraySpec.values\n };\n if (styleSpec.$version < 7) {\n arrayElementSpec.function = arraySpec.function;\n }\n if (getType(arraySpec.value) === \"object\") {\n arrayElementSpec = arraySpec.value;\n }\n var errors = [];\n for (var i = 0; i < array2.length; i++) {\n errors = errors.concat(validateArrayElement({\n array: array2,\n arrayIndex: i,\n value: array2[i],\n valueSpec: arrayElementSpec,\n style,\n styleSpec,\n key: key + \"[\" + i + \"]\"\n }));\n }\n return errors;\n }\n function validateNumber(options) {\n var key = options.key;\n var value = options.value;\n var valueSpec = options.valueSpec;\n var type = getType(value);\n if (type === \"number\" && value !== value) {\n type = \"NaN\";\n }\n if (type !== \"number\") {\n return [new ValidationError(key, value, \"number expected, \" + type + \" found\")];\n }\n if (\"minimum\" in valueSpec && value < valueSpec.minimum) {\n return [new ValidationError(key, value, value + \" is less than the minimum value \" + valueSpec.minimum)];\n }\n if (\"maximum\" in valueSpec && value > valueSpec.maximum) {\n return [new ValidationError(key, value, value + \" is greater than the maximum value \" + valueSpec.maximum)];\n }\n return [];\n }\n function validateFunction(options) {\n var functionValueSpec = options.valueSpec;\n var functionType = unbundle(options.value.type);\n var stopKeyType;\n var stopDomainValues = {};\n var previousStopDomainValue;\n var previousStopDomainZoom;\n var isZoomFunction = functionType !== \"categorical\" && options.value.property === void 0;\n var isPropertyFunction = !isZoomFunction;\n var isZoomAndPropertyFunction = getType(options.value.stops) === \"array\" && getType(options.value.stops[0]) === \"array\" && getType(options.value.stops[0][0]) === \"object\";\n var errors = validateObject({\n key: options.key,\n value: options.value,\n valueSpec: options.styleSpec.function,\n style: options.style,\n styleSpec: options.styleSpec,\n objectElementValidators: {\n stops: validateFunctionStops,\n default: validateFunctionDefault\n }\n });\n if (functionType === \"identity\" && isZoomFunction) {\n errors.push(new ValidationError(options.key, options.value, 'missing required property \"property\"'));\n }\n if (functionType !== \"identity\" && !options.value.stops) {\n errors.push(new ValidationError(options.key, options.value, 'missing required property \"stops\"'));\n }\n if (functionType === \"exponential\" && options.valueSpec.expression && !supportsInterpolation(options.valueSpec)) {\n errors.push(new ValidationError(options.key, options.value, \"exponential functions not supported\"));\n }\n if (options.styleSpec.$version >= 8) {\n if (isPropertyFunction && !supportsPropertyExpression(options.valueSpec)) {\n errors.push(new ValidationError(options.key, options.value, \"property functions not supported\"));\n } else if (isZoomFunction && !supportsZoomExpression(options.valueSpec)) {\n errors.push(new ValidationError(options.key, options.value, \"zoom functions not supported\"));\n }\n }\n if ((functionType === \"categorical\" || isZoomAndPropertyFunction) && options.value.property === void 0) {\n errors.push(new ValidationError(options.key, options.value, '\"property\" property is required'));\n }\n return errors;\n function validateFunctionStops(options2) {\n if (functionType === \"identity\") {\n return [new ValidationError(options2.key, options2.value, 'identity function may not have a \"stops\" property')];\n }\n var errors2 = [];\n var value = options2.value;\n errors2 = errors2.concat(validateArray({\n key: options2.key,\n value,\n valueSpec: options2.valueSpec,\n style: options2.style,\n styleSpec: options2.styleSpec,\n arrayElementValidator: validateFunctionStop\n }));\n if (getType(value) === \"array\" && value.length === 0) {\n errors2.push(new ValidationError(options2.key, value, \"array must have at least one stop\"));\n }\n return errors2;\n }\n function validateFunctionStop(options2) {\n var errors2 = [];\n var value = options2.value;\n var key = options2.key;\n if (getType(value) !== \"array\") {\n return [new ValidationError(key, value, \"array expected, \" + getType(value) + \" found\")];\n }\n if (value.length !== 2) {\n return [new ValidationError(key, value, \"array length 2 expected, length \" + value.length + \" found\")];\n }\n if (isZoomAndPropertyFunction) {\n if (getType(value[0]) !== \"object\") {\n return [new ValidationError(key, value, \"object expected, \" + getType(value[0]) + \" found\")];\n }\n if (value[0].zoom === void 0) {\n return [new ValidationError(key, value, \"object stop key must have zoom\")];\n }\n if (value[0].value === void 0) {\n return [new ValidationError(key, value, \"object stop key must have value\")];\n }\n if (previousStopDomainZoom && previousStopDomainZoom > unbundle(value[0].zoom)) {\n return [new ValidationError(key, value[0].zoom, \"stop zoom values must appear in ascending order\")];\n }\n if (unbundle(value[0].zoom) !== previousStopDomainZoom) {\n previousStopDomainZoom = unbundle(value[0].zoom);\n previousStopDomainValue = void 0;\n stopDomainValues = {};\n }\n errors2 = errors2.concat(validateObject({\n key: key + \"[0]\",\n value: value[0],\n valueSpec: { zoom: {} },\n style: options2.style,\n styleSpec: options2.styleSpec,\n objectElementValidators: {\n zoom: validateNumber,\n value: validateStopDomainValue\n }\n }));\n } else {\n errors2 = errors2.concat(validateStopDomainValue({\n key: key + \"[0]\",\n value: value[0],\n valueSpec: {},\n style: options2.style,\n styleSpec: options2.styleSpec\n }, value));\n }\n if (isExpression(deepUnbundle(value[1]))) {\n return errors2.concat([new ValidationError(key + \"[1]\", value[1], \"expressions are not allowed in function stops.\")]);\n }\n return errors2.concat(validate({\n key: key + \"[1]\",\n value: value[1],\n valueSpec: functionValueSpec,\n style: options2.style,\n styleSpec: options2.styleSpec\n }));\n }\n function validateStopDomainValue(options2, stop) {\n var type = getType(options2.value);\n var value = unbundle(options2.value);\n var reportValue = options2.value !== null ? options2.value : stop;\n if (!stopKeyType) {\n stopKeyType = type;\n } else if (type !== stopKeyType) {\n return [new ValidationError(options2.key, reportValue, type + \" stop domain type must match previous stop domain type \" + stopKeyType)];\n }\n if (type !== \"number\" && type !== \"string\" && type !== \"boolean\") {\n return [new ValidationError(options2.key, reportValue, \"stop domain value must be a number, string, or boolean\")];\n }\n if (type !== \"number\" && functionType !== \"categorical\") {\n var message = \"number expected, \" + type + \" found\";\n if (supportsPropertyExpression(functionValueSpec) && functionType === void 0) {\n message += '\\nIf you intended to use a categorical function, specify `\"type\": \"categorical\"`.';\n }\n return [new ValidationError(options2.key, reportValue, message)];\n }\n if (functionType === \"categorical\" && type === \"number\" && (!isFinite(value) || Math.floor(value) !== value)) {\n return [new ValidationError(options2.key, reportValue, \"integer expected, found \" + value)];\n }\n if (functionType !== \"categorical\" && type === \"number\" && previousStopDomainValue !== void 0 && value < previousStopDomainValue) {\n return [new ValidationError(options2.key, reportValue, \"stop domain values must appear in ascending order\")];\n } else {\n previousStopDomainValue = value;\n }\n if (functionType === \"categorical\" && value in stopDomainValues) {\n return [new ValidationError(options2.key, reportValue, \"stop domain values must be unique\")];\n } else {\n stopDomainValues[value] = true;\n }\n return [];\n }\n function validateFunctionDefault(options2) {\n return validate({\n key: options2.key,\n value: options2.value,\n valueSpec: functionValueSpec,\n style: options2.style,\n styleSpec: options2.styleSpec\n });\n }\n }\n function validateExpression(options) {\n var expression2 = (options.expressionContext === \"property\" ? createPropertyExpression : createExpression)(deepUnbundle(options.value), options.valueSpec);\n if (expression2.result === \"error\") {\n return expression2.value.map(function(error2) {\n return new ValidationError(\"\" + options.key + error2.key, options.value, error2.message);\n });\n }\n var expressionObj = expression2.value.expression || expression2.value._styleExpression.expression;\n if (options.expressionContext === \"property\" && options.propertyKey === \"text-font\" && !expressionObj.outputDefined()) {\n return [new ValidationError(options.key, options.value, 'Invalid data expression for \"' + options.propertyKey + '\". Output values must be contained as literals within the expression.')];\n }\n if (options.expressionContext === \"property\" && options.propertyType === \"layout\" && !isStateConstant(expressionObj)) {\n return [new ValidationError(options.key, options.value, '\"feature-state\" data expressions are not supported with layout properties.')];\n }\n if (options.expressionContext === \"filter\" && !isStateConstant(expressionObj)) {\n return [new ValidationError(options.key, options.value, '\"feature-state\" data expressions are not supported with filters.')];\n }\n if (options.expressionContext && options.expressionContext.indexOf(\"cluster\") === 0) {\n if (!isGlobalPropertyConstant(expressionObj, [\n \"zoom\",\n \"feature-state\"\n ])) {\n return [new ValidationError(options.key, options.value, '\"zoom\" and \"feature-state\" expressions are not supported with cluster properties.')];\n }\n if (options.expressionContext === \"cluster-initial\" && !isFeatureConstant(expressionObj)) {\n return [new ValidationError(options.key, options.value, \"Feature data expressions are not supported with initial expression part of cluster properties.\")];\n }\n }\n return [];\n }\n function validateBoolean(options) {\n var value = options.value;\n var key = options.key;\n var type = getType(value);\n if (type !== \"boolean\") {\n return [new ValidationError(key, value, \"boolean expected, \" + type + \" found\")];\n }\n return [];\n }\n function validateColor(options) {\n var key = options.key;\n var value = options.value;\n var type = getType(value);\n if (type !== \"string\") {\n return [new ValidationError(key, value, \"color expected, \" + type + \" found\")];\n }\n if (csscolorparser_1(value) === null) {\n return [new ValidationError(key, value, 'color expected, \"' + value + '\" found')];\n }\n return [];\n }\n function validateEnum(options) {\n var key = options.key;\n var value = options.value;\n var valueSpec = options.valueSpec;\n var errors = [];\n if (Array.isArray(valueSpec.values)) {\n if (valueSpec.values.indexOf(unbundle(value)) === -1) {\n errors.push(new ValidationError(key, value, \"expected one of [\" + valueSpec.values.join(\", \") + \"], \" + JSON.stringify(value) + \" found\"));\n }\n } else {\n if (Object.keys(valueSpec.values).indexOf(unbundle(value)) === -1) {\n errors.push(new ValidationError(key, value, \"expected one of [\" + Object.keys(valueSpec.values).join(\", \") + \"], \" + JSON.stringify(value) + \" found\"));\n }\n }\n return errors;\n }\n function isExpressionFilter(filter2) {\n if (filter2 === true || filter2 === false) {\n return true;\n }\n if (!Array.isArray(filter2) || filter2.length === 0) {\n return false;\n }\n switch (filter2[0]) {\n case \"has\":\n return filter2.length >= 2 && filter2[1] !== \"$id\" && filter2[1] !== \"$type\";\n case \"in\":\n return filter2.length >= 3 && (typeof filter2[1] !== \"string\" || Array.isArray(filter2[2]));\n case \"!in\":\n case \"!has\":\n case \"none\":\n return false;\n case \"==\":\n case \"!=\":\n case \">\":\n case \">=\":\n case \"<\":\n case \"<=\":\n return filter2.length !== 3 || (Array.isArray(filter2[1]) || Array.isArray(filter2[2]));\n case \"any\":\n case \"all\":\n for (var i = 0, list = filter2.slice(1); i < list.length; i += 1) {\n var f = list[i];\n if (!isExpressionFilter(f) && typeof f !== \"boolean\") {\n return false;\n }\n }\n return true;\n default:\n return true;\n }\n }\n var filterSpec = {\n \"type\": \"boolean\",\n \"default\": false,\n \"transition\": false,\n \"property-type\": \"data-driven\",\n \"expression\": {\n \"interpolated\": false,\n \"parameters\": [\n \"zoom\",\n \"feature\"\n ]\n }\n };\n function createFilter(filter2) {\n if (filter2 === null || filter2 === void 0) {\n return {\n filter: function() {\n return true;\n },\n needGeometry: false\n };\n }\n if (!isExpressionFilter(filter2)) {\n filter2 = convertFilter(filter2);\n }\n var compiled = createExpression(filter2, filterSpec);\n if (compiled.result === \"error\") {\n throw new Error(compiled.value.map(function(err) {\n return err.key + \": \" + err.message;\n }).join(\", \"));\n } else {\n var needGeometry = geometryNeeded(filter2);\n return {\n filter: function(globalProperties, feature, canonical) {\n return compiled.value.evaluate(globalProperties, feature, {}, canonical);\n },\n needGeometry\n };\n }\n }\n function compare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n }\n function geometryNeeded(filter2) {\n if (!Array.isArray(filter2)) {\n return false;\n }\n if (filter2[0] === \"within\") {\n return true;\n }\n for (var index = 1; index < filter2.length; index++) {\n if (geometryNeeded(filter2[index])) {\n return true;\n }\n }\n return false;\n }\n function convertFilter(filter2) {\n if (!filter2) {\n return true;\n }\n var op = filter2[0];\n if (filter2.length <= 1) {\n return op !== \"any\";\n }\n var converted = op === \"==\" ? convertComparisonOp(filter2[1], filter2[2], \"==\") : op === \"!=\" ? convertNegation(convertComparisonOp(filter2[1], filter2[2], \"==\")) : op === \"<\" || op === \">\" || op === \"<=\" || op === \">=\" ? convertComparisonOp(filter2[1], filter2[2], op) : op === \"any\" ? convertDisjunctionOp(filter2.slice(1)) : op === \"all\" ? [\"all\"].concat(filter2.slice(1).map(convertFilter)) : op === \"none\" ? [\"all\"].concat(filter2.slice(1).map(convertFilter).map(convertNegation)) : op === \"in\" ? convertInOp(filter2[1], filter2.slice(2)) : op === \"!in\" ? convertNegation(convertInOp(filter2[1], filter2.slice(2))) : op === \"has\" ? convertHasOp(filter2[1]) : op === \"!has\" ? convertNegation(convertHasOp(filter2[1])) : op === \"within\" ? filter2 : true;\n return converted;\n }\n function convertComparisonOp(property, value, op) {\n switch (property) {\n case \"$type\":\n return [\n \"filter-type-\" + op,\n value\n ];\n case \"$id\":\n return [\n \"filter-id-\" + op,\n value\n ];\n default:\n return [\n \"filter-\" + op,\n property,\n value\n ];\n }\n }\n function convertDisjunctionOp(filters) {\n return [\"any\"].concat(filters.map(convertFilter));\n }\n function convertInOp(property, values2) {\n if (values2.length === 0) {\n return false;\n }\n switch (property) {\n case \"$type\":\n return [\n \"filter-type-in\",\n [\n \"literal\",\n values2\n ]\n ];\n case \"$id\":\n return [\n \"filter-id-in\",\n [\n \"literal\",\n values2\n ]\n ];\n default:\n if (values2.length > 200 && !values2.some(function(v) {\n return typeof v !== typeof values2[0];\n })) {\n return [\n \"filter-in-large\",\n property,\n [\n \"literal\",\n values2.sort(compare)\n ]\n ];\n } else {\n return [\n \"filter-in-small\",\n property,\n [\n \"literal\",\n values2\n ]\n ];\n }\n }\n }\n function convertHasOp(property) {\n switch (property) {\n case \"$type\":\n return true;\n case \"$id\":\n return [\"filter-has-id\"];\n default:\n return [\n \"filter-has\",\n property\n ];\n }\n }\n function convertNegation(filter2) {\n return [\n \"!\",\n filter2\n ];\n }\n function validateFilter(options) {\n if (isExpressionFilter(deepUnbundle(options.value))) {\n return validateExpression(extend$1({}, options, {\n expressionContext: \"filter\",\n valueSpec: { value: \"boolean\" }\n }));\n } else {\n return validateNonExpressionFilter(options);\n }\n }\n function validateNonExpressionFilter(options) {\n var value = options.value;\n var key = options.key;\n if (getType(value) !== \"array\") {\n return [new ValidationError(key, value, \"array expected, \" + getType(value) + \" found\")];\n }\n var styleSpec = options.styleSpec;\n var type;\n var errors = [];\n if (value.length < 1) {\n return [new ValidationError(key, value, \"filter array must have at least 1 element\")];\n }\n errors = errors.concat(validateEnum({\n key: key + \"[0]\",\n value: value[0],\n valueSpec: styleSpec.filter_operator,\n style: options.style,\n styleSpec: options.styleSpec\n }));\n switch (unbundle(value[0])) {\n case \"<\":\n case \"<=\":\n case \">\":\n case \">=\":\n if (value.length >= 2 && unbundle(value[1]) === \"$type\") {\n errors.push(new ValidationError(key, value, '\"$type\" cannot be use with operator \"' + value[0] + '\"'));\n }\n case \"==\":\n case \"!=\":\n if (value.length !== 3) {\n errors.push(new ValidationError(key, value, 'filter array for operator \"' + value[0] + '\" must have 3 elements'));\n }\n case \"in\":\n case \"!in\":\n if (value.length >= 2) {\n type = getType(value[1]);\n if (type !== \"string\") {\n errors.push(new ValidationError(key + \"[1]\", value[1], \"string expected, \" + type + \" found\"));\n }\n }\n for (var i = 2; i < value.length; i++) {\n type = getType(value[i]);\n if (unbundle(value[1]) === \"$type\") {\n errors = errors.concat(validateEnum({\n key: key + \"[\" + i + \"]\",\n value: value[i],\n valueSpec: styleSpec.geometry_type,\n style: options.style,\n styleSpec: options.styleSpec\n }));\n } else if (type !== \"string\" && type !== \"number\" && type !== \"boolean\") {\n errors.push(new ValidationError(key + \"[\" + i + \"]\", value[i], \"string, number, or boolean expected, \" + type + \" found\"));\n }\n }\n break;\n case \"any\":\n case \"all\":\n case \"none\":\n for (var i$1 = 1; i$1 < value.length; i$1++) {\n errors = errors.concat(validateNonExpressionFilter({\n key: key + \"[\" + i$1 + \"]\",\n value: value[i$1],\n style: options.style,\n styleSpec: options.styleSpec\n }));\n }\n break;\n case \"has\":\n case \"!has\":\n type = getType(value[1]);\n if (value.length !== 2) {\n errors.push(new ValidationError(key, value, 'filter array for \"' + value[0] + '\" operator must have 2 elements'));\n } else if (type !== \"string\") {\n errors.push(new ValidationError(key + \"[1]\", value[1], \"string expected, \" + type + \" found\"));\n }\n break;\n case \"within\":\n type = getType(value[1]);\n if (value.length !== 2) {\n errors.push(new ValidationError(key, value, 'filter array for \"' + value[0] + '\" operator must have 2 elements'));\n } else if (type !== \"object\") {\n errors.push(new ValidationError(key + \"[1]\", value[1], \"object expected, \" + type + \" found\"));\n }\n break;\n }\n return errors;\n }\n function validateProperty(options, propertyType) {\n var key = options.key;\n var style = options.style;\n var styleSpec = options.styleSpec;\n var value = options.value;\n var propertyKey = options.objectKey;\n var layerSpec = styleSpec[propertyType + \"_\" + options.layerType];\n if (!layerSpec) {\n return [];\n }\n var transitionMatch = propertyKey.match(/^(.*)-transition$/);\n if (propertyType === \"paint\" && transitionMatch && layerSpec[transitionMatch[1]] && layerSpec[transitionMatch[1]].transition) {\n return validate({\n key,\n value,\n valueSpec: styleSpec.transition,\n style,\n styleSpec\n });\n }\n var valueSpec = options.valueSpec || layerSpec[propertyKey];\n if (!valueSpec) {\n return [new ValidationError(key, value, 'unknown property \"' + propertyKey + '\"')];\n }\n var tokenMatch;\n if (getType(value) === \"string\" && supportsPropertyExpression(valueSpec) && !valueSpec.tokens && (tokenMatch = /^{([^}]+)}$/.exec(value))) {\n return [new ValidationError(key, value, '\"' + propertyKey + '\" does not support interpolation syntax\\nUse an identity property function instead: `{ \"type\": \"identity\", \"property\": ' + JSON.stringify(tokenMatch[1]) + \" }`.\")];\n }\n var errors = [];\n if (options.layerType === \"symbol\") {\n if (propertyKey === \"text-field\" && style && !style.glyphs) {\n errors.push(new ValidationError(key, value, 'use of \"text-field\" requires a style \"glyphs\" property'));\n }\n if (propertyKey === \"text-font\" && isFunction(deepUnbundle(value)) && unbundle(value.type) === \"identity\") {\n errors.push(new ValidationError(key, value, '\"text-font\" does not support identity functions'));\n }\n }\n return errors.concat(validate({\n key: options.key,\n value,\n valueSpec,\n style,\n styleSpec,\n expressionContext: \"property\",\n propertyType,\n propertyKey\n }));\n }\n function validatePaintProperty(options) {\n return validateProperty(options, \"paint\");\n }\n function validateLayoutProperty(options) {\n return validateProperty(options, \"layout\");\n }\n function validateLayer(options) {\n var errors = [];\n var layer2 = options.value;\n var key = options.key;\n var style = options.style;\n var styleSpec = options.styleSpec;\n if (!layer2.type && !layer2.ref) {\n errors.push(new ValidationError(key, layer2, 'either \"type\" or \"ref\" is required'));\n }\n var type = unbundle(layer2.type);\n var ref = unbundle(layer2.ref);\n if (layer2.id) {\n var layerId = unbundle(layer2.id);\n for (var i = 0; i < options.arrayIndex; i++) {\n var otherLayer = style.layers[i];\n if (unbundle(otherLayer.id) === layerId) {\n errors.push(new ValidationError(key, layer2.id, 'duplicate layer id \"' + layer2.id + '\", previously used at line ' + otherLayer.id.__line__));\n }\n }\n }\n if (\"ref\" in layer2) {\n [\n \"type\",\n \"source\",\n \"source-layer\",\n \"filter\",\n \"layout\"\n ].forEach(function(p) {\n if (p in layer2) {\n errors.push(new ValidationError(key, layer2[p], '\"' + p + '\" is prohibited for ref layers'));\n }\n });\n var parent;\n style.layers.forEach(function(layer3) {\n if (unbundle(layer3.id) === ref) {\n parent = layer3;\n }\n });\n if (!parent) {\n errors.push(new ValidationError(key, layer2.ref, 'ref layer \"' + ref + '\" not found'));\n } else if (parent.ref) {\n errors.push(new ValidationError(key, layer2.ref, \"ref cannot reference another ref layer\"));\n } else {\n type = unbundle(parent.type);\n }\n } else if (type !== \"background\") {\n if (!layer2.source) {\n errors.push(new ValidationError(key, layer2, 'missing required property \"source\"'));\n } else {\n var source2 = style.sources && style.sources[layer2.source];\n var sourceType = source2 && unbundle(source2.type);\n if (!source2) {\n errors.push(new ValidationError(key, layer2.source, 'source \"' + layer2.source + '\" not found'));\n } else if (sourceType === \"vector\" && type === \"raster\") {\n errors.push(new ValidationError(key, layer2.source, 'layer \"' + layer2.id + '\" requires a raster source'));\n } else if (sourceType === \"raster\" && type !== \"raster\") {\n errors.push(new ValidationError(key, layer2.source, 'layer \"' + layer2.id + '\" requires a vector source'));\n } else if (sourceType === \"vector\" && !layer2[\"source-layer\"]) {\n errors.push(new ValidationError(key, layer2, 'layer \"' + layer2.id + '\" must specify a \"source-layer\"'));\n } else if (sourceType === \"raster-dem\" && type !== \"hillshade\") {\n errors.push(new ValidationError(key, layer2.source, \"raster-dem source can only be used with layer type 'hillshade'.\"));\n } else if (type === \"line\" && layer2.paint && layer2.paint[\"line-gradient\"] && (sourceType !== \"geojson\" || !source2.lineMetrics)) {\n errors.push(new ValidationError(key, layer2, 'layer \"' + layer2.id + '\" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.'));\n }\n }\n }\n errors = errors.concat(validateObject({\n key,\n value: layer2,\n valueSpec: styleSpec.layer,\n style: options.style,\n styleSpec: options.styleSpec,\n objectElementValidators: {\n \"*\": function _() {\n return [];\n },\n type: function type2() {\n return validate({\n key: key + \".type\",\n value: layer2.type,\n valueSpec: styleSpec.layer.type,\n style: options.style,\n styleSpec: options.styleSpec,\n object: layer2,\n objectKey: \"type\"\n });\n },\n filter: validateFilter,\n layout: function layout2(options2) {\n return validateObject({\n layer: layer2,\n key: options2.key,\n value: options2.value,\n style: options2.style,\n styleSpec: options2.styleSpec,\n objectElementValidators: {\n \"*\": function _(options3) {\n return validateLayoutProperty(extend$1({ layerType: type }, options3));\n }\n }\n });\n },\n paint: function paint2(options2) {\n return validateObject({\n layer: layer2,\n key: options2.key,\n value: options2.value,\n style: options2.style,\n styleSpec: options2.styleSpec,\n objectElementValidators: {\n \"*\": function _(options3) {\n return validatePaintProperty(extend$1({ layerType: type }, options3));\n }\n }\n });\n }\n }\n }));\n return errors;\n }\n function validateString(options) {\n var value = options.value;\n var key = options.key;\n var type = getType(value);\n if (type !== \"string\") {\n return [new ValidationError(key, value, \"string expected, \" + type + \" found\")];\n }\n return [];\n }\n var objectElementValidators = { promoteId: validatePromoteId };\n function validateSource(options) {\n var value = options.value;\n var key = options.key;\n var styleSpec = options.styleSpec;\n var style = options.style;\n if (!value.type) {\n return [new ValidationError(key, value, '\"type\" is required')];\n }\n var type = unbundle(value.type);\n var errors;\n switch (type) {\n case \"vector\":\n case \"raster\":\n case \"raster-dem\":\n errors = validateObject({\n key,\n value,\n valueSpec: styleSpec[\"source_\" + type.replace(\"-\", \"_\")],\n style: options.style,\n styleSpec,\n objectElementValidators\n });\n return errors;\n case \"geojson\":\n errors = validateObject({\n key,\n value,\n valueSpec: styleSpec.source_geojson,\n style,\n styleSpec,\n objectElementValidators\n });\n if (value.cluster) {\n for (var prop in value.clusterProperties) {\n var ref = value.clusterProperties[prop];\n var operator = ref[0];\n var mapExpr = ref[1];\n var reduceExpr = typeof operator === \"string\" ? [\n operator,\n [\"accumulated\"],\n [\n \"get\",\n prop\n ]\n ] : operator;\n errors.push.apply(errors, validateExpression({\n key: key + \".\" + prop + \".map\",\n value: mapExpr,\n expressionContext: \"cluster-map\"\n }));\n errors.push.apply(errors, validateExpression({\n key: key + \".\" + prop + \".reduce\",\n value: reduceExpr,\n expressionContext: \"cluster-reduce\"\n }));\n }\n }\n return errors;\n case \"video\":\n return validateObject({\n key,\n value,\n valueSpec: styleSpec.source_video,\n style,\n styleSpec\n });\n case \"image\":\n return validateObject({\n key,\n value,\n valueSpec: styleSpec.source_image,\n style,\n styleSpec\n });\n case \"canvas\":\n return [new ValidationError(key, null, \"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.\", \"source.canvas\")];\n default:\n return validateEnum({\n key: key + \".type\",\n value: value.type,\n valueSpec: {\n values: [\n \"vector\",\n \"raster\",\n \"raster-dem\",\n \"geojson\",\n \"video\",\n \"image\"\n ]\n },\n style,\n styleSpec\n });\n }\n }\n function validatePromoteId(ref) {\n var key = ref.key;\n var value = ref.value;\n if (getType(value) === \"string\") {\n return validateString({\n key,\n value\n });\n } else {\n var errors = [];\n for (var prop in value) {\n errors.push.apply(errors, validateString({\n key: key + \".\" + prop,\n value: value[prop]\n }));\n }\n return errors;\n }\n }\n function validateLight(options) {\n var light2 = options.value;\n var styleSpec = options.styleSpec;\n var lightSpec = styleSpec.light;\n var style = options.style;\n var errors = [];\n var rootType = getType(light2);\n if (light2 === void 0) {\n return errors;\n } else if (rootType !== \"object\") {\n errors = errors.concat([new ValidationError(\"light\", light2, \"object expected, \" + rootType + \" found\")]);\n return errors;\n }\n for (var key in light2) {\n var transitionMatch = key.match(/^(.*)-transition$/);\n if (transitionMatch && lightSpec[transitionMatch[1]] && lightSpec[transitionMatch[1]].transition) {\n errors = errors.concat(validate({\n key,\n value: light2[key],\n valueSpec: styleSpec.transition,\n style,\n styleSpec\n }));\n } else if (lightSpec[key]) {\n errors = errors.concat(validate({\n key,\n value: light2[key],\n valueSpec: lightSpec[key],\n style,\n styleSpec\n }));\n } else {\n errors = errors.concat([new ValidationError(key, light2[key], 'unknown property \"' + key + '\"')]);\n }\n }\n return errors;\n }\n function validateFormatted(options) {\n if (validateString(options).length === 0) {\n return [];\n }\n return validateExpression(options);\n }\n function validateImage(options) {\n if (validateString(options).length === 0) {\n return [];\n }\n return validateExpression(options);\n }\n var VALIDATORS = {\n \"*\": function _() {\n return [];\n },\n \"array\": validateArray,\n \"boolean\": validateBoolean,\n \"number\": validateNumber,\n \"color\": validateColor,\n \"constants\": validateConstants,\n \"enum\": validateEnum,\n \"filter\": validateFilter,\n \"function\": validateFunction,\n \"layer\": validateLayer,\n \"object\": validateObject,\n \"source\": validateSource,\n \"light\": validateLight,\n \"string\": validateString,\n \"formatted\": validateFormatted,\n \"resolvedImage\": validateImage\n };\n function validate(options) {\n var value = options.value;\n var valueSpec = options.valueSpec;\n var styleSpec = options.styleSpec;\n if (valueSpec.expression && isFunction(unbundle(value))) {\n return validateFunction(options);\n } else if (valueSpec.expression && isExpression(deepUnbundle(value))) {\n return validateExpression(options);\n } else if (valueSpec.type && VALIDATORS[valueSpec.type]) {\n return VALIDATORS[valueSpec.type](options);\n } else {\n var valid = validateObject(extend$1({}, options, { valueSpec: valueSpec.type ? styleSpec[valueSpec.type] : valueSpec }));\n return valid;\n }\n }\n function validateGlyphsURL(options) {\n var value = options.value;\n var key = options.key;\n var errors = validateString(options);\n if (errors.length) {\n return errors;\n }\n if (value.indexOf(\"{fontstack}\") === -1) {\n errors.push(new ValidationError(key, value, '\"glyphs\" url must include a \"{fontstack}\" token'));\n }\n if (value.indexOf(\"{range}\") === -1) {\n errors.push(new ValidationError(key, value, '\"glyphs\" url must include a \"{range}\" token'));\n }\n return errors;\n }\n function validateStyleMin(style, styleSpec) {\n if (styleSpec === void 0)\n styleSpec = spec;\n var errors = [];\n errors = errors.concat(validate({\n key: \"\",\n value: style,\n valueSpec: styleSpec.$root,\n styleSpec,\n style,\n objectElementValidators: {\n glyphs: validateGlyphsURL,\n \"*\": function _() {\n return [];\n }\n }\n }));\n if (style.constants) {\n errors = errors.concat(validateConstants({\n key: \"constants\",\n value: style.constants,\n style,\n styleSpec\n }));\n }\n return sortErrors(errors);\n }\n validateStyleMin.source = wrapCleanErrors(validateSource);\n validateStyleMin.light = wrapCleanErrors(validateLight);\n validateStyleMin.layer = wrapCleanErrors(validateLayer);\n validateStyleMin.filter = wrapCleanErrors(validateFilter);\n validateStyleMin.paintProperty = wrapCleanErrors(validatePaintProperty);\n validateStyleMin.layoutProperty = wrapCleanErrors(validateLayoutProperty);\n function sortErrors(errors) {\n return [].concat(errors).sort(function(a, b) {\n return a.line - b.line;\n });\n }\n function wrapCleanErrors(inner) {\n return function() {\n var args = [], len = arguments.length;\n while (len--)\n args[len] = arguments[len];\n return sortErrors(inner.apply(this, args));\n };\n }\n var validateStyle = validateStyleMin;\n var validateLight$1 = validateStyle.light;\n var validatePaintProperty$1 = validateStyle.paintProperty;\n var validateLayoutProperty$1 = validateStyle.layoutProperty;\n function emitValidationErrors(emitter, errors) {\n var hasErrors = false;\n if (errors && errors.length) {\n for (var i = 0, list = errors; i < list.length; i += 1) {\n var error2 = list[i];\n emitter.fire(new ErrorEvent(new Error(error2.message)));\n hasErrors = true;\n }\n }\n return hasErrors;\n }\n var gridIndex = GridIndex;\n var NUM_PARAMS = 3;\n function GridIndex(extent, n, padding) {\n var cells = this.cells = [];\n if (extent instanceof ArrayBuffer) {\n this.arrayBuffer = extent;\n var array2 = new Int32Array(this.arrayBuffer);\n extent = array2[0];\n n = array2[1];\n padding = array2[2];\n this.d = n + 2 * padding;\n for (var k = 0; k < this.d * this.d; k++) {\n var start = array2[NUM_PARAMS + k];\n var end = array2[NUM_PARAMS + k + 1];\n cells.push(start === end ? null : array2.subarray(start, end));\n }\n var keysOffset = array2[NUM_PARAMS + cells.length];\n var bboxesOffset = array2[NUM_PARAMS + cells.length + 1];\n this.keys = array2.subarray(keysOffset, bboxesOffset);\n this.bboxes = array2.subarray(bboxesOffset);\n this.insert = this._insertReadonly;\n } else {\n this.d = n + 2 * padding;\n for (var i = 0; i < this.d * this.d; i++) {\n cells.push([]);\n }\n this.keys = [];\n this.bboxes = [];\n }\n this.n = n;\n this.extent = extent;\n this.padding = padding;\n this.scale = n / extent;\n this.uid = 0;\n var p = padding / n * extent;\n this.min = -p;\n this.max = extent + p;\n }\n GridIndex.prototype.insert = function(key, x1, y1, x2, y2) {\n this._forEachCell(x1, y1, x2, y2, this._insertCell, this.uid++);\n this.keys.push(key);\n this.bboxes.push(x1);\n this.bboxes.push(y1);\n this.bboxes.push(x2);\n this.bboxes.push(y2);\n };\n GridIndex.prototype._insertReadonly = function() {\n throw \"Cannot insert into a GridIndex created from an ArrayBuffer.\";\n };\n GridIndex.prototype._insertCell = function(x1, y1, x2, y2, cellIndex, uid) {\n this.cells[cellIndex].push(uid);\n };\n GridIndex.prototype.query = function(x1, y1, x2, y2, intersectionTest) {\n var min = this.min;\n var max = this.max;\n if (x1 <= min && y1 <= min && max <= x2 && max <= y2 && !intersectionTest) {\n return Array.prototype.slice.call(this.keys);\n } else {\n var result = [];\n var seenUids = {};\n this._forEachCell(x1, y1, x2, y2, this._queryCell, result, seenUids, intersectionTest);\n return result;\n }\n };\n GridIndex.prototype._queryCell = function(x1, y1, x2, y2, cellIndex, result, seenUids, intersectionTest) {\n var cell = this.cells[cellIndex];\n if (cell !== null) {\n var keys = this.keys;\n var bboxes = this.bboxes;\n for (var u = 0; u < cell.length; u++) {\n var uid = cell[u];\n if (seenUids[uid] === void 0) {\n var offset = uid * 4;\n if (intersectionTest ? intersectionTest(bboxes[offset + 0], bboxes[offset + 1], bboxes[offset + 2], bboxes[offset + 3]) : x1 <= bboxes[offset + 2] && y1 <= bboxes[offset + 3] && x2 >= bboxes[offset + 0] && y2 >= bboxes[offset + 1]) {\n seenUids[uid] = true;\n result.push(keys[uid]);\n } else {\n seenUids[uid] = false;\n }\n }\n }\n }\n };\n GridIndex.prototype._forEachCell = function(x1, y1, x2, y2, fn, arg1, arg2, intersectionTest) {\n var cx1 = this._convertToCellCoord(x1);\n var cy1 = this._convertToCellCoord(y1);\n var cx2 = this._convertToCellCoord(x2);\n var cy2 = this._convertToCellCoord(y2);\n for (var x = cx1; x <= cx2; x++) {\n for (var y = cy1; y <= cy2; y++) {\n var cellIndex = this.d * y + x;\n if (intersectionTest && !intersectionTest(this._convertFromCellCoord(x), this._convertFromCellCoord(y), this._convertFromCellCoord(x + 1), this._convertFromCellCoord(y + 1))) {\n continue;\n }\n if (fn.call(this, x1, y1, x2, y2, cellIndex, arg1, arg2, intersectionTest)) {\n return;\n }\n }\n }\n };\n GridIndex.prototype._convertFromCellCoord = function(x) {\n return (x - this.padding) / this.scale;\n };\n GridIndex.prototype._convertToCellCoord = function(x) {\n return Math.max(0, Math.min(this.d - 1, Math.floor(x * this.scale) + this.padding));\n };\n GridIndex.prototype.toArrayBuffer = function() {\n if (this.arrayBuffer) {\n return this.arrayBuffer;\n }\n var cells = this.cells;\n var metadataLength = NUM_PARAMS + this.cells.length + 1 + 1;\n var totalCellLength = 0;\n for (var i = 0; i < this.cells.length; i++) {\n totalCellLength += this.cells[i].length;\n }\n var array2 = new Int32Array(metadataLength + totalCellLength + this.keys.length + this.bboxes.length);\n array2[0] = this.extent;\n array2[1] = this.n;\n array2[2] = this.padding;\n var offset = metadataLength;\n for (var k = 0; k < cells.length; k++) {\n var cell = cells[k];\n array2[NUM_PARAMS + k] = offset;\n array2.set(cell, offset);\n offset += cell.length;\n }\n array2[NUM_PARAMS + cells.length] = offset;\n array2.set(this.keys, offset);\n offset += this.keys.length;\n array2[NUM_PARAMS + cells.length + 1] = offset;\n array2.set(this.bboxes, offset);\n offset += this.bboxes.length;\n return array2.buffer;\n };\n var ImageData2 = window$1.ImageData;\n var ImageBitmap2 = window$1.ImageBitmap;\n var registry = {};\n function register(name3, klass, options) {\n if (options === void 0)\n options = {};\n Object.defineProperty(klass, \"_classRegistryKey\", {\n value: name3,\n writeable: false\n });\n registry[name3] = {\n klass,\n omit: options.omit || [],\n shallow: options.shallow || []\n };\n }\n register(\"Object\", Object);\n gridIndex.serialize = function serialize2(grid, transferables) {\n var buffer = grid.toArrayBuffer();\n if (transferables) {\n transferables.push(buffer);\n }\n return { buffer };\n };\n gridIndex.deserialize = function deserialize2(serialized) {\n return new gridIndex(serialized.buffer);\n };\n register(\"Grid\", gridIndex);\n register(\"Color\", Color2);\n register(\"Error\", Error);\n register(\"ResolvedImage\", ResolvedImage);\n register(\"StylePropertyFunction\", StylePropertyFunction);\n register(\"StyleExpression\", StyleExpression, { omit: [\"_evaluator\"] });\n register(\"ZoomDependentExpression\", ZoomDependentExpression);\n register(\"ZoomConstantExpression\", ZoomConstantExpression);\n register(\"CompoundExpression\", CompoundExpression, { omit: [\"_evaluate\"] });\n for (var name2 in expressions) {\n if (expressions[name2]._classRegistryKey) {\n continue;\n }\n register(\"Expression_\" + name2, expressions[name2]);\n }\n function isArrayBuffer(val) {\n return val && typeof ArrayBuffer !== \"undefined\" && (val instanceof ArrayBuffer || val.constructor && val.constructor.name === \"ArrayBuffer\");\n }\n function isImageBitmap(val) {\n return ImageBitmap2 && val instanceof ImageBitmap2;\n }\n function serialize(input, transferables) {\n if (input === null || input === void 0 || typeof input === \"boolean\" || typeof input === \"number\" || typeof input === \"string\" || input instanceof Boolean || input instanceof Number || input instanceof String || input instanceof Date || input instanceof RegExp) {\n return input;\n }\n if (isArrayBuffer(input) || isImageBitmap(input)) {\n if (transferables) {\n transferables.push(input);\n }\n return input;\n }\n if (ArrayBuffer.isView(input)) {\n var view = input;\n if (transferables) {\n transferables.push(view.buffer);\n }\n return view;\n }\n if (input instanceof ImageData2) {\n if (transferables) {\n transferables.push(input.data.buffer);\n }\n return input;\n }\n if (Array.isArray(input)) {\n var serialized = [];\n for (var i = 0, list = input; i < list.length; i += 1) {\n var item = list[i];\n serialized.push(serialize(item, transferables));\n }\n return serialized;\n }\n if (typeof input === \"object\") {\n var klass = input.constructor;\n var name3 = klass._classRegistryKey;\n if (!name3) {\n throw new Error(\"can't serialize object of unregistered class\");\n }\n var properties2 = klass.serialize ? klass.serialize(input, transferables) : {};\n if (!klass.serialize) {\n for (var key in input) {\n if (!input.hasOwnProperty(key)) {\n continue;\n }\n if (registry[name3].omit.indexOf(key) >= 0) {\n continue;\n }\n var property = input[key];\n properties2[key] = registry[name3].shallow.indexOf(key) >= 0 ? property : serialize(property, transferables);\n }\n if (input instanceof Error) {\n properties2.message = input.message;\n }\n }\n if (properties2.$name) {\n throw new Error(\"$name property is reserved for worker serialization logic.\");\n }\n if (name3 !== \"Object\") {\n properties2.$name = name3;\n }\n return properties2;\n }\n throw new Error(\"can't serialize object of type \" + typeof input);\n }\n function deserialize(input) {\n if (input === null || input === void 0 || typeof input === \"boolean\" || typeof input === \"number\" || typeof input === \"string\" || input instanceof Boolean || input instanceof Number || input instanceof String || input instanceof Date || input instanceof RegExp || isArrayBuffer(input) || isImageBitmap(input) || ArrayBuffer.isView(input) || input instanceof ImageData2) {\n return input;\n }\n if (Array.isArray(input)) {\n return input.map(deserialize);\n }\n if (typeof input === \"object\") {\n var name3 = input.$name || \"Object\";\n var ref = registry[name3];\n var klass = ref.klass;\n if (!klass) {\n throw new Error(\"can't deserialize unregistered class \" + name3);\n }\n if (klass.deserialize) {\n return klass.deserialize(input);\n }\n var result = Object.create(klass.prototype);\n for (var i = 0, list = Object.keys(input); i < list.length; i += 1) {\n var key = list[i];\n if (key === \"$name\") {\n continue;\n }\n var value = input[key];\n result[key] = registry[name3].shallow.indexOf(key) >= 0 ? value : deserialize(value);\n }\n return result;\n }\n throw new Error(\"can't deserialize object of type \" + typeof input);\n }\n var ZoomHistory = function ZoomHistory2() {\n this.first = true;\n };\n ZoomHistory.prototype.update = function update(z, now2) {\n var floorZ = Math.floor(z);\n if (this.first) {\n this.first = false;\n this.lastIntegerZoom = floorZ;\n this.lastIntegerZoomTime = 0;\n this.lastZoom = z;\n this.lastFloorZoom = floorZ;\n return true;\n }\n if (this.lastFloorZoom > floorZ) {\n this.lastIntegerZoom = floorZ + 1;\n this.lastIntegerZoomTime = now2;\n } else if (this.lastFloorZoom < floorZ) {\n this.lastIntegerZoom = floorZ;\n this.lastIntegerZoomTime = now2;\n }\n if (z !== this.lastZoom) {\n this.lastZoom = z;\n this.lastFloorZoom = floorZ;\n return true;\n }\n return false;\n };\n var unicodeBlockLookup = {\n \"Latin-1 Supplement\": function(char) {\n return char >= 128 && char <= 255;\n },\n \"Arabic\": function(char) {\n return char >= 1536 && char <= 1791;\n },\n \"Arabic Supplement\": function(char) {\n return char >= 1872 && char <= 1919;\n },\n \"Arabic Extended-A\": function(char) {\n return char >= 2208 && char <= 2303;\n },\n \"Hangul Jamo\": function(char) {\n return char >= 4352 && char <= 4607;\n },\n \"Unified Canadian Aboriginal Syllabics\": function(char) {\n return char >= 5120 && char <= 5759;\n },\n \"Khmer\": function(char) {\n return char >= 6016 && char <= 6143;\n },\n \"Unified Canadian Aboriginal Syllabics Extended\": function(char) {\n return char >= 6320 && char <= 6399;\n },\n \"General Punctuation\": function(char) {\n return char >= 8192 && char <= 8303;\n },\n \"Letterlike Symbols\": function(char) {\n return char >= 8448 && char <= 8527;\n },\n \"Number Forms\": function(char) {\n return char >= 8528 && char <= 8591;\n },\n \"Miscellaneous Technical\": function(char) {\n return char >= 8960 && char <= 9215;\n },\n \"Control Pictures\": function(char) {\n return char >= 9216 && char <= 9279;\n },\n \"Optical Character Recognition\": function(char) {\n return char >= 9280 && char <= 9311;\n },\n \"Enclosed Alphanumerics\": function(char) {\n return char >= 9312 && char <= 9471;\n },\n \"Geometric Shapes\": function(char) {\n return char >= 9632 && char <= 9727;\n },\n \"Miscellaneous Symbols\": function(char) {\n return char >= 9728 && char <= 9983;\n },\n \"Miscellaneous Symbols and Arrows\": function(char) {\n return char >= 11008 && char <= 11263;\n },\n \"CJK Radicals Supplement\": function(char) {\n return char >= 11904 && char <= 12031;\n },\n \"Kangxi Radicals\": function(char) {\n return char >= 12032 && char <= 12255;\n },\n \"Ideographic Description Characters\": function(char) {\n return char >= 12272 && char <= 12287;\n },\n \"CJK Symbols and Punctuation\": function(char) {\n return char >= 12288 && char <= 12351;\n },\n \"Hiragana\": function(char) {\n return char >= 12352 && char <= 12447;\n },\n \"Katakana\": function(char) {\n return char >= 12448 && char <= 12543;\n },\n \"Bopomofo\": function(char) {\n return char >= 12544 && char <= 12591;\n },\n \"Hangul Compatibility Jamo\": function(char) {\n return char >= 12592 && char <= 12687;\n },\n \"Kanbun\": function(char) {\n return char >= 12688 && char <= 12703;\n },\n \"Bopomofo Extended\": function(char) {\n return char >= 12704 && char <= 12735;\n },\n \"CJK Strokes\": function(char) {\n return char >= 12736 && char <= 12783;\n },\n \"Katakana Phonetic Extensions\": function(char) {\n return char >= 12784 && char <= 12799;\n },\n \"Enclosed CJK Letters and Months\": function(char) {\n return char >= 12800 && char <= 13055;\n },\n \"CJK Compatibility\": function(char) {\n return char >= 13056 && char <= 13311;\n },\n \"CJK Unified Ideographs Extension A\": function(char) {\n return char >= 13312 && char <= 19903;\n },\n \"Yijing Hexagram Symbols\": function(char) {\n return char >= 19904 && char <= 19967;\n },\n \"CJK Unified Ideographs\": function(char) {\n return char >= 19968 && char <= 40959;\n },\n \"Yi Syllables\": function(char) {\n return char >= 40960 && char <= 42127;\n },\n \"Yi Radicals\": function(char) {\n return char >= 42128 && char <= 42191;\n },\n \"Hangul Jamo Extended-A\": function(char) {\n return char >= 43360 && char <= 43391;\n },\n \"Hangul Syllables\": function(char) {\n return char >= 44032 && char <= 55215;\n },\n \"Hangul Jamo Extended-B\": function(char) {\n return char >= 55216 && char <= 55295;\n },\n \"Private Use Area\": function(char) {\n return char >= 57344 && char <= 63743;\n },\n \"CJK Compatibility Ideographs\": function(char) {\n return char >= 63744 && char <= 64255;\n },\n \"Arabic Presentation Forms-A\": function(char) {\n return char >= 64336 && char <= 65023;\n },\n \"Vertical Forms\": function(char) {\n return char >= 65040 && char <= 65055;\n },\n \"CJK Compatibility Forms\": function(char) {\n return char >= 65072 && char <= 65103;\n },\n \"Small Form Variants\": function(char) {\n return char >= 65104 && char <= 65135;\n },\n \"Arabic Presentation Forms-B\": function(char) {\n return char >= 65136 && char <= 65279;\n },\n \"Halfwidth and Fullwidth Forms\": function(char) {\n return char >= 65280 && char <= 65519;\n }\n };\n function allowsVerticalWritingMode(chars) {\n for (var i = 0, list = chars; i < list.length; i += 1) {\n var char = list[i];\n if (charHasUprightVerticalOrientation(char.charCodeAt(0))) {\n return true;\n }\n }\n return false;\n }\n function allowsLetterSpacing(chars) {\n for (var i = 0, list = chars; i < list.length; i += 1) {\n var char = list[i];\n if (!charAllowsLetterSpacing(char.charCodeAt(0))) {\n return false;\n }\n }\n return true;\n }\n function charAllowsLetterSpacing(char) {\n if (unicodeBlockLookup[\"Arabic\"](char)) {\n return false;\n }\n if (unicodeBlockLookup[\"Arabic Supplement\"](char)) {\n return false;\n }\n if (unicodeBlockLookup[\"Arabic Extended-A\"](char)) {\n return false;\n }\n if (unicodeBlockLookup[\"Arabic Presentation Forms-A\"](char)) {\n return false;\n }\n if (unicodeBlockLookup[\"Arabic Presentation Forms-B\"](char)) {\n return false;\n }\n return true;\n }\n function charAllowsIdeographicBreaking(char) {\n if (char < 11904) {\n return false;\n }\n if (unicodeBlockLookup[\"Bopomofo Extended\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Bopomofo\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"CJK Compatibility Forms\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"CJK Compatibility Ideographs\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"CJK Compatibility\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"CJK Radicals Supplement\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"CJK Strokes\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"CJK Symbols and Punctuation\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"CJK Unified Ideographs Extension A\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"CJK Unified Ideographs\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Enclosed CJK Letters and Months\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Halfwidth and Fullwidth Forms\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Hiragana\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Ideographic Description Characters\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Kangxi Radicals\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Katakana Phonetic Extensions\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Katakana\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Vertical Forms\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Yi Radicals\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Yi Syllables\"](char)) {\n return true;\n }\n return false;\n }\n function charHasUprightVerticalOrientation(char) {\n if (char === 746 || char === 747) {\n return true;\n }\n if (char < 4352) {\n return false;\n }\n if (unicodeBlockLookup[\"Bopomofo Extended\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Bopomofo\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"CJK Compatibility Forms\"](char)) {\n if (!(char >= 65097 && char <= 65103)) {\n return true;\n }\n }\n if (unicodeBlockLookup[\"CJK Compatibility Ideographs\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"CJK Compatibility\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"CJK Radicals Supplement\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"CJK Strokes\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"CJK Symbols and Punctuation\"](char)) {\n if (!(char >= 12296 && char <= 12305) && !(char >= 12308 && char <= 12319) && char !== 12336) {\n return true;\n }\n }\n if (unicodeBlockLookup[\"CJK Unified Ideographs Extension A\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"CJK Unified Ideographs\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Enclosed CJK Letters and Months\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Hangul Compatibility Jamo\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Hangul Jamo Extended-A\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Hangul Jamo Extended-B\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Hangul Jamo\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Hangul Syllables\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Hiragana\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Ideographic Description Characters\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Kanbun\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Kangxi Radicals\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Katakana Phonetic Extensions\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Katakana\"](char)) {\n if (char !== 12540) {\n return true;\n }\n }\n if (unicodeBlockLookup[\"Halfwidth and Fullwidth Forms\"](char)) {\n if (char !== 65288 && char !== 65289 && char !== 65293 && !(char >= 65306 && char <= 65310) && char !== 65339 && char !== 65341 && char !== 65343 && !(char >= 65371 && char <= 65503) && char !== 65507 && !(char >= 65512 && char <= 65519)) {\n return true;\n }\n }\n if (unicodeBlockLookup[\"Small Form Variants\"](char)) {\n if (!(char >= 65112 && char <= 65118) && !(char >= 65123 && char <= 65126)) {\n return true;\n }\n }\n if (unicodeBlockLookup[\"Unified Canadian Aboriginal Syllabics\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Unified Canadian Aboriginal Syllabics Extended\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Vertical Forms\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Yijing Hexagram Symbols\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Yi Syllables\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Yi Radicals\"](char)) {\n return true;\n }\n return false;\n }\n function charHasNeutralVerticalOrientation(char) {\n if (unicodeBlockLookup[\"Latin-1 Supplement\"](char)) {\n if (char === 167 || char === 169 || char === 174 || char === 177 || char === 188 || char === 189 || char === 190 || char === 215 || char === 247) {\n return true;\n }\n }\n if (unicodeBlockLookup[\"General Punctuation\"](char)) {\n if (char === 8214 || char === 8224 || char === 8225 || char === 8240 || char === 8241 || char === 8251 || char === 8252 || char === 8258 || char === 8263 || char === 8264 || char === 8265 || char === 8273) {\n return true;\n }\n }\n if (unicodeBlockLookup[\"Letterlike Symbols\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Number Forms\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Miscellaneous Technical\"](char)) {\n if (char >= 8960 && char <= 8967 || char >= 8972 && char <= 8991 || char >= 8996 && char <= 9e3 || char === 9003 || char >= 9085 && char <= 9114 || char >= 9150 && char <= 9165 || char === 9167 || char >= 9169 && char <= 9179 || char >= 9186 && char <= 9215) {\n return true;\n }\n }\n if (unicodeBlockLookup[\"Control Pictures\"](char) && char !== 9251) {\n return true;\n }\n if (unicodeBlockLookup[\"Optical Character Recognition\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Enclosed Alphanumerics\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Geometric Shapes\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Miscellaneous Symbols\"](char)) {\n if (!(char >= 9754 && char <= 9759)) {\n return true;\n }\n }\n if (unicodeBlockLookup[\"Miscellaneous Symbols and Arrows\"](char)) {\n if (char >= 11026 && char <= 11055 || char >= 11088 && char <= 11097 || char >= 11192 && char <= 11243) {\n return true;\n }\n }\n if (unicodeBlockLookup[\"CJK Symbols and Punctuation\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Katakana\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Private Use Area\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"CJK Compatibility Forms\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Small Form Variants\"](char)) {\n return true;\n }\n if (unicodeBlockLookup[\"Halfwidth and Fullwidth Forms\"](char)) {\n return true;\n }\n if (char === 8734 || char === 8756 || char === 8757 || char >= 9984 && char <= 10087 || char >= 10102 && char <= 10131 || char === 65532 || char === 65533) {\n return true;\n }\n return false;\n }\n function charHasRotatedVerticalOrientation(char) {\n return !(charHasUprightVerticalOrientation(char) || charHasNeutralVerticalOrientation(char));\n }\n function charInComplexShapingScript(char) {\n return unicodeBlockLookup[\"Arabic\"](char) || unicodeBlockLookup[\"Arabic Supplement\"](char) || unicodeBlockLookup[\"Arabic Extended-A\"](char) || unicodeBlockLookup[\"Arabic Presentation Forms-A\"](char) || unicodeBlockLookup[\"Arabic Presentation Forms-B\"](char);\n }\n function charInRTLScript(char) {\n return char >= 1424 && char <= 2303 || unicodeBlockLookup[\"Arabic Presentation Forms-A\"](char) || unicodeBlockLookup[\"Arabic Presentation Forms-B\"](char);\n }\n function charInSupportedScript(char, canRenderRTL) {\n if (!canRenderRTL && charInRTLScript(char)) {\n return false;\n }\n if (char >= 2304 && char <= 3583 || char >= 3840 && char <= 4255 || unicodeBlockLookup[\"Khmer\"](char)) {\n return false;\n }\n return true;\n }\n function stringContainsRTLText(chars) {\n for (var i = 0, list = chars; i < list.length; i += 1) {\n var char = list[i];\n if (charInRTLScript(char.charCodeAt(0))) {\n return true;\n }\n }\n return false;\n }\n function isStringInSupportedScript(chars, canRenderRTL) {\n for (var i = 0, list = chars; i < list.length; i += 1) {\n var char = list[i];\n if (!charInSupportedScript(char.charCodeAt(0), canRenderRTL)) {\n return false;\n }\n }\n return true;\n }\n var status = {\n unavailable: \"unavailable\",\n deferred: \"deferred\",\n loading: \"loading\",\n loaded: \"loaded\",\n error: \"error\"\n };\n var _completionCallback = null;\n var pluginStatus = status.unavailable;\n var pluginURL = null;\n var triggerPluginCompletionEvent = function(error2) {\n if (error2 && typeof error2 === \"string\" && error2.indexOf(\"NetworkError\") > -1) {\n pluginStatus = status.error;\n }\n if (_completionCallback) {\n _completionCallback(error2);\n }\n };\n function sendPluginStateToWorker() {\n evented.fire(new Event(\"pluginStateChange\", {\n pluginStatus,\n pluginURL\n }));\n }\n var evented = new Evented();\n var getRTLTextPluginStatus = function() {\n return pluginStatus;\n };\n var registerForPluginStateChange = function(callback) {\n callback({\n pluginStatus,\n pluginURL\n });\n evented.on(\"pluginStateChange\", callback);\n return callback;\n };\n var setRTLTextPlugin = function(url, callback, deferred) {\n if (deferred === void 0)\n deferred = false;\n if (pluginStatus === status.deferred || pluginStatus === status.loading || pluginStatus === status.loaded) {\n throw new Error(\"setRTLTextPlugin cannot be called multiple times.\");\n }\n pluginURL = exported.resolveURL(url);\n pluginStatus = status.deferred;\n _completionCallback = callback;\n sendPluginStateToWorker();\n if (!deferred) {\n downloadRTLTextPlugin();\n }\n };\n var downloadRTLTextPlugin = function() {\n if (pluginStatus !== status.deferred || !pluginURL) {\n throw new Error(\"rtl-text-plugin cannot be downloaded unless a pluginURL is specified\");\n }\n pluginStatus = status.loading;\n sendPluginStateToWorker();\n if (pluginURL) {\n getArrayBuffer({ url: pluginURL }, function(error2) {\n if (error2) {\n triggerPluginCompletionEvent(error2);\n } else {\n pluginStatus = status.loaded;\n sendPluginStateToWorker();\n }\n });\n }\n };\n var plugin = {\n applyArabicShaping: null,\n processBidirectionalText: null,\n processStyledBidirectionalText: null,\n isLoaded: function isLoaded() {\n return pluginStatus === status.loaded || plugin.applyArabicShaping != null;\n },\n isLoading: function isLoading() {\n return pluginStatus === status.loading;\n },\n setState: function setState(state) {\n pluginStatus = state.pluginStatus;\n pluginURL = state.pluginURL;\n },\n isParsed: function isParsed() {\n return plugin.applyArabicShaping != null && plugin.processBidirectionalText != null && plugin.processStyledBidirectionalText != null;\n },\n getPluginURL: function getPluginURL() {\n return pluginURL;\n }\n };\n var lazyLoadRTLTextPlugin = function() {\n if (!plugin.isLoading() && !plugin.isLoaded() && getRTLTextPluginStatus() === \"deferred\") {\n downloadRTLTextPlugin();\n }\n };\n var EvaluationParameters = function EvaluationParameters2(zoom, options) {\n this.zoom = zoom;\n if (options) {\n this.now = options.now;\n this.fadeDuration = options.fadeDuration;\n this.zoomHistory = options.zoomHistory;\n this.transition = options.transition;\n } else {\n this.now = 0;\n this.fadeDuration = 0;\n this.zoomHistory = new ZoomHistory();\n this.transition = {};\n }\n };\n EvaluationParameters.prototype.isSupportedScript = function isSupportedScript(str) {\n return isStringInSupportedScript(str, plugin.isLoaded());\n };\n EvaluationParameters.prototype.crossFadingFactor = function crossFadingFactor() {\n if (this.fadeDuration === 0) {\n return 1;\n } else {\n return Math.min((this.now - this.zoomHistory.lastIntegerZoomTime) / this.fadeDuration, 1);\n }\n };\n EvaluationParameters.prototype.getCrossfadeParameters = function getCrossfadeParameters() {\n var z = this.zoom;\n var fraction = z - Math.floor(z);\n var t = this.crossFadingFactor();\n return z > this.zoomHistory.lastIntegerZoom ? {\n fromScale: 2,\n toScale: 1,\n t: fraction + (1 - fraction) * t\n } : {\n fromScale: 0.5,\n toScale: 1,\n t: 1 - (1 - t) * fraction\n };\n };\n var PropertyValue = function PropertyValue2(property, value) {\n this.property = property;\n this.value = value;\n this.expression = normalizePropertyExpression(value === void 0 ? property.specification.default : value, property.specification);\n };\n PropertyValue.prototype.isDataDriven = function isDataDriven() {\n return this.expression.kind === \"source\" || this.expression.kind === \"composite\";\n };\n PropertyValue.prototype.possiblyEvaluate = function possiblyEvaluate(parameters, canonical, availableImages) {\n return this.property.possiblyEvaluate(this, parameters, canonical, availableImages);\n };\n var TransitionablePropertyValue = function TransitionablePropertyValue2(property) {\n this.property = property;\n this.value = new PropertyValue(property, void 0);\n };\n TransitionablePropertyValue.prototype.transitioned = function transitioned(parameters, prior) {\n return new TransitioningPropertyValue(this.property, this.value, prior, extend2({}, parameters.transition, this.transition), parameters.now);\n };\n TransitionablePropertyValue.prototype.untransitioned = function untransitioned() {\n return new TransitioningPropertyValue(this.property, this.value, null, {}, 0);\n };\n var Transitionable = function Transitionable2(properties2) {\n this._properties = properties2;\n this._values = Object.create(properties2.defaultTransitionablePropertyValues);\n };\n Transitionable.prototype.getValue = function getValue(name3) {\n return clone(this._values[name3].value.value);\n };\n Transitionable.prototype.setValue = function setValue(name3, value) {\n if (!this._values.hasOwnProperty(name3)) {\n this._values[name3] = new TransitionablePropertyValue(this._values[name3].property);\n }\n this._values[name3].value = new PropertyValue(this._values[name3].property, value === null ? void 0 : clone(value));\n };\n Transitionable.prototype.getTransition = function getTransition(name3) {\n return clone(this._values[name3].transition);\n };\n Transitionable.prototype.setTransition = function setTransition(name3, value) {\n if (!this._values.hasOwnProperty(name3)) {\n this._values[name3] = new TransitionablePropertyValue(this._values[name3].property);\n }\n this._values[name3].transition = clone(value) || void 0;\n };\n Transitionable.prototype.serialize = function serialize2() {\n var result = {};\n for (var i = 0, list = Object.keys(this._values); i < list.length; i += 1) {\n var property = list[i];\n var value = this.getValue(property);\n if (value !== void 0) {\n result[property] = value;\n }\n var transition2 = this.getTransition(property);\n if (transition2 !== void 0) {\n result[property + \"-transition\"] = transition2;\n }\n }\n return result;\n };\n Transitionable.prototype.transitioned = function transitioned(parameters, prior) {\n var result = new Transitioning(this._properties);\n for (var i = 0, list = Object.keys(this._values); i < list.length; i += 1) {\n var property = list[i];\n result._values[property] = this._values[property].transitioned(parameters, prior._values[property]);\n }\n return result;\n };\n Transitionable.prototype.untransitioned = function untransitioned() {\n var result = new Transitioning(this._properties);\n for (var i = 0, list = Object.keys(this._values); i < list.length; i += 1) {\n var property = list[i];\n result._values[property] = this._values[property].untransitioned();\n }\n return result;\n };\n var TransitioningPropertyValue = function TransitioningPropertyValue2(property, value, prior, transition2, now2) {\n this.property = property;\n this.value = value;\n this.begin = now2 + transition2.delay || 0;\n this.end = this.begin + transition2.duration || 0;\n if (property.specification.transition && (transition2.delay || transition2.duration)) {\n this.prior = prior;\n }\n };\n TransitioningPropertyValue.prototype.possiblyEvaluate = function possiblyEvaluate(parameters, canonical, availableImages) {\n var now2 = parameters.now || 0;\n var finalValue = this.value.possiblyEvaluate(parameters, canonical, availableImages);\n var prior = this.prior;\n if (!prior) {\n return finalValue;\n } else if (now2 > this.end) {\n this.prior = null;\n return finalValue;\n } else if (this.value.isDataDriven()) {\n this.prior = null;\n return finalValue;\n } else if (now2 < this.begin) {\n return prior.possiblyEvaluate(parameters, canonical, availableImages);\n } else {\n var t = (now2 - this.begin) / (this.end - this.begin);\n return this.property.interpolate(prior.possiblyEvaluate(parameters, canonical, availableImages), finalValue, easeCubicInOut(t));\n }\n };\n var Transitioning = function Transitioning2(properties2) {\n this._properties = properties2;\n this._values = Object.create(properties2.defaultTransitioningPropertyValues);\n };\n Transitioning.prototype.possiblyEvaluate = function possiblyEvaluate(parameters, canonical, availableImages) {\n var result = new PossiblyEvaluated(this._properties);\n for (var i = 0, list = Object.keys(this._values); i < list.length; i += 1) {\n var property = list[i];\n result._values[property] = this._values[property].possiblyEvaluate(parameters, canonical, availableImages);\n }\n return result;\n };\n Transitioning.prototype.hasTransition = function hasTransition() {\n for (var i = 0, list = Object.keys(this._values); i < list.length; i += 1) {\n var property = list[i];\n if (this._values[property].prior) {\n return true;\n }\n }\n return false;\n };\n var Layout = function Layout2(properties2) {\n this._properties = properties2;\n this._values = Object.create(properties2.defaultPropertyValues);\n };\n Layout.prototype.getValue = function getValue(name3) {\n return clone(this._values[name3].value);\n };\n Layout.prototype.setValue = function setValue(name3, value) {\n this._values[name3] = new PropertyValue(this._values[name3].property, value === null ? void 0 : clone(value));\n };\n Layout.prototype.serialize = function serialize2() {\n var result = {};\n for (var i = 0, list = Object.keys(this._values); i < list.length; i += 1) {\n var property = list[i];\n var value = this.getValue(property);\n if (value !== void 0) {\n result[property] = value;\n }\n }\n return result;\n };\n Layout.prototype.possiblyEvaluate = function possiblyEvaluate(parameters, canonical, availableImages) {\n var result = new PossiblyEvaluated(this._properties);\n for (var i = 0, list = Object.keys(this._values); i < list.length; i += 1) {\n var property = list[i];\n result._values[property] = this._values[property].possiblyEvaluate(parameters, canonical, availableImages);\n }\n return result;\n };\n var PossiblyEvaluatedPropertyValue = function PossiblyEvaluatedPropertyValue2(property, value, parameters) {\n this.property = property;\n this.value = value;\n this.parameters = parameters;\n };\n PossiblyEvaluatedPropertyValue.prototype.isConstant = function isConstant2() {\n return this.value.kind === \"constant\";\n };\n PossiblyEvaluatedPropertyValue.prototype.constantOr = function constantOr(value) {\n if (this.value.kind === \"constant\") {\n return this.value.value;\n } else {\n return value;\n }\n };\n PossiblyEvaluatedPropertyValue.prototype.evaluate = function evaluate(feature, featureState, canonical, availableImages) {\n return this.property.evaluate(this.value, this.parameters, feature, featureState, canonical, availableImages);\n };\n var PossiblyEvaluated = function PossiblyEvaluated2(properties2) {\n this._properties = properties2;\n this._values = Object.create(properties2.defaultPossiblyEvaluatedValues);\n };\n PossiblyEvaluated.prototype.get = function get2(name3) {\n return this._values[name3];\n };\n var DataConstantProperty = function DataConstantProperty2(specification) {\n this.specification = specification;\n };\n DataConstantProperty.prototype.possiblyEvaluate = function possiblyEvaluate(value, parameters) {\n return value.expression.evaluate(parameters);\n };\n DataConstantProperty.prototype.interpolate = function interpolate$1(a, b, t) {\n var interp = interpolate[this.specification.type];\n if (interp) {\n return interp(a, b, t);\n } else {\n return a;\n }\n };\n var DataDrivenProperty = function DataDrivenProperty2(specification, overrides) {\n this.specification = specification;\n this.overrides = overrides;\n };\n DataDrivenProperty.prototype.possiblyEvaluate = function possiblyEvaluate(value, parameters, canonical, availableImages) {\n if (value.expression.kind === \"constant\" || value.expression.kind === \"camera\") {\n return new PossiblyEvaluatedPropertyValue(this, {\n kind: \"constant\",\n value: value.expression.evaluate(parameters, null, {}, canonical, availableImages)\n }, parameters);\n } else {\n return new PossiblyEvaluatedPropertyValue(this, value.expression, parameters);\n }\n };\n DataDrivenProperty.prototype.interpolate = function interpolate$2(a, b, t) {\n if (a.value.kind !== \"constant\" || b.value.kind !== \"constant\") {\n return a;\n }\n if (a.value.value === void 0 || b.value.value === void 0) {\n return new PossiblyEvaluatedPropertyValue(this, {\n kind: \"constant\",\n value: void 0\n }, a.parameters);\n }\n var interp = interpolate[this.specification.type];\n if (interp) {\n return new PossiblyEvaluatedPropertyValue(this, {\n kind: \"constant\",\n value: interp(a.value.value, b.value.value, t)\n }, a.parameters);\n } else {\n return a;\n }\n };\n DataDrivenProperty.prototype.evaluate = function evaluate(value, parameters, feature, featureState, canonical, availableImages) {\n if (value.kind === \"constant\") {\n return value.value;\n } else {\n return value.evaluate(parameters, feature, featureState, canonical, availableImages);\n }\n };\n var CrossFadedDataDrivenProperty = function(DataDrivenProperty2) {\n function CrossFadedDataDrivenProperty2() {\n DataDrivenProperty2.apply(this, arguments);\n }\n if (DataDrivenProperty2)\n CrossFadedDataDrivenProperty2.__proto__ = DataDrivenProperty2;\n CrossFadedDataDrivenProperty2.prototype = Object.create(DataDrivenProperty2 && DataDrivenProperty2.prototype);\n CrossFadedDataDrivenProperty2.prototype.constructor = CrossFadedDataDrivenProperty2;\n CrossFadedDataDrivenProperty2.prototype.possiblyEvaluate = function possiblyEvaluate(value, parameters, canonical, availableImages) {\n if (value.value === void 0) {\n return new PossiblyEvaluatedPropertyValue(this, {\n kind: \"constant\",\n value: void 0\n }, parameters);\n } else if (value.expression.kind === \"constant\") {\n var evaluatedValue = value.expression.evaluate(parameters, null, {}, canonical, availableImages);\n var isImageExpression = value.property.specification.type === \"resolvedImage\";\n var constantValue = isImageExpression && typeof evaluatedValue !== \"string\" ? evaluatedValue.name : evaluatedValue;\n var constant = this._calculate(constantValue, constantValue, constantValue, parameters);\n return new PossiblyEvaluatedPropertyValue(this, {\n kind: \"constant\",\n value: constant\n }, parameters);\n } else if (value.expression.kind === \"camera\") {\n var cameraVal = this._calculate(value.expression.evaluate({ zoom: parameters.zoom - 1 }), value.expression.evaluate({ zoom: parameters.zoom }), value.expression.evaluate({ zoom: parameters.zoom + 1 }), parameters);\n return new PossiblyEvaluatedPropertyValue(this, {\n kind: \"constant\",\n value: cameraVal\n }, parameters);\n } else {\n return new PossiblyEvaluatedPropertyValue(this, value.expression, parameters);\n }\n };\n CrossFadedDataDrivenProperty2.prototype.evaluate = function evaluate(value, globals, feature, featureState, canonical, availableImages) {\n if (value.kind === \"source\") {\n var constant = value.evaluate(globals, feature, featureState, canonical, availableImages);\n return this._calculate(constant, constant, constant, globals);\n } else if (value.kind === \"composite\") {\n return this._calculate(value.evaluate({ zoom: Math.floor(globals.zoom) - 1 }, feature, featureState), value.evaluate({ zoom: Math.floor(globals.zoom) }, feature, featureState), value.evaluate({ zoom: Math.floor(globals.zoom) + 1 }, feature, featureState), globals);\n } else {\n return value.value;\n }\n };\n CrossFadedDataDrivenProperty2.prototype._calculate = function _calculate(min, mid, max, parameters) {\n var z = parameters.zoom;\n return z > parameters.zoomHistory.lastIntegerZoom ? {\n from: min,\n to: mid\n } : {\n from: max,\n to: mid\n };\n };\n CrossFadedDataDrivenProperty2.prototype.interpolate = function interpolate2(a) {\n return a;\n };\n return CrossFadedDataDrivenProperty2;\n }(DataDrivenProperty);\n var CrossFadedProperty = function CrossFadedProperty2(specification) {\n this.specification = specification;\n };\n CrossFadedProperty.prototype.possiblyEvaluate = function possiblyEvaluate(value, parameters, canonical, availableImages) {\n if (value.value === void 0) {\n return void 0;\n } else if (value.expression.kind === \"constant\") {\n var constant = value.expression.evaluate(parameters, null, {}, canonical, availableImages);\n return this._calculate(constant, constant, constant, parameters);\n } else {\n return this._calculate(value.expression.evaluate(new EvaluationParameters(Math.floor(parameters.zoom - 1), parameters)), value.expression.evaluate(new EvaluationParameters(Math.floor(parameters.zoom), parameters)), value.expression.evaluate(new EvaluationParameters(Math.floor(parameters.zoom + 1), parameters)), parameters);\n }\n };\n CrossFadedProperty.prototype._calculate = function _calculate(min, mid, max, parameters) {\n var z = parameters.zoom;\n return z > parameters.zoomHistory.lastIntegerZoom ? {\n from: min,\n to: mid\n } : {\n from: max,\n to: mid\n };\n };\n CrossFadedProperty.prototype.interpolate = function interpolate2(a) {\n return a;\n };\n var ColorRampProperty = function ColorRampProperty2(specification) {\n this.specification = specification;\n };\n ColorRampProperty.prototype.possiblyEvaluate = function possiblyEvaluate(value, parameters, canonical, availableImages) {\n return !!value.expression.evaluate(parameters, null, {}, canonical, availableImages);\n };\n ColorRampProperty.prototype.interpolate = function interpolate2() {\n return false;\n };\n var Properties = function Properties2(properties2) {\n this.properties = properties2;\n this.defaultPropertyValues = {};\n this.defaultTransitionablePropertyValues = {};\n this.defaultTransitioningPropertyValues = {};\n this.defaultPossiblyEvaluatedValues = {};\n this.overridableProperties = [];\n for (var property in properties2) {\n var prop = properties2[property];\n if (prop.specification.overridable) {\n this.overridableProperties.push(property);\n }\n var defaultPropertyValue = this.defaultPropertyValues[property] = new PropertyValue(prop, void 0);\n var defaultTransitionablePropertyValue = this.defaultTransitionablePropertyValues[property] = new TransitionablePropertyValue(prop);\n this.defaultTransitioningPropertyValues[property] = defaultTransitionablePropertyValue.untransitioned();\n this.defaultPossiblyEvaluatedValues[property] = defaultPropertyValue.possiblyEvaluate({});\n }\n };\n register(\"DataDrivenProperty\", DataDrivenProperty);\n register(\"DataConstantProperty\", DataConstantProperty);\n register(\"CrossFadedDataDrivenProperty\", CrossFadedDataDrivenProperty);\n register(\"CrossFadedProperty\", CrossFadedProperty);\n register(\"ColorRampProperty\", ColorRampProperty);\n var TRANSITION_SUFFIX = \"-transition\";\n var StyleLayer = function(Evented2) {\n function StyleLayer2(layer2, properties2) {\n Evented2.call(this);\n this.id = layer2.id;\n this.type = layer2.type;\n this._featureFilter = {\n filter: function() {\n return true;\n },\n needGeometry: false\n };\n if (layer2.type === \"custom\") {\n return;\n }\n layer2 = layer2;\n this.metadata = layer2.metadata;\n this.minzoom = layer2.minzoom;\n this.maxzoom = layer2.maxzoom;\n if (layer2.type !== \"background\") {\n this.source = layer2.source;\n this.sourceLayer = layer2[\"source-layer\"];\n this.filter = layer2.filter;\n }\n if (properties2.layout) {\n this._unevaluatedLayout = new Layout(properties2.layout);\n }\n if (properties2.paint) {\n this._transitionablePaint = new Transitionable(properties2.paint);\n for (var property in layer2.paint) {\n this.setPaintProperty(property, layer2.paint[property], { validate: false });\n }\n for (var property$1 in layer2.layout) {\n this.setLayoutProperty(property$1, layer2.layout[property$1], { validate: false });\n }\n this._transitioningPaint = this._transitionablePaint.untransitioned();\n this.paint = new PossiblyEvaluated(properties2.paint);\n }\n }\n if (Evented2)\n StyleLayer2.__proto__ = Evented2;\n StyleLayer2.prototype = Object.create(Evented2 && Evented2.prototype);\n StyleLayer2.prototype.constructor = StyleLayer2;\n StyleLayer2.prototype.getCrossfadeParameters = function getCrossfadeParameters() {\n return this._crossfadeParameters;\n };\n StyleLayer2.prototype.getLayoutProperty = function getLayoutProperty(name3) {\n if (name3 === \"visibility\") {\n return this.visibility;\n }\n return this._unevaluatedLayout.getValue(name3);\n };\n StyleLayer2.prototype.setLayoutProperty = function setLayoutProperty(name3, value, options) {\n if (options === void 0)\n options = {};\n if (value !== null && value !== void 0) {\n var key = \"layers.\" + this.id + \".layout.\" + name3;\n if (this._validate(validateLayoutProperty$1, key, name3, value, options)) {\n return;\n }\n }\n if (name3 === \"visibility\") {\n this.visibility = value;\n return;\n }\n this._unevaluatedLayout.setValue(name3, value);\n };\n StyleLayer2.prototype.getPaintProperty = function getPaintProperty(name3) {\n if (endsWith(name3, TRANSITION_SUFFIX)) {\n return this._transitionablePaint.getTransition(name3.slice(0, -TRANSITION_SUFFIX.length));\n } else {\n return this._transitionablePaint.getValue(name3);\n }\n };\n StyleLayer2.prototype.setPaintProperty = function setPaintProperty(name3, value, options) {\n if (options === void 0)\n options = {};\n if (value !== null && value !== void 0) {\n var key = \"layers.\" + this.id + \".paint.\" + name3;\n if (this._validate(validatePaintProperty$1, key, name3, value, options)) {\n return false;\n }\n }\n if (endsWith(name3, TRANSITION_SUFFIX)) {\n this._transitionablePaint.setTransition(name3.slice(0, -TRANSITION_SUFFIX.length), value || void 0);\n return false;\n } else {\n var transitionable = this._transitionablePaint._values[name3];\n var isCrossFadedProperty = transitionable.property.specification[\"property-type\"] === \"cross-faded-data-driven\";\n var wasDataDriven = transitionable.value.isDataDriven();\n var oldValue = transitionable.value;\n this._transitionablePaint.setValue(name3, value);\n this._handleSpecialPaintPropertyUpdate(name3);\n var newValue = this._transitionablePaint._values[name3].value;\n var isDataDriven = newValue.isDataDriven();\n return isDataDriven || wasDataDriven || isCrossFadedProperty || this._handleOverridablePaintPropertyUpdate(name3, oldValue, newValue);\n }\n };\n StyleLayer2.prototype._handleSpecialPaintPropertyUpdate = function _handleSpecialPaintPropertyUpdate(_) {\n };\n StyleLayer2.prototype._handleOverridablePaintPropertyUpdate = function _handleOverridablePaintPropertyUpdate(name3, oldValue, newValue) {\n return false;\n };\n StyleLayer2.prototype.isHidden = function isHidden(zoom) {\n if (this.minzoom && zoom < this.minzoom) {\n return true;\n }\n if (this.maxzoom && zoom >= this.maxzoom) {\n return true;\n }\n return this.visibility === \"none\";\n };\n StyleLayer2.prototype.updateTransitions = function updateTransitions(parameters) {\n this._transitioningPaint = this._transitionablePaint.transitioned(parameters, this._transitioningPaint);\n };\n StyleLayer2.prototype.hasTransition = function hasTransition() {\n return this._transitioningPaint.hasTransition();\n };\n StyleLayer2.prototype.recalculate = function recalculate(parameters, availableImages) {\n if (parameters.getCrossfadeParameters) {\n this._crossfadeParameters = parameters.getCrossfadeParameters();\n }\n if (this._unevaluatedLayout) {\n this.layout = this._unevaluatedLayout.possiblyEvaluate(parameters, void 0, availableImages);\n }\n this.paint = this._transitioningPaint.possiblyEvaluate(parameters, void 0, availableImages);\n };\n StyleLayer2.prototype.serialize = function serialize2() {\n var output = {\n \"id\": this.id,\n \"type\": this.type,\n \"source\": this.source,\n \"source-layer\": this.sourceLayer,\n \"metadata\": this.metadata,\n \"minzoom\": this.minzoom,\n \"maxzoom\": this.maxzoom,\n \"filter\": this.filter,\n \"layout\": this._unevaluatedLayout && this._unevaluatedLayout.serialize(),\n \"paint\": this._transitionablePaint && this._transitionablePaint.serialize()\n };\n if (this.visibility) {\n output.layout = output.layout || {};\n output.layout.visibility = this.visibility;\n }\n return filterObject(output, function(value, key) {\n return value !== void 0 && !(key === \"layout\" && !Object.keys(value).length) && !(key === \"paint\" && !Object.keys(value).length);\n });\n };\n StyleLayer2.prototype._validate = function _validate(validate2, key, name3, value, options) {\n if (options === void 0)\n options = {};\n if (options && options.validate === false) {\n return false;\n }\n return emitValidationErrors(this, validate2.call(validateStyle, {\n key,\n layerType: this.type,\n objectKey: name3,\n value,\n styleSpec: spec,\n style: {\n glyphs: true,\n sprite: true\n }\n }));\n };\n StyleLayer2.prototype.is3D = function is3D() {\n return false;\n };\n StyleLayer2.prototype.isTileClipped = function isTileClipped() {\n return false;\n };\n StyleLayer2.prototype.hasOffscreenPass = function hasOffscreenPass() {\n return false;\n };\n StyleLayer2.prototype.resize = function resize() {\n };\n StyleLayer2.prototype.isStateDependent = function isStateDependent() {\n for (var property in this.paint._values) {\n var value = this.paint.get(property);\n if (!(value instanceof PossiblyEvaluatedPropertyValue) || !supportsPropertyExpression(value.property.specification)) {\n continue;\n }\n if ((value.value.kind === \"source\" || value.value.kind === \"composite\") && value.value.isStateDependent) {\n return true;\n }\n }\n return false;\n };\n return StyleLayer2;\n }(Evented);\n var viewTypes = {\n \"Int8\": Int8Array,\n \"Uint8\": Uint8Array,\n \"Int16\": Int16Array,\n \"Uint16\": Uint16Array,\n \"Int32\": Int32Array,\n \"Uint32\": Uint32Array,\n \"Float32\": Float32Array\n };\n var Struct = function Struct2(structArray, index) {\n this._structArray = structArray;\n this._pos1 = index * this.size;\n this._pos2 = this._pos1 / 2;\n this._pos4 = this._pos1 / 4;\n this._pos8 = this._pos1 / 8;\n };\n var DEFAULT_CAPACITY = 128;\n var RESIZE_MULTIPLIER = 5;\n var StructArray = function StructArray2() {\n this.isTransferred = false;\n this.capacity = -1;\n this.resize(0);\n };\n StructArray.serialize = function serialize2(array2, transferables) {\n array2._trim();\n if (transferables) {\n array2.isTransferred = true;\n transferables.push(array2.arrayBuffer);\n }\n return {\n length: array2.length,\n arrayBuffer: array2.arrayBuffer\n };\n };\n StructArray.deserialize = function deserialize2(input) {\n var structArray = Object.create(this.prototype);\n structArray.arrayBuffer = input.arrayBuffer;\n structArray.length = input.length;\n structArray.capacity = input.arrayBuffer.byteLength / structArray.bytesPerElement;\n structArray._refreshViews();\n return structArray;\n };\n StructArray.prototype._trim = function _trim() {\n if (this.length !== this.capacity) {\n this.capacity = this.length;\n this.arrayBuffer = this.arrayBuffer.slice(0, this.length * this.bytesPerElement);\n this._refreshViews();\n }\n };\n StructArray.prototype.clear = function clear() {\n this.length = 0;\n };\n StructArray.prototype.resize = function resize(n) {\n this.reserve(n);\n this.length = n;\n };\n StructArray.prototype.reserve = function reserve(n) {\n if (n > this.capacity) {\n this.capacity = Math.max(n, Math.floor(this.capacity * RESIZE_MULTIPLIER), DEFAULT_CAPACITY);\n this.arrayBuffer = new ArrayBuffer(this.capacity * this.bytesPerElement);\n var oldUint8Array = this.uint8;\n this._refreshViews();\n if (oldUint8Array) {\n this.uint8.set(oldUint8Array);\n }\n }\n };\n StructArray.prototype._refreshViews = function _refreshViews() {\n throw new Error(\"_refreshViews() must be implemented by each concrete StructArray layout\");\n };\n function createLayout(members2, alignment) {\n if (alignment === void 0)\n alignment = 1;\n var offset = 0;\n var maxSize = 0;\n var layoutMembers = members2.map(function(member) {\n var typeSize = sizeOf(member.type);\n var memberOffset = offset = align(offset, Math.max(alignment, typeSize));\n var components = member.components || 1;\n maxSize = Math.max(maxSize, typeSize);\n offset += typeSize * components;\n return {\n name: member.name,\n type: member.type,\n components,\n offset: memberOffset\n };\n });\n var size = align(offset, Math.max(maxSize, alignment));\n return {\n members: layoutMembers,\n size,\n alignment\n };\n }\n function sizeOf(type) {\n return viewTypes[type].BYTES_PER_ELEMENT;\n }\n function align(offset, size) {\n return Math.ceil(offset / size) * size;\n }\n var StructArrayLayout2i4 = function(StructArray2) {\n function StructArrayLayout2i42() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout2i42.__proto__ = StructArray2;\n StructArrayLayout2i42.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout2i42.prototype.constructor = StructArrayLayout2i42;\n StructArrayLayout2i42.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n };\n StructArrayLayout2i42.prototype.emplaceBack = function emplaceBack(v0, v1) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1);\n };\n StructArrayLayout2i42.prototype.emplace = function emplace(i, v0, v1) {\n var o2 = i * 2;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n return i;\n };\n return StructArrayLayout2i42;\n }(StructArray);\n StructArrayLayout2i4.prototype.bytesPerElement = 4;\n register(\"StructArrayLayout2i4\", StructArrayLayout2i4);\n var StructArrayLayout4i8 = function(StructArray2) {\n function StructArrayLayout4i82() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout4i82.__proto__ = StructArray2;\n StructArrayLayout4i82.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout4i82.prototype.constructor = StructArrayLayout4i82;\n StructArrayLayout4i82.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n };\n StructArrayLayout4i82.prototype.emplaceBack = function emplaceBack(v0, v1, v2, v3) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3);\n };\n StructArrayLayout4i82.prototype.emplace = function emplace(i, v0, v1, v2, v3) {\n var o2 = i * 4;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n return i;\n };\n return StructArrayLayout4i82;\n }(StructArray);\n StructArrayLayout4i8.prototype.bytesPerElement = 8;\n register(\"StructArrayLayout4i8\", StructArrayLayout4i8);\n var StructArrayLayout2i4i12 = function(StructArray2) {\n function StructArrayLayout2i4i122() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout2i4i122.__proto__ = StructArray2;\n StructArrayLayout2i4i122.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout2i4i122.prototype.constructor = StructArrayLayout2i4i122;\n StructArrayLayout2i4i122.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n };\n StructArrayLayout2i4i122.prototype.emplaceBack = function emplaceBack(v0, v1, v2, v3, v4, v5) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4, v5);\n };\n StructArrayLayout2i4i122.prototype.emplace = function emplace(i, v0, v1, v2, v3, v4, v5) {\n var o2 = i * 6;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n this.int16[o2 + 4] = v4;\n this.int16[o2 + 5] = v5;\n return i;\n };\n return StructArrayLayout2i4i122;\n }(StructArray);\n StructArrayLayout2i4i12.prototype.bytesPerElement = 12;\n register(\"StructArrayLayout2i4i12\", StructArrayLayout2i4i12);\n var StructArrayLayout2i4ub8 = function(StructArray2) {\n function StructArrayLayout2i4ub82() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout2i4ub82.__proto__ = StructArray2;\n StructArrayLayout2i4ub82.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout2i4ub82.prototype.constructor = StructArrayLayout2i4ub82;\n StructArrayLayout2i4ub82.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n };\n StructArrayLayout2i4ub82.prototype.emplaceBack = function emplaceBack(v0, v1, v2, v3, v4, v5) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4, v5);\n };\n StructArrayLayout2i4ub82.prototype.emplace = function emplace(i, v0, v1, v2, v3, v4, v5) {\n var o2 = i * 4;\n var o1 = i * 8;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.uint8[o1 + 4] = v2;\n this.uint8[o1 + 5] = v3;\n this.uint8[o1 + 6] = v4;\n this.uint8[o1 + 7] = v5;\n return i;\n };\n return StructArrayLayout2i4ub82;\n }(StructArray);\n StructArrayLayout2i4ub8.prototype.bytesPerElement = 8;\n register(\"StructArrayLayout2i4ub8\", StructArrayLayout2i4ub8);\n var StructArrayLayout2f8 = function(StructArray2) {\n function StructArrayLayout2f82() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout2f82.__proto__ = StructArray2;\n StructArrayLayout2f82.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout2f82.prototype.constructor = StructArrayLayout2f82;\n StructArrayLayout2f82.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n };\n StructArrayLayout2f82.prototype.emplaceBack = function emplaceBack(v0, v1) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1);\n };\n StructArrayLayout2f82.prototype.emplace = function emplace(i, v0, v1) {\n var o4 = i * 2;\n this.float32[o4 + 0] = v0;\n this.float32[o4 + 1] = v1;\n return i;\n };\n return StructArrayLayout2f82;\n }(StructArray);\n StructArrayLayout2f8.prototype.bytesPerElement = 8;\n register(\"StructArrayLayout2f8\", StructArrayLayout2f8);\n var StructArrayLayout10ui20 = function(StructArray2) {\n function StructArrayLayout10ui202() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout10ui202.__proto__ = StructArray2;\n StructArrayLayout10ui202.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout10ui202.prototype.constructor = StructArrayLayout10ui202;\n StructArrayLayout10ui202.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n };\n StructArrayLayout10ui202.prototype.emplaceBack = function emplaceBack(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);\n };\n StructArrayLayout10ui202.prototype.emplace = function emplace(i, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {\n var o2 = i * 10;\n this.uint16[o2 + 0] = v0;\n this.uint16[o2 + 1] = v1;\n this.uint16[o2 + 2] = v2;\n this.uint16[o2 + 3] = v3;\n this.uint16[o2 + 4] = v4;\n this.uint16[o2 + 5] = v5;\n this.uint16[o2 + 6] = v6;\n this.uint16[o2 + 7] = v7;\n this.uint16[o2 + 8] = v8;\n this.uint16[o2 + 9] = v9;\n return i;\n };\n return StructArrayLayout10ui202;\n }(StructArray);\n StructArrayLayout10ui20.prototype.bytesPerElement = 20;\n register(\"StructArrayLayout10ui20\", StructArrayLayout10ui20);\n var StructArrayLayout4i4ui4i24 = function(StructArray2) {\n function StructArrayLayout4i4ui4i242() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout4i4ui4i242.__proto__ = StructArray2;\n StructArrayLayout4i4ui4i242.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout4i4ui4i242.prototype.constructor = StructArrayLayout4i4ui4i242;\n StructArrayLayout4i4ui4i242.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n };\n StructArrayLayout4i4ui4i242.prototype.emplaceBack = function emplaceBack(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);\n };\n StructArrayLayout4i4ui4i242.prototype.emplace = function emplace(i, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) {\n var o2 = i * 12;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n this.uint16[o2 + 4] = v4;\n this.uint16[o2 + 5] = v5;\n this.uint16[o2 + 6] = v6;\n this.uint16[o2 + 7] = v7;\n this.int16[o2 + 8] = v8;\n this.int16[o2 + 9] = v9;\n this.int16[o2 + 10] = v10;\n this.int16[o2 + 11] = v11;\n return i;\n };\n return StructArrayLayout4i4ui4i242;\n }(StructArray);\n StructArrayLayout4i4ui4i24.prototype.bytesPerElement = 24;\n register(\"StructArrayLayout4i4ui4i24\", StructArrayLayout4i4ui4i24);\n var StructArrayLayout3f12 = function(StructArray2) {\n function StructArrayLayout3f122() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout3f122.__proto__ = StructArray2;\n StructArrayLayout3f122.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout3f122.prototype.constructor = StructArrayLayout3f122;\n StructArrayLayout3f122.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n };\n StructArrayLayout3f122.prototype.emplaceBack = function emplaceBack(v0, v1, v2) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2);\n };\n StructArrayLayout3f122.prototype.emplace = function emplace(i, v0, v1, v2) {\n var o4 = i * 3;\n this.float32[o4 + 0] = v0;\n this.float32[o4 + 1] = v1;\n this.float32[o4 + 2] = v2;\n return i;\n };\n return StructArrayLayout3f122;\n }(StructArray);\n StructArrayLayout3f12.prototype.bytesPerElement = 12;\n register(\"StructArrayLayout3f12\", StructArrayLayout3f12);\n var StructArrayLayout1ul4 = function(StructArray2) {\n function StructArrayLayout1ul42() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout1ul42.__proto__ = StructArray2;\n StructArrayLayout1ul42.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout1ul42.prototype.constructor = StructArrayLayout1ul42;\n StructArrayLayout1ul42.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.uint32 = new Uint32Array(this.arrayBuffer);\n };\n StructArrayLayout1ul42.prototype.emplaceBack = function emplaceBack(v0) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0);\n };\n StructArrayLayout1ul42.prototype.emplace = function emplace(i, v0) {\n var o4 = i * 1;\n this.uint32[o4 + 0] = v0;\n return i;\n };\n return StructArrayLayout1ul42;\n }(StructArray);\n StructArrayLayout1ul4.prototype.bytesPerElement = 4;\n register(\"StructArrayLayout1ul4\", StructArrayLayout1ul4);\n var StructArrayLayout6i1ul2ui20 = function(StructArray2) {\n function StructArrayLayout6i1ul2ui202() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout6i1ul2ui202.__proto__ = StructArray2;\n StructArrayLayout6i1ul2ui202.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout6i1ul2ui202.prototype.constructor = StructArrayLayout6i1ul2ui202;\n StructArrayLayout6i1ul2ui202.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n this.uint32 = new Uint32Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n };\n StructArrayLayout6i1ul2ui202.prototype.emplaceBack = function emplaceBack(v0, v1, v2, v3, v4, v5, v6, v7, v8) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4, v5, v6, v7, v8);\n };\n StructArrayLayout6i1ul2ui202.prototype.emplace = function emplace(i, v0, v1, v2, v3, v4, v5, v6, v7, v8) {\n var o2 = i * 10;\n var o4 = i * 5;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n this.int16[o2 + 4] = v4;\n this.int16[o2 + 5] = v5;\n this.uint32[o4 + 3] = v6;\n this.uint16[o2 + 8] = v7;\n this.uint16[o2 + 9] = v8;\n return i;\n };\n return StructArrayLayout6i1ul2ui202;\n }(StructArray);\n StructArrayLayout6i1ul2ui20.prototype.bytesPerElement = 20;\n register(\"StructArrayLayout6i1ul2ui20\", StructArrayLayout6i1ul2ui20);\n var StructArrayLayout2i2i2i12 = function(StructArray2) {\n function StructArrayLayout2i2i2i122() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout2i2i2i122.__proto__ = StructArray2;\n StructArrayLayout2i2i2i122.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout2i2i2i122.prototype.constructor = StructArrayLayout2i2i2i122;\n StructArrayLayout2i2i2i122.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n };\n StructArrayLayout2i2i2i122.prototype.emplaceBack = function emplaceBack(v0, v1, v2, v3, v4, v5) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4, v5);\n };\n StructArrayLayout2i2i2i122.prototype.emplace = function emplace(i, v0, v1, v2, v3, v4, v5) {\n var o2 = i * 6;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n this.int16[o2 + 4] = v4;\n this.int16[o2 + 5] = v5;\n return i;\n };\n return StructArrayLayout2i2i2i122;\n }(StructArray);\n StructArrayLayout2i2i2i12.prototype.bytesPerElement = 12;\n register(\"StructArrayLayout2i2i2i12\", StructArrayLayout2i2i2i12);\n var StructArrayLayout2f1f2i16 = function(StructArray2) {\n function StructArrayLayout2f1f2i162() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout2f1f2i162.__proto__ = StructArray2;\n StructArrayLayout2f1f2i162.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout2f1f2i162.prototype.constructor = StructArrayLayout2f1f2i162;\n StructArrayLayout2f1f2i162.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n };\n StructArrayLayout2f1f2i162.prototype.emplaceBack = function emplaceBack(v0, v1, v2, v3, v4) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4);\n };\n StructArrayLayout2f1f2i162.prototype.emplace = function emplace(i, v0, v1, v2, v3, v4) {\n var o4 = i * 4;\n var o2 = i * 8;\n this.float32[o4 + 0] = v0;\n this.float32[o4 + 1] = v1;\n this.float32[o4 + 2] = v2;\n this.int16[o2 + 6] = v3;\n this.int16[o2 + 7] = v4;\n return i;\n };\n return StructArrayLayout2f1f2i162;\n }(StructArray);\n StructArrayLayout2f1f2i16.prototype.bytesPerElement = 16;\n register(\"StructArrayLayout2f1f2i16\", StructArrayLayout2f1f2i16);\n var StructArrayLayout2ub2f12 = function(StructArray2) {\n function StructArrayLayout2ub2f122() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout2ub2f122.__proto__ = StructArray2;\n StructArrayLayout2ub2f122.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout2ub2f122.prototype.constructor = StructArrayLayout2ub2f122;\n StructArrayLayout2ub2f122.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n };\n StructArrayLayout2ub2f122.prototype.emplaceBack = function emplaceBack(v0, v1, v2, v3) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3);\n };\n StructArrayLayout2ub2f122.prototype.emplace = function emplace(i, v0, v1, v2, v3) {\n var o1 = i * 12;\n var o4 = i * 3;\n this.uint8[o1 + 0] = v0;\n this.uint8[o1 + 1] = v1;\n this.float32[o4 + 1] = v2;\n this.float32[o4 + 2] = v3;\n return i;\n };\n return StructArrayLayout2ub2f122;\n }(StructArray);\n StructArrayLayout2ub2f12.prototype.bytesPerElement = 12;\n register(\"StructArrayLayout2ub2f12\", StructArrayLayout2ub2f12);\n var StructArrayLayout3ui6 = function(StructArray2) {\n function StructArrayLayout3ui62() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout3ui62.__proto__ = StructArray2;\n StructArrayLayout3ui62.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout3ui62.prototype.constructor = StructArrayLayout3ui62;\n StructArrayLayout3ui62.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n };\n StructArrayLayout3ui62.prototype.emplaceBack = function emplaceBack(v0, v1, v2) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2);\n };\n StructArrayLayout3ui62.prototype.emplace = function emplace(i, v0, v1, v2) {\n var o2 = i * 3;\n this.uint16[o2 + 0] = v0;\n this.uint16[o2 + 1] = v1;\n this.uint16[o2 + 2] = v2;\n return i;\n };\n return StructArrayLayout3ui62;\n }(StructArray);\n StructArrayLayout3ui6.prototype.bytesPerElement = 6;\n register(\"StructArrayLayout3ui6\", StructArrayLayout3ui6);\n var StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48 = function(StructArray2) {\n function StructArrayLayout2i2ui3ul3ui2f3ub1ul1i482() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout2i2ui3ul3ui2f3ub1ul1i482.__proto__ = StructArray2;\n StructArrayLayout2i2ui3ul3ui2f3ub1ul1i482.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout2i2ui3ul3ui2f3ub1ul1i482.prototype.constructor = StructArrayLayout2i2ui3ul3ui2f3ub1ul1i482;\n StructArrayLayout2i2ui3ul3ui2f3ub1ul1i482.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n this.uint32 = new Uint32Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n };\n StructArrayLayout2i2ui3ul3ui2f3ub1ul1i482.prototype.emplaceBack = function emplaceBack(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16);\n };\n StructArrayLayout2i2ui3ul3ui2f3ub1ul1i482.prototype.emplace = function emplace(i, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) {\n var o2 = i * 24;\n var o4 = i * 12;\n var o1 = i * 48;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.uint16[o2 + 2] = v2;\n this.uint16[o2 + 3] = v3;\n this.uint32[o4 + 2] = v4;\n this.uint32[o4 + 3] = v5;\n this.uint32[o4 + 4] = v6;\n this.uint16[o2 + 10] = v7;\n this.uint16[o2 + 11] = v8;\n this.uint16[o2 + 12] = v9;\n this.float32[o4 + 7] = v10;\n this.float32[o4 + 8] = v11;\n this.uint8[o1 + 36] = v12;\n this.uint8[o1 + 37] = v13;\n this.uint8[o1 + 38] = v14;\n this.uint32[o4 + 10] = v15;\n this.int16[o2 + 22] = v16;\n return i;\n };\n return StructArrayLayout2i2ui3ul3ui2f3ub1ul1i482;\n }(StructArray);\n StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48.prototype.bytesPerElement = 48;\n register(\"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48\", StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48);\n var StructArrayLayout8i15ui1ul4f68 = function(StructArray2) {\n function StructArrayLayout8i15ui1ul4f682() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout8i15ui1ul4f682.__proto__ = StructArray2;\n StructArrayLayout8i15ui1ul4f682.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout8i15ui1ul4f682.prototype.constructor = StructArrayLayout8i15ui1ul4f682;\n StructArrayLayout8i15ui1ul4f682.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n this.uint32 = new Uint32Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n };\n StructArrayLayout8i15ui1ul4f682.prototype.emplaceBack = function emplaceBack(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27);\n };\n StructArrayLayout8i15ui1ul4f682.prototype.emplace = function emplace(i, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) {\n var o2 = i * 34;\n var o4 = i * 17;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n this.int16[o2 + 4] = v4;\n this.int16[o2 + 5] = v5;\n this.int16[o2 + 6] = v6;\n this.int16[o2 + 7] = v7;\n this.uint16[o2 + 8] = v8;\n this.uint16[o2 + 9] = v9;\n this.uint16[o2 + 10] = v10;\n this.uint16[o2 + 11] = v11;\n this.uint16[o2 + 12] = v12;\n this.uint16[o2 + 13] = v13;\n this.uint16[o2 + 14] = v14;\n this.uint16[o2 + 15] = v15;\n this.uint16[o2 + 16] = v16;\n this.uint16[o2 + 17] = v17;\n this.uint16[o2 + 18] = v18;\n this.uint16[o2 + 19] = v19;\n this.uint16[o2 + 20] = v20;\n this.uint16[o2 + 21] = v21;\n this.uint16[o2 + 22] = v22;\n this.uint32[o4 + 12] = v23;\n this.float32[o4 + 13] = v24;\n this.float32[o4 + 14] = v25;\n this.float32[o4 + 15] = v26;\n this.float32[o4 + 16] = v27;\n return i;\n };\n return StructArrayLayout8i15ui1ul4f682;\n }(StructArray);\n StructArrayLayout8i15ui1ul4f68.prototype.bytesPerElement = 68;\n register(\"StructArrayLayout8i15ui1ul4f68\", StructArrayLayout8i15ui1ul4f68);\n var StructArrayLayout1f4 = function(StructArray2) {\n function StructArrayLayout1f42() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout1f42.__proto__ = StructArray2;\n StructArrayLayout1f42.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout1f42.prototype.constructor = StructArrayLayout1f42;\n StructArrayLayout1f42.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n };\n StructArrayLayout1f42.prototype.emplaceBack = function emplaceBack(v0) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0);\n };\n StructArrayLayout1f42.prototype.emplace = function emplace(i, v0) {\n var o4 = i * 1;\n this.float32[o4 + 0] = v0;\n return i;\n };\n return StructArrayLayout1f42;\n }(StructArray);\n StructArrayLayout1f4.prototype.bytesPerElement = 4;\n register(\"StructArrayLayout1f4\", StructArrayLayout1f4);\n var StructArrayLayout3i6 = function(StructArray2) {\n function StructArrayLayout3i62() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout3i62.__proto__ = StructArray2;\n StructArrayLayout3i62.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout3i62.prototype.constructor = StructArrayLayout3i62;\n StructArrayLayout3i62.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n };\n StructArrayLayout3i62.prototype.emplaceBack = function emplaceBack(v0, v1, v2) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2);\n };\n StructArrayLayout3i62.prototype.emplace = function emplace(i, v0, v1, v2) {\n var o2 = i * 3;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n return i;\n };\n return StructArrayLayout3i62;\n }(StructArray);\n StructArrayLayout3i6.prototype.bytesPerElement = 6;\n register(\"StructArrayLayout3i6\", StructArrayLayout3i6);\n var StructArrayLayout1ul2ui8 = function(StructArray2) {\n function StructArrayLayout1ul2ui82() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout1ul2ui82.__proto__ = StructArray2;\n StructArrayLayout1ul2ui82.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout1ul2ui82.prototype.constructor = StructArrayLayout1ul2ui82;\n StructArrayLayout1ul2ui82.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.uint32 = new Uint32Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n };\n StructArrayLayout1ul2ui82.prototype.emplaceBack = function emplaceBack(v0, v1, v2) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2);\n };\n StructArrayLayout1ul2ui82.prototype.emplace = function emplace(i, v0, v1, v2) {\n var o4 = i * 2;\n var o2 = i * 4;\n this.uint32[o4 + 0] = v0;\n this.uint16[o2 + 2] = v1;\n this.uint16[o2 + 3] = v2;\n return i;\n };\n return StructArrayLayout1ul2ui82;\n }(StructArray);\n StructArrayLayout1ul2ui8.prototype.bytesPerElement = 8;\n register(\"StructArrayLayout1ul2ui8\", StructArrayLayout1ul2ui8);\n var StructArrayLayout2ui4 = function(StructArray2) {\n function StructArrayLayout2ui42() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout2ui42.__proto__ = StructArray2;\n StructArrayLayout2ui42.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout2ui42.prototype.constructor = StructArrayLayout2ui42;\n StructArrayLayout2ui42.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n };\n StructArrayLayout2ui42.prototype.emplaceBack = function emplaceBack(v0, v1) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1);\n };\n StructArrayLayout2ui42.prototype.emplace = function emplace(i, v0, v1) {\n var o2 = i * 2;\n this.uint16[o2 + 0] = v0;\n this.uint16[o2 + 1] = v1;\n return i;\n };\n return StructArrayLayout2ui42;\n }(StructArray);\n StructArrayLayout2ui4.prototype.bytesPerElement = 4;\n register(\"StructArrayLayout2ui4\", StructArrayLayout2ui4);\n var StructArrayLayout1ui2 = function(StructArray2) {\n function StructArrayLayout1ui22() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout1ui22.__proto__ = StructArray2;\n StructArrayLayout1ui22.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout1ui22.prototype.constructor = StructArrayLayout1ui22;\n StructArrayLayout1ui22.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n };\n StructArrayLayout1ui22.prototype.emplaceBack = function emplaceBack(v0) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0);\n };\n StructArrayLayout1ui22.prototype.emplace = function emplace(i, v0) {\n var o2 = i * 1;\n this.uint16[o2 + 0] = v0;\n return i;\n };\n return StructArrayLayout1ui22;\n }(StructArray);\n StructArrayLayout1ui2.prototype.bytesPerElement = 2;\n register(\"StructArrayLayout1ui2\", StructArrayLayout1ui2);\n var StructArrayLayout4f16 = function(StructArray2) {\n function StructArrayLayout4f162() {\n StructArray2.apply(this, arguments);\n }\n if (StructArray2)\n StructArrayLayout4f162.__proto__ = StructArray2;\n StructArrayLayout4f162.prototype = Object.create(StructArray2 && StructArray2.prototype);\n StructArrayLayout4f162.prototype.constructor = StructArrayLayout4f162;\n StructArrayLayout4f162.prototype._refreshViews = function _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n };\n StructArrayLayout4f162.prototype.emplaceBack = function emplaceBack(v0, v1, v2, v3) {\n var i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3);\n };\n StructArrayLayout4f162.prototype.emplace = function emplace(i, v0, v1, v2, v3) {\n var o4 = i * 4;\n this.float32[o4 + 0] = v0;\n this.float32[o4 + 1] = v1;\n this.float32[o4 + 2] = v2;\n this.float32[o4 + 3] = v3;\n return i;\n };\n return StructArrayLayout4f162;\n }(StructArray);\n StructArrayLayout4f16.prototype.bytesPerElement = 16;\n register(\"StructArrayLayout4f16\", StructArrayLayout4f16);\n var CollisionBoxStruct = function(Struct2) {\n function CollisionBoxStruct2() {\n Struct2.apply(this, arguments);\n }\n if (Struct2)\n CollisionBoxStruct2.__proto__ = Struct2;\n CollisionBoxStruct2.prototype = Object.create(Struct2 && Struct2.prototype);\n CollisionBoxStruct2.prototype.constructor = CollisionBoxStruct2;\n var prototypeAccessors2 = {\n anchorPointX: { configurable: true },\n anchorPointY: { configurable: true },\n x1: { configurable: true },\n y1: { configurable: true },\n x2: { configurable: true },\n y2: { configurable: true },\n featureIndex: { configurable: true },\n sourceLayerIndex: { configurable: true },\n bucketIndex: { configurable: true },\n anchorPoint: { configurable: true }\n };\n prototypeAccessors2.anchorPointX.get = function() {\n return this._structArray.int16[this._pos2 + 0];\n };\n prototypeAccessors2.anchorPointY.get = function() {\n return this._structArray.int16[this._pos2 + 1];\n };\n prototypeAccessors2.x1.get = function() {\n return this._structArray.int16[this._pos2 + 2];\n };\n prototypeAccessors2.y1.get = function() {\n return this._structArray.int16[this._pos2 + 3];\n };\n prototypeAccessors2.x2.get = function() {\n return this._structArray.int16[this._pos2 + 4];\n };\n prototypeAccessors2.y2.get = function() {\n return this._structArray.int16[this._pos2 + 5];\n };\n prototypeAccessors2.featureIndex.get = function() {\n return this._structArray.uint32[this._pos4 + 3];\n };\n prototypeAccessors2.sourceLayerIndex.get = function() {\n return this._structArray.uint16[this._pos2 + 8];\n };\n prototypeAccessors2.bucketIndex.get = function() {\n return this._structArray.uint16[this._pos2 + 9];\n };\n prototypeAccessors2.anchorPoint.get = function() {\n return new pointGeometry(this.anchorPointX, this.anchorPointY);\n };\n Object.defineProperties(CollisionBoxStruct2.prototype, prototypeAccessors2);\n return CollisionBoxStruct2;\n }(Struct);\n CollisionBoxStruct.prototype.size = 20;\n var CollisionBoxArray = function(StructArrayLayout6i1ul2ui202) {\n function CollisionBoxArray2() {\n StructArrayLayout6i1ul2ui202.apply(this, arguments);\n }\n if (StructArrayLayout6i1ul2ui202)\n CollisionBoxArray2.__proto__ = StructArrayLayout6i1ul2ui202;\n CollisionBoxArray2.prototype = Object.create(StructArrayLayout6i1ul2ui202 && StructArrayLayout6i1ul2ui202.prototype);\n CollisionBoxArray2.prototype.constructor = CollisionBoxArray2;\n CollisionBoxArray2.prototype.get = function get2(index) {\n return new CollisionBoxStruct(this, index);\n };\n return CollisionBoxArray2;\n }(StructArrayLayout6i1ul2ui20);\n register(\"CollisionBoxArray\", CollisionBoxArray);\n var PlacedSymbolStruct = function(Struct2) {\n function PlacedSymbolStruct2() {\n Struct2.apply(this, arguments);\n }\n if (Struct2)\n PlacedSymbolStruct2.__proto__ = Struct2;\n PlacedSymbolStruct2.prototype = Object.create(Struct2 && Struct2.prototype);\n PlacedSymbolStruct2.prototype.constructor = PlacedSymbolStruct2;\n var prototypeAccessors$12 = {\n anchorX: { configurable: true },\n anchorY: { configurable: true },\n glyphStartIndex: { configurable: true },\n numGlyphs: { configurable: true },\n vertexStartIndex: { configurable: true },\n lineStartIndex: { configurable: true },\n lineLength: { configurable: true },\n segment: { configurable: true },\n lowerSize: { configurable: true },\n upperSize: { configurable: true },\n lineOffsetX: { configurable: true },\n lineOffsetY: { configurable: true },\n writingMode: { configurable: true },\n placedOrientation: { configurable: true },\n hidden: { configurable: true },\n crossTileID: { configurable: true },\n associatedIconIndex: { configurable: true }\n };\n prototypeAccessors$12.anchorX.get = function() {\n return this._structArray.int16[this._pos2 + 0];\n };\n prototypeAccessors$12.anchorY.get = function() {\n return this._structArray.int16[this._pos2 + 1];\n };\n prototypeAccessors$12.glyphStartIndex.get = function() {\n return this._structArray.uint16[this._pos2 + 2];\n };\n prototypeAccessors$12.numGlyphs.get = function() {\n return this._structArray.uint16[this._pos2 + 3];\n };\n prototypeAccessors$12.vertexStartIndex.get = function() {\n return this._structArray.uint32[this._pos4 + 2];\n };\n prototypeAccessors$12.lineStartIndex.get = function() {\n return this._structArray.uint32[this._pos4 + 3];\n };\n prototypeAccessors$12.lineLength.get = function() {\n return this._structArray.uint32[this._pos4 + 4];\n };\n prototypeAccessors$12.segment.get = function() {\n return this._structArray.uint16[this._pos2 + 10];\n };\n prototypeAccessors$12.lowerSize.get = function() {\n return this._structArray.uint16[this._pos2 + 11];\n };\n prototypeAccessors$12.upperSize.get = function() {\n return this._structArray.uint16[this._pos2 + 12];\n };\n prototypeAccessors$12.lineOffsetX.get = function() {\n return this._structArray.float32[this._pos4 + 7];\n };\n prototypeAccessors$12.lineOffsetY.get = function() {\n return this._structArray.float32[this._pos4 + 8];\n };\n prototypeAccessors$12.writingMode.get = function() {\n return this._structArray.uint8[this._pos1 + 36];\n };\n prototypeAccessors$12.placedOrientation.get = function() {\n return this._structArray.uint8[this._pos1 + 37];\n };\n prototypeAccessors$12.placedOrientation.set = function(x) {\n this._structArray.uint8[this._pos1 + 37] = x;\n };\n prototypeAccessors$12.hidden.get = function() {\n return this._structArray.uint8[this._pos1 + 38];\n };\n prototypeAccessors$12.hidden.set = function(x) {\n this._structArray.uint8[this._pos1 + 38] = x;\n };\n prototypeAccessors$12.crossTileID.get = function() {\n return this._structArray.uint32[this._pos4 + 10];\n };\n prototypeAccessors$12.crossTileID.set = function(x) {\n this._structArray.uint32[this._pos4 + 10] = x;\n };\n prototypeAccessors$12.associatedIconIndex.get = function() {\n return this._structArray.int16[this._pos2 + 22];\n };\n Object.defineProperties(PlacedSymbolStruct2.prototype, prototypeAccessors$12);\n return PlacedSymbolStruct2;\n }(Struct);\n PlacedSymbolStruct.prototype.size = 48;\n var PlacedSymbolArray = function(StructArrayLayout2i2ui3ul3ui2f3ub1ul1i482) {\n function PlacedSymbolArray2() {\n StructArrayLayout2i2ui3ul3ui2f3ub1ul1i482.apply(this, arguments);\n }\n if (StructArrayLayout2i2ui3ul3ui2f3ub1ul1i482)\n PlacedSymbolArray2.__proto__ = StructArrayLayout2i2ui3ul3ui2f3ub1ul1i482;\n PlacedSymbolArray2.prototype = Object.create(StructArrayLayout2i2ui3ul3ui2f3ub1ul1i482 && StructArrayLayout2i2ui3ul3ui2f3ub1ul1i482.prototype);\n PlacedSymbolArray2.prototype.constructor = PlacedSymbolArray2;\n PlacedSymbolArray2.prototype.get = function get2(index) {\n return new PlacedSymbolStruct(this, index);\n };\n return PlacedSymbolArray2;\n }(StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48);\n register(\"PlacedSymbolArray\", PlacedSymbolArray);\n var SymbolInstanceStruct = function(Struct2) {\n function SymbolInstanceStruct2() {\n Struct2.apply(this, arguments);\n }\n if (Struct2)\n SymbolInstanceStruct2.__proto__ = Struct2;\n SymbolInstanceStruct2.prototype = Object.create(Struct2 && Struct2.prototype);\n SymbolInstanceStruct2.prototype.constructor = SymbolInstanceStruct2;\n var prototypeAccessors$2 = {\n anchorX: { configurable: true },\n anchorY: { configurable: true },\n rightJustifiedTextSymbolIndex: { configurable: true },\n centerJustifiedTextSymbolIndex: { configurable: true },\n leftJustifiedTextSymbolIndex: { configurable: true },\n verticalPlacedTextSymbolIndex: { configurable: true },\n placedIconSymbolIndex: { configurable: true },\n verticalPlacedIconSymbolIndex: { configurable: true },\n key: { configurable: true },\n textBoxStartIndex: { configurable: true },\n textBoxEndIndex: { configurable: true },\n verticalTextBoxStartIndex: { configurable: true },\n verticalTextBoxEndIndex: { configurable: true },\n iconBoxStartIndex: { configurable: true },\n iconBoxEndIndex: { configurable: true },\n verticalIconBoxStartIndex: { configurable: true },\n verticalIconBoxEndIndex: { configurable: true },\n featureIndex: { configurable: true },\n numHorizontalGlyphVertices: { configurable: true },\n numVerticalGlyphVertices: { configurable: true },\n numIconVertices: { configurable: true },\n numVerticalIconVertices: { configurable: true },\n useRuntimeCollisionCircles: { configurable: true },\n crossTileID: { configurable: true },\n textBoxScale: { configurable: true },\n textOffset0: { configurable: true },\n textOffset1: { configurable: true },\n collisionCircleDiameter: { configurable: true }\n };\n prototypeAccessors$2.anchorX.get = function() {\n return this._structArray.int16[this._pos2 + 0];\n };\n prototypeAccessors$2.anchorY.get = function() {\n return this._structArray.int16[this._pos2 + 1];\n };\n prototypeAccessors$2.rightJustifiedTextSymbolIndex.get = function() {\n return this._structArray.int16[this._pos2 + 2];\n };\n prototypeAccessors$2.centerJustifiedTextSymbolIndex.get = function() {\n return this._structArray.int16[this._pos2 + 3];\n };\n prototypeAccessors$2.leftJustifiedTextSymbolIndex.get = function() {\n return this._structArray.int16[this._pos2 + 4];\n };\n prototypeAccessors$2.verticalPlacedTextSymbolIndex.get = function() {\n return this._structArray.int16[this._pos2 + 5];\n };\n prototypeAccessors$2.placedIconSymbolIndex.get = function() {\n return this._structArray.int16[this._pos2 + 6];\n };\n prototypeAccessors$2.verticalPlacedIconSymbolIndex.get = function() {\n return this._structArray.int16[this._pos2 + 7];\n };\n prototypeAccessors$2.key.get = function() {\n return this._structArray.uint16[this._pos2 + 8];\n };\n prototypeAccessors$2.textBoxStartIndex.get = function() {\n return this._structArray.uint16[this._pos2 + 9];\n };\n prototypeAccessors$2.textBoxEndIndex.get = function() {\n return this._structArray.uint16[this._pos2 + 10];\n };\n prototypeAccessors$2.verticalTextBoxStartIndex.get = function() {\n return this._structArray.uint16[this._pos2 + 11];\n };\n prototypeAccessors$2.verticalTextBoxEndIndex.get = function() {\n return this._structArray.uint16[this._pos2 + 12];\n };\n prototypeAccessors$2.iconBoxStartIndex.get = function() {\n return this._structArray.uint16[this._pos2 + 13];\n };\n prototypeAccessors$2.iconBoxEndIndex.get = function() {\n return this._structArray.uint16[this._pos2 + 14];\n };\n prototypeAccessors$2.verticalIconBoxStartIndex.get = function() {\n return this._structArray.uint16[this._pos2 + 15];\n };\n prototypeAccessors$2.verticalIconBoxEndIndex.get = function() {\n return this._structArray.uint16[this._pos2 + 16];\n };\n prototypeAccessors$2.featureIndex.get = function() {\n return this._structArray.uint16[this._pos2 + 17];\n };\n prototypeAccessors$2.numHorizontalGlyphVertices.get = function() {\n return this._structArray.uint16[this._pos2 + 18];\n };\n prototypeAccessors$2.numVerticalGlyphVertices.get = function() {\n return this._structArray.uint16[this._pos2 + 19];\n };\n prototypeAccessors$2.numIconVertices.get = function() {\n return this._structArray.uint16[this._pos2 + 20];\n };\n prototypeAccessors$2.numVerticalIconVertices.get = function() {\n return this._structArray.uint16[this._pos2 + 21];\n };\n prototypeAccessors$2.useRuntimeCollisionCircles.get = function() {\n return this._structArray.uint16[this._pos2 + 22];\n };\n prototypeAccessors$2.crossTileID.get = function() {\n return this._structArray.uint32[this._pos4 + 12];\n };\n prototypeAccessors$2.crossTileID.set = function(x) {\n this._structArray.uint32[this._pos4 + 12] = x;\n };\n prototypeAccessors$2.textBoxScale.get = function() {\n return this._structArray.float32[this._pos4 + 13];\n };\n prototypeAccessors$2.textOffset0.get = function() {\n return this._structArray.float32[this._pos4 + 14];\n };\n prototypeAccessors$2.textOffset1.get = function() {\n return this._structArray.float32[this._pos4 + 15];\n };\n prototypeAccessors$2.collisionCircleDiameter.get = function() {\n return this._structArray.float32[this._pos4 + 16];\n };\n Object.defineProperties(SymbolInstanceStruct2.prototype, prototypeAccessors$2);\n return SymbolInstanceStruct2;\n }(Struct);\n SymbolInstanceStruct.prototype.size = 68;\n var SymbolInstanceArray = function(StructArrayLayout8i15ui1ul4f682) {\n function SymbolInstanceArray2() {\n StructArrayLayout8i15ui1ul4f682.apply(this, arguments);\n }\n if (StructArrayLayout8i15ui1ul4f682)\n SymbolInstanceArray2.__proto__ = StructArrayLayout8i15ui1ul4f682;\n SymbolInstanceArray2.prototype = Object.create(StructArrayLayout8i15ui1ul4f682 && StructArrayLayout8i15ui1ul4f682.prototype);\n SymbolInstanceArray2.prototype.constructor = SymbolInstanceArray2;\n SymbolInstanceArray2.prototype.get = function get2(index) {\n return new SymbolInstanceStruct(this, index);\n };\n return SymbolInstanceArray2;\n }(StructArrayLayout8i15ui1ul4f68);\n register(\"SymbolInstanceArray\", SymbolInstanceArray);\n var GlyphOffsetArray = function(StructArrayLayout1f42) {\n function GlyphOffsetArray2() {\n StructArrayLayout1f42.apply(this, arguments);\n }\n if (StructArrayLayout1f42)\n GlyphOffsetArray2.__proto__ = StructArrayLayout1f42;\n GlyphOffsetArray2.prototype = Object.create(StructArrayLayout1f42 && StructArrayLayout1f42.prototype);\n GlyphOffsetArray2.prototype.constructor = GlyphOffsetArray2;\n GlyphOffsetArray2.prototype.getoffsetX = function getoffsetX(index) {\n return this.float32[index * 1 + 0];\n };\n return GlyphOffsetArray2;\n }(StructArrayLayout1f4);\n register(\"GlyphOffsetArray\", GlyphOffsetArray);\n var SymbolLineVertexArray = function(StructArrayLayout3i62) {\n function SymbolLineVertexArray2() {\n StructArrayLayout3i62.apply(this, arguments);\n }\n if (StructArrayLayout3i62)\n SymbolLineVertexArray2.__proto__ = StructArrayLayout3i62;\n SymbolLineVertexArray2.prototype = Object.create(StructArrayLayout3i62 && StructArrayLayout3i62.prototype);\n SymbolLineVertexArray2.prototype.constructor = SymbolLineVertexArray2;\n SymbolLineVertexArray2.prototype.getx = function getx(index) {\n return this.int16[index * 3 + 0];\n };\n SymbolLineVertexArray2.prototype.gety = function gety(index) {\n return this.int16[index * 3 + 1];\n };\n SymbolLineVertexArray2.prototype.gettileUnitDistanceFromAnchor = function gettileUnitDistanceFromAnchor(index) {\n return this.int16[index * 3 + 2];\n };\n return SymbolLineVertexArray2;\n }(StructArrayLayout3i6);\n register(\"SymbolLineVertexArray\", SymbolLineVertexArray);\n var FeatureIndexStruct = function(Struct2) {\n function FeatureIndexStruct2() {\n Struct2.apply(this, arguments);\n }\n if (Struct2)\n FeatureIndexStruct2.__proto__ = Struct2;\n FeatureIndexStruct2.prototype = Object.create(Struct2 && Struct2.prototype);\n FeatureIndexStruct2.prototype.constructor = FeatureIndexStruct2;\n var prototypeAccessors$3 = {\n featureIndex: { configurable: true },\n sourceLayerIndex: { configurable: true },\n bucketIndex: { configurable: true }\n };\n prototypeAccessors$3.featureIndex.get = function() {\n return this._structArray.uint32[this._pos4 + 0];\n };\n prototypeAccessors$3.sourceLayerIndex.get = function() {\n return this._structArray.uint16[this._pos2 + 2];\n };\n prototypeAccessors$3.bucketIndex.get = function() {\n return this._structArray.uint16[this._pos2 + 3];\n };\n Object.defineProperties(FeatureIndexStruct2.prototype, prototypeAccessors$3);\n return FeatureIndexStruct2;\n }(Struct);\n FeatureIndexStruct.prototype.size = 8;\n var FeatureIndexArray = function(StructArrayLayout1ul2ui82) {\n function FeatureIndexArray2() {\n StructArrayLayout1ul2ui82.apply(this, arguments);\n }\n if (StructArrayLayout1ul2ui82)\n FeatureIndexArray2.__proto__ = StructArrayLayout1ul2ui82;\n FeatureIndexArray2.prototype = Object.create(StructArrayLayout1ul2ui82 && StructArrayLayout1ul2ui82.prototype);\n FeatureIndexArray2.prototype.constructor = FeatureIndexArray2;\n FeatureIndexArray2.prototype.get = function get2(index) {\n return new FeatureIndexStruct(this, index);\n };\n return FeatureIndexArray2;\n }(StructArrayLayout1ul2ui8);\n register(\"FeatureIndexArray\", FeatureIndexArray);\n var layout$1 = createLayout([{\n name: \"a_pos\",\n components: 2,\n type: \"Int16\"\n }], 4);\n var members = layout$1.members;\n var SegmentVector = function SegmentVector2(segments) {\n if (segments === void 0)\n segments = [];\n this.segments = segments;\n };\n SegmentVector.prototype.prepareSegment = function prepareSegment(numVertices, layoutVertexArray, indexArray, sortKey) {\n var segment = this.segments[this.segments.length - 1];\n if (numVertices > SegmentVector.MAX_VERTEX_ARRAY_LENGTH) {\n warnOnce(\"Max vertices per segment is \" + SegmentVector.MAX_VERTEX_ARRAY_LENGTH + \": bucket requested \" + numVertices);\n }\n if (!segment || segment.vertexLength + numVertices > SegmentVector.MAX_VERTEX_ARRAY_LENGTH || segment.sortKey !== sortKey) {\n segment = {\n vertexOffset: layoutVertexArray.length,\n primitiveOffset: indexArray.length,\n vertexLength: 0,\n primitiveLength: 0\n };\n if (sortKey !== void 0) {\n segment.sortKey = sortKey;\n }\n this.segments.push(segment);\n }\n return segment;\n };\n SegmentVector.prototype.get = function get2() {\n return this.segments;\n };\n SegmentVector.prototype.destroy = function destroy() {\n for (var i = 0, list = this.segments; i < list.length; i += 1) {\n var segment = list[i];\n for (var k in segment.vaos) {\n segment.vaos[k].destroy();\n }\n }\n };\n SegmentVector.simpleSegment = function simpleSegment(vertexOffset, primitiveOffset, vertexLength, primitiveLength) {\n return new SegmentVector([{\n vertexOffset,\n primitiveOffset,\n vertexLength,\n primitiveLength,\n vaos: {},\n sortKey: 0\n }]);\n };\n SegmentVector.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1;\n register(\"SegmentVector\", SegmentVector);\n function packUint8ToFloat(a, b) {\n a = clamp(Math.floor(a), 0, 255);\n b = clamp(Math.floor(b), 0, 255);\n return 256 * a + b;\n }\n var patternAttributes = createLayout([\n {\n name: \"a_pattern_from\",\n components: 4,\n type: \"Uint16\"\n },\n {\n name: \"a_pattern_to\",\n components: 4,\n type: \"Uint16\"\n },\n {\n name: \"a_pixel_ratio_from\",\n components: 1,\n type: \"Uint16\"\n },\n {\n name: \"a_pixel_ratio_to\",\n components: 1,\n type: \"Uint16\"\n }\n ]);\n var murmurhash3_gc = createCommonjsModule(function(module2) {\n function murmurhash3_32_gc(key, seed) {\n var remainder, bytes, h1, h1b, c1, c2, k1, i;\n remainder = key.length & 3;\n bytes = key.length - remainder;\n h1 = seed;\n c1 = 3432918353;\n c2 = 461845907;\n i = 0;\n while (i < bytes) {\n k1 = key.charCodeAt(i) & 255 | (key.charCodeAt(++i) & 255) << 8 | (key.charCodeAt(++i) & 255) << 16 | (key.charCodeAt(++i) & 255) << 24;\n ++i;\n k1 = (k1 & 65535) * c1 + (((k1 >>> 16) * c1 & 65535) << 16) & 4294967295;\n k1 = k1 << 15 | k1 >>> 17;\n k1 = (k1 & 65535) * c2 + (((k1 >>> 16) * c2 & 65535) << 16) & 4294967295;\n h1 ^= k1;\n h1 = h1 << 13 | h1 >>> 19;\n h1b = (h1 & 65535) * 5 + (((h1 >>> 16) * 5 & 65535) << 16) & 4294967295;\n h1 = (h1b & 65535) + 27492 + (((h1b >>> 16) + 58964 & 65535) << 16);\n }\n k1 = 0;\n switch (remainder) {\n case 3:\n k1 ^= (key.charCodeAt(i + 2) & 255) << 16;\n case 2:\n k1 ^= (key.charCodeAt(i + 1) & 255) << 8;\n case 1:\n k1 ^= key.charCodeAt(i) & 255;\n k1 = (k1 & 65535) * c1 + (((k1 >>> 16) * c1 & 65535) << 16) & 4294967295;\n k1 = k1 << 15 | k1 >>> 17;\n k1 = (k1 & 65535) * c2 + (((k1 >>> 16) * c2 & 65535) << 16) & 4294967295;\n h1 ^= k1;\n }\n h1 ^= key.length;\n h1 ^= h1 >>> 16;\n h1 = (h1 & 65535) * 2246822507 + (((h1 >>> 16) * 2246822507 & 65535) << 16) & 4294967295;\n h1 ^= h1 >>> 13;\n h1 = (h1 & 65535) * 3266489909 + (((h1 >>> 16) * 3266489909 & 65535) << 16) & 4294967295;\n h1 ^= h1 >>> 16;\n return h1 >>> 0;\n }\n {\n module2.exports = murmurhash3_32_gc;\n }\n });\n var murmurhash2_gc = createCommonjsModule(function(module2) {\n function murmurhash2_32_gc(str, seed) {\n var l = str.length, h = seed ^ l, i = 0, k;\n while (l >= 4) {\n k = str.charCodeAt(i) & 255 | (str.charCodeAt(++i) & 255) << 8 | (str.charCodeAt(++i) & 255) << 16 | (str.charCodeAt(++i) & 255) << 24;\n k = (k & 65535) * 1540483477 + (((k >>> 16) * 1540483477 & 65535) << 16);\n k ^= k >>> 24;\n k = (k & 65535) * 1540483477 + (((k >>> 16) * 1540483477 & 65535) << 16);\n h = (h & 65535) * 1540483477 + (((h >>> 16) * 1540483477 & 65535) << 16) ^ k;\n l -= 4;\n ++i;\n }\n switch (l) {\n case 3:\n h ^= (str.charCodeAt(i + 2) & 255) << 16;\n case 2:\n h ^= (str.charCodeAt(i + 1) & 255) << 8;\n case 1:\n h ^= str.charCodeAt(i) & 255;\n h = (h & 65535) * 1540483477 + (((h >>> 16) * 1540483477 & 65535) << 16);\n }\n h ^= h >>> 13;\n h = (h & 65535) * 1540483477 + (((h >>> 16) * 1540483477 & 65535) << 16);\n h ^= h >>> 15;\n return h >>> 0;\n }\n {\n module2.exports = murmurhash2_32_gc;\n }\n });\n var murmurhashJs = murmurhash3_gc;\n var murmur3_1 = murmurhash3_gc;\n var murmur2_1 = murmurhash2_gc;\n murmurhashJs.murmur3 = murmur3_1;\n murmurhashJs.murmur2 = murmur2_1;\n var FeaturePositionMap = function FeaturePositionMap2() {\n this.ids = [];\n this.positions = [];\n this.indexed = false;\n };\n FeaturePositionMap.prototype.add = function add2(id2, index, start, end) {\n this.ids.push(getNumericId(id2));\n this.positions.push(index, start, end);\n };\n FeaturePositionMap.prototype.getPositions = function getPositions(id2) {\n var intId = getNumericId(id2);\n var i = 0;\n var j = this.ids.length - 1;\n while (i < j) {\n var m = i + j >> 1;\n if (this.ids[m] >= intId) {\n j = m;\n } else {\n i = m + 1;\n }\n }\n var positions = [];\n while (this.ids[i] === intId) {\n var index = this.positions[3 * i];\n var start = this.positions[3 * i + 1];\n var end = this.positions[3 * i + 2];\n positions.push({\n index,\n start,\n end\n });\n i++;\n }\n return positions;\n };\n FeaturePositionMap.serialize = function serialize2(map, transferables) {\n var ids = new Float64Array(map.ids);\n var positions = new Uint32Array(map.positions);\n sort(ids, positions, 0, ids.length - 1);\n if (transferables) {\n transferables.push(ids.buffer, positions.buffer);\n }\n return {\n ids,\n positions\n };\n };\n FeaturePositionMap.deserialize = function deserialize2(obj) {\n var map = new FeaturePositionMap();\n map.ids = obj.ids;\n map.positions = obj.positions;\n map.indexed = true;\n return map;\n };\n var MAX_SAFE_INTEGER$1 = Math.pow(2, 53) - 1;\n function getNumericId(value) {\n var numValue = +value;\n if (!isNaN(numValue) && numValue <= MAX_SAFE_INTEGER$1) {\n return numValue;\n }\n return murmurhashJs(String(value));\n }\n function sort(ids, positions, left, right) {\n while (left < right) {\n var pivot = ids[left + right >> 1];\n var i = left - 1;\n var j = right + 1;\n while (true) {\n do {\n i++;\n } while (ids[i] < pivot);\n do {\n j--;\n } while (ids[j] > pivot);\n if (i >= j) {\n break;\n }\n swap(ids, i, j);\n swap(positions, 3 * i, 3 * j);\n swap(positions, 3 * i + 1, 3 * j + 1);\n swap(positions, 3 * i + 2, 3 * j + 2);\n }\n if (j - left < right - j) {\n sort(ids, positions, left, j);\n left = j + 1;\n } else {\n sort(ids, positions, j + 1, right);\n right = j;\n }\n }\n }\n function swap(arr, i, j) {\n var tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n register(\"FeaturePositionMap\", FeaturePositionMap);\n var Uniform = function Uniform2(context, location2) {\n this.gl = context.gl;\n this.location = location2;\n };\n var Uniform1i = function(Uniform2) {\n function Uniform1i2(context, location2) {\n Uniform2.call(this, context, location2);\n this.current = 0;\n }\n if (Uniform2)\n Uniform1i2.__proto__ = Uniform2;\n Uniform1i2.prototype = Object.create(Uniform2 && Uniform2.prototype);\n Uniform1i2.prototype.constructor = Uniform1i2;\n Uniform1i2.prototype.set = function set(v) {\n if (this.current !== v) {\n this.current = v;\n this.gl.uniform1i(this.location, v);\n }\n };\n return Uniform1i2;\n }(Uniform);\n var Uniform1f = function(Uniform2) {\n function Uniform1f2(context, location2) {\n Uniform2.call(this, context, location2);\n this.current = 0;\n }\n if (Uniform2)\n Uniform1f2.__proto__ = Uniform2;\n Uniform1f2.prototype = Object.create(Uniform2 && Uniform2.prototype);\n Uniform1f2.prototype.constructor = Uniform1f2;\n Uniform1f2.prototype.set = function set(v) {\n if (this.current !== v) {\n this.current = v;\n this.gl.uniform1f(this.location, v);\n }\n };\n return Uniform1f2;\n }(Uniform);\n var Uniform2f = function(Uniform2) {\n function Uniform2f2(context, location2) {\n Uniform2.call(this, context, location2);\n this.current = [\n 0,\n 0\n ];\n }\n if (Uniform2)\n Uniform2f2.__proto__ = Uniform2;\n Uniform2f2.prototype = Object.create(Uniform2 && Uniform2.prototype);\n Uniform2f2.prototype.constructor = Uniform2f2;\n Uniform2f2.prototype.set = function set(v) {\n if (v[0] !== this.current[0] || v[1] !== this.current[1]) {\n this.current = v;\n this.gl.uniform2f(this.location, v[0], v[1]);\n }\n };\n return Uniform2f2;\n }(Uniform);\n var Uniform3f = function(Uniform2) {\n function Uniform3f2(context, location2) {\n Uniform2.call(this, context, location2);\n this.current = [\n 0,\n 0,\n 0\n ];\n }\n if (Uniform2)\n Uniform3f2.__proto__ = Uniform2;\n Uniform3f2.prototype = Object.create(Uniform2 && Uniform2.prototype);\n Uniform3f2.prototype.constructor = Uniform3f2;\n Uniform3f2.prototype.set = function set(v) {\n if (v[0] !== this.current[0] || v[1] !== this.current[1] || v[2] !== this.current[2]) {\n this.current = v;\n this.gl.uniform3f(this.location, v[0], v[1], v[2]);\n }\n };\n return Uniform3f2;\n }(Uniform);\n var Uniform4f = function(Uniform2) {\n function Uniform4f2(context, location2) {\n Uniform2.call(this, context, location2);\n this.current = [\n 0,\n 0,\n 0,\n 0\n ];\n }\n if (Uniform2)\n Uniform4f2.__proto__ = Uniform2;\n Uniform4f2.prototype = Object.create(Uniform2 && Uniform2.prototype);\n Uniform4f2.prototype.constructor = Uniform4f2;\n Uniform4f2.prototype.set = function set(v) {\n if (v[0] !== this.current[0] || v[1] !== this.current[1] || v[2] !== this.current[2] || v[3] !== this.current[3]) {\n this.current = v;\n this.gl.uniform4f(this.location, v[0], v[1], v[2], v[3]);\n }\n };\n return Uniform4f2;\n }(Uniform);\n var UniformColor = function(Uniform2) {\n function UniformColor2(context, location2) {\n Uniform2.call(this, context, location2);\n this.current = Color2.transparent;\n }\n if (Uniform2)\n UniformColor2.__proto__ = Uniform2;\n UniformColor2.prototype = Object.create(Uniform2 && Uniform2.prototype);\n UniformColor2.prototype.constructor = UniformColor2;\n UniformColor2.prototype.set = function set(v) {\n if (v.r !== this.current.r || v.g !== this.current.g || v.b !== this.current.b || v.a !== this.current.a) {\n this.current = v;\n this.gl.uniform4f(this.location, v.r, v.g, v.b, v.a);\n }\n };\n return UniformColor2;\n }(Uniform);\n var emptyMat4 = new Float32Array(16);\n var UniformMatrix4f = function(Uniform2) {\n function UniformMatrix4f2(context, location2) {\n Uniform2.call(this, context, location2);\n this.current = emptyMat4;\n }\n if (Uniform2)\n UniformMatrix4f2.__proto__ = Uniform2;\n UniformMatrix4f2.prototype = Object.create(Uniform2 && Uniform2.prototype);\n UniformMatrix4f2.prototype.constructor = UniformMatrix4f2;\n UniformMatrix4f2.prototype.set = function set(v) {\n if (v[12] !== this.current[12] || v[0] !== this.current[0]) {\n this.current = v;\n this.gl.uniformMatrix4fv(this.location, false, v);\n return;\n }\n for (var i = 1; i < 16; i++) {\n if (v[i] !== this.current[i]) {\n this.current = v;\n this.gl.uniformMatrix4fv(this.location, false, v);\n break;\n }\n }\n };\n return UniformMatrix4f2;\n }(Uniform);\n function packColor(color3) {\n return [\n packUint8ToFloat(255 * color3.r, 255 * color3.g),\n packUint8ToFloat(255 * color3.b, 255 * color3.a)\n ];\n }\n var ConstantBinder = function ConstantBinder2(value, names2, type) {\n this.value = value;\n this.uniformNames = names2.map(function(name3) {\n return \"u_\" + name3;\n });\n this.type = type;\n };\n ConstantBinder.prototype.setUniform = function setUniform(uniform, globals, currentValue) {\n uniform.set(currentValue.constantOr(this.value));\n };\n ConstantBinder.prototype.getBinding = function getBinding(context, location2, _) {\n return this.type === \"color\" ? new UniformColor(context, location2) : new Uniform1f(context, location2);\n };\n var CrossFadedConstantBinder = function CrossFadedConstantBinder2(value, names2) {\n this.uniformNames = names2.map(function(name3) {\n return \"u_\" + name3;\n });\n this.patternFrom = null;\n this.patternTo = null;\n this.pixelRatioFrom = 1;\n this.pixelRatioTo = 1;\n };\n CrossFadedConstantBinder.prototype.setConstantPatternPositions = function setConstantPatternPositions(posTo, posFrom) {\n this.pixelRatioFrom = posFrom.pixelRatio;\n this.pixelRatioTo = posTo.pixelRatio;\n this.patternFrom = posFrom.tlbr;\n this.patternTo = posTo.tlbr;\n };\n CrossFadedConstantBinder.prototype.setUniform = function setUniform(uniform, globals, currentValue, uniformName) {\n var pos = uniformName === \"u_pattern_to\" ? this.patternTo : uniformName === \"u_pattern_from\" ? this.patternFrom : uniformName === \"u_pixel_ratio_to\" ? this.pixelRatioTo : uniformName === \"u_pixel_ratio_from\" ? this.pixelRatioFrom : null;\n if (pos) {\n uniform.set(pos);\n }\n };\n CrossFadedConstantBinder.prototype.getBinding = function getBinding(context, location2, name3) {\n return name3.substr(0, 9) === \"u_pattern\" ? new Uniform4f(context, location2) : new Uniform1f(context, location2);\n };\n var SourceExpressionBinder = function SourceExpressionBinder2(expression2, names2, type, PaintVertexArray) {\n this.expression = expression2;\n this.type = type;\n this.maxValue = 0;\n this.paintVertexAttributes = names2.map(function(name3) {\n return {\n name: \"a_\" + name3,\n type: \"Float32\",\n components: type === \"color\" ? 2 : 1,\n offset: 0\n };\n });\n this.paintVertexArray = new PaintVertexArray();\n };\n SourceExpressionBinder.prototype.populatePaintArray = function populatePaintArray(newLength, feature, imagePositions, canonical, formattedSection) {\n var start = this.paintVertexArray.length;\n var value = this.expression.evaluate(new EvaluationParameters(0), feature, {}, canonical, [], formattedSection);\n this.paintVertexArray.resize(newLength);\n this._setPaintValue(start, newLength, value);\n };\n SourceExpressionBinder.prototype.updatePaintArray = function updatePaintArray(start, end, feature, featureState) {\n var value = this.expression.evaluate({ zoom: 0 }, feature, featureState);\n this._setPaintValue(start, end, value);\n };\n SourceExpressionBinder.prototype._setPaintValue = function _setPaintValue(start, end, value) {\n if (this.type === \"color\") {\n var color3 = packColor(value);\n for (var i = start; i < end; i++) {\n this.paintVertexArray.emplace(i, color3[0], color3[1]);\n }\n } else {\n for (var i$1 = start; i$1 < end; i$1++) {\n this.paintVertexArray.emplace(i$1, value);\n }\n this.maxValue = Math.max(this.maxValue, Math.abs(value));\n }\n };\n SourceExpressionBinder.prototype.upload = function upload(context) {\n if (this.paintVertexArray && this.paintVertexArray.arrayBuffer) {\n if (this.paintVertexBuffer && this.paintVertexBuffer.buffer) {\n this.paintVertexBuffer.updateData(this.paintVertexArray);\n } else {\n this.paintVertexBuffer = context.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent);\n }\n }\n };\n SourceExpressionBinder.prototype.destroy = function destroy() {\n if (this.paintVertexBuffer) {\n this.paintVertexBuffer.destroy();\n }\n };\n var CompositeExpressionBinder = function CompositeExpressionBinder2(expression2, names2, type, useIntegerZoom, zoom, PaintVertexArray) {\n this.expression = expression2;\n this.uniformNames = names2.map(function(name3) {\n return \"u_\" + name3 + \"_t\";\n });\n this.type = type;\n this.useIntegerZoom = useIntegerZoom;\n this.zoom = zoom;\n this.maxValue = 0;\n this.paintVertexAttributes = names2.map(function(name3) {\n return {\n name: \"a_\" + name3,\n type: \"Float32\",\n components: type === \"color\" ? 4 : 2,\n offset: 0\n };\n });\n this.paintVertexArray = new PaintVertexArray();\n };\n CompositeExpressionBinder.prototype.populatePaintArray = function populatePaintArray(newLength, feature, imagePositions, canonical, formattedSection) {\n var min = this.expression.evaluate(new EvaluationParameters(this.zoom), feature, {}, canonical, [], formattedSection);\n var max = this.expression.evaluate(new EvaluationParameters(this.zoom + 1), feature, {}, canonical, [], formattedSection);\n var start = this.paintVertexArray.length;\n this.paintVertexArray.resize(newLength);\n this._setPaintValue(start, newLength, min, max);\n };\n CompositeExpressionBinder.prototype.updatePaintArray = function updatePaintArray(start, end, feature, featureState) {\n var min = this.expression.evaluate({ zoom: this.zoom }, feature, featureState);\n var max = this.expression.evaluate({ zoom: this.zoom + 1 }, feature, featureState);\n this._setPaintValue(start, end, min, max);\n };\n CompositeExpressionBinder.prototype._setPaintValue = function _setPaintValue(start, end, min, max) {\n if (this.type === \"color\") {\n var minColor = packColor(min);\n var maxColor = packColor(max);\n for (var i = start; i < end; i++) {\n this.paintVertexArray.emplace(i, minColor[0], minColor[1], maxColor[0], maxColor[1]);\n }\n } else {\n for (var i$1 = start; i$1 < end; i$1++) {\n this.paintVertexArray.emplace(i$1, min, max);\n }\n this.maxValue = Math.max(this.maxValue, Math.abs(min), Math.abs(max));\n }\n };\n CompositeExpressionBinder.prototype.upload = function upload(context) {\n if (this.paintVertexArray && this.paintVertexArray.arrayBuffer) {\n if (this.paintVertexBuffer && this.paintVertexBuffer.buffer) {\n this.paintVertexBuffer.updateData(this.paintVertexArray);\n } else {\n this.paintVertexBuffer = context.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent);\n }\n }\n };\n CompositeExpressionBinder.prototype.destroy = function destroy() {\n if (this.paintVertexBuffer) {\n this.paintVertexBuffer.destroy();\n }\n };\n CompositeExpressionBinder.prototype.setUniform = function setUniform(uniform, globals) {\n var currentZoom = this.useIntegerZoom ? Math.floor(globals.zoom) : globals.zoom;\n var factor = clamp(this.expression.interpolationFactor(currentZoom, this.zoom, this.zoom + 1), 0, 1);\n uniform.set(factor);\n };\n CompositeExpressionBinder.prototype.getBinding = function getBinding(context, location2, _) {\n return new Uniform1f(context, location2);\n };\n var CrossFadedCompositeBinder = function CrossFadedCompositeBinder2(expression2, type, useIntegerZoom, zoom, PaintVertexArray, layerId) {\n this.expression = expression2;\n this.type = type;\n this.useIntegerZoom = useIntegerZoom;\n this.zoom = zoom;\n this.layerId = layerId;\n this.zoomInPaintVertexArray = new PaintVertexArray();\n this.zoomOutPaintVertexArray = new PaintVertexArray();\n };\n CrossFadedCompositeBinder.prototype.populatePaintArray = function populatePaintArray(length, feature, imagePositions) {\n var start = this.zoomInPaintVertexArray.length;\n this.zoomInPaintVertexArray.resize(length);\n this.zoomOutPaintVertexArray.resize(length);\n this._setPaintValues(start, length, feature.patterns && feature.patterns[this.layerId], imagePositions);\n };\n CrossFadedCompositeBinder.prototype.updatePaintArray = function updatePaintArray(start, end, feature, featureState, imagePositions) {\n this._setPaintValues(start, end, feature.patterns && feature.patterns[this.layerId], imagePositions);\n };\n CrossFadedCompositeBinder.prototype._setPaintValues = function _setPaintValues(start, end, patterns, positions) {\n if (!positions || !patterns) {\n return;\n }\n var min = patterns.min;\n var mid = patterns.mid;\n var max = patterns.max;\n var imageMin = positions[min];\n var imageMid = positions[mid];\n var imageMax = positions[max];\n if (!imageMin || !imageMid || !imageMax) {\n return;\n }\n for (var i = start; i < end; i++) {\n this.zoomInPaintVertexArray.emplace(i, imageMid.tl[0], imageMid.tl[1], imageMid.br[0], imageMid.br[1], imageMin.tl[0], imageMin.tl[1], imageMin.br[0], imageMin.br[1], imageMid.pixelRatio, imageMin.pixelRatio);\n this.zoomOutPaintVertexArray.emplace(i, imageMid.tl[0], imageMid.tl[1], imageMid.br[0], imageMid.br[1], imageMax.tl[0], imageMax.tl[1], imageMax.br[0], imageMax.br[1], imageMid.pixelRatio, imageMax.pixelRatio);\n }\n };\n CrossFadedCompositeBinder.prototype.upload = function upload(context) {\n if (this.zoomInPaintVertexArray && this.zoomInPaintVertexArray.arrayBuffer && this.zoomOutPaintVertexArray && this.zoomOutPaintVertexArray.arrayBuffer) {\n this.zoomInPaintVertexBuffer = context.createVertexBuffer(this.zoomInPaintVertexArray, patternAttributes.members, this.expression.isStateDependent);\n this.zoomOutPaintVertexBuffer = context.createVertexBuffer(this.zoomOutPaintVertexArray, patternAttributes.members, this.expression.isStateDependent);\n }\n };\n CrossFadedCompositeBinder.prototype.destroy = function destroy() {\n if (this.zoomOutPaintVertexBuffer) {\n this.zoomOutPaintVertexBuffer.destroy();\n }\n if (this.zoomInPaintVertexBuffer) {\n this.zoomInPaintVertexBuffer.destroy();\n }\n };\n var ProgramConfiguration = function ProgramConfiguration2(layer2, zoom, filterProperties) {\n this.binders = {};\n this._buffers = [];\n var keys = [];\n for (var property in layer2.paint._values) {\n if (!filterProperties(property)) {\n continue;\n }\n var value = layer2.paint.get(property);\n if (!(value instanceof PossiblyEvaluatedPropertyValue) || !supportsPropertyExpression(value.property.specification)) {\n continue;\n }\n var names2 = paintAttributeNames(property, layer2.type);\n var expression2 = value.value;\n var type = value.property.specification.type;\n var useIntegerZoom = value.property.useIntegerZoom;\n var propType = value.property.specification[\"property-type\"];\n var isCrossFaded = propType === \"cross-faded\" || propType === \"cross-faded-data-driven\";\n if (expression2.kind === \"constant\") {\n this.binders[property] = isCrossFaded ? new CrossFadedConstantBinder(expression2.value, names2) : new ConstantBinder(expression2.value, names2, type);\n keys.push(\"/u_\" + property);\n } else if (expression2.kind === \"source\" || isCrossFaded) {\n var StructArrayLayout = layoutType(property, type, \"source\");\n this.binders[property] = isCrossFaded ? new CrossFadedCompositeBinder(expression2, type, useIntegerZoom, zoom, StructArrayLayout, layer2.id) : new SourceExpressionBinder(expression2, names2, type, StructArrayLayout);\n keys.push(\"/a_\" + property);\n } else {\n var StructArrayLayout$1 = layoutType(property, type, \"composite\");\n this.binders[property] = new CompositeExpressionBinder(expression2, names2, type, useIntegerZoom, zoom, StructArrayLayout$1);\n keys.push(\"/z_\" + property);\n }\n }\n this.cacheKey = keys.sort().join(\"\");\n };\n ProgramConfiguration.prototype.getMaxValue = function getMaxValue(property) {\n var binder = this.binders[property];\n return binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder ? binder.maxValue : 0;\n };\n ProgramConfiguration.prototype.populatePaintArrays = function populatePaintArrays(newLength, feature, imagePositions, canonical, formattedSection) {\n for (var property in this.binders) {\n var binder = this.binders[property];\n if (binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder || binder instanceof CrossFadedCompositeBinder) {\n binder.populatePaintArray(newLength, feature, imagePositions, canonical, formattedSection);\n }\n }\n };\n ProgramConfiguration.prototype.setConstantPatternPositions = function setConstantPatternPositions(posTo, posFrom) {\n for (var property in this.binders) {\n var binder = this.binders[property];\n if (binder instanceof CrossFadedConstantBinder) {\n binder.setConstantPatternPositions(posTo, posFrom);\n }\n }\n };\n ProgramConfiguration.prototype.updatePaintArrays = function updatePaintArrays(featureStates, featureMap, vtLayer, layer2, imagePositions) {\n var dirty = false;\n for (var id2 in featureStates) {\n var positions = featureMap.getPositions(id2);\n for (var i = 0, list = positions; i < list.length; i += 1) {\n var pos = list[i];\n var feature = vtLayer.feature(pos.index);\n for (var property in this.binders) {\n var binder = this.binders[property];\n if ((binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder || binder instanceof CrossFadedCompositeBinder) && binder.expression.isStateDependent === true) {\n var value = layer2.paint.get(property);\n binder.expression = value.value;\n binder.updatePaintArray(pos.start, pos.end, feature, featureStates[id2], imagePositions);\n dirty = true;\n }\n }\n }\n }\n return dirty;\n };\n ProgramConfiguration.prototype.defines = function defines() {\n var result = [];\n for (var property in this.binders) {\n var binder = this.binders[property];\n if (binder instanceof ConstantBinder || binder instanceof CrossFadedConstantBinder) {\n result.push.apply(result, binder.uniformNames.map(function(name3) {\n return \"#define HAS_UNIFORM_\" + name3;\n }));\n }\n }\n return result;\n };\n ProgramConfiguration.prototype.getBinderAttributes = function getBinderAttributes() {\n var result = [];\n for (var property in this.binders) {\n var binder = this.binders[property];\n if (binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder) {\n for (var i = 0; i < binder.paintVertexAttributes.length; i++) {\n result.push(binder.paintVertexAttributes[i].name);\n }\n } else if (binder instanceof CrossFadedCompositeBinder) {\n for (var i$1 = 0; i$1 < patternAttributes.members.length; i$1++) {\n result.push(patternAttributes.members[i$1].name);\n }\n }\n }\n return result;\n };\n ProgramConfiguration.prototype.getBinderUniforms = function getBinderUniforms() {\n var uniforms = [];\n for (var property in this.binders) {\n var binder = this.binders[property];\n if (binder instanceof ConstantBinder || binder instanceof CrossFadedConstantBinder || binder instanceof CompositeExpressionBinder) {\n for (var i = 0, list = binder.uniformNames; i < list.length; i += 1) {\n var uniformName = list[i];\n uniforms.push(uniformName);\n }\n }\n }\n return uniforms;\n };\n ProgramConfiguration.prototype.getPaintVertexBuffers = function getPaintVertexBuffers() {\n return this._buffers;\n };\n ProgramConfiguration.prototype.getUniforms = function getUniforms(context, locations) {\n var uniforms = [];\n for (var property in this.binders) {\n var binder = this.binders[property];\n if (binder instanceof ConstantBinder || binder instanceof CrossFadedConstantBinder || binder instanceof CompositeExpressionBinder) {\n for (var i = 0, list = binder.uniformNames; i < list.length; i += 1) {\n var name3 = list[i];\n if (locations[name3]) {\n var binding = binder.getBinding(context, locations[name3], name3);\n uniforms.push({\n name: name3,\n property,\n binding\n });\n }\n }\n }\n }\n return uniforms;\n };\n ProgramConfiguration.prototype.setUniforms = function setUniforms(context, binderUniforms, properties2, globals) {\n for (var i = 0, list = binderUniforms; i < list.length; i += 1) {\n var ref = list[i];\n var name3 = ref.name;\n var property = ref.property;\n var binding = ref.binding;\n this.binders[property].setUniform(binding, globals, properties2.get(property), name3);\n }\n };\n ProgramConfiguration.prototype.updatePaintBuffers = function updatePaintBuffers(crossfade) {\n this._buffers = [];\n for (var property in this.binders) {\n var binder = this.binders[property];\n if (crossfade && binder instanceof CrossFadedCompositeBinder) {\n var patternVertexBuffer = crossfade.fromScale === 2 ? binder.zoomInPaintVertexBuffer : binder.zoomOutPaintVertexBuffer;\n if (patternVertexBuffer) {\n this._buffers.push(patternVertexBuffer);\n }\n } else if ((binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder) && binder.paintVertexBuffer) {\n this._buffers.push(binder.paintVertexBuffer);\n }\n }\n };\n ProgramConfiguration.prototype.upload = function upload(context) {\n for (var property in this.binders) {\n var binder = this.binders[property];\n if (binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder || binder instanceof CrossFadedCompositeBinder) {\n binder.upload(context);\n }\n }\n this.updatePaintBuffers();\n };\n ProgramConfiguration.prototype.destroy = function destroy() {\n for (var property in this.binders) {\n var binder = this.binders[property];\n if (binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder || binder instanceof CrossFadedCompositeBinder) {\n binder.destroy();\n }\n }\n };\n var ProgramConfigurationSet = function ProgramConfigurationSet2(layers, zoom, filterProperties) {\n if (filterProperties === void 0)\n filterProperties = function() {\n return true;\n };\n this.programConfigurations = {};\n for (var i = 0, list = layers; i < list.length; i += 1) {\n var layer2 = list[i];\n this.programConfigurations[layer2.id] = new ProgramConfiguration(layer2, zoom, filterProperties);\n }\n this.needsUpload = false;\n this._featureMap = new FeaturePositionMap();\n this._bufferOffset = 0;\n };\n ProgramConfigurationSet.prototype.populatePaintArrays = function populatePaintArrays(length, feature, index, imagePositions, canonical, formattedSection) {\n for (var key in this.programConfigurations) {\n this.programConfigurations[key].populatePaintArrays(length, feature, imagePositions, canonical, formattedSection);\n }\n if (feature.id !== void 0) {\n this._featureMap.add(feature.id, index, this._bufferOffset, length);\n }\n this._bufferOffset = length;\n this.needsUpload = true;\n };\n ProgramConfigurationSet.prototype.updatePaintArrays = function updatePaintArrays(featureStates, vtLayer, layers, imagePositions) {\n for (var i = 0, list = layers; i < list.length; i += 1) {\n var layer2 = list[i];\n this.needsUpload = this.programConfigurations[layer2.id].updatePaintArrays(featureStates, this._featureMap, vtLayer, layer2, imagePositions) || this.needsUpload;\n }\n };\n ProgramConfigurationSet.prototype.get = function get2(layerId) {\n return this.programConfigurations[layerId];\n };\n ProgramConfigurationSet.prototype.upload = function upload(context) {\n if (!this.needsUpload) {\n return;\n }\n for (var layerId in this.programConfigurations) {\n this.programConfigurations[layerId].upload(context);\n }\n this.needsUpload = false;\n };\n ProgramConfigurationSet.prototype.destroy = function destroy() {\n for (var layerId in this.programConfigurations) {\n this.programConfigurations[layerId].destroy();\n }\n };\n function paintAttributeNames(property, type) {\n var attributeNameExceptions = {\n \"text-opacity\": [\"opacity\"],\n \"icon-opacity\": [\"opacity\"],\n \"text-color\": [\"fill_color\"],\n \"icon-color\": [\"fill_color\"],\n \"text-halo-color\": [\"halo_color\"],\n \"icon-halo-color\": [\"halo_color\"],\n \"text-halo-blur\": [\"halo_blur\"],\n \"icon-halo-blur\": [\"halo_blur\"],\n \"text-halo-width\": [\"halo_width\"],\n \"icon-halo-width\": [\"halo_width\"],\n \"line-gap-width\": [\"gapwidth\"],\n \"line-pattern\": [\n \"pattern_to\",\n \"pattern_from\",\n \"pixel_ratio_to\",\n \"pixel_ratio_from\"\n ],\n \"fill-pattern\": [\n \"pattern_to\",\n \"pattern_from\",\n \"pixel_ratio_to\",\n \"pixel_ratio_from\"\n ],\n \"fill-extrusion-pattern\": [\n \"pattern_to\",\n \"pattern_from\",\n \"pixel_ratio_to\",\n \"pixel_ratio_from\"\n ]\n };\n return attributeNameExceptions[property] || [property.replace(type + \"-\", \"\").replace(/-/g, \"_\")];\n }\n function getLayoutException(property) {\n var propertyExceptions = {\n \"line-pattern\": {\n \"source\": StructArrayLayout10ui20,\n \"composite\": StructArrayLayout10ui20\n },\n \"fill-pattern\": {\n \"source\": StructArrayLayout10ui20,\n \"composite\": StructArrayLayout10ui20\n },\n \"fill-extrusion-pattern\": {\n \"source\": StructArrayLayout10ui20,\n \"composite\": StructArrayLayout10ui20\n }\n };\n return propertyExceptions[property];\n }\n function layoutType(property, type, binderType) {\n var defaultLayouts = {\n \"color\": {\n \"source\": StructArrayLayout2f8,\n \"composite\": StructArrayLayout4f16\n },\n \"number\": {\n \"source\": StructArrayLayout1f4,\n \"composite\": StructArrayLayout2f8\n }\n };\n var layoutException = getLayoutException(property);\n return layoutException && layoutException[binderType] || defaultLayouts[type][binderType];\n }\n register(\"ConstantBinder\", ConstantBinder);\n register(\"CrossFadedConstantBinder\", CrossFadedConstantBinder);\n register(\"SourceExpressionBinder\", SourceExpressionBinder);\n register(\"CrossFadedCompositeBinder\", CrossFadedCompositeBinder);\n register(\"CompositeExpressionBinder\", CompositeExpressionBinder);\n register(\"ProgramConfiguration\", ProgramConfiguration, { omit: [\"_buffers\"] });\n register(\"ProgramConfigurationSet\", ProgramConfigurationSet);\n var EXTENT$1 = 8192;\n var BITS = 15;\n var MAX = Math.pow(2, BITS - 1) - 1;\n var MIN = -MAX - 1;\n function loadGeometry(feature) {\n var scale2 = EXTENT$1 / feature.extent;\n var geometry = feature.loadGeometry();\n for (var r = 0; r < geometry.length; r++) {\n var ring = geometry[r];\n for (var p = 0; p < ring.length; p++) {\n var point = ring[p];\n var x = Math.round(point.x * scale2);\n var y = Math.round(point.y * scale2);\n point.x = clamp(x, MIN, MAX);\n point.y = clamp(y, MIN, MAX);\n if (x < point.x || x > point.x + 1 || y < point.y || y > point.y + 1) {\n warnOnce(\"Geometry exceeds allowed extent, reduce your vector tile buffer size\");\n }\n }\n }\n return geometry;\n }\n function toEvaluationFeature(feature, needGeometry) {\n return {\n type: feature.type,\n id: feature.id,\n properties: feature.properties,\n geometry: needGeometry ? loadGeometry(feature) : []\n };\n }\n function addCircleVertex(layoutVertexArray, x, y, extrudeX, extrudeY) {\n layoutVertexArray.emplaceBack(x * 2 + (extrudeX + 1) / 2, y * 2 + (extrudeY + 1) / 2);\n }\n var CircleBucket = function CircleBucket2(options) {\n this.zoom = options.zoom;\n this.overscaling = options.overscaling;\n this.layers = options.layers;\n this.layerIds = this.layers.map(function(layer2) {\n return layer2.id;\n });\n this.index = options.index;\n this.hasPattern = false;\n this.layoutVertexArray = new StructArrayLayout2i4();\n this.indexArray = new StructArrayLayout3ui6();\n this.segments = new SegmentVector();\n this.programConfigurations = new ProgramConfigurationSet(options.layers, options.zoom);\n this.stateDependentLayerIds = this.layers.filter(function(l) {\n return l.isStateDependent();\n }).map(function(l) {\n return l.id;\n });\n };\n CircleBucket.prototype.populate = function populate(features, options, canonical) {\n var styleLayer = this.layers[0];\n var bucketFeatures = [];\n var circleSortKey = null;\n if (styleLayer.type === \"circle\") {\n circleSortKey = styleLayer.layout.get(\"circle-sort-key\");\n }\n for (var i = 0, list = features; i < list.length; i += 1) {\n var ref = list[i];\n var feature = ref.feature;\n var id2 = ref.id;\n var index = ref.index;\n var sourceLayerIndex = ref.sourceLayerIndex;\n var needGeometry = this.layers[0]._featureFilter.needGeometry;\n var evaluationFeature = toEvaluationFeature(feature, needGeometry);\n if (!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom), evaluationFeature, canonical)) {\n continue;\n }\n var sortKey = circleSortKey ? circleSortKey.evaluate(evaluationFeature, {}, canonical) : void 0;\n var bucketFeature = {\n id: id2,\n properties: feature.properties,\n type: feature.type,\n sourceLayerIndex,\n index,\n geometry: needGeometry ? evaluationFeature.geometry : loadGeometry(feature),\n patterns: {},\n sortKey\n };\n bucketFeatures.push(bucketFeature);\n }\n if (circleSortKey) {\n bucketFeatures.sort(function(a, b) {\n return a.sortKey - b.sortKey;\n });\n }\n for (var i$1 = 0, list$1 = bucketFeatures; i$1 < list$1.length; i$1 += 1) {\n var bucketFeature$1 = list$1[i$1];\n var ref$1 = bucketFeature$1;\n var geometry = ref$1.geometry;\n var index$1 = ref$1.index;\n var sourceLayerIndex$1 = ref$1.sourceLayerIndex;\n var feature$1 = features[index$1].feature;\n this.addFeature(bucketFeature$1, geometry, index$1, canonical);\n options.featureIndex.insert(feature$1, geometry, index$1, sourceLayerIndex$1, this.index);\n }\n };\n CircleBucket.prototype.update = function update(states, vtLayer, imagePositions) {\n if (!this.stateDependentLayers.length) {\n return;\n }\n this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, imagePositions);\n };\n CircleBucket.prototype.isEmpty = function isEmpty2() {\n return this.layoutVertexArray.length === 0;\n };\n CircleBucket.prototype.uploadPending = function uploadPending() {\n return !this.uploaded || this.programConfigurations.needsUpload;\n };\n CircleBucket.prototype.upload = function upload(context) {\n if (!this.uploaded) {\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, members);\n this.indexBuffer = context.createIndexBuffer(this.indexArray);\n }\n this.programConfigurations.upload(context);\n this.uploaded = true;\n };\n CircleBucket.prototype.destroy = function destroy() {\n if (!this.layoutVertexBuffer) {\n return;\n }\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.programConfigurations.destroy();\n this.segments.destroy();\n };\n CircleBucket.prototype.addFeature = function addFeature2(feature, geometry, index, canonical) {\n for (var i$1 = 0, list$1 = geometry; i$1 < list$1.length; i$1 += 1) {\n var ring = list$1[i$1];\n for (var i = 0, list = ring; i < list.length; i += 1) {\n var point = list[i];\n var x = point.x;\n var y = point.y;\n if (x < 0 || x >= EXTENT$1 || y < 0 || y >= EXTENT$1) {\n continue;\n }\n var segment = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray, feature.sortKey);\n var index$1 = segment.vertexLength;\n addCircleVertex(this.layoutVertexArray, x, y, -1, -1);\n addCircleVertex(this.layoutVertexArray, x, y, 1, -1);\n addCircleVertex(this.layoutVertexArray, x, y, 1, 1);\n addCircleVertex(this.layoutVertexArray, x, y, -1, 1);\n this.indexArray.emplaceBack(index$1, index$1 + 1, index$1 + 2);\n this.indexArray.emplaceBack(index$1, index$1 + 3, index$1 + 2);\n segment.vertexLength += 4;\n segment.primitiveLength += 2;\n }\n }\n this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, feature, index, {}, canonical);\n };\n register(\"CircleBucket\", CircleBucket, { omit: [\"layers\"] });\n function polygonIntersectsPolygon(polygonA, polygonB) {\n for (var i = 0; i < polygonA.length; i++) {\n if (polygonContainsPoint(polygonB, polygonA[i])) {\n return true;\n }\n }\n for (var i$1 = 0; i$1 < polygonB.length; i$1++) {\n if (polygonContainsPoint(polygonA, polygonB[i$1])) {\n return true;\n }\n }\n if (lineIntersectsLine(polygonA, polygonB)) {\n return true;\n }\n return false;\n }\n function polygonIntersectsBufferedPoint(polygon, point, radius) {\n if (polygonContainsPoint(polygon, point)) {\n return true;\n }\n if (pointIntersectsBufferedLine(point, polygon, radius)) {\n return true;\n }\n return false;\n }\n function polygonIntersectsMultiPolygon(polygon, multiPolygon) {\n if (polygon.length === 1) {\n return multiPolygonContainsPoint(multiPolygon, polygon[0]);\n }\n for (var m = 0; m < multiPolygon.length; m++) {\n var ring = multiPolygon[m];\n for (var n = 0; n < ring.length; n++) {\n if (polygonContainsPoint(polygon, ring[n])) {\n return true;\n }\n }\n }\n for (var i = 0; i < polygon.length; i++) {\n if (multiPolygonContainsPoint(multiPolygon, polygon[i])) {\n return true;\n }\n }\n for (var k = 0; k < multiPolygon.length; k++) {\n if (lineIntersectsLine(polygon, multiPolygon[k])) {\n return true;\n }\n }\n return false;\n }\n function polygonIntersectsBufferedMultiLine(polygon, multiLine, radius) {\n for (var i = 0; i < multiLine.length; i++) {\n var line = multiLine[i];\n if (polygon.length >= 3) {\n for (var k = 0; k < line.length; k++) {\n if (polygonContainsPoint(polygon, line[k])) {\n return true;\n }\n }\n }\n if (lineIntersectsBufferedLine(polygon, line, radius)) {\n return true;\n }\n }\n return false;\n }\n function lineIntersectsBufferedLine(lineA, lineB, radius) {\n if (lineA.length > 1) {\n if (lineIntersectsLine(lineA, lineB)) {\n return true;\n }\n for (var j = 0; j < lineB.length; j++) {\n if (pointIntersectsBufferedLine(lineB[j], lineA, radius)) {\n return true;\n }\n }\n }\n for (var k = 0; k < lineA.length; k++) {\n if (pointIntersectsBufferedLine(lineA[k], lineB, radius)) {\n return true;\n }\n }\n return false;\n }\n function lineIntersectsLine(lineA, lineB) {\n if (lineA.length === 0 || lineB.length === 0) {\n return false;\n }\n for (var i = 0; i < lineA.length - 1; i++) {\n var a0 = lineA[i];\n var a1 = lineA[i + 1];\n for (var j = 0; j < lineB.length - 1; j++) {\n var b0 = lineB[j];\n var b1 = lineB[j + 1];\n if (lineSegmentIntersectsLineSegment(a0, a1, b0, b1)) {\n return true;\n }\n }\n }\n return false;\n }\n function lineSegmentIntersectsLineSegment(a0, a1, b0, b1) {\n return isCounterClockwise(a0, b0, b1) !== isCounterClockwise(a1, b0, b1) && isCounterClockwise(a0, a1, b0) !== isCounterClockwise(a0, a1, b1);\n }\n function pointIntersectsBufferedLine(p, line, radius) {\n var radiusSquared = radius * radius;\n if (line.length === 1) {\n return p.distSqr(line[0]) < radiusSquared;\n }\n for (var i = 1; i < line.length; i++) {\n var v = line[i - 1], w = line[i];\n if (distToSegmentSquared(p, v, w) < radiusSquared) {\n return true;\n }\n }\n return false;\n }\n function distToSegmentSquared(p, v, w) {\n var l2 = v.distSqr(w);\n if (l2 === 0) {\n return p.distSqr(v);\n }\n var t = ((p.x - v.x) * (w.x - v.x) + (p.y - v.y) * (w.y - v.y)) / l2;\n if (t < 0) {\n return p.distSqr(v);\n }\n if (t > 1) {\n return p.distSqr(w);\n }\n return p.distSqr(w.sub(v)._mult(t)._add(v));\n }\n function multiPolygonContainsPoint(rings, p) {\n var c = false, ring, p1, p2;\n for (var k = 0; k < rings.length; k++) {\n ring = rings[k];\n for (var i = 0, j = ring.length - 1; i < ring.length; j = i++) {\n p1 = ring[i];\n p2 = ring[j];\n if (p1.y > p.y !== p2.y > p.y && p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x) {\n c = !c;\n }\n }\n }\n return c;\n }\n function polygonContainsPoint(ring, p) {\n var c = false;\n for (var i = 0, j = ring.length - 1; i < ring.length; j = i++) {\n var p1 = ring[i];\n var p2 = ring[j];\n if (p1.y > p.y !== p2.y > p.y && p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x) {\n c = !c;\n }\n }\n return c;\n }\n function polygonIntersectsBox(ring, boxX1, boxY1, boxX2, boxY2) {\n for (var i$1 = 0, list = ring; i$1 < list.length; i$1 += 1) {\n var p = list[i$1];\n if (boxX1 <= p.x && boxY1 <= p.y && boxX2 >= p.x && boxY2 >= p.y) {\n return true;\n }\n }\n var corners = [\n new pointGeometry(boxX1, boxY1),\n new pointGeometry(boxX1, boxY2),\n new pointGeometry(boxX2, boxY2),\n new pointGeometry(boxX2, boxY1)\n ];\n if (ring.length > 2) {\n for (var i$2 = 0, list$1 = corners; i$2 < list$1.length; i$2 += 1) {\n var corner = list$1[i$2];\n if (polygonContainsPoint(ring, corner)) {\n return true;\n }\n }\n }\n for (var i = 0; i < ring.length - 1; i++) {\n var p1 = ring[i];\n var p2 = ring[i + 1];\n if (edgeIntersectsBox(p1, p2, corners)) {\n return true;\n }\n }\n return false;\n }\n function edgeIntersectsBox(e1, e2, corners) {\n var tl = corners[0];\n var br = corners[2];\n if (e1.x < tl.x && e2.x < tl.x || e1.x > br.x && e2.x > br.x || e1.y < tl.y && e2.y < tl.y || e1.y > br.y && e2.y > br.y) {\n return false;\n }\n var dir = isCounterClockwise(e1, e2, corners[0]);\n return dir !== isCounterClockwise(e1, e2, corners[1]) || dir !== isCounterClockwise(e1, e2, corners[2]) || dir !== isCounterClockwise(e1, e2, corners[3]);\n }\n function getMaximumPaintValue(property, layer2, bucket) {\n var value = layer2.paint.get(property).value;\n if (value.kind === \"constant\") {\n return value.value;\n } else {\n return bucket.programConfigurations.get(layer2.id).getMaxValue(property);\n }\n }\n function translateDistance(translate2) {\n return Math.sqrt(translate2[0] * translate2[0] + translate2[1] * translate2[1]);\n }\n function translate(queryGeometry, translate2, translateAnchor, bearing, pixelsToTileUnits) {\n if (!translate2[0] && !translate2[1]) {\n return queryGeometry;\n }\n var pt = pointGeometry.convert(translate2)._mult(pixelsToTileUnits);\n if (translateAnchor === \"viewport\") {\n pt._rotate(-bearing);\n }\n var translated = [];\n for (var i = 0; i < queryGeometry.length; i++) {\n var point = queryGeometry[i];\n translated.push(point.sub(pt));\n }\n return translated;\n }\n var layout$2 = new Properties({ \"circle-sort-key\": new DataDrivenProperty(spec[\"layout_circle\"][\"circle-sort-key\"]) });\n var paint$1 = new Properties({\n \"circle-radius\": new DataDrivenProperty(spec[\"paint_circle\"][\"circle-radius\"]),\n \"circle-color\": new DataDrivenProperty(spec[\"paint_circle\"][\"circle-color\"]),\n \"circle-blur\": new DataDrivenProperty(spec[\"paint_circle\"][\"circle-blur\"]),\n \"circle-opacity\": new DataDrivenProperty(spec[\"paint_circle\"][\"circle-opacity\"]),\n \"circle-translate\": new DataConstantProperty(spec[\"paint_circle\"][\"circle-translate\"]),\n \"circle-translate-anchor\": new DataConstantProperty(spec[\"paint_circle\"][\"circle-translate-anchor\"]),\n \"circle-pitch-scale\": new DataConstantProperty(spec[\"paint_circle\"][\"circle-pitch-scale\"]),\n \"circle-pitch-alignment\": new DataConstantProperty(spec[\"paint_circle\"][\"circle-pitch-alignment\"]),\n \"circle-stroke-width\": new DataDrivenProperty(spec[\"paint_circle\"][\"circle-stroke-width\"]),\n \"circle-stroke-color\": new DataDrivenProperty(spec[\"paint_circle\"][\"circle-stroke-color\"]),\n \"circle-stroke-opacity\": new DataDrivenProperty(spec[\"paint_circle\"][\"circle-stroke-opacity\"])\n });\n var properties = {\n paint: paint$1,\n layout: layout$2\n };\n var ARRAY_TYPE = typeof Float32Array !== \"undefined\" ? Float32Array : Array;\n if (!Math.hypot) {\n Math.hypot = function() {\n var arguments$1 = arguments;\n var y = 0, i = arguments.length;\n while (i--) {\n y += arguments$1[i] * arguments$1[i];\n }\n return Math.sqrt(y);\n };\n }\n function create() {\n var out = new ARRAY_TYPE(4);\n if (ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n }\n out[0] = 1;\n out[3] = 1;\n return out;\n }\n function rotate(out, a, rad) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3];\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n return out;\n }\n function create$1() {\n var out = new ARRAY_TYPE(9);\n if (ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n }\n out[0] = 1;\n out[4] = 1;\n out[8] = 1;\n return out;\n }\n function fromRotation(out, rad) {\n var s = Math.sin(rad), c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = -s;\n out[4] = c;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n }\n function create$2() {\n var out = new ARRAY_TYPE(16);\n if (ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n }\n out[0] = 1;\n out[5] = 1;\n out[10] = 1;\n out[15] = 1;\n return out;\n }\n function clone$1(a) {\n var out = new ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n }\n function identity2(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n function invert(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3];\n var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];\n var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];\n var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32;\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n if (!det) {\n return null;\n }\n det = 1 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n }\n function multiply(out, a, b) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3];\n var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];\n var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];\n var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n }\n function translate$1(out, a, v) {\n var x = v[0], y = v[1], z = v[2];\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n return out;\n }\n function scale(out, a, v) {\n var x = v[0], y = v[1], z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n }\n function rotateX(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n if (a !== out) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n }\n function rotateZ(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n if (a !== out) {\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n }\n function perspective(out, fovy, aspect, near, far) {\n var f = 1 / Math.tan(fovy / 2), nf;\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n if (far != null && far !== Infinity) {\n nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n return out;\n }\n function ortho(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right);\n var bt = 1 / (bottom - top);\n var nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n }\n var mul = multiply;\n function create$3() {\n var out = new ARRAY_TYPE(3);\n if (ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n return out;\n }\n function clone$2(a) {\n var out = new ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n }\n function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n }\n function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n }\n function scale$1(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n }\n function normalize(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var len = x * x + y * y + z * z;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n return out;\n }\n function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n }\n function cross(out, a, b) {\n var ax = a[0], ay = a[1], az = a[2];\n var bx = b[0], by = b[1], bz = b[2];\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n }\n function transformMat3(out, a, m) {\n var x = a[0], y = a[1], z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n }\n var sub = subtract;\n var forEach = function() {\n var vec = create$3();\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if (!stride) {\n stride = 3;\n }\n if (!offset) {\n offset = 0;\n }\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n }\n return a;\n };\n }();\n function create$4() {\n var out = new ARRAY_TYPE(4);\n if (ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n }\n return out;\n }\n function scale$2(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n }\n function dot$1(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n }\n function transformMat4(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n }\n var forEach$1 = function() {\n var vec = create$4();\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if (!stride) {\n stride = 4;\n }\n if (!offset) {\n offset = 0;\n }\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n vec[3] = a[i + 3];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n a[i + 3] = vec[3];\n }\n return a;\n };\n }();\n function create$5() {\n var out = new ARRAY_TYPE(2);\n if (ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n }\n return out;\n }\n function squaredLength(a) {\n var x = a[0], y = a[1];\n return x * x + y * y;\n }\n var sqrLen = squaredLength;\n var forEach$2 = function() {\n var vec = create$5();\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if (!stride) {\n stride = 2;\n }\n if (!offset) {\n offset = 0;\n }\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n }\n return a;\n };\n }();\n var CircleStyleLayer = function(StyleLayer2) {\n function CircleStyleLayer2(layer2) {\n StyleLayer2.call(this, layer2, properties);\n }\n if (StyleLayer2)\n CircleStyleLayer2.__proto__ = StyleLayer2;\n CircleStyleLayer2.prototype = Object.create(StyleLayer2 && StyleLayer2.prototype);\n CircleStyleLayer2.prototype.constructor = CircleStyleLayer2;\n CircleStyleLayer2.prototype.createBucket = function createBucket(parameters) {\n return new CircleBucket(parameters);\n };\n CircleStyleLayer2.prototype.queryRadius = function queryRadius(bucket) {\n var circleBucket = bucket;\n return getMaximumPaintValue(\"circle-radius\", this, circleBucket) + getMaximumPaintValue(\"circle-stroke-width\", this, circleBucket) + translateDistance(this.paint.get(\"circle-translate\"));\n };\n CircleStyleLayer2.prototype.queryIntersectsFeature = function queryIntersectsFeature(queryGeometry, feature, featureState, geometry, zoom, transform, pixelsToTileUnits, pixelPosMatrix) {\n var translatedPolygon = translate(queryGeometry, this.paint.get(\"circle-translate\"), this.paint.get(\"circle-translate-anchor\"), transform.angle, pixelsToTileUnits);\n var radius = this.paint.get(\"circle-radius\").evaluate(feature, featureState);\n var stroke = this.paint.get(\"circle-stroke-width\").evaluate(feature, featureState);\n var size = radius + stroke;\n var alignWithMap = this.paint.get(\"circle-pitch-alignment\") === \"map\";\n var transformedPolygon = alignWithMap ? translatedPolygon : projectQueryGeometry(translatedPolygon, pixelPosMatrix);\n var transformedSize = alignWithMap ? size * pixelsToTileUnits : size;\n for (var i$1 = 0, list$1 = geometry; i$1 < list$1.length; i$1 += 1) {\n var ring = list$1[i$1];\n for (var i = 0, list = ring; i < list.length; i += 1) {\n var point = list[i];\n var transformedPoint = alignWithMap ? point : projectPoint(point, pixelPosMatrix);\n var adjustedSize = transformedSize;\n var projectedCenter = transformMat4([], [\n point.x,\n point.y,\n 0,\n 1\n ], pixelPosMatrix);\n if (this.paint.get(\"circle-pitch-scale\") === \"viewport\" && this.paint.get(\"circle-pitch-alignment\") === \"map\") {\n adjustedSize *= projectedCenter[3] / transform.cameraToCenterDistance;\n } else if (this.paint.get(\"circle-pitch-scale\") === \"map\" && this.paint.get(\"circle-pitch-alignment\") === \"viewport\") {\n adjustedSize *= transform.cameraToCenterDistance / projectedCenter[3];\n }\n if (polygonIntersectsBufferedPoint(transformedPolygon, transformedPoint, adjustedSize)) {\n return true;\n }\n }\n }\n return false;\n };\n return CircleStyleLayer2;\n }(StyleLayer);\n function projectPoint(p, pixelPosMatrix) {\n var point = transformMat4([], [\n p.x,\n p.y,\n 0,\n 1\n ], pixelPosMatrix);\n return new pointGeometry(point[0] / point[3], point[1] / point[3]);\n }\n function projectQueryGeometry(queryGeometry, pixelPosMatrix) {\n return queryGeometry.map(function(p) {\n return projectPoint(p, pixelPosMatrix);\n });\n }\n var HeatmapBucket = function(CircleBucket2) {\n function HeatmapBucket2() {\n CircleBucket2.apply(this, arguments);\n }\n if (CircleBucket2)\n HeatmapBucket2.__proto__ = CircleBucket2;\n HeatmapBucket2.prototype = Object.create(CircleBucket2 && CircleBucket2.prototype);\n HeatmapBucket2.prototype.constructor = HeatmapBucket2;\n return HeatmapBucket2;\n }(CircleBucket);\n register(\"HeatmapBucket\", HeatmapBucket, { omit: [\"layers\"] });\n function createImage(image, ref, channels, data) {\n var width = ref.width;\n var height = ref.height;\n if (!data) {\n data = new Uint8Array(width * height * channels);\n } else if (data instanceof Uint8ClampedArray) {\n data = new Uint8Array(data.buffer);\n } else if (data.length !== width * height * channels) {\n throw new RangeError(\"mismatched image size\");\n }\n image.width = width;\n image.height = height;\n image.data = data;\n return image;\n }\n function resizeImage(image, ref, channels) {\n var width = ref.width;\n var height = ref.height;\n if (width === image.width && height === image.height) {\n return;\n }\n var newImage = createImage({}, {\n width,\n height\n }, channels);\n copyImage(image, newImage, {\n x: 0,\n y: 0\n }, {\n x: 0,\n y: 0\n }, {\n width: Math.min(image.width, width),\n height: Math.min(image.height, height)\n }, channels);\n image.width = width;\n image.height = height;\n image.data = newImage.data;\n }\n function copyImage(srcImg, dstImg, srcPt, dstPt, size, channels) {\n if (size.width === 0 || size.height === 0) {\n return dstImg;\n }\n if (size.width > srcImg.width || size.height > srcImg.height || srcPt.x > srcImg.width - size.width || srcPt.y > srcImg.height - size.height) {\n throw new RangeError(\"out of range source coordinates for image copy\");\n }\n if (size.width > dstImg.width || size.height > dstImg.height || dstPt.x > dstImg.width - size.width || dstPt.y > dstImg.height - size.height) {\n throw new RangeError(\"out of range destination coordinates for image copy\");\n }\n var srcData = srcImg.data;\n var dstData = dstImg.data;\n for (var y = 0; y < size.height; y++) {\n var srcOffset = ((srcPt.y + y) * srcImg.width + srcPt.x) * channels;\n var dstOffset = ((dstPt.y + y) * dstImg.width + dstPt.x) * channels;\n for (var i = 0; i < size.width * channels; i++) {\n dstData[dstOffset + i] = srcData[srcOffset + i];\n }\n }\n return dstImg;\n }\n var AlphaImage = function AlphaImage2(size, data) {\n createImage(this, size, 1, data);\n };\n AlphaImage.prototype.resize = function resize(size) {\n resizeImage(this, size, 1);\n };\n AlphaImage.prototype.clone = function clone2() {\n return new AlphaImage({\n width: this.width,\n height: this.height\n }, new Uint8Array(this.data));\n };\n AlphaImage.copy = function copy(srcImg, dstImg, srcPt, dstPt, size) {\n copyImage(srcImg, dstImg, srcPt, dstPt, size, 1);\n };\n var RGBAImage = function RGBAImage2(size, data) {\n createImage(this, size, 4, data);\n };\n RGBAImage.prototype.resize = function resize(size) {\n resizeImage(this, size, 4);\n };\n RGBAImage.prototype.replace = function replace(data, copy) {\n if (copy) {\n this.data.set(data);\n } else if (data instanceof Uint8ClampedArray) {\n this.data = new Uint8Array(data.buffer);\n } else {\n this.data = data;\n }\n };\n RGBAImage.prototype.clone = function clone2() {\n return new RGBAImage({\n width: this.width,\n height: this.height\n }, new Uint8Array(this.data));\n };\n RGBAImage.copy = function copy(srcImg, dstImg, srcPt, dstPt, size) {\n copyImage(srcImg, dstImg, srcPt, dstPt, size, 4);\n };\n register(\"AlphaImage\", AlphaImage);\n register(\"RGBAImage\", RGBAImage);\n var paint$2 = new Properties({\n \"heatmap-radius\": new DataDrivenProperty(spec[\"paint_heatmap\"][\"heatmap-radius\"]),\n \"heatmap-weight\": new DataDrivenProperty(spec[\"paint_heatmap\"][\"heatmap-weight\"]),\n \"heatmap-intensity\": new DataConstantProperty(spec[\"paint_heatmap\"][\"heatmap-intensity\"]),\n \"heatmap-color\": new ColorRampProperty(spec[\"paint_heatmap\"][\"heatmap-color\"]),\n \"heatmap-opacity\": new DataConstantProperty(spec[\"paint_heatmap\"][\"heatmap-opacity\"])\n });\n var properties$1 = { paint: paint$2 };\n function renderColorRamp(params) {\n var evaluationGlobals = {};\n var width = params.resolution || 256;\n var height = params.clips ? params.clips.length : 1;\n var image = params.image || new RGBAImage({\n width,\n height\n });\n var renderPixel = function(stride2, index, progress2) {\n evaluationGlobals[params.evaluationKey] = progress2;\n var pxColor = params.expression.evaluate(evaluationGlobals);\n image.data[stride2 + index + 0] = Math.floor(pxColor.r * 255 / pxColor.a);\n image.data[stride2 + index + 1] = Math.floor(pxColor.g * 255 / pxColor.a);\n image.data[stride2 + index + 2] = Math.floor(pxColor.b * 255 / pxColor.a);\n image.data[stride2 + index + 3] = Math.floor(pxColor.a * 255);\n };\n if (!params.clips) {\n for (var i = 0, j = 0; i < width; i++, j += 4) {\n var progress = i / (width - 1);\n renderPixel(0, j, progress);\n }\n } else {\n for (var clip = 0, stride = 0; clip < height; ++clip, stride += width * 4) {\n for (var i$1 = 0, j$1 = 0; i$1 < width; i$1++, j$1 += 4) {\n var progress$1 = i$1 / (width - 1);\n var ref = params.clips[clip];\n var start = ref.start;\n var end = ref.end;\n var evaluationProgress = start * (1 - progress$1) + end * progress$1;\n renderPixel(stride, j$1, evaluationProgress);\n }\n }\n }\n return image;\n }\n var HeatmapStyleLayer = function(StyleLayer2) {\n function HeatmapStyleLayer2(layer2) {\n StyleLayer2.call(this, layer2, properties$1);\n this._updateColorRamp();\n }\n if (StyleLayer2)\n HeatmapStyleLayer2.__proto__ = StyleLayer2;\n HeatmapStyleLayer2.prototype = Object.create(StyleLayer2 && StyleLayer2.prototype);\n HeatmapStyleLayer2.prototype.constructor = HeatmapStyleLayer2;\n HeatmapStyleLayer2.prototype.createBucket = function createBucket(options) {\n return new HeatmapBucket(options);\n };\n HeatmapStyleLayer2.prototype._handleSpecialPaintPropertyUpdate = function _handleSpecialPaintPropertyUpdate(name3) {\n if (name3 === \"heatmap-color\") {\n this._updateColorRamp();\n }\n };\n HeatmapStyleLayer2.prototype._updateColorRamp = function _updateColorRamp() {\n var expression2 = this._transitionablePaint._values[\"heatmap-color\"].value.expression;\n this.colorRamp = renderColorRamp({\n expression: expression2,\n evaluationKey: \"heatmapDensity\",\n image: this.colorRamp\n });\n this.colorRampTexture = null;\n };\n HeatmapStyleLayer2.prototype.resize = function resize() {\n if (this.heatmapFbo) {\n this.heatmapFbo.destroy();\n this.heatmapFbo = null;\n }\n };\n HeatmapStyleLayer2.prototype.queryRadius = function queryRadius() {\n return 0;\n };\n HeatmapStyleLayer2.prototype.queryIntersectsFeature = function queryIntersectsFeature() {\n return false;\n };\n HeatmapStyleLayer2.prototype.hasOffscreenPass = function hasOffscreenPass() {\n return this.paint.get(\"heatmap-opacity\") !== 0 && this.visibility !== \"none\";\n };\n return HeatmapStyleLayer2;\n }(StyleLayer);\n var paint$3 = new Properties({\n \"hillshade-illumination-direction\": new DataConstantProperty(spec[\"paint_hillshade\"][\"hillshade-illumination-direction\"]),\n \"hillshade-illumination-anchor\": new DataConstantProperty(spec[\"paint_hillshade\"][\"hillshade-illumination-anchor\"]),\n \"hillshade-exaggeration\": new DataConstantProperty(spec[\"paint_hillshade\"][\"hillshade-exaggeration\"]),\n \"hillshade-shadow-color\": new DataConstantProperty(spec[\"paint_hillshade\"][\"hillshade-shadow-color\"]),\n \"hillshade-highlight-color\": new DataConstantProperty(spec[\"paint_hillshade\"][\"hillshade-highlight-color\"]),\n \"hillshade-accent-color\": new DataConstantProperty(spec[\"paint_hillshade\"][\"hillshade-accent-color\"])\n });\n var properties$2 = { paint: paint$3 };\n var HillshadeStyleLayer = function(StyleLayer2) {\n function HillshadeStyleLayer2(layer2) {\n StyleLayer2.call(this, layer2, properties$2);\n }\n if (StyleLayer2)\n HillshadeStyleLayer2.__proto__ = StyleLayer2;\n HillshadeStyleLayer2.prototype = Object.create(StyleLayer2 && StyleLayer2.prototype);\n HillshadeStyleLayer2.prototype.constructor = HillshadeStyleLayer2;\n HillshadeStyleLayer2.prototype.hasOffscreenPass = function hasOffscreenPass() {\n return this.paint.get(\"hillshade-exaggeration\") !== 0 && this.visibility !== \"none\";\n };\n return HillshadeStyleLayer2;\n }(StyleLayer);\n var layout$3 = createLayout([{\n name: \"a_pos\",\n components: 2,\n type: \"Int16\"\n }], 4);\n var members$1 = layout$3.members;\n var earcut_1 = earcut;\n var default_1 = earcut;\n function earcut(data, holeIndices, dim) {\n dim = dim || 2;\n var hasHoles = holeIndices && holeIndices.length, outerLen = hasHoles ? holeIndices[0] * dim : data.length, outerNode = linkedList(data, 0, outerLen, dim, true), triangles = [];\n if (!outerNode || outerNode.next === outerNode.prev) {\n return triangles;\n }\n var minX, minY, maxX, maxY, x, y, invSize;\n if (hasHoles) {\n outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n }\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) {\n minX = x;\n }\n if (y < minY) {\n minY = y;\n }\n if (x > maxX) {\n maxX = x;\n }\n if (y > maxY) {\n maxY = y;\n }\n }\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 1 / invSize : 0;\n }\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize);\n return triangles;\n }\n function linkedList(data, start, end, dim, clockwise) {\n var i, last;\n if (clockwise === signedArea(data, start, end, dim) > 0) {\n for (i = start; i < end; i += dim) {\n last = insertNode(i, data[i], data[i + 1], last);\n }\n } else {\n for (i = end - dim; i >= start; i -= dim) {\n 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 return last;\n }\n function filterPoints(start, end) {\n if (!start) {\n return start;\n }\n if (!end) {\n end = start;\n }\n var p = start, again;\n do {\n again = false;\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) {\n break;\n }\n again = true;\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n return end;\n }\n function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) {\n return;\n }\n if (!pass && invSize) {\n indexCurve(ear, minX, minY, invSize);\n }\n var stop = ear, prev, next;\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n removeNode(ear);\n ear = next.next;\n stop = next.next;\n continue;\n }\n ear = next;\n if (ear === stop) {\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n break;\n }\n }\n }\n function isEar(ear) {\n var a = ear.prev, b = ear, c = ear.next;\n if (area(a, b, c) >= 0) {\n return false;\n }\n var p = ear.next.next;\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) {\n return false;\n }\n p = p.next;\n }\n return true;\n }\n function isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev, b = ear, c = ear.next;\n if (area(a, b, c) >= 0) {\n return false;\n }\n var minTX = a.x < b.x ? a.x < c.x ? a.x : c.x : b.x < c.x ? b.x : c.x, minTY = a.y < b.y ? a.y < c.y ? a.y : c.y : b.y < c.y ? b.y : c.y, maxTX = a.x > b.x ? a.x > c.x ? a.x : c.x : b.x > c.x ? b.x : c.x, maxTY = a.y > b.y ? a.y > c.y ? a.y : c.y : b.y > c.y ? b.y : c.y;\n var minZ = zOrder(minTX, minTY, minX, minY, invSize), maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);\n var p = ear.prevZ, n = ear.nextZ;\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) {\n return false;\n }\n p = p.prevZ;\n if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) {\n return false;\n }\n n = n.nextZ;\n }\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) {\n return false;\n }\n p = p.prevZ;\n }\n while (n && n.z <= maxZ) {\n if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) {\n return false;\n }\n n = n.nextZ;\n }\n return true;\n }\n function cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev, b = p.next.next;\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n removeNode(p);\n removeNode(p.next);\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n return filterPoints(p);\n }\n function splitEarcut(start, triangles, dim, minX, minY, invSize) {\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 var c = splitPolygon(a, b);\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n earcutLinked(a, triangles, dim, minX, minY, invSize);\n earcutLinked(c, triangles, dim, minX, minY, invSize);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n }\n function eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [], i, len, start, end, list;\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) {\n list.steiner = true;\n }\n queue.push(getLeftmost(list));\n }\n queue.sort(compareX);\n for (i = 0; i < queue.length; i++) {\n eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n return outerNode;\n }\n function compareX(a, b) {\n return a.x - b.x;\n }\n function eliminateHole(hole, outerNode) {\n outerNode = findHoleBridge(hole, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, hole);\n filterPoints(outerNode, outerNode.next);\n filterPoints(b, b.next);\n }\n }\n function findHoleBridge(hole, outerNode) {\n var p = outerNode, hx = hole.x, hy = hole.y, qx = -Infinity, m;\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 if (x === hx) {\n if (hy === p.y) {\n return p;\n }\n if (hy === p.next.y) {\n return p.next;\n }\n }\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n if (!m) {\n return null;\n }\n if (hx === qx) {\n return m;\n }\n var stop = m, mx = m.x, my = m.y, tanMin = Infinity, tan;\n p = m;\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n tan = Math.abs(hy - p.y) / (hx - p.x);\n if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) {\n m = p;\n tanMin = tan;\n }\n }\n p = p.next;\n } while (p !== stop);\n return m;\n }\n function sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n }\n function indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === null) {\n p.z = zOrder(p.x, p.y, minX, minY, invSize);\n }\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n p.prevZ.nextZ = null;\n p.prevZ = null;\n sortLinked(p);\n }\n function sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize, inSize = 1;\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\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) {\n break;\n }\n }\n qSize = inSize;\n while (pSize > 0 || qSize > 0 && q) {\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 if (tail) {\n tail.nextZ = e;\n } else {\n list = e;\n }\n e.prevZ = tail;\n tail = e;\n }\n p = q;\n }\n tail.nextZ = null;\n inSize *= 2;\n } while (numMerges > 1);\n return list;\n }\n function zOrder(x, y, minX, minY, invSize) {\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n x = (x | x << 8) & 16711935;\n x = (x | x << 4) & 252645135;\n x = (x | x << 2) & 858993459;\n x = (x | x << 1) & 1431655765;\n y = (y | y << 8) & 16711935;\n y = (y | y << 4) & 252645135;\n y = (y | y << 2) & 858993459;\n y = (y | y << 1) & 1431655765;\n return x | y << 1;\n }\n function getLeftmost(start) {\n var p = start, leftmost = start;\n do {\n if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) {\n leftmost = p;\n }\n p = p.next;\n } while (p !== start);\n return leftmost;\n }\n function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n }\n function isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && (area(a.prev, a, b.prev) || area(a, b.prev, b)) || equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0);\n }\n function area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n }\n function equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n }\n function 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 if (o1 !== o2 && o3 !== o4) {\n return true;\n }\n if (o1 === 0 && onSegment(p1, p2, q1)) {\n return true;\n }\n if (o2 === 0 && onSegment(p1, q2, q1)) {\n return true;\n }\n if (o3 === 0 && onSegment(p2, p1, q2)) {\n return true;\n }\n if (o4 === 0 && onSegment(p2, q1, q2)) {\n return true;\n }\n return false;\n }\n function 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 function sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n }\n function 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 && intersects(p, p.next, a, b)) {\n return true;\n }\n p = p.next;\n } while (p !== a);\n return false;\n }\n function locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n }\n function middleInside(a, b) {\n var p = a, inside = false, px = (a.x + b.x) / 2, py = (a.y + b.y) / 2;\n do {\n if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x) {\n inside = !inside;\n }\n p = p.next;\n } while (p !== a);\n return inside;\n }\n function splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y), b2 = new Node(b.i, b.x, b.y), an = a.next, bp = b.prev;\n a.next = b;\n b.prev = a;\n a2.next = an;\n an.prev = a2;\n b2.next = a2;\n a2.prev = b2;\n bp.next = b2;\n b2.prev = bp;\n return b2;\n }\n function insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n if (!last) {\n p.prev = p;\n p.next = p;\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 function removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n if (p.prevZ) {\n p.prevZ.nextZ = p.nextZ;\n }\n if (p.nextZ) {\n p.nextZ.prevZ = p.prevZ;\n }\n }\n function Node(i, x, y) {\n this.i = i;\n this.x = x;\n this.y = y;\n this.prev = null;\n this.next = null;\n this.z = null;\n this.prevZ = null;\n this.nextZ = null;\n this.steiner = false;\n }\n earcut.deviation = function(data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\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 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((data[a] - data[c]) * (data[b + 1] - data[a + 1]) - (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n return polygonArea === 0 && trianglesArea === 0 ? 0 : Math.abs((trianglesArea - polygonArea) / polygonArea);\n };\n function 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 earcut.flatten = function(data) {\n var dim = data[0][0].length, result = {\n vertices: [],\n holes: [],\n dimensions: dim\n }, holeIndex = 0;\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++) {\n result.vertices.push(data[i][j][d]);\n }\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n };\n earcut_1.default = default_1;\n function quickselect(arr, k, left, right, compare2) {\n quickselectStep(arr, k, left || 0, right || arr.length - 1, compare2 || defaultCompare);\n }\n function quickselectStep(arr, k, left, right, compare2) {\n while (right > left) {\n if (right - left > 600) {\n var n = right - left + 1;\n var m = k - left + 1;\n var z = Math.log(n);\n var s = 0.5 * Math.exp(2 * z / 3);\n var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);\n var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));\n var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));\n quickselectStep(arr, k, newLeft, newRight, compare2);\n }\n var t = arr[k];\n var i = left;\n var j = right;\n swap$1(arr, left, k);\n if (compare2(arr[right], t) > 0) {\n swap$1(arr, left, right);\n }\n while (i < j) {\n swap$1(arr, i, j);\n i++;\n j--;\n while (compare2(arr[i], t) < 0) {\n i++;\n }\n while (compare2(arr[j], t) > 0) {\n j--;\n }\n }\n if (compare2(arr[left], t) === 0) {\n swap$1(arr, left, j);\n } else {\n j++;\n swap$1(arr, j, right);\n }\n if (j <= k) {\n left = j + 1;\n }\n if (k <= j) {\n right = j - 1;\n }\n }\n }\n function swap$1(arr, i, j) {\n var tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n function defaultCompare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n }\n function classifyRings(rings, maxRings) {\n var len = rings.length;\n if (len <= 1) {\n return [rings];\n }\n var polygons = [];\n var polygon, ccw;\n for (var i = 0; i < len; i++) {\n var area2 = calculateSignedArea(rings[i]);\n if (area2 === 0) {\n continue;\n }\n rings[i].area = Math.abs(area2);\n if (ccw === void 0) {\n ccw = area2 < 0;\n }\n if (ccw === area2 < 0) {\n if (polygon) {\n polygons.push(polygon);\n }\n polygon = [rings[i]];\n } else {\n polygon.push(rings[i]);\n }\n }\n if (polygon) {\n polygons.push(polygon);\n }\n if (maxRings > 1) {\n for (var j = 0; j < polygons.length; j++) {\n if (polygons[j].length <= maxRings) {\n continue;\n }\n quickselect(polygons[j], maxRings, 1, polygons[j].length - 1, compareAreas);\n polygons[j] = polygons[j].slice(0, maxRings);\n }\n }\n return polygons;\n }\n function compareAreas(a, b) {\n return b.area - a.area;\n }\n function hasPattern(type, layers, options) {\n var patterns = options.patternDependencies;\n var hasPattern2 = false;\n for (var i = 0, list = layers; i < list.length; i += 1) {\n var layer2 = list[i];\n var patternProperty = layer2.paint.get(type + \"-pattern\");\n if (!patternProperty.isConstant()) {\n hasPattern2 = true;\n }\n var constantPattern = patternProperty.constantOr(null);\n if (constantPattern) {\n hasPattern2 = true;\n patterns[constantPattern.to] = true;\n patterns[constantPattern.from] = true;\n }\n }\n return hasPattern2;\n }\n function addPatternDependencies(type, layers, patternFeature, zoom, options) {\n var patterns = options.patternDependencies;\n for (var i = 0, list = layers; i < list.length; i += 1) {\n var layer2 = list[i];\n var patternProperty = layer2.paint.get(type + \"-pattern\");\n var patternPropertyValue = patternProperty.value;\n if (patternPropertyValue.kind !== \"constant\") {\n var min = patternPropertyValue.evaluate({ zoom: zoom - 1 }, patternFeature, {}, options.availableImages);\n var mid = patternPropertyValue.evaluate({ zoom }, patternFeature, {}, options.availableImages);\n var max = patternPropertyValue.evaluate({ zoom: zoom + 1 }, patternFeature, {}, options.availableImages);\n min = min && min.name ? min.name : min;\n mid = mid && mid.name ? mid.name : mid;\n max = max && max.name ? max.name : max;\n patterns[min] = true;\n patterns[mid] = true;\n patterns[max] = true;\n patternFeature.patterns[layer2.id] = {\n min,\n mid,\n max\n };\n }\n }\n return patternFeature;\n }\n var EARCUT_MAX_RINGS = 500;\n var FillBucket = function FillBucket2(options) {\n this.zoom = options.zoom;\n this.overscaling = options.overscaling;\n this.layers = options.layers;\n this.layerIds = this.layers.map(function(layer2) {\n return layer2.id;\n });\n this.index = options.index;\n this.hasPattern = false;\n this.patternFeatures = [];\n this.layoutVertexArray = new StructArrayLayout2i4();\n this.indexArray = new StructArrayLayout3ui6();\n this.indexArray2 = new StructArrayLayout2ui4();\n this.programConfigurations = new ProgramConfigurationSet(options.layers, options.zoom);\n this.segments = new SegmentVector();\n this.segments2 = new SegmentVector();\n this.stateDependentLayerIds = this.layers.filter(function(l) {\n return l.isStateDependent();\n }).map(function(l) {\n return l.id;\n });\n };\n FillBucket.prototype.populate = function populate(features, options, canonical) {\n this.hasPattern = hasPattern(\"fill\", this.layers, options);\n var fillSortKey = this.layers[0].layout.get(\"fill-sort-key\");\n var bucketFeatures = [];\n for (var i = 0, list = features; i < list.length; i += 1) {\n var ref = list[i];\n var feature = ref.feature;\n var id2 = ref.id;\n var index = ref.index;\n var sourceLayerIndex = ref.sourceLayerIndex;\n var needGeometry = this.layers[0]._featureFilter.needGeometry;\n var evaluationFeature = toEvaluationFeature(feature, needGeometry);\n if (!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom), evaluationFeature, canonical)) {\n continue;\n }\n var sortKey = fillSortKey ? fillSortKey.evaluate(evaluationFeature, {}, canonical, options.availableImages) : void 0;\n var bucketFeature = {\n id: id2,\n properties: feature.properties,\n type: feature.type,\n sourceLayerIndex,\n index,\n geometry: needGeometry ? evaluationFeature.geometry : loadGeometry(feature),\n patterns: {},\n sortKey\n };\n bucketFeatures.push(bucketFeature);\n }\n if (fillSortKey) {\n bucketFeatures.sort(function(a, b) {\n return a.sortKey - b.sortKey;\n });\n }\n for (var i$1 = 0, list$1 = bucketFeatures; i$1 < list$1.length; i$1 += 1) {\n var bucketFeature$1 = list$1[i$1];\n var ref$1 = bucketFeature$1;\n var geometry = ref$1.geometry;\n var index$1 = ref$1.index;\n var sourceLayerIndex$1 = ref$1.sourceLayerIndex;\n if (this.hasPattern) {\n var patternFeature = addPatternDependencies(\"fill\", this.layers, bucketFeature$1, this.zoom, options);\n this.patternFeatures.push(patternFeature);\n } else {\n this.addFeature(bucketFeature$1, geometry, index$1, canonical, {});\n }\n var feature$1 = features[index$1].feature;\n options.featureIndex.insert(feature$1, geometry, index$1, sourceLayerIndex$1, this.index);\n }\n };\n FillBucket.prototype.update = function update(states, vtLayer, imagePositions) {\n if (!this.stateDependentLayers.length) {\n return;\n }\n this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, imagePositions);\n };\n FillBucket.prototype.addFeatures = function addFeatures(options, canonical, imagePositions) {\n for (var i = 0, list = this.patternFeatures; i < list.length; i += 1) {\n var feature = list[i];\n this.addFeature(feature, feature.geometry, feature.index, canonical, imagePositions);\n }\n };\n FillBucket.prototype.isEmpty = function isEmpty2() {\n return this.layoutVertexArray.length === 0;\n };\n FillBucket.prototype.uploadPending = function uploadPending() {\n return !this.uploaded || this.programConfigurations.needsUpload;\n };\n FillBucket.prototype.upload = function upload(context) {\n if (!this.uploaded) {\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, members$1);\n this.indexBuffer = context.createIndexBuffer(this.indexArray);\n this.indexBuffer2 = context.createIndexBuffer(this.indexArray2);\n }\n this.programConfigurations.upload(context);\n this.uploaded = true;\n };\n FillBucket.prototype.destroy = function destroy() {\n if (!this.layoutVertexBuffer) {\n return;\n }\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.indexBuffer2.destroy();\n this.programConfigurations.destroy();\n this.segments.destroy();\n this.segments2.destroy();\n };\n FillBucket.prototype.addFeature = function addFeature2(feature, geometry, index, canonical, imagePositions) {\n for (var i$4 = 0, list$2 = classifyRings(geometry, EARCUT_MAX_RINGS); i$4 < list$2.length; i$4 += 1) {\n var polygon = list$2[i$4];\n var numVertices = 0;\n for (var i$2 = 0, list = polygon; i$2 < list.length; i$2 += 1) {\n var ring = list[i$2];\n numVertices += ring.length;\n }\n var triangleSegment = this.segments.prepareSegment(numVertices, this.layoutVertexArray, this.indexArray);\n var triangleIndex = triangleSegment.vertexLength;\n var flattened = [];\n var holeIndices = [];\n for (var i$3 = 0, list$1 = polygon; i$3 < list$1.length; i$3 += 1) {\n var ring$1 = list$1[i$3];\n if (ring$1.length === 0) {\n continue;\n }\n if (ring$1 !== polygon[0]) {\n holeIndices.push(flattened.length / 2);\n }\n var lineSegment = this.segments2.prepareSegment(ring$1.length, this.layoutVertexArray, this.indexArray2);\n var lineIndex = lineSegment.vertexLength;\n this.layoutVertexArray.emplaceBack(ring$1[0].x, ring$1[0].y);\n this.indexArray2.emplaceBack(lineIndex + ring$1.length - 1, lineIndex);\n flattened.push(ring$1[0].x);\n flattened.push(ring$1[0].y);\n for (var i = 1; i < ring$1.length; i++) {\n this.layoutVertexArray.emplaceBack(ring$1[i].x, ring$1[i].y);\n this.indexArray2.emplaceBack(lineIndex + i - 1, lineIndex + i);\n flattened.push(ring$1[i].x);\n flattened.push(ring$1[i].y);\n }\n lineSegment.vertexLength += ring$1.length;\n lineSegment.primitiveLength += ring$1.length;\n }\n var indices = earcut_1(flattened, holeIndices);\n for (var i$1 = 0; i$1 < indices.length; i$1 += 3) {\n this.indexArray.emplaceBack(triangleIndex + indices[i$1], triangleIndex + indices[i$1 + 1], triangleIndex + indices[i$1 + 2]);\n }\n triangleSegment.vertexLength += numVertices;\n triangleSegment.primitiveLength += indices.length / 3;\n }\n this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, feature, index, imagePositions, canonical);\n };\n register(\"FillBucket\", FillBucket, {\n omit: [\n \"layers\",\n \"patternFeatures\"\n ]\n });\n var layout$4 = new Properties({ \"fill-sort-key\": new DataDrivenProperty(spec[\"layout_fill\"][\"fill-sort-key\"]) });\n var paint$4 = new Properties({\n \"fill-antialias\": new DataConstantProperty(spec[\"paint_fill\"][\"fill-antialias\"]),\n \"fill-opacity\": new DataDrivenProperty(spec[\"paint_fill\"][\"fill-opacity\"]),\n \"fill-color\": new DataDrivenProperty(spec[\"paint_fill\"][\"fill-color\"]),\n \"fill-outline-color\": new DataDrivenProperty(spec[\"paint_fill\"][\"fill-outline-color\"]),\n \"fill-translate\": new DataConstantProperty(spec[\"paint_fill\"][\"fill-translate\"]),\n \"fill-translate-anchor\": new DataConstantProperty(spec[\"paint_fill\"][\"fill-translate-anchor\"]),\n \"fill-pattern\": new CrossFadedDataDrivenProperty(spec[\"paint_fill\"][\"fill-pattern\"])\n });\n var properties$3 = {\n paint: paint$4,\n layout: layout$4\n };\n var FillStyleLayer = function(StyleLayer2) {\n function FillStyleLayer2(layer2) {\n StyleLayer2.call(this, layer2, properties$3);\n }\n if (StyleLayer2)\n FillStyleLayer2.__proto__ = StyleLayer2;\n FillStyleLayer2.prototype = Object.create(StyleLayer2 && StyleLayer2.prototype);\n FillStyleLayer2.prototype.constructor = FillStyleLayer2;\n FillStyleLayer2.prototype.recalculate = function recalculate(parameters, availableImages) {\n StyleLayer2.prototype.recalculate.call(this, parameters, availableImages);\n var outlineColor = this.paint._values[\"fill-outline-color\"];\n if (outlineColor.value.kind === \"constant\" && outlineColor.value.value === void 0) {\n this.paint._values[\"fill-outline-color\"] = this.paint._values[\"fill-color\"];\n }\n };\n FillStyleLayer2.prototype.createBucket = function createBucket(parameters) {\n return new FillBucket(parameters);\n };\n FillStyleLayer2.prototype.queryRadius = function queryRadius() {\n return translateDistance(this.paint.get(\"fill-translate\"));\n };\n FillStyleLayer2.prototype.queryIntersectsFeature = function queryIntersectsFeature(queryGeometry, feature, featureState, geometry, zoom, transform, pixelsToTileUnits) {\n var translatedPolygon = translate(queryGeometry, this.paint.get(\"fill-translate\"), this.paint.get(\"fill-translate-anchor\"), transform.angle, pixelsToTileUnits);\n return polygonIntersectsMultiPolygon(translatedPolygon, geometry);\n };\n FillStyleLayer2.prototype.isTileClipped = function isTileClipped() {\n return true;\n };\n return FillStyleLayer2;\n }(StyleLayer);\n var layout$5 = createLayout([\n {\n name: \"a_pos\",\n components: 2,\n type: \"Int16\"\n },\n {\n name: \"a_normal_ed\",\n components: 4,\n type: \"Int16\"\n }\n ], 4);\n var members$2 = layout$5.members;\n var vectortilefeature = VectorTileFeature;\n function VectorTileFeature(pbf2, end, extent, keys, values2) {\n this.properties = {};\n this.extent = extent;\n this.type = 0;\n this._pbf = pbf2;\n this._geometry = -1;\n this._keys = keys;\n this._values = values2;\n pbf2.readFields(readFeature, this, end);\n }\n function readFeature(tag, feature, pbf2) {\n if (tag == 1) {\n feature.id = pbf2.readVarint();\n } else if (tag == 2) {\n readTag(pbf2, feature);\n } else if (tag == 3) {\n feature.type = pbf2.readVarint();\n } else if (tag == 4) {\n feature._geometry = pbf2.pos;\n }\n }\n function readTag(pbf2, feature) {\n var end = pbf2.readVarint() + pbf2.pos;\n while (pbf2.pos < end) {\n var key = feature._keys[pbf2.readVarint()], value = feature._values[pbf2.readVarint()];\n feature.properties[key] = value;\n }\n }\n VectorTileFeature.types = [\n \"Unknown\",\n \"Point\",\n \"LineString\",\n \"Polygon\"\n ];\n VectorTileFeature.prototype.loadGeometry = function() {\n var pbf2 = this._pbf;\n pbf2.pos = this._geometry;\n var end = pbf2.readVarint() + pbf2.pos, cmd = 1, length = 0, x = 0, y = 0, lines = [], line;\n while (pbf2.pos < end) {\n if (length <= 0) {\n var cmdLen = pbf2.readVarint();\n cmd = cmdLen & 7;\n length = cmdLen >> 3;\n }\n length--;\n if (cmd === 1 || cmd === 2) {\n x += pbf2.readSVarint();\n y += pbf2.readSVarint();\n if (cmd === 1) {\n if (line) {\n lines.push(line);\n }\n line = [];\n }\n line.push(new pointGeometry(x, y));\n } else if (cmd === 7) {\n if (line) {\n line.push(line[0].clone());\n }\n } else {\n throw new Error(\"unknown command \" + cmd);\n }\n }\n if (line) {\n lines.push(line);\n }\n return lines;\n };\n VectorTileFeature.prototype.bbox = function() {\n var pbf2 = this._pbf;\n pbf2.pos = this._geometry;\n var end = pbf2.readVarint() + pbf2.pos, cmd = 1, length = 0, x = 0, y = 0, x1 = Infinity, x2 = -Infinity, y1 = Infinity, y2 = -Infinity;\n while (pbf2.pos < end) {\n if (length <= 0) {\n var cmdLen = pbf2.readVarint();\n cmd = cmdLen & 7;\n length = cmdLen >> 3;\n }\n length--;\n if (cmd === 1 || cmd === 2) {\n x += pbf2.readSVarint();\n y += pbf2.readSVarint();\n if (x < x1) {\n x1 = x;\n }\n if (x > x2) {\n x2 = x;\n }\n if (y < y1) {\n y1 = y;\n }\n if (y > y2) {\n y2 = y;\n }\n } else if (cmd !== 7) {\n throw new Error(\"unknown command \" + cmd);\n }\n }\n return [\n x1,\n y1,\n x2,\n y2\n ];\n };\n VectorTileFeature.prototype.toGeoJSON = function(x, y, z) {\n var size = this.extent * Math.pow(2, z), x0 = this.extent * x, y0 = this.extent * y, coords = this.loadGeometry(), type = VectorTileFeature.types[this.type], i, j;\n function project(line) {\n for (var j2 = 0; j2 < line.length; j2++) {\n var p = line[j2], y2 = 180 - (p.y + y0) * 360 / size;\n line[j2] = [\n (p.x + x0) * 360 / size - 180,\n 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90\n ];\n }\n }\n switch (this.type) {\n case 1:\n var points = [];\n for (i = 0; i < coords.length; i++) {\n points[i] = coords[i][0];\n }\n coords = points;\n project(coords);\n break;\n case 2:\n for (i = 0; i < coords.length; i++) {\n project(coords[i]);\n }\n break;\n case 3:\n coords = classifyRings$1(coords);\n for (i = 0; i < coords.length; i++) {\n for (j = 0; j < coords[i].length; j++) {\n project(coords[i][j]);\n }\n }\n break;\n }\n if (coords.length === 1) {\n coords = coords[0];\n } else {\n type = \"Multi\" + type;\n }\n var result = {\n type: \"Feature\",\n geometry: {\n type,\n coordinates: coords\n },\n properties: this.properties\n };\n if (\"id\" in this) {\n result.id = this.id;\n }\n return result;\n };\n function classifyRings$1(rings) {\n var len = rings.length;\n if (len <= 1) {\n return [rings];\n }\n var polygons = [], polygon, ccw;\n for (var i = 0; i < len; i++) {\n var area2 = signedArea$1(rings[i]);\n if (area2 === 0) {\n continue;\n }\n if (ccw === void 0) {\n ccw = area2 < 0;\n }\n if (ccw === area2 < 0) {\n if (polygon) {\n polygons.push(polygon);\n }\n polygon = [rings[i]];\n } else {\n polygon.push(rings[i]);\n }\n }\n if (polygon) {\n polygons.push(polygon);\n }\n return polygons;\n }\n function signedArea$1(ring) {\n var sum = 0;\n for (var i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) {\n p1 = ring[i];\n p2 = ring[j];\n sum += (p2.x - p1.x) * (p1.y + p2.y);\n }\n return sum;\n }\n var vectortilelayer = VectorTileLayer;\n function VectorTileLayer(pbf2, end) {\n this.version = 1;\n this.name = null;\n this.extent = 4096;\n this.length = 0;\n this._pbf = pbf2;\n this._keys = [];\n this._values = [];\n this._features = [];\n pbf2.readFields(readLayer, this, end);\n this.length = this._features.length;\n }\n function readLayer(tag, layer2, pbf2) {\n if (tag === 15) {\n layer2.version = pbf2.readVarint();\n } else if (tag === 1) {\n layer2.name = pbf2.readString();\n } else if (tag === 5) {\n layer2.extent = pbf2.readVarint();\n } else if (tag === 2) {\n layer2._features.push(pbf2.pos);\n } else if (tag === 3) {\n layer2._keys.push(pbf2.readString());\n } else if (tag === 4) {\n layer2._values.push(readValueMessage(pbf2));\n }\n }\n function readValueMessage(pbf2) {\n var value = null, end = pbf2.readVarint() + pbf2.pos;\n while (pbf2.pos < end) {\n var tag = pbf2.readVarint() >> 3;\n value = tag === 1 ? pbf2.readString() : tag === 2 ? pbf2.readFloat() : tag === 3 ? pbf2.readDouble() : tag === 4 ? pbf2.readVarint64() : tag === 5 ? pbf2.readVarint() : tag === 6 ? pbf2.readSVarint() : tag === 7 ? pbf2.readBoolean() : null;\n }\n return value;\n }\n VectorTileLayer.prototype.feature = function(i) {\n if (i < 0 || i >= this._features.length) {\n throw new Error(\"feature index out of bounds\");\n }\n this._pbf.pos = this._features[i];\n var end = this._pbf.readVarint() + this._pbf.pos;\n return new vectortilefeature(this._pbf, end, this.extent, this._keys, this._values);\n };\n var vectortile = VectorTile;\n function VectorTile(pbf2, end) {\n this.layers = pbf2.readFields(readTile, {}, end);\n }\n function readTile(tag, layers, pbf2) {\n if (tag === 3) {\n var layer2 = new vectortilelayer(pbf2, pbf2.readVarint() + pbf2.pos);\n if (layer2.length) {\n layers[layer2.name] = layer2;\n }\n }\n }\n var VectorTile$1 = vectortile;\n var VectorTileFeature$1 = vectortilefeature;\n var VectorTileLayer$1 = vectortilelayer;\n var vectorTile = {\n VectorTile: VectorTile$1,\n VectorTileFeature: VectorTileFeature$1,\n VectorTileLayer: VectorTileLayer$1\n };\n var vectorTileFeatureTypes = vectorTile.VectorTileFeature.types;\n var EARCUT_MAX_RINGS$1 = 500;\n var FACTOR = Math.pow(2, 13);\n function addVertex(vertexArray, x, y, nx, ny, nz, t, e) {\n vertexArray.emplaceBack(x, y, Math.floor(nx * FACTOR) * 2 + t, ny * FACTOR * 2, nz * FACTOR * 2, Math.round(e));\n }\n var FillExtrusionBucket = function FillExtrusionBucket2(options) {\n this.zoom = options.zoom;\n this.overscaling = options.overscaling;\n this.layers = options.layers;\n this.layerIds = this.layers.map(function(layer2) {\n return layer2.id;\n });\n this.index = options.index;\n this.hasPattern = false;\n this.layoutVertexArray = new StructArrayLayout2i4i12();\n this.indexArray = new StructArrayLayout3ui6();\n this.programConfigurations = new ProgramConfigurationSet(options.layers, options.zoom);\n this.segments = new SegmentVector();\n this.stateDependentLayerIds = this.layers.filter(function(l) {\n return l.isStateDependent();\n }).map(function(l) {\n return l.id;\n });\n };\n FillExtrusionBucket.prototype.populate = function populate(features, options, canonical) {\n this.features = [];\n this.hasPattern = hasPattern(\"fill-extrusion\", this.layers, options);\n for (var i = 0, list = features; i < list.length; i += 1) {\n var ref = list[i];\n var feature = ref.feature;\n var id2 = ref.id;\n var index = ref.index;\n var sourceLayerIndex = ref.sourceLayerIndex;\n var needGeometry = this.layers[0]._featureFilter.needGeometry;\n var evaluationFeature = toEvaluationFeature(feature, needGeometry);\n if (!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom), evaluationFeature, canonical)) {\n continue;\n }\n var bucketFeature = {\n id: id2,\n sourceLayerIndex,\n index,\n geometry: needGeometry ? evaluationFeature.geometry : loadGeometry(feature),\n properties: feature.properties,\n type: feature.type,\n patterns: {}\n };\n if (this.hasPattern) {\n this.features.push(addPatternDependencies(\"fill-extrusion\", this.layers, bucketFeature, this.zoom, options));\n } else {\n this.addFeature(bucketFeature, bucketFeature.geometry, index, canonical, {});\n }\n options.featureIndex.insert(feature, bucketFeature.geometry, index, sourceLayerIndex, this.index, true);\n }\n };\n FillExtrusionBucket.prototype.addFeatures = function addFeatures(options, canonical, imagePositions) {\n for (var i = 0, list = this.features; i < list.length; i += 1) {\n var feature = list[i];\n var geometry = feature.geometry;\n this.addFeature(feature, geometry, feature.index, canonical, imagePositions);\n }\n };\n FillExtrusionBucket.prototype.update = function update(states, vtLayer, imagePositions) {\n if (!this.stateDependentLayers.length) {\n return;\n }\n this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, imagePositions);\n };\n FillExtrusionBucket.prototype.isEmpty = function isEmpty2() {\n return this.layoutVertexArray.length === 0;\n };\n FillExtrusionBucket.prototype.uploadPending = function uploadPending() {\n return !this.uploaded || this.programConfigurations.needsUpload;\n };\n FillExtrusionBucket.prototype.upload = function upload(context) {\n if (!this.uploaded) {\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, members$2);\n this.indexBuffer = context.createIndexBuffer(this.indexArray);\n }\n this.programConfigurations.upload(context);\n this.uploaded = true;\n };\n FillExtrusionBucket.prototype.destroy = function destroy() {\n if (!this.layoutVertexBuffer) {\n return;\n }\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.programConfigurations.destroy();\n this.segments.destroy();\n };\n FillExtrusionBucket.prototype.addFeature = function addFeature2(feature, geometry, index, canonical, imagePositions) {\n for (var i$4 = 0, list$3 = classifyRings(geometry, EARCUT_MAX_RINGS$1); i$4 < list$3.length; i$4 += 1) {\n var polygon = list$3[i$4];\n var numVertices = 0;\n for (var i$1 = 0, list = polygon; i$1 < list.length; i$1 += 1) {\n var ring = list[i$1];\n numVertices += ring.length;\n }\n var segment = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray);\n for (var i$2 = 0, list$1 = polygon; i$2 < list$1.length; i$2 += 1) {\n var ring$1 = list$1[i$2];\n if (ring$1.length === 0) {\n continue;\n }\n if (isEntirelyOutside(ring$1)) {\n continue;\n }\n var edgeDistance = 0;\n for (var p = 0; p < ring$1.length; p++) {\n var p1 = ring$1[p];\n if (p >= 1) {\n var p2 = ring$1[p - 1];\n if (!isBoundaryEdge(p1, p2)) {\n if (segment.vertexLength + 4 > SegmentVector.MAX_VERTEX_ARRAY_LENGTH) {\n segment = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray);\n }\n var perp2 = p1.sub(p2)._perp()._unit();\n var dist = p2.dist(p1);\n if (edgeDistance + dist > 32768) {\n edgeDistance = 0;\n }\n addVertex(this.layoutVertexArray, p1.x, p1.y, perp2.x, perp2.y, 0, 0, edgeDistance);\n addVertex(this.layoutVertexArray, p1.x, p1.y, perp2.x, perp2.y, 0, 1, edgeDistance);\n edgeDistance += dist;\n addVertex(this.layoutVertexArray, p2.x, p2.y, perp2.x, perp2.y, 0, 0, edgeDistance);\n addVertex(this.layoutVertexArray, p2.x, p2.y, perp2.x, perp2.y, 0, 1, edgeDistance);\n var bottomRight = segment.vertexLength;\n this.indexArray.emplaceBack(bottomRight, bottomRight + 2, bottomRight + 1);\n this.indexArray.emplaceBack(bottomRight + 1, bottomRight + 2, bottomRight + 3);\n segment.vertexLength += 4;\n segment.primitiveLength += 2;\n }\n }\n }\n }\n if (segment.vertexLength + numVertices > SegmentVector.MAX_VERTEX_ARRAY_LENGTH) {\n segment = this.segments.prepareSegment(numVertices, this.layoutVertexArray, this.indexArray);\n }\n if (vectorTileFeatureTypes[feature.type] !== \"Polygon\") {\n continue;\n }\n var flattened = [];\n var holeIndices = [];\n var triangleIndex = segment.vertexLength;\n for (var i$3 = 0, list$2 = polygon; i$3 < list$2.length; i$3 += 1) {\n var ring$2 = list$2[i$3];\n if (ring$2.length === 0) {\n continue;\n }\n if (ring$2 !== polygon[0]) {\n holeIndices.push(flattened.length / 2);\n }\n for (var i = 0; i < ring$2.length; i++) {\n var p$1 = ring$2[i];\n addVertex(this.layoutVertexArray, p$1.x, p$1.y, 0, 0, 1, 1, 0);\n flattened.push(p$1.x);\n flattened.push(p$1.y);\n }\n }\n var indices = earcut_1(flattened, holeIndices);\n for (var j = 0; j < indices.length; j += 3) {\n this.indexArray.emplaceBack(triangleIndex + indices[j], triangleIndex + indices[j + 2], triangleIndex + indices[j + 1]);\n }\n segment.primitiveLength += indices.length / 3;\n segment.vertexLength += numVertices;\n }\n this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, feature, index, imagePositions, canonical);\n };\n register(\"FillExtrusionBucket\", FillExtrusionBucket, {\n omit: [\n \"layers\",\n \"features\"\n ]\n });\n function isBoundaryEdge(p1, p2) {\n return p1.x === p2.x && (p1.x < 0 || p1.x > EXTENT$1) || p1.y === p2.y && (p1.y < 0 || p1.y > EXTENT$1);\n }\n function isEntirelyOutside(ring) {\n return ring.every(function(p) {\n return p.x < 0;\n }) || ring.every(function(p) {\n return p.x > EXTENT$1;\n }) || ring.every(function(p) {\n return p.y < 0;\n }) || ring.every(function(p) {\n return p.y > EXTENT$1;\n });\n }\n var paint$5 = new Properties({\n \"fill-extrusion-opacity\": new DataConstantProperty(spec[\"paint_fill-extrusion\"][\"fill-extrusion-opacity\"]),\n \"fill-extrusion-color\": new DataDrivenProperty(spec[\"paint_fill-extrusion\"][\"fill-extrusion-color\"]),\n \"fill-extrusion-translate\": new DataConstantProperty(spec[\"paint_fill-extrusion\"][\"fill-extrusion-translate\"]),\n \"fill-extrusion-translate-anchor\": new DataConstantProperty(spec[\"paint_fill-extrusion\"][\"fill-extrusion-translate-anchor\"]),\n \"fill-extrusion-pattern\": new CrossFadedDataDrivenProperty(spec[\"paint_fill-extrusion\"][\"fill-extrusion-pattern\"]),\n \"fill-extrusion-height\": new DataDrivenProperty(spec[\"paint_fill-extrusion\"][\"fill-extrusion-height\"]),\n \"fill-extrusion-base\": new DataDrivenProperty(spec[\"paint_fill-extrusion\"][\"fill-extrusion-base\"]),\n \"fill-extrusion-vertical-gradient\": new DataConstantProperty(spec[\"paint_fill-extrusion\"][\"fill-extrusion-vertical-gradient\"])\n });\n var properties$4 = { paint: paint$5 };\n var FillExtrusionStyleLayer = function(StyleLayer2) {\n function FillExtrusionStyleLayer2(layer2) {\n StyleLayer2.call(this, layer2, properties$4);\n }\n if (StyleLayer2)\n FillExtrusionStyleLayer2.__proto__ = StyleLayer2;\n FillExtrusionStyleLayer2.prototype = Object.create(StyleLayer2 && StyleLayer2.prototype);\n FillExtrusionStyleLayer2.prototype.constructor = FillExtrusionStyleLayer2;\n FillExtrusionStyleLayer2.prototype.createBucket = function createBucket(parameters) {\n return new FillExtrusionBucket(parameters);\n };\n FillExtrusionStyleLayer2.prototype.queryRadius = function queryRadius() {\n return translateDistance(this.paint.get(\"fill-extrusion-translate\"));\n };\n FillExtrusionStyleLayer2.prototype.is3D = function is3D() {\n return true;\n };\n FillExtrusionStyleLayer2.prototype.queryIntersectsFeature = function queryIntersectsFeature(queryGeometry, feature, featureState, geometry, zoom, transform, pixelsToTileUnits, pixelPosMatrix) {\n var translatedPolygon = translate(queryGeometry, this.paint.get(\"fill-extrusion-translate\"), this.paint.get(\"fill-extrusion-translate-anchor\"), transform.angle, pixelsToTileUnits);\n var height = this.paint.get(\"fill-extrusion-height\").evaluate(feature, featureState);\n var base = this.paint.get(\"fill-extrusion-base\").evaluate(feature, featureState);\n var projectedQueryGeometry = projectQueryGeometry$1(translatedPolygon, pixelPosMatrix, transform, 0);\n var projected = projectExtrusion(geometry, base, height, pixelPosMatrix);\n var projectedBase = projected[0];\n var projectedTop = projected[1];\n return checkIntersection(projectedBase, projectedTop, projectedQueryGeometry);\n };\n return FillExtrusionStyleLayer2;\n }(StyleLayer);\n function dot$2(a, b) {\n return a.x * b.x + a.y * b.y;\n }\n function getIntersectionDistance(projectedQueryGeometry, projectedFace) {\n if (projectedQueryGeometry.length === 1) {\n var i = 0;\n var a = projectedFace[i++];\n var b;\n while (!b || a.equals(b)) {\n b = projectedFace[i++];\n if (!b) {\n return Infinity;\n }\n }\n for (; i < projectedFace.length; i++) {\n var c = projectedFace[i];\n var p = projectedQueryGeometry[0];\n var ab = b.sub(a);\n var ac = c.sub(a);\n var ap = p.sub(a);\n var dotABAB = dot$2(ab, ab);\n var dotABAC = dot$2(ab, ac);\n var dotACAC = dot$2(ac, ac);\n var dotAPAB = dot$2(ap, ab);\n var dotAPAC = dot$2(ap, ac);\n var denom = dotABAB * dotACAC - dotABAC * dotABAC;\n var v = (dotACAC * dotAPAB - dotABAC * dotAPAC) / denom;\n var w = (dotABAB * dotAPAC - dotABAC * dotAPAB) / denom;\n var u = 1 - v - w;\n var distance = a.z * u + b.z * v + c.z * w;\n if (isFinite(distance)) {\n return distance;\n }\n }\n return Infinity;\n } else {\n var closestDistance = Infinity;\n for (var i$1 = 0, list = projectedFace; i$1 < list.length; i$1 += 1) {\n var p$1 = list[i$1];\n closestDistance = Math.min(closestDistance, p$1.z);\n }\n return closestDistance;\n }\n }\n function checkIntersection(projectedBase, projectedTop, projectedQueryGeometry) {\n var closestDistance = Infinity;\n if (polygonIntersectsMultiPolygon(projectedQueryGeometry, projectedTop)) {\n closestDistance = getIntersectionDistance(projectedQueryGeometry, projectedTop[0]);\n }\n for (var r = 0; r < projectedTop.length; r++) {\n var ringTop = projectedTop[r];\n var ringBase = projectedBase[r];\n for (var p = 0; p < ringTop.length - 1; p++) {\n var topA = ringTop[p];\n var topB = ringTop[p + 1];\n var baseA = ringBase[p];\n var baseB = ringBase[p + 1];\n var face = [\n topA,\n topB,\n baseB,\n baseA,\n topA\n ];\n if (polygonIntersectsPolygon(projectedQueryGeometry, face)) {\n closestDistance = Math.min(closestDistance, getIntersectionDistance(projectedQueryGeometry, face));\n }\n }\n }\n return closestDistance === Infinity ? false : closestDistance;\n }\n function projectExtrusion(geometry, zBase, zTop, m) {\n var projectedBase = [];\n var projectedTop = [];\n var baseXZ = m[8] * zBase;\n var baseYZ = m[9] * zBase;\n var baseZZ = m[10] * zBase;\n var baseWZ = m[11] * zBase;\n var topXZ = m[8] * zTop;\n var topYZ = m[9] * zTop;\n var topZZ = m[10] * zTop;\n var topWZ = m[11] * zTop;\n for (var i$1 = 0, list$1 = geometry; i$1 < list$1.length; i$1 += 1) {\n var r = list$1[i$1];\n var ringBase = [];\n var ringTop = [];\n for (var i = 0, list = r; i < list.length; i += 1) {\n var p = list[i];\n var x = p.x;\n var y = p.y;\n var sX = m[0] * x + m[4] * y + m[12];\n var sY = m[1] * x + m[5] * y + m[13];\n var sZ = m[2] * x + m[6] * y + m[14];\n var sW = m[3] * x + m[7] * y + m[15];\n var baseX = sX + baseXZ;\n var baseY = sY + baseYZ;\n var baseZ = sZ + baseZZ;\n var baseW = sW + baseWZ;\n var topX = sX + topXZ;\n var topY = sY + topYZ;\n var topZ = sZ + topZZ;\n var topW = sW + topWZ;\n var b = new pointGeometry(baseX / baseW, baseY / baseW);\n b.z = baseZ / baseW;\n ringBase.push(b);\n var t = new pointGeometry(topX / topW, topY / topW);\n t.z = topZ / topW;\n ringTop.push(t);\n }\n projectedBase.push(ringBase);\n projectedTop.push(ringTop);\n }\n return [\n projectedBase,\n projectedTop\n ];\n }\n function projectQueryGeometry$1(queryGeometry, pixelPosMatrix, transform, z) {\n var projectedQueryGeometry = [];\n for (var i = 0, list = queryGeometry; i < list.length; i += 1) {\n var p = list[i];\n var v = [\n p.x,\n p.y,\n z,\n 1\n ];\n transformMat4(v, v, pixelPosMatrix);\n projectedQueryGeometry.push(new pointGeometry(v[0] / v[3], v[1] / v[3]));\n }\n return projectedQueryGeometry;\n }\n var lineLayoutAttributes = createLayout([\n {\n name: \"a_pos_normal\",\n components: 2,\n type: \"Int16\"\n },\n {\n name: \"a_data\",\n components: 4,\n type: \"Uint8\"\n }\n ], 4);\n var members$3 = lineLayoutAttributes.members;\n var lineLayoutAttributesExt = createLayout([\n {\n name: \"a_uv_x\",\n components: 1,\n type: \"Float32\"\n },\n {\n name: \"a_split_index\",\n components: 1,\n type: \"Float32\"\n }\n ]);\n var members$4 = lineLayoutAttributesExt.members;\n var vectorTileFeatureTypes$1 = vectorTile.VectorTileFeature.types;\n var EXTRUDE_SCALE = 63;\n var COS_HALF_SHARP_CORNER = Math.cos(75 / 2 * (Math.PI / 180));\n var SHARP_CORNER_OFFSET = 15;\n var DEG_PER_TRIANGLE = 20;\n var LINE_DISTANCE_BUFFER_BITS = 15;\n var LINE_DISTANCE_SCALE = 1 / 2;\n var MAX_LINE_DISTANCE = Math.pow(2, LINE_DISTANCE_BUFFER_BITS - 1) / LINE_DISTANCE_SCALE;\n var LineBucket = function LineBucket2(options) {\n var this$1 = this;\n this.zoom = options.zoom;\n this.overscaling = options.overscaling;\n this.layers = options.layers;\n this.layerIds = this.layers.map(function(layer2) {\n return layer2.id;\n });\n this.index = options.index;\n this.hasPattern = false;\n this.patternFeatures = [];\n this.lineClipsArray = [];\n this.gradients = {};\n this.layers.forEach(function(layer2) {\n this$1.gradients[layer2.id] = {};\n });\n this.layoutVertexArray = new StructArrayLayout2i4ub8();\n this.layoutVertexArray2 = new StructArrayLayout2f8();\n this.indexArray = new StructArrayLayout3ui6();\n this.programConfigurations = new ProgramConfigurationSet(options.layers, options.zoom);\n this.segments = new SegmentVector();\n this.maxLineLength = 0;\n this.stateDependentLayerIds = this.layers.filter(function(l) {\n return l.isStateDependent();\n }).map(function(l) {\n return l.id;\n });\n };\n LineBucket.prototype.populate = function populate(features, options, canonical) {\n this.hasPattern = hasPattern(\"line\", this.layers, options);\n var lineSortKey = this.layers[0].layout.get(\"line-sort-key\");\n var bucketFeatures = [];\n for (var i = 0, list = features; i < list.length; i += 1) {\n var ref = list[i];\n var feature = ref.feature;\n var id2 = ref.id;\n var index = ref.index;\n var sourceLayerIndex = ref.sourceLayerIndex;\n var needGeometry = this.layers[0]._featureFilter.needGeometry;\n var evaluationFeature = toEvaluationFeature(feature, needGeometry);\n if (!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom), evaluationFeature, canonical)) {\n continue;\n }\n var sortKey = lineSortKey ? lineSortKey.evaluate(evaluationFeature, {}, canonical) : void 0;\n var bucketFeature = {\n id: id2,\n properties: feature.properties,\n type: feature.type,\n sourceLayerIndex,\n index,\n geometry: needGeometry ? evaluationFeature.geometry : loadGeometry(feature),\n patterns: {},\n sortKey\n };\n bucketFeatures.push(bucketFeature);\n }\n if (lineSortKey) {\n bucketFeatures.sort(function(a, b) {\n return a.sortKey - b.sortKey;\n });\n }\n for (var i$1 = 0, list$1 = bucketFeatures; i$1 < list$1.length; i$1 += 1) {\n var bucketFeature$1 = list$1[i$1];\n var ref$1 = bucketFeature$1;\n var geometry = ref$1.geometry;\n var index$1 = ref$1.index;\n var sourceLayerIndex$1 = ref$1.sourceLayerIndex;\n if (this.hasPattern) {\n var patternBucketFeature = addPatternDependencies(\"line\", this.layers, bucketFeature$1, this.zoom, options);\n this.patternFeatures.push(patternBucketFeature);\n } else {\n this.addFeature(bucketFeature$1, geometry, index$1, canonical, {});\n }\n var feature$1 = features[index$1].feature;\n options.featureIndex.insert(feature$1, geometry, index$1, sourceLayerIndex$1, this.index);\n }\n };\n LineBucket.prototype.update = function update(states, vtLayer, imagePositions) {\n if (!this.stateDependentLayers.length) {\n return;\n }\n this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, imagePositions);\n };\n LineBucket.prototype.addFeatures = function addFeatures(options, canonical, imagePositions) {\n for (var i = 0, list = this.patternFeatures; i < list.length; i += 1) {\n var feature = list[i];\n this.addFeature(feature, feature.geometry, feature.index, canonical, imagePositions);\n }\n };\n LineBucket.prototype.isEmpty = function isEmpty2() {\n return this.layoutVertexArray.length === 0;\n };\n LineBucket.prototype.uploadPending = function uploadPending() {\n return !this.uploaded || this.programConfigurations.needsUpload;\n };\n LineBucket.prototype.upload = function upload(context) {\n if (!this.uploaded) {\n if (this.layoutVertexArray2.length !== 0) {\n this.layoutVertexBuffer2 = context.createVertexBuffer(this.layoutVertexArray2, members$4);\n }\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, members$3);\n this.indexBuffer = context.createIndexBuffer(this.indexArray);\n }\n this.programConfigurations.upload(context);\n this.uploaded = true;\n };\n LineBucket.prototype.destroy = function destroy() {\n if (!this.layoutVertexBuffer) {\n return;\n }\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.programConfigurations.destroy();\n this.segments.destroy();\n };\n LineBucket.prototype.lineFeatureClips = function lineFeatureClips(feature) {\n if (!!feature.properties && feature.properties.hasOwnProperty(\"mapbox_clip_start\") && feature.properties.hasOwnProperty(\"mapbox_clip_end\")) {\n var start = +feature.properties[\"mapbox_clip_start\"];\n var end = +feature.properties[\"mapbox_clip_end\"];\n return {\n start,\n end\n };\n }\n };\n LineBucket.prototype.addFeature = function addFeature2(feature, geometry, index, canonical, imagePositions) {\n var layout2 = this.layers[0].layout;\n var join = layout2.get(\"line-join\").evaluate(feature, {});\n var cap = layout2.get(\"line-cap\");\n var miterLimit = layout2.get(\"line-miter-limit\");\n var roundLimit = layout2.get(\"line-round-limit\");\n this.lineClips = this.lineFeatureClips(feature);\n for (var i = 0, list = geometry; i < list.length; i += 1) {\n var line = list[i];\n this.addLine(line, feature, join, cap, miterLimit, roundLimit);\n }\n this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, feature, index, imagePositions, canonical);\n };\n LineBucket.prototype.addLine = function addLine(vertices, feature, join, cap, miterLimit, roundLimit) {\n this.distance = 0;\n this.scaledDistance = 0;\n this.totalDistance = 0;\n if (this.lineClips) {\n this.lineClipsArray.push(this.lineClips);\n for (var i = 0; i < vertices.length - 1; i++) {\n this.totalDistance += vertices[i].dist(vertices[i + 1]);\n }\n this.updateScaledDistance();\n this.maxLineLength = Math.max(this.maxLineLength, this.totalDistance);\n }\n var isPolygon = vectorTileFeatureTypes$1[feature.type] === \"Polygon\";\n var len = vertices.length;\n while (len >= 2 && vertices[len - 1].equals(vertices[len - 2])) {\n len--;\n }\n var first = 0;\n while (first < len - 1 && vertices[first].equals(vertices[first + 1])) {\n first++;\n }\n if (len < (isPolygon ? 3 : 2)) {\n return;\n }\n if (join === \"bevel\") {\n miterLimit = 1.05;\n }\n var sharpCornerOffset = this.overscaling <= 16 ? SHARP_CORNER_OFFSET * EXTENT$1 / (512 * this.overscaling) : 0;\n var segment = this.segments.prepareSegment(len * 10, this.layoutVertexArray, this.indexArray);\n var currentVertex;\n var prevVertex = void 0;\n var nextVertex = void 0;\n var prevNormal = void 0;\n var nextNormal = void 0;\n this.e1 = this.e2 = -1;\n if (isPolygon) {\n currentVertex = vertices[len - 2];\n nextNormal = vertices[first].sub(currentVertex)._unit()._perp();\n }\n for (var i$1 = first; i$1 < len; i$1++) {\n nextVertex = i$1 === len - 1 ? isPolygon ? vertices[first + 1] : void 0 : vertices[i$1 + 1];\n if (nextVertex && vertices[i$1].equals(nextVertex)) {\n continue;\n }\n if (nextNormal) {\n prevNormal = nextNormal;\n }\n if (currentVertex) {\n prevVertex = currentVertex;\n }\n currentVertex = vertices[i$1];\n nextNormal = nextVertex ? nextVertex.sub(currentVertex)._unit()._perp() : prevNormal;\n prevNormal = prevNormal || nextNormal;\n var joinNormal = prevNormal.add(nextNormal);\n if (joinNormal.x !== 0 || joinNormal.y !== 0) {\n joinNormal._unit();\n }\n var cosAngle = prevNormal.x * nextNormal.x + prevNormal.y * nextNormal.y;\n var cosHalfAngle = joinNormal.x * nextNormal.x + joinNormal.y * nextNormal.y;\n var miterLength = cosHalfAngle !== 0 ? 1 / cosHalfAngle : Infinity;\n var approxAngle = 2 * Math.sqrt(2 - 2 * cosHalfAngle);\n var isSharpCorner = cosHalfAngle < COS_HALF_SHARP_CORNER && prevVertex && nextVertex;\n var lineTurnsLeft = prevNormal.x * nextNormal.y - prevNormal.y * nextNormal.x > 0;\n if (isSharpCorner && i$1 > first) {\n var prevSegmentLength = currentVertex.dist(prevVertex);\n if (prevSegmentLength > 2 * sharpCornerOffset) {\n var newPrevVertex = currentVertex.sub(currentVertex.sub(prevVertex)._mult(sharpCornerOffset / prevSegmentLength)._round());\n this.updateDistance(prevVertex, newPrevVertex);\n this.addCurrentVertex(newPrevVertex, prevNormal, 0, 0, segment);\n prevVertex = newPrevVertex;\n }\n }\n var middleVertex = prevVertex && nextVertex;\n var currentJoin = middleVertex ? join : isPolygon ? \"butt\" : cap;\n if (middleVertex && currentJoin === \"round\") {\n if (miterLength < roundLimit) {\n currentJoin = \"miter\";\n } else if (miterLength <= 2) {\n currentJoin = \"fakeround\";\n }\n }\n if (currentJoin === \"miter\" && miterLength > miterLimit) {\n currentJoin = \"bevel\";\n }\n if (currentJoin === \"bevel\") {\n if (miterLength > 2) {\n currentJoin = \"flipbevel\";\n }\n if (miterLength < miterLimit) {\n currentJoin = \"miter\";\n }\n }\n if (prevVertex) {\n this.updateDistance(prevVertex, currentVertex);\n }\n if (currentJoin === \"miter\") {\n joinNormal._mult(miterLength);\n this.addCurrentVertex(currentVertex, joinNormal, 0, 0, segment);\n } else if (currentJoin === \"flipbevel\") {\n if (miterLength > 100) {\n joinNormal = nextNormal.mult(-1);\n } else {\n var bevelLength = miterLength * prevNormal.add(nextNormal).mag() / prevNormal.sub(nextNormal).mag();\n joinNormal._perp()._mult(bevelLength * (lineTurnsLeft ? -1 : 1));\n }\n this.addCurrentVertex(currentVertex, joinNormal, 0, 0, segment);\n this.addCurrentVertex(currentVertex, joinNormal.mult(-1), 0, 0, segment);\n } else if (currentJoin === \"bevel\" || currentJoin === \"fakeround\") {\n var offset = -Math.sqrt(miterLength * miterLength - 1);\n var offsetA = lineTurnsLeft ? offset : 0;\n var offsetB = lineTurnsLeft ? 0 : offset;\n if (prevVertex) {\n this.addCurrentVertex(currentVertex, prevNormal, offsetA, offsetB, segment);\n }\n if (currentJoin === \"fakeround\") {\n var n = Math.round(approxAngle * 180 / Math.PI / DEG_PER_TRIANGLE);\n for (var m = 1; m < n; m++) {\n var t = m / n;\n if (t !== 0.5) {\n var t23 = t - 0.5;\n var A2 = 1.0904 + cosAngle * (-3.2452 + cosAngle * (3.55645 - cosAngle * 1.43519));\n var B2 = 0.848013 + cosAngle * (-1.06021 + cosAngle * 0.215638);\n t = t + t * t23 * (t - 1) * (A2 * t23 * t23 + B2);\n }\n var extrude = nextNormal.sub(prevNormal)._mult(t)._add(prevNormal)._unit()._mult(lineTurnsLeft ? -1 : 1);\n this.addHalfVertex(currentVertex, extrude.x, extrude.y, false, lineTurnsLeft, 0, segment);\n }\n }\n if (nextVertex) {\n this.addCurrentVertex(currentVertex, nextNormal, -offsetA, -offsetB, segment);\n }\n } else if (currentJoin === \"butt\") {\n this.addCurrentVertex(currentVertex, joinNormal, 0, 0, segment);\n } else if (currentJoin === \"square\") {\n var offset$1 = prevVertex ? 1 : -1;\n this.addCurrentVertex(currentVertex, joinNormal, offset$1, offset$1, segment);\n } else if (currentJoin === \"round\") {\n if (prevVertex) {\n this.addCurrentVertex(currentVertex, prevNormal, 0, 0, segment);\n this.addCurrentVertex(currentVertex, prevNormal, 1, 1, segment, true);\n }\n if (nextVertex) {\n this.addCurrentVertex(currentVertex, nextNormal, -1, -1, segment, true);\n this.addCurrentVertex(currentVertex, nextNormal, 0, 0, segment);\n }\n }\n if (isSharpCorner && i$1 < len - 1) {\n var nextSegmentLength = currentVertex.dist(nextVertex);\n if (nextSegmentLength > 2 * sharpCornerOffset) {\n var newCurrentVertex = currentVertex.add(nextVertex.sub(currentVertex)._mult(sharpCornerOffset / nextSegmentLength)._round());\n this.updateDistance(currentVertex, newCurrentVertex);\n this.addCurrentVertex(newCurrentVertex, nextNormal, 0, 0, segment);\n currentVertex = newCurrentVertex;\n }\n }\n }\n };\n LineBucket.prototype.addCurrentVertex = function addCurrentVertex(p, normal, endLeft, endRight, segment, round) {\n if (round === void 0)\n round = false;\n var leftX = normal.x + normal.y * endLeft;\n var leftY = normal.y - normal.x * endLeft;\n var rightX = -normal.x + normal.y * endRight;\n var rightY = -normal.y - normal.x * endRight;\n this.addHalfVertex(p, leftX, leftY, round, false, endLeft, segment);\n this.addHalfVertex(p, rightX, rightY, round, true, -endRight, segment);\n if (this.distance > MAX_LINE_DISTANCE / 2 && this.totalDistance === 0) {\n this.distance = 0;\n this.addCurrentVertex(p, normal, endLeft, endRight, segment, round);\n }\n };\n LineBucket.prototype.addHalfVertex = function addHalfVertex(ref, extrudeX, extrudeY, round, up, dir, segment) {\n var x = ref.x;\n var y = ref.y;\n var totalDistance = this.lineClips ? this.scaledDistance * (MAX_LINE_DISTANCE - 1) : this.scaledDistance;\n var linesofarScaled = totalDistance * LINE_DISTANCE_SCALE;\n this.layoutVertexArray.emplaceBack((x << 1) + (round ? 1 : 0), (y << 1) + (up ? 1 : 0), Math.round(EXTRUDE_SCALE * extrudeX) + 128, Math.round(EXTRUDE_SCALE * extrudeY) + 128, (dir === 0 ? 0 : dir < 0 ? -1 : 1) + 1 | (linesofarScaled & 63) << 2, linesofarScaled >> 6);\n if (this.lineClips) {\n var progressRealigned = this.scaledDistance - this.lineClips.start;\n var endClipRealigned = this.lineClips.end - this.lineClips.start;\n var uvX = progressRealigned / endClipRealigned;\n this.layoutVertexArray2.emplaceBack(uvX, this.lineClipsArray.length);\n }\n var e = segment.vertexLength++;\n if (this.e1 >= 0 && this.e2 >= 0) {\n this.indexArray.emplaceBack(this.e1, this.e2, e);\n segment.primitiveLength++;\n }\n if (up) {\n this.e2 = e;\n } else {\n this.e1 = e;\n }\n };\n LineBucket.prototype.updateScaledDistance = function updateScaledDistance() {\n this.scaledDistance = this.lineClips ? this.lineClips.start + (this.lineClips.end - this.lineClips.start) * this.distance / this.totalDistance : this.distance;\n };\n LineBucket.prototype.updateDistance = function updateDistance(prev, next) {\n this.distance += prev.dist(next);\n this.updateScaledDistance();\n };\n register(\"LineBucket\", LineBucket, {\n omit: [\n \"layers\",\n \"patternFeatures\"\n ]\n });\n var layout$6 = new Properties({\n \"line-cap\": new DataConstantProperty(spec[\"layout_line\"][\"line-cap\"]),\n \"line-join\": new DataDrivenProperty(spec[\"layout_line\"][\"line-join\"]),\n \"line-miter-limit\": new DataConstantProperty(spec[\"layout_line\"][\"line-miter-limit\"]),\n \"line-round-limit\": new DataConstantProperty(spec[\"layout_line\"][\"line-round-limit\"]),\n \"line-sort-key\": new DataDrivenProperty(spec[\"layout_line\"][\"line-sort-key\"])\n });\n var paint$6 = new Properties({\n \"line-opacity\": new DataDrivenProperty(spec[\"paint_line\"][\"line-opacity\"]),\n \"line-color\": new DataDrivenProperty(spec[\"paint_line\"][\"line-color\"]),\n \"line-translate\": new DataConstantProperty(spec[\"paint_line\"][\"line-translate\"]),\n \"line-translate-anchor\": new DataConstantProperty(spec[\"paint_line\"][\"line-translate-anchor\"]),\n \"line-width\": new DataDrivenProperty(spec[\"paint_line\"][\"line-width\"]),\n \"line-gap-width\": new DataDrivenProperty(spec[\"paint_line\"][\"line-gap-width\"]),\n \"line-offset\": new DataDrivenProperty(spec[\"paint_line\"][\"line-offset\"]),\n \"line-blur\": new DataDrivenProperty(spec[\"paint_line\"][\"line-blur\"]),\n \"line-dasharray\": new CrossFadedProperty(spec[\"paint_line\"][\"line-dasharray\"]),\n \"line-pattern\": new CrossFadedDataDrivenProperty(spec[\"paint_line\"][\"line-pattern\"]),\n \"line-gradient\": new ColorRampProperty(spec[\"paint_line\"][\"line-gradient\"])\n });\n var properties$5 = {\n paint: paint$6,\n layout: layout$6\n };\n var LineFloorwidthProperty = function(DataDrivenProperty2) {\n function LineFloorwidthProperty2() {\n DataDrivenProperty2.apply(this, arguments);\n }\n if (DataDrivenProperty2)\n LineFloorwidthProperty2.__proto__ = DataDrivenProperty2;\n LineFloorwidthProperty2.prototype = Object.create(DataDrivenProperty2 && DataDrivenProperty2.prototype);\n LineFloorwidthProperty2.prototype.constructor = LineFloorwidthProperty2;\n LineFloorwidthProperty2.prototype.possiblyEvaluate = function possiblyEvaluate(value, parameters) {\n parameters = new EvaluationParameters(Math.floor(parameters.zoom), {\n now: parameters.now,\n fadeDuration: parameters.fadeDuration,\n zoomHistory: parameters.zoomHistory,\n transition: parameters.transition\n });\n return DataDrivenProperty2.prototype.possiblyEvaluate.call(this, value, parameters);\n };\n LineFloorwidthProperty2.prototype.evaluate = function evaluate(value, globals, feature, featureState) {\n globals = extend2({}, globals, { zoom: Math.floor(globals.zoom) });\n return DataDrivenProperty2.prototype.evaluate.call(this, value, globals, feature, featureState);\n };\n return LineFloorwidthProperty2;\n }(DataDrivenProperty);\n var lineFloorwidthProperty = new LineFloorwidthProperty(properties$5.paint.properties[\"line-width\"].specification);\n lineFloorwidthProperty.useIntegerZoom = true;\n var LineStyleLayer = function(StyleLayer2) {\n function LineStyleLayer2(layer2) {\n StyleLayer2.call(this, layer2, properties$5);\n this.gradientVersion = 0;\n }\n if (StyleLayer2)\n LineStyleLayer2.__proto__ = StyleLayer2;\n LineStyleLayer2.prototype = Object.create(StyleLayer2 && StyleLayer2.prototype);\n LineStyleLayer2.prototype.constructor = LineStyleLayer2;\n LineStyleLayer2.prototype._handleSpecialPaintPropertyUpdate = function _handleSpecialPaintPropertyUpdate(name3) {\n if (name3 === \"line-gradient\") {\n var expression2 = this._transitionablePaint._values[\"line-gradient\"].value.expression;\n this.stepInterpolant = expression2._styleExpression.expression instanceof Step;\n this.gradientVersion = (this.gradientVersion + 1) % MAX_SAFE_INTEGER;\n }\n };\n LineStyleLayer2.prototype.gradientExpression = function gradientExpression() {\n return this._transitionablePaint._values[\"line-gradient\"].value.expression;\n };\n LineStyleLayer2.prototype.recalculate = function recalculate(parameters, availableImages) {\n StyleLayer2.prototype.recalculate.call(this, parameters, availableImages);\n this.paint._values[\"line-floorwidth\"] = lineFloorwidthProperty.possiblyEvaluate(this._transitioningPaint._values[\"line-width\"].value, parameters);\n };\n LineStyleLayer2.prototype.createBucket = function createBucket(parameters) {\n return new LineBucket(parameters);\n };\n LineStyleLayer2.prototype.queryRadius = function queryRadius(bucket) {\n var lineBucket = bucket;\n var width = getLineWidth(getMaximumPaintValue(\"line-width\", this, lineBucket), getMaximumPaintValue(\"line-gap-width\", this, lineBucket));\n var offset = getMaximumPaintValue(\"line-offset\", this, lineBucket);\n return width / 2 + Math.abs(offset) + translateDistance(this.paint.get(\"line-translate\"));\n };\n LineStyleLayer2.prototype.queryIntersectsFeature = function queryIntersectsFeature(queryGeometry, feature, featureState, geometry, zoom, transform, pixelsToTileUnits) {\n var translatedPolygon = translate(queryGeometry, this.paint.get(\"line-translate\"), this.paint.get(\"line-translate-anchor\"), transform.angle, pixelsToTileUnits);\n var halfWidth = pixelsToTileUnits / 2 * getLineWidth(this.paint.get(\"line-width\").evaluate(feature, featureState), this.paint.get(\"line-gap-width\").evaluate(feature, featureState));\n var lineOffset = this.paint.get(\"line-offset\").evaluate(feature, featureState);\n if (lineOffset) {\n geometry = offsetLine(geometry, lineOffset * pixelsToTileUnits);\n }\n return polygonIntersectsBufferedMultiLine(translatedPolygon, geometry, halfWidth);\n };\n LineStyleLayer2.prototype.isTileClipped = function isTileClipped() {\n return true;\n };\n return LineStyleLayer2;\n }(StyleLayer);\n function getLineWidth(lineWidth, lineGapWidth) {\n if (lineGapWidth > 0) {\n return lineGapWidth + 2 * lineWidth;\n } else {\n return lineWidth;\n }\n }\n function offsetLine(rings, offset) {\n var newRings = [];\n var zero2 = new pointGeometry(0, 0);\n for (var k = 0; k < rings.length; k++) {\n var ring = rings[k];\n var newRing = [];\n for (var i = 0; i < ring.length; i++) {\n var a = ring[i - 1];\n var b = ring[i];\n var c = ring[i + 1];\n var aToB = i === 0 ? zero2 : b.sub(a)._unit()._perp();\n var bToC = i === ring.length - 1 ? zero2 : c.sub(b)._unit()._perp();\n var extrude = aToB._add(bToC)._unit();\n var cosHalfAngle = extrude.x * bToC.x + extrude.y * bToC.y;\n extrude._mult(1 / cosHalfAngle);\n newRing.push(extrude._mult(offset)._add(b));\n }\n newRings.push(newRing);\n }\n return newRings;\n }\n var symbolLayoutAttributes = createLayout([\n {\n name: \"a_pos_offset\",\n components: 4,\n type: \"Int16\"\n },\n {\n name: \"a_data\",\n components: 4,\n type: \"Uint16\"\n },\n {\n name: \"a_pixeloffset\",\n components: 4,\n type: \"Int16\"\n }\n ], 4);\n var dynamicLayoutAttributes = createLayout([{\n name: \"a_projected_pos\",\n components: 3,\n type: \"Float32\"\n }], 4);\n var placementOpacityAttributes = createLayout([{\n name: \"a_fade_opacity\",\n components: 1,\n type: \"Uint32\"\n }], 4);\n var collisionVertexAttributes = createLayout([\n {\n name: \"a_placed\",\n components: 2,\n type: \"Uint8\"\n },\n {\n name: \"a_shift\",\n components: 2,\n type: \"Float32\"\n }\n ]);\n var collisionBox = createLayout([\n {\n type: \"Int16\",\n name: \"anchorPointX\"\n },\n {\n type: \"Int16\",\n name: \"anchorPointY\"\n },\n {\n type: \"Int16\",\n name: \"x1\"\n },\n {\n type: \"Int16\",\n name: \"y1\"\n },\n {\n type: \"Int16\",\n name: \"x2\"\n },\n {\n type: \"Int16\",\n name: \"y2\"\n },\n {\n type: \"Uint32\",\n name: \"featureIndex\"\n },\n {\n type: \"Uint16\",\n name: \"sourceLayerIndex\"\n },\n {\n type: \"Uint16\",\n name: \"bucketIndex\"\n }\n ]);\n var collisionBoxLayout = createLayout([\n {\n name: \"a_pos\",\n components: 2,\n type: \"Int16\"\n },\n {\n name: \"a_anchor_pos\",\n components: 2,\n type: \"Int16\"\n },\n {\n name: \"a_extrude\",\n components: 2,\n type: \"Int16\"\n }\n ], 4);\n var collisionCircleLayout = createLayout([\n {\n name: \"a_pos\",\n components: 2,\n type: \"Float32\"\n },\n {\n name: \"a_radius\",\n components: 1,\n type: \"Float32\"\n },\n {\n name: \"a_flags\",\n components: 2,\n type: \"Int16\"\n }\n ], 4);\n var quadTriangle = createLayout([{\n name: \"triangle\",\n components: 3,\n type: \"Uint16\"\n }]);\n var placement = createLayout([\n {\n type: \"Int16\",\n name: \"anchorX\"\n },\n {\n type: \"Int16\",\n name: \"anchorY\"\n },\n {\n type: \"Uint16\",\n name: \"glyphStartIndex\"\n },\n {\n type: \"Uint16\",\n name: \"numGlyphs\"\n },\n {\n type: \"Uint32\",\n name: \"vertexStartIndex\"\n },\n {\n type: \"Uint32\",\n name: \"lineStartIndex\"\n },\n {\n type: \"Uint32\",\n name: \"lineLength\"\n },\n {\n type: \"Uint16\",\n name: \"segment\"\n },\n {\n type: \"Uint16\",\n name: \"lowerSize\"\n },\n {\n type: \"Uint16\",\n name: \"upperSize\"\n },\n {\n type: \"Float32\",\n name: \"lineOffsetX\"\n },\n {\n type: \"Float32\",\n name: \"lineOffsetY\"\n },\n {\n type: \"Uint8\",\n name: \"writingMode\"\n },\n {\n type: \"Uint8\",\n name: \"placedOrientation\"\n },\n {\n type: \"Uint8\",\n name: \"hidden\"\n },\n {\n type: \"Uint32\",\n name: \"crossTileID\"\n },\n {\n type: \"Int16\",\n name: \"associatedIconIndex\"\n }\n ]);\n var symbolInstance = createLayout([\n {\n type: \"Int16\",\n name: \"anchorX\"\n },\n {\n type: \"Int16\",\n name: \"anchorY\"\n },\n {\n type: \"Int16\",\n name: \"rightJustifiedTextSymbolIndex\"\n },\n {\n type: \"Int16\",\n name: \"centerJustifiedTextSymbolIndex\"\n },\n {\n type: \"Int16\",\n name: \"leftJustifiedTextSymbolIndex\"\n },\n {\n type: \"Int16\",\n name: \"verticalPlacedTextSymbolIndex\"\n },\n {\n type: \"Int16\",\n name: \"placedIconSymbolIndex\"\n },\n {\n type: \"Int16\",\n name: \"verticalPlacedIconSymbolIndex\"\n },\n {\n type: \"Uint16\",\n name: \"key\"\n },\n {\n type: \"Uint16\",\n name: \"textBoxStartIndex\"\n },\n {\n type: \"Uint16\",\n name: \"textBoxEndIndex\"\n },\n {\n type: \"Uint16\",\n name: \"verticalTextBoxStartIndex\"\n },\n {\n type: \"Uint16\",\n name: \"verticalTextBoxEndIndex\"\n },\n {\n type: \"Uint16\",\n name: \"iconBoxStartIndex\"\n },\n {\n type: \"Uint16\",\n name: \"iconBoxEndIndex\"\n },\n {\n type: \"Uint16\",\n name: \"verticalIconBoxStartIndex\"\n },\n {\n type: \"Uint16\",\n name: \"verticalIconBoxEndIndex\"\n },\n {\n type: \"Uint16\",\n name: \"featureIndex\"\n },\n {\n type: \"Uint16\",\n name: \"numHorizontalGlyphVertices\"\n },\n {\n type: \"Uint16\",\n name: \"numVerticalGlyphVertices\"\n },\n {\n type: \"Uint16\",\n name: \"numIconVertices\"\n },\n {\n type: \"Uint16\",\n name: \"numVerticalIconVertices\"\n },\n {\n type: \"Uint16\",\n name: \"useRuntimeCollisionCircles\"\n },\n {\n type: \"Uint32\",\n name: \"crossTileID\"\n },\n {\n type: \"Float32\",\n name: \"textBoxScale\"\n },\n {\n type: \"Float32\",\n components: 2,\n name: \"textOffset\"\n },\n {\n type: \"Float32\",\n name: \"collisionCircleDiameter\"\n }\n ]);\n var glyphOffset = createLayout([{\n type: \"Float32\",\n name: \"offsetX\"\n }]);\n var lineVertex = createLayout([\n {\n type: \"Int16\",\n name: \"x\"\n },\n {\n type: \"Int16\",\n name: \"y\"\n },\n {\n type: \"Int16\",\n name: \"tileUnitDistanceFromAnchor\"\n }\n ]);\n function transformText(text, layer2, feature) {\n var transform = layer2.layout.get(\"text-transform\").evaluate(feature, {});\n if (transform === \"uppercase\") {\n text = text.toLocaleUpperCase();\n } else if (transform === \"lowercase\") {\n text = text.toLocaleLowerCase();\n }\n if (plugin.applyArabicShaping) {\n text = plugin.applyArabicShaping(text);\n }\n return text;\n }\n function transformText$1(text, layer2, feature) {\n text.sections.forEach(function(section) {\n section.text = transformText(section.text, layer2, feature);\n });\n return text;\n }\n function mergeLines(features) {\n var leftIndex = {};\n var rightIndex = {};\n var mergedFeatures = [];\n var mergedIndex = 0;\n function add2(k2) {\n mergedFeatures.push(features[k2]);\n mergedIndex++;\n }\n function mergeFromRight(leftKey2, rightKey2, geom2) {\n var i2 = rightIndex[leftKey2];\n delete rightIndex[leftKey2];\n rightIndex[rightKey2] = i2;\n mergedFeatures[i2].geometry[0].pop();\n mergedFeatures[i2].geometry[0] = mergedFeatures[i2].geometry[0].concat(geom2[0]);\n return i2;\n }\n function mergeFromLeft(leftKey2, rightKey2, geom2) {\n var i2 = leftIndex[rightKey2];\n delete leftIndex[rightKey2];\n leftIndex[leftKey2] = i2;\n mergedFeatures[i2].geometry[0].shift();\n mergedFeatures[i2].geometry[0] = geom2[0].concat(mergedFeatures[i2].geometry[0]);\n return i2;\n }\n function getKey(text2, geom2, onRight) {\n var point = onRight ? geom2[0][geom2[0].length - 1] : geom2[0][0];\n return text2 + \":\" + point.x + \":\" + point.y;\n }\n for (var k = 0; k < features.length; k++) {\n var feature = features[k];\n var geom = feature.geometry;\n var text = feature.text ? feature.text.toString() : null;\n if (!text) {\n add2(k);\n continue;\n }\n var leftKey = getKey(text, geom), rightKey = getKey(text, geom, true);\n if (leftKey in rightIndex && rightKey in leftIndex && rightIndex[leftKey] !== leftIndex[rightKey]) {\n var j = mergeFromLeft(leftKey, rightKey, geom);\n var i = mergeFromRight(leftKey, rightKey, mergedFeatures[j].geometry);\n delete leftIndex[leftKey];\n delete rightIndex[rightKey];\n rightIndex[getKey(text, mergedFeatures[i].geometry, true)] = i;\n mergedFeatures[j].geometry = null;\n } else if (leftKey in rightIndex) {\n mergeFromRight(leftKey, rightKey, geom);\n } else if (rightKey in leftIndex) {\n mergeFromLeft(leftKey, rightKey, geom);\n } else {\n add2(k);\n leftIndex[leftKey] = mergedIndex - 1;\n rightIndex[rightKey] = mergedIndex - 1;\n }\n }\n return mergedFeatures.filter(function(f) {\n return f.geometry;\n });\n }\n var verticalizedCharacterMap = {\n \"!\": \"\\uFE15\",\n \"#\": \"\\uFF03\",\n \"$\": \"\\uFF04\",\n \"%\": \"\\uFF05\",\n \"&\": \"\\uFF06\",\n \"(\": \"\\uFE35\",\n \")\": \"\\uFE36\",\n \"*\": \"\\uFF0A\",\n \"+\": \"\\uFF0B\",\n \",\": \"\\uFE10\",\n \"-\": \"\\uFE32\",\n \".\": \"\\u30FB\",\n \"/\": \"\\uFF0F\",\n \":\": \"\\uFE13\",\n \";\": \"\\uFE14\",\n \"<\": \"\\uFE3F\",\n \"=\": \"\\uFF1D\",\n \">\": \"\\uFE40\",\n \"?\": \"\\uFE16\",\n \"@\": \"\\uFF20\",\n \"[\": \"\\uFE47\",\n \"\\\\\": \"\\uFF3C\",\n \"]\": \"\\uFE48\",\n \"^\": \"\\uFF3E\",\n \"_\": \"\\uFE33\",\n \"`\": \"\\uFF40\",\n \"{\": \"\\uFE37\",\n \"|\": \"\\u2015\",\n \"}\": \"\\uFE38\",\n \"~\": \"\\uFF5E\",\n \"\\xA2\": \"\\uFFE0\",\n \"\\xA3\": \"\\uFFE1\",\n \"\\xA5\": \"\\uFFE5\",\n \"\\xA6\": \"\\uFFE4\",\n \"\\xAC\": \"\\uFFE2\",\n \"\\xAF\": \"\\uFFE3\",\n \"\\u2013\": \"\\uFE32\",\n \"\\u2014\": \"\\uFE31\",\n \"\\u2018\": \"\\uFE43\",\n \"\\u2019\": \"\\uFE44\",\n \"\\u201C\": \"\\uFE41\",\n \"\\u201D\": \"\\uFE42\",\n \"\\u2026\": \"\\uFE19\",\n \"\\u2027\": \"\\u30FB\",\n \"\\u20A9\": \"\\uFFE6\",\n \"\\u3001\": \"\\uFE11\",\n \"\\u3002\": \"\\uFE12\",\n \"\\u3008\": \"\\uFE3F\",\n \"\\u3009\": \"\\uFE40\",\n \"\\u300A\": \"\\uFE3D\",\n \"\\u300B\": \"\\uFE3E\",\n \"\\u300C\": \"\\uFE41\",\n \"\\u300D\": \"\\uFE42\",\n \"\\u300E\": \"\\uFE43\",\n \"\\u300F\": \"\\uFE44\",\n \"\\u3010\": \"\\uFE3B\",\n \"\\u3011\": \"\\uFE3C\",\n \"\\u3014\": \"\\uFE39\",\n \"\\u3015\": \"\\uFE3A\",\n \"\\u3016\": \"\\uFE17\",\n \"\\u3017\": \"\\uFE18\",\n \"\\uFF01\": \"\\uFE15\",\n \"\\uFF08\": \"\\uFE35\",\n \"\\uFF09\": \"\\uFE36\",\n \"\\uFF0C\": \"\\uFE10\",\n \"\\uFF0D\": \"\\uFE32\",\n \"\\uFF0E\": \"\\u30FB\",\n \"\\uFF1A\": \"\\uFE13\",\n \"\\uFF1B\": \"\\uFE14\",\n \"\\uFF1C\": \"\\uFE3F\",\n \"\\uFF1E\": \"\\uFE40\",\n \"\\uFF1F\": \"\\uFE16\",\n \"\\uFF3B\": \"\\uFE47\",\n \"\\uFF3D\": \"\\uFE48\",\n \"\\uFF3F\": \"\\uFE33\",\n \"\\uFF5B\": \"\\uFE37\",\n \"\\uFF5C\": \"\\u2015\",\n \"\\uFF5D\": \"\\uFE38\",\n \"\\uFF5F\": \"\\uFE35\",\n \"\\uFF60\": \"\\uFE36\",\n \"\\uFF61\": \"\\uFE12\",\n \"\\uFF62\": \"\\uFE41\",\n \"\\uFF63\": \"\\uFE42\"\n };\n function verticalizePunctuation(input) {\n var output = \"\";\n for (var i = 0; i < input.length; i++) {\n var nextCharCode = input.charCodeAt(i + 1) || null;\n var prevCharCode = input.charCodeAt(i - 1) || null;\n var canReplacePunctuation = (!nextCharCode || !charHasRotatedVerticalOrientation(nextCharCode) || verticalizedCharacterMap[input[i + 1]]) && (!prevCharCode || !charHasRotatedVerticalOrientation(prevCharCode) || verticalizedCharacterMap[input[i - 1]]);\n if (canReplacePunctuation && verticalizedCharacterMap[input[i]]) {\n output += verticalizedCharacterMap[input[i]];\n } else {\n output += input[i];\n }\n }\n return output;\n }\n var ONE_EM = 24;\n var 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 i += d;\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 var 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 value = Math.abs(value);\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 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 for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {\n }\n e = e << mLen | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {\n }\n buffer[offset + i - d] |= s * 128;\n };\n var ieee754 = {\n read,\n write\n };\n var pbf = Pbf;\n function 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 Pbf.Varint = 0;\n Pbf.Fixed64 = 1;\n Pbf.Bytes = 2;\n Pbf.Fixed32 = 5;\n var SHIFT_LEFT_32 = (1 << 16) * (1 << 16), SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;\n var TEXT_DECODER_MIN_LENGTH = 12;\n var utf8TextDecoder = typeof TextDecoder === \"undefined\" ? null : new TextDecoder(\"utf8\");\n Pbf.prototype = {\n destroy: function() {\n this.buf = null;\n },\n readFields: function(readField, result, end) {\n end = end || this.length;\n while (this.pos < end) {\n var val = this.readVarint(), tag = val >> 3, startPos = this.pos;\n this.type = val & 7;\n readField(tag, result, this);\n if (this.pos === startPos) {\n this.skip(val);\n }\n }\n return result;\n },\n readMessage: function(readField, result) {\n return this.readFields(readField, result, this.readVarint() + this.pos);\n },\n readFixed32: function() {\n var val = readUInt32(this.buf, this.pos);\n this.pos += 4;\n return val;\n },\n readSFixed32: function() {\n var val = readInt32(this.buf, this.pos);\n this.pos += 4;\n return val;\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 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 readFloat: function() {\n var val = ieee754.read(this.buf, this.pos, true, 23, 4);\n this.pos += 4;\n return val;\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 readVarint: function(isSigned) {\n var buf = this.buf, val, b;\n b = buf[this.pos++];\n val = b & 127;\n if (b < 128) {\n return val;\n }\n b = buf[this.pos++];\n val |= (b & 127) << 7;\n if (b < 128) {\n return val;\n }\n b = buf[this.pos++];\n val |= (b & 127) << 14;\n if (b < 128) {\n return val;\n }\n b = buf[this.pos++];\n val |= (b & 127) << 21;\n if (b < 128) {\n return val;\n }\n b = buf[this.pos];\n val |= (b & 15) << 28;\n return readVarintRemainder(val, isSigned, this);\n },\n readVarint64: function() {\n return this.readVarint(true);\n },\n readSVarint: function() {\n var num = this.readVarint();\n return num % 2 === 1 ? (num + 1) / -2 : num / 2;\n },\n readBoolean: function() {\n return Boolean(this.readVarint());\n },\n readString: function() {\n var end = this.readVarint() + this.pos;\n var pos = this.pos;\n this.pos = end;\n if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {\n return readUtf8TextDecoder(this.buf, pos, end);\n }\n return readUtf8(this.buf, pos, end);\n },\n readBytes: function() {\n var end = this.readVarint() + this.pos, buffer = this.buf.subarray(this.pos, end);\n this.pos = end;\n return buffer;\n },\n readPackedVarint: function(arr, isSigned) {\n if (this.type !== Pbf.Bytes) {\n return arr.push(this.readVarint(isSigned));\n }\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) {\n arr.push(this.readVarint(isSigned));\n }\n return arr;\n },\n readPackedSVarint: function(arr) {\n if (this.type !== Pbf.Bytes) {\n return arr.push(this.readSVarint());\n }\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) {\n arr.push(this.readSVarint());\n }\n return arr;\n },\n readPackedBoolean: function(arr) {\n if (this.type !== Pbf.Bytes) {\n return arr.push(this.readBoolean());\n }\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) {\n arr.push(this.readBoolean());\n }\n return arr;\n },\n readPackedFloat: function(arr) {\n if (this.type !== Pbf.Bytes) {\n return arr.push(this.readFloat());\n }\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) {\n arr.push(this.readFloat());\n }\n return arr;\n },\n readPackedDouble: function(arr) {\n if (this.type !== Pbf.Bytes) {\n return arr.push(this.readDouble());\n }\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) {\n arr.push(this.readDouble());\n }\n return arr;\n },\n readPackedFixed32: function(arr) {\n if (this.type !== Pbf.Bytes) {\n return arr.push(this.readFixed32());\n }\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) {\n arr.push(this.readFixed32());\n }\n return arr;\n },\n readPackedSFixed32: function(arr) {\n if (this.type !== Pbf.Bytes) {\n return arr.push(this.readSFixed32());\n }\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) {\n arr.push(this.readSFixed32());\n }\n return arr;\n },\n readPackedFixed64: function(arr) {\n if (this.type !== Pbf.Bytes) {\n return arr.push(this.readFixed64());\n }\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) {\n arr.push(this.readFixed64());\n }\n return arr;\n },\n readPackedSFixed64: function(arr) {\n if (this.type !== Pbf.Bytes) {\n return arr.push(this.readSFixed64());\n }\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) {\n arr.push(this.readSFixed64());\n }\n return arr;\n },\n skip: function(val) {\n var type = val & 7;\n if (type === Pbf.Varint) {\n while (this.buf[this.pos++] > 127) {\n }\n } else if (type === Pbf.Bytes) {\n this.pos = this.readVarint() + this.pos;\n } else if (type === Pbf.Fixed32) {\n this.pos += 4;\n } else if (type === Pbf.Fixed64) {\n this.pos += 8;\n } else {\n throw new Error(\"Unimplemented type: \" + type);\n }\n },\n writeTag: function(tag, type) {\n this.writeVarint(tag << 3 | type);\n },\n realloc: function(min) {\n var length = this.length || 16;\n while (length < this.pos + min) {\n 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 finish: function() {\n this.length = this.pos;\n this.pos = 0;\n return this.buf.subarray(0, this.length);\n },\n writeFixed32: function(val) {\n this.realloc(4);\n writeInt32(this.buf, val, this.pos);\n this.pos += 4;\n },\n writeSFixed32: function(val) {\n this.realloc(4);\n writeInt32(this.buf, val, this.pos);\n this.pos += 4;\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 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 writeVarint: function(val) {\n val = +val || 0;\n if (val > 268435455 || val < 0) {\n writeBigVarint(val, this);\n return;\n }\n this.realloc(4);\n this.buf[this.pos++] = val & 127 | (val > 127 ? 128 : 0);\n if (val <= 127) {\n return;\n }\n this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);\n if (val <= 127) {\n return;\n }\n this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);\n if (val <= 127) {\n return;\n }\n this.buf[this.pos++] = val >>> 7 & 127;\n },\n writeSVarint: function(val) {\n this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);\n },\n writeBoolean: function(val) {\n this.writeVarint(Boolean(val));\n },\n writeString: function(str) {\n str = String(str);\n this.realloc(str.length * 4);\n this.pos++;\n var startPos = this.pos;\n this.pos = writeUtf8(this.buf, str, this.pos);\n var len = this.pos - startPos;\n if (len >= 128) {\n makeRoomForExtraLength(startPos, len, this);\n }\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\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 writeDouble: function(val) {\n this.realloc(8);\n ieee754.write(this.buf, val, this.pos, true, 52, 8);\n this.pos += 8;\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++) {\n this.buf[this.pos++] = buffer[i];\n }\n },\n writeRawMessage: function(fn, obj) {\n this.pos++;\n var startPos = this.pos;\n fn(obj, this);\n var len = this.pos - startPos;\n if (len >= 128) {\n makeRoomForExtraLength(startPos, len, this);\n }\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\n },\n writeMessage: function(tag, fn, obj) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeRawMessage(fn, obj);\n },\n writePackedVarint: function(tag, arr) {\n if (arr.length) {\n this.writeMessage(tag, writePackedVarint, arr);\n }\n },\n writePackedSVarint: function(tag, arr) {\n if (arr.length) {\n this.writeMessage(tag, writePackedSVarint, arr);\n }\n },\n writePackedBoolean: function(tag, arr) {\n if (arr.length) {\n this.writeMessage(tag, writePackedBoolean, arr);\n }\n },\n writePackedFloat: function(tag, arr) {\n if (arr.length) {\n this.writeMessage(tag, writePackedFloat, arr);\n }\n },\n writePackedDouble: function(tag, arr) {\n if (arr.length) {\n this.writeMessage(tag, writePackedDouble, arr);\n }\n },\n writePackedFixed32: function(tag, arr) {\n if (arr.length) {\n this.writeMessage(tag, writePackedFixed32, arr);\n }\n },\n writePackedSFixed32: function(tag, arr) {\n if (arr.length) {\n this.writeMessage(tag, writePackedSFixed32, arr);\n }\n },\n writePackedFixed64: function(tag, arr) {\n if (arr.length) {\n this.writeMessage(tag, writePackedFixed64, arr);\n }\n },\n writePackedSFixed64: function(tag, arr) {\n if (arr.length) {\n this.writeMessage(tag, writePackedSFixed64, arr);\n }\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 function readVarintRemainder(l, s, p) {\n var buf = p.buf, h, b;\n b = buf[p.pos++];\n h = (b & 112) >> 4;\n if (b < 128) {\n return toNum(l, h, s);\n }\n b = buf[p.pos++];\n h |= (b & 127) << 3;\n if (b < 128) {\n return toNum(l, h, s);\n }\n b = buf[p.pos++];\n h |= (b & 127) << 10;\n if (b < 128) {\n return toNum(l, h, s);\n }\n b = buf[p.pos++];\n h |= (b & 127) << 17;\n if (b < 128) {\n return toNum(l, h, s);\n }\n b = buf[p.pos++];\n h |= (b & 127) << 24;\n if (b < 128) {\n return toNum(l, h, s);\n }\n b = buf[p.pos++];\n h |= (b & 1) << 31;\n if (b < 128) {\n return toNum(l, h, s);\n }\n throw new Error(\"Expected varint not more than 10 bytes\");\n }\n function readPackedEnd(pbf2) {\n return pbf2.type === Pbf.Bytes ? pbf2.readVarint() + pbf2.pos : pbf2.pos + 1;\n }\n function toNum(low, high, isSigned) {\n if (isSigned) {\n return high * 4294967296 + (low >>> 0);\n }\n return (high >>> 0) * 4294967296 + (low >>> 0);\n }\n function writeBigVarint(val, pbf2) {\n var low, high;\n if (val >= 0) {\n low = val % 4294967296 | 0;\n high = val / 4294967296 | 0;\n } else {\n low = ~(-val % 4294967296);\n high = ~(-val / 4294967296);\n if (low ^ 4294967295) {\n low = low + 1 | 0;\n } else {\n low = 0;\n high = high + 1 | 0;\n }\n }\n if (val >= 18446744073709552e3 || val < -18446744073709552e3) {\n throw new Error(\"Given varint doesn't fit into 10 bytes\");\n }\n pbf2.realloc(10);\n writeBigVarintLow(low, high, pbf2);\n writeBigVarintHigh(high, pbf2);\n }\n function writeBigVarintLow(low, high, pbf2) {\n pbf2.buf[pbf2.pos++] = low & 127 | 128;\n low >>>= 7;\n pbf2.buf[pbf2.pos++] = low & 127 | 128;\n low >>>= 7;\n pbf2.buf[pbf2.pos++] = low & 127 | 128;\n low >>>= 7;\n pbf2.buf[pbf2.pos++] = low & 127 | 128;\n low >>>= 7;\n pbf2.buf[pbf2.pos] = low & 127;\n }\n function writeBigVarintHigh(high, pbf2) {\n var lsb = (high & 7) << 4;\n pbf2.buf[pbf2.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);\n if (!high) {\n return;\n }\n pbf2.buf[pbf2.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);\n if (!high) {\n return;\n }\n pbf2.buf[pbf2.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);\n if (!high) {\n return;\n }\n pbf2.buf[pbf2.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);\n if (!high) {\n return;\n }\n pbf2.buf[pbf2.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);\n if (!high) {\n return;\n }\n pbf2.buf[pbf2.pos++] = high & 127;\n }\n function makeRoomForExtraLength(startPos, len, pbf2) {\n var extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));\n pbf2.realloc(extraLen);\n for (var i = pbf2.pos - 1; i >= startPos; i--) {\n pbf2.buf[i + extraLen] = pbf2.buf[i];\n }\n }\n function writePackedVarint(arr, pbf2) {\n for (var i = 0; i < arr.length; i++) {\n pbf2.writeVarint(arr[i]);\n }\n }\n function writePackedSVarint(arr, pbf2) {\n for (var i = 0; i < arr.length; i++) {\n pbf2.writeSVarint(arr[i]);\n }\n }\n function writePackedFloat(arr, pbf2) {\n for (var i = 0; i < arr.length; i++) {\n pbf2.writeFloat(arr[i]);\n }\n }\n function writePackedDouble(arr, pbf2) {\n for (var i = 0; i < arr.length; i++) {\n pbf2.writeDouble(arr[i]);\n }\n }\n function writePackedBoolean(arr, pbf2) {\n for (var i = 0; i < arr.length; i++) {\n pbf2.writeBoolean(arr[i]);\n }\n }\n function writePackedFixed32(arr, pbf2) {\n for (var i = 0; i < arr.length; i++) {\n pbf2.writeFixed32(arr[i]);\n }\n }\n function writePackedSFixed32(arr, pbf2) {\n for (var i = 0; i < arr.length; i++) {\n pbf2.writeSFixed32(arr[i]);\n }\n }\n function writePackedFixed64(arr, pbf2) {\n for (var i = 0; i < arr.length; i++) {\n pbf2.writeFixed64(arr[i]);\n }\n }\n function writePackedSFixed64(arr, pbf2) {\n for (var i = 0; i < arr.length; i++) {\n pbf2.writeSFixed64(arr[i]);\n }\n }\n function readUInt32(buf, pos) {\n return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + buf[pos + 3] * 16777216;\n }\n function 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 function readInt32(buf, pos) {\n return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + (buf[pos + 3] << 24);\n }\n function readUtf8(buf, pos, end) {\n var str = \"\";\n var i = pos;\n while (i < end) {\n var b0 = buf[i];\n var c = null;\n var bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;\n if (i + bytesPerSequence > end) {\n break;\n }\n var b1, b2, b3;\n if (bytesPerSequence === 1) {\n if (b0 < 128) {\n c = b0;\n }\n } else if (bytesPerSequence === 2) {\n b1 = buf[i + 1];\n if ((b1 & 192) === 128) {\n c = (b0 & 31) << 6 | b1 & 63;\n if (c <= 127) {\n c = null;\n }\n }\n } else if (bytesPerSequence === 3) {\n b1 = buf[i + 1];\n b2 = buf[i + 2];\n if ((b1 & 192) === 128 && (b2 & 192) === 128) {\n c = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;\n if (c <= 2047 || c >= 55296 && c <= 57343) {\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 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {\n c = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;\n if (c <= 65535 || c >= 1114112) {\n c = null;\n }\n }\n }\n if (c === null) {\n c = 65533;\n bytesPerSequence = 1;\n } else if (c > 65535) {\n c -= 65536;\n str += String.fromCharCode(c >>> 10 & 1023 | 55296);\n c = 56320 | c & 1023;\n }\n str += String.fromCharCode(c);\n i += bytesPerSequence;\n }\n return str;\n }\n function readUtf8TextDecoder(buf, pos, end) {\n return utf8TextDecoder.decode(buf.subarray(pos, end));\n }\n function writeUtf8(buf, str, pos) {\n for (var i = 0, c, lead; i < str.length; i++) {\n c = str.charCodeAt(i);\n if (c > 55295 && c < 57344) {\n if (lead) {\n if (c < 56320) {\n buf[pos++] = 239;\n buf[pos++] = 191;\n buf[pos++] = 189;\n lead = c;\n continue;\n } else {\n c = lead - 55296 << 10 | c - 56320 | 65536;\n lead = null;\n }\n } else {\n if (c > 56319 || i + 1 === str.length) {\n buf[pos++] = 239;\n buf[pos++] = 191;\n buf[pos++] = 189;\n } else {\n lead = c;\n }\n continue;\n }\n } else if (lead) {\n buf[pos++] = 239;\n buf[pos++] = 191;\n buf[pos++] = 189;\n lead = null;\n }\n if (c < 128) {\n buf[pos++] = c;\n } else {\n if (c < 2048) {\n buf[pos++] = c >> 6 | 192;\n } else {\n if (c < 65536) {\n buf[pos++] = c >> 12 | 224;\n } else {\n buf[pos++] = c >> 18 | 240;\n buf[pos++] = c >> 12 & 63 | 128;\n }\n buf[pos++] = c >> 6 & 63 | 128;\n }\n buf[pos++] = c & 63 | 128;\n }\n }\n return pos;\n }\n var border = 3;\n function readFontstacks(tag, glyphs, pbf2) {\n if (tag === 1) {\n pbf2.readMessage(readFontstack, glyphs);\n }\n }\n function readFontstack(tag, glyphs, pbf2) {\n if (tag === 3) {\n var ref = pbf2.readMessage(readGlyph, {});\n var id2 = ref.id;\n var bitmap = ref.bitmap;\n var width = ref.width;\n var height = ref.height;\n var left = ref.left;\n var top = ref.top;\n var advance = ref.advance;\n glyphs.push({\n id: id2,\n bitmap: new AlphaImage({\n width: width + 2 * border,\n height: height + 2 * border\n }, bitmap),\n metrics: {\n width,\n height,\n left,\n top,\n advance\n }\n });\n }\n }\n function readGlyph(tag, glyph, pbf2) {\n if (tag === 1) {\n glyph.id = pbf2.readVarint();\n } else if (tag === 2) {\n glyph.bitmap = pbf2.readBytes();\n } else if (tag === 3) {\n glyph.width = pbf2.readVarint();\n } else if (tag === 4) {\n glyph.height = pbf2.readVarint();\n } else if (tag === 5) {\n glyph.left = pbf2.readSVarint();\n } else if (tag === 6) {\n glyph.top = pbf2.readSVarint();\n } else if (tag === 7) {\n glyph.advance = pbf2.readVarint();\n }\n }\n function parseGlyphPBF(data) {\n return new pbf(data).readFields(readFontstacks, []);\n }\n var GLYPH_PBF_BORDER = border;\n function potpack(boxes) {\n var area2 = 0;\n var maxWidth = 0;\n for (var i$1 = 0, list = boxes; i$1 < list.length; i$1 += 1) {\n var box = list[i$1];\n area2 += box.w * box.h;\n maxWidth = Math.max(maxWidth, box.w);\n }\n boxes.sort(function(a, b) {\n return b.h - a.h;\n });\n var startWidth = Math.max(Math.ceil(Math.sqrt(area2 / 0.95)), maxWidth);\n var spaces = [{ x: 0, y: 0, w: startWidth, h: Infinity }];\n var width = 0;\n var height = 0;\n for (var i$2 = 0, list$1 = boxes; i$2 < list$1.length; i$2 += 1) {\n var box$1 = list$1[i$2];\n for (var i = spaces.length - 1; i >= 0; i--) {\n var space = spaces[i];\n if (box$1.w > space.w || box$1.h > space.h) {\n continue;\n }\n box$1.x = space.x;\n box$1.y = space.y;\n height = Math.max(height, box$1.y + box$1.h);\n width = Math.max(width, box$1.x + box$1.w);\n if (box$1.w === space.w && box$1.h === space.h) {\n var last = spaces.pop();\n if (i < spaces.length) {\n spaces[i] = last;\n }\n } else if (box$1.h === space.h) {\n space.x += box$1.w;\n space.w -= box$1.w;\n } else if (box$1.w === space.w) {\n space.y += box$1.h;\n space.h -= box$1.h;\n } else {\n spaces.push({\n x: space.x + box$1.w,\n y: space.y,\n w: space.w - box$1.w,\n h: box$1.h\n });\n space.y += box$1.h;\n space.h -= box$1.h;\n }\n break;\n }\n }\n return {\n w: width,\n // container width\n h: height,\n // container height\n fill: area2 / (width * height) || 0\n // space utilization\n };\n }\n var IMAGE_PADDING = 1;\n var ImagePosition = function ImagePosition2(paddedRect, ref) {\n var pixelRatio = ref.pixelRatio;\n var version2 = ref.version;\n var stretchX = ref.stretchX;\n var stretchY = ref.stretchY;\n var content = ref.content;\n this.paddedRect = paddedRect;\n this.pixelRatio = pixelRatio;\n this.stretchX = stretchX;\n this.stretchY = stretchY;\n this.content = content;\n this.version = version2;\n };\n var prototypeAccessors = {\n tl: { configurable: true },\n br: { configurable: true },\n tlbr: { configurable: true },\n displaySize: { configurable: true }\n };\n prototypeAccessors.tl.get = function() {\n return [\n this.paddedRect.x + IMAGE_PADDING,\n this.paddedRect.y + IMAGE_PADDING\n ];\n };\n prototypeAccessors.br.get = function() {\n return [\n this.paddedRect.x + this.paddedRect.w - IMAGE_PADDING,\n this.paddedRect.y + this.paddedRect.h - IMAGE_PADDING\n ];\n };\n prototypeAccessors.tlbr.get = function() {\n return this.tl.concat(this.br);\n };\n prototypeAccessors.displaySize.get = function() {\n return [\n (this.paddedRect.w - IMAGE_PADDING * 2) / this.pixelRatio,\n (this.paddedRect.h - IMAGE_PADDING * 2) / this.pixelRatio\n ];\n };\n Object.defineProperties(ImagePosition.prototype, prototypeAccessors);\n var ImageAtlas = function ImageAtlas2(icons, patterns) {\n var iconPositions = {}, patternPositions = {};\n this.haveRenderCallbacks = [];\n var bins = [];\n this.addImages(icons, iconPositions, bins);\n this.addImages(patterns, patternPositions, bins);\n var ref = potpack(bins);\n var w = ref.w;\n var h = ref.h;\n var image = new RGBAImage({\n width: w || 1,\n height: h || 1\n });\n for (var id2 in icons) {\n var src = icons[id2];\n var bin = iconPositions[id2].paddedRect;\n RGBAImage.copy(src.data, image, {\n x: 0,\n y: 0\n }, {\n x: bin.x + IMAGE_PADDING,\n y: bin.y + IMAGE_PADDING\n }, src.data);\n }\n for (var id$1 in patterns) {\n var src$1 = patterns[id$1];\n var bin$1 = patternPositions[id$1].paddedRect;\n var x = bin$1.x + IMAGE_PADDING, y = bin$1.y + IMAGE_PADDING, w$1 = src$1.data.width, h$1 = src$1.data.height;\n RGBAImage.copy(src$1.data, image, {\n x: 0,\n y: 0\n }, {\n x,\n y\n }, src$1.data);\n RGBAImage.copy(src$1.data, image, {\n x: 0,\n y: h$1 - 1\n }, {\n x,\n y: y - 1\n }, {\n width: w$1,\n height: 1\n });\n RGBAImage.copy(src$1.data, image, {\n x: 0,\n y: 0\n }, {\n x,\n y: y + h$1\n }, {\n width: w$1,\n height: 1\n });\n RGBAImage.copy(src$1.data, image, {\n x: w$1 - 1,\n y: 0\n }, {\n x: x - 1,\n y\n }, {\n width: 1,\n height: h$1\n });\n RGBAImage.copy(src$1.data, image, {\n x: 0,\n y: 0\n }, {\n x: x + w$1,\n y\n }, {\n width: 1,\n height: h$1\n });\n }\n this.image = image;\n this.iconPositions = iconPositions;\n this.patternPositions = patternPositions;\n };\n ImageAtlas.prototype.addImages = function addImages(images, positions, bins) {\n for (var id2 in images) {\n var src = images[id2];\n var bin = {\n x: 0,\n y: 0,\n w: src.data.width + 2 * IMAGE_PADDING,\n h: src.data.height + 2 * IMAGE_PADDING\n };\n bins.push(bin);\n positions[id2] = new ImagePosition(bin, src);\n if (src.hasRenderCallback) {\n this.haveRenderCallbacks.push(id2);\n }\n }\n };\n ImageAtlas.prototype.patchUpdatedImages = function patchUpdatedImages(imageManager, texture) {\n imageManager.dispatchRenderCallbacks(this.haveRenderCallbacks);\n for (var name3 in imageManager.updatedImages) {\n this.patchUpdatedImage(this.iconPositions[name3], imageManager.getImage(name3), texture);\n this.patchUpdatedImage(this.patternPositions[name3], imageManager.getImage(name3), texture);\n }\n };\n ImageAtlas.prototype.patchUpdatedImage = function patchUpdatedImage(position, image, texture) {\n if (!position || !image) {\n return;\n }\n if (position.version === image.version) {\n return;\n }\n position.version = image.version;\n var ref = position.tl;\n var x = ref[0];\n var y = ref[1];\n texture.update(image.data, void 0, {\n x,\n y\n });\n };\n register(\"ImagePosition\", ImagePosition);\n register(\"ImageAtlas\", ImageAtlas);\n var WritingMode = {\n horizontal: 1,\n vertical: 2,\n horizontalOnly: 3\n };\n var SHAPING_DEFAULT_OFFSET = -17;\n function isEmpty(positionedLines) {\n for (var i = 0, list = positionedLines; i < list.length; i += 1) {\n var line = list[i];\n if (line.positionedGlyphs.length !== 0) {\n return false;\n }\n }\n return true;\n }\n var PUAbegin = 57344;\n var PUAend = 63743;\n var SectionOptions = function SectionOptions2() {\n this.scale = 1;\n this.fontStack = \"\";\n this.imageName = null;\n };\n SectionOptions.forText = function forText(scale2, fontStack) {\n var textOptions = new SectionOptions();\n textOptions.scale = scale2 || 1;\n textOptions.fontStack = fontStack;\n return textOptions;\n };\n SectionOptions.forImage = function forImage(imageName) {\n var imageOptions = new SectionOptions();\n imageOptions.imageName = imageName;\n return imageOptions;\n };\n var TaggedString = function TaggedString2() {\n this.text = \"\";\n this.sectionIndex = [];\n this.sections = [];\n this.imageSectionID = null;\n };\n TaggedString.fromFeature = function fromFeature(text, defaultFontStack) {\n var result = new TaggedString();\n for (var i = 0; i < text.sections.length; i++) {\n var section = text.sections[i];\n if (!section.image) {\n result.addTextSection(section, defaultFontStack);\n } else {\n result.addImageSection(section);\n }\n }\n return result;\n };\n TaggedString.prototype.length = function length() {\n return this.text.length;\n };\n TaggedString.prototype.getSection = function getSection(index) {\n return this.sections[this.sectionIndex[index]];\n };\n TaggedString.prototype.getSectionIndex = function getSectionIndex(index) {\n return this.sectionIndex[index];\n };\n TaggedString.prototype.getCharCode = function getCharCode(index) {\n return this.text.charCodeAt(index);\n };\n TaggedString.prototype.verticalizePunctuation = function verticalizePunctuation$1() {\n this.text = verticalizePunctuation(this.text);\n };\n TaggedString.prototype.trim = function trim() {\n var beginningWhitespace = 0;\n for (var i = 0; i < this.text.length && whitespace[this.text.charCodeAt(i)]; i++) {\n beginningWhitespace++;\n }\n var trailingWhitespace = this.text.length;\n for (var i$1 = this.text.length - 1; i$1 >= 0 && i$1 >= beginningWhitespace && whitespace[this.text.charCodeAt(i$1)]; i$1--) {\n trailingWhitespace--;\n }\n this.text = this.text.substring(beginningWhitespace, trailingWhitespace);\n this.sectionIndex = this.sectionIndex.slice(beginningWhitespace, trailingWhitespace);\n };\n TaggedString.prototype.substring = function substring(start, end) {\n var substring2 = new TaggedString();\n substring2.text = this.text.substring(start, end);\n substring2.sectionIndex = this.sectionIndex.slice(start, end);\n substring2.sections = this.sections;\n return substring2;\n };\n TaggedString.prototype.toString = function toString2() {\n return this.text;\n };\n TaggedString.prototype.getMaxScale = function getMaxScale() {\n var this$1 = this;\n return this.sectionIndex.reduce(function(max, index) {\n return Math.max(max, this$1.sections[index].scale);\n }, 0);\n };\n TaggedString.prototype.addTextSection = function addTextSection(section, defaultFontStack) {\n this.text += section.text;\n this.sections.push(SectionOptions.forText(section.scale, section.fontStack || defaultFontStack));\n var index = this.sections.length - 1;\n for (var i = 0; i < section.text.length; ++i) {\n this.sectionIndex.push(index);\n }\n };\n TaggedString.prototype.addImageSection = function addImageSection(section) {\n var imageName = section.image ? section.image.name : \"\";\n if (imageName.length === 0) {\n warnOnce(\"Can't add FormattedSection with an empty image.\");\n return;\n }\n var nextImageSectionCharCode = this.getNextImageSectionCharCode();\n if (!nextImageSectionCharCode) {\n warnOnce(\"Reached maximum number of images \" + (PUAend - PUAbegin + 2));\n return;\n }\n this.text += String.fromCharCode(nextImageSectionCharCode);\n this.sections.push(SectionOptions.forImage(imageName));\n this.sectionIndex.push(this.sections.length - 1);\n };\n TaggedString.prototype.getNextImageSectionCharCode = function getNextImageSectionCharCode() {\n if (!this.imageSectionID) {\n this.imageSectionID = PUAbegin;\n return this.imageSectionID;\n }\n if (this.imageSectionID >= PUAend) {\n return null;\n }\n return ++this.imageSectionID;\n };\n function breakLines(input, lineBreakPoints) {\n var lines = [];\n var text = input.text;\n var start = 0;\n for (var i = 0, list = lineBreakPoints; i < list.length; i += 1) {\n var lineBreak = list[i];\n lines.push(input.substring(start, lineBreak));\n start = lineBreak;\n }\n if (start < text.length) {\n lines.push(input.substring(start, text.length));\n }\n return lines;\n }\n function shapeText(text, glyphMap, glyphPositions, imagePositions, defaultFontStack, maxWidth, lineHeight, textAnchor, textJustify, spacing, translate2, writingMode, allowVerticalPlacement, symbolPlacement, layoutTextSize, layoutTextSizeThisZoom) {\n var logicalInput = TaggedString.fromFeature(text, defaultFontStack);\n if (writingMode === WritingMode.vertical) {\n logicalInput.verticalizePunctuation();\n }\n var lines;\n var processBidirectionalText = plugin.processBidirectionalText;\n var processStyledBidirectionalText = plugin.processStyledBidirectionalText;\n if (processBidirectionalText && logicalInput.sections.length === 1) {\n lines = [];\n var untaggedLines = processBidirectionalText(logicalInput.toString(), determineLineBreaks(logicalInput, spacing, maxWidth, glyphMap, imagePositions, symbolPlacement, layoutTextSize));\n for (var i$1 = 0, list = untaggedLines; i$1 < list.length; i$1 += 1) {\n var line = list[i$1];\n var taggedLine = new TaggedString();\n taggedLine.text = line;\n taggedLine.sections = logicalInput.sections;\n for (var i = 0; i < line.length; i++) {\n taggedLine.sectionIndex.push(0);\n }\n lines.push(taggedLine);\n }\n } else if (processStyledBidirectionalText) {\n lines = [];\n var processedLines = processStyledBidirectionalText(logicalInput.text, logicalInput.sectionIndex, determineLineBreaks(logicalInput, spacing, maxWidth, glyphMap, imagePositions, symbolPlacement, layoutTextSize));\n for (var i$2 = 0, list$1 = processedLines; i$2 < list$1.length; i$2 += 1) {\n var line$1 = list$1[i$2];\n var taggedLine$1 = new TaggedString();\n taggedLine$1.text = line$1[0];\n taggedLine$1.sectionIndex = line$1[1];\n taggedLine$1.sections = logicalInput.sections;\n lines.push(taggedLine$1);\n }\n } else {\n lines = breakLines(logicalInput, determineLineBreaks(logicalInput, spacing, maxWidth, glyphMap, imagePositions, symbolPlacement, layoutTextSize));\n }\n var positionedLines = [];\n var shaping = {\n positionedLines,\n text: logicalInput.toString(),\n top: translate2[1],\n bottom: translate2[1],\n left: translate2[0],\n right: translate2[0],\n writingMode,\n iconsInText: false,\n verticalizable: false\n };\n shapeLines(shaping, glyphMap, glyphPositions, imagePositions, lines, lineHeight, textAnchor, textJustify, writingMode, spacing, allowVerticalPlacement, layoutTextSizeThisZoom);\n if (isEmpty(positionedLines)) {\n return false;\n }\n return shaping;\n }\n var whitespace = {};\n whitespace[9] = true;\n whitespace[10] = true;\n whitespace[11] = true;\n whitespace[12] = true;\n whitespace[13] = true;\n whitespace[32] = true;\n var breakable = {};\n breakable[10] = true;\n breakable[32] = true;\n breakable[38] = true;\n breakable[40] = true;\n breakable[41] = true;\n breakable[43] = true;\n breakable[45] = true;\n breakable[47] = true;\n breakable[173] = true;\n breakable[183] = true;\n breakable[8203] = true;\n breakable[8208] = true;\n breakable[8211] = true;\n breakable[8231] = true;\n function getGlyphAdvance(codePoint, section, glyphMap, imagePositions, spacing, layoutTextSize) {\n if (!section.imageName) {\n var positions = glyphMap[section.fontStack];\n var glyph = positions && positions[codePoint];\n if (!glyph) {\n return 0;\n }\n return glyph.metrics.advance * section.scale + spacing;\n } else {\n var imagePosition = imagePositions[section.imageName];\n if (!imagePosition) {\n return 0;\n }\n return imagePosition.displaySize[0] * section.scale * ONE_EM / layoutTextSize + spacing;\n }\n }\n function determineAverageLineWidth(logicalInput, spacing, maxWidth, glyphMap, imagePositions, layoutTextSize) {\n var totalWidth = 0;\n for (var index = 0; index < logicalInput.length(); index++) {\n var section = logicalInput.getSection(index);\n totalWidth += getGlyphAdvance(logicalInput.getCharCode(index), section, glyphMap, imagePositions, spacing, layoutTextSize);\n }\n var lineCount = Math.max(1, Math.ceil(totalWidth / maxWidth));\n return totalWidth / lineCount;\n }\n function calculateBadness(lineWidth, targetWidth, penalty, isLastBreak) {\n var raggedness = Math.pow(lineWidth - targetWidth, 2);\n if (isLastBreak) {\n if (lineWidth < targetWidth) {\n return raggedness / 2;\n } else {\n return raggedness * 2;\n }\n }\n return raggedness + Math.abs(penalty) * penalty;\n }\n function calculatePenalty(codePoint, nextCodePoint, penalizableIdeographicBreak) {\n var penalty = 0;\n if (codePoint === 10) {\n penalty -= 1e4;\n }\n if (penalizableIdeographicBreak) {\n penalty += 150;\n }\n if (codePoint === 40 || codePoint === 65288) {\n penalty += 50;\n }\n if (nextCodePoint === 41 || nextCodePoint === 65289) {\n penalty += 50;\n }\n return penalty;\n }\n function evaluateBreak(breakIndex, breakX, targetWidth, potentialBreaks, penalty, isLastBreak) {\n var bestPriorBreak = null;\n var bestBreakBadness = calculateBadness(breakX, targetWidth, penalty, isLastBreak);\n for (var i = 0, list = potentialBreaks; i < list.length; i += 1) {\n var potentialBreak = list[i];\n var lineWidth = breakX - potentialBreak.x;\n var breakBadness = calculateBadness(lineWidth, targetWidth, penalty, isLastBreak) + potentialBreak.badness;\n if (breakBadness <= bestBreakBadness) {\n bestPriorBreak = potentialBreak;\n bestBreakBadness = breakBadness;\n }\n }\n return {\n index: breakIndex,\n x: breakX,\n priorBreak: bestPriorBreak,\n badness: bestBreakBadness\n };\n }\n function leastBadBreaks(lastLineBreak) {\n if (!lastLineBreak) {\n return [];\n }\n return leastBadBreaks(lastLineBreak.priorBreak).concat(lastLineBreak.index);\n }\n function determineLineBreaks(logicalInput, spacing, maxWidth, glyphMap, imagePositions, symbolPlacement, layoutTextSize) {\n if (symbolPlacement !== \"point\") {\n return [];\n }\n if (!logicalInput) {\n return [];\n }\n var potentialLineBreaks = [];\n var targetWidth = determineAverageLineWidth(logicalInput, spacing, maxWidth, glyphMap, imagePositions, layoutTextSize);\n var hasServerSuggestedBreakpoints = logicalInput.text.indexOf(\"\\u200B\") >= 0;\n var currentX = 0;\n for (var i = 0; i < logicalInput.length(); i++) {\n var section = logicalInput.getSection(i);\n var codePoint = logicalInput.getCharCode(i);\n if (!whitespace[codePoint]) {\n currentX += getGlyphAdvance(codePoint, section, glyphMap, imagePositions, spacing, layoutTextSize);\n }\n if (i < logicalInput.length() - 1) {\n var ideographicBreak = charAllowsIdeographicBreaking(codePoint);\n if (breakable[codePoint] || ideographicBreak || section.imageName) {\n potentialLineBreaks.push(evaluateBreak(i + 1, currentX, targetWidth, potentialLineBreaks, calculatePenalty(codePoint, logicalInput.getCharCode(i + 1), ideographicBreak && hasServerSuggestedBreakpoints), false));\n }\n }\n }\n return leastBadBreaks(evaluateBreak(logicalInput.length(), currentX, targetWidth, potentialLineBreaks, 0, true));\n }\n function getAnchorAlignment(anchor) {\n var horizontalAlign = 0.5, verticalAlign = 0.5;\n switch (anchor) {\n case \"right\":\n case \"top-right\":\n case \"bottom-right\":\n horizontalAlign = 1;\n break;\n case \"left\":\n case \"top-left\":\n case \"bottom-left\":\n horizontalAlign = 0;\n break;\n }\n switch (anchor) {\n case \"bottom\":\n case \"bottom-right\":\n case \"bottom-left\":\n verticalAlign = 1;\n break;\n case \"top\":\n case \"top-right\":\n case \"top-left\":\n verticalAlign = 0;\n break;\n }\n return {\n horizontalAlign,\n verticalAlign\n };\n }\n function shapeLines(shaping, glyphMap, glyphPositions, imagePositions, lines, lineHeight, textAnchor, textJustify, writingMode, spacing, allowVerticalPlacement, layoutTextSizeThisZoom) {\n var x = 0;\n var y = SHAPING_DEFAULT_OFFSET;\n var maxLineLength = 0;\n var maxLineHeight = 0;\n var justify = textJustify === \"right\" ? 1 : textJustify === \"left\" ? 0 : 0.5;\n var lineIndex = 0;\n for (var i$1 = 0, list = lines; i$1 < list.length; i$1 += 1) {\n var line = list[i$1];\n line.trim();\n var lineMaxScale = line.getMaxScale();\n var maxLineOffset = (lineMaxScale - 1) * ONE_EM;\n var positionedLine = {\n positionedGlyphs: [],\n lineOffset: 0\n };\n shaping.positionedLines[lineIndex] = positionedLine;\n var positionedGlyphs = positionedLine.positionedGlyphs;\n var lineOffset = 0;\n if (!line.length()) {\n y += lineHeight;\n ++lineIndex;\n continue;\n }\n for (var i = 0; i < line.length(); i++) {\n var section = line.getSection(i);\n var sectionIndex = line.getSectionIndex(i);\n var codePoint = line.getCharCode(i);\n var baselineOffset2 = 0;\n var metrics = null;\n var rect = null;\n var imageName = null;\n var verticalAdvance = ONE_EM;\n var vertical = !(writingMode === WritingMode.horizontal || !allowVerticalPlacement && !charHasUprightVerticalOrientation(codePoint) || allowVerticalPlacement && (whitespace[codePoint] || charInComplexShapingScript(codePoint)));\n if (!section.imageName) {\n var positions = glyphPositions[section.fontStack];\n var glyphPosition = positions && positions[codePoint];\n if (glyphPosition && glyphPosition.rect) {\n rect = glyphPosition.rect;\n metrics = glyphPosition.metrics;\n } else {\n var glyphs = glyphMap[section.fontStack];\n var glyph = glyphs && glyphs[codePoint];\n if (!glyph) {\n continue;\n }\n metrics = glyph.metrics;\n }\n baselineOffset2 = (lineMaxScale - section.scale) * ONE_EM;\n } else {\n var imagePosition = imagePositions[section.imageName];\n if (!imagePosition) {\n continue;\n }\n imageName = section.imageName;\n shaping.iconsInText = shaping.iconsInText || true;\n rect = imagePosition.paddedRect;\n var size = imagePosition.displaySize;\n section.scale = section.scale * ONE_EM / layoutTextSizeThisZoom;\n metrics = {\n width: size[0],\n height: size[1],\n left: IMAGE_PADDING,\n top: -GLYPH_PBF_BORDER,\n advance: vertical ? size[1] : size[0]\n };\n var imageOffset = ONE_EM - size[1] * section.scale;\n baselineOffset2 = maxLineOffset + imageOffset;\n verticalAdvance = metrics.advance;\n var offset = vertical ? size[0] * section.scale - ONE_EM * lineMaxScale : size[1] * section.scale - ONE_EM * lineMaxScale;\n if (offset > 0 && offset > lineOffset) {\n lineOffset = offset;\n }\n }\n if (!vertical) {\n positionedGlyphs.push({\n glyph: codePoint,\n imageName,\n x,\n y: y + baselineOffset2,\n vertical,\n scale: section.scale,\n fontStack: section.fontStack,\n sectionIndex,\n metrics,\n rect\n });\n x += metrics.advance * section.scale + spacing;\n } else {\n shaping.verticalizable = true;\n positionedGlyphs.push({\n glyph: codePoint,\n imageName,\n x,\n y: y + baselineOffset2,\n vertical,\n scale: section.scale,\n fontStack: section.fontStack,\n sectionIndex,\n metrics,\n rect\n });\n x += verticalAdvance * section.scale + spacing;\n }\n }\n if (positionedGlyphs.length !== 0) {\n var lineLength = x - spacing;\n maxLineLength = Math.max(lineLength, maxLineLength);\n justifyLine(positionedGlyphs, 0, positionedGlyphs.length - 1, justify, lineOffset);\n }\n x = 0;\n var currentLineHeight = lineHeight * lineMaxScale + lineOffset;\n positionedLine.lineOffset = Math.max(lineOffset, maxLineOffset);\n y += currentLineHeight;\n maxLineHeight = Math.max(currentLineHeight, maxLineHeight);\n ++lineIndex;\n }\n var height = y - SHAPING_DEFAULT_OFFSET;\n var ref = getAnchorAlignment(textAnchor);\n var horizontalAlign = ref.horizontalAlign;\n var verticalAlign = ref.verticalAlign;\n align$1(shaping.positionedLines, justify, horizontalAlign, verticalAlign, maxLineLength, maxLineHeight, lineHeight, height, lines.length);\n shaping.top += -verticalAlign * height;\n shaping.bottom = shaping.top + height;\n shaping.left += -horizontalAlign * maxLineLength;\n shaping.right = shaping.left + maxLineLength;\n }\n function justifyLine(positionedGlyphs, start, end, justify, lineOffset) {\n if (!justify && !lineOffset) {\n return;\n }\n var lastPositionedGlyph = positionedGlyphs[end];\n var lastAdvance = lastPositionedGlyph.metrics.advance * lastPositionedGlyph.scale;\n var lineIndent = (positionedGlyphs[end].x + lastAdvance) * justify;\n for (var j = start; j <= end; j++) {\n positionedGlyphs[j].x -= lineIndent;\n positionedGlyphs[j].y += lineOffset;\n }\n }\n function align$1(positionedLines, justify, horizontalAlign, verticalAlign, maxLineLength, maxLineHeight, lineHeight, blockHeight, lineCount) {\n var shiftX = (justify - horizontalAlign) * maxLineLength;\n var shiftY = 0;\n if (maxLineHeight !== lineHeight) {\n shiftY = -blockHeight * verticalAlign - SHAPING_DEFAULT_OFFSET;\n } else {\n shiftY = (-verticalAlign * lineCount + 0.5) * lineHeight;\n }\n for (var i$1 = 0, list$1 = positionedLines; i$1 < list$1.length; i$1 += 1) {\n var line = list$1[i$1];\n for (var i = 0, list = line.positionedGlyphs; i < list.length; i += 1) {\n var positionedGlyph = list[i];\n positionedGlyph.x += shiftX;\n positionedGlyph.y += shiftY;\n }\n }\n }\n function shapeIcon(image, iconOffset, iconAnchor) {\n var ref = getAnchorAlignment(iconAnchor);\n var horizontalAlign = ref.horizontalAlign;\n var verticalAlign = ref.verticalAlign;\n var dx = iconOffset[0];\n var dy = iconOffset[1];\n var x1 = dx - image.displaySize[0] * horizontalAlign;\n var x2 = x1 + image.displaySize[0];\n var y1 = dy - image.displaySize[1] * verticalAlign;\n var y2 = y1 + image.displaySize[1];\n return {\n image,\n top: y1,\n bottom: y2,\n left: x1,\n right: x2\n };\n }\n function fitIconToText(shapedIcon, shapedText, textFit, padding, iconOffset, fontScale) {\n var image = shapedIcon.image;\n var collisionPadding;\n if (image.content) {\n var content = image.content;\n var pixelRatio = image.pixelRatio || 1;\n collisionPadding = [\n content[0] / pixelRatio,\n content[1] / pixelRatio,\n image.displaySize[0] - content[2] / pixelRatio,\n image.displaySize[1] - content[3] / pixelRatio\n ];\n }\n var textLeft = shapedText.left * fontScale;\n var textRight = shapedText.right * fontScale;\n var top, right, bottom, left;\n if (textFit === \"width\" || textFit === \"both\") {\n left = iconOffset[0] + textLeft - padding[3];\n right = iconOffset[0] + textRight + padding[1];\n } else {\n left = iconOffset[0] + (textLeft + textRight - image.displaySize[0]) / 2;\n right = left + image.displaySize[0];\n }\n var textTop = shapedText.top * fontScale;\n var textBottom = shapedText.bottom * fontScale;\n if (textFit === \"height\" || textFit === \"both\") {\n top = iconOffset[1] + textTop - padding[0];\n bottom = iconOffset[1] + textBottom + padding[2];\n } else {\n top = iconOffset[1] + (textTop + textBottom - image.displaySize[1]) / 2;\n bottom = top + image.displaySize[1];\n }\n return {\n image,\n top,\n right,\n bottom,\n left,\n collisionPadding\n };\n }\n var Anchor = function(Point2) {\n function Anchor2(x, y, angle, segment) {\n Point2.call(this, x, y);\n this.angle = angle;\n if (segment !== void 0) {\n this.segment = segment;\n }\n }\n if (Point2)\n Anchor2.__proto__ = Point2;\n Anchor2.prototype = Object.create(Point2 && Point2.prototype);\n Anchor2.prototype.constructor = Anchor2;\n Anchor2.prototype.clone = function clone2() {\n return new Anchor2(this.x, this.y, this.angle, this.segment);\n };\n return Anchor2;\n }(pointGeometry);\n register(\"Anchor\", Anchor);\n var SIZE_PACK_FACTOR = 128;\n function getSizeData(tileZoom, value) {\n var expression2 = value.expression;\n if (expression2.kind === \"constant\") {\n var layoutSize = expression2.evaluate(new EvaluationParameters(tileZoom + 1));\n return {\n kind: \"constant\",\n layoutSize\n };\n } else if (expression2.kind === \"source\") {\n return { kind: \"source\" };\n } else {\n var zoomStops = expression2.zoomStops;\n var interpolationType = expression2.interpolationType;\n var lower = 0;\n while (lower < zoomStops.length && zoomStops[lower] <= tileZoom) {\n lower++;\n }\n lower = Math.max(0, lower - 1);\n var upper = lower;\n while (upper < zoomStops.length && zoomStops[upper] < tileZoom + 1) {\n upper++;\n }\n upper = Math.min(zoomStops.length - 1, upper);\n var minZoom = zoomStops[lower];\n var maxZoom = zoomStops[upper];\n if (expression2.kind === \"composite\") {\n return {\n kind: \"composite\",\n minZoom,\n maxZoom,\n interpolationType\n };\n }\n var minSize = expression2.evaluate(new EvaluationParameters(minZoom));\n var maxSize = expression2.evaluate(new EvaluationParameters(maxZoom));\n return {\n kind: \"camera\",\n minZoom,\n maxZoom,\n minSize,\n maxSize,\n interpolationType\n };\n }\n }\n function evaluateSizeForFeature(sizeData, ref, ref$1) {\n var uSize = ref.uSize;\n var uSizeT = ref.uSizeT;\n var lowerSize = ref$1.lowerSize;\n var upperSize = ref$1.upperSize;\n if (sizeData.kind === \"source\") {\n return lowerSize / SIZE_PACK_FACTOR;\n } else if (sizeData.kind === \"composite\") {\n return number(lowerSize / SIZE_PACK_FACTOR, upperSize / SIZE_PACK_FACTOR, uSizeT);\n }\n return uSize;\n }\n function evaluateSizeForZoom(sizeData, zoom) {\n var uSizeT = 0;\n var uSize = 0;\n if (sizeData.kind === \"constant\") {\n uSize = sizeData.layoutSize;\n } else if (sizeData.kind !== \"source\") {\n var interpolationType = sizeData.interpolationType;\n var minZoom = sizeData.minZoom;\n var maxZoom = sizeData.maxZoom;\n var t = !interpolationType ? 0 : clamp(Interpolate.interpolationFactor(interpolationType, zoom, minZoom, maxZoom), 0, 1);\n if (sizeData.kind === \"camera\") {\n uSize = number(sizeData.minSize, sizeData.maxSize, t);\n } else {\n uSizeT = t;\n }\n }\n return {\n uSizeT,\n uSize\n };\n }\n var symbolSize = /* @__PURE__ */ Object.freeze({\n __proto__: null,\n getSizeData,\n evaluateSizeForFeature,\n evaluateSizeForZoom,\n SIZE_PACK_FACTOR\n });\n function checkMaxAngle(line, anchor, labelLength, windowSize, maxAngle) {\n if (anchor.segment === void 0) {\n return true;\n }\n var p = anchor;\n var index = anchor.segment + 1;\n var anchorDistance = 0;\n while (anchorDistance > -labelLength / 2) {\n index--;\n if (index < 0) {\n return false;\n }\n anchorDistance -= line[index].dist(p);\n p = line[index];\n }\n anchorDistance += line[index].dist(line[index + 1]);\n index++;\n var recentCorners = [];\n var recentAngleDelta = 0;\n while (anchorDistance < labelLength / 2) {\n var prev = line[index - 1];\n var current = line[index];\n var next = line[index + 1];\n if (!next) {\n return false;\n }\n var angleDelta = prev.angleTo(current) - current.angleTo(next);\n angleDelta = Math.abs((angleDelta + 3 * Math.PI) % (Math.PI * 2) - Math.PI);\n recentCorners.push({\n distance: anchorDistance,\n angleDelta\n });\n recentAngleDelta += angleDelta;\n while (anchorDistance - recentCorners[0].distance > windowSize) {\n recentAngleDelta -= recentCorners.shift().angleDelta;\n }\n if (recentAngleDelta > maxAngle) {\n return false;\n }\n index++;\n anchorDistance += current.dist(next);\n }\n return true;\n }\n function getLineLength(line) {\n var lineLength = 0;\n for (var k = 0; k < line.length - 1; k++) {\n lineLength += line[k].dist(line[k + 1]);\n }\n return lineLength;\n }\n function getAngleWindowSize(shapedText, glyphSize, boxScale) {\n return shapedText ? 3 / 5 * glyphSize * boxScale : 0;\n }\n function getShapedLabelLength(shapedText, shapedIcon) {\n return Math.max(shapedText ? shapedText.right - shapedText.left : 0, shapedIcon ? shapedIcon.right - shapedIcon.left : 0);\n }\n function getCenterAnchor(line, maxAngle, shapedText, shapedIcon, glyphSize, boxScale) {\n var angleWindowSize = getAngleWindowSize(shapedText, glyphSize, boxScale);\n var labelLength = getShapedLabelLength(shapedText, shapedIcon) * boxScale;\n var prevDistance = 0;\n var centerDistance = getLineLength(line) / 2;\n for (var i = 0; i < line.length - 1; i++) {\n var a = line[i], b = line[i + 1];\n var segmentDistance = a.dist(b);\n if (prevDistance + segmentDistance > centerDistance) {\n var t = (centerDistance - prevDistance) / segmentDistance, x = number(a.x, b.x, t), y = number(a.y, b.y, t);\n var anchor = new Anchor(x, y, b.angleTo(a), i);\n anchor._round();\n if (!angleWindowSize || checkMaxAngle(line, anchor, labelLength, angleWindowSize, maxAngle)) {\n return anchor;\n } else {\n return;\n }\n }\n prevDistance += segmentDistance;\n }\n }\n function getAnchors(line, spacing, maxAngle, shapedText, shapedIcon, glyphSize, boxScale, overscaling, tileExtent) {\n var angleWindowSize = getAngleWindowSize(shapedText, glyphSize, boxScale);\n var shapedLabelLength = getShapedLabelLength(shapedText, shapedIcon);\n var labelLength = shapedLabelLength * boxScale;\n var isLineContinued = line[0].x === 0 || line[0].x === tileExtent || line[0].y === 0 || line[0].y === tileExtent;\n if (spacing - labelLength < spacing / 4) {\n spacing = labelLength + spacing / 4;\n }\n var fixedExtraOffset = glyphSize * 2;\n var offset = !isLineContinued ? (shapedLabelLength / 2 + fixedExtraOffset) * boxScale * overscaling % spacing : spacing / 2 * overscaling % spacing;\n return resample(line, offset, spacing, angleWindowSize, maxAngle, labelLength, isLineContinued, false, tileExtent);\n }\n function resample(line, offset, spacing, angleWindowSize, maxAngle, labelLength, isLineContinued, placeAtMiddle, tileExtent) {\n var halfLabelLength = labelLength / 2;\n var lineLength = getLineLength(line);\n var distance = 0, markedDistance = offset - spacing;\n var anchors = [];\n for (var i = 0; i < line.length - 1; i++) {\n var a = line[i], b = line[i + 1];\n var segmentDist = a.dist(b), angle = b.angleTo(a);\n while (markedDistance + spacing < distance + segmentDist) {\n markedDistance += spacing;\n var t = (markedDistance - distance) / segmentDist, x = number(a.x, b.x, t), y = number(a.y, b.y, t);\n if (x >= 0 && x < tileExtent && y >= 0 && y < tileExtent && markedDistance - halfLabelLength >= 0 && markedDistance + halfLabelLength <= lineLength) {\n var anchor = new Anchor(x, y, angle, i);\n anchor._round();\n if (!angleWindowSize || checkMaxAngle(line, anchor, labelLength, angleWindowSize, maxAngle)) {\n anchors.push(anchor);\n }\n }\n }\n distance += segmentDist;\n }\n if (!placeAtMiddle && !anchors.length && !isLineContinued) {\n anchors = resample(line, distance / 2, spacing, angleWindowSize, maxAngle, labelLength, isLineContinued, true, tileExtent);\n }\n return anchors;\n }\n function clipLine(lines, x1, y1, x2, y2) {\n var clippedLines = [];\n for (var l = 0; l < lines.length; l++) {\n var line = lines[l];\n var clippedLine = void 0;\n for (var i = 0; i < line.length - 1; i++) {\n var p0 = line[i];\n var p1 = line[i + 1];\n if (p0.x < x1 && p1.x < x1) {\n continue;\n } else if (p0.x < x1) {\n p0 = new pointGeometry(x1, p0.y + (p1.y - p0.y) * ((x1 - p0.x) / (p1.x - p0.x)))._round();\n } else if (p1.x < x1) {\n p1 = new pointGeometry(x1, p0.y + (p1.y - p0.y) * ((x1 - p0.x) / (p1.x - p0.x)))._round();\n }\n if (p0.y < y1 && p1.y < y1) {\n continue;\n } else if (p0.y < y1) {\n p0 = new pointGeometry(p0.x + (p1.x - p0.x) * ((y1 - p0.y) / (p1.y - p0.y)), y1)._round();\n } else if (p1.y < y1) {\n p1 = new pointGeometry(p0.x + (p1.x - p0.x) * ((y1 - p0.y) / (p1.y - p0.y)), y1)._round();\n }\n if (p0.x >= x2 && p1.x >= x2) {\n continue;\n } else if (p0.x >= x2) {\n p0 = new pointGeometry(x2, p0.y + (p1.y - p0.y) * ((x2 - p0.x) / (p1.x - p0.x)))._round();\n } else if (p1.x >= x2) {\n p1 = new pointGeometry(x2, p0.y + (p1.y - p0.y) * ((x2 - p0.x) / (p1.x - p0.x)))._round();\n }\n if (p0.y >= y2 && p1.y >= y2) {\n continue;\n } else if (p0.y >= y2) {\n p0 = new pointGeometry(p0.x + (p1.x - p0.x) * ((y2 - p0.y) / (p1.y - p0.y)), y2)._round();\n } else if (p1.y >= y2) {\n p1 = new pointGeometry(p0.x + (p1.x - p0.x) * ((y2 - p0.y) / (p1.y - p0.y)), y2)._round();\n }\n if (!clippedLine || !p0.equals(clippedLine[clippedLine.length - 1])) {\n clippedLine = [p0];\n clippedLines.push(clippedLine);\n }\n clippedLine.push(p1);\n }\n }\n return clippedLines;\n }\n var border$1 = IMAGE_PADDING;\n function getIconQuads(shapedIcon, iconRotate, isSDFIcon, hasIconTextFit) {\n var quads = [];\n var image = shapedIcon.image;\n var pixelRatio = image.pixelRatio;\n var imageWidth = image.paddedRect.w - 2 * border$1;\n var imageHeight = image.paddedRect.h - 2 * border$1;\n var iconWidth = shapedIcon.right - shapedIcon.left;\n var iconHeight = shapedIcon.bottom - shapedIcon.top;\n var stretchX = image.stretchX || [[\n 0,\n imageWidth\n ]];\n var stretchY = image.stretchY || [[\n 0,\n imageHeight\n ]];\n var reduceRanges = function(sum, range) {\n return sum + range[1] - range[0];\n };\n var stretchWidth = stretchX.reduce(reduceRanges, 0);\n var stretchHeight = stretchY.reduce(reduceRanges, 0);\n var fixedWidth = imageWidth - stretchWidth;\n var fixedHeight = imageHeight - stretchHeight;\n var stretchOffsetX = 0;\n var stretchContentWidth = stretchWidth;\n var stretchOffsetY = 0;\n var stretchContentHeight = stretchHeight;\n var fixedOffsetX = 0;\n var fixedContentWidth = fixedWidth;\n var fixedOffsetY = 0;\n var fixedContentHeight = fixedHeight;\n if (image.content && hasIconTextFit) {\n var content = image.content;\n stretchOffsetX = sumWithinRange(stretchX, 0, content[0]);\n stretchOffsetY = sumWithinRange(stretchY, 0, content[1]);\n stretchContentWidth = sumWithinRange(stretchX, content[0], content[2]);\n stretchContentHeight = sumWithinRange(stretchY, content[1], content[3]);\n fixedOffsetX = content[0] - stretchOffsetX;\n fixedOffsetY = content[1] - stretchOffsetY;\n fixedContentWidth = content[2] - content[0] - stretchContentWidth;\n fixedContentHeight = content[3] - content[1] - stretchContentHeight;\n }\n var makeBox = function(left, top, right, bottom) {\n var leftEm = getEmOffset(left.stretch - stretchOffsetX, stretchContentWidth, iconWidth, shapedIcon.left);\n var leftPx = getPxOffset(left.fixed - fixedOffsetX, fixedContentWidth, left.stretch, stretchWidth);\n var topEm = getEmOffset(top.stretch - stretchOffsetY, stretchContentHeight, iconHeight, shapedIcon.top);\n var topPx = getPxOffset(top.fixed - fixedOffsetY, fixedContentHeight, top.stretch, stretchHeight);\n var rightEm = getEmOffset(right.stretch - stretchOffsetX, stretchContentWidth, iconWidth, shapedIcon.left);\n var rightPx = getPxOffset(right.fixed - fixedOffsetX, fixedContentWidth, right.stretch, stretchWidth);\n var bottomEm = getEmOffset(bottom.stretch - stretchOffsetY, stretchContentHeight, iconHeight, shapedIcon.top);\n var bottomPx = getPxOffset(bottom.fixed - fixedOffsetY, fixedContentHeight, bottom.stretch, stretchHeight);\n var tl = new pointGeometry(leftEm, topEm);\n var tr = new pointGeometry(rightEm, topEm);\n var br = new pointGeometry(rightEm, bottomEm);\n var bl = new pointGeometry(leftEm, bottomEm);\n var pixelOffsetTL = new pointGeometry(leftPx / pixelRatio, topPx / pixelRatio);\n var pixelOffsetBR = new pointGeometry(rightPx / pixelRatio, bottomPx / pixelRatio);\n var angle = iconRotate * Math.PI / 180;\n if (angle) {\n var sin = Math.sin(angle), cos = Math.cos(angle), matrix = [\n cos,\n -sin,\n sin,\n cos\n ];\n tl._matMult(matrix);\n tr._matMult(matrix);\n bl._matMult(matrix);\n br._matMult(matrix);\n }\n var x12 = left.stretch + left.fixed;\n var x22 = right.stretch + right.fixed;\n var y12 = top.stretch + top.fixed;\n var y22 = bottom.stretch + bottom.fixed;\n var subRect = {\n x: image.paddedRect.x + border$1 + x12,\n y: image.paddedRect.y + border$1 + y12,\n w: x22 - x12,\n h: y22 - y12\n };\n var minFontScaleX = fixedContentWidth / pixelRatio / iconWidth;\n var minFontScaleY = fixedContentHeight / pixelRatio / iconHeight;\n return {\n tl,\n tr,\n bl,\n br,\n tex: subRect,\n writingMode: void 0,\n glyphOffset: [\n 0,\n 0\n ],\n sectionIndex: 0,\n pixelOffsetTL,\n pixelOffsetBR,\n minFontScaleX,\n minFontScaleY,\n isSDF: isSDFIcon\n };\n };\n if (!hasIconTextFit || !image.stretchX && !image.stretchY) {\n quads.push(makeBox({\n fixed: 0,\n stretch: -1\n }, {\n fixed: 0,\n stretch: -1\n }, {\n fixed: 0,\n stretch: imageWidth + 1\n }, {\n fixed: 0,\n stretch: imageHeight + 1\n }));\n } else {\n var xCuts = stretchZonesToCuts(stretchX, fixedWidth, stretchWidth);\n var yCuts = stretchZonesToCuts(stretchY, fixedHeight, stretchHeight);\n for (var xi = 0; xi < xCuts.length - 1; xi++) {\n var x1 = xCuts[xi];\n var x2 = xCuts[xi + 1];\n for (var yi = 0; yi < yCuts.length - 1; yi++) {\n var y1 = yCuts[yi];\n var y2 = yCuts[yi + 1];\n quads.push(makeBox(x1, y1, x2, y2));\n }\n }\n }\n return quads;\n }\n function sumWithinRange(ranges, min, max) {\n var sum = 0;\n for (var i = 0, list = ranges; i < list.length; i += 1) {\n var range = list[i];\n sum += Math.max(min, Math.min(max, range[1])) - Math.max(min, Math.min(max, range[0]));\n }\n return sum;\n }\n function stretchZonesToCuts(stretchZones, fixedSize, stretchSize) {\n var cuts = [{\n fixed: -border$1,\n stretch: 0\n }];\n for (var i = 0, list = stretchZones; i < list.length; i += 1) {\n var ref = list[i];\n var c1 = ref[0];\n var c2 = ref[1];\n var last = cuts[cuts.length - 1];\n cuts.push({\n fixed: c1 - last.stretch,\n stretch: last.stretch\n });\n cuts.push({\n fixed: c1 - last.stretch,\n stretch: last.stretch + (c2 - c1)\n });\n }\n cuts.push({\n fixed: fixedSize + border$1,\n stretch: stretchSize\n });\n return cuts;\n }\n function getEmOffset(stretchOffset, stretchSize, iconSize, iconOffset) {\n return stretchOffset / stretchSize * iconSize + iconOffset;\n }\n function getPxOffset(fixedOffset, fixedSize, stretchOffset, stretchSize) {\n return fixedOffset - fixedSize * stretchOffset / stretchSize;\n }\n function getGlyphQuads(anchor, shaping, textOffset, layer2, alongLine, feature, imageMap, allowVerticalPlacement) {\n var textRotate = layer2.layout.get(\"text-rotate\").evaluate(feature, {}) * Math.PI / 180;\n var quads = [];\n for (var i$1 = 0, list$1 = shaping.positionedLines; i$1 < list$1.length; i$1 += 1) {\n var line = list$1[i$1];\n for (var i = 0, list = line.positionedGlyphs; i < list.length; i += 1) {\n var positionedGlyph = list[i];\n if (!positionedGlyph.rect) {\n continue;\n }\n var textureRect = positionedGlyph.rect || {};\n var glyphPadding = 1;\n var rectBuffer = GLYPH_PBF_BORDER + glyphPadding;\n var isSDF = true;\n var pixelRatio = 1;\n var lineOffset = 0;\n var rotateVerticalGlyph = (alongLine || allowVerticalPlacement) && positionedGlyph.vertical;\n var halfAdvance = positionedGlyph.metrics.advance * positionedGlyph.scale / 2;\n if (allowVerticalPlacement && shaping.verticalizable) {\n var scaledGlyphOffset = (positionedGlyph.scale - 1) * ONE_EM;\n var imageOffset = (ONE_EM - positionedGlyph.metrics.width * positionedGlyph.scale) / 2;\n lineOffset = line.lineOffset / 2 - (positionedGlyph.imageName ? -imageOffset : scaledGlyphOffset);\n }\n if (positionedGlyph.imageName) {\n var image = imageMap[positionedGlyph.imageName];\n isSDF = image.sdf;\n pixelRatio = image.pixelRatio;\n rectBuffer = IMAGE_PADDING / pixelRatio;\n }\n var glyphOffset2 = alongLine ? [\n positionedGlyph.x + halfAdvance,\n positionedGlyph.y\n ] : [\n 0,\n 0\n ];\n var builtInOffset = alongLine ? [\n 0,\n 0\n ] : [\n positionedGlyph.x + halfAdvance + textOffset[0],\n positionedGlyph.y + textOffset[1] - lineOffset\n ];\n var verticalizedLabelOffset = [\n 0,\n 0\n ];\n if (rotateVerticalGlyph) {\n verticalizedLabelOffset = builtInOffset;\n builtInOffset = [\n 0,\n 0\n ];\n }\n var x1 = (positionedGlyph.metrics.left - rectBuffer) * positionedGlyph.scale - halfAdvance + builtInOffset[0];\n var y1 = (-positionedGlyph.metrics.top - rectBuffer) * positionedGlyph.scale + builtInOffset[1];\n var x2 = x1 + textureRect.w * positionedGlyph.scale / pixelRatio;\n var y2 = y1 + textureRect.h * positionedGlyph.scale / pixelRatio;\n var tl = new pointGeometry(x1, y1);\n var tr = new pointGeometry(x2, y1);\n var bl = new pointGeometry(x1, y2);\n var br = new pointGeometry(x2, y2);\n if (rotateVerticalGlyph) {\n var center = new pointGeometry(-halfAdvance, halfAdvance - SHAPING_DEFAULT_OFFSET);\n var verticalRotation = -Math.PI / 2;\n var xHalfWidthOffsetCorrection = ONE_EM / 2 - halfAdvance;\n var yImageOffsetCorrection = positionedGlyph.imageName ? xHalfWidthOffsetCorrection : 0;\n var halfWidthOffsetCorrection = new pointGeometry(5 - SHAPING_DEFAULT_OFFSET - xHalfWidthOffsetCorrection, -yImageOffsetCorrection);\n var verticalOffsetCorrection = new (Function.prototype.bind.apply(pointGeometry, [null].concat(verticalizedLabelOffset)))();\n tl._rotateAround(verticalRotation, center)._add(halfWidthOffsetCorrection)._add(verticalOffsetCorrection);\n tr._rotateAround(verticalRotation, center)._add(halfWidthOffsetCorrection)._add(verticalOffsetCorrection);\n bl._rotateAround(verticalRotation, center)._add(halfWidthOffsetCorrection)._add(verticalOffsetCorrection);\n br._rotateAround(verticalRotation, center)._add(halfWidthOffsetCorrection)._add(verticalOffsetCorrection);\n }\n if (textRotate) {\n var sin = Math.sin(textRotate), cos = Math.cos(textRotate), matrix = [\n cos,\n -sin,\n sin,\n cos\n ];\n tl._matMult(matrix);\n tr._matMult(matrix);\n bl._matMult(matrix);\n br._matMult(matrix);\n }\n var pixelOffsetTL = new pointGeometry(0, 0);\n var pixelOffsetBR = new pointGeometry(0, 0);\n var minFontScaleX = 0;\n var minFontScaleY = 0;\n quads.push({\n tl,\n tr,\n bl,\n br,\n tex: textureRect,\n writingMode: shaping.writingMode,\n glyphOffset: glyphOffset2,\n sectionIndex: positionedGlyph.sectionIndex,\n isSDF,\n pixelOffsetTL,\n pixelOffsetBR,\n minFontScaleX,\n minFontScaleY\n });\n }\n }\n return quads;\n }\n var CollisionFeature = function CollisionFeature2(collisionBoxArray, anchor, featureIndex, sourceLayerIndex, bucketIndex, shaped, boxScale, padding, alignLine, rotate2) {\n this.boxStartIndex = collisionBoxArray.length;\n if (alignLine) {\n var top = shaped.top;\n var bottom = shaped.bottom;\n var collisionPadding = shaped.collisionPadding;\n if (collisionPadding) {\n top -= collisionPadding[1];\n bottom += collisionPadding[3];\n }\n var height = bottom - top;\n if (height > 0) {\n height = Math.max(10, height);\n this.circleDiameter = height;\n }\n } else {\n var y1 = shaped.top * boxScale - padding;\n var y2 = shaped.bottom * boxScale + padding;\n var x1 = shaped.left * boxScale - padding;\n var x2 = shaped.right * boxScale + padding;\n var collisionPadding$1 = shaped.collisionPadding;\n if (collisionPadding$1) {\n x1 -= collisionPadding$1[0] * boxScale;\n y1 -= collisionPadding$1[1] * boxScale;\n x2 += collisionPadding$1[2] * boxScale;\n y2 += collisionPadding$1[3] * boxScale;\n }\n if (rotate2) {\n var tl = new pointGeometry(x1, y1);\n var tr = new pointGeometry(x2, y1);\n var bl = new pointGeometry(x1, y2);\n var br = new pointGeometry(x2, y2);\n var rotateRadians = rotate2 * Math.PI / 180;\n tl._rotate(rotateRadians);\n tr._rotate(rotateRadians);\n bl._rotate(rotateRadians);\n br._rotate(rotateRadians);\n x1 = Math.min(tl.x, tr.x, bl.x, br.x);\n x2 = Math.max(tl.x, tr.x, bl.x, br.x);\n y1 = Math.min(tl.y, tr.y, bl.y, br.y);\n y2 = Math.max(tl.y, tr.y, bl.y, br.y);\n }\n collisionBoxArray.emplaceBack(anchor.x, anchor.y, x1, y1, x2, y2, featureIndex, sourceLayerIndex, bucketIndex);\n }\n this.boxEndIndex = collisionBoxArray.length;\n };\n var TinyQueue = function TinyQueue2(data, compare2) {\n if (data === void 0)\n data = [];\n if (compare2 === void 0)\n compare2 = defaultCompare$1;\n this.data = data;\n this.length = this.data.length;\n this.compare = compare2;\n if (this.length > 0) {\n for (var i = (this.length >> 1) - 1; i >= 0; i--) {\n this._down(i);\n }\n }\n };\n TinyQueue.prototype.push = function push(item) {\n this.data.push(item);\n this.length++;\n this._up(this.length - 1);\n };\n TinyQueue.prototype.pop = function pop() {\n if (this.length === 0) {\n return void 0;\n }\n var top = this.data[0];\n var bottom = this.data.pop();\n this.length--;\n if (this.length > 0) {\n this.data[0] = bottom;\n this._down(0);\n }\n return top;\n };\n TinyQueue.prototype.peek = function peek() {\n return this.data[0];\n };\n TinyQueue.prototype._up = function _up(pos) {\n var ref = this;\n var data = ref.data;\n var compare2 = ref.compare;\n var item = data[pos];\n while (pos > 0) {\n var parent = pos - 1 >> 1;\n var current = data[parent];\n if (compare2(item, current) >= 0) {\n break;\n }\n data[pos] = current;\n pos = parent;\n }\n data[pos] = item;\n };\n TinyQueue.prototype._down = function _down(pos) {\n var ref = this;\n var data = ref.data;\n var compare2 = ref.compare;\n var halfLength = this.length >> 1;\n var item = data[pos];\n while (pos < halfLength) {\n var left = (pos << 1) + 1;\n var best = data[left];\n var right = left + 1;\n if (right < this.length && compare2(data[right], best) < 0) {\n left = right;\n best = data[right];\n }\n if (compare2(best, item) >= 0) {\n break;\n }\n data[pos] = best;\n pos = left;\n }\n data[pos] = item;\n };\n function defaultCompare$1(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n }\n function findPoleOfInaccessibility(polygonRings, precision, debug) {\n if (precision === void 0)\n precision = 1;\n if (debug === void 0)\n debug = false;\n var minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n var outerRing = polygonRings[0];\n for (var i = 0; i < outerRing.length; i++) {\n var p = outerRing[i];\n if (!i || p.x < minX) {\n minX = p.x;\n }\n if (!i || p.y < minY) {\n minY = p.y;\n }\n if (!i || p.x > maxX) {\n maxX = p.x;\n }\n if (!i || p.y > maxY) {\n maxY = p.y;\n }\n }\n var width = maxX - minX;\n var height = maxY - minY;\n var cellSize = Math.min(width, height);\n var h = cellSize / 2;\n var cellQueue = new TinyQueue([], compareMax);\n if (cellSize === 0) {\n return new pointGeometry(minX, minY);\n }\n for (var x = minX; x < maxX; x += cellSize) {\n for (var y = minY; y < maxY; y += cellSize) {\n cellQueue.push(new Cell(x + h, y + h, h, polygonRings));\n }\n }\n var bestCell = getCentroidCell(polygonRings);\n var numProbes = cellQueue.length;\n while (cellQueue.length) {\n var cell = cellQueue.pop();\n if (cell.d > bestCell.d || !bestCell.d) {\n bestCell = cell;\n if (debug) {\n console.log(\"found best %d after %d probes\", Math.round(1e4 * cell.d) / 1e4, numProbes);\n }\n }\n if (cell.max - bestCell.d <= precision) {\n continue;\n }\n h = cell.h / 2;\n cellQueue.push(new Cell(cell.p.x - h, cell.p.y - h, h, polygonRings));\n cellQueue.push(new Cell(cell.p.x + h, cell.p.y - h, h, polygonRings));\n cellQueue.push(new Cell(cell.p.x - h, cell.p.y + h, h, polygonRings));\n cellQueue.push(new Cell(cell.p.x + h, cell.p.y + h, h, polygonRings));\n numProbes += 4;\n }\n if (debug) {\n console.log(\"num probes: \" + numProbes);\n console.log(\"best distance: \" + bestCell.d);\n }\n return bestCell.p;\n }\n function compareMax(a, b) {\n return b.max - a.max;\n }\n function Cell(x, y, h, polygon) {\n this.p = new pointGeometry(x, y);\n this.h = h;\n this.d = pointToPolygonDist(this.p, polygon);\n this.max = this.d + this.h * Math.SQRT2;\n }\n function pointToPolygonDist(p, polygon) {\n var inside = false;\n var minDistSq = Infinity;\n for (var k = 0; k < polygon.length; k++) {\n var ring = polygon[k];\n for (var i = 0, len = ring.length, j = len - 1; i < len; j = i++) {\n var a = ring[i];\n var b = ring[j];\n if (a.y > p.y !== b.y > p.y && p.x < (b.x - a.x) * (p.y - a.y) / (b.y - a.y) + a.x) {\n inside = !inside;\n }\n minDistSq = Math.min(minDistSq, distToSegmentSquared(p, a, b));\n }\n }\n return (inside ? 1 : -1) * Math.sqrt(minDistSq);\n }\n function getCentroidCell(polygon) {\n var area2 = 0;\n var x = 0;\n var y = 0;\n var points = polygon[0];\n for (var i = 0, len = points.length, j = len - 1; i < len; j = i++) {\n var a = points[i];\n var b = points[j];\n var f = a.x * b.y - b.x * a.y;\n x += (a.x + b.x) * f;\n y += (a.y + b.y) * f;\n area2 += f * 3;\n }\n return new Cell(x / area2, y / area2, 0, polygon);\n }\n var baselineOffset = 7;\n var INVALID_TEXT_OFFSET = Number.POSITIVE_INFINITY;\n function evaluateVariableOffset(anchor, offset) {\n function fromRadialOffset(anchor2, radialOffset) {\n var x = 0, y = 0;\n if (radialOffset < 0) {\n radialOffset = 0;\n }\n var hypotenuse = radialOffset / Math.sqrt(2);\n switch (anchor2) {\n case \"top-right\":\n case \"top-left\":\n y = hypotenuse - baselineOffset;\n break;\n case \"bottom-right\":\n case \"bottom-left\":\n y = -hypotenuse + baselineOffset;\n break;\n case \"bottom\":\n y = -radialOffset + baselineOffset;\n break;\n case \"top\":\n y = radialOffset - baselineOffset;\n break;\n }\n switch (anchor2) {\n case \"top-right\":\n case \"bottom-right\":\n x = -hypotenuse;\n break;\n case \"top-left\":\n case \"bottom-left\":\n x = hypotenuse;\n break;\n case \"left\":\n x = radialOffset;\n break;\n case \"right\":\n x = -radialOffset;\n break;\n }\n return [\n x,\n y\n ];\n }\n function fromTextOffset(anchor2, offsetX, offsetY) {\n var x = 0, y = 0;\n offsetX = Math.abs(offsetX);\n offsetY = Math.abs(offsetY);\n switch (anchor2) {\n case \"top-right\":\n case \"top-left\":\n case \"top\":\n y = offsetY - baselineOffset;\n break;\n case \"bottom-right\":\n case \"bottom-left\":\n case \"bottom\":\n y = -offsetY + baselineOffset;\n break;\n }\n switch (anchor2) {\n case \"top-right\":\n case \"bottom-right\":\n case \"right\":\n x = -offsetX;\n break;\n case \"top-left\":\n case \"bottom-left\":\n case \"left\":\n x = offsetX;\n break;\n }\n return [\n x,\n y\n ];\n }\n return offset[1] !== INVALID_TEXT_OFFSET ? fromTextOffset(anchor, offset[0], offset[1]) : fromRadialOffset(anchor, offset[0]);\n }\n function performSymbolLayout(bucket, glyphMap, glyphPositions, imageMap, imagePositions, showCollisionBoxes, canonical) {\n bucket.createArrays();\n var tileSize = 512 * bucket.overscaling;\n bucket.tilePixelRatio = EXTENT$1 / tileSize;\n bucket.compareText = {};\n bucket.iconsNeedLinear = false;\n var layout2 = bucket.layers[0].layout;\n var unevaluatedLayoutValues = bucket.layers[0]._unevaluatedLayout._values;\n var sizes = {};\n if (bucket.textSizeData.kind === \"composite\") {\n var ref = bucket.textSizeData;\n var minZoom = ref.minZoom;\n var maxZoom = ref.maxZoom;\n sizes.compositeTextSizes = [\n unevaluatedLayoutValues[\"text-size\"].possiblyEvaluate(new EvaluationParameters(minZoom), canonical),\n unevaluatedLayoutValues[\"text-size\"].possiblyEvaluate(new EvaluationParameters(maxZoom), canonical)\n ];\n }\n if (bucket.iconSizeData.kind === \"composite\") {\n var ref$1 = bucket.iconSizeData;\n var minZoom$1 = ref$1.minZoom;\n var maxZoom$1 = ref$1.maxZoom;\n sizes.compositeIconSizes = [\n unevaluatedLayoutValues[\"icon-size\"].possiblyEvaluate(new EvaluationParameters(minZoom$1), canonical),\n unevaluatedLayoutValues[\"icon-size\"].possiblyEvaluate(new EvaluationParameters(maxZoom$1), canonical)\n ];\n }\n sizes.layoutTextSize = unevaluatedLayoutValues[\"text-size\"].possiblyEvaluate(new EvaluationParameters(bucket.zoom + 1), canonical);\n sizes.layoutIconSize = unevaluatedLayoutValues[\"icon-size\"].possiblyEvaluate(new EvaluationParameters(bucket.zoom + 1), canonical);\n sizes.textMaxSize = unevaluatedLayoutValues[\"text-size\"].possiblyEvaluate(new EvaluationParameters(18));\n var lineHeight = layout2.get(\"text-line-height\") * ONE_EM;\n var textAlongLine = layout2.get(\"text-rotation-alignment\") === \"map\" && layout2.get(\"symbol-placement\") !== \"point\";\n var keepUpright = layout2.get(\"text-keep-upright\");\n var textSize = layout2.get(\"text-size\");\n var loop = function() {\n var feature = list[i$1];\n var fontstack = layout2.get(\"text-font\").evaluate(feature, {}, canonical).join(\",\");\n var layoutTextSizeThisZoom = textSize.evaluate(feature, {}, canonical);\n var layoutTextSize = sizes.layoutTextSize.evaluate(feature, {}, canonical);\n var layoutIconSize = sizes.layoutIconSize.evaluate(feature, {}, canonical);\n var shapedTextOrientations = {\n horizontal: {},\n vertical: void 0\n };\n var text = feature.text;\n var textOffset = [\n 0,\n 0\n ];\n if (text) {\n var unformattedText = text.toString();\n var spacing = layout2.get(\"text-letter-spacing\").evaluate(feature, {}, canonical) * ONE_EM;\n var spacingIfAllowed = allowsLetterSpacing(unformattedText) ? spacing : 0;\n var textAnchor = layout2.get(\"text-anchor\").evaluate(feature, {}, canonical);\n var variableTextAnchor = layout2.get(\"text-variable-anchor\");\n if (!variableTextAnchor) {\n var radialOffset = layout2.get(\"text-radial-offset\").evaluate(feature, {}, canonical);\n if (radialOffset) {\n textOffset = evaluateVariableOffset(textAnchor, [\n radialOffset * ONE_EM,\n INVALID_TEXT_OFFSET\n ]);\n } else {\n textOffset = layout2.get(\"text-offset\").evaluate(feature, {}, canonical).map(function(t) {\n return t * ONE_EM;\n });\n }\n }\n var textJustify = textAlongLine ? \"center\" : layout2.get(\"text-justify\").evaluate(feature, {}, canonical);\n var symbolPlacement = layout2.get(\"symbol-placement\");\n var maxWidth = symbolPlacement === \"point\" ? layout2.get(\"text-max-width\").evaluate(feature, {}, canonical) * ONE_EM : 0;\n var addVerticalShapingForPointLabelIfNeeded = function() {\n if (bucket.allowVerticalPlacement && allowsVerticalWritingMode(unformattedText)) {\n shapedTextOrientations.vertical = shapeText(text, glyphMap, glyphPositions, imagePositions, fontstack, maxWidth, lineHeight, textAnchor, \"left\", spacingIfAllowed, textOffset, WritingMode.vertical, true, symbolPlacement, layoutTextSize, layoutTextSizeThisZoom);\n }\n };\n if (!textAlongLine && variableTextAnchor) {\n var justifications = textJustify === \"auto\" ? variableTextAnchor.map(function(a) {\n return getAnchorJustification(a);\n }) : [textJustify];\n var singleLine = false;\n for (var i = 0; i < justifications.length; i++) {\n var justification = justifications[i];\n if (shapedTextOrientations.horizontal[justification]) {\n continue;\n }\n if (singleLine) {\n shapedTextOrientations.horizontal[justification] = shapedTextOrientations.horizontal[0];\n } else {\n var shaping = shapeText(text, glyphMap, glyphPositions, imagePositions, fontstack, maxWidth, lineHeight, \"center\", justification, spacingIfAllowed, textOffset, WritingMode.horizontal, false, symbolPlacement, layoutTextSize, layoutTextSizeThisZoom);\n if (shaping) {\n shapedTextOrientations.horizontal[justification] = shaping;\n singleLine = shaping.positionedLines.length === 1;\n }\n }\n }\n addVerticalShapingForPointLabelIfNeeded();\n } else {\n if (textJustify === \"auto\") {\n textJustify = getAnchorJustification(textAnchor);\n }\n var shaping$1 = shapeText(text, glyphMap, glyphPositions, imagePositions, fontstack, maxWidth, lineHeight, textAnchor, textJustify, spacingIfAllowed, textOffset, WritingMode.horizontal, false, symbolPlacement, layoutTextSize, layoutTextSizeThisZoom);\n if (shaping$1) {\n shapedTextOrientations.horizontal[textJustify] = shaping$1;\n }\n addVerticalShapingForPointLabelIfNeeded();\n if (allowsVerticalWritingMode(unformattedText) && textAlongLine && keepUpright) {\n shapedTextOrientations.vertical = shapeText(text, glyphMap, glyphPositions, imagePositions, fontstack, maxWidth, lineHeight, textAnchor, textJustify, spacingIfAllowed, textOffset, WritingMode.vertical, false, symbolPlacement, layoutTextSize, layoutTextSizeThisZoom);\n }\n }\n }\n var shapedIcon = void 0;\n var isSDFIcon = false;\n if (feature.icon && feature.icon.name) {\n var image = imageMap[feature.icon.name];\n if (image) {\n shapedIcon = shapeIcon(imagePositions[feature.icon.name], layout2.get(\"icon-offset\").evaluate(feature, {}, canonical), layout2.get(\"icon-anchor\").evaluate(feature, {}, canonical));\n isSDFIcon = image.sdf;\n if (bucket.sdfIcons === void 0) {\n bucket.sdfIcons = image.sdf;\n } else if (bucket.sdfIcons !== image.sdf) {\n warnOnce(\"Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer\");\n }\n if (image.pixelRatio !== bucket.pixelRatio) {\n bucket.iconsNeedLinear = true;\n } else if (layout2.get(\"icon-rotate\").constantOr(1) !== 0) {\n bucket.iconsNeedLinear = true;\n }\n }\n }\n var shapedText = getDefaultHorizontalShaping(shapedTextOrientations.horizontal) || shapedTextOrientations.vertical;\n bucket.iconsInText = shapedText ? shapedText.iconsInText : false;\n if (shapedText || shapedIcon) {\n addFeature(bucket, feature, shapedTextOrientations, shapedIcon, imageMap, sizes, layoutTextSize, layoutIconSize, textOffset, isSDFIcon, canonical);\n }\n };\n for (var i$1 = 0, list = bucket.features; i$1 < list.length; i$1 += 1)\n loop();\n if (showCollisionBoxes) {\n bucket.generateCollisionDebugBuffers();\n }\n }\n function getAnchorJustification(anchor) {\n switch (anchor) {\n case \"right\":\n case \"top-right\":\n case \"bottom-right\":\n return \"right\";\n case \"left\":\n case \"top-left\":\n case \"bottom-left\":\n return \"left\";\n }\n return \"center\";\n }\n function addFeature(bucket, feature, shapedTextOrientations, shapedIcon, imageMap, sizes, layoutTextSize, layoutIconSize, textOffset, isSDFIcon, canonical) {\n var textMaxSize = sizes.textMaxSize.evaluate(feature, {});\n if (textMaxSize === void 0) {\n textMaxSize = layoutTextSize;\n }\n var layout2 = bucket.layers[0].layout;\n var iconOffset = layout2.get(\"icon-offset\").evaluate(feature, {}, canonical);\n var defaultHorizontalShaping = getDefaultHorizontalShaping(shapedTextOrientations.horizontal);\n var glyphSize = 24, fontScale = layoutTextSize / glyphSize, textBoxScale = bucket.tilePixelRatio * fontScale, textMaxBoxScale = bucket.tilePixelRatio * textMaxSize / glyphSize, iconBoxScale = bucket.tilePixelRatio * layoutIconSize, symbolMinDistance = bucket.tilePixelRatio * layout2.get(\"symbol-spacing\"), textPadding = layout2.get(\"text-padding\") * bucket.tilePixelRatio, iconPadding = layout2.get(\"icon-padding\") * bucket.tilePixelRatio, textMaxAngle = layout2.get(\"text-max-angle\") / 180 * Math.PI, textAlongLine = layout2.get(\"text-rotation-alignment\") === \"map\" && layout2.get(\"symbol-placement\") !== \"point\", iconAlongLine = layout2.get(\"icon-rotation-alignment\") === \"map\" && layout2.get(\"symbol-placement\") !== \"point\", symbolPlacement = layout2.get(\"symbol-placement\"), textRepeatDistance = symbolMinDistance / 2;\n var iconTextFit = layout2.get(\"icon-text-fit\");\n var verticallyShapedIcon;\n if (shapedIcon && iconTextFit !== \"none\") {\n if (bucket.allowVerticalPlacement && shapedTextOrientations.vertical) {\n verticallyShapedIcon = fitIconToText(shapedIcon, shapedTextOrientations.vertical, iconTextFit, layout2.get(\"icon-text-fit-padding\"), iconOffset, fontScale);\n }\n if (defaultHorizontalShaping) {\n shapedIcon = fitIconToText(shapedIcon, defaultHorizontalShaping, iconTextFit, layout2.get(\"icon-text-fit-padding\"), iconOffset, fontScale);\n }\n }\n var addSymbolAtAnchor = function(line2, anchor2) {\n if (anchor2.x < 0 || anchor2.x >= EXTENT$1 || anchor2.y < 0 || anchor2.y >= EXTENT$1) {\n return;\n }\n addSymbol(bucket, anchor2, line2, shapedTextOrientations, shapedIcon, imageMap, verticallyShapedIcon, bucket.layers[0], bucket.collisionBoxArray, feature.index, feature.sourceLayerIndex, bucket.index, textBoxScale, textPadding, textAlongLine, textOffset, iconBoxScale, iconPadding, iconAlongLine, iconOffset, feature, sizes, isSDFIcon, canonical, layoutTextSize);\n };\n if (symbolPlacement === \"line\") {\n for (var i$1 = 0, list$1 = clipLine(feature.geometry, 0, 0, EXTENT$1, EXTENT$1); i$1 < list$1.length; i$1 += 1) {\n var line = list$1[i$1];\n var anchors = getAnchors(line, symbolMinDistance, textMaxAngle, shapedTextOrientations.vertical || defaultHorizontalShaping, shapedIcon, glyphSize, textMaxBoxScale, bucket.overscaling, EXTENT$1);\n for (var i = 0, list = anchors; i < list.length; i += 1) {\n var anchor = list[i];\n var shapedText = defaultHorizontalShaping;\n if (!shapedText || !anchorIsTooClose(bucket, shapedText.text, textRepeatDistance, anchor)) {\n addSymbolAtAnchor(line, anchor);\n }\n }\n }\n } else if (symbolPlacement === \"line-center\") {\n for (var i$2 = 0, list$2 = feature.geometry; i$2 < list$2.length; i$2 += 1) {\n var line$1 = list$2[i$2];\n if (line$1.length > 1) {\n var anchor$1 = getCenterAnchor(line$1, textMaxAngle, shapedTextOrientations.vertical || defaultHorizontalShaping, shapedIcon, glyphSize, textMaxBoxScale);\n if (anchor$1) {\n addSymbolAtAnchor(line$1, anchor$1);\n }\n }\n }\n } else if (feature.type === \"Polygon\") {\n for (var i$3 = 0, list$3 = classifyRings(feature.geometry, 0); i$3 < list$3.length; i$3 += 1) {\n var polygon = list$3[i$3];\n var poi = findPoleOfInaccessibility(polygon, 16);\n addSymbolAtAnchor(polygon[0], new Anchor(poi.x, poi.y, 0));\n }\n } else if (feature.type === \"LineString\") {\n for (var i$4 = 0, list$4 = feature.geometry; i$4 < list$4.length; i$4 += 1) {\n var line$2 = list$4[i$4];\n addSymbolAtAnchor(line$2, new Anchor(line$2[0].x, line$2[0].y, 0));\n }\n } else if (feature.type === \"Point\") {\n for (var i$6 = 0, list$6 = feature.geometry; i$6 < list$6.length; i$6 += 1) {\n var points = list$6[i$6];\n for (var i$5 = 0, list$5 = points; i$5 < list$5.length; i$5 += 1) {\n var point = list$5[i$5];\n addSymbolAtAnchor([point], new Anchor(point.x, point.y, 0));\n }\n }\n }\n }\n var MAX_GLYPH_ICON_SIZE = 255;\n var MAX_PACKED_SIZE = MAX_GLYPH_ICON_SIZE * SIZE_PACK_FACTOR;\n function addTextVertices(bucket, anchor, shapedText, imageMap, layer2, textAlongLine, feature, textOffset, lineArray, writingMode, placementTypes, placedTextSymbolIndices, placedIconIndex, sizes, canonical) {\n var glyphQuads = getGlyphQuads(anchor, shapedText, textOffset, layer2, textAlongLine, feature, imageMap, bucket.allowVerticalPlacement);\n var sizeData = bucket.textSizeData;\n var textSizeData = null;\n if (sizeData.kind === \"source\") {\n textSizeData = [SIZE_PACK_FACTOR * layer2.layout.get(\"text-size\").evaluate(feature, {})];\n if (textSizeData[0] > MAX_PACKED_SIZE) {\n warnOnce(bucket.layerIds[0] + ': Value for \"text-size\" is >= ' + MAX_GLYPH_ICON_SIZE + '. Reduce your \"text-size\".');\n }\n } else if (sizeData.kind === \"composite\") {\n textSizeData = [\n SIZE_PACK_FACTOR * sizes.compositeTextSizes[0].evaluate(feature, {}, canonical),\n SIZE_PACK_FACTOR * sizes.compositeTextSizes[1].evaluate(feature, {}, canonical)\n ];\n if (textSizeData[0] > MAX_PACKED_SIZE || textSizeData[1] > MAX_PACKED_SIZE) {\n warnOnce(bucket.layerIds[0] + ': Value for \"text-size\" is >= ' + MAX_GLYPH_ICON_SIZE + '. Reduce your \"text-size\".');\n }\n }\n bucket.addSymbols(bucket.text, glyphQuads, textSizeData, textOffset, textAlongLine, feature, writingMode, anchor, lineArray.lineStartIndex, lineArray.lineLength, placedIconIndex, canonical);\n for (var i = 0, list = placementTypes; i < list.length; i += 1) {\n var placementType = list[i];\n placedTextSymbolIndices[placementType] = bucket.text.placedSymbolArray.length - 1;\n }\n return glyphQuads.length * 4;\n }\n function getDefaultHorizontalShaping(horizontalShaping) {\n for (var justification in horizontalShaping) {\n return horizontalShaping[justification];\n }\n return null;\n }\n function addSymbol(bucket, anchor, line, shapedTextOrientations, shapedIcon, imageMap, verticallyShapedIcon, layer2, collisionBoxArray, featureIndex, sourceLayerIndex, bucketIndex, textBoxScale, textPadding, textAlongLine, textOffset, iconBoxScale, iconPadding, iconAlongLine, iconOffset, feature, sizes, isSDFIcon, canonical, layoutTextSize) {\n var assign;\n var lineArray = bucket.addToLineVertexArray(anchor, line);\n var textCollisionFeature, iconCollisionFeature, verticalTextCollisionFeature, verticalIconCollisionFeature;\n var numIconVertices = 0;\n var numVerticalIconVertices = 0;\n var numHorizontalGlyphVertices = 0;\n var numVerticalGlyphVertices = 0;\n var placedIconSymbolIndex = -1;\n var verticalPlacedIconSymbolIndex = -1;\n var placedTextSymbolIndices = {};\n var key = murmurhashJs(\"\");\n var textOffset0 = 0;\n var textOffset1 = 0;\n if (layer2._unevaluatedLayout.getValue(\"text-radial-offset\") === void 0) {\n assign = layer2.layout.get(\"text-offset\").evaluate(feature, {}, canonical).map(function(t) {\n return t * ONE_EM;\n }), textOffset0 = assign[0], textOffset1 = assign[1];\n } else {\n textOffset0 = layer2.layout.get(\"text-radial-offset\").evaluate(feature, {}, canonical) * ONE_EM;\n textOffset1 = INVALID_TEXT_OFFSET;\n }\n if (bucket.allowVerticalPlacement && shapedTextOrientations.vertical) {\n var textRotation = layer2.layout.get(\"text-rotate\").evaluate(feature, {}, canonical);\n var verticalTextRotation = textRotation + 90;\n var verticalShaping = shapedTextOrientations.vertical;\n verticalTextCollisionFeature = new CollisionFeature(collisionBoxArray, anchor, featureIndex, sourceLayerIndex, bucketIndex, verticalShaping, textBoxScale, textPadding, textAlongLine, verticalTextRotation);\n if (verticallyShapedIcon) {\n verticalIconCollisionFeature = new CollisionFeature(collisionBoxArray, anchor, featureIndex, sourceLayerIndex, bucketIndex, verticallyShapedIcon, iconBoxScale, iconPadding, textAlongLine, verticalTextRotation);\n }\n }\n if (shapedIcon) {\n var iconRotate = layer2.layout.get(\"icon-rotate\").evaluate(feature, {});\n var hasIconTextFit = layer2.layout.get(\"icon-text-fit\") !== \"none\";\n var iconQuads = getIconQuads(shapedIcon, iconRotate, isSDFIcon, hasIconTextFit);\n var verticalIconQuads = verticallyShapedIcon ? getIconQuads(verticallyShapedIcon, iconRotate, isSDFIcon, hasIconTextFit) : void 0;\n iconCollisionFeature = new CollisionFeature(collisionBoxArray, anchor, featureIndex, sourceLayerIndex, bucketIndex, shapedIcon, iconBoxScale, iconPadding, false, iconRotate);\n numIconVertices = iconQuads.length * 4;\n var sizeData = bucket.iconSizeData;\n var iconSizeData = null;\n if (sizeData.kind === \"source\") {\n iconSizeData = [SIZE_PACK_FACTOR * layer2.layout.get(\"icon-size\").evaluate(feature, {})];\n if (iconSizeData[0] > MAX_PACKED_SIZE) {\n warnOnce(bucket.layerIds[0] + ': Value for \"icon-size\" is >= ' + MAX_GLYPH_ICON_SIZE + '. Reduce your \"icon-size\".');\n }\n } else if (sizeData.kind === \"composite\") {\n iconSizeData = [\n SIZE_PACK_FACTOR * sizes.compositeIconSizes[0].evaluate(feature, {}, canonical),\n SIZE_PACK_FACTOR * sizes.compositeIconSizes[1].evaluate(feature, {}, canonical)\n ];\n if (iconSizeData[0] > MAX_PACKED_SIZE || iconSizeData[1] > MAX_PACKED_SIZE) {\n warnOnce(bucket.layerIds[0] + ': Value for \"icon-size\" is >= ' + MAX_GLYPH_ICON_SIZE + '. Reduce your \"icon-size\".');\n }\n }\n bucket.addSymbols(bucket.icon, iconQuads, iconSizeData, iconOffset, iconAlongLine, feature, false, anchor, lineArray.lineStartIndex, lineArray.lineLength, -1, canonical);\n placedIconSymbolIndex = bucket.icon.placedSymbolArray.length - 1;\n if (verticalIconQuads) {\n numVerticalIconVertices = verticalIconQuads.length * 4;\n bucket.addSymbols(bucket.icon, verticalIconQuads, iconSizeData, iconOffset, iconAlongLine, feature, WritingMode.vertical, anchor, lineArray.lineStartIndex, lineArray.lineLength, -1, canonical);\n verticalPlacedIconSymbolIndex = bucket.icon.placedSymbolArray.length - 1;\n }\n }\n for (var justification in shapedTextOrientations.horizontal) {\n var shaping = shapedTextOrientations.horizontal[justification];\n if (!textCollisionFeature) {\n key = murmurhashJs(shaping.text);\n var textRotate = layer2.layout.get(\"text-rotate\").evaluate(feature, {}, canonical);\n textCollisionFeature = new CollisionFeature(collisionBoxArray, anchor, featureIndex, sourceLayerIndex, bucketIndex, shaping, textBoxScale, textPadding, textAlongLine, textRotate);\n }\n var singleLine = shaping.positionedLines.length === 1;\n numHorizontalGlyphVertices += addTextVertices(bucket, anchor, shaping, imageMap, layer2, textAlongLine, feature, textOffset, lineArray, shapedTextOrientations.vertical ? WritingMode.horizontal : WritingMode.horizontalOnly, singleLine ? Object.keys(shapedTextOrientations.horizontal) : [justification], placedTextSymbolIndices, placedIconSymbolIndex, sizes, canonical);\n if (singleLine) {\n break;\n }\n }\n if (shapedTextOrientations.vertical) {\n numVerticalGlyphVertices += addTextVertices(bucket, anchor, shapedTextOrientations.vertical, imageMap, layer2, textAlongLine, feature, textOffset, lineArray, WritingMode.vertical, [\"vertical\"], placedTextSymbolIndices, verticalPlacedIconSymbolIndex, sizes, canonical);\n }\n var textBoxStartIndex = textCollisionFeature ? textCollisionFeature.boxStartIndex : bucket.collisionBoxArray.length;\n var textBoxEndIndex = textCollisionFeature ? textCollisionFeature.boxEndIndex : bucket.collisionBoxArray.length;\n var verticalTextBoxStartIndex = verticalTextCollisionFeature ? verticalTextCollisionFeature.boxStartIndex : bucket.collisionBoxArray.length;\n var verticalTextBoxEndIndex = verticalTextCollisionFeature ? verticalTextCollisionFeature.boxEndIndex : bucket.collisionBoxArray.length;\n var iconBoxStartIndex = iconCollisionFeature ? iconCollisionFeature.boxStartIndex : bucket.collisionBoxArray.length;\n var iconBoxEndIndex = iconCollisionFeature ? iconCollisionFeature.boxEndIndex : bucket.collisionBoxArray.length;\n var verticalIconBoxStartIndex = verticalIconCollisionFeature ? verticalIconCollisionFeature.boxStartIndex : bucket.collisionBoxArray.length;\n var verticalIconBoxEndIndex = verticalIconCollisionFeature ? verticalIconCollisionFeature.boxEndIndex : bucket.collisionBoxArray.length;\n var collisionCircleDiameter = -1;\n var getCollisionCircleHeight = function(feature2, prevHeight) {\n if (feature2 && feature2.circleDiameter) {\n return Math.max(feature2.circleDiameter, prevHeight);\n }\n return prevHeight;\n };\n collisionCircleDiameter = getCollisionCircleHeight(textCollisionFeature, collisionCircleDiameter);\n collisionCircleDiameter = getCollisionCircleHeight(verticalTextCollisionFeature, collisionCircleDiameter);\n collisionCircleDiameter = getCollisionCircleHeight(iconCollisionFeature, collisionCircleDiameter);\n collisionCircleDiameter = getCollisionCircleHeight(verticalIconCollisionFeature, collisionCircleDiameter);\n var useRuntimeCollisionCircles = collisionCircleDiameter > -1 ? 1 : 0;\n if (useRuntimeCollisionCircles) {\n collisionCircleDiameter *= layoutTextSize / ONE_EM;\n }\n if (bucket.glyphOffsetArray.length >= SymbolBucket.MAX_GLYPHS) {\n warnOnce(\"Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907\");\n }\n if (feature.sortKey !== void 0) {\n bucket.addToSortKeyRanges(bucket.symbolInstances.length, feature.sortKey);\n }\n bucket.symbolInstances.emplaceBack(anchor.x, anchor.y, placedTextSymbolIndices.right >= 0 ? placedTextSymbolIndices.right : -1, placedTextSymbolIndices.center >= 0 ? placedTextSymbolIndices.center : -1, placedTextSymbolIndices.left >= 0 ? placedTextSymbolIndices.left : -1, placedTextSymbolIndices.vertical || -1, placedIconSymbolIndex, verticalPlacedIconSymbolIndex, key, textBoxStartIndex, textBoxEndIndex, verticalTextBoxStartIndex, verticalTextBoxEndIndex, iconBoxStartIndex, iconBoxEndIndex, verticalIconBoxStartIndex, verticalIconBoxEndIndex, featureIndex, numHorizontalGlyphVertices, numVerticalGlyphVertices, numIconVertices, numVerticalIconVertices, useRuntimeCollisionCircles, 0, textBoxScale, textOffset0, textOffset1, collisionCircleDiameter);\n }\n function anchorIsTooClose(bucket, text, repeatDistance, anchor) {\n var compareText = bucket.compareText;\n if (!(text in compareText)) {\n compareText[text] = [];\n } else {\n var otherAnchors = compareText[text];\n for (var k = otherAnchors.length - 1; k >= 0; k--) {\n if (anchor.dist(otherAnchors[k]) < repeatDistance) {\n return true;\n }\n }\n }\n compareText[text].push(anchor);\n return false;\n }\n var vectorTileFeatureTypes$2 = vectorTile.VectorTileFeature.types;\n var shaderOpacityAttributes = [{\n name: \"a_fade_opacity\",\n components: 1,\n type: \"Uint8\",\n offset: 0\n }];\n function addVertex$1(array2, anchorX, anchorY, ox, oy, tx, ty, sizeVertex, isSDF, pixelOffsetX, pixelOffsetY, minFontScaleX, minFontScaleY) {\n var aSizeX = sizeVertex ? Math.min(MAX_PACKED_SIZE, Math.round(sizeVertex[0])) : 0;\n var aSizeY = sizeVertex ? Math.min(MAX_PACKED_SIZE, Math.round(sizeVertex[1])) : 0;\n array2.emplaceBack(anchorX, anchorY, Math.round(ox * 32), Math.round(oy * 32), tx, ty, (aSizeX << 1) + (isSDF ? 1 : 0), aSizeY, pixelOffsetX * 16, pixelOffsetY * 16, minFontScaleX * 256, minFontScaleY * 256);\n }\n function addDynamicAttributes(dynamicLayoutVertexArray, p, angle) {\n dynamicLayoutVertexArray.emplaceBack(p.x, p.y, angle);\n dynamicLayoutVertexArray.emplaceBack(p.x, p.y, angle);\n dynamicLayoutVertexArray.emplaceBack(p.x, p.y, angle);\n dynamicLayoutVertexArray.emplaceBack(p.x, p.y, angle);\n }\n function containsRTLText(formattedText) {\n for (var i = 0, list = formattedText.sections; i < list.length; i += 1) {\n var section = list[i];\n if (stringContainsRTLText(section.text)) {\n return true;\n }\n }\n return false;\n }\n var SymbolBuffers = function SymbolBuffers2(programConfigurations) {\n this.layoutVertexArray = new StructArrayLayout4i4ui4i24();\n this.indexArray = new StructArrayLayout3ui6();\n this.programConfigurations = programConfigurations;\n this.segments = new SegmentVector();\n this.dynamicLayoutVertexArray = new StructArrayLayout3f12();\n this.opacityVertexArray = new StructArrayLayout1ul4();\n this.placedSymbolArray = new PlacedSymbolArray();\n };\n SymbolBuffers.prototype.isEmpty = function isEmpty2() {\n return this.layoutVertexArray.length === 0 && this.indexArray.length === 0 && this.dynamicLayoutVertexArray.length === 0 && this.opacityVertexArray.length === 0;\n };\n SymbolBuffers.prototype.upload = function upload(context, dynamicIndexBuffer, upload$1, update) {\n if (this.isEmpty()) {\n return;\n }\n if (upload$1) {\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, symbolLayoutAttributes.members);\n this.indexBuffer = context.createIndexBuffer(this.indexArray, dynamicIndexBuffer);\n this.dynamicLayoutVertexBuffer = context.createVertexBuffer(this.dynamicLayoutVertexArray, dynamicLayoutAttributes.members, true);\n this.opacityVertexBuffer = context.createVertexBuffer(this.opacityVertexArray, shaderOpacityAttributes, true);\n this.opacityVertexBuffer.itemSize = 1;\n }\n if (upload$1 || update) {\n this.programConfigurations.upload(context);\n }\n };\n SymbolBuffers.prototype.destroy = function destroy() {\n if (!this.layoutVertexBuffer) {\n return;\n }\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.programConfigurations.destroy();\n this.segments.destroy();\n this.dynamicLayoutVertexBuffer.destroy();\n this.opacityVertexBuffer.destroy();\n };\n register(\"SymbolBuffers\", SymbolBuffers);\n var CollisionBuffers = function CollisionBuffers2(LayoutArray, layoutAttributes, IndexArray) {\n this.layoutVertexArray = new LayoutArray();\n this.layoutAttributes = layoutAttributes;\n this.indexArray = new IndexArray();\n this.segments = new SegmentVector();\n this.collisionVertexArray = new StructArrayLayout2ub2f12();\n };\n CollisionBuffers.prototype.upload = function upload(context) {\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, this.layoutAttributes);\n this.indexBuffer = context.createIndexBuffer(this.indexArray);\n this.collisionVertexBuffer = context.createVertexBuffer(this.collisionVertexArray, collisionVertexAttributes.members, true);\n };\n CollisionBuffers.prototype.destroy = function destroy() {\n if (!this.layoutVertexBuffer) {\n return;\n }\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.segments.destroy();\n this.collisionVertexBuffer.destroy();\n };\n register(\"CollisionBuffers\", CollisionBuffers);\n var SymbolBucket = function SymbolBucket2(options) {\n this.collisionBoxArray = options.collisionBoxArray;\n this.zoom = options.zoom;\n this.overscaling = options.overscaling;\n this.layers = options.layers;\n this.layerIds = this.layers.map(function(layer3) {\n return layer3.id;\n });\n this.index = options.index;\n this.pixelRatio = options.pixelRatio;\n this.sourceLayerIndex = options.sourceLayerIndex;\n this.hasPattern = false;\n this.hasRTLText = false;\n this.sortKeyRanges = [];\n this.collisionCircleArray = [];\n this.placementInvProjMatrix = identity2([]);\n this.placementViewportMatrix = identity2([]);\n var layer2 = this.layers[0];\n var unevaluatedLayoutValues = layer2._unevaluatedLayout._values;\n this.textSizeData = getSizeData(this.zoom, unevaluatedLayoutValues[\"text-size\"]);\n this.iconSizeData = getSizeData(this.zoom, unevaluatedLayoutValues[\"icon-size\"]);\n var layout2 = this.layers[0].layout;\n var sortKey = layout2.get(\"symbol-sort-key\");\n var zOrder2 = layout2.get(\"symbol-z-order\");\n this.canOverlap = layout2.get(\"text-allow-overlap\") || layout2.get(\"icon-allow-overlap\") || layout2.get(\"text-ignore-placement\") || layout2.get(\"icon-ignore-placement\");\n this.sortFeaturesByKey = zOrder2 !== \"viewport-y\" && sortKey.constantOr(1) !== void 0;\n var zOrderByViewportY = zOrder2 === \"viewport-y\" || zOrder2 === \"auto\" && !this.sortFeaturesByKey;\n this.sortFeaturesByY = zOrderByViewportY && this.canOverlap;\n if (layout2.get(\"symbol-placement\") === \"point\") {\n this.writingModes = layout2.get(\"text-writing-mode\").map(function(wm) {\n return WritingMode[wm];\n });\n }\n this.stateDependentLayerIds = this.layers.filter(function(l) {\n return l.isStateDependent();\n }).map(function(l) {\n return l.id;\n });\n this.sourceID = options.sourceID;\n };\n SymbolBucket.prototype.createArrays = function createArrays() {\n this.text = new SymbolBuffers(new ProgramConfigurationSet(this.layers, this.zoom, function(property) {\n return /^text/.test(property);\n }));\n this.icon = new SymbolBuffers(new ProgramConfigurationSet(this.layers, this.zoom, function(property) {\n return /^icon/.test(property);\n }));\n this.glyphOffsetArray = new GlyphOffsetArray();\n this.lineVertexArray = new SymbolLineVertexArray();\n this.symbolInstances = new SymbolInstanceArray();\n };\n SymbolBucket.prototype.calculateGlyphDependencies = function calculateGlyphDependencies(text, stack, textAlongLine, allowVerticalPlacement, doesAllowVerticalWritingMode) {\n for (var i = 0; i < text.length; i++) {\n stack[text.charCodeAt(i)] = true;\n if ((textAlongLine || allowVerticalPlacement) && doesAllowVerticalWritingMode) {\n var verticalChar = verticalizedCharacterMap[text.charAt(i)];\n if (verticalChar) {\n stack[verticalChar.charCodeAt(0)] = true;\n }\n }\n }\n };\n SymbolBucket.prototype.populate = function populate(features, options, canonical) {\n var layer2 = this.layers[0];\n var layout2 = layer2.layout;\n var textFont = layout2.get(\"text-font\");\n var textField = layout2.get(\"text-field\");\n var iconImage = layout2.get(\"icon-image\");\n var hasText = (textField.value.kind !== \"constant\" || textField.value.value instanceof Formatted && !textField.value.value.isEmpty() || textField.value.value.toString().length > 0) && (textFont.value.kind !== \"constant\" || textFont.value.value.length > 0);\n var hasIcon = iconImage.value.kind !== \"constant\" || !!iconImage.value.value || Object.keys(iconImage.parameters).length > 0;\n var symbolSortKey = layout2.get(\"symbol-sort-key\");\n this.features = [];\n if (!hasText && !hasIcon) {\n return;\n }\n var icons = options.iconDependencies;\n var stacks = options.glyphDependencies;\n var availableImages = options.availableImages;\n var globalProperties = new EvaluationParameters(this.zoom);\n for (var i$1 = 0, list$1 = features; i$1 < list$1.length; i$1 += 1) {\n var ref = list$1[i$1];\n var feature = ref.feature;\n var id2 = ref.id;\n var index = ref.index;\n var sourceLayerIndex = ref.sourceLayerIndex;\n var needGeometry = layer2._featureFilter.needGeometry;\n var evaluationFeature = toEvaluationFeature(feature, needGeometry);\n if (!layer2._featureFilter.filter(globalProperties, evaluationFeature, canonical)) {\n continue;\n }\n if (!needGeometry) {\n evaluationFeature.geometry = loadGeometry(feature);\n }\n var text = void 0;\n if (hasText) {\n var resolvedTokens = layer2.getValueAndResolveTokens(\"text-field\", evaluationFeature, canonical, availableImages);\n var formattedText = Formatted.factory(resolvedTokens);\n if (containsRTLText(formattedText)) {\n this.hasRTLText = true;\n }\n if (!this.hasRTLText || getRTLTextPluginStatus() === \"unavailable\" || this.hasRTLText && plugin.isParsed()) {\n text = transformText$1(formattedText, layer2, evaluationFeature);\n }\n }\n var icon = void 0;\n if (hasIcon) {\n var resolvedTokens$1 = layer2.getValueAndResolveTokens(\"icon-image\", evaluationFeature, canonical, availableImages);\n if (resolvedTokens$1 instanceof ResolvedImage) {\n icon = resolvedTokens$1;\n } else {\n icon = ResolvedImage.fromString(resolvedTokens$1);\n }\n }\n if (!text && !icon) {\n continue;\n }\n var sortKey = this.sortFeaturesByKey ? symbolSortKey.evaluate(evaluationFeature, {}, canonical) : void 0;\n var symbolFeature = {\n id: id2,\n text,\n icon,\n index,\n sourceLayerIndex,\n geometry: evaluationFeature.geometry,\n properties: feature.properties,\n type: vectorTileFeatureTypes$2[feature.type],\n sortKey\n };\n this.features.push(symbolFeature);\n if (icon) {\n icons[icon.name] = true;\n }\n if (text) {\n var fontStack = textFont.evaluate(evaluationFeature, {}, canonical).join(\",\");\n var textAlongLine = layout2.get(\"text-rotation-alignment\") === \"map\" && layout2.get(\"symbol-placement\") !== \"point\";\n this.allowVerticalPlacement = this.writingModes && this.writingModes.indexOf(WritingMode.vertical) >= 0;\n for (var i = 0, list = text.sections; i < list.length; i += 1) {\n var section = list[i];\n if (!section.image) {\n var doesAllowVerticalWritingMode = allowsVerticalWritingMode(text.toString());\n var sectionFont = section.fontStack || fontStack;\n var sectionStack = stacks[sectionFont] = stacks[sectionFont] || {};\n this.calculateGlyphDependencies(section.text, sectionStack, textAlongLine, this.allowVerticalPlacement, doesAllowVerticalWritingMode);\n } else {\n icons[section.image.name] = true;\n }\n }\n }\n }\n if (layout2.get(\"symbol-placement\") === \"line\") {\n this.features = mergeLines(this.features);\n }\n if (this.sortFeaturesByKey) {\n this.features.sort(function(a, b) {\n return a.sortKey - b.sortKey;\n });\n }\n };\n SymbolBucket.prototype.update = function update(states, vtLayer, imagePositions) {\n if (!this.stateDependentLayers.length) {\n return;\n }\n this.text.programConfigurations.updatePaintArrays(states, vtLayer, this.layers, imagePositions);\n this.icon.programConfigurations.updatePaintArrays(states, vtLayer, this.layers, imagePositions);\n };\n SymbolBucket.prototype.isEmpty = function isEmpty2() {\n return this.symbolInstances.length === 0 && !this.hasRTLText;\n };\n SymbolBucket.prototype.uploadPending = function uploadPending() {\n return !this.uploaded || this.text.programConfigurations.needsUpload || this.icon.programConfigurations.needsUpload;\n };\n SymbolBucket.prototype.upload = function upload(context) {\n if (!this.uploaded && this.hasDebugData()) {\n this.textCollisionBox.upload(context);\n this.iconCollisionBox.upload(context);\n }\n this.text.upload(context, this.sortFeaturesByY, !this.uploaded, this.text.programConfigurations.needsUpload);\n this.icon.upload(context, this.sortFeaturesByY, !this.uploaded, this.icon.programConfigurations.needsUpload);\n this.uploaded = true;\n };\n SymbolBucket.prototype.destroyDebugData = function destroyDebugData() {\n this.textCollisionBox.destroy();\n this.iconCollisionBox.destroy();\n };\n SymbolBucket.prototype.destroy = function destroy() {\n this.text.destroy();\n this.icon.destroy();\n if (this.hasDebugData()) {\n this.destroyDebugData();\n }\n };\n SymbolBucket.prototype.addToLineVertexArray = function addToLineVertexArray(anchor, line) {\n var lineStartIndex = this.lineVertexArray.length;\n if (anchor.segment !== void 0) {\n var sumForwardLength = anchor.dist(line[anchor.segment + 1]);\n var sumBackwardLength = anchor.dist(line[anchor.segment]);\n var vertices = {};\n for (var i = anchor.segment + 1; i < line.length; i++) {\n vertices[i] = {\n x: line[i].x,\n y: line[i].y,\n tileUnitDistanceFromAnchor: sumForwardLength\n };\n if (i < line.length - 1) {\n sumForwardLength += line[i + 1].dist(line[i]);\n }\n }\n for (var i$1 = anchor.segment || 0; i$1 >= 0; i$1--) {\n vertices[i$1] = {\n x: line[i$1].x,\n y: line[i$1].y,\n tileUnitDistanceFromAnchor: sumBackwardLength\n };\n if (i$1 > 0) {\n sumBackwardLength += line[i$1 - 1].dist(line[i$1]);\n }\n }\n for (var i$2 = 0; i$2 < line.length; i$2++) {\n var vertex = vertices[i$2];\n this.lineVertexArray.emplaceBack(vertex.x, vertex.y, vertex.tileUnitDistanceFromAnchor);\n }\n }\n return {\n lineStartIndex,\n lineLength: this.lineVertexArray.length - lineStartIndex\n };\n };\n SymbolBucket.prototype.addSymbols = function addSymbols(arrays, quads, sizeVertex, lineOffset, alongLine, feature, writingMode, labelAnchor, lineStartIndex, lineLength, associatedIconIndex, canonical) {\n var indexArray = arrays.indexArray;\n var layoutVertexArray = arrays.layoutVertexArray;\n var segment = arrays.segments.prepareSegment(4 * quads.length, layoutVertexArray, indexArray, this.canOverlap ? feature.sortKey : void 0);\n var glyphOffsetArrayStart = this.glyphOffsetArray.length;\n var vertexStartIndex = segment.vertexLength;\n var angle = this.allowVerticalPlacement && writingMode === WritingMode.vertical ? Math.PI / 2 : 0;\n var sections = feature.text && feature.text.sections;\n for (var i = 0; i < quads.length; i++) {\n var ref = quads[i];\n var tl = ref.tl;\n var tr = ref.tr;\n var bl = ref.bl;\n var br = ref.br;\n var tex = ref.tex;\n var pixelOffsetTL = ref.pixelOffsetTL;\n var pixelOffsetBR = ref.pixelOffsetBR;\n var minFontScaleX = ref.minFontScaleX;\n var minFontScaleY = ref.minFontScaleY;\n var glyphOffset2 = ref.glyphOffset;\n var isSDF = ref.isSDF;\n var sectionIndex = ref.sectionIndex;\n var index = segment.vertexLength;\n var y = glyphOffset2[1];\n addVertex$1(layoutVertexArray, labelAnchor.x, labelAnchor.y, tl.x, y + tl.y, tex.x, tex.y, sizeVertex, isSDF, pixelOffsetTL.x, pixelOffsetTL.y, minFontScaleX, minFontScaleY);\n addVertex$1(layoutVertexArray, labelAnchor.x, labelAnchor.y, tr.x, y + tr.y, tex.x + tex.w, tex.y, sizeVertex, isSDF, pixelOffsetBR.x, pixelOffsetTL.y, minFontScaleX, minFontScaleY);\n addVertex$1(layoutVertexArray, labelAnchor.x, labelAnchor.y, bl.x, y + bl.y, tex.x, tex.y + tex.h, sizeVertex, isSDF, pixelOffsetTL.x, pixelOffsetBR.y, minFontScaleX, minFontScaleY);\n addVertex$1(layoutVertexArray, labelAnchor.x, labelAnchor.y, br.x, y + br.y, tex.x + tex.w, tex.y + tex.h, sizeVertex, isSDF, pixelOffsetBR.x, pixelOffsetBR.y, minFontScaleX, minFontScaleY);\n addDynamicAttributes(arrays.dynamicLayoutVertexArray, labelAnchor, angle);\n indexArray.emplaceBack(index, index + 1, index + 2);\n indexArray.emplaceBack(index + 1, index + 2, index + 3);\n segment.vertexLength += 4;\n segment.primitiveLength += 2;\n this.glyphOffsetArray.emplaceBack(glyphOffset2[0]);\n if (i === quads.length - 1 || sectionIndex !== quads[i + 1].sectionIndex) {\n arrays.programConfigurations.populatePaintArrays(layoutVertexArray.length, feature, feature.index, {}, canonical, sections && sections[sectionIndex]);\n }\n }\n arrays.placedSymbolArray.emplaceBack(labelAnchor.x, labelAnchor.y, glyphOffsetArrayStart, this.glyphOffsetArray.length - glyphOffsetArrayStart, vertexStartIndex, lineStartIndex, lineLength, labelAnchor.segment, sizeVertex ? sizeVertex[0] : 0, sizeVertex ? sizeVertex[1] : 0, lineOffset[0], lineOffset[1], writingMode, 0, false, 0, associatedIconIndex);\n };\n SymbolBucket.prototype._addCollisionDebugVertex = function _addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, point, anchorX, anchorY, extrude) {\n collisionVertexArray.emplaceBack(0, 0);\n return layoutVertexArray.emplaceBack(point.x, point.y, anchorX, anchorY, Math.round(extrude.x), Math.round(extrude.y));\n };\n SymbolBucket.prototype.addCollisionDebugVertices = function addCollisionDebugVertices(x1, y1, x2, y2, arrays, boxAnchorPoint, symbolInstance2) {\n var segment = arrays.segments.prepareSegment(4, arrays.layoutVertexArray, arrays.indexArray);\n var index = segment.vertexLength;\n var layoutVertexArray = arrays.layoutVertexArray;\n var collisionVertexArray = arrays.collisionVertexArray;\n var anchorX = symbolInstance2.anchorX;\n var anchorY = symbolInstance2.anchorY;\n this._addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, boxAnchorPoint, anchorX, anchorY, new pointGeometry(x1, y1));\n this._addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, boxAnchorPoint, anchorX, anchorY, new pointGeometry(x2, y1));\n this._addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, boxAnchorPoint, anchorX, anchorY, new pointGeometry(x2, y2));\n this._addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, boxAnchorPoint, anchorX, anchorY, new pointGeometry(x1, y2));\n segment.vertexLength += 4;\n var indexArray = arrays.indexArray;\n indexArray.emplaceBack(index, index + 1);\n indexArray.emplaceBack(index + 1, index + 2);\n indexArray.emplaceBack(index + 2, index + 3);\n indexArray.emplaceBack(index + 3, index);\n segment.primitiveLength += 4;\n };\n SymbolBucket.prototype.addDebugCollisionBoxes = function addDebugCollisionBoxes(startIndex, endIndex, symbolInstance2, isText) {\n for (var b = startIndex; b < endIndex; b++) {\n var box = this.collisionBoxArray.get(b);\n var x1 = box.x1;\n var y1 = box.y1;\n var x2 = box.x2;\n var y2 = box.y2;\n this.addCollisionDebugVertices(x1, y1, x2, y2, isText ? this.textCollisionBox : this.iconCollisionBox, box.anchorPoint, symbolInstance2);\n }\n };\n SymbolBucket.prototype.generateCollisionDebugBuffers = function generateCollisionDebugBuffers() {\n if (this.hasDebugData()) {\n this.destroyDebugData();\n }\n this.textCollisionBox = new CollisionBuffers(StructArrayLayout2i2i2i12, collisionBoxLayout.members, StructArrayLayout2ui4);\n this.iconCollisionBox = new CollisionBuffers(StructArrayLayout2i2i2i12, collisionBoxLayout.members, StructArrayLayout2ui4);\n for (var i = 0; i < this.symbolInstances.length; i++) {\n var symbolInstance2 = this.symbolInstances.get(i);\n this.addDebugCollisionBoxes(symbolInstance2.textBoxStartIndex, symbolInstance2.textBoxEndIndex, symbolInstance2, true);\n this.addDebugCollisionBoxes(symbolInstance2.verticalTextBoxStartIndex, symbolInstance2.verticalTextBoxEndIndex, symbolInstance2, true);\n this.addDebugCollisionBoxes(symbolInstance2.iconBoxStartIndex, symbolInstance2.iconBoxEndIndex, symbolInstance2, false);\n this.addDebugCollisionBoxes(symbolInstance2.verticalIconBoxStartIndex, symbolInstance2.verticalIconBoxEndIndex, symbolInstance2, false);\n }\n };\n SymbolBucket.prototype._deserializeCollisionBoxesForSymbol = function _deserializeCollisionBoxesForSymbol(collisionBoxArray, textStartIndex, textEndIndex, verticalTextStartIndex, verticalTextEndIndex, iconStartIndex, iconEndIndex, verticalIconStartIndex, verticalIconEndIndex) {\n var collisionArrays = {};\n for (var k = textStartIndex; k < textEndIndex; k++) {\n var box = collisionBoxArray.get(k);\n collisionArrays.textBox = {\n x1: box.x1,\n y1: box.y1,\n x2: box.x2,\n y2: box.y2,\n anchorPointX: box.anchorPointX,\n anchorPointY: box.anchorPointY\n };\n collisionArrays.textFeatureIndex = box.featureIndex;\n break;\n }\n for (var k$1 = verticalTextStartIndex; k$1 < verticalTextEndIndex; k$1++) {\n var box$1 = collisionBoxArray.get(k$1);\n collisionArrays.verticalTextBox = {\n x1: box$1.x1,\n y1: box$1.y1,\n x2: box$1.x2,\n y2: box$1.y2,\n anchorPointX: box$1.anchorPointX,\n anchorPointY: box$1.anchorPointY\n };\n collisionArrays.verticalTextFeatureIndex = box$1.featureIndex;\n break;\n }\n for (var k$2 = iconStartIndex; k$2 < iconEndIndex; k$2++) {\n var box$2 = collisionBoxArray.get(k$2);\n collisionArrays.iconBox = {\n x1: box$2.x1,\n y1: box$2.y1,\n x2: box$2.x2,\n y2: box$2.y2,\n anchorPointX: box$2.anchorPointX,\n anchorPointY: box$2.anchorPointY\n };\n collisionArrays.iconFeatureIndex = box$2.featureIndex;\n break;\n }\n for (var k$3 = verticalIconStartIndex; k$3 < verticalIconEndIndex; k$3++) {\n var box$3 = collisionBoxArray.get(k$3);\n collisionArrays.verticalIconBox = {\n x1: box$3.x1,\n y1: box$3.y1,\n x2: box$3.x2,\n y2: box$3.y2,\n anchorPointX: box$3.anchorPointX,\n anchorPointY: box$3.anchorPointY\n };\n collisionArrays.verticalIconFeatureIndex = box$3.featureIndex;\n break;\n }\n return collisionArrays;\n };\n SymbolBucket.prototype.deserializeCollisionBoxes = function deserializeCollisionBoxes(collisionBoxArray) {\n this.collisionArrays = [];\n for (var i = 0; i < this.symbolInstances.length; i++) {\n var symbolInstance2 = this.symbolInstances.get(i);\n this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(collisionBoxArray, symbolInstance2.textBoxStartIndex, symbolInstance2.textBoxEndIndex, symbolInstance2.verticalTextBoxStartIndex, symbolInstance2.verticalTextBoxEndIndex, symbolInstance2.iconBoxStartIndex, symbolInstance2.iconBoxEndIndex, symbolInstance2.verticalIconBoxStartIndex, symbolInstance2.verticalIconBoxEndIndex));\n }\n };\n SymbolBucket.prototype.hasTextData = function hasTextData() {\n return this.text.segments.get().length > 0;\n };\n SymbolBucket.prototype.hasIconData = function hasIconData() {\n return this.icon.segments.get().length > 0;\n };\n SymbolBucket.prototype.hasDebugData = function hasDebugData() {\n return this.textCollisionBox && this.iconCollisionBox;\n };\n SymbolBucket.prototype.hasTextCollisionBoxData = function hasTextCollisionBoxData() {\n return this.hasDebugData() && this.textCollisionBox.segments.get().length > 0;\n };\n SymbolBucket.prototype.hasIconCollisionBoxData = function hasIconCollisionBoxData() {\n return this.hasDebugData() && this.iconCollisionBox.segments.get().length > 0;\n };\n SymbolBucket.prototype.addIndicesForPlacedSymbol = function addIndicesForPlacedSymbol(iconOrText, placedSymbolIndex) {\n var placedSymbol = iconOrText.placedSymbolArray.get(placedSymbolIndex);\n var endIndex = placedSymbol.vertexStartIndex + placedSymbol.numGlyphs * 4;\n for (var vertexIndex = placedSymbol.vertexStartIndex; vertexIndex < endIndex; vertexIndex += 4) {\n iconOrText.indexArray.emplaceBack(vertexIndex, vertexIndex + 1, vertexIndex + 2);\n iconOrText.indexArray.emplaceBack(vertexIndex + 1, vertexIndex + 2, vertexIndex + 3);\n }\n };\n SymbolBucket.prototype.getSortedSymbolIndexes = function getSortedSymbolIndexes(angle) {\n if (this.sortedAngle === angle && this.symbolInstanceIndexes !== void 0) {\n return this.symbolInstanceIndexes;\n }\n var sin = Math.sin(angle);\n var cos = Math.cos(angle);\n var rotatedYs = [];\n var featureIndexes = [];\n var result = [];\n for (var i = 0; i < this.symbolInstances.length; ++i) {\n result.push(i);\n var symbolInstance2 = this.symbolInstances.get(i);\n rotatedYs.push(Math.round(sin * symbolInstance2.anchorX + cos * symbolInstance2.anchorY) | 0);\n featureIndexes.push(symbolInstance2.featureIndex);\n }\n result.sort(function(aIndex, bIndex) {\n return rotatedYs[aIndex] - rotatedYs[bIndex] || featureIndexes[bIndex] - featureIndexes[aIndex];\n });\n return result;\n };\n SymbolBucket.prototype.addToSortKeyRanges = function addToSortKeyRanges(symbolInstanceIndex, sortKey) {\n var last = this.sortKeyRanges[this.sortKeyRanges.length - 1];\n if (last && last.sortKey === sortKey) {\n last.symbolInstanceEnd = symbolInstanceIndex + 1;\n } else {\n this.sortKeyRanges.push({\n sortKey,\n symbolInstanceStart: symbolInstanceIndex,\n symbolInstanceEnd: symbolInstanceIndex + 1\n });\n }\n };\n SymbolBucket.prototype.sortFeatures = function sortFeatures(angle) {\n var this$1 = this;\n if (!this.sortFeaturesByY) {\n return;\n }\n if (this.sortedAngle === angle) {\n return;\n }\n if (this.text.segments.get().length > 1 || this.icon.segments.get().length > 1) {\n return;\n }\n this.symbolInstanceIndexes = this.getSortedSymbolIndexes(angle);\n this.sortedAngle = angle;\n this.text.indexArray.clear();\n this.icon.indexArray.clear();\n this.featureSortOrder = [];\n for (var i$1 = 0, list = this.symbolInstanceIndexes; i$1 < list.length; i$1 += 1) {\n var i = list[i$1];\n var symbolInstance2 = this.symbolInstances.get(i);\n this.featureSortOrder.push(symbolInstance2.featureIndex);\n [\n symbolInstance2.rightJustifiedTextSymbolIndex,\n symbolInstance2.centerJustifiedTextSymbolIndex,\n symbolInstance2.leftJustifiedTextSymbolIndex\n ].forEach(function(index, i2, array2) {\n if (index >= 0 && array2.indexOf(index) === i2) {\n this$1.addIndicesForPlacedSymbol(this$1.text, index);\n }\n });\n if (symbolInstance2.verticalPlacedTextSymbolIndex >= 0) {\n this.addIndicesForPlacedSymbol(this.text, symbolInstance2.verticalPlacedTextSymbolIndex);\n }\n if (symbolInstance2.placedIconSymbolIndex >= 0) {\n this.addIndicesForPlacedSymbol(this.icon, symbolInstance2.placedIconSymbolIndex);\n }\n if (symbolInstance2.verticalPlacedIconSymbolIndex >= 0) {\n this.addIndicesForPlacedSymbol(this.icon, symbolInstance2.verticalPlacedIconSymbolIndex);\n }\n }\n if (this.text.indexBuffer) {\n this.text.indexBuffer.updateData(this.text.indexArray);\n }\n if (this.icon.indexBuffer) {\n this.icon.indexBuffer.updateData(this.icon.indexArray);\n }\n };\n register(\"SymbolBucket\", SymbolBucket, {\n omit: [\n \"layers\",\n \"collisionBoxArray\",\n \"features\",\n \"compareText\"\n ]\n });\n SymbolBucket.MAX_GLYPHS = 65535;\n SymbolBucket.addDynamicAttributes = addDynamicAttributes;\n function resolveTokens(properties2, text) {\n return text.replace(/{([^{}]+)}/g, function(match, key) {\n return key in properties2 ? String(properties2[key]) : \"\";\n });\n }\n var layout$7 = new Properties({\n \"symbol-placement\": new DataConstantProperty(spec[\"layout_symbol\"][\"symbol-placement\"]),\n \"symbol-spacing\": new DataConstantProperty(spec[\"layout_symbol\"][\"symbol-spacing\"]),\n \"symbol-avoid-edges\": new DataConstantProperty(spec[\"layout_symbol\"][\"symbol-avoid-edges\"]),\n \"symbol-sort-key\": new DataDrivenProperty(spec[\"layout_symbol\"][\"symbol-sort-key\"]),\n \"symbol-z-order\": new DataConstantProperty(spec[\"layout_symbol\"][\"symbol-z-order\"]),\n \"icon-allow-overlap\": new DataConstantProperty(spec[\"layout_symbol\"][\"icon-allow-overlap\"]),\n \"icon-ignore-placement\": new DataConstantProperty(spec[\"layout_symbol\"][\"icon-ignore-placement\"]),\n \"icon-optional\": new DataConstantProperty(spec[\"layout_symbol\"][\"icon-optional\"]),\n \"icon-rotation-alignment\": new DataConstantProperty(spec[\"layout_symbol\"][\"icon-rotation-alignment\"]),\n \"icon-size\": new DataDrivenProperty(spec[\"layout_symbol\"][\"icon-size\"]),\n \"icon-text-fit\": new DataConstantProperty(spec[\"layout_symbol\"][\"icon-text-fit\"]),\n \"icon-text-fit-padding\": new DataConstantProperty(spec[\"layout_symbol\"][\"icon-text-fit-padding\"]),\n \"icon-image\": new DataDrivenProperty(spec[\"layout_symbol\"][\"icon-image\"]),\n \"icon-rotate\": new DataDrivenProperty(spec[\"layout_symbol\"][\"icon-rotate\"]),\n \"icon-padding\": new DataConstantProperty(spec[\"layout_symbol\"][\"icon-padding\"]),\n \"icon-keep-upright\": new DataConstantProperty(spec[\"layout_symbol\"][\"icon-keep-upright\"]),\n \"icon-offset\": new DataDrivenProperty(spec[\"layout_symbol\"][\"icon-offset\"]),\n \"icon-anchor\": new DataDrivenProperty(spec[\"layout_symbol\"][\"icon-anchor\"]),\n \"icon-pitch-alignment\": new DataConstantProperty(spec[\"layout_symbol\"][\"icon-pitch-alignment\"]),\n \"text-pitch-alignment\": new DataConstantProperty(spec[\"layout_symbol\"][\"text-pitch-alignment\"]),\n \"text-rotation-alignment\": new DataConstantProperty(spec[\"layout_symbol\"][\"text-rotation-alignment\"]),\n \"text-field\": new DataDrivenProperty(spec[\"layout_symbol\"][\"text-field\"]),\n \"text-font\": new DataDrivenProperty(spec[\"layout_symbol\"][\"text-font\"]),\n \"text-size\": new DataDrivenProperty(spec[\"layout_symbol\"][\"text-size\"]),\n \"text-max-width\": new DataDrivenProperty(spec[\"layout_symbol\"][\"text-max-width\"]),\n \"text-line-height\": new DataConstantProperty(spec[\"layout_symbol\"][\"text-line-height\"]),\n \"text-letter-spacing\": new DataDrivenProperty(spec[\"layout_symbol\"][\"text-letter-spacing\"]),\n \"text-justify\": new DataDrivenProperty(spec[\"layout_symbol\"][\"text-justify\"]),\n \"text-radial-offset\": new DataDrivenProperty(spec[\"layout_symbol\"][\"text-radial-offset\"]),\n \"text-variable-anchor\": new DataConstantProperty(spec[\"layout_symbol\"][\"text-variable-anchor\"]),\n \"text-anchor\": new DataDrivenProperty(spec[\"layout_symbol\"][\"text-anchor\"]),\n \"text-max-angle\": new DataConstantProperty(spec[\"layout_symbol\"][\"text-max-angle\"]),\n \"text-writing-mode\": new DataConstantProperty(spec[\"layout_symbol\"][\"text-writing-mode\"]),\n \"text-rotate\": new DataDrivenProperty(spec[\"layout_symbol\"][\"text-rotate\"]),\n \"text-padding\": new DataConstantProperty(spec[\"layout_symbol\"][\"text-padding\"]),\n \"text-keep-upright\": new DataConstantProperty(spec[\"layout_symbol\"][\"text-keep-upright\"]),\n \"text-transform\": new DataDrivenProperty(spec[\"layout_symbol\"][\"text-transform\"]),\n \"text-offset\": new DataDrivenProperty(spec[\"layout_symbol\"][\"text-offset\"]),\n \"text-allow-overlap\": new DataConstantProperty(spec[\"layout_symbol\"][\"text-allow-overlap\"]),\n \"text-ignore-placement\": new DataConstantProperty(spec[\"layout_symbol\"][\"text-ignore-placement\"]),\n \"text-optional\": new DataConstantProperty(spec[\"layout_symbol\"][\"text-optional\"])\n });\n var paint$7 = new Properties({\n \"icon-opacity\": new DataDrivenProperty(spec[\"paint_symbol\"][\"icon-opacity\"]),\n \"icon-color\": new DataDrivenProperty(spec[\"paint_symbol\"][\"icon-color\"]),\n \"icon-halo-color\": new DataDrivenProperty(spec[\"paint_symbol\"][\"icon-halo-color\"]),\n \"icon-halo-width\": new DataDrivenProperty(spec[\"paint_symbol\"][\"icon-halo-width\"]),\n \"icon-halo-blur\": new DataDrivenProperty(spec[\"paint_symbol\"][\"icon-halo-blur\"]),\n \"icon-translate\": new DataConstantProperty(spec[\"paint_symbol\"][\"icon-translate\"]),\n \"icon-translate-anchor\": new DataConstantProperty(spec[\"paint_symbol\"][\"icon-translate-anchor\"]),\n \"text-opacity\": new DataDrivenProperty(spec[\"paint_symbol\"][\"text-opacity\"]),\n \"text-color\": new DataDrivenProperty(spec[\"paint_symbol\"][\"text-color\"], {\n runtimeType: ColorType,\n getOverride: function(o) {\n return o.textColor;\n },\n hasOverride: function(o) {\n return !!o.textColor;\n }\n }),\n \"text-halo-color\": new DataDrivenProperty(spec[\"paint_symbol\"][\"text-halo-color\"]),\n \"text-halo-width\": new DataDrivenProperty(spec[\"paint_symbol\"][\"text-halo-width\"]),\n \"text-halo-blur\": new DataDrivenProperty(spec[\"paint_symbol\"][\"text-halo-blur\"]),\n \"text-translate\": new DataConstantProperty(spec[\"paint_symbol\"][\"text-translate\"]),\n \"text-translate-anchor\": new DataConstantProperty(spec[\"paint_symbol\"][\"text-translate-anchor\"])\n });\n var properties$6 = {\n paint: paint$7,\n layout: layout$7\n };\n var FormatSectionOverride = function FormatSectionOverride2(defaultValue) {\n this.type = defaultValue.property.overrides ? defaultValue.property.overrides.runtimeType : NullType;\n this.defaultValue = defaultValue;\n };\n FormatSectionOverride.prototype.evaluate = function evaluate(ctx) {\n if (ctx.formattedSection) {\n var overrides = this.defaultValue.property.overrides;\n if (overrides && overrides.hasOverride(ctx.formattedSection)) {\n return overrides.getOverride(ctx.formattedSection);\n }\n }\n if (ctx.feature && ctx.featureState) {\n return this.defaultValue.evaluate(ctx.feature, ctx.featureState);\n }\n return this.defaultValue.property.specification.default;\n };\n FormatSectionOverride.prototype.eachChild = function eachChild(fn) {\n if (!this.defaultValue.isConstant()) {\n var expr = this.defaultValue.value;\n fn(expr._styleExpression.expression);\n }\n };\n FormatSectionOverride.prototype.outputDefined = function outputDefined() {\n return false;\n };\n FormatSectionOverride.prototype.serialize = function serialize2() {\n return null;\n };\n register(\"FormatSectionOverride\", FormatSectionOverride, { omit: [\"defaultValue\"] });\n var SymbolStyleLayer = function(StyleLayer2) {\n function SymbolStyleLayer2(layer2) {\n StyleLayer2.call(this, layer2, properties$6);\n }\n if (StyleLayer2)\n SymbolStyleLayer2.__proto__ = StyleLayer2;\n SymbolStyleLayer2.prototype = Object.create(StyleLayer2 && StyleLayer2.prototype);\n SymbolStyleLayer2.prototype.constructor = SymbolStyleLayer2;\n SymbolStyleLayer2.prototype.recalculate = function recalculate(parameters, availableImages) {\n StyleLayer2.prototype.recalculate.call(this, parameters, availableImages);\n if (this.layout.get(\"icon-rotation-alignment\") === \"auto\") {\n if (this.layout.get(\"symbol-placement\") !== \"point\") {\n this.layout._values[\"icon-rotation-alignment\"] = \"map\";\n } else {\n this.layout._values[\"icon-rotation-alignment\"] = \"viewport\";\n }\n }\n if (this.layout.get(\"text-rotation-alignment\") === \"auto\") {\n if (this.layout.get(\"symbol-placement\") !== \"point\") {\n this.layout._values[\"text-rotation-alignment\"] = \"map\";\n } else {\n this.layout._values[\"text-rotation-alignment\"] = \"viewport\";\n }\n }\n if (this.layout.get(\"text-pitch-alignment\") === \"auto\") {\n this.layout._values[\"text-pitch-alignment\"] = this.layout.get(\"text-rotation-alignment\");\n }\n if (this.layout.get(\"icon-pitch-alignment\") === \"auto\") {\n this.layout._values[\"icon-pitch-alignment\"] = this.layout.get(\"icon-rotation-alignment\");\n }\n if (this.layout.get(\"symbol-placement\") === \"point\") {\n var writingModes = this.layout.get(\"text-writing-mode\");\n if (writingModes) {\n var deduped = [];\n for (var i = 0, list = writingModes; i < list.length; i += 1) {\n var m = list[i];\n if (deduped.indexOf(m) < 0) {\n deduped.push(m);\n }\n }\n this.layout._values[\"text-writing-mode\"] = deduped;\n } else {\n this.layout._values[\"text-writing-mode\"] = [\"horizontal\"];\n }\n }\n this._setPaintOverrides();\n };\n SymbolStyleLayer2.prototype.getValueAndResolveTokens = function getValueAndResolveTokens(name3, feature, canonical, availableImages) {\n var value = this.layout.get(name3).evaluate(feature, {}, canonical, availableImages);\n var unevaluated = this._unevaluatedLayout._values[name3];\n if (!unevaluated.isDataDriven() && !isExpression(unevaluated.value) && value) {\n return resolveTokens(feature.properties, value);\n }\n return value;\n };\n SymbolStyleLayer2.prototype.createBucket = function createBucket(parameters) {\n return new SymbolBucket(parameters);\n };\n SymbolStyleLayer2.prototype.queryRadius = function queryRadius() {\n return 0;\n };\n SymbolStyleLayer2.prototype.queryIntersectsFeature = function queryIntersectsFeature() {\n return false;\n };\n SymbolStyleLayer2.prototype._setPaintOverrides = function _setPaintOverrides() {\n for (var i = 0, list = properties$6.paint.overridableProperties; i < list.length; i += 1) {\n var overridable = list[i];\n if (!SymbolStyleLayer2.hasPaintOverride(this.layout, overridable)) {\n continue;\n }\n var overriden = this.paint.get(overridable);\n var override = new FormatSectionOverride(overriden);\n var styleExpression = new StyleExpression(override, overriden.property.specification);\n var expression2 = null;\n if (overriden.value.kind === \"constant\" || overriden.value.kind === \"source\") {\n expression2 = new ZoomConstantExpression(\"source\", styleExpression);\n } else {\n expression2 = new ZoomDependentExpression(\"composite\", styleExpression, overriden.value.zoomStops, overriden.value._interpolationType);\n }\n this.paint._values[overridable] = new PossiblyEvaluatedPropertyValue(overriden.property, expression2, overriden.parameters);\n }\n };\n SymbolStyleLayer2.prototype._handleOverridablePaintPropertyUpdate = function _handleOverridablePaintPropertyUpdate(name3, oldValue, newValue) {\n if (!this.layout || oldValue.isDataDriven() || newValue.isDataDriven()) {\n return false;\n }\n return SymbolStyleLayer2.hasPaintOverride(this.layout, name3);\n };\n SymbolStyleLayer2.hasPaintOverride = function hasPaintOverride(layout2, propertyName) {\n var textField = layout2.get(\"text-field\");\n var property = properties$6.paint.properties[propertyName];\n var hasOverrides = false;\n var checkSections = function(sections) {\n for (var i = 0, list = sections; i < list.length; i += 1) {\n var section = list[i];\n if (property.overrides && property.overrides.hasOverride(section)) {\n hasOverrides = true;\n return;\n }\n }\n };\n if (textField.value.kind === \"constant\" && textField.value.value instanceof Formatted) {\n checkSections(textField.value.value.sections);\n } else if (textField.value.kind === \"source\") {\n var checkExpression = function(expression2) {\n if (hasOverrides) {\n return;\n }\n if (expression2 instanceof Literal && typeOf(expression2.value) === FormattedType) {\n var formatted = expression2.value;\n checkSections(formatted.sections);\n } else if (expression2 instanceof FormatExpression) {\n checkSections(expression2.sections);\n } else {\n expression2.eachChild(checkExpression);\n }\n };\n var expr = textField.value;\n if (expr._styleExpression) {\n checkExpression(expr._styleExpression.expression);\n }\n }\n return hasOverrides;\n };\n return SymbolStyleLayer2;\n }(StyleLayer);\n var paint$8 = new Properties({\n \"background-color\": new DataConstantProperty(spec[\"paint_background\"][\"background-color\"]),\n \"background-pattern\": new CrossFadedProperty(spec[\"paint_background\"][\"background-pattern\"]),\n \"background-opacity\": new DataConstantProperty(spec[\"paint_background\"][\"background-opacity\"])\n });\n var properties$7 = { paint: paint$8 };\n var BackgroundStyleLayer = function(StyleLayer2) {\n function BackgroundStyleLayer2(layer2) {\n StyleLayer2.call(this, layer2, properties$7);\n }\n if (StyleLayer2)\n BackgroundStyleLayer2.__proto__ = StyleLayer2;\n BackgroundStyleLayer2.prototype = Object.create(StyleLayer2 && StyleLayer2.prototype);\n BackgroundStyleLayer2.prototype.constructor = BackgroundStyleLayer2;\n return BackgroundStyleLayer2;\n }(StyleLayer);\n var paint$9 = new Properties({\n \"raster-opacity\": new DataConstantProperty(spec[\"paint_raster\"][\"raster-opacity\"]),\n \"raster-hue-rotate\": new DataConstantProperty(spec[\"paint_raster\"][\"raster-hue-rotate\"]),\n \"raster-brightness-min\": new DataConstantProperty(spec[\"paint_raster\"][\"raster-brightness-min\"]),\n \"raster-brightness-max\": new DataConstantProperty(spec[\"paint_raster\"][\"raster-brightness-max\"]),\n \"raster-saturation\": new DataConstantProperty(spec[\"paint_raster\"][\"raster-saturation\"]),\n \"raster-contrast\": new DataConstantProperty(spec[\"paint_raster\"][\"raster-contrast\"]),\n \"raster-resampling\": new DataConstantProperty(spec[\"paint_raster\"][\"raster-resampling\"]),\n \"raster-fade-duration\": new DataConstantProperty(spec[\"paint_raster\"][\"raster-fade-duration\"])\n });\n var properties$8 = { paint: paint$9 };\n var RasterStyleLayer = function(StyleLayer2) {\n function RasterStyleLayer2(layer2) {\n StyleLayer2.call(this, layer2, properties$8);\n }\n if (StyleLayer2)\n RasterStyleLayer2.__proto__ = StyleLayer2;\n RasterStyleLayer2.prototype = Object.create(StyleLayer2 && StyleLayer2.prototype);\n RasterStyleLayer2.prototype.constructor = RasterStyleLayer2;\n return RasterStyleLayer2;\n }(StyleLayer);\n function validateCustomStyleLayer(layerObject) {\n var errors = [];\n var id2 = layerObject.id;\n if (id2 === void 0) {\n errors.push({ message: \"layers.\" + id2 + ': missing required property \"id\"' });\n }\n if (layerObject.render === void 0) {\n errors.push({ message: \"layers.\" + id2 + ': missing required method \"render\"' });\n }\n if (layerObject.renderingMode && layerObject.renderingMode !== \"2d\" && layerObject.renderingMode !== \"3d\") {\n errors.push({ message: \"layers.\" + id2 + ': property \"renderingMode\" must be either \"2d\" or \"3d\"' });\n }\n return errors;\n }\n var CustomStyleLayer = function(StyleLayer2) {\n function CustomStyleLayer2(implementation) {\n StyleLayer2.call(this, implementation, {});\n this.implementation = implementation;\n }\n if (StyleLayer2)\n CustomStyleLayer2.__proto__ = StyleLayer2;\n CustomStyleLayer2.prototype = Object.create(StyleLayer2 && StyleLayer2.prototype);\n CustomStyleLayer2.prototype.constructor = CustomStyleLayer2;\n CustomStyleLayer2.prototype.is3D = function is3D() {\n return this.implementation.renderingMode === \"3d\";\n };\n CustomStyleLayer2.prototype.hasOffscreenPass = function hasOffscreenPass() {\n return this.implementation.prerender !== void 0;\n };\n CustomStyleLayer2.prototype.recalculate = function recalculate() {\n };\n CustomStyleLayer2.prototype.updateTransitions = function updateTransitions() {\n };\n CustomStyleLayer2.prototype.hasTransition = function hasTransition() {\n };\n CustomStyleLayer2.prototype.serialize = function serialize2() {\n };\n CustomStyleLayer2.prototype.onAdd = function onAdd(map) {\n if (this.implementation.onAdd) {\n this.implementation.onAdd(map, map.painter.context.gl);\n }\n };\n CustomStyleLayer2.prototype.onRemove = function onRemove(map) {\n if (this.implementation.onRemove) {\n this.implementation.onRemove(map, map.painter.context.gl);\n }\n };\n return CustomStyleLayer2;\n }(StyleLayer);\n var subclasses = {\n circle: CircleStyleLayer,\n heatmap: HeatmapStyleLayer,\n hillshade: HillshadeStyleLayer,\n fill: FillStyleLayer,\n \"fill-extrusion\": FillExtrusionStyleLayer,\n line: LineStyleLayer,\n symbol: SymbolStyleLayer,\n background: BackgroundStyleLayer,\n raster: RasterStyleLayer\n };\n function createStyleLayer(layer2) {\n if (layer2.type === \"custom\") {\n return new CustomStyleLayer(layer2);\n } else {\n return new subclasses[layer2.type](layer2);\n }\n }\n var HTMLImageElement2 = window$1.HTMLImageElement;\n var HTMLCanvasElement2 = window$1.HTMLCanvasElement;\n var HTMLVideoElement2 = window$1.HTMLVideoElement;\n var ImageData$1 = window$1.ImageData;\n var ImageBitmap$1 = window$1.ImageBitmap;\n var Texture = function Texture2(context, image, format, options) {\n this.context = context;\n this.format = format;\n this.texture = context.gl.createTexture();\n this.update(image, options);\n };\n Texture.prototype.update = function update(image, options, position) {\n var width = image.width;\n var height = image.height;\n var resize = (!this.size || this.size[0] !== width || this.size[1] !== height) && !position;\n var ref = this;\n var context = ref.context;\n var gl2 = context.gl;\n this.useMipmap = Boolean(options && options.useMipmap);\n gl2.bindTexture(gl2.TEXTURE_2D, this.texture);\n context.pixelStoreUnpackFlipY.set(false);\n context.pixelStoreUnpack.set(1);\n context.pixelStoreUnpackPremultiplyAlpha.set(this.format === gl2.RGBA && (!options || options.premultiply !== false));\n if (resize) {\n this.size = [\n width,\n height\n ];\n if (image instanceof HTMLImageElement2 || image instanceof HTMLCanvasElement2 || image instanceof HTMLVideoElement2 || image instanceof ImageData$1 || ImageBitmap$1 && image instanceof ImageBitmap$1) {\n gl2.texImage2D(gl2.TEXTURE_2D, 0, this.format, this.format, gl2.UNSIGNED_BYTE, image);\n } else {\n gl2.texImage2D(gl2.TEXTURE_2D, 0, this.format, width, height, 0, this.format, gl2.UNSIGNED_BYTE, image.data);\n }\n } else {\n var ref$1 = position || {\n x: 0,\n y: 0\n };\n var x = ref$1.x;\n var y = ref$1.y;\n if (image instanceof HTMLImageElement2 || image instanceof HTMLCanvasElement2 || image instanceof HTMLVideoElement2 || image instanceof ImageData$1 || ImageBitmap$1 && image instanceof ImageBitmap$1) {\n gl2.texSubImage2D(gl2.TEXTURE_2D, 0, x, y, gl2.RGBA, gl2.UNSIGNED_BYTE, image);\n } else {\n gl2.texSubImage2D(gl2.TEXTURE_2D, 0, x, y, width, height, gl2.RGBA, gl2.UNSIGNED_BYTE, image.data);\n }\n }\n if (this.useMipmap && this.isSizePowerOfTwo()) {\n gl2.generateMipmap(gl2.TEXTURE_2D);\n }\n };\n Texture.prototype.bind = function bind(filter2, wrap2, minFilter) {\n var ref = this;\n var context = ref.context;\n var gl2 = context.gl;\n gl2.bindTexture(gl2.TEXTURE_2D, this.texture);\n if (minFilter === gl2.LINEAR_MIPMAP_NEAREST && !this.isSizePowerOfTwo()) {\n minFilter = gl2.LINEAR;\n }\n if (filter2 !== this.filter) {\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_MAG_FILTER, filter2);\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_MIN_FILTER, minFilter || filter2);\n this.filter = filter2;\n }\n if (wrap2 !== this.wrap) {\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_WRAP_S, wrap2);\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_WRAP_T, wrap2);\n this.wrap = wrap2;\n }\n };\n Texture.prototype.isSizePowerOfTwo = function isSizePowerOfTwo() {\n return this.size[0] === this.size[1] && Math.log(this.size[0]) / Math.LN2 % 1 === 0;\n };\n Texture.prototype.destroy = function destroy() {\n var ref = this.context;\n var gl2 = ref.gl;\n gl2.deleteTexture(this.texture);\n this.texture = null;\n };\n var ThrottledInvoker = function ThrottledInvoker2(callback) {\n var this$1 = this;\n this._callback = callback;\n this._triggered = false;\n if (typeof MessageChannel !== \"undefined\") {\n this._channel = new MessageChannel();\n this._channel.port2.onmessage = function() {\n this$1._triggered = false;\n this$1._callback();\n };\n }\n };\n ThrottledInvoker.prototype.trigger = function trigger() {\n var this$1 = this;\n if (!this._triggered) {\n this._triggered = true;\n if (this._channel) {\n this._channel.port1.postMessage(true);\n } else {\n setTimeout(function() {\n this$1._triggered = false;\n this$1._callback();\n }, 0);\n }\n }\n };\n ThrottledInvoker.prototype.remove = function remove() {\n delete this._channel;\n this._callback = function() {\n };\n };\n var Actor = function Actor2(target, parent, mapId) {\n this.target = target;\n this.parent = parent;\n this.mapId = mapId;\n this.callbacks = {};\n this.tasks = {};\n this.taskQueue = [];\n this.cancelCallbacks = {};\n bindAll([\n \"receive\",\n \"process\"\n ], this);\n this.invoker = new ThrottledInvoker(this.process);\n this.target.addEventListener(\"message\", this.receive, false);\n this.globalScope = isWorker() ? target : window$1;\n };\n Actor.prototype.send = function send(type, data, callback, targetMapId, mustQueue) {\n var this$1 = this;\n if (mustQueue === void 0)\n mustQueue = false;\n var id2 = Math.round(Math.random() * 1e18).toString(36).substring(0, 10);\n if (callback) {\n this.callbacks[id2] = callback;\n }\n var buffers = isSafari(this.globalScope) ? void 0 : [];\n this.target.postMessage({\n id: id2,\n type,\n hasCallback: !!callback,\n targetMapId,\n mustQueue,\n sourceMapId: this.mapId,\n data: serialize(data, buffers)\n }, buffers);\n return {\n cancel: function() {\n if (callback) {\n delete this$1.callbacks[id2];\n }\n this$1.target.postMessage({\n id: id2,\n type: \"\",\n targetMapId,\n sourceMapId: this$1.mapId\n });\n }\n };\n };\n Actor.prototype.receive = function receive(message) {\n var data = message.data, id2 = data.id;\n if (!id2) {\n return;\n }\n if (data.targetMapId && this.mapId !== data.targetMapId) {\n return;\n }\n if (data.type === \"\") {\n delete this.tasks[id2];\n var cancel2 = this.cancelCallbacks[id2];\n delete this.cancelCallbacks[id2];\n if (cancel2) {\n cancel2();\n }\n } else {\n if (isWorker() || data.mustQueue) {\n this.tasks[id2] = data;\n this.taskQueue.push(id2);\n this.invoker.trigger();\n } else {\n this.processTask(id2, data);\n }\n }\n };\n Actor.prototype.process = function process2() {\n if (!this.taskQueue.length) {\n return;\n }\n var id2 = this.taskQueue.shift();\n var task = this.tasks[id2];\n delete this.tasks[id2];\n if (this.taskQueue.length) {\n this.invoker.trigger();\n }\n if (!task) {\n return;\n }\n this.processTask(id2, task);\n };\n Actor.prototype.processTask = function processTask(id2, task) {\n var this$1 = this;\n if (task.type === \"\") {\n var callback = this.callbacks[id2];\n delete this.callbacks[id2];\n if (callback) {\n if (task.error) {\n callback(deserialize(task.error));\n } else {\n callback(null, deserialize(task.data));\n }\n }\n } else {\n var completed = false;\n var buffers = isSafari(this.globalScope) ? void 0 : [];\n var done = task.hasCallback ? function(err, data) {\n completed = true;\n delete this$1.cancelCallbacks[id2];\n this$1.target.postMessage({\n id: id2,\n type: \"\",\n sourceMapId: this$1.mapId,\n error: err ? serialize(err) : null,\n data: serialize(data, buffers)\n }, buffers);\n } : function(_) {\n completed = true;\n };\n var callback$1 = null;\n var params = deserialize(task.data);\n if (this.parent[task.type]) {\n callback$1 = this.parent[task.type](task.sourceMapId, params, done);\n } else if (this.parent.getWorkerSource) {\n var keys = task.type.split(\".\");\n var scope = this.parent.getWorkerSource(task.sourceMapId, keys[0], params.source);\n callback$1 = scope[keys[1]](params, done);\n } else {\n done(new Error(\"Could not find function \" + task.type));\n }\n if (!completed && callback$1 && callback$1.cancel) {\n this.cancelCallbacks[id2] = callback$1.cancel;\n }\n }\n };\n Actor.prototype.remove = function remove() {\n this.invoker.remove();\n this.target.removeEventListener(\"message\", this.receive, false);\n };\n function getTileBBox(x, y, z) {\n y = Math.pow(2, z) - y - 1;\n var min = getMercCoords(x * 256, y * 256, z), max = getMercCoords((x + 1) * 256, (y + 1) * 256, z);\n return min[0] + \",\" + min[1] + \",\" + max[0] + \",\" + max[1];\n }\n function getMercCoords(x, y, z) {\n var resolution = 2 * Math.PI * 6378137 / 256 / Math.pow(2, z), merc_x = x * resolution - 2 * Math.PI * 6378137 / 2, merc_y = y * resolution - 2 * Math.PI * 6378137 / 2;\n return [merc_x, merc_y];\n }\n var LngLatBounds = function LngLatBounds2(sw, ne) {\n if (!sw) ;\n else if (ne) {\n this.setSouthWest(sw).setNorthEast(ne);\n } else if (sw.length === 4) {\n this.setSouthWest([\n sw[0],\n sw[1]\n ]).setNorthEast([\n sw[2],\n sw[3]\n ]);\n } else {\n this.setSouthWest(sw[0]).setNorthEast(sw[1]);\n }\n };\n LngLatBounds.prototype.setNorthEast = function setNorthEast(ne) {\n this._ne = ne instanceof LngLat ? new LngLat(ne.lng, ne.lat) : LngLat.convert(ne);\n return this;\n };\n LngLatBounds.prototype.setSouthWest = function setSouthWest(sw) {\n this._sw = sw instanceof LngLat ? new LngLat(sw.lng, sw.lat) : LngLat.convert(sw);\n return this;\n };\n LngLatBounds.prototype.extend = function extend3(obj) {\n var sw = this._sw, ne = this._ne;\n var sw2, ne2;\n if (obj instanceof LngLat) {\n sw2 = obj;\n ne2 = obj;\n } else if (obj instanceof LngLatBounds) {\n sw2 = obj._sw;\n ne2 = obj._ne;\n if (!sw2 || !ne2) {\n return this;\n }\n } else {\n if (Array.isArray(obj)) {\n if (obj.length === 4 || obj.every(Array.isArray)) {\n var lngLatBoundsObj = obj;\n return this.extend(LngLatBounds.convert(lngLatBoundsObj));\n } else {\n var lngLatObj = obj;\n return this.extend(LngLat.convert(lngLatObj));\n }\n }\n return this;\n }\n if (!sw && !ne) {\n this._sw = new LngLat(sw2.lng, sw2.lat);\n this._ne = new LngLat(ne2.lng, ne2.lat);\n } else {\n sw.lng = Math.min(sw2.lng, sw.lng);\n sw.lat = Math.min(sw2.lat, sw.lat);\n ne.lng = Math.max(ne2.lng, ne.lng);\n ne.lat = Math.max(ne2.lat, ne.lat);\n }\n return this;\n };\n LngLatBounds.prototype.getCenter = function getCenter() {\n return new LngLat((this._sw.lng + this._ne.lng) / 2, (this._sw.lat + this._ne.lat) / 2);\n };\n LngLatBounds.prototype.getSouthWest = function getSouthWest() {\n return this._sw;\n };\n LngLatBounds.prototype.getNorthEast = function getNorthEast() {\n return this._ne;\n };\n LngLatBounds.prototype.getNorthWest = function getNorthWest() {\n return new LngLat(this.getWest(), this.getNorth());\n };\n LngLatBounds.prototype.getSouthEast = function getSouthEast() {\n return new LngLat(this.getEast(), this.getSouth());\n };\n LngLatBounds.prototype.getWest = function getWest() {\n return this._sw.lng;\n };\n LngLatBounds.prototype.getSouth = function getSouth() {\n return this._sw.lat;\n };\n LngLatBounds.prototype.getEast = function getEast() {\n return this._ne.lng;\n };\n LngLatBounds.prototype.getNorth = function getNorth() {\n return this._ne.lat;\n };\n LngLatBounds.prototype.toArray = function toArray() {\n return [\n this._sw.toArray(),\n this._ne.toArray()\n ];\n };\n LngLatBounds.prototype.toString = function toString2() {\n return \"LngLatBounds(\" + this._sw.toString() + \", \" + this._ne.toString() + \")\";\n };\n LngLatBounds.prototype.isEmpty = function isEmpty2() {\n return !(this._sw && this._ne);\n };\n LngLatBounds.prototype.contains = function contains(lnglat) {\n var ref = LngLat.convert(lnglat);\n var lng = ref.lng;\n var lat = ref.lat;\n var containsLatitude = this._sw.lat <= lat && lat <= this._ne.lat;\n var containsLongitude = this._sw.lng <= lng && lng <= this._ne.lng;\n if (this._sw.lng > this._ne.lng) {\n containsLongitude = this._sw.lng >= lng && lng >= this._ne.lng;\n }\n return containsLatitude && containsLongitude;\n };\n LngLatBounds.convert = function convert(input) {\n if (!input || input instanceof LngLatBounds) {\n return input;\n }\n return new LngLatBounds(input);\n };\n var earthRadius = 63710088e-1;\n var LngLat = function LngLat2(lng, lat) {\n if (isNaN(lng) || isNaN(lat)) {\n throw new Error(\"Invalid LngLat object: (\" + lng + \", \" + lat + \")\");\n }\n this.lng = +lng;\n this.lat = +lat;\n if (this.lat > 90 || this.lat < -90) {\n throw new Error(\"Invalid LngLat latitude value: must be between -90 and 90\");\n }\n };\n LngLat.prototype.wrap = function wrap$1() {\n return new LngLat(wrap(this.lng, -180, 180), this.lat);\n };\n LngLat.prototype.toArray = function toArray() {\n return [\n this.lng,\n this.lat\n ];\n };\n LngLat.prototype.toString = function toString2() {\n return \"LngLat(\" + this.lng + \", \" + this.lat + \")\";\n };\n LngLat.prototype.distanceTo = function distanceTo(lngLat) {\n var rad = Math.PI / 180;\n var lat1 = this.lat * rad;\n var lat2 = lngLat.lat * rad;\n var a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((lngLat.lng - this.lng) * rad);\n var maxMeters = earthRadius * Math.acos(Math.min(a, 1));\n return maxMeters;\n };\n LngLat.prototype.toBounds = function toBounds(radius) {\n if (radius === void 0)\n radius = 0;\n var earthCircumferenceInMetersAtEquator = 40075017;\n var latAccuracy = 360 * radius / earthCircumferenceInMetersAtEquator, lngAccuracy = latAccuracy / Math.cos(Math.PI / 180 * this.lat);\n return new LngLatBounds(new LngLat(this.lng - lngAccuracy, this.lat - latAccuracy), new LngLat(this.lng + lngAccuracy, this.lat + latAccuracy));\n };\n LngLat.convert = function convert(input) {\n if (input instanceof LngLat) {\n return input;\n }\n if (Array.isArray(input) && (input.length === 2 || input.length === 3)) {\n return new LngLat(Number(input[0]), Number(input[1]));\n }\n if (!Array.isArray(input) && typeof input === \"object\" && input !== null) {\n return new LngLat(Number(\"lng\" in input ? input.lng : input.lon), Number(input.lat));\n }\n throw new Error(\"`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]\");\n };\n var earthCircumfrence = 2 * Math.PI * earthRadius;\n function circumferenceAtLatitude(latitude) {\n return earthCircumfrence * Math.cos(latitude * Math.PI / 180);\n }\n function mercatorXfromLng$1(lng) {\n return (180 + lng) / 360;\n }\n function mercatorYfromLat$1(lat) {\n return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360))) / 360;\n }\n function mercatorZfromAltitude(altitude, lat) {\n return altitude / circumferenceAtLatitude(lat);\n }\n function lngFromMercatorX(x) {\n return x * 360 - 180;\n }\n function latFromMercatorY(y) {\n var y2 = 180 - y * 360;\n return 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;\n }\n function altitudeFromMercatorZ(z, y) {\n return z * circumferenceAtLatitude(latFromMercatorY(y));\n }\n function mercatorScale(lat) {\n return 1 / Math.cos(lat * Math.PI / 180);\n }\n var MercatorCoordinate = function MercatorCoordinate2(x, y, z) {\n if (z === void 0)\n z = 0;\n this.x = +x;\n this.y = +y;\n this.z = +z;\n };\n MercatorCoordinate.fromLngLat = function fromLngLat(lngLatLike, altitude) {\n if (altitude === void 0)\n altitude = 0;\n var lngLat = LngLat.convert(lngLatLike);\n return new MercatorCoordinate(mercatorXfromLng$1(lngLat.lng), mercatorYfromLat$1(lngLat.lat), mercatorZfromAltitude(altitude, lngLat.lat));\n };\n MercatorCoordinate.prototype.toLngLat = function toLngLat() {\n return new LngLat(lngFromMercatorX(this.x), latFromMercatorY(this.y));\n };\n MercatorCoordinate.prototype.toAltitude = function toAltitude() {\n return altitudeFromMercatorZ(this.z, this.y);\n };\n MercatorCoordinate.prototype.meterInMercatorCoordinateUnits = function meterInMercatorCoordinateUnits() {\n return 1 / earthCircumfrence * mercatorScale(latFromMercatorY(this.y));\n };\n var CanonicalTileID = function CanonicalTileID2(z, x, y) {\n this.z = z;\n this.x = x;\n this.y = y;\n this.key = calculateKey(0, z, z, x, y);\n };\n CanonicalTileID.prototype.equals = function equals2(id2) {\n return this.z === id2.z && this.x === id2.x && this.y === id2.y;\n };\n CanonicalTileID.prototype.url = function url(urls, scheme) {\n var bbox = getTileBBox(this.x, this.y, this.z);\n var quadkey = getQuadkey(this.z, this.x, this.y);\n return urls[(this.x + this.y) % urls.length].replace(\"{prefix}\", (this.x % 16).toString(16) + (this.y % 16).toString(16)).replace(\"{z}\", String(this.z)).replace(\"{x}\", String(this.x)).replace(\"{y}\", String(scheme === \"tms\" ? Math.pow(2, this.z) - this.y - 1 : this.y)).replace(\"{quadkey}\", quadkey).replace(\"{bbox-epsg-3857}\", bbox);\n };\n CanonicalTileID.prototype.getTilePoint = function getTilePoint(coord) {\n var tilesAtZoom = Math.pow(2, this.z);\n return new pointGeometry((coord.x * tilesAtZoom - this.x) * EXTENT$1, (coord.y * tilesAtZoom - this.y) * EXTENT$1);\n };\n CanonicalTileID.prototype.toString = function toString2() {\n return this.z + \"/\" + this.x + \"/\" + this.y;\n };\n var UnwrappedTileID = function UnwrappedTileID2(wrap2, canonical) {\n this.wrap = wrap2;\n this.canonical = canonical;\n this.key = calculateKey(wrap2, canonical.z, canonical.z, canonical.x, canonical.y);\n };\n var OverscaledTileID = function OverscaledTileID2(overscaledZ, wrap2, z, x, y) {\n this.overscaledZ = overscaledZ;\n this.wrap = wrap2;\n this.canonical = new CanonicalTileID(z, +x, +y);\n this.key = calculateKey(wrap2, overscaledZ, z, x, y);\n };\n OverscaledTileID.prototype.equals = function equals2(id2) {\n return this.overscaledZ === id2.overscaledZ && this.wrap === id2.wrap && this.canonical.equals(id2.canonical);\n };\n OverscaledTileID.prototype.scaledTo = function scaledTo(targetZ) {\n var zDifference = this.canonical.z - targetZ;\n if (targetZ > this.canonical.z) {\n return new OverscaledTileID(targetZ, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y);\n } else {\n return new OverscaledTileID(targetZ, this.wrap, targetZ, this.canonical.x >> zDifference, this.canonical.y >> zDifference);\n }\n };\n OverscaledTileID.prototype.calculateScaledKey = function calculateScaledKey(targetZ, withWrap) {\n var zDifference = this.canonical.z - targetZ;\n if (targetZ > this.canonical.z) {\n return calculateKey(this.wrap * +withWrap, targetZ, this.canonical.z, this.canonical.x, this.canonical.y);\n } else {\n return calculateKey(this.wrap * +withWrap, targetZ, targetZ, this.canonical.x >> zDifference, this.canonical.y >> zDifference);\n }\n };\n OverscaledTileID.prototype.isChildOf = function isChildOf(parent) {\n if (parent.wrap !== this.wrap) {\n return false;\n }\n var zDifference = this.canonical.z - parent.canonical.z;\n return parent.overscaledZ === 0 || parent.overscaledZ < this.overscaledZ && parent.canonical.x === this.canonical.x >> zDifference && parent.canonical.y === this.canonical.y >> zDifference;\n };\n OverscaledTileID.prototype.children = function children(sourceMaxZoom) {\n if (this.overscaledZ >= sourceMaxZoom) {\n return [new OverscaledTileID(this.overscaledZ + 1, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y)];\n }\n var z = this.canonical.z + 1;\n var x = this.canonical.x * 2;\n var y = this.canonical.y * 2;\n return [\n new OverscaledTileID(z, this.wrap, z, x, y),\n new OverscaledTileID(z, this.wrap, z, x + 1, y),\n new OverscaledTileID(z, this.wrap, z, x, y + 1),\n new OverscaledTileID(z, this.wrap, z, x + 1, y + 1)\n ];\n };\n OverscaledTileID.prototype.isLessThan = function isLessThan(rhs) {\n if (this.wrap < rhs.wrap) {\n return true;\n }\n if (this.wrap > rhs.wrap) {\n return false;\n }\n if (this.overscaledZ < rhs.overscaledZ) {\n return true;\n }\n if (this.overscaledZ > rhs.overscaledZ) {\n return false;\n }\n if (this.canonical.x < rhs.canonical.x) {\n return true;\n }\n if (this.canonical.x > rhs.canonical.x) {\n return false;\n }\n if (this.canonical.y < rhs.canonical.y) {\n return true;\n }\n return false;\n };\n OverscaledTileID.prototype.wrapped = function wrapped() {\n return new OverscaledTileID(this.overscaledZ, 0, this.canonical.z, this.canonical.x, this.canonical.y);\n };\n OverscaledTileID.prototype.unwrapTo = function unwrapTo(wrap2) {\n return new OverscaledTileID(this.overscaledZ, wrap2, this.canonical.z, this.canonical.x, this.canonical.y);\n };\n OverscaledTileID.prototype.overscaleFactor = function overscaleFactor() {\n return Math.pow(2, this.overscaledZ - this.canonical.z);\n };\n OverscaledTileID.prototype.toUnwrapped = function toUnwrapped() {\n return new UnwrappedTileID(this.wrap, this.canonical);\n };\n OverscaledTileID.prototype.toString = function toString2() {\n return this.overscaledZ + \"/\" + this.canonical.x + \"/\" + this.canonical.y;\n };\n OverscaledTileID.prototype.getTilePoint = function getTilePoint(coord) {\n return this.canonical.getTilePoint(new MercatorCoordinate(coord.x - this.wrap, coord.y));\n };\n function calculateKey(wrap2, overscaledZ, z, x, y) {\n wrap2 *= 2;\n if (wrap2 < 0) {\n wrap2 = wrap2 * -1 - 1;\n }\n var dim = 1 << z;\n return (dim * dim * wrap2 + dim * y + x).toString(36) + z.toString(36) + overscaledZ.toString(36);\n }\n function getQuadkey(z, x, y) {\n var quadkey = \"\", mask;\n for (var i = z; i > 0; i--) {\n mask = 1 << i - 1;\n quadkey += (x & mask ? 1 : 0) + (y & mask ? 2 : 0);\n }\n return quadkey;\n }\n register(\"CanonicalTileID\", CanonicalTileID);\n register(\"OverscaledTileID\", OverscaledTileID, { omit: [\"posMatrix\"] });\n var DEMData = function DEMData2(uid, data, encoding) {\n this.uid = uid;\n if (data.height !== data.width) {\n throw new RangeError(\"DEM tiles must be square\");\n }\n if (encoding && encoding !== \"mapbox\" && encoding !== \"terrarium\") {\n return warnOnce('\"' + encoding + '\" is not a valid encoding type. Valid types include \"mapbox\" and \"terrarium\".');\n }\n this.stride = data.height;\n var dim = this.dim = data.height - 2;\n this.data = new Uint32Array(data.data.buffer);\n this.encoding = encoding || \"mapbox\";\n for (var x = 0; x < dim; x++) {\n this.data[this._idx(-1, x)] = this.data[this._idx(0, x)];\n this.data[this._idx(dim, x)] = this.data[this._idx(dim - 1, x)];\n this.data[this._idx(x, -1)] = this.data[this._idx(x, 0)];\n this.data[this._idx(x, dim)] = this.data[this._idx(x, dim - 1)];\n }\n this.data[this._idx(-1, -1)] = this.data[this._idx(0, 0)];\n this.data[this._idx(dim, -1)] = this.data[this._idx(dim - 1, 0)];\n this.data[this._idx(-1, dim)] = this.data[this._idx(0, dim - 1)];\n this.data[this._idx(dim, dim)] = this.data[this._idx(dim - 1, dim - 1)];\n };\n DEMData.prototype.get = function get2(x, y) {\n var pixels = new Uint8Array(this.data.buffer);\n var index = this._idx(x, y) * 4;\n var unpack = this.encoding === \"terrarium\" ? this._unpackTerrarium : this._unpackMapbox;\n return unpack(pixels[index], pixels[index + 1], pixels[index + 2]);\n };\n DEMData.prototype.getUnpackVector = function getUnpackVector() {\n return this.encoding === \"terrarium\" ? [\n 256,\n 1,\n 1 / 256,\n 32768\n ] : [\n 6553.6,\n 25.6,\n 0.1,\n 1e4\n ];\n };\n DEMData.prototype._idx = function _idx(x, y) {\n if (x < -1 || x >= this.dim + 1 || y < -1 || y >= this.dim + 1) {\n throw new RangeError(\"out of range source coordinates for DEM data\");\n }\n return (y + 1) * this.stride + (x + 1);\n };\n DEMData.prototype._unpackMapbox = function _unpackMapbox(r, g, b) {\n return (r * 256 * 256 + g * 256 + b) / 10 - 1e4;\n };\n DEMData.prototype._unpackTerrarium = function _unpackTerrarium(r, g, b) {\n return r * 256 + g + b / 256 - 32768;\n };\n DEMData.prototype.getPixels = function getPixels() {\n return new RGBAImage({\n width: this.stride,\n height: this.stride\n }, new Uint8Array(this.data.buffer));\n };\n DEMData.prototype.backfillBorder = function backfillBorder(borderTile, dx, dy) {\n if (this.dim !== borderTile.dim) {\n throw new Error(\"dem dimension mismatch\");\n }\n var xMin = dx * this.dim, xMax = dx * this.dim + this.dim, yMin = dy * this.dim, yMax = dy * this.dim + this.dim;\n switch (dx) {\n case -1:\n xMin = xMax - 1;\n break;\n case 1:\n xMax = xMin + 1;\n break;\n }\n switch (dy) {\n case -1:\n yMin = yMax - 1;\n break;\n case 1:\n yMax = yMin + 1;\n break;\n }\n var ox = -dx * this.dim;\n var oy = -dy * this.dim;\n for (var y = yMin; y < yMax; y++) {\n for (var x = xMin; x < xMax; x++) {\n this.data[this._idx(x, y)] = borderTile.data[this._idx(x + ox, y + oy)];\n }\n }\n };\n register(\"DEMData\", DEMData);\n function deserialize$1(input, style) {\n var output = {};\n if (!style) {\n return output;\n }\n var loop = function() {\n var bucket = list$1[i$1];\n var layers = bucket.layerIds.map(function(id2) {\n return style.getLayer(id2);\n }).filter(Boolean);\n if (layers.length === 0) {\n return;\n }\n bucket.layers = layers;\n if (bucket.stateDependentLayerIds) {\n bucket.stateDependentLayers = bucket.stateDependentLayerIds.map(function(lId) {\n return layers.filter(function(l) {\n return l.id === lId;\n })[0];\n });\n }\n for (var i = 0, list = layers; i < list.length; i += 1) {\n var layer2 = list[i];\n output[layer2.id] = bucket;\n }\n };\n for (var i$1 = 0, list$1 = input; i$1 < list$1.length; i$1 += 1)\n loop();\n return output;\n }\n var DictionaryCoder = function DictionaryCoder2(strings) {\n this._stringToNumber = {};\n this._numberToString = [];\n for (var i = 0; i < strings.length; i++) {\n var string = strings[i];\n this._stringToNumber[string] = i;\n this._numberToString[i] = string;\n }\n };\n DictionaryCoder.prototype.encode = function encode(string) {\n return this._stringToNumber[string];\n };\n DictionaryCoder.prototype.decode = function decode(n) {\n return this._numberToString[n];\n };\n var Feature = function Feature2(vectorTileFeature, z, x, y, id2) {\n this.type = \"Feature\";\n this._vectorTileFeature = vectorTileFeature;\n vectorTileFeature._z = z;\n vectorTileFeature._x = x;\n vectorTileFeature._y = y;\n this.properties = vectorTileFeature.properties;\n this.id = id2;\n };\n var prototypeAccessors$1 = { geometry: { configurable: true } };\n prototypeAccessors$1.geometry.get = function() {\n if (this._geometry === void 0) {\n this._geometry = this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x, this._vectorTileFeature._y, this._vectorTileFeature._z).geometry;\n }\n return this._geometry;\n };\n prototypeAccessors$1.geometry.set = function(g) {\n this._geometry = g;\n };\n Feature.prototype.toJSON = function toJSON() {\n var json = { geometry: this.geometry };\n for (var i in this) {\n if (i === \"_geometry\" || i === \"_vectorTileFeature\") {\n continue;\n }\n json[i] = this[i];\n }\n return json;\n };\n Object.defineProperties(Feature.prototype, prototypeAccessors$1);\n var SourceFeatureState = function SourceFeatureState2() {\n this.state = {};\n this.stateChanges = {};\n this.deletedStates = {};\n };\n SourceFeatureState.prototype.updateState = function updateState(sourceLayer, featureId, newState) {\n var feature = String(featureId);\n this.stateChanges[sourceLayer] = this.stateChanges[sourceLayer] || {};\n this.stateChanges[sourceLayer][feature] = this.stateChanges[sourceLayer][feature] || {};\n extend2(this.stateChanges[sourceLayer][feature], newState);\n if (this.deletedStates[sourceLayer] === null) {\n this.deletedStates[sourceLayer] = {};\n for (var ft in this.state[sourceLayer]) {\n if (ft !== feature) {\n this.deletedStates[sourceLayer][ft] = null;\n }\n }\n } else {\n var featureDeletionQueued = this.deletedStates[sourceLayer] && this.deletedStates[sourceLayer][feature] === null;\n if (featureDeletionQueued) {\n this.deletedStates[sourceLayer][feature] = {};\n for (var prop in this.state[sourceLayer][feature]) {\n if (!newState[prop]) {\n this.deletedStates[sourceLayer][feature][prop] = null;\n }\n }\n } else {\n for (var key in newState) {\n var deletionInQueue = this.deletedStates[sourceLayer] && this.deletedStates[sourceLayer][feature] && this.deletedStates[sourceLayer][feature][key] === null;\n if (deletionInQueue) {\n delete this.deletedStates[sourceLayer][feature][key];\n }\n }\n }\n }\n };\n SourceFeatureState.prototype.removeFeatureState = function removeFeatureState(sourceLayer, featureId, key) {\n var sourceLayerDeleted = this.deletedStates[sourceLayer] === null;\n if (sourceLayerDeleted) {\n return;\n }\n var feature = String(featureId);\n this.deletedStates[sourceLayer] = this.deletedStates[sourceLayer] || {};\n if (key && featureId !== void 0) {\n if (this.deletedStates[sourceLayer][feature] !== null) {\n this.deletedStates[sourceLayer][feature] = this.deletedStates[sourceLayer][feature] || {};\n this.deletedStates[sourceLayer][feature][key] = null;\n }\n } else if (featureId !== void 0) {\n var updateInQueue = this.stateChanges[sourceLayer] && this.stateChanges[sourceLayer][feature];\n if (updateInQueue) {\n this.deletedStates[sourceLayer][feature] = {};\n for (key in this.stateChanges[sourceLayer][feature]) {\n this.deletedStates[sourceLayer][feature][key] = null;\n }\n } else {\n this.deletedStates[sourceLayer][feature] = null;\n }\n } else {\n this.deletedStates[sourceLayer] = null;\n }\n };\n SourceFeatureState.prototype.getState = function getState(sourceLayer, featureId) {\n var feature = String(featureId);\n var base = this.state[sourceLayer] || {};\n var changes = this.stateChanges[sourceLayer] || {};\n var reconciledState = extend2({}, base[feature], changes[feature]);\n if (this.deletedStates[sourceLayer] === null) {\n return {};\n } else if (this.deletedStates[sourceLayer]) {\n var featureDeletions = this.deletedStates[sourceLayer][featureId];\n if (featureDeletions === null) {\n return {};\n }\n for (var prop in featureDeletions) {\n delete reconciledState[prop];\n }\n }\n return reconciledState;\n };\n SourceFeatureState.prototype.initializeTileState = function initializeTileState(tile, painter) {\n tile.setFeatureState(this.state, painter);\n };\n SourceFeatureState.prototype.coalesceChanges = function coalesceChanges(tiles, painter) {\n var featuresChanged = {};\n for (var sourceLayer in this.stateChanges) {\n this.state[sourceLayer] = this.state[sourceLayer] || {};\n var layerStates = {};\n for (var feature in this.stateChanges[sourceLayer]) {\n if (!this.state[sourceLayer][feature]) {\n this.state[sourceLayer][feature] = {};\n }\n extend2(this.state[sourceLayer][feature], this.stateChanges[sourceLayer][feature]);\n layerStates[feature] = this.state[sourceLayer][feature];\n }\n featuresChanged[sourceLayer] = layerStates;\n }\n for (var sourceLayer$1 in this.deletedStates) {\n this.state[sourceLayer$1] = this.state[sourceLayer$1] || {};\n var layerStates$1 = {};\n if (this.deletedStates[sourceLayer$1] === null) {\n for (var ft in this.state[sourceLayer$1]) {\n layerStates$1[ft] = {};\n this.state[sourceLayer$1][ft] = {};\n }\n } else {\n for (var feature$1 in this.deletedStates[sourceLayer$1]) {\n var deleteWholeFeatureState = this.deletedStates[sourceLayer$1][feature$1] === null;\n if (deleteWholeFeatureState) {\n this.state[sourceLayer$1][feature$1] = {};\n } else {\n for (var i = 0, list = Object.keys(this.deletedStates[sourceLayer$1][feature$1]); i < list.length; i += 1) {\n var key = list[i];\n delete this.state[sourceLayer$1][feature$1][key];\n }\n }\n layerStates$1[feature$1] = this.state[sourceLayer$1][feature$1];\n }\n }\n featuresChanged[sourceLayer$1] = featuresChanged[sourceLayer$1] || {};\n extend2(featuresChanged[sourceLayer$1], layerStates$1);\n }\n this.stateChanges = {};\n this.deletedStates = {};\n if (Object.keys(featuresChanged).length === 0) {\n return;\n }\n for (var id2 in tiles) {\n var tile = tiles[id2];\n tile.setFeatureState(featuresChanged, painter);\n }\n };\n var FeatureIndex = function FeatureIndex2(tileID, promoteId2) {\n this.tileID = tileID;\n this.x = tileID.canonical.x;\n this.y = tileID.canonical.y;\n this.z = tileID.canonical.z;\n this.grid = new gridIndex(EXTENT$1, 16, 0);\n this.grid3D = new gridIndex(EXTENT$1, 16, 0);\n this.featureIndexArray = new FeatureIndexArray();\n this.promoteId = promoteId2;\n };\n FeatureIndex.prototype.insert = function insert(feature, geometry, featureIndex, sourceLayerIndex, bucketIndex, is3D) {\n var key = this.featureIndexArray.length;\n this.featureIndexArray.emplaceBack(featureIndex, sourceLayerIndex, bucketIndex);\n var grid = is3D ? this.grid3D : this.grid;\n for (var r = 0; r < geometry.length; r++) {\n var ring = geometry[r];\n var bbox = [\n Infinity,\n Infinity,\n -Infinity,\n -Infinity\n ];\n for (var i = 0; i < ring.length; i++) {\n var p = ring[i];\n bbox[0] = Math.min(bbox[0], p.x);\n bbox[1] = Math.min(bbox[1], p.y);\n bbox[2] = Math.max(bbox[2], p.x);\n bbox[3] = Math.max(bbox[3], p.y);\n }\n if (bbox[0] < EXTENT$1 && bbox[1] < EXTENT$1 && bbox[2] >= 0 && bbox[3] >= 0) {\n grid.insert(key, bbox[0], bbox[1], bbox[2], bbox[3]);\n }\n }\n };\n FeatureIndex.prototype.loadVTLayers = function loadVTLayers() {\n if (!this.vtLayers) {\n this.vtLayers = new vectorTile.VectorTile(new pbf(this.rawTileData)).layers;\n this.sourceLayerCoder = new DictionaryCoder(this.vtLayers ? Object.keys(this.vtLayers).sort() : [\"_geojsonTileLayer\"]);\n }\n return this.vtLayers;\n };\n FeatureIndex.prototype.query = function query(args, styleLayers, serializedLayers, sourceFeatureState) {\n var this$1 = this;\n this.loadVTLayers();\n var params = args.params || {}, pixelsToTileUnits = EXTENT$1 / args.tileSize / args.scale, filter2 = createFilter(params.filter);\n var queryGeometry = args.queryGeometry;\n var queryPadding = args.queryPadding * pixelsToTileUnits;\n var bounds = getBounds(queryGeometry);\n var matching = this.grid.query(bounds.minX - queryPadding, bounds.minY - queryPadding, bounds.maxX + queryPadding, bounds.maxY + queryPadding);\n var cameraBounds = getBounds(args.cameraQueryGeometry);\n var matching3D = this.grid3D.query(cameraBounds.minX - queryPadding, cameraBounds.minY - queryPadding, cameraBounds.maxX + queryPadding, cameraBounds.maxY + queryPadding, function(bx1, by1, bx2, by2) {\n return polygonIntersectsBox(args.cameraQueryGeometry, bx1 - queryPadding, by1 - queryPadding, bx2 + queryPadding, by2 + queryPadding);\n });\n for (var i = 0, list = matching3D; i < list.length; i += 1) {\n var key = list[i];\n matching.push(key);\n }\n matching.sort(topDownFeatureComparator);\n var result = {};\n var previousIndex;\n var loop = function(k2) {\n var index = matching[k2];\n if (index === previousIndex) {\n return;\n }\n previousIndex = index;\n var match = this$1.featureIndexArray.get(index);\n var featureGeometry = null;\n this$1.loadMatchingFeature(result, match.bucketIndex, match.sourceLayerIndex, match.featureIndex, filter2, params.layers, params.availableImages, styleLayers, serializedLayers, sourceFeatureState, function(feature, styleLayer, featureState) {\n if (!featureGeometry) {\n featureGeometry = loadGeometry(feature);\n }\n return styleLayer.queryIntersectsFeature(queryGeometry, feature, featureState, featureGeometry, this$1.z, args.transform, pixelsToTileUnits, args.pixelPosMatrix);\n });\n };\n for (var k = 0; k < matching.length; k++)\n loop(k);\n return result;\n };\n FeatureIndex.prototype.loadMatchingFeature = function loadMatchingFeature(result, bucketIndex, sourceLayerIndex, featureIndex, filter2, filterLayerIDs, availableImages, styleLayers, serializedLayers, sourceFeatureState, intersectionTest) {\n var layerIDs = this.bucketLayerIDs[bucketIndex];\n if (filterLayerIDs && !arraysIntersect(filterLayerIDs, layerIDs)) {\n return;\n }\n var sourceLayerName = this.sourceLayerCoder.decode(sourceLayerIndex);\n var sourceLayer = this.vtLayers[sourceLayerName];\n var feature = sourceLayer.feature(featureIndex);\n if (filter2.needGeometry) {\n var evaluationFeature = toEvaluationFeature(feature, true);\n if (!filter2.filter(new EvaluationParameters(this.tileID.overscaledZ), evaluationFeature, this.tileID.canonical)) {\n return;\n }\n } else if (!filter2.filter(new EvaluationParameters(this.tileID.overscaledZ), feature)) {\n return;\n }\n var id2 = this.getId(feature, sourceLayerName);\n for (var l = 0; l < layerIDs.length; l++) {\n var layerID = layerIDs[l];\n if (filterLayerIDs && filterLayerIDs.indexOf(layerID) < 0) {\n continue;\n }\n var styleLayer = styleLayers[layerID];\n if (!styleLayer) {\n continue;\n }\n var featureState = {};\n if (id2 !== void 0 && sourceFeatureState) {\n featureState = sourceFeatureState.getState(styleLayer.sourceLayer || \"_geojsonTileLayer\", id2);\n }\n var serializedLayer = extend2({}, serializedLayers[layerID]);\n serializedLayer.paint = evaluateProperties(serializedLayer.paint, styleLayer.paint, feature, featureState, availableImages);\n serializedLayer.layout = evaluateProperties(serializedLayer.layout, styleLayer.layout, feature, featureState, availableImages);\n var intersectionZ = !intersectionTest || intersectionTest(feature, styleLayer, featureState);\n if (!intersectionZ) {\n continue;\n }\n var geojsonFeature = new Feature(feature, this.z, this.x, this.y, id2);\n geojsonFeature.layer = serializedLayer;\n var layerResult = result[layerID];\n if (layerResult === void 0) {\n layerResult = result[layerID] = [];\n }\n layerResult.push({\n featureIndex,\n feature: geojsonFeature,\n intersectionZ\n });\n }\n };\n FeatureIndex.prototype.lookupSymbolFeatures = function lookupSymbolFeatures(symbolFeatureIndexes, serializedLayers, bucketIndex, sourceLayerIndex, filterSpec2, filterLayerIDs, availableImages, styleLayers) {\n var result = {};\n this.loadVTLayers();\n var filter2 = createFilter(filterSpec2);\n for (var i = 0, list = symbolFeatureIndexes; i < list.length; i += 1) {\n var symbolFeatureIndex = list[i];\n this.loadMatchingFeature(result, bucketIndex, sourceLayerIndex, symbolFeatureIndex, filter2, filterLayerIDs, availableImages, styleLayers, serializedLayers);\n }\n return result;\n };\n FeatureIndex.prototype.hasLayer = function hasLayer(id2) {\n for (var i$1 = 0, list$1 = this.bucketLayerIDs; i$1 < list$1.length; i$1 += 1) {\n var layerIDs = list$1[i$1];\n for (var i = 0, list = layerIDs; i < list.length; i += 1) {\n var layerID = list[i];\n if (id2 === layerID) {\n return true;\n }\n }\n }\n return false;\n };\n FeatureIndex.prototype.getId = function getId(feature, sourceLayerId) {\n var id2 = feature.id;\n if (this.promoteId) {\n var propName = typeof this.promoteId === \"string\" ? this.promoteId : this.promoteId[sourceLayerId];\n id2 = feature.properties[propName];\n if (typeof id2 === \"boolean\") {\n id2 = Number(id2);\n }\n }\n return id2;\n };\n register(\"FeatureIndex\", FeatureIndex, {\n omit: [\n \"rawTileData\",\n \"sourceLayerCoder\"\n ]\n });\n function evaluateProperties(serializedProperties, styleLayerProperties, feature, featureState, availableImages) {\n return mapObject(serializedProperties, function(property, key) {\n var prop = styleLayerProperties instanceof PossiblyEvaluated ? styleLayerProperties.get(key) : null;\n return prop && prop.evaluate ? prop.evaluate(feature, featureState, availableImages) : prop;\n });\n }\n function getBounds(geometry) {\n var minX = Infinity;\n var minY = Infinity;\n var maxX = -Infinity;\n var maxY = -Infinity;\n for (var i = 0, list = geometry; i < list.length; i += 1) {\n var p = list[i];\n minX = Math.min(minX, p.x);\n minY = Math.min(minY, p.y);\n maxX = Math.max(maxX, p.x);\n maxY = Math.max(maxY, p.y);\n }\n return {\n minX,\n minY,\n maxX,\n maxY\n };\n }\n function topDownFeatureComparator(a, b) {\n return b - a;\n }\n var CLOCK_SKEW_RETRY_TIMEOUT = 3e4;\n var Tile = function Tile2(tileID, size) {\n this.tileID = tileID;\n this.uid = uniqueId();\n this.uses = 0;\n this.tileSize = size;\n this.buckets = {};\n this.expirationTime = null;\n this.queryPadding = 0;\n this.hasSymbolBuckets = false;\n this.hasRTLText = false;\n this.dependencies = {};\n this.expiredRequestCount = 0;\n this.state = \"loading\";\n };\n Tile.prototype.registerFadeDuration = function registerFadeDuration(duration) {\n var fadeEndTime = duration + this.timeAdded;\n if (fadeEndTime < exported.now()) {\n return;\n }\n if (this.fadeEndTime && fadeEndTime < this.fadeEndTime) {\n return;\n }\n this.fadeEndTime = fadeEndTime;\n };\n Tile.prototype.wasRequested = function wasRequested() {\n return this.state === \"errored\" || this.state === \"loaded\" || this.state === \"reloading\";\n };\n Tile.prototype.loadVectorData = function loadVectorData(data, painter, justReloaded) {\n if (this.hasData()) {\n this.unloadVectorData();\n }\n this.state = \"loaded\";\n if (!data) {\n this.collisionBoxArray = new CollisionBoxArray();\n return;\n }\n if (data.featureIndex) {\n this.latestFeatureIndex = data.featureIndex;\n if (data.rawTileData) {\n this.latestRawTileData = data.rawTileData;\n this.latestFeatureIndex.rawTileData = data.rawTileData;\n } else if (this.latestRawTileData) {\n this.latestFeatureIndex.rawTileData = this.latestRawTileData;\n }\n }\n this.collisionBoxArray = data.collisionBoxArray;\n this.buckets = deserialize$1(data.buckets, painter.style);\n this.hasSymbolBuckets = false;\n for (var id2 in this.buckets) {\n var bucket = this.buckets[id2];\n if (bucket instanceof SymbolBucket) {\n this.hasSymbolBuckets = true;\n if (justReloaded) {\n bucket.justReloaded = true;\n } else {\n break;\n }\n }\n }\n this.hasRTLText = false;\n if (this.hasSymbolBuckets) {\n for (var id$1 in this.buckets) {\n var bucket$1 = this.buckets[id$1];\n if (bucket$1 instanceof SymbolBucket) {\n if (bucket$1.hasRTLText) {\n this.hasRTLText = true;\n lazyLoadRTLTextPlugin();\n break;\n }\n }\n }\n }\n this.queryPadding = 0;\n for (var id$2 in this.buckets) {\n var bucket$2 = this.buckets[id$2];\n this.queryPadding = Math.max(this.queryPadding, painter.style.getLayer(id$2).queryRadius(bucket$2));\n }\n if (data.imageAtlas) {\n this.imageAtlas = data.imageAtlas;\n }\n if (data.glyphAtlasImage) {\n this.glyphAtlasImage = data.glyphAtlasImage;\n }\n };\n Tile.prototype.unloadVectorData = function unloadVectorData() {\n for (var id2 in this.buckets) {\n this.buckets[id2].destroy();\n }\n this.buckets = {};\n if (this.imageAtlasTexture) {\n this.imageAtlasTexture.destroy();\n }\n if (this.imageAtlas) {\n this.imageAtlas = null;\n }\n if (this.glyphAtlasTexture) {\n this.glyphAtlasTexture.destroy();\n }\n this.latestFeatureIndex = null;\n this.state = \"unloaded\";\n };\n Tile.prototype.getBucket = function getBucket(layer2) {\n return this.buckets[layer2.id];\n };\n Tile.prototype.upload = function upload(context) {\n for (var id2 in this.buckets) {\n var bucket = this.buckets[id2];\n if (bucket.uploadPending()) {\n bucket.upload(context);\n }\n }\n var gl2 = context.gl;\n if (this.imageAtlas && !this.imageAtlas.uploaded) {\n this.imageAtlasTexture = new Texture(context, this.imageAtlas.image, gl2.RGBA);\n this.imageAtlas.uploaded = true;\n }\n if (this.glyphAtlasImage) {\n this.glyphAtlasTexture = new Texture(context, this.glyphAtlasImage, gl2.ALPHA);\n this.glyphAtlasImage = null;\n }\n };\n Tile.prototype.prepare = function prepare(imageManager) {\n if (this.imageAtlas) {\n this.imageAtlas.patchUpdatedImages(imageManager, this.imageAtlasTexture);\n }\n };\n Tile.prototype.queryRenderedFeatures = function queryRenderedFeatures(layers, serializedLayers, sourceFeatureState, queryGeometry, cameraQueryGeometry, scale2, params, transform, maxPitchScaleFactor, pixelPosMatrix) {\n if (!this.latestFeatureIndex || !this.latestFeatureIndex.rawTileData) {\n return {};\n }\n return this.latestFeatureIndex.query({\n queryGeometry,\n cameraQueryGeometry,\n scale: scale2,\n tileSize: this.tileSize,\n pixelPosMatrix,\n transform,\n params,\n queryPadding: this.queryPadding * maxPitchScaleFactor\n }, layers, serializedLayers, sourceFeatureState);\n };\n Tile.prototype.querySourceFeatures = function querySourceFeatures(result, params) {\n var featureIndex = this.latestFeatureIndex;\n if (!featureIndex || !featureIndex.rawTileData) {\n return;\n }\n var vtLayers = featureIndex.loadVTLayers();\n var sourceLayer = params ? params.sourceLayer : \"\";\n var layer2 = vtLayers._geojsonTileLayer || vtLayers[sourceLayer];\n if (!layer2) {\n return;\n }\n var filter2 = createFilter(params && params.filter);\n var ref = this.tileID.canonical;\n var z = ref.z;\n var x = ref.x;\n var y = ref.y;\n var coord = {\n z,\n x,\n y\n };\n for (var i = 0; i < layer2.length; i++) {\n var feature = layer2.feature(i);\n if (filter2.needGeometry) {\n var evaluationFeature = toEvaluationFeature(feature, true);\n if (!filter2.filter(new EvaluationParameters(this.tileID.overscaledZ), evaluationFeature, this.tileID.canonical)) {\n continue;\n }\n } else if (!filter2.filter(new EvaluationParameters(this.tileID.overscaledZ), feature)) {\n continue;\n }\n var id2 = featureIndex.getId(feature, sourceLayer);\n var geojsonFeature = new Feature(feature, z, x, y, id2);\n geojsonFeature.tile = coord;\n result.push(geojsonFeature);\n }\n };\n Tile.prototype.hasData = function hasData() {\n return this.state === \"loaded\" || this.state === \"reloading\" || this.state === \"expired\";\n };\n Tile.prototype.patternsLoaded = function patternsLoaded() {\n return this.imageAtlas && !!Object.keys(this.imageAtlas.patternPositions).length;\n };\n Tile.prototype.setExpiryData = function setExpiryData(data) {\n var prior = this.expirationTime;\n if (data.cacheControl) {\n var parsedCC = parseCacheControl(data.cacheControl);\n if (parsedCC[\"max-age\"]) {\n this.expirationTime = Date.now() + parsedCC[\"max-age\"] * 1e3;\n }\n } else if (data.expires) {\n this.expirationTime = new Date(data.expires).getTime();\n }\n if (this.expirationTime) {\n var now2 = Date.now();\n var isExpired = false;\n if (this.expirationTime > now2) {\n isExpired = false;\n } else if (!prior) {\n isExpired = true;\n } else if (this.expirationTime < prior) {\n isExpired = true;\n } else {\n var delta = this.expirationTime - prior;\n if (!delta) {\n isExpired = true;\n } else {\n this.expirationTime = now2 + Math.max(delta, CLOCK_SKEW_RETRY_TIMEOUT);\n }\n }\n if (isExpired) {\n this.expiredRequestCount++;\n this.state = \"expired\";\n } else {\n this.expiredRequestCount = 0;\n }\n }\n };\n Tile.prototype.getExpiryTimeout = function getExpiryTimeout() {\n if (this.expirationTime) {\n if (this.expiredRequestCount) {\n return 1e3 * (1 << Math.min(this.expiredRequestCount - 1, 31));\n } else {\n return Math.min(this.expirationTime - (/* @__PURE__ */ new Date()).getTime(), Math.pow(2, 31) - 1);\n }\n }\n };\n Tile.prototype.setFeatureState = function setFeatureState(states, painter) {\n if (!this.latestFeatureIndex || !this.latestFeatureIndex.rawTileData || Object.keys(states).length === 0) {\n return;\n }\n var vtLayers = this.latestFeatureIndex.loadVTLayers();\n for (var id2 in this.buckets) {\n if (!painter.style.hasLayer(id2)) {\n continue;\n }\n var bucket = this.buckets[id2];\n var sourceLayerId = bucket.layers[0][\"sourceLayer\"] || \"_geojsonTileLayer\";\n var sourceLayer = vtLayers[sourceLayerId];\n var sourceLayerStates = states[sourceLayerId];\n if (!sourceLayer || !sourceLayerStates || Object.keys(sourceLayerStates).length === 0) {\n continue;\n }\n bucket.update(sourceLayerStates, sourceLayer, this.imageAtlas && this.imageAtlas.patternPositions || {});\n var layer2 = painter && painter.style && painter.style.getLayer(id2);\n if (layer2) {\n this.queryPadding = Math.max(this.queryPadding, layer2.queryRadius(bucket));\n }\n }\n };\n Tile.prototype.holdingForFade = function holdingForFade() {\n return this.symbolFadeHoldUntil !== void 0;\n };\n Tile.prototype.symbolFadeFinished = function symbolFadeFinished() {\n return !this.symbolFadeHoldUntil || this.symbolFadeHoldUntil < exported.now();\n };\n Tile.prototype.clearFadeHold = function clearFadeHold() {\n this.symbolFadeHoldUntil = void 0;\n };\n Tile.prototype.setHoldDuration = function setHoldDuration(duration) {\n this.symbolFadeHoldUntil = exported.now() + duration;\n };\n Tile.prototype.setDependencies = function setDependencies(namespace, dependencies) {\n var index = {};\n for (var i = 0, list = dependencies; i < list.length; i += 1) {\n var dep = list[i];\n index[dep] = true;\n }\n this.dependencies[namespace] = index;\n };\n Tile.prototype.hasDependency = function hasDependency(namespaces, keys) {\n for (var i$1 = 0, list$1 = namespaces; i$1 < list$1.length; i$1 += 1) {\n var namespace = list$1[i$1];\n var dependencies = this.dependencies[namespace];\n if (dependencies) {\n for (var i = 0, list = keys; i < list.length; i += 1) {\n var key = list[i];\n if (dependencies[key]) {\n return true;\n }\n }\n }\n }\n return false;\n };\n var refProperties = [\n \"type\",\n \"source\",\n \"source-layer\",\n \"minzoom\",\n \"maxzoom\",\n \"filter\",\n \"layout\"\n ];\n var performance2 = window$1.performance;\n var RequestPerformance = function RequestPerformance2(request) {\n this._marks = {\n start: [\n request.url,\n \"start\"\n ].join(\"#\"),\n end: [\n request.url,\n \"end\"\n ].join(\"#\"),\n measure: request.url.toString()\n };\n performance2.mark(this._marks.start);\n };\n RequestPerformance.prototype.finish = function finish() {\n performance2.mark(this._marks.end);\n var resourceTimingData = performance2.getEntriesByName(this._marks.measure);\n if (resourceTimingData.length === 0) {\n performance2.measure(this._marks.measure, this._marks.start, this._marks.end);\n resourceTimingData = performance2.getEntriesByName(this._marks.measure);\n performance2.clearMarks(this._marks.start);\n performance2.clearMarks(this._marks.end);\n performance2.clearMeasures(this._marks.measure);\n }\n return resourceTimingData;\n };\n exports2.Actor = Actor;\n exports2.AlphaImage = AlphaImage;\n exports2.CanonicalTileID = CanonicalTileID;\n exports2.CollisionBoxArray = CollisionBoxArray;\n exports2.Color = Color2;\n exports2.DEMData = DEMData;\n exports2.DataConstantProperty = DataConstantProperty;\n exports2.DictionaryCoder = DictionaryCoder;\n exports2.EXTENT = EXTENT$1;\n exports2.ErrorEvent = ErrorEvent;\n exports2.EvaluationParameters = EvaluationParameters;\n exports2.Event = Event;\n exports2.Evented = Evented;\n exports2.FeatureIndex = FeatureIndex;\n exports2.FillBucket = FillBucket;\n exports2.FillExtrusionBucket = FillExtrusionBucket;\n exports2.ImageAtlas = ImageAtlas;\n exports2.ImagePosition = ImagePosition;\n exports2.LineBucket = LineBucket;\n exports2.LngLat = LngLat;\n exports2.LngLatBounds = LngLatBounds;\n exports2.MercatorCoordinate = MercatorCoordinate;\n exports2.ONE_EM = ONE_EM;\n exports2.OverscaledTileID = OverscaledTileID;\n exports2.Point = pointGeometry;\n exports2.Point$1 = pointGeometry;\n exports2.Properties = Properties;\n exports2.Protobuf = pbf;\n exports2.RGBAImage = RGBAImage;\n exports2.RequestManager = RequestManager;\n exports2.RequestPerformance = RequestPerformance;\n exports2.ResourceType = ResourceType;\n exports2.SegmentVector = SegmentVector;\n exports2.SourceFeatureState = SourceFeatureState;\n exports2.StructArrayLayout1ui2 = StructArrayLayout1ui2;\n exports2.StructArrayLayout2f1f2i16 = StructArrayLayout2f1f2i16;\n exports2.StructArrayLayout2i4 = StructArrayLayout2i4;\n exports2.StructArrayLayout3ui6 = StructArrayLayout3ui6;\n exports2.StructArrayLayout4i8 = StructArrayLayout4i8;\n exports2.SymbolBucket = SymbolBucket;\n exports2.Texture = Texture;\n exports2.Tile = Tile;\n exports2.Transitionable = Transitionable;\n exports2.Uniform1f = Uniform1f;\n exports2.Uniform1i = Uniform1i;\n exports2.Uniform2f = Uniform2f;\n exports2.Uniform3f = Uniform3f;\n exports2.Uniform4f = Uniform4f;\n exports2.UniformColor = UniformColor;\n exports2.UniformMatrix4f = UniformMatrix4f;\n exports2.UnwrappedTileID = UnwrappedTileID;\n exports2.ValidationError = ValidationError;\n exports2.WritingMode = WritingMode;\n exports2.ZoomHistory = ZoomHistory;\n exports2.add = add;\n exports2.addDynamicAttributes = addDynamicAttributes;\n exports2.asyncAll = asyncAll;\n exports2.bezier = bezier;\n exports2.bindAll = bindAll;\n exports2.browser = exported;\n exports2.cacheEntryPossiblyAdded = cacheEntryPossiblyAdded;\n exports2.clamp = clamp;\n exports2.clearTileCache = clearTileCache;\n exports2.clipLine = clipLine;\n exports2.clone = clone$1;\n exports2.clone$1 = clone;\n exports2.clone$2 = clone$2;\n exports2.collisionCircleLayout = collisionCircleLayout;\n exports2.config = config;\n exports2.create = create$2;\n exports2.create$1 = create$1;\n exports2.create$2 = create;\n exports2.createCommonjsModule = createCommonjsModule;\n exports2.createExpression = createExpression;\n exports2.createLayout = createLayout;\n exports2.createStyleLayer = createStyleLayer;\n exports2.cross = cross;\n exports2.deepEqual = deepEqual;\n exports2.dot = dot;\n exports2.dot$1 = dot$1;\n exports2.ease = ease;\n exports2.emitValidationErrors = emitValidationErrors;\n exports2.endsWith = endsWith;\n exports2.enforceCacheSizeLimit = enforceCacheSizeLimit;\n exports2.evaluateSizeForFeature = evaluateSizeForFeature;\n exports2.evaluateSizeForZoom = evaluateSizeForZoom;\n exports2.evaluateVariableOffset = evaluateVariableOffset;\n exports2.evented = evented;\n exports2.extend = extend2;\n exports2.featureFilter = createFilter;\n exports2.filterObject = filterObject;\n exports2.fromRotation = fromRotation;\n exports2.getAnchorAlignment = getAnchorAlignment;\n exports2.getAnchorJustification = getAnchorJustification;\n exports2.getArrayBuffer = getArrayBuffer;\n exports2.getImage = getImage;\n exports2.getJSON = getJSON;\n exports2.getRTLTextPluginStatus = getRTLTextPluginStatus;\n exports2.getReferrer = getReferrer;\n exports2.getVideo = getVideo;\n exports2.identity = identity2;\n exports2.invert = invert;\n exports2.isChar = unicodeBlockLookup;\n exports2.isMapboxURL = isMapboxURL;\n exports2.keysDifference = keysDifference;\n exports2.makeRequest = makeRequest;\n exports2.mapObject = mapObject;\n exports2.mercatorXfromLng = mercatorXfromLng$1;\n exports2.mercatorYfromLat = mercatorYfromLat$1;\n exports2.mercatorZfromAltitude = mercatorZfromAltitude;\n exports2.mul = mul;\n exports2.multiply = multiply;\n exports2.mvt = vectorTile;\n exports2.nextPowerOfTwo = nextPowerOfTwo;\n exports2.normalize = normalize;\n exports2.number = number;\n exports2.offscreenCanvasSupported = offscreenCanvasSupported;\n exports2.ortho = ortho;\n exports2.parseGlyphPBF = parseGlyphPBF;\n exports2.pbf = pbf;\n exports2.performSymbolLayout = performSymbolLayout;\n exports2.perspective = perspective;\n exports2.pick = pick;\n exports2.plugin = plugin;\n exports2.polygonIntersectsPolygon = polygonIntersectsPolygon;\n exports2.postMapLoadEvent = postMapLoadEvent;\n exports2.postTurnstileEvent = postTurnstileEvent;\n exports2.potpack = potpack;\n exports2.refProperties = refProperties;\n exports2.register = register;\n exports2.registerForPluginStateChange = registerForPluginStateChange;\n exports2.renderColorRamp = renderColorRamp;\n exports2.rotate = rotate;\n exports2.rotateX = rotateX;\n exports2.rotateZ = rotateZ;\n exports2.scale = scale;\n exports2.scale$1 = scale$2;\n exports2.scale$2 = scale$1;\n exports2.setCacheLimits = setCacheLimits;\n exports2.setRTLTextPlugin = setRTLTextPlugin;\n exports2.sphericalToCartesian = sphericalToCartesian;\n exports2.sqrLen = sqrLen;\n exports2.styleSpec = spec;\n exports2.sub = sub;\n exports2.symbolSize = symbolSize;\n exports2.transformMat3 = transformMat3;\n exports2.transformMat4 = transformMat4;\n exports2.translate = translate$1;\n exports2.triggerPluginCompletionEvent = triggerPluginCompletionEvent;\n exports2.uniqueId = uniqueId;\n exports2.validateCustomStyleLayer = validateCustomStyleLayer;\n exports2.validateLight = validateLight$1;\n exports2.validateStyle = validateStyle;\n exports2.values = values;\n exports2.vectorTile = vectorTile;\n exports2.version = version;\n exports2.warnOnce = warnOnce;\n exports2.webpSupported = exported$1;\n exports2.window = window$1;\n exports2.wrap = wrap;\n });\n define2([\"./shared\"], function(performance2) {\n \"use strict\";\n function stringify(obj) {\n var type = typeof obj;\n if (type === \"number\" || type === \"boolean\" || type === \"string\" || obj === void 0 || obj === null) {\n return JSON.stringify(obj);\n }\n if (Array.isArray(obj)) {\n var str$1 = \"[\";\n for (var i$1 = 0, list = obj; i$1 < list.length; i$1 += 1) {\n var val = list[i$1];\n str$1 += stringify(val) + \",\";\n }\n return str$1 + \"]\";\n }\n var keys = Object.keys(obj).sort();\n var str = \"{\";\n for (var i = 0; i < keys.length; i++) {\n str += JSON.stringify(keys[i]) + \":\" + stringify(obj[keys[i]]) + \",\";\n }\n return str + \"}\";\n }\n function getKey(layer) {\n var key = \"\";\n for (var i = 0, list = performance2.refProperties; i < list.length; i += 1) {\n var k = list[i];\n key += \"/\" + stringify(layer[k]);\n }\n return key;\n }\n function groupByLayout(layers, cachedKeys) {\n var groups = {};\n for (var i = 0; i < layers.length; i++) {\n var k = cachedKeys && cachedKeys[layers[i].id] || getKey(layers[i]);\n if (cachedKeys) {\n cachedKeys[layers[i].id] = k;\n }\n var group = groups[k];\n if (!group) {\n group = groups[k] = [];\n }\n group.push(layers[i]);\n }\n var result = [];\n for (var k$1 in groups) {\n result.push(groups[k$1]);\n }\n return result;\n }\n var StyleLayerIndex = function StyleLayerIndex2(layerConfigs) {\n this.keyCache = {};\n if (layerConfigs) {\n this.replace(layerConfigs);\n }\n };\n StyleLayerIndex.prototype.replace = function replace(layerConfigs) {\n this._layerConfigs = {};\n this._layers = {};\n this.update(layerConfigs, []);\n };\n StyleLayerIndex.prototype.update = function update(layerConfigs, removedIds) {\n var this$1 = this;\n for (var i = 0, list = layerConfigs; i < list.length; i += 1) {\n var layerConfig = list[i];\n this._layerConfigs[layerConfig.id] = layerConfig;\n var layer = this._layers[layerConfig.id] = performance2.createStyleLayer(layerConfig);\n layer._featureFilter = performance2.featureFilter(layer.filter);\n if (this.keyCache[layerConfig.id]) {\n delete this.keyCache[layerConfig.id];\n }\n }\n for (var i$1 = 0, list$1 = removedIds; i$1 < list$1.length; i$1 += 1) {\n var id = list$1[i$1];\n delete this.keyCache[id];\n delete this._layerConfigs[id];\n delete this._layers[id];\n }\n this.familiesBySource = {};\n var groups = groupByLayout(performance2.values(this._layerConfigs), this.keyCache);\n for (var i$2 = 0, list$2 = groups; i$2 < list$2.length; i$2 += 1) {\n var layerConfigs$1 = list$2[i$2];\n var layers = layerConfigs$1.map(function(layerConfig2) {\n return this$1._layers[layerConfig2.id];\n });\n var layer$1 = layers[0];\n if (layer$1.visibility === \"none\") {\n continue;\n }\n var sourceId = layer$1.source || \"\";\n var sourceGroup = this.familiesBySource[sourceId];\n if (!sourceGroup) {\n sourceGroup = this.familiesBySource[sourceId] = {};\n }\n var sourceLayerId = layer$1.sourceLayer || \"_geojsonTileLayer\";\n var sourceLayerFamilies = sourceGroup[sourceLayerId];\n if (!sourceLayerFamilies) {\n sourceLayerFamilies = sourceGroup[sourceLayerId] = [];\n }\n sourceLayerFamilies.push(layers);\n }\n };\n var padding = 1;\n var GlyphAtlas = function GlyphAtlas2(stacks) {\n var positions = {};\n var bins = [];\n for (var stack in stacks) {\n var glyphs = stacks[stack];\n var stackPositions = positions[stack] = {};\n for (var id in glyphs) {\n var src = glyphs[+id];\n if (!src || src.bitmap.width === 0 || src.bitmap.height === 0) {\n continue;\n }\n var bin = {\n x: 0,\n y: 0,\n w: src.bitmap.width + 2 * padding,\n h: src.bitmap.height + 2 * padding\n };\n bins.push(bin);\n stackPositions[id] = {\n rect: bin,\n metrics: src.metrics\n };\n }\n }\n var ref = performance2.potpack(bins);\n var w = ref.w;\n var h = ref.h;\n var image = new performance2.AlphaImage({\n width: w || 1,\n height: h || 1\n });\n for (var stack$1 in stacks) {\n var glyphs$1 = stacks[stack$1];\n for (var id$1 in glyphs$1) {\n var src$1 = glyphs$1[+id$1];\n if (!src$1 || src$1.bitmap.width === 0 || src$1.bitmap.height === 0) {\n continue;\n }\n var bin$1 = positions[stack$1][id$1].rect;\n performance2.AlphaImage.copy(src$1.bitmap, image, {\n x: 0,\n y: 0\n }, {\n x: bin$1.x + padding,\n y: bin$1.y + padding\n }, src$1.bitmap);\n }\n }\n this.image = image;\n this.positions = positions;\n };\n performance2.register(\"GlyphAtlas\", GlyphAtlas);\n var WorkerTile = function WorkerTile2(params) {\n this.tileID = new performance2.OverscaledTileID(params.tileID.overscaledZ, params.tileID.wrap, params.tileID.canonical.z, params.tileID.canonical.x, params.tileID.canonical.y);\n this.uid = params.uid;\n this.zoom = params.zoom;\n this.pixelRatio = params.pixelRatio;\n this.tileSize = params.tileSize;\n this.source = params.source;\n this.overscaling = this.tileID.overscaleFactor();\n this.showCollisionBoxes = params.showCollisionBoxes;\n this.collectResourceTiming = !!params.collectResourceTiming;\n this.returnDependencies = !!params.returnDependencies;\n this.promoteId = params.promoteId;\n };\n WorkerTile.prototype.parse = function parse2(data, layerIndex, availableImages, actor, callback) {\n var this$1 = this;\n this.status = \"parsing\";\n this.data = data;\n this.collisionBoxArray = new performance2.CollisionBoxArray();\n var sourceLayerCoder = new performance2.DictionaryCoder(Object.keys(data.layers).sort());\n var featureIndex = new performance2.FeatureIndex(this.tileID, this.promoteId);\n featureIndex.bucketLayerIDs = [];\n var buckets = {};\n var options = {\n featureIndex,\n iconDependencies: {},\n patternDependencies: {},\n glyphDependencies: {},\n availableImages\n };\n var layerFamilies = layerIndex.familiesBySource[this.source];\n for (var sourceLayerId in layerFamilies) {\n var sourceLayer = data.layers[sourceLayerId];\n if (!sourceLayer) {\n continue;\n }\n if (sourceLayer.version === 1) {\n performance2.warnOnce('Vector tile source \"' + this.source + '\" layer \"' + sourceLayerId + '\" does not use vector tile spec v2 and therefore may have some rendering errors.');\n }\n var sourceLayerIndex = sourceLayerCoder.encode(sourceLayerId);\n var features = [];\n for (var index = 0; index < sourceLayer.length; index++) {\n var feature = sourceLayer.feature(index);\n var id = featureIndex.getId(feature, sourceLayerId);\n features.push({\n feature,\n id,\n index,\n sourceLayerIndex\n });\n }\n for (var i = 0, list = layerFamilies[sourceLayerId]; i < list.length; i += 1) {\n var family = list[i];\n var layer = family[0];\n if (layer.minzoom && this.zoom < Math.floor(layer.minzoom)) {\n continue;\n }\n if (layer.maxzoom && this.zoom >= layer.maxzoom) {\n continue;\n }\n if (layer.visibility === \"none\") {\n continue;\n }\n recalculateLayers(family, this.zoom, availableImages);\n var bucket = buckets[layer.id] = layer.createBucket({\n index: featureIndex.bucketLayerIDs.length,\n layers: family,\n zoom: this.zoom,\n pixelRatio: this.pixelRatio,\n overscaling: this.overscaling,\n collisionBoxArray: this.collisionBoxArray,\n sourceLayerIndex,\n sourceID: this.source\n });\n bucket.populate(features, options, this.tileID.canonical);\n featureIndex.bucketLayerIDs.push(family.map(function(l) {\n return l.id;\n }));\n }\n }\n var error;\n var glyphMap;\n var iconMap;\n var patternMap;\n var stacks = performance2.mapObject(options.glyphDependencies, function(glyphs) {\n return Object.keys(glyphs).map(Number);\n });\n if (Object.keys(stacks).length) {\n actor.send(\"getGlyphs\", {\n uid: this.uid,\n stacks\n }, function(err, result) {\n if (!error) {\n error = err;\n glyphMap = result;\n maybePrepare.call(this$1);\n }\n });\n } else {\n glyphMap = {};\n }\n var icons = Object.keys(options.iconDependencies);\n if (icons.length) {\n actor.send(\"getImages\", {\n icons,\n source: this.source,\n tileID: this.tileID,\n type: \"icons\"\n }, function(err, result) {\n if (!error) {\n error = err;\n iconMap = result;\n maybePrepare.call(this$1);\n }\n });\n } else {\n iconMap = {};\n }\n var patterns = Object.keys(options.patternDependencies);\n if (patterns.length) {\n actor.send(\"getImages\", {\n icons: patterns,\n source: this.source,\n tileID: this.tileID,\n type: \"patterns\"\n }, function(err, result) {\n if (!error) {\n error = err;\n patternMap = result;\n maybePrepare.call(this$1);\n }\n });\n } else {\n patternMap = {};\n }\n maybePrepare.call(this);\n function maybePrepare() {\n if (error) {\n return callback(error);\n } else if (glyphMap && iconMap && patternMap) {\n var glyphAtlas = new GlyphAtlas(glyphMap);\n var imageAtlas = new performance2.ImageAtlas(iconMap, patternMap);\n for (var key in buckets) {\n var bucket2 = buckets[key];\n if (bucket2 instanceof performance2.SymbolBucket) {\n recalculateLayers(bucket2.layers, this.zoom, availableImages);\n performance2.performSymbolLayout(bucket2, glyphMap, glyphAtlas.positions, iconMap, imageAtlas.iconPositions, this.showCollisionBoxes, this.tileID.canonical);\n } else if (bucket2.hasPattern && (bucket2 instanceof performance2.LineBucket || bucket2 instanceof performance2.FillBucket || bucket2 instanceof performance2.FillExtrusionBucket)) {\n recalculateLayers(bucket2.layers, this.zoom, availableImages);\n bucket2.addFeatures(options, this.tileID.canonical, imageAtlas.patternPositions);\n }\n }\n this.status = \"done\";\n callback(null, {\n buckets: performance2.values(buckets).filter(function(b) {\n return !b.isEmpty();\n }),\n featureIndex,\n collisionBoxArray: this.collisionBoxArray,\n glyphAtlasImage: glyphAtlas.image,\n imageAtlas,\n glyphMap: this.returnDependencies ? glyphMap : null,\n iconMap: this.returnDependencies ? iconMap : null,\n glyphPositions: this.returnDependencies ? glyphAtlas.positions : null\n });\n }\n }\n };\n function recalculateLayers(layers, zoom, availableImages) {\n var parameters = new performance2.EvaluationParameters(zoom);\n for (var i = 0, list = layers; i < list.length; i += 1) {\n var layer = list[i];\n layer.recalculate(parameters, availableImages);\n }\n }\n function loadVectorTile(params, callback) {\n var request = performance2.getArrayBuffer(params.request, function(err, data, cacheControl, expires) {\n if (err) {\n callback(err);\n } else if (data) {\n callback(null, {\n vectorTile: new performance2.vectorTile.VectorTile(new performance2.pbf(data)),\n rawData: data,\n cacheControl,\n expires\n });\n }\n });\n return function() {\n request.cancel();\n callback();\n };\n }\n var VectorTileWorkerSource = function VectorTileWorkerSource2(actor, layerIndex, availableImages, loadVectorData) {\n this.actor = actor;\n this.layerIndex = layerIndex;\n this.availableImages = availableImages;\n this.loadVectorData = loadVectorData || loadVectorTile;\n this.loading = {};\n this.loaded = {};\n };\n VectorTileWorkerSource.prototype.loadTile = function loadTile(params, callback) {\n var this$1 = this;\n var uid = params.uid;\n if (!this.loading) {\n this.loading = {};\n }\n var perf = params && params.request && params.request.collectResourceTiming ? new performance2.RequestPerformance(params.request) : false;\n var workerTile = this.loading[uid] = new WorkerTile(params);\n workerTile.abort = this.loadVectorData(params, function(err, response) {\n delete this$1.loading[uid];\n if (err || !response) {\n workerTile.status = \"done\";\n this$1.loaded[uid] = workerTile;\n return callback(err);\n }\n var rawTileData = response.rawData;\n var cacheControl = {};\n if (response.expires) {\n cacheControl.expires = response.expires;\n }\n if (response.cacheControl) {\n cacheControl.cacheControl = response.cacheControl;\n }\n var resourceTiming = {};\n if (perf) {\n var resourceTimingData = perf.finish();\n if (resourceTimingData) {\n resourceTiming.resourceTiming = JSON.parse(JSON.stringify(resourceTimingData));\n }\n }\n workerTile.vectorTile = response.vectorTile;\n workerTile.parse(response.vectorTile, this$1.layerIndex, this$1.availableImages, this$1.actor, function(err2, result) {\n if (err2 || !result) {\n return callback(err2);\n }\n callback(null, performance2.extend({ rawTileData: rawTileData.slice(0) }, result, cacheControl, resourceTiming));\n });\n this$1.loaded = this$1.loaded || {};\n this$1.loaded[uid] = workerTile;\n });\n };\n VectorTileWorkerSource.prototype.reloadTile = function reloadTile(params, callback) {\n var this$1 = this;\n var loaded = this.loaded, uid = params.uid, vtSource = this;\n if (loaded && loaded[uid]) {\n var workerTile = loaded[uid];\n workerTile.showCollisionBoxes = params.showCollisionBoxes;\n var done = function(err, data) {\n var reloadCallback = workerTile.reloadCallback;\n if (reloadCallback) {\n delete workerTile.reloadCallback;\n workerTile.parse(workerTile.vectorTile, vtSource.layerIndex, this$1.availableImages, vtSource.actor, reloadCallback);\n }\n callback(err, data);\n };\n if (workerTile.status === \"parsing\") {\n workerTile.reloadCallback = done;\n } else if (workerTile.status === \"done\") {\n if (workerTile.vectorTile) {\n workerTile.parse(workerTile.vectorTile, this.layerIndex, this.availableImages, this.actor, done);\n } else {\n done();\n }\n }\n }\n };\n VectorTileWorkerSource.prototype.abortTile = function abortTile(params, callback) {\n var loading = this.loading, uid = params.uid;\n if (loading && loading[uid] && loading[uid].abort) {\n loading[uid].abort();\n delete loading[uid];\n }\n callback();\n };\n VectorTileWorkerSource.prototype.removeTile = function removeTile(params, callback) {\n var loaded = this.loaded, uid = params.uid;\n if (loaded && loaded[uid]) {\n delete loaded[uid];\n }\n callback();\n };\n var ImageBitmap2 = performance2.window.ImageBitmap;\n var RasterDEMTileWorkerSource = function RasterDEMTileWorkerSource2() {\n this.loaded = {};\n };\n RasterDEMTileWorkerSource.prototype.loadTile = function loadTile(params, callback) {\n var uid = params.uid;\n var encoding = params.encoding;\n var rawImageData = params.rawImageData;\n var imagePixels = ImageBitmap2 && rawImageData instanceof ImageBitmap2 ? this.getImageData(rawImageData) : rawImageData;\n var dem = new performance2.DEMData(uid, imagePixels, encoding);\n this.loaded = this.loaded || {};\n this.loaded[uid] = dem;\n callback(null, dem);\n };\n RasterDEMTileWorkerSource.prototype.getImageData = function getImageData(imgBitmap) {\n if (!this.offscreenCanvas || !this.offscreenCanvasContext) {\n this.offscreenCanvas = new OffscreenCanvas(imgBitmap.width, imgBitmap.height);\n this.offscreenCanvasContext = this.offscreenCanvas.getContext(\"2d\");\n }\n this.offscreenCanvas.width = imgBitmap.width;\n this.offscreenCanvas.height = imgBitmap.height;\n this.offscreenCanvasContext.drawImage(imgBitmap, 0, 0, imgBitmap.width, imgBitmap.height);\n var imgData = this.offscreenCanvasContext.getImageData(-1, -1, imgBitmap.width + 2, imgBitmap.height + 2);\n this.offscreenCanvasContext.clearRect(0, 0, this.offscreenCanvas.width, this.offscreenCanvas.height);\n return new performance2.RGBAImage({\n width: imgData.width,\n height: imgData.height\n }, imgData.data);\n };\n RasterDEMTileWorkerSource.prototype.removeTile = function removeTile(params) {\n var loaded = this.loaded, uid = params.uid;\n if (loaded && loaded[uid]) {\n delete loaded[uid];\n }\n };\n var geojsonRewind = rewind;\n function rewind(gj, outer) {\n var type = gj && gj.type, i;\n if (type === \"FeatureCollection\") {\n for (i = 0; i < gj.features.length; i++) {\n rewind(gj.features[i], outer);\n }\n } else if (type === \"GeometryCollection\") {\n for (i = 0; i < gj.geometries.length; i++) {\n rewind(gj.geometries[i], outer);\n }\n } else if (type === \"Feature\") {\n rewind(gj.geometry, outer);\n } else if (type === \"Polygon\") {\n rewindRings(gj.coordinates, outer);\n } else if (type === \"MultiPolygon\") {\n for (i = 0; i < gj.coordinates.length; i++) {\n rewindRings(gj.coordinates[i], outer);\n }\n }\n return gj;\n }\n function rewindRings(rings, outer) {\n if (rings.length === 0) {\n return;\n }\n rewindRing(rings[0], outer);\n for (var i = 1; i < rings.length; i++) {\n rewindRing(rings[i], !outer);\n }\n }\n function rewindRing(ring, dir) {\n var area = 0;\n for (var i = 0, len = ring.length, j = len - 1; i < len; j = i++) {\n area += (ring[i][0] - ring[j][0]) * (ring[j][1] + ring[i][1]);\n }\n if (area >= 0 !== !!dir) {\n ring.reverse();\n }\n }\n var toGeoJSON = performance2.vectorTile.VectorTileFeature.prototype.toGeoJSON;\n var FeatureWrapper = function FeatureWrapper2(feature) {\n this._feature = feature;\n this.extent = performance2.EXTENT;\n this.type = feature.type;\n this.properties = feature.tags;\n if (\"id\" in feature && !isNaN(feature.id)) {\n this.id = parseInt(feature.id, 10);\n }\n };\n FeatureWrapper.prototype.loadGeometry = function loadGeometry() {\n if (this._feature.type === 1) {\n var geometry = [];\n for (var i = 0, list = this._feature.geometry; i < list.length; i += 1) {\n var point = list[i];\n geometry.push([new performance2.Point$1(point[0], point[1])]);\n }\n return geometry;\n } else {\n var geometry$1 = [];\n for (var i$2 = 0, list$2 = this._feature.geometry; i$2 < list$2.length; i$2 += 1) {\n var ring = list$2[i$2];\n var newRing = [];\n for (var i$1 = 0, list$1 = ring; i$1 < list$1.length; i$1 += 1) {\n var point$1 = list$1[i$1];\n newRing.push(new performance2.Point$1(point$1[0], point$1[1]));\n }\n geometry$1.push(newRing);\n }\n return geometry$1;\n }\n };\n FeatureWrapper.prototype.toGeoJSON = function toGeoJSON$1(x, y, z) {\n return toGeoJSON.call(this, x, y, z);\n };\n var GeoJSONWrapper = function GeoJSONWrapper2(features) {\n this.layers = { \"_geojsonTileLayer\": this };\n this.name = \"_geojsonTileLayer\";\n this.extent = performance2.EXTENT;\n this.length = features.length;\n this._features = features;\n };\n GeoJSONWrapper.prototype.feature = function feature(i) {\n return new FeatureWrapper(this._features[i]);\n };\n var VectorTileFeature = performance2.vectorTile.VectorTileFeature;\n var geojson_wrapper = GeoJSONWrapper$1;\n function GeoJSONWrapper$1(features, options) {\n this.options = options || {};\n this.features = features;\n this.length = features.length;\n }\n GeoJSONWrapper$1.prototype.feature = function(i) {\n return new FeatureWrapper$1(this.features[i], this.options.extent);\n };\n function FeatureWrapper$1(feature, extent) {\n this.id = typeof feature.id === \"number\" ? feature.id : void 0;\n this.type = feature.type;\n this.rawGeometry = feature.type === 1 ? [feature.geometry] : feature.geometry;\n this.properties = feature.tags;\n this.extent = extent || 4096;\n }\n FeatureWrapper$1.prototype.loadGeometry = function() {\n var rings = this.rawGeometry;\n this.geometry = [];\n for (var i = 0; i < rings.length; i++) {\n var ring = rings[i];\n var newRing = [];\n for (var j = 0; j < ring.length; j++) {\n newRing.push(new performance2.Point$1(ring[j][0], ring[j][1]));\n }\n this.geometry.push(newRing);\n }\n return this.geometry;\n };\n FeatureWrapper$1.prototype.bbox = function() {\n if (!this.geometry) {\n this.loadGeometry();\n }\n var rings = this.geometry;\n var x1 = Infinity;\n var x2 = -Infinity;\n var y1 = Infinity;\n var y2 = -Infinity;\n for (var i = 0; i < rings.length; i++) {\n var ring = rings[i];\n for (var j = 0; j < ring.length; j++) {\n var coord = ring[j];\n x1 = Math.min(x1, coord.x);\n x2 = Math.max(x2, coord.x);\n y1 = Math.min(y1, coord.y);\n y2 = Math.max(y2, coord.y);\n }\n }\n return [\n x1,\n y1,\n x2,\n y2\n ];\n };\n FeatureWrapper$1.prototype.toGeoJSON = VectorTileFeature.prototype.toGeoJSON;\n var vtPbf = fromVectorTileJs;\n var fromVectorTileJs_1 = fromVectorTileJs;\n var fromGeojsonVt_1 = fromGeojsonVt;\n var GeoJSONWrapper_1 = geojson_wrapper;\n function fromVectorTileJs(tile) {\n var out = new performance2.pbf();\n writeTile(tile, out);\n return out.finish();\n }\n function fromGeojsonVt(layers, options) {\n options = options || {};\n var l = {};\n for (var k in layers) {\n l[k] = new geojson_wrapper(layers[k].features, options);\n l[k].name = k;\n l[k].version = options.version;\n l[k].extent = options.extent;\n }\n return fromVectorTileJs({ layers: l });\n }\n function writeTile(tile, pbf) {\n for (var key in tile.layers) {\n pbf.writeMessage(3, writeLayer, tile.layers[key]);\n }\n }\n function writeLayer(layer, pbf) {\n pbf.writeVarintField(15, layer.version || 1);\n pbf.writeStringField(1, layer.name || \"\");\n pbf.writeVarintField(5, layer.extent || 4096);\n var i;\n var context = {\n keys: [],\n values: [],\n keycache: {},\n valuecache: {}\n };\n for (i = 0; i < layer.length; i++) {\n context.feature = layer.feature(i);\n pbf.writeMessage(2, writeFeature, context);\n }\n var keys = context.keys;\n for (i = 0; i < keys.length; i++) {\n pbf.writeStringField(3, keys[i]);\n }\n var values = context.values;\n for (i = 0; i < values.length; i++) {\n pbf.writeMessage(4, writeValue, values[i]);\n }\n }\n function writeFeature(context, pbf) {\n var feature = context.feature;\n if (feature.id !== void 0) {\n pbf.writeVarintField(1, feature.id);\n }\n pbf.writeMessage(2, writeProperties, context);\n pbf.writeVarintField(3, feature.type);\n pbf.writeMessage(4, writeGeometry, feature);\n }\n function writeProperties(context, pbf) {\n var feature = context.feature;\n var keys = context.keys;\n var values = context.values;\n var keycache = context.keycache;\n var valuecache = context.valuecache;\n for (var key in feature.properties) {\n var keyIndex = keycache[key];\n if (typeof keyIndex === \"undefined\") {\n keys.push(key);\n keyIndex = keys.length - 1;\n keycache[key] = keyIndex;\n }\n pbf.writeVarint(keyIndex);\n var value = feature.properties[key];\n var type = typeof value;\n if (type !== \"string\" && type !== \"boolean\" && type !== \"number\") {\n value = JSON.stringify(value);\n }\n var valueKey = type + \":\" + value;\n var valueIndex = valuecache[valueKey];\n if (typeof valueIndex === \"undefined\") {\n values.push(value);\n valueIndex = values.length - 1;\n valuecache[valueKey] = valueIndex;\n }\n pbf.writeVarint(valueIndex);\n }\n }\n function command(cmd, length) {\n return (length << 3) + (cmd & 7);\n }\n function zigzag(num) {\n return num << 1 ^ num >> 31;\n }\n function writeGeometry(feature, pbf) {\n var geometry = feature.loadGeometry();\n var type = feature.type;\n var x = 0;\n var y = 0;\n var rings = geometry.length;\n for (var r = 0; r < rings; r++) {\n var ring = geometry[r];\n var count = 1;\n if (type === 1) {\n count = ring.length;\n }\n pbf.writeVarint(command(1, count));\n var lineCount = type === 3 ? ring.length - 1 : ring.length;\n for (var i = 0; i < lineCount; i++) {\n if (i === 1 && type !== 1) {\n pbf.writeVarint(command(2, lineCount - 1));\n }\n var dx = ring[i].x - x;\n var dy = ring[i].y - y;\n pbf.writeVarint(zigzag(dx));\n pbf.writeVarint(zigzag(dy));\n x += dx;\n y += dy;\n }\n if (type === 3) {\n pbf.writeVarint(command(7, 1));\n }\n }\n }\n function writeValue(value, pbf) {\n var type = typeof value;\n if (type === \"string\") {\n pbf.writeStringField(1, value);\n } else if (type === \"boolean\") {\n pbf.writeBooleanField(7, value);\n } else if (type === \"number\") {\n if (value % 1 !== 0) {\n pbf.writeDoubleField(3, value);\n } else if (value < 0) {\n pbf.writeSVarintField(6, value);\n } else {\n pbf.writeVarintField(5, value);\n }\n }\n }\n vtPbf.fromVectorTileJs = fromVectorTileJs_1;\n vtPbf.fromGeojsonVt = fromGeojsonVt_1;\n vtPbf.GeoJSONWrapper = GeoJSONWrapper_1;\n function sortKD(ids, coords, nodeSize, left, right, depth) {\n if (right - left <= nodeSize) {\n return;\n }\n var m = left + right >> 1;\n select(ids, coords, m, left, right, depth % 2);\n sortKD(ids, coords, nodeSize, left, m - 1, depth + 1);\n sortKD(ids, coords, nodeSize, m + 1, right, depth + 1);\n }\n function select(ids, coords, k, left, right, inc) {\n while (right > left) {\n if (right - left > 600) {\n var n = right - left + 1;\n var m = k - left + 1;\n var z = Math.log(n);\n var s = 0.5 * Math.exp(2 * z / 3);\n var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);\n var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));\n var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));\n select(ids, coords, k, newLeft, newRight, inc);\n }\n var t = coords[2 * k + inc];\n var i = left;\n var j = right;\n swapItem(ids, coords, left, k);\n if (coords[2 * right + inc] > t) {\n swapItem(ids, coords, left, right);\n }\n while (i < j) {\n swapItem(ids, coords, i, j);\n i++;\n j--;\n while (coords[2 * i + inc] < t) {\n i++;\n }\n while (coords[2 * j + inc] > t) {\n j--;\n }\n }\n if (coords[2 * left + inc] === t) {\n swapItem(ids, coords, left, j);\n } else {\n j++;\n swapItem(ids, coords, j, right);\n }\n if (j <= k) {\n left = j + 1;\n }\n if (k <= j) {\n right = j - 1;\n }\n }\n }\n function swapItem(ids, coords, i, j) {\n swap(ids, i, j);\n swap(coords, 2 * i, 2 * j);\n swap(coords, 2 * i + 1, 2 * j + 1);\n }\n function swap(arr, i, j) {\n var tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n function range(ids, coords, minX, minY, maxX, maxY, nodeSize) {\n var stack = [\n 0,\n ids.length - 1,\n 0\n ];\n var result = [];\n var x, y;\n while (stack.length) {\n var axis = stack.pop();\n var right = stack.pop();\n var left = stack.pop();\n if (right - left <= nodeSize) {\n for (var i = left; i <= right; i++) {\n x = coords[2 * i];\n y = coords[2 * i + 1];\n if (x >= minX && x <= maxX && y >= minY && y <= maxY) {\n result.push(ids[i]);\n }\n }\n continue;\n }\n var m = Math.floor((left + right) / 2);\n x = coords[2 * m];\n y = coords[2 * m + 1];\n if (x >= minX && x <= maxX && y >= minY && y <= maxY) {\n result.push(ids[m]);\n }\n var nextAxis = (axis + 1) % 2;\n if (axis === 0 ? minX <= x : minY <= y) {\n stack.push(left);\n stack.push(m - 1);\n stack.push(nextAxis);\n }\n if (axis === 0 ? maxX >= x : maxY >= y) {\n stack.push(m + 1);\n stack.push(right);\n stack.push(nextAxis);\n }\n }\n return result;\n }\n function within(ids, coords, qx, qy, r, nodeSize) {\n var stack = [\n 0,\n ids.length - 1,\n 0\n ];\n var result = [];\n var r2 = r * r;\n while (stack.length) {\n var axis = stack.pop();\n var right = stack.pop();\n var left = stack.pop();\n if (right - left <= nodeSize) {\n for (var i = left; i <= right; i++) {\n if (sqDist(coords[2 * i], coords[2 * i + 1], qx, qy) <= r2) {\n result.push(ids[i]);\n }\n }\n continue;\n }\n var m = Math.floor((left + right) / 2);\n var x = coords[2 * m];\n var y = coords[2 * m + 1];\n if (sqDist(x, y, qx, qy) <= r2) {\n result.push(ids[m]);\n }\n var nextAxis = (axis + 1) % 2;\n if (axis === 0 ? qx - r <= x : qy - r <= y) {\n stack.push(left);\n stack.push(m - 1);\n stack.push(nextAxis);\n }\n if (axis === 0 ? qx + r >= x : qy + r >= y) {\n stack.push(m + 1);\n stack.push(right);\n stack.push(nextAxis);\n }\n }\n return result;\n }\n function sqDist(ax, ay, bx, by) {\n var dx = ax - bx;\n var dy = ay - by;\n return dx * dx + dy * dy;\n }\n var defaultGetX = function(p) {\n return p[0];\n };\n var defaultGetY = function(p) {\n return p[1];\n };\n var KDBush = function KDBush2(points, getX2, getY2, nodeSize, ArrayType) {\n if (getX2 === void 0)\n getX2 = defaultGetX;\n if (getY2 === void 0)\n getY2 = defaultGetY;\n if (nodeSize === void 0)\n nodeSize = 64;\n if (ArrayType === void 0)\n ArrayType = Float64Array;\n this.nodeSize = nodeSize;\n this.points = points;\n var IndexArrayType = points.length < 65536 ? Uint16Array : Uint32Array;\n var ids = this.ids = new IndexArrayType(points.length);\n var coords = this.coords = new ArrayType(points.length * 2);\n for (var i = 0; i < points.length; i++) {\n ids[i] = i;\n coords[2 * i] = getX2(points[i]);\n coords[2 * i + 1] = getY2(points[i]);\n }\n sortKD(ids, coords, nodeSize, 0, ids.length - 1, 0);\n };\n KDBush.prototype.range = function range$1(minX, minY, maxX, maxY) {\n return range(this.ids, this.coords, minX, minY, maxX, maxY, this.nodeSize);\n };\n KDBush.prototype.within = function within$1(x, y, r) {\n return within(this.ids, this.coords, x, y, r, this.nodeSize);\n };\n var defaultOptions = {\n minZoom: 0,\n maxZoom: 16,\n minPoints: 2,\n radius: 40,\n extent: 512,\n nodeSize: 64,\n log: false,\n generateId: false,\n reduce: null,\n map: function(props) {\n return props;\n }\n };\n var Supercluster = function Supercluster2(options) {\n this.options = extend2(Object.create(defaultOptions), options);\n this.trees = new Array(this.options.maxZoom + 1);\n };\n Supercluster.prototype.load = function load(points) {\n var ref = this.options;\n var log = ref.log;\n var minZoom = ref.minZoom;\n var maxZoom = ref.maxZoom;\n var nodeSize = ref.nodeSize;\n if (log) {\n console.time(\"total time\");\n }\n var timerId = \"prepare \" + points.length + \" points\";\n if (log) {\n console.time(timerId);\n }\n this.points = points;\n var clusters = [];\n for (var i = 0; i < points.length; i++) {\n if (!points[i].geometry) {\n continue;\n }\n clusters.push(createPointCluster(points[i], i));\n }\n this.trees[maxZoom + 1] = new KDBush(clusters, getX, getY, nodeSize, Float32Array);\n if (log) {\n console.timeEnd(timerId);\n }\n for (var z = maxZoom; z >= minZoom; z--) {\n var now = +Date.now();\n clusters = this._cluster(clusters, z);\n this.trees[z] = new KDBush(clusters, getX, getY, nodeSize, Float32Array);\n if (log) {\n console.log(\"z%d: %d clusters in %dms\", z, clusters.length, +Date.now() - now);\n }\n }\n if (log) {\n console.timeEnd(\"total time\");\n }\n return this;\n };\n Supercluster.prototype.getClusters = function getClusters(bbox, zoom) {\n var minLng = ((bbox[0] + 180) % 360 + 360) % 360 - 180;\n var minLat = Math.max(-90, Math.min(90, bbox[1]));\n var maxLng = bbox[2] === 180 ? 180 : ((bbox[2] + 180) % 360 + 360) % 360 - 180;\n var maxLat = Math.max(-90, Math.min(90, bbox[3]));\n if (bbox[2] - bbox[0] >= 360) {\n minLng = -180;\n maxLng = 180;\n } else if (minLng > maxLng) {\n var easternHem = this.getClusters([\n minLng,\n minLat,\n 180,\n maxLat\n ], zoom);\n var westernHem = this.getClusters([\n -180,\n minLat,\n maxLng,\n maxLat\n ], zoom);\n return easternHem.concat(westernHem);\n }\n var tree = this.trees[this._limitZoom(zoom)];\n var ids = tree.range(lngX(minLng), latY(maxLat), lngX(maxLng), latY(minLat));\n var clusters = [];\n for (var i = 0, list = ids; i < list.length; i += 1) {\n var id = list[i];\n var c = tree.points[id];\n clusters.push(c.numPoints ? getClusterJSON(c) : this.points[c.index]);\n }\n return clusters;\n };\n Supercluster.prototype.getChildren = function getChildren(clusterId) {\n var originId = this._getOriginId(clusterId);\n var originZoom = this._getOriginZoom(clusterId);\n var errorMsg = \"No cluster with the specified id.\";\n var index = this.trees[originZoom];\n if (!index) {\n throw new Error(errorMsg);\n }\n var origin = index.points[originId];\n if (!origin) {\n throw new Error(errorMsg);\n }\n var r = this.options.radius / (this.options.extent * Math.pow(2, originZoom - 1));\n var ids = index.within(origin.x, origin.y, r);\n var children = [];\n for (var i = 0, list = ids; i < list.length; i += 1) {\n var id = list[i];\n var c = index.points[id];\n if (c.parentId === clusterId) {\n children.push(c.numPoints ? getClusterJSON(c) : this.points[c.index]);\n }\n }\n if (children.length === 0) {\n throw new Error(errorMsg);\n }\n return children;\n };\n Supercluster.prototype.getLeaves = function getLeaves(clusterId, limit, offset) {\n limit = limit || 10;\n offset = offset || 0;\n var leaves = [];\n this._appendLeaves(leaves, clusterId, limit, offset, 0);\n return leaves;\n };\n Supercluster.prototype.getTile = function getTile(z, x, y) {\n var tree = this.trees[this._limitZoom(z)];\n var z2 = Math.pow(2, z);\n var ref = this.options;\n var extent = ref.extent;\n var radius = ref.radius;\n var p = radius / extent;\n var top = (y - p) / z2;\n var bottom = (y + 1 + p) / z2;\n var tile = { features: [] };\n this._addTileFeatures(tree.range((x - p) / z2, top, (x + 1 + p) / z2, bottom), tree.points, x, y, z2, tile);\n if (x === 0) {\n this._addTileFeatures(tree.range(1 - p / z2, top, 1, bottom), tree.points, z2, y, z2, tile);\n }\n if (x === z2 - 1) {\n this._addTileFeatures(tree.range(0, top, p / z2, bottom), tree.points, -1, y, z2, tile);\n }\n return tile.features.length ? tile : null;\n };\n Supercluster.prototype.getClusterExpansionZoom = function getClusterExpansionZoom(clusterId) {\n var expansionZoom = this._getOriginZoom(clusterId) - 1;\n while (expansionZoom <= this.options.maxZoom) {\n var children = this.getChildren(clusterId);\n expansionZoom++;\n if (children.length !== 1) {\n break;\n }\n clusterId = children[0].properties.cluster_id;\n }\n return expansionZoom;\n };\n Supercluster.prototype._appendLeaves = function _appendLeaves(result, clusterId, limit, offset, skipped) {\n var children = this.getChildren(clusterId);\n for (var i = 0, list = children; i < list.length; i += 1) {\n var child = list[i];\n var props = child.properties;\n if (props && props.cluster) {\n if (skipped + props.point_count <= offset) {\n skipped += props.point_count;\n } else {\n skipped = this._appendLeaves(result, props.cluster_id, limit, offset, skipped);\n }\n } else if (skipped < offset) {\n skipped++;\n } else {\n result.push(child);\n }\n if (result.length === limit) {\n break;\n }\n }\n return skipped;\n };\n Supercluster.prototype._addTileFeatures = function _addTileFeatures(ids, points, x, y, z2, tile) {\n for (var i$1 = 0, list = ids; i$1 < list.length; i$1 += 1) {\n var i = list[i$1];\n var c = points[i];\n var isCluster = c.numPoints;\n var f = {\n type: 1,\n geometry: [[\n Math.round(this.options.extent * (c.x * z2 - x)),\n Math.round(this.options.extent * (c.y * z2 - y))\n ]],\n tags: isCluster ? getClusterProperties(c) : this.points[c.index].properties\n };\n var id = void 0;\n if (isCluster) {\n id = c.id;\n } else if (this.options.generateId) {\n id = c.index;\n } else if (this.points[c.index].id) {\n id = this.points[c.index].id;\n }\n if (id !== void 0) {\n f.id = id;\n }\n tile.features.push(f);\n }\n };\n Supercluster.prototype._limitZoom = function _limitZoom(z) {\n return Math.max(this.options.minZoom, Math.min(+z, this.options.maxZoom + 1));\n };\n Supercluster.prototype._cluster = function _cluster(points, zoom) {\n var clusters = [];\n var ref = this.options;\n var radius = ref.radius;\n var extent = ref.extent;\n var reduce = ref.reduce;\n var minPoints = ref.minPoints;\n var r = radius / (extent * Math.pow(2, zoom));\n for (var i = 0; i < points.length; i++) {\n var p = points[i];\n if (p.zoom <= zoom) {\n continue;\n }\n p.zoom = zoom;\n var tree = this.trees[zoom + 1];\n var neighborIds = tree.within(p.x, p.y, r);\n var numPointsOrigin = p.numPoints || 1;\n var numPoints = numPointsOrigin;\n for (var i$1 = 0, list = neighborIds; i$1 < list.length; i$1 += 1) {\n var neighborId = list[i$1];\n var b = tree.points[neighborId];\n if (b.zoom > zoom) {\n numPoints += b.numPoints || 1;\n }\n }\n if (numPoints >= minPoints) {\n var wx = p.x * numPointsOrigin;\n var wy = p.y * numPointsOrigin;\n var clusterProperties = reduce && numPointsOrigin > 1 ? this._map(p, true) : null;\n var id = (i << 5) + (zoom + 1) + this.points.length;\n for (var i$2 = 0, list$1 = neighborIds; i$2 < list$1.length; i$2 += 1) {\n var neighborId$1 = list$1[i$2];\n var b$1 = tree.points[neighborId$1];\n if (b$1.zoom <= zoom) {\n continue;\n }\n b$1.zoom = zoom;\n var numPoints2 = b$1.numPoints || 1;\n wx += b$1.x * numPoints2;\n wy += b$1.y * numPoints2;\n b$1.parentId = id;\n if (reduce) {\n if (!clusterProperties) {\n clusterProperties = this._map(p, true);\n }\n reduce(clusterProperties, this._map(b$1));\n }\n }\n p.parentId = id;\n clusters.push(createCluster(wx / numPoints, wy / numPoints, id, numPoints, clusterProperties));\n } else {\n clusters.push(p);\n if (numPoints > 1) {\n for (var i$3 = 0, list$2 = neighborIds; i$3 < list$2.length; i$3 += 1) {\n var neighborId$2 = list$2[i$3];\n var b$2 = tree.points[neighborId$2];\n if (b$2.zoom <= zoom) {\n continue;\n }\n b$2.zoom = zoom;\n clusters.push(b$2);\n }\n }\n }\n }\n return clusters;\n };\n Supercluster.prototype._getOriginId = function _getOriginId(clusterId) {\n return clusterId - this.points.length >> 5;\n };\n Supercluster.prototype._getOriginZoom = function _getOriginZoom(clusterId) {\n return (clusterId - this.points.length) % 32;\n };\n Supercluster.prototype._map = function _map(point, clone) {\n if (point.numPoints) {\n return clone ? extend2({}, point.properties) : point.properties;\n }\n var original = this.points[point.index].properties;\n var result = this.options.map(original);\n return clone && result === original ? extend2({}, result) : result;\n };\n function createCluster(x, y, id, numPoints, properties) {\n return {\n x,\n y,\n zoom: Infinity,\n id,\n parentId: -1,\n numPoints,\n properties\n };\n }\n function createPointCluster(p, id) {\n var ref = p.geometry.coordinates;\n var x = ref[0];\n var y = ref[1];\n return {\n x: lngX(x),\n y: latY(y),\n zoom: Infinity,\n index: id,\n parentId: -1\n };\n }\n function getClusterJSON(cluster) {\n return {\n type: \"Feature\",\n id: cluster.id,\n properties: getClusterProperties(cluster),\n geometry: {\n type: \"Point\",\n coordinates: [\n xLng(cluster.x),\n yLat(cluster.y)\n ]\n }\n };\n }\n function getClusterProperties(cluster) {\n var count = cluster.numPoints;\n var abbrev = count >= 1e4 ? Math.round(count / 1e3) + \"k\" : count >= 1e3 ? Math.round(count / 100) / 10 + \"k\" : count;\n return extend2(extend2({}, cluster.properties), {\n cluster: true,\n cluster_id: cluster.id,\n point_count: count,\n point_count_abbreviated: abbrev\n });\n }\n function lngX(lng) {\n return lng / 360 + 0.5;\n }\n function latY(lat) {\n var sin = Math.sin(lat * Math.PI / 180);\n var y = 0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI;\n return y < 0 ? 0 : y > 1 ? 1 : y;\n }\n function xLng(x) {\n return (x - 0.5) * 360;\n }\n function yLat(y) {\n var y2 = (180 - y * 360) * Math.PI / 180;\n return 360 * Math.atan(Math.exp(y2)) / Math.PI - 90;\n }\n function extend2(dest, src) {\n for (var id in src) {\n dest[id] = src[id];\n }\n return dest;\n }\n function getX(p) {\n return p.x;\n }\n function getY(p) {\n return p.y;\n }\n function simplify(coords, first, last, sqTolerance) {\n var maxSqDist = sqTolerance;\n var mid = last - first >> 1;\n var minPosToMid = last - first;\n var index;\n var ax = coords[first];\n var ay = coords[first + 1];\n var bx = coords[last];\n var by = coords[last + 1];\n for (var i = first + 3; i < last; i += 3) {\n var d = getSqSegDist(coords[i], coords[i + 1], ax, ay, bx, by);\n if (d > maxSqDist) {\n index = i;\n maxSqDist = d;\n } else if (d === maxSqDist) {\n var posToMid = Math.abs(i - mid);\n if (posToMid < minPosToMid) {\n index = i;\n minPosToMid = posToMid;\n }\n }\n }\n if (maxSqDist > sqTolerance) {\n if (index - first > 3) {\n simplify(coords, first, index, sqTolerance);\n }\n coords[index + 2] = maxSqDist;\n if (last - index > 3) {\n simplify(coords, index, last, sqTolerance);\n }\n }\n }\n function getSqSegDist(px, py, x, y, bx, by) {\n var dx = bx - x;\n var dy = by - y;\n if (dx !== 0 || dy !== 0) {\n var t = ((px - x) * dx + (py - y) * dy) / (dx * dx + dy * dy);\n if (t > 1) {\n x = bx;\n y = by;\n } else if (t > 0) {\n x += dx * t;\n y += dy * t;\n }\n }\n dx = px - x;\n dy = py - y;\n return dx * dx + dy * dy;\n }\n function createFeature(id, type, geom, tags) {\n var feature = {\n id: typeof id === \"undefined\" ? null : id,\n type,\n geometry: geom,\n tags,\n minX: Infinity,\n minY: Infinity,\n maxX: -Infinity,\n maxY: -Infinity\n };\n calcBBox(feature);\n return feature;\n }\n function calcBBox(feature) {\n var geom = feature.geometry;\n var type = feature.type;\n if (type === \"Point\" || type === \"MultiPoint\" || type === \"LineString\") {\n calcLineBBox(feature, geom);\n } else if (type === \"Polygon\" || type === \"MultiLineString\") {\n for (var i = 0; i < geom.length; i++) {\n calcLineBBox(feature, geom[i]);\n }\n } else if (type === \"MultiPolygon\") {\n for (i = 0; i < geom.length; i++) {\n for (var j = 0; j < geom[i].length; j++) {\n calcLineBBox(feature, geom[i][j]);\n }\n }\n }\n }\n function calcLineBBox(feature, geom) {\n for (var i = 0; i < geom.length; i += 3) {\n feature.minX = Math.min(feature.minX, geom[i]);\n feature.minY = Math.min(feature.minY, geom[i + 1]);\n feature.maxX = Math.max(feature.maxX, geom[i]);\n feature.maxY = Math.max(feature.maxY, geom[i + 1]);\n }\n }\n function convert(data, options) {\n var features = [];\n if (data.type === \"FeatureCollection\") {\n for (var i = 0; i < data.features.length; i++) {\n convertFeature(features, data.features[i], options, i);\n }\n } else if (data.type === \"Feature\") {\n convertFeature(features, data, options);\n } else {\n convertFeature(features, { geometry: data }, options);\n }\n return features;\n }\n function convertFeature(features, geojson, options, index) {\n if (!geojson.geometry) {\n return;\n }\n var coords = geojson.geometry.coordinates;\n var type = geojson.geometry.type;\n var tolerance = Math.pow(options.tolerance / ((1 << options.maxZoom) * options.extent), 2);\n var geometry = [];\n var id = geojson.id;\n if (options.promoteId) {\n id = geojson.properties[options.promoteId];\n } else if (options.generateId) {\n id = index || 0;\n }\n if (type === \"Point\") {\n convertPoint(coords, geometry);\n } else if (type === \"MultiPoint\") {\n for (var i = 0; i < coords.length; i++) {\n convertPoint(coords[i], geometry);\n }\n } else if (type === \"LineString\") {\n convertLine(coords, geometry, tolerance, false);\n } else if (type === \"MultiLineString\") {\n if (options.lineMetrics) {\n for (i = 0; i < coords.length; i++) {\n geometry = [];\n convertLine(coords[i], geometry, tolerance, false);\n features.push(createFeature(id, \"LineString\", geometry, geojson.properties));\n }\n return;\n } else {\n convertLines(coords, geometry, tolerance, false);\n }\n } else if (type === \"Polygon\") {\n convertLines(coords, geometry, tolerance, true);\n } else if (type === \"MultiPolygon\") {\n for (i = 0; i < coords.length; i++) {\n var polygon = [];\n convertLines(coords[i], polygon, tolerance, true);\n geometry.push(polygon);\n }\n } else if (type === \"GeometryCollection\") {\n for (i = 0; i < geojson.geometry.geometries.length; i++) {\n convertFeature(features, {\n id,\n geometry: geojson.geometry.geometries[i],\n properties: geojson.properties\n }, options, index);\n }\n return;\n } else {\n throw new Error(\"Input data is not a valid GeoJSON object.\");\n }\n features.push(createFeature(id, type, geometry, geojson.properties));\n }\n function convertPoint(coords, out) {\n out.push(projectX(coords[0]));\n out.push(projectY(coords[1]));\n out.push(0);\n }\n function convertLine(ring, out, tolerance, isPolygon) {\n var x0, y0;\n var size = 0;\n for (var j = 0; j < ring.length; j++) {\n var x = projectX(ring[j][0]);\n var y = projectY(ring[j][1]);\n out.push(x);\n out.push(y);\n out.push(0);\n if (j > 0) {\n if (isPolygon) {\n size += (x0 * y - x * y0) / 2;\n } else {\n size += Math.sqrt(Math.pow(x - x0, 2) + Math.pow(y - y0, 2));\n }\n }\n x0 = x;\n y0 = y;\n }\n var last = out.length - 3;\n out[2] = 1;\n simplify(out, 0, last, tolerance);\n out[last + 2] = 1;\n out.size = Math.abs(size);\n out.start = 0;\n out.end = out.size;\n }\n function convertLines(rings, out, tolerance, isPolygon) {\n for (var i = 0; i < rings.length; i++) {\n var geom = [];\n convertLine(rings[i], geom, tolerance, isPolygon);\n out.push(geom);\n }\n }\n function projectX(x) {\n return x / 360 + 0.5;\n }\n function projectY(y) {\n var sin = Math.sin(y * Math.PI / 180);\n var y2 = 0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI;\n return y2 < 0 ? 0 : y2 > 1 ? 1 : y2;\n }\n function clip(features, scale, k1, k2, axis, minAll, maxAll, options) {\n k1 /= scale;\n k2 /= scale;\n if (minAll >= k1 && maxAll < k2) {\n return features;\n } else if (maxAll < k1 || minAll >= k2) {\n return null;\n }\n var clipped = [];\n for (var i = 0; i < features.length; i++) {\n var feature = features[i];\n var geometry = feature.geometry;\n var type = feature.type;\n var min = axis === 0 ? feature.minX : feature.minY;\n var max = axis === 0 ? feature.maxX : feature.maxY;\n if (min >= k1 && max < k2) {\n clipped.push(feature);\n continue;\n } else if (max < k1 || min >= k2) {\n continue;\n }\n var newGeometry = [];\n if (type === \"Point\" || type === \"MultiPoint\") {\n clipPoints(geometry, newGeometry, k1, k2, axis);\n } else if (type === \"LineString\") {\n clipLine(geometry, newGeometry, k1, k2, axis, false, options.lineMetrics);\n } else if (type === \"MultiLineString\") {\n clipLines(geometry, newGeometry, k1, k2, axis, false);\n } else if (type === \"Polygon\") {\n clipLines(geometry, newGeometry, k1, k2, axis, true);\n } else if (type === \"MultiPolygon\") {\n for (var j = 0; j < geometry.length; j++) {\n var polygon = [];\n clipLines(geometry[j], polygon, k1, k2, axis, true);\n if (polygon.length) {\n newGeometry.push(polygon);\n }\n }\n }\n if (newGeometry.length) {\n if (options.lineMetrics && type === \"LineString\") {\n for (j = 0; j < newGeometry.length; j++) {\n clipped.push(createFeature(feature.id, type, newGeometry[j], feature.tags));\n }\n continue;\n }\n if (type === \"LineString\" || type === \"MultiLineString\") {\n if (newGeometry.length === 1) {\n type = \"LineString\";\n newGeometry = newGeometry[0];\n } else {\n type = \"MultiLineString\";\n }\n }\n if (type === \"Point\" || type === \"MultiPoint\") {\n type = newGeometry.length === 3 ? \"Point\" : \"MultiPoint\";\n }\n clipped.push(createFeature(feature.id, type, newGeometry, feature.tags));\n }\n }\n return clipped.length ? clipped : null;\n }\n function clipPoints(geom, newGeom, k1, k2, axis) {\n for (var i = 0; i < geom.length; i += 3) {\n var a = geom[i + axis];\n if (a >= k1 && a <= k2) {\n newGeom.push(geom[i]);\n newGeom.push(geom[i + 1]);\n newGeom.push(geom[i + 2]);\n }\n }\n }\n function clipLine(geom, newGeom, k1, k2, axis, isPolygon, trackMetrics) {\n var slice = newSlice(geom);\n var intersect = axis === 0 ? intersectX : intersectY;\n var len = geom.start;\n var segLen, t;\n for (var i = 0; i < geom.length - 3; i += 3) {\n var ax = geom[i];\n var ay = geom[i + 1];\n var az = geom[i + 2];\n var bx = geom[i + 3];\n var by = geom[i + 4];\n var a = axis === 0 ? ax : ay;\n var b = axis === 0 ? bx : by;\n var exited = false;\n if (trackMetrics) {\n segLen = Math.sqrt(Math.pow(ax - bx, 2) + Math.pow(ay - by, 2));\n }\n if (a < k1) {\n if (b > k1) {\n t = intersect(slice, ax, ay, bx, by, k1);\n if (trackMetrics) {\n slice.start = len + segLen * t;\n }\n }\n } else if (a > k2) {\n if (b < k2) {\n t = intersect(slice, ax, ay, bx, by, k2);\n if (trackMetrics) {\n slice.start = len + segLen * t;\n }\n }\n } else {\n addPoint(slice, ax, ay, az);\n }\n if (b < k1 && a >= k1) {\n t = intersect(slice, ax, ay, bx, by, k1);\n exited = true;\n }\n if (b > k2 && a <= k2) {\n t = intersect(slice, ax, ay, bx, by, k2);\n exited = true;\n }\n if (!isPolygon && exited) {\n if (trackMetrics) {\n slice.end = len + segLen * t;\n }\n newGeom.push(slice);\n slice = newSlice(geom);\n }\n if (trackMetrics) {\n len += segLen;\n }\n }\n var last = geom.length - 3;\n ax = geom[last];\n ay = geom[last + 1];\n az = geom[last + 2];\n a = axis === 0 ? ax : ay;\n if (a >= k1 && a <= k2) {\n addPoint(slice, ax, ay, az);\n }\n last = slice.length - 3;\n if (isPolygon && last >= 3 && (slice[last] !== slice[0] || slice[last + 1] !== slice[1])) {\n addPoint(slice, slice[0], slice[1], slice[2]);\n }\n if (slice.length) {\n newGeom.push(slice);\n }\n }\n function newSlice(line) {\n var slice = [];\n slice.size = line.size;\n slice.start = line.start;\n slice.end = line.end;\n return slice;\n }\n function clipLines(geom, newGeom, k1, k2, axis, isPolygon) {\n for (var i = 0; i < geom.length; i++) {\n clipLine(geom[i], newGeom, k1, k2, axis, isPolygon, false);\n }\n }\n function addPoint(out, x, y, z) {\n out.push(x);\n out.push(y);\n out.push(z);\n }\n function intersectX(out, ax, ay, bx, by, x) {\n var t = (x - ax) / (bx - ax);\n out.push(x);\n out.push(ay + (by - ay) * t);\n out.push(1);\n return t;\n }\n function intersectY(out, ax, ay, bx, by, y) {\n var t = (y - ay) / (by - ay);\n out.push(ax + (bx - ax) * t);\n out.push(y);\n out.push(1);\n return t;\n }\n function wrap(features, options) {\n var buffer = options.buffer / options.extent;\n var merged = features;\n var left = clip(features, 1, -1 - buffer, buffer, 0, -1, 2, options);\n var right = clip(features, 1, 1 - buffer, 2 + buffer, 0, -1, 2, options);\n if (left || right) {\n merged = clip(features, 1, -buffer, 1 + buffer, 0, -1, 2, options) || [];\n if (left) {\n merged = shiftFeatureCoords(left, 1).concat(merged);\n }\n if (right) {\n merged = merged.concat(shiftFeatureCoords(right, -1));\n }\n }\n return merged;\n }\n function shiftFeatureCoords(features, offset) {\n var newFeatures = [];\n for (var i = 0; i < features.length; i++) {\n var feature = features[i], type = feature.type;\n var newGeometry;\n if (type === \"Point\" || type === \"MultiPoint\" || type === \"LineString\") {\n newGeometry = shiftCoords(feature.geometry, offset);\n } else if (type === \"MultiLineString\" || type === \"Polygon\") {\n newGeometry = [];\n for (var j = 0; j < feature.geometry.length; j++) {\n newGeometry.push(shiftCoords(feature.geometry[j], offset));\n }\n } else if (type === \"MultiPolygon\") {\n newGeometry = [];\n for (j = 0; j < feature.geometry.length; j++) {\n var newPolygon = [];\n for (var k = 0; k < feature.geometry[j].length; k++) {\n newPolygon.push(shiftCoords(feature.geometry[j][k], offset));\n }\n newGeometry.push(newPolygon);\n }\n }\n newFeatures.push(createFeature(feature.id, type, newGeometry, feature.tags));\n }\n return newFeatures;\n }\n function shiftCoords(points, offset) {\n var newPoints = [];\n newPoints.size = points.size;\n if (points.start !== void 0) {\n newPoints.start = points.start;\n newPoints.end = points.end;\n }\n for (var i = 0; i < points.length; i += 3) {\n newPoints.push(points[i] + offset, points[i + 1], points[i + 2]);\n }\n return newPoints;\n }\n function transformTile(tile, extent) {\n if (tile.transformed) {\n return tile;\n }\n var z2 = 1 << tile.z, tx = tile.x, ty = tile.y, i, j, k;\n for (i = 0; i < tile.features.length; i++) {\n var feature = tile.features[i], geom = feature.geometry, type = feature.type;\n feature.geometry = [];\n if (type === 1) {\n for (j = 0; j < geom.length; j += 2) {\n feature.geometry.push(transformPoint(geom[j], geom[j + 1], extent, z2, tx, ty));\n }\n } else {\n for (j = 0; j < geom.length; j++) {\n var ring = [];\n for (k = 0; k < geom[j].length; k += 2) {\n ring.push(transformPoint(geom[j][k], geom[j][k + 1], extent, z2, tx, ty));\n }\n feature.geometry.push(ring);\n }\n }\n }\n tile.transformed = true;\n return tile;\n }\n function transformPoint(x, y, extent, z2, tx, ty) {\n return [\n Math.round(extent * (x * z2 - tx)),\n Math.round(extent * (y * z2 - ty))\n ];\n }\n function createTile(features, z, tx, ty, options) {\n var tolerance = z === options.maxZoom ? 0 : options.tolerance / ((1 << z) * options.extent);\n var tile = {\n features: [],\n numPoints: 0,\n numSimplified: 0,\n numFeatures: 0,\n source: null,\n x: tx,\n y: ty,\n z,\n transformed: false,\n minX: 2,\n minY: 1,\n maxX: -1,\n maxY: 0\n };\n for (var i = 0; i < features.length; i++) {\n tile.numFeatures++;\n addFeature(tile, features[i], tolerance, options);\n var minX = features[i].minX;\n var minY = features[i].minY;\n var maxX = features[i].maxX;\n var maxY = features[i].maxY;\n if (minX < tile.minX) {\n tile.minX = minX;\n }\n if (minY < tile.minY) {\n tile.minY = minY;\n }\n if (maxX > tile.maxX) {\n tile.maxX = maxX;\n }\n if (maxY > tile.maxY) {\n tile.maxY = maxY;\n }\n }\n return tile;\n }\n function addFeature(tile, feature, tolerance, options) {\n var geom = feature.geometry, type = feature.type, simplified = [];\n if (type === \"Point\" || type === \"MultiPoint\") {\n for (var i = 0; i < geom.length; i += 3) {\n simplified.push(geom[i]);\n simplified.push(geom[i + 1]);\n tile.numPoints++;\n tile.numSimplified++;\n }\n } else if (type === \"LineString\") {\n addLine(simplified, geom, tile, tolerance, false, false);\n } else if (type === \"MultiLineString\" || type === \"Polygon\") {\n for (i = 0; i < geom.length; i++) {\n addLine(simplified, geom[i], tile, tolerance, type === \"Polygon\", i === 0);\n }\n } else if (type === \"MultiPolygon\") {\n for (var k = 0; k < geom.length; k++) {\n var polygon = geom[k];\n for (i = 0; i < polygon.length; i++) {\n addLine(simplified, polygon[i], tile, tolerance, true, i === 0);\n }\n }\n }\n if (simplified.length) {\n var tags = feature.tags || null;\n if (type === \"LineString\" && options.lineMetrics) {\n tags = {};\n for (var key in feature.tags) {\n tags[key] = feature.tags[key];\n }\n tags[\"mapbox_clip_start\"] = geom.start / geom.size;\n tags[\"mapbox_clip_end\"] = geom.end / geom.size;\n }\n var tileFeature = {\n geometry: simplified,\n type: type === \"Polygon\" || type === \"MultiPolygon\" ? 3 : type === \"LineString\" || type === \"MultiLineString\" ? 2 : 1,\n tags\n };\n if (feature.id !== null) {\n tileFeature.id = feature.id;\n }\n tile.features.push(tileFeature);\n }\n }\n function addLine(result, geom, tile, tolerance, isPolygon, isOuter) {\n var sqTolerance = tolerance * tolerance;\n if (tolerance > 0 && geom.size < (isPolygon ? sqTolerance : tolerance)) {\n tile.numPoints += geom.length / 3;\n return;\n }\n var ring = [];\n for (var i = 0; i < geom.length; i += 3) {\n if (tolerance === 0 || geom[i + 2] > sqTolerance) {\n tile.numSimplified++;\n ring.push(geom[i]);\n ring.push(geom[i + 1]);\n }\n tile.numPoints++;\n }\n if (isPolygon) {\n rewind$1(ring, isOuter);\n }\n result.push(ring);\n }\n function rewind$1(ring, clockwise) {\n var area = 0;\n for (var i = 0, len = ring.length, j = len - 2; i < len; j = i, i += 2) {\n area += (ring[i] - ring[j]) * (ring[i + 1] + ring[j + 1]);\n }\n if (area > 0 === clockwise) {\n for (i = 0, len = ring.length; i < len / 2; i += 2) {\n var x = ring[i];\n var y = ring[i + 1];\n ring[i] = ring[len - 2 - i];\n ring[i + 1] = ring[len - 1 - i];\n ring[len - 2 - i] = x;\n ring[len - 1 - i] = y;\n }\n }\n }\n function geojsonvt(data, options) {\n return new GeoJSONVT(data, options);\n }\n function GeoJSONVT(data, options) {\n options = this.options = extend$1(Object.create(this.options), options);\n var debug = options.debug;\n if (debug) {\n console.time(\"preprocess data\");\n }\n if (options.maxZoom < 0 || options.maxZoom > 24) {\n throw new Error(\"maxZoom should be in the 0-24 range\");\n }\n if (options.promoteId && options.generateId) {\n throw new Error(\"promoteId and generateId cannot be used together.\");\n }\n var features = convert(data, options);\n this.tiles = {};\n this.tileCoords = [];\n if (debug) {\n console.timeEnd(\"preprocess data\");\n console.log(\"index: maxZoom: %d, maxPoints: %d\", options.indexMaxZoom, options.indexMaxPoints);\n console.time(\"generate tiles\");\n this.stats = {};\n this.total = 0;\n }\n features = wrap(features, options);\n if (features.length) {\n this.splitTile(features, 0, 0, 0);\n }\n if (debug) {\n if (features.length) {\n console.log(\"features: %d, points: %d\", this.tiles[0].numFeatures, this.tiles[0].numPoints);\n }\n console.timeEnd(\"generate tiles\");\n console.log(\"tiles generated:\", this.total, JSON.stringify(this.stats));\n }\n }\n GeoJSONVT.prototype.options = {\n maxZoom: 14,\n indexMaxZoom: 5,\n indexMaxPoints: 1e5,\n tolerance: 3,\n extent: 4096,\n buffer: 64,\n lineMetrics: false,\n promoteId: null,\n generateId: false,\n debug: 0\n };\n GeoJSONVT.prototype.splitTile = function(features, z, x, y, cz, cx, cy) {\n var stack = [\n features,\n z,\n x,\n y\n ], options = this.options, debug = options.debug;\n while (stack.length) {\n y = stack.pop();\n x = stack.pop();\n z = stack.pop();\n features = stack.pop();\n var z2 = 1 << z, id = toID(z, x, y), tile = this.tiles[id];\n if (!tile) {\n if (debug > 1) {\n console.time(\"creation\");\n }\n tile = this.tiles[id] = createTile(features, z, x, y, options);\n this.tileCoords.push({\n z,\n x,\n y\n });\n if (debug) {\n if (debug > 1) {\n console.log(\"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)\", z, x, y, tile.numFeatures, tile.numPoints, tile.numSimplified);\n console.timeEnd(\"creation\");\n }\n var key = \"z\" + z;\n this.stats[key] = (this.stats[key] || 0) + 1;\n this.total++;\n }\n }\n tile.source = features;\n if (!cz) {\n if (z === options.indexMaxZoom || tile.numPoints <= options.indexMaxPoints) {\n continue;\n }\n } else {\n if (z === options.maxZoom || z === cz) {\n continue;\n }\n var m = 1 << cz - z;\n if (x !== Math.floor(cx / m) || y !== Math.floor(cy / m)) {\n continue;\n }\n }\n tile.source = null;\n if (features.length === 0) {\n continue;\n }\n if (debug > 1) {\n console.time(\"clipping\");\n }\n var k1 = 0.5 * options.buffer / options.extent, k2 = 0.5 - k1, k3 = 0.5 + k1, k4 = 1 + k1, tl, bl, tr, br, left, right;\n tl = bl = tr = br = null;\n left = clip(features, z2, x - k1, x + k3, 0, tile.minX, tile.maxX, options);\n right = clip(features, z2, x + k2, x + k4, 0, tile.minX, tile.maxX, options);\n features = null;\n if (left) {\n tl = clip(left, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, options);\n bl = clip(left, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, options);\n left = null;\n }\n if (right) {\n tr = clip(right, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, options);\n br = clip(right, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, options);\n right = null;\n }\n if (debug > 1) {\n console.timeEnd(\"clipping\");\n }\n stack.push(tl || [], z + 1, x * 2, y * 2);\n stack.push(bl || [], z + 1, x * 2, y * 2 + 1);\n stack.push(tr || [], z + 1, x * 2 + 1, y * 2);\n stack.push(br || [], z + 1, x * 2 + 1, y * 2 + 1);\n }\n };\n GeoJSONVT.prototype.getTile = function(z, x, y) {\n var options = this.options, extent = options.extent, debug = options.debug;\n if (z < 0 || z > 24) {\n return null;\n }\n var z2 = 1 << z;\n x = (x % z2 + z2) % z2;\n var id = toID(z, x, y);\n if (this.tiles[id]) {\n return transformTile(this.tiles[id], extent);\n }\n if (debug > 1) {\n console.log(\"drilling down to z%d-%d-%d\", z, x, y);\n }\n var z0 = z, x0 = x, y0 = y, parent;\n while (!parent && z0 > 0) {\n z0--;\n x0 = Math.floor(x0 / 2);\n y0 = Math.floor(y0 / 2);\n parent = this.tiles[toID(z0, x0, y0)];\n }\n if (!parent || !parent.source) {\n return null;\n }\n if (debug > 1) {\n console.log(\"found parent tile z%d-%d-%d\", z0, x0, y0);\n }\n if (debug > 1) {\n console.time(\"drilling down\");\n }\n this.splitTile(parent.source, z0, x0, y0, z, x, y);\n if (debug > 1) {\n console.timeEnd(\"drilling down\");\n }\n return this.tiles[id] ? transformTile(this.tiles[id], extent) : null;\n };\n function toID(z, x, y) {\n return ((1 << z) * y + x) * 32 + z;\n }\n function extend$1(dest, src) {\n for (var i in src) {\n dest[i] = src[i];\n }\n return dest;\n }\n function loadGeoJSONTile(params, callback) {\n var canonical = params.tileID.canonical;\n if (!this._geoJSONIndex) {\n return callback(null, null);\n }\n var geoJSONTile = this._geoJSONIndex.getTile(canonical.z, canonical.x, canonical.y);\n if (!geoJSONTile) {\n return callback(null, null);\n }\n var geojsonWrapper = new GeoJSONWrapper(geoJSONTile.features);\n var pbf = vtPbf(geojsonWrapper);\n if (pbf.byteOffset !== 0 || pbf.byteLength !== pbf.buffer.byteLength) {\n pbf = new Uint8Array(pbf);\n }\n callback(null, {\n vectorTile: geojsonWrapper,\n rawData: pbf.buffer\n });\n }\n var GeoJSONWorkerSource = function(VectorTileWorkerSource2) {\n function GeoJSONWorkerSource2(actor, layerIndex, availableImages, loadGeoJSON) {\n VectorTileWorkerSource2.call(this, actor, layerIndex, availableImages, loadGeoJSONTile);\n if (loadGeoJSON) {\n this.loadGeoJSON = loadGeoJSON;\n }\n }\n if (VectorTileWorkerSource2)\n GeoJSONWorkerSource2.__proto__ = VectorTileWorkerSource2;\n GeoJSONWorkerSource2.prototype = Object.create(VectorTileWorkerSource2 && VectorTileWorkerSource2.prototype);\n GeoJSONWorkerSource2.prototype.constructor = GeoJSONWorkerSource2;\n GeoJSONWorkerSource2.prototype.loadData = function loadData(params, callback) {\n if (this._pendingCallback) {\n this._pendingCallback(null, { abandoned: true });\n }\n this._pendingCallback = callback;\n this._pendingLoadDataParams = params;\n if (this._state && this._state !== \"Idle\") {\n this._state = \"NeedsLoadData\";\n } else {\n this._state = \"Coalescing\";\n this._loadData();\n }\n };\n GeoJSONWorkerSource2.prototype._loadData = function _loadData() {\n var this$1 = this;\n if (!this._pendingCallback || !this._pendingLoadDataParams) {\n return;\n }\n var callback = this._pendingCallback;\n var params = this._pendingLoadDataParams;\n delete this._pendingCallback;\n delete this._pendingLoadDataParams;\n var perf = params && params.request && params.request.collectResourceTiming ? new performance2.RequestPerformance(params.request) : false;\n this.loadGeoJSON(params, function(err, data) {\n if (err || !data) {\n return callback(err);\n } else if (typeof data !== \"object\") {\n return callback(new Error(\"Input data given to '\" + params.source + \"' is not a valid GeoJSON object.\"));\n } else {\n geojsonRewind(data, true);\n try {\n if (params.filter) {\n var compiled = performance2.createExpression(params.filter, {\n type: \"boolean\",\n \"property-type\": \"data-driven\",\n overridable: false,\n transition: false\n });\n if (compiled.result === \"error\") {\n throw new Error(compiled.value.map(function(err2) {\n return err2.key + \": \" + err2.message;\n }).join(\", \"));\n }\n var features = data.features.filter(function(feature) {\n return compiled.value.evaluate({ zoom: 0 }, feature);\n });\n data = {\n type: \"FeatureCollection\",\n features\n };\n }\n this$1._geoJSONIndex = params.cluster ? new Supercluster(getSuperclusterOptions(params)).load(data.features) : geojsonvt(data, params.geojsonVtOptions);\n } catch (err2) {\n return callback(err2);\n }\n this$1.loaded = {};\n var result = {};\n if (perf) {\n var resourceTimingData = perf.finish();\n if (resourceTimingData) {\n result.resourceTiming = {};\n result.resourceTiming[params.source] = JSON.parse(JSON.stringify(resourceTimingData));\n }\n }\n callback(null, result);\n }\n });\n };\n GeoJSONWorkerSource2.prototype.coalesce = function coalesce() {\n if (this._state === \"Coalescing\") {\n this._state = \"Idle\";\n } else if (this._state === \"NeedsLoadData\") {\n this._state = \"Coalescing\";\n this._loadData();\n }\n };\n GeoJSONWorkerSource2.prototype.reloadTile = function reloadTile(params, callback) {\n var loaded = this.loaded, uid = params.uid;\n if (loaded && loaded[uid]) {\n return VectorTileWorkerSource2.prototype.reloadTile.call(this, params, callback);\n } else {\n return this.loadTile(params, callback);\n }\n };\n GeoJSONWorkerSource2.prototype.loadGeoJSON = function loadGeoJSON(params, callback) {\n if (params.request) {\n performance2.getJSON(params.request, callback);\n } else if (typeof params.data === \"string\") {\n try {\n return callback(null, JSON.parse(params.data));\n } catch (e) {\n return callback(new Error(\"Input data given to '\" + params.source + \"' is not a valid GeoJSON object.\"));\n }\n } else {\n return callback(new Error(\"Input data given to '\" + params.source + \"' is not a valid GeoJSON object.\"));\n }\n };\n GeoJSONWorkerSource2.prototype.removeSource = function removeSource(params, callback) {\n if (this._pendingCallback) {\n this._pendingCallback(null, { abandoned: true });\n }\n callback();\n };\n GeoJSONWorkerSource2.prototype.getClusterExpansionZoom = function getClusterExpansionZoom(params, callback) {\n try {\n callback(null, this._geoJSONIndex.getClusterExpansionZoom(params.clusterId));\n } catch (e) {\n callback(e);\n }\n };\n GeoJSONWorkerSource2.prototype.getClusterChildren = function getClusterChildren(params, callback) {\n try {\n callback(null, this._geoJSONIndex.getChildren(params.clusterId));\n } catch (e) {\n callback(e);\n }\n };\n GeoJSONWorkerSource2.prototype.getClusterLeaves = function getClusterLeaves(params, callback) {\n try {\n callback(null, this._geoJSONIndex.getLeaves(params.clusterId, params.limit, params.offset));\n } catch (e) {\n callback(e);\n }\n };\n return GeoJSONWorkerSource2;\n }(VectorTileWorkerSource);\n function getSuperclusterOptions(ref) {\n var superclusterOptions = ref.superclusterOptions;\n var clusterProperties = ref.clusterProperties;\n if (!clusterProperties || !superclusterOptions) {\n return superclusterOptions;\n }\n var mapExpressions = {};\n var reduceExpressions = {};\n var globals = {\n accumulated: null,\n zoom: 0\n };\n var feature = { properties: null };\n var propertyNames = Object.keys(clusterProperties);\n for (var i = 0, list = propertyNames; i < list.length; i += 1) {\n var key = list[i];\n var ref$1 = clusterProperties[key];\n var operator = ref$1[0];\n var mapExpression = ref$1[1];\n var mapExpressionParsed = performance2.createExpression(mapExpression);\n var reduceExpressionParsed = performance2.createExpression(typeof operator === \"string\" ? [\n operator,\n [\"accumulated\"],\n [\n \"get\",\n key\n ]\n ] : operator);\n mapExpressions[key] = mapExpressionParsed.value;\n reduceExpressions[key] = reduceExpressionParsed.value;\n }\n superclusterOptions.map = function(pointProperties) {\n feature.properties = pointProperties;\n var properties = {};\n for (var i2 = 0, list2 = propertyNames; i2 < list2.length; i2 += 1) {\n var key2 = list2[i2];\n properties[key2] = mapExpressions[key2].evaluate(globals, feature);\n }\n return properties;\n };\n superclusterOptions.reduce = function(accumulated, clusterProperties2) {\n feature.properties = clusterProperties2;\n for (var i2 = 0, list2 = propertyNames; i2 < list2.length; i2 += 1) {\n var key2 = list2[i2];\n globals.accumulated = accumulated[key2];\n accumulated[key2] = reduceExpressions[key2].evaluate(globals, feature);\n }\n };\n return superclusterOptions;\n }\n var Worker2 = function Worker3(self2) {\n var this$1 = this;\n this.self = self2;\n this.actor = new performance2.Actor(self2, this);\n this.layerIndexes = {};\n this.availableImages = {};\n this.workerSourceTypes = {\n vector: VectorTileWorkerSource,\n geojson: GeoJSONWorkerSource\n };\n this.workerSources = {};\n this.demWorkerSources = {};\n this.self.registerWorkerSource = function(name2, WorkerSource) {\n if (this$1.workerSourceTypes[name2]) {\n throw new Error('Worker source with name \"' + name2 + '\" already registered.');\n }\n this$1.workerSourceTypes[name2] = WorkerSource;\n };\n this.self.registerRTLTextPlugin = function(rtlTextPlugin) {\n if (performance2.plugin.isParsed()) {\n throw new Error(\"RTL text plugin already registered.\");\n }\n performance2.plugin[\"applyArabicShaping\"] = rtlTextPlugin.applyArabicShaping;\n performance2.plugin[\"processBidirectionalText\"] = rtlTextPlugin.processBidirectionalText;\n performance2.plugin[\"processStyledBidirectionalText\"] = rtlTextPlugin.processStyledBidirectionalText;\n };\n };\n Worker2.prototype.setReferrer = function setReferrer(mapID, referrer) {\n this.referrer = referrer;\n };\n Worker2.prototype.setImages = function setImages(mapId, images, callback) {\n this.availableImages[mapId] = images;\n for (var workerSource in this.workerSources[mapId]) {\n var ws = this.workerSources[mapId][workerSource];\n for (var source in ws) {\n ws[source].availableImages = images;\n }\n }\n callback();\n };\n Worker2.prototype.setLayers = function setLayers(mapId, layers, callback) {\n this.getLayerIndex(mapId).replace(layers);\n callback();\n };\n Worker2.prototype.updateLayers = function updateLayers(mapId, params, callback) {\n this.getLayerIndex(mapId).update(params.layers, params.removedIds);\n callback();\n };\n Worker2.prototype.loadTile = function loadTile(mapId, params, callback) {\n this.getWorkerSource(mapId, params.type, params.source).loadTile(params, callback);\n };\n Worker2.prototype.loadDEMTile = function loadDEMTile(mapId, params, callback) {\n this.getDEMWorkerSource(mapId, params.source).loadTile(params, callback);\n };\n Worker2.prototype.reloadTile = function reloadTile(mapId, params, callback) {\n this.getWorkerSource(mapId, params.type, params.source).reloadTile(params, callback);\n };\n Worker2.prototype.abortTile = function abortTile(mapId, params, callback) {\n this.getWorkerSource(mapId, params.type, params.source).abortTile(params, callback);\n };\n Worker2.prototype.removeTile = function removeTile(mapId, params, callback) {\n this.getWorkerSource(mapId, params.type, params.source).removeTile(params, callback);\n };\n Worker2.prototype.removeDEMTile = function removeDEMTile(mapId, params) {\n this.getDEMWorkerSource(mapId, params.source).removeTile(params);\n };\n Worker2.prototype.removeSource = function removeSource(mapId, params, callback) {\n if (!this.workerSources[mapId] || !this.workerSources[mapId][params.type] || !this.workerSources[mapId][params.type][params.source]) {\n return;\n }\n var worker2 = this.workerSources[mapId][params.type][params.source];\n delete this.workerSources[mapId][params.type][params.source];\n if (worker2.removeSource !== void 0) {\n worker2.removeSource(params, callback);\n } else {\n callback();\n }\n };\n Worker2.prototype.loadWorkerSource = function loadWorkerSource(map, params, callback) {\n try {\n this.self.importScripts(params.url);\n callback();\n } catch (e) {\n callback(e.toString());\n }\n };\n Worker2.prototype.syncRTLPluginState = function syncRTLPluginState(map, state, callback) {\n try {\n performance2.plugin.setState(state);\n var pluginURL = performance2.plugin.getPluginURL();\n if (performance2.plugin.isLoaded() && !performance2.plugin.isParsed() && pluginURL != null) {\n this.self.importScripts(pluginURL);\n var complete = performance2.plugin.isParsed();\n var error = complete ? void 0 : new Error(\"RTL Text Plugin failed to import scripts from \" + pluginURL);\n callback(error, complete);\n }\n } catch (e) {\n callback(e.toString());\n }\n };\n Worker2.prototype.getAvailableImages = function getAvailableImages(mapId) {\n var availableImages = this.availableImages[mapId];\n if (!availableImages) {\n availableImages = [];\n }\n return availableImages;\n };\n Worker2.prototype.getLayerIndex = function getLayerIndex(mapId) {\n var layerIndexes = this.layerIndexes[mapId];\n if (!layerIndexes) {\n layerIndexes = this.layerIndexes[mapId] = new StyleLayerIndex();\n }\n return layerIndexes;\n };\n Worker2.prototype.getWorkerSource = function getWorkerSource(mapId, type, source) {\n var this$1 = this;\n if (!this.workerSources[mapId]) {\n this.workerSources[mapId] = {};\n }\n if (!this.workerSources[mapId][type]) {\n this.workerSources[mapId][type] = {};\n }\n if (!this.workerSources[mapId][type][source]) {\n var actor = {\n send: function(type2, data, callback) {\n this$1.actor.send(type2, data, callback, mapId);\n }\n };\n this.workerSources[mapId][type][source] = new this.workerSourceTypes[type](actor, this.getLayerIndex(mapId), this.getAvailableImages(mapId));\n }\n return this.workerSources[mapId][type][source];\n };\n Worker2.prototype.getDEMWorkerSource = function getDEMWorkerSource(mapId, source) {\n if (!this.demWorkerSources[mapId]) {\n this.demWorkerSources[mapId] = {};\n }\n if (!this.demWorkerSources[mapId][source]) {\n this.demWorkerSources[mapId][source] = new RasterDEMTileWorkerSource();\n }\n return this.demWorkerSources[mapId][source];\n };\n Worker2.prototype.enforceCacheSizeLimit = function enforceCacheSizeLimit$1(mapId, limit) {\n performance2.enforceCacheSizeLimit(limit);\n };\n if (typeof WorkerGlobalScope !== \"undefined\" && typeof self !== \"undefined\" && self instanceof WorkerGlobalScope) {\n self.worker = new Worker2(self);\n }\n return Worker2;\n });\n define2([\"./shared\"], function(performance2) {\n \"use strict\";\n var mapboxGlSupported = performance2.createCommonjsModule(function(module2) {\n if (module2.exports) {\n module2.exports = isSupported;\n } else if (window) {\n window.mapboxgl = window.mapboxgl || {};\n window.mapboxgl.supported = isSupported;\n window.mapboxgl.notSupportedReason = notSupportedReason;\n }\n function isSupported(options) {\n return !notSupportedReason(options);\n }\n function notSupportedReason(options) {\n if (!isBrowser()) {\n return \"not a browser\";\n }\n if (!isArraySupported()) {\n return \"insufficent Array support\";\n }\n if (!isFunctionSupported()) {\n return \"insufficient Function support\";\n }\n if (!isObjectSupported()) {\n return \"insufficient Object support\";\n }\n if (!isJSONSupported()) {\n return \"insufficient JSON support\";\n }\n if (!isWorkerSupported()) {\n return \"insufficient worker support\";\n }\n if (!isUint8ClampedArraySupported()) {\n return \"insufficient Uint8ClampedArray support\";\n }\n if (!isArrayBufferSupported()) {\n return \"insufficient ArrayBuffer support\";\n }\n if (!isCanvasGetImageDataSupported()) {\n return \"insufficient Canvas/getImageData support\";\n }\n if (!isWebGLSupportedCached(options && options.failIfMajorPerformanceCaveat)) {\n return \"insufficient WebGL support\";\n }\n }\n function isBrowser() {\n return typeof window !== \"undefined\" && typeof document !== \"undefined\";\n }\n function isArraySupported() {\n return Array.prototype && Array.prototype.every && Array.prototype.filter && Array.prototype.forEach && Array.prototype.indexOf && Array.prototype.lastIndexOf && Array.prototype.map && Array.prototype.some && Array.prototype.reduce && Array.prototype.reduceRight && Array.isArray;\n }\n function isFunctionSupported() {\n return Function.prototype && Function.prototype.bind;\n }\n function isObjectSupported() {\n return Object.keys && Object.create && Object.getPrototypeOf && Object.getOwnPropertyNames && Object.isSealed && Object.isFrozen && Object.isExtensible && Object.getOwnPropertyDescriptor && Object.defineProperty && Object.defineProperties && Object.seal && Object.freeze && Object.preventExtensions;\n }\n function isJSONSupported() {\n return \"JSON\" in window && \"parse\" in JSON && \"stringify\" in JSON;\n }\n function isWorkerSupported() {\n if (!(\"Worker\" in window && \"Blob\" in window && \"URL\" in window)) {\n return false;\n }\n var blob = new Blob([\"\"], { type: \"text/javascript\" });\n var workerURL = URL.createObjectURL(blob);\n var supported;\n var worker2;\n try {\n worker2 = new Worker(workerURL);\n supported = true;\n } catch (e) {\n supported = false;\n }\n if (worker2) {\n worker2.terminate();\n }\n URL.revokeObjectURL(workerURL);\n return supported;\n }\n function isUint8ClampedArraySupported() {\n return \"Uint8ClampedArray\" in window;\n }\n function isArrayBufferSupported() {\n return ArrayBuffer.isView;\n }\n function isCanvasGetImageDataSupported() {\n var canvas = document.createElement(\"canvas\");\n canvas.width = canvas.height = 1;\n var context = canvas.getContext(\"2d\");\n if (!context) {\n return false;\n }\n var imageData = context.getImageData(0, 0, 1, 1);\n return imageData && imageData.width === canvas.width;\n }\n var isWebGLSupportedCache = {};\n function isWebGLSupportedCached(failIfMajorPerformanceCaveat) {\n if (isWebGLSupportedCache[failIfMajorPerformanceCaveat] === void 0) {\n isWebGLSupportedCache[failIfMajorPerformanceCaveat] = isWebGLSupported(failIfMajorPerformanceCaveat);\n }\n return isWebGLSupportedCache[failIfMajorPerformanceCaveat];\n }\n isSupported.webGLContextAttributes = {\n antialias: false,\n alpha: true,\n stencil: true,\n depth: true\n };\n function getWebGLContext(failIfMajorPerformanceCaveat) {\n var canvas = document.createElement(\"canvas\");\n var attributes = Object.create(isSupported.webGLContextAttributes);\n attributes.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat;\n if (canvas.probablySupportsContext) {\n return canvas.probablySupportsContext(\"webgl\", attributes) || canvas.probablySupportsContext(\"experimental-webgl\", attributes);\n } else if (canvas.supportsContext) {\n return canvas.supportsContext(\"webgl\", attributes) || canvas.supportsContext(\"experimental-webgl\", attributes);\n } else {\n return canvas.getContext(\"webgl\", attributes) || canvas.getContext(\"experimental-webgl\", attributes);\n }\n }\n function isWebGLSupported(failIfMajorPerformanceCaveat) {\n var gl2 = getWebGLContext(failIfMajorPerformanceCaveat);\n if (!gl2) {\n return false;\n }\n var shader = gl2.createShader(gl2.VERTEX_SHADER);\n if (!shader || gl2.isContextLost()) {\n return false;\n }\n gl2.shaderSource(shader, \"void main() {}\");\n gl2.compileShader(shader);\n return gl2.getShaderParameter(shader, gl2.COMPILE_STATUS) === true;\n }\n });\n var DOM = {};\n DOM.create = function(tagName, className, container) {\n var el = performance2.window.document.createElement(tagName);\n if (className !== void 0) {\n el.className = className;\n }\n if (container) {\n container.appendChild(el);\n }\n return el;\n };\n DOM.createNS = function(namespaceURI, tagName) {\n var el = performance2.window.document.createElementNS(namespaceURI, tagName);\n return el;\n };\n var docStyle = performance2.window.document && performance2.window.document.documentElement.style;\n function testProp(props) {\n if (!docStyle) {\n return props[0];\n }\n for (var i = 0; i < props.length; i++) {\n if (props[i] in docStyle) {\n return props[i];\n }\n }\n return props[0];\n }\n var selectProp = testProp([\n \"userSelect\",\n \"MozUserSelect\",\n \"WebkitUserSelect\",\n \"msUserSelect\"\n ]);\n var userSelect;\n DOM.disableDrag = function() {\n if (docStyle && selectProp) {\n userSelect = docStyle[selectProp];\n docStyle[selectProp] = \"none\";\n }\n };\n DOM.enableDrag = function() {\n if (docStyle && selectProp) {\n docStyle[selectProp] = userSelect;\n }\n };\n var transformProp = testProp([\n \"transform\",\n \"WebkitTransform\"\n ]);\n DOM.setTransform = function(el, value) {\n el.style[transformProp] = value;\n };\n var passiveSupported = false;\n try {\n var options$1 = Object.defineProperty({}, \"passive\", {\n get: function get() {\n passiveSupported = true;\n }\n });\n performance2.window.addEventListener(\"test\", options$1, options$1);\n performance2.window.removeEventListener(\"test\", options$1, options$1);\n } catch (err) {\n passiveSupported = false;\n }\n DOM.addEventListener = function(target, type, callback, options) {\n if (options === void 0)\n options = {};\n if (\"passive\" in options && passiveSupported) {\n target.addEventListener(type, callback, options);\n } else {\n target.addEventListener(type, callback, options.capture);\n }\n };\n DOM.removeEventListener = function(target, type, callback, options) {\n if (options === void 0)\n options = {};\n if (\"passive\" in options && passiveSupported) {\n target.removeEventListener(type, callback, options);\n } else {\n target.removeEventListener(type, callback, options.capture);\n }\n };\n var suppressClick = function(e) {\n e.preventDefault();\n e.stopPropagation();\n performance2.window.removeEventListener(\"click\", suppressClick, true);\n };\n DOM.suppressClick = function() {\n performance2.window.addEventListener(\"click\", suppressClick, true);\n performance2.window.setTimeout(function() {\n performance2.window.removeEventListener(\"click\", suppressClick, true);\n }, 0);\n };\n DOM.mousePos = function(el, e) {\n var rect = el.getBoundingClientRect();\n return new performance2.Point(e.clientX - rect.left - el.clientLeft, e.clientY - rect.top - el.clientTop);\n };\n DOM.touchPos = function(el, touches) {\n var rect = el.getBoundingClientRect(), points = [];\n for (var i = 0; i < touches.length; i++) {\n points.push(new performance2.Point(touches[i].clientX - rect.left - el.clientLeft, touches[i].clientY - rect.top - el.clientTop));\n }\n return points;\n };\n DOM.mouseButton = function(e) {\n if (typeof performance2.window.InstallTrigger !== \"undefined\" && e.button === 2 && e.ctrlKey && performance2.window.navigator.platform.toUpperCase().indexOf(\"MAC\") >= 0) {\n return 0;\n }\n return e.button;\n };\n DOM.remove = function(node) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n };\n function loadSprite(baseURL, requestManager, callback) {\n var json, image, error;\n var format = performance2.browser.devicePixelRatio > 1 ? \"@2x\" : \"\";\n var jsonRequest = performance2.getJSON(requestManager.transformRequest(requestManager.normalizeSpriteURL(baseURL, format, \".json\"), performance2.ResourceType.SpriteJSON), function(err, data) {\n jsonRequest = null;\n if (!error) {\n error = err;\n json = data;\n maybeComplete();\n }\n });\n var imageRequest = performance2.getImage(requestManager.transformRequest(requestManager.normalizeSpriteURL(baseURL, format, \".png\"), performance2.ResourceType.SpriteImage), function(err, img) {\n imageRequest = null;\n if (!error) {\n error = err;\n image = img;\n maybeComplete();\n }\n });\n function maybeComplete() {\n if (error) {\n callback(error);\n } else if (json && image) {\n var imageData = performance2.browser.getImageData(image);\n var result = {};\n for (var id in json) {\n var ref = json[id];\n var width = ref.width;\n var height = ref.height;\n var x = ref.x;\n var y = ref.y;\n var sdf = ref.sdf;\n var pixelRatio = ref.pixelRatio;\n var stretchX = ref.stretchX;\n var stretchY = ref.stretchY;\n var content = ref.content;\n var data = new performance2.RGBAImage({\n width,\n height\n });\n performance2.RGBAImage.copy(imageData, data, {\n x,\n y\n }, {\n x: 0,\n y: 0\n }, {\n width,\n height\n });\n result[id] = {\n data,\n pixelRatio,\n sdf,\n stretchX,\n stretchY,\n content\n };\n }\n callback(null, result);\n }\n }\n return {\n cancel: function cancel() {\n if (jsonRequest) {\n jsonRequest.cancel();\n jsonRequest = null;\n }\n if (imageRequest) {\n imageRequest.cancel();\n imageRequest = null;\n }\n }\n };\n }\n function renderStyleImage(image) {\n var userImage = image.userImage;\n if (userImage && userImage.render) {\n var updated = userImage.render();\n if (updated) {\n image.data.replace(new Uint8Array(userImage.data.buffer));\n return true;\n }\n }\n return false;\n }\n var padding = 1;\n var ImageManager = function(Evented) {\n function ImageManager2() {\n Evented.call(this);\n this.images = {};\n this.updatedImages = {};\n this.callbackDispatchedThisFrame = {};\n this.loaded = false;\n this.requestors = [];\n this.patterns = {};\n this.atlasImage = new performance2.RGBAImage({\n width: 1,\n height: 1\n });\n this.dirty = true;\n }\n if (Evented)\n ImageManager2.__proto__ = Evented;\n ImageManager2.prototype = Object.create(Evented && Evented.prototype);\n ImageManager2.prototype.constructor = ImageManager2;\n ImageManager2.prototype.isLoaded = function isLoaded() {\n return this.loaded;\n };\n ImageManager2.prototype.setLoaded = function setLoaded(loaded) {\n if (this.loaded === loaded) {\n return;\n }\n this.loaded = loaded;\n if (loaded) {\n for (var i = 0, list = this.requestors; i < list.length; i += 1) {\n var ref = list[i];\n var ids = ref.ids;\n var callback = ref.callback;\n this._notify(ids, callback);\n }\n this.requestors = [];\n }\n };\n ImageManager2.prototype.getImage = function getImage(id) {\n return this.images[id];\n };\n ImageManager2.prototype.addImage = function addImage(id, image) {\n if (this._validate(id, image)) {\n this.images[id] = image;\n }\n };\n ImageManager2.prototype._validate = function _validate(id, image) {\n var valid = true;\n if (!this._validateStretch(image.stretchX, image.data && image.data.width)) {\n this.fire(new performance2.ErrorEvent(new Error('Image \"' + id + '\" has invalid \"stretchX\" value')));\n valid = false;\n }\n if (!this._validateStretch(image.stretchY, image.data && image.data.height)) {\n this.fire(new performance2.ErrorEvent(new Error('Image \"' + id + '\" has invalid \"stretchY\" value')));\n valid = false;\n }\n if (!this._validateContent(image.content, image)) {\n this.fire(new performance2.ErrorEvent(new Error('Image \"' + id + '\" has invalid \"content\" value')));\n valid = false;\n }\n return valid;\n };\n ImageManager2.prototype._validateStretch = function _validateStretch(stretch, size) {\n if (!stretch) {\n return true;\n }\n var last = 0;\n for (var i = 0, list = stretch; i < list.length; i += 1) {\n var part = list[i];\n if (part[0] < last || part[1] < part[0] || size < part[1]) {\n return false;\n }\n last = part[1];\n }\n return true;\n };\n ImageManager2.prototype._validateContent = function _validateContent(content, image) {\n if (!content) {\n return true;\n }\n if (content.length !== 4) {\n return false;\n }\n if (content[0] < 0 || image.data.width < content[0]) {\n return false;\n }\n if (content[1] < 0 || image.data.height < content[1]) {\n return false;\n }\n if (content[2] < 0 || image.data.width < content[2]) {\n return false;\n }\n if (content[3] < 0 || image.data.height < content[3]) {\n return false;\n }\n if (content[2] < content[0]) {\n return false;\n }\n if (content[3] < content[1]) {\n return false;\n }\n return true;\n };\n ImageManager2.prototype.updateImage = function updateImage(id, image) {\n var oldImage = this.images[id];\n image.version = oldImage.version + 1;\n this.images[id] = image;\n this.updatedImages[id] = true;\n };\n ImageManager2.prototype.removeImage = function removeImage(id) {\n var image = this.images[id];\n delete this.images[id];\n delete this.patterns[id];\n if (image.userImage && image.userImage.onRemove) {\n image.userImage.onRemove();\n }\n };\n ImageManager2.prototype.listImages = function listImages() {\n return Object.keys(this.images);\n };\n ImageManager2.prototype.getImages = function getImages(ids, callback) {\n var hasAllDependencies = true;\n if (!this.isLoaded()) {\n for (var i = 0, list = ids; i < list.length; i += 1) {\n var id = list[i];\n if (!this.images[id]) {\n hasAllDependencies = false;\n }\n }\n }\n if (this.isLoaded() || hasAllDependencies) {\n this._notify(ids, callback);\n } else {\n this.requestors.push({\n ids,\n callback\n });\n }\n };\n ImageManager2.prototype._notify = function _notify(ids, callback) {\n var response = {};\n for (var i = 0, list = ids; i < list.length; i += 1) {\n var id = list[i];\n if (!this.images[id]) {\n this.fire(new performance2.Event(\"styleimagemissing\", { id }));\n }\n var image = this.images[id];\n if (image) {\n response[id] = {\n data: image.data.clone(),\n pixelRatio: image.pixelRatio,\n sdf: image.sdf,\n version: image.version,\n stretchX: image.stretchX,\n stretchY: image.stretchY,\n content: image.content,\n hasRenderCallback: Boolean(image.userImage && image.userImage.render)\n };\n } else {\n performance2.warnOnce('Image \"' + id + '\" could not be loaded. Please make sure you have added the image with map.addImage() or a \"sprite\" property in your style. You can provide missing images by listening for the \"styleimagemissing\" map event.');\n }\n }\n callback(null, response);\n };\n ImageManager2.prototype.getPixelSize = function getPixelSize() {\n var ref = this.atlasImage;\n var width = ref.width;\n var height = ref.height;\n return {\n width,\n height\n };\n };\n ImageManager2.prototype.getPattern = function getPattern(id) {\n var pattern = this.patterns[id];\n var image = this.getImage(id);\n if (!image) {\n return null;\n }\n if (pattern && pattern.position.version === image.version) {\n return pattern.position;\n }\n if (!pattern) {\n var w = image.data.width + padding * 2;\n var h = image.data.height + padding * 2;\n var bin = {\n w,\n h,\n x: 0,\n y: 0\n };\n var position = new performance2.ImagePosition(bin, image);\n this.patterns[id] = {\n bin,\n position\n };\n } else {\n pattern.position.version = image.version;\n }\n this._updatePatternAtlas();\n return this.patterns[id].position;\n };\n ImageManager2.prototype.bind = function bind(context) {\n var gl2 = context.gl;\n if (!this.atlasTexture) {\n this.atlasTexture = new performance2.Texture(context, this.atlasImage, gl2.RGBA);\n } else if (this.dirty) {\n this.atlasTexture.update(this.atlasImage);\n this.dirty = false;\n }\n this.atlasTexture.bind(gl2.LINEAR, gl2.CLAMP_TO_EDGE);\n };\n ImageManager2.prototype._updatePatternAtlas = function _updatePatternAtlas() {\n var bins = [];\n for (var id in this.patterns) {\n bins.push(this.patterns[id].bin);\n }\n var ref = performance2.potpack(bins);\n var w = ref.w;\n var h = ref.h;\n var dst = this.atlasImage;\n dst.resize({\n width: w || 1,\n height: h || 1\n });\n for (var id$1 in this.patterns) {\n var ref$1 = this.patterns[id$1];\n var bin = ref$1.bin;\n var x = bin.x + padding;\n var y = bin.y + padding;\n var src = this.images[id$1].data;\n var w$1 = src.width;\n var h$1 = src.height;\n performance2.RGBAImage.copy(src, dst, {\n x: 0,\n y: 0\n }, {\n x,\n y\n }, {\n width: w$1,\n height: h$1\n });\n performance2.RGBAImage.copy(src, dst, {\n x: 0,\n y: h$1 - 1\n }, {\n x,\n y: y - 1\n }, {\n width: w$1,\n height: 1\n });\n performance2.RGBAImage.copy(src, dst, {\n x: 0,\n y: 0\n }, {\n x,\n y: y + h$1\n }, {\n width: w$1,\n height: 1\n });\n performance2.RGBAImage.copy(src, dst, {\n x: w$1 - 1,\n y: 0\n }, {\n x: x - 1,\n y\n }, {\n width: 1,\n height: h$1\n });\n performance2.RGBAImage.copy(src, dst, {\n x: 0,\n y: 0\n }, {\n x: x + w$1,\n y\n }, {\n width: 1,\n height: h$1\n });\n }\n this.dirty = true;\n };\n ImageManager2.prototype.beginFrame = function beginFrame() {\n this.callbackDispatchedThisFrame = {};\n };\n ImageManager2.prototype.dispatchRenderCallbacks = function dispatchRenderCallbacks(ids) {\n for (var i = 0, list = ids; i < list.length; i += 1) {\n var id = list[i];\n if (this.callbackDispatchedThisFrame[id]) {\n continue;\n }\n this.callbackDispatchedThisFrame[id] = true;\n var image = this.images[id];\n var updated = renderStyleImage(image);\n if (updated) {\n this.updateImage(id, image);\n }\n }\n };\n return ImageManager2;\n }(performance2.Evented);\n function loadGlyphRange(fontstack, range, urlTemplate, requestManager, callback) {\n var begin = range * 256;\n var end = begin + 255;\n var request = requestManager.transformRequest(requestManager.normalizeGlyphsURL(urlTemplate).replace(\"{fontstack}\", fontstack).replace(\"{range}\", begin + \"-\" + end), performance2.ResourceType.Glyphs);\n performance2.getArrayBuffer(request, function(err, data) {\n if (err) {\n callback(err);\n } else if (data) {\n var glyphs = {};\n for (var i = 0, list = performance2.parseGlyphPBF(data); i < list.length; i += 1) {\n var glyph = list[i];\n glyphs[glyph.id] = glyph;\n }\n callback(null, glyphs);\n }\n });\n }\n var tinySdf = TinySDF;\n var default_1 = TinySDF;\n var INF = 1e20;\n function TinySDF(fontSize, buffer, radius, cutoff, fontFamily, fontWeight) {\n this.fontSize = fontSize || 24;\n this.buffer = buffer === void 0 ? 3 : buffer;\n this.cutoff = cutoff || 0.25;\n this.fontFamily = fontFamily || \"sans-serif\";\n this.fontWeight = fontWeight || \"normal\";\n this.radius = radius || 8;\n var size = this.size = this.fontSize + this.buffer * 2;\n this.canvas = document.createElement(\"canvas\");\n this.canvas.width = this.canvas.height = size;\n this.ctx = this.canvas.getContext(\"2d\");\n this.ctx.font = this.fontWeight + \" \" + this.fontSize + \"px \" + this.fontFamily;\n this.ctx.textBaseline = \"middle\";\n this.ctx.fillStyle = \"black\";\n this.gridOuter = new Float64Array(size * size);\n this.gridInner = new Float64Array(size * size);\n this.f = new Float64Array(size);\n this.d = new Float64Array(size);\n this.z = new Float64Array(size + 1);\n this.v = new Int16Array(size);\n this.middle = Math.round(size / 2 * (navigator.userAgent.indexOf(\"Gecko/\") >= 0 ? 1.2 : 1));\n }\n TinySDF.prototype.draw = function(char) {\n this.ctx.clearRect(0, 0, this.size, this.size);\n this.ctx.fillText(char, this.buffer, this.middle);\n var imgData = this.ctx.getImageData(0, 0, this.size, this.size);\n var alphaChannel = new Uint8ClampedArray(this.size * this.size);\n for (var i = 0; i < this.size * this.size; i++) {\n var a = imgData.data[i * 4 + 3] / 255;\n this.gridOuter[i] = a === 1 ? 0 : a === 0 ? INF : Math.pow(Math.max(0, 0.5 - a), 2);\n this.gridInner[i] = a === 1 ? INF : a === 0 ? 0 : Math.pow(Math.max(0, a - 0.5), 2);\n }\n edt(this.gridOuter, this.size, this.size, this.f, this.d, this.v, this.z);\n edt(this.gridInner, this.size, this.size, this.f, this.d, this.v, this.z);\n for (i = 0; i < this.size * this.size; i++) {\n var d = this.gridOuter[i] - this.gridInner[i];\n alphaChannel[i] = Math.max(0, Math.min(255, Math.round(255 - 255 * (d / this.radius + this.cutoff))));\n }\n return alphaChannel;\n };\n function edt(data, width, height, f, d, v, z) {\n for (var x = 0; x < width; x++) {\n for (var y = 0; y < height; y++) {\n f[y] = data[y * width + x];\n }\n edt1d(f, d, v, z, height);\n for (y = 0; y < height; y++) {\n data[y * width + x] = d[y];\n }\n }\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n f[x] = data[y * width + x];\n }\n edt1d(f, d, v, z, width);\n for (x = 0; x < width; x++) {\n data[y * width + x] = Math.sqrt(d[x]);\n }\n }\n }\n function edt1d(f, d, v, z, n) {\n v[0] = 0;\n z[0] = -INF;\n z[1] = +INF;\n for (var q = 1, k = 0; q < n; q++) {\n var s = (f[q] + q * q - (f[v[k]] + v[k] * v[k])) / (2 * q - 2 * v[k]);\n while (s <= z[k]) {\n k--;\n s = (f[q] + q * q - (f[v[k]] + v[k] * v[k])) / (2 * q - 2 * v[k]);\n }\n k++;\n v[k] = q;\n z[k] = s;\n z[k + 1] = +INF;\n }\n for (q = 0, k = 0; q < n; q++) {\n while (z[k + 1] < q) {\n k++;\n }\n d[q] = (q - v[k]) * (q - v[k]) + f[v[k]];\n }\n }\n tinySdf.default = default_1;\n var GlyphManager = function GlyphManager2(requestManager, localIdeographFontFamily) {\n this.requestManager = requestManager;\n this.localIdeographFontFamily = localIdeographFontFamily;\n this.entries = {};\n };\n GlyphManager.prototype.setURL = function setURL(url) {\n this.url = url;\n };\n GlyphManager.prototype.getGlyphs = function getGlyphs(glyphs, callback) {\n var this$1 = this;\n var all = [];\n for (var stack in glyphs) {\n for (var i = 0, list = glyphs[stack]; i < list.length; i += 1) {\n var id = list[i];\n all.push({\n stack,\n id\n });\n }\n }\n performance2.asyncAll(all, function(ref, callback2) {\n var stack2 = ref.stack;\n var id2 = ref.id;\n var entry = this$1.entries[stack2];\n if (!entry) {\n entry = this$1.entries[stack2] = {\n glyphs: {},\n requests: {},\n ranges: {}\n };\n }\n var glyph = entry.glyphs[id2];\n if (glyph !== void 0) {\n callback2(null, {\n stack: stack2,\n id: id2,\n glyph\n });\n return;\n }\n glyph = this$1._tinySDF(entry, stack2, id2);\n if (glyph) {\n entry.glyphs[id2] = glyph;\n callback2(null, {\n stack: stack2,\n id: id2,\n glyph\n });\n return;\n }\n var range = Math.floor(id2 / 256);\n if (range * 256 > 65535) {\n callback2(new Error(\"glyphs > 65535 not supported\"));\n return;\n }\n if (entry.ranges[range]) {\n callback2(null, {\n stack: stack2,\n id: id2,\n glyph\n });\n return;\n }\n var requests = entry.requests[range];\n if (!requests) {\n requests = entry.requests[range] = [];\n GlyphManager.loadGlyphRange(stack2, range, this$1.url, this$1.requestManager, function(err, response) {\n if (response) {\n for (var id3 in response) {\n if (!this$1._doesCharSupportLocalGlyph(+id3)) {\n entry.glyphs[+id3] = response[+id3];\n }\n }\n entry.ranges[range] = true;\n }\n for (var i2 = 0, list2 = requests; i2 < list2.length; i2 += 1) {\n var cb = list2[i2];\n cb(err, response);\n }\n delete entry.requests[range];\n });\n }\n requests.push(function(err, result) {\n if (err) {\n callback2(err);\n } else if (result) {\n callback2(null, {\n stack: stack2,\n id: id2,\n glyph: result[id2] || null\n });\n }\n });\n }, function(err, glyphs2) {\n if (err) {\n callback(err);\n } else if (glyphs2) {\n var result = {};\n for (var i2 = 0, list2 = glyphs2; i2 < list2.length; i2 += 1) {\n var ref = list2[i2];\n var stack2 = ref.stack;\n var id2 = ref.id;\n var glyph = ref.glyph;\n (result[stack2] || (result[stack2] = {}))[id2] = glyph && {\n id: glyph.id,\n bitmap: glyph.bitmap.clone(),\n metrics: glyph.metrics\n };\n }\n callback(null, result);\n }\n });\n };\n GlyphManager.prototype._doesCharSupportLocalGlyph = function _doesCharSupportLocalGlyph(id) {\n return !!this.localIdeographFontFamily && (performance2.isChar[\"CJK Unified Ideographs\"](id) || performance2.isChar[\"Hangul Syllables\"](id) || performance2.isChar[\"Hiragana\"](id) || performance2.isChar[\"Katakana\"](id));\n };\n GlyphManager.prototype._tinySDF = function _tinySDF(entry, stack, id) {\n var family = this.localIdeographFontFamily;\n if (!family) {\n return;\n }\n if (!this._doesCharSupportLocalGlyph(id)) {\n return;\n }\n var tinySDF = entry.tinySDF;\n if (!tinySDF) {\n var fontWeight = \"400\";\n if (/bold/i.test(stack)) {\n fontWeight = \"900\";\n } else if (/medium/i.test(stack)) {\n fontWeight = \"500\";\n } else if (/light/i.test(stack)) {\n fontWeight = \"200\";\n }\n tinySDF = entry.tinySDF = new GlyphManager.TinySDF(24, 3, 8, 0.25, family, fontWeight);\n }\n return {\n id,\n bitmap: new performance2.AlphaImage({\n width: 30,\n height: 30\n }, tinySDF.draw(String.fromCharCode(id))),\n metrics: {\n width: 24,\n height: 24,\n left: 0,\n top: -8,\n advance: 24\n }\n };\n };\n GlyphManager.loadGlyphRange = loadGlyphRange;\n GlyphManager.TinySDF = tinySdf;\n var LightPositionProperty = function LightPositionProperty2() {\n this.specification = performance2.styleSpec.light.position;\n };\n LightPositionProperty.prototype.possiblyEvaluate = function possiblyEvaluate(value, parameters) {\n return performance2.sphericalToCartesian(value.expression.evaluate(parameters));\n };\n LightPositionProperty.prototype.interpolate = function interpolate$1(a, b, t) {\n return {\n x: performance2.number(a.x, b.x, t),\n y: performance2.number(a.y, b.y, t),\n z: performance2.number(a.z, b.z, t)\n };\n };\n var properties = new performance2.Properties({\n \"anchor\": new performance2.DataConstantProperty(performance2.styleSpec.light.anchor),\n \"position\": new LightPositionProperty(),\n \"color\": new performance2.DataConstantProperty(performance2.styleSpec.light.color),\n \"intensity\": new performance2.DataConstantProperty(performance2.styleSpec.light.intensity)\n });\n var TRANSITION_SUFFIX = \"-transition\";\n var Light = function(Evented) {\n function Light2(lightOptions) {\n Evented.call(this);\n this._transitionable = new performance2.Transitionable(properties);\n this.setLight(lightOptions);\n this._transitioning = this._transitionable.untransitioned();\n }\n if (Evented)\n Light2.__proto__ = Evented;\n Light2.prototype = Object.create(Evented && Evented.prototype);\n Light2.prototype.constructor = Light2;\n Light2.prototype.getLight = function getLight() {\n return this._transitionable.serialize();\n };\n Light2.prototype.setLight = function setLight(light, options) {\n if (options === void 0)\n options = {};\n if (this._validate(performance2.validateLight, light, options)) {\n return;\n }\n for (var name2 in light) {\n var value = light[name2];\n if (performance2.endsWith(name2, TRANSITION_SUFFIX)) {\n this._transitionable.setTransition(name2.slice(0, -TRANSITION_SUFFIX.length), value);\n } else {\n this._transitionable.setValue(name2, value);\n }\n }\n };\n Light2.prototype.updateTransitions = function updateTransitions(parameters) {\n this._transitioning = this._transitionable.transitioned(parameters, this._transitioning);\n };\n Light2.prototype.hasTransition = function hasTransition() {\n return this._transitioning.hasTransition();\n };\n Light2.prototype.recalculate = function recalculate(parameters) {\n this.properties = this._transitioning.possiblyEvaluate(parameters);\n };\n Light2.prototype._validate = function _validate(validate, value, options) {\n if (options && options.validate === false) {\n return false;\n }\n return performance2.emitValidationErrors(this, validate.call(performance2.validateStyle, performance2.extend({\n value,\n style: {\n glyphs: true,\n sprite: true\n },\n styleSpec: performance2.styleSpec\n })));\n };\n return Light2;\n }(performance2.Evented);\n var LineAtlas = function LineAtlas2(width, height) {\n this.width = width;\n this.height = height;\n this.nextRow = 0;\n this.data = new Uint8Array(this.width * this.height);\n this.dashEntry = {};\n };\n LineAtlas.prototype.getDash = function getDash(dasharray, round) {\n var key = dasharray.join(\",\") + String(round);\n if (!this.dashEntry[key]) {\n this.dashEntry[key] = this.addDash(dasharray, round);\n }\n return this.dashEntry[key];\n };\n LineAtlas.prototype.getDashRanges = function getDashRanges(dasharray, lineAtlasWidth, stretch) {\n var oddDashArray = dasharray.length % 2 === 1;\n var ranges = [];\n var left = oddDashArray ? -dasharray[dasharray.length - 1] * stretch : 0;\n var right = dasharray[0] * stretch;\n var isDash = true;\n ranges.push({\n left,\n right,\n isDash,\n zeroLength: dasharray[0] === 0\n });\n var currentDashLength = dasharray[0];\n for (var i = 1; i < dasharray.length; i++) {\n isDash = !isDash;\n var dashLength = dasharray[i];\n left = currentDashLength * stretch;\n currentDashLength += dashLength;\n right = currentDashLength * stretch;\n ranges.push({\n left,\n right,\n isDash,\n zeroLength: dashLength === 0\n });\n }\n return ranges;\n };\n LineAtlas.prototype.addRoundDash = function addRoundDash(ranges, stretch, n) {\n var halfStretch = stretch / 2;\n for (var y = -n; y <= n; y++) {\n var row = this.nextRow + n + y;\n var index = this.width * row;\n var currIndex = 0;\n var range = ranges[currIndex];\n for (var x = 0; x < this.width; x++) {\n if (x / range.right > 1) {\n range = ranges[++currIndex];\n }\n var distLeft = Math.abs(x - range.left);\n var distRight = Math.abs(x - range.right);\n var minDist = Math.min(distLeft, distRight);\n var signedDistance = void 0;\n var distMiddle = y / n * (halfStretch + 1);\n if (range.isDash) {\n var distEdge = halfStretch - Math.abs(distMiddle);\n signedDistance = Math.sqrt(minDist * minDist + distEdge * distEdge);\n } else {\n signedDistance = halfStretch - Math.sqrt(minDist * minDist + distMiddle * distMiddle);\n }\n this.data[index + x] = Math.max(0, Math.min(255, signedDistance + 128));\n }\n }\n };\n LineAtlas.prototype.addRegularDash = function addRegularDash(ranges) {\n for (var i = ranges.length - 1; i >= 0; --i) {\n var part = ranges[i];\n var next = ranges[i + 1];\n if (part.zeroLength) {\n ranges.splice(i, 1);\n } else if (next && next.isDash === part.isDash) {\n next.left = part.left;\n ranges.splice(i, 1);\n }\n }\n var first = ranges[0];\n var last = ranges[ranges.length - 1];\n if (first.isDash === last.isDash) {\n first.left = last.left - this.width;\n last.right = first.right + this.width;\n }\n var index = this.width * this.nextRow;\n var currIndex = 0;\n var range = ranges[currIndex];\n for (var x = 0; x < this.width; x++) {\n if (x / range.right > 1) {\n range = ranges[++currIndex];\n }\n var distLeft = Math.abs(x - range.left);\n var distRight = Math.abs(x - range.right);\n var minDist = Math.min(distLeft, distRight);\n var signedDistance = range.isDash ? minDist : -minDist;\n this.data[index + x] = Math.max(0, Math.min(255, signedDistance + 128));\n }\n };\n LineAtlas.prototype.addDash = function addDash(dasharray, round) {\n var n = round ? 7 : 0;\n var height = 2 * n + 1;\n if (this.nextRow + height > this.height) {\n performance2.warnOnce(\"LineAtlas out of space\");\n return null;\n }\n var length = 0;\n for (var i = 0; i < dasharray.length; i++) {\n length += dasharray[i];\n }\n if (length !== 0) {\n var stretch = this.width / length;\n var ranges = this.getDashRanges(dasharray, this.width, stretch);\n if (round) {\n this.addRoundDash(ranges, stretch, n);\n } else {\n this.addRegularDash(ranges);\n }\n }\n var dashEntry = {\n y: (this.nextRow + n + 0.5) / this.height,\n height: 2 * n / this.height,\n width: length\n };\n this.nextRow += height;\n this.dirty = true;\n return dashEntry;\n };\n LineAtlas.prototype.bind = function bind(context) {\n var gl2 = context.gl;\n if (!this.texture) {\n this.texture = gl2.createTexture();\n gl2.bindTexture(gl2.TEXTURE_2D, this.texture);\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_WRAP_S, gl2.REPEAT);\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_WRAP_T, gl2.REPEAT);\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_MIN_FILTER, gl2.LINEAR);\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_MAG_FILTER, gl2.LINEAR);\n gl2.texImage2D(gl2.TEXTURE_2D, 0, gl2.ALPHA, this.width, this.height, 0, gl2.ALPHA, gl2.UNSIGNED_BYTE, this.data);\n } else {\n gl2.bindTexture(gl2.TEXTURE_2D, this.texture);\n if (this.dirty) {\n this.dirty = false;\n gl2.texSubImage2D(gl2.TEXTURE_2D, 0, 0, 0, this.width, this.height, gl2.ALPHA, gl2.UNSIGNED_BYTE, this.data);\n }\n }\n };\n var Dispatcher = function Dispatcher2(workerPool, parent) {\n this.workerPool = workerPool;\n this.actors = [];\n this.currentActor = 0;\n this.id = performance2.uniqueId();\n var workers = this.workerPool.acquire(this.id);\n for (var i = 0; i < workers.length; i++) {\n var worker2 = workers[i];\n var actor = new Dispatcher2.Actor(worker2, parent, this.id);\n actor.name = \"Worker \" + i;\n this.actors.push(actor);\n }\n };\n Dispatcher.prototype.broadcast = function broadcast(type, data, cb) {\n cb = cb || function() {\n };\n performance2.asyncAll(this.actors, function(actor, done) {\n actor.send(type, data, done);\n }, cb);\n };\n Dispatcher.prototype.getActor = function getActor() {\n this.currentActor = (this.currentActor + 1) % this.actors.length;\n return this.actors[this.currentActor];\n };\n Dispatcher.prototype.remove = function remove() {\n this.actors.forEach(function(actor) {\n actor.remove();\n });\n this.actors = [];\n this.workerPool.release(this.id);\n };\n Dispatcher.Actor = performance2.Actor;\n function loadTileJSON(options, requestManager, callback) {\n var loaded = function(err, tileJSON) {\n if (err) {\n return callback(err);\n } else if (tileJSON) {\n var result = performance2.pick(performance2.extend(tileJSON, options), [\n \"tiles\",\n \"minzoom\",\n \"maxzoom\",\n \"attribution\",\n \"mapbox_logo\",\n \"bounds\",\n \"scheme\",\n \"tileSize\",\n \"encoding\"\n ]);\n if (tileJSON.vector_layers) {\n result.vectorLayers = tileJSON.vector_layers;\n result.vectorLayerIds = result.vectorLayers.map(function(layer) {\n return layer.id;\n });\n }\n result.tiles = requestManager.canonicalizeTileset(result, options.url);\n callback(null, result);\n }\n };\n if (options.url) {\n return performance2.getJSON(requestManager.transformRequest(requestManager.normalizeSourceURL(options.url), performance2.ResourceType.Source), loaded);\n } else {\n return performance2.browser.frame(function() {\n return loaded(null, options);\n });\n }\n }\n var TileBounds = function TileBounds2(bounds, minzoom, maxzoom) {\n this.bounds = performance2.LngLatBounds.convert(this.validateBounds(bounds));\n this.minzoom = minzoom || 0;\n this.maxzoom = maxzoom || 24;\n };\n TileBounds.prototype.validateBounds = function validateBounds(bounds) {\n if (!Array.isArray(bounds) || bounds.length !== 4) {\n return [\n -180,\n -90,\n 180,\n 90\n ];\n }\n return [\n Math.max(-180, bounds[0]),\n Math.max(-90, bounds[1]),\n Math.min(180, bounds[2]),\n Math.min(90, bounds[3])\n ];\n };\n TileBounds.prototype.contains = function contains(tileID) {\n var worldSize = Math.pow(2, tileID.z);\n var level = {\n minX: Math.floor(performance2.mercatorXfromLng(this.bounds.getWest()) * worldSize),\n minY: Math.floor(performance2.mercatorYfromLat(this.bounds.getNorth()) * worldSize),\n maxX: Math.ceil(performance2.mercatorXfromLng(this.bounds.getEast()) * worldSize),\n maxY: Math.ceil(performance2.mercatorYfromLat(this.bounds.getSouth()) * worldSize)\n };\n var hit = tileID.x >= level.minX && tileID.x < level.maxX && tileID.y >= level.minY && tileID.y < level.maxY;\n return hit;\n };\n var VectorTileSource = function(Evented) {\n function VectorTileSource2(id, options, dispatcher, eventedParent) {\n Evented.call(this);\n this.id = id;\n this.dispatcher = dispatcher;\n this.type = \"vector\";\n this.minzoom = 0;\n this.maxzoom = 22;\n this.scheme = \"xyz\";\n this.tileSize = 512;\n this.reparseOverscaled = true;\n this.isTileClipped = true;\n this._loaded = false;\n performance2.extend(this, performance2.pick(options, [\n \"url\",\n \"scheme\",\n \"tileSize\",\n \"promoteId\"\n ]));\n this._options = performance2.extend({ type: \"vector\" }, options);\n this._collectResourceTiming = options.collectResourceTiming;\n if (this.tileSize !== 512) {\n throw new Error(\"vector tile sources must have a tileSize of 512\");\n }\n this.setEventedParent(eventedParent);\n }\n if (Evented)\n VectorTileSource2.__proto__ = Evented;\n VectorTileSource2.prototype = Object.create(Evented && Evented.prototype);\n VectorTileSource2.prototype.constructor = VectorTileSource2;\n VectorTileSource2.prototype.load = function load() {\n var this$1 = this;\n this._loaded = false;\n this.fire(new performance2.Event(\"dataloading\", { dataType: \"source\" }));\n this._tileJSONRequest = loadTileJSON(this._options, this.map._requestManager, function(err, tileJSON) {\n this$1._tileJSONRequest = null;\n this$1._loaded = true;\n if (err) {\n this$1.fire(new performance2.ErrorEvent(err));\n } else if (tileJSON) {\n performance2.extend(this$1, tileJSON);\n if (tileJSON.bounds) {\n this$1.tileBounds = new TileBounds(tileJSON.bounds, this$1.minzoom, this$1.maxzoom);\n }\n performance2.postTurnstileEvent(tileJSON.tiles, this$1.map._requestManager._customAccessToken);\n performance2.postMapLoadEvent(tileJSON.tiles, this$1.map._getMapId(), this$1.map._requestManager._skuToken, this$1.map._requestManager._customAccessToken);\n this$1.fire(new performance2.Event(\"data\", {\n dataType: \"source\",\n sourceDataType: \"metadata\"\n }));\n this$1.fire(new performance2.Event(\"data\", {\n dataType: \"source\",\n sourceDataType: \"content\"\n }));\n }\n });\n };\n VectorTileSource2.prototype.loaded = function loaded() {\n return this._loaded;\n };\n VectorTileSource2.prototype.hasTile = function hasTile(tileID) {\n return !this.tileBounds || this.tileBounds.contains(tileID.canonical);\n };\n VectorTileSource2.prototype.onAdd = function onAdd(map) {\n this.map = map;\n this.load();\n };\n VectorTileSource2.prototype.setSourceProperty = function setSourceProperty(callback) {\n if (this._tileJSONRequest) {\n this._tileJSONRequest.cancel();\n }\n callback();\n var sourceCache = this.map.style.sourceCaches[this.id];\n sourceCache.clearTiles();\n this.load();\n };\n VectorTileSource2.prototype.setTiles = function setTiles(tiles) {\n var this$1 = this;\n this.setSourceProperty(function() {\n this$1._options.tiles = tiles;\n });\n return this;\n };\n VectorTileSource2.prototype.setUrl = function setUrl(url) {\n var this$1 = this;\n this.setSourceProperty(function() {\n this$1.url = url;\n this$1._options.url = url;\n });\n return this;\n };\n VectorTileSource2.prototype.onRemove = function onRemove() {\n if (this._tileJSONRequest) {\n this._tileJSONRequest.cancel();\n this._tileJSONRequest = null;\n }\n };\n VectorTileSource2.prototype.serialize = function serialize() {\n return performance2.extend({}, this._options);\n };\n VectorTileSource2.prototype.loadTile = function loadTile(tile, callback) {\n var url = this.map._requestManager.normalizeTileURL(tile.tileID.canonical.url(this.tiles, this.scheme));\n var params = {\n request: this.map._requestManager.transformRequest(url, performance2.ResourceType.Tile),\n uid: tile.uid,\n tileID: tile.tileID,\n zoom: tile.tileID.overscaledZ,\n tileSize: this.tileSize * tile.tileID.overscaleFactor(),\n type: this.type,\n source: this.id,\n pixelRatio: performance2.browser.devicePixelRatio,\n showCollisionBoxes: this.map.showCollisionBoxes,\n promoteId: this.promoteId\n };\n params.request.collectResourceTiming = this._collectResourceTiming;\n if (!tile.actor || tile.state === \"expired\") {\n tile.actor = this.dispatcher.getActor();\n tile.request = tile.actor.send(\"loadTile\", params, done.bind(this));\n } else if (tile.state === \"loading\") {\n tile.reloadCallback = callback;\n } else {\n tile.request = tile.actor.send(\"reloadTile\", params, done.bind(this));\n }\n function done(err, data) {\n delete tile.request;\n if (tile.aborted) {\n return callback(null);\n }\n if (err && err.status !== 404) {\n return callback(err);\n }\n if (data && data.resourceTiming) {\n tile.resourceTiming = data.resourceTiming;\n }\n if (this.map._refreshExpiredTiles && data) {\n tile.setExpiryData(data);\n }\n tile.loadVectorData(data, this.map.painter);\n performance2.cacheEntryPossiblyAdded(this.dispatcher);\n callback(null);\n if (tile.reloadCallback) {\n this.loadTile(tile, tile.reloadCallback);\n tile.reloadCallback = null;\n }\n }\n };\n VectorTileSource2.prototype.abortTile = function abortTile(tile) {\n if (tile.request) {\n tile.request.cancel();\n delete tile.request;\n }\n if (tile.actor) {\n tile.actor.send(\"abortTile\", {\n uid: tile.uid,\n type: this.type,\n source: this.id\n }, void 0);\n }\n };\n VectorTileSource2.prototype.unloadTile = function unloadTile(tile) {\n tile.unloadVectorData();\n if (tile.actor) {\n tile.actor.send(\"removeTile\", {\n uid: tile.uid,\n type: this.type,\n source: this.id\n }, void 0);\n }\n };\n VectorTileSource2.prototype.hasTransition = function hasTransition() {\n return false;\n };\n return VectorTileSource2;\n }(performance2.Evented);\n var RasterTileSource = function(Evented) {\n function RasterTileSource2(id, options, dispatcher, eventedParent) {\n Evented.call(this);\n this.id = id;\n this.dispatcher = dispatcher;\n this.setEventedParent(eventedParent);\n this.type = \"raster\";\n this.minzoom = 0;\n this.maxzoom = 22;\n this.roundZoom = true;\n this.scheme = \"xyz\";\n this.tileSize = 512;\n this._loaded = false;\n this._options = performance2.extend({ type: \"raster\" }, options);\n performance2.extend(this, performance2.pick(options, [\n \"url\",\n \"scheme\",\n \"tileSize\"\n ]));\n }\n if (Evented)\n RasterTileSource2.__proto__ = Evented;\n RasterTileSource2.prototype = Object.create(Evented && Evented.prototype);\n RasterTileSource2.prototype.constructor = RasterTileSource2;\n RasterTileSource2.prototype.load = function load() {\n var this$1 = this;\n this._loaded = false;\n this.fire(new performance2.Event(\"dataloading\", { dataType: \"source\" }));\n this._tileJSONRequest = loadTileJSON(this._options, this.map._requestManager, function(err, tileJSON) {\n this$1._tileJSONRequest = null;\n this$1._loaded = true;\n if (err) {\n this$1.fire(new performance2.ErrorEvent(err));\n } else if (tileJSON) {\n performance2.extend(this$1, tileJSON);\n if (tileJSON.bounds) {\n this$1.tileBounds = new TileBounds(tileJSON.bounds, this$1.minzoom, this$1.maxzoom);\n }\n performance2.postTurnstileEvent(tileJSON.tiles);\n performance2.postMapLoadEvent(tileJSON.tiles, this$1.map._getMapId(), this$1.map._requestManager._skuToken);\n this$1.fire(new performance2.Event(\"data\", {\n dataType: \"source\",\n sourceDataType: \"metadata\"\n }));\n this$1.fire(new performance2.Event(\"data\", {\n dataType: \"source\",\n sourceDataType: \"content\"\n }));\n }\n });\n };\n RasterTileSource2.prototype.loaded = function loaded() {\n return this._loaded;\n };\n RasterTileSource2.prototype.onAdd = function onAdd(map) {\n this.map = map;\n this.load();\n };\n RasterTileSource2.prototype.onRemove = function onRemove() {\n if (this._tileJSONRequest) {\n this._tileJSONRequest.cancel();\n this._tileJSONRequest = null;\n }\n };\n RasterTileSource2.prototype.serialize = function serialize() {\n return performance2.extend({}, this._options);\n };\n RasterTileSource2.prototype.hasTile = function hasTile(tileID) {\n return !this.tileBounds || this.tileBounds.contains(tileID.canonical);\n };\n RasterTileSource2.prototype.loadTile = function loadTile(tile, callback) {\n var this$1 = this;\n var url = this.map._requestManager.normalizeTileURL(tile.tileID.canonical.url(this.tiles, this.scheme), this.tileSize);\n tile.request = performance2.getImage(this.map._requestManager.transformRequest(url, performance2.ResourceType.Tile), function(err, img) {\n delete tile.request;\n if (tile.aborted) {\n tile.state = \"unloaded\";\n callback(null);\n } else if (err) {\n tile.state = \"errored\";\n callback(err);\n } else if (img) {\n if (this$1.map._refreshExpiredTiles) {\n tile.setExpiryData(img);\n }\n delete img.cacheControl;\n delete img.expires;\n var context = this$1.map.painter.context;\n var gl2 = context.gl;\n tile.texture = this$1.map.painter.getTileTexture(img.width);\n if (tile.texture) {\n tile.texture.update(img, { useMipmap: true });\n } else {\n tile.texture = new performance2.Texture(context, img, gl2.RGBA, { useMipmap: true });\n tile.texture.bind(gl2.LINEAR, gl2.CLAMP_TO_EDGE, gl2.LINEAR_MIPMAP_NEAREST);\n if (context.extTextureFilterAnisotropic) {\n gl2.texParameterf(gl2.TEXTURE_2D, context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, context.extTextureFilterAnisotropicMax);\n }\n }\n tile.state = \"loaded\";\n performance2.cacheEntryPossiblyAdded(this$1.dispatcher);\n callback(null);\n }\n });\n };\n RasterTileSource2.prototype.abortTile = function abortTile(tile, callback) {\n if (tile.request) {\n tile.request.cancel();\n delete tile.request;\n }\n callback();\n };\n RasterTileSource2.prototype.unloadTile = function unloadTile(tile, callback) {\n if (tile.texture) {\n this.map.painter.saveTileTexture(tile.texture);\n }\n callback();\n };\n RasterTileSource2.prototype.hasTransition = function hasTransition() {\n return false;\n };\n return RasterTileSource2;\n }(performance2.Evented);\n var RasterDEMTileSource = function(RasterTileSource2) {\n function RasterDEMTileSource2(id, options, dispatcher, eventedParent) {\n RasterTileSource2.call(this, id, options, dispatcher, eventedParent);\n this.type = \"raster-dem\";\n this.maxzoom = 22;\n this._options = performance2.extend({ type: \"raster-dem\" }, options);\n this.encoding = options.encoding || \"mapbox\";\n }\n if (RasterTileSource2)\n RasterDEMTileSource2.__proto__ = RasterTileSource2;\n RasterDEMTileSource2.prototype = Object.create(RasterTileSource2 && RasterTileSource2.prototype);\n RasterDEMTileSource2.prototype.constructor = RasterDEMTileSource2;\n RasterDEMTileSource2.prototype.serialize = function serialize() {\n return {\n type: \"raster-dem\",\n url: this.url,\n tileSize: this.tileSize,\n tiles: this.tiles,\n bounds: this.bounds,\n encoding: this.encoding\n };\n };\n RasterDEMTileSource2.prototype.loadTile = function loadTile(tile, callback) {\n var url = this.map._requestManager.normalizeTileURL(tile.tileID.canonical.url(this.tiles, this.scheme), this.tileSize);\n tile.request = performance2.getImage(this.map._requestManager.transformRequest(url, performance2.ResourceType.Tile), imageLoaded.bind(this));\n tile.neighboringTiles = this._getNeighboringTiles(tile.tileID);\n function imageLoaded(err, img) {\n delete tile.request;\n if (tile.aborted) {\n tile.state = \"unloaded\";\n callback(null);\n } else if (err) {\n tile.state = \"errored\";\n callback(err);\n } else if (img) {\n if (this.map._refreshExpiredTiles) {\n tile.setExpiryData(img);\n }\n delete img.cacheControl;\n delete img.expires;\n var transfer = performance2.window.ImageBitmap && img instanceof performance2.window.ImageBitmap && performance2.offscreenCanvasSupported();\n var rawImageData = transfer ? img : performance2.browser.getImageData(img, 1);\n var params = {\n uid: tile.uid,\n coord: tile.tileID,\n source: this.id,\n rawImageData,\n encoding: this.encoding\n };\n if (!tile.actor || tile.state === \"expired\") {\n tile.actor = this.dispatcher.getActor();\n tile.actor.send(\"loadDEMTile\", params, done.bind(this));\n }\n }\n }\n function done(err, dem) {\n if (err) {\n tile.state = \"errored\";\n callback(err);\n }\n if (dem) {\n tile.dem = dem;\n tile.needsHillshadePrepare = true;\n tile.state = \"loaded\";\n callback(null);\n }\n }\n };\n RasterDEMTileSource2.prototype._getNeighboringTiles = function _getNeighboringTiles(tileID) {\n var canonical = tileID.canonical;\n var dim = Math.pow(2, canonical.z);\n var px = (canonical.x - 1 + dim) % dim;\n var pxw = canonical.x === 0 ? tileID.wrap - 1 : tileID.wrap;\n var nx = (canonical.x + 1 + dim) % dim;\n var nxw = canonical.x + 1 === dim ? tileID.wrap + 1 : tileID.wrap;\n var neighboringTiles = {};\n neighboringTiles[new performance2.OverscaledTileID(tileID.overscaledZ, pxw, canonical.z, px, canonical.y).key] = { backfilled: false };\n neighboringTiles[new performance2.OverscaledTileID(tileID.overscaledZ, nxw, canonical.z, nx, canonical.y).key] = { backfilled: false };\n if (canonical.y > 0) {\n neighboringTiles[new performance2.OverscaledTileID(tileID.overscaledZ, pxw, canonical.z, px, canonical.y - 1).key] = { backfilled: false };\n neighboringTiles[new performance2.OverscaledTileID(tileID.overscaledZ, tileID.wrap, canonical.z, canonical.x, canonical.y - 1).key] = { backfilled: false };\n neighboringTiles[new performance2.OverscaledTileID(tileID.overscaledZ, nxw, canonical.z, nx, canonical.y - 1).key] = { backfilled: false };\n }\n if (canonical.y + 1 < dim) {\n neighboringTiles[new performance2.OverscaledTileID(tileID.overscaledZ, pxw, canonical.z, px, canonical.y + 1).key] = { backfilled: false };\n neighboringTiles[new performance2.OverscaledTileID(tileID.overscaledZ, tileID.wrap, canonical.z, canonical.x, canonical.y + 1).key] = { backfilled: false };\n neighboringTiles[new performance2.OverscaledTileID(tileID.overscaledZ, nxw, canonical.z, nx, canonical.y + 1).key] = { backfilled: false };\n }\n return neighboringTiles;\n };\n RasterDEMTileSource2.prototype.unloadTile = function unloadTile(tile) {\n if (tile.demTexture) {\n this.map.painter.saveTileTexture(tile.demTexture);\n }\n if (tile.fbo) {\n tile.fbo.destroy();\n delete tile.fbo;\n }\n if (tile.dem) {\n delete tile.dem;\n }\n delete tile.neighboringTiles;\n tile.state = \"unloaded\";\n if (tile.actor) {\n tile.actor.send(\"removeDEMTile\", {\n uid: tile.uid,\n source: this.id\n });\n }\n };\n return RasterDEMTileSource2;\n }(RasterTileSource);\n var GeoJSONSource = function(Evented) {\n function GeoJSONSource2(id, options, dispatcher, eventedParent) {\n Evented.call(this);\n this.id = id;\n this.type = \"geojson\";\n this.minzoom = 0;\n this.maxzoom = 18;\n this.tileSize = 512;\n this.isTileClipped = true;\n this.reparseOverscaled = true;\n this._removed = false;\n this._loaded = false;\n this.actor = dispatcher.getActor();\n this.setEventedParent(eventedParent);\n this._data = options.data;\n this._options = performance2.extend({}, options);\n this._collectResourceTiming = options.collectResourceTiming;\n this._resourceTiming = [];\n if (options.maxzoom !== void 0) {\n this.maxzoom = options.maxzoom;\n }\n if (options.type) {\n this.type = options.type;\n }\n if (options.attribution) {\n this.attribution = options.attribution;\n }\n this.promoteId = options.promoteId;\n var scale = performance2.EXTENT / this.tileSize;\n this.workerOptions = performance2.extend({\n source: this.id,\n cluster: options.cluster || false,\n geojsonVtOptions: {\n buffer: (options.buffer !== void 0 ? options.buffer : 128) * scale,\n tolerance: (options.tolerance !== void 0 ? options.tolerance : 0.375) * scale,\n extent: performance2.EXTENT,\n maxZoom: this.maxzoom,\n lineMetrics: options.lineMetrics || false,\n generateId: options.generateId || false\n },\n superclusterOptions: {\n maxZoom: options.clusterMaxZoom !== void 0 ? Math.min(options.clusterMaxZoom, this.maxzoom - 1) : this.maxzoom - 1,\n minPoints: Math.max(2, options.clusterMinPoints || 2),\n extent: performance2.EXTENT,\n radius: (options.clusterRadius || 50) * scale,\n log: false,\n generateId: options.generateId || false\n },\n clusterProperties: options.clusterProperties,\n filter: options.filter\n }, options.workerOptions);\n }\n if (Evented)\n GeoJSONSource2.__proto__ = Evented;\n GeoJSONSource2.prototype = Object.create(Evented && Evented.prototype);\n GeoJSONSource2.prototype.constructor = GeoJSONSource2;\n GeoJSONSource2.prototype.load = function load() {\n var this$1 = this;\n this.fire(new performance2.Event(\"dataloading\", { dataType: \"source\" }));\n this._updateWorkerData(function(err) {\n if (err) {\n this$1.fire(new performance2.ErrorEvent(err));\n return;\n }\n var data = {\n dataType: \"source\",\n sourceDataType: \"metadata\"\n };\n if (this$1._collectResourceTiming && this$1._resourceTiming && this$1._resourceTiming.length > 0) {\n data.resourceTiming = this$1._resourceTiming;\n this$1._resourceTiming = [];\n }\n this$1.fire(new performance2.Event(\"data\", data));\n });\n };\n GeoJSONSource2.prototype.onAdd = function onAdd(map) {\n this.map = map;\n this.load();\n };\n GeoJSONSource2.prototype.setData = function setData(data) {\n var this$1 = this;\n this._data = data;\n this.fire(new performance2.Event(\"dataloading\", { dataType: \"source\" }));\n this._updateWorkerData(function(err) {\n if (err) {\n this$1.fire(new performance2.ErrorEvent(err));\n return;\n }\n var data2 = {\n dataType: \"source\",\n sourceDataType: \"content\"\n };\n if (this$1._collectResourceTiming && this$1._resourceTiming && this$1._resourceTiming.length > 0) {\n data2.resourceTiming = this$1._resourceTiming;\n this$1._resourceTiming = [];\n }\n this$1.fire(new performance2.Event(\"data\", data2));\n });\n return this;\n };\n GeoJSONSource2.prototype.getClusterExpansionZoom = function getClusterExpansionZoom(clusterId, callback) {\n this.actor.send(\"geojson.getClusterExpansionZoom\", {\n clusterId,\n source: this.id\n }, callback);\n return this;\n };\n GeoJSONSource2.prototype.getClusterChildren = function getClusterChildren(clusterId, callback) {\n this.actor.send(\"geojson.getClusterChildren\", {\n clusterId,\n source: this.id\n }, callback);\n return this;\n };\n GeoJSONSource2.prototype.getClusterLeaves = function getClusterLeaves(clusterId, limit, offset, callback) {\n this.actor.send(\"geojson.getClusterLeaves\", {\n source: this.id,\n clusterId,\n limit,\n offset\n }, callback);\n return this;\n };\n GeoJSONSource2.prototype._updateWorkerData = function _updateWorkerData(callback) {\n var this$1 = this;\n this._loaded = false;\n var options = performance2.extend({}, this.workerOptions);\n var data = this._data;\n if (typeof data === \"string\") {\n options.request = this.map._requestManager.transformRequest(performance2.browser.resolveURL(data), performance2.ResourceType.Source);\n options.request.collectResourceTiming = this._collectResourceTiming;\n } else {\n options.data = JSON.stringify(data);\n }\n this.actor.send(this.type + \".loadData\", options, function(err, result) {\n if (this$1._removed || result && result.abandoned) {\n return;\n }\n this$1._loaded = true;\n if (result && result.resourceTiming && result.resourceTiming[this$1.id]) {\n this$1._resourceTiming = result.resourceTiming[this$1.id].slice(0);\n }\n this$1.actor.send(this$1.type + \".coalesce\", { source: options.source }, null);\n callback(err);\n });\n };\n GeoJSONSource2.prototype.loaded = function loaded() {\n return this._loaded;\n };\n GeoJSONSource2.prototype.loadTile = function loadTile(tile, callback) {\n var this$1 = this;\n var message = !tile.actor ? \"loadTile\" : \"reloadTile\";\n tile.actor = this.actor;\n var params = {\n type: this.type,\n uid: tile.uid,\n tileID: tile.tileID,\n zoom: tile.tileID.overscaledZ,\n maxZoom: this.maxzoom,\n tileSize: this.tileSize,\n source: this.id,\n pixelRatio: performance2.browser.devicePixelRatio,\n showCollisionBoxes: this.map.showCollisionBoxes,\n promoteId: this.promoteId\n };\n tile.request = this.actor.send(message, params, function(err, data) {\n delete tile.request;\n tile.unloadVectorData();\n if (tile.aborted) {\n return callback(null);\n }\n if (err) {\n return callback(err);\n }\n tile.loadVectorData(data, this$1.map.painter, message === \"reloadTile\");\n return callback(null);\n });\n };\n GeoJSONSource2.prototype.abortTile = function abortTile(tile) {\n if (tile.request) {\n tile.request.cancel();\n delete tile.request;\n }\n tile.aborted = true;\n };\n GeoJSONSource2.prototype.unloadTile = function unloadTile(tile) {\n tile.unloadVectorData();\n this.actor.send(\"removeTile\", {\n uid: tile.uid,\n type: this.type,\n source: this.id\n });\n };\n GeoJSONSource2.prototype.onRemove = function onRemove() {\n this._removed = true;\n this.actor.send(\"removeSource\", {\n type: this.type,\n source: this.id\n });\n };\n GeoJSONSource2.prototype.serialize = function serialize() {\n return performance2.extend({}, this._options, {\n type: this.type,\n data: this._data\n });\n };\n GeoJSONSource2.prototype.hasTransition = function hasTransition() {\n return false;\n };\n return GeoJSONSource2;\n }(performance2.Evented);\n var rasterBoundsAttributes = performance2.createLayout([\n {\n name: \"a_pos\",\n type: \"Int16\",\n components: 2\n },\n {\n name: \"a_texture_pos\",\n type: \"Int16\",\n components: 2\n }\n ]);\n var ImageSource = function(Evented) {\n function ImageSource2(id, options, dispatcher, eventedParent) {\n Evented.call(this);\n this.id = id;\n this.dispatcher = dispatcher;\n this.coordinates = options.coordinates;\n this.type = \"image\";\n this.minzoom = 0;\n this.maxzoom = 22;\n this.tileSize = 512;\n this.tiles = {};\n this._loaded = false;\n this.setEventedParent(eventedParent);\n this.options = options;\n }\n if (Evented)\n ImageSource2.__proto__ = Evented;\n ImageSource2.prototype = Object.create(Evented && Evented.prototype);\n ImageSource2.prototype.constructor = ImageSource2;\n ImageSource2.prototype.load = function load(newCoordinates, successCallback) {\n var this$1 = this;\n this._loaded = false;\n this.fire(new performance2.Event(\"dataloading\", { dataType: \"source\" }));\n this.url = this.options.url;\n performance2.getImage(this.map._requestManager.transformRequest(this.url, performance2.ResourceType.Image), function(err, image) {\n this$1._loaded = true;\n if (err) {\n this$1.fire(new performance2.ErrorEvent(err));\n } else if (image) {\n this$1.image = image;\n if (newCoordinates) {\n this$1.coordinates = newCoordinates;\n }\n if (successCallback) {\n successCallback();\n }\n this$1._finishLoading();\n }\n });\n };\n ImageSource2.prototype.loaded = function loaded() {\n return this._loaded;\n };\n ImageSource2.prototype.updateImage = function updateImage(options) {\n var this$1 = this;\n if (!this.image || !options.url) {\n return this;\n }\n this.options.url = options.url;\n this.load(options.coordinates, function() {\n this$1.texture = null;\n });\n return this;\n };\n ImageSource2.prototype._finishLoading = function _finishLoading() {\n if (this.map) {\n this.setCoordinates(this.coordinates);\n this.fire(new performance2.Event(\"data\", {\n dataType: \"source\",\n sourceDataType: \"metadata\"\n }));\n }\n };\n ImageSource2.prototype.onAdd = function onAdd(map) {\n this.map = map;\n this.load();\n };\n ImageSource2.prototype.setCoordinates = function setCoordinates(coordinates) {\n var this$1 = this;\n this.coordinates = coordinates;\n var cornerCoords = coordinates.map(performance2.MercatorCoordinate.fromLngLat);\n this.tileID = getCoordinatesCenterTileID(cornerCoords);\n this.minzoom = this.maxzoom = this.tileID.z;\n var tileCoords = cornerCoords.map(function(coord) {\n return this$1.tileID.getTilePoint(coord)._round();\n });\n this._boundsArray = new performance2.StructArrayLayout4i8();\n this._boundsArray.emplaceBack(tileCoords[0].x, tileCoords[0].y, 0, 0);\n this._boundsArray.emplaceBack(tileCoords[1].x, tileCoords[1].y, performance2.EXTENT, 0);\n this._boundsArray.emplaceBack(tileCoords[3].x, tileCoords[3].y, 0, performance2.EXTENT);\n this._boundsArray.emplaceBack(tileCoords[2].x, tileCoords[2].y, performance2.EXTENT, performance2.EXTENT);\n if (this.boundsBuffer) {\n this.boundsBuffer.destroy();\n delete this.boundsBuffer;\n }\n this.fire(new performance2.Event(\"data\", {\n dataType: \"source\",\n sourceDataType: \"content\"\n }));\n return this;\n };\n ImageSource2.prototype.prepare = function prepare() {\n if (Object.keys(this.tiles).length === 0 || !this.image) {\n return;\n }\n var context = this.map.painter.context;\n var gl2 = context.gl;\n if (!this.boundsBuffer) {\n this.boundsBuffer = context.createVertexBuffer(this._boundsArray, rasterBoundsAttributes.members);\n }\n if (!this.boundsSegments) {\n this.boundsSegments = performance2.SegmentVector.simpleSegment(0, 0, 4, 2);\n }\n if (!this.texture) {\n this.texture = new performance2.Texture(context, this.image, gl2.RGBA);\n this.texture.bind(gl2.LINEAR, gl2.CLAMP_TO_EDGE);\n }\n for (var w in this.tiles) {\n var tile = this.tiles[w];\n if (tile.state !== \"loaded\") {\n tile.state = \"loaded\";\n tile.texture = this.texture;\n }\n }\n };\n ImageSource2.prototype.loadTile = function loadTile(tile, callback) {\n if (this.tileID && this.tileID.equals(tile.tileID.canonical)) {\n this.tiles[String(tile.tileID.wrap)] = tile;\n tile.buckets = {};\n callback(null);\n } else {\n tile.state = \"errored\";\n callback(null);\n }\n };\n ImageSource2.prototype.serialize = function serialize() {\n return {\n type: \"image\",\n url: this.options.url,\n coordinates: this.coordinates\n };\n };\n ImageSource2.prototype.hasTransition = function hasTransition() {\n return false;\n };\n return ImageSource2;\n }(performance2.Evented);\n function getCoordinatesCenterTileID(coords) {\n var minX = Infinity;\n var minY = Infinity;\n var maxX = -Infinity;\n var maxY = -Infinity;\n for (var i = 0, list = coords; i < list.length; i += 1) {\n var coord = list[i];\n minX = Math.min(minX, coord.x);\n minY = Math.min(minY, coord.y);\n maxX = Math.max(maxX, coord.x);\n maxY = Math.max(maxY, coord.y);\n }\n var dx = maxX - minX;\n var dy = maxY - minY;\n var dMax = Math.max(dx, dy);\n var zoom = Math.max(0, Math.floor(-Math.log(dMax) / Math.LN2));\n var tilesAtZoom = Math.pow(2, zoom);\n return new performance2.CanonicalTileID(zoom, Math.floor((minX + maxX) / 2 * tilesAtZoom), Math.floor((minY + maxY) / 2 * tilesAtZoom));\n }\n var VideoSource = function(ImageSource2) {\n function VideoSource2(id, options, dispatcher, eventedParent) {\n ImageSource2.call(this, id, options, dispatcher, eventedParent);\n this.roundZoom = true;\n this.type = \"video\";\n this.options = options;\n }\n if (ImageSource2)\n VideoSource2.__proto__ = ImageSource2;\n VideoSource2.prototype = Object.create(ImageSource2 && ImageSource2.prototype);\n VideoSource2.prototype.constructor = VideoSource2;\n VideoSource2.prototype.load = function load() {\n var this$1 = this;\n this._loaded = false;\n var options = this.options;\n this.urls = [];\n for (var i = 0, list = options.urls; i < list.length; i += 1) {\n var url = list[i];\n this.urls.push(this.map._requestManager.transformRequest(url, performance2.ResourceType.Source).url);\n }\n performance2.getVideo(this.urls, function(err, video) {\n this$1._loaded = true;\n if (err) {\n this$1.fire(new performance2.ErrorEvent(err));\n } else if (video) {\n this$1.video = video;\n this$1.video.loop = true;\n this$1.video.addEventListener(\"playing\", function() {\n this$1.map.triggerRepaint();\n });\n if (this$1.map) {\n this$1.video.play();\n }\n this$1._finishLoading();\n }\n });\n };\n VideoSource2.prototype.pause = function pause() {\n if (this.video) {\n this.video.pause();\n }\n };\n VideoSource2.prototype.play = function play() {\n if (this.video) {\n this.video.play();\n }\n };\n VideoSource2.prototype.seek = function seek(seconds) {\n if (this.video) {\n var seekableRange = this.video.seekable;\n if (seconds < seekableRange.start(0) || seconds > seekableRange.end(0)) {\n this.fire(new performance2.ErrorEvent(new performance2.ValidationError(\"sources.\" + this.id, null, \"Playback for this video can be set only between the \" + seekableRange.start(0) + \" and \" + seekableRange.end(0) + \"-second mark.\")));\n } else {\n this.video.currentTime = seconds;\n }\n }\n };\n VideoSource2.prototype.getVideo = function getVideo() {\n return this.video;\n };\n VideoSource2.prototype.onAdd = function onAdd(map) {\n if (this.map) {\n return;\n }\n this.map = map;\n this.load();\n if (this.video) {\n this.video.play();\n this.setCoordinates(this.coordinates);\n }\n };\n VideoSource2.prototype.prepare = function prepare() {\n if (Object.keys(this.tiles).length === 0 || this.video.readyState < 2) {\n return;\n }\n var context = this.map.painter.context;\n var gl2 = context.gl;\n if (!this.boundsBuffer) {\n this.boundsBuffer = context.createVertexBuffer(this._boundsArray, rasterBoundsAttributes.members);\n }\n if (!this.boundsSegments) {\n this.boundsSegments = performance2.SegmentVector.simpleSegment(0, 0, 4, 2);\n }\n if (!this.texture) {\n this.texture = new performance2.Texture(context, this.video, gl2.RGBA);\n this.texture.bind(gl2.LINEAR, gl2.CLAMP_TO_EDGE);\n } else if (!this.video.paused) {\n this.texture.bind(gl2.LINEAR, gl2.CLAMP_TO_EDGE);\n gl2.texSubImage2D(gl2.TEXTURE_2D, 0, 0, 0, gl2.RGBA, gl2.UNSIGNED_BYTE, this.video);\n }\n for (var w in this.tiles) {\n var tile = this.tiles[w];\n if (tile.state !== \"loaded\") {\n tile.state = \"loaded\";\n tile.texture = this.texture;\n }\n }\n };\n VideoSource2.prototype.serialize = function serialize() {\n return {\n type: \"video\",\n urls: this.urls,\n coordinates: this.coordinates\n };\n };\n VideoSource2.prototype.hasTransition = function hasTransition() {\n return this.video && !this.video.paused;\n };\n return VideoSource2;\n }(ImageSource);\n var CanvasSource = function(ImageSource2) {\n function CanvasSource2(id, options, dispatcher, eventedParent) {\n ImageSource2.call(this, id, options, dispatcher, eventedParent);\n if (!options.coordinates) {\n this.fire(new performance2.ErrorEvent(new performance2.ValidationError(\"sources.\" + id, null, 'missing required property \"coordinates\"')));\n } else if (!Array.isArray(options.coordinates) || options.coordinates.length !== 4 || options.coordinates.some(function(c) {\n return !Array.isArray(c) || c.length !== 2 || c.some(function(l) {\n return typeof l !== \"number\";\n });\n })) {\n this.fire(new performance2.ErrorEvent(new performance2.ValidationError(\"sources.\" + id, null, '\"coordinates\" property must be an array of 4 longitude/latitude array pairs')));\n }\n if (options.animate && typeof options.animate !== \"boolean\") {\n this.fire(new performance2.ErrorEvent(new performance2.ValidationError(\"sources.\" + id, null, 'optional \"animate\" property must be a boolean value')));\n }\n if (!options.canvas) {\n this.fire(new performance2.ErrorEvent(new performance2.ValidationError(\"sources.\" + id, null, 'missing required property \"canvas\"')));\n } else if (typeof options.canvas !== \"string\" && !(options.canvas instanceof performance2.window.HTMLCanvasElement)) {\n this.fire(new performance2.ErrorEvent(new performance2.ValidationError(\"sources.\" + id, null, '\"canvas\" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance')));\n }\n this.options = options;\n this.animate = options.animate !== void 0 ? options.animate : true;\n }\n if (ImageSource2)\n CanvasSource2.__proto__ = ImageSource2;\n CanvasSource2.prototype = Object.create(ImageSource2 && ImageSource2.prototype);\n CanvasSource2.prototype.constructor = CanvasSource2;\n CanvasSource2.prototype.load = function load() {\n this._loaded = true;\n if (!this.canvas) {\n this.canvas = this.options.canvas instanceof performance2.window.HTMLCanvasElement ? this.options.canvas : performance2.window.document.getElementById(this.options.canvas);\n }\n this.width = this.canvas.width;\n this.height = this.canvas.height;\n if (this._hasInvalidDimensions()) {\n this.fire(new performance2.ErrorEvent(new Error(\"Canvas dimensions cannot be less than or equal to zero.\")));\n return;\n }\n this.play = function() {\n this._playing = true;\n this.map.triggerRepaint();\n };\n this.pause = function() {\n if (this._playing) {\n this.prepare();\n this._playing = false;\n }\n };\n this._finishLoading();\n };\n CanvasSource2.prototype.getCanvas = function getCanvas() {\n return this.canvas;\n };\n CanvasSource2.prototype.onAdd = function onAdd(map) {\n this.map = map;\n this.load();\n if (this.canvas) {\n if (this.animate) {\n this.play();\n }\n }\n };\n CanvasSource2.prototype.onRemove = function onRemove() {\n this.pause();\n };\n CanvasSource2.prototype.prepare = function prepare() {\n var resize = false;\n if (this.canvas.width !== this.width) {\n this.width = this.canvas.width;\n resize = true;\n }\n if (this.canvas.height !== this.height) {\n this.height = this.canvas.height;\n resize = true;\n }\n if (this._hasInvalidDimensions()) {\n return;\n }\n if (Object.keys(this.tiles).length === 0) {\n return;\n }\n var context = this.map.painter.context;\n var gl2 = context.gl;\n if (!this.boundsBuffer) {\n this.boundsBuffer = context.createVertexBuffer(this._boundsArray, rasterBoundsAttributes.members);\n }\n if (!this.boundsSegments) {\n this.boundsSegments = performance2.SegmentVector.simpleSegment(0, 0, 4, 2);\n }\n if (!this.texture) {\n this.texture = new performance2.Texture(context, this.canvas, gl2.RGBA, { premultiply: true });\n } else if (resize || this._playing) {\n this.texture.update(this.canvas, { premultiply: true });\n }\n for (var w in this.tiles) {\n var tile = this.tiles[w];\n if (tile.state !== \"loaded\") {\n tile.state = \"loaded\";\n tile.texture = this.texture;\n }\n }\n };\n CanvasSource2.prototype.serialize = function serialize() {\n return {\n type: \"canvas\",\n coordinates: this.coordinates\n };\n };\n CanvasSource2.prototype.hasTransition = function hasTransition() {\n return this._playing;\n };\n CanvasSource2.prototype._hasInvalidDimensions = function _hasInvalidDimensions() {\n for (var i = 0, list = [\n this.canvas.width,\n this.canvas.height\n ]; i < list.length; i += 1) {\n var x = list[i];\n if (isNaN(x) || x <= 0) {\n return true;\n }\n }\n return false;\n };\n return CanvasSource2;\n }(ImageSource);\n var sourceTypes = {\n vector: VectorTileSource,\n raster: RasterTileSource,\n \"raster-dem\": RasterDEMTileSource,\n geojson: GeoJSONSource,\n video: VideoSource,\n image: ImageSource,\n canvas: CanvasSource\n };\n var create = function(id, specification, dispatcher, eventedParent) {\n var source = new sourceTypes[specification.type](id, specification, dispatcher, eventedParent);\n if (source.id !== id) {\n throw new Error(\"Expected Source id to be \" + id + \" instead of \" + source.id);\n }\n performance2.bindAll([\n \"load\",\n \"abort\",\n \"unload\",\n \"serialize\",\n \"prepare\"\n ], source);\n return source;\n };\n var getType = function(name2) {\n return sourceTypes[name2];\n };\n var setType = function(name2, type) {\n sourceTypes[name2] = type;\n };\n function getPixelPosMatrix(transform, tileID) {\n var t = performance2.identity([]);\n performance2.translate(t, t, [\n 1,\n 1,\n 0\n ]);\n performance2.scale(t, t, [\n transform.width * 0.5,\n transform.height * 0.5,\n 1\n ]);\n return performance2.multiply(t, t, transform.calculatePosMatrix(tileID.toUnwrapped()));\n }\n function queryIncludes3DLayer(layers, styleLayers, sourceID) {\n if (layers) {\n for (var i = 0, list = layers; i < list.length; i += 1) {\n var layerID = list[i];\n var layer = styleLayers[layerID];\n if (layer && layer.source === sourceID && layer.type === \"fill-extrusion\") {\n return true;\n }\n }\n } else {\n for (var key in styleLayers) {\n var layer$1 = styleLayers[key];\n if (layer$1.source === sourceID && layer$1.type === \"fill-extrusion\") {\n return true;\n }\n }\n }\n return false;\n }\n function queryRenderedFeatures(sourceCache, styleLayers, serializedLayers, queryGeometry, params, transform) {\n var has3DLayer = queryIncludes3DLayer(params && params.layers, styleLayers, sourceCache.id);\n var maxPitchScaleFactor = transform.maxPitchScaleFactor();\n var tilesIn = sourceCache.tilesIn(queryGeometry, maxPitchScaleFactor, has3DLayer);\n tilesIn.sort(sortTilesIn);\n var renderedFeatureLayers = [];\n for (var i = 0, list = tilesIn; i < list.length; i += 1) {\n var tileIn = list[i];\n renderedFeatureLayers.push({\n wrappedTileID: tileIn.tileID.wrapped().key,\n queryResults: tileIn.tile.queryRenderedFeatures(styleLayers, serializedLayers, sourceCache._state, tileIn.queryGeometry, tileIn.cameraQueryGeometry, tileIn.scale, params, transform, maxPitchScaleFactor, getPixelPosMatrix(sourceCache.transform, tileIn.tileID))\n });\n }\n var result = mergeRenderedFeatureLayers(renderedFeatureLayers);\n for (var layerID in result) {\n result[layerID].forEach(function(featureWrapper) {\n var feature = featureWrapper.feature;\n var state = sourceCache.getFeatureState(feature.layer[\"source-layer\"], feature.id);\n feature.source = feature.layer.source;\n if (feature.layer[\"source-layer\"]) {\n feature.sourceLayer = feature.layer[\"source-layer\"];\n }\n feature.state = state;\n });\n }\n return result;\n }\n function queryRenderedSymbols(styleLayers, serializedLayers, sourceCaches, queryGeometry, params, collisionIndex, retainedQueryData) {\n var result = {};\n var renderedSymbols = collisionIndex.queryRenderedSymbols(queryGeometry);\n var bucketQueryData = [];\n for (var i = 0, list = Object.keys(renderedSymbols).map(Number); i < list.length; i += 1) {\n var bucketInstanceId = list[i];\n bucketQueryData.push(retainedQueryData[bucketInstanceId]);\n }\n bucketQueryData.sort(sortTilesIn);\n var loop = function() {\n var queryData = list$2[i$2];\n var bucketSymbols = queryData.featureIndex.lookupSymbolFeatures(renderedSymbols[queryData.bucketInstanceId], serializedLayers, queryData.bucketIndex, queryData.sourceLayerIndex, params.filter, params.layers, params.availableImages, styleLayers);\n for (var layerID in bucketSymbols) {\n var resultFeatures = result[layerID] = result[layerID] || [];\n var layerSymbols = bucketSymbols[layerID];\n layerSymbols.sort(function(a, b) {\n var featureSortOrder = queryData.featureSortOrder;\n if (featureSortOrder) {\n var sortedA = featureSortOrder.indexOf(a.featureIndex);\n var sortedB = featureSortOrder.indexOf(b.featureIndex);\n return sortedB - sortedA;\n } else {\n return b.featureIndex - a.featureIndex;\n }\n });\n for (var i$1 = 0, list$1 = layerSymbols; i$1 < list$1.length; i$1 += 1) {\n var symbolFeature = list$1[i$1];\n resultFeatures.push(symbolFeature);\n }\n }\n };\n for (var i$2 = 0, list$2 = bucketQueryData; i$2 < list$2.length; i$2 += 1)\n loop();\n var loop$1 = function(layerName2) {\n result[layerName2].forEach(function(featureWrapper) {\n var feature = featureWrapper.feature;\n var layer = styleLayers[layerName2];\n var sourceCache = sourceCaches[layer.source];\n var state = sourceCache.getFeatureState(feature.layer[\"source-layer\"], feature.id);\n feature.source = feature.layer.source;\n if (feature.layer[\"source-layer\"]) {\n feature.sourceLayer = feature.layer[\"source-layer\"];\n }\n feature.state = state;\n });\n };\n for (var layerName in result)\n loop$1(layerName);\n return result;\n }\n function querySourceFeatures(sourceCache, params) {\n var tiles = sourceCache.getRenderableIds().map(function(id) {\n return sourceCache.getTileByID(id);\n });\n var result = [];\n var dataTiles = {};\n for (var i = 0; i < tiles.length; i++) {\n var tile = tiles[i];\n var dataID = tile.tileID.canonical.key;\n if (!dataTiles[dataID]) {\n dataTiles[dataID] = true;\n tile.querySourceFeatures(result, params);\n }\n }\n return result;\n }\n function sortTilesIn(a, b) {\n var idA = a.tileID;\n var idB = b.tileID;\n return idA.overscaledZ - idB.overscaledZ || idA.canonical.y - idB.canonical.y || idA.wrap - idB.wrap || idA.canonical.x - idB.canonical.x;\n }\n function mergeRenderedFeatureLayers(tiles) {\n var result = {};\n var wrappedIDLayerMap = {};\n for (var i$1 = 0, list$1 = tiles; i$1 < list$1.length; i$1 += 1) {\n var tile = list$1[i$1];\n var queryResults = tile.queryResults;\n var wrappedID = tile.wrappedTileID;\n var wrappedIDLayers = wrappedIDLayerMap[wrappedID] = wrappedIDLayerMap[wrappedID] || {};\n for (var layerID in queryResults) {\n var tileFeatures = queryResults[layerID];\n var wrappedIDFeatures = wrappedIDLayers[layerID] = wrappedIDLayers[layerID] || {};\n var resultFeatures = result[layerID] = result[layerID] || [];\n for (var i = 0, list = tileFeatures; i < list.length; i += 1) {\n var tileFeature = list[i];\n if (!wrappedIDFeatures[tileFeature.featureIndex]) {\n wrappedIDFeatures[tileFeature.featureIndex] = true;\n resultFeatures.push(tileFeature);\n }\n }\n }\n }\n return result;\n }\n var TileCache = function TileCache2(max, onRemove) {\n this.max = max;\n this.onRemove = onRemove;\n this.reset();\n };\n TileCache.prototype.reset = function reset() {\n for (var key in this.data) {\n for (var i = 0, list = this.data[key]; i < list.length; i += 1) {\n var removedData = list[i];\n if (removedData.timeout) {\n clearTimeout(removedData.timeout);\n }\n this.onRemove(removedData.value);\n }\n }\n this.data = {};\n this.order = [];\n return this;\n };\n TileCache.prototype.add = function add(tileID, data, expiryTimeout) {\n var this$1 = this;\n var key = tileID.wrapped().key;\n if (this.data[key] === void 0) {\n this.data[key] = [];\n }\n var dataWrapper = {\n value: data,\n timeout: void 0\n };\n if (expiryTimeout !== void 0) {\n dataWrapper.timeout = setTimeout(function() {\n this$1.remove(tileID, dataWrapper);\n }, expiryTimeout);\n }\n this.data[key].push(dataWrapper);\n this.order.push(key);\n if (this.order.length > this.max) {\n var removedData = this._getAndRemoveByKey(this.order[0]);\n if (removedData) {\n this.onRemove(removedData);\n }\n }\n return this;\n };\n TileCache.prototype.has = function has(tileID) {\n return tileID.wrapped().key in this.data;\n };\n TileCache.prototype.getAndRemove = function getAndRemove(tileID) {\n if (!this.has(tileID)) {\n return null;\n }\n return this._getAndRemoveByKey(tileID.wrapped().key);\n };\n TileCache.prototype._getAndRemoveByKey = function _getAndRemoveByKey(key) {\n var data = this.data[key].shift();\n if (data.timeout) {\n clearTimeout(data.timeout);\n }\n if (this.data[key].length === 0) {\n delete this.data[key];\n }\n this.order.splice(this.order.indexOf(key), 1);\n return data.value;\n };\n TileCache.prototype.getByKey = function getByKey(key) {\n var data = this.data[key];\n return data ? data[0].value : null;\n };\n TileCache.prototype.get = function get(tileID) {\n if (!this.has(tileID)) {\n return null;\n }\n var data = this.data[tileID.wrapped().key][0];\n return data.value;\n };\n TileCache.prototype.remove = function remove(tileID, value) {\n if (!this.has(tileID)) {\n return this;\n }\n var key = tileID.wrapped().key;\n var dataIndex = value === void 0 ? 0 : this.data[key].indexOf(value);\n var data = this.data[key][dataIndex];\n this.data[key].splice(dataIndex, 1);\n if (data.timeout) {\n clearTimeout(data.timeout);\n }\n if (this.data[key].length === 0) {\n delete this.data[key];\n }\n this.onRemove(data.value);\n this.order.splice(this.order.indexOf(key), 1);\n return this;\n };\n TileCache.prototype.setMaxSize = function setMaxSize(max) {\n this.max = max;\n while (this.order.length > this.max) {\n var removedData = this._getAndRemoveByKey(this.order[0]);\n if (removedData) {\n this.onRemove(removedData);\n }\n }\n return this;\n };\n TileCache.prototype.filter = function filter(filterFn) {\n var removed = [];\n for (var key in this.data) {\n for (var i = 0, list = this.data[key]; i < list.length; i += 1) {\n var entry = list[i];\n if (!filterFn(entry.value)) {\n removed.push(entry);\n }\n }\n }\n for (var i$1 = 0, list$1 = removed; i$1 < list$1.length; i$1 += 1) {\n var r = list$1[i$1];\n this.remove(r.value.tileID, r);\n }\n };\n var IndexBuffer = function IndexBuffer2(context, array, dynamicDraw) {\n this.context = context;\n var gl2 = context.gl;\n this.buffer = gl2.createBuffer();\n this.dynamicDraw = Boolean(dynamicDraw);\n this.context.unbindVAO();\n context.bindElementBuffer.set(this.buffer);\n gl2.bufferData(gl2.ELEMENT_ARRAY_BUFFER, array.arrayBuffer, this.dynamicDraw ? gl2.DYNAMIC_DRAW : gl2.STATIC_DRAW);\n if (!this.dynamicDraw) {\n delete array.arrayBuffer;\n }\n };\n IndexBuffer.prototype.bind = function bind() {\n this.context.bindElementBuffer.set(this.buffer);\n };\n IndexBuffer.prototype.updateData = function updateData(array) {\n var gl2 = this.context.gl;\n this.context.unbindVAO();\n this.bind();\n gl2.bufferSubData(gl2.ELEMENT_ARRAY_BUFFER, 0, array.arrayBuffer);\n };\n IndexBuffer.prototype.destroy = function destroy() {\n var gl2 = this.context.gl;\n if (this.buffer) {\n gl2.deleteBuffer(this.buffer);\n delete this.buffer;\n }\n };\n var AttributeType = {\n Int8: \"BYTE\",\n Uint8: \"UNSIGNED_BYTE\",\n Int16: \"SHORT\",\n Uint16: \"UNSIGNED_SHORT\",\n Int32: \"INT\",\n Uint32: \"UNSIGNED_INT\",\n Float32: \"FLOAT\"\n };\n var VertexBuffer = function VertexBuffer2(context, array, attributes, dynamicDraw) {\n this.length = array.length;\n this.attributes = attributes;\n this.itemSize = array.bytesPerElement;\n this.dynamicDraw = dynamicDraw;\n this.context = context;\n var gl2 = context.gl;\n this.buffer = gl2.createBuffer();\n context.bindVertexBuffer.set(this.buffer);\n gl2.bufferData(gl2.ARRAY_BUFFER, array.arrayBuffer, this.dynamicDraw ? gl2.DYNAMIC_DRAW : gl2.STATIC_DRAW);\n if (!this.dynamicDraw) {\n delete array.arrayBuffer;\n }\n };\n VertexBuffer.prototype.bind = function bind() {\n this.context.bindVertexBuffer.set(this.buffer);\n };\n VertexBuffer.prototype.updateData = function updateData(array) {\n var gl2 = this.context.gl;\n this.bind();\n gl2.bufferSubData(gl2.ARRAY_BUFFER, 0, array.arrayBuffer);\n };\n VertexBuffer.prototype.enableAttributes = function enableAttributes(gl2, program) {\n for (var j = 0; j < this.attributes.length; j++) {\n var member = this.attributes[j];\n var attribIndex = program.attributes[member.name];\n if (attribIndex !== void 0) {\n gl2.enableVertexAttribArray(attribIndex);\n }\n }\n };\n VertexBuffer.prototype.setVertexAttribPointers = function setVertexAttribPointers(gl2, program, vertexOffset) {\n for (var j = 0; j < this.attributes.length; j++) {\n var member = this.attributes[j];\n var attribIndex = program.attributes[member.name];\n if (attribIndex !== void 0) {\n gl2.vertexAttribPointer(attribIndex, member.components, gl2[AttributeType[member.type]], false, this.itemSize, member.offset + this.itemSize * (vertexOffset || 0));\n }\n }\n };\n VertexBuffer.prototype.destroy = function destroy() {\n var gl2 = this.context.gl;\n if (this.buffer) {\n gl2.deleteBuffer(this.buffer);\n delete this.buffer;\n }\n };\n var BaseValue = function BaseValue2(context) {\n this.gl = context.gl;\n this.default = this.getDefault();\n this.current = this.default;\n this.dirty = false;\n };\n BaseValue.prototype.get = function get() {\n return this.current;\n };\n BaseValue.prototype.set = function set(value) {\n };\n BaseValue.prototype.getDefault = function getDefault() {\n return this.default;\n };\n BaseValue.prototype.setDefault = function setDefault() {\n this.set(this.default);\n };\n var ClearColor = function(BaseValue2) {\n function ClearColor2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n ClearColor2.__proto__ = BaseValue2;\n ClearColor2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n ClearColor2.prototype.constructor = ClearColor2;\n ClearColor2.prototype.getDefault = function getDefault() {\n return performance2.Color.transparent;\n };\n ClearColor2.prototype.set = function set(v) {\n var c = this.current;\n if (v.r === c.r && v.g === c.g && v.b === c.b && v.a === c.a && !this.dirty) {\n return;\n }\n this.gl.clearColor(v.r, v.g, v.b, v.a);\n this.current = v;\n this.dirty = false;\n };\n return ClearColor2;\n }(BaseValue);\n var ClearDepth = function(BaseValue2) {\n function ClearDepth2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n ClearDepth2.__proto__ = BaseValue2;\n ClearDepth2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n ClearDepth2.prototype.constructor = ClearDepth2;\n ClearDepth2.prototype.getDefault = function getDefault() {\n return 1;\n };\n ClearDepth2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n this.gl.clearDepth(v);\n this.current = v;\n this.dirty = false;\n };\n return ClearDepth2;\n }(BaseValue);\n var ClearStencil = function(BaseValue2) {\n function ClearStencil2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n ClearStencil2.__proto__ = BaseValue2;\n ClearStencil2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n ClearStencil2.prototype.constructor = ClearStencil2;\n ClearStencil2.prototype.getDefault = function getDefault() {\n return 0;\n };\n ClearStencil2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n this.gl.clearStencil(v);\n this.current = v;\n this.dirty = false;\n };\n return ClearStencil2;\n }(BaseValue);\n var ColorMask = function(BaseValue2) {\n function ColorMask2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n ColorMask2.__proto__ = BaseValue2;\n ColorMask2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n ColorMask2.prototype.constructor = ColorMask2;\n ColorMask2.prototype.getDefault = function getDefault() {\n return [\n true,\n true,\n true,\n true\n ];\n };\n ColorMask2.prototype.set = function set(v) {\n var c = this.current;\n if (v[0] === c[0] && v[1] === c[1] && v[2] === c[2] && v[3] === c[3] && !this.dirty) {\n return;\n }\n this.gl.colorMask(v[0], v[1], v[2], v[3]);\n this.current = v;\n this.dirty = false;\n };\n return ColorMask2;\n }(BaseValue);\n var DepthMask = function(BaseValue2) {\n function DepthMask2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n DepthMask2.__proto__ = BaseValue2;\n DepthMask2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n DepthMask2.prototype.constructor = DepthMask2;\n DepthMask2.prototype.getDefault = function getDefault() {\n return true;\n };\n DepthMask2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n this.gl.depthMask(v);\n this.current = v;\n this.dirty = false;\n };\n return DepthMask2;\n }(BaseValue);\n var StencilMask = function(BaseValue2) {\n function StencilMask2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n StencilMask2.__proto__ = BaseValue2;\n StencilMask2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n StencilMask2.prototype.constructor = StencilMask2;\n StencilMask2.prototype.getDefault = function getDefault() {\n return 255;\n };\n StencilMask2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n this.gl.stencilMask(v);\n this.current = v;\n this.dirty = false;\n };\n return StencilMask2;\n }(BaseValue);\n var StencilFunc = function(BaseValue2) {\n function StencilFunc2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n StencilFunc2.__proto__ = BaseValue2;\n StencilFunc2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n StencilFunc2.prototype.constructor = StencilFunc2;\n StencilFunc2.prototype.getDefault = function getDefault() {\n return {\n func: this.gl.ALWAYS,\n ref: 0,\n mask: 255\n };\n };\n StencilFunc2.prototype.set = function set(v) {\n var c = this.current;\n if (v.func === c.func && v.ref === c.ref && v.mask === c.mask && !this.dirty) {\n return;\n }\n this.gl.stencilFunc(v.func, v.ref, v.mask);\n this.current = v;\n this.dirty = false;\n };\n return StencilFunc2;\n }(BaseValue);\n var StencilOp = function(BaseValue2) {\n function StencilOp2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n StencilOp2.__proto__ = BaseValue2;\n StencilOp2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n StencilOp2.prototype.constructor = StencilOp2;\n StencilOp2.prototype.getDefault = function getDefault() {\n var gl2 = this.gl;\n return [\n gl2.KEEP,\n gl2.KEEP,\n gl2.KEEP\n ];\n };\n StencilOp2.prototype.set = function set(v) {\n var c = this.current;\n if (v[0] === c[0] && v[1] === c[1] && v[2] === c[2] && !this.dirty) {\n return;\n }\n this.gl.stencilOp(v[0], v[1], v[2]);\n this.current = v;\n this.dirty = false;\n };\n return StencilOp2;\n }(BaseValue);\n var StencilTest = function(BaseValue2) {\n function StencilTest2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n StencilTest2.__proto__ = BaseValue2;\n StencilTest2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n StencilTest2.prototype.constructor = StencilTest2;\n StencilTest2.prototype.getDefault = function getDefault() {\n return false;\n };\n StencilTest2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n var gl2 = this.gl;\n if (v) {\n gl2.enable(gl2.STENCIL_TEST);\n } else {\n gl2.disable(gl2.STENCIL_TEST);\n }\n this.current = v;\n this.dirty = false;\n };\n return StencilTest2;\n }(BaseValue);\n var DepthRange = function(BaseValue2) {\n function DepthRange2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n DepthRange2.__proto__ = BaseValue2;\n DepthRange2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n DepthRange2.prototype.constructor = DepthRange2;\n DepthRange2.prototype.getDefault = function getDefault() {\n return [\n 0,\n 1\n ];\n };\n DepthRange2.prototype.set = function set(v) {\n var c = this.current;\n if (v[0] === c[0] && v[1] === c[1] && !this.dirty) {\n return;\n }\n this.gl.depthRange(v[0], v[1]);\n this.current = v;\n this.dirty = false;\n };\n return DepthRange2;\n }(BaseValue);\n var DepthTest = function(BaseValue2) {\n function DepthTest2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n DepthTest2.__proto__ = BaseValue2;\n DepthTest2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n DepthTest2.prototype.constructor = DepthTest2;\n DepthTest2.prototype.getDefault = function getDefault() {\n return false;\n };\n DepthTest2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n var gl2 = this.gl;\n if (v) {\n gl2.enable(gl2.DEPTH_TEST);\n } else {\n gl2.disable(gl2.DEPTH_TEST);\n }\n this.current = v;\n this.dirty = false;\n };\n return DepthTest2;\n }(BaseValue);\n var DepthFunc = function(BaseValue2) {\n function DepthFunc2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n DepthFunc2.__proto__ = BaseValue2;\n DepthFunc2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n DepthFunc2.prototype.constructor = DepthFunc2;\n DepthFunc2.prototype.getDefault = function getDefault() {\n return this.gl.LESS;\n };\n DepthFunc2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n this.gl.depthFunc(v);\n this.current = v;\n this.dirty = false;\n };\n return DepthFunc2;\n }(BaseValue);\n var Blend = function(BaseValue2) {\n function Blend2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n Blend2.__proto__ = BaseValue2;\n Blend2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n Blend2.prototype.constructor = Blend2;\n Blend2.prototype.getDefault = function getDefault() {\n return false;\n };\n Blend2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n var gl2 = this.gl;\n if (v) {\n gl2.enable(gl2.BLEND);\n } else {\n gl2.disable(gl2.BLEND);\n }\n this.current = v;\n this.dirty = false;\n };\n return Blend2;\n }(BaseValue);\n var BlendFunc = function(BaseValue2) {\n function BlendFunc2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n BlendFunc2.__proto__ = BaseValue2;\n BlendFunc2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n BlendFunc2.prototype.constructor = BlendFunc2;\n BlendFunc2.prototype.getDefault = function getDefault() {\n var gl2 = this.gl;\n return [\n gl2.ONE,\n gl2.ZERO\n ];\n };\n BlendFunc2.prototype.set = function set(v) {\n var c = this.current;\n if (v[0] === c[0] && v[1] === c[1] && !this.dirty) {\n return;\n }\n this.gl.blendFunc(v[0], v[1]);\n this.current = v;\n this.dirty = false;\n };\n return BlendFunc2;\n }(BaseValue);\n var BlendColor = function(BaseValue2) {\n function BlendColor2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n BlendColor2.__proto__ = BaseValue2;\n BlendColor2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n BlendColor2.prototype.constructor = BlendColor2;\n BlendColor2.prototype.getDefault = function getDefault() {\n return performance2.Color.transparent;\n };\n BlendColor2.prototype.set = function set(v) {\n var c = this.current;\n if (v.r === c.r && v.g === c.g && v.b === c.b && v.a === c.a && !this.dirty) {\n return;\n }\n this.gl.blendColor(v.r, v.g, v.b, v.a);\n this.current = v;\n this.dirty = false;\n };\n return BlendColor2;\n }(BaseValue);\n var BlendEquation = function(BaseValue2) {\n function BlendEquation2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n BlendEquation2.__proto__ = BaseValue2;\n BlendEquation2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n BlendEquation2.prototype.constructor = BlendEquation2;\n BlendEquation2.prototype.getDefault = function getDefault() {\n return this.gl.FUNC_ADD;\n };\n BlendEquation2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n this.gl.blendEquation(v);\n this.current = v;\n this.dirty = false;\n };\n return BlendEquation2;\n }(BaseValue);\n var CullFace = function(BaseValue2) {\n function CullFace2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n CullFace2.__proto__ = BaseValue2;\n CullFace2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n CullFace2.prototype.constructor = CullFace2;\n CullFace2.prototype.getDefault = function getDefault() {\n return false;\n };\n CullFace2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n var gl2 = this.gl;\n if (v) {\n gl2.enable(gl2.CULL_FACE);\n } else {\n gl2.disable(gl2.CULL_FACE);\n }\n this.current = v;\n this.dirty = false;\n };\n return CullFace2;\n }(BaseValue);\n var CullFaceSide = function(BaseValue2) {\n function CullFaceSide2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n CullFaceSide2.__proto__ = BaseValue2;\n CullFaceSide2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n CullFaceSide2.prototype.constructor = CullFaceSide2;\n CullFaceSide2.prototype.getDefault = function getDefault() {\n return this.gl.BACK;\n };\n CullFaceSide2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n this.gl.cullFace(v);\n this.current = v;\n this.dirty = false;\n };\n return CullFaceSide2;\n }(BaseValue);\n var FrontFace = function(BaseValue2) {\n function FrontFace2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n FrontFace2.__proto__ = BaseValue2;\n FrontFace2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n FrontFace2.prototype.constructor = FrontFace2;\n FrontFace2.prototype.getDefault = function getDefault() {\n return this.gl.CCW;\n };\n FrontFace2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n this.gl.frontFace(v);\n this.current = v;\n this.dirty = false;\n };\n return FrontFace2;\n }(BaseValue);\n var Program = function(BaseValue2) {\n function Program2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n Program2.__proto__ = BaseValue2;\n Program2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n Program2.prototype.constructor = Program2;\n Program2.prototype.getDefault = function getDefault() {\n return null;\n };\n Program2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n this.gl.useProgram(v);\n this.current = v;\n this.dirty = false;\n };\n return Program2;\n }(BaseValue);\n var ActiveTextureUnit = function(BaseValue2) {\n function ActiveTextureUnit2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n ActiveTextureUnit2.__proto__ = BaseValue2;\n ActiveTextureUnit2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n ActiveTextureUnit2.prototype.constructor = ActiveTextureUnit2;\n ActiveTextureUnit2.prototype.getDefault = function getDefault() {\n return this.gl.TEXTURE0;\n };\n ActiveTextureUnit2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n this.gl.activeTexture(v);\n this.current = v;\n this.dirty = false;\n };\n return ActiveTextureUnit2;\n }(BaseValue);\n var Viewport = function(BaseValue2) {\n function Viewport2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n Viewport2.__proto__ = BaseValue2;\n Viewport2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n Viewport2.prototype.constructor = Viewport2;\n Viewport2.prototype.getDefault = function getDefault() {\n var gl2 = this.gl;\n return [\n 0,\n 0,\n gl2.drawingBufferWidth,\n gl2.drawingBufferHeight\n ];\n };\n Viewport2.prototype.set = function set(v) {\n var c = this.current;\n if (v[0] === c[0] && v[1] === c[1] && v[2] === c[2] && v[3] === c[3] && !this.dirty) {\n return;\n }\n this.gl.viewport(v[0], v[1], v[2], v[3]);\n this.current = v;\n this.dirty = false;\n };\n return Viewport2;\n }(BaseValue);\n var BindFramebuffer = function(BaseValue2) {\n function BindFramebuffer2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n BindFramebuffer2.__proto__ = BaseValue2;\n BindFramebuffer2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n BindFramebuffer2.prototype.constructor = BindFramebuffer2;\n BindFramebuffer2.prototype.getDefault = function getDefault() {\n return null;\n };\n BindFramebuffer2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n var gl2 = this.gl;\n gl2.bindFramebuffer(gl2.FRAMEBUFFER, v);\n this.current = v;\n this.dirty = false;\n };\n return BindFramebuffer2;\n }(BaseValue);\n var BindRenderbuffer = function(BaseValue2) {\n function BindRenderbuffer2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n BindRenderbuffer2.__proto__ = BaseValue2;\n BindRenderbuffer2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n BindRenderbuffer2.prototype.constructor = BindRenderbuffer2;\n BindRenderbuffer2.prototype.getDefault = function getDefault() {\n return null;\n };\n BindRenderbuffer2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n var gl2 = this.gl;\n gl2.bindRenderbuffer(gl2.RENDERBUFFER, v);\n this.current = v;\n this.dirty = false;\n };\n return BindRenderbuffer2;\n }(BaseValue);\n var BindTexture = function(BaseValue2) {\n function BindTexture2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n BindTexture2.__proto__ = BaseValue2;\n BindTexture2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n BindTexture2.prototype.constructor = BindTexture2;\n BindTexture2.prototype.getDefault = function getDefault() {\n return null;\n };\n BindTexture2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n var gl2 = this.gl;\n gl2.bindTexture(gl2.TEXTURE_2D, v);\n this.current = v;\n this.dirty = false;\n };\n return BindTexture2;\n }(BaseValue);\n var BindVertexBuffer = function(BaseValue2) {\n function BindVertexBuffer2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n BindVertexBuffer2.__proto__ = BaseValue2;\n BindVertexBuffer2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n BindVertexBuffer2.prototype.constructor = BindVertexBuffer2;\n BindVertexBuffer2.prototype.getDefault = function getDefault() {\n return null;\n };\n BindVertexBuffer2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n var gl2 = this.gl;\n gl2.bindBuffer(gl2.ARRAY_BUFFER, v);\n this.current = v;\n this.dirty = false;\n };\n return BindVertexBuffer2;\n }(BaseValue);\n var BindElementBuffer = function(BaseValue2) {\n function BindElementBuffer2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n BindElementBuffer2.__proto__ = BaseValue2;\n BindElementBuffer2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n BindElementBuffer2.prototype.constructor = BindElementBuffer2;\n BindElementBuffer2.prototype.getDefault = function getDefault() {\n return null;\n };\n BindElementBuffer2.prototype.set = function set(v) {\n var gl2 = this.gl;\n gl2.bindBuffer(gl2.ELEMENT_ARRAY_BUFFER, v);\n this.current = v;\n this.dirty = false;\n };\n return BindElementBuffer2;\n }(BaseValue);\n var BindVertexArrayOES = function(BaseValue2) {\n function BindVertexArrayOES2(context) {\n BaseValue2.call(this, context);\n this.vao = context.extVertexArrayObject;\n }\n if (BaseValue2)\n BindVertexArrayOES2.__proto__ = BaseValue2;\n BindVertexArrayOES2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n BindVertexArrayOES2.prototype.constructor = BindVertexArrayOES2;\n BindVertexArrayOES2.prototype.getDefault = function getDefault() {\n return null;\n };\n BindVertexArrayOES2.prototype.set = function set(v) {\n if (!this.vao || v === this.current && !this.dirty) {\n return;\n }\n this.vao.bindVertexArrayOES(v);\n this.current = v;\n this.dirty = false;\n };\n return BindVertexArrayOES2;\n }(BaseValue);\n var PixelStoreUnpack = function(BaseValue2) {\n function PixelStoreUnpack2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n PixelStoreUnpack2.__proto__ = BaseValue2;\n PixelStoreUnpack2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n PixelStoreUnpack2.prototype.constructor = PixelStoreUnpack2;\n PixelStoreUnpack2.prototype.getDefault = function getDefault() {\n return 4;\n };\n PixelStoreUnpack2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n var gl2 = this.gl;\n gl2.pixelStorei(gl2.UNPACK_ALIGNMENT, v);\n this.current = v;\n this.dirty = false;\n };\n return PixelStoreUnpack2;\n }(BaseValue);\n var PixelStoreUnpackPremultiplyAlpha = function(BaseValue2) {\n function PixelStoreUnpackPremultiplyAlpha2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n PixelStoreUnpackPremultiplyAlpha2.__proto__ = BaseValue2;\n PixelStoreUnpackPremultiplyAlpha2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n PixelStoreUnpackPremultiplyAlpha2.prototype.constructor = PixelStoreUnpackPremultiplyAlpha2;\n PixelStoreUnpackPremultiplyAlpha2.prototype.getDefault = function getDefault() {\n return false;\n };\n PixelStoreUnpackPremultiplyAlpha2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n var gl2 = this.gl;\n gl2.pixelStorei(gl2.UNPACK_PREMULTIPLY_ALPHA_WEBGL, v);\n this.current = v;\n this.dirty = false;\n };\n return PixelStoreUnpackPremultiplyAlpha2;\n }(BaseValue);\n var PixelStoreUnpackFlipY = function(BaseValue2) {\n function PixelStoreUnpackFlipY2() {\n BaseValue2.apply(this, arguments);\n }\n if (BaseValue2)\n PixelStoreUnpackFlipY2.__proto__ = BaseValue2;\n PixelStoreUnpackFlipY2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n PixelStoreUnpackFlipY2.prototype.constructor = PixelStoreUnpackFlipY2;\n PixelStoreUnpackFlipY2.prototype.getDefault = function getDefault() {\n return false;\n };\n PixelStoreUnpackFlipY2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n var gl2 = this.gl;\n gl2.pixelStorei(gl2.UNPACK_FLIP_Y_WEBGL, v);\n this.current = v;\n this.dirty = false;\n };\n return PixelStoreUnpackFlipY2;\n }(BaseValue);\n var FramebufferAttachment = function(BaseValue2) {\n function FramebufferAttachment2(context, parent) {\n BaseValue2.call(this, context);\n this.context = context;\n this.parent = parent;\n }\n if (BaseValue2)\n FramebufferAttachment2.__proto__ = BaseValue2;\n FramebufferAttachment2.prototype = Object.create(BaseValue2 && BaseValue2.prototype);\n FramebufferAttachment2.prototype.constructor = FramebufferAttachment2;\n FramebufferAttachment2.prototype.getDefault = function getDefault() {\n return null;\n };\n return FramebufferAttachment2;\n }(BaseValue);\n var ColorAttachment = function(FramebufferAttachment2) {\n function ColorAttachment2() {\n FramebufferAttachment2.apply(this, arguments);\n }\n if (FramebufferAttachment2)\n ColorAttachment2.__proto__ = FramebufferAttachment2;\n ColorAttachment2.prototype = Object.create(FramebufferAttachment2 && FramebufferAttachment2.prototype);\n ColorAttachment2.prototype.constructor = ColorAttachment2;\n ColorAttachment2.prototype.setDirty = function setDirty() {\n this.dirty = true;\n };\n ColorAttachment2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n this.context.bindFramebuffer.set(this.parent);\n var gl2 = this.gl;\n gl2.framebufferTexture2D(gl2.FRAMEBUFFER, gl2.COLOR_ATTACHMENT0, gl2.TEXTURE_2D, v, 0);\n this.current = v;\n this.dirty = false;\n };\n return ColorAttachment2;\n }(FramebufferAttachment);\n var DepthAttachment = function(FramebufferAttachment2) {\n function DepthAttachment2() {\n FramebufferAttachment2.apply(this, arguments);\n }\n if (FramebufferAttachment2)\n DepthAttachment2.__proto__ = FramebufferAttachment2;\n DepthAttachment2.prototype = Object.create(FramebufferAttachment2 && FramebufferAttachment2.prototype);\n DepthAttachment2.prototype.constructor = DepthAttachment2;\n DepthAttachment2.prototype.set = function set(v) {\n if (v === this.current && !this.dirty) {\n return;\n }\n this.context.bindFramebuffer.set(this.parent);\n var gl2 = this.gl;\n gl2.framebufferRenderbuffer(gl2.FRAMEBUFFER, gl2.DEPTH_ATTACHMENT, gl2.RENDERBUFFER, v);\n this.current = v;\n this.dirty = false;\n };\n return DepthAttachment2;\n }(FramebufferAttachment);\n var Framebuffer = function Framebuffer2(context, width, height, hasDepth) {\n this.context = context;\n this.width = width;\n this.height = height;\n var gl2 = context.gl;\n var fbo = this.framebuffer = gl2.createFramebuffer();\n this.colorAttachment = new ColorAttachment(context, fbo);\n if (hasDepth) {\n this.depthAttachment = new DepthAttachment(context, fbo);\n }\n };\n Framebuffer.prototype.destroy = function destroy() {\n var gl2 = this.context.gl;\n var texture = this.colorAttachment.get();\n if (texture) {\n gl2.deleteTexture(texture);\n }\n if (this.depthAttachment) {\n var renderbuffer = this.depthAttachment.get();\n if (renderbuffer) {\n gl2.deleteRenderbuffer(renderbuffer);\n }\n }\n gl2.deleteFramebuffer(this.framebuffer);\n };\n var ALWAYS = 519;\n var DepthMode = function DepthMode2(depthFunc, depthMask, depthRange) {\n this.func = depthFunc;\n this.mask = depthMask;\n this.range = depthRange;\n };\n DepthMode.ReadOnly = false;\n DepthMode.ReadWrite = true;\n DepthMode.disabled = new DepthMode(ALWAYS, DepthMode.ReadOnly, [\n 0,\n 1\n ]);\n var ALWAYS$1 = 519;\n var KEEP = 7680;\n var StencilMode = function StencilMode2(test, ref, mask, fail, depthFail, pass) {\n this.test = test;\n this.ref = ref;\n this.mask = mask;\n this.fail = fail;\n this.depthFail = depthFail;\n this.pass = pass;\n };\n StencilMode.disabled = new StencilMode({\n func: ALWAYS$1,\n mask: 0\n }, 0, 0, KEEP, KEEP, KEEP);\n var ZERO = 0;\n var ONE = 1;\n var ONE_MINUS_SRC_ALPHA = 771;\n var ColorMode = function ColorMode2(blendFunction, blendColor, mask) {\n this.blendFunction = blendFunction;\n this.blendColor = blendColor;\n this.mask = mask;\n };\n ColorMode.Replace = [\n ONE,\n ZERO\n ];\n ColorMode.disabled = new ColorMode(ColorMode.Replace, performance2.Color.transparent, [\n false,\n false,\n false,\n false\n ]);\n ColorMode.unblended = new ColorMode(ColorMode.Replace, performance2.Color.transparent, [\n true,\n true,\n true,\n true\n ]);\n ColorMode.alphaBlended = new ColorMode([\n ONE,\n ONE_MINUS_SRC_ALPHA\n ], performance2.Color.transparent, [\n true,\n true,\n true,\n true\n ]);\n var BACK = 1029;\n var CCW = 2305;\n var CullFaceMode = function CullFaceMode2(enable, mode, frontFace) {\n this.enable = enable;\n this.mode = mode;\n this.frontFace = frontFace;\n };\n CullFaceMode.disabled = new CullFaceMode(false, BACK, CCW);\n CullFaceMode.backCCW = new CullFaceMode(true, BACK, CCW);\n var Context = function Context2(gl2) {\n this.gl = gl2;\n this.extVertexArrayObject = this.gl.getExtension(\"OES_vertex_array_object\");\n this.clearColor = new ClearColor(this);\n this.clearDepth = new ClearDepth(this);\n this.clearStencil = new ClearStencil(this);\n this.colorMask = new ColorMask(this);\n this.depthMask = new DepthMask(this);\n this.stencilMask = new StencilMask(this);\n this.stencilFunc = new StencilFunc(this);\n this.stencilOp = new StencilOp(this);\n this.stencilTest = new StencilTest(this);\n this.depthRange = new DepthRange(this);\n this.depthTest = new DepthTest(this);\n this.depthFunc = new DepthFunc(this);\n this.blend = new Blend(this);\n this.blendFunc = new BlendFunc(this);\n this.blendColor = new BlendColor(this);\n this.blendEquation = new BlendEquation(this);\n this.cullFace = new CullFace(this);\n this.cullFaceSide = new CullFaceSide(this);\n this.frontFace = new FrontFace(this);\n this.program = new Program(this);\n this.activeTexture = new ActiveTextureUnit(this);\n this.viewport = new Viewport(this);\n this.bindFramebuffer = new BindFramebuffer(this);\n this.bindRenderbuffer = new BindRenderbuffer(this);\n this.bindTexture = new BindTexture(this);\n this.bindVertexBuffer = new BindVertexBuffer(this);\n this.bindElementBuffer = new BindElementBuffer(this);\n this.bindVertexArrayOES = this.extVertexArrayObject && new BindVertexArrayOES(this);\n this.pixelStoreUnpack = new PixelStoreUnpack(this);\n this.pixelStoreUnpackPremultiplyAlpha = new PixelStoreUnpackPremultiplyAlpha(this);\n this.pixelStoreUnpackFlipY = new PixelStoreUnpackFlipY(this);\n this.extTextureFilterAnisotropic = gl2.getExtension(\"EXT_texture_filter_anisotropic\") || gl2.getExtension(\"MOZ_EXT_texture_filter_anisotropic\") || gl2.getExtension(\"WEBKIT_EXT_texture_filter_anisotropic\");\n if (this.extTextureFilterAnisotropic) {\n this.extTextureFilterAnisotropicMax = gl2.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT);\n }\n this.extTextureHalfFloat = gl2.getExtension(\"OES_texture_half_float\");\n if (this.extTextureHalfFloat) {\n gl2.getExtension(\"OES_texture_half_float_linear\");\n this.extRenderToTextureHalfFloat = gl2.getExtension(\"EXT_color_buffer_half_float\");\n }\n this.extTimerQuery = gl2.getExtension(\"EXT_disjoint_timer_query\");\n this.maxTextureSize = gl2.getParameter(gl2.MAX_TEXTURE_SIZE);\n };\n Context.prototype.setDefault = function setDefault() {\n this.unbindVAO();\n this.clearColor.setDefault();\n this.clearDepth.setDefault();\n this.clearStencil.setDefault();\n this.colorMask.setDefault();\n this.depthMask.setDefault();\n this.stencilMask.setDefault();\n this.stencilFunc.setDefault();\n this.stencilOp.setDefault();\n this.stencilTest.setDefault();\n this.depthRange.setDefault();\n this.depthTest.setDefault();\n this.depthFunc.setDefault();\n this.blend.setDefault();\n this.blendFunc.setDefault();\n this.blendColor.setDefault();\n this.blendEquation.setDefault();\n this.cullFace.setDefault();\n this.cullFaceSide.setDefault();\n this.frontFace.setDefault();\n this.program.setDefault();\n this.activeTexture.setDefault();\n this.bindFramebuffer.setDefault();\n this.pixelStoreUnpack.setDefault();\n this.pixelStoreUnpackPremultiplyAlpha.setDefault();\n this.pixelStoreUnpackFlipY.setDefault();\n };\n Context.prototype.setDirty = function setDirty() {\n this.clearColor.dirty = true;\n this.clearDepth.dirty = true;\n this.clearStencil.dirty = true;\n this.colorMask.dirty = true;\n this.depthMask.dirty = true;\n this.stencilMask.dirty = true;\n this.stencilFunc.dirty = true;\n this.stencilOp.dirty = true;\n this.stencilTest.dirty = true;\n this.depthRange.dirty = true;\n this.depthTest.dirty = true;\n this.depthFunc.dirty = true;\n this.blend.dirty = true;\n this.blendFunc.dirty = true;\n this.blendColor.dirty = true;\n this.blendEquation.dirty = true;\n this.cullFace.dirty = true;\n this.cullFaceSide.dirty = true;\n this.frontFace.dirty = true;\n this.program.dirty = true;\n this.activeTexture.dirty = true;\n this.viewport.dirty = true;\n this.bindFramebuffer.dirty = true;\n this.bindRenderbuffer.dirty = true;\n this.bindTexture.dirty = true;\n this.bindVertexBuffer.dirty = true;\n this.bindElementBuffer.dirty = true;\n if (this.extVertexArrayObject) {\n this.bindVertexArrayOES.dirty = true;\n }\n this.pixelStoreUnpack.dirty = true;\n this.pixelStoreUnpackPremultiplyAlpha.dirty = true;\n this.pixelStoreUnpackFlipY.dirty = true;\n };\n Context.prototype.createIndexBuffer = function createIndexBuffer(array, dynamicDraw) {\n return new IndexBuffer(this, array, dynamicDraw);\n };\n Context.prototype.createVertexBuffer = function createVertexBuffer(array, attributes, dynamicDraw) {\n return new VertexBuffer(this, array, attributes, dynamicDraw);\n };\n Context.prototype.createRenderbuffer = function createRenderbuffer(storageFormat, width, height) {\n var gl2 = this.gl;\n var rbo = gl2.createRenderbuffer();\n this.bindRenderbuffer.set(rbo);\n gl2.renderbufferStorage(gl2.RENDERBUFFER, storageFormat, width, height);\n this.bindRenderbuffer.set(null);\n return rbo;\n };\n Context.prototype.createFramebuffer = function createFramebuffer(width, height, hasDepth) {\n return new Framebuffer(this, width, height, hasDepth);\n };\n Context.prototype.clear = function clear(ref) {\n var color2 = ref.color;\n var depth = ref.depth;\n var gl2 = this.gl;\n var mask = 0;\n if (color2) {\n mask |= gl2.COLOR_BUFFER_BIT;\n this.clearColor.set(color2);\n this.colorMask.set([\n true,\n true,\n true,\n true\n ]);\n }\n if (typeof depth !== \"undefined\") {\n mask |= gl2.DEPTH_BUFFER_BIT;\n this.depthRange.set([\n 0,\n 1\n ]);\n this.clearDepth.set(depth);\n this.depthMask.set(true);\n }\n gl2.clear(mask);\n };\n Context.prototype.setCullFace = function setCullFace(cullFaceMode) {\n if (cullFaceMode.enable === false) {\n this.cullFace.set(false);\n } else {\n this.cullFace.set(true);\n this.cullFaceSide.set(cullFaceMode.mode);\n this.frontFace.set(cullFaceMode.frontFace);\n }\n };\n Context.prototype.setDepthMode = function setDepthMode(depthMode) {\n if (depthMode.func === this.gl.ALWAYS && !depthMode.mask) {\n this.depthTest.set(false);\n } else {\n this.depthTest.set(true);\n this.depthFunc.set(depthMode.func);\n this.depthMask.set(depthMode.mask);\n this.depthRange.set(depthMode.range);\n }\n };\n Context.prototype.setStencilMode = function setStencilMode(stencilMode) {\n if (stencilMode.test.func === this.gl.ALWAYS && !stencilMode.mask) {\n this.stencilTest.set(false);\n } else {\n this.stencilTest.set(true);\n this.stencilMask.set(stencilMode.mask);\n this.stencilOp.set([\n stencilMode.fail,\n stencilMode.depthFail,\n stencilMode.pass\n ]);\n this.stencilFunc.set({\n func: stencilMode.test.func,\n ref: stencilMode.ref,\n mask: stencilMode.test.mask\n });\n }\n };\n Context.prototype.setColorMode = function setColorMode(colorMode) {\n if (performance2.deepEqual(colorMode.blendFunction, ColorMode.Replace)) {\n this.blend.set(false);\n } else {\n this.blend.set(true);\n this.blendFunc.set(colorMode.blendFunction);\n this.blendColor.set(colorMode.blendColor);\n }\n this.colorMask.set(colorMode.mask);\n };\n Context.prototype.unbindVAO = function unbindVAO() {\n if (this.extVertexArrayObject) {\n this.bindVertexArrayOES.set(null);\n }\n };\n var SourceCache = function(Evented) {\n function SourceCache2(id, options, dispatcher) {\n var this$1 = this;\n Evented.call(this);\n this.id = id;\n this.dispatcher = dispatcher;\n this.on(\"data\", function(e) {\n if (e.dataType === \"source\" && e.sourceDataType === \"metadata\") {\n this$1._sourceLoaded = true;\n }\n if (this$1._sourceLoaded && !this$1._paused && e.dataType === \"source\" && e.sourceDataType === \"content\") {\n this$1.reload();\n if (this$1.transform) {\n this$1.update(this$1.transform);\n }\n }\n });\n this.on(\"error\", function() {\n this$1._sourceErrored = true;\n });\n this._source = create(id, options, dispatcher, this);\n this._tiles = {};\n this._cache = new TileCache(0, this._unloadTile.bind(this));\n this._timers = {};\n this._cacheTimers = {};\n this._maxTileCacheSize = null;\n this._loadedParentTiles = {};\n this._coveredTiles = {};\n this._state = new performance2.SourceFeatureState();\n }\n if (Evented)\n SourceCache2.__proto__ = Evented;\n SourceCache2.prototype = Object.create(Evented && Evented.prototype);\n SourceCache2.prototype.constructor = SourceCache2;\n SourceCache2.prototype.onAdd = function onAdd(map) {\n this.map = map;\n this._maxTileCacheSize = map ? map._maxTileCacheSize : null;\n if (this._source && this._source.onAdd) {\n this._source.onAdd(map);\n }\n };\n SourceCache2.prototype.onRemove = function onRemove(map) {\n if (this._source && this._source.onRemove) {\n this._source.onRemove(map);\n }\n };\n SourceCache2.prototype.loaded = function loaded() {\n if (this._sourceErrored) {\n return true;\n }\n if (!this._sourceLoaded) {\n return false;\n }\n if (!this._source.loaded()) {\n return false;\n }\n for (var t in this._tiles) {\n var tile = this._tiles[t];\n if (tile.state !== \"loaded\" && tile.state !== \"errored\") {\n return false;\n }\n }\n return true;\n };\n SourceCache2.prototype.getSource = function getSource() {\n return this._source;\n };\n SourceCache2.prototype.pause = function pause() {\n this._paused = true;\n };\n SourceCache2.prototype.resume = function resume() {\n if (!this._paused) {\n return;\n }\n var shouldReload = this._shouldReloadOnResume;\n this._paused = false;\n this._shouldReloadOnResume = false;\n if (shouldReload) {\n this.reload();\n }\n if (this.transform) {\n this.update(this.transform);\n }\n };\n SourceCache2.prototype._loadTile = function _loadTile(tile, callback) {\n return this._source.loadTile(tile, callback);\n };\n SourceCache2.prototype._unloadTile = function _unloadTile(tile) {\n if (this._source.unloadTile) {\n return this._source.unloadTile(tile, function() {\n });\n }\n };\n SourceCache2.prototype._abortTile = function _abortTile(tile) {\n if (this._source.abortTile) {\n return this._source.abortTile(tile, function() {\n });\n }\n };\n SourceCache2.prototype.serialize = function serialize() {\n return this._source.serialize();\n };\n SourceCache2.prototype.prepare = function prepare(context) {\n if (this._source.prepare) {\n this._source.prepare();\n }\n this._state.coalesceChanges(this._tiles, this.map ? this.map.painter : null);\n for (var i in this._tiles) {\n var tile = this._tiles[i];\n tile.upload(context);\n tile.prepare(this.map.style.imageManager);\n }\n };\n SourceCache2.prototype.getIds = function getIds() {\n return performance2.values(this._tiles).map(function(tile) {\n return tile.tileID;\n }).sort(compareTileId).map(function(id) {\n return id.key;\n });\n };\n SourceCache2.prototype.getRenderableIds = function getRenderableIds(symbolLayer) {\n var this$1 = this;\n var renderables = [];\n for (var id in this._tiles) {\n if (this._isIdRenderable(id, symbolLayer)) {\n renderables.push(this._tiles[id]);\n }\n }\n if (symbolLayer) {\n return renderables.sort(function(a_, b_) {\n var a = a_.tileID;\n var b = b_.tileID;\n var rotatedA = new performance2.Point(a.canonical.x, a.canonical.y)._rotate(this$1.transform.angle);\n var rotatedB = new performance2.Point(b.canonical.x, b.canonical.y)._rotate(this$1.transform.angle);\n return a.overscaledZ - b.overscaledZ || rotatedB.y - rotatedA.y || rotatedB.x - rotatedA.x;\n }).map(function(tile) {\n return tile.tileID.key;\n });\n }\n return renderables.map(function(tile) {\n return tile.tileID;\n }).sort(compareTileId).map(function(id2) {\n return id2.key;\n });\n };\n SourceCache2.prototype.hasRenderableParent = function hasRenderableParent(tileID) {\n var parentTile = this.findLoadedParent(tileID, 0);\n if (parentTile) {\n return this._isIdRenderable(parentTile.tileID.key);\n }\n return false;\n };\n SourceCache2.prototype._isIdRenderable = function _isIdRenderable(id, symbolLayer) {\n return this._tiles[id] && this._tiles[id].hasData() && !this._coveredTiles[id] && (symbolLayer || !this._tiles[id].holdingForFade());\n };\n SourceCache2.prototype.reload = function reload() {\n if (this._paused) {\n this._shouldReloadOnResume = true;\n return;\n }\n this._cache.reset();\n for (var i in this._tiles) {\n if (this._tiles[i].state !== \"errored\") {\n this._reloadTile(i, \"reloading\");\n }\n }\n };\n SourceCache2.prototype._reloadTile = function _reloadTile(id, state) {\n var tile = this._tiles[id];\n if (!tile) {\n return;\n }\n if (tile.state !== \"loading\") {\n tile.state = state;\n }\n this._loadTile(tile, this._tileLoaded.bind(this, tile, id, state));\n };\n SourceCache2.prototype._tileLoaded = function _tileLoaded(tile, id, previousState, err) {\n if (err) {\n tile.state = \"errored\";\n if (err.status !== 404) {\n this._source.fire(new performance2.ErrorEvent(err, { tile }));\n } else {\n this.update(this.transform);\n }\n return;\n }\n tile.timeAdded = performance2.browser.now();\n if (previousState === \"expired\") {\n tile.refreshedUponExpiration = true;\n }\n this._setTileReloadTimer(id, tile);\n if (this.getSource().type === \"raster-dem\" && tile.dem) {\n this._backfillDEM(tile);\n }\n this._state.initializeTileState(tile, this.map ? this.map.painter : null);\n this._source.fire(new performance2.Event(\"data\", {\n dataType: \"source\",\n tile,\n coord: tile.tileID\n }));\n };\n SourceCache2.prototype._backfillDEM = function _backfillDEM(tile) {\n var renderables = this.getRenderableIds();\n for (var i = 0; i < renderables.length; i++) {\n var borderId = renderables[i];\n if (tile.neighboringTiles && tile.neighboringTiles[borderId]) {\n var borderTile = this.getTileByID(borderId);\n fillBorder(tile, borderTile);\n fillBorder(borderTile, tile);\n }\n }\n function fillBorder(tile2, borderTile2) {\n tile2.needsHillshadePrepare = true;\n var dx = borderTile2.tileID.canonical.x - tile2.tileID.canonical.x;\n var dy = borderTile2.tileID.canonical.y - tile2.tileID.canonical.y;\n var dim = Math.pow(2, tile2.tileID.canonical.z);\n var borderId2 = borderTile2.tileID.key;\n if (dx === 0 && dy === 0) {\n return;\n }\n if (Math.abs(dy) > 1) {\n return;\n }\n if (Math.abs(dx) > 1) {\n if (Math.abs(dx + dim) === 1) {\n dx += dim;\n } else if (Math.abs(dx - dim) === 1) {\n dx -= dim;\n }\n }\n if (!borderTile2.dem || !tile2.dem) {\n return;\n }\n tile2.dem.backfillBorder(borderTile2.dem, dx, dy);\n if (tile2.neighboringTiles && tile2.neighboringTiles[borderId2]) {\n tile2.neighboringTiles[borderId2].backfilled = true;\n }\n }\n };\n SourceCache2.prototype.getTile = function getTile(tileID) {\n return this.getTileByID(tileID.key);\n };\n SourceCache2.prototype.getTileByID = function getTileByID(id) {\n return this._tiles[id];\n };\n SourceCache2.prototype._retainLoadedChildren = function _retainLoadedChildren(idealTiles, zoom, maxCoveringZoom, retain) {\n for (var id in this._tiles) {\n var tile = this._tiles[id];\n if (retain[id] || !tile.hasData() || tile.tileID.overscaledZ <= zoom || tile.tileID.overscaledZ > maxCoveringZoom) {\n continue;\n }\n var topmostLoadedID = tile.tileID;\n while (tile && tile.tileID.overscaledZ > zoom + 1) {\n var parentID = tile.tileID.scaledTo(tile.tileID.overscaledZ - 1);\n tile = this._tiles[parentID.key];\n if (tile && tile.hasData()) {\n topmostLoadedID = parentID;\n }\n }\n var tileID = topmostLoadedID;\n while (tileID.overscaledZ > zoom) {\n tileID = tileID.scaledTo(tileID.overscaledZ - 1);\n if (idealTiles[tileID.key]) {\n retain[topmostLoadedID.key] = topmostLoadedID;\n break;\n }\n }\n }\n };\n SourceCache2.prototype.findLoadedParent = function findLoadedParent(tileID, minCoveringZoom) {\n if (tileID.key in this._loadedParentTiles) {\n var parent = this._loadedParentTiles[tileID.key];\n if (parent && parent.tileID.overscaledZ >= minCoveringZoom) {\n return parent;\n } else {\n return null;\n }\n }\n for (var z = tileID.overscaledZ - 1; z >= minCoveringZoom; z--) {\n var parentTileID = tileID.scaledTo(z);\n var tile = this._getLoadedTile(parentTileID);\n if (tile) {\n return tile;\n }\n }\n };\n SourceCache2.prototype._getLoadedTile = function _getLoadedTile(tileID) {\n var tile = this._tiles[tileID.key];\n if (tile && tile.hasData()) {\n return tile;\n }\n var cachedTile = this._cache.getByKey(tileID.wrapped().key);\n return cachedTile;\n };\n SourceCache2.prototype.updateCacheSize = function updateCacheSize(transform) {\n var widthInTiles = Math.ceil(transform.width / this._source.tileSize) + 1;\n var heightInTiles = Math.ceil(transform.height / this._source.tileSize) + 1;\n var approxTilesInView = widthInTiles * heightInTiles;\n var commonZoomRange = 5;\n var viewDependentMaxSize = Math.floor(approxTilesInView * commonZoomRange);\n var maxSize = typeof this._maxTileCacheSize === \"number\" ? Math.min(this._maxTileCacheSize, viewDependentMaxSize) : viewDependentMaxSize;\n this._cache.setMaxSize(maxSize);\n };\n SourceCache2.prototype.handleWrapJump = function handleWrapJump(lng) {\n var prevLng = this._prevLng === void 0 ? lng : this._prevLng;\n var lngDifference = lng - prevLng;\n var worldDifference = lngDifference / 360;\n var wrapDelta = Math.round(worldDifference);\n this._prevLng = lng;\n if (wrapDelta) {\n var tiles = {};\n for (var key in this._tiles) {\n var tile = this._tiles[key];\n tile.tileID = tile.tileID.unwrapTo(tile.tileID.wrap + wrapDelta);\n tiles[tile.tileID.key] = tile;\n }\n this._tiles = tiles;\n for (var id in this._timers) {\n clearTimeout(this._timers[id]);\n delete this._timers[id];\n }\n for (var id$1 in this._tiles) {\n var tile$1 = this._tiles[id$1];\n this._setTileReloadTimer(id$1, tile$1);\n }\n }\n };\n SourceCache2.prototype.update = function update(transform) {\n var this$1 = this;\n this.transform = transform;\n if (!this._sourceLoaded || this._paused) {\n return;\n }\n this.updateCacheSize(transform);\n this.handleWrapJump(this.transform.center.lng);\n this._coveredTiles = {};\n var idealTileIDs;\n if (!this.used) {\n idealTileIDs = [];\n } else if (this._source.tileID) {\n idealTileIDs = transform.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(unwrapped) {\n return new performance2.OverscaledTileID(unwrapped.canonical.z, unwrapped.wrap, unwrapped.canonical.z, unwrapped.canonical.x, unwrapped.canonical.y);\n });\n } else {\n idealTileIDs = transform.coveringTiles({\n tileSize: this._source.tileSize,\n minzoom: this._source.minzoom,\n maxzoom: this._source.maxzoom,\n roundZoom: this._source.roundZoom,\n reparseOverscaled: this._source.reparseOverscaled\n });\n if (this._source.hasTile) {\n idealTileIDs = idealTileIDs.filter(function(coord) {\n return this$1._source.hasTile(coord);\n });\n }\n }\n var zoom = transform.coveringZoomLevel(this._source);\n var minCoveringZoom = Math.max(zoom - SourceCache2.maxOverzooming, this._source.minzoom);\n var maxCoveringZoom = Math.max(zoom + SourceCache2.maxUnderzooming, this._source.minzoom);\n var retain = this._updateRetainedTiles(idealTileIDs, zoom);\n if (isRasterType(this._source.type)) {\n var parentsForFading = {};\n var fadingTiles = {};\n var ids = Object.keys(retain);\n for (var i = 0, list = ids; i < list.length; i += 1) {\n var id = list[i];\n var tileID = retain[id];\n var tile = this._tiles[id];\n if (!tile || tile.fadeEndTime && tile.fadeEndTime <= performance2.browser.now()) {\n continue;\n }\n var parentTile = this.findLoadedParent(tileID, minCoveringZoom);\n if (parentTile) {\n this._addTile(parentTile.tileID);\n parentsForFading[parentTile.tileID.key] = parentTile.tileID;\n }\n fadingTiles[id] = tileID;\n }\n this._retainLoadedChildren(fadingTiles, zoom, maxCoveringZoom, retain);\n for (var id$1 in parentsForFading) {\n if (!retain[id$1]) {\n this._coveredTiles[id$1] = true;\n retain[id$1] = parentsForFading[id$1];\n }\n }\n }\n for (var retainedId in retain) {\n this._tiles[retainedId].clearFadeHold();\n }\n var remove = performance2.keysDifference(this._tiles, retain);\n for (var i$1 = 0, list$1 = remove; i$1 < list$1.length; i$1 += 1) {\n var tileID$1 = list$1[i$1];\n var tile$1 = this._tiles[tileID$1];\n if (tile$1.hasSymbolBuckets && !tile$1.holdingForFade()) {\n tile$1.setHoldDuration(this.map._fadeDuration);\n } else if (!tile$1.hasSymbolBuckets || tile$1.symbolFadeFinished()) {\n this._removeTile(tileID$1);\n }\n }\n this._updateLoadedParentTileCache();\n };\n SourceCache2.prototype.releaseSymbolFadeTiles = function releaseSymbolFadeTiles() {\n for (var id in this._tiles) {\n if (this._tiles[id].holdingForFade()) {\n this._removeTile(id);\n }\n }\n };\n SourceCache2.prototype._updateRetainedTiles = function _updateRetainedTiles(idealTileIDs, zoom) {\n var retain = {};\n var checked = {};\n var minCoveringZoom = Math.max(zoom - SourceCache2.maxOverzooming, this._source.minzoom);\n var maxCoveringZoom = Math.max(zoom + SourceCache2.maxUnderzooming, this._source.minzoom);\n var missingTiles = {};\n for (var i = 0, list = idealTileIDs; i < list.length; i += 1) {\n var tileID = list[i];\n var tile = this._addTile(tileID);\n retain[tileID.key] = tileID;\n if (tile.hasData()) {\n continue;\n }\n if (zoom < this._source.maxzoom) {\n missingTiles[tileID.key] = tileID;\n }\n }\n this._retainLoadedChildren(missingTiles, zoom, maxCoveringZoom, retain);\n for (var i$1 = 0, list$1 = idealTileIDs; i$1 < list$1.length; i$1 += 1) {\n var tileID$1 = list$1[i$1];\n var tile$1 = this._tiles[tileID$1.key];\n if (tile$1.hasData()) {\n continue;\n }\n if (zoom + 1 > this._source.maxzoom) {\n var childCoord = tileID$1.children(this._source.maxzoom)[0];\n var childTile = this.getTile(childCoord);\n if (!!childTile && childTile.hasData()) {\n retain[childCoord.key] = childCoord;\n continue;\n }\n } else {\n var children = tileID$1.children(this._source.maxzoom);\n if (retain[children[0].key] && retain[children[1].key] && retain[children[2].key] && retain[children[3].key]) {\n continue;\n }\n }\n var parentWasRequested = tile$1.wasRequested();\n for (var overscaledZ = tileID$1.overscaledZ - 1; overscaledZ >= minCoveringZoom; --overscaledZ) {\n var parentId = tileID$1.scaledTo(overscaledZ);\n if (checked[parentId.key]) {\n break;\n }\n checked[parentId.key] = true;\n tile$1 = this.getTile(parentId);\n if (!tile$1 && parentWasRequested) {\n tile$1 = this._addTile(parentId);\n }\n if (tile$1) {\n retain[parentId.key] = parentId;\n parentWasRequested = tile$1.wasRequested();\n if (tile$1.hasData()) {\n break;\n }\n }\n }\n }\n return retain;\n };\n SourceCache2.prototype._updateLoadedParentTileCache = function _updateLoadedParentTileCache() {\n this._loadedParentTiles = {};\n for (var tileKey in this._tiles) {\n var path = [];\n var parentTile = void 0;\n var currentId = this._tiles[tileKey].tileID;\n while (currentId.overscaledZ > 0) {\n if (currentId.key in this._loadedParentTiles) {\n parentTile = this._loadedParentTiles[currentId.key];\n break;\n }\n path.push(currentId.key);\n var parentId = currentId.scaledTo(currentId.overscaledZ - 1);\n parentTile = this._getLoadedTile(parentId);\n if (parentTile) {\n break;\n }\n currentId = parentId;\n }\n for (var i = 0, list = path; i < list.length; i += 1) {\n var key = list[i];\n this._loadedParentTiles[key] = parentTile;\n }\n }\n };\n SourceCache2.prototype._addTile = function _addTile(tileID) {\n var tile = this._tiles[tileID.key];\n if (tile) {\n return tile;\n }\n tile = this._cache.getAndRemove(tileID);\n if (tile) {\n this._setTileReloadTimer(tileID.key, tile);\n tile.tileID = tileID;\n this._state.initializeTileState(tile, this.map ? this.map.painter : null);\n if (this._cacheTimers[tileID.key]) {\n clearTimeout(this._cacheTimers[tileID.key]);\n delete this._cacheTimers[tileID.key];\n this._setTileReloadTimer(tileID.key, tile);\n }\n }\n var cached = Boolean(tile);\n if (!cached) {\n tile = new performance2.Tile(tileID, this._source.tileSize * tileID.overscaleFactor());\n this._loadTile(tile, this._tileLoaded.bind(this, tile, tileID.key, tile.state));\n }\n if (!tile) {\n return null;\n }\n tile.uses++;\n this._tiles[tileID.key] = tile;\n if (!cached) {\n this._source.fire(new performance2.Event(\"dataloading\", {\n tile,\n coord: tile.tileID,\n dataType: \"source\"\n }));\n }\n return tile;\n };\n SourceCache2.prototype._setTileReloadTimer = function _setTileReloadTimer(id, tile) {\n var this$1 = this;\n if (id in this._timers) {\n clearTimeout(this._timers[id]);\n delete this._timers[id];\n }\n var expiryTimeout = tile.getExpiryTimeout();\n if (expiryTimeout) {\n this._timers[id] = setTimeout(function() {\n this$1._reloadTile(id, \"expired\");\n delete this$1._timers[id];\n }, expiryTimeout);\n }\n };\n SourceCache2.prototype._removeTile = function _removeTile(id) {\n var tile = this._tiles[id];\n if (!tile) {\n return;\n }\n tile.uses--;\n delete this._tiles[id];\n if (this._timers[id]) {\n clearTimeout(this._timers[id]);\n delete this._timers[id];\n }\n if (tile.uses > 0) {\n return;\n }\n if (tile.hasData() && tile.state !== \"reloading\") {\n this._cache.add(tile.tileID, tile, tile.getExpiryTimeout());\n } else {\n tile.aborted = true;\n this._abortTile(tile);\n this._unloadTile(tile);\n }\n };\n SourceCache2.prototype.clearTiles = function clearTiles() {\n this._shouldReloadOnResume = false;\n this._paused = false;\n for (var id in this._tiles) {\n this._removeTile(id);\n }\n this._cache.reset();\n };\n SourceCache2.prototype.tilesIn = function tilesIn(pointQueryGeometry, maxPitchScaleFactor, has3DLayer) {\n var this$1 = this;\n var tileResults = [];\n var transform = this.transform;\n if (!transform) {\n return tileResults;\n }\n var cameraPointQueryGeometry = has3DLayer ? transform.getCameraQueryGeometry(pointQueryGeometry) : pointQueryGeometry;\n var queryGeometry = pointQueryGeometry.map(function(p2) {\n return transform.pointCoordinate(p2);\n });\n var cameraQueryGeometry = cameraPointQueryGeometry.map(function(p2) {\n return transform.pointCoordinate(p2);\n });\n var ids = this.getIds();\n var minX = Infinity;\n var minY = Infinity;\n var maxX = -Infinity;\n var maxY = -Infinity;\n for (var i$1 = 0, list = cameraQueryGeometry; i$1 < list.length; i$1 += 1) {\n var p = list[i$1];\n minX = Math.min(minX, p.x);\n minY = Math.min(minY, p.y);\n maxX = Math.max(maxX, p.x);\n maxY = Math.max(maxY, p.y);\n }\n var loop = function(i2) {\n var tile = this$1._tiles[ids[i2]];\n if (tile.holdingForFade()) {\n return;\n }\n var tileID = tile.tileID;\n var scale = Math.pow(2, transform.zoom - tile.tileID.overscaledZ);\n var queryPadding = maxPitchScaleFactor * tile.queryPadding * performance2.EXTENT / tile.tileSize / scale;\n var tileSpaceBounds = [\n tileID.getTilePoint(new performance2.MercatorCoordinate(minX, minY)),\n tileID.getTilePoint(new performance2.MercatorCoordinate(maxX, maxY))\n ];\n if (tileSpaceBounds[0].x - queryPadding < performance2.EXTENT && tileSpaceBounds[0].y - queryPadding < performance2.EXTENT && tileSpaceBounds[1].x + queryPadding >= 0 && tileSpaceBounds[1].y + queryPadding >= 0) {\n var tileSpaceQueryGeometry = queryGeometry.map(function(c) {\n return tileID.getTilePoint(c);\n });\n var tileSpaceCameraQueryGeometry = cameraQueryGeometry.map(function(c) {\n return tileID.getTilePoint(c);\n });\n tileResults.push({\n tile,\n tileID,\n queryGeometry: tileSpaceQueryGeometry,\n cameraQueryGeometry: tileSpaceCameraQueryGeometry,\n scale\n });\n }\n };\n for (var i = 0; i < ids.length; i++)\n loop(i);\n return tileResults;\n };\n SourceCache2.prototype.getVisibleCoordinates = function getVisibleCoordinates(symbolLayer) {\n var this$1 = this;\n var coords = this.getRenderableIds(symbolLayer).map(function(id) {\n return this$1._tiles[id].tileID;\n });\n for (var i = 0, list = coords; i < list.length; i += 1) {\n var coord = list[i];\n coord.posMatrix = this.transform.calculatePosMatrix(coord.toUnwrapped());\n }\n return coords;\n };\n SourceCache2.prototype.hasTransition = function hasTransition() {\n if (this._source.hasTransition()) {\n return true;\n }\n if (isRasterType(this._source.type)) {\n for (var id in this._tiles) {\n var tile = this._tiles[id];\n if (tile.fadeEndTime !== void 0 && tile.fadeEndTime >= performance2.browser.now()) {\n return true;\n }\n }\n }\n return false;\n };\n SourceCache2.prototype.setFeatureState = function setFeatureState(sourceLayer, featureId, state) {\n sourceLayer = sourceLayer || \"_geojsonTileLayer\";\n this._state.updateState(sourceLayer, featureId, state);\n };\n SourceCache2.prototype.removeFeatureState = function removeFeatureState(sourceLayer, featureId, key) {\n sourceLayer = sourceLayer || \"_geojsonTileLayer\";\n this._state.removeFeatureState(sourceLayer, featureId, key);\n };\n SourceCache2.prototype.getFeatureState = function getFeatureState(sourceLayer, featureId) {\n sourceLayer = sourceLayer || \"_geojsonTileLayer\";\n return this._state.getState(sourceLayer, featureId);\n };\n SourceCache2.prototype.setDependencies = function setDependencies(tileKey, namespace, dependencies) {\n var tile = this._tiles[tileKey];\n if (tile) {\n tile.setDependencies(namespace, dependencies);\n }\n };\n SourceCache2.prototype.reloadTilesForDependencies = function reloadTilesForDependencies(namespaces, keys) {\n for (var id in this._tiles) {\n var tile = this._tiles[id];\n if (tile.hasDependency(namespaces, keys)) {\n this._reloadTile(id, \"reloading\");\n }\n }\n this._cache.filter(function(tile2) {\n return !tile2.hasDependency(namespaces, keys);\n });\n };\n return SourceCache2;\n }(performance2.Evented);\n SourceCache.maxOverzooming = 10;\n SourceCache.maxUnderzooming = 3;\n function compareTileId(a, b) {\n var aWrap = Math.abs(a.wrap * 2) - +(a.wrap < 0);\n var bWrap = Math.abs(b.wrap * 2) - +(b.wrap < 0);\n return a.overscaledZ - b.overscaledZ || bWrap - aWrap || b.canonical.y - a.canonical.y || b.canonical.x - a.canonical.x;\n }\n function isRasterType(type) {\n return type === \"raster\" || type === \"image\" || type === \"video\";\n }\n function WebWorker() {\n return new performance2.window.Worker(exported.workerUrl);\n }\n var PRELOAD_POOL_ID = \"mapboxgl_preloaded_worker_pool\";\n var WorkerPool = function WorkerPool2() {\n this.active = {};\n };\n WorkerPool.prototype.acquire = function acquire(mapId) {\n if (!this.workers) {\n this.workers = [];\n while (this.workers.length < WorkerPool.workerCount) {\n this.workers.push(new WebWorker());\n }\n }\n this.active[mapId] = true;\n return this.workers.slice();\n };\n WorkerPool.prototype.release = function release(mapId) {\n delete this.active[mapId];\n if (this.numActive() === 0) {\n this.workers.forEach(function(w) {\n w.terminate();\n });\n this.workers = null;\n }\n };\n WorkerPool.prototype.isPreloaded = function isPreloaded() {\n return !!this.active[PRELOAD_POOL_ID];\n };\n WorkerPool.prototype.numActive = function numActive() {\n return Object.keys(this.active).length;\n };\n var availableLogicalProcessors = Math.floor(performance2.browser.hardwareConcurrency / 2);\n WorkerPool.workerCount = Math.max(Math.min(availableLogicalProcessors, 6), 1);\n var globalWorkerPool;\n function getGlobalWorkerPool() {\n if (!globalWorkerPool) {\n globalWorkerPool = new WorkerPool();\n }\n return globalWorkerPool;\n }\n function prewarm() {\n var workerPool = getGlobalWorkerPool();\n workerPool.acquire(PRELOAD_POOL_ID);\n }\n function clearPrewarmedResources() {\n var pool = globalWorkerPool;\n if (pool) {\n if (pool.isPreloaded() && pool.numActive() === 1) {\n pool.release(PRELOAD_POOL_ID);\n globalWorkerPool = null;\n } else {\n console.warn(\"Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()\");\n }\n }\n }\n function deref(layer, parent) {\n var result = {};\n for (var k in layer) {\n if (k !== \"ref\") {\n result[k] = layer[k];\n }\n }\n performance2.refProperties.forEach(function(k2) {\n if (k2 in parent) {\n result[k2] = parent[k2];\n }\n });\n return result;\n }\n function derefLayers(layers) {\n layers = layers.slice();\n var map = /* @__PURE__ */ Object.create(null);\n for (var i = 0; i < layers.length; i++) {\n map[layers[i].id] = layers[i];\n }\n for (var i$1 = 0; i$1 < layers.length; i$1++) {\n if (\"ref\" in layers[i$1]) {\n layers[i$1] = deref(layers[i$1], map[layers[i$1].ref]);\n }\n }\n return layers;\n }\n function emptyStyle() {\n var style = {};\n var version = performance2.styleSpec[\"$version\"];\n for (var styleKey in performance2.styleSpec[\"$root\"]) {\n var spec = performance2.styleSpec[\"$root\"][styleKey];\n if (spec.required) {\n var value = null;\n if (styleKey === \"version\") {\n value = version;\n } else {\n if (spec.type === \"array\") {\n value = [];\n } else {\n value = {};\n }\n }\n if (value != null) {\n style[styleKey] = value;\n }\n }\n }\n return style;\n }\n var operations = {\n setStyle: \"setStyle\",\n addLayer: \"addLayer\",\n removeLayer: \"removeLayer\",\n setPaintProperty: \"setPaintProperty\",\n setLayoutProperty: \"setLayoutProperty\",\n setFilter: \"setFilter\",\n addSource: \"addSource\",\n removeSource: \"removeSource\",\n setGeoJSONSourceData: \"setGeoJSONSourceData\",\n setLayerZoomRange: \"setLayerZoomRange\",\n setLayerProperty: \"setLayerProperty\",\n setCenter: \"setCenter\",\n setZoom: \"setZoom\",\n setBearing: \"setBearing\",\n setPitch: \"setPitch\",\n setSprite: \"setSprite\",\n setGlyphs: \"setGlyphs\",\n setTransition: \"setTransition\",\n setLight: \"setLight\"\n };\n function addSource(sourceId, after, commands) {\n commands.push({\n command: operations.addSource,\n args: [\n sourceId,\n after[sourceId]\n ]\n });\n }\n function removeSource(sourceId, commands, sourcesRemoved) {\n commands.push({\n command: operations.removeSource,\n args: [sourceId]\n });\n sourcesRemoved[sourceId] = true;\n }\n function updateSource(sourceId, after, commands, sourcesRemoved) {\n removeSource(sourceId, commands, sourcesRemoved);\n addSource(sourceId, after, commands);\n }\n function canUpdateGeoJSON(before, after, sourceId) {\n var prop;\n for (prop in before[sourceId]) {\n if (!before[sourceId].hasOwnProperty(prop)) {\n continue;\n }\n if (prop !== \"data\" && !performance2.deepEqual(before[sourceId][prop], after[sourceId][prop])) {\n return false;\n }\n }\n for (prop in after[sourceId]) {\n if (!after[sourceId].hasOwnProperty(prop)) {\n continue;\n }\n if (prop !== \"data\" && !performance2.deepEqual(before[sourceId][prop], after[sourceId][prop])) {\n return false;\n }\n }\n return true;\n }\n function diffSources(before, after, commands, sourcesRemoved) {\n before = before || {};\n after = after || {};\n var sourceId;\n for (sourceId in before) {\n if (!before.hasOwnProperty(sourceId)) {\n continue;\n }\n if (!after.hasOwnProperty(sourceId)) {\n removeSource(sourceId, commands, sourcesRemoved);\n }\n }\n for (sourceId in after) {\n if (!after.hasOwnProperty(sourceId)) {\n continue;\n }\n if (!before.hasOwnProperty(sourceId)) {\n addSource(sourceId, after, commands);\n } else if (!performance2.deepEqual(before[sourceId], after[sourceId])) {\n if (before[sourceId].type === \"geojson\" && after[sourceId].type === \"geojson\" && canUpdateGeoJSON(before, after, sourceId)) {\n commands.push({\n command: operations.setGeoJSONSourceData,\n args: [\n sourceId,\n after[sourceId].data\n ]\n });\n } else {\n updateSource(sourceId, after, commands, sourcesRemoved);\n }\n }\n }\n }\n function diffLayerPropertyChanges(before, after, commands, layerId, klass, command) {\n before = before || {};\n after = after || {};\n var prop;\n for (prop in before) {\n if (!before.hasOwnProperty(prop)) {\n continue;\n }\n if (!performance2.deepEqual(before[prop], after[prop])) {\n commands.push({\n command,\n args: [\n layerId,\n prop,\n after[prop],\n klass\n ]\n });\n }\n }\n for (prop in after) {\n if (!after.hasOwnProperty(prop) || before.hasOwnProperty(prop)) {\n continue;\n }\n if (!performance2.deepEqual(before[prop], after[prop])) {\n commands.push({\n command,\n args: [\n layerId,\n prop,\n after[prop],\n klass\n ]\n });\n }\n }\n }\n function pluckId(layer) {\n return layer.id;\n }\n function indexById(group, layer) {\n group[layer.id] = layer;\n return group;\n }\n function diffLayers(before, after, commands) {\n before = before || [];\n after = after || [];\n var beforeOrder = before.map(pluckId);\n var afterOrder = after.map(pluckId);\n var beforeIndex = before.reduce(indexById, {});\n var afterIndex = after.reduce(indexById, {});\n var tracker = beforeOrder.slice();\n var clean = /* @__PURE__ */ Object.create(null);\n var i, d, layerId, beforeLayer, afterLayer, insertBeforeLayerId, prop;\n for (i = 0, d = 0; i < beforeOrder.length; i++) {\n layerId = beforeOrder[i];\n if (!afterIndex.hasOwnProperty(layerId)) {\n commands.push({\n command: operations.removeLayer,\n args: [layerId]\n });\n tracker.splice(tracker.indexOf(layerId, d), 1);\n } else {\n d++;\n }\n }\n for (i = 0, d = 0; i < afterOrder.length; i++) {\n layerId = afterOrder[afterOrder.length - 1 - i];\n if (tracker[tracker.length - 1 - i] === layerId) {\n continue;\n }\n if (beforeIndex.hasOwnProperty(layerId)) {\n commands.push({\n command: operations.removeLayer,\n args: [layerId]\n });\n tracker.splice(tracker.lastIndexOf(layerId, tracker.length - d), 1);\n } else {\n d++;\n }\n insertBeforeLayerId = tracker[tracker.length - i];\n commands.push({\n command: operations.addLayer,\n args: [\n afterIndex[layerId],\n insertBeforeLayerId\n ]\n });\n tracker.splice(tracker.length - i, 0, layerId);\n clean[layerId] = true;\n }\n for (i = 0; i < afterOrder.length; i++) {\n layerId = afterOrder[i];\n beforeLayer = beforeIndex[layerId];\n afterLayer = afterIndex[layerId];\n if (clean[layerId] || performance2.deepEqual(beforeLayer, afterLayer)) {\n continue;\n }\n if (!performance2.deepEqual(beforeLayer.source, afterLayer.source) || !performance2.deepEqual(beforeLayer[\"source-layer\"], afterLayer[\"source-layer\"]) || !performance2.deepEqual(beforeLayer.type, afterLayer.type)) {\n commands.push({\n command: operations.removeLayer,\n args: [layerId]\n });\n insertBeforeLayerId = tracker[tracker.lastIndexOf(layerId) + 1];\n commands.push({\n command: operations.addLayer,\n args: [\n afterLayer,\n insertBeforeLayerId\n ]\n });\n continue;\n }\n diffLayerPropertyChanges(beforeLayer.layout, afterLayer.layout, commands, layerId, null, operations.setLayoutProperty);\n diffLayerPropertyChanges(beforeLayer.paint, afterLayer.paint, commands, layerId, null, operations.setPaintProperty);\n if (!performance2.deepEqual(beforeLayer.filter, afterLayer.filter)) {\n commands.push({\n command: operations.setFilter,\n args: [\n layerId,\n afterLayer.filter\n ]\n });\n }\n if (!performance2.deepEqual(beforeLayer.minzoom, afterLayer.minzoom) || !performance2.deepEqual(beforeLayer.maxzoom, afterLayer.maxzoom)) {\n commands.push({\n command: operations.setLayerZoomRange,\n args: [\n layerId,\n afterLayer.minzoom,\n afterLayer.maxzoom\n ]\n });\n }\n for (prop in beforeLayer) {\n if (!beforeLayer.hasOwnProperty(prop)) {\n continue;\n }\n if (prop === \"layout\" || prop === \"paint\" || prop === \"filter\" || prop === \"metadata\" || prop === \"minzoom\" || prop === \"maxzoom\") {\n continue;\n }\n if (prop.indexOf(\"paint.\") === 0) {\n diffLayerPropertyChanges(beforeLayer[prop], afterLayer[prop], commands, layerId, prop.slice(6), operations.setPaintProperty);\n } else if (!performance2.deepEqual(beforeLayer[prop], afterLayer[prop])) {\n commands.push({\n command: operations.setLayerProperty,\n args: [\n layerId,\n prop,\n afterLayer[prop]\n ]\n });\n }\n }\n for (prop in afterLayer) {\n if (!afterLayer.hasOwnProperty(prop) || beforeLayer.hasOwnProperty(prop)) {\n continue;\n }\n if (prop === \"layout\" || prop === \"paint\" || prop === \"filter\" || prop === \"metadata\" || prop === \"minzoom\" || prop === \"maxzoom\") {\n continue;\n }\n if (prop.indexOf(\"paint.\") === 0) {\n diffLayerPropertyChanges(beforeLayer[prop], afterLayer[prop], commands, layerId, prop.slice(6), operations.setPaintProperty);\n } else if (!performance2.deepEqual(beforeLayer[prop], afterLayer[prop])) {\n commands.push({\n command: operations.setLayerProperty,\n args: [\n layerId,\n prop,\n afterLayer[prop]\n ]\n });\n }\n }\n }\n }\n function diffStyles(before, after) {\n if (!before) {\n return [{\n command: operations.setStyle,\n args: [after]\n }];\n }\n var commands = [];\n try {\n if (!performance2.deepEqual(before.version, after.version)) {\n return [{\n command: operations.setStyle,\n args: [after]\n }];\n }\n if (!performance2.deepEqual(before.center, after.center)) {\n commands.push({\n command: operations.setCenter,\n args: [after.center]\n });\n }\n if (!performance2.deepEqual(before.zoom, after.zoom)) {\n commands.push({\n command: operations.setZoom,\n args: [after.zoom]\n });\n }\n if (!performance2.deepEqual(before.bearing, after.bearing)) {\n commands.push({\n command: operations.setBearing,\n args: [after.bearing]\n });\n }\n if (!performance2.deepEqual(before.pitch, after.pitch)) {\n commands.push({\n command: operations.setPitch,\n args: [after.pitch]\n });\n }\n if (!performance2.deepEqual(before.sprite, after.sprite)) {\n commands.push({\n command: operations.setSprite,\n args: [after.sprite]\n });\n }\n if (!performance2.deepEqual(before.glyphs, after.glyphs)) {\n commands.push({\n command: operations.setGlyphs,\n args: [after.glyphs]\n });\n }\n if (!performance2.deepEqual(before.transition, after.transition)) {\n commands.push({\n command: operations.setTransition,\n args: [after.transition]\n });\n }\n if (!performance2.deepEqual(before.light, after.light)) {\n commands.push({\n command: operations.setLight,\n args: [after.light]\n });\n }\n var sourcesRemoved = {};\n var removeOrAddSourceCommands = [];\n diffSources(before.sources, after.sources, removeOrAddSourceCommands, sourcesRemoved);\n var beforeLayers = [];\n if (before.layers) {\n before.layers.forEach(function(layer) {\n if (sourcesRemoved[layer.source]) {\n commands.push({\n command: operations.removeLayer,\n args: [layer.id]\n });\n } else {\n beforeLayers.push(layer);\n }\n });\n }\n commands = commands.concat(removeOrAddSourceCommands);\n diffLayers(beforeLayers, after.layers, commands);\n } catch (e) {\n console.warn(\"Unable to compute style diff:\", e);\n commands = [{\n command: operations.setStyle,\n args: [after]\n }];\n }\n return commands;\n }\n var PathInterpolator = function PathInterpolator2(points_, padding_) {\n this.reset(points_, padding_);\n };\n PathInterpolator.prototype.reset = function reset(points_, padding_) {\n this.points = points_ || [];\n this._distances = [0];\n for (var i = 1; i < this.points.length; i++) {\n this._distances[i] = this._distances[i - 1] + this.points[i].dist(this.points[i - 1]);\n }\n this.length = this._distances[this._distances.length - 1];\n this.padding = Math.min(padding_ || 0, this.length * 0.5);\n this.paddedLength = this.length - this.padding * 2;\n };\n PathInterpolator.prototype.lerp = function lerp(t) {\n if (this.points.length === 1) {\n return this.points[0];\n }\n t = performance2.clamp(t, 0, 1);\n var currentIndex = 1;\n var distOfCurrentIdx = this._distances[currentIndex];\n var distToTarget = t * this.paddedLength + this.padding;\n while (distOfCurrentIdx < distToTarget && currentIndex < this._distances.length) {\n distOfCurrentIdx = this._distances[++currentIndex];\n }\n var idxOfPrevPoint = currentIndex - 1;\n var distOfPrevIdx = this._distances[idxOfPrevPoint];\n var segmentLength = distOfCurrentIdx - distOfPrevIdx;\n var segmentT = segmentLength > 0 ? (distToTarget - distOfPrevIdx) / segmentLength : 0;\n return this.points[idxOfPrevPoint].mult(1 - segmentT).add(this.points[currentIndex].mult(segmentT));\n };\n var GridIndex = function GridIndex2(width, height, cellSize) {\n var boxCells = this.boxCells = [];\n var circleCells = this.circleCells = [];\n this.xCellCount = Math.ceil(width / cellSize);\n this.yCellCount = Math.ceil(height / cellSize);\n for (var i = 0; i < this.xCellCount * this.yCellCount; i++) {\n boxCells.push([]);\n circleCells.push([]);\n }\n this.circleKeys = [];\n this.boxKeys = [];\n this.bboxes = [];\n this.circles = [];\n this.width = width;\n this.height = height;\n this.xScale = this.xCellCount / width;\n this.yScale = this.yCellCount / height;\n this.boxUid = 0;\n this.circleUid = 0;\n };\n GridIndex.prototype.keysLength = function keysLength() {\n return this.boxKeys.length + this.circleKeys.length;\n };\n GridIndex.prototype.insert = function insert(key, x1, y1, x2, y2) {\n this._forEachCell(x1, y1, x2, y2, this._insertBoxCell, this.boxUid++);\n this.boxKeys.push(key);\n this.bboxes.push(x1);\n this.bboxes.push(y1);\n this.bboxes.push(x2);\n this.bboxes.push(y2);\n };\n GridIndex.prototype.insertCircle = function insertCircle(key, x, y, radius) {\n this._forEachCell(x - radius, y - radius, x + radius, y + radius, this._insertCircleCell, this.circleUid++);\n this.circleKeys.push(key);\n this.circles.push(x);\n this.circles.push(y);\n this.circles.push(radius);\n };\n GridIndex.prototype._insertBoxCell = function _insertBoxCell(x1, y1, x2, y2, cellIndex, uid) {\n this.boxCells[cellIndex].push(uid);\n };\n GridIndex.prototype._insertCircleCell = function _insertCircleCell(x1, y1, x2, y2, cellIndex, uid) {\n this.circleCells[cellIndex].push(uid);\n };\n GridIndex.prototype._query = function _query(x1, y1, x2, y2, hitTest, predicate) {\n if (x2 < 0 || x1 > this.width || y2 < 0 || y1 > this.height) {\n return hitTest ? false : [];\n }\n var result = [];\n if (x1 <= 0 && y1 <= 0 && this.width <= x2 && this.height <= y2) {\n if (hitTest) {\n return true;\n }\n for (var boxUid = 0; boxUid < this.boxKeys.length; boxUid++) {\n result.push({\n key: this.boxKeys[boxUid],\n x1: this.bboxes[boxUid * 4],\n y1: this.bboxes[boxUid * 4 + 1],\n x2: this.bboxes[boxUid * 4 + 2],\n y2: this.bboxes[boxUid * 4 + 3]\n });\n }\n for (var circleUid = 0; circleUid < this.circleKeys.length; circleUid++) {\n var x = this.circles[circleUid * 3];\n var y = this.circles[circleUid * 3 + 1];\n var radius = this.circles[circleUid * 3 + 2];\n result.push({\n key: this.circleKeys[circleUid],\n x1: x - radius,\n y1: y - radius,\n x2: x + radius,\n y2: y + radius\n });\n }\n return predicate ? result.filter(predicate) : result;\n } else {\n var queryArgs = {\n hitTest,\n seenUids: {\n box: {},\n circle: {}\n }\n };\n this._forEachCell(x1, y1, x2, y2, this._queryCell, result, queryArgs, predicate);\n return hitTest ? result.length > 0 : result;\n }\n };\n GridIndex.prototype._queryCircle = function _queryCircle(x, y, radius, hitTest, predicate) {\n var x1 = x - radius;\n var x2 = x + radius;\n var y1 = y - radius;\n var y2 = y + radius;\n if (x2 < 0 || x1 > this.width || y2 < 0 || y1 > this.height) {\n return hitTest ? false : [];\n }\n var result = [];\n var queryArgs = {\n hitTest,\n circle: {\n x,\n y,\n radius\n },\n seenUids: {\n box: {},\n circle: {}\n }\n };\n this._forEachCell(x1, y1, x2, y2, this._queryCellCircle, result, queryArgs, predicate);\n return hitTest ? result.length > 0 : result;\n };\n GridIndex.prototype.query = function query(x1, y1, x2, y2, predicate) {\n return this._query(x1, y1, x2, y2, false, predicate);\n };\n GridIndex.prototype.hitTest = function hitTest(x1, y1, x2, y2, predicate) {\n return this._query(x1, y1, x2, y2, true, predicate);\n };\n GridIndex.prototype.hitTestCircle = function hitTestCircle(x, y, radius, predicate) {\n return this._queryCircle(x, y, radius, true, predicate);\n };\n GridIndex.prototype._queryCell = function _queryCell(x1, y1, x2, y2, cellIndex, result, queryArgs, predicate) {\n var seenUids = queryArgs.seenUids;\n var boxCell = this.boxCells[cellIndex];\n if (boxCell !== null) {\n var bboxes = this.bboxes;\n for (var i = 0, list = boxCell; i < list.length; i += 1) {\n var boxUid = list[i];\n if (!seenUids.box[boxUid]) {\n seenUids.box[boxUid] = true;\n var offset = boxUid * 4;\n if (x1 <= bboxes[offset + 2] && y1 <= bboxes[offset + 3] && x2 >= bboxes[offset + 0] && y2 >= bboxes[offset + 1] && (!predicate || predicate(this.boxKeys[boxUid]))) {\n if (queryArgs.hitTest) {\n result.push(true);\n return true;\n } else {\n result.push({\n key: this.boxKeys[boxUid],\n x1: bboxes[offset],\n y1: bboxes[offset + 1],\n x2: bboxes[offset + 2],\n y2: bboxes[offset + 3]\n });\n }\n }\n }\n }\n }\n var circleCell = this.circleCells[cellIndex];\n if (circleCell !== null) {\n var circles = this.circles;\n for (var i$1 = 0, list$1 = circleCell; i$1 < list$1.length; i$1 += 1) {\n var circleUid = list$1[i$1];\n if (!seenUids.circle[circleUid]) {\n seenUids.circle[circleUid] = true;\n var offset$1 = circleUid * 3;\n if (this._circleAndRectCollide(circles[offset$1], circles[offset$1 + 1], circles[offset$1 + 2], x1, y1, x2, y2) && (!predicate || predicate(this.circleKeys[circleUid]))) {\n if (queryArgs.hitTest) {\n result.push(true);\n return true;\n } else {\n var x = circles[offset$1];\n var y = circles[offset$1 + 1];\n var radius = circles[offset$1 + 2];\n result.push({\n key: this.circleKeys[circleUid],\n x1: x - radius,\n y1: y - radius,\n x2: x + radius,\n y2: y + radius\n });\n }\n }\n }\n }\n }\n };\n GridIndex.prototype._queryCellCircle = function _queryCellCircle(x1, y1, x2, y2, cellIndex, result, queryArgs, predicate) {\n var circle2 = queryArgs.circle;\n var seenUids = queryArgs.seenUids;\n var boxCell = this.boxCells[cellIndex];\n if (boxCell !== null) {\n var bboxes = this.bboxes;\n for (var i = 0, list = boxCell; i < list.length; i += 1) {\n var boxUid = list[i];\n if (!seenUids.box[boxUid]) {\n seenUids.box[boxUid] = true;\n var offset = boxUid * 4;\n if (this._circleAndRectCollide(circle2.x, circle2.y, circle2.radius, bboxes[offset + 0], bboxes[offset + 1], bboxes[offset + 2], bboxes[offset + 3]) && (!predicate || predicate(this.boxKeys[boxUid]))) {\n result.push(true);\n return true;\n }\n }\n }\n }\n var circleCell = this.circleCells[cellIndex];\n if (circleCell !== null) {\n var circles = this.circles;\n for (var i$1 = 0, list$1 = circleCell; i$1 < list$1.length; i$1 += 1) {\n var circleUid = list$1[i$1];\n if (!seenUids.circle[circleUid]) {\n seenUids.circle[circleUid] = true;\n var offset$1 = circleUid * 3;\n if (this._circlesCollide(circles[offset$1], circles[offset$1 + 1], circles[offset$1 + 2], circle2.x, circle2.y, circle2.radius) && (!predicate || predicate(this.circleKeys[circleUid]))) {\n result.push(true);\n return true;\n }\n }\n }\n }\n };\n GridIndex.prototype._forEachCell = function _forEachCell(x1, y1, x2, y2, fn, arg1, arg2, predicate) {\n var cx1 = this._convertToXCellCoord(x1);\n var cy1 = this._convertToYCellCoord(y1);\n var cx2 = this._convertToXCellCoord(x2);\n var cy2 = this._convertToYCellCoord(y2);\n for (var x = cx1; x <= cx2; x++) {\n for (var y = cy1; y <= cy2; y++) {\n var cellIndex = this.xCellCount * y + x;\n if (fn.call(this, x1, y1, x2, y2, cellIndex, arg1, arg2, predicate)) {\n return;\n }\n }\n }\n };\n GridIndex.prototype._convertToXCellCoord = function _convertToXCellCoord(x) {\n return Math.max(0, Math.min(this.xCellCount - 1, Math.floor(x * this.xScale)));\n };\n GridIndex.prototype._convertToYCellCoord = function _convertToYCellCoord(y) {\n return Math.max(0, Math.min(this.yCellCount - 1, Math.floor(y * this.yScale)));\n };\n GridIndex.prototype._circlesCollide = function _circlesCollide(x1, y1, r1, x2, y2, r2) {\n var dx = x2 - x1;\n var dy = y2 - y1;\n var bothRadii = r1 + r2;\n return bothRadii * bothRadii > dx * dx + dy * dy;\n };\n GridIndex.prototype._circleAndRectCollide = function _circleAndRectCollide(circleX, circleY, radius, x1, y1, x2, y2) {\n var halfRectWidth = (x2 - x1) / 2;\n var distX = Math.abs(circleX - (x1 + halfRectWidth));\n if (distX > halfRectWidth + radius) {\n return false;\n }\n var halfRectHeight = (y2 - y1) / 2;\n var distY = Math.abs(circleY - (y1 + halfRectHeight));\n if (distY > halfRectHeight + radius) {\n return false;\n }\n if (distX <= halfRectWidth || distY <= halfRectHeight) {\n return true;\n }\n var dx = distX - halfRectWidth;\n var dy = distY - halfRectHeight;\n return dx * dx + dy * dy <= radius * radius;\n };\n function getLabelPlaneMatrix(posMatrix, pitchWithMap, rotateWithMap, transform, pixelsToTileUnits2) {\n var m = performance2.create();\n if (pitchWithMap) {\n performance2.scale(m, m, [\n 1 / pixelsToTileUnits2,\n 1 / pixelsToTileUnits2,\n 1\n ]);\n if (!rotateWithMap) {\n performance2.rotateZ(m, m, transform.angle);\n }\n } else {\n performance2.multiply(m, transform.labelPlaneMatrix, posMatrix);\n }\n return m;\n }\n function getGlCoordMatrix(posMatrix, pitchWithMap, rotateWithMap, transform, pixelsToTileUnits2) {\n if (pitchWithMap) {\n var m = performance2.clone(posMatrix);\n performance2.scale(m, m, [\n pixelsToTileUnits2,\n pixelsToTileUnits2,\n 1\n ]);\n if (!rotateWithMap) {\n performance2.rotateZ(m, m, -transform.angle);\n }\n return m;\n } else {\n return transform.glCoordMatrix;\n }\n }\n function project(point, matrix) {\n var pos = [\n point.x,\n point.y,\n 0,\n 1\n ];\n xyTransformMat4(pos, pos, matrix);\n var w = pos[3];\n return {\n point: new performance2.Point(pos[0] / w, pos[1] / w),\n signedDistanceFromCamera: w\n };\n }\n function getPerspectiveRatio(cameraToCenterDistance, signedDistanceFromCamera) {\n return 0.5 + 0.5 * (cameraToCenterDistance / signedDistanceFromCamera);\n }\n function isVisible(anchorPos, clippingBuffer) {\n var x = anchorPos[0] / anchorPos[3];\n var y = anchorPos[1] / anchorPos[3];\n var inPaddedViewport = x >= -clippingBuffer[0] && x <= clippingBuffer[0] && y >= -clippingBuffer[1] && y <= clippingBuffer[1];\n return inPaddedViewport;\n }\n function updateLineLabels(bucket, posMatrix, painter, isText, labelPlaneMatrix, glCoordMatrix, pitchWithMap, keepUpright) {\n var sizeData = isText ? bucket.textSizeData : bucket.iconSizeData;\n var partiallyEvaluatedSize = performance2.evaluateSizeForZoom(sizeData, painter.transform.zoom);\n var clippingBuffer = [\n 256 / painter.width * 2 + 1,\n 256 / painter.height * 2 + 1\n ];\n var dynamicLayoutVertexArray = isText ? bucket.text.dynamicLayoutVertexArray : bucket.icon.dynamicLayoutVertexArray;\n dynamicLayoutVertexArray.clear();\n var lineVertexArray = bucket.lineVertexArray;\n var placedSymbols = isText ? bucket.text.placedSymbolArray : bucket.icon.placedSymbolArray;\n var aspectRatio = painter.transform.width / painter.transform.height;\n var useVertical = false;\n for (var s = 0; s < placedSymbols.length; s++) {\n var symbol = placedSymbols.get(s);\n if (symbol.hidden || symbol.writingMode === performance2.WritingMode.vertical && !useVertical) {\n hideGlyphs(symbol.numGlyphs, dynamicLayoutVertexArray);\n continue;\n }\n useVertical = false;\n var anchorPos = [\n symbol.anchorX,\n symbol.anchorY,\n 0,\n 1\n ];\n performance2.transformMat4(anchorPos, anchorPos, posMatrix);\n if (!isVisible(anchorPos, clippingBuffer)) {\n hideGlyphs(symbol.numGlyphs, dynamicLayoutVertexArray);\n continue;\n }\n var cameraToAnchorDistance = anchorPos[3];\n var perspectiveRatio = getPerspectiveRatio(painter.transform.cameraToCenterDistance, cameraToAnchorDistance);\n var fontSize = performance2.evaluateSizeForFeature(sizeData, partiallyEvaluatedSize, symbol);\n var pitchScaledFontSize = pitchWithMap ? fontSize / perspectiveRatio : fontSize * perspectiveRatio;\n var tileAnchorPoint = new performance2.Point(symbol.anchorX, symbol.anchorY);\n var anchorPoint = project(tileAnchorPoint, labelPlaneMatrix).point;\n var projectionCache = {};\n var placeUnflipped = placeGlyphsAlongLine(symbol, pitchScaledFontSize, false, keepUpright, posMatrix, labelPlaneMatrix, glCoordMatrix, bucket.glyphOffsetArray, lineVertexArray, dynamicLayoutVertexArray, anchorPoint, tileAnchorPoint, projectionCache, aspectRatio);\n useVertical = placeUnflipped.useVertical;\n if (placeUnflipped.notEnoughRoom || useVertical || placeUnflipped.needsFlipping && placeGlyphsAlongLine(symbol, pitchScaledFontSize, true, keepUpright, posMatrix, labelPlaneMatrix, glCoordMatrix, bucket.glyphOffsetArray, lineVertexArray, dynamicLayoutVertexArray, anchorPoint, tileAnchorPoint, projectionCache, aspectRatio).notEnoughRoom) {\n hideGlyphs(symbol.numGlyphs, dynamicLayoutVertexArray);\n }\n }\n if (isText) {\n bucket.text.dynamicLayoutVertexBuffer.updateData(dynamicLayoutVertexArray);\n } else {\n bucket.icon.dynamicLayoutVertexBuffer.updateData(dynamicLayoutVertexArray);\n }\n }\n function placeFirstAndLastGlyph(fontScale, glyphOffsetArray, lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol, lineVertexArray, labelPlaneMatrix, projectionCache) {\n var glyphEndIndex = symbol.glyphStartIndex + symbol.numGlyphs;\n var lineStartIndex = symbol.lineStartIndex;\n var lineEndIndex = symbol.lineStartIndex + symbol.lineLength;\n var firstGlyphOffset = glyphOffsetArray.getoffsetX(symbol.glyphStartIndex);\n var lastGlyphOffset = glyphOffsetArray.getoffsetX(glyphEndIndex - 1);\n var firstPlacedGlyph = placeGlyphAlongLine(fontScale * firstGlyphOffset, lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol.segment, lineStartIndex, lineEndIndex, lineVertexArray, labelPlaneMatrix, projectionCache);\n if (!firstPlacedGlyph) {\n return null;\n }\n var lastPlacedGlyph = placeGlyphAlongLine(fontScale * lastGlyphOffset, lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol.segment, lineStartIndex, lineEndIndex, lineVertexArray, labelPlaneMatrix, projectionCache);\n if (!lastPlacedGlyph) {\n return null;\n }\n return {\n first: firstPlacedGlyph,\n last: lastPlacedGlyph\n };\n }\n function requiresOrientationChange(writingMode, firstPoint, lastPoint, aspectRatio) {\n if (writingMode === performance2.WritingMode.horizontal) {\n var rise = Math.abs(lastPoint.y - firstPoint.y);\n var run = Math.abs(lastPoint.x - firstPoint.x) * aspectRatio;\n if (rise > run) {\n return { useVertical: true };\n }\n }\n if (writingMode === performance2.WritingMode.vertical ? firstPoint.y < lastPoint.y : firstPoint.x > lastPoint.x) {\n return { needsFlipping: true };\n }\n return null;\n }\n function placeGlyphsAlongLine(symbol, fontSize, flip, keepUpright, posMatrix, labelPlaneMatrix, glCoordMatrix, glyphOffsetArray, lineVertexArray, dynamicLayoutVertexArray, anchorPoint, tileAnchorPoint, projectionCache, aspectRatio) {\n var fontScale = fontSize / 24;\n var lineOffsetX = symbol.lineOffsetX * fontScale;\n var lineOffsetY = symbol.lineOffsetY * fontScale;\n var placedGlyphs;\n if (symbol.numGlyphs > 1) {\n var glyphEndIndex = symbol.glyphStartIndex + symbol.numGlyphs;\n var lineStartIndex = symbol.lineStartIndex;\n var lineEndIndex = symbol.lineStartIndex + symbol.lineLength;\n var firstAndLastGlyph = placeFirstAndLastGlyph(fontScale, glyphOffsetArray, lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol, lineVertexArray, labelPlaneMatrix, projectionCache);\n if (!firstAndLastGlyph) {\n return { notEnoughRoom: true };\n }\n var firstPoint = project(firstAndLastGlyph.first.point, glCoordMatrix).point;\n var lastPoint = project(firstAndLastGlyph.last.point, glCoordMatrix).point;\n if (keepUpright && !flip) {\n var orientationChange = requiresOrientationChange(symbol.writingMode, firstPoint, lastPoint, aspectRatio);\n if (orientationChange) {\n return orientationChange;\n }\n }\n placedGlyphs = [firstAndLastGlyph.first];\n for (var glyphIndex = symbol.glyphStartIndex + 1; glyphIndex < glyphEndIndex - 1; glyphIndex++) {\n placedGlyphs.push(placeGlyphAlongLine(fontScale * glyphOffsetArray.getoffsetX(glyphIndex), lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol.segment, lineStartIndex, lineEndIndex, lineVertexArray, labelPlaneMatrix, projectionCache));\n }\n placedGlyphs.push(firstAndLastGlyph.last);\n } else {\n if (keepUpright && !flip) {\n var a = project(tileAnchorPoint, posMatrix).point;\n var tileVertexIndex = symbol.lineStartIndex + symbol.segment + 1;\n var tileSegmentEnd = new performance2.Point(lineVertexArray.getx(tileVertexIndex), lineVertexArray.gety(tileVertexIndex));\n var projectedVertex = project(tileSegmentEnd, posMatrix);\n var b = projectedVertex.signedDistanceFromCamera > 0 ? projectedVertex.point : projectTruncatedLineSegment(tileAnchorPoint, tileSegmentEnd, a, 1, posMatrix);\n var orientationChange$1 = requiresOrientationChange(symbol.writingMode, a, b, aspectRatio);\n if (orientationChange$1) {\n return orientationChange$1;\n }\n }\n var singleGlyph = placeGlyphAlongLine(fontScale * glyphOffsetArray.getoffsetX(symbol.glyphStartIndex), lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol.segment, symbol.lineStartIndex, symbol.lineStartIndex + symbol.lineLength, lineVertexArray, labelPlaneMatrix, projectionCache);\n if (!singleGlyph) {\n return { notEnoughRoom: true };\n }\n placedGlyphs = [singleGlyph];\n }\n for (var i = 0, list = placedGlyphs; i < list.length; i += 1) {\n var glyph = list[i];\n performance2.addDynamicAttributes(dynamicLayoutVertexArray, glyph.point, glyph.angle);\n }\n return {};\n }\n function projectTruncatedLineSegment(previousTilePoint, currentTilePoint, previousProjectedPoint, minimumLength, projectionMatrix) {\n var projectedUnitVertex = project(previousTilePoint.add(previousTilePoint.sub(currentTilePoint)._unit()), projectionMatrix).point;\n var projectedUnitSegment = previousProjectedPoint.sub(projectedUnitVertex);\n return previousProjectedPoint.add(projectedUnitSegment._mult(minimumLength / projectedUnitSegment.mag()));\n }\n function placeGlyphAlongLine(offsetX, lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, anchorSegment, lineStartIndex, lineEndIndex, lineVertexArray, labelPlaneMatrix, projectionCache) {\n var combinedOffsetX = flip ? offsetX - lineOffsetX : offsetX + lineOffsetX;\n var dir = combinedOffsetX > 0 ? 1 : -1;\n var angle = 0;\n if (flip) {\n dir *= -1;\n angle = Math.PI;\n }\n if (dir < 0) {\n angle += Math.PI;\n }\n var currentIndex = dir > 0 ? lineStartIndex + anchorSegment : lineStartIndex + anchorSegment + 1;\n var current = anchorPoint;\n var prev = anchorPoint;\n var distanceToPrev = 0;\n var currentSegmentDistance = 0;\n var absOffsetX = Math.abs(combinedOffsetX);\n var pathVertices = [];\n while (distanceToPrev + currentSegmentDistance <= absOffsetX) {\n currentIndex += dir;\n if (currentIndex < lineStartIndex || currentIndex >= lineEndIndex) {\n return null;\n }\n prev = current;\n pathVertices.push(current);\n current = projectionCache[currentIndex];\n if (current === void 0) {\n var currentVertex = new performance2.Point(lineVertexArray.getx(currentIndex), lineVertexArray.gety(currentIndex));\n var projection = project(currentVertex, labelPlaneMatrix);\n if (projection.signedDistanceFromCamera > 0) {\n current = projectionCache[currentIndex] = projection.point;\n } else {\n var previousLineVertexIndex = currentIndex - dir;\n var previousTilePoint = distanceToPrev === 0 ? tileAnchorPoint : new performance2.Point(lineVertexArray.getx(previousLineVertexIndex), lineVertexArray.gety(previousLineVertexIndex));\n current = projectTruncatedLineSegment(previousTilePoint, currentVertex, prev, absOffsetX - distanceToPrev + 1, labelPlaneMatrix);\n }\n }\n distanceToPrev += currentSegmentDistance;\n currentSegmentDistance = prev.dist(current);\n }\n var segmentInterpolationT = (absOffsetX - distanceToPrev) / currentSegmentDistance;\n var prevToCurrent = current.sub(prev);\n var p = prevToCurrent.mult(segmentInterpolationT)._add(prev);\n p._add(prevToCurrent._unit()._perp()._mult(lineOffsetY * dir));\n var segmentAngle = angle + Math.atan2(current.y - prev.y, current.x - prev.x);\n pathVertices.push(p);\n return {\n point: p,\n angle: segmentAngle,\n path: pathVertices\n };\n }\n var hiddenGlyphAttributes = new Float32Array([\n -Infinity,\n -Infinity,\n 0,\n -Infinity,\n -Infinity,\n 0,\n -Infinity,\n -Infinity,\n 0,\n -Infinity,\n -Infinity,\n 0\n ]);\n function hideGlyphs(num, dynamicLayoutVertexArray) {\n for (var i = 0; i < num; i++) {\n var offset = dynamicLayoutVertexArray.length;\n dynamicLayoutVertexArray.resize(offset + 4);\n dynamicLayoutVertexArray.float32.set(hiddenGlyphAttributes, offset * 3);\n }\n }\n function xyTransformMat4(out, a, m) {\n var x = a[0], y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n out[3] = m[3] * x + m[7] * y + m[15];\n return out;\n }\n var viewportPadding = 100;\n var CollisionIndex = function CollisionIndex2(transform, grid, ignoredGrid) {\n if (grid === void 0)\n grid = new GridIndex(transform.width + 2 * viewportPadding, transform.height + 2 * viewportPadding, 25);\n if (ignoredGrid === void 0)\n ignoredGrid = new GridIndex(transform.width + 2 * viewportPadding, transform.height + 2 * viewportPadding, 25);\n this.transform = transform;\n this.grid = grid;\n this.ignoredGrid = ignoredGrid;\n this.pitchfactor = Math.cos(transform._pitch) * transform.cameraToCenterDistance;\n this.screenRightBoundary = transform.width + viewportPadding;\n this.screenBottomBoundary = transform.height + viewportPadding;\n this.gridRightBoundary = transform.width + 2 * viewportPadding;\n this.gridBottomBoundary = transform.height + 2 * viewportPadding;\n };\n CollisionIndex.prototype.placeCollisionBox = function placeCollisionBox(collisionBox2, allowOverlap, textPixelRatio, posMatrix, collisionGroupPredicate) {\n var projectedPoint = this.projectAndGetPerspectiveRatio(posMatrix, collisionBox2.anchorPointX, collisionBox2.anchorPointY);\n var tileToViewport = textPixelRatio * projectedPoint.perspectiveRatio;\n var tlX = collisionBox2.x1 * tileToViewport + projectedPoint.point.x;\n var tlY = collisionBox2.y1 * tileToViewport + projectedPoint.point.y;\n var brX = collisionBox2.x2 * tileToViewport + projectedPoint.point.x;\n var brY = collisionBox2.y2 * tileToViewport + projectedPoint.point.y;\n if (!this.isInsideGrid(tlX, tlY, brX, brY) || !allowOverlap && this.grid.hitTest(tlX, tlY, brX, brY, collisionGroupPredicate)) {\n return {\n box: [],\n offscreen: false\n };\n }\n return {\n box: [\n tlX,\n tlY,\n brX,\n brY\n ],\n offscreen: this.isOffscreen(tlX, tlY, brX, brY)\n };\n };\n CollisionIndex.prototype.placeCollisionCircles = function placeCollisionCircles(allowOverlap, symbol, lineVertexArray, glyphOffsetArray, fontSize, posMatrix, labelPlaneMatrix, labelToScreenMatrix, showCollisionCircles, pitchWithMap, collisionGroupPredicate, circlePixelDiameter, textPixelPadding) {\n var placedCollisionCircles = [];\n var tileUnitAnchorPoint = new performance2.Point(symbol.anchorX, symbol.anchorY);\n var screenAnchorPoint = project(tileUnitAnchorPoint, posMatrix);\n var perspectiveRatio = getPerspectiveRatio(this.transform.cameraToCenterDistance, screenAnchorPoint.signedDistanceFromCamera);\n var labelPlaneFontSize = pitchWithMap ? fontSize / perspectiveRatio : fontSize * perspectiveRatio;\n var labelPlaneFontScale = labelPlaneFontSize / performance2.ONE_EM;\n var labelPlaneAnchorPoint = project(tileUnitAnchorPoint, labelPlaneMatrix).point;\n var projectionCache = {};\n var lineOffsetX = symbol.lineOffsetX * labelPlaneFontScale;\n var lineOffsetY = symbol.lineOffsetY * labelPlaneFontScale;\n var firstAndLastGlyph = placeFirstAndLastGlyph(labelPlaneFontScale, glyphOffsetArray, lineOffsetX, lineOffsetY, false, labelPlaneAnchorPoint, tileUnitAnchorPoint, symbol, lineVertexArray, labelPlaneMatrix, projectionCache);\n var collisionDetected = false;\n var inGrid = false;\n var entirelyOffscreen = true;\n if (firstAndLastGlyph) {\n var radius = circlePixelDiameter * 0.5 * perspectiveRatio + textPixelPadding;\n var screenPlaneMin = new performance2.Point(-viewportPadding, -viewportPadding);\n var screenPlaneMax = new performance2.Point(this.screenRightBoundary, this.screenBottomBoundary);\n var interpolator = new PathInterpolator();\n var first = firstAndLastGlyph.first;\n var last = firstAndLastGlyph.last;\n var projectedPath = [];\n for (var i = first.path.length - 1; i >= 1; i--) {\n projectedPath.push(first.path[i]);\n }\n for (var i$1 = 1; i$1 < last.path.length; i$1++) {\n projectedPath.push(last.path[i$1]);\n }\n var circleDist = radius * 2.5;\n if (labelToScreenMatrix) {\n var screenSpacePath = projectedPath.map(function(p) {\n return project(p, labelToScreenMatrix);\n });\n if (screenSpacePath.some(function(point) {\n return point.signedDistanceFromCamera <= 0;\n })) {\n projectedPath = [];\n } else {\n projectedPath = screenSpacePath.map(function(p) {\n return p.point;\n });\n }\n }\n var segments = [];\n if (projectedPath.length > 0) {\n var minPoint = projectedPath[0].clone();\n var maxPoint = projectedPath[0].clone();\n for (var i$2 = 1; i$2 < projectedPath.length; i$2++) {\n minPoint.x = Math.min(minPoint.x, projectedPath[i$2].x);\n minPoint.y = Math.min(minPoint.y, projectedPath[i$2].y);\n maxPoint.x = Math.max(maxPoint.x, projectedPath[i$2].x);\n maxPoint.y = Math.max(maxPoint.y, projectedPath[i$2].y);\n }\n if (minPoint.x >= screenPlaneMin.x && maxPoint.x <= screenPlaneMax.x && minPoint.y >= screenPlaneMin.y && maxPoint.y <= screenPlaneMax.y) {\n segments = [projectedPath];\n } else if (maxPoint.x < screenPlaneMin.x || minPoint.x > screenPlaneMax.x || maxPoint.y < screenPlaneMin.y || minPoint.y > screenPlaneMax.y) {\n segments = [];\n } else {\n segments = performance2.clipLine([projectedPath], screenPlaneMin.x, screenPlaneMin.y, screenPlaneMax.x, screenPlaneMax.y);\n }\n }\n for (var i$4 = 0, list = segments; i$4 < list.length; i$4 += 1) {\n var seg = list[i$4];\n interpolator.reset(seg, radius * 0.25);\n var numCircles = 0;\n if (interpolator.length <= 0.5 * radius) {\n numCircles = 1;\n } else {\n numCircles = Math.ceil(interpolator.paddedLength / circleDist) + 1;\n }\n for (var i$3 = 0; i$3 < numCircles; i$3++) {\n var t = i$3 / Math.max(numCircles - 1, 1);\n var circlePosition = interpolator.lerp(t);\n var centerX = circlePosition.x + viewportPadding;\n var centerY = circlePosition.y + viewportPadding;\n placedCollisionCircles.push(centerX, centerY, radius, 0);\n var x1 = centerX - radius;\n var y1 = centerY - radius;\n var x2 = centerX + radius;\n var y2 = centerY + radius;\n entirelyOffscreen = entirelyOffscreen && this.isOffscreen(x1, y1, x2, y2);\n inGrid = inGrid || this.isInsideGrid(x1, y1, x2, y2);\n if (!allowOverlap) {\n if (this.grid.hitTestCircle(centerX, centerY, radius, collisionGroupPredicate)) {\n collisionDetected = true;\n if (!showCollisionCircles) {\n return {\n circles: [],\n offscreen: false,\n collisionDetected\n };\n }\n }\n }\n }\n }\n }\n return {\n circles: !showCollisionCircles && collisionDetected || !inGrid ? [] : placedCollisionCircles,\n offscreen: entirelyOffscreen,\n collisionDetected\n };\n };\n CollisionIndex.prototype.queryRenderedSymbols = function queryRenderedSymbols2(viewportQueryGeometry) {\n if (viewportQueryGeometry.length === 0 || this.grid.keysLength() === 0 && this.ignoredGrid.keysLength() === 0) {\n return {};\n }\n var query = [];\n var minX = Infinity;\n var minY = Infinity;\n var maxX = -Infinity;\n var maxY = -Infinity;\n for (var i = 0, list = viewportQueryGeometry; i < list.length; i += 1) {\n var point = list[i];\n var gridPoint = new performance2.Point(point.x + viewportPadding, point.y + viewportPadding);\n minX = Math.min(minX, gridPoint.x);\n minY = Math.min(minY, gridPoint.y);\n maxX = Math.max(maxX, gridPoint.x);\n maxY = Math.max(maxY, gridPoint.y);\n query.push(gridPoint);\n }\n var features = this.grid.query(minX, minY, maxX, maxY).concat(this.ignoredGrid.query(minX, minY, maxX, maxY));\n var seenFeatures = {};\n var result = {};\n for (var i$1 = 0, list$1 = features; i$1 < list$1.length; i$1 += 1) {\n var feature = list$1[i$1];\n var featureKey = feature.key;\n if (seenFeatures[featureKey.bucketInstanceId] === void 0) {\n seenFeatures[featureKey.bucketInstanceId] = {};\n }\n if (seenFeatures[featureKey.bucketInstanceId][featureKey.featureIndex]) {\n continue;\n }\n var bbox = [\n new performance2.Point(feature.x1, feature.y1),\n new performance2.Point(feature.x2, feature.y1),\n new performance2.Point(feature.x2, feature.y2),\n new performance2.Point(feature.x1, feature.y2)\n ];\n if (!performance2.polygonIntersectsPolygon(query, bbox)) {\n continue;\n }\n seenFeatures[featureKey.bucketInstanceId][featureKey.featureIndex] = true;\n if (result[featureKey.bucketInstanceId] === void 0) {\n result[featureKey.bucketInstanceId] = [];\n }\n result[featureKey.bucketInstanceId].push(featureKey.featureIndex);\n }\n return result;\n };\n CollisionIndex.prototype.insertCollisionBox = function insertCollisionBox(collisionBox2, ignorePlacement, bucketInstanceId, featureIndex, collisionGroupID) {\n var grid = ignorePlacement ? this.ignoredGrid : this.grid;\n var key = {\n bucketInstanceId,\n featureIndex,\n collisionGroupID\n };\n grid.insert(key, collisionBox2[0], collisionBox2[1], collisionBox2[2], collisionBox2[3]);\n };\n CollisionIndex.prototype.insertCollisionCircles = function insertCollisionCircles(collisionCircles, ignorePlacement, bucketInstanceId, featureIndex, collisionGroupID) {\n var grid = ignorePlacement ? this.ignoredGrid : this.grid;\n var key = {\n bucketInstanceId,\n featureIndex,\n collisionGroupID\n };\n for (var k = 0; k < collisionCircles.length; k += 4) {\n grid.insertCircle(key, collisionCircles[k], collisionCircles[k + 1], collisionCircles[k + 2]);\n }\n };\n CollisionIndex.prototype.projectAndGetPerspectiveRatio = function projectAndGetPerspectiveRatio(posMatrix, x, y) {\n var p = [\n x,\n y,\n 0,\n 1\n ];\n xyTransformMat4(p, p, posMatrix);\n var a = new performance2.Point((p[0] / p[3] + 1) / 2 * this.transform.width + viewportPadding, (-p[1] / p[3] + 1) / 2 * this.transform.height + viewportPadding);\n return {\n point: a,\n perspectiveRatio: 0.5 + 0.5 * (this.transform.cameraToCenterDistance / p[3])\n };\n };\n CollisionIndex.prototype.isOffscreen = function isOffscreen(x1, y1, x2, y2) {\n return x2 < viewportPadding || x1 >= this.screenRightBoundary || y2 < viewportPadding || y1 > this.screenBottomBoundary;\n };\n CollisionIndex.prototype.isInsideGrid = function isInsideGrid(x1, y1, x2, y2) {\n return x2 >= 0 && x1 < this.gridRightBoundary && y2 >= 0 && y1 < this.gridBottomBoundary;\n };\n CollisionIndex.prototype.getViewportMatrix = function getViewportMatrix() {\n var m = performance2.identity([]);\n performance2.translate(m, m, [\n -viewportPadding,\n -viewportPadding,\n 0\n ]);\n return m;\n };\n function pixelsToTileUnits(tile, pixelValue, z) {\n return pixelValue * (performance2.EXTENT / (tile.tileSize * Math.pow(2, z - tile.tileID.overscaledZ)));\n }\n var OpacityState = function OpacityState2(prevState, increment, placed, skipFade) {\n if (prevState) {\n this.opacity = Math.max(0, Math.min(1, prevState.opacity + (prevState.placed ? increment : -increment)));\n } else {\n this.opacity = skipFade && placed ? 1 : 0;\n }\n this.placed = placed;\n };\n OpacityState.prototype.isHidden = function isHidden() {\n return this.opacity === 0 && !this.placed;\n };\n var JointOpacityState = function JointOpacityState2(prevState, increment, placedText, placedIcon, skipFade) {\n this.text = new OpacityState(prevState ? prevState.text : null, increment, placedText, skipFade);\n this.icon = new OpacityState(prevState ? prevState.icon : null, increment, placedIcon, skipFade);\n };\n JointOpacityState.prototype.isHidden = function isHidden() {\n return this.text.isHidden() && this.icon.isHidden();\n };\n var JointPlacement = function JointPlacement2(text, icon, skipFade) {\n this.text = text;\n this.icon = icon;\n this.skipFade = skipFade;\n };\n var CollisionCircleArray = function CollisionCircleArray2() {\n this.invProjMatrix = performance2.create();\n this.viewportMatrix = performance2.create();\n this.circles = [];\n };\n var RetainedQueryData = function RetainedQueryData2(bucketInstanceId, featureIndex, sourceLayerIndex, bucketIndex, tileID) {\n this.bucketInstanceId = bucketInstanceId;\n this.featureIndex = featureIndex;\n this.sourceLayerIndex = sourceLayerIndex;\n this.bucketIndex = bucketIndex;\n this.tileID = tileID;\n };\n var CollisionGroups = function CollisionGroups2(crossSourceCollisions) {\n this.crossSourceCollisions = crossSourceCollisions;\n this.maxGroupID = 0;\n this.collisionGroups = {};\n };\n CollisionGroups.prototype.get = function get(sourceID) {\n if (!this.crossSourceCollisions) {\n if (!this.collisionGroups[sourceID]) {\n var nextGroupID = ++this.maxGroupID;\n this.collisionGroups[sourceID] = {\n ID: nextGroupID,\n predicate: function(key) {\n return key.collisionGroupID === nextGroupID;\n }\n };\n }\n return this.collisionGroups[sourceID];\n } else {\n return {\n ID: 0,\n predicate: null\n };\n }\n };\n function calculateVariableLayoutShift(anchor, width, height, textOffset, textBoxScale) {\n var ref = performance2.getAnchorAlignment(anchor);\n var horizontalAlign = ref.horizontalAlign;\n var verticalAlign = ref.verticalAlign;\n var shiftX = -(horizontalAlign - 0.5) * width;\n var shiftY = -(verticalAlign - 0.5) * height;\n var offset = performance2.evaluateVariableOffset(anchor, textOffset);\n return new performance2.Point(shiftX + offset[0] * textBoxScale, shiftY + offset[1] * textBoxScale);\n }\n function shiftVariableCollisionBox(collisionBox2, shiftX, shiftY, rotateWithMap, pitchWithMap, angle) {\n var x1 = collisionBox2.x1;\n var x2 = collisionBox2.x2;\n var y1 = collisionBox2.y1;\n var y2 = collisionBox2.y2;\n var anchorPointX = collisionBox2.anchorPointX;\n var anchorPointY = collisionBox2.anchorPointY;\n var rotatedOffset = new performance2.Point(shiftX, shiftY);\n if (rotateWithMap) {\n rotatedOffset._rotate(pitchWithMap ? angle : -angle);\n }\n return {\n x1: x1 + rotatedOffset.x,\n y1: y1 + rotatedOffset.y,\n x2: x2 + rotatedOffset.x,\n y2: y2 + rotatedOffset.y,\n anchorPointX,\n anchorPointY\n };\n }\n var Placement = function Placement2(transform, fadeDuration, crossSourceCollisions, prevPlacement) {\n this.transform = transform.clone();\n this.collisionIndex = new CollisionIndex(this.transform);\n this.placements = {};\n this.opacities = {};\n this.variableOffsets = {};\n this.stale = false;\n this.commitTime = 0;\n this.fadeDuration = fadeDuration;\n this.retainedQueryData = {};\n this.collisionGroups = new CollisionGroups(crossSourceCollisions);\n this.collisionCircleArrays = {};\n this.prevPlacement = prevPlacement;\n if (prevPlacement) {\n prevPlacement.prevPlacement = void 0;\n }\n this.placedOrientations = {};\n };\n Placement.prototype.getBucketParts = function getBucketParts(results, styleLayer, tile, sortAcrossTiles) {\n var symbolBucket = tile.getBucket(styleLayer);\n var bucketFeatureIndex = tile.latestFeatureIndex;\n if (!symbolBucket || !bucketFeatureIndex || styleLayer.id !== symbolBucket.layerIds[0]) {\n return;\n }\n var collisionBoxArray = tile.collisionBoxArray;\n var layout = symbolBucket.layers[0].layout;\n var scale = Math.pow(2, this.transform.zoom - tile.tileID.overscaledZ);\n var textPixelRatio = tile.tileSize / performance2.EXTENT;\n var posMatrix = this.transform.calculatePosMatrix(tile.tileID.toUnwrapped());\n var pitchWithMap = layout.get(\"text-pitch-alignment\") === \"map\";\n var rotateWithMap = layout.get(\"text-rotation-alignment\") === \"map\";\n var pixelsToTiles = pixelsToTileUnits(tile, 1, this.transform.zoom);\n var textLabelPlaneMatrix = getLabelPlaneMatrix(posMatrix, pitchWithMap, rotateWithMap, this.transform, pixelsToTiles);\n var labelToScreenMatrix = null;\n if (pitchWithMap) {\n var glMatrix = getGlCoordMatrix(posMatrix, pitchWithMap, rotateWithMap, this.transform, pixelsToTiles);\n labelToScreenMatrix = performance2.multiply([], this.transform.labelPlaneMatrix, glMatrix);\n }\n this.retainedQueryData[symbolBucket.bucketInstanceId] = new RetainedQueryData(symbolBucket.bucketInstanceId, bucketFeatureIndex, symbolBucket.sourceLayerIndex, symbolBucket.index, tile.tileID);\n var parameters = {\n bucket: symbolBucket,\n layout,\n posMatrix,\n textLabelPlaneMatrix,\n labelToScreenMatrix,\n scale,\n textPixelRatio,\n holdingForFade: tile.holdingForFade(),\n collisionBoxArray,\n partiallyEvaluatedTextSize: performance2.evaluateSizeForZoom(symbolBucket.textSizeData, this.transform.zoom),\n collisionGroup: this.collisionGroups.get(symbolBucket.sourceID)\n };\n if (sortAcrossTiles) {\n for (var i = 0, list = symbolBucket.sortKeyRanges; i < list.length; i += 1) {\n var range = list[i];\n var sortKey = range.sortKey;\n var symbolInstanceStart = range.symbolInstanceStart;\n var symbolInstanceEnd = range.symbolInstanceEnd;\n results.push({\n sortKey,\n symbolInstanceStart,\n symbolInstanceEnd,\n parameters\n });\n }\n } else {\n results.push({\n symbolInstanceStart: 0,\n symbolInstanceEnd: symbolBucket.symbolInstances.length,\n parameters\n });\n }\n };\n Placement.prototype.attemptAnchorPlacement = function attemptAnchorPlacement(anchor, textBox, width, height, textBoxScale, rotateWithMap, pitchWithMap, textPixelRatio, posMatrix, collisionGroup, textAllowOverlap, symbolInstance, bucket, orientation, iconBox) {\n var textOffset = [\n symbolInstance.textOffset0,\n symbolInstance.textOffset1\n ];\n var shift = calculateVariableLayoutShift(anchor, width, height, textOffset, textBoxScale);\n var placedGlyphBoxes = this.collisionIndex.placeCollisionBox(shiftVariableCollisionBox(textBox, shift.x, shift.y, rotateWithMap, pitchWithMap, this.transform.angle), textAllowOverlap, textPixelRatio, posMatrix, collisionGroup.predicate);\n if (iconBox) {\n var placedIconBoxes = this.collisionIndex.placeCollisionBox(shiftVariableCollisionBox(iconBox, shift.x, shift.y, rotateWithMap, pitchWithMap, this.transform.angle), textAllowOverlap, textPixelRatio, posMatrix, collisionGroup.predicate);\n if (placedIconBoxes.box.length === 0) {\n return;\n }\n }\n if (placedGlyphBoxes.box.length > 0) {\n var prevAnchor;\n if (this.prevPlacement && this.prevPlacement.variableOffsets[symbolInstance.crossTileID] && this.prevPlacement.placements[symbolInstance.crossTileID] && this.prevPlacement.placements[symbolInstance.crossTileID].text) {\n prevAnchor = this.prevPlacement.variableOffsets[symbolInstance.crossTileID].anchor;\n }\n this.variableOffsets[symbolInstance.crossTileID] = {\n textOffset,\n width,\n height,\n anchor,\n textBoxScale,\n prevAnchor\n };\n this.markUsedJustification(bucket, anchor, symbolInstance, orientation);\n if (bucket.allowVerticalPlacement) {\n this.markUsedOrientation(bucket, orientation, symbolInstance);\n this.placedOrientations[symbolInstance.crossTileID] = orientation;\n }\n return {\n shift,\n placedGlyphBoxes\n };\n }\n };\n Placement.prototype.placeLayerBucketPart = function placeLayerBucketPart(bucketPart, seenCrossTileIDs, showCollisionBoxes) {\n var this$1 = this;\n var ref = bucketPart.parameters;\n var bucket = ref.bucket;\n var layout = ref.layout;\n var posMatrix = ref.posMatrix;\n var textLabelPlaneMatrix = ref.textLabelPlaneMatrix;\n var labelToScreenMatrix = ref.labelToScreenMatrix;\n var textPixelRatio = ref.textPixelRatio;\n var holdingForFade = ref.holdingForFade;\n var collisionBoxArray = ref.collisionBoxArray;\n var partiallyEvaluatedTextSize = ref.partiallyEvaluatedTextSize;\n var collisionGroup = ref.collisionGroup;\n var textOptional = layout.get(\"text-optional\");\n var iconOptional = layout.get(\"icon-optional\");\n var textAllowOverlap = layout.get(\"text-allow-overlap\");\n var iconAllowOverlap = layout.get(\"icon-allow-overlap\");\n var rotateWithMap = layout.get(\"text-rotation-alignment\") === \"map\";\n var pitchWithMap = layout.get(\"text-pitch-alignment\") === \"map\";\n var hasIconTextFit = layout.get(\"icon-text-fit\") !== \"none\";\n var zOrderByViewportY = layout.get(\"symbol-z-order\") === \"viewport-y\";\n var alwaysShowText = textAllowOverlap && (iconAllowOverlap || !bucket.hasIconData() || iconOptional);\n var alwaysShowIcon = iconAllowOverlap && (textAllowOverlap || !bucket.hasTextData() || textOptional);\n if (!bucket.collisionArrays && collisionBoxArray) {\n bucket.deserializeCollisionBoxes(collisionBoxArray);\n }\n var placeSymbol = function(symbolInstance, collisionArrays) {\n if (seenCrossTileIDs[symbolInstance.crossTileID]) {\n return;\n }\n if (holdingForFade) {\n this$1.placements[symbolInstance.crossTileID] = new JointPlacement(false, false, false);\n return;\n }\n var placeText = false;\n var placeIcon = false;\n var offscreen = true;\n var shift = null;\n var placed = {\n box: null,\n offscreen: null\n };\n var placedVerticalText = {\n box: null,\n offscreen: null\n };\n var placedGlyphBoxes = null;\n var placedGlyphCircles = null;\n var placedIconBoxes = null;\n var textFeatureIndex = 0;\n var verticalTextFeatureIndex = 0;\n var iconFeatureIndex = 0;\n if (collisionArrays.textFeatureIndex) {\n textFeatureIndex = collisionArrays.textFeatureIndex;\n } else if (symbolInstance.useRuntimeCollisionCircles) {\n textFeatureIndex = symbolInstance.featureIndex;\n }\n if (collisionArrays.verticalTextFeatureIndex) {\n verticalTextFeatureIndex = collisionArrays.verticalTextFeatureIndex;\n }\n var textBox = collisionArrays.textBox;\n if (textBox) {\n var updatePreviousOrientationIfNotPlaced = function(isPlaced) {\n var previousOrientation = performance2.WritingMode.horizontal;\n if (bucket.allowVerticalPlacement && !isPlaced && this$1.prevPlacement) {\n var prevPlacedOrientation = this$1.prevPlacement.placedOrientations[symbolInstance.crossTileID];\n if (prevPlacedOrientation) {\n this$1.placedOrientations[symbolInstance.crossTileID] = prevPlacedOrientation;\n previousOrientation = prevPlacedOrientation;\n this$1.markUsedOrientation(bucket, previousOrientation, symbolInstance);\n }\n }\n return previousOrientation;\n };\n var placeTextForPlacementModes = function(placeHorizontalFn, placeVerticalFn) {\n if (bucket.allowVerticalPlacement && symbolInstance.numVerticalGlyphVertices > 0 && collisionArrays.verticalTextBox) {\n for (var i3 = 0, list = bucket.writingModes; i3 < list.length; i3 += 1) {\n var placementMode = list[i3];\n if (placementMode === performance2.WritingMode.vertical) {\n placed = placeVerticalFn();\n placedVerticalText = placed;\n } else {\n placed = placeHorizontalFn();\n }\n if (placed && placed.box && placed.box.length) {\n break;\n }\n }\n } else {\n placed = placeHorizontalFn();\n }\n };\n if (!layout.get(\"text-variable-anchor\")) {\n var placeBox = function(collisionTextBox, orientation) {\n var placedFeature = this$1.collisionIndex.placeCollisionBox(collisionTextBox, textAllowOverlap, textPixelRatio, posMatrix, collisionGroup.predicate);\n if (placedFeature && placedFeature.box && placedFeature.box.length) {\n this$1.markUsedOrientation(bucket, orientation, symbolInstance);\n this$1.placedOrientations[symbolInstance.crossTileID] = orientation;\n }\n return placedFeature;\n };\n var placeHorizontal = function() {\n return placeBox(textBox, performance2.WritingMode.horizontal);\n };\n var placeVertical = function() {\n var verticalTextBox = collisionArrays.verticalTextBox;\n if (bucket.allowVerticalPlacement && symbolInstance.numVerticalGlyphVertices > 0 && verticalTextBox) {\n return placeBox(verticalTextBox, performance2.WritingMode.vertical);\n }\n return {\n box: null,\n offscreen: null\n };\n };\n placeTextForPlacementModes(placeHorizontal, placeVertical);\n updatePreviousOrientationIfNotPlaced(placed && placed.box && placed.box.length);\n } else {\n var anchors = layout.get(\"text-variable-anchor\");\n if (this$1.prevPlacement && this$1.prevPlacement.variableOffsets[symbolInstance.crossTileID]) {\n var prevOffsets = this$1.prevPlacement.variableOffsets[symbolInstance.crossTileID];\n if (anchors.indexOf(prevOffsets.anchor) > 0) {\n anchors = anchors.filter(function(anchor) {\n return anchor !== prevOffsets.anchor;\n });\n anchors.unshift(prevOffsets.anchor);\n }\n }\n var placeBoxForVariableAnchors = function(collisionTextBox, collisionIconBox, orientation) {\n var width = collisionTextBox.x2 - collisionTextBox.x1;\n var height = collisionTextBox.y2 - collisionTextBox.y1;\n var textBoxScale = symbolInstance.textBoxScale;\n var variableIconBox = hasIconTextFit && !iconAllowOverlap ? collisionIconBox : null;\n var placedBox = {\n box: [],\n offscreen: false\n };\n var placementAttempts = textAllowOverlap ? anchors.length * 2 : anchors.length;\n for (var i3 = 0; i3 < placementAttempts; ++i3) {\n var anchor = anchors[i3 % anchors.length];\n var allowOverlap = i3 >= anchors.length;\n var result = this$1.attemptAnchorPlacement(anchor, collisionTextBox, width, height, textBoxScale, rotateWithMap, pitchWithMap, textPixelRatio, posMatrix, collisionGroup, allowOverlap, symbolInstance, bucket, orientation, variableIconBox);\n if (result) {\n placedBox = result.placedGlyphBoxes;\n if (placedBox && placedBox.box && placedBox.box.length) {\n placeText = true;\n shift = result.shift;\n break;\n }\n }\n }\n return placedBox;\n };\n var placeHorizontal$1 = function() {\n return placeBoxForVariableAnchors(textBox, collisionArrays.iconBox, performance2.WritingMode.horizontal);\n };\n var placeVertical$1 = function() {\n var verticalTextBox = collisionArrays.verticalTextBox;\n var wasPlaced = placed && placed.box && placed.box.length;\n if (bucket.allowVerticalPlacement && !wasPlaced && symbolInstance.numVerticalGlyphVertices > 0 && verticalTextBox) {\n return placeBoxForVariableAnchors(verticalTextBox, collisionArrays.verticalIconBox, performance2.WritingMode.vertical);\n }\n return {\n box: null,\n offscreen: null\n };\n };\n placeTextForPlacementModes(placeHorizontal$1, placeVertical$1);\n if (placed) {\n placeText = placed.box;\n offscreen = placed.offscreen;\n }\n var prevOrientation = updatePreviousOrientationIfNotPlaced(placed && placed.box);\n if (!placeText && this$1.prevPlacement) {\n var prevOffset = this$1.prevPlacement.variableOffsets[symbolInstance.crossTileID];\n if (prevOffset) {\n this$1.variableOffsets[symbolInstance.crossTileID] = prevOffset;\n this$1.markUsedJustification(bucket, prevOffset.anchor, symbolInstance, prevOrientation);\n }\n }\n }\n }\n placedGlyphBoxes = placed;\n placeText = placedGlyphBoxes && placedGlyphBoxes.box && placedGlyphBoxes.box.length > 0;\n offscreen = placedGlyphBoxes && placedGlyphBoxes.offscreen;\n if (symbolInstance.useRuntimeCollisionCircles) {\n var placedSymbol = bucket.text.placedSymbolArray.get(symbolInstance.centerJustifiedTextSymbolIndex);\n var fontSize = performance2.evaluateSizeForFeature(bucket.textSizeData, partiallyEvaluatedTextSize, placedSymbol);\n var textPixelPadding = layout.get(\"text-padding\");\n var circlePixelDiameter = symbolInstance.collisionCircleDiameter;\n placedGlyphCircles = this$1.collisionIndex.placeCollisionCircles(textAllowOverlap, placedSymbol, bucket.lineVertexArray, bucket.glyphOffsetArray, fontSize, posMatrix, textLabelPlaneMatrix, labelToScreenMatrix, showCollisionBoxes, pitchWithMap, collisionGroup.predicate, circlePixelDiameter, textPixelPadding);\n placeText = textAllowOverlap || placedGlyphCircles.circles.length > 0 && !placedGlyphCircles.collisionDetected;\n offscreen = offscreen && placedGlyphCircles.offscreen;\n }\n if (collisionArrays.iconFeatureIndex) {\n iconFeatureIndex = collisionArrays.iconFeatureIndex;\n }\n if (collisionArrays.iconBox) {\n var placeIconFeature = function(iconBox) {\n var shiftedIconBox = hasIconTextFit && shift ? shiftVariableCollisionBox(iconBox, shift.x, shift.y, rotateWithMap, pitchWithMap, this$1.transform.angle) : iconBox;\n return this$1.collisionIndex.placeCollisionBox(shiftedIconBox, iconAllowOverlap, textPixelRatio, posMatrix, collisionGroup.predicate);\n };\n if (placedVerticalText && placedVerticalText.box && placedVerticalText.box.length && collisionArrays.verticalIconBox) {\n placedIconBoxes = placeIconFeature(collisionArrays.verticalIconBox);\n placeIcon = placedIconBoxes.box.length > 0;\n } else {\n placedIconBoxes = placeIconFeature(collisionArrays.iconBox);\n placeIcon = placedIconBoxes.box.length > 0;\n }\n offscreen = offscreen && placedIconBoxes.offscreen;\n }\n var iconWithoutText = textOptional || symbolInstance.numHorizontalGlyphVertices === 0 && symbolInstance.numVerticalGlyphVertices === 0;\n var textWithoutIcon = iconOptional || symbolInstance.numIconVertices === 0;\n if (!iconWithoutText && !textWithoutIcon) {\n placeIcon = placeText = placeIcon && placeText;\n } else if (!textWithoutIcon) {\n placeText = placeIcon && placeText;\n } else if (!iconWithoutText) {\n placeIcon = placeIcon && placeText;\n }\n if (placeText && placedGlyphBoxes && placedGlyphBoxes.box) {\n if (placedVerticalText && placedVerticalText.box && verticalTextFeatureIndex) {\n this$1.collisionIndex.insertCollisionBox(placedGlyphBoxes.box, layout.get(\"text-ignore-placement\"), bucket.bucketInstanceId, verticalTextFeatureIndex, collisionGroup.ID);\n } else {\n this$1.collisionIndex.insertCollisionBox(placedGlyphBoxes.box, layout.get(\"text-ignore-placement\"), bucket.bucketInstanceId, textFeatureIndex, collisionGroup.ID);\n }\n }\n if (placeIcon && placedIconBoxes) {\n this$1.collisionIndex.insertCollisionBox(placedIconBoxes.box, layout.get(\"icon-ignore-placement\"), bucket.bucketInstanceId, iconFeatureIndex, collisionGroup.ID);\n }\n if (placedGlyphCircles) {\n if (placeText) {\n this$1.collisionIndex.insertCollisionCircles(placedGlyphCircles.circles, layout.get(\"text-ignore-placement\"), bucket.bucketInstanceId, textFeatureIndex, collisionGroup.ID);\n }\n if (showCollisionBoxes) {\n var id = bucket.bucketInstanceId;\n var circleArray2 = this$1.collisionCircleArrays[id];\n if (circleArray2 === void 0) {\n circleArray2 = this$1.collisionCircleArrays[id] = new CollisionCircleArray();\n }\n for (var i2 = 0; i2 < placedGlyphCircles.circles.length; i2 += 4) {\n circleArray2.circles.push(placedGlyphCircles.circles[i2 + 0]);\n circleArray2.circles.push(placedGlyphCircles.circles[i2 + 1]);\n circleArray2.circles.push(placedGlyphCircles.circles[i2 + 2]);\n circleArray2.circles.push(placedGlyphCircles.collisionDetected ? 1 : 0);\n }\n }\n }\n this$1.placements[symbolInstance.crossTileID] = new JointPlacement(placeText || alwaysShowText, placeIcon || alwaysShowIcon, offscreen || bucket.justReloaded);\n seenCrossTileIDs[symbolInstance.crossTileID] = true;\n };\n if (zOrderByViewportY) {\n var symbolIndexes = bucket.getSortedSymbolIndexes(this.transform.angle);\n for (var i = symbolIndexes.length - 1; i >= 0; --i) {\n var symbolIndex = symbolIndexes[i];\n placeSymbol(bucket.symbolInstances.get(symbolIndex), bucket.collisionArrays[symbolIndex]);\n }\n } else {\n for (var i$1 = bucketPart.symbolInstanceStart; i$1 < bucketPart.symbolInstanceEnd; i$1++) {\n placeSymbol(bucket.symbolInstances.get(i$1), bucket.collisionArrays[i$1]);\n }\n }\n if (showCollisionBoxes && bucket.bucketInstanceId in this.collisionCircleArrays) {\n var circleArray = this.collisionCircleArrays[bucket.bucketInstanceId];\n performance2.invert(circleArray.invProjMatrix, posMatrix);\n circleArray.viewportMatrix = this.collisionIndex.getViewportMatrix();\n }\n bucket.justReloaded = false;\n };\n Placement.prototype.markUsedJustification = function markUsedJustification(bucket, placedAnchor, symbolInstance, orientation) {\n var justifications = {\n \"left\": symbolInstance.leftJustifiedTextSymbolIndex,\n \"center\": symbolInstance.centerJustifiedTextSymbolIndex,\n \"right\": symbolInstance.rightJustifiedTextSymbolIndex\n };\n var autoIndex;\n if (orientation === performance2.WritingMode.vertical) {\n autoIndex = symbolInstance.verticalPlacedTextSymbolIndex;\n } else {\n autoIndex = justifications[performance2.getAnchorJustification(placedAnchor)];\n }\n var indexes = [\n symbolInstance.leftJustifiedTextSymbolIndex,\n symbolInstance.centerJustifiedTextSymbolIndex,\n symbolInstance.rightJustifiedTextSymbolIndex,\n symbolInstance.verticalPlacedTextSymbolIndex\n ];\n for (var i = 0, list = indexes; i < list.length; i += 1) {\n var index = list[i];\n if (index >= 0) {\n if (autoIndex >= 0 && index !== autoIndex) {\n bucket.text.placedSymbolArray.get(index).crossTileID = 0;\n } else {\n bucket.text.placedSymbolArray.get(index).crossTileID = symbolInstance.crossTileID;\n }\n }\n }\n };\n Placement.prototype.markUsedOrientation = function markUsedOrientation(bucket, orientation, symbolInstance) {\n var horizontal = orientation === performance2.WritingMode.horizontal || orientation === performance2.WritingMode.horizontalOnly ? orientation : 0;\n var vertical = orientation === performance2.WritingMode.vertical ? orientation : 0;\n var horizontalIndexes = [\n symbolInstance.leftJustifiedTextSymbolIndex,\n symbolInstance.centerJustifiedTextSymbolIndex,\n symbolInstance.rightJustifiedTextSymbolIndex\n ];\n for (var i = 0, list = horizontalIndexes; i < list.length; i += 1) {\n var index = list[i];\n bucket.text.placedSymbolArray.get(index).placedOrientation = horizontal;\n }\n if (symbolInstance.verticalPlacedTextSymbolIndex) {\n bucket.text.placedSymbolArray.get(symbolInstance.verticalPlacedTextSymbolIndex).placedOrientation = vertical;\n }\n };\n Placement.prototype.commit = function commit(now) {\n this.commitTime = now;\n this.zoomAtLastRecencyCheck = this.transform.zoom;\n var prevPlacement = this.prevPlacement;\n var placementChanged = false;\n this.prevZoomAdjustment = prevPlacement ? prevPlacement.zoomAdjustment(this.transform.zoom) : 0;\n var increment = prevPlacement ? prevPlacement.symbolFadeChange(now) : 1;\n var prevOpacities = prevPlacement ? prevPlacement.opacities : {};\n var prevOffsets = prevPlacement ? prevPlacement.variableOffsets : {};\n var prevOrientations = prevPlacement ? prevPlacement.placedOrientations : {};\n for (var crossTileID in this.placements) {\n var jointPlacement = this.placements[crossTileID];\n var prevOpacity = prevOpacities[crossTileID];\n if (prevOpacity) {\n this.opacities[crossTileID] = new JointOpacityState(prevOpacity, increment, jointPlacement.text, jointPlacement.icon);\n placementChanged = placementChanged || jointPlacement.text !== prevOpacity.text.placed || jointPlacement.icon !== prevOpacity.icon.placed;\n } else {\n this.opacities[crossTileID] = new JointOpacityState(null, increment, jointPlacement.text, jointPlacement.icon, jointPlacement.skipFade);\n placementChanged = placementChanged || jointPlacement.text || jointPlacement.icon;\n }\n }\n for (var crossTileID$1 in prevOpacities) {\n var prevOpacity$1 = prevOpacities[crossTileID$1];\n if (!this.opacities[crossTileID$1]) {\n var jointOpacity = new JointOpacityState(prevOpacity$1, increment, false, false);\n if (!jointOpacity.isHidden()) {\n this.opacities[crossTileID$1] = jointOpacity;\n placementChanged = placementChanged || prevOpacity$1.text.placed || prevOpacity$1.icon.placed;\n }\n }\n }\n for (var crossTileID$2 in prevOffsets) {\n if (!this.variableOffsets[crossTileID$2] && this.opacities[crossTileID$2] && !this.opacities[crossTileID$2].isHidden()) {\n this.variableOffsets[crossTileID$2] = prevOffsets[crossTileID$2];\n }\n }\n for (var crossTileID$3 in prevOrientations) {\n if (!this.placedOrientations[crossTileID$3] && this.opacities[crossTileID$3] && !this.opacities[crossTileID$3].isHidden()) {\n this.placedOrientations[crossTileID$3] = prevOrientations[crossTileID$3];\n }\n }\n if (placementChanged) {\n this.lastPlacementChangeTime = now;\n } else if (typeof this.lastPlacementChangeTime !== \"number\") {\n this.lastPlacementChangeTime = prevPlacement ? prevPlacement.lastPlacementChangeTime : now;\n }\n };\n Placement.prototype.updateLayerOpacities = function updateLayerOpacities(styleLayer, tiles) {\n var seenCrossTileIDs = {};\n for (var i = 0, list = tiles; i < list.length; i += 1) {\n var tile = list[i];\n var symbolBucket = tile.getBucket(styleLayer);\n if (symbolBucket && tile.latestFeatureIndex && styleLayer.id === symbolBucket.layerIds[0]) {\n this.updateBucketOpacities(symbolBucket, seenCrossTileIDs, tile.collisionBoxArray);\n }\n }\n };\n Placement.prototype.updateBucketOpacities = function updateBucketOpacities(bucket, seenCrossTileIDs, collisionBoxArray) {\n var this$1 = this;\n if (bucket.hasTextData()) {\n bucket.text.opacityVertexArray.clear();\n }\n if (bucket.hasIconData()) {\n bucket.icon.opacityVertexArray.clear();\n }\n if (bucket.hasIconCollisionBoxData()) {\n bucket.iconCollisionBox.collisionVertexArray.clear();\n }\n if (bucket.hasTextCollisionBoxData()) {\n bucket.textCollisionBox.collisionVertexArray.clear();\n }\n var layout = bucket.layers[0].layout;\n var duplicateOpacityState = new JointOpacityState(null, 0, false, false, true);\n var textAllowOverlap = layout.get(\"text-allow-overlap\");\n var iconAllowOverlap = layout.get(\"icon-allow-overlap\");\n var variablePlacement = layout.get(\"text-variable-anchor\");\n var rotateWithMap = layout.get(\"text-rotation-alignment\") === \"map\";\n var pitchWithMap = layout.get(\"text-pitch-alignment\") === \"map\";\n var hasIconTextFit = layout.get(\"icon-text-fit\") !== \"none\";\n var defaultOpacityState = new JointOpacityState(null, 0, textAllowOverlap && (iconAllowOverlap || !bucket.hasIconData() || layout.get(\"icon-optional\")), iconAllowOverlap && (textAllowOverlap || !bucket.hasTextData() || layout.get(\"text-optional\")), true);\n if (!bucket.collisionArrays && collisionBoxArray && (bucket.hasIconCollisionBoxData() || bucket.hasTextCollisionBoxData())) {\n bucket.deserializeCollisionBoxes(collisionBoxArray);\n }\n var addOpacities = function(iconOrText, numVertices, opacity) {\n for (var i = 0; i < numVertices / 4; i++) {\n iconOrText.opacityVertexArray.emplaceBack(opacity);\n }\n };\n var loop = function(s2) {\n var symbolInstance = bucket.symbolInstances.get(s2);\n var numHorizontalGlyphVertices = symbolInstance.numHorizontalGlyphVertices;\n var numVerticalGlyphVertices = symbolInstance.numVerticalGlyphVertices;\n var crossTileID = symbolInstance.crossTileID;\n var isDuplicate = seenCrossTileIDs[crossTileID];\n var opacityState = this$1.opacities[crossTileID];\n if (isDuplicate) {\n opacityState = duplicateOpacityState;\n } else if (!opacityState) {\n opacityState = defaultOpacityState;\n this$1.opacities[crossTileID] = opacityState;\n }\n seenCrossTileIDs[crossTileID] = true;\n var hasText = numHorizontalGlyphVertices > 0 || numVerticalGlyphVertices > 0;\n var hasIcon = symbolInstance.numIconVertices > 0;\n var placedOrientation = this$1.placedOrientations[symbolInstance.crossTileID];\n var horizontalHidden = placedOrientation === performance2.WritingMode.vertical;\n var verticalHidden = placedOrientation === performance2.WritingMode.horizontal || placedOrientation === performance2.WritingMode.horizontalOnly;\n if (hasText) {\n var packedOpacity = packOpacity(opacityState.text);\n var horizontalOpacity = horizontalHidden ? PACKED_HIDDEN_OPACITY : packedOpacity;\n addOpacities(bucket.text, numHorizontalGlyphVertices, horizontalOpacity);\n var verticalOpacity = verticalHidden ? PACKED_HIDDEN_OPACITY : packedOpacity;\n addOpacities(bucket.text, numVerticalGlyphVertices, verticalOpacity);\n var symbolHidden = opacityState.text.isHidden();\n [\n symbolInstance.rightJustifiedTextSymbolIndex,\n symbolInstance.centerJustifiedTextSymbolIndex,\n symbolInstance.leftJustifiedTextSymbolIndex\n ].forEach(function(index) {\n if (index >= 0) {\n bucket.text.placedSymbolArray.get(index).hidden = symbolHidden || horizontalHidden ? 1 : 0;\n }\n });\n if (symbolInstance.verticalPlacedTextSymbolIndex >= 0) {\n bucket.text.placedSymbolArray.get(symbolInstance.verticalPlacedTextSymbolIndex).hidden = symbolHidden || verticalHidden ? 1 : 0;\n }\n var prevOffset = this$1.variableOffsets[symbolInstance.crossTileID];\n if (prevOffset) {\n this$1.markUsedJustification(bucket, prevOffset.anchor, symbolInstance, placedOrientation);\n }\n var prevOrientation = this$1.placedOrientations[symbolInstance.crossTileID];\n if (prevOrientation) {\n this$1.markUsedJustification(bucket, \"left\", symbolInstance, prevOrientation);\n this$1.markUsedOrientation(bucket, prevOrientation, symbolInstance);\n }\n }\n if (hasIcon) {\n var packedOpacity$1 = packOpacity(opacityState.icon);\n var useHorizontal = !(hasIconTextFit && symbolInstance.verticalPlacedIconSymbolIndex && horizontalHidden);\n if (symbolInstance.placedIconSymbolIndex >= 0) {\n var horizontalOpacity$1 = useHorizontal ? packedOpacity$1 : PACKED_HIDDEN_OPACITY;\n addOpacities(bucket.icon, symbolInstance.numIconVertices, horizontalOpacity$1);\n bucket.icon.placedSymbolArray.get(symbolInstance.placedIconSymbolIndex).hidden = opacityState.icon.isHidden();\n }\n if (symbolInstance.verticalPlacedIconSymbolIndex >= 0) {\n var verticalOpacity$1 = !useHorizontal ? packedOpacity$1 : PACKED_HIDDEN_OPACITY;\n addOpacities(bucket.icon, symbolInstance.numVerticalIconVertices, verticalOpacity$1);\n bucket.icon.placedSymbolArray.get(symbolInstance.verticalPlacedIconSymbolIndex).hidden = opacityState.icon.isHidden();\n }\n }\n if (bucket.hasIconCollisionBoxData() || bucket.hasTextCollisionBoxData()) {\n var collisionArrays = bucket.collisionArrays[s2];\n if (collisionArrays) {\n var shift = new performance2.Point(0, 0);\n if (collisionArrays.textBox || collisionArrays.verticalTextBox) {\n var used = true;\n if (variablePlacement) {\n var variableOffset = this$1.variableOffsets[crossTileID];\n if (variableOffset) {\n shift = calculateVariableLayoutShift(variableOffset.anchor, variableOffset.width, variableOffset.height, variableOffset.textOffset, variableOffset.textBoxScale);\n if (rotateWithMap) {\n shift._rotate(pitchWithMap ? this$1.transform.angle : -this$1.transform.angle);\n }\n } else {\n used = false;\n }\n }\n if (collisionArrays.textBox) {\n updateCollisionVertices(bucket.textCollisionBox.collisionVertexArray, opacityState.text.placed, !used || horizontalHidden, shift.x, shift.y);\n }\n if (collisionArrays.verticalTextBox) {\n updateCollisionVertices(bucket.textCollisionBox.collisionVertexArray, opacityState.text.placed, !used || verticalHidden, shift.x, shift.y);\n }\n }\n var verticalIconUsed = Boolean(!verticalHidden && collisionArrays.verticalIconBox);\n if (collisionArrays.iconBox) {\n updateCollisionVertices(bucket.iconCollisionBox.collisionVertexArray, opacityState.icon.placed, verticalIconUsed, hasIconTextFit ? shift.x : 0, hasIconTextFit ? shift.y : 0);\n }\n if (collisionArrays.verticalIconBox) {\n updateCollisionVertices(bucket.iconCollisionBox.collisionVertexArray, opacityState.icon.placed, !verticalIconUsed, hasIconTextFit ? shift.x : 0, hasIconTextFit ? shift.y : 0);\n }\n }\n }\n };\n for (var s = 0; s < bucket.symbolInstances.length; s++)\n loop(s);\n bucket.sortFeatures(this.transform.angle);\n if (this.retainedQueryData[bucket.bucketInstanceId]) {\n this.retainedQueryData[bucket.bucketInstanceId].featureSortOrder = bucket.featureSortOrder;\n }\n if (bucket.hasTextData() && bucket.text.opacityVertexBuffer) {\n bucket.text.opacityVertexBuffer.updateData(bucket.text.opacityVertexArray);\n }\n if (bucket.hasIconData() && bucket.icon.opacityVertexBuffer) {\n bucket.icon.opacityVertexBuffer.updateData(bucket.icon.opacityVertexArray);\n }\n if (bucket.hasIconCollisionBoxData() && bucket.iconCollisionBox.collisionVertexBuffer) {\n bucket.iconCollisionBox.collisionVertexBuffer.updateData(bucket.iconCollisionBox.collisionVertexArray);\n }\n if (bucket.hasTextCollisionBoxData() && bucket.textCollisionBox.collisionVertexBuffer) {\n bucket.textCollisionBox.collisionVertexBuffer.updateData(bucket.textCollisionBox.collisionVertexArray);\n }\n if (bucket.bucketInstanceId in this.collisionCircleArrays) {\n var instance = this.collisionCircleArrays[bucket.bucketInstanceId];\n bucket.placementInvProjMatrix = instance.invProjMatrix;\n bucket.placementViewportMatrix = instance.viewportMatrix;\n bucket.collisionCircleArray = instance.circles;\n delete this.collisionCircleArrays[bucket.bucketInstanceId];\n }\n };\n Placement.prototype.symbolFadeChange = function symbolFadeChange(now) {\n return this.fadeDuration === 0 ? 1 : (now - this.commitTime) / this.fadeDuration + this.prevZoomAdjustment;\n };\n Placement.prototype.zoomAdjustment = function zoomAdjustment(zoom) {\n return Math.max(0, (this.transform.zoom - zoom) / 1.5);\n };\n Placement.prototype.hasTransitions = function hasTransitions(now) {\n return this.stale || now - this.lastPlacementChangeTime < this.fadeDuration;\n };\n Placement.prototype.stillRecent = function stillRecent(now, zoom) {\n var durationAdjustment = this.zoomAtLastRecencyCheck === zoom ? 1 - this.zoomAdjustment(zoom) : 1;\n this.zoomAtLastRecencyCheck = zoom;\n return this.commitTime + this.fadeDuration * durationAdjustment > now;\n };\n Placement.prototype.setStale = function setStale() {\n this.stale = true;\n };\n function updateCollisionVertices(collisionVertexArray, placed, notUsed, shiftX, shiftY) {\n collisionVertexArray.emplaceBack(placed ? 1 : 0, notUsed ? 1 : 0, shiftX || 0, shiftY || 0);\n collisionVertexArray.emplaceBack(placed ? 1 : 0, notUsed ? 1 : 0, shiftX || 0, shiftY || 0);\n collisionVertexArray.emplaceBack(placed ? 1 : 0, notUsed ? 1 : 0, shiftX || 0, shiftY || 0);\n collisionVertexArray.emplaceBack(placed ? 1 : 0, notUsed ? 1 : 0, shiftX || 0, shiftY || 0);\n }\n var shift25 = Math.pow(2, 25);\n var shift24 = Math.pow(2, 24);\n var shift17 = Math.pow(2, 17);\n var shift16 = Math.pow(2, 16);\n var shift9 = Math.pow(2, 9);\n var shift8 = Math.pow(2, 8);\n var shift1 = Math.pow(2, 1);\n function packOpacity(opacityState) {\n if (opacityState.opacity === 0 && !opacityState.placed) {\n return 0;\n } else if (opacityState.opacity === 1 && opacityState.placed) {\n return 4294967295;\n }\n var targetBit = opacityState.placed ? 1 : 0;\n var opacityBits = Math.floor(opacityState.opacity * 127);\n return opacityBits * shift25 + targetBit * shift24 + opacityBits * shift17 + targetBit * shift16 + opacityBits * shift9 + targetBit * shift8 + opacityBits * shift1 + targetBit;\n }\n var PACKED_HIDDEN_OPACITY = 0;\n var LayerPlacement = function LayerPlacement2(styleLayer) {\n this._sortAcrossTiles = styleLayer.layout.get(\"symbol-z-order\") !== \"viewport-y\" && styleLayer.layout.get(\"symbol-sort-key\").constantOr(1) !== void 0;\n this._currentTileIndex = 0;\n this._currentPartIndex = 0;\n this._seenCrossTileIDs = {};\n this._bucketParts = [];\n };\n LayerPlacement.prototype.continuePlacement = function continuePlacement(tiles, placement, showCollisionBoxes, styleLayer, shouldPausePlacement) {\n var bucketParts = this._bucketParts;\n while (this._currentTileIndex < tiles.length) {\n var tile = tiles[this._currentTileIndex];\n placement.getBucketParts(bucketParts, styleLayer, tile, this._sortAcrossTiles);\n this._currentTileIndex++;\n if (shouldPausePlacement()) {\n return true;\n }\n }\n if (this._sortAcrossTiles) {\n this._sortAcrossTiles = false;\n bucketParts.sort(function(a, b) {\n return a.sortKey - b.sortKey;\n });\n }\n while (this._currentPartIndex < bucketParts.length) {\n var bucketPart = bucketParts[this._currentPartIndex];\n placement.placeLayerBucketPart(bucketPart, this._seenCrossTileIDs, showCollisionBoxes);\n this._currentPartIndex++;\n if (shouldPausePlacement()) {\n return true;\n }\n }\n return false;\n };\n var PauseablePlacement = function PauseablePlacement2(transform, order, forceFullPlacement, showCollisionBoxes, fadeDuration, crossSourceCollisions, prevPlacement) {\n this.placement = new Placement(transform, fadeDuration, crossSourceCollisions, prevPlacement);\n this._currentPlacementIndex = order.length - 1;\n this._forceFullPlacement = forceFullPlacement;\n this._showCollisionBoxes = showCollisionBoxes;\n this._done = false;\n };\n PauseablePlacement.prototype.isDone = function isDone() {\n return this._done;\n };\n PauseablePlacement.prototype.continuePlacement = function continuePlacement(order, layers, layerTiles) {\n var this$1 = this;\n var startTime = performance2.browser.now();\n var shouldPausePlacement = function() {\n var elapsedTime = performance2.browser.now() - startTime;\n return this$1._forceFullPlacement ? false : elapsedTime > 2;\n };\n while (this._currentPlacementIndex >= 0) {\n var layerId = order[this._currentPlacementIndex];\n var layer = layers[layerId];\n var placementZoom = this.placement.collisionIndex.transform.zoom;\n if (layer.type === \"symbol\" && (!layer.minzoom || layer.minzoom <= placementZoom) && (!layer.maxzoom || layer.maxzoom > placementZoom)) {\n if (!this._inProgressLayer) {\n this._inProgressLayer = new LayerPlacement(layer);\n }\n var pausePlacement = this._inProgressLayer.continuePlacement(layerTiles[layer.source], this.placement, this._showCollisionBoxes, layer, shouldPausePlacement);\n if (pausePlacement) {\n return;\n }\n delete this._inProgressLayer;\n }\n this._currentPlacementIndex--;\n }\n this._done = true;\n };\n PauseablePlacement.prototype.commit = function commit(now) {\n this.placement.commit(now);\n return this.placement;\n };\n var roundingFactor = 512 / performance2.EXTENT / 2;\n var TileLayerIndex = function TileLayerIndex2(tileID, symbolInstances, bucketInstanceId) {\n this.tileID = tileID;\n this.indexedSymbolInstances = {};\n this.bucketInstanceId = bucketInstanceId;\n for (var i = 0; i < symbolInstances.length; i++) {\n var symbolInstance = symbolInstances.get(i);\n var key = symbolInstance.key;\n if (!this.indexedSymbolInstances[key]) {\n this.indexedSymbolInstances[key] = [];\n }\n this.indexedSymbolInstances[key].push({\n crossTileID: symbolInstance.crossTileID,\n coord: this.getScaledCoordinates(symbolInstance, tileID)\n });\n }\n };\n TileLayerIndex.prototype.getScaledCoordinates = function getScaledCoordinates(symbolInstance, childTileID) {\n var zDifference = childTileID.canonical.z - this.tileID.canonical.z;\n var scale = roundingFactor / Math.pow(2, zDifference);\n return {\n x: Math.floor((childTileID.canonical.x * performance2.EXTENT + symbolInstance.anchorX) * scale),\n y: Math.floor((childTileID.canonical.y * performance2.EXTENT + symbolInstance.anchorY) * scale)\n };\n };\n TileLayerIndex.prototype.findMatches = function findMatches(symbolInstances, newTileID, zoomCrossTileIDs) {\n var tolerance = this.tileID.canonical.z < newTileID.canonical.z ? 1 : Math.pow(2, this.tileID.canonical.z - newTileID.canonical.z);\n for (var i = 0; i < symbolInstances.length; i++) {\n var symbolInstance = symbolInstances.get(i);\n if (symbolInstance.crossTileID) {\n continue;\n }\n var indexedInstances = this.indexedSymbolInstances[symbolInstance.key];\n if (!indexedInstances) {\n continue;\n }\n var scaledSymbolCoord = this.getScaledCoordinates(symbolInstance, newTileID);\n for (var i$1 = 0, list = indexedInstances; i$1 < list.length; i$1 += 1) {\n var thisTileSymbol = list[i$1];\n if (Math.abs(thisTileSymbol.coord.x - scaledSymbolCoord.x) <= tolerance && Math.abs(thisTileSymbol.coord.y - scaledSymbolCoord.y) <= tolerance && !zoomCrossTileIDs[thisTileSymbol.crossTileID]) {\n zoomCrossTileIDs[thisTileSymbol.crossTileID] = true;\n symbolInstance.crossTileID = thisTileSymbol.crossTileID;\n break;\n }\n }\n }\n };\n var CrossTileIDs = function CrossTileIDs2() {\n this.maxCrossTileID = 0;\n };\n CrossTileIDs.prototype.generate = function generate() {\n return ++this.maxCrossTileID;\n };\n var CrossTileSymbolLayerIndex = function CrossTileSymbolLayerIndex2() {\n this.indexes = {};\n this.usedCrossTileIDs = {};\n this.lng = 0;\n };\n CrossTileSymbolLayerIndex.prototype.handleWrapJump = function handleWrapJump(lng) {\n var wrapDelta = Math.round((lng - this.lng) / 360);\n if (wrapDelta !== 0) {\n for (var zoom in this.indexes) {\n var zoomIndexes = this.indexes[zoom];\n var newZoomIndex = {};\n for (var key in zoomIndexes) {\n var index = zoomIndexes[key];\n index.tileID = index.tileID.unwrapTo(index.tileID.wrap + wrapDelta);\n newZoomIndex[index.tileID.key] = index;\n }\n this.indexes[zoom] = newZoomIndex;\n }\n }\n this.lng = lng;\n };\n CrossTileSymbolLayerIndex.prototype.addBucket = function addBucket(tileID, bucket, crossTileIDs) {\n if (this.indexes[tileID.overscaledZ] && this.indexes[tileID.overscaledZ][tileID.key]) {\n if (this.indexes[tileID.overscaledZ][tileID.key].bucketInstanceId === bucket.bucketInstanceId) {\n return false;\n } else {\n this.removeBucketCrossTileIDs(tileID.overscaledZ, this.indexes[tileID.overscaledZ][tileID.key]);\n }\n }\n for (var i = 0; i < bucket.symbolInstances.length; i++) {\n var symbolInstance = bucket.symbolInstances.get(i);\n symbolInstance.crossTileID = 0;\n }\n if (!this.usedCrossTileIDs[tileID.overscaledZ]) {\n this.usedCrossTileIDs[tileID.overscaledZ] = {};\n }\n var zoomCrossTileIDs = this.usedCrossTileIDs[tileID.overscaledZ];\n for (var zoom in this.indexes) {\n var zoomIndexes = this.indexes[zoom];\n if (Number(zoom) > tileID.overscaledZ) {\n for (var id in zoomIndexes) {\n var childIndex = zoomIndexes[id];\n if (childIndex.tileID.isChildOf(tileID)) {\n childIndex.findMatches(bucket.symbolInstances, tileID, zoomCrossTileIDs);\n }\n }\n } else {\n var parentCoord = tileID.scaledTo(Number(zoom));\n var parentIndex = zoomIndexes[parentCoord.key];\n if (parentIndex) {\n parentIndex.findMatches(bucket.symbolInstances, tileID, zoomCrossTileIDs);\n }\n }\n }\n for (var i$1 = 0; i$1 < bucket.symbolInstances.length; i$1++) {\n var symbolInstance$1 = bucket.symbolInstances.get(i$1);\n if (!symbolInstance$1.crossTileID) {\n symbolInstance$1.crossTileID = crossTileIDs.generate();\n zoomCrossTileIDs[symbolInstance$1.crossTileID] = true;\n }\n }\n if (this.indexes[tileID.overscaledZ] === void 0) {\n this.indexes[tileID.overscaledZ] = {};\n }\n this.indexes[tileID.overscaledZ][tileID.key] = new TileLayerIndex(tileID, bucket.symbolInstances, bucket.bucketInstanceId);\n return true;\n };\n CrossTileSymbolLayerIndex.prototype.removeBucketCrossTileIDs = function removeBucketCrossTileIDs(zoom, removedBucket) {\n for (var key in removedBucket.indexedSymbolInstances) {\n for (var i = 0, list = removedBucket.indexedSymbolInstances[key]; i < list.length; i += 1) {\n var symbolInstance = list[i];\n delete this.usedCrossTileIDs[zoom][symbolInstance.crossTileID];\n }\n }\n };\n CrossTileSymbolLayerIndex.prototype.removeStaleBuckets = function removeStaleBuckets(currentIDs) {\n var tilesChanged = false;\n for (var z in this.indexes) {\n var zoomIndexes = this.indexes[z];\n for (var tileKey in zoomIndexes) {\n if (!currentIDs[zoomIndexes[tileKey].bucketInstanceId]) {\n this.removeBucketCrossTileIDs(z, zoomIndexes[tileKey]);\n delete zoomIndexes[tileKey];\n tilesChanged = true;\n }\n }\n }\n return tilesChanged;\n };\n var CrossTileSymbolIndex = function CrossTileSymbolIndex2() {\n this.layerIndexes = {};\n this.crossTileIDs = new CrossTileIDs();\n this.maxBucketInstanceId = 0;\n this.bucketsInCurrentPlacement = {};\n };\n CrossTileSymbolIndex.prototype.addLayer = function addLayer(styleLayer, tiles, lng) {\n var layerIndex = this.layerIndexes[styleLayer.id];\n if (layerIndex === void 0) {\n layerIndex = this.layerIndexes[styleLayer.id] = new CrossTileSymbolLayerIndex();\n }\n var symbolBucketsChanged = false;\n var currentBucketIDs = {};\n layerIndex.handleWrapJump(lng);\n for (var i = 0, list = tiles; i < list.length; i += 1) {\n var tile = list[i];\n var symbolBucket = tile.getBucket(styleLayer);\n if (!symbolBucket || styleLayer.id !== symbolBucket.layerIds[0]) {\n continue;\n }\n if (!symbolBucket.bucketInstanceId) {\n symbolBucket.bucketInstanceId = ++this.maxBucketInstanceId;\n }\n if (layerIndex.addBucket(tile.tileID, symbolBucket, this.crossTileIDs)) {\n symbolBucketsChanged = true;\n }\n currentBucketIDs[symbolBucket.bucketInstanceId] = true;\n }\n if (layerIndex.removeStaleBuckets(currentBucketIDs)) {\n symbolBucketsChanged = true;\n }\n return symbolBucketsChanged;\n };\n CrossTileSymbolIndex.prototype.pruneUnusedLayers = function pruneUnusedLayers(usedLayers) {\n var usedLayerMap = {};\n usedLayers.forEach(function(usedLayer) {\n usedLayerMap[usedLayer] = true;\n });\n for (var layerId in this.layerIndexes) {\n if (!usedLayerMap[layerId]) {\n delete this.layerIndexes[layerId];\n }\n }\n };\n var emitValidationErrors = function(evented, errors) {\n return performance2.emitValidationErrors(evented, errors && errors.filter(function(error) {\n return error.identifier !== \"source.canvas\";\n }));\n };\n var supportedDiffOperations = performance2.pick(operations, [\n \"addLayer\",\n \"removeLayer\",\n \"setPaintProperty\",\n \"setLayoutProperty\",\n \"setFilter\",\n \"addSource\",\n \"removeSource\",\n \"setLayerZoomRange\",\n \"setLight\",\n \"setTransition\",\n \"setGeoJSONSourceData\"\n ]);\n var ignoredDiffOperations = performance2.pick(operations, [\n \"setCenter\",\n \"setZoom\",\n \"setBearing\",\n \"setPitch\"\n ]);\n var empty = emptyStyle();\n var Style = function(Evented) {\n function Style2(map, options) {\n var this$1 = this;\n if (options === void 0)\n options = {};\n Evented.call(this);\n this.map = map;\n this.dispatcher = new Dispatcher(getGlobalWorkerPool(), this);\n this.imageManager = new ImageManager();\n this.imageManager.setEventedParent(this);\n this.glyphManager = new GlyphManager(map._requestManager, options.localIdeographFontFamily);\n this.lineAtlas = new LineAtlas(256, 512);\n this.crossTileSymbolIndex = new CrossTileSymbolIndex();\n this._layers = {};\n this._serializedLayers = {};\n this._order = [];\n this.sourceCaches = {};\n this.zoomHistory = new performance2.ZoomHistory();\n this._loaded = false;\n this._availableImages = [];\n this._resetUpdates();\n this.dispatcher.broadcast(\"setReferrer\", performance2.getReferrer());\n var self2 = this;\n this._rtlTextPluginCallback = Style2.registerForPluginStateChange(function(event) {\n var state = {\n pluginStatus: event.pluginStatus,\n pluginURL: event.pluginURL\n };\n self2.dispatcher.broadcast(\"syncRTLPluginState\", state, function(err, results) {\n performance2.triggerPluginCompletionEvent(err);\n if (results) {\n var allComplete = results.every(function(elem) {\n return elem;\n });\n if (allComplete) {\n for (var id in self2.sourceCaches) {\n self2.sourceCaches[id].reload();\n }\n }\n }\n });\n });\n this.on(\"data\", function(event) {\n if (event.dataType !== \"source\" || event.sourceDataType !== \"metadata\") {\n return;\n }\n var sourceCache = this$1.sourceCaches[event.sourceId];\n if (!sourceCache) {\n return;\n }\n var source = sourceCache.getSource();\n if (!source || !source.vectorLayerIds) {\n return;\n }\n for (var layerId in this$1._layers) {\n var layer = this$1._layers[layerId];\n if (layer.source === source.id) {\n this$1._validateLayer(layer);\n }\n }\n });\n }\n if (Evented)\n Style2.__proto__ = Evented;\n Style2.prototype = Object.create(Evented && Evented.prototype);\n Style2.prototype.constructor = Style2;\n Style2.prototype.loadURL = function loadURL(url, options) {\n var this$1 = this;\n if (options === void 0)\n options = {};\n this.fire(new performance2.Event(\"dataloading\", { dataType: \"style\" }));\n var validate = typeof options.validate === \"boolean\" ? options.validate : !performance2.isMapboxURL(url);\n url = this.map._requestManager.normalizeStyleURL(url, options.accessToken);\n var request = this.map._requestManager.transformRequest(url, performance2.ResourceType.Style);\n this._request = performance2.getJSON(request, function(error, json) {\n this$1._request = null;\n if (error) {\n this$1.fire(new performance2.ErrorEvent(error));\n } else if (json) {\n this$1._load(json, validate);\n }\n });\n };\n Style2.prototype.loadJSON = function loadJSON(json, options) {\n var this$1 = this;\n if (options === void 0)\n options = {};\n this.fire(new performance2.Event(\"dataloading\", { dataType: \"style\" }));\n this._request = performance2.browser.frame(function() {\n this$1._request = null;\n this$1._load(json, options.validate !== false);\n });\n };\n Style2.prototype.loadEmpty = function loadEmpty() {\n this.fire(new performance2.Event(\"dataloading\", { dataType: \"style\" }));\n this._load(empty, false);\n };\n Style2.prototype._load = function _load(json, validate) {\n if (validate && emitValidationErrors(this, performance2.validateStyle(json))) {\n return;\n }\n this._loaded = true;\n this.stylesheet = json;\n for (var id in json.sources) {\n this.addSource(id, json.sources[id], { validate: false });\n }\n if (json.sprite) {\n this._loadSprite(json.sprite);\n } else {\n this.imageManager.setLoaded(true);\n }\n this.glyphManager.setURL(json.glyphs);\n var layers = derefLayers(this.stylesheet.layers);\n this._order = layers.map(function(layer2) {\n return layer2.id;\n });\n this._layers = {};\n this._serializedLayers = {};\n for (var i = 0, list = layers; i < list.length; i += 1) {\n var layer = list[i];\n layer = performance2.createStyleLayer(layer);\n layer.setEventedParent(this, { layer: { id: layer.id } });\n this._layers[layer.id] = layer;\n this._serializedLayers[layer.id] = layer.serialize();\n }\n this.dispatcher.broadcast(\"setLayers\", this._serializeLayers(this._order));\n this.light = new Light(this.stylesheet.light);\n this.fire(new performance2.Event(\"data\", { dataType: \"style\" }));\n this.fire(new performance2.Event(\"style.load\"));\n };\n Style2.prototype._loadSprite = function _loadSprite(url) {\n var this$1 = this;\n this._spriteRequest = loadSprite(url, this.map._requestManager, function(err, images) {\n this$1._spriteRequest = null;\n if (err) {\n this$1.fire(new performance2.ErrorEvent(err));\n } else if (images) {\n for (var id in images) {\n this$1.imageManager.addImage(id, images[id]);\n }\n }\n this$1.imageManager.setLoaded(true);\n this$1._availableImages = this$1.imageManager.listImages();\n this$1.dispatcher.broadcast(\"setImages\", this$1._availableImages);\n this$1.fire(new performance2.Event(\"data\", { dataType: \"style\" }));\n });\n };\n Style2.prototype._validateLayer = function _validateLayer(layer) {\n var sourceCache = this.sourceCaches[layer.source];\n if (!sourceCache) {\n return;\n }\n var sourceLayer = layer.sourceLayer;\n if (!sourceLayer) {\n return;\n }\n var source = sourceCache.getSource();\n if (source.type === \"geojson\" || source.vectorLayerIds && source.vectorLayerIds.indexOf(sourceLayer) === -1) {\n this.fire(new performance2.ErrorEvent(new Error('Source layer \"' + sourceLayer + '\" does not exist on source \"' + source.id + '\" as specified by style layer \"' + layer.id + '\"')));\n }\n };\n Style2.prototype.loaded = function loaded() {\n if (!this._loaded) {\n return false;\n }\n if (Object.keys(this._updatedSources).length) {\n return false;\n }\n for (var id in this.sourceCaches) {\n if (!this.sourceCaches[id].loaded()) {\n return false;\n }\n }\n if (!this.imageManager.isLoaded()) {\n return false;\n }\n return true;\n };\n Style2.prototype._serializeLayers = function _serializeLayers(ids) {\n var serializedLayers = [];\n for (var i = 0, list = ids; i < list.length; i += 1) {\n var id = list[i];\n var layer = this._layers[id];\n if (layer.type !== \"custom\") {\n serializedLayers.push(layer.serialize());\n }\n }\n return serializedLayers;\n };\n Style2.prototype.hasTransitions = function hasTransitions() {\n if (this.light && this.light.hasTransition()) {\n return true;\n }\n for (var id in this.sourceCaches) {\n if (this.sourceCaches[id].hasTransition()) {\n return true;\n }\n }\n for (var id$1 in this._layers) {\n if (this._layers[id$1].hasTransition()) {\n return true;\n }\n }\n return false;\n };\n Style2.prototype._checkLoaded = function _checkLoaded() {\n if (!this._loaded) {\n throw new Error(\"Style is not done loading\");\n }\n };\n Style2.prototype.update = function update(parameters) {\n if (!this._loaded) {\n return;\n }\n var changed = this._changed;\n if (this._changed) {\n var updatedIds = Object.keys(this._updatedLayers);\n var removedIds = Object.keys(this._removedLayers);\n if (updatedIds.length || removedIds.length) {\n this._updateWorkerLayers(updatedIds, removedIds);\n }\n for (var id in this._updatedSources) {\n var action = this._updatedSources[id];\n if (action === \"reload\") {\n this._reloadSource(id);\n } else if (action === \"clear\") {\n this._clearSource(id);\n }\n }\n this._updateTilesForChangedImages();\n for (var id$1 in this._updatedPaintProps) {\n this._layers[id$1].updateTransitions(parameters);\n }\n this.light.updateTransitions(parameters);\n this._resetUpdates();\n }\n var sourcesUsedBefore = {};\n for (var sourceId in this.sourceCaches) {\n var sourceCache = this.sourceCaches[sourceId];\n sourcesUsedBefore[sourceId] = sourceCache.used;\n sourceCache.used = false;\n }\n for (var i = 0, list = this._order; i < list.length; i += 1) {\n var layerId = list[i];\n var layer = this._layers[layerId];\n layer.recalculate(parameters, this._availableImages);\n if (!layer.isHidden(parameters.zoom) && layer.source) {\n this.sourceCaches[layer.source].used = true;\n }\n }\n for (var sourceId$1 in sourcesUsedBefore) {\n var sourceCache$1 = this.sourceCaches[sourceId$1];\n if (sourcesUsedBefore[sourceId$1] !== sourceCache$1.used) {\n sourceCache$1.fire(new performance2.Event(\"data\", {\n sourceDataType: \"visibility\",\n dataType: \"source\",\n sourceId: sourceId$1\n }));\n }\n }\n this.light.recalculate(parameters);\n this.z = parameters.zoom;\n if (changed) {\n this.fire(new performance2.Event(\"data\", { dataType: \"style\" }));\n }\n };\n Style2.prototype._updateTilesForChangedImages = function _updateTilesForChangedImages() {\n var changedImages = Object.keys(this._changedImages);\n if (changedImages.length) {\n for (var name2 in this.sourceCaches) {\n this.sourceCaches[name2].reloadTilesForDependencies([\n \"icons\",\n \"patterns\"\n ], changedImages);\n }\n this._changedImages = {};\n }\n };\n Style2.prototype._updateWorkerLayers = function _updateWorkerLayers(updatedIds, removedIds) {\n this.dispatcher.broadcast(\"updateLayers\", {\n layers: this._serializeLayers(updatedIds),\n removedIds\n });\n };\n Style2.prototype._resetUpdates = function _resetUpdates() {\n this._changed = false;\n this._updatedLayers = {};\n this._removedLayers = {};\n this._updatedSources = {};\n this._updatedPaintProps = {};\n this._changedImages = {};\n };\n Style2.prototype.setState = function setState(nextState) {\n var this$1 = this;\n this._checkLoaded();\n if (emitValidationErrors(this, performance2.validateStyle(nextState))) {\n return false;\n }\n nextState = performance2.clone$1(nextState);\n nextState.layers = derefLayers(nextState.layers);\n var changes = diffStyles(this.serialize(), nextState).filter(function(op) {\n return !(op.command in ignoredDiffOperations);\n });\n if (changes.length === 0) {\n return false;\n }\n var unimplementedOps = changes.filter(function(op) {\n return !(op.command in supportedDiffOperations);\n });\n if (unimplementedOps.length > 0) {\n throw new Error(\"Unimplemented: \" + unimplementedOps.map(function(op) {\n return op.command;\n }).join(\", \") + \".\");\n }\n changes.forEach(function(op) {\n if (op.command === \"setTransition\") {\n return;\n }\n this$1[op.command].apply(this$1, op.args);\n });\n this.stylesheet = nextState;\n return true;\n };\n Style2.prototype.addImage = function addImage(id, image) {\n if (this.getImage(id)) {\n return this.fire(new performance2.ErrorEvent(new Error(\"An image with this name already exists.\")));\n }\n this.imageManager.addImage(id, image);\n this._afterImageUpdated(id);\n };\n Style2.prototype.updateImage = function updateImage(id, image) {\n this.imageManager.updateImage(id, image);\n };\n Style2.prototype.getImage = function getImage(id) {\n return this.imageManager.getImage(id);\n };\n Style2.prototype.removeImage = function removeImage(id) {\n if (!this.getImage(id)) {\n return this.fire(new performance2.ErrorEvent(new Error(\"No image with this name exists.\")));\n }\n this.imageManager.removeImage(id);\n this._afterImageUpdated(id);\n };\n Style2.prototype._afterImageUpdated = function _afterImageUpdated(id) {\n this._availableImages = this.imageManager.listImages();\n this._changedImages[id] = true;\n this._changed = true;\n this.dispatcher.broadcast(\"setImages\", this._availableImages);\n this.fire(new performance2.Event(\"data\", { dataType: \"style\" }));\n };\n Style2.prototype.listImages = function listImages() {\n this._checkLoaded();\n return this.imageManager.listImages();\n };\n Style2.prototype.addSource = function addSource2(id, source, options) {\n var this$1 = this;\n if (options === void 0)\n options = {};\n this._checkLoaded();\n if (this.sourceCaches[id] !== void 0) {\n throw new Error(\"There is already a source with this ID\");\n }\n if (!source.type) {\n throw new Error(\"The type property must be defined, but only the following properties were given: \" + Object.keys(source).join(\", \") + \".\");\n }\n var builtIns = [\n \"vector\",\n \"raster\",\n \"geojson\",\n \"video\",\n \"image\"\n ];\n var shouldValidate = builtIns.indexOf(source.type) >= 0;\n if (shouldValidate && this._validate(performance2.validateStyle.source, \"sources.\" + id, source, null, options)) {\n return;\n }\n if (this.map && this.map._collectResourceTiming) {\n source.collectResourceTiming = true;\n }\n var sourceCache = this.sourceCaches[id] = new SourceCache(id, source, this.dispatcher);\n sourceCache.style = this;\n sourceCache.setEventedParent(this, function() {\n return {\n isSourceLoaded: this$1.loaded(),\n source: sourceCache.serialize(),\n sourceId: id\n };\n });\n sourceCache.onAdd(this.map);\n this._changed = true;\n };\n Style2.prototype.removeSource = function removeSource2(id) {\n this._checkLoaded();\n if (this.sourceCaches[id] === void 0) {\n throw new Error(\"There is no source with this ID\");\n }\n for (var layerId in this._layers) {\n if (this._layers[layerId].source === id) {\n return this.fire(new performance2.ErrorEvent(new Error('Source \"' + id + '\" cannot be removed while layer \"' + layerId + '\" is using it.')));\n }\n }\n var sourceCache = this.sourceCaches[id];\n delete this.sourceCaches[id];\n delete this._updatedSources[id];\n sourceCache.fire(new performance2.Event(\"data\", {\n sourceDataType: \"metadata\",\n dataType: \"source\",\n sourceId: id\n }));\n sourceCache.setEventedParent(null);\n sourceCache.clearTiles();\n if (sourceCache.onRemove) {\n sourceCache.onRemove(this.map);\n }\n this._changed = true;\n };\n Style2.prototype.setGeoJSONSourceData = function setGeoJSONSourceData(id, data) {\n this._checkLoaded();\n var geojsonSource = this.sourceCaches[id].getSource();\n geojsonSource.setData(data);\n this._changed = true;\n };\n Style2.prototype.getSource = function getSource(id) {\n return this.sourceCaches[id] && this.sourceCaches[id].getSource();\n };\n Style2.prototype.addLayer = function addLayer(layerObject, before, options) {\n if (options === void 0)\n options = {};\n this._checkLoaded();\n var id = layerObject.id;\n if (this.getLayer(id)) {\n this.fire(new performance2.ErrorEvent(new Error('Layer with id \"' + id + '\" already exists on this map')));\n return;\n }\n var layer;\n if (layerObject.type === \"custom\") {\n if (emitValidationErrors(this, performance2.validateCustomStyleLayer(layerObject))) {\n return;\n }\n layer = performance2.createStyleLayer(layerObject);\n } else {\n if (typeof layerObject.source === \"object\") {\n this.addSource(id, layerObject.source);\n layerObject = performance2.clone$1(layerObject);\n layerObject = performance2.extend(layerObject, { source: id });\n }\n if (this._validate(performance2.validateStyle.layer, \"layers.\" + id, layerObject, { arrayIndex: -1 }, options)) {\n return;\n }\n layer = performance2.createStyleLayer(layerObject);\n this._validateLayer(layer);\n layer.setEventedParent(this, { layer: { id } });\n this._serializedLayers[layer.id] = layer.serialize();\n }\n var index = before ? this._order.indexOf(before) : this._order.length;\n if (before && index === -1) {\n this.fire(new performance2.ErrorEvent(new Error('Layer with id \"' + before + '\" does not exist on this map.')));\n return;\n }\n this._order.splice(index, 0, id);\n this._layerOrderChanged = true;\n this._layers[id] = layer;\n if (this._removedLayers[id] && layer.source && layer.type !== \"custom\") {\n var removed = this._removedLayers[id];\n delete this._removedLayers[id];\n if (removed.type !== layer.type) {\n this._updatedSources[layer.source] = \"clear\";\n } else {\n this._updatedSources[layer.source] = \"reload\";\n this.sourceCaches[layer.source].pause();\n }\n }\n this._updateLayer(layer);\n if (layer.onAdd) {\n layer.onAdd(this.map);\n }\n };\n Style2.prototype.moveLayer = function moveLayer(id, before) {\n this._checkLoaded();\n this._changed = true;\n var layer = this._layers[id];\n if (!layer) {\n this.fire(new performance2.ErrorEvent(new Error(\"The layer '\" + id + \"' does not exist in the map's style and cannot be moved.\")));\n return;\n }\n if (id === before) {\n return;\n }\n var index = this._order.indexOf(id);\n this._order.splice(index, 1);\n var newIndex = before ? this._order.indexOf(before) : this._order.length;\n if (before && newIndex === -1) {\n this.fire(new performance2.ErrorEvent(new Error('Layer with id \"' + before + '\" does not exist on this map.')));\n return;\n }\n this._order.splice(newIndex, 0, id);\n this._layerOrderChanged = true;\n };\n Style2.prototype.removeLayer = function removeLayer(id) {\n this._checkLoaded();\n var layer = this._layers[id];\n if (!layer) {\n this.fire(new performance2.ErrorEvent(new Error(\"The layer '\" + id + \"' does not exist in the map's style and cannot be removed.\")));\n return;\n }\n layer.setEventedParent(null);\n var index = this._order.indexOf(id);\n this._order.splice(index, 1);\n this._layerOrderChanged = true;\n this._changed = true;\n this._removedLayers[id] = layer;\n delete this._layers[id];\n delete this._serializedLayers[id];\n delete this._updatedLayers[id];\n delete this._updatedPaintProps[id];\n if (layer.onRemove) {\n layer.onRemove(this.map);\n }\n };\n Style2.prototype.getLayer = function getLayer(id) {\n return this._layers[id];\n };\n Style2.prototype.hasLayer = function hasLayer(id) {\n return id in this._layers;\n };\n Style2.prototype.setLayerZoomRange = function setLayerZoomRange(layerId, minzoom, maxzoom) {\n this._checkLoaded();\n var layer = this.getLayer(layerId);\n if (!layer) {\n this.fire(new performance2.ErrorEvent(new Error(\"The layer '\" + layerId + \"' does not exist in the map's style and cannot have zoom extent.\")));\n return;\n }\n if (layer.minzoom === minzoom && layer.maxzoom === maxzoom) {\n return;\n }\n if (minzoom != null) {\n layer.minzoom = minzoom;\n }\n if (maxzoom != null) {\n layer.maxzoom = maxzoom;\n }\n this._updateLayer(layer);\n };\n Style2.prototype.setFilter = function setFilter(layerId, filter, options) {\n if (options === void 0)\n options = {};\n this._checkLoaded();\n var layer = this.getLayer(layerId);\n if (!layer) {\n this.fire(new performance2.ErrorEvent(new Error(\"The layer '\" + layerId + \"' does not exist in the map's style and cannot be filtered.\")));\n return;\n }\n if (performance2.deepEqual(layer.filter, filter)) {\n return;\n }\n if (filter === null || filter === void 0) {\n layer.filter = void 0;\n this._updateLayer(layer);\n return;\n }\n if (this._validate(performance2.validateStyle.filter, \"layers.\" + layer.id + \".filter\", filter, null, options)) {\n return;\n }\n layer.filter = performance2.clone$1(filter);\n this._updateLayer(layer);\n };\n Style2.prototype.getFilter = function getFilter(layer) {\n return performance2.clone$1(this.getLayer(layer).filter);\n };\n Style2.prototype.setLayoutProperty = function setLayoutProperty(layerId, name2, value, options) {\n if (options === void 0)\n options = {};\n this._checkLoaded();\n var layer = this.getLayer(layerId);\n if (!layer) {\n this.fire(new performance2.ErrorEvent(new Error(\"The layer '\" + layerId + \"' does not exist in the map's style and cannot be styled.\")));\n return;\n }\n if (performance2.deepEqual(layer.getLayoutProperty(name2), value)) {\n return;\n }\n layer.setLayoutProperty(name2, value, options);\n this._updateLayer(layer);\n };\n Style2.prototype.getLayoutProperty = function getLayoutProperty(layerId, name2) {\n var layer = this.getLayer(layerId);\n if (!layer) {\n this.fire(new performance2.ErrorEvent(new Error(\"The layer '\" + layerId + \"' does not exist in the map's style.\")));\n return;\n }\n return layer.getLayoutProperty(name2);\n };\n Style2.prototype.setPaintProperty = function setPaintProperty(layerId, name2, value, options) {\n if (options === void 0)\n options = {};\n this._checkLoaded();\n var layer = this.getLayer(layerId);\n if (!layer) {\n this.fire(new performance2.ErrorEvent(new Error(\"The layer '\" + layerId + \"' does not exist in the map's style and cannot be styled.\")));\n return;\n }\n if (performance2.deepEqual(layer.getPaintProperty(name2), value)) {\n return;\n }\n var requiresRelayout = layer.setPaintProperty(name2, value, options);\n if (requiresRelayout) {\n this._updateLayer(layer);\n }\n this._changed = true;\n this._updatedPaintProps[layerId] = true;\n };\n Style2.prototype.getPaintProperty = function getPaintProperty(layer, name2) {\n return this.getLayer(layer).getPaintProperty(name2);\n };\n Style2.prototype.setFeatureState = function setFeatureState(target, state) {\n this._checkLoaded();\n var sourceId = target.source;\n var sourceLayer = target.sourceLayer;\n var sourceCache = this.sourceCaches[sourceId];\n if (sourceCache === void 0) {\n this.fire(new performance2.ErrorEvent(new Error(\"The source '\" + sourceId + \"' does not exist in the map's style.\")));\n return;\n }\n var sourceType = sourceCache.getSource().type;\n if (sourceType === \"geojson\" && sourceLayer) {\n this.fire(new performance2.ErrorEvent(new Error(\"GeoJSON sources cannot have a sourceLayer parameter.\")));\n return;\n }\n if (sourceType === \"vector\" && !sourceLayer) {\n this.fire(new performance2.ErrorEvent(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));\n return;\n }\n if (target.id === void 0) {\n this.fire(new performance2.ErrorEvent(new Error(\"The feature id parameter must be provided.\")));\n }\n sourceCache.setFeatureState(sourceLayer, target.id, state);\n };\n Style2.prototype.removeFeatureState = function removeFeatureState(target, key) {\n this._checkLoaded();\n var sourceId = target.source;\n var sourceCache = this.sourceCaches[sourceId];\n if (sourceCache === void 0) {\n this.fire(new performance2.ErrorEvent(new Error(\"The source '\" + sourceId + \"' does not exist in the map's style.\")));\n return;\n }\n var sourceType = sourceCache.getSource().type;\n var sourceLayer = sourceType === \"vector\" ? target.sourceLayer : void 0;\n if (sourceType === \"vector\" && !sourceLayer) {\n this.fire(new performance2.ErrorEvent(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));\n return;\n }\n if (key && (typeof target.id !== \"string\" && typeof target.id !== \"number\")) {\n this.fire(new performance2.ErrorEvent(new Error(\"A feature id is required to remove its specific state property.\")));\n return;\n }\n sourceCache.removeFeatureState(sourceLayer, target.id, key);\n };\n Style2.prototype.getFeatureState = function getFeatureState(target) {\n this._checkLoaded();\n var sourceId = target.source;\n var sourceLayer = target.sourceLayer;\n var sourceCache = this.sourceCaches[sourceId];\n if (sourceCache === void 0) {\n this.fire(new performance2.ErrorEvent(new Error(\"The source '\" + sourceId + \"' does not exist in the map's style.\")));\n return;\n }\n var sourceType = sourceCache.getSource().type;\n if (sourceType === \"vector\" && !sourceLayer) {\n this.fire(new performance2.ErrorEvent(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));\n return;\n }\n if (target.id === void 0) {\n this.fire(new performance2.ErrorEvent(new Error(\"The feature id parameter must be provided.\")));\n }\n return sourceCache.getFeatureState(sourceLayer, target.id);\n };\n Style2.prototype.getTransition = function getTransition() {\n return performance2.extend({\n duration: 300,\n delay: 0\n }, this.stylesheet && this.stylesheet.transition);\n };\n Style2.prototype.serialize = function serialize() {\n return performance2.filterObject({\n version: this.stylesheet.version,\n name: this.stylesheet.name,\n metadata: this.stylesheet.metadata,\n light: this.stylesheet.light,\n center: this.stylesheet.center,\n zoom: this.stylesheet.zoom,\n bearing: this.stylesheet.bearing,\n pitch: this.stylesheet.pitch,\n sprite: this.stylesheet.sprite,\n glyphs: this.stylesheet.glyphs,\n transition: this.stylesheet.transition,\n sources: performance2.mapObject(this.sourceCaches, function(source) {\n return source.serialize();\n }),\n layers: this._serializeLayers(this._order)\n }, function(value) {\n return value !== void 0;\n });\n };\n Style2.prototype._updateLayer = function _updateLayer(layer) {\n this._updatedLayers[layer.id] = true;\n if (layer.source && !this._updatedSources[layer.source] && this.sourceCaches[layer.source].getSource().type !== \"raster\") {\n this._updatedSources[layer.source] = \"reload\";\n this.sourceCaches[layer.source].pause();\n }\n this._changed = true;\n };\n Style2.prototype._flattenAndSortRenderedFeatures = function _flattenAndSortRenderedFeatures(sourceResults) {\n var this$1 = this;\n var isLayer3D = function(layerId2) {\n return this$1._layers[layerId2].type === \"fill-extrusion\";\n };\n var layerIndex = {};\n var features3D = [];\n for (var l = this._order.length - 1; l >= 0; l--) {\n var layerId = this._order[l];\n if (isLayer3D(layerId)) {\n layerIndex[layerId] = l;\n for (var i$2 = 0, list$1 = sourceResults; i$2 < list$1.length; i$2 += 1) {\n var sourceResult = list$1[i$2];\n var layerFeatures = sourceResult[layerId];\n if (layerFeatures) {\n for (var i$1 = 0, list = layerFeatures; i$1 < list.length; i$1 += 1) {\n var featureWrapper = list[i$1];\n features3D.push(featureWrapper);\n }\n }\n }\n }\n }\n features3D.sort(function(a, b) {\n return b.intersectionZ - a.intersectionZ;\n });\n var features = [];\n for (var l$1 = this._order.length - 1; l$1 >= 0; l$1--) {\n var layerId$1 = this._order[l$1];\n if (isLayer3D(layerId$1)) {\n for (var i = features3D.length - 1; i >= 0; i--) {\n var topmost3D = features3D[i].feature;\n if (layerIndex[topmost3D.layer.id] < l$1) {\n break;\n }\n features.push(topmost3D);\n features3D.pop();\n }\n } else {\n for (var i$4 = 0, list$3 = sourceResults; i$4 < list$3.length; i$4 += 1) {\n var sourceResult$1 = list$3[i$4];\n var layerFeatures$1 = sourceResult$1[layerId$1];\n if (layerFeatures$1) {\n for (var i$3 = 0, list$2 = layerFeatures$1; i$3 < list$2.length; i$3 += 1) {\n var featureWrapper$1 = list$2[i$3];\n features.push(featureWrapper$1.feature);\n }\n }\n }\n }\n }\n return features;\n };\n Style2.prototype.queryRenderedFeatures = function queryRenderedFeatures$1(queryGeometry, params, transform) {\n if (params && params.filter) {\n this._validate(performance2.validateStyle.filter, \"queryRenderedFeatures.filter\", params.filter, null, params);\n }\n var includedSources = {};\n if (params && params.layers) {\n if (!Array.isArray(params.layers)) {\n this.fire(new performance2.ErrorEvent(new Error(\"parameters.layers must be an Array.\")));\n return [];\n }\n for (var i = 0, list = params.layers; i < list.length; i += 1) {\n var layerId = list[i];\n var layer = this._layers[layerId];\n if (!layer) {\n this.fire(new performance2.ErrorEvent(new Error(\"The layer '\" + layerId + \"' does not exist in the map's style and cannot be queried for features.\")));\n return [];\n }\n includedSources[layer.source] = true;\n }\n }\n var sourceResults = [];\n params.availableImages = this._availableImages;\n for (var id in this.sourceCaches) {\n if (params.layers && !includedSources[id]) {\n continue;\n }\n sourceResults.push(queryRenderedFeatures(this.sourceCaches[id], this._layers, this._serializedLayers, queryGeometry, params, transform));\n }\n if (this.placement) {\n sourceResults.push(queryRenderedSymbols(this._layers, this._serializedLayers, this.sourceCaches, queryGeometry, params, this.placement.collisionIndex, this.placement.retainedQueryData));\n }\n return this._flattenAndSortRenderedFeatures(sourceResults);\n };\n Style2.prototype.querySourceFeatures = function querySourceFeatures$1(sourceID, params) {\n if (params && params.filter) {\n this._validate(performance2.validateStyle.filter, \"querySourceFeatures.filter\", params.filter, null, params);\n }\n var sourceCache = this.sourceCaches[sourceID];\n return sourceCache ? querySourceFeatures(sourceCache, params) : [];\n };\n Style2.prototype.addSourceType = function addSourceType(name2, SourceType, callback) {\n if (Style2.getSourceType(name2)) {\n return callback(new Error('A source type called \"' + name2 + '\" already exists.'));\n }\n Style2.setSourceType(name2, SourceType);\n if (!SourceType.workerSourceURL) {\n return callback(null, null);\n }\n this.dispatcher.broadcast(\"loadWorkerSource\", {\n name: name2,\n url: SourceType.workerSourceURL\n }, callback);\n };\n Style2.prototype.getLight = function getLight() {\n return this.light.getLight();\n };\n Style2.prototype.setLight = function setLight(lightOptions, options) {\n if (options === void 0)\n options = {};\n this._checkLoaded();\n var light = this.light.getLight();\n var _update = false;\n for (var key in lightOptions) {\n if (!performance2.deepEqual(lightOptions[key], light[key])) {\n _update = true;\n break;\n }\n }\n if (!_update) {\n return;\n }\n var parameters = {\n now: performance2.browser.now(),\n transition: performance2.extend({\n duration: 300,\n delay: 0\n }, this.stylesheet.transition)\n };\n this.light.setLight(lightOptions, options);\n this.light.updateTransitions(parameters);\n };\n Style2.prototype._validate = function _validate(validate, key, value, props, options) {\n if (options === void 0)\n options = {};\n if (options && options.validate === false) {\n return false;\n }\n return emitValidationErrors(this, validate.call(performance2.validateStyle, performance2.extend({\n key,\n style: this.serialize(),\n value,\n styleSpec: performance2.styleSpec\n }, props)));\n };\n Style2.prototype._remove = function _remove() {\n if (this._request) {\n this._request.cancel();\n this._request = null;\n }\n if (this._spriteRequest) {\n this._spriteRequest.cancel();\n this._spriteRequest = null;\n }\n performance2.evented.off(\"pluginStateChange\", this._rtlTextPluginCallback);\n for (var layerId in this._layers) {\n var layer = this._layers[layerId];\n layer.setEventedParent(null);\n }\n for (var id in this.sourceCaches) {\n this.sourceCaches[id].clearTiles();\n this.sourceCaches[id].setEventedParent(null);\n }\n this.imageManager.setEventedParent(null);\n this.setEventedParent(null);\n this.dispatcher.remove();\n };\n Style2.prototype._clearSource = function _clearSource(id) {\n this.sourceCaches[id].clearTiles();\n };\n Style2.prototype._reloadSource = function _reloadSource(id) {\n this.sourceCaches[id].resume();\n this.sourceCaches[id].reload();\n };\n Style2.prototype._updateSources = function _updateSources(transform) {\n for (var id in this.sourceCaches) {\n this.sourceCaches[id].update(transform);\n }\n };\n Style2.prototype._generateCollisionBoxes = function _generateCollisionBoxes() {\n for (var id in this.sourceCaches) {\n this._reloadSource(id);\n }\n };\n Style2.prototype._updatePlacement = function _updatePlacement(transform, showCollisionBoxes, fadeDuration, crossSourceCollisions, forceFullPlacement) {\n if (forceFullPlacement === void 0)\n forceFullPlacement = false;\n var symbolBucketsChanged = false;\n var placementCommitted = false;\n var layerTiles = {};\n for (var i = 0, list = this._order; i < list.length; i += 1) {\n var layerID = list[i];\n var styleLayer = this._layers[layerID];\n if (styleLayer.type !== \"symbol\") {\n continue;\n }\n if (!layerTiles[styleLayer.source]) {\n var sourceCache = this.sourceCaches[styleLayer.source];\n layerTiles[styleLayer.source] = sourceCache.getRenderableIds(true).map(function(id) {\n return sourceCache.getTileByID(id);\n }).sort(function(a, b) {\n return b.tileID.overscaledZ - a.tileID.overscaledZ || (a.tileID.isLessThan(b.tileID) ? -1 : 1);\n });\n }\n var layerBucketsChanged = this.crossTileSymbolIndex.addLayer(styleLayer, layerTiles[styleLayer.source], transform.center.lng);\n symbolBucketsChanged = symbolBucketsChanged || layerBucketsChanged;\n }\n this.crossTileSymbolIndex.pruneUnusedLayers(this._order);\n forceFullPlacement = forceFullPlacement || this._layerOrderChanged || fadeDuration === 0;\n if (forceFullPlacement || !this.pauseablePlacement || this.pauseablePlacement.isDone() && !this.placement.stillRecent(performance2.browser.now(), transform.zoom)) {\n this.pauseablePlacement = new PauseablePlacement(transform, this._order, forceFullPlacement, showCollisionBoxes, fadeDuration, crossSourceCollisions, this.placement);\n this._layerOrderChanged = false;\n }\n if (this.pauseablePlacement.isDone()) {\n this.placement.setStale();\n } else {\n this.pauseablePlacement.continuePlacement(this._order, this._layers, layerTiles);\n if (this.pauseablePlacement.isDone()) {\n this.placement = this.pauseablePlacement.commit(performance2.browser.now());\n placementCommitted = true;\n }\n if (symbolBucketsChanged) {\n this.pauseablePlacement.placement.setStale();\n }\n }\n if (placementCommitted || symbolBucketsChanged) {\n for (var i$1 = 0, list$1 = this._order; i$1 < list$1.length; i$1 += 1) {\n var layerID$1 = list$1[i$1];\n var styleLayer$1 = this._layers[layerID$1];\n if (styleLayer$1.type !== \"symbol\") {\n continue;\n }\n this.placement.updateLayerOpacities(styleLayer$1, layerTiles[styleLayer$1.source]);\n }\n }\n var needsRerender = !this.pauseablePlacement.isDone() || this.placement.hasTransitions(performance2.browser.now());\n return needsRerender;\n };\n Style2.prototype._releaseSymbolFadeTiles = function _releaseSymbolFadeTiles() {\n for (var id in this.sourceCaches) {\n this.sourceCaches[id].releaseSymbolFadeTiles();\n }\n };\n Style2.prototype.getImages = function getImages(mapId, params, callback) {\n this.imageManager.getImages(params.icons, callback);\n this._updateTilesForChangedImages();\n var sourceCache = this.sourceCaches[params.source];\n if (sourceCache) {\n sourceCache.setDependencies(params.tileID.key, params.type, params.icons);\n }\n };\n Style2.prototype.getGlyphs = function getGlyphs(mapId, params, callback) {\n this.glyphManager.getGlyphs(params.stacks, callback);\n };\n Style2.prototype.getResource = function getResource(mapId, params, callback) {\n return performance2.makeRequest(params, callback);\n };\n return Style2;\n }(performance2.Evented);\n Style.getSourceType = getType;\n Style.setSourceType = setType;\n Style.registerForPluginStateChange = performance2.registerForPluginStateChange;\n var posAttributes = performance2.createLayout([{\n name: \"a_pos\",\n type: \"Int16\",\n components: 2\n }]);\n var preludeFrag = \"#ifdef GL_ES\\nprecision mediump float;\\n#else\\n#if !defined(lowp)\\n#define lowp\\n#endif\\n#if !defined(mediump)\\n#define mediump\\n#endif\\n#if !defined(highp)\\n#define highp\\n#endif\\n#endif\";\n var preludeVert = \"#ifdef GL_ES\\nprecision highp float;\\n#else\\n#if !defined(lowp)\\n#define lowp\\n#endif\\n#if !defined(mediump)\\n#define mediump\\n#endif\\n#if !defined(highp)\\n#define highp\\n#endif\\n#endif\\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\";\n var backgroundFrag = \"uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var backgroundVert = \"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}\";\n var backgroundPatternFrag = \"uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var backgroundPatternVert = \"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}\";\n var circleFrag = \"varying vec3 v_data;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define mediump float radius\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define highp vec4 stroke_color\\n#pragma mapbox: define mediump float stroke_width\\n#pragma mapbox: define lowp float stroke_opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize mediump float radius\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize highp vec4 stroke_color\\n#pragma mapbox: initialize mediump float stroke_width\\n#pragma mapbox: initialize lowp float stroke_opacity\\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var circleVert = \"uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define mediump float radius\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define highp vec4 stroke_color\\n#pragma mapbox: define mediump float stroke_width\\n#pragma mapbox: define lowp float stroke_opacity\\nvoid main(void) {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize mediump float radius\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize highp vec4 stroke_color\\n#pragma mapbox: initialize mediump float stroke_width\\n#pragma mapbox: initialize lowp float stroke_opacity\\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}\";\n var clippingMaskFrag = \"void main() {gl_FragColor=vec4(1.0);}\";\n var clippingMaskVert = \"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}\";\n var heatmapFrag = \"uniform highp float u_intensity;varying vec2 v_extrude;\\n#pragma mapbox: define highp float weight\\n#define GAUSS_COEF 0.3989422804014327\\nvoid main() {\\n#pragma mapbox: initialize highp float weight\\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var heatmapVert = \"uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\\n#pragma mapbox: define highp float weight\\n#pragma mapbox: define mediump float radius\\nconst highp float ZERO=1.0/255.0/16.0;\\n#define GAUSS_COEF 0.3989422804014327\\nvoid main(void) {\\n#pragma mapbox: initialize highp float weight\\n#pragma mapbox: initialize mediump float radius\\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}\";\n var heatmapTextureFrag = \"uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(0.0);\\n#endif\\n}\";\n var heatmapTextureVert = \"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}\";\n var collisionBoxFrag = \"varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}\";\n var collisionBoxVert = \"attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}\";\n var collisionCircleFrag = \"varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}\";\n var collisionCircleVert = \"attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}\";\n var debugFrag = \"uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}\";\n var debugVert = \"attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}\";\n var fillFrag = \"#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float opacity\\ngl_FragColor=color*opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var fillVert = \"attribute vec2 a_pos;uniform mat4 u_matrix;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float opacity\\ngl_Position=u_matrix*vec4(a_pos,0,1);}\";\n var fillOutlineFrag = \"varying vec2 v_pos;\\n#pragma mapbox: define highp vec4 outline_color\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 outline_color\\n#pragma mapbox: initialize lowp float opacity\\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var fillOutlineVert = \"attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\\n#pragma mapbox: define highp vec4 outline_color\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 outline_color\\n#pragma mapbox: initialize lowp float opacity\\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}\";\n var fillOutlinePatternFrag = \"uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var fillOutlinePatternVert = \"uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}\";\n var fillPatternFrag = \"uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var fillPatternVert = \"uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}\";\n var fillExtrusionFrag = \"varying vec4 v_color;void main() {gl_FragColor=v_color;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var fillExtrusionVert = \"uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;\\n#pragma mapbox: define highp float base\\n#pragma mapbox: define highp float height\\n#pragma mapbox: define highp vec4 color\\nvoid main() {\\n#pragma mapbox: initialize highp float base\\n#pragma mapbox: initialize highp float height\\n#pragma mapbox: initialize highp vec4 color\\nvec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}\";\n var fillExtrusionPatternFrag = \"uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\\n#pragma mapbox: define lowp float base\\n#pragma mapbox: define lowp float height\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float base\\n#pragma mapbox: initialize lowp float height\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var fillExtrusionPatternVert = \"uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\\n#pragma mapbox: define lowp float base\\n#pragma mapbox: define lowp float height\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float base\\n#pragma mapbox: initialize lowp float height\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\\n? a_pos\\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}\";\n var hillshadePrepareFrag = \"#ifdef GL_ES\\nprecision highp float;\\n#endif\\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var hillshadePrepareVert = \"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}\";\n var hillshadeFrag = \"uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\\n#define PI 3.141592653589793\\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var hillshadeVert = \"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}\";\n var lineFrag = \"uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var lineVert = \"\\n#define scale 0.015873016\\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define mediump float gapwidth\\n#pragma mapbox: define lowp float offset\\n#pragma mapbox: define mediump float width\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump float gapwidth\\n#pragma mapbox: initialize lowp float offset\\n#pragma mapbox: initialize mediump float width\\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}\";\n var lineGradientFrag = \"uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var lineGradientVert = \"\\n#define scale 0.015873016\\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define mediump float gapwidth\\n#pragma mapbox: define lowp float offset\\n#pragma mapbox: define mediump float width\\nvoid main() {\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump float gapwidth\\n#pragma mapbox: initialize lowp float offset\\n#pragma mapbox: initialize mediump float width\\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}\";\n var linePatternFrag = \"uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var linePatternVert = \"\\n#define scale 0.015873016\\n#define LINE_DISTANCE_SCALE 2.0\\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float offset\\n#pragma mapbox: define mediump float gapwidth\\n#pragma mapbox: define mediump float width\\n#pragma mapbox: define lowp float floorwidth\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float offset\\n#pragma mapbox: initialize mediump float gapwidth\\n#pragma mapbox: initialize mediump float width\\n#pragma mapbox: initialize lowp float floorwidth\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}\";\n var lineSDFFrag = \"uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define mediump float width\\n#pragma mapbox: define lowp float floorwidth\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump float width\\n#pragma mapbox: initialize lowp float floorwidth\\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var lineSDFVert = \"\\n#define scale 0.015873016\\n#define LINE_DISTANCE_SCALE 2.0\\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define mediump float gapwidth\\n#pragma mapbox: define lowp float offset\\n#pragma mapbox: define mediump float width\\n#pragma mapbox: define lowp float floorwidth\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump float gapwidth\\n#pragma mapbox: initialize lowp float offset\\n#pragma mapbox: initialize mediump float width\\n#pragma mapbox: initialize lowp float floorwidth\\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}\";\n var rasterFrag = \"uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var rasterVert = \"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}\";\n var symbolIconFrag = \"uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var symbolIconVert = \"const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}\";\n var symbolSDFFrag = \"#define SDF_PX 8.0\\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var symbolSDFVert = \"const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}\";\n var symbolTextAndIconFrag = \"#define SDF_PX 8.0\\n#define SDF 1.0\\n#define ICON 0.0\\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\";\n var symbolTextAndIconVert = \"const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}\";\n var prelude = compile(preludeFrag, preludeVert);\n var background = compile(backgroundFrag, backgroundVert);\n var backgroundPattern = compile(backgroundPatternFrag, backgroundPatternVert);\n var circle = compile(circleFrag, circleVert);\n var clippingMask = compile(clippingMaskFrag, clippingMaskVert);\n var heatmap = compile(heatmapFrag, heatmapVert);\n var heatmapTexture = compile(heatmapTextureFrag, heatmapTextureVert);\n var collisionBox = compile(collisionBoxFrag, collisionBoxVert);\n var collisionCircle = compile(collisionCircleFrag, collisionCircleVert);\n var debug = compile(debugFrag, debugVert);\n var fill = compile(fillFrag, fillVert);\n var fillOutline = compile(fillOutlineFrag, fillOutlineVert);\n var fillOutlinePattern = compile(fillOutlinePatternFrag, fillOutlinePatternVert);\n var fillPattern = compile(fillPatternFrag, fillPatternVert);\n var fillExtrusion = compile(fillExtrusionFrag, fillExtrusionVert);\n var fillExtrusionPattern = compile(fillExtrusionPatternFrag, fillExtrusionPatternVert);\n var hillshadePrepare = compile(hillshadePrepareFrag, hillshadePrepareVert);\n var hillshade = compile(hillshadeFrag, hillshadeVert);\n var line = compile(lineFrag, lineVert);\n var lineGradient = compile(lineGradientFrag, lineGradientVert);\n var linePattern = compile(linePatternFrag, linePatternVert);\n var lineSDF = compile(lineSDFFrag, lineSDFVert);\n var raster = compile(rasterFrag, rasterVert);\n var symbolIcon = compile(symbolIconFrag, symbolIconVert);\n var symbolSDF = compile(symbolSDFFrag, symbolSDFVert);\n var symbolTextAndIcon = compile(symbolTextAndIconFrag, symbolTextAndIconVert);\n function compile(fragmentSource, vertexSource) {\n var re = /#pragma mapbox: ([\\w]+) ([\\w]+) ([\\w]+) ([\\w]+)/g;\n var staticAttributes = vertexSource.match(/attribute ([\\w]+) ([\\w]+)/g);\n var fragmentUniforms = fragmentSource.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g);\n var vertexUniforms = vertexSource.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g);\n var staticUniforms = vertexUniforms ? vertexUniforms.concat(fragmentUniforms) : fragmentUniforms;\n var fragmentPragmas = {};\n fragmentSource = fragmentSource.replace(re, function(match, operation, precision, type, name2) {\n fragmentPragmas[name2] = true;\n if (operation === \"define\") {\n return \"\\n#ifndef HAS_UNIFORM_u_\" + name2 + \"\\nvarying \" + precision + \" \" + type + \" \" + name2 + \";\\n#else\\nuniform \" + precision + \" \" + type + \" u_\" + name2 + \";\\n#endif\\n\";\n } else {\n return \"\\n#ifdef HAS_UNIFORM_u_\" + name2 + \"\\n \" + precision + \" \" + type + \" \" + name2 + \" = u_\" + name2 + \";\\n#endif\\n\";\n }\n });\n vertexSource = vertexSource.replace(re, function(match, operation, precision, type, name2) {\n var attrType = type === \"float\" ? \"vec2\" : \"vec4\";\n var unpackType = name2.match(/color/) ? \"color\" : attrType;\n if (fragmentPragmas[name2]) {\n if (operation === \"define\") {\n return \"\\n#ifndef HAS_UNIFORM_u_\" + name2 + \"\\nuniform lowp float u_\" + name2 + \"_t;\\nattribute \" + precision + \" \" + attrType + \" a_\" + name2 + \";\\nvarying \" + precision + \" \" + type + \" \" + name2 + \";\\n#else\\nuniform \" + precision + \" \" + type + \" u_\" + name2 + \";\\n#endif\\n\";\n } else {\n if (unpackType === \"vec4\") {\n return \"\\n#ifndef HAS_UNIFORM_u_\" + name2 + \"\\n \" + name2 + \" = a_\" + name2 + \";\\n#else\\n \" + precision + \" \" + type + \" \" + name2 + \" = u_\" + name2 + \";\\n#endif\\n\";\n } else {\n return \"\\n#ifndef HAS_UNIFORM_u_\" + name2 + \"\\n \" + name2 + \" = unpack_mix_\" + unpackType + \"(a_\" + name2 + \", u_\" + name2 + \"_t);\\n#else\\n \" + precision + \" \" + type + \" \" + name2 + \" = u_\" + name2 + \";\\n#endif\\n\";\n }\n }\n } else {\n if (operation === \"define\") {\n return \"\\n#ifndef HAS_UNIFORM_u_\" + name2 + \"\\nuniform lowp float u_\" + name2 + \"_t;\\nattribute \" + precision + \" \" + attrType + \" a_\" + name2 + \";\\n#else\\nuniform \" + precision + \" \" + type + \" u_\" + name2 + \";\\n#endif\\n\";\n } else {\n if (unpackType === \"vec4\") {\n return \"\\n#ifndef HAS_UNIFORM_u_\" + name2 + \"\\n \" + precision + \" \" + type + \" \" + name2 + \" = a_\" + name2 + \";\\n#else\\n \" + precision + \" \" + type + \" \" + name2 + \" = u_\" + name2 + \";\\n#endif\\n\";\n } else {\n return \"\\n#ifndef HAS_UNIFORM_u_\" + name2 + \"\\n \" + precision + \" \" + type + \" \" + name2 + \" = unpack_mix_\" + unpackType + \"(a_\" + name2 + \", u_\" + name2 + \"_t);\\n#else\\n \" + precision + \" \" + type + \" \" + name2 + \" = u_\" + name2 + \";\\n#endif\\n\";\n }\n }\n }\n });\n return {\n fragmentSource,\n vertexSource,\n staticAttributes,\n staticUniforms\n };\n }\n var shaders = /* @__PURE__ */ Object.freeze({\n __proto__: null,\n prelude,\n background,\n backgroundPattern,\n circle,\n clippingMask,\n heatmap,\n heatmapTexture,\n collisionBox,\n collisionCircle,\n debug,\n fill,\n fillOutline,\n fillOutlinePattern,\n fillPattern,\n fillExtrusion,\n fillExtrusionPattern,\n hillshadePrepare,\n hillshade,\n line,\n lineGradient,\n linePattern,\n lineSDF,\n raster,\n symbolIcon,\n symbolSDF,\n symbolTextAndIcon\n });\n var VertexArrayObject = function VertexArrayObject2() {\n this.boundProgram = null;\n this.boundLayoutVertexBuffer = null;\n this.boundPaintVertexBuffers = [];\n this.boundIndexBuffer = null;\n this.boundVertexOffset = null;\n this.boundDynamicVertexBuffer = null;\n this.vao = null;\n };\n VertexArrayObject.prototype.bind = function bind(context, program, layoutVertexBuffer, paintVertexBuffers, indexBuffer, vertexOffset, dynamicVertexBuffer, dynamicVertexBuffer2) {\n this.context = context;\n var paintBuffersDiffer = this.boundPaintVertexBuffers.length !== paintVertexBuffers.length;\n for (var i = 0; !paintBuffersDiffer && i < paintVertexBuffers.length; i++) {\n if (this.boundPaintVertexBuffers[i] !== paintVertexBuffers[i]) {\n paintBuffersDiffer = true;\n }\n }\n var isFreshBindRequired = !this.vao || this.boundProgram !== program || this.boundLayoutVertexBuffer !== layoutVertexBuffer || paintBuffersDiffer || this.boundIndexBuffer !== indexBuffer || this.boundVertexOffset !== vertexOffset || this.boundDynamicVertexBuffer !== dynamicVertexBuffer || this.boundDynamicVertexBuffer2 !== dynamicVertexBuffer2;\n if (!context.extVertexArrayObject || isFreshBindRequired) {\n this.freshBind(program, layoutVertexBuffer, paintVertexBuffers, indexBuffer, vertexOffset, dynamicVertexBuffer, dynamicVertexBuffer2);\n } else {\n context.bindVertexArrayOES.set(this.vao);\n if (dynamicVertexBuffer) {\n dynamicVertexBuffer.bind();\n }\n if (indexBuffer && indexBuffer.dynamicDraw) {\n indexBuffer.bind();\n }\n if (dynamicVertexBuffer2) {\n dynamicVertexBuffer2.bind();\n }\n }\n };\n VertexArrayObject.prototype.freshBind = function freshBind(program, layoutVertexBuffer, paintVertexBuffers, indexBuffer, vertexOffset, dynamicVertexBuffer, dynamicVertexBuffer2) {\n var numPrevAttributes;\n var numNextAttributes = program.numAttributes;\n var context = this.context;\n var gl2 = context.gl;\n if (context.extVertexArrayObject) {\n if (this.vao) {\n this.destroy();\n }\n this.vao = context.extVertexArrayObject.createVertexArrayOES();\n context.bindVertexArrayOES.set(this.vao);\n numPrevAttributes = 0;\n this.boundProgram = program;\n this.boundLayoutVertexBuffer = layoutVertexBuffer;\n this.boundPaintVertexBuffers = paintVertexBuffers;\n this.boundIndexBuffer = indexBuffer;\n this.boundVertexOffset = vertexOffset;\n this.boundDynamicVertexBuffer = dynamicVertexBuffer;\n this.boundDynamicVertexBuffer2 = dynamicVertexBuffer2;\n } else {\n numPrevAttributes = context.currentNumAttributes || 0;\n for (var i = numNextAttributes; i < numPrevAttributes; i++) {\n gl2.disableVertexAttribArray(i);\n }\n }\n layoutVertexBuffer.enableAttributes(gl2, program);\n for (var i$1 = 0, list = paintVertexBuffers; i$1 < list.length; i$1 += 1) {\n var vertexBuffer = list[i$1];\n vertexBuffer.enableAttributes(gl2, program);\n }\n if (dynamicVertexBuffer) {\n dynamicVertexBuffer.enableAttributes(gl2, program);\n }\n if (dynamicVertexBuffer2) {\n dynamicVertexBuffer2.enableAttributes(gl2, program);\n }\n layoutVertexBuffer.bind();\n layoutVertexBuffer.setVertexAttribPointers(gl2, program, vertexOffset);\n for (var i$2 = 0, list$1 = paintVertexBuffers; i$2 < list$1.length; i$2 += 1) {\n var vertexBuffer$1 = list$1[i$2];\n vertexBuffer$1.bind();\n vertexBuffer$1.setVertexAttribPointers(gl2, program, vertexOffset);\n }\n if (dynamicVertexBuffer) {\n dynamicVertexBuffer.bind();\n dynamicVertexBuffer.setVertexAttribPointers(gl2, program, vertexOffset);\n }\n if (indexBuffer) {\n indexBuffer.bind();\n }\n if (dynamicVertexBuffer2) {\n dynamicVertexBuffer2.bind();\n dynamicVertexBuffer2.setVertexAttribPointers(gl2, program, vertexOffset);\n }\n context.currentNumAttributes = numNextAttributes;\n };\n VertexArrayObject.prototype.destroy = function destroy() {\n if (this.vao) {\n this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao);\n this.vao = null;\n }\n };\n function getTokenizedAttributesAndUniforms(array) {\n var result = [];\n for (var i = 0; i < array.length; i++) {\n if (array[i] === null) {\n continue;\n }\n var token = array[i].split(\" \");\n result.push(token.pop());\n }\n return result;\n }\n var Program$1 = function Program2(context, name2, source, configuration, fixedUniforms, showOverdrawInspector) {\n var gl2 = context.gl;\n this.program = gl2.createProgram();\n var staticAttrInfo = getTokenizedAttributesAndUniforms(source.staticAttributes);\n var dynamicAttrInfo = configuration ? configuration.getBinderAttributes() : [];\n var allAttrInfo = staticAttrInfo.concat(dynamicAttrInfo);\n var staticUniformsInfo = source.staticUniforms ? getTokenizedAttributesAndUniforms(source.staticUniforms) : [];\n var dynamicUniformsInfo = configuration ? configuration.getBinderUniforms() : [];\n var uniformList = staticUniformsInfo.concat(dynamicUniformsInfo);\n var allUniformsInfo = [];\n for (var i$1 = 0, list = uniformList; i$1 < list.length; i$1 += 1) {\n var uniform = list[i$1];\n if (allUniformsInfo.indexOf(uniform) < 0) {\n allUniformsInfo.push(uniform);\n }\n }\n var defines = configuration ? configuration.defines() : [];\n if (showOverdrawInspector) {\n defines.push(\"#define OVERDRAW_INSPECTOR;\");\n }\n var fragmentSource = defines.concat(prelude.fragmentSource, source.fragmentSource).join(\"\\n\");\n var vertexSource = defines.concat(prelude.vertexSource, source.vertexSource).join(\"\\n\");\n var fragmentShader = gl2.createShader(gl2.FRAGMENT_SHADER);\n if (gl2.isContextLost()) {\n this.failedToCreate = true;\n return;\n }\n gl2.shaderSource(fragmentShader, fragmentSource);\n gl2.compileShader(fragmentShader);\n gl2.attachShader(this.program, fragmentShader);\n var vertexShader = gl2.createShader(gl2.VERTEX_SHADER);\n if (gl2.isContextLost()) {\n this.failedToCreate = true;\n return;\n }\n gl2.shaderSource(vertexShader, vertexSource);\n gl2.compileShader(vertexShader);\n gl2.attachShader(this.program, vertexShader);\n this.attributes = {};\n var uniformLocations = {};\n this.numAttributes = allAttrInfo.length;\n for (var i = 0; i < this.numAttributes; i++) {\n if (allAttrInfo[i]) {\n gl2.bindAttribLocation(this.program, i, allAttrInfo[i]);\n this.attributes[allAttrInfo[i]] = i;\n }\n }\n gl2.linkProgram(this.program);\n gl2.deleteShader(vertexShader);\n gl2.deleteShader(fragmentShader);\n for (var it = 0; it < allUniformsInfo.length; it++) {\n var uniform$1 = allUniformsInfo[it];\n if (uniform$1 && !uniformLocations[uniform$1]) {\n var uniformLocation = gl2.getUniformLocation(this.program, uniform$1);\n if (uniformLocation) {\n uniformLocations[uniform$1] = uniformLocation;\n }\n }\n }\n this.fixedUniforms = fixedUniforms(context, uniformLocations);\n this.binderUniforms = configuration ? configuration.getUniforms(context, uniformLocations) : [];\n };\n Program$1.prototype.draw = function draw2(context, drawMode, depthMode, stencilMode, colorMode, cullFaceMode, uniformValues, layerID, layoutVertexBuffer, indexBuffer, segments, currentProperties, zoom, configuration, dynamicLayoutBuffer, dynamicLayoutBuffer2) {\n var obj;\n var gl2 = context.gl;\n if (this.failedToCreate) {\n return;\n }\n context.program.set(this.program);\n context.setDepthMode(depthMode);\n context.setStencilMode(stencilMode);\n context.setColorMode(colorMode);\n context.setCullFace(cullFaceMode);\n for (var name2 in this.fixedUniforms) {\n this.fixedUniforms[name2].set(uniformValues[name2]);\n }\n if (configuration) {\n configuration.setUniforms(context, this.binderUniforms, currentProperties, { zoom });\n }\n var primitiveSize = (obj = {}, obj[gl2.LINES] = 2, obj[gl2.TRIANGLES] = 3, obj[gl2.LINE_STRIP] = 1, obj)[drawMode];\n for (var i = 0, list = segments.get(); i < list.length; i += 1) {\n var segment = list[i];\n var vaos = segment.vaos || (segment.vaos = {});\n var vao = vaos[layerID] || (vaos[layerID] = new VertexArrayObject());\n vao.bind(context, this, layoutVertexBuffer, configuration ? configuration.getPaintVertexBuffers() : [], indexBuffer, segment.vertexOffset, dynamicLayoutBuffer, dynamicLayoutBuffer2);\n gl2.drawElements(drawMode, segment.primitiveLength * primitiveSize, gl2.UNSIGNED_SHORT, segment.primitiveOffset * primitiveSize * 2);\n }\n };\n function patternUniformValues(crossfade, painter, tile) {\n var tileRatio = 1 / pixelsToTileUnits(tile, 1, painter.transform.tileZoom);\n var numTiles = Math.pow(2, tile.tileID.overscaledZ);\n var tileSizeAtNearestZoom = tile.tileSize * Math.pow(2, painter.transform.tileZoom) / numTiles;\n var pixelX = tileSizeAtNearestZoom * (tile.tileID.canonical.x + tile.tileID.wrap * numTiles);\n var pixelY = tileSizeAtNearestZoom * tile.tileID.canonical.y;\n return {\n \"u_image\": 0,\n \"u_texsize\": tile.imageAtlasTexture.size,\n \"u_scale\": [\n tileRatio,\n crossfade.fromScale,\n crossfade.toScale\n ],\n \"u_fade\": crossfade.t,\n \"u_pixel_coord_upper\": [\n pixelX >> 16,\n pixelY >> 16\n ],\n \"u_pixel_coord_lower\": [\n pixelX & 65535,\n pixelY & 65535\n ]\n };\n }\n function bgPatternUniformValues(image, crossfade, painter, tile) {\n var imagePosA = painter.imageManager.getPattern(image.from.toString());\n var imagePosB = painter.imageManager.getPattern(image.to.toString());\n var ref = painter.imageManager.getPixelSize();\n var width = ref.width;\n var height = ref.height;\n var numTiles = Math.pow(2, tile.tileID.overscaledZ);\n var tileSizeAtNearestZoom = tile.tileSize * Math.pow(2, painter.transform.tileZoom) / numTiles;\n var pixelX = tileSizeAtNearestZoom * (tile.tileID.canonical.x + tile.tileID.wrap * numTiles);\n var pixelY = tileSizeAtNearestZoom * tile.tileID.canonical.y;\n return {\n \"u_image\": 0,\n \"u_pattern_tl_a\": imagePosA.tl,\n \"u_pattern_br_a\": imagePosA.br,\n \"u_pattern_tl_b\": imagePosB.tl,\n \"u_pattern_br_b\": imagePosB.br,\n \"u_texsize\": [\n width,\n height\n ],\n \"u_mix\": crossfade.t,\n \"u_pattern_size_a\": imagePosA.displaySize,\n \"u_pattern_size_b\": imagePosB.displaySize,\n \"u_scale_a\": crossfade.fromScale,\n \"u_scale_b\": crossfade.toScale,\n \"u_tile_units_to_pixels\": 1 / pixelsToTileUnits(tile, 1, painter.transform.tileZoom),\n \"u_pixel_coord_upper\": [\n pixelX >> 16,\n pixelY >> 16\n ],\n \"u_pixel_coord_lower\": [\n pixelX & 65535,\n pixelY & 65535\n ]\n };\n }\n var fillExtrusionUniforms = function(context, locations) {\n return {\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_lightpos\": new performance2.Uniform3f(context, locations.u_lightpos),\n \"u_lightintensity\": new performance2.Uniform1f(context, locations.u_lightintensity),\n \"u_lightcolor\": new performance2.Uniform3f(context, locations.u_lightcolor),\n \"u_vertical_gradient\": new performance2.Uniform1f(context, locations.u_vertical_gradient),\n \"u_opacity\": new performance2.Uniform1f(context, locations.u_opacity)\n };\n };\n var fillExtrusionPatternUniforms = function(context, locations) {\n return {\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_lightpos\": new performance2.Uniform3f(context, locations.u_lightpos),\n \"u_lightintensity\": new performance2.Uniform1f(context, locations.u_lightintensity),\n \"u_lightcolor\": new performance2.Uniform3f(context, locations.u_lightcolor),\n \"u_vertical_gradient\": new performance2.Uniform1f(context, locations.u_vertical_gradient),\n \"u_height_factor\": new performance2.Uniform1f(context, locations.u_height_factor),\n \"u_image\": new performance2.Uniform1i(context, locations.u_image),\n \"u_texsize\": new performance2.Uniform2f(context, locations.u_texsize),\n \"u_pixel_coord_upper\": new performance2.Uniform2f(context, locations.u_pixel_coord_upper),\n \"u_pixel_coord_lower\": new performance2.Uniform2f(context, locations.u_pixel_coord_lower),\n \"u_scale\": new performance2.Uniform3f(context, locations.u_scale),\n \"u_fade\": new performance2.Uniform1f(context, locations.u_fade),\n \"u_opacity\": new performance2.Uniform1f(context, locations.u_opacity)\n };\n };\n var fillExtrusionUniformValues = function(matrix, painter, shouldUseVerticalGradient, opacity) {\n var light = painter.style.light;\n var _lp = light.properties.get(\"position\");\n var lightPos = [\n _lp.x,\n _lp.y,\n _lp.z\n ];\n var lightMat = performance2.create$1();\n if (light.properties.get(\"anchor\") === \"viewport\") {\n performance2.fromRotation(lightMat, -painter.transform.angle);\n }\n performance2.transformMat3(lightPos, lightPos, lightMat);\n var lightColor = light.properties.get(\"color\");\n return {\n \"u_matrix\": matrix,\n \"u_lightpos\": lightPos,\n \"u_lightintensity\": light.properties.get(\"intensity\"),\n \"u_lightcolor\": [\n lightColor.r,\n lightColor.g,\n lightColor.b\n ],\n \"u_vertical_gradient\": +shouldUseVerticalGradient,\n \"u_opacity\": opacity\n };\n };\n var fillExtrusionPatternUniformValues = function(matrix, painter, shouldUseVerticalGradient, opacity, coord, crossfade, tile) {\n return performance2.extend(fillExtrusionUniformValues(matrix, painter, shouldUseVerticalGradient, opacity), patternUniformValues(crossfade, painter, tile), { \"u_height_factor\": -Math.pow(2, coord.overscaledZ) / tile.tileSize / 8 });\n };\n var fillUniforms = function(context, locations) {\n return { \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix) };\n };\n var fillPatternUniforms = function(context, locations) {\n return {\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_image\": new performance2.Uniform1i(context, locations.u_image),\n \"u_texsize\": new performance2.Uniform2f(context, locations.u_texsize),\n \"u_pixel_coord_upper\": new performance2.Uniform2f(context, locations.u_pixel_coord_upper),\n \"u_pixel_coord_lower\": new performance2.Uniform2f(context, locations.u_pixel_coord_lower),\n \"u_scale\": new performance2.Uniform3f(context, locations.u_scale),\n \"u_fade\": new performance2.Uniform1f(context, locations.u_fade)\n };\n };\n var fillOutlineUniforms = function(context, locations) {\n return {\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_world\": new performance2.Uniform2f(context, locations.u_world)\n };\n };\n var fillOutlinePatternUniforms = function(context, locations) {\n return {\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_world\": new performance2.Uniform2f(context, locations.u_world),\n \"u_image\": new performance2.Uniform1i(context, locations.u_image),\n \"u_texsize\": new performance2.Uniform2f(context, locations.u_texsize),\n \"u_pixel_coord_upper\": new performance2.Uniform2f(context, locations.u_pixel_coord_upper),\n \"u_pixel_coord_lower\": new performance2.Uniform2f(context, locations.u_pixel_coord_lower),\n \"u_scale\": new performance2.Uniform3f(context, locations.u_scale),\n \"u_fade\": new performance2.Uniform1f(context, locations.u_fade)\n };\n };\n var fillUniformValues = function(matrix) {\n return { \"u_matrix\": matrix };\n };\n var fillPatternUniformValues = function(matrix, painter, crossfade, tile) {\n return performance2.extend(fillUniformValues(matrix), patternUniformValues(crossfade, painter, tile));\n };\n var fillOutlineUniformValues = function(matrix, drawingBufferSize) {\n return {\n \"u_matrix\": matrix,\n \"u_world\": drawingBufferSize\n };\n };\n var fillOutlinePatternUniformValues = function(matrix, painter, crossfade, tile, drawingBufferSize) {\n return performance2.extend(fillPatternUniformValues(matrix, painter, crossfade, tile), { \"u_world\": drawingBufferSize });\n };\n var circleUniforms = function(context, locations) {\n return {\n \"u_camera_to_center_distance\": new performance2.Uniform1f(context, locations.u_camera_to_center_distance),\n \"u_scale_with_map\": new performance2.Uniform1i(context, locations.u_scale_with_map),\n \"u_pitch_with_map\": new performance2.Uniform1i(context, locations.u_pitch_with_map),\n \"u_extrude_scale\": new performance2.Uniform2f(context, locations.u_extrude_scale),\n \"u_device_pixel_ratio\": new performance2.Uniform1f(context, locations.u_device_pixel_ratio),\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix)\n };\n };\n var circleUniformValues = function(painter, coord, tile, layer) {\n var transform = painter.transform;\n var pitchWithMap, extrudeScale;\n if (layer.paint.get(\"circle-pitch-alignment\") === \"map\") {\n var pixelRatio = pixelsToTileUnits(tile, 1, transform.zoom);\n pitchWithMap = true;\n extrudeScale = [\n pixelRatio,\n pixelRatio\n ];\n } else {\n pitchWithMap = false;\n extrudeScale = transform.pixelsToGLUnits;\n }\n return {\n \"u_camera_to_center_distance\": transform.cameraToCenterDistance,\n \"u_scale_with_map\": +(layer.paint.get(\"circle-pitch-scale\") === \"map\"),\n \"u_matrix\": painter.translatePosMatrix(coord.posMatrix, tile, layer.paint.get(\"circle-translate\"), layer.paint.get(\"circle-translate-anchor\")),\n \"u_pitch_with_map\": +pitchWithMap,\n \"u_device_pixel_ratio\": performance2.browser.devicePixelRatio,\n \"u_extrude_scale\": extrudeScale\n };\n };\n var collisionUniforms = function(context, locations) {\n return {\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_camera_to_center_distance\": new performance2.Uniform1f(context, locations.u_camera_to_center_distance),\n \"u_pixels_to_tile_units\": new performance2.Uniform1f(context, locations.u_pixels_to_tile_units),\n \"u_extrude_scale\": new performance2.Uniform2f(context, locations.u_extrude_scale),\n \"u_overscale_factor\": new performance2.Uniform1f(context, locations.u_overscale_factor)\n };\n };\n var collisionCircleUniforms = function(context, locations) {\n return {\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_inv_matrix\": new performance2.UniformMatrix4f(context, locations.u_inv_matrix),\n \"u_camera_to_center_distance\": new performance2.Uniform1f(context, locations.u_camera_to_center_distance),\n \"u_viewport_size\": new performance2.Uniform2f(context, locations.u_viewport_size)\n };\n };\n var collisionUniformValues = function(matrix, transform, tile) {\n var pixelRatio = pixelsToTileUnits(tile, 1, transform.zoom);\n var scale = Math.pow(2, transform.zoom - tile.tileID.overscaledZ);\n var overscaleFactor = tile.tileID.overscaleFactor();\n return {\n \"u_matrix\": matrix,\n \"u_camera_to_center_distance\": transform.cameraToCenterDistance,\n \"u_pixels_to_tile_units\": pixelRatio,\n \"u_extrude_scale\": [\n transform.pixelsToGLUnits[0] / (pixelRatio * scale),\n transform.pixelsToGLUnits[1] / (pixelRatio * scale)\n ],\n \"u_overscale_factor\": overscaleFactor\n };\n };\n var collisionCircleUniformValues = function(matrix, invMatrix, transform) {\n return {\n \"u_matrix\": matrix,\n \"u_inv_matrix\": invMatrix,\n \"u_camera_to_center_distance\": transform.cameraToCenterDistance,\n \"u_viewport_size\": [\n transform.width,\n transform.height\n ]\n };\n };\n var debugUniforms = function(context, locations) {\n return {\n \"u_color\": new performance2.UniformColor(context, locations.u_color),\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_overlay\": new performance2.Uniform1i(context, locations.u_overlay),\n \"u_overlay_scale\": new performance2.Uniform1f(context, locations.u_overlay_scale)\n };\n };\n var debugUniformValues = function(matrix, color2, scaleRatio) {\n if (scaleRatio === void 0)\n scaleRatio = 1;\n return {\n \"u_matrix\": matrix,\n \"u_color\": color2,\n \"u_overlay\": 0,\n \"u_overlay_scale\": scaleRatio\n };\n };\n var clippingMaskUniforms = function(context, locations) {\n return { \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix) };\n };\n var clippingMaskUniformValues = function(matrix) {\n return { \"u_matrix\": matrix };\n };\n var heatmapUniforms = function(context, locations) {\n return {\n \"u_extrude_scale\": new performance2.Uniform1f(context, locations.u_extrude_scale),\n \"u_intensity\": new performance2.Uniform1f(context, locations.u_intensity),\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix)\n };\n };\n var heatmapTextureUniforms = function(context, locations) {\n return {\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_world\": new performance2.Uniform2f(context, locations.u_world),\n \"u_image\": new performance2.Uniform1i(context, locations.u_image),\n \"u_color_ramp\": new performance2.Uniform1i(context, locations.u_color_ramp),\n \"u_opacity\": new performance2.Uniform1f(context, locations.u_opacity)\n };\n };\n var heatmapUniformValues = function(matrix, tile, zoom, intensity) {\n return {\n \"u_matrix\": matrix,\n \"u_extrude_scale\": pixelsToTileUnits(tile, 1, zoom),\n \"u_intensity\": intensity\n };\n };\n var heatmapTextureUniformValues = function(painter, layer, textureUnit, colorRampUnit) {\n var matrix = performance2.create();\n performance2.ortho(matrix, 0, painter.width, painter.height, 0, 0, 1);\n var gl2 = painter.context.gl;\n return {\n \"u_matrix\": matrix,\n \"u_world\": [\n gl2.drawingBufferWidth,\n gl2.drawingBufferHeight\n ],\n \"u_image\": textureUnit,\n \"u_color_ramp\": colorRampUnit,\n \"u_opacity\": layer.paint.get(\"heatmap-opacity\")\n };\n };\n var hillshadeUniforms = function(context, locations) {\n return {\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_image\": new performance2.Uniform1i(context, locations.u_image),\n \"u_latrange\": new performance2.Uniform2f(context, locations.u_latrange),\n \"u_light\": new performance2.Uniform2f(context, locations.u_light),\n \"u_shadow\": new performance2.UniformColor(context, locations.u_shadow),\n \"u_highlight\": new performance2.UniformColor(context, locations.u_highlight),\n \"u_accent\": new performance2.UniformColor(context, locations.u_accent)\n };\n };\n var hillshadePrepareUniforms = function(context, locations) {\n return {\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_image\": new performance2.Uniform1i(context, locations.u_image),\n \"u_dimension\": new performance2.Uniform2f(context, locations.u_dimension),\n \"u_zoom\": new performance2.Uniform1f(context, locations.u_zoom),\n \"u_unpack\": new performance2.Uniform4f(context, locations.u_unpack)\n };\n };\n var hillshadeUniformValues = function(painter, tile, layer) {\n var shadow = layer.paint.get(\"hillshade-shadow-color\");\n var highlight = layer.paint.get(\"hillshade-highlight-color\");\n var accent = layer.paint.get(\"hillshade-accent-color\");\n var azimuthal = layer.paint.get(\"hillshade-illumination-direction\") * (Math.PI / 180);\n if (layer.paint.get(\"hillshade-illumination-anchor\") === \"viewport\") {\n azimuthal -= painter.transform.angle;\n }\n var align = !painter.options.moving;\n return {\n \"u_matrix\": painter.transform.calculatePosMatrix(tile.tileID.toUnwrapped(), align),\n \"u_image\": 0,\n \"u_latrange\": getTileLatRange(painter, tile.tileID),\n \"u_light\": [\n layer.paint.get(\"hillshade-exaggeration\"),\n azimuthal\n ],\n \"u_shadow\": shadow,\n \"u_highlight\": highlight,\n \"u_accent\": accent\n };\n };\n var hillshadeUniformPrepareValues = function(tileID, dem) {\n var stride = dem.stride;\n var matrix = performance2.create();\n performance2.ortho(matrix, 0, performance2.EXTENT, -performance2.EXTENT, 0, 0, 1);\n performance2.translate(matrix, matrix, [\n 0,\n -performance2.EXTENT,\n 0\n ]);\n return {\n \"u_matrix\": matrix,\n \"u_image\": 1,\n \"u_dimension\": [\n stride,\n stride\n ],\n \"u_zoom\": tileID.overscaledZ,\n \"u_unpack\": dem.getUnpackVector()\n };\n };\n function getTileLatRange(painter, tileID) {\n var tilesAtZoom = Math.pow(2, tileID.canonical.z);\n var y = tileID.canonical.y;\n return [\n new performance2.MercatorCoordinate(0, y / tilesAtZoom).toLngLat().lat,\n new performance2.MercatorCoordinate(0, (y + 1) / tilesAtZoom).toLngLat().lat\n ];\n }\n var lineUniforms = function(context, locations) {\n return {\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_ratio\": new performance2.Uniform1f(context, locations.u_ratio),\n \"u_device_pixel_ratio\": new performance2.Uniform1f(context, locations.u_device_pixel_ratio),\n \"u_units_to_pixels\": new performance2.Uniform2f(context, locations.u_units_to_pixels)\n };\n };\n var lineGradientUniforms = function(context, locations) {\n return {\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_ratio\": new performance2.Uniform1f(context, locations.u_ratio),\n \"u_device_pixel_ratio\": new performance2.Uniform1f(context, locations.u_device_pixel_ratio),\n \"u_units_to_pixels\": new performance2.Uniform2f(context, locations.u_units_to_pixels),\n \"u_image\": new performance2.Uniform1i(context, locations.u_image),\n \"u_image_height\": new performance2.Uniform1f(context, locations.u_image_height)\n };\n };\n var linePatternUniforms = function(context, locations) {\n return {\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_texsize\": new performance2.Uniform2f(context, locations.u_texsize),\n \"u_ratio\": new performance2.Uniform1f(context, locations.u_ratio),\n \"u_device_pixel_ratio\": new performance2.Uniform1f(context, locations.u_device_pixel_ratio),\n \"u_image\": new performance2.Uniform1i(context, locations.u_image),\n \"u_units_to_pixels\": new performance2.Uniform2f(context, locations.u_units_to_pixels),\n \"u_scale\": new performance2.Uniform3f(context, locations.u_scale),\n \"u_fade\": new performance2.Uniform1f(context, locations.u_fade)\n };\n };\n var lineSDFUniforms = function(context, locations) {\n return {\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_ratio\": new performance2.Uniform1f(context, locations.u_ratio),\n \"u_device_pixel_ratio\": new performance2.Uniform1f(context, locations.u_device_pixel_ratio),\n \"u_units_to_pixels\": new performance2.Uniform2f(context, locations.u_units_to_pixels),\n \"u_patternscale_a\": new performance2.Uniform2f(context, locations.u_patternscale_a),\n \"u_patternscale_b\": new performance2.Uniform2f(context, locations.u_patternscale_b),\n \"u_sdfgamma\": new performance2.Uniform1f(context, locations.u_sdfgamma),\n \"u_image\": new performance2.Uniform1i(context, locations.u_image),\n \"u_tex_y_a\": new performance2.Uniform1f(context, locations.u_tex_y_a),\n \"u_tex_y_b\": new performance2.Uniform1f(context, locations.u_tex_y_b),\n \"u_mix\": new performance2.Uniform1f(context, locations.u_mix)\n };\n };\n var lineUniformValues = function(painter, tile, layer) {\n var transform = painter.transform;\n return {\n \"u_matrix\": calculateMatrix(painter, tile, layer),\n \"u_ratio\": 1 / pixelsToTileUnits(tile, 1, transform.zoom),\n \"u_device_pixel_ratio\": performance2.browser.devicePixelRatio,\n \"u_units_to_pixels\": [\n 1 / transform.pixelsToGLUnits[0],\n 1 / transform.pixelsToGLUnits[1]\n ]\n };\n };\n var lineGradientUniformValues = function(painter, tile, layer, imageHeight) {\n return performance2.extend(lineUniformValues(painter, tile, layer), {\n \"u_image\": 0,\n \"u_image_height\": imageHeight\n });\n };\n var linePatternUniformValues = function(painter, tile, layer, crossfade) {\n var transform = painter.transform;\n var tileZoomRatio = calculateTileRatio(tile, transform);\n return {\n \"u_matrix\": calculateMatrix(painter, tile, layer),\n \"u_texsize\": tile.imageAtlasTexture.size,\n \"u_ratio\": 1 / pixelsToTileUnits(tile, 1, transform.zoom),\n \"u_device_pixel_ratio\": performance2.browser.devicePixelRatio,\n \"u_image\": 0,\n \"u_scale\": [\n tileZoomRatio,\n crossfade.fromScale,\n crossfade.toScale\n ],\n \"u_fade\": crossfade.t,\n \"u_units_to_pixels\": [\n 1 / transform.pixelsToGLUnits[0],\n 1 / transform.pixelsToGLUnits[1]\n ]\n };\n };\n var lineSDFUniformValues = function(painter, tile, layer, dasharray, crossfade) {\n var transform = painter.transform;\n var lineAtlas = painter.lineAtlas;\n var tileRatio = calculateTileRatio(tile, transform);\n var round = layer.layout.get(\"line-cap\") === \"round\";\n var posA = lineAtlas.getDash(dasharray.from, round);\n var posB = lineAtlas.getDash(dasharray.to, round);\n var widthA = posA.width * crossfade.fromScale;\n var widthB = posB.width * crossfade.toScale;\n return performance2.extend(lineUniformValues(painter, tile, layer), {\n \"u_patternscale_a\": [\n tileRatio / widthA,\n -posA.height / 2\n ],\n \"u_patternscale_b\": [\n tileRatio / widthB,\n -posB.height / 2\n ],\n \"u_sdfgamma\": lineAtlas.width / (Math.min(widthA, widthB) * 256 * performance2.browser.devicePixelRatio) / 2,\n \"u_image\": 0,\n \"u_tex_y_a\": posA.y,\n \"u_tex_y_b\": posB.y,\n \"u_mix\": crossfade.t\n });\n };\n function calculateTileRatio(tile, transform) {\n return 1 / pixelsToTileUnits(tile, 1, transform.tileZoom);\n }\n function calculateMatrix(painter, tile, layer) {\n return painter.translatePosMatrix(tile.tileID.posMatrix, tile, layer.paint.get(\"line-translate\"), layer.paint.get(\"line-translate-anchor\"));\n }\n var rasterUniforms = function(context, locations) {\n return {\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_tl_parent\": new performance2.Uniform2f(context, locations.u_tl_parent),\n \"u_scale_parent\": new performance2.Uniform1f(context, locations.u_scale_parent),\n \"u_buffer_scale\": new performance2.Uniform1f(context, locations.u_buffer_scale),\n \"u_fade_t\": new performance2.Uniform1f(context, locations.u_fade_t),\n \"u_opacity\": new performance2.Uniform1f(context, locations.u_opacity),\n \"u_image0\": new performance2.Uniform1i(context, locations.u_image0),\n \"u_image1\": new performance2.Uniform1i(context, locations.u_image1),\n \"u_brightness_low\": new performance2.Uniform1f(context, locations.u_brightness_low),\n \"u_brightness_high\": new performance2.Uniform1f(context, locations.u_brightness_high),\n \"u_saturation_factor\": new performance2.Uniform1f(context, locations.u_saturation_factor),\n \"u_contrast_factor\": new performance2.Uniform1f(context, locations.u_contrast_factor),\n \"u_spin_weights\": new performance2.Uniform3f(context, locations.u_spin_weights)\n };\n };\n var rasterUniformValues = function(matrix, parentTL, parentScaleBy, fade, layer) {\n return {\n \"u_matrix\": matrix,\n \"u_tl_parent\": parentTL,\n \"u_scale_parent\": parentScaleBy,\n \"u_buffer_scale\": 1,\n \"u_fade_t\": fade.mix,\n \"u_opacity\": fade.opacity * layer.paint.get(\"raster-opacity\"),\n \"u_image0\": 0,\n \"u_image1\": 1,\n \"u_brightness_low\": layer.paint.get(\"raster-brightness-min\"),\n \"u_brightness_high\": layer.paint.get(\"raster-brightness-max\"),\n \"u_saturation_factor\": saturationFactor(layer.paint.get(\"raster-saturation\")),\n \"u_contrast_factor\": contrastFactor(layer.paint.get(\"raster-contrast\")),\n \"u_spin_weights\": spinWeights(layer.paint.get(\"raster-hue-rotate\"))\n };\n };\n function spinWeights(angle) {\n angle *= Math.PI / 180;\n var s = Math.sin(angle);\n var c = Math.cos(angle);\n return [\n (2 * c + 1) / 3,\n (-Math.sqrt(3) * s - c + 1) / 3,\n (Math.sqrt(3) * s - c + 1) / 3\n ];\n }\n function contrastFactor(contrast) {\n return contrast > 0 ? 1 / (1 - contrast) : 1 + contrast;\n }\n function saturationFactor(saturation) {\n return saturation > 0 ? 1 - 1 / (1.001 - saturation) : -saturation;\n }\n var symbolIconUniforms = function(context, locations) {\n return {\n \"u_is_size_zoom_constant\": new performance2.Uniform1i(context, locations.u_is_size_zoom_constant),\n \"u_is_size_feature_constant\": new performance2.Uniform1i(context, locations.u_is_size_feature_constant),\n \"u_size_t\": new performance2.Uniform1f(context, locations.u_size_t),\n \"u_size\": new performance2.Uniform1f(context, locations.u_size),\n \"u_camera_to_center_distance\": new performance2.Uniform1f(context, locations.u_camera_to_center_distance),\n \"u_pitch\": new performance2.Uniform1f(context, locations.u_pitch),\n \"u_rotate_symbol\": new performance2.Uniform1i(context, locations.u_rotate_symbol),\n \"u_aspect_ratio\": new performance2.Uniform1f(context, locations.u_aspect_ratio),\n \"u_fade_change\": new performance2.Uniform1f(context, locations.u_fade_change),\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_label_plane_matrix\": new performance2.UniformMatrix4f(context, locations.u_label_plane_matrix),\n \"u_coord_matrix\": new performance2.UniformMatrix4f(context, locations.u_coord_matrix),\n \"u_is_text\": new performance2.Uniform1i(context, locations.u_is_text),\n \"u_pitch_with_map\": new performance2.Uniform1i(context, locations.u_pitch_with_map),\n \"u_texsize\": new performance2.Uniform2f(context, locations.u_texsize),\n \"u_texture\": new performance2.Uniform1i(context, locations.u_texture)\n };\n };\n var symbolSDFUniforms = function(context, locations) {\n return {\n \"u_is_size_zoom_constant\": new performance2.Uniform1i(context, locations.u_is_size_zoom_constant),\n \"u_is_size_feature_constant\": new performance2.Uniform1i(context, locations.u_is_size_feature_constant),\n \"u_size_t\": new performance2.Uniform1f(context, locations.u_size_t),\n \"u_size\": new performance2.Uniform1f(context, locations.u_size),\n \"u_camera_to_center_distance\": new performance2.Uniform1f(context, locations.u_camera_to_center_distance),\n \"u_pitch\": new performance2.Uniform1f(context, locations.u_pitch),\n \"u_rotate_symbol\": new performance2.Uniform1i(context, locations.u_rotate_symbol),\n \"u_aspect_ratio\": new performance2.Uniform1f(context, locations.u_aspect_ratio),\n \"u_fade_change\": new performance2.Uniform1f(context, locations.u_fade_change),\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_label_plane_matrix\": new performance2.UniformMatrix4f(context, locations.u_label_plane_matrix),\n \"u_coord_matrix\": new performance2.UniformMatrix4f(context, locations.u_coord_matrix),\n \"u_is_text\": new performance2.Uniform1i(context, locations.u_is_text),\n \"u_pitch_with_map\": new performance2.Uniform1i(context, locations.u_pitch_with_map),\n \"u_texsize\": new performance2.Uniform2f(context, locations.u_texsize),\n \"u_texture\": new performance2.Uniform1i(context, locations.u_texture),\n \"u_gamma_scale\": new performance2.Uniform1f(context, locations.u_gamma_scale),\n \"u_device_pixel_ratio\": new performance2.Uniform1f(context, locations.u_device_pixel_ratio),\n \"u_is_halo\": new performance2.Uniform1i(context, locations.u_is_halo)\n };\n };\n var symbolTextAndIconUniforms = function(context, locations) {\n return {\n \"u_is_size_zoom_constant\": new performance2.Uniform1i(context, locations.u_is_size_zoom_constant),\n \"u_is_size_feature_constant\": new performance2.Uniform1i(context, locations.u_is_size_feature_constant),\n \"u_size_t\": new performance2.Uniform1f(context, locations.u_size_t),\n \"u_size\": new performance2.Uniform1f(context, locations.u_size),\n \"u_camera_to_center_distance\": new performance2.Uniform1f(context, locations.u_camera_to_center_distance),\n \"u_pitch\": new performance2.Uniform1f(context, locations.u_pitch),\n \"u_rotate_symbol\": new performance2.Uniform1i(context, locations.u_rotate_symbol),\n \"u_aspect_ratio\": new performance2.Uniform1f(context, locations.u_aspect_ratio),\n \"u_fade_change\": new performance2.Uniform1f(context, locations.u_fade_change),\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_label_plane_matrix\": new performance2.UniformMatrix4f(context, locations.u_label_plane_matrix),\n \"u_coord_matrix\": new performance2.UniformMatrix4f(context, locations.u_coord_matrix),\n \"u_is_text\": new performance2.Uniform1i(context, locations.u_is_text),\n \"u_pitch_with_map\": new performance2.Uniform1i(context, locations.u_pitch_with_map),\n \"u_texsize\": new performance2.Uniform2f(context, locations.u_texsize),\n \"u_texsize_icon\": new performance2.Uniform2f(context, locations.u_texsize_icon),\n \"u_texture\": new performance2.Uniform1i(context, locations.u_texture),\n \"u_texture_icon\": new performance2.Uniform1i(context, locations.u_texture_icon),\n \"u_gamma_scale\": new performance2.Uniform1f(context, locations.u_gamma_scale),\n \"u_device_pixel_ratio\": new performance2.Uniform1f(context, locations.u_device_pixel_ratio),\n \"u_is_halo\": new performance2.Uniform1i(context, locations.u_is_halo)\n };\n };\n var symbolIconUniformValues = function(functionType, size, rotateInShader, pitchWithMap, painter, matrix, labelPlaneMatrix, glCoordMatrix, isText, texSize) {\n var transform = painter.transform;\n return {\n \"u_is_size_zoom_constant\": +(functionType === \"constant\" || functionType === \"source\"),\n \"u_is_size_feature_constant\": +(functionType === \"constant\" || functionType === \"camera\"),\n \"u_size_t\": size ? size.uSizeT : 0,\n \"u_size\": size ? size.uSize : 0,\n \"u_camera_to_center_distance\": transform.cameraToCenterDistance,\n \"u_pitch\": transform.pitch / 360 * 2 * Math.PI,\n \"u_rotate_symbol\": +rotateInShader,\n \"u_aspect_ratio\": transform.width / transform.height,\n \"u_fade_change\": painter.options.fadeDuration ? painter.symbolFadeChange : 1,\n \"u_matrix\": matrix,\n \"u_label_plane_matrix\": labelPlaneMatrix,\n \"u_coord_matrix\": glCoordMatrix,\n \"u_is_text\": +isText,\n \"u_pitch_with_map\": +pitchWithMap,\n \"u_texsize\": texSize,\n \"u_texture\": 0\n };\n };\n var symbolSDFUniformValues = function(functionType, size, rotateInShader, pitchWithMap, painter, matrix, labelPlaneMatrix, glCoordMatrix, isText, texSize, isHalo) {\n var transform = painter.transform;\n return performance2.extend(symbolIconUniformValues(functionType, size, rotateInShader, pitchWithMap, painter, matrix, labelPlaneMatrix, glCoordMatrix, isText, texSize), {\n \"u_gamma_scale\": pitchWithMap ? Math.cos(transform._pitch) * transform.cameraToCenterDistance : 1,\n \"u_device_pixel_ratio\": performance2.browser.devicePixelRatio,\n \"u_is_halo\": +isHalo\n });\n };\n var symbolTextAndIconUniformValues = function(functionType, size, rotateInShader, pitchWithMap, painter, matrix, labelPlaneMatrix, glCoordMatrix, texSizeSDF, texSizeIcon) {\n return performance2.extend(symbolSDFUniformValues(functionType, size, rotateInShader, pitchWithMap, painter, matrix, labelPlaneMatrix, glCoordMatrix, true, texSizeSDF, true), {\n \"u_texsize_icon\": texSizeIcon,\n \"u_texture_icon\": 1\n });\n };\n var backgroundUniforms = function(context, locations) {\n return {\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_opacity\": new performance2.Uniform1f(context, locations.u_opacity),\n \"u_color\": new performance2.UniformColor(context, locations.u_color)\n };\n };\n var backgroundPatternUniforms = function(context, locations) {\n return {\n \"u_matrix\": new performance2.UniformMatrix4f(context, locations.u_matrix),\n \"u_opacity\": new performance2.Uniform1f(context, locations.u_opacity),\n \"u_image\": new performance2.Uniform1i(context, locations.u_image),\n \"u_pattern_tl_a\": new performance2.Uniform2f(context, locations.u_pattern_tl_a),\n \"u_pattern_br_a\": new performance2.Uniform2f(context, locations.u_pattern_br_a),\n \"u_pattern_tl_b\": new performance2.Uniform2f(context, locations.u_pattern_tl_b),\n \"u_pattern_br_b\": new performance2.Uniform2f(context, locations.u_pattern_br_b),\n \"u_texsize\": new performance2.Uniform2f(context, locations.u_texsize),\n \"u_mix\": new performance2.Uniform1f(context, locations.u_mix),\n \"u_pattern_size_a\": new performance2.Uniform2f(context, locations.u_pattern_size_a),\n \"u_pattern_size_b\": new performance2.Uniform2f(context, locations.u_pattern_size_b),\n \"u_scale_a\": new performance2.Uniform1f(context, locations.u_scale_a),\n \"u_scale_b\": new performance2.Uniform1f(context, locations.u_scale_b),\n \"u_pixel_coord_upper\": new performance2.Uniform2f(context, locations.u_pixel_coord_upper),\n \"u_pixel_coord_lower\": new performance2.Uniform2f(context, locations.u_pixel_coord_lower),\n \"u_tile_units_to_pixels\": new performance2.Uniform1f(context, locations.u_tile_units_to_pixels)\n };\n };\n var backgroundUniformValues = function(matrix, opacity, color2) {\n return {\n \"u_matrix\": matrix,\n \"u_opacity\": opacity,\n \"u_color\": color2\n };\n };\n var backgroundPatternUniformValues = function(matrix, opacity, painter, image, tile, crossfade) {\n return performance2.extend(bgPatternUniformValues(image, crossfade, painter, tile), {\n \"u_matrix\": matrix,\n \"u_opacity\": opacity\n });\n };\n var programUniforms = {\n fillExtrusion: fillExtrusionUniforms,\n fillExtrusionPattern: fillExtrusionPatternUniforms,\n fill: fillUniforms,\n fillPattern: fillPatternUniforms,\n fillOutline: fillOutlineUniforms,\n fillOutlinePattern: fillOutlinePatternUniforms,\n circle: circleUniforms,\n collisionBox: collisionUniforms,\n collisionCircle: collisionCircleUniforms,\n debug: debugUniforms,\n clippingMask: clippingMaskUniforms,\n heatmap: heatmapUniforms,\n heatmapTexture: heatmapTextureUniforms,\n hillshade: hillshadeUniforms,\n hillshadePrepare: hillshadePrepareUniforms,\n line: lineUniforms,\n lineGradient: lineGradientUniforms,\n linePattern: linePatternUniforms,\n lineSDF: lineSDFUniforms,\n raster: rasterUniforms,\n symbolIcon: symbolIconUniforms,\n symbolSDF: symbolSDFUniforms,\n symbolTextAndIcon: symbolTextAndIconUniforms,\n background: backgroundUniforms,\n backgroundPattern: backgroundPatternUniforms\n };\n var quadTriangles;\n function drawCollisionDebug(painter, sourceCache, layer, coords, translate, translateAnchor, isText) {\n var context = painter.context;\n var gl2 = context.gl;\n var program = painter.useProgram(\"collisionBox\");\n var tileBatches = [];\n var circleCount = 0;\n var circleOffset = 0;\n for (var i = 0; i < coords.length; i++) {\n var coord = coords[i];\n var tile = sourceCache.getTile(coord);\n var bucket = tile.getBucket(layer);\n if (!bucket) {\n continue;\n }\n var posMatrix = coord.posMatrix;\n if (translate[0] !== 0 || translate[1] !== 0) {\n posMatrix = painter.translatePosMatrix(coord.posMatrix, tile, translate, translateAnchor);\n }\n var buffers = isText ? bucket.textCollisionBox : bucket.iconCollisionBox;\n var circleArray = bucket.collisionCircleArray;\n if (circleArray.length > 0) {\n var invTransform = performance2.create();\n var transform = posMatrix;\n performance2.mul(invTransform, bucket.placementInvProjMatrix, painter.transform.glCoordMatrix);\n performance2.mul(invTransform, invTransform, bucket.placementViewportMatrix);\n tileBatches.push({\n circleArray,\n circleOffset,\n transform,\n invTransform\n });\n circleCount += circleArray.length / 4;\n circleOffset = circleCount;\n }\n if (!buffers) {\n continue;\n }\n program.draw(context, gl2.LINES, DepthMode.disabled, StencilMode.disabled, painter.colorModeForRenderPass(), CullFaceMode.disabled, collisionUniformValues(posMatrix, painter.transform, tile), layer.id, buffers.layoutVertexBuffer, buffers.indexBuffer, buffers.segments, null, painter.transform.zoom, null, null, buffers.collisionVertexBuffer);\n }\n if (!isText || !tileBatches.length) {\n return;\n }\n var circleProgram = painter.useProgram(\"collisionCircle\");\n var vertexData = new performance2.StructArrayLayout2f1f2i16();\n vertexData.resize(circleCount * 4);\n vertexData._trim();\n var vertexOffset = 0;\n for (var i$2 = 0, list = tileBatches; i$2 < list.length; i$2 += 1) {\n var batch = list[i$2];\n for (var i$1 = 0; i$1 < batch.circleArray.length / 4; i$1++) {\n var circleIdx = i$1 * 4;\n var x = batch.circleArray[circleIdx + 0];\n var y = batch.circleArray[circleIdx + 1];\n var radius = batch.circleArray[circleIdx + 2];\n var collision = batch.circleArray[circleIdx + 3];\n vertexData.emplace(vertexOffset++, x, y, radius, collision, 0);\n vertexData.emplace(vertexOffset++, x, y, radius, collision, 1);\n vertexData.emplace(vertexOffset++, x, y, radius, collision, 2);\n vertexData.emplace(vertexOffset++, x, y, radius, collision, 3);\n }\n }\n if (!quadTriangles || quadTriangles.length < circleCount * 2) {\n quadTriangles = createQuadTriangles(circleCount);\n }\n var indexBuffer = context.createIndexBuffer(quadTriangles, true);\n var vertexBuffer = context.createVertexBuffer(vertexData, performance2.collisionCircleLayout.members, true);\n for (var i$3 = 0, list$1 = tileBatches; i$3 < list$1.length; i$3 += 1) {\n var batch$1 = list$1[i$3];\n var uniforms = collisionCircleUniformValues(batch$1.transform, batch$1.invTransform, painter.transform);\n circleProgram.draw(context, gl2.TRIANGLES, DepthMode.disabled, StencilMode.disabled, painter.colorModeForRenderPass(), CullFaceMode.disabled, uniforms, layer.id, vertexBuffer, indexBuffer, performance2.SegmentVector.simpleSegment(0, batch$1.circleOffset * 2, batch$1.circleArray.length, batch$1.circleArray.length / 2), null, painter.transform.zoom, null, null, null);\n }\n vertexBuffer.destroy();\n indexBuffer.destroy();\n }\n function createQuadTriangles(quadCount) {\n var triCount = quadCount * 2;\n var array = new performance2.StructArrayLayout3ui6();\n array.resize(triCount);\n array._trim();\n for (var i = 0; i < triCount; i++) {\n var idx = i * 6;\n array.uint16[idx + 0] = i * 4 + 0;\n array.uint16[idx + 1] = i * 4 + 1;\n array.uint16[idx + 2] = i * 4 + 2;\n array.uint16[idx + 3] = i * 4 + 2;\n array.uint16[idx + 4] = i * 4 + 3;\n array.uint16[idx + 5] = i * 4 + 0;\n }\n return array;\n }\n var identityMat4 = performance2.identity(new Float32Array(16));\n function drawSymbols(painter, sourceCache, layer, coords, variableOffsets) {\n if (painter.renderPass !== \"translucent\") {\n return;\n }\n var stencilMode = StencilMode.disabled;\n var colorMode = painter.colorModeForRenderPass();\n var variablePlacement = layer.layout.get(\"text-variable-anchor\");\n if (variablePlacement) {\n updateVariableAnchors(coords, painter, layer, sourceCache, layer.layout.get(\"text-rotation-alignment\"), layer.layout.get(\"text-pitch-alignment\"), variableOffsets);\n }\n if (layer.paint.get(\"icon-opacity\").constantOr(1) !== 0) {\n drawLayerSymbols(painter, sourceCache, layer, coords, false, layer.paint.get(\"icon-translate\"), layer.paint.get(\"icon-translate-anchor\"), layer.layout.get(\"icon-rotation-alignment\"), layer.layout.get(\"icon-pitch-alignment\"), layer.layout.get(\"icon-keep-upright\"), stencilMode, colorMode);\n }\n if (layer.paint.get(\"text-opacity\").constantOr(1) !== 0) {\n drawLayerSymbols(painter, sourceCache, layer, coords, true, layer.paint.get(\"text-translate\"), layer.paint.get(\"text-translate-anchor\"), layer.layout.get(\"text-rotation-alignment\"), layer.layout.get(\"text-pitch-alignment\"), layer.layout.get(\"text-keep-upright\"), stencilMode, colorMode);\n }\n if (sourceCache.map.showCollisionBoxes) {\n drawCollisionDebug(painter, sourceCache, layer, coords, layer.paint.get(\"text-translate\"), layer.paint.get(\"text-translate-anchor\"), true);\n drawCollisionDebug(painter, sourceCache, layer, coords, layer.paint.get(\"icon-translate\"), layer.paint.get(\"icon-translate-anchor\"), false);\n }\n }\n function calculateVariableRenderShift(anchor, width, height, textOffset, textBoxScale, renderTextSize) {\n var ref = performance2.getAnchorAlignment(anchor);\n var horizontalAlign = ref.horizontalAlign;\n var verticalAlign = ref.verticalAlign;\n var shiftX = -(horizontalAlign - 0.5) * width;\n var shiftY = -(verticalAlign - 0.5) * height;\n var variableOffset = performance2.evaluateVariableOffset(anchor, textOffset);\n return new performance2.Point((shiftX / textBoxScale + variableOffset[0]) * renderTextSize, (shiftY / textBoxScale + variableOffset[1]) * renderTextSize);\n }\n function updateVariableAnchors(coords, painter, layer, sourceCache, rotationAlignment, pitchAlignment, variableOffsets) {\n var tr = painter.transform;\n var rotateWithMap = rotationAlignment === \"map\";\n var pitchWithMap = pitchAlignment === \"map\";\n for (var i = 0, list = coords; i < list.length; i += 1) {\n var coord = list[i];\n var tile = sourceCache.getTile(coord);\n var bucket = tile.getBucket(layer);\n if (!bucket || !bucket.text || !bucket.text.segments.get().length) {\n continue;\n }\n var sizeData = bucket.textSizeData;\n var size = performance2.evaluateSizeForZoom(sizeData, tr.zoom);\n var pixelToTileScale = pixelsToTileUnits(tile, 1, painter.transform.zoom);\n var labelPlaneMatrix = getLabelPlaneMatrix(coord.posMatrix, pitchWithMap, rotateWithMap, painter.transform, pixelToTileScale);\n var updateTextFitIcon = layer.layout.get(\"icon-text-fit\") !== \"none\" && bucket.hasIconData();\n if (size) {\n var tileScale = Math.pow(2, tr.zoom - tile.tileID.overscaledZ);\n updateVariableAnchorsForBucket(bucket, rotateWithMap, pitchWithMap, variableOffsets, performance2.symbolSize, tr, labelPlaneMatrix, coord.posMatrix, tileScale, size, updateTextFitIcon);\n }\n }\n }\n function updateVariableAnchorsForBucket(bucket, rotateWithMap, pitchWithMap, variableOffsets, symbolSize, transform, labelPlaneMatrix, posMatrix, tileScale, size, updateTextFitIcon) {\n var placedSymbols = bucket.text.placedSymbolArray;\n var dynamicTextLayoutVertexArray = bucket.text.dynamicLayoutVertexArray;\n var dynamicIconLayoutVertexArray = bucket.icon.dynamicLayoutVertexArray;\n var placedTextShifts = {};\n dynamicTextLayoutVertexArray.clear();\n for (var s = 0; s < placedSymbols.length; s++) {\n var symbol = placedSymbols.get(s);\n var skipOrientation = bucket.allowVerticalPlacement && !symbol.placedOrientation;\n var variableOffset = !symbol.hidden && symbol.crossTileID && !skipOrientation ? variableOffsets[symbol.crossTileID] : null;\n if (!variableOffset) {\n hideGlyphs(symbol.numGlyphs, dynamicTextLayoutVertexArray);\n } else {\n var tileAnchor = new performance2.Point(symbol.anchorX, symbol.anchorY);\n var projectedAnchor = project(tileAnchor, pitchWithMap ? posMatrix : labelPlaneMatrix);\n var perspectiveRatio = getPerspectiveRatio(transform.cameraToCenterDistance, projectedAnchor.signedDistanceFromCamera);\n var renderTextSize = symbolSize.evaluateSizeForFeature(bucket.textSizeData, size, symbol) * perspectiveRatio / performance2.ONE_EM;\n if (pitchWithMap) {\n renderTextSize *= bucket.tilePixelRatio / tileScale;\n }\n var width = variableOffset.width;\n var height = variableOffset.height;\n var anchor = variableOffset.anchor;\n var textOffset = variableOffset.textOffset;\n var textBoxScale = variableOffset.textBoxScale;\n var shift = calculateVariableRenderShift(anchor, width, height, textOffset, textBoxScale, renderTextSize);\n var shiftedAnchor = pitchWithMap ? project(tileAnchor.add(shift), labelPlaneMatrix).point : projectedAnchor.point.add(rotateWithMap ? shift.rotate(-transform.angle) : shift);\n var angle = bucket.allowVerticalPlacement && symbol.placedOrientation === performance2.WritingMode.vertical ? Math.PI / 2 : 0;\n for (var g = 0; g < symbol.numGlyphs; g++) {\n performance2.addDynamicAttributes(dynamicTextLayoutVertexArray, shiftedAnchor, angle);\n }\n if (updateTextFitIcon && symbol.associatedIconIndex >= 0) {\n placedTextShifts[symbol.associatedIconIndex] = {\n shiftedAnchor,\n angle\n };\n }\n }\n }\n if (updateTextFitIcon) {\n dynamicIconLayoutVertexArray.clear();\n var placedIcons = bucket.icon.placedSymbolArray;\n for (var i = 0; i < placedIcons.length; i++) {\n var placedIcon = placedIcons.get(i);\n if (placedIcon.hidden) {\n hideGlyphs(placedIcon.numGlyphs, dynamicIconLayoutVertexArray);\n } else {\n var shift$1 = placedTextShifts[i];\n if (!shift$1) {\n hideGlyphs(placedIcon.numGlyphs, dynamicIconLayoutVertexArray);\n } else {\n for (var g$1 = 0; g$1 < placedIcon.numGlyphs; g$1++) {\n performance2.addDynamicAttributes(dynamicIconLayoutVertexArray, shift$1.shiftedAnchor, shift$1.angle);\n }\n }\n }\n }\n bucket.icon.dynamicLayoutVertexBuffer.updateData(dynamicIconLayoutVertexArray);\n }\n bucket.text.dynamicLayoutVertexBuffer.updateData(dynamicTextLayoutVertexArray);\n }\n function getSymbolProgramName(isSDF, isText, bucket) {\n if (bucket.iconsInText && isText) {\n return \"symbolTextAndIcon\";\n } else if (isSDF) {\n return \"symbolSDF\";\n } else {\n return \"symbolIcon\";\n }\n }\n function drawLayerSymbols(painter, sourceCache, layer, coords, isText, translate, translateAnchor, rotationAlignment, pitchAlignment, keepUpright, stencilMode, colorMode) {\n var context = painter.context;\n var gl2 = context.gl;\n var tr = painter.transform;\n var rotateWithMap = rotationAlignment === \"map\";\n var pitchWithMap = pitchAlignment === \"map\";\n var alongLine = rotateWithMap && layer.layout.get(\"symbol-placement\") !== \"point\";\n var rotateInShader = rotateWithMap && !pitchWithMap && !alongLine;\n var hasSortKey = layer.layout.get(\"symbol-sort-key\").constantOr(1) !== void 0;\n var sortFeaturesByKey = false;\n var depthMode = painter.depthModeForSublayer(0, DepthMode.ReadOnly);\n var variablePlacement = layer.layout.get(\"text-variable-anchor\");\n var tileRenderState = [];\n for (var i$1 = 0, list$1 = coords; i$1 < list$1.length; i$1 += 1) {\n var coord = list$1[i$1];\n var tile = sourceCache.getTile(coord);\n var bucket = tile.getBucket(layer);\n if (!bucket) {\n continue;\n }\n var buffers = isText ? bucket.text : bucket.icon;\n if (!buffers || !buffers.segments.get().length) {\n continue;\n }\n var programConfiguration = buffers.programConfigurations.get(layer.id);\n var isSDF = isText || bucket.sdfIcons;\n var sizeData = isText ? bucket.textSizeData : bucket.iconSizeData;\n var transformed = pitchWithMap || tr.pitch !== 0;\n var program = painter.useProgram(getSymbolProgramName(isSDF, isText, bucket), programConfiguration);\n var size = performance2.evaluateSizeForZoom(sizeData, tr.zoom);\n var texSize = void 0;\n var texSizeIcon = [\n 0,\n 0\n ];\n var atlasTexture = void 0;\n var atlasInterpolation = void 0;\n var atlasTextureIcon = null;\n var atlasInterpolationIcon = void 0;\n if (isText) {\n atlasTexture = tile.glyphAtlasTexture;\n atlasInterpolation = gl2.LINEAR;\n texSize = tile.glyphAtlasTexture.size;\n if (bucket.iconsInText) {\n texSizeIcon = tile.imageAtlasTexture.size;\n atlasTextureIcon = tile.imageAtlasTexture;\n var zoomDependentSize = sizeData.kind === \"composite\" || sizeData.kind === \"camera\";\n atlasInterpolationIcon = transformed || painter.options.rotating || painter.options.zooming || zoomDependentSize ? gl2.LINEAR : gl2.NEAREST;\n }\n } else {\n var iconScaled = layer.layout.get(\"icon-size\").constantOr(0) !== 1 || bucket.iconsNeedLinear;\n atlasTexture = tile.imageAtlasTexture;\n atlasInterpolation = isSDF || painter.options.rotating || painter.options.zooming || iconScaled || transformed ? gl2.LINEAR : gl2.NEAREST;\n texSize = tile.imageAtlasTexture.size;\n }\n var s = pixelsToTileUnits(tile, 1, painter.transform.zoom);\n var labelPlaneMatrix = getLabelPlaneMatrix(coord.posMatrix, pitchWithMap, rotateWithMap, painter.transform, s);\n var glCoordMatrix = getGlCoordMatrix(coord.posMatrix, pitchWithMap, rotateWithMap, painter.transform, s);\n var hasVariableAnchors = variablePlacement && bucket.hasTextData();\n var updateTextFitIcon = layer.layout.get(\"icon-text-fit\") !== \"none\" && hasVariableAnchors && bucket.hasIconData();\n if (alongLine) {\n updateLineLabels(bucket, coord.posMatrix, painter, isText, labelPlaneMatrix, glCoordMatrix, pitchWithMap, keepUpright);\n }\n var matrix = painter.translatePosMatrix(coord.posMatrix, tile, translate, translateAnchor), uLabelPlaneMatrix = alongLine || isText && variablePlacement || updateTextFitIcon ? identityMat4 : labelPlaneMatrix, uglCoordMatrix = painter.translatePosMatrix(glCoordMatrix, tile, translate, translateAnchor, true);\n var hasHalo = isSDF && layer.paint.get(isText ? \"text-halo-width\" : \"icon-halo-width\").constantOr(1) !== 0;\n var uniformValues = void 0;\n if (isSDF) {\n if (!bucket.iconsInText) {\n uniformValues = symbolSDFUniformValues(sizeData.kind, size, rotateInShader, pitchWithMap, painter, matrix, uLabelPlaneMatrix, uglCoordMatrix, isText, texSize, true);\n } else {\n uniformValues = symbolTextAndIconUniformValues(sizeData.kind, size, rotateInShader, pitchWithMap, painter, matrix, uLabelPlaneMatrix, uglCoordMatrix, texSize, texSizeIcon);\n }\n } else {\n uniformValues = symbolIconUniformValues(sizeData.kind, size, rotateInShader, pitchWithMap, painter, matrix, uLabelPlaneMatrix, uglCoordMatrix, isText, texSize);\n }\n var state = {\n program,\n buffers,\n uniformValues,\n atlasTexture,\n atlasTextureIcon,\n atlasInterpolation,\n atlasInterpolationIcon,\n isSDF,\n hasHalo\n };\n if (hasSortKey && bucket.canOverlap) {\n sortFeaturesByKey = true;\n var oldSegments = buffers.segments.get();\n for (var i = 0, list = oldSegments; i < list.length; i += 1) {\n var segment = list[i];\n tileRenderState.push({\n segments: new performance2.SegmentVector([segment]),\n sortKey: segment.sortKey,\n state\n });\n }\n } else {\n tileRenderState.push({\n segments: buffers.segments,\n sortKey: 0,\n state\n });\n }\n }\n if (sortFeaturesByKey) {\n tileRenderState.sort(function(a, b) {\n return a.sortKey - b.sortKey;\n });\n }\n for (var i$2 = 0, list$2 = tileRenderState; i$2 < list$2.length; i$2 += 1) {\n var segmentState = list$2[i$2];\n var state$1 = segmentState.state;\n context.activeTexture.set(gl2.TEXTURE0);\n state$1.atlasTexture.bind(state$1.atlasInterpolation, gl2.CLAMP_TO_EDGE);\n if (state$1.atlasTextureIcon) {\n context.activeTexture.set(gl2.TEXTURE1);\n if (state$1.atlasTextureIcon) {\n state$1.atlasTextureIcon.bind(state$1.atlasInterpolationIcon, gl2.CLAMP_TO_EDGE);\n }\n }\n if (state$1.isSDF) {\n var uniformValues$1 = state$1.uniformValues;\n if (state$1.hasHalo) {\n uniformValues$1[\"u_is_halo\"] = 1;\n drawSymbolElements(state$1.buffers, segmentState.segments, layer, painter, state$1.program, depthMode, stencilMode, colorMode, uniformValues$1);\n }\n uniformValues$1[\"u_is_halo\"] = 0;\n }\n drawSymbolElements(state$1.buffers, segmentState.segments, layer, painter, state$1.program, depthMode, stencilMode, colorMode, state$1.uniformValues);\n }\n }\n function drawSymbolElements(buffers, segments, layer, painter, program, depthMode, stencilMode, colorMode, uniformValues) {\n var context = painter.context;\n var gl2 = context.gl;\n program.draw(context, gl2.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.disabled, uniformValues, layer.id, buffers.layoutVertexBuffer, buffers.indexBuffer, segments, layer.paint, painter.transform.zoom, buffers.programConfigurations.get(layer.id), buffers.dynamicLayoutVertexBuffer, buffers.opacityVertexBuffer);\n }\n function drawCircles(painter, sourceCache, layer, coords) {\n if (painter.renderPass !== \"translucent\") {\n return;\n }\n var opacity = layer.paint.get(\"circle-opacity\");\n var strokeWidth = layer.paint.get(\"circle-stroke-width\");\n var strokeOpacity = layer.paint.get(\"circle-stroke-opacity\");\n var sortFeaturesByKey = layer.layout.get(\"circle-sort-key\").constantOr(1) !== void 0;\n if (opacity.constantOr(1) === 0 && (strokeWidth.constantOr(1) === 0 || strokeOpacity.constantOr(1) === 0)) {\n return;\n }\n var context = painter.context;\n var gl2 = context.gl;\n var depthMode = painter.depthModeForSublayer(0, DepthMode.ReadOnly);\n var stencilMode = StencilMode.disabled;\n var colorMode = painter.colorModeForRenderPass();\n var segmentsRenderStates = [];\n for (var i = 0; i < coords.length; i++) {\n var coord = coords[i];\n var tile = sourceCache.getTile(coord);\n var bucket = tile.getBucket(layer);\n if (!bucket) {\n continue;\n }\n var programConfiguration = bucket.programConfigurations.get(layer.id);\n var program = painter.useProgram(\"circle\", programConfiguration);\n var layoutVertexBuffer = bucket.layoutVertexBuffer;\n var indexBuffer = bucket.indexBuffer;\n var uniformValues = circleUniformValues(painter, coord, tile, layer);\n var state = {\n programConfiguration,\n program,\n layoutVertexBuffer,\n indexBuffer,\n uniformValues\n };\n if (sortFeaturesByKey) {\n var oldSegments = bucket.segments.get();\n for (var i$1 = 0, list = oldSegments; i$1 < list.length; i$1 += 1) {\n var segment = list[i$1];\n segmentsRenderStates.push({\n segments: new performance2.SegmentVector([segment]),\n sortKey: segment.sortKey,\n state\n });\n }\n } else {\n segmentsRenderStates.push({\n segments: bucket.segments,\n sortKey: 0,\n state\n });\n }\n }\n if (sortFeaturesByKey) {\n segmentsRenderStates.sort(function(a, b) {\n return a.sortKey - b.sortKey;\n });\n }\n for (var i$2 = 0, list$1 = segmentsRenderStates; i$2 < list$1.length; i$2 += 1) {\n var segmentsState = list$1[i$2];\n var ref = segmentsState.state;\n var programConfiguration$1 = ref.programConfiguration;\n var program$1 = ref.program;\n var layoutVertexBuffer$1 = ref.layoutVertexBuffer;\n var indexBuffer$1 = ref.indexBuffer;\n var uniformValues$1 = ref.uniformValues;\n var segments = segmentsState.segments;\n program$1.draw(context, gl2.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.disabled, uniformValues$1, layer.id, layoutVertexBuffer$1, indexBuffer$1, segments, layer.paint, painter.transform.zoom, programConfiguration$1);\n }\n }\n function drawHeatmap(painter, sourceCache, layer, coords) {\n if (layer.paint.get(\"heatmap-opacity\") === 0) {\n return;\n }\n if (painter.renderPass === \"offscreen\") {\n var context = painter.context;\n var gl2 = context.gl;\n var stencilMode = StencilMode.disabled;\n var colorMode = new ColorMode([\n gl2.ONE,\n gl2.ONE\n ], performance2.Color.transparent, [\n true,\n true,\n true,\n true\n ]);\n bindFramebuffer(context, painter, layer);\n context.clear({ color: performance2.Color.transparent });\n for (var i = 0; i < coords.length; i++) {\n var coord = coords[i];\n if (sourceCache.hasRenderableParent(coord)) {\n continue;\n }\n var tile = sourceCache.getTile(coord);\n var bucket = tile.getBucket(layer);\n if (!bucket) {\n continue;\n }\n var programConfiguration = bucket.programConfigurations.get(layer.id);\n var program = painter.useProgram(\"heatmap\", programConfiguration);\n var ref = painter.transform;\n var zoom = ref.zoom;\n program.draw(context, gl2.TRIANGLES, DepthMode.disabled, stencilMode, colorMode, CullFaceMode.disabled, heatmapUniformValues(coord.posMatrix, tile, zoom, layer.paint.get(\"heatmap-intensity\")), layer.id, bucket.layoutVertexBuffer, bucket.indexBuffer, bucket.segments, layer.paint, painter.transform.zoom, programConfiguration);\n }\n context.viewport.set([\n 0,\n 0,\n painter.width,\n painter.height\n ]);\n } else if (painter.renderPass === \"translucent\") {\n painter.context.setColorMode(painter.colorModeForRenderPass());\n renderTextureToMap(painter, layer);\n }\n }\n function bindFramebuffer(context, painter, layer) {\n var gl2 = context.gl;\n context.activeTexture.set(gl2.TEXTURE1);\n context.viewport.set([\n 0,\n 0,\n painter.width / 4,\n painter.height / 4\n ]);\n var fbo = layer.heatmapFbo;\n if (!fbo) {\n var texture = gl2.createTexture();\n gl2.bindTexture(gl2.TEXTURE_2D, texture);\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_WRAP_S, gl2.CLAMP_TO_EDGE);\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_WRAP_T, gl2.CLAMP_TO_EDGE);\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_MIN_FILTER, gl2.LINEAR);\n gl2.texParameteri(gl2.TEXTURE_2D, gl2.TEXTURE_MAG_FILTER, gl2.LINEAR);\n fbo = layer.heatmapFbo = context.createFramebuffer(painter.width / 4, painter.height / 4, false);\n bindTextureToFramebuffer(context, painter, texture, fbo);\n } else {\n gl2.bindTexture(gl2.TEXTURE_2D, fbo.colorAttachment.get());\n context.bindFramebuffer.set(fbo.framebuffer);\n }\n }\n function bindTextureToFramebuffer(context, painter, texture, fbo) {\n var gl2 = context.gl;\n var internalFormat = context.extRenderToTextureHalfFloat ? context.extTextureHalfFloat.HALF_FLOAT_OES : gl2.UNSIGNED_BYTE;\n gl2.texImage2D(gl2.TEXTURE_2D, 0, gl2.RGBA, painter.width / 4, painter.height / 4, 0, gl2.RGBA, internalFormat, null);\n fbo.colorAttachment.set(texture);\n }\n function renderTextureToMap(painter, layer) {\n var context = painter.context;\n var gl2 = context.gl;\n var fbo = layer.heatmapFbo;\n if (!fbo) {\n return;\n }\n context.activeTexture.set(gl2.TEXTURE0);\n gl2.bindTexture(gl2.TEXTURE_2D, fbo.colorAttachment.get());\n context.activeTexture.set(gl2.TEXTURE1);\n var colorRampTexture = layer.colorRampTexture;\n if (!colorRampTexture) {\n colorRampTexture = layer.colorRampTexture = new performance2.Texture(context, layer.colorRamp, gl2.RGBA);\n }\n colorRampTexture.bind(gl2.LINEAR, gl2.CLAMP_TO_EDGE);\n painter.useProgram(\"heatmapTexture\").draw(context, gl2.TRIANGLES, DepthMode.disabled, StencilMode.disabled, painter.colorModeForRenderPass(), CullFaceMode.disabled, heatmapTextureUniformValues(painter, layer, 0, 1), layer.id, painter.viewportBuffer, painter.quadTriangleIndexBuffer, painter.viewportSegments, layer.paint, painter.transform.zoom);\n }\n function drawLine(painter, sourceCache, layer, coords) {\n if (painter.renderPass !== \"translucent\") {\n return;\n }\n var opacity = layer.paint.get(\"line-opacity\");\n var width = layer.paint.get(\"line-width\");\n if (opacity.constantOr(1) === 0 || width.constantOr(1) === 0) {\n return;\n }\n var depthMode = painter.depthModeForSublayer(0, DepthMode.ReadOnly);\n var colorMode = painter.colorModeForRenderPass();\n var dasharray = layer.paint.get(\"line-dasharray\");\n var patternProperty = layer.paint.get(\"line-pattern\");\n var image = patternProperty.constantOr(1);\n var gradient = layer.paint.get(\"line-gradient\");\n var crossfade = layer.getCrossfadeParameters();\n var programId = image ? \"linePattern\" : dasharray ? \"lineSDF\" : gradient ? \"lineGradient\" : \"line\";\n var context = painter.context;\n var gl2 = context.gl;\n var firstTile = true;\n for (var i = 0, list = coords; i < list.length; i += 1) {\n var coord = list[i];\n var tile = sourceCache.getTile(coord);\n if (image && !tile.patternsLoaded()) {\n continue;\n }\n var bucket = tile.getBucket(layer);\n if (!bucket) {\n continue;\n }\n var programConfiguration = bucket.programConfigurations.get(layer.id);\n var prevProgram = painter.context.program.get();\n var program = painter.useProgram(programId, programConfiguration);\n var programChanged = firstTile || program.program !== prevProgram;\n var constantPattern = patternProperty.constantOr(null);\n if (constantPattern && tile.imageAtlas) {\n var atlas = tile.imageAtlas;\n var posTo = atlas.patternPositions[constantPattern.to.toString()];\n var posFrom = atlas.patternPositions[constantPattern.from.toString()];\n if (posTo && posFrom) {\n programConfiguration.setConstantPatternPositions(posTo, posFrom);\n }\n }\n var uniformValues = image ? linePatternUniformValues(painter, tile, layer, crossfade) : dasharray ? lineSDFUniformValues(painter, tile, layer, dasharray, crossfade) : gradient ? lineGradientUniformValues(painter, tile, layer, bucket.lineClipsArray.length) : lineUniformValues(painter, tile, layer);\n if (image) {\n context.activeTexture.set(gl2.TEXTURE0);\n tile.imageAtlasTexture.bind(gl2.LINEAR, gl2.CLAMP_TO_EDGE);\n programConfiguration.updatePaintBuffers(crossfade);\n } else if (dasharray && (programChanged || painter.lineAtlas.dirty)) {\n context.activeTexture.set(gl2.TEXTURE0);\n painter.lineAtlas.bind(context);\n } else if (gradient) {\n var layerGradient = bucket.gradients[layer.id];\n var gradientTexture = layerGradient.texture;\n if (layer.gradientVersion !== layerGradient.version) {\n var textureResolution = 256;\n if (layer.stepInterpolant) {\n var sourceMaxZoom = sourceCache.getSource().maxzoom;\n var potentialOverzoom = coord.canonical.z === sourceMaxZoom ? Math.ceil(1 << painter.transform.maxZoom - coord.canonical.z) : 1;\n var lineLength = bucket.maxLineLength / performance2.EXTENT;\n var maxTilePixelSize = 1024;\n var maxTextureCoverage = lineLength * maxTilePixelSize * potentialOverzoom;\n textureResolution = performance2.clamp(performance2.nextPowerOfTwo(maxTextureCoverage), 256, context.maxTextureSize);\n }\n layerGradient.gradient = performance2.renderColorRamp({\n expression: layer.gradientExpression(),\n evaluationKey: \"lineProgress\",\n resolution: textureResolution,\n image: layerGradient.gradient || void 0,\n clips: bucket.lineClipsArray\n });\n if (layerGradient.texture) {\n layerGradient.texture.update(layerGradient.gradient);\n } else {\n layerGradient.texture = new performance2.Texture(context, layerGradient.gradient, gl2.RGBA);\n }\n layerGradient.version = layer.gradientVersion;\n gradientTexture = layerGradient.texture;\n }\n context.activeTexture.set(gl2.TEXTURE0);\n gradientTexture.bind(layer.stepInterpolant ? gl2.NEAREST : gl2.LINEAR, gl2.CLAMP_TO_EDGE);\n }\n program.draw(context, gl2.TRIANGLES, depthMode, painter.stencilModeForClipping(coord), colorMode, CullFaceMode.disabled, uniformValues, layer.id, bucket.layoutVertexBuffer, bucket.indexBuffer, bucket.segments, layer.paint, painter.transform.zoom, programConfiguration, bucket.layoutVertexBuffer2);\n firstTile = false;\n }\n }\n function drawFill(painter, sourceCache, layer, coords) {\n var color2 = layer.paint.get(\"fill-color\");\n var opacity = layer.paint.get(\"fill-opacity\");\n if (opacity.constantOr(1) === 0) {\n return;\n }\n var colorMode = painter.colorModeForRenderPass();\n var pattern = layer.paint.get(\"fill-pattern\");\n var pass = painter.opaquePassEnabledForLayer() && (!pattern.constantOr(1) && color2.constantOr(performance2.Color.transparent).a === 1 && opacity.constantOr(0) === 1) ? \"opaque\" : \"translucent\";\n if (painter.renderPass === pass) {\n var depthMode = painter.depthModeForSublayer(1, painter.renderPass === \"opaque\" ? DepthMode.ReadWrite : DepthMode.ReadOnly);\n drawFillTiles(painter, sourceCache, layer, coords, depthMode, colorMode, false);\n }\n if (painter.renderPass === \"translucent\" && layer.paint.get(\"fill-antialias\")) {\n var depthMode$1 = painter.depthModeForSublayer(layer.getPaintProperty(\"fill-outline-color\") ? 2 : 0, DepthMode.ReadOnly);\n drawFillTiles(painter, sourceCache, layer, coords, depthMode$1, colorMode, true);\n }\n }\n function drawFillTiles(painter, sourceCache, layer, coords, depthMode, colorMode, isOutline) {\n var gl2 = painter.context.gl;\n var patternProperty = layer.paint.get(\"fill-pattern\");\n var image = patternProperty && patternProperty.constantOr(1);\n var crossfade = layer.getCrossfadeParameters();\n var drawMode, programName, uniformValues, indexBuffer, segments;\n if (!isOutline) {\n programName = image ? \"fillPattern\" : \"fill\";\n drawMode = gl2.TRIANGLES;\n } else {\n programName = image && !layer.getPaintProperty(\"fill-outline-color\") ? \"fillOutlinePattern\" : \"fillOutline\";\n drawMode = gl2.LINES;\n }\n for (var i = 0, list = coords; i < list.length; i += 1) {\n var coord = list[i];\n var tile = sourceCache.getTile(coord);\n if (image && !tile.patternsLoaded()) {\n continue;\n }\n var bucket = tile.getBucket(layer);\n if (!bucket) {\n continue;\n }\n var programConfiguration = bucket.programConfigurations.get(layer.id);\n var program = painter.useProgram(programName, programConfiguration);\n if (image) {\n painter.context.activeTexture.set(gl2.TEXTURE0);\n tile.imageAtlasTexture.bind(gl2.LINEAR, gl2.CLAMP_TO_EDGE);\n programConfiguration.updatePaintBuffers(crossfade);\n }\n var constantPattern = patternProperty.constantOr(null);\n if (constantPattern && tile.imageAtlas) {\n var atlas = tile.imageAtlas;\n var posTo = atlas.patternPositions[constantPattern.to.toString()];\n var posFrom = atlas.patternPositions[constantPattern.from.toString()];\n if (posTo && posFrom) {\n programConfiguration.setConstantPatternPositions(posTo, posFrom);\n }\n }\n var tileMatrix = painter.translatePosMatrix(coord.posMatrix, tile, layer.paint.get(\"fill-translate\"), layer.paint.get(\"fill-translate-anchor\"));\n if (!isOutline) {\n indexBuffer = bucket.indexBuffer;\n segments = bucket.segments;\n uniformValues = image ? fillPatternUniformValues(tileMatrix, painter, crossfade, tile) : fillUniformValues(tileMatrix);\n } else {\n indexBuffer = bucket.indexBuffer2;\n segments = bucket.segments2;\n var drawingBufferSize = [\n gl2.drawingBufferWidth,\n gl2.drawingBufferHeight\n ];\n uniformValues = programName === \"fillOutlinePattern\" && image ? fillOutlinePatternUniformValues(tileMatrix, painter, crossfade, tile, drawingBufferSize) : fillOutlineUniformValues(tileMatrix, drawingBufferSize);\n }\n program.draw(painter.context, drawMode, depthMode, painter.stencilModeForClipping(coord), colorMode, CullFaceMode.disabled, uniformValues, layer.id, bucket.layoutVertexBuffer, indexBuffer, segments, layer.paint, painter.transform.zoom, programConfiguration);\n }\n }\n function draw(painter, source, layer, coords) {\n var opacity = layer.paint.get(\"fill-extrusion-opacity\");\n if (opacity === 0) {\n return;\n }\n if (painter.renderPass === \"translucent\") {\n var depthMode = new DepthMode(painter.context.gl.LEQUAL, DepthMode.ReadWrite, painter.depthRangeFor3D);\n if (opacity === 1 && !layer.paint.get(\"fill-extrusion-pattern\").constantOr(1)) {\n var colorMode = painter.colorModeForRenderPass();\n drawExtrusionTiles(painter, source, layer, coords, depthMode, StencilMode.disabled, colorMode);\n } else {\n drawExtrusionTiles(painter, source, layer, coords, depthMode, StencilMode.disabled, ColorMode.disabled);\n drawExtrusionTiles(painter, source, layer, coords, depthMode, painter.stencilModeFor3D(), painter.colorModeForRenderPass());\n }\n }\n }\n function drawExtrusionTiles(painter, source, layer, coords, depthMode, stencilMode, colorMode) {\n var context = painter.context;\n var gl2 = context.gl;\n var patternProperty = layer.paint.get(\"fill-extrusion-pattern\");\n var image = patternProperty.constantOr(1);\n var crossfade = layer.getCrossfadeParameters();\n var opacity = layer.paint.get(\"fill-extrusion-opacity\");\n for (var i = 0, list = coords; i < list.length; i += 1) {\n var coord = list[i];\n var tile = source.getTile(coord);\n var bucket = tile.getBucket(layer);\n if (!bucket) {\n continue;\n }\n var programConfiguration = bucket.programConfigurations.get(layer.id);\n var program = painter.useProgram(image ? \"fillExtrusionPattern\" : \"fillExtrusion\", programConfiguration);\n if (image) {\n painter.context.activeTexture.set(gl2.TEXTURE0);\n tile.imageAtlasTexture.bind(gl2.LINEAR, gl2.CLAMP_TO_EDGE);\n programConfiguration.updatePaintBuffers(crossfade);\n }\n var constantPattern = patternProperty.constantOr(null);\n if (constantPattern && tile.imageAtlas) {\n var atlas = tile.imageAtlas;\n var posTo = atlas.patternPositions[constantPattern.to.toString()];\n var posFrom = atlas.patternPositions[constantPattern.from.toString()];\n if (posTo && posFrom) {\n programConfiguration.setConstantPatternPositions(posTo, posFrom);\n }\n }\n var matrix = painter.translatePosMatrix(coord.posMatrix, tile, layer.paint.get(\"fill-extrusion-translate\"), layer.paint.get(\"fill-extrusion-translate-anchor\"));\n var shouldUseVerticalGradient = layer.paint.get(\"fill-extrusion-vertical-gradient\");\n var uniformValues = image ? fillExtrusionPatternUniformValues(matrix, painter, shouldUseVerticalGradient, opacity, coord, crossfade, tile) : fillExtrusionUniformValues(matrix, painter, shouldUseVerticalGradient, opacity);\n program.draw(context, context.gl.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.backCCW, uniformValues, layer.id, bucket.layoutVertexBuffer, bucket.indexBuffer, bucket.segments, layer.paint, painter.transform.zoom, programConfiguration);\n }\n }\n function drawHillshade(painter, sourceCache, layer, tileIDs) {\n if (painter.renderPass !== \"offscreen\" && painter.renderPass !== \"translucent\") {\n return;\n }\n var context = painter.context;\n var depthMode = painter.depthModeForSublayer(0, DepthMode.ReadOnly);\n var colorMode = painter.colorModeForRenderPass();\n var ref = painter.renderPass === \"translucent\" ? painter.stencilConfigForOverlap(tileIDs) : [\n {},\n tileIDs\n ];\n var stencilModes = ref[0];\n var coords = ref[1];\n for (var i = 0, list = coords; i < list.length; i += 1) {\n var coord = list[i];\n var tile = sourceCache.getTile(coord);\n if (tile.needsHillshadePrepare && painter.renderPass === \"offscreen\") {\n prepareHillshade(painter, tile, layer, depthMode, StencilMode.disabled, colorMode);\n } else if (painter.renderPass === \"translucent\") {\n renderHillshade(painter, tile, layer, depthMode, stencilModes[coord.overscaledZ], colorMode);\n }\n }\n context.viewport.set([\n 0,\n 0,\n painter.width,\n painter.height\n ]);\n }\n function renderHillshade(painter, tile, layer, depthMode, stencilMode, colorMode) {\n var context = painter.context;\n var gl2 = context.gl;\n var fbo = tile.fbo;\n if (!fbo) {\n return;\n }\n var program = painter.useProgram(\"hillshade\");\n context.activeTexture.set(gl2.TEXTURE0);\n gl2.bindTexture(gl2.TEXTURE_2D, fbo.colorAttachment.get());\n var uniformValues = hillshadeUniformValues(painter, tile, layer);\n program.draw(context, gl2.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.disabled, uniformValues, layer.id, painter.rasterBoundsBuffer, painter.quadTriangleIndexBuffer, painter.rasterBoundsSegments);\n }\n function prepareHillshade(painter, tile, layer, depthMode, stencilMode, colorMode) {\n var context = painter.context;\n var gl2 = context.gl;\n var dem = tile.dem;\n if (dem && dem.data) {\n var tileSize = dem.dim;\n var textureStride = dem.stride;\n var pixelData = dem.getPixels();\n context.activeTexture.set(gl2.TEXTURE1);\n context.pixelStoreUnpackPremultiplyAlpha.set(false);\n tile.demTexture = tile.demTexture || painter.getTileTexture(textureStride);\n if (tile.demTexture) {\n var demTexture = tile.demTexture;\n demTexture.update(pixelData, { premultiply: false });\n demTexture.bind(gl2.NEAREST, gl2.CLAMP_TO_EDGE);\n } else {\n tile.demTexture = new performance2.Texture(context, pixelData, gl2.RGBA, { premultiply: false });\n tile.demTexture.bind(gl2.NEAREST, gl2.CLAMP_TO_EDGE);\n }\n context.activeTexture.set(gl2.TEXTURE0);\n var fbo = tile.fbo;\n if (!fbo) {\n var renderTexture = new performance2.Texture(context, {\n width: tileSize,\n height: tileSize,\n data: null\n }, gl2.RGBA);\n renderTexture.bind(gl2.LINEAR, gl2.CLAMP_TO_EDGE);\n fbo = tile.fbo = context.createFramebuffer(tileSize, tileSize, true);\n fbo.colorAttachment.set(renderTexture.texture);\n }\n context.bindFramebuffer.set(fbo.framebuffer);\n context.viewport.set([\n 0,\n 0,\n tileSize,\n tileSize\n ]);\n painter.useProgram(\"hillshadePrepare\").draw(context, gl2.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.disabled, hillshadeUniformPrepareValues(tile.tileID, dem), layer.id, painter.rasterBoundsBuffer, painter.quadTriangleIndexBuffer, painter.rasterBoundsSegments);\n tile.needsHillshadePrepare = false;\n }\n }\n function drawRaster(painter, sourceCache, layer, tileIDs) {\n if (painter.renderPass !== \"translucent\") {\n return;\n }\n if (layer.paint.get(\"raster-opacity\") === 0) {\n return;\n }\n if (!tileIDs.length) {\n return;\n }\n var context = painter.context;\n var gl2 = context.gl;\n var source = sourceCache.getSource();\n var program = painter.useProgram(\"raster\");\n var colorMode = painter.colorModeForRenderPass();\n var ref = source instanceof ImageSource ? [\n {},\n tileIDs\n ] : painter.stencilConfigForOverlap(tileIDs);\n var stencilModes = ref[0];\n var coords = ref[1];\n var minTileZ = coords[coords.length - 1].overscaledZ;\n var align = !painter.options.moving;\n for (var i = 0, list = coords; i < list.length; i += 1) {\n var coord = list[i];\n var depthMode = painter.depthModeForSublayer(coord.overscaledZ - minTileZ, layer.paint.get(\"raster-opacity\") === 1 ? DepthMode.ReadWrite : DepthMode.ReadOnly, gl2.LESS);\n var tile = sourceCache.getTile(coord);\n var posMatrix = painter.transform.calculatePosMatrix(coord.toUnwrapped(), align);\n tile.registerFadeDuration(layer.paint.get(\"raster-fade-duration\"));\n var parentTile = sourceCache.findLoadedParent(coord, 0), fade = getFadeValues(tile, parentTile, sourceCache, layer, painter.transform);\n var parentScaleBy = void 0, parentTL = void 0;\n var textureFilter = layer.paint.get(\"raster-resampling\") === \"nearest\" ? gl2.NEAREST : gl2.LINEAR;\n context.activeTexture.set(gl2.TEXTURE0);\n tile.texture.bind(textureFilter, gl2.CLAMP_TO_EDGE, gl2.LINEAR_MIPMAP_NEAREST);\n context.activeTexture.set(gl2.TEXTURE1);\n if (parentTile) {\n parentTile.texture.bind(textureFilter, gl2.CLAMP_TO_EDGE, gl2.LINEAR_MIPMAP_NEAREST);\n parentScaleBy = Math.pow(2, parentTile.tileID.overscaledZ - tile.tileID.overscaledZ);\n parentTL = [\n tile.tileID.canonical.x * parentScaleBy % 1,\n tile.tileID.canonical.y * parentScaleBy % 1\n ];\n } else {\n tile.texture.bind(textureFilter, gl2.CLAMP_TO_EDGE, gl2.LINEAR_MIPMAP_NEAREST);\n }\n var uniformValues = rasterUniformValues(posMatrix, parentTL || [\n 0,\n 0\n ], parentScaleBy || 1, fade, layer);\n if (source instanceof ImageSource) {\n program.draw(context, gl2.TRIANGLES, depthMode, StencilMode.disabled, colorMode, CullFaceMode.disabled, uniformValues, layer.id, source.boundsBuffer, painter.quadTriangleIndexBuffer, source.boundsSegments);\n } else {\n program.draw(context, gl2.TRIANGLES, depthMode, stencilModes[coord.overscaledZ], colorMode, CullFaceMode.disabled, uniformValues, layer.id, painter.rasterBoundsBuffer, painter.quadTriangleIndexBuffer, painter.rasterBoundsSegments);\n }\n }\n }\n function getFadeValues(tile, parentTile, sourceCache, layer, transform) {\n var fadeDuration = layer.paint.get(\"raster-fade-duration\");\n if (fadeDuration > 0) {\n var now = performance2.browser.now();\n var sinceTile = (now - tile.timeAdded) / fadeDuration;\n var sinceParent = parentTile ? (now - parentTile.timeAdded) / fadeDuration : -1;\n var source = sourceCache.getSource();\n var idealZ = transform.coveringZoomLevel({\n tileSize: source.tileSize,\n roundZoom: source.roundZoom\n });\n var fadeIn = !parentTile || Math.abs(parentTile.tileID.overscaledZ - idealZ) > Math.abs(tile.tileID.overscaledZ - idealZ);\n var childOpacity = fadeIn && tile.refreshedUponExpiration ? 1 : performance2.clamp(fadeIn ? sinceTile : 1 - sinceParent, 0, 1);\n if (tile.refreshedUponExpiration && sinceTile >= 1) {\n tile.refreshedUponExpiration = false;\n }\n if (parentTile) {\n return {\n opacity: 1,\n mix: 1 - childOpacity\n };\n } else {\n return {\n opacity: childOpacity,\n mix: 0\n };\n }\n } else {\n return {\n opacity: 1,\n mix: 0\n };\n }\n }\n function drawBackground(painter, sourceCache, layer) {\n var color2 = layer.paint.get(\"background-color\");\n var opacity = layer.paint.get(\"background-opacity\");\n if (opacity === 0) {\n return;\n }\n var context = painter.context;\n var gl2 = context.gl;\n var transform = painter.transform;\n var tileSize = transform.tileSize;\n var image = layer.paint.get(\"background-pattern\");\n if (painter.isPatternMissing(image)) {\n return;\n }\n var pass = !image && color2.a === 1 && opacity === 1 && painter.opaquePassEnabledForLayer() ? \"opaque\" : \"translucent\";\n if (painter.renderPass !== pass) {\n return;\n }\n var stencilMode = StencilMode.disabled;\n var depthMode = painter.depthModeForSublayer(0, pass === \"opaque\" ? DepthMode.ReadWrite : DepthMode.ReadOnly);\n var colorMode = painter.colorModeForRenderPass();\n var program = painter.useProgram(image ? \"backgroundPattern\" : \"background\");\n var tileIDs = transform.coveringTiles({ tileSize });\n if (image) {\n context.activeTexture.set(gl2.TEXTURE0);\n painter.imageManager.bind(painter.context);\n }\n var crossfade = layer.getCrossfadeParameters();\n for (var i = 0, list = tileIDs; i < list.length; i += 1) {\n var tileID = list[i];\n var matrix = painter.transform.calculatePosMatrix(tileID.toUnwrapped());\n var uniformValues = image ? backgroundPatternUniformValues(matrix, opacity, painter, image, {\n tileID,\n tileSize\n }, crossfade) : backgroundUniformValues(matrix, opacity, color2);\n program.draw(context, gl2.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.disabled, uniformValues, layer.id, painter.tileExtentBuffer, painter.quadTriangleIndexBuffer, painter.tileExtentSegments);\n }\n }\n var topColor = new performance2.Color(1, 0, 0, 1);\n var btmColor = new performance2.Color(0, 1, 0, 1);\n var leftColor = new performance2.Color(0, 0, 1, 1);\n var rightColor = new performance2.Color(1, 0, 1, 1);\n var centerColor = new performance2.Color(0, 1, 1, 1);\n function drawDebugPadding(painter) {\n var padding2 = painter.transform.padding;\n var lineWidth = 3;\n drawHorizontalLine(painter, painter.transform.height - (padding2.top || 0), lineWidth, topColor);\n drawHorizontalLine(painter, padding2.bottom || 0, lineWidth, btmColor);\n drawVerticalLine(painter, padding2.left || 0, lineWidth, leftColor);\n drawVerticalLine(painter, painter.transform.width - (padding2.right || 0), lineWidth, rightColor);\n var center = painter.transform.centerPoint;\n drawCrosshair(painter, center.x, painter.transform.height - center.y, centerColor);\n }\n function drawCrosshair(painter, x, y, color2) {\n var size = 20;\n var lineWidth = 2;\n drawDebugSSRect(painter, x - lineWidth / 2, y - size / 2, lineWidth, size, color2);\n drawDebugSSRect(painter, x - size / 2, y - lineWidth / 2, size, lineWidth, color2);\n }\n function drawHorizontalLine(painter, y, lineWidth, color2) {\n drawDebugSSRect(painter, 0, y + lineWidth / 2, painter.transform.width, lineWidth, color2);\n }\n function drawVerticalLine(painter, x, lineWidth, color2) {\n drawDebugSSRect(painter, x - lineWidth / 2, 0, lineWidth, painter.transform.height, color2);\n }\n function drawDebugSSRect(painter, x, y, width, height, color2) {\n var context = painter.context;\n var gl2 = context.gl;\n gl2.enable(gl2.SCISSOR_TEST);\n gl2.scissor(x * performance2.browser.devicePixelRatio, y * performance2.browser.devicePixelRatio, width * performance2.browser.devicePixelRatio, height * performance2.browser.devicePixelRatio);\n context.clear({ color: color2 });\n gl2.disable(gl2.SCISSOR_TEST);\n }\n function drawDebug(painter, sourceCache, coords) {\n for (var i = 0; i < coords.length; i++) {\n drawDebugTile(painter, sourceCache, coords[i]);\n }\n }\n function drawDebugTile(painter, sourceCache, coord) {\n var context = painter.context;\n var gl2 = context.gl;\n var posMatrix = coord.posMatrix;\n var program = painter.useProgram(\"debug\");\n var depthMode = DepthMode.disabled;\n var stencilMode = StencilMode.disabled;\n var colorMode = painter.colorModeForRenderPass();\n var id = \"$debug\";\n context.activeTexture.set(gl2.TEXTURE0);\n painter.emptyTexture.bind(gl2.LINEAR, gl2.CLAMP_TO_EDGE);\n program.draw(context, gl2.LINE_STRIP, depthMode, stencilMode, colorMode, CullFaceMode.disabled, debugUniformValues(posMatrix, performance2.Color.red), id, painter.debugBuffer, painter.tileBorderIndexBuffer, painter.debugSegments);\n var tileRawData = sourceCache.getTileByID(coord.key).latestRawTileData;\n var tileByteLength = tileRawData && tileRawData.byteLength || 0;\n var tileSizeKb = Math.floor(tileByteLength / 1024);\n var tileSize = sourceCache.getTile(coord).tileSize;\n var scaleRatio = 512 / Math.min(tileSize, 512) * (coord.overscaledZ / painter.transform.zoom) * 0.5;\n var tileIdText = coord.canonical.toString();\n if (coord.overscaledZ !== coord.canonical.z) {\n tileIdText += \" => \" + coord.overscaledZ;\n }\n var tileLabel = tileIdText + \" \" + tileSizeKb + \"kb\";\n drawTextToOverlay(painter, tileLabel);\n program.draw(context, gl2.TRIANGLES, depthMode, stencilMode, ColorMode.alphaBlended, CullFaceMode.disabled, debugUniformValues(posMatrix, performance2.Color.transparent, scaleRatio), id, painter.debugBuffer, painter.quadTriangleIndexBuffer, painter.debugSegments);\n }\n function drawTextToOverlay(painter, text) {\n painter.initDebugOverlayCanvas();\n var canvas = painter.debugOverlayCanvas;\n var gl2 = painter.context.gl;\n var ctx2d = painter.debugOverlayCanvas.getContext(\"2d\");\n ctx2d.clearRect(0, 0, canvas.width, canvas.height);\n ctx2d.shadowColor = \"white\";\n ctx2d.shadowBlur = 2;\n ctx2d.lineWidth = 1.5;\n ctx2d.strokeStyle = \"white\";\n ctx2d.textBaseline = \"top\";\n ctx2d.font = \"bold 36px Open Sans, sans-serif\";\n ctx2d.fillText(text, 5, 5);\n ctx2d.strokeText(text, 5, 5);\n painter.debugOverlayTexture.update(canvas);\n painter.debugOverlayTexture.bind(gl2.LINEAR, gl2.CLAMP_TO_EDGE);\n }\n function drawCustom(painter, sourceCache, layer) {\n var context = painter.context;\n var implementation = layer.implementation;\n if (painter.renderPass === \"offscreen\") {\n var prerender = implementation.prerender;\n if (prerender) {\n painter.setCustomLayerDefaults();\n context.setColorMode(painter.colorModeForRenderPass());\n prerender.call(implementation, context.gl, painter.transform.customLayerMatrix());\n context.setDirty();\n painter.setBaseState();\n }\n } else if (painter.renderPass === \"translucent\") {\n painter.setCustomLayerDefaults();\n context.setColorMode(painter.colorModeForRenderPass());\n context.setStencilMode(StencilMode.disabled);\n var depthMode = implementation.renderingMode === \"3d\" ? new DepthMode(painter.context.gl.LEQUAL, DepthMode.ReadWrite, painter.depthRangeFor3D) : painter.depthModeForSublayer(0, DepthMode.ReadOnly);\n context.setDepthMode(depthMode);\n implementation.render(context.gl, painter.transform.customLayerMatrix());\n context.setDirty();\n painter.setBaseState();\n context.bindFramebuffer.set(null);\n }\n }\n var draw$1 = {\n symbol: drawSymbols,\n circle: drawCircles,\n heatmap: drawHeatmap,\n line: drawLine,\n fill: drawFill,\n \"fill-extrusion\": draw,\n hillshade: drawHillshade,\n raster: drawRaster,\n background: drawBackground,\n debug: drawDebug,\n custom: drawCustom\n };\n var Painter = function Painter2(gl2, transform) {\n this.context = new Context(gl2);\n this.transform = transform;\n this._tileTextures = {};\n this.setup();\n this.numSublayers = SourceCache.maxUnderzooming + SourceCache.maxOverzooming + 1;\n this.depthEpsilon = 1 / Math.pow(2, 16);\n this.crossTileSymbolIndex = new CrossTileSymbolIndex();\n this.gpuTimers = {};\n };\n Painter.prototype.resize = function resize(width, height) {\n this.width = width * performance2.browser.devicePixelRatio;\n this.height = height * performance2.browser.devicePixelRatio;\n this.context.viewport.set([\n 0,\n 0,\n this.width,\n this.height\n ]);\n if (this.style) {\n for (var i = 0, list = this.style._order; i < list.length; i += 1) {\n var layerId = list[i];\n this.style._layers[layerId].resize();\n }\n }\n };\n Painter.prototype.setup = function setup() {\n var context = this.context;\n var tileExtentArray = new performance2.StructArrayLayout2i4();\n tileExtentArray.emplaceBack(0, 0);\n tileExtentArray.emplaceBack(performance2.EXTENT, 0);\n tileExtentArray.emplaceBack(0, performance2.EXTENT);\n tileExtentArray.emplaceBack(performance2.EXTENT, performance2.EXTENT);\n this.tileExtentBuffer = context.createVertexBuffer(tileExtentArray, posAttributes.members);\n this.tileExtentSegments = performance2.SegmentVector.simpleSegment(0, 0, 4, 2);\n var debugArray = new performance2.StructArrayLayout2i4();\n debugArray.emplaceBack(0, 0);\n debugArray.emplaceBack(performance2.EXTENT, 0);\n debugArray.emplaceBack(0, performance2.EXTENT);\n debugArray.emplaceBack(performance2.EXTENT, performance2.EXTENT);\n this.debugBuffer = context.createVertexBuffer(debugArray, posAttributes.members);\n this.debugSegments = performance2.SegmentVector.simpleSegment(0, 0, 4, 5);\n var rasterBoundsArray = new performance2.StructArrayLayout4i8();\n rasterBoundsArray.emplaceBack(0, 0, 0, 0);\n rasterBoundsArray.emplaceBack(performance2.EXTENT, 0, performance2.EXTENT, 0);\n rasterBoundsArray.emplaceBack(0, performance2.EXTENT, 0, performance2.EXTENT);\n rasterBoundsArray.emplaceBack(performance2.EXTENT, performance2.EXTENT, performance2.EXTENT, performance2.EXTENT);\n this.rasterBoundsBuffer = context.createVertexBuffer(rasterBoundsArray, rasterBoundsAttributes.members);\n this.rasterBoundsSegments = performance2.SegmentVector.simpleSegment(0, 0, 4, 2);\n var viewportArray = new performance2.StructArrayLayout2i4();\n viewportArray.emplaceBack(0, 0);\n viewportArray.emplaceBack(1, 0);\n viewportArray.emplaceBack(0, 1);\n viewportArray.emplaceBack(1, 1);\n this.viewportBuffer = context.createVertexBuffer(viewportArray, posAttributes.members);\n this.viewportSegments = performance2.SegmentVector.simpleSegment(0, 0, 4, 2);\n var tileLineStripIndices = new performance2.StructArrayLayout1ui2();\n tileLineStripIndices.emplaceBack(0);\n tileLineStripIndices.emplaceBack(1);\n tileLineStripIndices.emplaceBack(3);\n tileLineStripIndices.emplaceBack(2);\n tileLineStripIndices.emplaceBack(0);\n this.tileBorderIndexBuffer = context.createIndexBuffer(tileLineStripIndices);\n var quadTriangleIndices = new performance2.StructArrayLayout3ui6();\n quadTriangleIndices.emplaceBack(0, 1, 2);\n quadTriangleIndices.emplaceBack(2, 1, 3);\n this.quadTriangleIndexBuffer = context.createIndexBuffer(quadTriangleIndices);\n this.emptyTexture = new performance2.Texture(context, {\n width: 1,\n height: 1,\n data: new Uint8Array([\n 0,\n 0,\n 0,\n 0\n ])\n }, context.gl.RGBA);\n var gl2 = this.context.gl;\n this.stencilClearMode = new StencilMode({\n func: gl2.ALWAYS,\n mask: 0\n }, 0, 255, gl2.ZERO, gl2.ZERO, gl2.ZERO);\n };\n Painter.prototype.clearStencil = function clearStencil() {\n var context = this.context;\n var gl2 = context.gl;\n this.nextStencilID = 1;\n this.currentStencilSource = void 0;\n var matrix = performance2.create();\n performance2.ortho(matrix, 0, this.width, this.height, 0, 0, 1);\n performance2.scale(matrix, matrix, [\n gl2.drawingBufferWidth,\n gl2.drawingBufferHeight,\n 0\n ]);\n this.useProgram(\"clippingMask\").draw(context, gl2.TRIANGLES, DepthMode.disabled, this.stencilClearMode, ColorMode.disabled, CullFaceMode.disabled, clippingMaskUniformValues(matrix), \"$clipping\", this.viewportBuffer, this.quadTriangleIndexBuffer, this.viewportSegments);\n };\n Painter.prototype._renderTileClippingMasks = function _renderTileClippingMasks(layer, tileIDs) {\n if (this.currentStencilSource === layer.source || !layer.isTileClipped() || !tileIDs || !tileIDs.length) {\n return;\n }\n this.currentStencilSource = layer.source;\n var context = this.context;\n var gl2 = context.gl;\n if (this.nextStencilID + tileIDs.length > 256) {\n this.clearStencil();\n }\n context.setColorMode(ColorMode.disabled);\n context.setDepthMode(DepthMode.disabled);\n var program = this.useProgram(\"clippingMask\");\n this._tileClippingMaskIDs = {};\n for (var i = 0, list = tileIDs; i < list.length; i += 1) {\n var tileID = list[i];\n var id = this._tileClippingMaskIDs[tileID.key] = this.nextStencilID++;\n program.draw(context, gl2.TRIANGLES, DepthMode.disabled, new StencilMode({\n func: gl2.ALWAYS,\n mask: 0\n }, id, 255, gl2.KEEP, gl2.KEEP, gl2.REPLACE), ColorMode.disabled, CullFaceMode.disabled, clippingMaskUniformValues(tileID.posMatrix), \"$clipping\", this.tileExtentBuffer, this.quadTriangleIndexBuffer, this.tileExtentSegments);\n }\n };\n Painter.prototype.stencilModeFor3D = function stencilModeFor3D() {\n this.currentStencilSource = void 0;\n if (this.nextStencilID + 1 > 256) {\n this.clearStencil();\n }\n var id = this.nextStencilID++;\n var gl2 = this.context.gl;\n return new StencilMode({\n func: gl2.NOTEQUAL,\n mask: 255\n }, id, 255, gl2.KEEP, gl2.KEEP, gl2.REPLACE);\n };\n Painter.prototype.stencilModeForClipping = function stencilModeForClipping(tileID) {\n var gl2 = this.context.gl;\n return new StencilMode({\n func: gl2.EQUAL,\n mask: 255\n }, this._tileClippingMaskIDs[tileID.key], 0, gl2.KEEP, gl2.KEEP, gl2.REPLACE);\n };\n Painter.prototype.stencilConfigForOverlap = function stencilConfigForOverlap(tileIDs) {\n var obj;\n var gl2 = this.context.gl;\n var coords = tileIDs.sort(function(a, b) {\n return b.overscaledZ - a.overscaledZ;\n });\n var minTileZ = coords[coords.length - 1].overscaledZ;\n var stencilValues = coords[0].overscaledZ - minTileZ + 1;\n if (stencilValues > 1) {\n this.currentStencilSource = void 0;\n if (this.nextStencilID + stencilValues > 256) {\n this.clearStencil();\n }\n var zToStencilMode = {};\n for (var i = 0; i < stencilValues; i++) {\n zToStencilMode[i + minTileZ] = new StencilMode({\n func: gl2.GEQUAL,\n mask: 255\n }, i + this.nextStencilID, 255, gl2.KEEP, gl2.KEEP, gl2.REPLACE);\n }\n this.nextStencilID += stencilValues;\n return [\n zToStencilMode,\n coords\n ];\n }\n return [\n (obj = {}, obj[minTileZ] = StencilMode.disabled, obj),\n coords\n ];\n };\n Painter.prototype.colorModeForRenderPass = function colorModeForRenderPass() {\n var gl2 = this.context.gl;\n if (this._showOverdrawInspector) {\n var numOverdrawSteps = 8;\n var a = 1 / numOverdrawSteps;\n return new ColorMode([\n gl2.CONSTANT_COLOR,\n gl2.ONE\n ], new performance2.Color(a, a, a, 0), [\n true,\n true,\n true,\n true\n ]);\n } else if (this.renderPass === \"opaque\") {\n return ColorMode.unblended;\n } else {\n return ColorMode.alphaBlended;\n }\n };\n Painter.prototype.depthModeForSublayer = function depthModeForSublayer(n, mask, func) {\n if (!this.opaquePassEnabledForLayer()) {\n return DepthMode.disabled;\n }\n var depth = 1 - ((1 + this.currentLayer) * this.numSublayers + n) * this.depthEpsilon;\n return new DepthMode(func || this.context.gl.LEQUAL, mask, [\n depth,\n depth\n ]);\n };\n Painter.prototype.opaquePassEnabledForLayer = function opaquePassEnabledForLayer() {\n return this.currentLayer < this.opaquePassCutoff;\n };\n Painter.prototype.render = function render(style, options) {\n var this$1 = this;\n this.style = style;\n this.options = options;\n this.lineAtlas = style.lineAtlas;\n this.imageManager = style.imageManager;\n this.glyphManager = style.glyphManager;\n this.symbolFadeChange = style.placement.symbolFadeChange(performance2.browser.now());\n this.imageManager.beginFrame();\n var layerIds = this.style._order;\n var sourceCaches = this.style.sourceCaches;\n for (var id in sourceCaches) {\n var sourceCache = sourceCaches[id];\n if (sourceCache.used) {\n sourceCache.prepare(this.context);\n }\n }\n var coordsAscending = {};\n var coordsDescending = {};\n var coordsDescendingSymbol = {};\n for (var id$1 in sourceCaches) {\n var sourceCache$1 = sourceCaches[id$1];\n coordsAscending[id$1] = sourceCache$1.getVisibleCoordinates();\n coordsDescending[id$1] = coordsAscending[id$1].slice().reverse();\n coordsDescendingSymbol[id$1] = sourceCache$1.getVisibleCoordinates(true).reverse();\n }\n this.opaquePassCutoff = Infinity;\n for (var i = 0; i < layerIds.length; i++) {\n var layerId = layerIds[i];\n if (this.style._layers[layerId].is3D()) {\n this.opaquePassCutoff = i;\n break;\n }\n }\n this.renderPass = \"offscreen\";\n for (var i$1 = 0, list = layerIds; i$1 < list.length; i$1 += 1) {\n var layerId$1 = list[i$1];\n var layer = this.style._layers[layerId$1];\n if (!layer.hasOffscreenPass() || layer.isHidden(this.transform.zoom)) {\n continue;\n }\n var coords = coordsDescending[layer.source];\n if (layer.type !== \"custom\" && !coords.length) {\n continue;\n }\n this.renderLayer(this, sourceCaches[layer.source], layer, coords);\n }\n this.context.bindFramebuffer.set(null);\n this.context.clear({\n color: options.showOverdrawInspector ? performance2.Color.black : performance2.Color.transparent,\n depth: 1\n });\n this.clearStencil();\n this._showOverdrawInspector = options.showOverdrawInspector;\n this.depthRangeFor3D = [\n 0,\n 1 - (style._order.length + 2) * this.numSublayers * this.depthEpsilon\n ];\n this.renderPass = \"opaque\";\n for (this.currentLayer = layerIds.length - 1; this.currentLayer >= 0; this.currentLayer--) {\n var layer$1 = this.style._layers[layerIds[this.currentLayer]];\n var sourceCache$2 = sourceCaches[layer$1.source];\n var coords$1 = coordsAscending[layer$1.source];\n this._renderTileClippingMasks(layer$1, coords$1);\n this.renderLayer(this, sourceCache$2, layer$1, coords$1);\n }\n this.renderPass = \"translucent\";\n for (this.currentLayer = 0; this.currentLayer < layerIds.length; this.currentLayer++) {\n var layer$2 = this.style._layers[layerIds[this.currentLayer]];\n var sourceCache$3 = sourceCaches[layer$2.source];\n var coords$2 = (layer$2.type === \"symbol\" ? coordsDescendingSymbol : coordsDescending)[layer$2.source];\n this._renderTileClippingMasks(layer$2, coordsAscending[layer$2.source]);\n this.renderLayer(this, sourceCache$3, layer$2, coords$2);\n }\n if (this.options.showTileBoundaries) {\n var selectedSource;\n var sourceCache$4;\n var layers = performance2.values(this.style._layers);\n layers.forEach(function(layer2) {\n if (layer2.source && !layer2.isHidden(this$1.transform.zoom)) {\n if (layer2.source !== (sourceCache$4 && sourceCache$4.id)) {\n sourceCache$4 = this$1.style.sourceCaches[layer2.source];\n }\n if (!selectedSource || selectedSource.getSource().maxzoom < sourceCache$4.getSource().maxzoom) {\n selectedSource = sourceCache$4;\n }\n }\n });\n if (selectedSource) {\n draw$1.debug(this, selectedSource, selectedSource.getVisibleCoordinates());\n }\n }\n if (this.options.showPadding) {\n drawDebugPadding(this);\n }\n this.context.setDefault();\n };\n Painter.prototype.renderLayer = function renderLayer(painter, sourceCache, layer, coords) {\n if (layer.isHidden(this.transform.zoom)) {\n return;\n }\n if (layer.type !== \"background\" && layer.type !== \"custom\" && !coords.length) {\n return;\n }\n this.id = layer.id;\n this.gpuTimingStart(layer);\n draw$1[layer.type](painter, sourceCache, layer, coords, this.style.placement.variableOffsets);\n this.gpuTimingEnd();\n };\n Painter.prototype.gpuTimingStart = function gpuTimingStart(layer) {\n if (!this.options.gpuTiming) {\n return;\n }\n var ext = this.context.extTimerQuery;\n var layerTimer = this.gpuTimers[layer.id];\n if (!layerTimer) {\n layerTimer = this.gpuTimers[layer.id] = {\n calls: 0,\n cpuTime: 0,\n query: ext.createQueryEXT()\n };\n }\n layerTimer.calls++;\n ext.beginQueryEXT(ext.TIME_ELAPSED_EXT, layerTimer.query);\n };\n Painter.prototype.gpuTimingEnd = function gpuTimingEnd() {\n if (!this.options.gpuTiming) {\n return;\n }\n var ext = this.context.extTimerQuery;\n ext.endQueryEXT(ext.TIME_ELAPSED_EXT);\n };\n Painter.prototype.collectGpuTimers = function collectGpuTimers() {\n var currentLayerTimers = this.gpuTimers;\n this.gpuTimers = {};\n return currentLayerTimers;\n };\n Painter.prototype.queryGpuTimers = function queryGpuTimers(gpuTimers) {\n var layers = {};\n for (var layerId in gpuTimers) {\n var gpuTimer = gpuTimers[layerId];\n var ext = this.context.extTimerQuery;\n var gpuTime = ext.getQueryObjectEXT(gpuTimer.query, ext.QUERY_RESULT_EXT) / (1e3 * 1e3);\n ext.deleteQueryEXT(gpuTimer.query);\n layers[layerId] = gpuTime;\n }\n return layers;\n };\n Painter.prototype.translatePosMatrix = function translatePosMatrix(matrix, tile, translate, translateAnchor, inViewportPixelUnitsUnits) {\n if (!translate[0] && !translate[1]) {\n return matrix;\n }\n var angle = inViewportPixelUnitsUnits ? translateAnchor === \"map\" ? this.transform.angle : 0 : translateAnchor === \"viewport\" ? -this.transform.angle : 0;\n if (angle) {\n var sinA = Math.sin(angle);\n var cosA = Math.cos(angle);\n translate = [\n translate[0] * cosA - translate[1] * sinA,\n translate[0] * sinA + translate[1] * cosA\n ];\n }\n var translation = [\n inViewportPixelUnitsUnits ? translate[0] : pixelsToTileUnits(tile, translate[0], this.transform.zoom),\n inViewportPixelUnitsUnits ? translate[1] : pixelsToTileUnits(tile, translate[1], this.transform.zoom),\n 0\n ];\n var translatedMatrix = new Float32Array(16);\n performance2.translate(translatedMatrix, matrix, translation);\n return translatedMatrix;\n };\n Painter.prototype.saveTileTexture = function saveTileTexture(texture) {\n var textures = this._tileTextures[texture.size[0]];\n if (!textures) {\n this._tileTextures[texture.size[0]] = [texture];\n } else {\n textures.push(texture);\n }\n };\n Painter.prototype.getTileTexture = function getTileTexture(size) {\n var textures = this._tileTextures[size];\n return textures && textures.length > 0 ? textures.pop() : null;\n };\n Painter.prototype.isPatternMissing = function isPatternMissing(image) {\n if (!image) {\n return false;\n }\n if (!image.from || !image.to) {\n return true;\n }\n var imagePosA = this.imageManager.getPattern(image.from.toString());\n var imagePosB = this.imageManager.getPattern(image.to.toString());\n return !imagePosA || !imagePosB;\n };\n Painter.prototype.useProgram = function useProgram(name2, programConfiguration) {\n this.cache = this.cache || {};\n var key = \"\" + name2 + (programConfiguration ? programConfiguration.cacheKey : \"\") + (this._showOverdrawInspector ? \"/overdraw\" : \"\");\n if (!this.cache[key]) {\n this.cache[key] = new Program$1(this.context, name2, shaders[name2], programConfiguration, programUniforms[name2], this._showOverdrawInspector);\n }\n return this.cache[key];\n };\n Painter.prototype.setCustomLayerDefaults = function setCustomLayerDefaults() {\n this.context.unbindVAO();\n this.context.cullFace.setDefault();\n this.context.activeTexture.setDefault();\n this.context.pixelStoreUnpack.setDefault();\n this.context.pixelStoreUnpackPremultiplyAlpha.setDefault();\n this.context.pixelStoreUnpackFlipY.setDefault();\n };\n Painter.prototype.setBaseState = function setBaseState() {\n var gl2 = this.context.gl;\n this.context.cullFace.set(false);\n this.context.viewport.set([\n 0,\n 0,\n this.width,\n this.height\n ]);\n this.context.blendEquation.set(gl2.FUNC_ADD);\n };\n Painter.prototype.initDebugOverlayCanvas = function initDebugOverlayCanvas() {\n if (this.debugOverlayCanvas == null) {\n this.debugOverlayCanvas = performance2.window.document.createElement(\"canvas\");\n this.debugOverlayCanvas.width = 512;\n this.debugOverlayCanvas.height = 512;\n var gl2 = this.context.gl;\n this.debugOverlayTexture = new performance2.Texture(this.context, this.debugOverlayCanvas, gl2.RGBA);\n }\n };\n Painter.prototype.destroy = function destroy() {\n this.emptyTexture.destroy();\n if (this.debugOverlayTexture) {\n this.debugOverlayTexture.destroy();\n }\n };\n var Frustum = function Frustum2(points_, planes_) {\n this.points = points_;\n this.planes = planes_;\n };\n Frustum.fromInvProjectionMatrix = function fromInvProjectionMatrix(invProj, worldSize, zoom) {\n var clipSpaceCorners = [\n [\n -1,\n 1,\n -1,\n 1\n ],\n [\n 1,\n 1,\n -1,\n 1\n ],\n [\n 1,\n -1,\n -1,\n 1\n ],\n [\n -1,\n -1,\n -1,\n 1\n ],\n [\n -1,\n 1,\n 1,\n 1\n ],\n [\n 1,\n 1,\n 1,\n 1\n ],\n [\n 1,\n -1,\n 1,\n 1\n ],\n [\n -1,\n -1,\n 1,\n 1\n ]\n ];\n var scale = Math.pow(2, zoom);\n var frustumCoords = clipSpaceCorners.map(function(v) {\n return performance2.transformMat4([], v, invProj);\n }).map(function(v) {\n return performance2.scale$1([], v, 1 / v[3] / worldSize * scale);\n });\n var frustumPlanePointIndices = [\n [\n 0,\n 1,\n 2\n ],\n [\n 6,\n 5,\n 4\n ],\n [\n 0,\n 3,\n 7\n ],\n [\n 2,\n 1,\n 5\n ],\n [\n 3,\n 2,\n 6\n ],\n [\n 0,\n 4,\n 5\n ]\n ];\n var frustumPlanes = frustumPlanePointIndices.map(function(p) {\n var a = performance2.sub([], frustumCoords[p[0]], frustumCoords[p[1]]);\n var b = performance2.sub([], frustumCoords[p[2]], frustumCoords[p[1]]);\n var n = performance2.normalize([], performance2.cross([], a, b));\n var d = -performance2.dot(n, frustumCoords[p[1]]);\n return n.concat(d);\n });\n return new Frustum(frustumCoords, frustumPlanes);\n };\n var Aabb = function Aabb2(min_, max_) {\n this.min = min_;\n this.max = max_;\n this.center = performance2.scale$2([], performance2.add([], this.min, this.max), 0.5);\n };\n Aabb.prototype.quadrant = function quadrant(index) {\n var split = [\n index % 2 === 0,\n index < 2\n ];\n var qMin = performance2.clone$2(this.min);\n var qMax = performance2.clone$2(this.max);\n for (var axis = 0; axis < split.length; axis++) {\n qMin[axis] = split[axis] ? this.min[axis] : this.center[axis];\n qMax[axis] = split[axis] ? this.center[axis] : this.max[axis];\n }\n qMax[2] = this.max[2];\n return new Aabb(qMin, qMax);\n };\n Aabb.prototype.distanceX = function distanceX(point) {\n var pointOnAabb = Math.max(Math.min(this.max[0], point[0]), this.min[0]);\n return pointOnAabb - point[0];\n };\n Aabb.prototype.distanceY = function distanceY(point) {\n var pointOnAabb = Math.max(Math.min(this.max[1], point[1]), this.min[1]);\n return pointOnAabb - point[1];\n };\n Aabb.prototype.intersects = function intersects(frustum) {\n var aabbPoints = [\n [\n this.min[0],\n this.min[1],\n 0,\n 1\n ],\n [\n this.max[0],\n this.min[1],\n 0,\n 1\n ],\n [\n this.max[0],\n this.max[1],\n 0,\n 1\n ],\n [\n this.min[0],\n this.max[1],\n 0,\n 1\n ]\n ];\n var fullyInside = true;\n for (var p = 0; p < frustum.planes.length; p++) {\n var plane = frustum.planes[p];\n var pointsInside = 0;\n for (var i = 0; i < aabbPoints.length; i++) {\n pointsInside += performance2.dot$1(plane, aabbPoints[i]) >= 0;\n }\n if (pointsInside === 0) {\n return 0;\n }\n if (pointsInside !== aabbPoints.length) {\n fullyInside = false;\n }\n }\n if (fullyInside) {\n return 2;\n }\n for (var axis = 0; axis < 3; axis++) {\n var projMin = Number.MAX_VALUE;\n var projMax = -Number.MAX_VALUE;\n for (var p$1 = 0; p$1 < frustum.points.length; p$1++) {\n var projectedPoint = frustum.points[p$1][axis] - this.min[axis];\n projMin = Math.min(projMin, projectedPoint);\n projMax = Math.max(projMax, projectedPoint);\n }\n if (projMax < 0 || projMin > this.max[axis] - this.min[axis]) {\n return 0;\n }\n }\n return 1;\n };\n var EdgeInsets = function EdgeInsets2(top, bottom, left, right) {\n if (top === void 0)\n top = 0;\n if (bottom === void 0)\n bottom = 0;\n if (left === void 0)\n left = 0;\n if (right === void 0)\n right = 0;\n if (isNaN(top) || top < 0 || isNaN(bottom) || bottom < 0 || isNaN(left) || left < 0 || isNaN(right) || right < 0) {\n throw new Error(\"Invalid value for edge-insets, top, bottom, left and right must all be numbers\");\n }\n this.top = top;\n this.bottom = bottom;\n this.left = left;\n this.right = right;\n };\n EdgeInsets.prototype.interpolate = function interpolate(start, target, t) {\n if (target.top != null && start.top != null) {\n this.top = performance2.number(start.top, target.top, t);\n }\n if (target.bottom != null && start.bottom != null) {\n this.bottom = performance2.number(start.bottom, target.bottom, t);\n }\n if (target.left != null && start.left != null) {\n this.left = performance2.number(start.left, target.left, t);\n }\n if (target.right != null && start.right != null) {\n this.right = performance2.number(start.right, target.right, t);\n }\n return this;\n };\n EdgeInsets.prototype.getCenter = function getCenter(width, height) {\n var x = performance2.clamp((this.left + width - this.right) / 2, 0, width);\n var y = performance2.clamp((this.top + height - this.bottom) / 2, 0, height);\n return new performance2.Point(x, y);\n };\n EdgeInsets.prototype.equals = function equals(other) {\n return this.top === other.top && this.bottom === other.bottom && this.left === other.left && this.right === other.right;\n };\n EdgeInsets.prototype.clone = function clone() {\n return new EdgeInsets(this.top, this.bottom, this.left, this.right);\n };\n EdgeInsets.prototype.toJSON = function toJSON() {\n return {\n top: this.top,\n bottom: this.bottom,\n left: this.left,\n right: this.right\n };\n };\n var Transform = function Transform2(minZoom, maxZoom, minPitch, maxPitch, renderWorldCopies) {\n this.tileSize = 512;\n this.maxValidLatitude = 85.051129;\n this._renderWorldCopies = renderWorldCopies === void 0 ? true : renderWorldCopies;\n this._minZoom = minZoom || 0;\n this._maxZoom = maxZoom || 22;\n this._minPitch = minPitch === void 0 || minPitch === null ? 0 : minPitch;\n this._maxPitch = maxPitch === void 0 || maxPitch === null ? 60 : maxPitch;\n this.setMaxBounds();\n this.width = 0;\n this.height = 0;\n this._center = new performance2.LngLat(0, 0);\n this.zoom = 0;\n this.angle = 0;\n this._fov = 0.6435011087932844;\n this._pitch = 0;\n this._unmodified = true;\n this._edgeInsets = new EdgeInsets();\n this._posMatrixCache = {};\n this._alignedPosMatrixCache = {};\n };\n var prototypeAccessors = {\n minZoom: { configurable: true },\n maxZoom: { configurable: true },\n minPitch: { configurable: true },\n maxPitch: { configurable: true },\n renderWorldCopies: { configurable: true },\n worldSize: { configurable: true },\n centerOffset: { configurable: true },\n size: { configurable: true },\n bearing: { configurable: true },\n pitch: { configurable: true },\n fov: { configurable: true },\n zoom: { configurable: true },\n center: { configurable: true },\n padding: { configurable: true },\n centerPoint: { configurable: true },\n unmodified: { configurable: true },\n point: { configurable: true }\n };\n Transform.prototype.clone = function clone() {\n var clone2 = new Transform(this._minZoom, this._maxZoom, this._minPitch, this.maxPitch, this._renderWorldCopies);\n clone2.tileSize = this.tileSize;\n clone2.latRange = this.latRange;\n clone2.width = this.width;\n clone2.height = this.height;\n clone2._center = this._center;\n clone2.zoom = this.zoom;\n clone2.angle = this.angle;\n clone2._fov = this._fov;\n clone2._pitch = this._pitch;\n clone2._unmodified = this._unmodified;\n clone2._edgeInsets = this._edgeInsets.clone();\n clone2._calcMatrices();\n return clone2;\n };\n prototypeAccessors.minZoom.get = function() {\n return this._minZoom;\n };\n prototypeAccessors.minZoom.set = function(zoom) {\n if (this._minZoom === zoom) {\n return;\n }\n this._minZoom = zoom;\n this.zoom = Math.max(this.zoom, zoom);\n };\n prototypeAccessors.maxZoom.get = function() {\n return this._maxZoom;\n };\n prototypeAccessors.maxZoom.set = function(zoom) {\n if (this._maxZoom === zoom) {\n return;\n }\n this._maxZoom = zoom;\n this.zoom = Math.min(this.zoom, zoom);\n };\n prototypeAccessors.minPitch.get = function() {\n return this._minPitch;\n };\n prototypeAccessors.minPitch.set = function(pitch) {\n if (this._minPitch === pitch) {\n return;\n }\n this._minPitch = pitch;\n this.pitch = Math.max(this.pitch, pitch);\n };\n prototypeAccessors.maxPitch.get = function() {\n return this._maxPitch;\n };\n prototypeAccessors.maxPitch.set = function(pitch) {\n if (this._maxPitch === pitch) {\n return;\n }\n this._maxPitch = pitch;\n this.pitch = Math.min(this.pitch, pitch);\n };\n prototypeAccessors.renderWorldCopies.get = function() {\n return this._renderWorldCopies;\n };\n prototypeAccessors.renderWorldCopies.set = function(renderWorldCopies) {\n if (renderWorldCopies === void 0) {\n renderWorldCopies = true;\n } else if (renderWorldCopies === null) {\n renderWorldCopies = false;\n }\n this._renderWorldCopies = renderWorldCopies;\n };\n prototypeAccessors.worldSize.get = function() {\n return this.tileSize * this.scale;\n };\n prototypeAccessors.centerOffset.get = function() {\n return this.centerPoint._sub(this.size._div(2));\n };\n prototypeAccessors.size.get = function() {\n return new performance2.Point(this.width, this.height);\n };\n prototypeAccessors.bearing.get = function() {\n return -this.angle / Math.PI * 180;\n };\n prototypeAccessors.bearing.set = function(bearing) {\n var b = -performance2.wrap(bearing, -180, 180) * Math.PI / 180;\n if (this.angle === b) {\n return;\n }\n this._unmodified = false;\n this.angle = b;\n this._calcMatrices();\n this.rotationMatrix = performance2.create$2();\n performance2.rotate(this.rotationMatrix, this.rotationMatrix, this.angle);\n };\n prototypeAccessors.pitch.get = function() {\n return this._pitch / Math.PI * 180;\n };\n prototypeAccessors.pitch.set = function(pitch) {\n var p = performance2.clamp(pitch, this.minPitch, this.maxPitch) / 180 * Math.PI;\n if (this._pitch === p) {\n return;\n }\n this._unmodified = false;\n this._pitch = p;\n this._calcMatrices();\n };\n prototypeAccessors.fov.get = function() {\n return this._fov / Math.PI * 180;\n };\n prototypeAccessors.fov.set = function(fov) {\n fov = Math.max(0.01, Math.min(60, fov));\n if (this._fov === fov) {\n return;\n }\n this._unmodified = false;\n this._fov = fov / 180 * Math.PI;\n this._calcMatrices();\n };\n prototypeAccessors.zoom.get = function() {\n return this._zoom;\n };\n prototypeAccessors.zoom.set = function(zoom) {\n var z = Math.min(Math.max(zoom, this.minZoom), this.maxZoom);\n if (this._zoom === z) {\n return;\n }\n this._unmodified = false;\n this._zoom = z;\n this.scale = this.zoomScale(z);\n this.tileZoom = Math.floor(z);\n this.zoomFraction = z - this.tileZoom;\n this._constrain();\n this._calcMatrices();\n };\n prototypeAccessors.center.get = function() {\n return this._center;\n };\n prototypeAccessors.center.set = function(center) {\n if (center.lat === this._center.lat && center.lng === this._center.lng) {\n return;\n }\n this._unmodified = false;\n this._center = center;\n this._constrain();\n this._calcMatrices();\n };\n prototypeAccessors.padding.get = function() {\n return this._edgeInsets.toJSON();\n };\n prototypeAccessors.padding.set = function(padding2) {\n if (this._edgeInsets.equals(padding2)) {\n return;\n }\n this._unmodified = false;\n this._edgeInsets.interpolate(this._edgeInsets, padding2, 1);\n this._calcMatrices();\n };\n prototypeAccessors.centerPoint.get = function() {\n return this._edgeInsets.getCenter(this.width, this.height);\n };\n Transform.prototype.isPaddingEqual = function isPaddingEqual(padding2) {\n return this._edgeInsets.equals(padding2);\n };\n Transform.prototype.interpolatePadding = function interpolatePadding(start, target, t) {\n this._unmodified = false;\n this._edgeInsets.interpolate(start, target, t);\n this._constrain();\n this._calcMatrices();\n };\n Transform.prototype.coveringZoomLevel = function coveringZoomLevel(options) {\n var z = (options.roundZoom ? Math.round : Math.floor)(this.zoom + this.scaleZoom(this.tileSize / options.tileSize));\n return Math.max(0, z);\n };\n Transform.prototype.getVisibleUnwrappedCoordinates = function getVisibleUnwrappedCoordinates(tileID) {\n var result = [new performance2.UnwrappedTileID(0, tileID)];\n if (this._renderWorldCopies) {\n var utl = this.pointCoordinate(new performance2.Point(0, 0));\n var utr = this.pointCoordinate(new performance2.Point(this.width, 0));\n var ubl = this.pointCoordinate(new performance2.Point(this.width, this.height));\n var ubr = this.pointCoordinate(new performance2.Point(0, this.height));\n var w0 = Math.floor(Math.min(utl.x, utr.x, ubl.x, ubr.x));\n var w1 = Math.floor(Math.max(utl.x, utr.x, ubl.x, ubr.x));\n var extraWorldCopy = 1;\n for (var w = w0 - extraWorldCopy; w <= w1 + extraWorldCopy; w++) {\n if (w === 0) {\n continue;\n }\n result.push(new performance2.UnwrappedTileID(w, tileID));\n }\n }\n return result;\n };\n Transform.prototype.coveringTiles = function coveringTiles(options) {\n var z = this.coveringZoomLevel(options);\n var actualZ = z;\n if (options.minzoom !== void 0 && z < options.minzoom) {\n return [];\n }\n if (options.maxzoom !== void 0 && z > options.maxzoom) {\n z = options.maxzoom;\n }\n var centerCoord = performance2.MercatorCoordinate.fromLngLat(this.center);\n var numTiles = Math.pow(2, z);\n var centerPoint = [\n numTiles * centerCoord.x,\n numTiles * centerCoord.y,\n 0\n ];\n var cameraFrustum = Frustum.fromInvProjectionMatrix(this.invProjMatrix, this.worldSize, z);\n var minZoom = options.minzoom || 0;\n if (this.pitch <= 60 && this._edgeInsets.top < 0.1) {\n minZoom = z;\n }\n var radiusOfMaxLvlLodInTiles = 3;\n var newRootTile = function(wrap) {\n return {\n aabb: new Aabb([\n wrap * numTiles,\n 0,\n 0\n ], [\n (wrap + 1) * numTiles,\n numTiles,\n 0\n ]),\n zoom: 0,\n x: 0,\n y: 0,\n wrap,\n fullyVisible: false\n };\n };\n var stack = [];\n var result = [];\n var maxZoom = z;\n var overscaledZ = options.reparseOverscaled ? actualZ : z;\n if (this._renderWorldCopies) {\n for (var i = 1; i <= 3; i++) {\n stack.push(newRootTile(-i));\n stack.push(newRootTile(i));\n }\n }\n stack.push(newRootTile(0));\n while (stack.length > 0) {\n var it = stack.pop();\n var x = it.x;\n var y = it.y;\n var fullyVisible = it.fullyVisible;\n if (!fullyVisible) {\n var intersectResult = it.aabb.intersects(cameraFrustum);\n if (intersectResult === 0) {\n continue;\n }\n fullyVisible = intersectResult === 2;\n }\n var distanceX = it.aabb.distanceX(centerPoint);\n var distanceY = it.aabb.distanceY(centerPoint);\n var longestDim = Math.max(Math.abs(distanceX), Math.abs(distanceY));\n var distToSplit = radiusOfMaxLvlLodInTiles + (1 << maxZoom - it.zoom) - 2;\n if (it.zoom === maxZoom || longestDim > distToSplit && it.zoom >= minZoom) {\n result.push({\n tileID: new performance2.OverscaledTileID(it.zoom === maxZoom ? overscaledZ : it.zoom, it.wrap, it.zoom, x, y),\n distanceSq: performance2.sqrLen([\n centerPoint[0] - 0.5 - x,\n centerPoint[1] - 0.5 - y\n ])\n });\n continue;\n }\n for (var i$1 = 0; i$1 < 4; i$1++) {\n var childX = (x << 1) + i$1 % 2;\n var childY = (y << 1) + (i$1 >> 1);\n stack.push({\n aabb: it.aabb.quadrant(i$1),\n zoom: it.zoom + 1,\n x: childX,\n y: childY,\n wrap: it.wrap,\n fullyVisible\n });\n }\n }\n return result.sort(function(a, b) {\n return a.distanceSq - b.distanceSq;\n }).map(function(a) {\n return a.tileID;\n });\n };\n Transform.prototype.resize = function resize(width, height) {\n this.width = width;\n this.height = height;\n this.pixelsToGLUnits = [\n 2 / width,\n -2 / height\n ];\n this._constrain();\n this._calcMatrices();\n };\n prototypeAccessors.unmodified.get = function() {\n return this._unmodified;\n };\n Transform.prototype.zoomScale = function zoomScale(zoom) {\n return Math.pow(2, zoom);\n };\n Transform.prototype.scaleZoom = function scaleZoom(scale) {\n return Math.log(scale) / Math.LN2;\n };\n Transform.prototype.project = function project2(lnglat) {\n var lat = performance2.clamp(lnglat.lat, -this.maxValidLatitude, this.maxValidLatitude);\n return new performance2.Point(performance2.mercatorXfromLng(lnglat.lng) * this.worldSize, performance2.mercatorYfromLat(lat) * this.worldSize);\n };\n Transform.prototype.unproject = function unproject(point) {\n return new performance2.MercatorCoordinate(point.x / this.worldSize, point.y / this.worldSize).toLngLat();\n };\n prototypeAccessors.point.get = function() {\n return this.project(this.center);\n };\n Transform.prototype.setLocationAtPoint = function setLocationAtPoint(lnglat, point) {\n var a = this.pointCoordinate(point);\n var b = this.pointCoordinate(this.centerPoint);\n var loc = this.locationCoordinate(lnglat);\n var newCenter = new performance2.MercatorCoordinate(loc.x - (a.x - b.x), loc.y - (a.y - b.y));\n this.center = this.coordinateLocation(newCenter);\n if (this._renderWorldCopies) {\n this.center = this.center.wrap();\n }\n };\n Transform.prototype.locationPoint = function locationPoint(lnglat) {\n return this.coordinatePoint(this.locationCoordinate(lnglat));\n };\n Transform.prototype.pointLocation = function pointLocation(p) {\n return this.coordinateLocation(this.pointCoordinate(p));\n };\n Transform.prototype.locationCoordinate = function locationCoordinate(lnglat) {\n return performance2.MercatorCoordinate.fromLngLat(lnglat);\n };\n Transform.prototype.coordinateLocation = function coordinateLocation(coord) {\n return coord.toLngLat();\n };\n Transform.prototype.pointCoordinate = function pointCoordinate(p) {\n var targetZ = 0;\n var coord0 = [\n p.x,\n p.y,\n 0,\n 1\n ];\n var coord1 = [\n p.x,\n p.y,\n 1,\n 1\n ];\n performance2.transformMat4(coord0, coord0, this.pixelMatrixInverse);\n performance2.transformMat4(coord1, coord1, this.pixelMatrixInverse);\n var w0 = coord0[3];\n var w1 = coord1[3];\n var x0 = coord0[0] / w0;\n var x1 = coord1[0] / w1;\n var y0 = coord0[1] / w0;\n var y1 = coord1[1] / w1;\n var z0 = coord0[2] / w0;\n var z1 = coord1[2] / w1;\n var t = z0 === z1 ? 0 : (targetZ - z0) / (z1 - z0);\n return new performance2.MercatorCoordinate(performance2.number(x0, x1, t) / this.worldSize, performance2.number(y0, y1, t) / this.worldSize);\n };\n Transform.prototype.coordinatePoint = function coordinatePoint(coord) {\n var p = [\n coord.x * this.worldSize,\n coord.y * this.worldSize,\n 0,\n 1\n ];\n performance2.transformMat4(p, p, this.pixelMatrix);\n return new performance2.Point(p[0] / p[3], p[1] / p[3]);\n };\n Transform.prototype.getBounds = function getBounds() {\n return new performance2.LngLatBounds().extend(this.pointLocation(new performance2.Point(0, 0))).extend(this.pointLocation(new performance2.Point(this.width, 0))).extend(this.pointLocation(new performance2.Point(this.width, this.height))).extend(this.pointLocation(new performance2.Point(0, this.height)));\n };\n Transform.prototype.getMaxBounds = function getMaxBounds() {\n if (!this.latRange || this.latRange.length !== 2 || !this.lngRange || this.lngRange.length !== 2) {\n return null;\n }\n return new performance2.LngLatBounds([\n this.lngRange[0],\n this.latRange[0]\n ], [\n this.lngRange[1],\n this.latRange[1]\n ]);\n };\n Transform.prototype.setMaxBounds = function setMaxBounds(bounds) {\n if (bounds) {\n this.lngRange = [\n bounds.getWest(),\n bounds.getEast()\n ];\n this.latRange = [\n bounds.getSouth(),\n bounds.getNorth()\n ];\n this._constrain();\n } else {\n this.lngRange = null;\n this.latRange = [\n -this.maxValidLatitude,\n this.maxValidLatitude\n ];\n }\n };\n Transform.prototype.calculatePosMatrix = function calculatePosMatrix(unwrappedTileID, aligned) {\n if (aligned === void 0)\n aligned = false;\n var posMatrixKey = unwrappedTileID.key;\n var cache = aligned ? this._alignedPosMatrixCache : this._posMatrixCache;\n if (cache[posMatrixKey]) {\n return cache[posMatrixKey];\n }\n var canonical = unwrappedTileID.canonical;\n var scale = this.worldSize / this.zoomScale(canonical.z);\n var unwrappedX = canonical.x + Math.pow(2, canonical.z) * unwrappedTileID.wrap;\n var posMatrix = performance2.identity(new Float64Array(16));\n performance2.translate(posMatrix, posMatrix, [\n unwrappedX * scale,\n canonical.y * scale,\n 0\n ]);\n performance2.scale(posMatrix, posMatrix, [\n scale / performance2.EXTENT,\n scale / performance2.EXTENT,\n 1\n ]);\n performance2.multiply(posMatrix, aligned ? this.alignedProjMatrix : this.projMatrix, posMatrix);\n cache[posMatrixKey] = new Float32Array(posMatrix);\n return cache[posMatrixKey];\n };\n Transform.prototype.customLayerMatrix = function customLayerMatrix() {\n return this.mercatorMatrix.slice();\n };\n Transform.prototype._constrain = function _constrain() {\n if (!this.center || !this.width || !this.height || this._constraining) {\n return;\n }\n this._constraining = true;\n var minY = -90;\n var maxY = 90;\n var minX = -180;\n var maxX = 180;\n var sy, sx, x2, y2;\n var size = this.size, unmodified = this._unmodified;\n if (this.latRange) {\n var latRange = this.latRange;\n minY = performance2.mercatorYfromLat(latRange[1]) * this.worldSize;\n maxY = performance2.mercatorYfromLat(latRange[0]) * this.worldSize;\n sy = maxY - minY < size.y ? size.y / (maxY - minY) : 0;\n }\n if (this.lngRange) {\n var lngRange = this.lngRange;\n minX = performance2.mercatorXfromLng(lngRange[0]) * this.worldSize;\n maxX = performance2.mercatorXfromLng(lngRange[1]) * this.worldSize;\n sx = maxX - minX < size.x ? size.x / (maxX - minX) : 0;\n }\n var point = this.point;\n var s = Math.max(sx || 0, sy || 0);\n if (s) {\n this.center = this.unproject(new performance2.Point(sx ? (maxX + minX) / 2 : point.x, sy ? (maxY + minY) / 2 : point.y));\n this.zoom += this.scaleZoom(s);\n this._unmodified = unmodified;\n this._constraining = false;\n return;\n }\n if (this.latRange) {\n var y = point.y, h2 = size.y / 2;\n if (y - h2 < minY) {\n y2 = minY + h2;\n }\n if (y + h2 > maxY) {\n y2 = maxY - h2;\n }\n }\n if (this.lngRange) {\n var x = point.x, w2 = size.x / 2;\n if (x - w2 < minX) {\n x2 = minX + w2;\n }\n if (x + w2 > maxX) {\n x2 = maxX - w2;\n }\n }\n if (x2 !== void 0 || y2 !== void 0) {\n this.center = this.unproject(new performance2.Point(x2 !== void 0 ? x2 : point.x, y2 !== void 0 ? y2 : point.y));\n }\n this._unmodified = unmodified;\n this._constraining = false;\n };\n Transform.prototype._calcMatrices = function _calcMatrices() {\n if (!this.height) {\n return;\n }\n var halfFov = this._fov / 2;\n var offset = this.centerOffset;\n this.cameraToCenterDistance = 0.5 / Math.tan(halfFov) * this.height;\n var groundAngle = Math.PI / 2 + this._pitch;\n var fovAboveCenter = this._fov * (0.5 + offset.y / this.height);\n var topHalfSurfaceDistance = Math.sin(fovAboveCenter) * this.cameraToCenterDistance / Math.sin(performance2.clamp(Math.PI - groundAngle - fovAboveCenter, 0.01, Math.PI - 0.01));\n var point = this.point;\n var x = point.x, y = point.y;\n var furthestDistance = Math.cos(Math.PI / 2 - this._pitch) * topHalfSurfaceDistance + this.cameraToCenterDistance;\n var farZ = furthestDistance * 1.01;\n var nearZ = this.height / 50;\n var m = new Float64Array(16);\n performance2.perspective(m, this._fov, this.width / this.height, nearZ, farZ);\n m[8] = -offset.x * 2 / this.width;\n m[9] = offset.y * 2 / this.height;\n performance2.scale(m, m, [\n 1,\n -1,\n 1\n ]);\n performance2.translate(m, m, [\n 0,\n 0,\n -this.cameraToCenterDistance\n ]);\n performance2.rotateX(m, m, this._pitch);\n performance2.rotateZ(m, m, this.angle);\n performance2.translate(m, m, [\n -x,\n -y,\n 0\n ]);\n this.mercatorMatrix = performance2.scale([], m, [\n this.worldSize,\n this.worldSize,\n this.worldSize\n ]);\n performance2.scale(m, m, [\n 1,\n 1,\n performance2.mercatorZfromAltitude(1, this.center.lat) * this.worldSize,\n 1\n ]);\n this.projMatrix = m;\n this.invProjMatrix = performance2.invert([], this.projMatrix);\n var xShift = this.width % 2 / 2, yShift = this.height % 2 / 2, angleCos = Math.cos(this.angle), angleSin = Math.sin(this.angle), dx = x - Math.round(x) + angleCos * xShift + angleSin * yShift, dy = y - Math.round(y) + angleCos * yShift + angleSin * xShift;\n var alignedM = new Float64Array(m);\n performance2.translate(alignedM, alignedM, [\n dx > 0.5 ? dx - 1 : dx,\n dy > 0.5 ? dy - 1 : dy,\n 0\n ]);\n this.alignedProjMatrix = alignedM;\n m = performance2.create();\n performance2.scale(m, m, [\n this.width / 2,\n -this.height / 2,\n 1\n ]);\n performance2.translate(m, m, [\n 1,\n -1,\n 0\n ]);\n this.labelPlaneMatrix = m;\n m = performance2.create();\n performance2.scale(m, m, [\n 1,\n -1,\n 1\n ]);\n performance2.translate(m, m, [\n -1,\n -1,\n 0\n ]);\n performance2.scale(m, m, [\n 2 / this.width,\n 2 / this.height,\n 1\n ]);\n this.glCoordMatrix = m;\n this.pixelMatrix = performance2.multiply(new Float64Array(16), this.labelPlaneMatrix, this.projMatrix);\n m = performance2.invert(new Float64Array(16), this.pixelMatrix);\n if (!m) {\n throw new Error(\"failed to invert matrix\");\n }\n this.pixelMatrixInverse = m;\n this._posMatrixCache = {};\n this._alignedPosMatrixCache = {};\n };\n Transform.prototype.maxPitchScaleFactor = function maxPitchScaleFactor() {\n if (!this.pixelMatrixInverse) {\n return 1;\n }\n var coord = this.pointCoordinate(new performance2.Point(0, 0));\n var p = [\n coord.x * this.worldSize,\n coord.y * this.worldSize,\n 0,\n 1\n ];\n var topPoint = performance2.transformMat4(p, p, this.pixelMatrix);\n return topPoint[3] / this.cameraToCenterDistance;\n };\n Transform.prototype.getCameraPoint = function getCameraPoint() {\n var pitch = this._pitch;\n var yOffset = Math.tan(pitch) * (this.cameraToCenterDistance || 1);\n return this.centerPoint.add(new performance2.Point(0, yOffset));\n };\n Transform.prototype.getCameraQueryGeometry = function getCameraQueryGeometry(queryGeometry) {\n var c = this.getCameraPoint();\n if (queryGeometry.length === 1) {\n return [\n queryGeometry[0],\n c\n ];\n } else {\n var minX = c.x;\n var minY = c.y;\n var maxX = c.x;\n var maxY = c.y;\n for (var i = 0, list = queryGeometry; i < list.length; i += 1) {\n var p = list[i];\n minX = Math.min(minX, p.x);\n minY = Math.min(minY, p.y);\n maxX = Math.max(maxX, p.x);\n maxY = Math.max(maxY, p.y);\n }\n return [\n new performance2.Point(minX, minY),\n new performance2.Point(maxX, minY),\n new performance2.Point(maxX, maxY),\n new performance2.Point(minX, maxY),\n new performance2.Point(minX, minY)\n ];\n }\n };\n Object.defineProperties(Transform.prototype, prototypeAccessors);\n function throttle(fn, time) {\n var pending = false;\n var timerId = null;\n var later = function() {\n timerId = null;\n if (pending) {\n fn();\n timerId = setTimeout(later, time);\n pending = false;\n }\n };\n return function() {\n pending = true;\n if (!timerId) {\n later();\n }\n return timerId;\n };\n }\n var Hash = function Hash2(hashName) {\n this._hashName = hashName && encodeURIComponent(hashName);\n performance2.bindAll([\n \"_getCurrentHash\",\n \"_onHashChange\",\n \"_updateHash\"\n ], this);\n this._updateHash = throttle(this._updateHashUnthrottled.bind(this), 30 * 1e3 / 100);\n };\n Hash.prototype.addTo = function addTo(map) {\n this._map = map;\n performance2.window.addEventListener(\"hashchange\", this._onHashChange, false);\n this._map.on(\"moveend\", this._updateHash);\n return this;\n };\n Hash.prototype.remove = function remove() {\n performance2.window.removeEventListener(\"hashchange\", this._onHashChange, false);\n this._map.off(\"moveend\", this._updateHash);\n clearTimeout(this._updateHash());\n delete this._map;\n return this;\n };\n Hash.prototype.getHashString = function getHashString(mapFeedback) {\n var center = this._map.getCenter(), zoom = Math.round(this._map.getZoom() * 100) / 100, precision = Math.ceil((zoom * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10), m = Math.pow(10, precision), lng = Math.round(center.lng * m) / m, lat = Math.round(center.lat * m) / m, bearing = this._map.getBearing(), pitch = this._map.getPitch();\n var hash = \"\";\n if (mapFeedback) {\n hash += \"/\" + lng + \"/\" + lat + \"/\" + zoom;\n } else {\n hash += zoom + \"/\" + lat + \"/\" + lng;\n }\n if (bearing || pitch) {\n hash += \"/\" + Math.round(bearing * 10) / 10;\n }\n if (pitch) {\n hash += \"/\" + Math.round(pitch);\n }\n if (this._hashName) {\n var hashName = this._hashName;\n var found = false;\n var parts = performance2.window.location.hash.slice(1).split(\"&\").map(function(part) {\n var key = part.split(\"=\")[0];\n if (key === hashName) {\n found = true;\n return key + \"=\" + hash;\n }\n return part;\n }).filter(function(a) {\n return a;\n });\n if (!found) {\n parts.push(hashName + \"=\" + hash);\n }\n return \"#\" + parts.join(\"&\");\n }\n return \"#\" + hash;\n };\n Hash.prototype._getCurrentHash = function _getCurrentHash() {\n var this$1 = this;\n var hash = performance2.window.location.hash.replace(\"#\", \"\");\n if (this._hashName) {\n var keyval;\n hash.split(\"&\").map(function(part) {\n return part.split(\"=\");\n }).forEach(function(part) {\n if (part[0] === this$1._hashName) {\n keyval = part;\n }\n });\n return (keyval ? keyval[1] || \"\" : \"\").split(\"/\");\n }\n return hash.split(\"/\");\n };\n Hash.prototype._onHashChange = function _onHashChange() {\n var loc = this._getCurrentHash();\n if (loc.length >= 3 && !loc.some(function(v) {\n return isNaN(v);\n })) {\n var bearing = this._map.dragRotate.isEnabled() && this._map.touchZoomRotate.isEnabled() ? +(loc[3] || 0) : this._map.getBearing();\n this._map.jumpTo({\n center: [\n +loc[2],\n +loc[1]\n ],\n zoom: +loc[0],\n bearing,\n pitch: +(loc[4] || 0)\n });\n return true;\n }\n return false;\n };\n Hash.prototype._updateHashUnthrottled = function _updateHashUnthrottled() {\n var location2 = performance2.window.location.href.replace(/(#.+)?$/, this.getHashString());\n try {\n performance2.window.history.replaceState(performance2.window.history.state, null, location2);\n } catch (SecurityError) {\n }\n };\n var defaultInertiaOptions = {\n linearity: 0.3,\n easing: performance2.bezier(0, 0, 0.3, 1)\n };\n var defaultPanInertiaOptions = performance2.extend({\n deceleration: 2500,\n maxSpeed: 1400\n }, defaultInertiaOptions);\n var defaultZoomInertiaOptions = performance2.extend({\n deceleration: 20,\n maxSpeed: 1400\n }, defaultInertiaOptions);\n var defaultBearingInertiaOptions = performance2.extend({\n deceleration: 1e3,\n maxSpeed: 360\n }, defaultInertiaOptions);\n var defaultPitchInertiaOptions = performance2.extend({\n deceleration: 1e3,\n maxSpeed: 90\n }, defaultInertiaOptions);\n var HandlerInertia = function HandlerInertia2(map) {\n this._map = map;\n this.clear();\n };\n HandlerInertia.prototype.clear = function clear() {\n this._inertiaBuffer = [];\n };\n HandlerInertia.prototype.record = function record(settings) {\n this._drainInertiaBuffer();\n this._inertiaBuffer.push({\n time: performance2.browser.now(),\n settings\n });\n };\n HandlerInertia.prototype._drainInertiaBuffer = function _drainInertiaBuffer() {\n var inertia = this._inertiaBuffer, now = performance2.browser.now(), cutoff = 160;\n while (inertia.length > 0 && now - inertia[0].time > cutoff) {\n inertia.shift();\n }\n };\n HandlerInertia.prototype._onMoveEnd = function _onMoveEnd(panInertiaOptions) {\n this._drainInertiaBuffer();\n if (this._inertiaBuffer.length < 2) {\n return;\n }\n var deltas = {\n zoom: 0,\n bearing: 0,\n pitch: 0,\n pan: new performance2.Point(0, 0),\n pinchAround: void 0,\n around: void 0\n };\n for (var i = 0, list = this._inertiaBuffer; i < list.length; i += 1) {\n var ref = list[i];\n var settings = ref.settings;\n deltas.zoom += settings.zoomDelta || 0;\n deltas.bearing += settings.bearingDelta || 0;\n deltas.pitch += settings.pitchDelta || 0;\n if (settings.panDelta) {\n deltas.pan._add(settings.panDelta);\n }\n if (settings.around) {\n deltas.around = settings.around;\n }\n if (settings.pinchAround) {\n deltas.pinchAround = settings.pinchAround;\n }\n }\n var lastEntry = this._inertiaBuffer[this._inertiaBuffer.length - 1];\n var duration = lastEntry.time - this._inertiaBuffer[0].time;\n var easeOptions = {};\n if (deltas.pan.mag()) {\n var result = calculateEasing(deltas.pan.mag(), duration, performance2.extend({}, defaultPanInertiaOptions, panInertiaOptions || {}));\n easeOptions.offset = deltas.pan.mult(result.amount / deltas.pan.mag());\n easeOptions.center = this._map.transform.center;\n extendDuration(easeOptions, result);\n }\n if (deltas.zoom) {\n var result$1 = calculateEasing(deltas.zoom, duration, defaultZoomInertiaOptions);\n easeOptions.zoom = this._map.transform.zoom + result$1.amount;\n extendDuration(easeOptions, result$1);\n }\n if (deltas.bearing) {\n var result$2 = calculateEasing(deltas.bearing, duration, defaultBearingInertiaOptions);\n easeOptions.bearing = this._map.transform.bearing + performance2.clamp(result$2.amount, -179, 179);\n extendDuration(easeOptions, result$2);\n }\n if (deltas.pitch) {\n var result$3 = calculateEasing(deltas.pitch, duration, defaultPitchInertiaOptions);\n easeOptions.pitch = this._map.transform.pitch + result$3.amount;\n extendDuration(easeOptions, result$3);\n }\n if (easeOptions.zoom || easeOptions.bearing) {\n var last = deltas.pinchAround === void 0 ? deltas.around : deltas.pinchAround;\n easeOptions.around = last ? this._map.unproject(last) : this._map.getCenter();\n }\n this.clear();\n return performance2.extend(easeOptions, { noMoveStart: true });\n };\n function extendDuration(easeOptions, result) {\n if (!easeOptions.duration || easeOptions.duration < result.duration) {\n easeOptions.duration = result.duration;\n easeOptions.easing = result.easing;\n }\n }\n function calculateEasing(amount, inertiaDuration, inertiaOptions) {\n var maxSpeed = inertiaOptions.maxSpeed;\n var linearity = inertiaOptions.linearity;\n var deceleration = inertiaOptions.deceleration;\n var speed = performance2.clamp(amount * linearity / (inertiaDuration / 1e3), -maxSpeed, maxSpeed);\n var duration = Math.abs(speed) / (deceleration * linearity);\n return {\n easing: inertiaOptions.easing,\n duration: duration * 1e3,\n amount: speed * (duration / 2)\n };\n }\n var MapMouseEvent = function(Event) {\n function MapMouseEvent2(type, map, originalEvent, data) {\n if (data === void 0)\n data = {};\n var point = DOM.mousePos(map.getCanvasContainer(), originalEvent);\n var lngLat = map.unproject(point);\n Event.call(this, type, performance2.extend({\n point,\n lngLat,\n originalEvent\n }, data));\n this._defaultPrevented = false;\n this.target = map;\n }\n if (Event)\n MapMouseEvent2.__proto__ = Event;\n MapMouseEvent2.prototype = Object.create(Event && Event.prototype);\n MapMouseEvent2.prototype.constructor = MapMouseEvent2;\n var prototypeAccessors2 = { defaultPrevented: { configurable: true } };\n MapMouseEvent2.prototype.preventDefault = function preventDefault() {\n this._defaultPrevented = true;\n };\n prototypeAccessors2.defaultPrevented.get = function() {\n return this._defaultPrevented;\n };\n Object.defineProperties(MapMouseEvent2.prototype, prototypeAccessors2);\n return MapMouseEvent2;\n }(performance2.Event);\n var MapTouchEvent = function(Event) {\n function MapTouchEvent2(type, map, originalEvent) {\n var touches = type === \"touchend\" ? originalEvent.changedTouches : originalEvent.touches;\n var points = DOM.touchPos(map.getCanvasContainer(), touches);\n var lngLats = points.map(function(t) {\n return map.unproject(t);\n });\n var point = points.reduce(function(prev, curr, i, arr) {\n return prev.add(curr.div(arr.length));\n }, new performance2.Point(0, 0));\n var lngLat = map.unproject(point);\n Event.call(this, type, {\n points,\n point,\n lngLats,\n lngLat,\n originalEvent\n });\n this._defaultPrevented = false;\n }\n if (Event)\n MapTouchEvent2.__proto__ = Event;\n MapTouchEvent2.prototype = Object.create(Event && Event.prototype);\n MapTouchEvent2.prototype.constructor = MapTouchEvent2;\n var prototypeAccessors$1 = { defaultPrevented: { configurable: true } };\n MapTouchEvent2.prototype.preventDefault = function preventDefault() {\n this._defaultPrevented = true;\n };\n prototypeAccessors$1.defaultPrevented.get = function() {\n return this._defaultPrevented;\n };\n Object.defineProperties(MapTouchEvent2.prototype, prototypeAccessors$1);\n return MapTouchEvent2;\n }(performance2.Event);\n var MapWheelEvent = function(Event) {\n function MapWheelEvent2(type, map, originalEvent) {\n Event.call(this, type, { originalEvent });\n this._defaultPrevented = false;\n }\n if (Event)\n MapWheelEvent2.__proto__ = Event;\n MapWheelEvent2.prototype = Object.create(Event && Event.prototype);\n MapWheelEvent2.prototype.constructor = MapWheelEvent2;\n var prototypeAccessors$2 = { defaultPrevented: { configurable: true } };\n MapWheelEvent2.prototype.preventDefault = function preventDefault() {\n this._defaultPrevented = true;\n };\n prototypeAccessors$2.defaultPrevented.get = function() {\n return this._defaultPrevented;\n };\n Object.defineProperties(MapWheelEvent2.prototype, prototypeAccessors$2);\n return MapWheelEvent2;\n }(performance2.Event);\n var MapEventHandler = function MapEventHandler2(map, options) {\n this._map = map;\n this._clickTolerance = options.clickTolerance;\n };\n MapEventHandler.prototype.reset = function reset() {\n delete this._mousedownPos;\n };\n MapEventHandler.prototype.wheel = function wheel(e) {\n return this._firePreventable(new MapWheelEvent(e.type, this._map, e));\n };\n MapEventHandler.prototype.mousedown = function mousedown(e, point) {\n this._mousedownPos = point;\n return this._firePreventable(new MapMouseEvent(e.type, this._map, e));\n };\n MapEventHandler.prototype.mouseup = function mouseup(e) {\n this._map.fire(new MapMouseEvent(e.type, this._map, e));\n };\n MapEventHandler.prototype.click = function click(e, point) {\n if (this._mousedownPos && this._mousedownPos.dist(point) >= this._clickTolerance) {\n return;\n }\n this._map.fire(new MapMouseEvent(e.type, this._map, e));\n };\n MapEventHandler.prototype.dblclick = function dblclick(e) {\n return this._firePreventable(new MapMouseEvent(e.type, this._map, e));\n };\n MapEventHandler.prototype.mouseover = function mouseover(e) {\n this._map.fire(new MapMouseEvent(e.type, this._map, e));\n };\n MapEventHandler.prototype.mouseout = function mouseout(e) {\n this._map.fire(new MapMouseEvent(e.type, this._map, e));\n };\n MapEventHandler.prototype.touchstart = function touchstart(e) {\n return this._firePreventable(new MapTouchEvent(e.type, this._map, e));\n };\n MapEventHandler.prototype.touchmove = function touchmove(e) {\n this._map.fire(new MapTouchEvent(e.type, this._map, e));\n };\n MapEventHandler.prototype.touchend = function touchend(e) {\n this._map.fire(new MapTouchEvent(e.type, this._map, e));\n };\n MapEventHandler.prototype.touchcancel = function touchcancel(e) {\n this._map.fire(new MapTouchEvent(e.type, this._map, e));\n };\n MapEventHandler.prototype._firePreventable = function _firePreventable(mapEvent) {\n this._map.fire(mapEvent);\n if (mapEvent.defaultPrevented) {\n return {};\n }\n };\n MapEventHandler.prototype.isEnabled = function isEnabled() {\n return true;\n };\n MapEventHandler.prototype.isActive = function isActive() {\n return false;\n };\n MapEventHandler.prototype.enable = function enable() {\n };\n MapEventHandler.prototype.disable = function disable() {\n };\n var BlockableMapEventHandler = function BlockableMapEventHandler2(map) {\n this._map = map;\n };\n BlockableMapEventHandler.prototype.reset = function reset() {\n this._delayContextMenu = false;\n delete this._contextMenuEvent;\n };\n BlockableMapEventHandler.prototype.mousemove = function mousemove(e) {\n this._map.fire(new MapMouseEvent(e.type, this._map, e));\n };\n BlockableMapEventHandler.prototype.mousedown = function mousedown() {\n this._delayContextMenu = true;\n };\n BlockableMapEventHandler.prototype.mouseup = function mouseup() {\n this._delayContextMenu = false;\n if (this._contextMenuEvent) {\n this._map.fire(new MapMouseEvent(\"contextmenu\", this._map, this._contextMenuEvent));\n delete this._contextMenuEvent;\n }\n };\n BlockableMapEventHandler.prototype.contextmenu = function contextmenu(e) {\n if (this._delayContextMenu) {\n this._contextMenuEvent = e;\n } else {\n this._map.fire(new MapMouseEvent(e.type, this._map, e));\n }\n if (this._map.listens(\"contextmenu\")) {\n e.preventDefault();\n }\n };\n BlockableMapEventHandler.prototype.isEnabled = function isEnabled() {\n return true;\n };\n BlockableMapEventHandler.prototype.isActive = function isActive() {\n return false;\n };\n BlockableMapEventHandler.prototype.enable = function enable() {\n };\n BlockableMapEventHandler.prototype.disable = function disable() {\n };\n var BoxZoomHandler = function BoxZoomHandler2(map, options) {\n this._map = map;\n this._el = map.getCanvasContainer();\n this._container = map.getContainer();\n this._clickTolerance = options.clickTolerance || 1;\n };\n BoxZoomHandler.prototype.isEnabled = function isEnabled() {\n return !!this._enabled;\n };\n BoxZoomHandler.prototype.isActive = function isActive() {\n return !!this._active;\n };\n BoxZoomHandler.prototype.enable = function enable() {\n if (this.isEnabled()) {\n return;\n }\n this._enabled = true;\n };\n BoxZoomHandler.prototype.disable = function disable() {\n if (!this.isEnabled()) {\n return;\n }\n this._enabled = false;\n };\n BoxZoomHandler.prototype.mousedown = function mousedown(e, point) {\n if (!this.isEnabled()) {\n return;\n }\n if (!(e.shiftKey && e.button === 0)) {\n return;\n }\n DOM.disableDrag();\n this._startPos = this._lastPos = point;\n this._active = true;\n };\n BoxZoomHandler.prototype.mousemoveWindow = function mousemoveWindow(e, point) {\n if (!this._active) {\n return;\n }\n var pos = point;\n if (this._lastPos.equals(pos) || !this._box && pos.dist(this._startPos) < this._clickTolerance) {\n return;\n }\n var p0 = this._startPos;\n this._lastPos = pos;\n if (!this._box) {\n this._box = DOM.create(\"div\", \"mapboxgl-boxzoom\", this._container);\n this._container.classList.add(\"mapboxgl-crosshair\");\n this._fireEvent(\"boxzoomstart\", e);\n }\n var minX = Math.min(p0.x, pos.x), maxX = Math.max(p0.x, pos.x), minY = Math.min(p0.y, pos.y), maxY = Math.max(p0.y, pos.y);\n DOM.setTransform(this._box, \"translate(\" + minX + \"px,\" + minY + \"px)\");\n this._box.style.width = maxX - minX + \"px\";\n this._box.style.height = maxY - minY + \"px\";\n };\n BoxZoomHandler.prototype.mouseupWindow = function mouseupWindow(e, point) {\n var this$1 = this;\n if (!this._active) {\n return;\n }\n if (e.button !== 0) {\n return;\n }\n var p0 = this._startPos, p1 = point;\n this.reset();\n DOM.suppressClick();\n if (p0.x === p1.x && p0.y === p1.y) {\n this._fireEvent(\"boxzoomcancel\", e);\n } else {\n this._map.fire(new performance2.Event(\"boxzoomend\", { originalEvent: e }));\n return {\n cameraAnimation: function(map) {\n return map.fitScreenCoordinates(p0, p1, this$1._map.getBearing(), { linear: true });\n }\n };\n }\n };\n BoxZoomHandler.prototype.keydown = function keydown(e) {\n if (!this._active) {\n return;\n }\n if (e.keyCode === 27) {\n this.reset();\n this._fireEvent(\"boxzoomcancel\", e);\n }\n };\n BoxZoomHandler.prototype.reset = function reset() {\n this._active = false;\n this._container.classList.remove(\"mapboxgl-crosshair\");\n if (this._box) {\n DOM.remove(this._box);\n this._box = null;\n }\n DOM.enableDrag();\n delete this._startPos;\n delete this._lastPos;\n };\n BoxZoomHandler.prototype._fireEvent = function _fireEvent(type, e) {\n return this._map.fire(new performance2.Event(type, { originalEvent: e }));\n };\n function indexTouches(touches, points) {\n var obj = {};\n for (var i = 0; i < touches.length; i++) {\n obj[touches[i].identifier] = points[i];\n }\n return obj;\n }\n function getCentroid(points) {\n var sum = new performance2.Point(0, 0);\n for (var i = 0, list = points; i < list.length; i += 1) {\n var point = list[i];\n sum._add(point);\n }\n return sum.div(points.length);\n }\n var MAX_TAP_INTERVAL = 500;\n var MAX_TOUCH_TIME = 500;\n var MAX_DIST = 30;\n var SingleTapRecognizer = function SingleTapRecognizer2(options) {\n this.reset();\n this.numTouches = options.numTouches;\n };\n SingleTapRecognizer.prototype.reset = function reset() {\n delete this.centroid;\n delete this.startTime;\n delete this.touches;\n this.aborted = false;\n };\n SingleTapRecognizer.prototype.touchstart = function touchstart(e, points, mapTouches) {\n if (this.centroid || mapTouches.length > this.numTouches) {\n this.aborted = true;\n }\n if (this.aborted) {\n return;\n }\n if (this.startTime === void 0) {\n this.startTime = e.timeStamp;\n }\n if (mapTouches.length === this.numTouches) {\n this.centroid = getCentroid(points);\n this.touches = indexTouches(mapTouches, points);\n }\n };\n SingleTapRecognizer.prototype.touchmove = function touchmove(e, points, mapTouches) {\n if (this.aborted || !this.centroid) {\n return;\n }\n var newTouches = indexTouches(mapTouches, points);\n for (var id in this.touches) {\n var prevPos = this.touches[id];\n var pos = newTouches[id];\n if (!pos || pos.dist(prevPos) > MAX_DIST) {\n this.aborted = true;\n }\n }\n };\n SingleTapRecognizer.prototype.touchend = function touchend(e, points, mapTouches) {\n if (!this.centroid || e.timeStamp - this.startTime > MAX_TOUCH_TIME) {\n this.aborted = true;\n }\n if (mapTouches.length === 0) {\n var centroid = !this.aborted && this.centroid;\n this.reset();\n if (centroid) {\n return centroid;\n }\n }\n };\n var TapRecognizer = function TapRecognizer2(options) {\n this.singleTap = new SingleTapRecognizer(options);\n this.numTaps = options.numTaps;\n this.reset();\n };\n TapRecognizer.prototype.reset = function reset() {\n this.lastTime = Infinity;\n delete this.lastTap;\n this.count = 0;\n this.singleTap.reset();\n };\n TapRecognizer.prototype.touchstart = function touchstart(e, points, mapTouches) {\n this.singleTap.touchstart(e, points, mapTouches);\n };\n TapRecognizer.prototype.touchmove = function touchmove(e, points, mapTouches) {\n this.singleTap.touchmove(e, points, mapTouches);\n };\n TapRecognizer.prototype.touchend = function touchend(e, points, mapTouches) {\n var tap = this.singleTap.touchend(e, points, mapTouches);\n if (tap) {\n var soonEnough = e.timeStamp - this.lastTime < MAX_TAP_INTERVAL;\n var closeEnough = !this.lastTap || this.lastTap.dist(tap) < MAX_DIST;\n if (!soonEnough || !closeEnough) {\n this.reset();\n }\n this.count++;\n this.lastTime = e.timeStamp;\n this.lastTap = tap;\n if (this.count === this.numTaps) {\n this.reset();\n return tap;\n }\n }\n };\n var TapZoomHandler = function TapZoomHandler2() {\n this._zoomIn = new TapRecognizer({\n numTouches: 1,\n numTaps: 2\n });\n this._zoomOut = new TapRecognizer({\n numTouches: 2,\n numTaps: 1\n });\n this.reset();\n };\n TapZoomHandler.prototype.reset = function reset() {\n this._active = false;\n this._zoomIn.reset();\n this._zoomOut.reset();\n };\n TapZoomHandler.prototype.touchstart = function touchstart(e, points, mapTouches) {\n this._zoomIn.touchstart(e, points, mapTouches);\n this._zoomOut.touchstart(e, points, mapTouches);\n };\n TapZoomHandler.prototype.touchmove = function touchmove(e, points, mapTouches) {\n this._zoomIn.touchmove(e, points, mapTouches);\n this._zoomOut.touchmove(e, points, mapTouches);\n };\n TapZoomHandler.prototype.touchend = function touchend(e, points, mapTouches) {\n var this$1 = this;\n var zoomInPoint = this._zoomIn.touchend(e, points, mapTouches);\n var zoomOutPoint = this._zoomOut.touchend(e, points, mapTouches);\n if (zoomInPoint) {\n this._active = true;\n e.preventDefault();\n setTimeout(function() {\n return this$1.reset();\n }, 0);\n return {\n cameraAnimation: function(map) {\n return map.easeTo({\n duration: 300,\n zoom: map.getZoom() + 1,\n around: map.unproject(zoomInPoint)\n }, { originalEvent: e });\n }\n };\n } else if (zoomOutPoint) {\n this._active = true;\n e.preventDefault();\n setTimeout(function() {\n return this$1.reset();\n }, 0);\n return {\n cameraAnimation: function(map) {\n return map.easeTo({\n duration: 300,\n zoom: map.getZoom() - 1,\n around: map.unproject(zoomOutPoint)\n }, { originalEvent: e });\n }\n };\n }\n };\n TapZoomHandler.prototype.touchcancel = function touchcancel() {\n this.reset();\n };\n TapZoomHandler.prototype.enable = function enable() {\n this._enabled = true;\n };\n TapZoomHandler.prototype.disable = function disable() {\n this._enabled = false;\n this.reset();\n };\n TapZoomHandler.prototype.isEnabled = function isEnabled() {\n return this._enabled;\n };\n TapZoomHandler.prototype.isActive = function isActive() {\n return this._active;\n };\n var LEFT_BUTTON = 0;\n var RIGHT_BUTTON = 2;\n var BUTTONS_FLAGS = {};\n BUTTONS_FLAGS[LEFT_BUTTON] = 1;\n BUTTONS_FLAGS[RIGHT_BUTTON] = 2;\n function buttonStillPressed(e, button) {\n var flag = BUTTONS_FLAGS[button];\n return e.buttons === void 0 || (e.buttons & flag) !== flag;\n }\n var MouseHandler = function MouseHandler2(options) {\n this.reset();\n this._clickTolerance = options.clickTolerance || 1;\n };\n MouseHandler.prototype.reset = function reset() {\n this._active = false;\n this._moved = false;\n delete this._lastPoint;\n delete this._eventButton;\n };\n MouseHandler.prototype._correctButton = function _correctButton(e, button) {\n return false;\n };\n MouseHandler.prototype._move = function _move(lastPoint, point) {\n return {};\n };\n MouseHandler.prototype.mousedown = function mousedown(e, point) {\n if (this._lastPoint) {\n return;\n }\n var eventButton = DOM.mouseButton(e);\n if (!this._correctButton(e, eventButton)) {\n return;\n }\n this._lastPoint = point;\n this._eventButton = eventButton;\n };\n MouseHandler.prototype.mousemoveWindow = function mousemoveWindow(e, point) {\n var lastPoint = this._lastPoint;\n if (!lastPoint) {\n return;\n }\n e.preventDefault();\n if (buttonStillPressed(e, this._eventButton)) {\n this.reset();\n return;\n }\n if (!this._moved && point.dist(lastPoint) < this._clickTolerance) {\n return;\n }\n this._moved = true;\n this._lastPoint = point;\n return this._move(lastPoint, point);\n };\n MouseHandler.prototype.mouseupWindow = function mouseupWindow(e) {\n if (!this._lastPoint) {\n return;\n }\n var eventButton = DOM.mouseButton(e);\n if (eventButton !== this._eventButton) {\n return;\n }\n if (this._moved) {\n DOM.suppressClick();\n }\n this.reset();\n };\n MouseHandler.prototype.enable = function enable() {\n this._enabled = true;\n };\n MouseHandler.prototype.disable = function disable() {\n this._enabled = false;\n this.reset();\n };\n MouseHandler.prototype.isEnabled = function isEnabled() {\n return this._enabled;\n };\n MouseHandler.prototype.isActive = function isActive() {\n return this._active;\n };\n var MousePanHandler = function(MouseHandler2) {\n function MousePanHandler2() {\n MouseHandler2.apply(this, arguments);\n }\n if (MouseHandler2)\n MousePanHandler2.__proto__ = MouseHandler2;\n MousePanHandler2.prototype = Object.create(MouseHandler2 && MouseHandler2.prototype);\n MousePanHandler2.prototype.constructor = MousePanHandler2;\n MousePanHandler2.prototype.mousedown = function mousedown(e, point) {\n MouseHandler2.prototype.mousedown.call(this, e, point);\n if (this._lastPoint) {\n this._active = true;\n }\n };\n MousePanHandler2.prototype._correctButton = function _correctButton(e, button) {\n return button === LEFT_BUTTON && !e.ctrlKey;\n };\n MousePanHandler2.prototype._move = function _move(lastPoint, point) {\n return {\n around: point,\n panDelta: point.sub(lastPoint)\n };\n };\n return MousePanHandler2;\n }(MouseHandler);\n var MouseRotateHandler = function(MouseHandler2) {\n function MouseRotateHandler2() {\n MouseHandler2.apply(this, arguments);\n }\n if (MouseHandler2)\n MouseRotateHandler2.__proto__ = MouseHandler2;\n MouseRotateHandler2.prototype = Object.create(MouseHandler2 && MouseHandler2.prototype);\n MouseRotateHandler2.prototype.constructor = MouseRotateHandler2;\n MouseRotateHandler2.prototype._correctButton = function _correctButton(e, button) {\n return button === LEFT_BUTTON && e.ctrlKey || button === RIGHT_BUTTON;\n };\n MouseRotateHandler2.prototype._move = function _move(lastPoint, point) {\n var degreesPerPixelMoved = 0.8;\n var bearingDelta = (point.x - lastPoint.x) * degreesPerPixelMoved;\n if (bearingDelta) {\n this._active = true;\n return { bearingDelta };\n }\n };\n MouseRotateHandler2.prototype.contextmenu = function contextmenu(e) {\n e.preventDefault();\n };\n return MouseRotateHandler2;\n }(MouseHandler);\n var MousePitchHandler = function(MouseHandler2) {\n function MousePitchHandler2() {\n MouseHandler2.apply(this, arguments);\n }\n if (MouseHandler2)\n MousePitchHandler2.__proto__ = MouseHandler2;\n MousePitchHandler2.prototype = Object.create(MouseHandler2 && MouseHandler2.prototype);\n MousePitchHandler2.prototype.constructor = MousePitchHandler2;\n MousePitchHandler2.prototype._correctButton = function _correctButton(e, button) {\n return button === LEFT_BUTTON && e.ctrlKey || button === RIGHT_BUTTON;\n };\n MousePitchHandler2.prototype._move = function _move(lastPoint, point) {\n var degreesPerPixelMoved = -0.5;\n var pitchDelta = (point.y - lastPoint.y) * degreesPerPixelMoved;\n if (pitchDelta) {\n this._active = true;\n return { pitchDelta };\n }\n };\n MousePitchHandler2.prototype.contextmenu = function contextmenu(e) {\n e.preventDefault();\n };\n return MousePitchHandler2;\n }(MouseHandler);\n var TouchPanHandler = function TouchPanHandler2(options) {\n this._minTouches = 1;\n this._clickTolerance = options.clickTolerance || 1;\n this.reset();\n };\n TouchPanHandler.prototype.reset = function reset() {\n this._active = false;\n this._touches = {};\n this._sum = new performance2.Point(0, 0);\n };\n TouchPanHandler.prototype.touchstart = function touchstart(e, points, mapTouches) {\n return this._calculateTransform(e, points, mapTouches);\n };\n TouchPanHandler.prototype.touchmove = function touchmove(e, points, mapTouches) {\n if (!this._active || mapTouches.length < this._minTouches) {\n return;\n }\n e.preventDefault();\n return this._calculateTransform(e, points, mapTouches);\n };\n TouchPanHandler.prototype.touchend = function touchend(e, points, mapTouches) {\n this._calculateTransform(e, points, mapTouches);\n if (this._active && mapTouches.length < this._minTouches) {\n this.reset();\n }\n };\n TouchPanHandler.prototype.touchcancel = function touchcancel() {\n this.reset();\n };\n TouchPanHandler.prototype._calculateTransform = function _calculateTransform(e, points, mapTouches) {\n if (mapTouches.length > 0) {\n this._active = true;\n }\n var touches = indexTouches(mapTouches, points);\n var touchPointSum = new performance2.Point(0, 0);\n var touchDeltaSum = new performance2.Point(0, 0);\n var touchDeltaCount = 0;\n for (var identifier in touches) {\n var point = touches[identifier];\n var prevPoint = this._touches[identifier];\n if (prevPoint) {\n touchPointSum._add(point);\n touchDeltaSum._add(point.sub(prevPoint));\n touchDeltaCount++;\n touches[identifier] = point;\n }\n }\n this._touches = touches;\n if (touchDeltaCount < this._minTouches || !touchDeltaSum.mag()) {\n return;\n }\n var panDelta = touchDeltaSum.div(touchDeltaCount);\n this._sum._add(panDelta);\n if (this._sum.mag() < this._clickTolerance) {\n return;\n }\n var around = touchPointSum.div(touchDeltaCount);\n return {\n around,\n panDelta\n };\n };\n TouchPanHandler.prototype.enable = function enable() {\n this._enabled = true;\n };\n TouchPanHandler.prototype.disable = function disable() {\n this._enabled = false;\n this.reset();\n };\n TouchPanHandler.prototype.isEnabled = function isEnabled() {\n return this._enabled;\n };\n TouchPanHandler.prototype.isActive = function isActive() {\n return this._active;\n };\n var TwoTouchHandler = function TwoTouchHandler2() {\n this.reset();\n };\n TwoTouchHandler.prototype.reset = function reset() {\n this._active = false;\n delete this._firstTwoTouches;\n };\n TwoTouchHandler.prototype._start = function _start(points) {\n };\n TwoTouchHandler.prototype._move = function _move(points, pinchAround, e) {\n return {};\n };\n TwoTouchHandler.prototype.touchstart = function touchstart(e, points, mapTouches) {\n if (this._firstTwoTouches || mapTouches.length < 2) {\n return;\n }\n this._firstTwoTouches = [\n mapTouches[0].identifier,\n mapTouches[1].identifier\n ];\n this._start([\n points[0],\n points[1]\n ]);\n };\n TwoTouchHandler.prototype.touchmove = function touchmove(e, points, mapTouches) {\n if (!this._firstTwoTouches) {\n return;\n }\n e.preventDefault();\n var ref = this._firstTwoTouches;\n var idA = ref[0];\n var idB = ref[1];\n var a = getTouchById(mapTouches, points, idA);\n var b = getTouchById(mapTouches, points, idB);\n if (!a || !b) {\n return;\n }\n var pinchAround = this._aroundCenter ? null : a.add(b).div(2);\n return this._move([\n a,\n b\n ], pinchAround, e);\n };\n TwoTouchHandler.prototype.touchend = function touchend(e, points, mapTouches) {\n if (!this._firstTwoTouches) {\n return;\n }\n var ref = this._firstTwoTouches;\n var idA = ref[0];\n var idB = ref[1];\n var a = getTouchById(mapTouches, points, idA);\n var b = getTouchById(mapTouches, points, idB);\n if (a && b) {\n return;\n }\n if (this._active) {\n DOM.suppressClick();\n }\n this.reset();\n };\n TwoTouchHandler.prototype.touchcancel = function touchcancel() {\n this.reset();\n };\n TwoTouchHandler.prototype.enable = function enable(options) {\n this._enabled = true;\n this._aroundCenter = !!options && options.around === \"center\";\n };\n TwoTouchHandler.prototype.disable = function disable() {\n this._enabled = false;\n this.reset();\n };\n TwoTouchHandler.prototype.isEnabled = function isEnabled() {\n return this._enabled;\n };\n TwoTouchHandler.prototype.isActive = function isActive() {\n return this._active;\n };\n function getTouchById(mapTouches, points, identifier) {\n for (var i = 0; i < mapTouches.length; i++) {\n if (mapTouches[i].identifier === identifier) {\n return points[i];\n }\n }\n }\n var ZOOM_THRESHOLD = 0.1;\n function getZoomDelta(distance, lastDistance) {\n return Math.log(distance / lastDistance) / Math.LN2;\n }\n var TouchZoomHandler = function(TwoTouchHandler2) {\n function TouchZoomHandler2() {\n TwoTouchHandler2.apply(this, arguments);\n }\n if (TwoTouchHandler2)\n TouchZoomHandler2.__proto__ = TwoTouchHandler2;\n TouchZoomHandler2.prototype = Object.create(TwoTouchHandler2 && TwoTouchHandler2.prototype);\n TouchZoomHandler2.prototype.constructor = TouchZoomHandler2;\n TouchZoomHandler2.prototype.reset = function reset() {\n TwoTouchHandler2.prototype.reset.call(this);\n delete this._distance;\n delete this._startDistance;\n };\n TouchZoomHandler2.prototype._start = function _start(points) {\n this._startDistance = this._distance = points[0].dist(points[1]);\n };\n TouchZoomHandler2.prototype._move = function _move(points, pinchAround) {\n var lastDistance = this._distance;\n this._distance = points[0].dist(points[1]);\n if (!this._active && Math.abs(getZoomDelta(this._distance, this._startDistance)) < ZOOM_THRESHOLD) {\n return;\n }\n this._active = true;\n return {\n zoomDelta: getZoomDelta(this._distance, lastDistance),\n pinchAround\n };\n };\n return TouchZoomHandler2;\n }(TwoTouchHandler);\n var ROTATION_THRESHOLD = 25;\n function getBearingDelta(a, b) {\n return a.angleWith(b) * 180 / Math.PI;\n }\n var TouchRotateHandler = function(TwoTouchHandler2) {\n function TouchRotateHandler2() {\n TwoTouchHandler2.apply(this, arguments);\n }\n if (TwoTouchHandler2)\n TouchRotateHandler2.__proto__ = TwoTouchHandler2;\n TouchRotateHandler2.prototype = Object.create(TwoTouchHandler2 && TwoTouchHandler2.prototype);\n TouchRotateHandler2.prototype.constructor = TouchRotateHandler2;\n TouchRotateHandler2.prototype.reset = function reset() {\n TwoTouchHandler2.prototype.reset.call(this);\n delete this._minDiameter;\n delete this._startVector;\n delete this._vector;\n };\n TouchRotateHandler2.prototype._start = function _start(points) {\n this._startVector = this._vector = points[0].sub(points[1]);\n this._minDiameter = points[0].dist(points[1]);\n };\n TouchRotateHandler2.prototype._move = function _move(points, pinchAround) {\n var lastVector = this._vector;\n this._vector = points[0].sub(points[1]);\n if (!this._active && this._isBelowThreshold(this._vector)) {\n return;\n }\n this._active = true;\n return {\n bearingDelta: getBearingDelta(this._vector, lastVector),\n pinchAround\n };\n };\n TouchRotateHandler2.prototype._isBelowThreshold = function _isBelowThreshold(vector) {\n this._minDiameter = Math.min(this._minDiameter, vector.mag());\n var circumference = Math.PI * this._minDiameter;\n var threshold = ROTATION_THRESHOLD / circumference * 360;\n var bearingDeltaSinceStart = getBearingDelta(vector, this._startVector);\n return Math.abs(bearingDeltaSinceStart) < threshold;\n };\n return TouchRotateHandler2;\n }(TwoTouchHandler);\n function isVertical(vector) {\n return Math.abs(vector.y) > Math.abs(vector.x);\n }\n var ALLOWED_SINGLE_TOUCH_TIME = 100;\n var TouchPitchHandler = function(TwoTouchHandler2) {\n function TouchPitchHandler2() {\n TwoTouchHandler2.apply(this, arguments);\n }\n if (TwoTouchHandler2)\n TouchPitchHandler2.__proto__ = TwoTouchHandler2;\n TouchPitchHandler2.prototype = Object.create(TwoTouchHandler2 && TwoTouchHandler2.prototype);\n TouchPitchHandler2.prototype.constructor = TouchPitchHandler2;\n TouchPitchHandler2.prototype.reset = function reset() {\n TwoTouchHandler2.prototype.reset.call(this);\n this._valid = void 0;\n delete this._firstMove;\n delete this._lastPoints;\n };\n TouchPitchHandler2.prototype._start = function _start(points) {\n this._lastPoints = points;\n if (isVertical(points[0].sub(points[1]))) {\n this._valid = false;\n }\n };\n TouchPitchHandler2.prototype._move = function _move(points, center, e) {\n var vectorA = points[0].sub(this._lastPoints[0]);\n var vectorB = points[1].sub(this._lastPoints[1]);\n this._valid = this.gestureBeginsVertically(vectorA, vectorB, e.timeStamp);\n if (!this._valid) {\n return;\n }\n this._lastPoints = points;\n this._active = true;\n var yDeltaAverage = (vectorA.y + vectorB.y) / 2;\n var degreesPerPixelMoved = -0.5;\n return { pitchDelta: yDeltaAverage * degreesPerPixelMoved };\n };\n TouchPitchHandler2.prototype.gestureBeginsVertically = function gestureBeginsVertically(vectorA, vectorB, timeStamp) {\n if (this._valid !== void 0) {\n return this._valid;\n }\n var threshold = 2;\n var movedA = vectorA.mag() >= threshold;\n var movedB = vectorB.mag() >= threshold;\n if (!movedA && !movedB) {\n return;\n }\n if (!movedA || !movedB) {\n if (this._firstMove === void 0) {\n this._firstMove = timeStamp;\n }\n if (timeStamp - this._firstMove < ALLOWED_SINGLE_TOUCH_TIME) {\n return void 0;\n } else {\n return false;\n }\n }\n var isSameDirection = vectorA.y > 0 === vectorB.y > 0;\n return isVertical(vectorA) && isVertical(vectorB) && isSameDirection;\n };\n return TouchPitchHandler2;\n }(TwoTouchHandler);\n var defaultOptions = {\n panStep: 100,\n bearingStep: 15,\n pitchStep: 10\n };\n var KeyboardHandler = function KeyboardHandler2() {\n var stepOptions = defaultOptions;\n this._panStep = stepOptions.panStep;\n this._bearingStep = stepOptions.bearingStep;\n this._pitchStep = stepOptions.pitchStep;\n this._rotationDisabled = false;\n };\n KeyboardHandler.prototype.reset = function reset() {\n this._active = false;\n };\n KeyboardHandler.prototype.keydown = function keydown(e) {\n var this$1 = this;\n if (e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n var zoomDir = 0;\n var bearingDir = 0;\n var pitchDir = 0;\n var xDir = 0;\n var yDir = 0;\n switch (e.keyCode) {\n case 61:\n case 107:\n case 171:\n case 187:\n zoomDir = 1;\n break;\n case 189:\n case 109:\n case 173:\n zoomDir = -1;\n break;\n case 37:\n if (e.shiftKey) {\n bearingDir = -1;\n } else {\n e.preventDefault();\n xDir = -1;\n }\n break;\n case 39:\n if (e.shiftKey) {\n bearingDir = 1;\n } else {\n e.preventDefault();\n xDir = 1;\n }\n break;\n case 38:\n if (e.shiftKey) {\n pitchDir = 1;\n } else {\n e.preventDefault();\n yDir = -1;\n }\n break;\n case 40:\n if (e.shiftKey) {\n pitchDir = -1;\n } else {\n e.preventDefault();\n yDir = 1;\n }\n break;\n default:\n return;\n }\n if (this._rotationDisabled) {\n bearingDir = 0;\n pitchDir = 0;\n }\n return {\n cameraAnimation: function(map) {\n var zoom = map.getZoom();\n map.easeTo({\n duration: 300,\n easeId: \"keyboardHandler\",\n easing: easeOut,\n zoom: zoomDir ? Math.round(zoom) + zoomDir * (e.shiftKey ? 2 : 1) : zoom,\n bearing: map.getBearing() + bearingDir * this$1._bearingStep,\n pitch: map.getPitch() + pitchDir * this$1._pitchStep,\n offset: [\n -xDir * this$1._panStep,\n -yDir * this$1._panStep\n ],\n center: map.getCenter()\n }, { originalEvent: e });\n }\n };\n };\n KeyboardHandler.prototype.enable = function enable() {\n this._enabled = true;\n };\n KeyboardHandler.prototype.disable = function disable() {\n this._enabled = false;\n this.reset();\n };\n KeyboardHandler.prototype.isEnabled = function isEnabled() {\n return this._enabled;\n };\n KeyboardHandler.prototype.isActive = function isActive() {\n return this._active;\n };\n KeyboardHandler.prototype.disableRotation = function disableRotation() {\n this._rotationDisabled = true;\n };\n KeyboardHandler.prototype.enableRotation = function enableRotation() {\n this._rotationDisabled = false;\n };\n function easeOut(t) {\n return t * (2 - t);\n }\n var wheelZoomDelta = 4.000244140625;\n var defaultZoomRate = 1 / 100;\n var wheelZoomRate = 1 / 450;\n var maxScalePerFrame = 2;\n var ScrollZoomHandler = function ScrollZoomHandler2(map, handler) {\n this._map = map;\n this._el = map.getCanvasContainer();\n this._handler = handler;\n this._delta = 0;\n this._defaultZoomRate = defaultZoomRate;\n this._wheelZoomRate = wheelZoomRate;\n performance2.bindAll([\"_onTimeout\"], this);\n };\n ScrollZoomHandler.prototype.setZoomRate = function setZoomRate(zoomRate) {\n this._defaultZoomRate = zoomRate;\n };\n ScrollZoomHandler.prototype.setWheelZoomRate = function setWheelZoomRate(wheelZoomRate2) {\n this._wheelZoomRate = wheelZoomRate2;\n };\n ScrollZoomHandler.prototype.isEnabled = function isEnabled() {\n return !!this._enabled;\n };\n ScrollZoomHandler.prototype.isActive = function isActive() {\n return !!this._active || this._finishTimeout !== void 0;\n };\n ScrollZoomHandler.prototype.isZooming = function isZooming() {\n return !!this._zooming;\n };\n ScrollZoomHandler.prototype.enable = function enable(options) {\n if (this.isEnabled()) {\n return;\n }\n this._enabled = true;\n this._aroundCenter = options && options.around === \"center\";\n };\n ScrollZoomHandler.prototype.disable = function disable() {\n if (!this.isEnabled()) {\n return;\n }\n this._enabled = false;\n };\n ScrollZoomHandler.prototype.wheel = function wheel(e) {\n if (!this.isEnabled()) {\n return;\n }\n var value = e.deltaMode === performance2.window.WheelEvent.DOM_DELTA_LINE ? e.deltaY * 40 : e.deltaY;\n var now = performance2.browser.now(), timeDelta = now - (this._lastWheelEventTime || 0);\n this._lastWheelEventTime = now;\n if (value !== 0 && value % wheelZoomDelta === 0) {\n this._type = \"wheel\";\n } else if (value !== 0 && Math.abs(value) < 4) {\n this._type = \"trackpad\";\n } else if (timeDelta > 400) {\n this._type = null;\n this._lastValue = value;\n this._timeout = setTimeout(this._onTimeout, 40, e);\n } else if (!this._type) {\n this._type = Math.abs(timeDelta * value) < 200 ? \"trackpad\" : \"wheel\";\n if (this._timeout) {\n clearTimeout(this._timeout);\n this._timeout = null;\n value += this._lastValue;\n }\n }\n if (e.shiftKey && value) {\n value = value / 4;\n }\n if (this._type) {\n this._lastWheelEvent = e;\n this._delta -= value;\n if (!this._active) {\n this._start(e);\n }\n }\n e.preventDefault();\n };\n ScrollZoomHandler.prototype._onTimeout = function _onTimeout(initialEvent) {\n this._type = \"wheel\";\n this._delta -= this._lastValue;\n if (!this._active) {\n this._start(initialEvent);\n }\n };\n ScrollZoomHandler.prototype._start = function _start(e) {\n if (!this._delta) {\n return;\n }\n if (this._frameId) {\n this._frameId = null;\n }\n this._active = true;\n if (!this.isZooming()) {\n this._zooming = true;\n }\n if (this._finishTimeout) {\n clearTimeout(this._finishTimeout);\n delete this._finishTimeout;\n }\n var pos = DOM.mousePos(this._el, e);\n this._around = performance2.LngLat.convert(this._aroundCenter ? this._map.getCenter() : this._map.unproject(pos));\n this._aroundPoint = this._map.transform.locationPoint(this._around);\n if (!this._frameId) {\n this._frameId = true;\n this._handler._triggerRenderFrame();\n }\n };\n ScrollZoomHandler.prototype.renderFrame = function renderFrame() {\n var this$1 = this;\n if (!this._frameId) {\n return;\n }\n this._frameId = null;\n if (!this.isActive()) {\n return;\n }\n var tr = this._map.transform;\n if (this._delta !== 0) {\n var zoomRate = this._type === \"wheel\" && Math.abs(this._delta) > wheelZoomDelta ? this._wheelZoomRate : this._defaultZoomRate;\n var scale = maxScalePerFrame / (1 + Math.exp(-Math.abs(this._delta * zoomRate)));\n if (this._delta < 0 && scale !== 0) {\n scale = 1 / scale;\n }\n var fromScale = typeof this._targetZoom === \"number\" ? tr.zoomScale(this._targetZoom) : tr.scale;\n this._targetZoom = Math.min(tr.maxZoom, Math.max(tr.minZoom, tr.scaleZoom(fromScale * scale)));\n if (this._type === \"wheel\") {\n this._startZoom = tr.zoom;\n this._easing = this._smoothOutEasing(200);\n }\n this._delta = 0;\n }\n var targetZoom = typeof this._targetZoom === \"number\" ? this._targetZoom : tr.zoom;\n var startZoom = this._startZoom;\n var easing = this._easing;\n var finished = false;\n var zoom;\n if (this._type === \"wheel\" && startZoom && easing) {\n var t = Math.min((performance2.browser.now() - this._lastWheelEventTime) / 200, 1);\n var k = easing(t);\n zoom = performance2.number(startZoom, targetZoom, k);\n if (t < 1) {\n if (!this._frameId) {\n this._frameId = true;\n }\n } else {\n finished = true;\n }\n } else {\n zoom = targetZoom;\n finished = true;\n }\n this._active = true;\n if (finished) {\n this._active = false;\n this._finishTimeout = setTimeout(function() {\n this$1._zooming = false;\n this$1._handler._triggerRenderFrame();\n delete this$1._targetZoom;\n delete this$1._finishTimeout;\n }, 200);\n }\n return {\n noInertia: true,\n needsRenderFrame: !finished,\n zoomDelta: zoom - tr.zoom,\n around: this._aroundPoint,\n originalEvent: this._lastWheelEvent\n };\n };\n ScrollZoomHandler.prototype._smoothOutEasing = function _smoothOutEasing(duration) {\n var easing = performance2.ease;\n if (this._prevEase) {\n var ease = this._prevEase, t = (performance2.browser.now() - ease.start) / ease.duration, speed = ease.easing(t + 0.01) - ease.easing(t), x = 0.27 / Math.sqrt(speed * speed + 1e-4) * 0.01, y = Math.sqrt(0.27 * 0.27 - x * x);\n easing = performance2.bezier(x, y, 0.25, 1);\n }\n this._prevEase = {\n start: performance2.browser.now(),\n duration,\n easing\n };\n return easing;\n };\n ScrollZoomHandler.prototype.reset = function reset() {\n this._active = false;\n };\n var DoubleClickZoomHandler = function DoubleClickZoomHandler2(clickZoom, TapZoom) {\n this._clickZoom = clickZoom;\n this._tapZoom = TapZoom;\n };\n DoubleClickZoomHandler.prototype.enable = function enable() {\n this._clickZoom.enable();\n this._tapZoom.enable();\n };\n DoubleClickZoomHandler.prototype.disable = function disable() {\n this._clickZoom.disable();\n this._tapZoom.disable();\n };\n DoubleClickZoomHandler.prototype.isEnabled = function isEnabled() {\n return this._clickZoom.isEnabled() && this._tapZoom.isEnabled();\n };\n DoubleClickZoomHandler.prototype.isActive = function isActive() {\n return this._clickZoom.isActive() || this._tapZoom.isActive();\n };\n var ClickZoomHandler = function ClickZoomHandler2() {\n this.reset();\n };\n ClickZoomHandler.prototype.reset = function reset() {\n this._active = false;\n };\n ClickZoomHandler.prototype.dblclick = function dblclick(e, point) {\n e.preventDefault();\n return {\n cameraAnimation: function(map) {\n map.easeTo({\n duration: 300,\n zoom: map.getZoom() + (e.shiftKey ? -1 : 1),\n around: map.unproject(point)\n }, { originalEvent: e });\n }\n };\n };\n ClickZoomHandler.prototype.enable = function enable() {\n this._enabled = true;\n };\n ClickZoomHandler.prototype.disable = function disable() {\n this._enabled = false;\n this.reset();\n };\n ClickZoomHandler.prototype.isEnabled = function isEnabled() {\n return this._enabled;\n };\n ClickZoomHandler.prototype.isActive = function isActive() {\n return this._active;\n };\n var TapDragZoomHandler = function TapDragZoomHandler2() {\n this._tap = new TapRecognizer({\n numTouches: 1,\n numTaps: 1\n });\n this.reset();\n };\n TapDragZoomHandler.prototype.reset = function reset() {\n this._active = false;\n delete this._swipePoint;\n delete this._swipeTouch;\n delete this._tapTime;\n this._tap.reset();\n };\n TapDragZoomHandler.prototype.touchstart = function touchstart(e, points, mapTouches) {\n if (this._swipePoint) {\n return;\n }\n if (this._tapTime && e.timeStamp - this._tapTime > MAX_TAP_INTERVAL) {\n this.reset();\n }\n if (!this._tapTime) {\n this._tap.touchstart(e, points, mapTouches);\n } else if (mapTouches.length > 0) {\n this._swipePoint = points[0];\n this._swipeTouch = mapTouches[0].identifier;\n }\n };\n TapDragZoomHandler.prototype.touchmove = function touchmove(e, points, mapTouches) {\n if (!this._tapTime) {\n this._tap.touchmove(e, points, mapTouches);\n } else if (this._swipePoint) {\n if (mapTouches[0].identifier !== this._swipeTouch) {\n return;\n }\n var newSwipePoint = points[0];\n var dist = newSwipePoint.y - this._swipePoint.y;\n this._swipePoint = newSwipePoint;\n e.preventDefault();\n this._active = true;\n return { zoomDelta: dist / 128 };\n }\n };\n TapDragZoomHandler.prototype.touchend = function touchend(e, points, mapTouches) {\n if (!this._tapTime) {\n var point = this._tap.touchend(e, points, mapTouches);\n if (point) {\n this._tapTime = e.timeStamp;\n }\n } else if (this._swipePoint) {\n if (mapTouches.length === 0) {\n this.reset();\n }\n }\n };\n TapDragZoomHandler.prototype.touchcancel = function touchcancel() {\n this.reset();\n };\n TapDragZoomHandler.prototype.enable = function enable() {\n this._enabled = true;\n };\n TapDragZoomHandler.prototype.disable = function disable() {\n this._enabled = false;\n this.reset();\n };\n TapDragZoomHandler.prototype.isEnabled = function isEnabled() {\n return this._enabled;\n };\n TapDragZoomHandler.prototype.isActive = function isActive() {\n return this._active;\n };\n var DragPanHandler = function DragPanHandler2(el, mousePan, touchPan) {\n this._el = el;\n this._mousePan = mousePan;\n this._touchPan = touchPan;\n };\n DragPanHandler.prototype.enable = function enable(options) {\n this._inertiaOptions = options || {};\n this._mousePan.enable();\n this._touchPan.enable();\n this._el.classList.add(\"mapboxgl-touch-drag-pan\");\n };\n DragPanHandler.prototype.disable = function disable() {\n this._mousePan.disable();\n this._touchPan.disable();\n this._el.classList.remove(\"mapboxgl-touch-drag-pan\");\n };\n DragPanHandler.prototype.isEnabled = function isEnabled() {\n return this._mousePan.isEnabled() && this._touchPan.isEnabled();\n };\n DragPanHandler.prototype.isActive = function isActive() {\n return this._mousePan.isActive() || this._touchPan.isActive();\n };\n var DragRotateHandler = function DragRotateHandler2(options, mouseRotate, mousePitch) {\n this._pitchWithRotate = options.pitchWithRotate;\n this._mouseRotate = mouseRotate;\n this._mousePitch = mousePitch;\n };\n DragRotateHandler.prototype.enable = function enable() {\n this._mouseRotate.enable();\n if (this._pitchWithRotate) {\n this._mousePitch.enable();\n }\n };\n DragRotateHandler.prototype.disable = function disable() {\n this._mouseRotate.disable();\n this._mousePitch.disable();\n };\n DragRotateHandler.prototype.isEnabled = function isEnabled() {\n return this._mouseRotate.isEnabled() && (!this._pitchWithRotate || this._mousePitch.isEnabled());\n };\n DragRotateHandler.prototype.isActive = function isActive() {\n return this._mouseRotate.isActive() || this._mousePitch.isActive();\n };\n var TouchZoomRotateHandler = function TouchZoomRotateHandler2(el, touchZoom, touchRotate, tapDragZoom) {\n this._el = el;\n this._touchZoom = touchZoom;\n this._touchRotate = touchRotate;\n this._tapDragZoom = tapDragZoom;\n this._rotationDisabled = false;\n this._enabled = true;\n };\n TouchZoomRotateHandler.prototype.enable = function enable(options) {\n this._touchZoom.enable(options);\n if (!this._rotationDisabled) {\n this._touchRotate.enable(options);\n }\n this._tapDragZoom.enable();\n this._el.classList.add(\"mapboxgl-touch-zoom-rotate\");\n };\n TouchZoomRotateHandler.prototype.disable = function disable() {\n this._touchZoom.disable();\n this._touchRotate.disable();\n this._tapDragZoom.disable();\n this._el.classList.remove(\"mapboxgl-touch-zoom-rotate\");\n };\n TouchZoomRotateHandler.prototype.isEnabled = function isEnabled() {\n return this._touchZoom.isEnabled() && (this._rotationDisabled || this._touchRotate.isEnabled()) && this._tapDragZoom.isEnabled();\n };\n TouchZoomRotateHandler.prototype.isActive = function isActive() {\n return this._touchZoom.isActive() || this._touchRotate.isActive() || this._tapDragZoom.isActive();\n };\n TouchZoomRotateHandler.prototype.disableRotation = function disableRotation() {\n this._rotationDisabled = true;\n this._touchRotate.disable();\n };\n TouchZoomRotateHandler.prototype.enableRotation = function enableRotation() {\n this._rotationDisabled = false;\n if (this._touchZoom.isEnabled()) {\n this._touchRotate.enable();\n }\n };\n var isMoving = function(p) {\n return p.zoom || p.drag || p.pitch || p.rotate;\n };\n var RenderFrameEvent = function(Event) {\n function RenderFrameEvent2() {\n Event.apply(this, arguments);\n }\n if (Event)\n RenderFrameEvent2.__proto__ = Event;\n RenderFrameEvent2.prototype = Object.create(Event && Event.prototype);\n RenderFrameEvent2.prototype.constructor = RenderFrameEvent2;\n return RenderFrameEvent2;\n }(performance2.Event);\n function hasChange(result) {\n return result.panDelta && result.panDelta.mag() || result.zoomDelta || result.bearingDelta || result.pitchDelta;\n }\n var HandlerManager = function HandlerManager2(map, options) {\n this._map = map;\n this._el = this._map.getCanvasContainer();\n this._handlers = [];\n this._handlersById = {};\n this._changes = [];\n this._inertia = new HandlerInertia(map);\n this._bearingSnap = options.bearingSnap;\n this._previousActiveHandlers = {};\n this._eventsInProgress = {};\n this._addDefaultHandlers(options);\n performance2.bindAll([\n \"handleEvent\",\n \"handleWindowEvent\"\n ], this);\n var el = this._el;\n this._listeners = [\n [\n el,\n \"touchstart\",\n { passive: true }\n ],\n [\n el,\n \"touchmove\",\n { passive: false }\n ],\n [\n el,\n \"touchend\",\n void 0\n ],\n [\n el,\n \"touchcancel\",\n void 0\n ],\n [\n el,\n \"mousedown\",\n void 0\n ],\n [\n el,\n \"mousemove\",\n void 0\n ],\n [\n el,\n \"mouseup\",\n void 0\n ],\n [\n performance2.window.document,\n \"mousemove\",\n { capture: true }\n ],\n [\n performance2.window.document,\n \"mouseup\",\n void 0\n ],\n [\n el,\n \"mouseover\",\n void 0\n ],\n [\n el,\n \"mouseout\",\n void 0\n ],\n [\n el,\n \"dblclick\",\n void 0\n ],\n [\n el,\n \"click\",\n void 0\n ],\n [\n el,\n \"keydown\",\n { capture: false }\n ],\n [\n el,\n \"keyup\",\n void 0\n ],\n [\n el,\n \"wheel\",\n { passive: false }\n ],\n [\n el,\n \"contextmenu\",\n void 0\n ],\n [\n performance2.window,\n \"blur\",\n void 0\n ]\n ];\n for (var i = 0, list = this._listeners; i < list.length; i += 1) {\n var ref = list[i];\n var target = ref[0];\n var type = ref[1];\n var listenerOptions = ref[2];\n DOM.addEventListener(target, type, target === performance2.window.document ? this.handleWindowEvent : this.handleEvent, listenerOptions);\n }\n };\n HandlerManager.prototype.destroy = function destroy() {\n for (var i = 0, list = this._listeners; i < list.length; i += 1) {\n var ref = list[i];\n var target = ref[0];\n var type = ref[1];\n var listenerOptions = ref[2];\n DOM.removeEventListener(target, type, target === performance2.window.document ? this.handleWindowEvent : this.handleEvent, listenerOptions);\n }\n };\n HandlerManager.prototype._addDefaultHandlers = function _addDefaultHandlers(options) {\n var map = this._map;\n var el = map.getCanvasContainer();\n this._add(\"mapEvent\", new MapEventHandler(map, options));\n var boxZoom = map.boxZoom = new BoxZoomHandler(map, options);\n this._add(\"boxZoom\", boxZoom);\n var tapZoom = new TapZoomHandler();\n var clickZoom = new ClickZoomHandler();\n map.doubleClickZoom = new DoubleClickZoomHandler(clickZoom, tapZoom);\n this._add(\"tapZoom\", tapZoom);\n this._add(\"clickZoom\", clickZoom);\n var tapDragZoom = new TapDragZoomHandler();\n this._add(\"tapDragZoom\", tapDragZoom);\n var touchPitch = map.touchPitch = new TouchPitchHandler();\n this._add(\"touchPitch\", touchPitch);\n var mouseRotate = new MouseRotateHandler(options);\n var mousePitch = new MousePitchHandler(options);\n map.dragRotate = new DragRotateHandler(options, mouseRotate, mousePitch);\n this._add(\"mouseRotate\", mouseRotate, [\"mousePitch\"]);\n this._add(\"mousePitch\", mousePitch, [\"mouseRotate\"]);\n var mousePan = new MousePanHandler(options);\n var touchPan = new TouchPanHandler(options);\n map.dragPan = new DragPanHandler(el, mousePan, touchPan);\n this._add(\"mousePan\", mousePan);\n this._add(\"touchPan\", touchPan, [\n \"touchZoom\",\n \"touchRotate\"\n ]);\n var touchRotate = new TouchRotateHandler();\n var touchZoom = new TouchZoomHandler();\n map.touchZoomRotate = new TouchZoomRotateHandler(el, touchZoom, touchRotate, tapDragZoom);\n this._add(\"touchRotate\", touchRotate, [\n \"touchPan\",\n \"touchZoom\"\n ]);\n this._add(\"touchZoom\", touchZoom, [\n \"touchPan\",\n \"touchRotate\"\n ]);\n var scrollZoom = map.scrollZoom = new ScrollZoomHandler(map, this);\n this._add(\"scrollZoom\", scrollZoom, [\"mousePan\"]);\n var keyboard = map.keyboard = new KeyboardHandler();\n this._add(\"keyboard\", keyboard);\n this._add(\"blockableMapEvent\", new BlockableMapEventHandler(map));\n for (var i = 0, list = [\n \"boxZoom\",\n \"doubleClickZoom\",\n \"tapDragZoom\",\n \"touchPitch\",\n \"dragRotate\",\n \"dragPan\",\n \"touchZoomRotate\",\n \"scrollZoom\",\n \"keyboard\"\n ]; i < list.length; i += 1) {\n var name2 = list[i];\n if (options.interactive && options[name2]) {\n map[name2].enable(options[name2]);\n }\n }\n };\n HandlerManager.prototype._add = function _add(handlerName, handler, allowed) {\n this._handlers.push({\n handlerName,\n handler,\n allowed\n });\n this._handlersById[handlerName] = handler;\n };\n HandlerManager.prototype.stop = function stop(allowEndAnimation) {\n if (this._updatingCamera) {\n return;\n }\n for (var i = 0, list = this._handlers; i < list.length; i += 1) {\n var ref = list[i];\n var handler = ref.handler;\n handler.reset();\n }\n this._inertia.clear();\n this._fireEvents({}, {}, allowEndAnimation);\n this._changes = [];\n };\n HandlerManager.prototype.isActive = function isActive() {\n for (var i = 0, list = this._handlers; i < list.length; i += 1) {\n var ref = list[i];\n var handler = ref.handler;\n if (handler.isActive()) {\n return true;\n }\n }\n return false;\n };\n HandlerManager.prototype.isZooming = function isZooming() {\n return !!this._eventsInProgress.zoom || this._map.scrollZoom.isZooming();\n };\n HandlerManager.prototype.isRotating = function isRotating() {\n return !!this._eventsInProgress.rotate;\n };\n HandlerManager.prototype.isMoving = function isMoving$1() {\n return Boolean(isMoving(this._eventsInProgress)) || this.isZooming();\n };\n HandlerManager.prototype._blockedByActive = function _blockedByActive(activeHandlers, allowed, myName) {\n for (var name2 in activeHandlers) {\n if (name2 === myName) {\n continue;\n }\n if (!allowed || allowed.indexOf(name2) < 0) {\n return true;\n }\n }\n return false;\n };\n HandlerManager.prototype.handleWindowEvent = function handleWindowEvent(e) {\n this.handleEvent(e, e.type + \"Window\");\n };\n HandlerManager.prototype._getMapTouches = function _getMapTouches(touches) {\n var mapTouches = [];\n for (var i = 0, list = touches; i < list.length; i += 1) {\n var t = list[i];\n var target = t.target;\n if (this._el.contains(target)) {\n mapTouches.push(t);\n }\n }\n return mapTouches;\n };\n HandlerManager.prototype.handleEvent = function handleEvent(e, eventName) {\n if (e.type === \"blur\") {\n this.stop(true);\n return;\n }\n this._updatingCamera = true;\n var inputEvent = e.type === \"renderFrame\" ? void 0 : e;\n var mergedHandlerResult = { needsRenderFrame: false };\n var eventsInProgress = {};\n var activeHandlers = {};\n var mapTouches = e.touches ? this._getMapTouches(e.touches) : void 0;\n var points = mapTouches ? DOM.touchPos(this._el, mapTouches) : DOM.mousePos(this._el, e);\n for (var i = 0, list = this._handlers; i < list.length; i += 1) {\n var ref = list[i];\n var handlerName = ref.handlerName;\n var handler = ref.handler;\n var allowed = ref.allowed;\n if (!handler.isEnabled()) {\n continue;\n }\n var data = void 0;\n if (this._blockedByActive(activeHandlers, allowed, handlerName)) {\n handler.reset();\n } else {\n if (handler[eventName || e.type]) {\n data = handler[eventName || e.type](e, points, mapTouches);\n this.mergeHandlerResult(mergedHandlerResult, eventsInProgress, data, handlerName, inputEvent);\n if (data && data.needsRenderFrame) {\n this._triggerRenderFrame();\n }\n }\n }\n if (data || handler.isActive()) {\n activeHandlers[handlerName] = handler;\n }\n }\n var deactivatedHandlers = {};\n for (var name2 in this._previousActiveHandlers) {\n if (!activeHandlers[name2]) {\n deactivatedHandlers[name2] = inputEvent;\n }\n }\n this._previousActiveHandlers = activeHandlers;\n if (Object.keys(deactivatedHandlers).length || hasChange(mergedHandlerResult)) {\n this._changes.push([\n mergedHandlerResult,\n eventsInProgress,\n deactivatedHandlers\n ]);\n this._triggerRenderFrame();\n }\n if (Object.keys(activeHandlers).length || hasChange(mergedHandlerResult)) {\n this._map._stop(true);\n }\n this._updatingCamera = false;\n var cameraAnimation = mergedHandlerResult.cameraAnimation;\n if (cameraAnimation) {\n this._inertia.clear();\n this._fireEvents({}, {}, true);\n this._changes = [];\n cameraAnimation(this._map);\n }\n };\n HandlerManager.prototype.mergeHandlerResult = function mergeHandlerResult(mergedHandlerResult, eventsInProgress, handlerResult, name2, e) {\n if (!handlerResult) {\n return;\n }\n performance2.extend(mergedHandlerResult, handlerResult);\n var eventData = {\n handlerName: name2,\n originalEvent: handlerResult.originalEvent || e\n };\n if (handlerResult.zoomDelta !== void 0) {\n eventsInProgress.zoom = eventData;\n }\n if (handlerResult.panDelta !== void 0) {\n eventsInProgress.drag = eventData;\n }\n if (handlerResult.pitchDelta !== void 0) {\n eventsInProgress.pitch = eventData;\n }\n if (handlerResult.bearingDelta !== void 0) {\n eventsInProgress.rotate = eventData;\n }\n };\n HandlerManager.prototype._applyChanges = function _applyChanges() {\n var combined = {};\n var combinedEventsInProgress = {};\n var combinedDeactivatedHandlers = {};\n for (var i = 0, list = this._changes; i < list.length; i += 1) {\n var ref = list[i];\n var change = ref[0];\n var eventsInProgress = ref[1];\n var deactivatedHandlers = ref[2];\n if (change.panDelta) {\n combined.panDelta = (combined.panDelta || new performance2.Point(0, 0))._add(change.panDelta);\n }\n if (change.zoomDelta) {\n combined.zoomDelta = (combined.zoomDelta || 0) + change.zoomDelta;\n }\n if (change.bearingDelta) {\n combined.bearingDelta = (combined.bearingDelta || 0) + change.bearingDelta;\n }\n if (change.pitchDelta) {\n combined.pitchDelta = (combined.pitchDelta || 0) + change.pitchDelta;\n }\n if (change.around !== void 0) {\n combined.around = change.around;\n }\n if (change.pinchAround !== void 0) {\n combined.pinchAround = change.pinchAround;\n }\n if (change.noInertia) {\n combined.noInertia = change.noInertia;\n }\n performance2.extend(combinedEventsInProgress, eventsInProgress);\n performance2.extend(combinedDeactivatedHandlers, deactivatedHandlers);\n }\n this._updateMapTransform(combined, combinedEventsInProgress, combinedDeactivatedHandlers);\n this._changes = [];\n };\n HandlerManager.prototype._updateMapTransform = function _updateMapTransform(combinedResult, combinedEventsInProgress, deactivatedHandlers) {\n var map = this._map;\n var tr = map.transform;\n if (!hasChange(combinedResult)) {\n return this._fireEvents(combinedEventsInProgress, deactivatedHandlers, true);\n }\n var panDelta = combinedResult.panDelta;\n var zoomDelta = combinedResult.zoomDelta;\n var bearingDelta = combinedResult.bearingDelta;\n var pitchDelta = combinedResult.pitchDelta;\n var around = combinedResult.around;\n var pinchAround = combinedResult.pinchAround;\n if (pinchAround !== void 0) {\n around = pinchAround;\n }\n map._stop(true);\n around = around || map.transform.centerPoint;\n var loc = tr.pointLocation(panDelta ? around.sub(panDelta) : around);\n if (bearingDelta) {\n tr.bearing += bearingDelta;\n }\n if (pitchDelta) {\n tr.pitch += pitchDelta;\n }\n if (zoomDelta) {\n tr.zoom += zoomDelta;\n }\n tr.setLocationAtPoint(loc, around);\n this._map._update();\n if (!combinedResult.noInertia) {\n this._inertia.record(combinedResult);\n }\n this._fireEvents(combinedEventsInProgress, deactivatedHandlers, true);\n };\n HandlerManager.prototype._fireEvents = function _fireEvents(newEventsInProgress, deactivatedHandlers, allowEndAnimation) {\n var this$1 = this;\n var wasMoving = isMoving(this._eventsInProgress);\n var nowMoving = isMoving(newEventsInProgress);\n var startEvents = {};\n for (var eventName in newEventsInProgress) {\n var ref = newEventsInProgress[eventName];\n var originalEvent = ref.originalEvent;\n if (!this._eventsInProgress[eventName]) {\n startEvents[eventName + \"start\"] = originalEvent;\n }\n this._eventsInProgress[eventName] = newEventsInProgress[eventName];\n }\n if (!wasMoving && nowMoving) {\n this._fireEvent(\"movestart\", nowMoving.originalEvent);\n }\n for (var name2 in startEvents) {\n this._fireEvent(name2, startEvents[name2]);\n }\n if (nowMoving) {\n this._fireEvent(\"move\", nowMoving.originalEvent);\n }\n for (var eventName$1 in newEventsInProgress) {\n var ref$1 = newEventsInProgress[eventName$1];\n var originalEvent$1 = ref$1.originalEvent;\n this._fireEvent(eventName$1, originalEvent$1);\n }\n var endEvents = {};\n var originalEndEvent;\n for (var eventName$2 in this._eventsInProgress) {\n var ref$2 = this._eventsInProgress[eventName$2];\n var handlerName = ref$2.handlerName;\n var originalEvent$2 = ref$2.originalEvent;\n if (!this._handlersById[handlerName].isActive()) {\n delete this._eventsInProgress[eventName$2];\n originalEndEvent = deactivatedHandlers[handlerName] || originalEvent$2;\n endEvents[eventName$2 + \"end\"] = originalEndEvent;\n }\n }\n for (var name$1 in endEvents) {\n this._fireEvent(name$1, endEvents[name$1]);\n }\n var stillMoving = isMoving(this._eventsInProgress);\n if (allowEndAnimation && (wasMoving || nowMoving) && !stillMoving) {\n this._updatingCamera = true;\n var inertialEase = this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions);\n var shouldSnapToNorth = function(bearing) {\n return bearing !== 0 && -this$1._bearingSnap < bearing && bearing < this$1._bearingSnap;\n };\n if (inertialEase) {\n if (shouldSnapToNorth(inertialEase.bearing || this._map.getBearing())) {\n inertialEase.bearing = 0;\n }\n this._map.easeTo(inertialEase, { originalEvent: originalEndEvent });\n } else {\n this._map.fire(new performance2.Event(\"moveend\", { originalEvent: originalEndEvent }));\n if (shouldSnapToNorth(this._map.getBearing())) {\n this._map.resetNorth();\n }\n }\n this._updatingCamera = false;\n }\n };\n HandlerManager.prototype._fireEvent = function _fireEvent(type, e) {\n this._map.fire(new performance2.Event(type, e ? { originalEvent: e } : {}));\n };\n HandlerManager.prototype._requestFrame = function _requestFrame() {\n var this$1 = this;\n this._map.triggerRepaint();\n return this._map._renderTaskQueue.add(function(timeStamp) {\n delete this$1._frameId;\n this$1.handleEvent(new RenderFrameEvent(\"renderFrame\", { timeStamp }));\n this$1._applyChanges();\n });\n };\n HandlerManager.prototype._triggerRenderFrame = function _triggerRenderFrame() {\n if (this._frameId === void 0) {\n this._frameId = this._requestFrame();\n }\n };\n var Camera = function(Evented) {\n function Camera2(transform, options) {\n Evented.call(this);\n this._moving = false;\n this._zooming = false;\n this.transform = transform;\n this._bearingSnap = options.bearingSnap;\n performance2.bindAll([\"_renderFrameCallback\"], this);\n }\n if (Evented)\n Camera2.__proto__ = Evented;\n Camera2.prototype = Object.create(Evented && Evented.prototype);\n Camera2.prototype.constructor = Camera2;\n Camera2.prototype.getCenter = function getCenter() {\n return new performance2.LngLat(this.transform.center.lng, this.transform.center.lat);\n };\n Camera2.prototype.setCenter = function setCenter(center, eventData) {\n return this.jumpTo({ center }, eventData);\n };\n Camera2.prototype.panBy = function panBy(offset, options, eventData) {\n offset = performance2.Point.convert(offset).mult(-1);\n return this.panTo(this.transform.center, performance2.extend({ offset }, options), eventData);\n };\n Camera2.prototype.panTo = function panTo(lnglat, options, eventData) {\n return this.easeTo(performance2.extend({ center: lnglat }, options), eventData);\n };\n Camera2.prototype.getZoom = function getZoom() {\n return this.transform.zoom;\n };\n Camera2.prototype.setZoom = function setZoom(zoom, eventData) {\n this.jumpTo({ zoom }, eventData);\n return this;\n };\n Camera2.prototype.zoomTo = function zoomTo(zoom, options, eventData) {\n return this.easeTo(performance2.extend({ zoom }, options), eventData);\n };\n Camera2.prototype.zoomIn = function zoomIn(options, eventData) {\n this.zoomTo(this.getZoom() + 1, options, eventData);\n return this;\n };\n Camera2.prototype.zoomOut = function zoomOut(options, eventData) {\n this.zoomTo(this.getZoom() - 1, options, eventData);\n return this;\n };\n Camera2.prototype.getBearing = function getBearing() {\n return this.transform.bearing;\n };\n Camera2.prototype.setBearing = function setBearing(bearing, eventData) {\n this.jumpTo({ bearing }, eventData);\n return this;\n };\n Camera2.prototype.getPadding = function getPadding() {\n return this.transform.padding;\n };\n Camera2.prototype.setPadding = function setPadding(padding2, eventData) {\n this.jumpTo({ padding: padding2 }, eventData);\n return this;\n };\n Camera2.prototype.rotateTo = function rotateTo(bearing, options, eventData) {\n return this.easeTo(performance2.extend({ bearing }, options), eventData);\n };\n Camera2.prototype.resetNorth = function resetNorth(options, eventData) {\n this.rotateTo(0, performance2.extend({ duration: 1e3 }, options), eventData);\n return this;\n };\n Camera2.prototype.resetNorthPitch = function resetNorthPitch(options, eventData) {\n this.easeTo(performance2.extend({\n bearing: 0,\n pitch: 0,\n duration: 1e3\n }, options), eventData);\n return this;\n };\n Camera2.prototype.snapToNorth = function snapToNorth(options, eventData) {\n if (Math.abs(this.getBearing()) < this._bearingSnap) {\n return this.resetNorth(options, eventData);\n }\n return this;\n };\n Camera2.prototype.getPitch = function getPitch() {\n return this.transform.pitch;\n };\n Camera2.prototype.setPitch = function setPitch(pitch, eventData) {\n this.jumpTo({ pitch }, eventData);\n return this;\n };\n Camera2.prototype.cameraForBounds = function cameraForBounds(bounds, options) {\n bounds = performance2.LngLatBounds.convert(bounds);\n var bearing = options && options.bearing || 0;\n return this._cameraForBoxAndBearing(bounds.getNorthWest(), bounds.getSouthEast(), bearing, options);\n };\n Camera2.prototype._cameraForBoxAndBearing = function _cameraForBoxAndBearing(p0, p1, bearing, options) {\n var defaultPadding = {\n top: 0,\n bottom: 0,\n right: 0,\n left: 0\n };\n options = performance2.extend({\n padding: defaultPadding,\n offset: [\n 0,\n 0\n ],\n maxZoom: this.transform.maxZoom\n }, options);\n if (typeof options.padding === \"number\") {\n var p = options.padding;\n options.padding = {\n top: p,\n bottom: p,\n right: p,\n left: p\n };\n }\n options.padding = performance2.extend(defaultPadding, options.padding);\n var tr = this.transform;\n var edgePadding = tr.padding;\n var p0world = tr.project(performance2.LngLat.convert(p0));\n var p1world = tr.project(performance2.LngLat.convert(p1));\n var p0rotated = p0world.rotate(-bearing * Math.PI / 180);\n var p1rotated = p1world.rotate(-bearing * Math.PI / 180);\n var upperRight = new performance2.Point(Math.max(p0rotated.x, p1rotated.x), Math.max(p0rotated.y, p1rotated.y));\n var lowerLeft = new performance2.Point(Math.min(p0rotated.x, p1rotated.x), Math.min(p0rotated.y, p1rotated.y));\n var size = upperRight.sub(lowerLeft);\n var scaleX = (tr.width - (edgePadding.left + edgePadding.right + options.padding.left + options.padding.right)) / size.x;\n var scaleY = (tr.height - (edgePadding.top + edgePadding.bottom + options.padding.top + options.padding.bottom)) / size.y;\n if (scaleY < 0 || scaleX < 0) {\n performance2.warnOnce(\"Map cannot fit within canvas with the given bounds, padding, and/or offset.\");\n return;\n }\n var zoom = Math.min(tr.scaleZoom(tr.scale * Math.min(scaleX, scaleY)), options.maxZoom);\n var offset = typeof options.offset.x === \"number\" ? new performance2.Point(options.offset.x, options.offset.y) : performance2.Point.convert(options.offset);\n var paddingOffsetX = (options.padding.left - options.padding.right) / 2;\n var paddingOffsetY = (options.padding.top - options.padding.bottom) / 2;\n var paddingOffset = new performance2.Point(paddingOffsetX, paddingOffsetY);\n var rotatedPaddingOffset = paddingOffset.rotate(bearing * Math.PI / 180);\n var offsetAtInitialZoom = offset.add(rotatedPaddingOffset);\n var offsetAtFinalZoom = offsetAtInitialZoom.mult(tr.scale / tr.zoomScale(zoom));\n var center = tr.unproject(p0world.add(p1world).div(2).sub(offsetAtFinalZoom));\n return {\n center,\n zoom,\n bearing\n };\n };\n Camera2.prototype.fitBounds = function fitBounds(bounds, options, eventData) {\n return this._fitInternal(this.cameraForBounds(bounds, options), options, eventData);\n };\n Camera2.prototype.fitScreenCoordinates = function fitScreenCoordinates(p0, p1, bearing, options, eventData) {\n return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(performance2.Point.convert(p0)), this.transform.pointLocation(performance2.Point.convert(p1)), bearing, options), options, eventData);\n };\n Camera2.prototype._fitInternal = function _fitInternal(calculatedOptions, options, eventData) {\n if (!calculatedOptions) {\n return this;\n }\n options = performance2.extend(calculatedOptions, options);\n delete options.padding;\n return options.linear ? this.easeTo(options, eventData) : this.flyTo(options, eventData);\n };\n Camera2.prototype.jumpTo = function jumpTo(options, eventData) {\n this.stop();\n var tr = this.transform;\n var zoomChanged = false, bearingChanged = false, pitchChanged = false;\n if (\"zoom\" in options && tr.zoom !== +options.zoom) {\n zoomChanged = true;\n tr.zoom = +options.zoom;\n }\n if (options.center !== void 0) {\n tr.center = performance2.LngLat.convert(options.center);\n }\n if (\"bearing\" in options && tr.bearing !== +options.bearing) {\n bearingChanged = true;\n tr.bearing = +options.bearing;\n }\n if (\"pitch\" in options && tr.pitch !== +options.pitch) {\n pitchChanged = true;\n tr.pitch = +options.pitch;\n }\n if (options.padding != null && !tr.isPaddingEqual(options.padding)) {\n tr.padding = options.padding;\n }\n this.fire(new performance2.Event(\"movestart\", eventData)).fire(new performance2.Event(\"move\", eventData));\n if (zoomChanged) {\n this.fire(new performance2.Event(\"zoomstart\", eventData)).fire(new performance2.Event(\"zoom\", eventData)).fire(new performance2.Event(\"zoomend\", eventData));\n }\n if (bearingChanged) {\n this.fire(new performance2.Event(\"rotatestart\", eventData)).fire(new performance2.Event(\"rotate\", eventData)).fire(new performance2.Event(\"rotateend\", eventData));\n }\n if (pitchChanged) {\n this.fire(new performance2.Event(\"pitchstart\", eventData)).fire(new performance2.Event(\"pitch\", eventData)).fire(new performance2.Event(\"pitchend\", eventData));\n }\n return this.fire(new performance2.Event(\"moveend\", eventData));\n };\n Camera2.prototype.easeTo = function easeTo(options, eventData) {\n var this$1 = this;\n this._stop(false, options.easeId);\n options = performance2.extend({\n offset: [\n 0,\n 0\n ],\n duration: 500,\n easing: performance2.ease\n }, options);\n if (options.animate === false || !options.essential && performance2.browser.prefersReducedMotion) {\n options.duration = 0;\n }\n var tr = this.transform, startZoom = this.getZoom(), startBearing = this.getBearing(), startPitch = this.getPitch(), startPadding = this.getPadding(), zoom = \"zoom\" in options ? +options.zoom : startZoom, bearing = \"bearing\" in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing, pitch = \"pitch\" in options ? +options.pitch : startPitch, padding2 = \"padding\" in options ? options.padding : tr.padding;\n var offsetAsPoint = performance2.Point.convert(options.offset);\n var pointAtOffset = tr.centerPoint.add(offsetAsPoint);\n var locationAtOffset = tr.pointLocation(pointAtOffset);\n var center = performance2.LngLat.convert(options.center || locationAtOffset);\n this._normalizeCenter(center);\n var from = tr.project(locationAtOffset);\n var delta = tr.project(center).sub(from);\n var finalScale = tr.zoomScale(zoom - startZoom);\n var around, aroundPoint;\n if (options.around) {\n around = performance2.LngLat.convert(options.around);\n aroundPoint = tr.locationPoint(around);\n }\n var currently = {\n moving: this._moving,\n zooming: this._zooming,\n rotating: this._rotating,\n pitching: this._pitching\n };\n this._zooming = this._zooming || zoom !== startZoom;\n this._rotating = this._rotating || startBearing !== bearing;\n this._pitching = this._pitching || pitch !== startPitch;\n this._padding = !tr.isPaddingEqual(padding2);\n this._easeId = options.easeId;\n this._prepareEase(eventData, options.noMoveStart, currently);\n this._ease(function(k) {\n if (this$1._zooming) {\n tr.zoom = performance2.number(startZoom, zoom, k);\n }\n if (this$1._rotating) {\n tr.bearing = performance2.number(startBearing, bearing, k);\n }\n if (this$1._pitching) {\n tr.pitch = performance2.number(startPitch, pitch, k);\n }\n if (this$1._padding) {\n tr.interpolatePadding(startPadding, padding2, k);\n pointAtOffset = tr.centerPoint.add(offsetAsPoint);\n }\n if (around) {\n tr.setLocationAtPoint(around, aroundPoint);\n } else {\n var scale = tr.zoomScale(tr.zoom - startZoom);\n var base = zoom > startZoom ? Math.min(2, finalScale) : Math.max(0.5, finalScale);\n var speedup = Math.pow(base, 1 - k);\n var newCenter = tr.unproject(from.add(delta.mult(k * speedup)).mult(scale));\n tr.setLocationAtPoint(tr.renderWorldCopies ? newCenter.wrap() : newCenter, pointAtOffset);\n }\n this$1._fireMoveEvents(eventData);\n }, function(interruptingEaseId) {\n this$1._afterEase(eventData, interruptingEaseId);\n }, options);\n return this;\n };\n Camera2.prototype._prepareEase = function _prepareEase(eventData, noMoveStart, currently) {\n if (currently === void 0)\n currently = {};\n this._moving = true;\n if (!noMoveStart && !currently.moving) {\n this.fire(new performance2.Event(\"movestart\", eventData));\n }\n if (this._zooming && !currently.zooming) {\n this.fire(new performance2.Event(\"zoomstart\", eventData));\n }\n if (this._rotating && !currently.rotating) {\n this.fire(new performance2.Event(\"rotatestart\", eventData));\n }\n if (this._pitching && !currently.pitching) {\n this.fire(new performance2.Event(\"pitchstart\", eventData));\n }\n };\n Camera2.prototype._fireMoveEvents = function _fireMoveEvents(eventData) {\n this.fire(new performance2.Event(\"move\", eventData));\n if (this._zooming) {\n this.fire(new performance2.Event(\"zoom\", eventData));\n }\n if (this._rotating) {\n this.fire(new performance2.Event(\"rotate\", eventData));\n }\n if (this._pitching) {\n this.fire(new performance2.Event(\"pitch\", eventData));\n }\n };\n Camera2.prototype._afterEase = function _afterEase(eventData, easeId) {\n if (this._easeId && easeId && this._easeId === easeId) {\n return;\n }\n delete this._easeId;\n var wasZooming = this._zooming;\n var wasRotating = this._rotating;\n var wasPitching = this._pitching;\n this._moving = false;\n this._zooming = false;\n this._rotating = false;\n this._pitching = false;\n this._padding = false;\n if (wasZooming) {\n this.fire(new performance2.Event(\"zoomend\", eventData));\n }\n if (wasRotating) {\n this.fire(new performance2.Event(\"rotateend\", eventData));\n }\n if (wasPitching) {\n this.fire(new performance2.Event(\"pitchend\", eventData));\n }\n this.fire(new performance2.Event(\"moveend\", eventData));\n };\n Camera2.prototype.flyTo = function flyTo(options, eventData) {\n var this$1 = this;\n if (!options.essential && performance2.browser.prefersReducedMotion) {\n var coercedOptions = performance2.pick(options, [\n \"center\",\n \"zoom\",\n \"bearing\",\n \"pitch\",\n \"around\"\n ]);\n return this.jumpTo(coercedOptions, eventData);\n }\n this.stop();\n options = performance2.extend({\n offset: [\n 0,\n 0\n ],\n speed: 1.2,\n curve: 1.42,\n easing: performance2.ease\n }, options);\n var tr = this.transform, startZoom = this.getZoom(), startBearing = this.getBearing(), startPitch = this.getPitch(), startPadding = this.getPadding();\n var zoom = \"zoom\" in options ? performance2.clamp(+options.zoom, tr.minZoom, tr.maxZoom) : startZoom;\n var bearing = \"bearing\" in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing;\n var pitch = \"pitch\" in options ? +options.pitch : startPitch;\n var padding2 = \"padding\" in options ? options.padding : tr.padding;\n var scale = tr.zoomScale(zoom - startZoom);\n var offsetAsPoint = performance2.Point.convert(options.offset);\n var pointAtOffset = tr.centerPoint.add(offsetAsPoint);\n var locationAtOffset = tr.pointLocation(pointAtOffset);\n var center = performance2.LngLat.convert(options.center || locationAtOffset);\n this._normalizeCenter(center);\n var from = tr.project(locationAtOffset);\n var delta = tr.project(center).sub(from);\n var rho = options.curve;\n var w0 = Math.max(tr.width, tr.height), w1 = w0 / scale, u1 = delta.mag();\n if (\"minZoom\" in options) {\n var minZoom = performance2.clamp(Math.min(options.minZoom, startZoom, zoom), tr.minZoom, tr.maxZoom);\n var wMax = w0 / tr.zoomScale(minZoom - startZoom);\n rho = Math.sqrt(wMax / u1 * 2);\n }\n var rho2 = rho * rho;\n function r(i) {\n var b = (w1 * w1 - w0 * w0 + (i ? -1 : 1) * rho2 * rho2 * u1 * u1) / (2 * (i ? w1 : w0) * rho2 * u1);\n return Math.log(Math.sqrt(b * b + 1) - b);\n }\n function sinh2(n) {\n return (Math.exp(n) - Math.exp(-n)) / 2;\n }\n function cosh2(n) {\n return (Math.exp(n) + Math.exp(-n)) / 2;\n }\n function tanh2(n) {\n return sinh2(n) / cosh2(n);\n }\n var r0 = r(0);\n var w = function(s) {\n return cosh2(r0) / cosh2(r0 + rho * s);\n };\n var u = function(s) {\n return w0 * ((cosh2(r0) * tanh2(r0 + rho * s) - sinh2(r0)) / rho2) / u1;\n };\n var S = (r(1) - r0) / rho;\n if (Math.abs(u1) < 1e-6 || !isFinite(S)) {\n if (Math.abs(w0 - w1) < 1e-6) {\n return this.easeTo(options, eventData);\n }\n var k = w1 < w0 ? -1 : 1;\n S = Math.abs(Math.log(w1 / w0)) / rho;\n u = function() {\n return 0;\n };\n w = function(s) {\n return Math.exp(k * rho * s);\n };\n }\n if (\"duration\" in options) {\n options.duration = +options.duration;\n } else {\n var V = \"screenSpeed\" in options ? +options.screenSpeed / rho : +options.speed;\n options.duration = 1e3 * S / V;\n }\n if (options.maxDuration && options.duration > options.maxDuration) {\n options.duration = 0;\n }\n this._zooming = true;\n this._rotating = startBearing !== bearing;\n this._pitching = pitch !== startPitch;\n this._padding = !tr.isPaddingEqual(padding2);\n this._prepareEase(eventData, false);\n this._ease(function(k2) {\n var s = k2 * S;\n var scale2 = 1 / w(s);\n tr.zoom = k2 === 1 ? zoom : startZoom + tr.scaleZoom(scale2);\n if (this$1._rotating) {\n tr.bearing = performance2.number(startBearing, bearing, k2);\n }\n if (this$1._pitching) {\n tr.pitch = performance2.number(startPitch, pitch, k2);\n }\n if (this$1._padding) {\n tr.interpolatePadding(startPadding, padding2, k2);\n pointAtOffset = tr.centerPoint.add(offsetAsPoint);\n }\n var newCenter = k2 === 1 ? center : tr.unproject(from.add(delta.mult(u(s))).mult(scale2));\n tr.setLocationAtPoint(tr.renderWorldCopies ? newCenter.wrap() : newCenter, pointAtOffset);\n this$1._fireMoveEvents(eventData);\n }, function() {\n return this$1._afterEase(eventData);\n }, options);\n return this;\n };\n Camera2.prototype.isEasing = function isEasing() {\n return !!this._easeFrameId;\n };\n Camera2.prototype.stop = function stop() {\n return this._stop();\n };\n Camera2.prototype._stop = function _stop(allowGestures, easeId) {\n if (this._easeFrameId) {\n this._cancelRenderFrame(this._easeFrameId);\n delete this._easeFrameId;\n delete this._onEaseFrame;\n }\n if (this._onEaseEnd) {\n var onEaseEnd = this._onEaseEnd;\n delete this._onEaseEnd;\n onEaseEnd.call(this, easeId);\n }\n if (!allowGestures) {\n var handlers = this.handlers;\n if (handlers) {\n handlers.stop(false);\n }\n }\n return this;\n };\n Camera2.prototype._ease = function _ease(frame, finish, options) {\n if (options.animate === false || options.duration === 0) {\n frame(1);\n finish();\n } else {\n this._easeStart = performance2.browser.now();\n this._easeOptions = options;\n this._onEaseFrame = frame;\n this._onEaseEnd = finish;\n this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback);\n }\n };\n Camera2.prototype._renderFrameCallback = function _renderFrameCallback() {\n var t = Math.min((performance2.browser.now() - this._easeStart) / this._easeOptions.duration, 1);\n this._onEaseFrame(this._easeOptions.easing(t));\n if (t < 1) {\n this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback);\n } else {\n this.stop();\n }\n };\n Camera2.prototype._normalizeBearing = function _normalizeBearing(bearing, currentBearing) {\n bearing = performance2.wrap(bearing, -180, 180);\n var diff = Math.abs(bearing - currentBearing);\n if (Math.abs(bearing - 360 - currentBearing) < diff) {\n bearing -= 360;\n }\n if (Math.abs(bearing + 360 - currentBearing) < diff) {\n bearing += 360;\n }\n return bearing;\n };\n Camera2.prototype._normalizeCenter = function _normalizeCenter(center) {\n var tr = this.transform;\n if (!tr.renderWorldCopies || tr.lngRange) {\n return;\n }\n var delta = center.lng - tr.center.lng;\n center.lng += delta > 180 ? -360 : delta < -180 ? 360 : 0;\n };\n return Camera2;\n }(performance2.Evented);\n var AttributionControl = function AttributionControl2(options) {\n if (options === void 0)\n options = {};\n this.options = options;\n performance2.bindAll([\n \"_toggleAttribution\",\n \"_updateEditLink\",\n \"_updateData\",\n \"_updateCompact\"\n ], this);\n };\n AttributionControl.prototype.getDefaultPosition = function getDefaultPosition() {\n return \"bottom-right\";\n };\n AttributionControl.prototype.onAdd = function onAdd(map) {\n var compact = this.options && this.options.compact;\n this._map = map;\n this._container = DOM.create(\"div\", \"mapboxgl-ctrl mapboxgl-ctrl-attrib\");\n this._compactButton = DOM.create(\"button\", \"mapboxgl-ctrl-attrib-button\", this._container);\n this._compactButton.addEventListener(\"click\", this._toggleAttribution);\n this._setElementTitle(this._compactButton, \"ToggleAttribution\");\n this._innerContainer = DOM.create(\"div\", \"mapboxgl-ctrl-attrib-inner\", this._container);\n this._innerContainer.setAttribute(\"role\", \"list\");\n if (compact) {\n this._container.classList.add(\"mapboxgl-compact\");\n }\n this._updateAttributions();\n this._updateEditLink();\n this._map.on(\"styledata\", this._updateData);\n this._map.on(\"sourcedata\", this._updateData);\n this._map.on(\"moveend\", this._updateEditLink);\n if (compact === void 0) {\n this._map.on(\"resize\", this._updateCompact);\n this._updateCompact();\n }\n return this._container;\n };\n AttributionControl.prototype.onRemove = function onRemove() {\n DOM.remove(this._container);\n this._map.off(\"styledata\", this._updateData);\n this._map.off(\"sourcedata\", this._updateData);\n this._map.off(\"moveend\", this._updateEditLink);\n this._map.off(\"resize\", this._updateCompact);\n this._map = void 0;\n this._attribHTML = void 0;\n };\n AttributionControl.prototype._setElementTitle = function _setElementTitle(element, title) {\n var str = this._map._getUIString(\"AttributionControl.\" + title);\n element.title = str;\n element.setAttribute(\"aria-label\", str);\n };\n AttributionControl.prototype._toggleAttribution = function _toggleAttribution() {\n if (this._container.classList.contains(\"mapboxgl-compact-show\")) {\n this._container.classList.remove(\"mapboxgl-compact-show\");\n this._compactButton.setAttribute(\"aria-pressed\", \"false\");\n } else {\n this._container.classList.add(\"mapboxgl-compact-show\");\n this._compactButton.setAttribute(\"aria-pressed\", \"true\");\n }\n };\n AttributionControl.prototype._updateEditLink = function _updateEditLink() {\n var editLink = this._editLink;\n if (!editLink) {\n editLink = this._editLink = this._container.querySelector(\".mapbox-improve-map\");\n }\n var params = [\n {\n key: \"owner\",\n value: this.styleOwner\n },\n {\n key: \"id\",\n value: this.styleId\n },\n {\n key: \"access_token\",\n value: this._map._requestManager._customAccessToken || performance2.config.ACCESS_TOKEN\n }\n ];\n if (editLink) {\n var paramString = params.reduce(function(acc, next, i) {\n if (next.value) {\n acc += next.key + \"=\" + next.value + (i < params.length - 1 ? \"&\" : \"\");\n }\n return acc;\n }, \"?\");\n editLink.href = performance2.config.FEEDBACK_URL + \"/\" + paramString + (this._map._hash ? this._map._hash.getHashString(true) : \"\");\n editLink.rel = \"noopener nofollow\";\n this._setElementTitle(editLink, \"MapFeedback\");\n }\n };\n AttributionControl.prototype._updateData = function _updateData(e) {\n if (e && (e.sourceDataType === \"metadata\" || e.sourceDataType === \"visibility\" || e.dataType === \"style\")) {\n this._updateAttributions();\n this._updateEditLink();\n }\n };\n AttributionControl.prototype._updateAttributions = function _updateAttributions() {\n if (!this._map.style) {\n return;\n }\n var attributions = [];\n if (this.options.customAttribution) {\n if (Array.isArray(this.options.customAttribution)) {\n attributions = attributions.concat(this.options.customAttribution.map(function(attribution) {\n if (typeof attribution !== \"string\") {\n return \"\";\n }\n return attribution;\n }));\n } else if (typeof this.options.customAttribution === \"string\") {\n attributions.push(this.options.customAttribution);\n }\n }\n if (this._map.style.stylesheet) {\n var stylesheet = this._map.style.stylesheet;\n this.styleOwner = stylesheet.owner;\n this.styleId = stylesheet.id;\n }\n var sourceCaches = this._map.style.sourceCaches;\n for (var id in sourceCaches) {\n var sourceCache = sourceCaches[id];\n if (sourceCache.used) {\n var source = sourceCache.getSource();\n if (source.attribution && attributions.indexOf(source.attribution) < 0) {\n attributions.push(source.attribution);\n }\n }\n }\n attributions.sort(function(a, b) {\n return a.length - b.length;\n });\n attributions = attributions.filter(function(attrib, i) {\n for (var j = i + 1; j < attributions.length; j++) {\n if (attributions[j].indexOf(attrib) >= 0) {\n return false;\n }\n }\n return true;\n });\n var attribHTML = attributions.join(\" | \");\n if (attribHTML === this._attribHTML) {\n return;\n }\n this._attribHTML = attribHTML;\n if (attributions.length) {\n this._innerContainer.innerHTML = attribHTML;\n this._container.classList.remove(\"mapboxgl-attrib-empty\");\n } else {\n this._container.classList.add(\"mapboxgl-attrib-empty\");\n }\n this._editLink = null;\n };\n AttributionControl.prototype._updateCompact = function _updateCompact() {\n if (this._map.getCanvasContainer().offsetWidth <= 640) {\n this._container.classList.add(\"mapboxgl-compact\");\n } else {\n this._container.classList.remove(\"mapboxgl-compact\", \"mapboxgl-compact-show\");\n }\n };\n var LogoControl = function LogoControl2() {\n performance2.bindAll([\"_updateLogo\"], this);\n performance2.bindAll([\"_updateCompact\"], this);\n };\n LogoControl.prototype.onAdd = function onAdd(map) {\n this._map = map;\n this._container = DOM.create(\"div\", \"mapboxgl-ctrl\");\n var anchor = DOM.create(\"a\", \"mapboxgl-ctrl-logo\");\n anchor.target = \"_blank\";\n anchor.rel = \"noopener nofollow\";\n anchor.href = \"https://www.mapbox.com/\";\n anchor.setAttribute(\"aria-label\", this._map._getUIString(\"LogoControl.Title\"));\n anchor.setAttribute(\"rel\", \"noopener nofollow\");\n this._container.appendChild(anchor);\n this._container.style.display = \"none\";\n this._map.on(\"sourcedata\", this._updateLogo);\n this._updateLogo();\n this._map.on(\"resize\", this._updateCompact);\n this._updateCompact();\n return this._container;\n };\n LogoControl.prototype.onRemove = function onRemove() {\n DOM.remove(this._container);\n this._map.off(\"sourcedata\", this._updateLogo);\n this._map.off(\"resize\", this._updateCompact);\n };\n LogoControl.prototype.getDefaultPosition = function getDefaultPosition() {\n return \"bottom-left\";\n };\n LogoControl.prototype._updateLogo = function _updateLogo(e) {\n if (!e || e.sourceDataType === \"metadata\") {\n this._container.style.display = this._logoRequired() ? \"block\" : \"none\";\n }\n };\n LogoControl.prototype._logoRequired = function _logoRequired() {\n if (!this._map.style) {\n return;\n }\n var sourceCaches = this._map.style.sourceCaches;\n for (var id in sourceCaches) {\n var source = sourceCaches[id].getSource();\n if (source.mapbox_logo) {\n return true;\n }\n }\n return false;\n };\n LogoControl.prototype._updateCompact = function _updateCompact() {\n var containerChildren = this._container.children;\n if (containerChildren.length) {\n var anchor = containerChildren[0];\n if (this._map.getCanvasContainer().offsetWidth < 250) {\n anchor.classList.add(\"mapboxgl-compact\");\n } else {\n anchor.classList.remove(\"mapboxgl-compact\");\n }\n }\n };\n var TaskQueue = function TaskQueue2() {\n this._queue = [];\n this._id = 0;\n this._cleared = false;\n this._currentlyRunning = false;\n };\n TaskQueue.prototype.add = function add(callback) {\n var id = ++this._id;\n var queue = this._queue;\n queue.push({\n callback,\n id,\n cancelled: false\n });\n return id;\n };\n TaskQueue.prototype.remove = function remove(id) {\n var running = this._currentlyRunning;\n var queue = running ? this._queue.concat(running) : this._queue;\n for (var i = 0, list = queue; i < list.length; i += 1) {\n var task = list[i];\n if (task.id === id) {\n task.cancelled = true;\n return;\n }\n }\n };\n TaskQueue.prototype.run = function run(timeStamp) {\n if (timeStamp === void 0)\n timeStamp = 0;\n var queue = this._currentlyRunning = this._queue;\n this._queue = [];\n for (var i = 0, list = queue; i < list.length; i += 1) {\n var task = list[i];\n if (task.cancelled) {\n continue;\n }\n task.callback(timeStamp);\n if (this._cleared) {\n break;\n }\n }\n this._cleared = false;\n this._currentlyRunning = false;\n };\n TaskQueue.prototype.clear = function clear() {\n if (this._currentlyRunning) {\n this._cleared = true;\n }\n this._queue = [];\n };\n var defaultLocale = {\n \"AttributionControl.ToggleAttribution\": \"Toggle attribution\",\n \"AttributionControl.MapFeedback\": \"Map feedback\",\n \"FullscreenControl.Enter\": \"Enter fullscreen\",\n \"FullscreenControl.Exit\": \"Exit fullscreen\",\n \"GeolocateControl.FindMyLocation\": \"Find my location\",\n \"GeolocateControl.LocationNotAvailable\": \"Location not available\",\n \"LogoControl.Title\": \"Mapbox logo\",\n \"NavigationControl.ResetBearing\": \"Reset bearing to north\",\n \"NavigationControl.ZoomIn\": \"Zoom in\",\n \"NavigationControl.ZoomOut\": \"Zoom out\",\n \"ScaleControl.Feet\": \"ft\",\n \"ScaleControl.Meters\": \"m\",\n \"ScaleControl.Kilometers\": \"km\",\n \"ScaleControl.Miles\": \"mi\",\n \"ScaleControl.NauticalMiles\": \"nm\"\n };\n var HTMLImageElement2 = performance2.window.HTMLImageElement;\n var HTMLElement2 = performance2.window.HTMLElement;\n var ImageBitmap2 = performance2.window.ImageBitmap;\n var defaultMinZoom = -2;\n var defaultMaxZoom = 22;\n var defaultMinPitch = 0;\n var defaultMaxPitch = 60;\n var defaultOptions$1 = {\n center: [\n 0,\n 0\n ],\n zoom: 0,\n bearing: 0,\n pitch: 0,\n minZoom: defaultMinZoom,\n maxZoom: defaultMaxZoom,\n minPitch: defaultMinPitch,\n maxPitch: defaultMaxPitch,\n interactive: true,\n scrollZoom: true,\n boxZoom: true,\n dragRotate: true,\n dragPan: true,\n keyboard: true,\n doubleClickZoom: true,\n touchZoomRotate: true,\n touchPitch: true,\n bearingSnap: 7,\n clickTolerance: 3,\n pitchWithRotate: true,\n hash: false,\n attributionControl: true,\n failIfMajorPerformanceCaveat: false,\n preserveDrawingBuffer: false,\n trackResize: true,\n renderWorldCopies: true,\n refreshExpiredTiles: true,\n maxTileCacheSize: null,\n localIdeographFontFamily: \"sans-serif\",\n transformRequest: null,\n accessToken: null,\n fadeDuration: 300,\n crossSourceCollisions: true\n };\n var Map2 = function(Camera2) {\n function Map3(options) {\n var this$1 = this;\n options = performance2.extend({}, defaultOptions$1, options);\n if (options.minZoom != null && options.maxZoom != null && options.minZoom > options.maxZoom) {\n throw new Error(\"maxZoom must be greater than or equal to minZoom\");\n }\n if (options.minPitch != null && options.maxPitch != null && options.minPitch > options.maxPitch) {\n throw new Error(\"maxPitch must be greater than or equal to minPitch\");\n }\n if (options.minPitch != null && options.minPitch < defaultMinPitch) {\n throw new Error(\"minPitch must be greater than or equal to \" + defaultMinPitch);\n }\n if (options.maxPitch != null && options.maxPitch > defaultMaxPitch) {\n throw new Error(\"maxPitch must be less than or equal to \" + defaultMaxPitch);\n }\n var transform = new Transform(options.minZoom, options.maxZoom, options.minPitch, options.maxPitch, options.renderWorldCopies);\n Camera2.call(this, transform, options);\n this._interactive = options.interactive;\n this._maxTileCacheSize = options.maxTileCacheSize;\n this._failIfMajorPerformanceCaveat = options.failIfMajorPerformanceCaveat;\n this._preserveDrawingBuffer = options.preserveDrawingBuffer;\n this._antialias = options.antialias;\n this._trackResize = options.trackResize;\n this._bearingSnap = options.bearingSnap;\n this._refreshExpiredTiles = options.refreshExpiredTiles;\n this._fadeDuration = options.fadeDuration;\n this._crossSourceCollisions = options.crossSourceCollisions;\n this._crossFadingFactor = 1;\n this._collectResourceTiming = options.collectResourceTiming;\n this._renderTaskQueue = new TaskQueue();\n this._controls = [];\n this._mapId = performance2.uniqueId();\n this._locale = performance2.extend({}, defaultLocale, options.locale);\n this._clickTolerance = options.clickTolerance;\n this._requestManager = new performance2.RequestManager(options.transformRequest, options.accessToken);\n if (typeof options.container === \"string\") {\n this._container = performance2.window.document.getElementById(options.container);\n if (!this._container) {\n throw new Error(\"Container '\" + options.container + \"' not found.\");\n }\n } else if (options.container instanceof HTMLElement2) {\n this._container = options.container;\n } else {\n throw new Error(\"Invalid type: 'container' must be a String or HTMLElement.\");\n }\n if (options.maxBounds) {\n this.setMaxBounds(options.maxBounds);\n }\n performance2.bindAll([\n \"_onWindowOnline\",\n \"_onWindowResize\",\n \"_onMapScroll\",\n \"_contextLost\",\n \"_contextRestored\"\n ], this);\n this._setupContainer();\n this._setupPainter();\n if (this.painter === void 0) {\n throw new Error(\"Failed to initialize WebGL.\");\n }\n this.on(\"move\", function() {\n return this$1._update(false);\n });\n this.on(\"moveend\", function() {\n return this$1._update(false);\n });\n this.on(\"zoom\", function() {\n return this$1._update(true);\n });\n if (typeof performance2.window !== \"undefined\") {\n performance2.window.addEventListener(\"online\", this._onWindowOnline, false);\n performance2.window.addEventListener(\"resize\", this._onWindowResize, false);\n performance2.window.addEventListener(\"orientationchange\", this._onWindowResize, false);\n }\n this.handlers = new HandlerManager(this, options);\n var hashName = typeof options.hash === \"string\" && options.hash || void 0;\n this._hash = options.hash && new Hash(hashName).addTo(this);\n if (!this._hash || !this._hash._onHashChange()) {\n this.jumpTo({\n center: options.center,\n zoom: options.zoom,\n bearing: options.bearing,\n pitch: options.pitch\n });\n if (options.bounds) {\n this.resize();\n this.fitBounds(options.bounds, performance2.extend({}, options.fitBoundsOptions, { duration: 0 }));\n }\n }\n this.resize();\n this._localIdeographFontFamily = options.localIdeographFontFamily;\n if (options.style) {\n this.setStyle(options.style, { localIdeographFontFamily: options.localIdeographFontFamily });\n }\n if (options.attributionControl) {\n this.addControl(new AttributionControl({ customAttribution: options.customAttribution }));\n }\n this.addControl(new LogoControl(), options.logoPosition);\n this.on(\"style.load\", function() {\n if (this$1.transform.unmodified) {\n this$1.jumpTo(this$1.style.stylesheet);\n }\n });\n this.on(\"data\", function(event) {\n this$1._update(event.dataType === \"style\");\n this$1.fire(new performance2.Event(event.dataType + \"data\", event));\n });\n this.on(\"dataloading\", function(event) {\n this$1.fire(new performance2.Event(event.dataType + \"dataloading\", event));\n });\n }\n if (Camera2)\n Map3.__proto__ = Camera2;\n Map3.prototype = Object.create(Camera2 && Camera2.prototype);\n Map3.prototype.constructor = Map3;\n var prototypeAccessors2 = {\n showTileBoundaries: { configurable: true },\n showPadding: { configurable: true },\n showCollisionBoxes: { configurable: true },\n showOverdrawInspector: { configurable: true },\n repaint: { configurable: true },\n vertices: { configurable: true },\n version: { configurable: true }\n };\n Map3.prototype._getMapId = function _getMapId() {\n return this._mapId;\n };\n Map3.prototype.addControl = function addControl(control, position) {\n if (position === void 0) {\n if (control.getDefaultPosition) {\n position = control.getDefaultPosition();\n } else {\n position = \"top-right\";\n }\n }\n if (!control || !control.onAdd) {\n return this.fire(new performance2.ErrorEvent(new Error(\"Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.\")));\n }\n var controlElement = control.onAdd(this);\n this._controls.push(control);\n var positionContainer = this._controlPositions[position];\n if (position.indexOf(\"bottom\") !== -1) {\n positionContainer.insertBefore(controlElement, positionContainer.firstChild);\n } else {\n positionContainer.appendChild(controlElement);\n }\n return this;\n };\n Map3.prototype.removeControl = function removeControl(control) {\n if (!control || !control.onRemove) {\n return this.fire(new performance2.ErrorEvent(new Error(\"Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.\")));\n }\n var ci = this._controls.indexOf(control);\n if (ci > -1) {\n this._controls.splice(ci, 1);\n }\n control.onRemove(this);\n return this;\n };\n Map3.prototype.hasControl = function hasControl(control) {\n return this._controls.indexOf(control) > -1;\n };\n Map3.prototype.resize = function resize(eventData) {\n var dimensions = this._containerDimensions();\n var width = dimensions[0];\n var height = dimensions[1];\n this._resizeCanvas(width, height);\n this.transform.resize(width, height);\n this.painter.resize(width, height);\n var fireMoving = !this._moving;\n if (fireMoving) {\n this.stop();\n this.fire(new performance2.Event(\"movestart\", eventData)).fire(new performance2.Event(\"move\", eventData));\n }\n this.fire(new performance2.Event(\"resize\", eventData));\n if (fireMoving) {\n this.fire(new performance2.Event(\"moveend\", eventData));\n }\n return this;\n };\n Map3.prototype.getBounds = function getBounds() {\n return this.transform.getBounds();\n };\n Map3.prototype.getMaxBounds = function getMaxBounds() {\n return this.transform.getMaxBounds();\n };\n Map3.prototype.setMaxBounds = function setMaxBounds(bounds) {\n this.transform.setMaxBounds(performance2.LngLatBounds.convert(bounds));\n return this._update();\n };\n Map3.prototype.setMinZoom = function setMinZoom(minZoom) {\n minZoom = minZoom === null || minZoom === void 0 ? defaultMinZoom : minZoom;\n if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {\n this.transform.minZoom = minZoom;\n this._update();\n if (this.getZoom() < minZoom) {\n this.setZoom(minZoom);\n }\n return this;\n } else {\n throw new Error(\"minZoom must be between \" + defaultMinZoom + \" and the current maxZoom, inclusive\");\n }\n };\n Map3.prototype.getMinZoom = function getMinZoom() {\n return this.transform.minZoom;\n };\n Map3.prototype.setMaxZoom = function setMaxZoom(maxZoom) {\n maxZoom = maxZoom === null || maxZoom === void 0 ? defaultMaxZoom : maxZoom;\n if (maxZoom >= this.transform.minZoom) {\n this.transform.maxZoom = maxZoom;\n this._update();\n if (this.getZoom() > maxZoom) {\n this.setZoom(maxZoom);\n }\n return this;\n } else {\n throw new Error(\"maxZoom must be greater than the current minZoom\");\n }\n };\n Map3.prototype.getMaxZoom = function getMaxZoom() {\n return this.transform.maxZoom;\n };\n Map3.prototype.setMinPitch = function setMinPitch(minPitch) {\n minPitch = minPitch === null || minPitch === void 0 ? defaultMinPitch : minPitch;\n if (minPitch < defaultMinPitch) {\n throw new Error(\"minPitch must be greater than or equal to \" + defaultMinPitch);\n }\n if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {\n this.transform.minPitch = minPitch;\n this._update();\n if (this.getPitch() < minPitch) {\n this.setPitch(minPitch);\n }\n return this;\n } else {\n throw new Error(\"minPitch must be between \" + defaultMinPitch + \" and the current maxPitch, inclusive\");\n }\n };\n Map3.prototype.getMinPitch = function getMinPitch() {\n return this.transform.minPitch;\n };\n Map3.prototype.setMaxPitch = function setMaxPitch(maxPitch) {\n maxPitch = maxPitch === null || maxPitch === void 0 ? defaultMaxPitch : maxPitch;\n if (maxPitch > defaultMaxPitch) {\n throw new Error(\"maxPitch must be less than or equal to \" + defaultMaxPitch);\n }\n if (maxPitch >= this.transform.minPitch) {\n this.transform.maxPitch = maxPitch;\n this._update();\n if (this.getPitch() > maxPitch) {\n this.setPitch(maxPitch);\n }\n return this;\n } else {\n throw new Error(\"maxPitch must be greater than the current minPitch\");\n }\n };\n Map3.prototype.getMaxPitch = function getMaxPitch() {\n return this.transform.maxPitch;\n };\n Map3.prototype.getRenderWorldCopies = function getRenderWorldCopies() {\n return this.transform.renderWorldCopies;\n };\n Map3.prototype.setRenderWorldCopies = function setRenderWorldCopies(renderWorldCopies) {\n this.transform.renderWorldCopies = renderWorldCopies;\n return this._update();\n };\n Map3.prototype.project = function project2(lnglat) {\n return this.transform.locationPoint(performance2.LngLat.convert(lnglat));\n };\n Map3.prototype.unproject = function unproject(point) {\n return this.transform.pointLocation(performance2.Point.convert(point));\n };\n Map3.prototype.isMoving = function isMoving2() {\n return this._moving || this.handlers.isMoving();\n };\n Map3.prototype.isZooming = function isZooming() {\n return this._zooming || this.handlers.isZooming();\n };\n Map3.prototype.isRotating = function isRotating() {\n return this._rotating || this.handlers.isRotating();\n };\n Map3.prototype._createDelegatedListener = function _createDelegatedListener(type, layerId, listener) {\n var this$1 = this;\n var obj;\n if (type === \"mouseenter\" || type === \"mouseover\") {\n var mousein = false;\n var mousemove = function(e) {\n var features = this$1.getLayer(layerId) ? this$1.queryRenderedFeatures(e.point, { layers: [layerId] }) : [];\n if (!features.length) {\n mousein = false;\n } else if (!mousein) {\n mousein = true;\n listener.call(this$1, new MapMouseEvent(type, this$1, e.originalEvent, { features }));\n }\n };\n var mouseout = function() {\n mousein = false;\n };\n return {\n layer: layerId,\n listener,\n delegates: {\n mousemove,\n mouseout\n }\n };\n } else if (type === \"mouseleave\" || type === \"mouseout\") {\n var mousein$1 = false;\n var mousemove$1 = function(e) {\n var features = this$1.getLayer(layerId) ? this$1.queryRenderedFeatures(e.point, { layers: [layerId] }) : [];\n if (features.length) {\n mousein$1 = true;\n } else if (mousein$1) {\n mousein$1 = false;\n listener.call(this$1, new MapMouseEvent(type, this$1, e.originalEvent));\n }\n };\n var mouseout$1 = function(e) {\n if (mousein$1) {\n mousein$1 = false;\n listener.call(this$1, new MapMouseEvent(type, this$1, e.originalEvent));\n }\n };\n return {\n layer: layerId,\n listener,\n delegates: {\n mousemove: mousemove$1,\n mouseout: mouseout$1\n }\n };\n } else {\n var delegate = function(e) {\n var features = this$1.getLayer(layerId) ? this$1.queryRenderedFeatures(e.point, { layers: [layerId] }) : [];\n if (features.length) {\n e.features = features;\n listener.call(this$1, e);\n delete e.features;\n }\n };\n return {\n layer: layerId,\n listener,\n delegates: (obj = {}, obj[type] = delegate, obj)\n };\n }\n };\n Map3.prototype.on = function on(type, layerId, listener) {\n if (listener === void 0) {\n return Camera2.prototype.on.call(this, type, layerId);\n }\n var delegatedListener = this._createDelegatedListener(type, layerId, listener);\n this._delegatedListeners = this._delegatedListeners || {};\n this._delegatedListeners[type] = this._delegatedListeners[type] || [];\n this._delegatedListeners[type].push(delegatedListener);\n for (var event in delegatedListener.delegates) {\n this.on(event, delegatedListener.delegates[event]);\n }\n return this;\n };\n Map3.prototype.once = function once(type, layerId, listener) {\n if (listener === void 0) {\n return Camera2.prototype.once.call(this, type, layerId);\n }\n var delegatedListener = this._createDelegatedListener(type, layerId, listener);\n for (var event in delegatedListener.delegates) {\n this.once(event, delegatedListener.delegates[event]);\n }\n return this;\n };\n Map3.prototype.off = function off(type, layerId, listener) {\n var this$1 = this;\n if (listener === void 0) {\n return Camera2.prototype.off.call(this, type, layerId);\n }\n var removeDelegatedListener = function(delegatedListeners) {\n var listeners = delegatedListeners[type];\n for (var i = 0; i < listeners.length; i++) {\n var delegatedListener = listeners[i];\n if (delegatedListener.layer === layerId && delegatedListener.listener === listener) {\n for (var event in delegatedListener.delegates) {\n this$1.off(event, delegatedListener.delegates[event]);\n }\n listeners.splice(i, 1);\n return this$1;\n }\n }\n };\n if (this._delegatedListeners && this._delegatedListeners[type]) {\n removeDelegatedListener(this._delegatedListeners);\n }\n return this;\n };\n Map3.prototype.queryRenderedFeatures = function queryRenderedFeatures2(geometry, options) {\n if (!this.style) {\n return [];\n }\n if (options === void 0 && geometry !== void 0 && !(geometry instanceof performance2.Point) && !Array.isArray(geometry)) {\n options = geometry;\n geometry = void 0;\n }\n options = options || {};\n geometry = geometry || [\n [\n 0,\n 0\n ],\n [\n this.transform.width,\n this.transform.height\n ]\n ];\n var queryGeometry;\n if (geometry instanceof performance2.Point || typeof geometry[0] === \"number\") {\n queryGeometry = [performance2.Point.convert(geometry)];\n } else {\n var tl = performance2.Point.convert(geometry[0]);\n var br = performance2.Point.convert(geometry[1]);\n queryGeometry = [\n tl,\n new performance2.Point(br.x, tl.y),\n br,\n new performance2.Point(tl.x, br.y),\n tl\n ];\n }\n return this.style.queryRenderedFeatures(queryGeometry, options, this.transform);\n };\n Map3.prototype.querySourceFeatures = function querySourceFeatures2(sourceId, parameters) {\n return this.style.querySourceFeatures(sourceId, parameters);\n };\n Map3.prototype.setStyle = function setStyle(style, options) {\n options = performance2.extend({}, { localIdeographFontFamily: this._localIdeographFontFamily }, options);\n if (options.diff !== false && options.localIdeographFontFamily === this._localIdeographFontFamily && this.style && style) {\n this._diffStyle(style, options);\n return this;\n } else {\n this._localIdeographFontFamily = options.localIdeographFontFamily;\n return this._updateStyle(style, options);\n }\n };\n Map3.prototype._getUIString = function _getUIString(key) {\n var str = this._locale[key];\n if (str == null) {\n throw new Error(\"Missing UI string '\" + key + \"'\");\n }\n return str;\n };\n Map3.prototype._updateStyle = function _updateStyle(style, options) {\n if (this.style) {\n this.style.setEventedParent(null);\n this.style._remove();\n }\n if (!style) {\n delete this.style;\n return this;\n } else {\n this.style = new Style(this, options || {});\n }\n this.style.setEventedParent(this, { style: this.style });\n if (typeof style === \"string\") {\n this.style.loadURL(style);\n } else {\n this.style.loadJSON(style);\n }\n return this;\n };\n Map3.prototype._lazyInitEmptyStyle = function _lazyInitEmptyStyle() {\n if (!this.style) {\n this.style = new Style(this, {});\n this.style.setEventedParent(this, { style: this.style });\n this.style.loadEmpty();\n }\n };\n Map3.prototype._diffStyle = function _diffStyle(style, options) {\n var this$1 = this;\n if (typeof style === \"string\") {\n var url = this._requestManager.normalizeStyleURL(style);\n var request = this._requestManager.transformRequest(url, performance2.ResourceType.Style);\n performance2.getJSON(request, function(error, json) {\n if (error) {\n this$1.fire(new performance2.ErrorEvent(error));\n } else if (json) {\n this$1._updateDiff(json, options);\n }\n });\n } else if (typeof style === \"object\") {\n this._updateDiff(style, options);\n }\n };\n Map3.prototype._updateDiff = function _updateDiff(style, options) {\n try {\n if (this.style.setState(style)) {\n this._update(true);\n }\n } catch (e) {\n performance2.warnOnce(\"Unable to perform style diff: \" + (e.message || e.error || e) + \". Rebuilding the style from scratch.\");\n this._updateStyle(style, options);\n }\n };\n Map3.prototype.getStyle = function getStyle() {\n if (this.style) {\n return this.style.serialize();\n }\n };\n Map3.prototype.isStyleLoaded = function isStyleLoaded() {\n if (!this.style) {\n return performance2.warnOnce(\"There is no style added to the map.\");\n }\n return this.style.loaded();\n };\n Map3.prototype.addSource = function addSource2(id, source) {\n this._lazyInitEmptyStyle();\n this.style.addSource(id, source);\n return this._update(true);\n };\n Map3.prototype.isSourceLoaded = function isSourceLoaded(id) {\n var source = this.style && this.style.sourceCaches[id];\n if (source === void 0) {\n this.fire(new performance2.ErrorEvent(new Error(\"There is no source with ID '\" + id + \"'\")));\n return;\n }\n return source.loaded();\n };\n Map3.prototype.areTilesLoaded = function areTilesLoaded() {\n var sources = this.style && this.style.sourceCaches;\n for (var id in sources) {\n var source = sources[id];\n var tiles = source._tiles;\n for (var t in tiles) {\n var tile = tiles[t];\n if (!(tile.state === \"loaded\" || tile.state === \"errored\")) {\n return false;\n }\n }\n }\n return true;\n };\n Map3.prototype.addSourceType = function addSourceType(name2, SourceType, callback) {\n this._lazyInitEmptyStyle();\n return this.style.addSourceType(name2, SourceType, callback);\n };\n Map3.prototype.removeSource = function removeSource2(id) {\n this.style.removeSource(id);\n return this._update(true);\n };\n Map3.prototype.getSource = function getSource(id) {\n return this.style.getSource(id);\n };\n Map3.prototype.addImage = function addImage(id, image, ref) {\n if (ref === void 0)\n ref = {};\n var pixelRatio = ref.pixelRatio;\n if (pixelRatio === void 0)\n pixelRatio = 1;\n var sdf = ref.sdf;\n if (sdf === void 0)\n sdf = false;\n var stretchX = ref.stretchX;\n var stretchY = ref.stretchY;\n var content = ref.content;\n this._lazyInitEmptyStyle();\n var version = 0;\n if (image instanceof HTMLImageElement2 || ImageBitmap2 && image instanceof ImageBitmap2) {\n var ref$1 = performance2.browser.getImageData(image);\n var width = ref$1.width;\n var height = ref$1.height;\n var data = ref$1.data;\n this.style.addImage(id, {\n data: new performance2.RGBAImage({\n width,\n height\n }, data),\n pixelRatio,\n stretchX,\n stretchY,\n content,\n sdf,\n version\n });\n } else if (image.width === void 0 || image.height === void 0) {\n return this.fire(new performance2.ErrorEvent(new Error(\"Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`\")));\n } else {\n var width$1 = image.width;\n var height$1 = image.height;\n var data$1 = image.data;\n var userImage = image;\n this.style.addImage(id, {\n data: new performance2.RGBAImage({\n width: width$1,\n height: height$1\n }, new Uint8Array(data$1)),\n pixelRatio,\n stretchX,\n stretchY,\n content,\n sdf,\n version,\n userImage\n });\n if (userImage.onAdd) {\n userImage.onAdd(this, id);\n }\n }\n };\n Map3.prototype.updateImage = function updateImage(id, image) {\n var existingImage = this.style.getImage(id);\n if (!existingImage) {\n return this.fire(new performance2.ErrorEvent(new Error(\"The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.\")));\n }\n var imageData = image instanceof HTMLImageElement2 || ImageBitmap2 && image instanceof ImageBitmap2 ? performance2.browser.getImageData(image) : image;\n var width = imageData.width;\n var height = imageData.height;\n var data = imageData.data;\n if (width === void 0 || height === void 0) {\n return this.fire(new performance2.ErrorEvent(new Error(\"Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`\")));\n }\n if (width !== existingImage.data.width || height !== existingImage.data.height) {\n return this.fire(new performance2.ErrorEvent(new Error(\"The width and height of the updated image must be that same as the previous version of the image\")));\n }\n var copy = !(image instanceof HTMLImageElement2 || ImageBitmap2 && image instanceof ImageBitmap2);\n existingImage.data.replace(data, copy);\n this.style.updateImage(id, existingImage);\n };\n Map3.prototype.hasImage = function hasImage(id) {\n if (!id) {\n this.fire(new performance2.ErrorEvent(new Error(\"Missing required image id\")));\n return false;\n }\n return !!this.style.getImage(id);\n };\n Map3.prototype.removeImage = function removeImage(id) {\n this.style.removeImage(id);\n };\n Map3.prototype.loadImage = function loadImage(url, callback) {\n performance2.getImage(this._requestManager.transformRequest(url, performance2.ResourceType.Image), callback);\n };\n Map3.prototype.listImages = function listImages() {\n return this.style.listImages();\n };\n Map3.prototype.addLayer = function addLayer(layer, beforeId) {\n this._lazyInitEmptyStyle();\n this.style.addLayer(layer, beforeId);\n return this._update(true);\n };\n Map3.prototype.moveLayer = function moveLayer(id, beforeId) {\n this.style.moveLayer(id, beforeId);\n return this._update(true);\n };\n Map3.prototype.removeLayer = function removeLayer(id) {\n this.style.removeLayer(id);\n return this._update(true);\n };\n Map3.prototype.getLayer = function getLayer(id) {\n return this.style.getLayer(id);\n };\n Map3.prototype.setLayerZoomRange = function setLayerZoomRange(layerId, minzoom, maxzoom) {\n this.style.setLayerZoomRange(layerId, minzoom, maxzoom);\n return this._update(true);\n };\n Map3.prototype.setFilter = function setFilter(layerId, filter, options) {\n if (options === void 0)\n options = {};\n this.style.setFilter(layerId, filter, options);\n return this._update(true);\n };\n Map3.prototype.getFilter = function getFilter(layerId) {\n return this.style.getFilter(layerId);\n };\n Map3.prototype.setPaintProperty = function setPaintProperty(layerId, name2, value, options) {\n if (options === void 0)\n options = {};\n this.style.setPaintProperty(layerId, name2, value, options);\n return this._update(true);\n };\n Map3.prototype.getPaintProperty = function getPaintProperty(layerId, name2) {\n return this.style.getPaintProperty(layerId, name2);\n };\n Map3.prototype.setLayoutProperty = function setLayoutProperty(layerId, name2, value, options) {\n if (options === void 0)\n options = {};\n this.style.setLayoutProperty(layerId, name2, value, options);\n return this._update(true);\n };\n Map3.prototype.getLayoutProperty = function getLayoutProperty(layerId, name2) {\n return this.style.getLayoutProperty(layerId, name2);\n };\n Map3.prototype.setLight = function setLight(light, options) {\n if (options === void 0)\n options = {};\n this._lazyInitEmptyStyle();\n this.style.setLight(light, options);\n return this._update(true);\n };\n Map3.prototype.getLight = function getLight() {\n return this.style.getLight();\n };\n Map3.prototype.setFeatureState = function setFeatureState(feature, state) {\n this.style.setFeatureState(feature, state);\n return this._update();\n };\n Map3.prototype.removeFeatureState = function removeFeatureState(target, key) {\n this.style.removeFeatureState(target, key);\n return this._update();\n };\n Map3.prototype.getFeatureState = function getFeatureState(feature) {\n return this.style.getFeatureState(feature);\n };\n Map3.prototype.getContainer = function getContainer() {\n return this._container;\n };\n Map3.prototype.getCanvasContainer = function getCanvasContainer() {\n return this._canvasContainer;\n };\n Map3.prototype.getCanvas = function getCanvas() {\n return this._canvas;\n };\n Map3.prototype._containerDimensions = function _containerDimensions() {\n var width = 0;\n var height = 0;\n if (this._container) {\n width = this._container.clientWidth || 400;\n height = this._container.clientHeight || 300;\n }\n return [\n width,\n height\n ];\n };\n Map3.prototype._detectMissingCSS = function _detectMissingCSS() {\n var computedColor = performance2.window.getComputedStyle(this._missingCSSCanary).getPropertyValue(\"background-color\");\n if (computedColor !== \"rgb(250, 128, 114)\") {\n performance2.warnOnce(\"This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.\");\n }\n };\n Map3.prototype._setupContainer = function _setupContainer() {\n var container = this._container;\n container.classList.add(\"mapboxgl-map\");\n var missingCSSCanary = this._missingCSSCanary = DOM.create(\"div\", \"mapboxgl-canary\", container);\n missingCSSCanary.style.visibility = \"hidden\";\n this._detectMissingCSS();\n var canvasContainer = this._canvasContainer = DOM.create(\"div\", \"mapboxgl-canvas-container\", container);\n if (this._interactive) {\n canvasContainer.classList.add(\"mapboxgl-interactive\");\n }\n this._canvas = DOM.create(\"canvas\", \"mapboxgl-canvas\", canvasContainer);\n this._canvas.addEventListener(\"webglcontextlost\", this._contextLost, false);\n this._canvas.addEventListener(\"webglcontextrestored\", this._contextRestored, false);\n this._canvas.setAttribute(\"tabindex\", \"0\");\n this._canvas.setAttribute(\"aria-label\", \"Map\");\n this._canvas.setAttribute(\"role\", \"region\");\n var dimensions = this._containerDimensions();\n this._resizeCanvas(dimensions[0], dimensions[1]);\n var controlContainer = this._controlContainer = DOM.create(\"div\", \"mapboxgl-control-container\", container);\n var positions = this._controlPositions = {};\n [\n \"top-left\",\n \"top-right\",\n \"bottom-left\",\n \"bottom-right\"\n ].forEach(function(positionName) {\n positions[positionName] = DOM.create(\"div\", \"mapboxgl-ctrl-\" + positionName, controlContainer);\n });\n this._container.addEventListener(\"scroll\", this._onMapScroll, false);\n };\n Map3.prototype._resizeCanvas = function _resizeCanvas(width, height) {\n var pixelRatio = performance2.browser.devicePixelRatio || 1;\n this._canvas.width = pixelRatio * width;\n this._canvas.height = pixelRatio * height;\n this._canvas.style.width = width + \"px\";\n this._canvas.style.height = height + \"px\";\n };\n Map3.prototype._setupPainter = function _setupPainter() {\n var attributes = performance2.extend({}, mapboxGlSupported.webGLContextAttributes, {\n failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat,\n preserveDrawingBuffer: this._preserveDrawingBuffer,\n antialias: this._antialias || false\n });\n var gl2 = this._canvas.getContext(\"webgl\", attributes) || this._canvas.getContext(\"experimental-webgl\", attributes);\n if (!gl2) {\n this.fire(new performance2.ErrorEvent(new Error(\"Failed to initialize WebGL\")));\n return;\n }\n this.painter = new Painter(gl2, this.transform);\n performance2.webpSupported.testSupport(gl2);\n };\n Map3.prototype._contextLost = function _contextLost(event) {\n event.preventDefault();\n if (this._frame) {\n this._frame.cancel();\n this._frame = null;\n }\n this.fire(new performance2.Event(\"webglcontextlost\", { originalEvent: event }));\n };\n Map3.prototype._contextRestored = function _contextRestored(event) {\n this._setupPainter();\n this.resize();\n this._update();\n this.fire(new performance2.Event(\"webglcontextrestored\", { originalEvent: event }));\n };\n Map3.prototype._onMapScroll = function _onMapScroll(event) {\n if (event.target !== this._container) {\n return;\n }\n this._container.scrollTop = 0;\n this._container.scrollLeft = 0;\n return false;\n };\n Map3.prototype.loaded = function loaded() {\n return !this._styleDirty && !this._sourcesDirty && !!this.style && this.style.loaded();\n };\n Map3.prototype._update = function _update(updateStyle) {\n if (!this.style) {\n return this;\n }\n this._styleDirty = this._styleDirty || updateStyle;\n this._sourcesDirty = true;\n this.triggerRepaint();\n return this;\n };\n Map3.prototype._requestRenderFrame = function _requestRenderFrame(callback) {\n this._update();\n return this._renderTaskQueue.add(callback);\n };\n Map3.prototype._cancelRenderFrame = function _cancelRenderFrame(id) {\n this._renderTaskQueue.remove(id);\n };\n Map3.prototype._render = function _render(paintStartTimeStamp) {\n var this$1 = this;\n var gpuTimer, frameStartTime = 0;\n var extTimerQuery = this.painter.context.extTimerQuery;\n if (this.listens(\"gpu-timing-frame\")) {\n gpuTimer = extTimerQuery.createQueryEXT();\n extTimerQuery.beginQueryEXT(extTimerQuery.TIME_ELAPSED_EXT, gpuTimer);\n frameStartTime = performance2.browser.now();\n }\n this.painter.context.setDirty();\n this.painter.setBaseState();\n this._renderTaskQueue.run(paintStartTimeStamp);\n if (this._removed) {\n return;\n }\n var crossFading = false;\n if (this.style && this._styleDirty) {\n this._styleDirty = false;\n var zoom = this.transform.zoom;\n var now = performance2.browser.now();\n this.style.zoomHistory.update(zoom, now);\n var parameters = new performance2.EvaluationParameters(zoom, {\n now,\n fadeDuration: this._fadeDuration,\n zoomHistory: this.style.zoomHistory,\n transition: this.style.getTransition()\n });\n var factor = parameters.crossFadingFactor();\n if (factor !== 1 || factor !== this._crossFadingFactor) {\n crossFading = true;\n this._crossFadingFactor = factor;\n }\n this.style.update(parameters);\n }\n if (this.style && this._sourcesDirty) {\n this._sourcesDirty = false;\n this.style._updateSources(this.transform);\n }\n this._placementDirty = this.style && this.style._updatePlacement(this.painter.transform, this.showCollisionBoxes, this._fadeDuration, this._crossSourceCollisions);\n this.painter.render(this.style, {\n showTileBoundaries: this.showTileBoundaries,\n showOverdrawInspector: this._showOverdrawInspector,\n rotating: this.isRotating(),\n zooming: this.isZooming(),\n moving: this.isMoving(),\n fadeDuration: this._fadeDuration,\n showPadding: this.showPadding,\n gpuTiming: !!this.listens(\"gpu-timing-layer\")\n });\n this.fire(new performance2.Event(\"render\"));\n if (this.loaded() && !this._loaded) {\n this._loaded = true;\n this.fire(new performance2.Event(\"load\"));\n }\n if (this.style && (this.style.hasTransitions() || crossFading)) {\n this._styleDirty = true;\n }\n if (this.style && !this._placementDirty) {\n this.style._releaseSymbolFadeTiles();\n }\n if (this.listens(\"gpu-timing-frame\")) {\n var renderCPUTime = performance2.browser.now() - frameStartTime;\n extTimerQuery.endQueryEXT(extTimerQuery.TIME_ELAPSED_EXT, gpuTimer);\n setTimeout(function() {\n var renderGPUTime = extTimerQuery.getQueryObjectEXT(gpuTimer, extTimerQuery.QUERY_RESULT_EXT) / (1e3 * 1e3);\n extTimerQuery.deleteQueryEXT(gpuTimer);\n this$1.fire(new performance2.Event(\"gpu-timing-frame\", {\n cpuTime: renderCPUTime,\n gpuTime: renderGPUTime\n }));\n }, 50);\n }\n if (this.listens(\"gpu-timing-layer\")) {\n var frameLayerQueries = this.painter.collectGpuTimers();\n setTimeout(function() {\n var renderedLayerTimes = this$1.painter.queryGpuTimers(frameLayerQueries);\n this$1.fire(new performance2.Event(\"gpu-timing-layer\", { layerTimes: renderedLayerTimes }));\n }, 50);\n }\n var somethingDirty = this._sourcesDirty || this._styleDirty || this._placementDirty;\n if (somethingDirty || this._repaint) {\n this.triggerRepaint();\n } else if (!this.isMoving() && this.loaded()) {\n this.fire(new performance2.Event(\"idle\"));\n }\n if (this._loaded && !this._fullyLoaded && !somethingDirty) {\n this._fullyLoaded = true;\n }\n return this;\n };\n Map3.prototype.remove = function remove() {\n if (this._hash) {\n this._hash.remove();\n }\n for (var i = 0, list = this._controls; i < list.length; i += 1) {\n var control = list[i];\n control.onRemove(this);\n }\n this._controls = [];\n if (this._frame) {\n this._frame.cancel();\n this._frame = null;\n }\n this._renderTaskQueue.clear();\n this.painter.destroy();\n this.handlers.destroy();\n delete this.handlers;\n this.setStyle(null);\n if (typeof performance2.window !== \"undefined\") {\n performance2.window.removeEventListener(\"resize\", this._onWindowResize, false);\n performance2.window.removeEventListener(\"orientationchange\", this._onWindowResize, false);\n performance2.window.removeEventListener(\"online\", this._onWindowOnline, false);\n }\n var extension = this.painter.context.gl.getExtension(\"WEBGL_lose_context\");\n if (extension && extension.loseContext) {\n extension.loseContext();\n }\n removeNode(this._canvasContainer);\n removeNode(this._controlContainer);\n removeNode(this._missingCSSCanary);\n this._container.classList.remove(\"mapboxgl-map\");\n this._removed = true;\n this.fire(new performance2.Event(\"remove\"));\n };\n Map3.prototype.triggerRepaint = function triggerRepaint() {\n var this$1 = this;\n if (this.style && !this._frame) {\n this._frame = performance2.browser.frame(function(paintStartTimeStamp) {\n this$1._frame = null;\n this$1._render(paintStartTimeStamp);\n });\n }\n };\n Map3.prototype._onWindowOnline = function _onWindowOnline() {\n this._update();\n };\n Map3.prototype._onWindowResize = function _onWindowResize(event) {\n if (this._trackResize) {\n this.resize({ originalEvent: event })._update();\n }\n };\n prototypeAccessors2.showTileBoundaries.get = function() {\n return !!this._showTileBoundaries;\n };\n prototypeAccessors2.showTileBoundaries.set = function(value) {\n if (this._showTileBoundaries === value) {\n return;\n }\n this._showTileBoundaries = value;\n this._update();\n };\n prototypeAccessors2.showPadding.get = function() {\n return !!this._showPadding;\n };\n prototypeAccessors2.showPadding.set = function(value) {\n if (this._showPadding === value) {\n return;\n }\n this._showPadding = value;\n this._update();\n };\n prototypeAccessors2.showCollisionBoxes.get = function() {\n return !!this._showCollisionBoxes;\n };\n prototypeAccessors2.showCollisionBoxes.set = function(value) {\n if (this._showCollisionBoxes === value) {\n return;\n }\n this._showCollisionBoxes = value;\n if (value) {\n this.style._generateCollisionBoxes();\n } else {\n this._update();\n }\n };\n prototypeAccessors2.showOverdrawInspector.get = function() {\n return !!this._showOverdrawInspector;\n };\n prototypeAccessors2.showOverdrawInspector.set = function(value) {\n if (this._showOverdrawInspector === value) {\n return;\n }\n this._showOverdrawInspector = value;\n this._update();\n };\n prototypeAccessors2.repaint.get = function() {\n return !!this._repaint;\n };\n prototypeAccessors2.repaint.set = function(value) {\n if (this._repaint !== value) {\n this._repaint = value;\n this.triggerRepaint();\n }\n };\n prototypeAccessors2.vertices.get = function() {\n return !!this._vertices;\n };\n prototypeAccessors2.vertices.set = function(value) {\n this._vertices = value;\n this._update();\n };\n Map3.prototype._setCacheLimits = function _setCacheLimits(limit, checkThreshold) {\n performance2.setCacheLimits(limit, checkThreshold);\n };\n prototypeAccessors2.version.get = function() {\n return performance2.version;\n };\n Object.defineProperties(Map3.prototype, prototypeAccessors2);\n return Map3;\n }(Camera);\n function removeNode(node) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n }\n var defaultOptions$2 = {\n showCompass: true,\n showZoom: true,\n visualizePitch: false\n };\n var NavigationControl = function NavigationControl2(options) {\n var this$1 = this;\n this.options = performance2.extend({}, defaultOptions$2, options);\n this._container = DOM.create(\"div\", \"mapboxgl-ctrl mapboxgl-ctrl-group\");\n this._container.addEventListener(\"contextmenu\", function(e) {\n return e.preventDefault();\n });\n if (this.options.showZoom) {\n performance2.bindAll([\n \"_setButtonTitle\",\n \"_updateZoomButtons\"\n ], this);\n this._zoomInButton = this._createButton(\"mapboxgl-ctrl-zoom-in\", function(e) {\n return this$1._map.zoomIn({}, { originalEvent: e });\n });\n DOM.create(\"span\", \"mapboxgl-ctrl-icon\", this._zoomInButton).setAttribute(\"aria-hidden\", true);\n this._zoomOutButton = this._createButton(\"mapboxgl-ctrl-zoom-out\", function(e) {\n return this$1._map.zoomOut({}, { originalEvent: e });\n });\n DOM.create(\"span\", \"mapboxgl-ctrl-icon\", this._zoomOutButton).setAttribute(\"aria-hidden\", true);\n }\n if (this.options.showCompass) {\n performance2.bindAll([\"_rotateCompassArrow\"], this);\n this._compass = this._createButton(\"mapboxgl-ctrl-compass\", function(e) {\n if (this$1.options.visualizePitch) {\n this$1._map.resetNorthPitch({}, { originalEvent: e });\n } else {\n this$1._map.resetNorth({}, { originalEvent: e });\n }\n });\n this._compassIcon = DOM.create(\"span\", \"mapboxgl-ctrl-icon\", this._compass);\n this._compassIcon.setAttribute(\"aria-hidden\", true);\n }\n };\n NavigationControl.prototype._updateZoomButtons = function _updateZoomButtons() {\n var zoom = this._map.getZoom();\n var isMax = zoom === this._map.getMaxZoom();\n var isMin = zoom === this._map.getMinZoom();\n this._zoomInButton.disabled = isMax;\n this._zoomOutButton.disabled = isMin;\n this._zoomInButton.setAttribute(\"aria-disabled\", isMax.toString());\n this._zoomOutButton.setAttribute(\"aria-disabled\", isMin.toString());\n };\n NavigationControl.prototype._rotateCompassArrow = function _rotateCompassArrow() {\n var rotate = this.options.visualizePitch ? \"scale(\" + 1 / Math.pow(Math.cos(this._map.transform.pitch * (Math.PI / 180)), 0.5) + \") rotateX(\" + this._map.transform.pitch + \"deg) rotateZ(\" + this._map.transform.angle * (180 / Math.PI) + \"deg)\" : \"rotate(\" + this._map.transform.angle * (180 / Math.PI) + \"deg)\";\n this._compassIcon.style.transform = rotate;\n };\n NavigationControl.prototype.onAdd = function onAdd(map) {\n this._map = map;\n if (this.options.showZoom) {\n this._setButtonTitle(this._zoomInButton, \"ZoomIn\");\n this._setButtonTitle(this._zoomOutButton, \"ZoomOut\");\n this._map.on(\"zoom\", this._updateZoomButtons);\n this._updateZoomButtons();\n }\n if (this.options.showCompass) {\n this._setButtonTitle(this._compass, \"ResetBearing\");\n if (this.options.visualizePitch) {\n this._map.on(\"pitch\", this._rotateCompassArrow);\n }\n this._map.on(\"rotate\", this._rotateCompassArrow);\n this._rotateCompassArrow();\n this._handler = new MouseRotateWrapper(this._map, this._compass, this.options.visualizePitch);\n }\n return this._container;\n };\n NavigationControl.prototype.onRemove = function onRemove() {\n DOM.remove(this._container);\n if (this.options.showZoom) {\n this._map.off(\"zoom\", this._updateZoomButtons);\n }\n if (this.options.showCompass) {\n if (this.options.visualizePitch) {\n this._map.off(\"pitch\", this._rotateCompassArrow);\n }\n this._map.off(\"rotate\", this._rotateCompassArrow);\n this._handler.off();\n delete this._handler;\n }\n delete this._map;\n };\n NavigationControl.prototype._createButton = function _createButton(className, fn) {\n var a = DOM.create(\"button\", className, this._container);\n a.type = \"button\";\n a.addEventListener(\"click\", fn);\n return a;\n };\n NavigationControl.prototype._setButtonTitle = function _setButtonTitle(button, title) {\n var str = this._map._getUIString(\"NavigationControl.\" + title);\n button.title = str;\n button.setAttribute(\"aria-label\", str);\n };\n var MouseRotateWrapper = function MouseRotateWrapper2(map, element, pitch) {\n if (pitch === void 0)\n pitch = false;\n this._clickTolerance = 10;\n this.element = element;\n this.mouseRotate = new MouseRotateHandler({ clickTolerance: map.dragRotate._mouseRotate._clickTolerance });\n this.map = map;\n if (pitch) {\n this.mousePitch = new MousePitchHandler({ clickTolerance: map.dragRotate._mousePitch._clickTolerance });\n }\n performance2.bindAll([\n \"mousedown\",\n \"mousemove\",\n \"mouseup\",\n \"touchstart\",\n \"touchmove\",\n \"touchend\",\n \"reset\"\n ], this);\n DOM.addEventListener(element, \"mousedown\", this.mousedown);\n DOM.addEventListener(element, \"touchstart\", this.touchstart, { passive: false });\n DOM.addEventListener(element, \"touchmove\", this.touchmove);\n DOM.addEventListener(element, \"touchend\", this.touchend);\n DOM.addEventListener(element, \"touchcancel\", this.reset);\n };\n MouseRotateWrapper.prototype.down = function down(e, point) {\n this.mouseRotate.mousedown(e, point);\n if (this.mousePitch) {\n this.mousePitch.mousedown(e, point);\n }\n DOM.disableDrag();\n };\n MouseRotateWrapper.prototype.move = function move(e, point) {\n var map = this.map;\n var r = this.mouseRotate.mousemoveWindow(e, point);\n if (r && r.bearingDelta) {\n map.setBearing(map.getBearing() + r.bearingDelta);\n }\n if (this.mousePitch) {\n var p = this.mousePitch.mousemoveWindow(e, point);\n if (p && p.pitchDelta) {\n map.setPitch(map.getPitch() + p.pitchDelta);\n }\n }\n };\n MouseRotateWrapper.prototype.off = function off() {\n var element = this.element;\n DOM.removeEventListener(element, \"mousedown\", this.mousedown);\n DOM.removeEventListener(element, \"touchstart\", this.touchstart, { passive: false });\n DOM.removeEventListener(element, \"touchmove\", this.touchmove);\n DOM.removeEventListener(element, \"touchend\", this.touchend);\n DOM.removeEventListener(element, \"touchcancel\", this.reset);\n this.offTemp();\n };\n MouseRotateWrapper.prototype.offTemp = function offTemp() {\n DOM.enableDrag();\n DOM.removeEventListener(performance2.window, \"mousemove\", this.mousemove);\n DOM.removeEventListener(performance2.window, \"mouseup\", this.mouseup);\n };\n MouseRotateWrapper.prototype.mousedown = function mousedown(e) {\n this.down(performance2.extend({}, e, {\n ctrlKey: true,\n preventDefault: function() {\n return e.preventDefault();\n }\n }), DOM.mousePos(this.element, e));\n DOM.addEventListener(performance2.window, \"mousemove\", this.mousemove);\n DOM.addEventListener(performance2.window, \"mouseup\", this.mouseup);\n };\n MouseRotateWrapper.prototype.mousemove = function mousemove(e) {\n this.move(e, DOM.mousePos(this.element, e));\n };\n MouseRotateWrapper.prototype.mouseup = function mouseup(e) {\n this.mouseRotate.mouseupWindow(e);\n if (this.mousePitch) {\n this.mousePitch.mouseupWindow(e);\n }\n this.offTemp();\n };\n MouseRotateWrapper.prototype.touchstart = function touchstart(e) {\n if (e.targetTouches.length !== 1) {\n this.reset();\n } else {\n this._startPos = this._lastPos = DOM.touchPos(this.element, e.targetTouches)[0];\n this.down({\n type: \"mousedown\",\n button: 0,\n ctrlKey: true,\n preventDefault: function() {\n return e.preventDefault();\n }\n }, this._startPos);\n }\n };\n MouseRotateWrapper.prototype.touchmove = function touchmove(e) {\n if (e.targetTouches.length !== 1) {\n this.reset();\n } else {\n this._lastPos = DOM.touchPos(this.element, e.targetTouches)[0];\n this.move({\n preventDefault: function() {\n return e.preventDefault();\n }\n }, this._lastPos);\n }\n };\n MouseRotateWrapper.prototype.touchend = function touchend(e) {\n if (e.targetTouches.length === 0 && this._startPos && this._lastPos && this._startPos.dist(this._lastPos) < this._clickTolerance) {\n this.element.click();\n }\n this.reset();\n };\n MouseRotateWrapper.prototype.reset = function reset() {\n this.mouseRotate.reset();\n if (this.mousePitch) {\n this.mousePitch.reset();\n }\n delete this._startPos;\n delete this._lastPos;\n this.offTemp();\n };\n function smartWrap(lngLat, priorPos, transform) {\n lngLat = new performance2.LngLat(lngLat.lng, lngLat.lat);\n if (priorPos) {\n var left = new performance2.LngLat(lngLat.lng - 360, lngLat.lat);\n var right = new performance2.LngLat(lngLat.lng + 360, lngLat.lat);\n var delta = transform.locationPoint(lngLat).distSqr(priorPos);\n if (transform.locationPoint(left).distSqr(priorPos) < delta) {\n lngLat = left;\n } else if (transform.locationPoint(right).distSqr(priorPos) < delta) {\n lngLat = right;\n }\n }\n while (Math.abs(lngLat.lng - transform.center.lng) > 180) {\n var pos = transform.locationPoint(lngLat);\n if (pos.x >= 0 && pos.y >= 0 && pos.x <= transform.width && pos.y <= transform.height) {\n break;\n }\n if (lngLat.lng > transform.center.lng) {\n lngLat.lng -= 360;\n } else {\n lngLat.lng += 360;\n }\n }\n return lngLat;\n }\n var anchorTranslate = {\n \"center\": \"translate(-50%,-50%)\",\n \"top\": \"translate(-50%,0)\",\n \"top-left\": \"translate(0,0)\",\n \"top-right\": \"translate(-100%,0)\",\n \"bottom\": \"translate(-50%,-100%)\",\n \"bottom-left\": \"translate(0,-100%)\",\n \"bottom-right\": \"translate(-100%,-100%)\",\n \"left\": \"translate(0,-50%)\",\n \"right\": \"translate(-100%,-50%)\"\n };\n function applyAnchorClass(element, anchor, prefix) {\n var classList = element.classList;\n for (var key in anchorTranslate) {\n classList.remove(\"mapboxgl-\" + prefix + \"-anchor-\" + key);\n }\n classList.add(\"mapboxgl-\" + prefix + \"-anchor-\" + anchor);\n }\n var Marker = function(Evented) {\n function Marker2(options, legacyOptions) {\n Evented.call(this);\n if (options instanceof performance2.window.HTMLElement || legacyOptions) {\n options = performance2.extend({ element: options }, legacyOptions);\n }\n performance2.bindAll([\n \"_update\",\n \"_onMove\",\n \"_onUp\",\n \"_addDragHandler\",\n \"_onMapClick\",\n \"_onKeyPress\"\n ], this);\n this._anchor = options && options.anchor || \"center\";\n this._color = options && options.color || \"#3FB1CE\";\n this._scale = options && options.scale || 1;\n this._draggable = options && options.draggable || false;\n this._clickTolerance = options && options.clickTolerance || 0;\n this._isDragging = false;\n this._state = \"inactive\";\n this._rotation = options && options.rotation || 0;\n this._rotationAlignment = options && options.rotationAlignment || \"auto\";\n this._pitchAlignment = options && options.pitchAlignment && options.pitchAlignment !== \"auto\" ? options.pitchAlignment : this._rotationAlignment;\n if (!options || !options.element) {\n this._defaultMarker = true;\n this._element = DOM.create(\"div\");\n this._element.setAttribute(\"aria-label\", \"Map marker\");\n var svg = DOM.createNS(\"http://www.w3.org/2000/svg\", \"svg\");\n var defaultHeight = 41;\n var defaultWidth = 27;\n svg.setAttributeNS(null, \"display\", \"block\");\n svg.setAttributeNS(null, \"height\", defaultHeight + \"px\");\n svg.setAttributeNS(null, \"width\", defaultWidth + \"px\");\n svg.setAttributeNS(null, \"viewBox\", \"0 0 \" + defaultWidth + \" \" + defaultHeight);\n var markerLarge = DOM.createNS(\"http://www.w3.org/2000/svg\", \"g\");\n markerLarge.setAttributeNS(null, \"stroke\", \"none\");\n markerLarge.setAttributeNS(null, \"stroke-width\", \"1\");\n markerLarge.setAttributeNS(null, \"fill\", \"none\");\n markerLarge.setAttributeNS(null, \"fill-rule\", \"evenodd\");\n var page1 = DOM.createNS(\"http://www.w3.org/2000/svg\", \"g\");\n page1.setAttributeNS(null, \"fill-rule\", \"nonzero\");\n var shadow = DOM.createNS(\"http://www.w3.org/2000/svg\", \"g\");\n shadow.setAttributeNS(null, \"transform\", \"translate(3.0, 29.0)\");\n shadow.setAttributeNS(null, \"fill\", \"#000000\");\n var ellipses = [\n {\n \"rx\": \"10.5\",\n \"ry\": \"5.25002273\"\n },\n {\n \"rx\": \"10.5\",\n \"ry\": \"5.25002273\"\n },\n {\n \"rx\": \"9.5\",\n \"ry\": \"4.77275007\"\n },\n {\n \"rx\": \"8.5\",\n \"ry\": \"4.29549936\"\n },\n {\n \"rx\": \"7.5\",\n \"ry\": \"3.81822308\"\n },\n {\n \"rx\": \"6.5\",\n \"ry\": \"3.34094679\"\n },\n {\n \"rx\": \"5.5\",\n \"ry\": \"2.86367051\"\n },\n {\n \"rx\": \"4.5\",\n \"ry\": \"2.38636864\"\n }\n ];\n for (var i = 0, list = ellipses; i < list.length; i += 1) {\n var data = list[i];\n var ellipse = DOM.createNS(\"http://www.w3.org/2000/svg\", \"ellipse\");\n ellipse.setAttributeNS(null, \"opacity\", \"0.04\");\n ellipse.setAttributeNS(null, \"cx\", \"10.5\");\n ellipse.setAttributeNS(null, \"cy\", \"5.80029008\");\n ellipse.setAttributeNS(null, \"rx\", data[\"rx\"]);\n ellipse.setAttributeNS(null, \"ry\", data[\"ry\"]);\n shadow.appendChild(ellipse);\n }\n var background2 = DOM.createNS(\"http://www.w3.org/2000/svg\", \"g\");\n background2.setAttributeNS(null, \"fill\", this._color);\n var bgPath = DOM.createNS(\"http://www.w3.org/2000/svg\", \"path\");\n bgPath.setAttributeNS(null, \"d\", \"M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z\");\n background2.appendChild(bgPath);\n var border = DOM.createNS(\"http://www.w3.org/2000/svg\", \"g\");\n border.setAttributeNS(null, \"opacity\", \"0.25\");\n border.setAttributeNS(null, \"fill\", \"#000000\");\n var borderPath = DOM.createNS(\"http://www.w3.org/2000/svg\", \"path\");\n borderPath.setAttributeNS(null, \"d\", \"M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z\");\n border.appendChild(borderPath);\n var maki = DOM.createNS(\"http://www.w3.org/2000/svg\", \"g\");\n maki.setAttributeNS(null, \"transform\", \"translate(6.0, 7.0)\");\n maki.setAttributeNS(null, \"fill\", \"#FFFFFF\");\n var circleContainer = DOM.createNS(\"http://www.w3.org/2000/svg\", \"g\");\n circleContainer.setAttributeNS(null, \"transform\", \"translate(8.0, 8.0)\");\n var circle1 = DOM.createNS(\"http://www.w3.org/2000/svg\", \"circle\");\n circle1.setAttributeNS(null, \"fill\", \"#000000\");\n circle1.setAttributeNS(null, \"opacity\", \"0.25\");\n circle1.setAttributeNS(null, \"cx\", \"5.5\");\n circle1.setAttributeNS(null, \"cy\", \"5.5\");\n circle1.setAttributeNS(null, \"r\", \"5.4999962\");\n var circle2 = DOM.createNS(\"http://www.w3.org/2000/svg\", \"circle\");\n circle2.setAttributeNS(null, \"fill\", \"#FFFFFF\");\n circle2.setAttributeNS(null, \"cx\", \"5.5\");\n circle2.setAttributeNS(null, \"cy\", \"5.5\");\n circle2.setAttributeNS(null, \"r\", \"5.4999962\");\n circleContainer.appendChild(circle1);\n circleContainer.appendChild(circle2);\n page1.appendChild(shadow);\n page1.appendChild(background2);\n page1.appendChild(border);\n page1.appendChild(maki);\n page1.appendChild(circleContainer);\n svg.appendChild(page1);\n svg.setAttributeNS(null, \"height\", defaultHeight * this._scale + \"px\");\n svg.setAttributeNS(null, \"width\", defaultWidth * this._scale + \"px\");\n this._element.appendChild(svg);\n this._offset = performance2.Point.convert(options && options.offset || [\n 0,\n -14\n ]);\n } else {\n this._element = options.element;\n this._offset = performance2.Point.convert(options && options.offset || [\n 0,\n 0\n ]);\n }\n this._element.classList.add(\"mapboxgl-marker\");\n this._element.addEventListener(\"dragstart\", function(e) {\n e.preventDefault();\n });\n this._element.addEventListener(\"mousedown\", function(e) {\n e.preventDefault();\n });\n applyAnchorClass(this._element, this._anchor, \"marker\");\n this._popup = null;\n }\n if (Evented)\n Marker2.__proto__ = Evented;\n Marker2.prototype = Object.create(Evented && Evented.prototype);\n Marker2.prototype.constructor = Marker2;\n Marker2.prototype.addTo = function addTo(map) {\n this.remove();\n this._map = map;\n map.getCanvasContainer().appendChild(this._element);\n map.on(\"move\", this._update);\n map.on(\"moveend\", this._update);\n this.setDraggable(this._draggable);\n this._update();\n this._map.on(\"click\", this._onMapClick);\n return this;\n };\n Marker2.prototype.remove = function remove() {\n if (this._map) {\n this._map.off(\"click\", this._onMapClick);\n this._map.off(\"move\", this._update);\n this._map.off(\"moveend\", this._update);\n this._map.off(\"mousedown\", this._addDragHandler);\n this._map.off(\"touchstart\", this._addDragHandler);\n this._map.off(\"mouseup\", this._onUp);\n this._map.off(\"touchend\", this._onUp);\n this._map.off(\"mousemove\", this._onMove);\n this._map.off(\"touchmove\", this._onMove);\n delete this._map;\n }\n DOM.remove(this._element);\n if (this._popup) {\n this._popup.remove();\n }\n return this;\n };\n Marker2.prototype.getLngLat = function getLngLat() {\n return this._lngLat;\n };\n Marker2.prototype.setLngLat = function setLngLat(lnglat) {\n this._lngLat = performance2.LngLat.convert(lnglat);\n this._pos = null;\n if (this._popup) {\n this._popup.setLngLat(this._lngLat);\n }\n this._update();\n return this;\n };\n Marker2.prototype.getElement = function getElement() {\n return this._element;\n };\n Marker2.prototype.setPopup = function setPopup(popup) {\n if (this._popup) {\n this._popup.remove();\n this._popup = null;\n this._element.removeEventListener(\"keypress\", this._onKeyPress);\n if (!this._originalTabIndex) {\n this._element.removeAttribute(\"tabindex\");\n }\n }\n if (popup) {\n if (!(\"offset\" in popup.options)) {\n var markerHeight = 41 - 5.8 / 2;\n var markerRadius = 13.5;\n var linearOffset = Math.sqrt(Math.pow(markerRadius, 2) / 2);\n popup.options.offset = this._defaultMarker ? {\n \"top\": [\n 0,\n 0\n ],\n \"top-left\": [\n 0,\n 0\n ],\n \"top-right\": [\n 0,\n 0\n ],\n \"bottom\": [\n 0,\n -markerHeight\n ],\n \"bottom-left\": [\n linearOffset,\n (markerHeight - markerRadius + linearOffset) * -1\n ],\n \"bottom-right\": [\n -linearOffset,\n (markerHeight - markerRadius + linearOffset) * -1\n ],\n \"left\": [\n markerRadius,\n (markerHeight - markerRadius) * -1\n ],\n \"right\": [\n -markerRadius,\n (markerHeight - markerRadius) * -1\n ]\n } : this._offset;\n }\n this._popup = popup;\n if (this._lngLat) {\n this._popup.setLngLat(this._lngLat);\n }\n this._originalTabIndex = this._element.getAttribute(\"tabindex\");\n if (!this._originalTabIndex) {\n this._element.setAttribute(\"tabindex\", \"0\");\n }\n this._element.addEventListener(\"keypress\", this._onKeyPress);\n }\n return this;\n };\n Marker2.prototype._onKeyPress = function _onKeyPress(e) {\n var code = e.code;\n var legacyCode = e.charCode || e.keyCode;\n if (code === \"Space\" || code === \"Enter\" || legacyCode === 32 || legacyCode === 13) {\n this.togglePopup();\n }\n };\n Marker2.prototype._onMapClick = function _onMapClick(e) {\n var targetElement = e.originalEvent.target;\n var element = this._element;\n if (this._popup && (targetElement === element || element.contains(targetElement))) {\n this.togglePopup();\n }\n };\n Marker2.prototype.getPopup = function getPopup() {\n return this._popup;\n };\n Marker2.prototype.togglePopup = function togglePopup() {\n var popup = this._popup;\n if (!popup) {\n return this;\n } else if (popup.isOpen()) {\n popup.remove();\n } else {\n popup.addTo(this._map);\n }\n return this;\n };\n Marker2.prototype._update = function _update(e) {\n if (!this._map) {\n return;\n }\n if (this._map.transform.renderWorldCopies) {\n this._lngLat = smartWrap(this._lngLat, this._pos, this._map.transform);\n }\n this._pos = this._map.project(this._lngLat)._add(this._offset);\n var rotation = \"\";\n if (this._rotationAlignment === \"viewport\" || this._rotationAlignment === \"auto\") {\n rotation = \"rotateZ(\" + this._rotation + \"deg)\";\n } else if (this._rotationAlignment === \"map\") {\n rotation = \"rotateZ(\" + (this._rotation - this._map.getBearing()) + \"deg)\";\n }\n var pitch = \"\";\n if (this._pitchAlignment === \"viewport\" || this._pitchAlignment === \"auto\") {\n pitch = \"rotateX(0deg)\";\n } else if (this._pitchAlignment === \"map\") {\n pitch = \"rotateX(\" + this._map.getPitch() + \"deg)\";\n }\n if (!e || e.type === \"moveend\") {\n this._pos = this._pos.round();\n }\n DOM.setTransform(this._element, anchorTranslate[this._anchor] + \" translate(\" + this._pos.x + \"px, \" + this._pos.y + \"px) \" + pitch + \" \" + rotation);\n };\n Marker2.prototype.getOffset = function getOffset() {\n return this._offset;\n };\n Marker2.prototype.setOffset = function setOffset(offset) {\n this._offset = performance2.Point.convert(offset);\n this._update();\n return this;\n };\n Marker2.prototype._onMove = function _onMove(e) {\n if (!this._isDragging) {\n var clickTolerance = this._clickTolerance || this._map._clickTolerance;\n this._isDragging = e.point.dist(this._pointerdownPos) >= clickTolerance;\n }\n if (!this._isDragging) {\n return;\n }\n this._pos = e.point.sub(this._positionDelta);\n this._lngLat = this._map.unproject(this._pos);\n this.setLngLat(this._lngLat);\n this._element.style.pointerEvents = \"none\";\n if (this._state === \"pending\") {\n this._state = \"active\";\n this.fire(new performance2.Event(\"dragstart\"));\n }\n this.fire(new performance2.Event(\"drag\"));\n };\n Marker2.prototype._onUp = function _onUp() {\n this._element.style.pointerEvents = \"auto\";\n this._positionDelta = null;\n this._pointerdownPos = null;\n this._isDragging = false;\n this._map.off(\"mousemove\", this._onMove);\n this._map.off(\"touchmove\", this._onMove);\n if (this._state === \"active\") {\n this.fire(new performance2.Event(\"dragend\"));\n }\n this._state = \"inactive\";\n };\n Marker2.prototype._addDragHandler = function _addDragHandler(e) {\n if (this._element.contains(e.originalEvent.target)) {\n e.preventDefault();\n this._positionDelta = e.point.sub(this._pos).add(this._offset);\n this._pointerdownPos = e.point;\n this._state = \"pending\";\n this._map.on(\"mousemove\", this._onMove);\n this._map.on(\"touchmove\", this._onMove);\n this._map.once(\"mouseup\", this._onUp);\n this._map.once(\"touchend\", this._onUp);\n }\n };\n Marker2.prototype.setDraggable = function setDraggable(shouldBeDraggable) {\n this._draggable = !!shouldBeDraggable;\n if (this._map) {\n if (shouldBeDraggable) {\n this._map.on(\"mousedown\", this._addDragHandler);\n this._map.on(\"touchstart\", this._addDragHandler);\n } else {\n this._map.off(\"mousedown\", this._addDragHandler);\n this._map.off(\"touchstart\", this._addDragHandler);\n }\n }\n return this;\n };\n Marker2.prototype.isDraggable = function isDraggable() {\n return this._draggable;\n };\n Marker2.prototype.setRotation = function setRotation(rotation) {\n this._rotation = rotation || 0;\n this._update();\n return this;\n };\n Marker2.prototype.getRotation = function getRotation() {\n return this._rotation;\n };\n Marker2.prototype.setRotationAlignment = function setRotationAlignment(alignment) {\n this._rotationAlignment = alignment || \"auto\";\n this._update();\n return this;\n };\n Marker2.prototype.getRotationAlignment = function getRotationAlignment() {\n return this._rotationAlignment;\n };\n Marker2.prototype.setPitchAlignment = function setPitchAlignment(alignment) {\n this._pitchAlignment = alignment && alignment !== \"auto\" ? alignment : this._rotationAlignment;\n this._update();\n return this;\n };\n Marker2.prototype.getPitchAlignment = function getPitchAlignment() {\n return this._pitchAlignment;\n };\n return Marker2;\n }(performance2.Evented);\n var defaultOptions$3 = {\n positionOptions: {\n enableHighAccuracy: false,\n maximumAge: 0,\n timeout: 6e3\n },\n fitBoundsOptions: { maxZoom: 15 },\n trackUserLocation: false,\n showAccuracyCircle: true,\n showUserLocation: true\n };\n var supportsGeolocation;\n function checkGeolocationSupport(callback) {\n if (supportsGeolocation !== void 0) {\n callback(supportsGeolocation);\n } else if (performance2.window.navigator.permissions !== void 0) {\n performance2.window.navigator.permissions.query({ name: \"geolocation\" }).then(function(p) {\n supportsGeolocation = p.state !== \"denied\";\n callback(supportsGeolocation);\n });\n } else {\n supportsGeolocation = !!performance2.window.navigator.geolocation;\n callback(supportsGeolocation);\n }\n }\n var numberOfWatches = 0;\n var noTimeout = false;\n var GeolocateControl = function(Evented) {\n function GeolocateControl2(options) {\n Evented.call(this);\n this.options = performance2.extend({}, defaultOptions$3, options);\n performance2.bindAll([\n \"_onSuccess\",\n \"_onError\",\n \"_onZoom\",\n \"_finish\",\n \"_setupUI\",\n \"_updateCamera\",\n \"_updateMarker\"\n ], this);\n }\n if (Evented)\n GeolocateControl2.__proto__ = Evented;\n GeolocateControl2.prototype = Object.create(Evented && Evented.prototype);\n GeolocateControl2.prototype.constructor = GeolocateControl2;\n GeolocateControl2.prototype.onAdd = function onAdd(map) {\n this._map = map;\n this._container = DOM.create(\"div\", \"mapboxgl-ctrl mapboxgl-ctrl-group\");\n checkGeolocationSupport(this._setupUI);\n return this._container;\n };\n GeolocateControl2.prototype.onRemove = function onRemove() {\n if (this._geolocationWatchID !== void 0) {\n performance2.window.navigator.geolocation.clearWatch(this._geolocationWatchID);\n this._geolocationWatchID = void 0;\n }\n if (this.options.showUserLocation && this._userLocationDotMarker) {\n this._userLocationDotMarker.remove();\n }\n if (this.options.showAccuracyCircle && this._accuracyCircleMarker) {\n this._accuracyCircleMarker.remove();\n }\n DOM.remove(this._container);\n this._map.off(\"zoom\", this._onZoom);\n this._map = void 0;\n numberOfWatches = 0;\n noTimeout = false;\n };\n GeolocateControl2.prototype._isOutOfMapMaxBounds = function _isOutOfMapMaxBounds(position) {\n var bounds = this._map.getMaxBounds();\n var coordinates = position.coords;\n return bounds && (coordinates.longitude < bounds.getWest() || coordinates.longitude > bounds.getEast() || coordinates.latitude < bounds.getSouth() || coordinates.latitude > bounds.getNorth());\n };\n GeolocateControl2.prototype._setErrorState = function _setErrorState() {\n switch (this._watchState) {\n case \"WAITING_ACTIVE\":\n this._watchState = \"ACTIVE_ERROR\";\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-active\");\n this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-active-error\");\n break;\n case \"ACTIVE_LOCK\":\n this._watchState = \"ACTIVE_ERROR\";\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-active\");\n this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-active-error\");\n this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-waiting\");\n break;\n case \"BACKGROUND\":\n this._watchState = \"BACKGROUND_ERROR\";\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-background\");\n this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-background-error\");\n this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-waiting\");\n break;\n }\n };\n GeolocateControl2.prototype._onSuccess = function _onSuccess(position) {\n if (!this._map) {\n return;\n }\n if (this._isOutOfMapMaxBounds(position)) {\n this._setErrorState();\n this.fire(new performance2.Event(\"outofmaxbounds\", position));\n this._updateMarker();\n this._finish();\n return;\n }\n if (this.options.trackUserLocation) {\n this._lastKnownPosition = position;\n switch (this._watchState) {\n case \"WAITING_ACTIVE\":\n case \"ACTIVE_LOCK\":\n case \"ACTIVE_ERROR\":\n this._watchState = \"ACTIVE_LOCK\";\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-waiting\");\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-active-error\");\n this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-active\");\n break;\n case \"BACKGROUND\":\n case \"BACKGROUND_ERROR\":\n this._watchState = \"BACKGROUND\";\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-waiting\");\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-background-error\");\n this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-background\");\n break;\n }\n }\n if (this.options.showUserLocation && this._watchState !== \"OFF\") {\n this._updateMarker(position);\n }\n if (!this.options.trackUserLocation || this._watchState === \"ACTIVE_LOCK\") {\n this._updateCamera(position);\n }\n if (this.options.showUserLocation) {\n this._dotElement.classList.remove(\"mapboxgl-user-location-dot-stale\");\n }\n this.fire(new performance2.Event(\"geolocate\", position));\n this._finish();\n };\n GeolocateControl2.prototype._updateCamera = function _updateCamera(position) {\n var center = new performance2.LngLat(position.coords.longitude, position.coords.latitude);\n var radius = position.coords.accuracy;\n var bearing = this._map.getBearing();\n var options = performance2.extend({ bearing }, this.options.fitBoundsOptions);\n this._map.fitBounds(center.toBounds(radius), options, { geolocateSource: true });\n };\n GeolocateControl2.prototype._updateMarker = function _updateMarker(position) {\n if (position) {\n var center = new performance2.LngLat(position.coords.longitude, position.coords.latitude);\n this._accuracyCircleMarker.setLngLat(center).addTo(this._map);\n this._userLocationDotMarker.setLngLat(center).addTo(this._map);\n this._accuracy = position.coords.accuracy;\n if (this.options.showUserLocation && this.options.showAccuracyCircle) {\n this._updateCircleRadius();\n }\n } else {\n this._userLocationDotMarker.remove();\n this._accuracyCircleMarker.remove();\n }\n };\n GeolocateControl2.prototype._updateCircleRadius = function _updateCircleRadius() {\n var y = this._map._container.clientHeight / 2;\n var a = this._map.unproject([\n 0,\n y\n ]);\n var b = this._map.unproject([\n 1,\n y\n ]);\n var metersPerPixel = a.distanceTo(b);\n var circleDiameter = Math.ceil(2 * this._accuracy / metersPerPixel);\n this._circleElement.style.width = circleDiameter + \"px\";\n this._circleElement.style.height = circleDiameter + \"px\";\n };\n GeolocateControl2.prototype._onZoom = function _onZoom() {\n if (this.options.showUserLocation && this.options.showAccuracyCircle) {\n this._updateCircleRadius();\n }\n };\n GeolocateControl2.prototype._onError = function _onError(error) {\n if (!this._map) {\n return;\n }\n if (this.options.trackUserLocation) {\n if (error.code === 1) {\n this._watchState = \"OFF\";\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-waiting\");\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-active\");\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-active-error\");\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-background\");\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-background-error\");\n this._geolocateButton.disabled = true;\n var title = this._map._getUIString(\"GeolocateControl.LocationNotAvailable\");\n this._geolocateButton.title = title;\n this._geolocateButton.setAttribute(\"aria-label\", title);\n if (this._geolocationWatchID !== void 0) {\n this._clearWatch();\n }\n } else if (error.code === 3 && noTimeout) {\n return;\n } else {\n this._setErrorState();\n }\n }\n if (this._watchState !== \"OFF\" && this.options.showUserLocation) {\n this._dotElement.classList.add(\"mapboxgl-user-location-dot-stale\");\n }\n this.fire(new performance2.Event(\"error\", error));\n this._finish();\n };\n GeolocateControl2.prototype._finish = function _finish() {\n if (this._timeoutId) {\n clearTimeout(this._timeoutId);\n }\n this._timeoutId = void 0;\n };\n GeolocateControl2.prototype._setupUI = function _setupUI(supported) {\n var this$1 = this;\n this._container.addEventListener(\"contextmenu\", function(e) {\n return e.preventDefault();\n });\n this._geolocateButton = DOM.create(\"button\", \"mapboxgl-ctrl-geolocate\", this._container);\n DOM.create(\"span\", \"mapboxgl-ctrl-icon\", this._geolocateButton).setAttribute(\"aria-hidden\", true);\n this._geolocateButton.type = \"button\";\n if (supported === false) {\n performance2.warnOnce(\"Geolocation support is not available so the GeolocateControl will be disabled.\");\n var title = this._map._getUIString(\"GeolocateControl.LocationNotAvailable\");\n this._geolocateButton.disabled = true;\n this._geolocateButton.title = title;\n this._geolocateButton.setAttribute(\"aria-label\", title);\n } else {\n var title$1 = this._map._getUIString(\"GeolocateControl.FindMyLocation\");\n this._geolocateButton.title = title$1;\n this._geolocateButton.setAttribute(\"aria-label\", title$1);\n }\n if (this.options.trackUserLocation) {\n this._geolocateButton.setAttribute(\"aria-pressed\", \"false\");\n this._watchState = \"OFF\";\n }\n if (this.options.showUserLocation) {\n this._dotElement = DOM.create(\"div\", \"mapboxgl-user-location-dot\");\n this._userLocationDotMarker = new Marker(this._dotElement);\n this._circleElement = DOM.create(\"div\", \"mapboxgl-user-location-accuracy-circle\");\n this._accuracyCircleMarker = new Marker({\n element: this._circleElement,\n pitchAlignment: \"map\"\n });\n if (this.options.trackUserLocation) {\n this._watchState = \"OFF\";\n }\n this._map.on(\"zoom\", this._onZoom);\n }\n this._geolocateButton.addEventListener(\"click\", this.trigger.bind(this));\n this._setup = true;\n if (this.options.trackUserLocation) {\n this._map.on(\"movestart\", function(event) {\n var fromResize = event.originalEvent && event.originalEvent.type === \"resize\";\n if (!event.geolocateSource && this$1._watchState === \"ACTIVE_LOCK\" && !fromResize) {\n this$1._watchState = \"BACKGROUND\";\n this$1._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-background\");\n this$1._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-active\");\n this$1.fire(new performance2.Event(\"trackuserlocationend\"));\n }\n });\n }\n };\n GeolocateControl2.prototype.trigger = function trigger() {\n if (!this._setup) {\n performance2.warnOnce(\"Geolocate control triggered before added to a map\");\n return false;\n }\n if (this.options.trackUserLocation) {\n switch (this._watchState) {\n case \"OFF\":\n this._watchState = \"WAITING_ACTIVE\";\n this.fire(new performance2.Event(\"trackuserlocationstart\"));\n break;\n case \"WAITING_ACTIVE\":\n case \"ACTIVE_LOCK\":\n case \"ACTIVE_ERROR\":\n case \"BACKGROUND_ERROR\":\n numberOfWatches--;\n noTimeout = false;\n this._watchState = \"OFF\";\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-waiting\");\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-active\");\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-active-error\");\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-background\");\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-background-error\");\n this.fire(new performance2.Event(\"trackuserlocationend\"));\n break;\n case \"BACKGROUND\":\n this._watchState = \"ACTIVE_LOCK\";\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-background\");\n if (this._lastKnownPosition) {\n this._updateCamera(this._lastKnownPosition);\n }\n this.fire(new performance2.Event(\"trackuserlocationstart\"));\n break;\n }\n switch (this._watchState) {\n case \"WAITING_ACTIVE\":\n this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-waiting\");\n this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-active\");\n break;\n case \"ACTIVE_LOCK\":\n this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-active\");\n break;\n case \"ACTIVE_ERROR\":\n this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-waiting\");\n this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-active-error\");\n break;\n case \"BACKGROUND\":\n this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-background\");\n break;\n case \"BACKGROUND_ERROR\":\n this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-waiting\");\n this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-background-error\");\n break;\n }\n if (this._watchState === \"OFF\" && this._geolocationWatchID !== void 0) {\n this._clearWatch();\n } else if (this._geolocationWatchID === void 0) {\n this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-waiting\");\n this._geolocateButton.setAttribute(\"aria-pressed\", \"true\");\n numberOfWatches++;\n var positionOptions;\n if (numberOfWatches > 1) {\n positionOptions = {\n maximumAge: 6e5,\n timeout: 0\n };\n noTimeout = true;\n } else {\n positionOptions = this.options.positionOptions;\n noTimeout = false;\n }\n this._geolocationWatchID = performance2.window.navigator.geolocation.watchPosition(this._onSuccess, this._onError, positionOptions);\n }\n } else {\n performance2.window.navigator.geolocation.getCurrentPosition(this._onSuccess, this._onError, this.options.positionOptions);\n this._timeoutId = setTimeout(this._finish, 1e4);\n }\n return true;\n };\n GeolocateControl2.prototype._clearWatch = function _clearWatch() {\n performance2.window.navigator.geolocation.clearWatch(this._geolocationWatchID);\n this._geolocationWatchID = void 0;\n this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-waiting\");\n this._geolocateButton.setAttribute(\"aria-pressed\", \"false\");\n if (this.options.showUserLocation) {\n this._updateMarker(null);\n }\n };\n return GeolocateControl2;\n }(performance2.Evented);\n var defaultOptions$4 = {\n maxWidth: 100,\n unit: \"metric\"\n };\n var ScaleControl = function ScaleControl2(options) {\n this.options = performance2.extend({}, defaultOptions$4, options);\n performance2.bindAll([\n \"_onMove\",\n \"setUnit\"\n ], this);\n };\n ScaleControl.prototype.getDefaultPosition = function getDefaultPosition() {\n return \"bottom-left\";\n };\n ScaleControl.prototype._onMove = function _onMove() {\n updateScale(this._map, this._container, this.options);\n };\n ScaleControl.prototype.onAdd = function onAdd(map) {\n this._map = map;\n this._container = DOM.create(\"div\", \"mapboxgl-ctrl mapboxgl-ctrl-scale\", map.getContainer());\n this._map.on(\"move\", this._onMove);\n this._onMove();\n return this._container;\n };\n ScaleControl.prototype.onRemove = function onRemove() {\n DOM.remove(this._container);\n this._map.off(\"move\", this._onMove);\n this._map = void 0;\n };\n ScaleControl.prototype.setUnit = function setUnit(unit) {\n this.options.unit = unit;\n updateScale(this._map, this._container, this.options);\n };\n function updateScale(map, container, options) {\n var maxWidth = options && options.maxWidth || 100;\n var y = map._container.clientHeight / 2;\n var left = map.unproject([\n 0,\n y\n ]);\n var right = map.unproject([\n maxWidth,\n y\n ]);\n var maxMeters = left.distanceTo(right);\n if (options && options.unit === \"imperial\") {\n var maxFeet = 3.2808 * maxMeters;\n if (maxFeet > 5280) {\n var maxMiles = maxFeet / 5280;\n setScale(container, maxWidth, maxMiles, map._getUIString(\"ScaleControl.Miles\"));\n } else {\n setScale(container, maxWidth, maxFeet, map._getUIString(\"ScaleControl.Feet\"));\n }\n } else if (options && options.unit === \"nautical\") {\n var maxNauticals = maxMeters / 1852;\n setScale(container, maxWidth, maxNauticals, map._getUIString(\"ScaleControl.NauticalMiles\"));\n } else if (maxMeters >= 1e3) {\n setScale(container, maxWidth, maxMeters / 1e3, map._getUIString(\"ScaleControl.Kilometers\"));\n } else {\n setScale(container, maxWidth, maxMeters, map._getUIString(\"ScaleControl.Meters\"));\n }\n }\n function setScale(container, maxWidth, maxDistance, unit) {\n var distance = getRoundNum(maxDistance);\n var ratio = distance / maxDistance;\n container.style.width = maxWidth * ratio + \"px\";\n container.innerHTML = distance + \" \" + unit;\n }\n function getDecimalRoundNum(d) {\n var multiplier = Math.pow(10, Math.ceil(-Math.log(d) / Math.LN10));\n return Math.round(d * multiplier) / multiplier;\n }\n function getRoundNum(num) {\n var pow10 = Math.pow(10, (\"\" + Math.floor(num)).length - 1);\n var d = num / pow10;\n d = d >= 10 ? 10 : d >= 5 ? 5 : d >= 3 ? 3 : d >= 2 ? 2 : d >= 1 ? 1 : getDecimalRoundNum(d);\n return pow10 * d;\n }\n var FullscreenControl = function FullscreenControl2(options) {\n this._fullscreen = false;\n if (options && options.container) {\n if (options.container instanceof performance2.window.HTMLElement) {\n this._container = options.container;\n } else {\n performance2.warnOnce(\"Full screen control 'container' must be a DOM element.\");\n }\n }\n performance2.bindAll([\n \"_onClickFullscreen\",\n \"_changeIcon\"\n ], this);\n if (\"onfullscreenchange\" in performance2.window.document) {\n this._fullscreenchange = \"fullscreenchange\";\n } else if (\"onmozfullscreenchange\" in performance2.window.document) {\n this._fullscreenchange = \"mozfullscreenchange\";\n } else if (\"onwebkitfullscreenchange\" in performance2.window.document) {\n this._fullscreenchange = \"webkitfullscreenchange\";\n } else if (\"onmsfullscreenchange\" in performance2.window.document) {\n this._fullscreenchange = \"MSFullscreenChange\";\n }\n };\n FullscreenControl.prototype.onAdd = function onAdd(map) {\n this._map = map;\n if (!this._container) {\n this._container = this._map.getContainer();\n }\n this._controlContainer = DOM.create(\"div\", \"mapboxgl-ctrl mapboxgl-ctrl-group\");\n if (this._checkFullscreenSupport()) {\n this._setupUI();\n } else {\n this._controlContainer.style.display = \"none\";\n performance2.warnOnce(\"This device does not support fullscreen mode.\");\n }\n return this._controlContainer;\n };\n FullscreenControl.prototype.onRemove = function onRemove() {\n DOM.remove(this._controlContainer);\n this._map = null;\n performance2.window.document.removeEventListener(this._fullscreenchange, this._changeIcon);\n };\n FullscreenControl.prototype._checkFullscreenSupport = function _checkFullscreenSupport() {\n return !!(performance2.window.document.fullscreenEnabled || performance2.window.document.mozFullScreenEnabled || performance2.window.document.msFullscreenEnabled || performance2.window.document.webkitFullscreenEnabled);\n };\n FullscreenControl.prototype._setupUI = function _setupUI() {\n var button = this._fullscreenButton = DOM.create(\"button\", \"mapboxgl-ctrl-fullscreen\", this._controlContainer);\n DOM.create(\"span\", \"mapboxgl-ctrl-icon\", button).setAttribute(\"aria-hidden\", true);\n button.type = \"button\";\n this._updateTitle();\n this._fullscreenButton.addEventListener(\"click\", this._onClickFullscreen);\n performance2.window.document.addEventListener(this._fullscreenchange, this._changeIcon);\n };\n FullscreenControl.prototype._updateTitle = function _updateTitle() {\n var title = this._getTitle();\n this._fullscreenButton.setAttribute(\"aria-label\", title);\n this._fullscreenButton.title = title;\n };\n FullscreenControl.prototype._getTitle = function _getTitle() {\n return this._map._getUIString(this._isFullscreen() ? \"FullscreenControl.Exit\" : \"FullscreenControl.Enter\");\n };\n FullscreenControl.prototype._isFullscreen = function _isFullscreen() {\n return this._fullscreen;\n };\n FullscreenControl.prototype._changeIcon = function _changeIcon() {\n var fullscreenElement = performance2.window.document.fullscreenElement || performance2.window.document.mozFullScreenElement || performance2.window.document.webkitFullscreenElement || performance2.window.document.msFullscreenElement;\n if (fullscreenElement === this._container !== this._fullscreen) {\n this._fullscreen = !this._fullscreen;\n this._fullscreenButton.classList.toggle(\"mapboxgl-ctrl-shrink\");\n this._fullscreenButton.classList.toggle(\"mapboxgl-ctrl-fullscreen\");\n this._updateTitle();\n }\n };\n FullscreenControl.prototype._onClickFullscreen = function _onClickFullscreen() {\n if (this._isFullscreen()) {\n if (performance2.window.document.exitFullscreen) {\n performance2.window.document.exitFullscreen();\n } else if (performance2.window.document.mozCancelFullScreen) {\n performance2.window.document.mozCancelFullScreen();\n } else if (performance2.window.document.msExitFullscreen) {\n performance2.window.document.msExitFullscreen();\n } else if (performance2.window.document.webkitCancelFullScreen) {\n performance2.window.document.webkitCancelFullScreen();\n }\n } else if (this._container.requestFullscreen) {\n this._container.requestFullscreen();\n } else if (this._container.mozRequestFullScreen) {\n this._container.mozRequestFullScreen();\n } else if (this._container.msRequestFullscreen) {\n this._container.msRequestFullscreen();\n } else if (this._container.webkitRequestFullscreen) {\n this._container.webkitRequestFullscreen();\n }\n };\n var defaultOptions$5 = {\n closeButton: true,\n closeOnClick: true,\n focusAfterOpen: true,\n className: \"\",\n maxWidth: \"240px\"\n };\n var focusQuerySelector = [\n \"a[href]\",\n \"[tabindex]:not([tabindex='-1'])\",\n \"[contenteditable]:not([contenteditable='false'])\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\"\n ].join(\", \");\n var Popup = function(Evented) {\n function Popup2(options) {\n Evented.call(this);\n this.options = performance2.extend(Object.create(defaultOptions$5), options);\n performance2.bindAll([\n \"_update\",\n \"_onClose\",\n \"remove\",\n \"_onMouseMove\",\n \"_onMouseUp\",\n \"_onDrag\"\n ], this);\n }\n if (Evented)\n Popup2.__proto__ = Evented;\n Popup2.prototype = Object.create(Evented && Evented.prototype);\n Popup2.prototype.constructor = Popup2;\n Popup2.prototype.addTo = function addTo(map) {\n if (this._map) {\n this.remove();\n }\n this._map = map;\n if (this.options.closeOnClick) {\n this._map.on(\"click\", this._onClose);\n }\n if (this.options.closeOnMove) {\n this._map.on(\"move\", this._onClose);\n }\n this._map.on(\"remove\", this.remove);\n this._update();\n this._focusFirstElement();\n if (this._trackPointer) {\n this._map.on(\"mousemove\", this._onMouseMove);\n this._map.on(\"mouseup\", this._onMouseUp);\n if (this._container) {\n this._container.classList.add(\"mapboxgl-popup-track-pointer\");\n }\n this._map._canvasContainer.classList.add(\"mapboxgl-track-pointer\");\n } else {\n this._map.on(\"move\", this._update);\n }\n this.fire(new performance2.Event(\"open\"));\n return this;\n };\n Popup2.prototype.isOpen = function isOpen() {\n return !!this._map;\n };\n Popup2.prototype.remove = function remove() {\n if (this._content) {\n DOM.remove(this._content);\n }\n if (this._container) {\n DOM.remove(this._container);\n delete this._container;\n }\n if (this._map) {\n this._map.off(\"move\", this._update);\n this._map.off(\"move\", this._onClose);\n this._map.off(\"click\", this._onClose);\n this._map.off(\"remove\", this.remove);\n this._map.off(\"mousemove\", this._onMouseMove);\n this._map.off(\"mouseup\", this._onMouseUp);\n this._map.off(\"drag\", this._onDrag);\n delete this._map;\n }\n this.fire(new performance2.Event(\"close\"));\n return this;\n };\n Popup2.prototype.getLngLat = function getLngLat() {\n return this._lngLat;\n };\n Popup2.prototype.setLngLat = function setLngLat(lnglat) {\n this._lngLat = performance2.LngLat.convert(lnglat);\n this._pos = null;\n this._trackPointer = false;\n this._update();\n if (this._map) {\n this._map.on(\"move\", this._update);\n this._map.off(\"mousemove\", this._onMouseMove);\n if (this._container) {\n this._container.classList.remove(\"mapboxgl-popup-track-pointer\");\n }\n this._map._canvasContainer.classList.remove(\"mapboxgl-track-pointer\");\n }\n return this;\n };\n Popup2.prototype.trackPointer = function trackPointer() {\n this._trackPointer = true;\n this._pos = null;\n this._update();\n if (this._map) {\n this._map.off(\"move\", this._update);\n this._map.on(\"mousemove\", this._onMouseMove);\n this._map.on(\"drag\", this._onDrag);\n if (this._container) {\n this._container.classList.add(\"mapboxgl-popup-track-pointer\");\n }\n this._map._canvasContainer.classList.add(\"mapboxgl-track-pointer\");\n }\n return this;\n };\n Popup2.prototype.getElement = function getElement() {\n return this._container;\n };\n Popup2.prototype.setText = function setText(text) {\n return this.setDOMContent(performance2.window.document.createTextNode(text));\n };\n Popup2.prototype.setHTML = function setHTML(html) {\n var frag = performance2.window.document.createDocumentFragment();\n var temp = performance2.window.document.createElement(\"body\");\n var child;\n temp.innerHTML = html;\n while (true) {\n child = temp.firstChild;\n if (!child) {\n break;\n }\n frag.appendChild(child);\n }\n return this.setDOMContent(frag);\n };\n Popup2.prototype.getMaxWidth = function getMaxWidth() {\n return this._container && this._container.style.maxWidth;\n };\n Popup2.prototype.setMaxWidth = function setMaxWidth(maxWidth) {\n this.options.maxWidth = maxWidth;\n this._update();\n return this;\n };\n Popup2.prototype.setDOMContent = function setDOMContent(htmlNode) {\n if (this._content) {\n while (this._content.hasChildNodes()) {\n if (this._content.firstChild) {\n this._content.removeChild(this._content.firstChild);\n }\n }\n } else {\n this._content = DOM.create(\"div\", \"mapboxgl-popup-content\", this._container);\n }\n this._content.appendChild(htmlNode);\n this._createCloseButton();\n this._update();\n this._focusFirstElement();\n return this;\n };\n Popup2.prototype.addClassName = function addClassName(className) {\n if (this._container) {\n this._container.classList.add(className);\n }\n };\n Popup2.prototype.removeClassName = function removeClassName(className) {\n if (this._container) {\n this._container.classList.remove(className);\n }\n };\n Popup2.prototype.setOffset = function setOffset(offset) {\n this.options.offset = offset;\n this._update();\n return this;\n };\n Popup2.prototype.toggleClassName = function toggleClassName(className) {\n if (this._container) {\n return this._container.classList.toggle(className);\n }\n };\n Popup2.prototype._createCloseButton = function _createCloseButton() {\n if (this.options.closeButton) {\n this._closeButton = DOM.create(\"button\", \"mapboxgl-popup-close-button\", this._content);\n this._closeButton.type = \"button\";\n this._closeButton.setAttribute(\"aria-label\", \"Close popup\");\n this._closeButton.innerHTML = \"×\";\n this._closeButton.addEventListener(\"click\", this._onClose);\n }\n };\n Popup2.prototype._onMouseUp = function _onMouseUp(event) {\n this._update(event.point);\n };\n Popup2.prototype._onMouseMove = function _onMouseMove(event) {\n this._update(event.point);\n };\n Popup2.prototype._onDrag = function _onDrag(event) {\n this._update(event.point);\n };\n Popup2.prototype._update = function _update(cursor) {\n var this$1 = this;\n var hasPosition = this._lngLat || this._trackPointer;\n if (!this._map || !hasPosition || !this._content) {\n return;\n }\n if (!this._container) {\n this._container = DOM.create(\"div\", \"mapboxgl-popup\", this._map.getContainer());\n this._tip = DOM.create(\"div\", \"mapboxgl-popup-tip\", this._container);\n this._container.appendChild(this._content);\n if (this.options.className) {\n this.options.className.split(\" \").forEach(function(name2) {\n return this$1._container.classList.add(name2);\n });\n }\n if (this._trackPointer) {\n this._container.classList.add(\"mapboxgl-popup-track-pointer\");\n }\n }\n if (this.options.maxWidth && this._container.style.maxWidth !== this.options.maxWidth) {\n this._container.style.maxWidth = this.options.maxWidth;\n }\n if (this._map.transform.renderWorldCopies && !this._trackPointer) {\n this._lngLat = smartWrap(this._lngLat, this._pos, this._map.transform);\n }\n if (this._trackPointer && !cursor) {\n return;\n }\n var pos = this._pos = this._trackPointer && cursor ? cursor : this._map.project(this._lngLat);\n var anchor = this.options.anchor;\n var offset = normalizeOffset(this.options.offset);\n if (!anchor) {\n var width = this._container.offsetWidth;\n var height = this._container.offsetHeight;\n var anchorComponents;\n if (pos.y + offset.bottom.y < height) {\n anchorComponents = [\"top\"];\n } else if (pos.y > this._map.transform.height - height) {\n anchorComponents = [\"bottom\"];\n } else {\n anchorComponents = [];\n }\n if (pos.x < width / 2) {\n anchorComponents.push(\"left\");\n } else if (pos.x > this._map.transform.width - width / 2) {\n anchorComponents.push(\"right\");\n }\n if (anchorComponents.length === 0) {\n anchor = \"bottom\";\n } else {\n anchor = anchorComponents.join(\"-\");\n }\n }\n var offsetedPos = pos.add(offset[anchor]).round();\n DOM.setTransform(this._container, anchorTranslate[anchor] + \" translate(\" + offsetedPos.x + \"px,\" + offsetedPos.y + \"px)\");\n applyAnchorClass(this._container, anchor, \"popup\");\n };\n Popup2.prototype._focusFirstElement = function _focusFirstElement() {\n if (!this.options.focusAfterOpen || !this._container) {\n return;\n }\n var firstFocusable = this._container.querySelector(focusQuerySelector);\n if (firstFocusable) {\n firstFocusable.focus();\n }\n };\n Popup2.prototype._onClose = function _onClose() {\n this.remove();\n };\n return Popup2;\n }(performance2.Evented);\n function normalizeOffset(offset) {\n if (!offset) {\n return normalizeOffset(new performance2.Point(0, 0));\n } else if (typeof offset === \"number\") {\n var cornerOffset = Math.round(Math.sqrt(0.5 * Math.pow(offset, 2)));\n return {\n \"center\": new performance2.Point(0, 0),\n \"top\": new performance2.Point(0, offset),\n \"top-left\": new performance2.Point(cornerOffset, cornerOffset),\n \"top-right\": new performance2.Point(-cornerOffset, cornerOffset),\n \"bottom\": new performance2.Point(0, -offset),\n \"bottom-left\": new performance2.Point(cornerOffset, -cornerOffset),\n \"bottom-right\": new performance2.Point(-cornerOffset, -cornerOffset),\n \"left\": new performance2.Point(offset, 0),\n \"right\": new performance2.Point(-offset, 0)\n };\n } else if (offset instanceof performance2.Point || Array.isArray(offset)) {\n var convertedOffset = performance2.Point.convert(offset);\n return {\n \"center\": convertedOffset,\n \"top\": convertedOffset,\n \"top-left\": convertedOffset,\n \"top-right\": convertedOffset,\n \"bottom\": convertedOffset,\n \"bottom-left\": convertedOffset,\n \"bottom-right\": convertedOffset,\n \"left\": convertedOffset,\n \"right\": convertedOffset\n };\n } else {\n return {\n \"center\": performance2.Point.convert(offset[\"center\"] || [\n 0,\n 0\n ]),\n \"top\": performance2.Point.convert(offset[\"top\"] || [\n 0,\n 0\n ]),\n \"top-left\": performance2.Point.convert(offset[\"top-left\"] || [\n 0,\n 0\n ]),\n \"top-right\": performance2.Point.convert(offset[\"top-right\"] || [\n 0,\n 0\n ]),\n \"bottom\": performance2.Point.convert(offset[\"bottom\"] || [\n 0,\n 0\n ]),\n \"bottom-left\": performance2.Point.convert(offset[\"bottom-left\"] || [\n 0,\n 0\n ]),\n \"bottom-right\": performance2.Point.convert(offset[\"bottom-right\"] || [\n 0,\n 0\n ]),\n \"left\": performance2.Point.convert(offset[\"left\"] || [\n 0,\n 0\n ]),\n \"right\": performance2.Point.convert(offset[\"right\"] || [\n 0,\n 0\n ])\n };\n }\n }\n var exported = {\n version: performance2.version,\n supported: mapboxGlSupported,\n setRTLTextPlugin: performance2.setRTLTextPlugin,\n getRTLTextPluginStatus: performance2.getRTLTextPluginStatus,\n Map: Map2,\n NavigationControl,\n GeolocateControl,\n AttributionControl,\n ScaleControl,\n FullscreenControl,\n Popup,\n Marker,\n Style,\n LngLat: performance2.LngLat,\n LngLatBounds: performance2.LngLatBounds,\n Point: performance2.Point,\n MercatorCoordinate: performance2.MercatorCoordinate,\n Evented: performance2.Evented,\n config: performance2.config,\n prewarm,\n clearPrewarmedResources,\n get accessToken() {\n return performance2.config.ACCESS_TOKEN;\n },\n set accessToken(token) {\n performance2.config.ACCESS_TOKEN = token;\n },\n get baseApiUrl() {\n return performance2.config.API_URL;\n },\n set baseApiUrl(url) {\n performance2.config.API_URL = url;\n },\n get workerCount() {\n return WorkerPool.workerCount;\n },\n set workerCount(count) {\n WorkerPool.workerCount = count;\n },\n get maxParallelImageRequests() {\n return performance2.config.MAX_PARALLEL_IMAGE_REQUESTS;\n },\n set maxParallelImageRequests(numRequests) {\n performance2.config.MAX_PARALLEL_IMAGE_REQUESTS = numRequests;\n },\n clearStorage: function clearStorage(callback) {\n performance2.clearTileCache(callback);\n },\n workerUrl: \"\"\n };\n return exported;\n });\n return mapboxgl;\n });\n }\n });\n\n // src/plots/mapbox/layers.js\n var require_layers = __commonJS({\n \"src/plots/mapbox/layers.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var sanitizeHTML = require_svg_text_utils().sanitizeHTML;\n var convertTextOpts = require_convert_text_opts();\n var constants = require_constants25();\n function MapboxLayer(subplot, index) {\n this.subplot = subplot;\n this.uid = subplot.uid + \"-\" + index;\n this.index = index;\n this.idSource = \"source-\" + this.uid;\n this.idLayer = constants.layoutLayerPrefix + this.uid;\n this.sourceType = null;\n this.source = null;\n this.layerType = null;\n this.below = null;\n this.visible = false;\n }\n var proto = MapboxLayer.prototype;\n proto.update = function update(opts) {\n if (!this.visible) {\n this.updateSource(opts);\n this.updateLayer(opts);\n } else if (this.needsNewImage(opts)) {\n this.updateImage(opts);\n } else if (this.needsNewSource(opts)) {\n this.removeLayer();\n this.updateSource(opts);\n this.updateLayer(opts);\n } else if (this.needsNewLayer(opts)) {\n this.updateLayer(opts);\n } else {\n this.updateStyle(opts);\n }\n this.visible = isVisible(opts);\n };\n proto.needsNewImage = function(opts) {\n var map = this.subplot.map;\n return map.getSource(this.idSource) && this.sourceType === \"image\" && opts.sourcetype === \"image\" && (this.source !== opts.source || JSON.stringify(this.coordinates) !== JSON.stringify(opts.coordinates));\n };\n proto.needsNewSource = function(opts) {\n return this.sourceType !== opts.sourcetype || JSON.stringify(this.source) !== JSON.stringify(opts.source) || this.layerType !== opts.type;\n };\n proto.needsNewLayer = function(opts) {\n return this.layerType !== opts.type || this.below !== this.subplot.belowLookup[\"layout-\" + this.index];\n };\n proto.lookupBelow = function() {\n return this.subplot.belowLookup[\"layout-\" + this.index];\n };\n proto.updateImage = function(opts) {\n var map = this.subplot.map;\n map.getSource(this.idSource).updateImage({\n url: opts.source,\n coordinates: opts.coordinates\n });\n var _below = this.findFollowingMapboxLayerId(this.lookupBelow());\n if (_below !== null) {\n this.subplot.map.moveLayer(this.idLayer, _below);\n }\n };\n proto.updateSource = function(opts) {\n var map = this.subplot.map;\n if (map.getSource(this.idSource)) map.removeSource(this.idSource);\n this.sourceType = opts.sourcetype;\n this.source = opts.source;\n if (!isVisible(opts)) return;\n var sourceOpts = convertSourceOpts(opts);\n map.addSource(this.idSource, sourceOpts);\n };\n proto.findFollowingMapboxLayerId = function(below) {\n if (below === \"traces\") {\n var mapLayers = this.subplot.getMapLayers();\n for (var i = 0; i < mapLayers.length; i++) {\n var layerId = mapLayers[i].id;\n if (typeof layerId === \"string\" && layerId.indexOf(constants.traceLayerPrefix) === 0) {\n below = layerId;\n break;\n }\n }\n }\n return below;\n };\n proto.updateLayer = function(opts) {\n var subplot = this.subplot;\n var convertedOpts = convertOpts(opts);\n var below = this.lookupBelow();\n var _below = this.findFollowingMapboxLayerId(below);\n this.removeLayer();\n if (isVisible(opts)) {\n subplot.addLayer({\n id: this.idLayer,\n source: this.idSource,\n \"source-layer\": opts.sourcelayer || \"\",\n type: opts.type,\n minzoom: opts.minzoom,\n maxzoom: opts.maxzoom,\n layout: convertedOpts.layout,\n paint: convertedOpts.paint\n }, _below);\n }\n this.layerType = opts.type;\n this.below = below;\n };\n proto.updateStyle = function(opts) {\n if (isVisible(opts)) {\n var convertedOpts = convertOpts(opts);\n this.subplot.setOptions(this.idLayer, \"setLayoutProperty\", convertedOpts.layout);\n this.subplot.setOptions(this.idLayer, \"setPaintProperty\", convertedOpts.paint);\n }\n };\n proto.removeLayer = function() {\n var map = this.subplot.map;\n if (map.getLayer(this.idLayer)) {\n map.removeLayer(this.idLayer);\n }\n };\n proto.dispose = function() {\n var map = this.subplot.map;\n if (map.getLayer(this.idLayer)) map.removeLayer(this.idLayer);\n if (map.getSource(this.idSource)) map.removeSource(this.idSource);\n };\n function isVisible(opts) {\n if (!opts.visible) return false;\n var source = opts.source;\n if (Array.isArray(source) && source.length > 0) {\n for (var i = 0; i < source.length; i++) {\n if (typeof source[i] !== \"string\" || source[i].length === 0) {\n return false;\n }\n }\n return true;\n }\n return Lib.isPlainObject(source) || typeof source === \"string\" && source.length > 0;\n }\n function convertOpts(opts) {\n var layout = {};\n var paint = {};\n switch (opts.type) {\n case \"circle\":\n Lib.extendFlat(paint, {\n \"circle-radius\": opts.circle.radius,\n \"circle-color\": opts.color,\n \"circle-opacity\": opts.opacity\n });\n break;\n case \"line\":\n Lib.extendFlat(paint, {\n \"line-width\": opts.line.width,\n \"line-color\": opts.color,\n \"line-opacity\": opts.opacity,\n \"line-dasharray\": opts.line.dash\n });\n break;\n case \"fill\":\n Lib.extendFlat(paint, {\n \"fill-color\": opts.color,\n \"fill-outline-color\": opts.fill.outlinecolor,\n \"fill-opacity\": opts.opacity\n // no way to pass specify outline width at the moment\n });\n break;\n case \"symbol\":\n var symbol = opts.symbol;\n var textOpts = convertTextOpts(symbol.textposition, symbol.iconsize);\n Lib.extendFlat(layout, {\n \"icon-image\": symbol.icon + \"-15\",\n \"icon-size\": symbol.iconsize / 10,\n \"text-field\": symbol.text,\n \"text-size\": symbol.textfont.size,\n \"text-anchor\": textOpts.anchor,\n \"text-offset\": textOpts.offset,\n \"symbol-placement\": symbol.placement\n // TODO font family\n // 'text-font': symbol.textfont.family.split(', '),\n });\n Lib.extendFlat(paint, {\n \"icon-color\": opts.color,\n \"text-color\": symbol.textfont.color,\n \"text-opacity\": opts.opacity\n });\n break;\n case \"raster\":\n Lib.extendFlat(paint, {\n \"raster-fade-duration\": 0,\n \"raster-opacity\": opts.opacity\n });\n break;\n }\n return {\n layout,\n paint\n };\n }\n function convertSourceOpts(opts) {\n var sourceType = opts.sourcetype;\n var source = opts.source;\n var sourceOpts = { type: sourceType };\n var field;\n if (sourceType === \"geojson\") {\n field = \"data\";\n } else if (sourceType === \"vector\") {\n field = typeof source === \"string\" ? \"url\" : \"tiles\";\n } else if (sourceType === \"raster\") {\n field = \"tiles\";\n sourceOpts.tileSize = 256;\n } else if (sourceType === \"image\") {\n field = \"url\";\n sourceOpts.coordinates = opts.coordinates;\n }\n sourceOpts[field] = source;\n if (opts.sourceattribution) {\n sourceOpts.attribution = sanitizeHTML(opts.sourceattribution);\n }\n return sourceOpts;\n }\n module.exports = function createMapboxLayer(subplot, index, opts) {\n var mapboxLayer = new MapboxLayer(subplot, index);\n mapboxLayer.update(opts);\n return mapboxLayer;\n };\n }\n });\n\n // src/plots/mapbox/mapbox.js\n var require_mapbox = __commonJS({\n \"src/plots/mapbox/mapbox.js\"(exports, module) {\n \"use strict\";\n var mapboxgl = require_mapbox_gl_unminified();\n var Lib = require_lib();\n var geoUtils = require_geo_location_utils();\n var Registry = require_registry();\n var Axes = require_axes();\n var dragElement = require_dragelement();\n var Fx = require_fx();\n var dragHelpers = require_helpers5();\n var drawMode = dragHelpers.drawMode;\n var selectMode = dragHelpers.selectMode;\n var prepSelect = require_selections().prepSelect;\n var clearOutline = require_selections().clearOutline;\n var clearSelectionsCache = require_selections().clearSelectionsCache;\n var selectOnClick = require_selections().selectOnClick;\n var constants = require_constants25();\n var createMapboxLayer = require_layers();\n function Mapbox(gd, id) {\n this.id = id;\n this.gd = gd;\n var fullLayout = gd._fullLayout;\n var context = gd._context;\n this.container = fullLayout._glcontainer.node();\n this.isStatic = context.staticPlot;\n this.uid = fullLayout._uid + \"-\" + this.id;\n this.div = null;\n this.xaxis = null;\n this.yaxis = null;\n this.createFramework(fullLayout);\n this.map = null;\n this.accessToken = null;\n this.styleObj = null;\n this.traceHash = {};\n this.layerList = [];\n this.belowLookup = {};\n this.dragging = false;\n this.wheeling = false;\n }\n var proto = Mapbox.prototype;\n proto.plot = function(calcData, fullLayout, promises) {\n var self2 = this;\n var opts = fullLayout[self2.id];\n if (self2.map && opts.accesstoken !== self2.accessToken) {\n self2.map.remove();\n self2.map = null;\n self2.styleObj = null;\n self2.traceHash = {};\n self2.layerList = [];\n }\n var promise;\n if (!self2.map) {\n promise = new Promise(function(resolve, reject) {\n self2.createMap(calcData, fullLayout, resolve, reject);\n });\n } else {\n promise = new Promise(function(resolve, reject) {\n self2.updateMap(calcData, fullLayout, resolve, reject);\n });\n }\n promises.push(promise);\n };\n proto.createMap = function(calcData, fullLayout, resolve, reject) {\n var self2 = this;\n var opts = fullLayout[self2.id];\n var styleObj = self2.styleObj = getStyleObj(opts.style, fullLayout);\n self2.accessToken = opts.accesstoken;\n var bounds = opts.bounds;\n var maxBounds = bounds ? [[bounds.west, bounds.south], [bounds.east, bounds.north]] : null;\n var map = self2.map = new mapboxgl.Map({\n container: self2.div,\n style: styleObj.style,\n center: convertCenter(opts.center),\n zoom: opts.zoom,\n bearing: opts.bearing,\n pitch: opts.pitch,\n maxBounds,\n interactive: !self2.isStatic,\n preserveDrawingBuffer: self2.isStatic,\n doubleClickZoom: false,\n boxZoom: false,\n attributionControl: false\n }).addControl(new mapboxgl.AttributionControl({\n compact: true\n }));\n map._canvas.style.left = \"0px\";\n map._canvas.style.top = \"0px\";\n self2.rejectOnError(reject);\n if (!self2.isStatic) {\n self2.initFx(calcData, fullLayout);\n }\n var promises = [];\n promises.push(new Promise(function(resolve2) {\n map.once(\"load\", resolve2);\n }));\n promises = promises.concat(geoUtils.fetchTraceGeoData(calcData));\n Promise.all(promises).then(function() {\n self2.fillBelowLookup(calcData, fullLayout);\n self2.updateData(calcData);\n self2.updateLayout(fullLayout);\n self2.resolveOnRender(resolve);\n }).catch(reject);\n };\n proto.updateMap = function(calcData, fullLayout, resolve, reject) {\n var self2 = this;\n var map = self2.map;\n var opts = fullLayout[this.id];\n self2.rejectOnError(reject);\n var promises = [];\n var styleObj = getStyleObj(opts.style, fullLayout);\n if (JSON.stringify(self2.styleObj) !== JSON.stringify(styleObj)) {\n self2.styleObj = styleObj;\n map.setStyle(styleObj.style);\n self2.traceHash = {};\n promises.push(new Promise(function(resolve2) {\n map.once(\"styledata\", resolve2);\n }));\n }\n promises = promises.concat(geoUtils.fetchTraceGeoData(calcData));\n Promise.all(promises).then(function() {\n self2.fillBelowLookup(calcData, fullLayout);\n self2.updateData(calcData);\n self2.updateLayout(fullLayout);\n self2.resolveOnRender(resolve);\n }).catch(reject);\n };\n proto.fillBelowLookup = function(calcData, fullLayout) {\n var opts = fullLayout[this.id];\n var layers = opts.layers;\n var i, val;\n var belowLookup = this.belowLookup = {};\n var hasTraceAtTop = false;\n for (i = 0; i < calcData.length; i++) {\n var trace = calcData[i][0].trace;\n var _module = trace._module;\n if (typeof trace.below === \"string\") {\n val = trace.below;\n } else if (_module.getBelow) {\n val = _module.getBelow(trace, this);\n }\n if (val === \"\") {\n hasTraceAtTop = true;\n }\n belowLookup[\"trace-\" + trace.uid] = val || \"\";\n }\n for (i = 0; i < layers.length; i++) {\n var item = layers[i];\n if (typeof item.below === \"string\") {\n val = item.below;\n } else if (hasTraceAtTop) {\n val = \"traces\";\n } else {\n val = \"\";\n }\n belowLookup[\"layout-\" + i] = val;\n }\n var val2list = {};\n var k, id;\n for (k in belowLookup) {\n val = belowLookup[k];\n if (val2list[val]) {\n val2list[val].push(k);\n } else {\n val2list[val] = [k];\n }\n }\n for (val in val2list) {\n var list = val2list[val];\n if (list.length > 1) {\n for (i = 0; i < list.length; i++) {\n k = list[i];\n if (k.indexOf(\"trace-\") === 0) {\n id = k.split(\"trace-\")[1];\n if (this.traceHash[id]) {\n this.traceHash[id].below = null;\n }\n } else if (k.indexOf(\"layout-\") === 0) {\n id = k.split(\"layout-\")[1];\n if (this.layerList[id]) {\n this.layerList[id].below = null;\n }\n }\n }\n }\n }\n };\n var traceType2orderIndex = {\n choroplethmapbox: 0,\n densitymapbox: 1,\n scattermapbox: 2\n };\n proto.updateData = function(calcData) {\n var traceHash = this.traceHash;\n var traceObj, trace, i, j;\n var calcDataSorted = calcData.slice().sort(function(a, b) {\n return traceType2orderIndex[a[0].trace.type] - traceType2orderIndex[b[0].trace.type];\n });\n for (i = 0; i < calcDataSorted.length; i++) {\n var calcTrace = calcDataSorted[i];\n trace = calcTrace[0].trace;\n traceObj = traceHash[trace.uid];\n var didUpdate = false;\n if (traceObj) {\n if (traceObj.type === trace.type) {\n traceObj.update(calcTrace);\n didUpdate = true;\n } else {\n traceObj.dispose();\n }\n }\n if (!didUpdate && trace._module) {\n traceHash[trace.uid] = trace._module.plot(this, calcTrace);\n }\n }\n var ids = Object.keys(traceHash);\n idLoop:\n for (i = 0; i < ids.length; i++) {\n var id = ids[i];\n for (j = 0; j < calcData.length; j++) {\n trace = calcData[j][0].trace;\n if (id === trace.uid) continue idLoop;\n }\n traceObj = traceHash[id];\n traceObj.dispose();\n delete traceHash[id];\n }\n };\n proto.updateLayout = function(fullLayout) {\n var map = this.map;\n var opts = fullLayout[this.id];\n if (!this.dragging && !this.wheeling) {\n map.setCenter(convertCenter(opts.center));\n map.setZoom(opts.zoom);\n map.setBearing(opts.bearing);\n map.setPitch(opts.pitch);\n }\n this.updateLayers(fullLayout);\n this.updateFramework(fullLayout);\n this.updateFx(fullLayout);\n this.map.resize();\n if (this.gd._context._scrollZoom.mapbox) {\n map.scrollZoom.enable();\n } else {\n map.scrollZoom.disable();\n }\n };\n proto.resolveOnRender = function(resolve) {\n var map = this.map;\n map.on(\"render\", function onRender() {\n if (map.loaded()) {\n map.off(\"render\", onRender);\n setTimeout(resolve, 10);\n }\n });\n };\n proto.rejectOnError = function(reject) {\n var map = this.map;\n function handler() {\n reject(new Error(constants.mapOnErrorMsg));\n }\n map.once(\"error\", handler);\n map.once(\"style.error\", handler);\n map.once(\"source.error\", handler);\n map.once(\"tile.error\", handler);\n map.once(\"layer.error\", handler);\n };\n proto.createFramework = function(fullLayout) {\n var self2 = this;\n var div = self2.div = document.createElement(\"div\");\n div.id = self2.uid;\n div.style.position = \"absolute\";\n self2.container.appendChild(div);\n self2.xaxis = {\n _id: \"x\",\n c2p: function(v) {\n return self2.project(v).x;\n }\n };\n self2.yaxis = {\n _id: \"y\",\n c2p: function(v) {\n return self2.project(v).y;\n }\n };\n self2.updateFramework(fullLayout);\n self2.mockAxis = {\n type: \"linear\",\n showexponent: \"all\",\n exponentformat: \"B\"\n };\n Axes.setConvert(self2.mockAxis, fullLayout);\n };\n proto.initFx = function(calcData, fullLayout) {\n var self2 = this;\n var gd = self2.gd;\n var map = self2.map;\n map.on(\"moveend\", function(evt) {\n if (!self2.map) return;\n var fullLayoutNow = gd._fullLayout;\n if (evt.originalEvent || self2.wheeling) {\n var optsNow = fullLayoutNow[self2.id];\n Registry.call(\"_storeDirectGUIEdit\", gd.layout, fullLayoutNow._preGUI, self2.getViewEdits(optsNow));\n var viewNow = self2.getView();\n optsNow._input.center = optsNow.center = viewNow.center;\n optsNow._input.zoom = optsNow.zoom = viewNow.zoom;\n optsNow._input.bearing = optsNow.bearing = viewNow.bearing;\n optsNow._input.pitch = optsNow.pitch = viewNow.pitch;\n gd.emit(\"plotly_relayout\", self2.getViewEditsWithDerived(viewNow));\n }\n if (evt.originalEvent && evt.originalEvent.type === \"mouseup\") {\n self2.dragging = false;\n } else if (self2.wheeling) {\n self2.wheeling = false;\n }\n if (fullLayoutNow._rehover) {\n fullLayoutNow._rehover();\n }\n });\n map.on(\"wheel\", function() {\n self2.wheeling = true;\n });\n map.on(\"mousemove\", function(evt) {\n var bb = self2.div.getBoundingClientRect();\n var xy = [\n evt.originalEvent.offsetX,\n evt.originalEvent.offsetY\n ];\n evt.target.getBoundingClientRect = function() {\n return bb;\n };\n self2.xaxis.p2c = function() {\n return map.unproject(xy).lng;\n };\n self2.yaxis.p2c = function() {\n return map.unproject(xy).lat;\n };\n gd._fullLayout._rehover = function() {\n if (gd._fullLayout._hoversubplot === self2.id && gd._fullLayout[self2.id]) {\n Fx.hover(gd, evt, self2.id);\n }\n };\n Fx.hover(gd, evt, self2.id);\n gd._fullLayout._hoversubplot = self2.id;\n });\n function unhover() {\n Fx.loneUnhover(fullLayout._hoverlayer);\n }\n map.on(\"dragstart\", function() {\n self2.dragging = true;\n unhover();\n });\n map.on(\"zoomstart\", unhover);\n map.on(\"mouseout\", function() {\n gd._fullLayout._hoversubplot = null;\n });\n function emitUpdate() {\n var viewNow = self2.getView();\n gd.emit(\"plotly_relayouting\", self2.getViewEditsWithDerived(viewNow));\n }\n map.on(\"drag\", emitUpdate);\n map.on(\"zoom\", emitUpdate);\n map.on(\"dblclick\", function() {\n var optsNow = gd._fullLayout[self2.id];\n Registry.call(\"_storeDirectGUIEdit\", gd.layout, gd._fullLayout._preGUI, self2.getViewEdits(optsNow));\n var viewInitial = self2.viewInitial;\n map.setCenter(convertCenter(viewInitial.center));\n map.setZoom(viewInitial.zoom);\n map.setBearing(viewInitial.bearing);\n map.setPitch(viewInitial.pitch);\n var viewNow = self2.getView();\n optsNow._input.center = optsNow.center = viewNow.center;\n optsNow._input.zoom = optsNow.zoom = viewNow.zoom;\n optsNow._input.bearing = optsNow.bearing = viewNow.bearing;\n optsNow._input.pitch = optsNow.pitch = viewNow.pitch;\n gd.emit(\"plotly_doubleclick\", null);\n gd.emit(\"plotly_relayout\", self2.getViewEditsWithDerived(viewNow));\n });\n self2.clearOutline = function() {\n clearSelectionsCache(self2.dragOptions);\n clearOutline(self2.dragOptions.gd);\n };\n self2.onClickInPanFn = function(dragOptions) {\n return function(evt) {\n var clickMode = gd._fullLayout.clickmode;\n if (clickMode.indexOf(\"select\") > -1) {\n selectOnClick(evt.originalEvent, gd, [self2.xaxis], [self2.yaxis], self2.id, dragOptions);\n }\n if (clickMode.indexOf(\"event\") > -1) {\n Fx.click(gd, evt.originalEvent);\n }\n };\n };\n };\n proto.updateFx = function(fullLayout) {\n var self2 = this;\n var map = self2.map;\n var gd = self2.gd;\n if (self2.isStatic) return;\n function invert(pxpy) {\n var obj = self2.map.unproject(pxpy);\n return [obj.lng, obj.lat];\n }\n var dragMode = fullLayout.dragmode;\n var fillRangeItems;\n fillRangeItems = function(eventData, poly) {\n if (poly.isRect) {\n var ranges = eventData.range = {};\n ranges[self2.id] = [\n invert([poly.xmin, poly.ymin]),\n invert([poly.xmax, poly.ymax])\n ];\n } else {\n var dataPts = eventData.lassoPoints = {};\n dataPts[self2.id] = poly.map(invert);\n }\n };\n var oldDragOptions = self2.dragOptions;\n self2.dragOptions = Lib.extendDeep(oldDragOptions || {}, {\n dragmode: fullLayout.dragmode,\n element: self2.div,\n gd,\n plotinfo: {\n id: self2.id,\n domain: fullLayout[self2.id].domain,\n xaxis: self2.xaxis,\n yaxis: self2.yaxis,\n fillRangeItems\n },\n xaxes: [self2.xaxis],\n yaxes: [self2.yaxis],\n subplot: self2.id\n });\n map.off(\"click\", self2.onClickInPanHandler);\n if (selectMode(dragMode) || drawMode(dragMode)) {\n map.dragPan.disable();\n map.on(\"zoomstart\", self2.clearOutline);\n self2.dragOptions.prepFn = function(e, startX, startY) {\n prepSelect(e, startX, startY, self2.dragOptions, dragMode);\n };\n dragElement.init(self2.dragOptions);\n } else {\n map.dragPan.enable();\n map.off(\"zoomstart\", self2.clearOutline);\n self2.div.onmousedown = null;\n self2.div.ontouchstart = null;\n self2.div.removeEventListener(\"touchstart\", self2.div._ontouchstart);\n self2.onClickInPanHandler = self2.onClickInPanFn(self2.dragOptions);\n map.on(\"click\", self2.onClickInPanHandler);\n }\n };\n proto.updateFramework = function(fullLayout) {\n var domain = fullLayout[this.id].domain;\n var size = fullLayout._size;\n var style = this.div.style;\n style.width = size.w * (domain.x[1] - domain.x[0]) + \"px\";\n style.height = size.h * (domain.y[1] - domain.y[0]) + \"px\";\n style.left = size.l + domain.x[0] * size.w + \"px\";\n style.top = size.t + (1 - domain.y[1]) * size.h + \"px\";\n this.xaxis._offset = size.l + domain.x[0] * size.w;\n this.xaxis._length = size.w * (domain.x[1] - domain.x[0]);\n this.yaxis._offset = size.t + (1 - domain.y[1]) * size.h;\n this.yaxis._length = size.h * (domain.y[1] - domain.y[0]);\n };\n proto.updateLayers = function(fullLayout) {\n var opts = fullLayout[this.id];\n var layers = opts.layers;\n var layerList = this.layerList;\n var i;\n if (layers.length !== layerList.length) {\n for (i = 0; i < layerList.length; i++) {\n layerList[i].dispose();\n }\n layerList = this.layerList = [];\n for (i = 0; i < layers.length; i++) {\n layerList.push(createMapboxLayer(this, i, layers[i]));\n }\n } else {\n for (i = 0; i < layers.length; i++) {\n layerList[i].update(layers[i]);\n }\n }\n };\n proto.destroy = function() {\n if (this.map) {\n this.map.remove();\n this.map = null;\n this.container.removeChild(this.div);\n }\n };\n proto.toImage = function() {\n this.map.stop();\n return this.map.getCanvas().toDataURL();\n };\n proto.setOptions = function(id, methodName, opts) {\n for (var k in opts) {\n this.map[methodName](id, k, opts[k]);\n }\n };\n proto.getMapLayers = function() {\n return this.map.getStyle().layers;\n };\n proto.addLayer = function(opts, below) {\n var map = this.map;\n if (typeof below === \"string\") {\n if (below === \"\") {\n map.addLayer(opts, below);\n return;\n }\n var mapLayers = this.getMapLayers();\n for (var i = 0; i < mapLayers.length; i++) {\n if (below === mapLayers[i].id) {\n map.addLayer(opts, below);\n return;\n }\n }\n Lib.warn([\n \"Trying to add layer with *below* value\",\n below,\n \"referencing a layer that does not exist\",\n \"or that does not yet exist.\"\n ].join(\" \"));\n }\n map.addLayer(opts);\n };\n proto.project = function(v) {\n return this.map.project(new mapboxgl.LngLat(v[0], v[1]));\n };\n proto.getView = function() {\n var map = this.map;\n var mapCenter = map.getCenter();\n var lon = mapCenter.lng;\n var lat = mapCenter.lat;\n var center = { lon, lat };\n var canvas = map.getCanvas();\n var w = parseInt(canvas.style.width);\n var h = parseInt(canvas.style.height);\n return {\n center,\n zoom: map.getZoom(),\n bearing: map.getBearing(),\n pitch: map.getPitch(),\n _derived: {\n coordinates: [\n map.unproject([0, 0]).toArray(),\n map.unproject([w, 0]).toArray(),\n map.unproject([w, h]).toArray(),\n map.unproject([0, h]).toArray()\n ]\n }\n };\n };\n proto.getViewEdits = function(cont) {\n var id = this.id;\n var keys = [\"center\", \"zoom\", \"bearing\", \"pitch\"];\n var obj = {};\n for (var i = 0; i < keys.length; i++) {\n var k = keys[i];\n obj[id + \".\" + k] = cont[k];\n }\n return obj;\n };\n proto.getViewEditsWithDerived = function(cont) {\n var id = this.id;\n var obj = this.getViewEdits(cont);\n obj[id + \"._derived\"] = cont._derived;\n return obj;\n };\n function getStyleObj(val, fullLayout) {\n var styleObj = {};\n if (Lib.isPlainObject(val)) {\n styleObj.id = val.id;\n styleObj.style = val;\n } else if (typeof val === \"string\") {\n styleObj.id = val;\n if (constants.styleValuesMapbox.indexOf(val) !== -1) {\n styleObj.style = convertStyleVal(val);\n } else if (constants.stylesNonMapbox[val]) {\n styleObj.style = constants.stylesNonMapbox[val];\n var spec = styleObj.style.sources[\"plotly-\" + val];\n var tiles = spec ? spec.tiles : void 0;\n if (tiles && tiles[0] && tiles[0].slice(-9) === \"?api_key=\") {\n tiles[0] += fullLayout._mapboxAccessToken;\n }\n } else {\n styleObj.style = val;\n }\n } else {\n styleObj.id = constants.styleValueDflt;\n styleObj.style = convertStyleVal(constants.styleValueDflt);\n }\n styleObj.transition = { duration: 0, delay: 0 };\n return styleObj;\n }\n function convertStyleVal(val) {\n return constants.styleUrlPrefix + val + \"-\" + constants.styleUrlSuffix;\n }\n function convertCenter(center) {\n return [center.lon, center.lat];\n }\n module.exports = Mapbox;\n }\n });\n\n // src/plots/mapbox/layout_defaults.js\n var require_layout_defaults17 = __commonJS({\n \"src/plots/mapbox/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleSubplotDefaults = require_subplot_defaults();\n var handleArrayContainerDefaults = require_array_container_defaults();\n var layoutAttributes = require_layout_attributes19();\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {\n handleSubplotDefaults(layoutIn, layoutOut, fullData, {\n type: \"mapbox\",\n attributes: layoutAttributes,\n handleDefaults,\n partition: \"y\",\n accessToken: layoutOut._mapboxAccessToken\n });\n };\n function handleDefaults(containerIn, containerOut, coerce, opts) {\n coerce(\"accesstoken\", opts.accessToken);\n coerce(\"style\");\n coerce(\"center.lon\");\n coerce(\"center.lat\");\n coerce(\"zoom\");\n coerce(\"bearing\");\n coerce(\"pitch\");\n var west = coerce(\"bounds.west\");\n var east = coerce(\"bounds.east\");\n var south = coerce(\"bounds.south\");\n var north = coerce(\"bounds.north\");\n if (west === void 0 || east === void 0 || south === void 0 || north === void 0) {\n delete containerOut.bounds;\n }\n handleArrayContainerDefaults(containerIn, containerOut, {\n name: \"layers\",\n handleItemDefaults: handleLayerDefaults\n });\n containerOut._input = containerIn;\n }\n function handleLayerDefaults(layerIn, layerOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(layerIn, layerOut, layoutAttributes.layers, attr, dflt);\n }\n var visible = coerce(\"visible\");\n if (visible) {\n var sourceType = coerce(\"sourcetype\");\n var mustBeRasterLayer = sourceType === \"raster\" || sourceType === \"image\";\n coerce(\"source\");\n coerce(\"sourceattribution\");\n if (sourceType === \"vector\") {\n coerce(\"sourcelayer\");\n }\n if (sourceType === \"image\") {\n coerce(\"coordinates\");\n }\n var typeDflt;\n if (mustBeRasterLayer) typeDflt = \"raster\";\n var type = coerce(\"type\", typeDflt);\n if (mustBeRasterLayer && type !== \"raster\") {\n type = layerOut.type = \"raster\";\n Lib.log(\"Source types *raster* and *image* must drawn *raster* layer type.\");\n }\n coerce(\"below\");\n coerce(\"color\");\n coerce(\"opacity\");\n coerce(\"minzoom\");\n coerce(\"maxzoom\");\n if (type === \"circle\") {\n coerce(\"circle.radius\");\n }\n if (type === \"line\") {\n coerce(\"line.width\");\n coerce(\"line.dash\");\n }\n if (type === \"fill\") {\n coerce(\"fill.outlinecolor\");\n }\n if (type === \"symbol\") {\n coerce(\"symbol.icon\");\n coerce(\"symbol.iconsize\");\n coerce(\"symbol.text\");\n Lib.coerceFont(coerce, \"symbol.textfont\", void 0, {\n noFontVariant: true,\n noFontShadow: true,\n noFontLineposition: true,\n noFontTextcase: true\n });\n coerce(\"symbol.textposition\");\n coerce(\"symbol.placement\");\n }\n }\n }\n }\n });\n\n // src/plots/mapbox/index.js\n var require_mapbox2 = __commonJS({\n \"src/plots/mapbox/index.js\"(exports) {\n \"use strict\";\n var mapboxgl = require_mapbox_gl_unminified();\n var Lib = require_lib();\n var strTranslate = Lib.strTranslate;\n var strScale = Lib.strScale;\n var getSubplotCalcData = require_get_data().getSubplotCalcData;\n var xmlnsNamespaces = require_xmlns_namespaces();\n var d3 = require_d3();\n var Drawing = require_drawing();\n var svgTextUtils = require_svg_text_utils();\n var Mapbox = require_mapbox();\n var MAPBOX = \"mapbox\";\n var constants = exports.constants = require_constants25();\n exports.name = MAPBOX;\n exports.attr = \"subplot\";\n exports.idRoot = MAPBOX;\n exports.idRegex = exports.attrRegex = Lib.counterRegex(MAPBOX);\n var deprecationWarning = [\n \"mapbox subplots and traces are deprecated!\",\n \"Please consider switching to `map` subplots and traces.\",\n \"Learn more at: https://plotly.com/python/maplibre-migration/\",\n \"as well as https://plotly.com/javascript/maplibre-migration/\"\n ].join(\" \");\n exports.attributes = {\n subplot: {\n valType: \"subplotid\",\n dflt: \"mapbox\",\n editType: \"calc\"\n }\n };\n exports.layoutAttributes = require_layout_attributes19();\n exports.supplyLayoutDefaults = require_layout_defaults17();\n var firstPlot = true;\n exports.plot = function plot(gd) {\n if (firstPlot) {\n firstPlot = false;\n Lib.warn(deprecationWarning);\n }\n var fullLayout = gd._fullLayout;\n var calcData = gd.calcdata;\n var mapboxIds = fullLayout._subplots[MAPBOX];\n if (mapboxgl.version !== constants.requiredVersion) {\n throw new Error(constants.wrongVersionErrorMsg);\n }\n var accessToken = findAccessToken(gd, mapboxIds);\n mapboxgl.accessToken = accessToken;\n for (var i = 0; i < mapboxIds.length; i++) {\n var id = mapboxIds[i];\n var subplotCalcData = getSubplotCalcData(calcData, MAPBOX, id);\n var opts = fullLayout[id];\n var mapbox = opts._subplot;\n if (!mapbox) {\n mapbox = new Mapbox(gd, id);\n fullLayout[id]._subplot = mapbox;\n }\n if (!mapbox.viewInitial) {\n mapbox.viewInitial = {\n center: Lib.extendFlat({}, opts.center),\n zoom: opts.zoom,\n bearing: opts.bearing,\n pitch: opts.pitch\n };\n }\n mapbox.plot(subplotCalcData, fullLayout, gd._promises);\n }\n };\n exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var oldMapboxKeys = oldFullLayout._subplots[MAPBOX] || [];\n for (var i = 0; i < oldMapboxKeys.length; i++) {\n var oldMapboxKey = oldMapboxKeys[i];\n if (!newFullLayout[oldMapboxKey] && !!oldFullLayout[oldMapboxKey]._subplot) {\n oldFullLayout[oldMapboxKey]._subplot.destroy();\n }\n }\n };\n exports.toSVG = function(gd) {\n var fullLayout = gd._fullLayout;\n var subplotIds = fullLayout._subplots[MAPBOX];\n var size = fullLayout._size;\n for (var i = 0; i < subplotIds.length; i++) {\n var opts = fullLayout[subplotIds[i]];\n var domain = opts.domain;\n var mapbox = opts._subplot;\n var imageData = mapbox.toImage(\"png\");\n var image = fullLayout._glimages.append(\"svg:image\");\n image.attr({\n xmlns: xmlnsNamespaces.svg,\n \"xlink:href\": imageData,\n x: size.l + size.w * domain.x[0],\n y: size.t + size.h * (1 - domain.y[1]),\n width: size.w * (domain.x[1] - domain.x[0]),\n height: size.h * (domain.y[1] - domain.y[0]),\n preserveAspectRatio: \"none\"\n });\n var subplotDiv = d3.select(opts._subplot.div);\n var hidden = subplotDiv.select(\".mapboxgl-ctrl-logo\").node().offsetParent === null;\n if (!hidden) {\n var logo = fullLayout._glimages.append(\"g\");\n logo.attr(\"transform\", strTranslate(size.l + size.w * domain.x[0] + 10, size.t + size.h * (1 - domain.y[0]) - 31));\n logo.append(\"path\").attr(\"d\", constants.mapboxLogo.path0).style({\n opacity: 0.9,\n fill: \"#ffffff\",\n \"enable-background\": \"new\"\n });\n logo.append(\"path\").attr(\"d\", constants.mapboxLogo.path1).style(\"opacity\", 0.35).style(\"enable-background\", \"new\");\n logo.append(\"path\").attr(\"d\", constants.mapboxLogo.path2).style(\"opacity\", 0.35).style(\"enable-background\", \"new\");\n logo.append(\"polygon\").attr(\"points\", constants.mapboxLogo.polygon).style({\n opacity: 0.9,\n fill: \"#ffffff\",\n \"enable-background\": \"new\"\n });\n }\n var attributions = subplotDiv.select(\".mapboxgl-ctrl-attrib\").text().replace(\"Improve this map\", \"\");\n var attributionGroup = fullLayout._glimages.append(\"g\");\n var attributionText = attributionGroup.append(\"text\");\n attributionText.text(attributions).classed(\"static-attribution\", true).attr({\n \"font-size\": 12,\n \"font-family\": \"Arial\",\n color: \"rgba(0, 0, 0, 0.75)\",\n \"text-anchor\": \"end\",\n \"data-unformatted\": attributions\n });\n var bBox = Drawing.bBox(attributionText.node());\n var maxWidth = size.w * (domain.x[1] - domain.x[0]);\n if (bBox.width > maxWidth / 2) {\n var multilineAttributions = attributions.split(\"|\").join(\"
    \");\n attributionText.text(multilineAttributions).attr(\"data-unformatted\", multilineAttributions).call(svgTextUtils.convertToTspans, gd);\n bBox = Drawing.bBox(attributionText.node());\n }\n attributionText.attr(\"transform\", strTranslate(-3, -bBox.height + 8));\n attributionGroup.insert(\"rect\", \".static-attribution\").attr({\n x: -bBox.width - 6,\n y: -bBox.height - 3,\n width: bBox.width + 6,\n height: bBox.height + 3,\n fill: \"rgba(255, 255, 255, 0.75)\"\n });\n var scaleRatio = 1;\n if (bBox.width + 6 > maxWidth) scaleRatio = maxWidth / (bBox.width + 6);\n var offset = [size.l + size.w * domain.x[1], size.t + size.h * (1 - domain.y[0])];\n attributionGroup.attr(\"transform\", strTranslate(offset[0], offset[1]) + strScale(scaleRatio));\n }\n };\n function findAccessToken(gd, mapboxIds) {\n var fullLayout = gd._fullLayout;\n var context = gd._context;\n if (context.mapboxAccessToken === \"\") return \"\";\n var tokensUseful = [];\n var tokensListed = [];\n var hasOneSetMapboxStyle = false;\n var wontWork = false;\n for (var i = 0; i < mapboxIds.length; i++) {\n var opts = fullLayout[mapboxIds[i]];\n var token = opts.accesstoken;\n if (isStyleRequireAccessToken(opts.style)) {\n if (token) {\n Lib.pushUnique(tokensUseful, token);\n } else {\n if (isStyleRequireAccessToken(opts._input.style)) {\n Lib.error(\"Uses Mapbox map style, but did not set an access token.\");\n hasOneSetMapboxStyle = true;\n }\n wontWork = true;\n }\n }\n if (token) {\n Lib.pushUnique(tokensListed, token);\n }\n }\n if (wontWork) {\n var msg = hasOneSetMapboxStyle ? constants.noAccessTokenErrorMsg : constants.missingStyleErrorMsg;\n Lib.error(msg);\n throw new Error(msg);\n }\n if (tokensUseful.length) {\n if (tokensUseful.length > 1) {\n Lib.warn(constants.multipleTokensErrorMsg);\n }\n return tokensUseful[0];\n } else {\n if (tokensListed.length) {\n Lib.log([\n \"Listed mapbox access token(s)\",\n tokensListed.join(\",\"),\n \"but did not use a Mapbox map style, ignoring token(s).\"\n ].join(\" \"));\n }\n return \"\";\n }\n }\n function isStyleRequireAccessToken(s) {\n return typeof s === \"string\" && (constants.styleValuesMapbox.indexOf(s) !== -1 || s.indexOf(\"mapbox://\") === 0 || s.indexOf(\"stamen\") === 0);\n }\n exports.updateFx = function(gd) {\n var fullLayout = gd._fullLayout;\n var subplotIds = fullLayout._subplots[MAPBOX];\n for (var i = 0; i < subplotIds.length; i++) {\n var subplotObj = fullLayout[subplotIds[i]]._subplot;\n subplotObj.updateFx(fullLayout);\n }\n };\n }\n });\n\n // src/traces/scattermapbox/index.js\n var require_scattermapbox = __commonJS({\n \"src/traces/scattermapbox/index.js\"(exports, module) {\n \"use strict\";\n var deprecationWarning = [\n \"*scattermapbox* trace is deprecated!\",\n \"Please consider switching to the *scattermap* trace type and `map` subplots.\",\n \"Learn more at: https://plotly.com/python/maplibre-migration/\",\n \"as well as https://plotly.com/javascript/maplibre-migration/\"\n ].join(\" \");\n module.exports = {\n attributes: require_attributes54(),\n supplyDefaults: require_defaults50(),\n colorbar: require_marker_colorbar(),\n formatLabels: require_format_labels5(),\n calc: require_calc27(),\n plot: require_plot23(),\n hoverPoints: require_hover18().hoverPoints,\n eventData: require_event_data11(),\n selectPoints: require_select9(),\n styleOnSelect: function(_, cd) {\n if (cd) {\n var trace = cd[0].trace;\n trace._glTrace.update(cd);\n }\n },\n moduleType: \"trace\",\n name: \"scattermapbox\",\n basePlotModule: require_mapbox2(),\n categories: [\"mapbox\", \"gl\", \"symbols\", \"showLegend\", \"scatter-like\"],\n meta: {}\n };\n }\n });\n\n // lib/scattermapbox.js\n var require_scattermapbox2 = __commonJS({\n \"lib/scattermapbox.js\"(exports, module) {\n \"use strict\";\n module.exports = require_scattermapbox();\n }\n });\n\n // src/traces/choroplethmapbox/attributes.js\n var require_attributes55 = __commonJS({\n \"src/traces/choroplethmapbox/attributes.js\"(exports, module) {\n \"use strict\";\n var choroplethAttrs = require_attributes49();\n var colorScaleAttrs = require_attributes8();\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var baseAttrs = require_attributes2();\n var extendFlat = require_extend().extendFlat;\n module.exports = extendFlat(\n {\n locations: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n // TODO\n // Maybe start with only one value (that we could name e.g. 'geojson-id'),\n // but eventually:\n // - we could also support for our own dist/topojson/*\n // .. and locationmode: choroplethAttrs.locationmode,\n z: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n // TODO maybe we could also set a \"key\" to dig out values out of the\n // GeoJSON feature `properties` fields?\n geojson: {\n valType: \"any\",\n editType: \"calc\"\n },\n featureidkey: extendFlat({}, choroplethAttrs.featureidkey, {}),\n // TODO agree on name / behaviour\n //\n // 'below' is used currently for layout.mapbox.layers,\n // even though it's not very plotly-esque.\n //\n // Note also, that the mapbox-gl style don't all have the same layers,\n // see https://codepen.io/etpinard/pen/ydVMwM for full list\n below: {\n valType: \"string\",\n editType: \"plot\"\n },\n text: choroplethAttrs.text,\n hovertext: choroplethAttrs.hovertext,\n marker: {\n line: {\n color: extendFlat({}, choroplethAttrs.marker.line.color, { editType: \"plot\" }),\n width: extendFlat({}, choroplethAttrs.marker.line.width, { editType: \"plot\" }),\n editType: \"calc\"\n },\n // TODO maybe having a dflt less than 1, together with `below:''` would be better?\n opacity: extendFlat({}, choroplethAttrs.marker.opacity, { editType: \"plot\" }),\n editType: \"calc\"\n },\n selected: {\n marker: {\n opacity: extendFlat({}, choroplethAttrs.selected.marker.opacity, { editType: \"plot\" }),\n editType: \"plot\"\n },\n editType: \"plot\"\n },\n unselected: {\n marker: {\n opacity: extendFlat({}, choroplethAttrs.unselected.marker.opacity, { editType: \"plot\" }),\n editType: \"plot\"\n },\n editType: \"plot\"\n },\n hoverinfo: choroplethAttrs.hoverinfo,\n hovertemplate: hovertemplateAttrs({}, { keys: [\"properties\"] }),\n showlegend: extendFlat({}, baseAttrs.showlegend, { dflt: false })\n },\n colorScaleAttrs(\"\", {\n cLetter: \"z\",\n editTypeOverride: \"calc\"\n })\n );\n }\n });\n\n // src/traces/choroplethmapbox/defaults.js\n var require_defaults51 = __commonJS({\n \"src/traces/choroplethmapbox/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var colorscaleDefaults = require_defaults2();\n var attributes = require_attributes55();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var locations = coerce(\"locations\");\n var z = coerce(\"z\");\n var geojson = coerce(\"geojson\");\n if (!Lib.isArrayOrTypedArray(locations) || !locations.length || !Lib.isArrayOrTypedArray(z) || !z.length || !(typeof geojson === \"string\" && geojson !== \"\" || Lib.isPlainObject(geojson))) {\n traceOut.visible = false;\n return;\n }\n coerce(\"featureidkey\");\n traceOut._length = Math.min(locations.length, z.length);\n coerce(\"below\");\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n var mlw = coerce(\"marker.line.width\");\n if (mlw) coerce(\"marker.line.color\");\n coerce(\"marker.opacity\");\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"\", cLetter: \"z\" });\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n };\n }\n });\n\n // src/traces/choroplethmapbox/convert.js\n var require_convert12 = __commonJS({\n \"src/traces/choroplethmapbox/convert.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var Colorscale = require_colorscale();\n var Drawing = require_drawing();\n var makeBlank = require_geojson_utils().makeBlank;\n var geoUtils = require_geo_location_utils();\n function convert(calcTrace) {\n var trace = calcTrace[0].trace;\n var isVisible = trace.visible === true && trace._length !== 0;\n var fill = {\n layout: { visibility: \"none\" },\n paint: {}\n };\n var line = {\n layout: { visibility: \"none\" },\n paint: {}\n };\n var opts = trace._opts = {\n fill,\n line,\n geojson: makeBlank()\n };\n if (!isVisible) return opts;\n var features = geoUtils.extractTraceFeature(calcTrace);\n if (!features) return opts;\n var sclFunc = Colorscale.makeColorScaleFuncFromTrace(trace);\n var marker = trace.marker;\n var markerLine = marker.line || {};\n var opacityFn;\n if (Lib.isArrayOrTypedArray(marker.opacity)) {\n opacityFn = function(d) {\n var mo = d.mo;\n return isNumeric(mo) ? +Lib.constrain(mo, 0, 1) : 0;\n };\n }\n var lineColorFn;\n if (Lib.isArrayOrTypedArray(markerLine.color)) {\n lineColorFn = function(d) {\n return d.mlc;\n };\n }\n var lineWidthFn;\n if (Lib.isArrayOrTypedArray(markerLine.width)) {\n lineWidthFn = function(d) {\n return d.mlw;\n };\n }\n for (var i = 0; i < calcTrace.length; i++) {\n var cdi = calcTrace[i];\n var fOut = cdi.fOut;\n if (fOut) {\n var props = fOut.properties;\n props.fc = sclFunc(cdi.z);\n if (opacityFn) props.mo = opacityFn(cdi);\n if (lineColorFn) props.mlc = lineColorFn(cdi);\n if (lineWidthFn) props.mlw = lineWidthFn(cdi);\n cdi.ct = props.ct;\n cdi._polygons = geoUtils.feature2polygons(fOut);\n }\n }\n var opacitySetting = opacityFn ? { type: \"identity\", property: \"mo\" } : marker.opacity;\n Lib.extendFlat(fill.paint, {\n \"fill-color\": { type: \"identity\", property: \"fc\" },\n \"fill-opacity\": opacitySetting\n });\n Lib.extendFlat(line.paint, {\n \"line-color\": lineColorFn ? { type: \"identity\", property: \"mlc\" } : markerLine.color,\n \"line-width\": lineWidthFn ? { type: \"identity\", property: \"mlw\" } : markerLine.width,\n \"line-opacity\": opacitySetting\n });\n fill.layout.visibility = \"visible\";\n line.layout.visibility = \"visible\";\n opts.geojson = { type: \"FeatureCollection\", features };\n convertOnSelect(calcTrace);\n return opts;\n }\n function convertOnSelect(calcTrace) {\n var trace = calcTrace[0].trace;\n var opts = trace._opts;\n var opacitySetting;\n if (trace.selectedpoints) {\n var fns = Drawing.makeSelectedPointStyleFns(trace);\n for (var i = 0; i < calcTrace.length; i++) {\n var cdi = calcTrace[i];\n if (cdi.fOut) {\n cdi.fOut.properties.mo2 = fns.selectedOpacityFn(cdi);\n }\n }\n opacitySetting = { type: \"identity\", property: \"mo2\" };\n } else {\n opacitySetting = Lib.isArrayOrTypedArray(trace.marker.opacity) ? { type: \"identity\", property: \"mo\" } : trace.marker.opacity;\n }\n Lib.extendFlat(opts.fill.paint, { \"fill-opacity\": opacitySetting });\n Lib.extendFlat(opts.line.paint, { \"line-opacity\": opacitySetting });\n return opts;\n }\n module.exports = {\n convert,\n convertOnSelect\n };\n }\n });\n\n // src/traces/choroplethmapbox/plot.js\n var require_plot24 = __commonJS({\n \"src/traces/choroplethmapbox/plot.js\"(exports, module) {\n \"use strict\";\n var convert = require_convert12().convert;\n var convertOnSelect = require_convert12().convertOnSelect;\n var LAYER_PREFIX = require_constants25().traceLayerPrefix;\n function ChoroplethMapbox(subplot, uid) {\n this.type = \"choroplethmapbox\";\n this.subplot = subplot;\n this.uid = uid;\n this.sourceId = \"source-\" + uid;\n this.layerList = [\n [\"fill\", LAYER_PREFIX + uid + \"-fill\"],\n [\"line\", LAYER_PREFIX + uid + \"-line\"]\n ];\n this.below = null;\n }\n var proto = ChoroplethMapbox.prototype;\n proto.update = function(calcTrace) {\n this._update(convert(calcTrace));\n calcTrace[0].trace._glTrace = this;\n };\n proto.updateOnSelect = function(calcTrace) {\n this._update(convertOnSelect(calcTrace));\n };\n proto._update = function(optsAll) {\n var subplot = this.subplot;\n var layerList = this.layerList;\n var below = subplot.belowLookup[\"trace-\" + this.uid];\n subplot.map.getSource(this.sourceId).setData(optsAll.geojson);\n if (below !== this.below) {\n this._removeLayers();\n this._addLayers(optsAll, below);\n this.below = below;\n }\n for (var i = 0; i < layerList.length; i++) {\n var item = layerList[i];\n var k = item[0];\n var id = item[1];\n var opts = optsAll[k];\n subplot.setOptions(id, \"setLayoutProperty\", opts.layout);\n if (opts.layout.visibility === \"visible\") {\n subplot.setOptions(id, \"setPaintProperty\", opts.paint);\n }\n }\n };\n proto._addLayers = function(optsAll, below) {\n var subplot = this.subplot;\n var layerList = this.layerList;\n var sourceId = this.sourceId;\n for (var i = 0; i < layerList.length; i++) {\n var item = layerList[i];\n var k = item[0];\n var opts = optsAll[k];\n subplot.addLayer({\n type: k,\n id: item[1],\n source: sourceId,\n layout: opts.layout,\n paint: opts.paint\n }, below);\n }\n };\n proto._removeLayers = function() {\n var map = this.subplot.map;\n var layerList = this.layerList;\n for (var i = layerList.length - 1; i >= 0; i--) {\n map.removeLayer(layerList[i][1]);\n }\n };\n proto.dispose = function() {\n var map = this.subplot.map;\n this._removeLayers();\n map.removeSource(this.sourceId);\n };\n module.exports = function createChoroplethMapbox(subplot, calcTrace) {\n var trace = calcTrace[0].trace;\n var choroplethMapbox = new ChoroplethMapbox(subplot, trace.uid);\n var sourceId = choroplethMapbox.sourceId;\n var optsAll = convert(calcTrace);\n var below = choroplethMapbox.below = subplot.belowLookup[\"trace-\" + trace.uid];\n subplot.map.addSource(sourceId, {\n type: \"geojson\",\n data: optsAll.geojson\n });\n choroplethMapbox._addLayers(optsAll, below);\n calcTrace[0].trace._glTrace = choroplethMapbox;\n return choroplethMapbox;\n };\n }\n });\n\n // src/traces/choroplethmapbox/index.js\n var require_choroplethmapbox = __commonJS({\n \"src/traces/choroplethmapbox/index.js\"(exports, module) {\n \"use strict\";\n var deprecationWarning = [\n \"*choroplethmapbox* trace is deprecated!\",\n \"Please consider switching to the *choroplethmap* trace type and `map` subplots.\",\n \"Learn more at: https://plotly.com/python/maplibre-migration/\",\n \"as well as https://plotly.com/javascript/maplibre-migration/\"\n ].join(\" \");\n module.exports = {\n attributes: require_attributes55(),\n supplyDefaults: require_defaults51(),\n colorbar: require_colorbar2(),\n calc: require_calc28(),\n plot: require_plot24(),\n hoverPoints: require_hover15(),\n eventData: require_event_data10(),\n selectPoints: require_select6(),\n styleOnSelect: function(_, cd) {\n if (cd) {\n var trace = cd[0].trace;\n trace._glTrace.updateOnSelect(cd);\n }\n },\n getBelow: function(trace, subplot) {\n var mapLayers = subplot.getMapLayers();\n for (var i = mapLayers.length - 2; i >= 0; i--) {\n var layerId = mapLayers[i].id;\n if (typeof layerId === \"string\" && layerId.indexOf(\"water\") === 0) {\n for (var j = i + 1; j < mapLayers.length; j++) {\n layerId = mapLayers[j].id;\n if (typeof layerId === \"string\" && layerId.indexOf(\"plotly-\") === -1) {\n return layerId;\n }\n }\n }\n }\n },\n moduleType: \"trace\",\n name: \"choroplethmapbox\",\n basePlotModule: require_mapbox2(),\n categories: [\"mapbox\", \"gl\", \"noOpacity\", \"showLegend\"],\n meta: {\n hr_name: \"choropleth_mapbox\"\n }\n };\n }\n });\n\n // lib/choroplethmapbox.js\n var require_choroplethmapbox2 = __commonJS({\n \"lib/choroplethmapbox.js\"(exports, module) {\n \"use strict\";\n module.exports = require_choroplethmapbox();\n }\n });\n\n // src/traces/densitymapbox/attributes.js\n var require_attributes56 = __commonJS({\n \"src/traces/densitymapbox/attributes.js\"(exports, module) {\n \"use strict\";\n var colorScaleAttrs = require_attributes8();\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var baseAttrs = require_attributes2();\n var scatterMapboxAttrs = require_attributes54();\n var extendFlat = require_extend().extendFlat;\n module.exports = extendFlat(\n {\n lon: scatterMapboxAttrs.lon,\n lat: scatterMapboxAttrs.lat,\n z: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n radius: {\n valType: \"number\",\n editType: \"plot\",\n arrayOk: true,\n min: 1,\n dflt: 30\n },\n below: {\n valType: \"string\",\n editType: \"plot\"\n },\n text: scatterMapboxAttrs.text,\n hovertext: scatterMapboxAttrs.hovertext,\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: [\"lon\", \"lat\", \"z\", \"text\", \"name\"]\n }),\n hovertemplate: hovertemplateAttrs(),\n showlegend: extendFlat({}, baseAttrs.showlegend, { dflt: false })\n },\n colorScaleAttrs(\"\", {\n cLetter: \"z\",\n editTypeOverride: \"calc\"\n })\n );\n }\n });\n\n // src/traces/densitymapbox/defaults.js\n var require_defaults52 = __commonJS({\n \"src/traces/densitymapbox/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var colorscaleDefaults = require_defaults2();\n var attributes = require_attributes56();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var lon = coerce(\"lon\") || [];\n var lat = coerce(\"lat\") || [];\n var len = Math.min(lon.length, lat.length);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n traceOut._length = len;\n coerce(\"z\");\n coerce(\"radius\");\n coerce(\"below\");\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"\", cLetter: \"z\" });\n };\n }\n });\n\n // src/traces/densitymapbox/calc.js\n var require_calc33 = __commonJS({\n \"src/traces/densitymapbox/calc.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n var BADNUM = require_numerical().BADNUM;\n var colorscaleCalc = require_calc();\n var _ = require_lib()._;\n module.exports = function calc(gd, trace) {\n var len = trace._length;\n var calcTrace = new Array(len);\n var z = trace.z;\n var hasZ = isArrayOrTypedArray(z) && z.length;\n for (var i = 0; i < len; i++) {\n var cdi = calcTrace[i] = {};\n var lon = trace.lon[i];\n var lat = trace.lat[i];\n cdi.lonlat = isNumeric(lon) && isNumeric(lat) ? [+lon, +lat] : [BADNUM, BADNUM];\n if (hasZ) {\n var zi = z[i];\n cdi.z = isNumeric(zi) ? zi : BADNUM;\n }\n }\n colorscaleCalc(gd, trace, {\n vals: hasZ ? z : [0, 1],\n containerStr: \"\",\n cLetter: \"z\"\n });\n if (len) {\n calcTrace[0].t = {\n labels: {\n lat: _(gd, \"lat:\") + \" \",\n lon: _(gd, \"lon:\") + \" \"\n }\n };\n }\n return calcTrace;\n };\n }\n });\n\n // src/traces/densitymapbox/convert.js\n var require_convert13 = __commonJS({\n \"src/traces/densitymapbox/convert.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var Color2 = require_color();\n var Colorscale = require_colorscale();\n var BADNUM = require_numerical().BADNUM;\n var makeBlank = require_geojson_utils().makeBlank;\n module.exports = function convert(calcTrace) {\n var trace = calcTrace[0].trace;\n var isVisible = trace.visible === true && trace._length !== 0;\n var heatmap = {\n layout: { visibility: \"none\" },\n paint: {}\n };\n var opts = trace._opts = {\n heatmap,\n geojson: makeBlank()\n };\n if (!isVisible) return opts;\n var features = [];\n var i;\n var z = trace.z;\n var radius = trace.radius;\n var hasZ = Lib.isArrayOrTypedArray(z) && z.length;\n var hasArrayRadius = Lib.isArrayOrTypedArray(radius);\n for (i = 0; i < calcTrace.length; i++) {\n var cdi = calcTrace[i];\n var lonlat = cdi.lonlat;\n if (lonlat[0] !== BADNUM) {\n var props = {};\n if (hasZ) {\n var zi = cdi.z;\n props.z = zi !== BADNUM ? zi : 0;\n }\n if (hasArrayRadius) {\n props.r = isNumeric(radius[i]) && radius[i] > 0 ? +radius[i] : 0;\n }\n features.push({\n type: \"Feature\",\n geometry: { type: \"Point\", coordinates: lonlat },\n properties: props\n });\n }\n }\n var cOpts = Colorscale.extractOpts(trace);\n var scl = cOpts.reversescale ? Colorscale.flipScale(cOpts.colorscale) : cOpts.colorscale;\n var scl01 = scl[0][1];\n var color0 = Color2.opacity(scl01) < 1 ? scl01 : Color2.addOpacity(scl01, 0);\n var heatmapColor = [\n \"interpolate\",\n [\"linear\"],\n [\"heatmap-density\"],\n 0,\n color0\n ];\n for (i = 1; i < scl.length; i++) {\n heatmapColor.push(scl[i][0], scl[i][1]);\n }\n var zExp = [\n \"interpolate\",\n [\"linear\"],\n [\"get\", \"z\"],\n cOpts.min,\n 0,\n cOpts.max,\n 1\n ];\n Lib.extendFlat(opts.heatmap.paint, {\n \"heatmap-weight\": hasZ ? zExp : 1 / (cOpts.max - cOpts.min),\n \"heatmap-color\": heatmapColor,\n \"heatmap-radius\": hasArrayRadius ? { type: \"identity\", property: \"r\" } : trace.radius,\n \"heatmap-opacity\": trace.opacity\n });\n opts.geojson = { type: \"FeatureCollection\", features };\n opts.heatmap.layout.visibility = \"visible\";\n return opts;\n };\n }\n });\n\n // src/traces/densitymapbox/plot.js\n var require_plot25 = __commonJS({\n \"src/traces/densitymapbox/plot.js\"(exports, module) {\n \"use strict\";\n var convert = require_convert13();\n var LAYER_PREFIX = require_constants25().traceLayerPrefix;\n function DensityMapbox(subplot, uid) {\n this.type = \"densitymapbox\";\n this.subplot = subplot;\n this.uid = uid;\n this.sourceId = \"source-\" + uid;\n this.layerList = [\n [\"heatmap\", LAYER_PREFIX + uid + \"-heatmap\"]\n ];\n this.below = null;\n }\n var proto = DensityMapbox.prototype;\n proto.update = function(calcTrace) {\n var subplot = this.subplot;\n var layerList = this.layerList;\n var optsAll = convert(calcTrace);\n var below = subplot.belowLookup[\"trace-\" + this.uid];\n subplot.map.getSource(this.sourceId).setData(optsAll.geojson);\n if (below !== this.below) {\n this._removeLayers();\n this._addLayers(optsAll, below);\n this.below = below;\n }\n for (var i = 0; i < layerList.length; i++) {\n var item = layerList[i];\n var k = item[0];\n var id = item[1];\n var opts = optsAll[k];\n subplot.setOptions(id, \"setLayoutProperty\", opts.layout);\n if (opts.layout.visibility === \"visible\") {\n subplot.setOptions(id, \"setPaintProperty\", opts.paint);\n }\n }\n };\n proto._addLayers = function(optsAll, below) {\n var subplot = this.subplot;\n var layerList = this.layerList;\n var sourceId = this.sourceId;\n for (var i = 0; i < layerList.length; i++) {\n var item = layerList[i];\n var k = item[0];\n var opts = optsAll[k];\n subplot.addLayer({\n type: k,\n id: item[1],\n source: sourceId,\n layout: opts.layout,\n paint: opts.paint\n }, below);\n }\n };\n proto._removeLayers = function() {\n var map = this.subplot.map;\n var layerList = this.layerList;\n for (var i = layerList.length - 1; i >= 0; i--) {\n map.removeLayer(layerList[i][1]);\n }\n };\n proto.dispose = function() {\n var map = this.subplot.map;\n this._removeLayers();\n map.removeSource(this.sourceId);\n };\n module.exports = function createDensityMapbox(subplot, calcTrace) {\n var trace = calcTrace[0].trace;\n var densityMapbox = new DensityMapbox(subplot, trace.uid);\n var sourceId = densityMapbox.sourceId;\n var optsAll = convert(calcTrace);\n var below = densityMapbox.below = subplot.belowLookup[\"trace-\" + trace.uid];\n subplot.map.addSource(sourceId, {\n type: \"geojson\",\n data: optsAll.geojson\n });\n densityMapbox._addLayers(optsAll, below);\n return densityMapbox;\n };\n }\n });\n\n // src/traces/densitymapbox/hover.js\n var require_hover19 = __commonJS({\n \"src/traces/densitymapbox/hover.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n var scatterMapboxHoverPoints = require_hover18().hoverPoints;\n var getExtraText = require_hover18().getExtraText;\n module.exports = function hoverPoints(pointData, xval, yval) {\n var pts = scatterMapboxHoverPoints(pointData, xval, yval);\n if (!pts) return;\n var newPointData = pts[0];\n var cd = newPointData.cd;\n var trace = cd[0].trace;\n var di = cd[newPointData.index];\n delete newPointData.color;\n if (\"z\" in di) {\n var ax = newPointData.subplot.mockAxis;\n newPointData.z = di.z;\n newPointData.zLabel = Axes.tickText(ax, ax.c2l(di.z), \"hover\").text;\n }\n newPointData.extraText = getExtraText(trace, di, cd[0].t.labels);\n return [newPointData];\n };\n }\n });\n\n // src/traces/densitymapbox/event_data.js\n var require_event_data12 = __commonJS({\n \"src/traces/densitymapbox/event_data.js\"(exports, module) {\n \"use strict\";\n module.exports = function eventData(out, pt) {\n out.lon = pt.lon;\n out.lat = pt.lat;\n out.z = pt.z;\n return out;\n };\n }\n });\n\n // src/traces/densitymapbox/index.js\n var require_densitymapbox = __commonJS({\n \"src/traces/densitymapbox/index.js\"(exports, module) {\n \"use strict\";\n var deprecationWarning = [\n \"*densitymapbox* trace is deprecated!\",\n \"Please consider switching to the *densitymap* trace type and `map` subplots.\",\n \"Learn more at: https://plotly.com/python/maplibre-migration/\",\n \"as well as https://plotly.com/javascript/maplibre-migration/\"\n ].join(\" \");\n module.exports = {\n attributes: require_attributes56(),\n supplyDefaults: require_defaults52(),\n colorbar: require_colorbar2(),\n formatLabels: require_format_labels5(),\n calc: require_calc33(),\n plot: require_plot25(),\n hoverPoints: require_hover19(),\n eventData: require_event_data12(),\n getBelow: function(trace, subplot) {\n var mapLayers = subplot.getMapLayers();\n for (var i = 0; i < mapLayers.length; i++) {\n var layer = mapLayers[i];\n var layerId = layer.id;\n if (layer.type === \"symbol\" && typeof layerId === \"string\" && layerId.indexOf(\"plotly-\") === -1) {\n return layerId;\n }\n }\n },\n moduleType: \"trace\",\n name: \"densitymapbox\",\n basePlotModule: require_mapbox2(),\n categories: [\"mapbox\", \"gl\", \"showLegend\"],\n meta: {\n hr_name: \"density_mapbox\"\n }\n };\n }\n });\n\n // lib/densitymapbox.js\n var require_densitymapbox2 = __commonJS({\n \"lib/densitymapbox.js\"(exports, module) {\n \"use strict\";\n module.exports = require_densitymapbox();\n }\n });\n\n // src/plots/map/styles/arcgis-sat-hybrid.js\n var require_arcgis_sat_hybrid = __commonJS({\n \"src/plots/map/styles/arcgis-sat-hybrid.js\"(exports, module) {\n module.exports = {\n \"version\": 8,\n \"name\": \"orto\",\n \"metadata\": { \"maputnik:renderer\": \"mlgljs\" },\n \"center\": [1.537786, 41.837539],\n \"zoom\": 12,\n \"bearing\": 0,\n \"pitch\": 0,\n \"light\": {\n \"anchor\": \"viewport\",\n \"color\": \"white\",\n \"intensity\": 0.4,\n \"position\": [1.15, 45, 30]\n },\n \"sources\": {\n \"ortoEsri\": {\n \"type\": \"raster\",\n \"tiles\": [\n \"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}\"\n ],\n \"tileSize\": 256,\n \"maxzoom\": 18,\n \"attribution\": \"ESRI © ESRI\"\n },\n \"ortoInstaMaps\": {\n \"type\": \"raster\",\n \"tiles\": [\n \"https://tilemaps.icgc.cat/mapfactory/wmts/orto_8_12/CAT3857/{z}/{x}/{y}.png\"\n ],\n \"tileSize\": 256,\n \"maxzoom\": 13\n },\n \"ortoICGC\": {\n \"type\": \"raster\",\n \"tiles\": [\n \"https://geoserveis.icgc.cat/icc_mapesmultibase/noutm/wmts/orto/GRID3857/{z}/{x}/{y}.jpeg\"\n ],\n \"tileSize\": 256,\n \"minzoom\": 13.1,\n \"maxzoom\": 20\n },\n \"openmaptiles\": {\n \"type\": \"vector\",\n \"url\": \"https://geoserveis.icgc.cat/contextmaps/basemap.json\"\n }\n },\n \"sprite\": \"https://geoserveis.icgc.cat/contextmaps/sprites/sprite@1\",\n \"glyphs\": \"https://geoserveis.icgc.cat/contextmaps/glyphs/{fontstack}/{range}.pbf\",\n \"layers\": [\n {\n \"id\": \"background\",\n \"type\": \"background\",\n \"paint\": { \"background-color\": \"#F4F9F4\" }\n },\n {\n \"id\": \"ortoEsri\",\n \"type\": \"raster\",\n \"source\": \"ortoEsri\",\n \"maxzoom\": 16,\n \"layout\": { \"visibility\": \"visible\" }\n },\n {\n \"id\": \"ortoICGC\",\n \"type\": \"raster\",\n \"source\": \"ortoICGC\",\n \"minzoom\": 13.1,\n \"maxzoom\": 19,\n \"layout\": { \"visibility\": \"visible\" }\n },\n {\n \"id\": \"ortoInstaMaps\",\n \"type\": \"raster\",\n \"source\": \"ortoInstaMaps\",\n \"maxzoom\": 13,\n \"layout\": { \"visibility\": \"visible\" }\n },\n {\n \"id\": \"waterway_tunnel\",\n \"type\": \"line\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"waterway\",\n \"minzoom\": 14,\n \"filter\": [\n \"all\",\n [\"in\", \"class\", \"river\", \"stream\", \"canal\"],\n [\"==\", \"brunnel\", \"tunnel\"]\n ],\n \"layout\": { \"line-cap\": \"round\" },\n \"paint\": {\n \"line-color\": \"#a0c8f0\",\n \"line-width\": { \"base\": 1.3, \"stops\": [[13, 0.5], [20, 6]] },\n \"line-dasharray\": [2, 4]\n }\n },\n {\n \"id\": \"waterway-other\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849382550.77\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"waterway\",\n \"filter\": [\"!in\", \"class\", \"canal\", \"river\", \"stream\"],\n \"layout\": { \"line-cap\": \"round\" },\n \"paint\": {\n \"line-color\": \"#a0c8f0\",\n \"line-width\": { \"base\": 1.3, \"stops\": [[13, 0.5], [20, 2]] }\n }\n },\n {\n \"id\": \"waterway-stream-canal\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849382550.77\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"waterway\",\n \"filter\": [\n \"all\",\n [\"in\", \"class\", \"canal\", \"stream\"],\n [\"!=\", \"brunnel\", \"tunnel\"]\n ],\n \"layout\": { \"line-cap\": \"round\" },\n \"paint\": {\n \"line-color\": \"#a0c8f0\",\n \"line-width\": { \"base\": 1.3, \"stops\": [[13, 0.5], [20, 6]] }\n }\n },\n {\n \"id\": \"waterway-river\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849382550.77\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"waterway\",\n \"filter\": [\"all\", [\"==\", \"class\", \"river\"], [\"!=\", \"brunnel\", \"tunnel\"]],\n \"layout\": { \"line-cap\": \"round\" },\n \"paint\": {\n \"line-color\": \"#a0c8f0\",\n \"line-width\": { \"base\": 1.2, \"stops\": [[10, 0.8], [20, 4]] },\n \"line-opacity\": 0.5\n }\n },\n {\n \"id\": \"water-offset\",\n \"type\": \"fill\",\n \"metadata\": { \"mapbox:group\": \"1444849382550.77\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"water\",\n \"maxzoom\": 8,\n \"filter\": [\"==\", \"$type\", \"Polygon\"],\n \"layout\": { \"visibility\": \"visible\" },\n \"paint\": {\n \"fill-opacity\": 0,\n \"fill-color\": \"#a0c8f0\",\n \"fill-translate\": { \"base\": 1, \"stops\": [[6, [2, 0]], [8, [0, 0]]] }\n }\n },\n {\n \"id\": \"water\",\n \"type\": \"fill\",\n \"metadata\": { \"mapbox:group\": \"1444849382550.77\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"water\",\n \"layout\": { \"visibility\": \"visible\" },\n \"paint\": { \"fill-color\": \"hsl(210, 67%, 85%)\", \"fill-opacity\": 0 }\n },\n {\n \"id\": \"water-pattern\",\n \"type\": \"fill\",\n \"metadata\": { \"mapbox:group\": \"1444849382550.77\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"water\",\n \"layout\": { \"visibility\": \"visible\" },\n \"paint\": {\n \"fill-translate\": [0, 2.5],\n \"fill-pattern\": \"wave\",\n \"fill-opacity\": 1\n }\n },\n {\n \"id\": \"landcover-ice-shelf\",\n \"type\": \"fill\",\n \"metadata\": { \"mapbox:group\": \"1444849382550.77\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"landcover\",\n \"filter\": [\"==\", \"subclass\", \"ice_shelf\"],\n \"layout\": { \"visibility\": \"visible\" },\n \"paint\": {\n \"fill-color\": \"#fff\",\n \"fill-opacity\": { \"base\": 1, \"stops\": [[0, 0.9], [10, 0.3]] }\n }\n },\n {\n \"id\": \"tunnel-service-track-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849354174.1904\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"tunnel\"],\n [\"in\", \"class\", \"service\", \"track\"]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#cfcdca\",\n \"line-dasharray\": [0.5, 0.25],\n \"line-width\": { \"base\": 1.2, \"stops\": [[15, 1], [16, 4], [20, 11]] }\n }\n },\n {\n \"id\": \"tunnel-minor-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849354174.1904\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\"all\", [\"==\", \"brunnel\", \"tunnel\"], [\"==\", \"class\", \"minor\"]],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#cfcdca\",\n \"line-opacity\": { \"stops\": [[12, 0], [12.5, 1]] },\n \"line-width\": {\n \"base\": 1.2,\n \"stops\": [[12, 0.5], [13, 1], [14, 4], [20, 15]]\n }\n }\n },\n {\n \"id\": \"tunnel-secondary-tertiary-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849354174.1904\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"tunnel\"],\n [\"in\", \"class\", \"secondary\", \"tertiary\"]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#e9ac77\",\n \"line-opacity\": 1,\n \"line-width\": { \"base\": 1.2, \"stops\": [[8, 1.5], [20, 17]] }\n }\n },\n {\n \"id\": \"tunnel-trunk-primary-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849354174.1904\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"tunnel\"],\n [\"in\", \"class\", \"primary\", \"trunk\"]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#e9ac77\",\n \"line-width\": {\n \"base\": 1.2,\n \"stops\": [[5, 0.4], [6, 0.6], [7, 1.5], [20, 22]]\n },\n \"line-opacity\": 0.7\n }\n },\n {\n \"id\": \"tunnel-motorway-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849354174.1904\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"tunnel\"],\n [\"==\", \"class\", \"motorway\"]\n ],\n \"layout\": { \"line-join\": \"round\", \"visibility\": \"visible\" },\n \"paint\": {\n \"line-color\": \"#e9ac77\",\n \"line-dasharray\": [0.5, 0.25],\n \"line-width\": {\n \"base\": 1.2,\n \"stops\": [[5, 0.4], [6, 0.6], [7, 1.5], [20, 22]]\n },\n \"line-opacity\": 0.5\n }\n },\n {\n \"id\": \"tunnel-path\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849354174.1904\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"LineString\"],\n [\"all\", [\"==\", \"brunnel\", \"tunnel\"], [\"==\", \"class\", \"path\"]]\n ],\n \"paint\": {\n \"line-color\": \"#cba\",\n \"line-dasharray\": [1.5, 0.75],\n \"line-width\": { \"base\": 1.2, \"stops\": [[15, 1.2], [20, 4]] }\n }\n },\n {\n \"id\": \"tunnel-service-track\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849354174.1904\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"tunnel\"],\n [\"in\", \"class\", \"service\", \"track\"]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#fff\",\n \"line-width\": { \"base\": 1.2, \"stops\": [[15.5, 0], [16, 2], [20, 7.5]] }\n }\n },\n {\n \"id\": \"tunnel-minor\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849354174.1904\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"tunnel\"],\n [\"==\", \"class\", \"minor_road\"]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#fff\",\n \"line-opacity\": 1,\n \"line-width\": { \"base\": 1.2, \"stops\": [[13.5, 0], [14, 2.5], [20, 11.5]] }\n }\n },\n {\n \"id\": \"tunnel-secondary-tertiary\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849354174.1904\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"tunnel\"],\n [\"in\", \"class\", \"secondary\", \"tertiary\"]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#fff4c6\",\n \"line-width\": { \"base\": 1.2, \"stops\": [[6.5, 0], [7, 0.5], [20, 10]] }\n }\n },\n {\n \"id\": \"tunnel-trunk-primary\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849354174.1904\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"tunnel\"],\n [\"in\", \"class\", \"primary\", \"trunk\"]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#fff4c6\",\n \"line-width\": { \"base\": 1.2, \"stops\": [[6.5, 0], [7, 0.5], [20, 18]] },\n \"line-opacity\": 0.5\n }\n },\n {\n \"id\": \"tunnel-motorway\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849354174.1904\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"tunnel\"],\n [\"==\", \"class\", \"motorway\"]\n ],\n \"layout\": { \"line-join\": \"round\", \"visibility\": \"visible\" },\n \"paint\": {\n \"line-color\": \"#ffdaa6\",\n \"line-width\": { \"base\": 1.2, \"stops\": [[6.5, 0], [7, 0.5], [20, 18]] },\n \"line-opacity\": 0.5\n }\n },\n {\n \"id\": \"tunnel-railway\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849354174.1904\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\"all\", [\"==\", \"brunnel\", \"tunnel\"], [\"==\", \"class\", \"rail\"]],\n \"paint\": {\n \"line-color\": \"#bbb\",\n \"line-width\": { \"base\": 1.4, \"stops\": [[14, 0.4], [15, 0.75], [20, 2]] },\n \"line-dasharray\": [2, 2]\n }\n },\n {\n \"id\": \"ferry\",\n \"type\": \"line\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\"all\", [\"in\", \"class\", \"ferry\"]],\n \"layout\": { \"line-join\": \"round\", \"visibility\": \"visible\" },\n \"paint\": {\n \"line-color\": \"rgba(108, 159, 182, 1)\",\n \"line-width\": 1.1,\n \"line-dasharray\": [2, 2]\n }\n },\n {\n \"id\": \"aeroway-taxiway-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"aeroway\",\n \"minzoom\": 12,\n \"filter\": [\"all\", [\"in\", \"class\", \"taxiway\"]],\n \"layout\": {\n \"line-cap\": \"round\",\n \"line-join\": \"round\",\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"line-color\": \"rgba(153, 153, 153, 1)\",\n \"line-width\": { \"base\": 1.5, \"stops\": [[11, 2], [17, 12]] },\n \"line-opacity\": 1\n }\n },\n {\n \"id\": \"aeroway-runway-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"aeroway\",\n \"minzoom\": 12,\n \"filter\": [\"all\", [\"in\", \"class\", \"runway\"]],\n \"layout\": {\n \"line-cap\": \"round\",\n \"line-join\": \"round\",\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"line-color\": \"rgba(153, 153, 153, 1)\",\n \"line-width\": { \"base\": 1.5, \"stops\": [[11, 5], [17, 55]] },\n \"line-opacity\": 1\n }\n },\n {\n \"id\": \"aeroway-taxiway\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"aeroway\",\n \"minzoom\": 4,\n \"filter\": [\n \"all\",\n [\"in\", \"class\", \"taxiway\"],\n [\"==\", \"$type\", \"LineString\"]\n ],\n \"layout\": {\n \"line-cap\": \"round\",\n \"line-join\": \"round\",\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"line-color\": \"rgba(255, 255, 255, 1)\",\n \"line-width\": { \"base\": 1.5, \"stops\": [[11, 1], [17, 10]] },\n \"line-opacity\": { \"base\": 1, \"stops\": [[11, 0], [12, 1]] }\n }\n },\n {\n \"id\": \"aeroway-runway\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"aeroway\",\n \"minzoom\": 4,\n \"filter\": [\n \"all\",\n [\"in\", \"class\", \"runway\"],\n [\"==\", \"$type\", \"LineString\"]\n ],\n \"layout\": {\n \"line-cap\": \"round\",\n \"line-join\": \"round\",\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"line-color\": \"rgba(255, 255, 255, 1)\",\n \"line-width\": { \"base\": 1.5, \"stops\": [[11, 4], [17, 50]] },\n \"line-opacity\": { \"base\": 1, \"stops\": [[11, 0], [12, 1]] }\n }\n },\n {\n \"id\": \"highway-motorway-link-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"minzoom\": 12,\n \"filter\": [\n \"all\",\n [\"!in\", \"brunnel\", \"bridge\", \"tunnel\"],\n [\"==\", \"class\", \"motorway_link\"]\n ],\n \"layout\": { \"line-cap\": \"round\", \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#e9ac77\",\n \"line-opacity\": 1,\n \"line-width\": {\n \"base\": 1.2,\n \"stops\": [[12, 1], [13, 3], [14, 4], [20, 15]]\n }\n }\n },\n {\n \"id\": \"highway-link-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"minzoom\": 13,\n \"filter\": [\n \"all\",\n [\"!in\", \"brunnel\", \"bridge\", \"tunnel\"],\n [\n \"in\",\n \"class\",\n \"primary_link\",\n \"secondary_link\",\n \"tertiary_link\",\n \"trunk_link\"\n ]\n ],\n \"layout\": {\n \"line-cap\": \"round\",\n \"line-join\": \"round\",\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"line-color\": \"#e9ac77\",\n \"line-opacity\": 1,\n \"line-width\": {\n \"base\": 1.2,\n \"stops\": [[12, 1], [13, 3], [14, 4], [20, 15]]\n }\n }\n },\n {\n \"id\": \"highway-minor-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"LineString\"],\n [\n \"all\",\n [\"!=\", \"brunnel\", \"tunnel\"],\n [\"in\", \"class\", \"minor\", \"service\", \"track\"]\n ]\n ],\n \"layout\": { \"line-cap\": \"round\", \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#cfcdca\",\n \"line-opacity\": { \"stops\": [[12, 0], [12.5, 0]] },\n \"line-width\": {\n \"base\": 1.2,\n \"stops\": [[12, 0.5], [13, 1], [14, 4], [20, 15]]\n }\n }\n },\n {\n \"id\": \"highway-secondary-tertiary-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"!in\", \"brunnel\", \"bridge\", \"tunnel\"],\n [\"in\", \"class\", \"secondary\", \"tertiary\"]\n ],\n \"layout\": {\n \"line-cap\": \"butt\",\n \"line-join\": \"round\",\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"line-color\": \"#e9ac77\",\n \"line-opacity\": 0.5,\n \"line-width\": { \"base\": 1.2, \"stops\": [[8, 1.5], [20, 17]] }\n }\n },\n {\n \"id\": \"highway-primary-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"minzoom\": 5,\n \"filter\": [\n \"all\",\n [\"!in\", \"brunnel\", \"bridge\", \"tunnel\"],\n [\"in\", \"class\", \"primary\"]\n ],\n \"layout\": {\n \"line-cap\": \"butt\",\n \"line-join\": \"round\",\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"line-color\": \"#e9ac77\",\n \"line-opacity\": { \"stops\": [[7, 0], [8, 0.6]] },\n \"line-width\": {\n \"base\": 1.2,\n \"stops\": [[7, 0], [8, 0.6], [9, 1.5], [20, 22]]\n }\n }\n },\n {\n \"id\": \"highway-trunk-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"minzoom\": 5,\n \"filter\": [\n \"all\",\n [\"!in\", \"brunnel\", \"bridge\", \"tunnel\"],\n [\"in\", \"class\", \"trunk\"]\n ],\n \"layout\": {\n \"line-cap\": \"butt\",\n \"line-join\": \"round\",\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"line-color\": \"#e9ac77\",\n \"line-opacity\": { \"stops\": [[5, 0], [6, 0.5]] },\n \"line-width\": {\n \"base\": 1.2,\n \"stops\": [[5, 0], [6, 0.6], [7, 1.5], [20, 22]]\n }\n }\n },\n {\n \"id\": \"highway-motorway-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"minzoom\": 4,\n \"filter\": [\n \"all\",\n [\"!in\", \"brunnel\", \"bridge\", \"tunnel\"],\n [\"==\", \"class\", \"motorway\"]\n ],\n \"layout\": {\n \"line-cap\": \"butt\",\n \"line-join\": \"round\",\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"line-color\": \"#e9ac77\",\n \"line-width\": {\n \"base\": 1.2,\n \"stops\": [[4, 0], [5, 0.4], [6, 0.6], [7, 1.5], [20, 22]]\n },\n \"line-opacity\": { \"stops\": [[4, 0], [5, 0.5]] }\n }\n },\n {\n \"id\": \"highway-path\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"LineString\"],\n [\"all\", [\"!in\", \"brunnel\", \"bridge\", \"tunnel\"], [\"==\", \"class\", \"path\"]]\n ],\n \"paint\": {\n \"line-color\": \"#cba\",\n \"line-dasharray\": [1.5, 0.75],\n \"line-width\": { \"base\": 1.2, \"stops\": [[15, 1.2], [20, 4]] }\n }\n },\n {\n \"id\": \"highway-motorway-link\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"minzoom\": 12,\n \"filter\": [\n \"all\",\n [\"!in\", \"brunnel\", \"bridge\", \"tunnel\"],\n [\"==\", \"class\", \"motorway_link\"]\n ],\n \"layout\": { \"line-cap\": \"round\", \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#fc8\",\n \"line-width\": {\n \"base\": 1.2,\n \"stops\": [[12.5, 0], [13, 1.5], [14, 2.5], [20, 11.5]]\n }\n }\n },\n {\n \"id\": \"highway-link\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"minzoom\": 13,\n \"filter\": [\n \"all\",\n [\"!in\", \"brunnel\", \"bridge\", \"tunnel\"],\n [\n \"in\",\n \"class\",\n \"primary_link\",\n \"secondary_link\",\n \"tertiary_link\",\n \"trunk_link\"\n ]\n ],\n \"layout\": {\n \"line-cap\": \"round\",\n \"line-join\": \"round\",\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"line-color\": \"#fea\",\n \"line-width\": {\n \"base\": 1.2,\n \"stops\": [[12.5, 0], [13, 1.5], [14, 2.5], [20, 11.5]]\n }\n }\n },\n {\n \"id\": \"highway-minor\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"LineString\"],\n [\n \"all\",\n [\"!=\", \"brunnel\", \"tunnel\"],\n [\"in\", \"class\", \"minor\", \"service\", \"track\"]\n ]\n ],\n \"layout\": { \"line-cap\": \"round\", \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#fff\",\n \"line-opacity\": 0.5,\n \"line-width\": { \"base\": 1.2, \"stops\": [[13.5, 0], [14, 2.5], [20, 11.5]] }\n }\n },\n {\n \"id\": \"highway-secondary-tertiary\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"!in\", \"brunnel\", \"bridge\", \"tunnel\"],\n [\"in\", \"class\", \"secondary\", \"tertiary\"]\n ],\n \"layout\": {\n \"line-cap\": \"round\",\n \"line-join\": \"round\",\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"line-color\": \"#fea\",\n \"line-width\": { \"base\": 1.2, \"stops\": [[6.5, 0], [8, 0.5], [20, 13]] },\n \"line-opacity\": 0.5\n }\n },\n {\n \"id\": \"highway-primary\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"LineString\"],\n [\n \"all\",\n [\"!in\", \"brunnel\", \"bridge\", \"tunnel\"],\n [\"in\", \"class\", \"primary\"]\n ]\n ],\n \"layout\": {\n \"line-cap\": \"round\",\n \"line-join\": \"round\",\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"line-color\": \"#fea\",\n \"line-width\": { \"base\": 1.2, \"stops\": [[8.5, 0], [9, 0.5], [20, 18]] },\n \"line-opacity\": 0\n }\n },\n {\n \"id\": \"highway-trunk\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"LineString\"],\n [\n \"all\",\n [\"!in\", \"brunnel\", \"bridge\", \"tunnel\"],\n [\"in\", \"class\", \"trunk\"]\n ]\n ],\n \"layout\": {\n \"line-cap\": \"round\",\n \"line-join\": \"round\",\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"line-color\": \"#fea\",\n \"line-width\": { \"base\": 1.2, \"stops\": [[6.5, 0], [7, 0.5], [20, 18]] },\n \"line-opacity\": 0.5\n }\n },\n {\n \"id\": \"highway-motorway\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"minzoom\": 5,\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"LineString\"],\n [\n \"all\",\n [\"!in\", \"brunnel\", \"bridge\", \"tunnel\"],\n [\"==\", \"class\", \"motorway\"]\n ]\n ],\n \"layout\": {\n \"line-cap\": \"round\",\n \"line-join\": \"round\",\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"line-color\": \"#fc8\",\n \"line-width\": { \"base\": 1.2, \"stops\": [[6.5, 0], [7, 0.5], [20, 18]] },\n \"line-opacity\": 0.5\n }\n },\n {\n \"id\": \"railway-transit\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"LineString\"],\n [\"all\", [\"==\", \"class\", \"transit\"], [\"!in\", \"brunnel\", \"tunnel\"]]\n ],\n \"layout\": { \"visibility\": \"visible\" },\n \"paint\": {\n \"line-color\": \"hsla(0, 0%, 73%, 0.77)\",\n \"line-width\": { \"base\": 1.4, \"stops\": [[14, 0.4], [20, 1]] }\n }\n },\n {\n \"id\": \"railway-transit-hatching\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"LineString\"],\n [\"all\", [\"==\", \"class\", \"transit\"], [\"!in\", \"brunnel\", \"tunnel\"]]\n ],\n \"layout\": { \"visibility\": \"visible\" },\n \"paint\": {\n \"line-color\": \"hsla(0, 0%, 73%, 0.68)\",\n \"line-dasharray\": [0.2, 8],\n \"line-width\": { \"base\": 1.4, \"stops\": [[14.5, 0], [15, 2], [20, 6]] }\n }\n },\n {\n \"id\": \"railway-service\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"LineString\"],\n [\"all\", [\"==\", \"class\", \"rail\"], [\"has\", \"service\"]]\n ],\n \"paint\": {\n \"line-color\": \"hsla(0, 0%, 73%, 0.77)\",\n \"line-width\": { \"base\": 1.4, \"stops\": [[14, 0.4], [20, 1]] }\n }\n },\n {\n \"id\": \"railway-service-hatching\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"LineString\"],\n [\"all\", [\"==\", \"class\", \"rail\"], [\"has\", \"service\"]]\n ],\n \"layout\": { \"visibility\": \"visible\" },\n \"paint\": {\n \"line-color\": \"hsla(0, 0%, 73%, 0.68)\",\n \"line-dasharray\": [0.2, 8],\n \"line-width\": { \"base\": 1.4, \"stops\": [[14.5, 0], [15, 2], [20, 6]] }\n }\n },\n {\n \"id\": \"railway\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"LineString\"],\n [\n \"all\",\n [\"!has\", \"service\"],\n [\"!in\", \"brunnel\", \"bridge\", \"tunnel\"],\n [\"==\", \"class\", \"rail\"]\n ]\n ],\n \"paint\": {\n \"line-color\": \"#bbb\",\n \"line-width\": { \"base\": 1.4, \"stops\": [[14, 0.4], [15, 0.75], [20, 2]] }\n }\n },\n {\n \"id\": \"railway-hatching\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849345966.4436\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"LineString\"],\n [\n \"all\",\n [\"!has\", \"service\"],\n [\"!in\", \"brunnel\", \"bridge\", \"tunnel\"],\n [\"==\", \"class\", \"rail\"]\n ]\n ],\n \"paint\": {\n \"line-color\": \"#bbb\",\n \"line-dasharray\": [0.2, 8],\n \"line-width\": { \"base\": 1.4, \"stops\": [[14.5, 0], [15, 3], [20, 8]] }\n }\n },\n {\n \"id\": \"bridge-motorway-link-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849334699.1902\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"bridge\"],\n [\"==\", \"class\", \"motorway_link\"]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#e9ac77\",\n \"line-opacity\": 1,\n \"line-width\": {\n \"base\": 1.2,\n \"stops\": [[12, 1], [13, 3], [14, 4], [20, 15]]\n }\n }\n },\n {\n \"id\": \"bridge-link-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849334699.1902\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"bridge\"],\n [\n \"in\",\n \"class\",\n \"primary_link\",\n \"secondary_link\",\n \"tertiary_link\",\n \"trunk_link\"\n ]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#e9ac77\",\n \"line-opacity\": 1,\n \"line-width\": {\n \"base\": 1.2,\n \"stops\": [[12, 1], [13, 3], [14, 4], [20, 15]]\n }\n }\n },\n {\n \"id\": \"bridge-secondary-tertiary-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849334699.1902\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"bridge\"],\n [\"in\", \"class\", \"secondary\", \"tertiary\"]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#e9ac77\",\n \"line-opacity\": 1,\n \"line-width\": { \"base\": 1.2, \"stops\": [[8, 1.5], [20, 28]] }\n }\n },\n {\n \"id\": \"bridge-trunk-primary-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849334699.1902\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"bridge\"],\n [\"in\", \"class\", \"primary\", \"trunk\"]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"hsl(28, 76%, 67%)\",\n \"line-width\": {\n \"base\": 1.2,\n \"stops\": [[5, 0.4], [6, 0.6], [7, 1.5], [20, 26]]\n }\n }\n },\n {\n \"id\": \"bridge-motorway-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849334699.1902\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"bridge\"],\n [\"==\", \"class\", \"motorway\"]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#e9ac77\",\n \"line-width\": {\n \"base\": 1.2,\n \"stops\": [[5, 0.4], [6, 0.6], [7, 1.5], [20, 22]]\n },\n \"line-opacity\": 0.5\n }\n },\n {\n \"id\": \"bridge-path-casing\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849334699.1902\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"LineString\"],\n [\"all\", [\"==\", \"brunnel\", \"bridge\"], [\"==\", \"class\", \"path\"]]\n ],\n \"paint\": {\n \"line-color\": \"#f8f4f0\",\n \"line-width\": { \"base\": 1.2, \"stops\": [[15, 1.2], [20, 18]] }\n }\n },\n {\n \"id\": \"bridge-path\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849334699.1902\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"LineString\"],\n [\"all\", [\"==\", \"brunnel\", \"bridge\"], [\"==\", \"class\", \"path\"]]\n ],\n \"paint\": {\n \"line-color\": \"#cba\",\n \"line-width\": { \"base\": 1.2, \"stops\": [[15, 1.2], [20, 4]] },\n \"line-dasharray\": [1.5, 0.75]\n }\n },\n {\n \"id\": \"bridge-motorway-link\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849334699.1902\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"bridge\"],\n [\"==\", \"class\", \"motorway_link\"]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#fc8\",\n \"line-width\": {\n \"base\": 1.2,\n \"stops\": [[12.5, 0], [13, 1.5], [14, 2.5], [20, 11.5]]\n }\n }\n },\n {\n \"id\": \"bridge-link\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849334699.1902\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"bridge\"],\n [\n \"in\",\n \"class\",\n \"primary_link\",\n \"secondary_link\",\n \"tertiary_link\",\n \"trunk_link\"\n ]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#fea\",\n \"line-width\": {\n \"base\": 1.2,\n \"stops\": [[12.5, 0], [13, 1.5], [14, 2.5], [20, 11.5]]\n }\n }\n },\n {\n \"id\": \"bridge-secondary-tertiary\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849334699.1902\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"bridge\"],\n [\"in\", \"class\", \"secondary\", \"tertiary\"]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#fea\",\n \"line-width\": { \"base\": 1.2, \"stops\": [[6.5, 0], [7, 0.5], [20, 20]] }\n }\n },\n {\n \"id\": \"bridge-trunk-primary\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849334699.1902\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"bridge\"],\n [\"in\", \"class\", \"primary\", \"trunk\"]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#fea\",\n \"line-width\": { \"base\": 1.2, \"stops\": [[6.5, 0], [7, 0.5], [20, 18]] }\n }\n },\n {\n \"id\": \"bridge-motorway\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849334699.1902\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\n \"all\",\n [\"==\", \"brunnel\", \"bridge\"],\n [\"==\", \"class\", \"motorway\"]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#fc8\",\n \"line-width\": { \"base\": 1.2, \"stops\": [[6.5, 0], [7, 0.5], [20, 18]] },\n \"line-opacity\": 0.5\n }\n },\n {\n \"id\": \"bridge-railway\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849334699.1902\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\"all\", [\"==\", \"brunnel\", \"bridge\"], [\"==\", \"class\", \"rail\"]],\n \"paint\": {\n \"line-color\": \"#bbb\",\n \"line-width\": { \"base\": 1.4, \"stops\": [[14, 0.4], [15, 0.75], [20, 2]] }\n }\n },\n {\n \"id\": \"bridge-railway-hatching\",\n \"type\": \"line\",\n \"metadata\": { \"mapbox:group\": \"1444849334699.1902\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"filter\": [\"all\", [\"==\", \"brunnel\", \"bridge\"], [\"==\", \"class\", \"rail\"]],\n \"paint\": {\n \"line-color\": \"#bbb\",\n \"line-dasharray\": [0.2, 8],\n \"line-width\": { \"base\": 1.4, \"stops\": [[14.5, 0], [15, 3], [20, 8]] }\n }\n },\n {\n \"id\": \"cablecar\",\n \"type\": \"line\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"minzoom\": 13,\n \"filter\": [\"==\", \"class\", \"cable_car\"],\n \"layout\": { \"visibility\": \"visible\", \"line-cap\": \"round\" },\n \"paint\": {\n \"line-color\": \"hsl(0, 0%, 70%)\",\n \"line-width\": { \"base\": 1, \"stops\": [[11, 1], [19, 2.5]] }\n }\n },\n {\n \"id\": \"cablecar-dash\",\n \"type\": \"line\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"minzoom\": 13,\n \"filter\": [\"==\", \"class\", \"cable_car\"],\n \"layout\": { \"visibility\": \"visible\", \"line-cap\": \"round\" },\n \"paint\": {\n \"line-color\": \"hsl(0, 0%, 70%)\",\n \"line-width\": { \"base\": 1, \"stops\": [[11, 3], [19, 5.5]] },\n \"line-dasharray\": [2, 3]\n }\n },\n {\n \"id\": \"boundary-land-level-4\",\n \"type\": \"line\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"boundary\",\n \"filter\": [\n \"all\",\n [\">=\", \"admin_level\", 4],\n [\"<=\", \"admin_level\", 8],\n [\"!=\", \"maritime\", 1]\n ],\n \"layout\": { \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"#9e9cab\",\n \"line-dasharray\": [3, 1, 1, 1],\n \"line-width\": { \"base\": 1.4, \"stops\": [[4, 0.4], [5, 1], [12, 3]] },\n \"line-opacity\": 0.6\n }\n },\n {\n \"id\": \"boundary-land-level-2\",\n \"type\": \"line\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"boundary\",\n \"filter\": [\n \"all\",\n [\"==\", \"admin_level\", 2],\n [\"!=\", \"maritime\", 1],\n [\"!=\", \"disputed\", 1]\n ],\n \"layout\": { \"line-cap\": \"round\", \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"hsl(248, 7%, 66%)\",\n \"line-width\": {\n \"base\": 1,\n \"stops\": [[0, 0.6], [4, 1.4], [5, 2], [12, 2]]\n }\n }\n },\n {\n \"id\": \"boundary-land-disputed\",\n \"type\": \"line\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"boundary\",\n \"filter\": [\"all\", [\"!=\", \"maritime\", 1], [\"==\", \"disputed\", 1]],\n \"layout\": { \"line-cap\": \"round\", \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"hsl(248, 7%, 70%)\",\n \"line-dasharray\": [1, 3],\n \"line-width\": {\n \"base\": 1,\n \"stops\": [[0, 0.6], [4, 1.4], [5, 2], [12, 8]]\n }\n }\n },\n {\n \"id\": \"boundary-water\",\n \"type\": \"line\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"boundary\",\n \"filter\": [\"all\", [\"in\", \"admin_level\", 2, 4], [\"==\", \"maritime\", 1]],\n \"layout\": { \"line-cap\": \"round\", \"line-join\": \"round\" },\n \"paint\": {\n \"line-color\": \"rgba(154, 189, 214, 1)\",\n \"line-width\": { \"base\": 1, \"stops\": [[0, 0.6], [4, 1], [5, 1], [12, 1]] },\n \"line-opacity\": { \"stops\": [[6, 0], [10, 0]] }\n }\n },\n {\n \"id\": \"waterway-name\",\n \"type\": \"symbol\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"waterway\",\n \"minzoom\": 13,\n \"filter\": [\"all\", [\"==\", \"$type\", \"LineString\"], [\"has\", \"name\"]],\n \"layout\": {\n \"text-font\": [\"Noto Sans Italic\"],\n \"text-size\": 14,\n \"text-field\": \"{name:latin} {name:nonlatin}\",\n \"text-max-width\": 5,\n \"text-rotation-alignment\": \"map\",\n \"symbol-placement\": \"line\",\n \"text-letter-spacing\": 0.2,\n \"symbol-spacing\": 350\n },\n \"paint\": {\n \"text-color\": \"#74aee9\",\n \"text-halo-width\": 1.5,\n \"text-halo-color\": \"rgba(255,255,255,0.7)\"\n }\n },\n {\n \"id\": \"water-name-lakeline\",\n \"type\": \"symbol\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"water_name\",\n \"filter\": [\"==\", \"$type\", \"LineString\"],\n \"layout\": {\n \"text-font\": [\"Noto Sans Italic\"],\n \"text-size\": 14,\n \"text-field\": \"{name:latin}\\n{name:nonlatin}\",\n \"text-max-width\": 5,\n \"text-rotation-alignment\": \"map\",\n \"symbol-placement\": \"line\",\n \"symbol-spacing\": 350,\n \"text-letter-spacing\": 0.2\n },\n \"paint\": {\n \"text-color\": \"#74aee9\",\n \"text-halo-width\": 1.5,\n \"text-halo-color\": \"rgba(255,255,255,0.7)\"\n }\n },\n {\n \"id\": \"water-name-ocean\",\n \"type\": \"symbol\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"water_name\",\n \"filter\": [\"all\", [\"==\", \"$type\", \"Point\"], [\"==\", \"class\", \"ocean\"]],\n \"layout\": {\n \"text-font\": [\"Noto Sans Italic\"],\n \"text-size\": 14,\n \"text-field\": \"{name:latin}\",\n \"text-max-width\": 5,\n \"text-rotation-alignment\": \"map\",\n \"symbol-placement\": \"point\",\n \"symbol-spacing\": 350,\n \"text-letter-spacing\": 0.2\n },\n \"paint\": {\n \"text-color\": \"#74aee9\",\n \"text-halo-width\": 1.5,\n \"text-halo-color\": \"rgba(255,255,255,0.7)\"\n }\n },\n {\n \"id\": \"water-name-other\",\n \"type\": \"symbol\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"water_name\",\n \"filter\": [\"all\", [\"==\", \"$type\", \"Point\"], [\"!in\", \"class\", \"ocean\"]],\n \"layout\": {\n \"text-font\": [\"Noto Sans Italic\"],\n \"text-size\": { \"stops\": [[0, 10], [6, 14]] },\n \"text-field\": \"{name:latin}\\n{name:nonlatin}\",\n \"text-max-width\": 5,\n \"text-rotation-alignment\": \"map\",\n \"symbol-placement\": \"point\",\n \"symbol-spacing\": 350,\n \"text-letter-spacing\": 0.2,\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"text-color\": \"#74aee9\",\n \"text-halo-width\": 1.5,\n \"text-halo-color\": \"rgba(255,255,255,0.7)\"\n }\n },\n {\n \"id\": \"poi-level-3\",\n \"type\": \"symbol\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"poi\",\n \"minzoom\": 16,\n \"filter\": [\"all\", [\"==\", \"$type\", \"Point\"], [\">=\", \"rank\", 25]],\n \"layout\": {\n \"text-padding\": 2,\n \"text-font\": [\"Noto Sans Regular\"],\n \"text-anchor\": \"top\",\n \"icon-image\": \"{class}_11\",\n \"text-field\": \"{name:latin}\\n{name:nonlatin}\",\n \"text-offset\": [0, 0.6],\n \"text-size\": 12,\n \"text-max-width\": 9\n },\n \"paint\": {\n \"text-halo-blur\": 0.5,\n \"text-color\": \"#666\",\n \"text-halo-width\": 1,\n \"text-halo-color\": \"#ffffff\"\n }\n },\n {\n \"id\": \"poi-level-2\",\n \"type\": \"symbol\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"poi\",\n \"minzoom\": 15,\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"Point\"],\n [\"<=\", \"rank\", 24],\n [\">=\", \"rank\", 15]\n ],\n \"layout\": {\n \"text-padding\": 2,\n \"text-font\": [\"Noto Sans Regular\"],\n \"text-anchor\": \"top\",\n \"icon-image\": \"{class}_11\",\n \"text-field\": \"{name:latin}\\n{name:nonlatin}\",\n \"text-offset\": [0, 0.6],\n \"text-size\": 12,\n \"text-max-width\": 9\n },\n \"paint\": {\n \"text-halo-blur\": 0.5,\n \"text-color\": \"#666\",\n \"text-halo-width\": 1,\n \"text-halo-color\": \"#ffffff\"\n }\n },\n {\n \"id\": \"poi-level-1\",\n \"type\": \"symbol\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"poi\",\n \"minzoom\": 14,\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"Point\"],\n [\"<=\", \"rank\", 14],\n [\"has\", \"name\"]\n ],\n \"layout\": {\n \"text-padding\": 2,\n \"text-font\": [\"Noto Sans Regular\"],\n \"text-anchor\": \"top\",\n \"icon-image\": \"{class}_11\",\n \"text-field\": \"{name:latin}\\n{name:nonlatin}\",\n \"text-offset\": [0, 0.6],\n \"text-size\": 11,\n \"text-max-width\": 9\n },\n \"paint\": {\n \"text-halo-blur\": 0.5,\n \"text-color\": \"rgba(191, 228, 172, 1)\",\n \"text-halo-width\": 1,\n \"text-halo-color\": \"rgba(30, 29, 29, 1)\"\n }\n },\n {\n \"id\": \"poi-railway\",\n \"type\": \"symbol\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"poi\",\n \"minzoom\": 13,\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"Point\"],\n [\"has\", \"name\"],\n [\"==\", \"class\", \"railway\"],\n [\"==\", \"subclass\", \"station\"]\n ],\n \"layout\": {\n \"text-padding\": 2,\n \"text-font\": [\"Noto Sans Regular\"],\n \"text-anchor\": \"top\",\n \"icon-image\": \"{class}_11\",\n \"text-field\": \"{name:latin}\\n{name:nonlatin}\",\n \"text-offset\": [0, 0.6],\n \"text-size\": 12,\n \"text-max-width\": 9,\n \"icon-optional\": false,\n \"icon-ignore-placement\": false,\n \"icon-allow-overlap\": false,\n \"text-ignore-placement\": false,\n \"text-allow-overlap\": false,\n \"text-optional\": true\n },\n \"paint\": {\n \"text-halo-blur\": 0.5,\n \"text-color\": \"#666\",\n \"text-halo-width\": 1,\n \"text-halo-color\": \"#ffffff\"\n }\n },\n {\n \"id\": \"road_oneway\",\n \"type\": \"symbol\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"minzoom\": 15,\n \"filter\": [\n \"all\",\n [\"==\", \"oneway\", 1],\n [\n \"in\",\n \"class\",\n \"motorway\",\n \"trunk\",\n \"primary\",\n \"secondary\",\n \"tertiary\",\n \"minor\",\n \"service\"\n ]\n ],\n \"layout\": {\n \"symbol-placement\": \"line\",\n \"icon-image\": \"oneway\",\n \"symbol-spacing\": 75,\n \"icon-padding\": 2,\n \"icon-rotation-alignment\": \"map\",\n \"icon-rotate\": 90,\n \"icon-size\": { \"stops\": [[15, 0.5], [19, 1]] }\n },\n \"paint\": { \"icon-opacity\": 0.5 }\n },\n {\n \"id\": \"road_oneway_opposite\",\n \"type\": \"symbol\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation\",\n \"minzoom\": 15,\n \"filter\": [\n \"all\",\n [\"==\", \"oneway\", -1],\n [\n \"in\",\n \"class\",\n \"motorway\",\n \"trunk\",\n \"primary\",\n \"secondary\",\n \"tertiary\",\n \"minor\",\n \"service\"\n ]\n ],\n \"layout\": {\n \"symbol-placement\": \"line\",\n \"icon-image\": \"oneway\",\n \"symbol-spacing\": 75,\n \"icon-padding\": 2,\n \"icon-rotation-alignment\": \"map\",\n \"icon-rotate\": -90,\n \"icon-size\": { \"stops\": [[15, 0.5], [19, 1]] }\n },\n \"paint\": { \"icon-opacity\": 0.5 }\n },\n {\n \"id\": \"highway-name-path\",\n \"type\": \"symbol\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation_name\",\n \"minzoom\": 15.5,\n \"filter\": [\"==\", \"class\", \"path\"],\n \"layout\": {\n \"text-size\": { \"base\": 1, \"stops\": [[13, 12], [14, 13]] },\n \"text-font\": [\"Noto Sans Regular\"],\n \"text-field\": \"{name:latin} {name:nonlatin}\",\n \"symbol-placement\": \"line\",\n \"text-rotation-alignment\": \"map\"\n },\n \"paint\": {\n \"text-halo-color\": \"#f8f4f0\",\n \"text-color\": \"hsl(30, 23%, 62%)\",\n \"text-halo-width\": 0.5\n }\n },\n {\n \"id\": \"highway-name-minor\",\n \"type\": \"symbol\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation_name\",\n \"minzoom\": 15,\n \"filter\": [\n \"all\",\n [\"==\", \"$type\", \"LineString\"],\n [\"in\", \"class\", \"minor\", \"service\", \"track\"]\n ],\n \"layout\": {\n \"text-size\": { \"base\": 1, \"stops\": [[13, 12], [14, 13]] },\n \"text-font\": [\"Noto Sans Regular\"],\n \"text-field\": \"{name:latin} {name:nonlatin}\",\n \"symbol-placement\": \"line\",\n \"text-rotation-alignment\": \"map\"\n },\n \"paint\": {\n \"text-halo-blur\": 0.5,\n \"text-color\": \"#765\",\n \"text-halo-width\": 1\n }\n },\n {\n \"id\": \"highway-name-major\",\n \"type\": \"symbol\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation_name\",\n \"minzoom\": 12.2,\n \"filter\": [\"in\", \"class\", \"primary\", \"secondary\", \"tertiary\", \"trunk\"],\n \"layout\": {\n \"text-size\": { \"base\": 1, \"stops\": [[13, 12], [14, 13]] },\n \"text-font\": [\"Noto Sans Regular\"],\n \"text-field\": \"{name:latin} {name:nonlatin}\",\n \"symbol-placement\": \"line\",\n \"text-rotation-alignment\": \"map\"\n },\n \"paint\": {\n \"text-halo-blur\": 0.5,\n \"text-color\": \"#765\",\n \"text-halo-width\": 1\n }\n },\n {\n \"id\": \"highway-shield\",\n \"type\": \"symbol\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation_name\",\n \"minzoom\": 8,\n \"filter\": [\n \"all\",\n [\"<=\", \"ref_length\", 6],\n [\"==\", \"$type\", \"LineString\"],\n [\"!in\", \"network\", \"us-interstate\", \"us-highway\", \"us-state\"]\n ],\n \"layout\": {\n \"text-size\": 10,\n \"icon-image\": \"road_{ref_length}\",\n \"icon-rotation-alignment\": \"viewport\",\n \"symbol-spacing\": 200,\n \"text-font\": [\"Noto Sans Regular\"],\n \"symbol-placement\": { \"base\": 1, \"stops\": [[10, \"point\"], [11, \"line\"]] },\n \"text-rotation-alignment\": \"viewport\",\n \"icon-size\": 1,\n \"text-field\": \"{ref}\"\n },\n \"paint\": {\n \"text-opacity\": 1,\n \"text-color\": \"rgba(20, 19, 19, 1)\",\n \"text-halo-color\": \"rgba(230, 221, 221, 0)\",\n \"text-halo-width\": 2,\n \"icon-color\": \"rgba(183, 18, 18, 1)\",\n \"icon-opacity\": 0.3,\n \"icon-halo-color\": \"rgba(183, 55, 55, 0)\"\n }\n },\n {\n \"id\": \"highway-shield-us-interstate\",\n \"type\": \"symbol\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation_name\",\n \"minzoom\": 7,\n \"filter\": [\n \"all\",\n [\"<=\", \"ref_length\", 6],\n [\"==\", \"$type\", \"LineString\"],\n [\"in\", \"network\", \"us-interstate\"]\n ],\n \"layout\": {\n \"text-size\": 10,\n \"icon-image\": \"{network}_{ref_length}\",\n \"icon-rotation-alignment\": \"viewport\",\n \"symbol-spacing\": 200,\n \"text-font\": [\"Noto Sans Regular\"],\n \"symbol-placement\": {\n \"base\": 1,\n \"stops\": [[7, \"point\"], [7, \"line\"], [8, \"line\"]]\n },\n \"text-rotation-alignment\": \"viewport\",\n \"icon-size\": 1,\n \"text-field\": \"{ref}\"\n },\n \"paint\": { \"text-color\": \"rgba(0, 0, 0, 1)\" }\n },\n {\n \"id\": \"highway-shield-us-other\",\n \"type\": \"symbol\",\n \"source\": \"openmaptiles\",\n \"source-layer\": \"transportation_name\",\n \"minzoom\": 9,\n \"filter\": [\n \"all\",\n [\"<=\", \"ref_length\", 6],\n [\"==\", \"$type\", \"LineString\"],\n [\"in\", \"network\", \"us-highway\", \"us-state\"]\n ],\n \"layout\": {\n \"text-size\": 10,\n \"icon-image\": \"{network}_{ref_length}\",\n \"icon-rotation-alignment\": \"viewport\",\n \"symbol-spacing\": 200,\n \"text-font\": [\"Noto Sans Regular\"],\n \"symbol-placement\": { \"base\": 1, \"stops\": [[10, \"point\"], [11, \"line\"]] },\n \"text-rotation-alignment\": \"viewport\",\n \"icon-size\": 1,\n \"text-field\": \"{ref}\"\n },\n \"paint\": { \"text-color\": \"rgba(0, 0, 0, 1)\" }\n },\n {\n \"id\": \"place-other\",\n \"type\": \"symbol\",\n \"metadata\": { \"mapbox:group\": \"1444849242106.713\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"place\",\n \"minzoom\": 12,\n \"filter\": [\n \"!in\",\n \"class\",\n \"city\",\n \"town\",\n \"village\",\n \"country\",\n \"continent\"\n ],\n \"layout\": {\n \"text-letter-spacing\": 0.1,\n \"text-size\": { \"base\": 1.2, \"stops\": [[12, 10], [15, 14]] },\n \"text-font\": [\"Noto Sans Bold\"],\n \"text-field\": \"{name:latin}\\n{name:nonlatin}\",\n \"text-transform\": \"uppercase\",\n \"text-max-width\": 9,\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"text-color\": \"rgba(255,255,255,1)\",\n \"text-halo-width\": 1.2,\n \"text-halo-color\": \"rgba(57, 28, 28, 1)\"\n }\n },\n {\n \"id\": \"place-village\",\n \"type\": \"symbol\",\n \"metadata\": { \"mapbox:group\": \"1444849242106.713\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"place\",\n \"minzoom\": 10,\n \"filter\": [\"==\", \"class\", \"village\"],\n \"layout\": {\n \"text-font\": [\"Noto Sans Regular\"],\n \"text-size\": { \"base\": 1.2, \"stops\": [[10, 12], [15, 16]] },\n \"text-field\": \"{name:latin}\\n{name:nonlatin}\",\n \"text-max-width\": 8,\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"text-color\": \"rgba(255, 255, 255, 1)\",\n \"text-halo-width\": 1.2,\n \"text-halo-color\": \"rgba(10, 9, 9, 0.8)\"\n }\n },\n {\n \"id\": \"place-town\",\n \"type\": \"symbol\",\n \"metadata\": { \"mapbox:group\": \"1444849242106.713\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"place\",\n \"filter\": [\"==\", \"class\", \"town\"],\n \"layout\": {\n \"text-font\": [\"Noto Sans Regular\"],\n \"text-size\": { \"base\": 1.2, \"stops\": [[10, 14], [15, 24]] },\n \"text-field\": \"{name:latin}\\n{name:nonlatin}\",\n \"text-max-width\": 8,\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"text-color\": \"rgba(255, 255, 255, 1)\",\n \"text-halo-width\": 1.2,\n \"text-halo-color\": \"rgba(22, 22, 22, 0.8)\"\n }\n },\n {\n \"id\": \"place-city\",\n \"type\": \"symbol\",\n \"metadata\": { \"mapbox:group\": \"1444849242106.713\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"place\",\n \"filter\": [\"all\", [\"!=\", \"capital\", 2], [\"==\", \"class\", \"city\"]],\n \"layout\": {\n \"text-font\": [\"Noto Sans Regular\"],\n \"text-size\": { \"base\": 1.2, \"stops\": [[7, 14], [11, 24]] },\n \"text-field\": \"{name:latin}\\n{name:nonlatin}\",\n \"text-max-width\": 8,\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"text-color\": \"rgba(0, 0, 0, 1)\",\n \"text-halo-width\": 1.2,\n \"text-halo-color\": \"rgba(255,255,255,0.8)\"\n }\n },\n {\n \"id\": \"place-city-capital\",\n \"type\": \"symbol\",\n \"metadata\": { \"mapbox:group\": \"1444849242106.713\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"place\",\n \"filter\": [\"all\", [\"==\", \"capital\", 2], [\"==\", \"class\", \"city\"]],\n \"layout\": {\n \"text-font\": [\"Noto Sans Regular\"],\n \"text-size\": { \"base\": 1.2, \"stops\": [[7, 14], [11, 24]] },\n \"text-field\": \"{name:latin}\\n{name:nonlatin}\",\n \"text-max-width\": 8,\n \"icon-image\": \"star_11\",\n \"text-offset\": [0.4, 0],\n \"icon-size\": 0.8,\n \"text-anchor\": \"left\",\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"text-color\": \"#333\",\n \"text-halo-width\": 1.2,\n \"text-halo-color\": \"rgba(255,255,255,0.8)\"\n }\n },\n {\n \"id\": \"place-country-other\",\n \"type\": \"symbol\",\n \"metadata\": { \"mapbox:group\": \"1444849242106.713\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"place\",\n \"filter\": [\n \"all\",\n [\"==\", \"class\", \"country\"],\n [\">=\", \"rank\", 3],\n [\"!has\", \"iso_a2\"]\n ],\n \"layout\": {\n \"text-font\": [\"Noto Sans Italic\"],\n \"text-field\": \"{name:latin}\",\n \"text-size\": { \"stops\": [[3, 11], [7, 17]] },\n \"text-transform\": \"uppercase\",\n \"text-max-width\": 6.25,\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"text-halo-blur\": 1,\n \"text-color\": \"#334\",\n \"text-halo-width\": 2,\n \"text-halo-color\": \"rgba(255,255,255,0.8)\"\n }\n },\n {\n \"id\": \"place-country-3\",\n \"type\": \"symbol\",\n \"metadata\": { \"mapbox:group\": \"1444849242106.713\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"place\",\n \"filter\": [\n \"all\",\n [\"==\", \"class\", \"country\"],\n [\">=\", \"rank\", 3],\n [\"has\", \"iso_a2\"]\n ],\n \"layout\": {\n \"text-font\": [\"Noto Sans Bold\"],\n \"text-field\": \"{name:latin}\",\n \"text-size\": { \"stops\": [[3, 11], [7, 17]] },\n \"text-transform\": \"uppercase\",\n \"text-max-width\": 6.25,\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"text-halo-blur\": 1,\n \"text-color\": \"#334\",\n \"text-halo-width\": 2,\n \"text-halo-color\": \"rgba(255,255,255,0.8)\"\n }\n },\n {\n \"id\": \"place-country-2\",\n \"type\": \"symbol\",\n \"metadata\": { \"mapbox:group\": \"1444849242106.713\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"place\",\n \"filter\": [\n \"all\",\n [\"==\", \"class\", \"country\"],\n [\"==\", \"rank\", 2],\n [\"has\", \"iso_a2\"]\n ],\n \"layout\": {\n \"text-font\": [\"Noto Sans Bold\"],\n \"text-field\": \"{name:latin}\",\n \"text-size\": { \"stops\": [[2, 11], [5, 17]] },\n \"text-transform\": \"uppercase\",\n \"text-max-width\": 6.25,\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"text-halo-blur\": 1,\n \"text-color\": \"#334\",\n \"text-halo-width\": 2,\n \"text-halo-color\": \"rgba(255,255,255,0.8)\"\n }\n },\n {\n \"id\": \"place-country-1\",\n \"type\": \"symbol\",\n \"metadata\": { \"mapbox:group\": \"1444849242106.713\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"place\",\n \"filter\": [\n \"all\",\n [\"==\", \"class\", \"country\"],\n [\"==\", \"rank\", 1],\n [\"has\", \"iso_a2\"]\n ],\n \"layout\": {\n \"text-font\": [\"Noto Sans Bold\"],\n \"text-field\": \"{name:latin}\",\n \"text-size\": { \"stops\": [[1, 11], [4, 17]] },\n \"text-transform\": \"uppercase\",\n \"text-max-width\": 6.25,\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"text-halo-blur\": 1,\n \"text-color\": \"#334\",\n \"text-halo-width\": 2,\n \"text-halo-color\": \"rgba(255,255,255,0.8)\"\n }\n },\n {\n \"id\": \"place-continent\",\n \"type\": \"symbol\",\n \"metadata\": { \"mapbox:group\": \"1444849242106.713\" },\n \"source\": \"openmaptiles\",\n \"source-layer\": \"place\",\n \"maxzoom\": 1,\n \"filter\": [\"==\", \"class\", \"continent\"],\n \"layout\": {\n \"text-font\": [\"Noto Sans Bold\"],\n \"text-field\": \"{name:latin}\",\n \"text-size\": 14,\n \"text-max-width\": 6.25,\n \"text-transform\": \"uppercase\",\n \"visibility\": \"visible\"\n },\n \"paint\": {\n \"text-halo-blur\": 1,\n \"text-color\": \"#334\",\n \"text-halo-width\": 2,\n \"text-halo-color\": \"rgba(255,255,255,0.8)\"\n }\n }\n ],\n \"id\": \"qebnlkra6\"\n };\n }\n });\n\n // src/plots/map/styles/arcgis-sat.js\n var require_arcgis_sat = __commonJS({\n \"src/plots/map/styles/arcgis-sat.js\"(exports, module) {\n module.exports = {\n \"version\": 8,\n \"name\": \"orto\",\n \"metadata\": {},\n \"center\": [\n 1.537786,\n 41.837539\n ],\n \"zoom\": 12,\n \"bearing\": 0,\n \"pitch\": 0,\n \"light\": {\n \"anchor\": \"viewport\",\n \"color\": \"white\",\n \"intensity\": 0.4,\n \"position\": [\n 1.15,\n 45,\n 30\n ]\n },\n \"sources\": {\n \"ortoEsri\": {\n \"type\": \"raster\",\n \"tiles\": [\n \"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}\"\n ],\n \"tileSize\": 256,\n \"maxzoom\": 18,\n \"attribution\": \"ESRI © ESRI\"\n },\n \"ortoInstaMaps\": {\n \"type\": \"raster\",\n \"tiles\": [\n \"https://tilemaps.icgc.cat/mapfactory/wmts/orto_8_12/CAT3857/{z}/{x}/{y}.png\"\n ],\n \"tileSize\": 256,\n \"maxzoom\": 13\n },\n \"ortoICGC\": {\n \"type\": \"raster\",\n \"tiles\": [\n \"https://geoserveis.icgc.cat/icc_mapesmultibase/noutm/wmts/orto/GRID3857/{z}/{x}/{y}.jpeg\"\n ],\n \"tileSize\": 256,\n \"minzoom\": 13.1,\n \"maxzoom\": 20\n },\n \"openmaptiles\": {\n \"type\": \"vector\",\n \"url\": \"https://geoserveis.icgc.cat/contextmaps/basemap.json\"\n }\n },\n \"sprite\": \"https://geoserveis.icgc.cat/contextmaps/sprites/sprite@1\",\n \"glyphs\": \"https://geoserveis.icgc.cat/contextmaps/glyphs/{fontstack}/{range}.pbf\",\n \"layers\": [\n {\n \"id\": \"background\",\n \"type\": \"background\",\n \"paint\": {\n \"background-color\": \"#F4F9F4\"\n }\n },\n {\n \"id\": \"ortoEsri\",\n \"type\": \"raster\",\n \"source\": \"ortoEsri\",\n \"maxzoom\": 16,\n \"layout\": {\n \"visibility\": \"visible\"\n }\n },\n {\n \"id\": \"ortoICGC\",\n \"type\": \"raster\",\n \"source\": \"ortoICGC\",\n \"minzoom\": 13.1,\n \"maxzoom\": 19,\n \"layout\": {\n \"visibility\": \"visible\"\n }\n },\n {\n \"id\": \"ortoInstaMaps\",\n \"type\": \"raster\",\n \"source\": \"ortoInstaMaps\",\n \"maxzoom\": 13,\n \"layout\": {\n \"visibility\": \"visible\"\n }\n }\n ]\n };\n }\n });\n\n // src/plots/map/constants.js\n var require_constants27 = __commonJS({\n \"src/plots/map/constants.js\"(exports, module) {\n \"use strict\";\n var sortObjectKeys = require_sort_object_keys();\n var arcgisSatHybrid = require_arcgis_sat_hybrid();\n var arcgisSat = require_arcgis_sat();\n var OSM = '\\xA9 OpenStreetMap contributors';\n var cartoPositron = \"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json\";\n var cartoDarkmatter = \"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json\";\n var cartoVoyager = \"https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json\";\n var cartoPositronNoLabels = \"https://basemaps.cartocdn.com/gl/positron-nolabels-gl-style/style.json\";\n var cartoDarkmatterNoLabels = \"https://basemaps.cartocdn.com/gl/dark-matter-nolabels-gl-style/style.json\";\n var cartoVoyagerNoLabels = \"https://basemaps.cartocdn.com/gl/voyager-nolabels-gl-style/style.json\";\n var stylesMap = {\n basic: cartoVoyager,\n streets: cartoVoyager,\n outdoors: cartoVoyager,\n light: cartoPositron,\n dark: cartoDarkmatter,\n satellite: arcgisSat,\n \"satellite-streets\": arcgisSatHybrid,\n \"open-street-map\": {\n id: \"osm\",\n version: 8,\n sources: {\n \"plotly-osm-tiles\": {\n type: \"raster\",\n attribution: OSM,\n tiles: [\n \"https://tile.openstreetmap.org/{z}/{x}/{y}.png\"\n ],\n tileSize: 256\n }\n },\n layers: [{\n id: \"plotly-osm-tiles\",\n type: \"raster\",\n source: \"plotly-osm-tiles\",\n minzoom: 0,\n maxzoom: 22\n }],\n glyphs: \"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf\"\n },\n \"white-bg\": {\n id: \"white-bg\",\n version: 8,\n sources: {},\n layers: [{\n id: \"white-bg\",\n type: \"background\",\n paint: { \"background-color\": \"#FFFFFF\" },\n minzoom: 0,\n maxzoom: 22\n }],\n glyphs: \"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf\"\n },\n \"carto-positron\": cartoPositron,\n \"carto-darkmatter\": cartoDarkmatter,\n \"carto-voyager\": cartoVoyager,\n \"carto-positron-nolabels\": cartoPositronNoLabels,\n \"carto-darkmatter-nolabels\": cartoDarkmatterNoLabels,\n \"carto-voyager-nolabels\": cartoVoyagerNoLabels\n };\n var styleValuesMap = sortObjectKeys(stylesMap);\n module.exports = {\n styleValueDflt: \"basic\",\n stylesMap,\n styleValuesMap,\n traceLayerPrefix: \"plotly-trace-layer-\",\n layoutLayerPrefix: \"plotly-layout-layer-\",\n missingStyleErrorMsg: [\n \"No valid maplibre style found, please set `map.style` to one of:\",\n styleValuesMap.join(\", \"),\n \"or use a tile service.\"\n ].join(\"\\n\"),\n mapOnErrorMsg: \"Map error.\"\n };\n }\n });\n\n // src/plots/map/layout_attributes.js\n var require_layout_attributes20 = __commonJS({\n \"src/plots/map/layout_attributes.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var defaultLine = require_color().defaultLine;\n var domainAttrs = require_domain().attributes;\n var fontAttrs = require_font_attributes();\n var textposition = require_attributes12().textposition;\n var overrideAll = require_edit_types().overrideAll;\n var templatedArray = require_plot_template().templatedArray;\n var constants = require_constants27();\n var fontAttr = fontAttrs({\n noFontVariant: true,\n noFontShadow: true,\n noFontLineposition: true,\n noFontTextcase: true\n });\n fontAttr.family.dflt = \"Open Sans Regular, Arial Unicode MS Regular\";\n var attrs = module.exports = overrideAll({\n _arrayAttrRegexps: [Lib.counterRegex(\"map\", \".layers\", true)],\n domain: domainAttrs({ name: \"map\" }),\n style: {\n valType: \"any\",\n values: constants.styleValuesMap,\n dflt: constants.styleValueDflt\n },\n center: {\n lon: {\n valType: \"number\",\n dflt: 0\n },\n lat: {\n valType: \"number\",\n dflt: 0\n }\n },\n zoom: {\n valType: \"number\",\n dflt: 1\n },\n bearing: {\n valType: \"number\",\n dflt: 0\n },\n pitch: {\n valType: \"number\",\n dflt: 0\n },\n bounds: {\n west: {\n valType: \"number\"\n },\n east: {\n valType: \"number\"\n },\n south: {\n valType: \"number\"\n },\n north: {\n valType: \"number\"\n }\n },\n layers: templatedArray(\"layer\", {\n visible: {\n valType: \"boolean\",\n dflt: true\n },\n sourcetype: {\n valType: \"enumerated\",\n values: [\"geojson\", \"vector\", \"raster\", \"image\"],\n dflt: \"geojson\"\n },\n source: {\n valType: \"any\"\n },\n sourcelayer: {\n valType: \"string\",\n dflt: \"\"\n },\n sourceattribution: {\n valType: \"string\"\n },\n type: {\n valType: \"enumerated\",\n values: [\"circle\", \"line\", \"fill\", \"symbol\", \"raster\"],\n dflt: \"circle\"\n },\n coordinates: {\n valType: \"any\"\n },\n // attributes shared between all types\n below: {\n valType: \"string\"\n },\n color: {\n valType: \"color\",\n dflt: defaultLine\n },\n opacity: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 1\n },\n minzoom: {\n valType: \"number\",\n min: 0,\n max: 24,\n dflt: 0\n },\n maxzoom: {\n valType: \"number\",\n min: 0,\n max: 24,\n dflt: 24\n },\n // type-specific style attributes\n circle: {\n radius: {\n valType: \"number\",\n dflt: 15\n }\n },\n line: {\n width: {\n valType: \"number\",\n dflt: 2\n },\n dash: {\n valType: \"data_array\"\n }\n },\n fill: {\n outlinecolor: {\n valType: \"color\",\n dflt: defaultLine\n }\n },\n symbol: {\n icon: {\n valType: \"string\",\n dflt: \"marker\"\n },\n iconsize: {\n valType: \"number\",\n dflt: 10\n },\n text: {\n valType: \"string\",\n dflt: \"\"\n },\n placement: {\n valType: \"enumerated\",\n values: [\"point\", \"line\", \"line-center\"],\n dflt: \"point\"\n },\n textfont: fontAttr,\n textposition: Lib.extendFlat({}, textposition, { arrayOk: false })\n }\n })\n }, \"plot\", \"from-root\");\n attrs.uirevision = {\n valType: \"any\",\n editType: \"none\"\n };\n }\n });\n\n // src/traces/scattermap/attributes.js\n var require_attributes57 = __commonJS({\n \"src/traces/scattermap/attributes.js\"(exports, module) {\n \"use strict\";\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var makeFillcolorAttr = require_fillcolor_attribute();\n var scatterGeoAttrs = require_attributes48();\n var scatterAttrs = require_attributes12();\n var mapAttrs = require_layout_attributes20();\n var baseAttrs = require_attributes2();\n var colorScaleAttrs = require_attributes8();\n var extendFlat = require_extend().extendFlat;\n var overrideAll = require_edit_types().overrideAll;\n var mapLayoutAtributes = require_layout_attributes20();\n var lineAttrs = scatterGeoAttrs.line;\n var markerAttrs = scatterGeoAttrs.marker;\n module.exports = overrideAll({\n lon: scatterGeoAttrs.lon,\n lat: scatterGeoAttrs.lat,\n cluster: {\n enabled: {\n valType: \"boolean\"\n },\n maxzoom: extendFlat({}, mapLayoutAtributes.layers.maxzoom, {}),\n step: {\n valType: \"number\",\n arrayOk: true,\n dflt: -1,\n min: -1\n },\n size: {\n valType: \"number\",\n arrayOk: true,\n dflt: 20,\n min: 0\n },\n color: {\n valType: \"color\",\n arrayOk: true\n },\n opacity: extendFlat({}, markerAttrs.opacity, {\n dflt: 1\n })\n },\n // locations\n // locationmode\n mode: extendFlat({}, scatterAttrs.mode, {\n dflt: \"markers\"\n }),\n text: extendFlat({}, scatterAttrs.text, {}),\n texttemplate: texttemplateAttrs({ editType: \"plot\" }, {\n keys: [\"lat\", \"lon\", \"text\"]\n }),\n hovertext: extendFlat({}, scatterAttrs.hovertext, {}),\n line: {\n color: lineAttrs.color,\n width: lineAttrs.width\n // TODO\n // dash: dash\n },\n connectgaps: scatterAttrs.connectgaps,\n marker: extendFlat(\n {\n symbol: {\n valType: \"string\",\n dflt: \"circle\",\n arrayOk: true\n },\n angle: {\n valType: \"number\",\n dflt: \"auto\",\n arrayOk: true\n },\n allowoverlap: {\n valType: \"boolean\",\n dflt: false\n },\n opacity: markerAttrs.opacity,\n size: markerAttrs.size,\n sizeref: markerAttrs.sizeref,\n sizemin: markerAttrs.sizemin,\n sizemode: markerAttrs.sizemode\n },\n colorScaleAttrs(\"marker\")\n // line\n ),\n fill: scatterGeoAttrs.fill,\n fillcolor: makeFillcolorAttr(),\n textfont: mapAttrs.layers.symbol.textfont,\n textposition: mapAttrs.layers.symbol.textposition,\n below: {\n valType: \"string\"\n },\n selected: {\n marker: scatterAttrs.selected.marker\n },\n unselected: {\n marker: scatterAttrs.unselected.marker\n },\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: [\"lon\", \"lat\", \"text\", \"name\"]\n }),\n hovertemplate: hovertemplateAttrs()\n }, \"calc\", \"nested\");\n }\n });\n\n // src/traces/scattermap/constants.js\n var require_constants28 = __commonJS({\n \"src/traces/scattermap/constants.js\"(exports, module) {\n \"use strict\";\n var supportedFonts = [\n \"Metropolis Black Italic\",\n \"Metropolis Black\",\n \"Metropolis Bold Italic\",\n \"Metropolis Bold\",\n \"Metropolis Extra Bold Italic\",\n \"Metropolis Extra Bold\",\n \"Metropolis Extra Light Italic\",\n \"Metropolis Extra Light\",\n \"Metropolis Light Italic\",\n \"Metropolis Light\",\n \"Metropolis Medium Italic\",\n \"Metropolis Medium\",\n \"Metropolis Regular Italic\",\n \"Metropolis Regular\",\n \"Metropolis Semi Bold Italic\",\n \"Metropolis Semi Bold\",\n \"Metropolis Thin Italic\",\n \"Metropolis Thin\",\n \"Open Sans Bold Italic\",\n \"Open Sans Bold\",\n \"Open Sans Extrabold Italic\",\n \"Open Sans Extrabold\",\n \"Open Sans Italic\",\n \"Open Sans Light Italic\",\n \"Open Sans Light\",\n \"Open Sans Regular\",\n \"Open Sans Semibold Italic\",\n \"Open Sans Semibold\",\n \"Klokantech Noto Sans Bold\",\n \"Klokantech Noto Sans CJK Bold\",\n \"Klokantech Noto Sans CJK Regular\",\n \"Klokantech Noto Sans Italic\",\n \"Klokantech Noto Sans Regular\"\n ];\n module.exports = {\n isSupportedFont: function(a) {\n return supportedFonts.indexOf(a) !== -1;\n }\n };\n }\n });\n\n // src/traces/scattermap/defaults.js\n var require_defaults53 = __commonJS({\n \"src/traces/scattermap/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var subTypes = require_subtypes();\n var handleMarkerDefaults = require_marker_defaults();\n var handleLineDefaults = require_line_defaults();\n var handleTextDefaults = require_text_defaults();\n var handleFillColorDefaults = require_fillcolor_defaults();\n var attributes = require_attributes57();\n var isSupportedFont = require_constants28().isSupportedFont;\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n function coerce2(attr, dflt) {\n return Lib.coerce2(traceIn, traceOut, attributes, attr, dflt);\n }\n var len = handleLonLatDefaults(traceIn, traceOut, coerce);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n coerce(\"text\");\n coerce(\"texttemplate\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n coerce(\"mode\");\n coerce(\"below\");\n if (subTypes.hasMarkers(traceOut)) {\n handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, { noLine: true, noAngle: true });\n coerce(\"marker.allowoverlap\");\n coerce(\"marker.angle\");\n var marker = traceOut.marker;\n if (marker.symbol !== \"circle\") {\n if (Lib.isArrayOrTypedArray(marker.size)) marker.size = marker.size[0];\n if (Lib.isArrayOrTypedArray(marker.color)) marker.color = marker.color[0];\n }\n }\n if (subTypes.hasLines(traceOut)) {\n handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce, { noDash: true });\n coerce(\"connectgaps\");\n }\n var clusterMaxzoom = coerce2(\"cluster.maxzoom\");\n var clusterStep = coerce2(\"cluster.step\");\n var clusterColor = coerce2(\"cluster.color\", traceOut.marker && traceOut.marker.color || defaultColor);\n var clusterSize = coerce2(\"cluster.size\");\n var clusterOpacity = coerce2(\"cluster.opacity\");\n var clusterEnabledDflt = clusterMaxzoom !== false || clusterStep !== false || clusterColor !== false || clusterSize !== false || clusterOpacity !== false;\n var clusterEnabled = coerce(\"cluster.enabled\", clusterEnabledDflt);\n if (clusterEnabled || subTypes.hasText(traceOut)) {\n var layoutFontFamily = layout.font.family;\n handleTextDefaults(\n traceIn,\n traceOut,\n layout,\n coerce,\n {\n noSelect: true,\n noFontVariant: true,\n noFontShadow: true,\n noFontLineposition: true,\n noFontTextcase: true,\n font: {\n family: isSupportedFont(layoutFontFamily) ? layoutFontFamily : \"Open Sans Regular\",\n weight: layout.font.weight,\n style: layout.font.style,\n size: layout.font.size,\n color: layout.font.color\n }\n }\n );\n }\n coerce(\"fill\");\n if (traceOut.fill !== \"none\") {\n handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce);\n }\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n };\n function handleLonLatDefaults(traceIn, traceOut, coerce) {\n var lon = coerce(\"lon\") || [];\n var lat = coerce(\"lat\") || [];\n var len = Math.min(lon.length, lat.length);\n traceOut._length = len;\n return len;\n }\n }\n });\n\n // src/traces/scattermap/format_labels.js\n var require_format_labels6 = __commonJS({\n \"src/traces/scattermap/format_labels.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n module.exports = function formatLabels(cdi, trace, fullLayout) {\n var labels = {};\n var subplot = fullLayout[trace.subplot]._subplot;\n var ax = subplot.mockAxis;\n var lonlat = cdi.lonlat;\n labels.lonLabel = Axes.tickText(ax, ax.c2l(lonlat[0]), true).text;\n labels.latLabel = Axes.tickText(ax, ax.c2l(lonlat[1]), true).text;\n return labels;\n };\n }\n });\n\n // src/plots/map/convert_text_opts.js\n var require_convert_text_opts2 = __commonJS({\n \"src/plots/map/convert_text_opts.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n module.exports = function convertTextOpts(textposition, iconSize) {\n var parts = textposition.split(\" \");\n var vPos = parts[0];\n var hPos = parts[1];\n var factor = Lib.isArrayOrTypedArray(iconSize) ? Lib.mean(iconSize) : iconSize;\n var xInc = 0.5 + factor / 100;\n var yInc = 1.5 + factor / 100;\n var anchorVals = [\"\", \"\"];\n var offset = [0, 0];\n switch (vPos) {\n case \"top\":\n anchorVals[0] = \"top\";\n offset[1] = -yInc;\n break;\n case \"bottom\":\n anchorVals[0] = \"bottom\";\n offset[1] = yInc;\n break;\n }\n switch (hPos) {\n case \"left\":\n anchorVals[1] = \"right\";\n offset[0] = -xInc;\n break;\n case \"right\":\n anchorVals[1] = \"left\";\n offset[0] = xInc;\n break;\n }\n var anchor;\n if (anchorVals[0] && anchorVals[1]) anchor = anchorVals.join(\"-\");\n else if (anchorVals[0]) anchor = anchorVals[0];\n else if (anchorVals[1]) anchor = anchorVals[1];\n else anchor = \"center\";\n return { anchor, offset };\n };\n }\n });\n\n // src/traces/scattermap/convert.js\n var require_convert14 = __commonJS({\n \"src/traces/scattermap/convert.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var BADNUM = require_numerical().BADNUM;\n var geoJsonUtils = require_geojson_utils();\n var Colorscale = require_colorscale();\n var Drawing = require_drawing();\n var makeBubbleSizeFn = require_make_bubble_size_func();\n var subTypes = require_subtypes();\n var isSupportedFont = require_constants28().isSupportedFont;\n var convertTextOpts = require_convert_text_opts2();\n var appendArrayPointValue = require_helpers2().appendArrayPointValue;\n var NEWLINES = require_svg_text_utils().NEWLINES;\n var BR_TAG_ALL = require_svg_text_utils().BR_TAG_ALL;\n module.exports = function convert(gd, calcTrace) {\n var trace = calcTrace[0].trace;\n var isVisible = trace.visible === true && trace._length !== 0;\n var hasFill = trace.fill !== \"none\";\n var hasLines = subTypes.hasLines(trace);\n var hasMarkers = subTypes.hasMarkers(trace);\n var hasText = subTypes.hasText(trace);\n var hasCircles = hasMarkers && trace.marker.symbol === \"circle\";\n var hasSymbols = hasMarkers && trace.marker.symbol !== \"circle\";\n var hasCluster = trace.cluster && trace.cluster.enabled;\n var fill = initContainer(\"fill\");\n var line = initContainer(\"line\");\n var circle = initContainer(\"circle\");\n var symbol = initContainer(\"symbol\");\n var opts = {\n fill,\n line,\n circle,\n symbol\n };\n if (!isVisible) return opts;\n var lineCoords;\n if (hasFill || hasLines) {\n lineCoords = geoJsonUtils.calcTraceToLineCoords(calcTrace);\n }\n if (hasFill) {\n fill.geojson = geoJsonUtils.makePolygon(lineCoords);\n fill.layout.visibility = \"visible\";\n Lib.extendFlat(fill.paint, {\n \"fill-color\": trace.fillcolor\n });\n }\n if (hasLines) {\n line.geojson = geoJsonUtils.makeLine(lineCoords);\n line.layout.visibility = \"visible\";\n Lib.extendFlat(line.paint, {\n \"line-width\": trace.line.width,\n \"line-color\": trace.line.color,\n \"line-opacity\": trace.opacity\n });\n }\n if (hasCircles) {\n var circleOpts = makeCircleOpts(calcTrace);\n circle.geojson = circleOpts.geojson;\n circle.layout.visibility = \"visible\";\n if (hasCluster) {\n circle.filter = [\"!\", [\"has\", \"point_count\"]];\n opts.cluster = {\n type: \"circle\",\n filter: [\"has\", \"point_count\"],\n layout: { visibility: \"visible\" },\n paint: {\n \"circle-color\": arrayifyAttribute(trace.cluster.color, trace.cluster.step),\n \"circle-radius\": arrayifyAttribute(trace.cluster.size, trace.cluster.step),\n \"circle-opacity\": arrayifyAttribute(trace.cluster.opacity, trace.cluster.step)\n }\n };\n opts.clusterCount = {\n type: \"symbol\",\n filter: [\"has\", \"point_count\"],\n paint: {},\n layout: {\n \"text-field\": \"{point_count_abbreviated}\",\n \"text-font\": getTextFont(trace),\n \"text-size\": 12\n }\n };\n }\n Lib.extendFlat(circle.paint, {\n \"circle-color\": circleOpts.mcc,\n \"circle-radius\": circleOpts.mrc,\n \"circle-opacity\": circleOpts.mo\n });\n }\n if (hasCircles && hasCluster) {\n circle.filter = [\"!\", [\"has\", \"point_count\"]];\n }\n if (hasSymbols || hasText) {\n symbol.geojson = makeSymbolGeoJSON(calcTrace, gd);\n Lib.extendFlat(symbol.layout, {\n visibility: \"visible\",\n \"icon-image\": \"{symbol}-15\",\n \"text-field\": \"{text}\"\n });\n if (hasSymbols) {\n Lib.extendFlat(symbol.layout, {\n \"icon-size\": trace.marker.size / 10\n });\n if (\"angle\" in trace.marker && trace.marker.angle !== \"auto\") {\n Lib.extendFlat(symbol.layout, {\n // unfortunately cant use {angle} do to this issue:\n // https://github.com/mapbox/mapbox-gl-js/issues/873\n \"icon-rotate\": {\n type: \"identity\",\n property: \"angle\"\n },\n \"icon-rotation-alignment\": \"map\"\n });\n }\n symbol.layout[\"icon-allow-overlap\"] = trace.marker.allowoverlap;\n Lib.extendFlat(symbol.paint, {\n \"icon-opacity\": trace.opacity * trace.marker.opacity,\n // TODO does not work ??\n \"icon-color\": trace.marker.color\n });\n }\n if (hasText) {\n var iconSize = (trace.marker || {}).size;\n var textOpts = convertTextOpts(trace.textposition, iconSize);\n Lib.extendFlat(symbol.layout, {\n \"text-size\": trace.textfont.size,\n \"text-anchor\": textOpts.anchor,\n \"text-offset\": textOpts.offset,\n \"text-font\": getTextFont(trace)\n });\n Lib.extendFlat(symbol.paint, {\n \"text-color\": trace.textfont.color,\n \"text-opacity\": trace.opacity\n });\n }\n }\n return opts;\n };\n function initContainer(type) {\n return {\n type,\n geojson: geoJsonUtils.makeBlank(),\n layout: { visibility: \"none\" },\n filter: null,\n paint: {}\n };\n }\n function makeCircleOpts(calcTrace) {\n var trace = calcTrace[0].trace;\n var marker = trace.marker;\n var selectedpoints = trace.selectedpoints;\n var arrayColor = Lib.isArrayOrTypedArray(marker.color);\n var arraySize = Lib.isArrayOrTypedArray(marker.size);\n var arrayOpacity = Lib.isArrayOrTypedArray(marker.opacity);\n var i;\n function addTraceOpacity(o) {\n return trace.opacity * o;\n }\n function size2radius(s) {\n return s / 2;\n }\n var colorFn;\n if (arrayColor) {\n if (Colorscale.hasColorscale(trace, \"marker\")) {\n colorFn = Colorscale.makeColorScaleFuncFromTrace(marker);\n } else {\n colorFn = Lib.identity;\n }\n }\n var sizeFn;\n if (arraySize) {\n sizeFn = makeBubbleSizeFn(trace);\n }\n var opacityFn;\n if (arrayOpacity) {\n opacityFn = function(mo) {\n var mo2 = isNumeric(mo) ? +Lib.constrain(mo, 0, 1) : 0;\n return addTraceOpacity(mo2);\n };\n }\n var features = [];\n for (i = 0; i < calcTrace.length; i++) {\n var calcPt = calcTrace[i];\n var lonlat = calcPt.lonlat;\n if (isBADNUM(lonlat)) continue;\n var props = {};\n if (colorFn) props.mcc = calcPt.mcc = colorFn(calcPt.mc);\n if (sizeFn) props.mrc = calcPt.mrc = sizeFn(calcPt.ms);\n if (opacityFn) props.mo = opacityFn(calcPt.mo);\n if (selectedpoints) props.selected = calcPt.selected || 0;\n features.push({\n type: \"Feature\",\n id: i + 1,\n geometry: { type: \"Point\", coordinates: lonlat },\n properties: props\n });\n }\n var fns;\n if (selectedpoints) {\n fns = Drawing.makeSelectedPointStyleFns(trace);\n for (i = 0; i < features.length; i++) {\n var d = features[i].properties;\n if (fns.selectedOpacityFn) {\n d.mo = addTraceOpacity(fns.selectedOpacityFn(d));\n }\n if (fns.selectedColorFn) {\n d.mcc = fns.selectedColorFn(d);\n }\n if (fns.selectedSizeFn) {\n d.mrc = fns.selectedSizeFn(d);\n }\n }\n }\n return {\n geojson: { type: \"FeatureCollection\", features },\n mcc: arrayColor || fns && fns.selectedColorFn ? { type: \"identity\", property: \"mcc\" } : marker.color,\n mrc: arraySize || fns && fns.selectedSizeFn ? { type: \"identity\", property: \"mrc\" } : size2radius(marker.size),\n mo: arrayOpacity || fns && fns.selectedOpacityFn ? { type: \"identity\", property: \"mo\" } : addTraceOpacity(marker.opacity)\n };\n }\n function makeSymbolGeoJSON(calcTrace, gd) {\n var fullLayout = gd._fullLayout;\n var trace = calcTrace[0].trace;\n var marker = trace.marker || {};\n var symbol = marker.symbol;\n var angle = marker.angle;\n var fillSymbol = symbol !== \"circle\" ? getFillFunc(symbol) : blankFillFunc;\n var fillAngle = angle !== \"auto\" ? getFillFunc(angle, true) : blankFillFunc;\n var fillText = subTypes.hasText(trace) ? getFillFunc(trace.text) : blankFillFunc;\n var features = [];\n for (var i = 0; i < calcTrace.length; i++) {\n var calcPt = calcTrace[i];\n if (isBADNUM(calcPt.lonlat)) continue;\n var texttemplate = trace.texttemplate;\n var text;\n if (texttemplate) {\n var tt = Array.isArray(texttemplate) ? texttemplate[i] || \"\" : texttemplate;\n var labels = trace._module.formatLabels(calcPt, trace, fullLayout);\n var pointValues = {};\n appendArrayPointValue(pointValues, trace, calcPt.i);\n var meta = trace._meta || {};\n text = Lib.texttemplateString(tt, labels, fullLayout._d3locale, pointValues, calcPt, meta);\n } else {\n text = fillText(i);\n }\n if (text) {\n text = text.replace(NEWLINES, \"\").replace(BR_TAG_ALL, \"\\n\");\n }\n features.push({\n type: \"Feature\",\n geometry: {\n type: \"Point\",\n coordinates: calcPt.lonlat\n },\n properties: {\n symbol: fillSymbol(i),\n angle: fillAngle(i),\n text\n }\n });\n }\n return {\n type: \"FeatureCollection\",\n features\n };\n }\n function getFillFunc(attr, numeric) {\n if (Lib.isArrayOrTypedArray(attr)) {\n if (numeric) {\n return function(i) {\n return isNumeric(attr[i]) ? +attr[i] : 0;\n };\n }\n return function(i) {\n return attr[i];\n };\n } else if (attr) {\n return function() {\n return attr;\n };\n } else {\n return blankFillFunc;\n }\n }\n function blankFillFunc() {\n return \"\";\n }\n function isBADNUM(lonlat) {\n return lonlat[0] === BADNUM;\n }\n function arrayifyAttribute(values, step) {\n var newAttribute;\n if (Lib.isArrayOrTypedArray(values) && Lib.isArrayOrTypedArray(step)) {\n newAttribute = [\"step\", [\"get\", \"point_count\"], values[0]];\n for (var idx = 1; idx < values.length; idx++) {\n newAttribute.push(step[idx - 1], values[idx]);\n }\n } else {\n newAttribute = values;\n }\n return newAttribute;\n }\n function getTextFont(trace) {\n var font = trace.textfont;\n var family = font.family;\n var style = font.style;\n var weight = font.weight;\n var parts = family.split(\" \");\n var isItalic = parts[parts.length - 1] === \"Italic\";\n if (isItalic) parts.pop();\n isItalic = isItalic || style === \"italic\";\n var str = parts.join(\" \");\n if (weight === \"bold\" && parts.indexOf(\"Bold\") === -1) {\n str += \" Bold\";\n } else if (weight <= 1e3) {\n if (parts[0] === \"Metropolis\") {\n str = \"Metropolis\";\n if (weight > 850) str += \" Black\";\n else if (weight > 750) str += \" Extra Bold\";\n else if (weight > 650) str += \" Bold\";\n else if (weight > 550) str += \" Semi Bold\";\n else if (weight > 450) str += \" Medium\";\n else if (weight > 350) str += \" Regular\";\n else if (weight > 250) str += \" Light\";\n else if (weight > 150) str += \" Extra Light\";\n else str += \" Thin\";\n } else if (parts.slice(0, 2).join(\" \") === \"Open Sans\") {\n str = \"Open Sans\";\n if (weight > 750) str += \" Extrabold\";\n else if (weight > 650) str += \" Bold\";\n else if (weight > 550) str += \" Semibold\";\n else if (weight > 350) str += \" Regular\";\n else str += \" Light\";\n } else if (parts.slice(0, 3).join(\" \") === \"Klokantech Noto Sans\") {\n str = \"Klokantech Noto Sans\";\n if (parts[3] === \"CJK\") str += \" CJK\";\n str += weight > 500 ? \" Bold\" : \" Regular\";\n }\n }\n if (isItalic) str += \" Italic\";\n if (str === \"Open Sans Regular Italic\") str = \"Open Sans Italic\";\n else if (str === \"Open Sans Regular Bold\") str = \"Open Sans Bold\";\n else if (str === \"Open Sans Regular Bold Italic\") str = \"Open Sans Bold Italic\";\n else if (str === \"Klokantech Noto Sans Regular Italic\") str = \"Klokantech Noto Sans Italic\";\n if (!isSupportedFont(str)) {\n str = family;\n }\n var textFont = str.split(\", \");\n return textFont;\n }\n }\n });\n\n // src/traces/scattermap/plot.js\n var require_plot26 = __commonJS({\n \"src/traces/scattermap/plot.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var convert = require_convert14();\n var LAYER_PREFIX = require_constants27().traceLayerPrefix;\n var ORDER = {\n cluster: [\"cluster\", \"clusterCount\", \"circle\"],\n nonCluster: [\"fill\", \"line\", \"circle\", \"symbol\"]\n };\n function ScatterMap(subplot, uid, clusterEnabled, isHidden) {\n this.type = \"scattermap\";\n this.subplot = subplot;\n this.uid = uid;\n this.clusterEnabled = clusterEnabled;\n this.isHidden = isHidden;\n this.sourceIds = {\n fill: \"source-\" + uid + \"-fill\",\n line: \"source-\" + uid + \"-line\",\n circle: \"source-\" + uid + \"-circle\",\n symbol: \"source-\" + uid + \"-symbol\",\n cluster: \"source-\" + uid + \"-circle\",\n clusterCount: \"source-\" + uid + \"-circle\"\n };\n this.layerIds = {\n fill: LAYER_PREFIX + uid + \"-fill\",\n line: LAYER_PREFIX + uid + \"-line\",\n circle: LAYER_PREFIX + uid + \"-circle\",\n symbol: LAYER_PREFIX + uid + \"-symbol\",\n cluster: LAYER_PREFIX + uid + \"-cluster\",\n clusterCount: LAYER_PREFIX + uid + \"-cluster-count\"\n };\n this.below = null;\n }\n var proto = ScatterMap.prototype;\n proto.addSource = function(k, opts, cluster) {\n var sourceOpts = {\n type: \"geojson\",\n data: opts.geojson\n };\n if (cluster && cluster.enabled) {\n Lib.extendFlat(sourceOpts, {\n cluster: true,\n clusterMaxZoom: cluster.maxzoom\n });\n }\n var isSourceExists = this.subplot.map.getSource(this.sourceIds[k]);\n if (isSourceExists) {\n isSourceExists.setData(opts.geojson);\n } else {\n this.subplot.map.addSource(this.sourceIds[k], sourceOpts);\n }\n };\n proto.setSourceData = function(k, opts) {\n this.subplot.map.getSource(this.sourceIds[k]).setData(opts.geojson);\n };\n proto.addLayer = function(k, opts, below) {\n var source = {\n type: opts.type,\n id: this.layerIds[k],\n source: this.sourceIds[k],\n layout: opts.layout,\n paint: opts.paint\n };\n if (opts.filter) {\n source.filter = opts.filter;\n }\n var currentLayerId = this.layerIds[k];\n var layerExist;\n var layers = this.subplot.getMapLayers();\n for (var i = 0; i < layers.length; i++) {\n if (layers[i].id === currentLayerId) {\n layerExist = true;\n break;\n }\n }\n if (layerExist) {\n this.subplot.setOptions(currentLayerId, \"setLayoutProperty\", source.layout);\n if (source.layout.visibility === \"visible\") {\n this.subplot.setOptions(currentLayerId, \"setPaintProperty\", source.paint);\n }\n } else {\n this.subplot.addLayer(source, below);\n }\n };\n proto.update = function update(calcTrace) {\n var trace = calcTrace[0].trace;\n var subplot = this.subplot;\n var map = subplot.map;\n var optsAll = convert(subplot.gd, calcTrace);\n var below = subplot.belowLookup[\"trace-\" + this.uid];\n var hasCluster = !!(trace.cluster && trace.cluster.enabled);\n var hadCluster = !!this.clusterEnabled;\n var lThis = this;\n function addCluster(noSource) {\n if (!noSource) lThis.addSource(\"circle\", optsAll.circle, trace.cluster);\n var order = ORDER.cluster;\n for (var i = 0; i < order.length; i++) {\n var k = order[i];\n var opts = optsAll[k];\n lThis.addLayer(k, opts, below);\n }\n }\n function removeCluster(noSource) {\n var order = ORDER.cluster;\n for (var i = order.length - 1; i >= 0; i--) {\n var k = order[i];\n map.removeLayer(lThis.layerIds[k]);\n }\n if (!noSource) map.removeSource(lThis.sourceIds.circle);\n }\n function addNonCluster(noSource) {\n var order = ORDER.nonCluster;\n for (var i = 0; i < order.length; i++) {\n var k = order[i];\n var opts = optsAll[k];\n if (!noSource) lThis.addSource(k, opts);\n lThis.addLayer(k, opts, below);\n }\n }\n function removeNonCluster(noSource) {\n var order = ORDER.nonCluster;\n for (var i = order.length - 1; i >= 0; i--) {\n var k = order[i];\n map.removeLayer(lThis.layerIds[k]);\n if (!noSource) map.removeSource(lThis.sourceIds[k]);\n }\n }\n function remove(noSource) {\n if (hadCluster) removeCluster(noSource);\n else removeNonCluster(noSource);\n }\n function add(noSource) {\n if (hasCluster) addCluster(noSource);\n else addNonCluster(noSource);\n }\n function repaint() {\n var order = hasCluster ? ORDER.cluster : ORDER.nonCluster;\n for (var i = 0; i < order.length; i++) {\n var k = order[i];\n var opts = optsAll[k];\n if (!opts) continue;\n subplot.setOptions(lThis.layerIds[k], \"setLayoutProperty\", opts.layout);\n if (opts.layout.visibility === \"visible\") {\n if (k !== \"cluster\") {\n lThis.setSourceData(k, opts);\n }\n subplot.setOptions(lThis.layerIds[k], \"setPaintProperty\", opts.paint);\n }\n }\n }\n var wasHidden = this.isHidden;\n var isHidden = trace.visible !== true;\n if (isHidden) {\n if (!wasHidden) remove();\n } else if (wasHidden) {\n if (!isHidden) add();\n } else if (hadCluster !== hasCluster) {\n remove();\n add();\n } else if (this.below !== below) {\n remove(true);\n add(true);\n repaint();\n } else {\n repaint();\n }\n this.clusterEnabled = hasCluster;\n this.isHidden = isHidden;\n this.below = below;\n calcTrace[0].trace._glTrace = this;\n };\n proto.dispose = function dispose() {\n var map = this.subplot.map;\n var order = this.clusterEnabled ? ORDER.cluster : ORDER.nonCluster;\n for (var i = order.length - 1; i >= 0; i--) {\n var k = order[i];\n map.removeLayer(this.layerIds[k]);\n map.removeSource(this.sourceIds[k]);\n }\n };\n module.exports = function createScatterMap(subplot, calcTrace) {\n var trace = calcTrace[0].trace;\n var hasCluster = trace.cluster && trace.cluster.enabled;\n var isHidden = trace.visible !== true;\n var scatterMap = new ScatterMap(\n subplot,\n trace.uid,\n hasCluster,\n isHidden\n );\n var optsAll = convert(subplot.gd, calcTrace);\n var below = scatterMap.below = subplot.belowLookup[\"trace-\" + trace.uid];\n var i, k, opts;\n if (hasCluster) {\n scatterMap.addSource(\"circle\", optsAll.circle, trace.cluster);\n for (i = 0; i < ORDER.cluster.length; i++) {\n k = ORDER.cluster[i];\n opts = optsAll[k];\n scatterMap.addLayer(k, opts, below);\n }\n } else {\n for (i = 0; i < ORDER.nonCluster.length; i++) {\n k = ORDER.nonCluster[i];\n opts = optsAll[k];\n scatterMap.addSource(k, opts, trace.cluster);\n scatterMap.addLayer(k, opts, below);\n }\n }\n calcTrace[0].trace._glTrace = scatterMap;\n return scatterMap;\n };\n }\n });\n\n // src/traces/scattermap/hover.js\n var require_hover20 = __commonJS({\n \"src/traces/scattermap/hover.js\"(exports, module) {\n \"use strict\";\n var Fx = require_fx();\n var Lib = require_lib();\n var getTraceColor = require_get_trace_color();\n var fillText = Lib.fillText;\n var BADNUM = require_numerical().BADNUM;\n var LAYER_PREFIX = require_constants27().traceLayerPrefix;\n function hoverPoints(pointData, xval, yval) {\n var cd = pointData.cd;\n var trace = cd[0].trace;\n var xa = pointData.xa;\n var ya = pointData.ya;\n var subplot = pointData.subplot;\n var clusteredPointsIds = [];\n var layer = LAYER_PREFIX + trace.uid + \"-circle\";\n var hasCluster = trace.cluster && trace.cluster.enabled;\n if (hasCluster) {\n var elems = subplot.map.queryRenderedFeatures(null, { layers: [layer] });\n clusteredPointsIds = elems.map(function(elem) {\n return elem.id;\n });\n }\n var winding = xval >= 0 ? Math.floor((xval + 180) / 360) : Math.ceil((xval - 180) / 360);\n var lonShift = winding * 360;\n var xval2 = xval - lonShift;\n function distFn(d) {\n var lonlat2 = d.lonlat;\n if (lonlat2[0] === BADNUM) return Infinity;\n if (hasCluster && clusteredPointsIds.indexOf(d.i + 1) === -1) return Infinity;\n var lon = Lib.modHalf(lonlat2[0], 360);\n var lat = lonlat2[1];\n var pt = subplot.project([lon, lat]);\n var dx = pt.x - xa.c2p([xval2, lat]);\n var dy = pt.y - ya.c2p([lon, yval]);\n var rad2 = Math.max(3, d.mrc || 0);\n return Math.max(Math.sqrt(dx * dx + dy * dy) - rad2, 1 - 3 / rad2);\n }\n Fx.getClosest(cd, distFn, pointData);\n if (pointData.index === false) return;\n var di = cd[pointData.index];\n var lonlat = di.lonlat;\n var lonlatShifted = [Lib.modHalf(lonlat[0], 360) + lonShift, lonlat[1]];\n var xc = xa.c2p(lonlatShifted);\n var yc = ya.c2p(lonlatShifted);\n var rad = di.mrc || 1;\n pointData.x0 = xc - rad;\n pointData.x1 = xc + rad;\n pointData.y0 = yc - rad;\n pointData.y1 = yc + rad;\n var fullLayout = {};\n fullLayout[trace.subplot] = { _subplot: subplot };\n var labels = trace._module.formatLabels(di, trace, fullLayout);\n pointData.lonLabel = labels.lonLabel;\n pointData.latLabel = labels.latLabel;\n pointData.color = getTraceColor(trace, di);\n pointData.extraText = getExtraText(trace, di, cd[0].t.labels);\n pointData.hovertemplate = trace.hovertemplate;\n return [pointData];\n }\n function getExtraText(trace, di, labels) {\n if (trace.hovertemplate) return;\n var hoverinfo = di.hi || trace.hoverinfo;\n var parts = hoverinfo.split(\"+\");\n var isAll = parts.indexOf(\"all\") !== -1;\n var hasLon = parts.indexOf(\"lon\") !== -1;\n var hasLat = parts.indexOf(\"lat\") !== -1;\n var lonlat = di.lonlat;\n var text = [];\n function format(v) {\n return v + \"\\xB0\";\n }\n if (isAll || hasLon && hasLat) {\n text.push(\"(\" + format(lonlat[1]) + \", \" + format(lonlat[0]) + \")\");\n } else if (hasLon) {\n text.push(labels.lon + format(lonlat[0]));\n } else if (hasLat) {\n text.push(labels.lat + format(lonlat[1]));\n }\n if (isAll || parts.indexOf(\"text\") !== -1) {\n fillText(di, trace, text);\n }\n return text.join(\"
    \");\n }\n module.exports = {\n hoverPoints,\n getExtraText\n };\n }\n });\n\n // src/traces/scattermap/event_data.js\n var require_event_data13 = __commonJS({\n \"src/traces/scattermap/event_data.js\"(exports, module) {\n \"use strict\";\n module.exports = function eventData(out, pt) {\n out.lon = pt.lon;\n out.lat = pt.lat;\n return out;\n };\n }\n });\n\n // src/traces/scattermap/select.js\n var require_select10 = __commonJS({\n \"src/traces/scattermap/select.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var subtypes = require_subtypes();\n var BADNUM = require_numerical().BADNUM;\n module.exports = function selectPoints(searchInfo, selectionTester) {\n var cd = searchInfo.cd;\n var xa = searchInfo.xaxis;\n var ya = searchInfo.yaxis;\n var selection = [];\n var trace = cd[0].trace;\n var i;\n if (!subtypes.hasMarkers(trace)) return [];\n if (selectionTester === false) {\n for (i = 0; i < cd.length; i++) {\n cd[i].selected = 0;\n }\n } else {\n for (i = 0; i < cd.length; i++) {\n var di = cd[i];\n var lonlat = di.lonlat;\n if (lonlat[0] !== BADNUM) {\n var lonlat2 = [Lib.modHalf(lonlat[0], 360), lonlat[1]];\n var xy = [xa.c2p(lonlat2), ya.c2p(lonlat2)];\n if (selectionTester.contains(xy, null, i, searchInfo)) {\n selection.push({\n pointNumber: i,\n lon: lonlat[0],\n lat: lonlat[1]\n });\n di.selected = 1;\n } else {\n di.selected = 0;\n }\n }\n }\n }\n return selection;\n };\n }\n });\n\n // node_modules/maplibre-gl/dist/maplibre-gl.js\n var require_maplibre_gl = __commonJS({\n \"node_modules/maplibre-gl/dist/maplibre-gl.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? module.exports = factory() : typeof define === \"function\" && false ? define(factory) : (global2 = typeof globalThis !== \"undefined\" ? globalThis : global2 || self, global2.maplibregl = factory());\n })(exports, function() {\n \"use strict\";\n var maplibregl = {};\n var modules = {};\n function define2(moduleName, _dependencies, moduleFactory) {\n modules[moduleName] = moduleFactory;\n if (moduleName !== \"index\") {\n return;\n }\n var workerBundleString = \"var sharedModule = {}; (\" + modules.shared + \")(sharedModule); (\" + modules.worker + \")(sharedModule);\";\n var sharedModule = {};\n modules.shared(sharedModule);\n modules.index(maplibregl, sharedModule);\n if (typeof window !== \"undefined\") {\n maplibregl.setWorkerUrl(window.URL.createObjectURL(new Blob([workerBundleString], { type: \"text/javascript\" })));\n }\n return maplibregl;\n }\n ;\n define2(\"shared\", [\"exports\"], function(t) {\n \"use strict\";\n function e(t4, e2, r2, n2) {\n return new (r2 || (r2 = Promise))(function(i2, s2) {\n function a2(t5) {\n try {\n l2(n2.next(t5));\n } catch (t6) {\n s2(t6);\n }\n }\n function o2(t5) {\n try {\n l2(n2.throw(t5));\n } catch (t6) {\n s2(t6);\n }\n }\n function l2(t5) {\n var e3;\n t5.done ? i2(t5.value) : (e3 = t5.value, e3 instanceof r2 ? e3 : new r2(function(t6) {\n t6(e3);\n })).then(a2, o2);\n }\n l2((n2 = n2.apply(t4, e2 || [])).next());\n });\n }\n function r(t4) {\n return t4 && t4.__esModule && Object.prototype.hasOwnProperty.call(t4, \"default\") ? t4.default : t4;\n }\n \"function\" == typeof SuppressedError && SuppressedError;\n var n = i;\n function i(t4, e2) {\n this.x = t4, this.y = e2;\n }\n i.prototype = { clone: function() {\n return new i(this.x, this.y);\n }, add: function(t4) {\n return this.clone()._add(t4);\n }, sub: function(t4) {\n return this.clone()._sub(t4);\n }, multByPoint: function(t4) {\n return this.clone()._multByPoint(t4);\n }, divByPoint: function(t4) {\n return this.clone()._divByPoint(t4);\n }, mult: function(t4) {\n return this.clone()._mult(t4);\n }, div: function(t4) {\n return this.clone()._div(t4);\n }, rotate: function(t4) {\n return this.clone()._rotate(t4);\n }, rotateAround: function(t4, e2) {\n return this.clone()._rotateAround(t4, e2);\n }, matMult: function(t4) {\n return this.clone()._matMult(t4);\n }, unit: function() {\n return this.clone()._unit();\n }, perp: function() {\n return this.clone()._perp();\n }, round: function() {\n return this.clone()._round();\n }, mag: function() {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n }, equals: function(t4) {\n return this.x === t4.x && this.y === t4.y;\n }, dist: function(t4) {\n return Math.sqrt(this.distSqr(t4));\n }, distSqr: function(t4) {\n var e2 = t4.x - this.x, r2 = t4.y - this.y;\n return e2 * e2 + r2 * r2;\n }, angle: function() {\n return Math.atan2(this.y, this.x);\n }, angleTo: function(t4) {\n return Math.atan2(this.y - t4.y, this.x - t4.x);\n }, angleWith: function(t4) {\n return this.angleWithSep(t4.x, t4.y);\n }, angleWithSep: function(t4, e2) {\n return Math.atan2(this.x * e2 - this.y * t4, this.x * t4 + this.y * e2);\n }, _matMult: function(t4) {\n var e2 = t4[2] * this.x + t4[3] * this.y;\n return this.x = t4[0] * this.x + t4[1] * this.y, this.y = e2, this;\n }, _add: function(t4) {\n return this.x += t4.x, this.y += t4.y, this;\n }, _sub: function(t4) {\n return this.x -= t4.x, this.y -= t4.y, this;\n }, _mult: function(t4) {\n return this.x *= t4, this.y *= t4, this;\n }, _div: function(t4) {\n return this.x /= t4, this.y /= t4, this;\n }, _multByPoint: function(t4) {\n return this.x *= t4.x, this.y *= t4.y, this;\n }, _divByPoint: function(t4) {\n return this.x /= t4.x, this.y /= t4.y, this;\n }, _unit: function() {\n return this._div(this.mag()), this;\n }, _perp: function() {\n var t4 = this.y;\n return this.y = this.x, this.x = -t4, this;\n }, _rotate: function(t4) {\n var e2 = Math.cos(t4), r2 = Math.sin(t4), n2 = r2 * this.x + e2 * this.y;\n return this.x = e2 * this.x - r2 * this.y, this.y = n2, this;\n }, _rotateAround: function(t4, e2) {\n var r2 = Math.cos(t4), n2 = Math.sin(t4), i2 = e2.y + n2 * (this.x - e2.x) + r2 * (this.y - e2.y);\n return this.x = e2.x + r2 * (this.x - e2.x) - n2 * (this.y - e2.y), this.y = i2, this;\n }, _round: function() {\n return this.x = Math.round(this.x), this.y = Math.round(this.y), this;\n } }, i.convert = function(t4) {\n return t4 instanceof i ? t4 : Array.isArray(t4) ? new i(t4[0], t4[1]) : t4;\n };\n var s = r(n), a = o;\n function o(t4, e2, r2, n2) {\n this.cx = 3 * t4, this.bx = 3 * (r2 - t4) - this.cx, this.ax = 1 - this.cx - this.bx, this.cy = 3 * e2, this.by = 3 * (n2 - e2) - this.cy, this.ay = 1 - this.cy - this.by, this.p1x = t4, this.p1y = e2, this.p2x = r2, this.p2y = n2;\n }\n o.prototype = { sampleCurveX: function(t4) {\n return ((this.ax * t4 + this.bx) * t4 + this.cx) * t4;\n }, sampleCurveY: function(t4) {\n return ((this.ay * t4 + this.by) * t4 + this.cy) * t4;\n }, sampleCurveDerivativeX: function(t4) {\n return (3 * this.ax * t4 + 2 * this.bx) * t4 + this.cx;\n }, solveCurveX: function(t4, e2) {\n if (void 0 === e2 && (e2 = 1e-6), t4 < 0) return 0;\n if (t4 > 1) return 1;\n for (var r2 = t4, n2 = 0; n2 < 8; n2++) {\n var i2 = this.sampleCurveX(r2) - t4;\n if (Math.abs(i2) < e2) return r2;\n var s2 = this.sampleCurveDerivativeX(r2);\n if (Math.abs(s2) < 1e-6) break;\n r2 -= i2 / s2;\n }\n var a2 = 0, o2 = 1;\n for (r2 = t4, n2 = 0; n2 < 20 && (i2 = this.sampleCurveX(r2), !(Math.abs(i2 - t4) < e2)); n2++) t4 > i2 ? a2 = r2 : o2 = r2, r2 = 0.5 * (o2 - a2) + a2;\n return r2;\n }, solve: function(t4, e2) {\n return this.sampleCurveY(this.solveCurveX(t4, e2));\n } };\n var l = r(a);\n let u, c;\n function h() {\n return null == u && (u = \"undefined\" != typeof OffscreenCanvas && new OffscreenCanvas(1, 1).getContext(\"2d\") && \"function\" == typeof createImageBitmap), u;\n }\n function p() {\n if (null == c && (c = false, h())) {\n const t4 = 5, e2 = new OffscreenCanvas(t4, t4).getContext(\"2d\", { willReadFrequently: true });\n if (e2) {\n for (let r3 = 0; r3 < t4 * t4; r3++) {\n const n2 = 4 * r3;\n e2.fillStyle = `rgb(${n2},${n2 + 1},${n2 + 2})`, e2.fillRect(r3 % t4, Math.floor(r3 / t4), 1, 1);\n }\n const r2 = e2.getImageData(0, 0, t4, t4).data;\n for (let e3 = 0; e3 < t4 * t4 * 4; e3++) if (e3 % 4 != 3 && r2[e3] !== e3) {\n c = true;\n break;\n }\n }\n }\n return c || false;\n }\n function f(t4, e2, r2, n2) {\n const i2 = new l(t4, e2, r2, n2);\n return (t5) => i2.solve(t5);\n }\n const d = f(0.25, 0.1, 0.25, 1);\n function y(t4, e2, r2) {\n return Math.min(r2, Math.max(e2, t4));\n }\n function m(t4, e2, r2) {\n const n2 = r2 - e2, i2 = ((t4 - e2) % n2 + n2) % n2 + e2;\n return i2 === e2 ? r2 : i2;\n }\n function g(t4, ...e2) {\n for (const r2 of e2) for (const e3 in r2) t4[e3] = r2[e3];\n return t4;\n }\n let x = 1;\n function v(t4, e2, r2) {\n const n2 = {};\n for (const r3 in t4) n2[r3] = e2.call(this, t4[r3], r3, t4);\n return n2;\n }\n function b(t4, e2, r2) {\n const n2 = {};\n for (const r3 in t4) e2.call(this, t4[r3], r3, t4) && (n2[r3] = t4[r3]);\n return n2;\n }\n function w(t4) {\n return Array.isArray(t4) ? t4.map(w) : \"object\" == typeof t4 && t4 ? v(t4, w) : t4;\n }\n const _ = {};\n function A2(t4) {\n _[t4] || (\"undefined\" != typeof console && console.warn(t4), _[t4] = true);\n }\n function S(t4, e2, r2) {\n return (r2.y - t4.y) * (e2.x - t4.x) > (e2.y - t4.y) * (r2.x - t4.x);\n }\n function k(t4) {\n return \"undefined\" != typeof WorkerGlobalScope && void 0 !== t4 && t4 instanceof WorkerGlobalScope;\n }\n let M = null;\n function I(t4) {\n return \"undefined\" != typeof ImageBitmap && t4 instanceof ImageBitmap;\n }\n const z = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=\";\n function P(t4, r2, n2, i2, s2) {\n return e(this, void 0, void 0, function* () {\n if (\"undefined\" == typeof VideoFrame) throw new Error(\"VideoFrame not supported\");\n const e2 = new VideoFrame(t4, { timestamp: 0 });\n try {\n const a2 = null == e2 ? void 0 : e2.format;\n if (!a2 || !a2.startsWith(\"BGR\") && !a2.startsWith(\"RGB\")) throw new Error(`Unrecognized format ${a2}`);\n const o2 = a2.startsWith(\"BGR\"), l2 = new Uint8ClampedArray(i2 * s2 * 4);\n if (yield e2.copyTo(l2, function(t5, e3, r3, n3, i3) {\n const s3 = 4 * Math.max(-e3, 0), a3 = (Math.max(0, r3) - r3) * n3 * 4 + s3, o3 = 4 * n3, l3 = Math.max(0, e3), u2 = Math.max(0, r3);\n return { rect: { x: l3, y: u2, width: Math.min(t5.width, e3 + n3) - l3, height: Math.min(t5.height, r3 + i3) - u2 }, layout: [{ offset: a3, stride: o3 }] };\n }(t4, r2, n2, i2, s2)), o2) for (let t5 = 0; t5 < l2.length; t5 += 4) {\n const e3 = l2[t5];\n l2[t5] = l2[t5 + 2], l2[t5 + 2] = e3;\n }\n return l2;\n } finally {\n e2.close();\n }\n });\n }\n let C2, B2;\n const V = \"AbortError\";\n function E2() {\n return new Error(V);\n }\n const F = { MAX_PARALLEL_IMAGE_REQUESTS: 16, MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME: 8, MAX_TILE_CACHE_ZOOM_LEVELS: 5, REGISTERED_PROTOCOLS: {}, WORKER_URL: \"\" };\n function T(t4) {\n return F.REGISTERED_PROTOCOLS[t4.substring(0, t4.indexOf(\"://\"))];\n }\n const $ = \"global-dispatcher\";\n class L extends Error {\n constructor(t4, e2, r2, n2) {\n super(`AJAXError: ${e2} (${t4}): ${r2}`), this.status = t4, this.statusText = e2, this.url = r2, this.body = n2;\n }\n }\n const D2 = () => k(self) ? self.worker && self.worker.referrer : (\"blob:\" === window.location.protocol ? window.parent : window).location.href, O = function(t4, r2) {\n if (/:\\/\\//.test(t4.url) && !/^https?:|^file:/.test(t4.url)) {\n const e2 = T(t4.url);\n if (e2) return e2(t4, r2);\n if (k(self) && self.worker && self.worker.actor) return self.worker.actor.sendAsync({ type: \"GR\", data: t4, targetMapId: $ }, r2);\n }\n if (!(/^file:/.test(n2 = t4.url) || /^file:/.test(D2()) && !/^\\w+:/.test(n2))) {\n if (fetch && Request && AbortController && Object.prototype.hasOwnProperty.call(Request.prototype, \"signal\")) return function(t5, r3) {\n return e(this, void 0, void 0, function* () {\n const e2 = new Request(t5.url, { method: t5.method || \"GET\", body: t5.body, credentials: t5.credentials, headers: t5.headers, cache: t5.cache, referrer: D2(), signal: r3.signal });\n \"json\" !== t5.type || e2.headers.has(\"Accept\") || e2.headers.set(\"Accept\", \"application/json\");\n const n3 = yield fetch(e2);\n if (!n3.ok) {\n const e3 = yield n3.blob();\n throw new L(n3.status, n3.statusText, t5.url, e3);\n }\n let i2;\n i2 = \"arrayBuffer\" === t5.type || \"image\" === t5.type ? n3.arrayBuffer() : \"json\" === t5.type ? n3.json() : n3.text();\n const s2 = yield i2;\n if (r3.signal.aborted) throw E2();\n return { data: s2, cacheControl: n3.headers.get(\"Cache-Control\"), expires: n3.headers.get(\"Expires\") };\n });\n }(t4, r2);\n if (k(self) && self.worker && self.worker.actor) return self.worker.actor.sendAsync({ type: \"GR\", data: t4, mustQueue: true, targetMapId: $ }, r2);\n }\n var n2;\n return function(t5, e2) {\n return new Promise((r3, n3) => {\n var i2;\n const s2 = new XMLHttpRequest();\n s2.open(t5.method || \"GET\", t5.url, true), \"arrayBuffer\" !== t5.type && \"image\" !== t5.type || (s2.responseType = \"arraybuffer\");\n for (const e3 in t5.headers) s2.setRequestHeader(e3, t5.headers[e3]);\n \"json\" === t5.type && (s2.responseType = \"text\", (null === (i2 = t5.headers) || void 0 === i2 ? void 0 : i2.Accept) || s2.setRequestHeader(\"Accept\", \"application/json\")), s2.withCredentials = \"include\" === t5.credentials, s2.onerror = () => {\n n3(new Error(s2.statusText));\n }, s2.onload = () => {\n if (!e2.signal.aborted) if ((s2.status >= 200 && s2.status < 300 || 0 === s2.status) && null !== s2.response) {\n let e3 = s2.response;\n if (\"json\" === t5.type) try {\n e3 = JSON.parse(s2.response);\n } catch (t6) {\n return void n3(t6);\n }\n r3({ data: e3, cacheControl: s2.getResponseHeader(\"Cache-Control\"), expires: s2.getResponseHeader(\"Expires\") });\n } else {\n const e3 = new Blob([s2.response], { type: s2.getResponseHeader(\"Content-Type\") });\n n3(new L(s2.status, s2.statusText, t5.url, e3));\n }\n }, e2.signal.addEventListener(\"abort\", () => {\n s2.abort(), n3(E2());\n }), s2.send(t5.body);\n });\n }(t4, r2);\n };\n function j(t4) {\n if (!t4 || t4.indexOf(\"://\") <= 0 || 0 === t4.indexOf(\"data:image/\") || 0 === t4.indexOf(\"blob:\")) return true;\n const e2 = new URL(t4), r2 = window.location;\n return e2.protocol === r2.protocol && e2.host === r2.host;\n }\n function R(t4, e2, r2) {\n r2[t4] && -1 !== r2[t4].indexOf(e2) || (r2[t4] = r2[t4] || [], r2[t4].push(e2));\n }\n function U(t4, e2, r2) {\n if (r2 && r2[t4]) {\n const n2 = r2[t4].indexOf(e2);\n -1 !== n2 && r2[t4].splice(n2, 1);\n }\n }\n class q {\n constructor(t4, e2 = {}) {\n g(this, e2), this.type = t4;\n }\n }\n class N extends q {\n constructor(t4, e2 = {}) {\n super(\"error\", g({ error: t4 }, e2));\n }\n }\n class Z {\n on(t4, e2) {\n return this._listeners = this._listeners || {}, R(t4, e2, this._listeners), this;\n }\n off(t4, e2) {\n return U(t4, e2, this._listeners), U(t4, e2, this._oneTimeListeners), this;\n }\n once(t4, e2) {\n return e2 ? (this._oneTimeListeners = this._oneTimeListeners || {}, R(t4, e2, this._oneTimeListeners), this) : new Promise((e3) => this.once(t4, e3));\n }\n fire(t4, e2) {\n \"string\" == typeof t4 && (t4 = new q(t4, e2 || {}));\n const r2 = t4.type;\n if (this.listens(r2)) {\n t4.target = this;\n const e3 = this._listeners && this._listeners[r2] ? this._listeners[r2].slice() : [];\n for (const r3 of e3) r3.call(this, t4);\n const n2 = this._oneTimeListeners && this._oneTimeListeners[r2] ? this._oneTimeListeners[r2].slice() : [];\n for (const e4 of n2) U(r2, e4, this._oneTimeListeners), e4.call(this, t4);\n const i2 = this._eventedParent;\n i2 && (g(t4, \"function\" == typeof this._eventedParentData ? this._eventedParentData() : this._eventedParentData), i2.fire(t4));\n } else t4 instanceof N && console.error(t4.error);\n return this;\n }\n listens(t4) {\n return this._listeners && this._listeners[t4] && this._listeners[t4].length > 0 || this._oneTimeListeners && this._oneTimeListeners[t4] && this._oneTimeListeners[t4].length > 0 || this._eventedParent && this._eventedParent.listens(t4);\n }\n setEventedParent(t4, e2) {\n return this._eventedParent = t4, this._eventedParentData = e2, this;\n }\n }\n var G = { $version: 8, $root: { version: { required: true, type: \"enum\", values: [8] }, name: { type: \"string\" }, metadata: { type: \"*\" }, center: { type: \"array\", value: \"number\" }, zoom: { type: \"number\" }, bearing: { type: \"number\", default: 0, period: 360, units: \"degrees\" }, pitch: { type: \"number\", default: 0, units: \"degrees\" }, light: { type: \"light\" }, sky: { type: \"sky\" }, projection: { type: \"projection\" }, terrain: { type: \"terrain\" }, sources: { required: true, type: \"sources\" }, sprite: { type: \"sprite\" }, glyphs: { type: \"string\" }, transition: { type: \"transition\" }, layers: { required: true, type: \"array\", value: \"layer\" } }, sources: { \"*\": { type: \"source\" } }, source: [\"source_vector\", \"source_raster\", \"source_raster_dem\", \"source_geojson\", \"source_video\", \"source_image\"], source_vector: { type: { required: true, type: \"enum\", values: { vector: {} } }, url: { type: \"string\" }, tiles: { type: \"array\", value: \"string\" }, bounds: { type: \"array\", value: \"number\", length: 4, default: [-180, -85.051129, 180, 85.051129] }, scheme: { type: \"enum\", values: { xyz: {}, tms: {} }, default: \"xyz\" }, minzoom: { type: \"number\", default: 0 }, maxzoom: { type: \"number\", default: 22 }, attribution: { type: \"string\" }, promoteId: { type: \"promoteId\" }, volatile: { type: \"boolean\", default: false }, \"*\": { type: \"*\" } }, source_raster: { type: { required: true, type: \"enum\", values: { raster: {} } }, url: { type: \"string\" }, tiles: { type: \"array\", value: \"string\" }, bounds: { type: \"array\", value: \"number\", length: 4, default: [-180, -85.051129, 180, 85.051129] }, minzoom: { type: \"number\", default: 0 }, maxzoom: { type: \"number\", default: 22 }, tileSize: { type: \"number\", default: 512, units: \"pixels\" }, scheme: { type: \"enum\", values: { xyz: {}, tms: {} }, default: \"xyz\" }, attribution: { type: \"string\" }, volatile: { type: \"boolean\", default: false }, \"*\": { type: \"*\" } }, source_raster_dem: { type: { required: true, type: \"enum\", values: { \"raster-dem\": {} } }, url: { type: \"string\" }, tiles: { type: \"array\", value: \"string\" }, bounds: { type: \"array\", value: \"number\", length: 4, default: [-180, -85.051129, 180, 85.051129] }, minzoom: { type: \"number\", default: 0 }, maxzoom: { type: \"number\", default: 22 }, tileSize: { type: \"number\", default: 512, units: \"pixels\" }, attribution: { type: \"string\" }, encoding: { type: \"enum\", values: { terrarium: {}, mapbox: {}, custom: {} }, default: \"mapbox\" }, redFactor: { type: \"number\", default: 1 }, blueFactor: { type: \"number\", default: 1 }, greenFactor: { type: \"number\", default: 1 }, baseShift: { type: \"number\", default: 0 }, volatile: { type: \"boolean\", default: false }, \"*\": { type: \"*\" } }, source_geojson: { type: { required: true, type: \"enum\", values: { geojson: {} } }, data: { required: true, type: \"*\" }, maxzoom: { type: \"number\", default: 18 }, attribution: { type: \"string\" }, buffer: { type: \"number\", default: 128, maximum: 512, minimum: 0 }, filter: { type: \"*\" }, tolerance: { type: \"number\", default: 0.375 }, cluster: { type: \"boolean\", default: false }, clusterRadius: { type: \"number\", default: 50, minimum: 0 }, clusterMaxZoom: { type: \"number\" }, clusterMinPoints: { type: \"number\" }, clusterProperties: { type: \"*\" }, lineMetrics: { type: \"boolean\", default: false }, generateId: { type: \"boolean\", default: false }, promoteId: { type: \"promoteId\" } }, source_video: { type: { required: true, type: \"enum\", values: { video: {} } }, urls: { required: true, type: \"array\", value: \"string\" }, coordinates: { required: true, type: \"array\", length: 4, value: { type: \"array\", length: 2, value: \"number\" } } }, source_image: { type: { required: true, type: \"enum\", values: { image: {} } }, url: { required: true, type: \"string\" }, coordinates: { required: true, type: \"array\", length: 4, value: { type: \"array\", length: 2, value: \"number\" } } }, layer: { id: { type: \"string\", required: true }, type: { type: \"enum\", values: { fill: {}, line: {}, symbol: {}, circle: {}, heatmap: {}, \"fill-extrusion\": {}, raster: {}, hillshade: {}, background: {} }, required: true }, metadata: { type: \"*\" }, source: { type: \"string\" }, \"source-layer\": { type: \"string\" }, minzoom: { type: \"number\", minimum: 0, maximum: 24 }, maxzoom: { type: \"number\", minimum: 0, maximum: 24 }, filter: { type: \"filter\" }, layout: { type: \"layout\" }, paint: { type: \"paint\" } }, layout: [\"layout_fill\", \"layout_line\", \"layout_circle\", \"layout_heatmap\", \"layout_fill-extrusion\", \"layout_symbol\", \"layout_raster\", \"layout_hillshade\", \"layout_background\"], layout_background: { visibility: { type: \"enum\", values: { visible: {}, none: {} }, default: \"visible\", \"property-type\": \"constant\" } }, layout_fill: { \"fill-sort-key\": { type: \"number\", expression: { interpolated: false, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, visibility: { type: \"enum\", values: { visible: {}, none: {} }, default: \"visible\", \"property-type\": \"constant\" } }, layout_circle: { \"circle-sort-key\": { type: \"number\", expression: { interpolated: false, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, visibility: { type: \"enum\", values: { visible: {}, none: {} }, default: \"visible\", \"property-type\": \"constant\" } }, layout_heatmap: { visibility: { type: \"enum\", values: { visible: {}, none: {} }, default: \"visible\", \"property-type\": \"constant\" } }, \"layout_fill-extrusion\": { visibility: { type: \"enum\", values: { visible: {}, none: {} }, default: \"visible\", \"property-type\": \"constant\" } }, layout_line: { \"line-cap\": { type: \"enum\", values: { butt: {}, round: {}, square: {} }, default: \"butt\", expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"line-join\": { type: \"enum\", values: { bevel: {}, round: {}, miter: {} }, default: \"miter\", expression: { interpolated: false, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"line-miter-limit\": { type: \"number\", default: 2, requires: [{ \"line-join\": \"miter\" }], expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"line-round-limit\": { type: \"number\", default: 1.05, requires: [{ \"line-join\": \"round\" }], expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"line-sort-key\": { type: \"number\", expression: { interpolated: false, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, visibility: { type: \"enum\", values: { visible: {}, none: {} }, default: \"visible\", \"property-type\": \"constant\" } }, layout_symbol: { \"symbol-placement\": { type: \"enum\", values: { point: {}, line: {}, \"line-center\": {} }, default: \"point\", expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"symbol-spacing\": { type: \"number\", default: 250, minimum: 1, units: \"pixels\", requires: [{ \"symbol-placement\": \"line\" }], expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"symbol-avoid-edges\": { type: \"boolean\", default: false, expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"symbol-sort-key\": { type: \"number\", expression: { interpolated: false, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"symbol-z-order\": { type: \"enum\", values: { auto: {}, \"viewport-y\": {}, source: {} }, default: \"auto\", expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"icon-allow-overlap\": { type: \"boolean\", default: false, requires: [\"icon-image\", { \"!\": \"icon-overlap\" }], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"icon-overlap\": { type: \"enum\", values: { never: {}, always: {}, cooperative: {} }, requires: [\"icon-image\"], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"icon-ignore-placement\": { type: \"boolean\", default: false, requires: [\"icon-image\"], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"icon-optional\": { type: \"boolean\", default: false, requires: [\"icon-image\", \"text-field\"], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"icon-rotation-alignment\": { type: \"enum\", values: { map: {}, viewport: {}, auto: {} }, default: \"auto\", requires: [\"icon-image\"], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"icon-size\": { type: \"number\", default: 1, minimum: 0, units: \"factor of the original icon size\", requires: [\"icon-image\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"icon-text-fit\": { type: \"enum\", values: { none: {}, width: {}, height: {}, both: {} }, default: \"none\", requires: [\"icon-image\", \"text-field\"], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"icon-text-fit-padding\": { type: \"array\", value: \"number\", length: 4, default: [0, 0, 0, 0], units: \"pixels\", requires: [\"icon-image\", \"text-field\", { \"icon-text-fit\": [\"both\", \"width\", \"height\"] }], expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"icon-image\": { type: \"resolvedImage\", tokens: true, expression: { interpolated: false, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"icon-rotate\": { type: \"number\", default: 0, period: 360, units: \"degrees\", requires: [\"icon-image\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"icon-padding\": { type: \"padding\", default: [2], units: \"pixels\", requires: [\"icon-image\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"icon-keep-upright\": { type: \"boolean\", default: false, requires: [\"icon-image\", { \"icon-rotation-alignment\": \"map\" }, { \"symbol-placement\": [\"line\", \"line-center\"] }], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"icon-offset\": { type: \"array\", value: \"number\", length: 2, default: [0, 0], requires: [\"icon-image\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"icon-anchor\": { type: \"enum\", values: { center: {}, left: {}, right: {}, top: {}, bottom: {}, \"top-left\": {}, \"top-right\": {}, \"bottom-left\": {}, \"bottom-right\": {} }, default: \"center\", requires: [\"icon-image\"], expression: { interpolated: false, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"icon-pitch-alignment\": { type: \"enum\", values: { map: {}, viewport: {}, auto: {} }, default: \"auto\", requires: [\"icon-image\"], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"text-pitch-alignment\": { type: \"enum\", values: { map: {}, viewport: {}, auto: {} }, default: \"auto\", requires: [\"text-field\"], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"text-rotation-alignment\": { type: \"enum\", values: { map: {}, viewport: {}, \"viewport-glyph\": {}, auto: {} }, default: \"auto\", requires: [\"text-field\"], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"text-field\": { type: \"formatted\", default: \"\", tokens: true, expression: { interpolated: false, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"text-font\": { type: \"array\", value: \"string\", default: [\"Open Sans Regular\", \"Arial Unicode MS Regular\"], requires: [\"text-field\"], expression: { interpolated: false, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"text-size\": { type: \"number\", default: 16, minimum: 0, units: \"pixels\", requires: [\"text-field\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"text-max-width\": { type: \"number\", default: 10, minimum: 0, units: \"ems\", requires: [\"text-field\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"text-line-height\": { type: \"number\", default: 1.2, units: \"ems\", requires: [\"text-field\"], expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"text-letter-spacing\": { type: \"number\", default: 0, units: \"ems\", requires: [\"text-field\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"text-justify\": { type: \"enum\", values: { auto: {}, left: {}, center: {}, right: {} }, default: \"center\", requires: [\"text-field\"], expression: { interpolated: false, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"text-radial-offset\": { type: \"number\", units: \"ems\", default: 0, requires: [\"text-field\"], \"property-type\": \"data-driven\", expression: { interpolated: true, parameters: [\"zoom\", \"feature\"] } }, \"text-variable-anchor\": { type: \"array\", value: \"enum\", values: { center: {}, left: {}, right: {}, top: {}, bottom: {}, \"top-left\": {}, \"top-right\": {}, \"bottom-left\": {}, \"bottom-right\": {} }, requires: [\"text-field\", { \"symbol-placement\": [\"point\"] }], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"text-variable-anchor-offset\": { type: \"variableAnchorOffsetCollection\", requires: [\"text-field\", { \"symbol-placement\": [\"point\"] }], expression: { interpolated: true, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"text-anchor\": { type: \"enum\", values: { center: {}, left: {}, right: {}, top: {}, bottom: {}, \"top-left\": {}, \"top-right\": {}, \"bottom-left\": {}, \"bottom-right\": {} }, default: \"center\", requires: [\"text-field\", { \"!\": \"text-variable-anchor\" }], expression: { interpolated: false, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"text-max-angle\": { type: \"number\", default: 45, units: \"degrees\", requires: [\"text-field\", { \"symbol-placement\": [\"line\", \"line-center\"] }], expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"text-writing-mode\": { type: \"array\", value: \"enum\", values: { horizontal: {}, vertical: {} }, requires: [\"text-field\", { \"symbol-placement\": [\"point\"] }], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"text-rotate\": { type: \"number\", default: 0, period: 360, units: \"degrees\", requires: [\"text-field\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"text-padding\": { type: \"number\", default: 2, minimum: 0, units: \"pixels\", requires: [\"text-field\"], expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"text-keep-upright\": { type: \"boolean\", default: true, requires: [\"text-field\", { \"text-rotation-alignment\": \"map\" }, { \"symbol-placement\": [\"line\", \"line-center\"] }], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"text-transform\": { type: \"enum\", values: { none: {}, uppercase: {}, lowercase: {} }, default: \"none\", requires: [\"text-field\"], expression: { interpolated: false, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"text-offset\": { type: \"array\", value: \"number\", units: \"ems\", length: 2, default: [0, 0], requires: [\"text-field\", { \"!\": \"text-radial-offset\" }], expression: { interpolated: true, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"data-driven\" }, \"text-allow-overlap\": { type: \"boolean\", default: false, requires: [\"text-field\", { \"!\": \"text-overlap\" }], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"text-overlap\": { type: \"enum\", values: { never: {}, always: {}, cooperative: {} }, requires: [\"text-field\"], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"text-ignore-placement\": { type: \"boolean\", default: false, requires: [\"text-field\"], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"text-optional\": { type: \"boolean\", default: false, requires: [\"text-field\", \"icon-image\"], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, visibility: { type: \"enum\", values: { visible: {}, none: {} }, default: \"visible\", \"property-type\": \"constant\" } }, layout_raster: { visibility: { type: \"enum\", values: { visible: {}, none: {} }, default: \"visible\", \"property-type\": \"constant\" } }, layout_hillshade: { visibility: { type: \"enum\", values: { visible: {}, none: {} }, default: \"visible\", \"property-type\": \"constant\" } }, filter: { type: \"array\", value: \"*\" }, filter_operator: { type: \"enum\", values: { \"==\": {}, \"!=\": {}, \">\": {}, \">=\": {}, \"<\": {}, \"<=\": {}, in: {}, \"!in\": {}, all: {}, any: {}, none: {}, has: {}, \"!has\": {} } }, geometry_type: { type: \"enum\", values: { Point: {}, LineString: {}, Polygon: {} } }, function: { expression: { type: \"expression\" }, stops: { type: \"array\", value: \"function_stop\" }, base: { type: \"number\", default: 1, minimum: 0 }, property: { type: \"string\", default: \"$zoom\" }, type: { type: \"enum\", values: { identity: {}, exponential: {}, interval: {}, categorical: {} }, default: \"exponential\" }, colorSpace: { type: \"enum\", values: { rgb: {}, lab: {}, hcl: {} }, default: \"rgb\" }, default: { type: \"*\", required: false } }, function_stop: { type: \"array\", minimum: 0, maximum: 24, value: [\"number\", \"color\"], length: 2 }, expression: { type: \"array\", value: \"*\", minimum: 1 }, light: { anchor: { type: \"enum\", default: \"viewport\", values: { map: {}, viewport: {} }, \"property-type\": \"data-constant\", transition: false, expression: { interpolated: false, parameters: [\"zoom\"] } }, position: { type: \"array\", default: [1.15, 210, 30], length: 3, value: \"number\", \"property-type\": \"data-constant\", transition: true, expression: { interpolated: true, parameters: [\"zoom\"] } }, color: { type: \"color\", \"property-type\": \"data-constant\", default: \"#ffffff\", expression: { interpolated: true, parameters: [\"zoom\"] }, transition: true }, intensity: { type: \"number\", \"property-type\": \"data-constant\", default: 0.5, minimum: 0, maximum: 1, expression: { interpolated: true, parameters: [\"zoom\"] }, transition: true } }, sky: { \"sky-color\": { type: \"color\", \"property-type\": \"data-constant\", default: \"#88C6FC\", expression: { interpolated: true, parameters: [\"zoom\"] }, transition: true }, \"horizon-color\": { type: \"color\", \"property-type\": \"data-constant\", default: \"#ffffff\", expression: { interpolated: true, parameters: [\"zoom\"] }, transition: true }, \"fog-color\": { type: \"color\", \"property-type\": \"data-constant\", default: \"#ffffff\", expression: { interpolated: true, parameters: [\"zoom\"] }, transition: true }, \"fog-ground-blend\": { type: \"number\", \"property-type\": \"data-constant\", default: 0.5, minimum: 0, maximum: 1, expression: { interpolated: true, parameters: [\"zoom\"] }, transition: true }, \"horizon-fog-blend\": { type: \"number\", \"property-type\": \"data-constant\", default: 0.8, minimum: 0, maximum: 1, expression: { interpolated: true, parameters: [\"zoom\"] }, transition: true }, \"sky-horizon-blend\": { type: \"number\", \"property-type\": \"data-constant\", default: 0.8, minimum: 0, maximum: 1, expression: { interpolated: true, parameters: [\"zoom\"] }, transition: true }, \"atmosphere-blend\": { type: \"number\", \"property-type\": \"data-constant\", default: 0.8, minimum: 0, maximum: 1, expression: { interpolated: true, parameters: [\"zoom\"] }, transition: true } }, terrain: { source: { type: \"string\", required: true }, exaggeration: { type: \"number\", minimum: 0, default: 1 } }, projection: { type: { type: \"enum\", default: \"mercator\", values: { mercator: {}, globe: {} } } }, paint: [\"paint_fill\", \"paint_line\", \"paint_circle\", \"paint_heatmap\", \"paint_fill-extrusion\", \"paint_symbol\", \"paint_raster\", \"paint_hillshade\", \"paint_background\"], paint_fill: { \"fill-antialias\": { type: \"boolean\", default: true, expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"fill-opacity\": { type: \"number\", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"fill-color\": { type: \"color\", default: \"#000000\", transition: true, requires: [{ \"!\": \"fill-pattern\" }], expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"fill-outline-color\": { type: \"color\", transition: true, requires: [{ \"!\": \"fill-pattern\" }, { \"fill-antialias\": true }], expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"fill-translate\": { type: \"array\", value: \"number\", length: 2, default: [0, 0], transition: true, units: \"pixels\", expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"fill-translate-anchor\": { type: \"enum\", values: { map: {}, viewport: {} }, default: \"map\", requires: [\"fill-translate\"], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"fill-pattern\": { type: \"resolvedImage\", transition: true, expression: { interpolated: false, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"cross-faded-data-driven\" } }, \"paint_fill-extrusion\": { \"fill-extrusion-opacity\": { type: \"number\", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"fill-extrusion-color\": { type: \"color\", default: \"#000000\", transition: true, requires: [{ \"!\": \"fill-extrusion-pattern\" }], expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"fill-extrusion-translate\": { type: \"array\", value: \"number\", length: 2, default: [0, 0], transition: true, units: \"pixels\", expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"fill-extrusion-translate-anchor\": { type: \"enum\", values: { map: {}, viewport: {} }, default: \"map\", requires: [\"fill-extrusion-translate\"], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"fill-extrusion-pattern\": { type: \"resolvedImage\", transition: true, expression: { interpolated: false, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"cross-faded-data-driven\" }, \"fill-extrusion-height\": { type: \"number\", default: 0, minimum: 0, units: \"meters\", transition: true, expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"fill-extrusion-base\": { type: \"number\", default: 0, minimum: 0, units: \"meters\", transition: true, requires: [\"fill-extrusion-height\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"fill-extrusion-vertical-gradient\": { type: \"boolean\", default: true, transition: false, expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" } }, paint_line: { \"line-opacity\": { type: \"number\", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"line-color\": { type: \"color\", default: \"#000000\", transition: true, requires: [{ \"!\": \"line-pattern\" }], expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"line-translate\": { type: \"array\", value: \"number\", length: 2, default: [0, 0], transition: true, units: \"pixels\", expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"line-translate-anchor\": { type: \"enum\", values: { map: {}, viewport: {} }, default: \"map\", requires: [\"line-translate\"], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"line-width\": { type: \"number\", default: 1, minimum: 0, transition: true, units: \"pixels\", expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"line-gap-width\": { type: \"number\", default: 0, minimum: 0, transition: true, units: \"pixels\", expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"line-offset\": { type: \"number\", default: 0, transition: true, units: \"pixels\", expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"line-blur\": { type: \"number\", default: 0, minimum: 0, transition: true, units: \"pixels\", expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"line-dasharray\": { type: \"array\", value: \"number\", minimum: 0, transition: true, units: \"line widths\", requires: [{ \"!\": \"line-pattern\" }], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"cross-faded\" }, \"line-pattern\": { type: \"resolvedImage\", transition: true, expression: { interpolated: false, parameters: [\"zoom\", \"feature\"] }, \"property-type\": \"cross-faded-data-driven\" }, \"line-gradient\": { type: \"color\", transition: false, requires: [{ \"!\": \"line-dasharray\" }, { \"!\": \"line-pattern\" }, { source: \"geojson\", has: { lineMetrics: true } }], expression: { interpolated: true, parameters: [\"line-progress\"] }, \"property-type\": \"color-ramp\" } }, paint_circle: { \"circle-radius\": { type: \"number\", default: 5, minimum: 0, transition: true, units: \"pixels\", expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"circle-color\": { type: \"color\", default: \"#000000\", transition: true, expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"circle-blur\": { type: \"number\", default: 0, transition: true, expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"circle-opacity\": { type: \"number\", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"circle-translate\": { type: \"array\", value: \"number\", length: 2, default: [0, 0], transition: true, units: \"pixels\", expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"circle-translate-anchor\": { type: \"enum\", values: { map: {}, viewport: {} }, default: \"map\", requires: [\"circle-translate\"], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"circle-pitch-scale\": { type: \"enum\", values: { map: {}, viewport: {} }, default: \"map\", expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"circle-pitch-alignment\": { type: \"enum\", values: { map: {}, viewport: {} }, default: \"viewport\", expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"circle-stroke-width\": { type: \"number\", default: 0, minimum: 0, transition: true, units: \"pixels\", expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"circle-stroke-color\": { type: \"color\", default: \"#000000\", transition: true, expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"circle-stroke-opacity\": { type: \"number\", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" } }, paint_heatmap: { \"heatmap-radius\": { type: \"number\", default: 30, minimum: 1, transition: true, units: \"pixels\", expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"heatmap-weight\": { type: \"number\", default: 1, minimum: 0, transition: false, expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"heatmap-intensity\": { type: \"number\", default: 1, minimum: 0, transition: true, expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"heatmap-color\": { type: \"color\", default: [\"interpolate\", [\"linear\"], [\"heatmap-density\"], 0, \"rgba(0, 0, 255, 0)\", 0.1, \"royalblue\", 0.3, \"cyan\", 0.5, \"lime\", 0.7, \"yellow\", 1, \"red\"], transition: false, expression: { interpolated: true, parameters: [\"heatmap-density\"] }, \"property-type\": \"color-ramp\" }, \"heatmap-opacity\": { type: \"number\", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" } }, paint_symbol: { \"icon-opacity\": { type: \"number\", default: 1, minimum: 0, maximum: 1, transition: true, requires: [\"icon-image\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"icon-color\": { type: \"color\", default: \"#000000\", transition: true, requires: [\"icon-image\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"icon-halo-color\": { type: \"color\", default: \"rgba(0, 0, 0, 0)\", transition: true, requires: [\"icon-image\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"icon-halo-width\": { type: \"number\", default: 0, minimum: 0, transition: true, units: \"pixels\", requires: [\"icon-image\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"icon-halo-blur\": { type: \"number\", default: 0, minimum: 0, transition: true, units: \"pixels\", requires: [\"icon-image\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"icon-translate\": { type: \"array\", value: \"number\", length: 2, default: [0, 0], transition: true, units: \"pixels\", requires: [\"icon-image\"], expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"icon-translate-anchor\": { type: \"enum\", values: { map: {}, viewport: {} }, default: \"map\", requires: [\"icon-image\", \"icon-translate\"], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"text-opacity\": { type: \"number\", default: 1, minimum: 0, maximum: 1, transition: true, requires: [\"text-field\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"text-color\": { type: \"color\", default: \"#000000\", transition: true, overridable: true, requires: [\"text-field\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"text-halo-color\": { type: \"color\", default: \"rgba(0, 0, 0, 0)\", transition: true, requires: [\"text-field\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"text-halo-width\": { type: \"number\", default: 0, minimum: 0, transition: true, units: \"pixels\", requires: [\"text-field\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"text-halo-blur\": { type: \"number\", default: 0, minimum: 0, transition: true, units: \"pixels\", requires: [\"text-field\"], expression: { interpolated: true, parameters: [\"zoom\", \"feature\", \"feature-state\"] }, \"property-type\": \"data-driven\" }, \"text-translate\": { type: \"array\", value: \"number\", length: 2, default: [0, 0], transition: true, units: \"pixels\", requires: [\"text-field\"], expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"text-translate-anchor\": { type: \"enum\", values: { map: {}, viewport: {} }, default: \"map\", requires: [\"text-field\", \"text-translate\"], expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" } }, paint_raster: { \"raster-opacity\": { type: \"number\", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"raster-hue-rotate\": { type: \"number\", default: 0, period: 360, transition: true, units: \"degrees\", expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"raster-brightness-min\": { type: \"number\", default: 0, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"raster-brightness-max\": { type: \"number\", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"raster-saturation\": { type: \"number\", default: 0, minimum: -1, maximum: 1, transition: true, expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"raster-contrast\": { type: \"number\", default: 0, minimum: -1, maximum: 1, transition: true, expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"raster-resampling\": { type: \"enum\", values: { linear: {}, nearest: {} }, default: \"linear\", expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"raster-fade-duration\": { type: \"number\", default: 300, minimum: 0, transition: false, units: \"milliseconds\", expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" } }, paint_hillshade: { \"hillshade-illumination-direction\": { type: \"number\", default: 335, minimum: 0, maximum: 359, transition: false, expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"hillshade-illumination-anchor\": { type: \"enum\", values: { map: {}, viewport: {} }, default: \"viewport\", expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"hillshade-exaggeration\": { type: \"number\", default: 0.5, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"hillshade-shadow-color\": { type: \"color\", default: \"#000000\", transition: true, expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"hillshade-highlight-color\": { type: \"color\", default: \"#FFFFFF\", transition: true, expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"hillshade-accent-color\": { type: \"color\", default: \"#000000\", transition: true, expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" } }, paint_background: { \"background-color\": { type: \"color\", default: \"#000000\", transition: true, requires: [{ \"!\": \"background-pattern\" }], expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" }, \"background-pattern\": { type: \"resolvedImage\", transition: true, expression: { interpolated: false, parameters: [\"zoom\"] }, \"property-type\": \"cross-faded\" }, \"background-opacity\": { type: \"number\", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: [\"zoom\"] }, \"property-type\": \"data-constant\" } }, transition: { duration: { type: \"number\", default: 300, minimum: 0, units: \"milliseconds\" }, delay: { type: \"number\", default: 0, minimum: 0, units: \"milliseconds\" } }, \"property-type\": { \"data-driven\": { type: \"property-type\" }, \"cross-faded\": { type: \"property-type\" }, \"cross-faded-data-driven\": { type: \"property-type\" }, \"color-ramp\": { type: \"property-type\" }, \"data-constant\": { type: \"property-type\" }, constant: { type: \"property-type\" } }, promoteId: { \"*\": { type: \"string\" } } };\n const K2 = [\"type\", \"source\", \"source-layer\", \"minzoom\", \"maxzoom\", \"filter\", \"layout\"];\n function X(t4, e2) {\n const r2 = {};\n for (const e3 in t4) \"ref\" !== e3 && (r2[e3] = t4[e3]);\n return K2.forEach((t5) => {\n t5 in e2 && (r2[t5] = e2[t5]);\n }), r2;\n }\n function H(t4, e2) {\n if (Array.isArray(t4)) {\n if (!Array.isArray(e2) || t4.length !== e2.length) return false;\n for (let r2 = 0; r2 < t4.length; r2++) if (!H(t4[r2], e2[r2])) return false;\n return true;\n }\n if (\"object\" == typeof t4 && null !== t4 && null !== e2) {\n if (\"object\" != typeof e2) return false;\n if (Object.keys(t4).length !== Object.keys(e2).length) return false;\n for (const r2 in t4) if (!H(t4[r2], e2[r2])) return false;\n return true;\n }\n return t4 === e2;\n }\n function Y(t4, e2) {\n t4.push(e2);\n }\n function J(t4, e2, r2) {\n Y(r2, { command: \"addSource\", args: [t4, e2[t4]] });\n }\n function W(t4, e2, r2) {\n Y(e2, { command: \"removeSource\", args: [t4] }), r2[t4] = true;\n }\n function Q(t4, e2, r2, n2) {\n W(t4, r2, n2), J(t4, e2, r2);\n }\n function tt(t4, e2, r2) {\n let n2;\n for (n2 in t4[r2]) if (Object.prototype.hasOwnProperty.call(t4[r2], n2) && \"data\" !== n2 && !H(t4[r2][n2], e2[r2][n2])) return false;\n for (n2 in e2[r2]) if (Object.prototype.hasOwnProperty.call(e2[r2], n2) && \"data\" !== n2 && !H(t4[r2][n2], e2[r2][n2])) return false;\n return true;\n }\n function et(t4, e2, r2, n2, i2, s2) {\n t4 = t4 || {}, e2 = e2 || {};\n for (const a2 in t4) Object.prototype.hasOwnProperty.call(t4, a2) && (H(t4[a2], e2[a2]) || r2.push({ command: s2, args: [n2, a2, e2[a2], i2] }));\n for (const a2 in e2) Object.prototype.hasOwnProperty.call(e2, a2) && !Object.prototype.hasOwnProperty.call(t4, a2) && (H(t4[a2], e2[a2]) || r2.push({ command: s2, args: [n2, a2, e2[a2], i2] }));\n }\n function rt(t4) {\n return t4.id;\n }\n function nt(t4, e2) {\n return t4[e2.id] = e2, t4;\n }\n class it {\n constructor(t4, e2, r2, n2) {\n this.message = (t4 ? `${t4}: ` : \"\") + r2, n2 && (this.identifier = n2), null != e2 && e2.__line__ && (this.line = e2.__line__);\n }\n }\n function st(t4, ...e2) {\n for (const r2 of e2) for (const e3 in r2) t4[e3] = r2[e3];\n return t4;\n }\n class at extends Error {\n constructor(t4, e2) {\n super(e2), this.message = e2, this.key = t4;\n }\n }\n class ot {\n constructor(t4, e2 = []) {\n this.parent = t4, this.bindings = {};\n for (const [t5, r2] of e2) this.bindings[t5] = r2;\n }\n concat(t4) {\n return new ot(this, t4);\n }\n get(t4) {\n if (this.bindings[t4]) return this.bindings[t4];\n if (this.parent) return this.parent.get(t4);\n throw new Error(`${t4} not found in scope.`);\n }\n has(t4) {\n return !!this.bindings[t4] || !!this.parent && this.parent.has(t4);\n }\n }\n const lt = { kind: \"null\" }, ut = { kind: \"number\" }, ct = { kind: \"string\" }, ht = { kind: \"boolean\" }, pt = { kind: \"color\" }, ft = { kind: \"object\" }, dt = { kind: \"value\" }, yt = { kind: \"collator\" }, mt = { kind: \"formatted\" }, gt = { kind: \"padding\" }, xt = { kind: \"resolvedImage\" }, vt = { kind: \"variableAnchorOffsetCollection\" };\n function bt(t4, e2) {\n return { kind: \"array\", itemType: t4, N: e2 };\n }\n function wt(t4) {\n if (\"array\" === t4.kind) {\n const e2 = wt(t4.itemType);\n return \"number\" == typeof t4.N ? `array<${e2}, ${t4.N}>` : \"value\" === t4.itemType.kind ? \"array\" : `array<${e2}>`;\n }\n return t4.kind;\n }\n const _t = [lt, ut, ct, ht, pt, mt, ft, bt(dt), gt, xt, vt];\n function At(t4, e2) {\n if (\"error\" === e2.kind) return null;\n if (\"array\" === t4.kind) {\n if (\"array\" === e2.kind && (0 === e2.N && \"value\" === e2.itemType.kind || !At(t4.itemType, e2.itemType)) && (\"number\" != typeof t4.N || t4.N === e2.N)) return null;\n } else {\n if (t4.kind === e2.kind) return null;\n if (\"value\" === t4.kind) {\n for (const t5 of _t) if (!At(t5, e2)) return null;\n }\n }\n return `Expected ${wt(t4)} but found ${wt(e2)} instead.`;\n }\n function St(t4, e2) {\n return e2.some((e3) => e3.kind === t4.kind);\n }\n function kt(t4, e2) {\n return e2.some((e3) => \"null\" === e3 ? null === t4 : \"array\" === e3 ? Array.isArray(t4) : \"object\" === e3 ? t4 && !Array.isArray(t4) && \"object\" == typeof t4 : e3 === typeof t4);\n }\n function Mt(t4, e2) {\n return \"array\" === t4.kind && \"array\" === e2.kind ? t4.itemType.kind === e2.itemType.kind && \"number\" == typeof t4.N : t4.kind === e2.kind;\n }\n const It = 0.96422, zt = 0.82521, Pt = 4 / 29, Ct = 6 / 29, Bt = 3 * Ct * Ct, Vt = Ct * Ct * Ct, Et = Math.PI / 180, Ft = 180 / Math.PI;\n function Tt(t4) {\n return (t4 %= 360) < 0 && (t4 += 360), t4;\n }\n function $t([t4, e2, r2, n2]) {\n let i2, s2;\n const a2 = Dt((0.2225045 * (t4 = Lt(t4)) + 0.7168786 * (e2 = Lt(e2)) + 0.0606169 * (r2 = Lt(r2))) / 1);\n t4 === e2 && e2 === r2 ? i2 = s2 = a2 : (i2 = Dt((0.4360747 * t4 + 0.3850649 * e2 + 0.1430804 * r2) / It), s2 = Dt((0.0139322 * t4 + 0.0971045 * e2 + 0.7141733 * r2) / zt));\n const o2 = 116 * a2 - 16;\n return [o2 < 0 ? 0 : o2, 500 * (i2 - a2), 200 * (a2 - s2), n2];\n }\n function Lt(t4) {\n return t4 <= 0.04045 ? t4 / 12.92 : Math.pow((t4 + 0.055) / 1.055, 2.4);\n }\n function Dt(t4) {\n return t4 > Vt ? Math.pow(t4, 1 / 3) : t4 / Bt + Pt;\n }\n function Ot([t4, e2, r2, n2]) {\n let i2 = (t4 + 16) / 116, s2 = isNaN(e2) ? i2 : i2 + e2 / 500, a2 = isNaN(r2) ? i2 : i2 - r2 / 200;\n return i2 = 1 * Rt(i2), s2 = It * Rt(s2), a2 = zt * Rt(a2), [jt(3.1338561 * s2 - 1.6168667 * i2 - 0.4906146 * a2), jt(-0.9787684 * s2 + 1.9161415 * i2 + 0.033454 * a2), jt(0.0719453 * s2 - 0.2289914 * i2 + 1.4052427 * a2), n2];\n }\n function jt(t4) {\n return (t4 = t4 <= 304e-5 ? 12.92 * t4 : 1.055 * Math.pow(t4, 1 / 2.4) - 0.055) < 0 ? 0 : t4 > 1 ? 1 : t4;\n }\n function Rt(t4) {\n return t4 > Ct ? t4 * t4 * t4 : Bt * (t4 - Pt);\n }\n function Ut(t4) {\n return parseInt(t4.padEnd(2, t4), 16) / 255;\n }\n function qt(t4, e2) {\n return Nt(e2 ? t4 / 100 : t4, 0, 1);\n }\n function Nt(t4, e2, r2) {\n return Math.min(Math.max(e2, t4), r2);\n }\n function Zt(t4) {\n return !t4.some(Number.isNaN);\n }\n const Gt = { 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] };\n class Kt {\n constructor(t4, e2, r2, n2 = 1, i2 = true) {\n this.r = t4, this.g = e2, this.b = r2, this.a = n2, i2 || (this.r *= n2, this.g *= n2, this.b *= n2, n2 || this.overwriteGetter(\"rgb\", [t4, e2, r2, n2]));\n }\n static parse(t4) {\n if (t4 instanceof Kt) return t4;\n if (\"string\" != typeof t4) return;\n const e2 = function(t5) {\n if (\"transparent\" === (t5 = t5.toLowerCase().trim())) return [0, 0, 0, 0];\n const e3 = Gt[t5];\n if (e3) {\n const [t6, r3, n2] = e3;\n return [t6 / 255, r3 / 255, n2 / 255, 1];\n }\n if (t5.startsWith(\"#\") && /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t5)) {\n const e4 = t5.length < 6 ? 1 : 2;\n let r3 = 1;\n return [Ut(t5.slice(r3, r3 += e4)), Ut(t5.slice(r3, r3 += e4)), Ut(t5.slice(r3, r3 += e4)), Ut(t5.slice(r3, r3 + e4) || \"ff\")];\n }\n if (t5.startsWith(\"rgb\")) {\n const e4 = t5.match(/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);\n if (e4) {\n const [t6, r3, n2, i2, s2, a2, o2, l2, u2, c2, h2, p2] = e4, f2 = [i2 || \" \", o2 || \" \", c2].join(\"\");\n if (\" \" === f2 || \" /\" === f2 || \",,\" === f2 || \",,,\" === f2) {\n const t7 = [n2, a2, u2].join(\"\"), e5 = \"%%%\" === t7 ? 100 : \"\" === t7 ? 255 : 0;\n if (e5) {\n const t8 = [Nt(+r3 / e5, 0, 1), Nt(+s2 / e5, 0, 1), Nt(+l2 / e5, 0, 1), h2 ? qt(+h2, p2) : 1];\n if (Zt(t8)) return t8;\n }\n }\n return;\n }\n }\n const r2 = t5.match(/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);\n if (r2) {\n const [t6, e4, n2, i2, s2, a2, o2, l2, u2] = r2, c2 = [n2 || \" \", s2 || \" \", o2].join(\"\");\n if (\" \" === c2 || \" /\" === c2 || \",,\" === c2 || \",,,\" === c2) {\n const t7 = [+e4, Nt(+i2, 0, 100), Nt(+a2, 0, 100), l2 ? qt(+l2, u2) : 1];\n if (Zt(t7)) return function([t8, e5, r3, n3]) {\n function i3(n4) {\n const i4 = (n4 + t8 / 30) % 12, s3 = e5 * Math.min(r3, 1 - r3);\n return r3 - s3 * Math.max(-1, Math.min(i4 - 3, 9 - i4, 1));\n }\n return t8 = Tt(t8), e5 /= 100, r3 /= 100, [i3(0), i3(8), i3(4), n3];\n }(t7);\n }\n }\n }(t4);\n return e2 ? new Kt(...e2, false) : void 0;\n }\n get rgb() {\n const { r: t4, g: e2, b: r2, a: n2 } = this, i2 = n2 || 1 / 0;\n return this.overwriteGetter(\"rgb\", [t4 / i2, e2 / i2, r2 / i2, n2]);\n }\n get hcl() {\n return this.overwriteGetter(\"hcl\", function(t4) {\n const [e2, r2, n2, i2] = $t(t4), s2 = Math.sqrt(r2 * r2 + n2 * n2);\n return [Math.round(1e4 * s2) ? Tt(Math.atan2(n2, r2) * Ft) : NaN, s2, e2, i2];\n }(this.rgb));\n }\n get lab() {\n return this.overwriteGetter(\"lab\", $t(this.rgb));\n }\n overwriteGetter(t4, e2) {\n return Object.defineProperty(this, t4, { value: e2 }), e2;\n }\n toString() {\n const [t4, e2, r2, n2] = this.rgb;\n return `rgba(${[t4, e2, r2].map((t5) => Math.round(255 * t5)).join(\",\")},${n2})`;\n }\n }\n Kt.black = new Kt(0, 0, 0, 1), Kt.white = new Kt(1, 1, 1, 1), Kt.transparent = new Kt(0, 0, 0, 0), Kt.red = new Kt(1, 0, 0, 1);\n class Xt {\n constructor(t4, e2, r2) {\n this.sensitivity = t4 ? e2 ? \"variant\" : \"case\" : e2 ? \"accent\" : \"base\", this.locale = r2, this.collator = new Intl.Collator(this.locale ? this.locale : [], { sensitivity: this.sensitivity, usage: \"search\" });\n }\n compare(t4, e2) {\n return this.collator.compare(t4, e2);\n }\n resolvedLocale() {\n return new Intl.Collator(this.locale ? this.locale : []).resolvedOptions().locale;\n }\n }\n class Ht {\n constructor(t4, e2, r2, n2, i2) {\n this.text = t4, this.image = e2, this.scale = r2, this.fontStack = n2, this.textColor = i2;\n }\n }\n class Yt {\n constructor(t4) {\n this.sections = t4;\n }\n static fromString(t4) {\n return new Yt([new Ht(t4, null, null, null, null)]);\n }\n isEmpty() {\n return 0 === this.sections.length || !this.sections.some((t4) => 0 !== t4.text.length || t4.image && 0 !== t4.image.name.length);\n }\n static factory(t4) {\n return t4 instanceof Yt ? t4 : Yt.fromString(t4);\n }\n toString() {\n return 0 === this.sections.length ? \"\" : this.sections.map((t4) => t4.text).join(\"\");\n }\n }\n class Jt {\n constructor(t4) {\n this.values = t4.slice();\n }\n static parse(t4) {\n if (t4 instanceof Jt) return t4;\n if (\"number\" == typeof t4) return new Jt([t4, t4, t4, t4]);\n if (Array.isArray(t4) && !(t4.length < 1 || t4.length > 4)) {\n for (const e2 of t4) if (\"number\" != typeof e2) return;\n switch (t4.length) {\n case 1:\n t4 = [t4[0], t4[0], t4[0], t4[0]];\n break;\n case 2:\n t4 = [t4[0], t4[1], t4[0], t4[1]];\n break;\n case 3:\n t4 = [t4[0], t4[1], t4[2], t4[1]];\n }\n return new Jt(t4);\n }\n }\n toString() {\n return JSON.stringify(this.values);\n }\n }\n const Wt = /* @__PURE__ */ new Set([\"center\", \"left\", \"right\", \"top\", \"bottom\", \"top-left\", \"top-right\", \"bottom-left\", \"bottom-right\"]);\n class Qt {\n constructor(t4) {\n this.values = t4.slice();\n }\n static parse(t4) {\n if (t4 instanceof Qt) return t4;\n if (Array.isArray(t4) && !(t4.length < 1) && t4.length % 2 == 0) {\n for (let e2 = 0; e2 < t4.length; e2 += 2) {\n const r2 = t4[e2], n2 = t4[e2 + 1];\n if (\"string\" != typeof r2 || !Wt.has(r2)) return;\n if (!Array.isArray(n2) || 2 !== n2.length || \"number\" != typeof n2[0] || \"number\" != typeof n2[1]) return;\n }\n return new Qt(t4);\n }\n }\n toString() {\n return JSON.stringify(this.values);\n }\n }\n class te {\n constructor(t4) {\n this.name = t4.name, this.available = t4.available;\n }\n toString() {\n return this.name;\n }\n static fromString(t4) {\n return t4 ? new te({ name: t4, available: false }) : null;\n }\n }\n function ee(t4, e2, r2, n2) {\n return \"number\" == typeof t4 && t4 >= 0 && t4 <= 255 && \"number\" == typeof e2 && e2 >= 0 && e2 <= 255 && \"number\" == typeof r2 && r2 >= 0 && r2 <= 255 ? void 0 === n2 || \"number\" == typeof n2 && n2 >= 0 && n2 <= 1 ? null : `Invalid rgba value [${[t4, e2, r2, n2].join(\", \")}]: 'a' must be between 0 and 1.` : `Invalid rgba value [${(\"number\" == typeof n2 ? [t4, e2, r2, n2] : [t4, e2, r2]).join(\", \")}]: 'r', 'g', and 'b' must be between 0 and 255.`;\n }\n function re(t4) {\n if (null === t4 || \"string\" == typeof t4 || \"boolean\" == typeof t4 || \"number\" == typeof t4 || t4 instanceof Kt || t4 instanceof Xt || t4 instanceof Yt || t4 instanceof Jt || t4 instanceof Qt || t4 instanceof te) return true;\n if (Array.isArray(t4)) {\n for (const e2 of t4) if (!re(e2)) return false;\n return true;\n }\n if (\"object\" == typeof t4) {\n for (const e2 in t4) if (!re(t4[e2])) return false;\n return true;\n }\n return false;\n }\n function ne(t4) {\n if (null === t4) return lt;\n if (\"string\" == typeof t4) return ct;\n if (\"boolean\" == typeof t4) return ht;\n if (\"number\" == typeof t4) return ut;\n if (t4 instanceof Kt) return pt;\n if (t4 instanceof Xt) return yt;\n if (t4 instanceof Yt) return mt;\n if (t4 instanceof Jt) return gt;\n if (t4 instanceof Qt) return vt;\n if (t4 instanceof te) return xt;\n if (Array.isArray(t4)) {\n const e2 = t4.length;\n let r2;\n for (const e3 of t4) {\n const t5 = ne(e3);\n if (r2) {\n if (r2 === t5) continue;\n r2 = dt;\n break;\n }\n r2 = t5;\n }\n return bt(r2 || dt, e2);\n }\n return ft;\n }\n function ie(t4) {\n const e2 = typeof t4;\n return null === t4 ? \"\" : \"string\" === e2 || \"number\" === e2 || \"boolean\" === e2 ? String(t4) : t4 instanceof Kt || t4 instanceof Yt || t4 instanceof Jt || t4 instanceof Qt || t4 instanceof te ? t4.toString() : JSON.stringify(t4);\n }\n class se {\n constructor(t4, e2) {\n this.type = t4, this.value = e2;\n }\n static parse(t4, e2) {\n if (2 !== t4.length) return e2.error(`'literal' expression requires exactly one argument, but found ${t4.length - 1} instead.`);\n if (!re(t4[1])) return e2.error(\"invalid value\");\n const r2 = t4[1];\n let n2 = ne(r2);\n const i2 = e2.expectedType;\n return \"array\" !== n2.kind || 0 !== n2.N || !i2 || \"array\" !== i2.kind || \"number\" == typeof i2.N && 0 !== i2.N || (n2 = i2), new se(n2, r2);\n }\n evaluate() {\n return this.value;\n }\n eachChild() {\n }\n outputDefined() {\n return true;\n }\n }\n class ae {\n constructor(t4) {\n this.name = \"ExpressionEvaluationError\", this.message = t4;\n }\n toJSON() {\n return this.message;\n }\n }\n const oe = { string: ct, number: ut, boolean: ht, object: ft };\n class le {\n constructor(t4, e2) {\n this.type = t4, this.args = e2;\n }\n static parse(t4, e2) {\n if (t4.length < 2) return e2.error(\"Expected at least one argument.\");\n let r2, n2 = 1;\n const i2 = t4[0];\n if (\"array\" === i2) {\n let i3, s3;\n if (t4.length > 2) {\n const r3 = t4[1];\n if (\"string\" != typeof r3 || !(r3 in oe) || \"object\" === r3) return e2.error('The item type argument of \"array\" must be one of string, number, boolean', 1);\n i3 = oe[r3], n2++;\n } else i3 = dt;\n if (t4.length > 3) {\n if (null !== t4[2] && (\"number\" != typeof t4[2] || t4[2] < 0 || t4[2] !== Math.floor(t4[2]))) return e2.error('The length argument to \"array\" must be a positive integer literal', 2);\n s3 = t4[2], n2++;\n }\n r2 = bt(i3, s3);\n } else {\n if (!oe[i2]) throw new Error(`Types doesn't contain name = ${i2}`);\n r2 = oe[i2];\n }\n const s2 = [];\n for (; n2 < t4.length; n2++) {\n const r3 = e2.parse(t4[n2], n2, dt);\n if (!r3) return null;\n s2.push(r3);\n }\n return new le(r2, s2);\n }\n evaluate(t4) {\n for (let e2 = 0; e2 < this.args.length; e2++) {\n const r2 = this.args[e2].evaluate(t4);\n if (!At(this.type, ne(r2))) return r2;\n if (e2 === this.args.length - 1) throw new ae(`Expected value to be of type ${wt(this.type)}, but found ${wt(ne(r2))} instead.`);\n }\n throw new Error();\n }\n eachChild(t4) {\n this.args.forEach(t4);\n }\n outputDefined() {\n return this.args.every((t4) => t4.outputDefined());\n }\n }\n const ue = { \"to-boolean\": ht, \"to-color\": pt, \"to-number\": ut, \"to-string\": ct };\n class ce {\n constructor(t4, e2) {\n this.type = t4, this.args = e2;\n }\n static parse(t4, e2) {\n if (t4.length < 2) return e2.error(\"Expected at least one argument.\");\n const r2 = t4[0];\n if (!ue[r2]) throw new Error(`Can't parse ${r2} as it is not part of the known types`);\n if ((\"to-boolean\" === r2 || \"to-string\" === r2) && 2 !== t4.length) return e2.error(\"Expected one argument.\");\n const n2 = ue[r2], i2 = [];\n for (let r3 = 1; r3 < t4.length; r3++) {\n const n3 = e2.parse(t4[r3], r3, dt);\n if (!n3) return null;\n i2.push(n3);\n }\n return new ce(n2, i2);\n }\n evaluate(t4) {\n switch (this.type.kind) {\n case \"boolean\":\n return Boolean(this.args[0].evaluate(t4));\n case \"color\": {\n let e2, r2;\n for (const n2 of this.args) {\n if (e2 = n2.evaluate(t4), r2 = null, e2 instanceof Kt) return e2;\n if (\"string\" == typeof e2) {\n const r3 = t4.parseColor(e2);\n if (r3) return r3;\n } else if (Array.isArray(e2) && (r2 = e2.length < 3 || e2.length > 4 ? `Invalid rbga value ${JSON.stringify(e2)}: expected an array containing either three or four numeric values.` : ee(e2[0], e2[1], e2[2], e2[3]), !r2)) return new Kt(e2[0] / 255, e2[1] / 255, e2[2] / 255, e2[3]);\n }\n throw new ae(r2 || `Could not parse color from value '${\"string\" == typeof e2 ? e2 : JSON.stringify(e2)}'`);\n }\n case \"padding\": {\n let e2;\n for (const r2 of this.args) {\n e2 = r2.evaluate(t4);\n const n2 = Jt.parse(e2);\n if (n2) return n2;\n }\n throw new ae(`Could not parse padding from value '${\"string\" == typeof e2 ? e2 : JSON.stringify(e2)}'`);\n }\n case \"variableAnchorOffsetCollection\": {\n let e2;\n for (const r2 of this.args) {\n e2 = r2.evaluate(t4);\n const n2 = Qt.parse(e2);\n if (n2) return n2;\n }\n throw new ae(`Could not parse variableAnchorOffsetCollection from value '${\"string\" == typeof e2 ? e2 : JSON.stringify(e2)}'`);\n }\n case \"number\": {\n let e2 = null;\n for (const r2 of this.args) {\n if (e2 = r2.evaluate(t4), null === e2) return 0;\n const n2 = Number(e2);\n if (!isNaN(n2)) return n2;\n }\n throw new ae(`Could not convert ${JSON.stringify(e2)} to number.`);\n }\n case \"formatted\":\n return Yt.fromString(ie(this.args[0].evaluate(t4)));\n case \"resolvedImage\":\n return te.fromString(ie(this.args[0].evaluate(t4)));\n default:\n return ie(this.args[0].evaluate(t4));\n }\n }\n eachChild(t4) {\n this.args.forEach(t4);\n }\n outputDefined() {\n return this.args.every((t4) => t4.outputDefined());\n }\n }\n const he = [\"Unknown\", \"Point\", \"LineString\", \"Polygon\"];\n class pe {\n constructor() {\n this.globals = null, this.feature = null, this.featureState = null, this.formattedSection = null, this._parseColorCache = {}, this.availableImages = null, this.canonical = null;\n }\n id() {\n return this.feature && \"id\" in this.feature ? this.feature.id : null;\n }\n geometryType() {\n return this.feature ? \"number\" == typeof this.feature.type ? he[this.feature.type] : this.feature.type : null;\n }\n geometry() {\n return this.feature && \"geometry\" in this.feature ? this.feature.geometry : null;\n }\n canonicalID() {\n return this.canonical;\n }\n properties() {\n return this.feature && this.feature.properties || {};\n }\n parseColor(t4) {\n let e2 = this._parseColorCache[t4];\n return e2 || (e2 = this._parseColorCache[t4] = Kt.parse(t4)), e2;\n }\n }\n class fe {\n constructor(t4, e2, r2 = [], n2, i2 = new ot(), s2 = []) {\n this.registry = t4, this.path = r2, this.key = r2.map((t5) => `[${t5}]`).join(\"\"), this.scope = i2, this.errors = s2, this.expectedType = n2, this._isConstant = e2;\n }\n parse(t4, e2, r2, n2, i2 = {}) {\n return e2 ? this.concat(e2, r2, n2)._parse(t4, i2) : this._parse(t4, i2);\n }\n _parse(t4, e2) {\n function r2(t5, e3, r3) {\n return \"assert\" === r3 ? new le(e3, [t5]) : \"coerce\" === r3 ? new ce(e3, [t5]) : t5;\n }\n if (null !== t4 && \"string\" != typeof t4 && \"boolean\" != typeof t4 && \"number\" != typeof t4 || (t4 = [\"literal\", t4]), Array.isArray(t4)) {\n if (0 === t4.length) return this.error('Expected an array with at least one element. If you wanted a literal array, use [\"literal\", []].');\n const n2 = t4[0];\n if (\"string\" != typeof n2) return this.error(`Expression name must be a string, but found ${typeof n2} instead. If you wanted a literal array, use [\"literal\", [...]].`, 0), null;\n const i2 = this.registry[n2];\n if (i2) {\n let n3 = i2.parse(t4, this);\n if (!n3) return null;\n if (this.expectedType) {\n const t5 = this.expectedType, i3 = n3.type;\n if (\"string\" !== t5.kind && \"number\" !== t5.kind && \"boolean\" !== t5.kind && \"object\" !== t5.kind && \"array\" !== t5.kind || \"value\" !== i3.kind) if (\"color\" !== t5.kind && \"formatted\" !== t5.kind && \"resolvedImage\" !== t5.kind || \"value\" !== i3.kind && \"string\" !== i3.kind) if (\"padding\" !== t5.kind || \"value\" !== i3.kind && \"number\" !== i3.kind && \"array\" !== i3.kind) if (\"variableAnchorOffsetCollection\" !== t5.kind || \"value\" !== i3.kind && \"array\" !== i3.kind) {\n if (this.checkSubtype(t5, i3)) return null;\n } else n3 = r2(n3, t5, e2.typeAnnotation || \"coerce\");\n else n3 = r2(n3, t5, e2.typeAnnotation || \"coerce\");\n else n3 = r2(n3, t5, e2.typeAnnotation || \"coerce\");\n else n3 = r2(n3, t5, e2.typeAnnotation || \"assert\");\n }\n if (!(n3 instanceof se) && \"resolvedImage\" !== n3.type.kind && this._isConstant(n3)) {\n const t5 = new pe();\n try {\n n3 = new se(n3.type, n3.evaluate(t5));\n } catch (t6) {\n return this.error(t6.message), null;\n }\n }\n return n3;\n }\n return this.error(`Unknown expression \"${n2}\". If you wanted a literal array, use [\"literal\", [...]].`, 0);\n }\n return this.error(void 0 === t4 ? \"'undefined' value invalid. Use null instead.\" : \"object\" == typeof t4 ? 'Bare objects invalid. Use [\"literal\", {...}] instead.' : `Expected an array, but found ${typeof t4} instead.`);\n }\n concat(t4, e2, r2) {\n const n2 = \"number\" == typeof t4 ? this.path.concat(t4) : this.path, i2 = r2 ? this.scope.concat(r2) : this.scope;\n return new fe(this.registry, this._isConstant, n2, e2 || null, i2, this.errors);\n }\n error(t4, ...e2) {\n const r2 = `${this.key}${e2.map((t5) => `[${t5}]`).join(\"\")}`;\n this.errors.push(new at(r2, t4));\n }\n checkSubtype(t4, e2) {\n const r2 = At(t4, e2);\n return r2 && this.error(r2), r2;\n }\n }\n class de {\n constructor(t4, e2) {\n this.type = e2.type, this.bindings = [].concat(t4), this.result = e2;\n }\n evaluate(t4) {\n return this.result.evaluate(t4);\n }\n eachChild(t4) {\n for (const e2 of this.bindings) t4(e2[1]);\n t4(this.result);\n }\n static parse(t4, e2) {\n if (t4.length < 4) return e2.error(`Expected at least 3 arguments, but found ${t4.length - 1} instead.`);\n const r2 = [];\n for (let n3 = 1; n3 < t4.length - 1; n3 += 2) {\n const i2 = t4[n3];\n if (\"string\" != typeof i2) return e2.error(`Expected string, but found ${typeof i2} instead.`, n3);\n if (/[^a-zA-Z0-9_]/.test(i2)) return e2.error(\"Variable names must contain only alphanumeric characters or '_'.\", n3);\n const s2 = e2.parse(t4[n3 + 1], n3 + 1);\n if (!s2) return null;\n r2.push([i2, s2]);\n }\n const n2 = e2.parse(t4[t4.length - 1], t4.length - 1, e2.expectedType, r2);\n return n2 ? new de(r2, n2) : null;\n }\n outputDefined() {\n return this.result.outputDefined();\n }\n }\n class ye {\n constructor(t4, e2) {\n this.type = e2.type, this.name = t4, this.boundExpression = e2;\n }\n static parse(t4, e2) {\n if (2 !== t4.length || \"string\" != typeof t4[1]) return e2.error(\"'var' expression requires exactly one string literal argument.\");\n const r2 = t4[1];\n return e2.scope.has(r2) ? new ye(r2, e2.scope.get(r2)) : e2.error(`Unknown variable \"${r2}\". Make sure \"${r2}\" has been bound in an enclosing \"let\" expression before using it.`, 1);\n }\n evaluate(t4) {\n return this.boundExpression.evaluate(t4);\n }\n eachChild() {\n }\n outputDefined() {\n return false;\n }\n }\n class me {\n constructor(t4, e2, r2) {\n this.type = t4, this.index = e2, this.input = r2;\n }\n static parse(t4, e2) {\n if (3 !== t4.length) return e2.error(`Expected 2 arguments, but found ${t4.length - 1} instead.`);\n const r2 = e2.parse(t4[1], 1, ut), n2 = e2.parse(t4[2], 2, bt(e2.expectedType || dt));\n return r2 && n2 ? new me(n2.type.itemType, r2, n2) : null;\n }\n evaluate(t4) {\n const e2 = this.index.evaluate(t4), r2 = this.input.evaluate(t4);\n if (e2 < 0) throw new ae(`Array index out of bounds: ${e2} < 0.`);\n if (e2 >= r2.length) throw new ae(`Array index out of bounds: ${e2} > ${r2.length - 1}.`);\n if (e2 !== Math.floor(e2)) throw new ae(`Array index must be an integer, but found ${e2} instead.`);\n return r2[e2];\n }\n eachChild(t4) {\n t4(this.index), t4(this.input);\n }\n outputDefined() {\n return false;\n }\n }\n class ge {\n constructor(t4, e2) {\n this.type = ht, this.needle = t4, this.haystack = e2;\n }\n static parse(t4, e2) {\n if (3 !== t4.length) return e2.error(`Expected 2 arguments, but found ${t4.length - 1} instead.`);\n const r2 = e2.parse(t4[1], 1, dt), n2 = e2.parse(t4[2], 2, dt);\n return r2 && n2 ? St(r2.type, [ht, ct, ut, lt, dt]) ? new ge(r2, n2) : e2.error(`Expected first argument to be of type boolean, string, number or null, but found ${wt(r2.type)} instead`) : null;\n }\n evaluate(t4) {\n const e2 = this.needle.evaluate(t4), r2 = this.haystack.evaluate(t4);\n if (!r2) return false;\n if (!kt(e2, [\"boolean\", \"string\", \"number\", \"null\"])) throw new ae(`Expected first argument to be of type boolean, string, number or null, but found ${wt(ne(e2))} instead.`);\n if (!kt(r2, [\"string\", \"array\"])) throw new ae(`Expected second argument to be of type array or string, but found ${wt(ne(r2))} instead.`);\n return r2.indexOf(e2) >= 0;\n }\n eachChild(t4) {\n t4(this.needle), t4(this.haystack);\n }\n outputDefined() {\n return true;\n }\n }\n class xe {\n constructor(t4, e2, r2) {\n this.type = ut, this.needle = t4, this.haystack = e2, this.fromIndex = r2;\n }\n static parse(t4, e2) {\n if (t4.length <= 2 || t4.length >= 5) return e2.error(`Expected 3 or 4 arguments, but found ${t4.length - 1} instead.`);\n const r2 = e2.parse(t4[1], 1, dt), n2 = e2.parse(t4[2], 2, dt);\n if (!r2 || !n2) return null;\n if (!St(r2.type, [ht, ct, ut, lt, dt])) return e2.error(`Expected first argument to be of type boolean, string, number or null, but found ${wt(r2.type)} instead`);\n if (4 === t4.length) {\n const i2 = e2.parse(t4[3], 3, ut);\n return i2 ? new xe(r2, n2, i2) : null;\n }\n return new xe(r2, n2);\n }\n evaluate(t4) {\n const e2 = this.needle.evaluate(t4), r2 = this.haystack.evaluate(t4);\n if (!kt(e2, [\"boolean\", \"string\", \"number\", \"null\"])) throw new ae(`Expected first argument to be of type boolean, string, number or null, but found ${wt(ne(e2))} instead.`);\n let n2;\n if (this.fromIndex && (n2 = this.fromIndex.evaluate(t4)), kt(r2, [\"string\"])) {\n const t5 = r2.indexOf(e2, n2);\n return -1 === t5 ? -1 : [...r2.slice(0, t5)].length;\n }\n if (kt(r2, [\"array\"])) return r2.indexOf(e2, n2);\n throw new ae(`Expected second argument to be of type array or string, but found ${wt(ne(r2))} instead.`);\n }\n eachChild(t4) {\n t4(this.needle), t4(this.haystack), this.fromIndex && t4(this.fromIndex);\n }\n outputDefined() {\n return false;\n }\n }\n class ve {\n constructor(t4, e2, r2, n2, i2, s2) {\n this.inputType = t4, this.type = e2, this.input = r2, this.cases = n2, this.outputs = i2, this.otherwise = s2;\n }\n static parse(t4, e2) {\n if (t4.length < 5) return e2.error(`Expected at least 4 arguments, but found only ${t4.length - 1}.`);\n if (t4.length % 2 != 1) return e2.error(\"Expected an even number of arguments.\");\n let r2, n2;\n e2.expectedType && \"value\" !== e2.expectedType.kind && (n2 = e2.expectedType);\n const i2 = {}, s2 = [];\n for (let a3 = 2; a3 < t4.length - 1; a3 += 2) {\n let o3 = t4[a3];\n const l2 = t4[a3 + 1];\n Array.isArray(o3) || (o3 = [o3]);\n const u2 = e2.concat(a3);\n if (0 === o3.length) return u2.error(\"Expected at least one branch label.\");\n for (const t5 of o3) {\n if (\"number\" != typeof t5 && \"string\" != typeof t5) return u2.error(\"Branch labels must be numbers or strings.\");\n if (\"number\" == typeof t5 && Math.abs(t5) > Number.MAX_SAFE_INTEGER) return u2.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);\n if (\"number\" == typeof t5 && Math.floor(t5) !== t5) return u2.error(\"Numeric branch labels must be integer values.\");\n if (r2) {\n if (u2.checkSubtype(r2, ne(t5))) return null;\n } else r2 = ne(t5);\n if (void 0 !== i2[String(t5)]) return u2.error(\"Branch labels must be unique.\");\n i2[String(t5)] = s2.length;\n }\n const c2 = e2.parse(l2, a3, n2);\n if (!c2) return null;\n n2 = n2 || c2.type, s2.push(c2);\n }\n const a2 = e2.parse(t4[1], 1, dt);\n if (!a2) return null;\n const o2 = e2.parse(t4[t4.length - 1], t4.length - 1, n2);\n return o2 ? \"value\" !== a2.type.kind && e2.concat(1).checkSubtype(r2, a2.type) ? null : new ve(r2, n2, a2, i2, s2, o2) : null;\n }\n evaluate(t4) {\n const e2 = this.input.evaluate(t4);\n return (ne(e2) === this.inputType && this.outputs[this.cases[e2]] || this.otherwise).evaluate(t4);\n }\n eachChild(t4) {\n t4(this.input), this.outputs.forEach(t4), t4(this.otherwise);\n }\n outputDefined() {\n return this.outputs.every((t4) => t4.outputDefined()) && this.otherwise.outputDefined();\n }\n }\n class be {\n constructor(t4, e2, r2) {\n this.type = t4, this.branches = e2, this.otherwise = r2;\n }\n static parse(t4, e2) {\n if (t4.length < 4) return e2.error(`Expected at least 3 arguments, but found only ${t4.length - 1}.`);\n if (t4.length % 2 != 0) return e2.error(\"Expected an odd number of arguments.\");\n let r2;\n e2.expectedType && \"value\" !== e2.expectedType.kind && (r2 = e2.expectedType);\n const n2 = [];\n for (let i3 = 1; i3 < t4.length - 1; i3 += 2) {\n const s2 = e2.parse(t4[i3], i3, ht);\n if (!s2) return null;\n const a2 = e2.parse(t4[i3 + 1], i3 + 1, r2);\n if (!a2) return null;\n n2.push([s2, a2]), r2 = r2 || a2.type;\n }\n const i2 = e2.parse(t4[t4.length - 1], t4.length - 1, r2);\n if (!i2) return null;\n if (!r2) throw new Error(\"Can't infer output type\");\n return new be(r2, n2, i2);\n }\n evaluate(t4) {\n for (const [e2, r2] of this.branches) if (e2.evaluate(t4)) return r2.evaluate(t4);\n return this.otherwise.evaluate(t4);\n }\n eachChild(t4) {\n for (const [e2, r2] of this.branches) t4(e2), t4(r2);\n t4(this.otherwise);\n }\n outputDefined() {\n return this.branches.every(([t4, e2]) => e2.outputDefined()) && this.otherwise.outputDefined();\n }\n }\n class we {\n constructor(t4, e2, r2, n2) {\n this.type = t4, this.input = e2, this.beginIndex = r2, this.endIndex = n2;\n }\n static parse(t4, e2) {\n if (t4.length <= 2 || t4.length >= 5) return e2.error(`Expected 3 or 4 arguments, but found ${t4.length - 1} instead.`);\n const r2 = e2.parse(t4[1], 1, dt), n2 = e2.parse(t4[2], 2, ut);\n if (!r2 || !n2) return null;\n if (!St(r2.type, [bt(dt), ct, dt])) return e2.error(`Expected first argument to be of type array or string, but found ${wt(r2.type)} instead`);\n if (4 === t4.length) {\n const i2 = e2.parse(t4[3], 3, ut);\n return i2 ? new we(r2.type, r2, n2, i2) : null;\n }\n return new we(r2.type, r2, n2);\n }\n evaluate(t4) {\n const e2 = this.input.evaluate(t4), r2 = this.beginIndex.evaluate(t4);\n let n2;\n if (this.endIndex && (n2 = this.endIndex.evaluate(t4)), kt(e2, [\"string\"])) return [...e2].slice(r2, n2).join(\"\");\n if (kt(e2, [\"array\"])) return e2.slice(r2, n2);\n throw new ae(`Expected first argument to be of type array or string, but found ${wt(ne(e2))} instead.`);\n }\n eachChild(t4) {\n t4(this.input), t4(this.beginIndex), this.endIndex && t4(this.endIndex);\n }\n outputDefined() {\n return false;\n }\n }\n function _e(t4, e2) {\n const r2 = t4.length - 1;\n let n2, i2, s2 = 0, a2 = r2, o2 = 0;\n for (; s2 <= a2; ) if (o2 = Math.floor((s2 + a2) / 2), n2 = t4[o2], i2 = t4[o2 + 1], n2 <= e2) {\n if (o2 === r2 || e2 < i2) return o2;\n s2 = o2 + 1;\n } else {\n if (!(n2 > e2)) throw new ae(\"Input is not a number.\");\n a2 = o2 - 1;\n }\n return 0;\n }\n class Ae {\n constructor(t4, e2, r2) {\n this.type = t4, this.input = e2, this.labels = [], this.outputs = [];\n for (const [t5, e3] of r2) this.labels.push(t5), this.outputs.push(e3);\n }\n static parse(t4, e2) {\n if (t4.length - 1 < 4) return e2.error(`Expected at least 4 arguments, but found only ${t4.length - 1}.`);\n if ((t4.length - 1) % 2 != 0) return e2.error(\"Expected an even number of arguments.\");\n const r2 = e2.parse(t4[1], 1, ut);\n if (!r2) return null;\n const n2 = [];\n let i2 = null;\n e2.expectedType && \"value\" !== e2.expectedType.kind && (i2 = e2.expectedType);\n for (let r3 = 1; r3 < t4.length; r3 += 2) {\n const s2 = 1 === r3 ? -1 / 0 : t4[r3], a2 = t4[r3 + 1], o2 = r3, l2 = r3 + 1;\n if (\"number\" != typeof s2) return e2.error('Input/output pairs for \"step\" expressions must be defined using literal numeric values (not computed expressions) for the input values.', o2);\n if (n2.length && n2[n2.length - 1][0] >= s2) return e2.error('Input/output pairs for \"step\" expressions must be arranged with input values in strictly ascending order.', o2);\n const u2 = e2.parse(a2, l2, i2);\n if (!u2) return null;\n i2 = i2 || u2.type, n2.push([s2, u2]);\n }\n return new Ae(i2, r2, n2);\n }\n evaluate(t4) {\n const e2 = this.labels, r2 = this.outputs;\n if (1 === e2.length) return r2[0].evaluate(t4);\n const n2 = this.input.evaluate(t4);\n if (n2 <= e2[0]) return r2[0].evaluate(t4);\n const i2 = e2.length;\n return n2 >= e2[i2 - 1] ? r2[i2 - 1].evaluate(t4) : r2[_e(e2, n2)].evaluate(t4);\n }\n eachChild(t4) {\n t4(this.input);\n for (const e2 of this.outputs) t4(e2);\n }\n outputDefined() {\n return this.outputs.every((t4) => t4.outputDefined());\n }\n }\n function Se(t4) {\n return t4 && t4.__esModule && Object.prototype.hasOwnProperty.call(t4, \"default\") ? t4.default : t4;\n }\n var ke = Me;\n function Me(t4, e2, r2, n2) {\n this.cx = 3 * t4, this.bx = 3 * (r2 - t4) - this.cx, this.ax = 1 - this.cx - this.bx, this.cy = 3 * e2, this.by = 3 * (n2 - e2) - this.cy, this.ay = 1 - this.cy - this.by, this.p1x = t4, this.p1y = e2, this.p2x = r2, this.p2y = n2;\n }\n Me.prototype = { sampleCurveX: function(t4) {\n return ((this.ax * t4 + this.bx) * t4 + this.cx) * t4;\n }, sampleCurveY: function(t4) {\n return ((this.ay * t4 + this.by) * t4 + this.cy) * t4;\n }, sampleCurveDerivativeX: function(t4) {\n return (3 * this.ax * t4 + 2 * this.bx) * t4 + this.cx;\n }, solveCurveX: function(t4, e2) {\n if (void 0 === e2 && (e2 = 1e-6), t4 < 0) return 0;\n if (t4 > 1) return 1;\n for (var r2 = t4, n2 = 0; n2 < 8; n2++) {\n var i2 = this.sampleCurveX(r2) - t4;\n if (Math.abs(i2) < e2) return r2;\n var s2 = this.sampleCurveDerivativeX(r2);\n if (Math.abs(s2) < 1e-6) break;\n r2 -= i2 / s2;\n }\n var a2 = 0, o2 = 1;\n for (r2 = t4, n2 = 0; n2 < 20 && (i2 = this.sampleCurveX(r2), !(Math.abs(i2 - t4) < e2)); n2++) t4 > i2 ? a2 = r2 : o2 = r2, r2 = 0.5 * (o2 - a2) + a2;\n return r2;\n }, solve: function(t4, e2) {\n return this.sampleCurveY(this.solveCurveX(t4, e2));\n } };\n var Ie = Se(ke);\n function ze(t4, e2, r2) {\n return t4 + r2 * (e2 - t4);\n }\n function Pe(t4, e2, r2) {\n return t4.map((t5, n2) => ze(t5, e2[n2], r2));\n }\n const Ce = { number: ze, color: function(t4, e2, r2, n2 = \"rgb\") {\n switch (n2) {\n case \"rgb\": {\n const [n3, i2, s2, a2] = Pe(t4.rgb, e2.rgb, r2);\n return new Kt(n3, i2, s2, a2, false);\n }\n case \"hcl\": {\n const [n3, i2, s2, a2] = t4.hcl, [o2, l2, u2, c2] = e2.hcl;\n let h2, p2;\n if (isNaN(n3) || isNaN(o2)) isNaN(n3) ? isNaN(o2) ? h2 = NaN : (h2 = o2, 1 !== s2 && 0 !== s2 || (p2 = l2)) : (h2 = n3, 1 !== u2 && 0 !== u2 || (p2 = i2));\n else {\n let t5 = o2 - n3;\n o2 > n3 && t5 > 180 ? t5 -= 360 : o2 < n3 && n3 - o2 > 180 && (t5 += 360), h2 = n3 + r2 * t5;\n }\n const [f2, d2, y2, m2] = function([t5, e3, r3, n4]) {\n return t5 = isNaN(t5) ? 0 : t5 * Et, Ot([r3, Math.cos(t5) * e3, Math.sin(t5) * e3, n4]);\n }([h2, null != p2 ? p2 : ze(i2, l2, r2), ze(s2, u2, r2), ze(a2, c2, r2)]);\n return new Kt(f2, d2, y2, m2, false);\n }\n case \"lab\": {\n const [n3, i2, s2, a2] = Ot(Pe(t4.lab, e2.lab, r2));\n return new Kt(n3, i2, s2, a2, false);\n }\n }\n }, array: Pe, padding: function(t4, e2, r2) {\n return new Jt(Pe(t4.values, e2.values, r2));\n }, variableAnchorOffsetCollection: function(t4, e2, r2) {\n const n2 = t4.values, i2 = e2.values;\n if (n2.length !== i2.length) throw new ae(`Cannot interpolate values of different length. from: ${t4.toString()}, to: ${e2.toString()}`);\n const s2 = [];\n for (let t5 = 0; t5 < n2.length; t5 += 2) {\n if (n2[t5] !== i2[t5]) throw new ae(`Cannot interpolate values containing mismatched anchors. from[${t5}]: ${n2[t5]}, to[${t5}]: ${i2[t5]}`);\n s2.push(n2[t5]);\n const [e3, a2] = n2[t5 + 1], [o2, l2] = i2[t5 + 1];\n s2.push([ze(e3, o2, r2), ze(a2, l2, r2)]);\n }\n return new Qt(s2);\n } };\n class Be {\n constructor(t4, e2, r2, n2, i2) {\n this.type = t4, this.operator = e2, this.interpolation = r2, this.input = n2, this.labels = [], this.outputs = [];\n for (const [t5, e3] of i2) this.labels.push(t5), this.outputs.push(e3);\n }\n static interpolationFactor(t4, e2, r2, n2) {\n let i2 = 0;\n if (\"exponential\" === t4.name) i2 = Ve(e2, t4.base, r2, n2);\n else if (\"linear\" === t4.name) i2 = Ve(e2, 1, r2, n2);\n else if (\"cubic-bezier\" === t4.name) {\n const s2 = t4.controlPoints;\n i2 = new Ie(s2[0], s2[1], s2[2], s2[3]).solve(Ve(e2, 1, r2, n2));\n }\n return i2;\n }\n static parse(t4, e2) {\n let [r2, n2, i2, ...s2] = t4;\n if (!Array.isArray(n2) || 0 === n2.length) return e2.error(\"Expected an interpolation type expression.\", 1);\n if (\"linear\" === n2[0]) n2 = { name: \"linear\" };\n else if (\"exponential\" === n2[0]) {\n const t5 = n2[1];\n if (\"number\" != typeof t5) return e2.error(\"Exponential interpolation requires a numeric base.\", 1, 1);\n n2 = { name: \"exponential\", base: t5 };\n } else {\n if (\"cubic-bezier\" !== n2[0]) return e2.error(`Unknown interpolation type ${String(n2[0])}`, 1, 0);\n {\n const t5 = n2.slice(1);\n if (4 !== t5.length || t5.some((t6) => \"number\" != typeof t6 || t6 < 0 || t6 > 1)) return e2.error(\"Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.\", 1);\n n2 = { name: \"cubic-bezier\", controlPoints: t5 };\n }\n }\n if (t4.length - 1 < 4) return e2.error(`Expected at least 4 arguments, but found only ${t4.length - 1}.`);\n if ((t4.length - 1) % 2 != 0) return e2.error(\"Expected an even number of arguments.\");\n if (i2 = e2.parse(i2, 2, ut), !i2) return null;\n const a2 = [];\n let o2 = null;\n \"interpolate-hcl\" === r2 || \"interpolate-lab\" === r2 ? o2 = pt : e2.expectedType && \"value\" !== e2.expectedType.kind && (o2 = e2.expectedType);\n for (let t5 = 0; t5 < s2.length; t5 += 2) {\n const r3 = s2[t5], n3 = s2[t5 + 1], i3 = t5 + 3, l2 = t5 + 4;\n if (\"number\" != typeof r3) return e2.error('Input/output pairs for \"interpolate\" expressions must be defined using literal numeric values (not computed expressions) for the input values.', i3);\n if (a2.length && a2[a2.length - 1][0] >= r3) return e2.error('Input/output pairs for \"interpolate\" expressions must be arranged with input values in strictly ascending order.', i3);\n const u2 = e2.parse(n3, l2, o2);\n if (!u2) return null;\n o2 = o2 || u2.type, a2.push([r3, u2]);\n }\n return Mt(o2, ut) || Mt(o2, pt) || Mt(o2, gt) || Mt(o2, vt) || Mt(o2, bt(ut)) ? new Be(o2, r2, n2, i2, a2) : e2.error(`Type ${wt(o2)} is not interpolatable.`);\n }\n evaluate(t4) {\n const e2 = this.labels, r2 = this.outputs;\n if (1 === e2.length) return r2[0].evaluate(t4);\n const n2 = this.input.evaluate(t4);\n if (n2 <= e2[0]) return r2[0].evaluate(t4);\n const i2 = e2.length;\n if (n2 >= e2[i2 - 1]) return r2[i2 - 1].evaluate(t4);\n const s2 = _e(e2, n2), a2 = Be.interpolationFactor(this.interpolation, n2, e2[s2], e2[s2 + 1]), o2 = r2[s2].evaluate(t4), l2 = r2[s2 + 1].evaluate(t4);\n switch (this.operator) {\n case \"interpolate\":\n return Ce[this.type.kind](o2, l2, a2);\n case \"interpolate-hcl\":\n return Ce.color(o2, l2, a2, \"hcl\");\n case \"interpolate-lab\":\n return Ce.color(o2, l2, a2, \"lab\");\n }\n }\n eachChild(t4) {\n t4(this.input);\n for (const e2 of this.outputs) t4(e2);\n }\n outputDefined() {\n return this.outputs.every((t4) => t4.outputDefined());\n }\n }\n function Ve(t4, e2, r2, n2) {\n const i2 = n2 - r2, s2 = t4 - r2;\n return 0 === i2 ? 0 : 1 === e2 ? s2 / i2 : (Math.pow(e2, s2) - 1) / (Math.pow(e2, i2) - 1);\n }\n class Ee {\n constructor(t4, e2) {\n this.type = t4, this.args = e2;\n }\n static parse(t4, e2) {\n if (t4.length < 2) return e2.error(\"Expectected at least one argument.\");\n let r2 = null;\n const n2 = e2.expectedType;\n n2 && \"value\" !== n2.kind && (r2 = n2);\n const i2 = [];\n for (const n3 of t4.slice(1)) {\n const t5 = e2.parse(n3, 1 + i2.length, r2, void 0, { typeAnnotation: \"omit\" });\n if (!t5) return null;\n r2 = r2 || t5.type, i2.push(t5);\n }\n if (!r2) throw new Error(\"No output type\");\n const s2 = n2 && i2.some((t5) => At(n2, t5.type));\n return new Ee(s2 ? dt : r2, i2);\n }\n evaluate(t4) {\n let e2, r2 = null, n2 = 0;\n for (const i2 of this.args) if (n2++, r2 = i2.evaluate(t4), r2 && r2 instanceof te && !r2.available && (e2 || (e2 = r2.name), r2 = null, n2 === this.args.length && (r2 = e2)), null !== r2) break;\n return r2;\n }\n eachChild(t4) {\n this.args.forEach(t4);\n }\n outputDefined() {\n return this.args.every((t4) => t4.outputDefined());\n }\n }\n function Fe(t4, e2) {\n return \"==\" === t4 || \"!=\" === t4 ? \"boolean\" === e2.kind || \"string\" === e2.kind || \"number\" === e2.kind || \"null\" === e2.kind || \"value\" === e2.kind : \"string\" === e2.kind || \"number\" === e2.kind || \"value\" === e2.kind;\n }\n function Te(t4, e2, r2, n2) {\n return 0 === n2.compare(e2, r2);\n }\n function $e(t4, e2, r2) {\n const n2 = \"==\" !== t4 && \"!=\" !== t4;\n return class i2 {\n constructor(t5, e3, r3) {\n this.type = ht, this.lhs = t5, this.rhs = e3, this.collator = r3, this.hasUntypedArgument = \"value\" === t5.type.kind || \"value\" === e3.type.kind;\n }\n static parse(t5, e3) {\n if (3 !== t5.length && 4 !== t5.length) return e3.error(\"Expected two or three arguments.\");\n const r3 = t5[0];\n let s2 = e3.parse(t5[1], 1, dt);\n if (!s2) return null;\n if (!Fe(r3, s2.type)) return e3.concat(1).error(`\"${r3}\" comparisons are not supported for type '${wt(s2.type)}'.`);\n let a2 = e3.parse(t5[2], 2, dt);\n if (!a2) return null;\n if (!Fe(r3, a2.type)) return e3.concat(2).error(`\"${r3}\" comparisons are not supported for type '${wt(a2.type)}'.`);\n if (s2.type.kind !== a2.type.kind && \"value\" !== s2.type.kind && \"value\" !== a2.type.kind) return e3.error(`Cannot compare types '${wt(s2.type)}' and '${wt(a2.type)}'.`);\n n2 && (\"value\" === s2.type.kind && \"value\" !== a2.type.kind ? s2 = new le(a2.type, [s2]) : \"value\" !== s2.type.kind && \"value\" === a2.type.kind && (a2 = new le(s2.type, [a2])));\n let o2 = null;\n if (4 === t5.length) {\n if (\"string\" !== s2.type.kind && \"string\" !== a2.type.kind && \"value\" !== s2.type.kind && \"value\" !== a2.type.kind) return e3.error(\"Cannot use collator to compare non-string types.\");\n if (o2 = e3.parse(t5[3], 3, yt), !o2) return null;\n }\n return new i2(s2, a2, o2);\n }\n evaluate(i3) {\n const s2 = this.lhs.evaluate(i3), a2 = this.rhs.evaluate(i3);\n if (n2 && this.hasUntypedArgument) {\n const e3 = ne(s2), r3 = ne(a2);\n if (e3.kind !== r3.kind || \"string\" !== e3.kind && \"number\" !== e3.kind) throw new ae(`Expected arguments for \"${t4}\" to be (string, string) or (number, number), but found (${e3.kind}, ${r3.kind}) instead.`);\n }\n if (this.collator && !n2 && this.hasUntypedArgument) {\n const t5 = ne(s2), r3 = ne(a2);\n if (\"string\" !== t5.kind || \"string\" !== r3.kind) return e2(i3, s2, a2);\n }\n return this.collator ? r2(i3, s2, a2, this.collator.evaluate(i3)) : e2(i3, s2, a2);\n }\n eachChild(t5) {\n t5(this.lhs), t5(this.rhs), this.collator && t5(this.collator);\n }\n outputDefined() {\n return true;\n }\n };\n }\n const Le = $e(\"==\", function(t4, e2, r2) {\n return e2 === r2;\n }, Te), De = $e(\"!=\", function(t4, e2, r2) {\n return e2 !== r2;\n }, function(t4, e2, r2, n2) {\n return !Te(0, e2, r2, n2);\n }), Oe = $e(\"<\", function(t4, e2, r2) {\n return e2 < r2;\n }, function(t4, e2, r2, n2) {\n return n2.compare(e2, r2) < 0;\n }), je = $e(\">\", function(t4, e2, r2) {\n return e2 > r2;\n }, function(t4, e2, r2, n2) {\n return n2.compare(e2, r2) > 0;\n }), Re = $e(\"<=\", function(t4, e2, r2) {\n return e2 <= r2;\n }, function(t4, e2, r2, n2) {\n return n2.compare(e2, r2) <= 0;\n }), Ue = $e(\">=\", function(t4, e2, r2) {\n return e2 >= r2;\n }, function(t4, e2, r2, n2) {\n return n2.compare(e2, r2) >= 0;\n });\n class qe {\n constructor(t4, e2, r2) {\n this.type = yt, this.locale = r2, this.caseSensitive = t4, this.diacriticSensitive = e2;\n }\n static parse(t4, e2) {\n if (2 !== t4.length) return e2.error(\"Expected one argument.\");\n const r2 = t4[1];\n if (\"object\" != typeof r2 || Array.isArray(r2)) return e2.error(\"Collator options argument must be an object.\");\n const n2 = e2.parse(void 0 !== r2[\"case-sensitive\"] && r2[\"case-sensitive\"], 1, ht);\n if (!n2) return null;\n const i2 = e2.parse(void 0 !== r2[\"diacritic-sensitive\"] && r2[\"diacritic-sensitive\"], 1, ht);\n if (!i2) return null;\n let s2 = null;\n return r2.locale && (s2 = e2.parse(r2.locale, 1, ct), !s2) ? null : new qe(n2, i2, s2);\n }\n evaluate(t4) {\n return new Xt(this.caseSensitive.evaluate(t4), this.diacriticSensitive.evaluate(t4), this.locale ? this.locale.evaluate(t4) : null);\n }\n eachChild(t4) {\n t4(this.caseSensitive), t4(this.diacriticSensitive), this.locale && t4(this.locale);\n }\n outputDefined() {\n return false;\n }\n }\n class Ne {\n constructor(t4, e2, r2, n2, i2) {\n this.type = ct, this.number = t4, this.locale = e2, this.currency = r2, this.minFractionDigits = n2, this.maxFractionDigits = i2;\n }\n static parse(t4, e2) {\n if (3 !== t4.length) return e2.error(\"Expected two arguments.\");\n const r2 = e2.parse(t4[1], 1, ut);\n if (!r2) return null;\n const n2 = t4[2];\n if (\"object\" != typeof n2 || Array.isArray(n2)) return e2.error(\"NumberFormat options argument must be an object.\");\n let i2 = null;\n if (n2.locale && (i2 = e2.parse(n2.locale, 1, ct), !i2)) return null;\n let s2 = null;\n if (n2.currency && (s2 = e2.parse(n2.currency, 1, ct), !s2)) return null;\n let a2 = null;\n if (n2[\"min-fraction-digits\"] && (a2 = e2.parse(n2[\"min-fraction-digits\"], 1, ut), !a2)) return null;\n let o2 = null;\n return n2[\"max-fraction-digits\"] && (o2 = e2.parse(n2[\"max-fraction-digits\"], 1, ut), !o2) ? null : new Ne(r2, i2, s2, a2, o2);\n }\n evaluate(t4) {\n return new Intl.NumberFormat(this.locale ? this.locale.evaluate(t4) : [], { style: this.currency ? \"currency\" : \"decimal\", currency: this.currency ? this.currency.evaluate(t4) : void 0, minimumFractionDigits: this.minFractionDigits ? this.minFractionDigits.evaluate(t4) : void 0, maximumFractionDigits: this.maxFractionDigits ? this.maxFractionDigits.evaluate(t4) : void 0 }).format(this.number.evaluate(t4));\n }\n eachChild(t4) {\n t4(this.number), this.locale && t4(this.locale), this.currency && t4(this.currency), this.minFractionDigits && t4(this.minFractionDigits), this.maxFractionDigits && t4(this.maxFractionDigits);\n }\n outputDefined() {\n return false;\n }\n }\n class Ze {\n constructor(t4) {\n this.type = mt, this.sections = t4;\n }\n static parse(t4, e2) {\n if (t4.length < 2) return e2.error(\"Expected at least one argument.\");\n const r2 = t4[1];\n if (!Array.isArray(r2) && \"object\" == typeof r2) return e2.error(\"First argument must be an image or text section.\");\n const n2 = [];\n let i2 = false;\n for (let r3 = 1; r3 <= t4.length - 1; ++r3) {\n const s2 = t4[r3];\n if (i2 && \"object\" == typeof s2 && !Array.isArray(s2)) {\n i2 = false;\n let t5 = null;\n if (s2[\"font-scale\"] && (t5 = e2.parse(s2[\"font-scale\"], 1, ut), !t5)) return null;\n let r4 = null;\n if (s2[\"text-font\"] && (r4 = e2.parse(s2[\"text-font\"], 1, bt(ct)), !r4)) return null;\n let a2 = null;\n if (s2[\"text-color\"] && (a2 = e2.parse(s2[\"text-color\"], 1, pt), !a2)) return null;\n const o2 = n2[n2.length - 1];\n o2.scale = t5, o2.font = r4, o2.textColor = a2;\n } else {\n const s3 = e2.parse(t4[r3], 1, dt);\n if (!s3) return null;\n const a2 = s3.type.kind;\n if (\"string\" !== a2 && \"value\" !== a2 && \"null\" !== a2 && \"resolvedImage\" !== a2) return e2.error(\"Formatted text type must be 'string', 'value', 'image' or 'null'.\");\n i2 = true, n2.push({ content: s3, scale: null, font: null, textColor: null });\n }\n }\n return new Ze(n2);\n }\n evaluate(t4) {\n return new Yt(this.sections.map((e2) => {\n const r2 = e2.content.evaluate(t4);\n return ne(r2) === xt ? new Ht(\"\", r2, null, null, null) : new Ht(ie(r2), null, e2.scale ? e2.scale.evaluate(t4) : null, e2.font ? e2.font.evaluate(t4).join(\",\") : null, e2.textColor ? e2.textColor.evaluate(t4) : null);\n }));\n }\n eachChild(t4) {\n for (const e2 of this.sections) t4(e2.content), e2.scale && t4(e2.scale), e2.font && t4(e2.font), e2.textColor && t4(e2.textColor);\n }\n outputDefined() {\n return false;\n }\n }\n class Ge {\n constructor(t4) {\n this.type = xt, this.input = t4;\n }\n static parse(t4, e2) {\n if (2 !== t4.length) return e2.error(\"Expected two arguments.\");\n const r2 = e2.parse(t4[1], 1, ct);\n return r2 ? new Ge(r2) : e2.error(\"No image name provided.\");\n }\n evaluate(t4) {\n const e2 = this.input.evaluate(t4), r2 = te.fromString(e2);\n return r2 && t4.availableImages && (r2.available = t4.availableImages.indexOf(e2) > -1), r2;\n }\n eachChild(t4) {\n t4(this.input);\n }\n outputDefined() {\n return false;\n }\n }\n class Ke {\n constructor(t4) {\n this.type = ut, this.input = t4;\n }\n static parse(t4, e2) {\n if (2 !== t4.length) return e2.error(`Expected 1 argument, but found ${t4.length - 1} instead.`);\n const r2 = e2.parse(t4[1], 1);\n return r2 ? \"array\" !== r2.type.kind && \"string\" !== r2.type.kind && \"value\" !== r2.type.kind ? e2.error(`Expected argument of type string or array, but found ${wt(r2.type)} instead.`) : new Ke(r2) : null;\n }\n evaluate(t4) {\n const e2 = this.input.evaluate(t4);\n if (\"string\" == typeof e2) return [...e2].length;\n if (Array.isArray(e2)) return e2.length;\n throw new ae(`Expected value to be of type string or array, but found ${wt(ne(e2))} instead.`);\n }\n eachChild(t4) {\n t4(this.input);\n }\n outputDefined() {\n return false;\n }\n }\n const Xe = 8192;\n function He(t4, e2) {\n const r2 = (180 + t4[0]) / 360, n2 = (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + t4[1] * Math.PI / 360))) / 360, i2 = Math.pow(2, e2.z);\n return [Math.round(r2 * i2 * Xe), Math.round(n2 * i2 * Xe)];\n }\n function Ye(t4, e2) {\n const r2 = Math.pow(2, e2.z);\n return [(i2 = (t4[0] / Xe + e2.x) / r2, 360 * i2 - 180), (n2 = (t4[1] / Xe + e2.y) / r2, 360 / Math.PI * Math.atan(Math.exp((180 - 360 * n2) * Math.PI / 180)) - 90)];\n var n2, i2;\n }\n function Je(t4, e2) {\n t4[0] = Math.min(t4[0], e2[0]), t4[1] = Math.min(t4[1], e2[1]), t4[2] = Math.max(t4[2], e2[0]), t4[3] = Math.max(t4[3], e2[1]);\n }\n function We(t4, e2) {\n return !(t4[0] <= e2[0] || t4[2] >= e2[2] || t4[1] <= e2[1] || t4[3] >= e2[3]);\n }\n function Qe(t4, e2, r2) {\n const n2 = t4[0] - e2[0], i2 = t4[1] - e2[1], s2 = t4[0] - r2[0], a2 = t4[1] - r2[1];\n return n2 * a2 - s2 * i2 == 0 && n2 * s2 <= 0 && i2 * a2 <= 0;\n }\n function tr(t4, e2, r2, n2) {\n return 0 != (i2 = [n2[0] - r2[0], n2[1] - r2[1]])[0] * (s2 = [e2[0] - t4[0], e2[1] - t4[1]])[1] - i2[1] * s2[0] && !(!ar(t4, e2, r2, n2) || !ar(r2, n2, t4, e2));\n var i2, s2;\n }\n function er(t4, e2, r2) {\n for (const n2 of r2) for (let r3 = 0; r3 < n2.length - 1; ++r3) if (tr(t4, e2, n2[r3], n2[r3 + 1])) return true;\n return false;\n }\n function rr(t4, e2, r2 = false) {\n let n2 = false;\n for (const o2 of e2) for (let e3 = 0; e3 < o2.length - 1; e3++) {\n if (Qe(t4, o2[e3], o2[e3 + 1])) return r2;\n (s2 = o2[e3])[1] > (i2 = t4)[1] != (a2 = o2[e3 + 1])[1] > i2[1] && i2[0] < (a2[0] - s2[0]) * (i2[1] - s2[1]) / (a2[1] - s2[1]) + s2[0] && (n2 = !n2);\n }\n var i2, s2, a2;\n return n2;\n }\n function nr(t4, e2) {\n for (const r2 of e2) if (rr(t4, r2)) return true;\n return false;\n }\n function ir(t4, e2) {\n for (const r2 of t4) if (!rr(r2, e2)) return false;\n for (let r2 = 0; r2 < t4.length - 1; ++r2) if (er(t4[r2], t4[r2 + 1], e2)) return false;\n return true;\n }\n function sr(t4, e2) {\n for (const r2 of e2) if (ir(t4, r2)) return true;\n return false;\n }\n function ar(t4, e2, r2, n2) {\n const i2 = n2[0] - r2[0], s2 = n2[1] - r2[1], a2 = (t4[0] - r2[0]) * s2 - i2 * (t4[1] - r2[1]), o2 = (e2[0] - r2[0]) * s2 - i2 * (e2[1] - r2[1]);\n return a2 > 0 && o2 < 0 || a2 < 0 && o2 > 0;\n }\n function or(t4, e2, r2) {\n const n2 = [];\n for (let i2 = 0; i2 < t4.length; i2++) {\n const s2 = [];\n for (let n3 = 0; n3 < t4[i2].length; n3++) {\n const a2 = He(t4[i2][n3], r2);\n Je(e2, a2), s2.push(a2);\n }\n n2.push(s2);\n }\n return n2;\n }\n function lr(t4, e2, r2) {\n const n2 = [];\n for (let i2 = 0; i2 < t4.length; i2++) {\n const s2 = or(t4[i2], e2, r2);\n n2.push(s2);\n }\n return n2;\n }\n function ur(t4, e2, r2, n2) {\n if (t4[0] < r2[0] || t4[0] > r2[2]) {\n const e3 = 0.5 * n2;\n let i2 = t4[0] - r2[0] > e3 ? -n2 : r2[0] - t4[0] > e3 ? n2 : 0;\n 0 === i2 && (i2 = t4[0] - r2[2] > e3 ? -n2 : r2[2] - t4[0] > e3 ? n2 : 0), t4[0] += i2;\n }\n Je(e2, t4);\n }\n function cr(t4, e2, r2, n2) {\n const i2 = Math.pow(2, n2.z) * Xe, s2 = [n2.x * Xe, n2.y * Xe], a2 = [];\n for (const n3 of t4) for (const t5 of n3) {\n const n4 = [t5.x + s2[0], t5.y + s2[1]];\n ur(n4, e2, r2, i2), a2.push(n4);\n }\n return a2;\n }\n function hr(t4, e2, r2, n2) {\n const i2 = Math.pow(2, n2.z) * Xe, s2 = [n2.x * Xe, n2.y * Xe], a2 = [];\n for (const r3 of t4) {\n const t5 = [];\n for (const n3 of r3) {\n const r4 = [n3.x + s2[0], n3.y + s2[1]];\n Je(e2, r4), t5.push(r4);\n }\n a2.push(t5);\n }\n if (e2[2] - e2[0] <= i2 / 2) {\n (o2 = e2)[0] = o2[1] = 1 / 0, o2[2] = o2[3] = -1 / 0;\n for (const t5 of a2) for (const n3 of t5) ur(n3, e2, r2, i2);\n }\n var o2;\n return a2;\n }\n class pr {\n constructor(t4, e2) {\n this.type = ht, this.geojson = t4, this.geometries = e2;\n }\n static parse(t4, e2) {\n if (2 !== t4.length) return e2.error(`'within' expression requires exactly one argument, but found ${t4.length - 1} instead.`);\n if (re(t4[1])) {\n const e3 = t4[1];\n if (\"FeatureCollection\" === e3.type) {\n const t5 = [];\n for (const r2 of e3.features) {\n const { type: e4, coordinates: n2 } = r2.geometry;\n \"Polygon\" === e4 && t5.push(n2), \"MultiPolygon\" === e4 && t5.push(...n2);\n }\n if (t5.length) return new pr(e3, { type: \"MultiPolygon\", coordinates: t5 });\n } else if (\"Feature\" === e3.type) {\n const t5 = e3.geometry.type;\n if (\"Polygon\" === t5 || \"MultiPolygon\" === t5) return new pr(e3, e3.geometry);\n } else if (\"Polygon\" === e3.type || \"MultiPolygon\" === e3.type) return new pr(e3, e3);\n }\n return e2.error(\"'within' expression requires valid geojson object that contains polygon geometry type.\");\n }\n evaluate(t4) {\n if (null != t4.geometry() && null != t4.canonicalID()) {\n if (\"Point\" === t4.geometryType()) return function(t5, e2) {\n const r2 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], n2 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], i2 = t5.canonicalID();\n if (\"Polygon\" === e2.type) {\n const s2 = or(e2.coordinates, n2, i2), a2 = cr(t5.geometry(), r2, n2, i2);\n if (!We(r2, n2)) return false;\n for (const t6 of a2) if (!rr(t6, s2)) return false;\n }\n if (\"MultiPolygon\" === e2.type) {\n const s2 = lr(e2.coordinates, n2, i2), a2 = cr(t5.geometry(), r2, n2, i2);\n if (!We(r2, n2)) return false;\n for (const t6 of a2) if (!nr(t6, s2)) return false;\n }\n return true;\n }(t4, this.geometries);\n if (\"LineString\" === t4.geometryType()) return function(t5, e2) {\n const r2 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], n2 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], i2 = t5.canonicalID();\n if (\"Polygon\" === e2.type) {\n const s2 = or(e2.coordinates, n2, i2), a2 = hr(t5.geometry(), r2, n2, i2);\n if (!We(r2, n2)) return false;\n for (const t6 of a2) if (!ir(t6, s2)) return false;\n }\n if (\"MultiPolygon\" === e2.type) {\n const s2 = lr(e2.coordinates, n2, i2), a2 = hr(t5.geometry(), r2, n2, i2);\n if (!We(r2, n2)) return false;\n for (const t6 of a2) if (!sr(t6, s2)) return false;\n }\n return true;\n }(t4, this.geometries);\n }\n return false;\n }\n eachChild() {\n }\n outputDefined() {\n return true;\n }\n }\n let fr = class {\n constructor(t4 = [], e2 = (t5, e3) => t5 < e3 ? -1 : t5 > e3 ? 1 : 0) {\n if (this.data = t4, this.length = this.data.length, this.compare = e2, this.length > 0) for (let t5 = (this.length >> 1) - 1; t5 >= 0; t5--) this._down(t5);\n }\n push(t4) {\n this.data.push(t4), this._up(this.length++);\n }\n pop() {\n if (0 === this.length) return;\n const t4 = this.data[0], e2 = this.data.pop();\n return --this.length > 0 && (this.data[0] = e2, this._down(0)), t4;\n }\n peek() {\n return this.data[0];\n }\n _up(t4) {\n const { data: e2, compare: r2 } = this, n2 = e2[t4];\n for (; t4 > 0; ) {\n const i2 = t4 - 1 >> 1, s2 = e2[i2];\n if (r2(n2, s2) >= 0) break;\n e2[t4] = s2, t4 = i2;\n }\n e2[t4] = n2;\n }\n _down(t4) {\n const { data: e2, compare: r2 } = this, n2 = this.length >> 1, i2 = e2[t4];\n for (; t4 < n2; ) {\n let n3 = 1 + (t4 << 1);\n const s2 = n3 + 1;\n if (s2 < this.length && r2(e2[s2], e2[n3]) < 0 && (n3 = s2), r2(e2[n3], i2) >= 0) break;\n e2[t4] = e2[n3], t4 = n3;\n }\n e2[t4] = i2;\n }\n };\n function dr(t4, e2, r2, n2, i2) {\n yr(t4, e2, r2, n2 || t4.length - 1, i2 || gr);\n }\n function yr(t4, e2, r2, n2, i2) {\n for (; n2 > r2; ) {\n if (n2 - r2 > 600) {\n var s2 = n2 - r2 + 1, a2 = e2 - r2 + 1, o2 = Math.log(s2), l2 = 0.5 * Math.exp(2 * o2 / 3), u2 = 0.5 * Math.sqrt(o2 * l2 * (s2 - l2) / s2) * (a2 - s2 / 2 < 0 ? -1 : 1);\n yr(t4, e2, Math.max(r2, Math.floor(e2 - a2 * l2 / s2 + u2)), Math.min(n2, Math.floor(e2 + (s2 - a2) * l2 / s2 + u2)), i2);\n }\n var c2 = t4[e2], h2 = r2, p2 = n2;\n for (mr(t4, r2, e2), i2(t4[n2], c2) > 0 && mr(t4, r2, n2); h2 < p2; ) {\n for (mr(t4, h2, p2), h2++, p2--; i2(t4[h2], c2) < 0; ) h2++;\n for (; i2(t4[p2], c2) > 0; ) p2--;\n }\n 0 === i2(t4[r2], c2) ? mr(t4, r2, p2) : mr(t4, ++p2, n2), p2 <= e2 && (r2 = p2 + 1), e2 <= p2 && (n2 = p2 - 1);\n }\n }\n function mr(t4, e2, r2) {\n var n2 = t4[e2];\n t4[e2] = t4[r2], t4[r2] = n2;\n }\n function gr(t4, e2) {\n return t4 < e2 ? -1 : t4 > e2 ? 1 : 0;\n }\n function xr(t4, e2) {\n if (t4.length <= 1) return [t4];\n const r2 = [];\n let n2, i2;\n for (const e3 of t4) {\n const t5 = br(e3);\n 0 !== t5 && (e3.area = Math.abs(t5), void 0 === i2 && (i2 = t5 < 0), i2 === t5 < 0 ? (n2 && r2.push(n2), n2 = [e3]) : n2.push(e3));\n }\n if (n2 && r2.push(n2), e2 > 1) for (let t5 = 0; t5 < r2.length; t5++) r2[t5].length <= e2 || (dr(r2[t5], e2, 1, r2[t5].length - 1, vr), r2[t5] = r2[t5].slice(0, e2));\n return r2;\n }\n function vr(t4, e2) {\n return e2.area - t4.area;\n }\n function br(t4) {\n let e2 = 0;\n for (let r2, n2, i2 = 0, s2 = t4.length, a2 = s2 - 1; i2 < s2; a2 = i2++) r2 = t4[i2], n2 = t4[a2], e2 += (n2.x - r2.x) * (r2.y + n2.y);\n return e2;\n }\n const wr = 1 / 298.257223563, _r = wr * (2 - wr), Ar = Math.PI / 180;\n class Sr {\n constructor(t4) {\n const e2 = 6378.137 * Ar * 1e3, r2 = Math.cos(t4 * Ar), n2 = 1 / (1 - _r * (1 - r2 * r2)), i2 = Math.sqrt(n2);\n this.kx = e2 * i2 * r2, this.ky = e2 * i2 * n2 * (1 - _r);\n }\n distance(t4, e2) {\n const r2 = this.wrap(t4[0] - e2[0]) * this.kx, n2 = (t4[1] - e2[1]) * this.ky;\n return Math.sqrt(r2 * r2 + n2 * n2);\n }\n pointOnLine(t4, e2) {\n let r2, n2, i2, s2, a2 = 1 / 0;\n for (let o2 = 0; o2 < t4.length - 1; o2++) {\n let l2 = t4[o2][0], u2 = t4[o2][1], c2 = this.wrap(t4[o2 + 1][0] - l2) * this.kx, h2 = (t4[o2 + 1][1] - u2) * this.ky, p2 = 0;\n 0 === c2 && 0 === h2 || (p2 = (this.wrap(e2[0] - l2) * this.kx * c2 + (e2[1] - u2) * this.ky * h2) / (c2 * c2 + h2 * h2), p2 > 1 ? (l2 = t4[o2 + 1][0], u2 = t4[o2 + 1][1]) : p2 > 0 && (l2 += c2 / this.kx * p2, u2 += h2 / this.ky * p2)), c2 = this.wrap(e2[0] - l2) * this.kx, h2 = (e2[1] - u2) * this.ky;\n const f2 = c2 * c2 + h2 * h2;\n f2 < a2 && (a2 = f2, r2 = l2, n2 = u2, i2 = o2, s2 = p2);\n }\n return { point: [r2, n2], index: i2, t: Math.max(0, Math.min(1, s2)) };\n }\n wrap(t4) {\n for (; t4 < -180; ) t4 += 360;\n for (; t4 > 180; ) t4 -= 360;\n return t4;\n }\n }\n function kr(t4, e2) {\n return e2[0] - t4[0];\n }\n function Mr(t4) {\n return t4[1] - t4[0] + 1;\n }\n function Ir(t4, e2) {\n return t4[1] >= t4[0] && t4[1] < e2;\n }\n function zr(t4, e2) {\n if (t4[0] > t4[1]) return [null, null];\n const r2 = Mr(t4);\n if (e2) {\n if (2 === r2) return [t4, null];\n const e3 = Math.floor(r2 / 2);\n return [[t4[0], t4[0] + e3], [t4[0] + e3, t4[1]]];\n }\n if (1 === r2) return [t4, null];\n const n2 = Math.floor(r2 / 2) - 1;\n return [[t4[0], t4[0] + n2], [t4[0] + n2 + 1, t4[1]]];\n }\n function Pr(t4, e2) {\n if (!Ir(e2, t4.length)) return [1 / 0, 1 / 0, -1 / 0, -1 / 0];\n const r2 = [1 / 0, 1 / 0, -1 / 0, -1 / 0];\n for (let n2 = e2[0]; n2 <= e2[1]; ++n2) Je(r2, t4[n2]);\n return r2;\n }\n function Cr(t4) {\n const e2 = [1 / 0, 1 / 0, -1 / 0, -1 / 0];\n for (const r2 of t4) for (const t5 of r2) Je(e2, t5);\n return e2;\n }\n function Br(t4) {\n return t4[0] !== -1 / 0 && t4[1] !== -1 / 0 && t4[2] !== 1 / 0 && t4[3] !== 1 / 0;\n }\n function Vr(t4, e2, r2) {\n if (!Br(t4) || !Br(e2)) return NaN;\n let n2 = 0, i2 = 0;\n return t4[2] < e2[0] && (n2 = e2[0] - t4[2]), t4[0] > e2[2] && (n2 = t4[0] - e2[2]), t4[1] > e2[3] && (i2 = t4[1] - e2[3]), t4[3] < e2[1] && (i2 = e2[1] - t4[3]), r2.distance([0, 0], [n2, i2]);\n }\n function Er(t4, e2, r2) {\n const n2 = r2.pointOnLine(e2, t4);\n return r2.distance(t4, n2.point);\n }\n function Fr(t4, e2, r2, n2, i2) {\n const s2 = Math.min(Er(t4, [r2, n2], i2), Er(e2, [r2, n2], i2)), a2 = Math.min(Er(r2, [t4, e2], i2), Er(n2, [t4, e2], i2));\n return Math.min(s2, a2);\n }\n function Tr(t4, e2, r2, n2, i2) {\n if (!Ir(e2, t4.length) || !Ir(n2, r2.length)) return 1 / 0;\n let s2 = 1 / 0;\n for (let a2 = e2[0]; a2 < e2[1]; ++a2) {\n const e3 = t4[a2], o2 = t4[a2 + 1];\n for (let t5 = n2[0]; t5 < n2[1]; ++t5) {\n const n3 = r2[t5], a3 = r2[t5 + 1];\n if (tr(e3, o2, n3, a3)) return 0;\n s2 = Math.min(s2, Fr(e3, o2, n3, a3, i2));\n }\n }\n return s2;\n }\n function $r(t4, e2, r2, n2, i2) {\n if (!Ir(e2, t4.length) || !Ir(n2, r2.length)) return NaN;\n let s2 = 1 / 0;\n for (let a2 = e2[0]; a2 <= e2[1]; ++a2) for (let e3 = n2[0]; e3 <= n2[1]; ++e3) if (s2 = Math.min(s2, i2.distance(t4[a2], r2[e3])), 0 === s2) return s2;\n return s2;\n }\n function Lr(t4, e2, r2) {\n if (rr(t4, e2, true)) return 0;\n let n2 = 1 / 0;\n for (const i2 of e2) {\n const e3 = i2[0], s2 = i2[i2.length - 1];\n if (e3 !== s2 && (n2 = Math.min(n2, Er(t4, [s2, e3], r2)), 0 === n2)) return n2;\n const a2 = r2.pointOnLine(i2, t4);\n if (n2 = Math.min(n2, r2.distance(t4, a2.point)), 0 === n2) return n2;\n }\n return n2;\n }\n function Dr(t4, e2, r2, n2) {\n if (!Ir(e2, t4.length)) return NaN;\n for (let n3 = e2[0]; n3 <= e2[1]; ++n3) if (rr(t4[n3], r2, true)) return 0;\n let i2 = 1 / 0;\n for (let s2 = e2[0]; s2 < e2[1]; ++s2) {\n const e3 = t4[s2], a2 = t4[s2 + 1];\n for (const t5 of r2) for (let r3 = 0, s3 = t5.length, o2 = s3 - 1; r3 < s3; o2 = r3++) {\n const s4 = t5[o2], l2 = t5[r3];\n if (tr(e3, a2, s4, l2)) return 0;\n i2 = Math.min(i2, Fr(e3, a2, s4, l2, n2));\n }\n }\n return i2;\n }\n function Or(t4, e2) {\n for (const r2 of t4) for (const t5 of r2) if (rr(t5, e2, true)) return true;\n return false;\n }\n function jr(t4, e2, r2, n2 = 1 / 0) {\n const i2 = Cr(t4), s2 = Cr(e2);\n if (n2 !== 1 / 0 && Vr(i2, s2, r2) >= n2) return n2;\n if (We(i2, s2)) {\n if (Or(t4, e2)) return 0;\n } else if (Or(e2, t4)) return 0;\n let a2 = 1 / 0;\n for (const n3 of t4) for (let t5 = 0, i3 = n3.length, s3 = i3 - 1; t5 < i3; s3 = t5++) {\n const i4 = n3[s3], o2 = n3[t5];\n for (const t6 of e2) for (let e3 = 0, n4 = t6.length, s4 = n4 - 1; e3 < n4; s4 = e3++) {\n const n5 = t6[s4], l2 = t6[e3];\n if (tr(i4, o2, n5, l2)) return 0;\n a2 = Math.min(a2, Fr(i4, o2, n5, l2, r2));\n }\n }\n return a2;\n }\n function Rr(t4, e2, r2, n2, i2, s2) {\n if (!s2) return;\n const a2 = Vr(Pr(n2, s2), i2, r2);\n a2 < e2 && t4.push([a2, s2, [0, 0]]);\n }\n function Ur(t4, e2, r2, n2, i2, s2, a2) {\n if (!s2 || !a2) return;\n const o2 = Vr(Pr(n2, s2), Pr(i2, a2), r2);\n o2 < e2 && t4.push([o2, s2, a2]);\n }\n function qr(t4, e2, r2, n2, i2 = 1 / 0) {\n let s2 = Math.min(n2.distance(t4[0], r2[0][0]), i2);\n if (0 === s2) return s2;\n const a2 = new fr([[0, [0, t4.length - 1], [0, 0]]], kr), o2 = Cr(r2);\n for (; a2.length > 0; ) {\n const i3 = a2.pop();\n if (i3[0] >= s2) continue;\n const l2 = i3[1], u2 = e2 ? 50 : 100;\n if (Mr(l2) <= u2) {\n if (!Ir(l2, t4.length)) return NaN;\n if (e2) {\n const e3 = Dr(t4, l2, r2, n2);\n if (isNaN(e3) || 0 === e3) return e3;\n s2 = Math.min(s2, e3);\n } else for (let e3 = l2[0]; e3 <= l2[1]; ++e3) {\n const i4 = Lr(t4[e3], r2, n2);\n if (s2 = Math.min(s2, i4), 0 === s2) return 0;\n }\n } else {\n const r3 = zr(l2, e2);\n Rr(a2, s2, n2, t4, o2, r3[0]), Rr(a2, s2, n2, t4, o2, r3[1]);\n }\n }\n return s2;\n }\n function Nr(t4, e2, r2, n2, i2, s2 = 1 / 0) {\n let a2 = Math.min(s2, i2.distance(t4[0], r2[0]));\n if (0 === a2) return a2;\n const o2 = new fr([[0, [0, t4.length - 1], [0, r2.length - 1]]], kr);\n for (; o2.length > 0; ) {\n const s3 = o2.pop();\n if (s3[0] >= a2) continue;\n const l2 = s3[1], u2 = s3[2], c2 = e2 ? 50 : 100, h2 = n2 ? 50 : 100;\n if (Mr(l2) <= c2 && Mr(u2) <= h2) {\n if (!Ir(l2, t4.length) && Ir(u2, r2.length)) return NaN;\n let s4;\n if (e2 && n2) s4 = Tr(t4, l2, r2, u2, i2), a2 = Math.min(a2, s4);\n else if (e2 && !n2) {\n const e3 = t4.slice(l2[0], l2[1] + 1);\n for (let t5 = u2[0]; t5 <= u2[1]; ++t5) if (s4 = Er(r2[t5], e3, i2), a2 = Math.min(a2, s4), 0 === a2) return a2;\n } else if (!e2 && n2) {\n const e3 = r2.slice(u2[0], u2[1] + 1);\n for (let r3 = l2[0]; r3 <= l2[1]; ++r3) if (s4 = Er(t4[r3], e3, i2), a2 = Math.min(a2, s4), 0 === a2) return a2;\n } else s4 = $r(t4, l2, r2, u2, i2), a2 = Math.min(a2, s4);\n } else {\n const s4 = zr(l2, e2), c3 = zr(u2, n2);\n Ur(o2, a2, i2, t4, r2, s4[0], c3[0]), Ur(o2, a2, i2, t4, r2, s4[0], c3[1]), Ur(o2, a2, i2, t4, r2, s4[1], c3[0]), Ur(o2, a2, i2, t4, r2, s4[1], c3[1]);\n }\n }\n return a2;\n }\n function Zr(t4) {\n return \"MultiPolygon\" === t4.type ? t4.coordinates.map((t5) => ({ type: \"Polygon\", coordinates: t5 })) : \"MultiLineString\" === t4.type ? t4.coordinates.map((t5) => ({ type: \"LineString\", coordinates: t5 })) : \"MultiPoint\" === t4.type ? t4.coordinates.map((t5) => ({ type: \"Point\", coordinates: t5 })) : [t4];\n }\n class Gr {\n constructor(t4, e2) {\n this.type = ut, this.geojson = t4, this.geometries = e2;\n }\n static parse(t4, e2) {\n if (2 !== t4.length) return e2.error(`'distance' expression requires exactly one argument, but found ${t4.length - 1} instead.`);\n if (re(t4[1])) {\n const e3 = t4[1];\n if (\"FeatureCollection\" === e3.type) return new Gr(e3, e3.features.map((t5) => Zr(t5.geometry)).flat());\n if (\"Feature\" === e3.type) return new Gr(e3, Zr(e3.geometry));\n if (\"type\" in e3 && \"coordinates\" in e3) return new Gr(e3, Zr(e3));\n }\n return e2.error(\"'distance' expression requires valid geojson object that contains polygon geometry type.\");\n }\n evaluate(t4) {\n if (null != t4.geometry() && null != t4.canonicalID()) {\n if (\"Point\" === t4.geometryType()) return function(t5, e2) {\n const r2 = t5.geometry(), n2 = r2.flat().map((e3) => Ye([e3.x, e3.y], t5.canonical));\n if (0 === r2.length) return NaN;\n const i2 = new Sr(n2[0][1]);\n let s2 = 1 / 0;\n for (const t6 of e2) {\n switch (t6.type) {\n case \"Point\":\n s2 = Math.min(s2, Nr(n2, false, [t6.coordinates], false, i2, s2));\n break;\n case \"LineString\":\n s2 = Math.min(s2, Nr(n2, false, t6.coordinates, true, i2, s2));\n break;\n case \"Polygon\":\n s2 = Math.min(s2, qr(n2, false, t6.coordinates, i2, s2));\n }\n if (0 === s2) return s2;\n }\n return s2;\n }(t4, this.geometries);\n if (\"LineString\" === t4.geometryType()) return function(t5, e2) {\n const r2 = t5.geometry(), n2 = r2.flat().map((e3) => Ye([e3.x, e3.y], t5.canonical));\n if (0 === r2.length) return NaN;\n const i2 = new Sr(n2[0][1]);\n let s2 = 1 / 0;\n for (const t6 of e2) {\n switch (t6.type) {\n case \"Point\":\n s2 = Math.min(s2, Nr(n2, true, [t6.coordinates], false, i2, s2));\n break;\n case \"LineString\":\n s2 = Math.min(s2, Nr(n2, true, t6.coordinates, true, i2, s2));\n break;\n case \"Polygon\":\n s2 = Math.min(s2, qr(n2, true, t6.coordinates, i2, s2));\n }\n if (0 === s2) return s2;\n }\n return s2;\n }(t4, this.geometries);\n if (\"Polygon\" === t4.geometryType()) return function(t5, e2) {\n const r2 = t5.geometry();\n if (0 === r2.length || 0 === r2[0].length) return NaN;\n const n2 = xr(r2, 0).map((e3) => e3.map((e4) => e4.map((e5) => Ye([e5.x, e5.y], t5.canonical)))), i2 = new Sr(n2[0][0][0][1]);\n let s2 = 1 / 0;\n for (const t6 of e2) for (const e3 of n2) {\n switch (t6.type) {\n case \"Point\":\n s2 = Math.min(s2, qr([t6.coordinates], false, e3, i2, s2));\n break;\n case \"LineString\":\n s2 = Math.min(s2, qr(t6.coordinates, true, e3, i2, s2));\n break;\n case \"Polygon\":\n s2 = Math.min(s2, jr(e3, t6.coordinates, i2, s2));\n }\n if (0 === s2) return s2;\n }\n return s2;\n }(t4, this.geometries);\n }\n return NaN;\n }\n eachChild() {\n }\n outputDefined() {\n return true;\n }\n }\n const Kr = { \"==\": Le, \"!=\": De, \">\": je, \"<\": Oe, \">=\": Ue, \"<=\": Re, array: le, at: me, boolean: le, case: be, coalesce: Ee, collator: qe, format: Ze, image: Ge, in: ge, \"index-of\": xe, interpolate: Be, \"interpolate-hcl\": Be, \"interpolate-lab\": Be, length: Ke, let: de, literal: se, match: ve, number: le, \"number-format\": Ne, object: le, slice: we, step: Ae, string: le, \"to-boolean\": ce, \"to-color\": ce, \"to-number\": ce, \"to-string\": ce, var: ye, within: pr, distance: Gr };\n class Xr {\n constructor(t4, e2, r2, n2) {\n this.name = t4, this.type = e2, this._evaluate = r2, this.args = n2;\n }\n evaluate(t4) {\n return this._evaluate(t4, this.args);\n }\n eachChild(t4) {\n this.args.forEach(t4);\n }\n outputDefined() {\n return false;\n }\n static parse(t4, e2) {\n const r2 = t4[0], n2 = Xr.definitions[r2];\n if (!n2) return e2.error(`Unknown expression \"${r2}\". If you wanted a literal array, use [\"literal\", [...]].`, 0);\n const i2 = Array.isArray(n2) ? n2[0] : n2.type, s2 = Array.isArray(n2) ? [[n2[1], n2[2]]] : n2.overloads, a2 = s2.filter(([e3]) => !Array.isArray(e3) || e3.length === t4.length - 1);\n let o2 = null;\n for (const [n3, s3] of a2) {\n o2 = new fe(e2.registry, Qr, e2.path, null, e2.scope);\n const a3 = [];\n let l2 = false;\n for (let e3 = 1; e3 < t4.length; e3++) {\n const r3 = t4[e3], i3 = Array.isArray(n3) ? n3[e3 - 1] : n3.type, s4 = o2.parse(r3, 1 + a3.length, i3);\n if (!s4) {\n l2 = true;\n break;\n }\n a3.push(s4);\n }\n if (!l2) if (Array.isArray(n3) && n3.length !== a3.length) o2.error(`Expected ${n3.length} arguments, but found ${a3.length} instead.`);\n else {\n for (let t5 = 0; t5 < a3.length; t5++) {\n const e3 = Array.isArray(n3) ? n3[t5] : n3.type, r3 = a3[t5];\n o2.concat(t5 + 1).checkSubtype(e3, r3.type);\n }\n if (0 === o2.errors.length) return new Xr(r2, i2, s3, a3);\n }\n }\n if (1 === a2.length) e2.errors.push(...o2.errors);\n else {\n const r3 = (a2.length ? a2 : s2).map(([t5]) => {\n return e3 = t5, Array.isArray(e3) ? `(${e3.map(wt).join(\", \")})` : `(${wt(e3.type)}...)`;\n var e3;\n }).join(\" | \"), n3 = [];\n for (let r4 = 1; r4 < t4.length; r4++) {\n const i3 = e2.parse(t4[r4], 1 + n3.length);\n if (!i3) return null;\n n3.push(wt(i3.type));\n }\n e2.error(`Expected arguments of type ${r3}, but found (${n3.join(\", \")}) instead.`);\n }\n return null;\n }\n static register(t4, e2) {\n Xr.definitions = e2;\n for (const r2 in e2) t4[r2] = Xr;\n }\n }\n function Hr(t4, [e2, r2, n2, i2]) {\n e2 = e2.evaluate(t4), r2 = r2.evaluate(t4), n2 = n2.evaluate(t4);\n const s2 = i2 ? i2.evaluate(t4) : 1, a2 = ee(e2, r2, n2, s2);\n if (a2) throw new ae(a2);\n return new Kt(e2 / 255, r2 / 255, n2 / 255, s2, false);\n }\n function Yr(t4, e2) {\n return t4 in e2;\n }\n function Jr(t4, e2) {\n const r2 = e2[t4];\n return void 0 === r2 ? null : r2;\n }\n function Wr(t4) {\n return { type: t4 };\n }\n function Qr(t4) {\n if (t4 instanceof ye) return Qr(t4.boundExpression);\n if (t4 instanceof Xr && \"error\" === t4.name) return false;\n if (t4 instanceof qe) return false;\n if (t4 instanceof pr) return false;\n if (t4 instanceof Gr) return false;\n const e2 = t4 instanceof ce || t4 instanceof le;\n let r2 = true;\n return t4.eachChild((t5) => {\n r2 = e2 ? r2 && Qr(t5) : r2 && t5 instanceof se;\n }), !!r2 && tn(t4) && rn(t4, [\"zoom\", \"heatmap-density\", \"line-progress\", \"accumulated\", \"is-supported-script\"]);\n }\n function tn(t4) {\n if (t4 instanceof Xr) {\n if (\"get\" === t4.name && 1 === t4.args.length) return false;\n if (\"feature-state\" === t4.name) return false;\n if (\"has\" === t4.name && 1 === t4.args.length) return false;\n if (\"properties\" === t4.name || \"geometry-type\" === t4.name || \"id\" === t4.name) return false;\n if (/^filter-/.test(t4.name)) return false;\n }\n if (t4 instanceof pr) return false;\n if (t4 instanceof Gr) return false;\n let e2 = true;\n return t4.eachChild((t5) => {\n e2 && !tn(t5) && (e2 = false);\n }), e2;\n }\n function en(t4) {\n if (t4 instanceof Xr && \"feature-state\" === t4.name) return false;\n let e2 = true;\n return t4.eachChild((t5) => {\n e2 && !en(t5) && (e2 = false);\n }), e2;\n }\n function rn(t4, e2) {\n if (t4 instanceof Xr && e2.indexOf(t4.name) >= 0) return false;\n let r2 = true;\n return t4.eachChild((t5) => {\n r2 && !rn(t5, e2) && (r2 = false);\n }), r2;\n }\n function nn(t4) {\n return { result: \"success\", value: t4 };\n }\n function sn(t4) {\n return { result: \"error\", value: t4 };\n }\n function an(t4) {\n return \"data-driven\" === t4[\"property-type\"] || \"cross-faded-data-driven\" === t4[\"property-type\"];\n }\n function on(t4) {\n return !!t4.expression && t4.expression.parameters.indexOf(\"zoom\") > -1;\n }\n function ln(t4) {\n return !!t4.expression && t4.expression.interpolated;\n }\n function un(t4) {\n return t4 instanceof Number ? \"number\" : t4 instanceof String ? \"string\" : t4 instanceof Boolean ? \"boolean\" : Array.isArray(t4) ? \"array\" : null === t4 ? \"null\" : typeof t4;\n }\n function cn(t4) {\n return \"object\" == typeof t4 && null !== t4 && !Array.isArray(t4);\n }\n function hn(t4) {\n return t4;\n }\n function pn(t4, e2) {\n const r2 = \"color\" === e2.type, n2 = t4.stops && \"object\" == typeof t4.stops[0][0], i2 = n2 || !(n2 || void 0 !== t4.property), s2 = t4.type || (ln(e2) ? \"exponential\" : \"interval\");\n if (r2 || \"padding\" === e2.type) {\n const n3 = r2 ? Kt.parse : Jt.parse;\n (t4 = st({}, t4)).stops && (t4.stops = t4.stops.map((t5) => [t5[0], n3(t5[1])])), t4.default = n3(t4.default ? t4.default : e2.default);\n }\n if (t4.colorSpace && \"rgb\" !== (a2 = t4.colorSpace) && \"hcl\" !== a2 && \"lab\" !== a2) throw new Error(`Unknown color space: \"${t4.colorSpace}\"`);\n var a2;\n let o2, l2, u2;\n if (\"exponential\" === s2) o2 = mn;\n else if (\"interval\" === s2) o2 = yn;\n else if (\"categorical\" === s2) {\n o2 = dn, l2 = /* @__PURE__ */ Object.create(null);\n for (const e3 of t4.stops) l2[e3[0]] = e3[1];\n u2 = typeof t4.stops[0][0];\n } else {\n if (\"identity\" !== s2) throw new Error(`Unknown function type \"${s2}\"`);\n o2 = gn;\n }\n if (n2) {\n const r3 = {}, n3 = [];\n for (let e3 = 0; e3 < t4.stops.length; e3++) {\n const i4 = t4.stops[e3], s4 = i4[0].zoom;\n void 0 === r3[s4] && (r3[s4] = { zoom: s4, type: t4.type, property: t4.property, default: t4.default, stops: [] }, n3.push(s4)), r3[s4].stops.push([i4[0].value, i4[1]]);\n }\n const i3 = [];\n for (const t5 of n3) i3.push([r3[t5].zoom, pn(r3[t5], e2)]);\n const s3 = { name: \"linear\" };\n return { kind: \"composite\", interpolationType: s3, interpolationFactor: Be.interpolationFactor.bind(void 0, s3), zoomStops: i3.map((t5) => t5[0]), evaluate: ({ zoom: r4 }, n4) => mn({ stops: i3, base: t4.base }, e2, r4).evaluate(r4, n4) };\n }\n if (i2) {\n const r3 = \"exponential\" === s2 ? { name: \"exponential\", base: void 0 !== t4.base ? t4.base : 1 } : null;\n return { kind: \"camera\", interpolationType: r3, interpolationFactor: Be.interpolationFactor.bind(void 0, r3), zoomStops: t4.stops.map((t5) => t5[0]), evaluate: ({ zoom: r4 }) => o2(t4, e2, r4, l2, u2) };\n }\n return { kind: \"source\", evaluate(r3, n3) {\n const i3 = n3 && n3.properties ? n3.properties[t4.property] : void 0;\n return void 0 === i3 ? fn(t4.default, e2.default) : o2(t4, e2, i3, l2, u2);\n } };\n }\n function fn(t4, e2, r2) {\n return void 0 !== t4 ? t4 : void 0 !== e2 ? e2 : void 0 !== r2 ? r2 : void 0;\n }\n function dn(t4, e2, r2, n2, i2) {\n return fn(typeof r2 === i2 ? n2[r2] : void 0, t4.default, e2.default);\n }\n function yn(t4, e2, r2) {\n if (\"number\" !== un(r2)) return fn(t4.default, e2.default);\n const n2 = t4.stops.length;\n if (1 === n2) return t4.stops[0][1];\n if (r2 <= t4.stops[0][0]) return t4.stops[0][1];\n if (r2 >= t4.stops[n2 - 1][0]) return t4.stops[n2 - 1][1];\n const i2 = _e(t4.stops.map((t5) => t5[0]), r2);\n return t4.stops[i2][1];\n }\n function mn(t4, e2, r2) {\n const n2 = void 0 !== t4.base ? t4.base : 1;\n if (\"number\" !== un(r2)) return fn(t4.default, e2.default);\n const i2 = t4.stops.length;\n if (1 === i2) return t4.stops[0][1];\n if (r2 <= t4.stops[0][0]) return t4.stops[0][1];\n if (r2 >= t4.stops[i2 - 1][0]) return t4.stops[i2 - 1][1];\n const s2 = _e(t4.stops.map((t5) => t5[0]), r2), a2 = function(t5, e3, r3, n3) {\n const i3 = n3 - r3, s3 = t5 - r3;\n return 0 === i3 ? 0 : 1 === e3 ? s3 / i3 : (Math.pow(e3, s3) - 1) / (Math.pow(e3, i3) - 1);\n }(r2, n2, t4.stops[s2][0], t4.stops[s2 + 1][0]), o2 = t4.stops[s2][1], l2 = t4.stops[s2 + 1][1], u2 = Ce[e2.type] || hn;\n return \"function\" == typeof o2.evaluate ? { evaluate(...e3) {\n const r3 = o2.evaluate.apply(void 0, e3), n3 = l2.evaluate.apply(void 0, e3);\n if (void 0 !== r3 && void 0 !== n3) return u2(r3, n3, a2, t4.colorSpace);\n } } : u2(o2, l2, a2, t4.colorSpace);\n }\n function gn(t4, e2, r2) {\n switch (e2.type) {\n case \"color\":\n r2 = Kt.parse(r2);\n break;\n case \"formatted\":\n r2 = Yt.fromString(r2.toString());\n break;\n case \"resolvedImage\":\n r2 = te.fromString(r2.toString());\n break;\n case \"padding\":\n r2 = Jt.parse(r2);\n break;\n default:\n un(r2) === e2.type || \"enum\" === e2.type && e2.values[r2] || (r2 = void 0);\n }\n return fn(r2, t4.default, e2.default);\n }\n Xr.register(Kr, { error: [{ kind: \"error\" }, [ct], (t4, [e2]) => {\n throw new ae(e2.evaluate(t4));\n }], typeof: [ct, [dt], (t4, [e2]) => wt(ne(e2.evaluate(t4)))], \"to-rgba\": [bt(ut, 4), [pt], (t4, [e2]) => {\n const [r2, n2, i2, s2] = e2.evaluate(t4).rgb;\n return [255 * r2, 255 * n2, 255 * i2, s2];\n }], rgb: [pt, [ut, ut, ut], Hr], rgba: [pt, [ut, ut, ut, ut], Hr], has: { type: ht, overloads: [[[ct], (t4, [e2]) => Yr(e2.evaluate(t4), t4.properties())], [[ct, ft], (t4, [e2, r2]) => Yr(e2.evaluate(t4), r2.evaluate(t4))]] }, get: { type: dt, overloads: [[[ct], (t4, [e2]) => Jr(e2.evaluate(t4), t4.properties())], [[ct, ft], (t4, [e2, r2]) => Jr(e2.evaluate(t4), r2.evaluate(t4))]] }, \"feature-state\": [dt, [ct], (t4, [e2]) => Jr(e2.evaluate(t4), t4.featureState || {})], properties: [ft, [], (t4) => t4.properties()], \"geometry-type\": [ct, [], (t4) => t4.geometryType()], id: [dt, [], (t4) => t4.id()], zoom: [ut, [], (t4) => t4.globals.zoom], \"heatmap-density\": [ut, [], (t4) => t4.globals.heatmapDensity || 0], \"line-progress\": [ut, [], (t4) => t4.globals.lineProgress || 0], accumulated: [dt, [], (t4) => void 0 === t4.globals.accumulated ? null : t4.globals.accumulated], \"+\": [ut, Wr(ut), (t4, e2) => {\n let r2 = 0;\n for (const n2 of e2) r2 += n2.evaluate(t4);\n return r2;\n }], \"*\": [ut, Wr(ut), (t4, e2) => {\n let r2 = 1;\n for (const n2 of e2) r2 *= n2.evaluate(t4);\n return r2;\n }], \"-\": { type: ut, overloads: [[[ut, ut], (t4, [e2, r2]) => e2.evaluate(t4) - r2.evaluate(t4)], [[ut], (t4, [e2]) => -e2.evaluate(t4)]] }, \"/\": [ut, [ut, ut], (t4, [e2, r2]) => e2.evaluate(t4) / r2.evaluate(t4)], \"%\": [ut, [ut, ut], (t4, [e2, r2]) => e2.evaluate(t4) % r2.evaluate(t4)], ln2: [ut, [], () => Math.LN2], pi: [ut, [], () => Math.PI], e: [ut, [], () => Math.E], \"^\": [ut, [ut, ut], (t4, [e2, r2]) => Math.pow(e2.evaluate(t4), r2.evaluate(t4))], sqrt: [ut, [ut], (t4, [e2]) => Math.sqrt(e2.evaluate(t4))], log10: [ut, [ut], (t4, [e2]) => Math.log(e2.evaluate(t4)) / Math.LN10], ln: [ut, [ut], (t4, [e2]) => Math.log(e2.evaluate(t4))], log2: [ut, [ut], (t4, [e2]) => Math.log(e2.evaluate(t4)) / Math.LN2], sin: [ut, [ut], (t4, [e2]) => Math.sin(e2.evaluate(t4))], cos: [ut, [ut], (t4, [e2]) => Math.cos(e2.evaluate(t4))], tan: [ut, [ut], (t4, [e2]) => Math.tan(e2.evaluate(t4))], asin: [ut, [ut], (t4, [e2]) => Math.asin(e2.evaluate(t4))], acos: [ut, [ut], (t4, [e2]) => Math.acos(e2.evaluate(t4))], atan: [ut, [ut], (t4, [e2]) => Math.atan(e2.evaluate(t4))], min: [ut, Wr(ut), (t4, e2) => Math.min(...e2.map((e3) => e3.evaluate(t4)))], max: [ut, Wr(ut), (t4, e2) => Math.max(...e2.map((e3) => e3.evaluate(t4)))], abs: [ut, [ut], (t4, [e2]) => Math.abs(e2.evaluate(t4))], round: [ut, [ut], (t4, [e2]) => {\n const r2 = e2.evaluate(t4);\n return r2 < 0 ? -Math.round(-r2) : Math.round(r2);\n }], floor: [ut, [ut], (t4, [e2]) => Math.floor(e2.evaluate(t4))], ceil: [ut, [ut], (t4, [e2]) => Math.ceil(e2.evaluate(t4))], \"filter-==\": [ht, [ct, dt], (t4, [e2, r2]) => t4.properties()[e2.value] === r2.value], \"filter-id-==\": [ht, [dt], (t4, [e2]) => t4.id() === e2.value], \"filter-type-==\": [ht, [ct], (t4, [e2]) => t4.geometryType() === e2.value], \"filter-<\": [ht, [ct, dt], (t4, [e2, r2]) => {\n const n2 = t4.properties()[e2.value], i2 = r2.value;\n return typeof n2 == typeof i2 && n2 < i2;\n }], \"filter-id-<\": [ht, [dt], (t4, [e2]) => {\n const r2 = t4.id(), n2 = e2.value;\n return typeof r2 == typeof n2 && r2 < n2;\n }], \"filter->\": [ht, [ct, dt], (t4, [e2, r2]) => {\n const n2 = t4.properties()[e2.value], i2 = r2.value;\n return typeof n2 == typeof i2 && n2 > i2;\n }], \"filter-id->\": [ht, [dt], (t4, [e2]) => {\n const r2 = t4.id(), n2 = e2.value;\n return typeof r2 == typeof n2 && r2 > n2;\n }], \"filter-<=\": [ht, [ct, dt], (t4, [e2, r2]) => {\n const n2 = t4.properties()[e2.value], i2 = r2.value;\n return typeof n2 == typeof i2 && n2 <= i2;\n }], \"filter-id-<=\": [ht, [dt], (t4, [e2]) => {\n const r2 = t4.id(), n2 = e2.value;\n return typeof r2 == typeof n2 && r2 <= n2;\n }], \"filter->=\": [ht, [ct, dt], (t4, [e2, r2]) => {\n const n2 = t4.properties()[e2.value], i2 = r2.value;\n return typeof n2 == typeof i2 && n2 >= i2;\n }], \"filter-id->=\": [ht, [dt], (t4, [e2]) => {\n const r2 = t4.id(), n2 = e2.value;\n return typeof r2 == typeof n2 && r2 >= n2;\n }], \"filter-has\": [ht, [dt], (t4, [e2]) => e2.value in t4.properties()], \"filter-has-id\": [ht, [], (t4) => null !== t4.id() && void 0 !== t4.id()], \"filter-type-in\": [ht, [bt(ct)], (t4, [e2]) => e2.value.indexOf(t4.geometryType()) >= 0], \"filter-id-in\": [ht, [bt(dt)], (t4, [e2]) => e2.value.indexOf(t4.id()) >= 0], \"filter-in-small\": [ht, [ct, bt(dt)], (t4, [e2, r2]) => r2.value.indexOf(t4.properties()[e2.value]) >= 0], \"filter-in-large\": [ht, [ct, bt(dt)], (t4, [e2, r2]) => function(t5, e3, r3, n2) {\n for (; r3 <= n2; ) {\n const i2 = r3 + n2 >> 1;\n if (e3[i2] === t5) return true;\n e3[i2] > t5 ? n2 = i2 - 1 : r3 = i2 + 1;\n }\n return false;\n }(t4.properties()[e2.value], r2.value, 0, r2.value.length - 1)], all: { type: ht, overloads: [[[ht, ht], (t4, [e2, r2]) => e2.evaluate(t4) && r2.evaluate(t4)], [Wr(ht), (t4, e2) => {\n for (const r2 of e2) if (!r2.evaluate(t4)) return false;\n return true;\n }]] }, any: { type: ht, overloads: [[[ht, ht], (t4, [e2, r2]) => e2.evaluate(t4) || r2.evaluate(t4)], [Wr(ht), (t4, e2) => {\n for (const r2 of e2) if (r2.evaluate(t4)) return true;\n return false;\n }]] }, \"!\": [ht, [ht], (t4, [e2]) => !e2.evaluate(t4)], \"is-supported-script\": [ht, [ct], (t4, [e2]) => {\n const r2 = t4.globals && t4.globals.isSupportedScript;\n return !r2 || r2(e2.evaluate(t4));\n }], upcase: [ct, [ct], (t4, [e2]) => e2.evaluate(t4).toUpperCase()], downcase: [ct, [ct], (t4, [e2]) => e2.evaluate(t4).toLowerCase()], concat: [ct, Wr(dt), (t4, e2) => e2.map((e3) => ie(e3.evaluate(t4))).join(\"\")], \"resolved-locale\": [ct, [yt], (t4, [e2]) => e2.evaluate(t4).resolvedLocale()] });\n class xn {\n constructor(t4, e2) {\n var r2;\n this.expression = t4, this._warningHistory = {}, this._evaluator = new pe(), this._defaultValue = e2 ? \"color\" === (r2 = e2).type && cn(r2.default) ? new Kt(0, 0, 0, 0) : \"color\" === r2.type ? Kt.parse(r2.default) || null : \"padding\" === r2.type ? Jt.parse(r2.default) || null : \"variableAnchorOffsetCollection\" === r2.type ? Qt.parse(r2.default) || null : void 0 === r2.default ? null : r2.default : null, this._enumValues = e2 && \"enum\" === e2.type ? e2.values : null;\n }\n evaluateWithoutErrorHandling(t4, e2, r2, n2, i2, s2) {\n return this._evaluator.globals = t4, this._evaluator.feature = e2, this._evaluator.featureState = r2, this._evaluator.canonical = n2, this._evaluator.availableImages = i2 || null, this._evaluator.formattedSection = s2, this.expression.evaluate(this._evaluator);\n }\n evaluate(t4, e2, r2, n2, i2, s2) {\n this._evaluator.globals = t4, this._evaluator.feature = e2 || null, this._evaluator.featureState = r2 || null, this._evaluator.canonical = n2, this._evaluator.availableImages = i2 || null, this._evaluator.formattedSection = s2 || null;\n try {\n const t5 = this.expression.evaluate(this._evaluator);\n if (null == t5 || \"number\" == typeof t5 && t5 != t5) return this._defaultValue;\n if (this._enumValues && !(t5 in this._enumValues)) throw new ae(`Expected value to be one of ${Object.keys(this._enumValues).map((t6) => JSON.stringify(t6)).join(\", \")}, but found ${JSON.stringify(t5)} instead.`);\n return t5;\n } catch (t5) {\n return this._warningHistory[t5.message] || (this._warningHistory[t5.message] = true, \"undefined\" != typeof console && console.warn(t5.message)), this._defaultValue;\n }\n }\n }\n function vn(t4) {\n return Array.isArray(t4) && t4.length > 0 && \"string\" == typeof t4[0] && t4[0] in Kr;\n }\n function bn(t4, e2) {\n const r2 = new fe(Kr, Qr, [], e2 ? function(t5) {\n const e3 = { color: pt, string: ct, number: ut, enum: ct, boolean: ht, formatted: mt, padding: gt, resolvedImage: xt, variableAnchorOffsetCollection: vt };\n return \"array\" === t5.type ? bt(e3[t5.value] || dt, t5.length) : e3[t5.type];\n }(e2) : void 0), n2 = r2.parse(t4, void 0, void 0, void 0, e2 && \"string\" === e2.type ? { typeAnnotation: \"coerce\" } : void 0);\n return n2 ? nn(new xn(n2, e2)) : sn(r2.errors);\n }\n class wn {\n constructor(t4, e2) {\n this.kind = t4, this._styleExpression = e2, this.isStateDependent = \"constant\" !== t4 && !en(e2.expression);\n }\n evaluateWithoutErrorHandling(t4, e2, r2, n2, i2, s2) {\n return this._styleExpression.evaluateWithoutErrorHandling(t4, e2, r2, n2, i2, s2);\n }\n evaluate(t4, e2, r2, n2, i2, s2) {\n return this._styleExpression.evaluate(t4, e2, r2, n2, i2, s2);\n }\n }\n class _n {\n constructor(t4, e2, r2, n2) {\n this.kind = t4, this.zoomStops = r2, this._styleExpression = e2, this.isStateDependent = \"camera\" !== t4 && !en(e2.expression), this.interpolationType = n2;\n }\n evaluateWithoutErrorHandling(t4, e2, r2, n2, i2, s2) {\n return this._styleExpression.evaluateWithoutErrorHandling(t4, e2, r2, n2, i2, s2);\n }\n evaluate(t4, e2, r2, n2, i2, s2) {\n return this._styleExpression.evaluate(t4, e2, r2, n2, i2, s2);\n }\n interpolationFactor(t4, e2, r2) {\n return this.interpolationType ? Be.interpolationFactor(this.interpolationType, t4, e2, r2) : 0;\n }\n }\n function An(t4, e2) {\n const r2 = bn(t4, e2);\n if (\"error\" === r2.result) return r2;\n const n2 = r2.value.expression, i2 = tn(n2);\n if (!i2 && !an(e2)) return sn([new at(\"\", \"data expressions not supported\")]);\n const s2 = rn(n2, [\"zoom\"]);\n if (!s2 && !on(e2)) return sn([new at(\"\", \"zoom expressions not supported\")]);\n const a2 = kn(n2);\n return a2 || s2 ? a2 instanceof at ? sn([a2]) : a2 instanceof Be && !ln(e2) ? sn([new at(\"\", '\"interpolate\" expressions cannot be used with this property')]) : nn(a2 ? new _n(i2 ? \"camera\" : \"composite\", r2.value, a2.labels, a2 instanceof Be ? a2.interpolation : void 0) : new wn(i2 ? \"constant\" : \"source\", r2.value)) : sn([new at(\"\", '\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.')]);\n }\n class Sn {\n constructor(t4, e2) {\n this._parameters = t4, this._specification = e2, st(this, pn(this._parameters, this._specification));\n }\n static deserialize(t4) {\n return new Sn(t4._parameters, t4._specification);\n }\n static serialize(t4) {\n return { _parameters: t4._parameters, _specification: t4._specification };\n }\n }\n function kn(t4) {\n let e2 = null;\n if (t4 instanceof de) e2 = kn(t4.result);\n else if (t4 instanceof Ee) {\n for (const r2 of t4.args) if (e2 = kn(r2), e2) break;\n } else (t4 instanceof Ae || t4 instanceof Be) && t4.input instanceof Xr && \"zoom\" === t4.input.name && (e2 = t4);\n return e2 instanceof at || t4.eachChild((t5) => {\n const r2 = kn(t5);\n r2 instanceof at ? e2 = r2 : !e2 && r2 ? e2 = new at(\"\", '\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.') : e2 && r2 && e2 !== r2 && (e2 = new at(\"\", 'Only one zoom-based \"step\" or \"interpolate\" subexpression may be used in an expression.'));\n }), e2;\n }\n function Mn(t4) {\n if (true === t4 || false === t4) return true;\n if (!Array.isArray(t4) || 0 === t4.length) return false;\n switch (t4[0]) {\n case \"has\":\n return t4.length >= 2 && \"$id\" !== t4[1] && \"$type\" !== t4[1];\n case \"in\":\n return t4.length >= 3 && (\"string\" != typeof t4[1] || Array.isArray(t4[2]));\n case \"!in\":\n case \"!has\":\n case \"none\":\n return false;\n case \"==\":\n case \"!=\":\n case \">\":\n case \">=\":\n case \"<\":\n case \"<=\":\n return 3 !== t4.length || Array.isArray(t4[1]) || Array.isArray(t4[2]);\n case \"any\":\n case \"all\":\n for (const e2 of t4.slice(1)) if (!Mn(e2) && \"boolean\" != typeof e2) return false;\n return true;\n default:\n return true;\n }\n }\n const In = { type: \"boolean\", default: false, transition: false, \"property-type\": \"data-driven\", expression: { interpolated: false, parameters: [\"zoom\", \"feature\"] } };\n function zn(t4) {\n if (null == t4) return { filter: () => true, needGeometry: false };\n Mn(t4) || (t4 = Bn(t4));\n const e2 = bn(t4, In);\n if (\"error\" === e2.result) throw new Error(e2.value.map((t5) => `${t5.key}: ${t5.message}`).join(\", \"));\n return { filter: (t5, r2, n2) => e2.value.evaluate(t5, r2, {}, n2), needGeometry: Cn(t4) };\n }\n function Pn(t4, e2) {\n return t4 < e2 ? -1 : t4 > e2 ? 1 : 0;\n }\n function Cn(t4) {\n if (!Array.isArray(t4)) return false;\n if (\"within\" === t4[0] || \"distance\" === t4[0]) return true;\n for (let e2 = 1; e2 < t4.length; e2++) if (Cn(t4[e2])) return true;\n return false;\n }\n function Bn(t4) {\n if (!t4) return true;\n const e2 = t4[0];\n return t4.length <= 1 ? \"any\" !== e2 : \"==\" === e2 ? Vn(t4[1], t4[2], \"==\") : \"!=\" === e2 ? Tn(Vn(t4[1], t4[2], \"==\")) : \"<\" === e2 || \">\" === e2 || \"<=\" === e2 || \">=\" === e2 ? Vn(t4[1], t4[2], e2) : \"any\" === e2 ? (r2 = t4.slice(1), [\"any\"].concat(r2.map(Bn))) : \"all\" === e2 ? [\"all\"].concat(t4.slice(1).map(Bn)) : \"none\" === e2 ? [\"all\"].concat(t4.slice(1).map(Bn).map(Tn)) : \"in\" === e2 ? En(t4[1], t4.slice(2)) : \"!in\" === e2 ? Tn(En(t4[1], t4.slice(2))) : \"has\" === e2 ? Fn(t4[1]) : \"!has\" !== e2 || Tn(Fn(t4[1]));\n var r2;\n }\n function Vn(t4, e2, r2) {\n switch (t4) {\n case \"$type\":\n return [`filter-type-${r2}`, e2];\n case \"$id\":\n return [`filter-id-${r2}`, e2];\n default:\n return [`filter-${r2}`, t4, e2];\n }\n }\n function En(t4, e2) {\n if (0 === e2.length) return false;\n switch (t4) {\n case \"$type\":\n return [\"filter-type-in\", [\"literal\", e2]];\n case \"$id\":\n return [\"filter-id-in\", [\"literal\", e2]];\n default:\n return e2.length > 200 && !e2.some((t5) => typeof t5 != typeof e2[0]) ? [\"filter-in-large\", t4, [\"literal\", e2.sort(Pn)]] : [\"filter-in-small\", t4, [\"literal\", e2]];\n }\n }\n function Fn(t4) {\n switch (t4) {\n case \"$type\":\n return true;\n case \"$id\":\n return [\"filter-has-id\"];\n default:\n return [\"filter-has\", t4];\n }\n }\n function Tn(t4) {\n return [\"!\", t4];\n }\n function $n(t4) {\n const e2 = typeof t4;\n if (\"number\" === e2 || \"boolean\" === e2 || \"string\" === e2 || null == t4) return JSON.stringify(t4);\n if (Array.isArray(t4)) {\n let e3 = \"[\";\n for (const r3 of t4) e3 += `${$n(r3)},`;\n return `${e3}]`;\n }\n const r2 = Object.keys(t4).sort();\n let n2 = \"{\";\n for (let e3 = 0; e3 < r2.length; e3++) n2 += `${JSON.stringify(r2[e3])}:${$n(t4[r2[e3]])},`;\n return `${n2}}`;\n }\n function Ln(t4) {\n let e2 = \"\";\n for (const r2 of K2) e2 += `/${$n(t4[r2])}`;\n return e2;\n }\n function Dn(t4) {\n const e2 = t4.value;\n return e2 ? [new it(t4.key, e2, \"constants have been deprecated as of v8\")] : [];\n }\n function On(t4) {\n return t4 instanceof Number || t4 instanceof String || t4 instanceof Boolean ? t4.valueOf() : t4;\n }\n function jn(t4) {\n if (Array.isArray(t4)) return t4.map(jn);\n if (t4 instanceof Object && !(t4 instanceof Number || t4 instanceof String || t4 instanceof Boolean)) {\n const e2 = {};\n for (const r2 in t4) e2[r2] = jn(t4[r2]);\n return e2;\n }\n return On(t4);\n }\n function Rn(t4) {\n const e2 = t4.key, r2 = t4.value, n2 = t4.valueSpec || {}, i2 = t4.objectElementValidators || {}, s2 = t4.style, a2 = t4.styleSpec, o2 = t4.validateSpec;\n let l2 = [];\n const u2 = un(r2);\n if (\"object\" !== u2) return [new it(e2, r2, `object expected, ${u2} found`)];\n for (const t5 in r2) {\n const u3 = t5.split(\".\")[0], c2 = n2[u3] || n2[\"*\"];\n let h2;\n if (i2[u3]) h2 = i2[u3];\n else if (n2[u3]) h2 = o2;\n else if (i2[\"*\"]) h2 = i2[\"*\"];\n else {\n if (!n2[\"*\"]) {\n l2.push(new it(e2, r2[t5], `unknown property \"${t5}\"`));\n continue;\n }\n h2 = o2;\n }\n l2 = l2.concat(h2({ key: (e2 ? `${e2}.` : e2) + t5, value: r2[t5], valueSpec: c2, style: s2, styleSpec: a2, object: r2, objectKey: t5, validateSpec: o2 }, r2));\n }\n for (const t5 in n2) i2[t5] || n2[t5].required && void 0 === n2[t5].default && void 0 === r2[t5] && l2.push(new it(e2, r2, `missing required property \"${t5}\"`));\n return l2;\n }\n function Un(t4) {\n const e2 = t4.value, r2 = t4.valueSpec, n2 = t4.style, i2 = t4.styleSpec, s2 = t4.key, a2 = t4.arrayElementValidator || t4.validateSpec;\n if (\"array\" !== un(e2)) return [new it(s2, e2, `array expected, ${un(e2)} found`)];\n if (r2.length && e2.length !== r2.length) return [new it(s2, e2, `array length ${r2.length} expected, length ${e2.length} found`)];\n if (r2[\"min-length\"] && e2.length < r2[\"min-length\"]) return [new it(s2, e2, `array length at least ${r2[\"min-length\"]} expected, length ${e2.length} found`)];\n let o2 = { type: r2.value, values: r2.values };\n i2.$version < 7 && (o2.function = r2.function), \"object\" === un(r2.value) && (o2 = r2.value);\n let l2 = [];\n for (let r3 = 0; r3 < e2.length; r3++) l2 = l2.concat(a2({ array: e2, arrayIndex: r3, value: e2[r3], valueSpec: o2, validateSpec: t4.validateSpec, style: n2, styleSpec: i2, key: `${s2}[${r3}]` }));\n return l2;\n }\n function qn(t4) {\n const e2 = t4.key, r2 = t4.value, n2 = t4.valueSpec;\n let i2 = un(r2);\n return \"number\" === i2 && r2 != r2 && (i2 = \"NaN\"), \"number\" !== i2 ? [new it(e2, r2, `number expected, ${i2} found`)] : \"minimum\" in n2 && r2 < n2.minimum ? [new it(e2, r2, `${r2} is less than the minimum value ${n2.minimum}`)] : \"maximum\" in n2 && r2 > n2.maximum ? [new it(e2, r2, `${r2} is greater than the maximum value ${n2.maximum}`)] : [];\n }\n function Nn(t4) {\n const e2 = t4.valueSpec, r2 = On(t4.value.type);\n let n2, i2, s2, a2 = {};\n const o2 = \"categorical\" !== r2 && void 0 === t4.value.property, l2 = !o2, u2 = \"array\" === un(t4.value.stops) && \"array\" === un(t4.value.stops[0]) && \"object\" === un(t4.value.stops[0][0]), c2 = Rn({ key: t4.key, value: t4.value, valueSpec: t4.styleSpec.function, validateSpec: t4.validateSpec, style: t4.style, styleSpec: t4.styleSpec, objectElementValidators: { stops: function(t5) {\n if (\"identity\" === r2) return [new it(t5.key, t5.value, 'identity function may not have a \"stops\" property')];\n let e3 = [];\n const n3 = t5.value;\n return e3 = e3.concat(Un({ key: t5.key, value: n3, valueSpec: t5.valueSpec, validateSpec: t5.validateSpec, style: t5.style, styleSpec: t5.styleSpec, arrayElementValidator: h2 })), \"array\" === un(n3) && 0 === n3.length && e3.push(new it(t5.key, n3, \"array must have at least one stop\")), e3;\n }, default: function(t5) {\n return t5.validateSpec({ key: t5.key, value: t5.value, valueSpec: e2, validateSpec: t5.validateSpec, style: t5.style, styleSpec: t5.styleSpec });\n } } });\n return \"identity\" === r2 && o2 && c2.push(new it(t4.key, t4.value, 'missing required property \"property\"')), \"identity\" === r2 || t4.value.stops || c2.push(new it(t4.key, t4.value, 'missing required property \"stops\"')), \"exponential\" === r2 && t4.valueSpec.expression && !ln(t4.valueSpec) && c2.push(new it(t4.key, t4.value, \"exponential functions not supported\")), t4.styleSpec.$version >= 8 && (l2 && !an(t4.valueSpec) ? c2.push(new it(t4.key, t4.value, \"property functions not supported\")) : o2 && !on(t4.valueSpec) && c2.push(new it(t4.key, t4.value, \"zoom functions not supported\"))), \"categorical\" !== r2 && !u2 || void 0 !== t4.value.property || c2.push(new it(t4.key, t4.value, '\"property\" property is required')), c2;\n function h2(t5) {\n let r3 = [];\n const n3 = t5.value, o3 = t5.key;\n if (\"array\" !== un(n3)) return [new it(o3, n3, `array expected, ${un(n3)} found`)];\n if (2 !== n3.length) return [new it(o3, n3, `array length 2 expected, length ${n3.length} found`)];\n if (u2) {\n if (\"object\" !== un(n3[0])) return [new it(o3, n3, `object expected, ${un(n3[0])} found`)];\n if (void 0 === n3[0].zoom) return [new it(o3, n3, \"object stop key must have zoom\")];\n if (void 0 === n3[0].value) return [new it(o3, n3, \"object stop key must have value\")];\n if (s2 && s2 > On(n3[0].zoom)) return [new it(o3, n3[0].zoom, \"stop zoom values must appear in ascending order\")];\n On(n3[0].zoom) !== s2 && (s2 = On(n3[0].zoom), i2 = void 0, a2 = {}), r3 = r3.concat(Rn({ key: `${o3}[0]`, value: n3[0], valueSpec: { zoom: {} }, validateSpec: t5.validateSpec, style: t5.style, styleSpec: t5.styleSpec, objectElementValidators: { zoom: qn, value: p2 } }));\n } else r3 = r3.concat(p2({ key: `${o3}[0]`, value: n3[0], valueSpec: {}, validateSpec: t5.validateSpec, style: t5.style, styleSpec: t5.styleSpec }, n3));\n return vn(jn(n3[1])) ? r3.concat([new it(`${o3}[1]`, n3[1], \"expressions are not allowed in function stops.\")]) : r3.concat(t5.validateSpec({ key: `${o3}[1]`, value: n3[1], valueSpec: e2, validateSpec: t5.validateSpec, style: t5.style, styleSpec: t5.styleSpec }));\n }\n function p2(t5, s3) {\n const o3 = un(t5.value), l3 = On(t5.value), u3 = null !== t5.value ? t5.value : s3;\n if (n2) {\n if (o3 !== n2) return [new it(t5.key, u3, `${o3} stop domain type must match previous stop domain type ${n2}`)];\n } else n2 = o3;\n if (\"number\" !== o3 && \"string\" !== o3 && \"boolean\" !== o3) return [new it(t5.key, u3, \"stop domain value must be a number, string, or boolean\")];\n if (\"number\" !== o3 && \"categorical\" !== r2) {\n let n3 = `number expected, ${o3} found`;\n return an(e2) && void 0 === r2 && (n3 += '\\nIf you intended to use a categorical function, specify `\"type\": \"categorical\"`.'), [new it(t5.key, u3, n3)];\n }\n return \"categorical\" !== r2 || \"number\" !== o3 || isFinite(l3) && Math.floor(l3) === l3 ? \"categorical\" !== r2 && \"number\" === o3 && void 0 !== i2 && l3 < i2 ? [new it(t5.key, u3, \"stop domain values must appear in ascending order\")] : (i2 = l3, \"categorical\" === r2 && l3 in a2 ? [new it(t5.key, u3, \"stop domain values must be unique\")] : (a2[l3] = true, [])) : [new it(t5.key, u3, `integer expected, found ${l3}`)];\n }\n }\n function Zn2(t4) {\n const e2 = (\"property\" === t4.expressionContext ? An : bn)(jn(t4.value), t4.valueSpec);\n if (\"error\" === e2.result) return e2.value.map((e3) => new it(`${t4.key}${e3.key}`, t4.value, e3.message));\n const r2 = e2.value.expression || e2.value._styleExpression.expression;\n if (\"property\" === t4.expressionContext && \"text-font\" === t4.propertyKey && !r2.outputDefined()) return [new it(t4.key, t4.value, `Invalid data expression for \"${t4.propertyKey}\". Output values must be contained as literals within the expression.`)];\n if (\"property\" === t4.expressionContext && \"layout\" === t4.propertyType && !en(r2)) return [new it(t4.key, t4.value, '\"feature-state\" data expressions are not supported with layout properties.')];\n if (\"filter\" === t4.expressionContext && !en(r2)) return [new it(t4.key, t4.value, '\"feature-state\" data expressions are not supported with filters.')];\n if (t4.expressionContext && 0 === t4.expressionContext.indexOf(\"cluster\")) {\n if (!rn(r2, [\"zoom\", \"feature-state\"])) return [new it(t4.key, t4.value, '\"zoom\" and \"feature-state\" expressions are not supported with cluster properties.')];\n if (\"cluster-initial\" === t4.expressionContext && !tn(r2)) return [new it(t4.key, t4.value, \"Feature data expressions are not supported with initial expression part of cluster properties.\")];\n }\n return [];\n }\n function Gn(t4) {\n const e2 = t4.key, r2 = t4.value, n2 = t4.valueSpec, i2 = [];\n return Array.isArray(n2.values) ? -1 === n2.values.indexOf(On(r2)) && i2.push(new it(e2, r2, `expected one of [${n2.values.join(\", \")}], ${JSON.stringify(r2)} found`)) : -1 === Object.keys(n2.values).indexOf(On(r2)) && i2.push(new it(e2, r2, `expected one of [${Object.keys(n2.values).join(\", \")}], ${JSON.stringify(r2)} found`)), i2;\n }\n function Kn(t4) {\n return Mn(jn(t4.value)) ? Zn2(st({}, t4, { expressionContext: \"filter\", valueSpec: { value: \"boolean\" } })) : Xn2(t4);\n }\n function Xn2(t4) {\n const e2 = t4.value, r2 = t4.key;\n if (\"array\" !== un(e2)) return [new it(r2, e2, `array expected, ${un(e2)} found`)];\n const n2 = t4.styleSpec;\n let i2, s2 = [];\n if (e2.length < 1) return [new it(r2, e2, \"filter array must have at least 1 element\")];\n switch (s2 = s2.concat(Gn({ key: `${r2}[0]`, value: e2[0], valueSpec: n2.filter_operator, style: t4.style, styleSpec: t4.styleSpec })), On(e2[0])) {\n case \"<\":\n case \"<=\":\n case \">\":\n case \">=\":\n e2.length >= 2 && \"$type\" === On(e2[1]) && s2.push(new it(r2, e2, `\"$type\" cannot be use with operator \"${e2[0]}\"`));\n case \"==\":\n case \"!=\":\n 3 !== e2.length && s2.push(new it(r2, e2, `filter array for operator \"${e2[0]}\" must have 3 elements`));\n case \"in\":\n case \"!in\":\n e2.length >= 2 && (i2 = un(e2[1]), \"string\" !== i2 && s2.push(new it(`${r2}[1]`, e2[1], `string expected, ${i2} found`)));\n for (let a2 = 2; a2 < e2.length; a2++) i2 = un(e2[a2]), \"$type\" === On(e2[1]) ? s2 = s2.concat(Gn({ key: `${r2}[${a2}]`, value: e2[a2], valueSpec: n2.geometry_type, style: t4.style, styleSpec: t4.styleSpec })) : \"string\" !== i2 && \"number\" !== i2 && \"boolean\" !== i2 && s2.push(new it(`${r2}[${a2}]`, e2[a2], `string, number, or boolean expected, ${i2} found`));\n break;\n case \"any\":\n case \"all\":\n case \"none\":\n for (let n3 = 1; n3 < e2.length; n3++) s2 = s2.concat(Xn2({ key: `${r2}[${n3}]`, value: e2[n3], style: t4.style, styleSpec: t4.styleSpec }));\n break;\n case \"has\":\n case \"!has\":\n i2 = un(e2[1]), 2 !== e2.length ? s2.push(new it(r2, e2, `filter array for \"${e2[0]}\" operator must have 2 elements`)) : \"string\" !== i2 && s2.push(new it(`${r2}[1]`, e2[1], `string expected, ${i2} found`));\n }\n return s2;\n }\n function Hn(t4, e2) {\n const r2 = t4.key, n2 = t4.validateSpec, i2 = t4.style, s2 = t4.styleSpec, a2 = t4.value, o2 = t4.objectKey, l2 = s2[`${e2}_${t4.layerType}`];\n if (!l2) return [];\n const u2 = o2.match(/^(.*)-transition$/);\n if (\"paint\" === e2 && u2 && l2[u2[1]] && l2[u2[1]].transition) return n2({ key: r2, value: a2, valueSpec: s2.transition, style: i2, styleSpec: s2 });\n const c2 = t4.valueSpec || l2[o2];\n if (!c2) return [new it(r2, a2, `unknown property \"${o2}\"`)];\n let h2;\n if (\"string\" === un(a2) && an(c2) && !c2.tokens && (h2 = /^{([^}]+)}$/.exec(a2))) return [new it(r2, a2, `\"${o2}\" does not support interpolation syntax\nUse an identity property function instead: \\`{ \"type\": \"identity\", \"property\": ${JSON.stringify(h2[1])} }\\`.`)];\n const p2 = [];\n return \"symbol\" === t4.layerType && (\"text-field\" === o2 && i2 && !i2.glyphs && p2.push(new it(r2, a2, 'use of \"text-field\" requires a style \"glyphs\" property')), \"text-font\" === o2 && cn(jn(a2)) && \"identity\" === On(a2.type) && p2.push(new it(r2, a2, '\"text-font\" does not support identity functions'))), p2.concat(n2({ key: t4.key, value: a2, valueSpec: c2, style: i2, styleSpec: s2, expressionContext: \"property\", propertyType: e2, propertyKey: o2 }));\n }\n function Yn2(t4) {\n return Hn(t4, \"paint\");\n }\n function Jn(t4) {\n return Hn(t4, \"layout\");\n }\n function Wn(t4) {\n let e2 = [];\n const r2 = t4.value, n2 = t4.key, i2 = t4.style, s2 = t4.styleSpec;\n r2.type || r2.ref || e2.push(new it(n2, r2, 'either \"type\" or \"ref\" is required'));\n let a2 = On(r2.type);\n const o2 = On(r2.ref);\n if (r2.id) {\n const s3 = On(r2.id);\n for (let a3 = 0; a3 < t4.arrayIndex; a3++) {\n const t5 = i2.layers[a3];\n On(t5.id) === s3 && e2.push(new it(n2, r2.id, `duplicate layer id \"${r2.id}\", previously used at line ${t5.id.__line__}`));\n }\n }\n if (\"ref\" in r2) {\n let t5;\n [\"type\", \"source\", \"source-layer\", \"filter\", \"layout\"].forEach((t6) => {\n t6 in r2 && e2.push(new it(n2, r2[t6], `\"${t6}\" is prohibited for ref layers`));\n }), i2.layers.forEach((e3) => {\n On(e3.id) === o2 && (t5 = e3);\n }), t5 ? t5.ref ? e2.push(new it(n2, r2.ref, \"ref cannot reference another ref layer\")) : a2 = On(t5.type) : e2.push(new it(n2, r2.ref, `ref layer \"${o2}\" not found`));\n } else if (\"background\" !== a2) if (r2.source) {\n const t5 = i2.sources && i2.sources[r2.source], s3 = t5 && On(t5.type);\n t5 ? \"vector\" === s3 && \"raster\" === a2 ? e2.push(new it(n2, r2.source, `layer \"${r2.id}\" requires a raster source`)) : \"raster-dem\" !== s3 && \"hillshade\" === a2 ? e2.push(new it(n2, r2.source, `layer \"${r2.id}\" requires a raster-dem source`)) : \"raster\" === s3 && \"raster\" !== a2 ? e2.push(new it(n2, r2.source, `layer \"${r2.id}\" requires a vector source`)) : \"vector\" !== s3 || r2[\"source-layer\"] ? \"raster-dem\" === s3 && \"hillshade\" !== a2 ? e2.push(new it(n2, r2.source, \"raster-dem source can only be used with layer type 'hillshade'.\")) : \"line\" !== a2 || !r2.paint || !r2.paint[\"line-gradient\"] || \"geojson\" === s3 && t5.lineMetrics || e2.push(new it(n2, r2, `layer \"${r2.id}\" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)) : e2.push(new it(n2, r2, `layer \"${r2.id}\" must specify a \"source-layer\"`)) : e2.push(new it(n2, r2.source, `source \"${r2.source}\" not found`));\n } else e2.push(new it(n2, r2, 'missing required property \"source\"'));\n return e2 = e2.concat(Rn({ key: n2, value: r2, valueSpec: s2.layer, style: t4.style, styleSpec: t4.styleSpec, validateSpec: t4.validateSpec, objectElementValidators: { \"*\": () => [], type: () => t4.validateSpec({ key: `${n2}.type`, value: r2.type, valueSpec: s2.layer.type, style: t4.style, styleSpec: t4.styleSpec, validateSpec: t4.validateSpec, object: r2, objectKey: \"type\" }), filter: Kn, layout: (t5) => Rn({ layer: r2, key: t5.key, value: t5.value, style: t5.style, styleSpec: t5.styleSpec, validateSpec: t5.validateSpec, objectElementValidators: { \"*\": (t6) => Jn(st({ layerType: a2 }, t6)) } }), paint: (t5) => Rn({ layer: r2, key: t5.key, value: t5.value, style: t5.style, styleSpec: t5.styleSpec, validateSpec: t5.validateSpec, objectElementValidators: { \"*\": (t6) => Yn2(st({ layerType: a2 }, t6)) } }) } })), e2;\n }\n function Qn(t4) {\n const e2 = t4.value, r2 = t4.key, n2 = un(e2);\n return \"string\" !== n2 ? [new it(r2, e2, `string expected, ${n2} found`)] : [];\n }\n const ti = { promoteId: function({ key: t4, value: e2 }) {\n if (\"string\" === un(e2)) return Qn({ key: t4, value: e2 });\n {\n const r2 = [];\n for (const n2 in e2) r2.push(...Qn({ key: `${t4}.${n2}`, value: e2[n2] }));\n return r2;\n }\n } };\n function ei(t4) {\n const e2 = t4.value, r2 = t4.key, n2 = t4.styleSpec, i2 = t4.style, s2 = t4.validateSpec;\n if (!e2.type) return [new it(r2, e2, '\"type\" is required')];\n const a2 = On(e2.type);\n let o2;\n switch (a2) {\n case \"vector\":\n case \"raster\":\n return o2 = Rn({ key: r2, value: e2, valueSpec: n2[`source_${a2.replace(\"-\", \"_\")}`], style: t4.style, styleSpec: n2, objectElementValidators: ti, validateSpec: s2 }), o2;\n case \"raster-dem\":\n return o2 = function(t5) {\n var e3;\n const r3 = null !== (e3 = t5.sourceName) && void 0 !== e3 ? e3 : \"\", n3 = t5.value, i3 = t5.styleSpec, s3 = i3.source_raster_dem, a3 = t5.style;\n let o3 = [];\n const l2 = un(n3);\n if (void 0 === n3) return o3;\n if (\"object\" !== l2) return o3.push(new it(\"source_raster_dem\", n3, `object expected, ${l2} found`)), o3;\n const u2 = \"custom\" === On(n3.encoding), c2 = [\"redFactor\", \"greenFactor\", \"blueFactor\", \"baseShift\"], h2 = t5.value.encoding ? `\"${t5.value.encoding}\"` : \"Default\";\n for (const e4 in n3) !u2 && c2.includes(e4) ? o3.push(new it(e4, n3[e4], `In \"${r3}\": \"${e4}\" is only valid when \"encoding\" is set to \"custom\". ${h2} encoding found`)) : s3[e4] ? o3 = o3.concat(t5.validateSpec({ key: e4, value: n3[e4], valueSpec: s3[e4], validateSpec: t5.validateSpec, style: a3, styleSpec: i3 })) : o3.push(new it(e4, n3[e4], `unknown property \"${e4}\"`));\n return o3;\n }({ sourceName: r2, value: e2, style: t4.style, styleSpec: n2, validateSpec: s2 }), o2;\n case \"geojson\":\n if (o2 = Rn({ key: r2, value: e2, valueSpec: n2.source_geojson, style: i2, styleSpec: n2, validateSpec: s2, objectElementValidators: ti }), e2.cluster) for (const t5 in e2.clusterProperties) {\n const [n3, i3] = e2.clusterProperties[t5], a3 = \"string\" == typeof n3 ? [n3, [\"accumulated\"], [\"get\", t5]] : n3;\n o2.push(...Zn2({ key: `${r2}.${t5}.map`, value: i3, validateSpec: s2, expressionContext: \"cluster-map\" })), o2.push(...Zn2({ key: `${r2}.${t5}.reduce`, value: a3, validateSpec: s2, expressionContext: \"cluster-reduce\" }));\n }\n return o2;\n case \"video\":\n return Rn({ key: r2, value: e2, valueSpec: n2.source_video, style: i2, validateSpec: s2, styleSpec: n2 });\n case \"image\":\n return Rn({ key: r2, value: e2, valueSpec: n2.source_image, style: i2, validateSpec: s2, styleSpec: n2 });\n case \"canvas\":\n return [new it(r2, null, \"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.\", \"source.canvas\")];\n default:\n return Gn({ key: `${r2}.type`, value: e2.type, valueSpec: { values: [\"vector\", \"raster\", \"raster-dem\", \"geojson\", \"video\", \"image\"] }, style: i2, validateSpec: s2, styleSpec: n2 });\n }\n }\n function ri(t4) {\n const e2 = t4.value, r2 = t4.styleSpec, n2 = r2.light, i2 = t4.style;\n let s2 = [];\n const a2 = un(e2);\n if (void 0 === e2) return s2;\n if (\"object\" !== a2) return s2 = s2.concat([new it(\"light\", e2, `object expected, ${a2} found`)]), s2;\n for (const a3 in e2) {\n const o2 = a3.match(/^(.*)-transition$/);\n s2 = s2.concat(o2 && n2[o2[1]] && n2[o2[1]].transition ? t4.validateSpec({ key: a3, value: e2[a3], valueSpec: r2.transition, validateSpec: t4.validateSpec, style: i2, styleSpec: r2 }) : n2[a3] ? t4.validateSpec({ key: a3, value: e2[a3], valueSpec: n2[a3], validateSpec: t4.validateSpec, style: i2, styleSpec: r2 }) : [new it(a3, e2[a3], `unknown property \"${a3}\"`)]);\n }\n return s2;\n }\n function ni(t4) {\n const e2 = t4.value, r2 = t4.styleSpec, n2 = r2.sky, i2 = t4.style, s2 = un(e2);\n if (void 0 === e2) return [];\n if (\"object\" !== s2) return [new it(\"sky\", e2, `object expected, ${s2} found`)];\n let a2 = [];\n for (const s3 in e2) a2 = a2.concat(n2[s3] ? t4.validateSpec({ key: s3, value: e2[s3], valueSpec: n2[s3], style: i2, styleSpec: r2 }) : [new it(s3, e2[s3], `unknown property \"${s3}\"`)]);\n return a2;\n }\n function ii(t4) {\n const e2 = t4.value, r2 = t4.styleSpec, n2 = r2.terrain, i2 = t4.style;\n let s2 = [];\n const a2 = un(e2);\n if (void 0 === e2) return s2;\n if (\"object\" !== a2) return s2 = s2.concat([new it(\"terrain\", e2, `object expected, ${a2} found`)]), s2;\n for (const a3 in e2) s2 = s2.concat(n2[a3] ? t4.validateSpec({ key: a3, value: e2[a3], valueSpec: n2[a3], validateSpec: t4.validateSpec, style: i2, styleSpec: r2 }) : [new it(a3, e2[a3], `unknown property \"${a3}\"`)]);\n return s2;\n }\n function si(t4) {\n let e2 = [];\n const r2 = t4.value, n2 = t4.key;\n if (Array.isArray(r2)) {\n const i2 = [], s2 = [];\n for (const a2 in r2) r2[a2].id && i2.includes(r2[a2].id) && e2.push(new it(n2, r2, `all the sprites' ids must be unique, but ${r2[a2].id} is duplicated`)), i2.push(r2[a2].id), r2[a2].url && s2.includes(r2[a2].url) && e2.push(new it(n2, r2, `all the sprites' URLs must be unique, but ${r2[a2].url} is duplicated`)), s2.push(r2[a2].url), e2 = e2.concat(Rn({ key: `${n2}[${a2}]`, value: r2[a2], valueSpec: { id: { type: \"string\", required: true }, url: { type: \"string\", required: true } }, validateSpec: t4.validateSpec }));\n return e2;\n }\n return Qn({ key: n2, value: r2 });\n }\n const ai = { \"*\": () => [], array: Un, boolean: function(t4) {\n const e2 = t4.value, r2 = t4.key, n2 = un(e2);\n return \"boolean\" !== n2 ? [new it(r2, e2, `boolean expected, ${n2} found`)] : [];\n }, number: qn, color: function(t4) {\n const e2 = t4.key, r2 = t4.value, n2 = un(r2);\n return \"string\" !== n2 ? [new it(e2, r2, `color expected, ${n2} found`)] : Kt.parse(String(r2)) ? [] : [new it(e2, r2, `color expected, \"${r2}\" found`)];\n }, constants: Dn, enum: Gn, filter: Kn, function: Nn, layer: Wn, object: Rn, source: ei, light: ri, sky: ni, terrain: ii, projection: function(t4) {\n const e2 = t4.value, r2 = t4.styleSpec, n2 = r2.projection, i2 = t4.style, s2 = un(e2);\n if (void 0 === e2) return [];\n if (\"object\" !== s2) return [new it(\"projection\", e2, `object expected, ${s2} found`)];\n let a2 = [];\n for (const s3 in e2) a2 = a2.concat(n2[s3] ? t4.validateSpec({ key: s3, value: e2[s3], valueSpec: n2[s3], style: i2, styleSpec: r2 }) : [new it(s3, e2[s3], `unknown property \"${s3}\"`)]);\n return a2;\n }, string: Qn, formatted: function(t4) {\n return 0 === Qn(t4).length ? [] : Zn2(t4);\n }, resolvedImage: function(t4) {\n return 0 === Qn(t4).length ? [] : Zn2(t4);\n }, padding: function(t4) {\n const e2 = t4.key, r2 = t4.value;\n if (\"array\" === un(r2)) {\n if (r2.length < 1 || r2.length > 4) return [new it(e2, r2, `padding requires 1 to 4 values; ${r2.length} values found`)];\n const n2 = { type: \"number\" };\n let i2 = [];\n for (let s2 = 0; s2 < r2.length; s2++) i2 = i2.concat(t4.validateSpec({ key: `${e2}[${s2}]`, value: r2[s2], validateSpec: t4.validateSpec, valueSpec: n2 }));\n return i2;\n }\n return qn({ key: e2, value: r2, valueSpec: {} });\n }, variableAnchorOffsetCollection: function(t4) {\n const e2 = t4.key, r2 = t4.value, n2 = un(r2), i2 = t4.styleSpec;\n if (\"array\" !== n2 || r2.length < 1 || r2.length % 2 != 0) return [new it(e2, r2, \"variableAnchorOffsetCollection requires a non-empty array of even length\")];\n let s2 = [];\n for (let n3 = 0; n3 < r2.length; n3 += 2) s2 = s2.concat(Gn({ key: `${e2}[${n3}]`, value: r2[n3], valueSpec: i2.layout_symbol[\"text-anchor\"] })), s2 = s2.concat(Un({ key: `${e2}[${n3 + 1}]`, value: r2[n3 + 1], valueSpec: { length: 2, value: \"number\" }, validateSpec: t4.validateSpec, style: t4.style, styleSpec: i2 }));\n return s2;\n }, sprite: si };\n function oi(t4) {\n const e2 = t4.value, r2 = t4.valueSpec, n2 = t4.styleSpec;\n return t4.validateSpec = oi, r2.expression && cn(On(e2)) ? Nn(t4) : r2.expression && vn(jn(e2)) ? Zn2(t4) : r2.type && ai[r2.type] ? ai[r2.type](t4) : Rn(st({}, t4, { valueSpec: r2.type ? n2[r2.type] : r2 }));\n }\n function li(t4) {\n const e2 = t4.value, r2 = t4.key, n2 = Qn(t4);\n return n2.length || (-1 === e2.indexOf(\"{fontstack}\") && n2.push(new it(r2, e2, '\"glyphs\" url must include a \"{fontstack}\" token')), -1 === e2.indexOf(\"{range}\") && n2.push(new it(r2, e2, '\"glyphs\" url must include a \"{range}\" token'))), n2;\n }\n function ui(t4, e2 = G) {\n let r2 = [];\n return r2 = r2.concat(oi({ key: \"\", value: t4, valueSpec: e2.$root, styleSpec: e2, style: t4, validateSpec: oi, objectElementValidators: { glyphs: li, \"*\": () => [] } })), t4.constants && (r2 = r2.concat(Dn({ key: \"constants\", value: t4.constants, style: t4, styleSpec: e2, validateSpec: oi }))), hi(r2);\n }\n function ci(t4) {\n return function(e2) {\n return t4(__spreadProps(__spreadValues({}, e2), { validateSpec: oi }));\n };\n }\n function hi(t4) {\n return [].concat(t4).sort((t5, e2) => t5.line - e2.line);\n }\n function pi(t4) {\n return function(...e2) {\n return hi(t4.apply(this, e2));\n };\n }\n ui.source = pi(ci(ei)), ui.sprite = pi(ci(si)), ui.glyphs = pi(ci(li)), ui.light = pi(ci(ri)), ui.sky = pi(ci(ni)), ui.terrain = pi(ci(ii)), ui.layer = pi(ci(Wn)), ui.filter = pi(ci(Kn)), ui.paintProperty = pi(ci(Yn2)), ui.layoutProperty = pi(ci(Jn));\n const fi = ui, di = fi.light, yi = fi.sky, mi = fi.paintProperty, gi = fi.layoutProperty;\n function xi(t4, e2) {\n let r2 = false;\n if (e2 && e2.length) for (const n2 of e2) t4.fire(new N(new Error(n2.message))), r2 = true;\n return r2;\n }\n class vi {\n constructor(t4, e2, r2) {\n const n2 = this.cells = [];\n if (t4 instanceof ArrayBuffer) {\n this.arrayBuffer = t4;\n const i3 = new Int32Array(this.arrayBuffer);\n t4 = i3[0], this.d = (e2 = i3[1]) + 2 * (r2 = i3[2]);\n for (let t5 = 0; t5 < this.d * this.d; t5++) {\n const e3 = i3[3 + t5], r3 = i3[3 + t5 + 1];\n n2.push(e3 === r3 ? null : i3.subarray(e3, r3));\n }\n const s2 = i3[3 + n2.length + 1];\n this.keys = i3.subarray(i3[3 + n2.length], s2), this.bboxes = i3.subarray(s2), this.insert = this._insertReadonly;\n } else {\n this.d = e2 + 2 * r2;\n for (let t5 = 0; t5 < this.d * this.d; t5++) n2.push([]);\n this.keys = [], this.bboxes = [];\n }\n this.n = e2, this.extent = t4, this.padding = r2, this.scale = e2 / t4, this.uid = 0;\n const i2 = r2 / e2 * t4;\n this.min = -i2, this.max = t4 + i2;\n }\n insert(t4, e2, r2, n2, i2) {\n this._forEachCell(e2, r2, n2, i2, this._insertCell, this.uid++, void 0, void 0), this.keys.push(t4), this.bboxes.push(e2), this.bboxes.push(r2), this.bboxes.push(n2), this.bboxes.push(i2);\n }\n _insertReadonly() {\n throw new Error(\"Cannot insert into a GridIndex created from an ArrayBuffer.\");\n }\n _insertCell(t4, e2, r2, n2, i2, s2) {\n this.cells[i2].push(s2);\n }\n query(t4, e2, r2, n2, i2) {\n const s2 = this.min, a2 = this.max;\n if (t4 <= s2 && e2 <= s2 && a2 <= r2 && a2 <= n2 && !i2) return Array.prototype.slice.call(this.keys);\n {\n const s3 = [];\n return this._forEachCell(t4, e2, r2, n2, this._queryCell, s3, {}, i2), s3;\n }\n }\n _queryCell(t4, e2, r2, n2, i2, s2, a2, o2) {\n const l2 = this.cells[i2];\n if (null !== l2) {\n const i3 = this.keys, u2 = this.bboxes;\n for (let c2 = 0; c2 < l2.length; c2++) {\n const h2 = l2[c2];\n if (void 0 === a2[h2]) {\n const l3 = 4 * h2;\n (o2 ? o2(u2[l3 + 0], u2[l3 + 1], u2[l3 + 2], u2[l3 + 3]) : t4 <= u2[l3 + 2] && e2 <= u2[l3 + 3] && r2 >= u2[l3 + 0] && n2 >= u2[l3 + 1]) ? (a2[h2] = true, s2.push(i3[h2])) : a2[h2] = false;\n }\n }\n }\n }\n _forEachCell(t4, e2, r2, n2, i2, s2, a2, o2) {\n const l2 = this._convertToCellCoord(t4), u2 = this._convertToCellCoord(e2), c2 = this._convertToCellCoord(r2), h2 = this._convertToCellCoord(n2);\n for (let p2 = l2; p2 <= c2; p2++) for (let l3 = u2; l3 <= h2; l3++) {\n const u3 = this.d * l3 + p2;\n if ((!o2 || o2(this._convertFromCellCoord(p2), this._convertFromCellCoord(l3), this._convertFromCellCoord(p2 + 1), this._convertFromCellCoord(l3 + 1))) && i2.call(this, t4, e2, r2, n2, u3, s2, a2, o2)) return;\n }\n }\n _convertFromCellCoord(t4) {\n return (t4 - this.padding) / this.scale;\n }\n _convertToCellCoord(t4) {\n return Math.max(0, Math.min(this.d - 1, Math.floor(t4 * this.scale) + this.padding));\n }\n toArrayBuffer() {\n if (this.arrayBuffer) return this.arrayBuffer;\n const t4 = this.cells, e2 = 3 + this.cells.length + 1 + 1;\n let r2 = 0;\n for (let t5 = 0; t5 < this.cells.length; t5++) r2 += this.cells[t5].length;\n const n2 = new Int32Array(e2 + r2 + this.keys.length + this.bboxes.length);\n n2[0] = this.extent, n2[1] = this.n, n2[2] = this.padding;\n let i2 = e2;\n for (let e3 = 0; e3 < t4.length; e3++) {\n const r3 = t4[e3];\n n2[3 + e3] = i2, n2.set(r3, i2), i2 += r3.length;\n }\n return n2[3 + t4.length] = i2, n2.set(this.keys, i2), i2 += this.keys.length, n2[3 + t4.length + 1] = i2, n2.set(this.bboxes, i2), i2 += this.bboxes.length, n2.buffer;\n }\n static serialize(t4, e2) {\n const r2 = t4.toArrayBuffer();\n return e2 && e2.push(r2), { buffer: r2 };\n }\n static deserialize(t4) {\n return new vi(t4.buffer);\n }\n }\n const bi = {};\n function wi(t4, e2, r2 = {}) {\n if (bi[t4]) throw new Error(`${t4} is already registered.`);\n Object.defineProperty(e2, \"_classRegistryKey\", { value: t4, writeable: false }), bi[t4] = { klass: e2, omit: r2.omit || [], shallow: r2.shallow || [] };\n }\n wi(\"Object\", Object), wi(\"TransferableGridIndex\", vi), wi(\"Color\", Kt), wi(\"Error\", Error), wi(\"AJAXError\", L), wi(\"ResolvedImage\", te), wi(\"StylePropertyFunction\", Sn), wi(\"StyleExpression\", xn, { omit: [\"_evaluator\"] }), wi(\"ZoomDependentExpression\", _n), wi(\"ZoomConstantExpression\", wn), wi(\"CompoundExpression\", Xr, { omit: [\"_evaluate\"] });\n for (const t4 in Kr) Kr[t4]._classRegistryKey || wi(`Expression_${t4}`, Kr[t4]);\n function _i(t4) {\n return t4 && \"undefined\" != typeof ArrayBuffer && (t4 instanceof ArrayBuffer || t4.constructor && \"ArrayBuffer\" === t4.constructor.name);\n }\n function Ai(t4) {\n return t4.$name || t4.constructor._classRegistryKey;\n }\n function Si(t4) {\n return !function(t5) {\n if (null === t5 || \"object\" != typeof t5) return false;\n const e2 = Ai(t5);\n return !(!e2 || \"Object\" === e2);\n }(t4) && (null == t4 || \"boolean\" == typeof t4 || \"number\" == typeof t4 || \"string\" == typeof t4 || t4 instanceof Boolean || t4 instanceof Number || t4 instanceof String || t4 instanceof Date || t4 instanceof RegExp || t4 instanceof Blob || t4 instanceof Error || _i(t4) || I(t4) || ArrayBuffer.isView(t4) || t4 instanceof ImageData);\n }\n function ki(t4, e2) {\n if (Si(t4)) return (_i(t4) || I(t4)) && e2 && e2.push(t4), ArrayBuffer.isView(t4) && e2 && e2.push(t4.buffer), t4 instanceof ImageData && e2 && e2.push(t4.data.buffer), t4;\n if (Array.isArray(t4)) {\n const r3 = [];\n for (const n3 of t4) r3.push(ki(n3, e2));\n return r3;\n }\n if (\"object\" != typeof t4) throw new Error(\"can't serialize object of type \" + typeof t4);\n const r2 = Ai(t4);\n if (!r2) throw new Error(`can't serialize object of unregistered class ${t4.constructor.name}`);\n if (!bi[r2]) throw new Error(`${r2} is not registered.`);\n const { klass: n2 } = bi[r2], i2 = n2.serialize ? n2.serialize(t4, e2) : {};\n if (n2.serialize) {\n if (e2 && i2 === e2[e2.length - 1]) throw new Error(\"statically serialized object won't survive transfer of $name property\");\n } else {\n for (const n3 in t4) {\n if (!t4.hasOwnProperty(n3)) continue;\n if (bi[r2].omit.indexOf(n3) >= 0) continue;\n const s2 = t4[n3];\n i2[n3] = bi[r2].shallow.indexOf(n3) >= 0 ? s2 : ki(s2, e2);\n }\n t4 instanceof Error && (i2.message = t4.message);\n }\n if (i2.$name) throw new Error(\"$name property is reserved for worker serialization logic.\");\n return \"Object\" !== r2 && (i2.$name = r2), i2;\n }\n function Mi(t4) {\n if (Si(t4)) return t4;\n if (Array.isArray(t4)) return t4.map(Mi);\n if (\"object\" != typeof t4) throw new Error(\"can't deserialize object of type \" + typeof t4);\n const e2 = Ai(t4) || \"Object\";\n if (!bi[e2]) throw new Error(`can't deserialize unregistered class ${e2}`);\n const { klass: r2 } = bi[e2];\n if (!r2) throw new Error(`can't deserialize unregistered class ${e2}`);\n if (r2.deserialize) return r2.deserialize(t4);\n const n2 = Object.create(r2.prototype);\n for (const r3 of Object.keys(t4)) {\n if (\"$name\" === r3) continue;\n const i2 = t4[r3];\n n2[r3] = bi[e2].shallow.indexOf(r3) >= 0 ? i2 : Mi(i2);\n }\n return n2;\n }\n class Ii {\n constructor() {\n this.first = true;\n }\n update(t4, e2) {\n const r2 = Math.floor(t4);\n return this.first ? (this.first = false, this.lastIntegerZoom = r2, this.lastIntegerZoomTime = 0, this.lastZoom = t4, this.lastFloorZoom = r2, true) : (this.lastFloorZoom > r2 ? (this.lastIntegerZoom = r2 + 1, this.lastIntegerZoomTime = e2) : this.lastFloorZoom < r2 && (this.lastIntegerZoom = r2, this.lastIntegerZoomTime = e2), t4 !== this.lastZoom && (this.lastZoom = t4, this.lastFloorZoom = r2, true));\n }\n }\n const zi = { \"Latin-1 Supplement\": (t4) => t4 >= 128 && t4 <= 255, \"Hangul Jamo\": (t4) => t4 >= 4352 && t4 <= 4607, Khmer: (t4) => t4 >= 6016 && t4 <= 6143, \"General Punctuation\": (t4) => t4 >= 8192 && t4 <= 8303, \"Letterlike Symbols\": (t4) => t4 >= 8448 && t4 <= 8527, \"Number Forms\": (t4) => t4 >= 8528 && t4 <= 8591, \"Miscellaneous Technical\": (t4) => t4 >= 8960 && t4 <= 9215, \"Control Pictures\": (t4) => t4 >= 9216 && t4 <= 9279, \"Optical Character Recognition\": (t4) => t4 >= 9280 && t4 <= 9311, \"Enclosed Alphanumerics\": (t4) => t4 >= 9312 && t4 <= 9471, \"Geometric Shapes\": (t4) => t4 >= 9632 && t4 <= 9727, \"Miscellaneous Symbols\": (t4) => t4 >= 9728 && t4 <= 9983, \"Miscellaneous Symbols and Arrows\": (t4) => t4 >= 11008 && t4 <= 11263, \"Ideographic Description Characters\": (t4) => t4 >= 12272 && t4 <= 12287, \"CJK Symbols and Punctuation\": (t4) => t4 >= 12288 && t4 <= 12351, Katakana: (t4) => t4 >= 12448 && t4 <= 12543, Kanbun: (t4) => t4 >= 12688 && t4 <= 12703, \"CJK Strokes\": (t4) => t4 >= 12736 && t4 <= 12783, \"Enclosed CJK Letters and Months\": (t4) => t4 >= 12800 && t4 <= 13055, \"CJK Compatibility\": (t4) => t4 >= 13056 && t4 <= 13311, \"Yijing Hexagram Symbols\": (t4) => t4 >= 19904 && t4 <= 19967, \"Private Use Area\": (t4) => t4 >= 57344 && t4 <= 63743, \"Vertical Forms\": (t4) => t4 >= 65040 && t4 <= 65055, \"CJK Compatibility Forms\": (t4) => t4 >= 65072 && t4 <= 65103, \"Small Form Variants\": (t4) => t4 >= 65104 && t4 <= 65135, \"Halfwidth and Fullwidth Forms\": (t4) => t4 >= 65280 && t4 <= 65519 };\n function Pi(t4) {\n for (const e2 of t4) if (Ti(e2.charCodeAt(0))) return true;\n return false;\n }\n function Ci(t4) {\n for (const e2 of t4) if (!Ei(e2.charCodeAt(0))) return false;\n return true;\n }\n function Bi(t4) {\n const e2 = t4.map((t5) => {\n try {\n return new RegExp(`\\\\p{sc=${t5}}`, \"u\").source;\n } catch (t6) {\n return null;\n }\n }).filter((t5) => t5);\n return new RegExp(e2.join(\"|\"), \"u\");\n }\n const Vi = Bi([\"Arab\", \"Dupl\", \"Mong\", \"Ougr\", \"Syrc\"]);\n function Ei(t4) {\n return !Vi.test(String.fromCodePoint(t4));\n }\n const Fi = Bi([\"Bopo\", \"Hani\", \"Hira\", \"Kana\", \"Kits\", \"Nshu\", \"Tang\", \"Yiii\"]);\n function Ti(t4) {\n return !(746 !== t4 && 747 !== t4 && (t4 < 4352 || !(zi[\"CJK Compatibility Forms\"](t4) && !(t4 >= 65097 && t4 <= 65103) || zi[\"CJK Compatibility\"](t4) || zi[\"CJK Strokes\"](t4) || !(!zi[\"CJK Symbols and Punctuation\"](t4) || t4 >= 12296 && t4 <= 12305 || t4 >= 12308 && t4 <= 12319 || 12336 === t4) || zi[\"Enclosed CJK Letters and Months\"](t4) || zi[\"Ideographic Description Characters\"](t4) || zi.Kanbun(t4) || zi.Katakana(t4) && 12540 !== t4 || !(!zi[\"Halfwidth and Fullwidth Forms\"](t4) || 65288 === t4 || 65289 === t4 || 65293 === t4 || t4 >= 65306 && t4 <= 65310 || 65339 === t4 || 65341 === t4 || 65343 === t4 || t4 >= 65371 && t4 <= 65503 || 65507 === t4 || t4 >= 65512 && t4 <= 65519) || !(!zi[\"Small Form Variants\"](t4) || t4 >= 65112 && t4 <= 65118 || t4 >= 65123 && t4 <= 65126) || zi[\"Vertical Forms\"](t4) || zi[\"Yijing Hexagram Symbols\"](t4) || new RegExp(\"\\\\p{sc=Cans}\", \"u\").test(String.fromCodePoint(t4)) || new RegExp(\"\\\\p{sc=Hang}\", \"u\").test(String.fromCodePoint(t4)) || Fi.test(String.fromCodePoint(t4)))));\n }\n function $i(t4) {\n return !(Ti(t4) || function(t5) {\n return !!(zi[\"Latin-1 Supplement\"](t5) && (167 === t5 || 169 === t5 || 174 === t5 || 177 === t5 || 188 === t5 || 189 === t5 || 190 === t5 || 215 === t5 || 247 === t5) || zi[\"General Punctuation\"](t5) && (8214 === t5 || 8224 === t5 || 8225 === t5 || 8240 === t5 || 8241 === t5 || 8251 === t5 || 8252 === t5 || 8258 === t5 || 8263 === t5 || 8264 === t5 || 8265 === t5 || 8273 === t5) || zi[\"Letterlike Symbols\"](t5) || zi[\"Number Forms\"](t5) || zi[\"Miscellaneous Technical\"](t5) && (t5 >= 8960 && t5 <= 8967 || t5 >= 8972 && t5 <= 8991 || t5 >= 8996 && t5 <= 9e3 || 9003 === t5 || t5 >= 9085 && t5 <= 9114 || t5 >= 9150 && t5 <= 9165 || 9167 === t5 || t5 >= 9169 && t5 <= 9179 || t5 >= 9186 && t5 <= 9215) || zi[\"Control Pictures\"](t5) && 9251 !== t5 || zi[\"Optical Character Recognition\"](t5) || zi[\"Enclosed Alphanumerics\"](t5) || zi[\"Geometric Shapes\"](t5) || zi[\"Miscellaneous Symbols\"](t5) && !(t5 >= 9754 && t5 <= 9759) || zi[\"Miscellaneous Symbols and Arrows\"](t5) && (t5 >= 11026 && t5 <= 11055 || t5 >= 11088 && t5 <= 11097 || t5 >= 11192 && t5 <= 11243) || zi[\"CJK Symbols and Punctuation\"](t5) || zi.Katakana(t5) || zi[\"Private Use Area\"](t5) || zi[\"CJK Compatibility Forms\"](t5) || zi[\"Small Form Variants\"](t5) || zi[\"Halfwidth and Fullwidth Forms\"](t5) || 8734 === t5 || 8756 === t5 || 8757 === t5 || t5 >= 9984 && t5 <= 10087 || t5 >= 10102 && t5 <= 10131 || 65532 === t5 || 65533 === t5);\n }(t4));\n }\n const Li = Bi([\"Adlm\", \"Arab\", \"Armi\", \"Avst\", \"Chrs\", \"Cprt\", \"Egyp\", \"Elym\", \"Gara\", \"Hatr\", \"Hebr\", \"Hung\", \"Khar\", \"Lydi\", \"Mand\", \"Mani\", \"Mend\", \"Merc\", \"Mero\", \"Narb\", \"Nbat\", \"Nkoo\", \"Orkh\", \"Palm\", \"Phli\", \"Phlp\", \"Phnx\", \"Prti\", \"Rohg\", \"Samr\", \"Sarb\", \"Sogo\", \"Syrc\", \"Thaa\", \"Todr\", \"Yezi\"]);\n function Di(t4) {\n return Li.test(String.fromCodePoint(t4));\n }\n function Oi(t4, e2) {\n return !(!e2 && Di(t4) || t4 >= 2304 && t4 <= 3583 || t4 >= 3840 && t4 <= 4255 || zi.Khmer(t4));\n }\n function ji(t4) {\n for (const e2 of t4) if (Di(e2.charCodeAt(0))) return true;\n return false;\n }\n const Ri = new class {\n constructor() {\n this.applyArabicShaping = null, this.processBidirectionalText = null, this.processStyledBidirectionalText = null, this.pluginStatus = \"unavailable\", this.pluginURL = null;\n }\n setState(t4) {\n this.pluginStatus = t4.pluginStatus, this.pluginURL = t4.pluginURL;\n }\n getState() {\n return { pluginStatus: this.pluginStatus, pluginURL: this.pluginURL };\n }\n setMethods(t4) {\n this.applyArabicShaping = t4.applyArabicShaping, this.processBidirectionalText = t4.processBidirectionalText, this.processStyledBidirectionalText = t4.processStyledBidirectionalText;\n }\n isParsed() {\n return null != this.applyArabicShaping && null != this.processBidirectionalText && null != this.processStyledBidirectionalText;\n }\n getPluginURL() {\n return this.pluginURL;\n }\n getRTLTextPluginStatus() {\n return this.pluginStatus;\n }\n }();\n class Ui {\n constructor(t4, e2) {\n this.zoom = t4, e2 ? (this.now = e2.now, this.fadeDuration = e2.fadeDuration, this.zoomHistory = e2.zoomHistory, this.transition = e2.transition) : (this.now = 0, this.fadeDuration = 0, this.zoomHistory = new Ii(), this.transition = {});\n }\n isSupportedScript(t4) {\n return function(t5, e2) {\n for (const r2 of t5) if (!Oi(r2.charCodeAt(0), e2)) return false;\n return true;\n }(t4, \"loaded\" === Ri.getRTLTextPluginStatus());\n }\n crossFadingFactor() {\n return 0 === this.fadeDuration ? 1 : Math.min((this.now - this.zoomHistory.lastIntegerZoomTime) / this.fadeDuration, 1);\n }\n getCrossfadeParameters() {\n const t4 = this.zoom, e2 = t4 - Math.floor(t4), r2 = this.crossFadingFactor();\n return t4 > this.zoomHistory.lastIntegerZoom ? { fromScale: 2, toScale: 1, t: e2 + (1 - e2) * r2 } : { fromScale: 0.5, toScale: 1, t: 1 - (1 - r2) * e2 };\n }\n }\n class qi {\n constructor(t4, e2) {\n this.property = t4, this.value = e2, this.expression = function(t5, e3) {\n if (cn(t5)) return new Sn(t5, e3);\n if (vn(t5)) {\n const r2 = An(t5, e3);\n if (\"error\" === r2.result) throw new Error(r2.value.map((t6) => `${t6.key}: ${t6.message}`).join(\", \"));\n return r2.value;\n }\n {\n let r2 = t5;\n return \"color\" === e3.type && \"string\" == typeof t5 ? r2 = Kt.parse(t5) : \"padding\" !== e3.type || \"number\" != typeof t5 && !Array.isArray(t5) ? \"variableAnchorOffsetCollection\" === e3.type && Array.isArray(t5) && (r2 = Qt.parse(t5)) : r2 = Jt.parse(t5), { kind: \"constant\", evaluate: () => r2 };\n }\n }(void 0 === e2 ? t4.specification.default : e2, t4.specification);\n }\n isDataDriven() {\n return \"source\" === this.expression.kind || \"composite\" === this.expression.kind;\n }\n possiblyEvaluate(t4, e2, r2) {\n return this.property.possiblyEvaluate(this, t4, e2, r2);\n }\n }\n class Ni {\n constructor(t4) {\n this.property = t4, this.value = new qi(t4, void 0);\n }\n transitioned(t4, e2) {\n return new Gi(this.property, this.value, e2, g({}, t4.transition, this.transition), t4.now);\n }\n untransitioned() {\n return new Gi(this.property, this.value, null, {}, 0);\n }\n }\n class Zi {\n constructor(t4) {\n this._properties = t4, this._values = Object.create(t4.defaultTransitionablePropertyValues);\n }\n getValue(t4) {\n return w(this._values[t4].value.value);\n }\n setValue(t4, e2) {\n Object.prototype.hasOwnProperty.call(this._values, t4) || (this._values[t4] = new Ni(this._values[t4].property)), this._values[t4].value = new qi(this._values[t4].property, null === e2 ? void 0 : w(e2));\n }\n getTransition(t4) {\n return w(this._values[t4].transition);\n }\n setTransition(t4, e2) {\n Object.prototype.hasOwnProperty.call(this._values, t4) || (this._values[t4] = new Ni(this._values[t4].property)), this._values[t4].transition = w(e2) || void 0;\n }\n serialize() {\n const t4 = {};\n for (const e2 of Object.keys(this._values)) {\n const r2 = this.getValue(e2);\n void 0 !== r2 && (t4[e2] = r2);\n const n2 = this.getTransition(e2);\n void 0 !== n2 && (t4[`${e2}-transition`] = n2);\n }\n return t4;\n }\n transitioned(t4, e2) {\n const r2 = new Ki(this._properties);\n for (const n2 of Object.keys(this._values)) r2._values[n2] = this._values[n2].transitioned(t4, e2._values[n2]);\n return r2;\n }\n untransitioned() {\n const t4 = new Ki(this._properties);\n for (const e2 of Object.keys(this._values)) t4._values[e2] = this._values[e2].untransitioned();\n return t4;\n }\n }\n class Gi {\n constructor(t4, e2, r2, n2, i2) {\n this.property = t4, this.value = e2, this.begin = i2 + n2.delay || 0, this.end = this.begin + n2.duration || 0, t4.specification.transition && (n2.delay || n2.duration) && (this.prior = r2);\n }\n possiblyEvaluate(t4, e2, r2) {\n const n2 = t4.now || 0, i2 = this.value.possiblyEvaluate(t4, e2, r2), s2 = this.prior;\n if (s2) {\n if (n2 > this.end) return this.prior = null, i2;\n if (this.value.isDataDriven()) return this.prior = null, i2;\n if (n2 < this.begin) return s2.possiblyEvaluate(t4, e2, r2);\n {\n const a2 = (n2 - this.begin) / (this.end - this.begin);\n return this.property.interpolate(s2.possiblyEvaluate(t4, e2, r2), i2, function(t5) {\n if (t5 <= 0) return 0;\n if (t5 >= 1) return 1;\n const e3 = t5 * t5, r3 = e3 * t5;\n return 4 * (t5 < 0.5 ? r3 : 3 * (t5 - e3) + r3 - 0.75);\n }(a2));\n }\n }\n return i2;\n }\n }\n class Ki {\n constructor(t4) {\n this._properties = t4, this._values = Object.create(t4.defaultTransitioningPropertyValues);\n }\n possiblyEvaluate(t4, e2, r2) {\n const n2 = new Yi(this._properties);\n for (const i2 of Object.keys(this._values)) n2._values[i2] = this._values[i2].possiblyEvaluate(t4, e2, r2);\n return n2;\n }\n hasTransition() {\n for (const t4 of Object.keys(this._values)) if (this._values[t4].prior) return true;\n return false;\n }\n }\n class Xi {\n constructor(t4) {\n this._properties = t4, this._values = Object.create(t4.defaultPropertyValues);\n }\n hasValue(t4) {\n return void 0 !== this._values[t4].value;\n }\n getValue(t4) {\n return w(this._values[t4].value);\n }\n setValue(t4, e2) {\n this._values[t4] = new qi(this._values[t4].property, null === e2 ? void 0 : w(e2));\n }\n serialize() {\n const t4 = {};\n for (const e2 of Object.keys(this._values)) {\n const r2 = this.getValue(e2);\n void 0 !== r2 && (t4[e2] = r2);\n }\n return t4;\n }\n possiblyEvaluate(t4, e2, r2) {\n const n2 = new Yi(this._properties);\n for (const i2 of Object.keys(this._values)) n2._values[i2] = this._values[i2].possiblyEvaluate(t4, e2, r2);\n return n2;\n }\n }\n class Hi {\n constructor(t4, e2, r2) {\n this.property = t4, this.value = e2, this.parameters = r2;\n }\n isConstant() {\n return \"constant\" === this.value.kind;\n }\n constantOr(t4) {\n return \"constant\" === this.value.kind ? this.value.value : t4;\n }\n evaluate(t4, e2, r2, n2) {\n return this.property.evaluate(this.value, this.parameters, t4, e2, r2, n2);\n }\n }\n class Yi {\n constructor(t4) {\n this._properties = t4, this._values = Object.create(t4.defaultPossiblyEvaluatedValues);\n }\n get(t4) {\n return this._values[t4];\n }\n }\n class Ji {\n constructor(t4) {\n this.specification = t4;\n }\n possiblyEvaluate(t4, e2) {\n if (t4.isDataDriven()) throw new Error(\"Value should not be data driven\");\n return t4.expression.evaluate(e2);\n }\n interpolate(t4, e2, r2) {\n const n2 = Ce[this.specification.type];\n return n2 ? n2(t4, e2, r2) : t4;\n }\n }\n class Wi {\n constructor(t4, e2) {\n this.specification = t4, this.overrides = e2;\n }\n possiblyEvaluate(t4, e2, r2, n2) {\n return new Hi(this, \"constant\" === t4.expression.kind || \"camera\" === t4.expression.kind ? { kind: \"constant\", value: t4.expression.evaluate(e2, null, {}, r2, n2) } : t4.expression, e2);\n }\n interpolate(t4, e2, r2) {\n if (\"constant\" !== t4.value.kind || \"constant\" !== e2.value.kind) return t4;\n if (void 0 === t4.value.value || void 0 === e2.value.value) return new Hi(this, { kind: \"constant\", value: void 0 }, t4.parameters);\n const n2 = Ce[this.specification.type];\n if (n2) {\n const i2 = n2(t4.value.value, e2.value.value, r2);\n return new Hi(this, { kind: \"constant\", value: i2 }, t4.parameters);\n }\n return t4;\n }\n evaluate(t4, e2, r2, n2, i2, s2) {\n return \"constant\" === t4.kind ? t4.value : t4.evaluate(e2, r2, n2, i2, s2);\n }\n }\n class Qi extends Wi {\n possiblyEvaluate(t4, e2, r2, n2) {\n if (void 0 === t4.value) return new Hi(this, { kind: \"constant\", value: void 0 }, e2);\n if (\"constant\" === t4.expression.kind) {\n const i2 = t4.expression.evaluate(e2, null, {}, r2, n2), s2 = \"resolvedImage\" === t4.property.specification.type && \"string\" != typeof i2 ? i2.name : i2, a2 = this._calculate(s2, s2, s2, e2);\n return new Hi(this, { kind: \"constant\", value: a2 }, e2);\n }\n if (\"camera\" === t4.expression.kind) {\n const r3 = this._calculate(t4.expression.evaluate({ zoom: e2.zoom - 1 }), t4.expression.evaluate({ zoom: e2.zoom }), t4.expression.evaluate({ zoom: e2.zoom + 1 }), e2);\n return new Hi(this, { kind: \"constant\", value: r3 }, e2);\n }\n return new Hi(this, t4.expression, e2);\n }\n evaluate(t4, e2, r2, n2, i2, s2) {\n if (\"source\" === t4.kind) {\n const a2 = t4.evaluate(e2, r2, n2, i2, s2);\n return this._calculate(a2, a2, a2, e2);\n }\n return \"composite\" === t4.kind ? this._calculate(t4.evaluate({ zoom: Math.floor(e2.zoom) - 1 }, r2, n2), t4.evaluate({ zoom: Math.floor(e2.zoom) }, r2, n2), t4.evaluate({ zoom: Math.floor(e2.zoom) + 1 }, r2, n2), e2) : t4.value;\n }\n _calculate(t4, e2, r2, n2) {\n return n2.zoom > n2.zoomHistory.lastIntegerZoom ? { from: t4, to: e2 } : { from: r2, to: e2 };\n }\n interpolate(t4) {\n return t4;\n }\n }\n class ts {\n constructor(t4) {\n this.specification = t4;\n }\n possiblyEvaluate(t4, e2, r2, n2) {\n if (void 0 !== t4.value) {\n if (\"constant\" === t4.expression.kind) {\n const i2 = t4.expression.evaluate(e2, null, {}, r2, n2);\n return this._calculate(i2, i2, i2, e2);\n }\n return this._calculate(t4.expression.evaluate(new Ui(Math.floor(e2.zoom - 1), e2)), t4.expression.evaluate(new Ui(Math.floor(e2.zoom), e2)), t4.expression.evaluate(new Ui(Math.floor(e2.zoom + 1), e2)), e2);\n }\n }\n _calculate(t4, e2, r2, n2) {\n return n2.zoom > n2.zoomHistory.lastIntegerZoom ? { from: t4, to: e2 } : { from: r2, to: e2 };\n }\n interpolate(t4) {\n return t4;\n }\n }\n class es {\n constructor(t4) {\n this.specification = t4;\n }\n possiblyEvaluate(t4, e2, r2, n2) {\n return !!t4.expression.evaluate(e2, null, {}, r2, n2);\n }\n interpolate() {\n return false;\n }\n }\n class rs {\n constructor(t4) {\n this.properties = t4, this.defaultPropertyValues = {}, this.defaultTransitionablePropertyValues = {}, this.defaultTransitioningPropertyValues = {}, this.defaultPossiblyEvaluatedValues = {}, this.overridableProperties = [];\n for (const e2 in t4) {\n const r2 = t4[e2];\n r2.specification.overridable && this.overridableProperties.push(e2);\n const n2 = this.defaultPropertyValues[e2] = new qi(r2, void 0), i2 = this.defaultTransitionablePropertyValues[e2] = new Ni(r2);\n this.defaultTransitioningPropertyValues[e2] = i2.untransitioned(), this.defaultPossiblyEvaluatedValues[e2] = n2.possiblyEvaluate({});\n }\n }\n }\n wi(\"DataDrivenProperty\", Wi), wi(\"DataConstantProperty\", Ji), wi(\"CrossFadedDataDrivenProperty\", Qi), wi(\"CrossFadedProperty\", ts), wi(\"ColorRampProperty\", es);\n const ns = \"-transition\";\n class is extends Z {\n constructor(t4, e2) {\n if (super(), this.id = t4.id, this.type = t4.type, this._featureFilter = { filter: () => true, needGeometry: false }, \"custom\" !== t4.type && (this.metadata = t4.metadata, this.minzoom = t4.minzoom, this.maxzoom = t4.maxzoom, \"background\" !== t4.type && (this.source = t4.source, this.sourceLayer = t4[\"source-layer\"], this.filter = t4.filter), e2.layout && (this._unevaluatedLayout = new Xi(e2.layout)), e2.paint)) {\n this._transitionablePaint = new Zi(e2.paint);\n for (const e3 in t4.paint) this.setPaintProperty(e3, t4.paint[e3], { validate: false });\n for (const e3 in t4.layout) this.setLayoutProperty(e3, t4.layout[e3], { validate: false });\n this._transitioningPaint = this._transitionablePaint.untransitioned(), this.paint = new Yi(e2.paint);\n }\n }\n getCrossfadeParameters() {\n return this._crossfadeParameters;\n }\n getLayoutProperty(t4) {\n return \"visibility\" === t4 ? this.visibility : this._unevaluatedLayout.getValue(t4);\n }\n setLayoutProperty(t4, e2, r2 = {}) {\n null != e2 && this._validate(gi, `layers.${this.id}.layout.${t4}`, t4, e2, r2) || (\"visibility\" !== t4 ? this._unevaluatedLayout.setValue(t4, e2) : this.visibility = e2);\n }\n getPaintProperty(t4) {\n return t4.endsWith(ns) ? this._transitionablePaint.getTransition(t4.slice(0, -11)) : this._transitionablePaint.getValue(t4);\n }\n setPaintProperty(t4, e2, r2 = {}) {\n if (null != e2 && this._validate(mi, `layers.${this.id}.paint.${t4}`, t4, e2, r2)) return false;\n if (t4.endsWith(ns)) return this._transitionablePaint.setTransition(t4.slice(0, -11), e2 || void 0), false;\n {\n const r3 = this._transitionablePaint._values[t4], n2 = \"cross-faded-data-driven\" === r3.property.specification[\"property-type\"], i2 = r3.value.isDataDriven(), s2 = r3.value;\n this._transitionablePaint.setValue(t4, e2), this._handleSpecialPaintPropertyUpdate(t4);\n const a2 = this._transitionablePaint._values[t4].value;\n return a2.isDataDriven() || i2 || n2 || this._handleOverridablePaintPropertyUpdate(t4, s2, a2);\n }\n }\n _handleSpecialPaintPropertyUpdate(t4) {\n }\n _handleOverridablePaintPropertyUpdate(t4, e2, r2) {\n return false;\n }\n isHidden(t4) {\n return !!(this.minzoom && t4 < this.minzoom) || !!(this.maxzoom && t4 >= this.maxzoom) || \"none\" === this.visibility;\n }\n updateTransitions(t4) {\n this._transitioningPaint = this._transitionablePaint.transitioned(t4, this._transitioningPaint);\n }\n hasTransition() {\n return this._transitioningPaint.hasTransition();\n }\n recalculate(t4, e2) {\n t4.getCrossfadeParameters && (this._crossfadeParameters = t4.getCrossfadeParameters()), this._unevaluatedLayout && (this.layout = this._unevaluatedLayout.possiblyEvaluate(t4, void 0, e2)), this.paint = this._transitioningPaint.possiblyEvaluate(t4, void 0, e2);\n }\n serialize() {\n const t4 = { id: this.id, type: this.type, source: this.source, \"source-layer\": this.sourceLayer, metadata: this.metadata, minzoom: this.minzoom, maxzoom: this.maxzoom, filter: this.filter, layout: this._unevaluatedLayout && this._unevaluatedLayout.serialize(), paint: this._transitionablePaint && this._transitionablePaint.serialize() };\n return this.visibility && (t4.layout = t4.layout || {}, t4.layout.visibility = this.visibility), b(t4, (t5, e2) => !(void 0 === t5 || \"layout\" === e2 && !Object.keys(t5).length || \"paint\" === e2 && !Object.keys(t5).length));\n }\n _validate(t4, e2, r2, n2, i2 = {}) {\n return (!i2 || false !== i2.validate) && xi(this, t4.call(fi, { key: e2, layerType: this.type, objectKey: r2, value: n2, styleSpec: G, style: { glyphs: true, sprite: true } }));\n }\n is3D() {\n return false;\n }\n isTileClipped() {\n return false;\n }\n hasOffscreenPass() {\n return false;\n }\n resize() {\n }\n isStateDependent() {\n for (const t4 in this.paint._values) {\n const e2 = this.paint.get(t4);\n if (e2 instanceof Hi && an(e2.property.specification) && (\"source\" === e2.value.kind || \"composite\" === e2.value.kind) && e2.value.isStateDependent) return true;\n }\n return false;\n }\n }\n const ss = { Int8: Int8Array, Uint8: Uint8Array, Int16: Int16Array, Uint16: Uint16Array, Int32: Int32Array, Uint32: Uint32Array, Float32: Float32Array };\n class as {\n constructor(t4, e2) {\n this._structArray = t4, this._pos1 = e2 * this.size, this._pos2 = this._pos1 / 2, this._pos4 = this._pos1 / 4, this._pos8 = this._pos1 / 8;\n }\n }\n class os {\n constructor() {\n this.isTransferred = false, this.capacity = -1, this.resize(0);\n }\n static serialize(t4, e2) {\n return t4._trim(), e2 && (t4.isTransferred = true, e2.push(t4.arrayBuffer)), { length: t4.length, arrayBuffer: t4.arrayBuffer };\n }\n static deserialize(t4) {\n const e2 = Object.create(this.prototype);\n return e2.arrayBuffer = t4.arrayBuffer, e2.length = t4.length, e2.capacity = t4.arrayBuffer.byteLength / e2.bytesPerElement, e2._refreshViews(), e2;\n }\n _trim() {\n this.length !== this.capacity && (this.capacity = this.length, this.arrayBuffer = this.arrayBuffer.slice(0, this.length * this.bytesPerElement), this._refreshViews());\n }\n clear() {\n this.length = 0;\n }\n resize(t4) {\n this.reserve(t4), this.length = t4;\n }\n reserve(t4) {\n if (t4 > this.capacity) {\n this.capacity = Math.max(t4, Math.floor(5 * this.capacity), 128), this.arrayBuffer = new ArrayBuffer(this.capacity * this.bytesPerElement);\n const e2 = this.uint8;\n this._refreshViews(), e2 && this.uint8.set(e2);\n }\n }\n _refreshViews() {\n throw new Error(\"_refreshViews() must be implemented by each concrete StructArray layout\");\n }\n }\n function ls(t4, e2 = 1) {\n let r2 = 0, n2 = 0;\n return { members: t4.map((t5) => {\n const i2 = ss[t5.type].BYTES_PER_ELEMENT, s2 = r2 = us(r2, Math.max(e2, i2)), a2 = t5.components || 1;\n return n2 = Math.max(n2, i2), r2 += i2 * a2, { name: t5.name, type: t5.type, components: a2, offset: s2 };\n }), size: us(r2, Math.max(n2, e2)), alignment: e2 };\n }\n function us(t4, e2) {\n return Math.ceil(t4 / e2) * e2;\n }\n class cs extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2) {\n const r2 = this.length;\n return this.resize(r2 + 1), this.emplace(r2, t4, e2);\n }\n emplace(t4, e2, r2) {\n const n2 = 2 * t4;\n return this.int16[n2 + 0] = e2, this.int16[n2 + 1] = r2, t4;\n }\n }\n cs.prototype.bytesPerElement = 4, wi(\"StructArrayLayout2i4\", cs);\n class hs extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2, r2) {\n const n2 = this.length;\n return this.resize(n2 + 1), this.emplace(n2, t4, e2, r2);\n }\n emplace(t4, e2, r2, n2) {\n const i2 = 3 * t4;\n return this.int16[i2 + 0] = e2, this.int16[i2 + 1] = r2, this.int16[i2 + 2] = n2, t4;\n }\n }\n hs.prototype.bytesPerElement = 6, wi(\"StructArrayLayout3i6\", hs);\n class ps extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2, r2, n2) {\n const i2 = this.length;\n return this.resize(i2 + 1), this.emplace(i2, t4, e2, r2, n2);\n }\n emplace(t4, e2, r2, n2, i2) {\n const s2 = 4 * t4;\n return this.int16[s2 + 0] = e2, this.int16[s2 + 1] = r2, this.int16[s2 + 2] = n2, this.int16[s2 + 3] = i2, t4;\n }\n }\n ps.prototype.bytesPerElement = 8, wi(\"StructArrayLayout4i8\", ps);\n class fs extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2, r2, n2, i2, s2) {\n const a2 = this.length;\n return this.resize(a2 + 1), this.emplace(a2, t4, e2, r2, n2, i2, s2);\n }\n emplace(t4, e2, r2, n2, i2, s2, a2) {\n const o2 = 6 * t4;\n return this.int16[o2 + 0] = e2, this.int16[o2 + 1] = r2, this.int16[o2 + 2] = n2, this.int16[o2 + 3] = i2, this.int16[o2 + 4] = s2, this.int16[o2 + 5] = a2, t4;\n }\n }\n fs.prototype.bytesPerElement = 12, wi(\"StructArrayLayout2i4i12\", fs);\n class ds extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2, r2, n2, i2, s2) {\n const a2 = this.length;\n return this.resize(a2 + 1), this.emplace(a2, t4, e2, r2, n2, i2, s2);\n }\n emplace(t4, e2, r2, n2, i2, s2, a2) {\n const o2 = 4 * t4, l2 = 8 * t4;\n return this.int16[o2 + 0] = e2, this.int16[o2 + 1] = r2, this.uint8[l2 + 4] = n2, this.uint8[l2 + 5] = i2, this.uint8[l2 + 6] = s2, this.uint8[l2 + 7] = a2, t4;\n }\n }\n ds.prototype.bytesPerElement = 8, wi(\"StructArrayLayout2i4ub8\", ds);\n class ys extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2) {\n const r2 = this.length;\n return this.resize(r2 + 1), this.emplace(r2, t4, e2);\n }\n emplace(t4, e2, r2) {\n const n2 = 2 * t4;\n return this.float32[n2 + 0] = e2, this.float32[n2 + 1] = r2, t4;\n }\n }\n ys.prototype.bytesPerElement = 8, wi(\"StructArrayLayout2f8\", ys);\n class ms extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2, r2, n2, i2, s2, a2, o2, l2, u2) {\n const c2 = this.length;\n return this.resize(c2 + 1), this.emplace(c2, t4, e2, r2, n2, i2, s2, a2, o2, l2, u2);\n }\n emplace(t4, e2, r2, n2, i2, s2, a2, o2, l2, u2, c2) {\n const h2 = 10 * t4;\n return this.uint16[h2 + 0] = e2, this.uint16[h2 + 1] = r2, this.uint16[h2 + 2] = n2, this.uint16[h2 + 3] = i2, this.uint16[h2 + 4] = s2, this.uint16[h2 + 5] = a2, this.uint16[h2 + 6] = o2, this.uint16[h2 + 7] = l2, this.uint16[h2 + 8] = u2, this.uint16[h2 + 9] = c2, t4;\n }\n }\n ms.prototype.bytesPerElement = 20, wi(\"StructArrayLayout10ui20\", ms);\n class gs extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2, r2, n2, i2, s2, a2, o2, l2, u2, c2, h2) {\n const p2 = this.length;\n return this.resize(p2 + 1), this.emplace(p2, t4, e2, r2, n2, i2, s2, a2, o2, l2, u2, c2, h2);\n }\n emplace(t4, e2, r2, n2, i2, s2, a2, o2, l2, u2, c2, h2, p2) {\n const f2 = 12 * t4;\n return this.int16[f2 + 0] = e2, this.int16[f2 + 1] = r2, this.int16[f2 + 2] = n2, this.int16[f2 + 3] = i2, this.uint16[f2 + 4] = s2, this.uint16[f2 + 5] = a2, this.uint16[f2 + 6] = o2, this.uint16[f2 + 7] = l2, this.int16[f2 + 8] = u2, this.int16[f2 + 9] = c2, this.int16[f2 + 10] = h2, this.int16[f2 + 11] = p2, t4;\n }\n }\n gs.prototype.bytesPerElement = 24, wi(\"StructArrayLayout4i4ui4i24\", gs);\n class xs extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2, r2) {\n const n2 = this.length;\n return this.resize(n2 + 1), this.emplace(n2, t4, e2, r2);\n }\n emplace(t4, e2, r2, n2) {\n const i2 = 3 * t4;\n return this.float32[i2 + 0] = e2, this.float32[i2 + 1] = r2, this.float32[i2 + 2] = n2, t4;\n }\n }\n xs.prototype.bytesPerElement = 12, wi(\"StructArrayLayout3f12\", xs);\n class vs extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer);\n }\n emplaceBack(t4) {\n const e2 = this.length;\n return this.resize(e2 + 1), this.emplace(e2, t4);\n }\n emplace(t4, e2) {\n return this.uint32[1 * t4 + 0] = e2, t4;\n }\n }\n vs.prototype.bytesPerElement = 4, wi(\"StructArrayLayout1ul4\", vs);\n class bs extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2, r2, n2, i2, s2, a2, o2, l2) {\n const u2 = this.length;\n return this.resize(u2 + 1), this.emplace(u2, t4, e2, r2, n2, i2, s2, a2, o2, l2);\n }\n emplace(t4, e2, r2, n2, i2, s2, a2, o2, l2, u2) {\n const c2 = 10 * t4, h2 = 5 * t4;\n return this.int16[c2 + 0] = e2, this.int16[c2 + 1] = r2, this.int16[c2 + 2] = n2, this.int16[c2 + 3] = i2, this.int16[c2 + 4] = s2, this.int16[c2 + 5] = a2, this.uint32[h2 + 3] = o2, this.uint16[c2 + 8] = l2, this.uint16[c2 + 9] = u2, t4;\n }\n }\n bs.prototype.bytesPerElement = 20, wi(\"StructArrayLayout6i1ul2ui20\", bs);\n class ws extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2, r2, n2, i2, s2) {\n const a2 = this.length;\n return this.resize(a2 + 1), this.emplace(a2, t4, e2, r2, n2, i2, s2);\n }\n emplace(t4, e2, r2, n2, i2, s2, a2) {\n const o2 = 6 * t4;\n return this.int16[o2 + 0] = e2, this.int16[o2 + 1] = r2, this.int16[o2 + 2] = n2, this.int16[o2 + 3] = i2, this.int16[o2 + 4] = s2, this.int16[o2 + 5] = a2, t4;\n }\n }\n ws.prototype.bytesPerElement = 12, wi(\"StructArrayLayout2i2i2i12\", ws);\n class _s extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2, r2, n2, i2) {\n const s2 = this.length;\n return this.resize(s2 + 1), this.emplace(s2, t4, e2, r2, n2, i2);\n }\n emplace(t4, e2, r2, n2, i2, s2) {\n const a2 = 4 * t4, o2 = 8 * t4;\n return this.float32[a2 + 0] = e2, this.float32[a2 + 1] = r2, this.float32[a2 + 2] = n2, this.int16[o2 + 6] = i2, this.int16[o2 + 7] = s2, t4;\n }\n }\n _s.prototype.bytesPerElement = 16, wi(\"StructArrayLayout2f1f2i16\", _s);\n class As extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2, r2, n2, i2, s2) {\n const a2 = this.length;\n return this.resize(a2 + 1), this.emplace(a2, t4, e2, r2, n2, i2, s2);\n }\n emplace(t4, e2, r2, n2, i2, s2, a2) {\n const o2 = 16 * t4, l2 = 4 * t4, u2 = 8 * t4;\n return this.uint8[o2 + 0] = e2, this.uint8[o2 + 1] = r2, this.float32[l2 + 1] = n2, this.float32[l2 + 2] = i2, this.int16[u2 + 6] = s2, this.int16[u2 + 7] = a2, t4;\n }\n }\n As.prototype.bytesPerElement = 16, wi(\"StructArrayLayout2ub2f2i16\", As);\n class Ss extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2, r2) {\n const n2 = this.length;\n return this.resize(n2 + 1), this.emplace(n2, t4, e2, r2);\n }\n emplace(t4, e2, r2, n2) {\n const i2 = 3 * t4;\n return this.uint16[i2 + 0] = e2, this.uint16[i2 + 1] = r2, this.uint16[i2 + 2] = n2, t4;\n }\n }\n Ss.prototype.bytesPerElement = 6, wi(\"StructArrayLayout3ui6\", Ss);\n class ks extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2, r2, n2, i2, s2, a2, o2, l2, u2, c2, h2, p2, f2, d2, y2, m2) {\n const g2 = this.length;\n return this.resize(g2 + 1), this.emplace(g2, t4, e2, r2, n2, i2, s2, a2, o2, l2, u2, c2, h2, p2, f2, d2, y2, m2);\n }\n emplace(t4, e2, r2, n2, i2, s2, a2, o2, l2, u2, c2, h2, p2, f2, d2, y2, m2, g2) {\n const x2 = 24 * t4, v2 = 12 * t4, b2 = 48 * t4;\n return this.int16[x2 + 0] = e2, this.int16[x2 + 1] = r2, this.uint16[x2 + 2] = n2, this.uint16[x2 + 3] = i2, this.uint32[v2 + 2] = s2, this.uint32[v2 + 3] = a2, this.uint32[v2 + 4] = o2, this.uint16[x2 + 10] = l2, this.uint16[x2 + 11] = u2, this.uint16[x2 + 12] = c2, this.float32[v2 + 7] = h2, this.float32[v2 + 8] = p2, this.uint8[b2 + 36] = f2, this.uint8[b2 + 37] = d2, this.uint8[b2 + 38] = y2, this.uint32[v2 + 10] = m2, this.int16[x2 + 22] = g2, t4;\n }\n }\n ks.prototype.bytesPerElement = 48, wi(\"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48\", ks);\n class Ms extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2, r2, n2, i2, s2, a2, o2, l2, u2, c2, h2, p2, f2, d2, y2, m2, g2, x2, v2, b2, w2, _2, A3, S2, k2, M2, I2) {\n const z2 = this.length;\n return this.resize(z2 + 1), this.emplace(z2, t4, e2, r2, n2, i2, s2, a2, o2, l2, u2, c2, h2, p2, f2, d2, y2, m2, g2, x2, v2, b2, w2, _2, A3, S2, k2, M2, I2);\n }\n emplace(t4, e2, r2, n2, i2, s2, a2, o2, l2, u2, c2, h2, p2, f2, d2, y2, m2, g2, x2, v2, b2, w2, _2, A3, S2, k2, M2, I2, z2) {\n const P2 = 32 * t4, C3 = 16 * t4;\n return this.int16[P2 + 0] = e2, this.int16[P2 + 1] = r2, this.int16[P2 + 2] = n2, this.int16[P2 + 3] = i2, this.int16[P2 + 4] = s2, this.int16[P2 + 5] = a2, this.int16[P2 + 6] = o2, this.int16[P2 + 7] = l2, this.uint16[P2 + 8] = u2, this.uint16[P2 + 9] = c2, this.uint16[P2 + 10] = h2, this.uint16[P2 + 11] = p2, this.uint16[P2 + 12] = f2, this.uint16[P2 + 13] = d2, this.uint16[P2 + 14] = y2, this.uint16[P2 + 15] = m2, this.uint16[P2 + 16] = g2, this.uint16[P2 + 17] = x2, this.uint16[P2 + 18] = v2, this.uint16[P2 + 19] = b2, this.uint16[P2 + 20] = w2, this.uint16[P2 + 21] = _2, this.uint16[P2 + 22] = A3, this.uint32[C3 + 12] = S2, this.float32[C3 + 13] = k2, this.float32[C3 + 14] = M2, this.uint16[P2 + 30] = I2, this.uint16[P2 + 31] = z2, t4;\n }\n }\n Ms.prototype.bytesPerElement = 64, wi(\"StructArrayLayout8i15ui1ul2f2ui64\", Ms);\n class Is extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);\n }\n emplaceBack(t4) {\n const e2 = this.length;\n return this.resize(e2 + 1), this.emplace(e2, t4);\n }\n emplace(t4, e2) {\n return this.float32[1 * t4 + 0] = e2, t4;\n }\n }\n Is.prototype.bytesPerElement = 4, wi(\"StructArrayLayout1f4\", Is);\n class zs extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2, r2) {\n const n2 = this.length;\n return this.resize(n2 + 1), this.emplace(n2, t4, e2, r2);\n }\n emplace(t4, e2, r2, n2) {\n const i2 = 3 * t4;\n return this.uint16[6 * t4 + 0] = e2, this.float32[i2 + 1] = r2, this.float32[i2 + 2] = n2, t4;\n }\n }\n zs.prototype.bytesPerElement = 12, wi(\"StructArrayLayout1ui2f12\", zs);\n class Ps extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2, r2) {\n const n2 = this.length;\n return this.resize(n2 + 1), this.emplace(n2, t4, e2, r2);\n }\n emplace(t4, e2, r2, n2) {\n const i2 = 4 * t4;\n return this.uint32[2 * t4 + 0] = e2, this.uint16[i2 + 2] = r2, this.uint16[i2 + 3] = n2, t4;\n }\n }\n Ps.prototype.bytesPerElement = 8, wi(\"StructArrayLayout1ul2ui8\", Ps);\n class Cs extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2) {\n const r2 = this.length;\n return this.resize(r2 + 1), this.emplace(r2, t4, e2);\n }\n emplace(t4, e2, r2) {\n const n2 = 2 * t4;\n return this.uint16[n2 + 0] = e2, this.uint16[n2 + 1] = r2, t4;\n }\n }\n Cs.prototype.bytesPerElement = 4, wi(\"StructArrayLayout2ui4\", Cs);\n class Bs extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n emplaceBack(t4) {\n const e2 = this.length;\n return this.resize(e2 + 1), this.emplace(e2, t4);\n }\n emplace(t4, e2) {\n return this.uint16[1 * t4 + 0] = e2, t4;\n }\n }\n Bs.prototype.bytesPerElement = 2, wi(\"StructArrayLayout1ui2\", Bs);\n class Vs extends os {\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);\n }\n emplaceBack(t4, e2, r2, n2) {\n const i2 = this.length;\n return this.resize(i2 + 1), this.emplace(i2, t4, e2, r2, n2);\n }\n emplace(t4, e2, r2, n2, i2) {\n const s2 = 4 * t4;\n return this.float32[s2 + 0] = e2, this.float32[s2 + 1] = r2, this.float32[s2 + 2] = n2, this.float32[s2 + 3] = i2, t4;\n }\n }\n Vs.prototype.bytesPerElement = 16, wi(\"StructArrayLayout4f16\", Vs);\n class Es extends as {\n get anchorPointX() {\n return this._structArray.int16[this._pos2 + 0];\n }\n get anchorPointY() {\n return this._structArray.int16[this._pos2 + 1];\n }\n get x1() {\n return this._structArray.int16[this._pos2 + 2];\n }\n get y1() {\n return this._structArray.int16[this._pos2 + 3];\n }\n get x2() {\n return this._structArray.int16[this._pos2 + 4];\n }\n get y2() {\n return this._structArray.int16[this._pos2 + 5];\n }\n get featureIndex() {\n return this._structArray.uint32[this._pos4 + 3];\n }\n get sourceLayerIndex() {\n return this._structArray.uint16[this._pos2 + 8];\n }\n get bucketIndex() {\n return this._structArray.uint16[this._pos2 + 9];\n }\n get anchorPoint() {\n return new s(this.anchorPointX, this.anchorPointY);\n }\n }\n Es.prototype.size = 20;\n class Fs extends bs {\n get(t4) {\n return new Es(this, t4);\n }\n }\n wi(\"CollisionBoxArray\", Fs);\n class Ts extends as {\n get anchorX() {\n return this._structArray.int16[this._pos2 + 0];\n }\n get anchorY() {\n return this._structArray.int16[this._pos2 + 1];\n }\n get glyphStartIndex() {\n return this._structArray.uint16[this._pos2 + 2];\n }\n get numGlyphs() {\n return this._structArray.uint16[this._pos2 + 3];\n }\n get vertexStartIndex() {\n return this._structArray.uint32[this._pos4 + 2];\n }\n get lineStartIndex() {\n return this._structArray.uint32[this._pos4 + 3];\n }\n get lineLength() {\n return this._structArray.uint32[this._pos4 + 4];\n }\n get segment() {\n return this._structArray.uint16[this._pos2 + 10];\n }\n get lowerSize() {\n return this._structArray.uint16[this._pos2 + 11];\n }\n get upperSize() {\n return this._structArray.uint16[this._pos2 + 12];\n }\n get lineOffsetX() {\n return this._structArray.float32[this._pos4 + 7];\n }\n get lineOffsetY() {\n return this._structArray.float32[this._pos4 + 8];\n }\n get writingMode() {\n return this._structArray.uint8[this._pos1 + 36];\n }\n get placedOrientation() {\n return this._structArray.uint8[this._pos1 + 37];\n }\n set placedOrientation(t4) {\n this._structArray.uint8[this._pos1 + 37] = t4;\n }\n get hidden() {\n return this._structArray.uint8[this._pos1 + 38];\n }\n set hidden(t4) {\n this._structArray.uint8[this._pos1 + 38] = t4;\n }\n get crossTileID() {\n return this._structArray.uint32[this._pos4 + 10];\n }\n set crossTileID(t4) {\n this._structArray.uint32[this._pos4 + 10] = t4;\n }\n get associatedIconIndex() {\n return this._structArray.int16[this._pos2 + 22];\n }\n }\n Ts.prototype.size = 48;\n class $s extends ks {\n get(t4) {\n return new Ts(this, t4);\n }\n }\n wi(\"PlacedSymbolArray\", $s);\n class Ls extends as {\n get anchorX() {\n return this._structArray.int16[this._pos2 + 0];\n }\n get anchorY() {\n return this._structArray.int16[this._pos2 + 1];\n }\n get rightJustifiedTextSymbolIndex() {\n return this._structArray.int16[this._pos2 + 2];\n }\n get centerJustifiedTextSymbolIndex() {\n return this._structArray.int16[this._pos2 + 3];\n }\n get leftJustifiedTextSymbolIndex() {\n return this._structArray.int16[this._pos2 + 4];\n }\n get verticalPlacedTextSymbolIndex() {\n return this._structArray.int16[this._pos2 + 5];\n }\n get placedIconSymbolIndex() {\n return this._structArray.int16[this._pos2 + 6];\n }\n get verticalPlacedIconSymbolIndex() {\n return this._structArray.int16[this._pos2 + 7];\n }\n get key() {\n return this._structArray.uint16[this._pos2 + 8];\n }\n get textBoxStartIndex() {\n return this._structArray.uint16[this._pos2 + 9];\n }\n get textBoxEndIndex() {\n return this._structArray.uint16[this._pos2 + 10];\n }\n get verticalTextBoxStartIndex() {\n return this._structArray.uint16[this._pos2 + 11];\n }\n get verticalTextBoxEndIndex() {\n return this._structArray.uint16[this._pos2 + 12];\n }\n get iconBoxStartIndex() {\n return this._structArray.uint16[this._pos2 + 13];\n }\n get iconBoxEndIndex() {\n return this._structArray.uint16[this._pos2 + 14];\n }\n get verticalIconBoxStartIndex() {\n return this._structArray.uint16[this._pos2 + 15];\n }\n get verticalIconBoxEndIndex() {\n return this._structArray.uint16[this._pos2 + 16];\n }\n get featureIndex() {\n return this._structArray.uint16[this._pos2 + 17];\n }\n get numHorizontalGlyphVertices() {\n return this._structArray.uint16[this._pos2 + 18];\n }\n get numVerticalGlyphVertices() {\n return this._structArray.uint16[this._pos2 + 19];\n }\n get numIconVertices() {\n return this._structArray.uint16[this._pos2 + 20];\n }\n get numVerticalIconVertices() {\n return this._structArray.uint16[this._pos2 + 21];\n }\n get useRuntimeCollisionCircles() {\n return this._structArray.uint16[this._pos2 + 22];\n }\n get crossTileID() {\n return this._structArray.uint32[this._pos4 + 12];\n }\n set crossTileID(t4) {\n this._structArray.uint32[this._pos4 + 12] = t4;\n }\n get textBoxScale() {\n return this._structArray.float32[this._pos4 + 13];\n }\n get collisionCircleDiameter() {\n return this._structArray.float32[this._pos4 + 14];\n }\n get textAnchorOffsetStartIndex() {\n return this._structArray.uint16[this._pos2 + 30];\n }\n get textAnchorOffsetEndIndex() {\n return this._structArray.uint16[this._pos2 + 31];\n }\n }\n Ls.prototype.size = 64;\n class Ds extends Ms {\n get(t4) {\n return new Ls(this, t4);\n }\n }\n wi(\"SymbolInstanceArray\", Ds);\n class Os extends Is {\n getoffsetX(t4) {\n return this.float32[1 * t4 + 0];\n }\n }\n wi(\"GlyphOffsetArray\", Os);\n class js extends hs {\n getx(t4) {\n return this.int16[3 * t4 + 0];\n }\n gety(t4) {\n return this.int16[3 * t4 + 1];\n }\n gettileUnitDistanceFromAnchor(t4) {\n return this.int16[3 * t4 + 2];\n }\n }\n wi(\"SymbolLineVertexArray\", js);\n class Rs extends as {\n get textAnchor() {\n return this._structArray.uint16[this._pos2 + 0];\n }\n get textOffset0() {\n return this._structArray.float32[this._pos4 + 1];\n }\n get textOffset1() {\n return this._structArray.float32[this._pos4 + 2];\n }\n }\n Rs.prototype.size = 12;\n class Us extends zs {\n get(t4) {\n return new Rs(this, t4);\n }\n }\n wi(\"TextAnchorOffsetArray\", Us);\n class qs extends as {\n get featureIndex() {\n return this._structArray.uint32[this._pos4 + 0];\n }\n get sourceLayerIndex() {\n return this._structArray.uint16[this._pos2 + 2];\n }\n get bucketIndex() {\n return this._structArray.uint16[this._pos2 + 3];\n }\n }\n qs.prototype.size = 8;\n class Ns extends Ps {\n get(t4) {\n return new qs(this, t4);\n }\n }\n wi(\"FeatureIndexArray\", Ns);\n class Zs extends cs {\n }\n class Gs extends cs {\n }\n class Ks extends cs {\n }\n class Xs extends fs {\n }\n class Hs extends ds {\n }\n class Ys extends ys {\n }\n class Js extends ms {\n }\n class Ws extends gs {\n }\n class Qs extends xs {\n }\n class ta extends vs {\n }\n class ea extends ws {\n }\n class ra extends As {\n }\n class na extends Ss {\n }\n class ia extends Cs {\n }\n const sa = ls([{ name: \"a_pos\", components: 2, type: \"Int16\" }], 4), { members: aa } = sa;\n class oa {\n constructor(t4 = []) {\n this.segments = t4;\n }\n prepareSegment(t4, e2, r2, n2) {\n let i2 = this.segments[this.segments.length - 1];\n return t4 > oa.MAX_VERTEX_ARRAY_LENGTH && A2(`Max vertices per segment is ${oa.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t4}`), (!i2 || i2.vertexLength + t4 > oa.MAX_VERTEX_ARRAY_LENGTH || i2.sortKey !== n2) && (i2 = { vertexOffset: e2.length, primitiveOffset: r2.length, vertexLength: 0, primitiveLength: 0 }, void 0 !== n2 && (i2.sortKey = n2), this.segments.push(i2)), i2;\n }\n get() {\n return this.segments;\n }\n destroy() {\n for (const t4 of this.segments) for (const e2 in t4.vaos) t4.vaos[e2].destroy();\n }\n static simpleSegment(t4, e2, r2, n2) {\n return new oa([{ vertexOffset: t4, primitiveOffset: e2, vertexLength: r2, primitiveLength: n2, vaos: {}, sortKey: 0 }]);\n }\n }\n function la(t4, e2) {\n return 256 * (t4 = y(Math.floor(t4), 0, 255)) + y(Math.floor(e2), 0, 255);\n }\n oa.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1, wi(\"SegmentVector\", oa);\n const ua = ls([{ name: \"a_pattern_from\", components: 4, type: \"Uint16\" }, { name: \"a_pattern_to\", components: 4, type: \"Uint16\" }, { name: \"a_pixel_ratio_from\", components: 1, type: \"Uint16\" }, { name: \"a_pixel_ratio_to\", components: 1, type: \"Uint16\" }]);\n var ca = { exports: {} }, ha = { exports: {} };\n ha.exports = function(t4, e2) {\n var r2, n2, i2, s2, a2, o2, l2, u2;\n for (n2 = t4.length - (r2 = 3 & t4.length), i2 = e2, a2 = 3432918353, o2 = 461845907, u2 = 0; u2 < n2; ) l2 = 255 & t4.charCodeAt(u2) | (255 & t4.charCodeAt(++u2)) << 8 | (255 & t4.charCodeAt(++u2)) << 16 | (255 & t4.charCodeAt(++u2)) << 24, ++u2, i2 = 27492 + (65535 & (s2 = 5 * (65535 & (i2 = (i2 ^= l2 = (65535 & (l2 = (l2 = (65535 & l2) * a2 + (((l2 >>> 16) * a2 & 65535) << 16) & 4294967295) << 15 | l2 >>> 17)) * o2 + (((l2 >>> 16) * o2 & 65535) << 16) & 4294967295) << 13 | i2 >>> 19)) + ((5 * (i2 >>> 16) & 65535) << 16) & 4294967295)) + ((58964 + (s2 >>> 16) & 65535) << 16);\n switch (l2 = 0, r2) {\n case 3:\n l2 ^= (255 & t4.charCodeAt(u2 + 2)) << 16;\n case 2:\n l2 ^= (255 & t4.charCodeAt(u2 + 1)) << 8;\n case 1:\n i2 ^= l2 = (65535 & (l2 = (l2 = (65535 & (l2 ^= 255 & t4.charCodeAt(u2))) * a2 + (((l2 >>> 16) * a2 & 65535) << 16) & 4294967295) << 15 | l2 >>> 17)) * o2 + (((l2 >>> 16) * o2 & 65535) << 16) & 4294967295;\n }\n return i2 ^= t4.length, i2 = 2246822507 * (65535 & (i2 ^= i2 >>> 16)) + ((2246822507 * (i2 >>> 16) & 65535) << 16) & 4294967295, i2 = 3266489909 * (65535 & (i2 ^= i2 >>> 13)) + ((3266489909 * (i2 >>> 16) & 65535) << 16) & 4294967295, (i2 ^= i2 >>> 16) >>> 0;\n };\n var pa = ha.exports, fa = { exports: {} };\n fa.exports = function(t4, e2) {\n for (var r2, n2 = t4.length, i2 = e2 ^ n2, s2 = 0; n2 >= 4; ) r2 = 1540483477 * (65535 & (r2 = 255 & t4.charCodeAt(s2) | (255 & t4.charCodeAt(++s2)) << 8 | (255 & t4.charCodeAt(++s2)) << 16 | (255 & t4.charCodeAt(++s2)) << 24)) + ((1540483477 * (r2 >>> 16) & 65535) << 16), i2 = 1540483477 * (65535 & i2) + ((1540483477 * (i2 >>> 16) & 65535) << 16) ^ (r2 = 1540483477 * (65535 & (r2 ^= r2 >>> 24)) + ((1540483477 * (r2 >>> 16) & 65535) << 16)), n2 -= 4, ++s2;\n switch (n2) {\n case 3:\n i2 ^= (255 & t4.charCodeAt(s2 + 2)) << 16;\n case 2:\n i2 ^= (255 & t4.charCodeAt(s2 + 1)) << 8;\n case 1:\n i2 = 1540483477 * (65535 & (i2 ^= 255 & t4.charCodeAt(s2))) + ((1540483477 * (i2 >>> 16) & 65535) << 16);\n }\n return i2 = 1540483477 * (65535 & (i2 ^= i2 >>> 13)) + ((1540483477 * (i2 >>> 16) & 65535) << 16), (i2 ^= i2 >>> 15) >>> 0;\n };\n var da = pa, ya = fa.exports;\n ca.exports = da, ca.exports.murmur3 = da, ca.exports.murmur2 = ya;\n var ma = r(ca.exports);\n class ga {\n constructor() {\n this.ids = [], this.positions = [], this.indexed = false;\n }\n add(t4, e2, r2, n2) {\n this.ids.push(xa(t4)), this.positions.push(e2, r2, n2);\n }\n getPositions(t4) {\n if (!this.indexed) throw new Error(\"Trying to get index, but feature positions are not indexed\");\n const e2 = xa(t4);\n let r2 = 0, n2 = this.ids.length - 1;\n for (; r2 < n2; ) {\n const t5 = r2 + n2 >> 1;\n this.ids[t5] >= e2 ? n2 = t5 : r2 = t5 + 1;\n }\n const i2 = [];\n for (; this.ids[r2] === e2; ) i2.push({ index: this.positions[3 * r2], start: this.positions[3 * r2 + 1], end: this.positions[3 * r2 + 2] }), r2++;\n return i2;\n }\n static serialize(t4, e2) {\n const r2 = new Float64Array(t4.ids), n2 = new Uint32Array(t4.positions);\n return va(r2, n2, 0, r2.length - 1), e2 && e2.push(r2.buffer, n2.buffer), { ids: r2, positions: n2 };\n }\n static deserialize(t4) {\n const e2 = new ga();\n return e2.ids = t4.ids, e2.positions = t4.positions, e2.indexed = true, e2;\n }\n }\n function xa(t4) {\n const e2 = +t4;\n return !isNaN(e2) && e2 <= Number.MAX_SAFE_INTEGER ? e2 : ma(String(t4));\n }\n function va(t4, e2, r2, n2) {\n for (; r2 < n2; ) {\n const i2 = t4[r2 + n2 >> 1];\n let s2 = r2 - 1, a2 = n2 + 1;\n for (; ; ) {\n do {\n s2++;\n } while (t4[s2] < i2);\n do {\n a2--;\n } while (t4[a2] > i2);\n if (s2 >= a2) break;\n ba(t4, s2, a2), ba(e2, 3 * s2, 3 * a2), ba(e2, 3 * s2 + 1, 3 * a2 + 1), ba(e2, 3 * s2 + 2, 3 * a2 + 2);\n }\n a2 - r2 < n2 - a2 ? (va(t4, e2, r2, a2), r2 = a2 + 1) : (va(t4, e2, a2 + 1, n2), n2 = a2);\n }\n }\n function ba(t4, e2, r2) {\n const n2 = t4[e2];\n t4[e2] = t4[r2], t4[r2] = n2;\n }\n wi(\"FeaturePositionMap\", ga);\n class wa {\n constructor(t4, e2) {\n this.gl = t4.gl, this.location = e2;\n }\n }\n class _a extends wa {\n constructor(t4, e2) {\n super(t4, e2), this.current = 0;\n }\n set(t4) {\n this.current !== t4 && (this.current = t4, this.gl.uniform1f(this.location, t4));\n }\n }\n class Aa extends wa {\n constructor(t4, e2) {\n super(t4, e2), this.current = [0, 0, 0, 0];\n }\n set(t4) {\n t4[0] === this.current[0] && t4[1] === this.current[1] && t4[2] === this.current[2] && t4[3] === this.current[3] || (this.current = t4, this.gl.uniform4f(this.location, t4[0], t4[1], t4[2], t4[3]));\n }\n }\n class Sa extends wa {\n constructor(t4, e2) {\n super(t4, e2), this.current = Kt.transparent;\n }\n set(t4) {\n t4.r === this.current.r && t4.g === this.current.g && t4.b === this.current.b && t4.a === this.current.a || (this.current = t4, this.gl.uniform4f(this.location, t4.r, t4.g, t4.b, t4.a));\n }\n }\n const ka = new Float32Array(16);\n function Ma(t4) {\n return [la(255 * t4.r, 255 * t4.g), la(255 * t4.b, 255 * t4.a)];\n }\n class Ia {\n constructor(t4, e2, r2) {\n this.value = t4, this.uniformNames = e2.map((t5) => `u_${t5}`), this.type = r2;\n }\n setUniform(t4, e2, r2) {\n t4.set(r2.constantOr(this.value));\n }\n getBinding(t4, e2, r2) {\n return \"color\" === this.type ? new Sa(t4, e2) : new _a(t4, e2);\n }\n }\n class za {\n constructor(t4, e2) {\n this.uniformNames = e2.map((t5) => `u_${t5}`), this.patternFrom = null, this.patternTo = null, this.pixelRatioFrom = 1, this.pixelRatioTo = 1;\n }\n setConstantPatternPositions(t4, e2) {\n this.pixelRatioFrom = e2.pixelRatio, this.pixelRatioTo = t4.pixelRatio, this.patternFrom = e2.tlbr, this.patternTo = t4.tlbr;\n }\n setUniform(t4, e2, r2, n2) {\n const i2 = \"u_pattern_to\" === n2 ? this.patternTo : \"u_pattern_from\" === n2 ? this.patternFrom : \"u_pixel_ratio_to\" === n2 ? this.pixelRatioTo : \"u_pixel_ratio_from\" === n2 ? this.pixelRatioFrom : null;\n i2 && t4.set(i2);\n }\n getBinding(t4, e2, r2) {\n return \"u_pattern\" === r2.substr(0, 9) ? new Aa(t4, e2) : new _a(t4, e2);\n }\n }\n class Pa {\n constructor(t4, e2, r2, n2) {\n this.expression = t4, this.type = r2, this.maxValue = 0, this.paintVertexAttributes = e2.map((t5) => ({ name: `a_${t5}`, type: \"Float32\", components: \"color\" === r2 ? 2 : 1, offset: 0 })), this.paintVertexArray = new n2();\n }\n populatePaintArray(t4, e2, r2, n2, i2) {\n const s2 = this.paintVertexArray.length, a2 = this.expression.evaluate(new Ui(0), e2, {}, n2, [], i2);\n this.paintVertexArray.resize(t4), this._setPaintValue(s2, t4, a2);\n }\n updatePaintArray(t4, e2, r2, n2) {\n const i2 = this.expression.evaluate({ zoom: 0 }, r2, n2);\n this._setPaintValue(t4, e2, i2);\n }\n _setPaintValue(t4, e2, r2) {\n if (\"color\" === this.type) {\n const n2 = Ma(r2);\n for (let r3 = t4; r3 < e2; r3++) this.paintVertexArray.emplace(r3, n2[0], n2[1]);\n } else {\n for (let n2 = t4; n2 < e2; n2++) this.paintVertexArray.emplace(n2, r2);\n this.maxValue = Math.max(this.maxValue, Math.abs(r2));\n }\n }\n upload(t4) {\n this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = t4.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent));\n }\n destroy() {\n this.paintVertexBuffer && this.paintVertexBuffer.destroy();\n }\n }\n class Ca {\n constructor(t4, e2, r2, n2, i2, s2) {\n this.expression = t4, this.uniformNames = e2.map((t5) => `u_${t5}_t`), this.type = r2, this.useIntegerZoom = n2, this.zoom = i2, this.maxValue = 0, this.paintVertexAttributes = e2.map((t5) => ({ name: `a_${t5}`, type: \"Float32\", components: \"color\" === r2 ? 4 : 2, offset: 0 })), this.paintVertexArray = new s2();\n }\n populatePaintArray(t4, e2, r2, n2, i2) {\n const s2 = this.expression.evaluate(new Ui(this.zoom), e2, {}, n2, [], i2), a2 = this.expression.evaluate(new Ui(this.zoom + 1), e2, {}, n2, [], i2), o2 = this.paintVertexArray.length;\n this.paintVertexArray.resize(t4), this._setPaintValue(o2, t4, s2, a2);\n }\n updatePaintArray(t4, e2, r2, n2) {\n const i2 = this.expression.evaluate({ zoom: this.zoom }, r2, n2), s2 = this.expression.evaluate({ zoom: this.zoom + 1 }, r2, n2);\n this._setPaintValue(t4, e2, i2, s2);\n }\n _setPaintValue(t4, e2, r2, n2) {\n if (\"color\" === this.type) {\n const i2 = Ma(r2), s2 = Ma(n2);\n for (let r3 = t4; r3 < e2; r3++) this.paintVertexArray.emplace(r3, i2[0], i2[1], s2[0], s2[1]);\n } else {\n for (let i2 = t4; i2 < e2; i2++) this.paintVertexArray.emplace(i2, r2, n2);\n this.maxValue = Math.max(this.maxValue, Math.abs(r2), Math.abs(n2));\n }\n }\n upload(t4) {\n this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = t4.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent));\n }\n destroy() {\n this.paintVertexBuffer && this.paintVertexBuffer.destroy();\n }\n setUniform(t4, e2) {\n const r2 = this.useIntegerZoom ? Math.floor(e2.zoom) : e2.zoom, n2 = y(this.expression.interpolationFactor(r2, this.zoom, this.zoom + 1), 0, 1);\n t4.set(n2);\n }\n getBinding(t4, e2, r2) {\n return new _a(t4, e2);\n }\n }\n class Ba {\n constructor(t4, e2, r2, n2, i2, s2) {\n this.expression = t4, this.type = e2, this.useIntegerZoom = r2, this.zoom = n2, this.layerId = s2, this.zoomInPaintVertexArray = new i2(), this.zoomOutPaintVertexArray = new i2();\n }\n populatePaintArray(t4, e2, r2) {\n const n2 = this.zoomInPaintVertexArray.length;\n this.zoomInPaintVertexArray.resize(t4), this.zoomOutPaintVertexArray.resize(t4), this._setPaintValues(n2, t4, e2.patterns && e2.patterns[this.layerId], r2);\n }\n updatePaintArray(t4, e2, r2, n2, i2) {\n this._setPaintValues(t4, e2, r2.patterns && r2.patterns[this.layerId], i2);\n }\n _setPaintValues(t4, e2, r2, n2) {\n if (!n2 || !r2) return;\n const { min: i2, mid: s2, max: a2 } = r2, o2 = n2[i2], l2 = n2[s2], u2 = n2[a2];\n if (o2 && l2 && u2) for (let r3 = t4; r3 < e2; r3++) this.zoomInPaintVertexArray.emplace(r3, l2.tl[0], l2.tl[1], l2.br[0], l2.br[1], o2.tl[0], o2.tl[1], o2.br[0], o2.br[1], l2.pixelRatio, o2.pixelRatio), this.zoomOutPaintVertexArray.emplace(r3, l2.tl[0], l2.tl[1], l2.br[0], l2.br[1], u2.tl[0], u2.tl[1], u2.br[0], u2.br[1], l2.pixelRatio, u2.pixelRatio);\n }\n upload(t4) {\n this.zoomInPaintVertexArray && this.zoomInPaintVertexArray.arrayBuffer && this.zoomOutPaintVertexArray && this.zoomOutPaintVertexArray.arrayBuffer && (this.zoomInPaintVertexBuffer = t4.createVertexBuffer(this.zoomInPaintVertexArray, ua.members, this.expression.isStateDependent), this.zoomOutPaintVertexBuffer = t4.createVertexBuffer(this.zoomOutPaintVertexArray, ua.members, this.expression.isStateDependent));\n }\n destroy() {\n this.zoomOutPaintVertexBuffer && this.zoomOutPaintVertexBuffer.destroy(), this.zoomInPaintVertexBuffer && this.zoomInPaintVertexBuffer.destroy();\n }\n }\n class Va {\n constructor(t4, e2, r2) {\n this.binders = {}, this._buffers = [];\n const n2 = [];\n for (const i2 in t4.paint._values) {\n if (!r2(i2)) continue;\n const s2 = t4.paint.get(i2);\n if (!(s2 instanceof Hi && an(s2.property.specification))) continue;\n const a2 = Fa(i2, t4.type), o2 = s2.value, l2 = s2.property.specification.type, u2 = s2.property.useIntegerZoom, c2 = s2.property.specification[\"property-type\"], h2 = \"cross-faded\" === c2 || \"cross-faded-data-driven\" === c2;\n if (\"constant\" === o2.kind) this.binders[i2] = h2 ? new za(o2.value, a2) : new Ia(o2.value, a2, l2), n2.push(`/u_${i2}`);\n else if (\"source\" === o2.kind || h2) {\n const r3 = Ta(i2, l2, \"source\");\n this.binders[i2] = h2 ? new Ba(o2, l2, u2, e2, r3, t4.id) : new Pa(o2, a2, l2, r3), n2.push(`/a_${i2}`);\n } else {\n const t5 = Ta(i2, l2, \"composite\");\n this.binders[i2] = new Ca(o2, a2, l2, u2, e2, t5), n2.push(`/z_${i2}`);\n }\n }\n this.cacheKey = n2.sort().join(\"\");\n }\n getMaxValue(t4) {\n const e2 = this.binders[t4];\n return e2 instanceof Pa || e2 instanceof Ca ? e2.maxValue : 0;\n }\n populatePaintArrays(t4, e2, r2, n2, i2) {\n for (const s2 in this.binders) {\n const a2 = this.binders[s2];\n (a2 instanceof Pa || a2 instanceof Ca || a2 instanceof Ba) && a2.populatePaintArray(t4, e2, r2, n2, i2);\n }\n }\n setConstantPatternPositions(t4, e2) {\n for (const r2 in this.binders) {\n const n2 = this.binders[r2];\n n2 instanceof za && n2.setConstantPatternPositions(t4, e2);\n }\n }\n updatePaintArrays(t4, e2, r2, n2, i2) {\n let s2 = false;\n for (const a2 in t4) {\n const o2 = e2.getPositions(a2);\n for (const e3 of o2) {\n const o3 = r2.feature(e3.index);\n for (const r3 in this.binders) {\n const l2 = this.binders[r3];\n if ((l2 instanceof Pa || l2 instanceof Ca || l2 instanceof Ba) && true === l2.expression.isStateDependent) {\n const u2 = n2.paint.get(r3);\n l2.expression = u2.value, l2.updatePaintArray(e3.start, e3.end, o3, t4[a2], i2), s2 = true;\n }\n }\n }\n }\n return s2;\n }\n defines() {\n const t4 = [];\n for (const e2 in this.binders) {\n const r2 = this.binders[e2];\n (r2 instanceof Ia || r2 instanceof za) && t4.push(...r2.uniformNames.map((t5) => `#define HAS_UNIFORM_${t5}`));\n }\n return t4;\n }\n getBinderAttributes() {\n const t4 = [];\n for (const e2 in this.binders) {\n const r2 = this.binders[e2];\n if (r2 instanceof Pa || r2 instanceof Ca) for (let e3 = 0; e3 < r2.paintVertexAttributes.length; e3++) t4.push(r2.paintVertexAttributes[e3].name);\n else if (r2 instanceof Ba) for (let e3 = 0; e3 < ua.members.length; e3++) t4.push(ua.members[e3].name);\n }\n return t4;\n }\n getBinderUniforms() {\n const t4 = [];\n for (const e2 in this.binders) {\n const r2 = this.binders[e2];\n if (r2 instanceof Ia || r2 instanceof za || r2 instanceof Ca) for (const e3 of r2.uniformNames) t4.push(e3);\n }\n return t4;\n }\n getPaintVertexBuffers() {\n return this._buffers;\n }\n getUniforms(t4, e2) {\n const r2 = [];\n for (const n2 in this.binders) {\n const i2 = this.binders[n2];\n if (i2 instanceof Ia || i2 instanceof za || i2 instanceof Ca) {\n for (const s2 of i2.uniformNames) if (e2[s2]) {\n const a2 = i2.getBinding(t4, e2[s2], s2);\n r2.push({ name: s2, property: n2, binding: a2 });\n }\n }\n }\n return r2;\n }\n setUniforms(t4, e2, r2, n2) {\n for (const { name: t5, property: i2, binding: s2 } of e2) this.binders[i2].setUniform(s2, n2, r2.get(i2), t5);\n }\n updatePaintBuffers(t4) {\n this._buffers = [];\n for (const e2 in this.binders) {\n const r2 = this.binders[e2];\n if (t4 && r2 instanceof Ba) {\n const e3 = 2 === t4.fromScale ? r2.zoomInPaintVertexBuffer : r2.zoomOutPaintVertexBuffer;\n e3 && this._buffers.push(e3);\n } else (r2 instanceof Pa || r2 instanceof Ca) && r2.paintVertexBuffer && this._buffers.push(r2.paintVertexBuffer);\n }\n }\n upload(t4) {\n for (const e2 in this.binders) {\n const r2 = this.binders[e2];\n (r2 instanceof Pa || r2 instanceof Ca || r2 instanceof Ba) && r2.upload(t4);\n }\n this.updatePaintBuffers();\n }\n destroy() {\n for (const t4 in this.binders) {\n const e2 = this.binders[t4];\n (e2 instanceof Pa || e2 instanceof Ca || e2 instanceof Ba) && e2.destroy();\n }\n }\n }\n class Ea {\n constructor(t4, e2, r2 = () => true) {\n this.programConfigurations = {};\n for (const n2 of t4) this.programConfigurations[n2.id] = new Va(n2, e2, r2);\n this.needsUpload = false, this._featureMap = new ga(), this._bufferOffset = 0;\n }\n populatePaintArrays(t4, e2, r2, n2, i2, s2) {\n for (const r3 in this.programConfigurations) this.programConfigurations[r3].populatePaintArrays(t4, e2, n2, i2, s2);\n void 0 !== e2.id && this._featureMap.add(e2.id, r2, this._bufferOffset, t4), this._bufferOffset = t4, this.needsUpload = true;\n }\n updatePaintArrays(t4, e2, r2, n2) {\n for (const i2 of r2) this.needsUpload = this.programConfigurations[i2.id].updatePaintArrays(t4, this._featureMap, e2, i2, n2) || this.needsUpload;\n }\n get(t4) {\n return this.programConfigurations[t4];\n }\n upload(t4) {\n if (this.needsUpload) {\n for (const e2 in this.programConfigurations) this.programConfigurations[e2].upload(t4);\n this.needsUpload = false;\n }\n }\n destroy() {\n for (const t4 in this.programConfigurations) this.programConfigurations[t4].destroy();\n }\n }\n function Fa(t4, e2) {\n return { \"text-opacity\": [\"opacity\"], \"icon-opacity\": [\"opacity\"], \"text-color\": [\"fill_color\"], \"icon-color\": [\"fill_color\"], \"text-halo-color\": [\"halo_color\"], \"icon-halo-color\": [\"halo_color\"], \"text-halo-blur\": [\"halo_blur\"], \"icon-halo-blur\": [\"halo_blur\"], \"text-halo-width\": [\"halo_width\"], \"icon-halo-width\": [\"halo_width\"], \"line-gap-width\": [\"gapwidth\"], \"line-pattern\": [\"pattern_to\", \"pattern_from\", \"pixel_ratio_to\", \"pixel_ratio_from\"], \"fill-pattern\": [\"pattern_to\", \"pattern_from\", \"pixel_ratio_to\", \"pixel_ratio_from\"], \"fill-extrusion-pattern\": [\"pattern_to\", \"pattern_from\", \"pixel_ratio_to\", \"pixel_ratio_from\"] }[t4] || [t4.replace(`${e2}-`, \"\").replace(/-/g, \"_\")];\n }\n function Ta(t4, e2, r2) {\n const n2 = { color: { source: ys, composite: Vs }, number: { source: Is, composite: ys } }, i2 = function(t5) {\n return { \"line-pattern\": { source: Js, composite: Js }, \"fill-pattern\": { source: Js, composite: Js }, \"fill-extrusion-pattern\": { source: Js, composite: Js } }[t5];\n }(t4);\n return i2 && i2[r2] || n2[e2][r2];\n }\n wi(\"ConstantBinder\", Ia), wi(\"CrossFadedConstantBinder\", za), wi(\"SourceExpressionBinder\", Pa), wi(\"CrossFadedCompositeBinder\", Ba), wi(\"CompositeExpressionBinder\", Ca), wi(\"ProgramConfiguration\", Va, { omit: [\"_buffers\"] }), wi(\"ProgramConfigurationSet\", Ea);\n const $a = 8192, La = Math.pow(2, 14) - 1, Da = -La - 1;\n function Oa(t4) {\n const e2 = $a / t4.extent, r2 = t4.loadGeometry();\n for (let t5 = 0; t5 < r2.length; t5++) {\n const n2 = r2[t5];\n for (let t6 = 0; t6 < n2.length; t6++) {\n const r3 = n2[t6], i2 = Math.round(r3.x * e2), s2 = Math.round(r3.y * e2);\n r3.x = y(i2, Da, La), r3.y = y(s2, Da, La), (i2 < r3.x || i2 > r3.x + 1 || s2 < r3.y || s2 > r3.y + 1) && A2(\"Geometry exceeds allowed extent, reduce your vector tile buffer size\");\n }\n }\n return r2;\n }\n function ja(t4, e2) {\n return { type: t4.type, id: t4.id, properties: t4.properties, geometry: e2 ? Oa(t4) : [] };\n }\n function Ra(t4, e2, r2, n2, i2) {\n t4.emplaceBack(2 * e2 + (n2 + 1) / 2, 2 * r2 + (i2 + 1) / 2);\n }\n class Ua {\n constructor(t4) {\n this.zoom = t4.zoom, this.overscaling = t4.overscaling, this.layers = t4.layers, this.layerIds = this.layers.map((t5) => t5.id), this.index = t4.index, this.hasPattern = false, this.layoutVertexArray = new Gs(), this.indexArray = new na(), this.segments = new oa(), this.programConfigurations = new Ea(t4.layers, t4.zoom), this.stateDependentLayerIds = this.layers.filter((t5) => t5.isStateDependent()).map((t5) => t5.id);\n }\n populate(t4, e2, r2) {\n const n2 = this.layers[0], i2 = [];\n let s2 = null, a2 = false;\n \"circle\" === n2.type && (s2 = n2.layout.get(\"circle-sort-key\"), a2 = !s2.isConstant());\n for (const { feature: e3, id: n3, index: o2, sourceLayerIndex: l2 } of t4) {\n const t5 = this.layers[0]._featureFilter.needGeometry, u2 = ja(e3, t5);\n if (!this.layers[0]._featureFilter.filter(new Ui(this.zoom), u2, r2)) continue;\n const c2 = a2 ? s2.evaluate(u2, {}, r2) : void 0, h2 = { id: n3, properties: e3.properties, type: e3.type, sourceLayerIndex: l2, index: o2, geometry: t5 ? u2.geometry : Oa(e3), patterns: {}, sortKey: c2 };\n i2.push(h2);\n }\n a2 && i2.sort((t5, e3) => t5.sortKey - e3.sortKey);\n for (const n3 of i2) {\n const { geometry: i3, index: s3, sourceLayerIndex: a3 } = n3, o2 = t4[s3].feature;\n this.addFeature(n3, i3, s3, r2), e2.featureIndex.insert(o2, i3, s3, a3, this.index);\n }\n }\n update(t4, e2, r2) {\n this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(t4, e2, this.stateDependentLayers, r2);\n }\n isEmpty() {\n return 0 === this.layoutVertexArray.length;\n }\n uploadPending() {\n return !this.uploaded || this.programConfigurations.needsUpload;\n }\n upload(t4) {\n this.uploaded || (this.layoutVertexBuffer = t4.createVertexBuffer(this.layoutVertexArray, aa), this.indexBuffer = t4.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(t4), this.uploaded = true;\n }\n destroy() {\n this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy());\n }\n addFeature(t4, e2, r2, n2) {\n for (const r3 of e2) for (const e3 of r3) {\n const r4 = e3.x, n3 = e3.y;\n if (r4 < 0 || r4 >= $a || n3 < 0 || n3 >= $a) continue;\n const i2 = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray, t4.sortKey), s2 = i2.vertexLength;\n Ra(this.layoutVertexArray, r4, n3, -1, -1), Ra(this.layoutVertexArray, r4, n3, 1, -1), Ra(this.layoutVertexArray, r4, n3, 1, 1), Ra(this.layoutVertexArray, r4, n3, -1, 1), this.indexArray.emplaceBack(s2, s2 + 1, s2 + 2), this.indexArray.emplaceBack(s2, s2 + 3, s2 + 2), i2.vertexLength += 4, i2.primitiveLength += 2;\n }\n this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t4, r2, {}, n2);\n }\n }\n function qa(t4, e2) {\n for (let r2 = 0; r2 < t4.length; r2++) if (Wa(e2, t4[r2])) return true;\n for (let r2 = 0; r2 < e2.length; r2++) if (Wa(t4, e2[r2])) return true;\n return !!Ka(t4, e2);\n }\n function Na(t4, e2, r2) {\n return !!Wa(t4, e2) || !!Ha(e2, t4, r2);\n }\n function Za(t4, e2) {\n if (1 === t4.length) return Ja(e2, t4[0]);\n for (let r2 = 0; r2 < e2.length; r2++) {\n const n2 = e2[r2];\n for (let e3 = 0; e3 < n2.length; e3++) if (Wa(t4, n2[e3])) return true;\n }\n for (let r2 = 0; r2 < t4.length; r2++) if (Ja(e2, t4[r2])) return true;\n for (let r2 = 0; r2 < e2.length; r2++) if (Ka(t4, e2[r2])) return true;\n return false;\n }\n function Ga(t4, e2, r2) {\n if (t4.length > 1) {\n if (Ka(t4, e2)) return true;\n for (let n2 = 0; n2 < e2.length; n2++) if (Ha(e2[n2], t4, r2)) return true;\n }\n for (let n2 = 0; n2 < t4.length; n2++) if (Ha(t4[n2], e2, r2)) return true;\n return false;\n }\n function Ka(t4, e2) {\n if (0 === t4.length || 0 === e2.length) return false;\n for (let r2 = 0; r2 < t4.length - 1; r2++) {\n const n2 = t4[r2], i2 = t4[r2 + 1];\n for (let t5 = 0; t5 < e2.length - 1; t5++) if (Xa(n2, i2, e2[t5], e2[t5 + 1])) return true;\n }\n return false;\n }\n function Xa(t4, e2, r2, n2) {\n return S(t4, r2, n2) !== S(e2, r2, n2) && S(t4, e2, r2) !== S(t4, e2, n2);\n }\n function Ha(t4, e2, r2) {\n const n2 = r2 * r2;\n if (1 === e2.length) return t4.distSqr(e2[0]) < n2;\n for (let r3 = 1; r3 < e2.length; r3++) if (Ya(t4, e2[r3 - 1], e2[r3]) < n2) return true;\n return false;\n }\n function Ya(t4, e2, r2) {\n const n2 = e2.distSqr(r2);\n if (0 === n2) return t4.distSqr(e2);\n const i2 = ((t4.x - e2.x) * (r2.x - e2.x) + (t4.y - e2.y) * (r2.y - e2.y)) / n2;\n return t4.distSqr(i2 < 0 ? e2 : i2 > 1 ? r2 : r2.sub(e2)._mult(i2)._add(e2));\n }\n function Ja(t4, e2) {\n let r2, n2, i2, s2 = false;\n for (let a2 = 0; a2 < t4.length; a2++) {\n r2 = t4[a2];\n for (let t5 = 0, a3 = r2.length - 1; t5 < r2.length; a3 = t5++) n2 = r2[t5], i2 = r2[a3], n2.y > e2.y != i2.y > e2.y && e2.x < (i2.x - n2.x) * (e2.y - n2.y) / (i2.y - n2.y) + n2.x && (s2 = !s2);\n }\n return s2;\n }\n function Wa(t4, e2) {\n let r2 = false;\n for (let n2 = 0, i2 = t4.length - 1; n2 < t4.length; i2 = n2++) {\n const s2 = t4[n2], a2 = t4[i2];\n s2.y > e2.y != a2.y > e2.y && e2.x < (a2.x - s2.x) * (e2.y - s2.y) / (a2.y - s2.y) + s2.x && (r2 = !r2);\n }\n return r2;\n }\n function Qa(t4, e2, r2) {\n const n2 = r2[0], i2 = r2[2];\n if (t4.x < n2.x && e2.x < n2.x || t4.x > i2.x && e2.x > i2.x || t4.y < n2.y && e2.y < n2.y || t4.y > i2.y && e2.y > i2.y) return false;\n const s2 = S(t4, e2, r2[0]);\n return s2 !== S(t4, e2, r2[1]) || s2 !== S(t4, e2, r2[2]) || s2 !== S(t4, e2, r2[3]);\n }\n function to(t4, e2, r2) {\n const n2 = e2.paint.get(t4).value;\n return \"constant\" === n2.kind ? n2.value : r2.programConfigurations.get(e2.id).getMaxValue(t4);\n }\n function eo(t4) {\n return Math.sqrt(t4[0] * t4[0] + t4[1] * t4[1]);\n }\n function ro(t4, e2, r2, n2, i2) {\n if (!e2[0] && !e2[1]) return t4;\n const a2 = s.convert(e2)._mult(i2);\n \"viewport\" === r2 && a2._rotate(-n2);\n const o2 = [];\n for (let e3 = 0; e3 < t4.length; e3++) o2.push(t4[e3].sub(a2));\n return o2;\n }\n let no, io;\n wi(\"CircleBucket\", Ua, { omit: [\"layers\"] });\n var so = { get paint() {\n return io = io || new rs({ \"circle-radius\": new Wi(G.paint_circle[\"circle-radius\"]), \"circle-color\": new Wi(G.paint_circle[\"circle-color\"]), \"circle-blur\": new Wi(G.paint_circle[\"circle-blur\"]), \"circle-opacity\": new Wi(G.paint_circle[\"circle-opacity\"]), \"circle-translate\": new Ji(G.paint_circle[\"circle-translate\"]), \"circle-translate-anchor\": new Ji(G.paint_circle[\"circle-translate-anchor\"]), \"circle-pitch-scale\": new Ji(G.paint_circle[\"circle-pitch-scale\"]), \"circle-pitch-alignment\": new Ji(G.paint_circle[\"circle-pitch-alignment\"]), \"circle-stroke-width\": new Wi(G.paint_circle[\"circle-stroke-width\"]), \"circle-stroke-color\": new Wi(G.paint_circle[\"circle-stroke-color\"]), \"circle-stroke-opacity\": new Wi(G.paint_circle[\"circle-stroke-opacity\"]) });\n }, get layout() {\n return no = no || new rs({ \"circle-sort-key\": new Wi(G.layout_circle[\"circle-sort-key\"]) });\n } }, ao = 1e-6, oo = \"undefined\" != typeof Float32Array ? Float32Array : Array;\n function lo(t4) {\n return t4[0] = 1, t4[1] = 0, t4[2] = 0, t4[3] = 0, t4[4] = 0, t4[5] = 1, t4[6] = 0, t4[7] = 0, t4[8] = 0, t4[9] = 0, t4[10] = 1, t4[11] = 0, t4[12] = 0, t4[13] = 0, t4[14] = 0, t4[15] = 1, t4;\n }\n function uo(t4, e2, r2) {\n var n2 = e2[0], i2 = e2[1], s2 = e2[2], a2 = e2[3], o2 = e2[4], l2 = e2[5], u2 = e2[6], c2 = e2[7], h2 = e2[8], p2 = e2[9], f2 = e2[10], d2 = e2[11], y2 = e2[12], m2 = e2[13], g2 = e2[14], x2 = e2[15], v2 = r2[0], b2 = r2[1], w2 = r2[2], _2 = r2[3];\n return t4[0] = v2 * n2 + b2 * o2 + w2 * h2 + _2 * y2, t4[1] = v2 * i2 + b2 * l2 + w2 * p2 + _2 * m2, t4[2] = v2 * s2 + b2 * u2 + w2 * f2 + _2 * g2, t4[3] = v2 * a2 + b2 * c2 + w2 * d2 + _2 * x2, t4[4] = (v2 = r2[4]) * n2 + (b2 = r2[5]) * o2 + (w2 = r2[6]) * h2 + (_2 = r2[7]) * y2, t4[5] = v2 * i2 + b2 * l2 + w2 * p2 + _2 * m2, t4[6] = v2 * s2 + b2 * u2 + w2 * f2 + _2 * g2, t4[7] = v2 * a2 + b2 * c2 + w2 * d2 + _2 * x2, t4[8] = (v2 = r2[8]) * n2 + (b2 = r2[9]) * o2 + (w2 = r2[10]) * h2 + (_2 = r2[11]) * y2, t4[9] = v2 * i2 + b2 * l2 + w2 * p2 + _2 * m2, t4[10] = v2 * s2 + b2 * u2 + w2 * f2 + _2 * g2, t4[11] = v2 * a2 + b2 * c2 + w2 * d2 + _2 * x2, t4[12] = (v2 = r2[12]) * n2 + (b2 = r2[13]) * o2 + (w2 = r2[14]) * h2 + (_2 = r2[15]) * y2, t4[13] = v2 * i2 + b2 * l2 + w2 * p2 + _2 * m2, t4[14] = v2 * s2 + b2 * u2 + w2 * f2 + _2 * g2, t4[15] = v2 * a2 + b2 * c2 + w2 * d2 + _2 * x2, t4;\n }\n Math.hypot || (Math.hypot = function() {\n for (var t4 = 0, e2 = arguments.length; e2--; ) t4 += arguments[e2] * arguments[e2];\n return Math.sqrt(t4);\n });\n var co, ho = uo;\n function po(t4, e2, r2) {\n var n2 = e2[0], i2 = e2[1], s2 = e2[2], a2 = e2[3];\n return t4[0] = r2[0] * n2 + r2[4] * i2 + r2[8] * s2 + r2[12] * a2, t4[1] = r2[1] * n2 + r2[5] * i2 + r2[9] * s2 + r2[13] * a2, t4[2] = r2[2] * n2 + r2[6] * i2 + r2[10] * s2 + r2[14] * a2, t4[3] = r2[3] * n2 + r2[7] * i2 + r2[11] * s2 + r2[15] * a2, t4;\n }\n co = new oo(4), oo != Float32Array && (co[0] = 0, co[1] = 0, co[2] = 0, co[3] = 0);\n class fo extends is {\n constructor(t4) {\n super(t4, so);\n }\n createBucket(t4) {\n return new Ua(t4);\n }\n queryRadius(t4) {\n const e2 = t4;\n return to(\"circle-radius\", this, e2) + to(\"circle-stroke-width\", this, e2) + eo(this.paint.get(\"circle-translate\"));\n }\n queryIntersectsFeature(t4, e2, r2, n2, i2, s2, a2, o2) {\n const l2 = ro(t4, this.paint.get(\"circle-translate\"), this.paint.get(\"circle-translate-anchor\"), s2.angle, a2), u2 = this.paint.get(\"circle-radius\").evaluate(e2, r2) + this.paint.get(\"circle-stroke-width\").evaluate(e2, r2), c2 = \"map\" === this.paint.get(\"circle-pitch-alignment\"), h2 = c2 ? l2 : function(t5, e3) {\n return t5.map((t6) => yo(t6, e3));\n }(l2, o2), p2 = c2 ? u2 * a2 : u2;\n for (const t5 of n2) for (const e3 of t5) {\n const t6 = c2 ? e3 : yo(e3, o2);\n let r3 = p2;\n const n3 = po([], [e3.x, e3.y, 0, 1], o2);\n if (\"viewport\" === this.paint.get(\"circle-pitch-scale\") && \"map\" === this.paint.get(\"circle-pitch-alignment\") ? r3 *= n3[3] / s2.cameraToCenterDistance : \"map\" === this.paint.get(\"circle-pitch-scale\") && \"viewport\" === this.paint.get(\"circle-pitch-alignment\") && (r3 *= s2.cameraToCenterDistance / n3[3]), Na(h2, t6, r3)) return true;\n }\n return false;\n }\n }\n function yo(t4, e2) {\n const r2 = po([], [t4.x, t4.y, 0, 1], e2);\n return new s(r2[0] / r2[3], r2[1] / r2[3]);\n }\n class mo extends Ua {\n }\n let go;\n wi(\"HeatmapBucket\", mo, { omit: [\"layers\"] });\n var xo = { get paint() {\n return go = go || new rs({ \"heatmap-radius\": new Wi(G.paint_heatmap[\"heatmap-radius\"]), \"heatmap-weight\": new Wi(G.paint_heatmap[\"heatmap-weight\"]), \"heatmap-intensity\": new Ji(G.paint_heatmap[\"heatmap-intensity\"]), \"heatmap-color\": new es(G.paint_heatmap[\"heatmap-color\"]), \"heatmap-opacity\": new Ji(G.paint_heatmap[\"heatmap-opacity\"]) });\n } };\n function vo(t4, { width: e2, height: r2 }, n2, i2) {\n if (i2) {\n if (i2 instanceof Uint8ClampedArray) i2 = new Uint8Array(i2.buffer);\n else if (i2.length !== e2 * r2 * n2) throw new RangeError(`mismatched image size. expected: ${i2.length} but got: ${e2 * r2 * n2}`);\n } else i2 = new Uint8Array(e2 * r2 * n2);\n return t4.width = e2, t4.height = r2, t4.data = i2, t4;\n }\n function bo(t4, { width: e2, height: r2 }, n2) {\n if (e2 === t4.width && r2 === t4.height) return;\n const i2 = vo({}, { width: e2, height: r2 }, n2);\n wo(t4, i2, { x: 0, y: 0 }, { x: 0, y: 0 }, { width: Math.min(t4.width, e2), height: Math.min(t4.height, r2) }, n2), t4.width = e2, t4.height = r2, t4.data = i2.data;\n }\n function wo(t4, e2, r2, n2, i2, s2) {\n if (0 === i2.width || 0 === i2.height) return e2;\n if (i2.width > t4.width || i2.height > t4.height || r2.x > t4.width - i2.width || r2.y > t4.height - i2.height) throw new RangeError(\"out of range source coordinates for image copy\");\n if (i2.width > e2.width || i2.height > e2.height || n2.x > e2.width - i2.width || n2.y > e2.height - i2.height) throw new RangeError(\"out of range destination coordinates for image copy\");\n const a2 = t4.data, o2 = e2.data;\n if (a2 === o2) throw new Error(\"srcData equals dstData, so image is already copied\");\n for (let l2 = 0; l2 < i2.height; l2++) {\n const u2 = ((r2.y + l2) * t4.width + r2.x) * s2, c2 = ((n2.y + l2) * e2.width + n2.x) * s2;\n for (let t5 = 0; t5 < i2.width * s2; t5++) o2[c2 + t5] = a2[u2 + t5];\n }\n return e2;\n }\n class _o {\n constructor(t4, e2) {\n vo(this, t4, 1, e2);\n }\n resize(t4) {\n bo(this, t4, 1);\n }\n clone() {\n return new _o({ width: this.width, height: this.height }, new Uint8Array(this.data));\n }\n static copy(t4, e2, r2, n2, i2) {\n wo(t4, e2, r2, n2, i2, 1);\n }\n }\n class Ao {\n constructor(t4, e2) {\n vo(this, t4, 4, e2);\n }\n resize(t4) {\n bo(this, t4, 4);\n }\n replace(t4, e2) {\n e2 ? this.data.set(t4) : this.data = t4 instanceof Uint8ClampedArray ? new Uint8Array(t4.buffer) : t4;\n }\n clone() {\n return new Ao({ width: this.width, height: this.height }, new Uint8Array(this.data));\n }\n static copy(t4, e2, r2, n2, i2) {\n wo(t4, e2, r2, n2, i2, 4);\n }\n }\n function So(t4) {\n const e2 = {}, r2 = t4.resolution || 256, n2 = t4.clips ? t4.clips.length : 1, i2 = t4.image || new Ao({ width: r2, height: n2 });\n if (Math.log(r2) / Math.LN2 % 1 != 0) throw new Error(`width is not a power of 2 - ${r2}`);\n const s2 = (r3, n3, s3) => {\n e2[t4.evaluationKey] = s3;\n const a2 = t4.expression.evaluate(e2);\n i2.data[r3 + n3 + 0] = Math.floor(255 * a2.r / a2.a), i2.data[r3 + n3 + 1] = Math.floor(255 * a2.g / a2.a), i2.data[r3 + n3 + 2] = Math.floor(255 * a2.b / a2.a), i2.data[r3 + n3 + 3] = Math.floor(255 * a2.a);\n };\n if (t4.clips) for (let e3 = 0, i3 = 0; e3 < n2; ++e3, i3 += 4 * r2) for (let n3 = 0, a2 = 0; n3 < r2; n3++, a2 += 4) {\n const o2 = n3 / (r2 - 1), { start: l2, end: u2 } = t4.clips[e3];\n s2(i3, a2, l2 * (1 - o2) + u2 * o2);\n }\n else for (let t5 = 0, e3 = 0; t5 < r2; t5++, e3 += 4) s2(0, e3, t5 / (r2 - 1));\n return i2;\n }\n wi(\"AlphaImage\", _o), wi(\"RGBAImage\", Ao);\n const ko = \"big-fb\";\n class Mo extends is {\n createBucket(t4) {\n return new mo(t4);\n }\n constructor(t4) {\n super(t4, xo), this.heatmapFbos = /* @__PURE__ */ new Map(), this._updateColorRamp();\n }\n _handleSpecialPaintPropertyUpdate(t4) {\n \"heatmap-color\" === t4 && this._updateColorRamp();\n }\n _updateColorRamp() {\n this.colorRamp = So({ expression: this._transitionablePaint._values[\"heatmap-color\"].value.expression, evaluationKey: \"heatmapDensity\", image: this.colorRamp }), this.colorRampTexture = null;\n }\n resize() {\n this.heatmapFbos.has(ko) && this.heatmapFbos.delete(ko);\n }\n queryRadius() {\n return 0;\n }\n queryIntersectsFeature() {\n return false;\n }\n hasOffscreenPass() {\n return 0 !== this.paint.get(\"heatmap-opacity\") && \"none\" !== this.visibility;\n }\n }\n let Io;\n var zo = { get paint() {\n return Io = Io || new rs({ \"hillshade-illumination-direction\": new Ji(G.paint_hillshade[\"hillshade-illumination-direction\"]), \"hillshade-illumination-anchor\": new Ji(G.paint_hillshade[\"hillshade-illumination-anchor\"]), \"hillshade-exaggeration\": new Ji(G.paint_hillshade[\"hillshade-exaggeration\"]), \"hillshade-shadow-color\": new Ji(G.paint_hillshade[\"hillshade-shadow-color\"]), \"hillshade-highlight-color\": new Ji(G.paint_hillshade[\"hillshade-highlight-color\"]), \"hillshade-accent-color\": new Ji(G.paint_hillshade[\"hillshade-accent-color\"]) });\n } };\n class Po extends is {\n constructor(t4) {\n super(t4, zo);\n }\n hasOffscreenPass() {\n return 0 !== this.paint.get(\"hillshade-exaggeration\") && \"none\" !== this.visibility;\n }\n }\n const Co = ls([{ name: \"a_pos\", components: 2, type: \"Int16\" }], 4), { members: Bo } = Co;\n function Vo(t4, e2, r2 = 2) {\n const n2 = e2 && e2.length, i2 = n2 ? e2[0] * r2 : t4.length;\n let s2 = Eo(t4, 0, i2, r2, true);\n const a2 = [];\n if (!s2 || s2.next === s2.prev) return a2;\n let o2, l2, u2;\n if (n2 && (s2 = function(t5, e3, r3, n3) {\n const i3 = [];\n for (let r4 = 0, s3 = e3.length; r4 < s3; r4++) {\n const a3 = Eo(t5, e3[r4] * n3, r4 < s3 - 1 ? e3[r4 + 1] * n3 : t5.length, n3, false);\n a3 === a3.next && (a3.steiner = true), i3.push(No(a3));\n }\n i3.sort(jo);\n for (let t6 = 0; t6 < i3.length; t6++) r3 = Ro(i3[t6], r3);\n return r3;\n }(t4, e2, s2, r2)), t4.length > 80 * r2) {\n o2 = 1 / 0, l2 = 1 / 0;\n let e3 = -1 / 0, n3 = -1 / 0;\n for (let s3 = r2; s3 < i2; s3 += r2) {\n const r3 = t4[s3], i3 = t4[s3 + 1];\n r3 < o2 && (o2 = r3), i3 < l2 && (l2 = i3), r3 > e3 && (e3 = r3), i3 > n3 && (n3 = i3);\n }\n u2 = Math.max(e3 - o2, n3 - l2), u2 = 0 !== u2 ? 32767 / u2 : 0;\n }\n return To(s2, a2, r2, o2, l2, u2, 0), a2;\n }\n function Eo(t4, e2, r2, n2, i2) {\n let s2;\n if (i2 === function(t5, e3, r3, n3) {\n let i3 = 0;\n for (let s3 = e3, a2 = r3 - n3; s3 < r3; s3 += n3) i3 += (t5[a2] - t5[s3]) * (t5[s3 + 1] + t5[a2 + 1]), a2 = s3;\n return i3;\n }(t4, e2, r2, n2) > 0) for (let i3 = e2; i3 < r2; i3 += n2) s2 = tl(i3 / n2 | 0, t4[i3], t4[i3 + 1], s2);\n else for (let i3 = r2 - n2; i3 >= e2; i3 -= n2) s2 = tl(i3 / n2 | 0, t4[i3], t4[i3 + 1], s2);\n return s2 && Xo(s2, s2.next) && (el(s2), s2 = s2.next), s2;\n }\n function Fo(t4, e2) {\n if (!t4) return t4;\n e2 || (e2 = t4);\n let r2, n2 = t4;\n do {\n if (r2 = false, n2.steiner || !Xo(n2, n2.next) && 0 !== Ko(n2.prev, n2, n2.next)) n2 = n2.next;\n else {\n if (el(n2), n2 = e2 = n2.prev, n2 === n2.next) break;\n r2 = true;\n }\n } while (r2 || n2 !== e2);\n return e2;\n }\n function To(t4, e2, r2, n2, i2, s2, a2) {\n if (!t4) return;\n !a2 && s2 && function(t5, e3, r3, n3) {\n let i3 = t5;\n do {\n 0 === i3.z && (i3.z = qo(i3.x, i3.y, e3, r3, n3)), i3.prevZ = i3.prev, i3.nextZ = i3.next, i3 = i3.next;\n } while (i3 !== t5);\n i3.prevZ.nextZ = null, i3.prevZ = null, function(t6) {\n let e4, r4 = 1;\n do {\n let n4, i4 = t6;\n t6 = null;\n let s3 = null;\n for (e4 = 0; i4; ) {\n e4++;\n let a3 = i4, o3 = 0;\n for (let t7 = 0; t7 < r4 && (o3++, a3 = a3.nextZ, a3); t7++) ;\n let l2 = r4;\n for (; o3 > 0 || l2 > 0 && a3; ) 0 !== o3 && (0 === l2 || !a3 || i4.z <= a3.z) ? (n4 = i4, i4 = i4.nextZ, o3--) : (n4 = a3, a3 = a3.nextZ, l2--), s3 ? s3.nextZ = n4 : t6 = n4, n4.prevZ = s3, s3 = n4;\n i4 = a3;\n }\n s3.nextZ = null, r4 *= 2;\n } while (e4 > 1);\n }(i3);\n }(t4, n2, i2, s2);\n let o2 = t4;\n for (; t4.prev !== t4.next; ) {\n const l2 = t4.prev, u2 = t4.next;\n if (s2 ? Lo(t4, n2, i2, s2) : $o(t4)) e2.push(l2.i, t4.i, u2.i), el(t4), t4 = u2.next, o2 = u2.next;\n else if ((t4 = u2) === o2) {\n a2 ? 1 === a2 ? To(t4 = Do(Fo(t4), e2), e2, r2, n2, i2, s2, 2) : 2 === a2 && Oo(t4, e2, r2, n2, i2, s2) : To(Fo(t4), e2, r2, n2, i2, s2, 1);\n break;\n }\n }\n }\n function $o(t4) {\n const e2 = t4.prev, r2 = t4, n2 = t4.next;\n if (Ko(e2, r2, n2) >= 0) return false;\n const i2 = e2.x, s2 = r2.x, a2 = n2.x, o2 = e2.y, l2 = r2.y, u2 = n2.y, c2 = i2 < s2 ? i2 < a2 ? i2 : a2 : s2 < a2 ? s2 : a2, h2 = o2 < l2 ? o2 < u2 ? o2 : u2 : l2 < u2 ? l2 : u2, p2 = i2 > s2 ? i2 > a2 ? i2 : a2 : s2 > a2 ? s2 : a2, f2 = o2 > l2 ? o2 > u2 ? o2 : u2 : l2 > u2 ? l2 : u2;\n let d2 = n2.next;\n for (; d2 !== e2; ) {\n if (d2.x >= c2 && d2.x <= p2 && d2.y >= h2 && d2.y <= f2 && Zo(i2, o2, s2, l2, a2, u2, d2.x, d2.y) && Ko(d2.prev, d2, d2.next) >= 0) return false;\n d2 = d2.next;\n }\n return true;\n }\n function Lo(t4, e2, r2, n2) {\n const i2 = t4.prev, s2 = t4, a2 = t4.next;\n if (Ko(i2, s2, a2) >= 0) return false;\n const o2 = i2.x, l2 = s2.x, u2 = a2.x, c2 = i2.y, h2 = s2.y, p2 = a2.y, f2 = o2 < l2 ? o2 < u2 ? o2 : u2 : l2 < u2 ? l2 : u2, d2 = c2 < h2 ? c2 < p2 ? c2 : p2 : h2 < p2 ? h2 : p2, y2 = o2 > l2 ? o2 > u2 ? o2 : u2 : l2 > u2 ? l2 : u2, m2 = c2 > h2 ? c2 > p2 ? c2 : p2 : h2 > p2 ? h2 : p2, g2 = qo(f2, d2, e2, r2, n2), x2 = qo(y2, m2, e2, r2, n2);\n let v2 = t4.prevZ, b2 = t4.nextZ;\n for (; v2 && v2.z >= g2 && b2 && b2.z <= x2; ) {\n if (v2.x >= f2 && v2.x <= y2 && v2.y >= d2 && v2.y <= m2 && v2 !== i2 && v2 !== a2 && Zo(o2, c2, l2, h2, u2, p2, v2.x, v2.y) && Ko(v2.prev, v2, v2.next) >= 0) return false;\n if (v2 = v2.prevZ, b2.x >= f2 && b2.x <= y2 && b2.y >= d2 && b2.y <= m2 && b2 !== i2 && b2 !== a2 && Zo(o2, c2, l2, h2, u2, p2, b2.x, b2.y) && Ko(b2.prev, b2, b2.next) >= 0) return false;\n b2 = b2.nextZ;\n }\n for (; v2 && v2.z >= g2; ) {\n if (v2.x >= f2 && v2.x <= y2 && v2.y >= d2 && v2.y <= m2 && v2 !== i2 && v2 !== a2 && Zo(o2, c2, l2, h2, u2, p2, v2.x, v2.y) && Ko(v2.prev, v2, v2.next) >= 0) return false;\n v2 = v2.prevZ;\n }\n for (; b2 && b2.z <= x2; ) {\n if (b2.x >= f2 && b2.x <= y2 && b2.y >= d2 && b2.y <= m2 && b2 !== i2 && b2 !== a2 && Zo(o2, c2, l2, h2, u2, p2, b2.x, b2.y) && Ko(b2.prev, b2, b2.next) >= 0) return false;\n b2 = b2.nextZ;\n }\n return true;\n }\n function Do(t4, e2) {\n let r2 = t4;\n do {\n const n2 = r2.prev, i2 = r2.next.next;\n !Xo(n2, i2) && Ho(n2, r2, r2.next, i2) && Wo(n2, i2) && Wo(i2, n2) && (e2.push(n2.i, r2.i, i2.i), el(r2), el(r2.next), r2 = t4 = i2), r2 = r2.next;\n } while (r2 !== t4);\n return Fo(r2);\n }\n function Oo(t4, e2, r2, n2, i2, s2) {\n let a2 = t4;\n do {\n let t5 = a2.next.next;\n for (; t5 !== a2.prev; ) {\n if (a2.i !== t5.i && Go(a2, t5)) {\n let o2 = Qo(a2, t5);\n return a2 = Fo(a2, a2.next), o2 = Fo(o2, o2.next), To(a2, e2, r2, n2, i2, s2, 0), void To(o2, e2, r2, n2, i2, s2, 0);\n }\n t5 = t5.next;\n }\n a2 = a2.next;\n } while (a2 !== t4);\n }\n function jo(t4, e2) {\n return t4.x - e2.x;\n }\n function Ro(t4, e2) {\n const r2 = function(t5, e3) {\n let r3 = e3;\n const n3 = t5.x, i2 = t5.y;\n let s2, a2 = -1 / 0;\n do {\n if (i2 <= r3.y && i2 >= r3.next.y && r3.next.y !== r3.y) {\n const t6 = r3.x + (i2 - r3.y) * (r3.next.x - r3.x) / (r3.next.y - r3.y);\n if (t6 <= n3 && t6 > a2 && (a2 = t6, s2 = r3.x < r3.next.x ? r3 : r3.next, t6 === n3)) return s2;\n }\n r3 = r3.next;\n } while (r3 !== e3);\n if (!s2) return null;\n const o2 = s2, l2 = s2.x, u2 = s2.y;\n let c2 = 1 / 0;\n r3 = s2;\n do {\n if (n3 >= r3.x && r3.x >= l2 && n3 !== r3.x && Zo(i2 < u2 ? n3 : a2, i2, l2, u2, i2 < u2 ? a2 : n3, i2, r3.x, r3.y)) {\n const e4 = Math.abs(i2 - r3.y) / (n3 - r3.x);\n Wo(r3, t5) && (e4 < c2 || e4 === c2 && (r3.x > s2.x || r3.x === s2.x && Uo(s2, r3))) && (s2 = r3, c2 = e4);\n }\n r3 = r3.next;\n } while (r3 !== o2);\n return s2;\n }(t4, e2);\n if (!r2) return e2;\n const n2 = Qo(r2, t4);\n return Fo(n2, n2.next), Fo(r2, r2.next);\n }\n function Uo(t4, e2) {\n return Ko(t4.prev, t4, e2.prev) < 0 && Ko(e2.next, t4, t4.next) < 0;\n }\n function qo(t4, e2, r2, n2, i2) {\n return (t4 = 1431655765 & ((t4 = 858993459 & ((t4 = 252645135 & ((t4 = 16711935 & ((t4 = (t4 - r2) * i2 | 0) | t4 << 8)) | t4 << 4)) | t4 << 2)) | t4 << 1)) | (e2 = 1431655765 & ((e2 = 858993459 & ((e2 = 252645135 & ((e2 = 16711935 & ((e2 = (e2 - n2) * i2 | 0) | e2 << 8)) | e2 << 4)) | e2 << 2)) | e2 << 1)) << 1;\n }\n function No(t4) {\n let e2 = t4, r2 = t4;\n do {\n (e2.x < r2.x || e2.x === r2.x && e2.y < r2.y) && (r2 = e2), e2 = e2.next;\n } while (e2 !== t4);\n return r2;\n }\n function Zo(t4, e2, r2, n2, i2, s2, a2, o2) {\n return (i2 - a2) * (e2 - o2) >= (t4 - a2) * (s2 - o2) && (t4 - a2) * (n2 - o2) >= (r2 - a2) * (e2 - o2) && (r2 - a2) * (s2 - o2) >= (i2 - a2) * (n2 - o2);\n }\n function Go(t4, e2) {\n return t4.next.i !== e2.i && t4.prev.i !== e2.i && !function(t5, e3) {\n let r2 = t5;\n do {\n if (r2.i !== t5.i && r2.next.i !== t5.i && r2.i !== e3.i && r2.next.i !== e3.i && Ho(r2, r2.next, t5, e3)) return true;\n r2 = r2.next;\n } while (r2 !== t5);\n return false;\n }(t4, e2) && (Wo(t4, e2) && Wo(e2, t4) && function(t5, e3) {\n let r2 = t5, n2 = false;\n const i2 = (t5.x + e3.x) / 2, s2 = (t5.y + e3.y) / 2;\n do {\n r2.y > s2 != r2.next.y > s2 && r2.next.y !== r2.y && i2 < (r2.next.x - r2.x) * (s2 - r2.y) / (r2.next.y - r2.y) + r2.x && (n2 = !n2), r2 = r2.next;\n } while (r2 !== t5);\n return n2;\n }(t4, e2) && (Ko(t4.prev, t4, e2.prev) || Ko(t4, e2.prev, e2)) || Xo(t4, e2) && Ko(t4.prev, t4, t4.next) > 0 && Ko(e2.prev, e2, e2.next) > 0);\n }\n function Ko(t4, e2, r2) {\n return (e2.y - t4.y) * (r2.x - e2.x) - (e2.x - t4.x) * (r2.y - e2.y);\n }\n function Xo(t4, e2) {\n return t4.x === e2.x && t4.y === e2.y;\n }\n function Ho(t4, e2, r2, n2) {\n const i2 = Jo(Ko(t4, e2, r2)), s2 = Jo(Ko(t4, e2, n2)), a2 = Jo(Ko(r2, n2, t4)), o2 = Jo(Ko(r2, n2, e2));\n return i2 !== s2 && a2 !== o2 || !(0 !== i2 || !Yo(t4, r2, e2)) || !(0 !== s2 || !Yo(t4, n2, e2)) || !(0 !== a2 || !Yo(r2, t4, n2)) || !(0 !== o2 || !Yo(r2, e2, n2));\n }\n function Yo(t4, e2, r2) {\n return e2.x <= Math.max(t4.x, r2.x) && e2.x >= Math.min(t4.x, r2.x) && e2.y <= Math.max(t4.y, r2.y) && e2.y >= Math.min(t4.y, r2.y);\n }\n function Jo(t4) {\n return t4 > 0 ? 1 : t4 < 0 ? -1 : 0;\n }\n function Wo(t4, e2) {\n return Ko(t4.prev, t4, t4.next) < 0 ? Ko(t4, e2, t4.next) >= 0 && Ko(t4, t4.prev, e2) >= 0 : Ko(t4, e2, t4.prev) < 0 || Ko(t4, t4.next, e2) < 0;\n }\n function Qo(t4, e2) {\n const r2 = rl(t4.i, t4.x, t4.y), n2 = rl(e2.i, e2.x, e2.y), i2 = t4.next, s2 = e2.prev;\n return t4.next = e2, e2.prev = t4, r2.next = i2, i2.prev = r2, n2.next = r2, r2.prev = n2, s2.next = n2, n2.prev = s2, n2;\n }\n function tl(t4, e2, r2, n2) {\n const i2 = rl(t4, e2, r2);\n return n2 ? (i2.next = n2.next, i2.prev = n2, n2.next.prev = i2, n2.next = i2) : (i2.prev = i2, i2.next = i2), i2;\n }\n function el(t4) {\n t4.next.prev = t4.prev, t4.prev.next = t4.next, t4.prevZ && (t4.prevZ.nextZ = t4.nextZ), t4.nextZ && (t4.nextZ.prevZ = t4.prevZ);\n }\n function rl(t4, e2, r2) {\n return { i: t4, x: e2, y: r2, prev: null, next: null, z: 0, prevZ: null, nextZ: null, steiner: false };\n }\n function nl(t4, e2, r2) {\n const n2 = r2.patternDependencies;\n let i2 = false;\n for (const r3 of e2) {\n const e3 = r3.paint.get(`${t4}-pattern`);\n e3.isConstant() || (i2 = true);\n const s2 = e3.constantOr(null);\n s2 && (i2 = true, n2[s2.to] = true, n2[s2.from] = true);\n }\n return i2;\n }\n function il(t4, e2, r2, n2, i2) {\n const s2 = i2.patternDependencies;\n for (const a2 of e2) {\n const e3 = a2.paint.get(`${t4}-pattern`).value;\n if (\"constant\" !== e3.kind) {\n let t5 = e3.evaluate({ zoom: n2 - 1 }, r2, {}, i2.availableImages), o2 = e3.evaluate({ zoom: n2 }, r2, {}, i2.availableImages), l2 = e3.evaluate({ zoom: n2 + 1 }, r2, {}, i2.availableImages);\n t5 = t5 && t5.name ? t5.name : t5, o2 = o2 && o2.name ? o2.name : o2, l2 = l2 && l2.name ? l2.name : l2, s2[t5] = true, s2[o2] = true, s2[l2] = true, r2.patterns[a2.id] = { min: t5, mid: o2, max: l2 };\n }\n }\n return r2;\n }\n class sl {\n constructor(t4) {\n this.zoom = t4.zoom, this.overscaling = t4.overscaling, this.layers = t4.layers, this.layerIds = this.layers.map((t5) => t5.id), this.index = t4.index, this.hasPattern = false, this.patternFeatures = [], this.layoutVertexArray = new Ks(), this.indexArray = new na(), this.indexArray2 = new ia(), this.programConfigurations = new Ea(t4.layers, t4.zoom), this.segments = new oa(), this.segments2 = new oa(), this.stateDependentLayerIds = this.layers.filter((t5) => t5.isStateDependent()).map((t5) => t5.id);\n }\n populate(t4, e2, r2) {\n this.hasPattern = nl(\"fill\", this.layers, e2);\n const n2 = this.layers[0].layout.get(\"fill-sort-key\"), i2 = !n2.isConstant(), s2 = [];\n for (const { feature: a2, id: o2, index: l2, sourceLayerIndex: u2 } of t4) {\n const t5 = this.layers[0]._featureFilter.needGeometry, c2 = ja(a2, t5);\n if (!this.layers[0]._featureFilter.filter(new Ui(this.zoom), c2, r2)) continue;\n const h2 = i2 ? n2.evaluate(c2, {}, r2, e2.availableImages) : void 0, p2 = { id: o2, properties: a2.properties, type: a2.type, sourceLayerIndex: u2, index: l2, geometry: t5 ? c2.geometry : Oa(a2), patterns: {}, sortKey: h2 };\n s2.push(p2);\n }\n i2 && s2.sort((t5, e3) => t5.sortKey - e3.sortKey);\n for (const n3 of s2) {\n const { geometry: i3, index: s3, sourceLayerIndex: a2 } = n3;\n if (this.hasPattern) {\n const t5 = il(\"fill\", this.layers, n3, this.zoom, e2);\n this.patternFeatures.push(t5);\n } else this.addFeature(n3, i3, s3, r2, {});\n e2.featureIndex.insert(t4[s3].feature, i3, s3, a2, this.index);\n }\n }\n update(t4, e2, r2) {\n this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(t4, e2, this.stateDependentLayers, r2);\n }\n addFeatures(t4, e2, r2) {\n for (const t5 of this.patternFeatures) this.addFeature(t5, t5.geometry, t5.index, e2, r2);\n }\n isEmpty() {\n return 0 === this.layoutVertexArray.length;\n }\n uploadPending() {\n return !this.uploaded || this.programConfigurations.needsUpload;\n }\n upload(t4) {\n this.uploaded || (this.layoutVertexBuffer = t4.createVertexBuffer(this.layoutVertexArray, Bo), this.indexBuffer = t4.createIndexBuffer(this.indexArray), this.indexBuffer2 = t4.createIndexBuffer(this.indexArray2)), this.programConfigurations.upload(t4), this.uploaded = true;\n }\n destroy() {\n this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.indexBuffer2.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.segments2.destroy());\n }\n addFeature(t4, e2, r2, n2, i2) {\n for (const t5 of xr(e2, 500)) {\n let e3 = 0;\n for (const r4 of t5) e3 += r4.length;\n const r3 = this.segments.prepareSegment(e3, this.layoutVertexArray, this.indexArray), n3 = r3.vertexLength, i3 = [], s2 = [];\n for (const e4 of t5) {\n if (0 === e4.length) continue;\n e4 !== t5[0] && s2.push(i3.length / 2);\n const r4 = this.segments2.prepareSegment(e4.length, this.layoutVertexArray, this.indexArray2), n4 = r4.vertexLength;\n this.layoutVertexArray.emplaceBack(e4[0].x, e4[0].y), this.indexArray2.emplaceBack(n4 + e4.length - 1, n4), i3.push(e4[0].x), i3.push(e4[0].y);\n for (let t6 = 1; t6 < e4.length; t6++) this.layoutVertexArray.emplaceBack(e4[t6].x, e4[t6].y), this.indexArray2.emplaceBack(n4 + t6 - 1, n4 + t6), i3.push(e4[t6].x), i3.push(e4[t6].y);\n r4.vertexLength += e4.length, r4.primitiveLength += e4.length;\n }\n const a2 = Vo(i3, s2);\n for (let t6 = 0; t6 < a2.length; t6 += 3) this.indexArray.emplaceBack(n3 + a2[t6], n3 + a2[t6 + 1], n3 + a2[t6 + 2]);\n r3.vertexLength += e3, r3.primitiveLength += a2.length / 3;\n }\n this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t4, r2, i2, n2);\n }\n }\n let al, ol;\n wi(\"FillBucket\", sl, { omit: [\"layers\", \"patternFeatures\"] });\n var ll = { get paint() {\n return ol = ol || new rs({ \"fill-antialias\": new Ji(G.paint_fill[\"fill-antialias\"]), \"fill-opacity\": new Wi(G.paint_fill[\"fill-opacity\"]), \"fill-color\": new Wi(G.paint_fill[\"fill-color\"]), \"fill-outline-color\": new Wi(G.paint_fill[\"fill-outline-color\"]), \"fill-translate\": new Ji(G.paint_fill[\"fill-translate\"]), \"fill-translate-anchor\": new Ji(G.paint_fill[\"fill-translate-anchor\"]), \"fill-pattern\": new Qi(G.paint_fill[\"fill-pattern\"]) });\n }, get layout() {\n return al = al || new rs({ \"fill-sort-key\": new Wi(G.layout_fill[\"fill-sort-key\"]) });\n } };\n class ul extends is {\n constructor(t4) {\n super(t4, ll);\n }\n recalculate(t4, e2) {\n super.recalculate(t4, e2);\n const r2 = this.paint._values[\"fill-outline-color\"];\n \"constant\" === r2.value.kind && void 0 === r2.value.value && (this.paint._values[\"fill-outline-color\"] = this.paint._values[\"fill-color\"]);\n }\n createBucket(t4) {\n return new sl(t4);\n }\n queryRadius() {\n return eo(this.paint.get(\"fill-translate\"));\n }\n queryIntersectsFeature(t4, e2, r2, n2, i2, s2, a2) {\n return Za(ro(t4, this.paint.get(\"fill-translate\"), this.paint.get(\"fill-translate-anchor\"), s2.angle, a2), n2);\n }\n isTileClipped() {\n return true;\n }\n }\n const cl = ls([{ name: \"a_pos\", components: 2, type: \"Int16\" }, { name: \"a_normal_ed\", components: 4, type: \"Int16\" }], 4), hl = ls([{ name: \"a_centroid\", components: 2, type: \"Int16\" }], 4), { members: pl } = cl;\n var fl = {}, dl = n, yl = ml;\n function ml(t4, e2, r2, n2, i2) {\n this.properties = {}, this.extent = r2, this.type = 0, this._pbf = t4, this._geometry = -1, this._keys = n2, this._values = i2, t4.readFields(gl2, this, e2);\n }\n function gl2(t4, e2, r2) {\n 1 == t4 ? e2.id = r2.readVarint() : 2 == t4 ? function(t5, e3) {\n for (var r3 = t5.readVarint() + t5.pos; t5.pos < r3; ) {\n var n2 = e3._keys[t5.readVarint()], i2 = e3._values[t5.readVarint()];\n e3.properties[n2] = i2;\n }\n }(r2, e2) : 3 == t4 ? e2.type = r2.readVarint() : 4 == t4 && (e2._geometry = r2.pos);\n }\n function xl(t4) {\n for (var e2, r2, n2 = 0, i2 = 0, s2 = t4.length, a2 = s2 - 1; i2 < s2; a2 = i2++) n2 += ((r2 = t4[a2]).x - (e2 = t4[i2]).x) * (e2.y + r2.y);\n return n2;\n }\n ml.types = [\"Unknown\", \"Point\", \"LineString\", \"Polygon\"], ml.prototype.loadGeometry = function() {\n var t4 = this._pbf;\n t4.pos = this._geometry;\n for (var e2, r2 = t4.readVarint() + t4.pos, n2 = 1, i2 = 0, s2 = 0, a2 = 0, o2 = []; t4.pos < r2; ) {\n if (i2 <= 0) {\n var l2 = t4.readVarint();\n n2 = 7 & l2, i2 = l2 >> 3;\n }\n if (i2--, 1 === n2 || 2 === n2) s2 += t4.readSVarint(), a2 += t4.readSVarint(), 1 === n2 && (e2 && o2.push(e2), e2 = []), e2.push(new dl(s2, a2));\n else {\n if (7 !== n2) throw new Error(\"unknown command \" + n2);\n e2 && e2.push(e2[0].clone());\n }\n }\n return e2 && o2.push(e2), o2;\n }, ml.prototype.bbox = function() {\n var t4 = this._pbf;\n t4.pos = this._geometry;\n for (var e2 = t4.readVarint() + t4.pos, r2 = 1, n2 = 0, i2 = 0, s2 = 0, a2 = 1 / 0, o2 = -1 / 0, l2 = 1 / 0, u2 = -1 / 0; t4.pos < e2; ) {\n if (n2 <= 0) {\n var c2 = t4.readVarint();\n r2 = 7 & c2, n2 = c2 >> 3;\n }\n if (n2--, 1 === r2 || 2 === r2) (i2 += t4.readSVarint()) < a2 && (a2 = i2), i2 > o2 && (o2 = i2), (s2 += t4.readSVarint()) < l2 && (l2 = s2), s2 > u2 && (u2 = s2);\n else if (7 !== r2) throw new Error(\"unknown command \" + r2);\n }\n return [a2, l2, o2, u2];\n }, ml.prototype.toGeoJSON = function(t4, e2, r2) {\n var n2, i2, s2 = this.extent * Math.pow(2, r2), a2 = this.extent * t4, o2 = this.extent * e2, l2 = this.loadGeometry(), u2 = ml.types[this.type];\n function c2(t5) {\n for (var e3 = 0; e3 < t5.length; e3++) {\n var r3 = t5[e3];\n t5[e3] = [360 * (r3.x + a2) / s2 - 180, 360 / Math.PI * Math.atan(Math.exp((180 - 360 * (r3.y + o2) / s2) * Math.PI / 180)) - 90];\n }\n }\n switch (this.type) {\n case 1:\n var h2 = [];\n for (n2 = 0; n2 < l2.length; n2++) h2[n2] = l2[n2][0];\n c2(l2 = h2);\n break;\n case 2:\n for (n2 = 0; n2 < l2.length; n2++) c2(l2[n2]);\n break;\n case 3:\n for (l2 = function(t5) {\n var e3 = t5.length;\n if (e3 <= 1) return [t5];\n for (var r3, n3, i3 = [], s3 = 0; s3 < e3; s3++) {\n var a3 = xl(t5[s3]);\n 0 !== a3 && (void 0 === n3 && (n3 = a3 < 0), n3 === a3 < 0 ? (r3 && i3.push(r3), r3 = [t5[s3]]) : r3.push(t5[s3]));\n }\n return r3 && i3.push(r3), i3;\n }(l2), n2 = 0; n2 < l2.length; n2++) for (i2 = 0; i2 < l2[n2].length; i2++) c2(l2[n2][i2]);\n }\n 1 === l2.length ? l2 = l2[0] : u2 = \"Multi\" + u2;\n var p2 = { type: \"Feature\", geometry: { type: u2, coordinates: l2 }, properties: this.properties };\n return \"id\" in this && (p2.id = this.id), p2;\n };\n var vl = yl, bl = wl;\n function wl(t4, e2) {\n this.version = 1, this.name = null, this.extent = 4096, this.length = 0, this._pbf = t4, this._keys = [], this._values = [], this._features = [], t4.readFields(_l, this, e2), this.length = this._features.length;\n }\n function _l(t4, e2, r2) {\n 15 === t4 ? e2.version = r2.readVarint() : 1 === t4 ? e2.name = r2.readString() : 5 === t4 ? e2.extent = r2.readVarint() : 2 === t4 ? e2._features.push(r2.pos) : 3 === t4 ? e2._keys.push(r2.readString()) : 4 === t4 && e2._values.push(function(t5) {\n for (var e3 = null, r3 = t5.readVarint() + t5.pos; t5.pos < r3; ) {\n var n2 = t5.readVarint() >> 3;\n e3 = 1 === n2 ? t5.readString() : 2 === n2 ? t5.readFloat() : 3 === n2 ? t5.readDouble() : 4 === n2 ? t5.readVarint64() : 5 === n2 ? t5.readVarint() : 6 === n2 ? t5.readSVarint() : 7 === n2 ? t5.readBoolean() : null;\n }\n return e3;\n }(r2));\n }\n wl.prototype.feature = function(t4) {\n if (t4 < 0 || t4 >= this._features.length) throw new Error(\"feature index out of bounds\");\n this._pbf.pos = this._features[t4];\n var e2 = this._pbf.readVarint() + this._pbf.pos;\n return new vl(this._pbf, e2, this.extent, this._keys, this._values);\n };\n var Al = bl;\n function Sl(t4, e2, r2) {\n if (3 === t4) {\n var n2 = new Al(r2, r2.readVarint() + r2.pos);\n n2.length && (e2[n2.name] = n2);\n }\n }\n fl.VectorTile = function(t4, e2) {\n this.layers = t4.readFields(Sl, {}, e2);\n }, fl.VectorTileFeature = yl, fl.VectorTileLayer = bl;\n const kl = fl.VectorTileFeature.types, Ml = Math.pow(2, 13);\n function Il(t4, e2, r2, n2, i2, s2, a2, o2) {\n t4.emplaceBack(e2, r2, 2 * Math.floor(n2 * Ml) + a2, i2 * Ml * 2, s2 * Ml * 2, Math.round(o2));\n }\n class zl {\n constructor(t4) {\n this.zoom = t4.zoom, this.overscaling = t4.overscaling, this.layers = t4.layers, this.layerIds = this.layers.map((t5) => t5.id), this.index = t4.index, this.hasPattern = false, this.layoutVertexArray = new Xs(), this.centroidVertexArray = new Zs(), this.indexArray = new na(), this.programConfigurations = new Ea(t4.layers, t4.zoom), this.segments = new oa(), this.stateDependentLayerIds = this.layers.filter((t5) => t5.isStateDependent()).map((t5) => t5.id);\n }\n populate(t4, e2, r2) {\n this.features = [], this.hasPattern = nl(\"fill-extrusion\", this.layers, e2);\n for (const { feature: n2, id: i2, index: s2, sourceLayerIndex: a2 } of t4) {\n const t5 = this.layers[0]._featureFilter.needGeometry, o2 = ja(n2, t5);\n if (!this.layers[0]._featureFilter.filter(new Ui(this.zoom), o2, r2)) continue;\n const l2 = { id: i2, sourceLayerIndex: a2, index: s2, geometry: t5 ? o2.geometry : Oa(n2), properties: n2.properties, type: n2.type, patterns: {} };\n this.hasPattern ? this.features.push(il(\"fill-extrusion\", this.layers, l2, this.zoom, e2)) : this.addFeature(l2, l2.geometry, s2, r2, {}), e2.featureIndex.insert(n2, l2.geometry, s2, a2, this.index, true);\n }\n }\n addFeatures(t4, e2, r2) {\n for (const t5 of this.features) {\n const { geometry: n2 } = t5;\n this.addFeature(t5, n2, t5.index, e2, r2);\n }\n }\n update(t4, e2, r2) {\n this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(t4, e2, this.stateDependentLayers, r2);\n }\n isEmpty() {\n return 0 === this.layoutVertexArray.length && 0 === this.centroidVertexArray.length;\n }\n uploadPending() {\n return !this.uploaded || this.programConfigurations.needsUpload;\n }\n upload(t4) {\n this.uploaded || (this.layoutVertexBuffer = t4.createVertexBuffer(this.layoutVertexArray, pl), this.centroidVertexBuffer = t4.createVertexBuffer(this.centroidVertexArray, hl.members, true), this.indexBuffer = t4.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(t4), this.uploaded = true;\n }\n destroy() {\n this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.centroidVertexBuffer.destroy());\n }\n addFeature(t4, e2, r2, n2, i2) {\n for (const r3 of xr(e2, 500)) {\n const e3 = { x: 0, y: 0, vertexCount: 0 };\n let n3 = 0;\n for (const t5 of r3) n3 += t5.length;\n let i3 = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray);\n for (const t5 of r3) {\n if (0 === t5.length) continue;\n if (Cl(t5)) continue;\n let r4 = 0;\n for (let n4 = 0; n4 < t5.length; n4++) {\n const s3 = t5[n4];\n if (n4 >= 1) {\n const a3 = t5[n4 - 1];\n if (!Pl(s3, a3)) {\n i3.vertexLength + 4 > oa.MAX_VERTEX_ARRAY_LENGTH && (i3 = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray));\n const t6 = s3.sub(a3)._perp()._unit(), n5 = a3.dist(s3);\n r4 + n5 > 32768 && (r4 = 0), Il(this.layoutVertexArray, s3.x, s3.y, t6.x, t6.y, 0, 0, r4), Il(this.layoutVertexArray, s3.x, s3.y, t6.x, t6.y, 0, 1, r4), e3.x += 2 * s3.x, e3.y += 2 * s3.y, e3.vertexCount += 2, r4 += n5, Il(this.layoutVertexArray, a3.x, a3.y, t6.x, t6.y, 0, 0, r4), Il(this.layoutVertexArray, a3.x, a3.y, t6.x, t6.y, 0, 1, r4), e3.x += 2 * a3.x, e3.y += 2 * a3.y, e3.vertexCount += 2;\n const o3 = i3.vertexLength;\n this.indexArray.emplaceBack(o3, o3 + 2, o3 + 1), this.indexArray.emplaceBack(o3 + 1, o3 + 2, o3 + 3), i3.vertexLength += 4, i3.primitiveLength += 2;\n }\n }\n }\n }\n if (i3.vertexLength + n3 > oa.MAX_VERTEX_ARRAY_LENGTH && (i3 = this.segments.prepareSegment(n3, this.layoutVertexArray, this.indexArray)), \"Polygon\" !== kl[t4.type]) continue;\n const s2 = [], a2 = [], o2 = i3.vertexLength;\n for (const t5 of r3) if (0 !== t5.length) {\n t5 !== r3[0] && a2.push(s2.length / 2);\n for (let r4 = 0; r4 < t5.length; r4++) {\n const n4 = t5[r4];\n Il(this.layoutVertexArray, n4.x, n4.y, 0, 0, 1, 1, 0), e3.x += n4.x, e3.y += n4.y, e3.vertexCount += 1, s2.push(n4.x), s2.push(n4.y);\n }\n }\n const l2 = Vo(s2, a2);\n for (let t5 = 0; t5 < l2.length; t5 += 3) this.indexArray.emplaceBack(o2 + l2[t5], o2 + l2[t5 + 2], o2 + l2[t5 + 1]);\n i3.primitiveLength += l2.length / 3, i3.vertexLength += n3;\n for (let t5 = 0; t5 < e3.vertexCount; t5++) {\n const t6 = Math.floor(e3.x / e3.vertexCount), r4 = Math.floor(e3.y / e3.vertexCount);\n this.centroidVertexArray.emplaceBack(t6, r4);\n }\n }\n this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t4, r2, i2, n2);\n }\n }\n function Pl(t4, e2) {\n return t4.x === e2.x && (t4.x < 0 || t4.x > $a) || t4.y === e2.y && (t4.y < 0 || t4.y > $a);\n }\n function Cl(t4) {\n return t4.every((t5) => t5.x < 0) || t4.every((t5) => t5.x > $a) || t4.every((t5) => t5.y < 0) || t4.every((t5) => t5.y > $a);\n }\n let Bl;\n wi(\"FillExtrusionBucket\", zl, { omit: [\"layers\", \"features\"] });\n var Vl = { get paint() {\n return Bl = Bl || new rs({ \"fill-extrusion-opacity\": new Ji(G[\"paint_fill-extrusion\"][\"fill-extrusion-opacity\"]), \"fill-extrusion-color\": new Wi(G[\"paint_fill-extrusion\"][\"fill-extrusion-color\"]), \"fill-extrusion-translate\": new Ji(G[\"paint_fill-extrusion\"][\"fill-extrusion-translate\"]), \"fill-extrusion-translate-anchor\": new Ji(G[\"paint_fill-extrusion\"][\"fill-extrusion-translate-anchor\"]), \"fill-extrusion-pattern\": new Qi(G[\"paint_fill-extrusion\"][\"fill-extrusion-pattern\"]), \"fill-extrusion-height\": new Wi(G[\"paint_fill-extrusion\"][\"fill-extrusion-height\"]), \"fill-extrusion-base\": new Wi(G[\"paint_fill-extrusion\"][\"fill-extrusion-base\"]), \"fill-extrusion-vertical-gradient\": new Ji(G[\"paint_fill-extrusion\"][\"fill-extrusion-vertical-gradient\"]) });\n } };\n class El extends is {\n constructor(t4) {\n super(t4, Vl);\n }\n createBucket(t4) {\n return new zl(t4);\n }\n queryRadius() {\n return eo(this.paint.get(\"fill-extrusion-translate\"));\n }\n is3D() {\n return true;\n }\n queryIntersectsFeature(t4, e2, r2, n2, i2, a2, o2, l2) {\n const u2 = ro(t4, this.paint.get(\"fill-extrusion-translate\"), this.paint.get(\"fill-extrusion-translate-anchor\"), a2.angle, o2), c2 = this.paint.get(\"fill-extrusion-height\").evaluate(e2, r2), h2 = this.paint.get(\"fill-extrusion-base\").evaluate(e2, r2), p2 = function(t5, e3, r3, n3) {\n const i3 = [];\n for (const r4 of t5) {\n const t6 = [r4.x, r4.y, 0, 1];\n po(t6, t6, e3), i3.push(new s(t6[0] / t6[3], t6[1] / t6[3]));\n }\n return i3;\n }(u2, l2), f2 = function(t5, e3, r3, n3) {\n const i3 = [], a3 = [], o3 = n3[8] * e3, l3 = n3[9] * e3, u3 = n3[10] * e3, c3 = n3[11] * e3, h3 = n3[8] * r3, p3 = n3[9] * r3, f3 = n3[10] * r3, d2 = n3[11] * r3;\n for (const e4 of t5) {\n const t6 = [], r4 = [];\n for (const i4 of e4) {\n const e5 = i4.x, a4 = i4.y, y2 = n3[0] * e5 + n3[4] * a4 + n3[12], m2 = n3[1] * e5 + n3[5] * a4 + n3[13], g2 = n3[2] * e5 + n3[6] * a4 + n3[14], x2 = n3[3] * e5 + n3[7] * a4 + n3[15], v2 = g2 + u3, b2 = x2 + c3, w2 = y2 + h3, _2 = m2 + p3, A3 = g2 + f3, S2 = x2 + d2, k2 = new s((y2 + o3) / b2, (m2 + l3) / b2);\n k2.z = v2 / b2, t6.push(k2);\n const M2 = new s(w2 / S2, _2 / S2);\n M2.z = A3 / S2, r4.push(M2);\n }\n i3.push(t6), a3.push(r4);\n }\n return [i3, a3];\n }(n2, h2, c2, l2);\n return function(t5, e3, r3) {\n let n3 = 1 / 0;\n Za(r3, e3) && (n3 = Tl(r3, e3[0]));\n for (let i3 = 0; i3 < e3.length; i3++) {\n const s2 = e3[i3], a3 = t5[i3];\n for (let t6 = 0; t6 < s2.length - 1; t6++) {\n const e4 = s2[t6], i4 = [e4, s2[t6 + 1], a3[t6 + 1], a3[t6], e4];\n qa(r3, i4) && (n3 = Math.min(n3, Tl(r3, i4)));\n }\n }\n return n3 !== 1 / 0 && n3;\n }(f2[0], f2[1], p2);\n }\n }\n function Fl(t4, e2) {\n return t4.x * e2.x + t4.y * e2.y;\n }\n function Tl(t4, e2) {\n if (1 === t4.length) {\n let r2 = 0;\n const n2 = e2[r2++];\n let i2;\n for (; !i2 || n2.equals(i2); ) if (i2 = e2[r2++], !i2) return 1 / 0;\n for (; r2 < e2.length; r2++) {\n const s2 = e2[r2], a2 = t4[0], o2 = i2.sub(n2), l2 = s2.sub(n2), u2 = a2.sub(n2), c2 = Fl(o2, o2), h2 = Fl(o2, l2), p2 = Fl(l2, l2), f2 = Fl(u2, o2), d2 = Fl(u2, l2), y2 = c2 * p2 - h2 * h2, m2 = (p2 * f2 - h2 * d2) / y2, g2 = (c2 * d2 - h2 * f2) / y2, x2 = n2.z * (1 - m2 - g2) + i2.z * m2 + s2.z * g2;\n if (isFinite(x2)) return x2;\n }\n return 1 / 0;\n }\n {\n let t5 = 1 / 0;\n for (const r2 of e2) t5 = Math.min(t5, r2.z);\n return t5;\n }\n }\n const $l = ls([{ name: \"a_pos_normal\", components: 2, type: \"Int16\" }, { name: \"a_data\", components: 4, type: \"Uint8\" }], 4), { members: Ll } = $l, Dl = ls([{ name: \"a_uv_x\", components: 1, type: \"Float32\" }, { name: \"a_split_index\", components: 1, type: \"Float32\" }]), { members: Ol } = Dl, jl = fl.VectorTileFeature.types, Rl = Math.cos(Math.PI / 180 * 37.5), Ul = Math.pow(2, 14) / 0.5;\n class ql {\n constructor(t4) {\n this.zoom = t4.zoom, this.overscaling = t4.overscaling, this.layers = t4.layers, this.layerIds = this.layers.map((t5) => t5.id), this.index = t4.index, this.hasPattern = false, this.patternFeatures = [], this.lineClipsArray = [], this.gradients = {}, this.layers.forEach((t5) => {\n this.gradients[t5.id] = {};\n }), this.layoutVertexArray = new Hs(), this.layoutVertexArray2 = new Ys(), this.indexArray = new na(), this.programConfigurations = new Ea(t4.layers, t4.zoom), this.segments = new oa(), this.maxLineLength = 0, this.stateDependentLayerIds = this.layers.filter((t5) => t5.isStateDependent()).map((t5) => t5.id);\n }\n populate(t4, e2, r2) {\n this.hasPattern = nl(\"line\", this.layers, e2);\n const n2 = this.layers[0].layout.get(\"line-sort-key\"), i2 = !n2.isConstant(), s2 = [];\n for (const { feature: e3, id: a2, index: o2, sourceLayerIndex: l2 } of t4) {\n const t5 = this.layers[0]._featureFilter.needGeometry, u2 = ja(e3, t5);\n if (!this.layers[0]._featureFilter.filter(new Ui(this.zoom), u2, r2)) continue;\n const c2 = i2 ? n2.evaluate(u2, {}, r2) : void 0, h2 = { id: a2, properties: e3.properties, type: e3.type, sourceLayerIndex: l2, index: o2, geometry: t5 ? u2.geometry : Oa(e3), patterns: {}, sortKey: c2 };\n s2.push(h2);\n }\n i2 && s2.sort((t5, e3) => t5.sortKey - e3.sortKey);\n for (const n3 of s2) {\n const { geometry: i3, index: s3, sourceLayerIndex: a2 } = n3;\n if (this.hasPattern) {\n const t5 = il(\"line\", this.layers, n3, this.zoom, e2);\n this.patternFeatures.push(t5);\n } else this.addFeature(n3, i3, s3, r2, {});\n e2.featureIndex.insert(t4[s3].feature, i3, s3, a2, this.index);\n }\n }\n update(t4, e2, r2) {\n this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(t4, e2, this.stateDependentLayers, r2);\n }\n addFeatures(t4, e2, r2) {\n for (const t5 of this.patternFeatures) this.addFeature(t5, t5.geometry, t5.index, e2, r2);\n }\n isEmpty() {\n return 0 === this.layoutVertexArray.length;\n }\n uploadPending() {\n return !this.uploaded || this.programConfigurations.needsUpload;\n }\n upload(t4) {\n this.uploaded || (0 !== this.layoutVertexArray2.length && (this.layoutVertexBuffer2 = t4.createVertexBuffer(this.layoutVertexArray2, Ol)), this.layoutVertexBuffer = t4.createVertexBuffer(this.layoutVertexArray, Ll), this.indexBuffer = t4.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(t4), this.uploaded = true;\n }\n destroy() {\n this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy());\n }\n lineFeatureClips(t4) {\n if (t4.properties && Object.prototype.hasOwnProperty.call(t4.properties, \"mapbox_clip_start\") && Object.prototype.hasOwnProperty.call(t4.properties, \"mapbox_clip_end\")) return { start: +t4.properties.mapbox_clip_start, end: +t4.properties.mapbox_clip_end };\n }\n addFeature(t4, e2, r2, n2, i2) {\n const s2 = this.layers[0].layout, a2 = s2.get(\"line-join\").evaluate(t4, {}), o2 = s2.get(\"line-cap\"), l2 = s2.get(\"line-miter-limit\"), u2 = s2.get(\"line-round-limit\");\n this.lineClips = this.lineFeatureClips(t4);\n for (const r3 of e2) this.addLine(r3, t4, a2, o2, l2, u2);\n this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t4, r2, i2, n2);\n }\n addLine(t4, e2, r2, n2, i2, s2) {\n if (this.distance = 0, this.scaledDistance = 0, this.totalDistance = 0, this.lineClips) {\n this.lineClipsArray.push(this.lineClips);\n for (let e3 = 0; e3 < t4.length - 1; e3++) this.totalDistance += t4[e3].dist(t4[e3 + 1]);\n this.updateScaledDistance(), this.maxLineLength = Math.max(this.maxLineLength, this.totalDistance);\n }\n const a2 = \"Polygon\" === jl[e2.type];\n let o2 = t4.length;\n for (; o2 >= 2 && t4[o2 - 1].equals(t4[o2 - 2]); ) o2--;\n let l2 = 0;\n for (; l2 < o2 - 1 && t4[l2].equals(t4[l2 + 1]); ) l2++;\n if (o2 < (a2 ? 3 : 2)) return;\n \"bevel\" === r2 && (i2 = 1.05);\n const u2 = this.overscaling <= 16 ? 15 * $a / (512 * this.overscaling) : 0, c2 = this.segments.prepareSegment(10 * o2, this.layoutVertexArray, this.indexArray);\n let h2, p2, f2, d2, y2;\n this.e1 = this.e2 = -1, a2 && (h2 = t4[o2 - 2], y2 = t4[l2].sub(h2)._unit()._perp());\n for (let e3 = l2; e3 < o2; e3++) {\n if (f2 = e3 === o2 - 1 ? a2 ? t4[l2 + 1] : void 0 : t4[e3 + 1], f2 && t4[e3].equals(f2)) continue;\n y2 && (d2 = y2), h2 && (p2 = h2), h2 = t4[e3], y2 = f2 ? f2.sub(h2)._unit()._perp() : d2, d2 = d2 || y2;\n let m2 = d2.add(y2);\n 0 === m2.x && 0 === m2.y || m2._unit();\n const g2 = d2.x * y2.x + d2.y * y2.y, x2 = m2.x * y2.x + m2.y * y2.y, v2 = 0 !== x2 ? 1 / x2 : 1 / 0, b2 = 2 * Math.sqrt(2 - 2 * x2), w2 = x2 < Rl && p2 && f2, _2 = d2.x * y2.y - d2.y * y2.x > 0;\n if (w2 && e3 > l2) {\n const t5 = h2.dist(p2);\n if (t5 > 2 * u2) {\n const e4 = h2.sub(h2.sub(p2)._mult(u2 / t5)._round());\n this.updateDistance(p2, e4), this.addCurrentVertex(e4, d2, 0, 0, c2), p2 = e4;\n }\n }\n const A3 = p2 && f2;\n let S2 = A3 ? r2 : a2 ? \"butt\" : n2;\n if (A3 && \"round\" === S2 && (v2 < s2 ? S2 = \"miter\" : v2 <= 2 && (S2 = \"fakeround\")), \"miter\" === S2 && v2 > i2 && (S2 = \"bevel\"), \"bevel\" === S2 && (v2 > 2 && (S2 = \"flipbevel\"), v2 < i2 && (S2 = \"miter\")), p2 && this.updateDistance(p2, h2), \"miter\" === S2) m2._mult(v2), this.addCurrentVertex(h2, m2, 0, 0, c2);\n else if (\"flipbevel\" === S2) {\n if (v2 > 100) m2 = y2.mult(-1);\n else {\n const t5 = v2 * d2.add(y2).mag() / d2.sub(y2).mag();\n m2._perp()._mult(t5 * (_2 ? -1 : 1));\n }\n this.addCurrentVertex(h2, m2, 0, 0, c2), this.addCurrentVertex(h2, m2.mult(-1), 0, 0, c2);\n } else if (\"bevel\" === S2 || \"fakeround\" === S2) {\n const t5 = -Math.sqrt(v2 * v2 - 1), e4 = _2 ? t5 : 0, r3 = _2 ? 0 : t5;\n if (p2 && this.addCurrentVertex(h2, d2, e4, r3, c2), \"fakeround\" === S2) {\n const t6 = Math.round(180 * b2 / Math.PI / 20);\n for (let e5 = 1; e5 < t6; e5++) {\n let r4 = e5 / t6;\n if (0.5 !== r4) {\n const t7 = r4 - 0.5;\n r4 += r4 * t7 * (r4 - 1) * ((1.0904 + g2 * (g2 * (3.55645 - 1.43519 * g2) - 3.2452)) * t7 * t7 + (0.848013 + g2 * (0.215638 * g2 - 1.06021)));\n }\n const n3 = y2.sub(d2)._mult(r4)._add(d2)._unit()._mult(_2 ? -1 : 1);\n this.addHalfVertex(h2, n3.x, n3.y, false, _2, 0, c2);\n }\n }\n f2 && this.addCurrentVertex(h2, y2, -e4, -r3, c2);\n } else if (\"butt\" === S2) this.addCurrentVertex(h2, m2, 0, 0, c2);\n else if (\"square\" === S2) {\n const t5 = p2 ? 1 : -1;\n this.addCurrentVertex(h2, m2, t5, t5, c2);\n } else \"round\" === S2 && (p2 && (this.addCurrentVertex(h2, d2, 0, 0, c2), this.addCurrentVertex(h2, d2, 1, 1, c2, true)), f2 && (this.addCurrentVertex(h2, y2, -1, -1, c2, true), this.addCurrentVertex(h2, y2, 0, 0, c2)));\n if (w2 && e3 < o2 - 1) {\n const t5 = h2.dist(f2);\n if (t5 > 2 * u2) {\n const e4 = h2.add(f2.sub(h2)._mult(u2 / t5)._round());\n this.updateDistance(h2, e4), this.addCurrentVertex(e4, y2, 0, 0, c2), h2 = e4;\n }\n }\n }\n }\n addCurrentVertex(t4, e2, r2, n2, i2, s2 = false) {\n const a2 = e2.y * n2 - e2.x, o2 = -e2.y - e2.x * n2;\n this.addHalfVertex(t4, e2.x + e2.y * r2, e2.y - e2.x * r2, s2, false, r2, i2), this.addHalfVertex(t4, a2, o2, s2, true, -n2, i2), this.distance > Ul / 2 && 0 === this.totalDistance && (this.distance = 0, this.updateScaledDistance(), this.addCurrentVertex(t4, e2, r2, n2, i2, s2));\n }\n addHalfVertex({ x: t4, y: e2 }, r2, n2, i2, s2, a2, o2) {\n const l2 = 0.5 * (this.lineClips ? this.scaledDistance * (Ul - 1) : this.scaledDistance);\n this.layoutVertexArray.emplaceBack((t4 << 1) + (i2 ? 1 : 0), (e2 << 1) + (s2 ? 1 : 0), Math.round(63 * r2) + 128, Math.round(63 * n2) + 128, 1 + (0 === a2 ? 0 : a2 < 0 ? -1 : 1) | (63 & l2) << 2, l2 >> 6), this.lineClips && this.layoutVertexArray2.emplaceBack((this.scaledDistance - this.lineClips.start) / (this.lineClips.end - this.lineClips.start), this.lineClipsArray.length);\n const u2 = o2.vertexLength++;\n this.e1 >= 0 && this.e2 >= 0 && (this.indexArray.emplaceBack(this.e1, this.e2, u2), o2.primitiveLength++), s2 ? this.e2 = u2 : this.e1 = u2;\n }\n updateScaledDistance() {\n this.scaledDistance = this.lineClips ? this.lineClips.start + (this.lineClips.end - this.lineClips.start) * this.distance / this.totalDistance : this.distance;\n }\n updateDistance(t4, e2) {\n this.distance += t4.dist(e2), this.updateScaledDistance();\n }\n }\n let Nl, Zl;\n wi(\"LineBucket\", ql, { omit: [\"layers\", \"patternFeatures\"] });\n var Gl = { get paint() {\n return Zl = Zl || new rs({ \"line-opacity\": new Wi(G.paint_line[\"line-opacity\"]), \"line-color\": new Wi(G.paint_line[\"line-color\"]), \"line-translate\": new Ji(G.paint_line[\"line-translate\"]), \"line-translate-anchor\": new Ji(G.paint_line[\"line-translate-anchor\"]), \"line-width\": new Wi(G.paint_line[\"line-width\"]), \"line-gap-width\": new Wi(G.paint_line[\"line-gap-width\"]), \"line-offset\": new Wi(G.paint_line[\"line-offset\"]), \"line-blur\": new Wi(G.paint_line[\"line-blur\"]), \"line-dasharray\": new ts(G.paint_line[\"line-dasharray\"]), \"line-pattern\": new Qi(G.paint_line[\"line-pattern\"]), \"line-gradient\": new es(G.paint_line[\"line-gradient\"]) });\n }, get layout() {\n return Nl = Nl || new rs({ \"line-cap\": new Ji(G.layout_line[\"line-cap\"]), \"line-join\": new Wi(G.layout_line[\"line-join\"]), \"line-miter-limit\": new Ji(G.layout_line[\"line-miter-limit\"]), \"line-round-limit\": new Ji(G.layout_line[\"line-round-limit\"]), \"line-sort-key\": new Wi(G.layout_line[\"line-sort-key\"]) });\n } };\n class Kl extends Wi {\n possiblyEvaluate(t4, e2) {\n return e2 = new Ui(Math.floor(e2.zoom), { now: e2.now, fadeDuration: e2.fadeDuration, zoomHistory: e2.zoomHistory, transition: e2.transition }), super.possiblyEvaluate(t4, e2);\n }\n evaluate(t4, e2, r2, n2) {\n return e2 = g({}, e2, { zoom: Math.floor(e2.zoom) }), super.evaluate(t4, e2, r2, n2);\n }\n }\n let Xl;\n class Hl extends is {\n constructor(t4) {\n super(t4, Gl), this.gradientVersion = 0, Xl || (Xl = new Kl(Gl.paint.properties[\"line-width\"].specification), Xl.useIntegerZoom = true);\n }\n _handleSpecialPaintPropertyUpdate(t4) {\n if (\"line-gradient\" === t4) {\n const t5 = this.gradientExpression();\n this.stepInterpolant = !!function(t6) {\n return void 0 !== t6._styleExpression;\n }(t5) && t5._styleExpression.expression instanceof Ae, this.gradientVersion = (this.gradientVersion + 1) % Number.MAX_SAFE_INTEGER;\n }\n }\n gradientExpression() {\n return this._transitionablePaint._values[\"line-gradient\"].value.expression;\n }\n recalculate(t4, e2) {\n super.recalculate(t4, e2), this.paint._values[\"line-floorwidth\"] = Xl.possiblyEvaluate(this._transitioningPaint._values[\"line-width\"].value, t4);\n }\n createBucket(t4) {\n return new ql(t4);\n }\n queryRadius(t4) {\n const e2 = t4, r2 = Yl(to(\"line-width\", this, e2), to(\"line-gap-width\", this, e2)), n2 = to(\"line-offset\", this, e2);\n return r2 / 2 + Math.abs(n2) + eo(this.paint.get(\"line-translate\"));\n }\n queryIntersectsFeature(t4, e2, r2, n2, i2, a2, o2) {\n const l2 = ro(t4, this.paint.get(\"line-translate\"), this.paint.get(\"line-translate-anchor\"), a2.angle, o2), u2 = o2 / 2 * Yl(this.paint.get(\"line-width\").evaluate(e2, r2), this.paint.get(\"line-gap-width\").evaluate(e2, r2)), c2 = this.paint.get(\"line-offset\").evaluate(e2, r2);\n return c2 && (n2 = function(t5, e3) {\n const r3 = [];\n for (let n3 = 0; n3 < t5.length; n3++) {\n const i3 = t5[n3], a3 = [];\n for (let t6 = 0; t6 < i3.length; t6++) {\n const r4 = i3[t6 - 1], n4 = i3[t6], o3 = i3[t6 + 1], l3 = 0 === t6 ? new s(0, 0) : n4.sub(r4)._unit()._perp(), u3 = t6 === i3.length - 1 ? new s(0, 0) : o3.sub(n4)._unit()._perp(), c3 = l3._add(u3)._unit(), h2 = c3.x * u3.x + c3.y * u3.y;\n 0 !== h2 && c3._mult(1 / h2), a3.push(c3._mult(e3)._add(n4));\n }\n r3.push(a3);\n }\n return r3;\n }(n2, c2 * o2)), function(t5, e3, r3) {\n for (let n3 = 0; n3 < e3.length; n3++) {\n const i3 = e3[n3];\n if (t5.length >= 3) {\n for (let e4 = 0; e4 < i3.length; e4++) if (Wa(t5, i3[e4])) return true;\n }\n if (Ga(t5, i3, r3)) return true;\n }\n return false;\n }(l2, n2, u2);\n }\n isTileClipped() {\n return true;\n }\n }\n function Yl(t4, e2) {\n return e2 > 0 ? e2 + 2 * t4 : t4;\n }\n const Jl = ls([{ name: \"a_pos_offset\", components: 4, type: \"Int16\" }, { name: \"a_data\", components: 4, type: \"Uint16\" }, { name: \"a_pixeloffset\", components: 4, type: \"Int16\" }], 4), Wl = ls([{ name: \"a_projected_pos\", components: 3, type: \"Float32\" }], 4);\n ls([{ name: \"a_fade_opacity\", components: 1, type: \"Uint32\" }], 4);\n const Ql = ls([{ name: \"a_placed\", components: 2, type: \"Uint8\" }, { name: \"a_shift\", components: 2, type: \"Float32\" }, { name: \"a_box_real\", components: 2, type: \"Int16\" }]);\n ls([{ type: \"Int16\", name: \"anchorPointX\" }, { type: \"Int16\", name: \"anchorPointY\" }, { type: \"Int16\", name: \"x1\" }, { type: \"Int16\", name: \"y1\" }, { type: \"Int16\", name: \"x2\" }, { type: \"Int16\", name: \"y2\" }, { type: \"Uint32\", name: \"featureIndex\" }, { type: \"Uint16\", name: \"sourceLayerIndex\" }, { type: \"Uint16\", name: \"bucketIndex\" }]);\n const tu = ls([{ name: \"a_pos\", components: 2, type: \"Int16\" }, { name: \"a_anchor_pos\", components: 2, type: \"Int16\" }, { name: \"a_extrude\", components: 2, type: \"Int16\" }], 4), eu = ls([{ name: \"a_pos\", components: 2, type: \"Float32\" }, { name: \"a_radius\", components: 1, type: \"Float32\" }, { name: \"a_flags\", components: 2, type: \"Int16\" }], 4);\n function ru(t4, e2, r2) {\n return t4.sections.forEach((t5) => {\n t5.text = function(t6, e3, r3) {\n const n2 = e3.layout.get(\"text-transform\").evaluate(r3, {});\n return \"uppercase\" === n2 ? t6 = t6.toLocaleUpperCase() : \"lowercase\" === n2 && (t6 = t6.toLocaleLowerCase()), Ri.applyArabicShaping && (t6 = Ri.applyArabicShaping(t6)), t6;\n }(t5.text, e2, r2);\n }), t4;\n }\n ls([{ name: \"triangle\", components: 3, type: \"Uint16\" }]), ls([{ type: \"Int16\", name: \"anchorX\" }, { type: \"Int16\", name: \"anchorY\" }, { type: \"Uint16\", name: \"glyphStartIndex\" }, { type: \"Uint16\", name: \"numGlyphs\" }, { type: \"Uint32\", name: \"vertexStartIndex\" }, { type: \"Uint32\", name: \"lineStartIndex\" }, { type: \"Uint32\", name: \"lineLength\" }, { type: \"Uint16\", name: \"segment\" }, { type: \"Uint16\", name: \"lowerSize\" }, { type: \"Uint16\", name: \"upperSize\" }, { type: \"Float32\", name: \"lineOffsetX\" }, { type: \"Float32\", name: \"lineOffsetY\" }, { type: \"Uint8\", name: \"writingMode\" }, { type: \"Uint8\", name: \"placedOrientation\" }, { type: \"Uint8\", name: \"hidden\" }, { type: \"Uint32\", name: \"crossTileID\" }, { type: \"Int16\", name: \"associatedIconIndex\" }]), ls([{ type: \"Int16\", name: \"anchorX\" }, { type: \"Int16\", name: \"anchorY\" }, { type: \"Int16\", name: \"rightJustifiedTextSymbolIndex\" }, { type: \"Int16\", name: \"centerJustifiedTextSymbolIndex\" }, { type: \"Int16\", name: \"leftJustifiedTextSymbolIndex\" }, { type: \"Int16\", name: \"verticalPlacedTextSymbolIndex\" }, { type: \"Int16\", name: \"placedIconSymbolIndex\" }, { type: \"Int16\", name: \"verticalPlacedIconSymbolIndex\" }, { type: \"Uint16\", name: \"key\" }, { type: \"Uint16\", name: \"textBoxStartIndex\" }, { type: \"Uint16\", name: \"textBoxEndIndex\" }, { type: \"Uint16\", name: \"verticalTextBoxStartIndex\" }, { type: \"Uint16\", name: \"verticalTextBoxEndIndex\" }, { type: \"Uint16\", name: \"iconBoxStartIndex\" }, { type: \"Uint16\", name: \"iconBoxEndIndex\" }, { type: \"Uint16\", name: \"verticalIconBoxStartIndex\" }, { type: \"Uint16\", name: \"verticalIconBoxEndIndex\" }, { type: \"Uint16\", name: \"featureIndex\" }, { type: \"Uint16\", name: \"numHorizontalGlyphVertices\" }, { type: \"Uint16\", name: \"numVerticalGlyphVertices\" }, { type: \"Uint16\", name: \"numIconVertices\" }, { type: \"Uint16\", name: \"numVerticalIconVertices\" }, { type: \"Uint16\", name: \"useRuntimeCollisionCircles\" }, { type: \"Uint32\", name: \"crossTileID\" }, { type: \"Float32\", name: \"textBoxScale\" }, { type: \"Float32\", name: \"collisionCircleDiameter\" }, { type: \"Uint16\", name: \"textAnchorOffsetStartIndex\" }, { type: \"Uint16\", name: \"textAnchorOffsetEndIndex\" }]), ls([{ type: \"Float32\", name: \"offsetX\" }]), ls([{ type: \"Int16\", name: \"x\" }, { type: \"Int16\", name: \"y\" }, { type: \"Int16\", name: \"tileUnitDistanceFromAnchor\" }]), ls([{ type: \"Uint16\", name: \"textAnchor\" }, { type: \"Float32\", components: 2, name: \"textOffset\" }]);\n const nu = { \"!\": \"\\uFE15\", \"#\": \"\\uFF03\", $: \"\\uFF04\", \"%\": \"\\uFF05\", \"&\": \"\\uFF06\", \"(\": \"\\uFE35\", \")\": \"\\uFE36\", \"*\": \"\\uFF0A\", \"+\": \"\\uFF0B\", \",\": \"\\uFE10\", \"-\": \"\\uFE32\", \".\": \"\\u30FB\", \"/\": \"\\uFF0F\", \":\": \"\\uFE13\", \";\": \"\\uFE14\", \"<\": \"\\uFE3F\", \"=\": \"\\uFF1D\", \">\": \"\\uFE40\", \"?\": \"\\uFE16\", \"@\": \"\\uFF20\", \"[\": \"\\uFE47\", \"\\\\\": \"\\uFF3C\", \"]\": \"\\uFE48\", \"^\": \"\\uFF3E\", _: \"\\uFE33\", \"`\": \"\\uFF40\", \"{\": \"\\uFE37\", \"|\": \"\\u2015\", \"}\": \"\\uFE38\", \"~\": \"\\uFF5E\", \"\\xA2\": \"\\uFFE0\", \"\\xA3\": \"\\uFFE1\", \"\\xA5\": \"\\uFFE5\", \"\\xA6\": \"\\uFFE4\", \"\\xAC\": \"\\uFFE2\", \"\\xAF\": \"\\uFFE3\", \"\\u2013\": \"\\uFE32\", \"\\u2014\": \"\\uFE31\", \"\\u2018\": \"\\uFE43\", \"\\u2019\": \"\\uFE44\", \"\\u201C\": \"\\uFE41\", \"\\u201D\": \"\\uFE42\", \"\\u2026\": \"\\uFE19\", \"\\u2027\": \"\\u30FB\", \"\\u20A9\": \"\\uFFE6\", \"\\u3001\": \"\\uFE11\", \"\\u3002\": \"\\uFE12\", \"\\u3008\": \"\\uFE3F\", \"\\u3009\": \"\\uFE40\", \"\\u300A\": \"\\uFE3D\", \"\\u300B\": \"\\uFE3E\", \"\\u300C\": \"\\uFE41\", \"\\u300D\": \"\\uFE42\", \"\\u300E\": \"\\uFE43\", \"\\u300F\": \"\\uFE44\", \"\\u3010\": \"\\uFE3B\", \"\\u3011\": \"\\uFE3C\", \"\\u3014\": \"\\uFE39\", \"\\u3015\": \"\\uFE3A\", \"\\u3016\": \"\\uFE17\", \"\\u3017\": \"\\uFE18\", \"\\uFF01\": \"\\uFE15\", \"\\uFF08\": \"\\uFE35\", \"\\uFF09\": \"\\uFE36\", \"\\uFF0C\": \"\\uFE10\", \"\\uFF0D\": \"\\uFE32\", \"\\uFF0E\": \"\\u30FB\", \"\\uFF1A\": \"\\uFE13\", \"\\uFF1B\": \"\\uFE14\", \"\\uFF1C\": \"\\uFE3F\", \"\\uFF1E\": \"\\uFE40\", \"\\uFF1F\": \"\\uFE16\", \"\\uFF3B\": \"\\uFE47\", \"\\uFF3D\": \"\\uFE48\", \"\\uFF3F\": \"\\uFE33\", \"\\uFF5B\": \"\\uFE37\", \"\\uFF5C\": \"\\u2015\", \"\\uFF5D\": \"\\uFE38\", \"\\uFF5F\": \"\\uFE35\", \"\\uFF60\": \"\\uFE36\", \"\\uFF61\": \"\\uFE12\", \"\\uFF62\": \"\\uFE41\", \"\\uFF63\": \"\\uFE42\" };\n var iu = 24, su = lu, au = function(t4, e2, r2, n2, i2) {\n var s2, a2, o2 = 8 * i2 - n2 - 1, l2 = (1 << o2) - 1, u2 = l2 >> 1, c2 = -7, h2 = r2 ? i2 - 1 : 0, p2 = r2 ? -1 : 1, f2 = t4[e2 + h2];\n for (h2 += p2, s2 = f2 & (1 << -c2) - 1, f2 >>= -c2, c2 += o2; c2 > 0; s2 = 256 * s2 + t4[e2 + h2], h2 += p2, c2 -= 8) ;\n for (a2 = s2 & (1 << -c2) - 1, s2 >>= -c2, c2 += n2; c2 > 0; a2 = 256 * a2 + t4[e2 + h2], h2 += p2, c2 -= 8) ;\n if (0 === s2) s2 = 1 - u2;\n else {\n if (s2 === l2) return a2 ? NaN : 1 / 0 * (f2 ? -1 : 1);\n a2 += Math.pow(2, n2), s2 -= u2;\n }\n return (f2 ? -1 : 1) * a2 * Math.pow(2, s2 - n2);\n }, ou = function(t4, e2, r2, n2, i2, s2) {\n var a2, o2, l2, u2 = 8 * s2 - i2 - 1, c2 = (1 << u2) - 1, h2 = c2 >> 1, p2 = 23 === i2 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, f2 = n2 ? 0 : s2 - 1, d2 = n2 ? 1 : -1, y2 = e2 < 0 || 0 === e2 && 1 / e2 < 0 ? 1 : 0;\n for (e2 = Math.abs(e2), isNaN(e2) || e2 === 1 / 0 ? (o2 = isNaN(e2) ? 1 : 0, a2 = c2) : (a2 = Math.floor(Math.log(e2) / Math.LN2), e2 * (l2 = Math.pow(2, -a2)) < 1 && (a2--, l2 *= 2), (e2 += a2 + h2 >= 1 ? p2 / l2 : p2 * Math.pow(2, 1 - h2)) * l2 >= 2 && (a2++, l2 /= 2), a2 + h2 >= c2 ? (o2 = 0, a2 = c2) : a2 + h2 >= 1 ? (o2 = (e2 * l2 - 1) * Math.pow(2, i2), a2 += h2) : (o2 = e2 * Math.pow(2, h2 - 1) * Math.pow(2, i2), a2 = 0)); i2 >= 8; t4[r2 + f2] = 255 & o2, f2 += d2, o2 /= 256, i2 -= 8) ;\n for (a2 = a2 << i2 | o2, u2 += i2; u2 > 0; t4[r2 + f2] = 255 & a2, f2 += d2, a2 /= 256, u2 -= 8) ;\n t4[r2 + f2 - d2] |= 128 * y2;\n };\n function lu(t4) {\n this.buf = ArrayBuffer.isView && ArrayBuffer.isView(t4) ? t4 : new Uint8Array(t4 || 0), this.pos = 0, this.type = 0, this.length = this.buf.length;\n }\n lu.Varint = 0, lu.Fixed64 = 1, lu.Bytes = 2, lu.Fixed32 = 5;\n var uu = 4294967296, cu = 1 / uu, hu = \"undefined\" == typeof TextDecoder ? null : new TextDecoder(\"utf-8\");\n function pu(t4) {\n return t4.type === lu.Bytes ? t4.readVarint() + t4.pos : t4.pos + 1;\n }\n function fu(t4, e2, r2) {\n return r2 ? 4294967296 * e2 + (t4 >>> 0) : 4294967296 * (e2 >>> 0) + (t4 >>> 0);\n }\n function du(t4, e2, r2) {\n var n2 = e2 <= 16383 ? 1 : e2 <= 2097151 ? 2 : e2 <= 268435455 ? 3 : Math.floor(Math.log(e2) / (7 * Math.LN2));\n r2.realloc(n2);\n for (var i2 = r2.pos - 1; i2 >= t4; i2--) r2.buf[i2 + n2] = r2.buf[i2];\n }\n function yu(t4, e2) {\n for (var r2 = 0; r2 < t4.length; r2++) e2.writeVarint(t4[r2]);\n }\n function mu(t4, e2) {\n for (var r2 = 0; r2 < t4.length; r2++) e2.writeSVarint(t4[r2]);\n }\n function gu(t4, e2) {\n for (var r2 = 0; r2 < t4.length; r2++) e2.writeFloat(t4[r2]);\n }\n function xu(t4, e2) {\n for (var r2 = 0; r2 < t4.length; r2++) e2.writeDouble(t4[r2]);\n }\n function vu(t4, e2) {\n for (var r2 = 0; r2 < t4.length; r2++) e2.writeBoolean(t4[r2]);\n }\n function bu(t4, e2) {\n for (var r2 = 0; r2 < t4.length; r2++) e2.writeFixed32(t4[r2]);\n }\n function wu(t4, e2) {\n for (var r2 = 0; r2 < t4.length; r2++) e2.writeSFixed32(t4[r2]);\n }\n function _u(t4, e2) {\n for (var r2 = 0; r2 < t4.length; r2++) e2.writeFixed64(t4[r2]);\n }\n function Au(t4, e2) {\n for (var r2 = 0; r2 < t4.length; r2++) e2.writeSFixed64(t4[r2]);\n }\n function Su(t4, e2) {\n return (t4[e2] | t4[e2 + 1] << 8 | t4[e2 + 2] << 16) + 16777216 * t4[e2 + 3];\n }\n function ku(t4, e2, r2) {\n t4[r2] = e2, t4[r2 + 1] = e2 >>> 8, t4[r2 + 2] = e2 >>> 16, t4[r2 + 3] = e2 >>> 24;\n }\n function Mu(t4, e2) {\n return (t4[e2] | t4[e2 + 1] << 8 | t4[e2 + 2] << 16) + (t4[e2 + 3] << 24);\n }\n lu.prototype = { destroy: function() {\n this.buf = null;\n }, readFields: function(t4, e2, r2) {\n for (r2 = r2 || this.length; this.pos < r2; ) {\n var n2 = this.readVarint(), i2 = n2 >> 3, s2 = this.pos;\n this.type = 7 & n2, t4(i2, e2, this), this.pos === s2 && this.skip(n2);\n }\n return e2;\n }, readMessage: function(t4, e2) {\n return this.readFields(t4, e2, this.readVarint() + this.pos);\n }, readFixed32: function() {\n var t4 = Su(this.buf, this.pos);\n return this.pos += 4, t4;\n }, readSFixed32: function() {\n var t4 = Mu(this.buf, this.pos);\n return this.pos += 4, t4;\n }, readFixed64: function() {\n var t4 = Su(this.buf, this.pos) + Su(this.buf, this.pos + 4) * uu;\n return this.pos += 8, t4;\n }, readSFixed64: function() {\n var t4 = Su(this.buf, this.pos) + Mu(this.buf, this.pos + 4) * uu;\n return this.pos += 8, t4;\n }, readFloat: function() {\n var t4 = au(this.buf, this.pos, true, 23, 4);\n return this.pos += 4, t4;\n }, readDouble: function() {\n var t4 = au(this.buf, this.pos, true, 52, 8);\n return this.pos += 8, t4;\n }, readVarint: function(t4) {\n var e2, r2, n2 = this.buf;\n return e2 = 127 & (r2 = n2[this.pos++]), r2 < 128 ? e2 : (e2 |= (127 & (r2 = n2[this.pos++])) << 7, r2 < 128 ? e2 : (e2 |= (127 & (r2 = n2[this.pos++])) << 14, r2 < 128 ? e2 : (e2 |= (127 & (r2 = n2[this.pos++])) << 21, r2 < 128 ? e2 : function(t5, e3, r3) {\n var n3, i2, s2 = r3.buf;\n if (n3 = (112 & (i2 = s2[r3.pos++])) >> 4, i2 < 128) return fu(t5, n3, e3);\n if (n3 |= (127 & (i2 = s2[r3.pos++])) << 3, i2 < 128) return fu(t5, n3, e3);\n if (n3 |= (127 & (i2 = s2[r3.pos++])) << 10, i2 < 128) return fu(t5, n3, e3);\n if (n3 |= (127 & (i2 = s2[r3.pos++])) << 17, i2 < 128) return fu(t5, n3, e3);\n if (n3 |= (127 & (i2 = s2[r3.pos++])) << 24, i2 < 128) return fu(t5, n3, e3);\n if (n3 |= (1 & (i2 = s2[r3.pos++])) << 31, i2 < 128) return fu(t5, n3, e3);\n throw new Error(\"Expected varint not more than 10 bytes\");\n }(e2 |= (15 & (r2 = n2[this.pos])) << 28, t4, this))));\n }, readVarint64: function() {\n return this.readVarint(true);\n }, readSVarint: function() {\n var t4 = this.readVarint();\n return t4 % 2 == 1 ? (t4 + 1) / -2 : t4 / 2;\n }, readBoolean: function() {\n return Boolean(this.readVarint());\n }, readString: function() {\n var t4 = this.readVarint() + this.pos, e2 = this.pos;\n return this.pos = t4, t4 - e2 >= 12 && hu ? function(t5, e3, r2) {\n return hu.decode(t5.subarray(e3, r2));\n }(this.buf, e2, t4) : function(t5, e3, r2) {\n for (var n2 = \"\", i2 = e3; i2 < r2; ) {\n var s2, a2, o2, l2 = t5[i2], u2 = null, c2 = l2 > 239 ? 4 : l2 > 223 ? 3 : l2 > 191 ? 2 : 1;\n if (i2 + c2 > r2) break;\n 1 === c2 ? l2 < 128 && (u2 = l2) : 2 === c2 ? 128 == (192 & (s2 = t5[i2 + 1])) && (u2 = (31 & l2) << 6 | 63 & s2) <= 127 && (u2 = null) : 3 === c2 ? (a2 = t5[i2 + 2], 128 == (192 & (s2 = t5[i2 + 1])) && 128 == (192 & a2) && ((u2 = (15 & l2) << 12 | (63 & s2) << 6 | 63 & a2) <= 2047 || u2 >= 55296 && u2 <= 57343) && (u2 = null)) : 4 === c2 && (a2 = t5[i2 + 2], o2 = t5[i2 + 3], 128 == (192 & (s2 = t5[i2 + 1])) && 128 == (192 & a2) && 128 == (192 & o2) && ((u2 = (15 & l2) << 18 | (63 & s2) << 12 | (63 & a2) << 6 | 63 & o2) <= 65535 || u2 >= 1114112) && (u2 = null)), null === u2 ? (u2 = 65533, c2 = 1) : u2 > 65535 && (u2 -= 65536, n2 += String.fromCharCode(u2 >>> 10 & 1023 | 55296), u2 = 56320 | 1023 & u2), n2 += String.fromCharCode(u2), i2 += c2;\n }\n return n2;\n }(this.buf, e2, t4);\n }, readBytes: function() {\n var t4 = this.readVarint() + this.pos, e2 = this.buf.subarray(this.pos, t4);\n return this.pos = t4, e2;\n }, readPackedVarint: function(t4, e2) {\n if (this.type !== lu.Bytes) return t4.push(this.readVarint(e2));\n var r2 = pu(this);\n for (t4 = t4 || []; this.pos < r2; ) t4.push(this.readVarint(e2));\n return t4;\n }, readPackedSVarint: function(t4) {\n if (this.type !== lu.Bytes) return t4.push(this.readSVarint());\n var e2 = pu(this);\n for (t4 = t4 || []; this.pos < e2; ) t4.push(this.readSVarint());\n return t4;\n }, readPackedBoolean: function(t4) {\n if (this.type !== lu.Bytes) return t4.push(this.readBoolean());\n var e2 = pu(this);\n for (t4 = t4 || []; this.pos < e2; ) t4.push(this.readBoolean());\n return t4;\n }, readPackedFloat: function(t4) {\n if (this.type !== lu.Bytes) return t4.push(this.readFloat());\n var e2 = pu(this);\n for (t4 = t4 || []; this.pos < e2; ) t4.push(this.readFloat());\n return t4;\n }, readPackedDouble: function(t4) {\n if (this.type !== lu.Bytes) return t4.push(this.readDouble());\n var e2 = pu(this);\n for (t4 = t4 || []; this.pos < e2; ) t4.push(this.readDouble());\n return t4;\n }, readPackedFixed32: function(t4) {\n if (this.type !== lu.Bytes) return t4.push(this.readFixed32());\n var e2 = pu(this);\n for (t4 = t4 || []; this.pos < e2; ) t4.push(this.readFixed32());\n return t4;\n }, readPackedSFixed32: function(t4) {\n if (this.type !== lu.Bytes) return t4.push(this.readSFixed32());\n var e2 = pu(this);\n for (t4 = t4 || []; this.pos < e2; ) t4.push(this.readSFixed32());\n return t4;\n }, readPackedFixed64: function(t4) {\n if (this.type !== lu.Bytes) return t4.push(this.readFixed64());\n var e2 = pu(this);\n for (t4 = t4 || []; this.pos < e2; ) t4.push(this.readFixed64());\n return t4;\n }, readPackedSFixed64: function(t4) {\n if (this.type !== lu.Bytes) return t4.push(this.readSFixed64());\n var e2 = pu(this);\n for (t4 = t4 || []; this.pos < e2; ) t4.push(this.readSFixed64());\n return t4;\n }, skip: function(t4) {\n var e2 = 7 & t4;\n if (e2 === lu.Varint) for (; this.buf[this.pos++] > 127; ) ;\n else if (e2 === lu.Bytes) this.pos = this.readVarint() + this.pos;\n else if (e2 === lu.Fixed32) this.pos += 4;\n else {\n if (e2 !== lu.Fixed64) throw new Error(\"Unimplemented type: \" + e2);\n this.pos += 8;\n }\n }, writeTag: function(t4, e2) {\n this.writeVarint(t4 << 3 | e2);\n }, realloc: function(t4) {\n for (var e2 = this.length || 16; e2 < this.pos + t4; ) e2 *= 2;\n if (e2 !== this.length) {\n var r2 = new Uint8Array(e2);\n r2.set(this.buf), this.buf = r2, this.length = e2;\n }\n }, finish: function() {\n return this.length = this.pos, this.pos = 0, this.buf.subarray(0, this.length);\n }, writeFixed32: function(t4) {\n this.realloc(4), ku(this.buf, t4, this.pos), this.pos += 4;\n }, writeSFixed32: function(t4) {\n this.realloc(4), ku(this.buf, t4, this.pos), this.pos += 4;\n }, writeFixed64: function(t4) {\n this.realloc(8), ku(this.buf, -1 & t4, this.pos), ku(this.buf, Math.floor(t4 * cu), this.pos + 4), this.pos += 8;\n }, writeSFixed64: function(t4) {\n this.realloc(8), ku(this.buf, -1 & t4, this.pos), ku(this.buf, Math.floor(t4 * cu), this.pos + 4), this.pos += 8;\n }, writeVarint: function(t4) {\n (t4 = +t4 || 0) > 268435455 || t4 < 0 ? function(t5, e2) {\n var r2, n2;\n if (t5 >= 0 ? (r2 = t5 % 4294967296 | 0, n2 = t5 / 4294967296 | 0) : (n2 = ~(-t5 / 4294967296), 4294967295 ^ (r2 = ~(-t5 % 4294967296)) ? r2 = r2 + 1 | 0 : (r2 = 0, n2 = n2 + 1 | 0)), t5 >= 18446744073709552e3 || t5 < -18446744073709552e3) throw new Error(\"Given varint doesn't fit into 10 bytes\");\n e2.realloc(10), function(t6, e3, r3) {\n r3.buf[r3.pos++] = 127 & t6 | 128, t6 >>>= 7, r3.buf[r3.pos++] = 127 & t6 | 128, t6 >>>= 7, r3.buf[r3.pos++] = 127 & t6 | 128, t6 >>>= 7, r3.buf[r3.pos++] = 127 & t6 | 128, r3.buf[r3.pos] = 127 & (t6 >>>= 7);\n }(r2, 0, e2), function(t6, e3) {\n var r3 = (7 & t6) << 4;\n e3.buf[e3.pos++] |= r3 | ((t6 >>>= 3) ? 128 : 0), t6 && (e3.buf[e3.pos++] = 127 & t6 | ((t6 >>>= 7) ? 128 : 0), t6 && (e3.buf[e3.pos++] = 127 & t6 | ((t6 >>>= 7) ? 128 : 0), t6 && (e3.buf[e3.pos++] = 127 & t6 | ((t6 >>>= 7) ? 128 : 0), t6 && (e3.buf[e3.pos++] = 127 & t6 | ((t6 >>>= 7) ? 128 : 0), t6 && (e3.buf[e3.pos++] = 127 & t6)))));\n }(n2, e2);\n }(t4, this) : (this.realloc(4), this.buf[this.pos++] = 127 & t4 | (t4 > 127 ? 128 : 0), t4 <= 127 || (this.buf[this.pos++] = 127 & (t4 >>>= 7) | (t4 > 127 ? 128 : 0), t4 <= 127 || (this.buf[this.pos++] = 127 & (t4 >>>= 7) | (t4 > 127 ? 128 : 0), t4 <= 127 || (this.buf[this.pos++] = t4 >>> 7 & 127))));\n }, writeSVarint: function(t4) {\n this.writeVarint(t4 < 0 ? 2 * -t4 - 1 : 2 * t4);\n }, writeBoolean: function(t4) {\n this.writeVarint(Boolean(t4));\n }, writeString: function(t4) {\n t4 = String(t4), this.realloc(4 * t4.length), this.pos++;\n var e2 = this.pos;\n this.pos = function(t5, e3, r3) {\n for (var n2, i2, s2 = 0; s2 < e3.length; s2++) {\n if ((n2 = e3.charCodeAt(s2)) > 55295 && n2 < 57344) {\n if (!i2) {\n n2 > 56319 || s2 + 1 === e3.length ? (t5[r3++] = 239, t5[r3++] = 191, t5[r3++] = 189) : i2 = n2;\n continue;\n }\n if (n2 < 56320) {\n t5[r3++] = 239, t5[r3++] = 191, t5[r3++] = 189, i2 = n2;\n continue;\n }\n n2 = i2 - 55296 << 10 | n2 - 56320 | 65536, i2 = null;\n } else i2 && (t5[r3++] = 239, t5[r3++] = 191, t5[r3++] = 189, i2 = null);\n n2 < 128 ? t5[r3++] = n2 : (n2 < 2048 ? t5[r3++] = n2 >> 6 | 192 : (n2 < 65536 ? t5[r3++] = n2 >> 12 | 224 : (t5[r3++] = n2 >> 18 | 240, t5[r3++] = n2 >> 12 & 63 | 128), t5[r3++] = n2 >> 6 & 63 | 128), t5[r3++] = 63 & n2 | 128);\n }\n return r3;\n }(this.buf, t4, this.pos);\n var r2 = this.pos - e2;\n r2 >= 128 && du(e2, r2, this), this.pos = e2 - 1, this.writeVarint(r2), this.pos += r2;\n }, writeFloat: function(t4) {\n this.realloc(4), ou(this.buf, t4, this.pos, true, 23, 4), this.pos += 4;\n }, writeDouble: function(t4) {\n this.realloc(8), ou(this.buf, t4, this.pos, true, 52, 8), this.pos += 8;\n }, writeBytes: function(t4) {\n var e2 = t4.length;\n this.writeVarint(e2), this.realloc(e2);\n for (var r2 = 0; r2 < e2; r2++) this.buf[this.pos++] = t4[r2];\n }, writeRawMessage: function(t4, e2) {\n this.pos++;\n var r2 = this.pos;\n t4(e2, this);\n var n2 = this.pos - r2;\n n2 >= 128 && du(r2, n2, this), this.pos = r2 - 1, this.writeVarint(n2), this.pos += n2;\n }, writeMessage: function(t4, e2, r2) {\n this.writeTag(t4, lu.Bytes), this.writeRawMessage(e2, r2);\n }, writePackedVarint: function(t4, e2) {\n e2.length && this.writeMessage(t4, yu, e2);\n }, writePackedSVarint: function(t4, e2) {\n e2.length && this.writeMessage(t4, mu, e2);\n }, writePackedBoolean: function(t4, e2) {\n e2.length && this.writeMessage(t4, vu, e2);\n }, writePackedFloat: function(t4, e2) {\n e2.length && this.writeMessage(t4, gu, e2);\n }, writePackedDouble: function(t4, e2) {\n e2.length && this.writeMessage(t4, xu, e2);\n }, writePackedFixed32: function(t4, e2) {\n e2.length && this.writeMessage(t4, bu, e2);\n }, writePackedSFixed32: function(t4, e2) {\n e2.length && this.writeMessage(t4, wu, e2);\n }, writePackedFixed64: function(t4, e2) {\n e2.length && this.writeMessage(t4, _u, e2);\n }, writePackedSFixed64: function(t4, e2) {\n e2.length && this.writeMessage(t4, Au, e2);\n }, writeBytesField: function(t4, e2) {\n this.writeTag(t4, lu.Bytes), this.writeBytes(e2);\n }, writeFixed32Field: function(t4, e2) {\n this.writeTag(t4, lu.Fixed32), this.writeFixed32(e2);\n }, writeSFixed32Field: function(t4, e2) {\n this.writeTag(t4, lu.Fixed32), this.writeSFixed32(e2);\n }, writeFixed64Field: function(t4, e2) {\n this.writeTag(t4, lu.Fixed64), this.writeFixed64(e2);\n }, writeSFixed64Field: function(t4, e2) {\n this.writeTag(t4, lu.Fixed64), this.writeSFixed64(e2);\n }, writeVarintField: function(t4, e2) {\n this.writeTag(t4, lu.Varint), this.writeVarint(e2);\n }, writeSVarintField: function(t4, e2) {\n this.writeTag(t4, lu.Varint), this.writeSVarint(e2);\n }, writeStringField: function(t4, e2) {\n this.writeTag(t4, lu.Bytes), this.writeString(e2);\n }, writeFloatField: function(t4, e2) {\n this.writeTag(t4, lu.Fixed32), this.writeFloat(e2);\n }, writeDoubleField: function(t4, e2) {\n this.writeTag(t4, lu.Fixed64), this.writeDouble(e2);\n }, writeBooleanField: function(t4, e2) {\n this.writeVarintField(t4, Boolean(e2));\n } };\n var Iu = r(su);\n const zu = 3;\n function Pu(t4, e2, r2) {\n 1 === t4 && r2.readMessage(Cu, e2);\n }\n function Cu(t4, e2, r2) {\n if (3 === t4) {\n const { id: t5, bitmap: n2, width: i2, height: s2, left: a2, top: o2, advance: l2 } = r2.readMessage(Bu, {});\n e2.push({ id: t5, bitmap: new _o({ width: i2 + 2 * zu, height: s2 + 2 * zu }, n2), metrics: { width: i2, height: s2, left: a2, top: o2, advance: l2 } });\n }\n }\n function Bu(t4, e2, r2) {\n 1 === t4 ? e2.id = r2.readVarint() : 2 === t4 ? e2.bitmap = r2.readBytes() : 3 === t4 ? e2.width = r2.readVarint() : 4 === t4 ? e2.height = r2.readVarint() : 5 === t4 ? e2.left = r2.readSVarint() : 6 === t4 ? e2.top = r2.readSVarint() : 7 === t4 && (e2.advance = r2.readVarint());\n }\n const Vu = zu;\n function Eu(t4) {\n let e2 = 0, r2 = 0;\n for (const n3 of t4) e2 += n3.w * n3.h, r2 = Math.max(r2, n3.w);\n t4.sort((t5, e3) => e3.h - t5.h);\n const n2 = [{ x: 0, y: 0, w: Math.max(Math.ceil(Math.sqrt(e2 / 0.95)), r2), h: 1 / 0 }];\n let i2 = 0, s2 = 0;\n for (const e3 of t4) for (let t5 = n2.length - 1; t5 >= 0; t5--) {\n const r3 = n2[t5];\n if (!(e3.w > r3.w || e3.h > r3.h)) {\n if (e3.x = r3.x, e3.y = r3.y, s2 = Math.max(s2, e3.y + e3.h), i2 = Math.max(i2, e3.x + e3.w), e3.w === r3.w && e3.h === r3.h) {\n const e4 = n2.pop();\n t5 < n2.length && (n2[t5] = e4);\n } else e3.h === r3.h ? (r3.x += e3.w, r3.w -= e3.w) : e3.w === r3.w ? (r3.y += e3.h, r3.h -= e3.h) : (n2.push({ x: r3.x + e3.w, y: r3.y, w: r3.w - e3.w, h: e3.h }), r3.y += e3.h, r3.h -= e3.h);\n break;\n }\n }\n return { w: i2, h: s2, fill: e2 / (i2 * s2) || 0 };\n }\n const Fu = 1;\n class Tu {\n constructor(t4, { pixelRatio: e2, version: r2, stretchX: n2, stretchY: i2, content: s2, textFitWidth: a2, textFitHeight: o2 }) {\n this.paddedRect = t4, this.pixelRatio = e2, this.stretchX = n2, this.stretchY = i2, this.content = s2, this.version = r2, this.textFitWidth = a2, this.textFitHeight = o2;\n }\n get tl() {\n return [this.paddedRect.x + Fu, this.paddedRect.y + Fu];\n }\n get br() {\n return [this.paddedRect.x + this.paddedRect.w - Fu, this.paddedRect.y + this.paddedRect.h - Fu];\n }\n get tlbr() {\n return this.tl.concat(this.br);\n }\n get displaySize() {\n return [(this.paddedRect.w - 2 * Fu) / this.pixelRatio, (this.paddedRect.h - 2 * Fu) / this.pixelRatio];\n }\n }\n class $u {\n constructor(t4, e2) {\n const r2 = {}, n2 = {};\n this.haveRenderCallbacks = [];\n const i2 = [];\n this.addImages(t4, r2, i2), this.addImages(e2, n2, i2);\n const { w: s2, h: a2 } = Eu(i2), o2 = new Ao({ width: s2 || 1, height: a2 || 1 });\n for (const e3 in t4) {\n const n3 = t4[e3], i3 = r2[e3].paddedRect;\n Ao.copy(n3.data, o2, { x: 0, y: 0 }, { x: i3.x + Fu, y: i3.y + Fu }, n3.data);\n }\n for (const t5 in e2) {\n const r3 = e2[t5], i3 = n2[t5].paddedRect, s3 = i3.x + Fu, a3 = i3.y + Fu, l2 = r3.data.width, u2 = r3.data.height;\n Ao.copy(r3.data, o2, { x: 0, y: 0 }, { x: s3, y: a3 }, r3.data), Ao.copy(r3.data, o2, { x: 0, y: u2 - 1 }, { x: s3, y: a3 - 1 }, { width: l2, height: 1 }), Ao.copy(r3.data, o2, { x: 0, y: 0 }, { x: s3, y: a3 + u2 }, { width: l2, height: 1 }), Ao.copy(r3.data, o2, { x: l2 - 1, y: 0 }, { x: s3 - 1, y: a3 }, { width: 1, height: u2 }), Ao.copy(r3.data, o2, { x: 0, y: 0 }, { x: s3 + l2, y: a3 }, { width: 1, height: u2 });\n }\n this.image = o2, this.iconPositions = r2, this.patternPositions = n2;\n }\n addImages(t4, e2, r2) {\n for (const n2 in t4) {\n const i2 = t4[n2], s2 = { x: 0, y: 0, w: i2.data.width + 2 * Fu, h: i2.data.height + 2 * Fu };\n r2.push(s2), e2[n2] = new Tu(s2, i2), i2.hasRenderCallback && this.haveRenderCallbacks.push(n2);\n }\n }\n patchUpdatedImages(t4, e2) {\n t4.dispatchRenderCallbacks(this.haveRenderCallbacks);\n for (const r2 in t4.updatedImages) this.patchUpdatedImage(this.iconPositions[r2], t4.getImage(r2), e2), this.patchUpdatedImage(this.patternPositions[r2], t4.getImage(r2), e2);\n }\n patchUpdatedImage(t4, e2, r2) {\n if (!t4 || !e2) return;\n if (t4.version === e2.version) return;\n t4.version = e2.version;\n const [n2, i2] = t4.tl;\n r2.update(e2.data, void 0, { x: n2, y: i2 });\n }\n }\n var Lu;\n wi(\"ImagePosition\", Tu), wi(\"ImageAtlas\", $u), t.ah = void 0, (Lu = t.ah || (t.ah = {}))[Lu.none = 0] = \"none\", Lu[Lu.horizontal = 1] = \"horizontal\", Lu[Lu.vertical = 2] = \"vertical\", Lu[Lu.horizontalOnly = 3] = \"horizontalOnly\";\n const Du = -17;\n class Ou {\n constructor() {\n this.scale = 1, this.fontStack = \"\", this.imageName = null;\n }\n static forText(t4, e2) {\n const r2 = new Ou();\n return r2.scale = t4 || 1, r2.fontStack = e2, r2;\n }\n static forImage(t4) {\n const e2 = new Ou();\n return e2.imageName = t4, e2;\n }\n }\n class ju {\n constructor() {\n this.text = \"\", this.sectionIndex = [], this.sections = [], this.imageSectionID = null;\n }\n static fromFeature(t4, e2) {\n const r2 = new ju();\n for (let n2 = 0; n2 < t4.sections.length; n2++) {\n const i2 = t4.sections[n2];\n i2.image ? r2.addImageSection(i2) : r2.addTextSection(i2, e2);\n }\n return r2;\n }\n length() {\n return this.text.length;\n }\n getSection(t4) {\n return this.sections[this.sectionIndex[t4]];\n }\n getSectionIndex(t4) {\n return this.sectionIndex[t4];\n }\n getCharCode(t4) {\n return this.text.charCodeAt(t4);\n }\n verticalizePunctuation() {\n this.text = function(t4) {\n let e2 = \"\";\n for (let r2 = 0; r2 < t4.length; r2++) {\n const n2 = t4.charCodeAt(r2 + 1) || null, i2 = t4.charCodeAt(r2 - 1) || null;\n e2 += n2 && $i(n2) && !nu[t4[r2 + 1]] || i2 && $i(i2) && !nu[t4[r2 - 1]] || !nu[t4[r2]] ? t4[r2] : nu[t4[r2]];\n }\n return e2;\n }(this.text);\n }\n trim() {\n let t4 = 0;\n for (let e3 = 0; e3 < this.text.length && Uu[this.text.charCodeAt(e3)]; e3++) t4++;\n let e2 = this.text.length;\n for (let r2 = this.text.length - 1; r2 >= 0 && r2 >= t4 && Uu[this.text.charCodeAt(r2)]; r2--) e2--;\n this.text = this.text.substring(t4, e2), this.sectionIndex = this.sectionIndex.slice(t4, e2);\n }\n substring(t4, e2) {\n const r2 = new ju();\n return r2.text = this.text.substring(t4, e2), r2.sectionIndex = this.sectionIndex.slice(t4, e2), r2.sections = this.sections, r2;\n }\n toString() {\n return this.text;\n }\n getMaxScale() {\n return this.sectionIndex.reduce((t4, e2) => Math.max(t4, this.sections[e2].scale), 0);\n }\n addTextSection(t4, e2) {\n this.text += t4.text, this.sections.push(Ou.forText(t4.scale, t4.fontStack || e2));\n const r2 = this.sections.length - 1;\n for (let e3 = 0; e3 < t4.text.length; ++e3) this.sectionIndex.push(r2);\n }\n addImageSection(t4) {\n const e2 = t4.image ? t4.image.name : \"\";\n if (0 === e2.length) return void A2(\"Can't add FormattedSection with an empty image.\");\n const r2 = this.getNextImageSectionCharCode();\n r2 ? (this.text += String.fromCharCode(r2), this.sections.push(Ou.forImage(e2)), this.sectionIndex.push(this.sections.length - 1)) : A2(\"Reached maximum number of images 6401\");\n }\n getNextImageSectionCharCode() {\n return this.imageSectionID ? this.imageSectionID >= 63743 ? null : ++this.imageSectionID : (this.imageSectionID = 57344, this.imageSectionID);\n }\n }\n function Ru(e2, r2, n2, i2, s2, a2, o2, l2, u2, c2, h2, p2, f2, d2, y2) {\n const m2 = ju.fromFeature(e2, s2);\n let g2;\n p2 === t.ah.vertical && m2.verticalizePunctuation();\n const { processBidirectionalText: x2, processStyledBidirectionalText: v2 } = Ri;\n if (x2 && 1 === m2.sections.length) {\n g2 = [];\n const t4 = x2(m2.toString(), Yu(m2, c2, a2, r2, i2, d2));\n for (const e3 of t4) {\n const t5 = new ju();\n t5.text = e3, t5.sections = m2.sections;\n for (let r3 = 0; r3 < e3.length; r3++) t5.sectionIndex.push(0);\n g2.push(t5);\n }\n } else if (v2) {\n g2 = [];\n const t4 = v2(m2.text, m2.sectionIndex, Yu(m2, c2, a2, r2, i2, d2));\n for (const e3 of t4) {\n const t5 = new ju();\n t5.text = e3[0], t5.sectionIndex = e3[1], t5.sections = m2.sections, g2.push(t5);\n }\n } else g2 = function(t4, e3) {\n const r3 = [], n3 = t4.text;\n let i3 = 0;\n for (const n4 of e3) r3.push(t4.substring(i3, n4)), i3 = n4;\n return i3 < n3.length && r3.push(t4.substring(i3, n3.length)), r3;\n }(m2, Yu(m2, c2, a2, r2, i2, d2));\n const b2 = [], w2 = { positionedLines: b2, text: m2.toString(), top: h2[1], bottom: h2[1], left: h2[0], right: h2[0], writingMode: p2, iconsInText: false, verticalizable: false };\n return function(e3, r3, n3, i3, s3, a3, o3, l3, u3, c3, h3, p3) {\n let f3 = 0, d3 = Du, y3 = 0, m3 = 0;\n const g3 = \"right\" === l3 ? 1 : \"left\" === l3 ? 0 : 0.5;\n let x3 = 0;\n for (const o4 of s3) {\n o4.trim();\n const s4 = o4.getMaxScale(), l4 = (s4 - 1) * iu, b4 = { positionedGlyphs: [], lineOffset: 0 };\n e3.positionedLines[x3] = b4;\n const w4 = b4.positionedGlyphs;\n let _3 = 0;\n if (!o4.length()) {\n d3 += a3, ++x3;\n continue;\n }\n for (let a4 = 0; a4 < o4.length(); a4++) {\n const y4 = o4.getSection(a4), m4 = o4.getSectionIndex(a4), g4 = o4.getCharCode(a4);\n let x4 = 0, b5 = null, A4 = null, S2 = null, k2 = iu;\n const M2 = !(u3 === t.ah.horizontal || !h3 && !Ti(g4) || h3 && (Uu[g4] || (v3 = g4, new RegExp(\"\\\\p{sc=Arab}\", \"u\").test(String.fromCodePoint(v3)))));\n if (y4.imageName) {\n const t4 = i3[y4.imageName];\n if (!t4) continue;\n S2 = y4.imageName, e3.iconsInText = e3.iconsInText || true, A4 = t4.paddedRect;\n const r4 = t4.displaySize;\n y4.scale = y4.scale * iu / p3, b5 = { width: r4[0], height: r4[1], left: Fu, top: -Vu, advance: M2 ? r4[1] : r4[0] }, x4 = l4 + (iu - r4[1] * y4.scale), k2 = b5.advance;\n const n4 = M2 ? r4[0] * y4.scale - iu * s4 : r4[1] * y4.scale - iu * s4;\n n4 > 0 && n4 > _3 && (_3 = n4);\n } else {\n const t4 = n3[y4.fontStack], e4 = t4 && t4[g4];\n if (e4 && e4.rect) A4 = e4.rect, b5 = e4.metrics;\n else {\n const t5 = r3[y4.fontStack], e5 = t5 && t5[g4];\n if (!e5) continue;\n b5 = e5.metrics;\n }\n x4 = (s4 - y4.scale) * iu;\n }\n M2 ? (e3.verticalizable = true, w4.push({ glyph: g4, imageName: S2, x: f3, y: d3 + x4, vertical: M2, scale: y4.scale, fontStack: y4.fontStack, sectionIndex: m4, metrics: b5, rect: A4 }), f3 += k2 * y4.scale + c3) : (w4.push({ glyph: g4, imageName: S2, x: f3, y: d3 + x4, vertical: M2, scale: y4.scale, fontStack: y4.fontStack, sectionIndex: m4, metrics: b5, rect: A4 }), f3 += b5.advance * y4.scale + c3);\n }\n 0 !== w4.length && (y3 = Math.max(f3 - c3, y3), Wu(w4, 0, w4.length - 1, g3, _3)), f3 = 0;\n const A3 = a3 * s4 + _3;\n b4.lineOffset = Math.max(_3, l4), d3 += A3, m3 = Math.max(A3, m3), ++x3;\n }\n var v3;\n const b3 = d3 - Du, { horizontalAlign: w3, verticalAlign: _2 } = Ju(o3);\n (function(t4, e4, r4, n4, i4, s4, a4, o4, l4) {\n const u4 = (e4 - r4) * i4;\n let c4 = 0;\n c4 = s4 !== a4 ? -o4 * n4 - Du : (-n4 * l4 + 0.5) * a4;\n for (const e5 of t4) for (const t5 of e5.positionedGlyphs) t5.x += u4, t5.y += c4;\n })(e3.positionedLines, g3, w3, _2, y3, m3, a3, b3, s3.length), e3.top += -_2 * b3, e3.bottom = e3.top + b3, e3.left += -w3 * y3, e3.right = e3.left + y3;\n }(w2, r2, n2, i2, g2, o2, l2, u2, p2, c2, f2, y2), !function(t4) {\n for (const e3 of t4) if (0 !== e3.positionedGlyphs.length) return false;\n return true;\n }(b2) && w2;\n }\n const Uu = { 9: true, 10: true, 11: true, 12: true, 13: true, 32: true }, qu = { 10: true, 32: true, 38: true, 41: true, 43: true, 45: true, 47: true, 173: true, 183: true, 8203: true, 8208: true, 8211: true, 8231: true }, Nu = { 40: true };\n function Zu(t4, e2, r2, n2, i2, s2) {\n if (e2.imageName) {\n const t5 = n2[e2.imageName];\n return t5 ? t5.displaySize[0] * e2.scale * iu / s2 + i2 : 0;\n }\n {\n const n3 = r2[e2.fontStack], s3 = n3 && n3[t4];\n return s3 ? s3.metrics.advance * e2.scale + i2 : 0;\n }\n }\n function Gu(t4, e2, r2, n2) {\n const i2 = Math.pow(t4 - e2, 2);\n return n2 ? t4 < e2 ? i2 / 2 : 2 * i2 : i2 + Math.abs(r2) * r2;\n }\n function Ku(t4, e2, r2) {\n let n2 = 0;\n return 10 === t4 && (n2 -= 1e4), r2 && (n2 += 150), 40 !== t4 && 65288 !== t4 || (n2 += 50), 41 !== e2 && 65289 !== e2 || (n2 += 50), n2;\n }\n function Xu(t4, e2, r2, n2, i2, s2) {\n let a2 = null, o2 = Gu(e2, r2, i2, s2);\n for (const t5 of n2) {\n const n3 = Gu(e2 - t5.x, r2, i2, s2) + t5.badness;\n n3 <= o2 && (a2 = t5, o2 = n3);\n }\n return { index: t4, x: e2, priorBreak: a2, badness: o2 };\n }\n function Hu(t4) {\n return t4 ? Hu(t4.priorBreak).concat(t4.index) : [];\n }\n function Yu(t4, e2, r2, n2, i2, s2) {\n if (!t4) return [];\n const a2 = [], o2 = function(t5, e3, r3, n3, i3, s3) {\n let a3 = 0;\n for (let r4 = 0; r4 < t5.length(); r4++) {\n const o3 = t5.getSection(r4);\n a3 += Zu(t5.getCharCode(r4), o3, n3, i3, e3, s3);\n }\n return a3 / Math.max(1, Math.ceil(a3 / r3));\n }(t4, e2, r2, n2, i2, s2), l2 = t4.text.indexOf(\"\\u200B\") >= 0;\n let u2 = 0;\n for (let r3 = 0; r3 < t4.length(); r3++) {\n const h2 = t4.getSection(r3), p2 = t4.getCharCode(r3);\n if (Uu[p2] || (u2 += Zu(p2, h2, n2, i2, e2, s2)), r3 < t4.length() - 1) {\n const e3 = !((c2 = p2) < 11904) && (!!zi[\"CJK Compatibility Forms\"](c2) || !!zi[\"CJK Compatibility\"](c2) || !!zi[\"CJK Strokes\"](c2) || !!zi[\"CJK Symbols and Punctuation\"](c2) || !!zi[\"Enclosed CJK Letters and Months\"](c2) || !!zi[\"Halfwidth and Fullwidth Forms\"](c2) || !!zi[\"Ideographic Description Characters\"](c2) || !!zi[\"Vertical Forms\"](c2) || Fi.test(String.fromCodePoint(c2)));\n (qu[p2] || e3 || h2.imageName || r3 !== t4.length() - 2 && Nu[t4.getCharCode(r3 + 1)]) && a2.push(Xu(r3 + 1, u2, o2, a2, Ku(p2, t4.getCharCode(r3 + 1), e3 && l2), false));\n }\n }\n var c2;\n return Hu(Xu(t4.length(), u2, o2, a2, 0, true));\n }\n function Ju(t4) {\n let e2 = 0.5, r2 = 0.5;\n switch (t4) {\n case \"right\":\n case \"top-right\":\n case \"bottom-right\":\n e2 = 1;\n break;\n case \"left\":\n case \"top-left\":\n case \"bottom-left\":\n e2 = 0;\n }\n switch (t4) {\n case \"bottom\":\n case \"bottom-right\":\n case \"bottom-left\":\n r2 = 1;\n break;\n case \"top\":\n case \"top-right\":\n case \"top-left\":\n r2 = 0;\n }\n return { horizontalAlign: e2, verticalAlign: r2 };\n }\n function Wu(t4, e2, r2, n2, i2) {\n if (!n2 && !i2) return;\n const s2 = t4[r2], a2 = (t4[r2].x + s2.metrics.advance * s2.scale) * n2;\n for (let n3 = e2; n3 <= r2; n3++) t4[n3].x -= a2, t4[n3].y += i2;\n }\n function Qu(t4, e2, r2) {\n const { horizontalAlign: n2, verticalAlign: i2 } = Ju(r2), s2 = e2[0] - t4.displaySize[0] * n2, a2 = e2[1] - t4.displaySize[1] * i2;\n return { image: t4, top: a2, bottom: a2 + t4.displaySize[1], left: s2, right: s2 + t4.displaySize[0] };\n }\n function tc(t4) {\n var e2, r2;\n let n2 = t4.left, i2 = t4.top, s2 = t4.right - n2, a2 = t4.bottom - i2;\n const o2 = null !== (e2 = t4.image.textFitWidth) && void 0 !== e2 ? e2 : \"stretchOrShrink\", l2 = null !== (r2 = t4.image.textFitHeight) && void 0 !== r2 ? r2 : \"stretchOrShrink\", u2 = (t4.image.content[2] - t4.image.content[0]) / (t4.image.content[3] - t4.image.content[1]);\n if (\"proportional\" === l2) {\n if (\"stretchOnly\" === o2 && s2 / a2 < u2 || \"proportional\" === o2) {\n const t5 = Math.ceil(a2 * u2);\n n2 *= t5 / s2, s2 = t5;\n }\n } else if (\"proportional\" === o2 && \"stretchOnly\" === l2 && 0 !== u2 && s2 / a2 > u2) {\n const t5 = Math.ceil(s2 / u2);\n i2 *= t5 / a2, a2 = t5;\n }\n return { x1: n2, y1: i2, x2: n2 + s2, y2: i2 + a2 };\n }\n function ec(t4, e2, r2, n2, i2, s2) {\n const a2 = t4.image;\n let o2;\n if (a2.content) {\n const t5 = a2.content, e3 = a2.pixelRatio || 1;\n o2 = [t5[0] / e3, t5[1] / e3, a2.displaySize[0] - t5[2] / e3, a2.displaySize[1] - t5[3] / e3];\n }\n const l2 = e2.left * s2, u2 = e2.right * s2;\n let c2, h2, p2, f2;\n \"width\" === r2 || \"both\" === r2 ? (f2 = i2[0] + l2 - n2[3], h2 = i2[0] + u2 + n2[1]) : (f2 = i2[0] + (l2 + u2 - a2.displaySize[0]) / 2, h2 = f2 + a2.displaySize[0]);\n const d2 = e2.top * s2, y2 = e2.bottom * s2;\n return \"height\" === r2 || \"both\" === r2 ? (c2 = i2[1] + d2 - n2[0], p2 = i2[1] + y2 + n2[2]) : (c2 = i2[1] + (d2 + y2 - a2.displaySize[1]) / 2, p2 = c2 + a2.displaySize[1]), { image: a2, top: c2, right: h2, bottom: p2, left: f2, collisionPadding: o2 };\n }\n const rc = 255, nc = 128, ic = rc * nc;\n function sc(t4, e2) {\n const { expression: r2 } = e2;\n if (\"constant\" === r2.kind) return { kind: \"constant\", layoutSize: r2.evaluate(new Ui(t4 + 1)) };\n if (\"source\" === r2.kind) return { kind: \"source\" };\n {\n const { zoomStops: e3, interpolationType: n2 } = r2;\n let i2 = 0;\n for (; i2 < e3.length && e3[i2] <= t4; ) i2++;\n i2 = Math.max(0, i2 - 1);\n let s2 = i2;\n for (; s2 < e3.length && e3[s2] < t4 + 1; ) s2++;\n s2 = Math.min(e3.length - 1, s2);\n const a2 = e3[i2], o2 = e3[s2];\n return \"composite\" === r2.kind ? { kind: \"composite\", minZoom: a2, maxZoom: o2, interpolationType: n2 } : { kind: \"camera\", minZoom: a2, maxZoom: o2, minSize: r2.evaluate(new Ui(a2)), maxSize: r2.evaluate(new Ui(o2)), interpolationType: n2 };\n }\n }\n function ac(t4, e2, r2) {\n let n2 = \"never\";\n const i2 = t4.get(e2);\n return i2 ? n2 = i2 : t4.get(r2) && (n2 = \"always\"), n2;\n }\n const oc = fl.VectorTileFeature.types, lc = [{ name: \"a_fade_opacity\", components: 1, type: \"Uint8\", offset: 0 }];\n function uc(t4, e2, r2, n2, i2, s2, a2, o2, l2, u2, c2, h2, p2) {\n const f2 = o2 ? Math.min(ic, Math.round(o2[0])) : 0, d2 = o2 ? Math.min(ic, Math.round(o2[1])) : 0;\n t4.emplaceBack(e2, r2, Math.round(32 * n2), Math.round(32 * i2), s2, a2, (f2 << 1) + (l2 ? 1 : 0), d2, 16 * u2, 16 * c2, 256 * h2, 256 * p2);\n }\n function cc(t4, e2, r2) {\n t4.emplaceBack(e2.x, e2.y, r2), t4.emplaceBack(e2.x, e2.y, r2), t4.emplaceBack(e2.x, e2.y, r2), t4.emplaceBack(e2.x, e2.y, r2);\n }\n function hc(t4) {\n for (const e2 of t4.sections) if (ji(e2.text)) return true;\n return false;\n }\n class pc {\n constructor(t4) {\n this.layoutVertexArray = new Ws(), this.indexArray = new na(), this.programConfigurations = t4, this.segments = new oa(), this.dynamicLayoutVertexArray = new Qs(), this.opacityVertexArray = new ta(), this.hasVisibleVertices = false, this.placedSymbolArray = new $s();\n }\n isEmpty() {\n return 0 === this.layoutVertexArray.length && 0 === this.indexArray.length && 0 === this.dynamicLayoutVertexArray.length && 0 === this.opacityVertexArray.length;\n }\n upload(t4, e2, r2, n2) {\n this.isEmpty() || (r2 && (this.layoutVertexBuffer = t4.createVertexBuffer(this.layoutVertexArray, Jl.members), this.indexBuffer = t4.createIndexBuffer(this.indexArray, e2), this.dynamicLayoutVertexBuffer = t4.createVertexBuffer(this.dynamicLayoutVertexArray, Wl.members, true), this.opacityVertexBuffer = t4.createVertexBuffer(this.opacityVertexArray, lc, true), this.opacityVertexBuffer.itemSize = 1), (r2 || n2) && this.programConfigurations.upload(t4));\n }\n destroy() {\n this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.dynamicLayoutVertexBuffer.destroy(), this.opacityVertexBuffer.destroy());\n }\n }\n wi(\"SymbolBuffers\", pc);\n class fc {\n constructor(t4, e2, r2) {\n this.layoutVertexArray = new t4(), this.layoutAttributes = e2, this.indexArray = new r2(), this.segments = new oa(), this.collisionVertexArray = new ra();\n }\n upload(t4) {\n this.layoutVertexBuffer = t4.createVertexBuffer(this.layoutVertexArray, this.layoutAttributes), this.indexBuffer = t4.createIndexBuffer(this.indexArray), this.collisionVertexBuffer = t4.createVertexBuffer(this.collisionVertexArray, Ql.members, true);\n }\n destroy() {\n this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(), this.collisionVertexBuffer.destroy());\n }\n }\n wi(\"CollisionBuffers\", fc);\n class dc {\n constructor(e2) {\n this.collisionBoxArray = e2.collisionBoxArray, this.zoom = e2.zoom, this.overscaling = e2.overscaling, this.layers = e2.layers, this.layerIds = this.layers.map((t4) => t4.id), this.index = e2.index, this.pixelRatio = e2.pixelRatio, this.sourceLayerIndex = e2.sourceLayerIndex, this.hasPattern = false, this.hasRTLText = false, this.sortKeyRanges = [], this.collisionCircleArray = [], this.placementInvProjMatrix = lo([]), this.placementViewportMatrix = lo([]);\n const r2 = this.layers[0]._unevaluatedLayout._values;\n this.textSizeData = sc(this.zoom, r2[\"text-size\"]), this.iconSizeData = sc(this.zoom, r2[\"icon-size\"]);\n const n2 = this.layers[0].layout, i2 = n2.get(\"symbol-sort-key\"), s2 = n2.get(\"symbol-z-order\");\n this.canOverlap = \"never\" !== ac(n2, \"text-overlap\", \"text-allow-overlap\") || \"never\" !== ac(n2, \"icon-overlap\", \"icon-allow-overlap\") || n2.get(\"text-ignore-placement\") || n2.get(\"icon-ignore-placement\"), this.sortFeaturesByKey = \"viewport-y\" !== s2 && !i2.isConstant(), this.sortFeaturesByY = (\"viewport-y\" === s2 || \"auto\" === s2 && !this.sortFeaturesByKey) && this.canOverlap, \"point\" === n2.get(\"symbol-placement\") && (this.writingModes = n2.get(\"text-writing-mode\").map((e3) => t.ah[e3])), this.stateDependentLayerIds = this.layers.filter((t4) => t4.isStateDependent()).map((t4) => t4.id), this.sourceID = e2.sourceID;\n }\n createArrays() {\n this.text = new pc(new Ea(this.layers, this.zoom, (t4) => /^text/.test(t4))), this.icon = new pc(new Ea(this.layers, this.zoom, (t4) => /^icon/.test(t4))), this.glyphOffsetArray = new Os(), this.lineVertexArray = new js(), this.symbolInstances = new Ds(), this.textAnchorOffsets = new Us();\n }\n calculateGlyphDependencies(t4, e2, r2, n2, i2) {\n for (let s2 = 0; s2 < t4.length; s2++) if (e2[t4.charCodeAt(s2)] = true, (r2 || n2) && i2) {\n const r3 = nu[t4.charAt(s2)];\n r3 && (e2[r3.charCodeAt(0)] = true);\n }\n }\n populate(e2, r2, n2) {\n const i2 = this.layers[0], s2 = i2.layout, a2 = s2.get(\"text-font\"), o2 = s2.get(\"text-field\"), l2 = s2.get(\"icon-image\"), u2 = (\"constant\" !== o2.value.kind || o2.value.value instanceof Yt && !o2.value.value.isEmpty() || o2.value.value.toString().length > 0) && (\"constant\" !== a2.value.kind || a2.value.value.length > 0), c2 = \"constant\" !== l2.value.kind || !!l2.value.value || Object.keys(l2.parameters).length > 0, h2 = s2.get(\"symbol-sort-key\");\n if (this.features = [], !u2 && !c2) return;\n const p2 = r2.iconDependencies, f2 = r2.glyphDependencies, d2 = r2.availableImages, y2 = new Ui(this.zoom);\n for (const { feature: r3, id: o3, index: l3, sourceLayerIndex: m2 } of e2) {\n const e3 = i2._featureFilter.needGeometry, g2 = ja(r3, e3);\n if (!i2._featureFilter.filter(y2, g2, n2)) continue;\n let x2, v2;\n if (e3 || (g2.geometry = Oa(r3)), u2) {\n const t4 = i2.getValueAndResolveTokens(\"text-field\", g2, n2, d2), e4 = Yt.factory(t4), r4 = this.hasRTLText = this.hasRTLText || hc(e4);\n (!r4 || \"unavailable\" === Ri.getRTLTextPluginStatus() || r4 && Ri.isParsed()) && (x2 = ru(e4, i2, g2));\n }\n if (c2) {\n const t4 = i2.getValueAndResolveTokens(\"icon-image\", g2, n2, d2);\n v2 = t4 instanceof te ? t4 : te.fromString(t4);\n }\n if (!x2 && !v2) continue;\n const b2 = this.sortFeaturesByKey ? h2.evaluate(g2, {}, n2) : void 0;\n if (this.features.push({ id: o3, text: x2, icon: v2, index: l3, sourceLayerIndex: m2, geometry: g2.geometry, properties: r3.properties, type: oc[r3.type], sortKey: b2 }), v2 && (p2[v2.name] = true), x2) {\n const e4 = a2.evaluate(g2, {}, n2).join(\",\"), r4 = \"viewport\" !== s2.get(\"text-rotation-alignment\") && \"point\" !== s2.get(\"symbol-placement\");\n this.allowVerticalPlacement = this.writingModes && this.writingModes.indexOf(t.ah.vertical) >= 0;\n for (const t4 of x2.sections) if (t4.image) p2[t4.image.name] = true;\n else {\n const n3 = Pi(x2.toString()), i3 = t4.fontStack || e4, s3 = f2[i3] = f2[i3] || {};\n this.calculateGlyphDependencies(t4.text, s3, r4, this.allowVerticalPlacement, n3);\n }\n }\n }\n \"line\" === s2.get(\"symbol-placement\") && (this.features = function(t4) {\n const e3 = {}, r3 = {}, n3 = [];\n let i3 = 0;\n function s3(e4) {\n n3.push(t4[e4]), i3++;\n }\n function a3(t5, e4, i4) {\n const s4 = r3[t5];\n return delete r3[t5], r3[e4] = s4, n3[s4].geometry[0].pop(), n3[s4].geometry[0] = n3[s4].geometry[0].concat(i4[0]), s4;\n }\n function o3(t5, r4, i4) {\n const s4 = e3[r4];\n return delete e3[r4], e3[t5] = s4, n3[s4].geometry[0].shift(), n3[s4].geometry[0] = i4[0].concat(n3[s4].geometry[0]), s4;\n }\n function l3(t5, e4, r4) {\n const n4 = r4 ? e4[0][e4[0].length - 1] : e4[0][0];\n return `${t5}:${n4.x}:${n4.y}`;\n }\n for (let u3 = 0; u3 < t4.length; u3++) {\n const c3 = t4[u3], h3 = c3.geometry, p3 = c3.text ? c3.text.toString() : null;\n if (!p3) {\n s3(u3);\n continue;\n }\n const f3 = l3(p3, h3), d3 = l3(p3, h3, true);\n if (f3 in r3 && d3 in e3 && r3[f3] !== e3[d3]) {\n const t5 = o3(f3, d3, h3), i4 = a3(f3, d3, n3[t5].geometry);\n delete e3[f3], delete r3[d3], r3[l3(p3, n3[i4].geometry, true)] = i4, n3[t5].geometry = null;\n } else f3 in r3 ? a3(f3, d3, h3) : d3 in e3 ? o3(f3, d3, h3) : (s3(u3), e3[f3] = i3 - 1, r3[d3] = i3 - 1);\n }\n return n3.filter((t5) => t5.geometry);\n }(this.features)), this.sortFeaturesByKey && this.features.sort((t4, e3) => t4.sortKey - e3.sortKey);\n }\n update(t4, e2, r2) {\n this.stateDependentLayers.length && (this.text.programConfigurations.updatePaintArrays(t4, e2, this.layers, r2), this.icon.programConfigurations.updatePaintArrays(t4, e2, this.layers, r2));\n }\n isEmpty() {\n return 0 === this.symbolInstances.length && !this.hasRTLText;\n }\n uploadPending() {\n return !this.uploaded || this.text.programConfigurations.needsUpload || this.icon.programConfigurations.needsUpload;\n }\n upload(t4) {\n !this.uploaded && this.hasDebugData() && (this.textCollisionBox.upload(t4), this.iconCollisionBox.upload(t4)), this.text.upload(t4, this.sortFeaturesByY, !this.uploaded, this.text.programConfigurations.needsUpload), this.icon.upload(t4, this.sortFeaturesByY, !this.uploaded, this.icon.programConfigurations.needsUpload), this.uploaded = true;\n }\n destroyDebugData() {\n this.textCollisionBox.destroy(), this.iconCollisionBox.destroy();\n }\n destroy() {\n this.text.destroy(), this.icon.destroy(), this.hasDebugData() && this.destroyDebugData();\n }\n addToLineVertexArray(t4, e2) {\n const r2 = this.lineVertexArray.length;\n if (void 0 !== t4.segment) {\n let r3 = t4.dist(e2[t4.segment + 1]), n2 = t4.dist(e2[t4.segment]);\n const i2 = {};\n for (let n3 = t4.segment + 1; n3 < e2.length; n3++) i2[n3] = { x: e2[n3].x, y: e2[n3].y, tileUnitDistanceFromAnchor: r3 }, n3 < e2.length - 1 && (r3 += e2[n3 + 1].dist(e2[n3]));\n for (let r4 = t4.segment || 0; r4 >= 0; r4--) i2[r4] = { x: e2[r4].x, y: e2[r4].y, tileUnitDistanceFromAnchor: n2 }, r4 > 0 && (n2 += e2[r4 - 1].dist(e2[r4]));\n for (let t5 = 0; t5 < e2.length; t5++) {\n const e3 = i2[t5];\n this.lineVertexArray.emplaceBack(e3.x, e3.y, e3.tileUnitDistanceFromAnchor);\n }\n }\n return { lineStartIndex: r2, lineLength: this.lineVertexArray.length - r2 };\n }\n addSymbols(e2, r2, n2, i2, s2, a2, o2, l2, u2, c2, h2, p2) {\n const f2 = e2.indexArray, d2 = e2.layoutVertexArray, y2 = e2.segments.prepareSegment(4 * r2.length, d2, f2, this.canOverlap ? a2.sortKey : void 0), m2 = this.glyphOffsetArray.length, g2 = y2.vertexLength, x2 = this.allowVerticalPlacement && o2 === t.ah.vertical ? Math.PI / 2 : 0, v2 = a2.text && a2.text.sections;\n for (let t4 = 0; t4 < r2.length; t4++) {\n const { tl: i3, tr: s3, bl: o3, br: u3, tex: c3, pixelOffsetTL: h3, pixelOffsetBR: m3, minFontScaleX: g3, minFontScaleY: b2, glyphOffset: w2, isSDF: _2, sectionIndex: A3 } = r2[t4], S2 = y2.vertexLength, k2 = w2[1];\n uc(d2, l2.x, l2.y, i3.x, k2 + i3.y, c3.x, c3.y, n2, _2, h3.x, h3.y, g3, b2), uc(d2, l2.x, l2.y, s3.x, k2 + s3.y, c3.x + c3.w, c3.y, n2, _2, m3.x, h3.y, g3, b2), uc(d2, l2.x, l2.y, o3.x, k2 + o3.y, c3.x, c3.y + c3.h, n2, _2, h3.x, m3.y, g3, b2), uc(d2, l2.x, l2.y, u3.x, k2 + u3.y, c3.x + c3.w, c3.y + c3.h, n2, _2, m3.x, m3.y, g3, b2), cc(e2.dynamicLayoutVertexArray, l2, x2), f2.emplaceBack(S2, S2 + 1, S2 + 2), f2.emplaceBack(S2 + 1, S2 + 2, S2 + 3), y2.vertexLength += 4, y2.primitiveLength += 2, this.glyphOffsetArray.emplaceBack(w2[0]), t4 !== r2.length - 1 && A3 === r2[t4 + 1].sectionIndex || e2.programConfigurations.populatePaintArrays(d2.length, a2, a2.index, {}, p2, v2 && v2[A3]);\n }\n e2.placedSymbolArray.emplaceBack(l2.x, l2.y, m2, this.glyphOffsetArray.length - m2, g2, u2, c2, l2.segment, n2 ? n2[0] : 0, n2 ? n2[1] : 0, i2[0], i2[1], o2, 0, false, 0, h2);\n }\n _addCollisionDebugVertex(t4, e2, r2, n2, i2, s2) {\n return e2.emplaceBack(0, 0), t4.emplaceBack(r2.x, r2.y, n2, i2, Math.round(s2.x), Math.round(s2.y));\n }\n addCollisionDebugVertices(t4, e2, r2, n2, i2, a2, o2) {\n const l2 = i2.segments.prepareSegment(4, i2.layoutVertexArray, i2.indexArray), u2 = l2.vertexLength, c2 = i2.layoutVertexArray, h2 = i2.collisionVertexArray, p2 = o2.anchorX, f2 = o2.anchorY;\n this._addCollisionDebugVertex(c2, h2, a2, p2, f2, new s(t4, e2)), this._addCollisionDebugVertex(c2, h2, a2, p2, f2, new s(r2, e2)), this._addCollisionDebugVertex(c2, h2, a2, p2, f2, new s(r2, n2)), this._addCollisionDebugVertex(c2, h2, a2, p2, f2, new s(t4, n2)), l2.vertexLength += 4;\n const d2 = i2.indexArray;\n d2.emplaceBack(u2, u2 + 1), d2.emplaceBack(u2 + 1, u2 + 2), d2.emplaceBack(u2 + 2, u2 + 3), d2.emplaceBack(u2 + 3, u2), l2.primitiveLength += 4;\n }\n addDebugCollisionBoxes(t4, e2, r2, n2) {\n for (let i2 = t4; i2 < e2; i2++) {\n const t5 = this.collisionBoxArray.get(i2);\n this.addCollisionDebugVertices(t5.x1, t5.y1, t5.x2, t5.y2, n2 ? this.textCollisionBox : this.iconCollisionBox, t5.anchorPoint, r2);\n }\n }\n generateCollisionDebugBuffers() {\n this.hasDebugData() && this.destroyDebugData(), this.textCollisionBox = new fc(ea, tu.members, ia), this.iconCollisionBox = new fc(ea, tu.members, ia);\n for (let t4 = 0; t4 < this.symbolInstances.length; t4++) {\n const e2 = this.symbolInstances.get(t4);\n this.addDebugCollisionBoxes(e2.textBoxStartIndex, e2.textBoxEndIndex, e2, true), this.addDebugCollisionBoxes(e2.verticalTextBoxStartIndex, e2.verticalTextBoxEndIndex, e2, true), this.addDebugCollisionBoxes(e2.iconBoxStartIndex, e2.iconBoxEndIndex, e2, false), this.addDebugCollisionBoxes(e2.verticalIconBoxStartIndex, e2.verticalIconBoxEndIndex, e2, false);\n }\n }\n _deserializeCollisionBoxesForSymbol(t4, e2, r2, n2, i2, s2, a2, o2, l2) {\n const u2 = {};\n for (let n3 = e2; n3 < r2; n3++) {\n const e3 = t4.get(n3);\n u2.textBox = { x1: e3.x1, y1: e3.y1, x2: e3.x2, y2: e3.y2, anchorPointX: e3.anchorPointX, anchorPointY: e3.anchorPointY }, u2.textFeatureIndex = e3.featureIndex;\n break;\n }\n for (let e3 = n2; e3 < i2; e3++) {\n const r3 = t4.get(e3);\n u2.verticalTextBox = { x1: r3.x1, y1: r3.y1, x2: r3.x2, y2: r3.y2, anchorPointX: r3.anchorPointX, anchorPointY: r3.anchorPointY }, u2.verticalTextFeatureIndex = r3.featureIndex;\n break;\n }\n for (let e3 = s2; e3 < a2; e3++) {\n const r3 = t4.get(e3);\n u2.iconBox = { x1: r3.x1, y1: r3.y1, x2: r3.x2, y2: r3.y2, anchorPointX: r3.anchorPointX, anchorPointY: r3.anchorPointY }, u2.iconFeatureIndex = r3.featureIndex;\n break;\n }\n for (let e3 = o2; e3 < l2; e3++) {\n const r3 = t4.get(e3);\n u2.verticalIconBox = { x1: r3.x1, y1: r3.y1, x2: r3.x2, y2: r3.y2, anchorPointX: r3.anchorPointX, anchorPointY: r3.anchorPointY }, u2.verticalIconFeatureIndex = r3.featureIndex;\n break;\n }\n return u2;\n }\n deserializeCollisionBoxes(t4) {\n this.collisionArrays = [];\n for (let e2 = 0; e2 < this.symbolInstances.length; e2++) {\n const r2 = this.symbolInstances.get(e2);\n this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t4, r2.textBoxStartIndex, r2.textBoxEndIndex, r2.verticalTextBoxStartIndex, r2.verticalTextBoxEndIndex, r2.iconBoxStartIndex, r2.iconBoxEndIndex, r2.verticalIconBoxStartIndex, r2.verticalIconBoxEndIndex));\n }\n }\n hasTextData() {\n return this.text.segments.get().length > 0;\n }\n hasIconData() {\n return this.icon.segments.get().length > 0;\n }\n hasDebugData() {\n return this.textCollisionBox && this.iconCollisionBox;\n }\n hasTextCollisionBoxData() {\n return this.hasDebugData() && this.textCollisionBox.segments.get().length > 0;\n }\n hasIconCollisionBoxData() {\n return this.hasDebugData() && this.iconCollisionBox.segments.get().length > 0;\n }\n addIndicesForPlacedSymbol(t4, e2) {\n const r2 = t4.placedSymbolArray.get(e2), n2 = r2.vertexStartIndex + 4 * r2.numGlyphs;\n for (let e3 = r2.vertexStartIndex; e3 < n2; e3 += 4) t4.indexArray.emplaceBack(e3, e3 + 1, e3 + 2), t4.indexArray.emplaceBack(e3 + 1, e3 + 2, e3 + 3);\n }\n getSortedSymbolIndexes(t4) {\n if (this.sortedAngle === t4 && void 0 !== this.symbolInstanceIndexes) return this.symbolInstanceIndexes;\n const e2 = Math.sin(t4), r2 = Math.cos(t4), n2 = [], i2 = [], s2 = [];\n for (let t5 = 0; t5 < this.symbolInstances.length; ++t5) {\n s2.push(t5);\n const a2 = this.symbolInstances.get(t5);\n n2.push(0 | Math.round(e2 * a2.anchorX + r2 * a2.anchorY)), i2.push(a2.featureIndex);\n }\n return s2.sort((t5, e3) => n2[t5] - n2[e3] || i2[e3] - i2[t5]), s2;\n }\n addToSortKeyRanges(t4, e2) {\n const r2 = this.sortKeyRanges[this.sortKeyRanges.length - 1];\n r2 && r2.sortKey === e2 ? r2.symbolInstanceEnd = t4 + 1 : this.sortKeyRanges.push({ sortKey: e2, symbolInstanceStart: t4, symbolInstanceEnd: t4 + 1 });\n }\n sortFeatures(t4) {\n if (this.sortFeaturesByY && this.sortedAngle !== t4 && !(this.text.segments.get().length > 1 || this.icon.segments.get().length > 1)) {\n this.symbolInstanceIndexes = this.getSortedSymbolIndexes(t4), this.sortedAngle = t4, this.text.indexArray.clear(), this.icon.indexArray.clear(), this.featureSortOrder = [];\n for (const t5 of this.symbolInstanceIndexes) {\n const e2 = this.symbolInstances.get(t5);\n this.featureSortOrder.push(e2.featureIndex), [e2.rightJustifiedTextSymbolIndex, e2.centerJustifiedTextSymbolIndex, e2.leftJustifiedTextSymbolIndex].forEach((t6, e3, r2) => {\n t6 >= 0 && r2.indexOf(t6) === e3 && this.addIndicesForPlacedSymbol(this.text, t6);\n }), e2.verticalPlacedTextSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.text, e2.verticalPlacedTextSymbolIndex), e2.placedIconSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.icon, e2.placedIconSymbolIndex), e2.verticalPlacedIconSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.icon, e2.verticalPlacedIconSymbolIndex);\n }\n this.text.indexBuffer && this.text.indexBuffer.updateData(this.text.indexArray), this.icon.indexBuffer && this.icon.indexBuffer.updateData(this.icon.indexArray);\n }\n }\n }\n let yc, mc;\n wi(\"SymbolBucket\", dc, { omit: [\"layers\", \"collisionBoxArray\", \"features\", \"compareText\"] }), dc.MAX_GLYPHS = 65535, dc.addDynamicAttributes = cc;\n var gc = { get paint() {\n return mc = mc || new rs({ \"icon-opacity\": new Wi(G.paint_symbol[\"icon-opacity\"]), \"icon-color\": new Wi(G.paint_symbol[\"icon-color\"]), \"icon-halo-color\": new Wi(G.paint_symbol[\"icon-halo-color\"]), \"icon-halo-width\": new Wi(G.paint_symbol[\"icon-halo-width\"]), \"icon-halo-blur\": new Wi(G.paint_symbol[\"icon-halo-blur\"]), \"icon-translate\": new Ji(G.paint_symbol[\"icon-translate\"]), \"icon-translate-anchor\": new Ji(G.paint_symbol[\"icon-translate-anchor\"]), \"text-opacity\": new Wi(G.paint_symbol[\"text-opacity\"]), \"text-color\": new Wi(G.paint_symbol[\"text-color\"], { runtimeType: pt, getOverride: (t4) => t4.textColor, hasOverride: (t4) => !!t4.textColor }), \"text-halo-color\": new Wi(G.paint_symbol[\"text-halo-color\"]), \"text-halo-width\": new Wi(G.paint_symbol[\"text-halo-width\"]), \"text-halo-blur\": new Wi(G.paint_symbol[\"text-halo-blur\"]), \"text-translate\": new Ji(G.paint_symbol[\"text-translate\"]), \"text-translate-anchor\": new Ji(G.paint_symbol[\"text-translate-anchor\"]) });\n }, get layout() {\n return yc = yc || new rs({ \"symbol-placement\": new Ji(G.layout_symbol[\"symbol-placement\"]), \"symbol-spacing\": new Ji(G.layout_symbol[\"symbol-spacing\"]), \"symbol-avoid-edges\": new Ji(G.layout_symbol[\"symbol-avoid-edges\"]), \"symbol-sort-key\": new Wi(G.layout_symbol[\"symbol-sort-key\"]), \"symbol-z-order\": new Ji(G.layout_symbol[\"symbol-z-order\"]), \"icon-allow-overlap\": new Ji(G.layout_symbol[\"icon-allow-overlap\"]), \"icon-overlap\": new Ji(G.layout_symbol[\"icon-overlap\"]), \"icon-ignore-placement\": new Ji(G.layout_symbol[\"icon-ignore-placement\"]), \"icon-optional\": new Ji(G.layout_symbol[\"icon-optional\"]), \"icon-rotation-alignment\": new Ji(G.layout_symbol[\"icon-rotation-alignment\"]), \"icon-size\": new Wi(G.layout_symbol[\"icon-size\"]), \"icon-text-fit\": new Ji(G.layout_symbol[\"icon-text-fit\"]), \"icon-text-fit-padding\": new Ji(G.layout_symbol[\"icon-text-fit-padding\"]), \"icon-image\": new Wi(G.layout_symbol[\"icon-image\"]), \"icon-rotate\": new Wi(G.layout_symbol[\"icon-rotate\"]), \"icon-padding\": new Wi(G.layout_symbol[\"icon-padding\"]), \"icon-keep-upright\": new Ji(G.layout_symbol[\"icon-keep-upright\"]), \"icon-offset\": new Wi(G.layout_symbol[\"icon-offset\"]), \"icon-anchor\": new Wi(G.layout_symbol[\"icon-anchor\"]), \"icon-pitch-alignment\": new Ji(G.layout_symbol[\"icon-pitch-alignment\"]), \"text-pitch-alignment\": new Ji(G.layout_symbol[\"text-pitch-alignment\"]), \"text-rotation-alignment\": new Ji(G.layout_symbol[\"text-rotation-alignment\"]), \"text-field\": new Wi(G.layout_symbol[\"text-field\"]), \"text-font\": new Wi(G.layout_symbol[\"text-font\"]), \"text-size\": new Wi(G.layout_symbol[\"text-size\"]), \"text-max-width\": new Wi(G.layout_symbol[\"text-max-width\"]), \"text-line-height\": new Ji(G.layout_symbol[\"text-line-height\"]), \"text-letter-spacing\": new Wi(G.layout_symbol[\"text-letter-spacing\"]), \"text-justify\": new Wi(G.layout_symbol[\"text-justify\"]), \"text-radial-offset\": new Wi(G.layout_symbol[\"text-radial-offset\"]), \"text-variable-anchor\": new Ji(G.layout_symbol[\"text-variable-anchor\"]), \"text-variable-anchor-offset\": new Wi(G.layout_symbol[\"text-variable-anchor-offset\"]), \"text-anchor\": new Wi(G.layout_symbol[\"text-anchor\"]), \"text-max-angle\": new Ji(G.layout_symbol[\"text-max-angle\"]), \"text-writing-mode\": new Ji(G.layout_symbol[\"text-writing-mode\"]), \"text-rotate\": new Wi(G.layout_symbol[\"text-rotate\"]), \"text-padding\": new Ji(G.layout_symbol[\"text-padding\"]), \"text-keep-upright\": new Ji(G.layout_symbol[\"text-keep-upright\"]), \"text-transform\": new Wi(G.layout_symbol[\"text-transform\"]), \"text-offset\": new Wi(G.layout_symbol[\"text-offset\"]), \"text-allow-overlap\": new Ji(G.layout_symbol[\"text-allow-overlap\"]), \"text-overlap\": new Ji(G.layout_symbol[\"text-overlap\"]), \"text-ignore-placement\": new Ji(G.layout_symbol[\"text-ignore-placement\"]), \"text-optional\": new Ji(G.layout_symbol[\"text-optional\"]) });\n } };\n class xc {\n constructor(t4) {\n if (void 0 === t4.property.overrides) throw new Error(\"overrides must be provided to instantiate FormatSectionOverride class\");\n this.type = t4.property.overrides ? t4.property.overrides.runtimeType : lt, this.defaultValue = t4;\n }\n evaluate(t4) {\n if (t4.formattedSection) {\n const e2 = this.defaultValue.property.overrides;\n if (e2 && e2.hasOverride(t4.formattedSection)) return e2.getOverride(t4.formattedSection);\n }\n return t4.feature && t4.featureState ? this.defaultValue.evaluate(t4.feature, t4.featureState) : this.defaultValue.property.specification.default;\n }\n eachChild(t4) {\n this.defaultValue.isConstant() || t4(this.defaultValue.value._styleExpression.expression);\n }\n outputDefined() {\n return false;\n }\n serialize() {\n return null;\n }\n }\n wi(\"FormatSectionOverride\", xc, { omit: [\"defaultValue\"] });\n class vc extends is {\n constructor(t4) {\n super(t4, gc);\n }\n recalculate(t4, e2) {\n if (super.recalculate(t4, e2), \"auto\" === this.layout.get(\"icon-rotation-alignment\") && (this.layout._values[\"icon-rotation-alignment\"] = \"point\" !== this.layout.get(\"symbol-placement\") ? \"map\" : \"viewport\"), \"auto\" === this.layout.get(\"text-rotation-alignment\") && (this.layout._values[\"text-rotation-alignment\"] = \"point\" !== this.layout.get(\"symbol-placement\") ? \"map\" : \"viewport\"), \"auto\" === this.layout.get(\"text-pitch-alignment\") && (this.layout._values[\"text-pitch-alignment\"] = \"map\" === this.layout.get(\"text-rotation-alignment\") ? \"map\" : \"viewport\"), \"auto\" === this.layout.get(\"icon-pitch-alignment\") && (this.layout._values[\"icon-pitch-alignment\"] = this.layout.get(\"icon-rotation-alignment\")), \"point\" === this.layout.get(\"symbol-placement\")) {\n const t5 = this.layout.get(\"text-writing-mode\");\n if (t5) {\n const e3 = [];\n for (const r2 of t5) e3.indexOf(r2) < 0 && e3.push(r2);\n this.layout._values[\"text-writing-mode\"] = e3;\n } else this.layout._values[\"text-writing-mode\"] = [\"horizontal\"];\n }\n this._setPaintOverrides();\n }\n getValueAndResolveTokens(t4, e2, r2, n2) {\n const i2 = this.layout.get(t4).evaluate(e2, {}, r2, n2), s2 = this._unevaluatedLayout._values[t4];\n return s2.isDataDriven() || vn(s2.value) || !i2 ? i2 : function(t5, e3) {\n return e3.replace(/{([^{}]+)}/g, (e4, r3) => t5 && r3 in t5 ? String(t5[r3]) : \"\");\n }(e2.properties, i2);\n }\n createBucket(t4) {\n return new dc(t4);\n }\n queryRadius() {\n return 0;\n }\n queryIntersectsFeature() {\n throw new Error(\"Should take a different path in FeatureIndex\");\n }\n _setPaintOverrides() {\n for (const t4 of gc.paint.overridableProperties) {\n if (!vc.hasPaintOverride(this.layout, t4)) continue;\n const e2 = this.paint.get(t4), r2 = new xc(e2), n2 = new xn(r2, e2.property.specification);\n let i2 = null;\n i2 = \"constant\" === e2.value.kind || \"source\" === e2.value.kind ? new wn(\"source\", n2) : new _n(\"composite\", n2, e2.value.zoomStops), this.paint._values[t4] = new Hi(e2.property, i2, e2.parameters);\n }\n }\n _handleOverridablePaintPropertyUpdate(t4, e2, r2) {\n return !(!this.layout || e2.isDataDriven() || r2.isDataDriven()) && vc.hasPaintOverride(this.layout, t4);\n }\n static hasPaintOverride(t4, e2) {\n const r2 = t4.get(\"text-field\"), n2 = gc.paint.properties[e2];\n let i2 = false;\n const s2 = (t5) => {\n for (const e3 of t5) if (n2.overrides && n2.overrides.hasOverride(e3)) return void (i2 = true);\n };\n if (\"constant\" === r2.value.kind && r2.value.value instanceof Yt) s2(r2.value.value.sections);\n else if (\"source\" === r2.value.kind) {\n const t5 = (e4) => {\n i2 || (e4 instanceof se && ne(e4.value) === mt ? s2(e4.value.sections) : e4 instanceof Ze ? s2(e4.sections) : e4.eachChild(t5));\n }, e3 = r2.value;\n e3._styleExpression && t5(e3._styleExpression.expression);\n }\n return i2;\n }\n }\n let bc;\n var wc = { get paint() {\n return bc = bc || new rs({ \"background-color\": new Ji(G.paint_background[\"background-color\"]), \"background-pattern\": new ts(G.paint_background[\"background-pattern\"]), \"background-opacity\": new Ji(G.paint_background[\"background-opacity\"]) });\n } };\n class _c extends is {\n constructor(t4) {\n super(t4, wc);\n }\n }\n let Ac;\n var Sc = { get paint() {\n return Ac = Ac || new rs({ \"raster-opacity\": new Ji(G.paint_raster[\"raster-opacity\"]), \"raster-hue-rotate\": new Ji(G.paint_raster[\"raster-hue-rotate\"]), \"raster-brightness-min\": new Ji(G.paint_raster[\"raster-brightness-min\"]), \"raster-brightness-max\": new Ji(G.paint_raster[\"raster-brightness-max\"]), \"raster-saturation\": new Ji(G.paint_raster[\"raster-saturation\"]), \"raster-contrast\": new Ji(G.paint_raster[\"raster-contrast\"]), \"raster-resampling\": new Ji(G.paint_raster[\"raster-resampling\"]), \"raster-fade-duration\": new Ji(G.paint_raster[\"raster-fade-duration\"]) });\n } };\n class kc extends is {\n constructor(t4) {\n super(t4, Sc);\n }\n }\n class Mc extends is {\n constructor(t4) {\n super(t4, {}), this.onAdd = (t5) => {\n this.implementation.onAdd && this.implementation.onAdd(t5, t5.painter.context.gl);\n }, this.onRemove = (t5) => {\n this.implementation.onRemove && this.implementation.onRemove(t5, t5.painter.context.gl);\n }, this.implementation = t4;\n }\n is3D() {\n return \"3d\" === this.implementation.renderingMode;\n }\n hasOffscreenPass() {\n return void 0 !== this.implementation.prerender;\n }\n recalculate() {\n }\n updateTransitions() {\n }\n hasTransition() {\n return false;\n }\n serialize() {\n throw new Error(\"Custom layers cannot be serialized\");\n }\n }\n class Ic {\n constructor(t4) {\n this._methodToThrottle = t4, this._triggered = false, \"undefined\" != typeof MessageChannel && (this._channel = new MessageChannel(), this._channel.port2.onmessage = () => {\n this._triggered = false, this._methodToThrottle();\n });\n }\n trigger() {\n this._triggered || (this._triggered = true, this._channel ? this._channel.port1.postMessage(true) : setTimeout(() => {\n this._triggered = false, this._methodToThrottle();\n }, 0));\n }\n remove() {\n delete this._channel, this._methodToThrottle = () => {\n };\n }\n }\n const zc = 63710088e-1;\n class Pc {\n constructor(t4, e2) {\n if (isNaN(t4) || isNaN(e2)) throw new Error(`Invalid LngLat object: (${t4}, ${e2})`);\n if (this.lng = +t4, this.lat = +e2, this.lat > 90 || this.lat < -90) throw new Error(\"Invalid LngLat latitude value: must be between -90 and 90\");\n }\n wrap() {\n return new Pc(m(this.lng, -180, 180), this.lat);\n }\n toArray() {\n return [this.lng, this.lat];\n }\n toString() {\n return `LngLat(${this.lng}, ${this.lat})`;\n }\n distanceTo(t4) {\n const e2 = Math.PI / 180, r2 = this.lat * e2, n2 = t4.lat * e2, i2 = Math.sin(r2) * Math.sin(n2) + Math.cos(r2) * Math.cos(n2) * Math.cos((t4.lng - this.lng) * e2);\n return zc * Math.acos(Math.min(i2, 1));\n }\n static convert(t4) {\n if (t4 instanceof Pc) return t4;\n if (Array.isArray(t4) && (2 === t4.length || 3 === t4.length)) return new Pc(Number(t4[0]), Number(t4[1]));\n if (!Array.isArray(t4) && \"object\" == typeof t4 && null !== t4) return new Pc(Number(\"lng\" in t4 ? t4.lng : t4.lon), Number(t4.lat));\n throw new Error(\"`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]\");\n }\n }\n const Cc = 2 * Math.PI * zc;\n function Bc(t4) {\n return Cc * Math.cos(t4 * Math.PI / 180);\n }\n function Vc(t4) {\n return (180 + t4) / 360;\n }\n function Ec(t4) {\n return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + t4 * Math.PI / 360))) / 360;\n }\n function Fc(t4, e2) {\n return t4 / Bc(e2);\n }\n function Tc(t4) {\n return 360 / Math.PI * Math.atan(Math.exp((180 - 360 * t4) * Math.PI / 180)) - 90;\n }\n class $c {\n constructor(t4, e2, r2 = 0) {\n this.x = +t4, this.y = +e2, this.z = +r2;\n }\n static fromLngLat(t4, e2 = 0) {\n const r2 = Pc.convert(t4);\n return new $c(Vc(r2.lng), Ec(r2.lat), Fc(e2, r2.lat));\n }\n toLngLat() {\n return new Pc(360 * this.x - 180, Tc(this.y));\n }\n toAltitude() {\n return this.z * Bc(Tc(this.y));\n }\n meterInMercatorCoordinateUnits() {\n return 1 / Cc * (t4 = Tc(this.y), 1 / Math.cos(t4 * Math.PI / 180));\n var t4;\n }\n }\n function Lc(t4, e2, r2) {\n var n2 = 2 * Math.PI * 6378137 / 256 / Math.pow(2, r2);\n return [t4 * n2 - 2 * Math.PI * 6378137 / 2, e2 * n2 - 2 * Math.PI * 6378137 / 2];\n }\n class Dc {\n constructor(t4, e2, r2) {\n if (!function(t5, e3, r3) {\n return !(t5 < 0 || t5 > 25 || r3 < 0 || r3 >= Math.pow(2, t5) || e3 < 0 || e3 >= Math.pow(2, t5));\n }(t4, e2, r2)) throw new Error(`x=${e2}, y=${r2}, z=${t4} outside of bounds. 0<=x<${Math.pow(2, t4)}, 0<=y<${Math.pow(2, t4)} 0<=z<=25 `);\n this.z = t4, this.x = e2, this.y = r2, this.key = Rc(0, t4, t4, e2, r2);\n }\n equals(t4) {\n return this.z === t4.z && this.x === t4.x && this.y === t4.y;\n }\n url(t4, e2, r2) {\n const n2 = (s2 = this.y, a2 = this.z, o2 = Lc(256 * (i2 = this.x), 256 * (s2 = Math.pow(2, a2) - s2 - 1), a2), l2 = Lc(256 * (i2 + 1), 256 * (s2 + 1), a2), o2[0] + \",\" + o2[1] + \",\" + l2[0] + \",\" + l2[1]);\n var i2, s2, a2, o2, l2;\n const u2 = function(t5, e3, r3) {\n let n3, i3 = \"\";\n for (let s3 = t5; s3 > 0; s3--) n3 = 1 << s3 - 1, i3 += (e3 & n3 ? 1 : 0) + (r3 & n3 ? 2 : 0);\n return i3;\n }(this.z, this.x, this.y);\n return t4[(this.x + this.y) % t4.length].replace(/{prefix}/g, (this.x % 16).toString(16) + (this.y % 16).toString(16)).replace(/{z}/g, String(this.z)).replace(/{x}/g, String(this.x)).replace(/{y}/g, String(\"tms\" === r2 ? Math.pow(2, this.z) - this.y - 1 : this.y)).replace(/{ratio}/g, e2 > 1 ? \"@2x\" : \"\").replace(/{quadkey}/g, u2).replace(/{bbox-epsg-3857}/g, n2);\n }\n isChildOf(t4) {\n const e2 = this.z - t4.z;\n return e2 > 0 && t4.x === this.x >> e2 && t4.y === this.y >> e2;\n }\n getTilePoint(t4) {\n const e2 = Math.pow(2, this.z);\n return new s((t4.x * e2 - this.x) * $a, (t4.y * e2 - this.y) * $a);\n }\n toString() {\n return `${this.z}/${this.x}/${this.y}`;\n }\n }\n class Oc {\n constructor(t4, e2) {\n this.wrap = t4, this.canonical = e2, this.key = Rc(t4, e2.z, e2.z, e2.x, e2.y);\n }\n }\n class jc {\n constructor(t4, e2, r2, n2, i2) {\n if (t4 < r2) throw new Error(`overscaledZ should be >= z; overscaledZ = ${t4}; z = ${r2}`);\n this.overscaledZ = t4, this.wrap = e2, this.canonical = new Dc(r2, +n2, +i2), this.key = Rc(e2, t4, r2, n2, i2);\n }\n clone() {\n return new jc(this.overscaledZ, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y);\n }\n equals(t4) {\n return this.overscaledZ === t4.overscaledZ && this.wrap === t4.wrap && this.canonical.equals(t4.canonical);\n }\n scaledTo(t4) {\n if (t4 > this.overscaledZ) throw new Error(`targetZ > this.overscaledZ; targetZ = ${t4}; overscaledZ = ${this.overscaledZ}`);\n const e2 = this.canonical.z - t4;\n return t4 > this.canonical.z ? new jc(t4, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y) : new jc(t4, this.wrap, t4, this.canonical.x >> e2, this.canonical.y >> e2);\n }\n calculateScaledKey(t4, e2) {\n if (t4 > this.overscaledZ) throw new Error(`targetZ > this.overscaledZ; targetZ = ${t4}; overscaledZ = ${this.overscaledZ}`);\n const r2 = this.canonical.z - t4;\n return t4 > this.canonical.z ? Rc(this.wrap * +e2, t4, this.canonical.z, this.canonical.x, this.canonical.y) : Rc(this.wrap * +e2, t4, t4, this.canonical.x >> r2, this.canonical.y >> r2);\n }\n isChildOf(t4) {\n if (t4.wrap !== this.wrap) return false;\n const e2 = this.canonical.z - t4.canonical.z;\n return 0 === t4.overscaledZ || t4.overscaledZ < this.overscaledZ && t4.canonical.x === this.canonical.x >> e2 && t4.canonical.y === this.canonical.y >> e2;\n }\n children(t4) {\n if (this.overscaledZ >= t4) return [new jc(this.overscaledZ + 1, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y)];\n const e2 = this.canonical.z + 1, r2 = 2 * this.canonical.x, n2 = 2 * this.canonical.y;\n return [new jc(e2, this.wrap, e2, r2, n2), new jc(e2, this.wrap, e2, r2 + 1, n2), new jc(e2, this.wrap, e2, r2, n2 + 1), new jc(e2, this.wrap, e2, r2 + 1, n2 + 1)];\n }\n isLessThan(t4) {\n return this.wrap < t4.wrap || !(this.wrap > t4.wrap) && (this.overscaledZ < t4.overscaledZ || !(this.overscaledZ > t4.overscaledZ) && (this.canonical.x < t4.canonical.x || !(this.canonical.x > t4.canonical.x) && this.canonical.y < t4.canonical.y));\n }\n wrapped() {\n return new jc(this.overscaledZ, 0, this.canonical.z, this.canonical.x, this.canonical.y);\n }\n unwrapTo(t4) {\n return new jc(this.overscaledZ, t4, this.canonical.z, this.canonical.x, this.canonical.y);\n }\n overscaleFactor() {\n return Math.pow(2, this.overscaledZ - this.canonical.z);\n }\n toUnwrapped() {\n return new Oc(this.wrap, this.canonical);\n }\n toString() {\n return `${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`;\n }\n getTilePoint(t4) {\n return this.canonical.getTilePoint(new $c(t4.x - this.wrap, t4.y));\n }\n }\n function Rc(t4, e2, r2, n2, i2) {\n (t4 *= 2) < 0 && (t4 = -1 * t4 - 1);\n const s2 = 1 << r2;\n return (s2 * s2 * t4 + s2 * i2 + n2).toString(36) + r2.toString(36) + e2.toString(36);\n }\n wi(\"CanonicalTileID\", Dc), wi(\"OverscaledTileID\", jc, { omit: [\"posMatrix\"] });\n class Uc {\n constructor(t4, e2, r2, n2 = 1, i2 = 1, s2 = 1, a2 = 0) {\n if (this.uid = t4, e2.height !== e2.width) throw new RangeError(\"DEM tiles must be square\");\n if (r2 && ![\"mapbox\", \"terrarium\", \"custom\"].includes(r2)) return void A2(`\"${r2}\" is not a valid encoding type. Valid types include \"mapbox\", \"terrarium\" and \"custom\".`);\n this.stride = e2.height;\n const o2 = this.dim = e2.height - 2;\n switch (this.data = new Uint32Array(e2.data.buffer), r2) {\n case \"terrarium\":\n this.redFactor = 256, this.greenFactor = 1, this.blueFactor = 1 / 256, this.baseShift = 32768;\n break;\n case \"custom\":\n this.redFactor = n2, this.greenFactor = i2, this.blueFactor = s2, this.baseShift = a2;\n break;\n default:\n this.redFactor = 6553.6, this.greenFactor = 25.6, this.blueFactor = 0.1, this.baseShift = 1e4;\n }\n for (let t5 = 0; t5 < o2; t5++) this.data[this._idx(-1, t5)] = this.data[this._idx(0, t5)], this.data[this._idx(o2, t5)] = this.data[this._idx(o2 - 1, t5)], this.data[this._idx(t5, -1)] = this.data[this._idx(t5, 0)], this.data[this._idx(t5, o2)] = this.data[this._idx(t5, o2 - 1)];\n this.data[this._idx(-1, -1)] = this.data[this._idx(0, 0)], this.data[this._idx(o2, -1)] = this.data[this._idx(o2 - 1, 0)], this.data[this._idx(-1, o2)] = this.data[this._idx(0, o2 - 1)], this.data[this._idx(o2, o2)] = this.data[this._idx(o2 - 1, o2 - 1)], this.min = Number.MAX_SAFE_INTEGER, this.max = Number.MIN_SAFE_INTEGER;\n for (let t5 = 0; t5 < o2; t5++) for (let e3 = 0; e3 < o2; e3++) {\n const r3 = this.get(t5, e3);\n r3 > this.max && (this.max = r3), r3 < this.min && (this.min = r3);\n }\n }\n get(t4, e2) {\n const r2 = new Uint8Array(this.data.buffer), n2 = 4 * this._idx(t4, e2);\n return this.unpack(r2[n2], r2[n2 + 1], r2[n2 + 2]);\n }\n getUnpackVector() {\n return [this.redFactor, this.greenFactor, this.blueFactor, this.baseShift];\n }\n _idx(t4, e2) {\n if (t4 < -1 || t4 >= this.dim + 1 || e2 < -1 || e2 >= this.dim + 1) throw new RangeError(\"out of range source coordinates for DEM data\");\n return (e2 + 1) * this.stride + (t4 + 1);\n }\n unpack(t4, e2, r2) {\n return t4 * this.redFactor + e2 * this.greenFactor + r2 * this.blueFactor - this.baseShift;\n }\n getPixels() {\n return new Ao({ width: this.stride, height: this.stride }, new Uint8Array(this.data.buffer));\n }\n backfillBorder(t4, e2, r2) {\n if (this.dim !== t4.dim) throw new Error(\"dem dimension mismatch\");\n let n2 = e2 * this.dim, i2 = e2 * this.dim + this.dim, s2 = r2 * this.dim, a2 = r2 * this.dim + this.dim;\n switch (e2) {\n case -1:\n n2 = i2 - 1;\n break;\n case 1:\n i2 = n2 + 1;\n }\n switch (r2) {\n case -1:\n s2 = a2 - 1;\n break;\n case 1:\n a2 = s2 + 1;\n }\n const o2 = -e2 * this.dim, l2 = -r2 * this.dim;\n for (let e3 = s2; e3 < a2; e3++) for (let r3 = n2; r3 < i2; r3++) this.data[this._idx(r3, e3)] = t4.data[this._idx(r3 + o2, e3 + l2)];\n }\n }\n wi(\"DEMData\", Uc);\n class qc {\n constructor(t4) {\n this._stringToNumber = {}, this._numberToString = [];\n for (let e2 = 0; e2 < t4.length; e2++) {\n const r2 = t4[e2];\n this._stringToNumber[r2] = e2, this._numberToString[e2] = r2;\n }\n }\n encode(t4) {\n return this._stringToNumber[t4];\n }\n decode(t4) {\n if (t4 >= this._numberToString.length) throw new Error(`Out of bounds. Index requested n=${t4} can't be >= this._numberToString.length ${this._numberToString.length}`);\n return this._numberToString[t4];\n }\n }\n class Nc {\n constructor(t4, e2, r2, n2, i2) {\n this.type = \"Feature\", this._vectorTileFeature = t4, t4._z = e2, t4._x = r2, t4._y = n2, this.properties = t4.properties, this.id = i2;\n }\n get geometry() {\n return void 0 === this._geometry && (this._geometry = this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x, this._vectorTileFeature._y, this._vectorTileFeature._z).geometry), this._geometry;\n }\n set geometry(t4) {\n this._geometry = t4;\n }\n toJSON() {\n const t4 = { geometry: this.geometry };\n for (const e2 in this) \"_geometry\" !== e2 && \"_vectorTileFeature\" !== e2 && (t4[e2] = this[e2]);\n return t4;\n }\n }\n class Zc {\n constructor(t4, e2) {\n this.tileID = t4, this.x = t4.canonical.x, this.y = t4.canonical.y, this.z = t4.canonical.z, this.grid = new vi($a, 16, 0), this.grid3D = new vi($a, 16, 0), this.featureIndexArray = new Ns(), this.promoteId = e2;\n }\n insert(t4, e2, r2, n2, i2, s2) {\n const a2 = this.featureIndexArray.length;\n this.featureIndexArray.emplaceBack(r2, n2, i2);\n const o2 = s2 ? this.grid3D : this.grid;\n for (let t5 = 0; t5 < e2.length; t5++) {\n const r3 = e2[t5], n3 = [1 / 0, 1 / 0, -1 / 0, -1 / 0];\n for (let t6 = 0; t6 < r3.length; t6++) {\n const e3 = r3[t6];\n n3[0] = Math.min(n3[0], e3.x), n3[1] = Math.min(n3[1], e3.y), n3[2] = Math.max(n3[2], e3.x), n3[3] = Math.max(n3[3], e3.y);\n }\n n3[0] < $a && n3[1] < $a && n3[2] >= 0 && n3[3] >= 0 && o2.insert(a2, n3[0], n3[1], n3[2], n3[3]);\n }\n }\n loadVTLayers() {\n return this.vtLayers || (this.vtLayers = new fl.VectorTile(new Iu(this.rawTileData)).layers, this.sourceLayerCoder = new qc(this.vtLayers ? Object.keys(this.vtLayers).sort() : [\"_geojsonTileLayer\"])), this.vtLayers;\n }\n query(t4, e2, r2, n2) {\n this.loadVTLayers();\n const i2 = t4.params || {}, a2 = $a / t4.tileSize / t4.scale, o2 = zn(i2.filter), l2 = t4.queryGeometry, u2 = t4.queryPadding * a2, c2 = Kc(l2), h2 = this.grid.query(c2.minX - u2, c2.minY - u2, c2.maxX + u2, c2.maxY + u2), p2 = Kc(t4.cameraQueryGeometry), f2 = this.grid3D.query(p2.minX - u2, p2.minY - u2, p2.maxX + u2, p2.maxY + u2, (e3, r3, n3, i3) => function(t5, e4, r4, n4, i4) {\n for (const s2 of t5) if (e4 <= s2.x && r4 <= s2.y && n4 >= s2.x && i4 >= s2.y) return true;\n const a3 = [new s(e4, r4), new s(e4, i4), new s(n4, i4), new s(n4, r4)];\n if (t5.length > 2) {\n for (const e5 of a3) if (Wa(t5, e5)) return true;\n }\n for (let e5 = 0; e5 < t5.length - 1; e5++) if (Qa(t5[e5], t5[e5 + 1], a3)) return true;\n return false;\n }(t4.cameraQueryGeometry, e3 - u2, r3 - u2, n3 + u2, i3 + u2));\n for (const t5 of f2) h2.push(t5);\n h2.sort(Xc);\n const d2 = {};\n let y2;\n for (let s2 = 0; s2 < h2.length; s2++) {\n const u3 = h2[s2];\n if (u3 === y2) continue;\n y2 = u3;\n const c3 = this.featureIndexArray.get(u3);\n let p3 = null;\n this.loadMatchingFeature(d2, c3.bucketIndex, c3.sourceLayerIndex, c3.featureIndex, o2, i2.layers, i2.availableImages, e2, r2, n2, (e3, r3, n3) => (p3 || (p3 = Oa(e3)), r3.queryIntersectsFeature(l2, e3, n3, p3, this.z, t4.transform, a2, t4.pixelPosMatrix)));\n }\n return d2;\n }\n loadMatchingFeature(t4, e2, r2, n2, i2, s2, a2, o2, l2, u2, c2) {\n const h2 = this.bucketLayerIDs[e2];\n if (s2 && !function(t5, e3) {\n for (let r3 = 0; r3 < t5.length; r3++) if (e3.indexOf(t5[r3]) >= 0) return true;\n return false;\n }(s2, h2)) return;\n const p2 = this.sourceLayerCoder.decode(r2), f2 = this.vtLayers[p2].feature(n2);\n if (i2.needGeometry) {\n const t5 = ja(f2, true);\n if (!i2.filter(new Ui(this.tileID.overscaledZ), t5, this.tileID.canonical)) return;\n } else if (!i2.filter(new Ui(this.tileID.overscaledZ), f2)) return;\n const d2 = this.getId(f2, p2);\n for (let e3 = 0; e3 < h2.length; e3++) {\n const r3 = h2[e3];\n if (s2 && s2.indexOf(r3) < 0) continue;\n const i3 = o2[r3];\n if (!i3) continue;\n let p3 = {};\n d2 && u2 && (p3 = u2.getState(i3.sourceLayer || \"_geojsonTileLayer\", d2));\n const y2 = g({}, l2[r3]);\n y2.paint = Gc(y2.paint, i3.paint, f2, p3, a2), y2.layout = Gc(y2.layout, i3.layout, f2, p3, a2);\n const m2 = !c2 || c2(f2, i3, p3);\n if (!m2) continue;\n const x2 = new Nc(f2, this.z, this.x, this.y, d2);\n x2.layer = y2;\n let v2 = t4[r3];\n void 0 === v2 && (v2 = t4[r3] = []), v2.push({ featureIndex: n2, feature: x2, intersectionZ: m2 });\n }\n }\n lookupSymbolFeatures(t4, e2, r2, n2, i2, s2, a2, o2) {\n const l2 = {};\n this.loadVTLayers();\n const u2 = zn(i2);\n for (const i3 of t4) this.loadMatchingFeature(l2, r2, n2, i3, u2, s2, a2, o2, e2);\n return l2;\n }\n hasLayer(t4) {\n for (const e2 of this.bucketLayerIDs) for (const r2 of e2) if (t4 === r2) return true;\n return false;\n }\n getId(t4, e2) {\n let r2 = t4.id;\n return this.promoteId && (r2 = t4.properties[\"string\" == typeof this.promoteId ? this.promoteId : this.promoteId[e2]], \"boolean\" == typeof r2 && (r2 = Number(r2))), r2;\n }\n }\n function Gc(t4, e2, r2, n2, i2) {\n return v(t4, (t5, s2) => {\n const a2 = e2 instanceof Yi ? e2.get(s2) : null;\n return a2 && a2.evaluate ? a2.evaluate(r2, n2, i2) : a2;\n });\n }\n function Kc(t4) {\n let e2 = 1 / 0, r2 = 1 / 0, n2 = -1 / 0, i2 = -1 / 0;\n for (const s2 of t4) e2 = Math.min(e2, s2.x), r2 = Math.min(r2, s2.y), n2 = Math.max(n2, s2.x), i2 = Math.max(i2, s2.y);\n return { minX: e2, minY: r2, maxX: n2, maxY: i2 };\n }\n function Xc(t4, e2) {\n return e2 - t4;\n }\n function Hc(t4, e2, r2, n2, i2) {\n const a2 = [];\n for (let o2 = 0; o2 < t4.length; o2++) {\n const l2 = t4[o2];\n let u2;\n for (let t5 = 0; t5 < l2.length - 1; t5++) {\n let o3 = l2[t5], c2 = l2[t5 + 1];\n o3.x < e2 && c2.x < e2 || (o3.x < e2 ? o3 = new s(e2, o3.y + (e2 - o3.x) / (c2.x - o3.x) * (c2.y - o3.y))._round() : c2.x < e2 && (c2 = new s(e2, o3.y + (e2 - o3.x) / (c2.x - o3.x) * (c2.y - o3.y))._round()), o3.y < r2 && c2.y < r2 || (o3.y < r2 ? o3 = new s(o3.x + (r2 - o3.y) / (c2.y - o3.y) * (c2.x - o3.x), r2)._round() : c2.y < r2 && (c2 = new s(o3.x + (r2 - o3.y) / (c2.y - o3.y) * (c2.x - o3.x), r2)._round()), o3.x >= n2 && c2.x >= n2 || (o3.x >= n2 ? o3 = new s(n2, o3.y + (n2 - o3.x) / (c2.x - o3.x) * (c2.y - o3.y))._round() : c2.x >= n2 && (c2 = new s(n2, o3.y + (n2 - o3.x) / (c2.x - o3.x) * (c2.y - o3.y))._round()), o3.y >= i2 && c2.y >= i2 || (o3.y >= i2 ? o3 = new s(o3.x + (i2 - o3.y) / (c2.y - o3.y) * (c2.x - o3.x), i2)._round() : c2.y >= i2 && (c2 = new s(o3.x + (i2 - o3.y) / (c2.y - o3.y) * (c2.x - o3.x), i2)._round()), u2 && o3.equals(u2[u2.length - 1]) || (u2 = [o3], a2.push(u2)), u2.push(c2)))));\n }\n }\n return a2;\n }\n wi(\"FeatureIndex\", Zc, { omit: [\"rawTileData\", \"sourceLayerCoder\"] });\n class Yc extends s {\n constructor(t4, e2, r2, n2) {\n super(t4, e2), this.angle = r2, void 0 !== n2 && (this.segment = n2);\n }\n clone() {\n return new Yc(this.x, this.y, this.angle, this.segment);\n }\n }\n function Jc(t4, e2, r2, n2, i2) {\n if (void 0 === e2.segment || 0 === r2) return true;\n let s2 = e2, a2 = e2.segment + 1, o2 = 0;\n for (; o2 > -r2 / 2; ) {\n if (a2--, a2 < 0) return false;\n o2 -= t4[a2].dist(s2), s2 = t4[a2];\n }\n o2 += t4[a2].dist(t4[a2 + 1]), a2++;\n const l2 = [];\n let u2 = 0;\n for (; o2 < r2 / 2; ) {\n const e3 = t4[a2], r3 = t4[a2 + 1];\n if (!r3) return false;\n let s3 = t4[a2 - 1].angleTo(e3) - e3.angleTo(r3);\n for (s3 = Math.abs((s3 + 3 * Math.PI) % (2 * Math.PI) - Math.PI), l2.push({ distance: o2, angleDelta: s3 }), u2 += s3; o2 - l2[0].distance > n2; ) u2 -= l2.shift().angleDelta;\n if (u2 > i2) return false;\n a2++, o2 += e3.dist(r3);\n }\n return true;\n }\n function Wc(t4) {\n let e2 = 0;\n for (let r2 = 0; r2 < t4.length - 1; r2++) e2 += t4[r2].dist(t4[r2 + 1]);\n return e2;\n }\n function Qc(t4, e2, r2) {\n return t4 ? 0.6 * e2 * r2 : 0;\n }\n function th(t4, e2) {\n return Math.max(t4 ? t4.right - t4.left : 0, e2 ? e2.right - e2.left : 0);\n }\n function eh(t4, e2, r2, n2, i2, s2) {\n const a2 = Qc(r2, i2, s2), o2 = th(r2, n2) * s2;\n let l2 = 0;\n const u2 = Wc(t4) / 2;\n for (let r3 = 0; r3 < t4.length - 1; r3++) {\n const n3 = t4[r3], i3 = t4[r3 + 1], s3 = n3.dist(i3);\n if (l2 + s3 > u2) {\n const c2 = (u2 - l2) / s3, h2 = Ce.number(n3.x, i3.x, c2), p2 = Ce.number(n3.y, i3.y, c2), f2 = new Yc(h2, p2, i3.angleTo(n3), r3);\n return f2._round(), !a2 || Jc(t4, f2, o2, a2, e2) ? f2 : void 0;\n }\n l2 += s3;\n }\n }\n function rh(t4, e2, r2, n2, i2, s2, a2, o2, l2) {\n const u2 = Qc(n2, s2, a2), c2 = th(n2, i2), h2 = c2 * a2, p2 = 0 === t4[0].x || t4[0].x === l2 || 0 === t4[0].y || t4[0].y === l2;\n return e2 - h2 < e2 / 4 && (e2 = h2 + e2 / 4), nh(t4, p2 ? e2 / 2 * o2 % e2 : (c2 / 2 + 2 * s2) * a2 * o2 % e2, e2, u2, r2, h2, p2, false, l2);\n }\n function nh(t4, e2, r2, n2, i2, s2, a2, o2, l2) {\n const u2 = s2 / 2, c2 = Wc(t4);\n let h2 = 0, p2 = e2 - r2, f2 = [];\n for (let e3 = 0; e3 < t4.length - 1; e3++) {\n const a3 = t4[e3], o3 = t4[e3 + 1], d2 = a3.dist(o3), y2 = o3.angleTo(a3);\n for (; p2 + r2 < h2 + d2; ) {\n p2 += r2;\n const m2 = (p2 - h2) / d2, g2 = Ce.number(a3.x, o3.x, m2), x2 = Ce.number(a3.y, o3.y, m2);\n if (g2 >= 0 && g2 < l2 && x2 >= 0 && x2 < l2 && p2 - u2 >= 0 && p2 + u2 <= c2) {\n const r3 = new Yc(g2, x2, y2, e3);\n r3._round(), n2 && !Jc(t4, r3, s2, n2, i2) || f2.push(r3);\n }\n }\n h2 += d2;\n }\n return o2 || f2.length || a2 || (f2 = nh(t4, h2 / 2, r2, n2, i2, s2, a2, true, l2)), f2;\n }\n wi(\"Anchor\", Yc);\n const ih = Fu;\n function sh(t4, e2, r2, n2) {\n const i2 = [], a2 = t4.image, o2 = a2.pixelRatio, l2 = a2.paddedRect.w - 2 * ih, u2 = a2.paddedRect.h - 2 * ih;\n let c2 = { x1: t4.left, y1: t4.top, x2: t4.right, y2: t4.bottom };\n const h2 = a2.stretchX || [[0, l2]], p2 = a2.stretchY || [[0, u2]], f2 = (t5, e3) => t5 + e3[1] - e3[0], d2 = h2.reduce(f2, 0), y2 = p2.reduce(f2, 0), m2 = l2 - d2, g2 = u2 - y2;\n let x2 = 0, v2 = d2, b2 = 0, w2 = y2, _2 = 0, A3 = m2, S2 = 0, k2 = g2;\n if (a2.content && n2) {\n const e3 = a2.content, r3 = e3[2] - e3[0], n3 = e3[3] - e3[1];\n (a2.textFitWidth || a2.textFitHeight) && (c2 = tc(t4)), x2 = ah(h2, 0, e3[0]), b2 = ah(p2, 0, e3[1]), v2 = ah(h2, e3[0], e3[2]), w2 = ah(p2, e3[1], e3[3]), _2 = e3[0] - x2, S2 = e3[1] - b2, A3 = r3 - v2, k2 = n3 - w2;\n }\n const M2 = c2.x1, I2 = c2.y1, z2 = c2.x2 - M2, P2 = c2.y2 - I2, C3 = (t5, n3, i3, l3) => {\n const u3 = lh(t5.stretch - x2, v2, z2, M2), c3 = uh(t5.fixed - _2, A3, t5.stretch, d2), h3 = lh(n3.stretch - b2, w2, P2, I2), p3 = uh(n3.fixed - S2, k2, n3.stretch, y2), f3 = lh(i3.stretch - x2, v2, z2, M2), m3 = uh(i3.fixed - _2, A3, i3.stretch, d2), g3 = lh(l3.stretch - b2, w2, P2, I2), C4 = uh(l3.fixed - S2, k2, l3.stretch, y2), B3 = new s(u3, h3), V2 = new s(f3, h3), E3 = new s(f3, g3), F2 = new s(u3, g3), T2 = new s(c3 / o2, p3 / o2), $2 = new s(m3 / o2, C4 / o2), L2 = e2 * Math.PI / 180;\n if (L2) {\n const t6 = Math.sin(L2), e3 = Math.cos(L2), r3 = [e3, -t6, t6, e3];\n B3._matMult(r3), V2._matMult(r3), F2._matMult(r3), E3._matMult(r3);\n }\n const D3 = t5.stretch + t5.fixed, O2 = n3.stretch + n3.fixed;\n return { tl: B3, tr: V2, bl: F2, br: E3, tex: { x: a2.paddedRect.x + ih + D3, y: a2.paddedRect.y + ih + O2, w: i3.stretch + i3.fixed - D3, h: l3.stretch + l3.fixed - O2 }, writingMode: void 0, glyphOffset: [0, 0], sectionIndex: 0, pixelOffsetTL: T2, pixelOffsetBR: $2, minFontScaleX: A3 / o2 / z2, minFontScaleY: k2 / o2 / P2, isSDF: r2 };\n };\n if (n2 && (a2.stretchX || a2.stretchY)) {\n const t5 = oh(h2, m2, d2), e3 = oh(p2, g2, y2);\n for (let r3 = 0; r3 < t5.length - 1; r3++) {\n const n3 = t5[r3], s2 = t5[r3 + 1];\n for (let t6 = 0; t6 < e3.length - 1; t6++) i2.push(C3(n3, e3[t6], s2, e3[t6 + 1]));\n }\n } else i2.push(C3({ fixed: 0, stretch: -1 }, { fixed: 0, stretch: -1 }, { fixed: 0, stretch: l2 + 1 }, { fixed: 0, stretch: u2 + 1 }));\n return i2;\n }\n function ah(t4, e2, r2) {\n let n2 = 0;\n for (const i2 of t4) n2 += Math.max(e2, Math.min(r2, i2[1])) - Math.max(e2, Math.min(r2, i2[0]));\n return n2;\n }\n function oh(t4, e2, r2) {\n const n2 = [{ fixed: -ih, stretch: 0 }];\n for (const [e3, r3] of t4) {\n const t5 = n2[n2.length - 1];\n n2.push({ fixed: e3 - t5.stretch, stretch: t5.stretch }), n2.push({ fixed: e3 - t5.stretch, stretch: t5.stretch + (r3 - e3) });\n }\n return n2.push({ fixed: e2 + ih, stretch: r2 }), n2;\n }\n function lh(t4, e2, r2, n2) {\n return t4 / e2 * r2 + n2;\n }\n function uh(t4, e2, r2, n2) {\n return t4 - e2 * r2 / n2;\n }\n class ch {\n constructor(t4, e2, r2, n2, i2, a2, o2, l2, u2, c2) {\n var h2;\n if (this.boxStartIndex = t4.length, u2) {\n let t5 = a2.top, e3 = a2.bottom;\n const r3 = a2.collisionPadding;\n r3 && (t5 -= r3[1], e3 += r3[3]);\n let n3 = e3 - t5;\n n3 > 0 && (n3 = Math.max(10, n3), this.circleDiameter = n3);\n } else {\n const u3 = (null === (h2 = a2.image) || void 0 === h2 ? void 0 : h2.content) && (a2.image.textFitWidth || a2.image.textFitHeight) ? tc(a2) : { x1: a2.left, y1: a2.top, x2: a2.right, y2: a2.bottom };\n u3.y1 = u3.y1 * o2 - l2[0], u3.y2 = u3.y2 * o2 + l2[2], u3.x1 = u3.x1 * o2 - l2[3], u3.x2 = u3.x2 * o2 + l2[1];\n const p2 = a2.collisionPadding;\n if (p2 && (u3.x1 -= p2[0] * o2, u3.y1 -= p2[1] * o2, u3.x2 += p2[2] * o2, u3.y2 += p2[3] * o2), c2) {\n const t5 = new s(u3.x1, u3.y1), e3 = new s(u3.x2, u3.y1), r3 = new s(u3.x1, u3.y2), n3 = new s(u3.x2, u3.y2), i3 = c2 * Math.PI / 180;\n t5._rotate(i3), e3._rotate(i3), r3._rotate(i3), n3._rotate(i3), u3.x1 = Math.min(t5.x, e3.x, r3.x, n3.x), u3.x2 = Math.max(t5.x, e3.x, r3.x, n3.x), u3.y1 = Math.min(t5.y, e3.y, r3.y, n3.y), u3.y2 = Math.max(t5.y, e3.y, r3.y, n3.y);\n }\n t4.emplaceBack(e2.x, e2.y, u3.x1, u3.y1, u3.x2, u3.y2, r2, n2, i2);\n }\n this.boxEndIndex = t4.length;\n }\n }\n class hh {\n constructor(t4 = [], e2 = (t5, e3) => t5 < e3 ? -1 : t5 > e3 ? 1 : 0) {\n if (this.data = t4, this.length = this.data.length, this.compare = e2, this.length > 0) for (let t5 = (this.length >> 1) - 1; t5 >= 0; t5--) this._down(t5);\n }\n push(t4) {\n this.data.push(t4), this._up(this.length++);\n }\n pop() {\n if (0 === this.length) return;\n const t4 = this.data[0], e2 = this.data.pop();\n return --this.length > 0 && (this.data[0] = e2, this._down(0)), t4;\n }\n peek() {\n return this.data[0];\n }\n _up(t4) {\n const { data: e2, compare: r2 } = this, n2 = e2[t4];\n for (; t4 > 0; ) {\n const i2 = t4 - 1 >> 1, s2 = e2[i2];\n if (r2(n2, s2) >= 0) break;\n e2[t4] = s2, t4 = i2;\n }\n e2[t4] = n2;\n }\n _down(t4) {\n const { data: e2, compare: r2 } = this, n2 = this.length >> 1, i2 = e2[t4];\n for (; t4 < n2; ) {\n let n3 = 1 + (t4 << 1);\n const s2 = n3 + 1;\n if (s2 < this.length && r2(e2[s2], e2[n3]) < 0 && (n3 = s2), r2(e2[n3], i2) >= 0) break;\n e2[t4] = e2[n3], t4 = n3;\n }\n e2[t4] = i2;\n }\n }\n function ph(t4, e2 = 1, r2 = false) {\n let n2 = 1 / 0, i2 = 1 / 0, a2 = -1 / 0, o2 = -1 / 0;\n const l2 = t4[0];\n for (let t5 = 0; t5 < l2.length; t5++) {\n const e3 = l2[t5];\n (!t5 || e3.x < n2) && (n2 = e3.x), (!t5 || e3.y < i2) && (i2 = e3.y), (!t5 || e3.x > a2) && (a2 = e3.x), (!t5 || e3.y > o2) && (o2 = e3.y);\n }\n const u2 = Math.min(a2 - n2, o2 - i2);\n let c2 = u2 / 2;\n const h2 = new hh([], fh);\n if (0 === u2) return new s(n2, i2);\n for (let e3 = n2; e3 < a2; e3 += u2) for (let r3 = i2; r3 < o2; r3 += u2) h2.push(new dh(e3 + c2, r3 + c2, c2, t4));\n let p2 = function(t5) {\n let e3 = 0, r3 = 0, n3 = 0;\n const i3 = t5[0];\n for (let t6 = 0, s2 = i3.length, a3 = s2 - 1; t6 < s2; a3 = t6++) {\n const s3 = i3[t6], o3 = i3[a3], l3 = s3.x * o3.y - o3.x * s3.y;\n r3 += (s3.x + o3.x) * l3, n3 += (s3.y + o3.y) * l3, e3 += 3 * l3;\n }\n return new dh(r3 / e3, n3 / e3, 0, t5);\n }(t4), f2 = h2.length;\n for (; h2.length; ) {\n const n3 = h2.pop();\n (n3.d > p2.d || !p2.d) && (p2 = n3, r2 && console.log(\"found best %d after %d probes\", Math.round(1e4 * n3.d) / 1e4, f2)), n3.max - p2.d <= e2 || (c2 = n3.h / 2, h2.push(new dh(n3.p.x - c2, n3.p.y - c2, c2, t4)), h2.push(new dh(n3.p.x + c2, n3.p.y - c2, c2, t4)), h2.push(new dh(n3.p.x - c2, n3.p.y + c2, c2, t4)), h2.push(new dh(n3.p.x + c2, n3.p.y + c2, c2, t4)), f2 += 4);\n }\n return r2 && (console.log(`num probes: ${f2}`), console.log(`best distance: ${p2.d}`)), p2.p;\n }\n function fh(t4, e2) {\n return e2.max - t4.max;\n }\n function dh(t4, e2, r2, n2) {\n this.p = new s(t4, e2), this.h = r2, this.d = function(t5, e3) {\n let r3 = false, n3 = 1 / 0;\n for (let i2 = 0; i2 < e3.length; i2++) {\n const s2 = e3[i2];\n for (let e4 = 0, i3 = s2.length, a2 = i3 - 1; e4 < i3; a2 = e4++) {\n const i4 = s2[e4], o2 = s2[a2];\n i4.y > t5.y != o2.y > t5.y && t5.x < (o2.x - i4.x) * (t5.y - i4.y) / (o2.y - i4.y) + i4.x && (r3 = !r3), n3 = Math.min(n3, Ya(t5, i4, o2));\n }\n }\n return (r3 ? 1 : -1) * Math.sqrt(n3);\n }(this.p, n2), this.max = this.d + this.h * Math.SQRT2;\n }\n var yh;\n t.aq = void 0, (yh = t.aq || (t.aq = {}))[yh.center = 1] = \"center\", yh[yh.left = 2] = \"left\", yh[yh.right = 3] = \"right\", yh[yh.top = 4] = \"top\", yh[yh.bottom = 5] = \"bottom\", yh[yh[\"top-left\"] = 6] = \"top-left\", yh[yh[\"top-right\"] = 7] = \"top-right\", yh[yh[\"bottom-left\"] = 8] = \"bottom-left\", yh[yh[\"bottom-right\"] = 9] = \"bottom-right\";\n const mh = 7, gh = Number.POSITIVE_INFINITY;\n function xh(t4, e2) {\n return e2[1] !== gh ? function(t5, e3, r2) {\n let n2 = 0, i2 = 0;\n switch (e3 = Math.abs(e3), r2 = Math.abs(r2), t5) {\n case \"top-right\":\n case \"top-left\":\n case \"top\":\n i2 = r2 - mh;\n break;\n case \"bottom-right\":\n case \"bottom-left\":\n case \"bottom\":\n i2 = -r2 + mh;\n }\n switch (t5) {\n case \"top-right\":\n case \"bottom-right\":\n case \"right\":\n n2 = -e3;\n break;\n case \"top-left\":\n case \"bottom-left\":\n case \"left\":\n n2 = e3;\n }\n return [n2, i2];\n }(t4, e2[0], e2[1]) : function(t5, e3) {\n let r2 = 0, n2 = 0;\n e3 < 0 && (e3 = 0);\n const i2 = e3 / Math.SQRT2;\n switch (t5) {\n case \"top-right\":\n case \"top-left\":\n n2 = i2 - mh;\n break;\n case \"bottom-right\":\n case \"bottom-left\":\n n2 = -i2 + mh;\n break;\n case \"bottom\":\n n2 = -e3 + mh;\n break;\n case \"top\":\n n2 = e3 - mh;\n }\n switch (t5) {\n case \"top-right\":\n case \"bottom-right\":\n r2 = -i2;\n break;\n case \"top-left\":\n case \"bottom-left\":\n r2 = i2;\n break;\n case \"left\":\n r2 = e3;\n break;\n case \"right\":\n r2 = -e3;\n }\n return [r2, n2];\n }(t4, e2[0]);\n }\n function vh(t4, e2, r2) {\n var n2;\n const i2 = t4.layout, s2 = null === (n2 = i2.get(\"text-variable-anchor-offset\")) || void 0 === n2 ? void 0 : n2.evaluate(e2, {}, r2);\n if (s2) {\n const t5 = s2.values, e3 = [];\n for (let r3 = 0; r3 < t5.length; r3 += 2) {\n const n3 = e3[r3] = t5[r3], i3 = t5[r3 + 1].map((t6) => t6 * iu);\n n3.startsWith(\"top\") ? i3[1] -= mh : n3.startsWith(\"bottom\") && (i3[1] += mh), e3[r3 + 1] = i3;\n }\n return new Qt(e3);\n }\n const a2 = i2.get(\"text-variable-anchor\");\n if (a2) {\n let n3;\n n3 = void 0 !== t4._unevaluatedLayout.getValue(\"text-radial-offset\") ? [i2.get(\"text-radial-offset\").evaluate(e2, {}, r2) * iu, gh] : i2.get(\"text-offset\").evaluate(e2, {}, r2).map((t5) => t5 * iu);\n const s3 = [];\n for (const t5 of a2) s3.push(t5, xh(t5, n3));\n return new Qt(s3);\n }\n return null;\n }\n function bh(t4) {\n switch (t4) {\n case \"right\":\n case \"top-right\":\n case \"bottom-right\":\n return \"right\";\n case \"left\":\n case \"top-left\":\n case \"bottom-left\":\n return \"left\";\n }\n return \"center\";\n }\n function wh(e2, r2, n2, i2, s2, a2, o2, l2, u2, c2, h2) {\n let p2 = a2.textMaxSize.evaluate(r2, {});\n void 0 === p2 && (p2 = o2);\n const f2 = e2.layers[0].layout, d2 = f2.get(\"icon-offset\").evaluate(r2, {}, h2), y2 = Ah(n2.horizontal), m2 = o2 / 24, g2 = e2.tilePixelRatio * m2, x2 = e2.tilePixelRatio * p2 / 24, v2 = e2.tilePixelRatio * l2, b2 = e2.tilePixelRatio * f2.get(\"symbol-spacing\"), w2 = f2.get(\"text-padding\") * e2.tilePixelRatio, _2 = function(t4, e3, r3, n3 = 1) {\n const i3 = t4.get(\"icon-padding\").evaluate(e3, {}, r3), s3 = i3 && i3.values;\n return [s3[0] * n3, s3[1] * n3, s3[2] * n3, s3[3] * n3];\n }(f2, r2, h2, e2.tilePixelRatio), S2 = f2.get(\"text-max-angle\") / 180 * Math.PI, k2 = \"viewport\" !== f2.get(\"text-rotation-alignment\") && \"point\" !== f2.get(\"symbol-placement\"), M2 = \"map\" === f2.get(\"icon-rotation-alignment\") && \"point\" !== f2.get(\"symbol-placement\"), I2 = f2.get(\"symbol-placement\"), z2 = b2 / 2, P2 = f2.get(\"icon-text-fit\");\n let C3;\n i2 && \"none\" !== P2 && (e2.allowVerticalPlacement && n2.vertical && (C3 = ec(i2, n2.vertical, P2, f2.get(\"icon-text-fit-padding\"), d2, m2)), y2 && (i2 = ec(i2, y2, P2, f2.get(\"icon-text-fit-padding\"), d2, m2)));\n const B3 = (l3, p3) => {\n p3.x < 0 || p3.x >= $a || p3.y < 0 || p3.y >= $a || function(e3, r3, n3, i3, s3, a3, o3, l4, u3, c3, h3, p4, f3, d3, y3, m3, g3, x3, v3, b3, w3, _3, S3, k3, M3) {\n const I3 = e3.addToLineVertexArray(r3, n3);\n let z3, P3, C4, B4, V2 = 0, E3 = 0, F2 = 0, T2 = 0, $2 = -1, L2 = -1;\n const D3 = {};\n let O2 = ma(\"\");\n if (e3.allowVerticalPlacement && i3.vertical) {\n const t4 = l4.layout.get(\"text-rotate\").evaluate(w3, {}, k3) + 90;\n C4 = new ch(u3, r3, c3, h3, p4, i3.vertical, f3, d3, y3, t4), o3 && (B4 = new ch(u3, r3, c3, h3, p4, o3, g3, x3, y3, t4));\n }\n if (s3) {\n const n4 = l4.layout.get(\"icon-rotate\").evaluate(w3, {}), i4 = \"none\" !== l4.layout.get(\"icon-text-fit\"), a4 = sh(s3, n4, S3, i4), f4 = o3 ? sh(o3, n4, S3, i4) : void 0;\n P3 = new ch(u3, r3, c3, h3, p4, s3, g3, x3, false, n4), V2 = 4 * a4.length;\n const d4 = e3.iconSizeData;\n let y4 = null;\n \"source\" === d4.kind ? (y4 = [nc * l4.layout.get(\"icon-size\").evaluate(w3, {})], y4[0] > ic && A2(`${e3.layerIds[0]}: Value for \"icon-size\" is >= ${rc}. Reduce your \"icon-size\".`)) : \"composite\" === d4.kind && (y4 = [nc * _3.compositeIconSizes[0].evaluate(w3, {}, k3), nc * _3.compositeIconSizes[1].evaluate(w3, {}, k3)], (y4[0] > ic || y4[1] > ic) && A2(`${e3.layerIds[0]}: Value for \"icon-size\" is >= ${rc}. Reduce your \"icon-size\".`)), e3.addSymbols(e3.icon, a4, y4, b3, v3, w3, t.ah.none, r3, I3.lineStartIndex, I3.lineLength, -1, k3), $2 = e3.icon.placedSymbolArray.length - 1, f4 && (E3 = 4 * f4.length, e3.addSymbols(e3.icon, f4, y4, b3, v3, w3, t.ah.vertical, r3, I3.lineStartIndex, I3.lineLength, -1, k3), L2 = e3.icon.placedSymbolArray.length - 1);\n }\n const j2 = Object.keys(i3.horizontal);\n for (const n4 of j2) {\n const s4 = i3.horizontal[n4];\n if (!z3) {\n O2 = ma(s4.text);\n const t4 = l4.layout.get(\"text-rotate\").evaluate(w3, {}, k3);\n z3 = new ch(u3, r3, c3, h3, p4, s4, f3, d3, y3, t4);\n }\n const o4 = 1 === s4.positionedLines.length;\n if (F2 += _h(e3, r3, s4, a3, l4, y3, w3, m3, I3, i3.vertical ? t.ah.horizontal : t.ah.horizontalOnly, o4 ? j2 : [n4], D3, $2, _3, k3), o4) break;\n }\n i3.vertical && (T2 += _h(e3, r3, i3.vertical, a3, l4, y3, w3, m3, I3, t.ah.vertical, [\"vertical\"], D3, L2, _3, k3));\n const R2 = z3 ? z3.boxStartIndex : e3.collisionBoxArray.length, U2 = z3 ? z3.boxEndIndex : e3.collisionBoxArray.length, q2 = C4 ? C4.boxStartIndex : e3.collisionBoxArray.length, N2 = C4 ? C4.boxEndIndex : e3.collisionBoxArray.length, Z2 = P3 ? P3.boxStartIndex : e3.collisionBoxArray.length, G2 = P3 ? P3.boxEndIndex : e3.collisionBoxArray.length, K3 = B4 ? B4.boxStartIndex : e3.collisionBoxArray.length, X2 = B4 ? B4.boxEndIndex : e3.collisionBoxArray.length;\n let H2 = -1;\n const Y2 = (t4, e4) => t4 && t4.circleDiameter ? Math.max(t4.circleDiameter, e4) : e4;\n H2 = Y2(z3, H2), H2 = Y2(C4, H2), H2 = Y2(P3, H2), H2 = Y2(B4, H2);\n const J2 = H2 > -1 ? 1 : 0;\n J2 && (H2 *= M3 / iu), e3.glyphOffsetArray.length >= dc.MAX_GLYPHS && A2(\"Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907\"), void 0 !== w3.sortKey && e3.addToSortKeyRanges(e3.symbolInstances.length, w3.sortKey);\n const W2 = vh(l4, w3, k3), [Q2, tt2] = function(e4, r4) {\n const n4 = e4.length, i4 = null == r4 ? void 0 : r4.values;\n if ((null == i4 ? void 0 : i4.length) > 0) for (let r5 = 0; r5 < i4.length; r5 += 2) {\n const n5 = i4[r5 + 1];\n e4.emplaceBack(t.aq[i4[r5]], n5[0], n5[1]);\n }\n return [n4, e4.length];\n }(e3.textAnchorOffsets, W2);\n e3.symbolInstances.emplaceBack(r3.x, r3.y, D3.right >= 0 ? D3.right : -1, D3.center >= 0 ? D3.center : -1, D3.left >= 0 ? D3.left : -1, D3.vertical || -1, $2, L2, O2, R2, U2, q2, N2, Z2, G2, K3, X2, c3, F2, T2, V2, E3, J2, 0, f3, H2, Q2, tt2);\n }(e2, p3, l3, n2, i2, s2, C3, e2.layers[0], e2.collisionBoxArray, r2.index, r2.sourceLayerIndex, e2.index, g2, [w2, w2, w2, w2], k2, u2, v2, _2, M2, d2, r2, a2, c2, h2, o2);\n };\n if (\"line\" === I2) for (const t4 of Hc(r2.geometry, 0, 0, $a, $a)) {\n const r3 = rh(t4, b2, S2, n2.vertical || y2, i2, 24, x2, e2.overscaling, $a);\n for (const n3 of r3) y2 && Sh(e2, y2.text, z2, n3) || B3(t4, n3);\n }\n else if (\"line-center\" === I2) {\n for (const t4 of r2.geometry) if (t4.length > 1) {\n const e3 = eh(t4, S2, n2.vertical || y2, i2, 24, x2);\n e3 && B3(t4, e3);\n }\n } else if (\"Polygon\" === r2.type) for (const t4 of xr(r2.geometry, 0)) {\n const e3 = ph(t4, 16);\n B3(t4[0], new Yc(e3.x, e3.y, 0));\n }\n else if (\"LineString\" === r2.type) for (const t4 of r2.geometry) B3(t4, new Yc(t4[0].x, t4[0].y, 0));\n else if (\"Point\" === r2.type) for (const t4 of r2.geometry) for (const e3 of t4) B3([e3], new Yc(e3.x, e3.y, 0));\n }\n function _h(t4, e2, r2, n2, i2, a2, o2, l2, u2, c2, h2, p2, f2, d2, y2) {\n const m2 = function(t5, e3, r3, n3, i3, a3, o3, l3) {\n const u3 = n3.layout.get(\"text-rotate\").evaluate(a3, {}) * Math.PI / 180, c3 = [];\n for (const t6 of e3.positionedLines) for (const n4 of t6.positionedGlyphs) {\n if (!n4.rect) continue;\n const a4 = n4.rect || {};\n let h3 = Vu + 1, p3 = true, f3 = 1, d3 = 0;\n const y3 = (i3 || l3) && n4.vertical, m3 = n4.metrics.advance * n4.scale / 2;\n if (l3 && e3.verticalizable && (d3 = t6.lineOffset / 2 - (n4.imageName ? -(iu - n4.metrics.width * n4.scale) / 2 : (n4.scale - 1) * iu)), n4.imageName) {\n const t7 = o3[n4.imageName];\n p3 = t7.sdf, f3 = t7.pixelRatio, h3 = Fu / f3;\n }\n const g3 = i3 ? [n4.x + m3, n4.y] : [0, 0];\n let x3 = i3 ? [0, 0] : [n4.x + m3 + r3[0], n4.y + r3[1] - d3], v2 = [0, 0];\n y3 && (v2 = x3, x3 = [0, 0]);\n const b2 = n4.metrics.isDoubleResolution ? 2 : 1, w2 = (n4.metrics.left - h3) * n4.scale - m3 + x3[0], _2 = (-n4.metrics.top - h3) * n4.scale + x3[1], A3 = w2 + a4.w / b2 * n4.scale / f3, S2 = _2 + a4.h / b2 * n4.scale / f3, k2 = new s(w2, _2), M2 = new s(A3, _2), I2 = new s(w2, S2), z2 = new s(A3, S2);\n if (y3) {\n const t7 = new s(-m3, m3 - Du), e4 = -Math.PI / 2, r4 = iu / 2 - m3, i4 = new s(5 - Du - r4, -(n4.imageName ? r4 : 0)), a5 = new s(...v2);\n k2._rotateAround(e4, t7)._add(i4)._add(a5), M2._rotateAround(e4, t7)._add(i4)._add(a5), I2._rotateAround(e4, t7)._add(i4)._add(a5), z2._rotateAround(e4, t7)._add(i4)._add(a5);\n }\n if (u3) {\n const t7 = Math.sin(u3), e4 = Math.cos(u3), r4 = [e4, -t7, t7, e4];\n k2._matMult(r4), M2._matMult(r4), I2._matMult(r4), z2._matMult(r4);\n }\n const P2 = new s(0, 0), C3 = new s(0, 0);\n c3.push({ tl: k2, tr: M2, bl: I2, br: z2, tex: a4, writingMode: e3.writingMode, glyphOffset: g3, sectionIndex: n4.sectionIndex, isSDF: p3, pixelOffsetTL: P2, pixelOffsetBR: C3, minFontScaleX: 0, minFontScaleY: 0 });\n }\n return c3;\n }(0, r2, l2, i2, a2, o2, n2, t4.allowVerticalPlacement), g2 = t4.textSizeData;\n let x2 = null;\n \"source\" === g2.kind ? (x2 = [nc * i2.layout.get(\"text-size\").evaluate(o2, {})], x2[0] > ic && A2(`${t4.layerIds[0]}: Value for \"text-size\" is >= ${rc}. Reduce your \"text-size\".`)) : \"composite\" === g2.kind && (x2 = [nc * d2.compositeTextSizes[0].evaluate(o2, {}, y2), nc * d2.compositeTextSizes[1].evaluate(o2, {}, y2)], (x2[0] > ic || x2[1] > ic) && A2(`${t4.layerIds[0]}: Value for \"text-size\" is >= ${rc}. Reduce your \"text-size\".`)), t4.addSymbols(t4.text, m2, x2, l2, a2, o2, c2, e2, u2.lineStartIndex, u2.lineLength, f2, y2);\n for (const e3 of h2) p2[e3] = t4.text.placedSymbolArray.length - 1;\n return 4 * m2.length;\n }\n function Ah(t4) {\n for (const e2 in t4) return t4[e2];\n return null;\n }\n function Sh(t4, e2, r2, n2) {\n const i2 = t4.compareText;\n if (e2 in i2) {\n const t5 = i2[e2];\n for (let e3 = t5.length - 1; e3 >= 0; e3--) if (n2.dist(t5[e3]) < r2) return true;\n } else i2[e2] = [];\n return i2[e2].push(n2), false;\n }\n const kh = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array];\n class Mh {\n static from(t4) {\n if (!(t4 instanceof ArrayBuffer)) throw new Error(\"Data must be an instance of ArrayBuffer.\");\n const [e2, r2] = new Uint8Array(t4, 0, 2);\n if (219 !== e2) throw new Error(\"Data does not appear to be in a KDBush format.\");\n const n2 = r2 >> 4;\n if (1 !== n2) throw new Error(`Got v${n2} data when expected v1.`);\n const i2 = kh[15 & r2];\n if (!i2) throw new Error(\"Unrecognized array type.\");\n const [s2] = new Uint16Array(t4, 2, 1), [a2] = new Uint32Array(t4, 4, 1);\n return new Mh(a2, s2, i2, t4);\n }\n constructor(t4, e2 = 64, r2 = Float64Array, n2) {\n if (isNaN(t4) || t4 < 0) throw new Error(`Unpexpected numItems value: ${t4}.`);\n this.numItems = +t4, this.nodeSize = Math.min(Math.max(+e2, 2), 65535), this.ArrayType = r2, this.IndexArrayType = t4 < 65536 ? Uint16Array : Uint32Array;\n const i2 = kh.indexOf(this.ArrayType), s2 = 2 * t4 * this.ArrayType.BYTES_PER_ELEMENT, a2 = t4 * this.IndexArrayType.BYTES_PER_ELEMENT, o2 = (8 - a2 % 8) % 8;\n if (i2 < 0) throw new Error(`Unexpected typed array class: ${r2}.`);\n n2 && n2 instanceof ArrayBuffer ? (this.data = n2, this.ids = new this.IndexArrayType(this.data, 8, t4), this.coords = new this.ArrayType(this.data, 8 + a2 + o2, 2 * t4), this._pos = 2 * t4, this._finished = true) : (this.data = new ArrayBuffer(8 + s2 + a2 + o2), this.ids = new this.IndexArrayType(this.data, 8, t4), this.coords = new this.ArrayType(this.data, 8 + a2 + o2, 2 * t4), this._pos = 0, this._finished = false, new Uint8Array(this.data, 0, 2).set([219, 16 + i2]), new Uint16Array(this.data, 2, 1)[0] = e2, new Uint32Array(this.data, 4, 1)[0] = t4);\n }\n add(t4, e2) {\n const r2 = this._pos >> 1;\n return this.ids[r2] = r2, this.coords[this._pos++] = t4, this.coords[this._pos++] = e2, r2;\n }\n finish() {\n const t4 = this._pos >> 1;\n if (t4 !== this.numItems) throw new Error(`Added ${t4} items when expected ${this.numItems}.`);\n return Ih(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = true, this;\n }\n range(t4, e2, r2, n2) {\n if (!this._finished) throw new Error(\"Data not yet indexed - call index.finish().\");\n const { ids: i2, coords: s2, nodeSize: a2 } = this, o2 = [0, i2.length - 1, 0], l2 = [];\n for (; o2.length; ) {\n const u2 = o2.pop() || 0, c2 = o2.pop() || 0, h2 = o2.pop() || 0;\n if (c2 - h2 <= a2) {\n for (let a3 = h2; a3 <= c2; a3++) {\n const o3 = s2[2 * a3], u3 = s2[2 * a3 + 1];\n o3 >= t4 && o3 <= r2 && u3 >= e2 && u3 <= n2 && l2.push(i2[a3]);\n }\n continue;\n }\n const p2 = h2 + c2 >> 1, f2 = s2[2 * p2], d2 = s2[2 * p2 + 1];\n f2 >= t4 && f2 <= r2 && d2 >= e2 && d2 <= n2 && l2.push(i2[p2]), (0 === u2 ? t4 <= f2 : e2 <= d2) && (o2.push(h2), o2.push(p2 - 1), o2.push(1 - u2)), (0 === u2 ? r2 >= f2 : n2 >= d2) && (o2.push(p2 + 1), o2.push(c2), o2.push(1 - u2));\n }\n return l2;\n }\n within(t4, e2, r2) {\n if (!this._finished) throw new Error(\"Data not yet indexed - call index.finish().\");\n const { ids: n2, coords: i2, nodeSize: s2 } = this, a2 = [0, n2.length - 1, 0], o2 = [], l2 = r2 * r2;\n for (; a2.length; ) {\n const u2 = a2.pop() || 0, c2 = a2.pop() || 0, h2 = a2.pop() || 0;\n if (c2 - h2 <= s2) {\n for (let r3 = h2; r3 <= c2; r3++) Bh(i2[2 * r3], i2[2 * r3 + 1], t4, e2) <= l2 && o2.push(n2[r3]);\n continue;\n }\n const p2 = h2 + c2 >> 1, f2 = i2[2 * p2], d2 = i2[2 * p2 + 1];\n Bh(f2, d2, t4, e2) <= l2 && o2.push(n2[p2]), (0 === u2 ? t4 - r2 <= f2 : e2 - r2 <= d2) && (a2.push(h2), a2.push(p2 - 1), a2.push(1 - u2)), (0 === u2 ? t4 + r2 >= f2 : e2 + r2 >= d2) && (a2.push(p2 + 1), a2.push(c2), a2.push(1 - u2));\n }\n return o2;\n }\n }\n function Ih(t4, e2, r2, n2, i2, s2) {\n if (i2 - n2 <= r2) return;\n const a2 = n2 + i2 >> 1;\n zh(t4, e2, a2, n2, i2, s2), Ih(t4, e2, r2, n2, a2 - 1, 1 - s2), Ih(t4, e2, r2, a2 + 1, i2, 1 - s2);\n }\n function zh(t4, e2, r2, n2, i2, s2) {\n for (; i2 > n2; ) {\n if (i2 - n2 > 600) {\n const a3 = i2 - n2 + 1, o3 = r2 - n2 + 1, l3 = Math.log(a3), u2 = 0.5 * Math.exp(2 * l3 / 3), c2 = 0.5 * Math.sqrt(l3 * u2 * (a3 - u2) / a3) * (o3 - a3 / 2 < 0 ? -1 : 1);\n zh(t4, e2, r2, Math.max(n2, Math.floor(r2 - o3 * u2 / a3 + c2)), Math.min(i2, Math.floor(r2 + (a3 - o3) * u2 / a3 + c2)), s2);\n }\n const a2 = e2[2 * r2 + s2];\n let o2 = n2, l2 = i2;\n for (Ph(t4, e2, n2, r2), e2[2 * i2 + s2] > a2 && Ph(t4, e2, n2, i2); o2 < l2; ) {\n for (Ph(t4, e2, o2, l2), o2++, l2--; e2[2 * o2 + s2] < a2; ) o2++;\n for (; e2[2 * l2 + s2] > a2; ) l2--;\n }\n e2[2 * n2 + s2] === a2 ? Ph(t4, e2, n2, l2) : (l2++, Ph(t4, e2, l2, i2)), l2 <= r2 && (n2 = l2 + 1), r2 <= l2 && (i2 = l2 - 1);\n }\n }\n function Ph(t4, e2, r2, n2) {\n Ch(t4, r2, n2), Ch(e2, 2 * r2, 2 * n2), Ch(e2, 2 * r2 + 1, 2 * n2 + 1);\n }\n function Ch(t4, e2, r2) {\n const n2 = t4[e2];\n t4[e2] = t4[r2], t4[r2] = n2;\n }\n function Bh(t4, e2, r2, n2) {\n const i2 = t4 - r2, s2 = e2 - n2;\n return i2 * i2 + s2 * s2;\n }\n var Vh;\n t.bg = void 0, (Vh = t.bg || (t.bg = {})).create = \"create\", Vh.load = \"load\", Vh.fullLoad = \"fullLoad\";\n let Eh = null, Fh = [];\n const Th = 1e3 / 60, $h = \"loadTime\", Lh = \"fullLoadTime\", Dh = { mark(t4) {\n performance.mark(t4);\n }, frame(t4) {\n const e2 = t4;\n null != Eh && Fh.push(e2 - Eh), Eh = e2;\n }, clearMetrics() {\n Eh = null, Fh = [], performance.clearMeasures($h), performance.clearMeasures(Lh);\n for (const e2 in t.bg) performance.clearMarks(t.bg[e2]);\n }, getPerformanceMetrics() {\n performance.measure($h, t.bg.create, t.bg.load), performance.measure(Lh, t.bg.create, t.bg.fullLoad);\n const e2 = performance.getEntriesByName($h)[0].duration, r2 = performance.getEntriesByName(Lh)[0].duration, n2 = Fh.length, i2 = 1 / (Fh.reduce((t4, e3) => t4 + e3, 0) / n2 / 1e3), s2 = Fh.filter((t4) => t4 > Th).reduce((t4, e3) => t4 + (e3 - Th) / Th, 0);\n return { loadTime: e2, fullLoadTime: r2, fps: i2, percentDroppedFrames: s2 / (n2 + s2) * 100, totalFrames: n2 };\n } };\n t.$ = class extends ps {\n }, t.A = oo, t.B = yi, t.C = function(t4) {\n if (null == M) {\n const e2 = t4.navigator ? t4.navigator.userAgent : null;\n M = !!t4.safari || !(!e2 || !(/\\b(iPad|iPhone|iPod)\\b/.test(e2) || e2.match(\"Safari\") && !e2.match(\"Chrome\")));\n }\n return M;\n }, t.D = Ji, t.E = Z, t.F = class {\n constructor(t4, e2) {\n this.target = t4, this.mapId = e2, this.resolveRejects = {}, this.tasks = {}, this.taskQueue = [], this.abortControllers = {}, this.messageHandlers = {}, this.invoker = new Ic(() => this.process()), this.subscription = function(t5, e3, r2, n2) {\n return t5.addEventListener(e3, r2, false), { unsubscribe: () => {\n t5.removeEventListener(e3, r2, false);\n } };\n }(this.target, \"message\", (t5) => this.receive(t5)), this.globalScope = k(self) ? t4 : window;\n }\n registerMessageHandler(t4, e2) {\n this.messageHandlers[t4] = e2;\n }\n sendAsync(t4, e2) {\n return new Promise((r2, n2) => {\n const i2 = Math.round(1e18 * Math.random()).toString(36).substring(0, 10);\n this.resolveRejects[i2] = { resolve: r2, reject: n2 }, e2 && e2.signal.addEventListener(\"abort\", () => {\n delete this.resolveRejects[i2];\n const e3 = { id: i2, type: \"\", origin: location.origin, targetMapId: t4.targetMapId, sourceMapId: this.mapId };\n this.target.postMessage(e3);\n }, { once: true });\n const s2 = [], a2 = Object.assign(Object.assign({}, t4), { id: i2, sourceMapId: this.mapId, origin: location.origin, data: ki(t4.data, s2) });\n this.target.postMessage(a2, { transfer: s2 });\n });\n }\n receive(t4) {\n const e2 = t4.data, r2 = e2.id;\n if (!(\"file://\" !== e2.origin && \"file://\" !== location.origin && \"resource://android\" !== e2.origin && \"resource://android\" !== location.origin && e2.origin !== location.origin || e2.targetMapId && this.mapId !== e2.targetMapId)) {\n if (\"\" === e2.type) {\n delete this.tasks[r2];\n const t5 = this.abortControllers[r2];\n return delete this.abortControllers[r2], void (t5 && t5.abort());\n }\n if (k(self) || e2.mustQueue) return this.tasks[r2] = e2, this.taskQueue.push(r2), void this.invoker.trigger();\n this.processTask(r2, e2);\n }\n }\n process() {\n if (0 === this.taskQueue.length) return;\n const t4 = this.taskQueue.shift(), e2 = this.tasks[t4];\n delete this.tasks[t4], this.taskQueue.length > 0 && this.invoker.trigger(), e2 && this.processTask(t4, e2);\n }\n processTask(t4, r2) {\n return e(this, void 0, void 0, function* () {\n if (\"\" === r2.type) {\n const e3 = this.resolveRejects[t4];\n if (delete this.resolveRejects[t4], !e3) return;\n return void (r2.error ? e3.reject(Mi(r2.error)) : e3.resolve(Mi(r2.data)));\n }\n if (!this.messageHandlers[r2.type]) return void this.completeTask(t4, new Error(`Could not find a registered handler for ${r2.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(\", \")}`));\n const e2 = Mi(r2.data), n2 = new AbortController();\n this.abortControllers[t4] = n2;\n try {\n const i2 = yield this.messageHandlers[r2.type](r2.sourceMapId, e2, n2);\n this.completeTask(t4, null, i2);\n } catch (e3) {\n this.completeTask(t4, e3);\n }\n });\n }\n completeTask(t4, e2, r2) {\n const n2 = [];\n delete this.abortControllers[t4];\n const i2 = { id: t4, type: \"\", sourceMapId: this.mapId, origin: location.origin, error: e2 ? ki(e2) : null, data: ki(r2, n2) };\n this.target.postMessage(i2, { transfer: n2 });\n }\n remove() {\n this.invoker.remove(), this.subscription.unsubscribe();\n }\n }, t.G = $, t.H = function() {\n var t4 = new oo(16);\n return oo != Float32Array && (t4[1] = 0, t4[2] = 0, t4[3] = 0, t4[4] = 0, t4[6] = 0, t4[7] = 0, t4[8] = 0, t4[9] = 0, t4[11] = 0, t4[12] = 0, t4[13] = 0, t4[14] = 0), t4[0] = 1, t4[5] = 1, t4[10] = 1, t4[15] = 1, t4;\n }, t.I = Tu, t.J = function(t4, e2, r2) {\n var n2, i2, s2, a2, o2, l2, u2, c2, h2, p2, f2, d2, y2 = r2[0], m2 = r2[1], g2 = r2[2];\n return e2 === t4 ? (t4[12] = e2[0] * y2 + e2[4] * m2 + e2[8] * g2 + e2[12], t4[13] = e2[1] * y2 + e2[5] * m2 + e2[9] * g2 + e2[13], t4[14] = e2[2] * y2 + e2[6] * m2 + e2[10] * g2 + e2[14], t4[15] = e2[3] * y2 + e2[7] * m2 + e2[11] * g2 + e2[15]) : (i2 = e2[1], s2 = e2[2], a2 = e2[3], o2 = e2[4], l2 = e2[5], u2 = e2[6], c2 = e2[7], h2 = e2[8], p2 = e2[9], f2 = e2[10], d2 = e2[11], t4[0] = n2 = e2[0], t4[1] = i2, t4[2] = s2, t4[3] = a2, t4[4] = o2, t4[5] = l2, t4[6] = u2, t4[7] = c2, t4[8] = h2, t4[9] = p2, t4[10] = f2, t4[11] = d2, t4[12] = n2 * y2 + o2 * m2 + h2 * g2 + e2[12], t4[13] = i2 * y2 + l2 * m2 + p2 * g2 + e2[13], t4[14] = s2 * y2 + u2 * m2 + f2 * g2 + e2[14], t4[15] = a2 * y2 + c2 * m2 + d2 * g2 + e2[15]), t4;\n }, t.K = function(t4, e2, r2) {\n var n2 = r2[0], i2 = r2[1], s2 = r2[2];\n return t4[0] = e2[0] * n2, t4[1] = e2[1] * n2, t4[2] = e2[2] * n2, t4[3] = e2[3] * n2, t4[4] = e2[4] * i2, t4[5] = e2[5] * i2, t4[6] = e2[6] * i2, t4[7] = e2[7] * i2, t4[8] = e2[8] * s2, t4[9] = e2[9] * s2, t4[10] = e2[10] * s2, t4[11] = e2[11] * s2, t4[12] = e2[12], t4[13] = e2[13], t4[14] = e2[14], t4[15] = e2[15], t4;\n }, t.L = uo, t.M = function(t4, e2) {\n const r2 = {};\n for (let n2 = 0; n2 < e2.length; n2++) {\n const i2 = e2[n2];\n i2 in t4 && (r2[i2] = t4[i2]);\n }\n return r2;\n }, t.N = Pc, t.O = Vc, t.P = s, t.Q = Ec, t.R = Ao, t.S = jc, t.T = Zi, t.U = h, t.V = p, t.W = P, t.X = $a, t.Y = ls, t.Z = $c, t._ = e, t.a = F, t.a$ = function(t4, e2) {\n var r2 = t4[0], n2 = t4[1], i2 = t4[2], s2 = t4[3], a2 = t4[4], o2 = t4[5], l2 = t4[6], u2 = t4[7], c2 = t4[8], h2 = t4[9], p2 = t4[10], f2 = t4[11], d2 = t4[12], y2 = t4[13], m2 = t4[14], g2 = t4[15], x2 = e2[0], v2 = e2[1], b2 = e2[2], w2 = e2[3], _2 = e2[4], A3 = e2[5], S2 = e2[6], k2 = e2[7], M2 = e2[8], I2 = e2[9], z2 = e2[10], P2 = e2[11], C3 = e2[12], B3 = e2[13], V2 = e2[14], E3 = e2[15];\n return Math.abs(r2 - x2) <= ao * Math.max(1, Math.abs(r2), Math.abs(x2)) && Math.abs(n2 - v2) <= ao * Math.max(1, Math.abs(n2), Math.abs(v2)) && Math.abs(i2 - b2) <= ao * Math.max(1, Math.abs(i2), Math.abs(b2)) && Math.abs(s2 - w2) <= ao * Math.max(1, Math.abs(s2), Math.abs(w2)) && Math.abs(a2 - _2) <= ao * Math.max(1, Math.abs(a2), Math.abs(_2)) && Math.abs(o2 - A3) <= ao * Math.max(1, Math.abs(o2), Math.abs(A3)) && Math.abs(l2 - S2) <= ao * Math.max(1, Math.abs(l2), Math.abs(S2)) && Math.abs(u2 - k2) <= ao * Math.max(1, Math.abs(u2), Math.abs(k2)) && Math.abs(c2 - M2) <= ao * Math.max(1, Math.abs(c2), Math.abs(M2)) && Math.abs(h2 - I2) <= ao * Math.max(1, Math.abs(h2), Math.abs(I2)) && Math.abs(p2 - z2) <= ao * Math.max(1, Math.abs(p2), Math.abs(z2)) && Math.abs(f2 - P2) <= ao * Math.max(1, Math.abs(f2), Math.abs(P2)) && Math.abs(d2 - C3) <= ao * Math.max(1, Math.abs(d2), Math.abs(C3)) && Math.abs(y2 - B3) <= ao * Math.max(1, Math.abs(y2), Math.abs(B3)) && Math.abs(m2 - V2) <= ao * Math.max(1, Math.abs(m2), Math.abs(V2)) && Math.abs(g2 - E3) <= ao * Math.max(1, Math.abs(g2), Math.abs(E3));\n }, t.a0 = oa, t.a1 = Dc, t.a2 = it, t.a3 = (t4) => {\n const e2 = window.document.createElement(\"video\");\n return e2.muted = true, new Promise((r2) => {\n e2.onloadstart = () => {\n r2(e2);\n };\n for (const r3 of t4) {\n const t5 = window.document.createElement(\"source\");\n j(r3) || (e2.crossOrigin = \"Anonymous\"), t5.src = r3, e2.appendChild(t5);\n }\n });\n }, t.a4 = function() {\n return x++;\n }, t.a5 = Fs, t.a6 = dc, t.a7 = zn, t.a8 = ja, t.a9 = Nc, t.aA = function(t4) {\n if (\"custom\" === t4.type) return new Mc(t4);\n switch (t4.type) {\n case \"background\":\n return new _c(t4);\n case \"circle\":\n return new fo(t4);\n case \"fill\":\n return new ul(t4);\n case \"fill-extrusion\":\n return new El(t4);\n case \"heatmap\":\n return new Mo(t4);\n case \"hillshade\":\n return new Po(t4);\n case \"line\":\n return new Hl(t4);\n case \"raster\":\n return new kc(t4);\n case \"symbol\":\n return new vc(t4);\n }\n }, t.aB = w, t.aC = function(t4, e2) {\n if (!t4) return [{ command: \"setStyle\", args: [e2] }];\n let r2 = [];\n try {\n if (!H(t4.version, e2.version)) return [{ command: \"setStyle\", args: [e2] }];\n H(t4.center, e2.center) || r2.push({ command: \"setCenter\", args: [e2.center] }), H(t4.zoom, e2.zoom) || r2.push({ command: \"setZoom\", args: [e2.zoom] }), H(t4.bearing, e2.bearing) || r2.push({ command: \"setBearing\", args: [e2.bearing] }), H(t4.pitch, e2.pitch) || r2.push({ command: \"setPitch\", args: [e2.pitch] }), H(t4.sprite, e2.sprite) || r2.push({ command: \"setSprite\", args: [e2.sprite] }), H(t4.glyphs, e2.glyphs) || r2.push({ command: \"setGlyphs\", args: [e2.glyphs] }), H(t4.transition, e2.transition) || r2.push({ command: \"setTransition\", args: [e2.transition] }), H(t4.light, e2.light) || r2.push({ command: \"setLight\", args: [e2.light] }), H(t4.terrain, e2.terrain) || r2.push({ command: \"setTerrain\", args: [e2.terrain] }), H(t4.sky, e2.sky) || r2.push({ command: \"setSky\", args: [e2.sky] }), H(t4.projection, e2.projection) || r2.push({ command: \"setProjection\", args: [e2.projection] });\n const n2 = {}, i2 = [];\n !function(t5, e3, r3, n3) {\n let i3;\n for (i3 in e3 = e3 || {}, t5 = t5 || {}) Object.prototype.hasOwnProperty.call(t5, i3) && (Object.prototype.hasOwnProperty.call(e3, i3) || W(i3, r3, n3));\n for (i3 in e3) Object.prototype.hasOwnProperty.call(e3, i3) && (Object.prototype.hasOwnProperty.call(t5, i3) ? H(t5[i3], e3[i3]) || (\"geojson\" === t5[i3].type && \"geojson\" === e3[i3].type && tt(t5, e3, i3) ? Y(r3, { command: \"setGeoJSONSourceData\", args: [i3, e3[i3].data] }) : Q(i3, e3, r3, n3)) : J(i3, e3, r3));\n }(t4.sources, e2.sources, i2, n2);\n const s2 = [];\n t4.layers && t4.layers.forEach((t5) => {\n \"source\" in t5 && n2[t5.source] ? r2.push({ command: \"removeLayer\", args: [t5.id] }) : s2.push(t5);\n }), r2 = r2.concat(i2), function(t5, e3, r3) {\n e3 = e3 || [];\n const n3 = (t5 = t5 || []).map(rt), i3 = e3.map(rt), s3 = t5.reduce(nt, {}), a2 = e3.reduce(nt, {}), o2 = n3.slice(), l2 = /* @__PURE__ */ Object.create(null);\n let u2, c2, h2, p2, f2;\n for (let t6 = 0, e4 = 0; t6 < n3.length; t6++) u2 = n3[t6], Object.prototype.hasOwnProperty.call(a2, u2) ? e4++ : (Y(r3, { command: \"removeLayer\", args: [u2] }), o2.splice(o2.indexOf(u2, e4), 1));\n for (let t6 = 0, e4 = 0; t6 < i3.length; t6++) u2 = i3[i3.length - 1 - t6], o2[o2.length - 1 - t6] !== u2 && (Object.prototype.hasOwnProperty.call(s3, u2) ? (Y(r3, { command: \"removeLayer\", args: [u2] }), o2.splice(o2.lastIndexOf(u2, o2.length - e4), 1)) : e4++, p2 = o2[o2.length - t6], Y(r3, { command: \"addLayer\", args: [a2[u2], p2] }), o2.splice(o2.length - t6, 0, u2), l2[u2] = true);\n for (let t6 = 0; t6 < i3.length; t6++) if (u2 = i3[t6], c2 = s3[u2], h2 = a2[u2], !l2[u2] && !H(c2, h2)) if (H(c2.source, h2.source) && H(c2[\"source-layer\"], h2[\"source-layer\"]) && H(c2.type, h2.type)) {\n for (f2 in et(c2.layout, h2.layout, r3, u2, null, \"setLayoutProperty\"), et(c2.paint, h2.paint, r3, u2, null, \"setPaintProperty\"), H(c2.filter, h2.filter) || Y(r3, { command: \"setFilter\", args: [u2, h2.filter] }), H(c2.minzoom, h2.minzoom) && H(c2.maxzoom, h2.maxzoom) || Y(r3, { command: \"setLayerZoomRange\", args: [u2, h2.minzoom, h2.maxzoom] }), c2) Object.prototype.hasOwnProperty.call(c2, f2) && \"layout\" !== f2 && \"paint\" !== f2 && \"filter\" !== f2 && \"metadata\" !== f2 && \"minzoom\" !== f2 && \"maxzoom\" !== f2 && (0 === f2.indexOf(\"paint.\") ? et(c2[f2], h2[f2], r3, u2, f2.slice(6), \"setPaintProperty\") : H(c2[f2], h2[f2]) || Y(r3, { command: \"setLayerProperty\", args: [u2, f2, h2[f2]] }));\n for (f2 in h2) Object.prototype.hasOwnProperty.call(h2, f2) && !Object.prototype.hasOwnProperty.call(c2, f2) && \"layout\" !== f2 && \"paint\" !== f2 && \"filter\" !== f2 && \"metadata\" !== f2 && \"minzoom\" !== f2 && \"maxzoom\" !== f2 && (0 === f2.indexOf(\"paint.\") ? et(c2[f2], h2[f2], r3, u2, f2.slice(6), \"setPaintProperty\") : H(c2[f2], h2[f2]) || Y(r3, { command: \"setLayerProperty\", args: [u2, f2, h2[f2]] }));\n } else Y(r3, { command: \"removeLayer\", args: [u2] }), p2 = o2[o2.lastIndexOf(u2) + 1], Y(r3, { command: \"addLayer\", args: [h2, p2] });\n }(s2, e2.layers, r2);\n } catch (t5) {\n console.warn(\"Unable to compute style diff:\", t5), r2 = [{ command: \"setStyle\", args: [e2] }];\n }\n return r2;\n }, t.aD = function(t4) {\n const e2 = [], r2 = t4.id;\n return void 0 === r2 && e2.push({ message: `layers.${r2}: missing required property \"id\"` }), void 0 === t4.render && e2.push({ message: `layers.${r2}: missing required method \"render\"` }), t4.renderingMode && \"2d\" !== t4.renderingMode && \"3d\" !== t4.renderingMode && e2.push({ message: `layers.${r2}: property \"renderingMode\" must be either \"2d\" or \"3d\"` }), e2;\n }, t.aE = function t4(e2, r2) {\n if (Array.isArray(e2)) {\n if (!Array.isArray(r2) || e2.length !== r2.length) return false;\n for (let n2 = 0; n2 < e2.length; n2++) if (!t4(e2[n2], r2[n2])) return false;\n return true;\n }\n if (\"object\" == typeof e2 && null !== e2 && null !== r2) {\n if (\"object\" != typeof r2) return false;\n if (Object.keys(e2).length !== Object.keys(r2).length) return false;\n for (const n2 in e2) if (!t4(e2[n2], r2[n2])) return false;\n return true;\n }\n return e2 === r2;\n }, t.aF = v, t.aG = b, t.aH = class extends wa {\n constructor(t4, e2) {\n super(t4, e2), this.current = 0;\n }\n set(t4) {\n this.current !== t4 && (this.current = t4, this.gl.uniform1i(this.location, t4));\n }\n }, t.aI = _a, t.aJ = class extends wa {\n constructor(t4, e2) {\n super(t4, e2), this.current = ka;\n }\n set(t4) {\n if (t4[12] !== this.current[12] || t4[0] !== this.current[0]) return this.current = t4, void this.gl.uniformMatrix4fv(this.location, false, t4);\n for (let e2 = 1; e2 < 16; e2++) if (t4[e2] !== this.current[e2]) {\n this.current = t4, this.gl.uniformMatrix4fv(this.location, false, t4);\n break;\n }\n }\n }, t.aK = Aa, t.aL = Sa, t.aM = Kt, t.aN = class extends wa {\n constructor(t4, e2) {\n super(t4, e2), this.current = [0, 0, 0];\n }\n set(t4) {\n t4[0] === this.current[0] && t4[1] === this.current[1] && t4[2] === this.current[2] || (this.current = t4, this.gl.uniform3f(this.location, t4[0], t4[1], t4[2]));\n }\n }, t.aO = class extends wa {\n constructor(t4, e2) {\n super(t4, e2), this.current = [0, 0];\n }\n set(t4) {\n t4[0] === this.current[0] && t4[1] === this.current[1] || (this.current = t4, this.gl.uniform2f(this.location, t4[0], t4[1]));\n }\n }, t.aP = function(t4, e2, r2, n2, i2, s2, a2) {\n var o2 = 1 / (e2 - r2), l2 = 1 / (n2 - i2), u2 = 1 / (s2 - a2);\n return t4[0] = -2 * o2, t4[1] = 0, t4[2] = 0, t4[3] = 0, t4[4] = 0, t4[5] = -2 * l2, t4[6] = 0, t4[7] = 0, t4[8] = 0, t4[9] = 0, t4[10] = 2 * u2, t4[11] = 0, t4[12] = (e2 + r2) * o2, t4[13] = (i2 + n2) * l2, t4[14] = (a2 + s2) * u2, t4[15] = 1, t4;\n }, t.aQ = ho, t.aR = class extends _s {\n }, t.aS = eu, t.aT = class extends Ss {\n }, t.aU = ko, t.aV = function(t4) {\n return t4 <= 1 ? 1 : Math.pow(2, Math.ceil(Math.log(t4) / Math.LN2));\n }, t.aW = So, t.aX = Zs, t.aY = na, t.aZ = class extends Bs {\n }, t.a_ = function(t4, e2) {\n return t4[0] === e2[0] && t4[1] === e2[1] && t4[2] === e2[2] && t4[3] === e2[3] && t4[4] === e2[4] && t4[5] === e2[5] && t4[6] === e2[6] && t4[7] === e2[7] && t4[8] === e2[8] && t4[9] === e2[9] && t4[10] === e2[10] && t4[11] === e2[11] && t4[12] === e2[12] && t4[13] === e2[13] && t4[14] === e2[14] && t4[15] === e2[15];\n }, t.aa = function(t4) {\n const e2 = {};\n if (t4.replace(/(?:^|(?:\\s*\\,\\s*))([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)(?:\\=(?:([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)|(?:\\\"((?:[^\"\\\\]|\\\\.)*)\\\")))?/g, (t5, r2, n2, i2) => {\n const s2 = n2 || i2;\n return e2[r2] = !s2 || s2.toLowerCase(), \"\";\n }), e2[\"max-age\"]) {\n const t5 = parseInt(e2[\"max-age\"], 10);\n isNaN(t5) ? delete e2[\"max-age\"] : e2[\"max-age\"] = t5;\n }\n return e2;\n }, t.ab = function(t4, e2) {\n const r2 = [];\n for (const n2 in t4) n2 in e2 || r2.push(n2);\n return r2;\n }, t.ac = y, t.ad = function(t4, e2, r2) {\n var n2 = Math.sin(r2), i2 = Math.cos(r2), s2 = e2[0], a2 = e2[1], o2 = e2[2], l2 = e2[3], u2 = e2[4], c2 = e2[5], h2 = e2[6], p2 = e2[7];\n return e2 !== t4 && (t4[8] = e2[8], t4[9] = e2[9], t4[10] = e2[10], t4[11] = e2[11], t4[12] = e2[12], t4[13] = e2[13], t4[14] = e2[14], t4[15] = e2[15]), t4[0] = s2 * i2 + u2 * n2, t4[1] = a2 * i2 + c2 * n2, t4[2] = o2 * i2 + h2 * n2, t4[3] = l2 * i2 + p2 * n2, t4[4] = u2 * i2 - s2 * n2, t4[5] = c2 * i2 - a2 * n2, t4[6] = h2 * i2 - o2 * n2, t4[7] = p2 * i2 - l2 * n2, t4;\n }, t.ae = function(t4) {\n var e2 = new oo(16);\n return e2[0] = t4[0], e2[1] = t4[1], e2[2] = t4[2], e2[3] = t4[3], e2[4] = t4[4], e2[5] = t4[5], e2[6] = t4[6], e2[7] = t4[7], e2[8] = t4[8], e2[9] = t4[9], e2[10] = t4[10], e2[11] = t4[11], e2[12] = t4[12], e2[13] = t4[13], e2[14] = t4[14], e2[15] = t4[15], e2;\n }, t.af = po, t.ag = function(t4, e2) {\n let r2 = 0, n2 = 0;\n if (\"constant\" === t4.kind) n2 = t4.layoutSize;\n else if (\"source\" !== t4.kind) {\n const { interpolationType: i2, minZoom: s2, maxZoom: a2 } = t4, o2 = i2 ? y(Be.interpolationFactor(i2, e2, s2, a2), 0, 1) : 0;\n \"camera\" === t4.kind ? n2 = Ce.number(t4.minSize, t4.maxSize, o2) : r2 = o2;\n }\n return { uSizeT: r2, uSize: n2 };\n }, t.ai = function(t4, { uSize: e2, uSizeT: r2 }, { lowerSize: n2, upperSize: i2 }) {\n return \"source\" === t4.kind ? n2 / nc : \"composite\" === t4.kind ? Ce.number(n2 / nc, i2 / nc, r2) : e2;\n }, t.aj = cc, t.ak = function(t4, e2, r2, n2) {\n const i2 = e2.y - t4.y, a2 = e2.x - t4.x, o2 = n2.y - r2.y, l2 = n2.x - r2.x, u2 = o2 * a2 - l2 * i2;\n if (0 === u2) return null;\n const c2 = (l2 * (t4.y - r2.y) - o2 * (t4.x - r2.x)) / u2;\n return new s(t4.x + c2 * a2, t4.y + c2 * i2);\n }, t.al = Hc, t.am = qa, t.an = lo, t.ao = function(t4) {\n let e2 = 1 / 0, r2 = 1 / 0, n2 = -1 / 0, i2 = -1 / 0;\n for (const s2 of t4) e2 = Math.min(e2, s2.x), r2 = Math.min(r2, s2.y), n2 = Math.max(n2, s2.x), i2 = Math.max(i2, s2.y);\n return [e2, r2, n2, i2];\n }, t.ap = iu, t.ar = ac, t.as = function(t4, e2) {\n var r2 = e2[0], n2 = e2[1], i2 = e2[2], s2 = e2[3], a2 = e2[4], o2 = e2[5], l2 = e2[6], u2 = e2[7], c2 = e2[8], h2 = e2[9], p2 = e2[10], f2 = e2[11], d2 = e2[12], y2 = e2[13], m2 = e2[14], g2 = e2[15], x2 = r2 * o2 - n2 * a2, v2 = r2 * l2 - i2 * a2, b2 = r2 * u2 - s2 * a2, w2 = n2 * l2 - i2 * o2, _2 = n2 * u2 - s2 * o2, A3 = i2 * u2 - s2 * l2, S2 = c2 * y2 - h2 * d2, k2 = c2 * m2 - p2 * d2, M2 = c2 * g2 - f2 * d2, I2 = h2 * m2 - p2 * y2, z2 = h2 * g2 - f2 * y2, P2 = p2 * g2 - f2 * m2, C3 = x2 * P2 - v2 * z2 + b2 * I2 + w2 * M2 - _2 * k2 + A3 * S2;\n return C3 ? (t4[0] = (o2 * P2 - l2 * z2 + u2 * I2) * (C3 = 1 / C3), t4[1] = (i2 * z2 - n2 * P2 - s2 * I2) * C3, t4[2] = (y2 * A3 - m2 * _2 + g2 * w2) * C3, t4[3] = (p2 * _2 - h2 * A3 - f2 * w2) * C3, t4[4] = (l2 * M2 - a2 * P2 - u2 * k2) * C3, t4[5] = (r2 * P2 - i2 * M2 + s2 * k2) * C3, t4[6] = (m2 * b2 - d2 * A3 - g2 * v2) * C3, t4[7] = (c2 * A3 - p2 * b2 + f2 * v2) * C3, t4[8] = (a2 * z2 - o2 * M2 + u2 * S2) * C3, t4[9] = (n2 * M2 - r2 * z2 - s2 * S2) * C3, t4[10] = (d2 * _2 - y2 * b2 + g2 * x2) * C3, t4[11] = (h2 * b2 - c2 * _2 - f2 * x2) * C3, t4[12] = (o2 * k2 - a2 * I2 - l2 * S2) * C3, t4[13] = (r2 * I2 - n2 * k2 + i2 * S2) * C3, t4[14] = (y2 * v2 - d2 * w2 - m2 * x2) * C3, t4[15] = (c2 * w2 - h2 * v2 + p2 * x2) * C3, t4) : null;\n }, t.at = bh, t.au = Ju, t.av = Mh, t.aw = function() {\n const t4 = {}, e2 = G.$version;\n for (const r2 in G.$root) {\n const n2 = G.$root[r2];\n if (n2.required) {\n let i2 = null;\n i2 = \"version\" === r2 ? e2 : \"array\" === n2.type ? [] : {}, null != i2 && (t4[r2] = i2);\n }\n }\n return t4;\n }, t.ax = Ii, t.ay = D2, t.az = function(t4) {\n t4 = t4.slice();\n const e2 = /* @__PURE__ */ Object.create(null);\n for (let r2 = 0; r2 < t4.length; r2++) e2[t4[r2].id] = t4[r2];\n for (let r2 = 0; r2 < t4.length; r2++) \"ref\" in t4[r2] && (t4[r2] = X(t4[r2], e2[t4[r2].ref]));\n return t4;\n }, t.b = I, t.b0 = function(t4, e2) {\n return t4[0] = e2[0], t4[1] = e2[1], t4[2] = e2[2], t4[3] = e2[3], t4[4] = e2[4], t4[5] = e2[5], t4[6] = e2[6], t4[7] = e2[7], t4[8] = e2[8], t4[9] = e2[9], t4[10] = e2[10], t4[11] = e2[11], t4[12] = e2[12], t4[13] = e2[13], t4[14] = e2[14], t4[15] = e2[15], t4;\n }, t.b1 = function(t4, e2, r2) {\n return t4[0] = e2[0] * r2[0], t4[1] = e2[1] * r2[1], t4[2] = e2[2] * r2[2], t4[3] = e2[3] * r2[3], t4;\n }, t.b2 = function(t4, e2) {\n return t4[0] * e2[0] + t4[1] * e2[1] + t4[2] * e2[2] + t4[3] * e2[3];\n }, t.b3 = m, t.b4 = Oc, t.b5 = Fc, t.b6 = function(t4, e2, r2, n2, i2) {\n var s2, a2 = 1 / Math.tan(e2 / 2);\n return t4[0] = a2 / r2, t4[1] = 0, t4[2] = 0, t4[3] = 0, t4[4] = 0, t4[5] = a2, t4[6] = 0, t4[7] = 0, t4[8] = 0, t4[9] = 0, t4[11] = -1, t4[12] = 0, t4[13] = 0, t4[15] = 0, null != i2 && i2 !== 1 / 0 ? (t4[10] = (i2 + n2) * (s2 = 1 / (n2 - i2)), t4[14] = 2 * i2 * n2 * s2) : (t4[10] = -1, t4[14] = -2 * n2), t4;\n }, t.b7 = function(t4, e2, r2) {\n var n2 = Math.sin(r2), i2 = Math.cos(r2), s2 = e2[4], a2 = e2[5], o2 = e2[6], l2 = e2[7], u2 = e2[8], c2 = e2[9], h2 = e2[10], p2 = e2[11];\n return e2 !== t4 && (t4[0] = e2[0], t4[1] = e2[1], t4[2] = e2[2], t4[3] = e2[3], t4[12] = e2[12], t4[13] = e2[13], t4[14] = e2[14], t4[15] = e2[15]), t4[4] = s2 * i2 + u2 * n2, t4[5] = a2 * i2 + c2 * n2, t4[6] = o2 * i2 + h2 * n2, t4[7] = l2 * i2 + p2 * n2, t4[8] = u2 * i2 - s2 * n2, t4[9] = c2 * i2 - a2 * n2, t4[10] = h2 * i2 - o2 * n2, t4[11] = p2 * i2 - l2 * n2, t4;\n }, t.b8 = f, t.b9 = d, t.bA = su, t.bB = function(t4) {\n return t4.message === V;\n }, t.bC = bn, t.bD = Ri, t.ba = function(t4) {\n return t4 * Math.PI / 180;\n }, t.bb = function(t4, e2) {\n const { x: r2, y: n2 } = $c.fromLngLat(e2);\n return !(t4 < 0 || t4 > 25 || n2 < 0 || n2 >= 1 || r2 < 0 || r2 >= 1);\n }, t.bc = function(t4, e2) {\n return t4[0] = e2[0], t4[1] = 0, t4[2] = 0, t4[3] = 0, t4[4] = 0, t4[5] = e2[1], t4[6] = 0, t4[7] = 0, t4[8] = 0, t4[9] = 0, t4[10] = e2[2], t4[11] = 0, t4[12] = 0, t4[13] = 0, t4[14] = 0, t4[15] = 1, t4;\n }, t.bd = class extends hs {\n }, t.be = zc, t.bf = Dh, t.bh = L, t.bi = function(t4, e2) {\n F.REGISTERED_PROTOCOLS[t4] = e2;\n }, t.bj = function(t4) {\n delete F.REGISTERED_PROTOCOLS[t4];\n }, t.bk = function(t4, e2) {\n const r2 = {};\n for (let n3 = 0; n3 < t4.length; n3++) {\n const i2 = e2 && e2[t4[n3].id] || Ln(t4[n3]);\n e2 && (e2[t4[n3].id] = i2);\n let s2 = r2[i2];\n s2 || (s2 = r2[i2] = []), s2.push(t4[n3]);\n }\n const n2 = [];\n for (const t5 in r2) n2.push(r2[t5]);\n return n2;\n }, t.bl = wi, t.bm = qc, t.bn = Zc, t.bo = $u, t.bp = function(e2) {\n e2.bucket.createArrays(), e2.bucket.tilePixelRatio = $a / (512 * e2.bucket.overscaling), e2.bucket.compareText = {}, e2.bucket.iconsNeedLinear = false;\n const r2 = e2.bucket.layers[0], n2 = r2.layout, i2 = r2._unevaluatedLayout._values, s2 = { layoutIconSize: i2[\"icon-size\"].possiblyEvaluate(new Ui(e2.bucket.zoom + 1), e2.canonical), layoutTextSize: i2[\"text-size\"].possiblyEvaluate(new Ui(e2.bucket.zoom + 1), e2.canonical), textMaxSize: i2[\"text-size\"].possiblyEvaluate(new Ui(18)) };\n if (\"composite\" === e2.bucket.textSizeData.kind) {\n const { minZoom: t4, maxZoom: r3 } = e2.bucket.textSizeData;\n s2.compositeTextSizes = [i2[\"text-size\"].possiblyEvaluate(new Ui(t4), e2.canonical), i2[\"text-size\"].possiblyEvaluate(new Ui(r3), e2.canonical)];\n }\n if (\"composite\" === e2.bucket.iconSizeData.kind) {\n const { minZoom: t4, maxZoom: r3 } = e2.bucket.iconSizeData;\n s2.compositeIconSizes = [i2[\"icon-size\"].possiblyEvaluate(new Ui(t4), e2.canonical), i2[\"icon-size\"].possiblyEvaluate(new Ui(r3), e2.canonical)];\n }\n const a2 = n2.get(\"text-line-height\") * iu, o2 = \"viewport\" !== n2.get(\"text-rotation-alignment\") && \"point\" !== n2.get(\"symbol-placement\"), l2 = n2.get(\"text-keep-upright\"), u2 = n2.get(\"text-size\");\n for (const i3 of e2.bucket.features) {\n const c2 = n2.get(\"text-font\").evaluate(i3, {}, e2.canonical).join(\",\"), h2 = u2.evaluate(i3, {}, e2.canonical), p2 = s2.layoutTextSize.evaluate(i3, {}, e2.canonical), f2 = s2.layoutIconSize.evaluate(i3, {}, e2.canonical), d2 = { horizontal: {}, vertical: void 0 }, y2 = i3.text;\n let m2, g2 = [0, 0];\n if (y2) {\n const s3 = y2.toString(), u3 = n2.get(\"text-letter-spacing\").evaluate(i3, {}, e2.canonical) * iu, f3 = Ci(s3) ? u3 : 0, m3 = n2.get(\"text-anchor\").evaluate(i3, {}, e2.canonical), x3 = vh(r2, i3, e2.canonical);\n if (!x3) {\n const t4 = n2.get(\"text-radial-offset\").evaluate(i3, {}, e2.canonical);\n g2 = t4 ? xh(m3, [t4 * iu, gh]) : n2.get(\"text-offset\").evaluate(i3, {}, e2.canonical).map((t5) => t5 * iu);\n }\n let v3 = o2 ? \"center\" : n2.get(\"text-justify\").evaluate(i3, {}, e2.canonical);\n const b2 = \"point\" === n2.get(\"symbol-placement\") ? n2.get(\"text-max-width\").evaluate(i3, {}, e2.canonical) * iu : 1 / 0, w2 = () => {\n e2.bucket.allowVerticalPlacement && Pi(s3) && (d2.vertical = Ru(y2, e2.glyphMap, e2.glyphPositions, e2.imagePositions, c2, b2, a2, m3, \"left\", f3, g2, t.ah.vertical, true, p2, h2));\n };\n if (!o2 && x3) {\n const r3 = /* @__PURE__ */ new Set();\n if (\"auto\" === v3) for (let t4 = 0; t4 < x3.values.length; t4 += 2) r3.add(bh(x3.values[t4]));\n else r3.add(v3);\n let n3 = false;\n for (const i4 of r3) if (!d2.horizontal[i4]) if (n3) d2.horizontal[i4] = d2.horizontal[0];\n else {\n const r4 = Ru(y2, e2.glyphMap, e2.glyphPositions, e2.imagePositions, c2, b2, a2, \"center\", i4, f3, g2, t.ah.horizontal, false, p2, h2);\n r4 && (d2.horizontal[i4] = r4, n3 = 1 === r4.positionedLines.length);\n }\n w2();\n } else {\n \"auto\" === v3 && (v3 = bh(m3));\n const r3 = Ru(y2, e2.glyphMap, e2.glyphPositions, e2.imagePositions, c2, b2, a2, m3, v3, f3, g2, t.ah.horizontal, false, p2, h2);\n r3 && (d2.horizontal[v3] = r3), w2(), Pi(s3) && o2 && l2 && (d2.vertical = Ru(y2, e2.glyphMap, e2.glyphPositions, e2.imagePositions, c2, b2, a2, m3, v3, f3, g2, t.ah.vertical, false, p2, h2));\n }\n }\n let x2 = false;\n if (i3.icon && i3.icon.name) {\n const t4 = e2.imageMap[i3.icon.name];\n t4 && (m2 = Qu(e2.imagePositions[i3.icon.name], n2.get(\"icon-offset\").evaluate(i3, {}, e2.canonical), n2.get(\"icon-anchor\").evaluate(i3, {}, e2.canonical)), x2 = !!t4.sdf, void 0 === e2.bucket.sdfIcons ? e2.bucket.sdfIcons = x2 : e2.bucket.sdfIcons !== x2 && A2(\"Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer\"), (t4.pixelRatio !== e2.bucket.pixelRatio || 0 !== n2.get(\"icon-rotate\").constantOr(1)) && (e2.bucket.iconsNeedLinear = true));\n }\n const v2 = Ah(d2.horizontal) || d2.vertical;\n e2.bucket.iconsInText = !!v2 && v2.iconsInText, (v2 || m2) && wh(e2.bucket, i3, d2, m2, e2.imageMap, s2, p2, f2, g2, x2, e2.canonical);\n }\n e2.showCollisionBoxes && e2.bucket.generateCollisionDebugBuffers();\n }, t.bq = ql, t.br = sl, t.bs = zl, t.bt = fl, t.bu = Iu, t.bv = class {\n constructor(t4) {\n this._marks = { start: [t4.url, \"start\"].join(\"#\"), end: [t4.url, \"end\"].join(\"#\"), measure: t4.url.toString() }, performance.mark(this._marks.start);\n }\n finish() {\n performance.mark(this._marks.end);\n let t4 = performance.getEntriesByName(this._marks.measure);\n return 0 === t4.length && (performance.measure(this._marks.measure, this._marks.start, this._marks.end), t4 = performance.getEntriesByName(this._marks.measure), performance.clearMarks(this._marks.start), performance.clearMarks(this._marks.end), performance.clearMeasures(this._marks.measure)), t4;\n }\n }, t.bw = function(t4, r2, n2, i2, s2) {\n return e(this, void 0, void 0, function* () {\n if (p()) try {\n return yield P(t4, r2, n2, i2, s2);\n } catch (t5) {\n }\n return function(t5, e2, r3, n3, i3) {\n const s3 = t5.width, a2 = t5.height;\n C2 && B2 || (C2 = new OffscreenCanvas(s3, a2), B2 = C2.getContext(\"2d\", { willReadFrequently: true })), C2.width = s3, C2.height = a2, B2.drawImage(t5, 0, 0, s3, a2);\n const o2 = B2.getImageData(e2, r3, n3, i3);\n return B2.clearRect(0, 0, s3, a2), o2.data;\n }(t4, r2, n2, i2, s2);\n });\n }, t.bx = Uc, t.by = r, t.bz = n, t.c = E2, t.d = (t4) => e(void 0, void 0, void 0, function* () {\n if (0 === t4.byteLength) return createImageBitmap(new ImageData(1, 1));\n const e2 = new Blob([new Uint8Array(t4)], { type: \"image/png\" });\n try {\n return createImageBitmap(e2);\n } catch (t5) {\n throw new Error(`Could not load image because of ${t5.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`);\n }\n }), t.e = g, t.f = (t4) => new Promise((e2, r2) => {\n const n2 = new Image();\n n2.onload = () => {\n e2(n2), URL.revokeObjectURL(n2.src), n2.onload = null, window.requestAnimationFrame(() => {\n n2.src = z;\n });\n }, n2.onerror = () => r2(new Error(\"Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.\"));\n const i2 = new Blob([new Uint8Array(t4)], { type: \"image/png\" });\n n2.src = t4.byteLength ? URL.createObjectURL(i2) : z;\n }), t.g = T, t.h = (t4, e2) => O(g(t4, { type: \"json\" }), e2), t.i = k, t.j = N, t.k = q, t.l = (t4, e2) => O(g(t4, { type: \"arrayBuffer\" }), e2), t.m = O, t.n = function(t4) {\n return new Iu(t4).readFields(Pu, []);\n }, t.o = _o, t.p = Eu, t.q = rs, t.r = di, t.s = j, t.t = xi, t.u = fi, t.v = G, t.w = A2, t.x = function([t4, e2, r2]) {\n return e2 += 90, e2 *= Math.PI / 180, r2 *= Math.PI / 180, { x: t4 * Math.cos(e2) * Math.sin(r2), y: t4 * Math.sin(e2) * Math.sin(r2), z: t4 * Math.cos(r2) };\n }, t.y = Ce, t.z = Ui;\n });\n define2(\"worker\", [\"./shared\"], function(e) {\n \"use strict\";\n class t {\n constructor(e2) {\n this.keyCache = {}, e2 && this.replace(e2);\n }\n replace(e2) {\n this._layerConfigs = {}, this._layers = {}, this.update(e2, []);\n }\n update(t4, o2) {\n for (const o3 of t4) {\n this._layerConfigs[o3.id] = o3;\n const t5 = this._layers[o3.id] = e.aA(o3);\n t5._featureFilter = e.a7(t5.filter), this.keyCache[o3.id] && delete this.keyCache[o3.id];\n }\n for (const e2 of o2) delete this.keyCache[e2], delete this._layerConfigs[e2], delete this._layers[e2];\n this.familiesBySource = {};\n const i2 = e.bk(Object.values(this._layerConfigs), this.keyCache);\n for (const e2 of i2) {\n const t5 = e2.map((e3) => this._layers[e3.id]), o3 = t5[0];\n if (\"none\" === o3.visibility) continue;\n const i3 = o3.source || \"\";\n let s2 = this.familiesBySource[i3];\n s2 || (s2 = this.familiesBySource[i3] = {});\n const r2 = o3.sourceLayer || \"_geojsonTileLayer\";\n let n2 = s2[r2];\n n2 || (n2 = s2[r2] = []), n2.push(t5);\n }\n }\n }\n class o {\n constructor(t4) {\n const o2 = {}, i2 = [];\n for (const e2 in t4) {\n const s3 = t4[e2], r3 = o2[e2] = {};\n for (const e3 in s3) {\n const t5 = s3[+e3];\n if (!t5 || 0 === t5.bitmap.width || 0 === t5.bitmap.height) continue;\n const o3 = { x: 0, y: 0, w: t5.bitmap.width + 2, h: t5.bitmap.height + 2 };\n i2.push(o3), r3[e3] = { rect: o3, metrics: t5.metrics };\n }\n }\n const { w: s2, h: r2 } = e.p(i2), n2 = new e.o({ width: s2 || 1, height: r2 || 1 });\n for (const i3 in t4) {\n const s3 = t4[i3];\n for (const t5 in s3) {\n const r3 = s3[+t5];\n if (!r3 || 0 === r3.bitmap.width || 0 === r3.bitmap.height) continue;\n const a2 = o2[i3][t5].rect;\n e.o.copy(r3.bitmap, n2, { x: 0, y: 0 }, { x: a2.x + 1, y: a2.y + 1 }, r3.bitmap);\n }\n }\n this.image = n2, this.positions = o2;\n }\n }\n e.bl(\"GlyphAtlas\", o);\n class i {\n constructor(t4) {\n this.tileID = new e.S(t4.tileID.overscaledZ, t4.tileID.wrap, t4.tileID.canonical.z, t4.tileID.canonical.x, t4.tileID.canonical.y), this.uid = t4.uid, this.zoom = t4.zoom, this.pixelRatio = t4.pixelRatio, this.tileSize = t4.tileSize, this.source = t4.source, this.overscaling = this.tileID.overscaleFactor(), this.showCollisionBoxes = t4.showCollisionBoxes, this.collectResourceTiming = !!t4.collectResourceTiming, this.returnDependencies = !!t4.returnDependencies, this.promoteId = t4.promoteId, this.inFlightDependencies = [];\n }\n parse(t4, i2, r2, n2) {\n return e._(this, void 0, void 0, function* () {\n this.status = \"parsing\", this.data = t4, this.collisionBoxArray = new e.a5();\n const a2 = new e.bm(Object.keys(t4.layers).sort()), l2 = new e.bn(this.tileID, this.promoteId);\n l2.bucketLayerIDs = [];\n const c2 = {}, u2 = { featureIndex: l2, iconDependencies: {}, patternDependencies: {}, glyphDependencies: {}, availableImages: r2 }, h2 = i2.familiesBySource[this.source];\n for (const o2 in h2) {\n const i3 = t4.layers[o2];\n if (!i3) continue;\n 1 === i3.version && e.w(`Vector tile source \"${this.source}\" layer \"${o2}\" does not use vector tile spec v2 and therefore may have some rendering errors.`);\n const n3 = a2.encode(o2), d3 = [];\n for (let e2 = 0; e2 < i3.length; e2++) {\n const t5 = i3.feature(e2), s2 = l2.getId(t5, o2);\n d3.push({ feature: t5, id: s2, index: e2, sourceLayerIndex: n3 });\n }\n for (const t5 of h2[o2]) {\n const o3 = t5[0];\n o3.source !== this.source && e.w(`layer.source = ${o3.source} does not equal this.source = ${this.source}`), o3.minzoom && this.zoom < Math.floor(o3.minzoom) || o3.maxzoom && this.zoom >= o3.maxzoom || \"none\" !== o3.visibility && (s(t5, this.zoom, r2), (c2[o3.id] = o3.createBucket({ index: l2.bucketLayerIDs.length, layers: t5, zoom: this.zoom, pixelRatio: this.pixelRatio, overscaling: this.overscaling, collisionBoxArray: this.collisionBoxArray, sourceLayerIndex: n3, sourceID: this.source })).populate(d3, u2, this.tileID.canonical), l2.bucketLayerIDs.push(t5.map((e2) => e2.id)));\n }\n }\n const d2 = e.aF(u2.glyphDependencies, (e2) => Object.keys(e2).map(Number));\n this.inFlightDependencies.forEach((e2) => null == e2 ? void 0 : e2.abort()), this.inFlightDependencies = [];\n let f2 = Promise.resolve({});\n if (Object.keys(d2).length) {\n const e2 = new AbortController();\n this.inFlightDependencies.push(e2), f2 = n2.sendAsync({ type: \"GG\", data: { stacks: d2, source: this.source, tileID: this.tileID, type: \"glyphs\" } }, e2);\n }\n const g2 = Object.keys(u2.iconDependencies);\n let p2 = Promise.resolve({});\n if (g2.length) {\n const e2 = new AbortController();\n this.inFlightDependencies.push(e2), p2 = n2.sendAsync({ type: \"GI\", data: { icons: g2, source: this.source, tileID: this.tileID, type: \"icons\" } }, e2);\n }\n const m2 = Object.keys(u2.patternDependencies);\n let y2 = Promise.resolve({});\n if (m2.length) {\n const e2 = new AbortController();\n this.inFlightDependencies.push(e2), y2 = n2.sendAsync({ type: \"GI\", data: { icons: m2, source: this.source, tileID: this.tileID, type: \"patterns\" } }, e2);\n }\n const [v2, w2, x2] = yield Promise.all([f2, p2, y2]), b2 = new o(v2), S2 = new e.bo(w2, x2);\n for (const t5 in c2) {\n const o2 = c2[t5];\n o2 instanceof e.a6 ? (s(o2.layers, this.zoom, r2), e.bp({ bucket: o2, glyphMap: v2, glyphPositions: b2.positions, imageMap: w2, imagePositions: S2.iconPositions, showCollisionBoxes: this.showCollisionBoxes, canonical: this.tileID.canonical })) : o2.hasPattern && (o2 instanceof e.bq || o2 instanceof e.br || o2 instanceof e.bs) && (s(o2.layers, this.zoom, r2), o2.addFeatures(u2, this.tileID.canonical, S2.patternPositions));\n }\n return this.status = \"done\", { buckets: Object.values(c2).filter((e2) => !e2.isEmpty()), featureIndex: l2, collisionBoxArray: this.collisionBoxArray, glyphAtlasImage: b2.image, imageAtlas: S2, glyphMap: this.returnDependencies ? v2 : null, iconMap: this.returnDependencies ? w2 : null, glyphPositions: this.returnDependencies ? b2.positions : null };\n });\n }\n }\n function s(t4, o2, i2) {\n const s2 = new e.z(o2);\n for (const e2 of t4) e2.recalculate(s2, i2);\n }\n class r {\n constructor(e2, t4, o2) {\n this.actor = e2, this.layerIndex = t4, this.availableImages = o2, this.fetching = {}, this.loading = {}, this.loaded = {};\n }\n loadVectorTile(t4, o2) {\n return e._(this, void 0, void 0, function* () {\n const i2 = yield e.l(t4.request, o2);\n try {\n return { vectorTile: new e.bt.VectorTile(new e.bu(i2.data)), rawData: i2.data, cacheControl: i2.cacheControl, expires: i2.expires };\n } catch (e2) {\n const o3 = new Uint8Array(i2.data);\n let s2 = `Unable to parse the tile at ${t4.request.url}, `;\n throw s2 += 31 === o3[0] && 139 === o3[1] ? \"please make sure the data is not gzipped and that you have configured the relevant header in the server\" : `got error: ${e2.message}`, new Error(s2);\n }\n });\n }\n loadTile(t4) {\n return e._(this, void 0, void 0, function* () {\n const o2 = t4.uid, s2 = !!(t4 && t4.request && t4.request.collectResourceTiming) && new e.bv(t4.request), r2 = new i(t4);\n this.loading[o2] = r2;\n const n2 = new AbortController();\n r2.abort = n2;\n try {\n const i2 = yield this.loadVectorTile(t4, n2);\n if (delete this.loading[o2], !i2) return null;\n const a2 = i2.rawData, l2 = {};\n i2.expires && (l2.expires = i2.expires), i2.cacheControl && (l2.cacheControl = i2.cacheControl);\n const c2 = {};\n if (s2) {\n const e2 = s2.finish();\n e2 && (c2.resourceTiming = JSON.parse(JSON.stringify(e2)));\n }\n r2.vectorTile = i2.vectorTile;\n const u2 = r2.parse(i2.vectorTile, this.layerIndex, this.availableImages, this.actor);\n this.loaded[o2] = r2, this.fetching[o2] = { rawTileData: a2, cacheControl: l2, resourceTiming: c2 };\n try {\n const t5 = yield u2;\n return e.e({ rawTileData: a2.slice(0) }, t5, l2, c2);\n } finally {\n delete this.fetching[o2];\n }\n } catch (e2) {\n throw delete this.loading[o2], r2.status = \"done\", this.loaded[o2] = r2, e2;\n }\n });\n }\n reloadTile(t4) {\n return e._(this, void 0, void 0, function* () {\n const o2 = t4.uid;\n if (!this.loaded || !this.loaded[o2]) throw new Error(\"Should not be trying to reload a tile that was never loaded or has been removed\");\n const i2 = this.loaded[o2];\n if (i2.showCollisionBoxes = t4.showCollisionBoxes, \"parsing\" === i2.status) {\n const t5 = yield i2.parse(i2.vectorTile, this.layerIndex, this.availableImages, this.actor);\n let s2;\n if (this.fetching[o2]) {\n const { rawTileData: i3, cacheControl: r2, resourceTiming: n2 } = this.fetching[o2];\n delete this.fetching[o2], s2 = e.e({ rawTileData: i3.slice(0) }, t5, r2, n2);\n } else s2 = t5;\n return s2;\n }\n if (\"done\" === i2.status && i2.vectorTile) return i2.parse(i2.vectorTile, this.layerIndex, this.availableImages, this.actor);\n });\n }\n abortTile(t4) {\n return e._(this, void 0, void 0, function* () {\n const e2 = this.loading, o2 = t4.uid;\n e2 && e2[o2] && e2[o2].abort && (e2[o2].abort.abort(), delete e2[o2]);\n });\n }\n removeTile(t4) {\n return e._(this, void 0, void 0, function* () {\n this.loaded && this.loaded[t4.uid] && delete this.loaded[t4.uid];\n });\n }\n }\n class n {\n constructor() {\n this.loaded = {};\n }\n loadTile(t4) {\n return e._(this, void 0, void 0, function* () {\n const { uid: o2, encoding: i2, rawImageData: s2, redFactor: r2, greenFactor: n2, blueFactor: a2, baseShift: l2 } = t4, c2 = s2.width + 2, u2 = s2.height + 2, h2 = e.b(s2) ? new e.R({ width: c2, height: u2 }, yield e.bw(s2, -1, -1, c2, u2)) : s2, d2 = new e.bx(o2, h2, i2, r2, n2, a2, l2);\n return this.loaded = this.loaded || {}, this.loaded[o2] = d2, d2;\n });\n }\n removeTile(e2) {\n const t4 = this.loaded, o2 = e2.uid;\n t4 && t4[o2] && delete t4[o2];\n }\n }\n function a(e2, t4) {\n if (0 !== e2.length) {\n l(e2[0], t4);\n for (var o2 = 1; o2 < e2.length; o2++) l(e2[o2], !t4);\n }\n }\n function l(e2, t4) {\n for (var o2 = 0, i2 = 0, s2 = 0, r2 = e2.length, n2 = r2 - 1; s2 < r2; n2 = s2++) {\n var a2 = (e2[s2][0] - e2[n2][0]) * (e2[n2][1] + e2[s2][1]), l2 = o2 + a2;\n i2 += Math.abs(o2) >= Math.abs(a2) ? o2 - l2 + a2 : a2 - l2 + o2, o2 = l2;\n }\n o2 + i2 >= 0 != !!t4 && e2.reverse();\n }\n var c = e.by(function e2(t4, o2) {\n var i2, s2 = t4 && t4.type;\n if (\"FeatureCollection\" === s2) for (i2 = 0; i2 < t4.features.length; i2++) e2(t4.features[i2], o2);\n else if (\"GeometryCollection\" === s2) for (i2 = 0; i2 < t4.geometries.length; i2++) e2(t4.geometries[i2], o2);\n else if (\"Feature\" === s2) e2(t4.geometry, o2);\n else if (\"Polygon\" === s2) a(t4.coordinates, o2);\n else if (\"MultiPolygon\" === s2) for (i2 = 0; i2 < t4.coordinates.length; i2++) a(t4.coordinates[i2], o2);\n return t4;\n });\n const u = e.bt.VectorTileFeature.prototype.toGeoJSON;\n var h = { exports: {} }, d = e.bz, f = e.bt.VectorTileFeature, g = p;\n function p(e2, t4) {\n this.options = t4 || {}, this.features = e2, this.length = e2.length;\n }\n function m(e2, t4) {\n this.id = \"number\" == typeof e2.id ? e2.id : void 0, this.type = e2.type, this.rawGeometry = 1 === e2.type ? [e2.geometry] : e2.geometry, this.properties = e2.tags, this.extent = t4 || 4096;\n }\n p.prototype.feature = function(e2) {\n return new m(this.features[e2], this.options.extent);\n }, m.prototype.loadGeometry = function() {\n var e2 = this.rawGeometry;\n this.geometry = [];\n for (var t4 = 0; t4 < e2.length; t4++) {\n for (var o2 = e2[t4], i2 = [], s2 = 0; s2 < o2.length; s2++) i2.push(new d(o2[s2][0], o2[s2][1]));\n this.geometry.push(i2);\n }\n return this.geometry;\n }, m.prototype.bbox = function() {\n this.geometry || this.loadGeometry();\n for (var e2 = this.geometry, t4 = 1 / 0, o2 = -1 / 0, i2 = 1 / 0, s2 = -1 / 0, r2 = 0; r2 < e2.length; r2++) for (var n2 = e2[r2], a2 = 0; a2 < n2.length; a2++) {\n var l2 = n2[a2];\n t4 = Math.min(t4, l2.x), o2 = Math.max(o2, l2.x), i2 = Math.min(i2, l2.y), s2 = Math.max(s2, l2.y);\n }\n return [t4, i2, o2, s2];\n }, m.prototype.toGeoJSON = f.prototype.toGeoJSON;\n var y = e.bA, v = g;\n function w(e2) {\n var t4 = new y();\n return function(e3, t5) {\n for (var o2 in e3.layers) t5.writeMessage(3, x, e3.layers[o2]);\n }(e2, t4), t4.finish();\n }\n function x(e2, t4) {\n var o2;\n t4.writeVarintField(15, e2.version || 1), t4.writeStringField(1, e2.name || \"\"), t4.writeVarintField(5, e2.extent || 4096);\n var i2 = { keys: [], values: [], keycache: {}, valuecache: {} };\n for (o2 = 0; o2 < e2.length; o2++) i2.feature = e2.feature(o2), t4.writeMessage(2, b, i2);\n var s2 = i2.keys;\n for (o2 = 0; o2 < s2.length; o2++) t4.writeStringField(3, s2[o2]);\n var r2 = i2.values;\n for (o2 = 0; o2 < r2.length; o2++) t4.writeMessage(4, P, r2[o2]);\n }\n function b(e2, t4) {\n var o2 = e2.feature;\n void 0 !== o2.id && t4.writeVarintField(1, o2.id), t4.writeMessage(2, S, e2), t4.writeVarintField(3, o2.type), t4.writeMessage(4, I, o2);\n }\n function S(e2, t4) {\n var o2 = e2.feature, i2 = e2.keys, s2 = e2.values, r2 = e2.keycache, n2 = e2.valuecache;\n for (var a2 in o2.properties) {\n var l2 = o2.properties[a2], c2 = r2[a2];\n if (null !== l2) {\n void 0 === c2 && (i2.push(a2), r2[a2] = c2 = i2.length - 1), t4.writeVarint(c2);\n var u2 = typeof l2;\n \"string\" !== u2 && \"boolean\" !== u2 && \"number\" !== u2 && (l2 = JSON.stringify(l2));\n var h2 = u2 + \":\" + l2, d2 = n2[h2];\n void 0 === d2 && (s2.push(l2), n2[h2] = d2 = s2.length - 1), t4.writeVarint(d2);\n }\n }\n }\n function _(e2, t4) {\n return (t4 << 3) + (7 & e2);\n }\n function M(e2) {\n return e2 << 1 ^ e2 >> 31;\n }\n function I(e2, t4) {\n for (var o2 = e2.loadGeometry(), i2 = e2.type, s2 = 0, r2 = 0, n2 = o2.length, a2 = 0; a2 < n2; a2++) {\n var l2 = o2[a2], c2 = 1;\n 1 === i2 && (c2 = l2.length), t4.writeVarint(_(1, c2));\n for (var u2 = 3 === i2 ? l2.length - 1 : l2.length, h2 = 0; h2 < u2; h2++) {\n 1 === h2 && 1 !== i2 && t4.writeVarint(_(2, u2 - 1));\n var d2 = l2[h2].x - s2, f2 = l2[h2].y - r2;\n t4.writeVarint(M(d2)), t4.writeVarint(M(f2)), s2 += d2, r2 += f2;\n }\n 3 === i2 && t4.writeVarint(_(7, 1));\n }\n }\n function P(e2, t4) {\n var o2 = typeof e2;\n \"string\" === o2 ? t4.writeStringField(1, e2) : \"boolean\" === o2 ? t4.writeBooleanField(7, e2) : \"number\" === o2 && (e2 % 1 != 0 ? t4.writeDoubleField(3, e2) : e2 < 0 ? t4.writeSVarintField(6, e2) : t4.writeVarintField(5, e2));\n }\n h.exports = w, h.exports.fromVectorTileJs = w, h.exports.fromGeojsonVt = function(e2, t4) {\n t4 = t4 || {};\n var o2 = {};\n for (var i2 in e2) o2[i2] = new v(e2[i2].features, t4), o2[i2].name = i2, o2[i2].version = t4.version, o2[i2].extent = t4.extent;\n return w({ layers: o2 });\n }, h.exports.GeoJSONWrapper = v;\n var k = e.by(h.exports);\n const T = { minZoom: 0, maxZoom: 16, minPoints: 2, radius: 40, extent: 512, nodeSize: 64, log: false, generateId: false, reduce: null, map: (e2) => e2 }, D2 = Math.fround || (C2 = new Float32Array(1), (e2) => (C2[0] = +e2, C2[0]));\n var C2;\n const L = 3, O = 5, F = 6;\n class z {\n constructor(e2) {\n this.options = Object.assign(Object.create(T), e2), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = [];\n }\n load(e2) {\n const { log: t4, minZoom: o2, maxZoom: i2 } = this.options;\n t4 && console.time(\"total time\");\n const s2 = `prepare ${e2.length} points`;\n t4 && console.time(s2), this.points = e2;\n const r2 = [];\n for (let t5 = 0; t5 < e2.length; t5++) {\n const o3 = e2[t5];\n if (!o3.geometry) continue;\n const [i3, s3] = o3.geometry.coordinates, n3 = D2(G(i3)), a2 = D2(j(s3));\n r2.push(n3, a2, 1 / 0, t5, -1, 1), this.options.reduce && r2.push(0);\n }\n let n2 = this.trees[i2 + 1] = this._createTree(r2);\n t4 && console.timeEnd(s2);\n for (let e3 = i2; e3 >= o2; e3--) {\n const o3 = +Date.now();\n n2 = this.trees[e3] = this._createTree(this._cluster(n2, e3)), t4 && console.log(\"z%d: %d clusters in %dms\", e3, n2.numItems, +Date.now() - o3);\n }\n return t4 && console.timeEnd(\"total time\"), this;\n }\n getClusters(e2, t4) {\n let o2 = ((e2[0] + 180) % 360 + 360) % 360 - 180;\n const i2 = Math.max(-90, Math.min(90, e2[1]));\n let s2 = 180 === e2[2] ? 180 : ((e2[2] + 180) % 360 + 360) % 360 - 180;\n const r2 = Math.max(-90, Math.min(90, e2[3]));\n if (e2[2] - e2[0] >= 360) o2 = -180, s2 = 180;\n else if (o2 > s2) {\n const e3 = this.getClusters([o2, i2, 180, r2], t4), n3 = this.getClusters([-180, i2, s2, r2], t4);\n return e3.concat(n3);\n }\n const n2 = this.trees[this._limitZoom(t4)], a2 = n2.range(G(o2), j(r2), G(s2), j(i2)), l2 = n2.data, c2 = [];\n for (const e3 of a2) {\n const t5 = this.stride * e3;\n c2.push(l2[t5 + O] > 1 ? A2(l2, t5, this.clusterProps) : this.points[l2[t5 + L]]);\n }\n return c2;\n }\n getChildren(e2) {\n const t4 = this._getOriginId(e2), o2 = this._getOriginZoom(e2), i2 = \"No cluster with the specified id.\", s2 = this.trees[o2];\n if (!s2) throw new Error(i2);\n const r2 = s2.data;\n if (t4 * this.stride >= r2.length) throw new Error(i2);\n const n2 = this.options.radius / (this.options.extent * Math.pow(2, o2 - 1)), a2 = s2.within(r2[t4 * this.stride], r2[t4 * this.stride + 1], n2), l2 = [];\n for (const t5 of a2) {\n const o3 = t5 * this.stride;\n r2[o3 + 4] === e2 && l2.push(r2[o3 + O] > 1 ? A2(r2, o3, this.clusterProps) : this.points[r2[o3 + L]]);\n }\n if (0 === l2.length) throw new Error(i2);\n return l2;\n }\n getLeaves(e2, t4, o2) {\n const i2 = [];\n return this._appendLeaves(i2, e2, t4 = t4 || 10, o2 = o2 || 0, 0), i2;\n }\n getTile(e2, t4, o2) {\n const i2 = this.trees[this._limitZoom(e2)], s2 = Math.pow(2, e2), { extent: r2, radius: n2 } = this.options, a2 = n2 / r2, l2 = (o2 - a2) / s2, c2 = (o2 + 1 + a2) / s2, u2 = { features: [] };\n return this._addTileFeatures(i2.range((t4 - a2) / s2, l2, (t4 + 1 + a2) / s2, c2), i2.data, t4, o2, s2, u2), 0 === t4 && this._addTileFeatures(i2.range(1 - a2 / s2, l2, 1, c2), i2.data, s2, o2, s2, u2), t4 === s2 - 1 && this._addTileFeatures(i2.range(0, l2, a2 / s2, c2), i2.data, -1, o2, s2, u2), u2.features.length ? u2 : null;\n }\n getClusterExpansionZoom(e2) {\n let t4 = this._getOriginZoom(e2) - 1;\n for (; t4 <= this.options.maxZoom; ) {\n const o2 = this.getChildren(e2);\n if (t4++, 1 !== o2.length) break;\n e2 = o2[0].properties.cluster_id;\n }\n return t4;\n }\n _appendLeaves(e2, t4, o2, i2, s2) {\n const r2 = this.getChildren(t4);\n for (const t5 of r2) {\n const r3 = t5.properties;\n if (r3 && r3.cluster ? s2 + r3.point_count <= i2 ? s2 += r3.point_count : s2 = this._appendLeaves(e2, r3.cluster_id, o2, i2, s2) : s2 < i2 ? s2++ : e2.push(t5), e2.length === o2) break;\n }\n return s2;\n }\n _createTree(t4) {\n const o2 = new e.av(t4.length / this.stride | 0, this.options.nodeSize, Float32Array);\n for (let e2 = 0; e2 < t4.length; e2 += this.stride) o2.add(t4[e2], t4[e2 + 1]);\n return o2.finish(), o2.data = t4, o2;\n }\n _addTileFeatures(e2, t4, o2, i2, s2, r2) {\n for (const n2 of e2) {\n const e3 = n2 * this.stride, a2 = t4[e3 + O] > 1;\n let l2, c2, u2;\n if (a2) l2 = E2(t4, e3, this.clusterProps), c2 = t4[e3], u2 = t4[e3 + 1];\n else {\n const o3 = this.points[t4[e3 + L]];\n l2 = o3.properties;\n const [i3, s3] = o3.geometry.coordinates;\n c2 = G(i3), u2 = j(s3);\n }\n const h2 = { type: 1, geometry: [[Math.round(this.options.extent * (c2 * s2 - o2)), Math.round(this.options.extent * (u2 * s2 - i2))]], tags: l2 };\n let d2;\n d2 = a2 || this.options.generateId ? t4[e3 + L] : this.points[t4[e3 + L]].id, void 0 !== d2 && (h2.id = d2), r2.features.push(h2);\n }\n }\n _limitZoom(e2) {\n return Math.max(this.options.minZoom, Math.min(Math.floor(+e2), this.options.maxZoom + 1));\n }\n _cluster(e2, t4) {\n const { radius: o2, extent: i2, reduce: s2, minPoints: r2 } = this.options, n2 = o2 / (i2 * Math.pow(2, t4)), a2 = e2.data, l2 = [], c2 = this.stride;\n for (let o3 = 0; o3 < a2.length; o3 += c2) {\n if (a2[o3 + 2] <= t4) continue;\n a2[o3 + 2] = t4;\n const i3 = a2[o3], u2 = a2[o3 + 1], h2 = e2.within(a2[o3], a2[o3 + 1], n2), d2 = a2[o3 + O];\n let f2 = d2;\n for (const e3 of h2) {\n const o4 = e3 * c2;\n a2[o4 + 2] > t4 && (f2 += a2[o4 + O]);\n }\n if (f2 > d2 && f2 >= r2) {\n let e3, r3 = i3 * d2, n3 = u2 * d2, g2 = -1;\n const p2 = ((o3 / c2 | 0) << 5) + (t4 + 1) + this.points.length;\n for (const i4 of h2) {\n const l3 = i4 * c2;\n if (a2[l3 + 2] <= t4) continue;\n a2[l3 + 2] = t4;\n const u3 = a2[l3 + O];\n r3 += a2[l3] * u3, n3 += a2[l3 + 1] * u3, a2[l3 + 4] = p2, s2 && (e3 || (e3 = this._map(a2, o3, true), g2 = this.clusterProps.length, this.clusterProps.push(e3)), s2(e3, this._map(a2, l3)));\n }\n a2[o3 + 4] = p2, l2.push(r3 / f2, n3 / f2, 1 / 0, p2, -1, f2), s2 && l2.push(g2);\n } else {\n for (let e3 = 0; e3 < c2; e3++) l2.push(a2[o3 + e3]);\n if (f2 > 1) for (const e3 of h2) {\n const o4 = e3 * c2;\n if (!(a2[o4 + 2] <= t4)) {\n a2[o4 + 2] = t4;\n for (let e4 = 0; e4 < c2; e4++) l2.push(a2[o4 + e4]);\n }\n }\n }\n }\n return l2;\n }\n _getOriginId(e2) {\n return e2 - this.points.length >> 5;\n }\n _getOriginZoom(e2) {\n return (e2 - this.points.length) % 32;\n }\n _map(e2, t4, o2) {\n if (e2[t4 + O] > 1) {\n const i3 = this.clusterProps[e2[t4 + F]];\n return o2 ? Object.assign({}, i3) : i3;\n }\n const i2 = this.points[e2[t4 + L]].properties, s2 = this.options.map(i2);\n return o2 && s2 === i2 ? Object.assign({}, s2) : s2;\n }\n }\n function A2(e2, t4, o2) {\n return { type: \"Feature\", id: e2[t4 + L], properties: E2(e2, t4, o2), geometry: { type: \"Point\", coordinates: [(i2 = e2[t4], 360 * (i2 - 0.5)), R(e2[t4 + 1])] } };\n var i2;\n }\n function E2(e2, t4, o2) {\n const i2 = e2[t4 + O], s2 = i2 >= 1e4 ? `${Math.round(i2 / 1e3)}k` : i2 >= 1e3 ? Math.round(i2 / 100) / 10 + \"k\" : i2, r2 = e2[t4 + F], n2 = -1 === r2 ? {} : Object.assign({}, o2[r2]);\n return Object.assign(n2, { cluster: true, cluster_id: e2[t4 + L], point_count: i2, point_count_abbreviated: s2 });\n }\n function G(e2) {\n return e2 / 360 + 0.5;\n }\n function j(e2) {\n const t4 = Math.sin(e2 * Math.PI / 180), o2 = 0.5 - 0.25 * Math.log((1 + t4) / (1 - t4)) / Math.PI;\n return o2 < 0 ? 0 : o2 > 1 ? 1 : o2;\n }\n function R(e2) {\n const t4 = (180 - 360 * e2) * Math.PI / 180;\n return 360 * Math.atan(Math.exp(t4)) / Math.PI - 90;\n }\n function Z(e2, t4, o2, i2) {\n let s2 = i2;\n const r2 = t4 + (o2 - t4 >> 1);\n let n2, a2 = o2 - t4;\n const l2 = e2[t4], c2 = e2[t4 + 1], u2 = e2[o2], h2 = e2[o2 + 1];\n for (let i3 = t4 + 3; i3 < o2; i3 += 3) {\n const t5 = N(e2[i3], e2[i3 + 1], l2, c2, u2, h2);\n if (t5 > s2) n2 = i3, s2 = t5;\n else if (t5 === s2) {\n const e3 = Math.abs(i3 - r2);\n e3 < a2 && (n2 = i3, a2 = e3);\n }\n }\n s2 > i2 && (n2 - t4 > 3 && Z(e2, t4, n2, i2), e2[n2 + 2] = s2, o2 - n2 > 3 && Z(e2, n2, o2, i2));\n }\n function N(e2, t4, o2, i2, s2, r2) {\n let n2 = s2 - o2, a2 = r2 - i2;\n if (0 !== n2 || 0 !== a2) {\n const l2 = ((e2 - o2) * n2 + (t4 - i2) * a2) / (n2 * n2 + a2 * a2);\n l2 > 1 ? (o2 = s2, i2 = r2) : l2 > 0 && (o2 += n2 * l2, i2 += a2 * l2);\n }\n return n2 = e2 - o2, a2 = t4 - i2, n2 * n2 + a2 * a2;\n }\n function J(e2, t4, o2, i2) {\n const s2 = { id: null == e2 ? null : e2, type: t4, geometry: o2, tags: i2, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };\n if (\"Point\" === t4 || \"MultiPoint\" === t4 || \"LineString\" === t4) W(s2, o2);\n else if (\"Polygon\" === t4) W(s2, o2[0]);\n else if (\"MultiLineString\" === t4) for (const e3 of o2) W(s2, e3);\n else if (\"MultiPolygon\" === t4) for (const e3 of o2) W(s2, e3[0]);\n return s2;\n }\n function W(e2, t4) {\n for (let o2 = 0; o2 < t4.length; o2 += 3) e2.minX = Math.min(e2.minX, t4[o2]), e2.minY = Math.min(e2.minY, t4[o2 + 1]), e2.maxX = Math.max(e2.maxX, t4[o2]), e2.maxY = Math.max(e2.maxY, t4[o2 + 1]);\n }\n function Y(e2, t4, o2, i2) {\n if (!t4.geometry) return;\n const s2 = t4.geometry.coordinates;\n if (s2 && 0 === s2.length) return;\n const r2 = t4.geometry.type, n2 = Math.pow(o2.tolerance / ((1 << o2.maxZoom) * o2.extent), 2);\n let a2 = [], l2 = t4.id;\n if (o2.promoteId ? l2 = t4.properties[o2.promoteId] : o2.generateId && (l2 = i2 || 0), \"Point\" === r2) V(s2, a2);\n else if (\"MultiPoint\" === r2) for (const e3 of s2) V(e3, a2);\n else if (\"LineString\" === r2) X(s2, a2, n2, false);\n else if (\"MultiLineString\" === r2) {\n if (o2.lineMetrics) {\n for (const o3 of s2) a2 = [], X(o3, a2, n2, false), e2.push(J(l2, \"LineString\", a2, t4.properties));\n return;\n }\n q(s2, a2, n2, false);\n } else if (\"Polygon\" === r2) q(s2, a2, n2, true);\n else {\n if (\"MultiPolygon\" !== r2) {\n if (\"GeometryCollection\" === r2) {\n for (const s3 of t4.geometry.geometries) Y(e2, { id: l2, geometry: s3, properties: t4.properties }, o2, i2);\n return;\n }\n throw new Error(\"Input data is not a valid GeoJSON object.\");\n }\n for (const e3 of s2) {\n const t5 = [];\n q(e3, t5, n2, true), a2.push(t5);\n }\n }\n e2.push(J(l2, r2, a2, t4.properties));\n }\n function V(e2, t4) {\n t4.push(H(e2[0]), B2(e2[1]), 0);\n }\n function X(e2, t4, o2, i2) {\n let s2, r2, n2 = 0;\n for (let o3 = 0; o3 < e2.length; o3++) {\n const a3 = H(e2[o3][0]), l2 = B2(e2[o3][1]);\n t4.push(a3, l2, 0), o3 > 0 && (n2 += i2 ? (s2 * l2 - a3 * r2) / 2 : Math.sqrt(Math.pow(a3 - s2, 2) + Math.pow(l2 - r2, 2))), s2 = a3, r2 = l2;\n }\n const a2 = t4.length - 3;\n t4[2] = 1, Z(t4, 0, a2, o2), t4[a2 + 2] = 1, t4.size = Math.abs(n2), t4.start = 0, t4.end = t4.size;\n }\n function q(e2, t4, o2, i2) {\n for (let s2 = 0; s2 < e2.length; s2++) {\n const r2 = [];\n X(e2[s2], r2, o2, i2), t4.push(r2);\n }\n }\n function H(e2) {\n return e2 / 360 + 0.5;\n }\n function B2(e2) {\n const t4 = Math.sin(e2 * Math.PI / 180), o2 = 0.5 - 0.25 * Math.log((1 + t4) / (1 - t4)) / Math.PI;\n return o2 < 0 ? 0 : o2 > 1 ? 1 : o2;\n }\n function U(e2, t4, o2, i2, s2, r2, n2, a2) {\n if (i2 /= t4, r2 >= (o2 /= t4) && n2 < i2) return e2;\n if (n2 < o2 || r2 >= i2) return null;\n const l2 = [];\n for (const t5 of e2) {\n const e3 = t5.geometry;\n let r3 = t5.type;\n const n3 = 0 === s2 ? t5.minX : t5.minY, c2 = 0 === s2 ? t5.maxX : t5.maxY;\n if (n3 >= o2 && c2 < i2) {\n l2.push(t5);\n continue;\n }\n if (c2 < o2 || n3 >= i2) continue;\n let u2 = [];\n if (\"Point\" === r3 || \"MultiPoint\" === r3) $(e3, u2, o2, i2, s2);\n else if (\"LineString\" === r3) K2(e3, u2, o2, i2, s2, false, a2.lineMetrics);\n else if (\"MultiLineString\" === r3) ee(e3, u2, o2, i2, s2, false);\n else if (\"Polygon\" === r3) ee(e3, u2, o2, i2, s2, true);\n else if (\"MultiPolygon\" === r3) for (const t6 of e3) {\n const e4 = [];\n ee(t6, e4, o2, i2, s2, true), e4.length && u2.push(e4);\n }\n if (u2.length) {\n if (a2.lineMetrics && \"LineString\" === r3) {\n for (const e4 of u2) l2.push(J(t5.id, r3, e4, t5.tags));\n continue;\n }\n \"LineString\" !== r3 && \"MultiLineString\" !== r3 || (1 === u2.length ? (r3 = \"LineString\", u2 = u2[0]) : r3 = \"MultiLineString\"), \"Point\" !== r3 && \"MultiPoint\" !== r3 || (r3 = 3 === u2.length ? \"Point\" : \"MultiPoint\"), l2.push(J(t5.id, r3, u2, t5.tags));\n }\n }\n return l2.length ? l2 : null;\n }\n function $(e2, t4, o2, i2, s2) {\n for (let r2 = 0; r2 < e2.length; r2 += 3) {\n const n2 = e2[r2 + s2];\n n2 >= o2 && n2 <= i2 && te(t4, e2[r2], e2[r2 + 1], e2[r2 + 2]);\n }\n }\n function K2(e2, t4, o2, i2, s2, r2, n2) {\n let a2 = Q(e2);\n const l2 = 0 === s2 ? oe : ie;\n let c2, u2, h2 = e2.start;\n for (let d3 = 0; d3 < e2.length - 3; d3 += 3) {\n const f3 = e2[d3], g3 = e2[d3 + 1], p3 = e2[d3 + 2], m2 = e2[d3 + 3], y2 = e2[d3 + 4], v2 = 0 === s2 ? f3 : g3, w2 = 0 === s2 ? m2 : y2;\n let x2 = false;\n n2 && (c2 = Math.sqrt(Math.pow(f3 - m2, 2) + Math.pow(g3 - y2, 2))), v2 < o2 ? w2 > o2 && (u2 = l2(a2, f3, g3, m2, y2, o2), n2 && (a2.start = h2 + c2 * u2)) : v2 > i2 ? w2 < i2 && (u2 = l2(a2, f3, g3, m2, y2, i2), n2 && (a2.start = h2 + c2 * u2)) : te(a2, f3, g3, p3), w2 < o2 && v2 >= o2 && (u2 = l2(a2, f3, g3, m2, y2, o2), x2 = true), w2 > i2 && v2 <= i2 && (u2 = l2(a2, f3, g3, m2, y2, i2), x2 = true), !r2 && x2 && (n2 && (a2.end = h2 + c2 * u2), t4.push(a2), a2 = Q(e2)), n2 && (h2 += c2);\n }\n let d2 = e2.length - 3;\n const f2 = e2[d2], g2 = e2[d2 + 1], p2 = 0 === s2 ? f2 : g2;\n p2 >= o2 && p2 <= i2 && te(a2, f2, g2, e2[d2 + 2]), d2 = a2.length - 3, r2 && d2 >= 3 && (a2[d2] !== a2[0] || a2[d2 + 1] !== a2[1]) && te(a2, a2[0], a2[1], a2[2]), a2.length && t4.push(a2);\n }\n function Q(e2) {\n const t4 = [];\n return t4.size = e2.size, t4.start = e2.start, t4.end = e2.end, t4;\n }\n function ee(e2, t4, o2, i2, s2, r2) {\n for (const n2 of e2) K2(n2, t4, o2, i2, s2, r2, false);\n }\n function te(e2, t4, o2, i2) {\n e2.push(t4, o2, i2);\n }\n function oe(e2, t4, o2, i2, s2, r2) {\n const n2 = (r2 - t4) / (i2 - t4);\n return te(e2, r2, o2 + (s2 - o2) * n2, 1), n2;\n }\n function ie(e2, t4, o2, i2, s2, r2) {\n const n2 = (r2 - o2) / (s2 - o2);\n return te(e2, t4 + (i2 - t4) * n2, r2, 1), n2;\n }\n function se(e2, t4) {\n const o2 = [];\n for (let i2 = 0; i2 < e2.length; i2++) {\n const s2 = e2[i2], r2 = s2.type;\n let n2;\n if (\"Point\" === r2 || \"MultiPoint\" === r2 || \"LineString\" === r2) n2 = re(s2.geometry, t4);\n else if (\"MultiLineString\" === r2 || \"Polygon\" === r2) {\n n2 = [];\n for (const e3 of s2.geometry) n2.push(re(e3, t4));\n } else if (\"MultiPolygon\" === r2) {\n n2 = [];\n for (const e3 of s2.geometry) {\n const o3 = [];\n for (const i3 of e3) o3.push(re(i3, t4));\n n2.push(o3);\n }\n }\n o2.push(J(s2.id, r2, n2, s2.tags));\n }\n return o2;\n }\n function re(e2, t4) {\n const o2 = [];\n o2.size = e2.size, void 0 !== e2.start && (o2.start = e2.start, o2.end = e2.end);\n for (let i2 = 0; i2 < e2.length; i2 += 3) o2.push(e2[i2] + t4, e2[i2 + 1], e2[i2 + 2]);\n return o2;\n }\n function ne(e2, t4) {\n if (e2.transformed) return e2;\n const o2 = 1 << e2.z, i2 = e2.x, s2 = e2.y;\n for (const r2 of e2.features) {\n const e3 = r2.geometry, n2 = r2.type;\n if (r2.geometry = [], 1 === n2) for (let n3 = 0; n3 < e3.length; n3 += 2) r2.geometry.push(ae(e3[n3], e3[n3 + 1], t4, o2, i2, s2));\n else for (let n3 = 0; n3 < e3.length; n3++) {\n const a2 = [];\n for (let r3 = 0; r3 < e3[n3].length; r3 += 2) a2.push(ae(e3[n3][r3], e3[n3][r3 + 1], t4, o2, i2, s2));\n r2.geometry.push(a2);\n }\n }\n return e2.transformed = true, e2;\n }\n function ae(e2, t4, o2, i2, s2, r2) {\n return [Math.round(o2 * (e2 * i2 - s2)), Math.round(o2 * (t4 * i2 - r2))];\n }\n function le(e2, t4, o2, i2, s2) {\n const r2 = t4 === s2.maxZoom ? 0 : s2.tolerance / ((1 << t4) * s2.extent), n2 = { features: [], numPoints: 0, numSimplified: 0, numFeatures: e2.length, source: null, x: o2, y: i2, z: t4, transformed: false, minX: 2, minY: 1, maxX: -1, maxY: 0 };\n for (const t5 of e2) ce(n2, t5, r2, s2);\n return n2;\n }\n function ce(e2, t4, o2, i2) {\n const s2 = t4.geometry, r2 = t4.type, n2 = [];\n if (e2.minX = Math.min(e2.minX, t4.minX), e2.minY = Math.min(e2.minY, t4.minY), e2.maxX = Math.max(e2.maxX, t4.maxX), e2.maxY = Math.max(e2.maxY, t4.maxY), \"Point\" === r2 || \"MultiPoint\" === r2) for (let t5 = 0; t5 < s2.length; t5 += 3) n2.push(s2[t5], s2[t5 + 1]), e2.numPoints++, e2.numSimplified++;\n else if (\"LineString\" === r2) ue(n2, s2, e2, o2, false, false);\n else if (\"MultiLineString\" === r2 || \"Polygon\" === r2) for (let t5 = 0; t5 < s2.length; t5++) ue(n2, s2[t5], e2, o2, \"Polygon\" === r2, 0 === t5);\n else if (\"MultiPolygon\" === r2) for (let t5 = 0; t5 < s2.length; t5++) {\n const i3 = s2[t5];\n for (let t6 = 0; t6 < i3.length; t6++) ue(n2, i3[t6], e2, o2, true, 0 === t6);\n }\n if (n2.length) {\n let o3 = t4.tags || null;\n if (\"LineString\" === r2 && i2.lineMetrics) {\n o3 = {};\n for (const e3 in t4.tags) o3[e3] = t4.tags[e3];\n o3.mapbox_clip_start = s2.start / s2.size, o3.mapbox_clip_end = s2.end / s2.size;\n }\n const a2 = { geometry: n2, type: \"Polygon\" === r2 || \"MultiPolygon\" === r2 ? 3 : \"LineString\" === r2 || \"MultiLineString\" === r2 ? 2 : 1, tags: o3 };\n null !== t4.id && (a2.id = t4.id), e2.features.push(a2);\n }\n }\n function ue(e2, t4, o2, i2, s2, r2) {\n const n2 = i2 * i2;\n if (i2 > 0 && t4.size < (s2 ? n2 : i2)) return void (o2.numPoints += t4.length / 3);\n const a2 = [];\n for (let e3 = 0; e3 < t4.length; e3 += 3) (0 === i2 || t4[e3 + 2] > n2) && (o2.numSimplified++, a2.push(t4[e3], t4[e3 + 1])), o2.numPoints++;\n s2 && function(e3, t5) {\n let o3 = 0;\n for (let t6 = 0, i3 = e3.length, s3 = i3 - 2; t6 < i3; s3 = t6, t6 += 2) o3 += (e3[t6] - e3[s3]) * (e3[t6 + 1] + e3[s3 + 1]);\n if (o3 > 0 === t5) for (let t6 = 0, o4 = e3.length; t6 < o4 / 2; t6 += 2) {\n const i3 = e3[t6], s3 = e3[t6 + 1];\n e3[t6] = e3[o4 - 2 - t6], e3[t6 + 1] = e3[o4 - 1 - t6], e3[o4 - 2 - t6] = i3, e3[o4 - 1 - t6] = s3;\n }\n }(a2, r2), e2.push(a2);\n }\n const he = { maxZoom: 14, indexMaxZoom: 5, indexMaxPoints: 1e5, tolerance: 3, extent: 4096, buffer: 64, lineMetrics: false, promoteId: null, generateId: false, debug: 0 };\n class de {\n constructor(e2, t4) {\n const o2 = (t4 = this.options = function(e3, t5) {\n for (const o3 in t5) e3[o3] = t5[o3];\n return e3;\n }(Object.create(he), t4)).debug;\n if (o2 && console.time(\"preprocess data\"), t4.maxZoom < 0 || t4.maxZoom > 24) throw new Error(\"maxZoom should be in the 0-24 range\");\n if (t4.promoteId && t4.generateId) throw new Error(\"promoteId and generateId cannot be used together.\");\n let i2 = function(e3, t5) {\n const o3 = [];\n if (\"FeatureCollection\" === e3.type) for (let i3 = 0; i3 < e3.features.length; i3++) Y(o3, e3.features[i3], t5, i3);\n else Y(o3, \"Feature\" === e3.type ? e3 : { geometry: e3 }, t5);\n return o3;\n }(e2, t4);\n this.tiles = {}, this.tileCoords = [], o2 && (console.timeEnd(\"preprocess data\"), console.log(\"index: maxZoom: %d, maxPoints: %d\", t4.indexMaxZoom, t4.indexMaxPoints), console.time(\"generate tiles\"), this.stats = {}, this.total = 0), i2 = function(e3, t5) {\n const o3 = t5.buffer / t5.extent;\n let i3 = e3;\n const s2 = U(e3, 1, -1 - o3, o3, 0, -1, 2, t5), r2 = U(e3, 1, 1 - o3, 2 + o3, 0, -1, 2, t5);\n return (s2 || r2) && (i3 = U(e3, 1, -o3, 1 + o3, 0, -1, 2, t5) || [], s2 && (i3 = se(s2, 1).concat(i3)), r2 && (i3 = i3.concat(se(r2, -1)))), i3;\n }(i2, t4), i2.length && this.splitTile(i2, 0, 0, 0), o2 && (i2.length && console.log(\"features: %d, points: %d\", this.tiles[0].numFeatures, this.tiles[0].numPoints), console.timeEnd(\"generate tiles\"), console.log(\"tiles generated:\", this.total, JSON.stringify(this.stats)));\n }\n splitTile(e2, t4, o2, i2, s2, r2, n2) {\n const a2 = [e2, t4, o2, i2], l2 = this.options, c2 = l2.debug;\n for (; a2.length; ) {\n i2 = a2.pop(), o2 = a2.pop(), t4 = a2.pop(), e2 = a2.pop();\n const u2 = 1 << t4, h2 = fe(t4, o2, i2);\n let d2 = this.tiles[h2];\n if (!d2 && (c2 > 1 && console.time(\"creation\"), d2 = this.tiles[h2] = le(e2, t4, o2, i2, l2), this.tileCoords.push({ z: t4, x: o2, y: i2 }), c2)) {\n c2 > 1 && (console.log(\"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)\", t4, o2, i2, d2.numFeatures, d2.numPoints, d2.numSimplified), console.timeEnd(\"creation\"));\n const e3 = `z${t4}`;\n this.stats[e3] = (this.stats[e3] || 0) + 1, this.total++;\n }\n if (d2.source = e2, null == s2) {\n if (t4 === l2.indexMaxZoom || d2.numPoints <= l2.indexMaxPoints) continue;\n } else {\n if (t4 === l2.maxZoom || t4 === s2) continue;\n if (null != s2) {\n const e3 = s2 - t4;\n if (o2 !== r2 >> e3 || i2 !== n2 >> e3) continue;\n }\n }\n if (d2.source = null, 0 === e2.length) continue;\n c2 > 1 && console.time(\"clipping\");\n const f2 = 0.5 * l2.buffer / l2.extent, g2 = 0.5 - f2, p2 = 0.5 + f2, m2 = 1 + f2;\n let y2 = null, v2 = null, w2 = null, x2 = null, b2 = U(e2, u2, o2 - f2, o2 + p2, 0, d2.minX, d2.maxX, l2), S2 = U(e2, u2, o2 + g2, o2 + m2, 0, d2.minX, d2.maxX, l2);\n e2 = null, b2 && (y2 = U(b2, u2, i2 - f2, i2 + p2, 1, d2.minY, d2.maxY, l2), v2 = U(b2, u2, i2 + g2, i2 + m2, 1, d2.minY, d2.maxY, l2), b2 = null), S2 && (w2 = U(S2, u2, i2 - f2, i2 + p2, 1, d2.minY, d2.maxY, l2), x2 = U(S2, u2, i2 + g2, i2 + m2, 1, d2.minY, d2.maxY, l2), S2 = null), c2 > 1 && console.timeEnd(\"clipping\"), a2.push(y2 || [], t4 + 1, 2 * o2, 2 * i2), a2.push(v2 || [], t4 + 1, 2 * o2, 2 * i2 + 1), a2.push(w2 || [], t4 + 1, 2 * o2 + 1, 2 * i2), a2.push(x2 || [], t4 + 1, 2 * o2 + 1, 2 * i2 + 1);\n }\n }\n getTile(e2, t4, o2) {\n e2 = +e2, t4 = +t4, o2 = +o2;\n const i2 = this.options, { extent: s2, debug: r2 } = i2;\n if (e2 < 0 || e2 > 24) return null;\n const n2 = 1 << e2, a2 = fe(e2, t4 = t4 + n2 & n2 - 1, o2);\n if (this.tiles[a2]) return ne(this.tiles[a2], s2);\n r2 > 1 && console.log(\"drilling down to z%d-%d-%d\", e2, t4, o2);\n let l2, c2 = e2, u2 = t4, h2 = o2;\n for (; !l2 && c2 > 0; ) c2--, u2 >>= 1, h2 >>= 1, l2 = this.tiles[fe(c2, u2, h2)];\n return l2 && l2.source ? (r2 > 1 && (console.log(\"found parent tile z%d-%d-%d\", c2, u2, h2), console.time(\"drilling down\")), this.splitTile(l2.source, c2, u2, h2, e2, t4, o2), r2 > 1 && console.timeEnd(\"drilling down\"), this.tiles[a2] ? ne(this.tiles[a2], s2) : null) : null;\n }\n }\n function fe(e2, t4, o2) {\n return 32 * ((1 << e2) * o2 + t4) + e2;\n }\n function ge(e2, t4) {\n return t4 ? e2.properties[t4] : e2.id;\n }\n function pe(e2, t4) {\n if (null == e2) return true;\n if (\"Feature\" === e2.type) return null != ge(e2, t4);\n if (\"FeatureCollection\" === e2.type) {\n const o2 = /* @__PURE__ */ new Set();\n for (const i2 of e2.features) {\n const e3 = ge(i2, t4);\n if (null == e3) return false;\n if (o2.has(e3)) return false;\n o2.add(e3);\n }\n return true;\n }\n return false;\n }\n function me(e2, t4) {\n const o2 = /* @__PURE__ */ new Map();\n if (null == e2) ;\n else if (\"Feature\" === e2.type) o2.set(ge(e2, t4), e2);\n else for (const i2 of e2.features) o2.set(ge(i2, t4), i2);\n return o2;\n }\n class ye extends r {\n constructor() {\n super(...arguments), this._dataUpdateable = /* @__PURE__ */ new Map();\n }\n loadVectorTile(t4, o2) {\n return e._(this, void 0, void 0, function* () {\n const o3 = t4.tileID.canonical;\n if (!this._geoJSONIndex) throw new Error(\"Unable to parse the data into a cluster or geojson\");\n const i2 = this._geoJSONIndex.getTile(o3.z, o3.x, o3.y);\n if (!i2) return null;\n const s2 = new class {\n constructor(t5) {\n this.layers = { _geojsonTileLayer: this }, this.name = \"_geojsonTileLayer\", this.extent = e.X, this.length = t5.length, this._features = t5;\n }\n feature(t5) {\n return new class {\n constructor(t6) {\n this._feature = t6, this.extent = e.X, this.type = t6.type, this.properties = t6.tags, \"id\" in t6 && !isNaN(t6.id) && (this.id = parseInt(t6.id, 10));\n }\n loadGeometry() {\n if (1 === this._feature.type) {\n const t6 = [];\n for (const o4 of this._feature.geometry) t6.push([new e.P(o4[0], o4[1])]);\n return t6;\n }\n {\n const t6 = [];\n for (const o4 of this._feature.geometry) {\n const i3 = [];\n for (const t7 of o4) i3.push(new e.P(t7[0], t7[1]));\n t6.push(i3);\n }\n return t6;\n }\n }\n toGeoJSON(e2, t6, o4) {\n return u.call(this, e2, t6, o4);\n }\n }(this._features[t5]);\n }\n }(i2.features);\n let r2 = k(s2);\n return 0 === r2.byteOffset && r2.byteLength === r2.buffer.byteLength || (r2 = new Uint8Array(r2)), { vectorTile: s2, rawData: r2.buffer };\n });\n }\n loadData(t4) {\n return e._(this, void 0, void 0, function* () {\n var o2;\n null === (o2 = this._pendingRequest) || void 0 === o2 || o2.abort();\n const i2 = !!(t4 && t4.request && t4.request.collectResourceTiming) && new e.bv(t4.request);\n this._pendingRequest = new AbortController();\n try {\n this._pendingData = this.loadAndProcessGeoJSON(t4, this._pendingRequest), this._geoJSONIndex = t4.cluster ? new z(function({ superclusterOptions: t5, clusterProperties: o4 }) {\n if (!o4 || !t5) return t5;\n const i3 = {}, s3 = {}, r2 = { accumulated: null, zoom: 0 }, n2 = { properties: null }, a2 = Object.keys(o4);\n for (const t6 of a2) {\n const [r3, n3] = o4[t6], a3 = e.bC(n3), l2 = e.bC(\"string\" == typeof r3 ? [r3, [\"accumulated\"], [\"get\", t6]] : r3);\n i3[t6] = a3.value, s3[t6] = l2.value;\n }\n return t5.map = (e2) => {\n n2.properties = e2;\n const t6 = {};\n for (const e3 of a2) t6[e3] = i3[e3].evaluate(r2, n2);\n return t6;\n }, t5.reduce = (e2, t6) => {\n n2.properties = t6;\n for (const t7 of a2) r2.accumulated = e2[t7], e2[t7] = s3[t7].evaluate(r2, n2);\n }, t5;\n }(t4)).load((yield this._pendingData).features) : (s2 = yield this._pendingData, new de(s2, t4.geojsonVtOptions)), this.loaded = {};\n const o3 = {};\n if (i2) {\n const e2 = i2.finish();\n e2 && (o3.resourceTiming = {}, o3.resourceTiming[t4.source] = JSON.parse(JSON.stringify(e2)));\n }\n return o3;\n } catch (t5) {\n if (delete this._pendingRequest, e.bB(t5)) return { abandoned: true };\n throw t5;\n }\n var s2;\n });\n }\n getData() {\n return e._(this, void 0, void 0, function* () {\n return this._pendingData;\n });\n }\n reloadTile(e2) {\n const t4 = this.loaded;\n return t4 && t4[e2.uid] ? super.reloadTile(e2) : this.loadTile(e2);\n }\n loadAndProcessGeoJSON(t4, o2) {\n return e._(this, void 0, void 0, function* () {\n let i2 = yield this.loadGeoJSON(t4, o2);\n if (delete this._pendingRequest, \"object\" != typeof i2) throw new Error(`Input data given to '${t4.source}' is not a valid GeoJSON object.`);\n if (c(i2, true), t4.filter) {\n const o3 = e.bC(t4.filter, { type: \"boolean\", \"property-type\": \"data-driven\", overridable: false, transition: false });\n if (\"error\" === o3.result) throw new Error(o3.value.map((e2) => `${e2.key}: ${e2.message}`).join(\", \"));\n const s2 = i2.features.filter((e2) => o3.value.evaluate({ zoom: 0 }, e2));\n i2 = { type: \"FeatureCollection\", features: s2 };\n }\n return i2;\n });\n }\n loadGeoJSON(t4, o2) {\n return e._(this, void 0, void 0, function* () {\n const { promoteId: i2 } = t4;\n if (t4.request) {\n const s2 = yield e.h(t4.request, o2);\n return this._dataUpdateable = pe(s2.data, i2) ? me(s2.data, i2) : void 0, s2.data;\n }\n if (\"string\" == typeof t4.data) try {\n const e2 = JSON.parse(t4.data);\n return this._dataUpdateable = pe(e2, i2) ? me(e2, i2) : void 0, e2;\n } catch (e2) {\n throw new Error(`Input data given to '${t4.source}' is not a valid GeoJSON object.`);\n }\n if (!t4.dataDiff) throw new Error(`Input data given to '${t4.source}' is not a valid GeoJSON object.`);\n if (!this._dataUpdateable) throw new Error(`Cannot update existing geojson data in ${t4.source}`);\n return function(e2, t5, o3) {\n var i3, s2, r2, n2;\n if (t5.removeAll && e2.clear(), t5.remove) for (const o4 of t5.remove) e2.delete(o4);\n if (t5.add) for (const i4 of t5.add) {\n const t6 = ge(i4, o3);\n null != t6 && e2.set(t6, i4);\n }\n if (t5.update) for (const o4 of t5.update) {\n let t6 = e2.get(o4.id);\n if (null == t6) continue;\n const a2 = !o4.removeAllProperties && ((null === (i3 = o4.removeProperties) || void 0 === i3 ? void 0 : i3.length) > 0 || (null === (s2 = o4.addOrUpdateProperties) || void 0 === s2 ? void 0 : s2.length) > 0);\n if ((o4.newGeometry || o4.removeAllProperties || a2) && (t6 = Object.assign({}, t6), e2.set(o4.id, t6), a2 && (t6.properties = Object.assign({}, t6.properties))), o4.newGeometry && (t6.geometry = o4.newGeometry), o4.removeAllProperties) t6.properties = {};\n else if ((null === (r2 = o4.removeProperties) || void 0 === r2 ? void 0 : r2.length) > 0) for (const e3 of o4.removeProperties) Object.prototype.hasOwnProperty.call(t6.properties, e3) && delete t6.properties[e3];\n if ((null === (n2 = o4.addOrUpdateProperties) || void 0 === n2 ? void 0 : n2.length) > 0) for (const { key: e3, value: i4 } of o4.addOrUpdateProperties) t6.properties[e3] = i4;\n }\n }(this._dataUpdateable, t4.dataDiff, i2), { type: \"FeatureCollection\", features: Array.from(this._dataUpdateable.values()) };\n });\n }\n removeSource(t4) {\n return e._(this, void 0, void 0, function* () {\n this._pendingRequest && this._pendingRequest.abort();\n });\n }\n getClusterExpansionZoom(e2) {\n return this._geoJSONIndex.getClusterExpansionZoom(e2.clusterId);\n }\n getClusterChildren(e2) {\n return this._geoJSONIndex.getChildren(e2.clusterId);\n }\n getClusterLeaves(e2) {\n return this._geoJSONIndex.getLeaves(e2.clusterId, e2.limit, e2.offset);\n }\n }\n class ve {\n constructor(t4) {\n this.self = t4, this.actor = new e.F(t4), this.layerIndexes = {}, this.availableImages = {}, this.workerSources = {}, this.demWorkerSources = {}, this.externalWorkerSourceTypes = {}, this.self.registerWorkerSource = (e2, t5) => {\n if (this.externalWorkerSourceTypes[e2]) throw new Error(`Worker source with name \"${e2}\" already registered.`);\n this.externalWorkerSourceTypes[e2] = t5;\n }, this.self.addProtocol = e.bi, this.self.removeProtocol = e.bj, this.self.registerRTLTextPlugin = (t5) => {\n if (e.bD.isParsed()) throw new Error(\"RTL text plugin already registered.\");\n e.bD.setMethods(t5);\n }, this.actor.registerMessageHandler(\"LDT\", (e2, t5) => this._getDEMWorkerSource(e2, t5.source).loadTile(t5)), this.actor.registerMessageHandler(\"RDT\", (t5, o2) => e._(this, void 0, void 0, function* () {\n this._getDEMWorkerSource(t5, o2.source).removeTile(o2);\n })), this.actor.registerMessageHandler(\"GCEZ\", (t5, o2) => e._(this, void 0, void 0, function* () {\n return this._getWorkerSource(t5, o2.type, o2.source).getClusterExpansionZoom(o2);\n })), this.actor.registerMessageHandler(\"GCC\", (t5, o2) => e._(this, void 0, void 0, function* () {\n return this._getWorkerSource(t5, o2.type, o2.source).getClusterChildren(o2);\n })), this.actor.registerMessageHandler(\"GCL\", (t5, o2) => e._(this, void 0, void 0, function* () {\n return this._getWorkerSource(t5, o2.type, o2.source).getClusterLeaves(o2);\n })), this.actor.registerMessageHandler(\"LD\", (e2, t5) => this._getWorkerSource(e2, t5.type, t5.source).loadData(t5)), this.actor.registerMessageHandler(\"GD\", (e2, t5) => this._getWorkerSource(e2, t5.type, t5.source).getData()), this.actor.registerMessageHandler(\"LT\", (e2, t5) => this._getWorkerSource(e2, t5.type, t5.source).loadTile(t5)), this.actor.registerMessageHandler(\"RT\", (e2, t5) => this._getWorkerSource(e2, t5.type, t5.source).reloadTile(t5)), this.actor.registerMessageHandler(\"AT\", (e2, t5) => this._getWorkerSource(e2, t5.type, t5.source).abortTile(t5)), this.actor.registerMessageHandler(\"RMT\", (e2, t5) => this._getWorkerSource(e2, t5.type, t5.source).removeTile(t5)), this.actor.registerMessageHandler(\"RS\", (t5, o2) => e._(this, void 0, void 0, function* () {\n if (!this.workerSources[t5] || !this.workerSources[t5][o2.type] || !this.workerSources[t5][o2.type][o2.source]) return;\n const e2 = this.workerSources[t5][o2.type][o2.source];\n delete this.workerSources[t5][o2.type][o2.source], void 0 !== e2.removeSource && e2.removeSource(o2);\n })), this.actor.registerMessageHandler(\"RM\", (t5) => e._(this, void 0, void 0, function* () {\n delete this.layerIndexes[t5], delete this.availableImages[t5], delete this.workerSources[t5], delete this.demWorkerSources[t5];\n })), this.actor.registerMessageHandler(\"SR\", (t5, o2) => e._(this, void 0, void 0, function* () {\n this.referrer = o2;\n })), this.actor.registerMessageHandler(\"SRPS\", (e2, t5) => this._syncRTLPluginState(e2, t5)), this.actor.registerMessageHandler(\"IS\", (t5, o2) => e._(this, void 0, void 0, function* () {\n this.self.importScripts(o2);\n })), this.actor.registerMessageHandler(\"SI\", (e2, t5) => this._setImages(e2, t5)), this.actor.registerMessageHandler(\"UL\", (t5, o2) => e._(this, void 0, void 0, function* () {\n this._getLayerIndex(t5).update(o2.layers, o2.removedIds);\n })), this.actor.registerMessageHandler(\"SL\", (t5, o2) => e._(this, void 0, void 0, function* () {\n this._getLayerIndex(t5).replace(o2);\n }));\n }\n _setImages(t4, o2) {\n return e._(this, void 0, void 0, function* () {\n this.availableImages[t4] = o2;\n for (const e2 in this.workerSources[t4]) {\n const i2 = this.workerSources[t4][e2];\n for (const e3 in i2) i2[e3].availableImages = o2;\n }\n });\n }\n _syncRTLPluginState(t4, o2) {\n return e._(this, void 0, void 0, function* () {\n if (e.bD.isParsed()) return e.bD.getState();\n if (\"loading\" !== o2.pluginStatus) return e.bD.setState(o2), o2;\n const t5 = o2.pluginURL;\n if (this.self.importScripts(t5), e.bD.isParsed()) {\n const o3 = { pluginStatus: \"loaded\", pluginURL: t5 };\n return e.bD.setState(o3), o3;\n }\n throw e.bD.setState({ pluginStatus: \"error\", pluginURL: \"\" }), new Error(`RTL Text Plugin failed to import scripts from ${t5}`);\n });\n }\n _getAvailableImages(e2) {\n let t4 = this.availableImages[e2];\n return t4 || (t4 = []), t4;\n }\n _getLayerIndex(e2) {\n let o2 = this.layerIndexes[e2];\n return o2 || (o2 = this.layerIndexes[e2] = new t()), o2;\n }\n _getWorkerSource(e2, t4, o2) {\n if (this.workerSources[e2] || (this.workerSources[e2] = {}), this.workerSources[e2][t4] || (this.workerSources[e2][t4] = {}), !this.workerSources[e2][t4][o2]) {\n const i2 = { sendAsync: (t5, o3) => (t5.targetMapId = e2, this.actor.sendAsync(t5, o3)) };\n switch (t4) {\n case \"vector\":\n this.workerSources[e2][t4][o2] = new r(i2, this._getLayerIndex(e2), this._getAvailableImages(e2));\n break;\n case \"geojson\":\n this.workerSources[e2][t4][o2] = new ye(i2, this._getLayerIndex(e2), this._getAvailableImages(e2));\n break;\n default:\n this.workerSources[e2][t4][o2] = new this.externalWorkerSourceTypes[t4](i2, this._getLayerIndex(e2), this._getAvailableImages(e2));\n }\n }\n return this.workerSources[e2][t4][o2];\n }\n _getDEMWorkerSource(e2, t4) {\n return this.demWorkerSources[e2] || (this.demWorkerSources[e2] = {}), this.demWorkerSources[e2][t4] || (this.demWorkerSources[e2][t4] = new n()), this.demWorkerSources[e2][t4];\n }\n }\n return e.i(self) && (self.worker = new ve(self)), ve;\n });\n define2(\"index\", [\"exports\", \"./shared\"], function(t, e) {\n \"use strict\";\n var i = \"4.7.1\";\n let a, s;\n const o = { now: \"undefined\" != typeof performance && performance && performance.now ? performance.now.bind(performance) : Date.now.bind(Date), frameAsync: (t4) => new Promise((i2, a2) => {\n const s2 = requestAnimationFrame(i2);\n t4.signal.addEventListener(\"abort\", () => {\n cancelAnimationFrame(s2), a2(e.c());\n });\n }), getImageData(t4, e2 = 0) {\n return this.getImageCanvasContext(t4).getImageData(-e2, -e2, t4.width + 2 * e2, t4.height + 2 * e2);\n }, getImageCanvasContext(t4) {\n const e2 = window.document.createElement(\"canvas\"), i2 = e2.getContext(\"2d\", { willReadFrequently: true });\n if (!i2) throw new Error(\"failed to create canvas 2d context\");\n return e2.width = t4.width, e2.height = t4.height, i2.drawImage(t4, 0, 0, t4.width, t4.height), i2;\n }, resolveURL: (t4) => (a || (a = document.createElement(\"a\")), a.href = t4, a.href), hardwareConcurrency: \"undefined\" != typeof navigator && navigator.hardwareConcurrency || 4, get prefersReducedMotion() {\n return !!matchMedia && (null == s && (s = matchMedia(\"(prefers-reduced-motion: reduce)\")), s.matches);\n } };\n class r {\n static testProp(t4) {\n if (!r.docStyle) return t4[0];\n for (let e2 = 0; e2 < t4.length; e2++) if (t4[e2] in r.docStyle) return t4[e2];\n return t4[0];\n }\n static create(t4, e2, i2) {\n const a2 = window.document.createElement(t4);\n return void 0 !== e2 && (a2.className = e2), i2 && i2.appendChild(a2), a2;\n }\n static createNS(t4, e2) {\n return window.document.createElementNS(t4, e2);\n }\n static disableDrag() {\n r.docStyle && r.selectProp && (r.userSelect = r.docStyle[r.selectProp], r.docStyle[r.selectProp] = \"none\");\n }\n static enableDrag() {\n r.docStyle && r.selectProp && (r.docStyle[r.selectProp] = r.userSelect);\n }\n static setTransform(t4, e2) {\n t4.style[r.transformProp] = e2;\n }\n static addEventListener(t4, e2, i2, a2 = {}) {\n t4.addEventListener(e2, i2, \"passive\" in a2 ? a2 : a2.capture);\n }\n static removeEventListener(t4, e2, i2, a2 = {}) {\n t4.removeEventListener(e2, i2, \"passive\" in a2 ? a2 : a2.capture);\n }\n static suppressClickInternal(t4) {\n t4.preventDefault(), t4.stopPropagation(), window.removeEventListener(\"click\", r.suppressClickInternal, true);\n }\n static suppressClick() {\n window.addEventListener(\"click\", r.suppressClickInternal, true), window.setTimeout(() => {\n window.removeEventListener(\"click\", r.suppressClickInternal, true);\n }, 0);\n }\n static getScale(t4) {\n const e2 = t4.getBoundingClientRect();\n return { x: e2.width / t4.offsetWidth || 1, y: e2.height / t4.offsetHeight || 1, boundingClientRect: e2 };\n }\n static getPoint(t4, i2, a2) {\n const s2 = i2.boundingClientRect;\n return new e.P((a2.clientX - s2.left) / i2.x - t4.clientLeft, (a2.clientY - s2.top) / i2.y - t4.clientTop);\n }\n static mousePos(t4, e2) {\n const i2 = r.getScale(t4);\n return r.getPoint(t4, i2, e2);\n }\n static touchPos(t4, e2) {\n const i2 = [], a2 = r.getScale(t4);\n for (let s2 = 0; s2 < e2.length; s2++) i2.push(r.getPoint(t4, a2, e2[s2]));\n return i2;\n }\n static mouseButton(t4) {\n return t4.button;\n }\n static remove(t4) {\n t4.parentNode && t4.parentNode.removeChild(t4);\n }\n }\n r.docStyle = \"undefined\" != typeof window && window.document && window.document.documentElement.style, r.selectProp = r.testProp([\"userSelect\", \"MozUserSelect\", \"WebkitUserSelect\", \"msUserSelect\"]), r.transformProp = r.testProp([\"transform\", \"WebkitTransform\"]);\n const n = { supported: false, testSupport: function(t4) {\n !c && h && (u ? d(t4) : l = t4);\n } };\n let l, h, c = false, u = false;\n function d(t4) {\n const e2 = t4.createTexture();\n t4.bindTexture(t4.TEXTURE_2D, e2);\n try {\n if (t4.texImage2D(t4.TEXTURE_2D, 0, t4.RGBA, t4.RGBA, t4.UNSIGNED_BYTE, h), t4.isContextLost()) return;\n n.supported = true;\n } catch (t5) {\n }\n t4.deleteTexture(e2), c = true;\n }\n var _;\n \"undefined\" != typeof document && (h = document.createElement(\"img\"), h.onload = () => {\n l && d(l), l = null, u = true;\n }, h.onerror = () => {\n c = true, l = null;\n }, h.src = \"data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=\"), function(t4) {\n let i2, a2, s2, o2;\n t4.resetRequestQueue = () => {\n i2 = [], a2 = 0, s2 = 0, o2 = {};\n }, t4.addThrottleControl = (t5) => {\n const e2 = s2++;\n return o2[e2] = t5, e2;\n }, t4.removeThrottleControl = (t5) => {\n delete o2[t5], l2();\n }, t4.getImage = (t5, a3, s3 = true) => new Promise((o3, r3) => {\n n.supported && (t5.headers || (t5.headers = {}), t5.headers.accept = \"image/webp,*/*\"), e.e(t5, { type: \"image\" }), i2.push({ abortController: a3, requestParameters: t5, supportImageRefresh: s3, state: \"queued\", onError: (t6) => {\n r3(t6);\n }, onSuccess: (t6) => {\n o3(t6);\n } }), l2();\n });\n const r2 = (t5) => e._(this, void 0, void 0, function* () {\n t5.state = \"running\";\n const { requestParameters: i3, supportImageRefresh: s3, onError: o3, onSuccess: r3, abortController: n2 } = t5, c2 = false === s3 && !e.i(self) && !e.g(i3.url) && (!i3.headers || Object.keys(i3.headers).reduce((t6, e2) => t6 && \"accept\" === e2, true));\n a2++;\n const u2 = c2 ? h2(i3, n2) : e.m(i3, n2);\n try {\n const i4 = yield u2;\n delete t5.abortController, t5.state = \"completed\", i4.data instanceof HTMLImageElement || e.b(i4.data) ? r3(i4) : i4.data && r3({ data: yield (d2 = i4.data, \"function\" == typeof createImageBitmap ? e.d(d2) : e.f(d2)), cacheControl: i4.cacheControl, expires: i4.expires });\n } catch (e2) {\n delete t5.abortController, o3(e2);\n } finally {\n a2--, l2();\n }\n var d2;\n }), l2 = () => {\n const t5 = (() => {\n for (const t6 of Object.keys(o2)) if (o2[t6]()) return true;\n return false;\n })() ? e.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME : e.a.MAX_PARALLEL_IMAGE_REQUESTS;\n for (let e2 = a2; e2 < t5 && i2.length > 0; e2++) {\n const t6 = i2.shift();\n t6.abortController.signal.aborted ? e2-- : r2(t6);\n }\n }, h2 = (t5, i3) => new Promise((a3, s3) => {\n const o3 = new Image(), r3 = t5.url, n2 = t5.credentials;\n n2 && \"include\" === n2 ? o3.crossOrigin = \"use-credentials\" : (n2 && \"same-origin\" === n2 || !e.s(r3)) && (o3.crossOrigin = \"anonymous\"), i3.signal.addEventListener(\"abort\", () => {\n o3.src = \"\", s3(e.c());\n }), o3.fetchPriority = \"high\", o3.onload = () => {\n o3.onerror = o3.onload = null, a3({ data: o3 });\n }, o3.onerror = () => {\n o3.onerror = o3.onload = null, i3.signal.aborted || s3(new Error(\"Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.\"));\n }, o3.src = r3;\n });\n }(_ || (_ = {})), _.resetRequestQueue();\n class p {\n constructor(t4) {\n this._transformRequestFn = t4;\n }\n transformRequest(t4, e2) {\n return this._transformRequestFn && this._transformRequestFn(t4, e2) || { url: t4 };\n }\n setTransformRequest(t4) {\n this._transformRequestFn = t4;\n }\n }\n function m(t4) {\n var i2 = new e.A(3);\n return i2[0] = t4[0], i2[1] = t4[1], i2[2] = t4[2], i2;\n }\n var f, g = function(t4, e2, i2) {\n return t4[0] = e2[0] - i2[0], t4[1] = e2[1] - i2[1], t4[2] = e2[2] - i2[2], t4;\n };\n f = new e.A(3), e.A != Float32Array && (f[0] = 0, f[1] = 0, f[2] = 0);\n var v = function(t4) {\n var e2 = t4[0], i2 = t4[1];\n return e2 * e2 + i2 * i2;\n };\n function x(t4) {\n const e2 = [];\n if (\"string\" == typeof t4) e2.push({ id: \"default\", url: t4 });\n else if (t4 && t4.length > 0) {\n const i2 = [];\n for (const { id: a2, url: s2 } of t4) {\n const t5 = `${a2}${s2}`;\n -1 === i2.indexOf(t5) && (i2.push(t5), e2.push({ id: a2, url: s2 }));\n }\n }\n return e2;\n }\n function y(t4, e2, i2) {\n const a2 = t4.split(\"?\");\n return a2[0] += `${e2}${i2}`, a2.join(\"?\");\n }\n !function() {\n var t4 = new e.A(2);\n e.A != Float32Array && (t4[0] = 0, t4[1] = 0);\n }();\n class b {\n constructor(t4, e2, i2, a2) {\n this.context = t4, this.format = i2, this.texture = t4.gl.createTexture(), this.update(e2, a2);\n }\n update(t4, i2, a2) {\n const { width: s2, height: o2 } = t4, r2 = !(this.size && this.size[0] === s2 && this.size[1] === o2 || a2), { context: n2 } = this, { gl: l2 } = n2;\n if (this.useMipmap = Boolean(i2 && i2.useMipmap), l2.bindTexture(l2.TEXTURE_2D, this.texture), n2.pixelStoreUnpackFlipY.set(false), n2.pixelStoreUnpack.set(1), n2.pixelStoreUnpackPremultiplyAlpha.set(this.format === l2.RGBA && (!i2 || false !== i2.premultiply)), r2) this.size = [s2, o2], t4 instanceof HTMLImageElement || t4 instanceof HTMLCanvasElement || t4 instanceof HTMLVideoElement || t4 instanceof ImageData || e.b(t4) ? l2.texImage2D(l2.TEXTURE_2D, 0, this.format, this.format, l2.UNSIGNED_BYTE, t4) : l2.texImage2D(l2.TEXTURE_2D, 0, this.format, s2, o2, 0, this.format, l2.UNSIGNED_BYTE, t4.data);\n else {\n const { x: i3, y: r3 } = a2 || { x: 0, y: 0 };\n t4 instanceof HTMLImageElement || t4 instanceof HTMLCanvasElement || t4 instanceof HTMLVideoElement || t4 instanceof ImageData || e.b(t4) ? l2.texSubImage2D(l2.TEXTURE_2D, 0, i3, r3, l2.RGBA, l2.UNSIGNED_BYTE, t4) : l2.texSubImage2D(l2.TEXTURE_2D, 0, i3, r3, s2, o2, l2.RGBA, l2.UNSIGNED_BYTE, t4.data);\n }\n this.useMipmap && this.isSizePowerOfTwo() && l2.generateMipmap(l2.TEXTURE_2D);\n }\n bind(t4, e2, i2) {\n const { context: a2 } = this, { gl: s2 } = a2;\n s2.bindTexture(s2.TEXTURE_2D, this.texture), i2 !== s2.LINEAR_MIPMAP_NEAREST || this.isSizePowerOfTwo() || (i2 = s2.LINEAR), t4 !== this.filter && (s2.texParameteri(s2.TEXTURE_2D, s2.TEXTURE_MAG_FILTER, t4), s2.texParameteri(s2.TEXTURE_2D, s2.TEXTURE_MIN_FILTER, i2 || t4), this.filter = t4), e2 !== this.wrap && (s2.texParameteri(s2.TEXTURE_2D, s2.TEXTURE_WRAP_S, e2), s2.texParameteri(s2.TEXTURE_2D, s2.TEXTURE_WRAP_T, e2), this.wrap = e2);\n }\n isSizePowerOfTwo() {\n return this.size[0] === this.size[1] && Math.log(this.size[0]) / Math.LN2 % 1 == 0;\n }\n destroy() {\n const { gl: t4 } = this.context;\n t4.deleteTexture(this.texture), this.texture = null;\n }\n }\n function w(t4) {\n const { userImage: e2 } = t4;\n return !!(e2 && e2.render && e2.render()) && (t4.data.replace(new Uint8Array(e2.data.buffer)), true);\n }\n class T extends e.E {\n constructor() {\n super(), this.images = {}, this.updatedImages = {}, this.callbackDispatchedThisFrame = {}, this.loaded = false, this.requestors = [], this.patterns = {}, this.atlasImage = new e.R({ width: 1, height: 1 }), this.dirty = true;\n }\n isLoaded() {\n return this.loaded;\n }\n setLoaded(t4) {\n if (this.loaded !== t4 && (this.loaded = t4, t4)) {\n for (const { ids: t5, promiseResolve: e2 } of this.requestors) e2(this._getImagesForIds(t5));\n this.requestors = [];\n }\n }\n getImage(t4) {\n const i2 = this.images[t4];\n if (i2 && !i2.data && i2.spriteData) {\n const t5 = i2.spriteData;\n i2.data = new e.R({ width: t5.width, height: t5.height }, t5.context.getImageData(t5.x, t5.y, t5.width, t5.height).data), i2.spriteData = null;\n }\n return i2;\n }\n addImage(t4, e2) {\n if (this.images[t4]) throw new Error(`Image id ${t4} already exist, use updateImage instead`);\n this._validate(t4, e2) && (this.images[t4] = e2);\n }\n _validate(t4, i2) {\n let a2 = true;\n const s2 = i2.data || i2.spriteData;\n return this._validateStretch(i2.stretchX, s2 && s2.width) || (this.fire(new e.j(new Error(`Image \"${t4}\" has invalid \"stretchX\" value`))), a2 = false), this._validateStretch(i2.stretchY, s2 && s2.height) || (this.fire(new e.j(new Error(`Image \"${t4}\" has invalid \"stretchY\" value`))), a2 = false), this._validateContent(i2.content, i2) || (this.fire(new e.j(new Error(`Image \"${t4}\" has invalid \"content\" value`))), a2 = false), a2;\n }\n _validateStretch(t4, e2) {\n if (!t4) return true;\n let i2 = 0;\n for (const a2 of t4) {\n if (a2[0] < i2 || a2[1] < a2[0] || e2 < a2[1]) return false;\n i2 = a2[1];\n }\n return true;\n }\n _validateContent(t4, e2) {\n if (!t4) return true;\n if (4 !== t4.length) return false;\n const i2 = e2.spriteData, a2 = i2 && i2.width || e2.data.width, s2 = i2 && i2.height || e2.data.height;\n return !(t4[0] < 0 || a2 < t4[0] || t4[1] < 0 || s2 < t4[1] || t4[2] < 0 || a2 < t4[2] || t4[3] < 0 || s2 < t4[3] || t4[2] < t4[0] || t4[3] < t4[1]);\n }\n updateImage(t4, e2, i2 = true) {\n const a2 = this.getImage(t4);\n if (i2 && (a2.data.width !== e2.data.width || a2.data.height !== e2.data.height)) throw new Error(`size mismatch between old image (${a2.data.width}x${a2.data.height}) and new image (${e2.data.width}x${e2.data.height}).`);\n e2.version = a2.version + 1, this.images[t4] = e2, this.updatedImages[t4] = true;\n }\n removeImage(t4) {\n const e2 = this.images[t4];\n delete this.images[t4], delete this.patterns[t4], e2.userImage && e2.userImage.onRemove && e2.userImage.onRemove();\n }\n listImages() {\n return Object.keys(this.images);\n }\n getImages(t4) {\n return new Promise((e2, i2) => {\n let a2 = true;\n if (!this.isLoaded()) for (const e3 of t4) this.images[e3] || (a2 = false);\n this.isLoaded() || a2 ? e2(this._getImagesForIds(t4)) : this.requestors.push({ ids: t4, promiseResolve: e2 });\n });\n }\n _getImagesForIds(t4) {\n const i2 = {};\n for (const a2 of t4) {\n let t5 = this.getImage(a2);\n t5 || (this.fire(new e.k(\"styleimagemissing\", { id: a2 })), t5 = this.getImage(a2)), t5 ? i2[a2] = { data: t5.data.clone(), pixelRatio: t5.pixelRatio, sdf: t5.sdf, version: t5.version, stretchX: t5.stretchX, stretchY: t5.stretchY, content: t5.content, textFitWidth: t5.textFitWidth, textFitHeight: t5.textFitHeight, hasRenderCallback: Boolean(t5.userImage && t5.userImage.render) } : e.w(`Image \"${a2}\" could not be loaded. Please make sure you have added the image with map.addImage() or a \"sprite\" property in your style. You can provide missing images by listening for the \"styleimagemissing\" map event.`);\n }\n return i2;\n }\n getPixelSize() {\n const { width: t4, height: e2 } = this.atlasImage;\n return { width: t4, height: e2 };\n }\n getPattern(t4) {\n const i2 = this.patterns[t4], a2 = this.getImage(t4);\n if (!a2) return null;\n if (i2 && i2.position.version === a2.version) return i2.position;\n if (i2) i2.position.version = a2.version;\n else {\n const i3 = { w: a2.data.width + 2, h: a2.data.height + 2, x: 0, y: 0 }, s2 = new e.I(i3, a2);\n this.patterns[t4] = { bin: i3, position: s2 };\n }\n return this._updatePatternAtlas(), this.patterns[t4].position;\n }\n bind(t4) {\n const e2 = t4.gl;\n this.atlasTexture ? this.dirty && (this.atlasTexture.update(this.atlasImage), this.dirty = false) : this.atlasTexture = new b(t4, this.atlasImage, e2.RGBA), this.atlasTexture.bind(e2.LINEAR, e2.CLAMP_TO_EDGE);\n }\n _updatePatternAtlas() {\n const t4 = [];\n for (const e2 in this.patterns) t4.push(this.patterns[e2].bin);\n const { w: i2, h: a2 } = e.p(t4), s2 = this.atlasImage;\n s2.resize({ width: i2 || 1, height: a2 || 1 });\n for (const t5 in this.patterns) {\n const { bin: i3 } = this.patterns[t5], a3 = i3.x + 1, o2 = i3.y + 1, r2 = this.getImage(t5).data, n2 = r2.width, l2 = r2.height;\n e.R.copy(r2, s2, { x: 0, y: 0 }, { x: a3, y: o2 }, { width: n2, height: l2 }), e.R.copy(r2, s2, { x: 0, y: l2 - 1 }, { x: a3, y: o2 - 1 }, { width: n2, height: 1 }), e.R.copy(r2, s2, { x: 0, y: 0 }, { x: a3, y: o2 + l2 }, { width: n2, height: 1 }), e.R.copy(r2, s2, { x: n2 - 1, y: 0 }, { x: a3 - 1, y: o2 }, { width: 1, height: l2 }), e.R.copy(r2, s2, { x: 0, y: 0 }, { x: a3 + n2, y: o2 }, { width: 1, height: l2 });\n }\n this.dirty = true;\n }\n beginFrame() {\n this.callbackDispatchedThisFrame = {};\n }\n dispatchRenderCallbacks(t4) {\n for (const i2 of t4) {\n if (this.callbackDispatchedThisFrame[i2]) continue;\n this.callbackDispatchedThisFrame[i2] = true;\n const t5 = this.getImage(i2);\n t5 || e.w(`Image with ID: \"${i2}\" was not found`), w(t5) && this.updateImage(i2, t5);\n }\n }\n }\n const I = 1e20;\n function E2(t4, e2, i2, a2, s2, o2, r2, n2, l2) {\n for (let h2 = e2; h2 < e2 + a2; h2++) P(t4, i2 * o2 + h2, o2, s2, r2, n2, l2);\n for (let h2 = i2; h2 < i2 + s2; h2++) P(t4, h2 * o2 + e2, 1, a2, r2, n2, l2);\n }\n function P(t4, e2, i2, a2, s2, o2, r2) {\n o2[0] = 0, r2[0] = -I, r2[1] = I, s2[0] = t4[e2];\n for (let n2 = 1, l2 = 0, h2 = 0; n2 < a2; n2++) {\n s2[n2] = t4[e2 + n2 * i2];\n const a3 = n2 * n2;\n do {\n const t5 = o2[l2];\n h2 = (s2[n2] - s2[t5] + a3 - t5 * t5) / (n2 - t5) / 2;\n } while (h2 <= r2[l2] && --l2 > -1);\n l2++, o2[l2] = n2, r2[l2] = h2, r2[l2 + 1] = I;\n }\n for (let n2 = 0, l2 = 0; n2 < a2; n2++) {\n for (; r2[l2 + 1] < n2; ) l2++;\n const a3 = o2[l2], h2 = n2 - a3;\n t4[e2 + n2 * i2] = s2[a3] + h2 * h2;\n }\n }\n class C2 {\n constructor(t4, e2) {\n this.requestManager = t4, this.localIdeographFontFamily = e2, this.entries = {};\n }\n setURL(t4) {\n this.url = t4;\n }\n getGlyphs(t4) {\n return e._(this, void 0, void 0, function* () {\n const e2 = [];\n for (const i3 in t4) for (const a3 of t4[i3]) e2.push(this._getAndCacheGlyphsPromise(i3, a3));\n const i2 = yield Promise.all(e2), a2 = {};\n for (const { stack: t5, id: e3, glyph: s2 } of i2) a2[t5] || (a2[t5] = {}), a2[t5][e3] = s2 && { id: s2.id, bitmap: s2.bitmap.clone(), metrics: s2.metrics };\n return a2;\n });\n }\n _getAndCacheGlyphsPromise(t4, i2) {\n return e._(this, void 0, void 0, function* () {\n let e2 = this.entries[t4];\n e2 || (e2 = this.entries[t4] = { glyphs: {}, requests: {}, ranges: {} });\n let a2 = e2.glyphs[i2];\n if (void 0 !== a2) return { stack: t4, id: i2, glyph: a2 };\n if (a2 = this._tinySDF(e2, t4, i2), a2) return e2.glyphs[i2] = a2, { stack: t4, id: i2, glyph: a2 };\n const s2 = Math.floor(i2 / 256);\n if (256 * s2 > 65535) throw new Error(\"glyphs > 65535 not supported\");\n if (e2.ranges[s2]) return { stack: t4, id: i2, glyph: a2 };\n if (!this.url) throw new Error(\"glyphsUrl is not set\");\n if (!e2.requests[s2]) {\n const i3 = C2.loadGlyphRange(t4, s2, this.url, this.requestManager);\n e2.requests[s2] = i3;\n }\n const o2 = yield e2.requests[s2];\n for (const t5 in o2) this._doesCharSupportLocalGlyph(+t5) || (e2.glyphs[+t5] = o2[+t5]);\n return e2.ranges[s2] = true, { stack: t4, id: i2, glyph: o2[i2] || null };\n });\n }\n _doesCharSupportLocalGlyph(t4) {\n return !!this.localIdeographFontFamily && new RegExp(\"\\\\p{Ideo}|\\\\p{sc=Hang}|\\\\p{sc=Hira}|\\\\p{sc=Kana}\", \"u\").test(String.fromCodePoint(t4));\n }\n _tinySDF(t4, i2, a2) {\n const s2 = this.localIdeographFontFamily;\n if (!s2) return;\n if (!this._doesCharSupportLocalGlyph(a2)) return;\n let o2 = t4.tinySDF;\n if (!o2) {\n let e2 = \"400\";\n /bold/i.test(i2) ? e2 = \"900\" : /medium/i.test(i2) ? e2 = \"500\" : /light/i.test(i2) && (e2 = \"200\"), o2 = t4.tinySDF = new C2.TinySDF({ fontSize: 48, buffer: 6, radius: 16, cutoff: 0.25, fontFamily: s2, fontWeight: e2 });\n }\n const r2 = o2.draw(String.fromCharCode(a2));\n return { id: a2, bitmap: new e.o({ width: r2.width || 60, height: r2.height || 60 }, r2.data), metrics: { width: r2.glyphWidth / 2 || 24, height: r2.glyphHeight / 2 || 24, left: r2.glyphLeft / 2 + 0.5 || 0, top: r2.glyphTop / 2 - 27.5 || -8, advance: r2.glyphAdvance / 2 || 24, isDoubleResolution: true } };\n }\n }\n C2.loadGlyphRange = function(t4, i2, a2, s2) {\n return e._(this, void 0, void 0, function* () {\n const o2 = 256 * i2, r2 = o2 + 255, n2 = s2.transformRequest(a2.replace(\"{fontstack}\", t4).replace(\"{range}\", `${o2}-${r2}`), \"Glyphs\"), l2 = yield e.l(n2, new AbortController());\n if (!l2 || !l2.data) throw new Error(`Could not load glyph range. range: ${i2}, ${o2}-${r2}`);\n const h2 = {};\n for (const t5 of e.n(l2.data)) h2[t5.id] = t5;\n return h2;\n });\n }, C2.TinySDF = class {\n constructor({ fontSize: t4 = 24, buffer: e2 = 3, radius: i2 = 8, cutoff: a2 = 0.25, fontFamily: s2 = \"sans-serif\", fontWeight: o2 = \"normal\", fontStyle: r2 = \"normal\" } = {}) {\n this.buffer = e2, this.cutoff = a2, this.radius = i2;\n const n2 = this.size = t4 + 4 * e2, l2 = this._createCanvas(n2), h2 = this.ctx = l2.getContext(\"2d\", { willReadFrequently: true });\n h2.font = `${r2} ${o2} ${t4}px ${s2}`, h2.textBaseline = \"alphabetic\", h2.textAlign = \"left\", h2.fillStyle = \"black\", this.gridOuter = new Float64Array(n2 * n2), this.gridInner = new Float64Array(n2 * n2), this.f = new Float64Array(n2), this.z = new Float64Array(n2 + 1), this.v = new Uint16Array(n2);\n }\n _createCanvas(t4) {\n const e2 = document.createElement(\"canvas\");\n return e2.width = e2.height = t4, e2;\n }\n draw(t4) {\n const { width: e2, actualBoundingBoxAscent: i2, actualBoundingBoxDescent: a2, actualBoundingBoxLeft: s2, actualBoundingBoxRight: o2 } = this.ctx.measureText(t4), r2 = Math.ceil(i2), n2 = Math.max(0, Math.min(this.size - this.buffer, Math.ceil(o2 - s2))), l2 = Math.min(this.size - this.buffer, r2 + Math.ceil(a2)), h2 = n2 + 2 * this.buffer, c2 = l2 + 2 * this.buffer, u2 = Math.max(h2 * c2, 0), d2 = new Uint8ClampedArray(u2), _2 = { data: d2, width: h2, height: c2, glyphWidth: n2, glyphHeight: l2, glyphTop: r2, glyphLeft: 0, glyphAdvance: e2 };\n if (0 === n2 || 0 === l2) return _2;\n const { ctx: p2, buffer: m2, gridInner: f2, gridOuter: g2 } = this;\n p2.clearRect(m2, m2, n2, l2), p2.fillText(t4, m2, m2 + r2);\n const v2 = p2.getImageData(m2, m2, n2, l2);\n g2.fill(I, 0, u2), f2.fill(0, 0, u2);\n for (let t5 = 0; t5 < l2; t5++) for (let e3 = 0; e3 < n2; e3++) {\n const i3 = v2.data[4 * (t5 * n2 + e3) + 3] / 255;\n if (0 === i3) continue;\n const a3 = (t5 + m2) * h2 + e3 + m2;\n if (1 === i3) g2[a3] = 0, f2[a3] = I;\n else {\n const t6 = 0.5 - i3;\n g2[a3] = t6 > 0 ? t6 * t6 : 0, f2[a3] = t6 < 0 ? t6 * t6 : 0;\n }\n }\n E2(g2, 0, 0, h2, c2, h2, this.f, this.v, this.z), E2(f2, m2, m2, n2, l2, h2, this.f, this.v, this.z);\n for (let t5 = 0; t5 < u2; t5++) {\n const e3 = Math.sqrt(g2[t5]) - Math.sqrt(f2[t5]);\n d2[t5] = Math.round(255 - 255 * (e3 / this.radius + this.cutoff));\n }\n return _2;\n }\n };\n class S {\n constructor() {\n this.specification = e.v.light.position;\n }\n possiblyEvaluate(t4, i2) {\n return e.x(t4.expression.evaluate(i2));\n }\n interpolate(t4, i2, a2) {\n return { x: e.y.number(t4.x, i2.x, a2), y: e.y.number(t4.y, i2.y, a2), z: e.y.number(t4.z, i2.z, a2) };\n }\n }\n let z;\n class D2 extends e.E {\n constructor(t4) {\n super(), z = z || new e.q({ anchor: new e.D(e.v.light.anchor), position: new S(), color: new e.D(e.v.light.color), intensity: new e.D(e.v.light.intensity) }), this._transitionable = new e.T(z), this.setLight(t4), this._transitioning = this._transitionable.untransitioned();\n }\n getLight() {\n return this._transitionable.serialize();\n }\n setLight(t4, i2 = {}) {\n if (!this._validate(e.r, t4, i2)) for (const e2 in t4) {\n const i3 = t4[e2];\n e2.endsWith(\"-transition\") ? this._transitionable.setTransition(e2.slice(0, -11), i3) : this._transitionable.setValue(e2, i3);\n }\n }\n updateTransitions(t4) {\n this._transitioning = this._transitionable.transitioned(t4, this._transitioning);\n }\n hasTransition() {\n return this._transitioning.hasTransition();\n }\n recalculate(t4) {\n this.properties = this._transitioning.possiblyEvaluate(t4);\n }\n _validate(t4, i2, a2) {\n return (!a2 || false !== a2.validate) && e.t(this, t4.call(e.u, { value: i2, style: { glyphs: true, sprite: true }, styleSpec: e.v }));\n }\n }\n const M = new e.q({ \"sky-color\": new e.D(e.v.sky[\"sky-color\"]), \"horizon-color\": new e.D(e.v.sky[\"horizon-color\"]), \"fog-color\": new e.D(e.v.sky[\"fog-color\"]), \"fog-ground-blend\": new e.D(e.v.sky[\"fog-ground-blend\"]), \"horizon-fog-blend\": new e.D(e.v.sky[\"horizon-fog-blend\"]), \"sky-horizon-blend\": new e.D(e.v.sky[\"sky-horizon-blend\"]), \"atmosphere-blend\": new e.D(e.v.sky[\"atmosphere-blend\"]) });\n class A2 extends e.E {\n constructor(t4) {\n super(), this._transitionable = new e.T(M), this.setSky(t4), this._transitioning = this._transitionable.untransitioned(), this.recalculate(new e.z(0));\n }\n setSky(t4, i2 = {}) {\n if (!this._validate(e.B, t4, i2)) {\n t4 || (t4 = { \"sky-color\": \"transparent\", \"horizon-color\": \"transparent\", \"fog-color\": \"transparent\", \"fog-ground-blend\": 1, \"atmosphere-blend\": 0 });\n for (const e2 in t4) {\n const i3 = t4[e2];\n e2.endsWith(\"-transition\") ? this._transitionable.setTransition(e2.slice(0, -11), i3) : this._transitionable.setValue(e2, i3);\n }\n }\n }\n getSky() {\n return this._transitionable.serialize();\n }\n updateTransitions(t4) {\n this._transitioning = this._transitionable.transitioned(t4, this._transitioning);\n }\n hasTransition() {\n return this._transitioning.hasTransition();\n }\n recalculate(t4) {\n this.properties = this._transitioning.possiblyEvaluate(t4);\n }\n _validate(t4, i2, a2 = {}) {\n return false !== (null == a2 ? void 0 : a2.validate) && e.t(this, t4.call(e.u, e.e({ value: i2, style: { glyphs: true, sprite: true }, styleSpec: e.v })));\n }\n calculateFogBlendOpacity(t4) {\n return t4 < 60 ? 0 : t4 < 70 ? (t4 - 60) / 10 : 1;\n }\n }\n class R {\n constructor(t4, e2) {\n this.width = t4, this.height = e2, this.nextRow = 0, this.data = new Uint8Array(this.width * this.height), this.dashEntry = {};\n }\n getDash(t4, e2) {\n const i2 = t4.join(\",\") + String(e2);\n return this.dashEntry[i2] || (this.dashEntry[i2] = this.addDash(t4, e2)), this.dashEntry[i2];\n }\n getDashRanges(t4, e2, i2) {\n const a2 = [];\n let s2 = t4.length % 2 == 1 ? -t4[t4.length - 1] * i2 : 0, o2 = t4[0] * i2, r2 = true;\n a2.push({ left: s2, right: o2, isDash: r2, zeroLength: 0 === t4[0] });\n let n2 = t4[0];\n for (let e3 = 1; e3 < t4.length; e3++) {\n r2 = !r2;\n const l2 = t4[e3];\n s2 = n2 * i2, n2 += l2, o2 = n2 * i2, a2.push({ left: s2, right: o2, isDash: r2, zeroLength: 0 === l2 });\n }\n return a2;\n }\n addRoundDash(t4, e2, i2) {\n const a2 = e2 / 2;\n for (let e3 = -i2; e3 <= i2; e3++) {\n const s2 = this.width * (this.nextRow + i2 + e3);\n let o2 = 0, r2 = t4[o2];\n for (let n2 = 0; n2 < this.width; n2++) {\n n2 / r2.right > 1 && (r2 = t4[++o2]);\n const l2 = Math.abs(n2 - r2.left), h2 = Math.abs(n2 - r2.right), c2 = Math.min(l2, h2);\n let u2;\n const d2 = e3 / i2 * (a2 + 1);\n if (r2.isDash) {\n const t5 = a2 - Math.abs(d2);\n u2 = Math.sqrt(c2 * c2 + t5 * t5);\n } else u2 = a2 - Math.sqrt(c2 * c2 + d2 * d2);\n this.data[s2 + n2] = Math.max(0, Math.min(255, u2 + 128));\n }\n }\n }\n addRegularDash(t4) {\n for (let e3 = t4.length - 1; e3 >= 0; --e3) {\n const i3 = t4[e3], a3 = t4[e3 + 1];\n i3.zeroLength ? t4.splice(e3, 1) : a3 && a3.isDash === i3.isDash && (a3.left = i3.left, t4.splice(e3, 1));\n }\n const e2 = t4[0], i2 = t4[t4.length - 1];\n e2.isDash === i2.isDash && (e2.left = i2.left - this.width, i2.right = e2.right + this.width);\n const a2 = this.width * this.nextRow;\n let s2 = 0, o2 = t4[s2];\n for (let e3 = 0; e3 < this.width; e3++) {\n e3 / o2.right > 1 && (o2 = t4[++s2]);\n const i3 = Math.abs(e3 - o2.left), r2 = Math.abs(e3 - o2.right), n2 = Math.min(i3, r2);\n this.data[a2 + e3] = Math.max(0, Math.min(255, (o2.isDash ? n2 : -n2) + 128));\n }\n }\n addDash(t4, i2) {\n const a2 = i2 ? 7 : 0, s2 = 2 * a2 + 1;\n if (this.nextRow + s2 > this.height) return e.w(\"LineAtlas out of space\"), null;\n let o2 = 0;\n for (let e2 = 0; e2 < t4.length; e2++) o2 += t4[e2];\n if (0 !== o2) {\n const e2 = this.width / o2, s3 = this.getDashRanges(t4, this.width, e2);\n i2 ? this.addRoundDash(s3, e2, a2) : this.addRegularDash(s3);\n }\n const r2 = { y: (this.nextRow + a2 + 0.5) / this.height, height: 2 * a2 / this.height, width: o2 };\n return this.nextRow += s2, this.dirty = true, r2;\n }\n bind(t4) {\n const e2 = t4.gl;\n this.texture ? (e2.bindTexture(e2.TEXTURE_2D, this.texture), this.dirty && (this.dirty = false, e2.texSubImage2D(e2.TEXTURE_2D, 0, 0, 0, this.width, this.height, e2.ALPHA, e2.UNSIGNED_BYTE, this.data))) : (this.texture = e2.createTexture(), e2.bindTexture(e2.TEXTURE_2D, this.texture), e2.texParameteri(e2.TEXTURE_2D, e2.TEXTURE_WRAP_S, e2.REPEAT), e2.texParameteri(e2.TEXTURE_2D, e2.TEXTURE_WRAP_T, e2.REPEAT), e2.texParameteri(e2.TEXTURE_2D, e2.TEXTURE_MIN_FILTER, e2.LINEAR), e2.texParameteri(e2.TEXTURE_2D, e2.TEXTURE_MAG_FILTER, e2.LINEAR), e2.texImage2D(e2.TEXTURE_2D, 0, e2.ALPHA, this.width, this.height, 0, e2.ALPHA, e2.UNSIGNED_BYTE, this.data));\n }\n }\n const k = \"maplibre_preloaded_worker_pool\";\n class L {\n constructor() {\n this.active = {};\n }\n acquire(t4) {\n if (!this.workers) for (this.workers = []; this.workers.length < L.workerCount; ) this.workers.push(new Worker(e.a.WORKER_URL));\n return this.active[t4] = true, this.workers.slice();\n }\n release(t4) {\n delete this.active[t4], 0 === this.numActive() && (this.workers.forEach((t5) => {\n t5.terminate();\n }), this.workers = null);\n }\n isPreloaded() {\n return !!this.active[k];\n }\n numActive() {\n return Object.keys(this.active).length;\n }\n }\n const F = Math.floor(o.hardwareConcurrency / 2);\n let B2, O;\n function N() {\n return B2 || (B2 = new L()), B2;\n }\n L.workerCount = e.C(globalThis) ? Math.max(Math.min(F, 3), 1) : 1;\n class U {\n constructor(t4, i2) {\n this.workerPool = t4, this.actors = [], this.currentActor = 0, this.id = i2;\n const a2 = this.workerPool.acquire(i2);\n for (let t5 = 0; t5 < a2.length; t5++) {\n const s2 = new e.F(a2[t5], i2);\n s2.name = `Worker ${t5}`, this.actors.push(s2);\n }\n if (!this.actors.length) throw new Error(\"No actors found\");\n }\n broadcast(t4, e2) {\n const i2 = [];\n for (const a2 of this.actors) i2.push(a2.sendAsync({ type: t4, data: e2 }));\n return Promise.all(i2);\n }\n getActor() {\n return this.currentActor = (this.currentActor + 1) % this.actors.length, this.actors[this.currentActor];\n }\n remove(t4 = true) {\n this.actors.forEach((t5) => {\n t5.remove();\n }), this.actors = [], t4 && this.workerPool.release(this.id);\n }\n registerMessageHandler(t4, e2) {\n for (const i2 of this.actors) i2.registerMessageHandler(t4, e2);\n }\n }\n function j() {\n return O || (O = new U(N(), e.G), O.registerMessageHandler(\"GR\", (t4, i2, a2) => e.m(i2, a2))), O;\n }\n function Z(t4, i2) {\n const a2 = e.H();\n return e.J(a2, a2, [1, 1, 0]), e.K(a2, a2, [0.5 * t4.width, 0.5 * t4.height, 1]), e.L(a2, a2, t4.calculatePosMatrix(i2.toUnwrapped()));\n }\n function q(t4, e2, i2, a2, s2, o2) {\n const r2 = function(t5, e3, i3) {\n if (t5) for (const a3 of t5) {\n const t6 = e3[a3];\n if (t6 && t6.source === i3 && \"fill-extrusion\" === t6.type) return true;\n }\n else for (const t6 in e3) {\n const a3 = e3[t6];\n if (a3.source === i3 && \"fill-extrusion\" === a3.type) return true;\n }\n return false;\n }(s2 && s2.layers, e2, t4.id), n2 = o2.maxPitchScaleFactor(), l2 = t4.tilesIn(a2, n2, r2);\n l2.sort(V);\n const h2 = [];\n for (const a3 of l2) h2.push({ wrappedTileID: a3.tileID.wrapped().key, queryResults: a3.tile.queryRenderedFeatures(e2, i2, t4._state, a3.queryGeometry, a3.cameraQueryGeometry, a3.scale, s2, o2, n2, Z(t4.transform, a3.tileID)) });\n const c2 = function(t5) {\n const e3 = {}, i3 = {};\n for (const a3 of t5) {\n const t6 = a3.queryResults, s3 = a3.wrappedTileID, o3 = i3[s3] = i3[s3] || {};\n for (const i4 in t6) {\n const a4 = t6[i4], s4 = o3[i4] = o3[i4] || {}, r3 = e3[i4] = e3[i4] || [];\n for (const t7 of a4) s4[t7.featureIndex] || (s4[t7.featureIndex] = true, r3.push(t7));\n }\n }\n return e3;\n }(h2);\n for (const e3 in c2) c2[e3].forEach((e4) => {\n const i3 = e4.feature, a3 = t4.getFeatureState(i3.layer[\"source-layer\"], i3.id);\n i3.source = i3.layer.source, i3.layer[\"source-layer\"] && (i3.sourceLayer = i3.layer[\"source-layer\"]), i3.state = a3;\n });\n return c2;\n }\n function V(t4, e2) {\n const i2 = t4.tileID, a2 = e2.tileID;\n return i2.overscaledZ - a2.overscaledZ || i2.canonical.y - a2.canonical.y || i2.wrap - a2.wrap || i2.canonical.x - a2.canonical.x;\n }\n function G(t4, i2, a2) {\n return e._(this, void 0, void 0, function* () {\n let s2 = t4;\n if (t4.url ? s2 = (yield e.h(i2.transformRequest(t4.url, \"Source\"), a2)).data : yield o.frameAsync(a2), !s2) return null;\n const r2 = e.M(e.e(s2, t4), [\"tiles\", \"minzoom\", \"maxzoom\", \"attribution\", \"bounds\", \"scheme\", \"tileSize\", \"encoding\"]);\n return \"vector_layers\" in s2 && s2.vector_layers && (r2.vectorLayerIds = s2.vector_layers.map((t5) => t5.id)), r2;\n });\n }\n class H {\n constructor(t4, e2) {\n t4 && (e2 ? this.setSouthWest(t4).setNorthEast(e2) : Array.isArray(t4) && (4 === t4.length ? this.setSouthWest([t4[0], t4[1]]).setNorthEast([t4[2], t4[3]]) : this.setSouthWest(t4[0]).setNorthEast(t4[1])));\n }\n setNorthEast(t4) {\n return this._ne = t4 instanceof e.N ? new e.N(t4.lng, t4.lat) : e.N.convert(t4), this;\n }\n setSouthWest(t4) {\n return this._sw = t4 instanceof e.N ? new e.N(t4.lng, t4.lat) : e.N.convert(t4), this;\n }\n extend(t4) {\n const i2 = this._sw, a2 = this._ne;\n let s2, o2;\n if (t4 instanceof e.N) s2 = t4, o2 = t4;\n else {\n if (!(t4 instanceof H)) return Array.isArray(t4) ? 4 === t4.length || t4.every(Array.isArray) ? this.extend(H.convert(t4)) : this.extend(e.N.convert(t4)) : t4 && (\"lng\" in t4 || \"lon\" in t4) && \"lat\" in t4 ? this.extend(e.N.convert(t4)) : this;\n if (s2 = t4._sw, o2 = t4._ne, !s2 || !o2) return this;\n }\n return i2 || a2 ? (i2.lng = Math.min(s2.lng, i2.lng), i2.lat = Math.min(s2.lat, i2.lat), a2.lng = Math.max(o2.lng, a2.lng), a2.lat = Math.max(o2.lat, a2.lat)) : (this._sw = new e.N(s2.lng, s2.lat), this._ne = new e.N(o2.lng, o2.lat)), this;\n }\n getCenter() {\n return new e.N((this._sw.lng + this._ne.lng) / 2, (this._sw.lat + this._ne.lat) / 2);\n }\n getSouthWest() {\n return this._sw;\n }\n getNorthEast() {\n return this._ne;\n }\n getNorthWest() {\n return new e.N(this.getWest(), this.getNorth());\n }\n getSouthEast() {\n return new e.N(this.getEast(), this.getSouth());\n }\n getWest() {\n return this._sw.lng;\n }\n getSouth() {\n return this._sw.lat;\n }\n getEast() {\n return this._ne.lng;\n }\n getNorth() {\n return this._ne.lat;\n }\n toArray() {\n return [this._sw.toArray(), this._ne.toArray()];\n }\n toString() {\n return `LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`;\n }\n isEmpty() {\n return !(this._sw && this._ne);\n }\n contains(t4) {\n const { lng: i2, lat: a2 } = e.N.convert(t4);\n let s2 = this._sw.lng <= i2 && i2 <= this._ne.lng;\n return this._sw.lng > this._ne.lng && (s2 = this._sw.lng >= i2 && i2 >= this._ne.lng), this._sw.lat <= a2 && a2 <= this._ne.lat && s2;\n }\n static convert(t4) {\n return t4 instanceof H ? t4 : t4 ? new H(t4) : t4;\n }\n static fromLngLat(t4, i2 = 0) {\n const a2 = 360 * i2 / 40075017, s2 = a2 / Math.cos(Math.PI / 180 * t4.lat);\n return new H(new e.N(t4.lng - s2, t4.lat - a2), new e.N(t4.lng + s2, t4.lat + a2));\n }\n adjustAntiMeridian() {\n const t4 = new e.N(this._sw.lng, this._sw.lat), i2 = new e.N(this._ne.lng, this._ne.lat);\n return new H(t4, t4.lng > i2.lng ? new e.N(i2.lng + 360, i2.lat) : i2);\n }\n }\n class W {\n constructor(t4, e2, i2) {\n this.bounds = H.convert(this.validateBounds(t4)), this.minzoom = e2 || 0, this.maxzoom = i2 || 24;\n }\n validateBounds(t4) {\n return Array.isArray(t4) && 4 === t4.length ? [Math.max(-180, t4[0]), Math.max(-90, t4[1]), Math.min(180, t4[2]), Math.min(90, t4[3])] : [-180, -90, 180, 90];\n }\n contains(t4) {\n const i2 = Math.pow(2, t4.z), a2 = Math.floor(e.O(this.bounds.getWest()) * i2), s2 = Math.floor(e.Q(this.bounds.getNorth()) * i2), o2 = Math.ceil(e.O(this.bounds.getEast()) * i2), r2 = Math.ceil(e.Q(this.bounds.getSouth()) * i2);\n return t4.x >= a2 && t4.x < o2 && t4.y >= s2 && t4.y < r2;\n }\n }\n class $ extends e.E {\n constructor(t4, i2, a2, s2) {\n if (super(), this.id = t4, this.dispatcher = a2, this.type = \"vector\", this.minzoom = 0, this.maxzoom = 22, this.scheme = \"xyz\", this.tileSize = 512, this.reparseOverscaled = true, this.isTileClipped = true, this._loaded = false, e.e(this, e.M(i2, [\"url\", \"scheme\", \"tileSize\", \"promoteId\"])), this._options = e.e({ type: \"vector\" }, i2), this._collectResourceTiming = i2.collectResourceTiming, 512 !== this.tileSize) throw new Error(\"vector tile sources must have a tileSize of 512\");\n this.setEventedParent(s2);\n }\n load() {\n return e._(this, void 0, void 0, function* () {\n this._loaded = false, this.fire(new e.k(\"dataloading\", { dataType: \"source\" })), this._tileJSONRequest = new AbortController();\n try {\n const t4 = yield G(this._options, this.map._requestManager, this._tileJSONRequest);\n this._tileJSONRequest = null, this._loaded = true, this.map.style.sourceCaches[this.id].clearTiles(), t4 && (e.e(this, t4), t4.bounds && (this.tileBounds = new W(t4.bounds, this.minzoom, this.maxzoom)), this.fire(new e.k(\"data\", { dataType: \"source\", sourceDataType: \"metadata\" })), this.fire(new e.k(\"data\", { dataType: \"source\", sourceDataType: \"content\" })));\n } catch (t4) {\n this._tileJSONRequest = null, this.fire(new e.j(t4));\n }\n });\n }\n loaded() {\n return this._loaded;\n }\n hasTile(t4) {\n return !this.tileBounds || this.tileBounds.contains(t4.canonical);\n }\n onAdd(t4) {\n this.map = t4, this.load();\n }\n setSourceProperty(t4) {\n this._tileJSONRequest && this._tileJSONRequest.abort(), t4(), this.load();\n }\n setTiles(t4) {\n return this.setSourceProperty(() => {\n this._options.tiles = t4;\n }), this;\n }\n setUrl(t4) {\n return this.setSourceProperty(() => {\n this.url = t4, this._options.url = t4;\n }), this;\n }\n onRemove() {\n this._tileJSONRequest && (this._tileJSONRequest.abort(), this._tileJSONRequest = null);\n }\n serialize() {\n return e.e({}, this._options);\n }\n loadTile(t4) {\n return e._(this, void 0, void 0, function* () {\n const e2 = t4.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme), i2 = { request: this.map._requestManager.transformRequest(e2, \"Tile\"), uid: t4.uid, tileID: t4.tileID, zoom: t4.tileID.overscaledZ, tileSize: this.tileSize * t4.tileID.overscaleFactor(), type: this.type, source: this.id, pixelRatio: this.map.getPixelRatio(), showCollisionBoxes: this.map.showCollisionBoxes, promoteId: this.promoteId };\n i2.request.collectResourceTiming = this._collectResourceTiming;\n let a2 = \"RT\";\n if (t4.actor && \"expired\" !== t4.state) {\n if (\"loading\" === t4.state) return new Promise((e3, i3) => {\n t4.reloadPromise = { resolve: e3, reject: i3 };\n });\n } else t4.actor = this.dispatcher.getActor(), a2 = \"LT\";\n t4.abortController = new AbortController();\n try {\n const e3 = yield t4.actor.sendAsync({ type: a2, data: i2 }, t4.abortController);\n if (delete t4.abortController, t4.aborted) return;\n this._afterTileLoadWorkerResponse(t4, e3);\n } catch (e3) {\n if (delete t4.abortController, t4.aborted) return;\n if (e3 && 404 !== e3.status) throw e3;\n this._afterTileLoadWorkerResponse(t4, null);\n }\n });\n }\n _afterTileLoadWorkerResponse(t4, e2) {\n if (e2 && e2.resourceTiming && (t4.resourceTiming = e2.resourceTiming), e2 && this.map._refreshExpiredTiles && t4.setExpiryData(e2), t4.loadVectorData(e2, this.map.painter), t4.reloadPromise) {\n const e3 = t4.reloadPromise;\n t4.reloadPromise = null, this.loadTile(t4).then(e3.resolve).catch(e3.reject);\n }\n }\n abortTile(t4) {\n return e._(this, void 0, void 0, function* () {\n t4.abortController && (t4.abortController.abort(), delete t4.abortController), t4.actor && (yield t4.actor.sendAsync({ type: \"AT\", data: { uid: t4.uid, type: this.type, source: this.id } }));\n });\n }\n unloadTile(t4) {\n return e._(this, void 0, void 0, function* () {\n t4.unloadVectorData(), t4.actor && (yield t4.actor.sendAsync({ type: \"RMT\", data: { uid: t4.uid, type: this.type, source: this.id } }));\n });\n }\n hasTransition() {\n return false;\n }\n }\n class X extends e.E {\n constructor(t4, i2, a2, s2) {\n super(), this.id = t4, this.dispatcher = a2, this.setEventedParent(s2), this.type = \"raster\", this.minzoom = 0, this.maxzoom = 22, this.roundZoom = true, this.scheme = \"xyz\", this.tileSize = 512, this._loaded = false, this._options = e.e({ type: \"raster\" }, i2), e.e(this, e.M(i2, [\"url\", \"scheme\", \"tileSize\"]));\n }\n load() {\n return e._(this, void 0, void 0, function* () {\n this._loaded = false, this.fire(new e.k(\"dataloading\", { dataType: \"source\" })), this._tileJSONRequest = new AbortController();\n try {\n const t4 = yield G(this._options, this.map._requestManager, this._tileJSONRequest);\n this._tileJSONRequest = null, this._loaded = true, t4 && (e.e(this, t4), t4.bounds && (this.tileBounds = new W(t4.bounds, this.minzoom, this.maxzoom)), this.fire(new e.k(\"data\", { dataType: \"source\", sourceDataType: \"metadata\" })), this.fire(new e.k(\"data\", { dataType: \"source\", sourceDataType: \"content\" })));\n } catch (t4) {\n this._tileJSONRequest = null, this.fire(new e.j(t4));\n }\n });\n }\n loaded() {\n return this._loaded;\n }\n onAdd(t4) {\n this.map = t4, this.load();\n }\n onRemove() {\n this._tileJSONRequest && (this._tileJSONRequest.abort(), this._tileJSONRequest = null);\n }\n setSourceProperty(t4) {\n this._tileJSONRequest && (this._tileJSONRequest.abort(), this._tileJSONRequest = null), t4(), this.load();\n }\n setTiles(t4) {\n return this.setSourceProperty(() => {\n this._options.tiles = t4;\n }), this;\n }\n setUrl(t4) {\n return this.setSourceProperty(() => {\n this.url = t4, this._options.url = t4;\n }), this;\n }\n serialize() {\n return e.e({}, this._options);\n }\n hasTile(t4) {\n return !this.tileBounds || this.tileBounds.contains(t4.canonical);\n }\n loadTile(t4) {\n return e._(this, void 0, void 0, function* () {\n const e2 = t4.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme);\n t4.abortController = new AbortController();\n try {\n const i2 = yield _.getImage(this.map._requestManager.transformRequest(e2, \"Tile\"), t4.abortController, this.map._refreshExpiredTiles);\n if (delete t4.abortController, t4.aborted) return void (t4.state = \"unloaded\");\n if (i2 && i2.data) {\n this.map._refreshExpiredTiles && i2.cacheControl && i2.expires && t4.setExpiryData({ cacheControl: i2.cacheControl, expires: i2.expires });\n const e3 = this.map.painter.context, a2 = e3.gl, s2 = i2.data;\n t4.texture = this.map.painter.getTileTexture(s2.width), t4.texture ? t4.texture.update(s2, { useMipmap: true }) : (t4.texture = new b(e3, s2, a2.RGBA, { useMipmap: true }), t4.texture.bind(a2.LINEAR, a2.CLAMP_TO_EDGE, a2.LINEAR_MIPMAP_NEAREST)), t4.state = \"loaded\";\n }\n } catch (e3) {\n if (delete t4.abortController, t4.aborted) t4.state = \"unloaded\";\n else if (e3) throw t4.state = \"errored\", e3;\n }\n });\n }\n abortTile(t4) {\n return e._(this, void 0, void 0, function* () {\n t4.abortController && (t4.abortController.abort(), delete t4.abortController);\n });\n }\n unloadTile(t4) {\n return e._(this, void 0, void 0, function* () {\n t4.texture && this.map.painter.saveTileTexture(t4.texture);\n });\n }\n hasTransition() {\n return false;\n }\n }\n class K2 extends X {\n constructor(t4, i2, a2, s2) {\n super(t4, i2, a2, s2), this.type = \"raster-dem\", this.maxzoom = 22, this._options = e.e({ type: \"raster-dem\" }, i2), this.encoding = i2.encoding || \"mapbox\", this.redFactor = i2.redFactor, this.greenFactor = i2.greenFactor, this.blueFactor = i2.blueFactor, this.baseShift = i2.baseShift;\n }\n loadTile(t4) {\n return e._(this, void 0, void 0, function* () {\n const i2 = t4.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme), a2 = this.map._requestManager.transformRequest(i2, \"Tile\");\n t4.neighboringTiles = this._getNeighboringTiles(t4.tileID), t4.abortController = new AbortController();\n try {\n const i3 = yield _.getImage(a2, t4.abortController, this.map._refreshExpiredTiles);\n if (delete t4.abortController, t4.aborted) return void (t4.state = \"unloaded\");\n if (i3 && i3.data) {\n const a3 = i3.data;\n this.map._refreshExpiredTiles && i3.cacheControl && i3.expires && t4.setExpiryData({ cacheControl: i3.cacheControl, expires: i3.expires });\n const s2 = e.b(a3) && e.U() ? a3 : yield this.readImageNow(a3), o2 = { type: this.type, uid: t4.uid, source: this.id, rawImageData: s2, encoding: this.encoding, redFactor: this.redFactor, greenFactor: this.greenFactor, blueFactor: this.blueFactor, baseShift: this.baseShift };\n if (!t4.actor || \"expired\" === t4.state) {\n t4.actor = this.dispatcher.getActor();\n const e2 = yield t4.actor.sendAsync({ type: \"LDT\", data: o2 });\n t4.dem = e2, t4.needsHillshadePrepare = true, t4.needsTerrainPrepare = true, t4.state = \"loaded\";\n }\n }\n } catch (e2) {\n if (delete t4.abortController, t4.aborted) t4.state = \"unloaded\";\n else if (e2) throw t4.state = \"errored\", e2;\n }\n });\n }\n readImageNow(t4) {\n return e._(this, void 0, void 0, function* () {\n if (\"undefined\" != typeof VideoFrame && e.V()) {\n const i2 = t4.width + 2, a2 = t4.height + 2;\n try {\n return new e.R({ width: i2, height: a2 }, yield e.W(t4, -1, -1, i2, a2));\n } catch (t5) {\n }\n }\n return o.getImageData(t4, 1);\n });\n }\n _getNeighboringTiles(t4) {\n const i2 = t4.canonical, a2 = Math.pow(2, i2.z), s2 = (i2.x - 1 + a2) % a2, o2 = 0 === i2.x ? t4.wrap - 1 : t4.wrap, r2 = (i2.x + 1 + a2) % a2, n2 = i2.x + 1 === a2 ? t4.wrap + 1 : t4.wrap, l2 = {};\n return l2[new e.S(t4.overscaledZ, o2, i2.z, s2, i2.y).key] = { backfilled: false }, l2[new e.S(t4.overscaledZ, n2, i2.z, r2, i2.y).key] = { backfilled: false }, i2.y > 0 && (l2[new e.S(t4.overscaledZ, o2, i2.z, s2, i2.y - 1).key] = { backfilled: false }, l2[new e.S(t4.overscaledZ, t4.wrap, i2.z, i2.x, i2.y - 1).key] = { backfilled: false }, l2[new e.S(t4.overscaledZ, n2, i2.z, r2, i2.y - 1).key] = { backfilled: false }), i2.y + 1 < a2 && (l2[new e.S(t4.overscaledZ, o2, i2.z, s2, i2.y + 1).key] = { backfilled: false }, l2[new e.S(t4.overscaledZ, t4.wrap, i2.z, i2.x, i2.y + 1).key] = { backfilled: false }, l2[new e.S(t4.overscaledZ, n2, i2.z, r2, i2.y + 1).key] = { backfilled: false }), l2;\n }\n unloadTile(t4) {\n return e._(this, void 0, void 0, function* () {\n t4.demTexture && this.map.painter.saveTileTexture(t4.demTexture), t4.fbo && (t4.fbo.destroy(), delete t4.fbo), t4.dem && delete t4.dem, delete t4.neighboringTiles, t4.state = \"unloaded\", t4.actor && (yield t4.actor.sendAsync({ type: \"RDT\", data: { type: this.type, uid: t4.uid, source: this.id } }));\n });\n }\n }\n class J extends e.E {\n constructor(t4, i2, a2, s2) {\n super(), this.id = t4, this.type = \"geojson\", this.minzoom = 0, this.maxzoom = 18, this.tileSize = 512, this.isTileClipped = true, this.reparseOverscaled = true, this._removed = false, this._pendingLoads = 0, this.actor = a2.getActor(), this.setEventedParent(s2), this._data = i2.data, this._options = e.e({}, i2), this._collectResourceTiming = i2.collectResourceTiming, void 0 !== i2.maxzoom && (this.maxzoom = i2.maxzoom), i2.type && (this.type = i2.type), i2.attribution && (this.attribution = i2.attribution), this.promoteId = i2.promoteId;\n const o2 = e.X / this.tileSize;\n void 0 !== i2.clusterMaxZoom && this.maxzoom <= i2.clusterMaxZoom && e.w(`The maxzoom value \"${this.maxzoom}\" is expected to be greater than the clusterMaxZoom value \"${i2.clusterMaxZoom}\".`), this.workerOptions = e.e({ source: this.id, cluster: i2.cluster || false, geojsonVtOptions: { buffer: (void 0 !== i2.buffer ? i2.buffer : 128) * o2, tolerance: (void 0 !== i2.tolerance ? i2.tolerance : 0.375) * o2, extent: e.X, maxZoom: this.maxzoom, lineMetrics: i2.lineMetrics || false, generateId: i2.generateId || false }, superclusterOptions: { maxZoom: void 0 !== i2.clusterMaxZoom ? i2.clusterMaxZoom : this.maxzoom - 1, minPoints: Math.max(2, i2.clusterMinPoints || 2), extent: e.X, radius: (i2.clusterRadius || 50) * o2, log: false, generateId: i2.generateId || false }, clusterProperties: i2.clusterProperties, filter: i2.filter }, i2.workerOptions), \"string\" == typeof this.promoteId && (this.workerOptions.promoteId = this.promoteId);\n }\n load() {\n return e._(this, void 0, void 0, function* () {\n yield this._updateWorkerData();\n });\n }\n onAdd(t4) {\n this.map = t4, this.load();\n }\n setData(t4) {\n return this._data = t4, this._updateWorkerData(), this;\n }\n updateData(t4) {\n return this._updateWorkerData(t4), this;\n }\n getData() {\n return e._(this, void 0, void 0, function* () {\n const t4 = e.e({ type: this.type }, this.workerOptions);\n return this.actor.sendAsync({ type: \"GD\", data: t4 });\n });\n }\n setClusterOptions(t4) {\n return this.workerOptions.cluster = t4.cluster, t4 && (void 0 !== t4.clusterRadius && (this.workerOptions.superclusterOptions.radius = t4.clusterRadius), void 0 !== t4.clusterMaxZoom && (this.workerOptions.superclusterOptions.maxZoom = t4.clusterMaxZoom)), this._updateWorkerData(), this;\n }\n getClusterExpansionZoom(t4) {\n return this.actor.sendAsync({ type: \"GCEZ\", data: { type: this.type, clusterId: t4, source: this.id } });\n }\n getClusterChildren(t4) {\n return this.actor.sendAsync({ type: \"GCC\", data: { type: this.type, clusterId: t4, source: this.id } });\n }\n getClusterLeaves(t4, e2, i2) {\n return this.actor.sendAsync({ type: \"GCL\", data: { type: this.type, source: this.id, clusterId: t4, limit: e2, offset: i2 } });\n }\n _updateWorkerData(t4) {\n return e._(this, void 0, void 0, function* () {\n const i2 = e.e({ type: this.type }, this.workerOptions);\n t4 ? i2.dataDiff = t4 : \"string\" == typeof this._data ? (i2.request = this.map._requestManager.transformRequest(o.resolveURL(this._data), \"Source\"), i2.request.collectResourceTiming = this._collectResourceTiming) : i2.data = JSON.stringify(this._data), this._pendingLoads++, this.fire(new e.k(\"dataloading\", { dataType: \"source\" }));\n try {\n const t5 = yield this.actor.sendAsync({ type: \"LD\", data: i2 });\n if (this._pendingLoads--, this._removed || t5.abandoned) return void this.fire(new e.k(\"dataabort\", { dataType: \"source\" }));\n let a2 = null;\n t5.resourceTiming && t5.resourceTiming[this.id] && (a2 = t5.resourceTiming[this.id].slice(0));\n const s2 = { dataType: \"source\" };\n this._collectResourceTiming && a2 && a2.length > 0 && e.e(s2, { resourceTiming: a2 }), this.fire(new e.k(\"data\", Object.assign(Object.assign({}, s2), { sourceDataType: \"metadata\" }))), this.fire(new e.k(\"data\", Object.assign(Object.assign({}, s2), { sourceDataType: \"content\" })));\n } catch (t5) {\n if (this._pendingLoads--, this._removed) return void this.fire(new e.k(\"dataabort\", { dataType: \"source\" }));\n this.fire(new e.j(t5));\n }\n });\n }\n loaded() {\n return 0 === this._pendingLoads;\n }\n loadTile(t4) {\n return e._(this, void 0, void 0, function* () {\n const e2 = t4.actor ? \"RT\" : \"LT\";\n t4.actor = this.actor;\n const i2 = { type: this.type, uid: t4.uid, tileID: t4.tileID, zoom: t4.tileID.overscaledZ, maxZoom: this.maxzoom, tileSize: this.tileSize, source: this.id, pixelRatio: this.map.getPixelRatio(), showCollisionBoxes: this.map.showCollisionBoxes, promoteId: this.promoteId };\n t4.abortController = new AbortController();\n const a2 = yield this.actor.sendAsync({ type: e2, data: i2 }, t4.abortController);\n delete t4.abortController, t4.unloadVectorData(), t4.aborted || t4.loadVectorData(a2, this.map.painter, \"RT\" === e2);\n });\n }\n abortTile(t4) {\n return e._(this, void 0, void 0, function* () {\n t4.abortController && (t4.abortController.abort(), delete t4.abortController), t4.aborted = true;\n });\n }\n unloadTile(t4) {\n return e._(this, void 0, void 0, function* () {\n t4.unloadVectorData(), yield this.actor.sendAsync({ type: \"RMT\", data: { uid: t4.uid, type: this.type, source: this.id } });\n });\n }\n onRemove() {\n this._removed = true, this.actor.sendAsync({ type: \"RS\", data: { type: this.type, source: this.id } });\n }\n serialize() {\n return e.e({}, this._options, { type: this.type, data: this._data });\n }\n hasTransition() {\n return false;\n }\n }\n var Y = e.Y([{ name: \"a_pos\", type: \"Int16\", components: 2 }, { name: \"a_texture_pos\", type: \"Int16\", components: 2 }]);\n class Q extends e.E {\n constructor(t4, e2, i2, a2) {\n super(), this.id = t4, this.dispatcher = i2, this.coordinates = e2.coordinates, this.type = \"image\", this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this.tiles = {}, this._loaded = false, this.setEventedParent(a2), this.options = e2;\n }\n load(t4) {\n return e._(this, void 0, void 0, function* () {\n this._loaded = false, this.fire(new e.k(\"dataloading\", { dataType: \"source\" })), this.url = this.options.url, this._request = new AbortController();\n try {\n const e2 = yield _.getImage(this.map._requestManager.transformRequest(this.url, \"Image\"), this._request);\n this._request = null, this._loaded = true, e2 && e2.data && (this.image = e2.data, t4 && (this.coordinates = t4), this._finishLoading());\n } catch (t5) {\n this._request = null, this._loaded = true, this.fire(new e.j(t5));\n }\n });\n }\n loaded() {\n return this._loaded;\n }\n updateImage(t4) {\n return t4.url ? (this._request && (this._request.abort(), this._request = null), this.options.url = t4.url, this.load(t4.coordinates).finally(() => {\n this.texture = null;\n }), this) : this;\n }\n _finishLoading() {\n this.map && (this.setCoordinates(this.coordinates), this.fire(new e.k(\"data\", { dataType: \"source\", sourceDataType: \"metadata\" })));\n }\n onAdd(t4) {\n this.map = t4, this.load();\n }\n onRemove() {\n this._request && (this._request.abort(), this._request = null);\n }\n setCoordinates(t4) {\n this.coordinates = t4;\n const i2 = t4.map(e.Z.fromLngLat);\n this.tileID = function(t5) {\n let i3 = 1 / 0, a3 = 1 / 0, s2 = -1 / 0, o2 = -1 / 0;\n for (const e2 of t5) i3 = Math.min(i3, e2.x), a3 = Math.min(a3, e2.y), s2 = Math.max(s2, e2.x), o2 = Math.max(o2, e2.y);\n const r2 = Math.max(s2 - i3, o2 - a3), n2 = Math.max(0, Math.floor(-Math.log(r2) / Math.LN2)), l2 = Math.pow(2, n2);\n return new e.a1(n2, Math.floor((i3 + s2) / 2 * l2), Math.floor((a3 + o2) / 2 * l2));\n }(i2), this.minzoom = this.maxzoom = this.tileID.z;\n const a2 = i2.map((t5) => this.tileID.getTilePoint(t5)._round());\n return this._boundsArray = new e.$(), this._boundsArray.emplaceBack(a2[0].x, a2[0].y, 0, 0), this._boundsArray.emplaceBack(a2[1].x, a2[1].y, e.X, 0), this._boundsArray.emplaceBack(a2[3].x, a2[3].y, 0, e.X), this._boundsArray.emplaceBack(a2[2].x, a2[2].y, e.X, e.X), this.boundsBuffer && (this.boundsBuffer.destroy(), delete this.boundsBuffer), this.fire(new e.k(\"data\", { dataType: \"source\", sourceDataType: \"content\" })), this;\n }\n prepare() {\n if (0 === Object.keys(this.tiles).length || !this.image) return;\n const t4 = this.map.painter.context, i2 = t4.gl;\n this.boundsBuffer || (this.boundsBuffer = t4.createVertexBuffer(this._boundsArray, Y.members)), this.boundsSegments || (this.boundsSegments = e.a0.simpleSegment(0, 0, 4, 2)), this.texture || (this.texture = new b(t4, this.image, i2.RGBA), this.texture.bind(i2.LINEAR, i2.CLAMP_TO_EDGE));\n let a2 = false;\n for (const t5 in this.tiles) {\n const e2 = this.tiles[t5];\n \"loaded\" !== e2.state && (e2.state = \"loaded\", e2.texture = this.texture, a2 = true);\n }\n a2 && this.fire(new e.k(\"data\", { dataType: \"source\", sourceDataType: \"idle\", sourceId: this.id }));\n }\n loadTile(t4) {\n return e._(this, void 0, void 0, function* () {\n this.tileID && this.tileID.equals(t4.tileID.canonical) ? (this.tiles[String(t4.tileID.wrap)] = t4, t4.buckets = {}) : t4.state = \"errored\";\n });\n }\n serialize() {\n return { type: \"image\", url: this.options.url, coordinates: this.coordinates };\n }\n hasTransition() {\n return false;\n }\n }\n class tt extends Q {\n constructor(t4, e2, i2, a2) {\n super(t4, e2, i2, a2), this.roundZoom = true, this.type = \"video\", this.options = e2;\n }\n load() {\n return e._(this, void 0, void 0, function* () {\n this._loaded = false;\n const t4 = this.options;\n this.urls = [];\n for (const e2 of t4.urls) this.urls.push(this.map._requestManager.transformRequest(e2, \"Source\").url);\n try {\n const t5 = yield e.a3(this.urls);\n if (this._loaded = true, !t5) return;\n this.video = t5, this.video.loop = true, this.video.addEventListener(\"playing\", () => {\n this.map.triggerRepaint();\n }), this.map && this.video.play(), this._finishLoading();\n } catch (t5) {\n this.fire(new e.j(t5));\n }\n });\n }\n pause() {\n this.video && this.video.pause();\n }\n play() {\n this.video && this.video.play();\n }\n seek(t4) {\n if (this.video) {\n const i2 = this.video.seekable;\n t4 < i2.start(0) || t4 > i2.end(0) ? this.fire(new e.j(new e.a2(`sources.${this.id}`, null, `Playback for this video can be set only between the ${i2.start(0)} and ${i2.end(0)}-second mark.`))) : this.video.currentTime = t4;\n }\n }\n getVideo() {\n return this.video;\n }\n onAdd(t4) {\n this.map || (this.map = t4, this.load(), this.video && (this.video.play(), this.setCoordinates(this.coordinates)));\n }\n prepare() {\n if (0 === Object.keys(this.tiles).length || this.video.readyState < 2) return;\n const t4 = this.map.painter.context, i2 = t4.gl;\n this.boundsBuffer || (this.boundsBuffer = t4.createVertexBuffer(this._boundsArray, Y.members)), this.boundsSegments || (this.boundsSegments = e.a0.simpleSegment(0, 0, 4, 2)), this.texture ? this.video.paused || (this.texture.bind(i2.LINEAR, i2.CLAMP_TO_EDGE), i2.texSubImage2D(i2.TEXTURE_2D, 0, 0, 0, i2.RGBA, i2.UNSIGNED_BYTE, this.video)) : (this.texture = new b(t4, this.video, i2.RGBA), this.texture.bind(i2.LINEAR, i2.CLAMP_TO_EDGE));\n let a2 = false;\n for (const t5 in this.tiles) {\n const e2 = this.tiles[t5];\n \"loaded\" !== e2.state && (e2.state = \"loaded\", e2.texture = this.texture, a2 = true);\n }\n a2 && this.fire(new e.k(\"data\", { dataType: \"source\", sourceDataType: \"idle\", sourceId: this.id }));\n }\n serialize() {\n return { type: \"video\", urls: this.urls, coordinates: this.coordinates };\n }\n hasTransition() {\n return this.video && !this.video.paused;\n }\n }\n class et extends Q {\n constructor(t4, i2, a2, s2) {\n super(t4, i2, a2, s2), i2.coordinates ? Array.isArray(i2.coordinates) && 4 === i2.coordinates.length && !i2.coordinates.some((t5) => !Array.isArray(t5) || 2 !== t5.length || t5.some((t6) => \"number\" != typeof t6)) || this.fire(new e.j(new e.a2(`sources.${t4}`, null, '\"coordinates\" property must be an array of 4 longitude/latitude array pairs'))) : this.fire(new e.j(new e.a2(`sources.${t4}`, null, 'missing required property \"coordinates\"'))), i2.animate && \"boolean\" != typeof i2.animate && this.fire(new e.j(new e.a2(`sources.${t4}`, null, 'optional \"animate\" property must be a boolean value'))), i2.canvas ? \"string\" == typeof i2.canvas || i2.canvas instanceof HTMLCanvasElement || this.fire(new e.j(new e.a2(`sources.${t4}`, null, '\"canvas\" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))) : this.fire(new e.j(new e.a2(`sources.${t4}`, null, 'missing required property \"canvas\"'))), this.options = i2, this.animate = void 0 === i2.animate || i2.animate;\n }\n load() {\n return e._(this, void 0, void 0, function* () {\n this._loaded = true, this.canvas || (this.canvas = this.options.canvas instanceof HTMLCanvasElement ? this.options.canvas : document.getElementById(this.options.canvas)), this.width = this.canvas.width, this.height = this.canvas.height, this._hasInvalidDimensions() ? this.fire(new e.j(new Error(\"Canvas dimensions cannot be less than or equal to zero.\"))) : (this.play = function() {\n this._playing = true, this.map.triggerRepaint();\n }, this.pause = function() {\n this._playing && (this.prepare(), this._playing = false);\n }, this._finishLoading());\n });\n }\n getCanvas() {\n return this.canvas;\n }\n onAdd(t4) {\n this.map = t4, this.load(), this.canvas && this.animate && this.play();\n }\n onRemove() {\n this.pause();\n }\n prepare() {\n let t4 = false;\n if (this.canvas.width !== this.width && (this.width = this.canvas.width, t4 = true), this.canvas.height !== this.height && (this.height = this.canvas.height, t4 = true), this._hasInvalidDimensions()) return;\n if (0 === Object.keys(this.tiles).length) return;\n const i2 = this.map.painter.context, a2 = i2.gl;\n this.boundsBuffer || (this.boundsBuffer = i2.createVertexBuffer(this._boundsArray, Y.members)), this.boundsSegments || (this.boundsSegments = e.a0.simpleSegment(0, 0, 4, 2)), this.texture ? (t4 || this._playing) && this.texture.update(this.canvas, { premultiply: true }) : this.texture = new b(i2, this.canvas, a2.RGBA, { premultiply: true });\n let s2 = false;\n for (const t5 in this.tiles) {\n const e2 = this.tiles[t5];\n \"loaded\" !== e2.state && (e2.state = \"loaded\", e2.texture = this.texture, s2 = true);\n }\n s2 && this.fire(new e.k(\"data\", { dataType: \"source\", sourceDataType: \"idle\", sourceId: this.id }));\n }\n serialize() {\n return { type: \"canvas\", coordinates: this.coordinates };\n }\n hasTransition() {\n return this._playing;\n }\n _hasInvalidDimensions() {\n for (const t4 of [this.canvas.width, this.canvas.height]) if (isNaN(t4) || t4 <= 0) return true;\n return false;\n }\n }\n const it = {}, at = (t4) => {\n switch (t4) {\n case \"geojson\":\n return J;\n case \"image\":\n return Q;\n case \"raster\":\n return X;\n case \"raster-dem\":\n return K2;\n case \"vector\":\n return $;\n case \"video\":\n return tt;\n case \"canvas\":\n return et;\n }\n return it[t4];\n }, st = \"RTLPluginLoaded\";\n class ot extends e.E {\n constructor() {\n super(...arguments), this.status = \"unavailable\", this.url = null, this.dispatcher = j();\n }\n _syncState(t4) {\n return this.status = t4, this.dispatcher.broadcast(\"SRPS\", { pluginStatus: t4, pluginURL: this.url }).catch((t5) => {\n throw this.status = \"error\", t5;\n });\n }\n getRTLTextPluginStatus() {\n return this.status;\n }\n clearRTLTextPlugin() {\n this.status = \"unavailable\", this.url = null;\n }\n setRTLTextPlugin(t4) {\n return e._(this, arguments, void 0, function* (t5, e2 = false) {\n if (this.url) throw new Error(\"setRTLTextPlugin cannot be called multiple times.\");\n if (this.url = o.resolveURL(t5), !this.url) throw new Error(`requested url ${t5} is invalid`);\n if (\"unavailable\" === this.status) {\n if (!e2) return this._requestImport();\n this.status = \"deferred\", this._syncState(this.status);\n } else if (\"requested\" === this.status) return this._requestImport();\n });\n }\n _requestImport() {\n return e._(this, void 0, void 0, function* () {\n yield this._syncState(\"loading\"), this.status = \"loaded\", this.fire(new e.k(st));\n });\n }\n lazyLoad() {\n \"unavailable\" === this.status ? this.status = \"requested\" : \"deferred\" === this.status && this._requestImport();\n }\n }\n let rt = null;\n function nt() {\n return rt || (rt = new ot()), rt;\n }\n class lt {\n constructor(t4, i2) {\n this.timeAdded = 0, this.fadeEndTime = 0, this.tileID = t4, this.uid = e.a4(), this.uses = 0, this.tileSize = i2, this.buckets = {}, this.expirationTime = null, this.queryPadding = 0, this.hasSymbolBuckets = false, this.hasRTLText = false, this.dependencies = {}, this.rtt = [], this.rttCoords = {}, this.expiredRequestCount = 0, this.state = \"loading\";\n }\n registerFadeDuration(t4) {\n const e2 = t4 + this.timeAdded;\n e2 < this.fadeEndTime || (this.fadeEndTime = e2);\n }\n wasRequested() {\n return \"errored\" === this.state || \"loaded\" === this.state || \"reloading\" === this.state;\n }\n clearTextures(t4) {\n this.demTexture && t4.saveTileTexture(this.demTexture), this.demTexture = null;\n }\n loadVectorData(t4, i2, a2) {\n if (this.hasData() && this.unloadVectorData(), this.state = \"loaded\", t4) {\n t4.featureIndex && (this.latestFeatureIndex = t4.featureIndex, t4.rawTileData ? (this.latestRawTileData = t4.rawTileData, this.latestFeatureIndex.rawTileData = t4.rawTileData) : this.latestRawTileData && (this.latestFeatureIndex.rawTileData = this.latestRawTileData)), this.collisionBoxArray = t4.collisionBoxArray, this.buckets = function(t5, e2) {\n const i3 = {};\n if (!e2) return i3;\n for (const a3 of t5) {\n const t6 = a3.layerIds.map((t7) => e2.getLayer(t7)).filter(Boolean);\n if (0 !== t6.length) {\n a3.layers = t6, a3.stateDependentLayerIds && (a3.stateDependentLayers = a3.stateDependentLayerIds.map((e3) => t6.filter((t7) => t7.id === e3)[0]));\n for (const e3 of t6) i3[e3.id] = a3;\n }\n }\n return i3;\n }(t4.buckets, i2.style), this.hasSymbolBuckets = false;\n for (const t5 in this.buckets) {\n const i3 = this.buckets[t5];\n if (i3 instanceof e.a6) {\n if (this.hasSymbolBuckets = true, !a2) break;\n i3.justReloaded = true;\n }\n }\n if (this.hasRTLText = false, this.hasSymbolBuckets) for (const t5 in this.buckets) {\n const i3 = this.buckets[t5];\n if (i3 instanceof e.a6 && i3.hasRTLText) {\n this.hasRTLText = true, nt().lazyLoad();\n break;\n }\n }\n this.queryPadding = 0;\n for (const t5 in this.buckets) {\n const e2 = this.buckets[t5];\n this.queryPadding = Math.max(this.queryPadding, i2.style.getLayer(t5).queryRadius(e2));\n }\n t4.imageAtlas && (this.imageAtlas = t4.imageAtlas), t4.glyphAtlasImage && (this.glyphAtlasImage = t4.glyphAtlasImage);\n } else this.collisionBoxArray = new e.a5();\n }\n unloadVectorData() {\n for (const t4 in this.buckets) this.buckets[t4].destroy();\n this.buckets = {}, this.imageAtlasTexture && this.imageAtlasTexture.destroy(), this.imageAtlas && (this.imageAtlas = null), this.glyphAtlasTexture && this.glyphAtlasTexture.destroy(), this.latestFeatureIndex = null, this.state = \"unloaded\";\n }\n getBucket(t4) {\n return this.buckets[t4.id];\n }\n upload(t4) {\n for (const e3 in this.buckets) {\n const i2 = this.buckets[e3];\n i2.uploadPending() && i2.upload(t4);\n }\n const e2 = t4.gl;\n this.imageAtlas && !this.imageAtlas.uploaded && (this.imageAtlasTexture = new b(t4, this.imageAtlas.image, e2.RGBA), this.imageAtlas.uploaded = true), this.glyphAtlasImage && (this.glyphAtlasTexture = new b(t4, this.glyphAtlasImage, e2.ALPHA), this.glyphAtlasImage = null);\n }\n prepare(t4) {\n this.imageAtlas && this.imageAtlas.patchUpdatedImages(t4, this.imageAtlasTexture);\n }\n queryRenderedFeatures(t4, e2, i2, a2, s2, o2, r2, n2, l2, h2) {\n return this.latestFeatureIndex && this.latestFeatureIndex.rawTileData ? this.latestFeatureIndex.query({ queryGeometry: a2, cameraQueryGeometry: s2, scale: o2, tileSize: this.tileSize, pixelPosMatrix: h2, transform: n2, params: r2, queryPadding: this.queryPadding * l2 }, t4, e2, i2) : {};\n }\n querySourceFeatures(t4, i2) {\n const a2 = this.latestFeatureIndex;\n if (!a2 || !a2.rawTileData) return;\n const s2 = a2.loadVTLayers(), o2 = i2 && i2.sourceLayer ? i2.sourceLayer : \"\", r2 = s2._geojsonTileLayer || s2[o2];\n if (!r2) return;\n const n2 = e.a7(i2 && i2.filter), { z: l2, x: h2, y: c2 } = this.tileID.canonical, u2 = { z: l2, x: h2, y: c2 };\n for (let i3 = 0; i3 < r2.length; i3++) {\n const s3 = r2.feature(i3);\n if (n2.needGeometry) {\n const t5 = e.a8(s3, true);\n if (!n2.filter(new e.z(this.tileID.overscaledZ), t5, this.tileID.canonical)) continue;\n } else if (!n2.filter(new e.z(this.tileID.overscaledZ), s3)) continue;\n const d2 = a2.getId(s3, o2), _2 = new e.a9(s3, l2, h2, c2, d2);\n _2.tile = u2, t4.push(_2);\n }\n }\n hasData() {\n return \"loaded\" === this.state || \"reloading\" === this.state || \"expired\" === this.state;\n }\n patternsLoaded() {\n return this.imageAtlas && !!Object.keys(this.imageAtlas.patternPositions).length;\n }\n setExpiryData(t4) {\n const i2 = this.expirationTime;\n if (t4.cacheControl) {\n const i3 = e.aa(t4.cacheControl);\n i3[\"max-age\"] && (this.expirationTime = Date.now() + 1e3 * i3[\"max-age\"]);\n } else t4.expires && (this.expirationTime = new Date(t4.expires).getTime());\n if (this.expirationTime) {\n const t5 = Date.now();\n let e2 = false;\n if (this.expirationTime > t5) e2 = false;\n else if (i2) if (this.expirationTime < i2) e2 = true;\n else {\n const a2 = this.expirationTime - i2;\n a2 ? this.expirationTime = t5 + Math.max(a2, 3e4) : e2 = true;\n }\n else e2 = true;\n e2 ? (this.expiredRequestCount++, this.state = \"expired\") : this.expiredRequestCount = 0;\n }\n }\n getExpiryTimeout() {\n if (this.expirationTime) return this.expiredRequestCount ? 1e3 * (1 << Math.min(this.expiredRequestCount - 1, 31)) : Math.min(this.expirationTime - (/* @__PURE__ */ new Date()).getTime(), Math.pow(2, 31) - 1);\n }\n setFeatureState(t4, e2) {\n if (!this.latestFeatureIndex || !this.latestFeatureIndex.rawTileData || 0 === Object.keys(t4).length) return;\n const i2 = this.latestFeatureIndex.loadVTLayers();\n for (const a2 in this.buckets) {\n if (!e2.style.hasLayer(a2)) continue;\n const s2 = this.buckets[a2], o2 = s2.layers[0].sourceLayer || \"_geojsonTileLayer\", r2 = i2[o2], n2 = t4[o2];\n if (!r2 || !n2 || 0 === Object.keys(n2).length) continue;\n s2.update(n2, r2, this.imageAtlas && this.imageAtlas.patternPositions || {});\n const l2 = e2 && e2.style && e2.style.getLayer(a2);\n l2 && (this.queryPadding = Math.max(this.queryPadding, l2.queryRadius(s2)));\n }\n }\n holdingForFade() {\n return void 0 !== this.symbolFadeHoldUntil;\n }\n symbolFadeFinished() {\n return !this.symbolFadeHoldUntil || this.symbolFadeHoldUntil < o.now();\n }\n clearFadeHold() {\n this.symbolFadeHoldUntil = void 0;\n }\n setHoldDuration(t4) {\n this.symbolFadeHoldUntil = o.now() + t4;\n }\n setDependencies(t4, e2) {\n const i2 = {};\n for (const t5 of e2) i2[t5] = true;\n this.dependencies[t4] = i2;\n }\n hasDependency(t4, e2) {\n for (const i2 of t4) {\n const t5 = this.dependencies[i2];\n if (t5) {\n for (const i3 of e2) if (t5[i3]) return true;\n }\n }\n return false;\n }\n }\n class ht {\n constructor(t4, e2) {\n this.max = t4, this.onRemove = e2, this.reset();\n }\n reset() {\n for (const t4 in this.data) for (const e2 of this.data[t4]) e2.timeout && clearTimeout(e2.timeout), this.onRemove(e2.value);\n return this.data = {}, this.order = [], this;\n }\n add(t4, e2, i2) {\n const a2 = t4.wrapped().key;\n void 0 === this.data[a2] && (this.data[a2] = []);\n const s2 = { value: e2, timeout: void 0 };\n if (void 0 !== i2 && (s2.timeout = setTimeout(() => {\n this.remove(t4, s2);\n }, i2)), this.data[a2].push(s2), this.order.push(a2), this.order.length > this.max) {\n const t5 = this._getAndRemoveByKey(this.order[0]);\n t5 && this.onRemove(t5);\n }\n return this;\n }\n has(t4) {\n return t4.wrapped().key in this.data;\n }\n getAndRemove(t4) {\n return this.has(t4) ? this._getAndRemoveByKey(t4.wrapped().key) : null;\n }\n _getAndRemoveByKey(t4) {\n const e2 = this.data[t4].shift();\n return e2.timeout && clearTimeout(e2.timeout), 0 === this.data[t4].length && delete this.data[t4], this.order.splice(this.order.indexOf(t4), 1), e2.value;\n }\n getByKey(t4) {\n const e2 = this.data[t4];\n return e2 ? e2[0].value : null;\n }\n get(t4) {\n return this.has(t4) ? this.data[t4.wrapped().key][0].value : null;\n }\n remove(t4, e2) {\n if (!this.has(t4)) return this;\n const i2 = t4.wrapped().key, a2 = void 0 === e2 ? 0 : this.data[i2].indexOf(e2), s2 = this.data[i2][a2];\n return this.data[i2].splice(a2, 1), s2.timeout && clearTimeout(s2.timeout), 0 === this.data[i2].length && delete this.data[i2], this.onRemove(s2.value), this.order.splice(this.order.indexOf(i2), 1), this;\n }\n setMaxSize(t4) {\n for (this.max = t4; this.order.length > this.max; ) {\n const t5 = this._getAndRemoveByKey(this.order[0]);\n t5 && this.onRemove(t5);\n }\n return this;\n }\n filter(t4) {\n const e2 = [];\n for (const i2 in this.data) for (const a2 of this.data[i2]) t4(a2.value) || e2.push(a2);\n for (const t5 of e2) this.remove(t5.value.tileID, t5);\n }\n }\n class ct {\n constructor() {\n this.state = {}, this.stateChanges = {}, this.deletedStates = {};\n }\n updateState(t4, i2, a2) {\n const s2 = String(i2);\n if (this.stateChanges[t4] = this.stateChanges[t4] || {}, this.stateChanges[t4][s2] = this.stateChanges[t4][s2] || {}, e.e(this.stateChanges[t4][s2], a2), null === this.deletedStates[t4]) {\n this.deletedStates[t4] = {};\n for (const e2 in this.state[t4]) e2 !== s2 && (this.deletedStates[t4][e2] = null);\n } else if (this.deletedStates[t4] && null === this.deletedStates[t4][s2]) {\n this.deletedStates[t4][s2] = {};\n for (const e2 in this.state[t4][s2]) a2[e2] || (this.deletedStates[t4][s2][e2] = null);\n } else for (const e2 in a2) this.deletedStates[t4] && this.deletedStates[t4][s2] && null === this.deletedStates[t4][s2][e2] && delete this.deletedStates[t4][s2][e2];\n }\n removeFeatureState(t4, e2, i2) {\n if (null === this.deletedStates[t4]) return;\n const a2 = String(e2);\n if (this.deletedStates[t4] = this.deletedStates[t4] || {}, i2 && void 0 !== e2) null !== this.deletedStates[t4][a2] && (this.deletedStates[t4][a2] = this.deletedStates[t4][a2] || {}, this.deletedStates[t4][a2][i2] = null);\n else if (void 0 !== e2) if (this.stateChanges[t4] && this.stateChanges[t4][a2]) for (i2 in this.deletedStates[t4][a2] = {}, this.stateChanges[t4][a2]) this.deletedStates[t4][a2][i2] = null;\n else this.deletedStates[t4][a2] = null;\n else this.deletedStates[t4] = null;\n }\n getState(t4, i2) {\n const a2 = String(i2), s2 = e.e({}, (this.state[t4] || {})[a2], (this.stateChanges[t4] || {})[a2]);\n if (null === this.deletedStates[t4]) return {};\n if (this.deletedStates[t4]) {\n const e2 = this.deletedStates[t4][i2];\n if (null === e2) return {};\n for (const t5 in e2) delete s2[t5];\n }\n return s2;\n }\n initializeTileState(t4, e2) {\n t4.setFeatureState(this.state, e2);\n }\n coalesceChanges(t4, i2) {\n const a2 = {};\n for (const t5 in this.stateChanges) {\n this.state[t5] = this.state[t5] || {};\n const i3 = {};\n for (const a3 in this.stateChanges[t5]) this.state[t5][a3] || (this.state[t5][a3] = {}), e.e(this.state[t5][a3], this.stateChanges[t5][a3]), i3[a3] = this.state[t5][a3];\n a2[t5] = i3;\n }\n for (const t5 in this.deletedStates) {\n this.state[t5] = this.state[t5] || {};\n const i3 = {};\n if (null === this.deletedStates[t5]) for (const e2 in this.state[t5]) i3[e2] = {}, this.state[t5][e2] = {};\n else for (const e2 in this.deletedStates[t5]) {\n if (null === this.deletedStates[t5][e2]) this.state[t5][e2] = {};\n else for (const i4 of Object.keys(this.deletedStates[t5][e2])) delete this.state[t5][e2][i4];\n i3[e2] = this.state[t5][e2];\n }\n a2[t5] = a2[t5] || {}, e.e(a2[t5], i3);\n }\n if (this.stateChanges = {}, this.deletedStates = {}, 0 !== Object.keys(a2).length) for (const e2 in t4) t4[e2].setFeatureState(a2, i2);\n }\n }\n class ut extends e.E {\n constructor(t4, e2, i2) {\n super(), this.id = t4, this.dispatcher = i2, this.on(\"data\", (t5) => this._dataHandler(t5)), this.on(\"dataloading\", () => {\n this._sourceErrored = false;\n }), this.on(\"error\", () => {\n this._sourceErrored = this._source.loaded();\n }), this._source = ((t5, e3, i3, a2) => {\n const s2 = new (at(e3.type))(t5, e3, i3, a2);\n if (s2.id !== t5) throw new Error(`Expected Source id to be ${t5} instead of ${s2.id}`);\n return s2;\n })(t4, e2, i2, this), this._tiles = {}, this._cache = new ht(0, (t5) => this._unloadTile(t5)), this._timers = {}, this._cacheTimers = {}, this._maxTileCacheSize = null, this._maxTileCacheZoomLevels = null, this._loadedParentTiles = {}, this._coveredTiles = {}, this._state = new ct(), this._didEmitContent = false, this._updated = false;\n }\n onAdd(t4) {\n this.map = t4, this._maxTileCacheSize = t4 ? t4._maxTileCacheSize : null, this._maxTileCacheZoomLevels = t4 ? t4._maxTileCacheZoomLevels : null, this._source && this._source.onAdd && this._source.onAdd(t4);\n }\n onRemove(t4) {\n this.clearTiles(), this._source && this._source.onRemove && this._source.onRemove(t4);\n }\n loaded() {\n if (this._sourceErrored) return true;\n if (!this._sourceLoaded) return false;\n if (!this._source.loaded()) return false;\n if (!(void 0 === this.used && void 0 === this.usedForTerrain || this.used || this.usedForTerrain)) return true;\n if (!this._updated) return false;\n for (const t4 in this._tiles) {\n const e2 = this._tiles[t4];\n if (\"loaded\" !== e2.state && \"errored\" !== e2.state) return false;\n }\n return true;\n }\n getSource() {\n return this._source;\n }\n pause() {\n this._paused = true;\n }\n resume() {\n if (!this._paused) return;\n const t4 = this._shouldReloadOnResume;\n this._paused = false, this._shouldReloadOnResume = false, t4 && this.reload(), this.transform && this.update(this.transform, this.terrain);\n }\n _loadTile(t4, i2, a2) {\n return e._(this, void 0, void 0, function* () {\n try {\n yield this._source.loadTile(t4), this._tileLoaded(t4, i2, a2);\n } catch (i3) {\n t4.state = \"errored\", 404 !== i3.status ? this._source.fire(new e.j(i3, { tile: t4 })) : this.update(this.transform, this.terrain);\n }\n });\n }\n _unloadTile(t4) {\n this._source.unloadTile && this._source.unloadTile(t4);\n }\n _abortTile(t4) {\n this._source.abortTile && this._source.abortTile(t4), this._source.fire(new e.k(\"dataabort\", { tile: t4, coord: t4.tileID, dataType: \"source\" }));\n }\n serialize() {\n return this._source.serialize();\n }\n prepare(t4) {\n this._source.prepare && this._source.prepare(), this._state.coalesceChanges(this._tiles, this.map ? this.map.painter : null);\n for (const e2 in this._tiles) {\n const i2 = this._tiles[e2];\n i2.upload(t4), i2.prepare(this.map.style.imageManager);\n }\n }\n getIds() {\n return Object.values(this._tiles).map((t4) => t4.tileID).sort(dt).map((t4) => t4.key);\n }\n getRenderableIds(t4) {\n const i2 = [];\n for (const e2 in this._tiles) this._isIdRenderable(e2, t4) && i2.push(this._tiles[e2]);\n return t4 ? i2.sort((t5, i3) => {\n const a2 = t5.tileID, s2 = i3.tileID, o2 = new e.P(a2.canonical.x, a2.canonical.y)._rotate(this.transform.angle), r2 = new e.P(s2.canonical.x, s2.canonical.y)._rotate(this.transform.angle);\n return a2.overscaledZ - s2.overscaledZ || r2.y - o2.y || r2.x - o2.x;\n }).map((t5) => t5.tileID.key) : i2.map((t5) => t5.tileID).sort(dt).map((t5) => t5.key);\n }\n hasRenderableParent(t4) {\n const e2 = this.findLoadedParent(t4, 0);\n return !!e2 && this._isIdRenderable(e2.tileID.key);\n }\n _isIdRenderable(t4, e2) {\n return this._tiles[t4] && this._tiles[t4].hasData() && !this._coveredTiles[t4] && (e2 || !this._tiles[t4].holdingForFade());\n }\n reload() {\n if (this._paused) this._shouldReloadOnResume = true;\n else {\n this._cache.reset();\n for (const t4 in this._tiles) \"errored\" !== this._tiles[t4].state && this._reloadTile(t4, \"reloading\");\n }\n }\n _reloadTile(t4, i2) {\n return e._(this, void 0, void 0, function* () {\n const e2 = this._tiles[t4];\n e2 && (\"loading\" !== e2.state && (e2.state = i2), yield this._loadTile(e2, t4, i2));\n });\n }\n _tileLoaded(t4, i2, a2) {\n t4.timeAdded = o.now(), \"expired\" === a2 && (t4.refreshedUponExpiration = true), this._setTileReloadTimer(i2, t4), \"raster-dem\" === this.getSource().type && t4.dem && this._backfillDEM(t4), this._state.initializeTileState(t4, this.map ? this.map.painter : null), t4.aborted || this._source.fire(new e.k(\"data\", { dataType: \"source\", tile: t4, coord: t4.tileID }));\n }\n _backfillDEM(t4) {\n const e2 = this.getRenderableIds();\n for (let a2 = 0; a2 < e2.length; a2++) {\n const s2 = e2[a2];\n if (t4.neighboringTiles && t4.neighboringTiles[s2]) {\n const e3 = this.getTileByID(s2);\n i2(t4, e3), i2(e3, t4);\n }\n }\n function i2(t5, e3) {\n t5.needsHillshadePrepare = true, t5.needsTerrainPrepare = true;\n let i3 = e3.tileID.canonical.x - t5.tileID.canonical.x;\n const a2 = e3.tileID.canonical.y - t5.tileID.canonical.y, s2 = Math.pow(2, t5.tileID.canonical.z), o2 = e3.tileID.key;\n 0 === i3 && 0 === a2 || Math.abs(a2) > 1 || (Math.abs(i3) > 1 && (1 === Math.abs(i3 + s2) ? i3 += s2 : 1 === Math.abs(i3 - s2) && (i3 -= s2)), e3.dem && t5.dem && (t5.dem.backfillBorder(e3.dem, i3, a2), t5.neighboringTiles && t5.neighboringTiles[o2] && (t5.neighboringTiles[o2].backfilled = true)));\n }\n }\n getTile(t4) {\n return this.getTileByID(t4.key);\n }\n getTileByID(t4) {\n return this._tiles[t4];\n }\n _retainLoadedChildren(t4, e2, i2, a2) {\n for (const s2 in this._tiles) {\n let o2 = this._tiles[s2];\n if (a2[s2] || !o2.hasData() || o2.tileID.overscaledZ <= e2 || o2.tileID.overscaledZ > i2) continue;\n let r2 = o2.tileID;\n for (; o2 && o2.tileID.overscaledZ > e2 + 1; ) {\n const t5 = o2.tileID.scaledTo(o2.tileID.overscaledZ - 1);\n o2 = this._tiles[t5.key], o2 && o2.hasData() && (r2 = t5);\n }\n let n2 = r2;\n for (; n2.overscaledZ > e2; ) if (n2 = n2.scaledTo(n2.overscaledZ - 1), t4[n2.key]) {\n a2[r2.key] = r2;\n break;\n }\n }\n }\n findLoadedParent(t4, e2) {\n if (t4.key in this._loadedParentTiles) {\n const i2 = this._loadedParentTiles[t4.key];\n return i2 && i2.tileID.overscaledZ >= e2 ? i2 : null;\n }\n for (let i2 = t4.overscaledZ - 1; i2 >= e2; i2--) {\n const e3 = t4.scaledTo(i2), a2 = this._getLoadedTile(e3);\n if (a2) return a2;\n }\n }\n findLoadedSibling(t4) {\n return this._getLoadedTile(t4);\n }\n _getLoadedTile(t4) {\n const e2 = this._tiles[t4.key];\n return e2 && e2.hasData() ? e2 : this._cache.getByKey(t4.wrapped().key);\n }\n updateCacheSize(t4) {\n const i2 = Math.ceil(t4.width / this._source.tileSize) + 1, a2 = Math.ceil(t4.height / this._source.tileSize) + 1, s2 = Math.floor(i2 * a2 * (null === this._maxTileCacheZoomLevels ? e.a.MAX_TILE_CACHE_ZOOM_LEVELS : this._maxTileCacheZoomLevels)), o2 = \"number\" == typeof this._maxTileCacheSize ? Math.min(this._maxTileCacheSize, s2) : s2;\n this._cache.setMaxSize(o2);\n }\n handleWrapJump(t4) {\n const e2 = Math.round((t4 - (void 0 === this._prevLng ? t4 : this._prevLng)) / 360);\n if (this._prevLng = t4, e2) {\n const t5 = {};\n for (const i2 in this._tiles) {\n const a2 = this._tiles[i2];\n a2.tileID = a2.tileID.unwrapTo(a2.tileID.wrap + e2), t5[a2.tileID.key] = a2;\n }\n this._tiles = t5;\n for (const t6 in this._timers) clearTimeout(this._timers[t6]), delete this._timers[t6];\n for (const t6 in this._tiles) this._setTileReloadTimer(t6, this._tiles[t6]);\n }\n }\n _updateCoveredAndRetainedTiles(t4, e2, i2, a2, s2, r2) {\n const n2 = {}, l2 = {}, h2 = Object.keys(t4), c2 = o.now();\n for (const i3 of h2) {\n const a3 = t4[i3], s3 = this._tiles[i3];\n if (!s3 || 0 !== s3.fadeEndTime && s3.fadeEndTime <= c2) continue;\n const o2 = this.findLoadedParent(a3, e2), r3 = this.findLoadedSibling(a3), h3 = o2 || r3 || null;\n h3 && (this._addTile(h3.tileID), n2[h3.tileID.key] = h3.tileID), l2[i3] = a3;\n }\n this._retainLoadedChildren(l2, a2, i2, t4);\n for (const e3 in n2) t4[e3] || (this._coveredTiles[e3] = true, t4[e3] = n2[e3]);\n if (r2) {\n const e3 = {}, i3 = {};\n for (const t5 of s2) this._tiles[t5.key].hasData() ? e3[t5.key] = t5 : i3[t5.key] = t5;\n for (const a3 in i3) {\n const s3 = i3[a3].children(this._source.maxzoom);\n this._tiles[s3[0].key] && this._tiles[s3[1].key] && this._tiles[s3[2].key] && this._tiles[s3[3].key] && (e3[s3[0].key] = t4[s3[0].key] = s3[0], e3[s3[1].key] = t4[s3[1].key] = s3[1], e3[s3[2].key] = t4[s3[2].key] = s3[2], e3[s3[3].key] = t4[s3[3].key] = s3[3], delete i3[a3]);\n }\n for (const a3 in i3) {\n const s3 = i3[a3], o2 = this.findLoadedParent(s3, this._source.minzoom), r3 = this.findLoadedSibling(s3), n3 = o2 || r3 || null;\n if (n3) {\n e3[n3.tileID.key] = t4[n3.tileID.key] = n3.tileID;\n for (const t5 in e3) e3[t5].isChildOf(n3.tileID) && delete e3[t5];\n }\n }\n for (const t5 in this._tiles) e3[t5] || (this._coveredTiles[t5] = true);\n }\n }\n update(t4, i2) {\n if (!this._sourceLoaded || this._paused) return;\n let a2;\n this.transform = t4, this.terrain = i2, this.updateCacheSize(t4), this.handleWrapJump(this.transform.center.lng), this._coveredTiles = {}, this.used || this.usedForTerrain ? this._source.tileID ? a2 = t4.getVisibleUnwrappedCoordinates(this._source.tileID).map((t5) => new e.S(t5.canonical.z, t5.wrap, t5.canonical.z, t5.canonical.x, t5.canonical.y)) : (a2 = t4.coveringTiles({ tileSize: this.usedForTerrain ? this.tileSize : this._source.tileSize, minzoom: this._source.minzoom, maxzoom: this._source.maxzoom, roundZoom: !this.usedForTerrain && this._source.roundZoom, reparseOverscaled: this._source.reparseOverscaled, terrain: i2 }), this._source.hasTile && (a2 = a2.filter((t5) => this._source.hasTile(t5)))) : a2 = [];\n const s2 = t4.coveringZoomLevel(this._source), o2 = Math.max(s2 - ut.maxOverzooming, this._source.minzoom), r2 = Math.max(s2 + ut.maxUnderzooming, this._source.minzoom);\n if (this.usedForTerrain) {\n const t5 = {};\n for (const e2 of a2) if (e2.canonical.z > this._source.minzoom) {\n const i3 = e2.scaledTo(e2.canonical.z - 1);\n t5[i3.key] = i3;\n const a3 = e2.scaledTo(Math.max(this._source.minzoom, Math.min(e2.canonical.z, 5)));\n t5[a3.key] = a3;\n }\n a2 = a2.concat(Object.values(t5));\n }\n const n2 = 0 === a2.length && !this._updated && this._didEmitContent;\n this._updated = true, n2 && this.fire(new e.k(\"data\", { sourceDataType: \"idle\", dataType: \"source\", sourceId: this.id }));\n const l2 = this._updateRetainedTiles(a2, s2);\n _t(this._source.type) && this._updateCoveredAndRetainedTiles(l2, o2, r2, s2, a2, i2);\n for (const t5 in l2) this._tiles[t5].clearFadeHold();\n const h2 = e.ab(this._tiles, l2);\n for (const t5 of h2) {\n const e2 = this._tiles[t5];\n e2.hasSymbolBuckets && !e2.holdingForFade() ? e2.setHoldDuration(this.map._fadeDuration) : e2.hasSymbolBuckets && !e2.symbolFadeFinished() || this._removeTile(t5);\n }\n this._updateLoadedParentTileCache(), this._updateLoadedSiblingTileCache();\n }\n releaseSymbolFadeTiles() {\n for (const t4 in this._tiles) this._tiles[t4].holdingForFade() && this._removeTile(t4);\n }\n _updateRetainedTiles(t4, e2) {\n var i2;\n const a2 = {}, s2 = {}, o2 = Math.max(e2 - ut.maxOverzooming, this._source.minzoom), r2 = Math.max(e2 + ut.maxUnderzooming, this._source.minzoom), n2 = {};\n for (const i3 of t4) {\n const t5 = this._addTile(i3);\n a2[i3.key] = i3, t5.hasData() || e2 < this._source.maxzoom && (n2[i3.key] = i3);\n }\n this._retainLoadedChildren(n2, e2, r2, a2);\n for (const r3 of t4) {\n let t5 = this._tiles[r3.key];\n if (t5.hasData()) continue;\n if (e2 + 1 > this._source.maxzoom) {\n const t6 = r3.children(this._source.maxzoom)[0], e3 = this.getTile(t6);\n if (e3 && e3.hasData()) {\n a2[t6.key] = t6;\n continue;\n }\n } else {\n const t6 = r3.children(this._source.maxzoom);\n if (a2[t6[0].key] && a2[t6[1].key] && a2[t6[2].key] && a2[t6[3].key]) continue;\n }\n let n3 = t5.wasRequested();\n for (let e3 = r3.overscaledZ - 1; e3 >= o2; --e3) {\n const o3 = r3.scaledTo(e3);\n if (s2[o3.key]) break;\n if (s2[o3.key] = true, t5 = this.getTile(o3), !t5 && n3 && (t5 = this._addTile(o3)), t5) {\n const e4 = t5.hasData();\n if ((e4 || !(null === (i2 = this.map) || void 0 === i2 ? void 0 : i2.cancelPendingTileRequestsWhileZooming) || n3) && (a2[o3.key] = o3), n3 = t5.wasRequested(), e4) break;\n }\n }\n }\n return a2;\n }\n _updateLoadedParentTileCache() {\n this._loadedParentTiles = {};\n for (const t4 in this._tiles) {\n const e2 = [];\n let i2, a2 = this._tiles[t4].tileID;\n for (; a2.overscaledZ > 0; ) {\n if (a2.key in this._loadedParentTiles) {\n i2 = this._loadedParentTiles[a2.key];\n break;\n }\n e2.push(a2.key);\n const t5 = a2.scaledTo(a2.overscaledZ - 1);\n if (i2 = this._getLoadedTile(t5), i2) break;\n a2 = t5;\n }\n for (const t5 of e2) this._loadedParentTiles[t5] = i2;\n }\n }\n _updateLoadedSiblingTileCache() {\n this._loadedSiblingTiles = {};\n for (const t4 in this._tiles) {\n const e2 = this._tiles[t4].tileID, i2 = this._getLoadedTile(e2);\n this._loadedSiblingTiles[e2.key] = i2;\n }\n }\n _addTile(t4) {\n let i2 = this._tiles[t4.key];\n if (i2) return i2;\n i2 = this._cache.getAndRemove(t4), i2 && (this._setTileReloadTimer(t4.key, i2), i2.tileID = t4, this._state.initializeTileState(i2, this.map ? this.map.painter : null), this._cacheTimers[t4.key] && (clearTimeout(this._cacheTimers[t4.key]), delete this._cacheTimers[t4.key], this._setTileReloadTimer(t4.key, i2)));\n const a2 = i2;\n return i2 || (i2 = new lt(t4, this._source.tileSize * t4.overscaleFactor()), this._loadTile(i2, t4.key, i2.state)), i2.uses++, this._tiles[t4.key] = i2, a2 || this._source.fire(new e.k(\"dataloading\", { tile: i2, coord: i2.tileID, dataType: \"source\" })), i2;\n }\n _setTileReloadTimer(t4, e2) {\n t4 in this._timers && (clearTimeout(this._timers[t4]), delete this._timers[t4]);\n const i2 = e2.getExpiryTimeout();\n i2 && (this._timers[t4] = setTimeout(() => {\n this._reloadTile(t4, \"expired\"), delete this._timers[t4];\n }, i2));\n }\n _removeTile(t4) {\n const e2 = this._tiles[t4];\n e2 && (e2.uses--, delete this._tiles[t4], this._timers[t4] && (clearTimeout(this._timers[t4]), delete this._timers[t4]), e2.uses > 0 || (e2.hasData() && \"reloading\" !== e2.state ? this._cache.add(e2.tileID, e2, e2.getExpiryTimeout()) : (e2.aborted = true, this._abortTile(e2), this._unloadTile(e2))));\n }\n _dataHandler(t4) {\n const e2 = t4.sourceDataType;\n \"source\" === t4.dataType && \"metadata\" === e2 && (this._sourceLoaded = true), this._sourceLoaded && !this._paused && \"source\" === t4.dataType && \"content\" === e2 && (this.reload(), this.transform && this.update(this.transform, this.terrain), this._didEmitContent = true);\n }\n clearTiles() {\n this._shouldReloadOnResume = false, this._paused = false;\n for (const t4 in this._tiles) this._removeTile(t4);\n this._cache.reset();\n }\n tilesIn(t4, i2, a2) {\n const s2 = [], o2 = this.transform;\n if (!o2) return s2;\n const r2 = a2 ? o2.getCameraQueryGeometry(t4) : t4, n2 = t4.map((t5) => o2.pointCoordinate(t5, this.terrain)), l2 = r2.map((t5) => o2.pointCoordinate(t5, this.terrain)), h2 = this.getIds();\n let c2 = 1 / 0, u2 = 1 / 0, d2 = -1 / 0, _2 = -1 / 0;\n for (const t5 of l2) c2 = Math.min(c2, t5.x), u2 = Math.min(u2, t5.y), d2 = Math.max(d2, t5.x), _2 = Math.max(_2, t5.y);\n for (let t5 = 0; t5 < h2.length; t5++) {\n const a3 = this._tiles[h2[t5]];\n if (a3.holdingForFade()) continue;\n const r3 = a3.tileID, p2 = Math.pow(2, o2.zoom - a3.tileID.overscaledZ), m2 = i2 * a3.queryPadding * e.X / a3.tileSize / p2, f2 = [r3.getTilePoint(new e.Z(c2, u2)), r3.getTilePoint(new e.Z(d2, _2))];\n if (f2[0].x - m2 < e.X && f2[0].y - m2 < e.X && f2[1].x + m2 >= 0 && f2[1].y + m2 >= 0) {\n const t6 = n2.map((t7) => r3.getTilePoint(t7)), e2 = l2.map((t7) => r3.getTilePoint(t7));\n s2.push({ tile: a3, tileID: r3, queryGeometry: t6, cameraQueryGeometry: e2, scale: p2 });\n }\n }\n return s2;\n }\n getVisibleCoordinates(t4) {\n const e2 = this.getRenderableIds(t4).map((t5) => this._tiles[t5].tileID);\n for (const t5 of e2) t5.posMatrix = this.transform.calculatePosMatrix(t5.toUnwrapped());\n return e2;\n }\n hasTransition() {\n if (this._source.hasTransition()) return true;\n if (_t(this._source.type)) {\n const t4 = o.now();\n for (const e2 in this._tiles) if (this._tiles[e2].fadeEndTime >= t4) return true;\n }\n return false;\n }\n setFeatureState(t4, e2, i2) {\n this._state.updateState(t4 = t4 || \"_geojsonTileLayer\", e2, i2);\n }\n removeFeatureState(t4, e2, i2) {\n this._state.removeFeatureState(t4 = t4 || \"_geojsonTileLayer\", e2, i2);\n }\n getFeatureState(t4, e2) {\n return this._state.getState(t4 = t4 || \"_geojsonTileLayer\", e2);\n }\n setDependencies(t4, e2, i2) {\n const a2 = this._tiles[t4];\n a2 && a2.setDependencies(e2, i2);\n }\n reloadTilesForDependencies(t4, e2) {\n for (const i2 in this._tiles) this._tiles[i2].hasDependency(t4, e2) && this._reloadTile(i2, \"reloading\");\n this._cache.filter((i2) => !i2.hasDependency(t4, e2));\n }\n }\n function dt(t4, e2) {\n const i2 = Math.abs(2 * t4.wrap) - +(t4.wrap < 0), a2 = Math.abs(2 * e2.wrap) - +(e2.wrap < 0);\n return t4.overscaledZ - e2.overscaledZ || a2 - i2 || e2.canonical.y - t4.canonical.y || e2.canonical.x - t4.canonical.x;\n }\n function _t(t4) {\n return \"raster\" === t4 || \"image\" === t4 || \"video\" === t4;\n }\n ut.maxOverzooming = 10, ut.maxUnderzooming = 3;\n class pt {\n constructor(t4, e2) {\n this.reset(t4, e2);\n }\n reset(t4, e2) {\n this.points = t4 || [], this._distances = [0];\n for (let t5 = 1; t5 < this.points.length; t5++) this._distances[t5] = this._distances[t5 - 1] + this.points[t5].dist(this.points[t5 - 1]);\n this.length = this._distances[this._distances.length - 1], this.padding = Math.min(e2 || 0, 0.5 * this.length), this.paddedLength = this.length - 2 * this.padding;\n }\n lerp(t4) {\n if (1 === this.points.length) return this.points[0];\n t4 = e.ac(t4, 0, 1);\n let i2 = 1, a2 = this._distances[i2];\n const s2 = t4 * this.paddedLength + this.padding;\n for (; a2 < s2 && i2 < this._distances.length; ) a2 = this._distances[++i2];\n const o2 = i2 - 1, r2 = this._distances[o2], n2 = a2 - r2, l2 = n2 > 0 ? (s2 - r2) / n2 : 0;\n return this.points[o2].mult(1 - l2).add(this.points[i2].mult(l2));\n }\n }\n function mt(t4, e2) {\n let i2 = true;\n return \"always\" === t4 || \"never\" !== t4 && \"never\" !== e2 || (i2 = false), i2;\n }\n class ft {\n constructor(t4, e2, i2) {\n const a2 = this.boxCells = [], s2 = this.circleCells = [];\n this.xCellCount = Math.ceil(t4 / i2), this.yCellCount = Math.ceil(e2 / i2);\n for (let t5 = 0; t5 < this.xCellCount * this.yCellCount; t5++) a2.push([]), s2.push([]);\n this.circleKeys = [], this.boxKeys = [], this.bboxes = [], this.circles = [], this.width = t4, this.height = e2, this.xScale = this.xCellCount / t4, this.yScale = this.yCellCount / e2, this.boxUid = 0, this.circleUid = 0;\n }\n keysLength() {\n return this.boxKeys.length + this.circleKeys.length;\n }\n insert(t4, e2, i2, a2, s2) {\n this._forEachCell(e2, i2, a2, s2, this._insertBoxCell, this.boxUid++), this.boxKeys.push(t4), this.bboxes.push(e2), this.bboxes.push(i2), this.bboxes.push(a2), this.bboxes.push(s2);\n }\n insertCircle(t4, e2, i2, a2) {\n this._forEachCell(e2 - a2, i2 - a2, e2 + a2, i2 + a2, this._insertCircleCell, this.circleUid++), this.circleKeys.push(t4), this.circles.push(e2), this.circles.push(i2), this.circles.push(a2);\n }\n _insertBoxCell(t4, e2, i2, a2, s2, o2) {\n this.boxCells[s2].push(o2);\n }\n _insertCircleCell(t4, e2, i2, a2, s2, o2) {\n this.circleCells[s2].push(o2);\n }\n _query(t4, e2, i2, a2, s2, o2, r2) {\n if (i2 < 0 || t4 > this.width || a2 < 0 || e2 > this.height) return [];\n const n2 = [];\n if (t4 <= 0 && e2 <= 0 && this.width <= i2 && this.height <= a2) {\n if (s2) return [{ key: null, x1: t4, y1: e2, x2: i2, y2: a2 }];\n for (let t5 = 0; t5 < this.boxKeys.length; t5++) n2.push({ key: this.boxKeys[t5], x1: this.bboxes[4 * t5], y1: this.bboxes[4 * t5 + 1], x2: this.bboxes[4 * t5 + 2], y2: this.bboxes[4 * t5 + 3] });\n for (let t5 = 0; t5 < this.circleKeys.length; t5++) {\n const e3 = this.circles[3 * t5], i3 = this.circles[3 * t5 + 1], a3 = this.circles[3 * t5 + 2];\n n2.push({ key: this.circleKeys[t5], x1: e3 - a3, y1: i3 - a3, x2: e3 + a3, y2: i3 + a3 });\n }\n } else this._forEachCell(t4, e2, i2, a2, this._queryCell, n2, { hitTest: s2, overlapMode: o2, seenUids: { box: {}, circle: {} } }, r2);\n return n2;\n }\n query(t4, e2, i2, a2) {\n return this._query(t4, e2, i2, a2, false, null);\n }\n hitTest(t4, e2, i2, a2, s2, o2) {\n return this._query(t4, e2, i2, a2, true, s2, o2).length > 0;\n }\n hitTestCircle(t4, e2, i2, a2, s2) {\n const o2 = t4 - i2, r2 = t4 + i2, n2 = e2 - i2, l2 = e2 + i2;\n if (r2 < 0 || o2 > this.width || l2 < 0 || n2 > this.height) return false;\n const h2 = [];\n return this._forEachCell(o2, n2, r2, l2, this._queryCellCircle, h2, { hitTest: true, overlapMode: a2, circle: { x: t4, y: e2, radius: i2 }, seenUids: { box: {}, circle: {} } }, s2), h2.length > 0;\n }\n _queryCell(t4, e2, i2, a2, s2, o2, r2, n2) {\n const { seenUids: l2, hitTest: h2, overlapMode: c2 } = r2, u2 = this.boxCells[s2];\n if (null !== u2) {\n const s3 = this.bboxes;\n for (const r3 of u2) if (!l2.box[r3]) {\n l2.box[r3] = true;\n const u3 = 4 * r3, d3 = this.boxKeys[r3];\n if (t4 <= s3[u3 + 2] && e2 <= s3[u3 + 3] && i2 >= s3[u3 + 0] && a2 >= s3[u3 + 1] && (!n2 || n2(d3)) && (!h2 || !mt(c2, d3.overlapMode)) && (o2.push({ key: d3, x1: s3[u3], y1: s3[u3 + 1], x2: s3[u3 + 2], y2: s3[u3 + 3] }), h2)) return true;\n }\n }\n const d2 = this.circleCells[s2];\n if (null !== d2) {\n const s3 = this.circles;\n for (const r3 of d2) if (!l2.circle[r3]) {\n l2.circle[r3] = true;\n const u3 = 3 * r3, d3 = this.circleKeys[r3];\n if (this._circleAndRectCollide(s3[u3], s3[u3 + 1], s3[u3 + 2], t4, e2, i2, a2) && (!n2 || n2(d3)) && (!h2 || !mt(c2, d3.overlapMode))) {\n const t5 = s3[u3], e3 = s3[u3 + 1], i3 = s3[u3 + 2];\n if (o2.push({ key: d3, x1: t5 - i3, y1: e3 - i3, x2: t5 + i3, y2: e3 + i3 }), h2) return true;\n }\n }\n }\n return false;\n }\n _queryCellCircle(t4, e2, i2, a2, s2, o2, r2, n2) {\n const { circle: l2, seenUids: h2, overlapMode: c2 } = r2, u2 = this.boxCells[s2];\n if (null !== u2) {\n const t5 = this.bboxes;\n for (const e3 of u2) if (!h2.box[e3]) {\n h2.box[e3] = true;\n const i3 = 4 * e3, a3 = this.boxKeys[e3];\n if (this._circleAndRectCollide(l2.x, l2.y, l2.radius, t5[i3 + 0], t5[i3 + 1], t5[i3 + 2], t5[i3 + 3]) && (!n2 || n2(a3)) && !mt(c2, a3.overlapMode)) return o2.push(true), true;\n }\n }\n const d2 = this.circleCells[s2];\n if (null !== d2) {\n const t5 = this.circles;\n for (const e3 of d2) if (!h2.circle[e3]) {\n h2.circle[e3] = true;\n const i3 = 3 * e3, a3 = this.circleKeys[e3];\n if (this._circlesCollide(t5[i3], t5[i3 + 1], t5[i3 + 2], l2.x, l2.y, l2.radius) && (!n2 || n2(a3)) && !mt(c2, a3.overlapMode)) return o2.push(true), true;\n }\n }\n }\n _forEachCell(t4, e2, i2, a2, s2, o2, r2, n2) {\n const l2 = this._convertToXCellCoord(t4), h2 = this._convertToYCellCoord(e2), c2 = this._convertToXCellCoord(i2), u2 = this._convertToYCellCoord(a2);\n for (let d2 = l2; d2 <= c2; d2++) for (let l3 = h2; l3 <= u2; l3++) if (s2.call(this, t4, e2, i2, a2, this.xCellCount * l3 + d2, o2, r2, n2)) return;\n }\n _convertToXCellCoord(t4) {\n return Math.max(0, Math.min(this.xCellCount - 1, Math.floor(t4 * this.xScale)));\n }\n _convertToYCellCoord(t4) {\n return Math.max(0, Math.min(this.yCellCount - 1, Math.floor(t4 * this.yScale)));\n }\n _circlesCollide(t4, e2, i2, a2, s2, o2) {\n const r2 = a2 - t4, n2 = s2 - e2, l2 = i2 + o2;\n return l2 * l2 > r2 * r2 + n2 * n2;\n }\n _circleAndRectCollide(t4, e2, i2, a2, s2, o2, r2) {\n const n2 = (o2 - a2) / 2, l2 = Math.abs(t4 - (a2 + n2));\n if (l2 > n2 + i2) return false;\n const h2 = (r2 - s2) / 2, c2 = Math.abs(e2 - (s2 + h2));\n if (c2 > h2 + i2) return false;\n if (l2 <= n2 || c2 <= h2) return true;\n const u2 = l2 - n2, d2 = c2 - h2;\n return u2 * u2 + d2 * d2 <= i2 * i2;\n }\n }\n function gt(t4, i2, a2, s2, o2) {\n const r2 = e.H();\n return i2 ? (e.K(r2, r2, [1 / o2, 1 / o2, 1]), a2 || e.ad(r2, r2, s2.angle)) : e.L(r2, s2.labelPlaneMatrix, t4), r2;\n }\n function vt(t4, i2, a2, s2, o2) {\n if (i2) {\n const i3 = e.ae(t4);\n return e.K(i3, i3, [o2, o2, 1]), a2 || e.ad(i3, i3, -s2.angle), i3;\n }\n return s2.glCoordMatrix;\n }\n function xt(t4, i2, a2, s2) {\n let o2;\n s2 ? (o2 = [t4, i2, s2(t4, i2), 1], e.af(o2, o2, a2)) : (o2 = [t4, i2, 0, 1], kt(o2, o2, a2));\n const r2 = o2[3];\n return { point: new e.P(o2[0] / r2, o2[1] / r2), signedDistanceFromCamera: r2, isOccluded: false };\n }\n function yt(t4, e2) {\n return 0.5 + t4 / e2 * 0.5;\n }\n function bt(t4, e2) {\n return t4.x >= -e2[0] && t4.x <= e2[0] && t4.y >= -e2[1] && t4.y <= e2[1];\n }\n function wt(t4, i2, a2, s2, o2, r2, n2, l2, h2, c2, u2, d2, _2, p2, m2) {\n const f2 = s2 ? t4.textSizeData : t4.iconSizeData, g2 = e.ag(f2, a2.transform.zoom), v2 = [256 / a2.width * 2 + 1, 256 / a2.height * 2 + 1], x2 = s2 ? t4.text.dynamicLayoutVertexArray : t4.icon.dynamicLayoutVertexArray;\n x2.clear();\n const y2 = t4.lineVertexArray, b2 = s2 ? t4.text.placedSymbolArray : t4.icon.placedSymbolArray, w2 = a2.transform.width / a2.transform.height;\n let T2 = false;\n for (let s3 = 0; s3 < b2.length; s3++) {\n const I2 = b2.get(s3);\n if (I2.hidden || I2.writingMode === e.ah.vertical && !T2) {\n Rt(I2.numGlyphs, x2);\n continue;\n }\n T2 = false;\n const E3 = xt(I2.anchorX, I2.anchorY, i2, m2);\n if (!bt(E3.point, v2)) {\n Rt(I2.numGlyphs, x2);\n continue;\n }\n const P2 = yt(a2.transform.cameraToCenterDistance, E3.signedDistanceFromCamera), C3 = e.ai(f2, g2, I2), S2 = n2 ? C3 / P2 : C3 * P2, z2 = { getElevation: m2, labelPlaneMatrix: o2, lineVertexArray: y2, pitchWithMap: n2, projectionCache: { projections: {}, offsets: {}, cachedAnchorPoint: void 0, anyProjectionOccluded: false }, projection: c2, tileAnchorPoint: new e.P(I2.anchorX, I2.anchorY), unwrappedTileID: u2, width: d2, height: _2, translation: p2 }, D3 = Et(z2, I2, S2, false, l2, i2, r2, t4.glyphOffsetArray, x2, w2, h2);\n T2 = D3.useVertical, (D3.notEnoughRoom || T2 || D3.needsFlipping && Et(z2, I2, S2, true, l2, i2, r2, t4.glyphOffsetArray, x2, w2, h2).notEnoughRoom) && Rt(I2.numGlyphs, x2);\n }\n s2 ? t4.text.dynamicLayoutVertexBuffer.updateData(x2) : t4.icon.dynamicLayoutVertexBuffer.updateData(x2);\n }\n function Tt(t4, e2, i2, a2, s2, o2, r2, n2) {\n const l2 = o2.glyphStartIndex + o2.numGlyphs, h2 = o2.lineStartIndex, c2 = o2.lineStartIndex + o2.lineLength, u2 = e2.getoffsetX(o2.glyphStartIndex), d2 = e2.getoffsetX(l2 - 1), _2 = Mt(t4 * u2, i2, a2, s2, o2.segment, h2, c2, n2, r2);\n if (!_2) return null;\n const p2 = Mt(t4 * d2, i2, a2, s2, o2.segment, h2, c2, n2, r2);\n return p2 ? n2.projectionCache.anyProjectionOccluded ? null : { first: _2, last: p2 } : null;\n }\n function It(t4, i2, a2, s2) {\n return t4 === e.ah.horizontal && Math.abs(a2.y - i2.y) > Math.abs(a2.x - i2.x) * s2 ? { useVertical: true } : (t4 === e.ah.vertical ? i2.y < a2.y : i2.x > a2.x) ? { needsFlipping: true } : null;\n }\n function Et(t4, i2, a2, s2, o2, r2, n2, l2, h2, c2, u2) {\n const d2 = a2 / 24, _2 = i2.lineOffsetX * d2, p2 = i2.lineOffsetY * d2;\n let m2;\n if (i2.numGlyphs > 1) {\n const e2 = i2.glyphStartIndex + i2.numGlyphs, a3 = i2.lineStartIndex, r3 = i2.lineStartIndex + i2.lineLength, h3 = Tt(d2, l2, _2, p2, s2, i2, u2, t4);\n if (!h3) return { notEnoughRoom: true };\n const f2 = xt(h3.first.point.x, h3.first.point.y, n2, t4.getElevation).point, g2 = xt(h3.last.point.x, h3.last.point.y, n2, t4.getElevation).point;\n if (o2 && !s2) {\n const t5 = It(i2.writingMode, f2, g2, c2);\n if (t5) return t5;\n }\n m2 = [h3.first];\n for (let o3 = i2.glyphStartIndex + 1; o3 < e2 - 1; o3++) m2.push(Mt(d2 * l2.getoffsetX(o3), _2, p2, s2, i2.segment, a3, r3, t4, u2));\n m2.push(h3.last);\n } else {\n if (o2 && !s2) {\n const a4 = xt(t4.tileAnchorPoint.x, t4.tileAnchorPoint.y, r2, t4.getElevation).point, s3 = i2.lineStartIndex + i2.segment + 1, o3 = new e.P(t4.lineVertexArray.getx(s3), t4.lineVertexArray.gety(s3)), n3 = xt(o3.x, o3.y, r2, t4.getElevation), l3 = n3.signedDistanceFromCamera > 0 ? n3.point : function(t5, e2, i3, a5, s4, o4) {\n return Pt(t5, e2, i3, 1, s4, o4);\n }(t4.tileAnchorPoint, o3, a4, 0, r2, t4), h3 = It(i2.writingMode, a4, l3, c2);\n if (h3) return h3;\n }\n const a3 = Mt(d2 * l2.getoffsetX(i2.glyphStartIndex), _2, p2, s2, i2.segment, i2.lineStartIndex, i2.lineStartIndex + i2.lineLength, t4, u2);\n if (!a3 || t4.projectionCache.anyProjectionOccluded) return { notEnoughRoom: true };\n m2 = [a3];\n }\n for (const t5 of m2) e.aj(h2, t5.point, t5.angle);\n return {};\n }\n function Pt(t4, e2, i2, a2, s2, o2) {\n const r2 = t4.add(t4.sub(e2)._unit()), n2 = void 0 !== s2 ? xt(r2.x, r2.y, s2, o2.getElevation).point : St(r2.x, r2.y, o2).point, l2 = i2.sub(n2);\n return i2.add(l2._mult(a2 / l2.mag()));\n }\n function Ct(t4, i2, a2) {\n const s2 = i2.projectionCache;\n if (s2.projections[t4]) return s2.projections[t4];\n const o2 = new e.P(i2.lineVertexArray.getx(t4), i2.lineVertexArray.gety(t4)), r2 = St(o2.x, o2.y, i2);\n if (r2.signedDistanceFromCamera > 0) return s2.projections[t4] = r2.point, s2.anyProjectionOccluded = s2.anyProjectionOccluded || r2.isOccluded, r2.point;\n const n2 = t4 - a2.direction;\n return function(t5, e2, i3, a3, s3) {\n return Pt(t5, e2, i3, a3, void 0, s3);\n }(0 === a2.distanceFromAnchor ? i2.tileAnchorPoint : new e.P(i2.lineVertexArray.getx(n2), i2.lineVertexArray.gety(n2)), o2, a2.previousVertex, a2.absOffsetX - a2.distanceFromAnchor + 1, i2);\n }\n function St(t4, e2, i2) {\n const a2 = t4 + i2.translation[0], s2 = e2 + i2.translation[1];\n let o2;\n return !i2.pitchWithMap && i2.projection.useSpecialProjectionForSymbols ? (o2 = i2.projection.projectTileCoordinates(a2, s2, i2.unwrappedTileID, i2.getElevation), o2.point.x = (0.5 * o2.point.x + 0.5) * i2.width, o2.point.y = (0.5 * -o2.point.y + 0.5) * i2.height) : (o2 = xt(a2, s2, i2.labelPlaneMatrix, i2.getElevation), o2.isOccluded = false), o2;\n }\n function zt(t4, e2, i2) {\n return t4._unit()._perp()._mult(e2 * i2);\n }\n function Dt(t4, i2, a2, s2, o2, r2, n2, l2, h2) {\n if (l2.projectionCache.offsets[t4]) return l2.projectionCache.offsets[t4];\n const c2 = a2.add(i2);\n if (t4 + h2.direction < s2 || t4 + h2.direction >= o2) return l2.projectionCache.offsets[t4] = c2, c2;\n const u2 = Ct(t4 + h2.direction, l2, h2), d2 = zt(u2.sub(a2), n2, h2.direction), _2 = a2.add(d2), p2 = u2.add(d2);\n return l2.projectionCache.offsets[t4] = e.ak(r2, c2, _2, p2) || c2, l2.projectionCache.offsets[t4];\n }\n function Mt(t4, e2, i2, a2, s2, o2, r2, n2, l2) {\n const h2 = a2 ? t4 - e2 : t4 + e2;\n let c2 = h2 > 0 ? 1 : -1, u2 = 0;\n a2 && (c2 *= -1, u2 = Math.PI), c2 < 0 && (u2 += Math.PI);\n let d2, _2 = c2 > 0 ? o2 + s2 : o2 + s2 + 1;\n n2.projectionCache.cachedAnchorPoint ? d2 = n2.projectionCache.cachedAnchorPoint : (d2 = St(n2.tileAnchorPoint.x, n2.tileAnchorPoint.y, n2).point, n2.projectionCache.cachedAnchorPoint = d2);\n let p2, m2, f2 = d2, g2 = d2, v2 = 0, x2 = 0;\n const y2 = Math.abs(h2), b2 = [];\n let w2;\n for (; v2 + x2 <= y2; ) {\n if (_2 += c2, _2 < o2 || _2 >= r2) return null;\n v2 += x2, g2 = f2, m2 = p2;\n const t5 = { absOffsetX: y2, direction: c2, distanceFromAnchor: v2, previousVertex: g2 };\n if (f2 = Ct(_2, n2, t5), 0 === i2) b2.push(g2), w2 = f2.sub(g2);\n else {\n let e3;\n const a3 = f2.sub(g2);\n e3 = 0 === a3.mag() ? zt(Ct(_2 + c2, n2, t5).sub(f2), i2, c2) : zt(a3, i2, c2), m2 || (m2 = g2.add(e3)), p2 = Dt(_2, e3, f2, o2, r2, m2, i2, n2, t5), b2.push(m2), w2 = p2.sub(m2);\n }\n x2 = w2.mag();\n }\n const T2 = w2._mult((y2 - v2) / x2)._add(m2 || g2), I2 = u2 + Math.atan2(f2.y - g2.y, f2.x - g2.x);\n return b2.push(T2), { point: T2, angle: l2 ? I2 : 0, path: b2 };\n }\n const At = new Float32Array([-1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0]);\n function Rt(t4, e2) {\n for (let i2 = 0; i2 < t4; i2++) {\n const t5 = e2.length;\n e2.resize(t5 + 4), e2.float32.set(At, 3 * t5);\n }\n }\n function kt(t4, e2, i2) {\n const a2 = e2[0], s2 = e2[1];\n return t4[0] = i2[0] * a2 + i2[4] * s2 + i2[12], t4[1] = i2[1] * a2 + i2[5] * s2 + i2[13], t4[3] = i2[3] * a2 + i2[7] * s2 + i2[15], t4;\n }\n const Lt = 100;\n class Ft {\n constructor(t4, e2, i2 = new ft(t4.width + 200, t4.height + 200, 25), a2 = new ft(t4.width + 200, t4.height + 200, 25)) {\n this.transform = t4, this.mapProjection = e2, this.grid = i2, this.ignoredGrid = a2, this.pitchFactor = Math.cos(t4._pitch) * t4.cameraToCenterDistance, this.screenRightBoundary = t4.width + Lt, this.screenBottomBoundary = t4.height + Lt, this.gridRightBoundary = t4.width + 200, this.gridBottomBoundary = t4.height + 200, this.perspectiveRatioCutoff = 0.6;\n }\n placeCollisionBox(t4, e2, i2, a2, s2, o2, r2, n2, l2, h2, c2) {\n const u2 = t4.anchorPointX + n2[0], d2 = t4.anchorPointY + n2[1], _2 = this.projectAndGetPerspectiveRatio(a2, u2, d2, s2, h2), p2 = i2 * _2.perspectiveRatio;\n let m2;\n if (o2 || r2) m2 = this._projectCollisionBox(t4, p2, a2, s2, o2, r2, n2, _2, h2, c2);\n else {\n const e3 = _2.point.x + (c2 ? c2.x * p2 : 0), i3 = _2.point.y + (c2 ? c2.y * p2 : 0);\n m2 = { allPointsOccluded: false, box: [e3 + t4.x1 * p2, i3 + t4.y1 * p2, e3 + t4.x2 * p2, i3 + t4.y2 * p2] };\n }\n const [f2, g2, v2, x2] = m2.box;\n return this.mapProjection.useSpecialProjectionForSymbols && (o2 ? m2.allPointsOccluded : this.mapProjection.isOccluded(u2, d2, s2)) || _2.perspectiveRatio < this.perspectiveRatioCutoff || !this.isInsideGrid(f2, g2, v2, x2) || \"always\" !== e2 && this.grid.hitTest(f2, g2, v2, x2, e2, l2) ? { box: [f2, g2, v2, x2], placeable: false, offscreen: false } : { box: [f2, g2, v2, x2], placeable: true, offscreen: this.isOffscreen(f2, g2, v2, x2) };\n }\n placeCollisionCircles(t4, i2, a2, s2, o2, r2, n2, l2, h2, c2, u2, d2, _2, p2, m2, f2) {\n const g2 = [], v2 = new e.P(i2.anchorX, i2.anchorY), x2 = this.getPerspectiveRatio(r2, v2.x, v2.y, n2, f2), y2 = (u2 ? o2 / x2 : o2 * x2) / e.ap, b2 = { getElevation: f2, labelPlaneMatrix: l2, lineVertexArray: a2, pitchWithMap: u2, projectionCache: { projections: {}, offsets: {}, cachedAnchorPoint: void 0, anyProjectionOccluded: false }, projection: this.mapProjection, tileAnchorPoint: v2, unwrappedTileID: n2, width: this.transform.width, height: this.transform.height, translation: m2 }, w2 = Tt(y2, s2, i2.lineOffsetX * y2, i2.lineOffsetY * y2, false, i2, false, b2);\n let T2 = false, I2 = false, E3 = true;\n if (w2) {\n const i3 = 0.5 * _2 * x2 + p2, a3 = new e.P(-100, -100), s3 = new e.P(this.screenRightBoundary, this.screenBottomBoundary), o3 = new pt(), r3 = w2.first, n3 = w2.last;\n let l3 = [];\n for (let t5 = r3.path.length - 1; t5 >= 1; t5--) l3.push(r3.path[t5]);\n for (let t5 = 1; t5 < n3.path.length; t5++) l3.push(n3.path[t5]);\n const u3 = 2.5 * i3;\n if (h2) {\n const t5 = this.projectPathToScreenSpace(l3, b2, h2);\n l3 = t5.some((t6) => t6.signedDistanceFromCamera <= 0) ? [] : t5.map((t6) => t6.point);\n }\n let m3 = [];\n if (l3.length > 0) {\n const t5 = l3[0].clone(), i4 = l3[0].clone();\n for (let e2 = 1; e2 < l3.length; e2++) t5.x = Math.min(t5.x, l3[e2].x), t5.y = Math.min(t5.y, l3[e2].y), i4.x = Math.max(i4.x, l3[e2].x), i4.y = Math.max(i4.y, l3[e2].y);\n m3 = t5.x >= a3.x && i4.x <= s3.x && t5.y >= a3.y && i4.y <= s3.y ? [l3] : i4.x < a3.x || t5.x > s3.x || i4.y < a3.y || t5.y > s3.y ? [] : e.al([l3], a3.x, a3.y, s3.x, s3.y);\n }\n for (const e2 of m3) {\n o3.reset(e2, 0.25 * i3);\n let a4 = 0;\n a4 = o3.length <= 0.5 * i3 ? 1 : Math.ceil(o3.paddedLength / u3) + 1;\n for (let e3 = 0; e3 < a4; e3++) {\n const s4 = e3 / Math.max(a4 - 1, 1), r4 = o3.lerp(s4), n4 = r4.x + Lt, l4 = r4.y + Lt;\n g2.push(n4, l4, i3, 0);\n const h3 = n4 - i3, u4 = l4 - i3, _3 = n4 + i3, p3 = l4 + i3;\n if (E3 = E3 && this.isOffscreen(h3, u4, _3, p3), I2 = I2 || this.isInsideGrid(h3, u4, _3, p3), \"always\" !== t4 && this.grid.hitTestCircle(n4, l4, i3, t4, d2) && (T2 = true, !c2)) return { circles: [], offscreen: false, collisionDetected: T2 };\n }\n }\n }\n return { circles: !c2 && T2 || !I2 || x2 < this.perspectiveRatioCutoff ? [] : g2, offscreen: E3, collisionDetected: T2 };\n }\n projectPathToScreenSpace(t4, e2, i2) {\n return t4.map((t5) => xt(t5.x, t5.y, i2, e2.getElevation));\n }\n queryRenderedSymbols(t4) {\n if (0 === t4.length || 0 === this.grid.keysLength() && 0 === this.ignoredGrid.keysLength()) return {};\n const i2 = [];\n let a2 = 1 / 0, s2 = 1 / 0, o2 = -1 / 0, r2 = -1 / 0;\n for (const n3 of t4) {\n const t5 = new e.P(n3.x + Lt, n3.y + Lt);\n a2 = Math.min(a2, t5.x), s2 = Math.min(s2, t5.y), o2 = Math.max(o2, t5.x), r2 = Math.max(r2, t5.y), i2.push(t5);\n }\n const n2 = this.grid.query(a2, s2, o2, r2).concat(this.ignoredGrid.query(a2, s2, o2, r2)), l2 = {}, h2 = {};\n for (const t5 of n2) {\n const a3 = t5.key;\n if (void 0 === l2[a3.bucketInstanceId] && (l2[a3.bucketInstanceId] = {}), l2[a3.bucketInstanceId][a3.featureIndex]) continue;\n const s3 = [new e.P(t5.x1, t5.y1), new e.P(t5.x2, t5.y1), new e.P(t5.x2, t5.y2), new e.P(t5.x1, t5.y2)];\n e.am(i2, s3) && (l2[a3.bucketInstanceId][a3.featureIndex] = true, void 0 === h2[a3.bucketInstanceId] && (h2[a3.bucketInstanceId] = []), h2[a3.bucketInstanceId].push(a3.featureIndex));\n }\n return h2;\n }\n insertCollisionBox(t4, e2, i2, a2, s2, o2) {\n (i2 ? this.ignoredGrid : this.grid).insert({ bucketInstanceId: a2, featureIndex: s2, collisionGroupID: o2, overlapMode: e2 }, t4[0], t4[1], t4[2], t4[3]);\n }\n insertCollisionCircles(t4, e2, i2, a2, s2, o2) {\n const r2 = i2 ? this.ignoredGrid : this.grid, n2 = { bucketInstanceId: a2, featureIndex: s2, collisionGroupID: o2, overlapMode: e2 };\n for (let e3 = 0; e3 < t4.length; e3 += 4) r2.insertCircle(n2, t4[e3], t4[e3 + 1], t4[e3 + 2]);\n }\n projectAndGetPerspectiveRatio(t4, i2, a2, s2, o2) {\n let r2;\n o2 ? (r2 = [i2, a2, o2(i2, a2), 1], e.af(r2, r2, t4)) : (r2 = [i2, a2, 0, 1], kt(r2, r2, t4));\n const n2 = r2[3];\n return { point: new e.P((r2[0] / n2 + 1) / 2 * this.transform.width + Lt, (-r2[1] / n2 + 1) / 2 * this.transform.height + Lt), perspectiveRatio: 0.5 + this.transform.cameraToCenterDistance / n2 * 0.5, isOccluded: false, signedDistanceFromCamera: n2 };\n }\n getPerspectiveRatio(t4, e2, i2, a2, s2) {\n const o2 = this.mapProjection.useSpecialProjectionForSymbols ? this.mapProjection.projectTileCoordinates(e2, i2, a2, s2) : xt(e2, i2, t4, s2);\n return 0.5 + this.transform.cameraToCenterDistance / o2.signedDistanceFromCamera * 0.5;\n }\n isOffscreen(t4, e2, i2, a2) {\n return i2 < Lt || t4 >= this.screenRightBoundary || a2 < Lt || e2 > this.screenBottomBoundary;\n }\n isInsideGrid(t4, e2, i2, a2) {\n return i2 >= 0 && t4 < this.gridRightBoundary && a2 >= 0 && e2 < this.gridBottomBoundary;\n }\n getViewportMatrix() {\n const t4 = e.an([]);\n return e.J(t4, t4, [-100, -100, 0]), t4;\n }\n _projectCollisionBox(t4, i2, a2, s2, o2, r2, n2, l2, h2, c2) {\n let u2 = new e.P(1, 0), d2 = new e.P(0, 1);\n const _2 = new e.P(t4.anchorPointX + n2[0], t4.anchorPointY + n2[1]);\n if (r2 && !o2) {\n const t5 = this.projectAndGetPerspectiveRatio(a2, _2.x + 1, _2.y, s2, h2).point.sub(l2.point).unit(), i3 = Math.atan(t5.y / t5.x) + (t5.x < 0 ? Math.PI : 0), o3 = Math.sin(i3), r3 = Math.cos(i3);\n u2 = new e.P(r3, o3), d2 = new e.P(-o3, r3);\n } else if (!r2 && o2) {\n const t5 = -this.transform.angle, i3 = Math.sin(t5), a3 = Math.cos(t5);\n u2 = new e.P(a3, i3), d2 = new e.P(-i3, a3);\n }\n let p2 = l2.point, m2 = i2;\n if (o2) {\n p2 = _2;\n const t5 = this.transform.zoom - Math.floor(this.transform.zoom);\n m2 = Math.pow(2, -t5), m2 *= this.mapProjection.getPitchedTextCorrection(this.transform, _2, s2), c2 || (m2 *= e.ac(0.5 + l2.signedDistanceFromCamera / this.transform.cameraToCenterDistance * 0.5, 0, 4));\n }\n c2 && (p2 = p2.add(u2.mult(c2.x * m2)).add(d2.mult(c2.y * m2)));\n const f2 = t4.x1 * m2, g2 = t4.x2 * m2, v2 = (f2 + g2) / 2, x2 = t4.y1 * m2, y2 = t4.y2 * m2, b2 = (x2 + y2) / 2, w2 = [{ offsetX: f2, offsetY: x2 }, { offsetX: v2, offsetY: x2 }, { offsetX: g2, offsetY: x2 }, { offsetX: g2, offsetY: b2 }, { offsetX: g2, offsetY: y2 }, { offsetX: v2, offsetY: y2 }, { offsetX: f2, offsetY: y2 }, { offsetX: f2, offsetY: b2 }];\n let T2 = [];\n for (const { offsetX: t5, offsetY: i3 } of w2) T2.push(new e.P(p2.x + u2.x * t5 + d2.x * i3, p2.y + u2.y * t5 + d2.y * i3));\n let I2 = false;\n if (o2) {\n const t5 = T2.map((t6) => this.projectAndGetPerspectiveRatio(a2, t6.x, t6.y, s2, h2));\n I2 = t5.some((t6) => !t6.isOccluded), T2 = t5.map((t6) => t6.point);\n } else I2 = true;\n return { box: e.ao(T2), allPointsOccluded: !I2 };\n }\n }\n function Bt(t4, i2, a2) {\n return i2 * (e.X / (t4.tileSize * Math.pow(2, a2 - t4.tileID.overscaledZ)));\n }\n class Ot {\n constructor(t4, e2, i2, a2) {\n this.opacity = t4 ? Math.max(0, Math.min(1, t4.opacity + (t4.placed ? e2 : -e2))) : a2 && i2 ? 1 : 0, this.placed = i2;\n }\n isHidden() {\n return 0 === this.opacity && !this.placed;\n }\n }\n class Nt {\n constructor(t4, e2, i2, a2, s2) {\n this.text = new Ot(t4 ? t4.text : null, e2, i2, s2), this.icon = new Ot(t4 ? t4.icon : null, e2, a2, s2);\n }\n isHidden() {\n return this.text.isHidden() && this.icon.isHidden();\n }\n }\n class Ut {\n constructor(t4, e2, i2) {\n this.text = t4, this.icon = e2, this.skipFade = i2;\n }\n }\n class jt {\n constructor() {\n this.invProjMatrix = e.H(), this.viewportMatrix = e.H(), this.circles = [];\n }\n }\n class Zt {\n constructor(t4, e2, i2, a2, s2) {\n this.bucketInstanceId = t4, this.featureIndex = e2, this.sourceLayerIndex = i2, this.bucketIndex = a2, this.tileID = s2;\n }\n }\n class qt {\n constructor(t4) {\n this.crossSourceCollisions = t4, this.maxGroupID = 0, this.collisionGroups = {};\n }\n get(t4) {\n if (this.crossSourceCollisions) return { ID: 0, predicate: null };\n if (!this.collisionGroups[t4]) {\n const e2 = ++this.maxGroupID;\n this.collisionGroups[t4] = { ID: e2, predicate: (t5) => t5.collisionGroupID === e2 };\n }\n return this.collisionGroups[t4];\n }\n }\n function Vt(t4, i2, a2, s2, o2) {\n const { horizontalAlign: r2, verticalAlign: n2 } = e.au(t4);\n return new e.P(-(r2 - 0.5) * i2 + s2[0] * o2, -(n2 - 0.5) * a2 + s2[1] * o2);\n }\n class Gt {\n constructor(t4, e2, i2, a2, s2, o2) {\n this.transform = t4.clone(), this.terrain = i2, this.collisionIndex = new Ft(this.transform, e2), this.placements = {}, this.opacities = {}, this.variableOffsets = {}, this.stale = false, this.commitTime = 0, this.fadeDuration = a2, this.retainedQueryData = {}, this.collisionGroups = new qt(s2), this.collisionCircleArrays = {}, this.collisionBoxArrays = /* @__PURE__ */ new Map(), this.prevPlacement = o2, o2 && (o2.prevPlacement = void 0), this.placedOrientations = {};\n }\n _getTerrainElevationFunc(t4) {\n const e2 = this.terrain;\n return e2 ? (i2, a2) => e2.getElevation(t4, i2, a2) : null;\n }\n getBucketParts(t4, i2, a2, s2) {\n const o2 = a2.getBucket(i2), r2 = a2.latestFeatureIndex;\n if (!o2 || !r2 || i2.id !== o2.layerIds[0]) return;\n const n2 = a2.collisionBoxArray, l2 = o2.layers[0].layout, h2 = o2.layers[0].paint, c2 = Math.pow(2, this.transform.zoom - a2.tileID.overscaledZ), u2 = a2.tileSize / e.X, d2 = a2.tileID.toUnwrapped(), _2 = this.transform.calculatePosMatrix(d2), p2 = \"map\" === l2.get(\"text-pitch-alignment\"), m2 = \"map\" === l2.get(\"text-rotation-alignment\"), f2 = Bt(a2, 1, this.transform.zoom), g2 = this.collisionIndex.mapProjection.translatePosition(this.transform, a2, h2.get(\"text-translate\"), h2.get(\"text-translate-anchor\")), v2 = this.collisionIndex.mapProjection.translatePosition(this.transform, a2, h2.get(\"icon-translate\"), h2.get(\"icon-translate-anchor\")), x2 = gt(_2, p2, m2, this.transform, f2);\n let y2 = null;\n if (p2) {\n const t5 = vt(_2, p2, m2, this.transform, f2);\n y2 = e.L([], this.transform.labelPlaneMatrix, t5);\n }\n this.retainedQueryData[o2.bucketInstanceId] = new Zt(o2.bucketInstanceId, r2, o2.sourceLayerIndex, o2.index, a2.tileID);\n const b2 = { bucket: o2, layout: l2, translationText: g2, translationIcon: v2, posMatrix: _2, unwrappedTileID: d2, textLabelPlaneMatrix: x2, labelToScreenMatrix: y2, scale: c2, textPixelRatio: u2, holdingForFade: a2.holdingForFade(), collisionBoxArray: n2, partiallyEvaluatedTextSize: e.ag(o2.textSizeData, this.transform.zoom), collisionGroup: this.collisionGroups.get(o2.sourceID) };\n if (s2) for (const e2 of o2.sortKeyRanges) {\n const { sortKey: i3, symbolInstanceStart: a3, symbolInstanceEnd: s3 } = e2;\n t4.push({ sortKey: i3, symbolInstanceStart: a3, symbolInstanceEnd: s3, parameters: b2 });\n }\n else t4.push({ symbolInstanceStart: 0, symbolInstanceEnd: o2.symbolInstances.length, parameters: b2 });\n }\n attemptAnchorPlacement(t4, i2, a2, s2, o2, r2, n2, l2, h2, c2, u2, d2, _2, p2, m2, f2, g2, v2, x2) {\n const y2 = e.aq[t4.textAnchor], b2 = [t4.textOffset0, t4.textOffset1], w2 = Vt(y2, a2, s2, b2, o2), T2 = this.collisionIndex.placeCollisionBox(i2, d2, l2, h2, c2, n2, r2, f2, u2.predicate, x2, w2);\n if ((!v2 || this.collisionIndex.placeCollisionBox(v2, d2, l2, h2, c2, n2, r2, g2, u2.predicate, x2, w2).placeable) && T2.placeable) {\n let t5;\n if (this.prevPlacement && this.prevPlacement.variableOffsets[_2.crossTileID] && this.prevPlacement.placements[_2.crossTileID] && this.prevPlacement.placements[_2.crossTileID].text && (t5 = this.prevPlacement.variableOffsets[_2.crossTileID].anchor), 0 === _2.crossTileID) throw new Error(\"symbolInstance.crossTileID can't be 0\");\n return this.variableOffsets[_2.crossTileID] = { textOffset: b2, width: a2, height: s2, anchor: y2, textBoxScale: o2, prevAnchor: t5 }, this.markUsedJustification(p2, y2, _2, m2), p2.allowVerticalPlacement && (this.markUsedOrientation(p2, m2, _2), this.placedOrientations[_2.crossTileID] = m2), { shift: w2, placedGlyphBoxes: T2 };\n }\n }\n placeLayerBucketPart(t4, i2, a2) {\n const { bucket: s2, layout: o2, translationText: r2, translationIcon: n2, posMatrix: l2, unwrappedTileID: h2, textLabelPlaneMatrix: c2, labelToScreenMatrix: u2, textPixelRatio: d2, holdingForFade: _2, collisionBoxArray: p2, partiallyEvaluatedTextSize: m2, collisionGroup: f2 } = t4.parameters, g2 = o2.get(\"text-optional\"), v2 = o2.get(\"icon-optional\"), x2 = e.ar(o2, \"text-overlap\", \"text-allow-overlap\"), y2 = \"always\" === x2, b2 = e.ar(o2, \"icon-overlap\", \"icon-allow-overlap\"), w2 = \"always\" === b2, T2 = \"map\" === o2.get(\"text-rotation-alignment\"), I2 = \"map\" === o2.get(\"text-pitch-alignment\"), E3 = \"none\" !== o2.get(\"icon-text-fit\"), P2 = \"viewport-y\" === o2.get(\"symbol-z-order\"), C3 = y2 && (w2 || !s2.hasIconData() || v2), S2 = w2 && (y2 || !s2.hasTextData() || g2);\n !s2.collisionArrays && p2 && s2.deserializeCollisionBoxes(p2);\n const z2 = this._getTerrainElevationFunc(this.retainedQueryData[s2.bucketInstanceId].tileID), D3 = (t5, p3, w3) => {\n var P3, D4;\n if (i2[t5.crossTileID]) return;\n if (_2) return void (this.placements[t5.crossTileID] = new Ut(false, false, false));\n let M2 = false, A3 = false, R2 = true, k2 = null, L2 = { box: null, placeable: false, offscreen: null }, F2 = { box: null, placeable: false, offscreen: null }, B3 = null, O2 = null, N2 = null, U2 = 0, j2 = 0, Z2 = 0;\n p3.textFeatureIndex ? U2 = p3.textFeatureIndex : t5.useRuntimeCollisionCircles && (U2 = t5.featureIndex), p3.verticalTextFeatureIndex && (j2 = p3.verticalTextFeatureIndex);\n const q2 = p3.textBox;\n if (q2) {\n const i3 = (i4) => {\n let a3 = e.ah.horizontal;\n if (s2.allowVerticalPlacement && !i4 && this.prevPlacement) {\n const e2 = this.prevPlacement.placedOrientations[t5.crossTileID];\n e2 && (this.placedOrientations[t5.crossTileID] = e2, a3 = e2, this.markUsedOrientation(s2, a3, t5));\n }\n return a3;\n }, o3 = (i4, a3) => {\n if (s2.allowVerticalPlacement && t5.numVerticalGlyphVertices > 0 && p3.verticalTextBox) {\n for (const t6 of s2.writingModes) if (t6 === e.ah.vertical ? (L2 = a3(), F2 = L2) : L2 = i4(), L2 && L2.placeable) break;\n } else L2 = i4();\n }, c3 = t5.textAnchorOffsetStartIndex, u3 = t5.textAnchorOffsetEndIndex;\n if (u3 === c3) {\n const a3 = (e2, i4) => {\n const a4 = this.collisionIndex.placeCollisionBox(e2, x2, d2, l2, h2, I2, T2, r2, f2.predicate, z2);\n return a4 && a4.placeable && (this.markUsedOrientation(s2, i4, t5), this.placedOrientations[t5.crossTileID] = i4), a4;\n };\n o3(() => a3(q2, e.ah.horizontal), () => {\n const i4 = p3.verticalTextBox;\n return s2.allowVerticalPlacement && t5.numVerticalGlyphVertices > 0 && i4 ? a3(i4, e.ah.vertical) : { box: null, offscreen: null };\n }), i3(L2 && L2.placeable);\n } else {\n let _3 = e.aq[null === (D4 = null === (P3 = this.prevPlacement) || void 0 === P3 ? void 0 : P3.variableOffsets[t5.crossTileID]) || void 0 === D4 ? void 0 : D4.anchor];\n const m3 = (i4, o4, p4) => {\n const m4 = i4.x2 - i4.x1, g4 = i4.y2 - i4.y1, v3 = t5.textBoxScale, y3 = E3 && \"never\" === b2 ? o4 : null;\n let w4 = null, P4 = \"never\" === x2 ? 1 : 2, C4 = \"never\";\n _3 && P4++;\n for (let e2 = 0; e2 < P4; e2++) {\n for (let e3 = c3; e3 < u3; e3++) {\n const a3 = s2.textAnchorOffsets.get(e3);\n if (_3 && a3.textAnchor !== _3) continue;\n const o5 = this.attemptAnchorPlacement(a3, i4, m4, g4, v3, T2, I2, d2, l2, h2, f2, C4, t5, s2, p4, r2, n2, y3, z2);\n if (o5 && (w4 = o5.placedGlyphBoxes, w4 && w4.placeable)) return M2 = true, k2 = o5.shift, w4;\n }\n _3 ? _3 = null : C4 = x2;\n }\n return a2 && !w4 && (w4 = { box: this.collisionIndex.placeCollisionBox(q2, \"always\", d2, l2, h2, I2, T2, r2, f2.predicate, z2, new e.P(0, 0)).box, offscreen: false, placeable: false }), w4;\n };\n o3(() => m3(q2, p3.iconBox, e.ah.horizontal), () => {\n const i4 = p3.verticalTextBox;\n return s2.allowVerticalPlacement && (!L2 || !L2.placeable) && t5.numVerticalGlyphVertices > 0 && i4 ? m3(i4, p3.verticalIconBox, e.ah.vertical) : { box: null, occluded: true, offscreen: null };\n }), L2 && (M2 = L2.placeable, R2 = L2.offscreen);\n const g3 = i3(L2 && L2.placeable);\n if (!M2 && this.prevPlacement) {\n const e2 = this.prevPlacement.variableOffsets[t5.crossTileID];\n e2 && (this.variableOffsets[t5.crossTileID] = e2, this.markUsedJustification(s2, e2.anchor, t5, g3));\n }\n }\n }\n if (B3 = L2, M2 = B3 && B3.placeable, R2 = B3 && B3.offscreen, t5.useRuntimeCollisionCircles) {\n const i3 = s2.text.placedSymbolArray.get(t5.centerJustifiedTextSymbolIndex), n3 = e.ai(s2.textSizeData, m2, i3), d3 = o2.get(\"text-padding\");\n O2 = this.collisionIndex.placeCollisionCircles(x2, i3, s2.lineVertexArray, s2.glyphOffsetArray, n3, l2, h2, c2, u2, a2, I2, f2.predicate, t5.collisionCircleDiameter, d3, r2, z2), O2.circles.length && O2.collisionDetected && !a2 && e.w(\"Collisions detected, but collision boxes are not shown\"), M2 = y2 || O2.circles.length > 0 && !O2.collisionDetected, R2 = R2 && O2.offscreen;\n }\n if (p3.iconFeatureIndex && (Z2 = p3.iconFeatureIndex), p3.iconBox) {\n const t6 = (t7) => this.collisionIndex.placeCollisionBox(t7, b2, d2, l2, h2, I2, T2, n2, f2.predicate, z2, E3 && k2 ? k2 : void 0);\n F2 && F2.placeable && p3.verticalIconBox ? (N2 = t6(p3.verticalIconBox), A3 = N2.placeable) : (N2 = t6(p3.iconBox), A3 = N2.placeable), R2 = R2 && N2.offscreen;\n }\n const V2 = g2 || 0 === t5.numHorizontalGlyphVertices && 0 === t5.numVerticalGlyphVertices, G2 = v2 || 0 === t5.numIconVertices;\n V2 || G2 ? G2 ? V2 || (A3 = A3 && M2) : M2 = A3 && M2 : A3 = M2 = A3 && M2;\n const H2 = A3 && N2.placeable;\n if (M2 && B3.placeable && this.collisionIndex.insertCollisionBox(B3.box, x2, o2.get(\"text-ignore-placement\"), s2.bucketInstanceId, F2 && F2.placeable && j2 ? j2 : U2, f2.ID), H2 && this.collisionIndex.insertCollisionBox(N2.box, b2, o2.get(\"icon-ignore-placement\"), s2.bucketInstanceId, Z2, f2.ID), O2 && M2 && this.collisionIndex.insertCollisionCircles(O2.circles, x2, o2.get(\"text-ignore-placement\"), s2.bucketInstanceId, U2, f2.ID), a2 && this.storeCollisionData(s2.bucketInstanceId, w3, p3, B3, N2, O2), 0 === t5.crossTileID) throw new Error(\"symbolInstance.crossTileID can't be 0\");\n if (0 === s2.bucketInstanceId) throw new Error(\"bucket.bucketInstanceId can't be 0\");\n this.placements[t5.crossTileID] = new Ut(M2 || C3, A3 || S2, R2 || s2.justReloaded), i2[t5.crossTileID] = true;\n };\n if (P2) {\n if (0 !== t4.symbolInstanceStart) throw new Error(\"bucket.bucketInstanceId should be 0\");\n const e2 = s2.getSortedSymbolIndexes(this.transform.angle);\n for (let t5 = e2.length - 1; t5 >= 0; --t5) {\n const i3 = e2[t5];\n D3(s2.symbolInstances.get(i3), s2.collisionArrays[i3], i3);\n }\n } else for (let e2 = t4.symbolInstanceStart; e2 < t4.symbolInstanceEnd; e2++) D3(s2.symbolInstances.get(e2), s2.collisionArrays[e2], e2);\n if (a2 && s2.bucketInstanceId in this.collisionCircleArrays) {\n const t5 = this.collisionCircleArrays[s2.bucketInstanceId];\n e.as(t5.invProjMatrix, l2), t5.viewportMatrix = this.collisionIndex.getViewportMatrix();\n }\n s2.justReloaded = false;\n }\n storeCollisionData(t4, e2, i2, a2, s2, o2) {\n if (i2.textBox || i2.iconBox) {\n let o3, r2;\n this.collisionBoxArrays.has(t4) ? o3 = this.collisionBoxArrays.get(t4) : (o3 = /* @__PURE__ */ new Map(), this.collisionBoxArrays.set(t4, o3)), o3.has(e2) ? r2 = o3.get(e2) : (r2 = { text: null, icon: null }, o3.set(e2, r2)), i2.textBox && (r2.text = a2.box), i2.iconBox && (r2.icon = s2.box);\n }\n if (o2) {\n let e3 = this.collisionCircleArrays[t4];\n void 0 === e3 && (e3 = this.collisionCircleArrays[t4] = new jt());\n for (let t5 = 0; t5 < o2.circles.length; t5 += 4) e3.circles.push(o2.circles[t5 + 0]), e3.circles.push(o2.circles[t5 + 1]), e3.circles.push(o2.circles[t5 + 2]), e3.circles.push(o2.collisionDetected ? 1 : 0);\n }\n }\n markUsedJustification(t4, i2, a2, s2) {\n let o2;\n o2 = s2 === e.ah.vertical ? a2.verticalPlacedTextSymbolIndex : { left: a2.leftJustifiedTextSymbolIndex, center: a2.centerJustifiedTextSymbolIndex, right: a2.rightJustifiedTextSymbolIndex }[e.at(i2)];\n const r2 = [a2.leftJustifiedTextSymbolIndex, a2.centerJustifiedTextSymbolIndex, a2.rightJustifiedTextSymbolIndex, a2.verticalPlacedTextSymbolIndex];\n for (const e2 of r2) e2 >= 0 && (t4.text.placedSymbolArray.get(e2).crossTileID = o2 >= 0 && e2 !== o2 ? 0 : a2.crossTileID);\n }\n markUsedOrientation(t4, i2, a2) {\n const s2 = i2 === e.ah.horizontal || i2 === e.ah.horizontalOnly ? i2 : 0, o2 = i2 === e.ah.vertical ? i2 : 0, r2 = [a2.leftJustifiedTextSymbolIndex, a2.centerJustifiedTextSymbolIndex, a2.rightJustifiedTextSymbolIndex];\n for (const e2 of r2) t4.text.placedSymbolArray.get(e2).placedOrientation = s2;\n a2.verticalPlacedTextSymbolIndex && (t4.text.placedSymbolArray.get(a2.verticalPlacedTextSymbolIndex).placedOrientation = o2);\n }\n commit(t4) {\n this.commitTime = t4, this.zoomAtLastRecencyCheck = this.transform.zoom;\n const e2 = this.prevPlacement;\n let i2 = false;\n this.prevZoomAdjustment = e2 ? e2.zoomAdjustment(this.transform.zoom) : 0;\n const a2 = e2 ? e2.symbolFadeChange(t4) : 1, s2 = e2 ? e2.opacities : {}, o2 = e2 ? e2.variableOffsets : {}, r2 = e2 ? e2.placedOrientations : {};\n for (const t5 in this.placements) {\n const e3 = this.placements[t5], o3 = s2[t5];\n o3 ? (this.opacities[t5] = new Nt(o3, a2, e3.text, e3.icon), i2 = i2 || e3.text !== o3.text.placed || e3.icon !== o3.icon.placed) : (this.opacities[t5] = new Nt(null, a2, e3.text, e3.icon, e3.skipFade), i2 = i2 || e3.text || e3.icon);\n }\n for (const t5 in s2) {\n const e3 = s2[t5];\n if (!this.opacities[t5]) {\n const s3 = new Nt(e3, a2, false, false);\n s3.isHidden() || (this.opacities[t5] = s3, i2 = i2 || e3.text.placed || e3.icon.placed);\n }\n }\n for (const t5 in o2) this.variableOffsets[t5] || !this.opacities[t5] || this.opacities[t5].isHidden() || (this.variableOffsets[t5] = o2[t5]);\n for (const t5 in r2) this.placedOrientations[t5] || !this.opacities[t5] || this.opacities[t5].isHidden() || (this.placedOrientations[t5] = r2[t5]);\n if (e2 && void 0 === e2.lastPlacementChangeTime) throw new Error(\"Last placement time for previous placement is not defined\");\n i2 ? this.lastPlacementChangeTime = t4 : \"number\" != typeof this.lastPlacementChangeTime && (this.lastPlacementChangeTime = e2 ? e2.lastPlacementChangeTime : t4);\n }\n updateLayerOpacities(t4, e2) {\n const i2 = {};\n for (const a2 of e2) {\n const e3 = a2.getBucket(t4);\n e3 && a2.latestFeatureIndex && t4.id === e3.layerIds[0] && this.updateBucketOpacities(e3, a2.tileID, i2, a2.collisionBoxArray);\n }\n }\n updateBucketOpacities(t4, i2, a2, s2) {\n t4.hasTextData() && (t4.text.opacityVertexArray.clear(), t4.text.hasVisibleVertices = false), t4.hasIconData() && (t4.icon.opacityVertexArray.clear(), t4.icon.hasVisibleVertices = false), t4.hasIconCollisionBoxData() && t4.iconCollisionBox.collisionVertexArray.clear(), t4.hasTextCollisionBoxData() && t4.textCollisionBox.collisionVertexArray.clear();\n const o2 = t4.layers[0], r2 = o2.layout, n2 = new Nt(null, 0, false, false, true), l2 = r2.get(\"text-allow-overlap\"), h2 = r2.get(\"icon-allow-overlap\"), c2 = o2._unevaluatedLayout.hasValue(\"text-variable-anchor\") || o2._unevaluatedLayout.hasValue(\"text-variable-anchor-offset\"), u2 = \"map\" === r2.get(\"text-rotation-alignment\"), d2 = \"map\" === r2.get(\"text-pitch-alignment\"), _2 = \"none\" !== r2.get(\"icon-text-fit\"), p2 = new Nt(null, 0, l2 && (h2 || !t4.hasIconData() || r2.get(\"icon-optional\")), h2 && (l2 || !t4.hasTextData() || r2.get(\"text-optional\")), true);\n !t4.collisionArrays && s2 && (t4.hasIconCollisionBoxData() || t4.hasTextCollisionBoxData()) && t4.deserializeCollisionBoxes(s2);\n const m2 = (t5, e2, i3) => {\n for (let a3 = 0; a3 < e2 / 4; a3++) t5.opacityVertexArray.emplaceBack(i3);\n t5.hasVisibleVertices = t5.hasVisibleVertices || i3 !== ee;\n }, f2 = this.collisionBoxArrays.get(t4.bucketInstanceId);\n for (let i3 = 0; i3 < t4.symbolInstances.length; i3++) {\n const s3 = t4.symbolInstances.get(i3), { numHorizontalGlyphVertices: o3, numVerticalGlyphVertices: r3, crossTileID: l3 } = s3;\n let h3 = this.opacities[l3];\n a2[l3] ? h3 = n2 : h3 || (h3 = p2, this.opacities[l3] = h3), a2[l3] = true;\n const g2 = s3.numIconVertices > 0, v2 = this.placedOrientations[s3.crossTileID], x2 = v2 === e.ah.vertical, y2 = v2 === e.ah.horizontal || v2 === e.ah.horizontalOnly;\n if (o3 > 0 || r3 > 0) {\n const e2 = te(h3.text);\n m2(t4.text, o3, x2 ? ee : e2), m2(t4.text, r3, y2 ? ee : e2);\n const i4 = h3.text.isHidden();\n [s3.rightJustifiedTextSymbolIndex, s3.centerJustifiedTextSymbolIndex, s3.leftJustifiedTextSymbolIndex].forEach((e3) => {\n e3 >= 0 && (t4.text.placedSymbolArray.get(e3).hidden = i4 || x2 ? 1 : 0);\n }), s3.verticalPlacedTextSymbolIndex >= 0 && (t4.text.placedSymbolArray.get(s3.verticalPlacedTextSymbolIndex).hidden = i4 || y2 ? 1 : 0);\n const a3 = this.variableOffsets[s3.crossTileID];\n a3 && this.markUsedJustification(t4, a3.anchor, s3, v2);\n const n3 = this.placedOrientations[s3.crossTileID];\n n3 && (this.markUsedJustification(t4, \"left\", s3, n3), this.markUsedOrientation(t4, n3, s3));\n }\n if (g2) {\n const e2 = te(h3.icon), i4 = !(_2 && s3.verticalPlacedIconSymbolIndex && x2);\n s3.placedIconSymbolIndex >= 0 && (m2(t4.icon, s3.numIconVertices, i4 ? e2 : ee), t4.icon.placedSymbolArray.get(s3.placedIconSymbolIndex).hidden = h3.icon.isHidden()), s3.verticalPlacedIconSymbolIndex >= 0 && (m2(t4.icon, s3.numVerticalIconVertices, i4 ? ee : e2), t4.icon.placedSymbolArray.get(s3.verticalPlacedIconSymbolIndex).hidden = h3.icon.isHidden());\n }\n const b2 = f2 && f2.has(i3) ? f2.get(i3) : { text: null, icon: null };\n if (t4.hasIconCollisionBoxData() || t4.hasTextCollisionBoxData()) {\n const a3 = t4.collisionArrays[i3];\n if (a3) {\n let i4 = new e.P(0, 0);\n if (a3.textBox || a3.verticalTextBox) {\n let e2 = true;\n if (c2) {\n const t5 = this.variableOffsets[l3];\n t5 ? (i4 = Vt(t5.anchor, t5.width, t5.height, t5.textOffset, t5.textBoxScale), u2 && i4._rotate(d2 ? this.transform.angle : -this.transform.angle)) : e2 = false;\n }\n if (a3.textBox || a3.verticalTextBox) {\n let s4;\n a3.textBox && (s4 = x2), a3.verticalTextBox && (s4 = y2), Ht(t4.textCollisionBox.collisionVertexArray, h3.text.placed, !e2 || s4, b2.text, i4.x, i4.y);\n }\n }\n if (a3.iconBox || a3.verticalIconBox) {\n const e2 = Boolean(!y2 && a3.verticalIconBox);\n let s4;\n a3.iconBox && (s4 = e2), a3.verticalIconBox && (s4 = !e2), Ht(t4.iconCollisionBox.collisionVertexArray, h3.icon.placed, s4, b2.icon, _2 ? i4.x : 0, _2 ? i4.y : 0);\n }\n }\n }\n }\n if (t4.sortFeatures(this.transform.angle), this.retainedQueryData[t4.bucketInstanceId] && (this.retainedQueryData[t4.bucketInstanceId].featureSortOrder = t4.featureSortOrder), t4.hasTextData() && t4.text.opacityVertexBuffer && t4.text.opacityVertexBuffer.updateData(t4.text.opacityVertexArray), t4.hasIconData() && t4.icon.opacityVertexBuffer && t4.icon.opacityVertexBuffer.updateData(t4.icon.opacityVertexArray), t4.hasIconCollisionBoxData() && t4.iconCollisionBox.collisionVertexBuffer && t4.iconCollisionBox.collisionVertexBuffer.updateData(t4.iconCollisionBox.collisionVertexArray), t4.hasTextCollisionBoxData() && t4.textCollisionBox.collisionVertexBuffer && t4.textCollisionBox.collisionVertexBuffer.updateData(t4.textCollisionBox.collisionVertexArray), t4.text.opacityVertexArray.length !== t4.text.layoutVertexArray.length / 4) throw new Error(`bucket.text.opacityVertexArray.length (= ${t4.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t4.text.layoutVertexArray.length}) / 4`);\n if (t4.icon.opacityVertexArray.length !== t4.icon.layoutVertexArray.length / 4) throw new Error(`bucket.icon.opacityVertexArray.length (= ${t4.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t4.icon.layoutVertexArray.length}) / 4`);\n if (t4.bucketInstanceId in this.collisionCircleArrays) {\n const e2 = this.collisionCircleArrays[t4.bucketInstanceId];\n t4.placementInvProjMatrix = e2.invProjMatrix, t4.placementViewportMatrix = e2.viewportMatrix, t4.collisionCircleArray = e2.circles, delete this.collisionCircleArrays[t4.bucketInstanceId];\n }\n }\n symbolFadeChange(t4) {\n return 0 === this.fadeDuration ? 1 : (t4 - this.commitTime) / this.fadeDuration + this.prevZoomAdjustment;\n }\n zoomAdjustment(t4) {\n return Math.max(0, (this.transform.zoom - t4) / 1.5);\n }\n hasTransitions(t4) {\n return this.stale || t4 - this.lastPlacementChangeTime < this.fadeDuration;\n }\n stillRecent(t4, e2) {\n const i2 = this.zoomAtLastRecencyCheck === e2 ? 1 - this.zoomAdjustment(e2) : 1;\n return this.zoomAtLastRecencyCheck = e2, this.commitTime + this.fadeDuration * i2 > t4;\n }\n setStale() {\n this.stale = true;\n }\n }\n function Ht(t4, e2, i2, a2, s2, o2) {\n a2 && 0 !== a2.length || (a2 = [0, 0, 0, 0]);\n const r2 = a2[0] - Lt, n2 = a2[1] - Lt, l2 = a2[2] - Lt, h2 = a2[3] - Lt;\n t4.emplaceBack(e2 ? 1 : 0, i2 ? 1 : 0, s2 || 0, o2 || 0, r2, n2), t4.emplaceBack(e2 ? 1 : 0, i2 ? 1 : 0, s2 || 0, o2 || 0, l2, n2), t4.emplaceBack(e2 ? 1 : 0, i2 ? 1 : 0, s2 || 0, o2 || 0, l2, h2), t4.emplaceBack(e2 ? 1 : 0, i2 ? 1 : 0, s2 || 0, o2 || 0, r2, h2);\n }\n const Wt = Math.pow(2, 25), $t = Math.pow(2, 24), Xt = Math.pow(2, 17), Kt = Math.pow(2, 16), Jt = Math.pow(2, 9), Yt = Math.pow(2, 8), Qt = Math.pow(2, 1);\n function te(t4) {\n if (0 === t4.opacity && !t4.placed) return 0;\n if (1 === t4.opacity && t4.placed) return 4294967295;\n const e2 = t4.placed ? 1 : 0, i2 = Math.floor(127 * t4.opacity);\n return i2 * Wt + e2 * $t + i2 * Xt + e2 * Kt + i2 * Jt + e2 * Yt + i2 * Qt + e2;\n }\n const ee = 0;\n function ie() {\n return { isOccluded: (t4, e2, i2) => false, getPitchedTextCorrection: (t4, e2, i2) => 1, get useSpecialProjectionForSymbols() {\n return false;\n }, projectTileCoordinates(t4, e2, i2, a2) {\n throw new Error(\"Not implemented.\");\n }, translatePosition: (t4, e2, i2, a2) => function(t5, e3, i3, a3, s2 = false) {\n if (!i3[0] && !i3[1]) return [0, 0];\n const o2 = s2 ? \"map\" === a3 ? t5.angle : 0 : \"viewport\" === a3 ? -t5.angle : 0;\n if (o2) {\n const t6 = Math.sin(o2), e4 = Math.cos(o2);\n i3 = [i3[0] * e4 - i3[1] * t6, i3[0] * t6 + i3[1] * e4];\n }\n return [s2 ? i3[0] : Bt(e3, i3[0], t5.zoom), s2 ? i3[1] : Bt(e3, i3[1], t5.zoom)];\n }(t4, e2, i2, a2), getCircleRadiusCorrection: (t4) => 1 };\n }\n class ae {\n constructor(t4) {\n this._sortAcrossTiles = \"viewport-y\" !== t4.layout.get(\"symbol-z-order\") && !t4.layout.get(\"symbol-sort-key\").isConstant(), this._currentTileIndex = 0, this._currentPartIndex = 0, this._seenCrossTileIDs = {}, this._bucketParts = [];\n }\n continuePlacement(t4, e2, i2, a2, s2) {\n const o2 = this._bucketParts;\n for (; this._currentTileIndex < t4.length; ) if (e2.getBucketParts(o2, a2, t4[this._currentTileIndex], this._sortAcrossTiles), this._currentTileIndex++, s2()) return true;\n for (this._sortAcrossTiles && (this._sortAcrossTiles = false, o2.sort((t5, e3) => t5.sortKey - e3.sortKey)); this._currentPartIndex < o2.length; ) if (e2.placeLayerBucketPart(o2[this._currentPartIndex], this._seenCrossTileIDs, i2), this._currentPartIndex++, s2()) return true;\n return false;\n }\n }\n class se {\n constructor(t4, e2, i2, a2, s2, o2, r2, n2) {\n this.placement = new Gt(t4, ie(), e2, o2, r2, n2), this._currentPlacementIndex = i2.length - 1, this._forceFullPlacement = a2, this._showCollisionBoxes = s2, this._done = false;\n }\n isDone() {\n return this._done;\n }\n continuePlacement(t4, e2, i2) {\n const a2 = o.now(), s2 = () => !this._forceFullPlacement && o.now() - a2 > 2;\n for (; this._currentPlacementIndex >= 0; ) {\n const a3 = e2[t4[this._currentPlacementIndex]], o2 = this.placement.collisionIndex.transform.zoom;\n if (\"symbol\" === a3.type && (!a3.minzoom || a3.minzoom <= o2) && (!a3.maxzoom || a3.maxzoom > o2)) {\n if (this._inProgressLayer || (this._inProgressLayer = new ae(a3)), this._inProgressLayer.continuePlacement(i2[a3.source], this.placement, this._showCollisionBoxes, a3, s2)) return;\n delete this._inProgressLayer;\n }\n this._currentPlacementIndex--;\n }\n this._done = true;\n }\n commit(t4) {\n return this.placement.commit(t4), this.placement;\n }\n }\n const oe = 512 / e.X / 2;\n class re {\n constructor(t4, i2, a2) {\n this.tileID = t4, this.bucketInstanceId = a2, this._symbolsByKey = {};\n const s2 = /* @__PURE__ */ new Map();\n for (let t5 = 0; t5 < i2.length; t5++) {\n const e2 = i2.get(t5), a3 = e2.key, o2 = s2.get(a3);\n o2 ? o2.push(e2) : s2.set(a3, [e2]);\n }\n for (const [t5, i3] of s2) {\n const a3 = { positions: i3.map((t6) => ({ x: Math.floor(t6.anchorX * oe), y: Math.floor(t6.anchorY * oe) })), crossTileIDs: i3.map((t6) => t6.crossTileID) };\n if (a3.positions.length > 128) {\n const t6 = new e.av(a3.positions.length, 16, Uint16Array);\n for (const { x: e2, y: i4 } of a3.positions) t6.add(e2, i4);\n t6.finish(), delete a3.positions, a3.index = t6;\n }\n this._symbolsByKey[t5] = a3;\n }\n }\n getScaledCoordinates(t4, i2) {\n const { x: a2, y: s2, z: o2 } = this.tileID.canonical, { x: r2, y: n2, z: l2 } = i2.canonical, h2 = oe / Math.pow(2, l2 - o2), c2 = (n2 * e.X + t4.anchorY) * h2, u2 = s2 * e.X * oe;\n return { x: Math.floor((r2 * e.X + t4.anchorX) * h2 - a2 * e.X * oe), y: Math.floor(c2 - u2) };\n }\n findMatches(t4, e2, i2) {\n const a2 = this.tileID.canonical.z < e2.canonical.z ? 1 : Math.pow(2, this.tileID.canonical.z - e2.canonical.z);\n for (let s2 = 0; s2 < t4.length; s2++) {\n const o2 = t4.get(s2);\n if (o2.crossTileID) continue;\n const r2 = this._symbolsByKey[o2.key];\n if (!r2) continue;\n const n2 = this.getScaledCoordinates(o2, e2);\n if (r2.index) {\n const t5 = r2.index.range(n2.x - a2, n2.y - a2, n2.x + a2, n2.y + a2).sort();\n for (const e3 of t5) {\n const t6 = r2.crossTileIDs[e3];\n if (!i2[t6]) {\n i2[t6] = true, o2.crossTileID = t6;\n break;\n }\n }\n } else if (r2.positions) for (let t5 = 0; t5 < r2.positions.length; t5++) {\n const e3 = r2.positions[t5], s3 = r2.crossTileIDs[t5];\n if (Math.abs(e3.x - n2.x) <= a2 && Math.abs(e3.y - n2.y) <= a2 && !i2[s3]) {\n i2[s3] = true, o2.crossTileID = s3;\n break;\n }\n }\n }\n }\n getCrossTileIDsLists() {\n return Object.values(this._symbolsByKey).map(({ crossTileIDs: t4 }) => t4);\n }\n }\n class ne {\n constructor() {\n this.maxCrossTileID = 0;\n }\n generate() {\n return ++this.maxCrossTileID;\n }\n }\n class le {\n constructor() {\n this.indexes = {}, this.usedCrossTileIDs = {}, this.lng = 0;\n }\n handleWrapJump(t4) {\n const e2 = Math.round((t4 - this.lng) / 360);\n if (0 !== e2) for (const t5 in this.indexes) {\n const i2 = this.indexes[t5], a2 = {};\n for (const t6 in i2) {\n const s2 = i2[t6];\n s2.tileID = s2.tileID.unwrapTo(s2.tileID.wrap + e2), a2[s2.tileID.key] = s2;\n }\n this.indexes[t5] = a2;\n }\n this.lng = t4;\n }\n addBucket(t4, e2, i2) {\n if (this.indexes[t4.overscaledZ] && this.indexes[t4.overscaledZ][t4.key]) {\n if (this.indexes[t4.overscaledZ][t4.key].bucketInstanceId === e2.bucketInstanceId) return false;\n this.removeBucketCrossTileIDs(t4.overscaledZ, this.indexes[t4.overscaledZ][t4.key]);\n }\n for (let t5 = 0; t5 < e2.symbolInstances.length; t5++) e2.symbolInstances.get(t5).crossTileID = 0;\n this.usedCrossTileIDs[t4.overscaledZ] || (this.usedCrossTileIDs[t4.overscaledZ] = {});\n const a2 = this.usedCrossTileIDs[t4.overscaledZ];\n for (const i3 in this.indexes) {\n const s2 = this.indexes[i3];\n if (Number(i3) > t4.overscaledZ) for (const i4 in s2) {\n const o2 = s2[i4];\n o2.tileID.isChildOf(t4) && o2.findMatches(e2.symbolInstances, t4, a2);\n }\n else {\n const o2 = s2[t4.scaledTo(Number(i3)).key];\n o2 && o2.findMatches(e2.symbolInstances, t4, a2);\n }\n }\n for (let t5 = 0; t5 < e2.symbolInstances.length; t5++) {\n const s2 = e2.symbolInstances.get(t5);\n s2.crossTileID || (s2.crossTileID = i2.generate(), a2[s2.crossTileID] = true);\n }\n return void 0 === this.indexes[t4.overscaledZ] && (this.indexes[t4.overscaledZ] = {}), this.indexes[t4.overscaledZ][t4.key] = new re(t4, e2.symbolInstances, e2.bucketInstanceId), true;\n }\n removeBucketCrossTileIDs(t4, e2) {\n for (const i2 of e2.getCrossTileIDsLists()) for (const e3 of i2) delete this.usedCrossTileIDs[t4][e3];\n }\n removeStaleBuckets(t4) {\n let e2 = false;\n for (const i2 in this.indexes) {\n const a2 = this.indexes[i2];\n for (const s2 in a2) t4[a2[s2].bucketInstanceId] || (this.removeBucketCrossTileIDs(i2, a2[s2]), delete a2[s2], e2 = true);\n }\n return e2;\n }\n }\n class he {\n constructor() {\n this.layerIndexes = {}, this.crossTileIDs = new ne(), this.maxBucketInstanceId = 0, this.bucketsInCurrentPlacement = {};\n }\n addLayer(t4, e2, i2) {\n let a2 = this.layerIndexes[t4.id];\n void 0 === a2 && (a2 = this.layerIndexes[t4.id] = new le());\n let s2 = false;\n const o2 = {};\n a2.handleWrapJump(i2);\n for (const i3 of e2) {\n const e3 = i3.getBucket(t4);\n e3 && t4.id === e3.layerIds[0] && (e3.bucketInstanceId || (e3.bucketInstanceId = ++this.maxBucketInstanceId), a2.addBucket(i3.tileID, e3, this.crossTileIDs) && (s2 = true), o2[e3.bucketInstanceId] = true);\n }\n return a2.removeStaleBuckets(o2) && (s2 = true), s2;\n }\n pruneUnusedLayers(t4) {\n const e2 = {};\n t4.forEach((t5) => {\n e2[t5] = true;\n });\n for (const t5 in this.layerIndexes) e2[t5] || delete this.layerIndexes[t5];\n }\n }\n const ce = (t4, i2) => e.t(t4, i2 && i2.filter((t5) => \"source.canvas\" !== t5.identifier)), ue = e.aw();\n class de extends e.E {\n constructor(t4, i2 = {}) {\n super(), this._rtlPluginLoaded = () => {\n for (const t5 in this.sourceCaches) {\n const e2 = this.sourceCaches[t5].getSource().type;\n \"vector\" !== e2 && \"geojson\" !== e2 || this.sourceCaches[t5].reload();\n }\n }, this.map = t4, this.dispatcher = new U(N(), t4._getMapId()), this.dispatcher.registerMessageHandler(\"GG\", (t5, e2) => this.getGlyphs(t5, e2)), this.dispatcher.registerMessageHandler(\"GI\", (t5, e2) => this.getImages(t5, e2)), this.imageManager = new T(), this.imageManager.setEventedParent(this), this.glyphManager = new C2(t4._requestManager, i2.localIdeographFontFamily), this.lineAtlas = new R(256, 512), this.crossTileSymbolIndex = new he(), this._spritesImagesIds = {}, this._layers = {}, this._order = [], this.sourceCaches = {}, this.zoomHistory = new e.ax(), this._loaded = false, this._availableImages = [], this._resetUpdates(), this.dispatcher.broadcast(\"SR\", e.ay()), nt().on(st, this._rtlPluginLoaded), this.on(\"data\", (t5) => {\n if (\"source\" !== t5.dataType || \"metadata\" !== t5.sourceDataType) return;\n const e2 = this.sourceCaches[t5.sourceId];\n if (!e2) return;\n const i3 = e2.getSource();\n if (i3 && i3.vectorLayerIds) for (const t6 in this._layers) {\n const e3 = this._layers[t6];\n e3.source === i3.id && this._validateLayer(e3);\n }\n });\n }\n loadURL(t4, i2 = {}, a2) {\n this.fire(new e.k(\"dataloading\", { dataType: \"style\" })), i2.validate = \"boolean\" != typeof i2.validate || i2.validate;\n const s2 = this.map._requestManager.transformRequest(t4, \"Style\");\n this._loadStyleRequest = new AbortController();\n const o2 = this._loadStyleRequest;\n e.h(s2, this._loadStyleRequest).then((t5) => {\n this._loadStyleRequest = null, this._load(t5.data, i2, a2);\n }).catch((t5) => {\n this._loadStyleRequest = null, t5 && !o2.signal.aborted && this.fire(new e.j(t5));\n });\n }\n loadJSON(t4, i2 = {}, a2) {\n this.fire(new e.k(\"dataloading\", { dataType: \"style\" })), this._frameRequest = new AbortController(), o.frameAsync(this._frameRequest).then(() => {\n this._frameRequest = null, i2.validate = false !== i2.validate, this._load(t4, i2, a2);\n }).catch(() => {\n });\n }\n loadEmpty() {\n this.fire(new e.k(\"dataloading\", { dataType: \"style\" })), this._load(ue, { validate: false });\n }\n _load(t4, i2, a2) {\n var s2;\n const o2 = i2.transformStyle ? i2.transformStyle(a2, t4) : t4;\n if (!i2.validate || !ce(this, e.u(o2))) {\n this._loaded = true, this.stylesheet = o2;\n for (const t5 in o2.sources) this.addSource(t5, o2.sources[t5], { validate: false });\n o2.sprite ? this._loadSprite(o2.sprite) : this.imageManager.setLoaded(true), this.glyphManager.setURL(o2.glyphs), this._createLayers(), this.light = new D2(this.stylesheet.light), this.sky = new A2(this.stylesheet.sky), this.map.setTerrain(null !== (s2 = this.stylesheet.terrain) && void 0 !== s2 ? s2 : null), this.fire(new e.k(\"data\", { dataType: \"style\" })), this.fire(new e.k(\"style.load\"));\n }\n }\n _createLayers() {\n const t4 = e.az(this.stylesheet.layers);\n this.dispatcher.broadcast(\"SL\", t4), this._order = t4.map((t5) => t5.id), this._layers = {}, this._serializedLayers = null;\n for (const i2 of t4) {\n const t5 = e.aA(i2);\n t5.setEventedParent(this, { layer: { id: i2.id } }), this._layers[i2.id] = t5;\n }\n }\n _loadSprite(t4, i2 = false, a2 = void 0) {\n let s2;\n this.imageManager.setLoaded(false), this._spriteRequest = new AbortController(), function(t5, i3, a3, s3) {\n return e._(this, void 0, void 0, function* () {\n const r2 = x(t5), n2 = a3 > 1 ? \"@2x\" : \"\", l2 = {}, h2 = {};\n for (const { id: t6, url: a4 } of r2) {\n const o2 = i3.transformRequest(y(a4, n2, \".json\"), \"SpriteJSON\");\n l2[t6] = e.h(o2, s3);\n const r3 = i3.transformRequest(y(a4, n2, \".png\"), \"SpriteImage\");\n h2[t6] = _.getImage(r3, s3);\n }\n return yield Promise.all([...Object.values(l2), ...Object.values(h2)]), function(t6, i4) {\n return e._(this, void 0, void 0, function* () {\n const e2 = {};\n for (const a4 in t6) {\n e2[a4] = {};\n const s4 = o.getImageCanvasContext((yield i4[a4]).data), r3 = (yield t6[a4]).data;\n for (const t7 in r3) {\n const { width: i5, height: o2, x: n3, y: l3, sdf: h3, pixelRatio: c2, stretchX: u2, stretchY: d2, content: _2, textFitWidth: p2, textFitHeight: m2 } = r3[t7];\n e2[a4][t7] = { data: null, pixelRatio: c2, sdf: h3, stretchX: u2, stretchY: d2, content: _2, textFitWidth: p2, textFitHeight: m2, spriteData: { width: i5, height: o2, x: n3, y: l3, context: s4 } };\n }\n }\n return e2;\n });\n }(l2, h2);\n });\n }(t4, this.map._requestManager, this.map.getPixelRatio(), this._spriteRequest).then((t5) => {\n if (this._spriteRequest = null, t5) for (const e2 in t5) {\n this._spritesImagesIds[e2] = [];\n const a3 = this._spritesImagesIds[e2] ? this._spritesImagesIds[e2].filter((e3) => !(e3 in t5)) : [];\n for (const t6 of a3) this.imageManager.removeImage(t6), this._changedImages[t6] = true;\n for (const a4 in t5[e2]) {\n const s3 = \"default\" === e2 ? a4 : `${e2}:${a4}`;\n this._spritesImagesIds[e2].push(s3), s3 in this.imageManager.images ? this.imageManager.updateImage(s3, t5[e2][a4], false) : this.imageManager.addImage(s3, t5[e2][a4]), i2 && (this._changedImages[s3] = true);\n }\n }\n }).catch((t5) => {\n this._spriteRequest = null, s2 = t5, this.fire(new e.j(s2));\n }).finally(() => {\n this.imageManager.setLoaded(true), this._availableImages = this.imageManager.listImages(), i2 && (this._changed = true), this.dispatcher.broadcast(\"SI\", this._availableImages), this.fire(new e.k(\"data\", { dataType: \"style\" })), a2 && a2(s2);\n });\n }\n _unloadSprite() {\n for (const t4 of Object.values(this._spritesImagesIds).flat()) this.imageManager.removeImage(t4), this._changedImages[t4] = true;\n this._spritesImagesIds = {}, this._availableImages = this.imageManager.listImages(), this._changed = true, this.dispatcher.broadcast(\"SI\", this._availableImages), this.fire(new e.k(\"data\", { dataType: \"style\" }));\n }\n _validateLayer(t4) {\n const i2 = this.sourceCaches[t4.source];\n if (!i2) return;\n const a2 = t4.sourceLayer;\n if (!a2) return;\n const s2 = i2.getSource();\n (\"geojson\" === s2.type || s2.vectorLayerIds && -1 === s2.vectorLayerIds.indexOf(a2)) && this.fire(new e.j(new Error(`Source layer \"${a2}\" does not exist on source \"${s2.id}\" as specified by style layer \"${t4.id}\".`)));\n }\n loaded() {\n if (!this._loaded) return false;\n if (Object.keys(this._updatedSources).length) return false;\n for (const t4 in this.sourceCaches) if (!this.sourceCaches[t4].loaded()) return false;\n return !!this.imageManager.isLoaded();\n }\n _serializeByIds(t4, i2 = false) {\n const a2 = this._serializedAllLayers();\n if (!t4 || 0 === t4.length) return Object.values(i2 ? e.aB(a2) : a2);\n const s2 = [];\n for (const o2 of t4) if (a2[o2]) {\n const t5 = i2 ? e.aB(a2[o2]) : a2[o2];\n s2.push(t5);\n }\n return s2;\n }\n _serializedAllLayers() {\n let t4 = this._serializedLayers;\n if (t4) return t4;\n t4 = this._serializedLayers = {};\n const e2 = Object.keys(this._layers);\n for (const i2 of e2) {\n const e3 = this._layers[i2];\n \"custom\" !== e3.type && (t4[i2] = e3.serialize());\n }\n return t4;\n }\n hasTransitions() {\n if (this.light && this.light.hasTransition()) return true;\n if (this.sky && this.sky.hasTransition()) return true;\n for (const t4 in this.sourceCaches) if (this.sourceCaches[t4].hasTransition()) return true;\n for (const t4 in this._layers) if (this._layers[t4].hasTransition()) return true;\n return false;\n }\n _checkLoaded() {\n if (!this._loaded) throw new Error(\"Style is not done loading.\");\n }\n update(t4) {\n if (!this._loaded) return;\n const i2 = this._changed;\n if (i2) {\n const e2 = Object.keys(this._updatedLayers), i3 = Object.keys(this._removedLayers);\n (e2.length || i3.length) && this._updateWorkerLayers(e2, i3);\n for (const t5 in this._updatedSources) {\n const e3 = this._updatedSources[t5];\n if (\"reload\" === e3) this._reloadSource(t5);\n else {\n if (\"clear\" !== e3) throw new Error(`Invalid action ${e3}`);\n this._clearSource(t5);\n }\n }\n this._updateTilesForChangedImages(), this._updateTilesForChangedGlyphs();\n for (const e3 in this._updatedPaintProps) this._layers[e3].updateTransitions(t4);\n this.light.updateTransitions(t4), this.sky.updateTransitions(t4), this._resetUpdates();\n }\n const a2 = {};\n for (const t5 in this.sourceCaches) {\n const e2 = this.sourceCaches[t5];\n a2[t5] = e2.used, e2.used = false;\n }\n for (const e2 of this._order) {\n const i3 = this._layers[e2];\n i3.recalculate(t4, this._availableImages), !i3.isHidden(t4.zoom) && i3.source && (this.sourceCaches[i3.source].used = true);\n }\n for (const t5 in a2) {\n const i3 = this.sourceCaches[t5];\n !!a2[t5] != !!i3.used && i3.fire(new e.k(\"data\", { sourceDataType: \"visibility\", dataType: \"source\", sourceId: t5 }));\n }\n this.light.recalculate(t4), this.sky.recalculate(t4), this.z = t4.zoom, i2 && this.fire(new e.k(\"data\", { dataType: \"style\" }));\n }\n _updateTilesForChangedImages() {\n const t4 = Object.keys(this._changedImages);\n if (t4.length) {\n for (const e2 in this.sourceCaches) this.sourceCaches[e2].reloadTilesForDependencies([\"icons\", \"patterns\"], t4);\n this._changedImages = {};\n }\n }\n _updateTilesForChangedGlyphs() {\n if (this._glyphsDidChange) {\n for (const t4 in this.sourceCaches) this.sourceCaches[t4].reloadTilesForDependencies([\"glyphs\"], [\"\"]);\n this._glyphsDidChange = false;\n }\n }\n _updateWorkerLayers(t4, e2) {\n this.dispatcher.broadcast(\"UL\", { layers: this._serializeByIds(t4, false), removedIds: e2 });\n }\n _resetUpdates() {\n this._changed = false, this._updatedLayers = {}, this._removedLayers = {}, this._updatedSources = {}, this._updatedPaintProps = {}, this._changedImages = {}, this._glyphsDidChange = false;\n }\n setState(t4, i2 = {}) {\n var a2;\n this._checkLoaded();\n const s2 = this.serialize();\n if (t4 = i2.transformStyle ? i2.transformStyle(s2, t4) : t4, (null === (a2 = i2.validate) || void 0 === a2 || a2) && ce(this, e.u(t4))) return false;\n (t4 = e.aB(t4)).layers = e.az(t4.layers);\n const o2 = e.aC(s2, t4), r2 = this._getOperationsToPerform(o2);\n if (r2.unimplemented.length > 0) throw new Error(`Unimplemented: ${r2.unimplemented.join(\", \")}.`);\n if (0 === r2.operations.length) return false;\n for (const t5 of r2.operations) t5();\n return this.stylesheet = t4, this._serializedLayers = null, true;\n }\n _getOperationsToPerform(t4) {\n const e2 = [], i2 = [];\n for (const a2 of t4) switch (a2.command) {\n case \"setCenter\":\n case \"setZoom\":\n case \"setBearing\":\n case \"setPitch\":\n continue;\n case \"addLayer\":\n e2.push(() => this.addLayer.apply(this, a2.args));\n break;\n case \"removeLayer\":\n e2.push(() => this.removeLayer.apply(this, a2.args));\n break;\n case \"setPaintProperty\":\n e2.push(() => this.setPaintProperty.apply(this, a2.args));\n break;\n case \"setLayoutProperty\":\n e2.push(() => this.setLayoutProperty.apply(this, a2.args));\n break;\n case \"setFilter\":\n e2.push(() => this.setFilter.apply(this, a2.args));\n break;\n case \"addSource\":\n e2.push(() => this.addSource.apply(this, a2.args));\n break;\n case \"removeSource\":\n e2.push(() => this.removeSource.apply(this, a2.args));\n break;\n case \"setLayerZoomRange\":\n e2.push(() => this.setLayerZoomRange.apply(this, a2.args));\n break;\n case \"setLight\":\n e2.push(() => this.setLight.apply(this, a2.args));\n break;\n case \"setGeoJSONSourceData\":\n e2.push(() => this.setGeoJSONSourceData.apply(this, a2.args));\n break;\n case \"setGlyphs\":\n e2.push(() => this.setGlyphs.apply(this, a2.args));\n break;\n case \"setSprite\":\n e2.push(() => this.setSprite.apply(this, a2.args));\n break;\n case \"setSky\":\n e2.push(() => this.setSky.apply(this, a2.args));\n break;\n case \"setTerrain\":\n e2.push(() => this.map.setTerrain.apply(this, a2.args));\n break;\n case \"setTransition\":\n e2.push(() => {\n });\n break;\n default:\n i2.push(a2.command);\n }\n return { operations: e2, unimplemented: i2 };\n }\n addImage(t4, i2) {\n if (this.getImage(t4)) return this.fire(new e.j(new Error(`An image named \"${t4}\" already exists.`)));\n this.imageManager.addImage(t4, i2), this._afterImageUpdated(t4);\n }\n updateImage(t4, e2) {\n this.imageManager.updateImage(t4, e2);\n }\n getImage(t4) {\n return this.imageManager.getImage(t4);\n }\n removeImage(t4) {\n if (!this.getImage(t4)) return this.fire(new e.j(new Error(`An image named \"${t4}\" does not exist.`)));\n this.imageManager.removeImage(t4), this._afterImageUpdated(t4);\n }\n _afterImageUpdated(t4) {\n this._availableImages = this.imageManager.listImages(), this._changedImages[t4] = true, this._changed = true, this.dispatcher.broadcast(\"SI\", this._availableImages), this.fire(new e.k(\"data\", { dataType: \"style\" }));\n }\n listImages() {\n return this._checkLoaded(), this.imageManager.listImages();\n }\n addSource(t4, i2, a2 = {}) {\n if (this._checkLoaded(), void 0 !== this.sourceCaches[t4]) throw new Error(`Source \"${t4}\" already exists.`);\n if (!i2.type) throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i2).join(\", \")}.`);\n if ([\"vector\", \"raster\", \"geojson\", \"video\", \"image\"].indexOf(i2.type) >= 0 && this._validate(e.u.source, `sources.${t4}`, i2, null, a2)) return;\n this.map && this.map._collectResourceTiming && (i2.collectResourceTiming = true);\n const s2 = this.sourceCaches[t4] = new ut(t4, i2, this.dispatcher);\n s2.style = this, s2.setEventedParent(this, () => ({ isSourceLoaded: s2.loaded(), source: s2.serialize(), sourceId: t4 })), s2.onAdd(this.map), this._changed = true;\n }\n removeSource(t4) {\n if (this._checkLoaded(), void 0 === this.sourceCaches[t4]) throw new Error(\"There is no source with this ID\");\n for (const i3 in this._layers) if (this._layers[i3].source === t4) return this.fire(new e.j(new Error(`Source \"${t4}\" cannot be removed while layer \"${i3}\" is using it.`)));\n const i2 = this.sourceCaches[t4];\n delete this.sourceCaches[t4], delete this._updatedSources[t4], i2.fire(new e.k(\"data\", { sourceDataType: \"metadata\", dataType: \"source\", sourceId: t4 })), i2.setEventedParent(null), i2.onRemove(this.map), this._changed = true;\n }\n setGeoJSONSourceData(t4, e2) {\n if (this._checkLoaded(), void 0 === this.sourceCaches[t4]) throw new Error(`There is no source with this ID=${t4}`);\n const i2 = this.sourceCaches[t4].getSource();\n if (\"geojson\" !== i2.type) throw new Error(`geojsonSource.type is ${i2.type}, which is !== 'geojson`);\n i2.setData(e2), this._changed = true;\n }\n getSource(t4) {\n return this.sourceCaches[t4] && this.sourceCaches[t4].getSource();\n }\n addLayer(t4, i2, a2 = {}) {\n this._checkLoaded();\n const s2 = t4.id;\n if (this.getLayer(s2)) return void this.fire(new e.j(new Error(`Layer \"${s2}\" already exists on this map.`)));\n let o2;\n if (\"custom\" === t4.type) {\n if (ce(this, e.aD(t4))) return;\n o2 = e.aA(t4);\n } else {\n if (\"source\" in t4 && \"object\" == typeof t4.source && (this.addSource(s2, t4.source), t4 = e.aB(t4), t4 = e.e(t4, { source: s2 })), this._validate(e.u.layer, `layers.${s2}`, t4, { arrayIndex: -1 }, a2)) return;\n o2 = e.aA(t4), this._validateLayer(o2), o2.setEventedParent(this, { layer: { id: s2 } });\n }\n const r2 = i2 ? this._order.indexOf(i2) : this._order.length;\n if (i2 && -1 === r2) this.fire(new e.j(new Error(`Cannot add layer \"${s2}\" before non-existing layer \"${i2}\".`)));\n else {\n if (this._order.splice(r2, 0, s2), this._layerOrderChanged = true, this._layers[s2] = o2, this._removedLayers[s2] && o2.source && \"custom\" !== o2.type) {\n const t5 = this._removedLayers[s2];\n delete this._removedLayers[s2], t5.type !== o2.type ? this._updatedSources[o2.source] = \"clear\" : (this._updatedSources[o2.source] = \"reload\", this.sourceCaches[o2.source].pause());\n }\n this._updateLayer(o2), o2.onAdd && o2.onAdd(this.map);\n }\n }\n moveLayer(t4, i2) {\n if (this._checkLoaded(), this._changed = true, !this._layers[t4]) return void this.fire(new e.j(new Error(`The layer '${t4}' does not exist in the map's style and cannot be moved.`)));\n if (t4 === i2) return;\n const a2 = this._order.indexOf(t4);\n this._order.splice(a2, 1);\n const s2 = i2 ? this._order.indexOf(i2) : this._order.length;\n i2 && -1 === s2 ? this.fire(new e.j(new Error(`Cannot move layer \"${t4}\" before non-existing layer \"${i2}\".`))) : (this._order.splice(s2, 0, t4), this._layerOrderChanged = true);\n }\n removeLayer(t4) {\n this._checkLoaded();\n const i2 = this._layers[t4];\n if (!i2) return void this.fire(new e.j(new Error(`Cannot remove non-existing layer \"${t4}\".`)));\n i2.setEventedParent(null);\n const a2 = this._order.indexOf(t4);\n this._order.splice(a2, 1), this._layerOrderChanged = true, this._changed = true, this._removedLayers[t4] = i2, delete this._layers[t4], this._serializedLayers && delete this._serializedLayers[t4], delete this._updatedLayers[t4], delete this._updatedPaintProps[t4], i2.onRemove && i2.onRemove(this.map);\n }\n getLayer(t4) {\n return this._layers[t4];\n }\n getLayersOrder() {\n return [...this._order];\n }\n hasLayer(t4) {\n return t4 in this._layers;\n }\n setLayerZoomRange(t4, i2, a2) {\n this._checkLoaded();\n const s2 = this.getLayer(t4);\n s2 ? s2.minzoom === i2 && s2.maxzoom === a2 || (null != i2 && (s2.minzoom = i2), null != a2 && (s2.maxzoom = a2), this._updateLayer(s2)) : this.fire(new e.j(new Error(`Cannot set the zoom range of non-existing layer \"${t4}\".`)));\n }\n setFilter(t4, i2, a2 = {}) {\n this._checkLoaded();\n const s2 = this.getLayer(t4);\n if (s2) {\n if (!e.aE(s2.filter, i2)) return null == i2 ? (s2.filter = void 0, void this._updateLayer(s2)) : void (this._validate(e.u.filter, `layers.${s2.id}.filter`, i2, null, a2) || (s2.filter = e.aB(i2), this._updateLayer(s2)));\n } else this.fire(new e.j(new Error(`Cannot filter non-existing layer \"${t4}\".`)));\n }\n getFilter(t4) {\n return e.aB(this.getLayer(t4).filter);\n }\n setLayoutProperty(t4, i2, a2, s2 = {}) {\n this._checkLoaded();\n const o2 = this.getLayer(t4);\n o2 ? e.aE(o2.getLayoutProperty(i2), a2) || (o2.setLayoutProperty(i2, a2, s2), this._updateLayer(o2)) : this.fire(new e.j(new Error(`Cannot style non-existing layer \"${t4}\".`)));\n }\n getLayoutProperty(t4, i2) {\n const a2 = this.getLayer(t4);\n if (a2) return a2.getLayoutProperty(i2);\n this.fire(new e.j(new Error(`Cannot get style of non-existing layer \"${t4}\".`)));\n }\n setPaintProperty(t4, i2, a2, s2 = {}) {\n this._checkLoaded();\n const o2 = this.getLayer(t4);\n o2 ? e.aE(o2.getPaintProperty(i2), a2) || (o2.setPaintProperty(i2, a2, s2) && this._updateLayer(o2), this._changed = true, this._updatedPaintProps[t4] = true, this._serializedLayers = null) : this.fire(new e.j(new Error(`Cannot style non-existing layer \"${t4}\".`)));\n }\n getPaintProperty(t4, e2) {\n return this.getLayer(t4).getPaintProperty(e2);\n }\n setFeatureState(t4, i2) {\n this._checkLoaded();\n const a2 = t4.source, s2 = t4.sourceLayer, o2 = this.sourceCaches[a2];\n if (void 0 === o2) return void this.fire(new e.j(new Error(`The source '${a2}' does not exist in the map's style.`)));\n const r2 = o2.getSource().type;\n \"geojson\" === r2 && s2 ? this.fire(new e.j(new Error(\"GeoJSON sources cannot have a sourceLayer parameter.\"))) : \"vector\" !== r2 || s2 ? (void 0 === t4.id && this.fire(new e.j(new Error(\"The feature id parameter must be provided.\"))), o2.setFeatureState(s2, t4.id, i2)) : this.fire(new e.j(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));\n }\n removeFeatureState(t4, i2) {\n this._checkLoaded();\n const a2 = t4.source, s2 = this.sourceCaches[a2];\n if (void 0 === s2) return void this.fire(new e.j(new Error(`The source '${a2}' does not exist in the map's style.`)));\n const o2 = s2.getSource().type, r2 = \"vector\" === o2 ? t4.sourceLayer : void 0;\n \"vector\" !== o2 || r2 ? i2 && \"string\" != typeof t4.id && \"number\" != typeof t4.id ? this.fire(new e.j(new Error(\"A feature id is required to remove its specific state property.\"))) : s2.removeFeatureState(r2, t4.id, i2) : this.fire(new e.j(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));\n }\n getFeatureState(t4) {\n this._checkLoaded();\n const i2 = t4.source, a2 = t4.sourceLayer, s2 = this.sourceCaches[i2];\n if (void 0 !== s2) return \"vector\" !== s2.getSource().type || a2 ? (void 0 === t4.id && this.fire(new e.j(new Error(\"The feature id parameter must be provided.\"))), s2.getFeatureState(a2, t4.id)) : void this.fire(new e.j(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));\n this.fire(new e.j(new Error(`The source '${i2}' does not exist in the map's style.`)));\n }\n getTransition() {\n return e.e({ duration: 300, delay: 0 }, this.stylesheet && this.stylesheet.transition);\n }\n serialize() {\n if (!this._loaded) return;\n const t4 = e.aF(this.sourceCaches, (t5) => t5.serialize()), i2 = this._serializeByIds(this._order, true), a2 = this.map.getTerrain() || void 0, s2 = this.stylesheet;\n return e.aG({ version: s2.version, name: s2.name, metadata: s2.metadata, light: s2.light, sky: s2.sky, center: s2.center, zoom: s2.zoom, bearing: s2.bearing, pitch: s2.pitch, sprite: s2.sprite, glyphs: s2.glyphs, transition: s2.transition, sources: t4, layers: i2, terrain: a2 }, (t5) => void 0 !== t5);\n }\n _updateLayer(t4) {\n this._updatedLayers[t4.id] = true, t4.source && !this._updatedSources[t4.source] && \"raster\" !== this.sourceCaches[t4.source].getSource().type && (this._updatedSources[t4.source] = \"reload\", this.sourceCaches[t4.source].pause()), this._serializedLayers = null, this._changed = true;\n }\n _flattenAndSortRenderedFeatures(t4) {\n const e2 = (t5) => \"fill-extrusion\" === this._layers[t5].type, i2 = {}, a2 = [];\n for (let s3 = this._order.length - 1; s3 >= 0; s3--) {\n const o2 = this._order[s3];\n if (e2(o2)) {\n i2[o2] = s3;\n for (const e3 of t4) {\n const t5 = e3[o2];\n if (t5) for (const e4 of t5) a2.push(e4);\n }\n }\n }\n a2.sort((t5, e3) => e3.intersectionZ - t5.intersectionZ);\n const s2 = [];\n for (let o2 = this._order.length - 1; o2 >= 0; o2--) {\n const r2 = this._order[o2];\n if (e2(r2)) for (let t5 = a2.length - 1; t5 >= 0; t5--) {\n const e3 = a2[t5].feature;\n if (i2[e3.layer.id] < o2) break;\n s2.push(e3), a2.pop();\n }\n else for (const e3 of t4) {\n const t5 = e3[r2];\n if (t5) for (const e4 of t5) s2.push(e4.feature);\n }\n }\n return s2;\n }\n queryRenderedFeatures(t4, i2, a2) {\n i2 && i2.filter && this._validate(e.u.filter, \"queryRenderedFeatures.filter\", i2.filter, null, i2);\n const s2 = {};\n if (i2 && i2.layers) {\n if (!Array.isArray(i2.layers)) return this.fire(new e.j(new Error(\"parameters.layers must be an Array.\"))), [];\n for (const t5 of i2.layers) {\n const i3 = this._layers[t5];\n if (!i3) return this.fire(new e.j(new Error(`The layer '${t5}' does not exist in the map's style and cannot be queried for features.`))), [];\n s2[i3.source] = true;\n }\n }\n const o2 = [];\n i2.availableImages = this._availableImages;\n const r2 = this._serializedAllLayers();\n for (const e2 in this.sourceCaches) i2.layers && !s2[e2] || o2.push(q(this.sourceCaches[e2], this._layers, r2, t4, i2, a2));\n return this.placement && o2.push(function(t5, e2, i3, a3, s3, o3, r3) {\n const n2 = {}, l2 = o3.queryRenderedSymbols(a3), h2 = [];\n for (const t6 of Object.keys(l2).map(Number)) h2.push(r3[t6]);\n h2.sort(V);\n for (const i4 of h2) {\n const a4 = i4.featureIndex.lookupSymbolFeatures(l2[i4.bucketInstanceId], e2, i4.bucketIndex, i4.sourceLayerIndex, s3.filter, s3.layers, s3.availableImages, t5);\n for (const t6 in a4) {\n const e3 = n2[t6] = n2[t6] || [], s4 = a4[t6];\n s4.sort((t7, e4) => {\n const a5 = i4.featureSortOrder;\n if (a5) {\n const i5 = a5.indexOf(t7.featureIndex);\n return a5.indexOf(e4.featureIndex) - i5;\n }\n return e4.featureIndex - t7.featureIndex;\n });\n for (const t7 of s4) e3.push(t7);\n }\n }\n for (const e3 in n2) n2[e3].forEach((a4) => {\n const s4 = a4.feature, o4 = i3[t5[e3].source].getFeatureState(s4.layer[\"source-layer\"], s4.id);\n s4.source = s4.layer.source, s4.layer[\"source-layer\"] && (s4.sourceLayer = s4.layer[\"source-layer\"]), s4.state = o4;\n });\n return n2;\n }(this._layers, r2, this.sourceCaches, t4, i2, this.placement.collisionIndex, this.placement.retainedQueryData)), this._flattenAndSortRenderedFeatures(o2);\n }\n querySourceFeatures(t4, i2) {\n i2 && i2.filter && this._validate(e.u.filter, \"querySourceFeatures.filter\", i2.filter, null, i2);\n const a2 = this.sourceCaches[t4];\n return a2 ? function(t5, e2) {\n const i3 = t5.getRenderableIds().map((e3) => t5.getTileByID(e3)), a3 = [], s2 = {};\n for (let t6 = 0; t6 < i3.length; t6++) {\n const o2 = i3[t6], r2 = o2.tileID.canonical.key;\n s2[r2] || (s2[r2] = true, o2.querySourceFeatures(a3, e2));\n }\n return a3;\n }(a2, i2) : [];\n }\n getLight() {\n return this.light.getLight();\n }\n setLight(t4, i2 = {}) {\n this._checkLoaded();\n const a2 = this.light.getLight();\n let s2 = false;\n for (const i3 in t4) if (!e.aE(t4[i3], a2[i3])) {\n s2 = true;\n break;\n }\n if (!s2) return;\n const r2 = { now: o.now(), transition: e.e({ duration: 300, delay: 0 }, this.stylesheet.transition) };\n this.light.setLight(t4, i2), this.light.updateTransitions(r2);\n }\n getSky() {\n var t4;\n return null === (t4 = this.stylesheet) || void 0 === t4 ? void 0 : t4.sky;\n }\n setSky(t4, i2 = {}) {\n const a2 = this.getSky();\n let s2 = false;\n if (!t4 && !a2) return;\n if (t4 && !a2) s2 = true;\n else if (!t4 && a2) s2 = true;\n else for (const i3 in t4) if (!e.aE(t4[i3], a2[i3])) {\n s2 = true;\n break;\n }\n if (!s2) return;\n const r2 = { now: o.now(), transition: e.e({ duration: 300, delay: 0 }, this.stylesheet.transition) };\n this.stylesheet.sky = t4, this.sky.setSky(t4, i2), this.sky.updateTransitions(r2);\n }\n _validate(t4, i2, a2, s2, o2 = {}) {\n return (!o2 || false !== o2.validate) && ce(this, t4.call(e.u, e.e({ key: i2, style: this.serialize(), value: a2, styleSpec: e.v }, s2)));\n }\n _remove(t4 = true) {\n this._frameRequest && (this._frameRequest.abort(), this._frameRequest = null), this._loadStyleRequest && (this._loadStyleRequest.abort(), this._loadStyleRequest = null), this._spriteRequest && (this._spriteRequest.abort(), this._spriteRequest = null), nt().off(st, this._rtlPluginLoaded);\n for (const t5 in this._layers) this._layers[t5].setEventedParent(null);\n for (const t5 in this.sourceCaches) {\n const e2 = this.sourceCaches[t5];\n e2.setEventedParent(null), e2.onRemove(this.map);\n }\n this.imageManager.setEventedParent(null), this.setEventedParent(null), t4 && this.dispatcher.broadcast(\"RM\", void 0), this.dispatcher.remove(t4);\n }\n _clearSource(t4) {\n this.sourceCaches[t4].clearTiles();\n }\n _reloadSource(t4) {\n this.sourceCaches[t4].resume(), this.sourceCaches[t4].reload();\n }\n _updateSources(t4) {\n for (const e2 in this.sourceCaches) this.sourceCaches[e2].update(t4, this.map.terrain);\n }\n _generateCollisionBoxes() {\n for (const t4 in this.sourceCaches) this._reloadSource(t4);\n }\n _updatePlacement(t4, e2, i2, a2, s2 = false) {\n let r2 = false, n2 = false;\n const l2 = {};\n for (const e3 of this._order) {\n const i3 = this._layers[e3];\n if (\"symbol\" !== i3.type) continue;\n if (!l2[i3.source]) {\n const t5 = this.sourceCaches[i3.source];\n l2[i3.source] = t5.getRenderableIds(true).map((e4) => t5.getTileByID(e4)).sort((t6, e4) => e4.tileID.overscaledZ - t6.tileID.overscaledZ || (t6.tileID.isLessThan(e4.tileID) ? -1 : 1));\n }\n const a3 = this.crossTileSymbolIndex.addLayer(i3, l2[i3.source], t4.center.lng);\n r2 = r2 || a3;\n }\n if (this.crossTileSymbolIndex.pruneUnusedLayers(this._order), ((s2 = s2 || this._layerOrderChanged || 0 === i2) || !this.pauseablePlacement || this.pauseablePlacement.isDone() && !this.placement.stillRecent(o.now(), t4.zoom)) && (this.pauseablePlacement = new se(t4, this.map.terrain, this._order, s2, e2, i2, a2, this.placement), this._layerOrderChanged = false), this.pauseablePlacement.isDone() ? this.placement.setStale() : (this.pauseablePlacement.continuePlacement(this._order, this._layers, l2), this.pauseablePlacement.isDone() && (this.placement = this.pauseablePlacement.commit(o.now()), n2 = true), r2 && this.pauseablePlacement.placement.setStale()), n2 || r2) for (const t5 of this._order) {\n const e3 = this._layers[t5];\n \"symbol\" === e3.type && this.placement.updateLayerOpacities(e3, l2[e3.source]);\n }\n return !this.pauseablePlacement.isDone() || this.placement.hasTransitions(o.now());\n }\n _releaseSymbolFadeTiles() {\n for (const t4 in this.sourceCaches) this.sourceCaches[t4].releaseSymbolFadeTiles();\n }\n getImages(t4, i2) {\n return e._(this, void 0, void 0, function* () {\n const t5 = yield this.imageManager.getImages(i2.icons);\n this._updateTilesForChangedImages();\n const e2 = this.sourceCaches[i2.source];\n return e2 && e2.setDependencies(i2.tileID.key, i2.type, i2.icons), t5;\n });\n }\n getGlyphs(t4, i2) {\n return e._(this, void 0, void 0, function* () {\n const t5 = yield this.glyphManager.getGlyphs(i2.stacks), e2 = this.sourceCaches[i2.source];\n return e2 && e2.setDependencies(i2.tileID.key, i2.type, [\"\"]), t5;\n });\n }\n getGlyphsUrl() {\n return this.stylesheet.glyphs || null;\n }\n setGlyphs(t4, i2 = {}) {\n this._checkLoaded(), t4 && this._validate(e.u.glyphs, \"glyphs\", t4, null, i2) || (this._glyphsDidChange = true, this.stylesheet.glyphs = t4, this.glyphManager.entries = {}, this.glyphManager.setURL(t4));\n }\n addSprite(t4, i2, a2 = {}, s2) {\n this._checkLoaded();\n const o2 = [{ id: t4, url: i2 }], r2 = [...x(this.stylesheet.sprite), ...o2];\n this._validate(e.u.sprite, \"sprite\", r2, null, a2) || (this.stylesheet.sprite = r2, this._loadSprite(o2, true, s2));\n }\n removeSprite(t4) {\n this._checkLoaded();\n const i2 = x(this.stylesheet.sprite);\n if (i2.find((e2) => e2.id === t4)) {\n if (this._spritesImagesIds[t4]) for (const e2 of this._spritesImagesIds[t4]) this.imageManager.removeImage(e2), this._changedImages[e2] = true;\n i2.splice(i2.findIndex((e2) => e2.id === t4), 1), this.stylesheet.sprite = i2.length > 0 ? i2 : void 0, delete this._spritesImagesIds[t4], this._availableImages = this.imageManager.listImages(), this._changed = true, this.dispatcher.broadcast(\"SI\", this._availableImages), this.fire(new e.k(\"data\", { dataType: \"style\" }));\n } else this.fire(new e.j(new Error(`Sprite \"${t4}\" doesn't exists on this map.`)));\n }\n getSprite() {\n return x(this.stylesheet.sprite);\n }\n setSprite(t4, i2 = {}, a2) {\n this._checkLoaded(), t4 && this._validate(e.u.sprite, \"sprite\", t4, null, i2) || (this.stylesheet.sprite = t4, t4 ? this._loadSprite(t4, true, a2) : (this._unloadSprite(), a2 && a2(null)));\n }\n }\n var _e = e.Y([{ name: \"a_pos\", type: \"Int16\", components: 2 }]);\n const pe = { prelude: me(\"#ifdef GL_ES\\nprecision mediump float;\\n#else\\n#if !defined(lowp)\\n#define lowp\\n#endif\\n#if !defined(mediump)\\n#define mediump\\n#endif\\n#if !defined(highp)\\n#define highp\\n#endif\\n#endif\\n\", \"#ifdef GL_ES\\nprecision highp float;\\n#else\\n#if !defined(lowp)\\n#define lowp\\n#endif\\n#if !defined(mediump)\\n#define mediump\\n#endif\\n#if !defined(highp)\\n#define highp\\n#endif\\n#endif\\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\\n#ifdef TERRAIN3D\\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\\n#endif\\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\\n#ifdef TERRAIN3D\\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\\n#else\\nreturn 1.0;\\n#endif\\n}float calculate_visibility(vec4 pos) {\\n#ifdef TERRAIN3D\\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\\n#else\\nreturn 1.0;\\n#endif\\n}float ele(vec2 pos) {\\n#ifdef TERRAIN3D\\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\\n#else\\nreturn 0.0;\\n#endif\\n}float get_elevation(vec2 pos) {\\n#ifdef TERRAIN3D\\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\\n#else\\nreturn 0.0;\\n#endif\\n}\"), background: me(\"uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}\"), backgroundPattern: me(\"uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}\"), circle: me(\"varying vec3 v_data;varying float v_visibility;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define mediump float radius\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define highp vec4 stroke_color\\n#pragma mapbox: define mediump float stroke_width\\n#pragma mapbox: define lowp float stroke_opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize mediump float radius\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize highp vec4 stroke_color\\n#pragma mapbox: initialize mediump float stroke_width\\n#pragma mapbox: initialize lowp float stroke_opacity\\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define mediump float radius\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define highp vec4 stroke_color\\n#pragma mapbox: define mediump float stroke_width\\n#pragma mapbox: define lowp float stroke_opacity\\nvoid main(void) {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize mediump float radius\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize highp vec4 stroke_color\\n#pragma mapbox: initialize mediump float stroke_width\\n#pragma mapbox: initialize lowp float stroke_opacity\\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}\"), clippingMask: me(\"void main() {gl_FragColor=vec4(1.0);}\", \"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}\"), heatmap: me(\"uniform highp float u_intensity;varying vec2 v_extrude;\\n#pragma mapbox: define highp float weight\\n#define GAUSS_COEF 0.3989422804014327\\nvoid main() {\\n#pragma mapbox: initialize highp float weight\\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\\n#pragma mapbox: define highp float weight\\n#pragma mapbox: define mediump float radius\\nconst highp float ZERO=1.0/255.0/16.0;\\n#define GAUSS_COEF 0.3989422804014327\\nvoid main(void) {\\n#pragma mapbox: initialize highp float weight\\n#pragma mapbox: initialize mediump float radius\\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}\"), heatmapTexture: me(\"uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(0.0);\\n#endif\\n}\", \"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}\"), collisionBox: me(\"varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}\", \"attribute vec2 a_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}\"), collisionCircle: me(\"varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}\", \"attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}\"), debug: me(\"uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}\", \"attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}\"), fill: me(\"#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float opacity\\ngl_FragColor=color*opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"attribute vec2 a_pos;uniform mat4 u_matrix;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float opacity\\ngl_Position=u_matrix*vec4(a_pos,0,1);}\"), fillOutline: me(\"varying vec2 v_pos;\\n#pragma mapbox: define highp vec4 outline_color\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 outline_color\\n#pragma mapbox: initialize lowp float opacity\\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\\n#pragma mapbox: define highp vec4 outline_color\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 outline_color\\n#pragma mapbox: initialize lowp float opacity\\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}\"), fillOutlinePattern: me(\"uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}\"), fillPattern: me(\"#ifdef GL_ES\\nprecision highp float;\\n#endif\\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}\"), fillExtrusion: me(\"varying vec4 v_color;void main() {gl_FragColor=v_color;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\\n#ifdef TERRAIN3D\\nattribute vec2 a_centroid;\\n#endif\\nvarying vec4 v_color;\\n#pragma mapbox: define highp float base\\n#pragma mapbox: define highp float height\\n#pragma mapbox: define highp vec4 color\\nvoid main() {\\n#pragma mapbox: initialize highp float base\\n#pragma mapbox: initialize highp float height\\n#pragma mapbox: initialize highp vec4 color\\nvec3 normal=a_normal_ed.xyz;\\n#ifdef TERRAIN3D\\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\\n#else\\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\\n#endif\\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}\"), fillExtrusionPattern: me(\"uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\\n#pragma mapbox: define lowp float base\\n#pragma mapbox: define lowp float height\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float base\\n#pragma mapbox: initialize lowp float height\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\\n#ifdef TERRAIN3D\\nattribute vec2 a_centroid;\\n#endif\\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\\n#pragma mapbox: define lowp float base\\n#pragma mapbox: define lowp float height\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float base\\n#pragma mapbox: initialize lowp float height\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\\n#ifdef TERRAIN3D\\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\\n#else\\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\\n#endif\\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\\n? a_pos\\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}\"), hillshadePrepare: me(\"#ifdef GL_ES\\nprecision highp float;\\n#endif\\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}\"), hillshade: me(\"uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\\n#define PI 3.141592653589793\\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}\"), line: me(\"uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"\\n#define scale 0.015873016\\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define mediump float gapwidth\\n#pragma mapbox: define lowp float offset\\n#pragma mapbox: define mediump float width\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump float gapwidth\\n#pragma mapbox: initialize lowp float offset\\n#pragma mapbox: initialize mediump float width\\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\\n#ifdef TERRAIN3D\\nv_gamma_scale=1.0;\\n#else\\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\\n#endif\\nv_width2=vec2(outset,inset);}\"), lineGradient: me(\"uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"\\n#define scale 0.015873016\\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define mediump float gapwidth\\n#pragma mapbox: define lowp float offset\\n#pragma mapbox: define mediump float width\\nvoid main() {\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump float gapwidth\\n#pragma mapbox: initialize lowp float offset\\n#pragma mapbox: initialize mediump float width\\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\\n#ifdef TERRAIN3D\\nv_gamma_scale=1.0;\\n#else\\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\\n#endif\\nv_width2=vec2(outset,inset);}\"), linePattern: me(\"#ifdef GL_ES\\nprecision highp float;\\n#endif\\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"\\n#define scale 0.015873016\\n#define LINE_DISTANCE_SCALE 2.0\\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float offset\\n#pragma mapbox: define mediump float gapwidth\\n#pragma mapbox: define mediump float width\\n#pragma mapbox: define lowp float floorwidth\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float offset\\n#pragma mapbox: initialize mediump float gapwidth\\n#pragma mapbox: initialize mediump float width\\n#pragma mapbox: initialize lowp float floorwidth\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\\n#ifdef TERRAIN3D\\nv_gamma_scale=1.0;\\n#else\\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\\n#endif\\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}\"), lineSDF: me(\"uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define mediump float width\\n#pragma mapbox: define lowp float floorwidth\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump float width\\n#pragma mapbox: initialize lowp float floorwidth\\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"\\n#define scale 0.015873016\\n#define LINE_DISTANCE_SCALE 2.0\\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define mediump float gapwidth\\n#pragma mapbox: define lowp float offset\\n#pragma mapbox: define mediump float width\\n#pragma mapbox: define lowp float floorwidth\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump float gapwidth\\n#pragma mapbox: initialize lowp float offset\\n#pragma mapbox: initialize mediump float width\\n#pragma mapbox: initialize lowp float floorwidth\\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\\n#ifdef TERRAIN3D\\nv_gamma_scale=1.0;\\n#else\\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\\n#endif\\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}\"), raster: me(\"uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}\"), symbolIcon: me(\"uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}\"), symbolSDF: me(\"#define SDF_PX 8.0\\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}\"), symbolTextAndIcon: me(\"#define SDF_PX 8.0\\n#define SDF 1.0\\n#define ICON 0.0\\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\", \"attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}\"), terrain: me(\"uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}\", \"attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}\"), terrainDepth: me(\"varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}\", \"attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}\"), terrainCoords: me(\"precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}\", \"attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}\"), sky: me(\"uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}\", \"attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}\") };\n function me(t4, e2) {\n const i2 = /#pragma mapbox: ([\\w]+) ([\\w]+) ([\\w]+) ([\\w]+)/g, a2 = e2.match(/attribute ([\\w]+) ([\\w]+)/g), s2 = t4.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g), o2 = e2.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g), r2 = o2 ? o2.concat(s2) : s2, n2 = {};\n return { fragmentSource: t4 = t4.replace(i2, (t5, e3, i3, a3, s3) => (n2[s3] = true, \"define\" === e3 ? `\n#ifndef HAS_UNIFORM_u_${s3}\nvarying ${i3} ${a3} ${s3};\n#else\nuniform ${i3} ${a3} u_${s3};\n#endif\n` : `\n#ifdef HAS_UNIFORM_u_${s3}\n ${i3} ${a3} ${s3} = u_${s3};\n#endif\n`)), vertexSource: e2 = e2.replace(i2, (t5, e3, i3, a3, s3) => {\n const o3 = \"float\" === a3 ? \"vec2\" : \"vec4\", r3 = s3.match(/color/) ? \"color\" : o3;\n return n2[s3] ? \"define\" === e3 ? `\n#ifndef HAS_UNIFORM_u_${s3}\nuniform lowp float u_${s3}_t;\nattribute ${i3} ${o3} a_${s3};\nvarying ${i3} ${a3} ${s3};\n#else\nuniform ${i3} ${a3} u_${s3};\n#endif\n` : \"vec4\" === r3 ? `\n#ifndef HAS_UNIFORM_u_${s3}\n ${s3} = a_${s3};\n#else\n ${i3} ${a3} ${s3} = u_${s3};\n#endif\n` : `\n#ifndef HAS_UNIFORM_u_${s3}\n ${s3} = unpack_mix_${r3}(a_${s3}, u_${s3}_t);\n#else\n ${i3} ${a3} ${s3} = u_${s3};\n#endif\n` : \"define\" === e3 ? `\n#ifndef HAS_UNIFORM_u_${s3}\nuniform lowp float u_${s3}_t;\nattribute ${i3} ${o3} a_${s3};\n#else\nuniform ${i3} ${a3} u_${s3};\n#endif\n` : \"vec4\" === r3 ? `\n#ifndef HAS_UNIFORM_u_${s3}\n ${i3} ${a3} ${s3} = a_${s3};\n#else\n ${i3} ${a3} ${s3} = u_${s3};\n#endif\n` : `\n#ifndef HAS_UNIFORM_u_${s3}\n ${i3} ${a3} ${s3} = unpack_mix_${r3}(a_${s3}, u_${s3}_t);\n#else\n ${i3} ${a3} ${s3} = u_${s3};\n#endif\n`;\n }), staticAttributes: a2, staticUniforms: r2 };\n }\n class fe {\n constructor() {\n this.boundProgram = null, this.boundLayoutVertexBuffer = null, this.boundPaintVertexBuffers = [], this.boundIndexBuffer = null, this.boundVertexOffset = null, this.boundDynamicVertexBuffer = null, this.vao = null;\n }\n bind(t4, e2, i2, a2, s2, o2, r2, n2, l2) {\n this.context = t4;\n let h2 = this.boundPaintVertexBuffers.length !== a2.length;\n for (let t5 = 0; !h2 && t5 < a2.length; t5++) this.boundPaintVertexBuffers[t5] !== a2[t5] && (h2 = true);\n !this.vao || this.boundProgram !== e2 || this.boundLayoutVertexBuffer !== i2 || h2 || this.boundIndexBuffer !== s2 || this.boundVertexOffset !== o2 || this.boundDynamicVertexBuffer !== r2 || this.boundDynamicVertexBuffer2 !== n2 || this.boundDynamicVertexBuffer3 !== l2 ? this.freshBind(e2, i2, a2, s2, o2, r2, n2, l2) : (t4.bindVertexArray.set(this.vao), r2 && r2.bind(), s2 && s2.dynamicDraw && s2.bind(), n2 && n2.bind(), l2 && l2.bind());\n }\n freshBind(t4, e2, i2, a2, s2, o2, r2, n2) {\n const l2 = t4.numAttributes, h2 = this.context, c2 = h2.gl;\n this.vao && this.destroy(), this.vao = h2.createVertexArray(), h2.bindVertexArray.set(this.vao), this.boundProgram = t4, this.boundLayoutVertexBuffer = e2, this.boundPaintVertexBuffers = i2, this.boundIndexBuffer = a2, this.boundVertexOffset = s2, this.boundDynamicVertexBuffer = o2, this.boundDynamicVertexBuffer2 = r2, this.boundDynamicVertexBuffer3 = n2, e2.enableAttributes(c2, t4);\n for (const e3 of i2) e3.enableAttributes(c2, t4);\n o2 && o2.enableAttributes(c2, t4), r2 && r2.enableAttributes(c2, t4), n2 && n2.enableAttributes(c2, t4), e2.bind(), e2.setVertexAttribPointers(c2, t4, s2);\n for (const e3 of i2) e3.bind(), e3.setVertexAttribPointers(c2, t4, s2);\n o2 && (o2.bind(), o2.setVertexAttribPointers(c2, t4, s2)), a2 && a2.bind(), r2 && (r2.bind(), r2.setVertexAttribPointers(c2, t4, s2)), n2 && (n2.bind(), n2.setVertexAttribPointers(c2, t4, s2)), h2.currentNumAttributes = l2;\n }\n destroy() {\n this.vao && (this.context.deleteVertexArray(this.vao), this.vao = null);\n }\n }\n const ge = (t4, i2, a2, s2, o2) => ({ u_matrix: t4, u_texture: 0, u_ele_delta: i2, u_fog_matrix: a2, u_fog_color: s2 ? s2.properties.get(\"fog-color\") : e.aM.white, u_fog_ground_blend: s2 ? s2.properties.get(\"fog-ground-blend\") : 1, u_fog_ground_blend_opacity: s2 ? s2.calculateFogBlendOpacity(o2) : 0, u_horizon_color: s2 ? s2.properties.get(\"horizon-color\") : e.aM.white, u_horizon_fog_blend: s2 ? s2.properties.get(\"horizon-fog-blend\") : 1 });\n function ve(t4) {\n const e2 = [];\n for (let i2 = 0; i2 < t4.length; i2++) {\n if (null === t4[i2]) continue;\n const a2 = t4[i2].split(\" \");\n e2.push(a2.pop());\n }\n return e2;\n }\n class xe {\n constructor(t4, i2, a2, s2, o2, r2) {\n const n2 = t4.gl;\n this.program = n2.createProgram();\n const l2 = ve(i2.staticAttributes), h2 = a2 ? a2.getBinderAttributes() : [], c2 = l2.concat(h2), u2 = pe.prelude.staticUniforms ? ve(pe.prelude.staticUniforms) : [], d2 = i2.staticUniforms ? ve(i2.staticUniforms) : [], _2 = a2 ? a2.getBinderUniforms() : [], p2 = u2.concat(d2).concat(_2), m2 = [];\n for (const t5 of p2) m2.indexOf(t5) < 0 && m2.push(t5);\n const f2 = a2 ? a2.defines() : [];\n o2 && f2.push(\"#define OVERDRAW_INSPECTOR;\"), r2 && f2.push(\"#define TERRAIN3D;\");\n const g2 = f2.concat(pe.prelude.fragmentSource, i2.fragmentSource).join(\"\\n\"), v2 = f2.concat(pe.prelude.vertexSource, i2.vertexSource).join(\"\\n\"), x2 = n2.createShader(n2.FRAGMENT_SHADER);\n if (n2.isContextLost()) return void (this.failedToCreate = true);\n if (n2.shaderSource(x2, g2), n2.compileShader(x2), !n2.getShaderParameter(x2, n2.COMPILE_STATUS)) throw new Error(`Could not compile fragment shader: ${n2.getShaderInfoLog(x2)}`);\n n2.attachShader(this.program, x2);\n const y2 = n2.createShader(n2.VERTEX_SHADER);\n if (n2.isContextLost()) return void (this.failedToCreate = true);\n if (n2.shaderSource(y2, v2), n2.compileShader(y2), !n2.getShaderParameter(y2, n2.COMPILE_STATUS)) throw new Error(`Could not compile vertex shader: ${n2.getShaderInfoLog(y2)}`);\n n2.attachShader(this.program, y2), this.attributes = {};\n const b2 = {};\n this.numAttributes = c2.length;\n for (let t5 = 0; t5 < this.numAttributes; t5++) c2[t5] && (n2.bindAttribLocation(this.program, t5, c2[t5]), this.attributes[c2[t5]] = t5);\n if (n2.linkProgram(this.program), !n2.getProgramParameter(this.program, n2.LINK_STATUS)) throw new Error(`Program failed to link: ${n2.getProgramInfoLog(this.program)}`);\n n2.deleteShader(y2), n2.deleteShader(x2);\n for (let t5 = 0; t5 < m2.length; t5++) {\n const e2 = m2[t5];\n if (e2 && !b2[e2]) {\n const t6 = n2.getUniformLocation(this.program, e2);\n t6 && (b2[e2] = t6);\n }\n }\n this.fixedUniforms = s2(t4, b2), this.terrainUniforms = ((t5, i3) => ({ u_depth: new e.aH(t5, i3.u_depth), u_terrain: new e.aH(t5, i3.u_terrain), u_terrain_dim: new e.aI(t5, i3.u_terrain_dim), u_terrain_matrix: new e.aJ(t5, i3.u_terrain_matrix), u_terrain_unpack: new e.aK(t5, i3.u_terrain_unpack), u_terrain_exaggeration: new e.aI(t5, i3.u_terrain_exaggeration) }))(t4, b2), this.binderUniforms = a2 ? a2.getUniforms(t4, b2) : [];\n }\n draw(t4, e2, i2, a2, s2, o2, r2, n2, l2, h2, c2, u2, d2, _2, p2, m2, f2, g2) {\n const v2 = t4.gl;\n if (this.failedToCreate) return;\n if (t4.program.set(this.program), t4.setDepthMode(i2), t4.setStencilMode(a2), t4.setColorMode(s2), t4.setCullFace(o2), n2) {\n t4.activeTexture.set(v2.TEXTURE2), v2.bindTexture(v2.TEXTURE_2D, n2.depthTexture), t4.activeTexture.set(v2.TEXTURE3), v2.bindTexture(v2.TEXTURE_2D, n2.texture);\n for (const t5 in this.terrainUniforms) this.terrainUniforms[t5].set(n2[t5]);\n }\n for (const t5 in this.fixedUniforms) this.fixedUniforms[t5].set(r2[t5]);\n p2 && p2.setUniforms(t4, this.binderUniforms, d2, { zoom: _2 });\n let x2 = 0;\n switch (e2) {\n case v2.LINES:\n x2 = 2;\n break;\n case v2.TRIANGLES:\n x2 = 3;\n break;\n case v2.LINE_STRIP:\n x2 = 1;\n }\n for (const i3 of u2.get()) {\n const a3 = i3.vaos || (i3.vaos = {});\n (a3[l2] || (a3[l2] = new fe())).bind(t4, this, h2, p2 ? p2.getPaintVertexBuffers() : [], c2, i3.vertexOffset, m2, f2, g2), v2.drawElements(e2, i3.primitiveLength * x2, v2.UNSIGNED_SHORT, i3.primitiveOffset * x2 * 2);\n }\n }\n }\n function ye(t4, e2, i2) {\n const a2 = 1 / Bt(i2, 1, e2.transform.tileZoom), s2 = Math.pow(2, i2.tileID.overscaledZ), o2 = i2.tileSize * Math.pow(2, e2.transform.tileZoom) / s2, r2 = o2 * (i2.tileID.canonical.x + i2.tileID.wrap * s2), n2 = o2 * i2.tileID.canonical.y;\n return { u_image: 0, u_texsize: i2.imageAtlasTexture.size, u_scale: [a2, t4.fromScale, t4.toScale], u_fade: t4.t, u_pixel_coord_upper: [r2 >> 16, n2 >> 16], u_pixel_coord_lower: [65535 & r2, 65535 & n2] };\n }\n const be = (t4, i2, a2, s2) => {\n const o2 = i2.style.light, r2 = o2.properties.get(\"position\"), n2 = [r2.x, r2.y, r2.z], l2 = function() {\n var t5 = new e.A(9);\n return e.A != Float32Array && (t5[1] = 0, t5[2] = 0, t5[3] = 0, t5[5] = 0, t5[6] = 0, t5[7] = 0), t5[0] = 1, t5[4] = 1, t5[8] = 1, t5;\n }();\n \"viewport\" === o2.properties.get(\"anchor\") && function(t5, e2) {\n var i3 = Math.sin(e2), a3 = Math.cos(e2);\n t5[0] = a3, t5[1] = i3, t5[2] = 0, t5[3] = -i3, t5[4] = a3, t5[5] = 0, t5[6] = 0, t5[7] = 0, t5[8] = 1;\n }(l2, -i2.transform.angle), function(t5, e2, i3) {\n var a3 = e2[0], s3 = e2[1], o3 = e2[2];\n t5[0] = a3 * i3[0] + s3 * i3[3] + o3 * i3[6], t5[1] = a3 * i3[1] + s3 * i3[4] + o3 * i3[7], t5[2] = a3 * i3[2] + s3 * i3[5] + o3 * i3[8];\n }(n2, n2, l2);\n const h2 = o2.properties.get(\"color\");\n return { u_matrix: t4, u_lightpos: n2, u_lightintensity: o2.properties.get(\"intensity\"), u_lightcolor: [h2.r, h2.g, h2.b], u_vertical_gradient: +a2, u_opacity: s2 };\n }, we = (t4, i2, a2, s2, o2, r2, n2) => e.e(be(t4, i2, a2, s2), ye(r2, i2, n2), { u_height_factor: -Math.pow(2, o2.overscaledZ) / n2.tileSize / 8 }), Te = (t4) => ({ u_matrix: t4 }), Ie = (t4, i2, a2, s2) => e.e(Te(t4), ye(a2, i2, s2)), Ee = (t4, e2) => ({ u_matrix: t4, u_world: e2 }), Pe = (t4, i2, a2, s2, o2) => e.e(Ie(t4, i2, a2, s2), { u_world: o2 }), Ce = (t4, e2, i2, a2) => {\n const s2 = t4.transform;\n let o2, r2;\n if (\"map\" === a2.paint.get(\"circle-pitch-alignment\")) {\n const t5 = Bt(i2, 1, s2.zoom);\n o2 = true, r2 = [t5, t5];\n } else o2 = false, r2 = s2.pixelsToGLUnits;\n return { u_camera_to_center_distance: s2.cameraToCenterDistance, u_scale_with_map: +(\"map\" === a2.paint.get(\"circle-pitch-scale\")), u_matrix: t4.translatePosMatrix(e2.posMatrix, i2, a2.paint.get(\"circle-translate\"), a2.paint.get(\"circle-translate-anchor\")), u_pitch_with_map: +o2, u_device_pixel_ratio: t4.pixelRatio, u_extrude_scale: r2 };\n }, Se = (t4, e2, i2) => ({ u_matrix: t4, u_inv_matrix: e2, u_camera_to_center_distance: i2.cameraToCenterDistance, u_viewport_size: [i2.width, i2.height] }), ze = (t4, e2, i2 = 1) => ({ u_matrix: t4, u_color: e2, u_overlay: 0, u_overlay_scale: i2 }), De = (t4) => ({ u_matrix: t4 }), Me = (t4, e2, i2, a2) => ({ u_matrix: t4, u_extrude_scale: Bt(e2, 1, i2), u_intensity: a2 }), Ae = (t4, i2, a2, s2) => {\n const o2 = e.H();\n e.aP(o2, 0, t4.width, t4.height, 0, 0, 1);\n const r2 = t4.context.gl;\n return { u_matrix: o2, u_world: [r2.drawingBufferWidth, r2.drawingBufferHeight], u_image: a2, u_color_ramp: s2, u_opacity: i2.paint.get(\"heatmap-opacity\") };\n };\n function Re(t4, i2) {\n const a2 = Math.pow(2, i2.canonical.z), s2 = i2.canonical.y;\n return [new e.Z(0, s2 / a2).toLngLat().lat, new e.Z(0, (s2 + 1) / a2).toLngLat().lat];\n }\n const ke = (t4, e2, i2, a2) => {\n const s2 = t4.transform;\n return { u_matrix: Ne(t4, e2, i2, a2), u_ratio: 1 / Bt(e2, 1, s2.zoom), u_device_pixel_ratio: t4.pixelRatio, u_units_to_pixels: [1 / s2.pixelsToGLUnits[0], 1 / s2.pixelsToGLUnits[1]] };\n }, Le = (t4, i2, a2, s2, o2) => e.e(ke(t4, i2, a2, o2), { u_image: 0, u_image_height: s2 }), Fe = (t4, e2, i2, a2, s2) => {\n const o2 = t4.transform, r2 = Oe(e2, o2);\n return { u_matrix: Ne(t4, e2, i2, s2), u_texsize: e2.imageAtlasTexture.size, u_ratio: 1 / Bt(e2, 1, o2.zoom), u_device_pixel_ratio: t4.pixelRatio, u_image: 0, u_scale: [r2, a2.fromScale, a2.toScale], u_fade: a2.t, u_units_to_pixels: [1 / o2.pixelsToGLUnits[0], 1 / o2.pixelsToGLUnits[1]] };\n }, Be = (t4, i2, a2, s2, o2, r2) => {\n const n2 = t4.lineAtlas, l2 = Oe(i2, t4.transform), h2 = \"round\" === a2.layout.get(\"line-cap\"), c2 = n2.getDash(s2.from, h2), u2 = n2.getDash(s2.to, h2), d2 = c2.width * o2.fromScale, _2 = u2.width * o2.toScale;\n return e.e(ke(t4, i2, a2, r2), { u_patternscale_a: [l2 / d2, -c2.height / 2], u_patternscale_b: [l2 / _2, -u2.height / 2], u_sdfgamma: n2.width / (256 * Math.min(d2, _2) * t4.pixelRatio) / 2, u_image: 0, u_tex_y_a: c2.y, u_tex_y_b: u2.y, u_mix: o2.t });\n };\n function Oe(t4, e2) {\n return 1 / Bt(t4, 1, e2.tileZoom);\n }\n function Ne(t4, e2, i2, a2) {\n return t4.translatePosMatrix(a2 ? a2.posMatrix : e2.tileID.posMatrix, e2, i2.paint.get(\"line-translate\"), i2.paint.get(\"line-translate-anchor\"));\n }\n const Ue = (t4, e2, i2, a2, s2) => {\n return { u_matrix: t4, u_tl_parent: e2, u_scale_parent: i2, u_buffer_scale: 1, u_fade_t: a2.mix, u_opacity: a2.opacity * s2.paint.get(\"raster-opacity\"), u_image0: 0, u_image1: 1, u_brightness_low: s2.paint.get(\"raster-brightness-min\"), u_brightness_high: s2.paint.get(\"raster-brightness-max\"), u_saturation_factor: (r2 = s2.paint.get(\"raster-saturation\"), r2 > 0 ? 1 - 1 / (1.001 - r2) : -r2), u_contrast_factor: (o2 = s2.paint.get(\"raster-contrast\"), o2 > 0 ? 1 / (1 - o2) : 1 + o2), u_spin_weights: je(s2.paint.get(\"raster-hue-rotate\")) };\n var o2, r2;\n };\n function je(t4) {\n t4 *= Math.PI / 180;\n const e2 = Math.sin(t4), i2 = Math.cos(t4);\n return [(2 * i2 + 1) / 3, (-Math.sqrt(3) * e2 - i2 + 1) / 3, (Math.sqrt(3) * e2 - i2 + 1) / 3];\n }\n const Ze = (t4, e2, i2, a2, s2, o2, r2, n2, l2, h2, c2, u2, d2, _2) => {\n const p2 = r2.transform;\n return { u_is_size_zoom_constant: +(\"constant\" === t4 || \"source\" === t4), u_is_size_feature_constant: +(\"constant\" === t4 || \"camera\" === t4), u_size_t: e2 ? e2.uSizeT : 0, u_size: e2 ? e2.uSize : 0, u_camera_to_center_distance: p2.cameraToCenterDistance, u_pitch: p2.pitch / 360 * 2 * Math.PI, u_rotate_symbol: +i2, u_aspect_ratio: p2.width / p2.height, u_fade_change: r2.options.fadeDuration ? r2.symbolFadeChange : 1, u_matrix: n2, u_label_plane_matrix: l2, u_coord_matrix: h2, u_is_text: +u2, u_pitch_with_map: +a2, u_is_along_line: s2, u_is_variable_anchor: o2, u_texsize: d2, u_texture: 0, u_translation: c2, u_pitched_scale: _2 };\n }, qe = (t4, i2, a2, s2, o2, r2, n2, l2, h2, c2, u2, d2, _2, p2, m2) => {\n const f2 = n2.transform;\n return e.e(Ze(t4, i2, a2, s2, o2, r2, n2, l2, h2, c2, u2, d2, _2, m2), { u_gamma_scale: s2 ? Math.cos(f2._pitch) * f2.cameraToCenterDistance : 1, u_device_pixel_ratio: n2.pixelRatio, u_is_halo: +p2 });\n }, Ve = (t4, i2, a2, s2, o2, r2, n2, l2, h2, c2, u2, d2, _2, p2) => e.e(qe(t4, i2, a2, s2, o2, r2, n2, l2, h2, c2, u2, true, d2, true, p2), { u_texsize_icon: _2, u_texture_icon: 1 }), Ge = (t4, e2, i2) => ({ u_matrix: t4, u_opacity: e2, u_color: i2 }), He = (t4, i2, a2, s2, o2, r2) => e.e(function(t5, e2, i3, a3) {\n const s3 = i3.imageManager.getPattern(t5.from.toString()), o3 = i3.imageManager.getPattern(t5.to.toString()), { width: r3, height: n2 } = i3.imageManager.getPixelSize(), l2 = Math.pow(2, a3.tileID.overscaledZ), h2 = a3.tileSize * Math.pow(2, i3.transform.tileZoom) / l2, c2 = h2 * (a3.tileID.canonical.x + a3.tileID.wrap * l2), u2 = h2 * a3.tileID.canonical.y;\n return { u_image: 0, u_pattern_tl_a: s3.tl, u_pattern_br_a: s3.br, u_pattern_tl_b: o3.tl, u_pattern_br_b: o3.br, u_texsize: [r3, n2], u_mix: e2.t, u_pattern_size_a: s3.displaySize, u_pattern_size_b: o3.displaySize, u_scale_a: e2.fromScale, u_scale_b: e2.toScale, u_tile_units_to_pixels: 1 / Bt(a3, 1, i3.transform.tileZoom), u_pixel_coord_upper: [c2 >> 16, u2 >> 16], u_pixel_coord_lower: [65535 & c2, 65535 & u2] };\n }(s2, r2, a2, o2), { u_matrix: t4, u_opacity: i2 }), We = { fillExtrusion: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_lightpos: new e.aN(t4, i2.u_lightpos), u_lightintensity: new e.aI(t4, i2.u_lightintensity), u_lightcolor: new e.aN(t4, i2.u_lightcolor), u_vertical_gradient: new e.aI(t4, i2.u_vertical_gradient), u_opacity: new e.aI(t4, i2.u_opacity) }), fillExtrusionPattern: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_lightpos: new e.aN(t4, i2.u_lightpos), u_lightintensity: new e.aI(t4, i2.u_lightintensity), u_lightcolor: new e.aN(t4, i2.u_lightcolor), u_vertical_gradient: new e.aI(t4, i2.u_vertical_gradient), u_height_factor: new e.aI(t4, i2.u_height_factor), u_image: new e.aH(t4, i2.u_image), u_texsize: new e.aO(t4, i2.u_texsize), u_pixel_coord_upper: new e.aO(t4, i2.u_pixel_coord_upper), u_pixel_coord_lower: new e.aO(t4, i2.u_pixel_coord_lower), u_scale: new e.aN(t4, i2.u_scale), u_fade: new e.aI(t4, i2.u_fade), u_opacity: new e.aI(t4, i2.u_opacity) }), fill: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix) }), fillPattern: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_image: new e.aH(t4, i2.u_image), u_texsize: new e.aO(t4, i2.u_texsize), u_pixel_coord_upper: new e.aO(t4, i2.u_pixel_coord_upper), u_pixel_coord_lower: new e.aO(t4, i2.u_pixel_coord_lower), u_scale: new e.aN(t4, i2.u_scale), u_fade: new e.aI(t4, i2.u_fade) }), fillOutline: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_world: new e.aO(t4, i2.u_world) }), fillOutlinePattern: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_world: new e.aO(t4, i2.u_world), u_image: new e.aH(t4, i2.u_image), u_texsize: new e.aO(t4, i2.u_texsize), u_pixel_coord_upper: new e.aO(t4, i2.u_pixel_coord_upper), u_pixel_coord_lower: new e.aO(t4, i2.u_pixel_coord_lower), u_scale: new e.aN(t4, i2.u_scale), u_fade: new e.aI(t4, i2.u_fade) }), circle: (t4, i2) => ({ u_camera_to_center_distance: new e.aI(t4, i2.u_camera_to_center_distance), u_scale_with_map: new e.aH(t4, i2.u_scale_with_map), u_pitch_with_map: new e.aH(t4, i2.u_pitch_with_map), u_extrude_scale: new e.aO(t4, i2.u_extrude_scale), u_device_pixel_ratio: new e.aI(t4, i2.u_device_pixel_ratio), u_matrix: new e.aJ(t4, i2.u_matrix) }), collisionBox: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_pixel_extrude_scale: new e.aO(t4, i2.u_pixel_extrude_scale) }), collisionCircle: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_inv_matrix: new e.aJ(t4, i2.u_inv_matrix), u_camera_to_center_distance: new e.aI(t4, i2.u_camera_to_center_distance), u_viewport_size: new e.aO(t4, i2.u_viewport_size) }), debug: (t4, i2) => ({ u_color: new e.aL(t4, i2.u_color), u_matrix: new e.aJ(t4, i2.u_matrix), u_overlay: new e.aH(t4, i2.u_overlay), u_overlay_scale: new e.aI(t4, i2.u_overlay_scale) }), clippingMask: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix) }), heatmap: (t4, i2) => ({ u_extrude_scale: new e.aI(t4, i2.u_extrude_scale), u_intensity: new e.aI(t4, i2.u_intensity), u_matrix: new e.aJ(t4, i2.u_matrix) }), heatmapTexture: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_world: new e.aO(t4, i2.u_world), u_image: new e.aH(t4, i2.u_image), u_color_ramp: new e.aH(t4, i2.u_color_ramp), u_opacity: new e.aI(t4, i2.u_opacity) }), hillshade: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_image: new e.aH(t4, i2.u_image), u_latrange: new e.aO(t4, i2.u_latrange), u_light: new e.aO(t4, i2.u_light), u_shadow: new e.aL(t4, i2.u_shadow), u_highlight: new e.aL(t4, i2.u_highlight), u_accent: new e.aL(t4, i2.u_accent) }), hillshadePrepare: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_image: new e.aH(t4, i2.u_image), u_dimension: new e.aO(t4, i2.u_dimension), u_zoom: new e.aI(t4, i2.u_zoom), u_unpack: new e.aK(t4, i2.u_unpack) }), line: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_ratio: new e.aI(t4, i2.u_ratio), u_device_pixel_ratio: new e.aI(t4, i2.u_device_pixel_ratio), u_units_to_pixels: new e.aO(t4, i2.u_units_to_pixels) }), lineGradient: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_ratio: new e.aI(t4, i2.u_ratio), u_device_pixel_ratio: new e.aI(t4, i2.u_device_pixel_ratio), u_units_to_pixels: new e.aO(t4, i2.u_units_to_pixels), u_image: new e.aH(t4, i2.u_image), u_image_height: new e.aI(t4, i2.u_image_height) }), linePattern: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_texsize: new e.aO(t4, i2.u_texsize), u_ratio: new e.aI(t4, i2.u_ratio), u_device_pixel_ratio: new e.aI(t4, i2.u_device_pixel_ratio), u_image: new e.aH(t4, i2.u_image), u_units_to_pixels: new e.aO(t4, i2.u_units_to_pixels), u_scale: new e.aN(t4, i2.u_scale), u_fade: new e.aI(t4, i2.u_fade) }), lineSDF: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_ratio: new e.aI(t4, i2.u_ratio), u_device_pixel_ratio: new e.aI(t4, i2.u_device_pixel_ratio), u_units_to_pixels: new e.aO(t4, i2.u_units_to_pixels), u_patternscale_a: new e.aO(t4, i2.u_patternscale_a), u_patternscale_b: new e.aO(t4, i2.u_patternscale_b), u_sdfgamma: new e.aI(t4, i2.u_sdfgamma), u_image: new e.aH(t4, i2.u_image), u_tex_y_a: new e.aI(t4, i2.u_tex_y_a), u_tex_y_b: new e.aI(t4, i2.u_tex_y_b), u_mix: new e.aI(t4, i2.u_mix) }), raster: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_tl_parent: new e.aO(t4, i2.u_tl_parent), u_scale_parent: new e.aI(t4, i2.u_scale_parent), u_buffer_scale: new e.aI(t4, i2.u_buffer_scale), u_fade_t: new e.aI(t4, i2.u_fade_t), u_opacity: new e.aI(t4, i2.u_opacity), u_image0: new e.aH(t4, i2.u_image0), u_image1: new e.aH(t4, i2.u_image1), u_brightness_low: new e.aI(t4, i2.u_brightness_low), u_brightness_high: new e.aI(t4, i2.u_brightness_high), u_saturation_factor: new e.aI(t4, i2.u_saturation_factor), u_contrast_factor: new e.aI(t4, i2.u_contrast_factor), u_spin_weights: new e.aN(t4, i2.u_spin_weights) }), symbolIcon: (t4, i2) => ({ u_is_size_zoom_constant: new e.aH(t4, i2.u_is_size_zoom_constant), u_is_size_feature_constant: new e.aH(t4, i2.u_is_size_feature_constant), u_size_t: new e.aI(t4, i2.u_size_t), u_size: new e.aI(t4, i2.u_size), u_camera_to_center_distance: new e.aI(t4, i2.u_camera_to_center_distance), u_pitch: new e.aI(t4, i2.u_pitch), u_rotate_symbol: new e.aH(t4, i2.u_rotate_symbol), u_aspect_ratio: new e.aI(t4, i2.u_aspect_ratio), u_fade_change: new e.aI(t4, i2.u_fade_change), u_matrix: new e.aJ(t4, i2.u_matrix), u_label_plane_matrix: new e.aJ(t4, i2.u_label_plane_matrix), u_coord_matrix: new e.aJ(t4, i2.u_coord_matrix), u_is_text: new e.aH(t4, i2.u_is_text), u_pitch_with_map: new e.aH(t4, i2.u_pitch_with_map), u_is_along_line: new e.aH(t4, i2.u_is_along_line), u_is_variable_anchor: new e.aH(t4, i2.u_is_variable_anchor), u_texsize: new e.aO(t4, i2.u_texsize), u_texture: new e.aH(t4, i2.u_texture), u_translation: new e.aO(t4, i2.u_translation), u_pitched_scale: new e.aI(t4, i2.u_pitched_scale) }), symbolSDF: (t4, i2) => ({ u_is_size_zoom_constant: new e.aH(t4, i2.u_is_size_zoom_constant), u_is_size_feature_constant: new e.aH(t4, i2.u_is_size_feature_constant), u_size_t: new e.aI(t4, i2.u_size_t), u_size: new e.aI(t4, i2.u_size), u_camera_to_center_distance: new e.aI(t4, i2.u_camera_to_center_distance), u_pitch: new e.aI(t4, i2.u_pitch), u_rotate_symbol: new e.aH(t4, i2.u_rotate_symbol), u_aspect_ratio: new e.aI(t4, i2.u_aspect_ratio), u_fade_change: new e.aI(t4, i2.u_fade_change), u_matrix: new e.aJ(t4, i2.u_matrix), u_label_plane_matrix: new e.aJ(t4, i2.u_label_plane_matrix), u_coord_matrix: new e.aJ(t4, i2.u_coord_matrix), u_is_text: new e.aH(t4, i2.u_is_text), u_pitch_with_map: new e.aH(t4, i2.u_pitch_with_map), u_is_along_line: new e.aH(t4, i2.u_is_along_line), u_is_variable_anchor: new e.aH(t4, i2.u_is_variable_anchor), u_texsize: new e.aO(t4, i2.u_texsize), u_texture: new e.aH(t4, i2.u_texture), u_gamma_scale: new e.aI(t4, i2.u_gamma_scale), u_device_pixel_ratio: new e.aI(t4, i2.u_device_pixel_ratio), u_is_halo: new e.aH(t4, i2.u_is_halo), u_translation: new e.aO(t4, i2.u_translation), u_pitched_scale: new e.aI(t4, i2.u_pitched_scale) }), symbolTextAndIcon: (t4, i2) => ({ u_is_size_zoom_constant: new e.aH(t4, i2.u_is_size_zoom_constant), u_is_size_feature_constant: new e.aH(t4, i2.u_is_size_feature_constant), u_size_t: new e.aI(t4, i2.u_size_t), u_size: new e.aI(t4, i2.u_size), u_camera_to_center_distance: new e.aI(t4, i2.u_camera_to_center_distance), u_pitch: new e.aI(t4, i2.u_pitch), u_rotate_symbol: new e.aH(t4, i2.u_rotate_symbol), u_aspect_ratio: new e.aI(t4, i2.u_aspect_ratio), u_fade_change: new e.aI(t4, i2.u_fade_change), u_matrix: new e.aJ(t4, i2.u_matrix), u_label_plane_matrix: new e.aJ(t4, i2.u_label_plane_matrix), u_coord_matrix: new e.aJ(t4, i2.u_coord_matrix), u_is_text: new e.aH(t4, i2.u_is_text), u_pitch_with_map: new e.aH(t4, i2.u_pitch_with_map), u_is_along_line: new e.aH(t4, i2.u_is_along_line), u_is_variable_anchor: new e.aH(t4, i2.u_is_variable_anchor), u_texsize: new e.aO(t4, i2.u_texsize), u_texsize_icon: new e.aO(t4, i2.u_texsize_icon), u_texture: new e.aH(t4, i2.u_texture), u_texture_icon: new e.aH(t4, i2.u_texture_icon), u_gamma_scale: new e.aI(t4, i2.u_gamma_scale), u_device_pixel_ratio: new e.aI(t4, i2.u_device_pixel_ratio), u_is_halo: new e.aH(t4, i2.u_is_halo), u_translation: new e.aO(t4, i2.u_translation), u_pitched_scale: new e.aI(t4, i2.u_pitched_scale) }), background: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_opacity: new e.aI(t4, i2.u_opacity), u_color: new e.aL(t4, i2.u_color) }), backgroundPattern: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_opacity: new e.aI(t4, i2.u_opacity), u_image: new e.aH(t4, i2.u_image), u_pattern_tl_a: new e.aO(t4, i2.u_pattern_tl_a), u_pattern_br_a: new e.aO(t4, i2.u_pattern_br_a), u_pattern_tl_b: new e.aO(t4, i2.u_pattern_tl_b), u_pattern_br_b: new e.aO(t4, i2.u_pattern_br_b), u_texsize: new e.aO(t4, i2.u_texsize), u_mix: new e.aI(t4, i2.u_mix), u_pattern_size_a: new e.aO(t4, i2.u_pattern_size_a), u_pattern_size_b: new e.aO(t4, i2.u_pattern_size_b), u_scale_a: new e.aI(t4, i2.u_scale_a), u_scale_b: new e.aI(t4, i2.u_scale_b), u_pixel_coord_upper: new e.aO(t4, i2.u_pixel_coord_upper), u_pixel_coord_lower: new e.aO(t4, i2.u_pixel_coord_lower), u_tile_units_to_pixels: new e.aI(t4, i2.u_tile_units_to_pixels) }), terrain: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_texture: new e.aH(t4, i2.u_texture), u_ele_delta: new e.aI(t4, i2.u_ele_delta), u_fog_matrix: new e.aJ(t4, i2.u_fog_matrix), u_fog_color: new e.aL(t4, i2.u_fog_color), u_fog_ground_blend: new e.aI(t4, i2.u_fog_ground_blend), u_fog_ground_blend_opacity: new e.aI(t4, i2.u_fog_ground_blend_opacity), u_horizon_color: new e.aL(t4, i2.u_horizon_color), u_horizon_fog_blend: new e.aI(t4, i2.u_horizon_fog_blend) }), terrainDepth: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_ele_delta: new e.aI(t4, i2.u_ele_delta) }), terrainCoords: (t4, i2) => ({ u_matrix: new e.aJ(t4, i2.u_matrix), u_texture: new e.aH(t4, i2.u_texture), u_terrain_coords_id: new e.aI(t4, i2.u_terrain_coords_id), u_ele_delta: new e.aI(t4, i2.u_ele_delta) }), sky: (t4, i2) => ({ u_sky_color: new e.aL(t4, i2.u_sky_color), u_horizon_color: new e.aL(t4, i2.u_horizon_color), u_horizon: new e.aI(t4, i2.u_horizon), u_sky_horizon_blend: new e.aI(t4, i2.u_sky_horizon_blend) }) };\n class $e {\n constructor(t4, e2, i2) {\n this.context = t4;\n const a2 = t4.gl;\n this.buffer = a2.createBuffer(), this.dynamicDraw = Boolean(i2), this.context.unbindVAO(), t4.bindElementBuffer.set(this.buffer), a2.bufferData(a2.ELEMENT_ARRAY_BUFFER, e2.arrayBuffer, this.dynamicDraw ? a2.DYNAMIC_DRAW : a2.STATIC_DRAW), this.dynamicDraw || delete e2.arrayBuffer;\n }\n bind() {\n this.context.bindElementBuffer.set(this.buffer);\n }\n updateData(t4) {\n const e2 = this.context.gl;\n if (!this.dynamicDraw) throw new Error(\"Attempted to update data while not in dynamic mode.\");\n this.context.unbindVAO(), this.bind(), e2.bufferSubData(e2.ELEMENT_ARRAY_BUFFER, 0, t4.arrayBuffer);\n }\n destroy() {\n this.buffer && (this.context.gl.deleteBuffer(this.buffer), delete this.buffer);\n }\n }\n const Xe = { Int8: \"BYTE\", Uint8: \"UNSIGNED_BYTE\", Int16: \"SHORT\", Uint16: \"UNSIGNED_SHORT\", Int32: \"INT\", Uint32: \"UNSIGNED_INT\", Float32: \"FLOAT\" };\n class Ke {\n constructor(t4, e2, i2, a2) {\n this.length = e2.length, this.attributes = i2, this.itemSize = e2.bytesPerElement, this.dynamicDraw = a2, this.context = t4;\n const s2 = t4.gl;\n this.buffer = s2.createBuffer(), t4.bindVertexBuffer.set(this.buffer), s2.bufferData(s2.ARRAY_BUFFER, e2.arrayBuffer, this.dynamicDraw ? s2.DYNAMIC_DRAW : s2.STATIC_DRAW), this.dynamicDraw || delete e2.arrayBuffer;\n }\n bind() {\n this.context.bindVertexBuffer.set(this.buffer);\n }\n updateData(t4) {\n if (t4.length !== this.length) throw new Error(`Length of new data is ${t4.length}, which doesn't match current length of ${this.length}`);\n const e2 = this.context.gl;\n this.bind(), e2.bufferSubData(e2.ARRAY_BUFFER, 0, t4.arrayBuffer);\n }\n enableAttributes(t4, e2) {\n for (let i2 = 0; i2 < this.attributes.length; i2++) {\n const a2 = e2.attributes[this.attributes[i2].name];\n void 0 !== a2 && t4.enableVertexAttribArray(a2);\n }\n }\n setVertexAttribPointers(t4, e2, i2) {\n for (let a2 = 0; a2 < this.attributes.length; a2++) {\n const s2 = this.attributes[a2], o2 = e2.attributes[s2.name];\n void 0 !== o2 && t4.vertexAttribPointer(o2, s2.components, t4[Xe[s2.type]], false, this.itemSize, s2.offset + this.itemSize * (i2 || 0));\n }\n }\n destroy() {\n this.buffer && (this.context.gl.deleteBuffer(this.buffer), delete this.buffer);\n }\n }\n const Je = /* @__PURE__ */ new WeakMap();\n function Ye(t4) {\n var e2;\n if (Je.has(t4)) return Je.get(t4);\n {\n const i2 = null === (e2 = t4.getParameter(t4.VERSION)) || void 0 === e2 ? void 0 : e2.startsWith(\"WebGL 2.0\");\n return Je.set(t4, i2), i2;\n }\n }\n class Qe {\n constructor(t4) {\n this.gl = t4.gl, this.default = this.getDefault(), this.current = this.default, this.dirty = false;\n }\n get() {\n return this.current;\n }\n set(t4) {\n }\n getDefault() {\n return this.default;\n }\n setDefault() {\n this.set(this.default);\n }\n }\n class ti extends Qe {\n getDefault() {\n return e.aM.transparent;\n }\n set(t4) {\n const e2 = this.current;\n (t4.r !== e2.r || t4.g !== e2.g || t4.b !== e2.b || t4.a !== e2.a || this.dirty) && (this.gl.clearColor(t4.r, t4.g, t4.b, t4.a), this.current = t4, this.dirty = false);\n }\n }\n class ei extends Qe {\n getDefault() {\n return 1;\n }\n set(t4) {\n (t4 !== this.current || this.dirty) && (this.gl.clearDepth(t4), this.current = t4, this.dirty = false);\n }\n }\n class ii extends Qe {\n getDefault() {\n return 0;\n }\n set(t4) {\n (t4 !== this.current || this.dirty) && (this.gl.clearStencil(t4), this.current = t4, this.dirty = false);\n }\n }\n class ai extends Qe {\n getDefault() {\n return [true, true, true, true];\n }\n set(t4) {\n const e2 = this.current;\n (t4[0] !== e2[0] || t4[1] !== e2[1] || t4[2] !== e2[2] || t4[3] !== e2[3] || this.dirty) && (this.gl.colorMask(t4[0], t4[1], t4[2], t4[3]), this.current = t4, this.dirty = false);\n }\n }\n class si extends Qe {\n getDefault() {\n return true;\n }\n set(t4) {\n (t4 !== this.current || this.dirty) && (this.gl.depthMask(t4), this.current = t4, this.dirty = false);\n }\n }\n class oi extends Qe {\n getDefault() {\n return 255;\n }\n set(t4) {\n (t4 !== this.current || this.dirty) && (this.gl.stencilMask(t4), this.current = t4, this.dirty = false);\n }\n }\n class ri extends Qe {\n getDefault() {\n return { func: this.gl.ALWAYS, ref: 0, mask: 255 };\n }\n set(t4) {\n const e2 = this.current;\n (t4.func !== e2.func || t4.ref !== e2.ref || t4.mask !== e2.mask || this.dirty) && (this.gl.stencilFunc(t4.func, t4.ref, t4.mask), this.current = t4, this.dirty = false);\n }\n }\n class ni extends Qe {\n getDefault() {\n const t4 = this.gl;\n return [t4.KEEP, t4.KEEP, t4.KEEP];\n }\n set(t4) {\n const e2 = this.current;\n (t4[0] !== e2[0] || t4[1] !== e2[1] || t4[2] !== e2[2] || this.dirty) && (this.gl.stencilOp(t4[0], t4[1], t4[2]), this.current = t4, this.dirty = false);\n }\n }\n class li extends Qe {\n getDefault() {\n return false;\n }\n set(t4) {\n if (t4 === this.current && !this.dirty) return;\n const e2 = this.gl;\n t4 ? e2.enable(e2.STENCIL_TEST) : e2.disable(e2.STENCIL_TEST), this.current = t4, this.dirty = false;\n }\n }\n class hi extends Qe {\n getDefault() {\n return [0, 1];\n }\n set(t4) {\n const e2 = this.current;\n (t4[0] !== e2[0] || t4[1] !== e2[1] || this.dirty) && (this.gl.depthRange(t4[0], t4[1]), this.current = t4, this.dirty = false);\n }\n }\n class ci extends Qe {\n getDefault() {\n return false;\n }\n set(t4) {\n if (t4 === this.current && !this.dirty) return;\n const e2 = this.gl;\n t4 ? e2.enable(e2.DEPTH_TEST) : e2.disable(e2.DEPTH_TEST), this.current = t4, this.dirty = false;\n }\n }\n class ui extends Qe {\n getDefault() {\n return this.gl.LESS;\n }\n set(t4) {\n (t4 !== this.current || this.dirty) && (this.gl.depthFunc(t4), this.current = t4, this.dirty = false);\n }\n }\n class di extends Qe {\n getDefault() {\n return false;\n }\n set(t4) {\n if (t4 === this.current && !this.dirty) return;\n const e2 = this.gl;\n t4 ? e2.enable(e2.BLEND) : e2.disable(e2.BLEND), this.current = t4, this.dirty = false;\n }\n }\n class _i extends Qe {\n getDefault() {\n const t4 = this.gl;\n return [t4.ONE, t4.ZERO];\n }\n set(t4) {\n const e2 = this.current;\n (t4[0] !== e2[0] || t4[1] !== e2[1] || this.dirty) && (this.gl.blendFunc(t4[0], t4[1]), this.current = t4, this.dirty = false);\n }\n }\n class pi extends Qe {\n getDefault() {\n return e.aM.transparent;\n }\n set(t4) {\n const e2 = this.current;\n (t4.r !== e2.r || t4.g !== e2.g || t4.b !== e2.b || t4.a !== e2.a || this.dirty) && (this.gl.blendColor(t4.r, t4.g, t4.b, t4.a), this.current = t4, this.dirty = false);\n }\n }\n class mi extends Qe {\n getDefault() {\n return this.gl.FUNC_ADD;\n }\n set(t4) {\n (t4 !== this.current || this.dirty) && (this.gl.blendEquation(t4), this.current = t4, this.dirty = false);\n }\n }\n class fi extends Qe {\n getDefault() {\n return false;\n }\n set(t4) {\n if (t4 === this.current && !this.dirty) return;\n const e2 = this.gl;\n t4 ? e2.enable(e2.CULL_FACE) : e2.disable(e2.CULL_FACE), this.current = t4, this.dirty = false;\n }\n }\n class gi extends Qe {\n getDefault() {\n return this.gl.BACK;\n }\n set(t4) {\n (t4 !== this.current || this.dirty) && (this.gl.cullFace(t4), this.current = t4, this.dirty = false);\n }\n }\n class vi extends Qe {\n getDefault() {\n return this.gl.CCW;\n }\n set(t4) {\n (t4 !== this.current || this.dirty) && (this.gl.frontFace(t4), this.current = t4, this.dirty = false);\n }\n }\n class xi extends Qe {\n getDefault() {\n return null;\n }\n set(t4) {\n (t4 !== this.current || this.dirty) && (this.gl.useProgram(t4), this.current = t4, this.dirty = false);\n }\n }\n class yi extends Qe {\n getDefault() {\n return this.gl.TEXTURE0;\n }\n set(t4) {\n (t4 !== this.current || this.dirty) && (this.gl.activeTexture(t4), this.current = t4, this.dirty = false);\n }\n }\n class bi extends Qe {\n getDefault() {\n const t4 = this.gl;\n return [0, 0, t4.drawingBufferWidth, t4.drawingBufferHeight];\n }\n set(t4) {\n const e2 = this.current;\n (t4[0] !== e2[0] || t4[1] !== e2[1] || t4[2] !== e2[2] || t4[3] !== e2[3] || this.dirty) && (this.gl.viewport(t4[0], t4[1], t4[2], t4[3]), this.current = t4, this.dirty = false);\n }\n }\n class wi extends Qe {\n getDefault() {\n return null;\n }\n set(t4) {\n if (t4 === this.current && !this.dirty) return;\n const e2 = this.gl;\n e2.bindFramebuffer(e2.FRAMEBUFFER, t4), this.current = t4, this.dirty = false;\n }\n }\n class Ti extends Qe {\n getDefault() {\n return null;\n }\n set(t4) {\n if (t4 === this.current && !this.dirty) return;\n const e2 = this.gl;\n e2.bindRenderbuffer(e2.RENDERBUFFER, t4), this.current = t4, this.dirty = false;\n }\n }\n class Ii extends Qe {\n getDefault() {\n return null;\n }\n set(t4) {\n if (t4 === this.current && !this.dirty) return;\n const e2 = this.gl;\n e2.bindTexture(e2.TEXTURE_2D, t4), this.current = t4, this.dirty = false;\n }\n }\n class Ei extends Qe {\n getDefault() {\n return null;\n }\n set(t4) {\n if (t4 === this.current && !this.dirty) return;\n const e2 = this.gl;\n e2.bindBuffer(e2.ARRAY_BUFFER, t4), this.current = t4, this.dirty = false;\n }\n }\n class Pi extends Qe {\n getDefault() {\n return null;\n }\n set(t4) {\n const e2 = this.gl;\n e2.bindBuffer(e2.ELEMENT_ARRAY_BUFFER, t4), this.current = t4, this.dirty = false;\n }\n }\n class Ci extends Qe {\n getDefault() {\n return null;\n }\n set(t4) {\n var e2;\n if (t4 === this.current && !this.dirty) return;\n const i2 = this.gl;\n Ye(i2) ? i2.bindVertexArray(t4) : null === (e2 = i2.getExtension(\"OES_vertex_array_object\")) || void 0 === e2 || e2.bindVertexArrayOES(t4), this.current = t4, this.dirty = false;\n }\n }\n class Si extends Qe {\n getDefault() {\n return 4;\n }\n set(t4) {\n if (t4 === this.current && !this.dirty) return;\n const e2 = this.gl;\n e2.pixelStorei(e2.UNPACK_ALIGNMENT, t4), this.current = t4, this.dirty = false;\n }\n }\n class zi extends Qe {\n getDefault() {\n return false;\n }\n set(t4) {\n if (t4 === this.current && !this.dirty) return;\n const e2 = this.gl;\n e2.pixelStorei(e2.UNPACK_PREMULTIPLY_ALPHA_WEBGL, t4), this.current = t4, this.dirty = false;\n }\n }\n class Di extends Qe {\n getDefault() {\n return false;\n }\n set(t4) {\n if (t4 === this.current && !this.dirty) return;\n const e2 = this.gl;\n e2.pixelStorei(e2.UNPACK_FLIP_Y_WEBGL, t4), this.current = t4, this.dirty = false;\n }\n }\n class Mi extends Qe {\n constructor(t4, e2) {\n super(t4), this.context = t4, this.parent = e2;\n }\n getDefault() {\n return null;\n }\n }\n class Ai extends Mi {\n setDirty() {\n this.dirty = true;\n }\n set(t4) {\n if (t4 === this.current && !this.dirty) return;\n this.context.bindFramebuffer.set(this.parent);\n const e2 = this.gl;\n e2.framebufferTexture2D(e2.FRAMEBUFFER, e2.COLOR_ATTACHMENT0, e2.TEXTURE_2D, t4, 0), this.current = t4, this.dirty = false;\n }\n }\n class Ri extends Mi {\n set(t4) {\n if (t4 === this.current && !this.dirty) return;\n this.context.bindFramebuffer.set(this.parent);\n const e2 = this.gl;\n e2.framebufferRenderbuffer(e2.FRAMEBUFFER, e2.DEPTH_ATTACHMENT, e2.RENDERBUFFER, t4), this.current = t4, this.dirty = false;\n }\n }\n class ki extends Mi {\n set(t4) {\n if (t4 === this.current && !this.dirty) return;\n this.context.bindFramebuffer.set(this.parent);\n const e2 = this.gl;\n e2.framebufferRenderbuffer(e2.FRAMEBUFFER, e2.DEPTH_STENCIL_ATTACHMENT, e2.RENDERBUFFER, t4), this.current = t4, this.dirty = false;\n }\n }\n class Li {\n constructor(t4, e2, i2, a2, s2) {\n this.context = t4, this.width = e2, this.height = i2;\n const o2 = t4.gl, r2 = this.framebuffer = o2.createFramebuffer();\n if (this.colorAttachment = new Ai(t4, r2), a2) this.depthAttachment = s2 ? new ki(t4, r2) : new Ri(t4, r2);\n else if (s2) throw new Error(\"Stencil cannot be set without depth\");\n if (o2.checkFramebufferStatus(o2.FRAMEBUFFER) !== o2.FRAMEBUFFER_COMPLETE) throw new Error(\"Framebuffer is not complete\");\n }\n destroy() {\n const t4 = this.context.gl, e2 = this.colorAttachment.get();\n if (e2 && t4.deleteTexture(e2), this.depthAttachment) {\n const e3 = this.depthAttachment.get();\n e3 && t4.deleteRenderbuffer(e3);\n }\n t4.deleteFramebuffer(this.framebuffer);\n }\n }\n class Fi {\n constructor(t4, e2, i2) {\n this.blendFunction = t4, this.blendColor = e2, this.mask = i2;\n }\n }\n Fi.Replace = [1, 0], Fi.disabled = new Fi(Fi.Replace, e.aM.transparent, [false, false, false, false]), Fi.unblended = new Fi(Fi.Replace, e.aM.transparent, [true, true, true, true]), Fi.alphaBlended = new Fi([1, 771], e.aM.transparent, [true, true, true, true]);\n class Bi {\n constructor(t4) {\n var e2, i2;\n if (this.gl = t4, this.clearColor = new ti(this), this.clearDepth = new ei(this), this.clearStencil = new ii(this), this.colorMask = new ai(this), this.depthMask = new si(this), this.stencilMask = new oi(this), this.stencilFunc = new ri(this), this.stencilOp = new ni(this), this.stencilTest = new li(this), this.depthRange = new hi(this), this.depthTest = new ci(this), this.depthFunc = new ui(this), this.blend = new di(this), this.blendFunc = new _i(this), this.blendColor = new pi(this), this.blendEquation = new mi(this), this.cullFace = new fi(this), this.cullFaceSide = new gi(this), this.frontFace = new vi(this), this.program = new xi(this), this.activeTexture = new yi(this), this.viewport = new bi(this), this.bindFramebuffer = new wi(this), this.bindRenderbuffer = new Ti(this), this.bindTexture = new Ii(this), this.bindVertexBuffer = new Ei(this), this.bindElementBuffer = new Pi(this), this.bindVertexArray = new Ci(this), this.pixelStoreUnpack = new Si(this), this.pixelStoreUnpackPremultiplyAlpha = new zi(this), this.pixelStoreUnpackFlipY = new Di(this), this.extTextureFilterAnisotropic = t4.getExtension(\"EXT_texture_filter_anisotropic\") || t4.getExtension(\"MOZ_EXT_texture_filter_anisotropic\") || t4.getExtension(\"WEBKIT_EXT_texture_filter_anisotropic\"), this.extTextureFilterAnisotropic && (this.extTextureFilterAnisotropicMax = t4.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)), this.maxTextureSize = t4.getParameter(t4.MAX_TEXTURE_SIZE), Ye(t4)) {\n this.HALF_FLOAT = t4.HALF_FLOAT;\n const a2 = t4.getExtension(\"EXT_color_buffer_half_float\");\n this.RGBA16F = null !== (e2 = t4.RGBA16F) && void 0 !== e2 ? e2 : null == a2 ? void 0 : a2.RGBA16F_EXT, this.RGB16F = null !== (i2 = t4.RGB16F) && void 0 !== i2 ? i2 : null == a2 ? void 0 : a2.RGB16F_EXT, t4.getExtension(\"EXT_color_buffer_float\");\n } else {\n t4.getExtension(\"EXT_color_buffer_half_float\"), t4.getExtension(\"OES_texture_half_float_linear\");\n const e3 = t4.getExtension(\"OES_texture_half_float\");\n this.HALF_FLOAT = null == e3 ? void 0 : e3.HALF_FLOAT_OES;\n }\n }\n setDefault() {\n this.unbindVAO(), this.clearColor.setDefault(), this.clearDepth.setDefault(), this.clearStencil.setDefault(), this.colorMask.setDefault(), this.depthMask.setDefault(), this.stencilMask.setDefault(), this.stencilFunc.setDefault(), this.stencilOp.setDefault(), this.stencilTest.setDefault(), this.depthRange.setDefault(), this.depthTest.setDefault(), this.depthFunc.setDefault(), this.blend.setDefault(), this.blendFunc.setDefault(), this.blendColor.setDefault(), this.blendEquation.setDefault(), this.cullFace.setDefault(), this.cullFaceSide.setDefault(), this.frontFace.setDefault(), this.program.setDefault(), this.activeTexture.setDefault(), this.bindFramebuffer.setDefault(), this.pixelStoreUnpack.setDefault(), this.pixelStoreUnpackPremultiplyAlpha.setDefault(), this.pixelStoreUnpackFlipY.setDefault();\n }\n setDirty() {\n this.clearColor.dirty = true, this.clearDepth.dirty = true, this.clearStencil.dirty = true, this.colorMask.dirty = true, this.depthMask.dirty = true, this.stencilMask.dirty = true, this.stencilFunc.dirty = true, this.stencilOp.dirty = true, this.stencilTest.dirty = true, this.depthRange.dirty = true, this.depthTest.dirty = true, this.depthFunc.dirty = true, this.blend.dirty = true, this.blendFunc.dirty = true, this.blendColor.dirty = true, this.blendEquation.dirty = true, this.cullFace.dirty = true, this.cullFaceSide.dirty = true, this.frontFace.dirty = true, this.program.dirty = true, this.activeTexture.dirty = true, this.viewport.dirty = true, this.bindFramebuffer.dirty = true, this.bindRenderbuffer.dirty = true, this.bindTexture.dirty = true, this.bindVertexBuffer.dirty = true, this.bindElementBuffer.dirty = true, this.bindVertexArray.dirty = true, this.pixelStoreUnpack.dirty = true, this.pixelStoreUnpackPremultiplyAlpha.dirty = true, this.pixelStoreUnpackFlipY.dirty = true;\n }\n createIndexBuffer(t4, e2) {\n return new $e(this, t4, e2);\n }\n createVertexBuffer(t4, e2, i2) {\n return new Ke(this, t4, e2, i2);\n }\n createRenderbuffer(t4, e2, i2) {\n const a2 = this.gl, s2 = a2.createRenderbuffer();\n return this.bindRenderbuffer.set(s2), a2.renderbufferStorage(a2.RENDERBUFFER, t4, e2, i2), this.bindRenderbuffer.set(null), s2;\n }\n createFramebuffer(t4, e2, i2, a2) {\n return new Li(this, t4, e2, i2, a2);\n }\n clear({ color: t4, depth: e2, stencil: i2 }) {\n const a2 = this.gl;\n let s2 = 0;\n t4 && (s2 |= a2.COLOR_BUFFER_BIT, this.clearColor.set(t4), this.colorMask.set([true, true, true, true])), void 0 !== e2 && (s2 |= a2.DEPTH_BUFFER_BIT, this.depthRange.set([0, 1]), this.clearDepth.set(e2), this.depthMask.set(true)), void 0 !== i2 && (s2 |= a2.STENCIL_BUFFER_BIT, this.clearStencil.set(i2), this.stencilMask.set(255)), a2.clear(s2);\n }\n setCullFace(t4) {\n false === t4.enable ? this.cullFace.set(false) : (this.cullFace.set(true), this.cullFaceSide.set(t4.mode), this.frontFace.set(t4.frontFace));\n }\n setDepthMode(t4) {\n t4.func !== this.gl.ALWAYS || t4.mask ? (this.depthTest.set(true), this.depthFunc.set(t4.func), this.depthMask.set(t4.mask), this.depthRange.set(t4.range)) : this.depthTest.set(false);\n }\n setStencilMode(t4) {\n t4.test.func !== this.gl.ALWAYS || t4.mask ? (this.stencilTest.set(true), this.stencilMask.set(t4.mask), this.stencilOp.set([t4.fail, t4.depthFail, t4.pass]), this.stencilFunc.set({ func: t4.test.func, ref: t4.ref, mask: t4.test.mask })) : this.stencilTest.set(false);\n }\n setColorMode(t4) {\n e.aE(t4.blendFunction, Fi.Replace) ? this.blend.set(false) : (this.blend.set(true), this.blendFunc.set(t4.blendFunction), this.blendColor.set(t4.blendColor)), this.colorMask.set(t4.mask);\n }\n createVertexArray() {\n var t4;\n return Ye(this.gl) ? this.gl.createVertexArray() : null === (t4 = this.gl.getExtension(\"OES_vertex_array_object\")) || void 0 === t4 ? void 0 : t4.createVertexArrayOES();\n }\n deleteVertexArray(t4) {\n var e2;\n return Ye(this.gl) ? this.gl.deleteVertexArray(t4) : null === (e2 = this.gl.getExtension(\"OES_vertex_array_object\")) || void 0 === e2 ? void 0 : e2.deleteVertexArrayOES(t4);\n }\n unbindVAO() {\n this.bindVertexArray.set(null);\n }\n }\n class Oi {\n constructor(t4, e2, i2) {\n this.func = t4, this.mask = e2, this.range = i2;\n }\n }\n Oi.ReadOnly = false, Oi.ReadWrite = true, Oi.disabled = new Oi(519, Oi.ReadOnly, [0, 1]);\n const Ni = 7680;\n class Ui {\n constructor(t4, e2, i2, a2, s2, o2) {\n this.test = t4, this.ref = e2, this.mask = i2, this.fail = a2, this.depthFail = s2, this.pass = o2;\n }\n }\n Ui.disabled = new Ui({ func: 519, mask: 0 }, 0, 0, Ni, Ni, Ni);\n class ji {\n constructor(t4, e2, i2) {\n this.enable = t4, this.mode = e2, this.frontFace = i2;\n }\n }\n let Zi;\n function qi(t4, i2, a2, s2, o2) {\n const r2 = t4.context, n2 = r2.gl, l2 = t4.useProgram(\"collisionBox\"), h2 = [];\n let c2 = 0, u2 = 0;\n for (let _3 = 0; _3 < s2.length; _3++) {\n const p3 = s2[_3], m3 = i2.getTile(p3).getBucket(a2);\n if (!m3) continue;\n const f3 = o2 ? m3.textCollisionBox : m3.iconCollisionBox, g3 = m3.collisionCircleArray;\n if (g3.length > 0) {\n const i3 = e.H();\n e.aQ(i3, m3.placementInvProjMatrix, t4.transform.glCoordMatrix), e.aQ(i3, i3, m3.placementViewportMatrix), h2.push({ circleArray: g3, circleOffset: u2, transform: p3.posMatrix, invTransform: i3, coord: p3 }), c2 += g3.length / 4, u2 = c2;\n }\n f3 && l2.draw(r2, n2.LINES, Oi.disabled, Ui.disabled, t4.colorModeForRenderPass(), ji.disabled, { u_matrix: p3.posMatrix, u_pixel_extrude_scale: [1 / (d2 = t4.transform).width, 1 / d2.height] }, t4.style.map.terrain && t4.style.map.terrain.getTerrainData(p3), a2.id, f3.layoutVertexBuffer, f3.indexBuffer, f3.segments, null, t4.transform.zoom, null, null, f3.collisionVertexBuffer);\n }\n var d2;\n if (!o2 || !h2.length) return;\n const _2 = t4.useProgram(\"collisionCircle\"), p2 = new e.aR();\n p2.resize(4 * c2), p2._trim();\n let m2 = 0;\n for (const t5 of h2) for (let e2 = 0; e2 < t5.circleArray.length / 4; e2++) {\n const i3 = 4 * e2, a3 = t5.circleArray[i3 + 0], s3 = t5.circleArray[i3 + 1], o3 = t5.circleArray[i3 + 2], r3 = t5.circleArray[i3 + 3];\n p2.emplace(m2++, a3, s3, o3, r3, 0), p2.emplace(m2++, a3, s3, o3, r3, 1), p2.emplace(m2++, a3, s3, o3, r3, 2), p2.emplace(m2++, a3, s3, o3, r3, 3);\n }\n (!Zi || Zi.length < 2 * c2) && (Zi = function(t5) {\n const i3 = 2 * t5, a3 = new e.aT();\n a3.resize(i3), a3._trim();\n for (let t6 = 0; t6 < i3; t6++) {\n const e2 = 6 * t6;\n a3.uint16[e2 + 0] = 4 * t6 + 0, a3.uint16[e2 + 1] = 4 * t6 + 1, a3.uint16[e2 + 2] = 4 * t6 + 2, a3.uint16[e2 + 3] = 4 * t6 + 2, a3.uint16[e2 + 4] = 4 * t6 + 3, a3.uint16[e2 + 5] = 4 * t6 + 0;\n }\n return a3;\n }(c2));\n const f2 = r2.createIndexBuffer(Zi, true), g2 = r2.createVertexBuffer(p2, e.aS.members, true);\n for (const i3 of h2) {\n const s3 = Se(i3.transform, i3.invTransform, t4.transform);\n _2.draw(r2, n2.TRIANGLES, Oi.disabled, Ui.disabled, t4.colorModeForRenderPass(), ji.disabled, s3, t4.style.map.terrain && t4.style.map.terrain.getTerrainData(i3.coord), a2.id, g2, f2, e.a0.simpleSegment(0, 2 * i3.circleOffset, i3.circleArray.length, i3.circleArray.length / 2), null, t4.transform.zoom, null, null, null);\n }\n g2.destroy(), f2.destroy();\n }\n ji.disabled = new ji(false, 1029, 2305), ji.backCCW = new ji(true, 1029, 2305);\n const Vi = e.an(new Float32Array(16));\n function Gi(t4, i2, a2, s2, o2, r2) {\n const { horizontalAlign: n2, verticalAlign: l2 } = e.au(t4);\n return new e.P((-(n2 - 0.5) * i2 / o2 + s2[0]) * r2, (-(l2 - 0.5) * a2 / o2 + s2[1]) * r2);\n }\n function Hi(t4, i2, a2, s2, o2, r2) {\n const n2 = i2.tileAnchorPoint.add(new e.P(i2.translation[0], i2.translation[1]));\n if (i2.pitchWithMap) {\n let t5 = s2.mult(r2);\n a2 || (t5 = t5.rotate(-o2));\n const e2 = n2.add(t5);\n return xt(e2.x, e2.y, i2.labelPlaneMatrix, i2.getElevation).point;\n }\n if (a2) {\n const e2 = St(i2.tileAnchorPoint.x + 1, i2.tileAnchorPoint.y, i2).point.sub(t4), a3 = Math.atan(e2.y / e2.x) + (e2.x < 0 ? Math.PI : 0);\n return t4.add(s2.rotate(a3));\n }\n return t4.add(s2);\n }\n function Wi(t4, i2, a2, s2, o2, r2, n2, l2, h2, c2, u2, d2, _2, p2) {\n const m2 = t4.text.placedSymbolArray, f2 = t4.text.dynamicLayoutVertexArray, g2 = t4.icon.dynamicLayoutVertexArray, v2 = {};\n f2.clear();\n for (let g3 = 0; g3 < m2.length; g3++) {\n const x2 = m2.get(g3), y2 = x2.hidden || !x2.crossTileID || t4.allowVerticalPlacement && !x2.placedOrientation ? null : s2[x2.crossTileID];\n if (y2) {\n const s3 = new e.P(x2.anchorX, x2.anchorY), m3 = { getElevation: p2, width: o2.width, height: o2.height, labelPlaneMatrix: r2, lineVertexArray: null, pitchWithMap: a2, projection: u2, projectionCache: null, tileAnchorPoint: s3, translation: d2, unwrappedTileID: _2 }, g4 = a2 ? xt(s3.x, s3.y, n2, p2) : St(s3.x, s3.y, m3), b2 = yt(o2.cameraToCenterDistance, g4.signedDistanceFromCamera);\n let w2 = e.ai(t4.textSizeData, h2, x2) * b2 / e.ap;\n a2 && (w2 *= t4.tilePixelRatio / l2);\n const { width: T2, height: I2, anchor: E3, textOffset: P2, textBoxScale: C3 } = y2, S2 = Gi(E3, T2, I2, P2, C3, w2), z2 = u2.getPitchedTextCorrection(o2, s3.add(new e.P(d2[0], d2[1])), _2), D3 = Hi(g4.point, m3, i2, S2, o2.angle, z2), M2 = t4.allowVerticalPlacement && x2.placedOrientation === e.ah.vertical ? Math.PI / 2 : 0;\n for (let t5 = 0; t5 < x2.numGlyphs; t5++) e.aj(f2, D3, M2);\n c2 && x2.associatedIconIndex >= 0 && (v2[x2.associatedIconIndex] = { shiftedAnchor: D3, angle: M2 });\n } else Rt(x2.numGlyphs, f2);\n }\n if (c2) {\n g2.clear();\n const i3 = t4.icon.placedSymbolArray;\n for (let t5 = 0; t5 < i3.length; t5++) {\n const a3 = i3.get(t5);\n if (a3.hidden) Rt(a3.numGlyphs, g2);\n else {\n const i4 = v2[t5];\n if (i4) for (let t6 = 0; t6 < a3.numGlyphs; t6++) e.aj(g2, i4.shiftedAnchor, i4.angle);\n else Rt(a3.numGlyphs, g2);\n }\n }\n t4.icon.dynamicLayoutVertexBuffer.updateData(g2);\n }\n t4.text.dynamicLayoutVertexBuffer.updateData(f2);\n }\n function $i(t4, e2, i2) {\n return i2.iconsInText && e2 ? \"symbolTextAndIcon\" : t4 ? \"symbolSDF\" : \"symbolIcon\";\n }\n function Xi(t4, i2, a2, s2, o2, r2, n2, l2, h2, c2, u2, d2) {\n const _2 = t4.context, p2 = _2.gl, m2 = t4.transform, f2 = ie(), g2 = \"map\" === l2, v2 = \"map\" === h2, x2 = \"viewport\" !== l2 && \"point\" !== a2.layout.get(\"symbol-placement\"), y2 = g2 && !v2 && !x2, b2 = !v2 && x2, w2 = !a2.layout.get(\"symbol-sort-key\").isConstant();\n let T2 = false;\n const I2 = t4.depthModeForSublayer(0, Oi.ReadOnly), E3 = a2._unevaluatedLayout.hasValue(\"text-variable-anchor\") || a2._unevaluatedLayout.hasValue(\"text-variable-anchor-offset\"), P2 = [], C3 = f2.getCircleRadiusCorrection(m2);\n for (const l3 of s2) {\n const s3 = i2.getTile(l3), h3 = s3.getBucket(a2);\n if (!h3) continue;\n const u3 = o2 ? h3.text : h3.icon;\n if (!u3 || !u3.segments.get().length || !u3.hasVisibleVertices) continue;\n const d3 = u3.programConfigurations.get(a2.id), _3 = o2 || h3.sdfIcons, I3 = o2 ? h3.textSizeData : h3.iconSizeData, S2 = v2 || 0 !== m2.pitch, z2 = t4.useProgram($i(_3, o2, h3), d3), D3 = e.ag(I3, m2.zoom), M2 = t4.style.map.terrain && t4.style.map.terrain.getTerrainData(l3);\n let A3, R2, k2, L2, F2 = [0, 0], B3 = null;\n if (o2) R2 = s3.glyphAtlasTexture, k2 = p2.LINEAR, A3 = s3.glyphAtlasTexture.size, h3.iconsInText && (F2 = s3.imageAtlasTexture.size, B3 = s3.imageAtlasTexture, L2 = S2 || t4.options.rotating || t4.options.zooming || \"composite\" === I3.kind || \"camera\" === I3.kind ? p2.LINEAR : p2.NEAREST);\n else {\n const e2 = 1 !== a2.layout.get(\"icon-size\").constantOr(0) || h3.iconsNeedLinear;\n R2 = s3.imageAtlasTexture, k2 = _3 || t4.options.rotating || t4.options.zooming || e2 || S2 ? p2.LINEAR : p2.NEAREST, A3 = s3.imageAtlasTexture.size;\n }\n const O2 = Bt(s3, 1, t4.transform.zoom), N2 = b2 ? l3.posMatrix : Vi, U2 = gt(N2, v2, g2, t4.transform, O2), j2 = vt(N2, v2, g2, t4.transform, O2), Z2 = vt(l3.posMatrix, v2, g2, t4.transform, O2), q2 = f2.translatePosition(t4.transform, s3, r2, n2), V2 = E3 && h3.hasTextData(), G2 = \"none\" !== a2.layout.get(\"icon-text-fit\") && V2 && h3.hasIconData();\n if (x2) {\n const e2 = t4.style.map.terrain ? (e3, i4) => t4.style.map.terrain.getElevation(l3, e3, i4) : null, i3 = \"map\" === a2.layout.get(\"text-rotation-alignment\");\n wt(h3, l3.posMatrix, t4, o2, U2, Z2, v2, c2, i3, f2, l3.toUnwrapped(), m2.width, m2.height, q2, e2);\n }\n const H2 = l3.posMatrix, W2 = o2 && E3 || G2, $2 = x2 || W2 ? Vi : U2, X2 = j2, K3 = _3 && 0 !== a2.paint.get(o2 ? \"text-halo-width\" : \"icon-halo-width\").constantOr(1);\n let J2;\n J2 = _3 ? h3.iconsInText ? Ve(I3.kind, D3, y2, v2, x2, W2, t4, H2, $2, X2, q2, A3, F2, C3) : qe(I3.kind, D3, y2, v2, x2, W2, t4, H2, $2, X2, q2, o2, A3, true, C3) : Ze(I3.kind, D3, y2, v2, x2, W2, t4, H2, $2, X2, q2, o2, A3, C3);\n const Y2 = { program: z2, buffers: u3, uniformValues: J2, atlasTexture: R2, atlasTextureIcon: B3, atlasInterpolation: k2, atlasInterpolationIcon: L2, isSDF: _3, hasHalo: K3 };\n if (w2 && h3.canOverlap) {\n T2 = true;\n const t5 = u3.segments.get();\n for (const i3 of t5) P2.push({ segments: new e.a0([i3]), sortKey: i3.sortKey, state: Y2, terrainData: M2 });\n } else P2.push({ segments: u3.segments, sortKey: 0, state: Y2, terrainData: M2 });\n }\n T2 && P2.sort((t5, e2) => t5.sortKey - e2.sortKey);\n for (const e2 of P2) {\n const i3 = e2.state;\n if (_2.activeTexture.set(p2.TEXTURE0), i3.atlasTexture.bind(i3.atlasInterpolation, p2.CLAMP_TO_EDGE), i3.atlasTextureIcon && (_2.activeTexture.set(p2.TEXTURE1), i3.atlasTextureIcon && i3.atlasTextureIcon.bind(i3.atlasInterpolationIcon, p2.CLAMP_TO_EDGE)), i3.isSDF) {\n const s3 = i3.uniformValues;\n i3.hasHalo && (s3.u_is_halo = 1, Ki(i3.buffers, e2.segments, a2, t4, i3.program, I2, u2, d2, s3, e2.terrainData)), s3.u_is_halo = 0;\n }\n Ki(i3.buffers, e2.segments, a2, t4, i3.program, I2, u2, d2, i3.uniformValues, e2.terrainData);\n }\n }\n function Ki(t4, e2, i2, a2, s2, o2, r2, n2, l2, h2) {\n const c2 = a2.context;\n s2.draw(c2, c2.gl.TRIANGLES, o2, r2, n2, ji.disabled, l2, h2, i2.id, t4.layoutVertexBuffer, t4.indexBuffer, e2, i2.paint, a2.transform.zoom, t4.programConfigurations.get(i2.id), t4.dynamicLayoutVertexBuffer, t4.opacityVertexBuffer);\n }\n function Ji(t4, i2, a2, s2) {\n const o2 = t4.context, r2 = o2.gl, n2 = Ui.disabled, l2 = new Fi([r2.ONE, r2.ONE], e.aM.transparent, [true, true, true, true]), h2 = i2.getBucket(a2);\n if (!h2) return;\n const c2 = s2.key;\n let u2 = a2.heatmapFbos.get(c2);\n u2 || (u2 = Qi(o2, i2.tileSize, i2.tileSize), a2.heatmapFbos.set(c2, u2)), o2.bindFramebuffer.set(u2.framebuffer), o2.viewport.set([0, 0, i2.tileSize, i2.tileSize]), o2.clear({ color: e.aM.transparent });\n const d2 = h2.programConfigurations.get(a2.id), _2 = t4.useProgram(\"heatmap\", d2), p2 = t4.style.map.terrain.getTerrainData(s2);\n _2.draw(o2, r2.TRIANGLES, Oi.disabled, n2, l2, ji.disabled, Me(s2.posMatrix, i2, t4.transform.zoom, a2.paint.get(\"heatmap-intensity\")), p2, a2.id, h2.layoutVertexBuffer, h2.indexBuffer, h2.segments, a2.paint, t4.transform.zoom, d2);\n }\n function Yi(t4, e2, i2) {\n const a2 = t4.context, s2 = a2.gl;\n a2.setColorMode(t4.colorModeForRenderPass());\n const o2 = ta(a2, e2), r2 = i2.key, n2 = e2.heatmapFbos.get(r2);\n n2 && (a2.activeTexture.set(s2.TEXTURE0), s2.bindTexture(s2.TEXTURE_2D, n2.colorAttachment.get()), a2.activeTexture.set(s2.TEXTURE1), o2.bind(s2.LINEAR, s2.CLAMP_TO_EDGE), t4.useProgram(\"heatmapTexture\").draw(a2, s2.TRIANGLES, Oi.disabled, Ui.disabled, t4.colorModeForRenderPass(), ji.disabled, Ae(t4, e2, 0, 1), null, e2.id, t4.rasterBoundsBuffer, t4.quadTriangleIndexBuffer, t4.rasterBoundsSegments, e2.paint, t4.transform.zoom), n2.destroy(), e2.heatmapFbos.delete(r2));\n }\n function Qi(t4, e2, i2) {\n var a2, s2;\n const o2 = t4.gl, r2 = o2.createTexture();\n o2.bindTexture(o2.TEXTURE_2D, r2), o2.texParameteri(o2.TEXTURE_2D, o2.TEXTURE_WRAP_S, o2.CLAMP_TO_EDGE), o2.texParameteri(o2.TEXTURE_2D, o2.TEXTURE_WRAP_T, o2.CLAMP_TO_EDGE), o2.texParameteri(o2.TEXTURE_2D, o2.TEXTURE_MIN_FILTER, o2.LINEAR), o2.texParameteri(o2.TEXTURE_2D, o2.TEXTURE_MAG_FILTER, o2.LINEAR);\n const n2 = null !== (a2 = t4.HALF_FLOAT) && void 0 !== a2 ? a2 : o2.UNSIGNED_BYTE, l2 = null !== (s2 = t4.RGBA16F) && void 0 !== s2 ? s2 : o2.RGBA;\n o2.texImage2D(o2.TEXTURE_2D, 0, l2, e2, i2, 0, o2.RGBA, n2, null);\n const h2 = t4.createFramebuffer(e2, i2, false, false);\n return h2.colorAttachment.set(r2), h2;\n }\n function ta(t4, e2) {\n return e2.colorRampTexture || (e2.colorRampTexture = new b(t4, e2.colorRamp, t4.gl.RGBA)), e2.colorRampTexture;\n }\n function ea(t4, e2, i2, a2, s2) {\n if (!i2 || !a2 || !a2.imageAtlas) return;\n const o2 = a2.imageAtlas.patternPositions;\n let r2 = o2[i2.to.toString()], n2 = o2[i2.from.toString()];\n if (!r2 && n2 && (r2 = n2), !n2 && r2 && (n2 = r2), !r2 || !n2) {\n const t5 = s2.getPaintProperty(e2);\n r2 = o2[t5], n2 = o2[t5];\n }\n r2 && n2 && t4.setConstantPatternPositions(r2, n2);\n }\n function ia(t4, e2, i2, a2, s2, o2, r2) {\n const n2 = t4.context.gl, l2 = \"fill-pattern\", h2 = i2.paint.get(l2), c2 = h2 && h2.constantOr(1), u2 = i2.getCrossfadeParameters();\n let d2, _2, p2, m2, f2;\n r2 ? (_2 = c2 && !i2.getPaintProperty(\"fill-outline-color\") ? \"fillOutlinePattern\" : \"fillOutline\", d2 = n2.LINES) : (_2 = c2 ? \"fillPattern\" : \"fill\", d2 = n2.TRIANGLES);\n const g2 = h2.constantOr(null);\n for (const h3 of a2) {\n const a3 = e2.getTile(h3);\n if (c2 && !a3.patternsLoaded()) continue;\n const v2 = a3.getBucket(i2);\n if (!v2) continue;\n const x2 = v2.programConfigurations.get(i2.id), y2 = t4.useProgram(_2, x2), b2 = t4.style.map.terrain && t4.style.map.terrain.getTerrainData(h3);\n c2 && (t4.context.activeTexture.set(n2.TEXTURE0), a3.imageAtlasTexture.bind(n2.LINEAR, n2.CLAMP_TO_EDGE), x2.updatePaintBuffers(u2)), ea(x2, l2, g2, a3, i2);\n const w2 = b2 ? h3 : null, T2 = t4.translatePosMatrix(w2 ? w2.posMatrix : h3.posMatrix, a3, i2.paint.get(\"fill-translate\"), i2.paint.get(\"fill-translate-anchor\"));\n if (r2) {\n m2 = v2.indexBuffer2, f2 = v2.segments2;\n const e3 = [n2.drawingBufferWidth, n2.drawingBufferHeight];\n p2 = \"fillOutlinePattern\" === _2 && c2 ? Pe(T2, t4, u2, a3, e3) : Ee(T2, e3);\n } else m2 = v2.indexBuffer, f2 = v2.segments, p2 = c2 ? Ie(T2, t4, u2, a3) : Te(T2);\n y2.draw(t4.context, d2, s2, t4.stencilModeForClipping(h3), o2, ji.disabled, p2, b2, i2.id, v2.layoutVertexBuffer, m2, f2, i2.paint, t4.transform.zoom, x2);\n }\n }\n function aa(t4, e2, i2, a2, s2, o2, r2) {\n const n2 = t4.context, l2 = n2.gl, h2 = \"fill-extrusion-pattern\", c2 = i2.paint.get(h2), u2 = c2.constantOr(1), d2 = i2.getCrossfadeParameters(), _2 = i2.paint.get(\"fill-extrusion-opacity\"), p2 = c2.constantOr(null);\n for (const c3 of a2) {\n const a3 = e2.getTile(c3), m2 = a3.getBucket(i2);\n if (!m2) continue;\n const f2 = t4.style.map.terrain && t4.style.map.terrain.getTerrainData(c3), g2 = m2.programConfigurations.get(i2.id), v2 = t4.useProgram(u2 ? \"fillExtrusionPattern\" : \"fillExtrusion\", g2);\n u2 && (t4.context.activeTexture.set(l2.TEXTURE0), a3.imageAtlasTexture.bind(l2.LINEAR, l2.CLAMP_TO_EDGE), g2.updatePaintBuffers(d2)), ea(g2, h2, p2, a3, i2);\n const x2 = t4.translatePosMatrix(c3.posMatrix, a3, i2.paint.get(\"fill-extrusion-translate\"), i2.paint.get(\"fill-extrusion-translate-anchor\")), y2 = i2.paint.get(\"fill-extrusion-vertical-gradient\"), b2 = u2 ? we(x2, t4, y2, _2, c3, d2, a3) : be(x2, t4, y2, _2);\n v2.draw(n2, n2.gl.TRIANGLES, s2, o2, r2, ji.backCCW, b2, f2, i2.id, m2.layoutVertexBuffer, m2.indexBuffer, m2.segments, i2.paint, t4.transform.zoom, g2, t4.style.map.terrain && m2.centroidVertexBuffer);\n }\n }\n function sa(t4, e2, i2, a2, s2, o2, r2) {\n const n2 = t4.context, l2 = n2.gl, h2 = i2.fbo;\n if (!h2) return;\n const c2 = t4.useProgram(\"hillshade\"), u2 = t4.style.map.terrain && t4.style.map.terrain.getTerrainData(e2);\n n2.activeTexture.set(l2.TEXTURE0), l2.bindTexture(l2.TEXTURE_2D, h2.colorAttachment.get()), c2.draw(n2, l2.TRIANGLES, s2, o2, r2, ji.disabled, ((t5, e3, i3, a3) => {\n const s3 = i3.paint.get(\"hillshade-shadow-color\"), o3 = i3.paint.get(\"hillshade-highlight-color\"), r3 = i3.paint.get(\"hillshade-accent-color\");\n let n3 = i3.paint.get(\"hillshade-illumination-direction\") * (Math.PI / 180);\n \"viewport\" === i3.paint.get(\"hillshade-illumination-anchor\") && (n3 -= t5.transform.angle);\n const l3 = !t5.options.moving;\n return { u_matrix: a3 ? a3.posMatrix : t5.transform.calculatePosMatrix(e3.tileID.toUnwrapped(), l3), u_image: 0, u_latrange: Re(0, e3.tileID), u_light: [i3.paint.get(\"hillshade-exaggeration\"), n3], u_shadow: s3, u_highlight: o3, u_accent: r3 };\n })(t4, i2, a2, u2 ? e2 : null), u2, a2.id, t4.rasterBoundsBuffer, t4.quadTriangleIndexBuffer, t4.rasterBoundsSegments);\n }\n function oa(t4, i2, a2, s2, o2, r2) {\n const n2 = t4.context, l2 = n2.gl, h2 = i2.dem;\n if (h2 && h2.data) {\n const c2 = h2.dim, u2 = h2.stride, d2 = h2.getPixels();\n if (n2.activeTexture.set(l2.TEXTURE1), n2.pixelStoreUnpackPremultiplyAlpha.set(false), i2.demTexture = i2.demTexture || t4.getTileTexture(u2), i2.demTexture) {\n const t5 = i2.demTexture;\n t5.update(d2, { premultiply: false }), t5.bind(l2.NEAREST, l2.CLAMP_TO_EDGE);\n } else i2.demTexture = new b(n2, d2, l2.RGBA, { premultiply: false }), i2.demTexture.bind(l2.NEAREST, l2.CLAMP_TO_EDGE);\n n2.activeTexture.set(l2.TEXTURE0);\n let _2 = i2.fbo;\n if (!_2) {\n const t5 = new b(n2, { width: c2, height: c2, data: null }, l2.RGBA);\n t5.bind(l2.LINEAR, l2.CLAMP_TO_EDGE), _2 = i2.fbo = n2.createFramebuffer(c2, c2, true, false), _2.colorAttachment.set(t5.texture);\n }\n n2.bindFramebuffer.set(_2.framebuffer), n2.viewport.set([0, 0, c2, c2]), t4.useProgram(\"hillshadePrepare\").draw(n2, l2.TRIANGLES, s2, o2, r2, ji.disabled, ((t5, i3) => {\n const a3 = i3.stride, s3 = e.H();\n return e.aP(s3, 0, e.X, -e.X, 0, 0, 1), e.J(s3, s3, [0, -e.X, 0]), { u_matrix: s3, u_image: 1, u_dimension: [a3, a3], u_zoom: t5.overscaledZ, u_unpack: i3.getUnpackVector() };\n })(i2.tileID, h2), null, a2.id, t4.rasterBoundsBuffer, t4.quadTriangleIndexBuffer, t4.rasterBoundsSegments), i2.needsHillshadePrepare = false;\n }\n }\n function ra(t4, i2, a2, s2, r2, n2) {\n const l2 = s2.paint.get(\"raster-fade-duration\");\n if (!n2 && l2 > 0) {\n const s3 = o.now(), n3 = (s3 - t4.timeAdded) / l2, h2 = i2 ? (s3 - i2.timeAdded) / l2 : -1, c2 = a2.getSource(), u2 = r2.coveringZoomLevel({ tileSize: c2.tileSize, roundZoom: c2.roundZoom }), d2 = !i2 || Math.abs(i2.tileID.overscaledZ - u2) > Math.abs(t4.tileID.overscaledZ - u2), _2 = d2 && t4.refreshedUponExpiration ? 1 : e.ac(d2 ? n3 : 1 - h2, 0, 1);\n return t4.refreshedUponExpiration && n3 >= 1 && (t4.refreshedUponExpiration = false), i2 ? { opacity: 1, mix: 1 - _2 } : { opacity: _2, mix: 0 };\n }\n return { opacity: 1, mix: 0 };\n }\n const na = new e.aM(1, 0, 0, 1), la = new e.aM(0, 1, 0, 1), ha = new e.aM(0, 0, 1, 1), ca = new e.aM(1, 0, 1, 1), ua = new e.aM(0, 1, 1, 1);\n function da(t4, e2, i2, a2) {\n pa(t4, 0, e2 + i2 / 2, t4.transform.width, i2, a2);\n }\n function _a(t4, e2, i2, a2) {\n pa(t4, e2 - i2 / 2, 0, i2, t4.transform.height, a2);\n }\n function pa(t4, e2, i2, a2, s2, o2) {\n const r2 = t4.context, n2 = r2.gl;\n n2.enable(n2.SCISSOR_TEST), n2.scissor(e2 * t4.pixelRatio, i2 * t4.pixelRatio, a2 * t4.pixelRatio, s2 * t4.pixelRatio), r2.clear({ color: o2 }), n2.disable(n2.SCISSOR_TEST);\n }\n function ma(t4, i2, a2) {\n const s2 = t4.context, o2 = s2.gl, r2 = a2.posMatrix, n2 = t4.useProgram(\"debug\"), l2 = Oi.disabled, h2 = Ui.disabled, c2 = t4.colorModeForRenderPass(), u2 = \"$debug\", d2 = t4.style.map.terrain && t4.style.map.terrain.getTerrainData(a2);\n s2.activeTexture.set(o2.TEXTURE0);\n const _2 = i2.getTileByID(a2.key).latestRawTileData, p2 = Math.floor((_2 && _2.byteLength || 0) / 1024), m2 = i2.getTile(a2).tileSize, f2 = 512 / Math.min(m2, 512) * (a2.overscaledZ / t4.transform.zoom) * 0.5;\n let g2 = a2.canonical.toString();\n a2.overscaledZ !== a2.canonical.z && (g2 += ` => ${a2.overscaledZ}`), function(t5, e2) {\n t5.initDebugOverlayCanvas();\n const i3 = t5.debugOverlayCanvas, a3 = t5.context.gl, s3 = t5.debugOverlayCanvas.getContext(\"2d\");\n s3.clearRect(0, 0, i3.width, i3.height), s3.shadowColor = \"white\", s3.shadowBlur = 2, s3.lineWidth = 1.5, s3.strokeStyle = \"white\", s3.textBaseline = \"top\", s3.font = \"bold 36px Open Sans, sans-serif\", s3.fillText(e2, 5, 5), s3.strokeText(e2, 5, 5), t5.debugOverlayTexture.update(i3), t5.debugOverlayTexture.bind(a3.LINEAR, a3.CLAMP_TO_EDGE);\n }(t4, `${g2} ${p2}kB`), n2.draw(s2, o2.TRIANGLES, l2, h2, Fi.alphaBlended, ji.disabled, ze(r2, e.aM.transparent, f2), null, u2, t4.debugBuffer, t4.quadTriangleIndexBuffer, t4.debugSegments), n2.draw(s2, o2.LINE_STRIP, l2, h2, c2, ji.disabled, ze(r2, e.aM.red), d2, u2, t4.debugBuffer, t4.tileBorderIndexBuffer, t4.debugSegments);\n }\n function fa(t4, e2, i2) {\n const a2 = t4.context, s2 = a2.gl, o2 = t4.colorModeForRenderPass(), r2 = new Oi(s2.LEQUAL, Oi.ReadWrite, t4.depthRangeFor3D), n2 = t4.useProgram(\"terrain\"), l2 = e2.getTerrainMesh();\n a2.bindFramebuffer.set(null), a2.viewport.set([0, 0, t4.width, t4.height]);\n for (const h2 of i2) {\n const i3 = t4.renderToTexture.getTexture(h2), c2 = e2.getTerrainData(h2.tileID);\n a2.activeTexture.set(s2.TEXTURE0), s2.bindTexture(s2.TEXTURE_2D, i3.texture);\n const u2 = t4.transform.calculatePosMatrix(h2.tileID.toUnwrapped()), d2 = e2.getMeshFrameDelta(t4.transform.zoom), _2 = t4.transform.calculateFogMatrix(h2.tileID.toUnwrapped()), p2 = ge(u2, d2, _2, t4.style.sky, t4.transform.pitch);\n n2.draw(a2, s2.TRIANGLES, r2, Ui.disabled, o2, ji.backCCW, p2, c2, \"terrain\", l2.vertexBuffer, l2.indexBuffer, l2.segments);\n }\n }\n class ga {\n constructor(t4, e2, i2) {\n this.vertexBuffer = t4, this.indexBuffer = e2, this.segments = i2;\n }\n destroy() {\n this.vertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(), this.vertexBuffer = null, this.indexBuffer = null, this.segments = null;\n }\n }\n class va {\n constructor(t4, i2) {\n this.context = new Bi(t4), this.transform = i2, this._tileTextures = {}, this.terrainFacilitator = { dirty: true, matrix: e.an(new Float64Array(16)), renderTime: 0 }, this.setup(), this.numSublayers = ut.maxUnderzooming + ut.maxOverzooming + 1, this.depthEpsilon = 1 / Math.pow(2, 16), this.crossTileSymbolIndex = new he();\n }\n resize(t4, e2, i2) {\n if (this.width = Math.floor(t4 * i2), this.height = Math.floor(e2 * i2), this.pixelRatio = i2, this.context.viewport.set([0, 0, this.width, this.height]), this.style) for (const t5 of this.style._order) this.style._layers[t5].resize();\n }\n setup() {\n const t4 = this.context, i2 = new e.aX();\n i2.emplaceBack(0, 0), i2.emplaceBack(e.X, 0), i2.emplaceBack(0, e.X), i2.emplaceBack(e.X, e.X), this.tileExtentBuffer = t4.createVertexBuffer(i2, _e.members), this.tileExtentSegments = e.a0.simpleSegment(0, 0, 4, 2);\n const a2 = new e.aX();\n a2.emplaceBack(0, 0), a2.emplaceBack(e.X, 0), a2.emplaceBack(0, e.X), a2.emplaceBack(e.X, e.X), this.debugBuffer = t4.createVertexBuffer(a2, _e.members), this.debugSegments = e.a0.simpleSegment(0, 0, 4, 5);\n const s2 = new e.$();\n s2.emplaceBack(0, 0, 0, 0), s2.emplaceBack(e.X, 0, e.X, 0), s2.emplaceBack(0, e.X, 0, e.X), s2.emplaceBack(e.X, e.X, e.X, e.X), this.rasterBoundsBuffer = t4.createVertexBuffer(s2, Y.members), this.rasterBoundsSegments = e.a0.simpleSegment(0, 0, 4, 2);\n const o2 = new e.aX();\n o2.emplaceBack(0, 0), o2.emplaceBack(1, 0), o2.emplaceBack(0, 1), o2.emplaceBack(1, 1), this.viewportBuffer = t4.createVertexBuffer(o2, _e.members), this.viewportSegments = e.a0.simpleSegment(0, 0, 4, 2);\n const r2 = new e.aZ();\n r2.emplaceBack(0), r2.emplaceBack(1), r2.emplaceBack(3), r2.emplaceBack(2), r2.emplaceBack(0), this.tileBorderIndexBuffer = t4.createIndexBuffer(r2);\n const n2 = new e.aY();\n n2.emplaceBack(0, 1, 2), n2.emplaceBack(2, 1, 3), this.quadTriangleIndexBuffer = t4.createIndexBuffer(n2);\n const l2 = this.context.gl;\n this.stencilClearMode = new Ui({ func: l2.ALWAYS, mask: 0 }, 0, 255, l2.ZERO, l2.ZERO, l2.ZERO);\n }\n clearStencil() {\n const t4 = this.context, i2 = t4.gl;\n this.nextStencilID = 1, this.currentStencilSource = void 0;\n const a2 = e.H();\n e.aP(a2, 0, this.width, this.height, 0, 0, 1), e.K(a2, a2, [i2.drawingBufferWidth, i2.drawingBufferHeight, 0]), this.useProgram(\"clippingMask\").draw(t4, i2.TRIANGLES, Oi.disabled, this.stencilClearMode, Fi.disabled, ji.disabled, De(a2), null, \"$clipping\", this.viewportBuffer, this.quadTriangleIndexBuffer, this.viewportSegments);\n }\n _renderTileClippingMasks(t4, e2) {\n if (this.currentStencilSource === t4.source || !t4.isTileClipped() || !e2 || !e2.length) return;\n this.currentStencilSource = t4.source;\n const i2 = this.context, a2 = i2.gl;\n this.nextStencilID + e2.length > 256 && this.clearStencil(), i2.setColorMode(Fi.disabled), i2.setDepthMode(Oi.disabled);\n const s2 = this.useProgram(\"clippingMask\");\n this._tileClippingMaskIDs = {};\n for (const t5 of e2) {\n const e3 = this._tileClippingMaskIDs[t5.key] = this.nextStencilID++, o2 = this.style.map.terrain && this.style.map.terrain.getTerrainData(t5);\n s2.draw(i2, a2.TRIANGLES, Oi.disabled, new Ui({ func: a2.ALWAYS, mask: 0 }, e3, 255, a2.KEEP, a2.KEEP, a2.REPLACE), Fi.disabled, ji.disabled, De(t5.posMatrix), o2, \"$clipping\", this.tileExtentBuffer, this.quadTriangleIndexBuffer, this.tileExtentSegments);\n }\n }\n stencilModeFor3D() {\n this.currentStencilSource = void 0, this.nextStencilID + 1 > 256 && this.clearStencil();\n const t4 = this.nextStencilID++, e2 = this.context.gl;\n return new Ui({ func: e2.NOTEQUAL, mask: 255 }, t4, 255, e2.KEEP, e2.KEEP, e2.REPLACE);\n }\n stencilModeForClipping(t4) {\n const e2 = this.context.gl;\n return new Ui({ func: e2.EQUAL, mask: 255 }, this._tileClippingMaskIDs[t4.key], 0, e2.KEEP, e2.KEEP, e2.REPLACE);\n }\n stencilConfigForOverlap(t4) {\n const e2 = this.context.gl, i2 = t4.sort((t5, e3) => e3.overscaledZ - t5.overscaledZ), a2 = i2[i2.length - 1].overscaledZ, s2 = i2[0].overscaledZ - a2 + 1;\n if (s2 > 1) {\n this.currentStencilSource = void 0, this.nextStencilID + s2 > 256 && this.clearStencil();\n const t5 = {};\n for (let i3 = 0; i3 < s2; i3++) t5[i3 + a2] = new Ui({ func: e2.GEQUAL, mask: 255 }, i3 + this.nextStencilID, 255, e2.KEEP, e2.KEEP, e2.REPLACE);\n return this.nextStencilID += s2, [t5, i2];\n }\n return [{ [a2]: Ui.disabled }, i2];\n }\n colorModeForRenderPass() {\n const t4 = this.context.gl;\n if (this._showOverdrawInspector) {\n const i2 = 1 / 8;\n return new Fi([t4.CONSTANT_COLOR, t4.ONE], new e.aM(i2, i2, i2, 0), [true, true, true, true]);\n }\n return \"opaque\" === this.renderPass ? Fi.unblended : Fi.alphaBlended;\n }\n depthModeForSublayer(t4, e2, i2) {\n if (!this.opaquePassEnabledForLayer()) return Oi.disabled;\n const a2 = 1 - ((1 + this.currentLayer) * this.numSublayers + t4) * this.depthEpsilon;\n return new Oi(i2 || this.context.gl.LEQUAL, e2, [a2, a2]);\n }\n opaquePassEnabledForLayer() {\n return this.currentLayer < this.opaquePassCutoff;\n }\n render(t4, i2) {\n this.style = t4, this.options = i2, this.lineAtlas = t4.lineAtlas, this.imageManager = t4.imageManager, this.glyphManager = t4.glyphManager, this.symbolFadeChange = t4.placement.symbolFadeChange(o.now()), this.imageManager.beginFrame();\n const a2 = this.style._order, s2 = this.style.sourceCaches, r2 = {}, n2 = {}, l2 = {};\n for (const t5 in s2) {\n const e2 = s2[t5];\n e2.used && e2.prepare(this.context), r2[t5] = e2.getVisibleCoordinates(), n2[t5] = r2[t5].slice().reverse(), l2[t5] = e2.getVisibleCoordinates(true).reverse();\n }\n this.opaquePassCutoff = 1 / 0;\n for (let t5 = 0; t5 < a2.length; t5++) if (this.style._layers[a2[t5]].is3D()) {\n this.opaquePassCutoff = t5;\n break;\n }\n this.maybeDrawDepthAndCoords(false), this.renderToTexture && (this.renderToTexture.prepareForRender(this.style, this.transform.zoom), this.opaquePassCutoff = 0), this.renderPass = \"offscreen\";\n for (const t5 of a2) {\n const e2 = this.style._layers[t5];\n if (!e2.hasOffscreenPass() || e2.isHidden(this.transform.zoom)) continue;\n const i3 = n2[e2.source];\n (\"custom\" === e2.type || i3.length) && this.renderLayer(this, s2[e2.source], e2, i3);\n }\n if (this.context.bindFramebuffer.set(null), this.context.clear({ color: i2.showOverdrawInspector ? e.aM.black : e.aM.transparent, depth: 1 }), this.clearStencil(), this.style.sky && function(t5, i3) {\n const a3 = t5.context, s3 = a3.gl, o2 = ((t6, e2, i4) => ({ u_sky_color: t6.properties.get(\"sky-color\"), u_horizon_color: t6.properties.get(\"horizon-color\"), u_horizon: (e2.height / 2 + e2.getHorizon()) * i4, u_sky_horizon_blend: t6.properties.get(\"sky-horizon-blend\") * e2.height / 2 * i4 }))(i3, t5.style.map.transform, t5.pixelRatio), r3 = new Oi(s3.LEQUAL, Oi.ReadWrite, [0, 1]), n3 = Ui.disabled, l3 = t5.colorModeForRenderPass(), h2 = t5.useProgram(\"sky\");\n if (!i3.mesh) {\n const t6 = new e.aX();\n t6.emplaceBack(-1, -1), t6.emplaceBack(1, -1), t6.emplaceBack(1, 1), t6.emplaceBack(-1, 1);\n const s4 = new e.aY();\n s4.emplaceBack(0, 1, 2), s4.emplaceBack(0, 2, 3), i3.mesh = new ga(a3.createVertexBuffer(t6, _e.members), a3.createIndexBuffer(s4), e.a0.simpleSegment(0, 0, t6.length, s4.length));\n }\n h2.draw(a3, s3.TRIANGLES, r3, n3, l3, ji.disabled, o2, void 0, \"sky\", i3.mesh.vertexBuffer, i3.mesh.indexBuffer, i3.mesh.segments);\n }(this, this.style.sky), this._showOverdrawInspector = i2.showOverdrawInspector, this.depthRangeFor3D = [0, 1 - (t4._order.length + 2) * this.numSublayers * this.depthEpsilon], !this.renderToTexture) for (this.renderPass = \"opaque\", this.currentLayer = a2.length - 1; this.currentLayer >= 0; this.currentLayer--) {\n const t5 = this.style._layers[a2[this.currentLayer]], e2 = s2[t5.source], i3 = r2[t5.source];\n this._renderTileClippingMasks(t5, i3), this.renderLayer(this, e2, t5, i3);\n }\n for (this.renderPass = \"translucent\", this.currentLayer = 0; this.currentLayer < a2.length; this.currentLayer++) {\n const t5 = this.style._layers[a2[this.currentLayer]], e2 = s2[t5.source];\n if (this.renderToTexture && this.renderToTexture.renderLayer(t5)) continue;\n const i3 = (\"symbol\" === t5.type ? l2 : n2)[t5.source];\n this._renderTileClippingMasks(t5, r2[t5.source]), this.renderLayer(this, e2, t5, i3);\n }\n if (this.options.showTileBoundaries) {\n const t5 = function(t6, e2) {\n let i3 = null;\n const a3 = Object.values(t6._layers).flatMap((i4) => i4.source && !i4.isHidden(e2) ? [t6.sourceCaches[i4.source]] : []), s3 = a3.filter((t7) => \"vector\" === t7.getSource().type), o2 = a3.filter((t7) => \"vector\" !== t7.getSource().type), r3 = (t7) => {\n (!i3 || i3.getSource().maxzoom < t7.getSource().maxzoom) && (i3 = t7);\n };\n return s3.forEach((t7) => r3(t7)), i3 || o2.forEach((t7) => r3(t7)), i3;\n }(this.style, this.transform.zoom);\n t5 && function(t6, e2, i3) {\n for (let a3 = 0; a3 < i3.length; a3++) ma(t6, e2, i3[a3]);\n }(this, t5, t5.getVisibleCoordinates());\n }\n this.options.showPadding && function(t5) {\n const e2 = t5.transform.padding;\n da(t5, t5.transform.height - (e2.top || 0), 3, na), da(t5, e2.bottom || 0, 3, la), _a(t5, e2.left || 0, 3, ha), _a(t5, t5.transform.width - (e2.right || 0), 3, ca);\n const i3 = t5.transform.centerPoint;\n !function(t6, e3, i4, a3) {\n pa(t6, e3 - 1, i4 - 10, 2, 20, a3), pa(t6, e3 - 10, i4 - 1, 20, 2, a3);\n }(t5, i3.x, t5.transform.height - i3.y, ua);\n }(this), this.context.setDefault();\n }\n maybeDrawDepthAndCoords(t4) {\n if (!this.style || !this.style.map || !this.style.map.terrain) return;\n const i2 = this.terrainFacilitator.matrix, a2 = this.transform.modelViewProjectionMatrix;\n let s2 = this.terrainFacilitator.dirty;\n s2 || (s2 = t4 ? !e.a_(i2, a2) : !e.a$(i2, a2)), s2 || (s2 = this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length > 0), s2 && (e.b0(i2, a2), this.terrainFacilitator.renderTime = Date.now(), this.terrainFacilitator.dirty = false, function(t5, i3) {\n const a3 = t5.context, s3 = a3.gl, o2 = Fi.unblended, r2 = new Oi(s3.LEQUAL, Oi.ReadWrite, [0, 1]), n2 = i3.getTerrainMesh(), l2 = i3.sourceCache.getRenderableTiles(), h2 = t5.useProgram(\"terrainDepth\");\n a3.bindFramebuffer.set(i3.getFramebuffer(\"depth\").framebuffer), a3.viewport.set([0, 0, t5.width / devicePixelRatio, t5.height / devicePixelRatio]), a3.clear({ color: e.aM.transparent, depth: 1 });\n for (const e2 of l2) {\n const l3 = i3.getTerrainData(e2.tileID), c2 = { u_matrix: t5.transform.calculatePosMatrix(e2.tileID.toUnwrapped()), u_ele_delta: i3.getMeshFrameDelta(t5.transform.zoom) };\n h2.draw(a3, s3.TRIANGLES, r2, Ui.disabled, o2, ji.backCCW, c2, l3, \"terrain\", n2.vertexBuffer, n2.indexBuffer, n2.segments);\n }\n a3.bindFramebuffer.set(null), a3.viewport.set([0, 0, t5.width, t5.height]);\n }(this, this.style.map.terrain), function(t5, i3) {\n const a3 = t5.context, s3 = a3.gl, o2 = Fi.unblended, r2 = new Oi(s3.LEQUAL, Oi.ReadWrite, [0, 1]), n2 = i3.getTerrainMesh(), l2 = i3.getCoordsTexture(), h2 = i3.sourceCache.getRenderableTiles(), c2 = t5.useProgram(\"terrainCoords\");\n a3.bindFramebuffer.set(i3.getFramebuffer(\"coords\").framebuffer), a3.viewport.set([0, 0, t5.width / devicePixelRatio, t5.height / devicePixelRatio]), a3.clear({ color: e.aM.transparent, depth: 1 }), i3.coordsIndex = [];\n for (const e2 of h2) {\n const h3 = i3.getTerrainData(e2.tileID);\n a3.activeTexture.set(s3.TEXTURE0), s3.bindTexture(s3.TEXTURE_2D, l2.texture);\n const u2 = { u_matrix: t5.transform.calculatePosMatrix(e2.tileID.toUnwrapped()), u_terrain_coords_id: (255 - i3.coordsIndex.length) / 255, u_texture: 0, u_ele_delta: i3.getMeshFrameDelta(t5.transform.zoom) };\n c2.draw(a3, s3.TRIANGLES, r2, Ui.disabled, o2, ji.backCCW, u2, h3, \"terrain\", n2.vertexBuffer, n2.indexBuffer, n2.segments), i3.coordsIndex.push(e2.tileID.key);\n }\n a3.bindFramebuffer.set(null), a3.viewport.set([0, 0, t5.width, t5.height]);\n }(this, this.style.map.terrain));\n }\n renderLayer(t4, i2, a2, s2) {\n if (!a2.isHidden(this.transform.zoom) && (\"background\" === a2.type || \"custom\" === a2.type || (s2 || []).length)) switch (this.id = a2.id, a2.type) {\n case \"symbol\":\n !function(t5, i3, a3, s3, o2) {\n if (\"translucent\" !== t5.renderPass) return;\n const r2 = Ui.disabled, n2 = t5.colorModeForRenderPass();\n (a3._unevaluatedLayout.hasValue(\"text-variable-anchor\") || a3._unevaluatedLayout.hasValue(\"text-variable-anchor-offset\")) && function(t6, i4, a4, s4, o3, r3, n3, l2, h2) {\n const c2 = i4.transform, u2 = ie(), d2 = \"map\" === o3, _2 = \"map\" === r3;\n for (const o4 of t6) {\n const t7 = s4.getTile(o4), r4 = t7.getBucket(a4);\n if (!r4 || !r4.text || !r4.text.segments.get().length) continue;\n const p2 = e.ag(r4.textSizeData, c2.zoom), m2 = Bt(t7, 1, i4.transform.zoom), f2 = gt(o4.posMatrix, _2, d2, i4.transform, m2), g2 = \"none\" !== a4.layout.get(\"icon-text-fit\") && r4.hasIconData();\n if (p2) {\n const e2 = Math.pow(2, c2.zoom - t7.tileID.overscaledZ), a5 = i4.style.map.terrain ? (t8, e3) => i4.style.map.terrain.getElevation(o4, t8, e3) : null, s5 = u2.translatePosition(c2, t7, n3, l2);\n Wi(r4, d2, _2, h2, c2, f2, o4.posMatrix, e2, p2, g2, u2, s5, o4.toUnwrapped(), a5);\n }\n }\n }(s3, t5, a3, i3, a3.layout.get(\"text-rotation-alignment\"), a3.layout.get(\"text-pitch-alignment\"), a3.paint.get(\"text-translate\"), a3.paint.get(\"text-translate-anchor\"), o2), 0 !== a3.paint.get(\"icon-opacity\").constantOr(1) && Xi(t5, i3, a3, s3, false, a3.paint.get(\"icon-translate\"), a3.paint.get(\"icon-translate-anchor\"), a3.layout.get(\"icon-rotation-alignment\"), a3.layout.get(\"icon-pitch-alignment\"), a3.layout.get(\"icon-keep-upright\"), r2, n2), 0 !== a3.paint.get(\"text-opacity\").constantOr(1) && Xi(t5, i3, a3, s3, true, a3.paint.get(\"text-translate\"), a3.paint.get(\"text-translate-anchor\"), a3.layout.get(\"text-rotation-alignment\"), a3.layout.get(\"text-pitch-alignment\"), a3.layout.get(\"text-keep-upright\"), r2, n2), i3.map.showCollisionBoxes && (qi(t5, i3, a3, s3, true), qi(t5, i3, a3, s3, false));\n }(t4, i2, a2, s2, this.style.placement.variableOffsets);\n break;\n case \"circle\":\n !function(t5, i3, a3, s3) {\n if (\"translucent\" !== t5.renderPass) return;\n const o2 = a3.paint.get(\"circle-opacity\"), r2 = a3.paint.get(\"circle-stroke-width\"), n2 = a3.paint.get(\"circle-stroke-opacity\"), l2 = !a3.layout.get(\"circle-sort-key\").isConstant();\n if (0 === o2.constantOr(1) && (0 === r2.constantOr(1) || 0 === n2.constantOr(1))) return;\n const h2 = t5.context, c2 = h2.gl, u2 = t5.depthModeForSublayer(0, Oi.ReadOnly), d2 = Ui.disabled, _2 = t5.colorModeForRenderPass(), p2 = [];\n for (let o3 = 0; o3 < s3.length; o3++) {\n const r3 = s3[o3], n3 = i3.getTile(r3), h3 = n3.getBucket(a3);\n if (!h3) continue;\n const c3 = h3.programConfigurations.get(a3.id), u3 = t5.useProgram(\"circle\", c3), d3 = h3.layoutVertexBuffer, _3 = h3.indexBuffer, m2 = t5.style.map.terrain && t5.style.map.terrain.getTerrainData(r3), f2 = { programConfiguration: c3, program: u3, layoutVertexBuffer: d3, indexBuffer: _3, uniformValues: Ce(t5, r3, n3, a3), terrainData: m2 };\n if (l2) {\n const t6 = h3.segments.get();\n for (const i4 of t6) p2.push({ segments: new e.a0([i4]), sortKey: i4.sortKey, state: f2 });\n } else p2.push({ segments: h3.segments, sortKey: 0, state: f2 });\n }\n l2 && p2.sort((t6, e2) => t6.sortKey - e2.sortKey);\n for (const e2 of p2) {\n const { programConfiguration: i4, program: s4, layoutVertexBuffer: o3, indexBuffer: r3, uniformValues: n3, terrainData: l3 } = e2.state;\n s4.draw(h2, c2.TRIANGLES, u2, d2, _2, ji.disabled, n3, l3, a3.id, o3, r3, e2.segments, a3.paint, t5.transform.zoom, i4);\n }\n }(t4, i2, a2, s2);\n break;\n case \"heatmap\":\n !function(t5, i3, a3, s3) {\n if (0 === a3.paint.get(\"heatmap-opacity\")) return;\n const o2 = t5.context;\n if (t5.style.map.terrain) {\n for (const e2 of s3) {\n const s4 = i3.getTile(e2);\n i3.hasRenderableParent(e2) || (\"offscreen\" === t5.renderPass ? Ji(t5, s4, a3, e2) : \"translucent\" === t5.renderPass && Yi(t5, a3, e2));\n }\n o2.viewport.set([0, 0, t5.width, t5.height]);\n } else \"offscreen\" === t5.renderPass ? function(t6, i4, a4, s4) {\n const o3 = t6.context, r2 = o3.gl, n2 = Ui.disabled, l2 = new Fi([r2.ONE, r2.ONE], e.aM.transparent, [true, true, true, true]);\n (function(t7, i5, a5) {\n const s5 = t7.gl;\n t7.activeTexture.set(s5.TEXTURE1), t7.viewport.set([0, 0, i5.width / 4, i5.height / 4]);\n let o4 = a5.heatmapFbos.get(e.aU);\n o4 ? (s5.bindTexture(s5.TEXTURE_2D, o4.colorAttachment.get()), t7.bindFramebuffer.set(o4.framebuffer)) : (o4 = Qi(t7, i5.width / 4, i5.height / 4), a5.heatmapFbos.set(e.aU, o4));\n })(o3, t6, a4), o3.clear({ color: e.aM.transparent });\n for (let e2 = 0; e2 < s4.length; e2++) {\n const h2 = s4[e2];\n if (i4.hasRenderableParent(h2)) continue;\n const c2 = i4.getTile(h2), u2 = c2.getBucket(a4);\n if (!u2) continue;\n const d2 = u2.programConfigurations.get(a4.id), _2 = t6.useProgram(\"heatmap\", d2), { zoom: p2 } = t6.transform;\n _2.draw(o3, r2.TRIANGLES, Oi.disabled, n2, l2, ji.disabled, Me(h2.posMatrix, c2, p2, a4.paint.get(\"heatmap-intensity\")), null, a4.id, u2.layoutVertexBuffer, u2.indexBuffer, u2.segments, a4.paint, t6.transform.zoom, d2);\n }\n o3.viewport.set([0, 0, t6.width, t6.height]);\n }(t5, i3, a3, s3) : \"translucent\" === t5.renderPass && function(t6, i4) {\n const a4 = t6.context, s4 = a4.gl;\n a4.setColorMode(t6.colorModeForRenderPass());\n const o3 = i4.heatmapFbos.get(e.aU);\n o3 && (a4.activeTexture.set(s4.TEXTURE0), s4.bindTexture(s4.TEXTURE_2D, o3.colorAttachment.get()), a4.activeTexture.set(s4.TEXTURE1), ta(a4, i4).bind(s4.LINEAR, s4.CLAMP_TO_EDGE), t6.useProgram(\"heatmapTexture\").draw(a4, s4.TRIANGLES, Oi.disabled, Ui.disabled, t6.colorModeForRenderPass(), ji.disabled, Ae(t6, i4, 0, 1), null, i4.id, t6.viewportBuffer, t6.quadTriangleIndexBuffer, t6.viewportSegments, i4.paint, t6.transform.zoom));\n }(t5, a3);\n }(t4, i2, a2, s2);\n break;\n case \"line\":\n !function(t5, i3, a3, s3) {\n if (\"translucent\" !== t5.renderPass) return;\n const o2 = a3.paint.get(\"line-opacity\"), r2 = a3.paint.get(\"line-width\");\n if (0 === o2.constantOr(1) || 0 === r2.constantOr(1)) return;\n const n2 = t5.depthModeForSublayer(0, Oi.ReadOnly), l2 = t5.colorModeForRenderPass(), h2 = a3.paint.get(\"line-dasharray\"), c2 = a3.paint.get(\"line-pattern\"), u2 = c2.constantOr(1), d2 = a3.paint.get(\"line-gradient\"), _2 = a3.getCrossfadeParameters(), p2 = u2 ? \"linePattern\" : h2 ? \"lineSDF\" : d2 ? \"lineGradient\" : \"line\", m2 = t5.context, f2 = m2.gl;\n let g2 = true;\n for (const o3 of s3) {\n const s4 = i3.getTile(o3);\n if (u2 && !s4.patternsLoaded()) continue;\n const r3 = s4.getBucket(a3);\n if (!r3) continue;\n const v2 = r3.programConfigurations.get(a3.id), x2 = t5.context.program.get(), y2 = t5.useProgram(p2, v2), w2 = g2 || y2.program !== x2, T2 = t5.style.map.terrain && t5.style.map.terrain.getTerrainData(o3), I2 = c2.constantOr(null);\n if (I2 && s4.imageAtlas) {\n const t6 = s4.imageAtlas, e2 = t6.patternPositions[I2.to.toString()], i4 = t6.patternPositions[I2.from.toString()];\n e2 && i4 && v2.setConstantPatternPositions(e2, i4);\n }\n const E3 = T2 ? o3 : null, P2 = u2 ? Fe(t5, s4, a3, _2, E3) : h2 ? Be(t5, s4, a3, h2, _2, E3) : d2 ? Le(t5, s4, a3, r3.lineClipsArray.length, E3) : ke(t5, s4, a3, E3);\n if (u2) m2.activeTexture.set(f2.TEXTURE0), s4.imageAtlasTexture.bind(f2.LINEAR, f2.CLAMP_TO_EDGE), v2.updatePaintBuffers(_2);\n else if (h2 && (w2 || t5.lineAtlas.dirty)) m2.activeTexture.set(f2.TEXTURE0), t5.lineAtlas.bind(m2);\n else if (d2) {\n const s5 = r3.gradients[a3.id];\n let n3 = s5.texture;\n if (a3.gradientVersion !== s5.version) {\n let l3 = 256;\n if (a3.stepInterpolant) {\n const a4 = i3.getSource().maxzoom, s6 = o3.canonical.z === a4 ? Math.ceil(1 << t5.transform.maxZoom - o3.canonical.z) : 1;\n l3 = e.ac(e.aV(r3.maxLineLength / e.X * 1024 * s6), 256, m2.maxTextureSize);\n }\n s5.gradient = e.aW({ expression: a3.gradientExpression(), evaluationKey: \"lineProgress\", resolution: l3, image: s5.gradient || void 0, clips: r3.lineClipsArray }), s5.texture ? s5.texture.update(s5.gradient) : s5.texture = new b(m2, s5.gradient, f2.RGBA), s5.version = a3.gradientVersion, n3 = s5.texture;\n }\n m2.activeTexture.set(f2.TEXTURE0), n3.bind(a3.stepInterpolant ? f2.NEAREST : f2.LINEAR, f2.CLAMP_TO_EDGE);\n }\n y2.draw(m2, f2.TRIANGLES, n2, t5.stencilModeForClipping(o3), l2, ji.disabled, P2, T2, a3.id, r3.layoutVertexBuffer, r3.indexBuffer, r3.segments, a3.paint, t5.transform.zoom, v2, r3.layoutVertexBuffer2), g2 = false;\n }\n }(t4, i2, a2, s2);\n break;\n case \"fill\":\n !function(t5, i3, a3, s3) {\n const o2 = a3.paint.get(\"fill-color\"), r2 = a3.paint.get(\"fill-opacity\");\n if (0 === r2.constantOr(1)) return;\n const n2 = t5.colorModeForRenderPass(), l2 = a3.paint.get(\"fill-pattern\"), h2 = t5.opaquePassEnabledForLayer() && !l2.constantOr(1) && 1 === o2.constantOr(e.aM.transparent).a && 1 === r2.constantOr(0) ? \"opaque\" : \"translucent\";\n if (t5.renderPass === h2) {\n const e2 = t5.depthModeForSublayer(1, \"opaque\" === t5.renderPass ? Oi.ReadWrite : Oi.ReadOnly);\n ia(t5, i3, a3, s3, e2, n2, false);\n }\n if (\"translucent\" === t5.renderPass && a3.paint.get(\"fill-antialias\")) {\n const e2 = t5.depthModeForSublayer(a3.getPaintProperty(\"fill-outline-color\") ? 2 : 0, Oi.ReadOnly);\n ia(t5, i3, a3, s3, e2, n2, true);\n }\n }(t4, i2, a2, s2);\n break;\n case \"fill-extrusion\":\n !function(t5, e2, i3, a3) {\n const s3 = i3.paint.get(\"fill-extrusion-opacity\");\n if (0 !== s3 && \"translucent\" === t5.renderPass) {\n const o2 = new Oi(t5.context.gl.LEQUAL, Oi.ReadWrite, t5.depthRangeFor3D);\n if (1 !== s3 || i3.paint.get(\"fill-extrusion-pattern\").constantOr(1)) aa(t5, e2, i3, a3, o2, Ui.disabled, Fi.disabled), aa(t5, e2, i3, a3, o2, t5.stencilModeFor3D(), t5.colorModeForRenderPass());\n else {\n const s4 = t5.colorModeForRenderPass();\n aa(t5, e2, i3, a3, o2, Ui.disabled, s4);\n }\n }\n }(t4, i2, a2, s2);\n break;\n case \"hillshade\":\n !function(t5, e2, i3, a3) {\n if (\"offscreen\" !== t5.renderPass && \"translucent\" !== t5.renderPass) return;\n const s3 = t5.context, o2 = t5.depthModeForSublayer(0, Oi.ReadOnly), r2 = t5.colorModeForRenderPass(), [n2, l2] = \"translucent\" === t5.renderPass ? t5.stencilConfigForOverlap(a3) : [{}, a3];\n for (const a4 of l2) {\n const s4 = e2.getTile(a4);\n void 0 !== s4.needsHillshadePrepare && s4.needsHillshadePrepare && \"offscreen\" === t5.renderPass ? oa(t5, s4, i3, o2, Ui.disabled, r2) : \"translucent\" === t5.renderPass && sa(t5, a4, s4, i3, o2, n2[a4.overscaledZ], r2);\n }\n s3.viewport.set([0, 0, t5.width, t5.height]);\n }(t4, i2, a2, s2);\n break;\n case \"raster\":\n !function(t5, e2, i3, a3) {\n if (\"translucent\" !== t5.renderPass) return;\n if (0 === i3.paint.get(\"raster-opacity\")) return;\n if (!a3.length) return;\n const s3 = t5.context, o2 = s3.gl, r2 = e2.getSource(), n2 = t5.useProgram(\"raster\"), l2 = t5.colorModeForRenderPass(), [h2, c2] = r2 instanceof Q ? [{}, a3] : t5.stencilConfigForOverlap(a3), u2 = c2[c2.length - 1].overscaledZ, d2 = !t5.options.moving;\n for (const a4 of c2) {\n const c3 = t5.depthModeForSublayer(a4.overscaledZ - u2, 1 === i3.paint.get(\"raster-opacity\") ? Oi.ReadWrite : Oi.ReadOnly, o2.LESS), _2 = e2.getTile(a4);\n _2.registerFadeDuration(i3.paint.get(\"raster-fade-duration\"));\n const p2 = e2.findLoadedParent(a4, 0), m2 = e2.findLoadedSibling(a4), f2 = ra(_2, p2 || m2 || null, e2, i3, t5.transform, t5.style.map.terrain);\n let g2, v2;\n const x2 = \"nearest\" === i3.paint.get(\"raster-resampling\") ? o2.NEAREST : o2.LINEAR;\n s3.activeTexture.set(o2.TEXTURE0), _2.texture.bind(x2, o2.CLAMP_TO_EDGE, o2.LINEAR_MIPMAP_NEAREST), s3.activeTexture.set(o2.TEXTURE1), p2 ? (p2.texture.bind(x2, o2.CLAMP_TO_EDGE, o2.LINEAR_MIPMAP_NEAREST), g2 = Math.pow(2, p2.tileID.overscaledZ - _2.tileID.overscaledZ), v2 = [_2.tileID.canonical.x * g2 % 1, _2.tileID.canonical.y * g2 % 1]) : _2.texture.bind(x2, o2.CLAMP_TO_EDGE, o2.LINEAR_MIPMAP_NEAREST), _2.texture.useMipmap && s3.extTextureFilterAnisotropic && t5.transform.pitch > 20 && o2.texParameterf(o2.TEXTURE_2D, s3.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, s3.extTextureFilterAnisotropicMax);\n const y2 = t5.style.map.terrain && t5.style.map.terrain.getTerrainData(a4), b2 = y2 ? a4 : null, w2 = b2 ? b2.posMatrix : t5.transform.calculatePosMatrix(a4.toUnwrapped(), d2), T2 = Ue(w2, v2 || [0, 0], g2 || 1, f2, i3);\n r2 instanceof Q ? n2.draw(s3, o2.TRIANGLES, c3, Ui.disabled, l2, ji.disabled, T2, y2, i3.id, r2.boundsBuffer, t5.quadTriangleIndexBuffer, r2.boundsSegments) : n2.draw(s3, o2.TRIANGLES, c3, h2[a4.overscaledZ], l2, ji.disabled, T2, y2, i3.id, t5.rasterBoundsBuffer, t5.quadTriangleIndexBuffer, t5.rasterBoundsSegments);\n }\n }(t4, i2, a2, s2);\n break;\n case \"background\":\n !function(t5, e2, i3, a3) {\n const s3 = i3.paint.get(\"background-color\"), o2 = i3.paint.get(\"background-opacity\");\n if (0 === o2) return;\n const r2 = t5.context, n2 = r2.gl, l2 = t5.transform, h2 = l2.tileSize, c2 = i3.paint.get(\"background-pattern\");\n if (t5.isPatternMissing(c2)) return;\n const u2 = !c2 && 1 === s3.a && 1 === o2 && t5.opaquePassEnabledForLayer() ? \"opaque\" : \"translucent\";\n if (t5.renderPass !== u2) return;\n const d2 = Ui.disabled, _2 = t5.depthModeForSublayer(0, \"opaque\" === u2 ? Oi.ReadWrite : Oi.ReadOnly), p2 = t5.colorModeForRenderPass(), m2 = t5.useProgram(c2 ? \"backgroundPattern\" : \"background\"), f2 = a3 || l2.coveringTiles({ tileSize: h2, terrain: t5.style.map.terrain });\n c2 && (r2.activeTexture.set(n2.TEXTURE0), t5.imageManager.bind(t5.context));\n const g2 = i3.getCrossfadeParameters();\n for (const e3 of f2) {\n const l3 = a3 ? e3.posMatrix : t5.transform.calculatePosMatrix(e3.toUnwrapped()), u3 = c2 ? He(l3, o2, t5, c2, { tileID: e3, tileSize: h2 }, g2) : Ge(l3, o2, s3), f3 = t5.style.map.terrain && t5.style.map.terrain.getTerrainData(e3);\n m2.draw(r2, n2.TRIANGLES, _2, d2, p2, ji.disabled, u3, f3, i3.id, t5.tileExtentBuffer, t5.quadTriangleIndexBuffer, t5.tileExtentSegments);\n }\n }(t4, 0, a2, s2);\n break;\n case \"custom\":\n !function(t5, e2, i3) {\n const a3 = t5.context, s3 = i3.implementation;\n if (\"offscreen\" === t5.renderPass) {\n const e3 = s3.prerender;\n e3 && (t5.setCustomLayerDefaults(), a3.setColorMode(t5.colorModeForRenderPass()), e3.call(s3, a3.gl, t5.transform.customLayerMatrix()), a3.setDirty(), t5.setBaseState());\n } else if (\"translucent\" === t5.renderPass) {\n t5.setCustomLayerDefaults(), a3.setColorMode(t5.colorModeForRenderPass()), a3.setStencilMode(Ui.disabled);\n const e3 = \"3d\" === s3.renderingMode ? new Oi(t5.context.gl.LEQUAL, Oi.ReadWrite, t5.depthRangeFor3D) : t5.depthModeForSublayer(0, Oi.ReadOnly);\n a3.setDepthMode(e3), s3.render(a3.gl, t5.transform.customLayerMatrix(), { farZ: t5.transform.farZ, nearZ: t5.transform.nearZ, fov: t5.transform._fov, modelViewProjectionMatrix: t5.transform.modelViewProjectionMatrix, projectionMatrix: t5.transform.projectionMatrix }), a3.setDirty(), t5.setBaseState(), a3.bindFramebuffer.set(null);\n }\n }(t4, 0, a2);\n }\n }\n translatePosMatrix(t4, i2, a2, s2, o2) {\n if (!a2[0] && !a2[1]) return t4;\n const r2 = o2 ? \"map\" === s2 ? this.transform.angle : 0 : \"viewport\" === s2 ? -this.transform.angle : 0;\n if (r2) {\n const t5 = Math.sin(r2), e2 = Math.cos(r2);\n a2 = [a2[0] * e2 - a2[1] * t5, a2[0] * t5 + a2[1] * e2];\n }\n const n2 = [o2 ? a2[0] : Bt(i2, a2[0], this.transform.zoom), o2 ? a2[1] : Bt(i2, a2[1], this.transform.zoom), 0], l2 = new Float32Array(16);\n return e.J(l2, t4, n2), l2;\n }\n saveTileTexture(t4) {\n const e2 = this._tileTextures[t4.size[0]];\n e2 ? e2.push(t4) : this._tileTextures[t4.size[0]] = [t4];\n }\n getTileTexture(t4) {\n const e2 = this._tileTextures[t4];\n return e2 && e2.length > 0 ? e2.pop() : null;\n }\n isPatternMissing(t4) {\n if (!t4) return false;\n if (!t4.from || !t4.to) return true;\n const e2 = this.imageManager.getPattern(t4.from.toString()), i2 = this.imageManager.getPattern(t4.to.toString());\n return !e2 || !i2;\n }\n useProgram(t4, e2) {\n this.cache = this.cache || {};\n const i2 = t4 + (e2 ? e2.cacheKey : \"\") + (this._showOverdrawInspector ? \"/overdraw\" : \"\") + (this.style.map.terrain ? \"/terrain\" : \"\");\n return this.cache[i2] || (this.cache[i2] = new xe(this.context, pe[t4], e2, We[t4], this._showOverdrawInspector, this.style.map.terrain)), this.cache[i2];\n }\n setCustomLayerDefaults() {\n this.context.unbindVAO(), this.context.cullFace.setDefault(), this.context.activeTexture.setDefault(), this.context.pixelStoreUnpack.setDefault(), this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(), this.context.pixelStoreUnpackFlipY.setDefault();\n }\n setBaseState() {\n const t4 = this.context.gl;\n this.context.cullFace.set(false), this.context.viewport.set([0, 0, this.width, this.height]), this.context.blendEquation.set(t4.FUNC_ADD);\n }\n initDebugOverlayCanvas() {\n null == this.debugOverlayCanvas && (this.debugOverlayCanvas = document.createElement(\"canvas\"), this.debugOverlayCanvas.width = 512, this.debugOverlayCanvas.height = 512, this.debugOverlayTexture = new b(this.context, this.debugOverlayCanvas, this.context.gl.RGBA));\n }\n destroy() {\n this.debugOverlayTexture && this.debugOverlayTexture.destroy();\n }\n overLimit() {\n const { drawingBufferWidth: t4, drawingBufferHeight: e2 } = this.context.gl;\n return this.width !== t4 || this.height !== e2;\n }\n }\n class xa {\n constructor(t4, e2) {\n this.points = t4, this.planes = e2;\n }\n static fromInvProjectionMatrix(t4, i2, a2) {\n const s2 = Math.pow(2, a2), o2 = [[-1, 1, -1, 1], [1, 1, -1, 1], [1, -1, -1, 1], [-1, -1, -1, 1], [-1, 1, 1, 1], [1, 1, 1, 1], [1, -1, 1, 1], [-1, -1, 1, 1]].map((a3) => {\n const o3 = 1 / (a3 = e.af([], a3, t4))[3] / i2 * s2;\n return e.b1(a3, a3, [o3, o3, 1 / a3[3], o3]);\n }), r2 = [[0, 1, 2], [6, 5, 4], [0, 3, 7], [2, 1, 5], [3, 2, 6], [0, 4, 5]].map((t5) => {\n const e2 = function(t6, e3) {\n var i4 = e3[0], a4 = e3[1], s4 = e3[2], o3 = i4 * i4 + a4 * a4 + s4 * s4;\n return o3 > 0 && (o3 = 1 / Math.sqrt(o3)), t6[0] = e3[0] * o3, t6[1] = e3[1] * o3, t6[2] = e3[2] * o3, t6;\n }([], function(t6, e3, i4) {\n var a4 = e3[0], s4 = e3[1], o3 = e3[2], r3 = i4[0], n2 = i4[1], l2 = i4[2];\n return t6[0] = s4 * l2 - o3 * n2, t6[1] = o3 * r3 - a4 * l2, t6[2] = a4 * n2 - s4 * r3, t6;\n }([], g([], o2[t5[0]], o2[t5[1]]), g([], o2[t5[2]], o2[t5[1]]))), i3 = -((a3 = e2)[0] * (s3 = o2[t5[1]])[0] + a3[1] * s3[1] + a3[2] * s3[2]);\n var a3, s3;\n return e2.concat(i3);\n });\n return new xa(o2, r2);\n }\n }\n class ya {\n constructor(t4, e2) {\n this.min = t4, this.max = e2, this.center = function(t5, e3, i2) {\n return t5[0] = 0.5 * e3[0], t5[1] = 0.5 * e3[1], t5[2] = 0.5 * e3[2], t5;\n }([], function(t5, e3, i2) {\n return t5[0] = e3[0] + i2[0], t5[1] = e3[1] + i2[1], t5[2] = e3[2] + i2[2], t5;\n }([], this.min, this.max));\n }\n quadrant(t4) {\n const e2 = [t4 % 2 == 0, t4 < 2], i2 = m(this.min), a2 = m(this.max);\n for (let t5 = 0; t5 < e2.length; t5++) i2[t5] = e2[t5] ? this.min[t5] : this.center[t5], a2[t5] = e2[t5] ? this.center[t5] : this.max[t5];\n return a2[2] = this.max[2], new ya(i2, a2);\n }\n distanceX(t4) {\n return Math.max(Math.min(this.max[0], t4[0]), this.min[0]) - t4[0];\n }\n distanceY(t4) {\n return Math.max(Math.min(this.max[1], t4[1]), this.min[1]) - t4[1];\n }\n intersects(t4) {\n const i2 = [[this.min[0], this.min[1], this.min[2], 1], [this.max[0], this.min[1], this.min[2], 1], [this.max[0], this.max[1], this.min[2], 1], [this.min[0], this.max[1], this.min[2], 1], [this.min[0], this.min[1], this.max[2], 1], [this.max[0], this.min[1], this.max[2], 1], [this.max[0], this.max[1], this.max[2], 1], [this.min[0], this.max[1], this.max[2], 1]];\n let a2 = true;\n for (let s2 = 0; s2 < t4.planes.length; s2++) {\n const o2 = t4.planes[s2];\n let r2 = 0;\n for (let t5 = 0; t5 < i2.length; t5++) e.b2(o2, i2[t5]) >= 0 && r2++;\n if (0 === r2) return 0;\n r2 !== i2.length && (a2 = false);\n }\n if (a2) return 2;\n for (let e2 = 0; e2 < 3; e2++) {\n let i3 = Number.MAX_VALUE, a3 = -Number.MAX_VALUE;\n for (let s2 = 0; s2 < t4.points.length; s2++) {\n const o2 = t4.points[s2][e2] - this.min[e2];\n i3 = Math.min(i3, o2), a3 = Math.max(a3, o2);\n }\n if (a3 < 0 || i3 > this.max[e2] - this.min[e2]) return 0;\n }\n return 1;\n }\n }\n class ba {\n constructor(t4 = 0, e2 = 0, i2 = 0, a2 = 0) {\n if (isNaN(t4) || t4 < 0 || isNaN(e2) || e2 < 0 || isNaN(i2) || i2 < 0 || isNaN(a2) || a2 < 0) throw new Error(\"Invalid value for edge-insets, top, bottom, left and right must all be numbers\");\n this.top = t4, this.bottom = e2, this.left = i2, this.right = a2;\n }\n interpolate(t4, i2, a2) {\n return null != i2.top && null != t4.top && (this.top = e.y.number(t4.top, i2.top, a2)), null != i2.bottom && null != t4.bottom && (this.bottom = e.y.number(t4.bottom, i2.bottom, a2)), null != i2.left && null != t4.left && (this.left = e.y.number(t4.left, i2.left, a2)), null != i2.right && null != t4.right && (this.right = e.y.number(t4.right, i2.right, a2)), this;\n }\n getCenter(t4, i2) {\n const a2 = e.ac((this.left + t4 - this.right) / 2, 0, t4), s2 = e.ac((this.top + i2 - this.bottom) / 2, 0, i2);\n return new e.P(a2, s2);\n }\n equals(t4) {\n return this.top === t4.top && this.bottom === t4.bottom && this.left === t4.left && this.right === t4.right;\n }\n clone() {\n return new ba(this.top, this.bottom, this.left, this.right);\n }\n toJSON() {\n return { top: this.top, bottom: this.bottom, left: this.left, right: this.right };\n }\n }\n const wa = 85.051129;\n class Ta {\n constructor(t4, i2, a2, s2, o2) {\n this.tileSize = 512, this._renderWorldCopies = void 0 === o2 || !!o2, this._minZoom = t4 || 0, this._maxZoom = i2 || 22, this._minPitch = null == a2 ? 0 : a2, this._maxPitch = null == s2 ? 60 : s2, this.setMaxBounds(), this.width = 0, this.height = 0, this._center = new e.N(0, 0), this._elevation = 0, this.zoom = 0, this.angle = 0, this._fov = 0.6435011087932844, this._pitch = 0, this._unmodified = true, this._edgeInsets = new ba(), this._posMatrixCache = {}, this._alignedPosMatrixCache = {}, this._fogMatrixCache = {}, this.minElevationForCurrentTile = 0;\n }\n clone() {\n const t4 = new Ta(this._minZoom, this._maxZoom, this._minPitch, this.maxPitch, this._renderWorldCopies);\n return t4.apply(this), t4;\n }\n apply(t4) {\n this.tileSize = t4.tileSize, this.latRange = t4.latRange, this.lngRange = t4.lngRange, this.width = t4.width, this.height = t4.height, this._center = t4._center, this._elevation = t4._elevation, this.minElevationForCurrentTile = t4.minElevationForCurrentTile, this.zoom = t4.zoom, this.angle = t4.angle, this._fov = t4._fov, this._pitch = t4._pitch, this._unmodified = t4._unmodified, this._edgeInsets = t4._edgeInsets.clone(), this._calcMatrices();\n }\n get minZoom() {\n return this._minZoom;\n }\n set minZoom(t4) {\n this._minZoom !== t4 && (this._minZoom = t4, this.zoom = Math.max(this.zoom, t4));\n }\n get maxZoom() {\n return this._maxZoom;\n }\n set maxZoom(t4) {\n this._maxZoom !== t4 && (this._maxZoom = t4, this.zoom = Math.min(this.zoom, t4));\n }\n get minPitch() {\n return this._minPitch;\n }\n set minPitch(t4) {\n this._minPitch !== t4 && (this._minPitch = t4, this.pitch = Math.max(this.pitch, t4));\n }\n get maxPitch() {\n return this._maxPitch;\n }\n set maxPitch(t4) {\n this._maxPitch !== t4 && (this._maxPitch = t4, this.pitch = Math.min(this.pitch, t4));\n }\n get renderWorldCopies() {\n return this._renderWorldCopies;\n }\n set renderWorldCopies(t4) {\n void 0 === t4 ? t4 = true : null === t4 && (t4 = false), this._renderWorldCopies = t4;\n }\n get worldSize() {\n return this.tileSize * this.scale;\n }\n get centerOffset() {\n return this.centerPoint._sub(this.size._div(2));\n }\n get size() {\n return new e.P(this.width, this.height);\n }\n get bearing() {\n return -this.angle / Math.PI * 180;\n }\n set bearing(t4) {\n const i2 = -e.b3(t4, -180, 180) * Math.PI / 180;\n this.angle !== i2 && (this._unmodified = false, this.angle = i2, this._calcMatrices(), this.rotationMatrix = function() {\n var t5 = new e.A(4);\n return e.A != Float32Array && (t5[1] = 0, t5[2] = 0), t5[0] = 1, t5[3] = 1, t5;\n }(), function(t5, e2, i3) {\n var a2 = e2[0], s2 = e2[1], o2 = e2[2], r2 = e2[3], n2 = Math.sin(i3), l2 = Math.cos(i3);\n t5[0] = a2 * l2 + o2 * n2, t5[1] = s2 * l2 + r2 * n2, t5[2] = a2 * -n2 + o2 * l2, t5[3] = s2 * -n2 + r2 * l2;\n }(this.rotationMatrix, this.rotationMatrix, this.angle));\n }\n get pitch() {\n return this._pitch / Math.PI * 180;\n }\n set pitch(t4) {\n const i2 = e.ac(t4, this.minPitch, this.maxPitch) / 180 * Math.PI;\n this._pitch !== i2 && (this._unmodified = false, this._pitch = i2, this._calcMatrices());\n }\n get fov() {\n return this._fov / Math.PI * 180;\n }\n set fov(t4) {\n t4 = Math.max(0.01, Math.min(60, t4)), this._fov !== t4 && (this._unmodified = false, this._fov = t4 / 180 * Math.PI, this._calcMatrices());\n }\n get zoom() {\n return this._zoom;\n }\n set zoom(t4) {\n const e2 = Math.min(Math.max(t4, this.minZoom), this.maxZoom);\n this._zoom !== e2 && (this._unmodified = false, this._zoom = e2, this.tileZoom = Math.max(0, Math.floor(e2)), this.scale = this.zoomScale(e2), this._constrain(), this._calcMatrices());\n }\n get center() {\n return this._center;\n }\n set center(t4) {\n t4.lat === this._center.lat && t4.lng === this._center.lng || (this._unmodified = false, this._center = t4, this._constrain(), this._calcMatrices());\n }\n get elevation() {\n return this._elevation;\n }\n set elevation(t4) {\n t4 !== this._elevation && (this._elevation = t4, this._constrain(), this._calcMatrices());\n }\n get padding() {\n return this._edgeInsets.toJSON();\n }\n set padding(t4) {\n this._edgeInsets.equals(t4) || (this._unmodified = false, this._edgeInsets.interpolate(this._edgeInsets, t4, 1), this._calcMatrices());\n }\n get centerPoint() {\n return this._edgeInsets.getCenter(this.width, this.height);\n }\n isPaddingEqual(t4) {\n return this._edgeInsets.equals(t4);\n }\n interpolatePadding(t4, e2, i2) {\n this._unmodified = false, this._edgeInsets.interpolate(t4, e2, i2), this._constrain(), this._calcMatrices();\n }\n coveringZoomLevel(t4) {\n const e2 = (t4.roundZoom ? Math.round : Math.floor)(this.zoom + this.scaleZoom(this.tileSize / t4.tileSize));\n return Math.max(0, e2);\n }\n getVisibleUnwrappedCoordinates(t4) {\n const i2 = [new e.b4(0, t4)];\n if (this._renderWorldCopies) {\n const a2 = this.pointCoordinate(new e.P(0, 0)), s2 = this.pointCoordinate(new e.P(this.width, 0)), o2 = this.pointCoordinate(new e.P(this.width, this.height)), r2 = this.pointCoordinate(new e.P(0, this.height)), n2 = Math.floor(Math.min(a2.x, s2.x, o2.x, r2.x)), l2 = Math.floor(Math.max(a2.x, s2.x, o2.x, r2.x)), h2 = 1;\n for (let a3 = n2 - h2; a3 <= l2 + h2; a3++) 0 !== a3 && i2.push(new e.b4(a3, t4));\n }\n return i2;\n }\n coveringTiles(t4) {\n var i2, a2;\n let s2 = this.coveringZoomLevel(t4);\n const o2 = s2;\n if (void 0 !== t4.minzoom && s2 < t4.minzoom) return [];\n void 0 !== t4.maxzoom && s2 > t4.maxzoom && (s2 = t4.maxzoom);\n const r2 = this.pointCoordinate(this.getCameraPoint()), n2 = e.Z.fromLngLat(this.center), l2 = Math.pow(2, s2), h2 = [l2 * r2.x, l2 * r2.y, 0], c2 = [l2 * n2.x, l2 * n2.y, 0], u2 = xa.fromInvProjectionMatrix(this.invModelViewProjectionMatrix, this.worldSize, s2);\n let d2 = t4.minzoom || 0;\n !t4.terrain && this.pitch <= 60 && this._edgeInsets.top < 0.1 && (d2 = s2);\n const _2 = t4.terrain ? 2 / Math.min(this.tileSize, t4.tileSize) * this.tileSize : 3, p2 = (t5) => ({ aabb: new ya([t5 * l2, 0, 0], [(t5 + 1) * l2, l2, 0]), zoom: 0, x: 0, y: 0, wrap: t5, fullyVisible: false }), m2 = [], f2 = [], g2 = s2, x2 = t4.reparseOverscaled ? o2 : s2;\n if (this._renderWorldCopies) for (let t5 = 1; t5 <= 3; t5++) m2.push(p2(-t5)), m2.push(p2(t5));\n for (m2.push(p2(0)); m2.length > 0; ) {\n const s3 = m2.pop(), o3 = s3.x, r3 = s3.y;\n let n3 = s3.fullyVisible;\n if (!n3) {\n const t5 = s3.aabb.intersects(u2);\n if (0 === t5) continue;\n n3 = 2 === t5;\n }\n const l3 = t4.terrain ? h2 : c2, p3 = s3.aabb.distanceX(l3), y2 = s3.aabb.distanceY(l3), b2 = Math.max(Math.abs(p3), Math.abs(y2));\n if (s3.zoom === g2 || b2 > _2 + (1 << g2 - s3.zoom) - 2 && s3.zoom >= d2) {\n const t5 = g2 - s3.zoom, i3 = h2[0] - 0.5 - (o3 << t5), a3 = h2[1] - 0.5 - (r3 << t5);\n f2.push({ tileID: new e.S(s3.zoom === g2 ? x2 : s3.zoom, s3.wrap, s3.zoom, o3, r3), distanceSq: v([c2[0] - 0.5 - o3, c2[1] - 0.5 - r3]), tileDistanceToCamera: Math.sqrt(i3 * i3 + a3 * a3) });\n } else for (let l4 = 0; l4 < 4; l4++) {\n const h3 = (o3 << 1) + l4 % 2, c3 = (r3 << 1) + (l4 >> 1), u3 = s3.zoom + 1;\n let d3 = s3.aabb.quadrant(l4);\n if (t4.terrain) {\n const o4 = new e.S(u3, s3.wrap, u3, h3, c3), r4 = t4.terrain.getMinMaxElevation(o4), n4 = null !== (i2 = r4.minElevation) && void 0 !== i2 ? i2 : this.elevation, l5 = null !== (a2 = r4.maxElevation) && void 0 !== a2 ? a2 : this.elevation;\n d3 = new ya([d3.min[0], d3.min[1], n4], [d3.max[0], d3.max[1], l5]);\n }\n m2.push({ aabb: d3, zoom: u3, x: h3, y: c3, wrap: s3.wrap, fullyVisible: n3 });\n }\n }\n return f2.sort((t5, e2) => t5.distanceSq - e2.distanceSq).map((t5) => t5.tileID);\n }\n resize(t4, e2) {\n this.width = t4, this.height = e2, this.pixelsToGLUnits = [2 / t4, -2 / e2], this._constrain(), this._calcMatrices();\n }\n get unmodified() {\n return this._unmodified;\n }\n zoomScale(t4) {\n return Math.pow(2, t4);\n }\n scaleZoom(t4) {\n return Math.log(t4) / Math.LN2;\n }\n project(t4) {\n const i2 = e.ac(t4.lat, -85.051129, wa);\n return new e.P(e.O(t4.lng) * this.worldSize, e.Q(i2) * this.worldSize);\n }\n unproject(t4) {\n return new e.Z(t4.x / this.worldSize, t4.y / this.worldSize).toLngLat();\n }\n get point() {\n return this.project(this.center);\n }\n getCameraPosition() {\n return { lngLat: this.pointLocation(this.getCameraPoint()), altitude: Math.cos(this._pitch) * this.cameraToCenterDistance / this._pixelPerMeter + this.elevation };\n }\n recalculateZoom(t4) {\n const i2 = this.elevation, a2 = Math.cos(this._pitch) * this.cameraToCenterDistance / this._pixelPerMeter, s2 = this.pointLocation(this.centerPoint, t4), o2 = t4.getElevationForLngLatZoom(s2, this.tileZoom);\n if (!(this.elevation - o2)) return;\n const r2 = a2 + i2 - o2, n2 = Math.cos(this._pitch) * this.cameraToCenterDistance / r2 / e.b5(1, s2.lat), l2 = this.scaleZoom(n2 / this.tileSize);\n this._elevation = o2, this._center = s2, this.zoom = l2;\n }\n setLocationAtPoint(t4, i2) {\n const a2 = this.pointCoordinate(i2), s2 = this.pointCoordinate(this.centerPoint), o2 = this.locationCoordinate(t4), r2 = new e.Z(o2.x - (a2.x - s2.x), o2.y - (a2.y - s2.y));\n this.center = this.coordinateLocation(r2), this._renderWorldCopies && (this.center = this.center.wrap());\n }\n locationPoint(t4, e2) {\n return e2 ? this.coordinatePoint(this.locationCoordinate(t4), e2.getElevationForLngLatZoom(t4, this.tileZoom), this.pixelMatrix3D) : this.coordinatePoint(this.locationCoordinate(t4));\n }\n pointLocation(t4, e2) {\n return this.coordinateLocation(this.pointCoordinate(t4, e2));\n }\n locationCoordinate(t4) {\n return e.Z.fromLngLat(t4);\n }\n coordinateLocation(t4) {\n return t4 && t4.toLngLat();\n }\n pointCoordinate(t4, i2) {\n if (i2) {\n const e2 = i2.pointCoordinate(t4);\n if (null != e2) return e2;\n }\n const a2 = [t4.x, t4.y, 0, 1], s2 = [t4.x, t4.y, 1, 1];\n e.af(a2, a2, this.pixelMatrixInverse), e.af(s2, s2, this.pixelMatrixInverse);\n const o2 = a2[3], r2 = s2[3], n2 = a2[1] / o2, l2 = s2[1] / r2, h2 = a2[2] / o2, c2 = s2[2] / r2, u2 = h2 === c2 ? 0 : (0 - h2) / (c2 - h2);\n return new e.Z(e.y.number(a2[0] / o2, s2[0] / r2, u2) / this.worldSize, e.y.number(n2, l2, u2) / this.worldSize);\n }\n coordinatePoint(t4, i2 = 0, a2 = this.pixelMatrix) {\n const s2 = [t4.x * this.worldSize, t4.y * this.worldSize, i2, 1];\n return e.af(s2, s2, a2), new e.P(s2[0] / s2[3], s2[1] / s2[3]);\n }\n getBounds() {\n const t4 = Math.max(0, this.height / 2 - this.getHorizon());\n return new H().extend(this.pointLocation(new e.P(0, t4))).extend(this.pointLocation(new e.P(this.width, t4))).extend(this.pointLocation(new e.P(this.width, this.height))).extend(this.pointLocation(new e.P(0, this.height)));\n }\n getMaxBounds() {\n return this.latRange && 2 === this.latRange.length && this.lngRange && 2 === this.lngRange.length ? new H([this.lngRange[0], this.latRange[0]], [this.lngRange[1], this.latRange[1]]) : null;\n }\n getHorizon() {\n return Math.tan(Math.PI / 2 - this._pitch) * this.cameraToCenterDistance * 0.85;\n }\n setMaxBounds(t4) {\n t4 ? (this.lngRange = [t4.getWest(), t4.getEast()], this.latRange = [t4.getSouth(), t4.getNorth()], this._constrain()) : (this.lngRange = null, this.latRange = [-85.051129, wa]);\n }\n calculateTileMatrix(t4) {\n const i2 = t4.canonical, a2 = this.worldSize / this.zoomScale(i2.z), s2 = i2.x + Math.pow(2, i2.z) * t4.wrap, o2 = e.an(new Float64Array(16));\n return e.J(o2, o2, [s2 * a2, i2.y * a2, 0]), e.K(o2, o2, [a2 / e.X, a2 / e.X, 1]), o2;\n }\n calculatePosMatrix(t4, i2 = false) {\n const a2 = t4.key, s2 = i2 ? this._alignedPosMatrixCache : this._posMatrixCache;\n if (s2[a2]) return s2[a2];\n const o2 = this.calculateTileMatrix(t4);\n return e.L(o2, i2 ? this.alignedModelViewProjectionMatrix : this.modelViewProjectionMatrix, o2), s2[a2] = new Float32Array(o2), s2[a2];\n }\n calculateFogMatrix(t4) {\n const i2 = t4.key, a2 = this._fogMatrixCache;\n if (a2[i2]) return a2[i2];\n const s2 = this.calculateTileMatrix(t4);\n return e.L(s2, this.fogMatrix, s2), a2[i2] = new Float32Array(s2), a2[i2];\n }\n customLayerMatrix() {\n return this.mercatorMatrix.slice();\n }\n getConstrained(t4, i2) {\n i2 = e.ac(+i2, this.minZoom, this.maxZoom);\n const a2 = { center: new e.N(t4.lng, t4.lat), zoom: i2 };\n let s2 = this.lngRange;\n if (!this._renderWorldCopies && null === s2) {\n const t5 = 180 - 1e-10;\n s2 = [-t5, t5];\n }\n const o2 = this.tileSize * this.zoomScale(a2.zoom);\n let r2 = 0, n2 = o2, l2 = 0, h2 = o2, c2 = 0, u2 = 0;\n const { x: d2, y: _2 } = this.size;\n if (this.latRange) {\n const t5 = this.latRange;\n r2 = e.Q(t5[1]) * o2, n2 = e.Q(t5[0]) * o2, n2 - r2 < _2 && (c2 = _2 / (n2 - r2));\n }\n s2 && (l2 = e.b3(e.O(s2[0]) * o2, 0, o2), h2 = e.b3(e.O(s2[1]) * o2, 0, o2), h2 < l2 && (h2 += o2), h2 - l2 < d2 && (u2 = d2 / (h2 - l2)));\n const { x: p2, y: m2 } = this.project.call({ worldSize: o2 }, t4);\n let f2, g2;\n const v2 = Math.max(u2 || 0, c2 || 0);\n if (v2) {\n const t5 = new e.P(u2 ? (h2 + l2) / 2 : p2, c2 ? (n2 + r2) / 2 : m2);\n return a2.center = this.unproject.call({ worldSize: o2 }, t5).wrap(), a2.zoom += this.scaleZoom(v2), a2;\n }\n if (this.latRange) {\n const t5 = _2 / 2;\n m2 - t5 < r2 && (g2 = r2 + t5), m2 + t5 > n2 && (g2 = n2 - t5);\n }\n if (s2) {\n const t5 = (l2 + h2) / 2;\n let i3 = p2;\n this._renderWorldCopies && (i3 = e.b3(p2, t5 - o2 / 2, t5 + o2 / 2));\n const a3 = d2 / 2;\n i3 - a3 < l2 && (f2 = l2 + a3), i3 + a3 > h2 && (f2 = h2 - a3);\n }\n if (void 0 !== f2 || void 0 !== g2) {\n const t5 = new e.P(null != f2 ? f2 : p2, null != g2 ? g2 : m2);\n a2.center = this.unproject.call({ worldSize: o2 }, t5).wrap();\n }\n return a2;\n }\n _constrain() {\n if (!this.center || !this.width || !this.height || this._constraining) return;\n this._constraining = true;\n const t4 = this._unmodified, { center: e2, zoom: i2 } = this.getConstrained(this.center, this.zoom);\n this.center = e2, this.zoom = i2, this._unmodified = t4, this._constraining = false;\n }\n _calcMatrices() {\n if (!this.height) return;\n const t4 = this.centerOffset, i2 = this.point.x, a2 = this.point.y;\n this.cameraToCenterDistance = 0.5 / Math.tan(this._fov / 2) * this.height, this._pixelPerMeter = e.b5(1, this.center.lat) * this.worldSize;\n let s2 = e.an(new Float64Array(16));\n e.K(s2, s2, [this.width / 2, -this.height / 2, 1]), e.J(s2, s2, [1, -1, 0]), this.labelPlaneMatrix = s2, s2 = e.an(new Float64Array(16)), e.K(s2, s2, [1, -1, 1]), e.J(s2, s2, [-1, -1, 0]), e.K(s2, s2, [2 / this.width, 2 / this.height, 1]), this.glCoordMatrix = s2;\n const o2 = this.cameraToCenterDistance + this._elevation * this._pixelPerMeter / Math.cos(this._pitch), r2 = Math.min(this.elevation, this.minElevationForCurrentTile), n2 = o2 - r2 * this._pixelPerMeter / Math.cos(this._pitch), l2 = r2 < 0 ? n2 : o2, h2 = Math.PI / 2 + this._pitch, c2 = this._fov * (0.5 + t4.y / this.height), u2 = Math.sin(c2) * l2 / Math.sin(e.ac(Math.PI - h2 - c2, 0.01, Math.PI - 0.01)), d2 = this.getHorizon(), _2 = 2 * Math.atan(d2 / this.cameraToCenterDistance) * (0.5 + t4.y / (2 * d2)), p2 = Math.sin(_2) * l2 / Math.sin(e.ac(Math.PI - h2 - _2, 0.01, Math.PI - 0.01)), m2 = Math.min(u2, p2);\n this.farZ = 1.01 * (Math.cos(Math.PI / 2 - this._pitch) * m2 + l2), this.nearZ = this.height / 50, s2 = new Float64Array(16), e.b6(s2, this._fov, this.width / this.height, this.nearZ, this.farZ), s2[8] = 2 * -t4.x / this.width, s2[9] = 2 * t4.y / this.height, this.projectionMatrix = e.ae(s2), e.K(s2, s2, [1, -1, 1]), e.J(s2, s2, [0, 0, -this.cameraToCenterDistance]), e.b7(s2, s2, this._pitch), e.ad(s2, s2, this.angle), e.J(s2, s2, [-i2, -a2, 0]), this.mercatorMatrix = e.K([], s2, [this.worldSize, this.worldSize, this.worldSize]), e.K(s2, s2, [1, 1, this._pixelPerMeter]), this.pixelMatrix = e.L(new Float64Array(16), this.labelPlaneMatrix, s2), e.J(s2, s2, [0, 0, -this.elevation]), this.modelViewProjectionMatrix = s2, this.invModelViewProjectionMatrix = e.as([], s2), this.fogMatrix = new Float64Array(16), e.b6(this.fogMatrix, this._fov, this.width / this.height, o2, this.farZ), this.fogMatrix[8] = 2 * -t4.x / this.width, this.fogMatrix[9] = 2 * t4.y / this.height, e.K(this.fogMatrix, this.fogMatrix, [1, -1, 1]), e.J(this.fogMatrix, this.fogMatrix, [0, 0, -this.cameraToCenterDistance]), e.b7(this.fogMatrix, this.fogMatrix, this._pitch), e.ad(this.fogMatrix, this.fogMatrix, this.angle), e.J(this.fogMatrix, this.fogMatrix, [-i2, -a2, 0]), e.K(this.fogMatrix, this.fogMatrix, [1, 1, this._pixelPerMeter]), e.J(this.fogMatrix, this.fogMatrix, [0, 0, -this.elevation]), this.pixelMatrix3D = e.L(new Float64Array(16), this.labelPlaneMatrix, s2);\n const f2 = this.width % 2 / 2, g2 = this.height % 2 / 2, v2 = Math.cos(this.angle), x2 = Math.sin(this.angle), y2 = i2 - Math.round(i2) + v2 * f2 + x2 * g2, b2 = a2 - Math.round(a2) + v2 * g2 + x2 * f2, w2 = new Float64Array(s2);\n if (e.J(w2, w2, [y2 > 0.5 ? y2 - 1 : y2, b2 > 0.5 ? b2 - 1 : b2, 0]), this.alignedModelViewProjectionMatrix = w2, s2 = e.as(new Float64Array(16), this.pixelMatrix), !s2) throw new Error(\"failed to invert matrix\");\n this.pixelMatrixInverse = s2, this._posMatrixCache = {}, this._alignedPosMatrixCache = {}, this._fogMatrixCache = {};\n }\n maxPitchScaleFactor() {\n if (!this.pixelMatrixInverse) return 1;\n const t4 = this.pointCoordinate(new e.P(0, 0)), i2 = [t4.x * this.worldSize, t4.y * this.worldSize, 0, 1];\n return e.af(i2, i2, this.pixelMatrix)[3] / this.cameraToCenterDistance;\n }\n getCameraPoint() {\n const t4 = Math.tan(this._pitch) * (this.cameraToCenterDistance || 1);\n return this.centerPoint.add(new e.P(0, t4));\n }\n getCameraQueryGeometry(t4) {\n const i2 = this.getCameraPoint();\n if (1 === t4.length) return [t4[0], i2];\n {\n let a2 = i2.x, s2 = i2.y, o2 = i2.x, r2 = i2.y;\n for (const e2 of t4) a2 = Math.min(a2, e2.x), s2 = Math.min(s2, e2.y), o2 = Math.max(o2, e2.x), r2 = Math.max(r2, e2.y);\n return [new e.P(a2, s2), new e.P(o2, s2), new e.P(o2, r2), new e.P(a2, r2), new e.P(a2, s2)];\n }\n }\n lngLatToCameraDepth(t4, i2) {\n const a2 = this.locationCoordinate(t4), s2 = [a2.x * this.worldSize, a2.y * this.worldSize, i2, 1];\n return e.af(s2, s2, this.modelViewProjectionMatrix), s2[2] / s2[3];\n }\n }\n function Ia(t4, e2) {\n let i2, a2 = false, s2 = null, o2 = null;\n const r2 = () => {\n s2 = null, a2 && (t4.apply(o2, i2), s2 = setTimeout(r2, e2), a2 = false);\n };\n return (...t5) => (a2 = true, o2 = this, i2 = t5, s2 || r2(), s2);\n }\n class Ea {\n constructor(t4) {\n this._getCurrentHash = () => {\n const t5 = window.location.hash.replace(\"#\", \"\");\n if (this._hashName) {\n let e2;\n return t5.split(\"&\").map((t6) => t6.split(\"=\")).forEach((t6) => {\n t6[0] === this._hashName && (e2 = t6);\n }), (e2 && e2[1] || \"\").split(\"/\");\n }\n return t5.split(\"/\");\n }, this._onHashChange = () => {\n const t5 = this._getCurrentHash();\n if (t5.length >= 3 && !t5.some((t6) => isNaN(t6))) {\n const e2 = this._map.dragRotate.isEnabled() && this._map.touchZoomRotate.isEnabled() ? +(t5[3] || 0) : this._map.getBearing();\n return this._map.jumpTo({ center: [+t5[2], +t5[1]], zoom: +t5[0], bearing: e2, pitch: +(t5[4] || 0) }), true;\n }\n return false;\n }, this._updateHashUnthrottled = () => {\n const t5 = window.location.href.replace(/(#.*)?$/, this.getHashString());\n window.history.replaceState(window.history.state, null, t5);\n }, this._removeHash = () => {\n const t5 = this._getCurrentHash();\n if (0 === t5.length) return;\n const e2 = t5.join(\"/\");\n let i2 = e2;\n i2.split(\"&\").length > 0 && (i2 = i2.split(\"&\")[0]), this._hashName && (i2 = `${this._hashName}=${e2}`);\n let a2 = window.location.hash.replace(i2, \"\");\n a2.startsWith(\"#&\") ? a2 = a2.slice(0, 1) + a2.slice(2) : \"#\" === a2 && (a2 = \"\");\n let s2 = window.location.href.replace(/(#.+)?$/, a2);\n s2 = s2.replace(\"&&\", \"&\"), window.history.replaceState(window.history.state, null, s2);\n }, this._updateHash = Ia(this._updateHashUnthrottled, 300), this._hashName = t4 && encodeURIComponent(t4);\n }\n addTo(t4) {\n return this._map = t4, addEventListener(\"hashchange\", this._onHashChange, false), this._map.on(\"moveend\", this._updateHash), this;\n }\n remove() {\n return removeEventListener(\"hashchange\", this._onHashChange, false), this._map.off(\"moveend\", this._updateHash), clearTimeout(this._updateHash()), this._removeHash(), delete this._map, this;\n }\n getHashString(t4) {\n const e2 = this._map.getCenter(), i2 = Math.round(100 * this._map.getZoom()) / 100, a2 = Math.ceil((i2 * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10), s2 = Math.pow(10, a2), o2 = Math.round(e2.lng * s2) / s2, r2 = Math.round(e2.lat * s2) / s2, n2 = this._map.getBearing(), l2 = this._map.getPitch();\n let h2 = \"\";\n if (h2 += t4 ? `/${o2}/${r2}/${i2}` : `${i2}/${r2}/${o2}`, (n2 || l2) && (h2 += \"/\" + Math.round(10 * n2) / 10), l2 && (h2 += `/${Math.round(l2)}`), this._hashName) {\n const t5 = this._hashName;\n let e3 = false;\n const i3 = window.location.hash.slice(1).split(\"&\").map((i4) => {\n const a3 = i4.split(\"=\")[0];\n return a3 === t5 ? (e3 = true, `${a3}=${h2}`) : i4;\n }).filter((t6) => t6);\n return e3 || i3.push(`${t5}=${h2}`), `#${i3.join(\"&\")}`;\n }\n return `#${h2}`;\n }\n }\n const Pa = { linearity: 0.3, easing: e.b8(0, 0, 0.3, 1) }, Ca = e.e({ deceleration: 2500, maxSpeed: 1400 }, Pa), Sa = e.e({ deceleration: 20, maxSpeed: 1400 }, Pa), za = e.e({ deceleration: 1e3, maxSpeed: 360 }, Pa), Da = e.e({ deceleration: 1e3, maxSpeed: 90 }, Pa);\n class Ma {\n constructor(t4) {\n this._map = t4, this.clear();\n }\n clear() {\n this._inertiaBuffer = [];\n }\n record(t4) {\n this._drainInertiaBuffer(), this._inertiaBuffer.push({ time: o.now(), settings: t4 });\n }\n _drainInertiaBuffer() {\n const t4 = this._inertiaBuffer, e2 = o.now();\n for (; t4.length > 0 && e2 - t4[0].time > 160; ) t4.shift();\n }\n _onMoveEnd(t4) {\n if (this._drainInertiaBuffer(), this._inertiaBuffer.length < 2) return;\n const i2 = { zoom: 0, bearing: 0, pitch: 0, pan: new e.P(0, 0), pinchAround: void 0, around: void 0 };\n for (const { settings: t5 } of this._inertiaBuffer) i2.zoom += t5.zoomDelta || 0, i2.bearing += t5.bearingDelta || 0, i2.pitch += t5.pitchDelta || 0, t5.panDelta && i2.pan._add(t5.panDelta), t5.around && (i2.around = t5.around), t5.pinchAround && (i2.pinchAround = t5.pinchAround);\n const a2 = this._inertiaBuffer[this._inertiaBuffer.length - 1].time - this._inertiaBuffer[0].time, s2 = {};\n if (i2.pan.mag()) {\n const o2 = Ra(i2.pan.mag(), a2, e.e({}, Ca, t4 || {}));\n s2.offset = i2.pan.mult(o2.amount / i2.pan.mag()), s2.center = this._map.transform.center, Aa(s2, o2);\n }\n if (i2.zoom) {\n const t5 = Ra(i2.zoom, a2, Sa);\n s2.zoom = this._map.transform.zoom + t5.amount, Aa(s2, t5);\n }\n if (i2.bearing) {\n const t5 = Ra(i2.bearing, a2, za);\n s2.bearing = this._map.transform.bearing + e.ac(t5.amount, -179, 179), Aa(s2, t5);\n }\n if (i2.pitch) {\n const t5 = Ra(i2.pitch, a2, Da);\n s2.pitch = this._map.transform.pitch + t5.amount, Aa(s2, t5);\n }\n if (s2.zoom || s2.bearing) {\n const t5 = void 0 === i2.pinchAround ? i2.around : i2.pinchAround;\n s2.around = t5 ? this._map.unproject(t5) : this._map.getCenter();\n }\n return this.clear(), e.e(s2, { noMoveStart: true });\n }\n }\n function Aa(t4, e2) {\n (!t4.duration || t4.duration < e2.duration) && (t4.duration = e2.duration, t4.easing = e2.easing);\n }\n function Ra(t4, i2, a2) {\n const { maxSpeed: s2, linearity: o2, deceleration: r2 } = a2, n2 = e.ac(t4 * o2 / (i2 / 1e3), -s2, s2), l2 = Math.abs(n2) / (r2 * o2);\n return { easing: a2.easing, duration: 1e3 * l2, amount: n2 * (l2 / 2) };\n }\n class ka extends e.k {\n preventDefault() {\n this._defaultPrevented = true;\n }\n get defaultPrevented() {\n return this._defaultPrevented;\n }\n constructor(t4, i2, a2, s2 = {}) {\n const o2 = r.mousePos(i2.getCanvas(), a2), n2 = i2.unproject(o2);\n super(t4, e.e({ point: o2, lngLat: n2, originalEvent: a2 }, s2)), this._defaultPrevented = false, this.target = i2;\n }\n }\n class La extends e.k {\n preventDefault() {\n this._defaultPrevented = true;\n }\n get defaultPrevented() {\n return this._defaultPrevented;\n }\n constructor(t4, i2, a2) {\n const s2 = \"touchend\" === t4 ? a2.changedTouches : a2.touches, o2 = r.touchPos(i2.getCanvasContainer(), s2), n2 = o2.map((t5) => i2.unproject(t5)), l2 = o2.reduce((t5, e2, i3, a3) => t5.add(e2.div(a3.length)), new e.P(0, 0));\n super(t4, { points: o2, point: l2, lngLats: n2, lngLat: i2.unproject(l2), originalEvent: a2 }), this._defaultPrevented = false;\n }\n }\n class Fa extends e.k {\n preventDefault() {\n this._defaultPrevented = true;\n }\n get defaultPrevented() {\n return this._defaultPrevented;\n }\n constructor(t4, e2, i2) {\n super(t4, { originalEvent: i2 }), this._defaultPrevented = false;\n }\n }\n class Ba {\n constructor(t4, e2) {\n this._map = t4, this._clickTolerance = e2.clickTolerance;\n }\n reset() {\n delete this._mousedownPos;\n }\n wheel(t4) {\n return this._firePreventable(new Fa(t4.type, this._map, t4));\n }\n mousedown(t4, e2) {\n return this._mousedownPos = e2, this._firePreventable(new ka(t4.type, this._map, t4));\n }\n mouseup(t4) {\n this._map.fire(new ka(t4.type, this._map, t4));\n }\n click(t4, e2) {\n this._mousedownPos && this._mousedownPos.dist(e2) >= this._clickTolerance || this._map.fire(new ka(t4.type, this._map, t4));\n }\n dblclick(t4) {\n return this._firePreventable(new ka(t4.type, this._map, t4));\n }\n mouseover(t4) {\n this._map.fire(new ka(t4.type, this._map, t4));\n }\n mouseout(t4) {\n this._map.fire(new ka(t4.type, this._map, t4));\n }\n touchstart(t4) {\n return this._firePreventable(new La(t4.type, this._map, t4));\n }\n touchmove(t4) {\n this._map.fire(new La(t4.type, this._map, t4));\n }\n touchend(t4) {\n this._map.fire(new La(t4.type, this._map, t4));\n }\n touchcancel(t4) {\n this._map.fire(new La(t4.type, this._map, t4));\n }\n _firePreventable(t4) {\n if (this._map.fire(t4), t4.defaultPrevented) return {};\n }\n isEnabled() {\n return true;\n }\n isActive() {\n return false;\n }\n enable() {\n }\n disable() {\n }\n }\n class Oa {\n constructor(t4) {\n this._map = t4;\n }\n reset() {\n this._delayContextMenu = false, this._ignoreContextMenu = true, delete this._contextMenuEvent;\n }\n mousemove(t4) {\n this._map.fire(new ka(t4.type, this._map, t4));\n }\n mousedown() {\n this._delayContextMenu = true, this._ignoreContextMenu = false;\n }\n mouseup() {\n this._delayContextMenu = false, this._contextMenuEvent && (this._map.fire(new ka(\"contextmenu\", this._map, this._contextMenuEvent)), delete this._contextMenuEvent);\n }\n contextmenu(t4) {\n this._delayContextMenu ? this._contextMenuEvent = t4 : this._ignoreContextMenu || this._map.fire(new ka(t4.type, this._map, t4)), this._map.listens(\"contextmenu\") && t4.preventDefault();\n }\n isEnabled() {\n return true;\n }\n isActive() {\n return false;\n }\n enable() {\n }\n disable() {\n }\n }\n class Na {\n constructor(t4) {\n this._map = t4;\n }\n get transform() {\n return this._map._requestedCameraState || this._map.transform;\n }\n get center() {\n return { lng: this.transform.center.lng, lat: this.transform.center.lat };\n }\n get zoom() {\n return this.transform.zoom;\n }\n get pitch() {\n return this.transform.pitch;\n }\n get bearing() {\n return this.transform.bearing;\n }\n unproject(t4) {\n return this.transform.pointLocation(e.P.convert(t4), this._map.terrain);\n }\n }\n class Ua {\n constructor(t4, e2) {\n this._map = t4, this._tr = new Na(t4), this._el = t4.getCanvasContainer(), this._container = t4.getContainer(), this._clickTolerance = e2.clickTolerance || 1;\n }\n isEnabled() {\n return !!this._enabled;\n }\n isActive() {\n return !!this._active;\n }\n enable() {\n this.isEnabled() || (this._enabled = true);\n }\n disable() {\n this.isEnabled() && (this._enabled = false);\n }\n mousedown(t4, e2) {\n this.isEnabled() && t4.shiftKey && 0 === t4.button && (r.disableDrag(), this._startPos = this._lastPos = e2, this._active = true);\n }\n mousemoveWindow(t4, e2) {\n if (!this._active) return;\n const i2 = e2;\n if (this._lastPos.equals(i2) || !this._box && i2.dist(this._startPos) < this._clickTolerance) return;\n const a2 = this._startPos;\n this._lastPos = i2, this._box || (this._box = r.create(\"div\", \"maplibregl-boxzoom\", this._container), this._container.classList.add(\"maplibregl-crosshair\"), this._fireEvent(\"boxzoomstart\", t4));\n const s2 = Math.min(a2.x, i2.x), o2 = Math.max(a2.x, i2.x), n2 = Math.min(a2.y, i2.y), l2 = Math.max(a2.y, i2.y);\n r.setTransform(this._box, `translate(${s2}px,${n2}px)`), this._box.style.width = o2 - s2 + \"px\", this._box.style.height = l2 - n2 + \"px\";\n }\n mouseupWindow(t4, i2) {\n if (!this._active) return;\n if (0 !== t4.button) return;\n const a2 = this._startPos, s2 = i2;\n if (this.reset(), r.suppressClick(), a2.x !== s2.x || a2.y !== s2.y) return this._map.fire(new e.k(\"boxzoomend\", { originalEvent: t4 })), { cameraAnimation: (t5) => t5.fitScreenCoordinates(a2, s2, this._tr.bearing, { linear: true }) };\n this._fireEvent(\"boxzoomcancel\", t4);\n }\n keydown(t4) {\n this._active && 27 === t4.keyCode && (this.reset(), this._fireEvent(\"boxzoomcancel\", t4));\n }\n reset() {\n this._active = false, this._container.classList.remove(\"maplibregl-crosshair\"), this._box && (r.remove(this._box), this._box = null), r.enableDrag(), delete this._startPos, delete this._lastPos;\n }\n _fireEvent(t4, i2) {\n return this._map.fire(new e.k(t4, { originalEvent: i2 }));\n }\n }\n function ja(t4, e2) {\n if (t4.length !== e2.length) throw new Error(`The number of touches and points are not equal - touches ${t4.length}, points ${e2.length}`);\n const i2 = {};\n for (let a2 = 0; a2 < t4.length; a2++) i2[t4[a2].identifier] = e2[a2];\n return i2;\n }\n class Za {\n constructor(t4) {\n this.reset(), this.numTouches = t4.numTouches;\n }\n reset() {\n delete this.centroid, delete this.startTime, delete this.touches, this.aborted = false;\n }\n touchstart(t4, i2, a2) {\n (this.centroid || a2.length > this.numTouches) && (this.aborted = true), this.aborted || (void 0 === this.startTime && (this.startTime = t4.timeStamp), a2.length === this.numTouches && (this.centroid = function(t5) {\n const i3 = new e.P(0, 0);\n for (const e2 of t5) i3._add(e2);\n return i3.div(t5.length);\n }(i2), this.touches = ja(a2, i2)));\n }\n touchmove(t4, e2, i2) {\n if (this.aborted || !this.centroid) return;\n const a2 = ja(i2, e2);\n for (const t5 in this.touches) {\n const e3 = a2[t5];\n (!e3 || e3.dist(this.touches[t5]) > 30) && (this.aborted = true);\n }\n }\n touchend(t4, e2, i2) {\n if ((!this.centroid || t4.timeStamp - this.startTime > 500) && (this.aborted = true), 0 === i2.length) {\n const t5 = !this.aborted && this.centroid;\n if (this.reset(), t5) return t5;\n }\n }\n }\n class qa {\n constructor(t4) {\n this.singleTap = new Za(t4), this.numTaps = t4.numTaps, this.reset();\n }\n reset() {\n this.lastTime = 1 / 0, delete this.lastTap, this.count = 0, this.singleTap.reset();\n }\n touchstart(t4, e2, i2) {\n this.singleTap.touchstart(t4, e2, i2);\n }\n touchmove(t4, e2, i2) {\n this.singleTap.touchmove(t4, e2, i2);\n }\n touchend(t4, e2, i2) {\n const a2 = this.singleTap.touchend(t4, e2, i2);\n if (a2) {\n const e3 = t4.timeStamp - this.lastTime < 500, i3 = !this.lastTap || this.lastTap.dist(a2) < 30;\n if (e3 && i3 || this.reset(), this.count++, this.lastTime = t4.timeStamp, this.lastTap = a2, this.count === this.numTaps) return this.reset(), a2;\n }\n }\n }\n class Va {\n constructor(t4) {\n this._tr = new Na(t4), this._zoomIn = new qa({ numTouches: 1, numTaps: 2 }), this._zoomOut = new qa({ numTouches: 2, numTaps: 1 }), this.reset();\n }\n reset() {\n this._active = false, this._zoomIn.reset(), this._zoomOut.reset();\n }\n touchstart(t4, e2, i2) {\n this._zoomIn.touchstart(t4, e2, i2), this._zoomOut.touchstart(t4, e2, i2);\n }\n touchmove(t4, e2, i2) {\n this._zoomIn.touchmove(t4, e2, i2), this._zoomOut.touchmove(t4, e2, i2);\n }\n touchend(t4, e2, i2) {\n const a2 = this._zoomIn.touchend(t4, e2, i2), s2 = this._zoomOut.touchend(t4, e2, i2), o2 = this._tr;\n return a2 ? (this._active = true, t4.preventDefault(), setTimeout(() => this.reset(), 0), { cameraAnimation: (e3) => e3.easeTo({ duration: 300, zoom: o2.zoom + 1, around: o2.unproject(a2) }, { originalEvent: t4 }) }) : s2 ? (this._active = true, t4.preventDefault(), setTimeout(() => this.reset(), 0), { cameraAnimation: (e3) => e3.easeTo({ duration: 300, zoom: o2.zoom - 1, around: o2.unproject(s2) }, { originalEvent: t4 }) }) : void 0;\n }\n touchcancel() {\n this.reset();\n }\n enable() {\n this._enabled = true;\n }\n disable() {\n this._enabled = false, this.reset();\n }\n isEnabled() {\n return this._enabled;\n }\n isActive() {\n return this._active;\n }\n }\n class Ga {\n constructor(t4) {\n this._enabled = !!t4.enable, this._moveStateManager = t4.moveStateManager, this._clickTolerance = t4.clickTolerance || 1, this._moveFunction = t4.move, this._activateOnStart = !!t4.activateOnStart, t4.assignEvents(this), this.reset();\n }\n reset(t4) {\n this._active = false, this._moved = false, delete this._lastPoint, this._moveStateManager.endMove(t4);\n }\n _move(...t4) {\n const e2 = this._moveFunction(...t4);\n if (e2.bearingDelta || e2.pitchDelta || e2.around || e2.panDelta) return this._active = true, e2;\n }\n dragStart(t4, e2) {\n this.isEnabled() && !this._lastPoint && this._moveStateManager.isValidStartEvent(t4) && (this._moveStateManager.startMove(t4), this._lastPoint = e2.length ? e2[0] : e2, this._activateOnStart && this._lastPoint && (this._active = true));\n }\n dragMove(t4, e2) {\n if (!this.isEnabled()) return;\n const i2 = this._lastPoint;\n if (!i2) return;\n if (t4.preventDefault(), !this._moveStateManager.isValidMoveEvent(t4)) return void this.reset(t4);\n const a2 = e2.length ? e2[0] : e2;\n return !this._moved && a2.dist(i2) < this._clickTolerance ? void 0 : (this._moved = true, this._lastPoint = a2, this._move(i2, a2));\n }\n dragEnd(t4) {\n this.isEnabled() && this._lastPoint && this._moveStateManager.isValidEndEvent(t4) && (this._moved && r.suppressClick(), this.reset(t4));\n }\n enable() {\n this._enabled = true;\n }\n disable() {\n this._enabled = false, this.reset();\n }\n isEnabled() {\n return this._enabled;\n }\n isActive() {\n return this._active;\n }\n getClickTolerance() {\n return this._clickTolerance;\n }\n }\n const Ha = { 0: 1, 2: 2 };\n class Wa {\n constructor(t4) {\n this._correctEvent = t4.checkCorrectEvent;\n }\n startMove(t4) {\n const e2 = r.mouseButton(t4);\n this._eventButton = e2;\n }\n endMove(t4) {\n delete this._eventButton;\n }\n isValidStartEvent(t4) {\n return this._correctEvent(t4);\n }\n isValidMoveEvent(t4) {\n return !function(t5, e2) {\n const i2 = Ha[e2];\n return void 0 === t5.buttons || (t5.buttons & i2) !== i2;\n }(t4, this._eventButton);\n }\n isValidEndEvent(t4) {\n return r.mouseButton(t4) === this._eventButton;\n }\n }\n class $a {\n constructor() {\n this._firstTouch = void 0;\n }\n _isOneFingerTouch(t4) {\n return 1 === t4.targetTouches.length;\n }\n _isSameTouchEvent(t4) {\n return t4.targetTouches[0].identifier === this._firstTouch;\n }\n startMove(t4) {\n this._firstTouch = t4.targetTouches[0].identifier;\n }\n endMove(t4) {\n delete this._firstTouch;\n }\n isValidStartEvent(t4) {\n return this._isOneFingerTouch(t4);\n }\n isValidMoveEvent(t4) {\n return this._isOneFingerTouch(t4) && this._isSameTouchEvent(t4);\n }\n isValidEndEvent(t4) {\n return this._isOneFingerTouch(t4) && this._isSameTouchEvent(t4);\n }\n }\n const Xa = (t4) => {\n t4.mousedown = t4.dragStart, t4.mousemoveWindow = t4.dragMove, t4.mouseup = t4.dragEnd, t4.contextmenu = (t5) => {\n t5.preventDefault();\n };\n }, Ka = ({ enable: t4, clickTolerance: e2, bearingDegreesPerPixelMoved: i2 = 0.8 }) => {\n const a2 = new Wa({ checkCorrectEvent: (t5) => 0 === r.mouseButton(t5) && t5.ctrlKey || 2 === r.mouseButton(t5) });\n return new Ga({ clickTolerance: e2, move: (t5, e3) => ({ bearingDelta: (e3.x - t5.x) * i2 }), moveStateManager: a2, enable: t4, assignEvents: Xa });\n }, Ja = ({ enable: t4, clickTolerance: e2, pitchDegreesPerPixelMoved: i2 = -0.5 }) => {\n const a2 = new Wa({ checkCorrectEvent: (t5) => 0 === r.mouseButton(t5) && t5.ctrlKey || 2 === r.mouseButton(t5) });\n return new Ga({ clickTolerance: e2, move: (t5, e3) => ({ pitchDelta: (e3.y - t5.y) * i2 }), moveStateManager: a2, enable: t4, assignEvents: Xa });\n };\n class Ya {\n constructor(t4, e2) {\n this._clickTolerance = t4.clickTolerance || 1, this._map = e2, this.reset();\n }\n reset() {\n this._active = false, this._touches = {}, this._sum = new e.P(0, 0);\n }\n _shouldBePrevented(t4) {\n return t4 < (this._map.cooperativeGestures.isEnabled() ? 2 : 1);\n }\n touchstart(t4, e2, i2) {\n return this._calculateTransform(t4, e2, i2);\n }\n touchmove(t4, e2, i2) {\n if (this._active) {\n if (!this._shouldBePrevented(i2.length)) return t4.preventDefault(), this._calculateTransform(t4, e2, i2);\n this._map.cooperativeGestures.notifyGestureBlocked(\"touch_pan\", t4);\n }\n }\n touchend(t4, e2, i2) {\n this._calculateTransform(t4, e2, i2), this._active && this._shouldBePrevented(i2.length) && this.reset();\n }\n touchcancel() {\n this.reset();\n }\n _calculateTransform(t4, i2, a2) {\n a2.length > 0 && (this._active = true);\n const s2 = ja(a2, i2), o2 = new e.P(0, 0), r2 = new e.P(0, 0);\n let n2 = 0;\n for (const t5 in s2) {\n const e2 = s2[t5], i3 = this._touches[t5];\n i3 && (o2._add(e2), r2._add(e2.sub(i3)), n2++, s2[t5] = e2);\n }\n if (this._touches = s2, this._shouldBePrevented(n2) || !r2.mag()) return;\n const l2 = r2.div(n2);\n return this._sum._add(l2), this._sum.mag() < this._clickTolerance ? void 0 : { around: o2.div(n2), panDelta: l2 };\n }\n enable() {\n this._enabled = true;\n }\n disable() {\n this._enabled = false, this.reset();\n }\n isEnabled() {\n return this._enabled;\n }\n isActive() {\n return this._active;\n }\n }\n class Qa {\n constructor() {\n this.reset();\n }\n reset() {\n this._active = false, delete this._firstTwoTouches;\n }\n touchstart(t4, e2, i2) {\n this._firstTwoTouches || i2.length < 2 || (this._firstTwoTouches = [i2[0].identifier, i2[1].identifier], this._start([e2[0], e2[1]]));\n }\n touchmove(t4, e2, i2) {\n if (!this._firstTwoTouches) return;\n t4.preventDefault();\n const [a2, s2] = this._firstTwoTouches, o2 = ts(i2, e2, a2), r2 = ts(i2, e2, s2);\n if (!o2 || !r2) return;\n const n2 = this._aroundCenter ? null : o2.add(r2).div(2);\n return this._move([o2, r2], n2, t4);\n }\n touchend(t4, e2, i2) {\n if (!this._firstTwoTouches) return;\n const [a2, s2] = this._firstTwoTouches, o2 = ts(i2, e2, a2), n2 = ts(i2, e2, s2);\n o2 && n2 || (this._active && r.suppressClick(), this.reset());\n }\n touchcancel() {\n this.reset();\n }\n enable(t4) {\n this._enabled = true, this._aroundCenter = !!t4 && \"center\" === t4.around;\n }\n disable() {\n this._enabled = false, this.reset();\n }\n isEnabled() {\n return !!this._enabled;\n }\n isActive() {\n return !!this._active;\n }\n }\n function ts(t4, e2, i2) {\n for (let a2 = 0; a2 < t4.length; a2++) if (t4[a2].identifier === i2) return e2[a2];\n }\n function es(t4, e2) {\n return Math.log(t4 / e2) / Math.LN2;\n }\n class is extends Qa {\n reset() {\n super.reset(), delete this._distance, delete this._startDistance;\n }\n _start(t4) {\n this._startDistance = this._distance = t4[0].dist(t4[1]);\n }\n _move(t4, e2) {\n const i2 = this._distance;\n if (this._distance = t4[0].dist(t4[1]), this._active || !(Math.abs(es(this._distance, this._startDistance)) < 0.1)) return this._active = true, { zoomDelta: es(this._distance, i2), pinchAround: e2 };\n }\n }\n function as(t4, e2) {\n return 180 * t4.angleWith(e2) / Math.PI;\n }\n class ss extends Qa {\n reset() {\n super.reset(), delete this._minDiameter, delete this._startVector, delete this._vector;\n }\n _start(t4) {\n this._startVector = this._vector = t4[0].sub(t4[1]), this._minDiameter = t4[0].dist(t4[1]);\n }\n _move(t4, e2, i2) {\n const a2 = this._vector;\n if (this._vector = t4[0].sub(t4[1]), this._active || !this._isBelowThreshold(this._vector)) return this._active = true, { bearingDelta: as(this._vector, a2), pinchAround: e2 };\n }\n _isBelowThreshold(t4) {\n this._minDiameter = Math.min(this._minDiameter, t4.mag());\n const e2 = 25 / (Math.PI * this._minDiameter) * 360, i2 = as(t4, this._startVector);\n return Math.abs(i2) < e2;\n }\n }\n function os(t4) {\n return Math.abs(t4.y) > Math.abs(t4.x);\n }\n class rs extends Qa {\n constructor(t4) {\n super(), this._currentTouchCount = 0, this._map = t4;\n }\n reset() {\n super.reset(), this._valid = void 0, delete this._firstMove, delete this._lastPoints;\n }\n touchstart(t4, e2, i2) {\n super.touchstart(t4, e2, i2), this._currentTouchCount = i2.length;\n }\n _start(t4) {\n this._lastPoints = t4, os(t4[0].sub(t4[1])) && (this._valid = false);\n }\n _move(t4, e2, i2) {\n if (this._map.cooperativeGestures.isEnabled() && this._currentTouchCount < 3) return;\n const a2 = t4[0].sub(this._lastPoints[0]), s2 = t4[1].sub(this._lastPoints[1]);\n return this._valid = this.gestureBeginsVertically(a2, s2, i2.timeStamp), this._valid ? (this._lastPoints = t4, this._active = true, { pitchDelta: (a2.y + s2.y) / 2 * -0.5 }) : void 0;\n }\n gestureBeginsVertically(t4, e2, i2) {\n if (void 0 !== this._valid) return this._valid;\n const a2 = t4.mag() >= 2, s2 = e2.mag() >= 2;\n if (!a2 && !s2) return;\n if (!a2 || !s2) return void 0 === this._firstMove && (this._firstMove = i2), i2 - this._firstMove < 100 && void 0;\n const o2 = t4.y > 0 == e2.y > 0;\n return os(t4) && os(e2) && o2;\n }\n }\n const ns = { panStep: 100, bearingStep: 15, pitchStep: 10 };\n class ls {\n constructor(t4) {\n this._tr = new Na(t4);\n const e2 = ns;\n this._panStep = e2.panStep, this._bearingStep = e2.bearingStep, this._pitchStep = e2.pitchStep, this._rotationDisabled = false;\n }\n reset() {\n this._active = false;\n }\n keydown(t4) {\n if (t4.altKey || t4.ctrlKey || t4.metaKey) return;\n let e2 = 0, i2 = 0, a2 = 0, s2 = 0, o2 = 0;\n switch (t4.keyCode) {\n case 61:\n case 107:\n case 171:\n case 187:\n e2 = 1;\n break;\n case 189:\n case 109:\n case 173:\n e2 = -1;\n break;\n case 37:\n t4.shiftKey ? i2 = -1 : (t4.preventDefault(), s2 = -1);\n break;\n case 39:\n t4.shiftKey ? i2 = 1 : (t4.preventDefault(), s2 = 1);\n break;\n case 38:\n t4.shiftKey ? a2 = 1 : (t4.preventDefault(), o2 = -1);\n break;\n case 40:\n t4.shiftKey ? a2 = -1 : (t4.preventDefault(), o2 = 1);\n break;\n default:\n return;\n }\n return this._rotationDisabled && (i2 = 0, a2 = 0), { cameraAnimation: (r2) => {\n const n2 = this._tr;\n r2.easeTo({ duration: 300, easeId: \"keyboardHandler\", easing: hs, zoom: e2 ? Math.round(n2.zoom) + e2 * (t4.shiftKey ? 2 : 1) : n2.zoom, bearing: n2.bearing + i2 * this._bearingStep, pitch: n2.pitch + a2 * this._pitchStep, offset: [-s2 * this._panStep, -o2 * this._panStep], center: n2.center }, { originalEvent: t4 });\n } };\n }\n enable() {\n this._enabled = true;\n }\n disable() {\n this._enabled = false, this.reset();\n }\n isEnabled() {\n return this._enabled;\n }\n isActive() {\n return this._active;\n }\n disableRotation() {\n this._rotationDisabled = true;\n }\n enableRotation() {\n this._rotationDisabled = false;\n }\n }\n function hs(t4) {\n return t4 * (2 - t4);\n }\n const cs = 4.000244140625;\n class us {\n constructor(t4, e2) {\n this._onTimeout = (t5) => {\n this._type = \"wheel\", this._delta -= this._lastValue, this._active || this._start(t5);\n }, this._map = t4, this._tr = new Na(t4), this._triggerRenderFrame = e2, this._delta = 0, this._defaultZoomRate = 0.01, this._wheelZoomRate = 0.0022222222222222222;\n }\n setZoomRate(t4) {\n this._defaultZoomRate = t4;\n }\n setWheelZoomRate(t4) {\n this._wheelZoomRate = t4;\n }\n isEnabled() {\n return !!this._enabled;\n }\n isActive() {\n return !!this._active || void 0 !== this._finishTimeout;\n }\n isZooming() {\n return !!this._zooming;\n }\n enable(t4) {\n this.isEnabled() || (this._enabled = true, this._aroundCenter = !!t4 && \"center\" === t4.around);\n }\n disable() {\n this.isEnabled() && (this._enabled = false);\n }\n _shouldBePrevented(t4) {\n return !!this._map.cooperativeGestures.isEnabled() && !(t4.ctrlKey || this._map.cooperativeGestures.isBypassed(t4));\n }\n wheel(t4) {\n if (!this.isEnabled()) return;\n if (this._shouldBePrevented(t4)) return void this._map.cooperativeGestures.notifyGestureBlocked(\"wheel_zoom\", t4);\n let e2 = t4.deltaMode === WheelEvent.DOM_DELTA_LINE ? 40 * t4.deltaY : t4.deltaY;\n const i2 = o.now(), a2 = i2 - (this._lastWheelEventTime || 0);\n this._lastWheelEventTime = i2, 0 !== e2 && e2 % cs == 0 ? this._type = \"wheel\" : 0 !== e2 && Math.abs(e2) < 4 ? this._type = \"trackpad\" : a2 > 400 ? (this._type = null, this._lastValue = e2, this._timeout = setTimeout(this._onTimeout, 40, t4)) : this._type || (this._type = Math.abs(a2 * e2) < 200 ? \"trackpad\" : \"wheel\", this._timeout && (clearTimeout(this._timeout), this._timeout = null, e2 += this._lastValue)), t4.shiftKey && e2 && (e2 /= 4), this._type && (this._lastWheelEvent = t4, this._delta -= e2, this._active || this._start(t4)), t4.preventDefault();\n }\n _start(t4) {\n if (!this._delta) return;\n this._frameId && (this._frameId = null), this._active = true, this.isZooming() || (this._zooming = true), this._finishTimeout && (clearTimeout(this._finishTimeout), delete this._finishTimeout);\n const i2 = r.mousePos(this._map.getCanvas(), t4), a2 = this._tr;\n this._around = i2.y > a2.transform.height / 2 - a2.transform.getHorizon() ? e.N.convert(this._aroundCenter ? a2.center : a2.unproject(i2)) : e.N.convert(a2.center), this._aroundPoint = a2.transform.locationPoint(this._around), this._frameId || (this._frameId = true, this._triggerRenderFrame());\n }\n renderFrame() {\n if (!this._frameId) return;\n if (this._frameId = null, !this.isActive()) return;\n const t4 = this._tr.transform;\n if (0 !== this._delta) {\n const e2 = \"wheel\" === this._type && Math.abs(this._delta) > cs ? this._wheelZoomRate : this._defaultZoomRate;\n let i3 = 2 / (1 + Math.exp(-Math.abs(this._delta * e2)));\n this._delta < 0 && 0 !== i3 && (i3 = 1 / i3);\n const a3 = \"number\" == typeof this._targetZoom ? t4.zoomScale(this._targetZoom) : t4.scale;\n this._targetZoom = Math.min(t4.maxZoom, Math.max(t4.minZoom, t4.scaleZoom(a3 * i3))), \"wheel\" === this._type && (this._startZoom = t4.zoom, this._easing = this._smoothOutEasing(200)), this._delta = 0;\n }\n const i2 = \"number\" == typeof this._targetZoom ? this._targetZoom : t4.zoom, a2 = this._startZoom, s2 = this._easing;\n let r2, n2 = false;\n const l2 = o.now() - this._lastWheelEventTime;\n if (\"wheel\" === this._type && a2 && s2 && l2) {\n const t5 = Math.min(l2 / 200, 1), o2 = s2(t5);\n r2 = e.y.number(a2, i2, o2), t5 < 1 ? this._frameId || (this._frameId = true) : n2 = true;\n } else r2 = i2, n2 = true;\n return this._active = true, n2 && (this._active = false, this._finishTimeout = setTimeout(() => {\n this._zooming = false, this._triggerRenderFrame(), delete this._targetZoom, delete this._finishTimeout;\n }, 200)), { noInertia: true, needsRenderFrame: !n2, zoomDelta: r2 - t4.zoom, around: this._aroundPoint, originalEvent: this._lastWheelEvent };\n }\n _smoothOutEasing(t4) {\n let i2 = e.b9;\n if (this._prevEase) {\n const t5 = this._prevEase, a2 = (o.now() - t5.start) / t5.duration, s2 = t5.easing(a2 + 0.01) - t5.easing(a2), r2 = 0.27 / Math.sqrt(s2 * s2 + 1e-4) * 0.01, n2 = Math.sqrt(0.0729 - r2 * r2);\n i2 = e.b8(r2, n2, 0.25, 1);\n }\n return this._prevEase = { start: o.now(), duration: t4, easing: i2 }, i2;\n }\n reset() {\n this._active = false, this._zooming = false, delete this._targetZoom, this._finishTimeout && (clearTimeout(this._finishTimeout), delete this._finishTimeout);\n }\n }\n class ds {\n constructor(t4, e2) {\n this._clickZoom = t4, this._tapZoom = e2;\n }\n enable() {\n this._clickZoom.enable(), this._tapZoom.enable();\n }\n disable() {\n this._clickZoom.disable(), this._tapZoom.disable();\n }\n isEnabled() {\n return this._clickZoom.isEnabled() && this._tapZoom.isEnabled();\n }\n isActive() {\n return this._clickZoom.isActive() || this._tapZoom.isActive();\n }\n }\n class _s {\n constructor(t4) {\n this._tr = new Na(t4), this.reset();\n }\n reset() {\n this._active = false;\n }\n dblclick(t4, e2) {\n return t4.preventDefault(), { cameraAnimation: (i2) => {\n i2.easeTo({ duration: 300, zoom: this._tr.zoom + (t4.shiftKey ? -1 : 1), around: this._tr.unproject(e2) }, { originalEvent: t4 });\n } };\n }\n enable() {\n this._enabled = true;\n }\n disable() {\n this._enabled = false, this.reset();\n }\n isEnabled() {\n return this._enabled;\n }\n isActive() {\n return this._active;\n }\n }\n class ps {\n constructor() {\n this._tap = new qa({ numTouches: 1, numTaps: 1 }), this.reset();\n }\n reset() {\n this._active = false, delete this._swipePoint, delete this._swipeTouch, delete this._tapTime, delete this._tapPoint, this._tap.reset();\n }\n touchstart(t4, e2, i2) {\n if (!this._swipePoint) if (this._tapTime) {\n const a2 = e2[0], s2 = t4.timeStamp - this._tapTime < 500, o2 = this._tapPoint.dist(a2) < 30;\n s2 && o2 ? i2.length > 0 && (this._swipePoint = a2, this._swipeTouch = i2[0].identifier) : this.reset();\n } else this._tap.touchstart(t4, e2, i2);\n }\n touchmove(t4, e2, i2) {\n if (this._tapTime) {\n if (this._swipePoint) {\n if (i2[0].identifier !== this._swipeTouch) return;\n const a2 = e2[0], s2 = a2.y - this._swipePoint.y;\n return this._swipePoint = a2, t4.preventDefault(), this._active = true, { zoomDelta: s2 / 128 };\n }\n } else this._tap.touchmove(t4, e2, i2);\n }\n touchend(t4, e2, i2) {\n if (this._tapTime) this._swipePoint && 0 === i2.length && this.reset();\n else {\n const a2 = this._tap.touchend(t4, e2, i2);\n a2 && (this._tapTime = t4.timeStamp, this._tapPoint = a2);\n }\n }\n touchcancel() {\n this.reset();\n }\n enable() {\n this._enabled = true;\n }\n disable() {\n this._enabled = false, this.reset();\n }\n isEnabled() {\n return this._enabled;\n }\n isActive() {\n return this._active;\n }\n }\n class ms {\n constructor(t4, e2, i2) {\n this._el = t4, this._mousePan = e2, this._touchPan = i2;\n }\n enable(t4) {\n this._inertiaOptions = t4 || {}, this._mousePan.enable(), this._touchPan.enable(), this._el.classList.add(\"maplibregl-touch-drag-pan\");\n }\n disable() {\n this._mousePan.disable(), this._touchPan.disable(), this._el.classList.remove(\"maplibregl-touch-drag-pan\");\n }\n isEnabled() {\n return this._mousePan.isEnabled() && this._touchPan.isEnabled();\n }\n isActive() {\n return this._mousePan.isActive() || this._touchPan.isActive();\n }\n }\n class fs {\n constructor(t4, e2, i2) {\n this._pitchWithRotate = t4.pitchWithRotate, this._mouseRotate = e2, this._mousePitch = i2;\n }\n enable() {\n this._mouseRotate.enable(), this._pitchWithRotate && this._mousePitch.enable();\n }\n disable() {\n this._mouseRotate.disable(), this._mousePitch.disable();\n }\n isEnabled() {\n return this._mouseRotate.isEnabled() && (!this._pitchWithRotate || this._mousePitch.isEnabled());\n }\n isActive() {\n return this._mouseRotate.isActive() || this._mousePitch.isActive();\n }\n }\n class gs {\n constructor(t4, e2, i2, a2) {\n this._el = t4, this._touchZoom = e2, this._touchRotate = i2, this._tapDragZoom = a2, this._rotationDisabled = false, this._enabled = true;\n }\n enable(t4) {\n this._touchZoom.enable(t4), this._rotationDisabled || this._touchRotate.enable(t4), this._tapDragZoom.enable(), this._el.classList.add(\"maplibregl-touch-zoom-rotate\");\n }\n disable() {\n this._touchZoom.disable(), this._touchRotate.disable(), this._tapDragZoom.disable(), this._el.classList.remove(\"maplibregl-touch-zoom-rotate\");\n }\n isEnabled() {\n return this._touchZoom.isEnabled() && (this._rotationDisabled || this._touchRotate.isEnabled()) && this._tapDragZoom.isEnabled();\n }\n isActive() {\n return this._touchZoom.isActive() || this._touchRotate.isActive() || this._tapDragZoom.isActive();\n }\n disableRotation() {\n this._rotationDisabled = true, this._touchRotate.disable();\n }\n enableRotation() {\n this._rotationDisabled = false, this._touchZoom.isEnabled() && this._touchRotate.enable();\n }\n }\n class vs {\n constructor(t4, e2) {\n this._bypassKey = -1 !== navigator.userAgent.indexOf(\"Mac\") ? \"metaKey\" : \"ctrlKey\", this._map = t4, this._options = e2, this._enabled = false;\n }\n isActive() {\n return false;\n }\n reset() {\n }\n _setupUI() {\n if (this._container) return;\n const t4 = this._map.getCanvasContainer();\n t4.classList.add(\"maplibregl-cooperative-gestures\"), this._container = r.create(\"div\", \"maplibregl-cooperative-gesture-screen\", t4);\n let e2 = this._map._getUIString(\"CooperativeGesturesHandler.WindowsHelpText\");\n \"metaKey\" === this._bypassKey && (e2 = this._map._getUIString(\"CooperativeGesturesHandler.MacHelpText\"));\n const i2 = this._map._getUIString(\"CooperativeGesturesHandler.MobileHelpText\"), a2 = document.createElement(\"div\");\n a2.className = \"maplibregl-desktop-message\", a2.textContent = e2, this._container.appendChild(a2);\n const s2 = document.createElement(\"div\");\n s2.className = \"maplibregl-mobile-message\", s2.textContent = i2, this._container.appendChild(s2), this._container.setAttribute(\"aria-hidden\", \"true\");\n }\n _destroyUI() {\n this._container && (r.remove(this._container), this._map.getCanvasContainer().classList.remove(\"maplibregl-cooperative-gestures\")), delete this._container;\n }\n enable() {\n this._setupUI(), this._enabled = true;\n }\n disable() {\n this._enabled = false, this._destroyUI();\n }\n isEnabled() {\n return this._enabled;\n }\n isBypassed(t4) {\n return t4[this._bypassKey];\n }\n notifyGestureBlocked(t4, i2) {\n this._enabled && (this._map.fire(new e.k(\"cooperativegestureprevented\", { gestureType: t4, originalEvent: i2 })), this._container.classList.add(\"maplibregl-show\"), setTimeout(() => {\n this._container.classList.remove(\"maplibregl-show\");\n }, 100));\n }\n }\n const xs = (t4) => t4.zoom || t4.drag || t4.pitch || t4.rotate;\n class ys extends e.k {\n }\n function bs(t4) {\n return t4.panDelta && t4.panDelta.mag() || t4.zoomDelta || t4.bearingDelta || t4.pitchDelta;\n }\n class ws {\n constructor(t4, e2) {\n this.handleWindowEvent = (t5) => {\n this.handleEvent(t5, `${t5.type}Window`);\n }, this.handleEvent = (t5, e3) => {\n if (\"blur\" === t5.type) return void this.stop(true);\n this._updatingCamera = true;\n const i3 = \"renderFrame\" === t5.type ? void 0 : t5, a2 = { needsRenderFrame: false }, s2 = {}, o2 = {}, n2 = t5.touches, l2 = n2 ? this._getMapTouches(n2) : void 0, h2 = l2 ? r.touchPos(this._map.getCanvas(), l2) : r.mousePos(this._map.getCanvas(), t5);\n for (const { handlerName: r2, handler: n3, allowed: c3 } of this._handlers) {\n if (!n3.isEnabled()) continue;\n let u3;\n this._blockedByActive(o2, c3, r2) ? n3.reset() : n3[e3 || t5.type] && (u3 = n3[e3 || t5.type](t5, h2, l2), this.mergeHandlerResult(a2, s2, u3, r2, i3), u3 && u3.needsRenderFrame && this._triggerRenderFrame()), (u3 || n3.isActive()) && (o2[r2] = n3);\n }\n const c2 = {};\n for (const t6 in this._previousActiveHandlers) o2[t6] || (c2[t6] = i3);\n this._previousActiveHandlers = o2, (Object.keys(c2).length || bs(a2)) && (this._changes.push([a2, s2, c2]), this._triggerRenderFrame()), (Object.keys(o2).length || bs(a2)) && this._map._stop(true), this._updatingCamera = false;\n const { cameraAnimation: u2 } = a2;\n u2 && (this._inertia.clear(), this._fireEvents({}, {}, true), this._changes = [], u2(this._map));\n }, this._map = t4, this._el = this._map.getCanvasContainer(), this._handlers = [], this._handlersById = {}, this._changes = [], this._inertia = new Ma(t4), this._bearingSnap = e2.bearingSnap, this._previousActiveHandlers = {}, this._eventsInProgress = {}, this._addDefaultHandlers(e2);\n const i2 = this._el;\n this._listeners = [[i2, \"touchstart\", { passive: true }], [i2, \"touchmove\", { passive: false }], [i2, \"touchend\", void 0], [i2, \"touchcancel\", void 0], [i2, \"mousedown\", void 0], [i2, \"mousemove\", void 0], [i2, \"mouseup\", void 0], [document, \"mousemove\", { capture: true }], [document, \"mouseup\", void 0], [i2, \"mouseover\", void 0], [i2, \"mouseout\", void 0], [i2, \"dblclick\", void 0], [i2, \"click\", void 0], [i2, \"keydown\", { capture: false }], [i2, \"keyup\", void 0], [i2, \"wheel\", { passive: false }], [i2, \"contextmenu\", void 0], [window, \"blur\", void 0]];\n for (const [t5, e3, i3] of this._listeners) r.addEventListener(t5, e3, t5 === document ? this.handleWindowEvent : this.handleEvent, i3);\n }\n destroy() {\n for (const [t4, e2, i2] of this._listeners) r.removeEventListener(t4, e2, t4 === document ? this.handleWindowEvent : this.handleEvent, i2);\n }\n _addDefaultHandlers(t4) {\n const e2 = this._map, i2 = e2.getCanvasContainer();\n this._add(\"mapEvent\", new Ba(e2, t4));\n const a2 = e2.boxZoom = new Ua(e2, t4);\n this._add(\"boxZoom\", a2), t4.interactive && t4.boxZoom && a2.enable();\n const s2 = e2.cooperativeGestures = new vs(e2, t4.cooperativeGestures);\n this._add(\"cooperativeGestures\", s2), t4.cooperativeGestures && s2.enable();\n const o2 = new Va(e2), n2 = new _s(e2);\n e2.doubleClickZoom = new ds(n2, o2), this._add(\"tapZoom\", o2), this._add(\"clickZoom\", n2), t4.interactive && t4.doubleClickZoom && e2.doubleClickZoom.enable();\n const l2 = new ps();\n this._add(\"tapDragZoom\", l2);\n const h2 = e2.touchPitch = new rs(e2);\n this._add(\"touchPitch\", h2), t4.interactive && t4.touchPitch && e2.touchPitch.enable(t4.touchPitch);\n const c2 = Ka(t4), u2 = Ja(t4);\n e2.dragRotate = new fs(t4, c2, u2), this._add(\"mouseRotate\", c2, [\"mousePitch\"]), this._add(\"mousePitch\", u2, [\"mouseRotate\"]), t4.interactive && t4.dragRotate && e2.dragRotate.enable();\n const d2 = (({ enable: t5, clickTolerance: e3 }) => {\n const i3 = new Wa({ checkCorrectEvent: (t6) => 0 === r.mouseButton(t6) && !t6.ctrlKey });\n return new Ga({ clickTolerance: e3, move: (t6, e4) => ({ around: e4, panDelta: e4.sub(t6) }), activateOnStart: true, moveStateManager: i3, enable: t5, assignEvents: Xa });\n })(t4), _2 = new Ya(t4, e2);\n e2.dragPan = new ms(i2, d2, _2), this._add(\"mousePan\", d2), this._add(\"touchPan\", _2, [\"touchZoom\", \"touchRotate\"]), t4.interactive && t4.dragPan && e2.dragPan.enable(t4.dragPan);\n const p2 = new ss(), m2 = new is();\n e2.touchZoomRotate = new gs(i2, m2, p2, l2), this._add(\"touchRotate\", p2, [\"touchPan\", \"touchZoom\"]), this._add(\"touchZoom\", m2, [\"touchPan\", \"touchRotate\"]), t4.interactive && t4.touchZoomRotate && e2.touchZoomRotate.enable(t4.touchZoomRotate);\n const f2 = e2.scrollZoom = new us(e2, () => this._triggerRenderFrame());\n this._add(\"scrollZoom\", f2, [\"mousePan\"]), t4.interactive && t4.scrollZoom && e2.scrollZoom.enable(t4.scrollZoom);\n const g2 = e2.keyboard = new ls(e2);\n this._add(\"keyboard\", g2), t4.interactive && t4.keyboard && e2.keyboard.enable(), this._add(\"blockableMapEvent\", new Oa(e2));\n }\n _add(t4, e2, i2) {\n this._handlers.push({ handlerName: t4, handler: e2, allowed: i2 }), this._handlersById[t4] = e2;\n }\n stop(t4) {\n if (!this._updatingCamera) {\n for (const { handler: t5 } of this._handlers) t5.reset();\n this._inertia.clear(), this._fireEvents({}, {}, t4), this._changes = [];\n }\n }\n isActive() {\n for (const { handler: t4 } of this._handlers) if (t4.isActive()) return true;\n return false;\n }\n isZooming() {\n return !!this._eventsInProgress.zoom || this._map.scrollZoom.isZooming();\n }\n isRotating() {\n return !!this._eventsInProgress.rotate;\n }\n isMoving() {\n return Boolean(xs(this._eventsInProgress)) || this.isZooming();\n }\n _blockedByActive(t4, e2, i2) {\n for (const a2 in t4) if (a2 !== i2 && (!e2 || e2.indexOf(a2) < 0)) return true;\n return false;\n }\n _getMapTouches(t4) {\n const e2 = [];\n for (const i2 of t4) this._el.contains(i2.target) && e2.push(i2);\n return e2;\n }\n mergeHandlerResult(t4, i2, a2, s2, o2) {\n if (!a2) return;\n e.e(t4, a2);\n const r2 = { handlerName: s2, originalEvent: a2.originalEvent || o2 };\n void 0 !== a2.zoomDelta && (i2.zoom = r2), void 0 !== a2.panDelta && (i2.drag = r2), void 0 !== a2.pitchDelta && (i2.pitch = r2), void 0 !== a2.bearingDelta && (i2.rotate = r2);\n }\n _applyChanges() {\n const t4 = {}, i2 = {}, a2 = {};\n for (const [s2, o2, r2] of this._changes) s2.panDelta && (t4.panDelta = (t4.panDelta || new e.P(0, 0))._add(s2.panDelta)), s2.zoomDelta && (t4.zoomDelta = (t4.zoomDelta || 0) + s2.zoomDelta), s2.bearingDelta && (t4.bearingDelta = (t4.bearingDelta || 0) + s2.bearingDelta), s2.pitchDelta && (t4.pitchDelta = (t4.pitchDelta || 0) + s2.pitchDelta), void 0 !== s2.around && (t4.around = s2.around), void 0 !== s2.pinchAround && (t4.pinchAround = s2.pinchAround), s2.noInertia && (t4.noInertia = s2.noInertia), e.e(i2, o2), e.e(a2, r2);\n this._updateMapTransform(t4, i2, a2), this._changes = [];\n }\n _updateMapTransform(t4, e2, i2) {\n const a2 = this._map, s2 = a2._getTransformForUpdate(), o2 = a2.terrain;\n if (!(bs(t4) || o2 && this._terrainMovement)) return this._fireEvents(e2, i2, true);\n let { panDelta: r2, zoomDelta: n2, bearingDelta: l2, pitchDelta: h2, around: c2, pinchAround: u2 } = t4;\n void 0 !== u2 && (c2 = u2), a2._stop(true), c2 = c2 || a2.transform.centerPoint;\n const d2 = s2.pointLocation(r2 ? c2.sub(r2) : c2);\n l2 && (s2.bearing += l2), h2 && (s2.pitch += h2), n2 && (s2.zoom += n2), o2 ? this._terrainMovement || !e2.drag && !e2.zoom ? e2.drag && this._terrainMovement ? s2.center = s2.pointLocation(s2.centerPoint.sub(r2)) : s2.setLocationAtPoint(d2, c2) : (this._terrainMovement = true, this._map._elevationFreeze = true, s2.setLocationAtPoint(d2, c2)) : s2.setLocationAtPoint(d2, c2), a2._applyUpdatedTransform(s2), this._map._update(), t4.noInertia || this._inertia.record(t4), this._fireEvents(e2, i2, true);\n }\n _fireEvents(t4, i2, a2) {\n const s2 = xs(this._eventsInProgress), r2 = xs(t4), n2 = {};\n for (const e2 in t4) {\n const { originalEvent: i3 } = t4[e2];\n this._eventsInProgress[e2] || (n2[`${e2}start`] = i3), this._eventsInProgress[e2] = t4[e2];\n }\n !s2 && r2 && this._fireEvent(\"movestart\", r2.originalEvent);\n for (const t5 in n2) this._fireEvent(t5, n2[t5]);\n r2 && this._fireEvent(\"move\", r2.originalEvent);\n for (const e2 in t4) {\n const { originalEvent: i3 } = t4[e2];\n this._fireEvent(e2, i3);\n }\n const l2 = {};\n let h2;\n for (const t5 in this._eventsInProgress) {\n const { handlerName: e2, originalEvent: a3 } = this._eventsInProgress[t5];\n this._handlersById[e2].isActive() || (delete this._eventsInProgress[t5], h2 = i2[e2] || a3, l2[`${t5}end`] = h2);\n }\n for (const t5 in l2) this._fireEvent(t5, l2[t5]);\n const c2 = xs(this._eventsInProgress), u2 = (s2 || r2) && !c2;\n if (u2 && this._terrainMovement) {\n this._map._elevationFreeze = false, this._terrainMovement = false;\n const t5 = this._map._getTransformForUpdate();\n t5.recalculateZoom(this._map.terrain), this._map._applyUpdatedTransform(t5);\n }\n if (a2 && u2) {\n this._updatingCamera = true;\n const t5 = this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions), i3 = (t6) => 0 !== t6 && -this._bearingSnap < t6 && t6 < this._bearingSnap;\n !t5 || !t5.essential && o.prefersReducedMotion ? (this._map.fire(new e.k(\"moveend\", { originalEvent: h2 })), i3(this._map.getBearing()) && this._map.resetNorth()) : (i3(t5.bearing || this._map.getBearing()) && (t5.bearing = 0), t5.freezeElevation = true, this._map.easeTo(t5, { originalEvent: h2 })), this._updatingCamera = false;\n }\n }\n _fireEvent(t4, i2) {\n this._map.fire(new e.k(t4, i2 ? { originalEvent: i2 } : {}));\n }\n _requestFrame() {\n return this._map.triggerRepaint(), this._map._renderTaskQueue.add((t4) => {\n delete this._frameId, this.handleEvent(new ys(\"renderFrame\", { timeStamp: t4 })), this._applyChanges();\n });\n }\n _triggerRenderFrame() {\n void 0 === this._frameId && (this._frameId = this._requestFrame());\n }\n }\n class Ts extends e.E {\n constructor(t4, e2) {\n super(), this._renderFrameCallback = () => {\n const t5 = Math.min((o.now() - this._easeStart) / this._easeOptions.duration, 1);\n this._onEaseFrame(this._easeOptions.easing(t5)), t5 < 1 && this._easeFrameId ? this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback) : this.stop();\n }, this._moving = false, this._zooming = false, this.transform = t4, this._bearingSnap = e2.bearingSnap, this.on(\"moveend\", () => {\n delete this._requestedCameraState;\n });\n }\n getCenter() {\n return new e.N(this.transform.center.lng, this.transform.center.lat);\n }\n setCenter(t4, e2) {\n return this.jumpTo({ center: t4 }, e2);\n }\n panBy(t4, i2, a2) {\n return t4 = e.P.convert(t4).mult(-1), this.panTo(this.transform.center, e.e({ offset: t4 }, i2), a2);\n }\n panTo(t4, i2, a2) {\n return this.easeTo(e.e({ center: t4 }, i2), a2);\n }\n getZoom() {\n return this.transform.zoom;\n }\n setZoom(t4, e2) {\n return this.jumpTo({ zoom: t4 }, e2), this;\n }\n zoomTo(t4, i2, a2) {\n return this.easeTo(e.e({ zoom: t4 }, i2), a2);\n }\n zoomIn(t4, e2) {\n return this.zoomTo(this.getZoom() + 1, t4, e2), this;\n }\n zoomOut(t4, e2) {\n return this.zoomTo(this.getZoom() - 1, t4, e2), this;\n }\n getBearing() {\n return this.transform.bearing;\n }\n setBearing(t4, e2) {\n return this.jumpTo({ bearing: t4 }, e2), this;\n }\n getPadding() {\n return this.transform.padding;\n }\n setPadding(t4, e2) {\n return this.jumpTo({ padding: t4 }, e2), this;\n }\n rotateTo(t4, i2, a2) {\n return this.easeTo(e.e({ bearing: t4 }, i2), a2);\n }\n resetNorth(t4, i2) {\n return this.rotateTo(0, e.e({ duration: 1e3 }, t4), i2), this;\n }\n resetNorthPitch(t4, i2) {\n return this.easeTo(e.e({ bearing: 0, pitch: 0, duration: 1e3 }, t4), i2), this;\n }\n snapToNorth(t4, e2) {\n return Math.abs(this.getBearing()) < this._bearingSnap ? this.resetNorth(t4, e2) : this;\n }\n getPitch() {\n return this.transform.pitch;\n }\n setPitch(t4, e2) {\n return this.jumpTo({ pitch: t4 }, e2), this;\n }\n cameraForBounds(t4, e2) {\n t4 = H.convert(t4).adjustAntiMeridian();\n const i2 = e2 && e2.bearing || 0;\n return this._cameraForBoxAndBearing(t4.getNorthWest(), t4.getSouthEast(), i2, e2);\n }\n _cameraForBoxAndBearing(t4, i2, a2, s2) {\n const o2 = { top: 0, bottom: 0, right: 0, left: 0 };\n if (\"number\" == typeof (s2 = e.e({ padding: o2, offset: [0, 0], maxZoom: this.transform.maxZoom }, s2)).padding) {\n const t5 = s2.padding;\n s2.padding = { top: t5, bottom: t5, right: t5, left: t5 };\n }\n s2.padding = e.e(o2, s2.padding);\n const r2 = this.transform, n2 = r2.padding, l2 = new H(t4, i2), h2 = r2.project(l2.getNorthWest()), c2 = r2.project(l2.getNorthEast()), u2 = r2.project(l2.getSouthEast()), d2 = r2.project(l2.getSouthWest()), _2 = e.ba(-a2), p2 = h2.rotate(_2), m2 = c2.rotate(_2), f2 = u2.rotate(_2), g2 = d2.rotate(_2), v2 = new e.P(Math.max(p2.x, m2.x, g2.x, f2.x), Math.max(p2.y, m2.y, g2.y, f2.y)), x2 = new e.P(Math.min(p2.x, m2.x, g2.x, f2.x), Math.min(p2.y, m2.y, g2.y, f2.y)), y2 = v2.sub(x2), b2 = (r2.width - (n2.left + n2.right + s2.padding.left + s2.padding.right)) / y2.x, w2 = (r2.height - (n2.top + n2.bottom + s2.padding.top + s2.padding.bottom)) / y2.y;\n if (w2 < 0 || b2 < 0) return void e.w(\"Map cannot fit within canvas with the given bounds, padding, and/or offset.\");\n const T2 = Math.min(r2.scaleZoom(r2.scale * Math.min(b2, w2)), s2.maxZoom), I2 = e.P.convert(s2.offset), E3 = new e.P((s2.padding.left - s2.padding.right) / 2, (s2.padding.top - s2.padding.bottom) / 2).rotate(e.ba(a2)), P2 = I2.add(E3).mult(r2.scale / r2.zoomScale(T2));\n return { center: r2.unproject(h2.add(u2).div(2).sub(P2)), zoom: T2, bearing: a2 };\n }\n fitBounds(t4, e2, i2) {\n return this._fitInternal(this.cameraForBounds(t4, e2), e2, i2);\n }\n fitScreenCoordinates(t4, i2, a2, s2, o2) {\n return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(e.P.convert(t4)), this.transform.pointLocation(e.P.convert(i2)), a2, s2), s2, o2);\n }\n _fitInternal(t4, i2, a2) {\n return t4 ? (delete (i2 = e.e(t4, i2)).padding, i2.linear ? this.easeTo(i2, a2) : this.flyTo(i2, a2)) : this;\n }\n jumpTo(t4, i2) {\n this.stop();\n const a2 = this._getTransformForUpdate();\n let s2 = false, o2 = false, r2 = false;\n return \"zoom\" in t4 && a2.zoom !== +t4.zoom && (s2 = true, a2.zoom = +t4.zoom), void 0 !== t4.center && (a2.center = e.N.convert(t4.center)), \"bearing\" in t4 && a2.bearing !== +t4.bearing && (o2 = true, a2.bearing = +t4.bearing), \"pitch\" in t4 && a2.pitch !== +t4.pitch && (r2 = true, a2.pitch = +t4.pitch), null == t4.padding || a2.isPaddingEqual(t4.padding) || (a2.padding = t4.padding), this._applyUpdatedTransform(a2), this.fire(new e.k(\"movestart\", i2)).fire(new e.k(\"move\", i2)), s2 && this.fire(new e.k(\"zoomstart\", i2)).fire(new e.k(\"zoom\", i2)).fire(new e.k(\"zoomend\", i2)), o2 && this.fire(new e.k(\"rotatestart\", i2)).fire(new e.k(\"rotate\", i2)).fire(new e.k(\"rotateend\", i2)), r2 && this.fire(new e.k(\"pitchstart\", i2)).fire(new e.k(\"pitch\", i2)).fire(new e.k(\"pitchend\", i2)), this.fire(new e.k(\"moveend\", i2));\n }\n calculateCameraOptionsFromTo(t4, i2, a2, s2 = 0) {\n const o2 = e.Z.fromLngLat(t4, i2), r2 = e.Z.fromLngLat(a2, s2), n2 = r2.x - o2.x, l2 = r2.y - o2.y, h2 = r2.z - o2.z, c2 = Math.hypot(n2, l2, h2);\n if (0 === c2) throw new Error(\"Can't calculate camera options with same From and To\");\n const u2 = Math.hypot(n2, l2), d2 = this.transform.scaleZoom(this.transform.cameraToCenterDistance / c2 / this.transform.tileSize), _2 = 180 * Math.atan2(n2, -l2) / Math.PI;\n let p2 = 180 * Math.acos(u2 / c2) / Math.PI;\n return p2 = h2 < 0 ? 90 - p2 : 90 + p2, { center: r2.toLngLat(), zoom: d2, pitch: p2, bearing: _2 };\n }\n easeTo(t4, i2) {\n var a2;\n this._stop(false, t4.easeId), (false === (t4 = e.e({ offset: [0, 0], duration: 500, easing: e.b9 }, t4)).animate || !t4.essential && o.prefersReducedMotion) && (t4.duration = 0);\n const s2 = this._getTransformForUpdate(), r2 = s2.zoom, n2 = s2.bearing, l2 = s2.pitch, h2 = s2.padding, c2 = \"bearing\" in t4 ? this._normalizeBearing(t4.bearing, n2) : n2, u2 = \"pitch\" in t4 ? +t4.pitch : l2, d2 = \"padding\" in t4 ? t4.padding : s2.padding, _2 = e.P.convert(t4.offset);\n let p2 = s2.centerPoint.add(_2);\n const m2 = s2.pointLocation(p2), { center: f2, zoom: g2 } = s2.getConstrained(e.N.convert(t4.center || m2), null !== (a2 = t4.zoom) && void 0 !== a2 ? a2 : r2);\n this._normalizeCenter(f2, s2);\n const v2 = s2.project(m2), x2 = s2.project(f2).sub(v2), y2 = s2.zoomScale(g2 - r2);\n let b2, w2;\n t4.around && (b2 = e.N.convert(t4.around), w2 = s2.locationPoint(b2));\n const T2 = { moving: this._moving, zooming: this._zooming, rotating: this._rotating, pitching: this._pitching };\n return this._zooming = this._zooming || g2 !== r2, this._rotating = this._rotating || n2 !== c2, this._pitching = this._pitching || u2 !== l2, this._padding = !s2.isPaddingEqual(d2), this._easeId = t4.easeId, this._prepareEase(i2, t4.noMoveStart, T2), this.terrain && this._prepareElevation(f2), this._ease((a3) => {\n if (this._zooming && (s2.zoom = e.y.number(r2, g2, a3)), this._rotating && (s2.bearing = e.y.number(n2, c2, a3)), this._pitching && (s2.pitch = e.y.number(l2, u2, a3)), this._padding && (s2.interpolatePadding(h2, d2, a3), p2 = s2.centerPoint.add(_2)), this.terrain && !t4.freezeElevation && this._updateElevation(a3), b2) s2.setLocationAtPoint(b2, w2);\n else {\n const t5 = s2.zoomScale(s2.zoom - r2), e2 = g2 > r2 ? Math.min(2, y2) : Math.max(0.5, y2), i3 = Math.pow(e2, 1 - a3), o2 = s2.unproject(v2.add(x2.mult(a3 * i3)).mult(t5));\n s2.setLocationAtPoint(s2.renderWorldCopies ? o2.wrap() : o2, p2);\n }\n this._applyUpdatedTransform(s2), this._fireMoveEvents(i2);\n }, (e2) => {\n this.terrain && t4.freezeElevation && this._finalizeElevation(), this._afterEase(i2, e2);\n }, t4), this;\n }\n _prepareEase(t4, i2, a2 = {}) {\n this._moving = true, i2 || a2.moving || this.fire(new e.k(\"movestart\", t4)), this._zooming && !a2.zooming && this.fire(new e.k(\"zoomstart\", t4)), this._rotating && !a2.rotating && this.fire(new e.k(\"rotatestart\", t4)), this._pitching && !a2.pitching && this.fire(new e.k(\"pitchstart\", t4));\n }\n _prepareElevation(t4) {\n this._elevationCenter = t4, this._elevationStart = this.transform.elevation, this._elevationTarget = this.terrain.getElevationForLngLatZoom(t4, this.transform.tileZoom), this._elevationFreeze = true;\n }\n _updateElevation(t4) {\n this.transform.minElevationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter, this.transform.tileZoom);\n const i2 = this.terrain.getElevationForLngLatZoom(this._elevationCenter, this.transform.tileZoom);\n if (t4 < 1 && i2 !== this._elevationTarget) {\n const e2 = this._elevationTarget - this._elevationStart;\n this._elevationStart += t4 * (e2 - (i2 - (e2 * t4 + this._elevationStart)) / (1 - t4)), this._elevationTarget = i2;\n }\n this.transform.elevation = e.y.number(this._elevationStart, this._elevationTarget, t4);\n }\n _finalizeElevation() {\n this._elevationFreeze = false, this.transform.recalculateZoom(this.terrain);\n }\n _getTransformForUpdate() {\n return this.transformCameraUpdate || this.terrain ? (this._requestedCameraState || (this._requestedCameraState = this.transform.clone()), this._requestedCameraState) : this.transform;\n }\n _elevateCameraIfInsideTerrain(t4) {\n const e2 = t4.getCameraPosition(), i2 = this.terrain.getElevationForLngLatZoom(e2.lngLat, t4.zoom);\n if (e2.altitude < i2) {\n const a2 = this.calculateCameraOptionsFromTo(e2.lngLat, i2, t4.center, t4.elevation);\n return { pitch: a2.pitch, zoom: a2.zoom };\n }\n return {};\n }\n _applyUpdatedTransform(t4) {\n const e2 = [];\n if (this.terrain && e2.push((t5) => this._elevateCameraIfInsideTerrain(t5)), this.transformCameraUpdate && e2.push((t5) => this.transformCameraUpdate(t5)), !e2.length) return;\n const i2 = t4.clone();\n for (const t5 of e2) {\n const e3 = i2.clone(), { center: a2, zoom: s2, pitch: o2, bearing: r2, elevation: n2 } = t5(e3);\n a2 && (e3.center = a2), void 0 !== s2 && (e3.zoom = s2), void 0 !== o2 && (e3.pitch = o2), void 0 !== r2 && (e3.bearing = r2), void 0 !== n2 && (e3.elevation = n2), i2.apply(e3);\n }\n this.transform.apply(i2);\n }\n _fireMoveEvents(t4) {\n this.fire(new e.k(\"move\", t4)), this._zooming && this.fire(new e.k(\"zoom\", t4)), this._rotating && this.fire(new e.k(\"rotate\", t4)), this._pitching && this.fire(new e.k(\"pitch\", t4));\n }\n _afterEase(t4, i2) {\n if (this._easeId && i2 && this._easeId === i2) return;\n delete this._easeId;\n const a2 = this._zooming, s2 = this._rotating, o2 = this._pitching;\n this._moving = false, this._zooming = false, this._rotating = false, this._pitching = false, this._padding = false, a2 && this.fire(new e.k(\"zoomend\", t4)), s2 && this.fire(new e.k(\"rotateend\", t4)), o2 && this.fire(new e.k(\"pitchend\", t4)), this.fire(new e.k(\"moveend\", t4));\n }\n flyTo(t4, i2) {\n var a2;\n if (!t4.essential && o.prefersReducedMotion) {\n const a3 = e.M(t4, [\"center\", \"zoom\", \"bearing\", \"pitch\", \"around\"]);\n return this.jumpTo(a3, i2);\n }\n this.stop(), t4 = e.e({ offset: [0, 0], speed: 1.2, curve: 1.42, easing: e.b9 }, t4);\n const s2 = this._getTransformForUpdate(), r2 = s2.zoom, n2 = s2.bearing, l2 = s2.pitch, h2 = s2.padding, c2 = \"bearing\" in t4 ? this._normalizeBearing(t4.bearing, n2) : n2, u2 = \"pitch\" in t4 ? +t4.pitch : l2, d2 = \"padding\" in t4 ? t4.padding : s2.padding, _2 = e.P.convert(t4.offset);\n let p2 = s2.centerPoint.add(_2);\n const m2 = s2.pointLocation(p2), { center: f2, zoom: g2 } = s2.getConstrained(e.N.convert(t4.center || m2), null !== (a2 = t4.zoom) && void 0 !== a2 ? a2 : r2);\n this._normalizeCenter(f2, s2);\n const v2 = s2.zoomScale(g2 - r2), x2 = s2.project(m2), y2 = s2.project(f2).sub(x2);\n let b2 = t4.curve;\n const w2 = Math.max(s2.width, s2.height), T2 = w2 / v2, I2 = y2.mag();\n if (\"minZoom\" in t4) {\n const i3 = e.ac(Math.min(t4.minZoom, r2, g2), s2.minZoom, s2.maxZoom), a3 = w2 / s2.zoomScale(i3 - r2);\n b2 = Math.sqrt(a3 / I2 * 2);\n }\n const E3 = b2 * b2;\n function P2(t5) {\n const e2 = (T2 * T2 - w2 * w2 + (t5 ? -1 : 1) * E3 * E3 * I2 * I2) / (2 * (t5 ? T2 : w2) * E3 * I2);\n return Math.log(Math.sqrt(e2 * e2 + 1) - e2);\n }\n function C3(t5) {\n return (Math.exp(t5) - Math.exp(-t5)) / 2;\n }\n function S2(t5) {\n return (Math.exp(t5) + Math.exp(-t5)) / 2;\n }\n const z2 = P2(false);\n let D3 = function(t5) {\n return S2(z2) / S2(z2 + b2 * t5);\n }, M2 = function(t5) {\n return w2 * ((S2(z2) * (C3(e2 = z2 + b2 * t5) / S2(e2)) - C3(z2)) / E3) / I2;\n var e2;\n }, A3 = (P2(true) - z2) / b2;\n if (Math.abs(I2) < 1e-6 || !isFinite(A3)) {\n if (Math.abs(w2 - T2) < 1e-6) return this.easeTo(t4, i2);\n const e2 = T2 < w2 ? -1 : 1;\n A3 = Math.abs(Math.log(T2 / w2)) / b2, M2 = () => 0, D3 = (t5) => Math.exp(e2 * b2 * t5);\n }\n return t4.duration = \"duration\" in t4 ? +t4.duration : 1e3 * A3 / (\"screenSpeed\" in t4 ? +t4.screenSpeed / b2 : +t4.speed), t4.maxDuration && t4.duration > t4.maxDuration && (t4.duration = 0), this._zooming = true, this._rotating = n2 !== c2, this._pitching = u2 !== l2, this._padding = !s2.isPaddingEqual(d2), this._prepareEase(i2, false), this.terrain && this._prepareElevation(f2), this._ease((a3) => {\n const o2 = a3 * A3, m3 = 1 / D3(o2);\n s2.zoom = 1 === a3 ? g2 : r2 + s2.scaleZoom(m3), this._rotating && (s2.bearing = e.y.number(n2, c2, a3)), this._pitching && (s2.pitch = e.y.number(l2, u2, a3)), this._padding && (s2.interpolatePadding(h2, d2, a3), p2 = s2.centerPoint.add(_2)), this.terrain && !t4.freezeElevation && this._updateElevation(a3);\n const v3 = 1 === a3 ? f2 : s2.unproject(x2.add(y2.mult(M2(o2))).mult(m3));\n s2.setLocationAtPoint(s2.renderWorldCopies ? v3.wrap() : v3, p2), this._applyUpdatedTransform(s2), this._fireMoveEvents(i2);\n }, () => {\n this.terrain && t4.freezeElevation && this._finalizeElevation(), this._afterEase(i2);\n }, t4), this;\n }\n isEasing() {\n return !!this._easeFrameId;\n }\n stop() {\n return this._stop();\n }\n _stop(t4, e2) {\n var i2;\n if (this._easeFrameId && (this._cancelRenderFrame(this._easeFrameId), delete this._easeFrameId, delete this._onEaseFrame), this._onEaseEnd) {\n const t5 = this._onEaseEnd;\n delete this._onEaseEnd, t5.call(this, e2);\n }\n return t4 || null === (i2 = this.handlers) || void 0 === i2 || i2.stop(false), this;\n }\n _ease(t4, e2, i2) {\n false === i2.animate || 0 === i2.duration ? (t4(1), e2()) : (this._easeStart = o.now(), this._easeOptions = i2, this._onEaseFrame = t4, this._onEaseEnd = e2, this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback));\n }\n _normalizeBearing(t4, i2) {\n t4 = e.b3(t4, -180, 180);\n const a2 = Math.abs(t4 - i2);\n return Math.abs(t4 - 360 - i2) < a2 && (t4 -= 360), Math.abs(t4 + 360 - i2) < a2 && (t4 += 360), t4;\n }\n _normalizeCenter(t4, e2) {\n if (!e2.renderWorldCopies || e2.lngRange) return;\n const i2 = t4.lng - e2.center.lng;\n t4.lng += i2 > 180 ? -360 : i2 < -180 ? 360 : 0;\n }\n queryTerrainElevation(t4) {\n return this.terrain ? this.terrain.getElevationForLngLatZoom(e.N.convert(t4), this.transform.tileZoom) - this.transform.elevation : null;\n }\n }\n const Is = { compact: true, customAttribution: 'MapLibre' };\n class Es {\n constructor(t4 = Is) {\n this._toggleAttribution = () => {\n this._container.classList.contains(\"maplibregl-compact\") && (this._container.classList.contains(\"maplibregl-compact-show\") ? (this._container.setAttribute(\"open\", \"\"), this._container.classList.remove(\"maplibregl-compact-show\")) : (this._container.classList.add(\"maplibregl-compact-show\"), this._container.removeAttribute(\"open\")));\n }, this._updateData = (t5) => {\n !t5 || \"metadata\" !== t5.sourceDataType && \"visibility\" !== t5.sourceDataType && \"style\" !== t5.dataType && \"terrain\" !== t5.type || this._updateAttributions();\n }, this._updateCompact = () => {\n this._map.getCanvasContainer().offsetWidth <= 640 || this._compact ? false === this._compact ? this._container.setAttribute(\"open\", \"\") : this._container.classList.contains(\"maplibregl-compact\") || this._container.classList.contains(\"maplibregl-attrib-empty\") || (this._container.setAttribute(\"open\", \"\"), this._container.classList.add(\"maplibregl-compact\", \"maplibregl-compact-show\")) : (this._container.setAttribute(\"open\", \"\"), this._container.classList.contains(\"maplibregl-compact\") && this._container.classList.remove(\"maplibregl-compact\", \"maplibregl-compact-show\"));\n }, this._updateCompactMinimize = () => {\n this._container.classList.contains(\"maplibregl-compact\") && this._container.classList.contains(\"maplibregl-compact-show\") && this._container.classList.remove(\"maplibregl-compact-show\");\n }, this.options = t4;\n }\n getDefaultPosition() {\n return \"bottom-right\";\n }\n onAdd(t4) {\n return this._map = t4, this._compact = this.options.compact, this._container = r.create(\"details\", \"maplibregl-ctrl maplibregl-ctrl-attrib\"), this._compactButton = r.create(\"summary\", \"maplibregl-ctrl-attrib-button\", this._container), this._compactButton.addEventListener(\"click\", this._toggleAttribution), this._setElementTitle(this._compactButton, \"ToggleAttribution\"), this._innerContainer = r.create(\"div\", \"maplibregl-ctrl-attrib-inner\", this._container), this._updateAttributions(), this._updateCompact(), this._map.on(\"styledata\", this._updateData), this._map.on(\"sourcedata\", this._updateData), this._map.on(\"terrain\", this._updateData), this._map.on(\"resize\", this._updateCompact), this._map.on(\"drag\", this._updateCompactMinimize), this._container;\n }\n onRemove() {\n r.remove(this._container), this._map.off(\"styledata\", this._updateData), this._map.off(\"sourcedata\", this._updateData), this._map.off(\"terrain\", this._updateData), this._map.off(\"resize\", this._updateCompact), this._map.off(\"drag\", this._updateCompactMinimize), this._map = void 0, this._compact = void 0, this._attribHTML = void 0;\n }\n _setElementTitle(t4, e2) {\n const i2 = this._map._getUIString(`AttributionControl.${e2}`);\n t4.title = i2, t4.setAttribute(\"aria-label\", i2);\n }\n _updateAttributions() {\n if (!this._map.style) return;\n let t4 = [];\n if (this.options.customAttribution && (Array.isArray(this.options.customAttribution) ? t4 = t4.concat(this.options.customAttribution.map((t5) => \"string\" != typeof t5 ? \"\" : t5)) : \"string\" == typeof this.options.customAttribution && t4.push(this.options.customAttribution)), this._map.style.stylesheet) {\n const t5 = this._map.style.stylesheet;\n this.styleOwner = t5.owner, this.styleId = t5.id;\n }\n const e2 = this._map.style.sourceCaches;\n for (const i3 in e2) {\n const a2 = e2[i3];\n if (a2.used || a2.usedForTerrain) {\n const e3 = a2.getSource();\n e3.attribution && t4.indexOf(e3.attribution) < 0 && t4.push(e3.attribution);\n }\n }\n t4 = t4.filter((t5) => String(t5).trim()), t4.sort((t5, e3) => t5.length - e3.length), t4 = t4.filter((e3, i3) => {\n for (let a2 = i3 + 1; a2 < t4.length; a2++) if (t4[a2].indexOf(e3) >= 0) return false;\n return true;\n });\n const i2 = t4.join(\" | \");\n i2 !== this._attribHTML && (this._attribHTML = i2, t4.length ? (this._innerContainer.innerHTML = i2, this._container.classList.remove(\"maplibregl-attrib-empty\")) : this._container.classList.add(\"maplibregl-attrib-empty\"), this._updateCompact(), this._editLink = null);\n }\n }\n class Ps {\n constructor(t4 = {}) {\n this._updateCompact = () => {\n const t5 = this._container.children;\n if (t5.length) {\n const e2 = t5[0];\n this._map.getCanvasContainer().offsetWidth <= 640 || this._compact ? false !== this._compact && e2.classList.add(\"maplibregl-compact\") : e2.classList.remove(\"maplibregl-compact\");\n }\n }, this.options = t4;\n }\n getDefaultPosition() {\n return \"bottom-left\";\n }\n onAdd(t4) {\n this._map = t4, this._compact = this.options && this.options.compact, this._container = r.create(\"div\", \"maplibregl-ctrl\");\n const e2 = r.create(\"a\", \"maplibregl-ctrl-logo\");\n return e2.target = \"_blank\", e2.rel = \"noopener nofollow\", e2.href = \"https://maplibre.org/\", e2.setAttribute(\"aria-label\", this._map._getUIString(\"LogoControl.Title\")), e2.setAttribute(\"rel\", \"noopener nofollow\"), this._container.appendChild(e2), this._container.style.display = \"block\", this._map.on(\"resize\", this._updateCompact), this._updateCompact(), this._container;\n }\n onRemove() {\n r.remove(this._container), this._map.off(\"resize\", this._updateCompact), this._map = void 0, this._compact = void 0;\n }\n }\n class Cs {\n constructor() {\n this._queue = [], this._id = 0, this._cleared = false, this._currentlyRunning = false;\n }\n add(t4) {\n const e2 = ++this._id;\n return this._queue.push({ callback: t4, id: e2, cancelled: false }), e2;\n }\n remove(t4) {\n const e2 = this._currentlyRunning, i2 = e2 ? this._queue.concat(e2) : this._queue;\n for (const e3 of i2) if (e3.id === t4) return void (e3.cancelled = true);\n }\n run(t4 = 0) {\n if (this._currentlyRunning) throw new Error(\"Attempting to run(), but is already running.\");\n const e2 = this._currentlyRunning = this._queue;\n this._queue = [];\n for (const i2 of e2) if (!i2.cancelled && (i2.callback(t4), this._cleared)) break;\n this._cleared = false, this._currentlyRunning = false;\n }\n clear() {\n this._currentlyRunning && (this._cleared = true), this._queue = [];\n }\n }\n var Ss = e.Y([{ name: \"a_pos3d\", type: \"Int16\", components: 3 }]);\n class zs extends e.E {\n constructor(t4) {\n super(), this.sourceCache = t4, this._tiles = {}, this._renderableTilesKeys = [], this._sourceTileCache = {}, this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this.deltaZoom = 1, t4.usedForTerrain = true, t4.tileSize = this.tileSize * 2 ** this.deltaZoom;\n }\n destruct() {\n this.sourceCache.usedForTerrain = false, this.sourceCache.tileSize = null;\n }\n update(t4, i2) {\n this.sourceCache.update(t4, i2), this._renderableTilesKeys = [];\n const a2 = {};\n for (const s2 of t4.coveringTiles({ tileSize: this.tileSize, minzoom: this.minzoom, maxzoom: this.maxzoom, reparseOverscaled: false, terrain: i2 })) a2[s2.key] = true, this._renderableTilesKeys.push(s2.key), this._tiles[s2.key] || (s2.posMatrix = new Float64Array(16), e.aP(s2.posMatrix, 0, e.X, 0, e.X, 0, 1), this._tiles[s2.key] = new lt(s2, this.tileSize));\n for (const t5 in this._tiles) a2[t5] || delete this._tiles[t5];\n }\n freeRtt(t4) {\n for (const e2 in this._tiles) {\n const i2 = this._tiles[e2];\n (!t4 || i2.tileID.equals(t4) || i2.tileID.isChildOf(t4) || t4.isChildOf(i2.tileID)) && (i2.rtt = []);\n }\n }\n getRenderableTiles() {\n return this._renderableTilesKeys.map((t4) => this.getTileByID(t4));\n }\n getTileByID(t4) {\n return this._tiles[t4];\n }\n getTerrainCoords(t4) {\n const i2 = {};\n for (const a2 of this._renderableTilesKeys) {\n const s2 = this._tiles[a2].tileID;\n if (s2.canonical.equals(t4.canonical)) {\n const s3 = t4.clone();\n s3.posMatrix = new Float64Array(16), e.aP(s3.posMatrix, 0, e.X, 0, e.X, 0, 1), i2[a2] = s3;\n } else if (s2.canonical.isChildOf(t4.canonical)) {\n const o2 = t4.clone();\n o2.posMatrix = new Float64Array(16);\n const r2 = s2.canonical.z - t4.canonical.z, n2 = s2.canonical.x - (s2.canonical.x >> r2 << r2), l2 = s2.canonical.y - (s2.canonical.y >> r2 << r2), h2 = e.X >> r2;\n e.aP(o2.posMatrix, 0, h2, 0, h2, 0, 1), e.J(o2.posMatrix, o2.posMatrix, [-n2 * h2, -l2 * h2, 0]), i2[a2] = o2;\n } else if (t4.canonical.isChildOf(s2.canonical)) {\n const o2 = t4.clone();\n o2.posMatrix = new Float64Array(16);\n const r2 = t4.canonical.z - s2.canonical.z, n2 = t4.canonical.x - (t4.canonical.x >> r2 << r2), l2 = t4.canonical.y - (t4.canonical.y >> r2 << r2), h2 = e.X >> r2;\n e.aP(o2.posMatrix, 0, e.X, 0, e.X, 0, 1), e.J(o2.posMatrix, o2.posMatrix, [n2 * h2, l2 * h2, 0]), e.K(o2.posMatrix, o2.posMatrix, [1 / 2 ** r2, 1 / 2 ** r2, 0]), i2[a2] = o2;\n }\n }\n return i2;\n }\n getSourceTile(t4, e2) {\n const i2 = this.sourceCache._source;\n let a2 = t4.overscaledZ - this.deltaZoom;\n if (a2 > i2.maxzoom && (a2 = i2.maxzoom), a2 < i2.minzoom) return null;\n this._sourceTileCache[t4.key] || (this._sourceTileCache[t4.key] = t4.scaledTo(a2).key);\n let s2 = this.sourceCache.getTileByID(this._sourceTileCache[t4.key]);\n if ((!s2 || !s2.dem) && e2) for (; a2 >= i2.minzoom && (!s2 || !s2.dem); ) s2 = this.sourceCache.getTileByID(t4.scaledTo(a2--).key);\n return s2;\n }\n tilesAfterTime(t4 = Date.now()) {\n return Object.values(this._tiles).filter((e2) => e2.timeAdded >= t4);\n }\n }\n class Ds {\n constructor(t4, e2, i2) {\n this.painter = t4, this.sourceCache = new zs(e2), this.options = i2, this.exaggeration = \"number\" == typeof i2.exaggeration ? i2.exaggeration : 1, this.qualityFactor = 2, this.meshSize = 128, this._demMatrixCache = {}, this.coordsIndex = [], this._coordsTextureSize = 1024;\n }\n getDEMElevation(t4, i2, a2, s2 = e.X) {\n var o2;\n if (!(i2 >= 0 && i2 < s2 && a2 >= 0 && a2 < s2)) return 0;\n const r2 = this.getTerrainData(t4), n2 = null === (o2 = r2.tile) || void 0 === o2 ? void 0 : o2.dem;\n if (!n2) return 0;\n const l2 = function(t5, e2, i3) {\n var a3 = e2[0], s3 = e2[1];\n return t5[0] = i3[0] * a3 + i3[4] * s3 + i3[12], t5[1] = i3[1] * a3 + i3[5] * s3 + i3[13], t5;\n }([], [i2 / s2 * e.X, a2 / s2 * e.X], r2.u_terrain_matrix), h2 = [l2[0] * n2.dim, l2[1] * n2.dim], c2 = Math.floor(h2[0]), u2 = Math.floor(h2[1]), d2 = h2[0] - c2, _2 = h2[1] - u2;\n return n2.get(c2, u2) * (1 - d2) * (1 - _2) + n2.get(c2 + 1, u2) * d2 * (1 - _2) + n2.get(c2, u2 + 1) * (1 - d2) * _2 + n2.get(c2 + 1, u2 + 1) * d2 * _2;\n }\n getElevationForLngLatZoom(t4, i2) {\n if (!e.bb(i2, t4.wrap())) return 0;\n const { tileID: a2, mercatorX: s2, mercatorY: o2 } = this._getOverscaledTileIDFromLngLatZoom(t4, i2);\n return this.getElevation(a2, s2 % e.X, o2 % e.X, e.X);\n }\n getElevation(t4, i2, a2, s2 = e.X) {\n return this.getDEMElevation(t4, i2, a2, s2) * this.exaggeration;\n }\n getTerrainData(t4) {\n if (!this._emptyDemTexture) {\n const t5 = this.painter.context, i3 = new e.R({ width: 1, height: 1 }, new Uint8Array(4));\n this._emptyDepthTexture = new b(t5, i3, t5.gl.RGBA, { premultiply: false }), this._emptyDemUnpack = [0, 0, 0, 0], this._emptyDemTexture = new b(t5, new e.R({ width: 1, height: 1 }), t5.gl.RGBA, { premultiply: false }), this._emptyDemTexture.bind(t5.gl.NEAREST, t5.gl.CLAMP_TO_EDGE), this._emptyDemMatrix = e.an([]);\n }\n const i2 = this.sourceCache.getSourceTile(t4, true);\n if (i2 && i2.dem && (!i2.demTexture || i2.needsTerrainPrepare)) {\n const t5 = this.painter.context;\n i2.demTexture = this.painter.getTileTexture(i2.dem.stride), i2.demTexture ? i2.demTexture.update(i2.dem.getPixels(), { premultiply: false }) : i2.demTexture = new b(t5, i2.dem.getPixels(), t5.gl.RGBA, { premultiply: false }), i2.demTexture.bind(t5.gl.NEAREST, t5.gl.CLAMP_TO_EDGE), i2.needsTerrainPrepare = false;\n }\n const a2 = i2 && i2 + i2.tileID.key + t4.key;\n if (a2 && !this._demMatrixCache[a2]) {\n const a3 = this.sourceCache.sourceCache._source.maxzoom;\n let s2 = t4.canonical.z - i2.tileID.canonical.z;\n t4.overscaledZ > t4.canonical.z && (t4.canonical.z >= a3 ? s2 = t4.canonical.z - a3 : e.w(\"cannot calculate elevation if elevation maxzoom > source.maxzoom\"));\n const o2 = t4.canonical.x - (t4.canonical.x >> s2 << s2), r2 = t4.canonical.y - (t4.canonical.y >> s2 << s2), n2 = e.bc(new Float64Array(16), [1 / (e.X << s2), 1 / (e.X << s2), 0]);\n e.J(n2, n2, [o2 * e.X, r2 * e.X, 0]), this._demMatrixCache[t4.key] = { matrix: n2, coord: t4 };\n }\n return { u_depth: 2, u_terrain: 3, u_terrain_dim: i2 && i2.dem && i2.dem.dim || 1, u_terrain_matrix: a2 ? this._demMatrixCache[t4.key].matrix : this._emptyDemMatrix, u_terrain_unpack: i2 && i2.dem && i2.dem.getUnpackVector() || this._emptyDemUnpack, u_terrain_exaggeration: this.exaggeration, texture: (i2 && i2.demTexture || this._emptyDemTexture).texture, depthTexture: (this._fboDepthTexture || this._emptyDepthTexture).texture, tile: i2 };\n }\n getFramebuffer(t4) {\n const e2 = this.painter, i2 = e2.width / devicePixelRatio, a2 = e2.height / devicePixelRatio;\n return !this._fbo || this._fbo.width === i2 && this._fbo.height === a2 || (this._fbo.destroy(), this._fboCoordsTexture.destroy(), this._fboDepthTexture.destroy(), delete this._fbo, delete this._fboDepthTexture, delete this._fboCoordsTexture), this._fboCoordsTexture || (this._fboCoordsTexture = new b(e2.context, { width: i2, height: a2, data: null }, e2.context.gl.RGBA, { premultiply: false }), this._fboCoordsTexture.bind(e2.context.gl.NEAREST, e2.context.gl.CLAMP_TO_EDGE)), this._fboDepthTexture || (this._fboDepthTexture = new b(e2.context, { width: i2, height: a2, data: null }, e2.context.gl.RGBA, { premultiply: false }), this._fboDepthTexture.bind(e2.context.gl.NEAREST, e2.context.gl.CLAMP_TO_EDGE)), this._fbo || (this._fbo = e2.context.createFramebuffer(i2, a2, true, false), this._fbo.depthAttachment.set(e2.context.createRenderbuffer(e2.context.gl.DEPTH_COMPONENT16, i2, a2))), this._fbo.colorAttachment.set(\"coords\" === t4 ? this._fboCoordsTexture.texture : this._fboDepthTexture.texture), this._fbo;\n }\n getCoordsTexture() {\n const t4 = this.painter.context;\n if (this._coordsTexture) return this._coordsTexture;\n const i2 = new Uint8Array(this._coordsTextureSize * this._coordsTextureSize * 4);\n for (let t5 = 0, e2 = 0; t5 < this._coordsTextureSize; t5++) for (let a3 = 0; a3 < this._coordsTextureSize; a3++, e2 += 4) i2[e2 + 0] = 255 & a3, i2[e2 + 1] = 255 & t5, i2[e2 + 2] = a3 >> 8 << 4 | t5 >> 8, i2[e2 + 3] = 0;\n const a2 = new e.R({ width: this._coordsTextureSize, height: this._coordsTextureSize }, new Uint8Array(i2.buffer)), s2 = new b(t4, a2, t4.gl.RGBA, { premultiply: false });\n return s2.bind(t4.gl.NEAREST, t4.gl.CLAMP_TO_EDGE), this._coordsTexture = s2, s2;\n }\n pointCoordinate(t4) {\n this.painter.maybeDrawDepthAndCoords(true);\n const i2 = new Uint8Array(4), a2 = this.painter.context, s2 = a2.gl, o2 = Math.round(t4.x * this.painter.pixelRatio / devicePixelRatio), r2 = Math.round(t4.y * this.painter.pixelRatio / devicePixelRatio), n2 = Math.round(this.painter.height / devicePixelRatio);\n a2.bindFramebuffer.set(this.getFramebuffer(\"coords\").framebuffer), s2.readPixels(o2, n2 - r2 - 1, 1, 1, s2.RGBA, s2.UNSIGNED_BYTE, i2), a2.bindFramebuffer.set(null);\n const l2 = i2[0] + (i2[2] >> 4 << 8), h2 = i2[1] + ((15 & i2[2]) << 8), c2 = this.coordsIndex[255 - i2[3]], u2 = c2 && this.sourceCache.getTileByID(c2);\n if (!u2) return null;\n const d2 = this._coordsTextureSize, _2 = (1 << u2.tileID.canonical.z) * d2;\n return new e.Z((u2.tileID.canonical.x * d2 + l2) / _2 + u2.tileID.wrap, (u2.tileID.canonical.y * d2 + h2) / _2, this.getElevation(u2.tileID, l2, h2, d2));\n }\n depthAtPoint(t4) {\n const e2 = new Uint8Array(4), i2 = this.painter.context, a2 = i2.gl;\n return i2.bindFramebuffer.set(this.getFramebuffer(\"depth\").framebuffer), a2.readPixels(t4.x, this.painter.height / devicePixelRatio - t4.y - 1, 1, 1, a2.RGBA, a2.UNSIGNED_BYTE, e2), i2.bindFramebuffer.set(null), (e2[0] / 16777216 + e2[1] / 65536 + e2[2] / 256 + e2[3]) / 256;\n }\n getTerrainMesh() {\n if (this._mesh) return this._mesh;\n const t4 = this.painter.context, i2 = new e.bd(), a2 = new e.aY(), s2 = this.meshSize, o2 = e.X / s2, r2 = s2 * s2;\n for (let t5 = 0; t5 <= s2; t5++) for (let e2 = 0; e2 <= s2; e2++) i2.emplaceBack(e2 * o2, t5 * o2, 0);\n for (let t5 = 0; t5 < r2; t5 += s2 + 1) for (let e2 = 0; e2 < s2; e2++) a2.emplaceBack(e2 + t5, s2 + e2 + t5 + 1, s2 + e2 + t5 + 2), a2.emplaceBack(e2 + t5, s2 + e2 + t5 + 2, e2 + t5 + 1);\n const n2 = i2.length, l2 = n2 + 2 * (s2 + 1);\n for (const t5 of [0, 1]) for (let a3 = 0; a3 <= s2; a3++) for (const s3 of [0, 1]) i2.emplaceBack(a3 * o2, t5 * e.X, s3);\n for (let t5 = 0; t5 < 2 * s2; t5 += 2) a2.emplaceBack(l2 + t5, l2 + t5 + 1, l2 + t5 + 3), a2.emplaceBack(l2 + t5, l2 + t5 + 3, l2 + t5 + 2), a2.emplaceBack(n2 + t5, n2 + t5 + 3, n2 + t5 + 1), a2.emplaceBack(n2 + t5, n2 + t5 + 2, n2 + t5 + 3);\n const h2 = i2.length, c2 = h2 + 2 * (s2 + 1);\n for (const t5 of [0, 1]) for (let a3 = 0; a3 <= s2; a3++) for (const s3 of [0, 1]) i2.emplaceBack(t5 * e.X, a3 * o2, s3);\n for (let t5 = 0; t5 < 2 * s2; t5 += 2) a2.emplaceBack(h2 + t5, h2 + t5 + 1, h2 + t5 + 3), a2.emplaceBack(h2 + t5, h2 + t5 + 3, h2 + t5 + 2), a2.emplaceBack(c2 + t5, c2 + t5 + 3, c2 + t5 + 1), a2.emplaceBack(c2 + t5, c2 + t5 + 2, c2 + t5 + 3);\n return this._mesh = new ga(t4.createVertexBuffer(i2, Ss.members), t4.createIndexBuffer(a2), e.a0.simpleSegment(0, 0, i2.length, a2.length)), this._mesh;\n }\n getMeshFrameDelta(t4) {\n return 2 * Math.PI * e.be / Math.pow(2, t4) / 5;\n }\n getMinTileElevationForLngLatZoom(t4, e2) {\n var i2;\n const { tileID: a2 } = this._getOverscaledTileIDFromLngLatZoom(t4, e2);\n return null !== (i2 = this.getMinMaxElevation(a2).minElevation) && void 0 !== i2 ? i2 : 0;\n }\n getMinMaxElevation(t4) {\n const e2 = this.getTerrainData(t4).tile, i2 = { minElevation: null, maxElevation: null };\n return e2 && e2.dem && (i2.minElevation = e2.dem.min * this.exaggeration, i2.maxElevation = e2.dem.max * this.exaggeration), i2;\n }\n _getOverscaledTileIDFromLngLatZoom(t4, i2) {\n const a2 = e.Z.fromLngLat(t4.wrap()), s2 = (1 << i2) * e.X, o2 = a2.x * s2, r2 = a2.y * s2, n2 = Math.floor(o2 / e.X), l2 = Math.floor(r2 / e.X);\n return { tileID: new e.S(i2, 0, i2, n2, l2), mercatorX: o2, mercatorY: r2 };\n }\n }\n class Ms {\n constructor(t4, e2, i2) {\n this._context = t4, this._size = e2, this._tileSize = i2, this._objects = [], this._recentlyUsed = [], this._stamp = 0;\n }\n destruct() {\n for (const t4 of this._objects) t4.texture.destroy(), t4.fbo.destroy();\n }\n _createObject(t4) {\n const e2 = this._context.createFramebuffer(this._tileSize, this._tileSize, true, true), i2 = new b(this._context, { width: this._tileSize, height: this._tileSize, data: null }, this._context.gl.RGBA);\n return i2.bind(this._context.gl.LINEAR, this._context.gl.CLAMP_TO_EDGE), e2.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL, this._tileSize, this._tileSize)), e2.colorAttachment.set(i2.texture), { id: t4, fbo: e2, texture: i2, stamp: -1, inUse: false };\n }\n getObjectForId(t4) {\n return this._objects[t4];\n }\n useObject(t4) {\n t4.inUse = true, this._recentlyUsed = this._recentlyUsed.filter((e2) => t4.id !== e2), this._recentlyUsed.push(t4.id);\n }\n stampObject(t4) {\n t4.stamp = ++this._stamp;\n }\n getOrCreateFreeObject() {\n for (const t5 of this._recentlyUsed) if (!this._objects[t5].inUse) return this._objects[t5];\n if (this._objects.length >= this._size) throw new Error(\"No free RenderPool available, call freeAllObjects() required!\");\n const t4 = this._createObject(this._objects.length);\n return this._objects.push(t4), t4;\n }\n freeObject(t4) {\n t4.inUse = false;\n }\n freeAllObjects() {\n for (const t4 of this._objects) this.freeObject(t4);\n }\n isFull() {\n return !(this._objects.length < this._size) && false === this._objects.some((t4) => !t4.inUse);\n }\n }\n const As = { background: true, fill: true, line: true, raster: true, hillshade: true };\n class Rs {\n constructor(t4, e2) {\n this.painter = t4, this.terrain = e2, this.pool = new Ms(t4.context, 30, e2.sourceCache.tileSize * e2.qualityFactor);\n }\n destruct() {\n this.pool.destruct();\n }\n getTexture(t4) {\n return this.pool.getObjectForId(t4.rtt[this._stacks.length - 1].id).texture;\n }\n prepareForRender(t4, e2) {\n this._stacks = [], this._prevType = null, this._rttTiles = [], this._renderableTiles = this.terrain.sourceCache.getRenderableTiles(), this._renderableLayerIds = t4._order.filter((i2) => !t4._layers[i2].isHidden(e2)), this._coordsDescendingInv = {};\n for (const e3 in t4.sourceCaches) {\n this._coordsDescendingInv[e3] = {};\n const i2 = t4.sourceCaches[e3].getVisibleCoordinates();\n for (const t5 of i2) {\n const i3 = this.terrain.sourceCache.getTerrainCoords(t5);\n for (const t6 in i3) this._coordsDescendingInv[e3][t6] || (this._coordsDescendingInv[e3][t6] = []), this._coordsDescendingInv[e3][t6].push(i3[t6]);\n }\n }\n this._coordsDescendingInvStr = {};\n for (const e3 of t4._order) {\n const i2 = t4._layers[e3], a2 = i2.source;\n if (As[i2.type] && !this._coordsDescendingInvStr[a2]) {\n this._coordsDescendingInvStr[a2] = {};\n for (const t5 in this._coordsDescendingInv[a2]) this._coordsDescendingInvStr[a2][t5] = this._coordsDescendingInv[a2][t5].map((t6) => t6.key).sort().join();\n }\n }\n for (const t5 of this._renderableTiles) for (const e3 in this._coordsDescendingInvStr) {\n const i2 = this._coordsDescendingInvStr[e3][t5.tileID.key];\n i2 && i2 !== t5.rttCoords[e3] && (t5.rtt = []);\n }\n }\n renderLayer(t4) {\n if (t4.isHidden(this.painter.transform.zoom)) return false;\n const i2 = t4.type, a2 = this.painter, s2 = this._renderableLayerIds[this._renderableLayerIds.length - 1] === t4.id;\n if (As[i2] && (this._prevType && As[this._prevType] || this._stacks.push([]), this._prevType = i2, this._stacks[this._stacks.length - 1].push(t4.id), !s2)) return true;\n if (As[this._prevType] || As[i2] && s2) {\n this._prevType = i2;\n const t5 = this._stacks.length - 1, s3 = this._stacks[t5] || [];\n for (const i3 of this._renderableTiles) {\n if (this.pool.isFull() && (fa(this.painter, this.terrain, this._rttTiles), this._rttTiles = [], this.pool.freeAllObjects()), this._rttTiles.push(i3), i3.rtt[t5]) {\n const e2 = this.pool.getObjectForId(i3.rtt[t5].id);\n if (e2.stamp === i3.rtt[t5].stamp) {\n this.pool.useObject(e2);\n continue;\n }\n }\n const o2 = this.pool.getOrCreateFreeObject();\n this.pool.useObject(o2), this.pool.stampObject(o2), i3.rtt[t5] = { id: o2.id, stamp: o2.stamp }, a2.context.bindFramebuffer.set(o2.fbo.framebuffer), a2.context.clear({ color: e.aM.transparent, stencil: 0 }), a2.currentStencilSource = void 0;\n for (let t6 = 0; t6 < s3.length; t6++) {\n const e2 = a2.style._layers[s3[t6]], r2 = e2.source ? this._coordsDescendingInv[e2.source][i3.tileID.key] : [i3.tileID];\n a2.context.viewport.set([0, 0, o2.fbo.width, o2.fbo.height]), a2._renderTileClippingMasks(e2, r2), a2.renderLayer(a2, a2.style.sourceCaches[e2.source], e2, r2), e2.source && (i3.rttCoords[e2.source] = this._coordsDescendingInvStr[e2.source][i3.tileID.key]);\n }\n }\n return fa(this.painter, this.terrain, this._rttTiles), this._rttTiles = [], this.pool.freeAllObjects(), As[i2];\n }\n return false;\n }\n }\n const ks = { \"AttributionControl.ToggleAttribution\": \"Toggle attribution\", \"AttributionControl.MapFeedback\": \"Map feedback\", \"FullscreenControl.Enter\": \"Enter fullscreen\", \"FullscreenControl.Exit\": \"Exit fullscreen\", \"GeolocateControl.FindMyLocation\": \"Find my location\", \"GeolocateControl.LocationNotAvailable\": \"Location not available\", \"LogoControl.Title\": \"MapLibre logo\", \"Map.Title\": \"Map\", \"Marker.Title\": \"Map marker\", \"NavigationControl.ResetBearing\": \"Reset bearing to north\", \"NavigationControl.ZoomIn\": \"Zoom in\", \"NavigationControl.ZoomOut\": \"Zoom out\", \"Popup.Close\": \"Close popup\", \"ScaleControl.Feet\": \"ft\", \"ScaleControl.Meters\": \"m\", \"ScaleControl.Kilometers\": \"km\", \"ScaleControl.Miles\": \"mi\", \"ScaleControl.NauticalMiles\": \"nm\", \"TerrainControl.Enable\": \"Enable terrain\", \"TerrainControl.Disable\": \"Disable terrain\", \"CooperativeGesturesHandler.WindowsHelpText\": \"Use Ctrl + scroll to zoom the map\", \"CooperativeGesturesHandler.MacHelpText\": \"Use \\u2318 + scroll to zoom the map\", \"CooperativeGesturesHandler.MobileHelpText\": \"Use two fingers to move the map\" }, Ls = i, Fs = { hash: false, interactive: true, bearingSnap: 7, attributionControl: Is, maplibreLogo: false, failIfMajorPerformanceCaveat: false, preserveDrawingBuffer: false, refreshExpiredTiles: true, scrollZoom: true, minZoom: -2, maxZoom: 22, minPitch: 0, maxPitch: 60, boxZoom: true, dragRotate: true, dragPan: true, keyboard: true, doubleClickZoom: true, touchZoomRotate: true, touchPitch: true, cooperativeGestures: false, trackResize: true, center: [0, 0], zoom: 0, bearing: 0, pitch: 0, renderWorldCopies: true, maxTileCacheSize: null, maxTileCacheZoomLevels: e.a.MAX_TILE_CACHE_ZOOM_LEVELS, transformRequest: null, transformCameraUpdate: null, fadeDuration: 300, crossSourceCollisions: true, clickTolerance: 3, localIdeographFontFamily: \"sans-serif\", pitchWithRotate: true, validateStyle: true, maxCanvasSize: [4096, 4096], cancelPendingTileRequestsWhileZooming: true }, Bs = (t4) => {\n t4.touchstart = t4.dragStart, t4.touchmoveWindow = t4.dragMove, t4.touchend = t4.dragEnd;\n }, Os = { showCompass: true, showZoom: true, visualizePitch: false };\n class Ns {\n constructor(t4, i2, a2 = false) {\n this.mousedown = (t5) => {\n this.startMouse(e.e({}, t5, { ctrlKey: true, preventDefault: () => t5.preventDefault() }), r.mousePos(this.element, t5)), r.addEventListener(window, \"mousemove\", this.mousemove), r.addEventListener(window, \"mouseup\", this.mouseup);\n }, this.mousemove = (t5) => {\n this.moveMouse(t5, r.mousePos(this.element, t5));\n }, this.mouseup = (t5) => {\n this.mouseRotate.dragEnd(t5), this.mousePitch && this.mousePitch.dragEnd(t5), this.offTemp();\n }, this.touchstart = (t5) => {\n 1 !== t5.targetTouches.length ? this.reset() : (this._startPos = this._lastPos = r.touchPos(this.element, t5.targetTouches)[0], this.startTouch(t5, this._startPos), r.addEventListener(window, \"touchmove\", this.touchmove, { passive: false }), r.addEventListener(window, \"touchend\", this.touchend));\n }, this.touchmove = (t5) => {\n 1 !== t5.targetTouches.length ? this.reset() : (this._lastPos = r.touchPos(this.element, t5.targetTouches)[0], this.moveTouch(t5, this._lastPos));\n }, this.touchend = (t5) => {\n 0 === t5.targetTouches.length && this._startPos && this._lastPos && this._startPos.dist(this._lastPos) < this._clickTolerance && this.element.click(), delete this._startPos, delete this._lastPos, this.offTemp();\n }, this.reset = () => {\n this.mouseRotate.reset(), this.mousePitch && this.mousePitch.reset(), this.touchRotate.reset(), this.touchPitch && this.touchPitch.reset(), delete this._startPos, delete this._lastPos, this.offTemp();\n }, this._clickTolerance = 10;\n const s2 = t4.dragRotate._mouseRotate.getClickTolerance(), o2 = t4.dragRotate._mousePitch.getClickTolerance();\n this.element = i2, this.mouseRotate = Ka({ clickTolerance: s2, enable: true }), this.touchRotate = (({ enable: t5, clickTolerance: e2, bearingDegreesPerPixelMoved: i3 = 0.8 }) => {\n const a3 = new $a();\n return new Ga({ clickTolerance: e2, move: (t6, e3) => ({ bearingDelta: (e3.x - t6.x) * i3 }), moveStateManager: a3, enable: t5, assignEvents: Bs });\n })({ clickTolerance: s2, enable: true }), this.map = t4, a2 && (this.mousePitch = Ja({ clickTolerance: o2, enable: true }), this.touchPitch = (({ enable: t5, clickTolerance: e2, pitchDegreesPerPixelMoved: i3 = -0.5 }) => {\n const a3 = new $a();\n return new Ga({ clickTolerance: e2, move: (t6, e3) => ({ pitchDelta: (e3.y - t6.y) * i3 }), moveStateManager: a3, enable: t5, assignEvents: Bs });\n })({ clickTolerance: o2, enable: true })), r.addEventListener(i2, \"mousedown\", this.mousedown), r.addEventListener(i2, \"touchstart\", this.touchstart, { passive: false }), r.addEventListener(i2, \"touchcancel\", this.reset);\n }\n startMouse(t4, e2) {\n this.mouseRotate.dragStart(t4, e2), this.mousePitch && this.mousePitch.dragStart(t4, e2), r.disableDrag();\n }\n startTouch(t4, e2) {\n this.touchRotate.dragStart(t4, e2), this.touchPitch && this.touchPitch.dragStart(t4, e2), r.disableDrag();\n }\n moveMouse(t4, e2) {\n const i2 = this.map, { bearingDelta: a2 } = this.mouseRotate.dragMove(t4, e2) || {};\n if (a2 && i2.setBearing(i2.getBearing() + a2), this.mousePitch) {\n const { pitchDelta: a3 } = this.mousePitch.dragMove(t4, e2) || {};\n a3 && i2.setPitch(i2.getPitch() + a3);\n }\n }\n moveTouch(t4, e2) {\n const i2 = this.map, { bearingDelta: a2 } = this.touchRotate.dragMove(t4, e2) || {};\n if (a2 && i2.setBearing(i2.getBearing() + a2), this.touchPitch) {\n const { pitchDelta: a3 } = this.touchPitch.dragMove(t4, e2) || {};\n a3 && i2.setPitch(i2.getPitch() + a3);\n }\n }\n off() {\n const t4 = this.element;\n r.removeEventListener(t4, \"mousedown\", this.mousedown), r.removeEventListener(t4, \"touchstart\", this.touchstart, { passive: false }), r.removeEventListener(window, \"touchmove\", this.touchmove, { passive: false }), r.removeEventListener(window, \"touchend\", this.touchend), r.removeEventListener(t4, \"touchcancel\", this.reset), this.offTemp();\n }\n offTemp() {\n r.enableDrag(), r.removeEventListener(window, \"mousemove\", this.mousemove), r.removeEventListener(window, \"mouseup\", this.mouseup), r.removeEventListener(window, \"touchmove\", this.touchmove, { passive: false }), r.removeEventListener(window, \"touchend\", this.touchend);\n }\n }\n let Us;\n function js(t4, i2, a2) {\n const s2 = new e.N(t4.lng, t4.lat);\n if (t4 = new e.N(t4.lng, t4.lat), i2) {\n const s3 = new e.N(t4.lng - 360, t4.lat), o2 = new e.N(t4.lng + 360, t4.lat), r2 = a2.locationPoint(t4).distSqr(i2);\n a2.locationPoint(s3).distSqr(i2) < r2 ? t4 = s3 : a2.locationPoint(o2).distSqr(i2) < r2 && (t4 = o2);\n }\n for (; Math.abs(t4.lng - a2.center.lng) > 180; ) {\n const e2 = a2.locationPoint(t4);\n if (e2.x >= 0 && e2.y >= 0 && e2.x <= a2.width && e2.y <= a2.height) break;\n t4.lng > a2.center.lng ? t4.lng -= 360 : t4.lng += 360;\n }\n return t4.lng !== s2.lng && a2.locationPoint(t4).y > a2.height / 2 - a2.getHorizon() ? t4 : s2;\n }\n const Zs = { center: \"translate(-50%,-50%)\", top: \"translate(-50%,0)\", \"top-left\": \"translate(0,0)\", \"top-right\": \"translate(-100%,0)\", bottom: \"translate(-50%,-100%)\", \"bottom-left\": \"translate(0,-100%)\", \"bottom-right\": \"translate(-100%,-100%)\", left: \"translate(0,-50%)\", right: \"translate(-100%,-50%)\" };\n function qs(t4, e2, i2) {\n const a2 = t4.classList;\n for (const t5 in Zs) a2.remove(`maplibregl-${i2}-anchor-${t5}`);\n a2.add(`maplibregl-${i2}-anchor-${e2}`);\n }\n class Vs extends e.E {\n constructor(t4) {\n if (super(), this._onKeyPress = (t5) => {\n const e2 = t5.code, i2 = t5.charCode || t5.keyCode;\n \"Space\" !== e2 && \"Enter\" !== e2 && 32 !== i2 && 13 !== i2 || this.togglePopup();\n }, this._onMapClick = (t5) => {\n const e2 = t5.originalEvent.target, i2 = this._element;\n this._popup && (e2 === i2 || i2.contains(e2)) && this.togglePopup();\n }, this._update = (t5) => {\n var e2;\n if (!this._map) return;\n const i2 = this._map.loaded() && !this._map.isMoving();\n (\"terrain\" === (null == t5 ? void 0 : t5.type) || \"render\" === (null == t5 ? void 0 : t5.type) && !i2) && this._map.once(\"render\", this._update), this._lngLat = this._map.transform.renderWorldCopies ? js(this._lngLat, this._flatPos, this._map.transform) : null === (e2 = this._lngLat) || void 0 === e2 ? void 0 : e2.wrap(), this._flatPos = this._pos = this._map.project(this._lngLat)._add(this._offset), this._map.terrain && (this._flatPos = this._map.transform.locationPoint(this._lngLat)._add(this._offset));\n let a2 = \"\";\n \"viewport\" === this._rotationAlignment || \"auto\" === this._rotationAlignment ? a2 = `rotateZ(${this._rotation}deg)` : \"map\" === this._rotationAlignment && (a2 = `rotateZ(${this._rotation - this._map.getBearing()}deg)`);\n let s2 = \"\";\n \"viewport\" === this._pitchAlignment || \"auto\" === this._pitchAlignment ? s2 = \"rotateX(0deg)\" : \"map\" === this._pitchAlignment && (s2 = `rotateX(${this._map.getPitch()}deg)`), this._subpixelPositioning || t5 && \"moveend\" !== t5.type || (this._pos = this._pos.round()), r.setTransform(this._element, `${Zs[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${s2} ${a2}`), o.frameAsync(new AbortController()).then(() => {\n this._updateOpacity(t5 && \"moveend\" === t5.type);\n }).catch(() => {\n });\n }, this._onMove = (t5) => {\n if (!this._isDragging) {\n const e2 = this._clickTolerance || this._map._clickTolerance;\n this._isDragging = t5.point.dist(this._pointerdownPos) >= e2;\n }\n this._isDragging && (this._pos = t5.point.sub(this._positionDelta), this._lngLat = this._map.unproject(this._pos), this.setLngLat(this._lngLat), this._element.style.pointerEvents = \"none\", \"pending\" === this._state && (this._state = \"active\", this.fire(new e.k(\"dragstart\"))), this.fire(new e.k(\"drag\")));\n }, this._onUp = () => {\n this._element.style.pointerEvents = \"auto\", this._positionDelta = null, this._pointerdownPos = null, this._isDragging = false, this._map.off(\"mousemove\", this._onMove), this._map.off(\"touchmove\", this._onMove), \"active\" === this._state && this.fire(new e.k(\"dragend\")), this._state = \"inactive\";\n }, this._addDragHandler = (t5) => {\n this._element.contains(t5.originalEvent.target) && (t5.preventDefault(), this._positionDelta = t5.point.sub(this._pos).add(this._offset), this._pointerdownPos = t5.point, this._state = \"pending\", this._map.on(\"mousemove\", this._onMove), this._map.on(\"touchmove\", this._onMove), this._map.once(\"mouseup\", this._onUp), this._map.once(\"touchend\", this._onUp));\n }, this._anchor = t4 && t4.anchor || \"center\", this._color = t4 && t4.color || \"#3FB1CE\", this._scale = t4 && t4.scale || 1, this._draggable = t4 && t4.draggable || false, this._clickTolerance = t4 && t4.clickTolerance || 0, this._subpixelPositioning = t4 && t4.subpixelPositioning || false, this._isDragging = false, this._state = \"inactive\", this._rotation = t4 && t4.rotation || 0, this._rotationAlignment = t4 && t4.rotationAlignment || \"auto\", this._pitchAlignment = t4 && t4.pitchAlignment && \"auto\" !== t4.pitchAlignment ? t4.pitchAlignment : this._rotationAlignment, this.setOpacity(), this.setOpacity(null == t4 ? void 0 : t4.opacity, null == t4 ? void 0 : t4.opacityWhenCovered), t4 && t4.element) this._element = t4.element, this._offset = e.P.convert(t4 && t4.offset || [0, 0]);\n else {\n this._defaultMarker = true, this._element = r.create(\"div\");\n const i2 = r.createNS(\"http://www.w3.org/2000/svg\", \"svg\"), a2 = 41, s2 = 27;\n i2.setAttributeNS(null, \"display\", \"block\"), i2.setAttributeNS(null, \"height\", `${a2}px`), i2.setAttributeNS(null, \"width\", `${s2}px`), i2.setAttributeNS(null, \"viewBox\", `0 0 ${s2} ${a2}`);\n const o2 = r.createNS(\"http://www.w3.org/2000/svg\", \"g\");\n o2.setAttributeNS(null, \"stroke\", \"none\"), o2.setAttributeNS(null, \"stroke-width\", \"1\"), o2.setAttributeNS(null, \"fill\", \"none\"), o2.setAttributeNS(null, \"fill-rule\", \"evenodd\");\n const n2 = r.createNS(\"http://www.w3.org/2000/svg\", \"g\");\n n2.setAttributeNS(null, \"fill-rule\", \"nonzero\");\n const l2 = r.createNS(\"http://www.w3.org/2000/svg\", \"g\");\n l2.setAttributeNS(null, \"transform\", \"translate(3.0, 29.0)\"), l2.setAttributeNS(null, \"fill\", \"#000000\");\n const h2 = [{ rx: \"10.5\", ry: \"5.25002273\" }, { rx: \"10.5\", ry: \"5.25002273\" }, { rx: \"9.5\", ry: \"4.77275007\" }, { rx: \"8.5\", ry: \"4.29549936\" }, { rx: \"7.5\", ry: \"3.81822308\" }, { rx: \"6.5\", ry: \"3.34094679\" }, { rx: \"5.5\", ry: \"2.86367051\" }, { rx: \"4.5\", ry: \"2.38636864\" }];\n for (const t5 of h2) {\n const e2 = r.createNS(\"http://www.w3.org/2000/svg\", \"ellipse\");\n e2.setAttributeNS(null, \"opacity\", \"0.04\"), e2.setAttributeNS(null, \"cx\", \"10.5\"), e2.setAttributeNS(null, \"cy\", \"5.80029008\"), e2.setAttributeNS(null, \"rx\", t5.rx), e2.setAttributeNS(null, \"ry\", t5.ry), l2.appendChild(e2);\n }\n const c2 = r.createNS(\"http://www.w3.org/2000/svg\", \"g\");\n c2.setAttributeNS(null, \"fill\", this._color);\n const u2 = r.createNS(\"http://www.w3.org/2000/svg\", \"path\");\n u2.setAttributeNS(null, \"d\", \"M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z\"), c2.appendChild(u2);\n const d2 = r.createNS(\"http://www.w3.org/2000/svg\", \"g\");\n d2.setAttributeNS(null, \"opacity\", \"0.25\"), d2.setAttributeNS(null, \"fill\", \"#000000\");\n const _2 = r.createNS(\"http://www.w3.org/2000/svg\", \"path\");\n _2.setAttributeNS(null, \"d\", \"M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z\"), d2.appendChild(_2);\n const p2 = r.createNS(\"http://www.w3.org/2000/svg\", \"g\");\n p2.setAttributeNS(null, \"transform\", \"translate(6.0, 7.0)\"), p2.setAttributeNS(null, \"fill\", \"#FFFFFF\");\n const m2 = r.createNS(\"http://www.w3.org/2000/svg\", \"g\");\n m2.setAttributeNS(null, \"transform\", \"translate(8.0, 8.0)\");\n const f2 = r.createNS(\"http://www.w3.org/2000/svg\", \"circle\");\n f2.setAttributeNS(null, \"fill\", \"#000000\"), f2.setAttributeNS(null, \"opacity\", \"0.25\"), f2.setAttributeNS(null, \"cx\", \"5.5\"), f2.setAttributeNS(null, \"cy\", \"5.5\"), f2.setAttributeNS(null, \"r\", \"5.4999962\");\n const g2 = r.createNS(\"http://www.w3.org/2000/svg\", \"circle\");\n g2.setAttributeNS(null, \"fill\", \"#FFFFFF\"), g2.setAttributeNS(null, \"cx\", \"5.5\"), g2.setAttributeNS(null, \"cy\", \"5.5\"), g2.setAttributeNS(null, \"r\", \"5.4999962\"), m2.appendChild(f2), m2.appendChild(g2), n2.appendChild(l2), n2.appendChild(c2), n2.appendChild(d2), n2.appendChild(p2), n2.appendChild(m2), i2.appendChild(n2), i2.setAttributeNS(null, \"height\", a2 * this._scale + \"px\"), i2.setAttributeNS(null, \"width\", s2 * this._scale + \"px\"), this._element.appendChild(i2), this._offset = e.P.convert(t4 && t4.offset || [0, -14]);\n }\n if (this._element.classList.add(\"maplibregl-marker\"), this._element.addEventListener(\"dragstart\", (t5) => {\n t5.preventDefault();\n }), this._element.addEventListener(\"mousedown\", (t5) => {\n t5.preventDefault();\n }), qs(this._element, this._anchor, \"marker\"), t4 && t4.className) for (const e2 of t4.className.split(\" \")) this._element.classList.add(e2);\n this._popup = null;\n }\n addTo(t4) {\n return this.remove(), this._map = t4, this._element.setAttribute(\"aria-label\", t4._getUIString(\"Marker.Title\")), t4.getCanvasContainer().appendChild(this._element), t4.on(\"move\", this._update), t4.on(\"moveend\", this._update), t4.on(\"terrain\", this._update), this.setDraggable(this._draggable), this._update(), this._map.on(\"click\", this._onMapClick), this;\n }\n remove() {\n return this._opacityTimeout && (clearTimeout(this._opacityTimeout), delete this._opacityTimeout), this._map && (this._map.off(\"click\", this._onMapClick), this._map.off(\"move\", this._update), this._map.off(\"moveend\", this._update), this._map.off(\"terrain\", this._update), this._map.off(\"mousedown\", this._addDragHandler), this._map.off(\"touchstart\", this._addDragHandler), this._map.off(\"mouseup\", this._onUp), this._map.off(\"touchend\", this._onUp), this._map.off(\"mousemove\", this._onMove), this._map.off(\"touchmove\", this._onMove), delete this._map), r.remove(this._element), this._popup && this._popup.remove(), this;\n }\n getLngLat() {\n return this._lngLat;\n }\n setLngLat(t4) {\n return this._lngLat = e.N.convert(t4), this._pos = null, this._popup && this._popup.setLngLat(this._lngLat), this._update(), this;\n }\n getElement() {\n return this._element;\n }\n setPopup(t4) {\n if (this._popup && (this._popup.remove(), this._popup = null, this._element.removeEventListener(\"keypress\", this._onKeyPress), this._originalTabIndex || this._element.removeAttribute(\"tabindex\")), t4) {\n if (!(\"offset\" in t4.options)) {\n const e2 = 38.1, i2 = 13.5, a2 = Math.abs(i2) / Math.SQRT2;\n t4.options.offset = this._defaultMarker ? { top: [0, 0], \"top-left\": [0, 0], \"top-right\": [0, 0], bottom: [0, -e2], \"bottom-left\": [a2, -1 * (e2 - i2 + a2)], \"bottom-right\": [-a2, -1 * (e2 - i2 + a2)], left: [i2, -1 * (e2 - i2)], right: [-i2, -1 * (e2 - i2)] } : this._offset;\n }\n this._popup = t4, this._originalTabIndex = this._element.getAttribute(\"tabindex\"), this._originalTabIndex || this._element.setAttribute(\"tabindex\", \"0\"), this._element.addEventListener(\"keypress\", this._onKeyPress);\n }\n return this;\n }\n setSubpixelPositioning(t4) {\n return this._subpixelPositioning = t4, this;\n }\n getPopup() {\n return this._popup;\n }\n togglePopup() {\n const t4 = this._popup;\n return this._element.style.opacity === this._opacityWhenCovered ? this : t4 ? (t4.isOpen() ? t4.remove() : (t4.setLngLat(this._lngLat), t4.addTo(this._map)), this) : this;\n }\n _updateOpacity(t4 = false) {\n var i2, a2;\n if (!(null === (i2 = this._map) || void 0 === i2 ? void 0 : i2.terrain)) return void (this._element.style.opacity !== this._opacity && (this._element.style.opacity = this._opacity));\n if (t4) this._opacityTimeout = null;\n else {\n if (this._opacityTimeout) return;\n this._opacityTimeout = setTimeout(() => {\n this._opacityTimeout = null;\n }, 100);\n }\n const s2 = this._map, o2 = s2.terrain.depthAtPoint(this._pos), r2 = s2.terrain.getElevationForLngLatZoom(this._lngLat, s2.transform.tileZoom);\n if (s2.transform.lngLatToCameraDepth(this._lngLat, r2) - o2 < 6e-3) return void (this._element.style.opacity = this._opacity);\n const n2 = -this._offset.y / s2.transform._pixelPerMeter, l2 = Math.sin(s2.getPitch() * Math.PI / 180) * n2, h2 = s2.terrain.depthAtPoint(new e.P(this._pos.x, this._pos.y - this._offset.y)), c2 = s2.transform.lngLatToCameraDepth(this._lngLat, r2 + l2) - h2 > 6e-3;\n (null === (a2 = this._popup) || void 0 === a2 ? void 0 : a2.isOpen()) && c2 && this._popup.remove(), this._element.style.opacity = c2 ? this._opacityWhenCovered : this._opacity;\n }\n getOffset() {\n return this._offset;\n }\n setOffset(t4) {\n return this._offset = e.P.convert(t4), this._update(), this;\n }\n addClassName(t4) {\n this._element.classList.add(t4);\n }\n removeClassName(t4) {\n this._element.classList.remove(t4);\n }\n toggleClassName(t4) {\n return this._element.classList.toggle(t4);\n }\n setDraggable(t4) {\n return this._draggable = !!t4, this._map && (t4 ? (this._map.on(\"mousedown\", this._addDragHandler), this._map.on(\"touchstart\", this._addDragHandler)) : (this._map.off(\"mousedown\", this._addDragHandler), this._map.off(\"touchstart\", this._addDragHandler))), this;\n }\n isDraggable() {\n return this._draggable;\n }\n setRotation(t4) {\n return this._rotation = t4 || 0, this._update(), this;\n }\n getRotation() {\n return this._rotation;\n }\n setRotationAlignment(t4) {\n return this._rotationAlignment = t4 || \"auto\", this._update(), this;\n }\n getRotationAlignment() {\n return this._rotationAlignment;\n }\n setPitchAlignment(t4) {\n return this._pitchAlignment = t4 && \"auto\" !== t4 ? t4 : this._rotationAlignment, this._update(), this;\n }\n getPitchAlignment() {\n return this._pitchAlignment;\n }\n setOpacity(t4, e2) {\n return void 0 === t4 && void 0 === e2 && (this._opacity = \"1\", this._opacityWhenCovered = \"0.2\"), void 0 !== t4 && (this._opacity = t4), void 0 !== e2 && (this._opacityWhenCovered = e2), this._map && this._updateOpacity(true), this;\n }\n }\n const Gs = { positionOptions: { enableHighAccuracy: false, maximumAge: 0, timeout: 6e3 }, fitBoundsOptions: { maxZoom: 15 }, trackUserLocation: false, showAccuracyCircle: true, showUserLocation: true };\n let Hs = 0, Ws = false;\n const $s = { maxWidth: 100, unit: \"metric\" };\n function Xs(t4, e2, i2) {\n const a2 = i2 && i2.maxWidth || 100, s2 = t4._container.clientHeight / 2, o2 = t4.unproject([0, s2]), r2 = t4.unproject([a2, s2]), n2 = o2.distanceTo(r2);\n if (i2 && \"imperial\" === i2.unit) {\n const i3 = 3.2808 * n2;\n i3 > 5280 ? Ks(e2, a2, i3 / 5280, t4._getUIString(\"ScaleControl.Miles\")) : Ks(e2, a2, i3, t4._getUIString(\"ScaleControl.Feet\"));\n } else i2 && \"nautical\" === i2.unit ? Ks(e2, a2, n2 / 1852, t4._getUIString(\"ScaleControl.NauticalMiles\")) : n2 >= 1e3 ? Ks(e2, a2, n2 / 1e3, t4._getUIString(\"ScaleControl.Kilometers\")) : Ks(e2, a2, n2, t4._getUIString(\"ScaleControl.Meters\"));\n }\n function Ks(t4, e2, i2, a2) {\n const s2 = function(t5) {\n const e3 = Math.pow(10, `${Math.floor(t5)}`.length - 1);\n let i3 = t5 / e3;\n return i3 = i3 >= 10 ? 10 : i3 >= 5 ? 5 : i3 >= 3 ? 3 : i3 >= 2 ? 2 : i3 >= 1 ? 1 : function(t6) {\n const e4 = Math.pow(10, Math.ceil(-Math.log(t6) / Math.LN10));\n return Math.round(t6 * e4) / e4;\n }(i3), e3 * i3;\n }(i2);\n t4.style.width = e2 * (s2 / i2) + \"px\", t4.innerHTML = `${s2} ${a2}`;\n }\n const Js = { closeButton: true, closeOnClick: true, focusAfterOpen: true, className: \"\", maxWidth: \"240px\", subpixelPositioning: false }, Ys = [\"a[href]\", \"[tabindex]:not([tabindex='-1'])\", \"[contenteditable]:not([contenteditable='false'])\", \"button:not([disabled])\", \"input:not([disabled])\", \"select:not([disabled])\", \"textarea:not([disabled])\"].join(\", \");\n function Qs(t4) {\n if (t4) {\n if (\"number\" == typeof t4) {\n const i2 = Math.round(Math.abs(t4) / Math.SQRT2);\n return { center: new e.P(0, 0), top: new e.P(0, t4), \"top-left\": new e.P(i2, i2), \"top-right\": new e.P(-i2, i2), bottom: new e.P(0, -t4), \"bottom-left\": new e.P(i2, -i2), \"bottom-right\": new e.P(-i2, -i2), left: new e.P(t4, 0), right: new e.P(-t4, 0) };\n }\n if (t4 instanceof e.P || Array.isArray(t4)) {\n const i2 = e.P.convert(t4);\n return { center: i2, top: i2, \"top-left\": i2, \"top-right\": i2, bottom: i2, \"bottom-left\": i2, \"bottom-right\": i2, left: i2, right: i2 };\n }\n return { center: e.P.convert(t4.center || [0, 0]), top: e.P.convert(t4.top || [0, 0]), \"top-left\": e.P.convert(t4[\"top-left\"] || [0, 0]), \"top-right\": e.P.convert(t4[\"top-right\"] || [0, 0]), bottom: e.P.convert(t4.bottom || [0, 0]), \"bottom-left\": e.P.convert(t4[\"bottom-left\"] || [0, 0]), \"bottom-right\": e.P.convert(t4[\"bottom-right\"] || [0, 0]), left: e.P.convert(t4.left || [0, 0]), right: e.P.convert(t4.right || [0, 0]) };\n }\n return Qs(new e.P(0, 0));\n }\n const to = i;\n t.AJAXError = e.bh, t.Evented = e.E, t.LngLat = e.N, t.MercatorCoordinate = e.Z, t.Point = e.P, t.addProtocol = e.bi, t.config = e.a, t.removeProtocol = e.bj, t.AttributionControl = Es, t.BoxZoomHandler = Ua, t.CanvasSource = et, t.CooperativeGesturesHandler = vs, t.DoubleClickZoomHandler = ds, t.DragPanHandler = ms, t.DragRotateHandler = fs, t.EdgeInsets = ba, t.FullscreenControl = class extends e.E {\n constructor(t4 = {}) {\n super(), this._onFullscreenChange = () => {\n var t5;\n let e2 = window.document.fullscreenElement || window.document.mozFullScreenElement || window.document.webkitFullscreenElement || window.document.msFullscreenElement;\n for (; null === (t5 = null == e2 ? void 0 : e2.shadowRoot) || void 0 === t5 ? void 0 : t5.fullscreenElement; ) e2 = e2.shadowRoot.fullscreenElement;\n e2 === this._container !== this._fullscreen && this._handleFullscreenChange();\n }, this._onClickFullscreen = () => {\n this._isFullscreen() ? this._exitFullscreen() : this._requestFullscreen();\n }, this._fullscreen = false, t4 && t4.container && (t4.container instanceof HTMLElement ? this._container = t4.container : e.w(\"Full screen control 'container' must be a DOM element.\")), \"onfullscreenchange\" in document ? this._fullscreenchange = \"fullscreenchange\" : \"onmozfullscreenchange\" in document ? this._fullscreenchange = \"mozfullscreenchange\" : \"onwebkitfullscreenchange\" in document ? this._fullscreenchange = \"webkitfullscreenchange\" : \"onmsfullscreenchange\" in document && (this._fullscreenchange = \"MSFullscreenChange\");\n }\n onAdd(t4) {\n return this._map = t4, this._container || (this._container = this._map.getContainer()), this._controlContainer = r.create(\"div\", \"maplibregl-ctrl maplibregl-ctrl-group\"), this._setupUI(), this._controlContainer;\n }\n onRemove() {\n r.remove(this._controlContainer), this._map = null, window.document.removeEventListener(this._fullscreenchange, this._onFullscreenChange);\n }\n _setupUI() {\n const t4 = this._fullscreenButton = r.create(\"button\", \"maplibregl-ctrl-fullscreen\", this._controlContainer);\n r.create(\"span\", \"maplibregl-ctrl-icon\", t4).setAttribute(\"aria-hidden\", \"true\"), t4.type = \"button\", this._updateTitle(), this._fullscreenButton.addEventListener(\"click\", this._onClickFullscreen), window.document.addEventListener(this._fullscreenchange, this._onFullscreenChange);\n }\n _updateTitle() {\n const t4 = this._getTitle();\n this._fullscreenButton.setAttribute(\"aria-label\", t4), this._fullscreenButton.title = t4;\n }\n _getTitle() {\n return this._map._getUIString(this._isFullscreen() ? \"FullscreenControl.Exit\" : \"FullscreenControl.Enter\");\n }\n _isFullscreen() {\n return this._fullscreen;\n }\n _handleFullscreenChange() {\n this._fullscreen = !this._fullscreen, this._fullscreenButton.classList.toggle(\"maplibregl-ctrl-shrink\"), this._fullscreenButton.classList.toggle(\"maplibregl-ctrl-fullscreen\"), this._updateTitle(), this._fullscreen ? (this.fire(new e.k(\"fullscreenstart\")), this._prevCooperativeGesturesEnabled = this._map.cooperativeGestures.isEnabled(), this._map.cooperativeGestures.disable()) : (this.fire(new e.k(\"fullscreenend\")), this._prevCooperativeGesturesEnabled && this._map.cooperativeGestures.enable());\n }\n _exitFullscreen() {\n window.document.exitFullscreen ? window.document.exitFullscreen() : window.document.mozCancelFullScreen ? window.document.mozCancelFullScreen() : window.document.msExitFullscreen ? window.document.msExitFullscreen() : window.document.webkitCancelFullScreen ? window.document.webkitCancelFullScreen() : this._togglePseudoFullScreen();\n }\n _requestFullscreen() {\n this._container.requestFullscreen ? this._container.requestFullscreen() : this._container.mozRequestFullScreen ? this._container.mozRequestFullScreen() : this._container.msRequestFullscreen ? this._container.msRequestFullscreen() : this._container.webkitRequestFullscreen ? this._container.webkitRequestFullscreen() : this._togglePseudoFullScreen();\n }\n _togglePseudoFullScreen() {\n this._container.classList.toggle(\"maplibregl-pseudo-fullscreen\"), this._handleFullscreenChange(), this._map.resize();\n }\n }, t.GeoJSONSource = J, t.GeolocateControl = class extends e.E {\n constructor(t4) {\n super(), this._onSuccess = (t5) => {\n if (this._map) {\n if (this._isOutOfMapMaxBounds(t5)) return this._setErrorState(), this.fire(new e.k(\"outofmaxbounds\", t5)), this._updateMarker(), void this._finish();\n if (this.options.trackUserLocation) switch (this._lastKnownPosition = t5, this._watchState) {\n case \"WAITING_ACTIVE\":\n case \"ACTIVE_LOCK\":\n case \"ACTIVE_ERROR\":\n this._watchState = \"ACTIVE_LOCK\", this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"), this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active-error\"), this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active\");\n break;\n case \"BACKGROUND\":\n case \"BACKGROUND_ERROR\":\n this._watchState = \"BACKGROUND\", this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"), this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background-error\"), this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-background\");\n break;\n default:\n throw new Error(`Unexpected watchState ${this._watchState}`);\n }\n this.options.showUserLocation && \"OFF\" !== this._watchState && this._updateMarker(t5), this.options.trackUserLocation && \"ACTIVE_LOCK\" !== this._watchState || this._updateCamera(t5), this.options.showUserLocation && this._dotElement.classList.remove(\"maplibregl-user-location-dot-stale\"), this.fire(new e.k(\"geolocate\", t5)), this._finish();\n }\n }, this._updateCamera = (t5) => {\n const i2 = new e.N(t5.coords.longitude, t5.coords.latitude), a2 = t5.coords.accuracy, s2 = this._map.getBearing(), o2 = e.e({ bearing: s2 }, this.options.fitBoundsOptions), r2 = H.fromLngLat(i2, a2);\n this._map.fitBounds(r2, o2, { geolocateSource: true });\n }, this._updateMarker = (t5) => {\n if (t5) {\n const i2 = new e.N(t5.coords.longitude, t5.coords.latitude);\n this._accuracyCircleMarker.setLngLat(i2).addTo(this._map), this._userLocationDotMarker.setLngLat(i2).addTo(this._map), this._accuracy = t5.coords.accuracy, this.options.showUserLocation && this.options.showAccuracyCircle && this._updateCircleRadius();\n } else this._userLocationDotMarker.remove(), this._accuracyCircleMarker.remove();\n }, this._onZoom = () => {\n this.options.showUserLocation && this.options.showAccuracyCircle && this._updateCircleRadius();\n }, this._onError = (t5) => {\n if (this._map) {\n if (this.options.trackUserLocation) if (1 === t5.code) {\n this._watchState = \"OFF\", this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"), this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"), this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active-error\"), this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background\"), this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background-error\"), this._geolocateButton.disabled = true;\n const t6 = this._map._getUIString(\"GeolocateControl.LocationNotAvailable\");\n this._geolocateButton.title = t6, this._geolocateButton.setAttribute(\"aria-label\", t6), void 0 !== this._geolocationWatchID && this._clearWatch();\n } else {\n if (3 === t5.code && Ws) return;\n this._setErrorState();\n }\n \"OFF\" !== this._watchState && this.options.showUserLocation && this._dotElement.classList.add(\"maplibregl-user-location-dot-stale\"), this.fire(new e.k(\"error\", t5)), this._finish();\n }\n }, this._finish = () => {\n this._timeoutId && clearTimeout(this._timeoutId), this._timeoutId = void 0;\n }, this._setupUI = () => {\n this._map && (this._container.addEventListener(\"contextmenu\", (t5) => t5.preventDefault()), this._geolocateButton = r.create(\"button\", \"maplibregl-ctrl-geolocate\", this._container), r.create(\"span\", \"maplibregl-ctrl-icon\", this._geolocateButton).setAttribute(\"aria-hidden\", \"true\"), this._geolocateButton.type = \"button\", this._geolocateButton.disabled = true);\n }, this._finishSetupUI = (t5) => {\n if (this._map) {\n if (false === t5) {\n e.w(\"Geolocation support is not available so the GeolocateControl will be disabled.\");\n const t6 = this._map._getUIString(\"GeolocateControl.LocationNotAvailable\");\n this._geolocateButton.disabled = true, this._geolocateButton.title = t6, this._geolocateButton.setAttribute(\"aria-label\", t6);\n } else {\n const t6 = this._map._getUIString(\"GeolocateControl.FindMyLocation\");\n this._geolocateButton.disabled = false, this._geolocateButton.title = t6, this._geolocateButton.setAttribute(\"aria-label\", t6);\n }\n this.options.trackUserLocation && (this._geolocateButton.setAttribute(\"aria-pressed\", \"false\"), this._watchState = \"OFF\"), this.options.showUserLocation && (this._dotElement = r.create(\"div\", \"maplibregl-user-location-dot\"), this._userLocationDotMarker = new Vs({ element: this._dotElement }), this._circleElement = r.create(\"div\", \"maplibregl-user-location-accuracy-circle\"), this._accuracyCircleMarker = new Vs({ element: this._circleElement, pitchAlignment: \"map\" }), this.options.trackUserLocation && (this._watchState = \"OFF\"), this._map.on(\"zoom\", this._onZoom)), this._geolocateButton.addEventListener(\"click\", () => this.trigger()), this._setup = true, this.options.trackUserLocation && this._map.on(\"movestart\", (t6) => {\n t6.geolocateSource || \"ACTIVE_LOCK\" !== this._watchState || t6.originalEvent && \"resize\" === t6.originalEvent.type || (this._watchState = \"BACKGROUND\", this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-background\"), this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"), this.fire(new e.k(\"trackuserlocationend\")), this.fire(new e.k(\"userlocationlostfocus\")));\n });\n }\n }, this.options = e.e({}, Gs, t4);\n }\n onAdd(t4) {\n return this._map = t4, this._container = r.create(\"div\", \"maplibregl-ctrl maplibregl-ctrl-group\"), this._setupUI(), function() {\n return e._(this, arguments, void 0, function* (t5 = false) {\n if (void 0 !== Us && !t5) return Us;\n if (void 0 === window.navigator.permissions) return Us = !!window.navigator.geolocation, Us;\n try {\n const t6 = yield window.navigator.permissions.query({ name: \"geolocation\" });\n Us = \"denied\" !== t6.state;\n } catch (t6) {\n Us = !!window.navigator.geolocation;\n }\n return Us;\n });\n }().then((t5) => this._finishSetupUI(t5)), this._container;\n }\n onRemove() {\n void 0 !== this._geolocationWatchID && (window.navigator.geolocation.clearWatch(this._geolocationWatchID), this._geolocationWatchID = void 0), this.options.showUserLocation && this._userLocationDotMarker && this._userLocationDotMarker.remove(), this.options.showAccuracyCircle && this._accuracyCircleMarker && this._accuracyCircleMarker.remove(), r.remove(this._container), this._map.off(\"zoom\", this._onZoom), this._map = void 0, Hs = 0, Ws = false;\n }\n _isOutOfMapMaxBounds(t4) {\n const e2 = this._map.getMaxBounds(), i2 = t4.coords;\n return e2 && (i2.longitude < e2.getWest() || i2.longitude > e2.getEast() || i2.latitude < e2.getSouth() || i2.latitude > e2.getNorth());\n }\n _setErrorState() {\n switch (this._watchState) {\n case \"WAITING_ACTIVE\":\n this._watchState = \"ACTIVE_ERROR\", this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"), this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active-error\");\n break;\n case \"ACTIVE_LOCK\":\n this._watchState = \"ACTIVE_ERROR\", this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"), this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active-error\"), this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\");\n break;\n case \"BACKGROUND\":\n this._watchState = \"BACKGROUND_ERROR\", this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background\"), this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-background-error\"), this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\");\n break;\n case \"ACTIVE_ERROR\":\n break;\n default:\n throw new Error(`Unexpected watchState ${this._watchState}`);\n }\n }\n _updateCircleRadius() {\n const t4 = this._map.getBounds(), e2 = t4.getSouthEast(), i2 = t4.getNorthEast(), a2 = e2.distanceTo(i2), s2 = Math.ceil(this._accuracy / (a2 / this._map._container.clientHeight) * 2);\n this._circleElement.style.width = `${s2}px`, this._circleElement.style.height = `${s2}px`;\n }\n trigger() {\n if (!this._setup) return e.w(\"Geolocate control triggered before added to a map\"), false;\n if (this.options.trackUserLocation) {\n switch (this._watchState) {\n case \"OFF\":\n this._watchState = \"WAITING_ACTIVE\", this.fire(new e.k(\"trackuserlocationstart\"));\n break;\n case \"WAITING_ACTIVE\":\n case \"ACTIVE_LOCK\":\n case \"ACTIVE_ERROR\":\n case \"BACKGROUND_ERROR\":\n Hs--, Ws = false, this._watchState = \"OFF\", this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"), this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"), this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active-error\"), this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background\"), this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background-error\"), this.fire(new e.k(\"trackuserlocationend\"));\n break;\n case \"BACKGROUND\":\n this._watchState = \"ACTIVE_LOCK\", this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background\"), this._lastKnownPosition && this._updateCamera(this._lastKnownPosition), this.fire(new e.k(\"trackuserlocationstart\")), this.fire(new e.k(\"userlocationfocus\"));\n break;\n default:\n throw new Error(`Unexpected watchState ${this._watchState}`);\n }\n switch (this._watchState) {\n case \"WAITING_ACTIVE\":\n this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\"), this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active\");\n break;\n case \"ACTIVE_LOCK\":\n this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active\");\n break;\n case \"OFF\":\n break;\n default:\n throw new Error(`Unexpected watchState ${this._watchState}`);\n }\n if (\"OFF\" === this._watchState && void 0 !== this._geolocationWatchID) this._clearWatch();\n else if (void 0 === this._geolocationWatchID) {\n let t4;\n this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\"), this._geolocateButton.setAttribute(\"aria-pressed\", \"true\"), Hs++, Hs > 1 ? (t4 = { maximumAge: 6e5, timeout: 0 }, Ws = true) : (t4 = this.options.positionOptions, Ws = false), this._geolocationWatchID = window.navigator.geolocation.watchPosition(this._onSuccess, this._onError, t4);\n }\n } else window.navigator.geolocation.getCurrentPosition(this._onSuccess, this._onError, this.options.positionOptions), this._timeoutId = setTimeout(this._finish, 1e4);\n return true;\n }\n _clearWatch() {\n window.navigator.geolocation.clearWatch(this._geolocationWatchID), this._geolocationWatchID = void 0, this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"), this._geolocateButton.setAttribute(\"aria-pressed\", \"false\"), this.options.showUserLocation && this._updateMarker(null);\n }\n }, t.Hash = Ea, t.ImageSource = Q, t.KeyboardHandler = ls, t.LngLatBounds = H, t.LogoControl = Ps, t.Map = class extends Ts {\n constructor(t4) {\n e.bf.mark(e.bg.create);\n const i2 = Object.assign(Object.assign({}, Fs), t4);\n if (null != i2.minZoom && null != i2.maxZoom && i2.minZoom > i2.maxZoom) throw new Error(\"maxZoom must be greater than or equal to minZoom\");\n if (null != i2.minPitch && null != i2.maxPitch && i2.minPitch > i2.maxPitch) throw new Error(\"maxPitch must be greater than or equal to minPitch\");\n if (null != i2.minPitch && i2.minPitch < 0) throw new Error(\"minPitch must be greater than or equal to 0\");\n if (null != i2.maxPitch && i2.maxPitch > 85) throw new Error(\"maxPitch must be less than or equal to 85\");\n if (super(new Ta(i2.minZoom, i2.maxZoom, i2.minPitch, i2.maxPitch, i2.renderWorldCopies), { bearingSnap: i2.bearingSnap }), this._idleTriggered = false, this._crossFadingFactor = 1, this._renderTaskQueue = new Cs(), this._controls = [], this._mapId = e.a4(), this._contextLost = (t5) => {\n t5.preventDefault(), this._frameRequest && (this._frameRequest.abort(), this._frameRequest = null), this.fire(new e.k(\"webglcontextlost\", { originalEvent: t5 }));\n }, this._contextRestored = (t5) => {\n this._setupPainter(), this.resize(), this._update(), this.fire(new e.k(\"webglcontextrestored\", { originalEvent: t5 }));\n }, this._onMapScroll = (t5) => {\n if (t5.target === this._container) return this._container.scrollTop = 0, this._container.scrollLeft = 0, false;\n }, this._onWindowOnline = () => {\n this._update();\n }, this._interactive = i2.interactive, this._maxTileCacheSize = i2.maxTileCacheSize, this._maxTileCacheZoomLevels = i2.maxTileCacheZoomLevels, this._failIfMajorPerformanceCaveat = true === i2.failIfMajorPerformanceCaveat, this._preserveDrawingBuffer = true === i2.preserveDrawingBuffer, this._antialias = true === i2.antialias, this._trackResize = true === i2.trackResize, this._bearingSnap = i2.bearingSnap, this._refreshExpiredTiles = true === i2.refreshExpiredTiles, this._fadeDuration = i2.fadeDuration, this._crossSourceCollisions = true === i2.crossSourceCollisions, this._collectResourceTiming = true === i2.collectResourceTiming, this._locale = Object.assign(Object.assign({}, ks), i2.locale), this._clickTolerance = i2.clickTolerance, this._overridePixelRatio = i2.pixelRatio, this._maxCanvasSize = i2.maxCanvasSize, this.transformCameraUpdate = i2.transformCameraUpdate, this.cancelPendingTileRequestsWhileZooming = true === i2.cancelPendingTileRequestsWhileZooming, this._imageQueueHandle = _.addThrottleControl(() => this.isMoving()), this._requestManager = new p(i2.transformRequest), \"string\" == typeof i2.container) {\n if (this._container = document.getElementById(i2.container), !this._container) throw new Error(`Container '${i2.container}' not found.`);\n } else {\n if (!(i2.container instanceof HTMLElement)) throw new Error(\"Invalid type: 'container' must be a String or HTMLElement.\");\n this._container = i2.container;\n }\n if (i2.maxBounds && this.setMaxBounds(i2.maxBounds), this._setupContainer(), this._setupPainter(), this.on(\"move\", () => this._update(false)).on(\"moveend\", () => this._update(false)).on(\"zoom\", () => this._update(true)).on(\"terrain\", () => {\n this.painter.terrainFacilitator.dirty = true, this._update(true);\n }).once(\"idle\", () => {\n this._idleTriggered = true;\n }), \"undefined\" != typeof window) {\n addEventListener(\"online\", this._onWindowOnline, false);\n let t5 = false;\n const e2 = Ia((t6) => {\n this._trackResize && !this._removed && (this.resize(t6), this.redraw());\n }, 50);\n this._resizeObserver = new ResizeObserver((i3) => {\n t5 ? e2(i3) : t5 = true;\n }), this._resizeObserver.observe(this._container);\n }\n this.handlers = new ws(this, i2), this._hash = i2.hash && new Ea(\"string\" == typeof i2.hash && i2.hash || void 0).addTo(this), this._hash && this._hash._onHashChange() || (this.jumpTo({ center: i2.center, zoom: i2.zoom, bearing: i2.bearing, pitch: i2.pitch }), i2.bounds && (this.resize(), this.fitBounds(i2.bounds, e.e({}, i2.fitBoundsOptions, { duration: 0 })))), this.resize(), this._localIdeographFontFamily = i2.localIdeographFontFamily, this._validateStyle = i2.validateStyle, i2.style && this.setStyle(i2.style, { localIdeographFontFamily: i2.localIdeographFontFamily }), i2.attributionControl && this.addControl(new Es(\"boolean\" == typeof i2.attributionControl ? void 0 : i2.attributionControl)), i2.maplibreLogo && this.addControl(new Ps(), i2.logoPosition), this.on(\"style.load\", () => {\n this.transform.unmodified && this.jumpTo(this.style.stylesheet);\n }), this.on(\"data\", (t5) => {\n this._update(\"style\" === t5.dataType), this.fire(new e.k(`${t5.dataType}data`, t5));\n }), this.on(\"dataloading\", (t5) => {\n this.fire(new e.k(`${t5.dataType}dataloading`, t5));\n }), this.on(\"dataabort\", (t5) => {\n this.fire(new e.k(\"sourcedataabort\", t5));\n });\n }\n _getMapId() {\n return this._mapId;\n }\n addControl(t4, i2) {\n if (void 0 === i2 && (i2 = t4.getDefaultPosition ? t4.getDefaultPosition() : \"top-right\"), !t4 || !t4.onAdd) return this.fire(new e.j(new Error(\"Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.\")));\n const a2 = t4.onAdd(this);\n this._controls.push(t4);\n const s2 = this._controlPositions[i2];\n return -1 !== i2.indexOf(\"bottom\") ? s2.insertBefore(a2, s2.firstChild) : s2.appendChild(a2), this;\n }\n removeControl(t4) {\n if (!t4 || !t4.onRemove) return this.fire(new e.j(new Error(\"Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.\")));\n const i2 = this._controls.indexOf(t4);\n return i2 > -1 && this._controls.splice(i2, 1), t4.onRemove(this), this;\n }\n hasControl(t4) {\n return this._controls.indexOf(t4) > -1;\n }\n calculateCameraOptionsFromTo(t4, e2, i2, a2) {\n return null == a2 && this.terrain && (a2 = this.terrain.getElevationForLngLatZoom(i2, this.transform.tileZoom)), super.calculateCameraOptionsFromTo(t4, e2, i2, a2);\n }\n resize(t4) {\n var i2;\n const a2 = this._containerDimensions(), s2 = a2[0], o2 = a2[1], r2 = this._getClampedPixelRatio(s2, o2);\n if (this._resizeCanvas(s2, o2, r2), this.painter.resize(s2, o2, r2), this.painter.overLimit()) {\n const t5 = this.painter.context.gl;\n this._maxCanvasSize = [t5.drawingBufferWidth, t5.drawingBufferHeight];\n const e2 = this._getClampedPixelRatio(s2, o2);\n this._resizeCanvas(s2, o2, e2), this.painter.resize(s2, o2, e2);\n }\n this.transform.resize(s2, o2), null === (i2 = this._requestedCameraState) || void 0 === i2 || i2.resize(s2, o2);\n const n2 = !this._moving;\n return n2 && (this.stop(), this.fire(new e.k(\"movestart\", t4)).fire(new e.k(\"move\", t4))), this.fire(new e.k(\"resize\", t4)), n2 && this.fire(new e.k(\"moveend\", t4)), this;\n }\n _getClampedPixelRatio(t4, e2) {\n const { 0: i2, 1: a2 } = this._maxCanvasSize, s2 = this.getPixelRatio(), o2 = t4 * s2, r2 = e2 * s2;\n return Math.min(o2 > i2 ? i2 / o2 : 1, r2 > a2 ? a2 / r2 : 1) * s2;\n }\n getPixelRatio() {\n var t4;\n return null !== (t4 = this._overridePixelRatio) && void 0 !== t4 ? t4 : devicePixelRatio;\n }\n setPixelRatio(t4) {\n this._overridePixelRatio = t4, this.resize();\n }\n getBounds() {\n return this.transform.getBounds();\n }\n getMaxBounds() {\n return this.transform.getMaxBounds();\n }\n setMaxBounds(t4) {\n return this.transform.setMaxBounds(H.convert(t4)), this._update();\n }\n setMinZoom(t4) {\n if ((t4 = null == t4 ? -2 : t4) >= -2 && t4 <= this.transform.maxZoom) return this.transform.minZoom = t4, this._update(), this.getZoom() < t4 && this.setZoom(t4), this;\n throw new Error(\"minZoom must be between -2 and the current maxZoom, inclusive\");\n }\n getMinZoom() {\n return this.transform.minZoom;\n }\n setMaxZoom(t4) {\n if ((t4 = null == t4 ? 22 : t4) >= this.transform.minZoom) return this.transform.maxZoom = t4, this._update(), this.getZoom() > t4 && this.setZoom(t4), this;\n throw new Error(\"maxZoom must be greater than the current minZoom\");\n }\n getMaxZoom() {\n return this.transform.maxZoom;\n }\n setMinPitch(t4) {\n if ((t4 = null == t4 ? 0 : t4) < 0) throw new Error(\"minPitch must be greater than or equal to 0\");\n if (t4 >= 0 && t4 <= this.transform.maxPitch) return this.transform.minPitch = t4, this._update(), this.getPitch() < t4 && this.setPitch(t4), this;\n throw new Error(\"minPitch must be between 0 and the current maxPitch, inclusive\");\n }\n getMinPitch() {\n return this.transform.minPitch;\n }\n setMaxPitch(t4) {\n if ((t4 = null == t4 ? 60 : t4) > 85) throw new Error(\"maxPitch must be less than or equal to 85\");\n if (t4 >= this.transform.minPitch) return this.transform.maxPitch = t4, this._update(), this.getPitch() > t4 && this.setPitch(t4), this;\n throw new Error(\"maxPitch must be greater than the current minPitch\");\n }\n getMaxPitch() {\n return this.transform.maxPitch;\n }\n getRenderWorldCopies() {\n return this.transform.renderWorldCopies;\n }\n setRenderWorldCopies(t4) {\n return this.transform.renderWorldCopies = t4, this._update();\n }\n project(t4) {\n return this.transform.locationPoint(e.N.convert(t4), this.style && this.terrain);\n }\n unproject(t4) {\n return this.transform.pointLocation(e.P.convert(t4), this.terrain);\n }\n isMoving() {\n var t4;\n return this._moving || (null === (t4 = this.handlers) || void 0 === t4 ? void 0 : t4.isMoving());\n }\n isZooming() {\n var t4;\n return this._zooming || (null === (t4 = this.handlers) || void 0 === t4 ? void 0 : t4.isZooming());\n }\n isRotating() {\n var t4;\n return this._rotating || (null === (t4 = this.handlers) || void 0 === t4 ? void 0 : t4.isRotating());\n }\n _createDelegatedListener(t4, e2, i2) {\n if (\"mouseenter\" === t4 || \"mouseover\" === t4) {\n let a2 = false;\n const s2 = (s3) => {\n const o2 = e2.filter((t5) => this.getLayer(t5)), r2 = 0 !== o2.length ? this.queryRenderedFeatures(s3.point, { layers: o2 }) : [];\n r2.length ? a2 || (a2 = true, i2.call(this, new ka(t4, this, s3.originalEvent, { features: r2 }))) : a2 = false;\n };\n return { layers: e2, listener: i2, delegates: { mousemove: s2, mouseout: () => {\n a2 = false;\n } } };\n }\n if (\"mouseleave\" === t4 || \"mouseout\" === t4) {\n let a2 = false;\n const s2 = (s3) => {\n const o3 = e2.filter((t5) => this.getLayer(t5));\n (0 !== o3.length ? this.queryRenderedFeatures(s3.point, { layers: o3 }) : []).length ? a2 = true : a2 && (a2 = false, i2.call(this, new ka(t4, this, s3.originalEvent)));\n }, o2 = (e3) => {\n a2 && (a2 = false, i2.call(this, new ka(t4, this, e3.originalEvent)));\n };\n return { layers: e2, listener: i2, delegates: { mousemove: s2, mouseout: o2 } };\n }\n {\n const a2 = (t5) => {\n const a3 = e2.filter((t6) => this.getLayer(t6)), s2 = 0 !== a3.length ? this.queryRenderedFeatures(t5.point, { layers: a3 }) : [];\n s2.length && (t5.features = s2, i2.call(this, t5), delete t5.features);\n };\n return { layers: e2, listener: i2, delegates: { [t4]: a2 } };\n }\n }\n _saveDelegatedListener(t4, e2) {\n this._delegatedListeners = this._delegatedListeners || {}, this._delegatedListeners[t4] = this._delegatedListeners[t4] || [], this._delegatedListeners[t4].push(e2);\n }\n _removeDelegatedListener(t4, e2, i2) {\n if (!this._delegatedListeners || !this._delegatedListeners[t4]) return;\n const a2 = this._delegatedListeners[t4];\n for (let t5 = 0; t5 < a2.length; t5++) {\n const s2 = a2[t5];\n if (s2.listener === i2 && s2.layers.length === e2.length && s2.layers.every((t6) => e2.includes(t6))) {\n for (const t6 in s2.delegates) this.off(t6, s2.delegates[t6]);\n return void a2.splice(t5, 1);\n }\n }\n }\n on(t4, e2, i2) {\n if (void 0 === i2) return super.on(t4, e2);\n const a2 = this._createDelegatedListener(t4, \"string\" == typeof e2 ? [e2] : e2, i2);\n this._saveDelegatedListener(t4, a2);\n for (const t5 in a2.delegates) this.on(t5, a2.delegates[t5]);\n return this;\n }\n once(t4, e2, i2) {\n if (void 0 === i2) return super.once(t4, e2);\n const a2 = \"string\" == typeof e2 ? [e2] : e2, s2 = this._createDelegatedListener(t4, a2, i2);\n for (const e3 in s2.delegates) {\n const o2 = s2.delegates[e3];\n s2.delegates[e3] = (...e4) => {\n this._removeDelegatedListener(t4, a2, i2), o2(...e4);\n };\n }\n this._saveDelegatedListener(t4, s2);\n for (const t5 in s2.delegates) this.once(t5, s2.delegates[t5]);\n return this;\n }\n off(t4, e2, i2) {\n return void 0 === i2 ? super.off(t4, e2) : (this._removeDelegatedListener(t4, \"string\" == typeof e2 ? [e2] : e2, i2), this);\n }\n queryRenderedFeatures(t4, i2) {\n if (!this.style) return [];\n let a2;\n const s2 = t4 instanceof e.P || Array.isArray(t4), o2 = s2 ? t4 : [[0, 0], [this.transform.width, this.transform.height]];\n if (i2 = i2 || (s2 ? {} : t4) || {}, o2 instanceof e.P || \"number\" == typeof o2[0]) a2 = [e.P.convert(o2)];\n else {\n const t5 = e.P.convert(o2[0]), i3 = e.P.convert(o2[1]);\n a2 = [t5, new e.P(i3.x, t5.y), i3, new e.P(t5.x, i3.y), t5];\n }\n return this.style.queryRenderedFeatures(a2, i2, this.transform);\n }\n querySourceFeatures(t4, e2) {\n return this.style.querySourceFeatures(t4, e2);\n }\n setStyle(t4, i2) {\n return false !== (i2 = e.e({}, { localIdeographFontFamily: this._localIdeographFontFamily, validate: this._validateStyle }, i2)).diff && i2.localIdeographFontFamily === this._localIdeographFontFamily && this.style && t4 ? (this._diffStyle(t4, i2), this) : (this._localIdeographFontFamily = i2.localIdeographFontFamily, this._updateStyle(t4, i2));\n }\n setTransformRequest(t4) {\n return this._requestManager.setTransformRequest(t4), this;\n }\n _getUIString(t4) {\n const e2 = this._locale[t4];\n if (null == e2) throw new Error(`Missing UI string '${t4}'`);\n return e2;\n }\n _updateStyle(t4, e2) {\n if (e2.transformStyle && this.style && !this.style._loaded) return void this.style.once(\"style.load\", () => this._updateStyle(t4, e2));\n const i2 = this.style && e2.transformStyle ? this.style.serialize() : void 0;\n return this.style && (this.style.setEventedParent(null), this.style._remove(!t4)), t4 ? (this.style = new de(this, e2 || {}), this.style.setEventedParent(this, { style: this.style }), \"string\" == typeof t4 ? this.style.loadURL(t4, e2, i2) : this.style.loadJSON(t4, e2, i2), this) : (delete this.style, this);\n }\n _lazyInitEmptyStyle() {\n this.style || (this.style = new de(this, {}), this.style.setEventedParent(this, { style: this.style }), this.style.loadEmpty());\n }\n _diffStyle(t4, i2) {\n if (\"string\" == typeof t4) {\n const a2 = this._requestManager.transformRequest(t4, \"Style\");\n e.h(a2, new AbortController()).then((t5) => {\n this._updateDiff(t5.data, i2);\n }).catch((t5) => {\n t5 && this.fire(new e.j(t5));\n });\n } else \"object\" == typeof t4 && this._updateDiff(t4, i2);\n }\n _updateDiff(t4, i2) {\n try {\n this.style.setState(t4, i2) && this._update(true);\n } catch (a2) {\n e.w(`Unable to perform style diff: ${a2.message || a2.error || a2}. Rebuilding the style from scratch.`), this._updateStyle(t4, i2);\n }\n }\n getStyle() {\n if (this.style) return this.style.serialize();\n }\n isStyleLoaded() {\n return this.style ? this.style.loaded() : e.w(\"There is no style added to the map.\");\n }\n addSource(t4, e2) {\n return this._lazyInitEmptyStyle(), this.style.addSource(t4, e2), this._update(true);\n }\n isSourceLoaded(t4) {\n const i2 = this.style && this.style.sourceCaches[t4];\n if (void 0 !== i2) return i2.loaded();\n this.fire(new e.j(new Error(`There is no source with ID '${t4}'`)));\n }\n setTerrain(t4) {\n if (this.style._checkLoaded(), this._terrainDataCallback && this.style.off(\"data\", this._terrainDataCallback), t4) {\n const i2 = this.style.sourceCaches[t4.source];\n if (!i2) throw new Error(`cannot load terrain, because there exists no source with ID: ${t4.source}`);\n null === this.terrain && i2.reload();\n for (const i3 in this.style._layers) {\n const a2 = this.style._layers[i3];\n \"hillshade\" === a2.type && a2.source === t4.source && e.w(\"You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.\");\n }\n this.terrain = new Ds(this.painter, i2, t4), this.painter.renderToTexture = new Rs(this.painter, this.terrain), this.transform.minElevationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this.transform.center, this.transform.tileZoom), this.transform.elevation = this.terrain.getElevationForLngLatZoom(this.transform.center, this.transform.tileZoom), this._terrainDataCallback = (e2) => {\n \"style\" === e2.dataType ? this.terrain.sourceCache.freeRtt() : \"source\" === e2.dataType && e2.tile && (e2.sourceId !== t4.source || this._elevationFreeze || (this.transform.minElevationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this.transform.center, this.transform.tileZoom), this.transform.elevation = this.terrain.getElevationForLngLatZoom(this.transform.center, this.transform.tileZoom)), this.terrain.sourceCache.freeRtt(e2.tile.tileID));\n }, this.style.on(\"data\", this._terrainDataCallback);\n } else this.terrain && this.terrain.sourceCache.destruct(), this.terrain = null, this.painter.renderToTexture && this.painter.renderToTexture.destruct(), this.painter.renderToTexture = null, this.transform.minElevationForCurrentTile = 0, this.transform.elevation = 0;\n return this.fire(new e.k(\"terrain\", { terrain: t4 })), this;\n }\n getTerrain() {\n var t4, e2;\n return null !== (e2 = null === (t4 = this.terrain) || void 0 === t4 ? void 0 : t4.options) && void 0 !== e2 ? e2 : null;\n }\n areTilesLoaded() {\n const t4 = this.style && this.style.sourceCaches;\n for (const e2 in t4) {\n const i2 = t4[e2]._tiles;\n for (const t5 in i2) {\n const e3 = i2[t5];\n if (\"loaded\" !== e3.state && \"errored\" !== e3.state) return false;\n }\n }\n return true;\n }\n removeSource(t4) {\n return this.style.removeSource(t4), this._update(true);\n }\n getSource(t4) {\n return this.style.getSource(t4);\n }\n addImage(t4, i2, a2 = {}) {\n const { pixelRatio: s2 = 1, sdf: r2 = false, stretchX: n2, stretchY: l2, content: h2, textFitWidth: c2, textFitHeight: u2 } = a2;\n if (this._lazyInitEmptyStyle(), !(i2 instanceof HTMLImageElement || e.b(i2))) {\n if (void 0 === i2.width || void 0 === i2.height) return this.fire(new e.j(new Error(\"Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`\")));\n {\n const { width: a3, height: o2, data: d2 } = i2, _2 = i2;\n return this.style.addImage(t4, { data: new e.R({ width: a3, height: o2 }, new Uint8Array(d2)), pixelRatio: s2, stretchX: n2, stretchY: l2, content: h2, textFitWidth: c2, textFitHeight: u2, sdf: r2, version: 0, userImage: _2 }), _2.onAdd && _2.onAdd(this, t4), this;\n }\n }\n {\n const { width: a3, height: d2, data: _2 } = o.getImageData(i2);\n this.style.addImage(t4, { data: new e.R({ width: a3, height: d2 }, _2), pixelRatio: s2, stretchX: n2, stretchY: l2, content: h2, textFitWidth: c2, textFitHeight: u2, sdf: r2, version: 0 });\n }\n }\n updateImage(t4, i2) {\n const a2 = this.style.getImage(t4);\n if (!a2) return this.fire(new e.j(new Error(\"The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.\")));\n const s2 = i2 instanceof HTMLImageElement || e.b(i2) ? o.getImageData(i2) : i2, { width: r2, height: n2, data: l2 } = s2;\n if (void 0 === r2 || void 0 === n2) return this.fire(new e.j(new Error(\"Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`\")));\n if (r2 !== a2.data.width || n2 !== a2.data.height) return this.fire(new e.j(new Error(\"The width and height of the updated image must be that same as the previous version of the image\")));\n const h2 = !(i2 instanceof HTMLImageElement || e.b(i2));\n return a2.data.replace(l2, h2), this.style.updateImage(t4, a2), this;\n }\n getImage(t4) {\n return this.style.getImage(t4);\n }\n hasImage(t4) {\n return t4 ? !!this.style.getImage(t4) : (this.fire(new e.j(new Error(\"Missing required image id\"))), false);\n }\n removeImage(t4) {\n this.style.removeImage(t4);\n }\n loadImage(t4) {\n return _.getImage(this._requestManager.transformRequest(t4, \"Image\"), new AbortController());\n }\n listImages() {\n return this.style.listImages();\n }\n addLayer(t4, e2) {\n return this._lazyInitEmptyStyle(), this.style.addLayer(t4, e2), this._update(true);\n }\n moveLayer(t4, e2) {\n return this.style.moveLayer(t4, e2), this._update(true);\n }\n removeLayer(t4) {\n return this.style.removeLayer(t4), this._update(true);\n }\n getLayer(t4) {\n return this.style.getLayer(t4);\n }\n getLayersOrder() {\n return this.style.getLayersOrder();\n }\n setLayerZoomRange(t4, e2, i2) {\n return this.style.setLayerZoomRange(t4, e2, i2), this._update(true);\n }\n setFilter(t4, e2, i2 = {}) {\n return this.style.setFilter(t4, e2, i2), this._update(true);\n }\n getFilter(t4) {\n return this.style.getFilter(t4);\n }\n setPaintProperty(t4, e2, i2, a2 = {}) {\n return this.style.setPaintProperty(t4, e2, i2, a2), this._update(true);\n }\n getPaintProperty(t4, e2) {\n return this.style.getPaintProperty(t4, e2);\n }\n setLayoutProperty(t4, e2, i2, a2 = {}) {\n return this.style.setLayoutProperty(t4, e2, i2, a2), this._update(true);\n }\n getLayoutProperty(t4, e2) {\n return this.style.getLayoutProperty(t4, e2);\n }\n setGlyphs(t4, e2 = {}) {\n return this._lazyInitEmptyStyle(), this.style.setGlyphs(t4, e2), this._update(true);\n }\n getGlyphs() {\n return this.style.getGlyphsUrl();\n }\n addSprite(t4, e2, i2 = {}) {\n return this._lazyInitEmptyStyle(), this.style.addSprite(t4, e2, i2, (t5) => {\n t5 || this._update(true);\n }), this;\n }\n removeSprite(t4) {\n return this._lazyInitEmptyStyle(), this.style.removeSprite(t4), this._update(true);\n }\n getSprite() {\n return this.style.getSprite();\n }\n setSprite(t4, e2 = {}) {\n return this._lazyInitEmptyStyle(), this.style.setSprite(t4, e2, (t5) => {\n t5 || this._update(true);\n }), this;\n }\n setLight(t4, e2 = {}) {\n return this._lazyInitEmptyStyle(), this.style.setLight(t4, e2), this._update(true);\n }\n getLight() {\n return this.style.getLight();\n }\n setSky(t4) {\n return this._lazyInitEmptyStyle(), this.style.setSky(t4), this._update(true);\n }\n getSky() {\n return this.style.getSky();\n }\n setFeatureState(t4, e2) {\n return this.style.setFeatureState(t4, e2), this._update();\n }\n removeFeatureState(t4, e2) {\n return this.style.removeFeatureState(t4, e2), this._update();\n }\n getFeatureState(t4) {\n return this.style.getFeatureState(t4);\n }\n getContainer() {\n return this._container;\n }\n getCanvasContainer() {\n return this._canvasContainer;\n }\n getCanvas() {\n return this._canvas;\n }\n _containerDimensions() {\n let t4 = 0, e2 = 0;\n return this._container && (t4 = this._container.clientWidth || 400, e2 = this._container.clientHeight || 300), [t4, e2];\n }\n _setupContainer() {\n const t4 = this._container;\n t4.classList.add(\"maplibregl-map\");\n const e2 = this._canvasContainer = r.create(\"div\", \"maplibregl-canvas-container\", t4);\n this._interactive && e2.classList.add(\"maplibregl-interactive\"), this._canvas = r.create(\"canvas\", \"maplibregl-canvas\", e2), this._canvas.addEventListener(\"webglcontextlost\", this._contextLost, false), this._canvas.addEventListener(\"webglcontextrestored\", this._contextRestored, false), this._canvas.setAttribute(\"tabindex\", this._interactive ? \"0\" : \"-1\"), this._canvas.setAttribute(\"aria-label\", this._getUIString(\"Map.Title\")), this._canvas.setAttribute(\"role\", \"region\");\n const i2 = this._containerDimensions(), a2 = this._getClampedPixelRatio(i2[0], i2[1]);\n this._resizeCanvas(i2[0], i2[1], a2);\n const s2 = this._controlContainer = r.create(\"div\", \"maplibregl-control-container\", t4), o2 = this._controlPositions = {};\n [\"top-left\", \"top-right\", \"bottom-left\", \"bottom-right\"].forEach((t5) => {\n o2[t5] = r.create(\"div\", `maplibregl-ctrl-${t5} `, s2);\n }), this._container.addEventListener(\"scroll\", this._onMapScroll, false);\n }\n _resizeCanvas(t4, e2, i2) {\n this._canvas.width = Math.floor(i2 * t4), this._canvas.height = Math.floor(i2 * e2), this._canvas.style.width = `${t4}px`, this._canvas.style.height = `${e2}px`;\n }\n _setupPainter() {\n const t4 = { alpha: true, stencil: true, depth: true, failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat, preserveDrawingBuffer: this._preserveDrawingBuffer, antialias: this._antialias || false };\n let e2 = null;\n this._canvas.addEventListener(\"webglcontextcreationerror\", (i3) => {\n e2 = { requestedAttributes: t4 }, i3 && (e2.statusMessage = i3.statusMessage, e2.type = i3.type);\n }, { once: true });\n const i2 = this._canvas.getContext(\"webgl2\", t4) || this._canvas.getContext(\"webgl\", t4);\n if (!i2) {\n const t5 = \"Failed to initialize WebGL\";\n throw e2 ? (e2.message = t5, new Error(JSON.stringify(e2))) : new Error(t5);\n }\n this.painter = new va(i2, this.transform), n.testSupport(i2);\n }\n loaded() {\n return !this._styleDirty && !this._sourcesDirty && !!this.style && this.style.loaded();\n }\n _update(t4) {\n return this.style && this.style._loaded ? (this._styleDirty = this._styleDirty || t4, this._sourcesDirty = true, this.triggerRepaint(), this) : this;\n }\n _requestRenderFrame(t4) {\n return this._update(), this._renderTaskQueue.add(t4);\n }\n _cancelRenderFrame(t4) {\n this._renderTaskQueue.remove(t4);\n }\n _render(t4) {\n const i2 = this._idleTriggered ? this._fadeDuration : 0;\n if (this.painter.context.setDirty(), this.painter.setBaseState(), this._renderTaskQueue.run(t4), this._removed) return;\n let a2 = false;\n if (this.style && this._styleDirty) {\n this._styleDirty = false;\n const t5 = this.transform.zoom, s3 = o.now();\n this.style.zoomHistory.update(t5, s3);\n const r2 = new e.z(t5, { now: s3, fadeDuration: i2, zoomHistory: this.style.zoomHistory, transition: this.style.getTransition() }), n2 = r2.crossFadingFactor();\n 1 === n2 && n2 === this._crossFadingFactor || (a2 = true, this._crossFadingFactor = n2), this.style.update(r2);\n }\n this.style && this._sourcesDirty && (this._sourcesDirty = false, this.style._updateSources(this.transform)), this.terrain ? (this.terrain.sourceCache.update(this.transform, this.terrain), this.transform.minElevationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this.transform.center, this.transform.tileZoom), this._elevationFreeze || (this.transform.elevation = this.terrain.getElevationForLngLatZoom(this.transform.center, this.transform.tileZoom))) : (this.transform.minElevationForCurrentTile = 0, this.transform.elevation = 0), this._placementDirty = this.style && this.style._updatePlacement(this.painter.transform, this.showCollisionBoxes, i2, this._crossSourceCollisions), this.painter.render(this.style, { showTileBoundaries: this.showTileBoundaries, showOverdrawInspector: this._showOverdrawInspector, rotating: this.isRotating(), zooming: this.isZooming(), moving: this.isMoving(), fadeDuration: i2, showPadding: this.showPadding }), this.fire(new e.k(\"render\")), this.loaded() && !this._loaded && (this._loaded = true, e.bf.mark(e.bg.load), this.fire(new e.k(\"load\"))), this.style && (this.style.hasTransitions() || a2) && (this._styleDirty = true), this.style && !this._placementDirty && this.style._releaseSymbolFadeTiles();\n const s2 = this._sourcesDirty || this._styleDirty || this._placementDirty;\n return s2 || this._repaint ? this.triggerRepaint() : !this.isMoving() && this.loaded() && this.fire(new e.k(\"idle\")), !this._loaded || this._fullyLoaded || s2 || (this._fullyLoaded = true, e.bf.mark(e.bg.fullLoad)), this;\n }\n redraw() {\n return this.style && (this._frameRequest && (this._frameRequest.abort(), this._frameRequest = null), this._render(0)), this;\n }\n remove() {\n var t4;\n this._hash && this._hash.remove();\n for (const t5 of this._controls) t5.onRemove(this);\n this._controls = [], this._frameRequest && (this._frameRequest.abort(), this._frameRequest = null), this._renderTaskQueue.clear(), this.painter.destroy(), this.handlers.destroy(), delete this.handlers, this.setStyle(null), \"undefined\" != typeof window && removeEventListener(\"online\", this._onWindowOnline, false), _.removeThrottleControl(this._imageQueueHandle), null === (t4 = this._resizeObserver) || void 0 === t4 || t4.disconnect();\n const i2 = this.painter.context.gl.getExtension(\"WEBGL_lose_context\");\n (null == i2 ? void 0 : i2.loseContext) && i2.loseContext(), this._canvas.removeEventListener(\"webglcontextrestored\", this._contextRestored, false), this._canvas.removeEventListener(\"webglcontextlost\", this._contextLost, false), r.remove(this._canvasContainer), r.remove(this._controlContainer), this._container.classList.remove(\"maplibregl-map\"), e.bf.clearMetrics(), this._removed = true, this.fire(new e.k(\"remove\"));\n }\n triggerRepaint() {\n this.style && !this._frameRequest && (this._frameRequest = new AbortController(), o.frameAsync(this._frameRequest).then((t4) => {\n e.bf.frame(t4), this._frameRequest = null, this._render(t4);\n }).catch(() => {\n }));\n }\n get showTileBoundaries() {\n return !!this._showTileBoundaries;\n }\n set showTileBoundaries(t4) {\n this._showTileBoundaries !== t4 && (this._showTileBoundaries = t4, this._update());\n }\n get showPadding() {\n return !!this._showPadding;\n }\n set showPadding(t4) {\n this._showPadding !== t4 && (this._showPadding = t4, this._update());\n }\n get showCollisionBoxes() {\n return !!this._showCollisionBoxes;\n }\n set showCollisionBoxes(t4) {\n this._showCollisionBoxes !== t4 && (this._showCollisionBoxes = t4, t4 ? this.style._generateCollisionBoxes() : this._update());\n }\n get showOverdrawInspector() {\n return !!this._showOverdrawInspector;\n }\n set showOverdrawInspector(t4) {\n this._showOverdrawInspector !== t4 && (this._showOverdrawInspector = t4, this._update());\n }\n get repaint() {\n return !!this._repaint;\n }\n set repaint(t4) {\n this._repaint !== t4 && (this._repaint = t4, this.triggerRepaint());\n }\n get vertices() {\n return !!this._vertices;\n }\n set vertices(t4) {\n this._vertices = t4, this._update();\n }\n get version() {\n return Ls;\n }\n getCameraTargetElevation() {\n return this.transform.elevation;\n }\n }, t.MapMouseEvent = ka, t.MapTouchEvent = La, t.MapWheelEvent = Fa, t.Marker = Vs, t.NavigationControl = class {\n constructor(t4) {\n this._updateZoomButtons = () => {\n const t5 = this._map.getZoom(), e2 = t5 === this._map.getMaxZoom(), i2 = t5 === this._map.getMinZoom();\n this._zoomInButton.disabled = e2, this._zoomOutButton.disabled = i2, this._zoomInButton.setAttribute(\"aria-disabled\", e2.toString()), this._zoomOutButton.setAttribute(\"aria-disabled\", i2.toString());\n }, this._rotateCompassArrow = () => {\n const t5 = this.options.visualizePitch ? `scale(${1 / Math.pow(Math.cos(this._map.transform.pitch * (Math.PI / 180)), 0.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle * (180 / Math.PI)}deg)` : `rotate(${this._map.transform.angle * (180 / Math.PI)}deg)`;\n this._compassIcon.style.transform = t5;\n }, this._setButtonTitle = (t5, e2) => {\n const i2 = this._map._getUIString(`NavigationControl.${e2}`);\n t5.title = i2, t5.setAttribute(\"aria-label\", i2);\n }, this.options = e.e({}, Os, t4), this._container = r.create(\"div\", \"maplibregl-ctrl maplibregl-ctrl-group\"), this._container.addEventListener(\"contextmenu\", (t5) => t5.preventDefault()), this.options.showZoom && (this._zoomInButton = this._createButton(\"maplibregl-ctrl-zoom-in\", (t5) => this._map.zoomIn({}, { originalEvent: t5 })), r.create(\"span\", \"maplibregl-ctrl-icon\", this._zoomInButton).setAttribute(\"aria-hidden\", \"true\"), this._zoomOutButton = this._createButton(\"maplibregl-ctrl-zoom-out\", (t5) => this._map.zoomOut({}, { originalEvent: t5 })), r.create(\"span\", \"maplibregl-ctrl-icon\", this._zoomOutButton).setAttribute(\"aria-hidden\", \"true\")), this.options.showCompass && (this._compass = this._createButton(\"maplibregl-ctrl-compass\", (t5) => {\n this.options.visualizePitch ? this._map.resetNorthPitch({}, { originalEvent: t5 }) : this._map.resetNorth({}, { originalEvent: t5 });\n }), this._compassIcon = r.create(\"span\", \"maplibregl-ctrl-icon\", this._compass), this._compassIcon.setAttribute(\"aria-hidden\", \"true\"));\n }\n onAdd(t4) {\n return this._map = t4, this.options.showZoom && (this._setButtonTitle(this._zoomInButton, \"ZoomIn\"), this._setButtonTitle(this._zoomOutButton, \"ZoomOut\"), this._map.on(\"zoom\", this._updateZoomButtons), this._updateZoomButtons()), this.options.showCompass && (this._setButtonTitle(this._compass, \"ResetBearing\"), this.options.visualizePitch && this._map.on(\"pitch\", this._rotateCompassArrow), this._map.on(\"rotate\", this._rotateCompassArrow), this._rotateCompassArrow(), this._handler = new Ns(this._map, this._compass, this.options.visualizePitch)), this._container;\n }\n onRemove() {\n r.remove(this._container), this.options.showZoom && this._map.off(\"zoom\", this._updateZoomButtons), this.options.showCompass && (this.options.visualizePitch && this._map.off(\"pitch\", this._rotateCompassArrow), this._map.off(\"rotate\", this._rotateCompassArrow), this._handler.off(), delete this._handler), delete this._map;\n }\n _createButton(t4, e2) {\n const i2 = r.create(\"button\", t4, this._container);\n return i2.type = \"button\", i2.addEventListener(\"click\", e2), i2;\n }\n }, t.Popup = class extends e.E {\n constructor(t4) {\n super(), this.remove = () => (this._content && r.remove(this._content), this._container && (r.remove(this._container), delete this._container), this._map && (this._map.off(\"move\", this._update), this._map.off(\"move\", this._onClose), this._map.off(\"click\", this._onClose), this._map.off(\"remove\", this.remove), this._map.off(\"mousemove\", this._onMouseMove), this._map.off(\"mouseup\", this._onMouseUp), this._map.off(\"drag\", this._onDrag), this._map._canvasContainer.classList.remove(\"maplibregl-track-pointer\"), delete this._map, this.fire(new e.k(\"close\"))), this), this._onMouseUp = (t5) => {\n this._update(t5.point);\n }, this._onMouseMove = (t5) => {\n this._update(t5.point);\n }, this._onDrag = (t5) => {\n this._update(t5.point);\n }, this._update = (t5) => {\n var e2;\n if (!this._map || !this._lngLat && !this._trackPointer || !this._content) return;\n if (!this._container) {\n if (this._container = r.create(\"div\", \"maplibregl-popup\", this._map.getContainer()), this._tip = r.create(\"div\", \"maplibregl-popup-tip\", this._container), this._container.appendChild(this._content), this.options.className) for (const t6 of this.options.className.split(\" \")) this._container.classList.add(t6);\n this._closeButton && this._closeButton.setAttribute(\"aria-label\", this._map._getUIString(\"Popup.Close\")), this._trackPointer && this._container.classList.add(\"maplibregl-popup-track-pointer\");\n }\n if (this.options.maxWidth && this._container.style.maxWidth !== this.options.maxWidth && (this._container.style.maxWidth = this.options.maxWidth), this._lngLat = this._map.transform.renderWorldCopies && !this._trackPointer ? js(this._lngLat, this._flatPos, this._map.transform) : null === (e2 = this._lngLat) || void 0 === e2 ? void 0 : e2.wrap(), this._trackPointer && !t5) return;\n const i2 = this._flatPos = this._pos = this._trackPointer && t5 ? t5 : this._map.project(this._lngLat);\n this._map.terrain && (this._flatPos = this._trackPointer && t5 ? t5 : this._map.transform.locationPoint(this._lngLat));\n let a2 = this.options.anchor;\n const s2 = Qs(this.options.offset);\n if (!a2) {\n const t6 = this._container.offsetWidth, e3 = this._container.offsetHeight;\n let o3;\n o3 = i2.y + s2.bottom.y < e3 ? [\"top\"] : i2.y > this._map.transform.height - e3 ? [\"bottom\"] : [], i2.x < t6 / 2 ? o3.push(\"left\") : i2.x > this._map.transform.width - t6 / 2 && o3.push(\"right\"), a2 = 0 === o3.length ? \"bottom\" : o3.join(\"-\");\n }\n let o2 = i2.add(s2[a2]);\n this.options.subpixelPositioning || (o2 = o2.round()), r.setTransform(this._container, `${Zs[a2]} translate(${o2.x}px,${o2.y}px)`), qs(this._container, a2, \"popup\");\n }, this._onClose = () => {\n this.remove();\n }, this.options = e.e(Object.create(Js), t4);\n }\n addTo(t4) {\n return this._map && this.remove(), this._map = t4, this.options.closeOnClick && this._map.on(\"click\", this._onClose), this.options.closeOnMove && this._map.on(\"move\", this._onClose), this._map.on(\"remove\", this.remove), this._update(), this._focusFirstElement(), this._trackPointer ? (this._map.on(\"mousemove\", this._onMouseMove), this._map.on(\"mouseup\", this._onMouseUp), this._container && this._container.classList.add(\"maplibregl-popup-track-pointer\"), this._map._canvasContainer.classList.add(\"maplibregl-track-pointer\")) : this._map.on(\"move\", this._update), this.fire(new e.k(\"open\")), this;\n }\n isOpen() {\n return !!this._map;\n }\n getLngLat() {\n return this._lngLat;\n }\n setLngLat(t4) {\n return this._lngLat = e.N.convert(t4), this._pos = null, this._flatPos = null, this._trackPointer = false, this._update(), this._map && (this._map.on(\"move\", this._update), this._map.off(\"mousemove\", this._onMouseMove), this._container && this._container.classList.remove(\"maplibregl-popup-track-pointer\"), this._map._canvasContainer.classList.remove(\"maplibregl-track-pointer\")), this;\n }\n trackPointer() {\n return this._trackPointer = true, this._pos = null, this._flatPos = null, this._update(), this._map && (this._map.off(\"move\", this._update), this._map.on(\"mousemove\", this._onMouseMove), this._map.on(\"drag\", this._onDrag), this._container && this._container.classList.add(\"maplibregl-popup-track-pointer\"), this._map._canvasContainer.classList.add(\"maplibregl-track-pointer\")), this;\n }\n getElement() {\n return this._container;\n }\n setText(t4) {\n return this.setDOMContent(document.createTextNode(t4));\n }\n setHTML(t4) {\n const e2 = document.createDocumentFragment(), i2 = document.createElement(\"body\");\n let a2;\n for (i2.innerHTML = t4; a2 = i2.firstChild, a2; ) e2.appendChild(a2);\n return this.setDOMContent(e2);\n }\n getMaxWidth() {\n var t4;\n return null === (t4 = this._container) || void 0 === t4 ? void 0 : t4.style.maxWidth;\n }\n setMaxWidth(t4) {\n return this.options.maxWidth = t4, this._update(), this;\n }\n setDOMContent(t4) {\n if (this._content) for (; this._content.hasChildNodes(); ) this._content.firstChild && this._content.removeChild(this._content.firstChild);\n else this._content = r.create(\"div\", \"maplibregl-popup-content\", this._container);\n return this._content.appendChild(t4), this._createCloseButton(), this._update(), this._focusFirstElement(), this;\n }\n addClassName(t4) {\n return this._container && this._container.classList.add(t4), this;\n }\n removeClassName(t4) {\n return this._container && this._container.classList.remove(t4), this;\n }\n setOffset(t4) {\n return this.options.offset = t4, this._update(), this;\n }\n toggleClassName(t4) {\n if (this._container) return this._container.classList.toggle(t4);\n }\n setSubpixelPositioning(t4) {\n this.options.subpixelPositioning = t4;\n }\n _createCloseButton() {\n this.options.closeButton && (this._closeButton = r.create(\"button\", \"maplibregl-popup-close-button\", this._content), this._closeButton.type = \"button\", this._closeButton.innerHTML = \"×\", this._closeButton.addEventListener(\"click\", this._onClose));\n }\n _focusFirstElement() {\n if (!this.options.focusAfterOpen || !this._container) return;\n const t4 = this._container.querySelector(Ys);\n t4 && t4.focus();\n }\n }, t.RasterDEMTileSource = K2, t.RasterTileSource = X, t.ScaleControl = class {\n constructor(t4) {\n this._onMove = () => {\n Xs(this._map, this._container, this.options);\n }, this.setUnit = (t5) => {\n this.options.unit = t5, Xs(this._map, this._container, this.options);\n }, this.options = Object.assign(Object.assign({}, $s), t4);\n }\n getDefaultPosition() {\n return \"bottom-left\";\n }\n onAdd(t4) {\n return this._map = t4, this._container = r.create(\"div\", \"maplibregl-ctrl maplibregl-ctrl-scale\", t4.getContainer()), this._map.on(\"move\", this._onMove), this._onMove(), this._container;\n }\n onRemove() {\n r.remove(this._container), this._map.off(\"move\", this._onMove), this._map = void 0;\n }\n }, t.ScrollZoomHandler = us, t.Style = de, t.TerrainControl = class {\n constructor(t4) {\n this._toggleTerrain = () => {\n this._map.getTerrain() ? this._map.setTerrain(null) : this._map.setTerrain(this.options), this._updateTerrainIcon();\n }, this._updateTerrainIcon = () => {\n this._terrainButton.classList.remove(\"maplibregl-ctrl-terrain\"), this._terrainButton.classList.remove(\"maplibregl-ctrl-terrain-enabled\"), this._map.terrain ? (this._terrainButton.classList.add(\"maplibregl-ctrl-terrain-enabled\"), this._terrainButton.title = this._map._getUIString(\"TerrainControl.Disable\")) : (this._terrainButton.classList.add(\"maplibregl-ctrl-terrain\"), this._terrainButton.title = this._map._getUIString(\"TerrainControl.Enable\"));\n }, this.options = t4;\n }\n onAdd(t4) {\n return this._map = t4, this._container = r.create(\"div\", \"maplibregl-ctrl maplibregl-ctrl-group\"), this._terrainButton = r.create(\"button\", \"maplibregl-ctrl-terrain\", this._container), r.create(\"span\", \"maplibregl-ctrl-icon\", this._terrainButton).setAttribute(\"aria-hidden\", \"true\"), this._terrainButton.type = \"button\", this._terrainButton.addEventListener(\"click\", this._toggleTerrain), this._updateTerrainIcon(), this._map.on(\"terrain\", this._updateTerrainIcon), this._container;\n }\n onRemove() {\n r.remove(this._container), this._map.off(\"terrain\", this._updateTerrainIcon), this._map = void 0;\n }\n }, t.TwoFingersTouchPitchHandler = rs, t.TwoFingersTouchRotateHandler = ss, t.TwoFingersTouchZoomHandler = is, t.TwoFingersTouchZoomRotateHandler = gs, t.VectorTileSource = $, t.VideoSource = tt, t.addSourceType = (t4, i2) => e._(void 0, void 0, void 0, function* () {\n if (at(t4)) throw new Error(`A source type called \"${t4}\" already exists.`);\n ((t5, e2) => {\n it[t5] = e2;\n })(t4, i2);\n }), t.clearPrewarmedResources = function() {\n const t4 = B2;\n t4 && (t4.isPreloaded() && 1 === t4.numActive() ? (t4.release(k), B2 = null) : console.warn(\"Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()\"));\n }, t.getMaxParallelImageRequests = function() {\n return e.a.MAX_PARALLEL_IMAGE_REQUESTS;\n }, t.getRTLTextPluginStatus = function() {\n return nt().getRTLTextPluginStatus();\n }, t.getVersion = function() {\n return to;\n }, t.getWorkerCount = function() {\n return L.workerCount;\n }, t.getWorkerUrl = function() {\n return e.a.WORKER_URL;\n }, t.importScriptInWorkers = function(t4) {\n return j().broadcast(\"IS\", t4);\n }, t.prewarm = function() {\n N().acquire(k);\n }, t.setMaxParallelImageRequests = function(t4) {\n e.a.MAX_PARALLEL_IMAGE_REQUESTS = t4;\n }, t.setRTLTextPlugin = function(t4, e2) {\n return nt().setRTLTextPlugin(t4, e2);\n }, t.setWorkerCount = function(t4) {\n L.workerCount = t4;\n }, t.setWorkerUrl = function(t4) {\n e.a.WORKER_URL = t4;\n };\n });\n var maplibregl$1 = maplibregl;\n return maplibregl$1;\n });\n }\n });\n\n // src/plots/map/layers.js\n var require_layers2 = __commonJS({\n \"src/plots/map/layers.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var sanitizeHTML = require_svg_text_utils().sanitizeHTML;\n var convertTextOpts = require_convert_text_opts2();\n var constants = require_constants27();\n function MapLayer(subplot, index) {\n this.subplot = subplot;\n this.uid = subplot.uid + \"-\" + index;\n this.index = index;\n this.idSource = \"source-\" + this.uid;\n this.idLayer = constants.layoutLayerPrefix + this.uid;\n this.sourceType = null;\n this.source = null;\n this.layerType = null;\n this.below = null;\n this.visible = false;\n }\n var proto = MapLayer.prototype;\n proto.update = function update(opts) {\n if (!this.visible) {\n this.updateSource(opts);\n this.updateLayer(opts);\n } else if (this.needsNewImage(opts)) {\n this.updateImage(opts);\n } else if (this.needsNewSource(opts)) {\n this.removeLayer();\n this.updateSource(opts);\n this.updateLayer(opts);\n } else if (this.needsNewLayer(opts)) {\n this.updateLayer(opts);\n } else {\n this.updateStyle(opts);\n }\n this.visible = isVisible(opts);\n };\n proto.needsNewImage = function(opts) {\n var map = this.subplot.map;\n return map.getSource(this.idSource) && this.sourceType === \"image\" && opts.sourcetype === \"image\" && (this.source !== opts.source || JSON.stringify(this.coordinates) !== JSON.stringify(opts.coordinates));\n };\n proto.needsNewSource = function(opts) {\n return this.sourceType !== opts.sourcetype || JSON.stringify(this.source) !== JSON.stringify(opts.source) || this.layerType !== opts.type;\n };\n proto.needsNewLayer = function(opts) {\n return this.layerType !== opts.type || this.below !== this.subplot.belowLookup[\"layout-\" + this.index];\n };\n proto.lookupBelow = function() {\n return this.subplot.belowLookup[\"layout-\" + this.index];\n };\n proto.updateImage = function(opts) {\n var map = this.subplot.map;\n map.getSource(this.idSource).updateImage({\n url: opts.source,\n coordinates: opts.coordinates\n });\n var _below = this.findFollowingMapLayerId(this.lookupBelow());\n if (_below !== null) {\n this.subplot.map.moveLayer(this.idLayer, _below);\n }\n };\n proto.updateSource = function(opts) {\n var map = this.subplot.map;\n if (map.getSource(this.idSource)) map.removeSource(this.idSource);\n this.sourceType = opts.sourcetype;\n this.source = opts.source;\n if (!isVisible(opts)) return;\n var sourceOpts = convertSourceOpts(opts);\n map.addSource(this.idSource, sourceOpts);\n };\n proto.findFollowingMapLayerId = function(below) {\n if (below === \"traces\") {\n var mapLayers = this.subplot.getMapLayers();\n for (var i = 0; i < mapLayers.length; i++) {\n var layerId = mapLayers[i].id;\n if (typeof layerId === \"string\" && layerId.indexOf(constants.traceLayerPrefix) === 0) {\n below = layerId;\n break;\n }\n }\n }\n return below;\n };\n proto.updateLayer = function(opts) {\n var subplot = this.subplot;\n var convertedOpts = convertOpts(opts);\n var below = this.lookupBelow();\n var _below = this.findFollowingMapLayerId(below);\n this.removeLayer();\n if (isVisible(opts)) {\n subplot.addLayer({\n id: this.idLayer,\n source: this.idSource,\n \"source-layer\": opts.sourcelayer || \"\",\n type: opts.type,\n minzoom: opts.minzoom,\n maxzoom: opts.maxzoom,\n layout: convertedOpts.layout,\n paint: convertedOpts.paint\n }, _below);\n }\n this.layerType = opts.type;\n this.below = below;\n };\n proto.updateStyle = function(opts) {\n if (isVisible(opts)) {\n var convertedOpts = convertOpts(opts);\n this.subplot.setOptions(this.idLayer, \"setLayoutProperty\", convertedOpts.layout);\n this.subplot.setOptions(this.idLayer, \"setPaintProperty\", convertedOpts.paint);\n }\n };\n proto.removeLayer = function() {\n var map = this.subplot.map;\n if (map.getLayer(this.idLayer)) {\n map.removeLayer(this.idLayer);\n }\n };\n proto.dispose = function() {\n var map = this.subplot.map;\n if (map.getLayer(this.idLayer)) map.removeLayer(this.idLayer);\n if (map.getSource(this.idSource)) map.removeSource(this.idSource);\n };\n function isVisible(opts) {\n if (!opts.visible) return false;\n var source = opts.source;\n if (Array.isArray(source) && source.length > 0) {\n for (var i = 0; i < source.length; i++) {\n if (typeof source[i] !== \"string\" || source[i].length === 0) {\n return false;\n }\n }\n return true;\n }\n return Lib.isPlainObject(source) || typeof source === \"string\" && source.length > 0;\n }\n function convertOpts(opts) {\n var layout = {};\n var paint = {};\n switch (opts.type) {\n case \"circle\":\n Lib.extendFlat(paint, {\n \"circle-radius\": opts.circle.radius,\n \"circle-color\": opts.color,\n \"circle-opacity\": opts.opacity\n });\n break;\n case \"line\":\n Lib.extendFlat(paint, {\n \"line-width\": opts.line.width,\n \"line-color\": opts.color,\n \"line-opacity\": opts.opacity,\n \"line-dasharray\": opts.line.dash\n });\n break;\n case \"fill\":\n Lib.extendFlat(paint, {\n \"fill-color\": opts.color,\n \"fill-outline-color\": opts.fill.outlinecolor,\n \"fill-opacity\": opts.opacity\n // no way to pass specify outline width at the moment\n });\n break;\n case \"symbol\":\n var symbol = opts.symbol;\n var textOpts = convertTextOpts(symbol.textposition, symbol.iconsize);\n Lib.extendFlat(layout, {\n \"icon-image\": symbol.icon + \"-15\",\n \"icon-size\": symbol.iconsize / 10,\n \"text-field\": symbol.text,\n \"text-size\": symbol.textfont.size,\n \"text-anchor\": textOpts.anchor,\n \"text-offset\": textOpts.offset,\n \"symbol-placement\": symbol.placement\n // TODO font family\n // 'text-font': symbol.textfont.family.split(', '),\n });\n Lib.extendFlat(paint, {\n \"icon-color\": opts.color,\n \"text-color\": symbol.textfont.color,\n \"text-opacity\": opts.opacity\n });\n break;\n case \"raster\":\n Lib.extendFlat(paint, {\n \"raster-fade-duration\": 0,\n \"raster-opacity\": opts.opacity\n });\n break;\n }\n return {\n layout,\n paint\n };\n }\n function convertSourceOpts(opts) {\n var sourceType = opts.sourcetype;\n var source = opts.source;\n var sourceOpts = { type: sourceType };\n var field;\n if (sourceType === \"geojson\") {\n field = \"data\";\n } else if (sourceType === \"vector\") {\n field = typeof source === \"string\" ? \"url\" : \"tiles\";\n } else if (sourceType === \"raster\") {\n field = \"tiles\";\n sourceOpts.tileSize = 256;\n } else if (sourceType === \"image\") {\n field = \"url\";\n sourceOpts.coordinates = opts.coordinates;\n }\n sourceOpts[field] = source;\n if (opts.sourceattribution) {\n sourceOpts.attribution = sanitizeHTML(opts.sourceattribution);\n }\n return sourceOpts;\n }\n module.exports = function createMapLayer(subplot, index, opts) {\n var mapLayer = new MapLayer(subplot, index);\n mapLayer.update(opts);\n return mapLayer;\n };\n }\n });\n\n // src/plots/map/map.js\n var require_map2 = __commonJS({\n \"src/plots/map/map.js\"(exports, module) {\n \"use strict\";\n var maplibregl = require_maplibre_gl();\n var Lib = require_lib();\n var geoUtils = require_geo_location_utils();\n var Registry = require_registry();\n var Axes = require_axes();\n var dragElement = require_dragelement();\n var Fx = require_fx();\n var dragHelpers = require_helpers5();\n var drawMode = dragHelpers.drawMode;\n var selectMode = dragHelpers.selectMode;\n var prepSelect = require_selections().prepSelect;\n var clearOutline = require_selections().clearOutline;\n var clearSelectionsCache = require_selections().clearSelectionsCache;\n var selectOnClick = require_selections().selectOnClick;\n var constants = require_constants27();\n var createMapLayer = require_layers2();\n function Map2(gd, id) {\n this.id = id;\n this.gd = gd;\n var fullLayout = gd._fullLayout;\n var context = gd._context;\n this.container = fullLayout._glcontainer.node();\n this.isStatic = context.staticPlot;\n this.uid = fullLayout._uid + \"-\" + this.id;\n this.div = null;\n this.xaxis = null;\n this.yaxis = null;\n this.createFramework(fullLayout);\n this.map = null;\n this.styleObj = null;\n this.traceHash = {};\n this.layerList = [];\n this.belowLookup = {};\n this.dragging = false;\n this.wheeling = false;\n }\n var proto = Map2.prototype;\n proto.plot = function(calcData, fullLayout, promises) {\n var self2 = this;\n var promise;\n if (!self2.map) {\n promise = new Promise(function(resolve, reject) {\n self2.createMap(calcData, fullLayout, resolve, reject);\n });\n } else {\n promise = new Promise(function(resolve, reject) {\n self2.updateMap(calcData, fullLayout, resolve, reject);\n });\n }\n promises.push(promise);\n };\n proto.createMap = function(calcData, fullLayout, resolve, reject) {\n var self2 = this;\n var opts = fullLayout[self2.id];\n var styleObj = self2.styleObj = getStyleObj(opts.style);\n var bounds = opts.bounds;\n var maxBounds = bounds ? [[bounds.west, bounds.south], [bounds.east, bounds.north]] : null;\n var map = self2.map = new maplibregl.Map({\n container: self2.div,\n style: styleObj.style,\n center: convertCenter(opts.center),\n zoom: opts.zoom,\n bearing: opts.bearing,\n pitch: opts.pitch,\n maxBounds,\n interactive: !self2.isStatic,\n preserveDrawingBuffer: self2.isStatic,\n doubleClickZoom: false,\n boxZoom: false,\n attributionControl: false\n }).addControl(new maplibregl.AttributionControl({\n compact: true\n }));\n var requestedIcons = {};\n map.on(\"styleimagemissing\", function(e) {\n var id = e.id;\n if (!requestedIcons[id] && id.includes(\"-15\")) {\n requestedIcons[id] = true;\n var img = new Image(15, 15);\n img.onload = function() {\n map.addImage(id, img);\n };\n img.crossOrigin = \"Anonymous\";\n img.src = \"https://unpkg.com/maki@2.1.0/icons/\" + id + \".svg\";\n }\n });\n map.setTransformRequest(function(url) {\n url = url.replace(\"https://fonts.openmaptiles.org/Open Sans Extrabold\", \"https://fonts.openmaptiles.org/Open Sans Extra Bold\");\n url = url.replace(\"https://tiles.basemaps.cartocdn.com/fonts/Open Sans Extrabold\", \"https://fonts.openmaptiles.org/Open Sans Extra Bold\");\n url = url.replace(\"https://fonts.openmaptiles.org/Open Sans Regular,Arial Unicode MS Regular\", \"https://fonts.openmaptiles.org/Klokantech Noto Sans Regular\");\n return {\n url\n };\n });\n map._canvas.style.left = \"0px\";\n map._canvas.style.top = \"0px\";\n self2.rejectOnError(reject);\n if (!self2.isStatic) {\n self2.initFx(calcData, fullLayout);\n }\n var promises = [];\n promises.push(new Promise(function(resolve2) {\n map.once(\"load\", resolve2);\n }));\n promises = promises.concat(geoUtils.fetchTraceGeoData(calcData));\n Promise.all(promises).then(function() {\n self2.fillBelowLookup(calcData, fullLayout);\n self2.updateData(calcData);\n self2.updateLayout(fullLayout);\n self2.resolveOnRender(resolve);\n }).catch(reject);\n };\n proto.updateMap = function(calcData, fullLayout, resolve, reject) {\n var self2 = this;\n var map = self2.map;\n var opts = fullLayout[this.id];\n self2.rejectOnError(reject);\n var promises = [];\n var styleObj = getStyleObj(opts.style);\n if (JSON.stringify(self2.styleObj) !== JSON.stringify(styleObj)) {\n self2.styleObj = styleObj;\n map.setStyle(styleObj.style);\n self2.traceHash = {};\n promises.push(new Promise(function(resolve2) {\n map.once(\"styledata\", resolve2);\n }));\n }\n promises = promises.concat(geoUtils.fetchTraceGeoData(calcData));\n Promise.all(promises).then(function() {\n self2.fillBelowLookup(calcData, fullLayout);\n self2.updateData(calcData);\n self2.updateLayout(fullLayout);\n self2.resolveOnRender(resolve);\n }).catch(reject);\n };\n proto.fillBelowLookup = function(calcData, fullLayout) {\n var opts = fullLayout[this.id];\n var layers = opts.layers;\n var i, val;\n var belowLookup = this.belowLookup = {};\n var hasTraceAtTop = false;\n for (i = 0; i < calcData.length; i++) {\n var trace = calcData[i][0].trace;\n var _module = trace._module;\n if (typeof trace.below === \"string\") {\n val = trace.below;\n } else if (_module.getBelow) {\n val = _module.getBelow(trace, this);\n }\n if (val === \"\") {\n hasTraceAtTop = true;\n }\n belowLookup[\"trace-\" + trace.uid] = val || \"\";\n }\n for (i = 0; i < layers.length; i++) {\n var item = layers[i];\n if (typeof item.below === \"string\") {\n val = item.below;\n } else if (hasTraceAtTop) {\n val = \"traces\";\n } else {\n val = \"\";\n }\n belowLookup[\"layout-\" + i] = val;\n }\n var val2list = {};\n var k, id;\n for (k in belowLookup) {\n val = belowLookup[k];\n if (val2list[val]) {\n val2list[val].push(k);\n } else {\n val2list[val] = [k];\n }\n }\n for (val in val2list) {\n var list = val2list[val];\n if (list.length > 1) {\n for (i = 0; i < list.length; i++) {\n k = list[i];\n if (k.indexOf(\"trace-\") === 0) {\n id = k.split(\"trace-\")[1];\n if (this.traceHash[id]) {\n this.traceHash[id].below = null;\n }\n } else if (k.indexOf(\"layout-\") === 0) {\n id = k.split(\"layout-\")[1];\n if (this.layerList[id]) {\n this.layerList[id].below = null;\n }\n }\n }\n }\n }\n };\n var traceType2orderIndex = {\n choroplethmap: 0,\n densitymap: 1,\n scattermap: 2\n };\n proto.updateData = function(calcData) {\n var traceHash = this.traceHash;\n var traceObj, trace, i, j;\n var calcDataSorted = calcData.slice().sort(function(a, b) {\n return traceType2orderIndex[a[0].trace.type] - traceType2orderIndex[b[0].trace.type];\n });\n for (i = 0; i < calcDataSorted.length; i++) {\n var calcTrace = calcDataSorted[i];\n trace = calcTrace[0].trace;\n traceObj = traceHash[trace.uid];\n var didUpdate = false;\n if (traceObj) {\n if (traceObj.type === trace.type) {\n traceObj.update(calcTrace);\n didUpdate = true;\n } else {\n traceObj.dispose();\n }\n }\n if (!didUpdate && trace._module) {\n traceHash[trace.uid] = trace._module.plot(this, calcTrace);\n }\n }\n var ids = Object.keys(traceHash);\n idLoop:\n for (i = 0; i < ids.length; i++) {\n var id = ids[i];\n for (j = 0; j < calcData.length; j++) {\n trace = calcData[j][0].trace;\n if (id === trace.uid) continue idLoop;\n }\n traceObj = traceHash[id];\n traceObj.dispose();\n delete traceHash[id];\n }\n };\n proto.updateLayout = function(fullLayout) {\n var map = this.map;\n var opts = fullLayout[this.id];\n if (!this.dragging && !this.wheeling) {\n map.setCenter(convertCenter(opts.center));\n map.setZoom(opts.zoom);\n map.setBearing(opts.bearing);\n map.setPitch(opts.pitch);\n }\n this.updateLayers(fullLayout);\n this.updateFramework(fullLayout);\n this.updateFx(fullLayout);\n this.map.resize();\n if (this.gd._context._scrollZoom.map) {\n map.scrollZoom.enable();\n } else {\n map.scrollZoom.disable();\n }\n };\n proto.resolveOnRender = function(resolve) {\n var map = this.map;\n map.on(\"render\", function onRender() {\n if (map.loaded()) {\n map.off(\"render\", onRender);\n setTimeout(resolve, 10);\n }\n });\n };\n proto.rejectOnError = function(reject) {\n var map = this.map;\n function handler() {\n reject(new Error(constants.mapOnErrorMsg));\n }\n map.once(\"error\", handler);\n map.once(\"style.error\", handler);\n map.once(\"source.error\", handler);\n map.once(\"tile.error\", handler);\n map.once(\"layer.error\", handler);\n };\n proto.createFramework = function(fullLayout) {\n var self2 = this;\n var div = self2.div = document.createElement(\"div\");\n div.id = self2.uid;\n div.style.position = \"absolute\";\n self2.container.appendChild(div);\n self2.xaxis = {\n _id: \"x\",\n c2p: function(v) {\n return self2.project(v).x;\n }\n };\n self2.yaxis = {\n _id: \"y\",\n c2p: function(v) {\n return self2.project(v).y;\n }\n };\n self2.updateFramework(fullLayout);\n self2.mockAxis = {\n type: \"linear\",\n showexponent: \"all\",\n exponentformat: \"B\"\n };\n Axes.setConvert(self2.mockAxis, fullLayout);\n };\n proto.initFx = function(calcData, fullLayout) {\n var self2 = this;\n var gd = self2.gd;\n var map = self2.map;\n map.on(\"moveend\", function(evt) {\n if (!self2.map) return;\n var fullLayoutNow = gd._fullLayout;\n if (evt.originalEvent || self2.wheeling) {\n var optsNow = fullLayoutNow[self2.id];\n Registry.call(\"_storeDirectGUIEdit\", gd.layout, fullLayoutNow._preGUI, self2.getViewEdits(optsNow));\n var viewNow = self2.getView();\n optsNow._input.center = optsNow.center = viewNow.center;\n optsNow._input.zoom = optsNow.zoom = viewNow.zoom;\n optsNow._input.bearing = optsNow.bearing = viewNow.bearing;\n optsNow._input.pitch = optsNow.pitch = viewNow.pitch;\n gd.emit(\"plotly_relayout\", self2.getViewEditsWithDerived(viewNow));\n }\n if (evt.originalEvent && evt.originalEvent.type === \"mouseup\") {\n self2.dragging = false;\n } else if (self2.wheeling) {\n self2.wheeling = false;\n }\n if (fullLayoutNow && fullLayoutNow._rehover) {\n fullLayoutNow._rehover();\n }\n });\n map.on(\"wheel\", function() {\n self2.wheeling = true;\n });\n map.on(\"mousemove\", function(evt) {\n var bb = self2.div.getBoundingClientRect();\n var xy = [\n evt.originalEvent.offsetX,\n evt.originalEvent.offsetY\n ];\n evt.target.getBoundingClientRect = function() {\n return bb;\n };\n self2.xaxis.p2c = function() {\n return map.unproject(xy).lng;\n };\n self2.yaxis.p2c = function() {\n return map.unproject(xy).lat;\n };\n gd._fullLayout._rehover = function() {\n if (gd._fullLayout._hoversubplot === self2.id && gd._fullLayout[self2.id]) {\n Fx.hover(gd, evt, self2.id);\n }\n };\n Fx.hover(gd, evt, self2.id);\n gd._fullLayout._hoversubplot = self2.id;\n });\n function unhover() {\n Fx.loneUnhover(fullLayout._hoverlayer);\n }\n map.on(\"dragstart\", function() {\n self2.dragging = true;\n unhover();\n });\n map.on(\"zoomstart\", unhover);\n map.on(\"mouseout\", function() {\n gd._fullLayout._hoversubplot = null;\n });\n function emitUpdate() {\n var viewNow = self2.getView();\n gd.emit(\"plotly_relayouting\", self2.getViewEditsWithDerived(viewNow));\n }\n map.on(\"drag\", emitUpdate);\n map.on(\"zoom\", emitUpdate);\n map.on(\"dblclick\", function() {\n var optsNow = gd._fullLayout[self2.id];\n Registry.call(\"_storeDirectGUIEdit\", gd.layout, gd._fullLayout._preGUI, self2.getViewEdits(optsNow));\n var viewInitial = self2.viewInitial;\n map.setCenter(convertCenter(viewInitial.center));\n map.setZoom(viewInitial.zoom);\n map.setBearing(viewInitial.bearing);\n map.setPitch(viewInitial.pitch);\n var viewNow = self2.getView();\n optsNow._input.center = optsNow.center = viewNow.center;\n optsNow._input.zoom = optsNow.zoom = viewNow.zoom;\n optsNow._input.bearing = optsNow.bearing = viewNow.bearing;\n optsNow._input.pitch = optsNow.pitch = viewNow.pitch;\n gd.emit(\"plotly_doubleclick\", null);\n gd.emit(\"plotly_relayout\", self2.getViewEditsWithDerived(viewNow));\n });\n self2.clearOutline = function() {\n clearSelectionsCache(self2.dragOptions);\n clearOutline(self2.dragOptions.gd);\n };\n self2.onClickInPanFn = function(dragOptions) {\n return function(evt) {\n var clickMode = gd._fullLayout.clickmode;\n if (clickMode.indexOf(\"select\") > -1) {\n selectOnClick(evt.originalEvent, gd, [self2.xaxis], [self2.yaxis], self2.id, dragOptions);\n }\n if (clickMode.indexOf(\"event\") > -1) {\n Fx.click(gd, evt.originalEvent);\n }\n };\n };\n };\n proto.updateFx = function(fullLayout) {\n var self2 = this;\n var map = self2.map;\n var gd = self2.gd;\n if (self2.isStatic) return;\n function invert(pxpy) {\n var obj = self2.map.unproject(pxpy);\n return [obj.lng, obj.lat];\n }\n var dragMode = fullLayout.dragmode;\n var fillRangeItems;\n fillRangeItems = function(eventData, poly) {\n if (poly.isRect) {\n var ranges = eventData.range = {};\n ranges[self2.id] = [\n invert([poly.xmin, poly.ymin]),\n invert([poly.xmax, poly.ymax])\n ];\n } else {\n var dataPts = eventData.lassoPoints = {};\n dataPts[self2.id] = poly.map(invert);\n }\n };\n var oldDragOptions = self2.dragOptions;\n self2.dragOptions = Lib.extendDeep(oldDragOptions || {}, {\n dragmode: fullLayout.dragmode,\n element: self2.div,\n gd,\n plotinfo: {\n id: self2.id,\n domain: fullLayout[self2.id].domain,\n xaxis: self2.xaxis,\n yaxis: self2.yaxis,\n fillRangeItems\n },\n xaxes: [self2.xaxis],\n yaxes: [self2.yaxis],\n subplot: self2.id\n });\n map.off(\"click\", self2.onClickInPanHandler);\n if (selectMode(dragMode) || drawMode(dragMode)) {\n map.dragPan.disable();\n map.on(\"zoomstart\", self2.clearOutline);\n self2.dragOptions.prepFn = function(e, startX, startY) {\n prepSelect(e, startX, startY, self2.dragOptions, dragMode);\n };\n dragElement.init(self2.dragOptions);\n } else {\n map.dragPan.enable();\n map.off(\"zoomstart\", self2.clearOutline);\n self2.div.onmousedown = null;\n self2.div.ontouchstart = null;\n self2.div.removeEventListener(\"touchstart\", self2.div._ontouchstart);\n self2.onClickInPanHandler = self2.onClickInPanFn(self2.dragOptions);\n map.on(\"click\", self2.onClickInPanHandler);\n }\n };\n proto.updateFramework = function(fullLayout) {\n var domain = fullLayout[this.id].domain;\n var size = fullLayout._size;\n var style = this.div.style;\n style.width = size.w * (domain.x[1] - domain.x[0]) + \"px\";\n style.height = size.h * (domain.y[1] - domain.y[0]) + \"px\";\n style.left = size.l + domain.x[0] * size.w + \"px\";\n style.top = size.t + (1 - domain.y[1]) * size.h + \"px\";\n this.xaxis._offset = size.l + domain.x[0] * size.w;\n this.xaxis._length = size.w * (domain.x[1] - domain.x[0]);\n this.yaxis._offset = size.t + (1 - domain.y[1]) * size.h;\n this.yaxis._length = size.h * (domain.y[1] - domain.y[0]);\n };\n proto.updateLayers = function(fullLayout) {\n var opts = fullLayout[this.id];\n var layers = opts.layers;\n var layerList = this.layerList;\n var i;\n if (layers.length !== layerList.length) {\n for (i = 0; i < layerList.length; i++) {\n layerList[i].dispose();\n }\n layerList = this.layerList = [];\n for (i = 0; i < layers.length; i++) {\n layerList.push(createMapLayer(this, i, layers[i]));\n }\n } else {\n for (i = 0; i < layers.length; i++) {\n layerList[i].update(layers[i]);\n }\n }\n };\n proto.destroy = function() {\n if (this.map) {\n this.map.remove();\n this.map = null;\n this.container.removeChild(this.div);\n }\n };\n proto.toImage = function() {\n this.map.stop();\n return this.map.getCanvas().toDataURL();\n };\n proto.setOptions = function(id, methodName, opts) {\n for (var k in opts) {\n this.map[methodName](id, k, opts[k]);\n }\n };\n proto.getMapLayers = function() {\n return this.map.getStyle().layers;\n };\n proto.addLayer = function(opts, below) {\n var map = this.map;\n if (typeof below === \"string\") {\n if (below === \"\") {\n map.addLayer(opts, below);\n return;\n }\n var mapLayers = this.getMapLayers();\n for (var i = 0; i < mapLayers.length; i++) {\n if (below === mapLayers[i].id) {\n map.addLayer(opts, below);\n return;\n }\n }\n Lib.warn([\n \"Trying to add layer with *below* value\",\n below,\n \"referencing a layer that does not exist\",\n \"or that does not yet exist.\"\n ].join(\" \"));\n }\n map.addLayer(opts);\n };\n proto.project = function(v) {\n return this.map.project(new maplibregl.LngLat(v[0], v[1]));\n };\n proto.getView = function() {\n var map = this.map;\n var mapCenter = map.getCenter();\n var lon = mapCenter.lng;\n var lat = mapCenter.lat;\n var center = { lon, lat };\n var canvas = map.getCanvas();\n var w = parseInt(canvas.style.width);\n var h = parseInt(canvas.style.height);\n return {\n center,\n zoom: map.getZoom(),\n bearing: map.getBearing(),\n pitch: map.getPitch(),\n _derived: {\n coordinates: [\n map.unproject([0, 0]).toArray(),\n map.unproject([w, 0]).toArray(),\n map.unproject([w, h]).toArray(),\n map.unproject([0, h]).toArray()\n ]\n }\n };\n };\n proto.getViewEdits = function(cont) {\n var id = this.id;\n var keys = [\"center\", \"zoom\", \"bearing\", \"pitch\"];\n var obj = {};\n for (var i = 0; i < keys.length; i++) {\n var k = keys[i];\n obj[id + \".\" + k] = cont[k];\n }\n return obj;\n };\n proto.getViewEditsWithDerived = function(cont) {\n var id = this.id;\n var obj = this.getViewEdits(cont);\n obj[id + \"._derived\"] = cont._derived;\n return obj;\n };\n function getStyleObj(val) {\n var styleObj = {};\n if (Lib.isPlainObject(val)) {\n styleObj.id = val.id;\n styleObj.style = val;\n } else if (typeof val === \"string\") {\n styleObj.id = val;\n if (constants.stylesMap[val]) {\n styleObj.style = constants.stylesMap[val];\n } else {\n styleObj.style = val;\n }\n } else {\n styleObj.id = constants.styleValueDflt;\n styleObj.style = convertStyleVal(constants.styleValueDflt);\n }\n styleObj.transition = { duration: 0, delay: 0 };\n return styleObj;\n }\n function convertStyleVal(val) {\n return constants.styleUrlPrefix + val + \"-\" + constants.styleUrlSuffix;\n }\n function convertCenter(center) {\n return [center.lon, center.lat];\n }\n module.exports = Map2;\n }\n });\n\n // src/plots/map/layout_defaults.js\n var require_layout_defaults18 = __commonJS({\n \"src/plots/map/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleSubplotDefaults = require_subplot_defaults();\n var handleArrayContainerDefaults = require_array_container_defaults();\n var layoutAttributes = require_layout_attributes20();\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {\n handleSubplotDefaults(layoutIn, layoutOut, fullData, {\n type: \"map\",\n attributes: layoutAttributes,\n handleDefaults,\n partition: \"y\"\n });\n };\n function handleDefaults(containerIn, containerOut, coerce) {\n coerce(\"style\");\n coerce(\"center.lon\");\n coerce(\"center.lat\");\n coerce(\"zoom\");\n coerce(\"bearing\");\n coerce(\"pitch\");\n var west = coerce(\"bounds.west\");\n var east = coerce(\"bounds.east\");\n var south = coerce(\"bounds.south\");\n var north = coerce(\"bounds.north\");\n if (west === void 0 || east === void 0 || south === void 0 || north === void 0) {\n delete containerOut.bounds;\n }\n handleArrayContainerDefaults(containerIn, containerOut, {\n name: \"layers\",\n handleItemDefaults: handleLayerDefaults\n });\n containerOut._input = containerIn;\n }\n function handleLayerDefaults(layerIn, layerOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(layerIn, layerOut, layoutAttributes.layers, attr, dflt);\n }\n var visible = coerce(\"visible\");\n if (visible) {\n var sourceType = coerce(\"sourcetype\");\n var mustBeRasterLayer = sourceType === \"raster\" || sourceType === \"image\";\n coerce(\"source\");\n coerce(\"sourceattribution\");\n if (sourceType === \"vector\") {\n coerce(\"sourcelayer\");\n }\n if (sourceType === \"image\") {\n coerce(\"coordinates\");\n }\n var typeDflt;\n if (mustBeRasterLayer) typeDflt = \"raster\";\n var type = coerce(\"type\", typeDflt);\n if (mustBeRasterLayer && type !== \"raster\") {\n type = layerOut.type = \"raster\";\n Lib.log(\"Source types *raster* and *image* must drawn *raster* layer type.\");\n }\n coerce(\"below\");\n coerce(\"color\");\n coerce(\"opacity\");\n coerce(\"minzoom\");\n coerce(\"maxzoom\");\n if (type === \"circle\") {\n coerce(\"circle.radius\");\n }\n if (type === \"line\") {\n coerce(\"line.width\");\n coerce(\"line.dash\");\n }\n if (type === \"fill\") {\n coerce(\"fill.outlinecolor\");\n }\n if (type === \"symbol\") {\n coerce(\"symbol.icon\");\n coerce(\"symbol.iconsize\");\n coerce(\"symbol.text\");\n Lib.coerceFont(coerce, \"symbol.textfont\", void 0, {\n noFontVariant: true,\n noFontShadow: true,\n noFontLineposition: true,\n noFontTextcase: true\n });\n coerce(\"symbol.textposition\");\n coerce(\"symbol.placement\");\n }\n }\n }\n }\n });\n\n // src/plots/map/index.js\n var require_map3 = __commonJS({\n \"src/plots/map/index.js\"(exports) {\n \"use strict\";\n var Lib = require_lib();\n var strTranslate = Lib.strTranslate;\n var strScale = Lib.strScale;\n var getSubplotCalcData = require_get_data().getSubplotCalcData;\n var xmlnsNamespaces = require_xmlns_namespaces();\n var d3 = require_d3();\n var Drawing = require_drawing();\n var svgTextUtils = require_svg_text_utils();\n var Map2 = require_map2();\n var MAP = \"map\";\n exports.name = MAP;\n exports.attr = \"subplot\";\n exports.idRoot = MAP;\n exports.idRegex = exports.attrRegex = Lib.counterRegex(MAP);\n exports.attributes = {\n subplot: {\n valType: \"subplotid\",\n dflt: \"map\",\n editType: \"calc\"\n }\n };\n exports.layoutAttributes = require_layout_attributes20();\n exports.supplyLayoutDefaults = require_layout_defaults18();\n exports.plot = function plot(gd) {\n var fullLayout = gd._fullLayout;\n var calcData = gd.calcdata;\n var mapIds = fullLayout._subplots[MAP];\n for (var i = 0; i < mapIds.length; i++) {\n var id = mapIds[i];\n var subplotCalcData = getSubplotCalcData(calcData, MAP, id);\n var opts = fullLayout[id];\n var map = opts._subplot;\n if (!map) {\n map = new Map2(gd, id);\n fullLayout[id]._subplot = map;\n }\n if (!map.viewInitial) {\n map.viewInitial = {\n center: Lib.extendFlat({}, opts.center),\n zoom: opts.zoom,\n bearing: opts.bearing,\n pitch: opts.pitch\n };\n }\n map.plot(subplotCalcData, fullLayout, gd._promises);\n }\n };\n exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var oldMapKeys = oldFullLayout._subplots[MAP] || [];\n for (var i = 0; i < oldMapKeys.length; i++) {\n var oldMapKey = oldMapKeys[i];\n if (!newFullLayout[oldMapKey] && !!oldFullLayout[oldMapKey]._subplot) {\n oldFullLayout[oldMapKey]._subplot.destroy();\n }\n }\n };\n exports.toSVG = function(gd) {\n var fullLayout = gd._fullLayout;\n var subplotIds = fullLayout._subplots[MAP];\n var size = fullLayout._size;\n for (var i = 0; i < subplotIds.length; i++) {\n var opts = fullLayout[subplotIds[i]];\n var domain = opts.domain;\n var map = opts._subplot;\n var imageData = map.toImage(\"png\");\n var image = fullLayout._glimages.append(\"svg:image\");\n image.attr({\n xmlns: xmlnsNamespaces.svg,\n \"xlink:href\": imageData,\n x: size.l + size.w * domain.x[0],\n y: size.t + size.h * (1 - domain.y[1]),\n width: size.w * (domain.x[1] - domain.x[0]),\n height: size.h * (domain.y[1] - domain.y[0]),\n preserveAspectRatio: \"none\"\n });\n var subplotDiv = d3.select(opts._subplot.div);\n var attributions = subplotDiv.select(\".maplibregl-ctrl-attrib\").text().replace(\"Improve this map\", \"\");\n var attributionGroup = fullLayout._glimages.append(\"g\");\n var attributionText = attributionGroup.append(\"text\");\n attributionText.text(attributions).classed(\"static-attribution\", true).attr({\n \"font-size\": 12,\n \"font-family\": \"Arial\",\n color: \"rgba(0, 0, 0, 0.75)\",\n \"text-anchor\": \"end\",\n \"data-unformatted\": attributions\n });\n var bBox = Drawing.bBox(attributionText.node());\n var maxWidth = size.w * (domain.x[1] - domain.x[0]);\n if (bBox.width > maxWidth / 2) {\n var multilineAttributions = attributions.split(\"|\").join(\"
    \");\n attributionText.text(multilineAttributions).attr(\"data-unformatted\", multilineAttributions).call(svgTextUtils.convertToTspans, gd);\n bBox = Drawing.bBox(attributionText.node());\n }\n attributionText.attr(\"transform\", strTranslate(-3, -bBox.height + 8));\n attributionGroup.insert(\"rect\", \".static-attribution\").attr({\n x: -bBox.width - 6,\n y: -bBox.height - 3,\n width: bBox.width + 6,\n height: bBox.height + 3,\n fill: \"rgba(255, 255, 255, 0.75)\"\n });\n var scaleRatio = 1;\n if (bBox.width + 6 > maxWidth) scaleRatio = maxWidth / (bBox.width + 6);\n var offset = [size.l + size.w * domain.x[1], size.t + size.h * (1 - domain.y[0])];\n attributionGroup.attr(\"transform\", strTranslate(offset[0], offset[1]) + strScale(scaleRatio));\n }\n };\n exports.updateFx = function(gd) {\n var fullLayout = gd._fullLayout;\n var subplotIds = fullLayout._subplots[MAP];\n for (var i = 0; i < subplotIds.length; i++) {\n var subplotObj = fullLayout[subplotIds[i]]._subplot;\n subplotObj.updateFx(fullLayout);\n }\n };\n }\n });\n\n // src/traces/scattermap/index.js\n var require_scattermap = __commonJS({\n \"src/traces/scattermap/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes57(),\n supplyDefaults: require_defaults53(),\n colorbar: require_marker_colorbar(),\n formatLabels: require_format_labels6(),\n calc: require_calc27(),\n plot: require_plot26(),\n hoverPoints: require_hover20().hoverPoints,\n eventData: require_event_data13(),\n selectPoints: require_select10(),\n styleOnSelect: function(_, cd) {\n if (cd) {\n var trace = cd[0].trace;\n trace._glTrace.update(cd);\n }\n },\n moduleType: \"trace\",\n name: \"scattermap\",\n basePlotModule: require_map3(),\n categories: [\"map\", \"gl\", \"symbols\", \"showLegend\", \"scatter-like\"],\n meta: {}\n };\n }\n });\n\n // lib/scattermap.js\n var require_scattermap2 = __commonJS({\n \"lib/scattermap.js\"(exports, module) {\n \"use strict\";\n module.exports = require_scattermap();\n }\n });\n\n // src/traces/choroplethmap/attributes.js\n var require_attributes58 = __commonJS({\n \"src/traces/choroplethmap/attributes.js\"(exports, module) {\n \"use strict\";\n var choroplethAttrs = require_attributes49();\n var colorScaleAttrs = require_attributes8();\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var baseAttrs = require_attributes2();\n var extendFlat = require_extend().extendFlat;\n module.exports = extendFlat(\n {\n locations: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n // TODO\n // Maybe start with only one value (that we could name e.g. 'geojson-id'),\n // but eventually:\n // - we could also support for our own dist/topojson/*\n // .. and locationmode: choroplethAttrs.locationmode,\n z: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n // TODO maybe we could also set a \"key\" to dig out values out of the\n // GeoJSON feature `properties` fields?\n geojson: {\n valType: \"any\",\n editType: \"calc\"\n },\n featureidkey: extendFlat({}, choroplethAttrs.featureidkey, {}),\n // TODO agree on name / behaviour\n //\n // 'below' is used currently for layout.map.layers,\n // even though it's not very plotly-esque.\n //\n // Note also, that the map-gl style don't all have the same layers,\n // see https://codepen.io/etpinard/pen/ydVMwM for full list\n below: {\n valType: \"string\",\n editType: \"plot\"\n },\n text: choroplethAttrs.text,\n hovertext: choroplethAttrs.hovertext,\n marker: {\n line: {\n color: extendFlat({}, choroplethAttrs.marker.line.color, { editType: \"plot\" }),\n width: extendFlat({}, choroplethAttrs.marker.line.width, { editType: \"plot\" }),\n editType: \"calc\"\n },\n // TODO maybe having a dflt less than 1, together with `below:''` would be better?\n opacity: extendFlat({}, choroplethAttrs.marker.opacity, { editType: \"plot\" }),\n editType: \"calc\"\n },\n selected: {\n marker: {\n opacity: extendFlat({}, choroplethAttrs.selected.marker.opacity, { editType: \"plot\" }),\n editType: \"plot\"\n },\n editType: \"plot\"\n },\n unselected: {\n marker: {\n opacity: extendFlat({}, choroplethAttrs.unselected.marker.opacity, { editType: \"plot\" }),\n editType: \"plot\"\n },\n editType: \"plot\"\n },\n hoverinfo: choroplethAttrs.hoverinfo,\n hovertemplate: hovertemplateAttrs({}, { keys: [\"properties\"] }),\n showlegend: extendFlat({}, baseAttrs.showlegend, { dflt: false })\n },\n colorScaleAttrs(\"\", {\n cLetter: \"z\",\n editTypeOverride: \"calc\"\n })\n );\n }\n });\n\n // src/traces/choroplethmap/defaults.js\n var require_defaults54 = __commonJS({\n \"src/traces/choroplethmap/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var colorscaleDefaults = require_defaults2();\n var attributes = require_attributes58();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var locations = coerce(\"locations\");\n var z = coerce(\"z\");\n var geojson = coerce(\"geojson\");\n if (!Lib.isArrayOrTypedArray(locations) || !locations.length || !Lib.isArrayOrTypedArray(z) || !z.length || !(typeof geojson === \"string\" && geojson !== \"\" || Lib.isPlainObject(geojson))) {\n traceOut.visible = false;\n return;\n }\n coerce(\"featureidkey\");\n traceOut._length = Math.min(locations.length, z.length);\n coerce(\"below\");\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n var mlw = coerce(\"marker.line.width\");\n if (mlw) coerce(\"marker.line.color\");\n coerce(\"marker.opacity\");\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"\", cLetter: \"z\" });\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n };\n }\n });\n\n // src/traces/choroplethmap/convert.js\n var require_convert15 = __commonJS({\n \"src/traces/choroplethmap/convert.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var Colorscale = require_colorscale();\n var Drawing = require_drawing();\n var makeBlank = require_geojson_utils().makeBlank;\n var geoUtils = require_geo_location_utils();\n function convert(calcTrace) {\n var trace = calcTrace[0].trace;\n var isVisible = trace.visible === true && trace._length !== 0;\n var fill = {\n layout: { visibility: \"none\" },\n paint: {}\n };\n var line = {\n layout: { visibility: \"none\" },\n paint: {}\n };\n var opts = trace._opts = {\n fill,\n line,\n geojson: makeBlank()\n };\n if (!isVisible) return opts;\n var features = geoUtils.extractTraceFeature(calcTrace);\n if (!features) return opts;\n var sclFunc = Colorscale.makeColorScaleFuncFromTrace(trace);\n var marker = trace.marker;\n var markerLine = marker.line || {};\n var opacityFn;\n if (Lib.isArrayOrTypedArray(marker.opacity)) {\n opacityFn = function(d) {\n var mo = d.mo;\n return isNumeric(mo) ? +Lib.constrain(mo, 0, 1) : 0;\n };\n }\n var lineColorFn;\n if (Lib.isArrayOrTypedArray(markerLine.color)) {\n lineColorFn = function(d) {\n return d.mlc;\n };\n }\n var lineWidthFn;\n if (Lib.isArrayOrTypedArray(markerLine.width)) {\n lineWidthFn = function(d) {\n return d.mlw;\n };\n }\n for (var i = 0; i < calcTrace.length; i++) {\n var cdi = calcTrace[i];\n var fOut = cdi.fOut;\n if (fOut) {\n var props = fOut.properties;\n props.fc = sclFunc(cdi.z);\n if (opacityFn) props.mo = opacityFn(cdi);\n if (lineColorFn) props.mlc = lineColorFn(cdi);\n if (lineWidthFn) props.mlw = lineWidthFn(cdi);\n cdi.ct = props.ct;\n cdi._polygons = geoUtils.feature2polygons(fOut);\n }\n }\n var opacitySetting = opacityFn ? { type: \"identity\", property: \"mo\" } : marker.opacity;\n Lib.extendFlat(fill.paint, {\n \"fill-color\": { type: \"identity\", property: \"fc\" },\n \"fill-opacity\": opacitySetting\n });\n Lib.extendFlat(line.paint, {\n \"line-color\": lineColorFn ? { type: \"identity\", property: \"mlc\" } : markerLine.color,\n \"line-width\": lineWidthFn ? { type: \"identity\", property: \"mlw\" } : markerLine.width,\n \"line-opacity\": opacitySetting\n });\n fill.layout.visibility = \"visible\";\n line.layout.visibility = \"visible\";\n opts.geojson = { type: \"FeatureCollection\", features };\n convertOnSelect(calcTrace);\n return opts;\n }\n function convertOnSelect(calcTrace) {\n var trace = calcTrace[0].trace;\n var opts = trace._opts;\n var opacitySetting;\n if (trace.selectedpoints) {\n var fns = Drawing.makeSelectedPointStyleFns(trace);\n for (var i = 0; i < calcTrace.length; i++) {\n var cdi = calcTrace[i];\n if (cdi.fOut) {\n cdi.fOut.properties.mo2 = fns.selectedOpacityFn(cdi);\n }\n }\n opacitySetting = { type: \"identity\", property: \"mo2\" };\n } else {\n opacitySetting = Lib.isArrayOrTypedArray(trace.marker.opacity) ? { type: \"identity\", property: \"mo\" } : trace.marker.opacity;\n }\n Lib.extendFlat(opts.fill.paint, { \"fill-opacity\": opacitySetting });\n Lib.extendFlat(opts.line.paint, { \"line-opacity\": opacitySetting });\n return opts;\n }\n module.exports = {\n convert,\n convertOnSelect\n };\n }\n });\n\n // src/traces/choroplethmap/plot.js\n var require_plot27 = __commonJS({\n \"src/traces/choroplethmap/plot.js\"(exports, module) {\n \"use strict\";\n var convert = require_convert15().convert;\n var convertOnSelect = require_convert15().convertOnSelect;\n var LAYER_PREFIX = require_constants27().traceLayerPrefix;\n function ChoroplethMap(subplot, uid) {\n this.type = \"choroplethmap\";\n this.subplot = subplot;\n this.uid = uid;\n this.sourceId = \"source-\" + uid;\n this.layerList = [\n [\"fill\", LAYER_PREFIX + uid + \"-fill\"],\n [\"line\", LAYER_PREFIX + uid + \"-line\"]\n ];\n this.below = null;\n }\n var proto = ChoroplethMap.prototype;\n proto.update = function(calcTrace) {\n this._update(convert(calcTrace));\n calcTrace[0].trace._glTrace = this;\n };\n proto.updateOnSelect = function(calcTrace) {\n this._update(convertOnSelect(calcTrace));\n };\n proto._update = function(optsAll) {\n var subplot = this.subplot;\n var layerList = this.layerList;\n var below = subplot.belowLookup[\"trace-\" + this.uid];\n subplot.map.getSource(this.sourceId).setData(optsAll.geojson);\n if (below !== this.below) {\n this._removeLayers();\n this._addLayers(optsAll, below);\n this.below = below;\n }\n for (var i = 0; i < layerList.length; i++) {\n var item = layerList[i];\n var k = item[0];\n var id = item[1];\n var opts = optsAll[k];\n subplot.setOptions(id, \"setLayoutProperty\", opts.layout);\n if (opts.layout.visibility === \"visible\") {\n subplot.setOptions(id, \"setPaintProperty\", opts.paint);\n }\n }\n };\n proto._addLayers = function(optsAll, below) {\n var subplot = this.subplot;\n var layerList = this.layerList;\n var sourceId = this.sourceId;\n for (var i = 0; i < layerList.length; i++) {\n var item = layerList[i];\n var k = item[0];\n var opts = optsAll[k];\n subplot.addLayer({\n type: k,\n id: item[1],\n source: sourceId,\n layout: opts.layout,\n paint: opts.paint\n }, below);\n }\n };\n proto._removeLayers = function() {\n var map = this.subplot.map;\n var layerList = this.layerList;\n for (var i = layerList.length - 1; i >= 0; i--) {\n map.removeLayer(layerList[i][1]);\n }\n };\n proto.dispose = function() {\n var map = this.subplot.map;\n this._removeLayers();\n map.removeSource(this.sourceId);\n };\n module.exports = function createChoroplethMap(subplot, calcTrace) {\n var trace = calcTrace[0].trace;\n var choroplethMap = new ChoroplethMap(subplot, trace.uid);\n var sourceId = choroplethMap.sourceId;\n var optsAll = convert(calcTrace);\n var below = choroplethMap.below = subplot.belowLookup[\"trace-\" + trace.uid];\n subplot.map.addSource(sourceId, {\n type: \"geojson\",\n data: optsAll.geojson\n });\n choroplethMap._addLayers(optsAll, below);\n calcTrace[0].trace._glTrace = choroplethMap;\n return choroplethMap;\n };\n }\n });\n\n // src/traces/choroplethmap/index.js\n var require_choroplethmap = __commonJS({\n \"src/traces/choroplethmap/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes58(),\n supplyDefaults: require_defaults54(),\n colorbar: require_colorbar2(),\n calc: require_calc28(),\n plot: require_plot27(),\n hoverPoints: require_hover15(),\n eventData: require_event_data10(),\n selectPoints: require_select6(),\n styleOnSelect: function(_, cd) {\n if (cd) {\n var trace = cd[0].trace;\n trace._glTrace.updateOnSelect(cd);\n }\n },\n getBelow: function(trace, subplot) {\n var mapLayers = subplot.getMapLayers();\n for (var i = mapLayers.length - 2; i >= 0; i--) {\n var layerId = mapLayers[i].id;\n if (typeof layerId === \"string\" && layerId.indexOf(\"water\") === 0) {\n for (var j = i + 1; j < mapLayers.length; j++) {\n layerId = mapLayers[j].id;\n if (typeof layerId === \"string\" && layerId.indexOf(\"plotly-\") === -1) {\n return layerId;\n }\n }\n }\n }\n },\n moduleType: \"trace\",\n name: \"choroplethmap\",\n basePlotModule: require_map3(),\n categories: [\"map\", \"gl\", \"noOpacity\", \"showLegend\"],\n meta: {\n hr_name: \"choropleth_map\"\n }\n };\n }\n });\n\n // lib/choroplethmap.js\n var require_choroplethmap2 = __commonJS({\n \"lib/choroplethmap.js\"(exports, module) {\n \"use strict\";\n module.exports = require_choroplethmap();\n }\n });\n\n // src/traces/densitymap/attributes.js\n var require_attributes59 = __commonJS({\n \"src/traces/densitymap/attributes.js\"(exports, module) {\n \"use strict\";\n var colorScaleAttrs = require_attributes8();\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var baseAttrs = require_attributes2();\n var scatterMapAttrs = require_attributes57();\n var extendFlat = require_extend().extendFlat;\n module.exports = extendFlat(\n {\n lon: scatterMapAttrs.lon,\n lat: scatterMapAttrs.lat,\n z: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n radius: {\n valType: \"number\",\n editType: \"plot\",\n arrayOk: true,\n min: 1,\n dflt: 30\n },\n below: {\n valType: \"string\",\n editType: \"plot\"\n },\n text: scatterMapAttrs.text,\n hovertext: scatterMapAttrs.hovertext,\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: [\"lon\", \"lat\", \"z\", \"text\", \"name\"]\n }),\n hovertemplate: hovertemplateAttrs(),\n showlegend: extendFlat({}, baseAttrs.showlegend, { dflt: false })\n },\n colorScaleAttrs(\"\", {\n cLetter: \"z\",\n editTypeOverride: \"calc\"\n })\n );\n }\n });\n\n // src/traces/densitymap/defaults.js\n var require_defaults55 = __commonJS({\n \"src/traces/densitymap/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var colorscaleDefaults = require_defaults2();\n var attributes = require_attributes59();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var lon = coerce(\"lon\") || [];\n var lat = coerce(\"lat\") || [];\n var len = Math.min(lon.length, lat.length);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n traceOut._length = len;\n coerce(\"z\");\n coerce(\"radius\");\n coerce(\"below\");\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: \"\", cLetter: \"z\" });\n };\n }\n });\n\n // src/traces/densitymap/calc.js\n var require_calc34 = __commonJS({\n \"src/traces/densitymap/calc.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n var BADNUM = require_numerical().BADNUM;\n var colorscaleCalc = require_calc();\n var _ = require_lib()._;\n module.exports = function calc(gd, trace) {\n var len = trace._length;\n var calcTrace = new Array(len);\n var z = trace.z;\n var hasZ = isArrayOrTypedArray(z) && z.length;\n for (var i = 0; i < len; i++) {\n var cdi = calcTrace[i] = {};\n var lon = trace.lon[i];\n var lat = trace.lat[i];\n cdi.lonlat = isNumeric(lon) && isNumeric(lat) ? [+lon, +lat] : [BADNUM, BADNUM];\n if (hasZ) {\n var zi = z[i];\n cdi.z = isNumeric(zi) ? zi : BADNUM;\n }\n }\n colorscaleCalc(gd, trace, {\n vals: hasZ ? z : [0, 1],\n containerStr: \"\",\n cLetter: \"z\"\n });\n if (len) {\n calcTrace[0].t = {\n labels: {\n lat: _(gd, \"lat:\") + \" \",\n lon: _(gd, \"lon:\") + \" \"\n }\n };\n }\n return calcTrace;\n };\n }\n });\n\n // src/traces/densitymap/convert.js\n var require_convert16 = __commonJS({\n \"src/traces/densitymap/convert.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var Color2 = require_color();\n var Colorscale = require_colorscale();\n var BADNUM = require_numerical().BADNUM;\n var makeBlank = require_geojson_utils().makeBlank;\n module.exports = function convert(calcTrace) {\n var trace = calcTrace[0].trace;\n var isVisible = trace.visible === true && trace._length !== 0;\n var heatmap = {\n layout: { visibility: \"none\" },\n paint: {}\n };\n var opts = trace._opts = {\n heatmap,\n geojson: makeBlank()\n };\n if (!isVisible) return opts;\n var features = [];\n var i;\n var z = trace.z;\n var radius = trace.radius;\n var hasZ = Lib.isArrayOrTypedArray(z) && z.length;\n var hasArrayRadius = Lib.isArrayOrTypedArray(radius);\n for (i = 0; i < calcTrace.length; i++) {\n var cdi = calcTrace[i];\n var lonlat = cdi.lonlat;\n if (lonlat[0] !== BADNUM) {\n var props = {};\n if (hasZ) {\n var zi = cdi.z;\n props.z = zi !== BADNUM ? zi : 0;\n }\n if (hasArrayRadius) {\n props.r = isNumeric(radius[i]) && radius[i] > 0 ? +radius[i] : 0;\n }\n features.push({\n type: \"Feature\",\n geometry: { type: \"Point\", coordinates: lonlat },\n properties: props\n });\n }\n }\n var cOpts = Colorscale.extractOpts(trace);\n var scl = cOpts.reversescale ? Colorscale.flipScale(cOpts.colorscale) : cOpts.colorscale;\n var scl01 = scl[0][1];\n var color0 = Color2.opacity(scl01) < 1 ? scl01 : Color2.addOpacity(scl01, 0);\n var heatmapColor = [\n \"interpolate\",\n [\"linear\"],\n [\"heatmap-density\"],\n 0,\n color0\n ];\n for (i = 1; i < scl.length; i++) {\n heatmapColor.push(scl[i][0], scl[i][1]);\n }\n var zExp = [\n \"interpolate\",\n [\"linear\"],\n [\"get\", \"z\"],\n cOpts.min,\n 0,\n cOpts.max,\n 1\n ];\n Lib.extendFlat(opts.heatmap.paint, {\n \"heatmap-weight\": hasZ ? zExp : 1 / (cOpts.max - cOpts.min),\n \"heatmap-color\": heatmapColor,\n \"heatmap-radius\": hasArrayRadius ? { type: \"identity\", property: \"r\" } : trace.radius,\n \"heatmap-opacity\": trace.opacity\n });\n opts.geojson = { type: \"FeatureCollection\", features };\n opts.heatmap.layout.visibility = \"visible\";\n return opts;\n };\n }\n });\n\n // src/traces/densitymap/plot.js\n var require_plot28 = __commonJS({\n \"src/traces/densitymap/plot.js\"(exports, module) {\n \"use strict\";\n var convert = require_convert16();\n var LAYER_PREFIX = require_constants27().traceLayerPrefix;\n function DensityMap(subplot, uid) {\n this.type = \"densitymap\";\n this.subplot = subplot;\n this.uid = uid;\n this.sourceId = \"source-\" + uid;\n this.layerList = [\n [\"heatmap\", LAYER_PREFIX + uid + \"-heatmap\"]\n ];\n this.below = null;\n }\n var proto = DensityMap.prototype;\n proto.update = function(calcTrace) {\n var subplot = this.subplot;\n var layerList = this.layerList;\n var optsAll = convert(calcTrace);\n var below = subplot.belowLookup[\"trace-\" + this.uid];\n subplot.map.getSource(this.sourceId).setData(optsAll.geojson);\n if (below !== this.below) {\n this._removeLayers();\n this._addLayers(optsAll, below);\n this.below = below;\n }\n for (var i = 0; i < layerList.length; i++) {\n var item = layerList[i];\n var k = item[0];\n var id = item[1];\n var opts = optsAll[k];\n subplot.setOptions(id, \"setLayoutProperty\", opts.layout);\n if (opts.layout.visibility === \"visible\") {\n subplot.setOptions(id, \"setPaintProperty\", opts.paint);\n }\n }\n };\n proto._addLayers = function(optsAll, below) {\n var subplot = this.subplot;\n var layerList = this.layerList;\n var sourceId = this.sourceId;\n for (var i = 0; i < layerList.length; i++) {\n var item = layerList[i];\n var k = item[0];\n var opts = optsAll[k];\n subplot.addLayer({\n type: k,\n id: item[1],\n source: sourceId,\n layout: opts.layout,\n paint: opts.paint\n }, below);\n }\n };\n proto._removeLayers = function() {\n var map = this.subplot.map;\n var layerList = this.layerList;\n for (var i = layerList.length - 1; i >= 0; i--) {\n map.removeLayer(layerList[i][1]);\n }\n };\n proto.dispose = function() {\n var map = this.subplot.map;\n this._removeLayers();\n map.removeSource(this.sourceId);\n };\n module.exports = function createDensityMap(subplot, calcTrace) {\n var trace = calcTrace[0].trace;\n var densityMap = new DensityMap(subplot, trace.uid);\n var sourceId = densityMap.sourceId;\n var optsAll = convert(calcTrace);\n var below = densityMap.below = subplot.belowLookup[\"trace-\" + trace.uid];\n subplot.map.addSource(sourceId, {\n type: \"geojson\",\n data: optsAll.geojson\n });\n densityMap._addLayers(optsAll, below);\n return densityMap;\n };\n }\n });\n\n // src/traces/densitymap/hover.js\n var require_hover21 = __commonJS({\n \"src/traces/densitymap/hover.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n var scatterMapHoverPoints = require_hover20().hoverPoints;\n var getExtraText = require_hover20().getExtraText;\n module.exports = function hoverPoints(pointData, xval, yval) {\n var pts = scatterMapHoverPoints(pointData, xval, yval);\n if (!pts) return;\n var newPointData = pts[0];\n var cd = newPointData.cd;\n var trace = cd[0].trace;\n var di = cd[newPointData.index];\n delete newPointData.color;\n if (\"z\" in di) {\n var ax = newPointData.subplot.mockAxis;\n newPointData.z = di.z;\n newPointData.zLabel = Axes.tickText(ax, ax.c2l(di.z), \"hover\").text;\n }\n newPointData.extraText = getExtraText(trace, di, cd[0].t.labels);\n return [newPointData];\n };\n }\n });\n\n // src/traces/densitymap/event_data.js\n var require_event_data14 = __commonJS({\n \"src/traces/densitymap/event_data.js\"(exports, module) {\n \"use strict\";\n module.exports = function eventData(out, pt) {\n out.lon = pt.lon;\n out.lat = pt.lat;\n out.z = pt.z;\n return out;\n };\n }\n });\n\n // src/traces/densitymap/index.js\n var require_densitymap = __commonJS({\n \"src/traces/densitymap/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes59(),\n supplyDefaults: require_defaults55(),\n colorbar: require_colorbar2(),\n formatLabels: require_format_labels6(),\n calc: require_calc34(),\n plot: require_plot28(),\n hoverPoints: require_hover21(),\n eventData: require_event_data14(),\n getBelow: function(trace, subplot) {\n var mapLayers = subplot.getMapLayers();\n for (var i = 0; i < mapLayers.length; i++) {\n var layer = mapLayers[i];\n var layerId = layer.id;\n if (layer.type === \"symbol\" && typeof layerId === \"string\" && layerId.indexOf(\"plotly-\") === -1) {\n return layerId;\n }\n }\n },\n moduleType: \"trace\",\n name: \"densitymap\",\n basePlotModule: require_map3(),\n categories: [\"map\", \"gl\", \"showLegend\"],\n meta: {\n hr_name: \"density_map\"\n }\n };\n }\n });\n\n // lib/densitymap.js\n var require_densitymap2 = __commonJS({\n \"lib/densitymap.js\"(exports, module) {\n \"use strict\";\n module.exports = require_densitymap();\n }\n });\n\n // src/traces/sankey/attributes.js\n var require_attributes60 = __commonJS({\n \"src/traces/sankey/attributes.js\"(exports, module) {\n \"use strict\";\n var fontAttrs = require_font_attributes();\n var baseAttrs = require_attributes2();\n var colorAttrs = require_attributes3();\n var fxAttrs = require_attributes();\n var domainAttrs = require_domain().attributes;\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var colorAttributes = require_attributes8();\n var templatedArray = require_plot_template().templatedArray;\n var descriptionOnlyNumbers = require_axis_format_attributes().descriptionOnlyNumbers;\n var extendFlat = require_extend().extendFlat;\n var overrideAll = require_edit_types().overrideAll;\n var attrs = module.exports = overrideAll({\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: [],\n arrayOk: false\n }),\n hoverlabel: fxAttrs.hoverlabel,\n domain: domainAttrs({ name: \"sankey\", trace: true }),\n orientation: {\n valType: \"enumerated\",\n values: [\"v\", \"h\"],\n dflt: \"h\"\n },\n valueformat: {\n valType: \"string\",\n dflt: \".3s\",\n description: descriptionOnlyNumbers(\"value\")\n },\n valuesuffix: {\n valType: \"string\",\n dflt: \"\"\n },\n arrangement: {\n valType: \"enumerated\",\n values: [\"snap\", \"perpendicular\", \"freeform\", \"fixed\"],\n dflt: \"snap\"\n },\n textfont: fontAttrs({\n autoShadowDflt: true\n }),\n // Remove top-level customdata\n customdata: void 0,\n node: {\n label: {\n valType: \"data_array\",\n dflt: []\n },\n groups: {\n valType: \"info_array\",\n impliedEdits: { x: [], y: [] },\n dimensions: 2,\n freeLength: true,\n dflt: [],\n items: { valType: \"number\", editType: \"calc\" }\n },\n x: {\n valType: \"data_array\",\n dflt: []\n },\n y: {\n valType: \"data_array\",\n dflt: []\n },\n color: {\n valType: \"color\",\n arrayOk: true\n },\n customdata: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n line: {\n color: {\n valType: \"color\",\n dflt: colorAttrs.defaultLine,\n arrayOk: true\n },\n width: {\n valType: \"number\",\n min: 0,\n dflt: 0.5,\n arrayOk: true\n }\n },\n pad: {\n valType: \"number\",\n arrayOk: false,\n min: 0,\n dflt: 20\n },\n thickness: {\n valType: \"number\",\n arrayOk: false,\n min: 1,\n dflt: 20\n },\n hoverinfo: {\n valType: \"enumerated\",\n values: [\"all\", \"none\", \"skip\"],\n dflt: \"all\"\n },\n hoverlabel: fxAttrs.hoverlabel,\n // needs editType override,\n hovertemplate: hovertemplateAttrs({}, {\n keys: [\"value\", \"label\"]\n }),\n align: {\n valType: \"enumerated\",\n values: [\"justify\", \"left\", \"right\", \"center\"],\n dflt: \"justify\"\n }\n },\n link: {\n arrowlen: {\n valType: \"number\",\n min: 0,\n dflt: 0\n },\n label: {\n valType: \"data_array\",\n dflt: []\n },\n color: {\n valType: \"color\",\n arrayOk: true\n },\n hovercolor: {\n valType: \"color\",\n arrayOk: true\n },\n customdata: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n line: {\n color: {\n valType: \"color\",\n dflt: colorAttrs.defaultLine,\n arrayOk: true\n },\n width: {\n valType: \"number\",\n min: 0,\n dflt: 0,\n arrayOk: true\n }\n },\n source: {\n valType: \"data_array\",\n dflt: []\n },\n target: {\n valType: \"data_array\",\n dflt: []\n },\n value: {\n valType: \"data_array\",\n dflt: []\n },\n hoverinfo: {\n valType: \"enumerated\",\n values: [\"all\", \"none\", \"skip\"],\n dflt: \"all\"\n },\n hoverlabel: fxAttrs.hoverlabel,\n // needs editType override,\n hovertemplate: hovertemplateAttrs({}, {\n keys: [\"value\", \"label\"]\n }),\n colorscales: templatedArray(\"concentrationscales\", {\n editType: \"calc\",\n label: {\n valType: \"string\",\n editType: \"calc\",\n dflt: \"\"\n },\n cmax: {\n valType: \"number\",\n editType: \"calc\",\n dflt: 1\n },\n cmin: {\n valType: \"number\",\n editType: \"calc\",\n dflt: 0\n },\n colorscale: extendFlat(colorAttributes().colorscale, { dflt: [[0, \"white\"], [1, \"black\"]] })\n })\n }\n }, \"calc\", \"nested\");\n }\n });\n\n // src/traces/sankey/defaults.js\n var require_defaults56 = __commonJS({\n \"src/traces/sankey/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var attributes = require_attributes60();\n var Color2 = require_color();\n var tinycolor = require_tinycolor();\n var handleDomainDefaults = require_domain().defaults;\n var handleHoverLabelDefaults = require_hoverlabel_defaults();\n var Template = require_plot_template();\n var handleArrayContainerDefaults = require_array_container_defaults();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var hoverlabelDefault = Lib.extendDeep(layout.hoverlabel, traceIn.hoverlabel);\n var nodeIn = traceIn.node;\n var nodeOut = Template.newContainer(traceOut, \"node\");\n function coerceNode(attr, dflt) {\n return Lib.coerce(nodeIn, nodeOut, attributes.node, attr, dflt);\n }\n coerceNode(\"label\");\n coerceNode(\"groups\");\n coerceNode(\"x\");\n coerceNode(\"y\");\n coerceNode(\"pad\");\n coerceNode(\"thickness\");\n coerceNode(\"line.color\");\n coerceNode(\"line.width\");\n coerceNode(\"hoverinfo\", traceIn.hoverinfo);\n handleHoverLabelDefaults(nodeIn, nodeOut, coerceNode, hoverlabelDefault);\n coerceNode(\"hovertemplate\");\n coerceNode(\"align\");\n var colors = layout.colorway;\n var defaultNodePalette = function(i) {\n return colors[i % colors.length];\n };\n coerceNode(\"color\", nodeOut.label.map(function(d, i) {\n return Color2.addOpacity(defaultNodePalette(i), 0.8);\n }));\n coerceNode(\"customdata\");\n var linkIn = traceIn.link || {};\n var linkOut = Template.newContainer(traceOut, \"link\");\n function coerceLink(attr, dflt) {\n return Lib.coerce(linkIn, linkOut, attributes.link, attr, dflt);\n }\n coerceLink(\"label\");\n coerceLink(\"arrowlen\");\n coerceLink(\"source\");\n coerceLink(\"target\");\n coerceLink(\"value\");\n coerceLink(\"line.color\");\n coerceLink(\"line.width\");\n coerceLink(\"hoverinfo\", traceIn.hoverinfo);\n handleHoverLabelDefaults(linkIn, linkOut, coerceLink, hoverlabelDefault);\n coerceLink(\"hovertemplate\");\n var darkBG = tinycolor(layout.paper_bgcolor).getLuminance() < 0.333;\n var defaultLinkColor = darkBG ? \"rgba(255, 255, 255, 0.6)\" : \"rgba(0, 0, 0, 0.2)\";\n var linkColor = coerceLink(\"color\", defaultLinkColor);\n function makeDefaultHoverColor(_linkColor) {\n var tc = tinycolor(_linkColor);\n if (!tc.isValid()) {\n return _linkColor;\n }\n var alpha = tc.getAlpha();\n if (alpha <= 0.8) {\n tc.setAlpha(alpha + 0.2);\n } else {\n tc = darkBG ? tc.brighten() : tc.darken();\n }\n return tc.toRgbString();\n }\n coerceLink(\n \"hovercolor\",\n Array.isArray(linkColor) ? linkColor.map(makeDefaultHoverColor) : makeDefaultHoverColor(linkColor)\n );\n coerceLink(\"customdata\");\n handleArrayContainerDefaults(linkIn, linkOut, {\n name: \"colorscales\",\n handleItemDefaults: concentrationscalesDefaults\n });\n handleDomainDefaults(traceOut, layout, coerce);\n coerce(\"orientation\");\n coerce(\"valueformat\");\n coerce(\"valuesuffix\");\n var dfltArrangement;\n if (nodeOut.x.length && nodeOut.y.length) {\n dfltArrangement = \"freeform\";\n }\n coerce(\"arrangement\", dfltArrangement);\n Lib.coerceFont(coerce, \"textfont\", layout.font, { autoShadowDflt: true });\n traceOut._length = null;\n };\n function concentrationscalesDefaults(In, Out) {\n function coerce(attr, dflt) {\n return Lib.coerce(In, Out, attributes.link.colorscales, attr, dflt);\n }\n coerce(\"label\");\n coerce(\"cmin\");\n coerce(\"cmax\");\n coerce(\"colorscale\");\n }\n }\n });\n\n // node_modules/strongly-connected-components/scc.js\n var require_scc = __commonJS({\n \"node_modules/strongly-connected-components/scc.js\"(exports, module) {\n \"use strict\";\n module.exports = stronglyConnectedComponents;\n function stronglyConnectedComponents(adjList) {\n var numVertices = adjList.length;\n var index = new Array(numVertices);\n var lowValue = new Array(numVertices);\n var active = new Array(numVertices);\n var child = new Array(numVertices);\n var scc = new Array(numVertices);\n var sccLinks = new Array(numVertices);\n for (var i = 0; i < numVertices; ++i) {\n index[i] = -1;\n lowValue[i] = 0;\n active[i] = false;\n child[i] = 0;\n scc[i] = -1;\n sccLinks[i] = [];\n }\n var count = 0;\n var components = [];\n var sccAdjList = [];\n function strongConnect(v) {\n var S = [v], T = [v];\n index[v] = lowValue[v] = count;\n active[v] = true;\n count += 1;\n while (T.length > 0) {\n v = T[T.length - 1];\n var e2 = adjList[v];\n if (child[v] < e2.length) {\n for (var i2 = child[v]; i2 < e2.length; ++i2) {\n var u = e2[i2];\n if (index[u] < 0) {\n index[u] = lowValue[u] = count;\n active[u] = true;\n count += 1;\n S.push(u);\n T.push(u);\n break;\n } else if (active[u]) {\n lowValue[v] = Math.min(lowValue[v], lowValue[u]) | 0;\n }\n if (scc[u] >= 0) {\n sccLinks[v].push(scc[u]);\n }\n }\n child[v] = i2;\n } else {\n if (lowValue[v] === index[v]) {\n var component = [];\n var links = [], linkCount = 0;\n for (var i2 = S.length - 1; i2 >= 0; --i2) {\n var w = S[i2];\n active[w] = false;\n component.push(w);\n links.push(sccLinks[w]);\n linkCount += sccLinks[w].length;\n scc[w] = components.length;\n if (w === v) {\n S.length = i2;\n break;\n }\n }\n components.push(component);\n var allLinks = new Array(linkCount);\n for (var i2 = 0; i2 < links.length; i2++) {\n for (var j2 = 0; j2 < links[i2].length; j2++) {\n allLinks[--linkCount] = links[i2][j2];\n }\n }\n sccAdjList.push(allLinks);\n }\n T.pop();\n }\n }\n }\n for (var i = 0; i < numVertices; ++i) {\n if (index[i] < 0) {\n strongConnect(i);\n }\n }\n var newE;\n for (var i = 0; i < sccAdjList.length; i++) {\n var e = sccAdjList[i];\n if (e.length === 0) continue;\n e.sort(function(a, b) {\n return a - b;\n });\n newE = [e[0]];\n for (var j = 1; j < e.length; j++) {\n if (e[j] !== e[j - 1]) {\n newE.push(e[j]);\n }\n }\n sccAdjList[i] = newE;\n }\n return { components, adjacencyList: sccAdjList };\n }\n }\n });\n\n // src/traces/sankey/calc.js\n var require_calc35 = __commonJS({\n \"src/traces/sankey/calc.js\"(exports, module) {\n \"use strict\";\n var tarjan = require_scc();\n var Lib = require_lib();\n var wrap = require_gup().wrap;\n var isArrayOrTypedArray = Lib.isArrayOrTypedArray;\n var isIndex = Lib.isIndex;\n var Colorscale = require_colorscale();\n function convertToD3Sankey(trace) {\n var nodeSpec = trace.node;\n var linkSpec = trace.link;\n var links = [];\n var hasLinkColorArray = isArrayOrTypedArray(linkSpec.color);\n var hasLinkHoverColorArray = isArrayOrTypedArray(linkSpec.hovercolor);\n var hasLinkCustomdataArray = isArrayOrTypedArray(linkSpec.customdata);\n var linkedNodes = {};\n var components = {};\n var componentCount = linkSpec.colorscales.length;\n var i;\n for (i = 0; i < componentCount; i++) {\n var cscale = linkSpec.colorscales[i];\n var specs = Colorscale.extractScale(cscale, { cLetter: \"c\" });\n var scale = Colorscale.makeColorScaleFunc(specs);\n components[cscale.label] = scale;\n }\n var maxNodeId = 0;\n for (i = 0; i < linkSpec.value.length; i++) {\n if (linkSpec.source[i] > maxNodeId) maxNodeId = linkSpec.source[i];\n if (linkSpec.target[i] > maxNodeId) maxNodeId = linkSpec.target[i];\n }\n var nodeCount = maxNodeId + 1;\n trace.node._count = nodeCount;\n var j;\n var groups = trace.node.groups;\n var groupLookup = {};\n for (i = 0; i < groups.length; i++) {\n var group = groups[i];\n for (j = 0; j < group.length; j++) {\n var nodeIndex = group[j];\n var groupIndex = nodeCount + i;\n if (groupLookup.hasOwnProperty(nodeIndex)) {\n Lib.warn(\"Node \" + nodeIndex + \" is already part of a group.\");\n } else {\n groupLookup[nodeIndex] = groupIndex;\n }\n }\n }\n var groupedLinks = {\n source: [],\n target: []\n };\n for (i = 0; i < linkSpec.value.length; i++) {\n var val = linkSpec.value[i];\n var source = linkSpec.source[i];\n var target = linkSpec.target[i];\n if (!(val > 0 && isIndex(source, nodeCount) && isIndex(target, nodeCount))) {\n continue;\n }\n if (groupLookup.hasOwnProperty(source) && groupLookup.hasOwnProperty(target) && groupLookup[source] === groupLookup[target]) {\n continue;\n }\n if (groupLookup.hasOwnProperty(target)) {\n target = groupLookup[target];\n }\n if (groupLookup.hasOwnProperty(source)) {\n source = groupLookup[source];\n }\n source = +source;\n target = +target;\n linkedNodes[source] = linkedNodes[target] = true;\n var label = \"\";\n if (linkSpec.label && linkSpec.label[i]) label = linkSpec.label[i];\n var concentrationscale = null;\n if (label && components.hasOwnProperty(label)) concentrationscale = components[label];\n links.push({\n pointNumber: i,\n label,\n color: hasLinkColorArray ? linkSpec.color[i] : linkSpec.color,\n hovercolor: hasLinkHoverColorArray ? linkSpec.hovercolor[i] : linkSpec.hovercolor,\n customdata: hasLinkCustomdataArray ? linkSpec.customdata[i] : linkSpec.customdata,\n concentrationscale,\n source,\n target,\n value: +val\n });\n groupedLinks.source.push(source);\n groupedLinks.target.push(target);\n }\n var totalCount = nodeCount + groups.length;\n var hasNodeColorArray = isArrayOrTypedArray(nodeSpec.color);\n var hasNodeCustomdataArray = isArrayOrTypedArray(nodeSpec.customdata);\n var nodes = [];\n for (i = 0; i < totalCount; i++) {\n if (!linkedNodes[i]) continue;\n var l = nodeSpec.label[i];\n nodes.push({\n group: i > nodeCount - 1,\n childrenNodes: [],\n pointNumber: i,\n label: l,\n color: hasNodeColorArray ? nodeSpec.color[i] : nodeSpec.color,\n customdata: hasNodeCustomdataArray ? nodeSpec.customdata[i] : nodeSpec.customdata\n });\n }\n var circular = false;\n if (circularityPresent(totalCount, groupedLinks.source, groupedLinks.target)) {\n circular = true;\n }\n return {\n circular,\n links,\n nodes,\n // Data structure for groups\n groups,\n groupLookup\n };\n }\n function circularityPresent(nodeLen, sources, targets) {\n var nodes = Lib.init2dArray(nodeLen, 0);\n for (var i = 0; i < Math.min(sources.length, targets.length); i++) {\n if (Lib.isIndex(sources[i], nodeLen) && Lib.isIndex(targets[i], nodeLen)) {\n if (sources[i] === targets[i]) {\n return true;\n }\n nodes[sources[i]].push(targets[i]);\n }\n }\n var scc = tarjan(nodes);\n return scc.components.some(function(c) {\n return c.length > 1;\n });\n }\n module.exports = function calc(gd, trace) {\n var result = convertToD3Sankey(trace);\n return wrap({\n circular: result.circular,\n _nodes: result.nodes,\n _links: result.links,\n // Data structure for grouping\n _groups: result.groups,\n _groupLookup: result.groupLookup\n });\n };\n }\n });\n\n // node_modules/d3-quadtree/dist/d3-quadtree.js\n var require_d3_quadtree = __commonJS({\n \"node_modules/d3-quadtree/dist/d3-quadtree.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports) : typeof define === \"function\" && false ? define([\"exports\"], factory) : (global2 = global2 || self, factory(global2.d3 = global2.d3 || {}));\n })(exports, function(exports2) {\n \"use strict\";\n function tree_add(d) {\n var x = +this._x.call(null, d), y = +this._y.call(null, d);\n return add(this.cover(x, y), x, y, d);\n }\n function add(tree, x, y, d) {\n if (isNaN(x) || isNaN(y)) return tree;\n var parent, node = tree._root, leaf = { data: d }, x0 = tree._x0, y0 = tree._y0, x1 = tree._x1, y1 = tree._y1, xm, ym, xp, yp, right, bottom, i, j;\n if (!node) return tree._root = leaf, tree;\n while (node.length) {\n if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;\n else x1 = xm;\n if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym;\n else y1 = ym;\n if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree;\n }\n xp = +tree._x.call(null, node.data);\n yp = +tree._y.call(null, node.data);\n if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree;\n do {\n parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4);\n if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;\n else x1 = xm;\n if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym;\n else y1 = ym;\n } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | xp >= xm));\n return parent[j] = node, parent[i] = leaf, tree;\n }\n function addAll(data) {\n var d, i, n = data.length, x, y, xz = new Array(n), yz = new Array(n), x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;\n for (i = 0; i < n; ++i) {\n if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue;\n xz[i] = x;\n yz[i] = y;\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n if (y > y1) y1 = y;\n }\n if (x0 > x1 || y0 > y1) return this;\n this.cover(x0, y0).cover(x1, y1);\n for (i = 0; i < n; ++i) {\n add(this, xz[i], yz[i], data[i]);\n }\n return this;\n }\n function tree_cover(x, y) {\n if (isNaN(x = +x) || isNaN(y = +y)) return this;\n var x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1;\n if (isNaN(x0)) {\n x1 = (x0 = Math.floor(x)) + 1;\n y1 = (y0 = Math.floor(y)) + 1;\n } else {\n var z = x1 - x0, node = this._root, parent, i;\n while (x0 > x || x >= x1 || y0 > y || y >= y1) {\n i = (y < y0) << 1 | x < x0;\n parent = new Array(4), parent[i] = node, node = parent, z *= 2;\n switch (i) {\n case 0:\n x1 = x0 + z, y1 = y0 + z;\n break;\n case 1:\n x0 = x1 - z, y1 = y0 + z;\n break;\n case 2:\n x1 = x0 + z, y0 = y1 - z;\n break;\n case 3:\n x0 = x1 - z, y0 = y1 - z;\n break;\n }\n }\n if (this._root && this._root.length) this._root = node;\n }\n this._x0 = x0;\n this._y0 = y0;\n this._x1 = x1;\n this._y1 = y1;\n return this;\n }\n function tree_data() {\n var data = [];\n this.visit(function(node) {\n if (!node.length) do\n data.push(node.data);\n while (node = node.next);\n });\n return data;\n }\n function tree_extent(_) {\n return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? void 0 : [[this._x0, this._y0], [this._x1, this._y1]];\n }\n function Quad(node, x0, y0, x1, y1) {\n this.node = node;\n this.x0 = x0;\n this.y0 = y0;\n this.x1 = x1;\n this.y1 = y1;\n }\n function tree_find(x, y, radius) {\n var data, x0 = this._x0, y0 = this._y0, x1, y1, x2, y2, x3 = this._x1, y3 = this._y1, quads = [], node = this._root, q, i;\n if (node) quads.push(new Quad(node, x0, y0, x3, y3));\n if (radius == null) radius = Infinity;\n else {\n x0 = x - radius, y0 = y - radius;\n x3 = x + radius, y3 = y + radius;\n radius *= radius;\n }\n while (q = quads.pop()) {\n if (!(node = q.node) || (x1 = q.x0) > x3 || (y1 = q.y0) > y3 || (x2 = q.x1) < x0 || (y2 = q.y1) < y0) continue;\n if (node.length) {\n var xm = (x1 + x2) / 2, ym = (y1 + y2) / 2;\n quads.push(\n new Quad(node[3], xm, ym, x2, y2),\n new Quad(node[2], x1, ym, xm, y2),\n new Quad(node[1], xm, y1, x2, ym),\n new Quad(node[0], x1, y1, xm, ym)\n );\n if (i = (y >= ym) << 1 | x >= xm) {\n q = quads[quads.length - 1];\n quads[quads.length - 1] = quads[quads.length - 1 - i];\n quads[quads.length - 1 - i] = q;\n }\n } else {\n var dx = x - +this._x.call(null, node.data), dy = y - +this._y.call(null, node.data), d2 = dx * dx + dy * dy;\n if (d2 < radius) {\n var d = Math.sqrt(radius = d2);\n x0 = x - d, y0 = y - d;\n x3 = x + d, y3 = y + d;\n data = node.data;\n }\n }\n }\n return data;\n }\n function tree_remove(d) {\n if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this;\n var parent, node = this._root, retainer, previous, next, x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1, x, y, xm, ym, right, bottom, i, j;\n if (!node) return this;\n if (node.length) while (true) {\n if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;\n else x1 = xm;\n if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym;\n else y1 = ym;\n if (!(parent = node, node = node[i = bottom << 1 | right])) return this;\n if (!node.length) break;\n if (parent[i + 1 & 3] || parent[i + 2 & 3] || parent[i + 3 & 3]) retainer = parent, j = i;\n }\n while (node.data !== d) if (!(previous = node, node = node.next)) return this;\n if (next = node.next) delete node.next;\n if (previous) return next ? previous.next = next : delete previous.next, this;\n if (!parent) return this._root = next, this;\n next ? parent[i] = next : delete parent[i];\n if ((node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) {\n if (retainer) retainer[j] = node;\n else this._root = node;\n }\n return this;\n }\n function removeAll(data) {\n for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]);\n return this;\n }\n function tree_root() {\n return this._root;\n }\n function tree_size() {\n var size = 0;\n this.visit(function(node) {\n if (!node.length) do\n ++size;\n while (node = node.next);\n });\n return size;\n }\n function tree_visit(callback) {\n var quads = [], q, node = this._root, child, x0, y0, x1, y1;\n if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1));\n while (q = quads.pop()) {\n if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) {\n var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;\n if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));\n if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));\n if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));\n if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));\n }\n }\n return this;\n }\n function tree_visitAfter(callback) {\n var quads = [], next = [], q;\n if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1));\n while (q = quads.pop()) {\n var node = q.node;\n if (node.length) {\n var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;\n if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));\n if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));\n if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));\n if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));\n }\n next.push(q);\n }\n while (q = next.pop()) {\n callback(q.node, q.x0, q.y0, q.x1, q.y1);\n }\n return this;\n }\n function defaultX(d) {\n return d[0];\n }\n function tree_x(_) {\n return arguments.length ? (this._x = _, this) : this._x;\n }\n function defaultY(d) {\n return d[1];\n }\n function tree_y(_) {\n return arguments.length ? (this._y = _, this) : this._y;\n }\n function quadtree(nodes, x, y) {\n var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN);\n return nodes == null ? tree : tree.addAll(nodes);\n }\n function Quadtree(x, y, x0, y0, x1, y1) {\n this._x = x;\n this._y = y;\n this._x0 = x0;\n this._y0 = y0;\n this._x1 = x1;\n this._y1 = y1;\n this._root = void 0;\n }\n function leaf_copy(leaf) {\n var copy = { data: leaf.data }, next = copy;\n while (leaf = leaf.next) next = next.next = { data: leaf.data };\n return copy;\n }\n var treeProto = quadtree.prototype = Quadtree.prototype;\n treeProto.copy = function() {\n var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), node = this._root, nodes, child;\n if (!node) return copy;\n if (!node.length) return copy._root = leaf_copy(node), copy;\n nodes = [{ source: node, target: copy._root = new Array(4) }];\n while (node = nodes.pop()) {\n for (var i = 0; i < 4; ++i) {\n if (child = node.source[i]) {\n if (child.length) nodes.push({ source: child, target: node.target[i] = new Array(4) });\n else node.target[i] = leaf_copy(child);\n }\n }\n }\n return copy;\n };\n treeProto.add = tree_add;\n treeProto.addAll = addAll;\n treeProto.cover = tree_cover;\n treeProto.data = tree_data;\n treeProto.extent = tree_extent;\n treeProto.find = tree_find;\n treeProto.remove = tree_remove;\n treeProto.removeAll = removeAll;\n treeProto.root = tree_root;\n treeProto.size = tree_size;\n treeProto.visit = tree_visit;\n treeProto.visitAfter = tree_visitAfter;\n treeProto.x = tree_x;\n treeProto.y = tree_y;\n exports2.quadtree = quadtree;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // node_modules/d3-collection/dist/d3-collection.js\n var require_d3_collection = __commonJS({\n \"node_modules/d3-collection/dist/d3-collection.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports) : typeof define === \"function\" && false ? define([\"exports\"], factory) : factory(global2.d3 = global2.d3 || {});\n })(exports, function(exports2) {\n \"use strict\";\n var prefix = \"$\";\n function Map2() {\n }\n Map2.prototype = map.prototype = {\n constructor: Map2,\n has: function(key) {\n return prefix + key in this;\n },\n get: function(key) {\n return this[prefix + key];\n },\n set: function(key, value) {\n this[prefix + key] = value;\n return this;\n },\n remove: function(key) {\n var property = prefix + key;\n return property in this && delete this[property];\n },\n clear: function() {\n for (var property in this) if (property[0] === prefix) delete this[property];\n },\n keys: function() {\n var keys2 = [];\n for (var property in this) if (property[0] === prefix) keys2.push(property.slice(1));\n return keys2;\n },\n values: function() {\n var values2 = [];\n for (var property in this) if (property[0] === prefix) values2.push(this[property]);\n return values2;\n },\n entries: function() {\n var entries2 = [];\n for (var property in this) if (property[0] === prefix) entries2.push({ key: property.slice(1), value: this[property] });\n return entries2;\n },\n size: function() {\n var size = 0;\n for (var property in this) if (property[0] === prefix) ++size;\n return size;\n },\n empty: function() {\n for (var property in this) if (property[0] === prefix) return false;\n return true;\n },\n each: function(f) {\n for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this);\n }\n };\n function map(object, f) {\n var map2 = new Map2();\n if (object instanceof Map2) object.each(function(value, key2) {\n map2.set(key2, value);\n });\n else if (Array.isArray(object)) {\n var i = -1, n = object.length, o;\n if (f == null) while (++i < n) map2.set(i, object[i]);\n else while (++i < n) map2.set(f(o = object[i], i, object), o);\n } else if (object) for (var key in object) map2.set(key, object[key]);\n return map2;\n }\n function nest() {\n var keys2 = [], sortKeys = [], sortValues, rollup, nest2;\n function apply(array, depth, createResult, setResult) {\n if (depth >= keys2.length) {\n if (sortValues != null) array.sort(sortValues);\n return rollup != null ? rollup(array) : array;\n }\n var i = -1, n = array.length, key = keys2[depth++], keyValue, value, valuesByKey = map(), values2, result = createResult();\n while (++i < n) {\n if (values2 = valuesByKey.get(keyValue = key(value = array[i]) + \"\")) {\n values2.push(value);\n } else {\n valuesByKey.set(keyValue, [value]);\n }\n }\n valuesByKey.each(function(values3, key2) {\n setResult(result, key2, apply(values3, depth, createResult, setResult));\n });\n return result;\n }\n function entries2(map$$1, depth) {\n if (++depth > keys2.length) return map$$1;\n var array, sortKey = sortKeys[depth - 1];\n if (rollup != null && depth >= keys2.length) array = map$$1.entries();\n else array = [], map$$1.each(function(v, k) {\n array.push({ key: k, values: entries2(v, depth) });\n });\n return sortKey != null ? array.sort(function(a, b) {\n return sortKey(a.key, b.key);\n }) : array;\n }\n return nest2 = {\n object: function(array) {\n return apply(array, 0, createObject, setObject);\n },\n map: function(array) {\n return apply(array, 0, createMap, setMap);\n },\n entries: function(array) {\n return entries2(apply(array, 0, createMap, setMap), 0);\n },\n key: function(d) {\n keys2.push(d);\n return nest2;\n },\n sortKeys: function(order) {\n sortKeys[keys2.length - 1] = order;\n return nest2;\n },\n sortValues: function(order) {\n sortValues = order;\n return nest2;\n },\n rollup: function(f) {\n rollup = f;\n return nest2;\n }\n };\n }\n function createObject() {\n return {};\n }\n function setObject(object, key, value) {\n object[key] = value;\n }\n function createMap() {\n return map();\n }\n function setMap(map$$1, key, value) {\n map$$1.set(key, value);\n }\n function Set2() {\n }\n var proto = map.prototype;\n Set2.prototype = set.prototype = {\n constructor: Set2,\n has: proto.has,\n add: function(value) {\n value += \"\";\n this[prefix + value] = value;\n return this;\n },\n remove: proto.remove,\n clear: proto.clear,\n values: proto.keys,\n size: proto.size,\n empty: proto.empty,\n each: proto.each\n };\n function set(object, f) {\n var set2 = new Set2();\n if (object instanceof Set2) object.each(function(value) {\n set2.add(value);\n });\n else if (object) {\n var i = -1, n = object.length;\n if (f == null) while (++i < n) set2.add(object[i]);\n else while (++i < n) set2.add(f(object[i], i, object));\n }\n return set2;\n }\n function keys(map2) {\n var keys2 = [];\n for (var key in map2) keys2.push(key);\n return keys2;\n }\n function values(map2) {\n var values2 = [];\n for (var key in map2) values2.push(map2[key]);\n return values2;\n }\n function entries(map2) {\n var entries2 = [];\n for (var key in map2) entries2.push({ key, value: map2[key] });\n return entries2;\n }\n exports2.nest = nest;\n exports2.set = set;\n exports2.map = map;\n exports2.keys = keys;\n exports2.values = values;\n exports2.entries = entries;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // node_modules/d3-dispatch/dist/d3-dispatch.js\n var require_d3_dispatch = __commonJS({\n \"node_modules/d3-dispatch/dist/d3-dispatch.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports) : typeof define === \"function\" && false ? define([\"exports\"], factory) : (global2 = global2 || self, factory(global2.d3 = global2.d3 || {}));\n })(exports, function(exports2) {\n \"use strict\";\n var noop = { value: function() {\n } };\n function dispatch() {\n for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {\n if (!(t = arguments[i] + \"\") || t in _ || /[\\s.]/.test(t)) throw new Error(\"illegal type: \" + t);\n _[t] = [];\n }\n return new Dispatch(_);\n }\n function Dispatch(_) {\n this._ = _;\n }\n function parseTypenames(typenames, types) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name2 = \"\", i = t.indexOf(\".\");\n if (i >= 0) name2 = t.slice(i + 1), t = t.slice(0, i);\n if (t && !types.hasOwnProperty(t)) throw new Error(\"unknown type: \" + t);\n return { type: t, name: name2 };\n });\n }\n Dispatch.prototype = dispatch.prototype = {\n constructor: Dispatch,\n on: function(typename, callback) {\n var _ = this._, T = parseTypenames(typename + \"\", _), t, i = -1, n = T.length;\n if (arguments.length < 2) {\n while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;\n return;\n }\n if (callback != null && typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n while (++i < n) {\n if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);\n else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);\n }\n return this;\n },\n copy: function() {\n var copy = {}, _ = this._;\n for (var t in _) copy[t] = _[t].slice();\n return new Dispatch(copy);\n },\n call: function(type, that) {\n if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n },\n apply: function(type, that, args) {\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n }\n };\n function get(type, name2) {\n for (var i = 0, n = type.length, c; i < n; ++i) {\n if ((c = type[i]).name === name2) {\n return c.value;\n }\n }\n }\n function set(type, name2, callback) {\n for (var i = 0, n = type.length; i < n; ++i) {\n if (type[i].name === name2) {\n type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));\n break;\n }\n }\n if (callback != null) type.push({ name: name2, value: callback });\n return type;\n }\n exports2.dispatch = dispatch;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // node_modules/d3-timer/dist/d3-timer.js\n var require_d3_timer = __commonJS({\n \"node_modules/d3-timer/dist/d3-timer.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports) : typeof define === \"function\" && false ? define([\"exports\"], factory) : (global2 = global2 || self, factory(global2.d3 = global2.d3 || {}));\n })(exports, function(exports2) {\n \"use strict\";\n var frame = 0, timeout = 0, interval = 0, pokeDelay = 1e3, taskHead, taskTail, clockLast = 0, clockNow = 0, clockSkew = 0, clock = typeof performance === \"object\" && performance.now ? performance : Date, setFrame = typeof window === \"object\" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) {\n setTimeout(f, 17);\n };\n function now() {\n return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);\n }\n function clearNow() {\n clockNow = 0;\n }\n function Timer() {\n this._call = this._time = this._next = null;\n }\n Timer.prototype = timer.prototype = {\n constructor: Timer,\n restart: function(callback, delay, time) {\n if (typeof callback !== \"function\") throw new TypeError(\"callback is not a function\");\n time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);\n if (!this._next && taskTail !== this) {\n if (taskTail) taskTail._next = this;\n else taskHead = this;\n taskTail = this;\n }\n this._call = callback;\n this._time = time;\n sleep();\n },\n stop: function() {\n if (this._call) {\n this._call = null;\n this._time = Infinity;\n sleep();\n }\n }\n };\n function timer(callback, delay, time) {\n var t = new Timer();\n t.restart(callback, delay, time);\n return t;\n }\n function timerFlush() {\n now();\n ++frame;\n var t = taskHead, e;\n while (t) {\n if ((e = clockNow - t._time) >= 0) t._call.call(null, e);\n t = t._next;\n }\n --frame;\n }\n function wake() {\n clockNow = (clockLast = clock.now()) + clockSkew;\n frame = timeout = 0;\n try {\n timerFlush();\n } finally {\n frame = 0;\n nap();\n clockNow = 0;\n }\n }\n function poke() {\n var now2 = clock.now(), delay = now2 - clockLast;\n if (delay > pokeDelay) clockSkew -= delay, clockLast = now2;\n }\n function nap() {\n var t02, t12 = taskHead, t22, time = Infinity;\n while (t12) {\n if (t12._call) {\n if (time > t12._time) time = t12._time;\n t02 = t12, t12 = t12._next;\n } else {\n t22 = t12._next, t12._next = null;\n t12 = t02 ? t02._next = t22 : taskHead = t22;\n }\n }\n taskTail = t02;\n sleep(time);\n }\n function sleep(time) {\n if (frame) return;\n if (timeout) timeout = clearTimeout(timeout);\n var delay = time - clockNow;\n if (delay > 24) {\n if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);\n if (interval) interval = clearInterval(interval);\n } else {\n if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);\n frame = 1, setFrame(wake);\n }\n }\n function timeout$1(callback, delay, time) {\n var t = new Timer();\n delay = delay == null ? 0 : +delay;\n t.restart(function(elapsed) {\n t.stop();\n callback(elapsed + delay);\n }, delay, time);\n return t;\n }\n function interval$1(callback, delay, time) {\n var t = new Timer(), total = delay;\n if (delay == null) return t.restart(callback, delay, time), t;\n delay = +delay, time = time == null ? now() : +time;\n t.restart(function tick(elapsed) {\n elapsed += total;\n t.restart(tick, total += delay, time);\n callback(elapsed);\n }, delay, time);\n return t;\n }\n exports2.interval = interval$1;\n exports2.now = now;\n exports2.timeout = timeout$1;\n exports2.timer = timer;\n exports2.timerFlush = timerFlush;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // node_modules/d3-force/dist/d3-force.js\n var require_d3_force = __commonJS({\n \"node_modules/d3-force/dist/d3-force.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports, require_d3_quadtree(), require_d3_collection(), require_d3_dispatch(), require_d3_timer()) : typeof define === \"function\" && false ? define([\"exports\", \"d3-quadtree\", \"d3-collection\", \"d3-dispatch\", \"d3-timer\"], factory) : factory(global2.d3 = global2.d3 || {}, global2.d3, global2.d3, global2.d3, global2.d3);\n })(exports, function(exports2, d3Quadtree, d3Collection, d3Dispatch, d3Timer) {\n \"use strict\";\n function center(x2, y2) {\n var nodes;\n if (x2 == null) x2 = 0;\n if (y2 == null) y2 = 0;\n function force() {\n var i, n = nodes.length, node, sx = 0, sy = 0;\n for (i = 0; i < n; ++i) {\n node = nodes[i], sx += node.x, sy += node.y;\n }\n for (sx = sx / n - x2, sy = sy / n - y2, i = 0; i < n; ++i) {\n node = nodes[i], node.x -= sx, node.y -= sy;\n }\n }\n force.initialize = function(_) {\n nodes = _;\n };\n force.x = function(_) {\n return arguments.length ? (x2 = +_, force) : x2;\n };\n force.y = function(_) {\n return arguments.length ? (y2 = +_, force) : y2;\n };\n return force;\n }\n function constant(x2) {\n return function() {\n return x2;\n };\n }\n function jiggle() {\n return (Math.random() - 0.5) * 1e-6;\n }\n function x(d) {\n return d.x + d.vx;\n }\n function y(d) {\n return d.y + d.vy;\n }\n function collide(radius) {\n var nodes, radii, strength = 1, iterations = 1;\n if (typeof radius !== \"function\") radius = constant(radius == null ? 1 : +radius);\n function force() {\n var i, n = nodes.length, tree, node, xi, yi, ri, ri2;\n for (var k = 0; k < iterations; ++k) {\n tree = d3Quadtree.quadtree(nodes, x, y).visitAfter(prepare);\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n ri = radii[node.index], ri2 = ri * ri;\n xi = node.x + node.vx;\n yi = node.y + node.vy;\n tree.visit(apply);\n }\n }\n function apply(quad, x0, y0, x1, y1) {\n var data = quad.data, rj = quad.r, r = ri + rj;\n if (data) {\n if (data.index > node.index) {\n var x2 = xi - data.x - data.vx, y2 = yi - data.y - data.vy, l = x2 * x2 + y2 * y2;\n if (l < r * r) {\n if (x2 === 0) x2 = jiggle(), l += x2 * x2;\n if (y2 === 0) y2 = jiggle(), l += y2 * y2;\n l = (r - (l = Math.sqrt(l))) / l * strength;\n node.vx += (x2 *= l) * (r = (rj *= rj) / (ri2 + rj));\n node.vy += (y2 *= l) * r;\n data.vx -= x2 * (r = 1 - r);\n data.vy -= y2 * r;\n }\n }\n return;\n }\n return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r;\n }\n }\n function prepare(quad) {\n if (quad.data) return quad.r = radii[quad.data.index];\n for (var i = quad.r = 0; i < 4; ++i) {\n if (quad[i] && quad[i].r > quad.r) {\n quad.r = quad[i].r;\n }\n }\n }\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length, node;\n radii = new Array(n);\n for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes);\n }\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n force.iterations = function(_) {\n return arguments.length ? (iterations = +_, force) : iterations;\n };\n force.strength = function(_) {\n return arguments.length ? (strength = +_, force) : strength;\n };\n force.radius = function(_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : radius;\n };\n return force;\n }\n function index(d) {\n return d.index;\n }\n function find(nodeById, nodeId) {\n var node = nodeById.get(nodeId);\n if (!node) throw new Error(\"missing: \" + nodeId);\n return node;\n }\n function link(links) {\n var id = index, strength = defaultStrength, strengths, distance = constant(30), distances, nodes, count, bias, iterations = 1;\n if (links == null) links = [];\n function defaultStrength(link2) {\n return 1 / Math.min(count[link2.source.index], count[link2.target.index]);\n }\n function force(alpha) {\n for (var k = 0, n = links.length; k < iterations; ++k) {\n for (var i = 0, link2, source, target, x2, y2, l, b; i < n; ++i) {\n link2 = links[i], source = link2.source, target = link2.target;\n x2 = target.x + target.vx - source.x - source.vx || jiggle();\n y2 = target.y + target.vy - source.y - source.vy || jiggle();\n l = Math.sqrt(x2 * x2 + y2 * y2);\n l = (l - distances[i]) / l * alpha * strengths[i];\n x2 *= l, y2 *= l;\n target.vx -= x2 * (b = bias[i]);\n target.vy -= y2 * b;\n source.vx += x2 * (b = 1 - b);\n source.vy += y2 * b;\n }\n }\n }\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length, m = links.length, nodeById = d3Collection.map(nodes, id), link2;\n for (i = 0, count = new Array(n); i < m; ++i) {\n link2 = links[i], link2.index = i;\n if (typeof link2.source !== \"object\") link2.source = find(nodeById, link2.source);\n if (typeof link2.target !== \"object\") link2.target = find(nodeById, link2.target);\n count[link2.source.index] = (count[link2.source.index] || 0) + 1;\n count[link2.target.index] = (count[link2.target.index] || 0) + 1;\n }\n for (i = 0, bias = new Array(m); i < m; ++i) {\n link2 = links[i], bias[i] = count[link2.source.index] / (count[link2.source.index] + count[link2.target.index]);\n }\n strengths = new Array(m), initializeStrength();\n distances = new Array(m), initializeDistance();\n }\n function initializeStrength() {\n if (!nodes) return;\n for (var i = 0, n = links.length; i < n; ++i) {\n strengths[i] = +strength(links[i], i, links);\n }\n }\n function initializeDistance() {\n if (!nodes) return;\n for (var i = 0, n = links.length; i < n; ++i) {\n distances[i] = +distance(links[i], i, links);\n }\n }\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n force.links = function(_) {\n return arguments.length ? (links = _, initialize(), force) : links;\n };\n force.id = function(_) {\n return arguments.length ? (id = _, force) : id;\n };\n force.iterations = function(_) {\n return arguments.length ? (iterations = +_, force) : iterations;\n };\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant(+_), initializeStrength(), force) : strength;\n };\n force.distance = function(_) {\n return arguments.length ? (distance = typeof _ === \"function\" ? _ : constant(+_), initializeDistance(), force) : distance;\n };\n return force;\n }\n function x$1(d) {\n return d.x;\n }\n function y$1(d) {\n return d.y;\n }\n var initialRadius = 10, initialAngle = Math.PI * (3 - Math.sqrt(5));\n function simulation(nodes) {\n var simulation2, alpha = 1, alphaMin = 1e-3, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = 0.6, forces = d3Collection.map(), stepper = d3Timer.timer(step), event = d3Dispatch.dispatch(\"tick\", \"end\");\n if (nodes == null) nodes = [];\n function step() {\n tick();\n event.call(\"tick\", simulation2);\n if (alpha < alphaMin) {\n stepper.stop();\n event.call(\"end\", simulation2);\n }\n }\n function tick(iterations) {\n var i, n = nodes.length, node;\n if (iterations === void 0) iterations = 1;\n for (var k = 0; k < iterations; ++k) {\n alpha += (alphaTarget - alpha) * alphaDecay;\n forces.each(function(force) {\n force(alpha);\n });\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n if (node.fx == null) node.x += node.vx *= velocityDecay;\n else node.x = node.fx, node.vx = 0;\n if (node.fy == null) node.y += node.vy *= velocityDecay;\n else node.y = node.fy, node.vy = 0;\n }\n }\n return simulation2;\n }\n function initializeNodes() {\n for (var i = 0, n = nodes.length, node; i < n; ++i) {\n node = nodes[i], node.index = i;\n if (node.fx != null) node.x = node.fx;\n if (node.fy != null) node.y = node.fy;\n if (isNaN(node.x) || isNaN(node.y)) {\n var radius = initialRadius * Math.sqrt(i), angle = i * initialAngle;\n node.x = radius * Math.cos(angle);\n node.y = radius * Math.sin(angle);\n }\n if (isNaN(node.vx) || isNaN(node.vy)) {\n node.vx = node.vy = 0;\n }\n }\n }\n function initializeForce(force) {\n if (force.initialize) force.initialize(nodes);\n return force;\n }\n initializeNodes();\n return simulation2 = {\n tick,\n restart: function() {\n return stepper.restart(step), simulation2;\n },\n stop: function() {\n return stepper.stop(), simulation2;\n },\n nodes: function(_) {\n return arguments.length ? (nodes = _, initializeNodes(), forces.each(initializeForce), simulation2) : nodes;\n },\n alpha: function(_) {\n return arguments.length ? (alpha = +_, simulation2) : alpha;\n },\n alphaMin: function(_) {\n return arguments.length ? (alphaMin = +_, simulation2) : alphaMin;\n },\n alphaDecay: function(_) {\n return arguments.length ? (alphaDecay = +_, simulation2) : +alphaDecay;\n },\n alphaTarget: function(_) {\n return arguments.length ? (alphaTarget = +_, simulation2) : alphaTarget;\n },\n velocityDecay: function(_) {\n return arguments.length ? (velocityDecay = 1 - _, simulation2) : 1 - velocityDecay;\n },\n force: function(name2, _) {\n return arguments.length > 1 ? (_ == null ? forces.remove(name2) : forces.set(name2, initializeForce(_)), simulation2) : forces.get(name2);\n },\n find: function(x2, y2, radius) {\n var i = 0, n = nodes.length, dx, dy, d2, node, closest;\n if (radius == null) radius = Infinity;\n else radius *= radius;\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n dx = x2 - node.x;\n dy = y2 - node.y;\n d2 = dx * dx + dy * dy;\n if (d2 < radius) closest = node, radius = d2;\n }\n return closest;\n },\n on: function(name2, _) {\n return arguments.length > 1 ? (event.on(name2, _), simulation2) : event.on(name2);\n }\n };\n }\n function manyBody() {\n var nodes, node, alpha, strength = constant(-30), strengths, distanceMin2 = 1, distanceMax2 = Infinity, theta2 = 0.81;\n function force(_) {\n var i, n = nodes.length, tree = d3Quadtree.quadtree(nodes, x$1, y$1).visitAfter(accumulate);\n for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply);\n }\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length, node2;\n strengths = new Array(n);\n for (i = 0; i < n; ++i) node2 = nodes[i], strengths[node2.index] = +strength(node2, i, nodes);\n }\n function accumulate(quad) {\n var strength2 = 0, q, c, weight = 0, x2, y2, i;\n if (quad.length) {\n for (x2 = y2 = i = 0; i < 4; ++i) {\n if ((q = quad[i]) && (c = Math.abs(q.value))) {\n strength2 += q.value, weight += c, x2 += c * q.x, y2 += c * q.y;\n }\n }\n quad.x = x2 / weight;\n quad.y = y2 / weight;\n } else {\n q = quad;\n q.x = q.data.x;\n q.y = q.data.y;\n do\n strength2 += strengths[q.data.index];\n while (q = q.next);\n }\n quad.value = strength2;\n }\n function apply(quad, x1, _, x2) {\n if (!quad.value) return true;\n var x3 = quad.x - node.x, y2 = quad.y - node.y, w = x2 - x1, l = x3 * x3 + y2 * y2;\n if (w * w / theta2 < l) {\n if (l < distanceMax2) {\n if (x3 === 0) x3 = jiggle(), l += x3 * x3;\n if (y2 === 0) y2 = jiggle(), l += y2 * y2;\n if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);\n node.vx += x3 * quad.value * alpha / l;\n node.vy += y2 * quad.value * alpha / l;\n }\n return true;\n } else if (quad.length || l >= distanceMax2) return;\n if (quad.data !== node || quad.next) {\n if (x3 === 0) x3 = jiggle(), l += x3 * x3;\n if (y2 === 0) y2 = jiggle(), l += y2 * y2;\n if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);\n }\n do\n if (quad.data !== node) {\n w = strengths[quad.data.index] * alpha / l;\n node.vx += x3 * w;\n node.vy += y2 * w;\n }\n while (quad = quad.next);\n }\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : strength;\n };\n force.distanceMin = function(_) {\n return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2);\n };\n force.distanceMax = function(_) {\n return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2);\n };\n force.theta = function(_) {\n return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2);\n };\n return force;\n }\n function radial(radius, x2, y2) {\n var nodes, strength = constant(0.1), strengths, radiuses;\n if (typeof radius !== \"function\") radius = constant(+radius);\n if (x2 == null) x2 = 0;\n if (y2 == null) y2 = 0;\n function force(alpha) {\n for (var i = 0, n = nodes.length; i < n; ++i) {\n var node = nodes[i], dx = node.x - x2 || 1e-6, dy = node.y - y2 || 1e-6, r = Math.sqrt(dx * dx + dy * dy), k = (radiuses[i] - r) * strengths[i] * alpha / r;\n node.vx += dx * k;\n node.vy += dy * k;\n }\n }\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length;\n strengths = new Array(n);\n radiuses = new Array(n);\n for (i = 0; i < n; ++i) {\n radiuses[i] = +radius(nodes[i], i, nodes);\n strengths[i] = isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, nodes);\n }\n }\n force.initialize = function(_) {\n nodes = _, initialize();\n };\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : strength;\n };\n force.radius = function(_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : radius;\n };\n force.x = function(_) {\n return arguments.length ? (x2 = +_, force) : x2;\n };\n force.y = function(_) {\n return arguments.length ? (y2 = +_, force) : y2;\n };\n return force;\n }\n function x$2(x2) {\n var strength = constant(0.1), nodes, strengths, xz;\n if (typeof x2 !== \"function\") x2 = constant(x2 == null ? 0 : +x2);\n function force(alpha) {\n for (var i = 0, n = nodes.length, node; i < n; ++i) {\n node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha;\n }\n }\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length;\n strengths = new Array(n);\n xz = new Array(n);\n for (i = 0; i < n; ++i) {\n strengths[i] = isNaN(xz[i] = +x2(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);\n }\n }\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : strength;\n };\n force.x = function(_) {\n return arguments.length ? (x2 = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : x2;\n };\n return force;\n }\n function y$2(y2) {\n var strength = constant(0.1), nodes, strengths, yz;\n if (typeof y2 !== \"function\") y2 = constant(y2 == null ? 0 : +y2);\n function force(alpha) {\n for (var i = 0, n = nodes.length, node; i < n; ++i) {\n node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha;\n }\n }\n function initialize() {\n if (!nodes) return;\n var i, n = nodes.length;\n strengths = new Array(n);\n yz = new Array(n);\n for (i = 0; i < n; ++i) {\n strengths[i] = isNaN(yz[i] = +y2(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);\n }\n }\n force.initialize = function(_) {\n nodes = _;\n initialize();\n };\n force.strength = function(_) {\n return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : strength;\n };\n force.y = function(_) {\n return arguments.length ? (y2 = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : y2;\n };\n return force;\n }\n exports2.forceCenter = center;\n exports2.forceCollide = collide;\n exports2.forceLink = link;\n exports2.forceManyBody = manyBody;\n exports2.forceRadial = radial;\n exports2.forceSimulation = simulation;\n exports2.forceX = x$2;\n exports2.forceY = y$2;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // node_modules/d3-path/dist/d3-path.js\n var require_d3_path = __commonJS({\n \"node_modules/d3-path/dist/d3-path.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports) : typeof define === \"function\" && false ? define([\"exports\"], factory) : (global2 = global2 || self, factory(global2.d3 = global2.d3 || {}));\n })(exports, function(exports2) {\n \"use strict\";\n var pi = Math.PI, tau = 2 * pi, epsilon = 1e-6, tauEpsilon = tau - epsilon;\n function Path() {\n this._x0 = this._y0 = // start of current subpath\n this._x1 = this._y1 = null;\n this._ = \"\";\n }\n function path() {\n return new Path();\n }\n Path.prototype = path.prototype = {\n constructor: Path,\n moveTo: function(x, y) {\n this._ += \"M\" + (this._x0 = this._x1 = +x) + \",\" + (this._y0 = this._y1 = +y);\n },\n closePath: function() {\n if (this._x1 !== null) {\n this._x1 = this._x0, this._y1 = this._y0;\n this._ += \"Z\";\n }\n },\n lineTo: function(x, y) {\n this._ += \"L\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n quadraticCurveTo: function(x1, y1, x, y) {\n this._ += \"Q\" + +x1 + \",\" + +y1 + \",\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) {\n this._ += \"C\" + +x1 + \",\" + +y1 + \",\" + +x2 + \",\" + +y2 + \",\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n arcTo: function(x1, y1, x2, y2, r) {\n x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;\n var x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01;\n if (r < 0) throw new Error(\"negative radius: \" + r);\n if (this._x1 === null) {\n this._ += \"M\" + (this._x1 = x1) + \",\" + (this._y1 = y1);\n } else if (!(l01_2 > epsilon)) ;\n else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {\n this._ += \"L\" + (this._x1 = x1) + \",\" + (this._y1 = y1);\n } else {\n var x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21;\n if (Math.abs(t01 - 1) > epsilon) {\n this._ += \"L\" + (x1 + t01 * x01) + \",\" + (y1 + t01 * y01);\n }\n this._ += \"A\" + r + \",\" + r + \",0,0,\" + +(y01 * x20 > x01 * y20) + \",\" + (this._x1 = x1 + t21 * x21) + \",\" + (this._y1 = y1 + t21 * y21);\n }\n },\n arc: function(x, y, r, a0, a1, ccw) {\n x = +x, y = +y, r = +r, ccw = !!ccw;\n var dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0;\n if (r < 0) throw new Error(\"negative radius: \" + r);\n if (this._x1 === null) {\n this._ += \"M\" + x0 + \",\" + y0;\n } else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {\n this._ += \"L\" + x0 + \",\" + y0;\n }\n if (!r) return;\n if (da < 0) da = da % tau + tau;\n if (da > tauEpsilon) {\n this._ += \"A\" + r + \",\" + r + \",0,1,\" + cw + \",\" + (x - dx) + \",\" + (y - dy) + \"A\" + r + \",\" + r + \",0,1,\" + cw + \",\" + (this._x1 = x0) + \",\" + (this._y1 = y0);\n } else if (da > epsilon) {\n this._ += \"A\" + r + \",\" + r + \",0,\" + +(da >= pi) + \",\" + cw + \",\" + (this._x1 = x + r * Math.cos(a1)) + \",\" + (this._y1 = y + r * Math.sin(a1));\n }\n },\n rect: function(x, y, w, h) {\n this._ += \"M\" + (this._x0 = this._x1 = +x) + \",\" + (this._y0 = this._y1 = +y) + \"h\" + +w + \"v\" + +h + \"h\" + -w + \"Z\";\n },\n toString: function() {\n return this._;\n }\n };\n exports2.path = path;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // node_modules/d3-shape/dist/d3-shape.js\n var require_d3_shape = __commonJS({\n \"node_modules/d3-shape/dist/d3-shape.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports, require_d3_path()) : typeof define === \"function\" && false ? define([\"exports\", \"d3-path\"], factory) : (global2 = global2 || self, factory(global2.d3 = global2.d3 || {}, global2.d3));\n })(exports, function(exports2, d3Path) {\n \"use strict\";\n function constant(x2) {\n return function constant2() {\n return x2;\n };\n }\n var abs = Math.abs;\n var atan2 = Math.atan2;\n var cos = Math.cos;\n var max = Math.max;\n var min = Math.min;\n var sin = Math.sin;\n var sqrt = Math.sqrt;\n var epsilon = 1e-12;\n var pi = Math.PI;\n var halfPi = pi / 2;\n var tau = 2 * pi;\n function acos(x2) {\n return x2 > 1 ? 0 : x2 < -1 ? pi : Math.acos(x2);\n }\n function asin(x2) {\n return x2 >= 1 ? halfPi : x2 <= -1 ? -halfPi : Math.asin(x2);\n }\n function arcInnerRadius(d) {\n return d.innerRadius;\n }\n function arcOuterRadius(d) {\n return d.outerRadius;\n }\n function arcStartAngle(d) {\n return d.startAngle;\n }\n function arcEndAngle(d) {\n return d.endAngle;\n }\n function arcPadAngle(d) {\n return d && d.padAngle;\n }\n function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {\n var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10;\n if (t * t < epsilon) return;\n t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;\n return [x0 + t * x10, y0 + t * y10];\n }\n function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {\n var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D2 = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D2 * D2)), cx0 = (D2 * dy - dx * d) / d2, cy0 = (-D2 * dx - dy * d) / d2, cx1 = (D2 * dy + dx * d) / d2, cy1 = (-D2 * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00;\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;\n return {\n cx: cx0,\n cy: cy0,\n x01: -ox,\n y01: -oy,\n x11: cx0 * (r1 / r - 1),\n y11: cy0 * (r1 / r - 1)\n };\n }\n function arc() {\n var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null;\n function arc2() {\n var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs(a1 - a0), cw = a1 > a0;\n if (!context) context = buffer = d3Path.path();\n if (r1 < r0) r = r1, r1 = r0, r0 = r;\n if (!(r1 > epsilon)) context.moveTo(0, 0);\n else if (da > tau - epsilon) {\n context.moveTo(r1 * cos(a0), r1 * sin(a0));\n context.arc(0, 0, r1, a0, a1, !cw);\n if (r0 > epsilon) {\n context.moveTo(r0 * cos(a1), r0 * sin(a1));\n context.arc(0, 0, r0, a1, a0, cw);\n }\n } else {\n var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t02, t12;\n if (rp > epsilon) {\n var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap));\n if ((da0 -= p0 * 2) > epsilon) p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;\n else da0 = 0, a00 = a10 = (a0 + a1) / 2;\n if ((da1 -= p1 * 2) > epsilon) p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;\n else da1 = 0, a01 = a11 = (a0 + a1) / 2;\n }\n var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10);\n if (rc > epsilon) {\n var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc;\n if (da < pi && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) {\n var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);\n rc0 = min(rc, (r0 - lc) / (kc - 1));\n rc1 = min(rc, (r1 - lc) / (kc + 1));\n }\n }\n if (!(da1 > epsilon)) context.moveTo(x01, y01);\n else if (rc1 > epsilon) {\n t02 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);\n t12 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);\n context.moveTo(t02.cx + t02.x01, t02.cy + t02.y01);\n if (rc1 < rc) context.arc(t02.cx, t02.cy, rc1, atan2(t02.y01, t02.x01), atan2(t12.y01, t12.x01), !cw);\n else {\n context.arc(t02.cx, t02.cy, rc1, atan2(t02.y01, t02.x01), atan2(t02.y11, t02.x11), !cw);\n context.arc(0, 0, r1, atan2(t02.cy + t02.y11, t02.cx + t02.x11), atan2(t12.cy + t12.y11, t12.cx + t12.x11), !cw);\n context.arc(t12.cx, t12.cy, rc1, atan2(t12.y11, t12.x11), atan2(t12.y01, t12.x01), !cw);\n }\n } else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);\n if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10);\n else if (rc0 > epsilon) {\n t02 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);\n t12 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);\n context.lineTo(t02.cx + t02.x01, t02.cy + t02.y01);\n if (rc0 < rc) context.arc(t02.cx, t02.cy, rc0, atan2(t02.y01, t02.x01), atan2(t12.y01, t12.x01), !cw);\n else {\n context.arc(t02.cx, t02.cy, rc0, atan2(t02.y01, t02.x01), atan2(t02.y11, t02.x11), !cw);\n context.arc(0, 0, r0, atan2(t02.cy + t02.y11, t02.cx + t02.x11), atan2(t12.cy + t12.y11, t12.cx + t12.x11), cw);\n context.arc(t12.cx, t12.cy, rc0, atan2(t12.y11, t12.x11), atan2(t12.y01, t12.x01), !cw);\n }\n } else context.arc(0, 0, r0, a10, a00, cw);\n }\n context.closePath();\n if (buffer) return context = null, buffer + \"\" || null;\n }\n arc2.centroid = function() {\n var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a2 = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;\n return [cos(a2) * r, sin(a2) * r];\n };\n arc2.innerRadius = function(_) {\n return arguments.length ? (innerRadius = typeof _ === \"function\" ? _ : constant(+_), arc2) : innerRadius;\n };\n arc2.outerRadius = function(_) {\n return arguments.length ? (outerRadius = typeof _ === \"function\" ? _ : constant(+_), arc2) : outerRadius;\n };\n arc2.cornerRadius = function(_) {\n return arguments.length ? (cornerRadius = typeof _ === \"function\" ? _ : constant(+_), arc2) : cornerRadius;\n };\n arc2.padRadius = function(_) {\n return arguments.length ? (padRadius = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), arc2) : padRadius;\n };\n arc2.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), arc2) : startAngle;\n };\n arc2.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), arc2) : endAngle;\n };\n arc2.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), arc2) : padAngle;\n };\n arc2.context = function(_) {\n return arguments.length ? (context = _ == null ? null : _, arc2) : context;\n };\n return arc2;\n }\n function Linear(context) {\n this._context = context;\n }\n Linear.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x2, y2) {\n x2 = +x2, y2 = +y2;\n switch (this._point) {\n case 0:\n this._point = 1;\n this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2);\n break;\n case 1:\n this._point = 2;\n // proceed\n default:\n this._context.lineTo(x2, y2);\n break;\n }\n }\n };\n function curveLinear(context) {\n return new Linear(context);\n }\n function x(p) {\n return p[0];\n }\n function y(p) {\n return p[1];\n }\n function line() {\n var x$1 = x, y$1 = y, defined = constant(true), context = null, curve = curveLinear, output = null;\n function line2(data) {\n var i, n = data.length, d, defined0 = false, buffer;\n if (context == null) output = curve(buffer = d3Path.path());\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) output.lineStart();\n else output.lineEnd();\n }\n if (defined0) output.point(+x$1(d, i, data), +y$1(d, i, data));\n }\n if (buffer) return output = null, buffer + \"\" || null;\n }\n line2.x = function(_) {\n return arguments.length ? (x$1 = typeof _ === \"function\" ? _ : constant(+_), line2) : x$1;\n };\n line2.y = function(_) {\n return arguments.length ? (y$1 = typeof _ === \"function\" ? _ : constant(+_), line2) : y$1;\n };\n line2.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), line2) : defined;\n };\n line2.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), line2) : curve;\n };\n line2.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line2) : context;\n };\n return line2;\n }\n function area() {\n var x0 = x, x1 = null, y0 = constant(0), y1 = y, defined = constant(true), context = null, curve = curveLinear, output = null;\n function area2(data) {\n var i, j, k2, n = data.length, d, defined0 = false, buffer, x0z = new Array(n), y0z = new Array(n);\n if (context == null) output = curve(buffer = d3Path.path());\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) {\n j = i;\n output.areaStart();\n output.lineStart();\n } else {\n output.lineEnd();\n output.lineStart();\n for (k2 = i - 1; k2 >= j; --k2) {\n output.point(x0z[k2], y0z[k2]);\n }\n output.lineEnd();\n output.areaEnd();\n }\n }\n if (defined0) {\n x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);\n output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);\n }\n }\n if (buffer) return output = null, buffer + \"\" || null;\n }\n function arealine() {\n return line().defined(defined).curve(curve).context(context);\n }\n area2.x = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), x1 = null, area2) : x0;\n };\n area2.x0 = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), area2) : x0;\n };\n area2.x1 = function(_) {\n return arguments.length ? (x1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area2) : x1;\n };\n area2.y = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), y1 = null, area2) : y0;\n };\n area2.y0 = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), area2) : y0;\n };\n area2.y1 = function(_) {\n return arguments.length ? (y1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area2) : y1;\n };\n area2.lineX0 = area2.lineY0 = function() {\n return arealine().x(x0).y(y0);\n };\n area2.lineY1 = function() {\n return arealine().x(x0).y(y1);\n };\n area2.lineX1 = function() {\n return arealine().x(x1).y(y0);\n };\n area2.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), area2) : defined;\n };\n area2.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), area2) : curve;\n };\n area2.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area2) : context;\n };\n return area2;\n }\n function descending(a2, b) {\n return b < a2 ? -1 : b > a2 ? 1 : b >= a2 ? 0 : NaN;\n }\n function identity2(d) {\n return d;\n }\n function pie() {\n var value = identity2, sortValues = descending, sort = null, startAngle = constant(0), endAngle = constant(tau), padAngle = constant(0);\n function pie2(data) {\n var i, n = data.length, j, k2, sum2 = 0, index = new Array(n), arcs = new Array(n), a0 = +startAngle.apply(this, arguments), da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), a1, p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), pa = p * (da < 0 ? -1 : 1), v;\n for (i = 0; i < n; ++i) {\n if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {\n sum2 += v;\n }\n }\n if (sortValues != null) index.sort(function(i2, j2) {\n return sortValues(arcs[i2], arcs[j2]);\n });\n else if (sort != null) index.sort(function(i2, j2) {\n return sort(data[i2], data[j2]);\n });\n for (i = 0, k2 = sum2 ? (da - n * pa) / sum2 : 0; i < n; ++i, a0 = a1) {\n j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k2 : 0) + pa, arcs[j] = {\n data: data[j],\n index: i,\n value: v,\n startAngle: a0,\n endAngle: a1,\n padAngle: p\n };\n }\n return arcs;\n }\n pie2.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), pie2) : value;\n };\n pie2.sortValues = function(_) {\n return arguments.length ? (sortValues = _, sort = null, pie2) : sortValues;\n };\n pie2.sort = function(_) {\n return arguments.length ? (sort = _, sortValues = null, pie2) : sort;\n };\n pie2.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), pie2) : startAngle;\n };\n pie2.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), pie2) : endAngle;\n };\n pie2.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), pie2) : padAngle;\n };\n return pie2;\n }\n var curveRadialLinear = curveRadial(curveLinear);\n function Radial(curve) {\n this._curve = curve;\n }\n Radial.prototype = {\n areaStart: function() {\n this._curve.areaStart();\n },\n areaEnd: function() {\n this._curve.areaEnd();\n },\n lineStart: function() {\n this._curve.lineStart();\n },\n lineEnd: function() {\n this._curve.lineEnd();\n },\n point: function(a2, r) {\n this._curve.point(r * Math.sin(a2), r * -Math.cos(a2));\n }\n };\n function curveRadial(curve) {\n function radial(context) {\n return new Radial(curve(context));\n }\n radial._curve = curve;\n return radial;\n }\n function lineRadial(l) {\n var c2 = l.curve;\n l.angle = l.x, delete l.x;\n l.radius = l.y, delete l.y;\n l.curve = function(_) {\n return arguments.length ? c2(curveRadial(_)) : c2()._curve;\n };\n return l;\n }\n function lineRadial$1() {\n return lineRadial(line().curve(curveRadialLinear));\n }\n function areaRadial() {\n var a2 = area().curve(curveRadialLinear), c2 = a2.curve, x0 = a2.lineX0, x1 = a2.lineX1, y0 = a2.lineY0, y1 = a2.lineY1;\n a2.angle = a2.x, delete a2.x;\n a2.startAngle = a2.x0, delete a2.x0;\n a2.endAngle = a2.x1, delete a2.x1;\n a2.radius = a2.y, delete a2.y;\n a2.innerRadius = a2.y0, delete a2.y0;\n a2.outerRadius = a2.y1, delete a2.y1;\n a2.lineStartAngle = function() {\n return lineRadial(x0());\n }, delete a2.lineX0;\n a2.lineEndAngle = function() {\n return lineRadial(x1());\n }, delete a2.lineX1;\n a2.lineInnerRadius = function() {\n return lineRadial(y0());\n }, delete a2.lineY0;\n a2.lineOuterRadius = function() {\n return lineRadial(y1());\n }, delete a2.lineY1;\n a2.curve = function(_) {\n return arguments.length ? c2(curveRadial(_)) : c2()._curve;\n };\n return a2;\n }\n function pointRadial(x2, y2) {\n return [(y2 = +y2) * Math.cos(x2 -= Math.PI / 2), y2 * Math.sin(x2)];\n }\n var slice = Array.prototype.slice;\n function linkSource(d) {\n return d.source;\n }\n function linkTarget(d) {\n return d.target;\n }\n function link(curve) {\n var source = linkSource, target = linkTarget, x$1 = x, y$1 = y, context = null;\n function link2() {\n var buffer, argv = slice.call(arguments), s2 = source.apply(this, argv), t = target.apply(this, argv);\n if (!context) context = buffer = d3Path.path();\n curve(context, +x$1.apply(this, (argv[0] = s2, argv)), +y$1.apply(this, argv), +x$1.apply(this, (argv[0] = t, argv)), +y$1.apply(this, argv));\n if (buffer) return context = null, buffer + \"\" || null;\n }\n link2.source = function(_) {\n return arguments.length ? (source = _, link2) : source;\n };\n link2.target = function(_) {\n return arguments.length ? (target = _, link2) : target;\n };\n link2.x = function(_) {\n return arguments.length ? (x$1 = typeof _ === \"function\" ? _ : constant(+_), link2) : x$1;\n };\n link2.y = function(_) {\n return arguments.length ? (y$1 = typeof _ === \"function\" ? _ : constant(+_), link2) : y$1;\n };\n link2.context = function(_) {\n return arguments.length ? (context = _ == null ? null : _, link2) : context;\n };\n return link2;\n }\n function curveHorizontal(context, x0, y0, x1, y1) {\n context.moveTo(x0, y0);\n context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);\n }\n function curveVertical(context, x0, y0, x1, y1) {\n context.moveTo(x0, y0);\n context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1);\n }\n function curveRadial$1(context, x0, y0, x1, y1) {\n var p0 = pointRadial(x0, y0), p1 = pointRadial(x0, y0 = (y0 + y1) / 2), p2 = pointRadial(x1, y0), p3 = pointRadial(x1, y1);\n context.moveTo(p0[0], p0[1]);\n context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);\n }\n function linkHorizontal() {\n return link(curveHorizontal);\n }\n function linkVertical() {\n return link(curveVertical);\n }\n function linkRadial() {\n var l = link(curveRadial$1);\n l.angle = l.x, delete l.x;\n l.radius = l.y, delete l.y;\n return l;\n }\n var circle = {\n draw: function(context, size) {\n var r = Math.sqrt(size / pi);\n context.moveTo(r, 0);\n context.arc(0, 0, r, 0, tau);\n }\n };\n var cross = {\n draw: function(context, size) {\n var r = Math.sqrt(size / 5) / 2;\n context.moveTo(-3 * r, -r);\n context.lineTo(-r, -r);\n context.lineTo(-r, -3 * r);\n context.lineTo(r, -3 * r);\n context.lineTo(r, -r);\n context.lineTo(3 * r, -r);\n context.lineTo(3 * r, r);\n context.lineTo(r, r);\n context.lineTo(r, 3 * r);\n context.lineTo(-r, 3 * r);\n context.lineTo(-r, r);\n context.lineTo(-3 * r, r);\n context.closePath();\n }\n };\n var tan30 = Math.sqrt(1 / 3), tan30_2 = tan30 * 2;\n var diamond = {\n draw: function(context, size) {\n var y2 = Math.sqrt(size / tan30_2), x2 = y2 * tan30;\n context.moveTo(0, -y2);\n context.lineTo(x2, 0);\n context.lineTo(0, y2);\n context.lineTo(-x2, 0);\n context.closePath();\n }\n };\n var ka = 0.8908130915292852, kr = Math.sin(pi / 10) / Math.sin(7 * pi / 10), kx = Math.sin(tau / 10) * kr, ky = -Math.cos(tau / 10) * kr;\n var star = {\n draw: function(context, size) {\n var r = Math.sqrt(size * ka), x2 = kx * r, y2 = ky * r;\n context.moveTo(0, -r);\n context.lineTo(x2, y2);\n for (var i = 1; i < 5; ++i) {\n var a2 = tau * i / 5, c2 = Math.cos(a2), s2 = Math.sin(a2);\n context.lineTo(s2 * r, -c2 * r);\n context.lineTo(c2 * x2 - s2 * y2, s2 * x2 + c2 * y2);\n }\n context.closePath();\n }\n };\n var square = {\n draw: function(context, size) {\n var w = Math.sqrt(size), x2 = -w / 2;\n context.rect(x2, x2, w, w);\n }\n };\n var sqrt3 = Math.sqrt(3);\n var triangle = {\n draw: function(context, size) {\n var y2 = -Math.sqrt(size / (sqrt3 * 3));\n context.moveTo(0, y2 * 2);\n context.lineTo(-sqrt3 * y2, -y2);\n context.lineTo(sqrt3 * y2, -y2);\n context.closePath();\n }\n };\n var c = -0.5, s = Math.sqrt(3) / 2, k = 1 / Math.sqrt(12), a = (k / 2 + 1) * 3;\n var wye = {\n draw: function(context, size) {\n var r = Math.sqrt(size / a), x0 = r / 2, y0 = r * k, x1 = x0, y1 = r * k + r, x2 = -x1, y2 = y1;\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n context.lineTo(c * x0 - s * y0, s * x0 + c * y0);\n context.lineTo(c * x1 - s * y1, s * x1 + c * y1);\n context.lineTo(c * x2 - s * y2, s * x2 + c * y2);\n context.lineTo(c * x0 + s * y0, c * y0 - s * x0);\n context.lineTo(c * x1 + s * y1, c * y1 - s * x1);\n context.lineTo(c * x2 + s * y2, c * y2 - s * x2);\n context.closePath();\n }\n };\n var symbols = [\n circle,\n cross,\n diamond,\n square,\n star,\n triangle,\n wye\n ];\n function symbol() {\n var type = constant(circle), size = constant(64), context = null;\n function symbol2() {\n var buffer;\n if (!context) context = buffer = d3Path.path();\n type.apply(this, arguments).draw(context, +size.apply(this, arguments));\n if (buffer) return context = null, buffer + \"\" || null;\n }\n symbol2.type = function(_) {\n return arguments.length ? (type = typeof _ === \"function\" ? _ : constant(_), symbol2) : type;\n };\n symbol2.size = function(_) {\n return arguments.length ? (size = typeof _ === \"function\" ? _ : constant(+_), symbol2) : size;\n };\n symbol2.context = function(_) {\n return arguments.length ? (context = _ == null ? null : _, symbol2) : context;\n };\n return symbol2;\n }\n function noop() {\n }\n function point(that, x2, y2) {\n that._context.bezierCurveTo(\n (2 * that._x0 + that._x1) / 3,\n (2 * that._y0 + that._y1) / 3,\n (that._x0 + 2 * that._x1) / 3,\n (that._y0 + 2 * that._y1) / 3,\n (that._x0 + 4 * that._x1 + x2) / 6,\n (that._y0 + 4 * that._y1 + y2) / 6\n );\n }\n function Basis(context) {\n this._context = context;\n }\n Basis.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 3:\n point(this, this._x1, this._y1);\n // proceed\n case 2:\n this._context.lineTo(this._x1, this._y1);\n break;\n }\n if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x2, y2) {\n x2 = +x2, y2 = +y2;\n switch (this._point) {\n case 0:\n this._point = 1;\n this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2);\n break;\n case 1:\n this._point = 2;\n break;\n case 2:\n this._point = 3;\n this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6);\n // proceed\n default:\n point(this, x2, y2);\n break;\n }\n this._x0 = this._x1, this._x1 = x2;\n this._y0 = this._y1, this._y1 = y2;\n }\n };\n function basis2(context) {\n return new Basis(context);\n }\n function BasisClosed(context) {\n this._context = context;\n }\n BasisClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x2, this._y2);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);\n this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x2, this._y2);\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n break;\n }\n }\n },\n point: function(x2, y2) {\n x2 = +x2, y2 = +y2;\n switch (this._point) {\n case 0:\n this._point = 1;\n this._x2 = x2, this._y2 = y2;\n break;\n case 1:\n this._point = 2;\n this._x3 = x2, this._y3 = y2;\n break;\n case 2:\n this._point = 3;\n this._x4 = x2, this._y4 = y2;\n this._context.moveTo((this._x0 + 4 * this._x1 + x2) / 6, (this._y0 + 4 * this._y1 + y2) / 6);\n break;\n default:\n point(this, x2, y2);\n break;\n }\n this._x0 = this._x1, this._x1 = x2;\n this._y0 = this._y1, this._y1 = y2;\n }\n };\n function basisClosed(context) {\n return new BasisClosed(context);\n }\n function BasisOpen(context) {\n this._context = context;\n }\n BasisOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || this._line !== 0 && this._point === 3) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x2, y2) {\n x2 = +x2, y2 = +y2;\n switch (this._point) {\n case 0:\n this._point = 1;\n break;\n case 1:\n this._point = 2;\n break;\n case 2:\n this._point = 3;\n var x0 = (this._x0 + 4 * this._x1 + x2) / 6, y0 = (this._y0 + 4 * this._y1 + y2) / 6;\n this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0);\n break;\n case 3:\n this._point = 4;\n // proceed\n default:\n point(this, x2, y2);\n break;\n }\n this._x0 = this._x1, this._x1 = x2;\n this._y0 = this._y1, this._y1 = y2;\n }\n };\n function basisOpen(context) {\n return new BasisOpen(context);\n }\n function Bundle(context, beta) {\n this._basis = new Basis(context);\n this._beta = beta;\n }\n Bundle.prototype = {\n lineStart: function() {\n this._x = [];\n this._y = [];\n this._basis.lineStart();\n },\n lineEnd: function() {\n var x2 = this._x, y2 = this._y, j = x2.length - 1;\n if (j > 0) {\n var x0 = x2[0], y0 = y2[0], dx = x2[j] - x0, dy = y2[j] - y0, i = -1, t;\n while (++i <= j) {\n t = i / j;\n this._basis.point(\n this._beta * x2[i] + (1 - this._beta) * (x0 + t * dx),\n this._beta * y2[i] + (1 - this._beta) * (y0 + t * dy)\n );\n }\n }\n this._x = this._y = null;\n this._basis.lineEnd();\n },\n point: function(x2, y2) {\n this._x.push(+x2);\n this._y.push(+y2);\n }\n };\n var bundle = function custom(beta) {\n function bundle2(context) {\n return beta === 1 ? new Basis(context) : new Bundle(context, beta);\n }\n bundle2.beta = function(beta2) {\n return custom(+beta2);\n };\n return bundle2;\n }(0.85);\n function point$1(that, x2, y2) {\n that._context.bezierCurveTo(\n that._x1 + that._k * (that._x2 - that._x0),\n that._y1 + that._k * (that._y2 - that._y0),\n that._x2 + that._k * (that._x1 - x2),\n that._y2 + that._k * (that._y1 - y2),\n that._x2,\n that._y2\n );\n }\n function Cardinal(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n }\n Cardinal.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2:\n this._context.lineTo(this._x2, this._y2);\n break;\n case 3:\n point$1(this, this._x1, this._y1);\n break;\n }\n if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x2, y2) {\n x2 = +x2, y2 = +y2;\n switch (this._point) {\n case 0:\n this._point = 1;\n this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2);\n break;\n case 1:\n this._point = 2;\n this._x1 = x2, this._y1 = y2;\n break;\n case 2:\n this._point = 3;\n // proceed\n default:\n point$1(this, x2, y2);\n break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2;\n }\n };\n var cardinal = function custom(tension) {\n function cardinal2(context) {\n return new Cardinal(context, tension);\n }\n cardinal2.tension = function(tension2) {\n return custom(+tension2);\n };\n return cardinal2;\n }(0);\n function CardinalClosed(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n }\n CardinalClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x2, y2) {\n x2 = +x2, y2 = +y2;\n switch (this._point) {\n case 0:\n this._point = 1;\n this._x3 = x2, this._y3 = y2;\n break;\n case 1:\n this._point = 2;\n this._context.moveTo(this._x4 = x2, this._y4 = y2);\n break;\n case 2:\n this._point = 3;\n this._x5 = x2, this._y5 = y2;\n break;\n default:\n point$1(this, x2, y2);\n break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2;\n }\n };\n var cardinalClosed = function custom(tension) {\n function cardinal2(context) {\n return new CardinalClosed(context, tension);\n }\n cardinal2.tension = function(tension2) {\n return custom(+tension2);\n };\n return cardinal2;\n }(0);\n function CardinalOpen(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n }\n CardinalOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || this._line !== 0 && this._point === 3) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x2, y2) {\n x2 = +x2, y2 = +y2;\n switch (this._point) {\n case 0:\n this._point = 1;\n break;\n case 1:\n this._point = 2;\n break;\n case 2:\n this._point = 3;\n this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);\n break;\n case 3:\n this._point = 4;\n // proceed\n default:\n point$1(this, x2, y2);\n break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2;\n }\n };\n var cardinalOpen = function custom(tension) {\n function cardinal2(context) {\n return new CardinalOpen(context, tension);\n }\n cardinal2.tension = function(tension2) {\n return custom(+tension2);\n };\n return cardinal2;\n }(0);\n function point$2(that, x2, y2) {\n var x1 = that._x1, y1 = that._y1, x22 = that._x2, y22 = that._y2;\n if (that._l01_a > epsilon) {\n var a2 = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n = 3 * that._l01_a * (that._l01_a + that._l12_a);\n x1 = (x1 * a2 - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;\n y1 = (y1 * a2 - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;\n }\n if (that._l23_a > epsilon) {\n var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m = 3 * that._l23_a * (that._l23_a + that._l12_a);\n x22 = (x22 * b + that._x1 * that._l23_2a - x2 * that._l12_2a) / m;\n y22 = (y22 * b + that._y1 * that._l23_2a - y2 * that._l12_2a) / m;\n }\n that._context.bezierCurveTo(x1, y1, x22, y22, that._x2, that._y2);\n }\n function CatmullRom(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n }\n CatmullRom.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2:\n this._context.lineTo(this._x2, this._y2);\n break;\n case 3:\n this.point(this._x2, this._y2);\n break;\n }\n if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x2, y2) {\n x2 = +x2, y2 = +y2;\n if (this._point) {\n var x23 = this._x2 - x2, y23 = this._y2 - y2;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n switch (this._point) {\n case 0:\n this._point = 1;\n this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2);\n break;\n case 1:\n this._point = 2;\n break;\n case 2:\n this._point = 3;\n // proceed\n default:\n point$2(this, x2, y2);\n break;\n }\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2;\n }\n };\n var catmullRom = function custom(alpha) {\n function catmullRom2(context) {\n return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);\n }\n catmullRom2.alpha = function(alpha2) {\n return custom(+alpha2);\n };\n return catmullRom2;\n }(0.5);\n function CatmullRomClosed(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n }\n CatmullRomClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x2, y2) {\n x2 = +x2, y2 = +y2;\n if (this._point) {\n var x23 = this._x2 - x2, y23 = this._y2 - y2;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n switch (this._point) {\n case 0:\n this._point = 1;\n this._x3 = x2, this._y3 = y2;\n break;\n case 1:\n this._point = 2;\n this._context.moveTo(this._x4 = x2, this._y4 = y2);\n break;\n case 2:\n this._point = 3;\n this._x5 = x2, this._y5 = y2;\n break;\n default:\n point$2(this, x2, y2);\n break;\n }\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2;\n }\n };\n var catmullRomClosed = function custom(alpha) {\n function catmullRom2(context) {\n return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);\n }\n catmullRom2.alpha = function(alpha2) {\n return custom(+alpha2);\n };\n return catmullRom2;\n }(0.5);\n function CatmullRomOpen(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n }\n CatmullRomOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;\n },\n lineEnd: function() {\n if (this._line || this._line !== 0 && this._point === 3) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x2, y2) {\n x2 = +x2, y2 = +y2;\n if (this._point) {\n var x23 = this._x2 - x2, y23 = this._y2 - y2;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n switch (this._point) {\n case 0:\n this._point = 1;\n break;\n case 1:\n this._point = 2;\n break;\n case 2:\n this._point = 3;\n this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);\n break;\n case 3:\n this._point = 4;\n // proceed\n default:\n point$2(this, x2, y2);\n break;\n }\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2;\n }\n };\n var catmullRomOpen = function custom(alpha) {\n function catmullRom2(context) {\n return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);\n }\n catmullRom2.alpha = function(alpha2) {\n return custom(+alpha2);\n };\n return catmullRom2;\n }(0.5);\n function LinearClosed(context) {\n this._context = context;\n }\n LinearClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._point) this._context.closePath();\n },\n point: function(x2, y2) {\n x2 = +x2, y2 = +y2;\n if (this._point) this._context.lineTo(x2, y2);\n else this._point = 1, this._context.moveTo(x2, y2);\n }\n };\n function linearClosed(context) {\n return new LinearClosed(context);\n }\n function sign(x2) {\n return x2 < 0 ? -1 : 1;\n }\n function slope3(that, x2, y2) {\n var h0 = that._x1 - that._x0, h1 = x2 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), p = (s0 * h1 + s1 * h0) / (h0 + h1);\n return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n }\n function slope2(that, t) {\n var h = that._x1 - that._x0;\n return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;\n }\n function point$3(that, t02, t12) {\n var x0 = that._x0, y0 = that._y0, x1 = that._x1, y1 = that._y1, dx = (x1 - x0) / 3;\n that._context.bezierCurveTo(x0 + dx, y0 + dx * t02, x1 - dx, y1 - dx * t12, x1, y1);\n }\n function MonotoneX(context) {\n this._context = context;\n }\n MonotoneX.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2:\n this._context.lineTo(this._x1, this._y1);\n break;\n case 3:\n point$3(this, this._t0, slope2(this, this._t0));\n break;\n }\n if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x2, y2) {\n var t12 = NaN;\n x2 = +x2, y2 = +y2;\n if (x2 === this._x1 && y2 === this._y1) return;\n switch (this._point) {\n case 0:\n this._point = 1;\n this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2);\n break;\n case 1:\n this._point = 2;\n break;\n case 2:\n this._point = 3;\n point$3(this, slope2(this, t12 = slope3(this, x2, y2)), t12);\n break;\n default:\n point$3(this, this._t0, t12 = slope3(this, x2, y2));\n break;\n }\n this._x0 = this._x1, this._x1 = x2;\n this._y0 = this._y1, this._y1 = y2;\n this._t0 = t12;\n }\n };\n function MonotoneY(context) {\n this._context = new ReflectContext(context);\n }\n (MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x2, y2) {\n MonotoneX.prototype.point.call(this, y2, x2);\n };\n function ReflectContext(context) {\n this._context = context;\n }\n ReflectContext.prototype = {\n moveTo: function(x2, y2) {\n this._context.moveTo(y2, x2);\n },\n closePath: function() {\n this._context.closePath();\n },\n lineTo: function(x2, y2) {\n this._context.lineTo(y2, x2);\n },\n bezierCurveTo: function(x1, y1, x2, y2, x3, y3) {\n this._context.bezierCurveTo(y1, x1, y2, x2, y3, x3);\n }\n };\n function monotoneX(context) {\n return new MonotoneX(context);\n }\n function monotoneY(context) {\n return new MonotoneY(context);\n }\n function Natural(context) {\n this._context = context;\n }\n Natural.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = [];\n this._y = [];\n },\n lineEnd: function() {\n var x2 = this._x, y2 = this._y, n = x2.length;\n if (n) {\n this._line ? this._context.lineTo(x2[0], y2[0]) : this._context.moveTo(x2[0], y2[0]);\n if (n === 2) {\n this._context.lineTo(x2[1], y2[1]);\n } else {\n var px = controlPoints(x2), py = controlPoints(y2);\n for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {\n this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x2[i1], y2[i1]);\n }\n }\n }\n if (this._line || this._line !== 0 && n === 1) this._context.closePath();\n this._line = 1 - this._line;\n this._x = this._y = null;\n },\n point: function(x2, y2) {\n this._x.push(+x2);\n this._y.push(+y2);\n }\n };\n function controlPoints(x2) {\n var i, n = x2.length - 1, m, a2 = new Array(n), b = new Array(n), r = new Array(n);\n a2[0] = 0, b[0] = 2, r[0] = x2[0] + 2 * x2[1];\n for (i = 1; i < n - 1; ++i) a2[i] = 1, b[i] = 4, r[i] = 4 * x2[i] + 2 * x2[i + 1];\n a2[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x2[n - 1] + x2[n];\n for (i = 1; i < n; ++i) m = a2[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];\n a2[n - 1] = r[n - 1] / b[n - 1];\n for (i = n - 2; i >= 0; --i) a2[i] = (r[i] - a2[i + 1]) / b[i];\n b[n - 1] = (x2[n] + a2[n - 1]) / 2;\n for (i = 0; i < n - 1; ++i) b[i] = 2 * x2[i + 1] - a2[i + 1];\n return [a2, b];\n }\n function natural(context) {\n return new Natural(context);\n }\n function Step(context, t) {\n this._context = context;\n this._t = t;\n }\n Step.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = this._y = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);\n if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();\n if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;\n },\n point: function(x2, y2) {\n x2 = +x2, y2 = +y2;\n switch (this._point) {\n case 0:\n this._point = 1;\n this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2);\n break;\n case 1:\n this._point = 2;\n // proceed\n default: {\n if (this._t <= 0) {\n this._context.lineTo(this._x, y2);\n this._context.lineTo(x2, y2);\n } else {\n var x1 = this._x * (1 - this._t) + x2 * this._t;\n this._context.lineTo(x1, this._y);\n this._context.lineTo(x1, y2);\n }\n break;\n }\n }\n this._x = x2, this._y = y2;\n }\n };\n function step(context) {\n return new Step(context, 0.5);\n }\n function stepBefore(context) {\n return new Step(context, 0);\n }\n function stepAfter(context) {\n return new Step(context, 1);\n }\n function none(series, order) {\n if (!((n = series.length) > 1)) return;\n for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) {\n s0 = s1, s1 = series[order[i]];\n for (j = 0; j < m; ++j) {\n s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1];\n }\n }\n }\n function none$1(series) {\n var n = series.length, o = new Array(n);\n while (--n >= 0) o[n] = n;\n return o;\n }\n function stackValue(d, key) {\n return d[key];\n }\n function stack() {\n var keys = constant([]), order = none$1, offset = none, value = stackValue;\n function stack2(data) {\n var kz = keys.apply(this, arguments), i, m = data.length, n = kz.length, sz = new Array(n), oz;\n for (i = 0; i < n; ++i) {\n for (var ki = kz[i], si = sz[i] = new Array(m), j = 0, sij; j < m; ++j) {\n si[j] = sij = [0, +value(data[j], ki, j, data)];\n sij.data = data[j];\n }\n si.key = ki;\n }\n for (i = 0, oz = order(sz); i < n; ++i) {\n sz[oz[i]].index = i;\n }\n offset(sz, oz);\n return sz;\n }\n stack2.keys = function(_) {\n return arguments.length ? (keys = typeof _ === \"function\" ? _ : constant(slice.call(_)), stack2) : keys;\n };\n stack2.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), stack2) : value;\n };\n stack2.order = function(_) {\n return arguments.length ? (order = _ == null ? none$1 : typeof _ === \"function\" ? _ : constant(slice.call(_)), stack2) : order;\n };\n stack2.offset = function(_) {\n return arguments.length ? (offset = _ == null ? none : _, stack2) : offset;\n };\n return stack2;\n }\n function expand(series, order) {\n if (!((n = series.length) > 0)) return;\n for (var i, n, j = 0, m = series[0].length, y2; j < m; ++j) {\n for (y2 = i = 0; i < n; ++i) y2 += series[i][j][1] || 0;\n if (y2) for (i = 0; i < n; ++i) series[i][j][1] /= y2;\n }\n none(series, order);\n }\n function diverging(series, order) {\n if (!((n = series.length) > 0)) return;\n for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) {\n for (yp = yn = 0, i = 0; i < n; ++i) {\n if ((dy = (d = series[order[i]][j])[1] - d[0]) > 0) {\n d[0] = yp, d[1] = yp += dy;\n } else if (dy < 0) {\n d[1] = yn, d[0] = yn += dy;\n } else {\n d[0] = 0, d[1] = dy;\n }\n }\n }\n }\n function silhouette(series, order) {\n if (!((n = series.length) > 0)) return;\n for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) {\n for (var i = 0, y2 = 0; i < n; ++i) y2 += series[i][j][1] || 0;\n s0[j][1] += s0[j][0] = -y2 / 2;\n }\n none(series, order);\n }\n function wiggle(series, order) {\n if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return;\n for (var y2 = 0, j = 1, s0, m, n; j < m; ++j) {\n for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) {\n var si = series[order[i]], sij0 = si[j][1] || 0, sij1 = si[j - 1][1] || 0, s3 = (sij0 - sij1) / 2;\n for (var k2 = 0; k2 < i; ++k2) {\n var sk = series[order[k2]], skj0 = sk[j][1] || 0, skj1 = sk[j - 1][1] || 0;\n s3 += skj0 - skj1;\n }\n s1 += sij0, s2 += s3 * sij0;\n }\n s0[j - 1][1] += s0[j - 1][0] = y2;\n if (s1) y2 -= s2 / s1;\n }\n s0[j - 1][1] += s0[j - 1][0] = y2;\n none(series, order);\n }\n function appearance(series) {\n var peaks = series.map(peak);\n return none$1(series).sort(function(a2, b) {\n return peaks[a2] - peaks[b];\n });\n }\n function peak(series) {\n var i = -1, j = 0, n = series.length, vi, vj = -Infinity;\n while (++i < n) if ((vi = +series[i][1]) > vj) vj = vi, j = i;\n return j;\n }\n function ascending(series) {\n var sums = series.map(sum);\n return none$1(series).sort(function(a2, b) {\n return sums[a2] - sums[b];\n });\n }\n function sum(series) {\n var s2 = 0, i = -1, n = series.length, v;\n while (++i < n) if (v = +series[i][1]) s2 += v;\n return s2;\n }\n function descending$1(series) {\n return ascending(series).reverse();\n }\n function insideOut(series) {\n var n = series.length, i, j, sums = series.map(sum), order = appearance(series), top = 0, bottom = 0, tops = [], bottoms = [];\n for (i = 0; i < n; ++i) {\n j = order[i];\n if (top < bottom) {\n top += sums[j];\n tops.push(j);\n } else {\n bottom += sums[j];\n bottoms.push(j);\n }\n }\n return bottoms.reverse().concat(tops);\n }\n function reverse(series) {\n return none$1(series).reverse();\n }\n exports2.arc = arc;\n exports2.area = area;\n exports2.areaRadial = areaRadial;\n exports2.curveBasis = basis2;\n exports2.curveBasisClosed = basisClosed;\n exports2.curveBasisOpen = basisOpen;\n exports2.curveBundle = bundle;\n exports2.curveCardinal = cardinal;\n exports2.curveCardinalClosed = cardinalClosed;\n exports2.curveCardinalOpen = cardinalOpen;\n exports2.curveCatmullRom = catmullRom;\n exports2.curveCatmullRomClosed = catmullRomClosed;\n exports2.curveCatmullRomOpen = catmullRomOpen;\n exports2.curveLinear = curveLinear;\n exports2.curveLinearClosed = linearClosed;\n exports2.curveMonotoneX = monotoneX;\n exports2.curveMonotoneY = monotoneY;\n exports2.curveNatural = natural;\n exports2.curveStep = step;\n exports2.curveStepAfter = stepAfter;\n exports2.curveStepBefore = stepBefore;\n exports2.line = line;\n exports2.lineRadial = lineRadial$1;\n exports2.linkHorizontal = linkHorizontal;\n exports2.linkRadial = linkRadial;\n exports2.linkVertical = linkVertical;\n exports2.pie = pie;\n exports2.pointRadial = pointRadial;\n exports2.radialArea = areaRadial;\n exports2.radialLine = lineRadial$1;\n exports2.stack = stack;\n exports2.stackOffsetDiverging = diverging;\n exports2.stackOffsetExpand = expand;\n exports2.stackOffsetNone = none;\n exports2.stackOffsetSilhouette = silhouette;\n exports2.stackOffsetWiggle = wiggle;\n exports2.stackOrderAppearance = appearance;\n exports2.stackOrderAscending = ascending;\n exports2.stackOrderDescending = descending$1;\n exports2.stackOrderInsideOut = insideOut;\n exports2.stackOrderNone = none$1;\n exports2.stackOrderReverse = reverse;\n exports2.symbol = symbol;\n exports2.symbolCircle = circle;\n exports2.symbolCross = cross;\n exports2.symbolDiamond = diamond;\n exports2.symbolSquare = square;\n exports2.symbolStar = star;\n exports2.symbolTriangle = triangle;\n exports2.symbolWye = wye;\n exports2.symbols = symbols;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // node_modules/@plotly/d3-sankey/build/d3-sankey.js\n var require_d3_sankey = __commonJS({\n \"node_modules/@plotly/d3-sankey/build/d3-sankey.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports, require_d3_array(), require_d3_collection(), require_d3_shape()) : typeof define === \"function\" && false ? define([\"exports\", \"d3-array\", \"d3-collection\", \"d3-shape\"], factory) : factory(global2.d3 = global2.d3 || {}, global2.d3, global2.d3, global2.d3);\n })(exports, function(exports2, d3Array, d3Collection, d3Shape) {\n \"use strict\";\n function targetDepth(d) {\n return d.target.depth;\n }\n function left(node) {\n return node.depth;\n }\n function right(node, n) {\n return n - 1 - node.height;\n }\n function justify(node, n) {\n return node.sourceLinks.length ? node.depth : n - 1;\n }\n function center(node) {\n return node.targetLinks.length ? node.depth : node.sourceLinks.length ? d3Array.min(node.sourceLinks, targetDepth) - 1 : 0;\n }\n function constant(x) {\n return function() {\n return x;\n };\n }\n function ascendingSourceBreadth(a, b) {\n return ascendingBreadth(a.source, b.source) || a.index - b.index;\n }\n function ascendingTargetBreadth(a, b) {\n return ascendingBreadth(a.target, b.target) || a.index - b.index;\n }\n function ascendingBreadth(a, b) {\n return a.y0 - b.y0;\n }\n function value(d) {\n return d.value;\n }\n function nodeCenter(node) {\n return (node.y0 + node.y1) / 2;\n }\n function weightedSource(link) {\n return nodeCenter(link.source) * link.value;\n }\n function weightedTarget(link) {\n return nodeCenter(link.target) * link.value;\n }\n function defaultId(d) {\n return d.index;\n }\n function defaultNodes(graph) {\n return graph.nodes;\n }\n function defaultLinks(graph) {\n return graph.links;\n }\n function find(nodeById, id) {\n var node = nodeById.get(id);\n if (!node) throw new Error(\"missing: \" + id);\n return node;\n }\n var sankey = function() {\n var x0 = 0, y0 = 0, x1 = 1, y1 = 1, dx = 24, py = 8, id = defaultId, align = justify, nodes = defaultNodes, links = defaultLinks, iterations = 32, maxPaddedSpace = 2 / 3;\n function sankey2() {\n var graph = { nodes: nodes.apply(null, arguments), links: links.apply(null, arguments) };\n computeNodeLinks(graph);\n computeNodeValues(graph);\n computeNodeDepths(graph);\n computeNodeBreadths(graph, iterations);\n computeLinkBreadths(graph);\n return graph;\n }\n sankey2.update = function(graph) {\n computeLinkBreadths(graph);\n return graph;\n };\n sankey2.nodeId = function(_) {\n return arguments.length ? (id = typeof _ === \"function\" ? _ : constant(_), sankey2) : id;\n };\n sankey2.nodeAlign = function(_) {\n return arguments.length ? (align = typeof _ === \"function\" ? _ : constant(_), sankey2) : align;\n };\n sankey2.nodeWidth = function(_) {\n return arguments.length ? (dx = +_, sankey2) : dx;\n };\n sankey2.nodePadding = function(_) {\n return arguments.length ? (py = +_, sankey2) : py;\n };\n sankey2.nodes = function(_) {\n return arguments.length ? (nodes = typeof _ === \"function\" ? _ : constant(_), sankey2) : nodes;\n };\n sankey2.links = function(_) {\n return arguments.length ? (links = typeof _ === \"function\" ? _ : constant(_), sankey2) : links;\n };\n sankey2.size = function(_) {\n return arguments.length ? (x0 = y0 = 0, x1 = +_[0], y1 = +_[1], sankey2) : [x1 - x0, y1 - y0];\n };\n sankey2.extent = function(_) {\n return arguments.length ? (x0 = +_[0][0], x1 = +_[1][0], y0 = +_[0][1], y1 = +_[1][1], sankey2) : [[x0, y0], [x1, y1]];\n };\n sankey2.iterations = function(_) {\n return arguments.length ? (iterations = +_, sankey2) : iterations;\n };\n function computeNodeLinks(graph) {\n graph.nodes.forEach(function(node, i) {\n node.index = i;\n node.sourceLinks = [];\n node.targetLinks = [];\n });\n var nodeById = d3Collection.map(graph.nodes, id);\n graph.links.forEach(function(link, i) {\n link.index = i;\n var source = link.source, target = link.target;\n if (typeof source !== \"object\") source = link.source = find(nodeById, source);\n if (typeof target !== \"object\") target = link.target = find(nodeById, target);\n source.sourceLinks.push(link);\n target.targetLinks.push(link);\n });\n }\n function computeNodeValues(graph) {\n graph.nodes.forEach(function(node) {\n node.value = Math.max(\n d3Array.sum(node.sourceLinks, value),\n d3Array.sum(node.targetLinks, value)\n );\n });\n }\n function computeNodeDepths(graph) {\n var nodes2, next, x;\n for (nodes2 = graph.nodes, next = [], x = 0; nodes2.length; ++x, nodes2 = next, next = []) {\n nodes2.forEach(function(node) {\n node.depth = x;\n node.sourceLinks.forEach(function(link) {\n if (next.indexOf(link.target) < 0) {\n next.push(link.target);\n }\n });\n });\n }\n for (nodes2 = graph.nodes, next = [], x = 0; nodes2.length; ++x, nodes2 = next, next = []) {\n nodes2.forEach(function(node) {\n node.height = x;\n node.targetLinks.forEach(function(link) {\n if (next.indexOf(link.source) < 0) {\n next.push(link.source);\n }\n });\n });\n }\n var kx = (x1 - x0 - dx) / (x - 1);\n graph.nodes.forEach(function(node) {\n node.x1 = (node.x0 = x0 + Math.max(0, Math.min(x - 1, Math.floor(align.call(null, node, x)))) * kx) + dx;\n });\n }\n function computeNodeBreadths(graph) {\n var columns = d3Collection.nest().key(function(d) {\n return d.x0;\n }).sortKeys(d3Array.ascending).entries(graph.nodes).map(function(d) {\n return d.values;\n });\n initializeNodeBreadth();\n resolveCollisions();\n for (var alpha = 1, n = iterations; n > 0; --n) {\n relaxRightToLeft(alpha *= 0.99);\n resolveCollisions();\n relaxLeftToRight(alpha);\n resolveCollisions();\n }\n function initializeNodeBreadth() {\n var L = d3Array.max(columns, function(nodes2) {\n return nodes2.length;\n });\n var maxNodePadding = maxPaddedSpace * (y1 - y0) / (L - 1);\n if (py > maxNodePadding) py = maxNodePadding;\n var ky = d3Array.min(columns, function(nodes2) {\n return (y1 - y0 - (nodes2.length - 1) * py) / d3Array.sum(nodes2, value);\n });\n columns.forEach(function(nodes2) {\n nodes2.forEach(function(node, i) {\n node.y1 = (node.y0 = i) + node.value * ky;\n });\n });\n graph.links.forEach(function(link) {\n link.width = link.value * ky;\n });\n }\n function relaxLeftToRight(alpha2) {\n columns.forEach(function(nodes2) {\n nodes2.forEach(function(node) {\n if (node.targetLinks.length) {\n var dy = (d3Array.sum(node.targetLinks, weightedSource) / d3Array.sum(node.targetLinks, value) - nodeCenter(node)) * alpha2;\n node.y0 += dy, node.y1 += dy;\n }\n });\n });\n }\n function relaxRightToLeft(alpha2) {\n columns.slice().reverse().forEach(function(nodes2) {\n nodes2.forEach(function(node) {\n if (node.sourceLinks.length) {\n var dy = (d3Array.sum(node.sourceLinks, weightedTarget) / d3Array.sum(node.sourceLinks, value) - nodeCenter(node)) * alpha2;\n node.y0 += dy, node.y1 += dy;\n }\n });\n });\n }\n function resolveCollisions() {\n columns.forEach(function(nodes2) {\n var node, dy, y = y0, n2 = nodes2.length, i;\n nodes2.sort(ascendingBreadth);\n for (i = 0; i < n2; ++i) {\n node = nodes2[i];\n dy = y - node.y0;\n if (dy > 0) node.y0 += dy, node.y1 += dy;\n y = node.y1 + py;\n }\n dy = y - py - y1;\n if (dy > 0) {\n y = node.y0 -= dy, node.y1 -= dy;\n for (i = n2 - 2; i >= 0; --i) {\n node = nodes2[i];\n dy = node.y1 + py - y;\n if (dy > 0) node.y0 -= dy, node.y1 -= dy;\n y = node.y0;\n }\n }\n });\n }\n }\n function computeLinkBreadths(graph) {\n graph.nodes.forEach(function(node) {\n node.sourceLinks.sort(ascendingTargetBreadth);\n node.targetLinks.sort(ascendingSourceBreadth);\n });\n graph.nodes.forEach(function(node) {\n var y02 = node.y0, y12 = y02;\n node.sourceLinks.forEach(function(link) {\n link.y0 = y02 + link.width / 2, y02 += link.width;\n });\n node.targetLinks.forEach(function(link) {\n link.y1 = y12 + link.width / 2, y12 += link.width;\n });\n });\n }\n return sankey2;\n };\n function horizontalSource(d) {\n return [d.source.x1, d.y0];\n }\n function horizontalTarget(d) {\n return [d.target.x0, d.y1];\n }\n var sankeyLinkHorizontal = function() {\n return d3Shape.linkHorizontal().source(horizontalSource).target(horizontalTarget);\n };\n exports2.sankey = sankey;\n exports2.sankeyCenter = center;\n exports2.sankeyLeft = left;\n exports2.sankeyRight = right;\n exports2.sankeyJustify = justify;\n exports2.sankeyLinkHorizontal = sankeyLinkHorizontal;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // node_modules/elementary-circuits-directed-graph/johnson.js\n var require_johnson = __commonJS({\n \"node_modules/elementary-circuits-directed-graph/johnson.js\"(exports, module) {\n var tarjan = require_scc();\n module.exports = function findCircuits(edges, cb) {\n var circuits = [];\n var stack = [];\n var blocked = [];\n var B2 = {};\n var Ak = [];\n var s;\n function unblock(u) {\n blocked[u] = false;\n if (B2.hasOwnProperty(u)) {\n Object.keys(B2[u]).forEach(function(w) {\n delete B2[u][w];\n if (blocked[w]) {\n unblock(w);\n }\n });\n }\n }\n function circuit(v) {\n var found = false;\n stack.push(v);\n blocked[v] = true;\n var i2;\n var w;\n for (i2 = 0; i2 < Ak[v].length; i2++) {\n w = Ak[v][i2];\n if (w === s) {\n output(s, stack);\n found = true;\n } else if (!blocked[w]) {\n found = circuit(w);\n }\n }\n if (found) {\n unblock(v);\n } else {\n for (i2 = 0; i2 < Ak[v].length; i2++) {\n w = Ak[v][i2];\n var entry = B2[w];\n if (!entry) {\n entry = {};\n B2[w] = entry;\n }\n entry[w] = true;\n }\n }\n stack.pop();\n return found;\n }\n function output(start, stack2) {\n var cycle = [].concat(stack2).concat(start);\n if (cb) {\n cb(circuit);\n } else {\n circuits.push(cycle);\n }\n }\n function subgraph(minId) {\n for (var i2 = 0; i2 < edges.length; i2++) {\n if (i2 < minId) edges[i2] = [];\n edges[i2] = edges[i2].filter(function(i3) {\n return i3 >= minId;\n });\n }\n }\n function adjacencyStructureSCC(from) {\n subgraph(from);\n var g = edges;\n var sccs = tarjan(g);\n var ccs = sccs.components.filter(function(scc) {\n return scc.length > 1;\n });\n var leastVertex = Infinity;\n var leastVertexComponent;\n for (var i2 = 0; i2 < ccs.length; i2++) {\n for (var j2 = 0; j2 < ccs[i2].length; j2++) {\n if (ccs[i2][j2] < leastVertex) {\n leastVertex = ccs[i2][j2];\n leastVertexComponent = i2;\n }\n }\n }\n var cc = ccs[leastVertexComponent];\n if (!cc) return false;\n var adjList = edges.map(function(l, index) {\n if (cc.indexOf(index) === -1) return [];\n return l.filter(function(i3) {\n return cc.indexOf(i3) !== -1;\n });\n });\n return {\n leastVertex,\n adjList\n };\n }\n s = 0;\n var n = edges.length;\n while (s < n) {\n var p = adjacencyStructureSCC(s);\n s = p.leastVertex;\n Ak = p.adjList;\n if (Ak) {\n for (var i = 0; i < Ak.length; i++) {\n for (var j = 0; j < Ak[i].length; j++) {\n var vertexId = Ak[i][j];\n blocked[+vertexId] = false;\n B2[vertexId] = {};\n }\n }\n circuit(s);\n s = s + 1;\n } else {\n s = n;\n }\n }\n if (cb) {\n return;\n } else {\n return circuits;\n }\n };\n }\n });\n\n // node_modules/@plotly/d3-sankey-circular/dist/d3-sankey-circular.js\n var require_d3_sankey_circular = __commonJS({\n \"node_modules/@plotly/d3-sankey-circular/dist/d3-sankey-circular.js\"(exports, module) {\n (function(global2, factory) {\n typeof exports === \"object\" && typeof module !== \"undefined\" ? factory(exports, require_d3_array(), require_d3_collection(), require_d3_shape(), require_johnson()) : typeof define === \"function\" && false ? define([\"exports\", \"d3-array\", \"d3-collection\", \"d3-shape\", \"elementary-circuits-directed-graph\"], factory) : factory(global2.d3 = global2.d3 || {}, global2.d3, global2.d3, global2.d3, null);\n })(exports, function(exports2, d3Array, d3Collection, d3Shape, findCircuits) {\n \"use strict\";\n findCircuits = findCircuits && findCircuits.hasOwnProperty(\"default\") ? findCircuits[\"default\"] : findCircuits;\n function targetDepth(d) {\n return d.target.depth;\n }\n function left(node) {\n return node.depth;\n }\n function right(node, n) {\n return n - 1 - node.height;\n }\n function justify(node, n) {\n return node.sourceLinks.length ? node.depth : n - 1;\n }\n function center(node) {\n return node.targetLinks.length ? node.depth : node.sourceLinks.length ? d3Array.min(node.sourceLinks, targetDepth) - 1 : 0;\n }\n function constant(x) {\n return function() {\n return x;\n };\n }\n var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function(obj) {\n return typeof obj;\n } : function(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n function ascendingSourceBreadth(a, b) {\n return ascendingBreadth(a.source, b.source) || a.index - b.index;\n }\n function ascendingTargetBreadth(a, b) {\n return ascendingBreadth(a.target, b.target) || a.index - b.index;\n }\n function ascendingBreadth(a, b) {\n if (a.partOfCycle === b.partOfCycle) {\n return a.y0 - b.y0;\n } else {\n if (a.circularLinkType === \"top\" || b.circularLinkType === \"bottom\") {\n return -1;\n } else {\n return 1;\n }\n }\n }\n function value(d) {\n return d.value;\n }\n function nodeCenter(node) {\n return (node.y0 + node.y1) / 2;\n }\n function linkSourceCenter(link) {\n return nodeCenter(link.source);\n }\n function linkTargetCenter(link) {\n return nodeCenter(link.target);\n }\n function defaultId(d) {\n return d.index;\n }\n function defaultNodes(graph) {\n return graph.nodes;\n }\n function defaultLinks(graph) {\n return graph.links;\n }\n function find(nodeById, id) {\n var node = nodeById.get(id);\n if (!node) throw new Error(\"missing: \" + id);\n return node;\n }\n function getNodeID(node, id) {\n return id(node);\n }\n var verticalMargin = 25;\n var baseRadius = 10;\n var scale = 0.3;\n function sankeyCircular() {\n var x0 = 0, y0 = 0, x1 = 1, y1 = 1, dx = 24, py, id = defaultId, align = justify, nodes = defaultNodes, links = defaultLinks, iterations = 32, circularLinkGap = 2, paddingRatio, sortNodes = null;\n function sankeyCircular2() {\n var graph = {\n nodes: nodes.apply(null, arguments),\n links: links.apply(null, arguments)\n // Process the graph's nodes and links, setting their positions\n // 1. Associate the nodes with their respective links, and vice versa\n };\n computeNodeLinks(graph);\n identifyCircles(graph, id, sortNodes);\n computeNodeValues(graph);\n computeNodeDepths(graph);\n selectCircularLinkTypes(graph, id);\n computeNodeBreadths(graph, iterations, id);\n computeLinkBreadths(graph);\n var linkSortingIterations = 4;\n for (var iteration = 0; iteration < linkSortingIterations; iteration++) {\n sortSourceLinks(graph, y1, id);\n sortTargetLinks(graph, y1, id);\n resolveNodeLinkOverlaps(graph, y0, y1, id);\n sortSourceLinks(graph, y1, id);\n sortTargetLinks(graph, y1, id);\n }\n fillHeight(graph, y0, y1);\n addCircularPathData(graph, circularLinkGap, y1, id);\n return graph;\n }\n sankeyCircular2.nodeId = function(_) {\n return arguments.length ? (id = typeof _ === \"function\" ? _ : constant(_), sankeyCircular2) : id;\n };\n sankeyCircular2.nodeAlign = function(_) {\n return arguments.length ? (align = typeof _ === \"function\" ? _ : constant(_), sankeyCircular2) : align;\n };\n sankeyCircular2.nodeWidth = function(_) {\n return arguments.length ? (dx = +_, sankeyCircular2) : dx;\n };\n sankeyCircular2.nodePadding = function(_) {\n return arguments.length ? (py = +_, sankeyCircular2) : py;\n };\n sankeyCircular2.nodes = function(_) {\n return arguments.length ? (nodes = typeof _ === \"function\" ? _ : constant(_), sankeyCircular2) : nodes;\n };\n sankeyCircular2.links = function(_) {\n return arguments.length ? (links = typeof _ === \"function\" ? _ : constant(_), sankeyCircular2) : links;\n };\n sankeyCircular2.size = function(_) {\n return arguments.length ? (x0 = y0 = 0, x1 = +_[0], y1 = +_[1], sankeyCircular2) : [x1 - x0, y1 - y0];\n };\n sankeyCircular2.extent = function(_) {\n return arguments.length ? (x0 = +_[0][0], x1 = +_[1][0], y0 = +_[0][1], y1 = +_[1][1], sankeyCircular2) : [[x0, y0], [x1, y1]];\n };\n sankeyCircular2.iterations = function(_) {\n return arguments.length ? (iterations = +_, sankeyCircular2) : iterations;\n };\n sankeyCircular2.circularLinkGap = function(_) {\n return arguments.length ? (circularLinkGap = +_, sankeyCircular2) : circularLinkGap;\n };\n sankeyCircular2.nodePaddingRatio = function(_) {\n return arguments.length ? (paddingRatio = +_, sankeyCircular2) : paddingRatio;\n };\n sankeyCircular2.sortNodes = function(_) {\n return arguments.length ? (sortNodes = _, sankeyCircular2) : sortNodes;\n };\n sankeyCircular2.update = function(graph) {\n selectCircularLinkTypes(graph, id);\n computeLinkBreadths(graph);\n graph.links.forEach(function(link) {\n if (link.circular) {\n link.circularLinkType = link.y0 + link.y1 < y1 ? \"top\" : \"bottom\";\n link.source.circularLinkType = link.circularLinkType;\n link.target.circularLinkType = link.circularLinkType;\n }\n });\n sortSourceLinks(graph, y1, id, false);\n sortTargetLinks(graph, y1, id);\n addCircularPathData(graph, circularLinkGap, y1, id);\n return graph;\n };\n function computeNodeLinks(graph) {\n graph.nodes.forEach(function(node, i) {\n node.index = i;\n node.sourceLinks = [];\n node.targetLinks = [];\n });\n var nodeById = d3Collection.map(graph.nodes, id);\n graph.links.forEach(function(link, i) {\n link.index = i;\n var source = link.source;\n var target = link.target;\n if ((typeof source === \"undefined\" ? \"undefined\" : _typeof(source)) !== \"object\") {\n source = link.source = find(nodeById, source);\n }\n if ((typeof target === \"undefined\" ? \"undefined\" : _typeof(target)) !== \"object\") {\n target = link.target = find(nodeById, target);\n }\n source.sourceLinks.push(link);\n target.targetLinks.push(link);\n });\n return graph;\n }\n function computeNodeValues(graph) {\n graph.nodes.forEach(function(node) {\n node.partOfCycle = false;\n node.value = Math.max(d3Array.sum(node.sourceLinks, value), d3Array.sum(node.targetLinks, value));\n node.sourceLinks.forEach(function(link) {\n if (link.circular) {\n node.partOfCycle = true;\n node.circularLinkType = link.circularLinkType;\n }\n });\n node.targetLinks.forEach(function(link) {\n if (link.circular) {\n node.partOfCycle = true;\n node.circularLinkType = link.circularLinkType;\n }\n });\n });\n }\n function getCircleMargins(graph) {\n var totalTopLinksWidth = 0, totalBottomLinksWidth = 0, totalRightLinksWidth = 0, totalLeftLinksWidth = 0;\n var maxColumn = d3Array.max(graph.nodes, function(node) {\n return node.column;\n });\n graph.links.forEach(function(link) {\n if (link.circular) {\n if (link.circularLinkType == \"top\") {\n totalTopLinksWidth = totalTopLinksWidth + link.width;\n } else {\n totalBottomLinksWidth = totalBottomLinksWidth + link.width;\n }\n if (link.target.column == 0) {\n totalLeftLinksWidth = totalLeftLinksWidth + link.width;\n }\n if (link.source.column == maxColumn) {\n totalRightLinksWidth = totalRightLinksWidth + link.width;\n }\n }\n });\n totalTopLinksWidth = totalTopLinksWidth > 0 ? totalTopLinksWidth + verticalMargin + baseRadius : totalTopLinksWidth;\n totalBottomLinksWidth = totalBottomLinksWidth > 0 ? totalBottomLinksWidth + verticalMargin + baseRadius : totalBottomLinksWidth;\n totalRightLinksWidth = totalRightLinksWidth > 0 ? totalRightLinksWidth + verticalMargin + baseRadius : totalRightLinksWidth;\n totalLeftLinksWidth = totalLeftLinksWidth > 0 ? totalLeftLinksWidth + verticalMargin + baseRadius : totalLeftLinksWidth;\n return { \"top\": totalTopLinksWidth, \"bottom\": totalBottomLinksWidth, \"left\": totalLeftLinksWidth, \"right\": totalRightLinksWidth };\n }\n function scaleSankeySize(graph, margin) {\n var maxColumn = d3Array.max(graph.nodes, function(node) {\n return node.column;\n });\n var currentWidth = x1 - x0;\n var currentHeight = y1 - y0;\n var newWidth = currentWidth + margin.right + margin.left;\n var newHeight = currentHeight + margin.top + margin.bottom;\n var scaleX = currentWidth / newWidth;\n var scaleY = currentHeight / newHeight;\n x0 = x0 * scaleX + margin.left;\n x1 = margin.right == 0 ? x1 : x1 * scaleX;\n y0 = y0 * scaleY + margin.top;\n y1 = y1 * scaleY;\n graph.nodes.forEach(function(node) {\n node.x0 = x0 + node.column * ((x1 - x0 - dx) / maxColumn);\n node.x1 = node.x0 + dx;\n });\n return scaleY;\n }\n function computeNodeDepths(graph) {\n var nodes2, next, x;\n for (nodes2 = graph.nodes, next = [], x = 0; nodes2.length; ++x, nodes2 = next, next = []) {\n nodes2.forEach(function(node) {\n node.depth = x;\n node.sourceLinks.forEach(function(link) {\n if (next.indexOf(link.target) < 0 && !link.circular) {\n next.push(link.target);\n }\n });\n });\n }\n for (nodes2 = graph.nodes, next = [], x = 0; nodes2.length; ++x, nodes2 = next, next = []) {\n nodes2.forEach(function(node) {\n node.height = x;\n node.targetLinks.forEach(function(link) {\n if (next.indexOf(link.source) < 0 && !link.circular) {\n next.push(link.source);\n }\n });\n });\n }\n graph.nodes.forEach(function(node) {\n node.column = Math.floor(align.call(null, node, x));\n });\n }\n function computeNodeBreadths(graph, iterations2, id2) {\n var columns = d3Collection.nest().key(function(d) {\n return d.column;\n }).sortKeys(d3Array.ascending).entries(graph.nodes).map(function(d) {\n return d.values;\n });\n initializeNodeBreadth(id2);\n resolveCollisions();\n for (var alpha = 1, n = iterations2; n > 0; --n) {\n relaxLeftAndRight(alpha *= 0.99, id2);\n resolveCollisions();\n }\n function initializeNodeBreadth(id3) {\n if (paddingRatio) {\n var padding = Infinity;\n columns.forEach(function(nodes2) {\n var thisPadding = y1 * paddingRatio / (nodes2.length + 1);\n padding = thisPadding < padding ? thisPadding : padding;\n });\n py = padding;\n }\n var ky = d3Array.min(columns, function(nodes2) {\n return (y1 - y0 - (nodes2.length - 1) * py) / d3Array.sum(nodes2, value);\n });\n ky = ky * scale;\n graph.links.forEach(function(link) {\n link.width = link.value * ky;\n });\n var margin = getCircleMargins(graph);\n var ratio = scaleSankeySize(graph, margin);\n ky = ky * ratio;\n graph.links.forEach(function(link) {\n link.width = link.value * ky;\n });\n columns.forEach(function(nodes2) {\n var nodesLength = nodes2.length;\n nodes2.forEach(function(node, i) {\n if (node.depth == columns.length - 1 && nodesLength == 1) {\n node.y0 = y1 / 2 - node.value * ky;\n node.y1 = node.y0 + node.value * ky;\n } else if (node.depth == 0 && nodesLength == 1) {\n node.y0 = y1 / 2 - node.value * ky;\n node.y1 = node.y0 + node.value * ky;\n } else if (node.partOfCycle) {\n if (numberOfNonSelfLinkingCycles(node, id3) == 0) {\n node.y0 = y1 / 2 + i;\n node.y1 = node.y0 + node.value * ky;\n } else if (node.circularLinkType == \"top\") {\n node.y0 = y0 + i;\n node.y1 = node.y0 + node.value * ky;\n } else {\n node.y0 = y1 - node.value * ky - i;\n node.y1 = node.y0 + node.value * ky;\n }\n } else {\n if (margin.top == 0 || margin.bottom == 0) {\n node.y0 = (y1 - y0) / nodesLength * i;\n node.y1 = node.y0 + node.value * ky;\n } else {\n node.y0 = (y1 - y0) / 2 - nodesLength / 2 + i;\n node.y1 = node.y0 + node.value * ky;\n }\n }\n });\n });\n }\n function relaxLeftAndRight(alpha2, id3) {\n var columnsLength = columns.length;\n columns.forEach(function(nodes2) {\n var n2 = nodes2.length;\n var depth = nodes2[0].depth;\n nodes2.forEach(function(node) {\n var nodeHeight;\n if (node.sourceLinks.length || node.targetLinks.length) {\n if (node.partOfCycle && numberOfNonSelfLinkingCycles(node, id3) > 0) ;\n else if (depth == 0 && n2 == 1) {\n nodeHeight = node.y1 - node.y0;\n node.y0 = y1 / 2 - nodeHeight / 2;\n node.y1 = y1 / 2 + nodeHeight / 2;\n } else if (depth == columnsLength - 1 && n2 == 1) {\n nodeHeight = node.y1 - node.y0;\n node.y0 = y1 / 2 - nodeHeight / 2;\n node.y1 = y1 / 2 + nodeHeight / 2;\n } else {\n var avg = 0;\n var avgTargetY = d3Array.mean(node.sourceLinks, linkTargetCenter);\n var avgSourceY = d3Array.mean(node.targetLinks, linkSourceCenter);\n if (avgTargetY && avgSourceY) {\n avg = (avgTargetY + avgSourceY) / 2;\n } else {\n avg = avgTargetY || avgSourceY;\n }\n var dy = (avg - nodeCenter(node)) * alpha2;\n node.y0 += dy;\n node.y1 += dy;\n }\n }\n });\n });\n }\n function resolveCollisions() {\n columns.forEach(function(nodes2) {\n var node, dy, y = y0, n2 = nodes2.length, i;\n nodes2.sort(ascendingBreadth);\n for (i = 0; i < n2; ++i) {\n node = nodes2[i];\n dy = y - node.y0;\n if (dy > 0) {\n node.y0 += dy;\n node.y1 += dy;\n }\n y = node.y1 + py;\n }\n dy = y - py - y1;\n if (dy > 0) {\n y = node.y0 -= dy, node.y1 -= dy;\n for (i = n2 - 2; i >= 0; --i) {\n node = nodes2[i];\n dy = node.y1 + py - y;\n if (dy > 0) node.y0 -= dy, node.y1 -= dy;\n y = node.y0;\n }\n }\n });\n }\n }\n function computeLinkBreadths(graph) {\n graph.nodes.forEach(function(node) {\n node.sourceLinks.sort(ascendingTargetBreadth);\n node.targetLinks.sort(ascendingSourceBreadth);\n });\n graph.nodes.forEach(function(node) {\n var y02 = node.y0;\n var y12 = y02;\n var y0cycle = node.y1;\n var y1cycle = y0cycle;\n node.sourceLinks.forEach(function(link) {\n if (link.circular) {\n link.y0 = y0cycle - link.width / 2;\n y0cycle = y0cycle - link.width;\n } else {\n link.y0 = y02 + link.width / 2;\n y02 += link.width;\n }\n });\n node.targetLinks.forEach(function(link) {\n if (link.circular) {\n link.y1 = y1cycle - link.width / 2;\n y1cycle = y1cycle - link.width;\n } else {\n link.y1 = y12 + link.width / 2;\n y12 += link.width;\n }\n });\n });\n }\n return sankeyCircular2;\n }\n function identifyCircles(graph, id, sortNodes) {\n var circularLinkID = 0;\n if (sortNodes === null) {\n var adjList = [];\n for (var i = 0; i < graph.links.length; i++) {\n var link = graph.links[i];\n var source = link.source.index;\n var target = link.target.index;\n if (!adjList[source]) adjList[source] = [];\n if (!adjList[target]) adjList[target] = [];\n if (adjList[source].indexOf(target) === -1) adjList[source].push(target);\n }\n var cycles = findCircuits(adjList);\n cycles.sort(function(a, b) {\n return a.length - b.length;\n });\n var circularLinks = {};\n for (i = 0; i < cycles.length; i++) {\n var cycle = cycles[i];\n var last = cycle.slice(-2);\n if (!circularLinks[last[0]]) circularLinks[last[0]] = {};\n circularLinks[last[0]][last[1]] = true;\n }\n graph.links.forEach(function(link2) {\n var target2 = link2.target.index;\n var source2 = link2.source.index;\n if (target2 === source2 || circularLinks[source2] && circularLinks[source2][target2]) {\n link2.circular = true;\n link2.circularLinkID = circularLinkID;\n circularLinkID = circularLinkID + 1;\n } else {\n link2.circular = false;\n }\n });\n } else {\n graph.links.forEach(function(link2) {\n if (link2.source[sortNodes] < link2.target[sortNodes]) {\n link2.circular = false;\n } else {\n link2.circular = true;\n link2.circularLinkID = circularLinkID;\n circularLinkID = circularLinkID + 1;\n }\n });\n }\n }\n function selectCircularLinkTypes(graph, id) {\n var numberOfTops = 0;\n var numberOfBottoms = 0;\n graph.links.forEach(function(link) {\n if (link.circular) {\n if (link.source.circularLinkType || link.target.circularLinkType) {\n link.circularLinkType = link.source.circularLinkType ? link.source.circularLinkType : link.target.circularLinkType;\n } else {\n link.circularLinkType = numberOfTops < numberOfBottoms ? \"top\" : \"bottom\";\n }\n if (link.circularLinkType == \"top\") {\n numberOfTops = numberOfTops + 1;\n } else {\n numberOfBottoms = numberOfBottoms + 1;\n }\n graph.nodes.forEach(function(node) {\n if (getNodeID(node, id) == getNodeID(link.source, id) || getNodeID(node, id) == getNodeID(link.target, id)) {\n node.circularLinkType = link.circularLinkType;\n }\n });\n }\n });\n graph.links.forEach(function(link) {\n if (link.circular) {\n if (link.source.circularLinkType == link.target.circularLinkType) {\n link.circularLinkType = link.source.circularLinkType;\n }\n if (selfLinking(link, id)) {\n link.circularLinkType = link.source.circularLinkType;\n }\n }\n });\n }\n function linkAngle(link) {\n var adjacent = Math.abs(link.y1 - link.y0);\n var opposite = Math.abs(link.target.x0 - link.source.x1);\n return Math.atan(opposite / adjacent);\n }\n function circularLinksCross(link1, link2) {\n if (link1.source.column < link2.target.column) {\n return false;\n } else if (link1.target.column > link2.source.column) {\n return false;\n } else {\n return true;\n }\n }\n function numberOfNonSelfLinkingCycles(node, id) {\n var sourceCount = 0;\n node.sourceLinks.forEach(function(l) {\n sourceCount = l.circular && !selfLinking(l, id) ? sourceCount + 1 : sourceCount;\n });\n var targetCount = 0;\n node.targetLinks.forEach(function(l) {\n targetCount = l.circular && !selfLinking(l, id) ? targetCount + 1 : targetCount;\n });\n return sourceCount + targetCount;\n }\n function onlyCircularLink(link) {\n var nodeSourceLinks = link.source.sourceLinks;\n var sourceCount = 0;\n nodeSourceLinks.forEach(function(l) {\n sourceCount = l.circular ? sourceCount + 1 : sourceCount;\n });\n var nodeTargetLinks = link.target.targetLinks;\n var targetCount = 0;\n nodeTargetLinks.forEach(function(l) {\n targetCount = l.circular ? targetCount + 1 : targetCount;\n });\n if (sourceCount > 1 || targetCount > 1) {\n return false;\n } else {\n return true;\n }\n }\n function calcVerticalBuffer(links, circularLinkGap, id) {\n links.sort(sortLinkColumnAscending);\n links.forEach(function(link, i) {\n var buffer = 0;\n if (selfLinking(link, id) && onlyCircularLink(link)) {\n link.circularPathData.verticalBuffer = buffer + link.width / 2;\n } else {\n var j = 0;\n for (j; j < i; j++) {\n if (circularLinksCross(links[i], links[j])) {\n var bufferOverThisLink = links[j].circularPathData.verticalBuffer + links[j].width / 2 + circularLinkGap;\n buffer = bufferOverThisLink > buffer ? bufferOverThisLink : buffer;\n }\n }\n link.circularPathData.verticalBuffer = buffer + link.width / 2;\n }\n });\n return links;\n }\n function addCircularPathData(graph, circularLinkGap, y1, id) {\n var buffer = 5;\n var minY = d3Array.min(graph.links, function(link) {\n return link.source.y0;\n });\n graph.links.forEach(function(link) {\n if (link.circular) {\n link.circularPathData = {};\n }\n });\n var topLinks = graph.links.filter(function(l) {\n return l.circularLinkType == \"top\";\n });\n calcVerticalBuffer(topLinks, circularLinkGap, id);\n var bottomLinks = graph.links.filter(function(l) {\n return l.circularLinkType == \"bottom\";\n });\n calcVerticalBuffer(bottomLinks, circularLinkGap, id);\n graph.links.forEach(function(link) {\n if (link.circular) {\n link.circularPathData.arcRadius = link.width + baseRadius;\n link.circularPathData.leftNodeBuffer = buffer;\n link.circularPathData.rightNodeBuffer = buffer;\n link.circularPathData.sourceWidth = link.source.x1 - link.source.x0;\n link.circularPathData.sourceX = link.source.x0 + link.circularPathData.sourceWidth;\n link.circularPathData.targetX = link.target.x0;\n link.circularPathData.sourceY = link.y0;\n link.circularPathData.targetY = link.y1;\n if (selfLinking(link, id) && onlyCircularLink(link)) {\n link.circularPathData.leftSmallArcRadius = baseRadius + link.width / 2;\n link.circularPathData.leftLargeArcRadius = baseRadius + link.width / 2;\n link.circularPathData.rightSmallArcRadius = baseRadius + link.width / 2;\n link.circularPathData.rightLargeArcRadius = baseRadius + link.width / 2;\n if (link.circularLinkType == \"bottom\") {\n link.circularPathData.verticalFullExtent = link.source.y1 + verticalMargin + link.circularPathData.verticalBuffer;\n link.circularPathData.verticalLeftInnerExtent = link.circularPathData.verticalFullExtent - link.circularPathData.leftLargeArcRadius;\n link.circularPathData.verticalRightInnerExtent = link.circularPathData.verticalFullExtent - link.circularPathData.rightLargeArcRadius;\n } else {\n link.circularPathData.verticalFullExtent = link.source.y0 - verticalMargin - link.circularPathData.verticalBuffer;\n link.circularPathData.verticalLeftInnerExtent = link.circularPathData.verticalFullExtent + link.circularPathData.leftLargeArcRadius;\n link.circularPathData.verticalRightInnerExtent = link.circularPathData.verticalFullExtent + link.circularPathData.rightLargeArcRadius;\n }\n } else {\n var thisColumn = link.source.column;\n var thisCircularLinkType = link.circularLinkType;\n var sameColumnLinks = graph.links.filter(function(l) {\n return l.source.column == thisColumn && l.circularLinkType == thisCircularLinkType;\n });\n if (link.circularLinkType == \"bottom\") {\n sameColumnLinks.sort(sortLinkSourceYDescending);\n } else {\n sameColumnLinks.sort(sortLinkSourceYAscending);\n }\n var radiusOffset = 0;\n sameColumnLinks.forEach(function(l, i) {\n if (l.circularLinkID == link.circularLinkID) {\n link.circularPathData.leftSmallArcRadius = baseRadius + link.width / 2 + radiusOffset;\n link.circularPathData.leftLargeArcRadius = baseRadius + link.width / 2 + i * circularLinkGap + radiusOffset;\n }\n radiusOffset = radiusOffset + l.width;\n });\n thisColumn = link.target.column;\n sameColumnLinks = graph.links.filter(function(l) {\n return l.target.column == thisColumn && l.circularLinkType == thisCircularLinkType;\n });\n if (link.circularLinkType == \"bottom\") {\n sameColumnLinks.sort(sortLinkTargetYDescending);\n } else {\n sameColumnLinks.sort(sortLinkTargetYAscending);\n }\n radiusOffset = 0;\n sameColumnLinks.forEach(function(l, i) {\n if (l.circularLinkID == link.circularLinkID) {\n link.circularPathData.rightSmallArcRadius = baseRadius + link.width / 2 + radiusOffset;\n link.circularPathData.rightLargeArcRadius = baseRadius + link.width / 2 + i * circularLinkGap + radiusOffset;\n }\n radiusOffset = radiusOffset + l.width;\n });\n if (link.circularLinkType == \"bottom\") {\n link.circularPathData.verticalFullExtent = Math.max(y1, link.source.y1, link.target.y1) + verticalMargin + link.circularPathData.verticalBuffer;\n link.circularPathData.verticalLeftInnerExtent = link.circularPathData.verticalFullExtent - link.circularPathData.leftLargeArcRadius;\n link.circularPathData.verticalRightInnerExtent = link.circularPathData.verticalFullExtent - link.circularPathData.rightLargeArcRadius;\n } else {\n link.circularPathData.verticalFullExtent = minY - verticalMargin - link.circularPathData.verticalBuffer;\n link.circularPathData.verticalLeftInnerExtent = link.circularPathData.verticalFullExtent + link.circularPathData.leftLargeArcRadius;\n link.circularPathData.verticalRightInnerExtent = link.circularPathData.verticalFullExtent + link.circularPathData.rightLargeArcRadius;\n }\n }\n link.circularPathData.leftInnerExtent = link.circularPathData.sourceX + link.circularPathData.leftNodeBuffer;\n link.circularPathData.rightInnerExtent = link.circularPathData.targetX - link.circularPathData.rightNodeBuffer;\n link.circularPathData.leftFullExtent = link.circularPathData.sourceX + link.circularPathData.leftLargeArcRadius + link.circularPathData.leftNodeBuffer;\n link.circularPathData.rightFullExtent = link.circularPathData.targetX - link.circularPathData.rightLargeArcRadius - link.circularPathData.rightNodeBuffer;\n }\n if (link.circular) {\n link.path = createCircularPathString(link);\n } else {\n var normalPath = d3Shape.linkHorizontal().source(function(d) {\n var x = d.source.x0 + (d.source.x1 - d.source.x0);\n var y = d.y0;\n return [x, y];\n }).target(function(d) {\n var x = d.target.x0;\n var y = d.y1;\n return [x, y];\n });\n link.path = normalPath(link);\n }\n });\n }\n function createCircularPathString(link) {\n var pathString = \"\";\n if (link.circularLinkType == \"top\") {\n pathString = // start at the right of the source node\n \"M\" + link.circularPathData.sourceX + \" \" + link.circularPathData.sourceY + \" L\" + link.circularPathData.leftInnerExtent + \" \" + link.circularPathData.sourceY + \" A\" + link.circularPathData.leftLargeArcRadius + \" \" + link.circularPathData.leftSmallArcRadius + \" 0 0 0 \" + // End of arc X //End of arc Y\n link.circularPathData.leftFullExtent + \" \" + (link.circularPathData.sourceY - link.circularPathData.leftSmallArcRadius) + \" L\" + link.circularPathData.leftFullExtent + \" \" + link.circularPathData.verticalLeftInnerExtent + \" A\" + link.circularPathData.leftLargeArcRadius + \" \" + link.circularPathData.leftLargeArcRadius + \" 0 0 0 \" + // End of arc X //End of arc Y\n link.circularPathData.leftInnerExtent + \" \" + link.circularPathData.verticalFullExtent + \" L\" + link.circularPathData.rightInnerExtent + \" \" + link.circularPathData.verticalFullExtent + \" A\" + link.circularPathData.rightLargeArcRadius + \" \" + link.circularPathData.rightLargeArcRadius + \" 0 0 0 \" + // End of arc X //End of arc Y\n link.circularPathData.rightFullExtent + \" \" + link.circularPathData.verticalRightInnerExtent + \" L\" + link.circularPathData.rightFullExtent + \" \" + (link.circularPathData.targetY - link.circularPathData.rightSmallArcRadius) + \" A\" + link.circularPathData.rightLargeArcRadius + \" \" + link.circularPathData.rightSmallArcRadius + \" 0 0 0 \" + // End of arc X //End of arc Y\n link.circularPathData.rightInnerExtent + \" \" + link.circularPathData.targetY + \" L\" + link.circularPathData.targetX + \" \" + link.circularPathData.targetY;\n } else {\n pathString = // start at the right of the source node\n \"M\" + link.circularPathData.sourceX + \" \" + link.circularPathData.sourceY + \" L\" + link.circularPathData.leftInnerExtent + \" \" + link.circularPathData.sourceY + \" A\" + link.circularPathData.leftLargeArcRadius + \" \" + link.circularPathData.leftSmallArcRadius + \" 0 0 1 \" + // End of arc X //End of arc Y\n link.circularPathData.leftFullExtent + \" \" + (link.circularPathData.sourceY + link.circularPathData.leftSmallArcRadius) + \" L\" + link.circularPathData.leftFullExtent + \" \" + link.circularPathData.verticalLeftInnerExtent + \" A\" + link.circularPathData.leftLargeArcRadius + \" \" + link.circularPathData.leftLargeArcRadius + \" 0 0 1 \" + // End of arc X //End of arc Y\n link.circularPathData.leftInnerExtent + \" \" + link.circularPathData.verticalFullExtent + \" L\" + link.circularPathData.rightInnerExtent + \" \" + link.circularPathData.verticalFullExtent + \" A\" + link.circularPathData.rightLargeArcRadius + \" \" + link.circularPathData.rightLargeArcRadius + \" 0 0 1 \" + // End of arc X //End of arc Y\n link.circularPathData.rightFullExtent + \" \" + link.circularPathData.verticalRightInnerExtent + \" L\" + link.circularPathData.rightFullExtent + \" \" + (link.circularPathData.targetY + link.circularPathData.rightSmallArcRadius) + \" A\" + link.circularPathData.rightLargeArcRadius + \" \" + link.circularPathData.rightSmallArcRadius + \" 0 0 1 \" + // End of arc X //End of arc Y\n link.circularPathData.rightInnerExtent + \" \" + link.circularPathData.targetY + \" L\" + link.circularPathData.targetX + \" \" + link.circularPathData.targetY;\n }\n return pathString;\n }\n function sortLinkColumnAscending(link1, link2) {\n if (linkColumnDistance(link1) == linkColumnDistance(link2)) {\n return link1.circularLinkType == \"bottom\" ? sortLinkSourceYDescending(link1, link2) : sortLinkSourceYAscending(link1, link2);\n } else {\n return linkColumnDistance(link2) - linkColumnDistance(link1);\n }\n }\n function sortLinkSourceYAscending(link1, link2) {\n return link1.y0 - link2.y0;\n }\n function sortLinkSourceYDescending(link1, link2) {\n return link2.y0 - link1.y0;\n }\n function sortLinkTargetYAscending(link1, link2) {\n return link1.y1 - link2.y1;\n }\n function sortLinkTargetYDescending(link1, link2) {\n return link2.y1 - link1.y1;\n }\n function linkColumnDistance(link) {\n return link.target.column - link.source.column;\n }\n function linkXLength(link) {\n return link.target.x0 - link.source.x1;\n }\n function linkPerpendicularYToLinkSource(longerLink, shorterLink) {\n var angle = linkAngle(longerLink);\n var heightFromY1ToPependicular = linkXLength(shorterLink) / Math.tan(angle);\n var yPerpendicular = incline(longerLink) == \"up\" ? longerLink.y1 + heightFromY1ToPependicular : longerLink.y1 - heightFromY1ToPependicular;\n return yPerpendicular;\n }\n function linkPerpendicularYToLinkTarget(longerLink, shorterLink) {\n var angle = linkAngle(longerLink);\n var heightFromY1ToPependicular = linkXLength(shorterLink) / Math.tan(angle);\n var yPerpendicular = incline(longerLink) == \"up\" ? longerLink.y1 - heightFromY1ToPependicular : longerLink.y1 + heightFromY1ToPependicular;\n return yPerpendicular;\n }\n function resolveNodeLinkOverlaps(graph, y0, y1, id) {\n graph.links.forEach(function(link) {\n if (link.circular) {\n return;\n }\n if (link.target.column - link.source.column > 1) {\n var columnToTest = link.source.column + 1;\n var maxColumnToTest = link.target.column - 1;\n var i = 1;\n var numberOfColumnsToTest = maxColumnToTest - columnToTest + 1;\n for (i = 1; columnToTest <= maxColumnToTest; columnToTest++, i++) {\n graph.nodes.forEach(function(node) {\n if (node.column == columnToTest) {\n var t = i / (numberOfColumnsToTest + 1);\n var B0_t = Math.pow(1 - t, 3);\n var B1_t = 3 * t * Math.pow(1 - t, 2);\n var B2_t = 3 * Math.pow(t, 2) * (1 - t);\n var B3_t = Math.pow(t, 3);\n var py_t = B0_t * link.y0 + B1_t * link.y0 + B2_t * link.y1 + B3_t * link.y1;\n var linkY0AtColumn = py_t - link.width / 2;\n var linkY1AtColumn = py_t + link.width / 2;\n var dy;\n if (linkY0AtColumn > node.y0 && linkY0AtColumn < node.y1) {\n dy = node.y1 - linkY0AtColumn + 10;\n dy = node.circularLinkType == \"bottom\" ? dy : -dy;\n node = adjustNodeHeight(node, dy, y0, y1);\n graph.nodes.forEach(function(otherNode) {\n if (getNodeID(otherNode, id) == getNodeID(node, id) || otherNode.column != node.column) {\n return;\n }\n if (nodesOverlap(node, otherNode)) {\n adjustNodeHeight(otherNode, dy, y0, y1);\n }\n });\n } else if (linkY1AtColumn > node.y0 && linkY1AtColumn < node.y1) {\n dy = linkY1AtColumn - node.y0 + 10;\n node = adjustNodeHeight(node, dy, y0, y1);\n graph.nodes.forEach(function(otherNode) {\n if (getNodeID(otherNode, id) == getNodeID(node, id) || otherNode.column != node.column) {\n return;\n }\n if (otherNode.y0 < node.y1 && otherNode.y1 > node.y1) {\n adjustNodeHeight(otherNode, dy, y0, y1);\n }\n });\n } else if (linkY0AtColumn < node.y0 && linkY1AtColumn > node.y1) {\n dy = linkY1AtColumn - node.y0 + 10;\n node = adjustNodeHeight(node, dy, y0, y1);\n graph.nodes.forEach(function(otherNode) {\n if (getNodeID(otherNode, id) == getNodeID(node, id) || otherNode.column != node.column) {\n return;\n }\n if (otherNode.y0 < node.y1 && otherNode.y1 > node.y1) {\n adjustNodeHeight(otherNode, dy, y0, y1);\n }\n });\n }\n }\n });\n }\n }\n });\n }\n function nodesOverlap(nodeA, nodeB) {\n if (nodeA.y0 > nodeB.y0 && nodeA.y0 < nodeB.y1) {\n return true;\n } else if (nodeA.y1 > nodeB.y0 && nodeA.y1 < nodeB.y1) {\n return true;\n } else if (nodeA.y0 < nodeB.y0 && nodeA.y1 > nodeB.y1) {\n return true;\n } else {\n return false;\n }\n }\n function adjustNodeHeight(node, dy, sankeyY0, sankeyY1) {\n if (node.y0 + dy >= sankeyY0 && node.y1 + dy <= sankeyY1) {\n node.y0 = node.y0 + dy;\n node.y1 = node.y1 + dy;\n node.targetLinks.forEach(function(l) {\n l.y1 = l.y1 + dy;\n });\n node.sourceLinks.forEach(function(l) {\n l.y0 = l.y0 + dy;\n });\n }\n return node;\n }\n function sortSourceLinks(graph, y1, id, moveNodes) {\n graph.nodes.forEach(function(node) {\n if (moveNodes && node.y + (node.y1 - node.y0) > y1) {\n node.y = node.y - (node.y + (node.y1 - node.y0) - y1);\n }\n var nodesSourceLinks = graph.links.filter(function(l) {\n return getNodeID(l.source, id) == getNodeID(node, id);\n });\n var nodeSourceLinksLength = nodesSourceLinks.length;\n if (nodeSourceLinksLength > 1) {\n nodesSourceLinks.sort(function(link1, link2) {\n if (!link1.circular && !link2.circular) {\n if (link1.target.column == link2.target.column) {\n return link1.y1 - link2.y1;\n } else if (!sameInclines(link1, link2)) {\n return link1.y1 - link2.y1;\n } else {\n if (link1.target.column > link2.target.column) {\n var link2Adj = linkPerpendicularYToLinkTarget(link2, link1);\n return link1.y1 - link2Adj;\n }\n if (link2.target.column > link1.target.column) {\n var link1Adj = linkPerpendicularYToLinkTarget(link1, link2);\n return link1Adj - link2.y1;\n }\n }\n }\n if (link1.circular && !link2.circular) {\n return link1.circularLinkType == \"top\" ? -1 : 1;\n } else if (link2.circular && !link1.circular) {\n return link2.circularLinkType == \"top\" ? 1 : -1;\n }\n if (link1.circular && link2.circular) {\n if (link1.circularLinkType === link2.circularLinkType && link1.circularLinkType == \"top\") {\n if (link1.target.column === link2.target.column) {\n return link1.target.y1 - link2.target.y1;\n } else {\n return link2.target.column - link1.target.column;\n }\n } else if (link1.circularLinkType === link2.circularLinkType && link1.circularLinkType == \"bottom\") {\n if (link1.target.column === link2.target.column) {\n return link2.target.y1 - link1.target.y1;\n } else {\n return link1.target.column - link2.target.column;\n }\n } else {\n return link1.circularLinkType == \"top\" ? -1 : 1;\n }\n }\n });\n }\n var ySourceOffset = node.y0;\n nodesSourceLinks.forEach(function(link) {\n link.y0 = ySourceOffset + link.width / 2;\n ySourceOffset = ySourceOffset + link.width;\n });\n nodesSourceLinks.forEach(function(link, i) {\n if (link.circularLinkType == \"bottom\") {\n var j = i + 1;\n var offsetFromBottom = 0;\n for (j; j < nodeSourceLinksLength; j++) {\n offsetFromBottom = offsetFromBottom + nodesSourceLinks[j].width;\n }\n link.y0 = node.y1 - offsetFromBottom - link.width / 2;\n }\n });\n });\n }\n function sortTargetLinks(graph, y1, id) {\n graph.nodes.forEach(function(node) {\n var nodesTargetLinks = graph.links.filter(function(l) {\n return getNodeID(l.target, id) == getNodeID(node, id);\n });\n var nodesTargetLinksLength = nodesTargetLinks.length;\n if (nodesTargetLinksLength > 1) {\n nodesTargetLinks.sort(function(link1, link2) {\n if (!link1.circular && !link2.circular) {\n if (link1.source.column == link2.source.column) {\n return link1.y0 - link2.y0;\n } else if (!sameInclines(link1, link2)) {\n return link1.y0 - link2.y0;\n } else {\n if (link2.source.column < link1.source.column) {\n var link2Adj = linkPerpendicularYToLinkSource(link2, link1);\n return link1.y0 - link2Adj;\n }\n if (link1.source.column < link2.source.column) {\n var link1Adj = linkPerpendicularYToLinkSource(link1, link2);\n return link1Adj - link2.y0;\n }\n }\n }\n if (link1.circular && !link2.circular) {\n return link1.circularLinkType == \"top\" ? -1 : 1;\n } else if (link2.circular && !link1.circular) {\n return link2.circularLinkType == \"top\" ? 1 : -1;\n }\n if (link1.circular && link2.circular) {\n if (link1.circularLinkType === link2.circularLinkType && link1.circularLinkType == \"top\") {\n if (link1.source.column === link2.source.column) {\n return link1.source.y1 - link2.source.y1;\n } else {\n return link1.source.column - link2.source.column;\n }\n } else if (link1.circularLinkType === link2.circularLinkType && link1.circularLinkType == \"bottom\") {\n if (link1.source.column === link2.source.column) {\n return link1.source.y1 - link2.source.y1;\n } else {\n return link2.source.column - link1.source.column;\n }\n } else {\n return link1.circularLinkType == \"top\" ? -1 : 1;\n }\n }\n });\n }\n var yTargetOffset = node.y0;\n nodesTargetLinks.forEach(function(link) {\n link.y1 = yTargetOffset + link.width / 2;\n yTargetOffset = yTargetOffset + link.width;\n });\n nodesTargetLinks.forEach(function(link, i) {\n if (link.circularLinkType == \"bottom\") {\n var j = i + 1;\n var offsetFromBottom = 0;\n for (j; j < nodesTargetLinksLength; j++) {\n offsetFromBottom = offsetFromBottom + nodesTargetLinks[j].width;\n }\n link.y1 = node.y1 - offsetFromBottom - link.width / 2;\n }\n });\n });\n }\n function sameInclines(link1, link2) {\n return incline(link1) == incline(link2);\n }\n function incline(link) {\n return link.y0 - link.y1 > 0 ? \"up\" : \"down\";\n }\n function selfLinking(link, id) {\n return getNodeID(link.source, id) == getNodeID(link.target, id);\n }\n function fillHeight(graph, y0, y1) {\n var nodes = graph.nodes;\n var links = graph.links;\n var top = false;\n var bottom = false;\n links.forEach(function(link) {\n if (link.circularLinkType == \"top\") {\n top = true;\n } else if (link.circularLinkType == \"bottom\") {\n bottom = true;\n }\n });\n if (top == false || bottom == false) {\n var minY0 = d3Array.min(nodes, function(node) {\n return node.y0;\n });\n var maxY1 = d3Array.max(nodes, function(node) {\n return node.y1;\n });\n var currentHeight = maxY1 - minY0;\n var chartHeight = y1 - y0;\n var ratio = chartHeight / currentHeight;\n nodes.forEach(function(node) {\n var nodeHeight = (node.y1 - node.y0) * ratio;\n node.y0 = (node.y0 - minY0) * ratio;\n node.y1 = node.y0 + nodeHeight;\n });\n links.forEach(function(link) {\n link.y0 = (link.y0 - minY0) * ratio;\n link.y1 = (link.y1 - minY0) * ratio;\n link.width = link.width * ratio;\n });\n }\n }\n exports2.sankeyCircular = sankeyCircular;\n exports2.sankeyCenter = center;\n exports2.sankeyLeft = left;\n exports2.sankeyRight = right;\n exports2.sankeyJustify = justify;\n Object.defineProperty(exports2, \"__esModule\", { value: true });\n });\n }\n });\n\n // src/traces/sankey/constants.js\n var require_constants29 = __commonJS({\n \"src/traces/sankey/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n nodeTextOffsetHorizontal: 4,\n nodeTextOffsetVertical: 3,\n nodePadAcross: 10,\n sankeyIterations: 50,\n forceIterations: 5,\n forceTicksPerFrame: 10,\n duration: 500,\n ease: \"linear\",\n cn: {\n sankey: \"sankey\",\n sankeyLinks: \"sankey-links\",\n sankeyLink: \"sankey-link\",\n sankeyNodeSet: \"sankey-node-set\",\n sankeyNode: \"sankey-node\",\n nodeRect: \"node-rect\",\n nodeLabel: \"node-label\"\n }\n };\n }\n });\n\n // src/traces/sankey/render.js\n var require_render = __commonJS({\n \"src/traces/sankey/render.js\"(exports, module) {\n \"use strict\";\n var d3Force = require_d3_force();\n var interpolateNumber = (init_src2(), __toCommonJS(src_exports)).interpolateNumber;\n var d3 = require_d3();\n var d3Sankey = require_d3_sankey();\n var d3SankeyCircular = require_d3_sankey_circular();\n var c = require_constants29();\n var tinycolor = require_tinycolor();\n var Color2 = require_color();\n var Drawing = require_drawing();\n var Lib = require_lib();\n var strTranslate = Lib.strTranslate;\n var strRotate = Lib.strRotate;\n var gup = require_gup();\n var keyFun = gup.keyFun;\n var repeat = gup.repeat;\n var unwrap = gup.unwrap;\n var svgTextUtils = require_svg_text_utils();\n var Registry = require_registry();\n var alignmentConstants = require_alignment();\n var CAP_SHIFT = alignmentConstants.CAP_SHIFT;\n var LINE_SPACING = alignmentConstants.LINE_SPACING;\n var TEXTPAD = 3;\n function sankeyModel(layout, d, traceIndex) {\n var calcData = unwrap(d);\n var trace = calcData.trace;\n var domain = trace.domain;\n var horizontal = trace.orientation === \"h\";\n var nodePad = trace.node.pad;\n var nodeThickness = trace.node.thickness;\n var nodeAlign = {\n justify: d3Sankey.sankeyJustify,\n left: d3Sankey.sankeyLeft,\n right: d3Sankey.sankeyRight,\n center: d3Sankey.sankeyCenter\n }[trace.node.align];\n var width = layout.width * (domain.x[1] - domain.x[0]);\n var height = layout.height * (domain.y[1] - domain.y[0]);\n var nodes = calcData._nodes;\n var links = calcData._links;\n var circular = calcData.circular;\n var sankey;\n if (circular) {\n sankey = d3SankeyCircular.sankeyCircular().circularLinkGap(0);\n } else {\n sankey = d3Sankey.sankey();\n }\n sankey.iterations(c.sankeyIterations).size(horizontal ? [width, height] : [height, width]).nodeWidth(nodeThickness).nodePadding(nodePad).nodeId(function(d2) {\n return d2.pointNumber;\n }).nodeAlign(nodeAlign).nodes(nodes).links(links);\n var graph = sankey();\n if (sankey.nodePadding() < nodePad) {\n Lib.warn(\"node.pad was reduced to \", sankey.nodePadding(), \" to fit within the figure.\");\n }\n var i, j, k;\n for (var nodePointNumber in calcData._groupLookup) {\n var groupIndex = parseInt(calcData._groupLookup[nodePointNumber]);\n var groupingNode;\n for (i = 0; i < graph.nodes.length; i++) {\n if (graph.nodes[i].pointNumber === groupIndex) {\n groupingNode = graph.nodes[i];\n break;\n }\n }\n if (!groupingNode) continue;\n var child = {\n pointNumber: parseInt(nodePointNumber),\n x0: groupingNode.x0,\n x1: groupingNode.x1,\n y0: groupingNode.y0,\n y1: groupingNode.y1,\n partOfGroup: true,\n sourceLinks: [],\n targetLinks: []\n };\n graph.nodes.unshift(child);\n groupingNode.childrenNodes.unshift(child);\n }\n function computeLinkConcentrations() {\n for (i = 0; i < graph.nodes.length; i++) {\n var node = graph.nodes[i];\n var flows = {};\n var flowKey;\n var link;\n for (j = 0; j < node.targetLinks.length; j++) {\n link = node.targetLinks[j];\n flowKey = link.source.pointNumber + \":\" + link.target.pointNumber;\n if (!flows.hasOwnProperty(flowKey)) flows[flowKey] = [];\n flows[flowKey].push(link);\n }\n var keys = Object.keys(flows);\n for (j = 0; j < keys.length; j++) {\n flowKey = keys[j];\n var flowLinks = flows[flowKey];\n var total = 0;\n var totalPerLabel = {};\n for (k = 0; k < flowLinks.length; k++) {\n link = flowLinks[k];\n if (!totalPerLabel[link.label]) totalPerLabel[link.label] = 0;\n totalPerLabel[link.label] += link.value;\n total += link.value;\n }\n for (k = 0; k < flowLinks.length; k++) {\n link = flowLinks[k];\n link.flow = {\n value: total,\n labelConcentration: totalPerLabel[link.label] / total,\n concentration: link.value / total,\n links: flowLinks\n };\n if (link.concentrationscale) {\n link.color = tinycolor(link.concentrationscale(link.flow.labelConcentration));\n }\n }\n }\n var totalOutflow = 0;\n for (j = 0; j < node.sourceLinks.length; j++) {\n totalOutflow += node.sourceLinks[j].value;\n }\n for (j = 0; j < node.sourceLinks.length; j++) {\n link = node.sourceLinks[j];\n link.concentrationOut = link.value / totalOutflow;\n }\n var totalInflow = 0;\n for (j = 0; j < node.targetLinks.length; j++) {\n totalInflow += node.targetLinks[j].value;\n }\n for (j = 0; j < node.targetLinks.length; j++) {\n link = node.targetLinks[j];\n link.concenrationIn = link.value / totalInflow;\n }\n }\n }\n computeLinkConcentrations();\n function resolveCollisionsTopToBottom(columns2) {\n columns2.forEach(function(nodes2) {\n var node;\n var dy;\n var y = 0;\n var n = nodes2.length;\n var i2;\n nodes2.sort(function(a, b) {\n return a.y0 - b.y0;\n });\n for (i2 = 0; i2 < n; ++i2) {\n node = nodes2[i2];\n if (node.y0 >= y) {\n } else {\n dy = y - node.y0;\n if (dy > 1e-6) node.y0 += dy, node.y1 += dy;\n }\n y = node.y1 + nodePad;\n }\n });\n }\n function snapToColumns(nodes2) {\n var orderedNodes = nodes2.map(function(n, i2) {\n return {\n x0: n.x0,\n index: i2\n };\n }).sort(function(a, b) {\n return a.x0 - b.x0;\n });\n var columns2 = [];\n var colNumber = -1;\n var colX;\n var lastX = -Infinity;\n var dx;\n for (i = 0; i < orderedNodes.length; i++) {\n var node = nodes2[orderedNodes[i].index];\n if (node.x0 > lastX + nodeThickness) {\n colNumber += 1;\n colX = node.x0;\n }\n lastX = node.x0;\n if (!columns2[colNumber]) columns2[colNumber] = [];\n columns2[colNumber].push(node);\n dx = colX - node.x0;\n node.x0 += dx, node.x1 += dx;\n }\n return columns2;\n }\n if (trace.node.x.length && trace.node.y.length) {\n for (i = 0; i < Math.min(trace.node.x.length, trace.node.y.length, graph.nodes.length); i++) {\n if (trace.node.x[i] && trace.node.y[i]) {\n var pos = [trace.node.x[i] * width, trace.node.y[i] * height];\n graph.nodes[i].x0 = pos[0] - nodeThickness / 2;\n graph.nodes[i].x1 = pos[0] + nodeThickness / 2;\n var nodeHeight = graph.nodes[i].y1 - graph.nodes[i].y0;\n graph.nodes[i].y0 = pos[1] - nodeHeight / 2;\n graph.nodes[i].y1 = pos[1] + nodeHeight / 2;\n }\n }\n if (trace.arrangement === \"snap\") {\n nodes = graph.nodes;\n var columns = snapToColumns(nodes);\n resolveCollisionsTopToBottom(columns);\n }\n sankey.update(graph);\n }\n return {\n circular,\n key: traceIndex,\n trace,\n guid: Lib.randstr(),\n horizontal,\n width,\n height,\n nodePad: trace.node.pad,\n nodeLineColor: trace.node.line.color,\n nodeLineWidth: trace.node.line.width,\n linkLineColor: trace.link.line.color,\n linkLineWidth: trace.link.line.width,\n linkArrowLength: trace.link.arrowlen,\n valueFormat: trace.valueformat,\n valueSuffix: trace.valuesuffix,\n textFont: trace.textfont,\n translateX: domain.x[0] * layout.width + layout.margin.l,\n translateY: layout.height - domain.y[1] * layout.height + layout.margin.t,\n dragParallel: horizontal ? height : width,\n dragPerpendicular: horizontal ? width : height,\n arrangement: trace.arrangement,\n sankey,\n graph,\n forceLayouts: {},\n interactionState: {\n dragInProgress: false,\n hovered: false\n }\n };\n }\n function linkModel(d, l, i) {\n var tc = tinycolor(l.color);\n var htc = tinycolor(l.hovercolor);\n var basicKey = l.source.label + \"|\" + l.target.label;\n var key = basicKey + \"__\" + i;\n l.trace = d.trace;\n l.curveNumber = d.trace.index;\n return {\n circular: d.circular,\n key,\n traceId: d.key,\n pointNumber: l.pointNumber,\n link: l,\n tinyColorHue: Color2.tinyRGB(tc),\n tinyColorAlpha: tc.getAlpha(),\n tinyColorHoverHue: Color2.tinyRGB(htc),\n tinyColorHoverAlpha: htc.getAlpha(),\n linkPath,\n linkLineColor: d.linkLineColor,\n linkLineWidth: d.linkLineWidth,\n linkArrowLength: d.linkArrowLength,\n valueFormat: d.valueFormat,\n valueSuffix: d.valueSuffix,\n sankey: d.sankey,\n parent: d,\n interactionState: d.interactionState,\n flow: l.flow\n };\n }\n function createCircularClosedPathString(link, arrowLen) {\n var pathString = \"\";\n var offset = link.width / 2;\n var coords = link.circularPathData;\n var isSourceBeforeTarget = coords.sourceX + coords.verticalBuffer < coords.targetX;\n var isPathOverlapped = coords.rightFullExtent - coords.rightLargeArcRadius - arrowLen <= coords.leftFullExtent - offset;\n var diff = Math.abs(coords.rightFullExtent - coords.leftFullExtent - offset) < offset;\n if (link.circularLinkType === \"top\") {\n pathString = // start at the left of the target node\n \"M \" + (coords.targetX - arrowLen) + \" \" + (coords.targetY + offset) + \" L \" + (coords.rightInnerExtent - arrowLen) + \" \" + (coords.targetY + offset) + \"A \" + (coords.rightLargeArcRadius + offset) + \" \" + (coords.rightSmallArcRadius + offset) + \" 0 0 1 \" + (coords.rightFullExtent - offset - arrowLen) + \" \" + (coords.targetY - coords.rightSmallArcRadius) + \"L \" + (coords.rightFullExtent - offset - arrowLen) + \" \" + coords.verticalRightInnerExtent;\n if (isSourceBeforeTarget && isPathOverlapped) {\n pathString += \" A \" + (coords.rightLargeArcRadius + offset) + \" \" + (coords.rightLargeArcRadius + offset) + \" 0 0 1 \" + (coords.rightFullExtent + offset - arrowLen - (coords.rightLargeArcRadius - offset)) + \" \" + (coords.verticalRightInnerExtent - (coords.rightLargeArcRadius + offset)) + \" L \" + (coords.rightFullExtent + offset - (coords.rightLargeArcRadius - offset) - arrowLen) + \" \" + (coords.verticalRightInnerExtent - (coords.rightLargeArcRadius + offset)) + \" A \" + (coords.leftLargeArcRadius + offset) + \" \" + (coords.leftLargeArcRadius + offset) + \" 0 0 1 \" + (coords.leftFullExtent + offset) + \" \" + coords.verticalRightInnerExtent;\n } else if (isSourceBeforeTarget) {\n pathString += \" A \" + (coords.rightLargeArcRadius - offset) + \" \" + (coords.rightLargeArcRadius - offset) + \" 0 0 0 \" + (coords.rightFullExtent - offset - arrowLen - (coords.rightLargeArcRadius - offset)) + \" \" + (coords.verticalRightInnerExtent - (coords.rightLargeArcRadius - offset)) + \" L \" + (coords.leftFullExtent + offset + (coords.rightLargeArcRadius - offset)) + \" \" + (coords.verticalRightInnerExtent - (coords.rightLargeArcRadius - offset)) + \" A \" + (coords.leftLargeArcRadius - offset) + \" \" + (coords.leftLargeArcRadius - offset) + \" 0 0 0 \" + (coords.leftFullExtent + offset) + \" \" + coords.verticalLeftInnerExtent;\n } else {\n pathString += \" A \" + (coords.rightLargeArcRadius + offset) + \" \" + (coords.rightLargeArcRadius + offset) + \" 0 0 1 \" + (coords.rightInnerExtent - arrowLen) + \" \" + (coords.verticalFullExtent - offset) + \" L \" + coords.leftInnerExtent + \" \" + (coords.verticalFullExtent - offset) + \" A \" + (coords.leftLargeArcRadius + offset) + \" \" + (coords.leftLargeArcRadius + offset) + \" 0 0 1 \" + (coords.leftFullExtent + offset) + \" \" + coords.verticalLeftInnerExtent;\n }\n pathString += \" L \" + (coords.leftFullExtent + offset) + \" \" + (coords.sourceY - coords.leftSmallArcRadius) + \" A \" + (coords.leftLargeArcRadius + offset) + \" \" + (coords.leftSmallArcRadius + offset) + \" 0 0 1 \" + coords.leftInnerExtent + \" \" + (coords.sourceY + offset) + \" L \" + coords.sourceX + \" \" + (coords.sourceY + offset) + // Walking back\n \" L \" + coords.sourceX + \" \" + (coords.sourceY - offset) + \" L \" + coords.leftInnerExtent + \" \" + (coords.sourceY - offset) + \" A \" + (coords.leftLargeArcRadius - offset) + \" \" + (coords.leftSmallArcRadius - offset) + \" 0 0 0 \" + (coords.leftFullExtent - offset) + \" \" + (coords.sourceY - coords.leftSmallArcRadius) + \" L \" + (coords.leftFullExtent - offset) + \" \" + coords.verticalLeftInnerExtent;\n if (isSourceBeforeTarget && isPathOverlapped) {\n pathString += \" A \" + (coords.leftLargeArcRadius + offset) + \" \" + (coords.leftSmallArcRadius + offset) + \" 0 0 0 \" + (coords.leftFullExtent - offset) + \" \" + (coords.verticalFullExtent + offset) + \"L\" + (coords.rightFullExtent + offset - arrowLen) + \" \" + (coords.verticalFullExtent + offset) + \" A \" + (coords.leftLargeArcRadius + offset) + \" \" + (coords.leftSmallArcRadius + offset) + \" 0 0 0 \" + (coords.rightFullExtent + offset - arrowLen) + \" \" + coords.verticalRightInnerExtent;\n } else if (isSourceBeforeTarget) {\n pathString += \" A \" + (coords.leftLargeArcRadius + offset) + \" \" + (coords.leftSmallArcRadius + offset) + \" 0 0 1 \" + (coords.leftFullExtent + offset) + \" \" + (coords.verticalFullExtent - offset) + \" L \" + (coords.rightFullExtent - offset - arrowLen) + \" \" + (coords.verticalFullExtent - offset) + \" A \" + (coords.leftLargeArcRadius + offset) + \" \" + (coords.leftSmallArcRadius + offset) + \" 0 0 1 \" + (coords.rightFullExtent + offset - arrowLen) + \" \" + coords.verticalRightInnerExtent;\n } else {\n pathString += \" A \" + (coords.leftLargeArcRadius - offset) + \" \" + (coords.leftLargeArcRadius - offset) + \" 0 0 0 \" + coords.leftInnerExtent + \" \" + (coords.verticalFullExtent + offset) + \" L \" + (coords.rightInnerExtent - arrowLen) + \" \" + (coords.verticalFullExtent + offset) + \" A \" + (coords.rightLargeArcRadius - offset) + \" \" + (coords.rightLargeArcRadius - offset) + \" 0 0 0 \" + (coords.rightFullExtent + offset - arrowLen) + \" \" + coords.verticalRightInnerExtent;\n }\n pathString += \" L \" + (coords.rightFullExtent + offset - arrowLen) + \" \" + (coords.targetY - coords.rightSmallArcRadius) + \" A \" + (coords.rightLargeArcRadius - offset) + \" \" + (coords.rightSmallArcRadius - offset) + \" 0 0 0 \" + (coords.rightInnerExtent - arrowLen) + \" \" + (coords.targetY - offset) + \" L \" + (coords.targetX - arrowLen) + \" \" + (coords.targetY - offset) + (arrowLen > 0 ? \" L \" + coords.targetX + \" \" + coords.targetY : \"\") + \"Z\";\n } else {\n pathString = \"M \" + (coords.targetX - arrowLen) + \" \" + (coords.targetY - offset) + \" L \" + (coords.rightInnerExtent - arrowLen) + \" \" + (coords.targetY - offset) + \" A \" + (coords.rightLargeArcRadius + offset) + \" \" + (coords.rightSmallArcRadius + offset) + \" 0 0 0 \" + (coords.rightFullExtent - offset - arrowLen) + \" \" + (coords.targetY + coords.rightSmallArcRadius) + \" L \" + (coords.rightFullExtent - offset - arrowLen) + \" \" + coords.verticalRightInnerExtent;\n if (isSourceBeforeTarget && isPathOverlapped) {\n pathString += \" A \" + (coords.rightLargeArcRadius + offset) + \" \" + (coords.rightLargeArcRadius + offset) + \" 0 0 0 \" + (coords.rightInnerExtent - offset - arrowLen) + \" \" + (coords.verticalFullExtent + offset) + \" L \" + (coords.rightFullExtent + offset - arrowLen - (coords.rightLargeArcRadius - offset)) + \" \" + (coords.verticalFullExtent + offset) + \" A \" + (coords.rightLargeArcRadius + offset) + \" \" + (coords.rightLargeArcRadius + offset) + \" 0 0 0 \" + (coords.leftFullExtent + offset) + \" \" + coords.verticalLeftInnerExtent;\n } else if (isSourceBeforeTarget) {\n pathString += \" A \" + (coords.rightLargeArcRadius - offset) + \" \" + (coords.rightSmallArcRadius - offset) + \" 0 0 1 \" + (coords.rightFullExtent - arrowLen - offset - (coords.rightLargeArcRadius - offset)) + \" \" + (coords.verticalFullExtent - offset) + \" L \" + (coords.leftFullExtent + offset + (coords.rightLargeArcRadius - offset)) + \" \" + (coords.verticalFullExtent - offset) + \" A \" + (coords.rightLargeArcRadius - offset) + \" \" + (coords.rightSmallArcRadius - offset) + \" 0 0 1 \" + (coords.leftFullExtent + offset) + \" \" + coords.verticalLeftInnerExtent;\n } else {\n pathString += \" A \" + (coords.rightLargeArcRadius + offset) + \" \" + (coords.rightLargeArcRadius + offset) + \" 0 0 0 \" + (coords.rightInnerExtent - arrowLen) + \" \" + (coords.verticalFullExtent + offset) + \" L \" + coords.leftInnerExtent + \" \" + (coords.verticalFullExtent + offset) + \" A \" + (coords.leftLargeArcRadius + offset) + \" \" + (coords.leftLargeArcRadius + offset) + \" 0 0 0 \" + (coords.leftFullExtent + offset) + \" \" + coords.verticalLeftInnerExtent;\n }\n pathString += \" L \" + (coords.leftFullExtent + offset) + \" \" + (coords.sourceY + coords.leftSmallArcRadius) + \" A \" + (coords.leftLargeArcRadius + offset) + \" \" + (coords.leftSmallArcRadius + offset) + \" 0 0 0 \" + coords.leftInnerExtent + \" \" + (coords.sourceY - offset) + \" L \" + coords.sourceX + \" \" + (coords.sourceY - offset) + // Walking back\n \" L \" + coords.sourceX + \" \" + (coords.sourceY + offset) + \" L \" + coords.leftInnerExtent + \" \" + (coords.sourceY + offset) + \" A \" + (coords.leftLargeArcRadius - offset) + \" \" + (coords.leftSmallArcRadius - offset) + \" 0 0 1 \" + (coords.leftFullExtent - offset) + \" \" + (coords.sourceY + coords.leftSmallArcRadius) + \" L \" + (coords.leftFullExtent - offset) + \" \" + coords.verticalLeftInnerExtent;\n if (isSourceBeforeTarget && isPathOverlapped) {\n pathString += \" A \" + (coords.rightLargeArcRadius - offset) + \" \" + (coords.rightSmallArcRadius - offset) + \" 0 0 1 \" + (coords.leftFullExtent - offset - (coords.rightLargeArcRadius - offset)) + \" \" + (coords.verticalFullExtent - offset) + \" L \" + (coords.rightFullExtent + offset - arrowLen + (coords.rightLargeArcRadius - offset)) + \" \" + (coords.verticalFullExtent - offset) + \" A \" + (coords.rightLargeArcRadius - offset) + \" \" + (coords.rightSmallArcRadius - offset) + \" 0 0 1 \" + (coords.rightFullExtent + offset - arrowLen) + \" \" + coords.verticalRightInnerExtent;\n } else if (isSourceBeforeTarget) {\n pathString += \" A \" + (coords.rightLargeArcRadius + offset) + \" \" + (coords.rightLargeArcRadius + offset) + \" 0 0 0 \" + (coords.leftFullExtent + offset) + \" \" + (coords.verticalFullExtent + offset) + \" L \" + (coords.rightFullExtent - arrowLen - offset) + \" \" + (coords.verticalFullExtent + offset) + \" A \" + (coords.rightLargeArcRadius + offset) + \" \" + (coords.rightLargeArcRadius + offset) + \" 0 0 0 \" + (coords.rightFullExtent + offset - arrowLen) + \" \" + coords.verticalRightInnerExtent;\n } else {\n pathString += \" A \" + (coords.leftLargeArcRadius - offset) + \" \" + (coords.leftLargeArcRadius - offset) + \" 0 0 1 \" + coords.leftInnerExtent + \" \" + (coords.verticalFullExtent - offset) + \" L \" + (coords.rightInnerExtent - arrowLen) + \" \" + (coords.verticalFullExtent - offset) + \" A \" + (coords.rightLargeArcRadius - offset) + \" \" + (coords.rightLargeArcRadius - offset) + \" 0 0 1 \" + (coords.rightFullExtent + offset - arrowLen) + \" \" + coords.verticalRightInnerExtent;\n }\n pathString += \" L \" + (coords.rightFullExtent + offset - arrowLen) + \" \" + (coords.targetY + coords.rightSmallArcRadius) + \" A \" + (coords.rightLargeArcRadius - offset) + \" \" + (coords.rightSmallArcRadius - offset) + \" 0 0 1 \" + (coords.rightInnerExtent - arrowLen) + \" \" + (coords.targetY + offset) + \" L \" + (coords.targetX - arrowLen) + \" \" + (coords.targetY + offset) + (arrowLen > 0 ? \" L \" + coords.targetX + \" \" + coords.targetY : \"\") + \"Z\";\n }\n return pathString;\n }\n function linkPath() {\n var curvature = 0.5;\n function path(d) {\n var arrowLen = d.linkArrowLength;\n if (d.link.circular) {\n return createCircularClosedPathString(d.link, arrowLen);\n } else {\n var maxArrowLength = Math.abs((d.link.target.x0 - d.link.source.x1) / 2);\n if (arrowLen > maxArrowLength) {\n arrowLen = maxArrowLength;\n }\n var x0 = d.link.source.x1;\n var x1 = d.link.target.x0 - arrowLen;\n var xi = interpolateNumber(x0, x1);\n var x2 = xi(curvature);\n var x3 = xi(1 - curvature);\n var y0a = d.link.y0 - d.link.width / 2;\n var y0b = d.link.y0 + d.link.width / 2;\n var y1a = d.link.y1 - d.link.width / 2;\n var y1b = d.link.y1 + d.link.width / 2;\n var start = \"M\" + x0 + \",\" + y0a;\n var upperCurve = \"C\" + x2 + \",\" + y0a + \" \" + x3 + \",\" + y1a + \" \" + x1 + \",\" + y1a;\n var lowerCurve = \"C\" + x3 + \",\" + y1b + \" \" + x2 + \",\" + y0b + \" \" + x0 + \",\" + y0b;\n var rightEnd = arrowLen > 0 ? \"L\" + (x1 + arrowLen) + \",\" + (y1a + d.link.width / 2) : \"\";\n rightEnd += \"L\" + x1 + \",\" + y1b;\n return start + upperCurve + rightEnd + lowerCurve + \"Z\";\n }\n }\n return path;\n }\n function nodeModel(d, n) {\n var tc = tinycolor(n.color);\n var zoneThicknessPad = c.nodePadAcross;\n var zoneLengthPad = d.nodePad / 2;\n n.dx = n.x1 - n.x0;\n n.dy = n.y1 - n.y0;\n var visibleThickness = n.dx;\n var visibleLength = Math.max(0.5, n.dy);\n var key = \"node_\" + n.pointNumber;\n if (n.group) {\n key = Lib.randstr();\n }\n n.trace = d.trace;\n n.curveNumber = d.trace.index;\n return {\n index: n.pointNumber,\n key,\n partOfGroup: n.partOfGroup || false,\n group: n.group,\n traceId: d.key,\n trace: d.trace,\n node: n,\n nodePad: d.nodePad,\n nodeLineColor: d.nodeLineColor,\n nodeLineWidth: d.nodeLineWidth,\n textFont: d.textFont,\n size: d.horizontal ? d.height : d.width,\n visibleWidth: Math.ceil(visibleThickness),\n visibleHeight: visibleLength,\n zoneX: -zoneThicknessPad,\n zoneY: -zoneLengthPad,\n zoneWidth: visibleThickness + 2 * zoneThicknessPad,\n zoneHeight: visibleLength + 2 * zoneLengthPad,\n labelY: d.horizontal ? n.dy / 2 + 1 : n.dx / 2 + 1,\n left: n.originalLayer === 1,\n sizeAcross: d.width,\n forceLayouts: d.forceLayouts,\n horizontal: d.horizontal,\n darkBackground: tc.getBrightness() <= 128,\n tinyColorHue: Color2.tinyRGB(tc),\n tinyColorAlpha: tc.getAlpha(),\n valueFormat: d.valueFormat,\n valueSuffix: d.valueSuffix,\n sankey: d.sankey,\n graph: d.graph,\n arrangement: d.arrangement,\n uniqueNodeLabelPathId: [d.guid, d.key, key].join(\"_\"),\n interactionState: d.interactionState,\n figure: d\n };\n }\n function updateNodePositions(sankeyNode) {\n sankeyNode.attr(\"transform\", function(d) {\n return strTranslate(d.node.x0.toFixed(3), d.node.y0.toFixed(3));\n });\n }\n function updateNodeShapes(sankeyNode) {\n sankeyNode.call(updateNodePositions);\n }\n function updateShapes(sankeyNode, sankeyLink) {\n sankeyNode.call(updateNodeShapes);\n sankeyLink.attr(\"d\", linkPath());\n }\n function sizeNode(rect) {\n rect.attr(\"width\", function(d) {\n return d.node.x1 - d.node.x0;\n }).attr(\"height\", function(d) {\n return d.visibleHeight;\n });\n }\n function salientEnough(d) {\n return d.link.width > 1 || d.linkLineWidth > 0;\n }\n function sankeyTransform(d) {\n var offset = strTranslate(d.translateX, d.translateY);\n return offset + (d.horizontal ? \"matrix(1 0 0 1 0 0)\" : \"matrix(0 1 1 0 0 0)\");\n }\n function attachPointerEvents(selection, sankey, eventSet) {\n selection.on(\".basic\", null).on(\"mouseover.basic\", function(d) {\n if (!d.interactionState.dragInProgress && !d.partOfGroup) {\n eventSet.hover(this, d, sankey);\n d.interactionState.hovered = [this, d];\n }\n }).on(\"mousemove.basic\", function(d) {\n if (!d.interactionState.dragInProgress && !d.partOfGroup) {\n eventSet.follow(this, d);\n d.interactionState.hovered = [this, d];\n }\n }).on(\"mouseout.basic\", function(d) {\n if (!d.interactionState.dragInProgress && !d.partOfGroup) {\n eventSet.unhover(this, d, sankey);\n d.interactionState.hovered = false;\n }\n }).on(\"click.basic\", function(d) {\n if (d.interactionState.hovered) {\n eventSet.unhover(this, d, sankey);\n d.interactionState.hovered = false;\n }\n if (!d.interactionState.dragInProgress && !d.partOfGroup) {\n eventSet.select(this, d, sankey);\n }\n });\n }\n function attachDragHandler(sankeyNode, sankeyLink, callbacks, gd) {\n var dragBehavior = d3.behavior.drag().origin(function(d) {\n return {\n x: d.node.x0 + d.visibleWidth / 2,\n y: d.node.y0 + d.visibleHeight / 2\n };\n }).on(\"dragstart\", function(d) {\n if (d.arrangement === \"fixed\") return;\n Lib.ensureSingle(gd._fullLayout._infolayer, \"g\", \"dragcover\", function(s) {\n gd._fullLayout._dragCover = s;\n });\n Lib.raiseToTop(this);\n d.interactionState.dragInProgress = d.node;\n saveCurrentDragPosition(d.node);\n if (d.interactionState.hovered) {\n callbacks.nodeEvents.unhover.apply(0, d.interactionState.hovered);\n d.interactionState.hovered = false;\n }\n if (d.arrangement === \"snap\") {\n var forceKey = d.traceId + \"|\" + d.key;\n if (d.forceLayouts[forceKey]) {\n d.forceLayouts[forceKey].alpha(1);\n } else {\n attachForce(sankeyNode, forceKey, d, gd);\n }\n startForce(sankeyNode, sankeyLink, d, forceKey, gd);\n }\n }).on(\"drag\", function(d) {\n if (d.arrangement === \"fixed\") return;\n var x = d3.event.x;\n var y = d3.event.y;\n if (d.arrangement === \"snap\") {\n d.node.x0 = x - d.visibleWidth / 2;\n d.node.x1 = x + d.visibleWidth / 2;\n d.node.y0 = y - d.visibleHeight / 2;\n d.node.y1 = y + d.visibleHeight / 2;\n } else {\n if (d.arrangement === \"freeform\") {\n d.node.x0 = x - d.visibleWidth / 2;\n d.node.x1 = x + d.visibleWidth / 2;\n }\n y = Math.max(0, Math.min(d.size - d.visibleHeight / 2, y));\n d.node.y0 = y - d.visibleHeight / 2;\n d.node.y1 = y + d.visibleHeight / 2;\n }\n saveCurrentDragPosition(d.node);\n if (d.arrangement !== \"snap\") {\n d.sankey.update(d.graph);\n updateShapes(sankeyNode.filter(sameLayer(d)), sankeyLink);\n }\n }).on(\"dragend\", function(d) {\n if (d.arrangement === \"fixed\") return;\n d.interactionState.dragInProgress = false;\n for (var i = 0; i < d.node.childrenNodes.length; i++) {\n d.node.childrenNodes[i].x = d.node.x;\n d.node.childrenNodes[i].y = d.node.y;\n }\n if (d.arrangement !== \"snap\") persistFinalNodePositions(d, gd);\n });\n sankeyNode.on(\".drag\", null).call(dragBehavior);\n }\n function attachForce(sankeyNode, forceKey, d, gd) {\n switchToForceFormat(d.graph.nodes);\n var nodes = d.graph.nodes.filter(function(n) {\n return n.originalX === d.node.originalX;\n }).filter(function(n) {\n return !n.partOfGroup;\n });\n d.forceLayouts[forceKey] = d3Force.forceSimulation(nodes).alphaDecay(0).force(\"collide\", d3Force.forceCollide().radius(function(n) {\n return n.dy / 2 + d.nodePad / 2;\n }).strength(1).iterations(c.forceIterations)).force(\"constrain\", snappingForce(sankeyNode, forceKey, nodes, d, gd)).stop();\n }\n function startForce(sankeyNode, sankeyLink, d, forceKey, gd) {\n window.requestAnimationFrame(function faster() {\n var i;\n for (i = 0; i < c.forceTicksPerFrame; i++) {\n d.forceLayouts[forceKey].tick();\n }\n var nodes = d.graph.nodes;\n switchToSankeyFormat(nodes);\n d.sankey.update(d.graph);\n updateShapes(sankeyNode.filter(sameLayer(d)), sankeyLink);\n if (d.forceLayouts[forceKey].alpha() > 0) {\n window.requestAnimationFrame(faster);\n } else {\n var x = d.node.originalX;\n d.node.x0 = x - d.visibleWidth / 2;\n d.node.x1 = x + d.visibleWidth / 2;\n persistFinalNodePositions(d, gd);\n }\n });\n }\n function snappingForce(sankeyNode, forceKey, nodes, d) {\n return function _snappingForce() {\n var maxVelocity = 0;\n for (var i = 0; i < nodes.length; i++) {\n var n = nodes[i];\n if (n === d.interactionState.dragInProgress) {\n n.x = n.lastDraggedX;\n n.y = n.lastDraggedY;\n } else {\n n.vx = (n.originalX - n.x) / c.forceTicksPerFrame;\n n.y = Math.min(d.size - n.dy / 2, Math.max(n.dy / 2, n.y));\n }\n maxVelocity = Math.max(maxVelocity, Math.abs(n.vx), Math.abs(n.vy));\n }\n if (!d.interactionState.dragInProgress && maxVelocity < 0.1 && d.forceLayouts[forceKey].alpha() > 0) {\n d.forceLayouts[forceKey].alpha(0);\n }\n };\n }\n function persistFinalNodePositions(d, gd) {\n var x = [];\n var y = [];\n for (var i = 0; i < d.graph.nodes.length; i++) {\n var nodeX = (d.graph.nodes[i].x0 + d.graph.nodes[i].x1) / 2;\n var nodeY = (d.graph.nodes[i].y0 + d.graph.nodes[i].y1) / 2;\n x.push(nodeX / d.figure.width);\n y.push(nodeY / d.figure.height);\n }\n Registry.call(\"_guiRestyle\", gd, {\n \"node.x\": [x],\n \"node.y\": [y]\n }, d.trace.index).then(function() {\n if (gd._fullLayout._dragCover) gd._fullLayout._dragCover.remove();\n });\n }\n function persistOriginalPlace(nodes) {\n var distinctLayerPositions = [];\n var i;\n for (i = 0; i < nodes.length; i++) {\n nodes[i].originalX = (nodes[i].x0 + nodes[i].x1) / 2;\n nodes[i].originalY = (nodes[i].y0 + nodes[i].y1) / 2;\n if (distinctLayerPositions.indexOf(nodes[i].originalX) === -1) {\n distinctLayerPositions.push(nodes[i].originalX);\n }\n }\n distinctLayerPositions.sort(function(a, b) {\n return a - b;\n });\n for (i = 0; i < nodes.length; i++) {\n nodes[i].originalLayerIndex = distinctLayerPositions.indexOf(nodes[i].originalX);\n nodes[i].originalLayer = nodes[i].originalLayerIndex / (distinctLayerPositions.length - 1);\n }\n }\n function saveCurrentDragPosition(d) {\n d.lastDraggedX = d.x0 + d.dx / 2;\n d.lastDraggedY = d.y0 + d.dy / 2;\n }\n function sameLayer(d) {\n return function(n) {\n return n.node.originalX === d.node.originalX;\n };\n }\n function switchToForceFormat(nodes) {\n for (var i = 0; i < nodes.length; i++) {\n nodes[i].y = (nodes[i].y0 + nodes[i].y1) / 2;\n nodes[i].x = (nodes[i].x0 + nodes[i].x1) / 2;\n }\n }\n function switchToSankeyFormat(nodes) {\n for (var i = 0; i < nodes.length; i++) {\n nodes[i].y0 = nodes[i].y - nodes[i].dy / 2;\n nodes[i].y1 = nodes[i].y0 + nodes[i].dy;\n nodes[i].x0 = nodes[i].x - nodes[i].dx / 2;\n nodes[i].x1 = nodes[i].x0 + nodes[i].dx;\n }\n }\n module.exports = function(gd, svg, calcData, layout, callbacks) {\n var isStatic = gd._context.staticPlot;\n var firstRender = false;\n Lib.ensureSingle(gd._fullLayout._infolayer, \"g\", \"first-render\", function() {\n firstRender = true;\n });\n var dragcover = gd._fullLayout._dragCover;\n var styledData = calcData.filter(function(d) {\n return unwrap(d).trace.visible;\n }).map(sankeyModel.bind(null, layout));\n var sankey = svg.selectAll(\".\" + c.cn.sankey).data(styledData, keyFun);\n sankey.exit().remove();\n sankey.enter().append(\"g\").classed(c.cn.sankey, true).style(\"box-sizing\", \"content-box\").style(\"position\", \"absolute\").style(\"left\", 0).style(\"shape-rendering\", \"geometricPrecision\").style(\"pointer-events\", isStatic ? \"none\" : \"auto\").attr(\"transform\", sankeyTransform);\n sankey.each(function(d, i) {\n gd._fullData[i]._sankey = d;\n var dragboxClassName = \"bgsankey-\" + d.trace.uid + \"-\" + i;\n Lib.ensureSingle(gd._fullLayout._draggers, \"rect\", dragboxClassName);\n gd._fullData[i]._bgRect = d3.select(\".\" + dragboxClassName);\n gd._fullData[i]._bgRect.style(\"pointer-events\", isStatic ? \"none\" : \"all\").attr(\"width\", d.width).attr(\"height\", d.height).attr(\"x\", d.translateX).attr(\"y\", d.translateY).classed(\"bgsankey\", true).style({ fill: \"transparent\", \"stroke-width\": 0 });\n });\n sankey.transition().ease(c.ease).duration(c.duration).attr(\"transform\", sankeyTransform);\n var sankeyLinks = sankey.selectAll(\".\" + c.cn.sankeyLinks).data(repeat, keyFun);\n sankeyLinks.enter().append(\"g\").classed(c.cn.sankeyLinks, true).style(\"fill\", \"none\");\n var sankeyLink = sankeyLinks.selectAll(\".\" + c.cn.sankeyLink).data(function(d) {\n var links = d.graph.links;\n return links.filter(function(l) {\n return l.value;\n }).map(linkModel.bind(null, d));\n }, keyFun);\n sankeyLink.enter().append(\"path\").classed(c.cn.sankeyLink, true).call(attachPointerEvents, sankey, callbacks.linkEvents);\n sankeyLink.style(\"stroke\", function(d) {\n return salientEnough(d) ? Color2.tinyRGB(tinycolor(d.linkLineColor)) : d.tinyColorHue;\n }).style(\"stroke-opacity\", function(d) {\n return salientEnough(d) ? Color2.opacity(d.linkLineColor) : d.tinyColorAlpha;\n }).style(\"fill\", function(d) {\n return d.tinyColorHue;\n }).style(\"fill-opacity\", function(d) {\n return d.tinyColorAlpha;\n }).style(\"stroke-width\", function(d) {\n return salientEnough(d) ? d.linkLineWidth : 1;\n }).attr(\"d\", linkPath());\n sankeyLink.style(\"opacity\", function() {\n return gd._context.staticPlot || firstRender || dragcover ? 1 : 0;\n }).transition().ease(c.ease).duration(c.duration).style(\"opacity\", 1);\n sankeyLink.exit().transition().ease(c.ease).duration(c.duration).style(\"opacity\", 0).remove();\n var sankeyNodeSet = sankey.selectAll(\".\" + c.cn.sankeyNodeSet).data(repeat, keyFun);\n sankeyNodeSet.enter().append(\"g\").classed(c.cn.sankeyNodeSet, true);\n sankeyNodeSet.style(\"cursor\", function(d) {\n switch (d.arrangement) {\n case \"fixed\":\n return \"default\";\n case \"perpendicular\":\n return \"ns-resize\";\n default:\n return \"move\";\n }\n });\n var sankeyNode = sankeyNodeSet.selectAll(\".\" + c.cn.sankeyNode).data(function(d) {\n var nodes = d.graph.nodes;\n persistOriginalPlace(nodes);\n return nodes.map(nodeModel.bind(null, d));\n }, keyFun);\n sankeyNode.enter().append(\"g\").classed(c.cn.sankeyNode, true).call(updateNodePositions).style(\"opacity\", function(n) {\n return (gd._context.staticPlot || firstRender) && !n.partOfGroup ? 1 : 0;\n });\n sankeyNode.call(attachPointerEvents, sankey, callbacks.nodeEvents).call(attachDragHandler, sankeyLink, callbacks, gd);\n sankeyNode.transition().ease(c.ease).duration(c.duration).call(updateNodePositions).style(\"opacity\", function(n) {\n return n.partOfGroup ? 0 : 1;\n });\n sankeyNode.exit().transition().ease(c.ease).duration(c.duration).style(\"opacity\", 0).remove();\n var nodeRect = sankeyNode.selectAll(\".\" + c.cn.nodeRect).data(repeat);\n nodeRect.enter().append(\"rect\").classed(c.cn.nodeRect, true).call(sizeNode);\n nodeRect.style(\"stroke-width\", function(d) {\n return d.nodeLineWidth;\n }).style(\"stroke\", function(d) {\n return Color2.tinyRGB(tinycolor(d.nodeLineColor));\n }).style(\"stroke-opacity\", function(d) {\n return Color2.opacity(d.nodeLineColor);\n }).style(\"fill\", function(d) {\n return d.tinyColorHue;\n }).style(\"fill-opacity\", function(d) {\n return d.tinyColorAlpha;\n });\n nodeRect.transition().ease(c.ease).duration(c.duration).call(sizeNode);\n var nodeLabel = sankeyNode.selectAll(\".\" + c.cn.nodeLabel).data(repeat);\n nodeLabel.enter().append(\"text\").classed(c.cn.nodeLabel, true).style(\"cursor\", \"default\");\n nodeLabel.attr(\"data-notex\", 1).text(function(d) {\n return d.node.label;\n }).each(function(d) {\n var e = d3.select(this);\n Drawing.font(e, d.textFont);\n svgTextUtils.convertToTspans(e, gd);\n }).attr(\"text-anchor\", function(d) {\n return d.horizontal && d.left ? \"end\" : \"start\";\n }).attr(\"transform\", function(d) {\n var e = d3.select(this);\n var nLines = svgTextUtils.lineCount(e);\n var blockHeight = d.textFont.size * ((nLines - 1) * LINE_SPACING - CAP_SHIFT);\n var posX = d.nodeLineWidth / 2 + TEXTPAD;\n var posY = ((d.horizontal ? d.visibleHeight : d.visibleWidth) - blockHeight) / 2;\n if (d.horizontal) {\n if (d.left) {\n posX = -posX;\n } else {\n posX += d.visibleWidth;\n }\n }\n var flipText = d.horizontal ? \"\" : \"scale(-1,1)\" + strRotate(90);\n return strTranslate(\n d.horizontal ? posX : posY,\n d.horizontal ? posY : posX\n ) + flipText;\n });\n nodeLabel.transition().ease(c.ease).duration(c.duration);\n };\n }\n });\n\n // src/traces/sankey/plot.js\n var require_plot29 = __commonJS({\n \"src/traces/sankey/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n var numberFormat = Lib.numberFormat;\n var render = require_render();\n var Fx = require_fx();\n var Color2 = require_color();\n var cn = require_constants29().cn;\n var _ = Lib._;\n function renderableValuePresent(d) {\n return d !== \"\";\n }\n function ownTrace(selection, d) {\n return selection.filter(function(s) {\n return s.key === d.traceId;\n });\n }\n function makeTranslucent(element, alpha) {\n d3.select(element).select(\"path\").style(\"fill-opacity\", alpha);\n d3.select(element).select(\"rect\").style(\"fill-opacity\", alpha);\n }\n function makeTextContrasty(element) {\n d3.select(element).select(\"text.name\").style(\"fill\", \"black\");\n }\n function relatedLinks(d) {\n return function(l) {\n return d.node.sourceLinks.indexOf(l.link) !== -1 || d.node.targetLinks.indexOf(l.link) !== -1;\n };\n }\n function relatedNodes(l) {\n return function(d) {\n return d.node.sourceLinks.indexOf(l.link) !== -1 || d.node.targetLinks.indexOf(l.link) !== -1;\n };\n }\n function nodeHoveredStyle(sankeyNode, d, sankey) {\n if (d && sankey) {\n ownTrace(sankey, d).selectAll(\".\" + cn.sankeyLink).filter(relatedLinks(d)).call(linkHoveredStyle.bind(0, d, sankey, false));\n }\n }\n function nodeNonHoveredStyle(sankeyNode, d, sankey) {\n if (d && sankey) {\n ownTrace(sankey, d).selectAll(\".\" + cn.sankeyLink).filter(relatedLinks(d)).call(linkNonHoveredStyle.bind(0, d, sankey, false));\n }\n }\n function linkHoveredStyle(d, sankey, visitNodes, sankeyLink) {\n sankeyLink.style(\"fill\", function(l) {\n if (!l.link.concentrationscale) {\n return l.tinyColorHoverHue;\n }\n }).style(\"fill-opacity\", function(l) {\n if (!l.link.concentrationscale) {\n return l.tinyColorHoverAlpha;\n }\n });\n sankeyLink.each(function(curLink) {\n var label = curLink.link.label;\n if (label !== \"\") {\n ownTrace(sankey, d).selectAll(\".\" + cn.sankeyLink).filter(function(l) {\n return l.link.label === label;\n }).style(\"fill\", function(l) {\n if (!l.link.concentrationscale) {\n return l.tinyColorHoverHue;\n }\n }).style(\"fill-opacity\", function(l) {\n if (!l.link.concentrationscale) {\n return l.tinyColorHoverAlpha;\n }\n });\n }\n });\n if (visitNodes) {\n ownTrace(sankey, d).selectAll(\".\" + cn.sankeyNode).filter(relatedNodes(d)).call(nodeHoveredStyle);\n }\n }\n function linkNonHoveredStyle(d, sankey, visitNodes, sankeyLink) {\n sankeyLink.style(\"fill\", function(l) {\n return l.tinyColorHue;\n }).style(\"fill-opacity\", function(l) {\n return l.tinyColorAlpha;\n });\n sankeyLink.each(function(curLink) {\n var label = curLink.link.label;\n if (label !== \"\") {\n ownTrace(sankey, d).selectAll(\".\" + cn.sankeyLink).filter(function(l) {\n return l.link.label === label;\n }).style(\"fill\", function(l) {\n return l.tinyColorHue;\n }).style(\"fill-opacity\", function(l) {\n return l.tinyColorAlpha;\n });\n }\n });\n if (visitNodes) {\n ownTrace(sankey, d).selectAll(cn.sankeyNode).filter(relatedNodes(d)).call(nodeNonHoveredStyle);\n }\n }\n function castHoverOption(trace, attr) {\n var labelOpts = trace.hoverlabel || {};\n var val = Lib.nestedProperty(labelOpts, attr).get();\n return Array.isArray(val) ? false : val;\n }\n module.exports = function plot(gd, calcData) {\n var fullLayout = gd._fullLayout;\n var svg = fullLayout._paper;\n var size = fullLayout._size;\n for (var i = 0; i < gd._fullData.length; i++) {\n if (!gd._fullData[i].visible) continue;\n if (gd._fullData[i].type !== cn.sankey) continue;\n if (!gd._fullData[i]._viewInitial) {\n var node = gd._fullData[i].node;\n gd._fullData[i]._viewInitial = {\n node: {\n groups: node.groups.slice(),\n x: node.x.slice(),\n y: node.y.slice()\n }\n };\n }\n }\n var linkSelect = function(element, d) {\n var evt = d.link;\n evt.originalEvent = d3.event;\n gd._hoverdata = [evt];\n Fx.click(gd, { target: true });\n };\n var linkHover = function(element, d, sankey) {\n if (gd._fullLayout.hovermode === false) return;\n d3.select(element).call(linkHoveredStyle.bind(0, d, sankey, true));\n if (d.link.trace.link.hoverinfo !== \"skip\") {\n d.link.fullData = d.link.trace;\n gd.emit(\"plotly_hover\", {\n event: d3.event,\n points: [d.link]\n });\n }\n };\n var sourceLabel = _(gd, \"source:\") + \" \";\n var targetLabel = _(gd, \"target:\") + \" \";\n var concentrationLabel = _(gd, \"concentration:\") + \" \";\n var incomingLabel = _(gd, \"incoming flow count:\") + \" \";\n var outgoingLabel = _(gd, \"outgoing flow count:\") + \" \";\n var linkHoverFollow = function(element, d) {\n if (gd._fullLayout.hovermode === false) return;\n var obj = d.link.trace.link;\n if (obj.hoverinfo === \"none\" || obj.hoverinfo === \"skip\") return;\n var hoverItems = [];\n function hoverCenterPosition(link2) {\n var hoverCenterX, hoverCenterY;\n if (link2.circular) {\n hoverCenterX = (link2.circularPathData.leftInnerExtent + link2.circularPathData.rightInnerExtent) / 2;\n hoverCenterY = link2.circularPathData.verticalFullExtent;\n } else {\n hoverCenterX = (link2.source.x1 + link2.target.x0) / 2;\n hoverCenterY = (link2.y0 + link2.y1) / 2;\n }\n var center = [hoverCenterX, hoverCenterY];\n if (link2.trace.orientation === \"v\") center.reverse();\n center[0] += d.parent.translateX;\n center[1] += d.parent.translateY;\n return center;\n }\n var anchorIndex = 0;\n for (var i2 = 0; i2 < d.flow.links.length; i2++) {\n var link = d.flow.links[i2];\n if (gd._fullLayout.hovermode === \"closest\" && d.link.pointNumber !== link.pointNumber) continue;\n if (d.link.pointNumber === link.pointNumber) anchorIndex = i2;\n link.fullData = link.trace;\n obj = d.link.trace.link;\n var hoverCenter = hoverCenterPosition(link);\n var hovertemplateLabels = { valueLabel: numberFormat(d.valueFormat)(link.value) + d.valueSuffix };\n hoverItems.push({\n x: hoverCenter[0],\n y: hoverCenter[1],\n name: hovertemplateLabels.valueLabel,\n text: [\n link.label || \"\",\n sourceLabel + link.source.label,\n targetLabel + link.target.label,\n link.concentrationscale ? concentrationLabel + numberFormat(\"%0.2f\")(link.flow.labelConcentration) : \"\"\n ].filter(renderableValuePresent).join(\"
    \"),\n color: castHoverOption(obj, \"bgcolor\") || Color2.addOpacity(link.color, 1),\n borderColor: castHoverOption(obj, \"bordercolor\"),\n fontFamily: castHoverOption(obj, \"font.family\"),\n fontSize: castHoverOption(obj, \"font.size\"),\n fontColor: castHoverOption(obj, \"font.color\"),\n fontWeight: castHoverOption(obj, \"font.weight\"),\n fontStyle: castHoverOption(obj, \"font.style\"),\n fontVariant: castHoverOption(obj, \"font.variant\"),\n fontTextcase: castHoverOption(obj, \"font.textcase\"),\n fontLineposition: castHoverOption(obj, \"font.lineposition\"),\n fontShadow: castHoverOption(obj, \"font.shadow\"),\n nameLength: castHoverOption(obj, \"namelength\"),\n textAlign: castHoverOption(obj, \"align\"),\n idealAlign: d3.event.x < hoverCenter[0] ? \"right\" : \"left\",\n hovertemplate: obj.hovertemplate,\n hovertemplateLabels,\n eventData: [link]\n });\n }\n var tooltips = Fx.loneHover(hoverItems, {\n container: fullLayout._hoverlayer.node(),\n outerContainer: fullLayout._paper.node(),\n gd,\n anchorIndex\n });\n tooltips.each(function() {\n var tooltip = this;\n if (!d.link.concentrationscale) {\n makeTranslucent(tooltip, 0.65);\n }\n makeTextContrasty(tooltip);\n });\n };\n var linkUnhover = function(element, d, sankey) {\n if (gd._fullLayout.hovermode === false) return;\n d3.select(element).call(linkNonHoveredStyle.bind(0, d, sankey, true));\n if (d.link.trace.link.hoverinfo !== \"skip\") {\n d.link.fullData = d.link.trace;\n gd.emit(\"plotly_unhover\", {\n event: d3.event,\n points: [d.link]\n });\n }\n Fx.loneUnhover(fullLayout._hoverlayer.node());\n };\n var nodeSelect = function(element, d, sankey) {\n var evt = d.node;\n evt.originalEvent = d3.event;\n gd._hoverdata = [evt];\n d3.select(element).call(nodeNonHoveredStyle, d, sankey);\n Fx.click(gd, { target: true });\n };\n var nodeHover = function(element, d, sankey) {\n if (gd._fullLayout.hovermode === false) return;\n d3.select(element).call(nodeHoveredStyle, d, sankey);\n if (d.node.trace.node.hoverinfo !== \"skip\") {\n d.node.fullData = d.node.trace;\n gd.emit(\"plotly_hover\", {\n event: d3.event,\n points: [d.node]\n });\n }\n };\n var nodeHoverFollow = function(element, d) {\n if (gd._fullLayout.hovermode === false) return;\n var obj = d.node.trace.node;\n if (obj.hoverinfo === \"none\" || obj.hoverinfo === \"skip\") return;\n var nodeRect = d3.select(element).select(\".\" + cn.nodeRect);\n var rootBBox = gd._fullLayout._paperdiv.node().getBoundingClientRect();\n var boundingBox = nodeRect.node().getBoundingClientRect();\n var hoverCenterX0 = boundingBox.left - 2 - rootBBox.left;\n var hoverCenterX1 = boundingBox.right + 2 - rootBBox.left;\n var hoverCenterY = boundingBox.top + boundingBox.height / 4 - rootBBox.top;\n var hovertemplateLabels = { valueLabel: numberFormat(d.valueFormat)(d.node.value) + d.valueSuffix };\n d.node.fullData = d.node.trace;\n gd._fullLayout._calcInverseTransform(gd);\n var scaleX = gd._fullLayout._invScaleX;\n var scaleY = gd._fullLayout._invScaleY;\n var tooltip = Fx.loneHover({\n x0: scaleX * hoverCenterX0,\n x1: scaleX * hoverCenterX1,\n y: scaleY * hoverCenterY,\n name: numberFormat(d.valueFormat)(d.node.value) + d.valueSuffix,\n text: [\n d.node.label,\n incomingLabel + d.node.targetLinks.length,\n outgoingLabel + d.node.sourceLinks.length\n ].filter(renderableValuePresent).join(\"
    \"),\n color: castHoverOption(obj, \"bgcolor\") || d.tinyColorHue,\n borderColor: castHoverOption(obj, \"bordercolor\"),\n fontFamily: castHoverOption(obj, \"font.family\"),\n fontSize: castHoverOption(obj, \"font.size\"),\n fontColor: castHoverOption(obj, \"font.color\"),\n fontWeight: castHoverOption(obj, \"font.weight\"),\n fontStyle: castHoverOption(obj, \"font.style\"),\n fontVariant: castHoverOption(obj, \"font.variant\"),\n fontTextcase: castHoverOption(obj, \"font.textcase\"),\n fontLineposition: castHoverOption(obj, \"font.lineposition\"),\n fontShadow: castHoverOption(obj, \"font.shadow\"),\n nameLength: castHoverOption(obj, \"namelength\"),\n textAlign: castHoverOption(obj, \"align\"),\n idealAlign: \"left\",\n hovertemplate: obj.hovertemplate,\n hovertemplateLabels,\n eventData: [d.node]\n }, {\n container: fullLayout._hoverlayer.node(),\n outerContainer: fullLayout._paper.node(),\n gd\n });\n makeTranslucent(tooltip, 0.85);\n makeTextContrasty(tooltip);\n };\n var nodeUnhover = function(element, d, sankey) {\n if (gd._fullLayout.hovermode === false) return;\n d3.select(element).call(nodeNonHoveredStyle, d, sankey);\n if (d.node.trace.node.hoverinfo !== \"skip\") {\n d.node.fullData = d.node.trace;\n gd.emit(\"plotly_unhover\", {\n event: d3.event,\n points: [d.node]\n });\n }\n Fx.loneUnhover(fullLayout._hoverlayer.node());\n };\n render(\n gd,\n svg,\n calcData,\n {\n width: size.w,\n height: size.h,\n margin: {\n t: size.t,\n r: size.r,\n b: size.b,\n l: size.l\n }\n },\n {\n linkEvents: {\n hover: linkHover,\n follow: linkHoverFollow,\n unhover: linkUnhover,\n select: linkSelect\n },\n nodeEvents: {\n hover: nodeHover,\n follow: nodeHoverFollow,\n unhover: nodeUnhover,\n select: nodeSelect\n }\n }\n );\n };\n }\n });\n\n // src/traces/sankey/base_plot.js\n var require_base_plot9 = __commonJS({\n \"src/traces/sankey/base_plot.js\"(exports) {\n \"use strict\";\n var overrideAll = require_edit_types().overrideAll;\n var getModuleCalcData = require_get_data().getModuleCalcData;\n var plot = require_plot29();\n var fxAttrs = require_layout_attributes();\n var setCursor = require_setcursor();\n var dragElement = require_dragelement();\n var prepSelect = require_selections().prepSelect;\n var Lib = require_lib();\n var Registry = require_registry();\n var SANKEY = \"sankey\";\n exports.name = SANKEY;\n exports.baseLayoutAttrOverrides = overrideAll({\n hoverlabel: fxAttrs.hoverlabel\n }, \"plot\", \"nested\");\n exports.plot = function(gd) {\n var calcData = getModuleCalcData(gd.calcdata, SANKEY)[0];\n plot(gd, calcData);\n exports.updateFx(gd);\n };\n exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var hadPlot = oldFullLayout._has && oldFullLayout._has(SANKEY);\n var hasPlot = newFullLayout._has && newFullLayout._has(SANKEY);\n if (hadPlot && !hasPlot) {\n oldFullLayout._paperdiv.selectAll(\".sankey\").remove();\n oldFullLayout._paperdiv.selectAll(\".bgsankey\").remove();\n }\n };\n exports.updateFx = function(gd) {\n for (var i = 0; i < gd._fullData.length; i++) {\n subplotUpdateFx(gd, i);\n }\n };\n function subplotUpdateFx(gd, index) {\n var trace = gd._fullData[index];\n var fullLayout = gd._fullLayout;\n var dragMode = fullLayout.dragmode;\n var cursor = fullLayout.dragmode === \"pan\" ? \"move\" : \"crosshair\";\n var bgRect = trace._bgRect;\n if (!bgRect) return;\n if (dragMode === \"pan\" || dragMode === \"zoom\") return;\n setCursor(bgRect, cursor);\n var xaxis = {\n _id: \"x\",\n c2p: Lib.identity,\n _offset: trace._sankey.translateX,\n _length: trace._sankey.width\n };\n var yaxis = {\n _id: \"y\",\n c2p: Lib.identity,\n _offset: trace._sankey.translateY,\n _length: trace._sankey.height\n };\n var dragOptions = {\n gd,\n element: bgRect.node(),\n plotinfo: {\n id: index,\n xaxis,\n yaxis,\n fillRangeItems: Lib.noop\n },\n subplot: index,\n // create mock x/y axes for hover routine\n xaxes: [xaxis],\n yaxes: [yaxis],\n doneFnCompleted: function(selection) {\n var traceNow = gd._fullData[index];\n var newGroups;\n var oldGroups = traceNow.node.groups.slice();\n var newGroup = [];\n function findNode(pt) {\n var nodes = traceNow._sankey.graph.nodes;\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i].pointNumber === pt) return nodes[i];\n }\n }\n for (var j = 0; j < selection.length; j++) {\n var node = findNode(selection[j].pointNumber);\n if (!node) continue;\n if (node.group) {\n for (var k = 0; k < node.childrenNodes.length; k++) {\n newGroup.push(node.childrenNodes[k].pointNumber);\n }\n oldGroups[node.pointNumber - traceNow.node._count] = false;\n } else {\n newGroup.push(node.pointNumber);\n }\n }\n newGroups = oldGroups.filter(Boolean).concat([newGroup]);\n Registry.call(\"_guiRestyle\", gd, {\n \"node.groups\": [newGroups]\n }, index);\n }\n };\n dragOptions.prepFn = function(e, startX, startY) {\n prepSelect(e, startX, startY, dragOptions, dragMode);\n };\n dragElement.init(dragOptions);\n }\n }\n });\n\n // src/traces/sankey/select.js\n var require_select11 = __commonJS({\n \"src/traces/sankey/select.js\"(exports, module) {\n \"use strict\";\n module.exports = function selectPoints(searchInfo, selectionTester) {\n var cd = searchInfo.cd;\n var selection = [];\n var fullData = cd[0].trace;\n var nodes = fullData._sankey.graph.nodes;\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n if (node.partOfGroup) continue;\n var pos = [(node.x0 + node.x1) / 2, (node.y0 + node.y1) / 2];\n if (fullData.orientation === \"v\") pos.reverse();\n if (selectionTester && selectionTester.contains(pos, false, i, searchInfo)) {\n selection.push({\n pointNumber: node.pointNumber\n // TODO: add eventData\n });\n }\n }\n return selection;\n };\n }\n });\n\n // src/traces/sankey/index.js\n var require_sankey = __commonJS({\n \"src/traces/sankey/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes60(),\n supplyDefaults: require_defaults56(),\n calc: require_calc35(),\n plot: require_plot29(),\n moduleType: \"trace\",\n name: \"sankey\",\n basePlotModule: require_base_plot9(),\n selectPoints: require_select11(),\n categories: [\"noOpacity\"],\n meta: {}\n };\n }\n });\n\n // lib/sankey.js\n var require_sankey2 = __commonJS({\n \"lib/sankey.js\"(exports, module) {\n \"use strict\";\n module.exports = require_sankey();\n }\n });\n\n // src/traces/indicator/base_plot.js\n var require_base_plot10 = __commonJS({\n \"src/traces/indicator/base_plot.js\"(exports) {\n \"use strict\";\n var plots = require_plots();\n exports.name = \"indicator\";\n exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) {\n plots.plotBasePlot(exports.name, gd, traces, transitionOpts, makeOnCompleteCallback);\n };\n exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout);\n };\n }\n });\n\n // src/traces/indicator/attributes.js\n var require_attributes61 = __commonJS({\n \"src/traces/indicator/attributes.js\"(exports, module) {\n \"use strict\";\n var extendFlat = require_extend().extendFlat;\n var extendDeep = require_extend().extendDeep;\n var overrideAll = require_edit_types().overrideAll;\n var fontAttrs = require_font_attributes();\n var colorAttrs = require_attributes3();\n var domainAttrs = require_domain().attributes;\n var axesAttrs = require_layout_attributes4();\n var templatedArray = require_plot_template().templatedArray;\n var delta = require_delta();\n var descriptionOnlyNumbers = require_axis_format_attributes().descriptionOnlyNumbers;\n var textFontAttrs = fontAttrs({\n editType: \"plot\",\n colorEditType: \"plot\"\n });\n var gaugeBarAttrs = {\n color: {\n valType: \"color\",\n editType: \"plot\"\n },\n line: {\n color: {\n valType: \"color\",\n dflt: colorAttrs.defaultLine,\n editType: \"plot\"\n },\n width: {\n valType: \"number\",\n min: 0,\n dflt: 0,\n editType: \"plot\"\n },\n editType: \"calc\"\n },\n thickness: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 1,\n editType: \"plot\"\n },\n editType: \"calc\"\n };\n var rangeAttr = {\n valType: \"info_array\",\n items: [\n { valType: \"number\", editType: \"plot\" },\n { valType: \"number\", editType: \"plot\" }\n ],\n editType: \"plot\"\n };\n var stepsAttrs = templatedArray(\"step\", extendDeep({}, gaugeBarAttrs, {\n range: rangeAttr\n }));\n module.exports = {\n mode: {\n valType: \"flaglist\",\n editType: \"calc\",\n flags: [\"number\", \"delta\", \"gauge\"],\n dflt: \"number\"\n },\n value: {\n valType: \"number\",\n editType: \"calc\",\n anim: true\n },\n align: {\n valType: \"enumerated\",\n values: [\"left\", \"center\", \"right\"],\n editType: \"plot\"\n },\n // position\n domain: domainAttrs({ name: \"indicator\", trace: true, editType: \"calc\" }),\n title: {\n text: {\n valType: \"string\",\n editType: \"plot\"\n },\n align: {\n valType: \"enumerated\",\n values: [\"left\", \"center\", \"right\"],\n editType: \"plot\"\n },\n font: extendFlat({}, textFontAttrs, {}),\n editType: \"plot\"\n },\n number: {\n valueformat: {\n valType: \"string\",\n dflt: \"\",\n editType: \"plot\",\n description: descriptionOnlyNumbers(\"value\")\n },\n font: extendFlat({}, textFontAttrs, {}),\n prefix: {\n valType: \"string\",\n dflt: \"\",\n editType: \"plot\"\n },\n suffix: {\n valType: \"string\",\n dflt: \"\",\n editType: \"plot\"\n },\n editType: \"plot\"\n },\n delta: {\n reference: {\n valType: \"number\",\n editType: \"calc\"\n },\n position: {\n valType: \"enumerated\",\n values: [\"top\", \"bottom\", \"left\", \"right\"],\n dflt: \"bottom\",\n editType: \"plot\"\n },\n relative: {\n valType: \"boolean\",\n editType: \"plot\",\n dflt: false\n },\n valueformat: {\n valType: \"string\",\n editType: \"plot\",\n description: descriptionOnlyNumbers(\"value\")\n },\n increasing: {\n symbol: {\n valType: \"string\",\n dflt: delta.INCREASING.SYMBOL,\n editType: \"plot\"\n },\n color: {\n valType: \"color\",\n dflt: delta.INCREASING.COLOR,\n editType: \"plot\"\n },\n // TODO: add attribute to show sign\n editType: \"plot\"\n },\n decreasing: {\n symbol: {\n valType: \"string\",\n dflt: delta.DECREASING.SYMBOL,\n editType: \"plot\"\n },\n color: {\n valType: \"color\",\n dflt: delta.DECREASING.COLOR,\n editType: \"plot\"\n },\n // TODO: add attribute to hide sign\n editType: \"plot\"\n },\n font: extendFlat({}, textFontAttrs, {}),\n prefix: {\n valType: \"string\",\n dflt: \"\",\n editType: \"plot\"\n },\n suffix: {\n valType: \"string\",\n dflt: \"\",\n editType: \"plot\"\n },\n editType: \"calc\"\n },\n gauge: {\n shape: {\n valType: \"enumerated\",\n editType: \"plot\",\n dflt: \"angular\",\n values: [\"angular\", \"bullet\"]\n },\n bar: extendDeep({}, gaugeBarAttrs, {\n color: { dflt: \"green\" }\n }),\n // Background of the gauge\n bgcolor: {\n valType: \"color\",\n editType: \"plot\"\n },\n bordercolor: {\n valType: \"color\",\n dflt: colorAttrs.defaultLine,\n editType: \"plot\"\n },\n borderwidth: {\n valType: \"number\",\n min: 0,\n dflt: 1,\n editType: \"plot\"\n },\n axis: overrideAll({\n range: rangeAttr,\n visible: extendFlat({}, axesAttrs.visible, {\n dflt: true\n }),\n // tick and title properties named and function exactly as in axes\n tickmode: axesAttrs.minor.tickmode,\n nticks: axesAttrs.nticks,\n tick0: axesAttrs.tick0,\n dtick: axesAttrs.dtick,\n tickvals: axesAttrs.tickvals,\n ticktext: axesAttrs.ticktext,\n ticks: extendFlat({}, axesAttrs.ticks, { dflt: \"outside\" }),\n ticklen: axesAttrs.ticklen,\n tickwidth: axesAttrs.tickwidth,\n tickcolor: axesAttrs.tickcolor,\n ticklabelstep: axesAttrs.ticklabelstep,\n showticklabels: axesAttrs.showticklabels,\n labelalias: axesAttrs.labelalias,\n tickfont: fontAttrs({}),\n tickangle: axesAttrs.tickangle,\n tickformat: axesAttrs.tickformat,\n tickformatstops: axesAttrs.tickformatstops,\n tickprefix: axesAttrs.tickprefix,\n showtickprefix: axesAttrs.showtickprefix,\n ticksuffix: axesAttrs.ticksuffix,\n showticksuffix: axesAttrs.showticksuffix,\n separatethousands: axesAttrs.separatethousands,\n exponentformat: axesAttrs.exponentformat,\n minexponent: axesAttrs.minexponent,\n showexponent: axesAttrs.showexponent,\n editType: \"plot\"\n }, \"plot\"),\n // Steps (or ranges) and thresholds\n steps: stepsAttrs,\n threshold: {\n line: {\n color: extendFlat({}, gaugeBarAttrs.line.color, {}),\n width: extendFlat({}, gaugeBarAttrs.line.width, {\n dflt: 1\n }),\n editType: \"plot\"\n },\n thickness: extendFlat({}, gaugeBarAttrs.thickness, {\n dflt: 0.85\n }),\n value: {\n valType: \"number\",\n editType: \"calc\",\n dflt: false\n },\n editType: \"plot\"\n },\n editType: \"plot\"\n // TODO: in future version, add marker: (bar|needle)\n }\n };\n }\n });\n\n // src/traces/indicator/constants.js\n var require_constants30 = __commonJS({\n \"src/traces/indicator/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n // Defaults for delta\n defaultNumberFontSize: 80,\n bulletNumberDomainSize: 0.25,\n bulletPadding: 0.025,\n innerRadius: 0.75,\n valueThickness: 0.5,\n // thickness of value bars relative to full thickness,\n titlePadding: 5,\n horizontalPadding: 10\n };\n }\n });\n\n // src/traces/indicator/defaults.js\n var require_defaults57 = __commonJS({\n \"src/traces/indicator/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var attributes = require_attributes61();\n var handleDomainDefaults = require_domain().defaults;\n var Template = require_plot_template();\n var handleArrayContainerDefaults = require_array_container_defaults();\n var cn = require_constants30();\n var handleTickValueDefaults = require_tick_value_defaults();\n var handleTickMarkDefaults = require_tick_mark_defaults();\n var handleTickLabelDefaults = require_tick_label_defaults();\n var handlePrefixSuffixDefaults = require_prefix_suffix_defaults();\n function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n handleDomainDefaults(traceOut, layout, coerce);\n coerce(\"mode\");\n traceOut._hasNumber = traceOut.mode.indexOf(\"number\") !== -1;\n traceOut._hasDelta = traceOut.mode.indexOf(\"delta\") !== -1;\n traceOut._hasGauge = traceOut.mode.indexOf(\"gauge\") !== -1;\n var value = coerce(\"value\");\n traceOut._range = [0, typeof value === \"number\" ? 1.5 * value : 1];\n var auto = new Array(2);\n var bignumberFontSize;\n if (traceOut._hasNumber) {\n coerce(\"number.valueformat\");\n var numberFontDflt = Lib.extendFlat({}, layout.font);\n numberFontDflt.size = void 0;\n Lib.coerceFont(coerce, \"number.font\", numberFontDflt);\n if (traceOut.number.font.size === void 0) {\n traceOut.number.font.size = cn.defaultNumberFontSize;\n auto[0] = true;\n }\n coerce(\"number.prefix\");\n coerce(\"number.suffix\");\n bignumberFontSize = traceOut.number.font.size;\n }\n var deltaFontSize;\n if (traceOut._hasDelta) {\n var deltaFontDflt = Lib.extendFlat({}, layout.font);\n deltaFontDflt.size = void 0;\n Lib.coerceFont(coerce, \"delta.font\", deltaFontDflt);\n if (traceOut.delta.font.size === void 0) {\n traceOut.delta.font.size = (traceOut._hasNumber ? 0.5 : 1) * (bignumberFontSize || cn.defaultNumberFontSize);\n auto[1] = true;\n }\n coerce(\"delta.reference\", traceOut.value);\n coerce(\"delta.relative\");\n coerce(\"delta.valueformat\", traceOut.delta.relative ? \"2%\" : \"\");\n coerce(\"delta.increasing.symbol\");\n coerce(\"delta.increasing.color\");\n coerce(\"delta.decreasing.symbol\");\n coerce(\"delta.decreasing.color\");\n coerce(\"delta.position\");\n coerce(\"delta.prefix\");\n coerce(\"delta.suffix\");\n deltaFontSize = traceOut.delta.font.size;\n }\n traceOut._scaleNumbers = (!traceOut._hasNumber || auto[0]) && (!traceOut._hasDelta || auto[1]) || false;\n var titleFontDflt = Lib.extendFlat({}, layout.font);\n titleFontDflt.size = 0.25 * (bignumberFontSize || deltaFontSize || cn.defaultNumberFontSize);\n Lib.coerceFont(coerce, \"title.font\", titleFontDflt);\n coerce(\"title.text\");\n var gaugeIn, gaugeOut, axisIn, axisOut;\n function coerceGauge(attr, dflt) {\n return Lib.coerce(gaugeIn, gaugeOut, attributes.gauge, attr, dflt);\n }\n function coerceGaugeAxis(attr, dflt) {\n return Lib.coerce(axisIn, axisOut, attributes.gauge.axis, attr, dflt);\n }\n if (traceOut._hasGauge) {\n gaugeIn = traceIn.gauge;\n if (!gaugeIn) gaugeIn = {};\n gaugeOut = Template.newContainer(traceOut, \"gauge\");\n coerceGauge(\"shape\");\n var isBullet = traceOut._isBullet = traceOut.gauge.shape === \"bullet\";\n if (!isBullet) {\n coerce(\"title.align\", \"center\");\n }\n var isAngular = traceOut._isAngular = traceOut.gauge.shape === \"angular\";\n if (!isAngular) {\n coerce(\"align\", \"center\");\n }\n coerceGauge(\"bgcolor\", layout.paper_bgcolor);\n coerceGauge(\"borderwidth\");\n coerceGauge(\"bordercolor\");\n coerceGauge(\"bar.color\");\n coerceGauge(\"bar.line.color\");\n coerceGauge(\"bar.line.width\");\n var defaultBarThickness = cn.valueThickness * (traceOut.gauge.shape === \"bullet\" ? 0.5 : 1);\n coerceGauge(\"bar.thickness\", defaultBarThickness);\n handleArrayContainerDefaults(gaugeIn, gaugeOut, {\n name: \"steps\",\n handleItemDefaults: stepDefaults\n });\n coerceGauge(\"threshold.value\");\n coerceGauge(\"threshold.thickness\");\n coerceGauge(\"threshold.line.width\");\n coerceGauge(\"threshold.line.color\");\n axisIn = {};\n if (gaugeIn) axisIn = gaugeIn.axis || {};\n axisOut = Template.newContainer(gaugeOut, \"axis\");\n coerceGaugeAxis(\"visible\");\n traceOut._range = coerceGaugeAxis(\"range\", traceOut._range);\n var opts = {\n font: layout.font,\n noAutotickangles: true,\n outerTicks: true,\n noTicklabelshift: true,\n noTicklabelstandoff: true\n };\n handleTickValueDefaults(axisIn, axisOut, coerceGaugeAxis, \"linear\");\n handlePrefixSuffixDefaults(axisIn, axisOut, coerceGaugeAxis, \"linear\", opts);\n handleTickLabelDefaults(axisIn, axisOut, coerceGaugeAxis, \"linear\", opts);\n handleTickMarkDefaults(axisIn, axisOut, coerceGaugeAxis, opts);\n } else {\n coerce(\"title.align\", \"center\");\n coerce(\"align\", \"center\");\n traceOut._isAngular = traceOut._isBullet = false;\n }\n traceOut._length = null;\n }\n function stepDefaults(stepIn, stepOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(stepIn, stepOut, attributes.gauge.steps, attr, dflt);\n }\n coerce(\"color\");\n coerce(\"line.color\");\n coerce(\"line.width\");\n coerce(\"range\");\n coerce(\"thickness\");\n }\n module.exports = {\n supplyDefaults\n };\n }\n });\n\n // src/traces/indicator/calc.js\n var require_calc36 = __commonJS({\n \"src/traces/indicator/calc.js\"(exports, module) {\n \"use strict\";\n function calc(gd, trace) {\n var cd = [];\n var lastReading = trace.value;\n if (!(typeof trace._lastValue === \"number\")) trace._lastValue = trace.value;\n var secondLastReading = trace._lastValue;\n var deltaRef = secondLastReading;\n if (trace._hasDelta && typeof trace.delta.reference === \"number\") {\n deltaRef = trace.delta.reference;\n }\n cd[0] = {\n y: lastReading,\n lastY: secondLastReading,\n delta: lastReading - deltaRef,\n relativeDelta: (lastReading - deltaRef) / deltaRef\n };\n return cd;\n }\n module.exports = {\n calc\n };\n }\n });\n\n // src/traces/indicator/plot.js\n var require_plot30 = __commonJS({\n \"src/traces/indicator/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var interpolate = (init_src2(), __toCommonJS(src_exports)).interpolate;\n var interpolateNumber = (init_src2(), __toCommonJS(src_exports)).interpolateNumber;\n var Lib = require_lib();\n var strScale = Lib.strScale;\n var strTranslate = Lib.strTranslate;\n var rad2deg = Lib.rad2deg;\n var MID_SHIFT = require_alignment().MID_SHIFT;\n var Drawing = require_drawing();\n var cn = require_constants30();\n var svgTextUtils = require_svg_text_utils();\n var Axes = require_axes();\n var handleAxisDefaults = require_axis_defaults();\n var handleAxisPositionDefaults = require_position_defaults();\n var axisLayoutAttrs = require_layout_attributes4();\n var Color2 = require_color();\n var anchor = {\n left: \"start\",\n center: \"middle\",\n right: \"end\"\n };\n var position = {\n left: 0,\n center: 0.5,\n right: 1\n };\n var SI_PREFIX = /[yzafpn\u00B5mkMGTPEZY]/;\n function hasTransition(transitionOpts) {\n return transitionOpts && transitionOpts.duration > 0;\n }\n module.exports = function plot(gd, cdModule, transitionOpts, makeOnCompleteCallback) {\n var fullLayout = gd._fullLayout;\n var onComplete;\n if (hasTransition(transitionOpts)) {\n if (makeOnCompleteCallback) {\n onComplete = makeOnCompleteCallback();\n }\n }\n Lib.makeTraceGroups(fullLayout._indicatorlayer, cdModule, \"trace\").each(function(cd) {\n var cd0 = cd[0];\n var trace = cd0.trace;\n var plotGroup = d3.select(this);\n var hasGauge = trace._hasGauge;\n var isAngular = trace._isAngular;\n var isBullet = trace._isBullet;\n var domain = trace.domain;\n var size = {\n w: fullLayout._size.w * (domain.x[1] - domain.x[0]),\n h: fullLayout._size.h * (domain.y[1] - domain.y[0]),\n l: fullLayout._size.l + fullLayout._size.w * domain.x[0],\n r: fullLayout._size.r + fullLayout._size.w * (1 - domain.x[1]),\n t: fullLayout._size.t + fullLayout._size.h * (1 - domain.y[1]),\n b: fullLayout._size.b + fullLayout._size.h * domain.y[0]\n };\n var centerX = size.l + size.w / 2;\n var centerY = size.t + size.h / 2;\n var radius = Math.min(size.w / 2, size.h);\n var innerRadius = cn.innerRadius * radius;\n var numbersX, numbersY, numbersScaler;\n var numbersAlign = trace.align || \"center\";\n numbersY = centerY;\n if (!hasGauge) {\n numbersX = size.l + position[numbersAlign] * size.w;\n numbersScaler = function(el) {\n return fitTextInsideBox(el, size.w, size.h);\n };\n } else {\n if (isAngular) {\n numbersX = centerX;\n numbersY = centerY + radius / 2;\n numbersScaler = function(el) {\n return fitTextInsideCircle(el, 0.9 * innerRadius);\n };\n }\n if (isBullet) {\n var padding = cn.bulletPadding;\n var p = 1 - cn.bulletNumberDomainSize + padding;\n numbersX = size.l + (p + (1 - p) * position[numbersAlign]) * size.w;\n numbersScaler = function(el) {\n return fitTextInsideBox(el, (cn.bulletNumberDomainSize - padding) * size.w, size.h);\n };\n }\n }\n drawNumbers(gd, plotGroup, cd, {\n numbersX,\n numbersY,\n numbersScaler,\n transitionOpts,\n onComplete\n });\n var gaugeBg, gaugeOutline;\n if (hasGauge) {\n gaugeBg = {\n range: trace.gauge.axis.range,\n color: trace.gauge.bgcolor,\n line: {\n color: trace.gauge.bordercolor,\n width: 0\n },\n thickness: 1\n };\n gaugeOutline = {\n range: trace.gauge.axis.range,\n color: \"rgba(0, 0, 0, 0)\",\n line: {\n color: trace.gauge.bordercolor,\n width: trace.gauge.borderwidth\n },\n thickness: 1\n };\n }\n var angularGauge = plotGroup.selectAll(\"g.angular\").data(isAngular ? cd : []);\n angularGauge.exit().remove();\n var angularaxisLayer = plotGroup.selectAll(\"g.angularaxis\").data(isAngular ? cd : []);\n angularaxisLayer.exit().remove();\n if (isAngular) {\n drawAngularGauge(gd, plotGroup, cd, {\n radius,\n innerRadius,\n gauge: angularGauge,\n layer: angularaxisLayer,\n size,\n gaugeBg,\n gaugeOutline,\n transitionOpts,\n onComplete\n });\n }\n var bulletGauge = plotGroup.selectAll(\"g.bullet\").data(isBullet ? cd : []);\n bulletGauge.exit().remove();\n var bulletaxisLayer = plotGroup.selectAll(\"g.bulletaxis\").data(isBullet ? cd : []);\n bulletaxisLayer.exit().remove();\n if (isBullet) {\n drawBulletGauge(gd, plotGroup, cd, {\n gauge: bulletGauge,\n layer: bulletaxisLayer,\n size,\n gaugeBg,\n gaugeOutline,\n transitionOpts,\n onComplete\n });\n }\n var title = plotGroup.selectAll(\"text.title\").data(cd);\n title.exit().remove();\n title.enter().append(\"text\").classed(\"title\", true);\n title.attr(\"text-anchor\", function() {\n return isBullet ? anchor.right : anchor[trace.title.align];\n }).text(trace.title.text).call(Drawing.font, trace.title.font).call(svgTextUtils.convertToTspans, gd);\n title.attr(\"transform\", function() {\n var titleX = size.l + size.w * position[trace.title.align];\n var titleY;\n var titlePadding = cn.titlePadding;\n var titlebBox = Drawing.bBox(title.node());\n if (hasGauge) {\n if (isAngular) {\n if (trace.gauge.axis.visible) {\n var bBox = Drawing.bBox(angularaxisLayer.node());\n titleY = bBox.top - titlePadding - titlebBox.bottom;\n } else {\n titleY = size.t + size.h / 2 - radius / 2 - titlebBox.bottom - titlePadding;\n }\n }\n if (isBullet) {\n titleY = numbersY - (titlebBox.top + titlebBox.bottom) / 2;\n titleX = size.l - cn.bulletPadding * size.w;\n }\n } else {\n titleY = trace._numbersTop - titlePadding - titlebBox.bottom;\n }\n return strTranslate(titleX, titleY);\n });\n });\n };\n function drawBulletGauge(gd, plotGroup, cd, opts) {\n var trace = cd[0].trace;\n var bullet = opts.gauge;\n var axisLayer = opts.layer;\n var gaugeBg = opts.gaugeBg;\n var gaugeOutline = opts.gaugeOutline;\n var size = opts.size;\n var domain = trace.domain;\n var transitionOpts = opts.transitionOpts;\n var onComplete = opts.onComplete;\n var ax, vals, transFn, tickSign, shift;\n bullet.enter().append(\"g\").classed(\"bullet\", true);\n bullet.attr(\"transform\", strTranslate(size.l, size.t));\n axisLayer.enter().append(\"g\").classed(\"bulletaxis\", true).classed(\"crisp\", true);\n axisLayer.selectAll(\"g.xbulletaxistick,path,text\").remove();\n var bulletHeight = size.h;\n var innerBulletHeight = trace.gauge.bar.thickness * bulletHeight;\n var bulletLeft = domain.x[0];\n var bulletRight = domain.x[0] + (domain.x[1] - domain.x[0]) * (trace._hasNumber || trace._hasDelta ? 1 - cn.bulletNumberDomainSize : 1);\n ax = mockAxis(gd, trace.gauge.axis);\n ax._id = \"xbulletaxis\";\n ax.domain = [bulletLeft, bulletRight];\n ax.setScale();\n vals = Axes.calcTicks(ax);\n transFn = Axes.makeTransTickFn(ax);\n tickSign = Axes.getTickSigns(ax)[2];\n shift = size.t + size.h;\n if (ax.visible) {\n Axes.drawTicks(gd, ax, {\n vals: ax.ticks === \"inside\" ? Axes.clipEnds(ax, vals) : vals,\n layer: axisLayer,\n path: Axes.makeTickPath(ax, shift, tickSign),\n transFn\n });\n Axes.drawLabels(gd, ax, {\n vals,\n layer: axisLayer,\n transFn,\n labelFns: Axes.makeLabelFns(ax, shift)\n });\n }\n function drawRect(s) {\n s.attr(\"width\", function(d) {\n return Math.max(0, ax.c2p(d.range[1]) - ax.c2p(d.range[0]));\n }).attr(\"x\", function(d) {\n return ax.c2p(d.range[0]);\n }).attr(\"y\", function(d) {\n return 0.5 * (1 - d.thickness) * bulletHeight;\n }).attr(\"height\", function(d) {\n return d.thickness * bulletHeight;\n });\n }\n var boxes = [gaugeBg].concat(trace.gauge.steps);\n var bgBullet = bullet.selectAll(\"g.bg-bullet\").data(boxes);\n bgBullet.enter().append(\"g\").classed(\"bg-bullet\", true).append(\"rect\");\n bgBullet.select(\"rect\").call(drawRect).call(styleShape);\n bgBullet.exit().remove();\n var fgBullet = bullet.selectAll(\"g.value-bullet\").data([trace.gauge.bar]);\n fgBullet.enter().append(\"g\").classed(\"value-bullet\", true).append(\"rect\");\n fgBullet.select(\"rect\").attr(\"height\", innerBulletHeight).attr(\"y\", (bulletHeight - innerBulletHeight) / 2).call(styleShape);\n if (hasTransition(transitionOpts)) {\n fgBullet.select(\"rect\").transition().duration(transitionOpts.duration).ease(transitionOpts.easing).each(\"end\", function() {\n onComplete && onComplete();\n }).each(\"interrupt\", function() {\n onComplete && onComplete();\n }).attr(\"width\", Math.max(0, ax.c2p(Math.min(trace.gauge.axis.range[1], cd[0].y))));\n } else {\n fgBullet.select(\"rect\").attr(\"width\", typeof cd[0].y === \"number\" ? Math.max(0, ax.c2p(Math.min(trace.gauge.axis.range[1], cd[0].y))) : 0);\n }\n fgBullet.exit().remove();\n var data = cd.filter(function() {\n return trace.gauge.threshold.value || trace.gauge.threshold.value === 0;\n });\n var threshold = bullet.selectAll(\"g.threshold-bullet\").data(data);\n threshold.enter().append(\"g\").classed(\"threshold-bullet\", true).append(\"line\");\n threshold.select(\"line\").attr(\"x1\", ax.c2p(trace.gauge.threshold.value)).attr(\"x2\", ax.c2p(trace.gauge.threshold.value)).attr(\"y1\", (1 - trace.gauge.threshold.thickness) / 2 * bulletHeight).attr(\"y2\", (1 - (1 - trace.gauge.threshold.thickness) / 2) * bulletHeight).call(Color2.stroke, trace.gauge.threshold.line.color).style(\"stroke-width\", trace.gauge.threshold.line.width);\n threshold.exit().remove();\n var bulletOutline = bullet.selectAll(\"g.gauge-outline\").data([gaugeOutline]);\n bulletOutline.enter().append(\"g\").classed(\"gauge-outline\", true).append(\"rect\");\n bulletOutline.select(\"rect\").call(drawRect).call(styleShape);\n bulletOutline.exit().remove();\n }\n function drawAngularGauge(gd, plotGroup, cd, opts) {\n var trace = cd[0].trace;\n var size = opts.size;\n var radius = opts.radius;\n var innerRadius = opts.innerRadius;\n var gaugeBg = opts.gaugeBg;\n var gaugeOutline = opts.gaugeOutline;\n var gaugePosition = [size.l + size.w / 2, size.t + size.h / 2 + radius / 2];\n var gauge = opts.gauge;\n var axisLayer = opts.layer;\n var transitionOpts = opts.transitionOpts;\n var onComplete = opts.onComplete;\n var theta = Math.PI / 2;\n function valueToAngle(v2) {\n var min = trace.gauge.axis.range[0];\n var max = trace.gauge.axis.range[1];\n var angle = (v2 - min) / (max - min) * Math.PI - theta;\n if (angle < -theta) return -theta;\n if (angle > theta) return theta;\n return angle;\n }\n function arcPathGenerator(size2) {\n return d3.svg.arc().innerRadius((innerRadius + radius) / 2 - size2 / 2 * (radius - innerRadius)).outerRadius((innerRadius + radius) / 2 + size2 / 2 * (radius - innerRadius)).startAngle(-theta);\n }\n function drawArc(p) {\n p.attr(\"d\", function(d) {\n return arcPathGenerator(d.thickness).startAngle(valueToAngle(d.range[0])).endAngle(valueToAngle(d.range[1]))();\n });\n }\n var ax, vals, transFn, tickSign;\n gauge.enter().append(\"g\").classed(\"angular\", true);\n gauge.attr(\"transform\", strTranslate(gaugePosition[0], gaugePosition[1]));\n axisLayer.enter().append(\"g\").classed(\"angularaxis\", true).classed(\"crisp\", true);\n axisLayer.selectAll(\"g.xangularaxistick,path,text\").remove();\n ax = mockAxis(gd, trace.gauge.axis);\n ax.type = \"linear\";\n ax.range = trace.gauge.axis.range;\n ax._id = \"xangularaxis\";\n ax.ticklabeloverflow = \"allow\";\n ax.setScale();\n var t2g = function(d) {\n return (ax.range[0] - d.x) / (ax.range[1] - ax.range[0]) * Math.PI + Math.PI;\n };\n var labelFns = {};\n var out = Axes.makeLabelFns(ax, 0);\n var labelStandoff = out.labelStandoff;\n labelFns.xFn = function(d) {\n var rad = t2g(d);\n return Math.cos(rad) * labelStandoff;\n };\n labelFns.yFn = function(d) {\n var rad = t2g(d);\n var ff = Math.sin(rad) > 0 ? 0.2 : 1;\n return -Math.sin(rad) * (labelStandoff + d.fontSize * ff) + Math.abs(Math.cos(rad)) * (d.fontSize * MID_SHIFT);\n };\n labelFns.anchorFn = function(d) {\n var rad = t2g(d);\n var cos = Math.cos(rad);\n return Math.abs(cos) < 0.1 ? \"middle\" : cos > 0 ? \"start\" : \"end\";\n };\n labelFns.heightFn = function(d, a, h) {\n var rad = t2g(d);\n return -0.5 * (1 + Math.sin(rad)) * h;\n };\n var _transFn = function(rad) {\n return strTranslate(\n gaugePosition[0] + radius * Math.cos(rad),\n gaugePosition[1] - radius * Math.sin(rad)\n );\n };\n transFn = function(d) {\n return _transFn(t2g(d));\n };\n var transFn2 = function(d) {\n var rad = t2g(d);\n return _transFn(rad) + \"rotate(\" + -rad2deg(rad) + \")\";\n };\n vals = Axes.calcTicks(ax);\n tickSign = Axes.getTickSigns(ax)[2];\n if (ax.visible) {\n tickSign = ax.ticks === \"inside\" ? -1 : 1;\n var pad = (ax.linewidth || 1) / 2;\n Axes.drawTicks(gd, ax, {\n vals,\n layer: axisLayer,\n path: \"M\" + tickSign * pad + \",0h\" + tickSign * ax.ticklen,\n transFn: transFn2\n });\n Axes.drawLabels(gd, ax, {\n vals,\n layer: axisLayer,\n transFn,\n labelFns\n });\n }\n var arcs = [gaugeBg].concat(trace.gauge.steps);\n var bgArc = gauge.selectAll(\"g.bg-arc\").data(arcs);\n bgArc.enter().append(\"g\").classed(\"bg-arc\", true).append(\"path\");\n bgArc.select(\"path\").call(drawArc).call(styleShape);\n bgArc.exit().remove();\n var valueArcPathGenerator = arcPathGenerator(trace.gauge.bar.thickness);\n var valueArc = gauge.selectAll(\"g.value-arc\").data([trace.gauge.bar]);\n valueArc.enter().append(\"g\").classed(\"value-arc\", true).append(\"path\");\n var valueArcPath = valueArc.select(\"path\");\n if (hasTransition(transitionOpts)) {\n valueArcPath.transition().duration(transitionOpts.duration).ease(transitionOpts.easing).each(\"end\", function() {\n onComplete && onComplete();\n }).each(\"interrupt\", function() {\n onComplete && onComplete();\n }).attrTween(\"d\", arcTween(valueArcPathGenerator, valueToAngle(cd[0].lastY), valueToAngle(cd[0].y)));\n trace._lastValue = cd[0].y;\n } else {\n valueArcPath.attr(\"d\", typeof cd[0].y === \"number\" ? valueArcPathGenerator.endAngle(valueToAngle(cd[0].y)) : \"M0,0Z\");\n }\n valueArcPath.call(styleShape);\n valueArc.exit().remove();\n arcs = [];\n var v = trace.gauge.threshold.value;\n if (v || v === 0) {\n arcs.push({\n range: [v, v],\n color: trace.gauge.threshold.color,\n line: {\n color: trace.gauge.threshold.line.color,\n width: trace.gauge.threshold.line.width\n },\n thickness: trace.gauge.threshold.thickness\n });\n }\n var thresholdArc = gauge.selectAll(\"g.threshold-arc\").data(arcs);\n thresholdArc.enter().append(\"g\").classed(\"threshold-arc\", true).append(\"path\");\n thresholdArc.select(\"path\").call(drawArc).call(styleShape);\n thresholdArc.exit().remove();\n var gaugeBorder = gauge.selectAll(\"g.gauge-outline\").data([gaugeOutline]);\n gaugeBorder.enter().append(\"g\").classed(\"gauge-outline\", true).append(\"path\");\n gaugeBorder.select(\"path\").call(drawArc).call(styleShape);\n gaugeBorder.exit().remove();\n }\n function drawNumbers(gd, plotGroup, cd, opts) {\n var trace = cd[0].trace;\n var numbersX = opts.numbersX;\n var numbersY = opts.numbersY;\n var numbersAlign = trace.align || \"center\";\n var numbersAnchor = anchor[numbersAlign];\n var transitionOpts = opts.transitionOpts;\n var onComplete = opts.onComplete;\n var numbers = Lib.ensureSingle(plotGroup, \"g\", \"numbers\");\n var bignumberbBox, deltabBox;\n var numbersbBox;\n var data = [];\n if (trace._hasNumber) data.push(\"number\");\n if (trace._hasDelta) {\n data.push(\"delta\");\n if (trace.delta.position === \"left\") data.reverse();\n }\n var sel = numbers.selectAll(\"text\").data(data);\n sel.enter().append(\"text\");\n sel.attr(\"text-anchor\", function() {\n return numbersAnchor;\n }).attr(\"class\", function(d) {\n return d;\n }).attr(\"x\", null).attr(\"y\", null).attr(\"dx\", null).attr(\"dy\", null);\n sel.exit().remove();\n function transitionFormat(valueformat, fmt, from, to) {\n if (valueformat.match(\"s\") && // If using SI prefix\n from >= 0 !== to >= 0 && // If sign change\n (!fmt(from).slice(-1).match(SI_PREFIX) && !fmt(to).slice(-1).match(SI_PREFIX))) {\n var transitionValueFormat = valueformat.slice().replace(\"s\", \"f\").replace(/\\d+/, function(m) {\n return parseInt(m) - 1;\n });\n var transitionAx = mockAxis(gd, { tickformat: transitionValueFormat });\n return function(v) {\n if (Math.abs(v) < 1) return Axes.tickText(transitionAx, v).text;\n return fmt(v);\n };\n } else {\n return fmt;\n }\n }\n function drawBignumber() {\n var bignumberAx = mockAxis(gd, { tickformat: trace.number.valueformat }, trace._range);\n bignumberAx.setScale();\n Axes.prepTicks(bignumberAx);\n var bignumberFmt = function(v) {\n return Axes.tickText(bignumberAx, v).text;\n };\n var bignumberSuffix = trace.number.suffix;\n var bignumberPrefix = trace.number.prefix;\n var number = numbers.select(\"text.number\");\n function writeNumber() {\n var txt = typeof cd[0].y === \"number\" ? bignumberPrefix + bignumberFmt(cd[0].y) + bignumberSuffix : \"-\";\n number.text(txt).call(Drawing.font, trace.number.font).call(svgTextUtils.convertToTspans, gd);\n }\n if (hasTransition(transitionOpts)) {\n number.transition().duration(transitionOpts.duration).ease(transitionOpts.easing).each(\"end\", function() {\n writeNumber();\n onComplete && onComplete();\n }).each(\"interrupt\", function() {\n writeNumber();\n onComplete && onComplete();\n }).attrTween(\"text\", function() {\n var that = d3.select(this);\n var interpolator = interpolateNumber(cd[0].lastY, cd[0].y);\n trace._lastValue = cd[0].y;\n var transitionFmt = transitionFormat(trace.number.valueformat, bignumberFmt, cd[0].lastY, cd[0].y);\n return function(t) {\n that.text(bignumberPrefix + transitionFmt(interpolator(t)) + bignumberSuffix);\n };\n });\n } else {\n writeNumber();\n }\n bignumberbBox = measureText(bignumberPrefix + bignumberFmt(cd[0].y) + bignumberSuffix, trace.number.font, numbersAnchor, gd);\n return number;\n }\n function drawDelta() {\n var deltaAx = mockAxis(gd, { tickformat: trace.delta.valueformat }, trace._range);\n deltaAx.setScale();\n Axes.prepTicks(deltaAx);\n var deltaFmt = function(v) {\n return Axes.tickText(deltaAx, v).text;\n };\n var deltaSuffix = trace.delta.suffix;\n var deltaPrefix = trace.delta.prefix;\n var deltaValue = function(d) {\n var value = trace.delta.relative ? d.relativeDelta : d.delta;\n return value;\n };\n var deltaFormatText = function(value, numberFmt) {\n if (value === 0 || typeof value !== \"number\" || isNaN(value)) return \"-\";\n return (value > 0 ? trace.delta.increasing.symbol : trace.delta.decreasing.symbol) + deltaPrefix + numberFmt(value) + deltaSuffix;\n };\n var deltaFill = function(d) {\n return d.delta >= 0 ? trace.delta.increasing.color : trace.delta.decreasing.color;\n };\n if (trace._deltaLastValue === void 0) {\n trace._deltaLastValue = deltaValue(cd[0]);\n }\n var delta2 = numbers.select(\"text.delta\");\n delta2.call(Drawing.font, trace.delta.font).call(Color2.fill, deltaFill({ delta: trace._deltaLastValue }));\n function writeDelta() {\n delta2.text(deltaFormatText(deltaValue(cd[0]), deltaFmt)).call(Color2.fill, deltaFill(cd[0])).call(svgTextUtils.convertToTspans, gd);\n }\n if (hasTransition(transitionOpts)) {\n delta2.transition().duration(transitionOpts.duration).ease(transitionOpts.easing).tween(\"text\", function() {\n var that = d3.select(this);\n var to = deltaValue(cd[0]);\n var from = trace._deltaLastValue;\n var transitionFmt = transitionFormat(trace.delta.valueformat, deltaFmt, from, to);\n var interpolator = interpolateNumber(from, to);\n trace._deltaLastValue = to;\n return function(t) {\n that.text(deltaFormatText(interpolator(t), transitionFmt));\n that.call(Color2.fill, deltaFill({ delta: interpolator(t) }));\n };\n }).each(\"end\", function() {\n writeDelta();\n onComplete && onComplete();\n }).each(\"interrupt\", function() {\n writeDelta();\n onComplete && onComplete();\n });\n } else {\n writeDelta();\n }\n deltabBox = measureText(deltaFormatText(deltaValue(cd[0]), deltaFmt), trace.delta.font, numbersAnchor, gd);\n return delta2;\n }\n var key = trace.mode + trace.align;\n var delta;\n if (trace._hasDelta) {\n delta = drawDelta();\n key += trace.delta.position + trace.delta.font.size + trace.delta.font.family + trace.delta.valueformat;\n key += trace.delta.increasing.symbol + trace.delta.decreasing.symbol;\n numbersbBox = deltabBox;\n }\n if (trace._hasNumber) {\n drawBignumber();\n key += trace.number.font.size + trace.number.font.family + trace.number.valueformat + trace.number.suffix + trace.number.prefix;\n numbersbBox = bignumberbBox;\n }\n if (trace._hasDelta && trace._hasNumber) {\n var bignumberCenter = [\n (bignumberbBox.left + bignumberbBox.right) / 2,\n (bignumberbBox.top + bignumberbBox.bottom) / 2\n ];\n var deltaCenter = [\n (deltabBox.left + deltabBox.right) / 2,\n (deltabBox.top + deltabBox.bottom) / 2\n ];\n var dx, dy;\n var padding = 0.75 * trace.delta.font.size;\n if (trace.delta.position === \"left\") {\n dx = cache(trace, \"deltaPos\", 0, -1 * (bignumberbBox.width * position[trace.align] + deltabBox.width * (1 - position[trace.align]) + padding), key, Math.min);\n dy = bignumberCenter[1] - deltaCenter[1];\n numbersbBox = {\n width: bignumberbBox.width + deltabBox.width + padding,\n height: Math.max(bignumberbBox.height, deltabBox.height),\n left: deltabBox.left + dx,\n right: bignumberbBox.right,\n top: Math.min(bignumberbBox.top, deltabBox.top + dy),\n bottom: Math.max(bignumberbBox.bottom, deltabBox.bottom + dy)\n };\n }\n if (trace.delta.position === \"right\") {\n dx = cache(trace, \"deltaPos\", 0, bignumberbBox.width * (1 - position[trace.align]) + deltabBox.width * position[trace.align] + padding, key, Math.max);\n dy = bignumberCenter[1] - deltaCenter[1];\n numbersbBox = {\n width: bignumberbBox.width + deltabBox.width + padding,\n height: Math.max(bignumberbBox.height, deltabBox.height),\n left: bignumberbBox.left,\n right: deltabBox.right + dx,\n top: Math.min(bignumberbBox.top, deltabBox.top + dy),\n bottom: Math.max(bignumberbBox.bottom, deltabBox.bottom + dy)\n };\n }\n if (trace.delta.position === \"bottom\") {\n dx = null;\n dy = deltabBox.height;\n numbersbBox = {\n width: Math.max(bignumberbBox.width, deltabBox.width),\n height: bignumberbBox.height + deltabBox.height,\n left: Math.min(bignumberbBox.left, deltabBox.left),\n right: Math.max(bignumberbBox.right, deltabBox.right),\n top: bignumberbBox.bottom - bignumberbBox.height,\n bottom: bignumberbBox.bottom + deltabBox.height\n };\n }\n if (trace.delta.position === \"top\") {\n dx = null;\n dy = bignumberbBox.top;\n numbersbBox = {\n width: Math.max(bignumberbBox.width, deltabBox.width),\n height: bignumberbBox.height + deltabBox.height,\n left: Math.min(bignumberbBox.left, deltabBox.left),\n right: Math.max(bignumberbBox.right, deltabBox.right),\n top: bignumberbBox.bottom - bignumberbBox.height - deltabBox.height,\n bottom: bignumberbBox.bottom\n };\n }\n delta.attr({ dx, dy });\n }\n if (trace._hasNumber || trace._hasDelta) {\n numbers.attr(\"transform\", function() {\n var m = opts.numbersScaler(numbersbBox);\n key += m[2];\n var scaleRatio = cache(trace, \"numbersScale\", 1, m[0], key, Math.min);\n var translateY;\n if (!trace._scaleNumbers) scaleRatio = 1;\n if (trace._isAngular) {\n translateY = numbersY - scaleRatio * numbersbBox.bottom;\n } else {\n translateY = numbersY - scaleRatio * (numbersbBox.top + numbersbBox.bottom) / 2;\n }\n trace._numbersTop = scaleRatio * numbersbBox.top + translateY;\n var ref = numbersbBox[numbersAlign];\n if (numbersAlign === \"center\") ref = (numbersbBox.left + numbersbBox.right) / 2;\n var translateX = numbersX - scaleRatio * ref;\n translateX = cache(trace, \"numbersTranslate\", 0, translateX, key, Math.max);\n return strTranslate(translateX, translateY) + strScale(scaleRatio);\n });\n }\n }\n function styleShape(p) {\n p.each(function(d) {\n Color2.stroke(d3.select(this), d.line.color);\n }).each(function(d) {\n Color2.fill(d3.select(this), d.color);\n }).style(\"stroke-width\", function(d) {\n return d.line.width;\n });\n }\n function arcTween(arc, endAngle, newAngle) {\n return function() {\n var interp = interpolate(endAngle, newAngle);\n return function(t) {\n return arc.endAngle(interp(t))();\n };\n };\n }\n function mockAxis(gd, opts, zrange) {\n var fullLayout = gd._fullLayout;\n var axisIn = Lib.extendFlat({\n type: \"linear\",\n ticks: \"outside\",\n range: zrange,\n showline: true\n }, opts);\n var axisOut = {\n type: \"linear\",\n _id: \"x\" + opts._id\n };\n var axisOptions = {\n letter: \"x\",\n font: fullLayout.font,\n noAutotickangles: true,\n noHover: true,\n noTickson: true\n };\n function coerce(attr, dflt) {\n return Lib.coerce(axisIn, axisOut, axisLayoutAttrs, attr, dflt);\n }\n handleAxisDefaults(axisIn, axisOut, coerce, axisOptions, fullLayout);\n handleAxisPositionDefaults(axisIn, axisOut, coerce, axisOptions);\n return axisOut;\n }\n function fitTextInsideBox(textBB, width, height) {\n var ratio = Math.min(width / textBB.width, height / textBB.height);\n return [ratio, textBB, width + \"x\" + height];\n }\n function fitTextInsideCircle(textBB, radius) {\n var elRadius = Math.sqrt(textBB.width / 2 * (textBB.width / 2) + textBB.height * textBB.height);\n var ratio = radius / elRadius;\n return [ratio, textBB, radius];\n }\n function measureText(txt, font, textAnchor, gd) {\n var element = document.createElementNS(\"http://www.w3.org/2000/svg\", \"text\");\n var sel = d3.select(element);\n sel.text(txt).attr(\"x\", 0).attr(\"y\", 0).attr(\"text-anchor\", textAnchor).attr(\"data-unformatted\", txt).call(svgTextUtils.convertToTspans, gd).call(Drawing.font, font);\n return Drawing.bBox(sel.node());\n }\n function cache(trace, name2, initialValue, value, key, fn) {\n var objName = \"_cache\" + name2;\n if (!(trace[objName] && trace[objName].key === key)) {\n trace[objName] = { key, value: initialValue };\n }\n var v = Lib.aggNums(fn, null, [trace[objName].value, value], 2);\n trace[objName].value = v;\n return v;\n }\n }\n });\n\n // src/traces/indicator/index.js\n var require_indicator = __commonJS({\n \"src/traces/indicator/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"trace\",\n name: \"indicator\",\n basePlotModule: require_base_plot10(),\n categories: [\"svg\", \"noOpacity\", \"noHover\"],\n animatable: true,\n attributes: require_attributes61(),\n supplyDefaults: require_defaults57().supplyDefaults,\n calc: require_calc36().calc,\n plot: require_plot30(),\n meta: {}\n };\n }\n });\n\n // lib/indicator.js\n var require_indicator2 = __commonJS({\n \"lib/indicator.js\"(exports, module) {\n \"use strict\";\n module.exports = require_indicator();\n }\n });\n\n // src/traces/table/attributes.js\n var require_attributes62 = __commonJS({\n \"src/traces/table/attributes.js\"(exports, module) {\n \"use strict\";\n var annAttrs = require_attributes11();\n var extendFlat = require_extend().extendFlat;\n var overrideAll = require_edit_types().overrideAll;\n var fontAttrs = require_font_attributes();\n var domainAttrs = require_domain().attributes;\n var descriptionOnlyNumbers = require_axis_format_attributes().descriptionOnlyNumbers;\n var attrs = module.exports = overrideAll({\n domain: domainAttrs({ name: \"table\", trace: true }),\n columnwidth: {\n valType: \"number\",\n arrayOk: true,\n dflt: null\n },\n columnorder: {\n valType: \"data_array\"\n },\n header: {\n values: {\n valType: \"data_array\",\n dflt: []\n },\n format: {\n valType: \"data_array\",\n dflt: [],\n description: descriptionOnlyNumbers(\"cell value\")\n },\n prefix: {\n valType: \"string\",\n arrayOk: true,\n dflt: null\n },\n suffix: {\n valType: \"string\",\n arrayOk: true,\n dflt: null\n },\n height: {\n valType: \"number\",\n dflt: 28\n },\n align: extendFlat({}, annAttrs.align, { arrayOk: true }),\n line: {\n width: {\n valType: \"number\",\n arrayOk: true,\n dflt: 1\n },\n color: {\n valType: \"color\",\n arrayOk: true,\n dflt: \"grey\"\n }\n },\n fill: {\n color: {\n valType: \"color\",\n arrayOk: true,\n dflt: \"white\"\n }\n },\n font: extendFlat({}, fontAttrs({ arrayOk: true }))\n },\n cells: {\n values: {\n valType: \"data_array\",\n dflt: []\n },\n format: {\n valType: \"data_array\",\n dflt: [],\n description: descriptionOnlyNumbers(\"cell value\")\n },\n prefix: {\n valType: \"string\",\n arrayOk: true,\n dflt: null\n },\n suffix: {\n valType: \"string\",\n arrayOk: true,\n dflt: null\n },\n height: {\n valType: \"number\",\n dflt: 20\n },\n align: extendFlat({}, annAttrs.align, { arrayOk: true }),\n line: {\n width: {\n valType: \"number\",\n arrayOk: true,\n dflt: 1\n },\n color: {\n valType: \"color\",\n arrayOk: true,\n dflt: \"grey\"\n }\n },\n fill: {\n color: {\n valType: \"color\",\n arrayOk: true,\n dflt: \"white\"\n }\n },\n font: extendFlat({}, fontAttrs({ arrayOk: true }))\n }\n }, \"calc\", \"from-root\");\n }\n });\n\n // src/traces/table/defaults.js\n var require_defaults58 = __commonJS({\n \"src/traces/table/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var attributes = require_attributes62();\n var handleDomainDefaults = require_domain().defaults;\n function defaultColumnOrder(traceOut, coerce) {\n var specifiedColumnOrder = traceOut.columnorder || [];\n var commonLength = traceOut.header.values.length;\n var truncated = specifiedColumnOrder.slice(0, commonLength);\n var sorted = truncated.slice().sort(function(a, b) {\n return a - b;\n });\n var oneStepped = truncated.map(function(d) {\n return sorted.indexOf(d);\n });\n for (var i = oneStepped.length; i < commonLength; i++) {\n oneStepped.push(i);\n }\n coerce(\"columnorder\", oneStepped);\n }\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n handleDomainDefaults(traceOut, layout, coerce);\n coerce(\"columnwidth\");\n coerce(\"header.values\");\n coerce(\"header.format\");\n coerce(\"header.align\");\n coerce(\"header.prefix\");\n coerce(\"header.suffix\");\n coerce(\"header.height\");\n coerce(\"header.line.width\");\n coerce(\"header.line.color\");\n coerce(\"header.fill.color\");\n Lib.coerceFont(coerce, \"header.font\", layout.font);\n defaultColumnOrder(traceOut, coerce);\n coerce(\"cells.values\");\n coerce(\"cells.format\");\n coerce(\"cells.align\");\n coerce(\"cells.prefix\");\n coerce(\"cells.suffix\");\n coerce(\"cells.height\");\n coerce(\"cells.line.width\");\n coerce(\"cells.line.color\");\n coerce(\"cells.fill.color\");\n Lib.coerceFont(coerce, \"cells.font\", layout.font);\n traceOut._length = null;\n };\n }\n });\n\n // src/traces/table/calc.js\n var require_calc37 = __commonJS({\n \"src/traces/table/calc.js\"(exports, module) {\n \"use strict\";\n var wrap = require_gup().wrap;\n module.exports = function calc() {\n return wrap({});\n };\n }\n });\n\n // src/traces/table/constants.js\n var require_constants31 = __commonJS({\n \"src/traces/table/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n cellPad: 8,\n columnExtentOffset: 10,\n columnTitleOffset: 28,\n emptyHeaderHeight: 16,\n latexCheck: /^\\$.*\\$$/,\n goldenRatio: 1.618,\n lineBreaker: \"
    \",\n maxDimensionCount: 60,\n overdrag: 45,\n releaseTransitionDuration: 120,\n releaseTransitionEase: \"cubic-out\",\n scrollbarCaptureWidth: 18,\n scrollbarHideDelay: 1e3,\n scrollbarHideDuration: 1e3,\n scrollbarOffset: 5,\n scrollbarWidth: 8,\n transitionDuration: 100,\n transitionEase: \"cubic-out\",\n uplift: 5,\n wrapSpacer: \" \",\n wrapSplitCharacter: \" \",\n cn: {\n // general class names\n table: \"table\",\n tableControlView: \"table-control-view\",\n scrollBackground: \"scroll-background\",\n yColumn: \"y-column\",\n columnBlock: \"column-block\",\n scrollAreaClip: \"scroll-area-clip\",\n scrollAreaClipRect: \"scroll-area-clip-rect\",\n columnBoundary: \"column-boundary\",\n columnBoundaryClippath: \"column-boundary-clippath\",\n columnBoundaryRect: \"column-boundary-rect\",\n columnCells: \"column-cells\",\n columnCell: \"column-cell\",\n cellRect: \"cell-rect\",\n cellText: \"cell-text\",\n cellTextHolder: \"cell-text-holder\",\n // scroll related class names\n scrollbarKit: \"scrollbar-kit\",\n scrollbar: \"scrollbar\",\n scrollbarSlider: \"scrollbar-slider\",\n scrollbarGlyph: \"scrollbar-glyph\",\n scrollbarCaptureZone: \"scrollbar-capture-zone\"\n }\n };\n }\n });\n\n // src/traces/table/data_preparation_helper.js\n var require_data_preparation_helper = __commonJS({\n \"src/traces/table/data_preparation_helper.js\"(exports, module) {\n \"use strict\";\n var c = require_constants31();\n var extendFlat = require_extend().extendFlat;\n var isNumeric = require_fast_isnumeric();\n var isTypedArray = require_array().isTypedArray;\n var isArrayOrTypedArray = require_array().isArrayOrTypedArray;\n module.exports = function calc(gd, trace) {\n var cellsValues = squareStringMatrix(trace.cells.values);\n var slicer = function(a) {\n return a.slice(trace.header.values.length, a.length);\n };\n var headerValuesIn = squareStringMatrix(trace.header.values);\n if (headerValuesIn.length && !headerValuesIn[0].length) {\n headerValuesIn[0] = [\"\"];\n headerValuesIn = squareStringMatrix(headerValuesIn);\n }\n var headerValues = headerValuesIn.concat(slicer(cellsValues).map(function() {\n return emptyStrings((headerValuesIn[0] || [\"\"]).length);\n }));\n var domain = trace.domain;\n var groupWidth = Math.floor(gd._fullLayout._size.w * (domain.x[1] - domain.x[0]));\n var groupHeight = Math.floor(gd._fullLayout._size.h * (domain.y[1] - domain.y[0]));\n var headerRowHeights = trace.header.values.length ? headerValues[0].map(function() {\n return trace.header.height;\n }) : [c.emptyHeaderHeight];\n var rowHeights = cellsValues.length ? cellsValues[0].map(function() {\n return trace.cells.height;\n }) : [];\n var headerHeight = headerRowHeights.reduce(sum, 0);\n var scrollHeight = groupHeight - headerHeight;\n var minimumFillHeight = scrollHeight + c.uplift;\n var anchorToRowBlock = makeAnchorToRowBlock(rowHeights, minimumFillHeight);\n var anchorToHeaderRowBlock = makeAnchorToRowBlock(headerRowHeights, headerHeight);\n var headerRowBlocks = makeRowBlock(anchorToHeaderRowBlock, []);\n var rowBlocks = makeRowBlock(anchorToRowBlock, headerRowBlocks);\n var uniqueKeys = {};\n var columnOrder = trace._fullInput.columnorder;\n if (isArrayOrTypedArray(columnOrder)) columnOrder = Array.from(columnOrder);\n columnOrder = columnOrder.concat(slicer(cellsValues.map(function(d, i) {\n return i;\n })));\n var columnWidths = headerValues.map(function(d, i) {\n var value = isArrayOrTypedArray(trace.columnwidth) ? trace.columnwidth[Math.min(i, trace.columnwidth.length - 1)] : trace.columnwidth;\n return isNumeric(value) ? Number(value) : 1;\n });\n var totalColumnWidths = columnWidths.reduce(sum, 0);\n columnWidths = columnWidths.map(function(d) {\n return d / totalColumnWidths * groupWidth;\n });\n var maxLineWidth = Math.max(arrayMax(trace.header.line.width), arrayMax(trace.cells.line.width));\n var calcdata = {\n // include staticPlot in the key so if it changes we delete and redraw\n key: trace.uid + gd._context.staticPlot,\n translateX: domain.x[0] * gd._fullLayout._size.w,\n translateY: gd._fullLayout._size.h * (1 - domain.y[1]),\n size: gd._fullLayout._size,\n width: groupWidth,\n maxLineWidth,\n height: groupHeight,\n columnOrder,\n // will be mutated on column move, todo use in callback\n groupHeight,\n rowBlocks,\n headerRowBlocks,\n scrollY: 0,\n // will be mutated on scroll\n cells: extendFlat({}, trace.cells, { values: cellsValues }),\n headerCells: extendFlat({}, trace.header, { values: headerValues }),\n gdColumns: headerValues.map(function(d) {\n return d[0];\n }),\n gdColumnsOriginalOrder: headerValues.map(function(d) {\n return d[0];\n }),\n prevPages: [0, 0],\n scrollbarState: { scrollbarScrollInProgress: false },\n columns: headerValues.map(function(label, i) {\n var foundKey = uniqueKeys[label];\n uniqueKeys[label] = (foundKey || 0) + 1;\n var key = label + \"__\" + uniqueKeys[label];\n return {\n key,\n label,\n specIndex: i,\n xIndex: columnOrder[i],\n xScale,\n x: void 0,\n // initialized below\n calcdata: void 0,\n // initialized below\n columnWidth: columnWidths[i]\n };\n })\n };\n calcdata.columns.forEach(function(col) {\n col.calcdata = calcdata;\n col.x = xScale(col);\n });\n return calcdata;\n };\n function arrayMax(maybeArray) {\n if (isArrayOrTypedArray(maybeArray)) {\n var max = 0;\n for (var i = 0; i < maybeArray.length; i++) {\n max = Math.max(max, arrayMax(maybeArray[i]));\n }\n return max;\n }\n return maybeArray;\n }\n function sum(a, b) {\n return a + b;\n }\n function squareStringMatrix(matrixIn) {\n var matrix = matrixIn.slice();\n var minLen = Infinity;\n var maxLen = 0;\n var i;\n for (i = 0; i < matrix.length; i++) {\n if (isTypedArray(matrix[i])) matrix[i] = Array.from(matrix[i]);\n else if (!isArrayOrTypedArray(matrix[i])) matrix[i] = [matrix[i]];\n minLen = Math.min(minLen, matrix[i].length);\n maxLen = Math.max(maxLen, matrix[i].length);\n }\n if (minLen !== maxLen) {\n for (i = 0; i < matrix.length; i++) {\n var padLen = maxLen - matrix[i].length;\n if (padLen) matrix[i] = matrix[i].concat(emptyStrings(padLen));\n }\n }\n return matrix;\n }\n function emptyStrings(len) {\n var padArray = new Array(len);\n for (var j = 0; j < len; j++) padArray[j] = \"\";\n return padArray;\n }\n function xScale(d) {\n return d.calcdata.columns.reduce(function(prev, next) {\n return next.xIndex < d.xIndex ? prev + next.columnWidth : prev;\n }, 0);\n }\n function makeRowBlock(anchorToRowBlock, auxiliary) {\n var blockAnchorKeys = Object.keys(anchorToRowBlock);\n return blockAnchorKeys.map(function(k) {\n return extendFlat({}, anchorToRowBlock[k], { auxiliaryBlocks: auxiliary });\n });\n }\n function makeAnchorToRowBlock(rowHeights, minimumFillHeight) {\n var anchorToRowBlock = {};\n var currentRowHeight;\n var currentAnchor = 0;\n var currentBlockHeight = 0;\n var currentBlock = makeIdentity();\n var currentFirstRowIndex = 0;\n var blockCounter = 0;\n for (var i = 0; i < rowHeights.length; i++) {\n currentRowHeight = rowHeights[i];\n currentBlock.rows.push({\n rowIndex: i,\n rowHeight: currentRowHeight\n });\n currentBlockHeight += currentRowHeight;\n if (currentBlockHeight >= minimumFillHeight || i === rowHeights.length - 1) {\n anchorToRowBlock[currentAnchor] = currentBlock;\n currentBlock.key = blockCounter++;\n currentBlock.firstRowIndex = currentFirstRowIndex;\n currentBlock.lastRowIndex = i;\n currentBlock = makeIdentity();\n currentAnchor += currentBlockHeight;\n currentFirstRowIndex = i + 1;\n currentBlockHeight = 0;\n }\n }\n return anchorToRowBlock;\n }\n function makeIdentity() {\n return {\n firstRowIndex: null,\n lastRowIndex: null,\n rows: []\n };\n }\n }\n });\n\n // src/traces/table/data_split_helpers.js\n var require_data_split_helpers = __commonJS({\n \"src/traces/table/data_split_helpers.js\"(exports) {\n \"use strict\";\n var extendFlat = require_extend().extendFlat;\n exports.splitToPanels = function(d) {\n var prevPages = [0, 0];\n var headerPanel = extendFlat({}, d, {\n key: \"header\",\n type: \"header\",\n page: 0,\n prevPages,\n currentRepaint: [null, null],\n dragHandle: true,\n values: d.calcdata.headerCells.values[d.specIndex],\n rowBlocks: d.calcdata.headerRowBlocks,\n calcdata: extendFlat({}, d.calcdata, { cells: d.calcdata.headerCells })\n });\n var revolverPanel1 = extendFlat({}, d, {\n key: \"cells1\",\n type: \"cells\",\n page: 0,\n prevPages,\n currentRepaint: [null, null],\n dragHandle: false,\n values: d.calcdata.cells.values[d.specIndex],\n rowBlocks: d.calcdata.rowBlocks\n });\n var revolverPanel2 = extendFlat({}, d, {\n key: \"cells2\",\n type: \"cells\",\n page: 1,\n prevPages,\n currentRepaint: [null, null],\n dragHandle: false,\n values: d.calcdata.cells.values[d.specIndex],\n rowBlocks: d.calcdata.rowBlocks\n });\n return [revolverPanel1, revolverPanel2, headerPanel];\n };\n exports.splitToCells = function(d) {\n var fromTo = rowFromTo(d);\n return (d.values || []).slice(fromTo[0], fromTo[1]).map(function(v, i) {\n var buster = typeof v === \"string\" && v.match(/[<$&> ]/) ? \"_keybuster_\" + Math.random() : \"\";\n return {\n // keyWithinBlock: /*fromTo[0] + */i, // optimized future version - no busting\n // keyWithinBlock: fromTo[0] + i, // initial always-unoptimized version - janky scrolling with 5+ columns\n keyWithinBlock: i + buster,\n // current compromise: regular content is very fast; async content is possible\n key: fromTo[0] + i,\n column: d,\n calcdata: d.calcdata,\n page: d.page,\n rowBlocks: d.rowBlocks,\n value: v\n };\n });\n };\n function rowFromTo(d) {\n var rowBlock = d.rowBlocks[d.page];\n var rowFrom = rowBlock ? rowBlock.rows[0].rowIndex : 0;\n var rowTo = rowBlock ? rowFrom + rowBlock.rows.length : 0;\n return [rowFrom, rowTo];\n }\n }\n });\n\n // src/traces/table/plot.js\n var require_plot31 = __commonJS({\n \"src/traces/table/plot.js\"(exports, module) {\n \"use strict\";\n var c = require_constants31();\n var d3 = require_d3();\n var Lib = require_lib();\n var numberFormat = Lib.numberFormat;\n var gup = require_gup();\n var Drawing = require_drawing();\n var svgUtil = require_svg_text_utils();\n var raiseToTop = require_lib().raiseToTop;\n var strTranslate = require_lib().strTranslate;\n var cancelEeaseColumn = require_lib().cancelTransition;\n var prepareData = require_data_preparation_helper();\n var splitData = require_data_split_helpers();\n var Color2 = require_color();\n module.exports = function plot(gd, wrappedTraceHolders) {\n var dynamic = !gd._context.staticPlot;\n var table = gd._fullLayout._paper.selectAll(\".\" + c.cn.table).data(wrappedTraceHolders.map(function(wrappedTraceHolder) {\n var traceHolder = gup.unwrap(wrappedTraceHolder);\n var trace = traceHolder.trace;\n return prepareData(gd, trace);\n }), gup.keyFun);\n table.exit().remove();\n table.enter().append(\"g\").classed(c.cn.table, true).attr(\"overflow\", \"visible\").style(\"box-sizing\", \"content-box\").style(\"position\", \"absolute\").style(\"left\", 0).style(\"overflow\", \"visible\").style(\"shape-rendering\", \"crispEdges\").style(\"pointer-events\", \"all\");\n table.attr(\"width\", function(d) {\n return d.width + d.size.l + d.size.r;\n }).attr(\"height\", function(d) {\n return d.height + d.size.t + d.size.b;\n }).attr(\"transform\", function(d) {\n return strTranslate(d.translateX, d.translateY);\n });\n var tableControlView = table.selectAll(\".\" + c.cn.tableControlView).data(gup.repeat, gup.keyFun);\n var cvEnter = tableControlView.enter().append(\"g\").classed(c.cn.tableControlView, true).style(\"box-sizing\", \"content-box\");\n if (dynamic) {\n var wheelEvent = \"onwheel\" in document ? \"wheel\" : \"mousewheel\";\n cvEnter.on(\"mousemove\", function(d) {\n tableControlView.filter(function(dd) {\n return d === dd;\n }).call(renderScrollbarKit, gd);\n }).on(wheelEvent, function(d) {\n if (d.scrollbarState.wheeling) return;\n d.scrollbarState.wheeling = true;\n var newY = d.scrollY + d3.event.deltaY;\n var noChange = makeDragRow(gd, tableControlView, null, newY)(d);\n if (!noChange) {\n d3.event.stopPropagation();\n d3.event.preventDefault();\n }\n d.scrollbarState.wheeling = false;\n }).call(renderScrollbarKit, gd, true);\n }\n tableControlView.attr(\"transform\", function(d) {\n return strTranslate(d.size.l, d.size.t);\n });\n var scrollBackground = tableControlView.selectAll(\".\" + c.cn.scrollBackground).data(gup.repeat, gup.keyFun);\n scrollBackground.enter().append(\"rect\").classed(c.cn.scrollBackground, true).attr(\"fill\", \"none\");\n scrollBackground.attr(\"width\", function(d) {\n return d.width;\n }).attr(\"height\", function(d) {\n return d.height;\n });\n tableControlView.each(function(d) {\n Drawing.setClipUrl(d3.select(this), scrollAreaBottomClipKey(gd, d), gd);\n });\n var yColumn = tableControlView.selectAll(\".\" + c.cn.yColumn).data(function(vm) {\n return vm.columns;\n }, gup.keyFun);\n yColumn.enter().append(\"g\").classed(c.cn.yColumn, true);\n yColumn.exit().remove();\n yColumn.attr(\"transform\", function(d) {\n return strTranslate(d.x, 0);\n });\n if (dynamic) {\n yColumn.call(\n d3.behavior.drag().origin(function(d) {\n var movedColumn = d3.select(this);\n easeColumn(movedColumn, d, -c.uplift);\n raiseToTop(this);\n d.calcdata.columnDragInProgress = true;\n renderScrollbarKit(tableControlView.filter(function(dd) {\n return d.calcdata.key === dd.key;\n }), gd);\n return d;\n }).on(\"drag\", function(d) {\n var movedColumn = d3.select(this);\n var getter = function(dd) {\n return (d === dd ? d3.event.x : dd.x) + dd.columnWidth / 2;\n };\n d.x = Math.max(-c.overdrag, Math.min(d.calcdata.width + c.overdrag - d.columnWidth, d3.event.x));\n var sortableColumns = flatData(yColumn).filter(function(dd) {\n return dd.calcdata.key === d.calcdata.key;\n });\n var newOrder = sortableColumns.sort(function(a, b) {\n return getter(a) - getter(b);\n });\n newOrder.forEach(function(dd, i) {\n dd.xIndex = i;\n dd.x = d === dd ? dd.x : dd.xScale(dd);\n });\n yColumn.filter(function(dd) {\n return d !== dd;\n }).transition().ease(c.transitionEase).duration(c.transitionDuration).attr(\"transform\", function(d2) {\n return strTranslate(d2.x, 0);\n });\n movedColumn.call(cancelEeaseColumn).attr(\"transform\", strTranslate(d.x, -c.uplift));\n }).on(\"dragend\", function(d) {\n var movedColumn = d3.select(this);\n var p = d.calcdata;\n d.x = d.xScale(d);\n d.calcdata.columnDragInProgress = false;\n easeColumn(movedColumn, d, 0);\n columnMoved(gd, p, p.columns.map(function(dd) {\n return dd.xIndex;\n }));\n })\n );\n }\n yColumn.each(function(d) {\n Drawing.setClipUrl(d3.select(this), columnBoundaryClipKey(gd, d), gd);\n });\n var columnBlock = yColumn.selectAll(\".\" + c.cn.columnBlock).data(splitData.splitToPanels, gup.keyFun);\n columnBlock.enter().append(\"g\").classed(c.cn.columnBlock, true).attr(\"id\", function(d) {\n return d.key;\n });\n columnBlock.style(\"cursor\", function(d) {\n return d.dragHandle ? \"ew-resize\" : d.calcdata.scrollbarState.barWiggleRoom ? \"ns-resize\" : \"default\";\n });\n var headerColumnBlock = columnBlock.filter(headerBlock);\n var cellsColumnBlock = columnBlock.filter(cellsBlock);\n if (dynamic) {\n cellsColumnBlock.call(\n d3.behavior.drag().origin(function(d) {\n d3.event.stopPropagation();\n return d;\n }).on(\"drag\", makeDragRow(gd, tableControlView, -1)).on(\"dragend\", function() {\n })\n );\n }\n renderColumnCellTree(gd, tableControlView, headerColumnBlock, columnBlock);\n renderColumnCellTree(gd, tableControlView, cellsColumnBlock, columnBlock);\n var scrollAreaClip = tableControlView.selectAll(\".\" + c.cn.scrollAreaClip).data(gup.repeat, gup.keyFun);\n scrollAreaClip.enter().append(\"clipPath\").classed(c.cn.scrollAreaClip, true).attr(\"id\", function(d) {\n return scrollAreaBottomClipKey(gd, d);\n });\n var scrollAreaClipRect = scrollAreaClip.selectAll(\".\" + c.cn.scrollAreaClipRect).data(gup.repeat, gup.keyFun);\n scrollAreaClipRect.enter().append(\"rect\").classed(c.cn.scrollAreaClipRect, true).attr(\"x\", -c.overdrag).attr(\"y\", -c.uplift).attr(\"fill\", \"none\");\n scrollAreaClipRect.attr(\"width\", function(d) {\n return d.width + 2 * c.overdrag;\n }).attr(\"height\", function(d) {\n return d.height + c.uplift;\n });\n var columnBoundary = yColumn.selectAll(\".\" + c.cn.columnBoundary).data(gup.repeat, gup.keyFun);\n columnBoundary.enter().append(\"g\").classed(c.cn.columnBoundary, true);\n var columnBoundaryClippath = yColumn.selectAll(\".\" + c.cn.columnBoundaryClippath).data(gup.repeat, gup.keyFun);\n columnBoundaryClippath.enter().append(\"clipPath\").classed(c.cn.columnBoundaryClippath, true);\n columnBoundaryClippath.attr(\"id\", function(d) {\n return columnBoundaryClipKey(gd, d);\n });\n var columnBoundaryRect = columnBoundaryClippath.selectAll(\".\" + c.cn.columnBoundaryRect).data(gup.repeat, gup.keyFun);\n columnBoundaryRect.enter().append(\"rect\").classed(c.cn.columnBoundaryRect, true).attr(\"fill\", \"none\");\n columnBoundaryRect.attr(\"width\", function(d) {\n return d.columnWidth + 2 * roundHalfWidth(d);\n }).attr(\"height\", function(d) {\n return d.calcdata.height + 2 * roundHalfWidth(d) + c.uplift;\n }).attr(\"x\", function(d) {\n return -roundHalfWidth(d);\n }).attr(\"y\", function(d) {\n return -roundHalfWidth(d);\n });\n updateBlockYPosition(null, cellsColumnBlock, tableControlView);\n };\n function roundHalfWidth(d) {\n return Math.ceil(d.calcdata.maxLineWidth / 2);\n }\n function scrollAreaBottomClipKey(gd, d) {\n return \"clip\" + gd._fullLayout._uid + \"_scrollAreaBottomClip_\" + d.key;\n }\n function columnBoundaryClipKey(gd, d) {\n return \"clip\" + gd._fullLayout._uid + \"_columnBoundaryClippath_\" + d.calcdata.key + \"_\" + d.specIndex;\n }\n function flatData(selection) {\n return [].concat.apply([], selection.map(function(g) {\n return g;\n })).map(function(g) {\n return g.__data__;\n });\n }\n function renderScrollbarKit(tableControlView, gd, bypassVisibleBar) {\n function calcTotalHeight(d) {\n var blocks = d.rowBlocks;\n return firstRowAnchor(blocks, blocks.length - 1) + (blocks.length ? rowsHeight(blocks[blocks.length - 1], Infinity) : 1);\n }\n var scrollbarKit = tableControlView.selectAll(\".\" + c.cn.scrollbarKit).data(gup.repeat, gup.keyFun);\n scrollbarKit.enter().append(\"g\").classed(c.cn.scrollbarKit, true).style(\"shape-rendering\", \"geometricPrecision\");\n scrollbarKit.each(function(d) {\n var s = d.scrollbarState;\n s.totalHeight = calcTotalHeight(d);\n s.scrollableAreaHeight = d.groupHeight - headerHeight(d);\n s.currentlyVisibleHeight = Math.min(s.totalHeight, s.scrollableAreaHeight);\n s.ratio = s.currentlyVisibleHeight / s.totalHeight;\n s.barLength = Math.max(s.ratio * s.currentlyVisibleHeight, c.goldenRatio * c.scrollbarWidth);\n s.barWiggleRoom = s.currentlyVisibleHeight - s.barLength;\n s.wiggleRoom = Math.max(0, s.totalHeight - s.scrollableAreaHeight);\n s.topY = s.barWiggleRoom === 0 ? 0 : d.scrollY / s.wiggleRoom * s.barWiggleRoom;\n s.bottomY = s.topY + s.barLength;\n s.dragMultiplier = s.wiggleRoom / s.barWiggleRoom;\n }).attr(\"transform\", function(d) {\n var xPosition2 = d.width + c.scrollbarWidth / 2 + c.scrollbarOffset;\n return strTranslate(xPosition2, headerHeight(d));\n });\n var scrollbar = scrollbarKit.selectAll(\".\" + c.cn.scrollbar).data(gup.repeat, gup.keyFun);\n scrollbar.enter().append(\"g\").classed(c.cn.scrollbar, true);\n var scrollbarSlider = scrollbar.selectAll(\".\" + c.cn.scrollbarSlider).data(gup.repeat, gup.keyFun);\n scrollbarSlider.enter().append(\"g\").classed(c.cn.scrollbarSlider, true);\n scrollbarSlider.attr(\"transform\", function(d) {\n return strTranslate(0, d.scrollbarState.topY || 0);\n });\n var scrollbarGlyph = scrollbarSlider.selectAll(\".\" + c.cn.scrollbarGlyph).data(gup.repeat, gup.keyFun);\n scrollbarGlyph.enter().append(\"line\").classed(c.cn.scrollbarGlyph, true).attr(\"stroke\", \"black\").attr(\"stroke-width\", c.scrollbarWidth).attr(\"stroke-linecap\", \"round\").attr(\"y1\", c.scrollbarWidth / 2);\n scrollbarGlyph.attr(\"y2\", function(d) {\n return d.scrollbarState.barLength - c.scrollbarWidth / 2;\n }).attr(\"stroke-opacity\", function(d) {\n return d.columnDragInProgress || !d.scrollbarState.barWiggleRoom || bypassVisibleBar ? 0 : 0.4;\n });\n scrollbarGlyph.transition().delay(0).duration(0);\n scrollbarGlyph.transition().delay(c.scrollbarHideDelay).duration(c.scrollbarHideDuration).attr(\"stroke-opacity\", 0);\n var scrollbarCaptureZone = scrollbar.selectAll(\".\" + c.cn.scrollbarCaptureZone).data(gup.repeat, gup.keyFun);\n scrollbarCaptureZone.enter().append(\"line\").classed(c.cn.scrollbarCaptureZone, true).attr(\"stroke\", \"white\").attr(\"stroke-opacity\", 0.01).attr(\"stroke-width\", c.scrollbarCaptureWidth).attr(\"stroke-linecap\", \"butt\").attr(\"y1\", 0).on(\"mousedown\", function(d) {\n var y = d3.event.y;\n var bbox = this.getBoundingClientRect();\n var s = d.scrollbarState;\n var pixelVal = y - bbox.top;\n var inverseScale = d3.scale.linear().domain([0, s.scrollableAreaHeight]).range([0, s.totalHeight]).clamp(true);\n if (!(s.topY <= pixelVal && pixelVal <= s.bottomY)) {\n makeDragRow(gd, tableControlView, null, inverseScale(pixelVal - s.barLength / 2))(d);\n }\n }).call(\n d3.behavior.drag().origin(function(d) {\n d3.event.stopPropagation();\n d.scrollbarState.scrollbarScrollInProgress = true;\n return d;\n }).on(\"drag\", makeDragRow(gd, tableControlView)).on(\"dragend\", function() {\n })\n );\n scrollbarCaptureZone.attr(\"y2\", function(d) {\n return d.scrollbarState.scrollableAreaHeight;\n });\n if (gd._context.staticPlot) {\n scrollbarGlyph.remove();\n scrollbarCaptureZone.remove();\n }\n }\n function renderColumnCellTree(gd, tableControlView, columnBlock, allColumnBlock) {\n var columnCells = renderColumnCells(columnBlock);\n var columnCell = renderColumnCell(columnCells);\n supplyStylingValues(columnCell);\n var cellRect = renderCellRect(columnCell);\n sizeAndStyleRect(cellRect);\n var cellTextHolder = renderCellTextHolder(columnCell);\n var cellText = renderCellText(cellTextHolder);\n setFont(cellText);\n populateCellText(cellText, tableControlView, allColumnBlock, gd);\n setCellHeightAndPositionY(columnCell);\n }\n function renderColumnCells(columnBlock) {\n var columnCells = columnBlock.selectAll(\".\" + c.cn.columnCells).data(gup.repeat, gup.keyFun);\n columnCells.enter().append(\"g\").classed(c.cn.columnCells, true);\n columnCells.exit().remove();\n return columnCells;\n }\n function renderColumnCell(columnCells) {\n var columnCell = columnCells.selectAll(\".\" + c.cn.columnCell).data(splitData.splitToCells, function(d) {\n return d.keyWithinBlock;\n });\n columnCell.enter().append(\"g\").classed(c.cn.columnCell, true);\n columnCell.exit().remove();\n return columnCell;\n }\n function renderCellRect(columnCell) {\n var cellRect = columnCell.selectAll(\".\" + c.cn.cellRect).data(gup.repeat, function(d) {\n return d.keyWithinBlock;\n });\n cellRect.enter().append(\"rect\").classed(c.cn.cellRect, true);\n return cellRect;\n }\n function renderCellText(cellTextHolder) {\n var cellText = cellTextHolder.selectAll(\".\" + c.cn.cellText).data(gup.repeat, function(d) {\n return d.keyWithinBlock;\n });\n cellText.enter().append(\"text\").classed(c.cn.cellText, true).style(\"cursor\", function() {\n return \"auto\";\n }).on(\"mousedown\", function() {\n d3.event.stopPropagation();\n });\n return cellText;\n }\n function renderCellTextHolder(columnCell) {\n var cellTextHolder = columnCell.selectAll(\".\" + c.cn.cellTextHolder).data(gup.repeat, function(d) {\n return d.keyWithinBlock;\n });\n cellTextHolder.enter().append(\"g\").classed(c.cn.cellTextHolder, true).style(\"shape-rendering\", \"geometricPrecision\");\n return cellTextHolder;\n }\n function supplyStylingValues(columnCell) {\n columnCell.each(function(d, i) {\n var spec = d.calcdata.cells.font;\n var col = d.column.specIndex;\n var font = {\n size: gridPick(spec.size, col, i),\n color: gridPick(spec.color, col, i),\n family: gridPick(spec.family, col, i),\n weight: gridPick(spec.weight, col, i),\n style: gridPick(spec.style, col, i),\n variant: gridPick(spec.variant, col, i),\n textcase: gridPick(spec.textcase, col, i),\n lineposition: gridPick(spec.lineposition, col, i),\n shadow: gridPick(spec.shadow, col, i)\n };\n d.rowNumber = d.key;\n d.align = gridPick(d.calcdata.cells.align, col, i);\n d.cellBorderWidth = gridPick(d.calcdata.cells.line.width, col, i);\n d.font = font;\n });\n }\n function setFont(cellText) {\n cellText.each(function(d) {\n Drawing.font(d3.select(this), d.font);\n });\n }\n function sizeAndStyleRect(cellRect) {\n cellRect.attr(\"width\", function(d) {\n return d.column.columnWidth;\n }).attr(\"stroke-width\", function(d) {\n return d.cellBorderWidth;\n }).each(function(d) {\n var atomicSelection = d3.select(this);\n Color2.stroke(atomicSelection, gridPick(d.calcdata.cells.line.color, d.column.specIndex, d.rowNumber));\n Color2.fill(atomicSelection, gridPick(d.calcdata.cells.fill.color, d.column.specIndex, d.rowNumber));\n });\n }\n function populateCellText(cellText, tableControlView, allColumnBlock, gd) {\n cellText.text(function(d) {\n var col = d.column.specIndex;\n var row = d.rowNumber;\n var userSuppliedContent = d.value;\n var stringSupplied = typeof userSuppliedContent === \"string\";\n var hasBreaks = stringSupplied && userSuppliedContent.match(/
    /i);\n var userBrokenText = !stringSupplied || hasBreaks;\n d.mayHaveMarkup = stringSupplied && userSuppliedContent.match(/[<&>]/);\n var latex = isLatex(userSuppliedContent);\n d.latex = latex;\n var prefix = latex ? \"\" : gridPick(d.calcdata.cells.prefix, col, row) || \"\";\n var suffix = latex ? \"\" : gridPick(d.calcdata.cells.suffix, col, row) || \"\";\n var format = latex ? null : gridPick(d.calcdata.cells.format, col, row) || null;\n var prefixSuffixedText = prefix + (format ? numberFormat(format)(d.value) : d.value) + suffix;\n var hasWrapSplitCharacter;\n d.wrappingNeeded = !d.wrapped && !userBrokenText && !latex && (hasWrapSplitCharacter = hasWrapCharacter(prefixSuffixedText));\n d.cellHeightMayIncrease = hasBreaks || latex || d.mayHaveMarkup || (hasWrapSplitCharacter === void 0 ? hasWrapCharacter(prefixSuffixedText) : hasWrapSplitCharacter);\n d.needsConvertToTspans = d.mayHaveMarkup || d.wrappingNeeded || d.latex;\n var textToRender;\n if (d.wrappingNeeded) {\n var hrefPreservedText = c.wrapSplitCharacter === \" \" ? prefixSuffixedText.replace(/ pTop) {\n pages.push(blockIndex);\n }\n pTop += rowsHeight2;\n }\n return pages;\n }\n function updateBlockYPosition(gd, cellsColumnBlock, tableControlView) {\n var d = flatData(cellsColumnBlock)[0];\n if (d === void 0) return;\n var blocks = d.rowBlocks;\n var calcdata = d.calcdata;\n var bottom = firstRowAnchor(blocks, blocks.length);\n var scrollHeight = d.calcdata.groupHeight - headerHeight(d);\n var scrollY = calcdata.scrollY = Math.max(0, Math.min(bottom - scrollHeight, calcdata.scrollY));\n var pages = findPagesAndCacheHeights(blocks, scrollY, scrollHeight);\n if (pages.length === 1) {\n if (pages[0] === blocks.length - 1) {\n pages.unshift(pages[0] - 1);\n } else {\n pages.push(pages[0] + 1);\n }\n }\n if (pages[0] % 2) {\n pages.reverse();\n }\n cellsColumnBlock.each(function(d2, i) {\n d2.page = pages[i];\n d2.scrollY = scrollY;\n });\n cellsColumnBlock.attr(\"transform\", function(d2) {\n var yTranslate = firstRowAnchor(d2.rowBlocks, d2.page) - d2.scrollY;\n return strTranslate(0, yTranslate);\n });\n if (gd) {\n conditionalPanelRerender(gd, tableControlView, cellsColumnBlock, pages, d.prevPages, d, 0);\n conditionalPanelRerender(gd, tableControlView, cellsColumnBlock, pages, d.prevPages, d, 1);\n renderScrollbarKit(tableControlView, gd);\n }\n }\n function makeDragRow(gd, allTableControlView, optionalMultiplier, optionalPosition) {\n return function dragRow(eventD) {\n var d = eventD.calcdata ? eventD.calcdata : eventD;\n var tableControlView = allTableControlView.filter(function(dd) {\n return d.key === dd.key;\n });\n var multiplier = optionalMultiplier || d.scrollbarState.dragMultiplier;\n var initialScrollY = d.scrollY;\n d.scrollY = optionalPosition === void 0 ? d.scrollY + multiplier * d3.event.dy : optionalPosition;\n var cellsColumnBlock = tableControlView.selectAll(\".\" + c.cn.yColumn).selectAll(\".\" + c.cn.columnBlock).filter(cellsBlock);\n updateBlockYPosition(gd, cellsColumnBlock, tableControlView);\n return d.scrollY === initialScrollY;\n };\n }\n function conditionalPanelRerender(gd, tableControlView, cellsColumnBlock, pages, prevPages, d, revolverIndex) {\n var shouldComponentUpdate = pages[revolverIndex] !== prevPages[revolverIndex];\n if (shouldComponentUpdate) {\n clearTimeout(d.currentRepaint[revolverIndex]);\n d.currentRepaint[revolverIndex] = setTimeout(function() {\n var toRerender = cellsColumnBlock.filter(function(d2, i) {\n return i === revolverIndex && pages[i] !== prevPages[i];\n });\n renderColumnCellTree(gd, tableControlView, toRerender, cellsColumnBlock);\n prevPages[revolverIndex] = pages[revolverIndex];\n });\n }\n }\n function wrapTextMaker(columnBlock, element, tableControlView, gd) {\n return function wrapText() {\n var cellTextHolder = d3.select(element.parentNode);\n cellTextHolder.each(function(d) {\n var fragments = d.fragments;\n cellTextHolder.selectAll(\"tspan.line\").each(function(dd, i) {\n fragments[i].width = this.getComputedTextLength();\n });\n var separatorLength = fragments[fragments.length - 1].width;\n var rest = fragments.slice(0, -1);\n var currentRow = [];\n var currentAddition, currentAdditionLength;\n var currentRowLength = 0;\n var rowLengthLimit = d.column.columnWidth - 2 * c.cellPad;\n d.value = \"\";\n while (rest.length) {\n currentAddition = rest.shift();\n currentAdditionLength = currentAddition.width + separatorLength;\n if (currentRowLength + currentAdditionLength > rowLengthLimit) {\n d.value += currentRow.join(c.wrapSpacer) + c.lineBreaker;\n currentRow = [];\n currentRowLength = 0;\n }\n currentRow.push(currentAddition.text);\n currentRowLength += currentAdditionLength;\n }\n if (currentRowLength) {\n d.value += currentRow.join(c.wrapSpacer);\n }\n d.wrapped = true;\n });\n cellTextHolder.selectAll(\"tspan.line\").remove();\n populateCellText(cellTextHolder.select(\".\" + c.cn.cellText), tableControlView, columnBlock, gd);\n d3.select(element.parentNode.parentNode).call(setCellHeightAndPositionY);\n };\n }\n function updateYPositionMaker(columnBlock, element, tableControlView, gd, d) {\n return function updateYPosition() {\n if (d.settledY) return;\n var cellTextHolder = d3.select(element.parentNode);\n var l = getBlock(d);\n var rowIndex = d.key - l.firstRowIndex;\n var declaredRowHeight = l.rows[rowIndex].rowHeight;\n var requiredHeight = d.cellHeightMayIncrease ? element.parentNode.getBoundingClientRect().height + 2 * c.cellPad : declaredRowHeight;\n var finalHeight = Math.max(requiredHeight, declaredRowHeight);\n var increase = finalHeight - l.rows[rowIndex].rowHeight;\n if (increase) {\n l.rows[rowIndex].rowHeight = finalHeight;\n columnBlock.selectAll(\".\" + c.cn.columnCell).call(setCellHeightAndPositionY);\n updateBlockYPosition(null, columnBlock.filter(cellsBlock), 0);\n renderScrollbarKit(tableControlView, gd, true);\n }\n cellTextHolder.attr(\"transform\", function() {\n var element2 = this;\n var columnCellElement = element2.parentNode;\n var box = columnCellElement.getBoundingClientRect();\n var rectBox = d3.select(element2.parentNode).select(\".\" + c.cn.cellRect).node().getBoundingClientRect();\n var currentTransform = element2.transform.baseVal.consolidate();\n var yPosition = rectBox.top - box.top + (currentTransform ? currentTransform.matrix.f : c.cellPad);\n return strTranslate(xPosition(d, d3.select(element2.parentNode).select(\".\" + c.cn.cellTextHolder).node().getBoundingClientRect().width), yPosition);\n });\n d.settledY = true;\n };\n }\n function xPosition(d, optionalWidth) {\n switch (d.align) {\n case \"left\":\n return c.cellPad;\n case \"right\":\n return d.column.columnWidth - (optionalWidth || 0) - c.cellPad;\n case \"center\":\n return (d.column.columnWidth - (optionalWidth || 0)) / 2;\n default:\n return c.cellPad;\n }\n }\n function setCellHeightAndPositionY(columnCell) {\n columnCell.attr(\"transform\", function(d) {\n var headerHeight2 = d.rowBlocks[0].auxiliaryBlocks.reduce(function(p, n) {\n return p + rowsHeight(n, Infinity);\n }, 0);\n var l = getBlock(d);\n var rowAnchor = rowsHeight(l, d.key);\n var yOffset = rowAnchor + headerHeight2;\n return strTranslate(0, yOffset);\n }).selectAll(\".\" + c.cn.cellRect).attr(\"height\", function(d) {\n return getRow(getBlock(d), d.key).rowHeight;\n });\n }\n function firstRowAnchor(blocks, page) {\n var total = 0;\n for (var i = page - 1; i >= 0; i--) {\n total += allRowsHeight(blocks[i]);\n }\n return total;\n }\n function rowsHeight(rowBlock, key) {\n var total = 0;\n for (var i = 0; i < rowBlock.rows.length && rowBlock.rows[i].rowIndex < key; i++) {\n total += rowBlock.rows[i].rowHeight;\n }\n return total;\n }\n function allRowsHeight(rowBlock) {\n var cached = rowBlock.allRowsHeight;\n if (cached !== void 0) {\n return cached;\n }\n var total = 0;\n for (var i = 0; i < rowBlock.rows.length; i++) {\n total += rowBlock.rows[i].rowHeight;\n }\n rowBlock.allRowsHeight = total;\n return total;\n }\n function getBlock(d) {\n return d.rowBlocks[d.page];\n }\n function getRow(l, i) {\n return l.rows[i - l.firstRowIndex];\n }\n }\n });\n\n // src/traces/table/base_plot.js\n var require_base_plot11 = __commonJS({\n \"src/traces/table/base_plot.js\"(exports) {\n \"use strict\";\n var getModuleCalcData = require_get_data().getModuleCalcData;\n var tablePlot = require_plot31();\n var TABLE = \"table\";\n exports.name = TABLE;\n exports.plot = function(gd) {\n var calcData = getModuleCalcData(gd.calcdata, TABLE)[0];\n if (calcData.length) tablePlot(gd, calcData);\n };\n exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var hadTable = oldFullLayout._has && oldFullLayout._has(TABLE);\n var hasTable = newFullLayout._has && newFullLayout._has(TABLE);\n if (hadTable && !hasTable) {\n oldFullLayout._paperdiv.selectAll(\".table\").remove();\n }\n };\n }\n });\n\n // src/traces/table/index.js\n var require_table = __commonJS({\n \"src/traces/table/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes62(),\n supplyDefaults: require_defaults58(),\n calc: require_calc37(),\n plot: require_plot31(),\n moduleType: \"trace\",\n name: \"table\",\n basePlotModule: require_base_plot11(),\n categories: [\"noOpacity\"],\n meta: {}\n };\n }\n });\n\n // lib/table.js\n var require_table2 = __commonJS({\n \"lib/table.js\"(exports, module) {\n \"use strict\";\n module.exports = require_table();\n }\n });\n\n // src/traces/carpet/axis_attributes.js\n var require_axis_attributes2 = __commonJS({\n \"src/traces/carpet/axis_attributes.js\"(exports, module) {\n \"use strict\";\n var fontAttrs = require_font_attributes();\n var colorAttrs = require_attributes3();\n var axesAttrs = require_layout_attributes4();\n var descriptionWithDates = require_axis_format_attributes().descriptionWithDates;\n var overrideAll = require_edit_types().overrideAll;\n var dash = require_attributes4().dash;\n var extendFlat = require_extend().extendFlat;\n module.exports = {\n color: {\n valType: \"color\",\n editType: \"calc\"\n },\n smoothing: {\n valType: \"number\",\n dflt: 1,\n min: 0,\n max: 1.3,\n editType: \"calc\"\n },\n title: {\n text: {\n valType: \"string\",\n dflt: \"\",\n editType: \"calc\"\n },\n font: fontAttrs({\n editType: \"calc\"\n }),\n // TODO how is this different than `title.standoff`\n offset: {\n valType: \"number\",\n dflt: 10,\n editType: \"calc\"\n },\n editType: \"calc\"\n },\n type: {\n valType: \"enumerated\",\n // '-' means we haven't yet run autotype or couldn't find any data\n // it gets turned into linear in gd._fullLayout but not copied back\n // to gd.data like the others are.\n values: [\"-\", \"linear\", \"date\", \"category\"],\n dflt: \"-\",\n editType: \"calc\"\n },\n autotypenumbers: axesAttrs.autotypenumbers,\n autorange: {\n valType: \"enumerated\",\n values: [true, false, \"reversed\"],\n dflt: true,\n editType: \"calc\"\n },\n rangemode: {\n valType: \"enumerated\",\n values: [\"normal\", \"tozero\", \"nonnegative\"],\n dflt: \"normal\",\n editType: \"calc\"\n },\n range: {\n valType: \"info_array\",\n editType: \"calc\",\n items: [\n { valType: \"any\", editType: \"calc\" },\n { valType: \"any\", editType: \"calc\" }\n ]\n },\n fixedrange: {\n valType: \"boolean\",\n dflt: false,\n editType: \"calc\"\n },\n cheatertype: {\n valType: \"enumerated\",\n values: [\"index\", \"value\"],\n dflt: \"value\",\n editType: \"calc\"\n },\n tickmode: {\n valType: \"enumerated\",\n values: [\"linear\", \"array\"],\n dflt: \"array\",\n editType: \"calc\"\n },\n nticks: {\n valType: \"integer\",\n min: 0,\n dflt: 0,\n editType: \"calc\"\n },\n tickvals: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n ticktext: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n showticklabels: {\n valType: \"enumerated\",\n values: [\"start\", \"end\", \"both\", \"none\"],\n dflt: \"start\",\n editType: \"calc\"\n },\n labelalias: extendFlat({}, axesAttrs.labelalias, { editType: \"calc\" }),\n tickfont: fontAttrs({\n editType: \"calc\"\n }),\n tickangle: {\n valType: \"angle\",\n dflt: \"auto\",\n editType: \"calc\"\n },\n tickprefix: {\n valType: \"string\",\n dflt: \"\",\n editType: \"calc\"\n },\n showtickprefix: {\n valType: \"enumerated\",\n values: [\"all\", \"first\", \"last\", \"none\"],\n dflt: \"all\",\n editType: \"calc\"\n },\n ticksuffix: {\n valType: \"string\",\n dflt: \"\",\n editType: \"calc\"\n },\n showticksuffix: {\n valType: \"enumerated\",\n values: [\"all\", \"first\", \"last\", \"none\"],\n dflt: \"all\",\n editType: \"calc\"\n },\n showexponent: {\n valType: \"enumerated\",\n values: [\"all\", \"first\", \"last\", \"none\"],\n dflt: \"all\",\n editType: \"calc\"\n },\n exponentformat: {\n valType: \"enumerated\",\n values: [\"none\", \"e\", \"E\", \"power\", \"SI\", \"B\"],\n dflt: \"B\",\n editType: \"calc\"\n },\n minexponent: {\n valType: \"number\",\n dflt: 3,\n min: 0,\n editType: \"calc\"\n },\n separatethousands: {\n valType: \"boolean\",\n dflt: false,\n editType: \"calc\"\n },\n tickformat: {\n valType: \"string\",\n dflt: \"\",\n editType: \"calc\",\n description: descriptionWithDates(\"tick label\")\n },\n tickformatstops: overrideAll(axesAttrs.tickformatstops, \"calc\", \"from-root\"),\n categoryorder: {\n valType: \"enumerated\",\n values: [\n \"trace\",\n \"category ascending\",\n \"category descending\",\n \"array\"\n /* , 'value ascending', 'value descending'*/\n // value ascending / descending to be implemented later\n ],\n dflt: \"trace\",\n editType: \"calc\"\n },\n categoryarray: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n labelpadding: {\n valType: \"integer\",\n dflt: 10,\n editType: \"calc\"\n },\n labelprefix: {\n valType: \"string\",\n editType: \"calc\"\n },\n labelsuffix: {\n valType: \"string\",\n dflt: \"\",\n editType: \"calc\"\n },\n // lines and grids\n showline: {\n valType: \"boolean\",\n dflt: false,\n editType: \"calc\"\n },\n linecolor: {\n valType: \"color\",\n dflt: colorAttrs.defaultLine,\n editType: \"calc\"\n },\n linewidth: {\n valType: \"number\",\n min: 0,\n dflt: 1,\n editType: \"calc\"\n },\n gridcolor: {\n valType: \"color\",\n editType: \"calc\"\n },\n gridwidth: {\n valType: \"number\",\n min: 0,\n dflt: 1,\n editType: \"calc\"\n },\n griddash: extendFlat({}, dash, { editType: \"calc\" }),\n showgrid: {\n valType: \"boolean\",\n dflt: true,\n editType: \"calc\"\n },\n minorgridcount: {\n valType: \"integer\",\n min: 0,\n dflt: 0,\n editType: \"calc\"\n },\n minorgridwidth: {\n valType: \"number\",\n min: 0,\n dflt: 1,\n editType: \"calc\"\n },\n minorgriddash: extendFlat({}, dash, { editType: \"calc\" }),\n minorgridcolor: {\n valType: \"color\",\n dflt: colorAttrs.lightLine,\n editType: \"calc\"\n },\n startline: {\n valType: \"boolean\",\n editType: \"calc\"\n },\n startlinecolor: {\n valType: \"color\",\n editType: \"calc\"\n },\n startlinewidth: {\n valType: \"number\",\n dflt: 1,\n editType: \"calc\"\n },\n endline: {\n valType: \"boolean\",\n editType: \"calc\"\n },\n endlinewidth: {\n valType: \"number\",\n dflt: 1,\n editType: \"calc\"\n },\n endlinecolor: {\n valType: \"color\",\n editType: \"calc\"\n },\n tick0: {\n valType: \"number\",\n min: 0,\n dflt: 0,\n editType: \"calc\"\n },\n dtick: {\n valType: \"number\",\n min: 0,\n dflt: 1,\n editType: \"calc\"\n },\n arraytick0: {\n valType: \"integer\",\n min: 0,\n dflt: 0,\n editType: \"calc\"\n },\n arraydtick: {\n valType: \"integer\",\n min: 1,\n dflt: 1,\n editType: \"calc\"\n },\n editType: \"calc\"\n };\n }\n });\n\n // src/traces/carpet/attributes.js\n var require_attributes63 = __commonJS({\n \"src/traces/carpet/attributes.js\"(exports, module) {\n \"use strict\";\n var fontAttrs = require_font_attributes();\n var axisAttrs = require_axis_attributes2();\n var colorAttrs = require_attributes3();\n var carpetFont = fontAttrs({\n editType: \"calc\"\n });\n var zorder = require_attributes12().zorder;\n carpetFont.family.dflt = '\"Open Sans\", verdana, arial, sans-serif';\n carpetFont.size.dflt = 12;\n carpetFont.color.dflt = colorAttrs.defaultLine;\n module.exports = {\n carpet: {\n valType: \"string\",\n editType: \"calc\"\n },\n x: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n y: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n a: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n a0: {\n valType: \"number\",\n dflt: 0,\n editType: \"calc\"\n },\n da: {\n valType: \"number\",\n dflt: 1,\n editType: \"calc\"\n },\n b: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n b0: {\n valType: \"number\",\n dflt: 0,\n editType: \"calc\"\n },\n db: {\n valType: \"number\",\n dflt: 1,\n editType: \"calc\"\n },\n cheaterslope: {\n valType: \"number\",\n dflt: 1,\n editType: \"calc\"\n },\n aaxis: axisAttrs,\n baxis: axisAttrs,\n font: carpetFont,\n color: {\n valType: \"color\",\n dflt: colorAttrs.defaultLine,\n editType: \"plot\"\n },\n zorder\n };\n }\n });\n\n // src/traces/carpet/xy_defaults.js\n var require_xy_defaults2 = __commonJS({\n \"src/traces/carpet/xy_defaults.js\"(exports, module) {\n \"use strict\";\n var isArray1D = require_lib().isArray1D;\n module.exports = function handleXYDefaults(traceIn, traceOut, coerce) {\n var x = coerce(\"x\");\n var hasX = x && x.length;\n var y = coerce(\"y\");\n var hasY = y && y.length;\n if (!hasX && !hasY) return false;\n traceOut._cheater = !x;\n if ((!hasX || isArray1D(x)) && (!hasY || isArray1D(y))) {\n var len = hasX ? x.length : Infinity;\n if (hasY) len = Math.min(len, y.length);\n if (traceOut.a && traceOut.a.length) len = Math.min(len, traceOut.a.length);\n if (traceOut.b && traceOut.b.length) len = Math.min(len, traceOut.b.length);\n traceOut._length = len;\n } else traceOut._length = null;\n return true;\n };\n }\n });\n\n // src/traces/carpet/axis_defaults.js\n var require_axis_defaults3 = __commonJS({\n \"src/traces/carpet/axis_defaults.js\"(exports, module) {\n \"use strict\";\n var carpetAttrs = require_attributes63();\n var addOpacity = require_color().addOpacity;\n var Registry = require_registry();\n var Lib = require_lib();\n var handleTickValueDefaults = require_tick_value_defaults();\n var handleTickLabelDefaults = require_tick_label_defaults();\n var handlePrefixSuffixDefaults = require_prefix_suffix_defaults();\n var handleCategoryOrderDefaults = require_category_order_defaults();\n var setConvert = require_set_convert();\n var autoType = require_axis_autotype();\n module.exports = function handleAxisDefaults(containerIn, containerOut, options) {\n var letter = options.letter;\n var font = options.font || {};\n var attributes = carpetAttrs[letter + \"axis\"];\n function coerce(attr, dflt) {\n return Lib.coerce(containerIn, containerOut, attributes, attr, dflt);\n }\n function coerce2(attr, dflt) {\n return Lib.coerce2(containerIn, containerOut, attributes, attr, dflt);\n }\n if (options.name) {\n containerOut._name = options.name;\n containerOut._id = options.name;\n }\n coerce(\"autotypenumbers\", options.autotypenumbersDflt);\n var axType = coerce(\"type\");\n if (axType === \"-\") {\n if (options.data) setAutoType(containerOut, options.data);\n if (containerOut.type === \"-\") {\n containerOut.type = \"linear\";\n } else {\n axType = containerIn.type = containerOut.type;\n }\n }\n coerce(\"smoothing\");\n coerce(\"cheatertype\");\n coerce(\"showticklabels\");\n coerce(\"labelprefix\", letter + \" = \");\n coerce(\"labelsuffix\");\n coerce(\"showtickprefix\");\n coerce(\"showticksuffix\");\n coerce(\"separatethousands\");\n coerce(\"tickformat\");\n coerce(\"exponentformat\");\n coerce(\"minexponent\");\n coerce(\"showexponent\");\n coerce(\"categoryorder\");\n coerce(\"tickmode\");\n coerce(\"tickvals\");\n coerce(\"ticktext\");\n coerce(\"tick0\");\n coerce(\"dtick\");\n if (containerOut.tickmode === \"array\") {\n coerce(\"arraytick0\");\n coerce(\"arraydtick\");\n }\n coerce(\"labelpadding\");\n containerOut._hovertitle = letter;\n if (axType === \"date\") {\n var handleCalendarDefaults = Registry.getComponentMethod(\"calendars\", \"handleDefaults\");\n handleCalendarDefaults(containerIn, containerOut, \"calendar\", options.calendar);\n }\n setConvert(containerOut, options.fullLayout);\n containerOut.c2p = Lib.identity;\n var dfltColor = coerce(\"color\", options.dfltColor);\n var dfltFontColor = dfltColor === containerIn.color ? dfltColor : font.color;\n var title = coerce(\"title.text\");\n if (title) {\n Lib.coerceFont(coerce, \"title.font\", font, { overrideDflt: {\n size: Lib.bigFont(font.size),\n color: dfltFontColor\n } });\n coerce(\"title.offset\");\n }\n coerce(\"tickangle\");\n var autoRange = coerce(\"autorange\", !containerOut.isValidRange(containerIn.range));\n if (autoRange) coerce(\"rangemode\");\n coerce(\"range\");\n containerOut.cleanRange();\n coerce(\"fixedrange\");\n handleTickValueDefaults(containerIn, containerOut, coerce, axType);\n handlePrefixSuffixDefaults(containerIn, containerOut, coerce, axType, options);\n handleTickLabelDefaults(containerIn, containerOut, coerce, axType, options);\n handleCategoryOrderDefaults(containerIn, containerOut, coerce, {\n data: options.data,\n dataAttr: letter\n });\n var gridColor = coerce2(\"gridcolor\", addOpacity(dfltColor, 0.3));\n var gridWidth = coerce2(\"gridwidth\");\n var gridDash = coerce2(\"griddash\");\n var showGrid = coerce(\"showgrid\");\n if (!showGrid) {\n delete containerOut.gridcolor;\n delete containerOut.gridwidth;\n delete containerOut.griddash;\n }\n var startLineColor = coerce2(\"startlinecolor\", dfltColor);\n var startLineWidth = coerce2(\"startlinewidth\", gridWidth);\n var showStartLine = coerce(\"startline\", containerOut.showgrid || !!startLineColor || !!startLineWidth);\n if (!showStartLine) {\n delete containerOut.startlinecolor;\n delete containerOut.startlinewidth;\n }\n var endLineColor = coerce2(\"endlinecolor\", dfltColor);\n var endLineWidth = coerce2(\"endlinewidth\", gridWidth);\n var showEndLine = coerce(\"endline\", containerOut.showgrid || !!endLineColor || !!endLineWidth);\n if (!showEndLine) {\n delete containerOut.endlinecolor;\n delete containerOut.endlinewidth;\n }\n if (!showGrid) {\n delete containerOut.gridcolor;\n delete containerOut.gridwidth;\n delete containerOut.griddash;\n } else {\n coerce(\"minorgridcount\");\n coerce(\"minorgridwidth\", gridWidth);\n coerce(\"minorgriddash\", gridDash);\n coerce(\"minorgridcolor\", addOpacity(gridColor, 0.06));\n if (!containerOut.minorgridcount) {\n delete containerOut.minorgridwidth;\n delete containerOut.minorgriddash;\n delete containerOut.minorgridcolor;\n }\n }\n if (containerOut.showticklabels === \"none\") {\n delete containerOut.tickfont;\n delete containerOut.tickangle;\n delete containerOut.showexponent;\n delete containerOut.exponentformat;\n delete containerOut.minexponent;\n delete containerOut.tickformat;\n delete containerOut.showticksuffix;\n delete containerOut.showtickprefix;\n }\n if (!containerOut.showticksuffix) {\n delete containerOut.ticksuffix;\n }\n if (!containerOut.showtickprefix) {\n delete containerOut.tickprefix;\n }\n coerce(\"tickmode\");\n return containerOut;\n };\n function setAutoType(ax, data) {\n if (ax.type !== \"-\") return;\n var id = ax._id;\n var axLetter = id.charAt(0);\n var calAttr = axLetter + \"calendar\";\n var calendar = ax[calAttr];\n ax.type = autoType(data, calendar, {\n autotypenumbers: ax.autotypenumbers\n });\n }\n }\n });\n\n // src/traces/carpet/ab_defaults.js\n var require_ab_defaults = __commonJS({\n \"src/traces/carpet/ab_defaults.js\"(exports, module) {\n \"use strict\";\n var handleAxisDefaults = require_axis_defaults3();\n var Template = require_plot_template();\n module.exports = function handleABDefaults(traceIn, traceOut, fullLayout, coerce, dfltColor) {\n var a = coerce(\"a\");\n if (!a) {\n coerce(\"da\");\n coerce(\"a0\");\n }\n var b = coerce(\"b\");\n if (!b) {\n coerce(\"db\");\n coerce(\"b0\");\n }\n mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor);\n };\n function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) {\n var axesList = [\"aaxis\", \"baxis\"];\n axesList.forEach(function(axName) {\n var axLetter = axName.charAt(0);\n var axIn = traceIn[axName] || {};\n var axOut = Template.newContainer(traceOut, axName);\n var defaultOptions = {\n noAutotickangles: true,\n noTicklabelshift: true,\n noTicklabelstandoff: true,\n noTicklabelstep: true,\n tickfont: \"x\",\n id: axLetter + \"axis\",\n letter: axLetter,\n font: traceOut.font,\n name: axName,\n data: traceIn[axLetter],\n calendar: traceOut.calendar,\n dfltColor,\n bgColor: fullLayout.paper_bgcolor,\n autotypenumbersDflt: fullLayout.autotypenumbers,\n fullLayout\n };\n handleAxisDefaults(axIn, axOut, defaultOptions);\n axOut._categories = axOut._categories || [];\n if (!traceIn[axName] && axIn.type !== \"-\") {\n traceIn[axName] = { type: axIn.type };\n }\n });\n }\n }\n });\n\n // src/traces/carpet/defaults.js\n var require_defaults59 = __commonJS({\n \"src/traces/carpet/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleXYDefaults = require_xy_defaults2();\n var handleABDefaults = require_ab_defaults();\n var attributes = require_attributes63();\n var colorAttrs = require_attributes3();\n module.exports = function supplyDefaults(traceIn, traceOut, dfltColor, fullLayout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n traceOut._clipPathId = \"clip\" + traceOut.uid + \"carpet\";\n var defaultColor = coerce(\"color\", colorAttrs.defaultLine);\n Lib.coerceFont(coerce, \"font\", fullLayout.font);\n coerce(\"carpet\");\n handleABDefaults(traceIn, traceOut, fullLayout, coerce, defaultColor);\n if (!traceOut.a || !traceOut.b) {\n traceOut.visible = false;\n return;\n }\n if (traceOut.a.length < 3) {\n traceOut.aaxis.smoothing = 0;\n }\n if (traceOut.b.length < 3) {\n traceOut.baxis.smoothing = 0;\n }\n var validData = handleXYDefaults(traceIn, traceOut, coerce);\n if (!validData) {\n traceOut.visible = false;\n }\n if (traceOut._cheater) {\n coerce(\"cheaterslope\");\n }\n coerce(\"zorder\");\n };\n }\n });\n\n // src/traces/carpet/map_1d_array.js\n var require_map_1d_array = __commonJS({\n \"src/traces/carpet/map_1d_array.js\"(exports, module) {\n \"use strict\";\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n module.exports = function mapArray(out, data, func) {\n var i;\n if (!isArrayOrTypedArray(out)) {\n out = [];\n } else if (out.length > data.length) {\n out = out.slice(0, data.length);\n }\n for (i = 0; i < data.length; i++) {\n out[i] = func(data[i]);\n }\n return out;\n };\n }\n });\n\n // src/traces/carpet/makepath.js\n var require_makepath = __commonJS({\n \"src/traces/carpet/makepath.js\"(exports, module) {\n \"use strict\";\n module.exports = function makePath(xp, yp, isBicubic) {\n if (xp.length === 0) return \"\";\n var i;\n var path = [];\n var stride = isBicubic ? 3 : 1;\n for (i = 0; i < xp.length; i += stride) {\n path.push(xp[i] + \",\" + yp[i]);\n if (isBicubic && i < xp.length - stride) {\n path.push(\"C\");\n path.push([\n xp[i + 1] + \",\" + yp[i + 1],\n xp[i + 2] + \",\" + yp[i + 2] + \" \"\n ].join(\" \"));\n }\n }\n return path.join(isBicubic ? \"\" : \"L\");\n };\n }\n });\n\n // src/traces/carpet/orient_text.js\n var require_orient_text = __commonJS({\n \"src/traces/carpet/orient_text.js\"(exports, module) {\n \"use strict\";\n module.exports = function orientText(trace, xaxis, yaxis, xy, dxy, refDxy) {\n var dx = dxy[0] * trace.dpdx(xaxis);\n var dy = dxy[1] * trace.dpdy(yaxis);\n var flip = 1;\n var offsetMultiplier = 1;\n if (refDxy) {\n var l1 = Math.sqrt(dxy[0] * dxy[0] + dxy[1] * dxy[1]);\n var l2 = Math.sqrt(refDxy[0] * refDxy[0] + refDxy[1] * refDxy[1]);\n var dot = (dxy[0] * refDxy[0] + dxy[1] * refDxy[1]) / l1 / l2;\n offsetMultiplier = Math.max(0, dot);\n }\n var angle = Math.atan2(dy, dx) * 180 / Math.PI;\n if (angle < -90) {\n angle += 180;\n flip = -flip;\n } else if (angle > 90) {\n angle -= 180;\n flip = -flip;\n }\n return {\n angle,\n flip,\n p: trace.c2p(xy, xaxis, yaxis),\n offsetMultplier: offsetMultiplier\n };\n };\n }\n });\n\n // src/traces/carpet/plot.js\n var require_plot32 = __commonJS({\n \"src/traces/carpet/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Drawing = require_drawing();\n var map1dArray = require_map_1d_array();\n var makepath = require_makepath();\n var orientText = require_orient_text();\n var svgTextUtils = require_svg_text_utils();\n var Lib = require_lib();\n var strRotate = Lib.strRotate;\n var strTranslate = Lib.strTranslate;\n var alignmentConstants = require_alignment();\n module.exports = function plot(gd, plotinfo, cdcarpet, carpetLayer) {\n var isStatic = gd._context.staticPlot;\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var fullLayout = gd._fullLayout;\n var clipLayer = fullLayout._clips;\n Lib.makeTraceGroups(carpetLayer, cdcarpet, \"trace\").each(function(cd) {\n var axisLayer = d3.select(this);\n var cd0 = cd[0];\n var trace = cd0.trace;\n var aax = trace.aaxis;\n var bax = trace.baxis;\n var minorLayer = Lib.ensureSingle(axisLayer, \"g\", \"minorlayer\");\n var majorLayer = Lib.ensureSingle(axisLayer, \"g\", \"majorlayer\");\n var boundaryLayer = Lib.ensureSingle(axisLayer, \"g\", \"boundarylayer\");\n var labelLayer = Lib.ensureSingle(axisLayer, \"g\", \"labellayer\");\n axisLayer.style(\"opacity\", trace.opacity);\n drawGridLines(xa, ya, majorLayer, aax, \"a\", aax._gridlines, true, isStatic);\n drawGridLines(xa, ya, majorLayer, bax, \"b\", bax._gridlines, true, isStatic);\n drawGridLines(xa, ya, minorLayer, aax, \"a\", aax._minorgridlines, true, isStatic);\n drawGridLines(xa, ya, minorLayer, bax, \"b\", bax._minorgridlines, true, isStatic);\n drawGridLines(xa, ya, boundaryLayer, aax, \"a-boundary\", aax._boundarylines, isStatic);\n drawGridLines(xa, ya, boundaryLayer, bax, \"b-boundary\", bax._boundarylines, isStatic);\n var labelOrientationA = drawAxisLabels(gd, xa, ya, trace, cd0, labelLayer, aax._labels, \"a-label\");\n var labelOrientationB = drawAxisLabels(gd, xa, ya, trace, cd0, labelLayer, bax._labels, \"b-label\");\n drawAxisTitles(gd, labelLayer, trace, cd0, xa, ya, labelOrientationA, labelOrientationB);\n drawClipPath(trace, cd0, clipLayer, xa, ya);\n });\n };\n function drawClipPath(trace, t, layer, xaxis, yaxis) {\n var seg, xp, yp, i;\n var clip = layer.select(\"#\" + trace._clipPathId);\n if (!clip.size()) {\n clip = layer.append(\"clipPath\").classed(\"carpetclip\", true);\n }\n var path = Lib.ensureSingle(clip, \"path\", \"carpetboundary\");\n var segments = t.clipsegments;\n var segs = [];\n for (i = 0; i < segments.length; i++) {\n seg = segments[i];\n xp = map1dArray([], seg.x, xaxis.c2p);\n yp = map1dArray([], seg.y, yaxis.c2p);\n segs.push(makepath(xp, yp, seg.bicubic));\n }\n var clipPathData = \"M\" + segs.join(\"L\") + \"Z\";\n clip.attr(\"id\", trace._clipPathId);\n path.attr(\"d\", clipPathData);\n }\n function drawGridLines(xaxis, yaxis, layer, axis, axisLetter, gridlines, isStatic) {\n var lineClass = \"const-\" + axisLetter + \"-lines\";\n var gridJoin = layer.selectAll(\".\" + lineClass).data(gridlines);\n gridJoin.enter().append(\"path\").classed(lineClass, true).style(\"vector-effect\", isStatic ? \"none\" : \"non-scaling-stroke\");\n gridJoin.each(function(d) {\n var gridline = d;\n var x = gridline.x;\n var y = gridline.y;\n var xp = map1dArray([], x, xaxis.c2p);\n var yp = map1dArray([], y, yaxis.c2p);\n var path = \"M\" + makepath(xp, yp, gridline.smoothing);\n var el = d3.select(this);\n el.attr(\"d\", path).style(\"stroke-width\", gridline.width).style(\"stroke\", gridline.color).style(\"stroke-dasharray\", Drawing.dashStyle(gridline.dash, gridline.width)).style(\"fill\", \"none\");\n });\n gridJoin.exit().remove();\n }\n function drawAxisLabels(gd, xaxis, yaxis, trace, t, layer, labels, labelClass) {\n var labelJoin = layer.selectAll(\"text.\" + labelClass).data(labels);\n labelJoin.enter().append(\"text\").classed(labelClass, true);\n var maxExtent = 0;\n var labelOrientation = {};\n labelJoin.each(function(label, i) {\n var orientation;\n if (label.axis.tickangle === \"auto\") {\n orientation = orientText(trace, xaxis, yaxis, label.xy, label.dxy);\n } else {\n var angle = (label.axis.tickangle + 180) * Math.PI / 180;\n orientation = orientText(trace, xaxis, yaxis, label.xy, [Math.cos(angle), Math.sin(angle)]);\n }\n if (!i) {\n labelOrientation = { angle: orientation.angle, flip: orientation.flip };\n }\n var direction = (label.endAnchor ? -1 : 1) * orientation.flip;\n var labelEl = d3.select(this).attr({\n \"text-anchor\": direction > 0 ? \"start\" : \"end\",\n \"data-notex\": 1\n }).call(Drawing.font, label.font).text(label.text).call(svgTextUtils.convertToTspans, gd);\n var bbox = Drawing.bBox(this);\n labelEl.attr(\n \"transform\",\n // Translate to the correct point:\n strTranslate(orientation.p[0], orientation.p[1]) + // Rotate to line up with grid line tangent:\n strRotate(orientation.angle) + // Adjust the baseline and indentation:\n strTranslate(label.axis.labelpadding * direction, bbox.height * 0.3)\n );\n maxExtent = Math.max(maxExtent, bbox.width + label.axis.labelpadding);\n });\n labelJoin.exit().remove();\n labelOrientation.maxExtent = maxExtent;\n return labelOrientation;\n }\n function drawAxisTitles(gd, layer, trace, t, xa, ya, labelOrientationA, labelOrientationB) {\n var a, b, xy, dxy;\n var aMin = Lib.aggNums(Math.min, null, trace.a);\n var aMax = Lib.aggNums(Math.max, null, trace.a);\n var bMin = Lib.aggNums(Math.min, null, trace.b);\n var bMax = Lib.aggNums(Math.max, null, trace.b);\n a = 0.5 * (aMin + aMax);\n b = bMin;\n xy = trace.ab2xy(a, b, true);\n dxy = trace.dxyda_rough(a, b);\n if (labelOrientationA.angle === void 0) {\n Lib.extendFlat(labelOrientationA, orientText(trace, xa, ya, xy, trace.dxydb_rough(a, b)));\n }\n drawAxisTitle(gd, layer, trace, t, xy, dxy, trace.aaxis, xa, ya, labelOrientationA, \"a-title\");\n a = aMin;\n b = 0.5 * (bMin + bMax);\n xy = trace.ab2xy(a, b, true);\n dxy = trace.dxydb_rough(a, b);\n if (labelOrientationB.angle === void 0) {\n Lib.extendFlat(labelOrientationB, orientText(trace, xa, ya, xy, trace.dxyda_rough(a, b)));\n }\n drawAxisTitle(gd, layer, trace, t, xy, dxy, trace.baxis, xa, ya, labelOrientationB, \"b-title\");\n }\n var lineSpacing = alignmentConstants.LINE_SPACING;\n var midShift = (1 - alignmentConstants.MID_SHIFT) / lineSpacing + 1;\n function drawAxisTitle(gd, layer, trace, t, xy, dxy, axis, xa, ya, labelOrientation, labelClass) {\n var data = [];\n if (axis.title.text) data.push(axis.title.text);\n var titleJoin = layer.selectAll(\"text.\" + labelClass).data(data);\n var offset = labelOrientation.maxExtent;\n titleJoin.enter().append(\"text\").classed(labelClass, true);\n titleJoin.each(function() {\n var orientation = orientText(trace, xa, ya, xy, dxy);\n if ([\"start\", \"both\"].indexOf(axis.showticklabels) === -1) {\n offset = 0;\n }\n var titleSize = axis.title.font.size;\n offset += titleSize + axis.title.offset;\n var labelNorm = labelOrientation.angle + (labelOrientation.flip < 0 ? 180 : 0);\n var angleDiff = (labelNorm - orientation.angle + 450) % 360;\n var reverseTitle = angleDiff > 90 && angleDiff < 270;\n var el = d3.select(this);\n el.text(axis.title.text).call(svgTextUtils.convertToTspans, gd);\n if (reverseTitle) {\n offset = (-svgTextUtils.lineCount(el) + midShift) * lineSpacing * titleSize - offset;\n }\n el.attr(\n \"transform\",\n strTranslate(orientation.p[0], orientation.p[1]) + strRotate(orientation.angle) + strTranslate(0, offset)\n ).attr(\"text-anchor\", \"middle\").call(Drawing.font, axis.title.font);\n });\n titleJoin.exit().remove();\n }\n }\n });\n\n // src/traces/carpet/cheater_basis.js\n var require_cheater_basis = __commonJS({\n \"src/traces/carpet/cheater_basis.js\"(exports, module) {\n \"use strict\";\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n module.exports = function(a, b, cheaterslope) {\n var i, j, ascal, bscal, aval, bval;\n var data = [];\n var na = isArrayOrTypedArray(a) ? a.length : a;\n var nb = isArrayOrTypedArray(b) ? b.length : b;\n var adata = isArrayOrTypedArray(a) ? a : null;\n var bdata = isArrayOrTypedArray(b) ? b : null;\n if (adata) {\n ascal = (adata.length - 1) / (adata[adata.length - 1] - adata[0]) / (na - 1);\n }\n if (bdata) {\n bscal = (bdata.length - 1) / (bdata[bdata.length - 1] - bdata[0]) / (nb - 1);\n }\n var xval;\n var xmin = Infinity;\n var xmax = -Infinity;\n for (j = 0; j < nb; j++) {\n data[j] = [];\n bval = bdata ? (bdata[j] - bdata[0]) * bscal : j / (nb - 1);\n for (i = 0; i < na; i++) {\n aval = adata ? (adata[i] - adata[0]) * ascal : i / (na - 1);\n xval = aval - bval * cheaterslope;\n xmin = Math.min(xval, xmin);\n xmax = Math.max(xval, xmax);\n data[j][i] = xval;\n }\n }\n var slope = 1 / (xmax - xmin);\n var offset = -xmin * slope;\n for (j = 0; j < nb; j++) {\n for (i = 0; i < na; i++) {\n data[j][i] = slope * data[j][i] + offset;\n }\n }\n return data;\n };\n }\n });\n\n // src/traces/carpet/array_minmax.js\n var require_array_minmax = __commonJS({\n \"src/traces/carpet/array_minmax.js\"(exports, module) {\n \"use strict\";\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n module.exports = function(a) {\n return minMax(a, 0);\n };\n function minMax(a, depth) {\n if (!isArrayOrTypedArray(a) || depth >= 10) {\n return null;\n }\n var min = Infinity;\n var max = -Infinity;\n var n = a.length;\n for (var i = 0; i < n; i++) {\n var datum = a[i];\n if (isArrayOrTypedArray(datum)) {\n var result = minMax(datum, depth + 1);\n if (result) {\n min = Math.min(result[0], min);\n max = Math.max(result[1], max);\n }\n } else {\n min = Math.min(datum, min);\n max = Math.max(datum, max);\n }\n }\n return [min, max];\n }\n }\n });\n\n // src/traces/carpet/calc_gridlines.js\n var require_calc_gridlines = __commonJS({\n \"src/traces/carpet/calc_gridlines.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n var extendFlat = require_extend().extendFlat;\n module.exports = function calcGridlines(trace, axisLetter, crossAxisLetter) {\n var i, j, j0;\n var eps, bounds, n1, n2, n, value, v;\n var j1, v0, v1, d;\n var data = trace[\"_\" + axisLetter];\n var axis = trace[axisLetter + \"axis\"];\n var gridlines = axis._gridlines = [];\n var minorgridlines = axis._minorgridlines = [];\n var boundarylines = axis._boundarylines = [];\n var crossData = trace[\"_\" + crossAxisLetter];\n var crossAxis = trace[crossAxisLetter + \"axis\"];\n if (axis.tickmode === \"array\") {\n axis.tickvals = data.slice();\n }\n var xcp = trace._xctrl;\n var ycp = trace._yctrl;\n var nea = xcp[0].length;\n var neb = xcp.length;\n var na = trace._a.length;\n var nb = trace._b.length;\n Axes.prepTicks(axis);\n if (axis.tickmode === \"array\") delete axis.tickvals;\n var stride = axis.smoothing ? 3 : 1;\n function constructValueGridline(value2) {\n var i2, j2, j02, tj, pxy, i0, ti, xy, dxydi0, dxydi1, dxydj0, dxydj1;\n var xpoints = [];\n var ypoints = [];\n var ret = {};\n if (axisLetter === \"b\") {\n j2 = trace.b2j(value2);\n j02 = Math.floor(Math.max(0, Math.min(nb - 2, j2)));\n tj = j2 - j02;\n ret.length = nb;\n ret.crossLength = na;\n ret.xy = function(i3) {\n return trace.evalxy([], i3, j2);\n };\n ret.dxy = function(i02, ti2) {\n return trace.dxydi([], i02, j02, ti2, tj);\n };\n for (i2 = 0; i2 < na; i2++) {\n i0 = Math.min(na - 2, i2);\n ti = i2 - i0;\n xy = trace.evalxy([], i2, j2);\n if (crossAxis.smoothing && i2 > 0) {\n dxydi0 = trace.dxydi([], i2 - 1, j02, 0, tj);\n xpoints.push(pxy[0] + dxydi0[0] / 3);\n ypoints.push(pxy[1] + dxydi0[1] / 3);\n dxydi1 = trace.dxydi([], i2 - 1, j02, 1, tj);\n xpoints.push(xy[0] - dxydi1[0] / 3);\n ypoints.push(xy[1] - dxydi1[1] / 3);\n }\n xpoints.push(xy[0]);\n ypoints.push(xy[1]);\n pxy = xy;\n }\n } else {\n i2 = trace.a2i(value2);\n i0 = Math.floor(Math.max(0, Math.min(na - 2, i2)));\n ti = i2 - i0;\n ret.length = na;\n ret.crossLength = nb;\n ret.xy = function(j3) {\n return trace.evalxy([], i2, j3);\n };\n ret.dxy = function(j03, tj2) {\n return trace.dxydj([], i0, j03, ti, tj2);\n };\n for (j2 = 0; j2 < nb; j2++) {\n j02 = Math.min(nb - 2, j2);\n tj = j2 - j02;\n xy = trace.evalxy([], i2, j2);\n if (crossAxis.smoothing && j2 > 0) {\n dxydj0 = trace.dxydj([], i0, j2 - 1, ti, 0);\n xpoints.push(pxy[0] + dxydj0[0] / 3);\n ypoints.push(pxy[1] + dxydj0[1] / 3);\n dxydj1 = trace.dxydj([], i0, j2 - 1, ti, 1);\n xpoints.push(xy[0] - dxydj1[0] / 3);\n ypoints.push(xy[1] - dxydj1[1] / 3);\n }\n xpoints.push(xy[0]);\n ypoints.push(xy[1]);\n pxy = xy;\n }\n }\n ret.axisLetter = axisLetter;\n ret.axis = axis;\n ret.crossAxis = crossAxis;\n ret.value = value2;\n ret.constvar = crossAxisLetter;\n ret.index = n;\n ret.x = xpoints;\n ret.y = ypoints;\n ret.smoothing = crossAxis.smoothing;\n return ret;\n }\n function constructArrayGridline(idx) {\n var j2, i0, j02, ti, tj;\n var xpoints = [];\n var ypoints = [];\n var ret = {};\n ret.length = data.length;\n ret.crossLength = crossData.length;\n if (axisLetter === \"b\") {\n j02 = Math.max(0, Math.min(nb - 2, idx));\n tj = Math.min(1, Math.max(0, idx - j02));\n ret.xy = function(i2) {\n return trace.evalxy([], i2, idx);\n };\n ret.dxy = function(i02, ti2) {\n return trace.dxydi([], i02, j02, ti2, tj);\n };\n for (j2 = 0; j2 < nea; j2++) {\n xpoints[j2] = xcp[idx * stride][j2];\n ypoints[j2] = ycp[idx * stride][j2];\n }\n } else {\n i0 = Math.max(0, Math.min(na - 2, idx));\n ti = Math.min(1, Math.max(0, idx - i0));\n ret.xy = function(j3) {\n return trace.evalxy([], idx, j3);\n };\n ret.dxy = function(j03, tj2) {\n return trace.dxydj([], i0, j03, ti, tj2);\n };\n for (j2 = 0; j2 < neb; j2++) {\n xpoints[j2] = xcp[j2][idx * stride];\n ypoints[j2] = ycp[j2][idx * stride];\n }\n }\n ret.axisLetter = axisLetter;\n ret.axis = axis;\n ret.crossAxis = crossAxis;\n ret.value = data[idx];\n ret.constvar = crossAxisLetter;\n ret.index = idx;\n ret.x = xpoints;\n ret.y = ypoints;\n ret.smoothing = crossAxis.smoothing;\n return ret;\n }\n if (axis.tickmode === \"array\") {\n eps = 5e-15;\n bounds = [\n Math.floor((data.length - 1 - axis.arraytick0) / axis.arraydtick * (1 + eps)),\n Math.ceil(-axis.arraytick0 / axis.arraydtick / (1 + eps))\n ].sort(function(a, b) {\n return a - b;\n });\n n1 = bounds[0] - 1;\n n2 = bounds[1] + 1;\n for (n = n1; n < n2; n++) {\n j = axis.arraytick0 + axis.arraydtick * n;\n if (j < 0 || j > data.length - 1) continue;\n gridlines.push(extendFlat(constructArrayGridline(j), {\n color: axis.gridcolor,\n width: axis.gridwidth,\n dash: axis.griddash\n }));\n }\n for (n = n1; n < n2; n++) {\n j0 = axis.arraytick0 + axis.arraydtick * n;\n j1 = Math.min(j0 + axis.arraydtick, data.length - 1);\n if (j0 < 0 || j0 > data.length - 1) continue;\n if (j1 < 0 || j1 > data.length - 1) continue;\n v0 = data[j0];\n v1 = data[j1];\n for (i = 0; i < axis.minorgridcount; i++) {\n d = j1 - j0;\n if (d <= 0) continue;\n v = v0 + (v1 - v0) * (i + 1) / (axis.minorgridcount + 1) * (axis.arraydtick / d);\n if (v < data[0] || v > data[data.length - 1]) continue;\n minorgridlines.push(extendFlat(constructValueGridline(v), {\n color: axis.minorgridcolor,\n width: axis.minorgridwidth,\n dash: axis.minorgriddash\n }));\n }\n }\n if (axis.startline) {\n boundarylines.push(extendFlat(constructArrayGridline(0), {\n color: axis.startlinecolor,\n width: axis.startlinewidth\n }));\n }\n if (axis.endline) {\n boundarylines.push(extendFlat(constructArrayGridline(data.length - 1), {\n color: axis.endlinecolor,\n width: axis.endlinewidth\n }));\n }\n } else {\n eps = 5e-15;\n bounds = [\n Math.floor((data[data.length - 1] - axis.tick0) / axis.dtick * (1 + eps)),\n Math.ceil((data[0] - axis.tick0) / axis.dtick / (1 + eps))\n ].sort(function(a, b) {\n return a - b;\n });\n n1 = bounds[0];\n n2 = bounds[1];\n for (n = n1; n <= n2; n++) {\n value = axis.tick0 + axis.dtick * n;\n gridlines.push(extendFlat(constructValueGridline(value), {\n color: axis.gridcolor,\n width: axis.gridwidth,\n dash: axis.griddash\n }));\n }\n for (n = n1 - 1; n < n2 + 1; n++) {\n value = axis.tick0 + axis.dtick * n;\n for (i = 0; i < axis.minorgridcount; i++) {\n v = value + axis.dtick * (i + 1) / (axis.minorgridcount + 1);\n if (v < data[0] || v > data[data.length - 1]) continue;\n minorgridlines.push(extendFlat(constructValueGridline(v), {\n color: axis.minorgridcolor,\n width: axis.minorgridwidth,\n dash: axis.minorgriddash\n }));\n }\n }\n if (axis.startline) {\n boundarylines.push(extendFlat(constructValueGridline(data[0]), {\n color: axis.startlinecolor,\n width: axis.startlinewidth\n }));\n }\n if (axis.endline) {\n boundarylines.push(extendFlat(constructValueGridline(data[data.length - 1]), {\n color: axis.endlinecolor,\n width: axis.endlinewidth\n }));\n }\n }\n };\n }\n });\n\n // src/traces/carpet/calc_labels.js\n var require_calc_labels = __commonJS({\n \"src/traces/carpet/calc_labels.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n var extendFlat = require_extend().extendFlat;\n module.exports = function calcLabels(trace, axis) {\n var i, tobj, prefix, suffix, gridline;\n var labels = axis._labels = [];\n var gridlines = axis._gridlines;\n for (i = 0; i < gridlines.length; i++) {\n gridline = gridlines[i];\n if ([\"start\", \"both\"].indexOf(axis.showticklabels) !== -1) {\n tobj = Axes.tickText(axis, gridline.value);\n extendFlat(tobj, {\n prefix,\n suffix,\n endAnchor: true,\n xy: gridline.xy(0),\n dxy: gridline.dxy(0, 0),\n axis: gridline.axis,\n length: gridline.crossAxis.length,\n font: gridline.axis.tickfont,\n isFirst: i === 0,\n isLast: i === gridlines.length - 1\n });\n labels.push(tobj);\n }\n if ([\"end\", \"both\"].indexOf(axis.showticklabels) !== -1) {\n tobj = Axes.tickText(axis, gridline.value);\n extendFlat(tobj, {\n endAnchor: false,\n xy: gridline.xy(gridline.crossLength - 1),\n dxy: gridline.dxy(gridline.crossLength - 2, 1),\n axis: gridline.axis,\n length: gridline.crossAxis.length,\n font: gridline.axis.tickfont,\n isFirst: i === 0,\n isLast: i === gridlines.length - 1\n });\n labels.push(tobj);\n }\n }\n };\n }\n });\n\n // src/traces/carpet/calc_clippath.js\n var require_calc_clippath = __commonJS({\n \"src/traces/carpet/calc_clippath.js\"(exports, module) {\n \"use strict\";\n module.exports = function makeClipPath(xctrl, yctrl, aax, bax) {\n var i, x, y;\n var segments = [];\n var asmoothing = !!aax.smoothing;\n var bsmoothing = !!bax.smoothing;\n var nea1 = xctrl[0].length - 1;\n var neb1 = xctrl.length - 1;\n for (i = 0, x = [], y = []; i <= nea1; i++) {\n x[i] = xctrl[0][i];\n y[i] = yctrl[0][i];\n }\n segments.push({ x, y, bicubic: asmoothing });\n for (i = 0, x = [], y = []; i <= neb1; i++) {\n x[i] = xctrl[i][nea1];\n y[i] = yctrl[i][nea1];\n }\n segments.push({ x, y, bicubic: bsmoothing });\n for (i = nea1, x = [], y = []; i >= 0; i--) {\n x[nea1 - i] = xctrl[neb1][i];\n y[nea1 - i] = yctrl[neb1][i];\n }\n segments.push({ x, y, bicubic: asmoothing });\n for (i = neb1, x = [], y = []; i >= 0; i--) {\n x[neb1 - i] = xctrl[i][0];\n y[neb1 - i] = yctrl[i][0];\n }\n segments.push({ x, y, bicubic: bsmoothing });\n return segments;\n };\n }\n });\n\n // src/traces/carpet/smooth_fill_2d_array.js\n var require_smooth_fill_2d_array = __commonJS({\n \"src/traces/carpet/smooth_fill_2d_array.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n module.exports = function smoothFill2dArray(data, a, b) {\n var i, j, k;\n var ip = [];\n var jp = [];\n var ni = data[0].length;\n var nj = data.length;\n function avgSurrounding(i2, j2) {\n var sum = 0;\n var val;\n var cnt = 0;\n if (i2 > 0 && (val = data[j2][i2 - 1]) !== void 0) {\n cnt++;\n sum += val;\n }\n if (i2 < ni - 1 && (val = data[j2][i2 + 1]) !== void 0) {\n cnt++;\n sum += val;\n }\n if (j2 > 0 && (val = data[j2 - 1][i2]) !== void 0) {\n cnt++;\n sum += val;\n }\n if (j2 < nj - 1 && (val = data[j2 + 1][i2]) !== void 0) {\n cnt++;\n sum += val;\n }\n return sum / Math.max(1, cnt);\n }\n var dmax = 0;\n for (i = 0; i < ni; i++) {\n for (j = 0; j < nj; j++) {\n if (data[j][i] === void 0) {\n ip.push(i);\n jp.push(j);\n data[j][i] = avgSurrounding(i, j);\n }\n dmax = Math.max(dmax, Math.abs(data[j][i]));\n }\n }\n if (!ip.length) return data;\n var dxp, dxm, dap, dam, dbp, dbm, c, d, diff, reldiff, overrelaxation;\n var tol = 1e-5;\n var resid = 0;\n var itermax = 100;\n var iter = 0;\n var n = ip.length;\n do {\n resid = 0;\n for (k = 0; k < n; k++) {\n i = ip[k];\n j = jp[k];\n var boundaryCnt = 0;\n var newVal = 0;\n var d0, d1, x0, x1, i0, j0;\n if (i === 0) {\n i0 = Math.min(ni - 1, 2);\n x0 = a[i0];\n x1 = a[1];\n d0 = data[j][i0];\n d1 = data[j][1];\n newVal += d1 + (d1 - d0) * (a[0] - x1) / (x1 - x0);\n boundaryCnt++;\n } else if (i === ni - 1) {\n i0 = Math.max(0, ni - 3);\n x0 = a[i0];\n x1 = a[ni - 2];\n d0 = data[j][i0];\n d1 = data[j][ni - 2];\n newVal += d1 + (d1 - d0) * (a[ni - 1] - x1) / (x1 - x0);\n boundaryCnt++;\n }\n if ((i === 0 || i === ni - 1) && (j > 0 && j < nj - 1)) {\n dxp = b[j + 1] - b[j];\n dxm = b[j] - b[j - 1];\n newVal += (dxm * data[j + 1][i] + dxp * data[j - 1][i]) / (dxm + dxp);\n boundaryCnt++;\n }\n if (j === 0) {\n j0 = Math.min(nj - 1, 2);\n x0 = b[j0];\n x1 = b[1];\n d0 = data[j0][i];\n d1 = data[1][i];\n newVal += d1 + (d1 - d0) * (b[0] - x1) / (x1 - x0);\n boundaryCnt++;\n } else if (j === nj - 1) {\n j0 = Math.max(0, nj - 3);\n x0 = b[j0];\n x1 = b[nj - 2];\n d0 = data[j0][i];\n d1 = data[nj - 2][i];\n newVal += d1 + (d1 - d0) * (b[nj - 1] - x1) / (x1 - x0);\n boundaryCnt++;\n }\n if ((j === 0 || j === nj - 1) && (i > 0 && i < ni - 1)) {\n dxp = a[i + 1] - a[i];\n dxm = a[i] - a[i - 1];\n newVal += (dxm * data[j][i + 1] + dxp * data[j][i - 1]) / (dxm + dxp);\n boundaryCnt++;\n }\n if (!boundaryCnt) {\n dap = a[i + 1] - a[i];\n dam = a[i] - a[i - 1];\n dbp = b[j + 1] - b[j];\n dbm = b[j] - b[j - 1];\n c = dap * dam * (dap + dam);\n d = dbp * dbm * (dbp + dbm);\n newVal = (c * (dbm * data[j + 1][i] + dbp * data[j - 1][i]) + d * (dam * data[j][i + 1] + dap * data[j][i - 1])) / (d * (dam + dap) + c * (dbm + dbp));\n } else {\n newVal /= boundaryCnt;\n }\n diff = newVal - data[j][i];\n reldiff = diff / dmax;\n resid += reldiff * reldiff;\n overrelaxation = boundaryCnt ? 0 : 0.85;\n data[j][i] += diff * (1 + overrelaxation);\n }\n resid = Math.sqrt(resid);\n } while (iter++ < itermax && resid > tol);\n Lib.log(\"Smoother converged to\", resid, \"after\", iter, \"iterations\");\n return data;\n };\n }\n });\n\n // src/traces/carpet/constants.js\n var require_constants32 = __commonJS({\n \"src/traces/carpet/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n RELATIVE_CULL_TOLERANCE: 1e-6\n };\n }\n });\n\n // src/traces/carpet/catmull_rom.js\n var require_catmull_rom = __commonJS({\n \"src/traces/carpet/catmull_rom.js\"(exports, module) {\n \"use strict\";\n var CatmullRomExp = 0.5;\n module.exports = function makeControlPoints(p0, p1, p2, smoothness) {\n var d1x = p0[0] - p1[0];\n var d1y = p0[1] - p1[1];\n var d2x = p2[0] - p1[0];\n var d2y = p2[1] - p1[1];\n var d1a = Math.pow(d1x * d1x + d1y * d1y, CatmullRomExp / 2);\n var d2a = Math.pow(d2x * d2x + d2y * d2y, CatmullRomExp / 2);\n var numx = (d2a * d2a * d1x - d1a * d1a * d2x) * smoothness;\n var numy = (d2a * d2a * d1y - d1a * d1a * d2y) * smoothness;\n var denom1 = d2a * (d1a + d2a) * 3;\n var denom2 = d1a * (d1a + d2a) * 3;\n return [[\n p1[0] + (denom1 && numx / denom1),\n p1[1] + (denom1 && numy / denom1)\n ], [\n p1[0] - (denom2 && numx / denom2),\n p1[1] - (denom2 && numy / denom2)\n ]];\n };\n }\n });\n\n // src/traces/carpet/compute_control_points.js\n var require_compute_control_points = __commonJS({\n \"src/traces/carpet/compute_control_points.js\"(exports, module) {\n \"use strict\";\n var makeControlPoints = require_catmull_rom();\n var ensureArray = require_lib().ensureArray;\n function inferCubicControlPoint(p0, p2, p3) {\n var p2e0 = -0.5 * p3[0] + 1.5 * p2[0];\n var p2e1 = -0.5 * p3[1] + 1.5 * p2[1];\n return [\n (2 * p2e0 + p0[0]) / 3,\n (2 * p2e1 + p0[1]) / 3\n ];\n }\n module.exports = function computeControlPoints(xe, ye, x, y, asmoothing, bsmoothing) {\n var i, j, ie, je, xej, yej, xj, yj, cp, p1;\n var na = x[0].length;\n var nb = x.length;\n var nea = asmoothing ? 3 * na - 2 : na;\n var neb = bsmoothing ? 3 * nb - 2 : nb;\n xe = ensureArray(xe, neb);\n ye = ensureArray(ye, neb);\n for (ie = 0; ie < neb; ie++) {\n xe[ie] = ensureArray(xe[ie], nea);\n ye[ie] = ensureArray(ye[ie], nea);\n }\n for (j = 0, je = 0; j < nb; j++, je += bsmoothing ? 3 : 1) {\n xej = xe[je];\n yej = ye[je];\n xj = x[j];\n yj = y[j];\n for (i = 0, ie = 0; i < na; i++, ie += asmoothing ? 3 : 1) {\n xej[ie] = xj[i];\n yej[ie] = yj[i];\n }\n }\n if (asmoothing) {\n for (j = 0, je = 0; j < nb; j++, je += bsmoothing ? 3 : 1) {\n for (i = 1, ie = 3; i < na - 1; i++, ie += 3) {\n cp = makeControlPoints(\n [x[j][i - 1], y[j][i - 1]],\n [x[j][i], y[j][i]],\n [x[j][i + 1], y[j][i + 1]],\n asmoothing\n );\n xe[je][ie - 1] = cp[0][0];\n ye[je][ie - 1] = cp[0][1];\n xe[je][ie + 1] = cp[1][0];\n ye[je][ie + 1] = cp[1][1];\n }\n p1 = inferCubicControlPoint(\n [xe[je][0], ye[je][0]],\n [xe[je][2], ye[je][2]],\n [xe[je][3], ye[je][3]]\n );\n xe[je][1] = p1[0];\n ye[je][1] = p1[1];\n p1 = inferCubicControlPoint(\n [xe[je][nea - 1], ye[je][nea - 1]],\n [xe[je][nea - 3], ye[je][nea - 3]],\n [xe[je][nea - 4], ye[je][nea - 4]]\n );\n xe[je][nea - 2] = p1[0];\n ye[je][nea - 2] = p1[1];\n }\n }\n if (bsmoothing) {\n for (ie = 0; ie < nea; ie++) {\n for (je = 3; je < neb - 3; je += 3) {\n cp = makeControlPoints(\n [xe[je - 3][ie], ye[je - 3][ie]],\n [xe[je][ie], ye[je][ie]],\n [xe[je + 3][ie], ye[je + 3][ie]],\n bsmoothing\n );\n xe[je - 1][ie] = cp[0][0];\n ye[je - 1][ie] = cp[0][1];\n xe[je + 1][ie] = cp[1][0];\n ye[je + 1][ie] = cp[1][1];\n }\n p1 = inferCubicControlPoint(\n [xe[0][ie], ye[0][ie]],\n [xe[2][ie], ye[2][ie]],\n [xe[3][ie], ye[3][ie]]\n );\n xe[1][ie] = p1[0];\n ye[1][ie] = p1[1];\n p1 = inferCubicControlPoint(\n [xe[neb - 1][ie], ye[neb - 1][ie]],\n [xe[neb - 3][ie], ye[neb - 3][ie]],\n [xe[neb - 4][ie], ye[neb - 4][ie]]\n );\n xe[neb - 2][ie] = p1[0];\n ye[neb - 2][ie] = p1[1];\n }\n }\n if (asmoothing && bsmoothing) {\n for (je = 1; je < neb; je += (je + 1) % 3 === 0 ? 2 : 1) {\n for (ie = 3; ie < nea - 3; ie += 3) {\n cp = makeControlPoints(\n [xe[je][ie - 3], ye[je][ie - 3]],\n [xe[je][ie], ye[je][ie]],\n [xe[je][ie + 3], ye[je][ie + 3]],\n asmoothing\n );\n xe[je][ie - 1] = 0.5 * (xe[je][ie - 1] + cp[0][0]);\n ye[je][ie - 1] = 0.5 * (ye[je][ie - 1] + cp[0][1]);\n xe[je][ie + 1] = 0.5 * (xe[je][ie + 1] + cp[1][0]);\n ye[je][ie + 1] = 0.5 * (ye[je][ie + 1] + cp[1][1]);\n }\n p1 = inferCubicControlPoint(\n [xe[je][0], ye[je][0]],\n [xe[je][2], ye[je][2]],\n [xe[je][3], ye[je][3]]\n );\n xe[je][1] = 0.5 * (xe[je][1] + p1[0]);\n ye[je][1] = 0.5 * (ye[je][1] + p1[1]);\n p1 = inferCubicControlPoint(\n [xe[je][nea - 1], ye[je][nea - 1]],\n [xe[je][nea - 3], ye[je][nea - 3]],\n [xe[je][nea - 4], ye[je][nea - 4]]\n );\n xe[je][nea - 2] = 0.5 * (xe[je][nea - 2] + p1[0]);\n ye[je][nea - 2] = 0.5 * (ye[je][nea - 2] + p1[1]);\n }\n }\n return [xe, ye];\n };\n }\n });\n\n // src/traces/carpet/create_spline_evaluator.js\n var require_create_spline_evaluator = __commonJS({\n \"src/traces/carpet/create_spline_evaluator.js\"(exports, module) {\n \"use strict\";\n module.exports = function(arrays, na, nb, asmoothing, bsmoothing) {\n var imax = na - 2;\n var jmax = nb - 2;\n if (asmoothing && bsmoothing) {\n return function(out, i, j) {\n if (!out) out = [];\n var f0, f1, f2, f3, ak, k;\n var i0 = Math.max(0, Math.min(Math.floor(i), imax));\n var j0 = Math.max(0, Math.min(Math.floor(j), jmax));\n var u = Math.max(0, Math.min(1, i - i0));\n var v = Math.max(0, Math.min(1, j - j0));\n i0 *= 3;\n j0 *= 3;\n var u2 = u * u;\n var u3 = u2 * u;\n var ou = 1 - u;\n var ou2 = ou * ou;\n var ou3 = ou2 * ou;\n var v2 = v * v;\n var v3 = v2 * v;\n var ov = 1 - v;\n var ov2 = ov * ov;\n var ov3 = ov2 * ov;\n for (k = 0; k < arrays.length; k++) {\n ak = arrays[k];\n f0 = ou3 * ak[j0][i0] + 3 * (ou2 * u * ak[j0][i0 + 1] + ou * u2 * ak[j0][i0 + 2]) + u3 * ak[j0][i0 + 3];\n f1 = ou3 * ak[j0 + 1][i0] + 3 * (ou2 * u * ak[j0 + 1][i0 + 1] + ou * u2 * ak[j0 + 1][i0 + 2]) + u3 * ak[j0 + 1][i0 + 3];\n f2 = ou3 * ak[j0 + 2][i0] + 3 * (ou2 * u * ak[j0 + 2][i0 + 1] + ou * u2 * ak[j0 + 2][i0 + 2]) + u3 * ak[j0 + 2][i0 + 3];\n f3 = ou3 * ak[j0 + 3][i0] + 3 * (ou2 * u * ak[j0 + 3][i0 + 1] + ou * u2 * ak[j0 + 3][i0 + 2]) + u3 * ak[j0 + 3][i0 + 3];\n out[k] = ov3 * f0 + 3 * (ov2 * v * f1 + ov * v2 * f2) + v3 * f3;\n }\n return out;\n };\n } else if (asmoothing) {\n return function(out, i, j) {\n if (!out) out = [];\n var i0 = Math.max(0, Math.min(Math.floor(i), imax));\n var j0 = Math.max(0, Math.min(Math.floor(j), jmax));\n var u = Math.max(0, Math.min(1, i - i0));\n var v = Math.max(0, Math.min(1, j - j0));\n var f0, f1, f2, f3, k, ak;\n i0 *= 3;\n var u2 = u * u;\n var u3 = u2 * u;\n var ou = 1 - u;\n var ou2 = ou * ou;\n var ou3 = ou2 * ou;\n var ov = 1 - v;\n for (k = 0; k < arrays.length; k++) {\n ak = arrays[k];\n f0 = ov * ak[j0][i0] + v * ak[j0 + 1][i0];\n f1 = ov * ak[j0][i0 + 1] + v * ak[j0 + 1][i0 + 1];\n f2 = ov * ak[j0][i0 + 2] + v * ak[j0 + 1][i0 + 1];\n f3 = ov * ak[j0][i0 + 3] + v * ak[j0 + 1][i0 + 1];\n out[k] = ou3 * f0 + 3 * (ou2 * u * f1 + ou * u2 * f2) + u3 * f3;\n }\n return out;\n };\n } else if (bsmoothing) {\n return function(out, i, j) {\n if (!out) out = [];\n var i0 = Math.max(0, Math.min(Math.floor(i), imax));\n var j0 = Math.max(0, Math.min(Math.floor(j), jmax));\n var u = Math.max(0, Math.min(1, i - i0));\n var v = Math.max(0, Math.min(1, j - j0));\n var f0, f1, f2, f3, k, ak;\n j0 *= 3;\n var v2 = v * v;\n var v3 = v2 * v;\n var ov = 1 - v;\n var ov2 = ov * ov;\n var ov3 = ov2 * ov;\n var ou = 1 - u;\n for (k = 0; k < arrays.length; k++) {\n ak = arrays[k];\n f0 = ou * ak[j0][i0] + u * ak[j0][i0 + 1];\n f1 = ou * ak[j0 + 1][i0] + u * ak[j0 + 1][i0 + 1];\n f2 = ou * ak[j0 + 2][i0] + u * ak[j0 + 2][i0 + 1];\n f3 = ou * ak[j0 + 3][i0] + u * ak[j0 + 3][i0 + 1];\n out[k] = ov3 * f0 + 3 * (ov2 * v * f1 + ov * v2 * f2) + v3 * f3;\n }\n return out;\n };\n } else {\n return function(out, i, j) {\n if (!out) out = [];\n var i0 = Math.max(0, Math.min(Math.floor(i), imax));\n var j0 = Math.max(0, Math.min(Math.floor(j), jmax));\n var u = Math.max(0, Math.min(1, i - i0));\n var v = Math.max(0, Math.min(1, j - j0));\n var f0, f1, k, ak;\n var ov = 1 - v;\n var ou = 1 - u;\n for (k = 0; k < arrays.length; k++) {\n ak = arrays[k];\n f0 = ou * ak[j0][i0] + u * ak[j0][i0 + 1];\n f1 = ou * ak[j0 + 1][i0] + u * ak[j0 + 1][i0 + 1];\n out[k] = ov * f0 + v * f1;\n }\n return out;\n };\n }\n };\n }\n });\n\n // src/traces/carpet/create_i_derivative_evaluator.js\n var require_create_i_derivative_evaluator = __commonJS({\n \"src/traces/carpet/create_i_derivative_evaluator.js\"(exports, module) {\n \"use strict\";\n module.exports = function(arrays, asmoothing, bsmoothing) {\n if (asmoothing && bsmoothing) {\n return function(out, i0, j0, u, v) {\n if (!out) out = [];\n var f0, f1, f2, f3, ak, k;\n i0 *= 3;\n j0 *= 3;\n var u2 = u * u;\n var ou = 1 - u;\n var ou2 = ou * ou;\n var ouu2 = ou * u * 2;\n var a = -3 * ou2;\n var b = 3 * (ou2 - ouu2);\n var c = 3 * (ouu2 - u2);\n var d = 3 * u2;\n var v2 = v * v;\n var v3 = v2 * v;\n var ov = 1 - v;\n var ov2 = ov * ov;\n var ov3 = ov2 * ov;\n for (k = 0; k < arrays.length; k++) {\n ak = arrays[k];\n f0 = a * ak[j0][i0] + b * ak[j0][i0 + 1] + c * ak[j0][i0 + 2] + d * ak[j0][i0 + 3];\n f1 = a * ak[j0 + 1][i0] + b * ak[j0 + 1][i0 + 1] + c * ak[j0 + 1][i0 + 2] + d * ak[j0 + 1][i0 + 3];\n f2 = a * ak[j0 + 2][i0] + b * ak[j0 + 2][i0 + 1] + c * ak[j0 + 2][i0 + 2] + d * ak[j0 + 2][i0 + 3];\n f3 = a * ak[j0 + 3][i0] + b * ak[j0 + 3][i0 + 1] + c * ak[j0 + 3][i0 + 2] + d * ak[j0 + 3][i0 + 3];\n out[k] = ov3 * f0 + 3 * (ov2 * v * f1 + ov * v2 * f2) + v3 * f3;\n }\n return out;\n };\n } else if (asmoothing) {\n return function(out, i0, j0, u, v) {\n if (!out) out = [];\n var f0, f1, k, ak;\n i0 *= 3;\n var u2 = u * u;\n var ou = 1 - u;\n var ou2 = ou * ou;\n var ouu2 = ou * u * 2;\n var a = -3 * ou2;\n var b = 3 * (ou2 - ouu2);\n var c = 3 * (ouu2 - u2);\n var d = 3 * u2;\n var ov = 1 - v;\n for (k = 0; k < arrays.length; k++) {\n ak = arrays[k];\n f0 = a * ak[j0][i0] + b * ak[j0][i0 + 1] + c * ak[j0][i0 + 2] + d * ak[j0][i0 + 3];\n f1 = a * ak[j0 + 1][i0] + b * ak[j0 + 1][i0 + 1] + c * ak[j0 + 1][i0 + 2] + d * ak[j0 + 1][i0 + 3];\n out[k] = ov * f0 + v * f1;\n }\n return out;\n };\n } else if (bsmoothing) {\n return function(out, i0, j0, u, v) {\n if (!out) out = [];\n var f0, f1, f2, f3, k, ak;\n j0 *= 3;\n var v2 = v * v;\n var v3 = v2 * v;\n var ov = 1 - v;\n var ov2 = ov * ov;\n var ov3 = ov2 * ov;\n for (k = 0; k < arrays.length; k++) {\n ak = arrays[k];\n f0 = ak[j0][i0 + 1] - ak[j0][i0];\n f1 = ak[j0 + 1][i0 + 1] - ak[j0 + 1][i0];\n f2 = ak[j0 + 2][i0 + 1] - ak[j0 + 2][i0];\n f3 = ak[j0 + 3][i0 + 1] - ak[j0 + 3][i0];\n out[k] = ov3 * f0 + 3 * (ov2 * v * f1 + ov * v2 * f2) + v3 * f3;\n }\n return out;\n };\n } else {\n return function(out, i0, j0, u, v) {\n if (!out) out = [];\n var f0, f1, k, ak;\n var ov = 1 - v;\n for (k = 0; k < arrays.length; k++) {\n ak = arrays[k];\n f0 = ak[j0][i0 + 1] - ak[j0][i0];\n f1 = ak[j0 + 1][i0 + 1] - ak[j0 + 1][i0];\n out[k] = ov * f0 + v * f1;\n }\n return out;\n };\n }\n };\n }\n });\n\n // src/traces/carpet/create_j_derivative_evaluator.js\n var require_create_j_derivative_evaluator = __commonJS({\n \"src/traces/carpet/create_j_derivative_evaluator.js\"(exports, module) {\n \"use strict\";\n module.exports = function(arrays, asmoothing, bsmoothing) {\n if (asmoothing && bsmoothing) {\n return function(out, i0, j0, u, v) {\n if (!out) out = [];\n var f0, f1, f2, f3, ak, k;\n i0 *= 3;\n j0 *= 3;\n var u2 = u * u;\n var u3 = u2 * u;\n var ou = 1 - u;\n var ou2 = ou * ou;\n var ou3 = ou2 * ou;\n var v2 = v * v;\n var ov = 1 - v;\n var ov2 = ov * ov;\n var ovv2 = ov * v * 2;\n var a = -3 * ov2;\n var b = 3 * (ov2 - ovv2);\n var c = 3 * (ovv2 - v2);\n var d = 3 * v2;\n for (k = 0; k < arrays.length; k++) {\n ak = arrays[k];\n f0 = a * ak[j0][i0] + b * ak[j0 + 1][i0] + c * ak[j0 + 2][i0] + d * ak[j0 + 3][i0];\n f1 = a * ak[j0][i0 + 1] + b * ak[j0 + 1][i0 + 1] + c * ak[j0 + 2][i0 + 1] + d * ak[j0 + 3][i0 + 1];\n f2 = a * ak[j0][i0 + 2] + b * ak[j0 + 1][i0 + 2] + c * ak[j0 + 2][i0 + 2] + d * ak[j0 + 3][i0 + 2];\n f3 = a * ak[j0][i0 + 3] + b * ak[j0 + 1][i0 + 3] + c * ak[j0 + 2][i0 + 3] + d * ak[j0 + 3][i0 + 3];\n out[k] = ou3 * f0 + 3 * (ou2 * u * f1 + ou * u2 * f2) + u3 * f3;\n }\n return out;\n };\n } else if (asmoothing) {\n return function(out, i0, j0, v, u) {\n if (!out) out = [];\n var f0, f1, f2, f3, k, ak;\n i0 *= 3;\n var u2 = u * u;\n var u3 = u2 * u;\n var ou = 1 - u;\n var ou2 = ou * ou;\n var ou3 = ou2 * ou;\n for (k = 0; k < arrays.length; k++) {\n ak = arrays[k];\n f0 = ak[j0 + 1][i0] - ak[j0][i0];\n f1 = ak[j0 + 1][i0 + 1] - ak[j0][i0 + 1];\n f2 = ak[j0 + 1][i0 + 2] - ak[j0][i0 + 2];\n f3 = ak[j0 + 1][i0 + 3] - ak[j0][i0 + 3];\n out[k] = ou3 * f0 + 3 * (ou2 * u * f1 + ou * u2 * f2) + u3 * f3;\n }\n return out;\n };\n } else if (bsmoothing) {\n return function(out, i0, j0, u, v) {\n if (!out) out = [];\n var f0, f1, k, ak;\n j0 *= 3;\n var ou = 1 - u;\n var v2 = v * v;\n var ov = 1 - v;\n var ov2 = ov * ov;\n var ovv2 = ov * v * 2;\n var a = -3 * ov2;\n var b = 3 * (ov2 - ovv2);\n var c = 3 * (ovv2 - v2);\n var d = 3 * v2;\n for (k = 0; k < arrays.length; k++) {\n ak = arrays[k];\n f0 = a * ak[j0][i0] + b * ak[j0 + 1][i0] + c * ak[j0 + 2][i0] + d * ak[j0 + 3][i0];\n f1 = a * ak[j0][i0 + 1] + b * ak[j0 + 1][i0 + 1] + c * ak[j0 + 2][i0 + 1] + d * ak[j0 + 3][i0 + 1];\n out[k] = ou * f0 + u * f1;\n }\n return out;\n };\n } else {\n return function(out, i0, j0, v, u) {\n if (!out) out = [];\n var f0, f1, k, ak;\n var ov = 1 - v;\n for (k = 0; k < arrays.length; k++) {\n ak = arrays[k];\n f0 = ak[j0 + 1][i0] - ak[j0][i0];\n f1 = ak[j0 + 1][i0 + 1] - ak[j0][i0 + 1];\n out[k] = ov * f0 + v * f1;\n }\n return out;\n };\n }\n };\n }\n });\n\n // src/traces/carpet/set_convert.js\n var require_set_convert2 = __commonJS({\n \"src/traces/carpet/set_convert.js\"(exports, module) {\n \"use strict\";\n var constants = require_constants32();\n var search = require_search().findBin;\n var computeControlPoints = require_compute_control_points();\n var createSplineEvaluator = require_create_spline_evaluator();\n var createIDerivativeEvaluator = require_create_i_derivative_evaluator();\n var createJDerivativeEvaluator = require_create_j_derivative_evaluator();\n module.exports = function setConvert(trace) {\n var a = trace._a;\n var b = trace._b;\n var na = a.length;\n var nb = b.length;\n var aax = trace.aaxis;\n var bax = trace.baxis;\n var amin = a[0];\n var amax = a[na - 1];\n var bmin = b[0];\n var bmax = b[nb - 1];\n var arange = a[a.length - 1] - a[0];\n var brange = b[b.length - 1] - b[0];\n var atol = arange * constants.RELATIVE_CULL_TOLERANCE;\n var btol = brange * constants.RELATIVE_CULL_TOLERANCE;\n amin -= atol;\n amax += atol;\n bmin -= btol;\n bmax += btol;\n trace.isVisible = function(a2, b2) {\n return a2 > amin && a2 < amax && b2 > bmin && b2 < bmax;\n };\n trace.isOccluded = function(a2, b2) {\n return a2 < amin || a2 > amax || b2 < bmin || b2 > bmax;\n };\n trace.setScale = function() {\n var x = trace._x;\n var y = trace._y;\n var result = computeControlPoints(trace._xctrl, trace._yctrl, x, y, aax.smoothing, bax.smoothing);\n trace._xctrl = result[0];\n trace._yctrl = result[1];\n trace.evalxy = createSplineEvaluator([trace._xctrl, trace._yctrl], na, nb, aax.smoothing, bax.smoothing);\n trace.dxydi = createIDerivativeEvaluator([trace._xctrl, trace._yctrl], aax.smoothing, bax.smoothing);\n trace.dxydj = createJDerivativeEvaluator([trace._xctrl, trace._yctrl], aax.smoothing, bax.smoothing);\n };\n trace.i2a = function(i) {\n var i0 = Math.max(0, Math.floor(i[0]), na - 2);\n var ti = i[0] - i0;\n return (1 - ti) * a[i0] + ti * a[i0 + 1];\n };\n trace.j2b = function(j) {\n var j0 = Math.max(0, Math.floor(j[1]), na - 2);\n var tj = j[1] - j0;\n return (1 - tj) * b[j0] + tj * b[j0 + 1];\n };\n trace.ij2ab = function(ij) {\n return [trace.i2a(ij[0]), trace.j2b(ij[1])];\n };\n trace.a2i = function(aval) {\n var i0 = Math.max(0, Math.min(search(aval, a), na - 2));\n var a0 = a[i0];\n var a1 = a[i0 + 1];\n return Math.max(0, Math.min(na - 1, i0 + (aval - a0) / (a1 - a0)));\n };\n trace.b2j = function(bval) {\n var j0 = Math.max(0, Math.min(search(bval, b), nb - 2));\n var b0 = b[j0];\n var b1 = b[j0 + 1];\n return Math.max(0, Math.min(nb - 1, j0 + (bval - b0) / (b1 - b0)));\n };\n trace.ab2ij = function(ab) {\n return [trace.a2i(ab[0]), trace.b2j(ab[1])];\n };\n trace.i2c = function(i, j) {\n return trace.evalxy([], i, j);\n };\n trace.ab2xy = function(aval, bval, extrapolate) {\n if (!extrapolate && (aval < a[0] || aval > a[na - 1] | bval < b[0] || bval > b[nb - 1])) {\n return [false, false];\n }\n var i = trace.a2i(aval);\n var j = trace.b2j(bval);\n var pt = trace.evalxy([], i, j);\n if (extrapolate) {\n var iex = 0;\n var jex = 0;\n var der = [];\n var i0, ti, j0, tj;\n if (aval < a[0]) {\n i0 = 0;\n ti = 0;\n iex = (aval - a[0]) / (a[1] - a[0]);\n } else if (aval > a[na - 1]) {\n i0 = na - 2;\n ti = 1;\n iex = (aval - a[na - 1]) / (a[na - 1] - a[na - 2]);\n } else {\n i0 = Math.max(0, Math.min(na - 2, Math.floor(i)));\n ti = i - i0;\n }\n if (bval < b[0]) {\n j0 = 0;\n tj = 0;\n jex = (bval - b[0]) / (b[1] - b[0]);\n } else if (bval > b[nb - 1]) {\n j0 = nb - 2;\n tj = 1;\n jex = (bval - b[nb - 1]) / (b[nb - 1] - b[nb - 2]);\n } else {\n j0 = Math.max(0, Math.min(nb - 2, Math.floor(j)));\n tj = j - j0;\n }\n if (iex) {\n trace.dxydi(der, i0, j0, ti, tj);\n pt[0] += der[0] * iex;\n pt[1] += der[1] * iex;\n }\n if (jex) {\n trace.dxydj(der, i0, j0, ti, tj);\n pt[0] += der[0] * jex;\n pt[1] += der[1] * jex;\n }\n }\n return pt;\n };\n trace.c2p = function(xy, xa, ya) {\n return [xa.c2p(xy[0]), ya.c2p(xy[1])];\n };\n trace.p2x = function(p, xa, ya) {\n return [xa.p2c(p[0]), ya.p2c(p[1])];\n };\n trace.dadi = function(i) {\n var i0 = Math.max(0, Math.min(a.length - 2, i));\n return a[i0 + 1] - a[i0];\n };\n trace.dbdj = function(j) {\n var j0 = Math.max(0, Math.min(b.length - 2, j));\n return b[j0 + 1] - b[j0];\n };\n trace.dxyda = function(i0, j0, u, v) {\n var dxydi = trace.dxydi(null, i0, j0, u, v);\n var dadi = trace.dadi(i0, u);\n return [dxydi[0] / dadi, dxydi[1] / dadi];\n };\n trace.dxydb = function(i0, j0, u, v) {\n var dxydj = trace.dxydj(null, i0, j0, u, v);\n var dbdj = trace.dbdj(j0, v);\n return [dxydj[0] / dbdj, dxydj[1] / dbdj];\n };\n trace.dxyda_rough = function(a2, b2, reldiff) {\n var h = arange * (reldiff || 0.1);\n var plus = trace.ab2xy(a2 + h, b2, true);\n var minus = trace.ab2xy(a2 - h, b2, true);\n return [\n (plus[0] - minus[0]) * 0.5 / h,\n (plus[1] - minus[1]) * 0.5 / h\n ];\n };\n trace.dxydb_rough = function(a2, b2, reldiff) {\n var h = brange * (reldiff || 0.1);\n var plus = trace.ab2xy(a2, b2 + h, true);\n var minus = trace.ab2xy(a2, b2 - h, true);\n return [\n (plus[0] - minus[0]) * 0.5 / h,\n (plus[1] - minus[1]) * 0.5 / h\n ];\n };\n trace.dpdx = function(xa) {\n return xa._m;\n };\n trace.dpdy = function(ya) {\n return ya._m;\n };\n };\n }\n });\n\n // src/traces/carpet/calc.js\n var require_calc38 = __commonJS({\n \"src/traces/carpet/calc.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n var isArray1D = require_lib().isArray1D;\n var cheaterBasis = require_cheater_basis();\n var arrayMinmax = require_array_minmax();\n var calcGridlines = require_calc_gridlines();\n var calcLabels = require_calc_labels();\n var calcClipPath = require_calc_clippath();\n var clean2dArray = require_clean_2d_array();\n var smoothFill2dArray = require_smooth_fill_2d_array();\n var convertColumnData = require_convert_column_xyz();\n var setConvert = require_set_convert2();\n module.exports = function calc(gd, trace) {\n var xa = Axes.getFromId(gd, trace.xaxis);\n var ya = Axes.getFromId(gd, trace.yaxis);\n var aax = trace.aaxis;\n var bax = trace.baxis;\n var x = trace.x;\n var y = trace.y;\n var cols = [];\n if (x && isArray1D(x)) cols.push(\"x\");\n if (y && isArray1D(y)) cols.push(\"y\");\n if (cols.length) {\n convertColumnData(trace, aax, bax, \"a\", \"b\", cols);\n }\n var a = trace._a = trace._a || trace.a;\n var b = trace._b = trace._b || trace.b;\n x = trace._x || trace.x;\n y = trace._y || trace.y;\n var t = {};\n if (trace._cheater) {\n var avals = aax.cheatertype === \"index\" ? a.length : a;\n var bvals = bax.cheatertype === \"index\" ? b.length : b;\n x = cheaterBasis(avals, bvals, trace.cheaterslope);\n }\n trace._x = x = clean2dArray(x);\n trace._y = y = clean2dArray(y);\n smoothFill2dArray(x, a, b);\n smoothFill2dArray(y, a, b);\n setConvert(trace);\n trace.setScale();\n var xrange = arrayMinmax(x);\n var yrange = arrayMinmax(y);\n var dx = 0.5 * (xrange[1] - xrange[0]);\n var xc = 0.5 * (xrange[1] + xrange[0]);\n var dy = 0.5 * (yrange[1] - yrange[0]);\n var yc = 0.5 * (yrange[1] + yrange[0]);\n var grow = 1.3;\n xrange = [xc - dx * grow, xc + dx * grow];\n yrange = [yc - dy * grow, yc + dy * grow];\n trace._extremes[xa._id] = Axes.findExtremes(xa, xrange, { padded: true });\n trace._extremes[ya._id] = Axes.findExtremes(ya, yrange, { padded: true });\n calcGridlines(trace, \"a\", \"b\");\n calcGridlines(trace, \"b\", \"a\");\n calcLabels(trace, aax);\n calcLabels(trace, bax);\n t.clipsegments = calcClipPath(trace._xctrl, trace._yctrl, aax, bax);\n t.x = x;\n t.y = y;\n t.a = a;\n t.b = b;\n return [t];\n };\n }\n });\n\n // src/traces/carpet/index.js\n var require_carpet = __commonJS({\n \"src/traces/carpet/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes63(),\n supplyDefaults: require_defaults59(),\n plot: require_plot32(),\n calc: require_calc38(),\n animatable: true,\n isContainer: true,\n // so carpet traces get `calc` before other traces\n moduleType: \"trace\",\n name: \"carpet\",\n basePlotModule: require_cartesian(),\n categories: [\"cartesian\", \"svg\", \"carpet\", \"carpetAxis\", \"notLegendIsolatable\", \"noMultiCategory\", \"noHover\", \"noSortingByValue\"],\n meta: {}\n };\n }\n });\n\n // lib/carpet.js\n var require_carpet2 = __commonJS({\n \"lib/carpet.js\"(exports, module) {\n \"use strict\";\n module.exports = require_carpet();\n }\n });\n\n // src/traces/scattercarpet/attributes.js\n var require_attributes64 = __commonJS({\n \"src/traces/scattercarpet/attributes.js\"(exports, module) {\n \"use strict\";\n var makeFillcolorAttr = require_fillcolor_attribute();\n var scatterAttrs = require_attributes12();\n var baseAttrs = require_attributes2();\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var colorScaleAttrs = require_attributes8();\n var extendFlat = require_extend().extendFlat;\n var scatterMarkerAttrs = scatterAttrs.marker;\n var scatterLineAttrs = scatterAttrs.line;\n var scatterMarkerLineAttrs = scatterMarkerAttrs.line;\n module.exports = {\n carpet: {\n valType: \"string\",\n editType: \"calc\"\n },\n a: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n b: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n mode: extendFlat({}, scatterAttrs.mode, { dflt: \"markers\" }),\n text: extendFlat({}, scatterAttrs.text, {}),\n texttemplate: texttemplateAttrs({ editType: \"plot\" }, {\n keys: [\"a\", \"b\", \"text\"]\n }),\n hovertext: extendFlat({}, scatterAttrs.hovertext, {}),\n line: {\n color: scatterLineAttrs.color,\n width: scatterLineAttrs.width,\n dash: scatterLineAttrs.dash,\n backoff: scatterLineAttrs.backoff,\n shape: extendFlat(\n {},\n scatterLineAttrs.shape,\n { values: [\"linear\", \"spline\"] }\n ),\n smoothing: scatterLineAttrs.smoothing,\n editType: \"calc\"\n },\n connectgaps: scatterAttrs.connectgaps,\n fill: extendFlat({}, scatterAttrs.fill, {\n values: [\"none\", \"toself\", \"tonext\"],\n dflt: \"none\"\n }),\n fillcolor: makeFillcolorAttr(),\n marker: extendFlat(\n {\n symbol: scatterMarkerAttrs.symbol,\n opacity: scatterMarkerAttrs.opacity,\n maxdisplayed: scatterMarkerAttrs.maxdisplayed,\n angle: scatterMarkerAttrs.angle,\n angleref: scatterMarkerAttrs.angleref,\n standoff: scatterMarkerAttrs.standoff,\n size: scatterMarkerAttrs.size,\n sizeref: scatterMarkerAttrs.sizeref,\n sizemin: scatterMarkerAttrs.sizemin,\n sizemode: scatterMarkerAttrs.sizemode,\n line: extendFlat(\n {\n width: scatterMarkerLineAttrs.width,\n editType: \"calc\"\n },\n colorScaleAttrs(\"marker.line\")\n ),\n gradient: scatterMarkerAttrs.gradient,\n editType: \"calc\"\n },\n colorScaleAttrs(\"marker\")\n ),\n textfont: scatterAttrs.textfont,\n textposition: scatterAttrs.textposition,\n selected: scatterAttrs.selected,\n unselected: scatterAttrs.unselected,\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: [\"a\", \"b\", \"text\", \"name\"]\n }),\n hoveron: scatterAttrs.hoveron,\n hovertemplate: hovertemplateAttrs(),\n zorder: scatterAttrs.zorder\n };\n }\n });\n\n // src/traces/scattercarpet/defaults.js\n var require_defaults60 = __commonJS({\n \"src/traces/scattercarpet/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var constants = require_constants8();\n var subTypes = require_subtypes();\n var handleMarkerDefaults = require_marker_defaults();\n var handleLineDefaults = require_line_defaults();\n var handleLineShapeDefaults = require_line_shape_defaults();\n var handleTextDefaults = require_text_defaults();\n var handleFillColorDefaults = require_fillcolor_defaults();\n var attributes = require_attributes64();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n coerce(\"carpet\");\n traceOut.xaxis = \"x\";\n traceOut.yaxis = \"y\";\n var a = coerce(\"a\");\n var b = coerce(\"b\");\n var len = Math.min(a.length, b.length);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n traceOut._length = len;\n coerce(\"text\");\n coerce(\"texttemplate\");\n coerce(\"hovertext\");\n var defaultMode = len < constants.PTS_LINESONLY ? \"lines+markers\" : \"lines\";\n coerce(\"mode\", defaultMode);\n if (subTypes.hasMarkers(traceOut)) {\n handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, { gradient: true });\n }\n if (subTypes.hasLines(traceOut)) {\n handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce, { backoff: true });\n handleLineShapeDefaults(traceIn, traceOut, coerce);\n coerce(\"connectgaps\");\n }\n if (subTypes.hasText(traceOut)) {\n handleTextDefaults(traceIn, traceOut, layout, coerce);\n }\n var dfltHoverOn = [];\n if (subTypes.hasMarkers(traceOut) || subTypes.hasText(traceOut)) {\n coerce(\"marker.maxdisplayed\");\n dfltHoverOn.push(\"points\");\n }\n coerce(\"fill\");\n if (traceOut.fill !== \"none\") {\n handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce);\n if (!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce);\n }\n if (traceOut.fill === \"tonext\" || traceOut.fill === \"toself\") {\n dfltHoverOn.push(\"fills\");\n }\n var hoverOn = coerce(\"hoveron\", dfltHoverOn.join(\"+\") || \"points\");\n if (hoverOn !== \"fills\") coerce(\"hovertemplate\");\n coerce(\"zorder\");\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n };\n }\n });\n\n // src/traces/scattercarpet/format_labels.js\n var require_format_labels7 = __commonJS({\n \"src/traces/scattercarpet/format_labels.js\"(exports, module) {\n \"use strict\";\n module.exports = function formatLabels(cdi, trace) {\n var labels = {};\n var carpet = trace._carpet;\n var ij = carpet.ab2ij([cdi.a, cdi.b]);\n var i0 = Math.floor(ij[0]);\n var ti = ij[0] - i0;\n var j0 = Math.floor(ij[1]);\n var tj = ij[1] - j0;\n var xy = carpet.evalxy([], i0, j0, ti, tj);\n labels.yLabel = xy[1].toFixed(3);\n return labels;\n };\n }\n });\n\n // src/traces/carpet/lookup_carpetid.js\n var require_lookup_carpetid = __commonJS({\n \"src/traces/carpet/lookup_carpetid.js\"(exports, module) {\n \"use strict\";\n module.exports = function(gd, trace) {\n var n = gd._fullData.length;\n var firstAxis;\n for (var i = 0; i < n; i++) {\n var maybeCarpet = gd._fullData[i];\n if (maybeCarpet.index === trace.index) continue;\n if (maybeCarpet.type === \"carpet\") {\n if (!firstAxis) {\n firstAxis = maybeCarpet;\n }\n if (maybeCarpet.carpet === trace.carpet) {\n return maybeCarpet;\n }\n }\n }\n return firstAxis;\n };\n }\n });\n\n // src/traces/scattercarpet/calc.js\n var require_calc39 = __commonJS({\n \"src/traces/scattercarpet/calc.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var calcColorscale = require_colorscale_calc();\n var arraysToCalcdata = require_arrays_to_calcdata();\n var calcSelection = require_calc_selection();\n var calcMarkerSize = require_calc3().calcMarkerSize;\n var lookupCarpet = require_lookup_carpetid();\n module.exports = function calc(gd, trace) {\n var carpet = trace._carpetTrace = lookupCarpet(gd, trace);\n if (!carpet || !carpet.visible || carpet.visible === \"legendonly\") return;\n var i;\n trace.xaxis = carpet.xaxis;\n trace.yaxis = carpet.yaxis;\n var serieslen = trace._length;\n var cd = new Array(serieslen);\n var a, b;\n var needsCull = false;\n for (i = 0; i < serieslen; i++) {\n a = trace.a[i];\n b = trace.b[i];\n if (isNumeric(a) && isNumeric(b)) {\n var xy = carpet.ab2xy(+a, +b, true);\n var visible = carpet.isVisible(+a, +b);\n if (!visible) needsCull = true;\n cd[i] = { x: xy[0], y: xy[1], a, b, vis: visible };\n } else cd[i] = { x: false, y: false };\n }\n trace._needsCull = needsCull;\n cd[0].carpet = carpet;\n cd[0].trace = trace;\n calcMarkerSize(trace, serieslen);\n calcColorscale(gd, trace);\n arraysToCalcdata(cd, trace);\n calcSelection(cd, trace);\n return cd;\n };\n }\n });\n\n // src/traces/scattercarpet/plot.js\n var require_plot33 = __commonJS({\n \"src/traces/scattercarpet/plot.js\"(exports, module) {\n \"use strict\";\n var scatterPlot = require_plot();\n var Axes = require_axes();\n var Drawing = require_drawing();\n module.exports = function plot(gd, plotinfoproxy, data, layer) {\n var i, trace, node;\n var carpet = data[0][0].carpet;\n var xaxis = Axes.getFromId(gd, carpet.xaxis || \"x\");\n var yaxis = Axes.getFromId(gd, carpet.yaxis || \"y\");\n var plotinfo = {\n xaxis,\n yaxis,\n plot: plotinfoproxy.plot\n };\n for (i = 0; i < data.length; i++) {\n trace = data[i][0].trace;\n trace._xA = xaxis;\n trace._yA = yaxis;\n }\n scatterPlot(gd, plotinfo, data, layer);\n for (i = 0; i < data.length; i++) {\n trace = data[i][0].trace;\n node = layer.selectAll(\"g.trace\" + trace.uid + \" .js-line\");\n Drawing.setClipUrl(node, data[i][0].carpet._clipPathId, gd);\n }\n };\n }\n });\n\n // src/traces/scattercarpet/hover.js\n var require_hover22 = __commonJS({\n \"src/traces/scattercarpet/hover.js\"(exports, module) {\n \"use strict\";\n var scatterHover = require_hover2();\n var fillText = require_lib().fillText;\n module.exports = function hoverPoints(pointData, xval, yval, hovermode) {\n var scatterPointData = scatterHover(pointData, xval, yval, hovermode);\n if (!scatterPointData || scatterPointData[0].index === false) return;\n var newPointData = scatterPointData[0];\n if (newPointData.index === void 0) {\n var yFracUp = 1 - newPointData.y0 / pointData.ya._length;\n var xLen = pointData.xa._length;\n var xMin = xLen * yFracUp / 2;\n var xMax = xLen - xMin;\n newPointData.x0 = Math.max(Math.min(newPointData.x0, xMax), xMin);\n newPointData.x1 = Math.max(Math.min(newPointData.x1, xMax), xMin);\n return scatterPointData;\n }\n var cdi = newPointData.cd[newPointData.index];\n newPointData.a = cdi.a;\n newPointData.b = cdi.b;\n newPointData.xLabelVal = void 0;\n newPointData.yLabelVal = void 0;\n var trace = newPointData.trace;\n var carpet = trace._carpet;\n var labels = trace._module.formatLabels(cdi, trace);\n newPointData.yLabel = labels.yLabel;\n delete newPointData.text;\n var text = [];\n function textPart(ax, val) {\n var prefix;\n if (ax.labelprefix && ax.labelprefix.length > 0) {\n prefix = ax.labelprefix.replace(/ = $/, \"\");\n } else {\n prefix = ax._hovertitle;\n }\n text.push(prefix + \": \" + val.toFixed(3) + ax.labelsuffix);\n }\n if (!trace.hovertemplate) {\n var hoverinfo = cdi.hi || trace.hoverinfo;\n var parts = hoverinfo.split(\"+\");\n if (parts.indexOf(\"all\") !== -1) parts = [\"a\", \"b\", \"text\"];\n if (parts.indexOf(\"a\") !== -1) textPart(carpet.aaxis, cdi.a);\n if (parts.indexOf(\"b\") !== -1) textPart(carpet.baxis, cdi.b);\n text.push(\"y: \" + newPointData.yLabel);\n if (parts.indexOf(\"text\") !== -1) {\n fillText(cdi, trace, text);\n }\n newPointData.extraText = text.join(\"
    \");\n }\n return scatterPointData;\n };\n }\n });\n\n // src/traces/scattercarpet/event_data.js\n var require_event_data15 = __commonJS({\n \"src/traces/scattercarpet/event_data.js\"(exports, module) {\n \"use strict\";\n module.exports = function eventData(out, pt, trace, cd, pointNumber) {\n var cdi = cd[pointNumber];\n out.a = cdi.a;\n out.b = cdi.b;\n out.y = cdi.y;\n return out;\n };\n }\n });\n\n // src/traces/scattercarpet/index.js\n var require_scattercarpet = __commonJS({\n \"src/traces/scattercarpet/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes64(),\n supplyDefaults: require_defaults60(),\n colorbar: require_marker_colorbar(),\n formatLabels: require_format_labels7(),\n calc: require_calc39(),\n plot: require_plot33(),\n style: require_style2().style,\n styleOnSelect: require_style2().styleOnSelect,\n hoverPoints: require_hover22(),\n selectPoints: require_select2(),\n eventData: require_event_data15(),\n moduleType: \"trace\",\n name: \"scattercarpet\",\n basePlotModule: require_cartesian(),\n categories: [\"svg\", \"carpet\", \"symbols\", \"showLegend\", \"carpetDependent\", \"zoomScale\"],\n meta: {}\n };\n }\n });\n\n // lib/scattercarpet.js\n var require_scattercarpet2 = __commonJS({\n \"lib/scattercarpet.js\"(exports, module) {\n \"use strict\";\n module.exports = require_scattercarpet();\n }\n });\n\n // src/traces/contourcarpet/attributes.js\n var require_attributes65 = __commonJS({\n \"src/traces/contourcarpet/attributes.js\"(exports, module) {\n \"use strict\";\n var heatmapAttrs = require_attributes25();\n var contourAttrs = require_attributes28();\n var colorScaleAttrs = require_attributes8();\n var extendFlat = require_extend().extendFlat;\n var contourContourAttrs = contourAttrs.contours;\n module.exports = extendFlat(\n {\n carpet: {\n valType: \"string\",\n editType: \"calc\"\n },\n z: heatmapAttrs.z,\n a: heatmapAttrs.x,\n a0: heatmapAttrs.x0,\n da: heatmapAttrs.dx,\n b: heatmapAttrs.y,\n b0: heatmapAttrs.y0,\n db: heatmapAttrs.dy,\n text: heatmapAttrs.text,\n hovertext: heatmapAttrs.hovertext,\n transpose: heatmapAttrs.transpose,\n atype: heatmapAttrs.xtype,\n btype: heatmapAttrs.ytype,\n fillcolor: contourAttrs.fillcolor,\n autocontour: contourAttrs.autocontour,\n ncontours: contourAttrs.ncontours,\n contours: {\n type: contourContourAttrs.type,\n start: contourContourAttrs.start,\n end: contourContourAttrs.end,\n size: contourContourAttrs.size,\n coloring: {\n // from contourAttrs.contours.coloring but no 'heatmap' option\n valType: \"enumerated\",\n values: [\"fill\", \"lines\", \"none\"],\n dflt: \"fill\",\n editType: \"calc\"\n },\n showlines: contourContourAttrs.showlines,\n showlabels: contourContourAttrs.showlabels,\n labelfont: contourContourAttrs.labelfont,\n labelformat: contourContourAttrs.labelformat,\n operation: contourContourAttrs.operation,\n value: contourContourAttrs.value,\n editType: \"calc\",\n impliedEdits: { autocontour: false }\n },\n line: {\n color: contourAttrs.line.color,\n width: contourAttrs.line.width,\n dash: contourAttrs.line.dash,\n smoothing: contourAttrs.line.smoothing,\n editType: \"plot\"\n },\n zorder: contourAttrs.zorder\n },\n colorScaleAttrs(\"\", {\n cLetter: \"z\",\n autoColorDflt: false\n })\n );\n }\n });\n\n // src/traces/contourcarpet/defaults.js\n var require_defaults61 = __commonJS({\n \"src/traces/contourcarpet/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleXYZDefaults = require_xyz_defaults();\n var attributes = require_attributes65();\n var handleConstraintDefaults = require_constraint_defaults();\n var handleContoursDefaults = require_contours_defaults();\n var handleStyleDefaults = require_style_defaults3();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n function coerce2(attr) {\n return Lib.coerce2(traceIn, traceOut, attributes, attr);\n }\n coerce(\"carpet\");\n if (traceIn.a && traceIn.b) {\n var len = handleXYZDefaults(traceIn, traceOut, coerce, layout, \"a\", \"b\");\n if (!len) {\n traceOut.visible = false;\n return;\n }\n coerce(\"text\");\n var isConstraint = coerce(\"contours.type\") === \"constraint\";\n if (isConstraint) {\n handleConstraintDefaults(traceIn, traceOut, coerce, layout, defaultColor, { hasHover: false });\n } else {\n handleContoursDefaults(traceIn, traceOut, coerce, coerce2);\n handleStyleDefaults(traceIn, traceOut, coerce, layout, { hasHover: false });\n }\n } else {\n traceOut._defaultColor = defaultColor;\n traceOut._length = null;\n }\n coerce(\"zorder\");\n };\n }\n });\n\n // src/traces/contourcarpet/calc.js\n var require_calc40 = __commonJS({\n \"src/traces/contourcarpet/calc.js\"(exports, module) {\n \"use strict\";\n var colorscaleCalc = require_calc();\n var Lib = require_lib();\n var convertColumnData = require_convert_column_xyz();\n var clean2dArray = require_clean_2d_array();\n var interp2d = require_interp2d();\n var findEmpties = require_find_empties();\n var makeBoundArray = require_make_bound_array();\n var supplyDefaults = require_defaults61();\n var lookupCarpet = require_lookup_carpetid();\n var setContours = require_set_contours();\n module.exports = function calc(gd, trace) {\n var carpet = trace._carpetTrace = lookupCarpet(gd, trace);\n if (!carpet || !carpet.visible || carpet.visible === \"legendonly\") return;\n if (!trace.a || !trace.b) {\n var carpetdata = gd.data[carpet.index];\n var tracedata = gd.data[trace.index];\n if (!tracedata.a) tracedata.a = carpetdata.a;\n if (!tracedata.b) tracedata.b = carpetdata.b;\n supplyDefaults(tracedata, trace, trace._defaultColor, gd._fullLayout);\n }\n var cd = heatmappishCalc(gd, trace);\n setContours(trace, trace._z);\n return cd;\n };\n function heatmappishCalc(gd, trace) {\n var carpet = trace._carpetTrace;\n var aax = carpet.aaxis;\n var bax = carpet.baxis;\n var a, a0, da, b, b0, db, z;\n aax._minDtick = 0;\n bax._minDtick = 0;\n if (Lib.isArray1D(trace.z)) convertColumnData(trace, aax, bax, \"a\", \"b\", [\"z\"]);\n a = trace._a = trace._a || trace.a;\n b = trace._b = trace._b || trace.b;\n a = a ? aax.makeCalcdata(trace, \"_a\") : [];\n b = b ? bax.makeCalcdata(trace, \"_b\") : [];\n a0 = trace.a0 || 0;\n da = trace.da || 1;\n b0 = trace.b0 || 0;\n db = trace.db || 1;\n z = trace._z = clean2dArray(trace._z || trace.z, trace.transpose);\n trace._emptypoints = findEmpties(z);\n interp2d(z, trace._emptypoints);\n var xlen = Lib.maxRowLength(z);\n var xIn = trace.xtype === \"scaled\" ? \"\" : a;\n var xArray = makeBoundArray(trace, xIn, a0, da, xlen, aax);\n var yIn = trace.ytype === \"scaled\" ? \"\" : b;\n var yArray = makeBoundArray(trace, yIn, b0, db, z.length, bax);\n var cd0 = {\n a: xArray,\n b: yArray,\n z\n };\n if (trace.contours.type === \"levels\" && trace.contours.coloring !== \"none\") {\n colorscaleCalc(gd, trace, {\n vals: z,\n containerStr: \"\",\n cLetter: \"z\"\n });\n }\n return [cd0];\n }\n }\n });\n\n // src/traces/carpet/axis_aligned_line.js\n var require_axis_aligned_line = __commonJS({\n \"src/traces/carpet/axis_aligned_line.js\"(exports, module) {\n \"use strict\";\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n module.exports = function(carpet, carpetcd, a, b) {\n var idx, tangent, tanIsoIdx, tanIsoPar, segment, refidx;\n var p0, p1, v0, v1, start, end, range;\n var axis = isArrayOrTypedArray(a) ? \"a\" : \"b\";\n var ax = axis === \"a\" ? carpet.aaxis : carpet.baxis;\n var smoothing = ax.smoothing;\n var toIdx = axis === \"a\" ? carpet.a2i : carpet.b2j;\n var pt = axis === \"a\" ? a : b;\n var iso = axis === \"a\" ? b : a;\n var n = axis === \"a\" ? carpetcd.a.length : carpetcd.b.length;\n var m = axis === \"a\" ? carpetcd.b.length : carpetcd.a.length;\n var isoIdx = Math.floor(axis === \"a\" ? carpet.b2j(iso) : carpet.a2i(iso));\n var xy = axis === \"a\" ? function(value) {\n return carpet.evalxy([], value, isoIdx);\n } : function(value) {\n return carpet.evalxy([], isoIdx, value);\n };\n if (smoothing) {\n tanIsoIdx = Math.max(0, Math.min(m - 2, isoIdx));\n tanIsoPar = isoIdx - tanIsoIdx;\n tangent = axis === \"a\" ? function(i, ti) {\n return carpet.dxydi([], i, tanIsoIdx, ti, tanIsoPar);\n } : function(j, tj) {\n return carpet.dxydj([], tanIsoIdx, j, tanIsoPar, tj);\n };\n }\n var vstart = toIdx(pt[0]);\n var vend = toIdx(pt[1]);\n var dir = vstart < vend ? 1 : -1;\n var tol = (vend - vstart) * 1e-8;\n var dirfloor = dir > 0 ? Math.floor : Math.ceil;\n var dirceil = dir > 0 ? Math.ceil : Math.floor;\n var dirmin = dir > 0 ? Math.min : Math.max;\n var dirmax = dir > 0 ? Math.max : Math.min;\n var idx0 = dirfloor(vstart + tol);\n var idx1 = dirceil(vend - tol);\n p0 = xy(vstart);\n var segments = [[p0]];\n for (idx = idx0; idx * dir < idx1 * dir; idx += dir) {\n segment = [];\n start = dirmax(vstart, idx);\n end = dirmin(vend, idx + dir);\n range = end - start;\n refidx = Math.max(0, Math.min(n - 2, Math.floor(0.5 * (start + end))));\n p1 = xy(end);\n if (smoothing) {\n v0 = tangent(refidx, start - refidx);\n v1 = tangent(refidx, end - refidx);\n segment.push([\n p0[0] + v0[0] / 3 * range,\n p0[1] + v0[1] / 3 * range\n ]);\n segment.push([\n p1[0] - v1[0] / 3 * range,\n p1[1] - v1[1] / 3 * range\n ]);\n }\n segment.push(p1);\n segments.push(segment);\n p0 = p1;\n }\n return segments;\n };\n }\n });\n\n // src/traces/contourcarpet/plot.js\n var require_plot34 = __commonJS({\n \"src/traces/contourcarpet/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var map1dArray = require_map_1d_array();\n var makepath = require_makepath();\n var Drawing = require_drawing();\n var Lib = require_lib();\n var makeCrossings = require_make_crossings();\n var findAllPaths = require_find_all_paths();\n var contourPlot = require_plot6();\n var constants = require_constants16();\n var convertToConstraints = require_convert_to_constraints();\n var emptyPathinfo = require_empty_pathinfo();\n var closeBoundaries = require_close_boundaries();\n var lookupCarpet = require_lookup_carpetid();\n var axisAlignedLine = require_axis_aligned_line();\n module.exports = function plot(gd, plotinfo, cdcontours, contourcarpetLayer) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n Lib.makeTraceGroups(contourcarpetLayer, cdcontours, \"contour\").each(function(cd) {\n var plotGroup = d3.select(this);\n var cd0 = cd[0];\n var trace = cd0.trace;\n var carpet = trace._carpetTrace = lookupCarpet(gd, trace);\n var carpetcd = gd.calcdata[carpet.index][0];\n if (!carpet.visible || carpet.visible === \"legendonly\") return;\n var a = cd0.a;\n var b = cd0.b;\n var contours = trace.contours;\n var pathinfo = emptyPathinfo(contours, plotinfo, cd0);\n var isConstraint = contours.type === \"constraint\";\n var operation = contours._operation;\n var coloring = isConstraint ? operation === \"=\" ? \"lines\" : \"fill\" : contours.coloring;\n function ab2p(ab) {\n var pt = carpet.ab2xy(ab[0], ab[1], true);\n return [xa.c2p(pt[0]), ya.c2p(pt[1])];\n }\n var perimeter = [\n [a[0], b[b.length - 1]],\n [a[a.length - 1], b[b.length - 1]],\n [a[a.length - 1], b[0]],\n [a[0], b[0]]\n ];\n makeCrossings(pathinfo);\n var atol = (a[a.length - 1] - a[0]) * 1e-8;\n var btol = (b[b.length - 1] - b[0]) * 1e-8;\n findAllPaths(pathinfo, atol, btol);\n var fillPathinfo = pathinfo;\n if (contours.type === \"constraint\") {\n fillPathinfo = convertToConstraints(pathinfo, operation);\n }\n mapPathinfo(pathinfo, ab2p);\n var seg, xp, yp, i;\n var segs = [];\n for (i = carpetcd.clipsegments.length - 1; i >= 0; i--) {\n seg = carpetcd.clipsegments[i];\n xp = map1dArray([], seg.x, xa.c2p);\n yp = map1dArray([], seg.y, ya.c2p);\n xp.reverse();\n yp.reverse();\n segs.push(makepath(xp, yp, seg.bicubic));\n }\n var boundaryPath = \"M\" + segs.join(\"L\") + \"Z\";\n makeBackground(plotGroup, carpetcd.clipsegments, xa, ya, isConstraint, coloring);\n makeFills(trace, plotGroup, xa, ya, fillPathinfo, perimeter, ab2p, carpet, carpetcd, coloring, boundaryPath);\n makeLinesAndLabels(plotGroup, pathinfo, gd, cd0, contours, plotinfo, carpet);\n Drawing.setClipUrl(plotGroup, carpet._clipPathId, gd);\n });\n };\n function mapPathinfo(pathinfo, map) {\n var i, j, k, pi, pedgepaths, ppaths, pedgepath, ppath, path;\n for (i = 0; i < pathinfo.length; i++) {\n pi = pathinfo[i];\n pedgepaths = pi.pedgepaths = [];\n ppaths = pi.ppaths = [];\n for (j = 0; j < pi.edgepaths.length; j++) {\n path = pi.edgepaths[j];\n pedgepath = [];\n for (k = 0; k < path.length; k++) {\n pedgepath[k] = map(path[k]);\n }\n pedgepaths.push(pedgepath);\n }\n for (j = 0; j < pi.paths.length; j++) {\n path = pi.paths[j];\n ppath = [];\n for (k = 0; k < path.length; k++) {\n ppath[k] = map(path[k]);\n }\n ppaths.push(ppath);\n }\n }\n }\n function makeLinesAndLabels(plotgroup, pathinfo, gd, cd0, contours, plotinfo, carpet) {\n var isStatic = gd._context.staticPlot;\n var lineContainer = Lib.ensureSingle(plotgroup, \"g\", \"contourlines\");\n var showLines = contours.showlines !== false;\n var showLabels = contours.showlabels;\n var clipLinesForLabels = showLines && showLabels;\n var linegroup = contourPlot.createLines(lineContainer, showLines || showLabels, pathinfo, isStatic);\n var lineClip = contourPlot.createLineClip(lineContainer, clipLinesForLabels, gd, cd0.trace.uid);\n var labelGroup = plotgroup.selectAll(\"g.contourlabels\").data(showLabels ? [0] : []);\n labelGroup.exit().remove();\n labelGroup.enter().append(\"g\").classed(\"contourlabels\", true);\n if (showLabels) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var xLen = xa._length;\n var yLen = ya._length;\n var labelClipPathData = [[\n [0, 0],\n [xLen, 0],\n [xLen, yLen],\n [0, yLen]\n ]];\n var labelData = [];\n Lib.clearLocationCache();\n var contourFormat = contourPlot.labelFormatter(gd, cd0);\n var dummyText = Drawing.tester.append(\"text\").attr(\"data-notex\", 1).call(Drawing.font, contours.labelfont);\n var bounds = {\n left: 0,\n right: xLen,\n center: xLen / 2,\n top: 0,\n bottom: yLen,\n middle: yLen / 2\n };\n var plotDiagonal = Math.sqrt(xLen * xLen + yLen * yLen);\n var normLength = constants.LABELDISTANCE * plotDiagonal / Math.max(1, pathinfo.length / constants.LABELINCREASE);\n linegroup.each(function(d) {\n var textOpts = contourPlot.calcTextOpts(d.level, contourFormat, dummyText, gd);\n d3.select(this).selectAll(\"path\").each(function(pathData) {\n var path = this;\n var pathBounds = Lib.getVisibleSegment(path, bounds, textOpts.height / 2);\n if (!pathBounds) return;\n constrainToCarpet(path, pathData, d, pathBounds, carpet, textOpts.height);\n if (pathBounds.len < (textOpts.width + textOpts.height) * constants.LABELMIN) return;\n var maxLabels = Math.min(\n Math.ceil(pathBounds.len / normLength),\n constants.LABELMAX\n );\n for (var i = 0; i < maxLabels; i++) {\n var loc = contourPlot.findBestTextLocation(\n path,\n pathBounds,\n textOpts,\n labelData,\n bounds\n );\n if (!loc) break;\n contourPlot.addLabelData(loc, textOpts, labelData, labelClipPathData);\n }\n });\n });\n dummyText.remove();\n contourPlot.drawLabels(\n labelGroup,\n labelData,\n gd,\n lineClip,\n clipLinesForLabels ? labelClipPathData : null\n );\n }\n if (showLabels && !showLines) linegroup.remove();\n }\n function constrainToCarpet(path, pathData, levelData, pathBounds, carpet, textHeight) {\n var pathABData;\n for (var i = 0; i < levelData.pedgepaths.length; i++) {\n if (pathData === levelData.pedgepaths[i]) {\n pathABData = levelData.edgepaths[i];\n }\n }\n if (!pathABData) return;\n var aMin = carpet.a[0];\n var aMax = carpet.a[carpet.a.length - 1];\n var bMin = carpet.b[0];\n var bMax = carpet.b[carpet.b.length - 1];\n function getOffset(abPt, pathVector) {\n var offset = 0;\n var edgeVector;\n var dAB = 0.1;\n if (Math.abs(abPt[0] - aMin) < dAB || Math.abs(abPt[0] - aMax) < dAB) {\n edgeVector = normalizeVector(carpet.dxydb_rough(abPt[0], abPt[1], dAB));\n offset = Math.max(offset, textHeight * vectorTan(pathVector, edgeVector) / 2);\n }\n if (Math.abs(abPt[1] - bMin) < dAB || Math.abs(abPt[1] - bMax) < dAB) {\n edgeVector = normalizeVector(carpet.dxyda_rough(abPt[0], abPt[1], dAB));\n offset = Math.max(offset, textHeight * vectorTan(pathVector, edgeVector) / 2);\n }\n return offset;\n }\n var startVector = getUnitVector(path, 0, 1);\n var endVector = getUnitVector(path, pathBounds.total, pathBounds.total - 1);\n var minStart = getOffset(pathABData[0], startVector);\n var maxEnd = pathBounds.total - getOffset(pathABData[pathABData.length - 1], endVector);\n if (pathBounds.min < minStart) pathBounds.min = minStart;\n if (pathBounds.max > maxEnd) pathBounds.max = maxEnd;\n pathBounds.len = pathBounds.max - pathBounds.min;\n }\n function getUnitVector(path, p0, p1) {\n var pt0 = path.getPointAtLength(p0);\n var pt1 = path.getPointAtLength(p1);\n var dx = pt1.x - pt0.x;\n var dy = pt1.y - pt0.y;\n var len = Math.sqrt(dx * dx + dy * dy);\n return [dx / len, dy / len];\n }\n function normalizeVector(v) {\n var len = Math.sqrt(v[0] * v[0] + v[1] * v[1]);\n return [v[0] / len, v[1] / len];\n }\n function vectorTan(v0, v1) {\n var cos = Math.abs(v0[0] * v1[0] + v0[1] * v1[1]);\n var sin = Math.sqrt(1 - cos * cos);\n return sin / cos;\n }\n function makeBackground(plotgroup, clipsegments, xaxis, yaxis, isConstraint, coloring) {\n var seg, xp, yp, i;\n var bggroup = Lib.ensureSingle(plotgroup, \"g\", \"contourbg\");\n var bgfill = bggroup.selectAll(\"path\").data(coloring === \"fill\" && !isConstraint ? [0] : []);\n bgfill.enter().append(\"path\");\n bgfill.exit().remove();\n var segs = [];\n for (i = 0; i < clipsegments.length; i++) {\n seg = clipsegments[i];\n xp = map1dArray([], seg.x, xaxis.c2p);\n yp = map1dArray([], seg.y, yaxis.c2p);\n segs.push(makepath(xp, yp, seg.bicubic));\n }\n bgfill.attr(\"d\", \"M\" + segs.join(\"L\") + \"Z\").style(\"stroke\", \"none\");\n }\n function makeFills(trace, plotgroup, xa, ya, pathinfo, perimeter, ab2p, carpet, carpetcd, coloring, boundaryPath) {\n var hasFills = coloring === \"fill\";\n if (hasFills) {\n closeBoundaries(pathinfo, trace.contours);\n }\n var fillgroup = Lib.ensureSingle(plotgroup, \"g\", \"contourfill\");\n var fillitems = fillgroup.selectAll(\"path\").data(hasFills ? pathinfo : []);\n fillitems.enter().append(\"path\");\n fillitems.exit().remove();\n fillitems.each(function(pi) {\n var fullpath = (pi.prefixBoundary ? boundaryPath : \"\") + joinAllPaths(trace, pi, perimeter, ab2p, carpet, carpetcd, xa, ya);\n if (!fullpath) {\n d3.select(this).remove();\n } else {\n d3.select(this).attr(\"d\", fullpath).style(\"stroke\", \"none\");\n }\n });\n }\n function joinAllPaths(trace, pi, perimeter, ab2p, carpet, carpetcd, xa, ya) {\n var i;\n var fullpath = \"\";\n var startsleft = pi.edgepaths.map(function(v, i2) {\n return i2;\n });\n var newloop = true;\n var endpt, newendpt, cnt, nexti, possiblei, addpath;\n var atol = Math.abs(perimeter[0][0] - perimeter[2][0]) * 1e-4;\n var btol = Math.abs(perimeter[0][1] - perimeter[2][1]) * 1e-4;\n function istop(pt) {\n return Math.abs(pt[1] - perimeter[0][1]) < btol;\n }\n function isbottom(pt) {\n return Math.abs(pt[1] - perimeter[2][1]) < btol;\n }\n function isleft(pt) {\n return Math.abs(pt[0] - perimeter[0][0]) < atol;\n }\n function isright(pt) {\n return Math.abs(pt[0] - perimeter[2][0]) < atol;\n }\n function pathto(pt0, pt1) {\n var i2, j, segments, axis;\n var path = \"\";\n if (istop(pt0) && !isright(pt0) || isbottom(pt0) && !isleft(pt0)) {\n axis = carpet.aaxis;\n segments = axisAlignedLine(carpet, carpetcd, [pt0[0], pt1[0]], 0.5 * (pt0[1] + pt1[1]));\n } else {\n axis = carpet.baxis;\n segments = axisAlignedLine(carpet, carpetcd, 0.5 * (pt0[0] + pt1[0]), [pt0[1], pt1[1]]);\n }\n for (i2 = 1; i2 < segments.length; i2++) {\n path += axis.smoothing ? \"C\" : \"L\";\n for (j = 0; j < segments[i2].length; j++) {\n var pt = segments[i2][j];\n path += [xa.c2p(pt[0]), ya.c2p(pt[1])] + \" \";\n }\n }\n return path;\n }\n i = 0;\n endpt = null;\n while (startsleft.length) {\n var startpt = pi.edgepaths[i][0];\n if (endpt) {\n fullpath += pathto(endpt, startpt);\n }\n addpath = Drawing.smoothopen(pi.edgepaths[i].map(ab2p), pi.smoothing);\n fullpath += newloop ? addpath : addpath.replace(/^M/, \"L\");\n startsleft.splice(startsleft.indexOf(i), 1);\n endpt = pi.edgepaths[i][pi.edgepaths[i].length - 1];\n nexti = -1;\n for (cnt = 0; cnt < 4; cnt++) {\n if (!endpt) {\n Lib.log(\"Missing end?\", i, pi);\n break;\n }\n if (istop(endpt) && !isright(endpt)) {\n newendpt = perimeter[1];\n } else if (isleft(endpt)) {\n newendpt = perimeter[0];\n } else if (isbottom(endpt)) {\n newendpt = perimeter[3];\n } else if (isright(endpt)) {\n newendpt = perimeter[2];\n }\n for (possiblei = 0; possiblei < pi.edgepaths.length; possiblei++) {\n var ptNew = pi.edgepaths[possiblei][0];\n if (Math.abs(endpt[0] - newendpt[0]) < atol) {\n if (Math.abs(endpt[0] - ptNew[0]) < atol && (ptNew[1] - endpt[1]) * (newendpt[1] - ptNew[1]) >= 0) {\n newendpt = ptNew;\n nexti = possiblei;\n }\n } else if (Math.abs(endpt[1] - newendpt[1]) < btol) {\n if (Math.abs(endpt[1] - ptNew[1]) < btol && (ptNew[0] - endpt[0]) * (newendpt[0] - ptNew[0]) >= 0) {\n newendpt = ptNew;\n nexti = possiblei;\n }\n } else {\n Lib.log(\"endpt to newendpt is not vert. or horz.\", endpt, newendpt, ptNew);\n }\n }\n if (nexti >= 0) break;\n fullpath += pathto(endpt, newendpt);\n endpt = newendpt;\n }\n if (nexti === pi.edgepaths.length) {\n Lib.log(\"unclosed perimeter path\");\n break;\n }\n i = nexti;\n newloop = startsleft.indexOf(i) === -1;\n if (newloop) {\n i = startsleft[0];\n fullpath += pathto(endpt, newendpt) + \"Z\";\n endpt = null;\n }\n }\n for (i = 0; i < pi.paths.length; i++) {\n fullpath += Drawing.smoothclosed(pi.paths[i].map(ab2p), pi.smoothing);\n }\n return fullpath;\n }\n }\n });\n\n // src/traces/contourcarpet/index.js\n var require_contourcarpet = __commonJS({\n \"src/traces/contourcarpet/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attributes: require_attributes65(),\n supplyDefaults: require_defaults61(),\n colorbar: require_colorbar3(),\n calc: require_calc40(),\n plot: require_plot34(),\n style: require_style7(),\n moduleType: \"trace\",\n name: \"contourcarpet\",\n basePlotModule: require_cartesian(),\n categories: [\"cartesian\", \"svg\", \"carpet\", \"contour\", \"symbols\", \"showLegend\", \"hasLines\", \"carpetDependent\", \"noHover\", \"noSortingByValue\"],\n meta: {}\n };\n }\n });\n\n // lib/contourcarpet.js\n var require_contourcarpet2 = __commonJS({\n \"lib/contourcarpet.js\"(exports, module) {\n \"use strict\";\n module.exports = require_contourcarpet();\n }\n });\n\n // src/traces/ohlc/attributes.js\n var require_attributes66 = __commonJS({\n \"src/traces/ohlc/attributes.js\"(exports, module) {\n \"use strict\";\n var extendFlat = require_lib().extendFlat;\n var scatterAttrs = require_attributes12();\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var dash = require_attributes4().dash;\n var fxAttrs = require_attributes();\n var delta = require_delta();\n var INCREASING_COLOR = delta.INCREASING.COLOR;\n var DECREASING_COLOR = delta.DECREASING.COLOR;\n var lineAttrs = scatterAttrs.line;\n function directionAttrs(lineColorDefault) {\n return {\n line: {\n color: extendFlat({}, lineAttrs.color, { dflt: lineColorDefault }),\n width: lineAttrs.width,\n dash,\n editType: \"style\"\n },\n editType: \"style\"\n };\n }\n module.exports = {\n xperiod: scatterAttrs.xperiod,\n xperiod0: scatterAttrs.xperiod0,\n xperiodalignment: scatterAttrs.xperiodalignment,\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n x: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n open: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n high: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n low: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n close: {\n valType: \"data_array\",\n editType: \"calc\"\n },\n line: {\n width: extendFlat({}, lineAttrs.width, {}),\n dash: extendFlat({}, dash, {}),\n editType: \"style\"\n },\n increasing: directionAttrs(INCREASING_COLOR),\n decreasing: directionAttrs(DECREASING_COLOR),\n text: {\n valType: \"string\",\n dflt: \"\",\n arrayOk: true,\n editType: \"calc\"\n },\n hovertext: {\n valType: \"string\",\n dflt: \"\",\n arrayOk: true,\n editType: \"calc\"\n },\n tickwidth: {\n valType: \"number\",\n min: 0,\n max: 0.5,\n dflt: 0.3,\n editType: \"calc\"\n },\n hoverlabel: extendFlat({}, fxAttrs.hoverlabel, {\n split: {\n valType: \"boolean\",\n dflt: false,\n editType: \"style\"\n }\n }),\n zorder: scatterAttrs.zorder\n };\n }\n });\n\n // src/traces/ohlc/ohlc_defaults.js\n var require_ohlc_defaults = __commonJS({\n \"src/traces/ohlc/ohlc_defaults.js\"(exports, module) {\n \"use strict\";\n var Registry = require_registry();\n var Lib = require_lib();\n module.exports = function handleOHLC(traceIn, traceOut, coerce, layout) {\n var x = coerce(\"x\");\n var open = coerce(\"open\");\n var high = coerce(\"high\");\n var low = coerce(\"low\");\n var close = coerce(\"close\");\n coerce(\"hoverlabel.split\");\n var handleCalendarDefaults = Registry.getComponentMethod(\"calendars\", \"handleTraceDefaults\");\n handleCalendarDefaults(traceIn, traceOut, [\"x\"], layout);\n if (!(open && high && low && close)) return;\n var len = Math.min(open.length, high.length, low.length, close.length);\n if (x) len = Math.min(len, Lib.minRowLength(x));\n traceOut._length = len;\n return len;\n };\n }\n });\n\n // src/traces/ohlc/defaults.js\n var require_defaults62 = __commonJS({\n \"src/traces/ohlc/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleOHLC = require_ohlc_defaults();\n var handlePeriodDefaults = require_period_defaults();\n var attributes = require_attributes66();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var len = handleOHLC(traceIn, traceOut, coerce, layout);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n handlePeriodDefaults(traceIn, traceOut, layout, coerce, { x: true });\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n coerce(\"line.width\");\n coerce(\"line.dash\");\n handleDirection(traceIn, traceOut, coerce, \"increasing\");\n handleDirection(traceIn, traceOut, coerce, \"decreasing\");\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"tickwidth\");\n layout._requestRangeslider[traceOut.xaxis] = true;\n coerce(\"zorder\");\n };\n function handleDirection(traceIn, traceOut, coerce, direction) {\n coerce(direction + \".line.color\");\n coerce(direction + \".line.width\", traceOut.line.width);\n coerce(direction + \".line.dash\", traceOut.line.dash);\n }\n }\n });\n\n // src/traces/ohlc/calc.js\n var require_calc41 = __commonJS({\n \"src/traces/ohlc/calc.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var _ = Lib._;\n var Axes = require_axes();\n var alignPeriod = require_align_period();\n var BADNUM = require_numerical().BADNUM;\n function calc(gd, trace) {\n var xa = Axes.getFromId(gd, trace.xaxis);\n var ya = Axes.getFromId(gd, trace.yaxis);\n var tickLen = convertTickWidth(gd, xa, trace);\n var minDiff = trace._minDiff;\n trace._minDiff = null;\n var origX = trace._origX;\n trace._origX = null;\n var x = trace._xcalc;\n trace._xcalc = null;\n var cd = calcCommon(gd, trace, origX, x, ya, ptFunc);\n trace._extremes[xa._id] = Axes.findExtremes(xa, x, { vpad: minDiff / 2 });\n if (cd.length) {\n Lib.extendFlat(cd[0].t, {\n wHover: minDiff / 2,\n tickLen\n });\n return cd;\n } else {\n return [{ t: { empty: true } }];\n }\n }\n function ptFunc(o, h, l, c) {\n return {\n o,\n h,\n l,\n c\n };\n }\n function calcCommon(gd, trace, origX, x, ya, ptFunc2) {\n var o = ya.makeCalcdata(trace, \"open\");\n var h = ya.makeCalcdata(trace, \"high\");\n var l = ya.makeCalcdata(trace, \"low\");\n var c = ya.makeCalcdata(trace, \"close\");\n var hasTextArray = Lib.isArrayOrTypedArray(trace.text);\n var hasHovertextArray = Lib.isArrayOrTypedArray(trace.hovertext);\n var increasing = true;\n var cPrev = null;\n var hasPeriod = !!trace.xperiodalignment;\n var cd = [];\n for (var i = 0; i < x.length; i++) {\n var xi = x[i];\n var oi = o[i];\n var hi = h[i];\n var li = l[i];\n var ci = c[i];\n if (xi !== BADNUM && oi !== BADNUM && hi !== BADNUM && li !== BADNUM && ci !== BADNUM) {\n if (ci === oi) {\n if (cPrev !== null && ci !== cPrev) increasing = ci > cPrev;\n } else increasing = ci > oi;\n cPrev = ci;\n var pt = ptFunc2(oi, hi, li, ci);\n pt.pos = xi;\n pt.yc = (oi + ci) / 2;\n pt.i = i;\n pt.dir = increasing ? \"increasing\" : \"decreasing\";\n pt.x = pt.pos;\n pt.y = [li, hi];\n if (hasPeriod) pt.orig_p = origX[i];\n if (hasTextArray) pt.tx = trace.text[i];\n if (hasHovertextArray) pt.htx = trace.hovertext[i];\n cd.push(pt);\n } else {\n cd.push({ pos: xi, empty: true });\n }\n }\n trace._extremes[ya._id] = Axes.findExtremes(ya, Lib.concat(l, h), { padded: true });\n if (cd.length) {\n cd[0].t = {\n labels: {\n open: _(gd, \"open:\") + \" \",\n high: _(gd, \"high:\") + \" \",\n low: _(gd, \"low:\") + \" \",\n close: _(gd, \"close:\") + \" \"\n }\n };\n }\n return cd;\n }\n function convertTickWidth(gd, xa, trace) {\n var minDiff = trace._minDiff;\n if (!minDiff) {\n var fullData = gd._fullData;\n var ohlcTracesOnThisXaxis = [];\n minDiff = Infinity;\n var i;\n for (i = 0; i < fullData.length; i++) {\n var tracei = fullData[i];\n if (tracei.type === \"ohlc\" && tracei.visible === true && tracei.xaxis === xa._id) {\n ohlcTracesOnThisXaxis.push(tracei);\n var origX = xa.makeCalcdata(tracei, \"x\");\n tracei._origX = origX;\n var xcalc = alignPeriod(trace, xa, \"x\", origX).vals;\n tracei._xcalc = xcalc;\n var _minDiff = Lib.distinctVals(xcalc).minDiff;\n if (_minDiff && isFinite(_minDiff)) {\n minDiff = Math.min(minDiff, _minDiff);\n }\n }\n }\n if (minDiff === Infinity) minDiff = 1;\n for (i = 0; i < ohlcTracesOnThisXaxis.length; i++) {\n ohlcTracesOnThisXaxis[i]._minDiff = minDiff;\n }\n }\n return minDiff * trace.tickwidth;\n }\n module.exports = {\n calc,\n calcCommon\n };\n }\n });\n\n // src/traces/ohlc/plot.js\n var require_plot35 = __commonJS({\n \"src/traces/ohlc/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Lib = require_lib();\n module.exports = function plot(gd, plotinfo, cdOHLC, ohlcLayer) {\n var ya = plotinfo.yaxis;\n var xa = plotinfo.xaxis;\n var posHasRangeBreaks = !!xa.rangebreaks;\n Lib.makeTraceGroups(ohlcLayer, cdOHLC, \"trace ohlc\").each(function(cd) {\n var plotGroup = d3.select(this);\n var cd0 = cd[0];\n var t = cd0.t;\n var trace = cd0.trace;\n if (trace.visible !== true || t.empty) {\n plotGroup.remove();\n return;\n }\n var tickLen = t.tickLen;\n var paths = plotGroup.selectAll(\"path\").data(Lib.identity);\n paths.enter().append(\"path\");\n paths.exit().remove();\n paths.attr(\"d\", function(d) {\n if (d.empty) return \"M0,0Z\";\n var xo = xa.c2p(d.pos - tickLen, true);\n var xc = xa.c2p(d.pos + tickLen, true);\n var x = posHasRangeBreaks ? (xo + xc) / 2 : xa.c2p(d.pos, true);\n var yo = ya.c2p(d.o, true);\n var yh = ya.c2p(d.h, true);\n var yl = ya.c2p(d.l, true);\n var yc = ya.c2p(d.c, true);\n return \"M\" + xo + \",\" + yo + \"H\" + x + \"M\" + x + \",\" + yh + \"V\" + yl + \"M\" + xc + \",\" + yc + \"H\" + x;\n });\n });\n };\n }\n });\n\n // src/traces/ohlc/style.js\n var require_style19 = __commonJS({\n \"src/traces/ohlc/style.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var Drawing = require_drawing();\n var Color2 = require_color();\n module.exports = function style(gd, cd, sel) {\n var s = sel ? sel : d3.select(gd).selectAll(\"g.ohlclayer\").selectAll(\"g.trace\");\n s.style(\"opacity\", function(d) {\n return d[0].trace.opacity;\n });\n s.each(function(d) {\n var trace = d[0].trace;\n d3.select(this).selectAll(\"path\").each(function(di) {\n if (di.empty) return;\n var dirLine = trace[di.dir].line;\n d3.select(this).style(\"fill\", \"none\").call(Color2.stroke, dirLine.color).call(Drawing.dashLine, dirLine.dash, dirLine.width).style(\"opacity\", trace.selectedpoints && !di.selected ? 0.3 : 1);\n });\n });\n };\n }\n });\n\n // src/traces/ohlc/hover.js\n var require_hover23 = __commonJS({\n \"src/traces/ohlc/hover.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n var Lib = require_lib();\n var Fx = require_fx();\n var Color2 = require_color();\n var fillText = require_lib().fillText;\n var delta = require_delta();\n var DIRSYMBOL = {\n increasing: delta.INCREASING.SYMBOL,\n decreasing: delta.DECREASING.SYMBOL\n };\n function hoverPoints(pointData, xval, yval, hovermode) {\n var cd = pointData.cd;\n var trace = cd[0].trace;\n if (trace.hoverlabel.split) {\n return hoverSplit(pointData, xval, yval, hovermode);\n }\n return hoverOnPoints(pointData, xval, yval, hovermode);\n }\n function _getClosestPoint(pointData, xval, yval, hovermode) {\n var cd = pointData.cd;\n var xa = pointData.xa;\n var trace = cd[0].trace;\n var t = cd[0].t;\n var type = trace.type;\n var minAttr = type === \"ohlc\" ? \"l\" : \"min\";\n var maxAttr = type === \"ohlc\" ? \"h\" : \"max\";\n var hoverPseudoDistance, spikePseudoDistance;\n var centerShift = t.bPos || 0;\n var shiftPos = function(di2) {\n return di2.pos + centerShift - xval;\n };\n var displayHalfWidth = t.bdPos || t.tickLen;\n var hoverHalfWidth = t.wHover;\n var pseudoDistance = Math.min(1, displayHalfWidth / Math.abs(xa.r2c(xa.range[1]) - xa.r2c(xa.range[0])));\n hoverPseudoDistance = pointData.maxHoverDistance - pseudoDistance;\n spikePseudoDistance = pointData.maxSpikeDistance - pseudoDistance;\n function dx(di2) {\n var pos = shiftPos(di2);\n return Fx.inbox(pos - hoverHalfWidth, pos + hoverHalfWidth, hoverPseudoDistance);\n }\n function dy(di2) {\n var min = di2[minAttr];\n var max = di2[maxAttr];\n return min === max || Fx.inbox(min - yval, max - yval, hoverPseudoDistance);\n }\n function dxy(di2) {\n return (dx(di2) + dy(di2)) / 2;\n }\n var distfn = Fx.getDistanceFunction(hovermode, dx, dy, dxy);\n Fx.getClosest(cd, distfn, pointData);\n if (pointData.index === false) return null;\n var di = cd[pointData.index];\n if (di.empty) return null;\n var dir = di.dir;\n var container = trace[dir];\n var lc = container.line.color;\n if (Color2.opacity(lc) && container.line.width) pointData.color = lc;\n else pointData.color = container.fillcolor;\n pointData.x0 = xa.c2p(di.pos + centerShift - displayHalfWidth, true);\n pointData.x1 = xa.c2p(di.pos + centerShift + displayHalfWidth, true);\n pointData.xLabelVal = di.orig_p !== void 0 ? di.orig_p : di.pos;\n pointData.spikeDistance = dxy(di) * spikePseudoDistance / hoverPseudoDistance;\n pointData.xSpike = xa.c2p(di.pos, true);\n return pointData;\n }\n function hoverSplit(pointData, xval, yval, hovermode) {\n var cd = pointData.cd;\n var ya = pointData.ya;\n var trace = cd[0].trace;\n var t = cd[0].t;\n var closeBoxData = [];\n var closestPoint = _getClosestPoint(pointData, xval, yval, hovermode);\n if (!closestPoint) return [];\n var cdIndex = closestPoint.index;\n var di = cd[cdIndex];\n var hoverinfo = di.hi || trace.hoverinfo;\n var hoverParts = hoverinfo.split(\"+\");\n var isAll = hoverinfo === \"all\";\n var hasY = isAll || hoverParts.indexOf(\"y\") !== -1;\n if (!hasY) return [];\n var attrs = [\"high\", \"open\", \"close\", \"low\"];\n var usedVals = {};\n for (var i = 0; i < attrs.length; i++) {\n var attr = attrs[i];\n var val = trace[attr][closestPoint.index];\n var valPx = ya.c2p(val, true);\n var pointData2;\n if (val in usedVals) {\n pointData2 = usedVals[val];\n pointData2.yLabel += \"
    \" + t.labels[attr] + Axes.hoverLabelText(ya, val, trace.yhoverformat);\n } else {\n pointData2 = Lib.extendFlat({}, closestPoint);\n pointData2.y0 = pointData2.y1 = valPx;\n pointData2.yLabelVal = val;\n pointData2.yLabel = t.labels[attr] + Axes.hoverLabelText(ya, val, trace.yhoverformat);\n pointData2.name = \"\";\n closeBoxData.push(pointData2);\n usedVals[val] = pointData2;\n }\n }\n return closeBoxData;\n }\n function hoverOnPoints(pointData, xval, yval, hovermode) {\n var cd = pointData.cd;\n var ya = pointData.ya;\n var trace = cd[0].trace;\n var t = cd[0].t;\n var closestPoint = _getClosestPoint(pointData, xval, yval, hovermode);\n if (!closestPoint) return [];\n var cdIndex = closestPoint.index;\n var di = cd[cdIndex];\n var i = closestPoint.index = di.i;\n var dir = di.dir;\n function getLabelLine(attr) {\n return t.labels[attr] + Axes.hoverLabelText(ya, trace[attr][i], trace.yhoverformat);\n }\n var hoverinfo = di.hi || trace.hoverinfo;\n var hoverParts = hoverinfo.split(\"+\");\n var isAll = hoverinfo === \"all\";\n var hasY = isAll || hoverParts.indexOf(\"y\") !== -1;\n var hasText = isAll || hoverParts.indexOf(\"text\") !== -1;\n var textParts = hasY ? [\n getLabelLine(\"open\"),\n getLabelLine(\"high\"),\n getLabelLine(\"low\"),\n getLabelLine(\"close\") + \" \" + DIRSYMBOL[dir]\n ] : [];\n if (hasText) fillText(di, trace, textParts);\n closestPoint.extraText = textParts.join(\"
    \");\n closestPoint.y0 = closestPoint.y1 = ya.c2p(di.yc, true);\n return [closestPoint];\n }\n module.exports = {\n hoverPoints,\n hoverSplit,\n hoverOnPoints\n };\n }\n });\n\n // src/traces/ohlc/select.js\n var require_select12 = __commonJS({\n \"src/traces/ohlc/select.js\"(exports, module) {\n \"use strict\";\n module.exports = function selectPoints(searchInfo, selectionTester) {\n var cd = searchInfo.cd;\n var xa = searchInfo.xaxis;\n var ya = searchInfo.yaxis;\n var selection = [];\n var i;\n var posOffset = cd[0].t.bPos || 0;\n if (selectionTester === false) {\n for (i = 0; i < cd.length; i++) {\n cd[i].selected = 0;\n }\n } else {\n for (i = 0; i < cd.length; i++) {\n var di = cd[i];\n if (selectionTester.contains([xa.c2p(di.pos + posOffset), ya.c2p(di.yc)], null, di.i, searchInfo)) {\n selection.push({\n pointNumber: di.i,\n x: xa.c2d(di.pos),\n y: ya.c2d(di.yc)\n });\n di.selected = 1;\n } else {\n di.selected = 0;\n }\n }\n }\n return selection;\n };\n }\n });\n\n // src/traces/ohlc/index.js\n var require_ohlc = __commonJS({\n \"src/traces/ohlc/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"trace\",\n name: \"ohlc\",\n basePlotModule: require_cartesian(),\n categories: [\"cartesian\", \"svg\", \"showLegend\"],\n meta: {},\n attributes: require_attributes66(),\n supplyDefaults: require_defaults62(),\n calc: require_calc41().calc,\n plot: require_plot35(),\n style: require_style19(),\n hoverPoints: require_hover23().hoverPoints,\n selectPoints: require_select12()\n };\n }\n });\n\n // lib/ohlc.js\n var require_ohlc2 = __commonJS({\n \"lib/ohlc.js\"(exports, module) {\n \"use strict\";\n module.exports = require_ohlc();\n }\n });\n\n // src/traces/candlestick/attributes.js\n var require_attributes67 = __commonJS({\n \"src/traces/candlestick/attributes.js\"(exports, module) {\n \"use strict\";\n var extendFlat = require_lib().extendFlat;\n var axisHoverFormat = require_axis_format_attributes().axisHoverFormat;\n var OHLCattrs = require_attributes66();\n var boxAttrs = require_attributes24();\n function directionAttrs(lineColorDefault) {\n return {\n line: {\n color: extendFlat({}, boxAttrs.line.color, { dflt: lineColorDefault }),\n width: boxAttrs.line.width,\n editType: \"style\"\n },\n fillcolor: boxAttrs.fillcolor,\n editType: \"style\"\n };\n }\n module.exports = {\n xperiod: OHLCattrs.xperiod,\n xperiod0: OHLCattrs.xperiod0,\n xperiodalignment: OHLCattrs.xperiodalignment,\n xhoverformat: axisHoverFormat(\"x\"),\n yhoverformat: axisHoverFormat(\"y\"),\n x: OHLCattrs.x,\n open: OHLCattrs.open,\n high: OHLCattrs.high,\n low: OHLCattrs.low,\n close: OHLCattrs.close,\n line: {\n width: extendFlat({}, boxAttrs.line.width, {}),\n editType: \"style\"\n },\n increasing: directionAttrs(OHLCattrs.increasing.line.color.dflt),\n decreasing: directionAttrs(OHLCattrs.decreasing.line.color.dflt),\n text: OHLCattrs.text,\n hovertext: OHLCattrs.hovertext,\n whiskerwidth: extendFlat({}, boxAttrs.whiskerwidth, { dflt: 0 }),\n hoverlabel: OHLCattrs.hoverlabel,\n zorder: boxAttrs.zorder\n };\n }\n });\n\n // src/traces/candlestick/defaults.js\n var require_defaults63 = __commonJS({\n \"src/traces/candlestick/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Color2 = require_color();\n var handleOHLC = require_ohlc_defaults();\n var handlePeriodDefaults = require_period_defaults();\n var attributes = require_attributes67();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var len = handleOHLC(traceIn, traceOut, coerce, layout);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n handlePeriodDefaults(traceIn, traceOut, layout, coerce, { x: true });\n coerce(\"xhoverformat\");\n coerce(\"yhoverformat\");\n coerce(\"line.width\");\n handleDirection(traceIn, traceOut, coerce, \"increasing\");\n handleDirection(traceIn, traceOut, coerce, \"decreasing\");\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"whiskerwidth\");\n layout._requestRangeslider[traceOut.xaxis] = true;\n coerce(\"zorder\");\n };\n function handleDirection(traceIn, traceOut, coerce, direction) {\n var lineColor = coerce(direction + \".line.color\");\n coerce(direction + \".line.width\", traceOut.line.width);\n coerce(direction + \".fillcolor\", Color2.addOpacity(lineColor, 0.5));\n }\n }\n });\n\n // src/traces/candlestick/calc.js\n var require_calc42 = __commonJS({\n \"src/traces/candlestick/calc.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Axes = require_axes();\n var alignPeriod = require_align_period();\n var calcCommon = require_calc41().calcCommon;\n module.exports = function(gd, trace) {\n var fullLayout = gd._fullLayout;\n var xa = Axes.getFromId(gd, trace.xaxis);\n var ya = Axes.getFromId(gd, trace.yaxis);\n var origX = xa.makeCalcdata(trace, \"x\");\n var x = alignPeriod(trace, xa, \"x\", origX).vals;\n var cd = calcCommon(gd, trace, origX, x, ya, ptFunc);\n if (cd.length) {\n Lib.extendFlat(cd[0].t, {\n num: fullLayout._numBoxes,\n dPos: Lib.distinctVals(x).minDiff / 2,\n posLetter: \"x\",\n valLetter: \"y\"\n });\n fullLayout._numBoxes++;\n return cd;\n } else {\n return [{ t: { empty: true } }];\n }\n };\n function ptFunc(o, h, l, c) {\n return {\n min: l,\n q1: Math.min(o, c),\n med: c,\n q3: Math.max(o, c),\n max: h\n };\n }\n }\n });\n\n // src/traces/candlestick/index.js\n var require_candlestick = __commonJS({\n \"src/traces/candlestick/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"trace\",\n name: \"candlestick\",\n basePlotModule: require_cartesian(),\n categories: [\"cartesian\", \"svg\", \"showLegend\", \"candlestick\", \"boxLayout\"],\n meta: {},\n attributes: require_attributes67(),\n layoutAttributes: require_layout_attributes7(),\n supplyLayoutDefaults: require_layout_defaults6().supplyLayoutDefaults,\n crossTraceCalc: require_cross_trace_calc3().crossTraceCalc,\n supplyDefaults: require_defaults63(),\n calc: require_calc42(),\n plot: require_plot4().plot,\n layerName: \"boxlayer\",\n style: require_style5().style,\n hoverPoints: require_hover23().hoverPoints,\n selectPoints: require_select12()\n };\n }\n });\n\n // lib/candlestick.js\n var require_candlestick2 = __commonJS({\n \"lib/candlestick.js\"(exports, module) {\n \"use strict\";\n module.exports = require_candlestick();\n }\n });\n\n // src/plots/polar/set_convert.js\n var require_set_convert3 = __commonJS({\n \"src/plots/polar/set_convert.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var setConvertCartesian = require_set_convert();\n var deg2rad = Lib.deg2rad;\n var rad2deg = Lib.rad2deg;\n module.exports = function setConvert(ax, polarLayout, fullLayout) {\n setConvertCartesian(ax, fullLayout);\n switch (ax._id) {\n case \"x\":\n case \"radialaxis\":\n setConvertRadial(ax, polarLayout);\n break;\n case \"angularaxis\":\n setConvertAngular(ax, polarLayout);\n break;\n }\n };\n function setConvertRadial(ax, polarLayout) {\n var subplot = polarLayout._subplot;\n ax.setGeometry = function() {\n var rl0 = ax._rl[0];\n var rl1 = ax._rl[1];\n var b = subplot.innerRadius;\n var m = (subplot.radius - b) / (rl1 - rl0);\n var b2 = b / m;\n var rFilter = rl0 > rl1 ? function(v) {\n return v <= 0;\n } : function(v) {\n return v >= 0;\n };\n ax.c2g = function(v) {\n var r = ax.c2l(v) - rl0;\n return (rFilter(r) ? r : 0) + b2;\n };\n ax.g2c = function(v) {\n return ax.l2c(v + rl0 - b2);\n };\n ax.g2p = function(v) {\n return v * m;\n };\n ax.c2p = function(v) {\n return ax.g2p(ax.c2g(v));\n };\n };\n }\n function toRadians(v, unit) {\n return unit === \"degrees\" ? deg2rad(v) : v;\n }\n function fromRadians(v, unit) {\n return unit === \"degrees\" ? rad2deg(v) : v;\n }\n function setConvertAngular(ax, polarLayout) {\n var axType = ax.type;\n if (axType === \"linear\") {\n var _d2c = ax.d2c;\n var _c2d = ax.c2d;\n ax.d2c = function(v, unit) {\n return toRadians(_d2c(v), unit);\n };\n ax.c2d = function(v, unit) {\n return _c2d(fromRadians(v, unit));\n };\n }\n ax.makeCalcdata = function(trace, coord) {\n var arrayIn = trace[coord];\n var len = trace._length;\n var arrayOut, i;\n var _d2c2 = function(v) {\n return ax.d2c(v, trace.thetaunit);\n };\n if (arrayIn) {\n arrayOut = new Array(len);\n for (i = 0; i < len; i++) {\n arrayOut[i] = _d2c2(arrayIn[i]);\n }\n } else {\n var coord0 = coord + \"0\";\n var dcoord = \"d\" + coord;\n var v0 = coord0 in trace ? _d2c2(trace[coord0]) : 0;\n var dv = trace[dcoord] ? _d2c2(trace[dcoord]) : (ax.period || 2 * Math.PI) / len;\n arrayOut = new Array(len);\n for (i = 0; i < len; i++) {\n arrayOut[i] = v0 + i * dv;\n }\n }\n return arrayOut;\n };\n ax.setGeometry = function() {\n var sector = polarLayout.sector;\n var sectorInRad = sector.map(deg2rad);\n var dir = { clockwise: -1, counterclockwise: 1 }[ax.direction];\n var rot = deg2rad(ax.rotation);\n var rad2g = function(v) {\n return dir * v + rot;\n };\n var g2rad = function(v) {\n return (v - rot) / dir;\n };\n var rad2c, c2rad;\n var rad2t, t2rad;\n switch (axType) {\n case \"linear\":\n c2rad = rad2c = Lib.identity;\n t2rad = deg2rad;\n rad2t = rad2deg;\n ax.range = Lib.isFullCircle(sectorInRad) ? [sector[0], sector[0] + 360] : sectorInRad.map(g2rad).map(rad2deg);\n break;\n case \"category\":\n var catLen = ax._categories.length;\n var _period = ax.period ? Math.max(ax.period, catLen) : catLen;\n if (_period === 0) _period = 1;\n c2rad = t2rad = function(v) {\n return v * 2 * Math.PI / _period;\n };\n rad2c = rad2t = function(v) {\n return v * _period / Math.PI / 2;\n };\n ax.range = [0, _period];\n break;\n }\n ax.c2g = function(v) {\n return rad2g(c2rad(v));\n };\n ax.g2c = function(v) {\n return rad2c(g2rad(v));\n };\n ax.t2g = function(v) {\n return rad2g(t2rad(v));\n };\n ax.g2t = function(v) {\n return rad2t(g2rad(v));\n };\n };\n }\n }\n });\n\n // src/plots/polar/constants.js\n var require_constants33 = __commonJS({\n \"src/plots/polar/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attr: \"subplot\",\n name: \"polar\",\n axisNames: [\"angularaxis\", \"radialaxis\"],\n axisName2dataArray: { angularaxis: \"theta\", radialaxis: \"r\" },\n layerNames: [\n \"draglayer\",\n \"plotbg\",\n \"backplot\",\n \"angular-grid\",\n \"radial-grid\",\n \"frontplot\",\n \"angular-line\",\n \"radial-line\",\n \"angular-axis\",\n \"radial-axis\"\n ],\n radialDragBoxSize: 50,\n angularDragBoxSize: 30,\n cornerLen: 25,\n cornerHalfWidth: 2,\n // pixels to move mouse before you stop clamping to starting point\n MINDRAG: 8,\n // smallest radial distance [px] allowed for a zoombox\n MINZOOM: 20,\n // distance [px] off (r=0) or (r=radius) where we transition\n // from single-sided to two-sided radial zoom\n OFFEDGE: 20\n };\n }\n });\n\n // src/plots/polar/helpers.js\n var require_helpers19 = __commonJS({\n \"src/plots/polar/helpers.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var polygonTester = require_polygon().tester;\n var findIndexOfMin = Lib.findIndexOfMin;\n var isAngleInsideSector = Lib.isAngleInsideSector;\n var angleDelta = Lib.angleDelta;\n var angleDist = Lib.angleDist;\n function isPtInsidePolygon(r, a, rBnds, aBnds, vangles) {\n if (!isAngleInsideSector(a, aBnds)) return false;\n var r0, r1;\n if (rBnds[0] < rBnds[1]) {\n r0 = rBnds[0];\n r1 = rBnds[1];\n } else {\n r0 = rBnds[1];\n r1 = rBnds[0];\n }\n var polygonIn = polygonTester(makePolygon(r0, aBnds[0], aBnds[1], vangles));\n var polygonOut = polygonTester(makePolygon(r1, aBnds[0], aBnds[1], vangles));\n var xy = [r * Math.cos(a), r * Math.sin(a)];\n return polygonOut.contains(xy) && !polygonIn.contains(xy);\n }\n function findIntersectionXY(v0, v1, a, xpyp) {\n var xstar, ystar;\n var xp = xpyp[0];\n var yp = xpyp[1];\n var dsin = clampTiny(Math.sin(v1) - Math.sin(v0));\n var dcos = clampTiny(Math.cos(v1) - Math.cos(v0));\n var tanA = Math.tan(a);\n var cotanA = clampTiny(1 / tanA);\n var m = dsin / dcos;\n var b = yp - m * xp;\n if (cotanA) {\n if (dsin && dcos) {\n xstar = b / (tanA - m);\n ystar = tanA * xstar;\n } else if (dcos) {\n xstar = yp * cotanA;\n ystar = yp;\n } else {\n xstar = xp;\n ystar = xp * tanA;\n }\n } else {\n if (dsin && dcos) {\n xstar = 0;\n ystar = b;\n } else if (dcos) {\n xstar = 0;\n ystar = yp;\n } else {\n xstar = ystar = NaN;\n }\n }\n return [xstar, ystar];\n }\n function findXYatLength(l, m, xp, yp) {\n var t = -m * xp;\n var a = m * m + 1;\n var b = 2 * (m * t - xp);\n var c = t * t + xp * xp - l * l;\n var del = Math.sqrt(b * b - 4 * a * c);\n var x0 = (-b + del) / (2 * a);\n var x1 = (-b - del) / (2 * a);\n return [\n [x0, m * x0 + t + yp],\n [x1, m * x1 + t + yp]\n ];\n }\n function makeRegularPolygon(r, vangles) {\n var len = vangles.length;\n var vertices = new Array(len + 1);\n var i;\n for (i = 0; i < len; i++) {\n var va = vangles[i];\n vertices[i] = [r * Math.cos(va), r * Math.sin(va)];\n }\n vertices[i] = vertices[0].slice();\n return vertices;\n }\n function makeClippedPolygon(r, a0, a1, vangles) {\n var len = vangles.length;\n var vertices = [];\n var i, j;\n function a2xy(a) {\n return [r * Math.cos(a), r * Math.sin(a)];\n }\n function findXY(va0, va1, s) {\n return findIntersectionXY(va0, va1, s, a2xy(va0));\n }\n function cycleIndex(ind) {\n return Lib.mod(ind, len);\n }\n function isInside(v) {\n return isAngleInsideSector(v, [a0, a1]);\n }\n var i0 = findIndexOfMin(vangles, function(v) {\n return isInside(v) ? angleDist(v, a0) : Infinity;\n });\n var xy0 = findXY(vangles[i0], vangles[cycleIndex(i0 - 1)], a0);\n vertices.push(xy0);\n for (i = i0, j = 0; j < len; i++, j++) {\n var va = vangles[cycleIndex(i)];\n if (!isInside(va)) break;\n vertices.push(a2xy(va));\n }\n var iN = findIndexOfMin(vangles, function(v) {\n return isInside(v) ? angleDist(v, a1) : Infinity;\n });\n var xyN = findXY(vangles[iN], vangles[cycleIndex(iN + 1)], a1);\n vertices.push(xyN);\n vertices.push([0, 0]);\n vertices.push(vertices[0].slice());\n return vertices;\n }\n function makePolygon(r, a0, a1, vangles) {\n return Lib.isFullCircle([a0, a1]) ? makeRegularPolygon(r, vangles) : makeClippedPolygon(r, a0, a1, vangles);\n }\n function findPolygonOffset(r, a0, a1, vangles) {\n var minX = Infinity;\n var minY = Infinity;\n var vertices = makePolygon(r, a0, a1, vangles);\n for (var i = 0; i < vertices.length; i++) {\n var v = vertices[i];\n minX = Math.min(minX, v[0]);\n minY = Math.min(minY, -v[1]);\n }\n return [minX, minY];\n }\n function findEnclosingVertexAngles(a, vangles) {\n var minFn = function(v) {\n var adelta = angleDelta(v, a);\n return adelta > 0 ? adelta : Infinity;\n };\n var i0 = findIndexOfMin(vangles, minFn);\n var i1 = Lib.mod(i0 + 1, vangles.length);\n return [vangles[i0], vangles[i1]];\n }\n function clampTiny(v) {\n return Math.abs(v) > 1e-10 ? v : 0;\n }\n function transformForSVG(pts0, cx, cy) {\n cx = cx || 0;\n cy = cy || 0;\n var len = pts0.length;\n var pts1 = new Array(len);\n for (var i = 0; i < len; i++) {\n var pt = pts0[i];\n pts1[i] = [cx + pt[0], cy - pt[1]];\n }\n return pts1;\n }\n function pathPolygon(r, a0, a1, vangles, cx, cy) {\n var poly = makePolygon(r, a0, a1, vangles);\n return \"M\" + transformForSVG(poly, cx, cy).join(\"L\");\n }\n function pathPolygonAnnulus(r0, r1, a0, a1, vangles, cx, cy) {\n var rStart, rEnd;\n if (r0 < r1) {\n rStart = r0;\n rEnd = r1;\n } else {\n rStart = r1;\n rEnd = r0;\n }\n var inner = transformForSVG(makePolygon(rStart, a0, a1, vangles), cx, cy);\n var outer = transformForSVG(makePolygon(rEnd, a0, a1, vangles), cx, cy);\n return \"M\" + outer.reverse().join(\"L\") + \"M\" + inner.join(\"L\");\n }\n module.exports = {\n isPtInsidePolygon,\n findPolygonOffset,\n findEnclosingVertexAngles,\n findIntersectionXY,\n findXYatLength,\n clampTiny,\n pathPolygon,\n pathPolygonAnnulus\n };\n }\n });\n\n // src/plots/smith/helpers.js\n var require_helpers20 = __commonJS({\n \"src/plots/smith/helpers.js\"(exports, module) {\n \"use strict\";\n function sign(x) {\n return x < 0 ? -1 : x > 0 ? 1 : 0;\n }\n function smith(a) {\n var R = a[0];\n var X = a[1];\n if (!isFinite(R) || !isFinite(X)) return [1, 0];\n var D2 = (R + 1) * (R + 1) + X * X;\n return [(R * R + X * X - 1) / D2, 2 * X / D2];\n }\n function transform(subplot, a) {\n var x = a[0];\n var y = a[1];\n return [\n x * subplot.radius + subplot.cx,\n -y * subplot.radius + subplot.cy\n ];\n }\n function scale(subplot, r) {\n return r * subplot.radius;\n }\n function reactanceArc(subplot, X, R1, R2) {\n var t12 = transform(subplot, smith([R1, X]));\n var x1 = t12[0];\n var y1 = t12[1];\n var t22 = transform(subplot, smith([R2, X]));\n var x2 = t22[0];\n var y2 = t22[1];\n if (X === 0) {\n return [\n \"M\" + x1 + \",\" + y1,\n \"L\" + x2 + \",\" + y2\n ].join(\" \");\n }\n var r = scale(subplot, 1 / Math.abs(X));\n return [\n \"M\" + x1 + \",\" + y1,\n \"A\" + r + \",\" + r + \" 0 0,\" + (X < 0 ? 1 : 0) + \" \" + x2 + \",\" + y2\n ].join(\" \");\n }\n function resistanceArc(subplot, R, X1, X2) {\n var r = scale(subplot, 1 / (R + 1));\n var t12 = transform(subplot, smith([R, X1]));\n var x1 = t12[0];\n var y1 = t12[1];\n var t22 = transform(subplot, smith([R, X2]));\n var x2 = t22[0];\n var y2 = t22[1];\n if (sign(X1) !== sign(X2)) {\n var t02 = transform(subplot, smith([R, 0]));\n var x0 = t02[0];\n var y0 = t02[1];\n return [\n \"M\" + x1 + \",\" + y1,\n \"A\" + r + \",\" + r + \" 0 0,\" + (0 < X1 ? 0 : 1) + \" \" + x0 + \",\" + y0,\n \"A\" + r + \",\" + r + \" 0 0,\" + (X2 < 0 ? 0 : 1) + x2 + \",\" + y2\n ].join(\" \");\n }\n return [\n \"M\" + x1 + \",\" + y1,\n \"A\" + r + \",\" + r + \" 0 0,\" + (X2 < X1 ? 0 : 1) + \" \" + x2 + \",\" + y2\n ].join(\" \");\n }\n module.exports = {\n smith,\n reactanceArc,\n resistanceArc,\n smithTransform: transform\n };\n }\n });\n\n // src/plots/polar/polar.js\n var require_polar = __commonJS({\n \"src/plots/polar/polar.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var tinycolor = require_tinycolor();\n var Registry = require_registry();\n var Lib = require_lib();\n var strRotate = Lib.strRotate;\n var strTranslate = Lib.strTranslate;\n var Color2 = require_color();\n var Drawing = require_drawing();\n var Plots = require_plots();\n var Axes = require_axes();\n var setConvertCartesian = require_set_convert();\n var setConvertPolar = require_set_convert3();\n var doAutoRange = require_autorange().doAutoRange;\n var dragBox = require_dragbox();\n var dragElement = require_dragelement();\n var Fx = require_fx();\n var Titles = require_titles();\n var prepSelect = require_selections().prepSelect;\n var selectOnClick = require_selections().selectOnClick;\n var clearOutline = require_selections().clearOutline;\n var setCursor = require_setcursor();\n var clearGlCanvases = require_clear_gl_canvases();\n var redrawReglTraces = require_subroutines().redrawReglTraces;\n var MID_SHIFT = require_alignment().MID_SHIFT;\n var constants = require_constants33();\n var helpers = require_helpers19();\n var smithHelpers = require_helpers20();\n var smith = smithHelpers.smith;\n var reactanceArc = smithHelpers.reactanceArc;\n var resistanceArc = smithHelpers.resistanceArc;\n var smithTransform = smithHelpers.smithTransform;\n var _ = Lib._;\n var mod = Lib.mod;\n var deg2rad = Lib.deg2rad;\n var rad2deg = Lib.rad2deg;\n function Polar(gd, id, isSmith) {\n this.isSmith = isSmith || false;\n this.id = id;\n this.gd = gd;\n this._hasClipOnAxisFalse = null;\n this.vangles = null;\n this.radialAxisAngle = null;\n this.traceHash = {};\n this.layers = {};\n this.clipPaths = {};\n this.clipIds = {};\n this.viewInitial = {};\n var fullLayout = gd._fullLayout;\n var clipIdBase = \"clip\" + fullLayout._uid + id;\n this.clipIds.forTraces = clipIdBase + \"-for-traces\";\n this.clipPaths.forTraces = fullLayout._clips.append(\"clipPath\").attr(\"id\", this.clipIds.forTraces);\n this.clipPaths.forTraces.append(\"path\");\n this.framework = fullLayout[\"_\" + (isSmith ? \"smith\" : \"polar\") + \"layer\"].append(\"g\").attr(\"class\", id);\n this.getHole = function(s) {\n return this.isSmith ? 0 : s.hole;\n };\n this.getSector = function(s) {\n return this.isSmith ? [0, 360] : s.sector;\n };\n this.getRadial = function(s) {\n return this.isSmith ? s.realaxis : s.radialaxis;\n };\n this.getAngular = function(s) {\n return this.isSmith ? s.imaginaryaxis : s.angularaxis;\n };\n if (!isSmith) {\n this.radialTickLayout = null;\n this.angularTickLayout = null;\n }\n }\n var proto = Polar.prototype;\n module.exports = function createPolar(gd, id, isSmith) {\n return new Polar(gd, id, isSmith);\n };\n proto.plot = function(polarCalcData, fullLayout) {\n var _this = this;\n var polarLayout = fullLayout[_this.id];\n var found = false;\n for (var i = 0; i < polarCalcData.length; i++) {\n var trace = polarCalcData[i][0].trace;\n if (trace.cliponaxis === false) {\n found = true;\n break;\n }\n }\n _this._hasClipOnAxisFalse = found;\n _this.updateLayers(fullLayout, polarLayout);\n _this.updateLayout(fullLayout, polarLayout);\n Plots.generalUpdatePerTraceModule(_this.gd, _this, polarCalcData, polarLayout);\n _this.updateFx(fullLayout, polarLayout);\n if (_this.isSmith) {\n delete polarLayout.realaxis.range;\n delete polarLayout.imaginaryaxis.range;\n }\n };\n proto.updateLayers = function(fullLayout, polarLayout) {\n var _this = this;\n var isSmith = _this.isSmith;\n var layers = _this.layers;\n var radialLayout = _this.getRadial(polarLayout);\n var angularLayout = _this.getAngular(polarLayout);\n var layerNames = constants.layerNames;\n var frontPlotIndex = layerNames.indexOf(\"frontplot\");\n var layerData = layerNames.slice(0, frontPlotIndex);\n var isAngularAxisBelowTraces = angularLayout.layer === \"below traces\";\n var isRadialAxisBelowTraces = radialLayout.layer === \"below traces\";\n if (isAngularAxisBelowTraces) layerData.push(\"angular-line\");\n if (isRadialAxisBelowTraces) layerData.push(\"radial-line\");\n if (isAngularAxisBelowTraces) layerData.push(\"angular-axis\");\n if (isRadialAxisBelowTraces) layerData.push(\"radial-axis\");\n layerData.push(\"frontplot\");\n if (!isAngularAxisBelowTraces) layerData.push(\"angular-line\");\n if (!isRadialAxisBelowTraces) layerData.push(\"radial-line\");\n if (!isAngularAxisBelowTraces) layerData.push(\"angular-axis\");\n if (!isRadialAxisBelowTraces) layerData.push(\"radial-axis\");\n var subLayer = (isSmith ? \"smith\" : \"polar\") + \"sublayer\";\n var join = _this.framework.selectAll(\".\" + subLayer).data(layerData, String);\n join.enter().append(\"g\").attr(\"class\", function(d) {\n return subLayer + \" \" + d;\n }).each(function(d) {\n var sel = layers[d] = d3.select(this);\n switch (d) {\n case \"frontplot\":\n if (!isSmith) {\n sel.append(\"g\").classed(\"barlayer\", true);\n }\n sel.append(\"g\").classed(\"scatterlayer\", true);\n break;\n case \"backplot\":\n sel.append(\"g\").classed(\"maplayer\", true);\n break;\n case \"plotbg\":\n layers.bg = sel.append(\"path\");\n break;\n case \"radial-grid\":\n sel.style(\"fill\", \"none\");\n break;\n case \"angular-grid\":\n sel.style(\"fill\", \"none\");\n break;\n case \"radial-line\":\n sel.append(\"line\").style(\"fill\", \"none\");\n break;\n case \"angular-line\":\n sel.append(\"path\").style(\"fill\", \"none\");\n break;\n }\n });\n join.order();\n };\n proto.updateLayout = function(fullLayout, polarLayout) {\n var _this = this;\n var layers = _this.layers;\n var gs = fullLayout._size;\n var radialLayout = _this.getRadial(polarLayout);\n var angularLayout = _this.getAngular(polarLayout);\n var xDomain = polarLayout.domain.x;\n var yDomain = polarLayout.domain.y;\n _this.xOffset = gs.l + gs.w * xDomain[0];\n _this.yOffset = gs.t + gs.h * (1 - yDomain[1]);\n var xLength = _this.xLength = gs.w * (xDomain[1] - xDomain[0]);\n var yLength = _this.yLength = gs.h * (yDomain[1] - yDomain[0]);\n var sector = _this.getSector(polarLayout);\n _this.sectorInRad = sector.map(deg2rad);\n var sectorBBox = _this.sectorBBox = computeSectorBBox(sector);\n var dxSectorBBox = sectorBBox[2] - sectorBBox[0];\n var dySectorBBox = sectorBBox[3] - sectorBBox[1];\n var arDomain = yLength / xLength;\n var arSector = Math.abs(dySectorBBox / dxSectorBBox);\n var xLength2, yLength2;\n var xDomain2, yDomain2;\n var gap;\n if (arDomain > arSector) {\n xLength2 = xLength;\n yLength2 = xLength * arSector;\n gap = (yLength - yLength2) / gs.h / 2;\n xDomain2 = [xDomain[0], xDomain[1]];\n yDomain2 = [yDomain[0] + gap, yDomain[1] - gap];\n } else {\n xLength2 = yLength / arSector;\n yLength2 = yLength;\n gap = (xLength - xLength2) / gs.w / 2;\n xDomain2 = [xDomain[0] + gap, xDomain[1] - gap];\n yDomain2 = [yDomain[0], yDomain[1]];\n }\n _this.xLength2 = xLength2;\n _this.yLength2 = yLength2;\n _this.xDomain2 = xDomain2;\n _this.yDomain2 = yDomain2;\n var xOffset2 = _this.xOffset2 = gs.l + gs.w * xDomain2[0];\n var yOffset2 = _this.yOffset2 = gs.t + gs.h * (1 - yDomain2[1]);\n var radius = _this.radius = xLength2 / dxSectorBBox;\n var innerRadius = _this.innerRadius = _this.getHole(polarLayout) * radius;\n var cx = _this.cx = xOffset2 - radius * sectorBBox[0];\n var cy = _this.cy = yOffset2 + radius * sectorBBox[3];\n var cxx = _this.cxx = cx - xOffset2;\n var cyy = _this.cyy = cy - yOffset2;\n var side = radialLayout.side;\n var trueSide;\n if (side === \"counterclockwise\") {\n trueSide = side;\n side = \"top\";\n } else if (side === \"clockwise\") {\n trueSide = side;\n side = \"bottom\";\n }\n _this.radialAxis = _this.mockAxis(fullLayout, polarLayout, radialLayout, {\n // make this an 'x' axis to make positioning (especially rotation) easier\n _id: \"x\",\n // convert to 'x' axis equivalent\n side,\n // keep track of real side\n _trueSide: trueSide,\n // spans length 1 radius\n domain: [innerRadius / gs.w, radius / gs.w]\n });\n _this.angularAxis = _this.mockAxis(fullLayout, polarLayout, angularLayout, {\n side: \"right\",\n // to get auto nticks right\n domain: [0, Math.PI],\n // don't pass through autorange logic\n autorange: false\n });\n _this.doAutoRange(fullLayout, polarLayout);\n _this.updateAngularAxis(fullLayout, polarLayout);\n _this.updateRadialAxis(fullLayout, polarLayout);\n _this.updateRadialAxisTitle(fullLayout, polarLayout);\n _this.xaxis = _this.mockCartesianAxis(fullLayout, polarLayout, {\n _id: \"x\",\n domain: xDomain2\n });\n _this.yaxis = _this.mockCartesianAxis(fullLayout, polarLayout, {\n _id: \"y\",\n domain: yDomain2\n });\n var dPath = _this.pathSubplot();\n _this.clipPaths.forTraces.select(\"path\").attr(\"d\", dPath).attr(\"transform\", strTranslate(cxx, cyy));\n layers.frontplot.attr(\"transform\", strTranslate(xOffset2, yOffset2)).call(Drawing.setClipUrl, _this._hasClipOnAxisFalse ? null : _this.clipIds.forTraces, _this.gd);\n layers.bg.attr(\"d\", dPath).attr(\"transform\", strTranslate(cx, cy)).call(Color2.fill, polarLayout.bgcolor);\n };\n proto.mockAxis = function(fullLayout, polarLayout, axLayout, opts) {\n var ax = Lib.extendFlat({}, axLayout, opts);\n setConvertPolar(ax, polarLayout, fullLayout);\n return ax;\n };\n proto.mockCartesianAxis = function(fullLayout, polarLayout, opts) {\n var _this = this;\n var isSmith = _this.isSmith;\n var axId = opts._id;\n var ax = Lib.extendFlat({ type: \"linear\" }, opts);\n setConvertCartesian(ax, fullLayout);\n var bboxIndices = {\n x: [0, 2],\n y: [1, 3]\n };\n ax.setRange = function() {\n var sectorBBox = _this.sectorBBox;\n var ind = bboxIndices[axId];\n var rl = _this.radialAxis._rl;\n var drl = (rl[1] - rl[0]) / (1 - _this.getHole(polarLayout));\n ax.range = [sectorBBox[ind[0]] * drl, sectorBBox[ind[1]] * drl];\n };\n ax.isPtWithinRange = axId === \"x\" && !isSmith ? function(d) {\n return _this.isPtInside(d);\n } : function() {\n return true;\n };\n ax.setRange();\n ax.setScale();\n return ax;\n };\n proto.doAutoRange = function(fullLayout, polarLayout) {\n var _this = this;\n var gd = _this.gd;\n var radialAxis = _this.radialAxis;\n var radialLayout = _this.getRadial(polarLayout);\n doAutoRange(gd, radialAxis);\n var rng = radialAxis.range;\n radialLayout.range = rng.slice();\n radialLayout._input.range = rng.slice();\n radialAxis._rl = [\n radialAxis.r2l(rng[0], null, \"gregorian\"),\n radialAxis.r2l(rng[1], null, \"gregorian\")\n ];\n if (radialAxis.minallowed !== void 0) {\n var minallowed = radialAxis.r2l(radialAxis.minallowed);\n if (radialAxis._rl[0] > radialAxis._rl[1]) {\n radialAxis._rl[1] = Math.max(radialAxis._rl[1], minallowed);\n } else {\n radialAxis._rl[0] = Math.max(radialAxis._rl[0], minallowed);\n }\n }\n if (radialAxis.maxallowed !== void 0) {\n var maxallowed = radialAxis.r2l(radialAxis.maxallowed);\n if (radialAxis._rl[0] < radialAxis._rl[1]) {\n radialAxis._rl[1] = Math.min(radialAxis._rl[1], maxallowed);\n } else {\n radialAxis._rl[0] = Math.min(radialAxis._rl[0], maxallowed);\n }\n }\n };\n proto.updateRadialAxis = function(fullLayout, polarLayout) {\n var _this = this;\n var gd = _this.gd;\n var layers = _this.layers;\n var radius = _this.radius;\n var innerRadius = _this.innerRadius;\n var cx = _this.cx;\n var cy = _this.cy;\n var radialLayout = _this.getRadial(polarLayout);\n var a0 = mod(_this.getSector(polarLayout)[0], 360);\n var ax = _this.radialAxis;\n var hasRoomForIt = innerRadius < radius;\n var isSmith = _this.isSmith;\n if (!isSmith) {\n _this.fillViewInitialKey(\"radialaxis.angle\", radialLayout.angle);\n _this.fillViewInitialKey(\"radialaxis.range\", ax.range.slice());\n ax.setGeometry();\n }\n if (ax.tickangle === \"auto\" && (a0 > 90 && a0 <= 270)) {\n ax.tickangle = 180;\n }\n var transFn = isSmith ? function(d) {\n var t = smithTransform(_this, smith([d.x, 0]));\n return strTranslate(t[0] - cx, t[1] - cy);\n } : function(d) {\n return strTranslate(ax.l2p(d.x) + innerRadius, 0);\n };\n var gridPathFn = isSmith ? function(d) {\n return resistanceArc(_this, d.x, -Infinity, Infinity);\n } : function(d) {\n return _this.pathArc(ax.r2p(d.x) + innerRadius);\n };\n var newTickLayout = strTickLayout(radialLayout);\n if (_this.radialTickLayout !== newTickLayout) {\n layers[\"radial-axis\"].selectAll(\".xtick\").remove();\n _this.radialTickLayout = newTickLayout;\n }\n if (hasRoomForIt) {\n ax.setScale();\n var labelShift = 0;\n var vals = isSmith ? (ax.tickvals || []).filter(function(x) {\n return x >= 0;\n }).map(function(x) {\n return Axes.tickText(ax, x, true, false);\n }) : Axes.calcTicks(ax);\n var valsClipped = isSmith ? vals : Axes.clipEnds(ax, vals);\n var tickSign = Axes.getTickSigns(ax)[2];\n if (isSmith) {\n if (ax.ticks === \"top\" && ax.side === \"bottom\" || ax.ticks === \"bottom\" && ax.side === \"top\") {\n tickSign = -tickSign;\n }\n if (ax.ticks === \"top\" && ax.side === \"top\") labelShift = -ax.ticklen;\n if (ax.ticks === \"bottom\" && ax.side === \"bottom\") labelShift = ax.ticklen;\n }\n Axes.drawTicks(gd, ax, {\n vals,\n layer: layers[\"radial-axis\"],\n path: Axes.makeTickPath(ax, 0, tickSign),\n transFn,\n crisp: false\n });\n Axes.drawGrid(gd, ax, {\n vals: valsClipped,\n layer: layers[\"radial-grid\"],\n path: gridPathFn,\n transFn: Lib.noop,\n crisp: false\n });\n Axes.drawLabels(gd, ax, {\n vals,\n layer: layers[\"radial-axis\"],\n transFn,\n labelFns: Axes.makeLabelFns(ax, labelShift)\n });\n }\n var angle = _this.radialAxisAngle = _this.vangles ? rad2deg(snapToVertexAngle(deg2rad(radialLayout.angle), _this.vangles)) : radialLayout.angle;\n var tLayer = strTranslate(cx, cy);\n var tLayer2 = tLayer + strRotate(-angle);\n updateElement(\n layers[\"radial-axis\"],\n hasRoomForIt && (radialLayout.showticklabels || radialLayout.ticks),\n { transform: tLayer2 }\n );\n updateElement(\n layers[\"radial-grid\"],\n hasRoomForIt && radialLayout.showgrid,\n { transform: isSmith ? \"\" : tLayer }\n );\n updateElement(\n layers[\"radial-line\"].select(\"line\"),\n hasRoomForIt && radialLayout.showline,\n {\n x1: isSmith ? -radius : innerRadius,\n y1: 0,\n x2: radius,\n y2: 0,\n transform: tLayer2\n }\n ).attr(\"stroke-width\", radialLayout.linewidth).call(Color2.stroke, radialLayout.linecolor);\n };\n proto.updateRadialAxisTitle = function(fullLayout, polarLayout, _angle) {\n if (this.isSmith) return;\n var _this = this;\n var gd = _this.gd;\n var radius = _this.radius;\n var cx = _this.cx;\n var cy = _this.cy;\n var radialLayout = _this.getRadial(polarLayout);\n var titleClass = _this.id + \"title\";\n var pad = 0;\n if (radialLayout.title) {\n var h = Drawing.bBox(_this.layers[\"radial-axis\"].node()).height;\n var ts = radialLayout.title.font.size;\n var side = radialLayout.side;\n pad = side === \"top\" ? ts : side === \"counterclockwise\" ? -(h + ts * 0.4) : h + ts * 0.8;\n }\n var angle = _angle !== void 0 ? _angle : _this.radialAxisAngle;\n var angleRad = deg2rad(angle);\n var cosa = Math.cos(angleRad);\n var sina = Math.sin(angleRad);\n var x = cx + radius / 2 * cosa + pad * sina;\n var y = cy - radius / 2 * sina + pad * cosa;\n _this.layers[\"radial-axis-title\"] = Titles.draw(gd, titleClass, {\n propContainer: radialLayout,\n propName: _this.id + \".radialaxis.title\",\n placeholder: _(gd, \"Click to enter radial axis title\"),\n attributes: {\n x,\n y,\n \"text-anchor\": \"middle\"\n },\n transform: { rotate: -angle }\n });\n };\n proto.updateAngularAxis = function(fullLayout, polarLayout) {\n var _this = this;\n var gd = _this.gd;\n var layers = _this.layers;\n var radius = _this.radius;\n var innerRadius = _this.innerRadius;\n var cx = _this.cx;\n var cy = _this.cy;\n var angularLayout = _this.getAngular(polarLayout);\n var ax = _this.angularAxis;\n var isSmith = _this.isSmith;\n if (!isSmith) {\n _this.fillViewInitialKey(\"angularaxis.rotation\", angularLayout.rotation);\n ax.setGeometry();\n ax.setScale();\n }\n var t2g = isSmith ? function(d) {\n var t = smithTransform(_this, smith([0, d.x]));\n return Math.atan2(t[0] - cx, t[1] - cy) - Math.PI / 2;\n } : function(d) {\n return ax.t2g(d.x);\n };\n if (ax.type === \"linear\" && ax.thetaunit === \"radians\") {\n ax.tick0 = rad2deg(ax.tick0);\n ax.dtick = rad2deg(ax.dtick);\n }\n var _transFn = function(rad) {\n return strTranslate(cx + radius * Math.cos(rad), cy - radius * Math.sin(rad));\n };\n var transFn = isSmith ? function(d) {\n var t = smithTransform(_this, smith([0, d.x]));\n return strTranslate(t[0], t[1]);\n } : function(d) {\n return _transFn(t2g(d));\n };\n var transFn2 = isSmith ? function(d) {\n var t = smithTransform(_this, smith([0, d.x]));\n var rad = Math.atan2(t[0] - cx, t[1] - cy) - Math.PI / 2;\n return strTranslate(t[0], t[1]) + strRotate(-rad2deg(rad));\n } : function(d) {\n var rad = t2g(d);\n return _transFn(rad) + strRotate(-rad2deg(rad));\n };\n var gridPathFn = isSmith ? function(d) {\n return reactanceArc(_this, d.x, 0, Infinity);\n } : function(d) {\n var rad = t2g(d);\n var cosRad = Math.cos(rad);\n var sinRad = Math.sin(rad);\n return \"M\" + [cx + innerRadius * cosRad, cy - innerRadius * sinRad] + \"L\" + [cx + radius * cosRad, cy - radius * sinRad];\n };\n var out = Axes.makeLabelFns(ax, 0);\n var labelStandoff = out.labelStandoff;\n var labelFns = {};\n labelFns.xFn = function(d) {\n var rad = t2g(d);\n return Math.cos(rad) * labelStandoff;\n };\n labelFns.yFn = function(d) {\n var rad = t2g(d);\n var ff = Math.sin(rad) > 0 ? 0.2 : 1;\n return -Math.sin(rad) * (labelStandoff + d.fontSize * ff) + Math.abs(Math.cos(rad)) * (d.fontSize * MID_SHIFT);\n };\n labelFns.anchorFn = function(d) {\n var rad = t2g(d);\n var cos = Math.cos(rad);\n return Math.abs(cos) < 0.1 ? \"middle\" : cos > 0 ? \"start\" : \"end\";\n };\n labelFns.heightFn = function(d, a, h) {\n var rad = t2g(d);\n return -0.5 * (1 + Math.sin(rad)) * h;\n };\n var newTickLayout = strTickLayout(angularLayout);\n if (_this.angularTickLayout !== newTickLayout) {\n layers[\"angular-axis\"].selectAll(\".\" + ax._id + \"tick\").remove();\n _this.angularTickLayout = newTickLayout;\n }\n var vals = isSmith ? [Infinity].concat(ax.tickvals || []).map(function(x) {\n return Axes.tickText(ax, x, true, false);\n }) : Axes.calcTicks(ax);\n if (isSmith) {\n vals[0].text = \"\\u221E\";\n vals[0].fontSize *= 1.75;\n }\n var vangles;\n if (polarLayout.gridshape === \"linear\") {\n vangles = vals.map(t2g);\n if (Lib.angleDelta(vangles[0], vangles[1]) < 0) {\n vangles = vangles.slice().reverse();\n }\n } else {\n vangles = null;\n }\n _this.vangles = vangles;\n if (ax.type === \"category\") {\n vals = vals.filter(function(d) {\n return Lib.isAngleInsideSector(t2g(d), _this.sectorInRad);\n });\n }\n if (ax.visible) {\n var tickSign = ax.ticks === \"inside\" ? -1 : 1;\n var pad = (ax.linewidth || 1) / 2;\n Axes.drawTicks(gd, ax, {\n vals,\n layer: layers[\"angular-axis\"],\n path: \"M\" + tickSign * pad + \",0h\" + tickSign * ax.ticklen,\n transFn: transFn2,\n crisp: false\n });\n Axes.drawGrid(gd, ax, {\n vals,\n layer: layers[\"angular-grid\"],\n path: gridPathFn,\n transFn: Lib.noop,\n crisp: false\n });\n Axes.drawLabels(gd, ax, {\n vals,\n layer: layers[\"angular-axis\"],\n repositionOnUpdate: true,\n transFn,\n labelFns\n });\n }\n updateElement(layers[\"angular-line\"].select(\"path\"), angularLayout.showline, {\n d: _this.pathSubplot(),\n transform: strTranslate(cx, cy)\n }).attr(\"stroke-width\", angularLayout.linewidth).call(Color2.stroke, angularLayout.linecolor);\n };\n proto.updateFx = function(fullLayout, polarLayout) {\n if (!this.gd._context.staticPlot) {\n var hasDrag = !this.isSmith;\n if (hasDrag) {\n this.updateAngularDrag(fullLayout);\n this.updateRadialDrag(fullLayout, polarLayout, 0);\n this.updateRadialDrag(fullLayout, polarLayout, 1);\n }\n this.updateHoverAndMainDrag(fullLayout);\n }\n };\n proto.updateHoverAndMainDrag = function(fullLayout) {\n var _this = this;\n var isSmith = _this.isSmith;\n var gd = _this.gd;\n var layers = _this.layers;\n var zoomlayer = fullLayout._zoomlayer;\n var MINZOOM = constants.MINZOOM;\n var OFFEDGE = constants.OFFEDGE;\n var radius = _this.radius;\n var innerRadius = _this.innerRadius;\n var cx = _this.cx;\n var cy = _this.cy;\n var cxx = _this.cxx;\n var cyy = _this.cyy;\n var sectorInRad = _this.sectorInRad;\n var vangles = _this.vangles;\n var radialAxis = _this.radialAxis;\n var clampTiny = helpers.clampTiny;\n var findXYatLength = helpers.findXYatLength;\n var findEnclosingVertexAngles = helpers.findEnclosingVertexAngles;\n var chw = constants.cornerHalfWidth;\n var chl = constants.cornerLen / 2;\n var scaleX;\n var scaleY;\n var mainDrag = dragBox.makeDragger(layers, \"path\", \"maindrag\", fullLayout.dragmode === false ? \"none\" : \"crosshair\");\n d3.select(mainDrag).attr(\"d\", _this.pathSubplot()).attr(\"transform\", strTranslate(cx, cy));\n mainDrag.onmousemove = function(evt) {\n Fx.hover(gd, evt, _this.id);\n gd._fullLayout._lasthover = mainDrag;\n gd._fullLayout._hoversubplot = _this.id;\n };\n mainDrag.onmouseout = function(evt) {\n if (gd._dragging) return;\n dragElement.unhover(gd, evt);\n };\n var dragOpts = {\n element: mainDrag,\n gd,\n subplot: _this.id,\n plotinfo: {\n id: _this.id,\n xaxis: _this.xaxis,\n yaxis: _this.yaxis\n },\n xaxes: [_this.xaxis],\n yaxes: [_this.yaxis]\n };\n var x0, y0;\n var r0, r1;\n var path0, dimmed, lum;\n var zb, corners;\n function norm(x, y) {\n return Math.sqrt(x * x + y * y);\n }\n function xy2r(x, y) {\n return norm(x - cxx, y - cyy);\n }\n function xy2a(x, y) {\n return Math.atan2(cyy - y, x - cxx);\n }\n function ra2xy(r, a) {\n return [r * Math.cos(a), r * Math.sin(-a)];\n }\n function pathCorner(r, a) {\n if (r === 0) return _this.pathSector(2 * chw);\n var da = chl / r;\n var am = a - da;\n var ap = a + da;\n var rb = Math.max(0, Math.min(r, radius));\n var rm = rb - chw;\n var rp = rb + chw;\n return \"M\" + ra2xy(rm, am) + \"A\" + [rm, rm] + \" 0,0,0 \" + ra2xy(rm, ap) + \"L\" + ra2xy(rp, ap) + \"A\" + [rp, rp] + \" 0,0,1 \" + ra2xy(rp, am) + \"Z\";\n }\n function pathCornerForPolygons(r, va0, va1) {\n if (r === 0) return _this.pathSector(2 * chw);\n var xy0 = ra2xy(r, va0);\n var xy1 = ra2xy(r, va1);\n var x = clampTiny((xy0[0] + xy1[0]) / 2);\n var y = clampTiny((xy0[1] + xy1[1]) / 2);\n var innerPts, outerPts;\n if (x && y) {\n var m = y / x;\n var mperp = -1 / m;\n var midPts = findXYatLength(chw, m, x, y);\n innerPts = findXYatLength(chl, mperp, midPts[0][0], midPts[0][1]);\n outerPts = findXYatLength(chl, mperp, midPts[1][0], midPts[1][1]);\n } else {\n var dx, dy;\n if (y) {\n dx = chl;\n dy = chw;\n } else {\n dx = chw;\n dy = chl;\n }\n innerPts = [[x - dx, y - dy], [x + dx, y - dy]];\n outerPts = [[x - dx, y + dy], [x + dx, y + dy]];\n }\n return \"M\" + innerPts.join(\"L\") + \"L\" + outerPts.reverse().join(\"L\") + \"Z\";\n }\n function zoomPrep() {\n r0 = null;\n r1 = null;\n path0 = _this.pathSubplot();\n dimmed = false;\n var polarLayoutNow = gd._fullLayout[_this.id];\n lum = tinycolor(polarLayoutNow.bgcolor).getLuminance();\n zb = dragBox.makeZoombox(zoomlayer, lum, cx, cy, path0);\n zb.attr(\"fill-rule\", \"evenodd\");\n corners = dragBox.makeCorners(zoomlayer, cx, cy);\n clearOutline(gd);\n }\n function clampAndSetR0R1(rr0, rr1) {\n rr1 = Math.max(Math.min(rr1, radius), innerRadius);\n if (rr0 < OFFEDGE) rr0 = 0;\n else if (radius - rr0 < OFFEDGE) rr0 = radius;\n else if (rr1 < OFFEDGE) rr1 = 0;\n else if (radius - rr1 < OFFEDGE) rr1 = radius;\n if (Math.abs(rr1 - rr0) > MINZOOM) {\n if (rr0 < rr1) {\n r0 = rr0;\n r1 = rr1;\n } else {\n r0 = rr1;\n r1 = rr0;\n }\n return true;\n } else {\n r0 = null;\n r1 = null;\n return false;\n }\n }\n function applyZoomMove(path1, cpath) {\n path1 = path1 || path0;\n cpath = cpath || \"M0,0Z\";\n zb.attr(\"d\", path1);\n corners.attr(\"d\", cpath);\n dragBox.transitionZoombox(zb, corners, dimmed, lum);\n dimmed = true;\n var updateObj = {};\n computeZoomUpdates(updateObj);\n gd.emit(\"plotly_relayouting\", updateObj);\n }\n function zoomMove(dx, dy) {\n dx = dx * scaleX;\n dy = dy * scaleY;\n var x1 = x0 + dx;\n var y1 = y0 + dy;\n var rr0 = xy2r(x0, y0);\n var rr1 = Math.min(xy2r(x1, y1), radius);\n var a0 = xy2a(x0, y0);\n var path1;\n var cpath;\n if (clampAndSetR0R1(rr0, rr1)) {\n path1 = path0 + _this.pathSector(r1);\n if (r0) path1 += _this.pathSector(r0);\n cpath = pathCorner(r0, a0) + pathCorner(r1, a0);\n }\n applyZoomMove(path1, cpath);\n }\n function findPolygonRadius(x, y, va0, va1) {\n var xy = helpers.findIntersectionXY(va0, va1, va0, [x - cxx, cyy - y]);\n return norm(xy[0], xy[1]);\n }\n function zoomMoveForPolygons(dx, dy) {\n var x1 = x0 + dx;\n var y1 = y0 + dy;\n var a0 = xy2a(x0, y0);\n var a1 = xy2a(x1, y1);\n var vangles0 = findEnclosingVertexAngles(a0, vangles);\n var vangles1 = findEnclosingVertexAngles(a1, vangles);\n var rr0 = findPolygonRadius(x0, y0, vangles0[0], vangles0[1]);\n var rr1 = Math.min(findPolygonRadius(x1, y1, vangles1[0], vangles1[1]), radius);\n var path1;\n var cpath;\n if (clampAndSetR0R1(rr0, rr1)) {\n path1 = path0 + _this.pathSector(r1);\n if (r0) path1 += _this.pathSector(r0);\n cpath = [\n pathCornerForPolygons(r0, vangles0[0], vangles0[1]),\n pathCornerForPolygons(r1, vangles0[0], vangles0[1])\n ].join(\" \");\n }\n applyZoomMove(path1, cpath);\n }\n function zoomDone() {\n dragBox.removeZoombox(gd);\n if (r0 === null || r1 === null) return;\n var updateObj = {};\n computeZoomUpdates(updateObj);\n dragBox.showDoubleClickNotifier(gd);\n Registry.call(\"_guiRelayout\", gd, updateObj);\n }\n function computeZoomUpdates(update) {\n var rl = radialAxis._rl;\n var m = (rl[1] - rl[0]) / (1 - innerRadius / radius) / radius;\n var newRng = [\n rl[0] + (r0 - innerRadius) * m,\n rl[0] + (r1 - innerRadius) * m\n ];\n update[_this.id + \".radialaxis.range\"] = newRng;\n }\n function zoomClick(numClicks, evt) {\n var clickMode = gd._fullLayout.clickmode;\n dragBox.removeZoombox(gd);\n if (numClicks === 2) {\n var updateObj = {};\n for (var k in _this.viewInitial) {\n updateObj[_this.id + \".\" + k] = _this.viewInitial[k];\n }\n gd.emit(\"plotly_doubleclick\", null);\n Registry.call(\"_guiRelayout\", gd, updateObj);\n }\n if (clickMode.indexOf(\"select\") > -1 && numClicks === 1) {\n selectOnClick(evt, gd, [_this.xaxis], [_this.yaxis], _this.id, dragOpts);\n }\n if (clickMode.indexOf(\"event\") > -1) {\n Fx.click(gd, evt, _this.id);\n }\n }\n dragOpts.prepFn = function(evt, startX, startY) {\n var dragModeNow = gd._fullLayout.dragmode;\n var bbox = mainDrag.getBoundingClientRect();\n gd._fullLayout._calcInverseTransform(gd);\n var inverse = gd._fullLayout._invTransform;\n scaleX = gd._fullLayout._invScaleX;\n scaleY = gd._fullLayout._invScaleY;\n var transformedCoords = Lib.apply3DTransform(inverse)(startX - bbox.left, startY - bbox.top);\n x0 = transformedCoords[0];\n y0 = transformedCoords[1];\n if (vangles) {\n var offset = helpers.findPolygonOffset(radius, sectorInRad[0], sectorInRad[1], vangles);\n x0 += cxx + offset[0];\n y0 += cyy + offset[1];\n }\n switch (dragModeNow) {\n case \"zoom\":\n dragOpts.clickFn = zoomClick;\n if (!isSmith) {\n if (vangles) {\n dragOpts.moveFn = zoomMoveForPolygons;\n } else {\n dragOpts.moveFn = zoomMove;\n }\n dragOpts.doneFn = zoomDone;\n zoomPrep(evt, startX, startY);\n }\n break;\n case \"select\":\n case \"lasso\":\n prepSelect(evt, startX, startY, dragOpts, dragModeNow);\n break;\n }\n };\n dragElement.init(dragOpts);\n };\n proto.updateRadialDrag = function(fullLayout, polarLayout, rngIndex) {\n var _this = this;\n var gd = _this.gd;\n var layers = _this.layers;\n var radius = _this.radius;\n var innerRadius = _this.innerRadius;\n var cx = _this.cx;\n var cy = _this.cy;\n var radialAxis = _this.radialAxis;\n var bl = constants.radialDragBoxSize;\n var bl2 = bl / 2;\n if (!radialAxis.visible) return;\n var angle0 = deg2rad(_this.radialAxisAngle);\n var rl = radialAxis._rl;\n var rl0 = rl[0];\n var rl1 = rl[1];\n var rbase = rl[rngIndex];\n var m = 0.75 * (rl[1] - rl[0]) / (1 - _this.getHole(polarLayout)) / radius;\n var tx, ty, className;\n if (rngIndex) {\n tx = cx + (radius + bl2) * Math.cos(angle0);\n ty = cy - (radius + bl2) * Math.sin(angle0);\n className = \"radialdrag\";\n } else {\n tx = cx + (innerRadius - bl2) * Math.cos(angle0);\n ty = cy - (innerRadius - bl2) * Math.sin(angle0);\n className = \"radialdrag-inner\";\n }\n var radialDrag = dragBox.makeRectDragger(layers, className, \"crosshair\", -bl2, -bl2, bl, bl);\n var dragOpts = { element: radialDrag, gd };\n if (fullLayout.dragmode === false) {\n dragOpts.dragmode = false;\n }\n updateElement(d3.select(radialDrag), radialAxis.visible && innerRadius < radius, {\n transform: strTranslate(tx, ty)\n });\n var moveFn2;\n var angle1;\n var rprime;\n function moveFn(dx, dy) {\n if (moveFn2) {\n moveFn2(dx, dy);\n } else {\n var dvec = [dx, -dy];\n var rvec = [Math.cos(angle0), Math.sin(angle0)];\n var comp = Math.abs(Lib.dot(dvec, rvec) / Math.sqrt(Lib.dot(dvec, dvec)));\n if (!isNaN(comp)) {\n moveFn2 = comp < 0.5 ? rotateMove : rerangeMove;\n }\n }\n var update = {};\n computeRadialAxisUpdates(update);\n gd.emit(\"plotly_relayouting\", update);\n }\n function computeRadialAxisUpdates(update) {\n if (angle1 !== null) {\n update[_this.id + \".radialaxis.angle\"] = angle1;\n } else if (rprime !== null) {\n update[_this.id + \".radialaxis.range[\" + rngIndex + \"]\"] = rprime;\n }\n }\n function doneFn() {\n if (angle1 !== null) {\n Registry.call(\"_guiRelayout\", gd, _this.id + \".radialaxis.angle\", angle1);\n } else if (rprime !== null) {\n Registry.call(\"_guiRelayout\", gd, _this.id + \".radialaxis.range[\" + rngIndex + \"]\", rprime);\n }\n }\n function rotateMove(dx, dy) {\n if (rngIndex === 0) return;\n var x1 = tx + dx;\n var y1 = ty + dy;\n angle1 = Math.atan2(cy - y1, x1 - cx);\n if (_this.vangles) angle1 = snapToVertexAngle(angle1, _this.vangles);\n angle1 = rad2deg(angle1);\n var transform = strTranslate(cx, cy) + strRotate(-angle1);\n layers[\"radial-axis\"].attr(\"transform\", transform);\n layers[\"radial-line\"].select(\"line\").attr(\"transform\", transform);\n var fullLayoutNow = _this.gd._fullLayout;\n var polarLayoutNow = fullLayoutNow[_this.id];\n _this.updateRadialAxisTitle(fullLayoutNow, polarLayoutNow, angle1);\n }\n function rerangeMove(dx, dy) {\n var dr = Lib.dot([dx, -dy], [Math.cos(angle0), Math.sin(angle0)]);\n rprime = rbase - m * dr;\n if (m > 0 !== (rngIndex ? rprime > rl0 : rprime < rl1)) {\n rprime = null;\n return;\n }\n var fullLayoutNow = gd._fullLayout;\n var polarLayoutNow = fullLayoutNow[_this.id];\n radialAxis.range[rngIndex] = rprime;\n radialAxis._rl[rngIndex] = rprime;\n _this.updateRadialAxis(fullLayoutNow, polarLayoutNow);\n _this.xaxis.setRange();\n _this.xaxis.setScale();\n _this.yaxis.setRange();\n _this.yaxis.setScale();\n var hasRegl = false;\n for (var traceType in _this.traceHash) {\n var moduleCalcData = _this.traceHash[traceType];\n var moduleCalcDataVisible = Lib.filterVisible(moduleCalcData);\n var _module = moduleCalcData[0][0].trace._module;\n _module.plot(gd, _this, moduleCalcDataVisible, polarLayoutNow);\n if (Registry.traceIs(traceType, \"gl\") && moduleCalcDataVisible.length) hasRegl = true;\n }\n if (hasRegl) {\n clearGlCanvases(gd);\n redrawReglTraces(gd);\n }\n }\n dragOpts.prepFn = function() {\n moveFn2 = null;\n angle1 = null;\n rprime = null;\n dragOpts.moveFn = moveFn;\n dragOpts.doneFn = doneFn;\n clearOutline(gd);\n };\n dragOpts.clampFn = function(dx, dy) {\n if (Math.sqrt(dx * dx + dy * dy) < constants.MINDRAG) {\n dx = 0;\n dy = 0;\n }\n return [dx, dy];\n };\n dragElement.init(dragOpts);\n };\n proto.updateAngularDrag = function(fullLayout) {\n var _this = this;\n var gd = _this.gd;\n var layers = _this.layers;\n var radius = _this.radius;\n var angularAxis = _this.angularAxis;\n var cx = _this.cx;\n var cy = _this.cy;\n var cxx = _this.cxx;\n var cyy = _this.cyy;\n var dbs = constants.angularDragBoxSize;\n var angularDrag = dragBox.makeDragger(layers, \"path\", \"angulardrag\", fullLayout.dragmode === false ? \"none\" : \"move\");\n var dragOpts = { element: angularDrag, gd };\n if (fullLayout.dragmode === false) {\n dragOpts.dragmode = false;\n } else {\n d3.select(angularDrag).attr(\"d\", _this.pathAnnulus(radius, radius + dbs)).attr(\"transform\", strTranslate(cx, cy)).call(setCursor, \"move\");\n }\n function xy2a(x, y) {\n return Math.atan2(cyy + dbs - y, x - cxx - dbs);\n }\n var scatterTraces = layers.frontplot.select(\".scatterlayer\").selectAll(\".trace\");\n var scatterPoints = scatterTraces.selectAll(\".point\");\n var scatterTextPoints = scatterTraces.selectAll(\".textpoint\");\n var x0, y0;\n var rot0, rot1;\n var rrot1;\n var a0;\n function moveFn(dx, dy) {\n var fullLayoutNow = _this.gd._fullLayout;\n var polarLayoutNow = fullLayoutNow[_this.id];\n var x1 = x0 + dx * fullLayout._invScaleX;\n var y1 = y0 + dy * fullLayout._invScaleY;\n var a1 = xy2a(x1, y1);\n var da = rad2deg(a1 - a0);\n rot1 = rot0 + da;\n layers.frontplot.attr(\n \"transform\",\n strTranslate(_this.xOffset2, _this.yOffset2) + strRotate([-da, cxx, cyy])\n );\n if (_this.vangles) {\n rrot1 = _this.radialAxisAngle + da;\n var trans = strTranslate(cx, cy) + strRotate(-da);\n var trans2 = strTranslate(cx, cy) + strRotate(-rrot1);\n layers.bg.attr(\"transform\", trans);\n layers[\"radial-grid\"].attr(\"transform\", trans);\n layers[\"radial-axis\"].attr(\"transform\", trans2);\n layers[\"radial-line\"].select(\"line\").attr(\"transform\", trans2);\n _this.updateRadialAxisTitle(fullLayoutNow, polarLayoutNow, rrot1);\n } else {\n _this.clipPaths.forTraces.select(\"path\").attr(\n \"transform\",\n strTranslate(cxx, cyy) + strRotate(da)\n );\n }\n scatterPoints.each(function() {\n var sel = d3.select(this);\n var xy = Drawing.getTranslate(sel);\n sel.attr(\"transform\", strTranslate(xy.x, xy.y) + strRotate([da]));\n });\n scatterTextPoints.each(function() {\n var sel = d3.select(this);\n var tx = sel.select(\"text\");\n var xy = Drawing.getTranslate(sel);\n sel.attr(\"transform\", strRotate([da, tx.attr(\"x\"), tx.attr(\"y\")]) + strTranslate(xy.x, xy.y));\n });\n angularAxis.rotation = Lib.modHalf(rot1, 360);\n _this.updateAngularAxis(fullLayoutNow, polarLayoutNow);\n if (_this._hasClipOnAxisFalse && !Lib.isFullCircle(_this.sectorInRad)) {\n scatterTraces.call(Drawing.hideOutsideRangePoints, _this);\n }\n var hasRegl = false;\n for (var traceType in _this.traceHash) {\n if (Registry.traceIs(traceType, \"gl\")) {\n var moduleCalcData = _this.traceHash[traceType];\n var moduleCalcDataVisible = Lib.filterVisible(moduleCalcData);\n var _module = moduleCalcData[0][0].trace._module;\n _module.plot(gd, _this, moduleCalcDataVisible, polarLayoutNow);\n if (moduleCalcDataVisible.length) hasRegl = true;\n }\n }\n if (hasRegl) {\n clearGlCanvases(gd);\n redrawReglTraces(gd);\n }\n var update = {};\n computeRotationUpdates(update);\n gd.emit(\"plotly_relayouting\", update);\n }\n function computeRotationUpdates(updateObj) {\n updateObj[_this.id + \".angularaxis.rotation\"] = rot1;\n if (_this.vangles) {\n updateObj[_this.id + \".radialaxis.angle\"] = rrot1;\n }\n }\n function doneFn() {\n scatterTextPoints.select(\"text\").attr(\"transform\", null);\n var updateObj = {};\n computeRotationUpdates(updateObj);\n Registry.call(\"_guiRelayout\", gd, updateObj);\n }\n dragOpts.prepFn = function(evt, startX, startY) {\n var polarLayoutNow = fullLayout[_this.id];\n rot0 = polarLayoutNow.angularaxis.rotation;\n var bbox = angularDrag.getBoundingClientRect();\n x0 = startX - bbox.left;\n y0 = startY - bbox.top;\n gd._fullLayout._calcInverseTransform(gd);\n var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(x0, y0);\n x0 = transformedCoords[0];\n y0 = transformedCoords[1];\n a0 = xy2a(x0, y0);\n dragOpts.moveFn = moveFn;\n dragOpts.doneFn = doneFn;\n clearOutline(gd);\n };\n if (_this.vangles && !Lib.isFullCircle(_this.sectorInRad)) {\n dragOpts.prepFn = Lib.noop;\n setCursor(d3.select(angularDrag), null);\n }\n dragElement.init(dragOpts);\n };\n proto.isPtInside = function(d) {\n if (this.isSmith) return true;\n var sectorInRad = this.sectorInRad;\n var vangles = this.vangles;\n var thetag = this.angularAxis.c2g(d.theta);\n var radialAxis = this.radialAxis;\n var r = radialAxis.c2l(d.r);\n var rl = radialAxis._rl;\n var fn = vangles ? helpers.isPtInsidePolygon : Lib.isPtInsideSector;\n return fn(r, thetag, rl, sectorInRad, vangles);\n };\n proto.pathArc = function(r) {\n var sectorInRad = this.sectorInRad;\n var vangles = this.vangles;\n var fn = vangles ? helpers.pathPolygon : Lib.pathArc;\n return fn(r, sectorInRad[0], sectorInRad[1], vangles);\n };\n proto.pathSector = function(r) {\n var sectorInRad = this.sectorInRad;\n var vangles = this.vangles;\n var fn = vangles ? helpers.pathPolygon : Lib.pathSector;\n return fn(r, sectorInRad[0], sectorInRad[1], vangles);\n };\n proto.pathAnnulus = function(r0, r1) {\n var sectorInRad = this.sectorInRad;\n var vangles = this.vangles;\n var fn = vangles ? helpers.pathPolygonAnnulus : Lib.pathAnnulus;\n return fn(r0, r1, sectorInRad[0], sectorInRad[1], vangles);\n };\n proto.pathSubplot = function() {\n var r0 = this.innerRadius;\n var r1 = this.radius;\n return r0 ? this.pathAnnulus(r0, r1) : this.pathSector(r1);\n };\n proto.fillViewInitialKey = function(key, val) {\n if (!(key in this.viewInitial)) {\n this.viewInitial[key] = val;\n }\n };\n function strTickLayout(axLayout) {\n var out = axLayout.ticks + String(axLayout.ticklen) + String(axLayout.showticklabels);\n if (\"side\" in axLayout) out += axLayout.side;\n return out;\n }\n function computeSectorBBox(sector) {\n var s0 = sector[0];\n var s1 = sector[1];\n var arc = s1 - s0;\n var a0 = mod(s0, 360);\n var a1 = a0 + arc;\n var ax0 = Math.cos(deg2rad(a0));\n var ay0 = Math.sin(deg2rad(a0));\n var ax1 = Math.cos(deg2rad(a1));\n var ay1 = Math.sin(deg2rad(a1));\n var x0, y0, x1, y1;\n if (a0 <= 90 && a1 >= 90 || a0 > 90 && a1 >= 450) {\n y1 = 1;\n } else if (ay0 <= 0 && ay1 <= 0) {\n y1 = 0;\n } else {\n y1 = Math.max(ay0, ay1);\n }\n if (a0 <= 180 && a1 >= 180 || a0 > 180 && a1 >= 540) {\n x0 = -1;\n } else if (ax0 >= 0 && ax1 >= 0) {\n x0 = 0;\n } else {\n x0 = Math.min(ax0, ax1);\n }\n if (a0 <= 270 && a1 >= 270 || a0 > 270 && a1 >= 630) {\n y0 = -1;\n } else if (ay0 >= 0 && ay1 >= 0) {\n y0 = 0;\n } else {\n y0 = Math.min(ay0, ay1);\n }\n if (a1 >= 360) {\n x1 = 1;\n } else if (ax0 <= 0 && ax1 <= 0) {\n x1 = 0;\n } else {\n x1 = Math.max(ax0, ax1);\n }\n return [x0, y0, x1, y1];\n }\n function snapToVertexAngle(a, vangles) {\n var fn = function(v) {\n return Lib.angleDist(a, v);\n };\n var ind = Lib.findIndexOfMin(vangles, fn);\n return vangles[ind];\n }\n function updateElement(sel, showAttr, attrs) {\n if (showAttr) {\n sel.attr(\"display\", null);\n sel.attr(attrs);\n } else if (sel) {\n sel.attr(\"display\", \"none\");\n }\n return sel;\n }\n }\n });\n\n // src/plots/polar/layout_attributes.js\n var require_layout_attributes21 = __commonJS({\n \"src/plots/polar/layout_attributes.js\"(exports, module) {\n \"use strict\";\n var colorAttrs = require_attributes3();\n var axesAttrs = require_layout_attributes4();\n var domainAttrs = require_domain().attributes;\n var extendFlat = require_lib().extendFlat;\n var overrideAll = require_edit_types().overrideAll;\n var axisLineGridAttr = overrideAll({\n color: axesAttrs.color,\n showline: extendFlat({}, axesAttrs.showline, { dflt: true }),\n linecolor: axesAttrs.linecolor,\n linewidth: axesAttrs.linewidth,\n showgrid: extendFlat({}, axesAttrs.showgrid, { dflt: true }),\n gridcolor: axesAttrs.gridcolor,\n gridwidth: axesAttrs.gridwidth,\n griddash: axesAttrs.griddash\n // TODO add spike* attributes down the road\n // should we add zeroline* attributes?\n }, \"plot\", \"from-root\");\n var axisTickAttrs = overrideAll({\n tickmode: axesAttrs.minor.tickmode,\n nticks: axesAttrs.nticks,\n tick0: axesAttrs.tick0,\n dtick: axesAttrs.dtick,\n tickvals: axesAttrs.tickvals,\n ticktext: axesAttrs.ticktext,\n ticks: axesAttrs.ticks,\n ticklen: axesAttrs.ticklen,\n tickwidth: axesAttrs.tickwidth,\n tickcolor: axesAttrs.tickcolor,\n ticklabelstep: axesAttrs.ticklabelstep,\n showticklabels: axesAttrs.showticklabels,\n labelalias: axesAttrs.labelalias,\n showtickprefix: axesAttrs.showtickprefix,\n tickprefix: axesAttrs.tickprefix,\n showticksuffix: axesAttrs.showticksuffix,\n ticksuffix: axesAttrs.ticksuffix,\n showexponent: axesAttrs.showexponent,\n exponentformat: axesAttrs.exponentformat,\n minexponent: axesAttrs.minexponent,\n separatethousands: axesAttrs.separatethousands,\n tickfont: axesAttrs.tickfont,\n tickangle: axesAttrs.tickangle,\n tickformat: axesAttrs.tickformat,\n tickformatstops: axesAttrs.tickformatstops,\n layer: axesAttrs.layer\n }, \"plot\", \"from-root\");\n var radialAxisAttrs = {\n visible: extendFlat({}, axesAttrs.visible, { dflt: true }),\n type: extendFlat({}, axesAttrs.type, {\n values: [\"-\", \"linear\", \"log\", \"date\", \"category\"]\n }),\n autotypenumbers: axesAttrs.autotypenumbers,\n autorangeoptions: {\n minallowed: axesAttrs.autorangeoptions.minallowed,\n maxallowed: axesAttrs.autorangeoptions.maxallowed,\n clipmin: axesAttrs.autorangeoptions.clipmin,\n clipmax: axesAttrs.autorangeoptions.clipmax,\n include: axesAttrs.autorangeoptions.include,\n editType: \"plot\"\n },\n autorange: extendFlat({}, axesAttrs.autorange, { editType: \"plot\" }),\n rangemode: {\n valType: \"enumerated\",\n values: [\"tozero\", \"nonnegative\", \"normal\"],\n dflt: \"tozero\",\n editType: \"calc\"\n },\n minallowed: extendFlat({}, axesAttrs.minallowed, { editType: \"plot\" }),\n maxallowed: extendFlat({}, axesAttrs.maxallowed, { editType: \"plot\" }),\n range: extendFlat({}, axesAttrs.range, {\n items: [\n { valType: \"any\", editType: \"plot\", impliedEdits: { \"^autorange\": false } },\n { valType: \"any\", editType: \"plot\", impliedEdits: { \"^autorange\": false } }\n ],\n editType: \"plot\"\n }),\n categoryorder: axesAttrs.categoryorder,\n categoryarray: axesAttrs.categoryarray,\n angle: {\n valType: \"angle\",\n editType: \"plot\"\n },\n autotickangles: axesAttrs.autotickangles,\n side: {\n valType: \"enumerated\",\n // TODO add 'center' for `showline: false` radial axes\n values: [\"clockwise\", \"counterclockwise\"],\n dflt: \"clockwise\",\n editType: \"plot\"\n },\n title: {\n // radial title is not gui-editable at the moment,\n // so it needs dflt: '', similar to carpet axes.\n text: extendFlat({}, axesAttrs.title.text, { editType: \"plot\", dflt: \"\" }),\n font: extendFlat({}, axesAttrs.title.font, { editType: \"plot\" }),\n // TODO\n // - might need a 'titleside' and even 'titledirection' down the road\n // - what about standoff ??\n editType: \"plot\"\n },\n hoverformat: axesAttrs.hoverformat,\n uirevision: {\n valType: \"any\",\n editType: \"none\"\n },\n editType: \"calc\"\n };\n extendFlat(\n radialAxisAttrs,\n // N.B. radialaxis grid lines are circular,\n // but radialaxis lines are straight from circle center to outer bound\n axisLineGridAttr,\n axisTickAttrs\n );\n var angularAxisAttrs = {\n visible: extendFlat({}, axesAttrs.visible, { dflt: true }),\n type: {\n valType: \"enumerated\",\n // 'linear' should maybe be called 'angle' or 'angular' here\n // to make clear that axis here is periodic and more tightly match\n // `thetaunit`?\n //\n // skip 'date' for first push\n // no 'log' for now\n values: [\"-\", \"linear\", \"category\"],\n dflt: \"-\",\n editType: \"calc\",\n _noTemplating: true\n },\n autotypenumbers: axesAttrs.autotypenumbers,\n categoryorder: axesAttrs.categoryorder,\n categoryarray: axesAttrs.categoryarray,\n thetaunit: {\n valType: \"enumerated\",\n values: [\"radians\", \"degrees\"],\n dflt: \"degrees\",\n editType: \"calc\"\n },\n period: {\n valType: \"number\",\n editType: \"calc\",\n min: 0\n // Examples for date axes:\n //\n // - period that equals the timeseries length\n // http://flowingdata.com/2017/01/24/one-dataset-visualized-25-ways/18-polar-coordinates/\n // - and 1-year periods (focusing on seasonal change0\n // http://otexts.org/fpp2/seasonal-plots.html\n // https://blogs.scientificamerican.com/sa-visual/why-are-so-many-babies-born-around-8-00-a-m/\n // http://www.seasonaladjustment.com/2012/09/05/clock-plot-visualising-seasonality-using-r-and-ggplot2-part-3/\n // https://i.pinimg.com/736x/49/b9/72/49b972ccb3206a1a6d6f870dac543280.jpg\n // https://www.climate-lab-book.ac.uk/spirals/\n },\n direction: {\n valType: \"enumerated\",\n values: [\"counterclockwise\", \"clockwise\"],\n dflt: \"counterclockwise\",\n editType: \"calc\"\n },\n rotation: {\n valType: \"angle\",\n editType: \"calc\"\n },\n hoverformat: axesAttrs.hoverformat,\n uirevision: {\n valType: \"any\",\n editType: \"none\"\n },\n editType: \"calc\"\n };\n extendFlat(\n angularAxisAttrs,\n // N.B. angular grid lines are straight lines from circle center to outer bound\n // the angular line is circular bounding the polar plot area.\n axisLineGridAttr,\n // N.B. ticksuffix defaults to '\u00B0' for angular axes with `thetaunit: 'degrees'`\n axisTickAttrs\n );\n module.exports = {\n // TODO for x/y/zoom system for paper-based zooming:\n // x: {},\n // y: {},\n // zoom: {},\n domain: domainAttrs({ name: \"polar\", editType: \"plot\" }),\n sector: {\n valType: \"info_array\",\n items: [\n { valType: \"number\", editType: \"plot\" },\n { valType: \"number\", editType: \"plot\" }\n ],\n dflt: [0, 360],\n editType: \"plot\"\n },\n hole: {\n valType: \"number\",\n min: 0,\n max: 1,\n dflt: 0,\n editType: \"plot\"\n },\n bgcolor: {\n valType: \"color\",\n editType: \"plot\",\n dflt: colorAttrs.background\n },\n radialaxis: radialAxisAttrs,\n angularaxis: angularAxisAttrs,\n gridshape: {\n valType: \"enumerated\",\n values: [\"circular\", \"linear\"],\n dflt: \"circular\",\n editType: \"plot\"\n },\n // TODO maybe?\n // annotations:\n uirevision: {\n valType: \"any\",\n editType: \"none\"\n },\n editType: \"calc\"\n };\n }\n });\n\n // src/plots/polar/layout_defaults.js\n var require_layout_defaults19 = __commonJS({\n \"src/plots/polar/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Color2 = require_color();\n var Template = require_plot_template();\n var handleSubplotDefaults = require_subplot_defaults();\n var getSubplotData = require_get_data().getSubplotData;\n var handleTickValueDefaults = require_tick_value_defaults();\n var handleTickMarkDefaults = require_tick_mark_defaults();\n var handleTickLabelDefaults = require_tick_label_defaults();\n var handlePrefixSuffixDefaults = require_prefix_suffix_defaults();\n var handleCategoryOrderDefaults = require_category_order_defaults();\n var handleLineGridDefaults = require_line_grid_defaults();\n var handleAutorangeOptionsDefaults = require_autorange_options_defaults();\n var autoType = require_axis_autotype();\n var layoutAttributes = require_layout_attributes21();\n var setConvert = require_set_convert3();\n var constants = require_constants33();\n var axisNames = constants.axisNames;\n function handleDefaults(contIn, contOut, coerce, opts) {\n var bgColor = coerce(\"bgcolor\");\n opts.bgColor = Color2.combine(bgColor, opts.paper_bgcolor);\n var sector = coerce(\"sector\");\n coerce(\"hole\");\n var subplotData = getSubplotData(opts.fullData, constants.name, opts.id);\n var layoutOut = opts.layoutOut;\n var axName;\n function coerceAxis(attr, dflt) {\n return coerce(axName + \".\" + attr, dflt);\n }\n for (var i = 0; i < axisNames.length; i++) {\n axName = axisNames[i];\n if (!Lib.isPlainObject(contIn[axName])) {\n contIn[axName] = {};\n }\n var axIn = contIn[axName];\n var axOut = Template.newContainer(contOut, axName);\n axOut._id = axOut._name = axName;\n axOut._attr = opts.id + \".\" + axName;\n axOut._traceIndices = subplotData.map(function(t) {\n return t.index;\n });\n var dataAttr = constants.axisName2dataArray[axName];\n var axType = handleAxisTypeDefaults(axIn, axOut, coerceAxis, subplotData, dataAttr, opts);\n handleCategoryOrderDefaults(axIn, axOut, coerceAxis, {\n axData: subplotData,\n dataAttr\n });\n var visible = coerceAxis(\"visible\");\n setConvert(axOut, contOut, layoutOut);\n coerceAxis(\"uirevision\", contOut.uirevision);\n axOut._m = 1;\n switch (axName) {\n case \"radialaxis\":\n coerceAxis(\"minallowed\");\n coerceAxis(\"maxallowed\");\n var range = coerceAxis(\"range\");\n var autorangeDflt = axOut.getAutorangeDflt(range);\n var autorange = coerceAxis(\"autorange\", autorangeDflt);\n var shouldAutorange;\n if (range && (range[0] === null && range[1] === null || (range[0] === null || range[1] === null) && (autorange === \"reversed\" || autorange === true) || range[0] !== null && (autorange === \"min\" || autorange === \"max reversed\") || range[1] !== null && (autorange === \"max\" || autorange === \"min reversed\"))) {\n range = void 0;\n delete axOut.range;\n axOut.autorange = true;\n shouldAutorange = true;\n }\n if (!shouldAutorange) {\n autorangeDflt = axOut.getAutorangeDflt(range);\n autorange = coerceAxis(\"autorange\", autorangeDflt);\n }\n axIn.autorange = autorange;\n if (autorange) {\n handleAutorangeOptionsDefaults(coerceAxis, autorange, range);\n if (axType === \"linear\" || axType === \"-\") coerceAxis(\"rangemode\");\n if (axOut.isReversed()) axOut._m = -1;\n }\n axOut.cleanRange(\"range\", { dfltRange: [0, 1] });\n break;\n case \"angularaxis\":\n if (axType === \"date\") {\n Lib.log(\"Polar plots do not support date angular axes yet.\");\n for (var j = 0; j < subplotData.length; j++) {\n subplotData[j].visible = false;\n }\n axType = axIn.type = axOut.type = \"linear\";\n }\n if (axType === \"linear\") {\n coerceAxis(\"thetaunit\");\n } else {\n coerceAxis(\"period\");\n }\n var direction = coerceAxis(\"direction\");\n coerceAxis(\"rotation\", { counterclockwise: 0, clockwise: 90 }[direction]);\n break;\n }\n handlePrefixSuffixDefaults(axIn, axOut, coerceAxis, axOut.type, {\n tickSuffixDflt: axOut.thetaunit === \"degrees\" ? \"\\xB0\" : void 0\n });\n if (visible) {\n var dfltColor;\n var dfltFontColor;\n var dfltFontSize;\n var dfltFontFamily;\n var dfltFontWeight;\n var dfltFontStyle;\n var dfltFontVariant;\n var dfltFontTextcase;\n var dfltFontLineposition;\n var dfltFontShadow;\n var font = opts.font || {};\n dfltColor = coerceAxis(\"color\");\n dfltFontColor = dfltColor === axIn.color ? dfltColor : font.color;\n dfltFontSize = font.size;\n dfltFontFamily = font.family;\n dfltFontWeight = font.weight;\n dfltFontStyle = font.style;\n dfltFontVariant = font.variant;\n dfltFontTextcase = font.textcase;\n dfltFontLineposition = font.lineposition;\n dfltFontShadow = font.shadow;\n handleTickValueDefaults(axIn, axOut, coerceAxis, axOut.type);\n handleTickLabelDefaults(axIn, axOut, coerceAxis, axOut.type, {\n font: {\n weight: dfltFontWeight,\n style: dfltFontStyle,\n variant: dfltFontVariant,\n textcase: dfltFontTextcase,\n lineposition: dfltFontLineposition,\n shadow: dfltFontShadow,\n color: dfltFontColor,\n size: dfltFontSize,\n family: dfltFontFamily\n },\n noAutotickangles: axName === \"angularaxis\",\n noTicklabelshift: true,\n noTicklabelstandoff: true\n });\n handleTickMarkDefaults(axIn, axOut, coerceAxis, { outerTicks: true });\n handleLineGridDefaults(axIn, axOut, coerceAxis, {\n dfltColor,\n bgColor: opts.bgColor,\n // default grid color is darker here (60%, vs cartesian default ~91%)\n // because the grid is not square so the eye needs heavier cues to follow\n blend: 60,\n showLine: true,\n showGrid: true,\n noZeroLine: true,\n attributes: layoutAttributes[axName]\n });\n coerceAxis(\"layer\");\n if (axName === \"radialaxis\") {\n coerceAxis(\"side\");\n coerceAxis(\"angle\", sector[0]);\n coerceAxis(\"title.text\");\n Lib.coerceFont(coerceAxis, \"title.font\", {\n weight: dfltFontWeight,\n style: dfltFontStyle,\n variant: dfltFontVariant,\n textcase: dfltFontTextcase,\n lineposition: dfltFontLineposition,\n shadow: dfltFontShadow,\n color: dfltFontColor,\n size: Lib.bigFont(dfltFontSize),\n family: dfltFontFamily\n });\n }\n }\n if (axType !== \"category\") coerceAxis(\"hoverformat\");\n axOut._input = axIn;\n }\n if (contOut.angularaxis.type === \"category\") {\n coerce(\"gridshape\");\n }\n }\n function handleAxisTypeDefaults(axIn, axOut, coerce, subplotData, dataAttr, options) {\n var autotypenumbers = coerce(\"autotypenumbers\", options.autotypenumbersDflt);\n var axType = coerce(\"type\");\n if (axType === \"-\") {\n var trace;\n for (var i = 0; i < subplotData.length; i++) {\n if (subplotData[i].visible) {\n trace = subplotData[i];\n break;\n }\n }\n if (trace && trace[dataAttr]) {\n axOut.type = autoType(trace[dataAttr], \"gregorian\", {\n noMultiCategory: true,\n autotypenumbers\n });\n }\n if (axOut.type === \"-\") {\n axOut.type = \"linear\";\n } else {\n axIn.type = axOut.type;\n }\n }\n return axOut.type;\n }\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {\n handleSubplotDefaults(layoutIn, layoutOut, fullData, {\n type: constants.name,\n attributes: layoutAttributes,\n handleDefaults,\n font: layoutOut.font,\n autotypenumbersDflt: layoutOut.autotypenumbers,\n paper_bgcolor: layoutOut.paper_bgcolor,\n fullData,\n layoutOut\n });\n };\n }\n });\n\n // src/plots/polar/index.js\n var require_polar2 = __commonJS({\n \"src/plots/polar/index.js\"(exports, module) {\n \"use strict\";\n var getSubplotCalcData = require_get_data().getSubplotCalcData;\n var counterRegex = require_lib().counterRegex;\n var createPolar = require_polar();\n var constants = require_constants33();\n var attr = constants.attr;\n var name2 = constants.name;\n var counter = counterRegex(name2);\n var attributes = {};\n attributes[attr] = {\n valType: \"subplotid\",\n dflt: name2,\n editType: \"calc\"\n };\n function plot(gd) {\n var fullLayout = gd._fullLayout;\n var calcData = gd.calcdata;\n var subplotIds = fullLayout._subplots[name2];\n for (var i = 0; i < subplotIds.length; i++) {\n var id = subplotIds[i];\n var subplotCalcData = getSubplotCalcData(calcData, name2, id);\n var subplot = fullLayout[id]._subplot;\n if (!subplot) {\n subplot = createPolar(gd, id);\n fullLayout[id]._subplot = subplot;\n }\n subplot.plot(subplotCalcData, fullLayout, gd._promises);\n }\n }\n function clean(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var oldIds = oldFullLayout._subplots[name2] || [];\n var hadGl = oldFullLayout._has && oldFullLayout._has(\"gl\");\n var hasGl = newFullLayout._has && newFullLayout._has(\"gl\");\n var mustCleanScene = hadGl && !hasGl;\n for (var i = 0; i < oldIds.length; i++) {\n var id = oldIds[i];\n var oldSubplot = oldFullLayout[id]._subplot;\n if (!newFullLayout[id] && !!oldSubplot) {\n oldSubplot.framework.remove();\n oldSubplot.layers[\"radial-axis-title\"].remove();\n for (var k in oldSubplot.clipPaths) {\n oldSubplot.clipPaths[k].remove();\n }\n }\n if (mustCleanScene && oldSubplot._scene) {\n oldSubplot._scene.destroy();\n oldSubplot._scene = null;\n }\n }\n }\n module.exports = {\n attr,\n name: name2,\n idRoot: name2,\n idRegex: counter,\n attrRegex: counter,\n attributes,\n layoutAttributes: require_layout_attributes21(),\n supplyLayoutDefaults: require_layout_defaults19(),\n plot,\n clean,\n toSVG: require_cartesian().toSVG\n };\n }\n });\n\n // src/traces/scatterpolar/attributes.js\n var require_attributes68 = __commonJS({\n \"src/traces/scatterpolar/attributes.js\"(exports, module) {\n \"use strict\";\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var extendFlat = require_extend().extendFlat;\n var makeFillcolorAttr = require_fillcolor_attribute();\n var scatterAttrs = require_attributes12();\n var baseAttrs = require_attributes2();\n var lineAttrs = scatterAttrs.line;\n module.exports = {\n mode: scatterAttrs.mode,\n r: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n theta: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n r0: {\n valType: \"any\",\n dflt: 0,\n editType: \"calc+clearAxisTypes\"\n },\n dr: {\n valType: \"number\",\n dflt: 1,\n editType: \"calc\"\n },\n theta0: {\n valType: \"any\",\n dflt: 0,\n editType: \"calc+clearAxisTypes\"\n },\n dtheta: {\n valType: \"number\",\n editType: \"calc\"\n },\n thetaunit: {\n valType: \"enumerated\",\n values: [\"radians\", \"degrees\", \"gradians\"],\n dflt: \"degrees\",\n editType: \"calc+clearAxisTypes\"\n },\n text: scatterAttrs.text,\n texttemplate: texttemplateAttrs({ editType: \"plot\" }, {\n keys: [\"r\", \"theta\", \"text\"]\n }),\n hovertext: scatterAttrs.hovertext,\n line: {\n color: lineAttrs.color,\n width: lineAttrs.width,\n dash: lineAttrs.dash,\n backoff: lineAttrs.backoff,\n shape: extendFlat({}, lineAttrs.shape, {\n values: [\"linear\", \"spline\"]\n }),\n smoothing: lineAttrs.smoothing,\n editType: \"calc\"\n },\n connectgaps: scatterAttrs.connectgaps,\n marker: scatterAttrs.marker,\n cliponaxis: extendFlat({}, scatterAttrs.cliponaxis, { dflt: false }),\n textposition: scatterAttrs.textposition,\n textfont: scatterAttrs.textfont,\n fill: extendFlat({}, scatterAttrs.fill, {\n values: [\"none\", \"toself\", \"tonext\"],\n dflt: \"none\"\n }),\n fillcolor: makeFillcolorAttr(),\n // TODO error bars\n // https://stackoverflow.com/a/26597487/4068492\n // error_x (error_r, error_theta)\n // error_y\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: [\"r\", \"theta\", \"text\", \"name\"]\n }),\n hoveron: scatterAttrs.hoveron,\n hovertemplate: hovertemplateAttrs(),\n selected: scatterAttrs.selected,\n unselected: scatterAttrs.unselected\n };\n }\n });\n\n // src/traces/scatterpolar/defaults.js\n var require_defaults64 = __commonJS({\n \"src/traces/scatterpolar/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var subTypes = require_subtypes();\n var handleMarkerDefaults = require_marker_defaults();\n var handleLineDefaults = require_line_defaults();\n var handleLineShapeDefaults = require_line_shape_defaults();\n var handleTextDefaults = require_text_defaults();\n var handleFillColorDefaults = require_fillcolor_defaults();\n var PTS_LINESONLY = require_constants8().PTS_LINESONLY;\n var attributes = require_attributes68();\n function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var len = handleRThetaDefaults(traceIn, traceOut, layout, coerce);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n coerce(\"thetaunit\");\n coerce(\"mode\", len < PTS_LINESONLY ? \"lines+markers\" : \"lines\");\n coerce(\"text\");\n coerce(\"hovertext\");\n if (traceOut.hoveron !== \"fills\") coerce(\"hovertemplate\");\n if (subTypes.hasMarkers(traceOut)) {\n handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, { gradient: true });\n }\n if (subTypes.hasLines(traceOut)) {\n handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce, { backoff: true });\n handleLineShapeDefaults(traceIn, traceOut, coerce);\n coerce(\"connectgaps\");\n }\n if (subTypes.hasText(traceOut)) {\n coerce(\"texttemplate\");\n handleTextDefaults(traceIn, traceOut, layout, coerce);\n }\n var dfltHoverOn = [];\n if (subTypes.hasMarkers(traceOut) || subTypes.hasText(traceOut)) {\n coerce(\"cliponaxis\");\n coerce(\"marker.maxdisplayed\");\n dfltHoverOn.push(\"points\");\n }\n coerce(\"fill\");\n if (traceOut.fill !== \"none\") {\n handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce);\n if (!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce);\n }\n if (traceOut.fill === \"tonext\" || traceOut.fill === \"toself\") {\n dfltHoverOn.push(\"fills\");\n }\n coerce(\"hoveron\", dfltHoverOn.join(\"+\") || \"points\");\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n }\n function handleRThetaDefaults(traceIn, traceOut, layout, coerce) {\n var r = coerce(\"r\");\n var theta = coerce(\"theta\");\n if (Lib.isTypedArray(r)) {\n traceOut.r = r = Array.from(r);\n }\n if (Lib.isTypedArray(theta)) {\n traceOut.theta = theta = Array.from(theta);\n }\n var len;\n if (r) {\n if (theta) {\n len = Math.min(r.length, theta.length);\n } else {\n len = r.length;\n coerce(\"theta0\");\n coerce(\"dtheta\");\n }\n } else {\n if (!theta) return 0;\n len = traceOut.theta.length;\n coerce(\"r0\");\n coerce(\"dr\");\n }\n traceOut._length = len;\n return len;\n }\n module.exports = {\n handleRThetaDefaults,\n supplyDefaults\n };\n }\n });\n\n // src/traces/scatterpolar/format_labels.js\n var require_format_labels8 = __commonJS({\n \"src/traces/scatterpolar/format_labels.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Axes = require_axes();\n module.exports = function formatLabels(cdi, trace, fullLayout) {\n var labels = {};\n var subplot = fullLayout[trace.subplot]._subplot;\n var radialAxis;\n var angularAxis;\n if (!subplot) {\n subplot = fullLayout[trace.subplot];\n radialAxis = subplot.radialaxis;\n angularAxis = subplot.angularaxis;\n } else {\n radialAxis = subplot.radialAxis;\n angularAxis = subplot.angularAxis;\n }\n var rVal = radialAxis.c2l(cdi.r);\n labels.rLabel = Axes.tickText(radialAxis, rVal, true).text;\n var thetaVal = angularAxis.thetaunit === \"degrees\" ? Lib.rad2deg(cdi.theta) : cdi.theta;\n labels.thetaLabel = Axes.tickText(angularAxis, thetaVal, true).text;\n return labels;\n };\n }\n });\n\n // src/traces/scatterpolar/calc.js\n var require_calc43 = __commonJS({\n \"src/traces/scatterpolar/calc.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var BADNUM = require_numerical().BADNUM;\n var Axes = require_axes();\n var calcColorscale = require_colorscale_calc();\n var arraysToCalcdata = require_arrays_to_calcdata();\n var calcSelection = require_calc_selection();\n var calcMarkerSize = require_calc3().calcMarkerSize;\n module.exports = function calc(gd, trace) {\n var fullLayout = gd._fullLayout;\n var subplotId = trace.subplot;\n var radialAxis = fullLayout[subplotId].radialaxis;\n var angularAxis = fullLayout[subplotId].angularaxis;\n var rArray = radialAxis.makeCalcdata(trace, \"r\");\n var thetaArray = angularAxis.makeCalcdata(trace, \"theta\");\n var len = trace._length;\n var cd = new Array(len);\n for (var i = 0; i < len; i++) {\n var r = rArray[i];\n var theta = thetaArray[i];\n var cdi = cd[i] = {};\n if (isNumeric(r) && isNumeric(theta)) {\n cdi.r = r;\n cdi.theta = theta;\n } else {\n cdi.r = BADNUM;\n }\n }\n var ppad = calcMarkerSize(trace, len);\n trace._extremes.x = Axes.findExtremes(radialAxis, rArray, { ppad });\n calcColorscale(gd, trace);\n arraysToCalcdata(cd, trace);\n calcSelection(cd, trace);\n return cd;\n };\n }\n });\n\n // src/traces/scatterpolar/plot.js\n var require_plot36 = __commonJS({\n \"src/traces/scatterpolar/plot.js\"(exports, module) {\n \"use strict\";\n var scatterPlot = require_plot();\n var BADNUM = require_numerical().BADNUM;\n module.exports = function plot(gd, subplot, moduleCalcData) {\n var mlayer = subplot.layers.frontplot.select(\"g.scatterlayer\");\n var xa = subplot.xaxis;\n var ya = subplot.yaxis;\n var plotinfo = {\n xaxis: xa,\n yaxis: ya,\n plot: subplot.framework,\n layerClipId: subplot._hasClipOnAxisFalse ? subplot.clipIds.forTraces : null\n };\n var radialAxis = subplot.radialAxis;\n var angularAxis = subplot.angularAxis;\n for (var i = 0; i < moduleCalcData.length; i++) {\n var cdi = moduleCalcData[i];\n for (var j = 0; j < cdi.length; j++) {\n if (j === 0) {\n cdi[0].trace._xA = xa;\n cdi[0].trace._yA = ya;\n }\n var cd = cdi[j];\n var r = cd.r;\n if (r === BADNUM) {\n cd.x = cd.y = BADNUM;\n } else {\n var rg = radialAxis.c2g(r);\n var thetag = angularAxis.c2g(cd.theta);\n cd.x = rg * Math.cos(thetag);\n cd.y = rg * Math.sin(thetag);\n }\n }\n }\n scatterPlot(gd, plotinfo, moduleCalcData, mlayer);\n };\n }\n });\n\n // src/traces/scatterpolar/hover.js\n var require_hover24 = __commonJS({\n \"src/traces/scatterpolar/hover.js\"(exports, module) {\n \"use strict\";\n var scatterHover = require_hover2();\n function hoverPoints(pointData, xval, yval, hovermode) {\n var scatterPointData = scatterHover(pointData, xval, yval, hovermode);\n if (!scatterPointData || scatterPointData[0].index === false) return;\n var newPointData = scatterPointData[0];\n if (newPointData.index === void 0) {\n return scatterPointData;\n }\n var subplot = pointData.subplot;\n var cdi = newPointData.cd[newPointData.index];\n var trace = newPointData.trace;\n if (!subplot.isPtInside(cdi)) return;\n newPointData.xLabelVal = void 0;\n newPointData.yLabelVal = void 0;\n makeHoverPointText(cdi, trace, subplot, newPointData);\n newPointData.hovertemplate = trace.hovertemplate;\n return scatterPointData;\n }\n function makeHoverPointText(cdi, trace, subplot, pointData) {\n var radialAxis = subplot.radialAxis;\n var angularAxis = subplot.angularAxis;\n radialAxis._hovertitle = \"r\";\n angularAxis._hovertitle = \"\\u03B8\";\n var fullLayout = {};\n fullLayout[trace.subplot] = { _subplot: subplot };\n var labels = trace._module.formatLabels(cdi, trace, fullLayout);\n pointData.rLabel = labels.rLabel;\n pointData.thetaLabel = labels.thetaLabel;\n var hoverinfo = cdi.hi || trace.hoverinfo;\n var text = [];\n function textPart(ax, val) {\n text.push(ax._hovertitle + \": \" + val);\n }\n if (!trace.hovertemplate) {\n var parts = hoverinfo.split(\"+\");\n if (parts.indexOf(\"all\") !== -1) parts = [\"r\", \"theta\", \"text\"];\n if (parts.indexOf(\"r\") !== -1) textPart(radialAxis, pointData.rLabel);\n if (parts.indexOf(\"theta\") !== -1) textPart(angularAxis, pointData.thetaLabel);\n if (parts.indexOf(\"text\") !== -1 && pointData.text) {\n text.push(pointData.text);\n delete pointData.text;\n }\n pointData.extraText = text.join(\"
    \");\n }\n }\n module.exports = {\n hoverPoints,\n makeHoverPointText\n };\n }\n });\n\n // src/traces/scatterpolar/index.js\n var require_scatterpolar = __commonJS({\n \"src/traces/scatterpolar/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"trace\",\n name: \"scatterpolar\",\n basePlotModule: require_polar2(),\n categories: [\"polar\", \"symbols\", \"showLegend\", \"scatter-like\"],\n attributes: require_attributes68(),\n supplyDefaults: require_defaults64().supplyDefaults,\n colorbar: require_marker_colorbar(),\n formatLabels: require_format_labels8(),\n calc: require_calc43(),\n plot: require_plot36(),\n style: require_style2().style,\n styleOnSelect: require_style2().styleOnSelect,\n hoverPoints: require_hover24().hoverPoints,\n selectPoints: require_select2(),\n meta: {}\n };\n }\n });\n\n // lib/scatterpolar.js\n var require_scatterpolar2 = __commonJS({\n \"lib/scatterpolar.js\"(exports, module) {\n \"use strict\";\n module.exports = require_scatterpolar();\n }\n });\n\n // src/traces/scatterpolargl/attributes.js\n var require_attributes69 = __commonJS({\n \"src/traces/scatterpolargl/attributes.js\"(exports, module) {\n \"use strict\";\n var scatterPolarAttrs = require_attributes68();\n var scatterGlAttrs = require_attributes50();\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n module.exports = {\n mode: scatterPolarAttrs.mode,\n r: scatterPolarAttrs.r,\n theta: scatterPolarAttrs.theta,\n r0: scatterPolarAttrs.r0,\n dr: scatterPolarAttrs.dr,\n theta0: scatterPolarAttrs.theta0,\n dtheta: scatterPolarAttrs.dtheta,\n thetaunit: scatterPolarAttrs.thetaunit,\n text: scatterPolarAttrs.text,\n texttemplate: texttemplateAttrs({ editType: \"plot\" }, {\n keys: [\"r\", \"theta\", \"text\"]\n }),\n hovertext: scatterPolarAttrs.hovertext,\n hovertemplate: scatterPolarAttrs.hovertemplate,\n line: {\n color: scatterGlAttrs.line.color,\n width: scatterGlAttrs.line.width,\n dash: scatterGlAttrs.line.dash,\n editType: \"calc\"\n },\n connectgaps: scatterGlAttrs.connectgaps,\n marker: scatterGlAttrs.marker,\n // no cliponaxis\n fill: scatterGlAttrs.fill,\n fillcolor: scatterGlAttrs.fillcolor,\n textposition: scatterGlAttrs.textposition,\n textfont: scatterGlAttrs.textfont,\n hoverinfo: scatterPolarAttrs.hoverinfo,\n // no hoveron\n selected: scatterPolarAttrs.selected,\n unselected: scatterPolarAttrs.unselected\n };\n }\n });\n\n // src/traces/scatterpolargl/defaults.js\n var require_defaults65 = __commonJS({\n \"src/traces/scatterpolargl/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var subTypes = require_subtypes();\n var handleRThetaDefaults = require_defaults64().handleRThetaDefaults;\n var handleMarkerDefaults = require_marker_defaults();\n var handleLineDefaults = require_line_defaults();\n var handleTextDefaults = require_text_defaults();\n var handleFillColorDefaults = require_fillcolor_defaults();\n var PTS_LINESONLY = require_constants8().PTS_LINESONLY;\n var attributes = require_attributes69();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var len = handleRThetaDefaults(traceIn, traceOut, layout, coerce);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n coerce(\"thetaunit\");\n coerce(\"mode\", len < PTS_LINESONLY ? \"lines+markers\" : \"lines\");\n coerce(\"text\");\n coerce(\"hovertext\");\n if (traceOut.hoveron !== \"fills\") coerce(\"hovertemplate\");\n if (subTypes.hasMarkers(traceOut)) {\n handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, { noAngleRef: true, noStandOff: true });\n }\n if (subTypes.hasLines(traceOut)) {\n handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce);\n coerce(\"connectgaps\");\n }\n if (subTypes.hasText(traceOut)) {\n coerce(\"texttemplate\");\n handleTextDefaults(traceIn, traceOut, layout, coerce, {\n noFontShadow: true,\n noFontLineposition: true,\n noFontTextcase: true\n });\n }\n coerce(\"fill\");\n if (traceOut.fill !== \"none\") {\n handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce);\n }\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n };\n }\n });\n\n // src/traces/scatterpolargl/format_labels.js\n var require_format_labels9 = __commonJS({\n \"src/traces/scatterpolargl/format_labels.js\"(exports, module) {\n \"use strict\";\n var scatterPolarFormatLabels = require_format_labels8();\n module.exports = function formatLabels(cdi, trace, fullLayout) {\n var i = cdi.i;\n if (!(\"r\" in cdi)) cdi.r = trace._r[i];\n if (!(\"theta\" in cdi)) cdi.theta = trace._theta[i];\n return scatterPolarFormatLabels(cdi, trace, fullLayout);\n };\n }\n });\n\n // src/traces/scatterpolargl/calc.js\n var require_calc44 = __commonJS({\n \"src/traces/scatterpolargl/calc.js\"(exports, module) {\n \"use strict\";\n var calcColorscale = require_colorscale_calc();\n var calcMarkerSize = require_calc3().calcMarkerSize;\n var convert = require_convert10();\n var Axes = require_axes();\n var TOO_MANY_POINTS = require_constants23().TOO_MANY_POINTS;\n module.exports = function calc(gd, trace) {\n var fullLayout = gd._fullLayout;\n var subplotId = trace.subplot;\n var radialAxis = fullLayout[subplotId].radialaxis;\n var angularAxis = fullLayout[subplotId].angularaxis;\n var rArray = trace._r = radialAxis.makeCalcdata(trace, \"r\");\n var thetaArray = trace._theta = angularAxis.makeCalcdata(trace, \"theta\");\n var len = trace._length;\n var stash = {};\n if (len < rArray.length) rArray = rArray.slice(0, len);\n if (len < thetaArray.length) thetaArray = thetaArray.slice(0, len);\n stash.r = rArray;\n stash.theta = thetaArray;\n calcColorscale(gd, trace);\n var opts = stash.opts = convert.style(gd, trace);\n var ppad;\n if (len < TOO_MANY_POINTS) {\n ppad = calcMarkerSize(trace, len);\n } else if (opts.marker) {\n ppad = 2 * (opts.marker.sizeAvg || Math.max(opts.marker.size, 3));\n }\n trace._extremes.x = Axes.findExtremes(radialAxis, rArray, { ppad });\n return [{ x: false, y: false, t: stash, trace }];\n };\n }\n });\n\n // src/traces/scatterpolargl/hover.js\n var require_hover25 = __commonJS({\n \"src/traces/scatterpolargl/hover.js\"(exports, module) {\n \"use strict\";\n var hover = require_hover16();\n var makeHoverPointText = require_hover24().makeHoverPointText;\n function hoverPoints(pointData, xval, yval, hovermode) {\n var cd = pointData.cd;\n var stash = cd[0].t;\n var rArray = stash.r;\n var thetaArray = stash.theta;\n var scatterPointData = hover.hoverPoints(pointData, xval, yval, hovermode);\n if (!scatterPointData || scatterPointData[0].index === false) return;\n var newPointData = scatterPointData[0];\n if (newPointData.index === void 0) {\n return scatterPointData;\n }\n var subplot = pointData.subplot;\n var cdi = newPointData.cd[newPointData.index];\n var trace = newPointData.trace;\n cdi.r = rArray[newPointData.index];\n cdi.theta = thetaArray[newPointData.index];\n if (!subplot.isPtInside(cdi)) return;\n newPointData.xLabelVal = void 0;\n newPointData.yLabelVal = void 0;\n makeHoverPointText(cdi, trace, subplot, newPointData);\n return scatterPointData;\n }\n module.exports = {\n hoverPoints\n };\n }\n });\n\n // src/traces/scatterpolargl/base_index.js\n var require_base_index4 = __commonJS({\n \"src/traces/scatterpolargl/base_index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"trace\",\n name: \"scatterpolargl\",\n basePlotModule: require_polar2(),\n categories: [\"gl\", \"regl\", \"polar\", \"symbols\", \"showLegend\", \"scatter-like\"],\n attributes: require_attributes69(),\n supplyDefaults: require_defaults65(),\n colorbar: require_marker_colorbar(),\n formatLabels: require_format_labels9(),\n calc: require_calc44(),\n hoverPoints: require_hover25().hoverPoints,\n selectPoints: require_select7(),\n meta: {}\n };\n }\n });\n\n // src/traces/scatterpolargl/plot.js\n var require_plot37 = __commonJS({\n \"src/traces/scatterpolargl/plot.js\"(exports, module) {\n \"use strict\";\n var cluster = require_point_cluster();\n var isNumeric = require_fast_isnumeric();\n var scatterglPlot = require_plot19();\n var sceneUpdate = require_scene_update();\n var convert = require_convert10();\n var Lib = require_lib();\n var TOO_MANY_POINTS = require_constants23().TOO_MANY_POINTS;\n var reglPrecompiled = {};\n module.exports = function plot(gd, subplot, cdata) {\n if (!cdata.length) return;\n var radialAxis = subplot.radialAxis;\n var angularAxis = subplot.angularAxis;\n var scene = sceneUpdate(gd, subplot);\n cdata.forEach(function(cdscatter) {\n if (!cdscatter || !cdscatter[0] || !cdscatter[0].trace) return;\n var cd = cdscatter[0];\n var trace = cd.trace;\n var stash = cd.t;\n var len = trace._length;\n var rArray = stash.r;\n var thetaArray = stash.theta;\n var opts = stash.opts;\n var i;\n var subRArray = rArray.slice();\n var subThetaArray = thetaArray.slice();\n for (i = 0; i < rArray.length; i++) {\n if (!subplot.isPtInside({ r: rArray[i], theta: thetaArray[i] })) {\n subRArray[i] = NaN;\n subThetaArray[i] = NaN;\n }\n }\n var positions = new Array(len * 2);\n var x = Array(len);\n var y = Array(len);\n for (i = 0; i < len; i++) {\n var r = subRArray[i];\n var xx, yy;\n if (isNumeric(r)) {\n var rg = radialAxis.c2g(r);\n var thetag = angularAxis.c2g(subThetaArray[i], trace.thetaunit);\n xx = rg * Math.cos(thetag);\n yy = rg * Math.sin(thetag);\n } else {\n xx = yy = NaN;\n }\n x[i] = positions[i * 2] = xx;\n y[i] = positions[i * 2 + 1] = yy;\n }\n stash.tree = cluster(positions);\n if (opts.marker && len >= TOO_MANY_POINTS) {\n opts.marker.cluster = stash.tree;\n }\n if (opts.marker) {\n opts.markerSel.positions = opts.markerUnsel.positions = opts.marker.positions = positions;\n }\n if (opts.line && positions.length > 1) {\n Lib.extendFlat(\n opts.line,\n convert.linePositions(gd, trace, positions)\n );\n }\n if (opts.text) {\n Lib.extendFlat(\n opts.text,\n { positions },\n convert.textPosition(gd, trace, opts.text, opts.marker)\n );\n Lib.extendFlat(\n opts.textSel,\n { positions },\n convert.textPosition(gd, trace, opts.text, opts.markerSel)\n );\n Lib.extendFlat(\n opts.textUnsel,\n { positions },\n convert.textPosition(gd, trace, opts.text, opts.markerUnsel)\n );\n }\n if (opts.fill && !scene.fill2d) scene.fill2d = true;\n if (opts.marker && !scene.scatter2d) scene.scatter2d = true;\n if (opts.line && !scene.line2d) scene.line2d = true;\n if (opts.text && !scene.glText) scene.glText = true;\n scene.lineOptions.push(opts.line);\n scene.fillOptions.push(opts.fill);\n scene.markerOptions.push(opts.marker);\n scene.markerSelectedOptions.push(opts.markerSel);\n scene.markerUnselectedOptions.push(opts.markerUnsel);\n scene.textOptions.push(opts.text);\n scene.textSelectedOptions.push(opts.textSel);\n scene.textUnselectedOptions.push(opts.textUnsel);\n scene.selectBatch.push([]);\n scene.unselectBatch.push([]);\n stash.x = x;\n stash.y = y;\n stash.rawx = x;\n stash.rawy = y;\n stash.r = rArray;\n stash.theta = thetaArray;\n stash.positions = positions;\n stash._scene = scene;\n stash.index = scene.count;\n scene.count++;\n });\n return scatterglPlot(gd, subplot, cdata);\n };\n module.exports.reglPrecompiled = reglPrecompiled;\n }\n });\n\n // src/traces/scatterpolargl/index.js\n var require_scatterpolargl = __commonJS({\n \"src/traces/scatterpolargl/index.js\"(exports, module) {\n \"use strict\";\n var index = require_base_index4();\n index.plot = require_plot37();\n module.exports = index;\n }\n });\n\n // lib/scatterpolargl.js\n var require_scatterpolargl2 = __commonJS({\n \"lib/scatterpolargl.js\"(exports, module) {\n \"use strict\";\n module.exports = require_scatterpolargl();\n }\n });\n\n // src/traces/barpolar/attributes.js\n var require_attributes70 = __commonJS({\n \"src/traces/barpolar/attributes.js\"(exports, module) {\n \"use strict\";\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var extendFlat = require_extend().extendFlat;\n var scatterPolarAttrs = require_attributes68();\n var barAttrs = require_attributes23();\n module.exports = {\n r: scatterPolarAttrs.r,\n theta: scatterPolarAttrs.theta,\n r0: scatterPolarAttrs.r0,\n dr: scatterPolarAttrs.dr,\n theta0: scatterPolarAttrs.theta0,\n dtheta: scatterPolarAttrs.dtheta,\n thetaunit: scatterPolarAttrs.thetaunit,\n // orientation: {\n // valType: 'enumerated',\n // values: ['radial', 'angular'],\n // editType: 'calc+clearAxisTypes',\n //\n // },\n base: extendFlat({}, barAttrs.base, {}),\n offset: extendFlat({}, barAttrs.offset, {}),\n width: extendFlat({}, barAttrs.width, {}),\n text: extendFlat({}, barAttrs.text, {}),\n hovertext: extendFlat({}, barAttrs.hovertext, {}),\n // textposition: {},\n // textfont: {},\n // insidetextfont: {},\n // outsidetextfont: {},\n // constraintext: {},\n // cliponaxis: extendFlat({}, barAttrs.cliponaxis, {dflt: false}),\n marker: barPolarMarker(),\n hoverinfo: scatterPolarAttrs.hoverinfo,\n hovertemplate: hovertemplateAttrs(),\n selected: barAttrs.selected,\n unselected: barAttrs.unselected\n // error_x (error_r, error_theta)\n // error_y\n };\n function barPolarMarker() {\n var marker = extendFlat({}, barAttrs.marker);\n delete marker.cornerradius;\n return marker;\n }\n }\n });\n\n // src/traces/barpolar/layout_attributes.js\n var require_layout_attributes22 = __commonJS({\n \"src/traces/barpolar/layout_attributes.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n barmode: {\n valType: \"enumerated\",\n values: [\"stack\", \"overlay\"],\n dflt: \"stack\",\n editType: \"calc\"\n },\n bargap: {\n valType: \"number\",\n dflt: 0.1,\n min: 0,\n max: 1,\n editType: \"calc\"\n }\n };\n }\n });\n\n // src/traces/barpolar/defaults.js\n var require_defaults66 = __commonJS({\n \"src/traces/barpolar/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var handleRThetaDefaults = require_defaults64().handleRThetaDefaults;\n var handleStyleDefaults = require_style_defaults();\n var attributes = require_attributes70();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var len = handleRThetaDefaults(traceIn, traceOut, layout, coerce);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n coerce(\"thetaunit\");\n coerce(\"base\");\n coerce(\"offset\");\n coerce(\"width\");\n coerce(\"text\");\n coerce(\"hovertext\");\n coerce(\"hovertemplate\");\n handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout);\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n };\n }\n });\n\n // src/traces/barpolar/layout_defaults.js\n var require_layout_defaults20 = __commonJS({\n \"src/traces/barpolar/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var attrs = require_layout_attributes22();\n module.exports = function(layoutIn, layoutOut, fullData) {\n var subplotsDone = {};\n var sp;\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn[sp] || {}, layoutOut[sp], attrs, attr, dflt);\n }\n for (var i = 0; i < fullData.length; i++) {\n var trace = fullData[i];\n if (trace.type === \"barpolar\" && trace.visible === true) {\n sp = trace.subplot;\n if (!subplotsDone[sp]) {\n coerce(\"barmode\");\n coerce(\"bargap\");\n subplotsDone[sp] = 1;\n }\n }\n }\n };\n }\n });\n\n // src/traces/barpolar/calc.js\n var require_calc45 = __commonJS({\n \"src/traces/barpolar/calc.js\"(exports, module) {\n \"use strict\";\n var hasColorscale = require_helpers().hasColorscale;\n var colorscaleCalc = require_calc();\n var isArrayOrTypedArray = require_lib().isArrayOrTypedArray;\n var arraysToCalcdata = require_arrays_to_calcdata2();\n var setGroupPositions = require_cross_trace_calc().setGroupPositions;\n var calcSelection = require_calc_selection();\n var traceIs = require_registry().traceIs;\n var extendFlat = require_lib().extendFlat;\n function calc(gd, trace) {\n var fullLayout = gd._fullLayout;\n var subplotId = trace.subplot;\n var radialAxis = fullLayout[subplotId].radialaxis;\n var angularAxis = fullLayout[subplotId].angularaxis;\n var rArray = radialAxis.makeCalcdata(trace, \"r\");\n var thetaArray = angularAxis.makeCalcdata(trace, \"theta\");\n var len = trace._length;\n var cd = new Array(len);\n var sArray = rArray;\n var pArray = thetaArray;\n for (var i = 0; i < len; i++) {\n cd[i] = { p: pArray[i], s: sArray[i] };\n }\n function d2c(attr) {\n var val = trace[attr];\n if (val !== void 0) {\n trace[\"_\" + attr] = isArrayOrTypedArray(val) ? angularAxis.makeCalcdata(trace, attr) : angularAxis.d2c(val, trace.thetaunit);\n }\n }\n if (angularAxis.type === \"linear\") {\n d2c(\"width\");\n d2c(\"offset\");\n }\n if (hasColorscale(trace, \"marker\")) {\n colorscaleCalc(gd, trace, {\n vals: trace.marker.color,\n containerStr: \"marker\",\n cLetter: \"c\"\n });\n }\n if (hasColorscale(trace, \"marker.line\")) {\n colorscaleCalc(gd, trace, {\n vals: trace.marker.line.color,\n containerStr: \"marker.line\",\n cLetter: \"c\"\n });\n }\n arraysToCalcdata(cd, trace);\n calcSelection(cd, trace);\n return cd;\n }\n function crossTraceCalc(gd, polarLayout, subplotId) {\n var calcdata = gd.calcdata;\n var barPolarCd = [];\n for (var i = 0; i < calcdata.length; i++) {\n var cdi = calcdata[i];\n var trace = cdi[0].trace;\n if (trace.visible === true && traceIs(trace, \"bar\") && trace.subplot === subplotId) {\n barPolarCd.push(cdi);\n }\n }\n var rAxis = extendFlat({}, polarLayout.radialaxis, { _id: \"x\" });\n var aAxis = polarLayout.angularaxis;\n setGroupPositions(gd, aAxis, rAxis, barPolarCd, {\n mode: polarLayout.barmode,\n norm: polarLayout.barnorm,\n gap: polarLayout.bargap,\n groupgap: polarLayout.bargroupgap\n });\n }\n module.exports = {\n calc,\n crossTraceCalc\n };\n }\n });\n\n // src/traces/barpolar/plot.js\n var require_plot38 = __commonJS({\n \"src/traces/barpolar/plot.js\"(exports, module) {\n \"use strict\";\n var d3 = require_d3();\n var isNumeric = require_fast_isnumeric();\n var Lib = require_lib();\n var Drawing = require_drawing();\n var helpers = require_helpers19();\n module.exports = function plot(gd, subplot, cdbar) {\n var isStatic = gd._context.staticPlot;\n var xa = subplot.xaxis;\n var ya = subplot.yaxis;\n var radialAxis = subplot.radialAxis;\n var angularAxis = subplot.angularAxis;\n var pathFn = makePathFn(subplot);\n var barLayer = subplot.layers.frontplot.select(\"g.barlayer\");\n Lib.makeTraceGroups(barLayer, cdbar, \"trace bars\").each(function() {\n var plotGroup = d3.select(this);\n var pointGroup = Lib.ensureSingle(plotGroup, \"g\", \"points\");\n var bars = pointGroup.selectAll(\"g.point\").data(Lib.identity);\n bars.enter().append(\"g\").style(\"vector-effect\", isStatic ? \"none\" : \"non-scaling-stroke\").style(\"stroke-miterlimit\", 2).classed(\"point\", true);\n bars.exit().remove();\n bars.each(function(di) {\n var bar = d3.select(this);\n var rp0 = di.rp0 = radialAxis.c2p(di.s0);\n var rp1 = di.rp1 = radialAxis.c2p(di.s1);\n var thetag0 = di.thetag0 = angularAxis.c2g(di.p0);\n var thetag1 = di.thetag1 = angularAxis.c2g(di.p1);\n var dPath;\n if (!isNumeric(rp0) || !isNumeric(rp1) || !isNumeric(thetag0) || !isNumeric(thetag1) || rp0 === rp1 || thetag0 === thetag1) {\n dPath = \"M0,0Z\";\n } else {\n var rg1 = radialAxis.c2g(di.s1);\n var thetagMid = (thetag0 + thetag1) / 2;\n di.ct = [\n xa.c2p(rg1 * Math.cos(thetagMid)),\n ya.c2p(rg1 * Math.sin(thetagMid))\n ];\n dPath = pathFn(rp0, rp1, thetag0, thetag1);\n }\n Lib.ensureSingle(bar, \"path\").attr(\"d\", dPath);\n });\n Drawing.setClipUrl(\n plotGroup,\n subplot._hasClipOnAxisFalse ? subplot.clipIds.forTraces : null,\n gd\n );\n });\n };\n function makePathFn(subplot) {\n var cxx = subplot.cxx;\n var cyy = subplot.cyy;\n if (subplot.vangles) {\n return function(r0, r1, _a0, _a1) {\n var a0, a1;\n if (Lib.angleDelta(_a0, _a1) > 0) {\n a0 = _a0;\n a1 = _a1;\n } else {\n a0 = _a1;\n a1 = _a0;\n }\n var va0 = helpers.findEnclosingVertexAngles(a0, subplot.vangles)[0];\n var va1 = helpers.findEnclosingVertexAngles(a1, subplot.vangles)[1];\n var vaBar = [va0, (a0 + a1) / 2, va1];\n return helpers.pathPolygonAnnulus(r0, r1, a0, a1, vaBar, cxx, cyy);\n };\n }\n return function(r0, r1, a0, a1) {\n return Lib.pathAnnulus(r0, r1, a0, a1, cxx, cyy);\n };\n }\n }\n });\n\n // src/traces/barpolar/hover.js\n var require_hover26 = __commonJS({\n \"src/traces/barpolar/hover.js\"(exports, module) {\n \"use strict\";\n var Fx = require_fx();\n var Lib = require_lib();\n var getTraceColor = require_hover3().getTraceColor;\n var fillText = Lib.fillText;\n var makeHoverPointText = require_hover24().makeHoverPointText;\n var isPtInsidePolygon = require_helpers19().isPtInsidePolygon;\n module.exports = function hoverPoints(pointData, xval, yval) {\n var cd = pointData.cd;\n var trace = cd[0].trace;\n var subplot = pointData.subplot;\n var radialAxis = subplot.radialAxis;\n var angularAxis = subplot.angularAxis;\n var vangles = subplot.vangles;\n var inboxFn = vangles ? isPtInsidePolygon : Lib.isPtInsideSector;\n var maxHoverDistance = pointData.maxHoverDistance;\n var period = angularAxis._period || 2 * Math.PI;\n var rVal = Math.abs(radialAxis.g2p(Math.sqrt(xval * xval + yval * yval)));\n var thetaVal = Math.atan2(yval, xval);\n if (radialAxis.range[0] > radialAxis.range[1]) {\n thetaVal += Math.PI;\n }\n var distFn = function(di) {\n if (inboxFn(rVal, thetaVal, [di.rp0, di.rp1], [di.thetag0, di.thetag1], vangles)) {\n return maxHoverDistance + // add a little to the pseudo-distance for wider bars, so that like scatter,\n // if you are over two overlapping bars, the narrower one wins.\n Math.min(1, Math.abs(di.thetag1 - di.thetag0) / period) - 1 + // add a gradient so hovering near the end of a\n // bar makes it a little closer match\n (di.rp1 - rVal) / (di.rp1 - di.rp0) - 1;\n } else {\n return Infinity;\n }\n };\n Fx.getClosest(cd, distFn, pointData);\n if (pointData.index === false) return;\n var index = pointData.index;\n var cdi = cd[index];\n pointData.x0 = pointData.x1 = cdi.ct[0];\n pointData.y0 = pointData.y1 = cdi.ct[1];\n var _cdi = Lib.extendFlat({}, cdi, { r: cdi.s, theta: cdi.p });\n fillText(cdi, trace, pointData);\n makeHoverPointText(_cdi, trace, subplot, pointData);\n pointData.hovertemplate = trace.hovertemplate;\n pointData.color = getTraceColor(trace, cdi);\n pointData.xLabelVal = pointData.yLabelVal = void 0;\n if (cdi.s < 0) {\n pointData.idealAlign = \"left\";\n }\n return [pointData];\n };\n }\n });\n\n // src/traces/barpolar/index.js\n var require_barpolar = __commonJS({\n \"src/traces/barpolar/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"trace\",\n name: \"barpolar\",\n basePlotModule: require_polar2(),\n categories: [\"polar\", \"bar\", \"showLegend\"],\n attributes: require_attributes70(),\n layoutAttributes: require_layout_attributes22(),\n supplyDefaults: require_defaults66(),\n supplyLayoutDefaults: require_layout_defaults20(),\n calc: require_calc45().calc,\n crossTraceCalc: require_calc45().crossTraceCalc,\n plot: require_plot38(),\n colorbar: require_marker_colorbar(),\n formatLabels: require_format_labels8(),\n style: require_style4().style,\n styleOnSelect: require_style4().styleOnSelect,\n hoverPoints: require_hover26(),\n selectPoints: require_select3(),\n meta: {}\n };\n }\n });\n\n // lib/barpolar.js\n var require_barpolar2 = __commonJS({\n \"lib/barpolar.js\"(exports, module) {\n \"use strict\";\n module.exports = require_barpolar();\n }\n });\n\n // src/plots/smith/constants.js\n var require_constants34 = __commonJS({\n \"src/plots/smith/constants.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n attr: \"subplot\",\n name: \"smith\",\n axisNames: [\n \"realaxis\",\n \"imaginaryaxis\"\n // imaginary axis should be second here so that the `tickvals` defaults could be inherited from realaxis\n ],\n axisName2dataArray: { imaginaryaxis: \"imag\", realaxis: \"real\" }\n };\n }\n });\n\n // src/plots/smith/layout_attributes.js\n var require_layout_attributes23 = __commonJS({\n \"src/plots/smith/layout_attributes.js\"(exports, module) {\n \"use strict\";\n var colorAttrs = require_attributes3();\n var axesAttrs = require_layout_attributes4();\n var domainAttrs = require_domain().attributes;\n var extendFlat = require_lib().extendFlat;\n var overrideAll = require_edit_types().overrideAll;\n var axisLineGridAttr = overrideAll({\n color: axesAttrs.color,\n showline: extendFlat({}, axesAttrs.showline, { dflt: true }),\n linecolor: axesAttrs.linecolor,\n linewidth: axesAttrs.linewidth,\n showgrid: extendFlat({}, axesAttrs.showgrid, { dflt: true }),\n gridcolor: axesAttrs.gridcolor,\n gridwidth: axesAttrs.gridwidth,\n griddash: axesAttrs.griddash\n }, \"plot\", \"from-root\");\n var axisTickAttrs = overrideAll({\n ticklen: axesAttrs.ticklen,\n tickwidth: extendFlat({}, axesAttrs.tickwidth, { dflt: 2 }),\n tickcolor: axesAttrs.tickcolor,\n showticklabels: axesAttrs.showticklabels,\n labelalias: axesAttrs.labelalias,\n showtickprefix: axesAttrs.showtickprefix,\n tickprefix: axesAttrs.tickprefix,\n showticksuffix: axesAttrs.showticksuffix,\n ticksuffix: axesAttrs.ticksuffix,\n tickfont: axesAttrs.tickfont,\n tickformat: axesAttrs.tickformat,\n hoverformat: axesAttrs.hoverformat,\n layer: axesAttrs.layer\n }, \"plot\", \"from-root\");\n var realAxisAttrs = extendFlat({\n visible: extendFlat({}, axesAttrs.visible, { dflt: true }),\n tickvals: {\n dflt: [0.2, 0.5, 1, 2, 5],\n valType: \"data_array\",\n editType: \"plot\"\n },\n tickangle: extendFlat({}, axesAttrs.tickangle, { dflt: 90 }),\n ticks: {\n valType: \"enumerated\",\n values: [\"top\", \"bottom\", \"\"],\n editType: \"ticks\"\n },\n side: {\n valType: \"enumerated\",\n values: [\"top\", \"bottom\"],\n dflt: \"top\",\n editType: \"plot\"\n },\n editType: \"calc\"\n }, axisLineGridAttr, axisTickAttrs);\n var imaginaryAxisAttrs = extendFlat({\n visible: extendFlat({}, axesAttrs.visible, { dflt: true }),\n tickvals: {\n valType: \"data_array\",\n editType: \"plot\"\n },\n ticks: axesAttrs.ticks,\n editType: \"calc\"\n }, axisLineGridAttr, axisTickAttrs);\n module.exports = {\n domain: domainAttrs({ name: \"smith\", editType: \"plot\" }),\n bgcolor: {\n valType: \"color\",\n editType: \"plot\",\n dflt: colorAttrs.background\n },\n realaxis: realAxisAttrs,\n imaginaryaxis: imaginaryAxisAttrs,\n editType: \"calc\"\n };\n }\n });\n\n // src/plots/smith/layout_defaults.js\n var require_layout_defaults21 = __commonJS({\n \"src/plots/smith/layout_defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var Color2 = require_color();\n var Template = require_plot_template();\n var handleSubplotDefaults = require_subplot_defaults();\n var getSubplotData = require_get_data().getSubplotData;\n var handlePrefixSuffixDefaults = require_prefix_suffix_defaults();\n var handleTickLabelDefaults = require_tick_label_defaults();\n var handleLineGridDefaults = require_line_grid_defaults();\n var setConvertCartesian = require_set_convert();\n var layoutAttributes = require_layout_attributes23();\n var constants = require_constants34();\n var axisNames = constants.axisNames;\n var makeImagDflt = memoize(function(realTickvals) {\n if (Lib.isTypedArray(realTickvals)) realTickvals = Array.from(realTickvals);\n return realTickvals.slice().reverse().map(function(x) {\n return -x;\n }).concat([0]).concat(realTickvals);\n }, String);\n function handleDefaults(contIn, contOut, coerce, opts) {\n var bgColor = coerce(\"bgcolor\");\n opts.bgColor = Color2.combine(bgColor, opts.paper_bgcolor);\n var subplotData = getSubplotData(opts.fullData, constants.name, opts.id);\n var layoutOut = opts.layoutOut;\n var axName;\n function coerceAxis(attr, dflt) {\n return coerce(axName + \".\" + attr, dflt);\n }\n for (var i = 0; i < axisNames.length; i++) {\n axName = axisNames[i];\n if (!Lib.isPlainObject(contIn[axName])) {\n contIn[axName] = {};\n }\n var axIn = contIn[axName];\n var axOut = Template.newContainer(contOut, axName);\n axOut._id = axOut._name = axName;\n axOut._attr = opts.id + \".\" + axName;\n axOut._traceIndices = subplotData.map(function(t) {\n return t.index;\n });\n var visible = coerceAxis(\"visible\");\n axOut.type = \"linear\";\n setConvertCartesian(axOut, layoutOut);\n handlePrefixSuffixDefaults(axIn, axOut, coerceAxis, axOut.type);\n if (visible) {\n var isRealAxis = axName === \"realaxis\";\n if (isRealAxis) coerceAxis(\"side\");\n if (isRealAxis) {\n coerceAxis(\"tickvals\");\n } else {\n var imagTickvalsDflt = makeImagDflt(\n contOut.realaxis.tickvals || layoutAttributes.realaxis.tickvals.dflt\n );\n coerceAxis(\"tickvals\", imagTickvalsDflt);\n }\n if (Lib.isTypedArray(axOut.tickvals)) axOut.tickvals = Array.from(axOut.tickvals);\n var dfltColor;\n var dfltFontColor;\n var dfltFontSize;\n var dfltFontFamily;\n var font = opts.font || {};\n if (visible) {\n dfltColor = coerceAxis(\"color\");\n dfltFontColor = dfltColor === axIn.color ? dfltColor : font.color;\n dfltFontSize = font.size;\n dfltFontFamily = font.family;\n }\n handleTickLabelDefaults(axIn, axOut, coerceAxis, axOut.type, {\n noAutotickangles: true,\n noTicklabelshift: true,\n noTicklabelstandoff: true,\n noTicklabelstep: true,\n noAng: !isRealAxis,\n noExp: true,\n font: {\n color: dfltFontColor,\n size: dfltFontSize,\n family: dfltFontFamily\n }\n });\n Lib.coerce2(contIn, contOut, layoutAttributes, axName + \".ticklen\");\n Lib.coerce2(contIn, contOut, layoutAttributes, axName + \".tickwidth\");\n Lib.coerce2(contIn, contOut, layoutAttributes, axName + \".tickcolor\", contOut.color);\n var showTicks = coerceAxis(\"ticks\");\n if (!showTicks) {\n delete contOut[axName].ticklen;\n delete contOut[axName].tickwidth;\n delete contOut[axName].tickcolor;\n }\n handleLineGridDefaults(axIn, axOut, coerceAxis, {\n dfltColor,\n bgColor: opts.bgColor,\n // default grid color is darker here (60%, vs cartesian default ~91%)\n // because the grid is not square so the eye needs heavier cues to follow\n blend: 60,\n showLine: true,\n showGrid: true,\n noZeroLine: true,\n attributes: layoutAttributes[axName]\n });\n coerceAxis(\"layer\");\n }\n coerceAxis(\"hoverformat\");\n delete axOut.type;\n axOut._input = axIn;\n }\n }\n module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {\n handleSubplotDefaults(layoutIn, layoutOut, fullData, {\n noUirevision: true,\n type: constants.name,\n attributes: layoutAttributes,\n handleDefaults,\n font: layoutOut.font,\n paper_bgcolor: layoutOut.paper_bgcolor,\n fullData,\n layoutOut\n });\n };\n function memoize(fn, keyFn) {\n var cache = {};\n return function(val) {\n var newKey = keyFn ? keyFn(val) : val;\n if (newKey in cache) {\n return cache[newKey];\n }\n var out = fn(val);\n cache[newKey] = out;\n return out;\n };\n }\n }\n });\n\n // src/plots/smith/index.js\n var require_smith = __commonJS({\n \"src/plots/smith/index.js\"(exports, module) {\n \"use strict\";\n var getSubplotCalcData = require_get_data().getSubplotCalcData;\n var counterRegex = require_lib().counterRegex;\n var createPolar = require_polar();\n var constants = require_constants34();\n var attr = constants.attr;\n var name2 = constants.name;\n var counter = counterRegex(name2);\n var attributes = {};\n attributes[attr] = {\n valType: \"subplotid\",\n dflt: name2,\n editType: \"calc\"\n };\n function plot(gd) {\n var fullLayout = gd._fullLayout;\n var calcData = gd.calcdata;\n var subplotIds = fullLayout._subplots[name2];\n for (var i = 0; i < subplotIds.length; i++) {\n var id = subplotIds[i];\n var subplotCalcData = getSubplotCalcData(calcData, name2, id);\n var subplot = fullLayout[id]._subplot;\n if (!subplot) {\n subplot = createPolar(gd, id, true);\n fullLayout[id]._subplot = subplot;\n }\n subplot.plot(subplotCalcData, fullLayout, gd._promises);\n }\n }\n function clean(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var oldIds = oldFullLayout._subplots[name2] || [];\n for (var i = 0; i < oldIds.length; i++) {\n var id = oldIds[i];\n var oldSubplot = oldFullLayout[id]._subplot;\n if (!newFullLayout[id] && !!oldSubplot) {\n oldSubplot.framework.remove();\n for (var k in oldSubplot.clipPaths) {\n oldSubplot.clipPaths[k].remove();\n }\n }\n }\n }\n module.exports = {\n attr,\n name: name2,\n idRoot: name2,\n idRegex: counter,\n attrRegex: counter,\n attributes,\n layoutAttributes: require_layout_attributes23(),\n supplyLayoutDefaults: require_layout_defaults21(),\n plot,\n clean,\n toSVG: require_cartesian().toSVG\n };\n }\n });\n\n // src/traces/scattersmith/attributes.js\n var require_attributes71 = __commonJS({\n \"src/traces/scattersmith/attributes.js\"(exports, module) {\n \"use strict\";\n var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs;\n var texttemplateAttrs = require_template_attributes().texttemplateAttrs;\n var extendFlat = require_extend().extendFlat;\n var makeFillcolorAttr = require_fillcolor_attribute();\n var scatterAttrs = require_attributes12();\n var baseAttrs = require_attributes2();\n var lineAttrs = scatterAttrs.line;\n module.exports = {\n mode: scatterAttrs.mode,\n real: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n imag: {\n valType: \"data_array\",\n editType: \"calc+clearAxisTypes\"\n },\n text: scatterAttrs.text,\n texttemplate: texttemplateAttrs({ editType: \"plot\" }, {\n keys: [\"real\", \"imag\", \"text\"]\n }),\n hovertext: scatterAttrs.hovertext,\n line: {\n color: lineAttrs.color,\n width: lineAttrs.width,\n dash: lineAttrs.dash,\n backoff: lineAttrs.backoff,\n shape: extendFlat({}, lineAttrs.shape, {\n values: [\"linear\", \"spline\"]\n }),\n smoothing: lineAttrs.smoothing,\n editType: \"calc\"\n },\n connectgaps: scatterAttrs.connectgaps,\n marker: scatterAttrs.marker,\n cliponaxis: extendFlat({}, scatterAttrs.cliponaxis, { dflt: false }),\n textposition: scatterAttrs.textposition,\n textfont: scatterAttrs.textfont,\n fill: extendFlat({}, scatterAttrs.fill, {\n values: [\"none\", \"toself\", \"tonext\"],\n dflt: \"none\"\n }),\n fillcolor: makeFillcolorAttr(),\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: [\"real\", \"imag\", \"text\", \"name\"]\n }),\n hoveron: scatterAttrs.hoveron,\n hovertemplate: hovertemplateAttrs(),\n selected: scatterAttrs.selected,\n unselected: scatterAttrs.unselected\n };\n }\n });\n\n // src/traces/scattersmith/defaults.js\n var require_defaults67 = __commonJS({\n \"src/traces/scattersmith/defaults.js\"(exports, module) {\n \"use strict\";\n var Lib = require_lib();\n var subTypes = require_subtypes();\n var handleMarkerDefaults = require_marker_defaults();\n var handleLineDefaults = require_line_defaults();\n var handleLineShapeDefaults = require_line_shape_defaults();\n var handleTextDefaults = require_text_defaults();\n var handleFillColorDefaults = require_fillcolor_defaults();\n var PTS_LINESONLY = require_constants8().PTS_LINESONLY;\n var attributes = require_attributes71();\n module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n var len = handleRealImagDefaults(traceIn, traceOut, layout, coerce);\n if (!len) {\n traceOut.visible = false;\n return;\n }\n coerce(\"mode\", len < PTS_LINESONLY ? \"lines+markers\" : \"lines\");\n coerce(\"text\");\n coerce(\"hovertext\");\n if (traceOut.hoveron !== \"fills\") coerce(\"hovertemplate\");\n if (subTypes.hasMarkers(traceOut)) {\n handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, { gradient: true });\n }\n if (subTypes.hasLines(traceOut)) {\n handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce, { backoff: true });\n handleLineShapeDefaults(traceIn, traceOut, coerce);\n coerce(\"connectgaps\");\n }\n if (subTypes.hasText(traceOut)) {\n coerce(\"texttemplate\");\n handleTextDefaults(traceIn, traceOut, layout, coerce);\n }\n var dfltHoverOn = [];\n if (subTypes.hasMarkers(traceOut) || subTypes.hasText(traceOut)) {\n coerce(\"cliponaxis\");\n coerce(\"marker.maxdisplayed\");\n dfltHoverOn.push(\"points\");\n }\n coerce(\"fill\");\n if (traceOut.fill !== \"none\") {\n handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce);\n if (!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce);\n }\n if (traceOut.fill === \"tonext\" || traceOut.fill === \"toself\") {\n dfltHoverOn.push(\"fills\");\n }\n coerce(\"hoveron\", dfltHoverOn.join(\"+\") || \"points\");\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n };\n function handleRealImagDefaults(traceIn, traceOut, layout, coerce) {\n var real = coerce(\"real\");\n var imag = coerce(\"imag\");\n var len;\n if (real && imag) {\n len = Math.min(real.length, imag.length);\n }\n if (Lib.isTypedArray(real)) {\n traceOut.real = real = Array.from(real);\n }\n if (Lib.isTypedArray(imag)) {\n traceOut.imag = imag = Array.from(imag);\n }\n traceOut._length = len;\n return len;\n }\n }\n });\n\n // src/traces/scattersmith/format_labels.js\n var require_format_labels10 = __commonJS({\n \"src/traces/scattersmith/format_labels.js\"(exports, module) {\n \"use strict\";\n var Axes = require_axes();\n module.exports = function formatLabels(cdi, trace, fullLayout) {\n var labels = {};\n var subplot = fullLayout[trace.subplot]._subplot;\n labels.realLabel = Axes.tickText(subplot.radialAxis, cdi.real, true).text;\n labels.imagLabel = Axes.tickText(subplot.angularAxis, cdi.imag, true).text;\n return labels;\n };\n }\n });\n\n // src/traces/scattersmith/calc.js\n var require_calc46 = __commonJS({\n \"src/traces/scattersmith/calc.js\"(exports, module) {\n \"use strict\";\n var isNumeric = require_fast_isnumeric();\n var BADNUM = require_numerical().BADNUM;\n var calcColorscale = require_colorscale_calc();\n var arraysToCalcdata = require_arrays_to_calcdata();\n var calcSelection = require_calc_selection();\n var calcMarkerSize = require_calc3().calcMarkerSize;\n module.exports = function calc(gd, trace) {\n var fullLayout = gd._fullLayout;\n var subplotId = trace.subplot;\n var realAxis = fullLayout[subplotId].realaxis;\n var imaginaryAxis = fullLayout[subplotId].imaginaryaxis;\n var realArray = realAxis.makeCalcdata(trace, \"real\");\n var imagArray = imaginaryAxis.makeCalcdata(trace, \"imag\");\n var len = trace._length;\n var cd = new Array(len);\n for (var i = 0; i < len; i++) {\n var real = realArray[i];\n var imag = imagArray[i];\n var cdi = cd[i] = {};\n if (isNumeric(real) && isNumeric(imag)) {\n cdi.real = real;\n cdi.imag = imag;\n } else {\n cdi.real = BADNUM;\n }\n }\n calcMarkerSize(trace, len);\n calcColorscale(gd, trace);\n arraysToCalcdata(cd, trace);\n calcSelection(cd, trace);\n return cd;\n };\n }\n });\n\n // src/traces/scattersmith/plot.js\n var require_plot39 = __commonJS({\n \"src/traces/scattersmith/plot.js\"(exports, module) {\n \"use strict\";\n var scatterPlot = require_plot();\n var BADNUM = require_numerical().BADNUM;\n var helpers = require_helpers20();\n var smith = helpers.smith;\n module.exports = function plot(gd, subplot, moduleCalcData) {\n var mlayer = subplot.layers.frontplot.select(\"g.scatterlayer\");\n var xa = subplot.xaxis;\n var ya = subplot.yaxis;\n var plotinfo = {\n xaxis: xa,\n yaxis: ya,\n plot: subplot.framework,\n layerClipId: subplot._hasClipOnAxisFalse ? subplot.clipIds.forTraces : null\n };\n for (var i = 0; i < moduleCalcData.length; i++) {\n var cdi = moduleCalcData[i];\n for (var j = 0; j < cdi.length; j++) {\n if (j === 0) {\n cdi[0].trace._xA = xa;\n cdi[0].trace._yA = ya;\n }\n var cd = cdi[j];\n var real = cd.real;\n if (real === BADNUM) {\n cd.x = cd.y = BADNUM;\n } else {\n var t = smith([real, cd.imag]);\n cd.x = t[0];\n cd.y = t[1];\n }\n }\n }\n scatterPlot(gd, plotinfo, moduleCalcData, mlayer);\n };\n }\n });\n\n // src/traces/scattersmith/hover.js\n var require_hover27 = __commonJS({\n \"src/traces/scattersmith/hover.js\"(exports, module) {\n \"use strict\";\n var scatterHover = require_hover2();\n function hoverPoints(pointData, xval, yval, hovermode) {\n var scatterPointData = scatterHover(pointData, xval, yval, hovermode);\n if (!scatterPointData || scatterPointData[0].index === false) return;\n var newPointData = scatterPointData[0];\n if (newPointData.index === void 0) {\n return scatterPointData;\n }\n var subplot = pointData.subplot;\n var cdi = newPointData.cd[newPointData.index];\n var trace = newPointData.trace;\n if (!subplot.isPtInside(cdi)) return;\n newPointData.xLabelVal = void 0;\n newPointData.yLabelVal = void 0;\n makeHoverPointText(cdi, trace, subplot, newPointData);\n newPointData.hovertemplate = trace.hovertemplate;\n return scatterPointData;\n }\n function makeHoverPointText(cdi, trace, subplot, pointData) {\n var realAxis = subplot.radialAxis;\n var imaginaryAxis = subplot.angularAxis;\n realAxis._hovertitle = \"real\";\n imaginaryAxis._hovertitle = \"imag\";\n var fullLayout = {};\n fullLayout[trace.subplot] = { _subplot: subplot };\n var labels = trace._module.formatLabels(cdi, trace, fullLayout);\n pointData.realLabel = labels.realLabel;\n pointData.imagLabel = labels.imagLabel;\n var hoverinfo = cdi.hi || trace.hoverinfo;\n var text = [];\n function textPart(ax, val) {\n text.push(ax._hovertitle + \": \" + val);\n }\n if (!trace.hovertemplate) {\n var parts = hoverinfo.split(\"+\");\n if (parts.indexOf(\"all\") !== -1) parts = [\"real\", \"imag\", \"text\"];\n if (parts.indexOf(\"real\") !== -1) textPart(realAxis, pointData.realLabel);\n if (parts.indexOf(\"imag\") !== -1) textPart(imaginaryAxis, pointData.imagLabel);\n if (parts.indexOf(\"text\") !== -1 && pointData.text) {\n text.push(pointData.text);\n delete pointData.text;\n }\n pointData.extraText = text.join(\"
    \");\n }\n }\n module.exports = {\n hoverPoints,\n makeHoverPointText\n };\n }\n });\n\n // src/traces/scattersmith/index.js\n var require_scattersmith = __commonJS({\n \"src/traces/scattersmith/index.js\"(exports, module) {\n \"use strict\";\n module.exports = {\n moduleType: \"trace\",\n name: \"scattersmith\",\n basePlotModule: require_smith(),\n categories: [\"smith\", \"symbols\", \"showLegend\", \"scatter-like\"],\n attributes: require_attributes71(),\n supplyDefaults: require_defaults67(),\n colorbar: require_marker_colorbar(),\n formatLabels: require_format_labels10(),\n calc: require_calc46(),\n plot: require_plot39(),\n style: require_style2().style,\n styleOnSelect: require_style2().styleOnSelect,\n hoverPoints: require_hover27().hoverPoints,\n selectPoints: require_select2(),\n meta: {}\n };\n }\n });\n\n // lib/scattersmith.js\n var require_scattersmith2 = __commonJS({\n \"lib/scattersmith.js\"(exports, module) {\n \"use strict\";\n module.exports = require_scattersmith();\n }\n });\n\n // node_modules/world-calendars/dist/main.js\n var require_main = __commonJS({\n \"node_modules/world-calendars/dist/main.js\"(exports, module) {\n var assign = require_object_assign();\n function Calendars() {\n this.regionalOptions = [];\n this.regionalOptions[\"\"] = {\n invalidCalendar: \"Calendar {0} not found\",\n invalidDate: \"Invalid {0} date\",\n invalidMonth: \"Invalid {0} month\",\n invalidYear: \"Invalid {0} year\",\n differentCalendars: \"Cannot mix {0} and {1} dates\"\n };\n this.local = this.regionalOptions[\"\"];\n this.calendars = {};\n this._localCals = {};\n }\n assign(Calendars.prototype, {\n /** Obtain a calendar implementation and localisation.\n @memberof Calendars\n @param [name='gregorian'] {string} The name of the calendar, e.g. 'gregorian', 'persian', 'islamic'.\n @param [language=''] {string} The language code to use for localisation (default is English).\n @return {Calendar} The calendar and localisation.\n @throws Error if calendar not found. */\n instance: function(name2, language) {\n name2 = (name2 || \"gregorian\").toLowerCase();\n language = language || \"\";\n var cal = this._localCals[name2 + \"-\" + language];\n if (!cal && this.calendars[name2]) {\n cal = new this.calendars[name2](language);\n this._localCals[name2 + \"-\" + language] = cal;\n }\n if (!cal) {\n throw (this.local.invalidCalendar || this.regionalOptions[\"\"].invalidCalendar).replace(/\\{0\\}/, name2);\n }\n return cal;\n },\n /** Create a new date - for today if no other parameters given.\n @memberof Calendars\n @param year {CDate|number} The date to copy or the year for the date.\n @param [month] {number} The month for the date.\n @param [day] {number} The day for the date.\n @param [calendar='gregorian'] {BaseCalendar|string} The underlying calendar or the name of the calendar.\n @param [language=''] {string} The language to use for localisation (default English).\n @return {CDate} The new date.\n @throws Error if an invalid date. */\n newDate: function(year, month, day, calendar, language) {\n calendar = (year != null && year.year ? year.calendar() : typeof calendar === \"string\" ? this.instance(calendar, language) : calendar) || this.instance();\n return calendar.newDate(year, month, day);\n },\n /** A simple digit substitution function for localising numbers via the Calendar digits option.\n @member Calendars\n @param digits {string[]} The substitute digits, for 0 through 9.\n @return {function} The substitution function. */\n substituteDigits: function(digits) {\n return function(value) {\n return (value + \"\").replace(/[0-9]/g, function(digit) {\n return digits[digit];\n });\n };\n },\n /** Digit substitution function for localising Chinese style numbers via the Calendar digits option.\n @member Calendars\n @param digits {string[]} The substitute digits, for 0 through 9.\n @param powers {string[]} The characters denoting powers of 10, i.e. 1, 10, 100, 1000.\n @return {function} The substitution function. */\n substituteChineseDigits: function(digits, powers) {\n return function(value) {\n var localNumber = \"\";\n var power = 0;\n while (value > 0) {\n var units = value % 10;\n localNumber = (units === 0 ? \"\" : digits[units] + powers[power]) + localNumber;\n power++;\n value = Math.floor(value / 10);\n }\n if (localNumber.indexOf(digits[1] + powers[1]) === 0) {\n localNumber = localNumber.substr(1);\n }\n return localNumber || digits[0];\n };\n }\n });\n function CDate(calendar, year, month, day) {\n this._calendar = calendar;\n this._year = year;\n this._month = month;\n this._day = day;\n if (this._calendar._validateLevel === 0 && !this._calendar.isValid(this._year, this._month, this._day)) {\n throw (_exports.local.invalidDate || _exports.regionalOptions[\"\"].invalidDate).replace(/\\{0\\}/, this._calendar.local.name);\n }\n }\n function pad(value, length) {\n value = \"\" + value;\n return \"000000\".substring(0, length - value.length) + value;\n }\n assign(CDate.prototype, {\n /** Create a new date.\n @memberof CDate\n @param [year] {CDate|number} The date to copy or the year for the date (default this date).\n @param [month] {number} The month for the date.\n @param [day] {number} The day for the date.\n @return {CDate} The new date.\n @throws Error if an invalid date. */\n newDate: function(year, month, day) {\n return this._calendar.newDate(year == null ? this : year, month, day);\n },\n /** Set or retrieve the year for this date.\n @memberof CDate\n @param [year] {number} The year for the date.\n @return {number|CDate} The date's year (if no parameter) or the updated date.\n @throws Error if an invalid date. */\n year: function(year) {\n return arguments.length === 0 ? this._year : this.set(year, \"y\");\n },\n /** Set or retrieve the month for this date.\n @memberof CDate\n @param [month] {number} The month for the date.\n @return {number|CDate} The date's month (if no parameter) or the updated date.\n @throws Error if an invalid date. */\n month: function(month) {\n return arguments.length === 0 ? this._month : this.set(month, \"m\");\n },\n /** Set or retrieve the day for this date.\n @memberof CDate\n @param [day] {number} The day for the date.\n @return {number|CData} The date's day (if no parameter) or the updated date.\n @throws Error if an invalid date. */\n day: function(day) {\n return arguments.length === 0 ? this._day : this.set(day, \"d\");\n },\n /** Set new values for this date.\n @memberof CDate\n @param year {number} The year for the date.\n @param month {number} The month for the date.\n @param day {number} The day for the date.\n @return {CDate} The updated date.\n @throws Error if an invalid date. */\n date: function(year, month, day) {\n if (!this._calendar.isValid(year, month, day)) {\n throw (_exports.local.invalidDate || _exports.regionalOptions[\"\"].invalidDate).replace(/\\{0\\}/, this._calendar.local.name);\n }\n this._year = year;\n this._month = month;\n this._day = day;\n return this;\n },\n /** Determine whether this date is in a leap year.\n @memberof CDate\n @return {boolean} true if this is a leap year, false if not. */\n leapYear: function() {\n return this._calendar.leapYear(this);\n },\n /** Retrieve the epoch designator for this date, e.g. BCE or CE.\n @memberof CDate\n @return {string} The current epoch. */\n epoch: function() {\n return this._calendar.epoch(this);\n },\n /** Format the year, if not a simple sequential number.\n @memberof CDate\n @return {string} The formatted year. */\n formatYear: function() {\n return this._calendar.formatYear(this);\n },\n /** Retrieve the month of the year for this date,\n i.e. the month's position within a numbered year.\n @memberof CDate\n @return {number} The month of the year: minMonth to months per year. */\n monthOfYear: function() {\n return this._calendar.monthOfYear(this);\n },\n /** Retrieve the week of the year for this date.\n @memberof CDate\n @return {number} The week of the year: 1 to weeks per year. */\n weekOfYear: function() {\n return this._calendar.weekOfYear(this);\n },\n /** Retrieve the number of days in the year for this date.\n @memberof CDate\n @return {number} The number of days in this year. */\n daysInYear: function() {\n return this._calendar.daysInYear(this);\n },\n /** Retrieve the day of the year for this date.\n @memberof CDate\n @return {number} The day of the year: 1 to days per year. */\n dayOfYear: function() {\n return this._calendar.dayOfYear(this);\n },\n /** Retrieve the number of days in the month for this date.\n @memberof CDate\n @return {number} The number of days. */\n daysInMonth: function() {\n return this._calendar.daysInMonth(this);\n },\n /** Retrieve the day of the week for this date.\n @memberof CDate\n @return {number} The day of the week: 0 to number of days - 1. */\n dayOfWeek: function() {\n return this._calendar.dayOfWeek(this);\n },\n /** Determine whether this date is a week day.\n @memberof CDate\n @return {boolean} true if a week day, false if not. */\n weekDay: function() {\n return this._calendar.weekDay(this);\n },\n /** Retrieve additional information about this date.\n @memberof CDate\n @return {object} Additional information - contents depends on calendar. */\n extraInfo: function() {\n return this._calendar.extraInfo(this);\n },\n /** Add period(s) to a date.\n @memberof CDate\n @param offset {number} The number of periods to adjust by.\n @param period {string} One of 'y' for year, 'm' for month, 'w' for week, 'd' for day.\n @return {CDate} The updated date. */\n add: function(offset, period) {\n return this._calendar.add(this, offset, period);\n },\n /** Set a portion of the date.\n @memberof CDate\n @param value {number} The new value for the period.\n @param period {string} One of 'y' for year, 'm' for month, 'd' for day.\n @return {CDate} The updated date.\n @throws Error if not a valid date. */\n set: function(value, period) {\n return this._calendar.set(this, value, period);\n },\n /** Compare this date to another date.\n @memberof CDate\n @param date {CDate} The other date.\n @return {number} -1 if this date is before the other date,\n 0 if they are equal, or +1 if this date is after the other date. */\n compareTo: function(date) {\n if (this._calendar.name !== date._calendar.name) {\n throw (_exports.local.differentCalendars || _exports.regionalOptions[\"\"].differentCalendars).replace(/\\{0\\}/, this._calendar.local.name).replace(/\\{1\\}/, date._calendar.local.name);\n }\n var c = this._year !== date._year ? this._year - date._year : this._month !== date._month ? this.monthOfYear() - date.monthOfYear() : this._day - date._day;\n return c === 0 ? 0 : c < 0 ? -1 : 1;\n },\n /** Retrieve the calendar backing this date.\n @memberof CDate\n @return {BaseCalendar} The calendar implementation. */\n calendar: function() {\n return this._calendar;\n },\n /** Retrieve the Julian date equivalent for this date,\n i.e. days since January 1, 4713 BCE Greenwich noon.\n @memberof CDate\n @return {number} The equivalent Julian date. */\n toJD: function() {\n return this._calendar.toJD(this);\n },\n /** Create a new date from a Julian date.\n @memberof CDate\n @param jd {number} The Julian date to convert.\n @return {CDate} The equivalent date. */\n fromJD: function(jd) {\n return this._calendar.fromJD(jd);\n },\n /** Convert this date to a standard (Gregorian) JavaScript Date.\n @memberof CDate\n @return {Date} The equivalent JavaScript date. */\n toJSDate: function() {\n return this._calendar.toJSDate(this);\n },\n /** Create a new date from a standard (Gregorian) JavaScript Date.\n @memberof CDate\n @param jsd {Date} The JavaScript date to convert.\n @return {CDate} The equivalent date. */\n fromJSDate: function(jsd) {\n return this._calendar.fromJSDate(jsd);\n },\n /** Convert to a string for display.\n @memberof CDate\n @return {string} This date as a string. */\n toString: function() {\n return (this.year() < 0 ? \"-\" : \"\") + pad(Math.abs(this.year()), 4) + \"-\" + pad(this.month(), 2) + \"-\" + pad(this.day(), 2);\n }\n });\n function BaseCalendar() {\n this.shortYearCutoff = \"+10\";\n }\n assign(BaseCalendar.prototype, {\n _validateLevel: 0,\n // \"Stack\" to turn validation on/off\n /** Create a new date within this calendar - today if no parameters given.\n @memberof BaseCalendar\n @param year {CDate|number} The date to duplicate or the year for the date.\n @param [month] {number} The month for the date.\n @param [day] {number} The day for the date.\n @return {CDate} The new date.\n @throws Error if not a valid date or a different calendar used. */\n newDate: function(year, month, day) {\n if (year == null) {\n return this.today();\n }\n if (year.year) {\n this._validate(\n year,\n month,\n day,\n _exports.local.invalidDate || _exports.regionalOptions[\"\"].invalidDate\n );\n day = year.day();\n month = year.month();\n year = year.year();\n }\n return new CDate(this, year, month, day);\n },\n /** Create a new date for today.\n @memberof BaseCalendar\n @return {CDate} Today's date. */\n today: function() {\n return this.fromJSDate(/* @__PURE__ */ new Date());\n },\n /** Retrieve the epoch designator for this date.\n @memberof BaseCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {string} The current epoch.\n @throws Error if an invalid year or a different calendar used. */\n epoch: function(year) {\n var date = this._validate(\n year,\n this.minMonth,\n this.minDay,\n _exports.local.invalidYear || _exports.regionalOptions[\"\"].invalidYear\n );\n return date.year() < 0 ? this.local.epochs[0] : this.local.epochs[1];\n },\n /** Format the year, if not a simple sequential number\n @memberof BaseCalendar\n @param year {CDate|number} The date to format or the year to format.\n @return {string} The formatted year.\n @throws Error if an invalid year or a different calendar used. */\n formatYear: function(year) {\n var date = this._validate(\n year,\n this.minMonth,\n this.minDay,\n _exports.local.invalidYear || _exports.regionalOptions[\"\"].invalidYear\n );\n return (date.year() < 0 ? \"-\" : \"\") + pad(Math.abs(date.year()), 4);\n },\n /** Retrieve the number of months in a year.\n @memberof BaseCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {number} The number of months.\n @throws Error if an invalid year or a different calendar used. */\n monthsInYear: function(year) {\n this._validate(\n year,\n this.minMonth,\n this.minDay,\n _exports.local.invalidYear || _exports.regionalOptions[\"\"].invalidYear\n );\n return 12;\n },\n /** Calculate the month's ordinal position within the year -\n for those calendars that don't start at month 1!\n @memberof BaseCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param month {number} The month to examine.\n @return {number} The ordinal position, starting from minMonth.\n @throws Error if an invalid year/month or a different calendar used. */\n monthOfYear: function(year, month) {\n var date = this._validate(\n year,\n month,\n this.minDay,\n _exports.local.invalidMonth || _exports.regionalOptions[\"\"].invalidMonth\n );\n return (date.month() + this.monthsInYear(date) - this.firstMonth) % this.monthsInYear(date) + this.minMonth;\n },\n /** Calculate actual month from ordinal position, starting from minMonth.\n @memberof BaseCalendar\n @param year {number} The year to examine.\n @param ord {number} The month's ordinal position.\n @return {number} The month's number.\n @throws Error if an invalid year/month. */\n fromMonthOfYear: function(year, ord) {\n var m = (ord + this.firstMonth - 2 * this.minMonth) % this.monthsInYear(year) + this.minMonth;\n this._validate(\n year,\n m,\n this.minDay,\n _exports.local.invalidMonth || _exports.regionalOptions[\"\"].invalidMonth\n );\n return m;\n },\n /** Retrieve the number of days in a year.\n @memberof BaseCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {number} The number of days.\n @throws Error if an invalid year or a different calendar used. */\n daysInYear: function(year) {\n var date = this._validate(\n year,\n this.minMonth,\n this.minDay,\n _exports.local.invalidYear || _exports.regionalOptions[\"\"].invalidYear\n );\n return this.leapYear(date) ? 366 : 365;\n },\n /** Retrieve the day of the year for a date.\n @memberof BaseCalendar\n @param year {CDate|number} The date to convert or the year to convert.\n @param [month] {number} The month to convert.\n @param [day] {number} The day to convert.\n @return {number} The day of the year.\n @throws Error if an invalid date or a different calendar used. */\n dayOfYear: function(year, month, day) {\n var date = this._validate(\n year,\n month,\n day,\n _exports.local.invalidDate || _exports.regionalOptions[\"\"].invalidDate\n );\n return date.toJD() - this.newDate(\n date.year(),\n this.fromMonthOfYear(date.year(), this.minMonth),\n this.minDay\n ).toJD() + 1;\n },\n /** Retrieve the number of days in a week.\n @memberof BaseCalendar\n @return {number} The number of days. */\n daysInWeek: function() {\n return 7;\n },\n /** Retrieve the day of the week for a date.\n @memberof BaseCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {number} The day of the week: 0 to number of days - 1.\n @throws Error if an invalid date or a different calendar used. */\n dayOfWeek: function(year, month, day) {\n var date = this._validate(\n year,\n month,\n day,\n _exports.local.invalidDate || _exports.regionalOptions[\"\"].invalidDate\n );\n return (Math.floor(this.toJD(date)) + 2) % this.daysInWeek();\n },\n /** Retrieve additional information about a date.\n @memberof BaseCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {object} Additional information - contents depends on calendar.\n @throws Error if an invalid date or a different calendar used. */\n extraInfo: function(year, month, day) {\n this._validate(\n year,\n month,\n day,\n _exports.local.invalidDate || _exports.regionalOptions[\"\"].invalidDate\n );\n return {};\n },\n /** Add period(s) to a date.\n Cater for no year zero.\n @memberof BaseCalendar\n @param date {CDate} The starting date.\n @param offset {number} The number of periods to adjust by.\n @param period {string} One of 'y' for year, 'm' for month, 'w' for week, 'd' for day.\n @return {CDate} The updated date.\n @throws Error if a different calendar used. */\n add: function(date, offset, period) {\n this._validate(\n date,\n this.minMonth,\n this.minDay,\n _exports.local.invalidDate || _exports.regionalOptions[\"\"].invalidDate\n );\n return this._correctAdd(date, this._add(date, offset, period), offset, period);\n },\n /** Add period(s) to a date.\n @memberof BaseCalendar\n @private\n @param date {CDate} The starting date.\n @param offset {number} The number of periods to adjust by.\n @param period {string} One of 'y' for year, 'm' for month, 'w' for week, 'd' for day.\n @return {CDate} The updated date. */\n _add: function(date, offset, period) {\n this._validateLevel++;\n if (period === \"d\" || period === \"w\") {\n var jd = date.toJD() + offset * (period === \"w\" ? this.daysInWeek() : 1);\n var d = date.calendar().fromJD(jd);\n this._validateLevel--;\n return [d.year(), d.month(), d.day()];\n }\n try {\n var y = date.year() + (period === \"y\" ? offset : 0);\n var m = date.monthOfYear() + (period === \"m\" ? offset : 0);\n var d = date.day();\n var resyncYearMonth = function(calendar) {\n while (m < calendar.minMonth) {\n y--;\n m += calendar.monthsInYear(y);\n }\n var yearMonths = calendar.monthsInYear(y);\n while (m > yearMonths - 1 + calendar.minMonth) {\n y++;\n m -= yearMonths;\n yearMonths = calendar.monthsInYear(y);\n }\n };\n if (period === \"y\") {\n if (date.month() !== this.fromMonthOfYear(y, m)) {\n m = this.newDate(y, date.month(), this.minDay).monthOfYear();\n }\n m = Math.min(m, this.monthsInYear(y));\n d = Math.min(d, this.daysInMonth(y, this.fromMonthOfYear(y, m)));\n } else if (period === \"m\") {\n resyncYearMonth(this);\n d = Math.min(d, this.daysInMonth(y, this.fromMonthOfYear(y, m)));\n }\n var ymd = [y, this.fromMonthOfYear(y, m), d];\n this._validateLevel--;\n return ymd;\n } catch (e) {\n this._validateLevel--;\n throw e;\n }\n },\n /** Correct a candidate date after adding period(s) to a date.\n Handle no year zero if necessary.\n @memberof BaseCalendar\n @private\n @param date {CDate} The starting date.\n @param ymd {number[]} The added date.\n @param offset {number} The number of periods to adjust by.\n @param period {string} One of 'y' for year, 'm' for month, 'w' for week, 'd' for day.\n @return {CDate} The updated date. */\n _correctAdd: function(date, ymd, offset, period) {\n if (!this.hasYearZero && (period === \"y\" || period === \"m\")) {\n if (ymd[0] === 0 || // In year zero\n date.year() > 0 !== ymd[0] > 0) {\n var adj = {\n y: [1, 1, \"y\"],\n m: [1, this.monthsInYear(-1), \"m\"],\n w: [this.daysInWeek(), this.daysInYear(-1), \"d\"],\n d: [1, this.daysInYear(-1), \"d\"]\n }[period];\n var dir = offset < 0 ? -1 : 1;\n ymd = this._add(date, offset * adj[0] + dir * adj[1], adj[2]);\n }\n }\n return date.date(ymd[0], ymd[1], ymd[2]);\n },\n /** Set a portion of the date.\n @memberof BaseCalendar\n @param date {CDate} The starting date.\n @param value {number} The new value for the period.\n @param period {string} One of 'y' for year, 'm' for month, 'd' for day.\n @return {CDate} The updated date.\n @throws Error if an invalid date or a different calendar used. */\n set: function(date, value, period) {\n this._validate(\n date,\n this.minMonth,\n this.minDay,\n _exports.local.invalidDate || _exports.regionalOptions[\"\"].invalidDate\n );\n var y = period === \"y\" ? value : date.year();\n var m = period === \"m\" ? value : date.month();\n var d = period === \"d\" ? value : date.day();\n if (period === \"y\" || period === \"m\") {\n d = Math.min(d, this.daysInMonth(y, m));\n }\n return date.date(y, m, d);\n },\n /** Determine whether a date is valid for this calendar.\n @memberof BaseCalendar\n @param year {number} The year to examine.\n @param month {number} The month to examine.\n @param day {number} The day to examine.\n @return {boolean} true if a valid date, false if not. */\n isValid: function(year, month, day) {\n this._validateLevel++;\n var valid = this.hasYearZero || year !== 0;\n if (valid) {\n var date = this.newDate(year, month, this.minDay);\n valid = month >= this.minMonth && month - this.minMonth < this.monthsInYear(date) && (day >= this.minDay && day - this.minDay < this.daysInMonth(date));\n }\n this._validateLevel--;\n return valid;\n },\n /** Convert the date to a standard (Gregorian) JavaScript Date.\n @memberof BaseCalendar\n @param year {CDate|number} The date to convert or the year to convert.\n @param [month] {number} The month to convert.\n @param [day] {number} The day to convert.\n @return {Date} The equivalent JavaScript date.\n @throws Error if an invalid date or a different calendar used. */\n toJSDate: function(year, month, day) {\n var date = this._validate(\n year,\n month,\n day,\n _exports.local.invalidDate || _exports.regionalOptions[\"\"].invalidDate\n );\n return _exports.instance().fromJD(this.toJD(date)).toJSDate();\n },\n /** Convert the date from a standard (Gregorian) JavaScript Date.\n @memberof BaseCalendar\n @param jsd {Date} The JavaScript date.\n @return {CDate} The equivalent calendar date. */\n fromJSDate: function(jsd) {\n return this.fromJD(_exports.instance().fromJSDate(jsd).toJD());\n },\n /** Check that a candidate date is from the same calendar and is valid.\n @memberof BaseCalendar\n @private\n @param year {CDate|number} The date to validate or the year to validate.\n @param [month] {number} The month to validate.\n @param [day] {number} The day to validate.\n @param error {string} Rrror message if invalid.\n @throws Error if different calendars used or invalid date. */\n _validate: function(year, month, day, error) {\n if (year.year) {\n if (this._validateLevel === 0 && this.name !== year.calendar().name) {\n throw (_exports.local.differentCalendars || _exports.regionalOptions[\"\"].differentCalendars).replace(/\\{0\\}/, this.local.name).replace(/\\{1\\}/, year.calendar().local.name);\n }\n return year;\n }\n try {\n this._validateLevel++;\n if (this._validateLevel === 1 && !this.isValid(year, month, day)) {\n throw error.replace(/\\{0\\}/, this.local.name);\n }\n var date = this.newDate(year, month, day);\n this._validateLevel--;\n return date;\n } catch (e) {\n this._validateLevel--;\n throw e;\n }\n }\n });\n function GregorianCalendar(language) {\n this.local = this.regionalOptions[language] || this.regionalOptions[\"\"];\n }\n GregorianCalendar.prototype = new BaseCalendar();\n assign(GregorianCalendar.prototype, {\n /** The calendar name.\n @memberof GregorianCalendar */\n name: \"Gregorian\",\n /** Julian date of start of Gregorian epoch: 1 January 0001 CE.\n @memberof GregorianCalendar */\n jdEpoch: 17214255e-1,\n /** Days per month in a common year.\n @memberof GregorianCalendar */\n daysPerMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n /** true if has a year zero, false if not.\n @memberof GregorianCalendar */\n hasYearZero: false,\n /** The minimum month number.\n @memberof GregorianCalendar */\n minMonth: 1,\n /** The first month in the year.\n @memberof GregorianCalendar */\n firstMonth: 1,\n /** The minimum day number.\n @memberof GregorianCalendar */\n minDay: 1,\n /** Localisations for the plugin.\n Entries are objects indexed by the language code ('' being the default US/English).\n Each object has the following attributes.\n @memberof GregorianCalendar\n @property name {string} The calendar name.\n @property epochs {string[]} The epoch names.\n @property monthNames {string[]} The long names of the months of the year.\n @property monthNamesShort {string[]} The short names of the months of the year.\n @property dayNames {string[]} The long names of the days of the week.\n @property dayNamesShort {string[]} The short names of the days of the week.\n @property dayNamesMin {string[]} The minimal names of the days of the week.\n @property dateFormat {string} The date format for this calendar.\n See the options on
    formatDate for details.\n @property firstDay {number} The number of the first day of the week, starting at 0.\n @property isRTL {number} true if this localisation reads right-to-left. */\n regionalOptions: {\n // Localisations\n \"\": {\n name: \"Gregorian\",\n epochs: [\"BCE\", \"CE\"],\n monthNames: [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\"\n ],\n monthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\n dayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n dayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n dayNamesMin: [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"],\n digits: null,\n dateFormat: \"mm/dd/yyyy\",\n firstDay: 0,\n isRTL: false\n }\n },\n /** Determine whether this date is in a leap year.\n @memberof GregorianCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {boolean} true if this is a leap year, false if not.\n @throws Error if an invalid year or a different calendar used. */\n leapYear: function(year) {\n var date = this._validate(\n year,\n this.minMonth,\n this.minDay,\n _exports.local.invalidYear || _exports.regionalOptions[\"\"].invalidYear\n );\n var year = date.year() + (date.year() < 0 ? 1 : 0);\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n },\n /** Determine the week of the year for a date - ISO 8601.\n @memberof GregorianCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {number} The week of the year, starting from 1.\n @throws Error if an invalid date or a different calendar used. */\n weekOfYear: function(year, month, day) {\n var checkDate = this.newDate(year, month, day);\n checkDate.add(4 - (checkDate.dayOfWeek() || 7), \"d\");\n return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1;\n },\n /** Retrieve the number of days in a month.\n @memberof GregorianCalendar\n @param year {CDate|number} The date to examine or the year of the month.\n @param [month] {number} The month.\n @return {number} The number of days in this month.\n @throws Error if an invalid month/year or a different calendar used. */\n daysInMonth: function(year, month) {\n var date = this._validate(\n year,\n month,\n this.minDay,\n _exports.local.invalidMonth || _exports.regionalOptions[\"\"].invalidMonth\n );\n return this.daysPerMonth[date.month() - 1] + (date.month() === 2 && this.leapYear(date.year()) ? 1 : 0);\n },\n /** Determine whether this date is a week day.\n @memberof GregorianCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {boolean} true if a week day, false if not.\n @throws Error if an invalid date or a different calendar used. */\n weekDay: function(year, month, day) {\n return (this.dayOfWeek(year, month, day) || 7) < 6;\n },\n /** Retrieve the Julian date equivalent for this date,\n i.e. days since January 1, 4713 BCE Greenwich noon.\n @memberof GregorianCalendar\n @param year {CDate|number} The date to convert or the year to convert.\n @param [month] {number} The month to convert.\n @param [day] {number} The day to convert.\n @return {number} The equivalent Julian date.\n @throws Error if an invalid date or a different calendar used. */\n toJD: function(year, month, day) {\n var date = this._validate(\n year,\n month,\n day,\n _exports.local.invalidDate || _exports.regionalOptions[\"\"].invalidDate\n );\n year = date.year();\n month = date.month();\n day = date.day();\n if (year < 0) {\n year++;\n }\n if (month < 3) {\n month += 12;\n year--;\n }\n var a = Math.floor(year / 100);\n var b = 2 - a + Math.floor(a / 4);\n return Math.floor(365.25 * (year + 4716)) + Math.floor(30.6001 * (month + 1)) + day + b - 1524.5;\n },\n /** Create a new date from a Julian date.\n @memberof GregorianCalendar\n @param jd {number} The Julian date to convert.\n @return {CDate} The equivalent date. */\n fromJD: function(jd) {\n var z = Math.floor(jd + 0.5);\n var a = Math.floor((z - 186721625e-2) / 36524.25);\n a = z + 1 + a - Math.floor(a / 4);\n var b = a + 1524;\n var c = Math.floor((b - 122.1) / 365.25);\n var d = Math.floor(365.25 * c);\n var e = Math.floor((b - d) / 30.6001);\n var day = b - d - Math.floor(e * 30.6001);\n var month = e - (e > 13.5 ? 13 : 1);\n var year = c - (month > 2.5 ? 4716 : 4715);\n if (year <= 0) {\n year--;\n }\n return this.newDate(year, month, day);\n },\n /** Convert this date to a standard (Gregorian) JavaScript Date.\n @memberof GregorianCalendar\n @param year {CDate|number} The date to convert or the year to convert.\n @param [month] {number} The month to convert.\n @param [day] {number} The day to convert.\n @return {Date} The equivalent JavaScript date.\n @throws Error if an invalid date or a different calendar used. */\n toJSDate: function(year, month, day) {\n var date = this._validate(\n year,\n month,\n day,\n _exports.local.invalidDate || _exports.regionalOptions[\"\"].invalidDate\n );\n var jsd = new Date(date.year(), date.month() - 1, date.day());\n jsd.setHours(0);\n jsd.setMinutes(0);\n jsd.setSeconds(0);\n jsd.setMilliseconds(0);\n jsd.setHours(jsd.getHours() > 12 ? jsd.getHours() + 2 : 0);\n return jsd;\n },\n /** Create a new date from a standard (Gregorian) JavaScript Date.\n @memberof GregorianCalendar\n @param jsd {Date} The JavaScript date to convert.\n @return {CDate} The equivalent date. */\n fromJSDate: function(jsd) {\n return this.newDate(jsd.getFullYear(), jsd.getMonth() + 1, jsd.getDate());\n }\n });\n var _exports = module.exports = new Calendars();\n _exports.cdate = CDate;\n _exports.baseCalendar = BaseCalendar;\n _exports.calendars.gregorian = GregorianCalendar;\n }\n });\n\n // node_modules/world-calendars/dist/plus.js\n var require_plus = __commonJS({\n \"node_modules/world-calendars/dist/plus.js\"() {\n var assign = require_object_assign();\n var main = require_main();\n assign(main.regionalOptions[\"\"], {\n invalidArguments: \"Invalid arguments\",\n invalidFormat: \"Cannot format a date from another calendar\",\n missingNumberAt: \"Missing number at position {0}\",\n unknownNameAt: \"Unknown name at position {0}\",\n unexpectedLiteralAt: \"Unexpected literal at position {0}\",\n unexpectedText: \"Additional text found at end\"\n });\n main.local = main.regionalOptions[\"\"];\n assign(main.cdate.prototype, {\n /** Format this date.\n Found in the jquery.calendars.plus.js module.\n @memberof CDate\n @param [format] {string} The date format to use (see formatDate).\n @param [settings] {object} Options for the formatDate function.\n @return {string} The formatted date. */\n formatDate: function(format, settings) {\n if (typeof format !== \"string\") {\n settings = format;\n format = \"\";\n }\n return this._calendar.formatDate(format || \"\", this, settings);\n }\n });\n assign(main.baseCalendar.prototype, {\n UNIX_EPOCH: main.instance().newDate(1970, 1, 1).toJD(),\n SECS_PER_DAY: 24 * 60 * 60,\n TICKS_EPOCH: main.instance().jdEpoch,\n // 1 January 0001 CE\n TICKS_PER_DAY: 24 * 60 * 60 * 1e7,\n /** Date form for ATOM (RFC 3339/ISO 8601).\n Found in the jquery.calendars.plus.js module.\n @memberof BaseCalendar */\n ATOM: \"yyyy-mm-dd\",\n /** Date form for cookies.\n Found in the jquery.calendars.plus.js module.\n @memberof BaseCalendar */\n COOKIE: \"D, dd M yyyy\",\n /** Date form for full date.\n Found in the jquery.calendars.plus.js module.\n @memberof BaseCalendar */\n FULL: \"DD, MM d, yyyy\",\n /** Date form for ISO 8601.\n Found in the jquery.calendars.plus.js module.\n @memberof BaseCalendar */\n ISO_8601: \"yyyy-mm-dd\",\n /** Date form for Julian date.\n Found in the jquery.calendars.plus.js module.\n @memberof BaseCalendar */\n JULIAN: \"J\",\n /** Date form for RFC 822.\n Found in the jquery.calendars.plus.js module.\n @memberof BaseCalendar */\n RFC_822: \"D, d M yy\",\n /** Date form for RFC 850.\n Found in the jquery.calendars.plus.js module.\n @memberof BaseCalendar */\n RFC_850: \"DD, dd-M-yy\",\n /** Date form for RFC 1036.\n Found in the jquery.calendars.plus.js module.\n @memberof BaseCalendar */\n RFC_1036: \"D, d M yy\",\n /** Date form for RFC 1123.\n Found in the jquery.calendars.plus.js module.\n @memberof BaseCalendar */\n RFC_1123: \"D, d M yyyy\",\n /** Date form for RFC 2822.\n Found in the jquery.calendars.plus.js module.\n @memberof BaseCalendar */\n RFC_2822: \"D, d M yyyy\",\n /** Date form for RSS (RFC 822).\n Found in the jquery.calendars.plus.js module.\n @memberof BaseCalendar */\n RSS: \"D, d M yy\",\n /** Date form for Windows ticks.\n Found in the jquery.calendars.plus.js module.\n @memberof BaseCalendar */\n TICKS: \"!\",\n /** Date form for Unix timestamp.\n Found in the jquery.calendars.plus.js module.\n @memberof BaseCalendar */\n TIMESTAMP: \"@\",\n /** Date form for W3c (ISO 8601).\n Found in the jquery.calendars.plus.js module.\n @memberof BaseCalendar */\n W3C: \"yyyy-mm-dd\",\n /** Format a date object into a string value.\n The format can be combinations of the following:\n

      \n
    • d - day of month (no leading zero)
    • \n
    • dd - day of month (two digit)
    • \n
    • o - day of year (no leading zeros)
    • \n
    • oo - day of year (three digit)
    • \n
    • D - day name short
    • \n
    • DD - day name long
    • \n
    • w - week of year (no leading zero)
    • \n
    • ww - week of year (two digit)
    • \n
    • m - month of year (no leading zero)
    • \n
    • mm - month of year (two digit)
    • \n
    • M - month name short
    • \n
    • MM - month name long
    • \n
    • yy - year (two digit)
    • \n
    • yyyy - year (four digit)
    • \n
    • YYYY - formatted year
    • \n
    • J - Julian date (days since January 1, 4713 BCE Greenwich noon)
    • \n
    • @ - Unix timestamp (s since 01/01/1970)
    • \n
    • ! - Windows ticks (100ns since 01/01/0001)
    • \n
    • '...' - literal text
    • \n
    • '' - single quote
    • \n
    \n Found in the jquery.calendars.plus.js module.\n @memberof BaseCalendar\n @param [format] {string} The desired format of the date (defaults to calendar format).\n @param date {CDate} The date value to format.\n @param [settings] {object} Addition options, whose attributes include:\n @property [dayNamesShort] {string[]} Abbreviated names of the days from Sunday.\n @property [dayNames] {string[]} Names of the days from Sunday.\n @property [monthNamesShort] {string[]} Abbreviated names of the months.\n @property [monthNames] {string[]} Names of the months.\n @property [calculateWeek] {CalendarsPickerCalculateWeek} Function that determines week of the year.\n @property [localNumbers=false] {boolean} true to localise numbers (if available),\n false to use normal Arabic numerals.\n @return {string} The date in the above format.\n @throws Errors if the date is from a different calendar. */\n formatDate: function(format, date, settings) {\n if (typeof format !== \"string\") {\n settings = date;\n date = format;\n format = \"\";\n }\n if (!date) {\n return \"\";\n }\n if (date.calendar() !== this) {\n throw main.local.invalidFormat || main.regionalOptions[\"\"].invalidFormat;\n }\n format = format || this.local.dateFormat;\n settings = settings || {};\n var dayNamesShort = settings.dayNamesShort || this.local.dayNamesShort;\n var dayNames = settings.dayNames || this.local.dayNames;\n var monthNumbers = settings.monthNumbers || this.local.monthNumbers;\n var monthNamesShort = settings.monthNamesShort || this.local.monthNamesShort;\n var monthNames = settings.monthNames || this.local.monthNames;\n var calculateWeek = settings.calculateWeek || this.local.calculateWeek;\n var doubled = function(match, step) {\n var matches = 1;\n while (iFormat + matches < format.length && format.charAt(iFormat + matches) === match) {\n matches++;\n }\n iFormat += matches - 1;\n return Math.floor(matches / (step || 1)) > 1;\n };\n var formatNumber = function(match, value, len, step) {\n var num = \"\" + value;\n if (doubled(match, step)) {\n while (num.length < len) {\n num = \"0\" + num;\n }\n }\n return num;\n };\n var formatName = function(match, value, shortNames, longNames) {\n return doubled(match) ? longNames[value] : shortNames[value];\n };\n var calendar = this;\n var formatMonth = function(date2) {\n return typeof monthNumbers === \"function\" ? monthNumbers.call(calendar, date2, doubled(\"m\")) : localiseNumbers(formatNumber(\"m\", date2.month(), 2));\n };\n var formatMonthName = function(date2, useLongName) {\n if (useLongName) {\n return typeof monthNames === \"function\" ? monthNames.call(calendar, date2) : monthNames[date2.month() - calendar.minMonth];\n } else {\n return typeof monthNamesShort === \"function\" ? monthNamesShort.call(calendar, date2) : monthNamesShort[date2.month() - calendar.minMonth];\n }\n };\n var digits = this.local.digits;\n var localiseNumbers = function(value) {\n return settings.localNumbers && digits ? digits(value) : value;\n };\n var output = \"\";\n var literal = false;\n for (var iFormat = 0; iFormat < format.length; iFormat++) {\n if (literal) {\n if (format.charAt(iFormat) === \"'\" && !doubled(\"'\")) {\n literal = false;\n } else {\n output += format.charAt(iFormat);\n }\n } else {\n switch (format.charAt(iFormat)) {\n case \"d\":\n output += localiseNumbers(formatNumber(\"d\", date.day(), 2));\n break;\n case \"D\":\n output += formatName(\n \"D\",\n date.dayOfWeek(),\n dayNamesShort,\n dayNames\n );\n break;\n case \"o\":\n output += formatNumber(\"o\", date.dayOfYear(), 3);\n break;\n case \"w\":\n output += formatNumber(\"w\", date.weekOfYear(), 2);\n break;\n case \"m\":\n output += formatMonth(date);\n break;\n case \"M\":\n output += formatMonthName(date, doubled(\"M\"));\n break;\n case \"y\":\n output += doubled(\"y\", 2) ? date.year() : (date.year() % 100 < 10 ? \"0\" : \"\") + date.year() % 100;\n break;\n case \"Y\":\n doubled(\"Y\", 2);\n output += date.formatYear();\n break;\n case \"J\":\n output += date.toJD();\n break;\n case \"@\":\n output += (date.toJD() - this.UNIX_EPOCH) * this.SECS_PER_DAY;\n break;\n case \"!\":\n output += (date.toJD() - this.TICKS_EPOCH) * this.TICKS_PER_DAY;\n break;\n case \"'\":\n if (doubled(\"'\")) {\n output += \"'\";\n } else {\n literal = true;\n }\n break;\n default:\n output += format.charAt(iFormat);\n }\n }\n }\n return output;\n },\n /** Parse a string value into a date object.\n See formatDate for the possible formats, plus:\n
      \n
    • * - ignore rest of string
    • \n
    \n Found in the jquery.calendars.plus.js module.\n @memberof BaseCalendar\n @param format {string} The expected format of the date ('' for default calendar format).\n @param value {string} The date in the above format.\n @param [settings] {object} Additional options whose attributes include:\n @property [shortYearCutoff] {number} The cutoff year for determining the century.\n @property [dayNamesShort] {string[]} Abbreviated names of the days from Sunday.\n @property [dayNames] {string[]} Names of the days from Sunday.\n @property [monthNamesShort] {string[]} Abbreviated names of the months.\n @property [monthNames] {string[]} Names of the months.\n @return {CDate} The extracted date value or null if value is blank.\n @throws Errors if the format and/or value are missing,\n if the value doesn't match the format, or if the date is invalid. */\n parseDate: function(format, value, settings) {\n if (value == null) {\n throw main.local.invalidArguments || main.regionalOptions[\"\"].invalidArguments;\n }\n value = typeof value === \"object\" ? value.toString() : value + \"\";\n if (value === \"\") {\n return null;\n }\n format = format || this.local.dateFormat;\n settings = settings || {};\n var shortYearCutoff = settings.shortYearCutoff || this.shortYearCutoff;\n shortYearCutoff = typeof shortYearCutoff !== \"string\" ? shortYearCutoff : this.today().year() % 100 + parseInt(shortYearCutoff, 10);\n var dayNamesShort = settings.dayNamesShort || this.local.dayNamesShort;\n var dayNames = settings.dayNames || this.local.dayNames;\n var parseMonth = settings.parseMonth || this.local.parseMonth;\n var monthNumbers = settings.monthNumbers || this.local.monthNumbers;\n var monthNamesShort = settings.monthNamesShort || this.local.monthNamesShort;\n var monthNames = settings.monthNames || this.local.monthNames;\n var jd = -1;\n var year = -1;\n var month = -1;\n var day = -1;\n var doy = -1;\n var shortYear = false;\n var literal = false;\n var doubled = function(match, step) {\n var matches = 1;\n while (iFormat + matches < format.length && format.charAt(iFormat + matches) === match) {\n matches++;\n }\n iFormat += matches - 1;\n return Math.floor(matches / (step || 1)) > 1;\n };\n var getNumber = function(match, step) {\n var isDoubled = doubled(match, step);\n var size = [2, 3, isDoubled ? 4 : 2, isDoubled ? 4 : 2, 10, 11, 20][\"oyYJ@!\".indexOf(match) + 1];\n var digits = new RegExp(\"^-?\\\\d{1,\" + size + \"}\");\n var num = value.substring(iValue).match(digits);\n if (!num) {\n throw (main.local.missingNumberAt || main.regionalOptions[\"\"].missingNumberAt).replace(/\\{0\\}/, iValue);\n }\n iValue += num[0].length;\n return parseInt(num[0], 10);\n };\n var calendar = this;\n var getMonthNumber = function() {\n if (typeof monthNumbers === \"function\") {\n doubled(\"m\");\n var month2 = monthNumbers.call(calendar, value.substring(iValue));\n iValue += month2.length;\n return month2;\n }\n return getNumber(\"m\");\n };\n var getName = function(match, shortNames, longNames, step) {\n var names2 = doubled(match, step) ? longNames : shortNames;\n for (var i = 0; i < names2.length; i++) {\n if (value.substr(iValue, names2[i].length).toLowerCase() === names2[i].toLowerCase()) {\n iValue += names2[i].length;\n return i + calendar.minMonth;\n }\n }\n throw (main.local.unknownNameAt || main.regionalOptions[\"\"].unknownNameAt).replace(/\\{0\\}/, iValue);\n };\n var getMonthName = function() {\n if (typeof monthNames === \"function\") {\n var month2 = doubled(\"M\") ? monthNames.call(calendar, value.substring(iValue)) : monthNamesShort.call(calendar, value.substring(iValue));\n iValue += month2.length;\n return month2;\n }\n return getName(\"M\", monthNamesShort, monthNames);\n };\n var checkLiteral = function() {\n if (value.charAt(iValue) !== format.charAt(iFormat)) {\n throw (main.local.unexpectedLiteralAt || main.regionalOptions[\"\"].unexpectedLiteralAt).replace(/\\{0\\}/, iValue);\n }\n iValue++;\n };\n var iValue = 0;\n for (var iFormat = 0; iFormat < format.length; iFormat++) {\n if (literal) {\n if (format.charAt(iFormat) === \"'\" && !doubled(\"'\")) {\n literal = false;\n } else {\n checkLiteral();\n }\n } else {\n switch (format.charAt(iFormat)) {\n case \"d\":\n day = getNumber(\"d\");\n break;\n case \"D\":\n getName(\"D\", dayNamesShort, dayNames);\n break;\n case \"o\":\n doy = getNumber(\"o\");\n break;\n case \"w\":\n getNumber(\"w\");\n break;\n case \"m\":\n month = getMonthNumber();\n break;\n case \"M\":\n month = getMonthName();\n break;\n case \"y\":\n var iSave = iFormat;\n shortYear = !doubled(\"y\", 2);\n iFormat = iSave;\n year = getNumber(\"y\", 2);\n break;\n case \"Y\":\n year = getNumber(\"Y\", 2);\n break;\n case \"J\":\n jd = getNumber(\"J\") + 0.5;\n if (value.charAt(iValue) === \".\") {\n iValue++;\n getNumber(\"J\");\n }\n break;\n case \"@\":\n jd = getNumber(\"@\") / this.SECS_PER_DAY + this.UNIX_EPOCH;\n break;\n case \"!\":\n jd = getNumber(\"!\") / this.TICKS_PER_DAY + this.TICKS_EPOCH;\n break;\n case \"*\":\n iValue = value.length;\n break;\n case \"'\":\n if (doubled(\"'\")) {\n checkLiteral();\n } else {\n literal = true;\n }\n break;\n default:\n checkLiteral();\n }\n }\n }\n if (iValue < value.length) {\n throw main.local.unexpectedText || main.regionalOptions[\"\"].unexpectedText;\n }\n if (year === -1) {\n year = this.today().year();\n } else if (year < 100 && shortYear) {\n year += shortYearCutoff === -1 ? 1900 : this.today().year() - this.today().year() % 100 - (year <= shortYearCutoff ? 0 : 100);\n }\n if (typeof month === \"string\") {\n month = parseMonth.call(this, year, month);\n }\n if (doy > -1) {\n month = 1;\n day = doy;\n for (var dim = this.daysInMonth(year, month); day > dim; dim = this.daysInMonth(year, month)) {\n month++;\n day -= dim;\n }\n }\n return jd > -1 ? this.fromJD(jd) : this.newDate(year, month, day);\n },\n /** A date may be specified as an exact value or a relative one.\n Found in the jquery.calendars.plus.js module.\n @memberof BaseCalendar\n @param dateSpec {CDate|number|string} The date as an object or string in the given format or\n an offset - numeric days from today, or string amounts and periods, e.g. '+1m +2w'.\n @param defaultDate {CDate} The date to use if no other supplied, may be null.\n @param currentDate {CDate} The current date as a possible basis for relative dates,\n if null today is used (optional)\n @param [dateFormat] {string} The expected date format - see formatDate.\n @param [settings] {object} Additional options whose attributes include:\n @property [shortYearCutoff] {number} The cutoff year for determining the century.\n @property [dayNamesShort] {string[]} Abbreviated names of the days from Sunday.\n @property [dayNames] {string[]} Names of the days from Sunday.\n @property [monthNamesShort] {string[]} Abbreviated names of the months.\n @property [monthNames] {string[]} Names of the months.\n @return {CDate} The decoded date. */\n determineDate: function(dateSpec, defaultDate, currentDate, dateFormat, settings) {\n if (currentDate && typeof currentDate !== \"object\") {\n settings = dateFormat;\n dateFormat = currentDate;\n currentDate = null;\n }\n if (typeof dateFormat !== \"string\") {\n settings = dateFormat;\n dateFormat = \"\";\n }\n var calendar = this;\n var offsetString = function(offset) {\n try {\n return calendar.parseDate(dateFormat, offset, settings);\n } catch (e) {\n }\n offset = offset.toLowerCase();\n var date = (offset.match(/^c/) && currentDate ? currentDate.newDate() : null) || calendar.today();\n var pattern = /([+-]?[0-9]+)\\s*(d|w|m|y)?/g;\n var matches = pattern.exec(offset);\n while (matches) {\n date.add(parseInt(matches[1], 10), matches[2] || \"d\");\n matches = pattern.exec(offset);\n }\n return date;\n };\n defaultDate = defaultDate ? defaultDate.newDate() : null;\n dateSpec = dateSpec == null ? defaultDate : typeof dateSpec === \"string\" ? offsetString(dateSpec) : typeof dateSpec === \"number\" ? isNaN(dateSpec) || dateSpec === Infinity || dateSpec === -Infinity ? defaultDate : calendar.today().add(dateSpec, \"d\") : calendar.newDate(dateSpec);\n return dateSpec;\n }\n });\n }\n });\n\n // node_modules/world-calendars/dist/calendars/chinese.js\n var require_chinese = __commonJS({\n \"node_modules/world-calendars/dist/calendars/chinese.js\"() {\n var main = require_main();\n var assign = require_object_assign();\n var gregorianCalendar = main.instance();\n function ChineseCalendar(language) {\n this.local = this.regionalOptions[language || \"\"] || this.regionalOptions[\"\"];\n }\n ChineseCalendar.prototype = new main.baseCalendar();\n assign(ChineseCalendar.prototype, {\n /** The calendar name.\n @memberof ChineseCalendar */\n name: \"Chinese\",\n /** Julian date of start of Gregorian epoch: 1 January 0001 CE.\n @memberof GregorianCalendar */\n jdEpoch: 17214255e-1,\n /** true if has a year zero, false if not.\n @memberof ChineseCalendar */\n hasYearZero: false,\n /** The minimum month number.\n This calendar uses month indices to account for intercalary months. \n @memberof ChineseCalendar */\n minMonth: 0,\n /** The first month in the year.\n This calendar uses month indices to account for intercalary months. \n @memberof ChineseCalendar */\n firstMonth: 0,\n /** The minimum day number.\n @memberof ChineseCalendar */\n minDay: 1,\n /** Localisations for the plugin.\n Entries are objects indexed by the language code ('' being the default US/English).\n Each object has the following attributes.\n @memberof ChineseCalendar\n @property name {string} The calendar name.\n @property epochs {string[]} The epoch names.\n @property monthNames {string[]} The long names of the months of the year.\n @property monthNamesShort {string[]} The short names of the months of the year.\n @property dayNames {string[]} The long names of the days of the week.\n @property dayNamesShort {string[]} The short names of the days of the week.\n @property dayNamesMin {string[]} The minimal names of the days of the week.\n @property dateFormat {string} The date format for this calendar.\n See the options on formatDate for details.\n @property firstDay {number} The number of the first day of the week, starting at 0.\n @property isRTL {number} true if this localisation reads right-to-left. */\n regionalOptions: {\n // Localisations\n \"\": {\n name: \"Chinese\",\n epochs: [\"BEC\", \"EC\"],\n monthNumbers: function(date, padded) {\n if (typeof date === \"string\") {\n var match = date.match(MONTH_NUMBER_REGEXP);\n return match ? match[0] : \"\";\n }\n var year = this._validateYear(date);\n var monthIndex = date.month();\n var month = \"\" + this.toChineseMonth(year, monthIndex);\n if (padded && month.length < 2) {\n month = \"0\" + month;\n }\n if (this.isIntercalaryMonth(year, monthIndex)) {\n month += \"i\";\n }\n return month;\n },\n monthNames: function(date) {\n if (typeof date === \"string\") {\n var match = date.match(MONTH_NAME_REGEXP);\n return match ? match[0] : \"\";\n }\n var year = this._validateYear(date);\n var monthIndex = date.month();\n var month = this.toChineseMonth(year, monthIndex);\n var monthName = [\n \"\\u4E00\\u6708\",\n \"\\u4E8C\\u6708\",\n \"\\u4E09\\u6708\",\n \"\\u56DB\\u6708\",\n \"\\u4E94\\u6708\",\n \"\\u516D\\u6708\",\n \"\\u4E03\\u6708\",\n \"\\u516B\\u6708\",\n \"\\u4E5D\\u6708\",\n \"\\u5341\\u6708\",\n \"\\u5341\\u4E00\\u6708\",\n \"\\u5341\\u4E8C\\u6708\"\n ][month - 1];\n if (this.isIntercalaryMonth(year, monthIndex)) {\n monthName = \"\\u95F0\" + monthName;\n }\n return monthName;\n },\n monthNamesShort: function(date) {\n if (typeof date === \"string\") {\n var match = date.match(MONTH_SHORT_NAME_REGEXP);\n return match ? match[0] : \"\";\n }\n var year = this._validateYear(date);\n var monthIndex = date.month();\n var month = this.toChineseMonth(year, monthIndex);\n var monthName = [\n \"\\u4E00\",\n \"\\u4E8C\",\n \"\\u4E09\",\n \"\\u56DB\",\n \"\\u4E94\",\n \"\\u516D\",\n \"\\u4E03\",\n \"\\u516B\",\n \"\\u4E5D\",\n \"\\u5341\",\n \"\\u5341\\u4E00\",\n \"\\u5341\\u4E8C\"\n ][month - 1];\n if (this.isIntercalaryMonth(year, monthIndex)) {\n monthName = \"\\u95F0\" + monthName;\n }\n return monthName;\n },\n parseMonth: function(year, monthString) {\n year = this._validateYear(year);\n var month = parseInt(monthString);\n var isIntercalary;\n if (!isNaN(month)) {\n var i = monthString[monthString.length - 1];\n isIntercalary = i === \"i\" || i === \"I\";\n } else {\n if (monthString[0] === \"\\u95F0\") {\n isIntercalary = true;\n monthString = monthString.substring(1);\n }\n if (monthString[monthString.length - 1] === \"\\u6708\") {\n monthString = monthString.substring(0, monthString.length - 1);\n }\n month = 1 + [\n \"\\u4E00\",\n \"\\u4E8C\",\n \"\\u4E09\",\n \"\\u56DB\",\n \"\\u4E94\",\n \"\\u516D\",\n \"\\u4E03\",\n \"\\u516B\",\n \"\\u4E5D\",\n \"\\u5341\",\n \"\\u5341\\u4E00\",\n \"\\u5341\\u4E8C\"\n ].indexOf(monthString);\n }\n var monthIndex = this.toMonthIndex(year, month, isIntercalary);\n return monthIndex;\n },\n dayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n dayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n dayNamesMin: [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"],\n digits: null,\n dateFormat: \"yyyy/mm/dd\",\n firstDay: 1,\n isRTL: false\n }\n },\n /** Check that a candidate date is from the same calendar and is valid.\n @memberof BaseCalendar\n @private\n @param year {CDate|number} The date or the year to validate.\n @param error {string} Error message if invalid.\n @return {number} The year.\n @throws Error if year out of range. */\n _validateYear: function(year, error) {\n if (year.year) {\n year = year.year();\n }\n if (typeof year !== \"number\" || year < 1888 || year > 2111) {\n throw error.replace(/\\{0\\}/, this.local.name);\n }\n return year;\n },\n /** Retrieve the month index (i.e. accounting for intercalary months).\n @memberof ChineseCalendar\n @param year {number} The year.\n @param month {number} The month (1 for first month).\n @param [isIntercalary=false] {boolean} If month is intercalary.\n @return {number} The month index (0 for first month).\n @throws Error if an invalid month/year or a different calendar used. */\n toMonthIndex: function(year, month, isIntercalary) {\n var intercalaryMonth = this.intercalaryMonth(year);\n var invalidIntercalaryMonth = isIntercalary && month !== intercalaryMonth;\n if (invalidIntercalaryMonth || month < 1 || month > 12) {\n throw main.local.invalidMonth.replace(/\\{0\\}/, this.local.name);\n }\n var monthIndex;\n if (!intercalaryMonth) {\n monthIndex = month - 1;\n } else if (!isIntercalary && month <= intercalaryMonth) {\n monthIndex = month - 1;\n } else {\n monthIndex = month;\n }\n return monthIndex;\n },\n /** Retrieve the month (i.e. accounting for intercalary months).\n @memberof ChineseCalendar\n @param year {CDate|number} The date or the year to examine.\n @param monthIndex {number} The month index (0 for first month).\n @return {number} The month (1 for first month).\n @throws Error if an invalid month/year or a different calendar used. */\n toChineseMonth: function(year, monthIndex) {\n if (year.year) {\n year = year.year();\n monthIndex = year.month();\n }\n var intercalaryMonth = this.intercalaryMonth(year);\n var maxMonthIndex = intercalaryMonth ? 12 : 11;\n if (monthIndex < 0 || monthIndex > maxMonthIndex) {\n throw main.local.invalidMonth.replace(/\\{0\\}/, this.local.name);\n }\n var month;\n if (!intercalaryMonth) {\n month = monthIndex + 1;\n } else if (monthIndex < intercalaryMonth) {\n month = monthIndex + 1;\n } else {\n month = monthIndex;\n }\n return month;\n },\n /** Determine the intercalary month of a year (if any).\n @memberof ChineseCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {number} The intercalary month number, or 0 if none.\n @throws Error if an invalid year or a different calendar used. */\n intercalaryMonth: function(year) {\n year = this._validateYear(year);\n var monthDaysTable = LUNAR_MONTH_DAYS[year - LUNAR_MONTH_DAYS[0]];\n var intercalaryMonth = monthDaysTable >> 13;\n return intercalaryMonth;\n },\n /** Determine whether this date is an intercalary month.\n @memberof ChineseCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [monthIndex] {number} The month index to examine.\n @return {boolean} true if this is an intercalary month, false if not.\n @throws Error if an invalid year or a different calendar used. */\n isIntercalaryMonth: function(year, monthIndex) {\n if (year.year) {\n year = year.year();\n monthIndex = year.month();\n }\n var intercalaryMonth = this.intercalaryMonth(year);\n return !!intercalaryMonth && intercalaryMonth === monthIndex;\n },\n /** Determine whether this date is in a leap year.\n @memberof ChineseCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {boolean} true if this is a leap year, false if not.\n @throws Error if an invalid year or a different calendar used. */\n leapYear: function(year) {\n return this.intercalaryMonth(year) !== 0;\n },\n /** Determine the week of the year for a date - ISO 8601.\n @memberof ChineseCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [monthIndex] {number} The month index to examine.\n @param [day] {number} The day to examine.\n @return {number} The week of the year.\n @throws Error if an invalid date or a different calendar used. */\n weekOfYear: function(year, monthIndex, day) {\n var validatedYear = this._validateYear(year, main.local.invalidyear);\n var packedDate = CHINESE_NEW_YEAR[validatedYear - CHINESE_NEW_YEAR[0]];\n var y = packedDate >> 9 & 4095;\n var m = packedDate >> 5 & 15;\n var d = packedDate & 31;\n var firstThursday;\n firstThursday = gregorianCalendar.newDate(y, m, d);\n firstThursday.add(4 - (firstThursday.dayOfWeek() || 7), \"d\");\n var offset = this.toJD(year, monthIndex, day) - firstThursday.toJD();\n return 1 + Math.floor(offset / 7);\n },\n /** Retrieve the number of months in a year.\n @memberof ChineseCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {number} The number of months.\n @throws Error if an invalid year or a different calendar used. */\n monthsInYear: function(year) {\n return this.leapYear(year) ? 13 : 12;\n },\n /** Retrieve the number of days in a month.\n @memberof ChineseCalendar\n @param year {CDate|number} The date to examine or the year of the month.\n @param [monthIndex] {number} The month index.\n @return {number} The number of days in this month.\n @throws Error if an invalid month/year or a different calendar used. */\n daysInMonth: function(year, monthIndex) {\n if (year.year) {\n monthIndex = year.month();\n year = year.year();\n }\n year = this._validateYear(year);\n var monthDaysTable = LUNAR_MONTH_DAYS[year - LUNAR_MONTH_DAYS[0]];\n var intercalaryMonth = monthDaysTable >> 13;\n var maxMonthIndex = intercalaryMonth ? 12 : 11;\n if (monthIndex > maxMonthIndex) {\n throw main.local.invalidMonth.replace(/\\{0\\}/, this.local.name);\n }\n var daysInMonth = monthDaysTable & 1 << 12 - monthIndex ? 30 : 29;\n return daysInMonth;\n },\n /** Determine whether this date is a week day.\n @memberof ChineseCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [monthIndex] {number} The month index to examine.\n @param [day] {number} The day to examine.\n @return {boolean} true if a week day, false if not.\n @throws Error if an invalid date or a different calendar used. */\n weekDay: function(year, monthIndex, day) {\n return (this.dayOfWeek(year, monthIndex, day) || 7) < 6;\n },\n /** Retrieve the Julian date equivalent for this date,\n i.e. days since January 1, 4713 BCE Greenwich noon.\n @memberof ChineseCalendar\n @param year {CDate|number} The date to convert or the year to convert.\n @param [monthIndex] {number} The month index to convert.\n @param [day] {number} The day to convert.\n @return {number} The equivalent Julian date.\n @throws Error if an invalid date or a different calendar used. */\n toJD: function(year, monthIndex, day) {\n var date = this._validate(year, month, day, main.local.invalidDate);\n year = this._validateYear(date.year());\n monthIndex = date.month();\n day = date.day();\n var isIntercalary = this.isIntercalaryMonth(year, monthIndex);\n var month = this.toChineseMonth(year, monthIndex);\n var solar = toSolar(year, month, day, isIntercalary);\n return gregorianCalendar.toJD(solar.year, solar.month, solar.day);\n },\n /** Create a new date from a Julian date.\n @memberof ChineseCalendar\n @param jd {number} The Julian date to convert.\n @return {CDate} The equivalent date. */\n fromJD: function(jd) {\n var date = gregorianCalendar.fromJD(jd);\n var lunar = toLunar(date.year(), date.month(), date.day());\n var monthIndex = this.toMonthIndex(\n lunar.year,\n lunar.month,\n lunar.isIntercalary\n );\n return this.newDate(lunar.year, monthIndex, lunar.day);\n },\n /** Create a new date from a string.\n @memberof ChineseCalendar\n @param dateString {string} String representing a Chinese date\n @return {CDate} The new date.\n @throws Error if an invalid date. */\n fromString: function(dateString) {\n var match = dateString.match(DATE_REGEXP);\n var year = this._validateYear(+match[1]);\n var month = +match[2];\n var isIntercalary = !!match[3];\n var monthIndex = this.toMonthIndex(year, month, isIntercalary);\n var day = +match[4];\n return this.newDate(year, monthIndex, day);\n },\n /** Add period(s) to a date.\n Cater for no year zero.\n @memberof ChineseCalendar\n @param date {CDate} The starting date.\n @param offset {number} The number of periods to adjust by.\n @param period {string} One of 'y' for year, 'm' for month, 'w' for week, 'd' for day.\n @return {CDate} The updated date.\n @throws Error if a different calendar used. */\n add: function(date, offset, period) {\n var year = date.year();\n var monthIndex = date.month();\n var isIntercalary = this.isIntercalaryMonth(year, monthIndex);\n var month = this.toChineseMonth(year, monthIndex);\n var cdate = Object.getPrototypeOf(ChineseCalendar.prototype).add.call(this, date, offset, period);\n if (period === \"y\") {\n var resultYear = cdate.year();\n var resultMonthIndex = cdate.month();\n var resultCanBeIntercalaryMonth = this.isIntercalaryMonth(resultYear, month);\n var correctedMonthIndex = isIntercalary && resultCanBeIntercalaryMonth ? this.toMonthIndex(resultYear, month, true) : this.toMonthIndex(resultYear, month, false);\n if (correctedMonthIndex !== resultMonthIndex) {\n cdate.month(correctedMonthIndex);\n }\n }\n return cdate;\n }\n });\n var DATE_REGEXP = /^\\s*(-?\\d\\d\\d\\d|\\d\\d)[-/](\\d?\\d)([iI]?)[-/](\\d?\\d)/m;\n var MONTH_NUMBER_REGEXP = /^\\d?\\d[iI]?/m;\n var MONTH_NAME_REGEXP = /^\u95F0?\u5341?[\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D]?\u6708/m;\n var MONTH_SHORT_NAME_REGEXP = /^\u95F0?\u5341?[\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D]?/m;\n main.calendars.chinese = ChineseCalendar;\n var LUNAR_MONTH_DAYS = [\n 1887,\n 5780,\n 5802,\n 19157,\n 2742,\n 50359,\n 1198,\n 2646,\n 46378,\n 7466,\n 3412,\n 30122,\n 5482,\n 67949,\n 2396,\n 5294,\n 43597,\n 6732,\n 6954,\n 36181,\n 2772,\n 4954,\n 18781,\n 2396,\n 54427,\n 5274,\n 6730,\n 47781,\n 5800,\n 6868,\n 21210,\n 4790,\n 59703,\n 2350,\n 5270,\n 46667,\n 3402,\n 3496,\n 38325,\n 1388,\n 4782,\n 18735,\n 2350,\n 52374,\n 6804,\n 7498,\n 44457,\n 2906,\n 1388,\n 29294,\n 4700,\n 63789,\n 6442,\n 6804,\n 56138,\n 5802,\n 2772,\n 38235,\n 1210,\n 4698,\n 22827,\n 5418,\n 63125,\n 3476,\n 5802,\n 43701,\n 2484,\n 5302,\n 27223,\n 2646,\n 70954,\n 7466,\n 3412,\n 54698,\n 5482,\n 2412,\n 38062,\n 5294,\n 2636,\n 32038,\n 6954,\n 60245,\n 2772,\n 4826,\n 43357,\n 2394,\n 5274,\n 39501,\n 6730,\n 72357,\n 5800,\n 5844,\n 53978,\n 4790,\n 2358,\n 38039,\n 5270,\n 87627,\n 3402,\n 3496,\n 54708,\n 5484,\n 4782,\n 43311,\n 2350,\n 3222,\n 27978,\n 7498,\n 68965,\n 2904,\n 5484,\n 45677,\n 4700,\n 6444,\n 39573,\n 6804,\n 6986,\n 19285,\n 2772,\n 62811,\n 1210,\n 4698,\n 47403,\n 5418,\n 5780,\n 38570,\n 5546,\n 76469,\n 2420,\n 5302,\n 51799,\n 2646,\n 5414,\n 36501,\n 3412,\n 5546,\n 18869,\n 2412,\n 54446,\n 5276,\n 6732,\n 48422,\n 6822,\n 2900,\n 28010,\n 4826,\n 92509,\n 2394,\n 5274,\n 55883,\n 6730,\n 6820,\n 47956,\n 5812,\n 2778,\n 18779,\n 2358,\n 62615,\n 5270,\n 5450,\n 46757,\n 3492,\n 5556,\n 27318,\n 4718,\n 67887,\n 2350,\n 3222,\n 52554,\n 7498,\n 3428,\n 38252,\n 5468,\n 4700,\n 31022,\n 6444,\n 64149,\n 6804,\n 6986,\n 43861,\n 2772,\n 5338,\n 35421,\n 2650,\n 70955,\n 5418,\n 5780,\n 54954,\n 5546,\n 2740,\n 38074,\n 5302,\n 2646,\n 29991,\n 3366,\n 61011,\n 3412,\n 5546,\n 43445,\n 2412,\n 5294,\n 35406,\n 6732,\n 72998,\n 6820,\n 6996,\n 52586,\n 2778,\n 2396,\n 38045,\n 5274,\n 6698,\n 23333,\n 6820,\n 64338,\n 5812,\n 2746,\n 43355,\n 2358,\n 5270,\n 39499,\n 5450,\n 79525,\n 3492,\n 5548\n ];\n var CHINESE_NEW_YEAR = [\n 1887,\n 966732,\n 967231,\n 967733,\n 968265,\n 968766,\n 969297,\n 969798,\n 970298,\n 970829,\n 971330,\n 971830,\n 972362,\n 972863,\n 973395,\n 973896,\n 974397,\n 974928,\n 975428,\n 975929,\n 976461,\n 976962,\n 977462,\n 977994,\n 978494,\n 979026,\n 979526,\n 980026,\n 980558,\n 981059,\n 981559,\n 982091,\n 982593,\n 983124,\n 983624,\n 984124,\n 984656,\n 985157,\n 985656,\n 986189,\n 986690,\n 987191,\n 987722,\n 988222,\n 988753,\n 989254,\n 989754,\n 990286,\n 990788,\n 991288,\n 991819,\n 992319,\n 992851,\n 993352,\n 993851,\n 994383,\n 994885,\n 995385,\n 995917,\n 996418,\n 996918,\n 997450,\n 997949,\n 998481,\n 998982,\n 999483,\n 1000014,\n 1000515,\n 1001016,\n 1001548,\n 1002047,\n 1002578,\n 1003080,\n 1003580,\n 1004111,\n 1004613,\n 1005113,\n 1005645,\n 1006146,\n 1006645,\n 1007177,\n 1007678,\n 1008209,\n 1008710,\n 1009211,\n 1009743,\n 1010243,\n 1010743,\n 1011275,\n 1011775,\n 1012306,\n 1012807,\n 1013308,\n 1013840,\n 1014341,\n 1014841,\n 1015373,\n 1015874,\n 1016404,\n 1016905,\n 1017405,\n 1017937,\n 1018438,\n 1018939,\n 1019471,\n 1019972,\n 1020471,\n 1021002,\n 1021503,\n 1022035,\n 1022535,\n 1023036,\n 1023568,\n 1024069,\n 1024568,\n 1025100,\n 1025601,\n 1026102,\n 1026633,\n 1027133,\n 1027666,\n 1028167,\n 1028666,\n 1029198,\n 1029699,\n 1030199,\n 1030730,\n 1031231,\n 1031763,\n 1032264,\n 1032764,\n 1033296,\n 1033797,\n 1034297,\n 1034828,\n 1035329,\n 1035830,\n 1036362,\n 1036861,\n 1037393,\n 1037894,\n 1038394,\n 1038925,\n 1039427,\n 1039927,\n 1040459,\n 1040959,\n 1041491,\n 1041992,\n 1042492,\n 1043023,\n 1043524,\n 1044024,\n 1044556,\n 1045057,\n 1045558,\n 1046090,\n 1046590,\n 1047121,\n 1047622,\n 1048122,\n 1048654,\n 1049154,\n 1049655,\n 1050187,\n 1050689,\n 1051219,\n 1051720,\n 1052220,\n 1052751,\n 1053252,\n 1053752,\n 1054284,\n 1054786,\n 1055285,\n 1055817,\n 1056317,\n 1056849,\n 1057349,\n 1057850,\n 1058382,\n 1058883,\n 1059383,\n 1059915,\n 1060415,\n 1060947,\n 1061447,\n 1061947,\n 1062479,\n 1062981,\n 1063480,\n 1064012,\n 1064514,\n 1065014,\n 1065545,\n 1066045,\n 1066577,\n 1067078,\n 1067578,\n 1068110,\n 1068611,\n 1069112,\n 1069642,\n 1070142,\n 1070674,\n 1071175,\n 1071675,\n 1072207,\n 1072709,\n 1073209,\n 1073740,\n 1074241,\n 1074741,\n 1075273,\n 1075773,\n 1076305,\n 1076807,\n 1077308,\n 1077839,\n 1078340,\n 1078840,\n 1079372,\n 1079871,\n 1080403,\n 1080904\n ];\n function toLunar(yearOrDate, monthOrResult, day, result) {\n var solarDate;\n var lunarDate;\n if (typeof yearOrDate === \"object\") {\n solarDate = yearOrDate;\n lunarDate = monthOrResult || {};\n } else {\n var isValidYear = typeof yearOrDate === \"number\" && yearOrDate >= 1888 && yearOrDate <= 2111;\n if (!isValidYear)\n throw new Error(\"Solar year outside range 1888-2111\");\n var isValidMonth = typeof monthOrResult === \"number\" && monthOrResult >= 1 && monthOrResult <= 12;\n if (!isValidMonth)\n throw new Error(\"Solar month outside range 1 - 12\");\n var isValidDay = typeof day === \"number\" && day >= 1 && day <= 31;\n if (!isValidDay)\n throw new Error(\"Solar day outside range 1 - 31\");\n solarDate = {\n year: yearOrDate,\n month: monthOrResult,\n day\n };\n lunarDate = result || {};\n }\n var chineseNewYearPackedDate = CHINESE_NEW_YEAR[solarDate.year - CHINESE_NEW_YEAR[0]];\n var packedDate = solarDate.year << 9 | solarDate.month << 5 | solarDate.day;\n lunarDate.year = packedDate >= chineseNewYearPackedDate ? solarDate.year : solarDate.year - 1;\n chineseNewYearPackedDate = CHINESE_NEW_YEAR[lunarDate.year - CHINESE_NEW_YEAR[0]];\n var y = chineseNewYearPackedDate >> 9 & 4095;\n var m = chineseNewYearPackedDate >> 5 & 15;\n var d = chineseNewYearPackedDate & 31;\n var daysFromNewYear;\n var chineseNewYearJSDate = new Date(y, m - 1, d);\n var jsDate = new Date(solarDate.year, solarDate.month - 1, solarDate.day);\n daysFromNewYear = Math.round(\n (jsDate - chineseNewYearJSDate) / (24 * 3600 * 1e3)\n );\n var monthDaysTable = LUNAR_MONTH_DAYS[lunarDate.year - LUNAR_MONTH_DAYS[0]];\n var i;\n for (i = 0; i < 13; i++) {\n var daysInMonth = monthDaysTable & 1 << 12 - i ? 30 : 29;\n if (daysFromNewYear < daysInMonth) {\n break;\n }\n daysFromNewYear -= daysInMonth;\n }\n var intercalaryMonth = monthDaysTable >> 13;\n if (!intercalaryMonth || i < intercalaryMonth) {\n lunarDate.isIntercalary = false;\n lunarDate.month = 1 + i;\n } else if (i === intercalaryMonth) {\n lunarDate.isIntercalary = true;\n lunarDate.month = i;\n } else {\n lunarDate.isIntercalary = false;\n lunarDate.month = i;\n }\n lunarDate.day = 1 + daysFromNewYear;\n return lunarDate;\n }\n function toSolar(yearOrDate, monthOrResult, day, isIntercalaryOrResult, result) {\n var solarDate;\n var lunarDate;\n if (typeof yearOrDate === \"object\") {\n lunarDate = yearOrDate;\n solarDate = monthOrResult || {};\n } else {\n var isValidYear = typeof yearOrDate === \"number\" && yearOrDate >= 1888 && yearOrDate <= 2111;\n if (!isValidYear)\n throw new Error(\"Lunar year outside range 1888-2111\");\n var isValidMonth = typeof monthOrResult === \"number\" && monthOrResult >= 1 && monthOrResult <= 12;\n if (!isValidMonth)\n throw new Error(\"Lunar month outside range 1 - 12\");\n var isValidDay = typeof day === \"number\" && day >= 1 && day <= 30;\n if (!isValidDay)\n throw new Error(\"Lunar day outside range 1 - 30\");\n var isIntercalary;\n if (typeof isIntercalaryOrResult === \"object\") {\n isIntercalary = false;\n solarDate = isIntercalaryOrResult;\n } else {\n isIntercalary = !!isIntercalaryOrResult;\n solarDate = result || {};\n }\n lunarDate = {\n year: yearOrDate,\n month: monthOrResult,\n day,\n isIntercalary\n };\n }\n var daysFromNewYear;\n daysFromNewYear = lunarDate.day - 1;\n var monthDaysTable = LUNAR_MONTH_DAYS[lunarDate.year - LUNAR_MONTH_DAYS[0]];\n var intercalaryMonth = monthDaysTable >> 13;\n var monthsFromNewYear;\n if (!intercalaryMonth) {\n monthsFromNewYear = lunarDate.month - 1;\n } else if (lunarDate.month > intercalaryMonth) {\n monthsFromNewYear = lunarDate.month;\n } else if (lunarDate.isIntercalary) {\n monthsFromNewYear = lunarDate.month;\n } else {\n monthsFromNewYear = lunarDate.month - 1;\n }\n for (var i = 0; i < monthsFromNewYear; i++) {\n var daysInMonth = monthDaysTable & 1 << 12 - i ? 30 : 29;\n daysFromNewYear += daysInMonth;\n }\n var packedDate = CHINESE_NEW_YEAR[lunarDate.year - CHINESE_NEW_YEAR[0]];\n var y = packedDate >> 9 & 4095;\n var m = packedDate >> 5 & 15;\n var d = packedDate & 31;\n var jsDate = new Date(y, m - 1, d + daysFromNewYear);\n solarDate.year = jsDate.getFullYear();\n solarDate.month = 1 + jsDate.getMonth();\n solarDate.day = jsDate.getDate();\n return solarDate;\n }\n }\n });\n\n // node_modules/world-calendars/dist/calendars/coptic.js\n var require_coptic = __commonJS({\n \"node_modules/world-calendars/dist/calendars/coptic.js\"() {\n var main = require_main();\n var assign = require_object_assign();\n function CopticCalendar(language) {\n this.local = this.regionalOptions[language || \"\"] || this.regionalOptions[\"\"];\n }\n CopticCalendar.prototype = new main.baseCalendar();\n assign(CopticCalendar.prototype, {\n /** The calendar name.\n @memberof CopticCalendar */\n name: \"Coptic\",\n /** Julian date of start of Coptic epoch: 29 August 284 CE (Gregorian).\n @memberof CopticCalendar */\n jdEpoch: 18250295e-1,\n /** Days per month in a common year.\n @memberof CopticCalendar */\n daysPerMonth: [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 5],\n /** true if has a year zero, false if not.\n @memberof CopticCalendar */\n hasYearZero: false,\n /** The minimum month number.\n @memberof CopticCalendar */\n minMonth: 1,\n /** The first month in the year.\n @memberof CopticCalendar */\n firstMonth: 1,\n /** The minimum day number.\n @memberof CopticCalendar */\n minDay: 1,\n /** Localisations for the plugin.\n Entries are objects indexed by the language code ('' being the default US/English).\n Each object has the following attributes.\n @memberof CopticCalendar\n @property name {string} The calendar name.\n @property epochs {string[]} The epoch names.\n @property monthNames {string[]} The long names of the months of the year.\n @property monthNamesShort {string[]} The short names of the months of the year.\n @property dayNames {string[]} The long names of the days of the week.\n @property dayNamesShort {string[]} The short names of the days of the week.\n @property dayNamesMin {string[]} The minimal names of the days of the week.\n @property dateFormat {string} The date format for this calendar.\n See the options on formatDate for details.\n @property firstDay {number} The number of the first day of the week, starting at 0.\n @property isRTL {number} true if this localisation reads right-to-left. */\n regionalOptions: {\n // Localisations\n \"\": {\n name: \"Coptic\",\n epochs: [\"BAM\", \"AM\"],\n monthNames: [\n \"Thout\",\n \"Paopi\",\n \"Hathor\",\n \"Koiak\",\n \"Tobi\",\n \"Meshir\",\n \"Paremhat\",\n \"Paremoude\",\n \"Pashons\",\n \"Paoni\",\n \"Epip\",\n \"Mesori\",\n \"Pi Kogi Enavot\"\n ],\n monthNamesShort: [\n \"Tho\",\n \"Pao\",\n \"Hath\",\n \"Koi\",\n \"Tob\",\n \"Mesh\",\n \"Pat\",\n \"Pad\",\n \"Pash\",\n \"Pao\",\n \"Epi\",\n \"Meso\",\n \"PiK\"\n ],\n dayNames: [\"Tkyriaka\", \"Pesnau\", \"Pshoment\", \"Peftoou\", \"Ptiou\", \"Psoou\", \"Psabbaton\"],\n dayNamesShort: [\"Tky\", \"Pes\", \"Psh\", \"Pef\", \"Pti\", \"Pso\", \"Psa\"],\n dayNamesMin: [\"Tk\", \"Pes\", \"Psh\", \"Pef\", \"Pt\", \"Pso\", \"Psa\"],\n digits: null,\n dateFormat: \"dd/mm/yyyy\",\n firstDay: 0,\n isRTL: false\n }\n },\n /** Determine whether this date is in a leap year.\n @memberof CopticCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {boolean} true if this is a leap year, false if not.\n @throws Error if an invalid year or a different calendar used. */\n leapYear: function(year) {\n var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n var year = date.year() + (date.year() < 0 ? 1 : 0);\n return year % 4 === 3 || year % 4 === -1;\n },\n /** Retrieve the number of months in a year.\n @memberof CopticCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {number} The number of months.\n @throws Error if an invalid year or a different calendar used. */\n monthsInYear: function(year) {\n this._validate(\n year,\n this.minMonth,\n this.minDay,\n main.local.invalidYear || main.regionalOptions[\"\"].invalidYear\n );\n return 13;\n },\n /** Determine the week of the year for a date.\n @memberof CopticCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number) the month to examine.\n @param [day] {number} The day to examine.\n @return {number} The week of the year.\n @throws Error if an invalid date or a different calendar used. */\n weekOfYear: function(year, month, day) {\n var checkDate = this.newDate(year, month, day);\n checkDate.add(-checkDate.dayOfWeek(), \"d\");\n return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1;\n },\n /** Retrieve the number of days in a month.\n @memberof CopticCalendar\n @param year {CDate|number} The date to examine or the year of the month.\n @param [month] {number} The month.\n @return {number} The number of days in this month.\n @throws Error if an invalid month/year or a different calendar used. */\n daysInMonth: function(year, month) {\n var date = this._validate(year, month, this.minDay, main.local.invalidMonth);\n return this.daysPerMonth[date.month() - 1] + (date.month() === 13 && this.leapYear(date.year()) ? 1 : 0);\n },\n /** Determine whether this date is a week day.\n @memberof CopticCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param month {number} The month to examine.\n @param day {number} The day to examine.\n @return {boolean} true if a week day, false if not.\n @throws Error if an invalid date or a different calendar used. */\n weekDay: function(year, month, day) {\n return (this.dayOfWeek(year, month, day) || 7) < 6;\n },\n /** Retrieve the Julian date equivalent for this date,\n i.e. days since January 1, 4713 BCE Greenwich noon.\n @memberof CopticCalendar\n @param year {CDate|number} The date to convert or the year to convert.\n @param [month] {number) the month to convert.\n @param [day] {number} The day to convert.\n @return {number} The equivalent Julian date.\n @throws Error if an invalid date or a different calendar used. */\n toJD: function(year, month, day) {\n var date = this._validate(year, month, day, main.local.invalidDate);\n year = date.year();\n if (year < 0) {\n year++;\n }\n return date.day() + (date.month() - 1) * 30 + (year - 1) * 365 + Math.floor(year / 4) + this.jdEpoch - 1;\n },\n /** Create a new date from a Julian date.\n @memberof CopticCalendar\n @param jd {number} The Julian date to convert.\n @return {CDate} The equivalent date. */\n fromJD: function(jd) {\n var c = Math.floor(jd) + 0.5 - this.jdEpoch;\n var year = Math.floor((c - Math.floor((c + 366) / 1461)) / 365) + 1;\n if (year <= 0) {\n year--;\n }\n c = Math.floor(jd) + 0.5 - this.newDate(year, 1, 1).toJD();\n var month = Math.floor(c / 30) + 1;\n var day = c - (month - 1) * 30 + 1;\n return this.newDate(year, month, day);\n }\n });\n main.calendars.coptic = CopticCalendar;\n }\n });\n\n // node_modules/world-calendars/dist/calendars/discworld.js\n var require_discworld = __commonJS({\n \"node_modules/world-calendars/dist/calendars/discworld.js\"() {\n var main = require_main();\n var assign = require_object_assign();\n function DiscworldCalendar(language) {\n this.local = this.regionalOptions[language || \"\"] || this.regionalOptions[\"\"];\n }\n DiscworldCalendar.prototype = new main.baseCalendar();\n assign(DiscworldCalendar.prototype, {\n /** The calendar name.\n @memberof DiscworldCalendar */\n name: \"Discworld\",\n /** Julian date of start of Discworld epoch: 1 January 0001 CE.\n @memberof DiscworldCalendar */\n jdEpoch: 17214255e-1,\n /** Days per month in a common year.\n @memberof DiscworldCalendar */\n daysPerMonth: [16, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32],\n /** true if has a year zero, false if not.\n @memberof DiscworldCalendar */\n hasYearZero: false,\n /** The minimum month number.\n @memberof DiscworldCalendar */\n minMonth: 1,\n /** The first month in the year.\n @memberof DiscworldCalendar */\n firstMonth: 1,\n /** The minimum day number.\n @memberof DiscworldCalendar */\n minDay: 1,\n /** Localisations for the plugin.\n Entries are objects indexed by the language code ('' being the default US/English).\n Each object has the following attributes.\n @memberof DiscworldCalendar\n @property name {string} The calendar name.\n @property epochs {string[]} The epoch names.\n @property monthNames {string[]} The long names of the months of the year.\n @property monthNamesShort {string[]} The short names of the months of the year.\n @property dayNames {string[]} The long names of the days of the week.\n @property dayNamesShort {string[]} The short names of the days of the week.\n @property dayNamesMin {string[]} The minimal names of the days of the week.\n @property dateFormat {string} The date format for this calendar.\n See the options on formatDate for details.\n @property firstDay {number} The number of the first day of the week, starting at 0.\n @property isRTL {number} true if this localisation reads right-to-left. */\n regionalOptions: {\n // Localisations\n \"\": {\n name: \"Discworld\",\n epochs: [\"BUC\", \"UC\"],\n monthNames: [\n \"Ick\",\n \"Offle\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"Grune\",\n \"August\",\n \"Spune\",\n \"Sektober\",\n \"Ember\",\n \"December\"\n ],\n monthNamesShort: [\"Ick\", \"Off\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Gru\", \"Aug\", \"Spu\", \"Sek\", \"Emb\", \"Dec\"],\n dayNames: [\"Sunday\", \"Octeday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n dayNamesShort: [\"Sun\", \"Oct\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n dayNamesMin: [\"Su\", \"Oc\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"],\n digits: null,\n dateFormat: \"yyyy/mm/dd\",\n firstDay: 2,\n isRTL: false\n }\n },\n /** Determine whether this date is in a leap year.\n @memberof DiscworldCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {boolean} true if this is a leap year, false if not.\n @throws Error if an invalid year or a different calendar used. */\n leapYear: function(year) {\n this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n return false;\n },\n /** Retrieve the number of months in a year.\n @memberof DiscworldCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {number} The number of months.\n @throws Error if an invalid year or a different calendar used. */\n monthsInYear: function(year) {\n this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n return 13;\n },\n /** Retrieve the number of days in a year.\n @memberof DiscworldCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {number} The number of days.\n @throws Error if an invalid year or a different calendar used. */\n daysInYear: function(year) {\n this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n return 400;\n },\n /** Determine the week of the year for a date.\n @memberof DiscworldCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {number} The week of the year.\n @throws Error if an invalid date or a different calendar used. */\n weekOfYear: function(year, month, day) {\n var checkDate = this.newDate(year, month, day);\n checkDate.add(-checkDate.dayOfWeek(), \"d\");\n return Math.floor((checkDate.dayOfYear() - 1) / 8) + 1;\n },\n /** Retrieve the number of days in a month.\n @memberof DiscworldCalendar\n @param year {CDate|number} The date to examine or the year of the month.\n @param [month] {number} The month.\n @return {number} The number of days in this month.\n @throws Error if an invalid month/year or a different calendar used. */\n daysInMonth: function(year, month) {\n var date = this._validate(year, month, this.minDay, main.local.invalidMonth);\n return this.daysPerMonth[date.month() - 1];\n },\n /** Retrieve the number of days in a week.\n @memberof DiscworldCalendar\n @return {number} The number of days. */\n daysInWeek: function() {\n return 8;\n },\n /** Retrieve the day of the week for a date.\n @memberof DiscworldCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {number} The day of the week: 0 to number of days - 1.\n @throws Error if an invalid date or a different calendar used. */\n dayOfWeek: function(year, month, day) {\n var date = this._validate(year, month, day, main.local.invalidDate);\n return (date.day() + 1) % 8;\n },\n /** Determine whether this date is a week day.\n @memberof DiscworldCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {boolean} true if a week day, false if not.\n @throws Error if an invalid date or a different calendar used. */\n weekDay: function(year, month, day) {\n var dow = this.dayOfWeek(year, month, day);\n return dow >= 2 && dow <= 6;\n },\n /** Retrieve additional information about a date.\n @memberof DiscworldCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {object} Additional information - contents depends on calendar.\n @throws Error if an invalid date or a different calendar used. */\n extraInfo: function(year, month, day) {\n var date = this._validate(year, month, day, main.local.invalidDate);\n return { century: centuries[Math.floor((date.year() - 1) / 100) + 1] || \"\" };\n },\n /** Retrieve the Julian date equivalent for this date,\n i.e. days since January 1, 4713 BCE Greenwich noon.\n @memberof DiscworldCalendar\n @param year {CDate|number} The date to convert or the year to convert.\n @param [month] {number} The month to convert.\n @param [day] {number} The day to convert.\n @return {number} The equivalent Julian date.\n @throws Error if an invalid date or a different calendar used. */\n toJD: function(year, month, day) {\n var date = this._validate(year, month, day, main.local.invalidDate);\n year = date.year() + (date.year() < 0 ? 1 : 0);\n month = date.month();\n day = date.day();\n return day + (month > 1 ? 16 : 0) + (month > 2 ? (month - 2) * 32 : 0) + (year - 1) * 400 + this.jdEpoch - 1;\n },\n /** Create a new date from a Julian date.\n @memberof DiscworldCalendar\n @param jd {number} The Julian date to convert.\n @return {CDate} The equivalent date. */\n fromJD: function(jd) {\n jd = Math.floor(jd + 0.5) - Math.floor(this.jdEpoch) - 1;\n var year = Math.floor(jd / 400) + 1;\n jd -= (year - 1) * 400;\n jd += jd > 15 ? 16 : 0;\n var month = Math.floor(jd / 32) + 1;\n var day = jd - (month - 1) * 32 + 1;\n return this.newDate(year <= 0 ? year - 1 : year, month, day);\n }\n });\n var centuries = {\n 20: \"Fruitbat\",\n 21: \"Anchovy\"\n };\n main.calendars.discworld = DiscworldCalendar;\n }\n });\n\n // node_modules/world-calendars/dist/calendars/ethiopian.js\n var require_ethiopian = __commonJS({\n \"node_modules/world-calendars/dist/calendars/ethiopian.js\"() {\n var main = require_main();\n var assign = require_object_assign();\n function EthiopianCalendar(language) {\n this.local = this.regionalOptions[language || \"\"] || this.regionalOptions[\"\"];\n }\n EthiopianCalendar.prototype = new main.baseCalendar();\n assign(EthiopianCalendar.prototype, {\n /** The calendar name.\n @memberof EthiopianCalendar */\n name: \"Ethiopian\",\n /** Julian date of start of Ethiopian epoch: 27 August 8 CE (Gregorian).\n @memberof EthiopianCalendar */\n jdEpoch: 17242205e-1,\n /** Days per month in a common year.\n @memberof EthiopianCalendar */\n daysPerMonth: [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 5],\n /** true if has a year zero, false if not.\n @memberof EthiopianCalendar */\n hasYearZero: false,\n /** The minimum month number.\n @memberof EthiopianCalendar */\n minMonth: 1,\n /** The first month in the year.\n @memberof EthiopianCalendar */\n firstMonth: 1,\n /** The minimum day number.\n @memberof EthiopianCalendar */\n minDay: 1,\n /** Localisations for the plugin.\n Entries are objects indexed by the language code ('' being the default US/English).\n Each object has the following attributes.\n @memberof EthiopianCalendar\n @property name {string} The calendar name.\n @property epochs {string[]} The epoch names.\n @property monthNames {string[]} The long names of the months of the year.\n @property monthNamesShort {string[]} The short names of the months of the year.\n @property dayNames {string[]} The long names of the days of the week.\n @property dayNamesShort {string[]} The short names of the days of the week.\n @property dayNamesMin {string[]} The minimal names of the days of the week.\n @property dateFormat {string} The date format for this calendar.\n See the options on formatDate for details.\n @property firstDay {number} The number of the first day of the week, starting at 0.\n @property isRTL {number} true if this localisation reads right-to-left. */\n regionalOptions: {\n // Localisations\n \"\": {\n name: \"Ethiopian\",\n epochs: [\"BEE\", \"EE\"],\n monthNames: [\n \"Meskerem\",\n \"Tikemet\",\n \"Hidar\",\n \"Tahesas\",\n \"Tir\",\n \"Yekatit\",\n \"Megabit\",\n \"Miazia\",\n \"Genbot\",\n \"Sene\",\n \"Hamle\",\n \"Nehase\",\n \"Pagume\"\n ],\n monthNamesShort: [\n \"Mes\",\n \"Tik\",\n \"Hid\",\n \"Tah\",\n \"Tir\",\n \"Yek\",\n \"Meg\",\n \"Mia\",\n \"Gen\",\n \"Sen\",\n \"Ham\",\n \"Neh\",\n \"Pag\"\n ],\n dayNames: [\"Ehud\", \"Segno\", \"Maksegno\", \"Irob\", \"Hamus\", \"Arb\", \"Kidame\"],\n dayNamesShort: [\"Ehu\", \"Seg\", \"Mak\", \"Iro\", \"Ham\", \"Arb\", \"Kid\"],\n dayNamesMin: [\"Eh\", \"Se\", \"Ma\", \"Ir\", \"Ha\", \"Ar\", \"Ki\"],\n digits: null,\n dateFormat: \"dd/mm/yyyy\",\n firstDay: 0,\n isRTL: false\n }\n },\n /** Determine whether this date is in a leap year.\n @memberof EthiopianCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {boolean} true if this is a leap year, false if not.\n @throws Error if an invalid year or a different calendar used. */\n leapYear: function(year) {\n var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n var year = date.year() + (date.year() < 0 ? 1 : 0);\n return year % 4 === 3 || year % 4 === -1;\n },\n /** Retrieve the number of months in a year.\n @memberof EthiopianCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {number} The number of months.\n @throws Error if an invalid year or a different calendar used. */\n monthsInYear: function(year) {\n this._validate(\n year,\n this.minMonth,\n this.minDay,\n main.local.invalidYear || main.regionalOptions[\"\"].invalidYear\n );\n return 13;\n },\n /** Determine the week of the year for a date.\n @memberof EthiopianCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {number} The week of the year.\n @throws Error if an invalid date or a different calendar used. */\n weekOfYear: function(year, month, day) {\n var checkDate = this.newDate(year, month, day);\n checkDate.add(-checkDate.dayOfWeek(), \"d\");\n return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1;\n },\n /** Retrieve the number of days in a month.\n @memberof EthiopianCalendar\n @param year {CDate|number} The date to examine or the year of the month.\n @param [month] {number} The month.\n @return {number} The number of days in this month.\n @throws Error if an invalid month/year or a different calendar used. */\n daysInMonth: function(year, month) {\n var date = this._validate(year, month, this.minDay, main.local.invalidMonth);\n return this.daysPerMonth[date.month() - 1] + (date.month() === 13 && this.leapYear(date.year()) ? 1 : 0);\n },\n /** Determine whether this date is a week day.\n @memberof EthiopianCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {boolean} true if a week day, false if not.\n @throws Error if an invalid date or a different calendar used. */\n weekDay: function(year, month, day) {\n return (this.dayOfWeek(year, month, day) || 7) < 6;\n },\n /** Retrieve the Julian date equivalent for this date,\n i.e. days since January 1, 4713 BCE Greenwich noon.\n @memberof EthiopianCalendar\n @param year {CDate|number} The date to convert or the year to convert.\n @param [month] {number} The month to convert.\n @param [day] {number} The day to convert.\n @return {number} The equivalent Julian date.\n @throws Error if an invalid date or a different calendar used. */\n toJD: function(year, month, day) {\n var date = this._validate(year, month, day, main.local.invalidDate);\n year = date.year();\n if (year < 0) {\n year++;\n }\n return date.day() + (date.month() - 1) * 30 + (year - 1) * 365 + Math.floor(year / 4) + this.jdEpoch - 1;\n },\n /** Create a new date from a Julian date.\n @memberof EthiopianCalendar\n @param jd {number} the Julian date to convert.\n @return {CDate} the equivalent date. */\n fromJD: function(jd) {\n var c = Math.floor(jd) + 0.5 - this.jdEpoch;\n var year = Math.floor((c - Math.floor((c + 366) / 1461)) / 365) + 1;\n if (year <= 0) {\n year--;\n }\n c = Math.floor(jd) + 0.5 - this.newDate(year, 1, 1).toJD();\n var month = Math.floor(c / 30) + 1;\n var day = c - (month - 1) * 30 + 1;\n return this.newDate(year, month, day);\n }\n });\n main.calendars.ethiopian = EthiopianCalendar;\n }\n });\n\n // node_modules/world-calendars/dist/calendars/hebrew.js\n var require_hebrew = __commonJS({\n \"node_modules/world-calendars/dist/calendars/hebrew.js\"() {\n var main = require_main();\n var assign = require_object_assign();\n function HebrewCalendar(language) {\n this.local = this.regionalOptions[language || \"\"] || this.regionalOptions[\"\"];\n }\n HebrewCalendar.prototype = new main.baseCalendar();\n assign(HebrewCalendar.prototype, {\n /** The calendar name.\n @memberof HebrewCalendar */\n name: \"Hebrew\",\n /** Julian date of start of Hebrew epoch: 7 October 3761 BCE.\n @memberof HebrewCalendar */\n jdEpoch: 347995.5,\n /** Days per month in a common year.\n @memberof HebrewCalendar */\n daysPerMonth: [30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 29],\n /** true if has a year zero, false if not.\n @memberof HebrewCalendar */\n hasYearZero: false,\n /** The minimum month number.\n @memberof HebrewCalendar */\n minMonth: 1,\n /** The first month in the year.\n @memberof HebrewCalendar */\n firstMonth: 7,\n /** The minimum day number.\n @memberof HebrewCalendar */\n minDay: 1,\n /** Localisations for the plugin.\n Entries are objects indexed by the language code ('' being the default US/English).\n Each object has the following attributes.\n @memberof HebrewCalendar\n @property name {string} The calendar name.\n @property epochs {string[]} The epoch names.\n @property monthNames {string[]} The long names of the months of the year.\n @property monthNamesShort {string[]} The short names of the months of the year.\n @property dayNames {string[]} The long names of the days of the week.\n @property dayNamesShort {string[]} The short names of the days of the week.\n @property dayNamesMin {string[]} The minimal names of the days of the week.\n @property dateFormat {string} The date format for this calendar.\n See the options on formatDate for details.\n @property firstDay {number} The number of the first day of the week, starting at 0.\n @property isRTL {number} true if this localisation reads right-to-left. */\n regionalOptions: {\n // Localisations\n \"\": {\n name: \"Hebrew\",\n epochs: [\"BAM\", \"AM\"],\n monthNames: [\n \"Nisan\",\n \"Iyar\",\n \"Sivan\",\n \"Tammuz\",\n \"Av\",\n \"Elul\",\n \"Tishrei\",\n \"Cheshvan\",\n \"Kislev\",\n \"Tevet\",\n \"Shevat\",\n \"Adar\",\n \"Adar II\"\n ],\n monthNamesShort: [\"Nis\", \"Iya\", \"Siv\", \"Tam\", \"Av\", \"Elu\", \"Tis\", \"Che\", \"Kis\", \"Tev\", \"She\", \"Ada\", \"Ad2\"],\n dayNames: [\"Yom Rishon\", \"Yom Sheni\", \"Yom Shlishi\", \"Yom Revi'i\", \"Yom Chamishi\", \"Yom Shishi\", \"Yom Shabbat\"],\n dayNamesShort: [\"Ris\", \"She\", \"Shl\", \"Rev\", \"Cha\", \"Shi\", \"Sha\"],\n dayNamesMin: [\"Ri\", \"She\", \"Shl\", \"Re\", \"Ch\", \"Shi\", \"Sha\"],\n digits: null,\n dateFormat: \"dd/mm/yyyy\",\n firstDay: 0,\n isRTL: false\n }\n },\n /** Determine whether this date is in a leap year.\n @memberof HebrewCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {boolean} true if this is a leap year, false if not.\n @throws Error if an invalid year or a different calendar used. */\n leapYear: function(year) {\n var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n return this._leapYear(date.year());\n },\n /** Determine whether this date is in a leap year.\n @memberof HebrewCalendar\n @private\n @param year {number} The year to examine.\n @return {boolean} true if this is a leap year, false if not.\n @throws Error if an invalid year or a different calendar used. */\n _leapYear: function(year) {\n year = year < 0 ? year + 1 : year;\n return mod(year * 7 + 1, 19) < 7;\n },\n /** Retrieve the number of months in a year.\n @memberof HebrewCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {number} The number of months.\n @throws Error if an invalid year or a different calendar used. */\n monthsInYear: function(year) {\n this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n return this._leapYear(year.year ? year.year() : year) ? 13 : 12;\n },\n /** Determine the week of the year for a date.\n @memberof HebrewCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {number} The week of the year.\n @throws Error if an invalid date or a different calendar used. */\n weekOfYear: function(year, month, day) {\n var checkDate = this.newDate(year, month, day);\n checkDate.add(-checkDate.dayOfWeek(), \"d\");\n return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1;\n },\n /** Retrieve the number of days in a year.\n @memberof HebrewCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {number} The number of days.\n @throws Error if an invalid year or a different calendar used. */\n daysInYear: function(year) {\n var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n year = date.year();\n return this.toJD(year === -1 ? 1 : year + 1, 7, 1) - this.toJD(year, 7, 1);\n },\n /** Retrieve the number of days in a month.\n @memberof HebrewCalendar\n @param year {CDate|number} The date to examine or the year of the month.\n @param [month] {number} The month.\n @return {number} The number of days in this month.\n @throws Error if an invalid month/year or a different calendar used. */\n daysInMonth: function(year, month) {\n if (year.year) {\n month = year.month();\n year = year.year();\n }\n this._validate(year, month, this.minDay, main.local.invalidMonth);\n return month === 12 && this.leapYear(year) ? 30 : (\n // Adar I\n month === 8 && mod(this.daysInYear(year), 10) === 5 ? 30 : (\n // Cheshvan in shlemah year\n month === 9 && mod(this.daysInYear(year), 10) === 3 ? 29 : (\n // Kislev in chaserah year\n this.daysPerMonth[month - 1]\n )\n )\n );\n },\n /** Determine whether this date is a week day.\n @memberof HebrewCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {boolean} true if a week day, false if not.\n @throws Error if an invalid date or a different calendar used. */\n weekDay: function(year, month, day) {\n return this.dayOfWeek(year, month, day) !== 6;\n },\n /** Retrieve additional information about a date - year type.\n @memberof HebrewCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {object} Additional information - contents depends on calendar.\n @throws Error if an invalid date or a different calendar used. */\n extraInfo: function(year, month, day) {\n var date = this._validate(year, month, day, main.local.invalidDate);\n return { yearType: (this.leapYear(date) ? \"embolismic\" : \"common\") + \" \" + [\"deficient\", \"regular\", \"complete\"][this.daysInYear(date) % 10 - 3] };\n },\n /** Retrieve the Julian date equivalent for this date,\n i.e. days since January 1, 4713 BCE Greenwich noon.\n @memberof HebrewCalendar\n @param year {CDate)|number} The date to convert or the year to convert.\n @param [month] {number} The month to convert.\n @param [day] {number} The day to convert.\n @return {number} The equivalent Julian date.\n @throws Error if an invalid date or a different calendar used. */\n toJD: function(year, month, day) {\n var date = this._validate(year, month, day, main.local.invalidDate);\n year = date.year();\n month = date.month();\n day = date.day();\n var adjYear = year <= 0 ? year + 1 : year;\n var jd = this.jdEpoch + this._delay1(adjYear) + this._delay2(adjYear) + day + 1;\n if (month < 7) {\n for (var m = 7; m <= this.monthsInYear(year); m++) {\n jd += this.daysInMonth(year, m);\n }\n for (var m = 1; m < month; m++) {\n jd += this.daysInMonth(year, m);\n }\n } else {\n for (var m = 7; m < month; m++) {\n jd += this.daysInMonth(year, m);\n }\n }\n return jd;\n },\n /** Test for delay of start of new year and to avoid\n Sunday, Wednesday, or Friday as start of the new year.\n @memberof HebrewCalendar\n @private\n @param year {number} The year to examine.\n @return {number} The days to offset by. */\n _delay1: function(year) {\n var months = Math.floor((235 * year - 234) / 19);\n var parts = 12084 + 13753 * months;\n var day = months * 29 + Math.floor(parts / 25920);\n if (mod(3 * (day + 1), 7) < 3) {\n day++;\n }\n return day;\n },\n /** Check for delay in start of new year due to length of adjacent years.\n @memberof HebrewCalendar\n @private\n @param year {number} The year to examine.\n @return {number} The days to offset by. */\n _delay2: function(year) {\n var last = this._delay1(year - 1);\n var present = this._delay1(year);\n var next = this._delay1(year + 1);\n return next - present === 356 ? 2 : present - last === 382 ? 1 : 0;\n },\n /** Create a new date from a Julian date.\n @memberof HebrewCalendar\n @param jd {number} The Julian date to convert.\n @return {CDate} The equivalent date. */\n fromJD: function(jd) {\n jd = Math.floor(jd) + 0.5;\n var year = Math.floor((jd - this.jdEpoch) * 98496 / 35975351) - 1;\n while (jd >= this.toJD(year === -1 ? 1 : year + 1, 7, 1)) {\n year++;\n }\n var month = jd < this.toJD(year, 1, 1) ? 7 : 1;\n while (jd > this.toJD(year, month, this.daysInMonth(year, month))) {\n month++;\n }\n var day = jd - this.toJD(year, month, 1) + 1;\n return this.newDate(year, month, day);\n }\n });\n function mod(a, b) {\n return a - b * Math.floor(a / b);\n }\n main.calendars.hebrew = HebrewCalendar;\n }\n });\n\n // node_modules/world-calendars/dist/calendars/islamic.js\n var require_islamic = __commonJS({\n \"node_modules/world-calendars/dist/calendars/islamic.js\"() {\n var main = require_main();\n var assign = require_object_assign();\n function IslamicCalendar(language) {\n this.local = this.regionalOptions[language || \"\"] || this.regionalOptions[\"\"];\n }\n IslamicCalendar.prototype = new main.baseCalendar();\n assign(IslamicCalendar.prototype, {\n /** The calendar name.\n @memberof IslamicCalendar */\n name: \"Islamic\",\n /** Julian date of start of Islamic epoch: 16 July 622 CE.\n @memberof IslamicCalendar */\n jdEpoch: 19484395e-1,\n /** Days per month in a common year.\n @memberof IslamicCalendar */\n daysPerMonth: [30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29],\n /** true if has a year zero, false if not.\n @memberof IslamicCalendar */\n hasYearZero: false,\n /** The minimum month number.\n @memberof IslamicCalendar */\n minMonth: 1,\n /** The first month in the year.\n @memberof IslamicCalendar */\n firstMonth: 1,\n /** The minimum day number.\n @memberof IslamicCalendar */\n minDay: 1,\n /** Localisations for the plugin.\n Entries are objects indexed by the language code ('' being the default US/English).\n Each object has the following attributes.\n @memberof IslamicCalendar\n @property name {string} The calendar name.\n @property epochs {string[]} The epoch names.\n @property monthNames {string[]} The long names of the months of the year.\n @property monthNamesShort {string[]} The short names of the months of the year.\n @property dayNames {string[]} The long names of the days of the week.\n @property dayNamesShort {string[]} The short names of the days of the week.\n @property dayNamesMin {string[]} The minimal names of the days of the week.\n @property dateFormat {string} The date format for this calendar.\n See the options on formatDate for details.\n @property firstDay {number} The number of the first day of the week, starting at 0.\n @property isRTL {number} true if this localisation reads right-to-left. */\n regionalOptions: {\n // Localisations\n \"\": {\n name: \"Islamic\",\n epochs: [\"BH\", \"AH\"],\n monthNames: [\n \"Muharram\",\n \"Safar\",\n \"Rabi' al-awwal\",\n \"Rabi' al-thani\",\n \"Jumada al-awwal\",\n \"Jumada al-thani\",\n \"Rajab\",\n \"Sha'aban\",\n \"Ramadan\",\n \"Shawwal\",\n \"Dhu al-Qi'dah\",\n \"Dhu al-Hijjah\"\n ],\n monthNamesShort: [\"Muh\", \"Saf\", \"Rab1\", \"Rab2\", \"Jum1\", \"Jum2\", \"Raj\", \"Sha'\", \"Ram\", \"Shaw\", \"DhuQ\", \"DhuH\"],\n dayNames: [\n \"Yawm al-ahad\",\n \"Yawm al-ithnayn\",\n \"Yawm ath-thulaathaa'\",\n \"Yawm al-arbi'aa'\",\n \"Yawm al-kham\\u012Bs\",\n \"Yawm al-jum'a\",\n \"Yawm as-sabt\"\n ],\n dayNamesShort: [\"Aha\", \"Ith\", \"Thu\", \"Arb\", \"Kha\", \"Jum\", \"Sab\"],\n dayNamesMin: [\"Ah\", \"It\", \"Th\", \"Ar\", \"Kh\", \"Ju\", \"Sa\"],\n digits: null,\n dateFormat: \"yyyy/mm/dd\",\n firstDay: 6,\n isRTL: false\n }\n },\n /** Determine whether this date is in a leap year.\n @memberof IslamicCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {boolean} true if this is a leap year, false if not.\n @throws Error if an invalid year or a different calendar used. */\n leapYear: function(year) {\n var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n return (date.year() * 11 + 14) % 30 < 11;\n },\n /** Determine the week of the year for a date.\n @memberof IslamicCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {number} The week of the year.\n @throws Error if an invalid date or a different calendar used. */\n weekOfYear: function(year, month, day) {\n var checkDate = this.newDate(year, month, day);\n checkDate.add(-checkDate.dayOfWeek(), \"d\");\n return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1;\n },\n /** Retrieve the number of days in a year.\n @memberof IslamicCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {number} The number of days.\n @throws Error if an invalid year or a different calendar used. */\n daysInYear: function(year) {\n return this.leapYear(year) ? 355 : 354;\n },\n /** Retrieve the number of days in a month.\n @memberof IslamicCalendar\n @param year {CDate|number} The date to examine or the year of the month.\n @param [month] {number} The month.\n @return {number} The number of days in this month.\n @throws Error if an invalid month/year or a different calendar used. */\n daysInMonth: function(year, month) {\n var date = this._validate(year, month, this.minDay, main.local.invalidMonth);\n return this.daysPerMonth[date.month() - 1] + (date.month() === 12 && this.leapYear(date.year()) ? 1 : 0);\n },\n /** Determine whether this date is a week day.\n @memberof IslamicCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {boolean} true if a week day, false if not.\n @throws Error if an invalid date or a different calendar used. */\n weekDay: function(year, month, day) {\n return this.dayOfWeek(year, month, day) !== 5;\n },\n /** Retrieve the Julian date equivalent for this date,\n i.e. days since January 1, 4713 BCE Greenwich noon.\n @memberof IslamicCalendar\n @param year {CDate|number} The date to convert or the year to convert.\n @param [month] {number} The month to convert.\n @param [day] {number} The day to convert.\n @return {number} The equivalent Julian date.\n @throws Error if an invalid date or a different calendar used. */\n toJD: function(year, month, day) {\n var date = this._validate(year, month, day, main.local.invalidDate);\n year = date.year();\n month = date.month();\n day = date.day();\n year = year <= 0 ? year + 1 : year;\n return day + Math.ceil(29.5 * (month - 1)) + (year - 1) * 354 + Math.floor((3 + 11 * year) / 30) + this.jdEpoch - 1;\n },\n /** Create a new date from a Julian date.\n @memberof IslamicCalendar\n @param jd {number} The Julian date to convert.\n @return {CDate} The equivalent date. */\n fromJD: function(jd) {\n jd = Math.floor(jd) + 0.5;\n var year = Math.floor((30 * (jd - this.jdEpoch) + 10646) / 10631);\n year = year <= 0 ? year - 1 : year;\n var month = Math.min(12, Math.ceil((jd - 29 - this.toJD(year, 1, 1)) / 29.5) + 1);\n var day = jd - this.toJD(year, month, 1) + 1;\n return this.newDate(year, month, day);\n }\n });\n main.calendars.islamic = IslamicCalendar;\n }\n });\n\n // node_modules/world-calendars/dist/calendars/julian.js\n var require_julian = __commonJS({\n \"node_modules/world-calendars/dist/calendars/julian.js\"() {\n var main = require_main();\n var assign = require_object_assign();\n function JulianCalendar(language) {\n this.local = this.regionalOptions[language || \"\"] || this.regionalOptions[\"\"];\n }\n JulianCalendar.prototype = new main.baseCalendar();\n assign(JulianCalendar.prototype, {\n /** The calendar name.\n @memberof JulianCalendar */\n name: \"Julian\",\n /** Julian date of start of Julian epoch: 1 January 0001 AD = 30 December 0001 BCE.\n @memberof JulianCalendar */\n jdEpoch: 17214235e-1,\n /** Days per month in a common year.\n @memberof JulianCalendar */\n daysPerMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n /** true if has a year zero, false if not.\n @memberof JulianCalendar */\n hasYearZero: false,\n /** The minimum month number.\n @memberof JulianCalendar */\n minMonth: 1,\n /** The first month in the year.\n @memberof JulianCalendar */\n firstMonth: 1,\n /** The minimum day number.\n @memberof JulianCalendar */\n minDay: 1,\n /** Localisations for the plugin.\n Entries are objects indexed by the language code ('' being the default US/English).\n Each object has the following attributes.\n @memberof JulianCalendar\n @property name {string} The calendar name.\n @property epochs {string[]} The epoch names.\n @property monthNames {string[]} The long names of the months of the year.\n @property monthNamesShort {string[]} The short names of the months of the year.\n @property dayNames {string[]} The long names of the days of the week.\n @property dayNamesShort {string[]} The short names of the days of the week.\n @property dayNamesMin {string[]} The minimal names of the days of the week.\n @property dateFormat {string} The date format for this calendar.\n See the options on formatDate for details.\n @property firstDay {number} The number of the first day of the week, starting at 0.\n @property isRTL {number} true if this localisation reads right-to-left. */\n regionalOptions: {\n // Localisations\n \"\": {\n name: \"Julian\",\n epochs: [\"BC\", \"AD\"],\n monthNames: [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\"\n ],\n monthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\n dayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n dayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n dayNamesMin: [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"],\n digits: null,\n dateFormat: \"mm/dd/yyyy\",\n firstDay: 0,\n isRTL: false\n }\n },\n /** Determine whether this date is in a leap year.\n @memberof JulianCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {boolean} true if this is a leap year, false if not.\n @throws Error if an invalid year or a different calendar used. */\n leapYear: function(year) {\n var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n var year = date.year() < 0 ? date.year() + 1 : date.year();\n return year % 4 === 0;\n },\n /** Determine the week of the year for a date - ISO 8601.\n @memberof JulianCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {number} The week of the year.\n @throws Error if an invalid date or a different calendar used. */\n weekOfYear: function(year, month, day) {\n var checkDate = this.newDate(year, month, day);\n checkDate.add(4 - (checkDate.dayOfWeek() || 7), \"d\");\n return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1;\n },\n /** Retrieve the number of days in a month.\n @memberof JulianCalendar\n @param year {CDate|number} The date to examine or the year of the month.\n @param [month] {number} The month.\n @return {number} The number of days in this month.\n @throws Error if an invalid month/year or a different calendar used. */\n daysInMonth: function(year, month) {\n var date = this._validate(year, month, this.minDay, main.local.invalidMonth);\n return this.daysPerMonth[date.month() - 1] + (date.month() === 2 && this.leapYear(date.year()) ? 1 : 0);\n },\n /** Determine whether this date is a week day.\n @memberof JulianCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {boolean} True if a week day, false if not.\n @throws Error if an invalid date or a different calendar used. */\n weekDay: function(year, month, day) {\n return (this.dayOfWeek(year, month, day) || 7) < 6;\n },\n /** Retrieve the Julian date equivalent for this date,\n i.e. days since January 1, 4713 BCE Greenwich noon.\n @memberof JulianCalendar\n @param year {CDate|number} The date to convert or the year to convert.\n @param [month] {number} The month to convert.\n @param [day] {number} The day to convert.\n @return {number} The equivalent Julian date.\n @throws Error if an invalid date or a different calendar used. */\n toJD: function(year, month, day) {\n var date = this._validate(year, month, day, main.local.invalidDate);\n year = date.year();\n month = date.month();\n day = date.day();\n if (year < 0) {\n year++;\n }\n if (month <= 2) {\n year--;\n month += 12;\n }\n return Math.floor(365.25 * (year + 4716)) + Math.floor(30.6001 * (month + 1)) + day - 1524.5;\n },\n /** Create a new date from a Julian date.\n @memberof JulianCalendar\n @param jd {number} The Julian date to convert.\n @return {CDate} The equivalent date. */\n fromJD: function(jd) {\n var a = Math.floor(jd + 0.5);\n var b = a + 1524;\n var c = Math.floor((b - 122.1) / 365.25);\n var d = Math.floor(365.25 * c);\n var e = Math.floor((b - d) / 30.6001);\n var month = e - Math.floor(e < 14 ? 1 : 13);\n var year = c - Math.floor(month > 2 ? 4716 : 4715);\n var day = b - d - Math.floor(30.6001 * e);\n if (year <= 0) {\n year--;\n }\n return this.newDate(year, month, day);\n }\n });\n main.calendars.julian = JulianCalendar;\n }\n });\n\n // node_modules/world-calendars/dist/calendars/mayan.js\n var require_mayan = __commonJS({\n \"node_modules/world-calendars/dist/calendars/mayan.js\"() {\n var main = require_main();\n var assign = require_object_assign();\n function MayanCalendar(language) {\n this.local = this.regionalOptions[language || \"\"] || this.regionalOptions[\"\"];\n }\n MayanCalendar.prototype = new main.baseCalendar();\n assign(MayanCalendar.prototype, {\n /** The calendar name.\n @memberof MayanCalendar */\n name: \"Mayan\",\n /** Julian date of start of Mayan epoch: 11 August 3114 BCE.\n @memberof MayanCalendar */\n jdEpoch: 584282.5,\n /** true if has a year zero, false if not.\n @memberof MayanCalendar */\n hasYearZero: true,\n /** The minimum month number.\n @memberof MayanCalendar */\n minMonth: 0,\n /** The first month in the year.\n @memberof MayanCalendar */\n firstMonth: 0,\n /** The minimum day number.\n @memberof MayanCalendar */\n minDay: 0,\n /** Localisations for the plugin.\n Entries are objects indexed by the language code ('' being the default US/English).\n Each object has the following attributes.\n @memberof MayanCalendar\n @property name {string} The calendar name.\n @property epochs {string[]} The epoch names.\n @property monthNames {string[]} The long names of the months of the year.\n @property monthNamesShort {string[]} The short names of the months of the year.\n @property dayNames {string[]} The long names of the days of the week.\n @property dayNamesShort {string[]} The short names of the days of the week.\n @property dayNamesMin {string[]} The minimal names of the days of the week.\n @property dateFormat {string} The date format for this calendar.\n See the options on formatDate for details.\n @property firstDay {number} The number of the first day of the week, starting at 0.\n @property isRTL {number} true if this localisation reads right-to-left.\n @property haabMonths {string[]} The names of the Haab months.\n @property tzolkinMonths {string[]} The names of the Tzolkin months. */\n regionalOptions: {\n // Localisations\n \"\": {\n name: \"Mayan\",\n epochs: [\"\", \"\"],\n monthNames: [\n \"0\",\n \"1\",\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"10\",\n \"11\",\n \"12\",\n \"13\",\n \"14\",\n \"15\",\n \"16\",\n \"17\"\n ],\n monthNamesShort: [\n \"0\",\n \"1\",\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"10\",\n \"11\",\n \"12\",\n \"13\",\n \"14\",\n \"15\",\n \"16\",\n \"17\"\n ],\n dayNames: [\n \"0\",\n \"1\",\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"10\",\n \"11\",\n \"12\",\n \"13\",\n \"14\",\n \"15\",\n \"16\",\n \"17\",\n \"18\",\n \"19\"\n ],\n dayNamesShort: [\n \"0\",\n \"1\",\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"10\",\n \"11\",\n \"12\",\n \"13\",\n \"14\",\n \"15\",\n \"16\",\n \"17\",\n \"18\",\n \"19\"\n ],\n dayNamesMin: [\n \"0\",\n \"1\",\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"10\",\n \"11\",\n \"12\",\n \"13\",\n \"14\",\n \"15\",\n \"16\",\n \"17\",\n \"18\",\n \"19\"\n ],\n digits: null,\n dateFormat: \"YYYY.m.d\",\n firstDay: 0,\n isRTL: false,\n haabMonths: [\n \"Pop\",\n \"Uo\",\n \"Zip\",\n \"Zotz\",\n \"Tzec\",\n \"Xul\",\n \"Yaxkin\",\n \"Mol\",\n \"Chen\",\n \"Yax\",\n \"Zac\",\n \"Ceh\",\n \"Mac\",\n \"Kankin\",\n \"Muan\",\n \"Pax\",\n \"Kayab\",\n \"Cumku\",\n \"Uayeb\"\n ],\n tzolkinMonths: [\n \"Imix\",\n \"Ik\",\n \"Akbal\",\n \"Kan\",\n \"Chicchan\",\n \"Cimi\",\n \"Manik\",\n \"Lamat\",\n \"Muluc\",\n \"Oc\",\n \"Chuen\",\n \"Eb\",\n \"Ben\",\n \"Ix\",\n \"Men\",\n \"Cib\",\n \"Caban\",\n \"Etznab\",\n \"Cauac\",\n \"Ahau\"\n ]\n }\n },\n /** Determine whether this date is in a leap year.\n @memberof MayanCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {boolean} true if this is a leap year, false if not.\n @throws Error if an invalid year or a different calendar used. */\n leapYear: function(year) {\n this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n return false;\n },\n /** Format the year, if not a simple sequential number.\n @memberof MayanCalendar\n @param year {CDate|number} The date to format or the year to format.\n @return {string} The formatted year.\n @throws Error if an invalid year or a different calendar used. */\n formatYear: function(year) {\n var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n year = date.year();\n var baktun = Math.floor(year / 400);\n year = year % 400;\n year += year < 0 ? 400 : 0;\n var katun = Math.floor(year / 20);\n return baktun + \".\" + katun + \".\" + year % 20;\n },\n /** Convert from the formatted year back to a single number.\n @memberof MayanCalendar\n @param years {string} The year as n.n.n.\n @return {number} The sequential year.\n @throws Error if an invalid value is supplied. */\n forYear: function(years) {\n years = years.split(\".\");\n if (years.length < 3) {\n throw \"Invalid Mayan year\";\n }\n var year = 0;\n for (var i = 0; i < years.length; i++) {\n var y = parseInt(years[i], 10);\n if (Math.abs(y) > 19 || i > 0 && y < 0) {\n throw \"Invalid Mayan year\";\n }\n year = year * 20 + y;\n }\n return year;\n },\n /** Retrieve the number of months in a year.\n @memberof MayanCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {number} The number of months.\n @throws Error if an invalid year or a different calendar used. */\n monthsInYear: function(year) {\n this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n return 18;\n },\n /** Determine the week of the year for a date.\n @memberof MayanCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {number} The week of the year.\n @throws Error if an invalid date or a different calendar used. */\n weekOfYear: function(year, month, day) {\n this._validate(year, month, day, main.local.invalidDate);\n return 0;\n },\n /** Retrieve the number of days in a year.\n @memberof MayanCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {number} The number of days.\n @throws Error if an invalid year or a different calendar used. */\n daysInYear: function(year) {\n this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n return 360;\n },\n /** Retrieve the number of days in a month.\n @memberof MayanCalendar\n @param year {CDate|number} The date to examine or the year of the month.\n @param [month] {number} The month.\n @return {number} The number of days in this month.\n @throws Error if an invalid month/year or a different calendar used. */\n daysInMonth: function(year, month) {\n this._validate(year, month, this.minDay, main.local.invalidMonth);\n return 20;\n },\n /** Retrieve the number of days in a week.\n @memberof MayanCalendar\n @return {number} The number of days. */\n daysInWeek: function() {\n return 5;\n },\n /** Retrieve the day of the week for a date.\n @memberof MayanCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {number} The day of the week: 0 to number of days - 1.\n @throws Error if an invalid date or a different calendar used. */\n dayOfWeek: function(year, month, day) {\n var date = this._validate(year, month, day, main.local.invalidDate);\n return date.day();\n },\n /** Determine whether this date is a week day.\n @memberof MayanCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {boolean} true if a week day, false if not.\n @throws Error if an invalid date or a different calendar used. */\n weekDay: function(year, month, day) {\n this._validate(year, month, day, main.local.invalidDate);\n return true;\n },\n /** Retrieve additional information about a date - Haab and Tzolkin equivalents.\n @memberof MayanCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {object} Additional information - contents depends on calendar.\n @throws Error if an invalid date or a different calendar used. */\n extraInfo: function(year, month, day) {\n var date = this._validate(year, month, day, main.local.invalidDate);\n var jd = date.toJD();\n var haab = this._toHaab(jd);\n var tzolkin = this._toTzolkin(jd);\n return {\n haabMonthName: this.local.haabMonths[haab[0] - 1],\n haabMonth: haab[0],\n haabDay: haab[1],\n tzolkinDayName: this.local.tzolkinMonths[tzolkin[0] - 1],\n tzolkinDay: tzolkin[0],\n tzolkinTrecena: tzolkin[1]\n };\n },\n /** Retrieve Haab date from a Julian date.\n @memberof MayanCalendar\n @private\n @param jd {number} The Julian date.\n @return {number[]} Corresponding Haab month and day. */\n _toHaab: function(jd) {\n jd -= this.jdEpoch;\n var day = mod(jd + 8 + (18 - 1) * 20, 365);\n return [Math.floor(day / 20) + 1, mod(day, 20)];\n },\n /** Retrieve Tzolkin date from a Julian date.\n @memberof MayanCalendar\n @private\n @param jd {number} The Julian date.\n @return {number[]} Corresponding Tzolkin day and trecena. */\n _toTzolkin: function(jd) {\n jd -= this.jdEpoch;\n return [amod(jd + 20, 20), amod(jd + 4, 13)];\n },\n /** Retrieve the Julian date equivalent for this date,\n i.e. days since January 1, 4713 BCE Greenwich noon.\n @memberof MayanCalendar\n @param year {CDate|number} The date to convert or the year to convert.\n @param [month] {number} The month to convert.\n @param [day] {number} The day to convert.\n @return {number} The equivalent Julian date.\n @throws Error if an invalid date or a different calendar used. */\n toJD: function(year, month, day) {\n var date = this._validate(year, month, day, main.local.invalidDate);\n return date.day() + date.month() * 20 + date.year() * 360 + this.jdEpoch;\n },\n /** Create a new date from a Julian date.\n @memberof MayanCalendar\n @param jd {number} The Julian date to convert.\n @return {CDate} The equivalent date. */\n fromJD: function(jd) {\n jd = Math.floor(jd) + 0.5 - this.jdEpoch;\n var year = Math.floor(jd / 360);\n jd = jd % 360;\n jd += jd < 0 ? 360 : 0;\n var month = Math.floor(jd / 20);\n var day = jd % 20;\n return this.newDate(year, month, day);\n }\n });\n function mod(a, b) {\n return a - b * Math.floor(a / b);\n }\n function amod(a, b) {\n return mod(a - 1, b) + 1;\n }\n main.calendars.mayan = MayanCalendar;\n }\n });\n\n // node_modules/world-calendars/dist/calendars/nanakshahi.js\n var require_nanakshahi = __commonJS({\n \"node_modules/world-calendars/dist/calendars/nanakshahi.js\"() {\n var main = require_main();\n var assign = require_object_assign();\n function NanakshahiCalendar(language) {\n this.local = this.regionalOptions[language || \"\"] || this.regionalOptions[\"\"];\n }\n NanakshahiCalendar.prototype = new main.baseCalendar();\n var gregorian = main.instance(\"gregorian\");\n assign(NanakshahiCalendar.prototype, {\n /** The calendar name.\n @memberof NanakshahiCalendar */\n name: \"Nanakshahi\",\n /** Julian date of start of Nanakshahi epoch: 14 March 1469 CE.\n @memberof NanakshahiCalendar */\n jdEpoch: 22576735e-1,\n /** Days per month in a common year.\n @memberof NanakshahiCalendar */\n daysPerMonth: [31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 30, 30],\n /** true if has a year zero, false if not.\n @memberof NanakshahiCalendar */\n hasYearZero: false,\n /** The minimum month number.\n @memberof NanakshahiCalendar */\n minMonth: 1,\n /** The first month in the year.\n @memberof NanakshahiCalendar */\n firstMonth: 1,\n /** The minimum day number.\n @memberof NanakshahiCalendar */\n minDay: 1,\n /** Localisations for the plugin.\n Entries are objects indexed by the language code ('' being the default US/English).\n Each object has the following attributes.\n @memberof NanakshahiCalendar\n @property name {string} The calendar name.\n @property epochs {string[]} The epoch names.\n @property monthNames {string[]} The long names of the months of the year.\n @property monthNamesShort {string[]} The short names of the months of the year.\n @property dayNames {string[]} The long names of the days of the week.\n @property dayNamesShort {string[]} The short names of the days of the week.\n @property dayNamesMin {string[]} The minimal names of the days of the week.\n @property dateFormat {string} The date format for this calendar.\n See the options on formatDate for details.\n @property firstDay {number} The number of the first day of the week, starting at 0.\n @property isRTL {number} true if this localisation reads right-to-left. */\n regionalOptions: {\n // Localisations\n \"\": {\n name: \"Nanakshahi\",\n epochs: [\"BN\", \"AN\"],\n monthNames: [\n \"Chet\",\n \"Vaisakh\",\n \"Jeth\",\n \"Harh\",\n \"Sawan\",\n \"Bhadon\",\n \"Assu\",\n \"Katak\",\n \"Maghar\",\n \"Poh\",\n \"Magh\",\n \"Phagun\"\n ],\n monthNamesShort: [\"Che\", \"Vai\", \"Jet\", \"Har\", \"Saw\", \"Bha\", \"Ass\", \"Kat\", \"Mgr\", \"Poh\", \"Mgh\", \"Pha\"],\n dayNames: [\"Somvaar\", \"Mangalvar\", \"Budhvaar\", \"Veervaar\", \"Shukarvaar\", \"Sanicharvaar\", \"Etvaar\"],\n dayNamesShort: [\"Som\", \"Mangal\", \"Budh\", \"Veer\", \"Shukar\", \"Sanichar\", \"Et\"],\n dayNamesMin: [\"So\", \"Ma\", \"Bu\", \"Ve\", \"Sh\", \"Sa\", \"Et\"],\n digits: null,\n dateFormat: \"dd-mm-yyyy\",\n firstDay: 0,\n isRTL: false\n }\n },\n /** Determine whether this date is in a leap year.\n @memberof NanakshahiCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {boolean} true if this is a leap year, false if not.\n @throws Error if an invalid year or a different calendar used. */\n leapYear: function(year) {\n var date = this._validate(\n year,\n this.minMonth,\n this.minDay,\n main.local.invalidYear || main.regionalOptions[\"\"].invalidYear\n );\n return gregorian.leapYear(date.year() + (date.year() < 1 ? 1 : 0) + 1469);\n },\n /** Determine the week of the year for a date.\n @memberof NanakshahiCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {number} The week of the year.\n @throws Error if an invalid date or a different calendar used. */\n weekOfYear: function(year, month, day) {\n var checkDate = this.newDate(year, month, day);\n checkDate.add(1 - (checkDate.dayOfWeek() || 7), \"d\");\n return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1;\n },\n /** Retrieve the number of days in a month.\n @memberof NanakshahiCalendar\n @param year {CDate|number} The date to examine or the year of the month.\n @param [month] {number} The month.\n @return {number} The number of days in this month.\n @throws Error if an invalid month/year or a different calendar used. */\n daysInMonth: function(year, month) {\n var date = this._validate(year, month, this.minDay, main.local.invalidMonth);\n return this.daysPerMonth[date.month() - 1] + (date.month() === 12 && this.leapYear(date.year()) ? 1 : 0);\n },\n /** Determine whether this date is a week day.\n @memberof NanakshahiCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {boolean} true if a week day, false if not.\n @throws Error if an invalid date or a different calendar used. */\n weekDay: function(year, month, day) {\n return (this.dayOfWeek(year, month, day) || 7) < 6;\n },\n /** Retrieve the Julian date equivalent for this date,\n i.e. days since January 1, 4713 BCE Greenwich noon.\n @memberof NanakshahiCalendar\n @param year {CDate|number} The date to convert or the year to convert.\n @param [month] {number} The month to convert.\n @param [day] {number} The day to convert.\n @return {number} The equivalent Julian date.\n @throws Error if an invalid date or a different calendar used. */\n toJD: function(year, month, day) {\n var date = this._validate(year, month, day, main.local.invalidMonth);\n var year = date.year();\n if (year < 0) {\n year++;\n }\n var doy = date.day();\n for (var m = 1; m < date.month(); m++) {\n doy += this.daysPerMonth[m - 1];\n }\n return doy + gregorian.toJD(year + 1468, 3, 13);\n },\n /** Create a new date from a Julian date.\n @memberof NanakshahiCalendar\n @param jd {number} The Julian date to convert.\n @return {CDate} The equivalent date. */\n fromJD: function(jd) {\n jd = Math.floor(jd + 0.5);\n var year = Math.floor((jd - (this.jdEpoch - 1)) / 366);\n while (jd >= this.toJD(year + 1, 1, 1)) {\n year++;\n }\n var day = jd - Math.floor(this.toJD(year, 1, 1) + 0.5) + 1;\n var month = 1;\n while (day > this.daysInMonth(year, month)) {\n day -= this.daysInMonth(year, month);\n month++;\n }\n return this.newDate(year, month, day);\n }\n });\n main.calendars.nanakshahi = NanakshahiCalendar;\n }\n });\n\n // node_modules/world-calendars/dist/calendars/nepali.js\n var require_nepali = __commonJS({\n \"node_modules/world-calendars/dist/calendars/nepali.js\"() {\n var main = require_main();\n var assign = require_object_assign();\n function NepaliCalendar(language) {\n this.local = this.regionalOptions[language || \"\"] || this.regionalOptions[\"\"];\n }\n NepaliCalendar.prototype = new main.baseCalendar();\n assign(NepaliCalendar.prototype, {\n /** The calendar name.\n @memberof NepaliCalendar */\n name: \"Nepali\",\n /** Julian date of start of Nepali epoch: 14 April 57 BCE.\n @memberof NepaliCalendar */\n jdEpoch: 17007095e-1,\n /** Days per month in a common year.\n @memberof NepaliCalendar */\n daysPerMonth: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n /** true if has a year zero, false if not.\n @memberof NepaliCalendar */\n hasYearZero: false,\n /** The minimum month number.\n @memberof NepaliCalendar */\n minMonth: 1,\n /** The first month in the year.\n @memberof NepaliCalendar */\n firstMonth: 1,\n /** The minimum day number.\n @memberof NepaliCalendar */\n minDay: 1,\n /** The number of days in the year.\n @memberof NepaliCalendar */\n daysPerYear: 365,\n /** Localisations for the plugin.\n Entries are objects indexed by the language code ('' being the default US/English).\n Each object has the following attributes.\n @memberof NepaliCalendar\n @property name {string} The calendar name.\n @property epochs {string[]} The epoch names.\n @property monthNames {string[]} The long names of the months of the year.\n @property monthNamesShort {string[]} The short names of the months of the year.\n @property dayNames {string[]} The long names of the days of the week.\n @property dayNamesShort {string[]} The short names of the days of the week.\n @property dayNamesMin {string[]} The minimal names of the days of the week.\n @property dateFormat {string} The date format for this calendar.\n See the options on formatDate for details.\n @property firstDay {number} The number of the first day of the week, starting at 0.\n @property isRTL {number} true if this localisation reads right-to-left. */\n regionalOptions: {\n // Localisations\n \"\": {\n name: \"Nepali\",\n epochs: [\"BBS\", \"ABS\"],\n monthNames: [\n \"Baisakh\",\n \"Jestha\",\n \"Ashadh\",\n \"Shrawan\",\n \"Bhadra\",\n \"Ashwin\",\n \"Kartik\",\n \"Mangsir\",\n \"Paush\",\n \"Mangh\",\n \"Falgun\",\n \"Chaitra\"\n ],\n monthNamesShort: [\"Bai\", \"Je\", \"As\", \"Shra\", \"Bha\", \"Ash\", \"Kar\", \"Mang\", \"Pau\", \"Ma\", \"Fal\", \"Chai\"],\n dayNames: [\"Aaitabaar\", \"Sombaar\", \"Manglbaar\", \"Budhabaar\", \"Bihibaar\", \"Shukrabaar\", \"Shanibaar\"],\n dayNamesShort: [\"Aaita\", \"Som\", \"Mangl\", \"Budha\", \"Bihi\", \"Shukra\", \"Shani\"],\n dayNamesMin: [\"Aai\", \"So\", \"Man\", \"Bu\", \"Bi\", \"Shu\", \"Sha\"],\n digits: null,\n dateFormat: \"dd/mm/yyyy\",\n firstDay: 1,\n isRTL: false\n }\n },\n /** Determine whether this date is in a leap year.\n @memberof NepaliCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {boolean} true if this is a leap year, false if not.\n @throws Error if an invalid year or a different calendar used. */\n leapYear: function(year) {\n return this.daysInYear(year) !== this.daysPerYear;\n },\n /** Determine the week of the year for a date.\n @memberof NepaliCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {number} The week of the year.\n @throws Error if an invalid date or a different calendar used. */\n weekOfYear: function(year, month, day) {\n var checkDate = this.newDate(year, month, day);\n checkDate.add(-checkDate.dayOfWeek(), \"d\");\n return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1;\n },\n /** Retrieve the number of days in a year.\n @memberof NepaliCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {number} The number of days.\n @throws Error if an invalid year or a different calendar used. */\n daysInYear: function(year) {\n var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n year = date.year();\n if (typeof this.NEPALI_CALENDAR_DATA[year] === \"undefined\") {\n return this.daysPerYear;\n }\n var daysPerYear = 0;\n for (var month_number = this.minMonth; month_number <= 12; month_number++) {\n daysPerYear += this.NEPALI_CALENDAR_DATA[year][month_number];\n }\n return daysPerYear;\n },\n /** Retrieve the number of days in a month.\n @memberof NepaliCalendar\n @param year {CDate|number| The date to examine or the year of the month.\n @param [month] {number} The month.\n @return {number} The number of days in this month.\n @throws Error if an invalid month/year or a different calendar used. */\n daysInMonth: function(year, month) {\n if (year.year) {\n month = year.month();\n year = year.year();\n }\n this._validate(year, month, this.minDay, main.local.invalidMonth);\n return typeof this.NEPALI_CALENDAR_DATA[year] === \"undefined\" ? this.daysPerMonth[month - 1] : this.NEPALI_CALENDAR_DATA[year][month];\n },\n /** Determine whether this date is a week day.\n @memberof NepaliCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {boolean} true if a week day, false if not.\n @throws Error if an invalid date or a different calendar used. */\n weekDay: function(year, month, day) {\n return this.dayOfWeek(year, month, day) !== 6;\n },\n /** Retrieve the Julian date equivalent for this date,\n i.e. days since January 1, 4713 BCE Greenwich noon.\n @memberof NepaliCalendar\n @param year {CDate|number} The date to convert or the year to convert.\n @param [month] {number} The month to convert.\n @param [day] {number} The day to convert.\n @return {number} The equivalent Julian date.\n @throws Error if an invalid date or a different calendar used. */\n toJD: function(nepaliYear, nepaliMonth, nepaliDay) {\n var date = this._validate(nepaliYear, nepaliMonth, nepaliDay, main.local.invalidDate);\n nepaliYear = date.year();\n nepaliMonth = date.month();\n nepaliDay = date.day();\n var gregorianCalendar = main.instance();\n var gregorianDayOfYear = 0;\n var nepaliMonthToCheck = nepaliMonth;\n var nepaliYearToCheck = nepaliYear;\n this._createMissingCalendarData(nepaliYear);\n var gregorianYear = nepaliYear - (nepaliMonthToCheck > 9 || nepaliMonthToCheck === 9 && nepaliDay >= this.NEPALI_CALENDAR_DATA[nepaliYearToCheck][0] ? 56 : 57);\n if (nepaliMonth !== 9) {\n gregorianDayOfYear = nepaliDay;\n nepaliMonthToCheck--;\n }\n while (nepaliMonthToCheck !== 9) {\n if (nepaliMonthToCheck <= 0) {\n nepaliMonthToCheck = 12;\n nepaliYearToCheck--;\n }\n gregorianDayOfYear += this.NEPALI_CALENDAR_DATA[nepaliYearToCheck][nepaliMonthToCheck];\n nepaliMonthToCheck--;\n }\n if (nepaliMonth === 9) {\n gregorianDayOfYear += nepaliDay - this.NEPALI_CALENDAR_DATA[nepaliYearToCheck][0];\n if (gregorianDayOfYear < 0) {\n gregorianDayOfYear += gregorianCalendar.daysInYear(gregorianYear);\n }\n } else {\n gregorianDayOfYear += this.NEPALI_CALENDAR_DATA[nepaliYearToCheck][9] - this.NEPALI_CALENDAR_DATA[nepaliYearToCheck][0];\n }\n return gregorianCalendar.newDate(gregorianYear, 1, 1).add(gregorianDayOfYear, \"d\").toJD();\n },\n /** Create a new date from a Julian date.\n @memberof NepaliCalendar\n @param jd {number} The Julian date to convert.\n @return {CDate} The equivalent date. */\n fromJD: function(jd) {\n var gregorianCalendar = main.instance();\n var gregorianDate = gregorianCalendar.fromJD(jd);\n var gregorianYear = gregorianDate.year();\n var gregorianDayOfYear = gregorianDate.dayOfYear();\n var nepaliYear = gregorianYear + 56;\n this._createMissingCalendarData(nepaliYear);\n var nepaliMonth = 9;\n var dayOfFirstJanInPaush = this.NEPALI_CALENDAR_DATA[nepaliYear][0];\n var daysSinceJanFirstToEndOfNepaliMonth = this.NEPALI_CALENDAR_DATA[nepaliYear][nepaliMonth] - dayOfFirstJanInPaush + 1;\n while (gregorianDayOfYear > daysSinceJanFirstToEndOfNepaliMonth) {\n nepaliMonth++;\n if (nepaliMonth > 12) {\n nepaliMonth = 1;\n nepaliYear++;\n }\n daysSinceJanFirstToEndOfNepaliMonth += this.NEPALI_CALENDAR_DATA[nepaliYear][nepaliMonth];\n }\n var nepaliDayOfMonth = this.NEPALI_CALENDAR_DATA[nepaliYear][nepaliMonth] - (daysSinceJanFirstToEndOfNepaliMonth - gregorianDayOfYear);\n return this.newDate(nepaliYear, nepaliMonth, nepaliDayOfMonth);\n },\n /** Creates missing data in the NEPALI_CALENDAR_DATA table.\n This data will not be correct but just give an estimated result. Mostly -/+ 1 day\n @private\n @param nepaliYear {number} The missing year number. */\n _createMissingCalendarData: function(nepaliYear) {\n var tmp_calendar_data = this.daysPerMonth.slice(0);\n tmp_calendar_data.unshift(17);\n for (var nepaliYearToCreate = nepaliYear - 1; nepaliYearToCreate < nepaliYear + 2; nepaliYearToCreate++) {\n if (typeof this.NEPALI_CALENDAR_DATA[nepaliYearToCreate] === \"undefined\") {\n this.NEPALI_CALENDAR_DATA[nepaliYearToCreate] = tmp_calendar_data;\n }\n }\n },\n NEPALI_CALENDAR_DATA: {\n // These data are from http://www.ashesh.com.np\n 1970: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 1971: [18, 31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30],\n 1972: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],\n 1973: [19, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],\n 1974: [19, 31, 31, 32, 30, 31, 31, 30, 29, 30, 29, 30, 30],\n 1975: [18, 31, 31, 32, 32, 30, 31, 30, 29, 30, 29, 30, 30],\n 1976: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 1977: [18, 31, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31],\n 1978: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 1979: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n 1980: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 1981: [18, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],\n 1982: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 1983: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n 1984: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 1985: [18, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],\n 1986: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 1987: [18, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n 1988: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 1989: [18, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],\n 1990: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 1991: [18, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n // These data are from http://nepalicalendar.rat32.com/index.php\n 1992: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],\n 1993: [18, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],\n 1994: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 1995: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],\n 1996: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],\n 1997: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 1998: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 1999: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 2e3: [17, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],\n 2001: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2002: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n 2003: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 2004: [17, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],\n 2005: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2006: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n 2007: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 2008: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31],\n 2009: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2010: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n 2011: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 2012: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],\n 2013: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2014: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n 2015: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 2016: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],\n 2017: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2018: [18, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n 2019: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],\n 2020: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],\n 2021: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2022: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],\n 2023: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],\n 2024: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],\n 2025: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2026: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 2027: [17, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],\n 2028: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2029: [18, 31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30],\n 2030: [17, 31, 32, 31, 32, 31, 30, 30, 30, 30, 30, 30, 31],\n 2031: [17, 31, 32, 31, 32, 31, 31, 31, 31, 31, 31, 31, 31],\n 2032: [17, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32],\n 2033: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n 2034: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 2035: [17, 30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31],\n 2036: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2037: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n 2038: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 2039: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],\n 2040: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2041: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n 2042: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 2043: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],\n 2044: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2045: [18, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n 2046: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 2047: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],\n 2048: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2049: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],\n 2050: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],\n 2051: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],\n 2052: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2053: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],\n 2054: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],\n 2055: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 30, 29, 30],\n 2056: [17, 31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30],\n 2057: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 2058: [17, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],\n 2059: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2060: [17, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n 2061: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 2062: [17, 30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31],\n 2063: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2064: [17, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n 2065: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 2066: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31],\n 2067: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2068: [17, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n 2069: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 2070: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],\n 2071: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2072: [17, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n 2073: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],\n 2074: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],\n 2075: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2076: [16, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],\n 2077: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],\n 2078: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],\n 2079: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],\n 2080: [16, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],\n // These data are from http://www.ashesh.com.np/nepali-calendar/\n 2081: [17, 31, 31, 32, 32, 31, 30, 30, 30, 29, 30, 30, 30],\n 2082: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30],\n 2083: [17, 31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30],\n 2084: [17, 31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30],\n 2085: [17, 31, 32, 31, 32, 31, 31, 30, 30, 29, 30, 30, 30],\n 2086: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30],\n 2087: [16, 31, 31, 32, 31, 31, 31, 30, 30, 29, 30, 30, 30],\n 2088: [16, 30, 31, 32, 32, 30, 31, 30, 30, 29, 30, 30, 30],\n 2089: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30],\n 2090: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30],\n 2091: [16, 31, 31, 32, 31, 31, 31, 30, 30, 29, 30, 30, 30],\n 2092: [16, 31, 31, 32, 32, 31, 30, 30, 30, 29, 30, 30, 30],\n 2093: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30],\n 2094: [17, 31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30],\n 2095: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 30, 30, 30],\n 2096: [17, 30, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],\n 2097: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30],\n 2098: [17, 31, 31, 32, 31, 31, 31, 29, 30, 29, 30, 30, 31],\n 2099: [17, 31, 31, 32, 31, 31, 31, 30, 29, 29, 30, 30, 30],\n 2100: [17, 31, 32, 31, 32, 30, 31, 30, 29, 30, 29, 30, 30]\n }\n });\n main.calendars.nepali = NepaliCalendar;\n }\n });\n\n // node_modules/world-calendars/dist/calendars/persian.js\n var require_persian = __commonJS({\n \"node_modules/world-calendars/dist/calendars/persian.js\"() {\n var main = require_main();\n var assign = require_object_assign();\n function PersianCalendar(language) {\n this.local = this.regionalOptions[language || \"\"] || this.regionalOptions[\"\"];\n }\n PersianCalendar.prototype = new main.baseCalendar();\n assign(PersianCalendar.prototype, {\n /** The calendar name.\n @memberof PersianCalendar */\n name: \"Persian\",\n /** Julian date of start of Persian epoch: 19 March 622 CE.\n @memberof PersianCalendar */\n jdEpoch: 19483205e-1,\n /** Days per month in a common year.\n @memberof PersianCalendar */\n daysPerMonth: [31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29],\n /** true if has a year zero, false if not.\n @memberof PersianCalendar */\n hasYearZero: false,\n /** The minimum month number.\n @memberof PersianCalendar */\n minMonth: 1,\n /** The first month in the year.\n @memberof PersianCalendar */\n firstMonth: 1,\n /** The minimum day number.\n @memberof PersianCalendar */\n minDay: 1,\n /** Localisations for the plugin.\n Entries are objects indexed by the language code ('' being the default US/English).\n Each object has the following attributes.\n @memberof PersianCalendar\n @property name {string} The calendar name.\n @property epochs {string[]} The epoch names.\n @property monthNames {string[]} The long names of the months of the year.\n @property monthNamesShort {string[]} The short names of the months of the year.\n @property dayNames {string[]} The long names of the days of the week.\n @property dayNamesShort {string[]} The short names of the days of the week.\n @property dayNamesMin {string[]} The minimal names of the days of the week.\n @property dateFormat {string} The date format for this calendar.\n See the options on formatDate for details.\n @property firstDay {number} The number of the first day of the week, starting at 0.\n @property isRTL {number} true if this localisation reads right-to-left. */\n regionalOptions: {\n // Localisations\n \"\": {\n name: \"Persian\",\n epochs: [\"BP\", \"AP\"],\n monthNames: [\n \"Farvardin\",\n \"Ordibehesht\",\n \"Khordad\",\n \"Tir\",\n \"Mordad\",\n \"Shahrivar\",\n \"Mehr\",\n \"Aban\",\n \"Azar\",\n \"Day\",\n \"Bahman\",\n \"Esfand\"\n ],\n monthNamesShort: [\"Far\", \"Ord\", \"Kho\", \"Tir\", \"Mor\", \"Sha\", \"Meh\", \"Aba\", \"Aza\", \"Day\", \"Bah\", \"Esf\"],\n dayNames: [\"Yekshambe\", \"Doshambe\", \"Seshambe\", \"Ch\\xE6harshambe\", \"Panjshambe\", \"Jom'e\", \"Shambe\"],\n dayNamesShort: [\"Yek\", \"Do\", \"Se\", \"Ch\\xE6\", \"Panj\", \"Jom\", \"Sha\"],\n dayNamesMin: [\"Ye\", \"Do\", \"Se\", \"Ch\", \"Pa\", \"Jo\", \"Sh\"],\n digits: null,\n dateFormat: \"yyyy/mm/dd\",\n firstDay: 6,\n isRTL: false\n }\n },\n /** Determine whether this date is in a leap year.\n @memberof PersianCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {boolean} true if this is a leap year, false if not.\n @throws Error if an invalid year or a different calendar used. */\n leapYear: function(year) {\n var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n return ((date.year() - (date.year() > 0 ? 474 : 473)) % 2820 + 474 + 38) * 682 % 2816 < 682;\n },\n /** Determine the week of the year for a date.\n @memberof PersianCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {number} The week of the year.\n @throws Error if an invalid date or a different calendar used. */\n weekOfYear: function(year, month, day) {\n var checkDate = this.newDate(year, month, day);\n checkDate.add(-((checkDate.dayOfWeek() + 1) % 7), \"d\");\n return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1;\n },\n /** Retrieve the number of days in a month.\n @memberof PersianCalendar\n @param year {CDate|number} The date to examine or the year of the month.\n @param [month] {number} The month.\n @return {number} The number of days in this month.\n @throws Error if an invalid month/year or a different calendar used. */\n daysInMonth: function(year, month) {\n var date = this._validate(year, month, this.minDay, main.local.invalidMonth);\n return this.daysPerMonth[date.month() - 1] + (date.month() === 12 && this.leapYear(date.year()) ? 1 : 0);\n },\n /** Determine whether this date is a week day.\n @memberof PersianCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {boolean} true if a week day, false if not.\n @throws Error if an invalid date or a different calendar used. */\n weekDay: function(year, month, day) {\n return this.dayOfWeek(year, month, day) !== 5;\n },\n /** Retrieve the Julian date equivalent for this date,\n i.e. days since January 1, 4713 BCE Greenwich noon.\n @memberof PersianCalendar\n @param year {CDate|number} The date to convert or the year to convert.\n @param [month] {number} The month to convert.\n @param [day] {number} The day to convert.\n @return {number} The equivalent Julian date.\n @throws Error if an invalid date or a different calendar used. */\n toJD: function(year, month, day) {\n var date = this._validate(year, month, day, main.local.invalidDate);\n year = date.year();\n month = date.month();\n day = date.day();\n var epBase = year - (year >= 0 ? 474 : 473);\n var epYear = 474 + mod(epBase, 2820);\n return day + (month <= 7 ? (month - 1) * 31 : (month - 1) * 30 + 6) + Math.floor((epYear * 682 - 110) / 2816) + (epYear - 1) * 365 + Math.floor(epBase / 2820) * 1029983 + this.jdEpoch - 1;\n },\n /** Create a new date from a Julian date.\n @memberof PersianCalendar\n @param jd {number} The Julian date to convert.\n @return {CDate} The equivalent date. */\n fromJD: function(jd) {\n jd = Math.floor(jd) + 0.5;\n var depoch = jd - this.toJD(475, 1, 1);\n var cycle = Math.floor(depoch / 1029983);\n var cyear = mod(depoch, 1029983);\n var ycycle = 2820;\n if (cyear !== 1029982) {\n var aux1 = Math.floor(cyear / 366);\n var aux2 = mod(cyear, 366);\n ycycle = Math.floor((2134 * aux1 + 2816 * aux2 + 2815) / 1028522) + aux1 + 1;\n }\n var year = ycycle + 2820 * cycle + 474;\n year = year <= 0 ? year - 1 : year;\n var yday = jd - this.toJD(year, 1, 1) + 1;\n var month = yday <= 186 ? Math.ceil(yday / 31) : Math.ceil((yday - 6) / 30);\n var day = jd - this.toJD(year, month, 1) + 1;\n return this.newDate(year, month, day);\n }\n });\n function mod(a, b) {\n return a - b * Math.floor(a / b);\n }\n main.calendars.persian = PersianCalendar;\n main.calendars.jalali = PersianCalendar;\n }\n });\n\n // node_modules/world-calendars/dist/calendars/taiwan.js\n var require_taiwan = __commonJS({\n \"node_modules/world-calendars/dist/calendars/taiwan.js\"() {\n var main = require_main();\n var assign = require_object_assign();\n var gregorianCalendar = main.instance();\n function TaiwanCalendar(language) {\n this.local = this.regionalOptions[language || \"\"] || this.regionalOptions[\"\"];\n }\n TaiwanCalendar.prototype = new main.baseCalendar();\n assign(TaiwanCalendar.prototype, {\n /** The calendar name.\n @memberof TaiwanCalendar */\n name: \"Taiwan\",\n /** Julian date of start of Taiwan epoch: 1 January 1912 CE (Gregorian).\n @memberof TaiwanCalendar */\n jdEpoch: 24194025e-1,\n /** Difference in years between Taiwan and Gregorian calendars.\n @memberof TaiwanCalendar */\n yearsOffset: 1911,\n /** Days per month in a common year.\n @memberof TaiwanCalendar */\n daysPerMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n /** true if has a year zero, false if not.\n @memberof TaiwanCalendar */\n hasYearZero: false,\n /** The minimum month number.\n @memberof TaiwanCalendar */\n minMonth: 1,\n /** The first month in the year.\n @memberof TaiwanCalendar */\n firstMonth: 1,\n /** The minimum day number.\n @memberof TaiwanCalendar */\n minDay: 1,\n /** Localisations for the plugin.\n Entries are objects indexed by the language code ('' being the default US/English).\n Each object has the following attributes.\n @memberof TaiwanCalendar\n @property name {string} The calendar name.\n @property epochs {string[]} The epoch names.\n @property monthNames {string[]} The long names of the months of the year.\n @property monthNamesShort {string[]} The short names of the months of the year.\n @property dayNames {string[]} The long names of the days of the week.\n @property dayNamesShort {string[]} The short names of the days of the week.\n @property dayNamesMin {string[]} The minimal names of the days of the week.\n @property dateFormat {string} The date format for this calendar.\n See the options on formatDate for details.\n @property firstDay {number} The number of the first day of the week, starting at 0.\n @property isRTL {number} true if this localisation reads right-to-left. */\n regionalOptions: {\n // Localisations\n \"\": {\n name: \"Taiwan\",\n epochs: [\"BROC\", \"ROC\"],\n monthNames: [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\"\n ],\n monthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\n dayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n dayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n dayNamesMin: [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"],\n digits: null,\n dateFormat: \"yyyy/mm/dd\",\n firstDay: 1,\n isRTL: false\n }\n },\n /** Determine whether this date is in a leap year.\n @memberof TaiwanCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {boolean} true if this is a leap year, false if not.\n @throws Error if an invalid year or a different calendar used. */\n leapYear: function(year) {\n var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n var year = this._t2gYear(date.year());\n return gregorianCalendar.leapYear(year);\n },\n /** Determine the week of the year for a date - ISO 8601.\n @memberof TaiwanCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {number} The week of the year.\n @throws Error if an invalid date or a different calendar used. */\n weekOfYear: function(year, month, day) {\n var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n var year = this._t2gYear(date.year());\n return gregorianCalendar.weekOfYear(year, date.month(), date.day());\n },\n /** Retrieve the number of days in a month.\n @memberof TaiwanCalendar\n @param year {CDate|number} The date to examine or the year of the month.\n @param [month] {number} The month.\n @return {number} The number of days in this month.\n @throws Error if an invalid month/year or a different calendar used. */\n daysInMonth: function(year, month) {\n var date = this._validate(year, month, this.minDay, main.local.invalidMonth);\n return this.daysPerMonth[date.month() - 1] + (date.month() === 2 && this.leapYear(date.year()) ? 1 : 0);\n },\n /** Determine whether this date is a week day.\n @memberof TaiwanCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {boolean} true if a week day, false if not.\n @throws Error if an invalid date or a different calendar used. */\n weekDay: function(year, month, day) {\n return (this.dayOfWeek(year, month, day) || 7) < 6;\n },\n /** Retrieve the Julian date equivalent for this date,\n i.e. days since January 1, 4713 BCE Greenwich noon.\n @memberof TaiwanCalendar\n @param year {CDate|number} The date to convert or the year to convert.\n @param [month] {number} The month to convert.\n @param [day] {number} The day to convert.\n @return {number} The equivalent Julian date.\n @throws Error if an invalid date or a different calendar used. */\n toJD: function(year, month, day) {\n var date = this._validate(year, month, day, main.local.invalidDate);\n var year = this._t2gYear(date.year());\n return gregorianCalendar.toJD(year, date.month(), date.day());\n },\n /** Create a new date from a Julian date.\n @memberof TaiwanCalendar\n @param jd {number} The Julian date to convert.\n @return {CDate} The equivalent date. */\n fromJD: function(jd) {\n var date = gregorianCalendar.fromJD(jd);\n var year = this._g2tYear(date.year());\n return this.newDate(year, date.month(), date.day());\n },\n /** Convert Taiwanese to Gregorian year.\n @memberof TaiwanCalendar\n @private\n @param year {number} The Taiwanese year.\n @return {number} The corresponding Gregorian year. */\n _t2gYear: function(year) {\n return year + this.yearsOffset + (year >= -this.yearsOffset && year <= -1 ? 1 : 0);\n },\n /** Convert Gregorian to Taiwanese year.\n @memberof TaiwanCalendar\n @private\n @param year {number} The Gregorian year.\n @return {number} The corresponding Taiwanese year. */\n _g2tYear: function(year) {\n return year - this.yearsOffset - (year >= 1 && year <= this.yearsOffset ? 1 : 0);\n }\n });\n main.calendars.taiwan = TaiwanCalendar;\n }\n });\n\n // node_modules/world-calendars/dist/calendars/thai.js\n var require_thai = __commonJS({\n \"node_modules/world-calendars/dist/calendars/thai.js\"() {\n var main = require_main();\n var assign = require_object_assign();\n var gregorianCalendar = main.instance();\n function ThaiCalendar(language) {\n this.local = this.regionalOptions[language || \"\"] || this.regionalOptions[\"\"];\n }\n ThaiCalendar.prototype = new main.baseCalendar();\n assign(ThaiCalendar.prototype, {\n /** The calendar name.\n @memberof ThaiCalendar */\n name: \"Thai\",\n /** Julian date of start of Thai epoch: 1 January 543 BCE (Gregorian).\n @memberof ThaiCalendar */\n jdEpoch: 15230985e-1,\n /** Difference in years between Thai and Gregorian calendars.\n @memberof ThaiCalendar */\n yearsOffset: 543,\n /** Days per month in a common year.\n @memberof ThaiCalendar */\n daysPerMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n /** true if has a year zero, false if not.\n @memberof ThaiCalendar */\n hasYearZero: false,\n /** The minimum month number.\n @memberof ThaiCalendar */\n minMonth: 1,\n /** The first month in the year.\n @memberof ThaiCalendar */\n firstMonth: 1,\n /** The minimum day number.\n @memberof ThaiCalendar */\n minDay: 1,\n /** Localisations for the plugin.\n Entries are objects indexed by the language code ('' being the default US/English).\n Each object has the following attributes.\n @memberof ThaiCalendar\n @property name {string} The calendar name.\n @property epochs {string[]} The epoch names.\n @property monthNames {string[]} The long names of the months of the year.\n @property monthNamesShort {string[]} The short names of the months of the year.\n @property dayNames {string[]} The long names of the days of the week.\n @property dayNamesShort {string[]} The short names of the days of the week.\n @property dayNamesMin {string[]} The minimal names of the days of the week.\n @property dateFormat {string} The date format for this calendar.\n See the options on formatDate for details.\n @property firstDay {number} The number of the first day of the week, starting at 0.\n @property isRTL {number} true if this localisation reads right-to-left. */\n regionalOptions: {\n // Localisations\n \"\": {\n name: \"Thai\",\n epochs: [\"BBE\", \"BE\"],\n monthNames: [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\"\n ],\n monthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\n dayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n dayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n dayNamesMin: [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"],\n digits: null,\n dateFormat: \"dd/mm/yyyy\",\n firstDay: 0,\n isRTL: false\n }\n },\n /** Determine whether this date is in a leap year.\n @memberof ThaiCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {boolean} true if this is a leap year, false if not.\n @throws Error if an invalid year or a different calendar used. */\n leapYear: function(year) {\n var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n var year = this._t2gYear(date.year());\n return gregorianCalendar.leapYear(year);\n },\n /** Determine the week of the year for a date - ISO 8601.\n @memberof ThaiCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {number} The week of the year.\n @throws Error if an invalid date or a different calendar used. */\n weekOfYear: function(year, month, day) {\n var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n var year = this._t2gYear(date.year());\n return gregorianCalendar.weekOfYear(year, date.month(), date.day());\n },\n /** Retrieve the number of days in a month.\n @memberof ThaiCalendar\n @param year {CDate|number} The date to examine or the year of the month.\n @param [month] {number} The month.\n @return {number} The number of days in this month.\n @throws Error if an invalid month/year or a different calendar used. */\n daysInMonth: function(year, month) {\n var date = this._validate(year, month, this.minDay, main.local.invalidMonth);\n return this.daysPerMonth[date.month() - 1] + (date.month() === 2 && this.leapYear(date.year()) ? 1 : 0);\n },\n /** Determine whether this date is a week day.\n @memberof ThaiCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {boolean} true if a week day, false if not.\n @throws Error if an invalid date or a different calendar used. */\n weekDay: function(year, month, day) {\n return (this.dayOfWeek(year, month, day) || 7) < 6;\n },\n /** Retrieve the Julian date equivalent for this date,\n i.e. days since January 1, 4713 BCE Greenwich noon.\n @memberof ThaiCalendar\n @param year {CDate|number} The date to convert or the year to convert.\n @param [month] {number} The month to convert.\n @param [day] {number} The day to convert.\n @return {number} The equivalent Julian date.\n @throws Error if an invalid date or a different calendar used. */\n toJD: function(year, month, day) {\n var date = this._validate(year, month, day, main.local.invalidDate);\n var year = this._t2gYear(date.year());\n return gregorianCalendar.toJD(year, date.month(), date.day());\n },\n /** Create a new date from a Julian date.\n @memberof ThaiCalendar\n @param jd {number} The Julian date to convert.\n @return {CDate} The equivalent date. */\n fromJD: function(jd) {\n var date = gregorianCalendar.fromJD(jd);\n var year = this._g2tYear(date.year());\n return this.newDate(year, date.month(), date.day());\n },\n /** Convert Thai to Gregorian year.\n @memberof ThaiCalendar\n @private\n @param year {number} The Thai year.\n @return {number} The corresponding Gregorian year. */\n _t2gYear: function(year) {\n return year - this.yearsOffset - (year >= 1 && year <= this.yearsOffset ? 1 : 0);\n },\n /** Convert Gregorian to Thai year.\n @memberof ThaiCalendar\n @private\n @param year {number} The Gregorian year.\n @return {number} The corresponding Thai year. */\n _g2tYear: function(year) {\n return year + this.yearsOffset + (year >= -this.yearsOffset && year <= -1 ? 1 : 0);\n }\n });\n main.calendars.thai = ThaiCalendar;\n }\n });\n\n // node_modules/world-calendars/dist/calendars/ummalqura.js\n var require_ummalqura = __commonJS({\n \"node_modules/world-calendars/dist/calendars/ummalqura.js\"() {\n var main = require_main();\n var assign = require_object_assign();\n function UmmAlQuraCalendar(language) {\n this.local = this.regionalOptions[language || \"\"] || this.regionalOptions[\"\"];\n }\n UmmAlQuraCalendar.prototype = new main.baseCalendar();\n assign(UmmAlQuraCalendar.prototype, {\n /** The calendar name.\n @memberof UmmAlQuraCalendar */\n name: \"UmmAlQura\",\n //jdEpoch: 1948440, // Julian date of start of UmmAlQura epoch: 14 March 1937 CE\n //daysPerMonth: // Days per month in a common year, replaced by a method.\n /** true if has a year zero, false if not.\n @memberof UmmAlQuraCalendar */\n hasYearZero: false,\n /** The minimum month number.\n @memberof UmmAlQuraCalendar */\n minMonth: 1,\n /** The first month in the year.\n @memberof UmmAlQuraCalendar */\n firstMonth: 1,\n /** The minimum day number.\n @memberof UmmAlQuraCalendar */\n minDay: 1,\n /** Localisations for the plugin.\n Entries are objects indexed by the language code ('' being the default US/English).\n Each object has the following attributes.\n @memberof UmmAlQuraCalendar\n @property name {string} The calendar name.\n @property epochs {string[]} The epoch names.\n @property monthNames {string[]} The long names of the months of the year.\n @property monthNamesShort {string[]} The short names of the months of the year.\n @property dayNames {string[]} The long names of the days of the week.\n @property dayNamesShort {string[]} The short names of the days of the week.\n @property dayNamesMin {string[]} The minimal names of the days of the week.\n @property dateFormat {string} The date format for this calendar.\n See the options on formatDate for details.\n @property firstDay {number} The number of the first day of the week, starting at 0.\n @property isRTL {number} true if this localisation reads right-to-left. */\n regionalOptions: {\n // Localisations\n \"\": {\n name: \"Umm al-Qura\",\n epochs: [\"BH\", \"AH\"],\n monthNames: [\n \"Al-Muharram\",\n \"Safar\",\n \"Rabi' al-awwal\",\n \"Rabi' Al-Thani\",\n \"Jumada Al-Awwal\",\n \"Jumada Al-Thani\",\n \"Rajab\",\n \"Sha'aban\",\n \"Ramadan\",\n \"Shawwal\",\n \"Dhu al-Qi'dah\",\n \"Dhu al-Hijjah\"\n ],\n monthNamesShort: [\"Muh\", \"Saf\", \"Rab1\", \"Rab2\", \"Jum1\", \"Jum2\", \"Raj\", \"Sha'\", \"Ram\", \"Shaw\", \"DhuQ\", \"DhuH\"],\n dayNames: [\"Yawm al-Ahad\", \"Yawm al-Ithnain\", \"Yawm al-Thal\\u0101th\\u0101\\u2019\", \"Yawm al-Arba\\u2018\\u0101\\u2019\", \"Yawm al-Kham\\u012Bs\", \"Yawm al-Jum\\u2018a\", \"Yawm al-Sabt\"],\n dayNamesMin: [\"Ah\", \"Ith\", \"Th\", \"Ar\", \"Kh\", \"Ju\", \"Sa\"],\n digits: null,\n dateFormat: \"yyyy/mm/dd\",\n firstDay: 6,\n isRTL: true\n }\n },\n /** Determine whether this date is in a leap year.\n @memberof UmmAlQuraCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {boolean} true if this is a leap year, false if not.\n @throws Error if an invalid year or a different calendar used. */\n leapYear: function(year) {\n var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear);\n return this.daysInYear(date.year()) === 355;\n },\n /** Determine the week of the year for a date.\n @memberof UmmAlQuraCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {number} The week of the year.\n @throws Error if an invalid date or a different calendar used. */\n weekOfYear: function(year, month, day) {\n var checkDate = this.newDate(year, month, day);\n checkDate.add(-checkDate.dayOfWeek(), \"d\");\n return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1;\n },\n /** Retrieve the number of days in a year.\n @memberof UmmAlQuraCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @return {number} The number of days.\n @throws Error if an invalid year or a different calendar used. */\n daysInYear: function(year) {\n var daysCount = 0;\n for (var i = 1; i <= 12; i++) {\n daysCount += this.daysInMonth(year, i);\n }\n return daysCount;\n },\n /** Retrieve the number of days in a month.\n @memberof UmmAlQuraCalendar\n @param year {CDate|number} The date to examine or the year of the month.\n @param [month] {number} The month.\n @return {number} The number of days in this month.\n @throws Error if an invalid month/year or a different calendar used. */\n daysInMonth: function(year, month) {\n var date = this._validate(year, month, this.minDay, main.local.invalidMonth);\n var mcjdn = date.toJD() - 24e5 + 0.5;\n var index = 0;\n for (var i = 0; i < ummalqura_dat.length; i++) {\n if (ummalqura_dat[i] > mcjdn) {\n return ummalqura_dat[index] - ummalqura_dat[index - 1];\n }\n index++;\n }\n return 30;\n },\n /** Determine whether this date is a week day.\n @memberof UmmAlQuraCalendar\n @param year {CDate|number} The date to examine or the year to examine.\n @param [month] {number} The month to examine.\n @param [day] {number} The day to examine.\n @return {boolean} true if a week day, false if not.\n @throws Error if an invalid date or a different calendar used. */\n weekDay: function(year, month, day) {\n return this.dayOfWeek(year, month, day) !== 5;\n },\n /** Retrieve the Julian date equivalent for this date,\n i.e. days since January 1, 4713 BCE Greenwich noon.\n @memberof UmmAlQuraCalendar\n @param year {CDate|number} The date to convert or the year to convert.\n @param [month] {number} The month to convert.\n @param [day] {number} The day to convert.\n @return {number} The equivalent Julian date.\n @throws Error if an invalid date or a different calendar used. */\n toJD: function(year, month, day) {\n var date = this._validate(year, month, day, main.local.invalidDate);\n var index = 12 * (date.year() - 1) + date.month() - 15292;\n var mcjdn = date.day() + ummalqura_dat[index - 1] - 1;\n return mcjdn + 24e5 - 0.5;\n },\n /** Create a new date from a Julian date.\n @memberof UmmAlQuraCalendar\n @param jd {number} The Julian date to convert.\n @return {CDate} The equivalent date. */\n fromJD: function(jd) {\n var mcjdn = jd - 24e5 + 0.5;\n var index = 0;\n for (var i = 0; i < ummalqura_dat.length; i++) {\n if (ummalqura_dat[i] > mcjdn) break;\n index++;\n }\n var lunation = index + 15292;\n var ii = Math.floor((lunation - 1) / 12);\n var year = ii + 1;\n var month = lunation - 12 * ii;\n var day = mcjdn - ummalqura_dat[index - 1] + 1;\n return this.newDate(year, month, day);\n },\n /** Determine whether a date is valid for this calendar.\n @memberof UmmAlQuraCalendar\n @param year {number} The year to examine.\n @param month {number} The month to examine.\n @param day {number} The day to examine.\n @return {boolean} true if a valid date, false if not. */\n isValid: function(year, month, day) {\n var valid = main.baseCalendar.prototype.isValid.apply(this, arguments);\n if (valid) {\n year = year.year != null ? year.year : year;\n valid = year >= 1276 && year <= 1500;\n }\n return valid;\n },\n /** Check that a candidate date is from the same calendar and is valid.\n @memberof UmmAlQuraCalendar\n @private\n @param year {CDate|number} The date to validate or the year to validate.\n @param month {number} The month to validate.\n @param day {number} The day to validate.\n @param error {string} Error message if invalid.\n @throws Error if different calendars used or invalid date. */\n _validate: function(year, month, day, error) {\n var date = main.baseCalendar.prototype._validate.apply(this, arguments);\n if (date.year < 1276 || date.year > 1500) {\n throw error.replace(/\\{0\\}/, this.local.name);\n }\n return date;\n }\n });\n main.calendars.ummalqura = UmmAlQuraCalendar;\n var ummalqura_dat = [\n 20,\n 50,\n 79,\n 109,\n 138,\n 168,\n 197,\n 227,\n 256,\n 286,\n 315,\n 345,\n 374,\n 404,\n 433,\n 463,\n 492,\n 522,\n 551,\n 581,\n 611,\n 641,\n 670,\n 700,\n 729,\n 759,\n 788,\n 818,\n 847,\n 877,\n 906,\n 936,\n 965,\n 995,\n 1024,\n 1054,\n 1083,\n 1113,\n 1142,\n 1172,\n 1201,\n 1231,\n 1260,\n 1290,\n 1320,\n 1350,\n 1379,\n 1409,\n 1438,\n 1468,\n 1497,\n 1527,\n 1556,\n 1586,\n 1615,\n 1645,\n 1674,\n 1704,\n 1733,\n 1763,\n 1792,\n 1822,\n 1851,\n 1881,\n 1910,\n 1940,\n 1969,\n 1999,\n 2028,\n 2058,\n 2087,\n 2117,\n 2146,\n 2176,\n 2205,\n 2235,\n 2264,\n 2294,\n 2323,\n 2353,\n 2383,\n 2413,\n 2442,\n 2472,\n 2501,\n 2531,\n 2560,\n 2590,\n 2619,\n 2649,\n 2678,\n 2708,\n 2737,\n 2767,\n 2796,\n 2826,\n 2855,\n 2885,\n 2914,\n 2944,\n 2973,\n 3003,\n 3032,\n 3062,\n 3091,\n 3121,\n 3150,\n 3180,\n 3209,\n 3239,\n 3268,\n 3298,\n 3327,\n 3357,\n 3386,\n 3416,\n 3446,\n 3476,\n 3505,\n 3535,\n 3564,\n 3594,\n 3623,\n 3653,\n 3682,\n 3712,\n 3741,\n 3771,\n 3800,\n 3830,\n 3859,\n 3889,\n 3918,\n 3948,\n 3977,\n 4007,\n 4036,\n 4066,\n 4095,\n 4125,\n 4155,\n 4185,\n 4214,\n 4244,\n 4273,\n 4303,\n 4332,\n 4362,\n 4391,\n 4421,\n 4450,\n 4480,\n 4509,\n 4539,\n 4568,\n 4598,\n 4627,\n 4657,\n 4686,\n 4716,\n 4745,\n 4775,\n 4804,\n 4834,\n 4863,\n 4893,\n 4922,\n 4952,\n 4981,\n 5011,\n 5040,\n 5070,\n 5099,\n 5129,\n 5158,\n 5188,\n 5218,\n 5248,\n 5277,\n 5307,\n 5336,\n 5366,\n 5395,\n 5425,\n 5454,\n 5484,\n 5513,\n 5543,\n 5572,\n 5602,\n 5631,\n 5661,\n 5690,\n 5720,\n 5749,\n 5779,\n 5808,\n 5838,\n 5867,\n 5897,\n 5926,\n 5956,\n 5985,\n 6015,\n 6044,\n 6074,\n 6103,\n 6133,\n 6162,\n 6192,\n 6221,\n 6251,\n 6281,\n 6311,\n 6340,\n 6370,\n 6399,\n 6429,\n 6458,\n 6488,\n 6517,\n 6547,\n 6576,\n 6606,\n 6635,\n 6665,\n 6694,\n 6724,\n 6753,\n 6783,\n 6812,\n 6842,\n 6871,\n 6901,\n 6930,\n 6960,\n 6989,\n 7019,\n 7048,\n 7078,\n 7107,\n 7137,\n 7166,\n 7196,\n 7225,\n 7255,\n 7284,\n 7314,\n 7344,\n 7374,\n 7403,\n 7433,\n 7462,\n 7492,\n 7521,\n 7551,\n 7580,\n 7610,\n 7639,\n 7669,\n 7698,\n 7728,\n 7757,\n 7787,\n 7816,\n 7846,\n 7875,\n 7905,\n 7934,\n 7964,\n 7993,\n 8023,\n 8053,\n 8083,\n 8112,\n 8142,\n 8171,\n 8201,\n 8230,\n 8260,\n 8289,\n 8319,\n 8348,\n 8378,\n 8407,\n 8437,\n 8466,\n 8496,\n 8525,\n 8555,\n 8584,\n 8614,\n 8643,\n 8673,\n 8702,\n 8732,\n 8761,\n 8791,\n 8821,\n 8850,\n 8880,\n 8909,\n 8938,\n 8968,\n 8997,\n 9027,\n 9056,\n 9086,\n 9115,\n 9145,\n 9175,\n 9205,\n 9234,\n 9264,\n 9293,\n 9322,\n 9352,\n 9381,\n 9410,\n 9440,\n 9470,\n 9499,\n 9529,\n 9559,\n 9589,\n 9618,\n 9648,\n 9677,\n 9706,\n 9736,\n 9765,\n 9794,\n 9824,\n 9853,\n 9883,\n 9913,\n 9943,\n 9972,\n 10002,\n 10032,\n 10061,\n 10090,\n 10120,\n 10149,\n 10178,\n 10208,\n 10237,\n 10267,\n 10297,\n 10326,\n 10356,\n 10386,\n 10415,\n 10445,\n 10474,\n 10504,\n 10533,\n 10562,\n 10592,\n 10621,\n 10651,\n 10680,\n 10710,\n 10740,\n 10770,\n 10799,\n 10829,\n 10858,\n 10888,\n 10917,\n 10947,\n 10976,\n 11005,\n 11035,\n 11064,\n 11094,\n 11124,\n 11153,\n 11183,\n 11213,\n 11242,\n 11272,\n 11301,\n 11331,\n 11360,\n 11389,\n 11419,\n 11448,\n 11478,\n 11507,\n 11537,\n 11567,\n 11596,\n 11626,\n 11655,\n 11685,\n 11715,\n 11744,\n 11774,\n 11803,\n 11832,\n 11862,\n 11891,\n 11921,\n 11950,\n 11980,\n 12010,\n 12039,\n 12069,\n 12099,\n 12128,\n 12158,\n 12187,\n 12216,\n 12246,\n 12275,\n 12304,\n 12334,\n 12364,\n 12393,\n 12423,\n 12453,\n 12483,\n 12512,\n 12542,\n 12571,\n 12600,\n 12630,\n 12659,\n 12688,\n 12718,\n 12747,\n 12777,\n 12807,\n 12837,\n 12866,\n 12896,\n 12926,\n 12955,\n 12984,\n 13014,\n 13043,\n 13072,\n 13102,\n 13131,\n 13161,\n 13191,\n 13220,\n 13250,\n 13280,\n 13310,\n 13339,\n 13368,\n 13398,\n 13427,\n 13456,\n 13486,\n 13515,\n 13545,\n 13574,\n 13604,\n 13634,\n 13664,\n 13693,\n 13723,\n 13752,\n 13782,\n 13811,\n 13840,\n 13870,\n 13899,\n 13929,\n 13958,\n 13988,\n 14018,\n 14047,\n 14077,\n 14107,\n 14136,\n 14166,\n 14195,\n 14224,\n 14254,\n 14283,\n 14313,\n 14342,\n 14372,\n 14401,\n 14431,\n 14461,\n 14490,\n 14520,\n 14550,\n 14579,\n 14609,\n 14638,\n 14667,\n 14697,\n 14726,\n 14756,\n 14785,\n 14815,\n 14844,\n 14874,\n 14904,\n 14933,\n 14963,\n 14993,\n 15021,\n 15051,\n 15081,\n 15110,\n 15140,\n 15169,\n 15199,\n 15228,\n 15258,\n 15287,\n 15317,\n 15347,\n 15377,\n 15406,\n 15436,\n 15465,\n 15494,\n 15524,\n 15553,\n 15582,\n 15612,\n 15641,\n 15671,\n 15701,\n 15731,\n 15760,\n 15790,\n 15820,\n 15849,\n 15878,\n 15908,\n 15937,\n 15966,\n 15996,\n 16025,\n 16055,\n 16085,\n 16114,\n 16144,\n 16174,\n 16204,\n 16233,\n 16262,\n 16292,\n 16321,\n 16350,\n 16380,\n 16409,\n 16439,\n 16468,\n 16498,\n 16528,\n 16558,\n 16587,\n 16617,\n 16646,\n 16676,\n 16705,\n 16734,\n 16764,\n 16793,\n 16823,\n 16852,\n 16882,\n 16912,\n 16941,\n 16971,\n 17001,\n 17030,\n 17060,\n 17089,\n 17118,\n 17148,\n 17177,\n 17207,\n 17236,\n 17266,\n 17295,\n 17325,\n 17355,\n 17384,\n 17414,\n 17444,\n 17473,\n 17502,\n 17532,\n 17561,\n 17591,\n 17620,\n 17650,\n 17679,\n 17709,\n 17738,\n 17768,\n 17798,\n 17827,\n 17857,\n 17886,\n 17916,\n 17945,\n 17975,\n 18004,\n 18034,\n 18063,\n 18093,\n 18122,\n 18152,\n 18181,\n 18211,\n 18241,\n 18270,\n 18300,\n 18330,\n 18359,\n 18388,\n 18418,\n 18447,\n 18476,\n 18506,\n 18535,\n 18565,\n 18595,\n 18625,\n 18654,\n 18684,\n 18714,\n 18743,\n 18772,\n 18802,\n 18831,\n 18860,\n 18890,\n 18919,\n 18949,\n 18979,\n 19008,\n 19038,\n 19068,\n 19098,\n 19127,\n 19156,\n 19186,\n 19215,\n 19244,\n 19274,\n 19303,\n 19333,\n 19362,\n 19392,\n 19422,\n 19452,\n 19481,\n 19511,\n 19540,\n 19570,\n 19599,\n 19628,\n 19658,\n 19687,\n 19717,\n 19746,\n 19776,\n 19806,\n 19836,\n 19865,\n 19895,\n 19924,\n 19954,\n 19983,\n 20012,\n 20042,\n 20071,\n 20101,\n 20130,\n 20160,\n 20190,\n 20219,\n 20249,\n 20279,\n 20308,\n 20338,\n 20367,\n 20396,\n 20426,\n 20455,\n 20485,\n 20514,\n 20544,\n 20573,\n 20603,\n 20633,\n 20662,\n 20692,\n 20721,\n 20751,\n 20780,\n 20810,\n 20839,\n 20869,\n 20898,\n 20928,\n 20957,\n 20987,\n 21016,\n 21046,\n 21076,\n 21105,\n 21135,\n 21164,\n 21194,\n 21223,\n 21253,\n 21282,\n 21312,\n 21341,\n 21371,\n 21400,\n 21430,\n 21459,\n 21489,\n 21519,\n 21548,\n 21578,\n 21607,\n 21637,\n 21666,\n 21696,\n 21725,\n 21754,\n 21784,\n 21813,\n 21843,\n 21873,\n 21902,\n 21932,\n 21962,\n 21991,\n 22021,\n 22050,\n 22080,\n 22109,\n 22138,\n 22168,\n 22197,\n 22227,\n 22256,\n 22286,\n 22316,\n 22346,\n 22375,\n 22405,\n 22434,\n 22464,\n 22493,\n 22522,\n 22552,\n 22581,\n 22611,\n 22640,\n 22670,\n 22700,\n 22730,\n 22759,\n 22789,\n 22818,\n 22848,\n 22877,\n 22906,\n 22936,\n 22965,\n 22994,\n 23024,\n 23054,\n 23083,\n 23113,\n 23143,\n 23173,\n 23202,\n 23232,\n 23261,\n 23290,\n 23320,\n 23349,\n 23379,\n 23408,\n 23438,\n 23467,\n 23497,\n 23527,\n 23556,\n 23586,\n 23616,\n 23645,\n 23674,\n 23704,\n 23733,\n 23763,\n 23792,\n 23822,\n 23851,\n 23881,\n 23910,\n 23940,\n 23970,\n 23999,\n 24029,\n 24058,\n 24088,\n 24117,\n 24147,\n 24176,\n 24206,\n 24235,\n 24265,\n 24294,\n 24324,\n 24353,\n 24383,\n 24413,\n 24442,\n 24472,\n 24501,\n 24531,\n 24560,\n 24590,\n 24619,\n 24648,\n 24678,\n 24707,\n 24737,\n 24767,\n 24796,\n 24826,\n 24856,\n 24885,\n 24915,\n 24944,\n 24974,\n 25003,\n 25032,\n 25062,\n 25091,\n 25121,\n 25150,\n 25180,\n 25210,\n 25240,\n 25269,\n 25299,\n 25328,\n 25358,\n 25387,\n 25416,\n 25446,\n 25475,\n 25505,\n 25534,\n 25564,\n 25594,\n 25624,\n 25653,\n 25683,\n 25712,\n 25742,\n 25771,\n 25800,\n 25830,\n 25859,\n 25888,\n 25918,\n 25948,\n 25977,\n 26007,\n 26037,\n 26067,\n 26096,\n 26126,\n 26155,\n 26184,\n 26214,\n 26243,\n 26272,\n 26302,\n 26332,\n 26361,\n 26391,\n 26421,\n 26451,\n 26480,\n 26510,\n 26539,\n 26568,\n 26598,\n 26627,\n 26656,\n 26686,\n 26715,\n 26745,\n 26775,\n 26805,\n 26834,\n 26864,\n 26893,\n 26923,\n 26952,\n 26982,\n 27011,\n 27041,\n 27070,\n 27099,\n 27129,\n 27159,\n 27188,\n 27218,\n 27248,\n 27277,\n 27307,\n 27336,\n 27366,\n 27395,\n 27425,\n 27454,\n 27484,\n 27513,\n 27542,\n 27572,\n 27602,\n 27631,\n 27661,\n 27691,\n 27720,\n 27750,\n 27779,\n 27809,\n 27838,\n 27868,\n 27897,\n 27926,\n 27956,\n 27985,\n 28015,\n 28045,\n 28074,\n 28104,\n 28134,\n 28163,\n 28193,\n 28222,\n 28252,\n 28281,\n 28310,\n 28340,\n 28369,\n 28399,\n 28428,\n 28458,\n 28488,\n 28517,\n 28547,\n 28577,\n // From 1356\n 28607,\n 28636,\n 28665,\n 28695,\n 28724,\n 28754,\n 28783,\n 28813,\n 28843,\n 28872,\n 28901,\n 28931,\n 28960,\n 28990,\n 29019,\n 29049,\n 29078,\n 29108,\n 29137,\n 29167,\n 29196,\n 29226,\n 29255,\n 29285,\n 29315,\n 29345,\n 29375,\n 29404,\n 29434,\n 29463,\n 29492,\n 29522,\n 29551,\n 29580,\n 29610,\n 29640,\n 29669,\n 29699,\n 29729,\n 29759,\n 29788,\n 29818,\n 29847,\n 29876,\n 29906,\n 29935,\n 29964,\n 29994,\n 30023,\n 30053,\n 30082,\n 30112,\n 30141,\n 30171,\n 30200,\n 30230,\n 30259,\n 30289,\n 30318,\n 30348,\n 30378,\n 30408,\n 30437,\n 30467,\n 30496,\n 30526,\n 30555,\n 30585,\n 30614,\n 30644,\n 30673,\n 30703,\n 30732,\n 30762,\n 30791,\n 30821,\n 30850,\n 30880,\n 30909,\n 30939,\n 30968,\n 30998,\n 31027,\n 31057,\n 31086,\n 31116,\n 31145,\n 31175,\n 31204,\n 31234,\n 31263,\n 31293,\n 31322,\n 31352,\n 31381,\n 31411,\n 31441,\n 31471,\n 31500,\n 31530,\n 31559,\n 31589,\n 31618,\n 31648,\n 31676,\n 31706,\n 31736,\n 31766,\n 31795,\n 31825,\n 31854,\n 31884,\n 31913,\n 31943,\n 31972,\n 32002,\n 32031,\n 32061,\n 32090,\n 32120,\n 32150,\n 32180,\n 32209,\n 32239,\n 32268,\n 32298,\n 32327,\n 32357,\n 32386,\n 32416,\n 32445,\n 32475,\n 32504,\n 32534,\n 32563,\n 32593,\n 32622,\n 32652,\n 32681,\n 32711,\n 32740,\n 32770,\n 32799,\n 32829,\n 32858,\n 32888,\n 32917,\n 32947,\n 32976,\n 33006,\n 33035,\n 33065,\n 33094,\n 33124,\n 33153,\n 33183,\n 33213,\n 33243,\n 33272,\n 33302,\n 33331,\n 33361,\n 33390,\n 33420,\n 33450,\n 33479,\n 33509,\n 33539,\n 33568,\n 33598,\n 33627,\n 33657,\n 33686,\n 33716,\n 33745,\n 33775,\n 33804,\n 33834,\n 33863,\n 33893,\n 33922,\n 33952,\n 33981,\n 34011,\n 34040,\n 34069,\n 34099,\n 34128,\n 34158,\n 34187,\n 34217,\n 34247,\n 34277,\n 34306,\n 34336,\n 34365,\n 34395,\n 34424,\n 34454,\n 34483,\n 34512,\n 34542,\n 34571,\n 34601,\n 34631,\n 34660,\n 34690,\n 34719,\n 34749,\n 34778,\n 34808,\n 34837,\n 34867,\n 34896,\n 34926,\n 34955,\n 34985,\n 35015,\n 35044,\n 35074,\n 35103,\n 35133,\n 35162,\n 35192,\n 35222,\n 35251,\n 35280,\n 35310,\n 35340,\n 35370,\n 35399,\n 35429,\n 35458,\n 35488,\n 35517,\n 35547,\n 35576,\n 35605,\n 35635,\n 35665,\n 35694,\n 35723,\n 35753,\n 35782,\n 35811,\n 35841,\n 35871,\n 35901,\n 35930,\n 35960,\n 35989,\n 36019,\n 36048,\n 36078,\n 36107,\n 36136,\n 36166,\n 36195,\n 36225,\n 36254,\n 36284,\n 36314,\n 36343,\n 36373,\n 36403,\n 36433,\n 36462,\n 36492,\n 36521,\n 36551,\n 36580,\n 36610,\n 36639,\n 36669,\n 36698,\n 36728,\n 36757,\n 36786,\n 36816,\n 36845,\n 36875,\n 36904,\n 36934,\n 36963,\n 36993,\n 37022,\n 37052,\n 37081,\n 37111,\n 37141,\n 37170,\n 37200,\n 37229,\n 37259,\n 37288,\n 37318,\n 37347,\n 37377,\n 37406,\n 37436,\n 37465,\n 37495,\n 37524,\n 37554,\n 37584,\n 37613,\n 37643,\n 37672,\n 37701,\n 37731,\n 37760,\n 37790,\n 37819,\n 37849,\n 37878,\n 37908,\n 37938,\n 37967,\n 37997,\n 38027,\n 38056,\n 38085,\n 38115,\n 38144,\n 38174,\n 38203,\n 38233,\n 38262,\n 38292,\n 38322,\n 38351,\n 38381,\n 38410,\n 38440,\n 38469,\n 38499,\n 38528,\n 38558,\n 38587,\n 38617,\n 38646,\n 38676,\n 38705,\n 38735,\n 38764,\n 38794,\n 38823,\n 38853,\n 38882,\n 38912,\n 38941,\n 38971,\n 39001,\n 39030,\n 39059,\n 39089,\n 39118,\n 39148,\n 39178,\n 39208,\n 39237,\n 39267,\n 39297,\n 39326,\n 39355,\n 39385,\n 39414,\n 39444,\n 39473,\n 39503,\n 39532,\n 39562,\n 39592,\n 39621,\n 39650,\n 39680,\n 39709,\n 39739,\n 39768,\n 39798,\n 39827,\n 39857,\n 39886,\n 39916,\n 39946,\n 39975,\n 40005,\n 40035,\n 40064,\n 40094,\n 40123,\n 40153,\n 40182,\n 40212,\n 40241,\n 40271,\n 40300,\n 40330,\n 40359,\n 40389,\n 40418,\n 40448,\n 40477,\n 40507,\n 40536,\n 40566,\n 40595,\n 40625,\n 40655,\n 40685,\n 40714,\n 40744,\n 40773,\n 40803,\n 40832,\n 40862,\n 40892,\n 40921,\n 40951,\n 40980,\n 41009,\n 41039,\n 41068,\n 41098,\n 41127,\n 41157,\n 41186,\n 41216,\n 41245,\n 41275,\n 41304,\n 41334,\n 41364,\n 41393,\n 41422,\n 41452,\n 41481,\n 41511,\n 41540,\n 41570,\n 41599,\n 41629,\n 41658,\n 41688,\n 41718,\n 41748,\n 41777,\n 41807,\n 41836,\n 41865,\n 41894,\n 41924,\n 41953,\n 41983,\n 42012,\n 42042,\n 42072,\n 42102,\n 42131,\n 42161,\n 42190,\n 42220,\n 42249,\n 42279,\n 42308,\n 42337,\n 42367,\n 42397,\n 42426,\n 42456,\n 42485,\n 42515,\n 42545,\n 42574,\n 42604,\n 42633,\n 42662,\n 42692,\n 42721,\n 42751,\n 42780,\n 42810,\n 42839,\n 42869,\n 42899,\n 42929,\n 42958,\n 42988,\n 43017,\n 43046,\n 43076,\n 43105,\n 43135,\n 43164,\n 43194,\n 43223,\n 43253,\n 43283,\n 43312,\n 43342,\n 43371,\n 43401,\n 43430,\n 43460,\n 43489,\n 43519,\n 43548,\n 43578,\n 43607,\n 43637,\n 43666,\n 43696,\n 43726,\n 43755,\n 43785,\n 43814,\n 43844,\n 43873,\n 43903,\n 43932,\n 43962,\n 43991,\n 44021,\n 44050,\n 44080,\n 44109,\n 44139,\n 44169,\n 44198,\n 44228,\n 44258,\n 44287,\n 44317,\n 44346,\n 44375,\n 44405,\n 44434,\n 44464,\n 44493,\n 44523,\n 44553,\n 44582,\n 44612,\n 44641,\n 44671,\n 44700,\n 44730,\n 44759,\n 44788,\n 44818,\n 44847,\n 44877,\n 44906,\n 44936,\n 44966,\n 44996,\n 45025,\n 45055,\n 45084,\n 45114,\n 45143,\n 45172,\n 45202,\n 45231,\n 45261,\n 45290,\n 45320,\n 45350,\n 45380,\n 45409,\n 45439,\n 45468,\n 45498,\n 45527,\n 45556,\n 45586,\n 45615,\n 45644,\n 45674,\n 45704,\n 45733,\n 45763,\n 45793,\n 45823,\n 45852,\n 45882,\n 45911,\n 45940,\n 45970,\n 45999,\n 46028,\n 46058,\n 46088,\n 46117,\n 46147,\n 46177,\n 46206,\n 46236,\n 46265,\n 46295,\n 46324,\n 46354,\n 46383,\n 46413,\n 46442,\n 46472,\n 46501,\n 46531,\n 46560,\n 46590,\n 46620,\n 46649,\n 46679,\n 46708,\n 46738,\n 46767,\n 46797,\n 46826,\n 46856,\n 46885,\n 46915,\n 46944,\n 46974,\n 47003,\n 47033,\n 47063,\n 47092,\n 47122,\n 47151,\n 47181,\n 47210,\n 47240,\n 47269,\n 47298,\n 47328,\n 47357,\n 47387,\n 47417,\n 47446,\n 47476,\n 47506,\n 47535,\n 47565,\n 47594,\n 47624,\n 47653,\n 47682,\n 47712,\n 47741,\n 47771,\n 47800,\n 47830,\n 47860,\n 47890,\n 47919,\n 47949,\n 47978,\n 48008,\n 48037,\n 48066,\n 48096,\n 48125,\n 48155,\n 48184,\n 48214,\n 48244,\n 48273,\n 48303,\n 48333,\n 48362,\n 48392,\n 48421,\n 48450,\n 48480,\n 48509,\n 48538,\n 48568,\n 48598,\n 48627,\n 48657,\n 48687,\n 48717,\n 48746,\n 48776,\n 48805,\n 48834,\n 48864,\n 48893,\n 48922,\n 48952,\n 48982,\n 49011,\n 49041,\n 49071,\n 49100,\n 49130,\n 49160,\n 49189,\n 49218,\n 49248,\n 49277,\n 49306,\n 49336,\n 49365,\n 49395,\n 49425,\n 49455,\n 49484,\n 49514,\n 49543,\n 49573,\n 49602,\n 49632,\n 49661,\n 49690,\n 49720,\n 49749,\n 49779,\n 49809,\n 49838,\n 49868,\n 49898,\n 49927,\n 49957,\n 49986,\n 50016,\n 50045,\n 50075,\n 50104,\n 50133,\n 50163,\n 50192,\n 50222,\n 50252,\n 50281,\n 50311,\n 50340,\n 50370,\n 50400,\n 50429,\n 50459,\n 50488,\n 50518,\n 50547,\n 50576,\n 50606,\n 50635,\n 50665,\n 50694,\n 50724,\n 50754,\n 50784,\n 50813,\n 50843,\n 50872,\n 50902,\n 50931,\n 50960,\n 50990,\n 51019,\n 51049,\n 51078,\n 51108,\n 51138,\n 51167,\n 51197,\n 51227,\n 51256,\n 51286,\n 51315,\n 51345,\n 51374,\n 51403,\n 51433,\n 51462,\n 51492,\n 51522,\n 51552,\n 51582,\n 51611,\n 51641,\n 51670,\n 51699,\n 51729,\n 51758,\n 51787,\n 51816,\n 51846,\n 51876,\n 51906,\n 51936,\n 51965,\n 51995,\n 52025,\n 52054,\n 52083,\n 52113,\n 52142,\n 52171,\n 52200,\n 52230,\n 52260,\n 52290,\n 52319,\n 52349,\n 52379,\n 52408,\n 52438,\n 52467,\n 52497,\n 52526,\n 52555,\n 52585,\n 52614,\n 52644,\n 52673,\n 52703,\n 52733,\n 52762,\n 52792,\n 52822,\n 52851,\n 52881,\n 52910,\n 52939,\n 52969,\n 52998,\n 53028,\n 53057,\n 53087,\n 53116,\n 53146,\n 53176,\n 53205,\n 53235,\n 53264,\n 53294,\n 53324,\n 53353,\n 53383,\n 53412,\n 53441,\n 53471,\n 53500,\n 53530,\n 53559,\n 53589,\n 53619,\n 53648,\n 53678,\n 53708,\n 53737,\n 53767,\n 53796,\n 53825,\n 53855,\n 53884,\n 53913,\n 53943,\n 53973,\n 54003,\n 54032,\n 54062,\n 54092,\n 54121,\n 54151,\n 54180,\n 54209,\n 54239,\n 54268,\n 54297,\n 54327,\n 54357,\n 54387,\n 54416,\n 54446,\n 54476,\n 54505,\n 54535,\n 54564,\n 54593,\n 54623,\n 54652,\n 54681,\n 54711,\n 54741,\n 54770,\n 54800,\n 54830,\n 54859,\n 54889,\n 54919,\n 54948,\n 54977,\n 55007,\n 55036,\n 55066,\n 55095,\n 55125,\n 55154,\n 55184,\n 55213,\n 55243,\n 55273,\n 55302,\n 55332,\n 55361,\n 55391,\n 55420,\n 55450,\n 55479,\n 55508,\n 55538,\n 55567,\n 55597,\n 55627,\n 55657,\n 55686,\n 55716,\n 55745,\n 55775,\n 55804,\n 55834,\n 55863,\n 55892,\n 55922,\n 55951,\n 55981,\n 56011,\n 56040,\n 56070,\n 56100,\n 56129,\n 56159,\n 56188,\n 56218,\n 56247,\n 56276,\n 56306,\n 56335,\n 56365,\n 56394,\n 56424,\n 56454,\n 56483,\n 56513,\n 56543,\n 56572,\n 56601,\n 56631,\n 56660,\n 56690,\n 56719,\n 56749,\n 56778,\n 56808,\n 56837,\n 56867,\n 56897,\n 56926,\n 56956,\n 56985,\n 57015,\n 57044,\n 57074,\n 57103,\n 57133,\n 57162,\n 57192,\n 57221,\n 57251,\n 57280,\n 57310,\n 57340,\n 57369,\n 57399,\n 57429,\n 57458,\n 57487,\n 57517,\n 57546,\n 57576,\n 57605,\n 57634,\n 57664,\n 57694,\n 57723,\n 57753,\n 57783,\n 57813,\n 57842,\n 57871,\n 57901,\n 57930,\n 57959,\n 57989,\n 58018,\n 58048,\n 58077,\n 58107,\n 58137,\n 58167,\n 58196,\n 58226,\n 58255,\n 58285,\n 58314,\n 58343,\n 58373,\n 58402,\n 58432,\n 58461,\n 58491,\n 58521,\n 58551,\n 58580,\n 58610,\n 58639,\n 58669,\n 58698,\n 58727,\n 58757,\n 58786,\n 58816,\n 58845,\n 58875,\n 58905,\n 58934,\n 58964,\n 58994,\n 59023,\n 59053,\n 59082,\n 59111,\n 59141,\n 59170,\n 59200,\n 59229,\n 59259,\n 59288,\n 59318,\n 59348,\n 59377,\n 59407,\n 59436,\n 59466,\n 59495,\n 59525,\n 59554,\n 59584,\n 59613,\n 59643,\n 59672,\n 59702,\n 59731,\n 59761,\n 59791,\n 59820,\n 59850,\n 59879,\n 59909,\n 59939,\n 59968,\n 59997,\n 60027,\n 60056,\n 60086,\n 60115,\n 60145,\n 60174,\n 60204,\n 60234,\n 60264,\n 60293,\n 60323,\n 60352,\n 60381,\n 60411,\n 60440,\n 60469,\n 60499,\n 60528,\n 60558,\n 60588,\n 60618,\n 60648,\n 60677,\n 60707,\n 60736,\n 60765,\n 60795,\n 60824,\n 60853,\n 60883,\n 60912,\n 60942,\n 60972,\n 61002,\n 61031,\n 61061,\n 61090,\n 61120,\n 61149,\n 61179,\n 61208,\n 61237,\n 61267,\n 61296,\n 61326,\n 61356,\n 61385,\n 61415,\n 61445,\n 61474,\n 61504,\n 61533,\n 61563,\n 61592,\n 61621,\n 61651,\n 61680,\n 61710,\n 61739,\n 61769,\n 61799,\n 61828,\n 61858,\n 61888,\n 61917,\n 61947,\n 61976,\n 62006,\n 62035,\n 62064,\n 62094,\n 62123,\n 62153,\n 62182,\n 62212,\n 62242,\n 62271,\n 62301,\n 62331,\n 62360,\n 62390,\n 62419,\n 62448,\n 62478,\n 62507,\n 62537,\n 62566,\n 62596,\n 62625,\n 62655,\n 62685,\n 62715,\n 62744,\n 62774,\n 62803,\n 62832,\n 62862,\n 62891,\n 62921,\n 62950,\n 62980,\n 63009,\n 63039,\n 63069,\n 63099,\n 63128,\n 63157,\n 63187,\n 63216,\n 63246,\n 63275,\n 63305,\n 63334,\n 63363,\n 63393,\n 63423,\n 63453,\n 63482,\n 63512,\n 63541,\n 63571,\n 63600,\n 63630,\n 63659,\n 63689,\n 63718,\n 63747,\n 63777,\n 63807,\n 63836,\n 63866,\n 63895,\n 63925,\n 63955,\n 63984,\n 64014,\n 64043,\n 64073,\n 64102,\n 64131,\n 64161,\n 64190,\n 64220,\n 64249,\n 64279,\n 64309,\n 64339,\n 64368,\n 64398,\n 64427,\n 64457,\n 64486,\n 64515,\n 64545,\n 64574,\n 64603,\n 64633,\n 64663,\n 64692,\n 64722,\n 64752,\n 64782,\n 64811,\n 64841,\n 64870,\n 64899,\n 64929,\n 64958,\n 64987,\n 65017,\n 65047,\n 65076,\n 65106,\n 65136,\n 65166,\n 65195,\n 65225,\n 65254,\n 65283,\n 65313,\n 65342,\n 65371,\n 65401,\n 65431,\n 65460,\n 65490,\n 65520,\n 65549,\n 65579,\n 65608,\n 65638,\n 65667,\n 65697,\n 65726,\n 65755,\n 65785,\n 65815,\n 65844,\n 65874,\n 65903,\n 65933,\n 65963,\n 65992,\n 66022,\n 66051,\n 66081,\n 66110,\n 66140,\n 66169,\n 66199,\n 66228,\n 66258,\n 66287,\n 66317,\n 66346,\n 66376,\n 66405,\n 66435,\n 66465,\n 66494,\n 66524,\n 66553,\n 66583,\n 66612,\n 66641,\n 66671,\n 66700,\n 66730,\n 66760,\n 66789,\n 66819,\n 66849,\n 66878,\n 66908,\n 66937,\n 66967,\n 66996,\n 67025,\n 67055,\n 67084,\n 67114,\n 67143,\n 67173,\n 67203,\n 67233,\n 67262,\n 67292,\n 67321,\n 67351,\n 67380,\n 67409,\n 67439,\n 67468,\n 67497,\n 67527,\n 67557,\n 67587,\n 67617,\n 67646,\n 67676,\n 67705,\n 67735,\n 67764,\n 67793,\n 67823,\n 67852,\n 67882,\n 67911,\n 67941,\n 67971,\n 68e3,\n 68030,\n 68060,\n 68089,\n 68119,\n 68148,\n 68177,\n 68207,\n 68236,\n 68266,\n 68295,\n 68325,\n 68354,\n 68384,\n 68414,\n 68443,\n 68473,\n 68502,\n 68532,\n 68561,\n 68591,\n 68620,\n 68650,\n 68679,\n 68708,\n 68738,\n 68768,\n 68797,\n 68827,\n 68857,\n 68886,\n 68916,\n 68946,\n 68975,\n 69004,\n 69034,\n 69063,\n 69092,\n 69122,\n 69152,\n 69181,\n 69211,\n 69240,\n 69270,\n 69300,\n 69330,\n 69359,\n 69388,\n 69418,\n 69447,\n 69476,\n 69506,\n 69535,\n 69565,\n 69595,\n 69624,\n 69654,\n 69684,\n 69713,\n 69743,\n 69772,\n 69802,\n 69831,\n 69861,\n 69890,\n 69919,\n 69949,\n 69978,\n 70008,\n 70038,\n 70067,\n 70097,\n 70126,\n 70156,\n 70186,\n 70215,\n 70245,\n 70274,\n 70303,\n 70333,\n 70362,\n 70392,\n 70421,\n 70451,\n 70481,\n 70510,\n 70540,\n 70570,\n 70599,\n 70629,\n 70658,\n 70687,\n 70717,\n 70746,\n 70776,\n 70805,\n 70835,\n 70864,\n 70894,\n 70924,\n 70954,\n 70983,\n 71013,\n 71042,\n 71071,\n 71101,\n 71130,\n 71159,\n 71189,\n 71218,\n 71248,\n 71278,\n 71308,\n 71337,\n 71367,\n 71397,\n 71426,\n 71455,\n 71485,\n 71514,\n 71543,\n 71573,\n 71602,\n 71632,\n 71662,\n 71691,\n 71721,\n 71751,\n 71781,\n 71810,\n 71839,\n 71869,\n 71898,\n 71927,\n 71957,\n 71986,\n 72016,\n 72046,\n 72075,\n 72105,\n 72135,\n 72164,\n 72194,\n 72223,\n 72253,\n 72282,\n 72311,\n 72341,\n 72370,\n 72400,\n 72429,\n 72459,\n 72489,\n 72518,\n 72548,\n 72577,\n 72607,\n 72637,\n 72666,\n 72695,\n 72725,\n 72754,\n 72784,\n 72813,\n 72843,\n 72872,\n 72902,\n 72931,\n 72961,\n 72991,\n 73020,\n 73050,\n 73080,\n 73109,\n 73139,\n 73168,\n 73197,\n 73227,\n 73256,\n 73286,\n 73315,\n 73345,\n 73375,\n 73404,\n 73434,\n 73464,\n 73493,\n 73523,\n 73552,\n 73581,\n 73611,\n 73640,\n 73669,\n 73699,\n 73729,\n 73758,\n 73788,\n 73818,\n 73848,\n 73877,\n 73907,\n 73936,\n 73965,\n 73995,\n 74024,\n 74053,\n 74083,\n 74113,\n 74142,\n 74172,\n 74202,\n 74231,\n 74261,\n 74291,\n 74320,\n 74349,\n 74379,\n 74408,\n 74437,\n 74467,\n 74497,\n 74526,\n 74556,\n 74586,\n 74615,\n 74645,\n 74675,\n 74704,\n 74733,\n 74763,\n 74792,\n 74822,\n 74851,\n 74881,\n 74910,\n 74940,\n 74969,\n 74999,\n 75029,\n 75058,\n 75088,\n 75117,\n 75147,\n 75176,\n 75206,\n 75235,\n 75264,\n 75294,\n 75323,\n 75353,\n 75383,\n 75412,\n 75442,\n 75472,\n 75501,\n 75531,\n 75560,\n 75590,\n 75619,\n 75648,\n 75678,\n 75707,\n 75737,\n 75766,\n 75796,\n 75826,\n 75856,\n 75885,\n 75915,\n 75944,\n 75974,\n 76003,\n 76032,\n 76062,\n 76091,\n 76121,\n 76150,\n 76180,\n 76210,\n 76239,\n 76269,\n 76299,\n 76328,\n 76358,\n 76387,\n 76416,\n 76446,\n 76475,\n 76505,\n 76534,\n 76564,\n 76593,\n 76623,\n 76653,\n 76682,\n 76712,\n 76741,\n 76771,\n 76801,\n 76830,\n 76859,\n 76889,\n 76918,\n 76948,\n 76977,\n 77007,\n 77036,\n 77066,\n 77096,\n 77125,\n 77155,\n 77185,\n 77214,\n 77243,\n 77273,\n 77302,\n 77332,\n 77361,\n 77390,\n 77420,\n 77450,\n 77479,\n 77509,\n 77539,\n 77569,\n 77598,\n 77627,\n 77657,\n 77686,\n 77715,\n 77745,\n 77774,\n 77804,\n 77833,\n 77863,\n 77893,\n 77923,\n 77952,\n 77982,\n 78011,\n 78041,\n 78070,\n 78099,\n 78129,\n 78158,\n 78188,\n 78217,\n 78247,\n 78277,\n 78307,\n 78336,\n 78366,\n 78395,\n 78425,\n 78454,\n 78483,\n 78513,\n 78542,\n 78572,\n 78601,\n 78631,\n 78661,\n 78690,\n 78720,\n 78750,\n 78779,\n 78808,\n 78838,\n 78867,\n 78897,\n 78926,\n 78956,\n 78985,\n 79015,\n 79044,\n 79074,\n 79104,\n 79133,\n 79163,\n 79192,\n 79222,\n 79251,\n 79281,\n 79310,\n 79340,\n 79369,\n 79399,\n 79428,\n 79458,\n 79487,\n 79517,\n 79546,\n 79576,\n 79606,\n 79635,\n 79665,\n 79695,\n 79724,\n 79753,\n 79783,\n 79812,\n 79841,\n 79871,\n 79900,\n 79930,\n 79960,\n 79990\n ];\n }\n });\n\n // src/components/calendars/calendars.js\n var require_calendars = __commonJS({\n \"src/components/calendars/calendars.js\"(exports, module) {\n \"use strict\";\n module.exports = require_main();\n require_plus();\n require_chinese();\n require_coptic();\n require_discworld();\n require_ethiopian();\n require_hebrew();\n require_islamic();\n require_julian();\n require_mayan();\n require_nanakshahi();\n require_nepali();\n require_persian();\n require_taiwan();\n require_thai();\n require_ummalqura();\n }\n });\n\n // src/components/calendars/index.js\n var require_calendars2 = __commonJS({\n \"src/components/calendars/index.js\"(exports, module) {\n \"use strict\";\n var calendars = require_calendars();\n var Lib = require_lib();\n var constants = require_numerical();\n var EPOCHJD = constants.EPOCHJD;\n var ONEDAY = constants.ONEDAY;\n var attributes = {\n valType: \"enumerated\",\n values: Lib.sortObjectKeys(calendars.calendars),\n editType: \"calc\",\n dflt: \"gregorian\"\n };\n var handleDefaults = function(contIn, contOut, attr, dflt) {\n var attrs = {};\n attrs[attr] = attributes;\n return Lib.coerce(contIn, contOut, attrs, attr, dflt);\n };\n var handleTraceDefaults = function(traceIn, traceOut, coords, layout) {\n for (var i = 0; i < coords.length; i++) {\n handleDefaults(traceIn, traceOut, coords[i] + \"calendar\", layout.calendar);\n }\n };\n var CANONICAL_TICK = {\n chinese: \"2000-01-01\",\n coptic: \"2000-01-01\",\n discworld: \"2000-01-01\",\n ethiopian: \"2000-01-01\",\n hebrew: \"5000-01-01\",\n islamic: \"1000-01-01\",\n julian: \"2000-01-01\",\n mayan: \"5000-01-01\",\n nanakshahi: \"1000-01-01\",\n nepali: \"2000-01-01\",\n persian: \"1000-01-01\",\n jalali: \"1000-01-01\",\n taiwan: \"1000-01-01\",\n thai: \"2000-01-01\",\n ummalqura: \"1400-01-01\"\n };\n var CANONICAL_SUNDAY = {\n chinese: \"2000-01-02\",\n coptic: \"2000-01-03\",\n discworld: \"2000-01-03\",\n ethiopian: \"2000-01-05\",\n hebrew: \"5000-01-01\",\n islamic: \"1000-01-02\",\n julian: \"2000-01-03\",\n mayan: \"5000-01-01\",\n nanakshahi: \"1000-01-05\",\n nepali: \"2000-01-05\",\n persian: \"1000-01-01\",\n jalali: \"1000-01-01\",\n taiwan: \"1000-01-04\",\n thai: \"2000-01-04\",\n ummalqura: \"1400-01-06\"\n };\n var DFLTRANGE = {\n chinese: [\"2000-01-01\", \"2001-01-01\"],\n coptic: [\"1700-01-01\", \"1701-01-01\"],\n discworld: [\"1800-01-01\", \"1801-01-01\"],\n ethiopian: [\"2000-01-01\", \"2001-01-01\"],\n hebrew: [\"5700-01-01\", \"5701-01-01\"],\n islamic: [\"1400-01-01\", \"1401-01-01\"],\n julian: [\"2000-01-01\", \"2001-01-01\"],\n mayan: [\"5200-01-01\", \"5201-01-01\"],\n nanakshahi: [\"0500-01-01\", \"0501-01-01\"],\n nepali: [\"2000-01-01\", \"2001-01-01\"],\n persian: [\"1400-01-01\", \"1401-01-01\"],\n jalali: [\"1400-01-01\", \"1401-01-01\"],\n taiwan: [\"0100-01-01\", \"0101-01-01\"],\n thai: [\"2500-01-01\", \"2501-01-01\"],\n ummalqura: [\"1400-01-01\", \"1401-01-01\"]\n };\n var UNKNOWN = \"##\";\n var d3ToWorldCalendars = {\n d: { 0: \"dd\", \"-\": \"d\" },\n // 2-digit or unpadded day of month\n e: { 0: \"d\", \"-\": \"d\" },\n // alternate, always unpadded day of month\n a: { 0: \"D\", \"-\": \"D\" },\n // short weekday name\n A: { 0: \"DD\", \"-\": \"DD\" },\n // full weekday name\n j: { 0: \"oo\", \"-\": \"o\" },\n // 3-digit or unpadded day of the year\n W: { 0: \"ww\", \"-\": \"w\" },\n // 2-digit or unpadded week of the year (Monday first)\n m: { 0: \"mm\", \"-\": \"m\" },\n // 2-digit or unpadded month number\n b: { 0: \"M\", \"-\": \"M\" },\n // short month name\n B: { 0: \"MM\", \"-\": \"MM\" },\n // full month name\n y: { 0: \"yy\", \"-\": \"yy\" },\n // 2-digit year (map unpadded to zero-padded)\n Y: { 0: \"yyyy\", \"-\": \"yyyy\" },\n // 4-digit year (map unpadded to zero-padded)\n U: UNKNOWN,\n // Sunday-first week of the year\n w: UNKNOWN,\n // day of the week [0(sunday),6]\n // combined format, we replace the date part with the world-calendar version\n // and the %X stays there for d3 to handle with time parts\n c: { 0: \"D M d %X yyyy\", \"-\": \"D M d %X yyyy\" },\n x: { 0: \"mm/dd/yyyy\", \"-\": \"mm/dd/yyyy\" }\n };\n function worldCalFmt(fmt, x, calendar) {\n var dateJD = Math.floor((x + 0.05) / ONEDAY) + EPOCHJD;\n var cDate = getCal(calendar).fromJD(dateJD);\n var i = 0;\n var modifier, directive, directiveLen, directiveObj, replacementPart;\n while ((i = fmt.indexOf(\"%\", i)) !== -1) {\n modifier = fmt.charAt(i + 1);\n if (modifier === \"0\" || modifier === \"-\" || modifier === \"_\") {\n directiveLen = 3;\n directive = fmt.charAt(i + 2);\n if (modifier === \"_\") modifier = \"-\";\n } else {\n directive = modifier;\n modifier = \"0\";\n directiveLen = 2;\n }\n directiveObj = d3ToWorldCalendars[directive];\n if (!directiveObj) {\n i += directiveLen;\n } else {\n if (directiveObj === UNKNOWN) replacementPart = UNKNOWN;\n else replacementPart = cDate.formatDate(directiveObj[modifier]);\n fmt = fmt.substr(0, i) + replacementPart + fmt.substr(i + directiveLen);\n i += replacementPart.length;\n }\n }\n return fmt;\n }\n var allCals = {};\n function getCal(calendar) {\n var calendarObj = allCals[calendar];\n if (calendarObj) return calendarObj;\n calendarObj = allCals[calendar] = calendars.instance(calendar);\n return calendarObj;\n }\n function makeAttrs(description) {\n return Lib.extendFlat({}, attributes, { description });\n }\n function makeTraceAttrsDescription(coord) {\n return \"Sets the calendar system to use with `\" + coord + \"` date data.\";\n }\n var xAttrs = {\n xcalendar: makeAttrs(makeTraceAttrsDescription(\"x\"))\n };\n var xyAttrs = Lib.extendFlat({}, xAttrs, {\n ycalendar: makeAttrs(makeTraceAttrsDescription(\"y\"))\n });\n var xyzAttrs = Lib.extendFlat({}, xyAttrs, {\n zcalendar: makeAttrs(makeTraceAttrsDescription(\"z\"))\n });\n var axisAttrs = makeAttrs([\n \"Sets the calendar system to use for `range` and `tick0`\",\n \"if this is a date axis. This does not set the calendar for\",\n \"interpreting data on this axis, that's specified in the trace\",\n \"or via the global `layout.calendar`\"\n ].join(\" \"));\n module.exports = {\n moduleType: \"component\",\n name: \"calendars\",\n schema: {\n traces: {\n scatter: xyAttrs,\n bar: xyAttrs,\n box: xyAttrs,\n heatmap: xyAttrs,\n contour: xyAttrs,\n histogram: xyAttrs,\n histogram2d: xyAttrs,\n histogram2dcontour: xyAttrs,\n scatter3d: xyzAttrs,\n surface: xyzAttrs,\n mesh3d: xyzAttrs,\n scattergl: xyAttrs,\n ohlc: xAttrs,\n candlestick: xAttrs\n },\n layout: {\n calendar: makeAttrs([\n \"Sets the default calendar system to use for interpreting and\",\n \"displaying dates throughout the plot.\"\n ].join(\" \"))\n },\n subplots: {\n xaxis: { calendar: axisAttrs },\n yaxis: { calendar: axisAttrs },\n scene: {\n xaxis: { calendar: axisAttrs },\n // TODO: it's actually redundant to include yaxis and zaxis here\n // because in the scene attributes these are the same object so merging\n // into one merges into them all. However, I left them in for parity with\n // cartesian, where yaxis is unused until we Plotschema.get() when we\n // use its presence or absence to determine whether to delete attributes\n // from yaxis if they only apply to x (rangeselector/rangeslider)\n yaxis: { calendar: axisAttrs },\n zaxis: { calendar: axisAttrs }\n },\n polar: {\n radialaxis: { calendar: axisAttrs }\n }\n }\n },\n layoutAttributes: attributes,\n handleDefaults,\n handleTraceDefaults,\n CANONICAL_SUNDAY,\n CANONICAL_TICK,\n DFLTRANGE,\n getCal,\n worldCalFmt\n };\n }\n });\n\n // lib/calendars.js\n var require_calendars3 = __commonJS({\n \"lib/calendars.js\"(exports, module) {\n \"use strict\";\n module.exports = require_calendars2();\n }\n });\n\n // lib/index.js\n var require_lib2 = __commonJS({\n \"lib/index.js\"(exports, module) {\n var Plotly = require_core2();\n Plotly.register([\n // traces\n require_bar2(),\n require_box2(),\n require_heatmap2(),\n require_histogram2(),\n require_histogram2d2(),\n require_histogram2dcontour2(),\n require_contour2(),\n require_scatterternary2(),\n require_violin2(),\n require_funnel2(),\n require_waterfall2(),\n require_image2(),\n require_pie2(),\n require_sunburst2(),\n require_treemap2(),\n require_icicle2(),\n require_funnelarea2(),\n require_scatter3d2(),\n require_surface2(),\n require_isosurface2(),\n require_volume2(),\n require_mesh3d2(),\n require_cone2(),\n require_streamtube2(),\n require_scattergeo2(),\n require_choropleth2(),\n require_scattergl2(),\n require_splom2(),\n require_parcoords3(),\n require_parcats3(),\n require_scattermapbox2(),\n require_choroplethmapbox2(),\n require_densitymapbox2(),\n require_scattermap2(),\n require_choroplethmap2(),\n require_densitymap2(),\n require_sankey2(),\n require_indicator2(),\n require_table2(),\n require_carpet2(),\n require_scattercarpet2(),\n require_contourcarpet2(),\n require_ohlc2(),\n require_candlestick2(),\n require_scatterpolar2(),\n require_scatterpolargl2(),\n require_barpolar2(),\n require_scattersmith2(),\n // components\n require_calendars3()\n ]);\n module.exports = Plotly;\n }\n });\n return require_lib2();\n})();\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\n/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/*!\n * pad-left \n *\n * Copyright (c) 2014-2015, Jon Schlinkert.\n * Licensed under the MIT license.\n */\n/*!\n * repeat-string \n *\n * Copyright (c) 2014-2015, Jon Schlinkert.\n * Licensed under the MIT License.\n */\n/*! Bundled license information:\n\nnative-promise-only/lib/npo.src.js:\n (*! Native Promise Only\n v0.8.1 (c) Kyle Simpson\n MIT License: http://getify.mit-license.org\n *)\n\npolybooljs/index.js:\n (*\n * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc\n * @license MIT\n * @preserve Project Home: https://github.com/voidqk/polybooljs\n *)\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *)\n\nbuffer/index.js:\n (*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n *)\n\nsafe-buffer/index.js:\n (*! safe-buffer. MIT License. Feross Aboukhadijeh *)\n\nassert/build/internal/util/comparisons.js:\n (*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n *)\n\nobject-assign/index.js:\n (*\n object-assign\n (c) Sindre Sorhus\n @license MIT\n *)\n\nmaplibre-gl/dist/maplibre-gl.js:\n (**\n * MapLibre GL JS\n * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt\n *)\n*/\n\nwindow.Plotly = Plotly;\nreturn Plotly;\n}));", "/*!\n * Chartkick.js v5.0.1\n * Create beautiful charts with one line of JavaScript\n * https://github.com/ankane/chartkick.js\n * MIT License\n */\n\nfunction isArray(variable) {\n return Object.prototype.toString.call(variable) === \"[object Array]\";\n}\n\nfunction isFunction(variable) {\n return variable instanceof Function;\n}\n\nfunction isPlainObject(variable) {\n // protect against prototype pollution, defense 2\n return Object.prototype.toString.call(variable) === \"[object Object]\" && !isFunction(variable) && variable instanceof Object;\n}\n\n// https://github.com/madrobby/zepto/blob/master/src/zepto.js\nfunction extend(target, source) {\n for (var key in source) {\n // protect against prototype pollution, defense 1\n if (key === \"__proto__\") { continue; }\n\n if (isPlainObject(source[key]) || isArray(source[key])) {\n if (isPlainObject(source[key]) && !isPlainObject(target[key])) {\n target[key] = {};\n }\n if (isArray(source[key]) && !isArray(target[key])) {\n target[key] = [];\n }\n extend(target[key], source[key]);\n } else if (source[key] !== undefined) {\n target[key] = source[key];\n }\n }\n}\n\nfunction merge(obj1, obj2) {\n var target = {};\n extend(target, obj1);\n extend(target, obj2);\n return target;\n}\n\nvar DATE_PATTERN = /^(\\d\\d\\d\\d)(?:-)?(\\d\\d)(?:-)?(\\d\\d)$/i;\n\nfunction negativeValues(series) {\n for (var i = 0; i < series.length; i++) {\n var data = series[i].data;\n for (var j = 0; j < data.length; j++) {\n if (data[j][1] < 0) {\n return true;\n }\n }\n }\n return false;\n}\n\nfunction toStr(obj) {\n return \"\" + obj;\n}\n\nfunction toFloat(obj) {\n return parseFloat(obj);\n}\n\nfunction toDate(obj) {\n if (obj instanceof Date) {\n return obj;\n } else if (typeof obj === \"number\") {\n return new Date(obj * 1000); // ms\n } else {\n var s = toStr(obj);\n var matches = s.match(DATE_PATTERN);\n if (matches) {\n var year = parseInt(matches[1], 10);\n var month = parseInt(matches[2], 10) - 1;\n var day = parseInt(matches[3], 10);\n return new Date(year, month, day);\n } else {\n // try our best to get the str into iso8601\n // TODO be smarter about this\n var str = s.replace(/ /, \"T\").replace(\" \", \"\").replace(\"UTC\", \"Z\");\n // Date.parse returns milliseconds if valid and NaN if invalid\n return new Date(Date.parse(str) || s);\n }\n }\n}\n\nfunction toArr(obj) {\n if (isArray(obj)) {\n return obj;\n } else {\n var arr = [];\n for (var i in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, i)) {\n arr.push([i, obj[i]]);\n }\n }\n return arr;\n }\n}\n\nfunction jsOptionsFunc(defaultOptions, hideLegend, setTitle, setMin, setMax, setStacked, setXtitle, setYtitle) {\n return function (chart, opts, chartOptions) {\n var series = chart.data;\n var options = merge({}, defaultOptions);\n options = merge(options, chartOptions || {});\n\n if (chart.singleSeriesFormat || \"legend\" in opts) {\n hideLegend(options, opts.legend, chart.singleSeriesFormat);\n }\n\n if (opts.title) {\n setTitle(options, opts.title);\n }\n\n // min\n if (\"min\" in opts) {\n setMin(options, opts.min);\n } else if (!negativeValues(series)) {\n setMin(options, 0);\n }\n\n // max\n if (opts.max) {\n setMax(options, opts.max);\n }\n\n if (\"stacked\" in opts) {\n setStacked(options, opts.stacked);\n }\n\n if (opts.colors) {\n options.colors = opts.colors;\n }\n\n if (opts.xtitle) {\n setXtitle(options, opts.xtitle);\n }\n\n if (opts.ytitle) {\n setYtitle(options, opts.ytitle);\n }\n\n // merge library last\n options = merge(options, opts.library || {});\n\n return options;\n };\n}\n\nfunction sortByTime(a, b) {\n return a[0].getTime() - b[0].getTime();\n}\n\nfunction sortByNumberSeries(a, b) {\n return a[0] - b[0];\n}\n\n// needed since sort() without arguments does string comparison\nfunction sortByNumber(a, b) {\n return a - b;\n}\n\nfunction every(values, fn) {\n for (var i = 0; i < values.length; i++) {\n if (!fn(values[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction isDay(timeUnit) {\n return timeUnit === \"day\" || timeUnit === \"week\" || timeUnit === \"month\" || timeUnit === \"year\";\n}\n\nfunction calculateTimeUnit(values, maxDay) {\n if ( maxDay === void 0 ) maxDay = false;\n\n if (values.length === 0) {\n return null;\n }\n\n var minute = every(values, function (d) { return d.getMilliseconds() === 0 && d.getSeconds() === 0; });\n if (!minute) {\n return null;\n }\n\n var hour = every(values, function (d) { return d.getMinutes() === 0; });\n if (!hour) {\n return \"minute\";\n }\n\n var day = every(values, function (d) { return d.getHours() === 0; });\n if (!day) {\n return \"hour\";\n }\n\n if (maxDay) {\n return \"day\";\n }\n\n var month = every(values, function (d) { return d.getDate() === 1; });\n if (!month) {\n var dayOfWeek = values[0].getDay();\n var week = every(values, function (d) { return d.getDay() === dayOfWeek; });\n return (week ? \"week\" : \"day\");\n }\n\n var year = every(values, function (d) { return d.getMonth() === 0; });\n if (!year) {\n return \"month\";\n }\n\n return \"year\";\n}\n\nfunction isDate(obj) {\n return !isNaN(toDate(obj)) && toStr(obj).length >= 6;\n}\n\nfunction isNumber(obj) {\n return typeof obj === \"number\";\n}\n\nvar byteSuffixes = [\"bytes\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\"];\n\nfunction formatValue(pre, value, options, axis) {\n pre = pre || \"\";\n if (options.prefix) {\n if (value < 0) {\n value = value * -1;\n pre += \"-\";\n }\n pre += options.prefix;\n }\n\n var suffix = options.suffix || \"\";\n var precision = options.precision;\n var round = options.round;\n\n if (options.byteScale) {\n var positive = value >= 0;\n if (!positive) {\n value *= -1;\n }\n\n var baseValue = axis ? options.byteScale : value;\n\n var suffixIdx;\n if (baseValue >= 1152921504606846976) {\n value /= 1152921504606846976;\n suffixIdx = 6;\n } else if (baseValue >= 1125899906842624) {\n value /= 1125899906842624;\n suffixIdx = 5;\n } else if (baseValue >= 1099511627776) {\n value /= 1099511627776;\n suffixIdx = 4;\n } else if (baseValue >= 1073741824) {\n value /= 1073741824;\n suffixIdx = 3;\n } else if (baseValue >= 1048576) {\n value /= 1048576;\n suffixIdx = 2;\n } else if (baseValue >= 1024) {\n value /= 1024;\n suffixIdx = 1;\n } else {\n suffixIdx = 0;\n }\n\n // TODO handle manual precision case\n if (precision === undefined && round === undefined) {\n if (value >= 1023.5) {\n if (suffixIdx < byteSuffixes.length - 1) {\n value = 1.0;\n suffixIdx += 1;\n }\n }\n precision = value >= 1000 ? 4 : 3;\n }\n suffix = \" \" + byteSuffixes[suffixIdx];\n\n // flip value back\n if (!positive) {\n value *= -1;\n }\n }\n\n if (precision !== undefined && round !== undefined) {\n throw Error(\"Use either round or precision, not both\");\n }\n\n if (!axis) {\n if (precision !== undefined) {\n value = value.toPrecision(precision);\n if (!options.zeros) {\n value = parseFloat(value);\n }\n }\n\n if (round !== undefined) {\n if (round < 0) {\n var num = Math.pow(10, -1 * round);\n value = parseInt((1.0 * value / num).toFixed(0)) * num;\n } else {\n value = value.toFixed(round);\n if (!options.zeros) {\n value = parseFloat(value);\n }\n }\n }\n }\n\n if (options.thousands || options.decimal) {\n value = toStr(value);\n var parts = value.split(\".\");\n value = parts[0];\n if (options.thousands) {\n value = value.replace(/\\B(?=(\\d{3})+(?!\\d))/g, options.thousands);\n }\n if (parts.length > 1) {\n value += (options.decimal || \".\") + parts[1];\n }\n }\n\n return pre + value + suffix;\n}\n\nfunction seriesOption(chart, series, option) {\n if (option in series) {\n return series[option];\n } else if (option in chart.options) {\n return chart.options[option];\n }\n return null;\n}\n\nvar baseOptions = {\n maintainAspectRatio: false,\n animation: false,\n plugins: {\n legend: {},\n tooltip: {\n displayColors: false,\n callbacks: {}\n },\n title: {\n font: {\n size: 20\n },\n color: \"#333\"\n }\n },\n interaction: {}\n};\n\nvar defaultOptions$2 = {\n scales: {\n y: {\n ticks: {\n maxTicksLimit: 4\n },\n title: {\n font: {\n size: 16\n },\n color: \"#333\"\n },\n grid: {}\n },\n x: {\n grid: {\n drawOnChartArea: false\n },\n title: {\n font: {\n size: 16\n },\n color: \"#333\"\n },\n time: {},\n ticks: {}\n }\n }\n};\n\n// http://there4.io/2012/05/02/google-chart-color-list/\nvar defaultColors = [\n \"#3366CC\", \"#DC3912\", \"#FF9900\", \"#109618\", \"#990099\", \"#3B3EAC\", \"#0099C6\",\n \"#DD4477\", \"#66AA00\", \"#B82E2E\", \"#316395\", \"#994499\", \"#22AA99\", \"#AAAA11\",\n \"#6633CC\", \"#E67300\", \"#8B0707\", \"#329262\", \"#5574A6\", \"#651067\"\n];\n\nfunction hideLegend$2(options, legend, hideLegend) {\n if (legend !== undefined) {\n options.plugins.legend.display = !!legend;\n if (legend && legend !== true) {\n options.plugins.legend.position = legend;\n }\n } else if (hideLegend) {\n options.plugins.legend.display = false;\n }\n}\n\nfunction setTitle$2(options, title) {\n options.plugins.title.display = true;\n options.plugins.title.text = title;\n}\n\nfunction setMin$2(options, min) {\n if (min !== null) {\n options.scales.y.min = toFloat(min);\n }\n}\n\nfunction setMax$2(options, max) {\n options.scales.y.max = toFloat(max);\n}\n\nfunction setBarMin$1(options, min) {\n if (min !== null) {\n options.scales.x.min = toFloat(min);\n }\n}\n\nfunction setBarMax$1(options, max) {\n options.scales.x.max = toFloat(max);\n}\n\nfunction setStacked$2(options, stacked) {\n options.scales.x.stacked = !!stacked;\n options.scales.y.stacked = !!stacked;\n}\n\nfunction setXtitle$2(options, title) {\n options.scales.x.title.display = true;\n options.scales.x.title.text = title;\n}\n\nfunction setYtitle$2(options, title) {\n options.scales.y.title.display = true;\n options.scales.y.title.text = title;\n}\n\n// https://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb\nfunction addOpacity(hex, opacity) {\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n return result ? \"rgba(\" + parseInt(result[1], 16) + \", \" + parseInt(result[2], 16) + \", \" + parseInt(result[3], 16) + \", \" + opacity + \")\" : hex;\n}\n\nfunction notnull(x) {\n return x !== null && x !== undefined;\n}\n\nfunction setLabelSize(chart, data, options) {\n var maxLabelSize = Math.ceil(chart.element.offsetWidth / 4.0 / data.labels.length);\n if (maxLabelSize > 25) {\n maxLabelSize = 25;\n } else if (maxLabelSize < 10) {\n maxLabelSize = 10;\n }\n if (!options.scales.x.ticks.callback) {\n options.scales.x.ticks.callback = function (value) {\n value = toStr(this.getLabelForValue(value));\n if (value.length > maxLabelSize) {\n return value.substring(0, maxLabelSize - 2) + \"...\";\n } else {\n return value;\n }\n };\n }\n}\n\nfunction calculateScale(series) {\n var scale = 1;\n var max = maxAbsY(series);\n while (max >= 1024) {\n scale *= 1024;\n max /= 1024;\n }\n return scale;\n}\n\nfunction setFormatOptions$1(chart, options, chartType) {\n // options to apply to x and r values for scatter and bubble\n var numericOptions = {\n thousands: chart.options.thousands,\n decimal: chart.options.decimal\n };\n\n // options to apply to y value\n var formatOptions = merge({\n prefix: chart.options.prefix,\n suffix: chart.options.suffix,\n precision: chart.options.precision,\n round: chart.options.round,\n zeros: chart.options.zeros\n }, numericOptions);\n\n if (chart.options.bytes) {\n var series = chart.data;\n if (chartType === \"pie\") {\n series = [{data: series}];\n }\n\n // set step size\n formatOptions.byteScale = calculateScale(series);\n }\n\n if (chartType !== \"pie\") {\n var axis = options.scales.y;\n if (chartType === \"bar\") {\n axis = options.scales.x;\n }\n\n if (formatOptions.byteScale) {\n if (!axis.ticks.stepSize) {\n axis.ticks.stepSize = formatOptions.byteScale / 2;\n }\n if (!axis.ticks.maxTicksLimit) {\n axis.ticks.maxTicksLimit = 4;\n }\n }\n\n if (!axis.ticks.callback) {\n axis.ticks.callback = function (value) {\n return formatValue(\"\", value, formatOptions, true);\n };\n }\n\n if ((chartType === \"scatter\" || chartType === \"bubble\") && !options.scales.x.ticks.callback) {\n options.scales.x.ticks.callback = function (value) {\n return formatValue(\"\", value, numericOptions, true);\n };\n }\n }\n\n if (!options.plugins.tooltip.callbacks.label) {\n if (chartType === \"scatter\") {\n options.plugins.tooltip.callbacks.label = function (context) {\n var label = context.dataset.label || '';\n if (label) {\n label += ': ';\n }\n\n var dataPoint = context.parsed;\n return label + '(' + formatValue('', dataPoint.x, numericOptions) + ', ' + formatValue('', dataPoint.y, formatOptions) + ')';\n };\n } else if (chartType === \"bubble\") {\n options.plugins.tooltip.callbacks.label = function (context) {\n var label = context.dataset.label || '';\n if (label) {\n label += ': ';\n }\n var dataPoint = context.raw;\n return label + '(' + formatValue('', dataPoint.x, numericOptions) + ', ' + formatValue('', dataPoint.y, formatOptions) + ', ' + formatValue('', dataPoint.v, numericOptions) + ')';\n };\n } else if (chartType === \"pie\") {\n // need to use separate label for pie charts\n options.plugins.tooltip.callbacks.label = function (context) {\n return formatValue('', context.parsed, formatOptions);\n };\n } else {\n var valueLabel = chartType === \"bar\" ? \"x\" : \"y\";\n options.plugins.tooltip.callbacks.label = function (context) {\n // don't show null values for stacked charts\n if (context.parsed[valueLabel] === null) {\n return;\n }\n\n var label = context.dataset.label || '';\n if (label) {\n label += ': ';\n }\n return formatValue(label, context.parsed[valueLabel], formatOptions);\n };\n }\n }\n\n // avoid formatting x-axis labels\n // by default, Chart.js applies locale\n if ((chartType === \"line\" || chartType === \"area\") && chart.xtype === \"number\") {\n if (!options.scales.x.ticks.callback) {\n options.scales.x.ticks.callback = function (value) {\n return toStr(value);\n };\n }\n\n if (!options.plugins.tooltip.callbacks.title) {\n options.plugins.tooltip.callbacks.title = function (context) {\n return toStr(context[0].parsed.x);\n };\n }\n }\n}\n\nfunction maxAbsY(series) {\n var max = 0;\n for (var i = 0; i < series.length; i++) {\n var data = series[i].data;\n for (var j = 0; j < data.length; j++) {\n var v = Math.abs(data[j][1]);\n if (v > max) {\n max = v;\n }\n }\n }\n return max;\n}\n\nfunction maxR(series) {\n // start at zero since radius must be positive\n var max = 0;\n for (var i = 0; i < series.length; i++) {\n var data = series[i].data;\n for (var j = 0; j < data.length; j++) {\n var v = data[j][2];\n if (v > max) {\n max = v;\n }\n }\n }\n return max;\n}\n\nvar jsOptions$2 = jsOptionsFunc(merge(baseOptions, defaultOptions$2), hideLegend$2, setTitle$2, setMin$2, setMax$2, setStacked$2, setXtitle$2, setYtitle$2);\n\nfunction prepareDefaultData(chart) {\n var series = chart.data;\n var rows = {};\n var keys = [];\n var labels = [];\n var values = [];\n\n for (var i = 0; i < series.length; i++) {\n var data = series[i].data;\n\n for (var j = 0; j < data.length; j++) {\n var d = data[j];\n var key = chart.xtype === \"datetime\" ? d[0].getTime() : d[0];\n if (!rows[key]) {\n rows[key] = new Array(series.length);\n keys.push(key);\n }\n rows[key][i] = d[1];\n }\n }\n\n if (chart.xtype === \"datetime\" || chart.xtype === \"number\") {\n keys.sort(sortByNumber);\n }\n\n for (var i$1 = 0; i$1 < series.length; i$1++) {\n values.push([]);\n }\n\n for (var i$2 = 0; i$2 < keys.length; i$2++) {\n var key$1 = keys[i$2];\n\n var label = chart.xtype === \"datetime\" ? new Date(key$1) : key$1;\n labels.push(label);\n\n var row = rows[key$1];\n for (var j$1 = 0; j$1 < series.length; j$1++) {\n var v = row[j$1];\n // Chart.js doesn't like undefined\n values[j$1].push(v === undefined ? null : v);\n }\n }\n\n return {\n labels: labels,\n values: values\n };\n}\n\nfunction prepareBubbleData(chart) {\n var series = chart.data;\n var values = [];\n var max = maxR(series);\n\n for (var i = 0; i < series.length; i++) {\n var data = series[i].data;\n var points = [];\n for (var j = 0; j < data.length; j++) {\n var v = data[j];\n points.push({\n x: v[0],\n y: v[1],\n r: v[2] * 20 / max,\n // custom attribute, for tooltip\n v: v[2]\n });\n }\n values.push(points);\n }\n\n return {\n labels: [],\n values: values\n };\n}\n\n// scatter or numeric line/area\nfunction prepareNumberData(chart) {\n var series = chart.data;\n var values = [];\n\n for (var i = 0; i < series.length; i++) {\n var data = series[i].data;\n\n data.sort(sortByNumberSeries);\n\n var points = [];\n for (var j = 0; j < data.length; j++) {\n var v = data[j];\n points.push({\n x: v[0],\n y: v[1]\n });\n }\n values.push(points);\n }\n\n return {\n labels: [],\n values: values\n };\n}\n\nfunction prepareData(chart, chartType) {\n if (chartType === \"bubble\") {\n return prepareBubbleData(chart);\n } else if (chart.xtype === \"number\" && chartType !== \"bar\" && chartType !== \"column\") {\n return prepareNumberData(chart);\n } else {\n return prepareDefaultData(chart);\n }\n}\n\nfunction createDataTable(chart, options, chartType) {\n var ref = prepareData(chart, chartType);\n var labels = ref.labels;\n var values = ref.values;\n\n var series = chart.data;\n var datasets = [];\n var colors = chart.options.colors || defaultColors;\n for (var i = 0; i < series.length; i++) {\n var s = series[i];\n\n // use colors for each bar for single series format\n var color = (void 0);\n var backgroundColor = (void 0);\n if (chart.options.colors && chart.singleSeriesFormat && (chartType === \"bar\" || chartType === \"column\") && !s.color && isArray(chart.options.colors) && !isArray(chart.options.colors[0])) {\n color = colors;\n backgroundColor = [];\n for (var j = 0; j < colors.length; j++) {\n backgroundColor[j] = addOpacity(color[j], 0.5);\n }\n } else {\n color = s.color || colors[i];\n backgroundColor = chartType !== \"line\" ? addOpacity(color, 0.5) : color;\n }\n\n var dataset = {\n label: s.name || \"\",\n data: values[i],\n fill: chartType === \"area\",\n borderColor: color,\n backgroundColor: backgroundColor,\n borderWidth: 2\n };\n\n var pointChart = chartType === \"line\" || chartType === \"area\" || chartType === \"scatter\" || chartType === \"bubble\";\n if (pointChart) {\n dataset.pointBackgroundColor = color;\n dataset.pointHoverBackgroundColor = color;\n dataset.pointHitRadius = 50;\n }\n\n if (chartType === \"bubble\") {\n dataset.pointBackgroundColor = backgroundColor;\n dataset.pointHoverBackgroundColor = backgroundColor;\n dataset.pointHoverBorderWidth = 2;\n }\n\n if (s.stack) {\n dataset.stack = s.stack;\n }\n\n var curve = seriesOption(chart, s, \"curve\");\n if (curve === false) {\n dataset.tension = 0;\n } else if (pointChart) {\n dataset.tension = 0.4;\n }\n\n var points = seriesOption(chart, s, \"points\");\n if (points === false) {\n dataset.pointRadius = 0;\n dataset.pointHoverRadius = 0;\n }\n\n dataset = merge(dataset, chart.options.dataset || {});\n dataset = merge(dataset, s.library || {});\n dataset = merge(dataset, s.dataset || {});\n\n datasets.push(dataset);\n }\n\n var xmin = chart.options.xmin;\n var xmax = chart.options.xmax;\n\n if (chart.xtype === \"datetime\") {\n if (notnull(xmin)) {\n options.scales.x.min = toDate(xmin).getTime();\n }\n if (notnull(xmax)) {\n options.scales.x.max = toDate(xmax).getTime();\n }\n } else if (chart.xtype === \"number\") {\n if (notnull(xmin)) {\n options.scales.x.min = xmin;\n }\n if (notnull(xmax)) {\n options.scales.x.max = xmax;\n }\n }\n\n if (chart.xtype === \"datetime\") {\n var timeUnit = calculateTimeUnit(labels);\n\n // for empty datetime chart\n if (labels.length === 0) {\n if (notnull(xmin)) {\n labels.push(toDate(xmin));\n }\n if (notnull(xmax)) {\n labels.push(toDate(xmax));\n }\n }\n\n if (labels.length > 0) {\n var minTime = (notnull(xmin) ? toDate(xmin) : labels[0]).getTime();\n var maxTime = (notnull(xmax) ? toDate(xmax) : labels[0]).getTime();\n\n for (var i$1 = 1; i$1 < labels.length; i$1++) {\n var value = labels[i$1].getTime();\n if (value < minTime) {\n minTime = value;\n }\n if (value > maxTime) {\n maxTime = value;\n }\n }\n\n var timeDiff = (maxTime - minTime) / (86400 * 1000.0);\n\n if (!options.scales.x.time.unit) {\n var step;\n if (timeUnit === \"year\" || timeDiff > 365 * 10) {\n options.scales.x.time.unit = \"year\";\n step = 365;\n } else if (timeUnit === \"month\" || timeDiff > 30 * 10) {\n options.scales.x.time.unit = \"month\";\n step = 30;\n } else if (timeUnit === \"week\" || timeUnit === \"day\" || timeDiff > 10) {\n options.scales.x.time.unit = \"day\";\n step = 1;\n } else if (timeUnit === \"hour\" || timeDiff > 0.5) {\n options.scales.x.time.displayFormats = {hour: \"MMM d, h a\"};\n options.scales.x.time.unit = \"hour\";\n step = 1 / 24.0;\n } else if (timeUnit === \"minute\") {\n options.scales.x.time.displayFormats = {minute: \"h:mm a\"};\n options.scales.x.time.unit = \"minute\";\n step = 1 / 24.0 / 60.0;\n }\n\n if (step && timeDiff > 0) {\n // width not available for hidden elements\n var width = chart.element.offsetWidth;\n if (width > 0) {\n var unitStepSize = Math.ceil(timeDiff / step / (width / 100.0));\n if (timeUnit === \"week\" && step === 1) {\n unitStepSize = Math.ceil(unitStepSize / 7.0) * 7;\n }\n options.scales.x.ticks.stepSize = unitStepSize;\n }\n }\n }\n\n if (!options.scales.x.time.tooltipFormat) {\n if (timeUnit === \"year\") {\n options.scales.x.time.tooltipFormat = \"yyyy\";\n } else if (timeUnit === \"month\") {\n options.scales.x.time.tooltipFormat = \"MMM yyyy\";\n } else if (timeUnit === \"week\" || timeUnit === \"day\") {\n options.scales.x.time.tooltipFormat = \"PP\";\n } else if (timeUnit === \"hour\") {\n options.scales.x.time.tooltipFormat = \"MMM d, h a\";\n } else if (timeUnit === \"minute\") {\n options.scales.x.time.tooltipFormat = \"h:mm a\";\n }\n }\n }\n }\n\n return {\n labels: labels,\n datasets: datasets\n };\n}\n\nvar defaultExport$2 = function defaultExport(library) {\n this.name = \"chartjs\";\n this.library = library;\n};\n\ndefaultExport$2.prototype.renderLineChart = function renderLineChart (chart, chartType) {\n if (!chartType) {\n chartType = \"line\";\n }\n\n var chartOptions = {};\n\n var options = jsOptions$2(chart, merge(chartOptions, chart.options));\n setFormatOptions$1(chart, options, chartType);\n\n var data = createDataTable(chart, options, chartType);\n\n if (chart.xtype === \"number\") {\n options.scales.x.type = options.scales.x.type || \"linear\";\n options.scales.x.position = options.scales.x.position || \"bottom\";\n } else {\n options.scales.x.type = chart.xtype === \"string\" ? \"category\" : \"time\";\n }\n\n this.drawChart(chart, \"line\", data, options);\n};\n\ndefaultExport$2.prototype.renderPieChart = function renderPieChart (chart) {\n var options = merge({}, baseOptions);\n if (chart.options.donut) {\n options.cutout = \"50%\";\n }\n\n if (\"legend\" in chart.options) {\n hideLegend$2(options, chart.options.legend);\n }\n\n if (chart.options.title) {\n setTitle$2(options, chart.options.title);\n }\n\n options = merge(options, chart.options.library || {});\n setFormatOptions$1(chart, options, \"pie\");\n\n var labels = [];\n var values = [];\n for (var i = 0; i < chart.data.length; i++) {\n var point = chart.data[i];\n labels.push(point[0]);\n values.push(point[1]);\n }\n\n var dataset = {\n data: values,\n backgroundColor: chart.options.colors || defaultColors\n };\n dataset = merge(dataset, chart.options.dataset || {});\n\n var data = {\n labels: labels,\n datasets: [dataset]\n };\n\n this.drawChart(chart, \"pie\", data, options);\n};\n\ndefaultExport$2.prototype.renderColumnChart = function renderColumnChart (chart, chartType) {\n var options;\n if (chartType === \"bar\") {\n var barOptions = merge(baseOptions, defaultOptions$2);\n barOptions.indexAxis = \"y\";\n\n // ensure gridlines have proper orientation\n barOptions.scales.x.grid.drawOnChartArea = true;\n barOptions.scales.y.grid.drawOnChartArea = false;\n delete barOptions.scales.y.ticks.maxTicksLimit;\n\n options = jsOptionsFunc(barOptions, hideLegend$2, setTitle$2, setBarMin$1, setBarMax$1, setStacked$2, setXtitle$2, setYtitle$2)(chart, chart.options);\n } else {\n options = jsOptions$2(chart, chart.options);\n }\n setFormatOptions$1(chart, options, chartType);\n var data = createDataTable(chart, options, \"column\");\n if (chartType !== \"bar\") {\n setLabelSize(chart, data, options);\n }\n if (!(\"mode\" in options.interaction)) {\n options.interaction.mode = \"index\";\n }\n this.drawChart(chart, \"bar\", data, options);\n};\n\ndefaultExport$2.prototype.renderAreaChart = function renderAreaChart (chart) {\n this.renderLineChart(chart, \"area\");\n};\n\ndefaultExport$2.prototype.renderBarChart = function renderBarChart (chart) {\n this.renderColumnChart(chart, \"bar\");\n};\n\ndefaultExport$2.prototype.renderScatterChart = function renderScatterChart (chart, chartType) {\n chartType = chartType || \"scatter\";\n\n var options = jsOptions$2(chart, chart.options);\n setFormatOptions$1(chart, options, chartType);\n\n if (!(\"showLine\" in options)) {\n options.showLine = false;\n }\n\n var data = createDataTable(chart, options, chartType);\n\n options.scales.x.type = options.scales.x.type || \"linear\";\n options.scales.x.position = options.scales.x.position || \"bottom\";\n\n // prevent grouping hover and tooltips\n if (!(\"mode\" in options.interaction)) {\n options.interaction.mode = \"nearest\";\n }\n\n this.drawChart(chart, chartType, data, options);\n};\n\ndefaultExport$2.prototype.renderBubbleChart = function renderBubbleChart (chart) {\n this.renderScatterChart(chart, \"bubble\");\n};\n\ndefaultExport$2.prototype.destroy = function destroy (chart) {\n if (chart.chart) {\n chart.chart.destroy();\n }\n};\n\ndefaultExport$2.prototype.drawChart = function drawChart (chart, type, data, options) {\n this.destroy(chart);\n if (chart.destroyed) { return; }\n\n var chartOptions = {\n type: type,\n data: data,\n options: options\n };\n\n if (chart.options.code) {\n window.console.log(\"new Chart(ctx, \" + JSON.stringify(chartOptions) + \");\");\n }\n\n chart.element.innerHTML = \"\";\n var ctx = chart.element.getElementsByTagName(\"CANVAS\")[0];\n chart.chart = new this.library(ctx, chartOptions);\n};\n\nvar defaultOptions$1 = {\n chart: {},\n xAxis: {\n title: {\n text: null\n },\n labels: {\n style: {\n fontSize: \"12px\"\n }\n }\n },\n yAxis: {\n title: {\n text: null\n },\n labels: {\n style: {\n fontSize: \"12px\"\n }\n }\n },\n title: {\n text: null\n },\n credits: {\n enabled: false\n },\n legend: {\n borderWidth: 0\n },\n tooltip: {\n style: {\n fontSize: \"12px\"\n }\n },\n plotOptions: {\n areaspline: {},\n area: {},\n series: {\n marker: {}\n }\n },\n time: {\n useUTC: false\n }\n};\n\nfunction hideLegend$1(options, legend, hideLegend) {\n if (legend !== undefined) {\n options.legend.enabled = !!legend;\n if (legend && legend !== true) {\n if (legend === \"top\" || legend === \"bottom\") {\n options.legend.verticalAlign = legend;\n } else {\n options.legend.layout = \"vertical\";\n options.legend.verticalAlign = \"middle\";\n options.legend.align = legend;\n }\n }\n } else if (hideLegend) {\n options.legend.enabled = false;\n }\n}\n\nfunction setTitle$1(options, title) {\n options.title.text = title;\n}\n\nfunction setMin$1(options, min) {\n options.yAxis.min = min;\n}\n\nfunction setMax$1(options, max) {\n options.yAxis.max = max;\n}\n\nfunction setStacked$1(options, stacked) {\n var stackedValue = stacked ? (stacked === true ? \"normal\" : stacked) : null;\n options.plotOptions.series.stacking = stackedValue;\n options.plotOptions.area.stacking = stackedValue;\n options.plotOptions.areaspline.stacking = stackedValue;\n}\n\nfunction setXtitle$1(options, title) {\n options.xAxis.title.text = title;\n}\n\nfunction setYtitle$1(options, title) {\n options.yAxis.title.text = title;\n}\n\nvar jsOptions$1 = jsOptionsFunc(defaultOptions$1, hideLegend$1, setTitle$1, setMin$1, setMax$1, setStacked$1, setXtitle$1, setYtitle$1);\n\nfunction setFormatOptions(chart, options, chartType) {\n var formatOptions = {\n prefix: chart.options.prefix,\n suffix: chart.options.suffix,\n thousands: chart.options.thousands,\n decimal: chart.options.decimal,\n precision: chart.options.precision,\n round: chart.options.round,\n zeros: chart.options.zeros\n };\n\n // skip when axis is an array (like with min/max)\n if (chartType !== \"pie\" && !isArray(options.yAxis) && !options.yAxis.labels.formatter) {\n options.yAxis.labels.formatter = function () {\n return formatValue(\"\", this.value, formatOptions);\n };\n }\n\n if (!options.tooltip.pointFormatter && !options.tooltip.pointFormat) {\n options.tooltip.pointFormatter = function () {\n return '\\u25CF ' + formatValue(this.series.name + ': ', this.y, formatOptions) + '
    ';\n };\n }\n}\n\nvar defaultExport$1 = function defaultExport(library) {\n this.name = \"highcharts\";\n this.library = library;\n};\n\ndefaultExport$1.prototype.renderLineChart = function renderLineChart (chart, chartType) {\n chartType = chartType || \"spline\";\n var chartOptions = {};\n if (chartType === \"areaspline\") {\n chartOptions = {\n plotOptions: {\n areaspline: {\n stacking: \"normal\"\n },\n area: {\n stacking: \"normal\"\n },\n series: {\n marker: {\n enabled: false\n }\n }\n }\n };\n }\n\n if (chart.options.curve === false) {\n if (chartType === \"areaspline\") {\n chartType = \"area\";\n } else if (chartType === \"spline\") {\n chartType = \"line\";\n }\n }\n\n var options = jsOptions$1(chart, chart.options, chartOptions);\n if (chart.xtype === \"number\") {\n options.xAxis.type = options.xAxis.type || \"linear\";\n } else {\n options.xAxis.type = chart.xtype === \"string\" ? \"category\" : \"datetime\";\n }\n if (!options.chart.type) {\n options.chart.type = chartType;\n }\n setFormatOptions(chart, options, chartType);\n\n var series = chart.data;\n for (var i = 0; i < series.length; i++) {\n series[i].name = series[i].name || \"Value\";\n var data = series[i].data;\n if (chart.xtype === \"datetime\") {\n for (var j = 0; j < data.length; j++) {\n data[j][0] = data[j][0].getTime();\n }\n } else if (chart.xtype === \"number\") {\n data.sort(sortByNumberSeries);\n }\n series[i].marker = {symbol: \"circle\"};\n if (chart.options.points === false) {\n series[i].marker.enabled = false;\n }\n }\n\n this.drawChart(chart, series, options);\n};\n\ndefaultExport$1.prototype.renderScatterChart = function renderScatterChart (chart) {\n var options = jsOptions$1(chart, chart.options, {});\n options.chart.type = \"scatter\";\n this.drawChart(chart, chart.data, options);\n};\n\ndefaultExport$1.prototype.renderPieChart = function renderPieChart (chart) {\n var chartOptions = merge(defaultOptions$1, {});\n\n if (chart.options.colors) {\n chartOptions.colors = chart.options.colors;\n }\n if (chart.options.donut) {\n chartOptions.plotOptions = {pie: {innerSize: \"50%\"}};\n }\n\n if (\"legend\" in chart.options) {\n hideLegend$1(chartOptions, chart.options.legend);\n }\n\n if (chart.options.title) {\n setTitle$1(chartOptions, chart.options.title);\n }\n\n var options = merge(chartOptions, chart.options.library || {});\n setFormatOptions(chart, options, \"pie\");\n var series = [{\n type: \"pie\",\n name: chart.options.label || \"Value\",\n data: chart.data\n }];\n\n this.drawChart(chart, series, options);\n};\n\ndefaultExport$1.prototype.renderColumnChart = function renderColumnChart (chart, chartType) {\n chartType = chartType || \"column\";\n var series = chart.data;\n var options = jsOptions$1(chart, chart.options);\n var rows = [];\n var categories = [];\n options.chart.type = chartType;\n setFormatOptions(chart, options, chartType);\n\n for (var i = 0; i < series.length; i++) {\n var s = series[i];\n\n for (var j = 0; j < s.data.length; j++) {\n var d = s.data[j];\n if (!rows[d[0]]) {\n rows[d[0]] = new Array(series.length);\n categories.push(d[0]);\n }\n rows[d[0]][i] = d[1];\n }\n }\n\n if (chart.xtype === \"number\") {\n categories.sort(sortByNumber);\n }\n\n options.xAxis.categories = categories;\n\n var newSeries = [];\n for (var i$1 = 0; i$1 < series.length; i$1++) {\n var d$1 = [];\n for (var j$1 = 0; j$1 < categories.length; j$1++) {\n d$1.push(rows[categories[j$1]][i$1] || 0);\n }\n\n var d2 = {\n name: series[i$1].name || \"Value\",\n data: d$1\n };\n if (series[i$1].stack) {\n d2.stack = series[i$1].stack;\n }\n\n newSeries.push(d2);\n }\n\n this.drawChart(chart, newSeries, options);\n};\n\ndefaultExport$1.prototype.renderBarChart = function renderBarChart (chart) {\n this.renderColumnChart(chart, \"bar\");\n};\n\ndefaultExport$1.prototype.renderAreaChart = function renderAreaChart (chart) {\n this.renderLineChart(chart, \"areaspline\");\n};\n\ndefaultExport$1.prototype.destroy = function destroy (chart) {\n if (chart.chart) {\n chart.chart.destroy();\n }\n};\n\ndefaultExport$1.prototype.drawChart = function drawChart (chart, data, options) {\n this.destroy(chart);\n if (chart.destroyed) { return; }\n\n options.chart.renderTo = chart.element.id;\n options.series = data;\n\n if (chart.options.code) {\n window.console.log(\"new Highcharts.Chart(\" + JSON.stringify(options) + \");\");\n }\n\n chart.chart = new this.library.Chart(options);\n};\n\nvar loaded = {};\nvar callbacks = [];\n\n// Set chart options\nvar defaultOptions = {\n chartArea: {},\n fontName: \"'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, Helvetica, sans-serif\",\n pointSize: 6,\n legend: {\n textStyle: {\n fontSize: 12,\n color: \"#444\"\n },\n alignment: \"center\",\n position: \"right\"\n },\n curveType: \"function\",\n hAxis: {\n textStyle: {\n color: \"#666\",\n fontSize: 12\n },\n titleTextStyle: {},\n gridlines: {\n color: \"transparent\"\n },\n baselineColor: \"#ccc\",\n viewWindow: {}\n },\n vAxis: {\n textStyle: {\n color: \"#666\",\n fontSize: 12\n },\n titleTextStyle: {},\n baselineColor: \"#ccc\",\n viewWindow: {}\n },\n tooltip: {\n textStyle: {\n color: \"#666\",\n fontSize: 12\n }\n }\n};\n\nfunction hideLegend(options, legend, hideLegend) {\n if (legend !== undefined) {\n var position;\n if (!legend) {\n position = \"none\";\n } else if (legend === true) {\n position = \"right\";\n } else {\n position = legend;\n }\n options.legend.position = position;\n } else if (hideLegend) {\n options.legend.position = \"none\";\n }\n}\n\nfunction setTitle(options, title) {\n options.title = title;\n options.titleTextStyle = {color: \"#333\", fontSize: \"20px\"};\n}\n\nfunction setMin(options, min) {\n options.vAxis.viewWindow.min = min;\n}\n\nfunction setMax(options, max) {\n options.vAxis.viewWindow.max = max;\n}\n\nfunction setBarMin(options, min) {\n options.hAxis.viewWindow.min = min;\n}\n\nfunction setBarMax(options, max) {\n options.hAxis.viewWindow.max = max;\n}\n\nfunction setStacked(options, stacked) {\n options.isStacked = stacked || false;\n}\n\nfunction setXtitle(options, title) {\n options.hAxis.title = title;\n options.hAxis.titleTextStyle.italic = false;\n}\n\nfunction setYtitle(options, title) {\n options.vAxis.title = title;\n options.vAxis.titleTextStyle.italic = false;\n}\n\nvar jsOptions = jsOptionsFunc(defaultOptions, hideLegend, setTitle, setMin, setMax, setStacked, setXtitle, setYtitle);\n\nfunction resize(callback) {\n if (window.attachEvent) {\n window.attachEvent(\"onresize\", callback);\n } else if (window.addEventListener) {\n window.addEventListener(\"resize\", callback, true);\n }\n callback();\n}\n\nvar defaultExport = function defaultExport(library) {\n this.name = \"google\";\n this.library = library;\n};\n\ndefaultExport.prototype.renderLineChart = function renderLineChart (chart) {\n var this$1$1 = this;\n\n this.waitForLoaded(chart, function () {\n var chartOptions = {};\n\n if (chart.options.curve === false) {\n chartOptions.curveType = \"none\";\n }\n\n if (chart.options.points === false) {\n chartOptions.pointSize = 0;\n }\n\n var options = jsOptions(chart, chart.options, chartOptions);\n var data = this$1$1.createDataTable(chart.data, chart.xtype);\n\n this$1$1.drawChart(chart, \"LineChart\", data, options);\n });\n};\n\ndefaultExport.prototype.renderPieChart = function renderPieChart (chart) {\n var this$1$1 = this;\n\n this.waitForLoaded(chart, function () {\n var chartOptions = {\n chartArea: {\n top: \"10%\",\n height: \"80%\"\n },\n legend: {}\n };\n if (chart.options.colors) {\n chartOptions.colors = chart.options.colors;\n }\n if (chart.options.donut) {\n chartOptions.pieHole = 0.5;\n }\n if (\"legend\" in chart.options) {\n hideLegend(chartOptions, chart.options.legend);\n }\n if (chart.options.title) {\n setTitle(chartOptions, chart.options.title);\n }\n var options = merge(merge(defaultOptions, chartOptions), chart.options.library || {});\n\n var data = new this$1$1.library.visualization.DataTable();\n data.addColumn(\"string\", \"\");\n data.addColumn(\"number\", \"Value\");\n data.addRows(chart.data);\n\n this$1$1.drawChart(chart, \"PieChart\", data, options);\n });\n};\n\ndefaultExport.prototype.renderColumnChart = function renderColumnChart (chart) {\n var this$1$1 = this;\n\n this.waitForLoaded(chart, function () {\n var options = jsOptions(chart, chart.options);\n var data = this$1$1.createDataTable(chart.data, chart.xtype);\n\n this$1$1.drawChart(chart, \"ColumnChart\", data, options);\n });\n};\n\ndefaultExport.prototype.renderBarChart = function renderBarChart (chart) {\n var this$1$1 = this;\n\n this.waitForLoaded(chart, function () {\n var chartOptions = {\n hAxis: {\n gridlines: {\n color: \"#ccc\"\n }\n }\n };\n var options = jsOptionsFunc(defaultOptions, hideLegend, setTitle, setBarMin, setBarMax, setStacked, setXtitle, setYtitle)(chart, chart.options, chartOptions);\n var data = this$1$1.createDataTable(chart.data, chart.xtype);\n\n this$1$1.drawChart(chart, \"BarChart\", data, options);\n });\n};\n\ndefaultExport.prototype.renderAreaChart = function renderAreaChart (chart) {\n var this$1$1 = this;\n\n this.waitForLoaded(chart, function () {\n var chartOptions = {\n isStacked: true,\n pointSize: 0,\n areaOpacity: 0.5\n };\n\n var options = jsOptions(chart, chart.options, chartOptions);\n var data = this$1$1.createDataTable(chart.data, chart.xtype);\n\n this$1$1.drawChart(chart, \"AreaChart\", data, options);\n });\n};\n\ndefaultExport.prototype.renderGeoChart = function renderGeoChart (chart) {\n var this$1$1 = this;\n\n this.waitForLoaded(chart, \"geochart\", function () {\n var chartOptions = {\n legend: \"none\",\n colorAxis: {\n colors: chart.options.colors || [\"#f6c7b6\", \"#ce502d\"]\n }\n };\n var options = merge(merge(defaultOptions, chartOptions), chart.options.library || {});\n\n var data = new this$1$1.library.visualization.DataTable();\n data.addColumn(\"string\", \"\");\n data.addColumn(\"number\", chart.options.label || \"Value\");\n data.addRows(chart.data);\n\n this$1$1.drawChart(chart, \"GeoChart\", data, options);\n });\n};\n\ndefaultExport.prototype.renderScatterChart = function renderScatterChart (chart) {\n var this$1$1 = this;\n\n this.waitForLoaded(chart, function () {\n var chartOptions = {};\n var options = jsOptions(chart, chart.options, chartOptions);\n\n var series = chart.data;\n var rows2 = [];\n for (var i = 0; i < series.length; i++) {\n series[i].name = series[i].name || \"Value\";\n var d = series[i].data;\n for (var j = 0; j < d.length; j++) {\n var row = new Array(series.length + 1);\n row[0] = d[j][0];\n row[i + 1] = d[j][1];\n rows2.push(row);\n }\n }\n\n var data = new this$1$1.library.visualization.DataTable();\n data.addColumn(\"number\", \"\");\n for (var i$1 = 0; i$1 < series.length; i$1++) {\n data.addColumn(\"number\", series[i$1].name);\n }\n data.addRows(rows2);\n\n this$1$1.drawChart(chart, \"ScatterChart\", data, options);\n });\n};\n\ndefaultExport.prototype.renderTimeline = function renderTimeline (chart) {\n var this$1$1 = this;\n\n this.waitForLoaded(chart, \"timeline\", function () {\n var chartOptions = {\n legend: \"none\"\n };\n\n if (chart.options.colors) {\n chartOptions.colors = chart.options.colors;\n }\n var options = merge(merge(defaultOptions, chartOptions), chart.options.library || {});\n\n var data = new this$1$1.library.visualization.DataTable();\n data.addColumn({type: \"string\", id: \"Name\"});\n data.addColumn({type: \"date\", id: \"Start\"});\n data.addColumn({type: \"date\", id: \"End\"});\n data.addRows(chart.data);\n\n chart.element.style.lineHeight = \"normal\";\n\n this$1$1.drawChart(chart, \"Timeline\", data, options);\n });\n};\n\n// TODO remove resize events\ndefaultExport.prototype.destroy = function destroy (chart) {\n if (chart.chart) {\n chart.chart.clearChart();\n }\n};\n\ndefaultExport.prototype.drawChart = function drawChart (chart, type, data, options) {\n this.destroy(chart);\n if (chart.destroyed) { return; }\n\n if (chart.options.code) {\n window.console.log(\"var data = new google.visualization.DataTable(\" + data.toJSON() + \");\\nvar chart = new google.visualization.\" + type + \"(element);\\nchart.draw(data, \" + JSON.stringify(options) + \");\");\n }\n\n chart.chart = new this.library.visualization[type](chart.element);\n resize(function () {\n chart.chart.draw(data, options);\n });\n};\n\ndefaultExport.prototype.waitForLoaded = function waitForLoaded (chart, pack, callback) {\n var this$1$1 = this;\n\n if (!callback) {\n callback = pack;\n pack = \"corechart\";\n }\n\n callbacks.push({pack: pack, callback: callback});\n\n if (loaded[pack]) {\n this.runCallbacks();\n } else {\n loaded[pack] = true;\n\n // https://groups.google.com/forum/#!topic/google-visualization-api/fMKJcyA2yyI\n var loadOptions = {\n packages: [pack],\n callback: function () { this$1$1.runCallbacks(); }\n };\n var config = chart.__config();\n if (config.language) {\n loadOptions.language = config.language;\n }\n if (pack === \"geochart\" && config.mapsApiKey) {\n loadOptions.mapsApiKey = config.mapsApiKey;\n }\n\n this.library.charts.load(\"current\", loadOptions);\n }\n};\n\ndefaultExport.prototype.runCallbacks = function runCallbacks () {\n for (var i = 0; i < callbacks.length; i++) {\n var cb = callbacks[i];\n var call = this.library.visualization && ((cb.pack === \"corechart\" && this.library.visualization.LineChart) || (cb.pack === \"timeline\" && this.library.visualization.Timeline) || (cb.pack === \"geochart\" && this.library.visualization.GeoChart));\n if (call) {\n cb.callback();\n callbacks.splice(i, 1);\n i--;\n }\n }\n};\n\n// cant use object as key\ndefaultExport.prototype.createDataTable = function createDataTable (series, columnType) {\n var rows = [];\n var sortedLabels = [];\n for (var i = 0; i < series.length; i++) {\n var s = series[i];\n series[i].name = series[i].name || \"Value\";\n\n for (var j = 0; j < s.data.length; j++) {\n var d = s.data[j];\n var key = columnType === \"datetime\" ? d[0].getTime() : d[0];\n if (!rows[key]) {\n rows[key] = new Array(series.length);\n sortedLabels.push(key);\n }\n rows[key][i] = d[1];\n }\n }\n\n var rows2 = [];\n var values = [];\n for (var j$1 = 0; j$1 < sortedLabels.length; j$1++) {\n var i$1 = sortedLabels[j$1];\n var value = (void 0);\n if (columnType === \"datetime\") {\n value = new Date(i$1);\n values.push(value);\n } else {\n value = i$1;\n }\n rows2.push([value].concat(rows[i$1]));\n }\n\n var day = true;\n if (columnType === \"datetime\") {\n rows2.sort(sortByTime);\n\n var timeUnit = calculateTimeUnit(values, true);\n day = isDay(timeUnit);\n } else if (columnType === \"number\") {\n rows2.sort(sortByNumberSeries);\n\n for (var i$2 = 0; i$2 < rows2.length; i$2++) {\n rows2[i$2][0] = toStr(rows2[i$2][0]);\n }\n\n columnType = \"string\";\n }\n\n // create datatable\n var data = new this.library.visualization.DataTable();\n columnType = columnType === \"datetime\" && day ? \"date\" : columnType;\n data.addColumn(columnType, \"\");\n for (var i$3 = 0; i$3 < series.length; i$3++) {\n data.addColumn(\"number\", series[i$3].name);\n }\n data.addRows(rows2);\n\n return data;\n};\n\nvar adapters = [];\n\nfunction getAdapterType(library) {\n if (library) {\n if (library.product === \"Highcharts\") {\n return defaultExport$1;\n } else if (library.charts) {\n return defaultExport;\n } else if (isFunction(library)) {\n return defaultExport$2;\n }\n }\n throw new Error(\"Unknown adapter\");\n}\n\nfunction addAdapter(library) {\n var adapterType = getAdapterType(library);\n\n for (var i = 0; i < adapters.length; i++) {\n if (adapters[i].library === library) {\n return;\n }\n }\n\n adapters.push(new adapterType(library));\n}\n\nfunction loadAdapters() {\n if (\"Chart\" in window) {\n addAdapter(window.Chart);\n }\n\n if (\"Highcharts\" in window) {\n addAdapter(window.Highcharts);\n }\n\n if (window.google && window.google.charts) {\n addAdapter(window.google);\n }\n}\n\n// TODO remove chartType if cross-browser way\n// to get the name of the chart class\nfunction callAdapter(chartType, chart) {\n var fnName = \"render\" + chartType;\n var adapterName = chart.options.adapter;\n\n loadAdapters();\n\n for (var i = 0; i < adapters.length; i++) {\n var adapter = adapters[i];\n if ((!adapterName || adapterName === adapter.name) && isFunction(adapter[fnName])) {\n chart.adapter = adapter.name;\n chart.__adapterObject = adapter;\n return adapter[fnName](chart);\n }\n }\n\n if (adapters.length > 0) {\n throw new Error(\"No charting library found for \" + chartType);\n } else {\n throw new Error(\"No charting libraries found - be sure to include one before your charts\");\n }\n}\n\nvar Chartkick = {\n charts: {},\n configure: function (options) {\n for (var key in options) {\n if (Object.prototype.hasOwnProperty.call(options, key)) {\n Chartkick.config[key] = options[key];\n }\n }\n },\n setDefaultOptions: function (opts) {\n Chartkick.options = opts;\n },\n eachChart: function (callback) {\n for (var chartId in Chartkick.charts) {\n if (Object.prototype.hasOwnProperty.call(Chartkick.charts, chartId)) {\n callback(Chartkick.charts[chartId]);\n }\n }\n },\n destroyAll: function () {\n for (var chartId in Chartkick.charts) {\n if (Object.prototype.hasOwnProperty.call(Chartkick.charts, chartId)) {\n Chartkick.charts[chartId].destroy();\n delete Chartkick.charts[chartId];\n }\n }\n },\n config: {},\n options: {},\n adapters: adapters,\n addAdapter: addAdapter,\n use: function (adapter) {\n addAdapter(adapter);\n return Chartkick;\n }\n};\n\nfunction formatSeriesBubble(data) {\n var r = [];\n for (var i = 0; i < data.length; i++) {\n r.push([toFloat(data[i][0]), toFloat(data[i][1]), toFloat(data[i][2])]);\n }\n return r;\n}\n\n// casts data to proper type\n// sorting is left to adapters\nfunction formatSeriesData(data, keyType) {\n if (keyType === \"bubble\") {\n return formatSeriesBubble(data);\n }\n\n var keyFunc;\n if (keyType === \"number\") {\n keyFunc = toFloat;\n } else if (keyType === \"datetime\") {\n keyFunc = toDate;\n } else {\n keyFunc = toStr;\n }\n\n var r = [];\n for (var i = 0; i < data.length; i++) {\n r.push([keyFunc(data[i][0]), toFloat(data[i][1])]);\n }\n return r;\n}\n\nfunction detectXType(series, noDatetime, options) {\n if (dataEmpty(series)) {\n if ((options.xmin || options.xmax) && (!options.xmin || isDate(options.xmin)) && (!options.xmax || isDate(options.xmax))) {\n return \"datetime\";\n } else {\n return \"number\";\n }\n } else if (detectXTypeWithFunction(series, isNumber)) {\n return \"number\";\n } else if (!noDatetime && detectXTypeWithFunction(series, isDate)) {\n return \"datetime\";\n } else {\n return \"string\";\n }\n}\n\nfunction detectXTypeWithFunction(series, func) {\n for (var i = 0; i < series.length; i++) {\n var data = toArr(series[i].data);\n for (var j = 0; j < data.length; j++) {\n if (!func(data[j][0])) {\n return false;\n }\n }\n }\n return true;\n}\n\n// creates a shallow copy of each element of the array\n// elements are expected to be objects\nfunction copySeries(series) {\n var newSeries = [];\n for (var i = 0; i < series.length; i++) {\n var copy = {};\n for (var j in series[i]) {\n if (Object.prototype.hasOwnProperty.call(series[i], j)) {\n copy[j] = series[i][j];\n }\n }\n newSeries.push(copy);\n }\n return newSeries;\n}\n\nfunction processSeries(chart, keyType, noDatetime) {\n var opts = chart.options;\n var series = chart.rawData;\n\n // see if one series or multiple\n chart.singleSeriesFormat = !isArray(series) || !isPlainObject(series[0]);\n if (chart.singleSeriesFormat) {\n series = [{name: opts.label, data: series}];\n }\n\n // convert to array\n // must come before dataEmpty check\n series = copySeries(series);\n for (var i = 0; i < series.length; i++) {\n series[i].data = toArr(series[i].data);\n }\n\n chart.xtype = keyType || (opts.discrete ? \"string\" : detectXType(series, noDatetime, opts));\n\n // right format\n for (var i$1 = 0; i$1 < series.length; i$1++) {\n series[i$1].data = formatSeriesData(series[i$1].data, chart.xtype);\n }\n\n return series;\n}\n\nfunction processSimple(chart) {\n var perfectData = toArr(chart.rawData);\n for (var i = 0; i < perfectData.length; i++) {\n perfectData[i] = [toStr(perfectData[i][0]), toFloat(perfectData[i][1])];\n }\n return perfectData;\n}\n\nfunction dataEmpty(data, chartType) {\n if (chartType === \"PieChart\" || chartType === \"GeoChart\" || chartType === \"Timeline\") {\n return data.length === 0;\n } else {\n for (var i = 0; i < data.length; i++) {\n if (data[i].data.length > 0) {\n return false;\n }\n }\n return true;\n }\n}\n\nfunction addDownloadButton(chart) {\n var download = chart.options.download;\n if (download === true) {\n download = {};\n } else if (typeof download === \"string\") {\n download = {filename: download};\n }\n\n var link = document.createElement(\"a\");\n link.download = download.filename || \"chart.png\";\n link.style.position = \"absolute\";\n link.style.top = \"20px\";\n link.style.right = \"20px\";\n link.style.zIndex = 1000;\n link.style.lineHeight = \"20px\";\n link.target = \"_blank\"; // for safari\n\n var image = document.createElement(\"img\");\n // icon from Font Awesome, modified to set fill color\n var svg = \"\";\n image.src = \"data:image/svg+xml;utf8,\" + (encodeURIComponent(svg));\n image.alt = \"Download\";\n image.style.width = \"20px\";\n image.style.height = \"20px\";\n image.style.border = \"none\";\n link.appendChild(image);\n\n var element = chart.element;\n element.style.position = \"relative\";\n\n chart.__downloadAttached = true;\n\n // mouseenter\n chart.__enterEvent = element.addEventListener(\"mouseover\", function (e) {\n var related = e.relatedTarget;\n // check download option again to ensure it wasn't changed\n if ((!related || (related !== this && !this.contains(related))) && chart.options.download) {\n link.href = chart.toImage(download);\n element.appendChild(link);\n }\n });\n\n // mouseleave\n chart.__leaveEvent = element.addEventListener(\"mouseout\", function (e) {\n var related = e.relatedTarget;\n if (!related || (related !== this && !this.contains(related))) {\n if (link.parentNode) {\n link.parentNode.removeChild(link);\n }\n }\n });\n}\n\nvar pendingRequests = [];\nvar runningRequests = 0;\nvar maxRequests = 4;\n\nfunction pushRequest(url, success, error) {\n pendingRequests.push([url, success, error]);\n runNext();\n}\n\nfunction runNext() {\n if (runningRequests < maxRequests) {\n var request = pendingRequests.shift();\n if (request) {\n runningRequests++;\n getJSON(request[0], request[1], request[2]);\n runNext();\n }\n }\n}\n\nfunction requestComplete() {\n runningRequests--;\n runNext();\n}\n\nfunction getJSON(url, success, error) {\n var xhr = new XMLHttpRequest();\n xhr.open(\"GET\", url, true);\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n xhr.onload = function () {\n requestComplete();\n if (xhr.status === 200) {\n success(JSON.parse(xhr.responseText));\n } else {\n error(xhr.statusText);\n }\n };\n xhr.send();\n}\n\n// helpers\n\nfunction setText(element, text) {\n element.textContent = text;\n}\n\n// TODO remove prefix for all messages\nfunction chartError(element, message, noPrefix) {\n if (!noPrefix) {\n message = \"Error Loading Chart: \" + message;\n }\n setText(element, message);\n element.style.color = \"#ff0000\";\n}\n\nfunction errorCatcher(chart) {\n try {\n chart.__render();\n } catch (err) {\n chartError(chart.element, err.message);\n throw err;\n }\n}\n\nfunction fetchDataSource(chart, dataSource, showLoading) {\n // only show loading message for urls and callbacks\n if (showLoading && chart.options.loading && (typeof dataSource === \"string\" || typeof dataSource === \"function\")) {\n setText(chart.element, chart.options.loading);\n }\n\n if (typeof dataSource === \"string\") {\n pushRequest(dataSource, function (data) {\n chart.rawData = data;\n errorCatcher(chart);\n }, function (message) {\n chartError(chart.element, message);\n });\n } else if (typeof dataSource === \"function\") {\n try {\n dataSource(function (data) {\n chart.rawData = data;\n errorCatcher(chart);\n }, function (message) {\n chartError(chart.element, message, true);\n });\n } catch (err) {\n chartError(chart.element, err, true);\n }\n } else {\n chart.rawData = dataSource;\n errorCatcher(chart);\n }\n}\n\nfunction renderChart(chartType, chart) {\n if (dataEmpty(chart.data, chartType)) {\n var message = chart.options.empty || (chart.options.messages && chart.options.messages.empty) || \"No data\";\n setText(chart.element, message);\n } else {\n callAdapter(chartType, chart);\n // TODO add downloadSupported method to adapter\n if (chart.options.download && !chart.__downloadAttached && chart.adapter === \"chartjs\") {\n addDownloadButton(chart);\n }\n }\n}\n\nfunction getElement(element) {\n if (typeof element === \"string\") {\n var elementId = element;\n element = document.getElementById(element);\n if (!element) {\n throw new Error(\"No element with id \" + elementId);\n }\n }\n return element;\n}\n\n// define classes\n\nvar Chart = function Chart(element, dataSource, options) {\n this.element = getElement(element);\n this.options = merge(Chartkick.options, options || {});\n this.dataSource = dataSource;\n\n // TODO handle charts without an id for eachChart and destroyAll\n if (this.element.id) {\n Chartkick.charts[this.element.id] = this;\n }\n\n fetchDataSource(this, dataSource, true);\n\n if (this.options.refresh) {\n this.startRefresh();\n }\n};\n\nChart.prototype.getElement = function getElement () {\n return this.element;\n};\n\nChart.prototype.getDataSource = function getDataSource () {\n return this.dataSource;\n};\n\nChart.prototype.getData = function getData () {\n return this.data;\n};\n\nChart.prototype.getOptions = function getOptions () {\n return this.options;\n};\n\nChart.prototype.getChartObject = function getChartObject () {\n return this.chart;\n};\n\nChart.prototype.getAdapter = function getAdapter () {\n return this.adapter;\n};\n\nChart.prototype.updateData = function updateData (dataSource, options) {\n this.dataSource = dataSource;\n if (options) {\n this.__updateOptions(options);\n }\n fetchDataSource(this, dataSource, true);\n};\n\nChart.prototype.setOptions = function setOptions (options) {\n this.__updateOptions(options);\n this.redraw();\n};\n\nChart.prototype.redraw = function redraw () {\n fetchDataSource(this, this.rawData);\n};\n\nChart.prototype.refreshData = function refreshData () {\n if (typeof this.dataSource === \"string\") {\n // prevent browser from caching\n var sep = this.dataSource.indexOf(\"?\") === -1 ? \"?\" : \"&\";\n var url = this.dataSource + sep + \"_=\" + (new Date()).getTime();\n fetchDataSource(this, url);\n } else if (typeof this.dataSource === \"function\") {\n fetchDataSource(this, this.dataSource);\n }\n};\n\nChart.prototype.startRefresh = function startRefresh () {\n var this$1$1 = this;\n\n var refresh = this.options.refresh;\n\n if (refresh && typeof this.dataSource !== \"string\" && typeof this.dataSource !== \"function\") {\n throw new Error(\"Data source must be a URL or callback for refresh\");\n }\n\n if (!this.intervalId) {\n if (refresh) {\n this.intervalId = setInterval(function () {\n this$1$1.refreshData();\n }, refresh * 1000);\n } else {\n throw new Error(\"No refresh interval\");\n }\n }\n};\n\nChart.prototype.stopRefresh = function stopRefresh () {\n if (this.intervalId) {\n clearInterval(this.intervalId);\n this.intervalId = null;\n }\n};\n\nChart.prototype.toImage = function toImage (download) {\n // TODO move logic to adapter\n if (this.adapter === \"chartjs\") {\n if (download && download.background && download.background !== \"transparent\") {\n // https://stackoverflow.com/questions/30464750/chartjs-line-chart-set-background-color\n var canvas = this.chart.canvas;\n var ctx = this.chart.ctx;\n var tmpCanvas = document.createElement(\"canvas\");\n var tmpCtx = tmpCanvas.getContext(\"2d\");\n tmpCanvas.width = ctx.canvas.width;\n tmpCanvas.height = ctx.canvas.height;\n tmpCtx.fillStyle = download.background;\n tmpCtx.fillRect(0, 0, tmpCanvas.width, tmpCanvas.height);\n tmpCtx.drawImage(canvas, 0, 0);\n return tmpCanvas.toDataURL(\"image/png\");\n } else {\n return this.chart.toBase64Image();\n }\n } else {\n throw new Error(\"Feature only available for Chart.js\");\n }\n};\n\nChart.prototype.destroy = function destroy () {\n this.destroyed = true;\n this.stopRefresh();\n\n if (this.__adapterObject) {\n this.__adapterObject.destroy(this);\n }\n\n if (this.__enterEvent) {\n this.element.removeEventListener(\"mouseover\", this.__enterEvent);\n }\n\n if (this.__leaveEvent) {\n this.element.removeEventListener(\"mouseout\", this.__leaveEvent);\n }\n};\n\nChart.prototype.__updateOptions = function __updateOptions (options) {\n var updateRefresh = options.refresh && options.refresh !== this.options.refresh;\n this.options = merge(Chartkick.options, options);\n if (updateRefresh) {\n this.stopRefresh();\n this.startRefresh();\n }\n};\n\nChart.prototype.__render = function __render () {\n this.data = this.__processData();\n renderChart(this.__chartName(), this);\n};\n\nChart.prototype.__config = function __config () {\n return Chartkick.config;\n};\n\nvar LineChart = /*@__PURE__*/(function (Chart) {\n function LineChart () {\n Chart.apply(this, arguments);\n }\n\n if ( Chart ) LineChart.__proto__ = Chart;\n LineChart.prototype = Object.create( Chart && Chart.prototype );\n LineChart.prototype.constructor = LineChart;\n\n LineChart.prototype.__processData = function __processData () {\n return processSeries(this);\n };\n\n LineChart.prototype.__chartName = function __chartName () {\n return \"LineChart\";\n };\n\n return LineChart;\n}(Chart));\n\nvar PieChart = /*@__PURE__*/(function (Chart) {\n function PieChart () {\n Chart.apply(this, arguments);\n }\n\n if ( Chart ) PieChart.__proto__ = Chart;\n PieChart.prototype = Object.create( Chart && Chart.prototype );\n PieChart.prototype.constructor = PieChart;\n\n PieChart.prototype.__processData = function __processData () {\n return processSimple(this);\n };\n\n PieChart.prototype.__chartName = function __chartName () {\n return \"PieChart\";\n };\n\n return PieChart;\n}(Chart));\n\nvar ColumnChart = /*@__PURE__*/(function (Chart) {\n function ColumnChart () {\n Chart.apply(this, arguments);\n }\n\n if ( Chart ) ColumnChart.__proto__ = Chart;\n ColumnChart.prototype = Object.create( Chart && Chart.prototype );\n ColumnChart.prototype.constructor = ColumnChart;\n\n ColumnChart.prototype.__processData = function __processData () {\n return processSeries(this, null, true);\n };\n\n ColumnChart.prototype.__chartName = function __chartName () {\n return \"ColumnChart\";\n };\n\n return ColumnChart;\n}(Chart));\n\nvar BarChart = /*@__PURE__*/(function (Chart) {\n function BarChart () {\n Chart.apply(this, arguments);\n }\n\n if ( Chart ) BarChart.__proto__ = Chart;\n BarChart.prototype = Object.create( Chart && Chart.prototype );\n BarChart.prototype.constructor = BarChart;\n\n BarChart.prototype.__processData = function __processData () {\n return processSeries(this, null, true);\n };\n\n BarChart.prototype.__chartName = function __chartName () {\n return \"BarChart\";\n };\n\n return BarChart;\n}(Chart));\n\nvar AreaChart = /*@__PURE__*/(function (Chart) {\n function AreaChart () {\n Chart.apply(this, arguments);\n }\n\n if ( Chart ) AreaChart.__proto__ = Chart;\n AreaChart.prototype = Object.create( Chart && Chart.prototype );\n AreaChart.prototype.constructor = AreaChart;\n\n AreaChart.prototype.__processData = function __processData () {\n return processSeries(this);\n };\n\n AreaChart.prototype.__chartName = function __chartName () {\n return \"AreaChart\";\n };\n\n return AreaChart;\n}(Chart));\n\nvar GeoChart = /*@__PURE__*/(function (Chart) {\n function GeoChart () {\n Chart.apply(this, arguments);\n }\n\n if ( Chart ) GeoChart.__proto__ = Chart;\n GeoChart.prototype = Object.create( Chart && Chart.prototype );\n GeoChart.prototype.constructor = GeoChart;\n\n GeoChart.prototype.__processData = function __processData () {\n return processSimple(this);\n };\n\n GeoChart.prototype.__chartName = function __chartName () {\n return \"GeoChart\";\n };\n\n return GeoChart;\n}(Chart));\n\nvar ScatterChart = /*@__PURE__*/(function (Chart) {\n function ScatterChart () {\n Chart.apply(this, arguments);\n }\n\n if ( Chart ) ScatterChart.__proto__ = Chart;\n ScatterChart.prototype = Object.create( Chart && Chart.prototype );\n ScatterChart.prototype.constructor = ScatterChart;\n\n ScatterChart.prototype.__processData = function __processData () {\n return processSeries(this, \"number\");\n };\n\n ScatterChart.prototype.__chartName = function __chartName () {\n return \"ScatterChart\";\n };\n\n return ScatterChart;\n}(Chart));\n\nvar BubbleChart = /*@__PURE__*/(function (Chart) {\n function BubbleChart () {\n Chart.apply(this, arguments);\n }\n\n if ( Chart ) BubbleChart.__proto__ = Chart;\n BubbleChart.prototype = Object.create( Chart && Chart.prototype );\n BubbleChart.prototype.constructor = BubbleChart;\n\n BubbleChart.prototype.__processData = function __processData () {\n return processSeries(this, \"bubble\");\n };\n\n BubbleChart.prototype.__chartName = function __chartName () {\n return \"BubbleChart\";\n };\n\n return BubbleChart;\n}(Chart));\n\nvar Timeline = /*@__PURE__*/(function (Chart) {\n function Timeline () {\n Chart.apply(this, arguments);\n }\n\n if ( Chart ) Timeline.__proto__ = Chart;\n Timeline.prototype = Object.create( Chart && Chart.prototype );\n Timeline.prototype.constructor = Timeline;\n\n Timeline.prototype.__processData = function __processData () {\n var data = this.rawData;\n for (var i = 0; i < data.length; i++) {\n data[i][1] = toDate(data[i][1]);\n data[i][2] = toDate(data[i][2]);\n }\n return data;\n };\n\n Timeline.prototype.__chartName = function __chartName () {\n return \"Timeline\";\n };\n\n return Timeline;\n}(Chart));\n\nChartkick.LineChart = LineChart;\nChartkick.PieChart = PieChart;\nChartkick.ColumnChart = ColumnChart;\nChartkick.BarChart = BarChart;\nChartkick.AreaChart = AreaChart;\nChartkick.GeoChart = GeoChart;\nChartkick.ScatterChart = ScatterChart;\nChartkick.BubbleChart = BubbleChart;\nChartkick.Timeline = Timeline;\n\n// not ideal, but allows for simpler integration\nif (typeof window !== \"undefined\" && !window.Chartkick) {\n window.Chartkick = Chartkick;\n\n // clean up previous charts before Turbolinks loads new page\n document.addEventListener(\"turbolinks:before-render\", function () {\n if (Chartkick.config.autoDestroy !== false) {\n Chartkick.destroyAll();\n }\n });\n\n // clean up previous charts before Turbo loads new page\n document.addEventListener(\"turbo:before-render\", function () {\n if (Chartkick.config.autoDestroy !== false) {\n Chartkick.destroyAll();\n }\n });\n\n // use setTimeout so charting library can come later in same JS file\n setTimeout(function () {\n window.dispatchEvent(new Event(\"chartkick:load\"));\n }, 0);\n}\n\n// backwards compatibility for esm require\nChartkick.default = Chartkick;\n\nexport { Chartkick as default };\n", "/*!\n * @kurkle/color v0.3.2\n * https://github.com/kurkle/color#readme\n * (c) 2023 Jukka Kurkela\n * Released under the MIT License\n */\nfunction round(v) {\n return v + 0.5 | 0;\n}\nconst lim = (v, l, h) => Math.max(Math.min(v, h), l);\nfunction p2b(v) {\n return lim(round(v * 2.55), 0, 255);\n}\nfunction b2p(v) {\n return lim(round(v / 2.55), 0, 100);\n}\nfunction n2b(v) {\n return lim(round(v * 255), 0, 255);\n}\nfunction b2n(v) {\n return lim(round(v / 2.55) / 100, 0, 1);\n}\nfunction n2p(v) {\n return lim(round(v * 100), 0, 100);\n}\n\nconst map$1 = {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, A: 10, B: 11, C: 12, D: 13, E: 14, F: 15, a: 10, b: 11, c: 12, d: 13, e: 14, f: 15};\nconst hex = [...'0123456789ABCDEF'];\nconst h1 = b => hex[b & 0xF];\nconst h2 = b => hex[(b & 0xF0) >> 4] + hex[b & 0xF];\nconst eq = b => ((b & 0xF0) >> 4) === (b & 0xF);\nconst isShort = v => eq(v.r) && eq(v.g) && eq(v.b) && eq(v.a);\nfunction hexParse(str) {\n var len = str.length;\n var ret;\n if (str[0] === '#') {\n if (len === 4 || len === 5) {\n ret = {\n r: 255 & map$1[str[1]] * 17,\n g: 255 & map$1[str[2]] * 17,\n b: 255 & map$1[str[3]] * 17,\n a: len === 5 ? map$1[str[4]] * 17 : 255\n };\n } else if (len === 7 || len === 9) {\n ret = {\n r: map$1[str[1]] << 4 | map$1[str[2]],\n g: map$1[str[3]] << 4 | map$1[str[4]],\n b: map$1[str[5]] << 4 | map$1[str[6]],\n a: len === 9 ? (map$1[str[7]] << 4 | map$1[str[8]]) : 255\n };\n }\n }\n return ret;\n}\nconst alpha = (a, f) => a < 255 ? f(a) : '';\nfunction hexString(v) {\n var f = isShort(v) ? h1 : h2;\n return v\n ? '#' + f(v.r) + f(v.g) + f(v.b) + alpha(v.a, f)\n : undefined;\n}\n\nconst HUE_RE = /^(hsla?|hwb|hsv)\\(\\s*([-+.e\\d]+)(?:deg)?[\\s,]+([-+.e\\d]+)%[\\s,]+([-+.e\\d]+)%(?:[\\s,]+([-+.e\\d]+)(%)?)?\\s*\\)$/;\nfunction hsl2rgbn(h, s, l) {\n const a = s * Math.min(l, 1 - l);\n const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);\n return [f(0), f(8), f(4)];\n}\nfunction hsv2rgbn(h, s, v) {\n const f = (n, k = (n + h / 60) % 6) => v - v * s * Math.max(Math.min(k, 4 - k, 1), 0);\n return [f(5), f(3), f(1)];\n}\nfunction hwb2rgbn(h, w, b) {\n const rgb = hsl2rgbn(h, 1, 0.5);\n let i;\n if (w + b > 1) {\n i = 1 / (w + b);\n w *= i;\n b *= i;\n }\n for (i = 0; i < 3; i++) {\n rgb[i] *= 1 - w - b;\n rgb[i] += w;\n }\n return rgb;\n}\nfunction hueValue(r, g, b, d, max) {\n if (r === max) {\n return ((g - b) / d) + (g < b ? 6 : 0);\n }\n if (g === max) {\n return (b - r) / d + 2;\n }\n return (r - g) / d + 4;\n}\nfunction rgb2hsl(v) {\n const range = 255;\n const r = v.r / range;\n const g = v.g / range;\n const b = v.b / range;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const l = (max + min) / 2;\n let h, s, d;\n if (max !== min) {\n d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n h = hueValue(r, g, b, d, max);\n h = h * 60 + 0.5;\n }\n return [h | 0, s || 0, l];\n}\nfunction calln(f, a, b, c) {\n return (\n Array.isArray(a)\n ? f(a[0], a[1], a[2])\n : f(a, b, c)\n ).map(n2b);\n}\nfunction hsl2rgb(h, s, l) {\n return calln(hsl2rgbn, h, s, l);\n}\nfunction hwb2rgb(h, w, b) {\n return calln(hwb2rgbn, h, w, b);\n}\nfunction hsv2rgb(h, s, v) {\n return calln(hsv2rgbn, h, s, v);\n}\nfunction hue(h) {\n return (h % 360 + 360) % 360;\n}\nfunction hueParse(str) {\n const m = HUE_RE.exec(str);\n let a = 255;\n let v;\n if (!m) {\n return;\n }\n if (m[5] !== v) {\n a = m[6] ? p2b(+m[5]) : n2b(+m[5]);\n }\n const h = hue(+m[2]);\n const p1 = +m[3] / 100;\n const p2 = +m[4] / 100;\n if (m[1] === 'hwb') {\n v = hwb2rgb(h, p1, p2);\n } else if (m[1] === 'hsv') {\n v = hsv2rgb(h, p1, p2);\n } else {\n v = hsl2rgb(h, p1, p2);\n }\n return {\n r: v[0],\n g: v[1],\n b: v[2],\n a: a\n };\n}\nfunction rotate(v, deg) {\n var h = rgb2hsl(v);\n h[0] = hue(h[0] + deg);\n h = hsl2rgb(h);\n v.r = h[0];\n v.g = h[1];\n v.b = h[2];\n}\nfunction hslString(v) {\n if (!v) {\n return;\n }\n const a = rgb2hsl(v);\n const h = a[0];\n const s = n2p(a[1]);\n const l = n2p(a[2]);\n return v.a < 255\n ? `hsla(${h}, ${s}%, ${l}%, ${b2n(v.a)})`\n : `hsl(${h}, ${s}%, ${l}%)`;\n}\n\nconst map = {\n x: 'dark',\n Z: 'light',\n Y: 're',\n X: 'blu',\n W: 'gr',\n V: 'medium',\n U: 'slate',\n A: 'ee',\n T: 'ol',\n S: 'or',\n B: 'ra',\n C: 'lateg',\n D: 'ights',\n R: 'in',\n Q: 'turquois',\n E: 'hi',\n P: 'ro',\n O: 'al',\n N: 'le',\n M: 'de',\n L: 'yello',\n F: 'en',\n K: 'ch',\n G: 'arks',\n H: 'ea',\n I: 'ightg',\n J: 'wh'\n};\nconst names$1 = {\n OiceXe: 'f0f8ff',\n antiquewEte: 'faebd7',\n aqua: 'ffff',\n aquamarRe: '7fffd4',\n azuY: 'f0ffff',\n beige: 'f5f5dc',\n bisque: 'ffe4c4',\n black: '0',\n blanKedOmond: 'ffebcd',\n Xe: 'ff',\n XeviTet: '8a2be2',\n bPwn: 'a52a2a',\n burlywood: 'deb887',\n caMtXe: '5f9ea0',\n KartYuse: '7fff00',\n KocTate: 'd2691e',\n cSO: 'ff7f50',\n cSnflowerXe: '6495ed',\n cSnsilk: 'fff8dc',\n crimson: 'dc143c',\n cyan: 'ffff',\n xXe: '8b',\n xcyan: '8b8b',\n xgTMnPd: 'b8860b',\n xWay: 'a9a9a9',\n xgYF: '6400',\n xgYy: 'a9a9a9',\n xkhaki: 'bdb76b',\n xmagFta: '8b008b',\n xTivegYF: '556b2f',\n xSange: 'ff8c00',\n xScEd: '9932cc',\n xYd: '8b0000',\n xsOmon: 'e9967a',\n xsHgYF: '8fbc8f',\n xUXe: '483d8b',\n xUWay: '2f4f4f',\n xUgYy: '2f4f4f',\n xQe: 'ced1',\n xviTet: '9400d3',\n dAppRk: 'ff1493',\n dApskyXe: 'bfff',\n dimWay: '696969',\n dimgYy: '696969',\n dodgerXe: '1e90ff',\n fiYbrick: 'b22222',\n flSOwEte: 'fffaf0',\n foYstWAn: '228b22',\n fuKsia: 'ff00ff',\n gaRsbSo: 'dcdcdc',\n ghostwEte: 'f8f8ff',\n gTd: 'ffd700',\n gTMnPd: 'daa520',\n Way: '808080',\n gYF: '8000',\n gYFLw: 'adff2f',\n gYy: '808080',\n honeyMw: 'f0fff0',\n hotpRk: 'ff69b4',\n RdianYd: 'cd5c5c',\n Rdigo: '4b0082',\n ivSy: 'fffff0',\n khaki: 'f0e68c',\n lavFMr: 'e6e6fa',\n lavFMrXsh: 'fff0f5',\n lawngYF: '7cfc00',\n NmoncEffon: 'fffacd',\n ZXe: 'add8e6',\n ZcSO: 'f08080',\n Zcyan: 'e0ffff',\n ZgTMnPdLw: 'fafad2',\n ZWay: 'd3d3d3',\n ZgYF: '90ee90',\n ZgYy: 'd3d3d3',\n ZpRk: 'ffb6c1',\n ZsOmon: 'ffa07a',\n ZsHgYF: '20b2aa',\n ZskyXe: '87cefa',\n ZUWay: '778899',\n ZUgYy: '778899',\n ZstAlXe: 'b0c4de',\n ZLw: 'ffffe0',\n lime: 'ff00',\n limegYF: '32cd32',\n lRF: 'faf0e6',\n magFta: 'ff00ff',\n maPon: '800000',\n VaquamarRe: '66cdaa',\n VXe: 'cd',\n VScEd: 'ba55d3',\n VpurpN: '9370db',\n VsHgYF: '3cb371',\n VUXe: '7b68ee',\n VsprRggYF: 'fa9a',\n VQe: '48d1cc',\n VviTetYd: 'c71585',\n midnightXe: '191970',\n mRtcYam: 'f5fffa',\n mistyPse: 'ffe4e1',\n moccasR: 'ffe4b5',\n navajowEte: 'ffdead',\n navy: '80',\n Tdlace: 'fdf5e6',\n Tive: '808000',\n TivedBb: '6b8e23',\n Sange: 'ffa500',\n SangeYd: 'ff4500',\n ScEd: 'da70d6',\n pOegTMnPd: 'eee8aa',\n pOegYF: '98fb98',\n pOeQe: 'afeeee',\n pOeviTetYd: 'db7093',\n papayawEp: 'ffefd5',\n pHKpuff: 'ffdab9',\n peru: 'cd853f',\n pRk: 'ffc0cb',\n plum: 'dda0dd',\n powMrXe: 'b0e0e6',\n purpN: '800080',\n YbeccapurpN: '663399',\n Yd: 'ff0000',\n Psybrown: 'bc8f8f',\n PyOXe: '4169e1',\n saddNbPwn: '8b4513',\n sOmon: 'fa8072',\n sandybPwn: 'f4a460',\n sHgYF: '2e8b57',\n sHshell: 'fff5ee',\n siFna: 'a0522d',\n silver: 'c0c0c0',\n skyXe: '87ceeb',\n UXe: '6a5acd',\n UWay: '708090',\n UgYy: '708090',\n snow: 'fffafa',\n sprRggYF: 'ff7f',\n stAlXe: '4682b4',\n tan: 'd2b48c',\n teO: '8080',\n tEstN: 'd8bfd8',\n tomato: 'ff6347',\n Qe: '40e0d0',\n viTet: 'ee82ee',\n JHt: 'f5deb3',\n wEte: 'ffffff',\n wEtesmoke: 'f5f5f5',\n Lw: 'ffff00',\n LwgYF: '9acd32'\n};\nfunction unpack() {\n const unpacked = {};\n const keys = Object.keys(names$1);\n const tkeys = Object.keys(map);\n let i, j, k, ok, nk;\n for (i = 0; i < keys.length; i++) {\n ok = nk = keys[i];\n for (j = 0; j < tkeys.length; j++) {\n k = tkeys[j];\n nk = nk.replace(k, map[k]);\n }\n k = parseInt(names$1[ok], 16);\n unpacked[nk] = [k >> 16 & 0xFF, k >> 8 & 0xFF, k & 0xFF];\n }\n return unpacked;\n}\n\nlet names;\nfunction nameParse(str) {\n if (!names) {\n names = unpack();\n names.transparent = [0, 0, 0, 0];\n }\n const a = names[str.toLowerCase()];\n return a && {\n r: a[0],\n g: a[1],\n b: a[2],\n a: a.length === 4 ? a[3] : 255\n };\n}\n\nconst RGB_RE = /^rgba?\\(\\s*([-+.\\d]+)(%)?[\\s,]+([-+.e\\d]+)(%)?[\\s,]+([-+.e\\d]+)(%)?(?:[\\s,/]+([-+.e\\d]+)(%)?)?\\s*\\)$/;\nfunction rgbParse(str) {\n const m = RGB_RE.exec(str);\n let a = 255;\n let r, g, b;\n if (!m) {\n return;\n }\n if (m[7] !== r) {\n const v = +m[7];\n a = m[8] ? p2b(v) : lim(v * 255, 0, 255);\n }\n r = +m[1];\n g = +m[3];\n b = +m[5];\n r = 255 & (m[2] ? p2b(r) : lim(r, 0, 255));\n g = 255 & (m[4] ? p2b(g) : lim(g, 0, 255));\n b = 255 & (m[6] ? p2b(b) : lim(b, 0, 255));\n return {\n r: r,\n g: g,\n b: b,\n a: a\n };\n}\nfunction rgbString(v) {\n return v && (\n v.a < 255\n ? `rgba(${v.r}, ${v.g}, ${v.b}, ${b2n(v.a)})`\n : `rgb(${v.r}, ${v.g}, ${v.b})`\n );\n}\n\nconst to = v => v <= 0.0031308 ? v * 12.92 : Math.pow(v, 1.0 / 2.4) * 1.055 - 0.055;\nconst from = v => v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);\nfunction interpolate(rgb1, rgb2, t) {\n const r = from(b2n(rgb1.r));\n const g = from(b2n(rgb1.g));\n const b = from(b2n(rgb1.b));\n return {\n r: n2b(to(r + t * (from(b2n(rgb2.r)) - r))),\n g: n2b(to(g + t * (from(b2n(rgb2.g)) - g))),\n b: n2b(to(b + t * (from(b2n(rgb2.b)) - b))),\n a: rgb1.a + t * (rgb2.a - rgb1.a)\n };\n}\n\nfunction modHSL(v, i, ratio) {\n if (v) {\n let tmp = rgb2hsl(v);\n tmp[i] = Math.max(0, Math.min(tmp[i] + tmp[i] * ratio, i === 0 ? 360 : 1));\n tmp = hsl2rgb(tmp);\n v.r = tmp[0];\n v.g = tmp[1];\n v.b = tmp[2];\n }\n}\nfunction clone(v, proto) {\n return v ? Object.assign(proto || {}, v) : v;\n}\nfunction fromObject(input) {\n var v = {r: 0, g: 0, b: 0, a: 255};\n if (Array.isArray(input)) {\n if (input.length >= 3) {\n v = {r: input[0], g: input[1], b: input[2], a: 255};\n if (input.length > 3) {\n v.a = n2b(input[3]);\n }\n }\n } else {\n v = clone(input, {r: 0, g: 0, b: 0, a: 1});\n v.a = n2b(v.a);\n }\n return v;\n}\nfunction functionParse(str) {\n if (str.charAt(0) === 'r') {\n return rgbParse(str);\n }\n return hueParse(str);\n}\nclass Color {\n constructor(input) {\n if (input instanceof Color) {\n return input;\n }\n const type = typeof input;\n let v;\n if (type === 'object') {\n v = fromObject(input);\n } else if (type === 'string') {\n v = hexParse(input) || nameParse(input) || functionParse(input);\n }\n this._rgb = v;\n this._valid = !!v;\n }\n get valid() {\n return this._valid;\n }\n get rgb() {\n var v = clone(this._rgb);\n if (v) {\n v.a = b2n(v.a);\n }\n return v;\n }\n set rgb(obj) {\n this._rgb = fromObject(obj);\n }\n rgbString() {\n return this._valid ? rgbString(this._rgb) : undefined;\n }\n hexString() {\n return this._valid ? hexString(this._rgb) : undefined;\n }\n hslString() {\n return this._valid ? hslString(this._rgb) : undefined;\n }\n mix(color, weight) {\n if (color) {\n const c1 = this.rgb;\n const c2 = color.rgb;\n let w2;\n const p = weight === w2 ? 0.5 : weight;\n const w = 2 * p - 1;\n const a = c1.a - c2.a;\n const w1 = ((w * a === -1 ? w : (w + a) / (1 + w * a)) + 1) / 2.0;\n w2 = 1 - w1;\n c1.r = 0xFF & w1 * c1.r + w2 * c2.r + 0.5;\n c1.g = 0xFF & w1 * c1.g + w2 * c2.g + 0.5;\n c1.b = 0xFF & w1 * c1.b + w2 * c2.b + 0.5;\n c1.a = p * c1.a + (1 - p) * c2.a;\n this.rgb = c1;\n }\n return this;\n }\n interpolate(color, t) {\n if (color) {\n this._rgb = interpolate(this._rgb, color._rgb, t);\n }\n return this;\n }\n clone() {\n return new Color(this.rgb);\n }\n alpha(a) {\n this._rgb.a = n2b(a);\n return this;\n }\n clearer(ratio) {\n const rgb = this._rgb;\n rgb.a *= 1 - ratio;\n return this;\n }\n greyscale() {\n const rgb = this._rgb;\n const val = round(rgb.r * 0.3 + rgb.g * 0.59 + rgb.b * 0.11);\n rgb.r = rgb.g = rgb.b = val;\n return this;\n }\n opaquer(ratio) {\n const rgb = this._rgb;\n rgb.a *= 1 + ratio;\n return this;\n }\n negate() {\n const v = this._rgb;\n v.r = 255 - v.r;\n v.g = 255 - v.g;\n v.b = 255 - v.b;\n return this;\n }\n lighten(ratio) {\n modHSL(this._rgb, 2, ratio);\n return this;\n }\n darken(ratio) {\n modHSL(this._rgb, 2, -ratio);\n return this;\n }\n saturate(ratio) {\n modHSL(this._rgb, 1, ratio);\n return this;\n }\n desaturate(ratio) {\n modHSL(this._rgb, 1, -ratio);\n return this;\n }\n rotate(deg) {\n rotate(this._rgb, deg);\n return this;\n }\n}\n\nfunction index_esm(input) {\n return new Color(input);\n}\n\nexport { Color, b2n, b2p, index_esm as default, hexParse, hexString, hsl2rgb, hslString, hsv2rgb, hueParse, hwb2rgb, lim, n2b, n2p, nameParse, p2b, rgb2hsl, rgbParse, rgbString, rotate, round };\n", "/**\n * @namespace Chart.helpers\n */\n\nimport type {AnyObject} from '../types/basic.js';\nimport type {ActiveDataPoint, ChartEvent} from '../types/index.js';\n\n/**\n * An empty function that can be used, for example, for optional callback.\n */\nexport function noop() {\n /* noop */\n}\n\n/**\n * Returns a unique id, sequentially generated from a global variable.\n */\nexport const uid = (() => {\n let id = 0;\n return () => id++;\n})();\n\n/**\n * Returns true if `value` is neither null nor undefined, else returns false.\n * @param value - The value to test.\n * @since 2.7.0\n */\nexport function isNullOrUndef(value: unknown): value is null | undefined {\n return value === null || value === undefined;\n}\n\n/**\n * Returns true if `value` is an array (including typed arrays), else returns false.\n * @param value - The value to test.\n * @function\n */\nexport function isArray(value: unknown): value is T[] {\n if (Array.isArray && Array.isArray(value)) {\n return true;\n }\n const type = Object.prototype.toString.call(value);\n if (type.slice(0, 7) === '[object' && type.slice(-6) === 'Array]') {\n return true;\n }\n return false;\n}\n\n/**\n * Returns true if `value` is an object (excluding null), else returns false.\n * @param value - The value to test.\n * @since 2.7.0\n */\nexport function isObject(value: unknown): value is AnyObject {\n return value !== null && Object.prototype.toString.call(value) === '[object Object]';\n}\n\n/**\n * Returns true if `value` is a finite number, else returns false\n * @param value - The value to test.\n */\nfunction isNumberFinite(value: unknown): value is number {\n return (typeof value === 'number' || value instanceof Number) && isFinite(+value);\n}\nexport {\n isNumberFinite as isFinite,\n};\n\n/**\n * Returns `value` if finite, else returns `defaultValue`.\n * @param value - The value to return if defined.\n * @param defaultValue - The value to return if `value` is not finite.\n */\nexport function finiteOrDefault(value: unknown, defaultValue: number) {\n return isNumberFinite(value) ? value : defaultValue;\n}\n\n/**\n * Returns `value` if defined, else returns `defaultValue`.\n * @param value - The value to return if defined.\n * @param defaultValue - The value to return if `value` is undefined.\n */\nexport function valueOrDefault(value: T | undefined, defaultValue: T) {\n return typeof value === 'undefined' ? defaultValue : value;\n}\n\nexport const toPercentage = (value: number | string, dimension: number) =>\n typeof value === 'string' && value.endsWith('%') ?\n parseFloat(value) / 100\n : +value / dimension;\n\nexport const toDimension = (value: number | string, dimension: number) =>\n typeof value === 'string' && value.endsWith('%') ?\n parseFloat(value) / 100 * dimension\n : +value;\n\n/**\n * Calls `fn` with the given `args` in the scope defined by `thisArg` and returns the\n * value returned by `fn`. If `fn` is not a function, this method returns undefined.\n * @param fn - The function to call.\n * @param args - The arguments with which `fn` should be called.\n * @param [thisArg] - The value of `this` provided for the call to `fn`.\n */\nexport function callback R, TA, R>(\n fn: T | undefined,\n args: unknown[],\n thisArg?: TA\n): R | undefined {\n if (fn && typeof fn.call === 'function') {\n return fn.apply(thisArg, args);\n }\n}\n\n/**\n * Note(SB) for performance sake, this method should only be used when loopable type\n * is unknown or in none intensive code (not called often and small loopable). Else\n * it's preferable to use a regular for() loop and save extra function calls.\n * @param loopable - The object or array to be iterated.\n * @param fn - The function to call for each item.\n * @param [thisArg] - The value of `this` provided for the call to `fn`.\n * @param [reverse] - If true, iterates backward on the loopable.\n */\nexport function each(\n loopable: Record,\n fn: (this: TA, v: T, i: string) => void,\n thisArg?: TA,\n reverse?: boolean\n): void;\nexport function each(\n loopable: T[],\n fn: (this: TA, v: T, i: number) => void,\n thisArg?: TA,\n reverse?: boolean\n): void;\nexport function each(\n loopable: T[] | Record,\n fn: (this: TA, v: T, i: any) => void,\n thisArg?: TA,\n reverse?: boolean\n) {\n let i: number, len: number, keys: string[];\n if (isArray(loopable)) {\n len = loopable.length;\n if (reverse) {\n for (i = len - 1; i >= 0; i--) {\n fn.call(thisArg, loopable[i], i);\n }\n } else {\n for (i = 0; i < len; i++) {\n fn.call(thisArg, loopable[i], i);\n }\n }\n } else if (isObject(loopable)) {\n keys = Object.keys(loopable);\n len = keys.length;\n for (i = 0; i < len; i++) {\n fn.call(thisArg, loopable[keys[i]], keys[i]);\n }\n }\n}\n\n/**\n * Returns true if the `a0` and `a1` arrays have the same content, else returns false.\n * @param a0 - The array to compare\n * @param a1 - The array to compare\n * @private\n */\nexport function _elementsEqual(a0: ActiveDataPoint[], a1: ActiveDataPoint[]) {\n let i: number, ilen: number, v0: ActiveDataPoint, v1: ActiveDataPoint;\n\n if (!a0 || !a1 || a0.length !== a1.length) {\n return false;\n }\n\n for (i = 0, ilen = a0.length; i < ilen; ++i) {\n v0 = a0[i];\n v1 = a1[i];\n\n if (v0.datasetIndex !== v1.datasetIndex || v0.index !== v1.index) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Returns a deep copy of `source` without keeping references on objects and arrays.\n * @param source - The value to clone.\n */\nexport function clone(source: T): T {\n if (isArray(source)) {\n return source.map(clone) as unknown as T;\n }\n\n if (isObject(source)) {\n const target = Object.create(null);\n const keys = Object.keys(source);\n const klen = keys.length;\n let k = 0;\n\n for (; k < klen; ++k) {\n target[keys[k]] = clone(source[keys[k]]);\n }\n\n return target;\n }\n\n return source;\n}\n\nfunction isValidKey(key: string) {\n return ['__proto__', 'prototype', 'constructor'].indexOf(key) === -1;\n}\n\n/**\n * The default merger when Chart.helpers.merge is called without merger option.\n * Note(SB): also used by mergeConfig and mergeScaleConfig as fallback.\n * @private\n */\nexport function _merger(key: string, target: AnyObject, source: AnyObject, options: AnyObject) {\n if (!isValidKey(key)) {\n return;\n }\n\n const tval = target[key];\n const sval = source[key];\n\n if (isObject(tval) && isObject(sval)) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n merge(tval, sval, options);\n } else {\n target[key] = clone(sval);\n }\n}\n\nexport interface MergeOptions {\n merger?: (key: string, target: AnyObject, source: AnyObject, options?: AnyObject) => void;\n}\n\n/**\n * Recursively deep copies `source` properties into `target` with the given `options`.\n * IMPORTANT: `target` is not cloned and will be updated with `source` properties.\n * @param target - The target object in which all sources are merged into.\n * @param source - Object(s) to merge into `target`.\n * @param [options] - Merging options:\n * @param [options.merger] - The merge method (key, target, source, options)\n * @returns The `target` object.\n */\nexport function merge(target: T, source: [], options?: MergeOptions): T;\nexport function merge(target: T, source: S1, options?: MergeOptions): T & S1;\nexport function merge(target: T, source: [S1], options?: MergeOptions): T & S1;\nexport function merge(target: T, source: [S1, S2], options?: MergeOptions): T & S1 & S2;\nexport function merge(target: T, source: [S1, S2, S3], options?: MergeOptions): T & S1 & S2 & S3;\nexport function merge(\n target: T,\n source: [S1, S2, S3, S4],\n options?: MergeOptions\n): T & S1 & S2 & S3 & S4;\nexport function merge(target: T, source: AnyObject[], options?: MergeOptions): AnyObject;\nexport function merge(target: T, source: AnyObject[], options?: MergeOptions): AnyObject {\n const sources = isArray(source) ? source : [source];\n const ilen = sources.length;\n\n if (!isObject(target)) {\n return target as AnyObject;\n }\n\n options = options || {};\n const merger = options.merger || _merger;\n let current: AnyObject;\n\n for (let i = 0; i < ilen; ++i) {\n current = sources[i];\n if (!isObject(current)) {\n continue;\n }\n\n const keys = Object.keys(current);\n for (let k = 0, klen = keys.length; k < klen; ++k) {\n merger(keys[k], target, current, options as AnyObject);\n }\n }\n\n return target;\n}\n\n/**\n * Recursively deep copies `source` properties into `target` *only* if not defined in target.\n * IMPORTANT: `target` is not cloned and will be updated with `source` properties.\n * @param target - The target object in which all sources are merged into.\n * @param source - Object(s) to merge into `target`.\n * @returns The `target` object.\n */\nexport function mergeIf(target: T, source: []): T;\nexport function mergeIf(target: T, source: S1): T & S1;\nexport function mergeIf(target: T, source: [S1]): T & S1;\nexport function mergeIf(target: T, source: [S1, S2]): T & S1 & S2;\nexport function mergeIf(target: T, source: [S1, S2, S3]): T & S1 & S2 & S3;\nexport function mergeIf(target: T, source: [S1, S2, S3, S4]): T & S1 & S2 & S3 & S4;\nexport function mergeIf(target: T, source: AnyObject[]): AnyObject;\nexport function mergeIf(target: T, source: AnyObject[]): AnyObject {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return merge(target, source, {merger: _mergerIf});\n}\n\n/**\n * Merges source[key] in target[key] only if target[key] is undefined.\n * @private\n */\nexport function _mergerIf(key: string, target: AnyObject, source: AnyObject) {\n if (!isValidKey(key)) {\n return;\n }\n\n const tval = target[key];\n const sval = source[key];\n\n if (isObject(tval) && isObject(sval)) {\n mergeIf(tval, sval);\n } else if (!Object.prototype.hasOwnProperty.call(target, key)) {\n target[key] = clone(sval);\n }\n}\n\n/**\n * @private\n */\nexport function _deprecated(scope: string, value: unknown, previous: string, current: string) {\n if (value !== undefined) {\n console.warn(scope + ': \"' + previous +\n '\" is deprecated. Please use \"' + current + '\" instead');\n }\n}\n\n// resolveObjectKey resolver cache\nconst keyResolvers = {\n // Chart.helpers.core resolveObjectKey should resolve empty key to root object\n '': v => v,\n // default resolvers\n x: o => o.x,\n y: o => o.y\n};\n\n/**\n * @private\n */\nexport function _splitKey(key: string) {\n const parts = key.split('.');\n const keys: string[] = [];\n let tmp = '';\n for (const part of parts) {\n tmp += part;\n if (tmp.endsWith('\\\\')) {\n tmp = tmp.slice(0, -1) + '.';\n } else {\n keys.push(tmp);\n tmp = '';\n }\n }\n return keys;\n}\n\nfunction _getKeyResolver(key: string) {\n const keys = _splitKey(key);\n return obj => {\n for (const k of keys) {\n if (k === '') {\n // For backward compatibility:\n // Chart.helpers.core resolveObjectKey should break at empty key\n break;\n }\n obj = obj && obj[k];\n }\n return obj;\n };\n}\n\nexport function resolveObjectKey(obj: AnyObject, key: string): any {\n const resolver = keyResolvers[key] || (keyResolvers[key] = _getKeyResolver(key));\n return resolver(obj);\n}\n\n/**\n * @private\n */\nexport function _capitalize(str: string) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\n\nexport const defined = (value: unknown) => typeof value !== 'undefined';\n\nexport const isFunction = (value: unknown): value is (...args: any[]) => any => typeof value === 'function';\n\n// Adapted from https://stackoverflow.com/questions/31128855/comparing-ecma6-sets-for-equality#31129384\nexport const setsEqual = (a: Set, b: Set) => {\n if (a.size !== b.size) {\n return false;\n }\n\n for (const item of a) {\n if (!b.has(item)) {\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * @param e - The event\n * @private\n */\nexport function _isClickEvent(e: ChartEvent) {\n return e.type === 'mouseup' || e.type === 'click' || e.type === 'contextmenu';\n}\n", "import type {Point} from '../types/geometric.js';\nimport {isFinite as isFiniteNumber} from './helpers.core.js';\n\n/**\n * @alias Chart.helpers.math\n * @namespace\n */\n\nexport const PI = Math.PI;\nexport const TAU = 2 * PI;\nexport const PITAU = TAU + PI;\nexport const INFINITY = Number.POSITIVE_INFINITY;\nexport const RAD_PER_DEG = PI / 180;\nexport const HALF_PI = PI / 2;\nexport const QUARTER_PI = PI / 4;\nexport const TWO_THIRDS_PI = PI * 2 / 3;\n\nexport const log10 = Math.log10;\nexport const sign = Math.sign;\n\nexport function almostEquals(x: number, y: number, epsilon: number) {\n return Math.abs(x - y) < epsilon;\n}\n\n/**\n * Implementation of the nice number algorithm used in determining where axis labels will go\n */\nexport function niceNum(range: number) {\n const roundedRange = Math.round(range);\n range = almostEquals(range, roundedRange, range / 1000) ? roundedRange : range;\n const niceRange = Math.pow(10, Math.floor(log10(range)));\n const fraction = range / niceRange;\n const niceFraction = fraction <= 1 ? 1 : fraction <= 2 ? 2 : fraction <= 5 ? 5 : 10;\n return niceFraction * niceRange;\n}\n\n/**\n * Returns an array of factors sorted from 1 to sqrt(value)\n * @private\n */\nexport function _factorize(value: number) {\n const result: number[] = [];\n const sqrt = Math.sqrt(value);\n let i: number;\n\n for (i = 1; i < sqrt; i++) {\n if (value % i === 0) {\n result.push(i);\n result.push(value / i);\n }\n }\n if (sqrt === (sqrt | 0)) { // if value is a square number\n result.push(sqrt);\n }\n\n result.sort((a, b) => a - b).pop();\n return result;\n}\n\n/**\n * Verifies that attempting to coerce n to string or number won't throw a TypeError.\n */\nfunction isNonPrimitive(n: unknown) {\n return typeof n === 'symbol' || (typeof n === 'object' && n !== null && !(Symbol.toPrimitive in n || 'toString' in n || 'valueOf' in n));\n}\n\nexport function isNumber(n: unknown): n is number {\n return !isNonPrimitive(n) && !isNaN(parseFloat(n as string)) && isFinite(n as number);\n}\n\nexport function almostWhole(x: number, epsilon: number) {\n const rounded = Math.round(x);\n return ((rounded - epsilon) <= x) && ((rounded + epsilon) >= x);\n}\n\n/**\n * @private\n */\nexport function _setMinAndMaxByKey(\n array: Record[],\n target: { min: number, max: number },\n property: string\n) {\n let i: number, ilen: number, value: number;\n\n for (i = 0, ilen = array.length; i < ilen; i++) {\n value = array[i][property];\n if (!isNaN(value)) {\n target.min = Math.min(target.min, value);\n target.max = Math.max(target.max, value);\n }\n }\n}\n\nexport function toRadians(degrees: number) {\n return degrees * (PI / 180);\n}\n\nexport function toDegrees(radians: number) {\n return radians * (180 / PI);\n}\n\n/**\n * Returns the number of decimal places\n * i.e. the number of digits after the decimal point, of the value of this Number.\n * @param x - A number.\n * @returns The number of decimal places.\n * @private\n */\nexport function _decimalPlaces(x: number) {\n if (!isFiniteNumber(x)) {\n return;\n }\n let e = 1;\n let p = 0;\n while (Math.round(x * e) / e !== x) {\n e *= 10;\n p++;\n }\n return p;\n}\n\n// Gets the angle from vertical upright to the point about a centre.\nexport function getAngleFromPoint(\n centrePoint: Point,\n anglePoint: Point\n) {\n const distanceFromXCenter = anglePoint.x - centrePoint.x;\n const distanceFromYCenter = anglePoint.y - centrePoint.y;\n const radialDistanceFromCenter = Math.sqrt(distanceFromXCenter * distanceFromXCenter + distanceFromYCenter * distanceFromYCenter);\n\n let angle = Math.atan2(distanceFromYCenter, distanceFromXCenter);\n\n if (angle < (-0.5 * PI)) {\n angle += TAU; // make sure the returned angle is in the range of (-PI/2, 3PI/2]\n }\n\n return {\n angle,\n distance: radialDistanceFromCenter\n };\n}\n\nexport function distanceBetweenPoints(pt1: Point, pt2: Point) {\n return Math.sqrt(Math.pow(pt2.x - pt1.x, 2) + Math.pow(pt2.y - pt1.y, 2));\n}\n\n/**\n * Shortest distance between angles, in either direction.\n * @private\n */\nexport function _angleDiff(a: number, b: number) {\n return (a - b + PITAU) % TAU - PI;\n}\n\n/**\n * Normalize angle to be between 0 and 2*PI\n * @private\n */\nexport function _normalizeAngle(a: number) {\n return (a % TAU + TAU) % TAU;\n}\n\n/**\n * @private\n */\nexport function _angleBetween(angle: number, start: number, end: number, sameAngleIsFullCircle?: boolean) {\n const a = _normalizeAngle(angle);\n const s = _normalizeAngle(start);\n const e = _normalizeAngle(end);\n const angleToStart = _normalizeAngle(s - a);\n const angleToEnd = _normalizeAngle(e - a);\n const startToAngle = _normalizeAngle(a - s);\n const endToAngle = _normalizeAngle(a - e);\n return a === s || a === e || (sameAngleIsFullCircle && s === e)\n || (angleToStart > angleToEnd && startToAngle < endToAngle);\n}\n\n/**\n * Limit `value` between `min` and `max`\n * @param value\n * @param min\n * @param max\n * @private\n */\nexport function _limitValue(value: number, min: number, max: number) {\n return Math.max(min, Math.min(max, value));\n}\n\n/**\n * @param {number} value\n * @private\n */\nexport function _int16Range(value: number) {\n return _limitValue(value, -32768, 32767);\n}\n\n/**\n * @param value\n * @param start\n * @param end\n * @param [epsilon]\n * @private\n */\nexport function _isBetween(value: number, start: number, end: number, epsilon = 1e-6) {\n return value >= Math.min(start, end) - epsilon && value <= Math.max(start, end) + epsilon;\n}\n", "import {_capitalize} from './helpers.core.js';\n\n/**\n * Binary search\n * @param table - the table search. must be sorted!\n * @param value - value to find\n * @param cmp\n * @private\n */\nexport function _lookup(\n table: number[],\n value: number,\n cmp?: (value: number) => boolean\n): {lo: number, hi: number};\nexport function _lookup(\n table: T[],\n value: number,\n cmp: (value: number) => boolean\n): {lo: number, hi: number};\nexport function _lookup(\n table: unknown[],\n value: number,\n cmp?: (value: number) => boolean\n) {\n cmp = cmp || ((index) => table[index] < value);\n let hi = table.length - 1;\n let lo = 0;\n let mid: number;\n\n while (hi - lo > 1) {\n mid = (lo + hi) >> 1;\n if (cmp(mid)) {\n lo = mid;\n } else {\n hi = mid;\n }\n }\n\n return {lo, hi};\n}\n\n/**\n * Binary search\n * @param table - the table search. must be sorted!\n * @param key - property name for the value in each entry\n * @param value - value to find\n * @param last - lookup last index\n * @private\n */\nexport const _lookupByKey = (\n table: Record[],\n key: string,\n value: number,\n last?: boolean\n) =>\n _lookup(table, value, last\n ? index => {\n const ti = table[index][key];\n return ti < value || ti === value && table[index + 1][key] === value;\n }\n : index => table[index][key] < value);\n\n/**\n * Reverse binary search\n * @param table - the table search. must be sorted!\n * @param key - property name for the value in each entry\n * @param value - value to find\n * @private\n */\nexport const _rlookupByKey = (\n table: Record[],\n key: string,\n value: number\n) =>\n _lookup(table, value, index => table[index][key] >= value);\n\n/**\n * Return subset of `values` between `min` and `max` inclusive.\n * Values are assumed to be in sorted order.\n * @param values - sorted array of values\n * @param min - min value\n * @param max - max value\n */\nexport function _filterBetween(values: number[], min: number, max: number) {\n let start = 0;\n let end = values.length;\n\n while (start < end && values[start] < min) {\n start++;\n }\n while (end > start && values[end - 1] > max) {\n end--;\n }\n\n return start > 0 || end < values.length\n ? values.slice(start, end)\n : values;\n}\n\nconst arrayEvents = ['push', 'pop', 'shift', 'splice', 'unshift'] as const;\n\nexport interface ArrayListener {\n _onDataPush?(...item: T[]): void;\n _onDataPop?(): void;\n _onDataShift?(): void;\n _onDataSplice?(index: number, deleteCount: number, ...items: T[]): void;\n _onDataUnshift?(...item: T[]): void;\n}\n\n/**\n * Hooks the array methods that add or remove values ('push', pop', 'shift', 'splice',\n * 'unshift') and notify the listener AFTER the array has been altered. Listeners are\n * called on the '_onData*' callbacks (e.g. _onDataPush, etc.) with same arguments.\n */\nexport function listenArrayEvents(array: T[], listener: ArrayListener): void;\nexport function listenArrayEvents(array, listener) {\n if (array._chartjs) {\n array._chartjs.listeners.push(listener);\n return;\n }\n\n Object.defineProperty(array, '_chartjs', {\n configurable: true,\n enumerable: false,\n value: {\n listeners: [listener]\n }\n });\n\n arrayEvents.forEach((key) => {\n const method = '_onData' + _capitalize(key);\n const base = array[key];\n\n Object.defineProperty(array, key, {\n configurable: true,\n enumerable: false,\n value(...args) {\n const res = base.apply(this, args);\n\n array._chartjs.listeners.forEach((object) => {\n if (typeof object[method] === 'function') {\n object[method](...args);\n }\n });\n\n return res;\n }\n });\n });\n}\n\n\n/**\n * Removes the given array event listener and cleanup extra attached properties (such as\n * the _chartjs stub and overridden methods) if array doesn't have any more listeners.\n */\nexport function unlistenArrayEvents(array: T[], listener: ArrayListener): void;\nexport function unlistenArrayEvents(array, listener) {\n const stub = array._chartjs;\n if (!stub) {\n return;\n }\n\n const listeners = stub.listeners;\n const index = listeners.indexOf(listener);\n if (index !== -1) {\n listeners.splice(index, 1);\n }\n\n if (listeners.length > 0) {\n return;\n }\n\n arrayEvents.forEach((key) => {\n delete array[key];\n });\n\n delete array._chartjs;\n}\n\n/**\n * @param items\n */\nexport function _arrayUnique(items: T[]) {\n const set = new Set(items);\n\n if (set.size === items.length) {\n return items;\n }\n\n return Array.from(set);\n}\n", "import type {ChartMeta, PointElement} from '../types/index.js';\n\nimport {_limitValue} from './helpers.math.js';\nimport {_lookupByKey} from './helpers.collection.js';\nimport {isNullOrUndef} from './helpers.core.js';\n\nexport function fontString(pixelSize: number, fontStyle: string, fontFamily: string) {\n return fontStyle + ' ' + pixelSize + 'px ' + fontFamily;\n}\n\n/**\n* Request animation polyfill\n*/\nexport const requestAnimFrame = (function() {\n if (typeof window === 'undefined') {\n return function(callback) {\n return callback();\n };\n }\n return window.requestAnimationFrame;\n}());\n\n/**\n * Throttles calling `fn` once per animation frame\n * Latest arguments are used on the actual call\n */\nexport function throttled>(\n fn: (...args: TArgs) => void,\n thisArg: any,\n) {\n let argsToUse = [] as TArgs;\n let ticking = false;\n\n return function(...args: TArgs) {\n // Save the args for use later\n argsToUse = args;\n if (!ticking) {\n ticking = true;\n requestAnimFrame.call(window, () => {\n ticking = false;\n fn.apply(thisArg, argsToUse);\n });\n }\n };\n}\n\n/**\n * Debounces calling `fn` for `delay` ms\n */\nexport function debounce>(fn: (...args: TArgs) => void, delay: number) {\n let timeout;\n return function(...args: TArgs) {\n if (delay) {\n clearTimeout(timeout);\n timeout = setTimeout(fn, delay, args);\n } else {\n fn.apply(this, args);\n }\n return delay;\n };\n}\n\n/**\n * Converts 'start' to 'left', 'end' to 'right' and others to 'center'\n * @private\n */\nexport const _toLeftRightCenter = (align: 'start' | 'end' | 'center') => align === 'start' ? 'left' : align === 'end' ? 'right' : 'center';\n\n/**\n * Returns `start`, `end` or `(start + end) / 2` depending on `align`. Defaults to `center`\n * @private\n */\nexport const _alignStartEnd = (align: 'start' | 'end' | 'center', start: number, end: number) => align === 'start' ? start : align === 'end' ? end : (start + end) / 2;\n\n/**\n * Returns `left`, `right` or `(left + right) / 2` depending on `align`. Defaults to `left`\n * @private\n */\nexport const _textX = (align: 'left' | 'right' | 'center', left: number, right: number, rtl: boolean) => {\n const check = rtl ? 'left' : 'right';\n return align === check ? right : align === 'center' ? (left + right) / 2 : left;\n};\n\n/**\n * Return start and count of visible points.\n * @private\n */\nexport function _getStartAndCountOfVisiblePoints(meta: ChartMeta<'line' | 'scatter'>, points: PointElement[], animationsDisabled: boolean) {\n const pointCount = points.length;\n\n let start = 0;\n let count = pointCount;\n\n if (meta._sorted) {\n const {iScale, vScale, _parsed} = meta;\n const spanGaps = meta.dataset ? meta.dataset.options ? meta.dataset.options.spanGaps : null : null;\n const axis = iScale.axis;\n const {min, max, minDefined, maxDefined} = iScale.getUserBounds();\n\n if (minDefined) {\n start = Math.min(\n // @ts-expect-error Need to type _parsed\n _lookupByKey(_parsed, axis, min).lo,\n // @ts-expect-error Need to fix types on _lookupByKey\n animationsDisabled ? pointCount : _lookupByKey(points, axis, iScale.getPixelForValue(min)).lo);\n if (spanGaps) {\n const distanceToDefinedLo = (_parsed\n .slice(0, start + 1)\n .reverse()\n .findIndex(\n point => !isNullOrUndef(point[vScale.axis])));\n start -= Math.max(0, distanceToDefinedLo);\n }\n start = _limitValue(start, 0, pointCount - 1);\n }\n if (maxDefined) {\n let end = Math.max(\n // @ts-expect-error Need to type _parsed\n _lookupByKey(_parsed, iScale.axis, max, true).hi + 1,\n // @ts-expect-error Need to fix types on _lookupByKey\n animationsDisabled ? 0 : _lookupByKey(points, axis, iScale.getPixelForValue(max), true).hi + 1);\n if (spanGaps) {\n const distanceToDefinedHi = (_parsed\n .slice(end - 1)\n .findIndex(\n point => !isNullOrUndef(point[vScale.axis])));\n end += Math.max(0, distanceToDefinedHi);\n }\n count = _limitValue(end, start, pointCount) - start;\n } else {\n count = pointCount - start;\n }\n }\n\n return {start, count};\n}\n\n/**\n * Checks if the scale ranges have changed.\n * @param {object} meta - dataset meta.\n * @returns {boolean}\n * @private\n */\nexport function _scaleRangesChanged(meta) {\n const {xScale, yScale, _scaleRanges} = meta;\n const newRanges = {\n xmin: xScale.min,\n xmax: xScale.max,\n ymin: yScale.min,\n ymax: yScale.max\n };\n if (!_scaleRanges) {\n meta._scaleRanges = newRanges;\n return true;\n }\n const changed = _scaleRanges.xmin !== xScale.min\n\t\t|| _scaleRanges.xmax !== xScale.max\n\t\t|| _scaleRanges.ymin !== yScale.min\n\t\t|| _scaleRanges.ymax !== yScale.max;\n\n Object.assign(_scaleRanges, newRanges);\n return changed;\n}\n", "import {PI, TAU, HALF_PI} from './helpers.math.js';\n\nconst atEdge = (t: number) => t === 0 || t === 1;\nconst elasticIn = (t: number, s: number, p: number) => -(Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * TAU / p));\nconst elasticOut = (t: number, s: number, p: number) => Math.pow(2, -10 * t) * Math.sin((t - s) * TAU / p) + 1;\n\n/**\n * Easing functions adapted from Robert Penner's easing equations.\n * @namespace Chart.helpers.easing.effects\n * @see http://www.robertpenner.com/easing/\n */\nconst effects = {\n linear: (t: number) => t,\n\n easeInQuad: (t: number) => t * t,\n\n easeOutQuad: (t: number) => -t * (t - 2),\n\n easeInOutQuad: (t: number) => ((t /= 0.5) < 1)\n ? 0.5 * t * t\n : -0.5 * ((--t) * (t - 2) - 1),\n\n easeInCubic: (t: number) => t * t * t,\n\n easeOutCubic: (t: number) => (t -= 1) * t * t + 1,\n\n easeInOutCubic: (t: number) => ((t /= 0.5) < 1)\n ? 0.5 * t * t * t\n : 0.5 * ((t -= 2) * t * t + 2),\n\n easeInQuart: (t: number) => t * t * t * t,\n\n easeOutQuart: (t: number) => -((t -= 1) * t * t * t - 1),\n\n easeInOutQuart: (t: number) => ((t /= 0.5) < 1)\n ? 0.5 * t * t * t * t\n : -0.5 * ((t -= 2) * t * t * t - 2),\n\n easeInQuint: (t: number) => t * t * t * t * t,\n\n easeOutQuint: (t: number) => (t -= 1) * t * t * t * t + 1,\n\n easeInOutQuint: (t: number) => ((t /= 0.5) < 1)\n ? 0.5 * t * t * t * t * t\n : 0.5 * ((t -= 2) * t * t * t * t + 2),\n\n easeInSine: (t: number) => -Math.cos(t * HALF_PI) + 1,\n\n easeOutSine: (t: number) => Math.sin(t * HALF_PI),\n\n easeInOutSine: (t: number) => -0.5 * (Math.cos(PI * t) - 1),\n\n easeInExpo: (t: number) => (t === 0) ? 0 : Math.pow(2, 10 * (t - 1)),\n\n easeOutExpo: (t: number) => (t === 1) ? 1 : -Math.pow(2, -10 * t) + 1,\n\n easeInOutExpo: (t: number) => atEdge(t) ? t : t < 0.5\n ? 0.5 * Math.pow(2, 10 * (t * 2 - 1))\n : 0.5 * (-Math.pow(2, -10 * (t * 2 - 1)) + 2),\n\n easeInCirc: (t: number) => (t >= 1) ? t : -(Math.sqrt(1 - t * t) - 1),\n\n easeOutCirc: (t: number) => Math.sqrt(1 - (t -= 1) * t),\n\n easeInOutCirc: (t: number) => ((t /= 0.5) < 1)\n ? -0.5 * (Math.sqrt(1 - t * t) - 1)\n : 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1),\n\n easeInElastic: (t: number) => atEdge(t) ? t : elasticIn(t, 0.075, 0.3),\n\n easeOutElastic: (t: number) => atEdge(t) ? t : elasticOut(t, 0.075, 0.3),\n\n easeInOutElastic(t: number) {\n const s = 0.1125;\n const p = 0.45;\n return atEdge(t) ? t :\n t < 0.5\n ? 0.5 * elasticIn(t * 2, s, p)\n : 0.5 + 0.5 * elasticOut(t * 2 - 1, s, p);\n },\n\n easeInBack(t: number) {\n const s = 1.70158;\n return t * t * ((s + 1) * t - s);\n },\n\n easeOutBack(t: number) {\n const s = 1.70158;\n return (t -= 1) * t * ((s + 1) * t + s) + 1;\n },\n\n easeInOutBack(t: number) {\n let s = 1.70158;\n if ((t /= 0.5) < 1) {\n return 0.5 * (t * t * (((s *= (1.525)) + 1) * t - s));\n }\n return 0.5 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2);\n },\n\n easeInBounce: (t: number) => 1 - effects.easeOutBounce(1 - t),\n\n easeOutBounce(t: number) {\n const m = 7.5625;\n const d = 2.75;\n if (t < (1 / d)) {\n return m * t * t;\n }\n if (t < (2 / d)) {\n return m * (t -= (1.5 / d)) * t + 0.75;\n }\n if (t < (2.5 / d)) {\n return m * (t -= (2.25 / d)) * t + 0.9375;\n }\n return m * (t -= (2.625 / d)) * t + 0.984375;\n },\n\n easeInOutBounce: (t: number) => (t < 0.5)\n ? effects.easeInBounce(t * 2) * 0.5\n : effects.easeOutBounce(t * 2 - 1) * 0.5 + 0.5,\n} as const;\n\nexport type EasingFunction = keyof typeof effects\n\nexport default effects;\n", "import {Color} from '@kurkle/color';\n\nexport function isPatternOrGradient(value: unknown): value is CanvasPattern | CanvasGradient {\n if (value && typeof value === 'object') {\n const type = value.toString();\n return type === '[object CanvasPattern]' || type === '[object CanvasGradient]';\n }\n\n return false;\n}\n\nexport function color(value: CanvasGradient): CanvasGradient;\nexport function color(value: CanvasPattern): CanvasPattern;\nexport function color(\n value:\n | string\n | { r: number; g: number; b: number; a: number }\n | [number, number, number]\n | [number, number, number, number]\n): Color;\nexport function color(value) {\n return isPatternOrGradient(value) ? value : new Color(value);\n}\n\nexport function getHoverColor(value: CanvasGradient): CanvasGradient;\nexport function getHoverColor(value: CanvasPattern): CanvasPattern;\nexport function getHoverColor(value: string): string;\nexport function getHoverColor(value) {\n return isPatternOrGradient(value)\n ? value\n : new Color(value).saturate(0.5).darken(0.1).hexString();\n}\n", "const numbers = ['x', 'y', 'borderWidth', 'radius', 'tension'];\nconst colors = ['color', 'borderColor', 'backgroundColor'];\n\nexport function applyAnimationsDefaults(defaults) {\n defaults.set('animation', {\n delay: undefined,\n duration: 1000,\n easing: 'easeOutQuart',\n fn: undefined,\n from: undefined,\n loop: undefined,\n to: undefined,\n type: undefined,\n });\n\n defaults.describe('animation', {\n _fallback: false,\n _indexable: false,\n _scriptable: (name) => name !== 'onProgress' && name !== 'onComplete' && name !== 'fn',\n });\n\n defaults.set('animations', {\n colors: {\n type: 'color',\n properties: colors\n },\n numbers: {\n type: 'number',\n properties: numbers\n },\n });\n\n defaults.describe('animations', {\n _fallback: 'animation',\n });\n\n defaults.set('transitions', {\n active: {\n animation: {\n duration: 400\n }\n },\n resize: {\n animation: {\n duration: 0\n }\n },\n show: {\n animations: {\n colors: {\n from: 'transparent'\n },\n visible: {\n type: 'boolean',\n duration: 0 // show immediately\n },\n }\n },\n hide: {\n animations: {\n colors: {\n to: 'transparent'\n },\n visible: {\n type: 'boolean',\n easing: 'linear',\n fn: v => v | 0 // for keeping the dataset visible all the way through the animation\n },\n }\n }\n });\n}\n", "export function applyLayoutsDefaults(defaults) {\n defaults.set('layout', {\n autoPadding: true,\n padding: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n }\n });\n}\n", "\nconst intlCache = new Map();\n\nfunction getNumberFormat(locale: string, options?: Intl.NumberFormatOptions) {\n options = options || {};\n const cacheKey = locale + JSON.stringify(options);\n let formatter = intlCache.get(cacheKey);\n if (!formatter) {\n formatter = new Intl.NumberFormat(locale, options);\n intlCache.set(cacheKey, formatter);\n }\n return formatter;\n}\n\nexport function formatNumber(num: number, locale: string, options?: Intl.NumberFormatOptions) {\n return getNumberFormat(locale, options).format(num);\n}\n", "import {isArray} from '../helpers/helpers.core.js';\nimport {formatNumber} from '../helpers/helpers.intl.js';\nimport {log10} from '../helpers/helpers.math.js';\n\n/**\n * Namespace to hold formatters for different types of ticks\n * @namespace Chart.Ticks.formatters\n */\nconst formatters = {\n /**\n * Formatter for value labels\n * @method Chart.Ticks.formatters.values\n * @param value the value to display\n * @return {string|string[]} the label to display\n */\n values(value) {\n return isArray(value) ? /** @type {string[]} */ (value) : '' + value;\n },\n\n /**\n * Formatter for numeric ticks\n * @method Chart.Ticks.formatters.numeric\n * @param tickValue {number} the value to be formatted\n * @param index {number} the position of the tickValue parameter in the ticks array\n * @param ticks {object[]} the list of ticks being converted\n * @return {string} string representation of the tickValue parameter\n */\n numeric(tickValue, index, ticks) {\n if (tickValue === 0) {\n return '0'; // never show decimal places for 0\n }\n\n const locale = this.chart.options.locale;\n let notation;\n let delta = tickValue; // This is used when there are less than 2 ticks as the tick interval.\n\n if (ticks.length > 1) {\n // all ticks are small or there huge numbers; use scientific notation\n const maxTick = Math.max(Math.abs(ticks[0].value), Math.abs(ticks[ticks.length - 1].value));\n if (maxTick < 1e-4 || maxTick > 1e+15) {\n notation = 'scientific';\n }\n\n delta = calculateDelta(tickValue, ticks);\n }\n\n const logDelta = log10(Math.abs(delta));\n\n // When datasets have values approaching Number.MAX_VALUE, the tick calculations might result in\n // infinity and eventually NaN. Passing NaN for minimumFractionDigits or maximumFractionDigits\n // will make the number formatter throw. So instead we check for isNaN and use a fallback value.\n //\n // toFixed has a max of 20 decimal places\n const numDecimal = isNaN(logDelta) ? 1 : Math.max(Math.min(-1 * Math.floor(logDelta), 20), 0);\n\n const options = {notation, minimumFractionDigits: numDecimal, maximumFractionDigits: numDecimal};\n Object.assign(options, this.options.ticks.format);\n\n return formatNumber(tickValue, locale, options);\n },\n\n\n /**\n * Formatter for logarithmic ticks\n * @method Chart.Ticks.formatters.logarithmic\n * @param tickValue {number} the value to be formatted\n * @param index {number} the position of the tickValue parameter in the ticks array\n * @param ticks {object[]} the list of ticks being converted\n * @return {string} string representation of the tickValue parameter\n */\n logarithmic(tickValue, index, ticks) {\n if (tickValue === 0) {\n return '0';\n }\n const remain = ticks[index].significand || (tickValue / (Math.pow(10, Math.floor(log10(tickValue)))));\n if ([1, 2, 3, 5, 10, 15].includes(remain) || index > 0.8 * ticks.length) {\n return formatters.numeric.call(this, tickValue, index, ticks);\n }\n return '';\n }\n\n};\n\n\nfunction calculateDelta(tickValue, ticks) {\n // Figure out how many digits to show\n // The space between the first two ticks might be smaller than normal spacing\n let delta = ticks.length > 3 ? ticks[2].value - ticks[1].value : ticks[1].value - ticks[0].value;\n\n // If we have a number like 2.5 as the delta, figure out how many decimal places we need\n if (Math.abs(delta) >= 1 && tickValue !== Math.floor(tickValue)) {\n // not an integer\n delta = tickValue - Math.floor(tickValue);\n }\n return delta;\n}\n\n/**\n * Namespace to hold static tick generation functions\n * @namespace Chart.Ticks\n */\nexport default {formatters};\n", "import Ticks from './core.ticks.js';\n\nexport function applyScaleDefaults(defaults) {\n defaults.set('scale', {\n display: true,\n offset: false,\n reverse: false,\n beginAtZero: false,\n\n /**\n * Scale boundary strategy (bypassed by min/max time options)\n * - `data`: make sure data are fully visible, ticks outside are removed\n * - `ticks`: make sure ticks are fully visible, data outside are truncated\n * @see https://github.com/chartjs/Chart.js/pull/4556\n * @since 3.0.0\n */\n bounds: 'ticks',\n\n clip: true,\n\n /**\n * Addition grace added to max and reduced from min data value.\n * @since 3.0.0\n */\n grace: 0,\n\n // grid line settings\n grid: {\n display: true,\n lineWidth: 1,\n drawOnChartArea: true,\n drawTicks: true,\n tickLength: 8,\n tickWidth: (_ctx, options) => options.lineWidth,\n tickColor: (_ctx, options) => options.color,\n offset: false,\n },\n\n border: {\n display: true,\n dash: [],\n dashOffset: 0.0,\n width: 1\n },\n\n // scale title\n title: {\n // display property\n display: false,\n\n // actual label\n text: '',\n\n // top/bottom padding\n padding: {\n top: 4,\n bottom: 4\n }\n },\n\n // label settings\n ticks: {\n minRotation: 0,\n maxRotation: 50,\n mirror: false,\n textStrokeWidth: 0,\n textStrokeColor: '',\n padding: 3,\n display: true,\n autoSkip: true,\n autoSkipPadding: 3,\n labelOffset: 0,\n // We pass through arrays to be rendered as multiline labels, we convert Others to strings here.\n callback: Ticks.formatters.values,\n minor: {},\n major: {},\n align: 'center',\n crossAlign: 'near',\n\n showLabelBackdrop: false,\n backdropColor: 'rgba(255, 255, 255, 0.75)',\n backdropPadding: 2,\n }\n });\n\n defaults.route('scale.ticks', 'color', '', 'color');\n defaults.route('scale.grid', 'color', '', 'borderColor');\n defaults.route('scale.border', 'color', '', 'borderColor');\n defaults.route('scale.title', 'color', '', 'color');\n\n defaults.describe('scale', {\n _fallback: false,\n _scriptable: (name) => !name.startsWith('before') && !name.startsWith('after') && name !== 'callback' && name !== 'parser',\n _indexable: (name) => name !== 'borderDash' && name !== 'tickBorderDash' && name !== 'dash',\n });\n\n defaults.describe('scales', {\n _fallback: 'scale',\n });\n\n defaults.describe('scale.ticks', {\n _scriptable: (name) => name !== 'backdropPadding' && name !== 'callback',\n _indexable: (name) => name !== 'backdropPadding',\n });\n}\n", "import {getHoverColor} from '../helpers/helpers.color.js';\nimport {isObject, merge, valueOrDefault} from '../helpers/helpers.core.js';\nimport {applyAnimationsDefaults} from './core.animations.defaults.js';\nimport {applyLayoutsDefaults} from './core.layouts.defaults.js';\nimport {applyScaleDefaults} from './core.scale.defaults.js';\n\nexport const overrides = Object.create(null);\nexport const descriptors = Object.create(null);\n\n/**\n * @param {object} node\n * @param {string} key\n * @return {object}\n */\nfunction getScope(node, key) {\n if (!key) {\n return node;\n }\n const keys = key.split('.');\n for (let i = 0, n = keys.length; i < n; ++i) {\n const k = keys[i];\n node = node[k] || (node[k] = Object.create(null));\n }\n return node;\n}\n\nfunction set(root, scope, values) {\n if (typeof scope === 'string') {\n return merge(getScope(root, scope), values);\n }\n return merge(getScope(root, ''), scope);\n}\n\n/**\n * Please use the module's default export which provides a singleton instance\n * Note: class is exported for typedoc\n */\nexport class Defaults {\n constructor(_descriptors, _appliers) {\n this.animation = undefined;\n this.backgroundColor = 'rgba(0,0,0,0.1)';\n this.borderColor = 'rgba(0,0,0,0.1)';\n this.color = '#666';\n this.datasets = {};\n this.devicePixelRatio = (context) => context.chart.platform.getDevicePixelRatio();\n this.elements = {};\n this.events = [\n 'mousemove',\n 'mouseout',\n 'click',\n 'touchstart',\n 'touchmove'\n ];\n this.font = {\n family: \"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif\",\n size: 12,\n style: 'normal',\n lineHeight: 1.2,\n weight: null\n };\n this.hover = {};\n this.hoverBackgroundColor = (ctx, options) => getHoverColor(options.backgroundColor);\n this.hoverBorderColor = (ctx, options) => getHoverColor(options.borderColor);\n this.hoverColor = (ctx, options) => getHoverColor(options.color);\n this.indexAxis = 'x';\n this.interaction = {\n mode: 'nearest',\n intersect: true,\n includeInvisible: false\n };\n this.maintainAspectRatio = true;\n this.onHover = null;\n this.onClick = null;\n this.parsing = true;\n this.plugins = {};\n this.responsive = true;\n this.scale = undefined;\n this.scales = {};\n this.showLine = true;\n this.drawActiveElementsOnTop = true;\n\n this.describe(_descriptors);\n this.apply(_appliers);\n }\n\n /**\n\t * @param {string|object} scope\n\t * @param {object} [values]\n\t */\n set(scope, values) {\n return set(this, scope, values);\n }\n\n /**\n\t * @param {string} scope\n\t */\n get(scope) {\n return getScope(this, scope);\n }\n\n /**\n\t * @param {string|object} scope\n\t * @param {object} [values]\n\t */\n describe(scope, values) {\n return set(descriptors, scope, values);\n }\n\n override(scope, values) {\n return set(overrides, scope, values);\n }\n\n /**\n\t * Routes the named defaults to fallback to another scope/name.\n\t * This routing is useful when those target values, like defaults.color, are changed runtime.\n\t * If the values would be copied, the runtime change would not take effect. By routing, the\n\t * fallback is evaluated at each access, so its always up to date.\n\t *\n\t * Example:\n\t *\n\t * \tdefaults.route('elements.arc', 'backgroundColor', '', 'color')\n\t * - reads the backgroundColor from defaults.color when undefined locally\n\t *\n\t * @param {string} scope Scope this route applies to.\n\t * @param {string} name Property name that should be routed to different namespace when not defined here.\n\t * @param {string} targetScope The namespace where those properties should be routed to.\n\t * Empty string ('') is the root of defaults.\n\t * @param {string} targetName The target name in the target scope the property should be routed to.\n\t */\n route(scope, name, targetScope, targetName) {\n const scopeObject = getScope(this, scope);\n const targetScopeObject = getScope(this, targetScope);\n const privateName = '_' + name;\n\n Object.defineProperties(scopeObject, {\n // A private property is defined to hold the actual value, when this property is set in its scope (set in the setter)\n [privateName]: {\n value: scopeObject[name],\n writable: true\n },\n // The actual property is defined as getter/setter so we can do the routing when value is not locally set.\n [name]: {\n enumerable: true,\n get() {\n const local = this[privateName];\n const target = targetScopeObject[targetName];\n if (isObject(local)) {\n return Object.assign({}, target, local);\n }\n return valueOrDefault(local, target);\n },\n set(value) {\n this[privateName] = value;\n }\n }\n });\n }\n\n apply(appliers) {\n appliers.forEach((apply) => apply(this));\n }\n}\n\n// singleton instance\nexport default /* #__PURE__ */ new Defaults({\n _scriptable: (name) => !name.startsWith('on'),\n _indexable: (name) => name !== 'events',\n hover: {\n _fallback: 'interaction'\n },\n interaction: {\n _scriptable: false,\n _indexable: false,\n }\n}, [applyAnimationsDefaults, applyLayoutsDefaults, applyScaleDefaults]);\n", "import type {\n Chart,\n Point,\n FontSpec,\n CanvasFontSpec,\n PointStyle,\n RenderTextOpts,\n BackdropOptions\n} from '../types/index.js';\nimport type {\n TRBL,\n SplinePoint,\n RoundedRect,\n TRBLCorners\n} from '../types/geometric.js';\nimport {isArray, isNullOrUndef} from './helpers.core.js';\nimport {PI, TAU, HALF_PI, QUARTER_PI, TWO_THIRDS_PI, RAD_PER_DEG} from './helpers.math.js';\n\n/**\n * Converts the given font object into a CSS font string.\n * @param font - A font object.\n * @return The CSS font string. See https://developer.mozilla.org/en-US/docs/Web/CSS/font\n * @private\n */\nexport function toFontString(font: FontSpec) {\n if (!font || isNullOrUndef(font.size) || isNullOrUndef(font.family)) {\n return null;\n }\n\n return (font.style ? font.style + ' ' : '')\n\t\t+ (font.weight ? font.weight + ' ' : '')\n\t\t+ font.size + 'px '\n\t\t+ font.family;\n}\n\n/**\n * @private\n */\nexport function _measureText(\n ctx: CanvasRenderingContext2D,\n data: Record,\n gc: string[],\n longest: number,\n string: string\n) {\n let textWidth = data[string];\n if (!textWidth) {\n textWidth = data[string] = ctx.measureText(string).width;\n gc.push(string);\n }\n if (textWidth > longest) {\n longest = textWidth;\n }\n return longest;\n}\n\ntype Thing = string | undefined | null\ntype Things = (Thing | Thing[])[]\n\n/**\n * @private\n */\n// eslint-disable-next-line complexity\nexport function _longestText(\n ctx: CanvasRenderingContext2D,\n font: string,\n arrayOfThings: Things,\n cache?: {data?: Record, garbageCollect?: string[], font?: string}\n) {\n cache = cache || {};\n let data = cache.data = cache.data || {};\n let gc = cache.garbageCollect = cache.garbageCollect || [];\n\n if (cache.font !== font) {\n data = cache.data = {};\n gc = cache.garbageCollect = [];\n cache.font = font;\n }\n\n ctx.save();\n\n ctx.font = font;\n let longest = 0;\n const ilen = arrayOfThings.length;\n let i: number, j: number, jlen: number, thing: Thing | Thing[], nestedThing: Thing | Thing[];\n for (i = 0; i < ilen; i++) {\n thing = arrayOfThings[i];\n\n // Undefined strings and arrays should not be measured\n if (thing !== undefined && thing !== null && !isArray(thing)) {\n longest = _measureText(ctx, data, gc, longest, thing);\n } else if (isArray(thing)) {\n // if it is an array lets measure each element\n // to do maybe simplify this function a bit so we can do this more recursively?\n for (j = 0, jlen = thing.length; j < jlen; j++) {\n nestedThing = thing[j];\n // Undefined strings and arrays should not be measured\n if (nestedThing !== undefined && nestedThing !== null && !isArray(nestedThing)) {\n longest = _measureText(ctx, data, gc, longest, nestedThing);\n }\n }\n }\n }\n\n ctx.restore();\n\n const gcLen = gc.length / 2;\n if (gcLen > arrayOfThings.length) {\n for (i = 0; i < gcLen; i++) {\n delete data[gc[i]];\n }\n gc.splice(0, gcLen);\n }\n return longest;\n}\n\n/**\n * Returns the aligned pixel value to avoid anti-aliasing blur\n * @param chart - The chart instance.\n * @param pixel - A pixel value.\n * @param width - The width of the element.\n * @returns The aligned pixel value.\n * @private\n */\nexport function _alignPixel(chart: Chart, pixel: number, width: number) {\n const devicePixelRatio = chart.currentDevicePixelRatio;\n const halfWidth = width !== 0 ? Math.max(width / 2, 0.5) : 0;\n return Math.round((pixel - halfWidth) * devicePixelRatio) / devicePixelRatio + halfWidth;\n}\n\n/**\n * Clears the entire canvas.\n */\nexport function clearCanvas(canvas?: HTMLCanvasElement, ctx?: CanvasRenderingContext2D) {\n if (!ctx && !canvas) {\n return;\n }\n\n ctx = ctx || canvas.getContext('2d');\n\n ctx.save();\n // canvas.width and canvas.height do not consider the canvas transform,\n // while clearRect does\n ctx.resetTransform();\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n ctx.restore();\n}\n\nexport interface DrawPointOptions {\n pointStyle: PointStyle;\n rotation?: number;\n radius: number;\n borderWidth: number;\n}\n\nexport function drawPoint(\n ctx: CanvasRenderingContext2D,\n options: DrawPointOptions,\n x: number,\n y: number\n) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n drawPointLegend(ctx, options, x, y, null);\n}\n\n// eslint-disable-next-line complexity\nexport function drawPointLegend(\n ctx: CanvasRenderingContext2D,\n options: DrawPointOptions,\n x: number,\n y: number,\n w: number\n) {\n let type: string, xOffset: number, yOffset: number, size: number, cornerRadius: number, width: number, xOffsetW: number, yOffsetW: number;\n const style = options.pointStyle;\n const rotation = options.rotation;\n const radius = options.radius;\n let rad = (rotation || 0) * RAD_PER_DEG;\n\n if (style && typeof style === 'object') {\n type = style.toString();\n if (type === '[object HTMLImageElement]' || type === '[object HTMLCanvasElement]') {\n ctx.save();\n ctx.translate(x, y);\n ctx.rotate(rad);\n ctx.drawImage(style, -style.width / 2, -style.height / 2, style.width, style.height);\n ctx.restore();\n return;\n }\n }\n\n if (isNaN(radius) || radius <= 0) {\n return;\n }\n\n ctx.beginPath();\n\n switch (style) {\n // Default includes circle\n default:\n if (w) {\n ctx.ellipse(x, y, w / 2, radius, 0, 0, TAU);\n } else {\n ctx.arc(x, y, radius, 0, TAU);\n }\n ctx.closePath();\n break;\n case 'triangle':\n width = w ? w / 2 : radius;\n ctx.moveTo(x + Math.sin(rad) * width, y - Math.cos(rad) * radius);\n rad += TWO_THIRDS_PI;\n ctx.lineTo(x + Math.sin(rad) * width, y - Math.cos(rad) * radius);\n rad += TWO_THIRDS_PI;\n ctx.lineTo(x + Math.sin(rad) * width, y - Math.cos(rad) * radius);\n ctx.closePath();\n break;\n case 'rectRounded':\n // NOTE: the rounded rect implementation changed to use `arc` instead of\n // `quadraticCurveTo` since it generates better results when rect is\n // almost a circle. 0.516 (instead of 0.5) produces results with visually\n // closer proportion to the previous impl and it is inscribed in the\n // circle with `radius`. For more details, see the following PRs:\n // https://github.com/chartjs/Chart.js/issues/5597\n // https://github.com/chartjs/Chart.js/issues/5858\n cornerRadius = radius * 0.516;\n size = radius - cornerRadius;\n xOffset = Math.cos(rad + QUARTER_PI) * size;\n xOffsetW = Math.cos(rad + QUARTER_PI) * (w ? w / 2 - cornerRadius : size);\n yOffset = Math.sin(rad + QUARTER_PI) * size;\n yOffsetW = Math.sin(rad + QUARTER_PI) * (w ? w / 2 - cornerRadius : size);\n ctx.arc(x - xOffsetW, y - yOffset, cornerRadius, rad - PI, rad - HALF_PI);\n ctx.arc(x + yOffsetW, y - xOffset, cornerRadius, rad - HALF_PI, rad);\n ctx.arc(x + xOffsetW, y + yOffset, cornerRadius, rad, rad + HALF_PI);\n ctx.arc(x - yOffsetW, y + xOffset, cornerRadius, rad + HALF_PI, rad + PI);\n ctx.closePath();\n break;\n case 'rect':\n if (!rotation) {\n size = Math.SQRT1_2 * radius;\n width = w ? w / 2 : size;\n ctx.rect(x - width, y - size, 2 * width, 2 * size);\n break;\n }\n rad += QUARTER_PI;\n /* falls through */\n case 'rectRot':\n xOffsetW = Math.cos(rad) * (w ? w / 2 : radius);\n xOffset = Math.cos(rad) * radius;\n yOffset = Math.sin(rad) * radius;\n yOffsetW = Math.sin(rad) * (w ? w / 2 : radius);\n ctx.moveTo(x - xOffsetW, y - yOffset);\n ctx.lineTo(x + yOffsetW, y - xOffset);\n ctx.lineTo(x + xOffsetW, y + yOffset);\n ctx.lineTo(x - yOffsetW, y + xOffset);\n ctx.closePath();\n break;\n case 'crossRot':\n rad += QUARTER_PI;\n /* falls through */\n case 'cross':\n xOffsetW = Math.cos(rad) * (w ? w / 2 : radius);\n xOffset = Math.cos(rad) * radius;\n yOffset = Math.sin(rad) * radius;\n yOffsetW = Math.sin(rad) * (w ? w / 2 : radius);\n ctx.moveTo(x - xOffsetW, y - yOffset);\n ctx.lineTo(x + xOffsetW, y + yOffset);\n ctx.moveTo(x + yOffsetW, y - xOffset);\n ctx.lineTo(x - yOffsetW, y + xOffset);\n break;\n case 'star':\n xOffsetW = Math.cos(rad) * (w ? w / 2 : radius);\n xOffset = Math.cos(rad) * radius;\n yOffset = Math.sin(rad) * radius;\n yOffsetW = Math.sin(rad) * (w ? w / 2 : radius);\n ctx.moveTo(x - xOffsetW, y - yOffset);\n ctx.lineTo(x + xOffsetW, y + yOffset);\n ctx.moveTo(x + yOffsetW, y - xOffset);\n ctx.lineTo(x - yOffsetW, y + xOffset);\n rad += QUARTER_PI;\n xOffsetW = Math.cos(rad) * (w ? w / 2 : radius);\n xOffset = Math.cos(rad) * radius;\n yOffset = Math.sin(rad) * radius;\n yOffsetW = Math.sin(rad) * (w ? w / 2 : radius);\n ctx.moveTo(x - xOffsetW, y - yOffset);\n ctx.lineTo(x + xOffsetW, y + yOffset);\n ctx.moveTo(x + yOffsetW, y - xOffset);\n ctx.lineTo(x - yOffsetW, y + xOffset);\n break;\n case 'line':\n xOffset = w ? w / 2 : Math.cos(rad) * radius;\n yOffset = Math.sin(rad) * radius;\n ctx.moveTo(x - xOffset, y - yOffset);\n ctx.lineTo(x + xOffset, y + yOffset);\n break;\n case 'dash':\n ctx.moveTo(x, y);\n ctx.lineTo(x + Math.cos(rad) * (w ? w / 2 : radius), y + Math.sin(rad) * radius);\n break;\n case false:\n ctx.closePath();\n break;\n }\n\n ctx.fill();\n if (options.borderWidth > 0) {\n ctx.stroke();\n }\n}\n\n/**\n * Returns true if the point is inside the rectangle\n * @param point - The point to test\n * @param area - The rectangle\n * @param margin - allowed margin\n * @private\n */\nexport function _isPointInArea(\n point: Point,\n area: TRBL,\n margin?: number\n) {\n margin = margin || 0.5; // margin - default is to match rounded decimals\n\n return !area || (point && point.x > area.left - margin && point.x < area.right + margin &&\n\t\tpoint.y > area.top - margin && point.y < area.bottom + margin);\n}\n\nexport function clipArea(ctx: CanvasRenderingContext2D, area: TRBL) {\n ctx.save();\n ctx.beginPath();\n ctx.rect(area.left, area.top, area.right - area.left, area.bottom - area.top);\n ctx.clip();\n}\n\nexport function unclipArea(ctx: CanvasRenderingContext2D) {\n ctx.restore();\n}\n\n/**\n * @private\n */\nexport function _steppedLineTo(\n ctx: CanvasRenderingContext2D,\n previous: Point,\n target: Point,\n flip?: boolean,\n mode?: string\n) {\n if (!previous) {\n return ctx.lineTo(target.x, target.y);\n }\n if (mode === 'middle') {\n const midpoint = (previous.x + target.x) / 2.0;\n ctx.lineTo(midpoint, previous.y);\n ctx.lineTo(midpoint, target.y);\n } else if (mode === 'after' !== !!flip) {\n ctx.lineTo(previous.x, target.y);\n } else {\n ctx.lineTo(target.x, previous.y);\n }\n ctx.lineTo(target.x, target.y);\n}\n\n/**\n * @private\n */\nexport function _bezierCurveTo(\n ctx: CanvasRenderingContext2D,\n previous: SplinePoint,\n target: SplinePoint,\n flip?: boolean\n) {\n if (!previous) {\n return ctx.lineTo(target.x, target.y);\n }\n ctx.bezierCurveTo(\n flip ? previous.cp1x : previous.cp2x,\n flip ? previous.cp1y : previous.cp2y,\n flip ? target.cp2x : target.cp1x,\n flip ? target.cp2y : target.cp1y,\n target.x,\n target.y);\n}\n\nfunction setRenderOpts(ctx: CanvasRenderingContext2D, opts: RenderTextOpts) {\n if (opts.translation) {\n ctx.translate(opts.translation[0], opts.translation[1]);\n }\n\n if (!isNullOrUndef(opts.rotation)) {\n ctx.rotate(opts.rotation);\n }\n\n if (opts.color) {\n ctx.fillStyle = opts.color;\n }\n\n if (opts.textAlign) {\n ctx.textAlign = opts.textAlign;\n }\n\n if (opts.textBaseline) {\n ctx.textBaseline = opts.textBaseline;\n }\n}\n\nfunction decorateText(\n ctx: CanvasRenderingContext2D,\n x: number,\n y: number,\n line: string,\n opts: RenderTextOpts\n) {\n if (opts.strikethrough || opts.underline) {\n /**\n * Now that IE11 support has been dropped, we can use more\n * of the TextMetrics object. The actual bounding boxes\n * are unflagged in Chrome, Firefox, Edge, and Safari so they\n * can be safely used.\n * See https://developer.mozilla.org/en-US/docs/Web/API/TextMetrics#Browser_compatibility\n */\n const metrics = ctx.measureText(line);\n const left = x - metrics.actualBoundingBoxLeft;\n const right = x + metrics.actualBoundingBoxRight;\n const top = y - metrics.actualBoundingBoxAscent;\n const bottom = y + metrics.actualBoundingBoxDescent;\n const yDecoration = opts.strikethrough ? (top + bottom) / 2 : bottom;\n\n ctx.strokeStyle = ctx.fillStyle;\n ctx.beginPath();\n ctx.lineWidth = opts.decorationWidth || 2;\n ctx.moveTo(left, yDecoration);\n ctx.lineTo(right, yDecoration);\n ctx.stroke();\n }\n}\n\nfunction drawBackdrop(ctx: CanvasRenderingContext2D, opts: BackdropOptions) {\n const oldColor = ctx.fillStyle;\n\n ctx.fillStyle = opts.color as string;\n ctx.fillRect(opts.left, opts.top, opts.width, opts.height);\n ctx.fillStyle = oldColor;\n}\n\n/**\n * Render text onto the canvas\n */\nexport function renderText(\n ctx: CanvasRenderingContext2D,\n text: string | string[],\n x: number,\n y: number,\n font: CanvasFontSpec,\n opts: RenderTextOpts = {}\n) {\n const lines = isArray(text) ? text : [text];\n const stroke = opts.strokeWidth > 0 && opts.strokeColor !== '';\n let i: number, line: string;\n\n ctx.save();\n ctx.font = font.string;\n setRenderOpts(ctx, opts);\n\n for (i = 0; i < lines.length; ++i) {\n line = lines[i];\n\n if (opts.backdrop) {\n drawBackdrop(ctx, opts.backdrop);\n }\n\n if (stroke) {\n if (opts.strokeColor) {\n ctx.strokeStyle = opts.strokeColor;\n }\n\n if (!isNullOrUndef(opts.strokeWidth)) {\n ctx.lineWidth = opts.strokeWidth;\n }\n\n ctx.strokeText(line, x, y, opts.maxWidth);\n }\n\n ctx.fillText(line, x, y, opts.maxWidth);\n decorateText(ctx, x, y, line, opts);\n\n y += Number(font.lineHeight);\n }\n\n ctx.restore();\n}\n\n/**\n * Add a path of a rectangle with rounded corners to the current sub-path\n * @param ctx - Context\n * @param rect - Bounding rect\n */\nexport function addRoundedRectPath(\n ctx: CanvasRenderingContext2D,\n rect: RoundedRect & { radius: TRBLCorners }\n) {\n const {x, y, w, h, radius} = rect;\n\n // top left arc\n ctx.arc(x + radius.topLeft, y + radius.topLeft, radius.topLeft, 1.5 * PI, PI, true);\n\n // line from top left to bottom left\n ctx.lineTo(x, y + h - radius.bottomLeft);\n\n // bottom left arc\n ctx.arc(x + radius.bottomLeft, y + h - radius.bottomLeft, radius.bottomLeft, PI, HALF_PI, true);\n\n // line from bottom left to bottom right\n ctx.lineTo(x + w - radius.bottomRight, y + h);\n\n // bottom right arc\n ctx.arc(x + w - radius.bottomRight, y + h - radius.bottomRight, radius.bottomRight, HALF_PI, 0, true);\n\n // line from bottom right to top right\n ctx.lineTo(x + w, y + radius.topRight);\n\n // top right arc\n ctx.arc(x + w - radius.topRight, y + radius.topRight, radius.topRight, 0, -HALF_PI, true);\n\n // line from top right to top left\n ctx.lineTo(x + radius.topLeft, y);\n}\n", "import defaults from '../core/core.defaults.js';\nimport {isArray, isObject, toDimension, valueOrDefault} from './helpers.core.js';\nimport {toFontString} from './helpers.canvas.js';\nimport type {ChartArea, FontSpec, Point} from '../types/index.js';\nimport type {TRBL, TRBLCorners} from '../types/geometric.js';\n\nconst LINE_HEIGHT = /^(normal|(\\d+(?:\\.\\d+)?)(px|em|%)?)$/;\nconst FONT_STYLE = /^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;\n\n/**\n * @alias Chart.helpers.options\n * @namespace\n */\n/**\n * Converts the given line height `value` in pixels for a specific font `size`.\n * @param value - The lineHeight to parse (eg. 1.6, '14px', '75%', '1.6em').\n * @param size - The font size (in pixels) used to resolve relative `value`.\n * @returns The effective line height in pixels (size * 1.2 if value is invalid).\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/line-height\n * @since 2.7.0\n */\nexport function toLineHeight(value: number | string, size: number): number {\n const matches = ('' + value).match(LINE_HEIGHT);\n if (!matches || matches[1] === 'normal') {\n return size * 1.2;\n }\n\n value = +matches[2];\n\n switch (matches[3]) {\n case 'px':\n return value;\n case '%':\n value /= 100;\n break;\n default:\n break;\n }\n\n return size * value;\n}\n\nconst numberOrZero = (v: unknown) => +v || 0;\n\n/**\n * @param value\n * @param props\n */\nexport function _readValueToProps(value: number | Record, props: K[]): Record;\nexport function _readValueToProps(value: number | Record, props: Record): Record;\nexport function _readValueToProps(value: number | Record, props: string[] | Record) {\n const ret = {};\n const objProps = isObject(props);\n const keys = objProps ? Object.keys(props) : props;\n const read = isObject(value)\n ? objProps\n ? prop => valueOrDefault(value[prop], value[props[prop]])\n : prop => value[prop]\n : () => value;\n\n for (const prop of keys) {\n ret[prop] = numberOrZero(read(prop));\n }\n return ret;\n}\n\n/**\n * Converts the given value into a TRBL object.\n * @param value - If a number, set the value to all TRBL component,\n * else, if an object, use defined properties and sets undefined ones to 0.\n * x / y are shorthands for same value for left/right and top/bottom.\n * @returns The padding values (top, right, bottom, left)\n * @since 3.0.0\n */\nexport function toTRBL(value: number | TRBL | Point) {\n return _readValueToProps(value, {top: 'y', right: 'x', bottom: 'y', left: 'x'});\n}\n\n/**\n * Converts the given value into a TRBL corners object (similar with css border-radius).\n * @param value - If a number, set the value to all TRBL corner components,\n * else, if an object, use defined properties and sets undefined ones to 0.\n * @returns The TRBL corner values (topLeft, topRight, bottomLeft, bottomRight)\n * @since 3.0.0\n */\nexport function toTRBLCorners(value: number | TRBLCorners) {\n return _readValueToProps(value, ['topLeft', 'topRight', 'bottomLeft', 'bottomRight']);\n}\n\n/**\n * Converts the given value into a padding object with pre-computed width/height.\n * @param value - If a number, set the value to all TRBL component,\n * else, if an object, use defined properties and sets undefined ones to 0.\n * x / y are shorthands for same value for left/right and top/bottom.\n * @returns The padding values (top, right, bottom, left, width, height)\n * @since 2.7.0\n */\nexport function toPadding(value?: number | TRBL): ChartArea {\n const obj = toTRBL(value) as ChartArea;\n\n obj.width = obj.left + obj.right;\n obj.height = obj.top + obj.bottom;\n\n return obj;\n}\n\n/**\n * Parses font options and returns the font object.\n * @param options - A object that contains font options to be parsed.\n * @param fallback - A object that contains fallback font options.\n * @return The font object.\n * @private\n */\n\nexport function toFont(options: Partial, fallback?: Partial) {\n options = options || {};\n fallback = fallback || defaults.font as FontSpec;\n\n let size = valueOrDefault(options.size, fallback.size);\n\n if (typeof size === 'string') {\n size = parseInt(size, 10);\n }\n let style = valueOrDefault(options.style, fallback.style);\n if (style && !('' + style).match(FONT_STYLE)) {\n console.warn('Invalid font style specified: \"' + style + '\"');\n style = undefined;\n }\n\n const font = {\n family: valueOrDefault(options.family, fallback.family),\n lineHeight: toLineHeight(valueOrDefault(options.lineHeight, fallback.lineHeight), size),\n size,\n style,\n weight: valueOrDefault(options.weight, fallback.weight),\n string: ''\n };\n\n font.string = toFontString(font);\n return font;\n}\n\n/**\n * Evaluates the given `inputs` sequentially and returns the first defined value.\n * @param inputs - An array of values, falling back to the last value.\n * @param context - If defined and the current value is a function, the value\n * is called with `context` as first argument and the result becomes the new input.\n * @param index - If defined and the current value is an array, the value\n * at `index` become the new input.\n * @param info - object to return information about resolution in\n * @param info.cacheable - Will be set to `false` if option is not cacheable.\n * @since 2.7.0\n */\nexport function resolve(inputs: Array, context?: object, index?: number, info?: { cacheable: boolean }) {\n let cacheable = true;\n let i: number, ilen: number, value: unknown;\n\n for (i = 0, ilen = inputs.length; i < ilen; ++i) {\n value = inputs[i];\n if (value === undefined) {\n continue;\n }\n if (context !== undefined && typeof value === 'function') {\n value = value(context);\n cacheable = false;\n }\n if (index !== undefined && isArray(value)) {\n value = value[index % value.length];\n cacheable = false;\n }\n if (value !== undefined) {\n if (info && !cacheable) {\n info.cacheable = false;\n }\n return value;\n }\n }\n}\n\n/**\n * @param minmax\n * @param grace\n * @param beginAtZero\n * @private\n */\nexport function _addGrace(minmax: { min: number; max: number; }, grace: number | string, beginAtZero: boolean) {\n const {min, max} = minmax;\n const change = toDimension(grace, (max - min) / 2);\n const keepZero = (value: number, add: number) => beginAtZero && value === 0 ? 0 : value + add;\n return {\n min: keepZero(min, -Math.abs(change)),\n max: keepZero(max, change)\n };\n}\n\n/**\n * Create a context inheriting parentContext\n * @param parentContext\n * @param context\n * @returns\n */\nexport function createContext(parentContext: null, context: T): T;\nexport function createContext(parentContext: P, context: T): P & T;\nexport function createContext(parentContext: object, context: object) {\n return Object.assign(Object.create(parentContext), context);\n}\n", "/* eslint-disable @typescript-eslint/no-use-before-define */\nimport type {AnyObject} from '../types/basic.js';\nimport type {ChartMeta} from '../types/index.js';\nimport type {\n ResolverObjectKey,\n ResolverCache,\n ResolverProxy,\n DescriptorDefaults,\n Descriptor,\n ContextCache,\n ContextProxy\n} from './helpers.config.types.js';\nimport {isArray, isFunction, isObject, resolveObjectKey, _capitalize} from './helpers.core.js';\n\nexport * from './helpers.config.types.js';\n\n/**\n * Creates a Proxy for resolving raw values for options.\n * @param scopes - The option scopes to look for values, in resolution order\n * @param prefixes - The prefixes for values, in resolution order.\n * @param rootScopes - The root option scopes\n * @param fallback - Parent scopes fallback\n * @param getTarget - callback for getting the target for changed values\n * @returns Proxy\n * @private\n */\nexport function _createResolver<\n T extends AnyObject[] = AnyObject[],\n R extends AnyObject[] = T\n>(\n scopes: T,\n prefixes = [''],\n rootScopes?: R,\n fallback?: ResolverObjectKey,\n getTarget = () => scopes[0]\n) {\n const finalRootScopes = rootScopes || scopes;\n if (typeof fallback === 'undefined') {\n fallback = _resolve('_fallback', scopes);\n }\n const cache: ResolverCache = {\n [Symbol.toStringTag]: 'Object',\n _cacheable: true,\n _scopes: scopes,\n _rootScopes: finalRootScopes,\n _fallback: fallback,\n _getTarget: getTarget,\n override: (scope: AnyObject) => _createResolver([scope, ...scopes], prefixes, finalRootScopes, fallback),\n };\n return new Proxy(cache, {\n /**\n * A trap for the delete operator.\n */\n deleteProperty(target, prop: string) {\n delete target[prop]; // remove from cache\n delete target._keys; // remove cached keys\n delete scopes[0][prop]; // remove from top level scope\n return true;\n },\n\n /**\n * A trap for getting property values.\n */\n get(target, prop: string) {\n return _cached(target, prop,\n () => _resolveWithPrefixes(prop, prefixes, scopes, target));\n },\n\n /**\n * A trap for Object.getOwnPropertyDescriptor.\n * Also used by Object.hasOwnProperty.\n */\n getOwnPropertyDescriptor(target, prop) {\n return Reflect.getOwnPropertyDescriptor(target._scopes[0], prop);\n },\n\n /**\n * A trap for Object.getPrototypeOf.\n */\n getPrototypeOf() {\n return Reflect.getPrototypeOf(scopes[0]);\n },\n\n /**\n * A trap for the in operator.\n */\n has(target, prop: string) {\n return getKeysFromAllScopes(target).includes(prop);\n },\n\n /**\n * A trap for Object.getOwnPropertyNames and Object.getOwnPropertySymbols.\n */\n ownKeys(target) {\n return getKeysFromAllScopes(target);\n },\n\n /**\n * A trap for setting property values.\n */\n set(target, prop: string, value) {\n const storage = target._storage || (target._storage = getTarget());\n target[prop] = storage[prop] = value; // set to top level scope + cache\n delete target._keys; // remove cached keys\n return true;\n }\n }) as ResolverProxy;\n}\n\n/**\n * Returns an Proxy for resolving option values with context.\n * @param proxy - The Proxy returned by `_createResolver`\n * @param context - Context object for scriptable/indexable options\n * @param subProxy - The proxy provided for scriptable options\n * @param descriptorDefaults - Defaults for descriptors\n * @private\n */\nexport function _attachContext<\n T extends AnyObject[] = AnyObject[],\n R extends AnyObject[] = T\n>(\n proxy: ResolverProxy,\n context: AnyObject,\n subProxy?: ResolverProxy,\n descriptorDefaults?: DescriptorDefaults\n) {\n const cache: ContextCache = {\n _cacheable: false,\n _proxy: proxy,\n _context: context,\n _subProxy: subProxy,\n _stack: new Set(),\n _descriptors: _descriptors(proxy, descriptorDefaults),\n setContext: (ctx: AnyObject) => _attachContext(proxy, ctx, subProxy, descriptorDefaults),\n override: (scope: AnyObject) => _attachContext(proxy.override(scope), context, subProxy, descriptorDefaults)\n };\n return new Proxy(cache, {\n /**\n * A trap for the delete operator.\n */\n deleteProperty(target, prop) {\n delete target[prop]; // remove from cache\n delete proxy[prop]; // remove from proxy\n return true;\n },\n\n /**\n * A trap for getting property values.\n */\n get(target, prop: string, receiver) {\n return _cached(target, prop,\n () => _resolveWithContext(target, prop, receiver));\n },\n\n /**\n * A trap for Object.getOwnPropertyDescriptor.\n * Also used by Object.hasOwnProperty.\n */\n getOwnPropertyDescriptor(target, prop) {\n return target._descriptors.allKeys\n ? Reflect.has(proxy, prop) ? {enumerable: true, configurable: true} : undefined\n : Reflect.getOwnPropertyDescriptor(proxy, prop);\n },\n\n /**\n * A trap for Object.getPrototypeOf.\n */\n getPrototypeOf() {\n return Reflect.getPrototypeOf(proxy);\n },\n\n /**\n * A trap for the in operator.\n */\n has(target, prop) {\n return Reflect.has(proxy, prop);\n },\n\n /**\n * A trap for Object.getOwnPropertyNames and Object.getOwnPropertySymbols.\n */\n ownKeys() {\n return Reflect.ownKeys(proxy);\n },\n\n /**\n * A trap for setting property values.\n */\n set(target, prop, value) {\n proxy[prop] = value; // set to proxy\n delete target[prop]; // remove from cache\n return true;\n }\n }) as ContextProxy;\n}\n\n/**\n * @private\n */\nexport function _descriptors(\n proxy: ResolverCache,\n defaults: DescriptorDefaults = {scriptable: true, indexable: true}\n): Descriptor {\n const {_scriptable = defaults.scriptable, _indexable = defaults.indexable, _allKeys = defaults.allKeys} = proxy;\n return {\n allKeys: _allKeys,\n scriptable: _scriptable,\n indexable: _indexable,\n isScriptable: isFunction(_scriptable) ? _scriptable : () => _scriptable,\n isIndexable: isFunction(_indexable) ? _indexable : () => _indexable\n };\n}\n\nconst readKey = (prefix: string, name: string) => prefix ? prefix + _capitalize(name) : name;\nconst needsSubResolver = (prop: string, value: unknown) => isObject(value) && prop !== 'adapters' &&\n (Object.getPrototypeOf(value) === null || value.constructor === Object);\n\nfunction _cached(\n target: AnyObject,\n prop: string,\n resolve: () => unknown\n) {\n if (Object.prototype.hasOwnProperty.call(target, prop) || prop === 'constructor') {\n return target[prop];\n }\n\n const value = resolve();\n // cache the resolved value\n target[prop] = value;\n return value;\n}\n\nfunction _resolveWithContext(\n target: ContextCache,\n prop: string,\n receiver: AnyObject\n) {\n const {_proxy, _context, _subProxy, _descriptors: descriptors} = target;\n let value = _proxy[prop]; // resolve from proxy\n\n // resolve with context\n if (isFunction(value) && descriptors.isScriptable(prop)) {\n value = _resolveScriptable(prop, value, target, receiver);\n }\n if (isArray(value) && value.length) {\n value = _resolveArray(prop, value, target, descriptors.isIndexable);\n }\n if (needsSubResolver(prop, value)) {\n // if the resolved value is an object, create a sub resolver for it\n value = _attachContext(value, _context, _subProxy && _subProxy[prop], descriptors);\n }\n return value;\n}\n\nfunction _resolveScriptable(\n prop: string,\n getValue: (ctx: AnyObject, sub: AnyObject) => unknown,\n target: ContextCache,\n receiver: AnyObject\n) {\n const {_proxy, _context, _subProxy, _stack} = target;\n if (_stack.has(prop)) {\n throw new Error('Recursion detected: ' + Array.from(_stack).join('->') + '->' + prop);\n }\n _stack.add(prop);\n let value = getValue(_context, _subProxy || receiver);\n _stack.delete(prop);\n if (needsSubResolver(prop, value)) {\n // When scriptable option returns an object, create a resolver on that.\n value = createSubResolver(_proxy._scopes, _proxy, prop, value);\n }\n return value;\n}\n\nfunction _resolveArray(\n prop: string,\n value: unknown[],\n target: ContextCache,\n isIndexable: (key: string) => boolean\n) {\n const {_proxy, _context, _subProxy, _descriptors: descriptors} = target;\n\n if (typeof _context.index !== 'undefined' && isIndexable(prop)) {\n return value[_context.index % value.length];\n } else if (isObject(value[0])) {\n // Array of objects, return array or resolvers\n const arr = value;\n const scopes = _proxy._scopes.filter(s => s !== arr);\n value = [];\n for (const item of arr) {\n const resolver = createSubResolver(scopes, _proxy, prop, item);\n value.push(_attachContext(resolver, _context, _subProxy && _subProxy[prop], descriptors));\n }\n }\n return value;\n}\n\nfunction resolveFallback(\n fallback: ResolverObjectKey | ((prop: ResolverObjectKey, value: unknown) => ResolverObjectKey),\n prop: ResolverObjectKey,\n value: unknown\n) {\n return isFunction(fallback) ? fallback(prop, value) : fallback;\n}\n\nconst getScope = (key: ResolverObjectKey, parent: AnyObject) => key === true ? parent\n : typeof key === 'string' ? resolveObjectKey(parent, key) : undefined;\n\nfunction addScopes(\n set: Set,\n parentScopes: AnyObject[],\n key: ResolverObjectKey,\n parentFallback: ResolverObjectKey,\n value: unknown\n) {\n for (const parent of parentScopes) {\n const scope = getScope(key, parent);\n if (scope) {\n set.add(scope);\n const fallback = resolveFallback(scope._fallback, key, value);\n if (typeof fallback !== 'undefined' && fallback !== key && fallback !== parentFallback) {\n // When we reach the descriptor that defines a new _fallback, return that.\n // The fallback will resume to that new scope.\n return fallback;\n }\n } else if (scope === false && typeof parentFallback !== 'undefined' && key !== parentFallback) {\n // Fallback to `false` results to `false`, when falling back to different key.\n // For example `interaction` from `hover` or `plugins.tooltip` and `animation` from `animations`\n return null;\n }\n }\n return false;\n}\n\nfunction createSubResolver(\n parentScopes: AnyObject[],\n resolver: ResolverCache,\n prop: ResolverObjectKey,\n value: unknown\n) {\n const rootScopes = resolver._rootScopes;\n const fallback = resolveFallback(resolver._fallback, prop, value);\n const allScopes = [...parentScopes, ...rootScopes];\n const set = new Set();\n set.add(value);\n let key = addScopesFromKey(set, allScopes, prop, fallback || prop, value);\n if (key === null) {\n return false;\n }\n if (typeof fallback !== 'undefined' && fallback !== prop) {\n key = addScopesFromKey(set, allScopes, fallback, key, value);\n if (key === null) {\n return false;\n }\n }\n return _createResolver(Array.from(set), [''], rootScopes, fallback,\n () => subGetTarget(resolver, prop as string, value));\n}\n\nfunction addScopesFromKey(\n set: Set,\n allScopes: AnyObject[],\n key: ResolverObjectKey,\n fallback: ResolverObjectKey,\n item: unknown\n) {\n while (key) {\n key = addScopes(set, allScopes, key, fallback, item);\n }\n return key;\n}\n\nfunction subGetTarget(\n resolver: ResolverCache,\n prop: string,\n value: unknown\n) {\n const parent = resolver._getTarget();\n if (!(prop in parent)) {\n parent[prop] = {};\n }\n const target = parent[prop];\n if (isArray(target) && isObject(value)) {\n // For array of objects, the object is used to store updated values\n return value;\n }\n return target || {};\n}\n\nfunction _resolveWithPrefixes(\n prop: string,\n prefixes: string[],\n scopes: AnyObject[],\n proxy: ResolverProxy\n) {\n let value: unknown;\n for (const prefix of prefixes) {\n value = _resolve(readKey(prefix, prop), scopes);\n if (typeof value !== 'undefined') {\n return needsSubResolver(prop, value)\n ? createSubResolver(scopes, proxy, prop, value)\n : value;\n }\n }\n}\n\nfunction _resolve(key: string, scopes: AnyObject[]) {\n for (const scope of scopes) {\n if (!scope) {\n continue;\n }\n const value = scope[key];\n if (typeof value !== 'undefined') {\n return value;\n }\n }\n}\n\nfunction getKeysFromAllScopes(target: ResolverCache) {\n let keys = target._keys;\n if (!keys) {\n keys = target._keys = resolveKeysFromAllScopes(target._scopes);\n }\n return keys;\n}\n\nfunction resolveKeysFromAllScopes(scopes: AnyObject[]) {\n const set = new Set();\n for (const scope of scopes) {\n for (const key of Object.keys(scope).filter(k => !k.startsWith('_'))) {\n set.add(key);\n }\n }\n return Array.from(set);\n}\n\nexport function _parseObjectDataRadialScale(\n meta: ChartMeta<'line' | 'scatter'>,\n data: AnyObject[],\n start: number,\n count: number\n) {\n const {iScale} = meta;\n const {key = 'r'} = this._parsing;\n const parsed = new Array<{r: unknown}>(count);\n let i: number, ilen: number, index: number, item: AnyObject;\n\n for (i = 0, ilen = count; i < ilen; ++i) {\n index = i + start;\n item = data[index];\n parsed[i] = {\n r: iScale.parse(resolveObjectKey(item, key), index)\n };\n }\n return parsed;\n}\n", "import {almostEquals, distanceBetweenPoints, sign} from './helpers.math.js';\nimport {_isPointInArea} from './helpers.canvas.js';\nimport type {ChartArea} from '../types/index.js';\nimport type {SplinePoint} from '../types/geometric.js';\n\nconst EPSILON = Number.EPSILON || 1e-14;\n\ntype OptionalSplinePoint = SplinePoint | false\nconst getPoint = (points: SplinePoint[], i: number): OptionalSplinePoint => i < points.length && !points[i].skip && points[i];\nconst getValueAxis = (indexAxis: 'x' | 'y') => indexAxis === 'x' ? 'y' : 'x';\n\nexport function splineCurve(\n firstPoint: SplinePoint,\n middlePoint: SplinePoint,\n afterPoint: SplinePoint,\n t: number\n): {\n previous: SplinePoint\n next: SplinePoint\n } {\n // Props to Rob Spencer at scaled innovation for his post on splining between points\n // http://scaledinnovation.com/analytics/splines/aboutSplines.html\n\n // This function must also respect \"skipped\" points\n\n const previous = firstPoint.skip ? middlePoint : firstPoint;\n const current = middlePoint;\n const next = afterPoint.skip ? middlePoint : afterPoint;\n const d01 = distanceBetweenPoints(current, previous);\n const d12 = distanceBetweenPoints(next, current);\n\n let s01 = d01 / (d01 + d12);\n let s12 = d12 / (d01 + d12);\n\n // If all points are the same, s01 & s02 will be inf\n s01 = isNaN(s01) ? 0 : s01;\n s12 = isNaN(s12) ? 0 : s12;\n\n const fa = t * s01; // scaling factor for triangle Ta\n const fb = t * s12;\n\n return {\n previous: {\n x: current.x - fa * (next.x - previous.x),\n y: current.y - fa * (next.y - previous.y)\n },\n next: {\n x: current.x + fb * (next.x - previous.x),\n y: current.y + fb * (next.y - previous.y)\n }\n };\n}\n\n/**\n * Adjust tangents to ensure monotonic properties\n */\nfunction monotoneAdjust(points: SplinePoint[], deltaK: number[], mK: number[]) {\n const pointsLen = points.length;\n\n let alphaK: number, betaK: number, tauK: number, squaredMagnitude: number, pointCurrent: OptionalSplinePoint;\n let pointAfter = getPoint(points, 0);\n for (let i = 0; i < pointsLen - 1; ++i) {\n pointCurrent = pointAfter;\n pointAfter = getPoint(points, i + 1);\n if (!pointCurrent || !pointAfter) {\n continue;\n }\n\n if (almostEquals(deltaK[i], 0, EPSILON)) {\n mK[i] = mK[i + 1] = 0;\n continue;\n }\n\n alphaK = mK[i] / deltaK[i];\n betaK = mK[i + 1] / deltaK[i];\n squaredMagnitude = Math.pow(alphaK, 2) + Math.pow(betaK, 2);\n if (squaredMagnitude <= 9) {\n continue;\n }\n\n tauK = 3 / Math.sqrt(squaredMagnitude);\n mK[i] = alphaK * tauK * deltaK[i];\n mK[i + 1] = betaK * tauK * deltaK[i];\n }\n}\n\nfunction monotoneCompute(points: SplinePoint[], mK: number[], indexAxis: 'x' | 'y' = 'x') {\n const valueAxis = getValueAxis(indexAxis);\n const pointsLen = points.length;\n let delta: number, pointBefore: OptionalSplinePoint, pointCurrent: OptionalSplinePoint;\n let pointAfter = getPoint(points, 0);\n\n for (let i = 0; i < pointsLen; ++i) {\n pointBefore = pointCurrent;\n pointCurrent = pointAfter;\n pointAfter = getPoint(points, i + 1);\n if (!pointCurrent) {\n continue;\n }\n\n const iPixel = pointCurrent[indexAxis];\n const vPixel = pointCurrent[valueAxis];\n if (pointBefore) {\n delta = (iPixel - pointBefore[indexAxis]) / 3;\n pointCurrent[`cp1${indexAxis}`] = iPixel - delta;\n pointCurrent[`cp1${valueAxis}`] = vPixel - delta * mK[i];\n }\n if (pointAfter) {\n delta = (pointAfter[indexAxis] - iPixel) / 3;\n pointCurrent[`cp2${indexAxis}`] = iPixel + delta;\n pointCurrent[`cp2${valueAxis}`] = vPixel + delta * mK[i];\n }\n }\n}\n\n/**\n * This function calculates Bézier control points in a similar way than |splineCurve|,\n * but preserves monotonicity of the provided data and ensures no local extremums are added\n * between the dataset discrete points due to the interpolation.\n * See : https://en.wikipedia.org/wiki/Monotone_cubic_interpolation\n */\nexport function splineCurveMonotone(points: SplinePoint[], indexAxis: 'x' | 'y' = 'x') {\n const valueAxis = getValueAxis(indexAxis);\n const pointsLen = points.length;\n const deltaK: number[] = Array(pointsLen).fill(0);\n const mK: number[] = Array(pointsLen);\n\n // Calculate slopes (deltaK) and initialize tangents (mK)\n let i, pointBefore: OptionalSplinePoint, pointCurrent: OptionalSplinePoint;\n let pointAfter = getPoint(points, 0);\n\n for (i = 0; i < pointsLen; ++i) {\n pointBefore = pointCurrent;\n pointCurrent = pointAfter;\n pointAfter = getPoint(points, i + 1);\n if (!pointCurrent) {\n continue;\n }\n\n if (pointAfter) {\n const slopeDelta = pointAfter[indexAxis] - pointCurrent[indexAxis];\n\n // In the case of two points that appear at the same x pixel, slopeDeltaX is 0\n deltaK[i] = slopeDelta !== 0 ? (pointAfter[valueAxis] - pointCurrent[valueAxis]) / slopeDelta : 0;\n }\n mK[i] = !pointBefore ? deltaK[i]\n : !pointAfter ? deltaK[i - 1]\n : (sign(deltaK[i - 1]) !== sign(deltaK[i])) ? 0\n : (deltaK[i - 1] + deltaK[i]) / 2;\n }\n\n monotoneAdjust(points, deltaK, mK);\n\n monotoneCompute(points, mK, indexAxis);\n}\n\nfunction capControlPoint(pt: number, min: number, max: number) {\n return Math.max(Math.min(pt, max), min);\n}\n\nfunction capBezierPoints(points: SplinePoint[], area: ChartArea) {\n let i, ilen, point, inArea, inAreaPrev;\n let inAreaNext = _isPointInArea(points[0], area);\n for (i = 0, ilen = points.length; i < ilen; ++i) {\n inAreaPrev = inArea;\n inArea = inAreaNext;\n inAreaNext = i < ilen - 1 && _isPointInArea(points[i + 1], area);\n if (!inArea) {\n continue;\n }\n point = points[i];\n if (inAreaPrev) {\n point.cp1x = capControlPoint(point.cp1x, area.left, area.right);\n point.cp1y = capControlPoint(point.cp1y, area.top, area.bottom);\n }\n if (inAreaNext) {\n point.cp2x = capControlPoint(point.cp2x, area.left, area.right);\n point.cp2y = capControlPoint(point.cp2y, area.top, area.bottom);\n }\n }\n}\n\n/**\n * @private\n */\nexport function _updateBezierControlPoints(\n points: SplinePoint[],\n options,\n area: ChartArea,\n loop: boolean,\n indexAxis: 'x' | 'y'\n) {\n let i: number, ilen: number, point: SplinePoint, controlPoints: ReturnType;\n\n // Only consider points that are drawn in case the spanGaps option is used\n if (options.spanGaps) {\n points = points.filter((pt) => !pt.skip);\n }\n\n if (options.cubicInterpolationMode === 'monotone') {\n splineCurveMonotone(points, indexAxis);\n } else {\n let prev = loop ? points[points.length - 1] : points[0];\n for (i = 0, ilen = points.length; i < ilen; ++i) {\n point = points[i];\n controlPoints = splineCurve(\n prev,\n point,\n points[Math.min(i + 1, ilen - (loop ? 0 : 1)) % ilen],\n options.tension\n );\n point.cp1x = controlPoints.previous.x;\n point.cp1y = controlPoints.previous.y;\n point.cp2x = controlPoints.next.x;\n point.cp2y = controlPoints.next.y;\n prev = point;\n }\n }\n\n if (options.capBezierPoints) {\n capBezierPoints(points, area);\n }\n}\n", "import type {ChartArea, Scale} from '../types/index.js';\nimport type PrivateChart from '../core/core.controller.js';\nimport type {Chart, ChartEvent} from '../types.js';\nimport {INFINITY} from './helpers.math.js';\n\n/**\n * @private\n */\nexport function _isDomSupported(): boolean {\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}\n\n/**\n * @private\n */\nexport function _getParentNode(domNode: HTMLCanvasElement): HTMLCanvasElement {\n let parent = domNode.parentNode;\n if (parent && parent.toString() === '[object ShadowRoot]') {\n parent = (parent as ShadowRoot).host;\n }\n return parent as HTMLCanvasElement;\n}\n\n/**\n * convert max-width/max-height values that may be percentages into a number\n * @private\n */\n\nfunction parseMaxStyle(styleValue: string | number, node: HTMLElement, parentProperty: string) {\n let valueInPixels: number;\n if (typeof styleValue === 'string') {\n valueInPixels = parseInt(styleValue, 10);\n\n if (styleValue.indexOf('%') !== -1) {\n // percentage * size in dimension\n valueInPixels = (valueInPixels / 100) * node.parentNode[parentProperty];\n }\n } else {\n valueInPixels = styleValue;\n }\n\n return valueInPixels;\n}\n\nconst getComputedStyle = (element: HTMLElement): CSSStyleDeclaration =>\n element.ownerDocument.defaultView.getComputedStyle(element, null);\n\nexport function getStyle(el: HTMLElement, property: string): string {\n return getComputedStyle(el).getPropertyValue(property);\n}\n\nconst positions = ['top', 'right', 'bottom', 'left'];\nfunction getPositionedStyle(styles: CSSStyleDeclaration, style: string, suffix?: string): ChartArea {\n const result = {} as ChartArea;\n suffix = suffix ? '-' + suffix : '';\n for (let i = 0; i < 4; i++) {\n const pos = positions[i];\n result[pos] = parseFloat(styles[style + '-' + pos + suffix]) || 0;\n }\n result.width = result.left + result.right;\n result.height = result.top + result.bottom;\n return result;\n}\n\nconst useOffsetPos = (x: number, y: number, target: HTMLElement | EventTarget) =>\n (x > 0 || y > 0) && (!target || !(target as HTMLElement).shadowRoot);\n\n/**\n * @param e\n * @param canvas\n * @returns Canvas position\n */\nfunction getCanvasPosition(\n e: Event | TouchEvent | MouseEvent,\n canvas: HTMLCanvasElement\n): {\n x: number;\n y: number;\n box: boolean;\n } {\n const touches = (e as TouchEvent).touches;\n const source = (touches && touches.length ? touches[0] : e) as MouseEvent;\n const {offsetX, offsetY} = source as MouseEvent;\n let box = false;\n let x, y;\n if (useOffsetPos(offsetX, offsetY, e.target)) {\n x = offsetX;\n y = offsetY;\n } else {\n const rect = canvas.getBoundingClientRect();\n x = source.clientX - rect.left;\n y = source.clientY - rect.top;\n box = true;\n }\n return {x, y, box};\n}\n\n/**\n * Gets an event's x, y coordinates, relative to the chart area\n * @param event\n * @param chart\n * @returns x and y coordinates of the event\n */\n\nexport function getRelativePosition(\n event: Event | ChartEvent | TouchEvent | MouseEvent,\n chart: Chart | PrivateChart\n): { x: number; y: number } {\n if ('native' in event) {\n return event;\n }\n\n const {canvas, currentDevicePixelRatio} = chart;\n const style = getComputedStyle(canvas);\n const borderBox = style.boxSizing === 'border-box';\n const paddings = getPositionedStyle(style, 'padding');\n const borders = getPositionedStyle(style, 'border', 'width');\n const {x, y, box} = getCanvasPosition(event, canvas);\n const xOffset = paddings.left + (box && borders.left);\n const yOffset = paddings.top + (box && borders.top);\n\n let {width, height} = chart;\n if (borderBox) {\n width -= paddings.width + borders.width;\n height -= paddings.height + borders.height;\n }\n return {\n x: Math.round((x - xOffset) / width * canvas.width / currentDevicePixelRatio),\n y: Math.round((y - yOffset) / height * canvas.height / currentDevicePixelRatio)\n };\n}\n\nfunction getContainerSize(canvas: HTMLCanvasElement, width: number, height: number): Partial {\n let maxWidth: number, maxHeight: number;\n\n if (width === undefined || height === undefined) {\n const container = canvas && _getParentNode(canvas);\n if (!container) {\n width = canvas.clientWidth;\n height = canvas.clientHeight;\n } else {\n const rect = container.getBoundingClientRect(); // this is the border box of the container\n const containerStyle = getComputedStyle(container);\n const containerBorder = getPositionedStyle(containerStyle, 'border', 'width');\n const containerPadding = getPositionedStyle(containerStyle, 'padding');\n width = rect.width - containerPadding.width - containerBorder.width;\n height = rect.height - containerPadding.height - containerBorder.height;\n maxWidth = parseMaxStyle(containerStyle.maxWidth, container, 'clientWidth');\n maxHeight = parseMaxStyle(containerStyle.maxHeight, container, 'clientHeight');\n }\n }\n return {\n width,\n height,\n maxWidth: maxWidth || INFINITY,\n maxHeight: maxHeight || INFINITY\n };\n}\n\nconst round1 = (v: number) => Math.round(v * 10) / 10;\n\n// eslint-disable-next-line complexity\nexport function getMaximumSize(\n canvas: HTMLCanvasElement,\n bbWidth?: number,\n bbHeight?: number,\n aspectRatio?: number\n): { width: number; height: number } {\n const style = getComputedStyle(canvas);\n const margins = getPositionedStyle(style, 'margin');\n const maxWidth = parseMaxStyle(style.maxWidth, canvas, 'clientWidth') || INFINITY;\n const maxHeight = parseMaxStyle(style.maxHeight, canvas, 'clientHeight') || INFINITY;\n const containerSize = getContainerSize(canvas, bbWidth, bbHeight);\n let {width, height} = containerSize;\n\n if (style.boxSizing === 'content-box') {\n const borders = getPositionedStyle(style, 'border', 'width');\n const paddings = getPositionedStyle(style, 'padding');\n width -= paddings.width + borders.width;\n height -= paddings.height + borders.height;\n }\n width = Math.max(0, width - margins.width);\n height = Math.max(0, aspectRatio ? width / aspectRatio : height - margins.height);\n width = round1(Math.min(width, maxWidth, containerSize.maxWidth));\n height = round1(Math.min(height, maxHeight, containerSize.maxHeight));\n if (width && !height) {\n // https://github.com/chartjs/Chart.js/issues/4659\n // If the canvas has width, but no height, default to aspectRatio of 2 (canvas default)\n height = round1(width / 2);\n }\n\n const maintainHeight = bbWidth !== undefined || bbHeight !== undefined;\n\n if (maintainHeight && aspectRatio && containerSize.height && height > containerSize.height) {\n height = containerSize.height;\n width = round1(Math.floor(height * aspectRatio));\n }\n\n return {width, height};\n}\n\n/**\n * @param chart\n * @param forceRatio\n * @param forceStyle\n * @returns True if the canvas context size or transformation has changed.\n */\nexport function retinaScale(\n chart: Chart | PrivateChart,\n forceRatio: number,\n forceStyle?: boolean\n): boolean | void {\n const pixelRatio = forceRatio || 1;\n const deviceHeight = Math.floor(chart.height * pixelRatio);\n const deviceWidth = Math.floor(chart.width * pixelRatio);\n\n (chart as PrivateChart).height = Math.floor(chart.height);\n (chart as PrivateChart).width = Math.floor(chart.width);\n\n const canvas = chart.canvas;\n\n // If no style has been set on the canvas, the render size is used as display size,\n // making the chart visually bigger, so let's enforce it to the \"correct\" values.\n // See https://github.com/chartjs/Chart.js/issues/3575\n if (canvas.style && (forceStyle || (!canvas.style.height && !canvas.style.width))) {\n canvas.style.height = `${chart.height}px`;\n canvas.style.width = `${chart.width}px`;\n }\n\n if (chart.currentDevicePixelRatio !== pixelRatio\n || canvas.height !== deviceHeight\n || canvas.width !== deviceWidth) {\n (chart as PrivateChart).currentDevicePixelRatio = pixelRatio;\n canvas.height = deviceHeight;\n canvas.width = deviceWidth;\n chart.ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\n return true;\n }\n return false;\n}\n\n/**\n * Detects support for options object argument in addEventListener.\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support\n * @private\n */\nexport const supportsEventListenerOptions = (function() {\n let passiveSupported = false;\n try {\n const options = {\n get passive() { // This function will be called when the browser attempts to access the passive property.\n passiveSupported = true;\n return false;\n }\n } as EventListenerOptions;\n\n if (_isDomSupported()) {\n window.addEventListener('test', null, options);\n window.removeEventListener('test', null, options);\n }\n } catch (e) {\n // continue regardless of error\n }\n return passiveSupported;\n}());\n\n/**\n * The \"used\" size is the final value of a dimension property after all calculations have\n * been performed. This method uses the computed style of `element` but returns undefined\n * if the computed style is not expressed in pixels. That can happen in some cases where\n * `element` has a size relative to its parent and this last one is not yet displayed,\n * for example because of `display: none` on a parent node.\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/used_value\n * @returns Size in pixels or undefined if unknown.\n */\n\nexport function readUsedSize(\n element: HTMLElement,\n property: 'width' | 'height'\n): number | undefined {\n const value = getStyle(element, property);\n const matches = value && value.match(/^(\\d+)(\\.\\d+)?px$/);\n return matches ? +matches[1] : undefined;\n}\n", "import type {Point, SplinePoint} from '../types/geometric.js';\n\n/**\n * @private\n */\nexport function _pointInLine(p1: Point, p2: Point, t: number, mode?) { // eslint-disable-line @typescript-eslint/no-unused-vars\n return {\n x: p1.x + t * (p2.x - p1.x),\n y: p1.y + t * (p2.y - p1.y)\n };\n}\n\n/**\n * @private\n */\nexport function _steppedInterpolation(\n p1: Point,\n p2: Point,\n t: number, mode: 'middle' | 'after' | unknown\n) {\n return {\n x: p1.x + t * (p2.x - p1.x),\n y: mode === 'middle' ? t < 0.5 ? p1.y : p2.y\n : mode === 'after' ? t < 1 ? p1.y : p2.y\n : t > 0 ? p2.y : p1.y\n };\n}\n\n/**\n * @private\n */\nexport function _bezierInterpolation(p1: SplinePoint, p2: SplinePoint, t: number, mode?) { // eslint-disable-line @typescript-eslint/no-unused-vars\n const cp1 = {x: p1.cp2x, y: p1.cp2y};\n const cp2 = {x: p2.cp1x, y: p2.cp1y};\n const a = _pointInLine(p1, cp1, t);\n const b = _pointInLine(cp1, cp2, t);\n const c = _pointInLine(cp2, p2, t);\n const d = _pointInLine(a, b, t);\n const e = _pointInLine(b, c, t);\n return _pointInLine(d, e, t);\n}\n", "export interface RTLAdapter {\n x(x: number): number;\n setWidth(w: number): void;\n textAlign(align: 'center' | 'left' | 'right'): 'center' | 'left' | 'right';\n xPlus(x: number, value: number): number;\n leftForLtr(x: number, itemWidth: number): number;\n}\n\nconst getRightToLeftAdapter = function(rectX: number, width: number): RTLAdapter {\n return {\n x(x) {\n return rectX + rectX + width - x;\n },\n setWidth(w) {\n width = w;\n },\n textAlign(align) {\n if (align === 'center') {\n return align;\n }\n return align === 'right' ? 'left' : 'right';\n },\n xPlus(x, value) {\n return x - value;\n },\n leftForLtr(x, itemWidth) {\n return x - itemWidth;\n },\n };\n};\n\nconst getLeftToRightAdapter = function(): RTLAdapter {\n return {\n x(x) {\n return x;\n },\n setWidth(w) { // eslint-disable-line no-unused-vars\n },\n textAlign(align) {\n return align;\n },\n xPlus(x, value) {\n return x + value;\n },\n leftForLtr(x, _itemWidth) { // eslint-disable-line @typescript-eslint/no-unused-vars\n return x;\n },\n };\n};\n\nexport function getRtlAdapter(rtl: boolean, rectX: number, width: number) {\n return rtl ? getRightToLeftAdapter(rectX, width) : getLeftToRightAdapter();\n}\n\nexport function overrideTextDirection(ctx: CanvasRenderingContext2D, direction: 'ltr' | 'rtl') {\n let style: CSSStyleDeclaration, original: [string, string];\n if (direction === 'ltr' || direction === 'rtl') {\n style = ctx.canvas.style;\n original = [\n style.getPropertyValue('direction'),\n style.getPropertyPriority('direction'),\n ];\n\n style.setProperty('direction', direction, 'important');\n (ctx as { prevTextDirection?: [string, string] }).prevTextDirection = original;\n }\n}\n\nexport function restoreTextDirection(ctx: CanvasRenderingContext2D, original?: [string, string]) {\n if (original !== undefined) {\n delete (ctx as { prevTextDirection?: [string, string] }).prevTextDirection;\n ctx.canvas.style.setProperty('direction', original[0], original[1]);\n }\n}\n", "import {_angleBetween, _angleDiff, _isBetween, _normalizeAngle} from './helpers.math.js';\nimport {createContext} from './helpers.options.js';\nimport {isPatternOrGradient} from './helpers.color.js';\n\n/**\n * @typedef { import('../elements/element.line.js').default } LineElement\n * @typedef { import('../elements/element.point.js').default } PointElement\n * @typedef {{start: number, end: number, loop: boolean, style?: any}} Segment\n */\n\nfunction propertyFn(property) {\n if (property === 'angle') {\n return {\n between: _angleBetween,\n compare: _angleDiff,\n normalize: _normalizeAngle,\n };\n }\n return {\n between: _isBetween,\n compare: (a, b) => a - b,\n normalize: x => x\n };\n}\n\nfunction normalizeSegment({start, end, count, loop, style}) {\n return {\n start: start % count,\n end: end % count,\n loop: loop && (end - start + 1) % count === 0,\n style\n };\n}\n\nfunction getSegment(segment, points, bounds) {\n const {property, start: startBound, end: endBound} = bounds;\n const {between, normalize} = propertyFn(property);\n const count = points.length;\n // eslint-disable-next-line prefer-const\n let {start, end, loop} = segment;\n let i, ilen;\n\n if (loop) {\n start += count;\n end += count;\n for (i = 0, ilen = count; i < ilen; ++i) {\n if (!between(normalize(points[start % count][property]), startBound, endBound)) {\n break;\n }\n start--;\n end--;\n }\n start %= count;\n end %= count;\n }\n\n if (end < start) {\n end += count;\n }\n return {start, end, loop, style: segment.style};\n}\n\n/**\n * Returns the sub-segment(s) of a line segment that fall in the given bounds\n * @param {object} segment\n * @param {number} segment.start - start index of the segment, referring the points array\n * @param {number} segment.end - end index of the segment, referring the points array\n * @param {boolean} segment.loop - indicates that the segment is a loop\n * @param {object} [segment.style] - segment style\n * @param {PointElement[]} points - the points that this segment refers to\n * @param {object} [bounds]\n * @param {string} bounds.property - the property of a `PointElement` we are bounding. `x`, `y` or `angle`.\n * @param {number} bounds.start - start value of the property\n * @param {number} bounds.end - end value of the property\n * @private\n **/\nexport function _boundSegment(segment, points, bounds) {\n if (!bounds) {\n return [segment];\n }\n\n const {property, start: startBound, end: endBound} = bounds;\n const count = points.length;\n const {compare, between, normalize} = propertyFn(property);\n const {start, end, loop, style} = getSegment(segment, points, bounds);\n\n const result = [];\n let inside = false;\n let subStart = null;\n let value, point, prevValue;\n\n const startIsBefore = () => between(startBound, prevValue, value) && compare(startBound, prevValue) !== 0;\n const endIsBefore = () => compare(endBound, value) === 0 || between(endBound, prevValue, value);\n const shouldStart = () => inside || startIsBefore();\n const shouldStop = () => !inside || endIsBefore();\n\n for (let i = start, prev = start; i <= end; ++i) {\n point = points[i % count];\n\n if (point.skip) {\n continue;\n }\n\n value = normalize(point[property]);\n\n if (value === prevValue) {\n continue;\n }\n\n inside = between(value, startBound, endBound);\n\n if (subStart === null && shouldStart()) {\n subStart = compare(value, startBound) === 0 ? i : prev;\n }\n\n if (subStart !== null && shouldStop()) {\n result.push(normalizeSegment({start: subStart, end: i, loop, count, style}));\n subStart = null;\n }\n prev = i;\n prevValue = value;\n }\n\n if (subStart !== null) {\n result.push(normalizeSegment({start: subStart, end, loop, count, style}));\n }\n\n return result;\n}\n\n\n/**\n * Returns the segments of the line that are inside given bounds\n * @param {LineElement} line\n * @param {object} [bounds]\n * @param {string} bounds.property - the property we are bounding with. `x`, `y` or `angle`.\n * @param {number} bounds.start - start value of the `property`\n * @param {number} bounds.end - end value of the `property`\n * @private\n */\nexport function _boundSegments(line, bounds) {\n const result = [];\n const segments = line.segments;\n\n for (let i = 0; i < segments.length; i++) {\n const sub = _boundSegment(segments[i], line.points, bounds);\n if (sub.length) {\n result.push(...sub);\n }\n }\n return result;\n}\n\n/**\n * Find start and end index of a line.\n */\nfunction findStartAndEnd(points, count, loop, spanGaps) {\n let start = 0;\n let end = count - 1;\n\n if (loop && !spanGaps) {\n // loop and not spanning gaps, first find a gap to start from\n while (start < count && !points[start].skip) {\n start++;\n }\n }\n\n // find first non skipped point (after the first gap possibly)\n while (start < count && points[start].skip) {\n start++;\n }\n\n // if we looped to count, start needs to be 0\n start %= count;\n\n if (loop) {\n // loop will go past count, if start > 0\n end += start;\n }\n\n while (end > start && points[end % count].skip) {\n end--;\n }\n\n // end could be more than count, normalize\n end %= count;\n\n return {start, end};\n}\n\n/**\n * Compute solid segments from Points, when spanGaps === false\n * @param {PointElement[]} points - the points\n * @param {number} start - start index\n * @param {number} max - max index (can go past count on a loop)\n * @param {boolean} loop - boolean indicating that this would be a loop if no gaps are found\n */\nfunction solidSegments(points, start, max, loop) {\n const count = points.length;\n const result = [];\n let last = start;\n let prev = points[start];\n let end;\n\n for (end = start + 1; end <= max; ++end) {\n const cur = points[end % count];\n if (cur.skip || cur.stop) {\n if (!prev.skip) {\n loop = false;\n result.push({start: start % count, end: (end - 1) % count, loop});\n // @ts-ignore\n start = last = cur.stop ? end : null;\n }\n } else {\n last = end;\n if (prev.skip) {\n start = end;\n }\n }\n prev = cur;\n }\n\n if (last !== null) {\n result.push({start: start % count, end: last % count, loop});\n }\n\n return result;\n}\n\n/**\n * Compute the continuous segments that define the whole line\n * There can be skipped points within a segment, if spanGaps is true.\n * @param {LineElement} line\n * @param {object} [segmentOptions]\n * @return {Segment[]}\n * @private\n */\nexport function _computeSegments(line, segmentOptions) {\n const points = line.points;\n const spanGaps = line.options.spanGaps;\n const count = points.length;\n\n if (!count) {\n return [];\n }\n\n const loop = !!line._loop;\n const {start, end} = findStartAndEnd(points, count, loop, spanGaps);\n\n if (spanGaps === true) {\n return splitByStyles(line, [{start, end, loop}], points, segmentOptions);\n }\n\n const max = end < start ? end + count : end;\n const completeLoop = !!line._fullLoop && start === 0 && end === count - 1;\n return splitByStyles(line, solidSegments(points, start, max, completeLoop), points, segmentOptions);\n}\n\n/**\n * @param {Segment[]} segments\n * @param {PointElement[]} points\n * @param {object} [segmentOptions]\n * @return {Segment[]}\n */\nfunction splitByStyles(line, segments, points, segmentOptions) {\n if (!segmentOptions || !segmentOptions.setContext || !points) {\n return segments;\n }\n return doSplitByStyles(line, segments, points, segmentOptions);\n}\n\n/**\n * @param {LineElement} line\n * @param {Segment[]} segments\n * @param {PointElement[]} points\n * @param {object} [segmentOptions]\n * @return {Segment[]}\n */\nfunction doSplitByStyles(line, segments, points, segmentOptions) {\n const chartContext = line._chart.getContext();\n const baseStyle = readStyle(line.options);\n const {_datasetIndex: datasetIndex, options: {spanGaps}} = line;\n const count = points.length;\n const result = [];\n let prevStyle = baseStyle;\n let start = segments[0].start;\n let i = start;\n\n function addStyle(s, e, l, st) {\n const dir = spanGaps ? -1 : 1;\n if (s === e) {\n return;\n }\n // Style can not start/end on a skipped point, adjust indices accordingly\n s += count;\n while (points[s % count].skip) {\n s -= dir;\n }\n while (points[e % count].skip) {\n e += dir;\n }\n if (s % count !== e % count) {\n result.push({start: s % count, end: e % count, loop: l, style: st});\n prevStyle = st;\n start = e % count;\n }\n }\n\n for (const segment of segments) {\n start = spanGaps ? start : segment.start;\n let prev = points[start % count];\n let style;\n for (i = start + 1; i <= segment.end; i++) {\n const pt = points[i % count];\n style = readStyle(segmentOptions.setContext(createContext(chartContext, {\n type: 'segment',\n p0: prev,\n p1: pt,\n p0DataIndex: (i - 1) % count,\n p1DataIndex: i % count,\n datasetIndex\n })));\n if (styleChanged(style, prevStyle)) {\n addStyle(start, i - 1, segment.loop, prevStyle);\n }\n prev = pt;\n prevStyle = style;\n }\n if (start < i - 1) {\n addStyle(start, i - 1, segment.loop, prevStyle);\n }\n }\n\n return result;\n}\n\nfunction readStyle(options) {\n return {\n backgroundColor: options.backgroundColor,\n borderCapStyle: options.borderCapStyle,\n borderDash: options.borderDash,\n borderDashOffset: options.borderDashOffset,\n borderJoinStyle: options.borderJoinStyle,\n borderWidth: options.borderWidth,\n borderColor: options.borderColor\n };\n}\n\nfunction styleChanged(style, prevStyle) {\n if (!prevStyle) {\n return false;\n }\n const cache = [];\n const replacer = function(key, value) {\n if (!isPatternOrGradient(value)) {\n return value;\n }\n if (!cache.includes(value)) {\n cache.push(value);\n }\n return cache.indexOf(value);\n };\n return JSON.stringify(style, replacer) !== JSON.stringify(prevStyle, replacer);\n}\n", "import {requestAnimFrame} from '../helpers/helpers.extras.js';\n\n/**\n * @typedef { import('./core.animation.js').default } Animation\n * @typedef { import('./core.controller.js').default } Chart\n */\n\n/**\n * Please use the module's default export which provides a singleton instance\n * Note: class is export for typedoc\n */\nexport class Animator {\n constructor() {\n this._request = null;\n this._charts = new Map();\n this._running = false;\n this._lastDate = undefined;\n }\n\n /**\n\t * @private\n\t */\n _notify(chart, anims, date, type) {\n const callbacks = anims.listeners[type];\n const numSteps = anims.duration;\n\n callbacks.forEach(fn => fn({\n chart,\n initial: anims.initial,\n numSteps,\n currentStep: Math.min(date - anims.start, numSteps)\n }));\n }\n\n /**\n\t * @private\n\t */\n _refresh() {\n if (this._request) {\n return;\n }\n this._running = true;\n\n this._request = requestAnimFrame.call(window, () => {\n this._update();\n this._request = null;\n\n if (this._running) {\n this._refresh();\n }\n });\n }\n\n /**\n\t * @private\n\t */\n _update(date = Date.now()) {\n let remaining = 0;\n\n this._charts.forEach((anims, chart) => {\n if (!anims.running || !anims.items.length) {\n return;\n }\n const items = anims.items;\n let i = items.length - 1;\n let draw = false;\n let item;\n\n for (; i >= 0; --i) {\n item = items[i];\n\n if (item._active) {\n if (item._total > anims.duration) {\n // if the animation has been updated and its duration prolonged,\n // update to total duration of current animations run (for progress event)\n anims.duration = item._total;\n }\n item.tick(date);\n draw = true;\n } else {\n // Remove the item by replacing it with last item and removing the last\n // A lot faster than splice.\n items[i] = items[items.length - 1];\n items.pop();\n }\n }\n\n if (draw) {\n chart.draw();\n this._notify(chart, anims, date, 'progress');\n }\n\n if (!items.length) {\n anims.running = false;\n this._notify(chart, anims, date, 'complete');\n anims.initial = false;\n }\n\n remaining += items.length;\n });\n\n this._lastDate = date;\n\n if (remaining === 0) {\n this._running = false;\n }\n }\n\n /**\n\t * @private\n\t */\n _getAnims(chart) {\n const charts = this._charts;\n let anims = charts.get(chart);\n if (!anims) {\n anims = {\n running: false,\n initial: true,\n items: [],\n listeners: {\n complete: [],\n progress: []\n }\n };\n charts.set(chart, anims);\n }\n return anims;\n }\n\n /**\n\t * @param {Chart} chart\n\t * @param {string} event - event name\n\t * @param {Function} cb - callback\n\t */\n listen(chart, event, cb) {\n this._getAnims(chart).listeners[event].push(cb);\n }\n\n /**\n\t * Add animations\n\t * @param {Chart} chart\n\t * @param {Animation[]} items - animations\n\t */\n add(chart, items) {\n if (!items || !items.length) {\n return;\n }\n this._getAnims(chart).items.push(...items);\n }\n\n /**\n\t * Counts number of active animations for the chart\n\t * @param {Chart} chart\n\t */\n has(chart) {\n return this._getAnims(chart).items.length > 0;\n }\n\n /**\n\t * Start animating (all charts)\n\t * @param {Chart} chart\n\t */\n start(chart) {\n const anims = this._charts.get(chart);\n if (!anims) {\n return;\n }\n anims.running = true;\n anims.start = Date.now();\n anims.duration = anims.items.reduce((acc, cur) => Math.max(acc, cur._duration), 0);\n this._refresh();\n }\n\n running(chart) {\n if (!this._running) {\n return false;\n }\n const anims = this._charts.get(chart);\n if (!anims || !anims.running || !anims.items.length) {\n return false;\n }\n return true;\n }\n\n /**\n\t * Stop all animations for the chart\n\t * @param {Chart} chart\n\t */\n stop(chart) {\n const anims = this._charts.get(chart);\n if (!anims || !anims.items.length) {\n return;\n }\n const items = anims.items;\n let i = items.length - 1;\n\n for (; i >= 0; --i) {\n items[i].cancel();\n }\n anims.items = [];\n this._notify(chart, anims, Date.now(), 'complete');\n }\n\n /**\n\t * Remove chart from Animator\n\t * @param {Chart} chart\n\t */\n remove(chart) {\n return this._charts.delete(chart);\n }\n}\n\n// singleton instance\nexport default /* #__PURE__ */ new Animator();\n", "import effects from '../helpers/helpers.easing.js';\nimport {resolve} from '../helpers/helpers.options.js';\nimport {color as helpersColor} from '../helpers/helpers.color.js';\n\nconst transparent = 'transparent';\nconst interpolators = {\n boolean(from, to, factor) {\n return factor > 0.5 ? to : from;\n },\n /**\n * @param {string} from\n * @param {string} to\n * @param {number} factor\n */\n color(from, to, factor) {\n const c0 = helpersColor(from || transparent);\n const c1 = c0.valid && helpersColor(to || transparent);\n return c1 && c1.valid\n ? c1.mix(c0, factor).hexString()\n : to;\n },\n number(from, to, factor) {\n return from + (to - from) * factor;\n }\n};\n\nexport default class Animation {\n constructor(cfg, target, prop, to) {\n const currentValue = target[prop];\n\n to = resolve([cfg.to, to, currentValue, cfg.from]);\n const from = resolve([cfg.from, currentValue, to]);\n\n this._active = true;\n this._fn = cfg.fn || interpolators[cfg.type || typeof from];\n this._easing = effects[cfg.easing] || effects.linear;\n this._start = Math.floor(Date.now() + (cfg.delay || 0));\n this._duration = this._total = Math.floor(cfg.duration);\n this._loop = !!cfg.loop;\n this._target = target;\n this._prop = prop;\n this._from = from;\n this._to = to;\n this._promises = undefined;\n }\n\n active() {\n return this._active;\n }\n\n update(cfg, to, date) {\n if (this._active) {\n this._notify(false);\n\n const currentValue = this._target[this._prop];\n const elapsed = date - this._start;\n const remain = this._duration - elapsed;\n this._start = date;\n this._duration = Math.floor(Math.max(remain, cfg.duration));\n this._total += elapsed;\n this._loop = !!cfg.loop;\n this._to = resolve([cfg.to, to, currentValue, cfg.from]);\n this._from = resolve([cfg.from, currentValue, to]);\n }\n }\n\n cancel() {\n if (this._active) {\n // update current evaluated value, for smoother animations\n this.tick(Date.now());\n this._active = false;\n this._notify(false);\n }\n }\n\n tick(date) {\n const elapsed = date - this._start;\n const duration = this._duration;\n const prop = this._prop;\n const from = this._from;\n const loop = this._loop;\n const to = this._to;\n let factor;\n\n this._active = from !== to && (loop || (elapsed < duration));\n\n if (!this._active) {\n this._target[prop] = to;\n this._notify(true);\n return;\n }\n\n if (elapsed < 0) {\n this._target[prop] = from;\n return;\n }\n\n factor = (elapsed / duration) % 2;\n factor = loop && factor > 1 ? 2 - factor : factor;\n factor = this._easing(Math.min(1, Math.max(0, factor)));\n\n this._target[prop] = this._fn(from, to, factor);\n }\n\n wait() {\n const promises = this._promises || (this._promises = []);\n return new Promise((res, rej) => {\n promises.push({res, rej});\n });\n }\n\n _notify(resolved) {\n const method = resolved ? 'res' : 'rej';\n const promises = this._promises || [];\n for (let i = 0; i < promises.length; i++) {\n promises[i][method]();\n }\n }\n}\n", "import animator from './core.animator.js';\nimport Animation from './core.animation.js';\nimport defaults from './core.defaults.js';\nimport {isArray, isObject} from '../helpers/helpers.core.js';\n\nexport default class Animations {\n constructor(chart, config) {\n this._chart = chart;\n this._properties = new Map();\n this.configure(config);\n }\n\n configure(config) {\n if (!isObject(config)) {\n return;\n }\n\n const animationOptions = Object.keys(defaults.animation);\n const animatedProps = this._properties;\n\n Object.getOwnPropertyNames(config).forEach(key => {\n const cfg = config[key];\n if (!isObject(cfg)) {\n return;\n }\n const resolved = {};\n for (const option of animationOptions) {\n resolved[option] = cfg[option];\n }\n\n (isArray(cfg.properties) && cfg.properties || [key]).forEach((prop) => {\n if (prop === key || !animatedProps.has(prop)) {\n animatedProps.set(prop, resolved);\n }\n });\n });\n }\n\n /**\n\t * Utility to handle animation of `options`.\n\t * @private\n\t */\n _animateOptions(target, values) {\n const newOptions = values.options;\n const options = resolveTargetOptions(target, newOptions);\n if (!options) {\n return [];\n }\n\n const animations = this._createAnimations(options, newOptions);\n if (newOptions.$shared) {\n // Going to shared options:\n // After all animations are done, assign the shared options object to the element\n // So any new updates to the shared options are observed\n awaitAll(target.options.$animations, newOptions).then(() => {\n target.options = newOptions;\n }, () => {\n // rejected, noop\n });\n }\n\n return animations;\n }\n\n /**\n\t * @private\n\t */\n _createAnimations(target, values) {\n const animatedProps = this._properties;\n const animations = [];\n const running = target.$animations || (target.$animations = {});\n const props = Object.keys(values);\n const date = Date.now();\n let i;\n\n for (i = props.length - 1; i >= 0; --i) {\n const prop = props[i];\n if (prop.charAt(0) === '$') {\n continue;\n }\n\n if (prop === 'options') {\n animations.push(...this._animateOptions(target, values));\n continue;\n }\n const value = values[prop];\n let animation = running[prop];\n const cfg = animatedProps.get(prop);\n\n if (animation) {\n if (cfg && animation.active()) {\n // There is an existing active animation, let's update that\n animation.update(cfg, value, date);\n continue;\n } else {\n animation.cancel();\n }\n }\n if (!cfg || !cfg.duration) {\n // not animated, set directly to new value\n target[prop] = value;\n continue;\n }\n\n running[prop] = animation = new Animation(cfg, target, prop, value);\n animations.push(animation);\n }\n return animations;\n }\n\n\n /**\n\t * Update `target` properties to new values, using configured animations\n\t * @param {object} target - object to update\n\t * @param {object} values - new target properties\n\t * @returns {boolean|undefined} - `true` if animations were started\n\t **/\n update(target, values) {\n if (this._properties.size === 0) {\n // Nothing is animated, just apply the new values.\n Object.assign(target, values);\n return;\n }\n\n const animations = this._createAnimations(target, values);\n\n if (animations.length) {\n animator.add(this._chart, animations);\n return true;\n }\n }\n}\n\nfunction awaitAll(animations, properties) {\n const running = [];\n const keys = Object.keys(properties);\n for (let i = 0; i < keys.length; i++) {\n const anim = animations[keys[i]];\n if (anim && anim.active()) {\n running.push(anim.wait());\n }\n }\n // @ts-ignore\n return Promise.all(running);\n}\n\nfunction resolveTargetOptions(target, newOptions) {\n if (!newOptions) {\n return;\n }\n let options = target.options;\n if (!options) {\n target.options = newOptions;\n return;\n }\n if (options.$shared) {\n // Going from shared options to distinct one:\n // Create new options object containing the old shared values and start updating that.\n target.options = options = Object.assign({}, options, {$shared: false, $animations: {}});\n }\n return options;\n}\n", "import Animations from './core.animations.js';\nimport defaults from './core.defaults.js';\nimport {isArray, isFinite, isObject, valueOrDefault, resolveObjectKey, defined} from '../helpers/helpers.core.js';\nimport {listenArrayEvents, unlistenArrayEvents} from '../helpers/helpers.collection.js';\nimport {createContext, sign} from '../helpers/index.js';\n\n/**\n * @typedef { import('./core.controller.js').default } Chart\n * @typedef { import('./core.scale.js').default } Scale\n */\n\nfunction scaleClip(scale, allowedOverflow) {\n const opts = scale && scale.options || {};\n const reverse = opts.reverse;\n const min = opts.min === undefined ? allowedOverflow : 0;\n const max = opts.max === undefined ? allowedOverflow : 0;\n return {\n start: reverse ? max : min,\n end: reverse ? min : max\n };\n}\n\nfunction defaultClip(xScale, yScale, allowedOverflow) {\n if (allowedOverflow === false) {\n return false;\n }\n const x = scaleClip(xScale, allowedOverflow);\n const y = scaleClip(yScale, allowedOverflow);\n\n return {\n top: y.end,\n right: x.end,\n bottom: y.start,\n left: x.start\n };\n}\n\nfunction toClip(value) {\n let t, r, b, l;\n\n if (isObject(value)) {\n t = value.top;\n r = value.right;\n b = value.bottom;\n l = value.left;\n } else {\n t = r = b = l = value;\n }\n\n return {\n top: t,\n right: r,\n bottom: b,\n left: l,\n disabled: value === false\n };\n}\n\nfunction getSortedDatasetIndices(chart, filterVisible) {\n const keys = [];\n const metasets = chart._getSortedDatasetMetas(filterVisible);\n let i, ilen;\n\n for (i = 0, ilen = metasets.length; i < ilen; ++i) {\n keys.push(metasets[i].index);\n }\n return keys;\n}\n\nfunction applyStack(stack, value, dsIndex, options = {}) {\n const keys = stack.keys;\n const singleMode = options.mode === 'single';\n let i, ilen, datasetIndex, otherValue;\n\n if (value === null) {\n return;\n }\n\n let found = false;\n for (i = 0, ilen = keys.length; i < ilen; ++i) {\n datasetIndex = +keys[i];\n if (datasetIndex === dsIndex) {\n found = true;\n if (options.all) {\n continue;\n }\n break;\n }\n otherValue = stack.values[datasetIndex];\n if (isFinite(otherValue) && (singleMode || (value === 0 || sign(value) === sign(otherValue)))) {\n value += otherValue;\n }\n }\n\n if (!found && !options.all) {\n return 0;\n }\n\n return value;\n}\n\nfunction convertObjectDataToArray(data, meta) {\n const {iScale, vScale} = meta;\n const iAxisKey = iScale.axis === 'x' ? 'x' : 'y';\n const vAxisKey = vScale.axis === 'x' ? 'x' : 'y';\n const keys = Object.keys(data);\n const adata = new Array(keys.length);\n let i, ilen, key;\n for (i = 0, ilen = keys.length; i < ilen; ++i) {\n key = keys[i];\n adata[i] = {\n [iAxisKey]: key,\n [vAxisKey]: data[key]\n };\n }\n return adata;\n}\n\nfunction isStacked(scale, meta) {\n const stacked = scale && scale.options.stacked;\n return stacked || (stacked === undefined && meta.stack !== undefined);\n}\n\nfunction getStackKey(indexScale, valueScale, meta) {\n return `${indexScale.id}.${valueScale.id}.${meta.stack || meta.type}`;\n}\n\nfunction getUserBounds(scale) {\n const {min, max, minDefined, maxDefined} = scale.getUserBounds();\n return {\n min: minDefined ? min : Number.NEGATIVE_INFINITY,\n max: maxDefined ? max : Number.POSITIVE_INFINITY\n };\n}\n\nfunction getOrCreateStack(stacks, stackKey, indexValue) {\n const subStack = stacks[stackKey] || (stacks[stackKey] = {});\n return subStack[indexValue] || (subStack[indexValue] = {});\n}\n\nfunction getLastIndexInStack(stack, vScale, positive, type) {\n for (const meta of vScale.getMatchingVisibleMetas(type).reverse()) {\n const value = stack[meta.index];\n if ((positive && value > 0) || (!positive && value < 0)) {\n return meta.index;\n }\n }\n\n return null;\n}\n\nfunction updateStacks(controller, parsed) {\n const {chart, _cachedMeta: meta} = controller;\n const stacks = chart._stacks || (chart._stacks = {}); // map structure is {stackKey: {datasetIndex: value}}\n const {iScale, vScale, index: datasetIndex} = meta;\n const iAxis = iScale.axis;\n const vAxis = vScale.axis;\n const key = getStackKey(iScale, vScale, meta);\n const ilen = parsed.length;\n let stack;\n\n for (let i = 0; i < ilen; ++i) {\n const item = parsed[i];\n const {[iAxis]: index, [vAxis]: value} = item;\n const itemStacks = item._stacks || (item._stacks = {});\n stack = itemStacks[vAxis] = getOrCreateStack(stacks, key, index);\n stack[datasetIndex] = value;\n\n stack._top = getLastIndexInStack(stack, vScale, true, meta.type);\n stack._bottom = getLastIndexInStack(stack, vScale, false, meta.type);\n\n const visualValues = stack._visualValues || (stack._visualValues = {});\n visualValues[datasetIndex] = value;\n }\n}\n\nfunction getFirstScaleId(chart, axis) {\n const scales = chart.scales;\n return Object.keys(scales).filter(key => scales[key].axis === axis).shift();\n}\n\nfunction createDatasetContext(parent, index) {\n return createContext(parent,\n {\n active: false,\n dataset: undefined,\n datasetIndex: index,\n index,\n mode: 'default',\n type: 'dataset'\n }\n );\n}\n\nfunction createDataContext(parent, index, element) {\n return createContext(parent, {\n active: false,\n dataIndex: index,\n parsed: undefined,\n raw: undefined,\n element,\n index,\n mode: 'default',\n type: 'data'\n });\n}\n\nfunction clearStacks(meta, items) {\n // Not using meta.index here, because it might be already updated if the dataset changed location\n const datasetIndex = meta.controller.index;\n const axis = meta.vScale && meta.vScale.axis;\n if (!axis) {\n return;\n }\n\n items = items || meta._parsed;\n for (const parsed of items) {\n const stacks = parsed._stacks;\n if (!stacks || stacks[axis] === undefined || stacks[axis][datasetIndex] === undefined) {\n return;\n }\n delete stacks[axis][datasetIndex];\n if (stacks[axis]._visualValues !== undefined && stacks[axis]._visualValues[datasetIndex] !== undefined) {\n delete stacks[axis]._visualValues[datasetIndex];\n }\n }\n}\n\nconst isDirectUpdateMode = (mode) => mode === 'reset' || mode === 'none';\nconst cloneIfNotShared = (cached, shared) => shared ? cached : Object.assign({}, cached);\nconst createStack = (canStack, meta, chart) => canStack && !meta.hidden && meta._stacked\n && {keys: getSortedDatasetIndices(chart, true), values: null};\n\nexport default class DatasetController {\n\n /**\n * @type {any}\n */\n static defaults = {};\n\n /**\n * Element type used to generate a meta dataset (e.g. Chart.element.LineElement).\n */\n static datasetElementType = null;\n\n /**\n * Element type used to generate a meta data (e.g. Chart.element.PointElement).\n */\n static dataElementType = null;\n\n /**\n\t * @param {Chart} chart\n\t * @param {number} datasetIndex\n\t */\n constructor(chart, datasetIndex) {\n this.chart = chart;\n this._ctx = chart.ctx;\n this.index = datasetIndex;\n this._cachedDataOpts = {};\n this._cachedMeta = this.getMeta();\n this._type = this._cachedMeta.type;\n this.options = undefined;\n /** @type {boolean | object} */\n this._parsing = false;\n this._data = undefined;\n this._objectData = undefined;\n this._sharedOptions = undefined;\n this._drawStart = undefined;\n this._drawCount = undefined;\n this.enableOptionSharing = false;\n this.supportsDecimation = false;\n this.$context = undefined;\n this._syncList = [];\n this.datasetElementType = new.target.datasetElementType;\n this.dataElementType = new.target.dataElementType;\n\n this.initialize();\n }\n\n initialize() {\n const meta = this._cachedMeta;\n this.configure();\n this.linkScales();\n meta._stacked = isStacked(meta.vScale, meta);\n this.addElements();\n\n if (this.options.fill && !this.chart.isPluginEnabled('filler')) {\n console.warn(\"Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options\");\n }\n }\n\n updateIndex(datasetIndex) {\n if (this.index !== datasetIndex) {\n clearStacks(this._cachedMeta);\n }\n this.index = datasetIndex;\n }\n\n linkScales() {\n const chart = this.chart;\n const meta = this._cachedMeta;\n const dataset = this.getDataset();\n\n const chooseId = (axis, x, y, r) => axis === 'x' ? x : axis === 'r' ? r : y;\n\n const xid = meta.xAxisID = valueOrDefault(dataset.xAxisID, getFirstScaleId(chart, 'x'));\n const yid = meta.yAxisID = valueOrDefault(dataset.yAxisID, getFirstScaleId(chart, 'y'));\n const rid = meta.rAxisID = valueOrDefault(dataset.rAxisID, getFirstScaleId(chart, 'r'));\n const indexAxis = meta.indexAxis;\n const iid = meta.iAxisID = chooseId(indexAxis, xid, yid, rid);\n const vid = meta.vAxisID = chooseId(indexAxis, yid, xid, rid);\n meta.xScale = this.getScaleForId(xid);\n meta.yScale = this.getScaleForId(yid);\n meta.rScale = this.getScaleForId(rid);\n meta.iScale = this.getScaleForId(iid);\n meta.vScale = this.getScaleForId(vid);\n }\n\n getDataset() {\n return this.chart.data.datasets[this.index];\n }\n\n getMeta() {\n return this.chart.getDatasetMeta(this.index);\n }\n\n /**\n\t * @param {string} scaleID\n\t * @return {Scale}\n\t */\n getScaleForId(scaleID) {\n return this.chart.scales[scaleID];\n }\n\n /**\n\t * @private\n\t */\n _getOtherScale(scale) {\n const meta = this._cachedMeta;\n return scale === meta.iScale\n ? meta.vScale\n : meta.iScale;\n }\n\n reset() {\n this._update('reset');\n }\n\n /**\n\t * @private\n\t */\n _destroy() {\n const meta = this._cachedMeta;\n if (this._data) {\n unlistenArrayEvents(this._data, this);\n }\n if (meta._stacked) {\n clearStacks(meta);\n }\n }\n\n /**\n\t * @private\n\t */\n _dataCheck() {\n const dataset = this.getDataset();\n const data = dataset.data || (dataset.data = []);\n const _data = this._data;\n\n // In order to correctly handle data addition/deletion animation (and thus simulate\n // real-time charts), we need to monitor these data modifications and synchronize\n // the internal metadata accordingly.\n\n if (isObject(data)) {\n const meta = this._cachedMeta;\n this._data = convertObjectDataToArray(data, meta);\n } else if (_data !== data) {\n if (_data) {\n // This case happens when the user replaced the data array instance.\n unlistenArrayEvents(_data, this);\n // Discard old parsed data and stacks\n const meta = this._cachedMeta;\n clearStacks(meta);\n meta._parsed = [];\n }\n if (data && Object.isExtensible(data)) {\n listenArrayEvents(data, this);\n }\n this._syncList = [];\n this._data = data;\n }\n }\n\n addElements() {\n const meta = this._cachedMeta;\n\n this._dataCheck();\n\n if (this.datasetElementType) {\n meta.dataset = new this.datasetElementType();\n }\n }\n\n buildOrUpdateElements(resetNewElements) {\n const meta = this._cachedMeta;\n const dataset = this.getDataset();\n let stackChanged = false;\n\n this._dataCheck();\n\n // make sure cached _stacked status is current\n const oldStacked = meta._stacked;\n meta._stacked = isStacked(meta.vScale, meta);\n\n // detect change in stack option\n if (meta.stack !== dataset.stack) {\n stackChanged = true;\n // remove values from old stack\n clearStacks(meta);\n meta.stack = dataset.stack;\n }\n\n // Re-sync meta data in case the user replaced the data array or if we missed\n // any updates and so make sure that we handle number of datapoints changing.\n this._resyncElements(resetNewElements);\n\n // if stack changed, update stack values for the whole dataset\n if (stackChanged || oldStacked !== meta._stacked) {\n updateStacks(this, meta._parsed);\n meta._stacked = isStacked(meta.vScale, meta);\n }\n }\n\n /**\n\t * Merges user-supplied and default dataset-level options\n\t * @private\n\t */\n configure() {\n const config = this.chart.config;\n const scopeKeys = config.datasetScopeKeys(this._type);\n const scopes = config.getOptionScopes(this.getDataset(), scopeKeys, true);\n this.options = config.createResolver(scopes, this.getContext());\n this._parsing = this.options.parsing;\n this._cachedDataOpts = {};\n }\n\n /**\n\t * @param {number} start\n\t * @param {number} count\n\t */\n parse(start, count) {\n const {_cachedMeta: meta, _data: data} = this;\n const {iScale, _stacked} = meta;\n const iAxis = iScale.axis;\n\n let sorted = start === 0 && count === data.length ? true : meta._sorted;\n let prev = start > 0 && meta._parsed[start - 1];\n let i, cur, parsed;\n\n if (this._parsing === false) {\n meta._parsed = data;\n meta._sorted = true;\n parsed = data;\n } else {\n if (isArray(data[start])) {\n parsed = this.parseArrayData(meta, data, start, count);\n } else if (isObject(data[start])) {\n parsed = this.parseObjectData(meta, data, start, count);\n } else {\n parsed = this.parsePrimitiveData(meta, data, start, count);\n }\n\n const isNotInOrderComparedToPrev = () => cur[iAxis] === null || (prev && cur[iAxis] < prev[iAxis]);\n for (i = 0; i < count; ++i) {\n meta._parsed[i + start] = cur = parsed[i];\n if (sorted) {\n if (isNotInOrderComparedToPrev()) {\n sorted = false;\n }\n prev = cur;\n }\n }\n meta._sorted = sorted;\n }\n\n if (_stacked) {\n updateStacks(this, parsed);\n }\n }\n\n /**\n\t * Parse array of primitive values\n\t * @param {object} meta - dataset meta\n\t * @param {array} data - data array. Example [1,3,4]\n\t * @param {number} start - start index\n\t * @param {number} count - number of items to parse\n\t * @returns {object} parsed item - item containing index and a parsed value\n\t * for each scale id.\n\t * Example: {xScale0: 0, yScale0: 1}\n\t * @protected\n\t */\n parsePrimitiveData(meta, data, start, count) {\n const {iScale, vScale} = meta;\n const iAxis = iScale.axis;\n const vAxis = vScale.axis;\n const labels = iScale.getLabels();\n const singleScale = iScale === vScale;\n const parsed = new Array(count);\n let i, ilen, index;\n\n for (i = 0, ilen = count; i < ilen; ++i) {\n index = i + start;\n parsed[i] = {\n [iAxis]: singleScale || iScale.parse(labels[index], index),\n [vAxis]: vScale.parse(data[index], index)\n };\n }\n return parsed;\n }\n\n /**\n\t * Parse array of arrays\n\t * @param {object} meta - dataset meta\n\t * @param {array} data - data array. Example [[1,2],[3,4]]\n\t * @param {number} start - start index\n\t * @param {number} count - number of items to parse\n\t * @returns {object} parsed item - item containing index and a parsed value\n\t * for each scale id.\n\t * Example: {x: 0, y: 1}\n\t * @protected\n\t */\n parseArrayData(meta, data, start, count) {\n const {xScale, yScale} = meta;\n const parsed = new Array(count);\n let i, ilen, index, item;\n\n for (i = 0, ilen = count; i < ilen; ++i) {\n index = i + start;\n item = data[index];\n parsed[i] = {\n x: xScale.parse(item[0], index),\n y: yScale.parse(item[1], index)\n };\n }\n return parsed;\n }\n\n /**\n\t * Parse array of objects\n\t * @param {object} meta - dataset meta\n\t * @param {array} data - data array. Example [{x:1, y:5}, {x:2, y:10}]\n\t * @param {number} start - start index\n\t * @param {number} count - number of items to parse\n\t * @returns {object} parsed item - item containing index and a parsed value\n\t * for each scale id. _custom is optional\n\t * Example: {xScale0: 0, yScale0: 1, _custom: {r: 10, foo: 'bar'}}\n\t * @protected\n\t */\n parseObjectData(meta, data, start, count) {\n const {xScale, yScale} = meta;\n const {xAxisKey = 'x', yAxisKey = 'y'} = this._parsing;\n const parsed = new Array(count);\n let i, ilen, index, item;\n\n for (i = 0, ilen = count; i < ilen; ++i) {\n index = i + start;\n item = data[index];\n parsed[i] = {\n x: xScale.parse(resolveObjectKey(item, xAxisKey), index),\n y: yScale.parse(resolveObjectKey(item, yAxisKey), index)\n };\n }\n return parsed;\n }\n\n /**\n\t * @protected\n\t */\n getParsed(index) {\n return this._cachedMeta._parsed[index];\n }\n\n /**\n\t * @protected\n\t */\n getDataElement(index) {\n return this._cachedMeta.data[index];\n }\n\n /**\n\t * @protected\n\t */\n applyStack(scale, parsed, mode) {\n const chart = this.chart;\n const meta = this._cachedMeta;\n const value = parsed[scale.axis];\n const stack = {\n keys: getSortedDatasetIndices(chart, true),\n values: parsed._stacks[scale.axis]._visualValues\n };\n return applyStack(stack, value, meta.index, {mode});\n }\n\n /**\n\t * @protected\n\t */\n updateRangeFromParsed(range, scale, parsed, stack) {\n const parsedValue = parsed[scale.axis];\n let value = parsedValue === null ? NaN : parsedValue;\n const values = stack && parsed._stacks[scale.axis];\n if (stack && values) {\n stack.values = values;\n value = applyStack(stack, parsedValue, this._cachedMeta.index);\n }\n range.min = Math.min(range.min, value);\n range.max = Math.max(range.max, value);\n }\n\n /**\n\t * @protected\n\t */\n getMinMax(scale, canStack) {\n const meta = this._cachedMeta;\n const _parsed = meta._parsed;\n const sorted = meta._sorted && scale === meta.iScale;\n const ilen = _parsed.length;\n const otherScale = this._getOtherScale(scale);\n const stack = createStack(canStack, meta, this.chart);\n const range = {min: Number.POSITIVE_INFINITY, max: Number.NEGATIVE_INFINITY};\n const {min: otherMin, max: otherMax} = getUserBounds(otherScale);\n let i, parsed;\n\n function _skip() {\n parsed = _parsed[i];\n const otherValue = parsed[otherScale.axis];\n return !isFinite(parsed[scale.axis]) || otherMin > otherValue || otherMax < otherValue;\n }\n\n for (i = 0; i < ilen; ++i) {\n if (_skip()) {\n continue;\n }\n this.updateRangeFromParsed(range, scale, parsed, stack);\n if (sorted) {\n // if the data is sorted, we don't need to check further from this end of array\n break;\n }\n }\n if (sorted) {\n // in the sorted case, find first non-skipped value from other end of array\n for (i = ilen - 1; i >= 0; --i) {\n if (_skip()) {\n continue;\n }\n this.updateRangeFromParsed(range, scale, parsed, stack);\n break;\n }\n }\n return range;\n }\n\n getAllParsedValues(scale) {\n const parsed = this._cachedMeta._parsed;\n const values = [];\n let i, ilen, value;\n\n for (i = 0, ilen = parsed.length; i < ilen; ++i) {\n value = parsed[i][scale.axis];\n if (isFinite(value)) {\n values.push(value);\n }\n }\n return values;\n }\n\n /**\n\t * @return {number|boolean}\n\t * @protected\n\t */\n getMaxOverflow() {\n return false;\n }\n\n /**\n\t * @protected\n\t */\n getLabelAndValue(index) {\n const meta = this._cachedMeta;\n const iScale = meta.iScale;\n const vScale = meta.vScale;\n const parsed = this.getParsed(index);\n return {\n label: iScale ? '' + iScale.getLabelForValue(parsed[iScale.axis]) : '',\n value: vScale ? '' + vScale.getLabelForValue(parsed[vScale.axis]) : ''\n };\n }\n\n /**\n\t * @private\n\t */\n _update(mode) {\n const meta = this._cachedMeta;\n this.update(mode || 'default');\n meta._clip = toClip(valueOrDefault(this.options.clip, defaultClip(meta.xScale, meta.yScale, this.getMaxOverflow())));\n }\n\n /**\n\t * @param {string} mode\n\t */\n update(mode) {} // eslint-disable-line no-unused-vars\n\n draw() {\n const ctx = this._ctx;\n const chart = this.chart;\n const meta = this._cachedMeta;\n const elements = meta.data || [];\n const area = chart.chartArea;\n const active = [];\n const start = this._drawStart || 0;\n const count = this._drawCount || (elements.length - start);\n const drawActiveElementsOnTop = this.options.drawActiveElementsOnTop;\n let i;\n\n if (meta.dataset) {\n meta.dataset.draw(ctx, area, start, count);\n }\n\n for (i = start; i < start + count; ++i) {\n const element = elements[i];\n if (element.hidden) {\n continue;\n }\n if (element.active && drawActiveElementsOnTop) {\n active.push(element);\n } else {\n element.draw(ctx, area);\n }\n }\n\n for (i = 0; i < active.length; ++i) {\n active[i].draw(ctx, area);\n }\n }\n\n /**\n\t * Returns a set of predefined style properties that should be used to represent the dataset\n\t * or the data if the index is specified\n\t * @param {number} index - data index\n\t * @param {boolean} [active] - true if hover\n\t * @return {object} style object\n\t */\n getStyle(index, active) {\n const mode = active ? 'active' : 'default';\n return index === undefined && this._cachedMeta.dataset\n ? this.resolveDatasetElementOptions(mode)\n : this.resolveDataElementOptions(index || 0, mode);\n }\n\n /**\n\t * @protected\n\t */\n getContext(index, active, mode) {\n const dataset = this.getDataset();\n let context;\n if (index >= 0 && index < this._cachedMeta.data.length) {\n const element = this._cachedMeta.data[index];\n context = element.$context ||\n (element.$context = createDataContext(this.getContext(), index, element));\n context.parsed = this.getParsed(index);\n context.raw = dataset.data[index];\n context.index = context.dataIndex = index;\n } else {\n context = this.$context ||\n (this.$context = createDatasetContext(this.chart.getContext(), this.index));\n context.dataset = dataset;\n context.index = context.datasetIndex = this.index;\n }\n\n context.active = !!active;\n context.mode = mode;\n return context;\n }\n\n /**\n\t * @param {string} [mode]\n\t * @protected\n\t */\n resolveDatasetElementOptions(mode) {\n return this._resolveElementOptions(this.datasetElementType.id, mode);\n }\n\n /**\n\t * @param {number} index\n\t * @param {string} [mode]\n\t * @protected\n\t */\n resolveDataElementOptions(index, mode) {\n return this._resolveElementOptions(this.dataElementType.id, mode, index);\n }\n\n /**\n\t * @private\n\t */\n _resolveElementOptions(elementType, mode = 'default', index) {\n const active = mode === 'active';\n const cache = this._cachedDataOpts;\n const cacheKey = elementType + '-' + mode;\n const cached = cache[cacheKey];\n const sharing = this.enableOptionSharing && defined(index);\n if (cached) {\n return cloneIfNotShared(cached, sharing);\n }\n const config = this.chart.config;\n const scopeKeys = config.datasetElementScopeKeys(this._type, elementType);\n const prefixes = active ? [`${elementType}Hover`, 'hover', elementType, ''] : [elementType, ''];\n const scopes = config.getOptionScopes(this.getDataset(), scopeKeys);\n const names = Object.keys(defaults.elements[elementType]);\n // context is provided as a function, and is called only if needed,\n // so we don't create a context for each element if not needed.\n const context = () => this.getContext(index, active, mode);\n const values = config.resolveNamedOptions(scopes, names, context, prefixes);\n\n if (values.$shared) {\n // `$shared` indicates this set of options can be shared between multiple elements.\n // Sharing is used to reduce number of properties to change during animation.\n values.$shared = sharing;\n\n // We cache options by `mode`, which can be 'active' for example. This enables us\n // to have the 'active' element options and 'default' options to switch between\n // when interacting.\n cache[cacheKey] = Object.freeze(cloneIfNotShared(values, sharing));\n }\n\n return values;\n }\n\n\n /**\n\t * @private\n\t */\n _resolveAnimations(index, transition, active) {\n const chart = this.chart;\n const cache = this._cachedDataOpts;\n const cacheKey = `animation-${transition}`;\n const cached = cache[cacheKey];\n if (cached) {\n return cached;\n }\n let options;\n if (chart.options.animation !== false) {\n const config = this.chart.config;\n const scopeKeys = config.datasetAnimationScopeKeys(this._type, transition);\n const scopes = config.getOptionScopes(this.getDataset(), scopeKeys);\n options = config.createResolver(scopes, this.getContext(index, active, transition));\n }\n const animations = new Animations(chart, options && options.animations);\n if (options && options._cacheable) {\n cache[cacheKey] = Object.freeze(animations);\n }\n return animations;\n }\n\n /**\n\t * Utility for getting the options object shared between elements\n\t * @protected\n\t */\n getSharedOptions(options) {\n if (!options.$shared) {\n return;\n }\n return this._sharedOptions || (this._sharedOptions = Object.assign({}, options));\n }\n\n /**\n\t * Utility for determining if `options` should be included in the updated properties\n\t * @protected\n\t */\n includeOptions(mode, sharedOptions) {\n return !sharedOptions || isDirectUpdateMode(mode) || this.chart._animationsDisabled;\n }\n\n /**\n * @todo v4, rename to getSharedOptions and remove excess functions\n */\n _getSharedOptions(start, mode) {\n const firstOpts = this.resolveDataElementOptions(start, mode);\n const previouslySharedOptions = this._sharedOptions;\n const sharedOptions = this.getSharedOptions(firstOpts);\n const includeOptions = this.includeOptions(mode, sharedOptions) || (sharedOptions !== previouslySharedOptions);\n this.updateSharedOptions(sharedOptions, mode, firstOpts);\n return {sharedOptions, includeOptions};\n }\n\n /**\n\t * Utility for updating an element with new properties, using animations when appropriate.\n\t * @protected\n\t */\n updateElement(element, index, properties, mode) {\n if (isDirectUpdateMode(mode)) {\n Object.assign(element, properties);\n } else {\n this._resolveAnimations(index, mode).update(element, properties);\n }\n }\n\n /**\n\t * Utility to animate the shared options, that are potentially affecting multiple elements.\n\t * @protected\n\t */\n updateSharedOptions(sharedOptions, mode, newOptions) {\n if (sharedOptions && !isDirectUpdateMode(mode)) {\n this._resolveAnimations(undefined, mode).update(sharedOptions, newOptions);\n }\n }\n\n /**\n\t * @private\n\t */\n _setStyle(element, index, mode, active) {\n element.active = active;\n const options = this.getStyle(index, active);\n this._resolveAnimations(index, mode, active).update(element, {\n // When going from active to inactive, we need to update to the shared options.\n // This way the once hovered element will end up with the same original shared options instance, after animation.\n options: (!active && this.getSharedOptions(options)) || options\n });\n }\n\n removeHoverStyle(element, datasetIndex, index) {\n this._setStyle(element, index, 'active', false);\n }\n\n setHoverStyle(element, datasetIndex, index) {\n this._setStyle(element, index, 'active', true);\n }\n\n /**\n\t * @private\n\t */\n _removeDatasetHoverStyle() {\n const element = this._cachedMeta.dataset;\n\n if (element) {\n this._setStyle(element, undefined, 'active', false);\n }\n }\n\n /**\n\t * @private\n\t */\n _setDatasetHoverStyle() {\n const element = this._cachedMeta.dataset;\n\n if (element) {\n this._setStyle(element, undefined, 'active', true);\n }\n }\n\n /**\n\t * @private\n\t */\n _resyncElements(resetNewElements) {\n const data = this._data;\n const elements = this._cachedMeta.data;\n\n // Apply changes detected through array listeners\n for (const [method, arg1, arg2] of this._syncList) {\n this[method](arg1, arg2);\n }\n this._syncList = [];\n\n const numMeta = elements.length;\n const numData = data.length;\n const count = Math.min(numData, numMeta);\n\n if (count) {\n // TODO: It is not optimal to always parse the old data\n // This is done because we are not detecting direct assignments:\n // chart.data.datasets[0].data[5] = 10;\n // chart.data.datasets[0].data[5].y = 10;\n this.parse(0, count);\n }\n\n if (numData > numMeta) {\n this._insertElements(numMeta, numData - numMeta, resetNewElements);\n } else if (numData < numMeta) {\n this._removeElements(numData, numMeta - numData);\n }\n }\n\n /**\n\t * @private\n\t */\n _insertElements(start, count, resetNewElements = true) {\n const meta = this._cachedMeta;\n const data = meta.data;\n const end = start + count;\n let i;\n\n const move = (arr) => {\n arr.length += count;\n for (i = arr.length - 1; i >= end; i--) {\n arr[i] = arr[i - count];\n }\n };\n move(data);\n\n for (i = start; i < end; ++i) {\n data[i] = new this.dataElementType();\n }\n\n if (this._parsing) {\n move(meta._parsed);\n }\n this.parse(start, count);\n\n if (resetNewElements) {\n this.updateElements(data, start, count, 'reset');\n }\n }\n\n updateElements(element, start, count, mode) {} // eslint-disable-line no-unused-vars\n\n /**\n\t * @private\n\t */\n _removeElements(start, count) {\n const meta = this._cachedMeta;\n if (this._parsing) {\n const removed = meta._parsed.splice(start, count);\n if (meta._stacked) {\n clearStacks(meta, removed);\n }\n }\n meta.data.splice(start, count);\n }\n\n /**\n\t * @private\n */\n _sync(args) {\n if (this._parsing) {\n this._syncList.push(args);\n } else {\n const [method, arg1, arg2] = args;\n this[method](arg1, arg2);\n }\n this.chart._dataChanges.push([this.index, ...args]);\n }\n\n _onDataPush() {\n const count = arguments.length;\n this._sync(['_insertElements', this.getDataset().data.length - count, count]);\n }\n\n _onDataPop() {\n this._sync(['_removeElements', this._cachedMeta.data.length - 1, 1]);\n }\n\n _onDataShift() {\n this._sync(['_removeElements', 0, 1]);\n }\n\n _onDataSplice(start, count) {\n if (count) {\n this._sync(['_removeElements', start, count]);\n }\n const newCount = arguments.length - 2;\n if (newCount) {\n this._sync(['_insertElements', start, newCount]);\n }\n }\n\n _onDataUnshift() {\n this._sync(['_insertElements', 0, arguments.length]);\n }\n}\n", "import DatasetController from '../core/core.datasetController.js';\nimport {\n _arrayUnique, isArray, isNullOrUndef,\n valueOrDefault, resolveObjectKey, sign, defined\n} from '../helpers/index.js';\n\nfunction getAllScaleValues(scale, type) {\n if (!scale._cache.$bar) {\n const visibleMetas = scale.getMatchingVisibleMetas(type);\n let values = [];\n\n for (let i = 0, ilen = visibleMetas.length; i < ilen; i++) {\n values = values.concat(visibleMetas[i].controller.getAllParsedValues(scale));\n }\n scale._cache.$bar = _arrayUnique(values.sort((a, b) => a - b));\n }\n return scale._cache.$bar;\n}\n\n/**\n * Computes the \"optimal\" sample size to maintain bars equally sized while preventing overlap.\n * @private\n */\nfunction computeMinSampleSize(meta) {\n const scale = meta.iScale;\n const values = getAllScaleValues(scale, meta.type);\n let min = scale._length;\n let i, ilen, curr, prev;\n const updateMinAndPrev = () => {\n if (curr === 32767 || curr === -32768) {\n // Ignore truncated pixels\n return;\n }\n if (defined(prev)) {\n // curr - prev === 0 is ignored\n min = Math.min(min, Math.abs(curr - prev) || min);\n }\n prev = curr;\n };\n\n for (i = 0, ilen = values.length; i < ilen; ++i) {\n curr = scale.getPixelForValue(values[i]);\n updateMinAndPrev();\n }\n\n prev = undefined;\n for (i = 0, ilen = scale.ticks.length; i < ilen; ++i) {\n curr = scale.getPixelForTick(i);\n updateMinAndPrev();\n }\n\n return min;\n}\n\n/**\n * Computes an \"ideal\" category based on the absolute bar thickness or, if undefined or null,\n * uses the smallest interval (see computeMinSampleSize) that prevents bar overlapping. This\n * mode currently always generates bars equally sized (until we introduce scriptable options?).\n * @private\n */\nfunction computeFitCategoryTraits(index, ruler, options, stackCount) {\n const thickness = options.barThickness;\n let size, ratio;\n\n if (isNullOrUndef(thickness)) {\n size = ruler.min * options.categoryPercentage;\n ratio = options.barPercentage;\n } else {\n // When bar thickness is enforced, category and bar percentages are ignored.\n // Note(SB): we could add support for relative bar thickness (e.g. barThickness: '50%')\n // and deprecate barPercentage since this value is ignored when thickness is absolute.\n size = thickness * stackCount;\n ratio = 1;\n }\n\n return {\n chunk: size / stackCount,\n ratio,\n start: ruler.pixels[index] - (size / 2)\n };\n}\n\n/**\n * Computes an \"optimal\" category that globally arranges bars side by side (no gap when\n * percentage options are 1), based on the previous and following categories. This mode\n * generates bars with different widths when data are not evenly spaced.\n * @private\n */\nfunction computeFlexCategoryTraits(index, ruler, options, stackCount) {\n const pixels = ruler.pixels;\n const curr = pixels[index];\n let prev = index > 0 ? pixels[index - 1] : null;\n let next = index < pixels.length - 1 ? pixels[index + 1] : null;\n const percent = options.categoryPercentage;\n\n if (prev === null) {\n // first data: its size is double based on the next point or,\n // if it's also the last data, we use the scale size.\n prev = curr - (next === null ? ruler.end - ruler.start : next - curr);\n }\n\n if (next === null) {\n // last data: its size is also double based on the previous point.\n next = curr + curr - prev;\n }\n\n const start = curr - (curr - Math.min(prev, next)) / 2 * percent;\n const size = Math.abs(next - prev) / 2 * percent;\n\n return {\n chunk: size / stackCount,\n ratio: options.barPercentage,\n start\n };\n}\n\nfunction parseFloatBar(entry, item, vScale, i) {\n const startValue = vScale.parse(entry[0], i);\n const endValue = vScale.parse(entry[1], i);\n const min = Math.min(startValue, endValue);\n const max = Math.max(startValue, endValue);\n let barStart = min;\n let barEnd = max;\n\n if (Math.abs(min) > Math.abs(max)) {\n barStart = max;\n barEnd = min;\n }\n\n // Store `barEnd` (furthest away from origin) as parsed value,\n // to make stacking straight forward\n item[vScale.axis] = barEnd;\n\n item._custom = {\n barStart,\n barEnd,\n start: startValue,\n end: endValue,\n min,\n max\n };\n}\n\nfunction parseValue(entry, item, vScale, i) {\n if (isArray(entry)) {\n parseFloatBar(entry, item, vScale, i);\n } else {\n item[vScale.axis] = vScale.parse(entry, i);\n }\n return item;\n}\n\nfunction parseArrayOrPrimitive(meta, data, start, count) {\n const iScale = meta.iScale;\n const vScale = meta.vScale;\n const labels = iScale.getLabels();\n const singleScale = iScale === vScale;\n const parsed = [];\n let i, ilen, item, entry;\n\n for (i = start, ilen = start + count; i < ilen; ++i) {\n entry = data[i];\n item = {};\n item[iScale.axis] = singleScale || iScale.parse(labels[i], i);\n parsed.push(parseValue(entry, item, vScale, i));\n }\n return parsed;\n}\n\nfunction isFloatBar(custom) {\n return custom && custom.barStart !== undefined && custom.barEnd !== undefined;\n}\n\nfunction barSign(size, vScale, actualBase) {\n if (size !== 0) {\n return sign(size);\n }\n return (vScale.isHorizontal() ? 1 : -1) * (vScale.min >= actualBase ? 1 : -1);\n}\n\nfunction borderProps(properties) {\n let reverse, start, end, top, bottom;\n if (properties.horizontal) {\n reverse = properties.base > properties.x;\n start = 'left';\n end = 'right';\n } else {\n reverse = properties.base < properties.y;\n start = 'bottom';\n end = 'top';\n }\n if (reverse) {\n top = 'end';\n bottom = 'start';\n } else {\n top = 'start';\n bottom = 'end';\n }\n return {start, end, reverse, top, bottom};\n}\n\nfunction setBorderSkipped(properties, options, stack, index) {\n let edge = options.borderSkipped;\n const res = {};\n\n if (!edge) {\n properties.borderSkipped = res;\n return;\n }\n\n if (edge === true) {\n properties.borderSkipped = {top: true, right: true, bottom: true, left: true};\n return;\n }\n\n const {start, end, reverse, top, bottom} = borderProps(properties);\n\n if (edge === 'middle' && stack) {\n properties.enableBorderRadius = true;\n if ((stack._top || 0) === index) {\n edge = top;\n } else if ((stack._bottom || 0) === index) {\n edge = bottom;\n } else {\n res[parseEdge(bottom, start, end, reverse)] = true;\n edge = top;\n }\n }\n\n res[parseEdge(edge, start, end, reverse)] = true;\n properties.borderSkipped = res;\n}\n\nfunction parseEdge(edge, a, b, reverse) {\n if (reverse) {\n edge = swap(edge, a, b);\n edge = startEnd(edge, b, a);\n } else {\n edge = startEnd(edge, a, b);\n }\n return edge;\n}\n\nfunction swap(orig, v1, v2) {\n return orig === v1 ? v2 : orig === v2 ? v1 : orig;\n}\n\nfunction startEnd(v, start, end) {\n return v === 'start' ? start : v === 'end' ? end : v;\n}\n\nfunction setInflateAmount(properties, {inflateAmount}, ratio) {\n properties.inflateAmount = inflateAmount === 'auto'\n ? ratio === 1 ? 0.33 : 0\n : inflateAmount;\n}\n\nexport default class BarController extends DatasetController {\n\n static id = 'bar';\n\n /**\n * @type {any}\n */\n static defaults = {\n datasetElementType: false,\n dataElementType: 'bar',\n\n categoryPercentage: 0.8,\n barPercentage: 0.9,\n grouped: true,\n\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'base', 'width', 'height']\n }\n }\n };\n\n /**\n * @type {any}\n */\n static overrides = {\n scales: {\n _index_: {\n type: 'category',\n offset: true,\n grid: {\n offset: true\n }\n },\n _value_: {\n type: 'linear',\n beginAtZero: true,\n }\n }\n };\n\n\n /**\n\t * Overriding primitive data parsing since we support mixed primitive/array\n\t * data for float bars\n\t * @protected\n\t */\n parsePrimitiveData(meta, data, start, count) {\n return parseArrayOrPrimitive(meta, data, start, count);\n }\n\n /**\n\t * Overriding array data parsing since we support mixed primitive/array\n\t * data for float bars\n\t * @protected\n\t */\n parseArrayData(meta, data, start, count) {\n return parseArrayOrPrimitive(meta, data, start, count);\n }\n\n /**\n\t * Overriding object data parsing since we support mixed primitive/array\n\t * value-scale data for float bars\n\t * @protected\n\t */\n parseObjectData(meta, data, start, count) {\n const {iScale, vScale} = meta;\n const {xAxisKey = 'x', yAxisKey = 'y'} = this._parsing;\n const iAxisKey = iScale.axis === 'x' ? xAxisKey : yAxisKey;\n const vAxisKey = vScale.axis === 'x' ? xAxisKey : yAxisKey;\n const parsed = [];\n let i, ilen, item, obj;\n for (i = start, ilen = start + count; i < ilen; ++i) {\n obj = data[i];\n item = {};\n item[iScale.axis] = iScale.parse(resolveObjectKey(obj, iAxisKey), i);\n parsed.push(parseValue(resolveObjectKey(obj, vAxisKey), item, vScale, i));\n }\n return parsed;\n }\n\n /**\n\t * @protected\n\t */\n updateRangeFromParsed(range, scale, parsed, stack) {\n super.updateRangeFromParsed(range, scale, parsed, stack);\n const custom = parsed._custom;\n if (custom && scale === this._cachedMeta.vScale) {\n // float bar: only one end of the bar is considered by `super`\n range.min = Math.min(range.min, custom.min);\n range.max = Math.max(range.max, custom.max);\n }\n }\n\n /**\n\t * @return {number|boolean}\n\t * @protected\n\t */\n getMaxOverflow() {\n return 0;\n }\n\n /**\n\t * @protected\n\t */\n getLabelAndValue(index) {\n const meta = this._cachedMeta;\n const {iScale, vScale} = meta;\n const parsed = this.getParsed(index);\n const custom = parsed._custom;\n const value = isFloatBar(custom)\n ? '[' + custom.start + ', ' + custom.end + ']'\n : '' + vScale.getLabelForValue(parsed[vScale.axis]);\n\n return {\n label: '' + iScale.getLabelForValue(parsed[iScale.axis]),\n value\n };\n }\n\n initialize() {\n this.enableOptionSharing = true;\n\n super.initialize();\n\n const meta = this._cachedMeta;\n meta.stack = this.getDataset().stack;\n }\n\n update(mode) {\n const meta = this._cachedMeta;\n this.updateElements(meta.data, 0, meta.data.length, mode);\n }\n\n updateElements(bars, start, count, mode) {\n const reset = mode === 'reset';\n const {index, _cachedMeta: {vScale}} = this;\n const base = vScale.getBasePixel();\n const horizontal = vScale.isHorizontal();\n const ruler = this._getRuler();\n const {sharedOptions, includeOptions} = this._getSharedOptions(start, mode);\n\n for (let i = start; i < start + count; i++) {\n const parsed = this.getParsed(i);\n const vpixels = reset || isNullOrUndef(parsed[vScale.axis]) ? {base, head: base} : this._calculateBarValuePixels(i);\n const ipixels = this._calculateBarIndexPixels(i, ruler);\n const stack = (parsed._stacks || {})[vScale.axis];\n\n const properties = {\n horizontal,\n base: vpixels.base,\n enableBorderRadius: !stack || isFloatBar(parsed._custom) || (index === stack._top || index === stack._bottom),\n x: horizontal ? vpixels.head : ipixels.center,\n y: horizontal ? ipixels.center : vpixels.head,\n height: horizontal ? ipixels.size : Math.abs(vpixels.size),\n width: horizontal ? Math.abs(vpixels.size) : ipixels.size\n };\n\n if (includeOptions) {\n properties.options = sharedOptions || this.resolveDataElementOptions(i, bars[i].active ? 'active' : mode);\n }\n const options = properties.options || bars[i].options;\n setBorderSkipped(properties, options, stack, index);\n setInflateAmount(properties, options, ruler.ratio);\n this.updateElement(bars[i], i, properties, mode);\n }\n }\n\n /**\n\t * Returns the stacks based on groups and bar visibility.\n\t * @param {number} [last] - The dataset index\n\t * @param {number} [dataIndex] - The data index of the ruler\n\t * @returns {string[]} The list of stack IDs\n\t * @private\n\t */\n _getStacks(last, dataIndex) {\n const {iScale} = this._cachedMeta;\n const metasets = iScale.getMatchingVisibleMetas(this._type)\n .filter(meta => meta.controller.options.grouped);\n const stacked = iScale.options.stacked;\n const stacks = [];\n const currentParsed = this._cachedMeta.controller.getParsed(dataIndex);\n const iScaleValue = currentParsed && currentParsed[iScale.axis];\n\n const skipNull = (meta) => {\n const parsed = meta._parsed.find(item => item[iScale.axis] === iScaleValue);\n const val = parsed && parsed[meta.vScale.axis];\n\n if (isNullOrUndef(val) || isNaN(val)) {\n return true;\n }\n };\n\n for (const meta of metasets) {\n if (dataIndex !== undefined && skipNull(meta)) {\n continue;\n }\n\n // stacked | meta.stack\n // | found | not found | undefined\n // false | x | x | x\n // true | | x |\n // undefined | | x | x\n if (stacked === false || stacks.indexOf(meta.stack) === -1 ||\n\t\t\t\t(stacked === undefined && meta.stack === undefined)) {\n stacks.push(meta.stack);\n }\n if (meta.index === last) {\n break;\n }\n }\n\n // No stacks? that means there is no visible data. Let's still initialize an `undefined`\n // stack where possible invisible bars will be located.\n // https://github.com/chartjs/Chart.js/issues/6368\n if (!stacks.length) {\n stacks.push(undefined);\n }\n\n return stacks;\n }\n\n /**\n\t * Returns the effective number of stacks based on groups and bar visibility.\n\t * @private\n\t */\n _getStackCount(index) {\n return this._getStacks(undefined, index).length;\n }\n\n /**\n\t * Returns the stack index for the given dataset based on groups and bar visibility.\n\t * @param {number} [datasetIndex] - The dataset index\n\t * @param {string} [name] - The stack name to find\n * @param {number} [dataIndex]\n\t * @returns {number} The stack index\n\t * @private\n\t */\n _getStackIndex(datasetIndex, name, dataIndex) {\n const stacks = this._getStacks(datasetIndex, dataIndex);\n const index = (name !== undefined)\n ? stacks.indexOf(name)\n : -1; // indexOf returns -1 if element is not present\n\n return (index === -1)\n ? stacks.length - 1\n : index;\n }\n\n /**\n\t * @private\n\t */\n _getRuler() {\n const opts = this.options;\n const meta = this._cachedMeta;\n const iScale = meta.iScale;\n const pixels = [];\n let i, ilen;\n\n for (i = 0, ilen = meta.data.length; i < ilen; ++i) {\n pixels.push(iScale.getPixelForValue(this.getParsed(i)[iScale.axis], i));\n }\n\n const barThickness = opts.barThickness;\n const min = barThickness || computeMinSampleSize(meta);\n\n return {\n min,\n pixels,\n start: iScale._startPixel,\n end: iScale._endPixel,\n stackCount: this._getStackCount(),\n scale: iScale,\n grouped: opts.grouped,\n // bar thickness ratio used for non-grouped bars\n ratio: barThickness ? 1 : opts.categoryPercentage * opts.barPercentage\n };\n }\n\n /**\n\t * Note: pixel values are not clamped to the scale area.\n\t * @private\n\t */\n _calculateBarValuePixels(index) {\n const {_cachedMeta: {vScale, _stacked, index: datasetIndex}, options: {base: baseValue, minBarLength}} = this;\n const actualBase = baseValue || 0;\n const parsed = this.getParsed(index);\n const custom = parsed._custom;\n const floating = isFloatBar(custom);\n let value = parsed[vScale.axis];\n let start = 0;\n let length = _stacked ? this.applyStack(vScale, parsed, _stacked) : value;\n let head, size;\n\n if (length !== value) {\n start = length - value;\n length = value;\n }\n\n if (floating) {\n value = custom.barStart;\n length = custom.barEnd - custom.barStart;\n // bars crossing origin are not stacked\n if (value !== 0 && sign(value) !== sign(custom.barEnd)) {\n start = 0;\n }\n start += value;\n }\n\n const startValue = !isNullOrUndef(baseValue) && !floating ? baseValue : start;\n let base = vScale.getPixelForValue(startValue);\n\n if (this.chart.getDataVisibility(index)) {\n head = vScale.getPixelForValue(start + length);\n } else {\n // When not visible, no height\n head = base;\n }\n\n size = head - base;\n\n if (Math.abs(size) < minBarLength) {\n size = barSign(size, vScale, actualBase) * minBarLength;\n if (value === actualBase) {\n base -= size / 2;\n }\n const startPixel = vScale.getPixelForDecimal(0);\n const endPixel = vScale.getPixelForDecimal(1);\n const min = Math.min(startPixel, endPixel);\n const max = Math.max(startPixel, endPixel);\n base = Math.max(Math.min(base, max), min);\n head = base + size;\n\n if (_stacked && !floating) {\n // visual data coordinates after applying minBarLength\n parsed._stacks[vScale.axis]._visualValues[datasetIndex] = vScale.getValueForPixel(head) - vScale.getValueForPixel(base);\n }\n }\n\n if (base === vScale.getPixelForValue(actualBase)) {\n const halfGrid = sign(size) * vScale.getLineWidthForValue(actualBase) / 2;\n base += halfGrid;\n size -= halfGrid;\n }\n\n return {\n size,\n base,\n head,\n center: head + size / 2\n };\n }\n\n /**\n\t * @private\n\t */\n _calculateBarIndexPixels(index, ruler) {\n const scale = ruler.scale;\n const options = this.options;\n const skipNull = options.skipNull;\n const maxBarThickness = valueOrDefault(options.maxBarThickness, Infinity);\n let center, size;\n if (ruler.grouped) {\n const stackCount = skipNull ? this._getStackCount(index) : ruler.stackCount;\n const range = options.barThickness === 'flex'\n ? computeFlexCategoryTraits(index, ruler, options, stackCount)\n : computeFitCategoryTraits(index, ruler, options, stackCount);\n\n const stackIndex = this._getStackIndex(this.index, this._cachedMeta.stack, skipNull ? index : undefined);\n center = range.start + (range.chunk * stackIndex) + (range.chunk / 2);\n size = Math.min(maxBarThickness, range.chunk * range.ratio);\n } else {\n // For non-grouped bar charts, exact pixel values are used\n center = scale.getPixelForValue(this.getParsed(index)[scale.axis], index);\n size = Math.min(maxBarThickness, ruler.min * ruler.ratio);\n }\n\n return {\n base: center - size / 2,\n head: center + size / 2,\n center,\n size\n };\n }\n\n draw() {\n const meta = this._cachedMeta;\n const vScale = meta.vScale;\n const rects = meta.data;\n const ilen = rects.length;\n let i = 0;\n\n for (; i < ilen; ++i) {\n if (this.getParsed(i)[vScale.axis] !== null && !rects[i].hidden) {\n rects[i].draw(this._ctx);\n }\n }\n }\n\n}\n", "import DatasetController from '../core/core.datasetController.js';\nimport {valueOrDefault} from '../helpers/helpers.core.js';\n\nexport default class BubbleController extends DatasetController {\n\n static id = 'bubble';\n\n /**\n * @type {any}\n */\n static defaults = {\n datasetElementType: false,\n dataElementType: 'point',\n\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'borderWidth', 'radius']\n }\n }\n };\n\n /**\n * @type {any}\n */\n static overrides = {\n scales: {\n x: {\n type: 'linear'\n },\n y: {\n type: 'linear'\n }\n }\n };\n\n initialize() {\n this.enableOptionSharing = true;\n super.initialize();\n }\n\n /**\n\t * Parse array of primitive values\n\t * @protected\n\t */\n parsePrimitiveData(meta, data, start, count) {\n const parsed = super.parsePrimitiveData(meta, data, start, count);\n for (let i = 0; i < parsed.length; i++) {\n parsed[i]._custom = this.resolveDataElementOptions(i + start).radius;\n }\n return parsed;\n }\n\n /**\n\t * Parse array of arrays\n\t * @protected\n\t */\n parseArrayData(meta, data, start, count) {\n const parsed = super.parseArrayData(meta, data, start, count);\n for (let i = 0; i < parsed.length; i++) {\n const item = data[start + i];\n parsed[i]._custom = valueOrDefault(item[2], this.resolveDataElementOptions(i + start).radius);\n }\n return parsed;\n }\n\n /**\n\t * Parse array of objects\n\t * @protected\n\t */\n parseObjectData(meta, data, start, count) {\n const parsed = super.parseObjectData(meta, data, start, count);\n for (let i = 0; i < parsed.length; i++) {\n const item = data[start + i];\n parsed[i]._custom = valueOrDefault(item && item.r && +item.r, this.resolveDataElementOptions(i + start).radius);\n }\n return parsed;\n }\n\n /**\n\t * @protected\n\t */\n getMaxOverflow() {\n const data = this._cachedMeta.data;\n\n let max = 0;\n for (let i = data.length - 1; i >= 0; --i) {\n max = Math.max(max, data[i].size(this.resolveDataElementOptions(i)) / 2);\n }\n return max > 0 && max;\n }\n\n /**\n\t * @protected\n\t */\n getLabelAndValue(index) {\n const meta = this._cachedMeta;\n const labels = this.chart.data.labels || [];\n const {xScale, yScale} = meta;\n const parsed = this.getParsed(index);\n const x = xScale.getLabelForValue(parsed.x);\n const y = yScale.getLabelForValue(parsed.y);\n const r = parsed._custom;\n\n return {\n label: labels[index] || '',\n value: '(' + x + ', ' + y + (r ? ', ' + r : '') + ')'\n };\n }\n\n update(mode) {\n const points = this._cachedMeta.data;\n\n // Update Points\n this.updateElements(points, 0, points.length, mode);\n }\n\n updateElements(points, start, count, mode) {\n const reset = mode === 'reset';\n const {iScale, vScale} = this._cachedMeta;\n const {sharedOptions, includeOptions} = this._getSharedOptions(start, mode);\n const iAxis = iScale.axis;\n const vAxis = vScale.axis;\n\n for (let i = start; i < start + count; i++) {\n const point = points[i];\n const parsed = !reset && this.getParsed(i);\n const properties = {};\n const iPixel = properties[iAxis] = reset ? iScale.getPixelForDecimal(0.5) : iScale.getPixelForValue(parsed[iAxis]);\n const vPixel = properties[vAxis] = reset ? vScale.getBasePixel() : vScale.getPixelForValue(parsed[vAxis]);\n\n properties.skip = isNaN(iPixel) || isNaN(vPixel);\n\n if (includeOptions) {\n properties.options = sharedOptions || this.resolveDataElementOptions(i, point.active ? 'active' : mode);\n\n if (reset) {\n properties.options.radius = 0;\n }\n }\n\n this.updateElement(point, i, properties, mode);\n }\n }\n\n /**\n\t * @param {number} index\n\t * @param {string} [mode]\n\t * @protected\n\t */\n resolveDataElementOptions(index, mode) {\n const parsed = this.getParsed(index);\n let values = super.resolveDataElementOptions(index, mode);\n\n // In case values were cached (and thus frozen), we need to clone the values\n if (values.$shared) {\n values = Object.assign({}, values, {$shared: false});\n }\n\n // Custom radius resolution\n const radius = values.radius;\n if (mode !== 'active') {\n values.radius = 0;\n }\n values.radius += valueOrDefault(parsed && parsed._custom, radius);\n\n return values;\n }\n}\n", "import DatasetController from '../core/core.datasetController.js';\nimport {isObject, resolveObjectKey, toPercentage, toDimension, valueOrDefault} from '../helpers/helpers.core.js';\nimport {formatNumber} from '../helpers/helpers.intl.js';\nimport {toRadians, PI, TAU, HALF_PI, _angleBetween} from '../helpers/helpers.math.js';\n\n/**\n * @typedef { import('../core/core.controller.js').default } Chart\n */\n\nfunction getRatioAndOffset(rotation, circumference, cutout) {\n let ratioX = 1;\n let ratioY = 1;\n let offsetX = 0;\n let offsetY = 0;\n // If the chart's circumference isn't a full circle, calculate size as a ratio of the width/height of the arc\n if (circumference < TAU) {\n const startAngle = rotation;\n const endAngle = startAngle + circumference;\n const startX = Math.cos(startAngle);\n const startY = Math.sin(startAngle);\n const endX = Math.cos(endAngle);\n const endY = Math.sin(endAngle);\n const calcMax = (angle, a, b) => _angleBetween(angle, startAngle, endAngle, true) ? 1 : Math.max(a, a * cutout, b, b * cutout);\n const calcMin = (angle, a, b) => _angleBetween(angle, startAngle, endAngle, true) ? -1 : Math.min(a, a * cutout, b, b * cutout);\n const maxX = calcMax(0, startX, endX);\n const maxY = calcMax(HALF_PI, startY, endY);\n const minX = calcMin(PI, startX, endX);\n const minY = calcMin(PI + HALF_PI, startY, endY);\n ratioX = (maxX - minX) / 2;\n ratioY = (maxY - minY) / 2;\n offsetX = -(maxX + minX) / 2;\n offsetY = -(maxY + minY) / 2;\n }\n return {ratioX, ratioY, offsetX, offsetY};\n}\n\nexport default class DoughnutController extends DatasetController {\n\n static id = 'doughnut';\n\n /**\n * @type {any}\n */\n static defaults = {\n datasetElementType: false,\n dataElementType: 'arc',\n animation: {\n // Boolean - Whether we animate the rotation of the Doughnut\n animateRotate: true,\n // Boolean - Whether we animate scaling the Doughnut from the centre\n animateScale: false\n },\n animations: {\n numbers: {\n type: 'number',\n properties: ['circumference', 'endAngle', 'innerRadius', 'outerRadius', 'startAngle', 'x', 'y', 'offset', 'borderWidth', 'spacing']\n },\n },\n // The percentage of the chart that we cut out of the middle.\n cutout: '50%',\n\n // The rotation of the chart, where the first data arc begins.\n rotation: 0,\n\n // The total circumference of the chart.\n circumference: 360,\n\n // The outer radius of the chart\n radius: '100%',\n\n // Spacing between arcs\n spacing: 0,\n\n indexAxis: 'r',\n };\n\n static descriptors = {\n _scriptable: (name) => name !== 'spacing',\n _indexable: (name) => name !== 'spacing' && !name.startsWith('borderDash') && !name.startsWith('hoverBorderDash'),\n };\n\n /**\n * @type {any}\n */\n static overrides = {\n aspectRatio: 1,\n\n // Need to override these to give a nice default\n plugins: {\n legend: {\n labels: {\n generateLabels(chart) {\n const data = chart.data;\n if (data.labels.length && data.datasets.length) {\n const {labels: {pointStyle, color}} = chart.legend.options;\n\n return data.labels.map((label, i) => {\n const meta = chart.getDatasetMeta(0);\n const style = meta.controller.getStyle(i);\n\n return {\n text: label,\n fillStyle: style.backgroundColor,\n strokeStyle: style.borderColor,\n fontColor: color,\n lineWidth: style.borderWidth,\n pointStyle: pointStyle,\n hidden: !chart.getDataVisibility(i),\n\n // Extra data used for toggling the correct item\n index: i\n };\n });\n }\n return [];\n }\n },\n\n onClick(e, legendItem, legend) {\n legend.chart.toggleDataVisibility(legendItem.index);\n legend.chart.update();\n }\n }\n }\n };\n\n constructor(chart, datasetIndex) {\n super(chart, datasetIndex);\n\n this.enableOptionSharing = true;\n this.innerRadius = undefined;\n this.outerRadius = undefined;\n this.offsetX = undefined;\n this.offsetY = undefined;\n }\n\n linkScales() {}\n\n /**\n\t * Override data parsing, since we are not using scales\n\t */\n parse(start, count) {\n const data = this.getDataset().data;\n const meta = this._cachedMeta;\n\n if (this._parsing === false) {\n meta._parsed = data;\n } else {\n let getter = (i) => +data[i];\n\n if (isObject(data[start])) {\n const {key = 'value'} = this._parsing;\n getter = (i) => +resolveObjectKey(data[i], key);\n }\n\n let i, ilen;\n for (i = start, ilen = start + count; i < ilen; ++i) {\n meta._parsed[i] = getter(i);\n }\n }\n }\n\n /**\n\t * @private\n\t */\n _getRotation() {\n return toRadians(this.options.rotation - 90);\n }\n\n /**\n\t * @private\n\t */\n _getCircumference() {\n return toRadians(this.options.circumference);\n }\n\n /**\n\t * Get the maximal rotation & circumference extents\n\t * across all visible datasets.\n\t */\n _getRotationExtents() {\n let min = TAU;\n let max = -TAU;\n\n for (let i = 0; i < this.chart.data.datasets.length; ++i) {\n if (this.chart.isDatasetVisible(i) && this.chart.getDatasetMeta(i).type === this._type) {\n const controller = this.chart.getDatasetMeta(i).controller;\n const rotation = controller._getRotation();\n const circumference = controller._getCircumference();\n\n min = Math.min(min, rotation);\n max = Math.max(max, rotation + circumference);\n }\n }\n\n return {\n rotation: min,\n circumference: max - min,\n };\n }\n\n /**\n\t * @param {string} mode\n\t */\n update(mode) {\n const chart = this.chart;\n const {chartArea} = chart;\n const meta = this._cachedMeta;\n const arcs = meta.data;\n const spacing = this.getMaxBorderWidth() + this.getMaxOffset(arcs) + this.options.spacing;\n const maxSize = Math.max((Math.min(chartArea.width, chartArea.height) - spacing) / 2, 0);\n const cutout = Math.min(toPercentage(this.options.cutout, maxSize), 1);\n const chartWeight = this._getRingWeight(this.index);\n\n // Compute the maximal rotation & circumference limits.\n // If we only consider our dataset, this can cause problems when two datasets\n // are both less than a circle with different rotations (starting angles)\n const {circumference, rotation} = this._getRotationExtents();\n const {ratioX, ratioY, offsetX, offsetY} = getRatioAndOffset(rotation, circumference, cutout);\n const maxWidth = (chartArea.width - spacing) / ratioX;\n const maxHeight = (chartArea.height - spacing) / ratioY;\n const maxRadius = Math.max(Math.min(maxWidth, maxHeight) / 2, 0);\n const outerRadius = toDimension(this.options.radius, maxRadius);\n const innerRadius = Math.max(outerRadius * cutout, 0);\n const radiusLength = (outerRadius - innerRadius) / this._getVisibleDatasetWeightTotal();\n this.offsetX = offsetX * outerRadius;\n this.offsetY = offsetY * outerRadius;\n\n meta.total = this.calculateTotal();\n\n this.outerRadius = outerRadius - radiusLength * this._getRingWeightOffset(this.index);\n this.innerRadius = Math.max(this.outerRadius - radiusLength * chartWeight, 0);\n\n this.updateElements(arcs, 0, arcs.length, mode);\n }\n\n /**\n * @private\n */\n _circumference(i, reset) {\n const opts = this.options;\n const meta = this._cachedMeta;\n const circumference = this._getCircumference();\n if ((reset && opts.animation.animateRotate) || !this.chart.getDataVisibility(i) || meta._parsed[i] === null || meta.data[i].hidden) {\n return 0;\n }\n return this.calculateCircumference(meta._parsed[i] * circumference / TAU);\n }\n\n updateElements(arcs, start, count, mode) {\n const reset = mode === 'reset';\n const chart = this.chart;\n const chartArea = chart.chartArea;\n const opts = chart.options;\n const animationOpts = opts.animation;\n const centerX = (chartArea.left + chartArea.right) / 2;\n const centerY = (chartArea.top + chartArea.bottom) / 2;\n const animateScale = reset && animationOpts.animateScale;\n const innerRadius = animateScale ? 0 : this.innerRadius;\n const outerRadius = animateScale ? 0 : this.outerRadius;\n const {sharedOptions, includeOptions} = this._getSharedOptions(start, mode);\n let startAngle = this._getRotation();\n let i;\n\n for (i = 0; i < start; ++i) {\n startAngle += this._circumference(i, reset);\n }\n\n for (i = start; i < start + count; ++i) {\n const circumference = this._circumference(i, reset);\n const arc = arcs[i];\n const properties = {\n x: centerX + this.offsetX,\n y: centerY + this.offsetY,\n startAngle,\n endAngle: startAngle + circumference,\n circumference,\n outerRadius,\n innerRadius\n };\n if (includeOptions) {\n properties.options = sharedOptions || this.resolveDataElementOptions(i, arc.active ? 'active' : mode);\n }\n startAngle += circumference;\n\n this.updateElement(arc, i, properties, mode);\n }\n }\n\n calculateTotal() {\n const meta = this._cachedMeta;\n const metaData = meta.data;\n let total = 0;\n let i;\n\n for (i = 0; i < metaData.length; i++) {\n const value = meta._parsed[i];\n if (value !== null && !isNaN(value) && this.chart.getDataVisibility(i) && !metaData[i].hidden) {\n total += Math.abs(value);\n }\n }\n\n return total;\n }\n\n calculateCircumference(value) {\n const total = this._cachedMeta.total;\n if (total > 0 && !isNaN(value)) {\n return TAU * (Math.abs(value) / total);\n }\n return 0;\n }\n\n getLabelAndValue(index) {\n const meta = this._cachedMeta;\n const chart = this.chart;\n const labels = chart.data.labels || [];\n const value = formatNumber(meta._parsed[index], chart.options.locale);\n\n return {\n label: labels[index] || '',\n value,\n };\n }\n\n getMaxBorderWidth(arcs) {\n let max = 0;\n const chart = this.chart;\n let i, ilen, meta, controller, options;\n\n if (!arcs) {\n // Find the outmost visible dataset\n for (i = 0, ilen = chart.data.datasets.length; i < ilen; ++i) {\n if (chart.isDatasetVisible(i)) {\n meta = chart.getDatasetMeta(i);\n arcs = meta.data;\n controller = meta.controller;\n break;\n }\n }\n }\n\n if (!arcs) {\n return 0;\n }\n\n for (i = 0, ilen = arcs.length; i < ilen; ++i) {\n options = controller.resolveDataElementOptions(i);\n if (options.borderAlign !== 'inner') {\n max = Math.max(max, options.borderWidth || 0, options.hoverBorderWidth || 0);\n }\n }\n return max;\n }\n\n getMaxOffset(arcs) {\n let max = 0;\n\n for (let i = 0, ilen = arcs.length; i < ilen; ++i) {\n const options = this.resolveDataElementOptions(i);\n max = Math.max(max, options.offset || 0, options.hoverOffset || 0);\n }\n return max;\n }\n\n /**\n\t * Get radius length offset of the dataset in relation to the visible datasets weights. This allows determining the inner and outer radius correctly\n\t * @private\n\t */\n _getRingWeightOffset(datasetIndex) {\n let ringWeightOffset = 0;\n\n for (let i = 0; i < datasetIndex; ++i) {\n if (this.chart.isDatasetVisible(i)) {\n ringWeightOffset += this._getRingWeight(i);\n }\n }\n\n return ringWeightOffset;\n }\n\n /**\n\t * @private\n\t */\n _getRingWeight(datasetIndex) {\n return Math.max(valueOrDefault(this.chart.data.datasets[datasetIndex].weight, 1), 0);\n }\n\n /**\n\t * Returns the sum of all visible data set weights.\n\t * @private\n\t */\n _getVisibleDatasetWeightTotal() {\n return this._getRingWeightOffset(this.chart.data.datasets.length) || 1;\n }\n}\n", "import DatasetController from '../core/core.datasetController.js';\nimport {isNullOrUndef} from '../helpers/index.js';\nimport {isNumber} from '../helpers/helpers.math.js';\nimport {_getStartAndCountOfVisiblePoints, _scaleRangesChanged} from '../helpers/helpers.extras.js';\n\nexport default class LineController extends DatasetController {\n\n static id = 'line';\n\n /**\n * @type {any}\n */\n static defaults = {\n datasetElementType: 'line',\n dataElementType: 'point',\n\n showLine: true,\n spanGaps: false,\n };\n\n /**\n * @type {any}\n */\n static overrides = {\n scales: {\n _index_: {\n type: 'category',\n },\n _value_: {\n type: 'linear',\n },\n }\n };\n\n initialize() {\n this.enableOptionSharing = true;\n this.supportsDecimation = true;\n super.initialize();\n }\n\n update(mode) {\n const meta = this._cachedMeta;\n const {dataset: line, data: points = [], _dataset} = meta;\n // @ts-ignore\n const animationsDisabled = this.chart._animationsDisabled;\n let {start, count} = _getStartAndCountOfVisiblePoints(meta, points, animationsDisabled);\n\n this._drawStart = start;\n this._drawCount = count;\n\n if (_scaleRangesChanged(meta)) {\n start = 0;\n count = points.length;\n }\n\n // Update Line\n line._chart = this.chart;\n line._datasetIndex = this.index;\n line._decimated = !!_dataset._decimated;\n line.points = points;\n\n const options = this.resolveDatasetElementOptions(mode);\n if (!this.options.showLine) {\n options.borderWidth = 0;\n }\n options.segment = this.options.segment;\n this.updateElement(line, undefined, {\n animated: !animationsDisabled,\n options\n }, mode);\n\n // Update Points\n this.updateElements(points, start, count, mode);\n }\n\n updateElements(points, start, count, mode) {\n const reset = mode === 'reset';\n const {iScale, vScale, _stacked, _dataset} = this._cachedMeta;\n const {sharedOptions, includeOptions} = this._getSharedOptions(start, mode);\n const iAxis = iScale.axis;\n const vAxis = vScale.axis;\n const {spanGaps, segment} = this.options;\n const maxGapLength = isNumber(spanGaps) ? spanGaps : Number.POSITIVE_INFINITY;\n const directUpdate = this.chart._animationsDisabled || reset || mode === 'none';\n const end = start + count;\n const pointsCount = points.length;\n let prevParsed = start > 0 && this.getParsed(start - 1);\n\n for (let i = 0; i < pointsCount; ++i) {\n const point = points[i];\n const properties = directUpdate ? point : {};\n\n if (i < start || i >= end) {\n properties.skip = true;\n continue;\n }\n\n const parsed = this.getParsed(i);\n const nullData = isNullOrUndef(parsed[vAxis]);\n const iPixel = properties[iAxis] = iScale.getPixelForValue(parsed[iAxis], i);\n const vPixel = properties[vAxis] = reset || nullData ? vScale.getBasePixel() : vScale.getPixelForValue(_stacked ? this.applyStack(vScale, parsed, _stacked) : parsed[vAxis], i);\n\n properties.skip = isNaN(iPixel) || isNaN(vPixel) || nullData;\n properties.stop = i > 0 && (Math.abs(parsed[iAxis] - prevParsed[iAxis])) > maxGapLength;\n if (segment) {\n properties.parsed = parsed;\n properties.raw = _dataset.data[i];\n }\n\n if (includeOptions) {\n properties.options = sharedOptions || this.resolveDataElementOptions(i, point.active ? 'active' : mode);\n }\n\n if (!directUpdate) {\n this.updateElement(point, i, properties, mode);\n }\n\n prevParsed = parsed;\n }\n }\n\n /**\n\t * @protected\n\t */\n getMaxOverflow() {\n const meta = this._cachedMeta;\n const dataset = meta.dataset;\n const border = dataset.options && dataset.options.borderWidth || 0;\n const data = meta.data || [];\n if (!data.length) {\n return border;\n }\n const firstPoint = data[0].size(this.resolveDataElementOptions(0));\n const lastPoint = data[data.length - 1].size(this.resolveDataElementOptions(data.length - 1));\n return Math.max(border, firstPoint, lastPoint) / 2;\n }\n\n draw() {\n const meta = this._cachedMeta;\n meta.dataset.updateControlPoints(this.chart.chartArea, meta.iScale.axis);\n super.draw();\n }\n}\n", "import DatasetController from '../core/core.datasetController.js';\nimport {toRadians, PI, formatNumber, _parseObjectDataRadialScale} from '../helpers/index.js';\n\nexport default class PolarAreaController extends DatasetController {\n\n static id = 'polarArea';\n\n /**\n * @type {any}\n */\n static defaults = {\n dataElementType: 'arc',\n animation: {\n animateRotate: true,\n animateScale: true\n },\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'startAngle', 'endAngle', 'innerRadius', 'outerRadius']\n },\n },\n indexAxis: 'r',\n startAngle: 0,\n };\n\n /**\n * @type {any}\n */\n static overrides = {\n aspectRatio: 1,\n\n plugins: {\n legend: {\n labels: {\n generateLabels(chart) {\n const data = chart.data;\n if (data.labels.length && data.datasets.length) {\n const {labels: {pointStyle, color}} = chart.legend.options;\n\n return data.labels.map((label, i) => {\n const meta = chart.getDatasetMeta(0);\n const style = meta.controller.getStyle(i);\n\n return {\n text: label,\n fillStyle: style.backgroundColor,\n strokeStyle: style.borderColor,\n fontColor: color,\n lineWidth: style.borderWidth,\n pointStyle: pointStyle,\n hidden: !chart.getDataVisibility(i),\n\n // Extra data used for toggling the correct item\n index: i\n };\n });\n }\n return [];\n }\n },\n\n onClick(e, legendItem, legend) {\n legend.chart.toggleDataVisibility(legendItem.index);\n legend.chart.update();\n }\n }\n },\n\n scales: {\n r: {\n type: 'radialLinear',\n angleLines: {\n display: false\n },\n beginAtZero: true,\n grid: {\n circular: true\n },\n pointLabels: {\n display: false\n },\n startAngle: 0\n }\n }\n };\n\n constructor(chart, datasetIndex) {\n super(chart, datasetIndex);\n\n this.innerRadius = undefined;\n this.outerRadius = undefined;\n }\n\n getLabelAndValue(index) {\n const meta = this._cachedMeta;\n const chart = this.chart;\n const labels = chart.data.labels || [];\n const value = formatNumber(meta._parsed[index].r, chart.options.locale);\n\n return {\n label: labels[index] || '',\n value,\n };\n }\n\n parseObjectData(meta, data, start, count) {\n return _parseObjectDataRadialScale.bind(this)(meta, data, start, count);\n }\n\n update(mode) {\n const arcs = this._cachedMeta.data;\n\n this._updateRadius();\n this.updateElements(arcs, 0, arcs.length, mode);\n }\n\n /**\n * @protected\n */\n getMinMax() {\n const meta = this._cachedMeta;\n const range = {min: Number.POSITIVE_INFINITY, max: Number.NEGATIVE_INFINITY};\n\n meta.data.forEach((element, index) => {\n const parsed = this.getParsed(index).r;\n\n if (!isNaN(parsed) && this.chart.getDataVisibility(index)) {\n if (parsed < range.min) {\n range.min = parsed;\n }\n\n if (parsed > range.max) {\n range.max = parsed;\n }\n }\n });\n\n return range;\n }\n\n /**\n\t * @private\n\t */\n _updateRadius() {\n const chart = this.chart;\n const chartArea = chart.chartArea;\n const opts = chart.options;\n const minSize = Math.min(chartArea.right - chartArea.left, chartArea.bottom - chartArea.top);\n\n const outerRadius = Math.max(minSize / 2, 0);\n const innerRadius = Math.max(opts.cutoutPercentage ? (outerRadius / 100) * (opts.cutoutPercentage) : 1, 0);\n const radiusLength = (outerRadius - innerRadius) / chart.getVisibleDatasetCount();\n\n this.outerRadius = outerRadius - (radiusLength * this.index);\n this.innerRadius = this.outerRadius - radiusLength;\n }\n\n updateElements(arcs, start, count, mode) {\n const reset = mode === 'reset';\n const chart = this.chart;\n const opts = chart.options;\n const animationOpts = opts.animation;\n const scale = this._cachedMeta.rScale;\n const centerX = scale.xCenter;\n const centerY = scale.yCenter;\n const datasetStartAngle = scale.getIndexAngle(0) - 0.5 * PI;\n let angle = datasetStartAngle;\n let i;\n\n const defaultAngle = 360 / this.countVisibleElements();\n\n for (i = 0; i < start; ++i) {\n angle += this._computeAngle(i, mode, defaultAngle);\n }\n for (i = start; i < start + count; i++) {\n const arc = arcs[i];\n let startAngle = angle;\n let endAngle = angle + this._computeAngle(i, mode, defaultAngle);\n let outerRadius = chart.getDataVisibility(i) ? scale.getDistanceFromCenterForValue(this.getParsed(i).r) : 0;\n angle = endAngle;\n\n if (reset) {\n if (animationOpts.animateScale) {\n outerRadius = 0;\n }\n if (animationOpts.animateRotate) {\n startAngle = endAngle = datasetStartAngle;\n }\n }\n\n const properties = {\n x: centerX,\n y: centerY,\n innerRadius: 0,\n outerRadius,\n startAngle,\n endAngle,\n options: this.resolveDataElementOptions(i, arc.active ? 'active' : mode)\n };\n\n this.updateElement(arc, i, properties, mode);\n }\n }\n\n countVisibleElements() {\n const meta = this._cachedMeta;\n let count = 0;\n\n meta.data.forEach((element, index) => {\n if (!isNaN(this.getParsed(index).r) && this.chart.getDataVisibility(index)) {\n count++;\n }\n });\n\n return count;\n }\n\n /**\n\t * @private\n\t */\n _computeAngle(index, mode, defaultAngle) {\n return this.chart.getDataVisibility(index)\n ? toRadians(this.resolveDataElementOptions(index, mode).angle || defaultAngle)\n : 0;\n }\n}\n", "import DoughnutController from './controller.doughnut.js';\n\n// Pie charts are Doughnut chart with different defaults\nexport default class PieController extends DoughnutController {\n\n static id = 'pie';\n\n /**\n * @type {any}\n */\n static defaults = {\n // The percentage of the chart that we cut out of the middle.\n cutout: 0,\n\n // The rotation of the chart, where the first data arc begins.\n rotation: 0,\n\n // The total circumference of the chart.\n circumference: 360,\n\n // The outer radius of the chart\n radius: '100%'\n };\n}\n", "import DatasetController from '../core/core.datasetController.js';\nimport {_parseObjectDataRadialScale} from '../helpers/index.js';\n\nexport default class RadarController extends DatasetController {\n\n static id = 'radar';\n\n /**\n * @type {any}\n */\n static defaults = {\n datasetElementType: 'line',\n dataElementType: 'point',\n indexAxis: 'r',\n showLine: true,\n elements: {\n line: {\n fill: 'start'\n }\n },\n };\n\n /**\n * @type {any}\n */\n static overrides = {\n aspectRatio: 1,\n\n scales: {\n r: {\n type: 'radialLinear',\n }\n }\n };\n\n /**\n\t * @protected\n\t */\n getLabelAndValue(index) {\n const vScale = this._cachedMeta.vScale;\n const parsed = this.getParsed(index);\n\n return {\n label: vScale.getLabels()[index],\n value: '' + vScale.getLabelForValue(parsed[vScale.axis])\n };\n }\n\n parseObjectData(meta, data, start, count) {\n return _parseObjectDataRadialScale.bind(this)(meta, data, start, count);\n }\n\n update(mode) {\n const meta = this._cachedMeta;\n const line = meta.dataset;\n const points = meta.data || [];\n const labels = meta.iScale.getLabels();\n\n // Update Line\n line.points = points;\n // In resize mode only point locations change, so no need to set the points or options.\n if (mode !== 'resize') {\n const options = this.resolveDatasetElementOptions(mode);\n if (!this.options.showLine) {\n options.borderWidth = 0;\n }\n\n const properties = {\n _loop: true,\n _fullLoop: labels.length === points.length,\n options\n };\n\n this.updateElement(line, undefined, properties, mode);\n }\n\n // Update Points\n this.updateElements(points, 0, points.length, mode);\n }\n\n updateElements(points, start, count, mode) {\n const scale = this._cachedMeta.rScale;\n const reset = mode === 'reset';\n\n for (let i = start; i < start + count; i++) {\n const point = points[i];\n const options = this.resolveDataElementOptions(i, point.active ? 'active' : mode);\n const pointPosition = scale.getPointPositionForValue(i, this.getParsed(i).r);\n\n const x = reset ? scale.xCenter : pointPosition.x;\n const y = reset ? scale.yCenter : pointPosition.y;\n\n const properties = {\n x,\n y,\n angle: pointPosition.angle,\n skip: isNaN(x) || isNaN(y),\n options\n };\n\n this.updateElement(point, i, properties, mode);\n }\n }\n}\n", "import DatasetController from '../core/core.datasetController.js';\nimport {isNullOrUndef} from '../helpers/index.js';\nimport {isNumber} from '../helpers/helpers.math.js';\nimport {_getStartAndCountOfVisiblePoints, _scaleRangesChanged} from '../helpers/helpers.extras.js';\n\nexport default class ScatterController extends DatasetController {\n\n static id = 'scatter';\n\n /**\n * @type {any}\n */\n static defaults = {\n datasetElementType: false,\n dataElementType: 'point',\n showLine: false,\n fill: false\n };\n\n /**\n * @type {any}\n */\n static overrides = {\n\n interaction: {\n mode: 'point'\n },\n\n scales: {\n x: {\n type: 'linear'\n },\n y: {\n type: 'linear'\n }\n }\n };\n\n /**\n\t * @protected\n\t */\n getLabelAndValue(index) {\n const meta = this._cachedMeta;\n const labels = this.chart.data.labels || [];\n const {xScale, yScale} = meta;\n const parsed = this.getParsed(index);\n const x = xScale.getLabelForValue(parsed.x);\n const y = yScale.getLabelForValue(parsed.y);\n\n return {\n label: labels[index] || '',\n value: '(' + x + ', ' + y + ')'\n };\n }\n\n update(mode) {\n const meta = this._cachedMeta;\n const {data: points = []} = meta;\n // @ts-ignore\n const animationsDisabled = this.chart._animationsDisabled;\n let {start, count} = _getStartAndCountOfVisiblePoints(meta, points, animationsDisabled);\n\n this._drawStart = start;\n this._drawCount = count;\n\n if (_scaleRangesChanged(meta)) {\n start = 0;\n count = points.length;\n }\n\n if (this.options.showLine) {\n\n // https://github.com/chartjs/Chart.js/issues/11333\n if (!this.datasetElementType) {\n this.addElements();\n }\n const {dataset: line, _dataset} = meta;\n\n // Update Line\n line._chart = this.chart;\n line._datasetIndex = this.index;\n line._decimated = !!_dataset._decimated;\n line.points = points;\n\n const options = this.resolveDatasetElementOptions(mode);\n options.segment = this.options.segment;\n this.updateElement(line, undefined, {\n animated: !animationsDisabled,\n options\n }, mode);\n } else if (this.datasetElementType) {\n // https://github.com/chartjs/Chart.js/issues/11333\n delete meta.dataset;\n this.datasetElementType = false;\n }\n\n // Update Points\n this.updateElements(points, start, count, mode);\n }\n\n addElements() {\n const {showLine} = this.options;\n\n if (!this.datasetElementType && showLine) {\n this.datasetElementType = this.chart.registry.getElement('line');\n }\n\n super.addElements();\n }\n\n updateElements(points, start, count, mode) {\n const reset = mode === 'reset';\n const {iScale, vScale, _stacked, _dataset} = this._cachedMeta;\n const firstOpts = this.resolveDataElementOptions(start, mode);\n const sharedOptions = this.getSharedOptions(firstOpts);\n const includeOptions = this.includeOptions(mode, sharedOptions);\n const iAxis = iScale.axis;\n const vAxis = vScale.axis;\n const {spanGaps, segment} = this.options;\n const maxGapLength = isNumber(spanGaps) ? spanGaps : Number.POSITIVE_INFINITY;\n const directUpdate = this.chart._animationsDisabled || reset || mode === 'none';\n let prevParsed = start > 0 && this.getParsed(start - 1);\n\n for (let i = start; i < start + count; ++i) {\n const point = points[i];\n const parsed = this.getParsed(i);\n const properties = directUpdate ? point : {};\n const nullData = isNullOrUndef(parsed[vAxis]);\n const iPixel = properties[iAxis] = iScale.getPixelForValue(parsed[iAxis], i);\n const vPixel = properties[vAxis] = reset || nullData ? vScale.getBasePixel() : vScale.getPixelForValue(_stacked ? this.applyStack(vScale, parsed, _stacked) : parsed[vAxis], i);\n\n properties.skip = isNaN(iPixel) || isNaN(vPixel) || nullData;\n properties.stop = i > 0 && (Math.abs(parsed[iAxis] - prevParsed[iAxis])) > maxGapLength;\n if (segment) {\n properties.parsed = parsed;\n properties.raw = _dataset.data[i];\n }\n\n if (includeOptions) {\n properties.options = sharedOptions || this.resolveDataElementOptions(i, point.active ? 'active' : mode);\n }\n\n if (!directUpdate) {\n this.updateElement(point, i, properties, mode);\n }\n\n prevParsed = parsed;\n }\n\n this.updateSharedOptions(sharedOptions, mode, firstOpts);\n }\n\n /**\n\t * @protected\n\t */\n getMaxOverflow() {\n const meta = this._cachedMeta;\n const data = meta.data || [];\n\n if (!this.options.showLine) {\n let max = 0;\n for (let i = data.length - 1; i >= 0; --i) {\n max = Math.max(max, data[i].size(this.resolveDataElementOptions(i)) / 2);\n }\n return max > 0 && max;\n }\n\n const dataset = meta.dataset;\n const border = dataset.options && dataset.options.borderWidth || 0;\n\n if (!data.length) {\n return border;\n }\n\n const firstPoint = data[0].size(this.resolveDataElementOptions(0));\n const lastPoint = data[data.length - 1].size(this.resolveDataElementOptions(data.length - 1));\n return Math.max(border, firstPoint, lastPoint) / 2;\n }\n}\n", "/**\n * @namespace Chart._adapters\n * @since 2.8.0\n * @private\n */\n\nimport type {AnyObject} from '../types/basic.js';\nimport type {ChartOptions} from '../types/index.js';\n\nexport type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';\n\nexport interface DateAdapter {\n readonly options: T;\n /**\n * Will called with chart options after adapter creation.\n */\n init(this: DateAdapter, chartOptions: ChartOptions): void;\n /**\n * Returns a map of time formats for the supported formatting units defined\n * in Unit as well as 'datetime' representing a detailed date/time string.\n */\n formats(this: DateAdapter): Record;\n /**\n * Parses the given `value` and return the associated timestamp.\n * @param value - the value to parse (usually comes from the data)\n * @param [format] - the expected data format\n */\n parse(this: DateAdapter, value: unknown, format?: string): number | null;\n /**\n * Returns the formatted date in the specified `format` for a given `timestamp`.\n * @param timestamp - the timestamp to format\n * @param format - the date/time token\n */\n format(this: DateAdapter, timestamp: number, format: string): string;\n /**\n * Adds the specified `amount` of `unit` to the given `timestamp`.\n * @param timestamp - the input timestamp\n * @param amount - the amount to add\n * @param unit - the unit as string\n */\n add(this: DateAdapter, timestamp: number, amount: number, unit: TimeUnit): number;\n /**\n * Returns the number of `unit` between the given timestamps.\n * @param a - the input timestamp (reference)\n * @param b - the timestamp to subtract\n * @param unit - the unit as string\n */\n diff(this: DateAdapter, a: number, b: number, unit: TimeUnit): number;\n /**\n * Returns start of `unit` for the given `timestamp`.\n * @param timestamp - the input timestamp\n * @param unit - the unit as string\n * @param [weekday] - the ISO day of the week with 1 being Monday\n * and 7 being Sunday (only needed if param *unit* is `isoWeek`).\n */\n startOf(this: DateAdapter, timestamp: number, unit: TimeUnit | 'isoWeek', weekday?: number | boolean): number;\n /**\n * Returns end of `unit` for the given `timestamp`.\n * @param timestamp - the input timestamp\n * @param unit - the unit as string\n */\n endOf(this: DateAdapter, timestamp: number, unit: TimeUnit): number;\n}\n\nfunction abstract(): T {\n throw new Error('This method is not implemented: Check that a complete date adapter is provided.');\n}\n\n/**\n * Date adapter (current used by the time scale)\n * @namespace Chart._adapters._date\n * @memberof Chart._adapters\n * @private\n */\nclass DateAdapterBase implements DateAdapter {\n\n /**\n * Override default date adapter methods.\n * Accepts type parameter to define options type.\n * @example\n * Chart._adapters._date.override<{myAdapterOption: string}>({\n * init() {\n * console.log(this.options.myAdapterOption);\n * }\n * })\n */\n static override(\n members: Partial, 'options'>>\n ) {\n Object.assign(DateAdapterBase.prototype, members);\n }\n\n readonly options: AnyObject;\n\n constructor(options?: AnyObject) {\n this.options = options || {};\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n init() {}\n\n formats(): Record {\n return abstract();\n }\n\n parse(): number | null {\n return abstract();\n }\n\n format(): string {\n return abstract();\n }\n\n add(): number {\n return abstract();\n }\n\n diff(): number {\n return abstract();\n }\n\n startOf(): number {\n return abstract();\n }\n\n endOf(): number {\n return abstract();\n }\n}\n\nexport default {\n _date: DateAdapterBase as {\n new (options?: AnyObject): DateAdapter;\n override(\n members: Partial, 'options'>>\n ): void;\n }\n};\n", "import {_lookupByKey, _rlookupByKey} from '../helpers/helpers.collection.js';\nimport {getRelativePosition} from '../helpers/helpers.dom.js';\nimport {_angleBetween, getAngleFromPoint} from '../helpers/helpers.math.js';\nimport {_isPointInArea, isNullOrUndef} from '../helpers/index.js';\n\n/**\n * @typedef { import('./core.controller.js').default } Chart\n * @typedef { import('../types/index.js').ChartEvent } ChartEvent\n * @typedef {{axis?: string, intersect?: boolean, includeInvisible?: boolean}} InteractionOptions\n * @typedef {{datasetIndex: number, index: number, element: import('./core.element.js').default}} InteractionItem\n * @typedef { import('../types/index.js').Point } Point\n */\n\n/**\n * Helper function to do binary search when possible\n * @param {object} metaset - the dataset meta\n * @param {string} axis - the axis mode. x|y|xy|r\n * @param {number} value - the value to find\n * @param {boolean} [intersect] - should the element intersect\n * @returns {{lo:number, hi:number}} indices to search data array between\n */\nfunction binarySearch(metaset, axis, value, intersect) {\n const {controller, data, _sorted} = metaset;\n const iScale = controller._cachedMeta.iScale;\n const spanGaps = metaset.dataset ? metaset.dataset.options ? metaset.dataset.options.spanGaps : null : null;\n\n if (iScale && axis === iScale.axis && axis !== 'r' && _sorted && data.length) {\n const lookupMethod = iScale._reversePixels ? _rlookupByKey : _lookupByKey;\n if (!intersect) {\n const result = lookupMethod(data, axis, value);\n if (spanGaps) {\n const {vScale} = controller._cachedMeta;\n const {_parsed} = metaset;\n\n const distanceToDefinedLo = (_parsed\n .slice(0, result.lo + 1)\n .reverse()\n .findIndex(\n point => !isNullOrUndef(point[vScale.axis])));\n result.lo -= Math.max(0, distanceToDefinedLo);\n\n const distanceToDefinedHi = (_parsed\n .slice(result.hi)\n .findIndex(\n point => !isNullOrUndef(point[vScale.axis])));\n result.hi += Math.max(0, distanceToDefinedHi);\n }\n return result;\n } else if (controller._sharedOptions) {\n // _sharedOptions indicates that each element has equal options -> equal proportions\n // So we can do a ranged binary search based on the range of first element and\n // be confident to get the full range of indices that can intersect with the value.\n const el = data[0];\n const range = typeof el.getRange === 'function' && el.getRange(axis);\n if (range) {\n const start = lookupMethod(data, axis, value - range);\n const end = lookupMethod(data, axis, value + range);\n return {lo: start.lo, hi: end.hi};\n }\n }\n }\n // Default to all elements, when binary search can not be used.\n return {lo: 0, hi: data.length - 1};\n}\n\n/**\n * Helper function to select candidate elements for interaction\n * @param {Chart} chart - the chart\n * @param {string} axis - the axis mode. x|y|xy|r\n * @param {Point} position - the point to be nearest to, in relative coordinates\n * @param {function} handler - the callback to execute for each visible item\n * @param {boolean} [intersect] - consider intersecting items\n */\nfunction evaluateInteractionItems(chart, axis, position, handler, intersect) {\n const metasets = chart.getSortedVisibleDatasetMetas();\n const value = position[axis];\n for (let i = 0, ilen = metasets.length; i < ilen; ++i) {\n const {index, data} = metasets[i];\n const {lo, hi} = binarySearch(metasets[i], axis, value, intersect);\n for (let j = lo; j <= hi; ++j) {\n const element = data[j];\n if (!element.skip) {\n handler(element, index, j);\n }\n }\n }\n}\n\n/**\n * Get a distance metric function for two points based on the\n * axis mode setting\n * @param {string} axis - the axis mode. x|y|xy|r\n */\nfunction getDistanceMetricForAxis(axis) {\n const useX = axis.indexOf('x') !== -1;\n const useY = axis.indexOf('y') !== -1;\n\n return function(pt1, pt2) {\n const deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0;\n const deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0;\n return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));\n };\n}\n\n/**\n * Helper function to get the items that intersect the event position\n * @param {Chart} chart - the chart\n * @param {Point} position - the point to be nearest to, in relative coordinates\n * @param {string} axis - the axis mode. x|y|xy|r\n * @param {boolean} [useFinalPosition] - use the element's animation target instead of current position\n * @param {boolean} [includeInvisible] - include invisible points that are outside of the chart area\n * @return {InteractionItem[]} the nearest items\n */\nfunction getIntersectItems(chart, position, axis, useFinalPosition, includeInvisible) {\n const items = [];\n\n if (!includeInvisible && !chart.isPointInArea(position)) {\n return items;\n }\n\n const evaluationFunc = function(element, datasetIndex, index) {\n if (!includeInvisible && !_isPointInArea(element, chart.chartArea, 0)) {\n return;\n }\n if (element.inRange(position.x, position.y, useFinalPosition)) {\n items.push({element, datasetIndex, index});\n }\n };\n\n evaluateInteractionItems(chart, axis, position, evaluationFunc, true);\n return items;\n}\n\n/**\n * Helper function to get the items nearest to the event position for a radial chart\n * @param {Chart} chart - the chart to look at elements from\n * @param {Point} position - the point to be nearest to, in relative coordinates\n * @param {string} axis - the axes along which to measure distance\n * @param {boolean} [useFinalPosition] - use the element's animation target instead of current position\n * @return {InteractionItem[]} the nearest items\n */\nfunction getNearestRadialItems(chart, position, axis, useFinalPosition) {\n let items = [];\n\n function evaluationFunc(element, datasetIndex, index) {\n const {startAngle, endAngle} = element.getProps(['startAngle', 'endAngle'], useFinalPosition);\n const {angle} = getAngleFromPoint(element, {x: position.x, y: position.y});\n\n if (_angleBetween(angle, startAngle, endAngle)) {\n items.push({element, datasetIndex, index});\n }\n }\n\n evaluateInteractionItems(chart, axis, position, evaluationFunc);\n return items;\n}\n\n/**\n * Helper function to get the items nearest to the event position for a cartesian chart\n * @param {Chart} chart - the chart to look at elements from\n * @param {Point} position - the point to be nearest to, in relative coordinates\n * @param {string} axis - the axes along which to measure distance\n * @param {boolean} [intersect] - if true, only consider items that intersect the position\n * @param {boolean} [useFinalPosition] - use the element's animation target instead of current position\n * @param {boolean} [includeInvisible] - include invisible points that are outside of the chart area\n * @return {InteractionItem[]} the nearest items\n */\nfunction getNearestCartesianItems(chart, position, axis, intersect, useFinalPosition, includeInvisible) {\n let items = [];\n const distanceMetric = getDistanceMetricForAxis(axis);\n let minDistance = Number.POSITIVE_INFINITY;\n\n function evaluationFunc(element, datasetIndex, index) {\n const inRange = element.inRange(position.x, position.y, useFinalPosition);\n if (intersect && !inRange) {\n return;\n }\n\n const center = element.getCenterPoint(useFinalPosition);\n const pointInArea = !!includeInvisible || chart.isPointInArea(center);\n if (!pointInArea && !inRange) {\n return;\n }\n\n const distance = distanceMetric(position, center);\n if (distance < minDistance) {\n items = [{element, datasetIndex, index}];\n minDistance = distance;\n } else if (distance === minDistance) {\n // Can have multiple items at the same distance in which case we sort by size\n items.push({element, datasetIndex, index});\n }\n }\n\n evaluateInteractionItems(chart, axis, position, evaluationFunc);\n return items;\n}\n\n/**\n * Helper function to get the items nearest to the event position considering all visible items in the chart\n * @param {Chart} chart - the chart to look at elements from\n * @param {Point} position - the point to be nearest to, in relative coordinates\n * @param {string} axis - the axes along which to measure distance\n * @param {boolean} [intersect] - if true, only consider items that intersect the position\n * @param {boolean} [useFinalPosition] - use the element's animation target instead of current position\n * @param {boolean} [includeInvisible] - include invisible points that are outside of the chart area\n * @return {InteractionItem[]} the nearest items\n */\nfunction getNearestItems(chart, position, axis, intersect, useFinalPosition, includeInvisible) {\n if (!includeInvisible && !chart.isPointInArea(position)) {\n return [];\n }\n\n return axis === 'r' && !intersect\n ? getNearestRadialItems(chart, position, axis, useFinalPosition)\n : getNearestCartesianItems(chart, position, axis, intersect, useFinalPosition, includeInvisible);\n}\n\n/**\n * Helper function to get the items matching along the given X or Y axis\n * @param {Chart} chart - the chart to look at elements from\n * @param {Point} position - the point to be nearest to, in relative coordinates\n * @param {string} axis - the axis to match\n * @param {boolean} [intersect] - if true, only consider items that intersect the position\n * @param {boolean} [useFinalPosition] - use the element's animation target instead of current position\n * @return {InteractionItem[]} the nearest items\n */\nfunction getAxisItems(chart, position, axis, intersect, useFinalPosition) {\n const items = [];\n const rangeMethod = axis === 'x' ? 'inXRange' : 'inYRange';\n let intersectsItem = false;\n\n evaluateInteractionItems(chart, axis, position, (element, datasetIndex, index) => {\n if (element[rangeMethod] && element[rangeMethod](position[axis], useFinalPosition)) {\n items.push({element, datasetIndex, index});\n intersectsItem = intersectsItem || element.inRange(position.x, position.y, useFinalPosition);\n }\n });\n\n // If we want to trigger on an intersect and we don't have any items\n // that intersect the position, return nothing\n if (intersect && !intersectsItem) {\n return [];\n }\n return items;\n}\n\n/**\n * Contains interaction related functions\n * @namespace Chart.Interaction\n */\nexport default {\n // Part of the public API to facilitate developers creating their own modes\n evaluateInteractionItems,\n\n // Helper function for different modes\n modes: {\n /**\n\t\t * Returns items at the same index. If the options.intersect parameter is true, we only return items if we intersect something\n\t\t * If the options.intersect mode is false, we find the nearest item and return the items at the same index as that item\n\t\t * @function Chart.Interaction.modes.index\n\t\t * @since v2.4.0\n\t\t * @param {Chart} chart - the chart we are returning items from\n\t\t * @param {Event} e - the event we are find things at\n\t\t * @param {InteractionOptions} options - options to use\n\t\t * @param {boolean} [useFinalPosition] - use final element position (animation target)\n\t\t * @return {InteractionItem[]} - items that are found\n\t\t */\n index(chart, e, options, useFinalPosition) {\n const position = getRelativePosition(e, chart);\n // Default axis for index mode is 'x' to match old behaviour\n const axis = options.axis || 'x';\n const includeInvisible = options.includeInvisible || false;\n const items = options.intersect\n ? getIntersectItems(chart, position, axis, useFinalPosition, includeInvisible)\n : getNearestItems(chart, position, axis, false, useFinalPosition, includeInvisible);\n const elements = [];\n\n if (!items.length) {\n return [];\n }\n\n chart.getSortedVisibleDatasetMetas().forEach((meta) => {\n const index = items[0].index;\n const element = meta.data[index];\n\n // don't count items that are skipped (null data)\n if (element && !element.skip) {\n elements.push({element, datasetIndex: meta.index, index});\n }\n });\n\n return elements;\n },\n\n /**\n\t\t * Returns items in the same dataset. If the options.intersect parameter is true, we only return items if we intersect something\n\t\t * If the options.intersect is false, we find the nearest item and return the items in that dataset\n\t\t * @function Chart.Interaction.modes.dataset\n\t\t * @param {Chart} chart - the chart we are returning items from\n\t\t * @param {Event} e - the event we are find things at\n\t\t * @param {InteractionOptions} options - options to use\n\t\t * @param {boolean} [useFinalPosition] - use final element position (animation target)\n\t\t * @return {InteractionItem[]} - items that are found\n\t\t */\n dataset(chart, e, options, useFinalPosition) {\n const position = getRelativePosition(e, chart);\n const axis = options.axis || 'xy';\n const includeInvisible = options.includeInvisible || false;\n let items = options.intersect\n ? getIntersectItems(chart, position, axis, useFinalPosition, includeInvisible) :\n getNearestItems(chart, position, axis, false, useFinalPosition, includeInvisible);\n\n if (items.length > 0) {\n const datasetIndex = items[0].datasetIndex;\n const data = chart.getDatasetMeta(datasetIndex).data;\n items = [];\n for (let i = 0; i < data.length; ++i) {\n items.push({element: data[i], datasetIndex, index: i});\n }\n }\n\n return items;\n },\n\n /**\n\t\t * Point mode returns all elements that hit test based on the event position\n\t\t * of the event\n\t\t * @function Chart.Interaction.modes.intersect\n\t\t * @param {Chart} chart - the chart we are returning items from\n\t\t * @param {Event} e - the event we are find things at\n\t\t * @param {InteractionOptions} options - options to use\n\t\t * @param {boolean} [useFinalPosition] - use final element position (animation target)\n\t\t * @return {InteractionItem[]} - items that are found\n\t\t */\n point(chart, e, options, useFinalPosition) {\n const position = getRelativePosition(e, chart);\n const axis = options.axis || 'xy';\n const includeInvisible = options.includeInvisible || false;\n return getIntersectItems(chart, position, axis, useFinalPosition, includeInvisible);\n },\n\n /**\n\t\t * nearest mode returns the element closest to the point\n\t\t * @function Chart.Interaction.modes.intersect\n\t\t * @param {Chart} chart - the chart we are returning items from\n\t\t * @param {Event} e - the event we are find things at\n\t\t * @param {InteractionOptions} options - options to use\n\t\t * @param {boolean} [useFinalPosition] - use final element position (animation target)\n\t\t * @return {InteractionItem[]} - items that are found\n\t\t */\n nearest(chart, e, options, useFinalPosition) {\n const position = getRelativePosition(e, chart);\n const axis = options.axis || 'xy';\n const includeInvisible = options.includeInvisible || false;\n return getNearestItems(chart, position, axis, options.intersect, useFinalPosition, includeInvisible);\n },\n\n /**\n\t\t * x mode returns the elements that hit-test at the current x coordinate\n\t\t * @function Chart.Interaction.modes.x\n\t\t * @param {Chart} chart - the chart we are returning items from\n\t\t * @param {Event} e - the event we are find things at\n\t\t * @param {InteractionOptions} options - options to use\n\t\t * @param {boolean} [useFinalPosition] - use final element position (animation target)\n\t\t * @return {InteractionItem[]} - items that are found\n\t\t */\n x(chart, e, options, useFinalPosition) {\n const position = getRelativePosition(e, chart);\n return getAxisItems(chart, position, 'x', options.intersect, useFinalPosition);\n },\n\n /**\n\t\t * y mode returns the elements that hit-test at the current y coordinate\n\t\t * @function Chart.Interaction.modes.y\n\t\t * @param {Chart} chart - the chart we are returning items from\n\t\t * @param {Event} e - the event we are find things at\n\t\t * @param {InteractionOptions} options - options to use\n\t\t * @param {boolean} [useFinalPosition] - use final element position (animation target)\n\t\t * @return {InteractionItem[]} - items that are found\n\t\t */\n y(chart, e, options, useFinalPosition) {\n const position = getRelativePosition(e, chart);\n return getAxisItems(chart, position, 'y', options.intersect, useFinalPosition);\n }\n }\n};\n", "import {defined, each, isObject} from '../helpers/helpers.core.js';\nimport {toPadding} from '../helpers/helpers.options.js';\n\n/**\n * @typedef { import('./core.controller.js').default } Chart\n */\n\nconst STATIC_POSITIONS = ['left', 'top', 'right', 'bottom'];\n\nfunction filterByPosition(array, position) {\n return array.filter(v => v.pos === position);\n}\n\nfunction filterDynamicPositionByAxis(array, axis) {\n return array.filter(v => STATIC_POSITIONS.indexOf(v.pos) === -1 && v.box.axis === axis);\n}\n\nfunction sortByWeight(array, reverse) {\n return array.sort((a, b) => {\n const v0 = reverse ? b : a;\n const v1 = reverse ? a : b;\n return v0.weight === v1.weight ?\n v0.index - v1.index :\n v0.weight - v1.weight;\n });\n}\n\nfunction wrapBoxes(boxes) {\n const layoutBoxes = [];\n let i, ilen, box, pos, stack, stackWeight;\n\n for (i = 0, ilen = (boxes || []).length; i < ilen; ++i) {\n box = boxes[i];\n ({position: pos, options: {stack, stackWeight = 1}} = box);\n layoutBoxes.push({\n index: i,\n box,\n pos,\n horizontal: box.isHorizontal(),\n weight: box.weight,\n stack: stack && (pos + stack),\n stackWeight\n });\n }\n return layoutBoxes;\n}\n\nfunction buildStacks(layouts) {\n const stacks = {};\n for (const wrap of layouts) {\n const {stack, pos, stackWeight} = wrap;\n if (!stack || !STATIC_POSITIONS.includes(pos)) {\n continue;\n }\n const _stack = stacks[stack] || (stacks[stack] = {count: 0, placed: 0, weight: 0, size: 0});\n _stack.count++;\n _stack.weight += stackWeight;\n }\n return stacks;\n}\n\n/**\n * store dimensions used instead of available chartArea in fitBoxes\n **/\nfunction setLayoutDims(layouts, params) {\n const stacks = buildStacks(layouts);\n const {vBoxMaxWidth, hBoxMaxHeight} = params;\n let i, ilen, layout;\n for (i = 0, ilen = layouts.length; i < ilen; ++i) {\n layout = layouts[i];\n const {fullSize} = layout.box;\n const stack = stacks[layout.stack];\n const factor = stack && layout.stackWeight / stack.weight;\n if (layout.horizontal) {\n layout.width = factor ? factor * vBoxMaxWidth : fullSize && params.availableWidth;\n layout.height = hBoxMaxHeight;\n } else {\n layout.width = vBoxMaxWidth;\n layout.height = factor ? factor * hBoxMaxHeight : fullSize && params.availableHeight;\n }\n }\n return stacks;\n}\n\nfunction buildLayoutBoxes(boxes) {\n const layoutBoxes = wrapBoxes(boxes);\n const fullSize = sortByWeight(layoutBoxes.filter(wrap => wrap.box.fullSize), true);\n const left = sortByWeight(filterByPosition(layoutBoxes, 'left'), true);\n const right = sortByWeight(filterByPosition(layoutBoxes, 'right'));\n const top = sortByWeight(filterByPosition(layoutBoxes, 'top'), true);\n const bottom = sortByWeight(filterByPosition(layoutBoxes, 'bottom'));\n const centerHorizontal = filterDynamicPositionByAxis(layoutBoxes, 'x');\n const centerVertical = filterDynamicPositionByAxis(layoutBoxes, 'y');\n\n return {\n fullSize,\n leftAndTop: left.concat(top),\n rightAndBottom: right.concat(centerVertical).concat(bottom).concat(centerHorizontal),\n chartArea: filterByPosition(layoutBoxes, 'chartArea'),\n vertical: left.concat(right).concat(centerVertical),\n horizontal: top.concat(bottom).concat(centerHorizontal)\n };\n}\n\nfunction getCombinedMax(maxPadding, chartArea, a, b) {\n return Math.max(maxPadding[a], chartArea[a]) + Math.max(maxPadding[b], chartArea[b]);\n}\n\nfunction updateMaxPadding(maxPadding, boxPadding) {\n maxPadding.top = Math.max(maxPadding.top, boxPadding.top);\n maxPadding.left = Math.max(maxPadding.left, boxPadding.left);\n maxPadding.bottom = Math.max(maxPadding.bottom, boxPadding.bottom);\n maxPadding.right = Math.max(maxPadding.right, boxPadding.right);\n}\n\nfunction updateDims(chartArea, params, layout, stacks) {\n const {pos, box} = layout;\n const maxPadding = chartArea.maxPadding;\n\n // dynamically placed boxes size is not considered\n if (!isObject(pos)) {\n if (layout.size) {\n // this layout was already counted for, lets first reduce old size\n chartArea[pos] -= layout.size;\n }\n const stack = stacks[layout.stack] || {size: 0, count: 1};\n stack.size = Math.max(stack.size, layout.horizontal ? box.height : box.width);\n layout.size = stack.size / stack.count;\n chartArea[pos] += layout.size;\n }\n\n if (box.getPadding) {\n updateMaxPadding(maxPadding, box.getPadding());\n }\n\n const newWidth = Math.max(0, params.outerWidth - getCombinedMax(maxPadding, chartArea, 'left', 'right'));\n const newHeight = Math.max(0, params.outerHeight - getCombinedMax(maxPadding, chartArea, 'top', 'bottom'));\n const widthChanged = newWidth !== chartArea.w;\n const heightChanged = newHeight !== chartArea.h;\n chartArea.w = newWidth;\n chartArea.h = newHeight;\n\n // return booleans on the changes per direction\n return layout.horizontal\n ? {same: widthChanged, other: heightChanged}\n : {same: heightChanged, other: widthChanged};\n}\n\nfunction handleMaxPadding(chartArea) {\n const maxPadding = chartArea.maxPadding;\n\n function updatePos(pos) {\n const change = Math.max(maxPadding[pos] - chartArea[pos], 0);\n chartArea[pos] += change;\n return change;\n }\n chartArea.y += updatePos('top');\n chartArea.x += updatePos('left');\n updatePos('right');\n updatePos('bottom');\n}\n\nfunction getMargins(horizontal, chartArea) {\n const maxPadding = chartArea.maxPadding;\n\n function marginForPositions(positions) {\n const margin = {left: 0, top: 0, right: 0, bottom: 0};\n positions.forEach((pos) => {\n margin[pos] = Math.max(chartArea[pos], maxPadding[pos]);\n });\n return margin;\n }\n\n return horizontal\n ? marginForPositions(['left', 'right'])\n : marginForPositions(['top', 'bottom']);\n}\n\nfunction fitBoxes(boxes, chartArea, params, stacks) {\n const refitBoxes = [];\n let i, ilen, layout, box, refit, changed;\n\n for (i = 0, ilen = boxes.length, refit = 0; i < ilen; ++i) {\n layout = boxes[i];\n box = layout.box;\n\n box.update(\n layout.width || chartArea.w,\n layout.height || chartArea.h,\n getMargins(layout.horizontal, chartArea)\n );\n const {same, other} = updateDims(chartArea, params, layout, stacks);\n\n // Dimensions changed and there were non full width boxes before this\n // -> we have to refit those\n refit |= same && refitBoxes.length;\n\n // Chart area changed in the opposite direction\n changed = changed || other;\n\n if (!box.fullSize) { // fullSize boxes don't need to be re-fitted in any case\n refitBoxes.push(layout);\n }\n }\n\n return refit && fitBoxes(refitBoxes, chartArea, params, stacks) || changed;\n}\n\nfunction setBoxDims(box, left, top, width, height) {\n box.top = top;\n box.left = left;\n box.right = left + width;\n box.bottom = top + height;\n box.width = width;\n box.height = height;\n}\n\nfunction placeBoxes(boxes, chartArea, params, stacks) {\n const userPadding = params.padding;\n let {x, y} = chartArea;\n\n for (const layout of boxes) {\n const box = layout.box;\n const stack = stacks[layout.stack] || {count: 1, placed: 0, weight: 1};\n const weight = (layout.stackWeight / stack.weight) || 1;\n if (layout.horizontal) {\n const width = chartArea.w * weight;\n const height = stack.size || box.height;\n if (defined(stack.start)) {\n y = stack.start;\n }\n if (box.fullSize) {\n setBoxDims(box, userPadding.left, y, params.outerWidth - userPadding.right - userPadding.left, height);\n } else {\n setBoxDims(box, chartArea.left + stack.placed, y, width, height);\n }\n stack.start = y;\n stack.placed += width;\n y = box.bottom;\n } else {\n const height = chartArea.h * weight;\n const width = stack.size || box.width;\n if (defined(stack.start)) {\n x = stack.start;\n }\n if (box.fullSize) {\n setBoxDims(box, x, userPadding.top, width, params.outerHeight - userPadding.bottom - userPadding.top);\n } else {\n setBoxDims(box, x, chartArea.top + stack.placed, width, height);\n }\n stack.start = x;\n stack.placed += height;\n x = box.right;\n }\n }\n\n chartArea.x = x;\n chartArea.y = y;\n}\n\n/**\n * @interface LayoutItem\n * @typedef {object} LayoutItem\n * @prop {string} position - The position of the item in the chart layout. Possible values are\n * 'left', 'top', 'right', 'bottom', and 'chartArea'\n * @prop {number} weight - The weight used to sort the item. Higher weights are further away from the chart area\n * @prop {boolean} fullSize - if true, and the item is horizontal, then push vertical boxes down\n * @prop {function} isHorizontal - returns true if the layout item is horizontal (ie. top or bottom)\n * @prop {function} update - Takes two parameters: width and height. Returns size of item\n * @prop {function} draw - Draws the element\n * @prop {function} [getPadding] - Returns an object with padding on the edges\n * @prop {number} width - Width of item. Must be valid after update()\n * @prop {number} height - Height of item. Must be valid after update()\n * @prop {number} left - Left edge of the item. Set by layout system and cannot be used in update\n * @prop {number} top - Top edge of the item. Set by layout system and cannot be used in update\n * @prop {number} right - Right edge of the item. Set by layout system and cannot be used in update\n * @prop {number} bottom - Bottom edge of the item. Set by layout system and cannot be used in update\n */\n\n// The layout service is very self explanatory. It's responsible for the layout within a chart.\n// Scales, Legends and Plugins all rely on the layout service and can easily register to be placed anywhere they need\n// It is this service's responsibility of carrying out that layout.\nexport default {\n\n /**\n\t * Register a box to a chart.\n\t * A box is simply a reference to an object that requires layout. eg. Scales, Legend, Title.\n\t * @param {Chart} chart - the chart to use\n\t * @param {LayoutItem} item - the item to add to be laid out\n\t */\n addBox(chart, item) {\n if (!chart.boxes) {\n chart.boxes = [];\n }\n\n // initialize item with default values\n item.fullSize = item.fullSize || false;\n item.position = item.position || 'top';\n item.weight = item.weight || 0;\n // @ts-ignore\n item._layers = item._layers || function() {\n return [{\n z: 0,\n draw(chartArea) {\n item.draw(chartArea);\n }\n }];\n };\n\n chart.boxes.push(item);\n },\n\n /**\n\t * Remove a layoutItem from a chart\n\t * @param {Chart} chart - the chart to remove the box from\n\t * @param {LayoutItem} layoutItem - the item to remove from the layout\n\t */\n removeBox(chart, layoutItem) {\n const index = chart.boxes ? chart.boxes.indexOf(layoutItem) : -1;\n if (index !== -1) {\n chart.boxes.splice(index, 1);\n }\n },\n\n /**\n\t * Sets (or updates) options on the given `item`.\n\t * @param {Chart} chart - the chart in which the item lives (or will be added to)\n\t * @param {LayoutItem} item - the item to configure with the given options\n\t * @param {object} options - the new item options.\n\t */\n configure(chart, item, options) {\n item.fullSize = options.fullSize;\n item.position = options.position;\n item.weight = options.weight;\n },\n\n /**\n\t * Fits boxes of the given chart into the given size by having each box measure itself\n\t * then running a fitting algorithm\n\t * @param {Chart} chart - the chart\n\t * @param {number} width - the width to fit into\n\t * @param {number} height - the height to fit into\n * @param {number} minPadding - minimum padding required for each side of chart area\n\t */\n update(chart, width, height, minPadding) {\n if (!chart) {\n return;\n }\n\n const padding = toPadding(chart.options.layout.padding);\n const availableWidth = Math.max(width - padding.width, 0);\n const availableHeight = Math.max(height - padding.height, 0);\n const boxes = buildLayoutBoxes(chart.boxes);\n const verticalBoxes = boxes.vertical;\n const horizontalBoxes = boxes.horizontal;\n\n // Before any changes are made, notify boxes that an update is about to being\n // This is used to clear any cached data (e.g. scale limits)\n each(chart.boxes, box => {\n if (typeof box.beforeLayout === 'function') {\n box.beforeLayout();\n }\n });\n\n // Essentially we now have any number of boxes on each of the 4 sides.\n // Our canvas looks like the following.\n // The areas L1 and L2 are the left axes. R1 is the right axis, T1 is the top axis and\n // B1 is the bottom axis\n // There are also 4 quadrant-like locations (left to right instead of clockwise) reserved for chart overlays\n // These locations are single-box locations only, when trying to register a chartArea location that is already taken,\n // an error will be thrown.\n //\n // |----------------------------------------------------|\n // | T1 (Full Width) |\n // |----------------------------------------------------|\n // | | | T2 | |\n // | |----|-------------------------------------|----|\n // | | | C1 | | C2 | |\n // | | |----| |----| |\n // | | | | |\n // | L1 | L2 | ChartArea (C0) | R1 |\n // | | | | |\n // | | |----| |----| |\n // | | | C3 | | C4 | |\n // | |----|-------------------------------------|----|\n // | | | B1 | |\n // |----------------------------------------------------|\n // | B2 (Full Width) |\n // |----------------------------------------------------|\n //\n\n const visibleVerticalBoxCount = verticalBoxes.reduce((total, wrap) =>\n wrap.box.options && wrap.box.options.display === false ? total : total + 1, 0) || 1;\n\n const params = Object.freeze({\n outerWidth: width,\n outerHeight: height,\n padding,\n availableWidth,\n availableHeight,\n vBoxMaxWidth: availableWidth / 2 / visibleVerticalBoxCount,\n hBoxMaxHeight: availableHeight / 2\n });\n const maxPadding = Object.assign({}, padding);\n updateMaxPadding(maxPadding, toPadding(minPadding));\n const chartArea = Object.assign({\n maxPadding,\n w: availableWidth,\n h: availableHeight,\n x: padding.left,\n y: padding.top\n }, padding);\n\n const stacks = setLayoutDims(verticalBoxes.concat(horizontalBoxes), params);\n\n // First fit the fullSize boxes, to reduce probability of re-fitting.\n fitBoxes(boxes.fullSize, chartArea, params, stacks);\n\n // Then fit vertical boxes\n fitBoxes(verticalBoxes, chartArea, params, stacks);\n\n // Then fit horizontal boxes\n if (fitBoxes(horizontalBoxes, chartArea, params, stacks)) {\n // if the area changed, re-fit vertical boxes\n fitBoxes(verticalBoxes, chartArea, params, stacks);\n }\n\n handleMaxPadding(chartArea);\n\n // Finally place the boxes to correct coordinates\n placeBoxes(boxes.leftAndTop, chartArea, params, stacks);\n\n // Move to opposite side of chart\n chartArea.x += chartArea.w;\n chartArea.y += chartArea.h;\n\n placeBoxes(boxes.rightAndBottom, chartArea, params, stacks);\n\n chart.chartArea = {\n left: chartArea.left,\n top: chartArea.top,\n right: chartArea.left + chartArea.w,\n bottom: chartArea.top + chartArea.h,\n height: chartArea.h,\n width: chartArea.w,\n };\n\n // Finally update boxes in chartArea (radial scale for example)\n each(boxes.chartArea, (layout) => {\n const box = layout.box;\n Object.assign(box, chart.chartArea);\n box.update(chartArea.w, chartArea.h, {left: 0, top: 0, right: 0, bottom: 0});\n });\n }\n};\n", "\n/**\n * @typedef { import('../core/core.controller.js').default } Chart\n */\n\n/**\n * Abstract class that allows abstracting platform dependencies away from the chart.\n */\nexport default class BasePlatform {\n /**\n\t * Called at chart construction time, returns a context2d instance implementing\n\t * the [W3C Canvas 2D Context API standard]{@link https://www.w3.org/TR/2dcontext/}.\n\t * @param {HTMLCanvasElement} canvas - The canvas from which to acquire context (platform specific)\n\t * @param {number} [aspectRatio] - The chart options\n\t */\n acquireContext(canvas, aspectRatio) {} // eslint-disable-line no-unused-vars\n\n /**\n\t * Called at chart destruction time, releases any resources associated to the context\n\t * previously returned by the acquireContext() method.\n\t * @param {CanvasRenderingContext2D} context - The context2d instance\n\t * @returns {boolean} true if the method succeeded, else false\n\t */\n releaseContext(context) { // eslint-disable-line no-unused-vars\n return false;\n }\n\n /**\n\t * Registers the specified listener on the given chart.\n\t * @param {Chart} chart - Chart from which to listen for event\n\t * @param {string} type - The ({@link ChartEvent}) type to listen for\n\t * @param {function} listener - Receives a notification (an object that implements\n\t * the {@link ChartEvent} interface) when an event of the specified type occurs.\n\t */\n addEventListener(chart, type, listener) {} // eslint-disable-line no-unused-vars\n\n /**\n\t * Removes the specified listener previously registered with addEventListener.\n\t * @param {Chart} chart - Chart from which to remove the listener\n\t * @param {string} type - The ({@link ChartEvent}) type to remove\n\t * @param {function} listener - The listener function to remove from the event target.\n\t */\n removeEventListener(chart, type, listener) {} // eslint-disable-line no-unused-vars\n\n /**\n\t * @returns {number} the current devicePixelRatio of the device this platform is connected to.\n\t */\n getDevicePixelRatio() {\n return 1;\n }\n\n /**\n\t * Returns the maximum size in pixels of given canvas element.\n\t * @param {HTMLCanvasElement} element\n\t * @param {number} [width] - content width of parent element\n\t * @param {number} [height] - content height of parent element\n\t * @param {number} [aspectRatio] - aspect ratio to maintain\n\t */\n getMaximumSize(element, width, height, aspectRatio) {\n width = Math.max(0, width || element.width);\n height = height || element.height;\n return {\n width,\n height: Math.max(0, aspectRatio ? Math.floor(width / aspectRatio) : height)\n };\n }\n\n /**\n\t * @param {HTMLCanvasElement} canvas\n\t * @returns {boolean} true if the canvas is attached to the platform, false if not.\n\t */\n isAttached(canvas) { // eslint-disable-line no-unused-vars\n return true;\n }\n\n /**\n * Updates config with platform specific requirements\n * @param {import('../core/core.config.js').default} config\n */\n updateConfig(config) { // eslint-disable-line no-unused-vars\n // no-op\n }\n}\n", "/**\n * Platform fallback implementation (minimal).\n * @see https://github.com/chartjs/Chart.js/pull/4591#issuecomment-319575939\n */\n\nimport BasePlatform from './platform.base.js';\n\n/**\n * Platform class for charts without access to the DOM or to many element properties\n * This platform is used by default for any chart passed an OffscreenCanvas.\n * @extends BasePlatform\n */\nexport default class BasicPlatform extends BasePlatform {\n acquireContext(item) {\n // To prevent canvas fingerprinting, some add-ons undefine the getContext\n // method, for example: https://github.com/kkapsner/CanvasBlocker\n // https://github.com/chartjs/Chart.js/issues/2807\n return item && item.getContext && item.getContext('2d') || null;\n }\n updateConfig(config) {\n config.options.animation = false;\n }\n}\n", "/**\n * Chart.Platform implementation for targeting a web browser\n */\n\nimport BasePlatform from './platform.base.js';\nimport {_getParentNode, getRelativePosition, supportsEventListenerOptions, readUsedSize, getMaximumSize} from '../helpers/helpers.dom.js';\nimport {throttled} from '../helpers/helpers.extras.js';\nimport {isNullOrUndef} from '../helpers/helpers.core.js';\n\n/**\n * @typedef { import('../core/core.controller.js').default } Chart\n */\n\nconst EXPANDO_KEY = '$chartjs';\n\n/**\n * DOM event types -> Chart.js event types.\n * Note: only events with different types are mapped.\n * @see https://developer.mozilla.org/en-US/docs/Web/Events\n */\nconst EVENT_TYPES = {\n touchstart: 'mousedown',\n touchmove: 'mousemove',\n touchend: 'mouseup',\n pointerenter: 'mouseenter',\n pointerdown: 'mousedown',\n pointermove: 'mousemove',\n pointerup: 'mouseup',\n pointerleave: 'mouseout',\n pointerout: 'mouseout'\n};\n\nconst isNullOrEmpty = value => value === null || value === '';\n/**\n * Initializes the canvas style and render size without modifying the canvas display size,\n * since responsiveness is handled by the controller.resize() method. The config is used\n * to determine the aspect ratio to apply in case no explicit height has been specified.\n * @param {HTMLCanvasElement} canvas\n * @param {number} [aspectRatio]\n */\nfunction initCanvas(canvas, aspectRatio) {\n const style = canvas.style;\n\n // NOTE(SB) canvas.getAttribute('width') !== canvas.width: in the first case it\n // returns null or '' if no explicit value has been set to the canvas attribute.\n const renderHeight = canvas.getAttribute('height');\n const renderWidth = canvas.getAttribute('width');\n\n // Chart.js modifies some canvas values that we want to restore on destroy\n canvas[EXPANDO_KEY] = {\n initial: {\n height: renderHeight,\n width: renderWidth,\n style: {\n display: style.display,\n height: style.height,\n width: style.width\n }\n }\n };\n\n // Force canvas to display as block to avoid extra space caused by inline\n // elements, which would interfere with the responsive resize process.\n // https://github.com/chartjs/Chart.js/issues/2538\n style.display = style.display || 'block';\n // Include possible borders in the size\n style.boxSizing = style.boxSizing || 'border-box';\n\n if (isNullOrEmpty(renderWidth)) {\n const displayWidth = readUsedSize(canvas, 'width');\n if (displayWidth !== undefined) {\n canvas.width = displayWidth;\n }\n }\n\n if (isNullOrEmpty(renderHeight)) {\n if (canvas.style.height === '') {\n // If no explicit render height and style height, let's apply the aspect ratio,\n // which one can be specified by the user but also by charts as default option\n // (i.e. options.aspectRatio). If not specified, use canvas aspect ratio of 2.\n canvas.height = canvas.width / (aspectRatio || 2);\n } else {\n const displayHeight = readUsedSize(canvas, 'height');\n if (displayHeight !== undefined) {\n canvas.height = displayHeight;\n }\n }\n }\n\n return canvas;\n}\n\n// Default passive to true as expected by Chrome for 'touchstart' and 'touchend' events.\n// https://github.com/chartjs/Chart.js/issues/4287\nconst eventListenerOptions = supportsEventListenerOptions ? {passive: true} : false;\n\nfunction addListener(node, type, listener) {\n if (node) {\n node.addEventListener(type, listener, eventListenerOptions);\n }\n}\n\nfunction removeListener(chart, type, listener) {\n if (chart && chart.canvas) {\n chart.canvas.removeEventListener(type, listener, eventListenerOptions);\n }\n}\n\nfunction fromNativeEvent(event, chart) {\n const type = EVENT_TYPES[event.type] || event.type;\n const {x, y} = getRelativePosition(event, chart);\n return {\n type,\n chart,\n native: event,\n x: x !== undefined ? x : null,\n y: y !== undefined ? y : null,\n };\n}\n\nfunction nodeListContains(nodeList, canvas) {\n for (const node of nodeList) {\n if (node === canvas || node.contains(canvas)) {\n return true;\n }\n }\n}\n\nfunction createAttachObserver(chart, type, listener) {\n const canvas = chart.canvas;\n const observer = new MutationObserver(entries => {\n let trigger = false;\n for (const entry of entries) {\n trigger = trigger || nodeListContains(entry.addedNodes, canvas);\n trigger = trigger && !nodeListContains(entry.removedNodes, canvas);\n }\n if (trigger) {\n listener();\n }\n });\n observer.observe(document, {childList: true, subtree: true});\n return observer;\n}\n\nfunction createDetachObserver(chart, type, listener) {\n const canvas = chart.canvas;\n const observer = new MutationObserver(entries => {\n let trigger = false;\n for (const entry of entries) {\n trigger = trigger || nodeListContains(entry.removedNodes, canvas);\n trigger = trigger && !nodeListContains(entry.addedNodes, canvas);\n }\n if (trigger) {\n listener();\n }\n });\n observer.observe(document, {childList: true, subtree: true});\n return observer;\n}\n\nconst drpListeningCharts = new Map();\nlet oldDevicePixelRatio = 0;\n\nfunction onWindowResize() {\n const dpr = window.devicePixelRatio;\n if (dpr === oldDevicePixelRatio) {\n return;\n }\n oldDevicePixelRatio = dpr;\n drpListeningCharts.forEach((resize, chart) => {\n if (chart.currentDevicePixelRatio !== dpr) {\n resize();\n }\n });\n}\n\nfunction listenDevicePixelRatioChanges(chart, resize) {\n if (!drpListeningCharts.size) {\n window.addEventListener('resize', onWindowResize);\n }\n drpListeningCharts.set(chart, resize);\n}\n\nfunction unlistenDevicePixelRatioChanges(chart) {\n drpListeningCharts.delete(chart);\n if (!drpListeningCharts.size) {\n window.removeEventListener('resize', onWindowResize);\n }\n}\n\nfunction createResizeObserver(chart, type, listener) {\n const canvas = chart.canvas;\n const container = canvas && _getParentNode(canvas);\n if (!container) {\n return;\n }\n const resize = throttled((width, height) => {\n const w = container.clientWidth;\n listener(width, height);\n if (w < container.clientWidth) {\n // If the container size shrank during chart resize, let's assume\n // scrollbar appeared. So we resize again with the scrollbar visible -\n // effectively making chart smaller and the scrollbar hidden again.\n // Because we are inside `throttled`, and currently `ticking`, scroll\n // events are ignored during this whole 2 resize process.\n // If we assumed wrong and something else happened, we are resizing\n // twice in a frame (potential performance issue)\n listener();\n }\n }, window);\n\n // @ts-ignore until https://github.com/microsoft/TypeScript/issues/37861 implemented\n const observer = new ResizeObserver(entries => {\n const entry = entries[0];\n const width = entry.contentRect.width;\n const height = entry.contentRect.height;\n // When its container's display is set to 'none' the callback will be called with a\n // size of (0, 0), which will cause the chart to lose its original height, so skip\n // resizing in such case.\n if (width === 0 && height === 0) {\n return;\n }\n resize(width, height);\n });\n observer.observe(container);\n listenDevicePixelRatioChanges(chart, resize);\n\n return observer;\n}\n\nfunction releaseObserver(chart, type, observer) {\n if (observer) {\n observer.disconnect();\n }\n if (type === 'resize') {\n unlistenDevicePixelRatioChanges(chart);\n }\n}\n\nfunction createProxyAndListen(chart, type, listener) {\n const canvas = chart.canvas;\n const proxy = throttled((event) => {\n // This case can occur if the chart is destroyed while waiting\n // for the throttled function to occur. We prevent crashes by checking\n // for a destroyed chart\n if (chart.ctx !== null) {\n listener(fromNativeEvent(event, chart));\n }\n }, chart);\n\n addListener(canvas, type, proxy);\n\n return proxy;\n}\n\n/**\n * Platform class for charts that can access the DOM and global window/document properties\n * @extends BasePlatform\n */\nexport default class DomPlatform extends BasePlatform {\n\n /**\n\t * @param {HTMLCanvasElement} canvas\n\t * @param {number} [aspectRatio]\n\t * @return {CanvasRenderingContext2D|null}\n\t */\n acquireContext(canvas, aspectRatio) {\n // To prevent canvas fingerprinting, some add-ons undefine the getContext\n // method, for example: https://github.com/kkapsner/CanvasBlocker\n // https://github.com/chartjs/Chart.js/issues/2807\n const context = canvas && canvas.getContext && canvas.getContext('2d');\n\n // `instanceof HTMLCanvasElement/CanvasRenderingContext2D` fails when the canvas is\n // inside an iframe or when running in a protected environment. We could guess the\n // types from their toString() value but let's keep things flexible and assume it's\n // a sufficient condition if the canvas has a context2D which has canvas as `canvas`.\n // https://github.com/chartjs/Chart.js/issues/3887\n // https://github.com/chartjs/Chart.js/issues/4102\n // https://github.com/chartjs/Chart.js/issues/4152\n if (context && context.canvas === canvas) {\n // Load platform resources on first chart creation, to make it possible to\n // import the library before setting platform options.\n initCanvas(canvas, aspectRatio);\n return context;\n }\n\n return null;\n }\n\n /**\n\t * @param {CanvasRenderingContext2D} context\n\t */\n releaseContext(context) {\n const canvas = context.canvas;\n if (!canvas[EXPANDO_KEY]) {\n return false;\n }\n\n const initial = canvas[EXPANDO_KEY].initial;\n ['height', 'width'].forEach((prop) => {\n const value = initial[prop];\n if (isNullOrUndef(value)) {\n canvas.removeAttribute(prop);\n } else {\n canvas.setAttribute(prop, value);\n }\n });\n\n const style = initial.style || {};\n Object.keys(style).forEach((key) => {\n canvas.style[key] = style[key];\n });\n\n // The canvas render size might have been changed (and thus the state stack discarded),\n // we can't use save() and restore() to restore the initial state. So make sure that at\n // least the canvas context is reset to the default state by setting the canvas width.\n // https://www.w3.org/TR/2011/WD-html5-20110525/the-canvas-element.html\n // eslint-disable-next-line no-self-assign\n canvas.width = canvas.width;\n\n delete canvas[EXPANDO_KEY];\n return true;\n }\n\n /**\n\t *\n\t * @param {Chart} chart\n\t * @param {string} type\n\t * @param {function} listener\n\t */\n addEventListener(chart, type, listener) {\n // Can have only one listener per type, so make sure previous is removed\n this.removeEventListener(chart, type);\n\n const proxies = chart.$proxies || (chart.$proxies = {});\n const handlers = {\n attach: createAttachObserver,\n detach: createDetachObserver,\n resize: createResizeObserver\n };\n const handler = handlers[type] || createProxyAndListen;\n proxies[type] = handler(chart, type, listener);\n }\n\n\n /**\n\t * @param {Chart} chart\n\t * @param {string} type\n\t */\n removeEventListener(chart, type) {\n const proxies = chart.$proxies || (chart.$proxies = {});\n const proxy = proxies[type];\n\n if (!proxy) {\n return;\n }\n\n const handlers = {\n attach: releaseObserver,\n detach: releaseObserver,\n resize: releaseObserver\n };\n const handler = handlers[type] || removeListener;\n handler(chart, type, proxy);\n proxies[type] = undefined;\n }\n\n getDevicePixelRatio() {\n return window.devicePixelRatio;\n }\n\n /**\n\t * @param {HTMLCanvasElement} canvas\n\t * @param {number} [width] - content width of parent element\n\t * @param {number} [height] - content height of parent element\n\t * @param {number} [aspectRatio] - aspect ratio to maintain\n\t */\n getMaximumSize(canvas, width, height, aspectRatio) {\n return getMaximumSize(canvas, width, height, aspectRatio);\n }\n\n /**\n\t * @param {HTMLCanvasElement} canvas\n\t */\n isAttached(canvas) {\n const container = canvas && _getParentNode(canvas);\n return !!(container && container.isConnected);\n }\n}\n", "import {_isDomSupported} from '../helpers/index.js';\nimport BasePlatform from './platform.base.js';\nimport BasicPlatform from './platform.basic.js';\nimport DomPlatform from './platform.dom.js';\n\nexport function _detectPlatform(canvas) {\n if (!_isDomSupported() || (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas)) {\n return BasicPlatform;\n }\n return DomPlatform;\n}\n\nexport {BasePlatform, BasicPlatform, DomPlatform};\n", "import type {AnyObject} from '../types/basic.js';\nimport type {Point} from '../types/geometric.js';\nimport type {Animation} from '../types/animation.js';\nimport {isNumber} from '../helpers/helpers.math.js';\n\nexport default class Element {\n\n static defaults = {};\n static defaultRoutes = undefined;\n\n x: number;\n y: number;\n active = false;\n options: O;\n $animations: Record;\n\n tooltipPosition(useFinalPosition: boolean): Point {\n const {x, y} = this.getProps(['x', 'y'], useFinalPosition);\n return {x, y} as Point;\n }\n\n hasValue() {\n return isNumber(this.x) && isNumber(this.y);\n }\n\n /**\n * Gets the current or final value of each prop. Can return extra properties (whole object).\n * @param props - properties to get\n * @param [final] - get the final value (animation target)\n */\n getProps

    (props: P, final?: boolean): Pick;\n getProps

    (props: P[], final?: boolean): Partial>;\n getProps(props: string[], final?: boolean): Partial> {\n const anims = this.$animations;\n if (!final || !anims) {\n // let's not create an object, if not needed\n return this as Record;\n }\n const ret: Record = {};\n props.forEach((prop) => {\n ret[prop] = anims[prop] && anims[prop].active() ? anims[prop]._to : this[prop as string];\n });\n return ret;\n }\n}\n", "import {isNullOrUndef, valueOrDefault} from '../helpers/helpers.core.js';\nimport {_factorize} from '../helpers/helpers.math.js';\n\n\n/**\n * @typedef { import('./core.controller.js').default } Chart\n * @typedef {{value:number | string, label?:string, major?:boolean, $context?:any}} Tick\n */\n\n/**\n * Returns a subset of ticks to be plotted to avoid overlapping labels.\n * @param {import('./core.scale.js').default} scale\n * @param {Tick[]} ticks\n * @return {Tick[]}\n * @private\n */\nexport function autoSkip(scale, ticks) {\n const tickOpts = scale.options.ticks;\n const determinedMaxTicks = determineMaxTicks(scale);\n const ticksLimit = Math.min(tickOpts.maxTicksLimit || determinedMaxTicks, determinedMaxTicks);\n const majorIndices = tickOpts.major.enabled ? getMajorIndices(ticks) : [];\n const numMajorIndices = majorIndices.length;\n const first = majorIndices[0];\n const last = majorIndices[numMajorIndices - 1];\n const newTicks = [];\n\n // If there are too many major ticks to display them all\n if (numMajorIndices > ticksLimit) {\n skipMajors(ticks, newTicks, majorIndices, numMajorIndices / ticksLimit);\n return newTicks;\n }\n\n const spacing = calculateSpacing(majorIndices, ticks, ticksLimit);\n\n if (numMajorIndices > 0) {\n let i, ilen;\n const avgMajorSpacing = numMajorIndices > 1 ? Math.round((last - first) / (numMajorIndices - 1)) : null;\n skip(ticks, newTicks, spacing, isNullOrUndef(avgMajorSpacing) ? 0 : first - avgMajorSpacing, first);\n for (i = 0, ilen = numMajorIndices - 1; i < ilen; i++) {\n skip(ticks, newTicks, spacing, majorIndices[i], majorIndices[i + 1]);\n }\n skip(ticks, newTicks, spacing, last, isNullOrUndef(avgMajorSpacing) ? ticks.length : last + avgMajorSpacing);\n return newTicks;\n }\n skip(ticks, newTicks, spacing);\n return newTicks;\n}\n\nfunction determineMaxTicks(scale) {\n const offset = scale.options.offset;\n const tickLength = scale._tickSize();\n const maxScale = scale._length / tickLength + (offset ? 0 : 1);\n const maxChart = scale._maxLength / tickLength;\n return Math.floor(Math.min(maxScale, maxChart));\n}\n\n/**\n * @param {number[]} majorIndices\n * @param {Tick[]} ticks\n * @param {number} ticksLimit\n */\nfunction calculateSpacing(majorIndices, ticks, ticksLimit) {\n const evenMajorSpacing = getEvenSpacing(majorIndices);\n const spacing = ticks.length / ticksLimit;\n\n // If the major ticks are evenly spaced apart, place the minor ticks\n // so that they divide the major ticks into even chunks\n if (!evenMajorSpacing) {\n return Math.max(spacing, 1);\n }\n\n const factors = _factorize(evenMajorSpacing);\n for (let i = 0, ilen = factors.length - 1; i < ilen; i++) {\n const factor = factors[i];\n if (factor > spacing) {\n return factor;\n }\n }\n return Math.max(spacing, 1);\n}\n\n/**\n * @param {Tick[]} ticks\n */\nfunction getMajorIndices(ticks) {\n const result = [];\n let i, ilen;\n for (i = 0, ilen = ticks.length; i < ilen; i++) {\n if (ticks[i].major) {\n result.push(i);\n }\n }\n return result;\n}\n\n/**\n * @param {Tick[]} ticks\n * @param {Tick[]} newTicks\n * @param {number[]} majorIndices\n * @param {number} spacing\n */\nfunction skipMajors(ticks, newTicks, majorIndices, spacing) {\n let count = 0;\n let next = majorIndices[0];\n let i;\n\n spacing = Math.ceil(spacing);\n for (i = 0; i < ticks.length; i++) {\n if (i === next) {\n newTicks.push(ticks[i]);\n count++;\n next = majorIndices[count * spacing];\n }\n }\n}\n\n/**\n * @param {Tick[]} ticks\n * @param {Tick[]} newTicks\n * @param {number} spacing\n * @param {number} [majorStart]\n * @param {number} [majorEnd]\n */\nfunction skip(ticks, newTicks, spacing, majorStart, majorEnd) {\n const start = valueOrDefault(majorStart, 0);\n const end = Math.min(valueOrDefault(majorEnd, ticks.length), ticks.length);\n let count = 0;\n let length, i, next;\n\n spacing = Math.ceil(spacing);\n if (majorEnd) {\n length = majorEnd - majorStart;\n spacing = length / Math.floor(length / spacing);\n }\n\n next = start;\n\n while (next < 0) {\n count++;\n next = Math.round(start + count * spacing);\n }\n\n for (i = Math.max(start, 0); i < end; i++) {\n if (i === next) {\n newTicks.push(ticks[i]);\n count++;\n next = Math.round(start + count * spacing);\n }\n }\n}\n\n\n/**\n * @param {number[]} arr\n */\nfunction getEvenSpacing(arr) {\n const len = arr.length;\n let i, diff;\n\n if (len < 2) {\n return false;\n }\n\n for (diff = arr[0], i = 1; i < len; ++i) {\n if (arr[i] - arr[i - 1] !== diff) {\n return false;\n }\n }\n return diff;\n}\n", "import Element from './core.element.js';\nimport {_alignPixel, _measureText, renderText, clipArea, unclipArea} from '../helpers/helpers.canvas.js';\nimport {callback as call, each, finiteOrDefault, isArray, isFinite, isNullOrUndef, isObject, valueOrDefault} from '../helpers/helpers.core.js';\nimport {toDegrees, toRadians, _int16Range, _limitValue, HALF_PI} from '../helpers/helpers.math.js';\nimport {_alignStartEnd, _toLeftRightCenter} from '../helpers/helpers.extras.js';\nimport {createContext, toFont, toPadding, _addGrace} from '../helpers/helpers.options.js';\nimport {autoSkip} from './core.scale.autoskip.js';\n\nconst reverseAlign = (align) => align === 'left' ? 'right' : align === 'right' ? 'left' : align;\nconst offsetFromEdge = (scale, edge, offset) => edge === 'top' || edge === 'left' ? scale[edge] + offset : scale[edge] - offset;\nconst getTicksLimit = (ticksLength, maxTicksLimit) => Math.min(maxTicksLimit || ticksLength, ticksLength);\n\n/**\n * @typedef { import('../types/index.js').Chart } Chart\n * @typedef {{value:number | string, label?:string, major?:boolean, $context?:any}} Tick\n */\n\n/**\n * Returns a new array containing numItems from arr\n * @param {any[]} arr\n * @param {number} numItems\n */\nfunction sample(arr, numItems) {\n const result = [];\n const increment = arr.length / numItems;\n const len = arr.length;\n let i = 0;\n\n for (; i < len; i += increment) {\n result.push(arr[Math.floor(i)]);\n }\n return result;\n}\n\n/**\n * @param {Scale} scale\n * @param {number} index\n * @param {boolean} offsetGridLines\n */\nfunction getPixelForGridLine(scale, index, offsetGridLines) {\n const length = scale.ticks.length;\n const validIndex = Math.min(index, length - 1);\n const start = scale._startPixel;\n const end = scale._endPixel;\n const epsilon = 1e-6; // 1e-6 is margin in pixels for accumulated error.\n let lineValue = scale.getPixelForTick(validIndex);\n let offset;\n\n if (offsetGridLines) {\n if (length === 1) {\n offset = Math.max(lineValue - start, end - lineValue);\n } else if (index === 0) {\n offset = (scale.getPixelForTick(1) - lineValue) / 2;\n } else {\n offset = (lineValue - scale.getPixelForTick(validIndex - 1)) / 2;\n }\n lineValue += validIndex < index ? offset : -offset;\n\n // Return undefined if the pixel is out of the range\n if (lineValue < start - epsilon || lineValue > end + epsilon) {\n return;\n }\n }\n return lineValue;\n}\n\n/**\n * @param {object} caches\n * @param {number} length\n */\nfunction garbageCollect(caches, length) {\n each(caches, (cache) => {\n const gc = cache.gc;\n const gcLen = gc.length / 2;\n let i;\n if (gcLen > length) {\n for (i = 0; i < gcLen; ++i) {\n delete cache.data[gc[i]];\n }\n gc.splice(0, gcLen);\n }\n });\n}\n\n/**\n * @param {object} options\n */\nfunction getTickMarkLength(options) {\n return options.drawTicks ? options.tickLength : 0;\n}\n\n/**\n * @param {object} options\n */\nfunction getTitleHeight(options, fallback) {\n if (!options.display) {\n return 0;\n }\n\n const font = toFont(options.font, fallback);\n const padding = toPadding(options.padding);\n const lines = isArray(options.text) ? options.text.length : 1;\n\n return (lines * font.lineHeight) + padding.height;\n}\n\nfunction createScaleContext(parent, scale) {\n return createContext(parent, {\n scale,\n type: 'scale'\n });\n}\n\nfunction createTickContext(parent, index, tick) {\n return createContext(parent, {\n tick,\n index,\n type: 'tick'\n });\n}\n\nfunction titleAlign(align, position, reverse) {\n /** @type {CanvasTextAlign} */\n let ret = _toLeftRightCenter(align);\n if ((reverse && position !== 'right') || (!reverse && position === 'right')) {\n ret = reverseAlign(ret);\n }\n return ret;\n}\n\nfunction titleArgs(scale, offset, position, align) {\n const {top, left, bottom, right, chart} = scale;\n const {chartArea, scales} = chart;\n let rotation = 0;\n let maxWidth, titleX, titleY;\n const height = bottom - top;\n const width = right - left;\n\n if (scale.isHorizontal()) {\n titleX = _alignStartEnd(align, left, right);\n\n if (isObject(position)) {\n const positionAxisID = Object.keys(position)[0];\n const value = position[positionAxisID];\n titleY = scales[positionAxisID].getPixelForValue(value) + height - offset;\n } else if (position === 'center') {\n titleY = (chartArea.bottom + chartArea.top) / 2 + height - offset;\n } else {\n titleY = offsetFromEdge(scale, position, offset);\n }\n maxWidth = right - left;\n } else {\n if (isObject(position)) {\n const positionAxisID = Object.keys(position)[0];\n const value = position[positionAxisID];\n titleX = scales[positionAxisID].getPixelForValue(value) - width + offset;\n } else if (position === 'center') {\n titleX = (chartArea.left + chartArea.right) / 2 - width + offset;\n } else {\n titleX = offsetFromEdge(scale, position, offset);\n }\n titleY = _alignStartEnd(align, bottom, top);\n rotation = position === 'left' ? -HALF_PI : HALF_PI;\n }\n return {titleX, titleY, maxWidth, rotation};\n}\n\nexport default class Scale extends Element {\n\n // eslint-disable-next-line max-statements\n constructor(cfg) {\n super();\n\n /** @type {string} */\n this.id = cfg.id;\n /** @type {string} */\n this.type = cfg.type;\n /** @type {any} */\n this.options = undefined;\n /** @type {CanvasRenderingContext2D} */\n this.ctx = cfg.ctx;\n /** @type {Chart} */\n this.chart = cfg.chart;\n\n // implements box\n /** @type {number} */\n this.top = undefined;\n /** @type {number} */\n this.bottom = undefined;\n /** @type {number} */\n this.left = undefined;\n /** @type {number} */\n this.right = undefined;\n /** @type {number} */\n this.width = undefined;\n /** @type {number} */\n this.height = undefined;\n this._margins = {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0\n };\n /** @type {number} */\n this.maxWidth = undefined;\n /** @type {number} */\n this.maxHeight = undefined;\n /** @type {number} */\n this.paddingTop = undefined;\n /** @type {number} */\n this.paddingBottom = undefined;\n /** @type {number} */\n this.paddingLeft = undefined;\n /** @type {number} */\n this.paddingRight = undefined;\n\n // scale-specific properties\n /** @type {string=} */\n this.axis = undefined;\n /** @type {number=} */\n this.labelRotation = undefined;\n this.min = undefined;\n this.max = undefined;\n this._range = undefined;\n /** @type {Tick[]} */\n this.ticks = [];\n /** @type {object[]|null} */\n this._gridLineItems = null;\n /** @type {object[]|null} */\n this._labelItems = null;\n /** @type {object|null} */\n this._labelSizes = null;\n this._length = 0;\n this._maxLength = 0;\n this._longestTextCache = {};\n /** @type {number} */\n this._startPixel = undefined;\n /** @type {number} */\n this._endPixel = undefined;\n this._reversePixels = false;\n this._userMax = undefined;\n this._userMin = undefined;\n this._suggestedMax = undefined;\n this._suggestedMin = undefined;\n this._ticksLength = 0;\n this._borderValue = 0;\n this._cache = {};\n this._dataLimitsCached = false;\n this.$context = undefined;\n }\n\n /**\n\t * @param {any} options\n\t * @since 3.0\n\t */\n init(options) {\n this.options = options.setContext(this.getContext());\n\n this.axis = options.axis;\n\n // parse min/max value, so we can properly determine min/max for other scales\n this._userMin = this.parse(options.min);\n this._userMax = this.parse(options.max);\n this._suggestedMin = this.parse(options.suggestedMin);\n this._suggestedMax = this.parse(options.suggestedMax);\n }\n\n /**\n\t * Parse a supported input value to internal representation.\n\t * @param {*} raw\n\t * @param {number} [index]\n\t * @since 3.0\n\t */\n parse(raw, index) { // eslint-disable-line no-unused-vars\n return raw;\n }\n\n /**\n\t * @return {{min: number, max: number, minDefined: boolean, maxDefined: boolean}}\n\t * @protected\n\t * @since 3.0\n\t */\n getUserBounds() {\n let {_userMin, _userMax, _suggestedMin, _suggestedMax} = this;\n _userMin = finiteOrDefault(_userMin, Number.POSITIVE_INFINITY);\n _userMax = finiteOrDefault(_userMax, Number.NEGATIVE_INFINITY);\n _suggestedMin = finiteOrDefault(_suggestedMin, Number.POSITIVE_INFINITY);\n _suggestedMax = finiteOrDefault(_suggestedMax, Number.NEGATIVE_INFINITY);\n return {\n min: finiteOrDefault(_userMin, _suggestedMin),\n max: finiteOrDefault(_userMax, _suggestedMax),\n minDefined: isFinite(_userMin),\n maxDefined: isFinite(_userMax)\n };\n }\n\n /**\n\t * @param {boolean} canStack\n\t * @return {{min: number, max: number}}\n\t * @protected\n\t * @since 3.0\n\t */\n getMinMax(canStack) {\n let {min, max, minDefined, maxDefined} = this.getUserBounds();\n let range;\n\n if (minDefined && maxDefined) {\n return {min, max};\n }\n\n const metas = this.getMatchingVisibleMetas();\n for (let i = 0, ilen = metas.length; i < ilen; ++i) {\n range = metas[i].controller.getMinMax(this, canStack);\n if (!minDefined) {\n min = Math.min(min, range.min);\n }\n if (!maxDefined) {\n max = Math.max(max, range.max);\n }\n }\n\n // Make sure min <= max when only min or max is defined by user and the data is outside that range\n min = maxDefined && min > max ? max : min;\n max = minDefined && min > max ? min : max;\n\n return {\n min: finiteOrDefault(min, finiteOrDefault(max, min)),\n max: finiteOrDefault(max, finiteOrDefault(min, max))\n };\n }\n\n /**\n\t * Get the padding needed for the scale\n\t * @return {{top: number, left: number, bottom: number, right: number}} the necessary padding\n\t * @private\n\t */\n getPadding() {\n return {\n left: this.paddingLeft || 0,\n top: this.paddingTop || 0,\n right: this.paddingRight || 0,\n bottom: this.paddingBottom || 0\n };\n }\n\n /**\n\t * Returns the scale tick objects\n\t * @return {Tick[]}\n\t * @since 2.7\n\t */\n getTicks() {\n return this.ticks;\n }\n\n /**\n\t * @return {string[]}\n\t */\n getLabels() {\n const data = this.chart.data;\n return this.options.labels || (this.isHorizontal() ? data.xLabels : data.yLabels) || data.labels || [];\n }\n\n /**\n * @return {import('../types.js').LabelItem[]}\n */\n getLabelItems(chartArea = this.chart.chartArea) {\n const items = this._labelItems || (this._labelItems = this._computeLabelItems(chartArea));\n return items;\n }\n\n // When a new layout is created, reset the data limits cache\n beforeLayout() {\n this._cache = {};\n this._dataLimitsCached = false;\n }\n\n // These methods are ordered by lifecycle. Utilities then follow.\n // Any function defined here is inherited by all scale types.\n // Any function can be extended by the scale type\n\n beforeUpdate() {\n call(this.options.beforeUpdate, [this]);\n }\n\n /**\n\t * @param {number} maxWidth - the max width in pixels\n\t * @param {number} maxHeight - the max height in pixels\n\t * @param {{top: number, left: number, bottom: number, right: number}} margins - the space between the edge of the other scales and edge of the chart\n\t * This space comes from two sources:\n\t * - padding - space that's required to show the labels at the edges of the scale\n\t * - thickness of scales or legends in another orientation\n\t */\n update(maxWidth, maxHeight, margins) {\n const {beginAtZero, grace, ticks: tickOpts} = this.options;\n const sampleSize = tickOpts.sampleSize;\n\n // Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)\n this.beforeUpdate();\n\n // Absorb the master measurements\n this.maxWidth = maxWidth;\n this.maxHeight = maxHeight;\n this._margins = margins = Object.assign({\n left: 0,\n right: 0,\n top: 0,\n bottom: 0\n }, margins);\n\n this.ticks = null;\n this._labelSizes = null;\n this._gridLineItems = null;\n this._labelItems = null;\n\n // Dimensions\n this.beforeSetDimensions();\n this.setDimensions();\n this.afterSetDimensions();\n\n this._maxLength = this.isHorizontal()\n ? this.width + margins.left + margins.right\n : this.height + margins.top + margins.bottom;\n\n // Data min/max\n if (!this._dataLimitsCached) {\n this.beforeDataLimits();\n this.determineDataLimits();\n this.afterDataLimits();\n this._range = _addGrace(this, grace, beginAtZero);\n this._dataLimitsCached = true;\n }\n\n this.beforeBuildTicks();\n\n this.ticks = this.buildTicks() || [];\n\n // Allow modification of ticks in callback.\n this.afterBuildTicks();\n\n // Compute tick rotation and fit using a sampled subset of labels\n // We generally don't need to compute the size of every single label for determining scale size\n const samplingEnabled = sampleSize < this.ticks.length;\n this._convertTicksToLabels(samplingEnabled ? sample(this.ticks, sampleSize) : this.ticks);\n\n // configure is called twice, once here, once from core.controller.updateLayout.\n // Here we haven't been positioned yet, but dimensions are correct.\n // Variables set in configure are needed for calculateLabelRotation, and\n // it's ok that coordinates are not correct there, only dimensions matter.\n this.configure();\n\n // Tick Rotation\n this.beforeCalculateLabelRotation();\n this.calculateLabelRotation(); // Preconditions: number of ticks and sizes of largest labels must be calculated beforehand\n this.afterCalculateLabelRotation();\n\n // Auto-skip\n if (tickOpts.display && (tickOpts.autoSkip || tickOpts.source === 'auto')) {\n this.ticks = autoSkip(this, this.ticks);\n this._labelSizes = null;\n this.afterAutoSkip();\n }\n\n if (samplingEnabled) {\n // Generate labels using all non-skipped ticks\n this._convertTicksToLabels(this.ticks);\n }\n\n this.beforeFit();\n this.fit(); // Preconditions: label rotation and label sizes must be calculated beforehand\n this.afterFit();\n\n // IMPORTANT: after this point, we consider that `this.ticks` will NEVER change!\n\n this.afterUpdate();\n }\n\n /**\n\t * @protected\n\t */\n configure() {\n let reversePixels = this.options.reverse;\n let startPixel, endPixel;\n\n if (this.isHorizontal()) {\n startPixel = this.left;\n endPixel = this.right;\n } else {\n startPixel = this.top;\n endPixel = this.bottom;\n // by default vertical scales are from bottom to top, so pixels are reversed\n reversePixels = !reversePixels;\n }\n this._startPixel = startPixel;\n this._endPixel = endPixel;\n this._reversePixels = reversePixels;\n this._length = endPixel - startPixel;\n this._alignToPixels = this.options.alignToPixels;\n }\n\n afterUpdate() {\n call(this.options.afterUpdate, [this]);\n }\n\n //\n\n beforeSetDimensions() {\n call(this.options.beforeSetDimensions, [this]);\n }\n setDimensions() {\n // Set the unconstrained dimension before label rotation\n if (this.isHorizontal()) {\n // Reset position before calculating rotation\n this.width = this.maxWidth;\n this.left = 0;\n this.right = this.width;\n } else {\n this.height = this.maxHeight;\n\n // Reset position before calculating rotation\n this.top = 0;\n this.bottom = this.height;\n }\n\n // Reset padding\n this.paddingLeft = 0;\n this.paddingTop = 0;\n this.paddingRight = 0;\n this.paddingBottom = 0;\n }\n afterSetDimensions() {\n call(this.options.afterSetDimensions, [this]);\n }\n\n _callHooks(name) {\n this.chart.notifyPlugins(name, this.getContext());\n call(this.options[name], [this]);\n }\n\n // Data limits\n beforeDataLimits() {\n this._callHooks('beforeDataLimits');\n }\n determineDataLimits() {}\n afterDataLimits() {\n this._callHooks('afterDataLimits');\n }\n\n //\n beforeBuildTicks() {\n this._callHooks('beforeBuildTicks');\n }\n /**\n\t * @return {object[]} the ticks\n\t */\n buildTicks() {\n return [];\n }\n afterBuildTicks() {\n this._callHooks('afterBuildTicks');\n }\n\n beforeTickToLabelConversion() {\n call(this.options.beforeTickToLabelConversion, [this]);\n }\n /**\n\t * Convert ticks to label strings\n\t * @param {Tick[]} ticks\n\t */\n generateTickLabels(ticks) {\n const tickOpts = this.options.ticks;\n let i, ilen, tick;\n for (i = 0, ilen = ticks.length; i < ilen; i++) {\n tick = ticks[i];\n tick.label = call(tickOpts.callback, [tick.value, i, ticks], this);\n }\n }\n afterTickToLabelConversion() {\n call(this.options.afterTickToLabelConversion, [this]);\n }\n\n //\n\n beforeCalculateLabelRotation() {\n call(this.options.beforeCalculateLabelRotation, [this]);\n }\n calculateLabelRotation() {\n const options = this.options;\n const tickOpts = options.ticks;\n const numTicks = getTicksLimit(this.ticks.length, options.ticks.maxTicksLimit);\n const minRotation = tickOpts.minRotation || 0;\n const maxRotation = tickOpts.maxRotation;\n let labelRotation = minRotation;\n let tickWidth, maxHeight, maxLabelDiagonal;\n\n if (!this._isVisible() || !tickOpts.display || minRotation >= maxRotation || numTicks <= 1 || !this.isHorizontal()) {\n this.labelRotation = minRotation;\n return;\n }\n\n const labelSizes = this._getLabelSizes();\n const maxLabelWidth = labelSizes.widest.width;\n const maxLabelHeight = labelSizes.highest.height;\n\n // Estimate the width of each grid based on the canvas width, the maximum\n // label width and the number of tick intervals\n const maxWidth = _limitValue(this.chart.width - maxLabelWidth, 0, this.maxWidth);\n tickWidth = options.offset ? this.maxWidth / numTicks : maxWidth / (numTicks - 1);\n\n // Allow 3 pixels x2 padding either side for label readability\n if (maxLabelWidth + 6 > tickWidth) {\n tickWidth = maxWidth / (numTicks - (options.offset ? 0.5 : 1));\n maxHeight = this.maxHeight - getTickMarkLength(options.grid)\n\t\t\t\t- tickOpts.padding - getTitleHeight(options.title, this.chart.options.font);\n maxLabelDiagonal = Math.sqrt(maxLabelWidth * maxLabelWidth + maxLabelHeight * maxLabelHeight);\n labelRotation = toDegrees(Math.min(\n Math.asin(_limitValue((labelSizes.highest.height + 6) / tickWidth, -1, 1)),\n Math.asin(_limitValue(maxHeight / maxLabelDiagonal, -1, 1)) - Math.asin(_limitValue(maxLabelHeight / maxLabelDiagonal, -1, 1))\n ));\n labelRotation = Math.max(minRotation, Math.min(maxRotation, labelRotation));\n }\n\n this.labelRotation = labelRotation;\n }\n afterCalculateLabelRotation() {\n call(this.options.afterCalculateLabelRotation, [this]);\n }\n afterAutoSkip() {}\n\n //\n\n beforeFit() {\n call(this.options.beforeFit, [this]);\n }\n fit() {\n // Reset\n const minSize = {\n width: 0,\n height: 0\n };\n\n const {chart, options: {ticks: tickOpts, title: titleOpts, grid: gridOpts}} = this;\n const display = this._isVisible();\n const isHorizontal = this.isHorizontal();\n\n if (display) {\n const titleHeight = getTitleHeight(titleOpts, chart.options.font);\n if (isHorizontal) {\n minSize.width = this.maxWidth;\n minSize.height = getTickMarkLength(gridOpts) + titleHeight;\n } else {\n minSize.height = this.maxHeight; // fill all the height\n minSize.width = getTickMarkLength(gridOpts) + titleHeight;\n }\n\n // Don't bother fitting the ticks if we are not showing the labels\n if (tickOpts.display && this.ticks.length) {\n const {first, last, widest, highest} = this._getLabelSizes();\n const tickPadding = tickOpts.padding * 2;\n const angleRadians = toRadians(this.labelRotation);\n const cos = Math.cos(angleRadians);\n const sin = Math.sin(angleRadians);\n\n if (isHorizontal) {\n // A horizontal axis is more constrained by the height.\n const labelHeight = tickOpts.mirror ? 0 : sin * widest.width + cos * highest.height;\n minSize.height = Math.min(this.maxHeight, minSize.height + labelHeight + tickPadding);\n } else {\n // A vertical axis is more constrained by the width. Labels are the\n // dominant factor here, so get that length first and account for padding\n const labelWidth = tickOpts.mirror ? 0 : cos * widest.width + sin * highest.height;\n\n minSize.width = Math.min(this.maxWidth, minSize.width + labelWidth + tickPadding);\n }\n this._calculatePadding(first, last, sin, cos);\n }\n }\n\n this._handleMargins();\n\n if (isHorizontal) {\n this.width = this._length = chart.width - this._margins.left - this._margins.right;\n this.height = minSize.height;\n } else {\n this.width = minSize.width;\n this.height = this._length = chart.height - this._margins.top - this._margins.bottom;\n }\n }\n\n _calculatePadding(first, last, sin, cos) {\n const {ticks: {align, padding}, position} = this.options;\n const isRotated = this.labelRotation !== 0;\n const labelsBelowTicks = position !== 'top' && this.axis === 'x';\n\n if (this.isHorizontal()) {\n const offsetLeft = this.getPixelForTick(0) - this.left;\n const offsetRight = this.right - this.getPixelForTick(this.ticks.length - 1);\n let paddingLeft = 0;\n let paddingRight = 0;\n\n // Ensure that our ticks are always inside the canvas. When rotated, ticks are right aligned\n // which means that the right padding is dominated by the font height\n if (isRotated) {\n if (labelsBelowTicks) {\n paddingLeft = cos * first.width;\n paddingRight = sin * last.height;\n } else {\n paddingLeft = sin * first.height;\n paddingRight = cos * last.width;\n }\n } else if (align === 'start') {\n paddingRight = last.width;\n } else if (align === 'end') {\n paddingLeft = first.width;\n } else if (align !== 'inner') {\n paddingLeft = first.width / 2;\n paddingRight = last.width / 2;\n }\n\n // Adjust padding taking into account changes in offsets\n this.paddingLeft = Math.max((paddingLeft - offsetLeft + padding) * this.width / (this.width - offsetLeft), 0);\n this.paddingRight = Math.max((paddingRight - offsetRight + padding) * this.width / (this.width - offsetRight), 0);\n } else {\n let paddingTop = last.height / 2;\n let paddingBottom = first.height / 2;\n\n if (align === 'start') {\n paddingTop = 0;\n paddingBottom = first.height;\n } else if (align === 'end') {\n paddingTop = last.height;\n paddingBottom = 0;\n }\n\n this.paddingTop = paddingTop + padding;\n this.paddingBottom = paddingBottom + padding;\n }\n }\n\n /**\n\t * Handle margins and padding interactions\n\t * @private\n\t */\n _handleMargins() {\n if (this._margins) {\n this._margins.left = Math.max(this.paddingLeft, this._margins.left);\n this._margins.top = Math.max(this.paddingTop, this._margins.top);\n this._margins.right = Math.max(this.paddingRight, this._margins.right);\n this._margins.bottom = Math.max(this.paddingBottom, this._margins.bottom);\n }\n }\n\n afterFit() {\n call(this.options.afterFit, [this]);\n }\n\n // Shared Methods\n /**\n\t * @return {boolean}\n\t */\n isHorizontal() {\n const {axis, position} = this.options;\n return position === 'top' || position === 'bottom' || axis === 'x';\n }\n /**\n\t * @return {boolean}\n\t */\n isFullSize() {\n return this.options.fullSize;\n }\n\n /**\n\t * @param {Tick[]} ticks\n\t * @private\n\t */\n _convertTicksToLabels(ticks) {\n this.beforeTickToLabelConversion();\n\n this.generateTickLabels(ticks);\n\n // Ticks should be skipped when callback returns null or undef, so lets remove those.\n let i, ilen;\n for (i = 0, ilen = ticks.length; i < ilen; i++) {\n if (isNullOrUndef(ticks[i].label)) {\n ticks.splice(i, 1);\n ilen--;\n i--;\n }\n }\n\n this.afterTickToLabelConversion();\n }\n\n /**\n\t * @return {{ first: object, last: object, widest: object, highest: object, widths: Array, heights: array }}\n\t * @private\n\t */\n _getLabelSizes() {\n let labelSizes = this._labelSizes;\n\n if (!labelSizes) {\n const sampleSize = this.options.ticks.sampleSize;\n let ticks = this.ticks;\n if (sampleSize < ticks.length) {\n ticks = sample(ticks, sampleSize);\n }\n\n this._labelSizes = labelSizes = this._computeLabelSizes(ticks, ticks.length, this.options.ticks.maxTicksLimit);\n }\n\n return labelSizes;\n }\n\n /**\n\t * Returns {width, height, offset} objects for the first, last, widest, highest tick\n\t * labels where offset indicates the anchor point offset from the top in pixels.\n\t * @return {{ first: object, last: object, widest: object, highest: object, widths: Array, heights: array }}\n\t * @private\n\t */\n _computeLabelSizes(ticks, length, maxTicksLimit) {\n const {ctx, _longestTextCache: caches} = this;\n const widths = [];\n const heights = [];\n const increment = Math.floor(length / getTicksLimit(length, maxTicksLimit));\n let widestLabelSize = 0;\n let highestLabelSize = 0;\n let i, j, jlen, label, tickFont, fontString, cache, lineHeight, width, height, nestedLabel;\n\n for (i = 0; i < length; i += increment) {\n label = ticks[i].label;\n tickFont = this._resolveTickFontOptions(i);\n ctx.font = fontString = tickFont.string;\n cache = caches[fontString] = caches[fontString] || {data: {}, gc: []};\n lineHeight = tickFont.lineHeight;\n width = height = 0;\n // Undefined labels and arrays should not be measured\n if (!isNullOrUndef(label) && !isArray(label)) {\n width = _measureText(ctx, cache.data, cache.gc, width, label);\n height = lineHeight;\n } else if (isArray(label)) {\n // if it is an array let's measure each element\n for (j = 0, jlen = label.length; j < jlen; ++j) {\n nestedLabel = /** @type {string} */ (label[j]);\n // Undefined labels and arrays should not be measured\n if (!isNullOrUndef(nestedLabel) && !isArray(nestedLabel)) {\n width = _measureText(ctx, cache.data, cache.gc, width, nestedLabel);\n height += lineHeight;\n }\n }\n }\n widths.push(width);\n heights.push(height);\n widestLabelSize = Math.max(width, widestLabelSize);\n highestLabelSize = Math.max(height, highestLabelSize);\n }\n garbageCollect(caches, length);\n\n const widest = widths.indexOf(widestLabelSize);\n const highest = heights.indexOf(highestLabelSize);\n\n const valueAt = (idx) => ({width: widths[idx] || 0, height: heights[idx] || 0});\n\n return {\n first: valueAt(0),\n last: valueAt(length - 1),\n widest: valueAt(widest),\n highest: valueAt(highest),\n widths,\n heights,\n };\n }\n\n /**\n\t * Used to get the label to display in the tooltip for the given value\n\t * @param {*} value\n\t * @return {string}\n\t */\n getLabelForValue(value) {\n return value;\n }\n\n /**\n\t * Returns the location of the given data point. Value can either be an index or a numerical value\n\t * The coordinate (0, 0) is at the upper-left corner of the canvas\n\t * @param {*} value\n\t * @param {number} [index]\n\t * @return {number}\n\t */\n getPixelForValue(value, index) { // eslint-disable-line no-unused-vars\n return NaN;\n }\n\n /**\n\t * Used to get the data value from a given pixel. This is the inverse of getPixelForValue\n\t * The coordinate (0, 0) is at the upper-left corner of the canvas\n\t * @param {number} pixel\n\t * @return {*}\n\t */\n getValueForPixel(pixel) {} // eslint-disable-line no-unused-vars\n\n /**\n\t * Returns the location of the tick at the given index\n\t * The coordinate (0, 0) is at the upper-left corner of the canvas\n\t * @param {number} index\n\t * @return {number}\n\t */\n getPixelForTick(index) {\n const ticks = this.ticks;\n if (index < 0 || index > ticks.length - 1) {\n return null;\n }\n return this.getPixelForValue(ticks[index].value);\n }\n\n /**\n\t * Utility for getting the pixel location of a percentage of scale\n\t * The coordinate (0, 0) is at the upper-left corner of the canvas\n\t * @param {number} decimal\n\t * @return {number}\n\t */\n getPixelForDecimal(decimal) {\n if (this._reversePixels) {\n decimal = 1 - decimal;\n }\n\n const pixel = this._startPixel + decimal * this._length;\n return _int16Range(this._alignToPixels ? _alignPixel(this.chart, pixel, 0) : pixel);\n }\n\n /**\n\t * @param {number} pixel\n\t * @return {number}\n\t */\n getDecimalForPixel(pixel) {\n const decimal = (pixel - this._startPixel) / this._length;\n return this._reversePixels ? 1 - decimal : decimal;\n }\n\n /**\n\t * Returns the pixel for the minimum chart value\n\t * The coordinate (0, 0) is at the upper-left corner of the canvas\n\t * @return {number}\n\t */\n getBasePixel() {\n return this.getPixelForValue(this.getBaseValue());\n }\n\n /**\n\t * @return {number}\n\t */\n getBaseValue() {\n const {min, max} = this;\n\n return min < 0 && max < 0 ? max :\n min > 0 && max > 0 ? min :\n 0;\n }\n\n /**\n\t * @protected\n\t */\n getContext(index) {\n const ticks = this.ticks || [];\n\n if (index >= 0 && index < ticks.length) {\n const tick = ticks[index];\n return tick.$context ||\n\t\t\t\t(tick.$context = createTickContext(this.getContext(), index, tick));\n }\n return this.$context ||\n\t\t\t(this.$context = createScaleContext(this.chart.getContext(), this));\n }\n\n /**\n\t * @return {number}\n\t * @private\n\t */\n _tickSize() {\n const optionTicks = this.options.ticks;\n\n // Calculate space needed by label in axis direction.\n const rot = toRadians(this.labelRotation);\n const cos = Math.abs(Math.cos(rot));\n const sin = Math.abs(Math.sin(rot));\n\n const labelSizes = this._getLabelSizes();\n const padding = optionTicks.autoSkipPadding || 0;\n const w = labelSizes ? labelSizes.widest.width + padding : 0;\n const h = labelSizes ? labelSizes.highest.height + padding : 0;\n\n // Calculate space needed for 1 tick in axis direction.\n return this.isHorizontal()\n ? h * cos > w * sin ? w / cos : h / sin\n : h * sin < w * cos ? h / cos : w / sin;\n }\n\n /**\n\t * @return {boolean}\n\t * @private\n\t */\n _isVisible() {\n const display = this.options.display;\n\n if (display !== 'auto') {\n return !!display;\n }\n\n return this.getMatchingVisibleMetas().length > 0;\n }\n\n /**\n\t * @private\n\t */\n _computeGridLineItems(chartArea) {\n const axis = this.axis;\n const chart = this.chart;\n const options = this.options;\n const {grid, position, border} = options;\n const offset = grid.offset;\n const isHorizontal = this.isHorizontal();\n const ticks = this.ticks;\n const ticksLength = ticks.length + (offset ? 1 : 0);\n const tl = getTickMarkLength(grid);\n const items = [];\n\n const borderOpts = border.setContext(this.getContext());\n const axisWidth = borderOpts.display ? borderOpts.width : 0;\n const axisHalfWidth = axisWidth / 2;\n const alignBorderValue = function(pixel) {\n return _alignPixel(chart, pixel, axisWidth);\n };\n let borderValue, i, lineValue, alignedLineValue;\n let tx1, ty1, tx2, ty2, x1, y1, x2, y2;\n\n if (position === 'top') {\n borderValue = alignBorderValue(this.bottom);\n ty1 = this.bottom - tl;\n ty2 = borderValue - axisHalfWidth;\n y1 = alignBorderValue(chartArea.top) + axisHalfWidth;\n y2 = chartArea.bottom;\n } else if (position === 'bottom') {\n borderValue = alignBorderValue(this.top);\n y1 = chartArea.top;\n y2 = alignBorderValue(chartArea.bottom) - axisHalfWidth;\n ty1 = borderValue + axisHalfWidth;\n ty2 = this.top + tl;\n } else if (position === 'left') {\n borderValue = alignBorderValue(this.right);\n tx1 = this.right - tl;\n tx2 = borderValue - axisHalfWidth;\n x1 = alignBorderValue(chartArea.left) + axisHalfWidth;\n x2 = chartArea.right;\n } else if (position === 'right') {\n borderValue = alignBorderValue(this.left);\n x1 = chartArea.left;\n x2 = alignBorderValue(chartArea.right) - axisHalfWidth;\n tx1 = borderValue + axisHalfWidth;\n tx2 = this.left + tl;\n } else if (axis === 'x') {\n if (position === 'center') {\n borderValue = alignBorderValue((chartArea.top + chartArea.bottom) / 2 + 0.5);\n } else if (isObject(position)) {\n const positionAxisID = Object.keys(position)[0];\n const value = position[positionAxisID];\n borderValue = alignBorderValue(this.chart.scales[positionAxisID].getPixelForValue(value));\n }\n\n y1 = chartArea.top;\n y2 = chartArea.bottom;\n ty1 = borderValue + axisHalfWidth;\n ty2 = ty1 + tl;\n } else if (axis === 'y') {\n if (position === 'center') {\n borderValue = alignBorderValue((chartArea.left + chartArea.right) / 2);\n } else if (isObject(position)) {\n const positionAxisID = Object.keys(position)[0];\n const value = position[positionAxisID];\n borderValue = alignBorderValue(this.chart.scales[positionAxisID].getPixelForValue(value));\n }\n\n tx1 = borderValue - axisHalfWidth;\n tx2 = tx1 - tl;\n x1 = chartArea.left;\n x2 = chartArea.right;\n }\n\n const limit = valueOrDefault(options.ticks.maxTicksLimit, ticksLength);\n const step = Math.max(1, Math.ceil(ticksLength / limit));\n for (i = 0; i < ticksLength; i += step) {\n const context = this.getContext(i);\n const optsAtIndex = grid.setContext(context);\n const optsAtIndexBorder = border.setContext(context);\n\n const lineWidth = optsAtIndex.lineWidth;\n const lineColor = optsAtIndex.color;\n const borderDash = optsAtIndexBorder.dash || [];\n const borderDashOffset = optsAtIndexBorder.dashOffset;\n\n const tickWidth = optsAtIndex.tickWidth;\n const tickColor = optsAtIndex.tickColor;\n const tickBorderDash = optsAtIndex.tickBorderDash || [];\n const tickBorderDashOffset = optsAtIndex.tickBorderDashOffset;\n\n lineValue = getPixelForGridLine(this, i, offset);\n\n // Skip if the pixel is out of the range\n if (lineValue === undefined) {\n continue;\n }\n\n alignedLineValue = _alignPixel(chart, lineValue, lineWidth);\n\n if (isHorizontal) {\n tx1 = tx2 = x1 = x2 = alignedLineValue;\n } else {\n ty1 = ty2 = y1 = y2 = alignedLineValue;\n }\n\n items.push({\n tx1,\n ty1,\n tx2,\n ty2,\n x1,\n y1,\n x2,\n y2,\n width: lineWidth,\n color: lineColor,\n borderDash,\n borderDashOffset,\n tickWidth,\n tickColor,\n tickBorderDash,\n tickBorderDashOffset,\n });\n }\n\n this._ticksLength = ticksLength;\n this._borderValue = borderValue;\n\n return items;\n }\n\n /**\n\t * @private\n\t */\n _computeLabelItems(chartArea) {\n const axis = this.axis;\n const options = this.options;\n const {position, ticks: optionTicks} = options;\n const isHorizontal = this.isHorizontal();\n const ticks = this.ticks;\n const {align, crossAlign, padding, mirror} = optionTicks;\n const tl = getTickMarkLength(options.grid);\n const tickAndPadding = tl + padding;\n const hTickAndPadding = mirror ? -padding : tickAndPadding;\n const rotation = -toRadians(this.labelRotation);\n const items = [];\n let i, ilen, tick, label, x, y, textAlign, pixel, font, lineHeight, lineCount, textOffset;\n let textBaseline = 'middle';\n\n if (position === 'top') {\n y = this.bottom - hTickAndPadding;\n textAlign = this._getXAxisLabelAlignment();\n } else if (position === 'bottom') {\n y = this.top + hTickAndPadding;\n textAlign = this._getXAxisLabelAlignment();\n } else if (position === 'left') {\n const ret = this._getYAxisLabelAlignment(tl);\n textAlign = ret.textAlign;\n x = ret.x;\n } else if (position === 'right') {\n const ret = this._getYAxisLabelAlignment(tl);\n textAlign = ret.textAlign;\n x = ret.x;\n } else if (axis === 'x') {\n if (position === 'center') {\n y = ((chartArea.top + chartArea.bottom) / 2) + tickAndPadding;\n } else if (isObject(position)) {\n const positionAxisID = Object.keys(position)[0];\n const value = position[positionAxisID];\n y = this.chart.scales[positionAxisID].getPixelForValue(value) + tickAndPadding;\n }\n textAlign = this._getXAxisLabelAlignment();\n } else if (axis === 'y') {\n if (position === 'center') {\n x = ((chartArea.left + chartArea.right) / 2) - tickAndPadding;\n } else if (isObject(position)) {\n const positionAxisID = Object.keys(position)[0];\n const value = position[positionAxisID];\n x = this.chart.scales[positionAxisID].getPixelForValue(value);\n }\n textAlign = this._getYAxisLabelAlignment(tl).textAlign;\n }\n\n if (axis === 'y') {\n if (align === 'start') {\n textBaseline = 'top';\n } else if (align === 'end') {\n textBaseline = 'bottom';\n }\n }\n\n const labelSizes = this._getLabelSizes();\n for (i = 0, ilen = ticks.length; i < ilen; ++i) {\n tick = ticks[i];\n label = tick.label;\n\n const optsAtIndex = optionTicks.setContext(this.getContext(i));\n pixel = this.getPixelForTick(i) + optionTicks.labelOffset;\n font = this._resolveTickFontOptions(i);\n lineHeight = font.lineHeight;\n lineCount = isArray(label) ? label.length : 1;\n const halfCount = lineCount / 2;\n const color = optsAtIndex.color;\n const strokeColor = optsAtIndex.textStrokeColor;\n const strokeWidth = optsAtIndex.textStrokeWidth;\n let tickTextAlign = textAlign;\n\n if (isHorizontal) {\n x = pixel;\n\n if (textAlign === 'inner') {\n if (i === ilen - 1) {\n tickTextAlign = !this.options.reverse ? 'right' : 'left';\n } else if (i === 0) {\n tickTextAlign = !this.options.reverse ? 'left' : 'right';\n } else {\n tickTextAlign = 'center';\n }\n }\n\n if (position === 'top') {\n if (crossAlign === 'near' || rotation !== 0) {\n textOffset = -lineCount * lineHeight + lineHeight / 2;\n } else if (crossAlign === 'center') {\n textOffset = -labelSizes.highest.height / 2 - halfCount * lineHeight + lineHeight;\n } else {\n textOffset = -labelSizes.highest.height + lineHeight / 2;\n }\n } else {\n // eslint-disable-next-line no-lonely-if\n if (crossAlign === 'near' || rotation !== 0) {\n textOffset = lineHeight / 2;\n } else if (crossAlign === 'center') {\n textOffset = labelSizes.highest.height / 2 - halfCount * lineHeight;\n } else {\n textOffset = labelSizes.highest.height - lineCount * lineHeight;\n }\n }\n if (mirror) {\n textOffset *= -1;\n }\n if (rotation !== 0 && !optsAtIndex.showLabelBackdrop) {\n x += (lineHeight / 2) * Math.sin(rotation);\n }\n } else {\n y = pixel;\n textOffset = (1 - lineCount) * lineHeight / 2;\n }\n\n let backdrop;\n\n if (optsAtIndex.showLabelBackdrop) {\n const labelPadding = toPadding(optsAtIndex.backdropPadding);\n const height = labelSizes.heights[i];\n const width = labelSizes.widths[i];\n\n let top = textOffset - labelPadding.top;\n let left = 0 - labelPadding.left;\n\n switch (textBaseline) {\n case 'middle':\n top -= height / 2;\n break;\n case 'bottom':\n top -= height;\n break;\n default:\n break;\n }\n\n switch (textAlign) {\n case 'center':\n left -= width / 2;\n break;\n case 'right':\n left -= width;\n break;\n case 'inner':\n if (i === ilen - 1) {\n left -= width;\n } else if (i > 0) {\n left -= width / 2;\n }\n break;\n default:\n break;\n }\n\n backdrop = {\n left,\n top,\n width: width + labelPadding.width,\n height: height + labelPadding.height,\n\n color: optsAtIndex.backdropColor,\n };\n }\n\n items.push({\n label,\n font,\n textOffset,\n options: {\n rotation,\n color,\n strokeColor,\n strokeWidth,\n textAlign: tickTextAlign,\n textBaseline,\n translation: [x, y],\n backdrop,\n }\n });\n }\n\n return items;\n }\n\n _getXAxisLabelAlignment() {\n const {position, ticks} = this.options;\n const rotation = -toRadians(this.labelRotation);\n\n if (rotation) {\n return position === 'top' ? 'left' : 'right';\n }\n\n let align = 'center';\n\n if (ticks.align === 'start') {\n align = 'left';\n } else if (ticks.align === 'end') {\n align = 'right';\n } else if (ticks.align === 'inner') {\n align = 'inner';\n }\n\n return align;\n }\n\n _getYAxisLabelAlignment(tl) {\n const {position, ticks: {crossAlign, mirror, padding}} = this.options;\n const labelSizes = this._getLabelSizes();\n const tickAndPadding = tl + padding;\n const widest = labelSizes.widest.width;\n\n let textAlign;\n let x;\n\n if (position === 'left') {\n if (mirror) {\n x = this.right + padding;\n\n if (crossAlign === 'near') {\n textAlign = 'left';\n } else if (crossAlign === 'center') {\n textAlign = 'center';\n x += (widest / 2);\n } else {\n textAlign = 'right';\n x += widest;\n }\n } else {\n x = this.right - tickAndPadding;\n\n if (crossAlign === 'near') {\n textAlign = 'right';\n } else if (crossAlign === 'center') {\n textAlign = 'center';\n x -= (widest / 2);\n } else {\n textAlign = 'left';\n x = this.left;\n }\n }\n } else if (position === 'right') {\n if (mirror) {\n x = this.left + padding;\n\n if (crossAlign === 'near') {\n textAlign = 'right';\n } else if (crossAlign === 'center') {\n textAlign = 'center';\n x -= (widest / 2);\n } else {\n textAlign = 'left';\n x -= widest;\n }\n } else {\n x = this.left + tickAndPadding;\n\n if (crossAlign === 'near') {\n textAlign = 'left';\n } else if (crossAlign === 'center') {\n textAlign = 'center';\n x += widest / 2;\n } else {\n textAlign = 'right';\n x = this.right;\n }\n }\n } else {\n textAlign = 'right';\n }\n\n return {textAlign, x};\n }\n\n /**\n\t * @private\n\t */\n _computeLabelArea() {\n if (this.options.ticks.mirror) {\n return;\n }\n\n const chart = this.chart;\n const position = this.options.position;\n\n if (position === 'left' || position === 'right') {\n return {top: 0, left: this.left, bottom: chart.height, right: this.right};\n } if (position === 'top' || position === 'bottom') {\n return {top: this.top, left: 0, bottom: this.bottom, right: chart.width};\n }\n }\n\n /**\n * @protected\n */\n drawBackground() {\n const {ctx, options: {backgroundColor}, left, top, width, height} = this;\n if (backgroundColor) {\n ctx.save();\n ctx.fillStyle = backgroundColor;\n ctx.fillRect(left, top, width, height);\n ctx.restore();\n }\n }\n\n getLineWidthForValue(value) {\n const grid = this.options.grid;\n if (!this._isVisible() || !grid.display) {\n return 0;\n }\n const ticks = this.ticks;\n const index = ticks.findIndex(t => t.value === value);\n if (index >= 0) {\n const opts = grid.setContext(this.getContext(index));\n return opts.lineWidth;\n }\n return 0;\n }\n\n /**\n\t * @protected\n\t */\n drawGrid(chartArea) {\n const grid = this.options.grid;\n const ctx = this.ctx;\n const items = this._gridLineItems || (this._gridLineItems = this._computeGridLineItems(chartArea));\n let i, ilen;\n\n const drawLine = (p1, p2, style) => {\n if (!style.width || !style.color) {\n return;\n }\n ctx.save();\n ctx.lineWidth = style.width;\n ctx.strokeStyle = style.color;\n ctx.setLineDash(style.borderDash || []);\n ctx.lineDashOffset = style.borderDashOffset;\n\n ctx.beginPath();\n ctx.moveTo(p1.x, p1.y);\n ctx.lineTo(p2.x, p2.y);\n ctx.stroke();\n ctx.restore();\n };\n\n if (grid.display) {\n for (i = 0, ilen = items.length; i < ilen; ++i) {\n const item = items[i];\n\n if (grid.drawOnChartArea) {\n drawLine(\n {x: item.x1, y: item.y1},\n {x: item.x2, y: item.y2},\n item\n );\n }\n\n if (grid.drawTicks) {\n drawLine(\n {x: item.tx1, y: item.ty1},\n {x: item.tx2, y: item.ty2},\n {\n color: item.tickColor,\n width: item.tickWidth,\n borderDash: item.tickBorderDash,\n borderDashOffset: item.tickBorderDashOffset\n }\n );\n }\n }\n }\n }\n\n /**\n\t * @protected\n\t */\n drawBorder() {\n const {chart, ctx, options: {border, grid}} = this;\n const borderOpts = border.setContext(this.getContext());\n const axisWidth = border.display ? borderOpts.width : 0;\n if (!axisWidth) {\n return;\n }\n const lastLineWidth = grid.setContext(this.getContext(0)).lineWidth;\n const borderValue = this._borderValue;\n let x1, x2, y1, y2;\n\n if (this.isHorizontal()) {\n x1 = _alignPixel(chart, this.left, axisWidth) - axisWidth / 2;\n x2 = _alignPixel(chart, this.right, lastLineWidth) + lastLineWidth / 2;\n y1 = y2 = borderValue;\n } else {\n y1 = _alignPixel(chart, this.top, axisWidth) - axisWidth / 2;\n y2 = _alignPixel(chart, this.bottom, lastLineWidth) + lastLineWidth / 2;\n x1 = x2 = borderValue;\n }\n ctx.save();\n ctx.lineWidth = borderOpts.width;\n ctx.strokeStyle = borderOpts.color;\n\n ctx.beginPath();\n ctx.moveTo(x1, y1);\n ctx.lineTo(x2, y2);\n ctx.stroke();\n\n ctx.restore();\n }\n\n /**\n\t * @protected\n\t */\n drawLabels(chartArea) {\n const optionTicks = this.options.ticks;\n\n if (!optionTicks.display) {\n return;\n }\n\n const ctx = this.ctx;\n\n const area = this._computeLabelArea();\n if (area) {\n clipArea(ctx, area);\n }\n\n const items = this.getLabelItems(chartArea);\n for (const item of items) {\n const renderTextOptions = item.options;\n const tickFont = item.font;\n const label = item.label;\n const y = item.textOffset;\n renderText(ctx, label, 0, y, tickFont, renderTextOptions);\n }\n\n if (area) {\n unclipArea(ctx);\n }\n }\n\n /**\n\t * @protected\n\t */\n drawTitle() {\n const {ctx, options: {position, title, reverse}} = this;\n\n if (!title.display) {\n return;\n }\n\n const font = toFont(title.font);\n const padding = toPadding(title.padding);\n const align = title.align;\n let offset = font.lineHeight / 2;\n\n if (position === 'bottom' || position === 'center' || isObject(position)) {\n offset += padding.bottom;\n if (isArray(title.text)) {\n offset += font.lineHeight * (title.text.length - 1);\n }\n } else {\n offset += padding.top;\n }\n\n const {titleX, titleY, maxWidth, rotation} = titleArgs(this, offset, position, align);\n\n renderText(ctx, title.text, 0, 0, font, {\n color: title.color,\n maxWidth,\n rotation,\n textAlign: titleAlign(align, position, reverse),\n textBaseline: 'middle',\n translation: [titleX, titleY],\n });\n }\n\n draw(chartArea) {\n if (!this._isVisible()) {\n return;\n }\n\n this.drawBackground();\n this.drawGrid(chartArea);\n this.drawBorder();\n this.drawTitle();\n this.drawLabels(chartArea);\n }\n\n /**\n\t * @return {object[]}\n\t * @private\n\t */\n _layers() {\n const opts = this.options;\n const tz = opts.ticks && opts.ticks.z || 0;\n const gz = valueOrDefault(opts.grid && opts.grid.z, -1);\n const bz = valueOrDefault(opts.border && opts.border.z, 0);\n\n if (!this._isVisible() || this.draw !== Scale.prototype.draw) {\n // backward compatibility: draw has been overridden by custom scale\n return [{\n z: tz,\n draw: (chartArea) => {\n this.draw(chartArea);\n }\n }];\n }\n\n return [{\n z: gz,\n draw: (chartArea) => {\n this.drawBackground();\n this.drawGrid(chartArea);\n this.drawTitle();\n }\n }, {\n z: bz,\n draw: () => {\n this.drawBorder();\n }\n }, {\n z: tz,\n draw: (chartArea) => {\n this.drawLabels(chartArea);\n }\n }];\n }\n\n /**\n\t * Returns visible dataset metas that are attached to this scale\n\t * @param {string} [type] - if specified, also filter by dataset type\n\t * @return {object[]}\n\t */\n getMatchingVisibleMetas(type) {\n const metas = this.chart.getSortedVisibleDatasetMetas();\n const axisID = this.axis + 'AxisID';\n const result = [];\n let i, ilen;\n\n for (i = 0, ilen = metas.length; i < ilen; ++i) {\n const meta = metas[i];\n if (meta[axisID] === this.id && (!type || meta.type === type)) {\n result.push(meta);\n }\n }\n return result;\n }\n\n /**\n\t * @param {number} index\n\t * @return {object}\n\t * @protected\n \t */\n _resolveTickFontOptions(index) {\n const opts = this.options.ticks.setContext(this.getContext(index));\n return toFont(opts.font);\n }\n\n /**\n * @protected\n */\n _maxDigits() {\n const fontSize = this._resolveTickFontOptions(0).lineHeight;\n return (this.isHorizontal() ? this.width : this.height) / fontSize;\n }\n}\n", "import {merge} from '../helpers/index.js';\nimport defaults, {overrides} from './core.defaults.js';\n\n/**\n * @typedef {{id: string, defaults: any, overrides?: any, defaultRoutes: any}} IChartComponent\n */\n\nexport default class TypedRegistry {\n constructor(type, scope, override) {\n this.type = type;\n this.scope = scope;\n this.override = override;\n this.items = Object.create(null);\n }\n\n isForType(type) {\n return Object.prototype.isPrototypeOf.call(this.type.prototype, type.prototype);\n }\n\n /**\n\t * @param {IChartComponent} item\n\t * @returns {string} The scope where items defaults were registered to.\n\t */\n register(item) {\n const proto = Object.getPrototypeOf(item);\n let parentScope;\n\n if (isIChartComponent(proto)) {\n // Make sure the parent is registered and note the scope where its defaults are.\n parentScope = this.register(proto);\n }\n\n const items = this.items;\n const id = item.id;\n const scope = this.scope + '.' + id;\n\n if (!id) {\n throw new Error('class does not have id: ' + item);\n }\n\n if (id in items) {\n // already registered\n return scope;\n }\n\n items[id] = item;\n registerDefaults(item, scope, parentScope);\n if (this.override) {\n defaults.override(item.id, item.overrides);\n }\n\n return scope;\n }\n\n /**\n\t * @param {string} id\n\t * @returns {object?}\n\t */\n get(id) {\n return this.items[id];\n }\n\n /**\n\t * @param {IChartComponent} item\n\t */\n unregister(item) {\n const items = this.items;\n const id = item.id;\n const scope = this.scope;\n\n if (id in items) {\n delete items[id];\n }\n\n if (scope && id in defaults[scope]) {\n delete defaults[scope][id];\n if (this.override) {\n delete overrides[id];\n }\n }\n }\n}\n\nfunction registerDefaults(item, scope, parentScope) {\n // Inherit the parent's defaults and keep existing defaults\n const itemDefaults = merge(Object.create(null), [\n parentScope ? defaults.get(parentScope) : {},\n defaults.get(scope),\n item.defaults\n ]);\n\n defaults.set(scope, itemDefaults);\n\n if (item.defaultRoutes) {\n routeDefaults(scope, item.defaultRoutes);\n }\n\n if (item.descriptors) {\n defaults.describe(scope, item.descriptors);\n }\n}\n\nfunction routeDefaults(scope, routes) {\n Object.keys(routes).forEach(property => {\n const propertyParts = property.split('.');\n const sourceName = propertyParts.pop();\n const sourceScope = [scope].concat(propertyParts).join('.');\n const parts = routes[property].split('.');\n const targetName = parts.pop();\n const targetScope = parts.join('.');\n defaults.route(sourceScope, sourceName, targetScope, targetName);\n });\n}\n\nfunction isIChartComponent(proto) {\n return 'id' in proto && 'defaults' in proto;\n}\n", "import DatasetController from './core.datasetController.js';\nimport Element from './core.element.js';\nimport Scale from './core.scale.js';\nimport TypedRegistry from './core.typedRegistry.js';\nimport {each, callback as call, _capitalize} from '../helpers/helpers.core.js';\n\n/**\n * Please use the module's default export which provides a singleton instance\n * Note: class is exported for typedoc\n */\nexport class Registry {\n constructor() {\n this.controllers = new TypedRegistry(DatasetController, 'datasets', true);\n this.elements = new TypedRegistry(Element, 'elements');\n this.plugins = new TypedRegistry(Object, 'plugins');\n this.scales = new TypedRegistry(Scale, 'scales');\n // Order is important, Scale has Element in prototype chain,\n // so Scales must be before Elements. Plugins are a fallback, so not listed here.\n this._typedRegistries = [this.controllers, this.scales, this.elements];\n }\n\n /**\n\t * @param {...any} args\n\t */\n add(...args) {\n this._each('register', args);\n }\n\n remove(...args) {\n this._each('unregister', args);\n }\n\n /**\n\t * @param {...typeof DatasetController} args\n\t */\n addControllers(...args) {\n this._each('register', args, this.controllers);\n }\n\n /**\n\t * @param {...typeof Element} args\n\t */\n addElements(...args) {\n this._each('register', args, this.elements);\n }\n\n /**\n\t * @param {...any} args\n\t */\n addPlugins(...args) {\n this._each('register', args, this.plugins);\n }\n\n /**\n\t * @param {...typeof Scale} args\n\t */\n addScales(...args) {\n this._each('register', args, this.scales);\n }\n\n /**\n\t * @param {string} id\n\t * @returns {typeof DatasetController}\n\t */\n getController(id) {\n return this._get(id, this.controllers, 'controller');\n }\n\n /**\n\t * @param {string} id\n\t * @returns {typeof Element}\n\t */\n getElement(id) {\n return this._get(id, this.elements, 'element');\n }\n\n /**\n\t * @param {string} id\n\t * @returns {object}\n\t */\n getPlugin(id) {\n return this._get(id, this.plugins, 'plugin');\n }\n\n /**\n\t * @param {string} id\n\t * @returns {typeof Scale}\n\t */\n getScale(id) {\n return this._get(id, this.scales, 'scale');\n }\n\n /**\n\t * @param {...typeof DatasetController} args\n\t */\n removeControllers(...args) {\n this._each('unregister', args, this.controllers);\n }\n\n /**\n\t * @param {...typeof Element} args\n\t */\n removeElements(...args) {\n this._each('unregister', args, this.elements);\n }\n\n /**\n\t * @param {...any} args\n\t */\n removePlugins(...args) {\n this._each('unregister', args, this.plugins);\n }\n\n /**\n\t * @param {...typeof Scale} args\n\t */\n removeScales(...args) {\n this._each('unregister', args, this.scales);\n }\n\n /**\n\t * @private\n\t */\n _each(method, args, typedRegistry) {\n [...args].forEach(arg => {\n const reg = typedRegistry || this._getRegistryForType(arg);\n if (typedRegistry || reg.isForType(arg) || (reg === this.plugins && arg.id)) {\n this._exec(method, reg, arg);\n } else {\n // Handle loopable args\n // Use case:\n // import * as plugins from './plugins.js';\n // Chart.register(plugins);\n each(arg, item => {\n // If there are mixed types in the loopable, make sure those are\n // registered in correct registry\n // Use case: (treemap exporting controller, elements etc)\n // import * as treemap from 'chartjs-chart-treemap.js';\n // Chart.register(treemap);\n\n const itemReg = typedRegistry || this._getRegistryForType(item);\n this._exec(method, itemReg, item);\n });\n }\n });\n }\n\n /**\n\t * @private\n\t */\n _exec(method, registry, component) {\n const camelMethod = _capitalize(method);\n call(component['before' + camelMethod], [], component); // beforeRegister / beforeUnregister\n registry[method](component);\n call(component['after' + camelMethod], [], component); // afterRegister / afterUnregister\n }\n\n /**\n\t * @private\n\t */\n _getRegistryForType(type) {\n for (let i = 0; i < this._typedRegistries.length; i++) {\n const reg = this._typedRegistries[i];\n if (reg.isForType(type)) {\n return reg;\n }\n }\n // plugins is the fallback registry\n return this.plugins;\n }\n\n /**\n\t * @private\n\t */\n _get(id, typedRegistry, type) {\n const item = typedRegistry.get(id);\n if (item === undefined) {\n throw new Error('\"' + id + '\" is not a registered ' + type + '.');\n }\n return item;\n }\n\n}\n\n// singleton instance\nexport default /* #__PURE__ */ new Registry();\n", "import registry from './core.registry.js';\nimport {callback as callCallback, isNullOrUndef, valueOrDefault} from '../helpers/helpers.core.js';\n\n/**\n * @typedef { import('./core.controller.js').default } Chart\n * @typedef { import('../types/index.js').ChartEvent } ChartEvent\n * @typedef { import('../plugins/plugin.tooltip.js').default } Tooltip\n */\n\n/**\n * @callback filterCallback\n * @param {{plugin: object, options: object}} value\n * @param {number} [index]\n * @param {array} [array]\n * @param {object} [thisArg]\n * @return {boolean}\n */\n\n\nexport default class PluginService {\n constructor() {\n this._init = [];\n }\n\n /**\n\t * Calls enabled plugins for `chart` on the specified hook and with the given args.\n\t * This method immediately returns as soon as a plugin explicitly returns false. The\n\t * returned value can be used, for instance, to interrupt the current action.\n\t * @param {Chart} chart - The chart instance for which plugins should be called.\n\t * @param {string} hook - The name of the plugin method to call (e.g. 'beforeUpdate').\n\t * @param {object} [args] - Extra arguments to apply to the hook call.\n * @param {filterCallback} [filter] - Filtering function for limiting which plugins are notified\n\t * @returns {boolean} false if any of the plugins return false, else returns true.\n\t */\n notify(chart, hook, args, filter) {\n if (hook === 'beforeInit') {\n this._init = this._createDescriptors(chart, true);\n this._notify(this._init, chart, 'install');\n }\n\n const descriptors = filter ? this._descriptors(chart).filter(filter) : this._descriptors(chart);\n const result = this._notify(descriptors, chart, hook, args);\n\n if (hook === 'afterDestroy') {\n this._notify(descriptors, chart, 'stop');\n this._notify(this._init, chart, 'uninstall');\n }\n return result;\n }\n\n /**\n\t * @private\n\t */\n _notify(descriptors, chart, hook, args) {\n args = args || {};\n for (const descriptor of descriptors) {\n const plugin = descriptor.plugin;\n const method = plugin[hook];\n const params = [chart, args, descriptor.options];\n if (callCallback(method, params, plugin) === false && args.cancelable) {\n return false;\n }\n }\n\n return true;\n }\n\n invalidate() {\n // When plugins are registered, there is the possibility of a double\n // invalidate situation. In this case, we only want to invalidate once.\n // If we invalidate multiple times, the `_oldCache` is lost and all of the\n // plugins are restarted without being correctly stopped.\n // See https://github.com/chartjs/Chart.js/issues/8147\n if (!isNullOrUndef(this._cache)) {\n this._oldCache = this._cache;\n this._cache = undefined;\n }\n }\n\n /**\n\t * @param {Chart} chart\n\t * @private\n\t */\n _descriptors(chart) {\n if (this._cache) {\n return this._cache;\n }\n\n const descriptors = this._cache = this._createDescriptors(chart);\n\n this._notifyStateChanges(chart);\n\n return descriptors;\n }\n\n _createDescriptors(chart, all) {\n const config = chart && chart.config;\n const options = valueOrDefault(config.options && config.options.plugins, {});\n const plugins = allPlugins(config);\n // options === false => all plugins are disabled\n return options === false && !all ? [] : createDescriptors(chart, plugins, options, all);\n }\n\n /**\n\t * @param {Chart} chart\n\t * @private\n\t */\n _notifyStateChanges(chart) {\n const previousDescriptors = this._oldCache || [];\n const descriptors = this._cache;\n const diff = (a, b) => a.filter(x => !b.some(y => x.plugin.id === y.plugin.id));\n this._notify(diff(previousDescriptors, descriptors), chart, 'stop');\n this._notify(diff(descriptors, previousDescriptors), chart, 'start');\n }\n}\n\n/**\n * @param {import('./core.config.js').default} config\n */\nfunction allPlugins(config) {\n const localIds = {};\n const plugins = [];\n const keys = Object.keys(registry.plugins.items);\n for (let i = 0; i < keys.length; i++) {\n plugins.push(registry.getPlugin(keys[i]));\n }\n\n const local = config.plugins || [];\n for (let i = 0; i < local.length; i++) {\n const plugin = local[i];\n\n if (plugins.indexOf(plugin) === -1) {\n plugins.push(plugin);\n localIds[plugin.id] = true;\n }\n }\n\n return {plugins, localIds};\n}\n\nfunction getOpts(options, all) {\n if (!all && options === false) {\n return null;\n }\n if (options === true) {\n return {};\n }\n return options;\n}\n\nfunction createDescriptors(chart, {plugins, localIds}, options, all) {\n const result = [];\n const context = chart.getContext();\n\n for (const plugin of plugins) {\n const id = plugin.id;\n const opts = getOpts(options[id], all);\n if (opts === null) {\n continue;\n }\n result.push({\n plugin,\n options: pluginOpts(chart.config, {plugin, local: localIds[id]}, opts, context)\n });\n }\n\n return result;\n}\n\nfunction pluginOpts(config, {plugin, local}, opts, context) {\n const keys = config.pluginScopeKeys(plugin);\n const scopes = config.getOptionScopes(opts, keys);\n if (local && plugin.defaults) {\n // make sure plugin defaults are in scopes for local (not registered) plugins\n scopes.push(plugin.defaults);\n }\n return config.createResolver(scopes, context, [''], {\n // These are just defaults that plugins can override\n scriptable: false,\n indexable: false,\n allKeys: true\n });\n}\n", "import defaults, {overrides, descriptors} from './core.defaults.js';\nimport {mergeIf, resolveObjectKey, isArray, isFunction, valueOrDefault, isObject} from '../helpers/helpers.core.js';\nimport {_attachContext, _createResolver, _descriptors} from '../helpers/helpers.config.js';\n\nexport function getIndexAxis(type, options) {\n const datasetDefaults = defaults.datasets[type] || {};\n const datasetOptions = (options.datasets || {})[type] || {};\n return datasetOptions.indexAxis || options.indexAxis || datasetDefaults.indexAxis || 'x';\n}\n\nfunction getAxisFromDefaultScaleID(id, indexAxis) {\n let axis = id;\n if (id === '_index_') {\n axis = indexAxis;\n } else if (id === '_value_') {\n axis = indexAxis === 'x' ? 'y' : 'x';\n }\n return axis;\n}\n\nfunction getDefaultScaleIDFromAxis(axis, indexAxis) {\n return axis === indexAxis ? '_index_' : '_value_';\n}\n\nfunction idMatchesAxis(id) {\n if (id === 'x' || id === 'y' || id === 'r') {\n return id;\n }\n}\n\nfunction axisFromPosition(position) {\n if (position === 'top' || position === 'bottom') {\n return 'x';\n }\n if (position === 'left' || position === 'right') {\n return 'y';\n }\n}\n\nexport function determineAxis(id, ...scaleOptions) {\n if (idMatchesAxis(id)) {\n return id;\n }\n for (const opts of scaleOptions) {\n const axis = opts.axis\n || axisFromPosition(opts.position)\n || id.length > 1 && idMatchesAxis(id[0].toLowerCase());\n if (axis) {\n return axis;\n }\n }\n throw new Error(`Cannot determine type of '${id}' axis. Please provide 'axis' or 'position' option.`);\n}\n\nfunction getAxisFromDataset(id, axis, dataset) {\n if (dataset[axis + 'AxisID'] === id) {\n return {axis};\n }\n}\n\nfunction retrieveAxisFromDatasets(id, config) {\n if (config.data && config.data.datasets) {\n const boundDs = config.data.datasets.filter((d) => d.xAxisID === id || d.yAxisID === id);\n if (boundDs.length) {\n return getAxisFromDataset(id, 'x', boundDs[0]) || getAxisFromDataset(id, 'y', boundDs[0]);\n }\n }\n return {};\n}\n\nfunction mergeScaleConfig(config, options) {\n const chartDefaults = overrides[config.type] || {scales: {}};\n const configScales = options.scales || {};\n const chartIndexAxis = getIndexAxis(config.type, options);\n const scales = Object.create(null);\n\n // First figure out first scale id's per axis.\n Object.keys(configScales).forEach(id => {\n const scaleConf = configScales[id];\n if (!isObject(scaleConf)) {\n return console.error(`Invalid scale configuration for scale: ${id}`);\n }\n if (scaleConf._proxy) {\n return console.warn(`Ignoring resolver passed as options for scale: ${id}`);\n }\n const axis = determineAxis(id, scaleConf, retrieveAxisFromDatasets(id, config), defaults.scales[scaleConf.type]);\n const defaultId = getDefaultScaleIDFromAxis(axis, chartIndexAxis);\n const defaultScaleOptions = chartDefaults.scales || {};\n scales[id] = mergeIf(Object.create(null), [{axis}, scaleConf, defaultScaleOptions[axis], defaultScaleOptions[defaultId]]);\n });\n\n // Then merge dataset defaults to scale configs\n config.data.datasets.forEach(dataset => {\n const type = dataset.type || config.type;\n const indexAxis = dataset.indexAxis || getIndexAxis(type, options);\n const datasetDefaults = overrides[type] || {};\n const defaultScaleOptions = datasetDefaults.scales || {};\n Object.keys(defaultScaleOptions).forEach(defaultID => {\n const axis = getAxisFromDefaultScaleID(defaultID, indexAxis);\n const id = dataset[axis + 'AxisID'] || axis;\n scales[id] = scales[id] || Object.create(null);\n mergeIf(scales[id], [{axis}, configScales[id], defaultScaleOptions[defaultID]]);\n });\n });\n\n // apply scale defaults, if not overridden by dataset defaults\n Object.keys(scales).forEach(key => {\n const scale = scales[key];\n mergeIf(scale, [defaults.scales[scale.type], defaults.scale]);\n });\n\n return scales;\n}\n\nfunction initOptions(config) {\n const options = config.options || (config.options = {});\n\n options.plugins = valueOrDefault(options.plugins, {});\n options.scales = mergeScaleConfig(config, options);\n}\n\nfunction initData(data) {\n data = data || {};\n data.datasets = data.datasets || [];\n data.labels = data.labels || [];\n return data;\n}\n\nfunction initConfig(config) {\n config = config || {};\n config.data = initData(config.data);\n\n initOptions(config);\n\n return config;\n}\n\nconst keyCache = new Map();\nconst keysCached = new Set();\n\nfunction cachedKeys(cacheKey, generate) {\n let keys = keyCache.get(cacheKey);\n if (!keys) {\n keys = generate();\n keyCache.set(cacheKey, keys);\n keysCached.add(keys);\n }\n return keys;\n}\n\nconst addIfFound = (set, obj, key) => {\n const opts = resolveObjectKey(obj, key);\n if (opts !== undefined) {\n set.add(opts);\n }\n};\n\nexport default class Config {\n constructor(config) {\n this._config = initConfig(config);\n this._scopeCache = new Map();\n this._resolverCache = new Map();\n }\n\n get platform() {\n return this._config.platform;\n }\n\n get type() {\n return this._config.type;\n }\n\n set type(type) {\n this._config.type = type;\n }\n\n get data() {\n return this._config.data;\n }\n\n set data(data) {\n this._config.data = initData(data);\n }\n\n get options() {\n return this._config.options;\n }\n\n set options(options) {\n this._config.options = options;\n }\n\n get plugins() {\n return this._config.plugins;\n }\n\n update() {\n const config = this._config;\n this.clearCache();\n initOptions(config);\n }\n\n clearCache() {\n this._scopeCache.clear();\n this._resolverCache.clear();\n }\n\n /**\n * Returns the option scope keys for resolving dataset options.\n * These keys do not include the dataset itself, because it is not under options.\n * @param {string} datasetType\n * @return {string[][]}\n */\n datasetScopeKeys(datasetType) {\n return cachedKeys(datasetType,\n () => [[\n `datasets.${datasetType}`,\n ''\n ]]);\n }\n\n /**\n * Returns the option scope keys for resolving dataset animation options.\n * These keys do not include the dataset itself, because it is not under options.\n * @param {string} datasetType\n * @param {string} transition\n * @return {string[][]}\n */\n datasetAnimationScopeKeys(datasetType, transition) {\n return cachedKeys(`${datasetType}.transition.${transition}`,\n () => [\n [\n `datasets.${datasetType}.transitions.${transition}`,\n `transitions.${transition}`,\n ],\n // The following are used for looking up the `animations` and `animation` keys\n [\n `datasets.${datasetType}`,\n ''\n ]\n ]);\n }\n\n /**\n * Returns the options scope keys for resolving element options that belong\n * to an dataset. These keys do not include the dataset itself, because it\n * is not under options.\n * @param {string} datasetType\n * @param {string} elementType\n * @return {string[][]}\n */\n datasetElementScopeKeys(datasetType, elementType) {\n return cachedKeys(`${datasetType}-${elementType}`,\n () => [[\n `datasets.${datasetType}.elements.${elementType}`,\n `datasets.${datasetType}`,\n `elements.${elementType}`,\n ''\n ]]);\n }\n\n /**\n * Returns the options scope keys for resolving plugin options.\n * @param {{id: string, additionalOptionScopes?: string[]}} plugin\n * @return {string[][]}\n */\n pluginScopeKeys(plugin) {\n const id = plugin.id;\n const type = this.type;\n return cachedKeys(`${type}-plugin-${id}`,\n () => [[\n `plugins.${id}`,\n ...plugin.additionalOptionScopes || [],\n ]]);\n }\n\n /**\n * @private\n */\n _cachedScopes(mainScope, resetCache) {\n const _scopeCache = this._scopeCache;\n let cache = _scopeCache.get(mainScope);\n if (!cache || resetCache) {\n cache = new Map();\n _scopeCache.set(mainScope, cache);\n }\n return cache;\n }\n\n /**\n * Resolves the objects from options and defaults for option value resolution.\n * @param {object} mainScope - The main scope object for options\n * @param {string[][]} keyLists - The arrays of keys in resolution order\n * @param {boolean} [resetCache] - reset the cache for this mainScope\n */\n getOptionScopes(mainScope, keyLists, resetCache) {\n const {options, type} = this;\n const cache = this._cachedScopes(mainScope, resetCache);\n const cached = cache.get(keyLists);\n if (cached) {\n return cached;\n }\n\n const scopes = new Set();\n\n keyLists.forEach(keys => {\n if (mainScope) {\n scopes.add(mainScope);\n keys.forEach(key => addIfFound(scopes, mainScope, key));\n }\n keys.forEach(key => addIfFound(scopes, options, key));\n keys.forEach(key => addIfFound(scopes, overrides[type] || {}, key));\n keys.forEach(key => addIfFound(scopes, defaults, key));\n keys.forEach(key => addIfFound(scopes, descriptors, key));\n });\n\n const array = Array.from(scopes);\n if (array.length === 0) {\n array.push(Object.create(null));\n }\n if (keysCached.has(keyLists)) {\n cache.set(keyLists, array);\n }\n return array;\n }\n\n /**\n * Returns the option scopes for resolving chart options\n * @return {object[]}\n */\n chartOptionScopes() {\n const {options, type} = this;\n\n return [\n options,\n overrides[type] || {},\n defaults.datasets[type] || {}, // https://github.com/chartjs/Chart.js/issues/8531\n {type},\n defaults,\n descriptors\n ];\n }\n\n /**\n * @param {object[]} scopes\n * @param {string[]} names\n * @param {function|object} context\n * @param {string[]} [prefixes]\n * @return {object}\n */\n resolveNamedOptions(scopes, names, context, prefixes = ['']) {\n const result = {$shared: true};\n const {resolver, subPrefixes} = getResolver(this._resolverCache, scopes, prefixes);\n let options = resolver;\n if (needContext(resolver, names)) {\n result.$shared = false;\n context = isFunction(context) ? context() : context;\n // subResolver is passed to scriptable options. It should not resolve to hover options.\n const subResolver = this.createResolver(scopes, context, subPrefixes);\n options = _attachContext(resolver, context, subResolver);\n }\n\n for (const prop of names) {\n result[prop] = options[prop];\n }\n return result;\n }\n\n /**\n * @param {object[]} scopes\n * @param {object} [context]\n * @param {string[]} [prefixes]\n * @param {{scriptable: boolean, indexable: boolean, allKeys?: boolean}} [descriptorDefaults]\n */\n createResolver(scopes, context, prefixes = [''], descriptorDefaults) {\n const {resolver} = getResolver(this._resolverCache, scopes, prefixes);\n return isObject(context)\n ? _attachContext(resolver, context, undefined, descriptorDefaults)\n : resolver;\n }\n}\n\nfunction getResolver(resolverCache, scopes, prefixes) {\n let cache = resolverCache.get(scopes);\n if (!cache) {\n cache = new Map();\n resolverCache.set(scopes, cache);\n }\n const cacheKey = prefixes.join();\n let cached = cache.get(cacheKey);\n if (!cached) {\n const resolver = _createResolver(scopes, prefixes);\n cached = {\n resolver,\n subPrefixes: prefixes.filter(p => !p.toLowerCase().includes('hover'))\n };\n cache.set(cacheKey, cached);\n }\n return cached;\n}\n\nconst hasFunction = value => isObject(value)\n && Object.getOwnPropertyNames(value).some((key) => isFunction(value[key]));\n\nfunction needContext(proxy, names) {\n const {isScriptable, isIndexable} = _descriptors(proxy);\n\n for (const prop of names) {\n const scriptable = isScriptable(prop);\n const indexable = isIndexable(prop);\n const value = (indexable || scriptable) && proxy[prop];\n if ((scriptable && (isFunction(value) || hasFunction(value)))\n || (indexable && isArray(value))) {\n return true;\n }\n }\n return false;\n}\n", "import animator from './core.animator.js';\nimport defaults, {overrides} from './core.defaults.js';\nimport Interaction from './core.interaction.js';\nimport layouts from './core.layouts.js';\nimport {_detectPlatform} from '../platform/index.js';\nimport PluginService from './core.plugins.js';\nimport registry from './core.registry.js';\nimport Config, {determineAxis, getIndexAxis} from './core.config.js';\nimport {retinaScale, _isDomSupported} from '../helpers/helpers.dom.js';\nimport {each, callback as callCallback, uid, valueOrDefault, _elementsEqual, isNullOrUndef, setsEqual, defined, isFunction, _isClickEvent} from '../helpers/helpers.core.js';\nimport {clearCanvas, clipArea, createContext, unclipArea, _isPointInArea} from '../helpers/index.js';\n// @ts-ignore\nimport {version} from '../../package.json';\nimport {debounce} from '../helpers/helpers.extras.js';\n\n/**\n * @typedef { import('../types/index.js').ChartEvent } ChartEvent\n * @typedef { import('../types/index.js').Point } Point\n */\n\nconst KNOWN_POSITIONS = ['top', 'bottom', 'left', 'right', 'chartArea'];\nfunction positionIsHorizontal(position, axis) {\n return position === 'top' || position === 'bottom' || (KNOWN_POSITIONS.indexOf(position) === -1 && axis === 'x');\n}\n\nfunction compare2Level(l1, l2) {\n return function(a, b) {\n return a[l1] === b[l1]\n ? a[l2] - b[l2]\n : a[l1] - b[l1];\n };\n}\n\nfunction onAnimationsComplete(context) {\n const chart = context.chart;\n const animationOptions = chart.options.animation;\n\n chart.notifyPlugins('afterRender');\n callCallback(animationOptions && animationOptions.onComplete, [context], chart);\n}\n\nfunction onAnimationProgress(context) {\n const chart = context.chart;\n const animationOptions = chart.options.animation;\n callCallback(animationOptions && animationOptions.onProgress, [context], chart);\n}\n\n/**\n * Chart.js can take a string id of a canvas element, a 2d context, or a canvas element itself.\n * Attempt to unwrap the item passed into the chart constructor so that it is a canvas element (if possible).\n */\nfunction getCanvas(item) {\n if (_isDomSupported() && typeof item === 'string') {\n item = document.getElementById(item);\n } else if (item && item.length) {\n // Support for array based queries (such as jQuery)\n item = item[0];\n }\n\n if (item && item.canvas) {\n // Support for any object associated to a canvas (including a context2d)\n item = item.canvas;\n }\n return item;\n}\n\nconst instances = {};\nconst getChart = (key) => {\n const canvas = getCanvas(key);\n return Object.values(instances).filter((c) => c.canvas === canvas).pop();\n};\n\nfunction moveNumericKeys(obj, start, move) {\n const keys = Object.keys(obj);\n for (const key of keys) {\n const intKey = +key;\n if (intKey >= start) {\n const value = obj[key];\n delete obj[key];\n if (move > 0 || intKey > start) {\n obj[intKey + move] = value;\n }\n }\n }\n}\n\n/**\n * @param {ChartEvent} e\n * @param {ChartEvent|null} lastEvent\n * @param {boolean} inChartArea\n * @param {boolean} isClick\n * @returns {ChartEvent|null}\n */\nfunction determineLastEvent(e, lastEvent, inChartArea, isClick) {\n if (!inChartArea || e.type === 'mouseout') {\n return null;\n }\n if (isClick) {\n return lastEvent;\n }\n return e;\n}\n\nfunction getSizeForArea(scale, chartArea, field) {\n return scale.options.clip ? scale[field] : chartArea[field];\n}\n\nfunction getDatasetArea(meta, chartArea) {\n const {xScale, yScale} = meta;\n if (xScale && yScale) {\n return {\n left: getSizeForArea(xScale, chartArea, 'left'),\n right: getSizeForArea(xScale, chartArea, 'right'),\n top: getSizeForArea(yScale, chartArea, 'top'),\n bottom: getSizeForArea(yScale, chartArea, 'bottom')\n };\n }\n return chartArea;\n}\n\nclass Chart {\n\n static defaults = defaults;\n static instances = instances;\n static overrides = overrides;\n static registry = registry;\n static version = version;\n static getChart = getChart;\n\n static register(...items) {\n registry.add(...items);\n invalidatePlugins();\n }\n\n static unregister(...items) {\n registry.remove(...items);\n invalidatePlugins();\n }\n\n // eslint-disable-next-line max-statements\n constructor(item, userConfig) {\n const config = this.config = new Config(userConfig);\n const initialCanvas = getCanvas(item);\n const existingChart = getChart(initialCanvas);\n if (existingChart) {\n throw new Error(\n 'Canvas is already in use. Chart with ID \\'' + existingChart.id + '\\'' +\n\t\t\t\t' must be destroyed before the canvas with ID \\'' + existingChart.canvas.id + '\\' can be reused.'\n );\n }\n\n const options = config.createResolver(config.chartOptionScopes(), this.getContext());\n\n this.platform = new (config.platform || _detectPlatform(initialCanvas))();\n this.platform.updateConfig(config);\n\n const context = this.platform.acquireContext(initialCanvas, options.aspectRatio);\n const canvas = context && context.canvas;\n const height = canvas && canvas.height;\n const width = canvas && canvas.width;\n\n this.id = uid();\n this.ctx = context;\n this.canvas = canvas;\n this.width = width;\n this.height = height;\n this._options = options;\n // Store the previously used aspect ratio to determine if a resize\n // is needed during updates. Do this after _options is set since\n // aspectRatio uses a getter\n this._aspectRatio = this.aspectRatio;\n this._layers = [];\n this._metasets = [];\n this._stacks = undefined;\n this.boxes = [];\n this.currentDevicePixelRatio = undefined;\n this.chartArea = undefined;\n this._active = [];\n this._lastEvent = undefined;\n this._listeners = {};\n /** @type {?{attach?: function, detach?: function, resize?: function}} */\n this._responsiveListeners = undefined;\n this._sortedMetasets = [];\n this.scales = {};\n this._plugins = new PluginService();\n this.$proxies = {};\n this._hiddenIndices = {};\n this.attached = false;\n this._animationsDisabled = undefined;\n this.$context = undefined;\n this._doResize = debounce(mode => this.update(mode), options.resizeDelay || 0);\n this._dataChanges = [];\n\n // Add the chart instance to the global namespace\n instances[this.id] = this;\n\n if (!context || !canvas) {\n // The given item is not a compatible context2d element, let's return before finalizing\n // the chart initialization but after setting basic chart / controller properties that\n // can help to figure out that the chart is not valid (e.g chart.canvas !== null);\n // https://github.com/chartjs/Chart.js/issues/2807\n console.error(\"Failed to create chart: can't acquire context from the given item\");\n return;\n }\n\n animator.listen(this, 'complete', onAnimationsComplete);\n animator.listen(this, 'progress', onAnimationProgress);\n\n this._initialize();\n if (this.attached) {\n this.update();\n }\n }\n\n get aspectRatio() {\n const {options: {aspectRatio, maintainAspectRatio}, width, height, _aspectRatio} = this;\n if (!isNullOrUndef(aspectRatio)) {\n // If aspectRatio is defined in options, use that.\n return aspectRatio;\n }\n\n if (maintainAspectRatio && _aspectRatio) {\n // If maintainAspectRatio is truthly and we had previously determined _aspectRatio, use that\n return _aspectRatio;\n }\n\n // Calculate\n return height ? width / height : null;\n }\n\n get data() {\n return this.config.data;\n }\n\n set data(data) {\n this.config.data = data;\n }\n\n get options() {\n return this._options;\n }\n\n set options(options) {\n this.config.options = options;\n }\n\n get registry() {\n return registry;\n }\n\n /**\n\t * @private\n\t */\n _initialize() {\n // Before init plugin notification\n this.notifyPlugins('beforeInit');\n\n if (this.options.responsive) {\n this.resize();\n } else {\n retinaScale(this, this.options.devicePixelRatio);\n }\n\n this.bindEvents();\n\n // After init plugin notification\n this.notifyPlugins('afterInit');\n\n return this;\n }\n\n clear() {\n clearCanvas(this.canvas, this.ctx);\n return this;\n }\n\n stop() {\n animator.stop(this);\n return this;\n }\n\n /**\n\t * Resize the chart to its container or to explicit dimensions.\n\t * @param {number} [width]\n\t * @param {number} [height]\n\t */\n resize(width, height) {\n if (!animator.running(this)) {\n this._resize(width, height);\n } else {\n this._resizeBeforeDraw = {width, height};\n }\n }\n\n _resize(width, height) {\n const options = this.options;\n const canvas = this.canvas;\n const aspectRatio = options.maintainAspectRatio && this.aspectRatio;\n const newSize = this.platform.getMaximumSize(canvas, width, height, aspectRatio);\n const newRatio = options.devicePixelRatio || this.platform.getDevicePixelRatio();\n const mode = this.width ? 'resize' : 'attach';\n\n this.width = newSize.width;\n this.height = newSize.height;\n this._aspectRatio = this.aspectRatio;\n if (!retinaScale(this, newRatio, true)) {\n return;\n }\n\n this.notifyPlugins('resize', {size: newSize});\n\n callCallback(options.onResize, [this, newSize], this);\n\n if (this.attached) {\n if (this._doResize(mode)) {\n // The resize update is delayed, only draw without updating.\n this.render();\n }\n }\n }\n\n ensureScalesHaveIDs() {\n const options = this.options;\n const scalesOptions = options.scales || {};\n\n each(scalesOptions, (axisOptions, axisID) => {\n axisOptions.id = axisID;\n });\n }\n\n /**\n\t * Builds a map of scale ID to scale object for future lookup.\n\t */\n buildOrUpdateScales() {\n const options = this.options;\n const scaleOpts = options.scales;\n const scales = this.scales;\n const updated = Object.keys(scales).reduce((obj, id) => {\n obj[id] = false;\n return obj;\n }, {});\n let items = [];\n\n if (scaleOpts) {\n items = items.concat(\n Object.keys(scaleOpts).map((id) => {\n const scaleOptions = scaleOpts[id];\n const axis = determineAxis(id, scaleOptions);\n const isRadial = axis === 'r';\n const isHorizontal = axis === 'x';\n return {\n options: scaleOptions,\n dposition: isRadial ? 'chartArea' : isHorizontal ? 'bottom' : 'left',\n dtype: isRadial ? 'radialLinear' : isHorizontal ? 'category' : 'linear'\n };\n })\n );\n }\n\n each(items, (item) => {\n const scaleOptions = item.options;\n const id = scaleOptions.id;\n const axis = determineAxis(id, scaleOptions);\n const scaleType = valueOrDefault(scaleOptions.type, item.dtype);\n\n if (scaleOptions.position === undefined || positionIsHorizontal(scaleOptions.position, axis) !== positionIsHorizontal(item.dposition)) {\n scaleOptions.position = item.dposition;\n }\n\n updated[id] = true;\n let scale = null;\n if (id in scales && scales[id].type === scaleType) {\n scale = scales[id];\n } else {\n const scaleClass = registry.getScale(scaleType);\n scale = new scaleClass({\n id,\n type: scaleType,\n ctx: this.ctx,\n chart: this\n });\n scales[scale.id] = scale;\n }\n\n scale.init(scaleOptions, options);\n });\n // clear up discarded scales\n each(updated, (hasUpdated, id) => {\n if (!hasUpdated) {\n delete scales[id];\n }\n });\n\n each(scales, (scale) => {\n layouts.configure(this, scale, scale.options);\n layouts.addBox(this, scale);\n });\n }\n\n /**\n\t * @private\n\t */\n _updateMetasets() {\n const metasets = this._metasets;\n const numData = this.data.datasets.length;\n const numMeta = metasets.length;\n\n metasets.sort((a, b) => a.index - b.index);\n if (numMeta > numData) {\n for (let i = numData; i < numMeta; ++i) {\n this._destroyDatasetMeta(i);\n }\n metasets.splice(numData, numMeta - numData);\n }\n this._sortedMetasets = metasets.slice(0).sort(compare2Level('order', 'index'));\n }\n\n /**\n\t * @private\n\t */\n _removeUnreferencedMetasets() {\n const {_metasets: metasets, data: {datasets}} = this;\n if (metasets.length > datasets.length) {\n delete this._stacks;\n }\n metasets.forEach((meta, index) => {\n if (datasets.filter(x => x === meta._dataset).length === 0) {\n this._destroyDatasetMeta(index);\n }\n });\n }\n\n buildOrUpdateControllers() {\n const newControllers = [];\n const datasets = this.data.datasets;\n let i, ilen;\n\n this._removeUnreferencedMetasets();\n\n for (i = 0, ilen = datasets.length; i < ilen; i++) {\n const dataset = datasets[i];\n let meta = this.getDatasetMeta(i);\n const type = dataset.type || this.config.type;\n\n if (meta.type && meta.type !== type) {\n this._destroyDatasetMeta(i);\n meta = this.getDatasetMeta(i);\n }\n meta.type = type;\n meta.indexAxis = dataset.indexAxis || getIndexAxis(type, this.options);\n meta.order = dataset.order || 0;\n meta.index = i;\n meta.label = '' + dataset.label;\n meta.visible = this.isDatasetVisible(i);\n\n if (meta.controller) {\n meta.controller.updateIndex(i);\n meta.controller.linkScales();\n } else {\n const ControllerClass = registry.getController(type);\n const {datasetElementType, dataElementType} = defaults.datasets[type];\n Object.assign(ControllerClass, {\n dataElementType: registry.getElement(dataElementType),\n datasetElementType: datasetElementType && registry.getElement(datasetElementType)\n });\n meta.controller = new ControllerClass(this, i);\n newControllers.push(meta.controller);\n }\n }\n\n this._updateMetasets();\n return newControllers;\n }\n\n /**\n\t * Reset the elements of all datasets\n\t * @private\n\t */\n _resetElements() {\n each(this.data.datasets, (dataset, datasetIndex) => {\n this.getDatasetMeta(datasetIndex).controller.reset();\n }, this);\n }\n\n /**\n\t* Resets the chart back to its state before the initial animation\n\t*/\n reset() {\n this._resetElements();\n this.notifyPlugins('reset');\n }\n\n update(mode) {\n const config = this.config;\n\n config.update();\n const options = this._options = config.createResolver(config.chartOptionScopes(), this.getContext());\n const animsDisabled = this._animationsDisabled = !options.animation;\n\n this._updateScales();\n this._checkEventBindings();\n this._updateHiddenIndices();\n\n // plugins options references might have change, let's invalidate the cache\n // https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167\n this._plugins.invalidate();\n\n if (this.notifyPlugins('beforeUpdate', {mode, cancelable: true}) === false) {\n return;\n }\n\n // Make sure dataset controllers are updated and new controllers are reset\n const newControllers = this.buildOrUpdateControllers();\n\n this.notifyPlugins('beforeElementsUpdate');\n\n // Make sure all dataset controllers have correct meta data counts\n let minPadding = 0;\n for (let i = 0, ilen = this.data.datasets.length; i < ilen; i++) {\n const {controller} = this.getDatasetMeta(i);\n const reset = !animsDisabled && newControllers.indexOf(controller) === -1;\n // New controllers will be reset after the layout pass, so we only want to modify\n // elements added to new datasets\n controller.buildOrUpdateElements(reset);\n minPadding = Math.max(+controller.getMaxOverflow(), minPadding);\n }\n minPadding = this._minPadding = options.layout.autoPadding ? minPadding : 0;\n this._updateLayout(minPadding);\n\n // Only reset the controllers if we have animations\n if (!animsDisabled) {\n // Can only reset the new controllers after the scales have been updated\n // Reset is done to get the starting point for the initial animation\n each(newControllers, (controller) => {\n controller.reset();\n });\n }\n\n this._updateDatasets(mode);\n\n // Do this before render so that any plugins that need final scale updates can use it\n this.notifyPlugins('afterUpdate', {mode});\n\n this._layers.sort(compare2Level('z', '_idx'));\n\n // Replay last event from before update, or set hover styles on active elements\n const {_active, _lastEvent} = this;\n if (_lastEvent) {\n this._eventHandler(_lastEvent, true);\n } else if (_active.length) {\n this._updateHoverStyles(_active, _active, true);\n }\n\n this.render();\n }\n\n /**\n * @private\n */\n _updateScales() {\n each(this.scales, (scale) => {\n layouts.removeBox(this, scale);\n });\n\n this.ensureScalesHaveIDs();\n this.buildOrUpdateScales();\n }\n\n /**\n * @private\n */\n _checkEventBindings() {\n const options = this.options;\n const existingEvents = new Set(Object.keys(this._listeners));\n const newEvents = new Set(options.events);\n\n if (!setsEqual(existingEvents, newEvents) || !!this._responsiveListeners !== options.responsive) {\n // The configured events have changed. Rebind.\n this.unbindEvents();\n this.bindEvents();\n }\n }\n\n /**\n * @private\n */\n _updateHiddenIndices() {\n const {_hiddenIndices} = this;\n const changes = this._getUniformDataChanges() || [];\n for (const {method, start, count} of changes) {\n const move = method === '_removeElements' ? -count : count;\n moveNumericKeys(_hiddenIndices, start, move);\n }\n }\n\n /**\n * @private\n */\n _getUniformDataChanges() {\n const _dataChanges = this._dataChanges;\n if (!_dataChanges || !_dataChanges.length) {\n return;\n }\n\n this._dataChanges = [];\n const datasetCount = this.data.datasets.length;\n const makeSet = (idx) => new Set(\n _dataChanges\n .filter(c => c[0] === idx)\n .map((c, i) => i + ',' + c.splice(1).join(','))\n );\n\n const changeSet = makeSet(0);\n for (let i = 1; i < datasetCount; i++) {\n if (!setsEqual(changeSet, makeSet(i))) {\n return;\n }\n }\n return Array.from(changeSet)\n .map(c => c.split(','))\n .map(a => ({method: a[1], start: +a[2], count: +a[3]}));\n }\n\n /**\n\t * Updates the chart layout unless a plugin returns `false` to the `beforeLayout`\n\t * hook, in which case, plugins will not be called on `afterLayout`.\n\t * @private\n\t */\n _updateLayout(minPadding) {\n if (this.notifyPlugins('beforeLayout', {cancelable: true}) === false) {\n return;\n }\n\n layouts.update(this, this.width, this.height, minPadding);\n\n const area = this.chartArea;\n const noArea = area.width <= 0 || area.height <= 0;\n\n this._layers = [];\n each(this.boxes, (box) => {\n if (noArea && box.position === 'chartArea') {\n // Skip drawing and configuring chartArea boxes when chartArea is zero or negative\n return;\n }\n\n // configure is called twice, once in core.scale.update and once here.\n // Here the boxes are fully updated and at their final positions.\n if (box.configure) {\n box.configure();\n }\n this._layers.push(...box._layers());\n }, this);\n\n this._layers.forEach((item, index) => {\n item._idx = index;\n });\n\n this.notifyPlugins('afterLayout');\n }\n\n /**\n\t * Updates all datasets unless a plugin returns `false` to the `beforeDatasetsUpdate`\n\t * hook, in which case, plugins will not be called on `afterDatasetsUpdate`.\n\t * @private\n\t */\n _updateDatasets(mode) {\n if (this.notifyPlugins('beforeDatasetsUpdate', {mode, cancelable: true}) === false) {\n return;\n }\n\n for (let i = 0, ilen = this.data.datasets.length; i < ilen; ++i) {\n this.getDatasetMeta(i).controller.configure();\n }\n\n for (let i = 0, ilen = this.data.datasets.length; i < ilen; ++i) {\n this._updateDataset(i, isFunction(mode) ? mode({datasetIndex: i}) : mode);\n }\n\n this.notifyPlugins('afterDatasetsUpdate', {mode});\n }\n\n /**\n\t * Updates dataset at index unless a plugin returns `false` to the `beforeDatasetUpdate`\n\t * hook, in which case, plugins will not be called on `afterDatasetUpdate`.\n\t * @private\n\t */\n _updateDataset(index, mode) {\n const meta = this.getDatasetMeta(index);\n const args = {meta, index, mode, cancelable: true};\n\n if (this.notifyPlugins('beforeDatasetUpdate', args) === false) {\n return;\n }\n\n meta.controller._update(mode);\n\n args.cancelable = false;\n this.notifyPlugins('afterDatasetUpdate', args);\n }\n\n render() {\n if (this.notifyPlugins('beforeRender', {cancelable: true}) === false) {\n return;\n }\n\n if (animator.has(this)) {\n if (this.attached && !animator.running(this)) {\n animator.start(this);\n }\n } else {\n this.draw();\n onAnimationsComplete({chart: this});\n }\n }\n\n draw() {\n let i;\n if (this._resizeBeforeDraw) {\n const {width, height} = this._resizeBeforeDraw;\n // Unset pending resize request now to avoid possible recursion within _resize\n this._resizeBeforeDraw = null;\n this._resize(width, height);\n }\n this.clear();\n\n if (this.width <= 0 || this.height <= 0) {\n return;\n }\n\n if (this.notifyPlugins('beforeDraw', {cancelable: true}) === false) {\n return;\n }\n\n // Because of plugin hooks (before/afterDatasetsDraw), datasets can't\n // currently be part of layers. Instead, we draw\n // layers <= 0 before(default, backward compat), and the rest after\n const layers = this._layers;\n for (i = 0; i < layers.length && layers[i].z <= 0; ++i) {\n layers[i].draw(this.chartArea);\n }\n\n this._drawDatasets();\n\n // Rest of layers\n for (; i < layers.length; ++i) {\n layers[i].draw(this.chartArea);\n }\n\n this.notifyPlugins('afterDraw');\n }\n\n /**\n\t * @private\n\t */\n _getSortedDatasetMetas(filterVisible) {\n const metasets = this._sortedMetasets;\n const result = [];\n let i, ilen;\n\n for (i = 0, ilen = metasets.length; i < ilen; ++i) {\n const meta = metasets[i];\n if (!filterVisible || meta.visible) {\n result.push(meta);\n }\n }\n\n return result;\n }\n\n /**\n\t * Gets the visible dataset metas in drawing order\n\t * @return {object[]}\n\t */\n getSortedVisibleDatasetMetas() {\n return this._getSortedDatasetMetas(true);\n }\n\n /**\n\t * Draws all datasets unless a plugin returns `false` to the `beforeDatasetsDraw`\n\t * hook, in which case, plugins will not be called on `afterDatasetsDraw`.\n\t * @private\n\t */\n _drawDatasets() {\n if (this.notifyPlugins('beforeDatasetsDraw', {cancelable: true}) === false) {\n return;\n }\n\n const metasets = this.getSortedVisibleDatasetMetas();\n for (let i = metasets.length - 1; i >= 0; --i) {\n this._drawDataset(metasets[i]);\n }\n\n this.notifyPlugins('afterDatasetsDraw');\n }\n\n /**\n\t * Draws dataset at index unless a plugin returns `false` to the `beforeDatasetDraw`\n\t * hook, in which case, plugins will not be called on `afterDatasetDraw`.\n\t * @private\n\t */\n _drawDataset(meta) {\n const ctx = this.ctx;\n const clip = meta._clip;\n const useClip = !clip.disabled;\n const area = getDatasetArea(meta, this.chartArea);\n const args = {\n meta,\n index: meta.index,\n cancelable: true\n };\n\n if (this.notifyPlugins('beforeDatasetDraw', args) === false) {\n return;\n }\n\n if (useClip) {\n clipArea(ctx, {\n left: clip.left === false ? 0 : area.left - clip.left,\n right: clip.right === false ? this.width : area.right + clip.right,\n top: clip.top === false ? 0 : area.top - clip.top,\n bottom: clip.bottom === false ? this.height : area.bottom + clip.bottom\n });\n }\n\n meta.controller.draw();\n\n if (useClip) {\n unclipArea(ctx);\n }\n\n args.cancelable = false;\n this.notifyPlugins('afterDatasetDraw', args);\n }\n\n /**\n * Checks whether the given point is in the chart area.\n * @param {Point} point - in relative coordinates (see, e.g., getRelativePosition)\n * @returns {boolean}\n */\n isPointInArea(point) {\n return _isPointInArea(point, this.chartArea, this._minPadding);\n }\n\n getElementsAtEventForMode(e, mode, options, useFinalPosition) {\n const method = Interaction.modes[mode];\n if (typeof method === 'function') {\n return method(this, e, options, useFinalPosition);\n }\n\n return [];\n }\n\n getDatasetMeta(datasetIndex) {\n const dataset = this.data.datasets[datasetIndex];\n const metasets = this._metasets;\n let meta = metasets.filter(x => x && x._dataset === dataset).pop();\n\n if (!meta) {\n meta = {\n type: null,\n data: [],\n dataset: null,\n controller: null,\n hidden: null,\t\t\t// See isDatasetVisible() comment\n xAxisID: null,\n yAxisID: null,\n order: dataset && dataset.order || 0,\n index: datasetIndex,\n _dataset: dataset,\n _parsed: [],\n _sorted: false\n };\n metasets.push(meta);\n }\n\n return meta;\n }\n\n getContext() {\n return this.$context || (this.$context = createContext(null, {chart: this, type: 'chart'}));\n }\n\n getVisibleDatasetCount() {\n return this.getSortedVisibleDatasetMetas().length;\n }\n\n isDatasetVisible(datasetIndex) {\n const dataset = this.data.datasets[datasetIndex];\n if (!dataset) {\n return false;\n }\n\n const meta = this.getDatasetMeta(datasetIndex);\n\n // meta.hidden is a per chart dataset hidden flag override with 3 states: if true or false,\n // the dataset.hidden value is ignored, else if null, the dataset hidden state is returned.\n return typeof meta.hidden === 'boolean' ? !meta.hidden : !dataset.hidden;\n }\n\n setDatasetVisibility(datasetIndex, visible) {\n const meta = this.getDatasetMeta(datasetIndex);\n meta.hidden = !visible;\n }\n\n toggleDataVisibility(index) {\n this._hiddenIndices[index] = !this._hiddenIndices[index];\n }\n\n getDataVisibility(index) {\n return !this._hiddenIndices[index];\n }\n\n /**\n\t * @private\n\t */\n _updateVisibility(datasetIndex, dataIndex, visible) {\n const mode = visible ? 'show' : 'hide';\n const meta = this.getDatasetMeta(datasetIndex);\n const anims = meta.controller._resolveAnimations(undefined, mode);\n\n if (defined(dataIndex)) {\n meta.data[dataIndex].hidden = !visible;\n this.update();\n } else {\n this.setDatasetVisibility(datasetIndex, visible);\n // Animate visible state, so hide animation can be seen. This could be handled better if update / updateDataset returned a Promise.\n anims.update(meta, {visible});\n this.update((ctx) => ctx.datasetIndex === datasetIndex ? mode : undefined);\n }\n }\n\n hide(datasetIndex, dataIndex) {\n this._updateVisibility(datasetIndex, dataIndex, false);\n }\n\n show(datasetIndex, dataIndex) {\n this._updateVisibility(datasetIndex, dataIndex, true);\n }\n\n /**\n\t * @private\n\t */\n _destroyDatasetMeta(datasetIndex) {\n const meta = this._metasets[datasetIndex];\n if (meta && meta.controller) {\n meta.controller._destroy();\n }\n delete this._metasets[datasetIndex];\n }\n\n _stop() {\n let i, ilen;\n this.stop();\n animator.remove(this);\n\n for (i = 0, ilen = this.data.datasets.length; i < ilen; ++i) {\n this._destroyDatasetMeta(i);\n }\n }\n\n destroy() {\n this.notifyPlugins('beforeDestroy');\n const {canvas, ctx} = this;\n\n this._stop();\n this.config.clearCache();\n\n if (canvas) {\n this.unbindEvents();\n clearCanvas(canvas, ctx);\n this.platform.releaseContext(ctx);\n this.canvas = null;\n this.ctx = null;\n }\n\n delete instances[this.id];\n\n this.notifyPlugins('afterDestroy');\n }\n\n toBase64Image(...args) {\n return this.canvas.toDataURL(...args);\n }\n\n /**\n\t * @private\n\t */\n bindEvents() {\n this.bindUserEvents();\n if (this.options.responsive) {\n this.bindResponsiveEvents();\n } else {\n this.attached = true;\n }\n }\n\n /**\n * @private\n */\n bindUserEvents() {\n const listeners = this._listeners;\n const platform = this.platform;\n\n const _add = (type, listener) => {\n platform.addEventListener(this, type, listener);\n listeners[type] = listener;\n };\n\n const listener = (e, x, y) => {\n e.offsetX = x;\n e.offsetY = y;\n this._eventHandler(e);\n };\n\n each(this.options.events, (type) => _add(type, listener));\n }\n\n /**\n * @private\n */\n bindResponsiveEvents() {\n if (!this._responsiveListeners) {\n this._responsiveListeners = {};\n }\n const listeners = this._responsiveListeners;\n const platform = this.platform;\n\n const _add = (type, listener) => {\n platform.addEventListener(this, type, listener);\n listeners[type] = listener;\n };\n const _remove = (type, listener) => {\n if (listeners[type]) {\n platform.removeEventListener(this, type, listener);\n delete listeners[type];\n }\n };\n\n const listener = (width, height) => {\n if (this.canvas) {\n this.resize(width, height);\n }\n };\n\n let detached; // eslint-disable-line prefer-const\n const attached = () => {\n _remove('attach', attached);\n\n this.attached = true;\n this.resize();\n\n _add('resize', listener);\n _add('detach', detached);\n };\n\n detached = () => {\n this.attached = false;\n\n _remove('resize', listener);\n\n // Stop animating and remove metasets, so when re-attached, the animations start from beginning.\n this._stop();\n this._resize(0, 0);\n\n _add('attach', attached);\n };\n\n if (platform.isAttached(this.canvas)) {\n attached();\n } else {\n detached();\n }\n }\n\n /**\n\t * @private\n\t */\n unbindEvents() {\n each(this._listeners, (listener, type) => {\n this.platform.removeEventListener(this, type, listener);\n });\n this._listeners = {};\n\n each(this._responsiveListeners, (listener, type) => {\n this.platform.removeEventListener(this, type, listener);\n });\n this._responsiveListeners = undefined;\n }\n\n updateHoverStyle(items, mode, enabled) {\n const prefix = enabled ? 'set' : 'remove';\n let meta, item, i, ilen;\n\n if (mode === 'dataset') {\n meta = this.getDatasetMeta(items[0].datasetIndex);\n meta.controller['_' + prefix + 'DatasetHoverStyle']();\n }\n\n for (i = 0, ilen = items.length; i < ilen; ++i) {\n item = items[i];\n const controller = item && this.getDatasetMeta(item.datasetIndex).controller;\n if (controller) {\n controller[prefix + 'HoverStyle'](item.element, item.datasetIndex, item.index);\n }\n }\n }\n\n /**\n\t * Get active (hovered) elements\n\t * @returns array\n\t */\n getActiveElements() {\n return this._active || [];\n }\n\n /**\n\t * Set active (hovered) elements\n\t * @param {array} activeElements New active data points\n\t */\n setActiveElements(activeElements) {\n const lastActive = this._active || [];\n const active = activeElements.map(({datasetIndex, index}) => {\n const meta = this.getDatasetMeta(datasetIndex);\n if (!meta) {\n throw new Error('No dataset found at index ' + datasetIndex);\n }\n\n return {\n datasetIndex,\n element: meta.data[index],\n index,\n };\n });\n const changed = !_elementsEqual(active, lastActive);\n\n if (changed) {\n this._active = active;\n // Make sure we don't use the previous mouse event to override the active elements in update.\n this._lastEvent = null;\n this._updateHoverStyles(active, lastActive);\n }\n }\n\n /**\n\t * Calls enabled plugins on the specified hook and with the given args.\n\t * This method immediately returns as soon as a plugin explicitly returns false. The\n\t * returned value can be used, for instance, to interrupt the current action.\n\t * @param {string} hook - The name of the plugin method to call (e.g. 'beforeUpdate').\n\t * @param {Object} [args] - Extra arguments to apply to the hook call.\n * @param {import('./core.plugins.js').filterCallback} [filter] - Filtering function for limiting which plugins are notified\n\t * @returns {boolean} false if any of the plugins return false, else returns true.\n\t */\n notifyPlugins(hook, args, filter) {\n return this._plugins.notify(this, hook, args, filter);\n }\n\n /**\n * Check if a plugin with the specific ID is registered and enabled\n * @param {string} pluginId - The ID of the plugin of which to check if it is enabled\n * @returns {boolean}\n */\n isPluginEnabled(pluginId) {\n return this._plugins._cache.filter(p => p.plugin.id === pluginId).length === 1;\n }\n\n /**\n\t * @private\n\t */\n _updateHoverStyles(active, lastActive, replay) {\n const hoverOptions = this.options.hover;\n const diff = (a, b) => a.filter(x => !b.some(y => x.datasetIndex === y.datasetIndex && x.index === y.index));\n const deactivated = diff(lastActive, active);\n const activated = replay ? active : diff(active, lastActive);\n\n if (deactivated.length) {\n this.updateHoverStyle(deactivated, hoverOptions.mode, false);\n }\n\n if (activated.length && hoverOptions.mode) {\n this.updateHoverStyle(activated, hoverOptions.mode, true);\n }\n }\n\n /**\n\t * @private\n\t */\n _eventHandler(e, replay) {\n const args = {\n event: e,\n replay,\n cancelable: true,\n inChartArea: this.isPointInArea(e)\n };\n const eventFilter = (plugin) => (plugin.options.events || this.options.events).includes(e.native.type);\n\n if (this.notifyPlugins('beforeEvent', args, eventFilter) === false) {\n return;\n }\n\n const changed = this._handleEvent(e, replay, args.inChartArea);\n\n args.cancelable = false;\n this.notifyPlugins('afterEvent', args, eventFilter);\n\n if (changed || args.changed) {\n this.render();\n }\n\n return this;\n }\n\n /**\n\t * Handle an event\n\t * @param {ChartEvent} e the event to handle\n\t * @param {boolean} [replay] - true if the event was replayed by `update`\n * @param {boolean} [inChartArea] - true if the event is inside chartArea\n\t * @return {boolean} true if the chart needs to re-render\n\t * @private\n\t */\n _handleEvent(e, replay, inChartArea) {\n const {_active: lastActive = [], options} = this;\n\n // If the event is replayed from `update`, we should evaluate with the final positions.\n //\n // The `replay`:\n // It's the last event (excluding click) that has occurred before `update`.\n // So mouse has not moved. It's also over the chart, because there is a `replay`.\n //\n // The why:\n // If animations are active, the elements haven't moved yet compared to state before update.\n // But if they will, we are activating the elements that would be active, if this check\n // was done after the animations have completed. => \"final positions\".\n // If there is no animations, the \"final\" and \"current\" positions are equal.\n // This is done so we do not have to evaluate the active elements each animation frame\n // - it would be expensive.\n const useFinalPosition = replay;\n const active = this._getActiveElements(e, lastActive, inChartArea, useFinalPosition);\n const isClick = _isClickEvent(e);\n const lastEvent = determineLastEvent(e, this._lastEvent, inChartArea, isClick);\n\n if (inChartArea) {\n // Set _lastEvent to null while we are processing the event handlers.\n // This prevents recursion if the handler calls chart.update()\n this._lastEvent = null;\n\n // Invoke onHover hook\n callCallback(options.onHover, [e, active, this], this);\n\n if (isClick) {\n callCallback(options.onClick, [e, active, this], this);\n }\n }\n\n const changed = !_elementsEqual(active, lastActive);\n if (changed || replay) {\n this._active = active;\n this._updateHoverStyles(active, lastActive, replay);\n }\n\n this._lastEvent = lastEvent;\n\n return changed;\n }\n\n /**\n * @param {ChartEvent} e - The event\n * @param {import('../types/index.js').ActiveElement[]} lastActive - Previously active elements\n * @param {boolean} inChartArea - Is the event inside chartArea\n * @param {boolean} useFinalPosition - Should the evaluation be done with current or final (after animation) element positions\n * @returns {import('../types/index.js').ActiveElement[]} - The active elements\n * @pravate\n */\n _getActiveElements(e, lastActive, inChartArea, useFinalPosition) {\n if (e.type === 'mouseout') {\n return [];\n }\n\n if (!inChartArea) {\n // Let user control the active elements outside chartArea. Eg. using Legend.\n return lastActive;\n }\n\n const hoverOptions = this.options.hover;\n return this.getElementsAtEventForMode(e, hoverOptions.mode, hoverOptions, useFinalPosition);\n }\n}\n\n// @ts-ignore\nfunction invalidatePlugins() {\n return each(Chart.instances, (chart) => chart._plugins.invalidate());\n}\n\nexport default Chart;\n", "import Element from '../core/core.element.js';\nimport {_angleBetween, getAngleFromPoint, TAU, HALF_PI, valueOrDefault} from '../helpers/index.js';\nimport {PI, _isBetween, _limitValue} from '../helpers/helpers.math.js';\nimport {_readValueToProps} from '../helpers/helpers.options.js';\nimport type {ArcOptions, Point} from '../types/index.js';\n\n\nfunction clipArc(ctx: CanvasRenderingContext2D, element: ArcElement, endAngle: number) {\n const {startAngle, pixelMargin, x, y, outerRadius, innerRadius} = element;\n let angleMargin = pixelMargin / outerRadius;\n\n // Draw an inner border by clipping the arc and drawing a double-width border\n // Enlarge the clipping arc by 0.33 pixels to eliminate glitches between borders\n ctx.beginPath();\n ctx.arc(x, y, outerRadius, startAngle - angleMargin, endAngle + angleMargin);\n if (innerRadius > pixelMargin) {\n angleMargin = pixelMargin / innerRadius;\n ctx.arc(x, y, innerRadius, endAngle + angleMargin, startAngle - angleMargin, true);\n } else {\n ctx.arc(x, y, pixelMargin, endAngle + HALF_PI, startAngle - HALF_PI);\n }\n ctx.closePath();\n ctx.clip();\n}\n\nfunction toRadiusCorners(value) {\n return _readValueToProps(value, ['outerStart', 'outerEnd', 'innerStart', 'innerEnd']);\n}\n\n/**\n * Parse border radius from the provided options\n */\nfunction parseBorderRadius(arc: ArcElement, innerRadius: number, outerRadius: number, angleDelta: number) {\n const o = toRadiusCorners(arc.options.borderRadius);\n const halfThickness = (outerRadius - innerRadius) / 2;\n const innerLimit = Math.min(halfThickness, angleDelta * innerRadius / 2);\n\n // Outer limits are complicated. We want to compute the available angular distance at\n // a radius of outerRadius - borderRadius because for small angular distances, this term limits.\n // We compute at r = outerRadius - borderRadius because this circle defines the center of the border corners.\n //\n // If the borderRadius is large, that value can become negative.\n // This causes the outer borders to lose their radius entirely, which is rather unexpected. To solve that, if borderRadius > outerRadius\n // we know that the thickness term will dominate and compute the limits at that point\n const computeOuterLimit = (val) => {\n const outerArcLimit = (outerRadius - Math.min(halfThickness, val)) * angleDelta / 2;\n return _limitValue(val, 0, Math.min(halfThickness, outerArcLimit));\n };\n\n return {\n outerStart: computeOuterLimit(o.outerStart),\n outerEnd: computeOuterLimit(o.outerEnd),\n innerStart: _limitValue(o.innerStart, 0, innerLimit),\n innerEnd: _limitValue(o.innerEnd, 0, innerLimit),\n };\n}\n\n/**\n * Convert (r, 𝜃) to (x, y)\n */\nfunction rThetaToXY(r: number, theta: number, x: number, y: number) {\n return {\n x: x + r * Math.cos(theta),\n y: y + r * Math.sin(theta),\n };\n}\n\n\n/**\n * Path the arc, respecting border radius by separating into left and right halves.\n *\n * Start End\n *\n * 1--->a--->2 Outer\n * / \\\n * 8 3\n * | |\n * | |\n * 7 4\n * \\ /\n * 6<---b<---5 Inner\n */\nfunction pathArc(\n ctx: CanvasRenderingContext2D,\n element: ArcElement,\n offset: number,\n spacing: number,\n end: number,\n circular: boolean,\n) {\n const {x, y, startAngle: start, pixelMargin, innerRadius: innerR} = element;\n\n const outerRadius = Math.max(element.outerRadius + spacing + offset - pixelMargin, 0);\n const innerRadius = innerR > 0 ? innerR + spacing + offset + pixelMargin : 0;\n\n let spacingOffset = 0;\n const alpha = end - start;\n\n if (spacing) {\n // When spacing is present, it is the same for all items\n // So we adjust the start and end angle of the arc such that\n // the distance is the same as it would be without the spacing\n const noSpacingInnerRadius = innerR > 0 ? innerR - spacing : 0;\n const noSpacingOuterRadius = outerRadius > 0 ? outerRadius - spacing : 0;\n const avNogSpacingRadius = (noSpacingInnerRadius + noSpacingOuterRadius) / 2;\n const adjustedAngle = avNogSpacingRadius !== 0 ? (alpha * avNogSpacingRadius) / (avNogSpacingRadius + spacing) : alpha;\n spacingOffset = (alpha - adjustedAngle) / 2;\n }\n\n const beta = Math.max(0.001, alpha * outerRadius - offset / PI) / outerRadius;\n const angleOffset = (alpha - beta) / 2;\n const startAngle = start + angleOffset + spacingOffset;\n const endAngle = end - angleOffset - spacingOffset;\n const {outerStart, outerEnd, innerStart, innerEnd} = parseBorderRadius(element, innerRadius, outerRadius, endAngle - startAngle);\n\n const outerStartAdjustedRadius = outerRadius - outerStart;\n const outerEndAdjustedRadius = outerRadius - outerEnd;\n const outerStartAdjustedAngle = startAngle + outerStart / outerStartAdjustedRadius;\n const outerEndAdjustedAngle = endAngle - outerEnd / outerEndAdjustedRadius;\n\n const innerStartAdjustedRadius = innerRadius + innerStart;\n const innerEndAdjustedRadius = innerRadius + innerEnd;\n const innerStartAdjustedAngle = startAngle + innerStart / innerStartAdjustedRadius;\n const innerEndAdjustedAngle = endAngle - innerEnd / innerEndAdjustedRadius;\n\n ctx.beginPath();\n\n if (circular) {\n // The first arc segments from point 1 to point a to point 2\n const outerMidAdjustedAngle = (outerStartAdjustedAngle + outerEndAdjustedAngle) / 2;\n ctx.arc(x, y, outerRadius, outerStartAdjustedAngle, outerMidAdjustedAngle);\n ctx.arc(x, y, outerRadius, outerMidAdjustedAngle, outerEndAdjustedAngle);\n\n // The corner segment from point 2 to point 3\n if (outerEnd > 0) {\n const pCenter = rThetaToXY(outerEndAdjustedRadius, outerEndAdjustedAngle, x, y);\n ctx.arc(pCenter.x, pCenter.y, outerEnd, outerEndAdjustedAngle, endAngle + HALF_PI);\n }\n\n // The line from point 3 to point 4\n const p4 = rThetaToXY(innerEndAdjustedRadius, endAngle, x, y);\n ctx.lineTo(p4.x, p4.y);\n\n // The corner segment from point 4 to point 5\n if (innerEnd > 0) {\n const pCenter = rThetaToXY(innerEndAdjustedRadius, innerEndAdjustedAngle, x, y);\n ctx.arc(pCenter.x, pCenter.y, innerEnd, endAngle + HALF_PI, innerEndAdjustedAngle + Math.PI);\n }\n\n // The inner arc from point 5 to point b to point 6\n const innerMidAdjustedAngle = ((endAngle - (innerEnd / innerRadius)) + (startAngle + (innerStart / innerRadius))) / 2;\n ctx.arc(x, y, innerRadius, endAngle - (innerEnd / innerRadius), innerMidAdjustedAngle, true);\n ctx.arc(x, y, innerRadius, innerMidAdjustedAngle, startAngle + (innerStart / innerRadius), true);\n\n // The corner segment from point 6 to point 7\n if (innerStart > 0) {\n const pCenter = rThetaToXY(innerStartAdjustedRadius, innerStartAdjustedAngle, x, y);\n ctx.arc(pCenter.x, pCenter.y, innerStart, innerStartAdjustedAngle + Math.PI, startAngle - HALF_PI);\n }\n\n // The line from point 7 to point 8\n const p8 = rThetaToXY(outerStartAdjustedRadius, startAngle, x, y);\n ctx.lineTo(p8.x, p8.y);\n\n // The corner segment from point 8 to point 1\n if (outerStart > 0) {\n const pCenter = rThetaToXY(outerStartAdjustedRadius, outerStartAdjustedAngle, x, y);\n ctx.arc(pCenter.x, pCenter.y, outerStart, startAngle - HALF_PI, outerStartAdjustedAngle);\n }\n } else {\n ctx.moveTo(x, y);\n\n const outerStartX = Math.cos(outerStartAdjustedAngle) * outerRadius + x;\n const outerStartY = Math.sin(outerStartAdjustedAngle) * outerRadius + y;\n ctx.lineTo(outerStartX, outerStartY);\n\n const outerEndX = Math.cos(outerEndAdjustedAngle) * outerRadius + x;\n const outerEndY = Math.sin(outerEndAdjustedAngle) * outerRadius + y;\n ctx.lineTo(outerEndX, outerEndY);\n }\n\n ctx.closePath();\n}\n\nfunction drawArc(\n ctx: CanvasRenderingContext2D,\n element: ArcElement,\n offset: number,\n spacing: number,\n circular: boolean,\n) {\n const {fullCircles, startAngle, circumference} = element;\n let endAngle = element.endAngle;\n if (fullCircles) {\n pathArc(ctx, element, offset, spacing, endAngle, circular);\n for (let i = 0; i < fullCircles; ++i) {\n ctx.fill();\n }\n if (!isNaN(circumference)) {\n endAngle = startAngle + (circumference % TAU || TAU);\n }\n }\n pathArc(ctx, element, offset, spacing, endAngle, circular);\n ctx.fill();\n return endAngle;\n}\n\nfunction drawBorder(\n ctx: CanvasRenderingContext2D,\n element: ArcElement,\n offset: number,\n spacing: number,\n circular: boolean,\n) {\n const {fullCircles, startAngle, circumference, options} = element;\n const {borderWidth, borderJoinStyle, borderDash, borderDashOffset} = options;\n const inner = options.borderAlign === 'inner';\n\n if (!borderWidth) {\n return;\n }\n\n ctx.setLineDash(borderDash || []);\n ctx.lineDashOffset = borderDashOffset;\n\n if (inner) {\n ctx.lineWidth = borderWidth * 2;\n ctx.lineJoin = borderJoinStyle || 'round';\n } else {\n ctx.lineWidth = borderWidth;\n ctx.lineJoin = borderJoinStyle || 'bevel';\n }\n\n let endAngle = element.endAngle;\n if (fullCircles) {\n pathArc(ctx, element, offset, spacing, endAngle, circular);\n for (let i = 0; i < fullCircles; ++i) {\n ctx.stroke();\n }\n if (!isNaN(circumference)) {\n endAngle = startAngle + (circumference % TAU || TAU);\n }\n }\n\n if (inner) {\n clipArc(ctx, element, endAngle);\n }\n\n if (!fullCircles) {\n pathArc(ctx, element, offset, spacing, endAngle, circular);\n ctx.stroke();\n }\n}\n\nexport interface ArcProps extends Point {\n startAngle: number;\n endAngle: number;\n innerRadius: number;\n outerRadius: number;\n circumference: number;\n}\n\nexport default class ArcElement extends Element {\n\n static id = 'arc';\n\n static defaults = {\n borderAlign: 'center',\n borderColor: '#fff',\n borderDash: [],\n borderDashOffset: 0,\n borderJoinStyle: undefined,\n borderRadius: 0,\n borderWidth: 2,\n offset: 0,\n spacing: 0,\n angle: undefined,\n circular: true,\n };\n\n static defaultRoutes = {\n backgroundColor: 'backgroundColor'\n };\n\n static descriptors = {\n _scriptable: true,\n _indexable: (name) => name !== 'borderDash'\n };\n\n circumference: number;\n endAngle: number;\n fullCircles: number;\n innerRadius: number;\n outerRadius: number;\n pixelMargin: number;\n startAngle: number;\n\n constructor(cfg) {\n super();\n\n this.options = undefined;\n this.circumference = undefined;\n this.startAngle = undefined;\n this.endAngle = undefined;\n this.innerRadius = undefined;\n this.outerRadius = undefined;\n this.pixelMargin = 0;\n this.fullCircles = 0;\n\n if (cfg) {\n Object.assign(this, cfg);\n }\n }\n\n inRange(chartX: number, chartY: number, useFinalPosition: boolean) {\n const point = this.getProps(['x', 'y'], useFinalPosition);\n const {angle, distance} = getAngleFromPoint(point, {x: chartX, y: chartY});\n const {startAngle, endAngle, innerRadius, outerRadius, circumference} = this.getProps([\n 'startAngle',\n 'endAngle',\n 'innerRadius',\n 'outerRadius',\n 'circumference'\n ], useFinalPosition);\n const rAdjust = (this.options.spacing + this.options.borderWidth) / 2;\n const _circumference = valueOrDefault(circumference, endAngle - startAngle);\n const nonZeroBetween = _angleBetween(angle, startAngle, endAngle) && startAngle !== endAngle;\n const betweenAngles = _circumference >= TAU || nonZeroBetween;\n const withinRadius = _isBetween(distance, innerRadius + rAdjust, outerRadius + rAdjust);\n\n return (betweenAngles && withinRadius);\n }\n\n getCenterPoint(useFinalPosition: boolean) {\n const {x, y, startAngle, endAngle, innerRadius, outerRadius} = this.getProps([\n 'x',\n 'y',\n 'startAngle',\n 'endAngle',\n 'innerRadius',\n 'outerRadius'\n ], useFinalPosition);\n const {offset, spacing} = this.options;\n const halfAngle = (startAngle + endAngle) / 2;\n const halfRadius = (innerRadius + outerRadius + spacing + offset) / 2;\n return {\n x: x + Math.cos(halfAngle) * halfRadius,\n y: y + Math.sin(halfAngle) * halfRadius\n };\n }\n\n tooltipPosition(useFinalPosition: boolean) {\n return this.getCenterPoint(useFinalPosition);\n }\n\n draw(ctx: CanvasRenderingContext2D) {\n const {options, circumference} = this;\n const offset = (options.offset || 0) / 4;\n const spacing = (options.spacing || 0) / 2;\n const circular = options.circular;\n this.pixelMargin = (options.borderAlign === 'inner') ? 0.33 : 0;\n this.fullCircles = circumference > TAU ? Math.floor(circumference / TAU) : 0;\n\n if (circumference === 0 || this.innerRadius < 0 || this.outerRadius < 0) {\n return;\n }\n\n ctx.save();\n\n const halfAngle = (this.startAngle + this.endAngle) / 2;\n ctx.translate(Math.cos(halfAngle) * offset, Math.sin(halfAngle) * offset);\n const fix = 1 - Math.sin(Math.min(PI, circumference || 0));\n const radiusOffset = offset * fix;\n\n ctx.fillStyle = options.backgroundColor;\n ctx.strokeStyle = options.borderColor;\n\n drawArc(ctx, this, radiusOffset, spacing, circular);\n drawBorder(ctx, this, radiusOffset, spacing, circular);\n\n ctx.restore();\n }\n}\n", "import Element from '../core/core.element.js';\nimport {_bezierInterpolation, _pointInLine, _steppedInterpolation} from '../helpers/helpers.interpolation.js';\nimport {_computeSegments, _boundSegments} from '../helpers/helpers.segment.js';\nimport {_steppedLineTo, _bezierCurveTo} from '../helpers/helpers.canvas.js';\nimport {_updateBezierControlPoints} from '../helpers/helpers.curve.js';\nimport {valueOrDefault} from '../helpers/index.js';\n\n/**\n * @typedef { import('./element.point.js').default } PointElement\n */\n\nfunction setStyle(ctx, options, style = options) {\n ctx.lineCap = valueOrDefault(style.borderCapStyle, options.borderCapStyle);\n ctx.setLineDash(valueOrDefault(style.borderDash, options.borderDash));\n ctx.lineDashOffset = valueOrDefault(style.borderDashOffset, options.borderDashOffset);\n ctx.lineJoin = valueOrDefault(style.borderJoinStyle, options.borderJoinStyle);\n ctx.lineWidth = valueOrDefault(style.borderWidth, options.borderWidth);\n ctx.strokeStyle = valueOrDefault(style.borderColor, options.borderColor);\n}\n\nfunction lineTo(ctx, previous, target) {\n ctx.lineTo(target.x, target.y);\n}\n\n/**\n * @returns {any}\n */\nfunction getLineMethod(options) {\n if (options.stepped) {\n return _steppedLineTo;\n }\n\n if (options.tension || options.cubicInterpolationMode === 'monotone') {\n return _bezierCurveTo;\n }\n\n return lineTo;\n}\n\nfunction pathVars(points, segment, params = {}) {\n const count = points.length;\n const {start: paramsStart = 0, end: paramsEnd = count - 1} = params;\n const {start: segmentStart, end: segmentEnd} = segment;\n const start = Math.max(paramsStart, segmentStart);\n const end = Math.min(paramsEnd, segmentEnd);\n const outside = paramsStart < segmentStart && paramsEnd < segmentStart || paramsStart > segmentEnd && paramsEnd > segmentEnd;\n\n return {\n count,\n start,\n loop: segment.loop,\n ilen: end < start && !outside ? count + end - start : end - start\n };\n}\n\n/**\n * Create path from points, grouping by truncated x-coordinate\n * Points need to be in order by x-coordinate for this to work efficiently\n * @param {CanvasRenderingContext2D|Path2D} ctx - Context\n * @param {LineElement} line\n * @param {object} segment\n * @param {number} segment.start - start index of the segment, referring the points array\n * @param {number} segment.end - end index of the segment, referring the points array\n * @param {boolean} segment.loop - indicates that the segment is a loop\n * @param {object} params\n * @param {boolean} params.move - move to starting point (vs line to it)\n * @param {boolean} params.reverse - path the segment from end to start\n * @param {number} params.start - limit segment to points starting from `start` index\n * @param {number} params.end - limit segment to points ending at `start` + `count` index\n */\nfunction pathSegment(ctx, line, segment, params) {\n const {points, options} = line;\n const {count, start, loop, ilen} = pathVars(points, segment, params);\n const lineMethod = getLineMethod(options);\n // eslint-disable-next-line prefer-const\n let {move = true, reverse} = params || {};\n let i, point, prev;\n\n for (i = 0; i <= ilen; ++i) {\n point = points[(start + (reverse ? ilen - i : i)) % count];\n\n if (point.skip) {\n // If there is a skipped point inside a segment, spanGaps must be true\n continue;\n } else if (move) {\n ctx.moveTo(point.x, point.y);\n move = false;\n } else {\n lineMethod(ctx, prev, point, reverse, options.stepped);\n }\n\n prev = point;\n }\n\n if (loop) {\n point = points[(start + (reverse ? ilen : 0)) % count];\n lineMethod(ctx, prev, point, reverse, options.stepped);\n }\n\n return !!loop;\n}\n\n/**\n * Create path from points, grouping by truncated x-coordinate\n * Points need to be in order by x-coordinate for this to work efficiently\n * @param {CanvasRenderingContext2D|Path2D} ctx - Context\n * @param {LineElement} line\n * @param {object} segment\n * @param {number} segment.start - start index of the segment, referring the points array\n * @param {number} segment.end - end index of the segment, referring the points array\n * @param {boolean} segment.loop - indicates that the segment is a loop\n * @param {object} params\n * @param {boolean} params.move - move to starting point (vs line to it)\n * @param {boolean} params.reverse - path the segment from end to start\n * @param {number} params.start - limit segment to points starting from `start` index\n * @param {number} params.end - limit segment to points ending at `start` + `count` index\n */\nfunction fastPathSegment(ctx, line, segment, params) {\n const points = line.points;\n const {count, start, ilen} = pathVars(points, segment, params);\n const {move = true, reverse} = params || {};\n let avgX = 0;\n let countX = 0;\n let i, point, prevX, minY, maxY, lastY;\n\n const pointIndex = (index) => (start + (reverse ? ilen - index : index)) % count;\n const drawX = () => {\n if (minY !== maxY) {\n // Draw line to maxY and minY, using the average x-coordinate\n ctx.lineTo(avgX, maxY);\n ctx.lineTo(avgX, minY);\n // Line to y-value of last point in group. So the line continues\n // from correct position. Not using move, to have solid path.\n ctx.lineTo(avgX, lastY);\n }\n };\n\n if (move) {\n point = points[pointIndex(0)];\n ctx.moveTo(point.x, point.y);\n }\n\n for (i = 0; i <= ilen; ++i) {\n point = points[pointIndex(i)];\n\n if (point.skip) {\n // If there is a skipped point inside a segment, spanGaps must be true\n continue;\n }\n\n const x = point.x;\n const y = point.y;\n const truncX = x | 0; // truncated x-coordinate\n\n if (truncX === prevX) {\n // Determine `minY` / `maxY` and `avgX` while we stay within same x-position\n if (y < minY) {\n minY = y;\n } else if (y > maxY) {\n maxY = y;\n }\n // For first point in group, countX is `0`, so average will be `x` / 1.\n avgX = (countX * avgX + x) / ++countX;\n } else {\n drawX();\n // Draw line to next x-position, using the first (or only)\n // y-value in that group\n ctx.lineTo(x, y);\n\n prevX = truncX;\n countX = 0;\n minY = maxY = y;\n }\n // Keep track of the last y-value in group\n lastY = y;\n }\n drawX();\n}\n\n/**\n * @param {LineElement} line - the line\n * @returns {function}\n * @private\n */\nfunction _getSegmentMethod(line) {\n const opts = line.options;\n const borderDash = opts.borderDash && opts.borderDash.length;\n const useFastPath = !line._decimated && !line._loop && !opts.tension && opts.cubicInterpolationMode !== 'monotone' && !opts.stepped && !borderDash;\n return useFastPath ? fastPathSegment : pathSegment;\n}\n\n/**\n * @private\n */\nfunction _getInterpolationMethod(options) {\n if (options.stepped) {\n return _steppedInterpolation;\n }\n\n if (options.tension || options.cubicInterpolationMode === 'monotone') {\n return _bezierInterpolation;\n }\n\n return _pointInLine;\n}\n\nfunction strokePathWithCache(ctx, line, start, count) {\n let path = line._path;\n if (!path) {\n path = line._path = new Path2D();\n if (line.path(path, start, count)) {\n path.closePath();\n }\n }\n setStyle(ctx, line.options);\n ctx.stroke(path);\n}\n\nfunction strokePathDirect(ctx, line, start, count) {\n const {segments, options} = line;\n const segmentMethod = _getSegmentMethod(line);\n\n for (const segment of segments) {\n setStyle(ctx, options, segment.style);\n ctx.beginPath();\n if (segmentMethod(ctx, line, segment, {start, end: start + count - 1})) {\n ctx.closePath();\n }\n ctx.stroke();\n }\n}\n\nconst usePath2D = typeof Path2D === 'function';\n\nfunction draw(ctx, line, start, count) {\n if (usePath2D && !line.options.segment) {\n strokePathWithCache(ctx, line, start, count);\n } else {\n strokePathDirect(ctx, line, start, count);\n }\n}\n\nexport default class LineElement extends Element {\n\n static id = 'line';\n\n /**\n * @type {any}\n */\n static defaults = {\n borderCapStyle: 'butt',\n borderDash: [],\n borderDashOffset: 0,\n borderJoinStyle: 'miter',\n borderWidth: 3,\n capBezierPoints: true,\n cubicInterpolationMode: 'default',\n fill: false,\n spanGaps: false,\n stepped: false,\n tension: 0,\n };\n\n /**\n * @type {any}\n */\n static defaultRoutes = {\n backgroundColor: 'backgroundColor',\n borderColor: 'borderColor'\n };\n\n\n static descriptors = {\n _scriptable: true,\n _indexable: (name) => name !== 'borderDash' && name !== 'fill',\n };\n\n\n constructor(cfg) {\n super();\n\n this.animated = true;\n this.options = undefined;\n this._chart = undefined;\n this._loop = undefined;\n this._fullLoop = undefined;\n this._path = undefined;\n this._points = undefined;\n this._segments = undefined;\n this._decimated = false;\n this._pointsUpdated = false;\n this._datasetIndex = undefined;\n\n if (cfg) {\n Object.assign(this, cfg);\n }\n }\n\n updateControlPoints(chartArea, indexAxis) {\n const options = this.options;\n if ((options.tension || options.cubicInterpolationMode === 'monotone') && !options.stepped && !this._pointsUpdated) {\n const loop = options.spanGaps ? this._loop : this._fullLoop;\n _updateBezierControlPoints(this._points, options, chartArea, loop, indexAxis);\n this._pointsUpdated = true;\n }\n }\n\n set points(points) {\n this._points = points;\n delete this._segments;\n delete this._path;\n this._pointsUpdated = false;\n }\n\n get points() {\n return this._points;\n }\n\n get segments() {\n return this._segments || (this._segments = _computeSegments(this, this.options.segment));\n }\n\n /**\n\t * First non-skipped point on this line\n\t * @returns {PointElement|undefined}\n\t */\n first() {\n const segments = this.segments;\n const points = this.points;\n return segments.length && points[segments[0].start];\n }\n\n /**\n\t * Last non-skipped point on this line\n\t * @returns {PointElement|undefined}\n\t */\n last() {\n const segments = this.segments;\n const points = this.points;\n const count = segments.length;\n return count && points[segments[count - 1].end];\n }\n\n /**\n\t * Interpolate a point in this line at the same value on `property` as\n\t * the reference `point` provided\n\t * @param {PointElement} point - the reference point\n\t * @param {string} property - the property to match on\n\t * @returns {PointElement|undefined}\n\t */\n interpolate(point, property) {\n const options = this.options;\n const value = point[property];\n const points = this.points;\n const segments = _boundSegments(this, {property, start: value, end: value});\n\n if (!segments.length) {\n return;\n }\n\n const result = [];\n const _interpolate = _getInterpolationMethod(options);\n let i, ilen;\n for (i = 0, ilen = segments.length; i < ilen; ++i) {\n const {start, end} = segments[i];\n const p1 = points[start];\n const p2 = points[end];\n if (p1 === p2) {\n result.push(p1);\n continue;\n }\n const t = Math.abs((value - p1[property]) / (p2[property] - p1[property]));\n const interpolated = _interpolate(p1, p2, t, options.stepped);\n interpolated[property] = point[property];\n result.push(interpolated);\n }\n return result.length === 1 ? result[0] : result;\n }\n\n /**\n\t * Append a segment of this line to current path.\n\t * @param {CanvasRenderingContext2D} ctx\n\t * @param {object} segment\n\t * @param {number} segment.start - start index of the segment, referring the points array\n \t * @param {number} segment.end - end index of the segment, referring the points array\n \t * @param {boolean} segment.loop - indicates that the segment is a loop\n\t * @param {object} params\n\t * @param {boolean} params.move - move to starting point (vs line to it)\n\t * @param {boolean} params.reverse - path the segment from end to start\n\t * @param {number} params.start - limit segment to points starting from `start` index\n\t * @param {number} params.end - limit segment to points ending at `start` + `count` index\n\t * @returns {undefined|boolean} - true if the segment is a full loop (path should be closed)\n\t */\n pathSegment(ctx, segment, params) {\n const segmentMethod = _getSegmentMethod(this);\n return segmentMethod(ctx, this, segment, params);\n }\n\n /**\n\t * Append all segments of this line to current path.\n\t * @param {CanvasRenderingContext2D|Path2D} ctx\n\t * @param {number} [start]\n\t * @param {number} [count]\n\t * @returns {undefined|boolean} - true if line is a full loop (path should be closed)\n\t */\n path(ctx, start, count) {\n const segments = this.segments;\n const segmentMethod = _getSegmentMethod(this);\n let loop = this._loop;\n\n start = start || 0;\n count = count || (this.points.length - start);\n\n for (const segment of segments) {\n loop &= segmentMethod(ctx, this, segment, {start, end: start + count - 1});\n }\n return !!loop;\n }\n\n /**\n\t * Draw\n\t * @param {CanvasRenderingContext2D} ctx\n\t * @param {object} chartArea\n\t * @param {number} [start]\n\t * @param {number} [count]\n\t */\n draw(ctx, chartArea, start, count) {\n const options = this.options || {};\n const points = this.points || [];\n\n if (points.length && options.borderWidth) {\n ctx.save();\n\n draw(ctx, this, start, count);\n\n ctx.restore();\n }\n\n if (this.animated) {\n // When line is animated, the control points and path are not cached.\n this._pointsUpdated = false;\n this._path = undefined;\n }\n }\n}\n", "import Element from '../core/core.element.js';\nimport {drawPoint, _isPointInArea} from '../helpers/helpers.canvas.js';\nimport type {\n CartesianParsedData,\n ChartArea,\n Point,\n PointHoverOptions,\n PointOptions,\n} from '../types/index.js';\n\nfunction inRange(el: PointElement, pos: number, axis: 'x' | 'y', useFinalPosition?: boolean) {\n const options = el.options;\n const {[axis]: value} = el.getProps([axis], useFinalPosition);\n\n return (Math.abs(pos - value) < options.radius + options.hitRadius);\n}\n\nexport type PointProps = Point\n\nexport default class PointElement extends Element {\n\n static id = 'point';\n\n parsed: CartesianParsedData;\n skip?: boolean;\n stop?: boolean;\n\n /**\n * @type {any}\n */\n static defaults = {\n borderWidth: 1,\n hitRadius: 1,\n hoverBorderWidth: 1,\n hoverRadius: 4,\n pointStyle: 'circle',\n radius: 3,\n rotation: 0\n };\n\n /**\n * @type {any}\n */\n static defaultRoutes = {\n backgroundColor: 'backgroundColor',\n borderColor: 'borderColor'\n };\n\n constructor(cfg) {\n super();\n\n this.options = undefined;\n this.parsed = undefined;\n this.skip = undefined;\n this.stop = undefined;\n\n if (cfg) {\n Object.assign(this, cfg);\n }\n }\n\n inRange(mouseX: number, mouseY: number, useFinalPosition?: boolean) {\n const options = this.options;\n const {x, y} = this.getProps(['x', 'y'], useFinalPosition);\n return ((Math.pow(mouseX - x, 2) + Math.pow(mouseY - y, 2)) < Math.pow(options.hitRadius + options.radius, 2));\n }\n\n inXRange(mouseX: number, useFinalPosition?: boolean) {\n return inRange(this, mouseX, 'x', useFinalPosition);\n }\n\n inYRange(mouseY: number, useFinalPosition?: boolean) {\n return inRange(this, mouseY, 'y', useFinalPosition);\n }\n\n getCenterPoint(useFinalPosition?: boolean) {\n const {x, y} = this.getProps(['x', 'y'], useFinalPosition);\n return {x, y};\n }\n\n size(options?: Partial) {\n options = options || this.options || {};\n let radius = options.radius || 0;\n radius = Math.max(radius, radius && options.hoverRadius || 0);\n const borderWidth = radius && options.borderWidth || 0;\n return (radius + borderWidth) * 2;\n }\n\n draw(ctx: CanvasRenderingContext2D, area: ChartArea) {\n const options = this.options;\n\n if (this.skip || options.radius < 0.1 || !_isPointInArea(this, area, this.size(options) / 2)) {\n return;\n }\n\n ctx.strokeStyle = options.borderColor;\n ctx.lineWidth = options.borderWidth;\n ctx.fillStyle = options.backgroundColor;\n drawPoint(ctx, options, this.x, this.y);\n }\n\n getRange() {\n const options = this.options || {};\n // @ts-expect-error Fallbacks should never be hit in practice\n return options.radius + options.hitRadius;\n }\n}\n", "import Element from '../core/core.element.js';\nimport {isObject, _isBetween, _limitValue} from '../helpers/index.js';\nimport {addRoundedRectPath} from '../helpers/helpers.canvas.js';\nimport {toTRBL, toTRBLCorners} from '../helpers/helpers.options.js';\n\n/** @typedef {{ x: number, y: number, base: number, horizontal: boolean, width: number, height: number }} BarProps */\n\n/**\n * Helper function to get the bounds of the bar regardless of the orientation\n * @param {BarElement} bar the bar\n * @param {boolean} [useFinalPosition]\n * @return {object} bounds of the bar\n * @private\n */\nfunction getBarBounds(bar, useFinalPosition) {\n const {x, y, base, width, height} = /** @type {BarProps} */ (bar.getProps(['x', 'y', 'base', 'width', 'height'], useFinalPosition));\n\n let left, right, top, bottom, half;\n\n if (bar.horizontal) {\n half = height / 2;\n left = Math.min(x, base);\n right = Math.max(x, base);\n top = y - half;\n bottom = y + half;\n } else {\n half = width / 2;\n left = x - half;\n right = x + half;\n top = Math.min(y, base);\n bottom = Math.max(y, base);\n }\n\n return {left, top, right, bottom};\n}\n\nfunction skipOrLimit(skip, value, min, max) {\n return skip ? 0 : _limitValue(value, min, max);\n}\n\nfunction parseBorderWidth(bar, maxW, maxH) {\n const value = bar.options.borderWidth;\n const skip = bar.borderSkipped;\n const o = toTRBL(value);\n\n return {\n t: skipOrLimit(skip.top, o.top, 0, maxH),\n r: skipOrLimit(skip.right, o.right, 0, maxW),\n b: skipOrLimit(skip.bottom, o.bottom, 0, maxH),\n l: skipOrLimit(skip.left, o.left, 0, maxW)\n };\n}\n\nfunction parseBorderRadius(bar, maxW, maxH) {\n const {enableBorderRadius} = bar.getProps(['enableBorderRadius']);\n const value = bar.options.borderRadius;\n const o = toTRBLCorners(value);\n const maxR = Math.min(maxW, maxH);\n const skip = bar.borderSkipped;\n\n // If the value is an object, assume the user knows what they are doing\n // and apply as directed.\n const enableBorder = enableBorderRadius || isObject(value);\n\n return {\n topLeft: skipOrLimit(!enableBorder || skip.top || skip.left, o.topLeft, 0, maxR),\n topRight: skipOrLimit(!enableBorder || skip.top || skip.right, o.topRight, 0, maxR),\n bottomLeft: skipOrLimit(!enableBorder || skip.bottom || skip.left, o.bottomLeft, 0, maxR),\n bottomRight: skipOrLimit(!enableBorder || skip.bottom || skip.right, o.bottomRight, 0, maxR)\n };\n}\n\nfunction boundingRects(bar) {\n const bounds = getBarBounds(bar);\n const width = bounds.right - bounds.left;\n const height = bounds.bottom - bounds.top;\n const border = parseBorderWidth(bar, width / 2, height / 2);\n const radius = parseBorderRadius(bar, width / 2, height / 2);\n\n return {\n outer: {\n x: bounds.left,\n y: bounds.top,\n w: width,\n h: height,\n radius\n },\n inner: {\n x: bounds.left + border.l,\n y: bounds.top + border.t,\n w: width - border.l - border.r,\n h: height - border.t - border.b,\n radius: {\n topLeft: Math.max(0, radius.topLeft - Math.max(border.t, border.l)),\n topRight: Math.max(0, radius.topRight - Math.max(border.t, border.r)),\n bottomLeft: Math.max(0, radius.bottomLeft - Math.max(border.b, border.l)),\n bottomRight: Math.max(0, radius.bottomRight - Math.max(border.b, border.r)),\n }\n }\n };\n}\n\nfunction inRange(bar, x, y, useFinalPosition) {\n const skipX = x === null;\n const skipY = y === null;\n const skipBoth = skipX && skipY;\n const bounds = bar && !skipBoth && getBarBounds(bar, useFinalPosition);\n\n return bounds\n\t\t&& (skipX || _isBetween(x, bounds.left, bounds.right))\n\t\t&& (skipY || _isBetween(y, bounds.top, bounds.bottom));\n}\n\nfunction hasRadius(radius) {\n return radius.topLeft || radius.topRight || radius.bottomLeft || radius.bottomRight;\n}\n\n/**\n * Add a path of a rectangle to the current sub-path\n * @param {CanvasRenderingContext2D} ctx Context\n * @param {*} rect Bounding rect\n */\nfunction addNormalRectPath(ctx, rect) {\n ctx.rect(rect.x, rect.y, rect.w, rect.h);\n}\n\nfunction inflateRect(rect, amount, refRect = {}) {\n const x = rect.x !== refRect.x ? -amount : 0;\n const y = rect.y !== refRect.y ? -amount : 0;\n const w = (rect.x + rect.w !== refRect.x + refRect.w ? amount : 0) - x;\n const h = (rect.y + rect.h !== refRect.y + refRect.h ? amount : 0) - y;\n return {\n x: rect.x + x,\n y: rect.y + y,\n w: rect.w + w,\n h: rect.h + h,\n radius: rect.radius\n };\n}\n\nexport default class BarElement extends Element {\n\n static id = 'bar';\n\n /**\n * @type {any}\n */\n static defaults = {\n borderSkipped: 'start',\n borderWidth: 0,\n borderRadius: 0,\n inflateAmount: 'auto',\n pointStyle: undefined\n };\n\n /**\n * @type {any}\n */\n static defaultRoutes = {\n backgroundColor: 'backgroundColor',\n borderColor: 'borderColor'\n };\n\n constructor(cfg) {\n super();\n\n this.options = undefined;\n this.horizontal = undefined;\n this.base = undefined;\n this.width = undefined;\n this.height = undefined;\n this.inflateAmount = undefined;\n\n if (cfg) {\n Object.assign(this, cfg);\n }\n }\n\n draw(ctx) {\n const {inflateAmount, options: {borderColor, backgroundColor}} = this;\n const {inner, outer} = boundingRects(this);\n const addRectPath = hasRadius(outer.radius) ? addRoundedRectPath : addNormalRectPath;\n\n ctx.save();\n\n if (outer.w !== inner.w || outer.h !== inner.h) {\n ctx.beginPath();\n addRectPath(ctx, inflateRect(outer, inflateAmount, inner));\n ctx.clip();\n addRectPath(ctx, inflateRect(inner, -inflateAmount, outer));\n ctx.fillStyle = borderColor;\n ctx.fill('evenodd');\n }\n\n ctx.beginPath();\n addRectPath(ctx, inflateRect(inner, inflateAmount));\n ctx.fillStyle = backgroundColor;\n ctx.fill();\n\n ctx.restore();\n }\n\n inRange(mouseX, mouseY, useFinalPosition) {\n return inRange(this, mouseX, mouseY, useFinalPosition);\n }\n\n inXRange(mouseX, useFinalPosition) {\n return inRange(this, mouseX, null, useFinalPosition);\n }\n\n inYRange(mouseY, useFinalPosition) {\n return inRange(this, null, mouseY, useFinalPosition);\n }\n\n getCenterPoint(useFinalPosition) {\n const {x, y, base, horizontal} = /** @type {BarProps} */ (this.getProps(['x', 'y', 'base', 'horizontal'], useFinalPosition));\n return {\n x: horizontal ? (x + base) / 2 : x,\n y: horizontal ? y : (y + base) / 2\n };\n }\n\n getRange(axis) {\n return axis === 'x' ? this.width / 2 : this.height / 2;\n }\n}\n", "import {DoughnutController, PolarAreaController, defaults} from '../index.js';\nimport type {Chart, ChartDataset} from '../types.js';\n\nexport interface ColorsPluginOptions {\n enabled?: boolean;\n forceOverride?: boolean;\n}\n\ninterface ColorsDescriptor {\n backgroundColor?: unknown;\n borderColor?: unknown;\n}\n\nconst BORDER_COLORS = [\n 'rgb(54, 162, 235)', // blue\n 'rgb(255, 99, 132)', // red\n 'rgb(255, 159, 64)', // orange\n 'rgb(255, 205, 86)', // yellow\n 'rgb(75, 192, 192)', // green\n 'rgb(153, 102, 255)', // purple\n 'rgb(201, 203, 207)' // grey\n];\n\n// Border colors with 50% transparency\nconst BACKGROUND_COLORS = /* #__PURE__ */ BORDER_COLORS.map(color => color.replace('rgb(', 'rgba(').replace(')', ', 0.5)'));\n\nfunction getBorderColor(i: number) {\n return BORDER_COLORS[i % BORDER_COLORS.length];\n}\n\nfunction getBackgroundColor(i: number) {\n return BACKGROUND_COLORS[i % BACKGROUND_COLORS.length];\n}\n\nfunction colorizeDefaultDataset(dataset: ChartDataset, i: number) {\n dataset.borderColor = getBorderColor(i);\n dataset.backgroundColor = getBackgroundColor(i);\n\n return ++i;\n}\n\nfunction colorizeDoughnutDataset(dataset: ChartDataset, i: number) {\n dataset.backgroundColor = dataset.data.map(() => getBorderColor(i++));\n\n return i;\n}\n\nfunction colorizePolarAreaDataset(dataset: ChartDataset, i: number) {\n dataset.backgroundColor = dataset.data.map(() => getBackgroundColor(i++));\n\n return i;\n}\n\nfunction getColorizer(chart: Chart) {\n let i = 0;\n\n return (dataset: ChartDataset, datasetIndex: number) => {\n const controller = chart.getDatasetMeta(datasetIndex).controller;\n\n if (controller instanceof DoughnutController) {\n i = colorizeDoughnutDataset(dataset, i);\n } else if (controller instanceof PolarAreaController) {\n i = colorizePolarAreaDataset(dataset, i);\n } else if (controller) {\n i = colorizeDefaultDataset(dataset, i);\n }\n };\n}\n\nfunction containsColorsDefinitions(\n descriptors: ColorsDescriptor[] | Record\n) {\n let k: number | string;\n\n for (k in descriptors) {\n if (descriptors[k].borderColor || descriptors[k].backgroundColor) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction containsColorsDefinition(\n descriptor: ColorsDescriptor\n) {\n return descriptor && (descriptor.borderColor || descriptor.backgroundColor);\n}\n\nfunction containsDefaultColorsDefenitions() {\n return defaults.borderColor !== 'rgba(0,0,0,0.1)' || defaults.backgroundColor !== 'rgba(0,0,0,0.1)';\n}\n\nexport default {\n id: 'colors',\n\n defaults: {\n enabled: true,\n forceOverride: false\n } as ColorsPluginOptions,\n\n beforeLayout(chart: Chart, _args, options: ColorsPluginOptions) {\n if (!options.enabled) {\n return;\n }\n\n const {\n data: {datasets},\n options: chartOptions\n } = chart.config;\n const {elements} = chartOptions;\n\n const containsColorDefenition = (\n containsColorsDefinitions(datasets) ||\n containsColorsDefinition(chartOptions) ||\n (elements && containsColorsDefinitions(elements)) ||\n containsDefaultColorsDefenitions());\n\n if (!options.forceOverride && containsColorDefenition) {\n return;\n }\n\n const colorizer = getColorizer(chart);\n\n datasets.forEach(colorizer);\n }\n};\n", "import {_limitValue, _lookupByKey, isNullOrUndef, resolve} from '../helpers/index.js';\n\nfunction lttbDecimation(data, start, count, availableWidth, options) {\n /**\n * Implementation of the Largest Triangle Three Buckets algorithm.\n *\n * This implementation is based on the original implementation by Sveinn Steinarsson\n * in https://github.com/sveinn-steinarsson/flot-downsample/blob/master/jquery.flot.downsample.js\n *\n * The original implementation is MIT licensed.\n */\n const samples = options.samples || availableWidth;\n // There are less points than the threshold, returning the whole array\n if (samples >= count) {\n return data.slice(start, start + count);\n }\n\n const decimated = [];\n\n const bucketWidth = (count - 2) / (samples - 2);\n let sampledIndex = 0;\n const endIndex = start + count - 1;\n // Starting from offset\n let a = start;\n let i, maxAreaPoint, maxArea, area, nextA;\n\n decimated[sampledIndex++] = data[a];\n\n for (i = 0; i < samples - 2; i++) {\n let avgX = 0;\n let avgY = 0;\n let j;\n\n // Adding offset\n const avgRangeStart = Math.floor((i + 1) * bucketWidth) + 1 + start;\n const avgRangeEnd = Math.min(Math.floor((i + 2) * bucketWidth) + 1, count) + start;\n const avgRangeLength = avgRangeEnd - avgRangeStart;\n\n for (j = avgRangeStart; j < avgRangeEnd; j++) {\n avgX += data[j].x;\n avgY += data[j].y;\n }\n\n avgX /= avgRangeLength;\n avgY /= avgRangeLength;\n\n // Adding offset\n const rangeOffs = Math.floor(i * bucketWidth) + 1 + start;\n const rangeTo = Math.min(Math.floor((i + 1) * bucketWidth) + 1, count) + start;\n const {x: pointAx, y: pointAy} = data[a];\n\n // Note that this is changed from the original algorithm which initializes these\n // values to 1. The reason for this change is that if the area is small, nextA\n // would never be set and thus a crash would occur in the next loop as `a` would become\n // `undefined`. Since the area is always positive, but could be 0 in the case of a flat trace,\n // initializing with a negative number is the correct solution.\n maxArea = area = -1;\n\n for (j = rangeOffs; j < rangeTo; j++) {\n area = 0.5 * Math.abs(\n (pointAx - avgX) * (data[j].y - pointAy) -\n (pointAx - data[j].x) * (avgY - pointAy)\n );\n\n if (area > maxArea) {\n maxArea = area;\n maxAreaPoint = data[j];\n nextA = j;\n }\n }\n\n decimated[sampledIndex++] = maxAreaPoint;\n a = nextA;\n }\n\n // Include the last point\n decimated[sampledIndex++] = data[endIndex];\n\n return decimated;\n}\n\nfunction minMaxDecimation(data, start, count, availableWidth) {\n let avgX = 0;\n let countX = 0;\n let i, point, x, y, prevX, minIndex, maxIndex, startIndex, minY, maxY;\n const decimated = [];\n const endIndex = start + count - 1;\n\n const xMin = data[start].x;\n const xMax = data[endIndex].x;\n const dx = xMax - xMin;\n\n for (i = start; i < start + count; ++i) {\n point = data[i];\n x = (point.x - xMin) / dx * availableWidth;\n y = point.y;\n const truncX = x | 0;\n\n if (truncX === prevX) {\n // Determine `minY` / `maxY` and `avgX` while we stay within same x-position\n if (y < minY) {\n minY = y;\n minIndex = i;\n } else if (y > maxY) {\n maxY = y;\n maxIndex = i;\n }\n // For first point in group, countX is `0`, so average will be `x` / 1.\n // Use point.x here because we're computing the average data `x` value\n avgX = (countX * avgX + point.x) / ++countX;\n } else {\n // Push up to 4 points, 3 for the last interval and the first point for this interval\n const lastIndex = i - 1;\n\n if (!isNullOrUndef(minIndex) && !isNullOrUndef(maxIndex)) {\n // The interval is defined by 4 points: start, min, max, end.\n // The starting point is already considered at this point, so we need to determine which\n // of the other points to add. We need to sort these points to ensure the decimated data\n // is still sorted and then ensure there are no duplicates.\n const intermediateIndex1 = Math.min(minIndex, maxIndex);\n const intermediateIndex2 = Math.max(minIndex, maxIndex);\n\n if (intermediateIndex1 !== startIndex && intermediateIndex1 !== lastIndex) {\n decimated.push({\n ...data[intermediateIndex1],\n x: avgX,\n });\n }\n if (intermediateIndex2 !== startIndex && intermediateIndex2 !== lastIndex) {\n decimated.push({\n ...data[intermediateIndex2],\n x: avgX\n });\n }\n }\n\n // lastIndex === startIndex will occur when a range has only 1 point which could\n // happen with very uneven data\n if (i > 0 && lastIndex !== startIndex) {\n // Last point in the previous interval\n decimated.push(data[lastIndex]);\n }\n\n // Start of the new interval\n decimated.push(point);\n prevX = truncX;\n countX = 0;\n minY = maxY = y;\n minIndex = maxIndex = startIndex = i;\n }\n }\n\n return decimated;\n}\n\nfunction cleanDecimatedDataset(dataset) {\n if (dataset._decimated) {\n const data = dataset._data;\n delete dataset._decimated;\n delete dataset._data;\n Object.defineProperty(dataset, 'data', {\n configurable: true,\n enumerable: true,\n writable: true,\n value: data,\n });\n }\n}\n\nfunction cleanDecimatedData(chart) {\n chart.data.datasets.forEach((dataset) => {\n cleanDecimatedDataset(dataset);\n });\n}\n\nfunction getStartAndCountOfVisiblePointsSimplified(meta, points) {\n const pointCount = points.length;\n\n let start = 0;\n let count;\n\n const {iScale} = meta;\n const {min, max, minDefined, maxDefined} = iScale.getUserBounds();\n\n if (minDefined) {\n start = _limitValue(_lookupByKey(points, iScale.axis, min).lo, 0, pointCount - 1);\n }\n if (maxDefined) {\n count = _limitValue(_lookupByKey(points, iScale.axis, max).hi + 1, start, pointCount) - start;\n } else {\n count = pointCount - start;\n }\n\n return {start, count};\n}\n\nexport default {\n id: 'decimation',\n\n defaults: {\n algorithm: 'min-max',\n enabled: false,\n },\n\n beforeElementsUpdate: (chart, args, options) => {\n if (!options.enabled) {\n // The decimation plugin may have been previously enabled. Need to remove old `dataset._data` handlers\n cleanDecimatedData(chart);\n return;\n }\n\n // Assume the entire chart is available to show a few more points than needed\n const availableWidth = chart.width;\n\n chart.data.datasets.forEach((dataset, datasetIndex) => {\n const {_data, indexAxis} = dataset;\n const meta = chart.getDatasetMeta(datasetIndex);\n const data = _data || dataset.data;\n\n if (resolve([indexAxis, chart.options.indexAxis]) === 'y') {\n // Decimation is only supported for lines that have an X indexAxis\n return;\n }\n\n if (!meta.controller.supportsDecimation) {\n // Only line datasets are supported\n return;\n }\n\n const xAxis = chart.scales[meta.xAxisID];\n if (xAxis.type !== 'linear' && xAxis.type !== 'time') {\n // Only linear interpolation is supported\n return;\n }\n\n if (chart.options.parsing) {\n // Plugin only supports data that does not need parsing\n return;\n }\n\n let {start, count} = getStartAndCountOfVisiblePointsSimplified(meta, data);\n const threshold = options.threshold || 4 * availableWidth;\n if (count <= threshold) {\n // No decimation is required until we are above this threshold\n cleanDecimatedDataset(dataset);\n return;\n }\n\n if (isNullOrUndef(_data)) {\n // First time we are seeing this dataset\n // We override the 'data' property with a setter that stores the\n // raw data in _data, but reads the decimated data from _decimated\n dataset._data = data;\n delete dataset.data;\n Object.defineProperty(dataset, 'data', {\n configurable: true,\n enumerable: true,\n get: function() {\n return this._decimated;\n },\n set: function(d) {\n this._data = d;\n }\n });\n }\n\n // Point the chart to the decimated data\n let decimated;\n switch (options.algorithm) {\n case 'lttb':\n decimated = lttbDecimation(data, start, count, availableWidth, options);\n break;\n case 'min-max':\n decimated = minMaxDecimation(data, start, count, availableWidth);\n break;\n default:\n throw new Error(`Unsupported decimation algorithm '${options.algorithm}'`);\n }\n\n dataset._decimated = decimated;\n });\n },\n\n destroy(chart) {\n cleanDecimatedData(chart);\n }\n};\n", "import {_boundSegment, _boundSegments, _normalizeAngle} from '../../helpers/index.js';\n\nexport function _segments(line, target, property) {\n const segments = line.segments;\n const points = line.points;\n const tpoints = target.points;\n const parts = [];\n\n for (const segment of segments) {\n let {start, end} = segment;\n end = _findSegmentEnd(start, end, points);\n\n const bounds = _getBounds(property, points[start], points[end], segment.loop);\n\n if (!target.segments) {\n // Special case for boundary not supporting `segments` (simpleArc)\n // Bounds are provided as `target` for partial circle, or undefined for full circle\n parts.push({\n source: segment,\n target: bounds,\n start: points[start],\n end: points[end]\n });\n continue;\n }\n\n // Get all segments from `target` that intersect the bounds of current segment of `line`\n const targetSegments = _boundSegments(target, bounds);\n\n for (const tgt of targetSegments) {\n const subBounds = _getBounds(property, tpoints[tgt.start], tpoints[tgt.end], tgt.loop);\n const fillSources = _boundSegment(segment, points, subBounds);\n\n for (const fillSource of fillSources) {\n parts.push({\n source: fillSource,\n target: tgt,\n start: {\n [property]: _getEdge(bounds, subBounds, 'start', Math.max)\n },\n end: {\n [property]: _getEdge(bounds, subBounds, 'end', Math.min)\n }\n });\n }\n }\n }\n return parts;\n}\n\nexport function _getBounds(property, first, last, loop) {\n if (loop) {\n return;\n }\n let start = first[property];\n let end = last[property];\n\n if (property === 'angle') {\n start = _normalizeAngle(start);\n end = _normalizeAngle(end);\n }\n return {property, start, end};\n}\n\nexport function _pointsFromSegments(boundary, line) {\n const {x = null, y = null} = boundary || {};\n const linePoints = line.points;\n const points = [];\n line.segments.forEach(({start, end}) => {\n end = _findSegmentEnd(start, end, linePoints);\n const first = linePoints[start];\n const last = linePoints[end];\n if (y !== null) {\n points.push({x: first.x, y});\n points.push({x: last.x, y});\n } else if (x !== null) {\n points.push({x, y: first.y});\n points.push({x, y: last.y});\n }\n });\n return points;\n}\n\nexport function _findSegmentEnd(start, end, points) {\n for (;end > start; end--) {\n const point = points[end];\n if (!isNaN(point.x) && !isNaN(point.y)) {\n break;\n }\n }\n return end;\n}\n\nfunction _getEdge(a, b, prop, fn) {\n if (a && b) {\n return fn(a[prop], b[prop]);\n }\n return a ? a[prop] : b ? b[prop] : 0;\n}\n", "/**\n * @typedef { import('../../core/core.controller.js').default } Chart\n * @typedef { import('../../core/core.scale.js').default } Scale\n * @typedef { import('../../elements/element.point.js').default } PointElement\n */\n\nimport {LineElement} from '../../elements/index.js';\nimport {isArray} from '../../helpers/index.js';\nimport {_pointsFromSegments} from './filler.segment.js';\n\n/**\n * @param {PointElement[] | { x: number; y: number; }} boundary\n * @param {LineElement} line\n * @return {LineElement?}\n */\nexport function _createBoundaryLine(boundary, line) {\n let points = [];\n let _loop = false;\n\n if (isArray(boundary)) {\n _loop = true;\n // @ts-ignore\n points = boundary;\n } else {\n points = _pointsFromSegments(boundary, line);\n }\n\n return points.length ? new LineElement({\n points,\n options: {tension: 0},\n _loop,\n _fullLoop: _loop\n }) : null;\n}\n\nexport function _shouldApplyFill(source) {\n return source && source.fill !== false;\n}\n", "import {isObject, isFinite, valueOrDefault} from '../../helpers/helpers.core.js';\n\n/**\n * @typedef { import('../../core/core.scale.js').default } Scale\n * @typedef { import('../../elements/element.line.js').default } LineElement\n * @typedef { import('../../types/index.js').FillTarget } FillTarget\n * @typedef { import('../../types/index.js').ComplexFillTarget } ComplexFillTarget\n */\n\nexport function _resolveTarget(sources, index, propagate) {\n const source = sources[index];\n let fill = source.fill;\n const visited = [index];\n let target;\n\n if (!propagate) {\n return fill;\n }\n\n while (fill !== false && visited.indexOf(fill) === -1) {\n if (!isFinite(fill)) {\n return fill;\n }\n\n target = sources[fill];\n if (!target) {\n return false;\n }\n\n if (target.visible) {\n return fill;\n }\n\n visited.push(fill);\n fill = target.fill;\n }\n\n return false;\n}\n\n/**\n * @param {LineElement} line\n * @param {number} index\n * @param {number} count\n */\nexport function _decodeFill(line, index, count) {\n /** @type {string | {value: number}} */\n const fill = parseFillOption(line);\n\n if (isObject(fill)) {\n return isNaN(fill.value) ? false : fill;\n }\n\n let target = parseFloat(fill);\n\n if (isFinite(target) && Math.floor(target) === target) {\n return decodeTargetIndex(fill[0], index, target, count);\n }\n\n return ['origin', 'start', 'end', 'stack', 'shape'].indexOf(fill) >= 0 && fill;\n}\n\nfunction decodeTargetIndex(firstCh, index, target, count) {\n if (firstCh === '-' || firstCh === '+') {\n target = index + target;\n }\n\n if (target === index || target < 0 || target >= count) {\n return false;\n }\n\n return target;\n}\n\n/**\n * @param {FillTarget | ComplexFillTarget} fill\n * @param {Scale} scale\n * @returns {number | null}\n */\nexport function _getTargetPixel(fill, scale) {\n let pixel = null;\n if (fill === 'start') {\n pixel = scale.bottom;\n } else if (fill === 'end') {\n pixel = scale.top;\n } else if (isObject(fill)) {\n // @ts-ignore\n pixel = scale.getPixelForValue(fill.value);\n } else if (scale.getBasePixel) {\n pixel = scale.getBasePixel();\n }\n return pixel;\n}\n\n/**\n * @param {FillTarget | ComplexFillTarget} fill\n * @param {Scale} scale\n * @param {number} startValue\n * @returns {number | undefined}\n */\nexport function _getTargetValue(fill, scale, startValue) {\n let value;\n\n if (fill === 'start') {\n value = startValue;\n } else if (fill === 'end') {\n value = scale.options.reverse ? scale.min : scale.max;\n } else if (isObject(fill)) {\n // @ts-ignore\n value = fill.value;\n } else {\n value = scale.getBaseValue();\n }\n return value;\n}\n\n/**\n * @param {LineElement} line\n */\nfunction parseFillOption(line) {\n const options = line.options;\n const fillOption = options.fill;\n let fill = valueOrDefault(fillOption && fillOption.target, fillOption);\n\n if (fill === undefined) {\n fill = !!options.backgroundColor;\n }\n\n if (fill === false || fill === null) {\n return false;\n }\n\n if (fill === true) {\n return 'origin';\n }\n return fill;\n}\n", "/**\n * @typedef { import('../../core/core.controller.js').default } Chart\n * @typedef { import('../../core/core.scale.js').default } Scale\n * @typedef { import('../../elements/element.point.js').default } PointElement\n */\n\nimport {LineElement} from '../../elements/index.js';\nimport {_isBetween} from '../../helpers/index.js';\nimport {_createBoundaryLine} from './filler.helper.js';\n\n/**\n * @param {{ chart: Chart; scale: Scale; index: number; line: LineElement; }} source\n * @return {LineElement}\n */\nexport function _buildStackLine(source) {\n const {scale, index, line} = source;\n const points = [];\n const segments = line.segments;\n const sourcePoints = line.points;\n const linesBelow = getLinesBelow(scale, index);\n linesBelow.push(_createBoundaryLine({x: null, y: scale.bottom}, line));\n\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n for (let j = segment.start; j <= segment.end; j++) {\n addPointsBelow(points, sourcePoints[j], linesBelow);\n }\n }\n return new LineElement({points, options: {}});\n}\n\n/**\n * @param {Scale} scale\n * @param {number} index\n * @return {LineElement[]}\n */\nfunction getLinesBelow(scale, index) {\n const below = [];\n const metas = scale.getMatchingVisibleMetas('line');\n\n for (let i = 0; i < metas.length; i++) {\n const meta = metas[i];\n if (meta.index === index) {\n break;\n }\n if (!meta.hidden) {\n below.unshift(meta.dataset);\n }\n }\n return below;\n}\n\n/**\n * @param {PointElement[]} points\n * @param {PointElement} sourcePoint\n * @param {LineElement[]} linesBelow\n */\nfunction addPointsBelow(points, sourcePoint, linesBelow) {\n const postponed = [];\n for (let j = 0; j < linesBelow.length; j++) {\n const line = linesBelow[j];\n const {first, last, point} = findPoint(line, sourcePoint, 'x');\n\n if (!point || (first && last)) {\n continue;\n }\n if (first) {\n // First point of an segment -> need to add another point before this,\n // from next line below.\n postponed.unshift(point);\n } else {\n points.push(point);\n if (!last) {\n // In the middle of an segment, no need to add more points.\n break;\n }\n }\n }\n points.push(...postponed);\n}\n\n/**\n * @param {LineElement} line\n * @param {PointElement} sourcePoint\n * @param {string} property\n * @returns {{point?: PointElement, first?: boolean, last?: boolean}}\n */\nfunction findPoint(line, sourcePoint, property) {\n const point = line.interpolate(sourcePoint, property);\n if (!point) {\n return {};\n }\n\n const pointValue = point[property];\n const segments = line.segments;\n const linePoints = line.points;\n let first = false;\n let last = false;\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n const firstValue = linePoints[segment.start][property];\n const lastValue = linePoints[segment.end][property];\n if (_isBetween(pointValue, firstValue, lastValue)) {\n first = pointValue === firstValue;\n last = pointValue === lastValue;\n break;\n }\n }\n return {first, last, point};\n}\n", "import {TAU} from '../../helpers/index.js';\n\n// TODO: use elements.ArcElement instead\nexport class simpleArc {\n constructor(opts) {\n this.x = opts.x;\n this.y = opts.y;\n this.radius = opts.radius;\n }\n\n pathSegment(ctx, bounds, opts) {\n const {x, y, radius} = this;\n bounds = bounds || {start: 0, end: TAU};\n ctx.arc(x, y, radius, bounds.end, bounds.start, true);\n return !opts.bounds;\n }\n\n interpolate(point) {\n const {x, y, radius} = this;\n const angle = point.angle;\n return {\n x: x + Math.cos(angle) * radius,\n y: y + Math.sin(angle) * radius,\n angle\n };\n }\n}\n", "import {isFinite} from '../../helpers/index.js';\nimport {_createBoundaryLine} from './filler.helper.js';\nimport {_getTargetPixel, _getTargetValue} from './filler.options.js';\nimport {_buildStackLine} from './filler.target.stack.js';\nimport {simpleArc} from './simpleArc.js';\n\n/**\n * @typedef { import('../../core/core.controller.js').default } Chart\n * @typedef { import('../../core/core.scale.js').default } Scale\n * @typedef { import('../../elements/element.point.js').default } PointElement\n */\n\nexport function _getTarget(source) {\n const {chart, fill, line} = source;\n\n if (isFinite(fill)) {\n return getLineByIndex(chart, fill);\n }\n\n if (fill === 'stack') {\n return _buildStackLine(source);\n }\n\n if (fill === 'shape') {\n return true;\n }\n\n const boundary = computeBoundary(source);\n\n if (boundary instanceof simpleArc) {\n return boundary;\n }\n\n return _createBoundaryLine(boundary, line);\n}\n\n/**\n * @param {Chart} chart\n * @param {number} index\n */\nfunction getLineByIndex(chart, index) {\n const meta = chart.getDatasetMeta(index);\n const visible = meta && chart.isDatasetVisible(index);\n return visible ? meta.dataset : null;\n}\n\nfunction computeBoundary(source) {\n const scale = source.scale || {};\n\n if (scale.getPointPositionForValue) {\n return computeCircularBoundary(source);\n }\n return computeLinearBoundary(source);\n}\n\n\nfunction computeLinearBoundary(source) {\n const {scale = {}, fill} = source;\n const pixel = _getTargetPixel(fill, scale);\n\n if (isFinite(pixel)) {\n const horizontal = scale.isHorizontal();\n\n return {\n x: horizontal ? pixel : null,\n y: horizontal ? null : pixel\n };\n }\n\n return null;\n}\n\nfunction computeCircularBoundary(source) {\n const {scale, fill} = source;\n const options = scale.options;\n const length = scale.getLabels().length;\n const start = options.reverse ? scale.max : scale.min;\n const value = _getTargetValue(fill, scale, start);\n const target = [];\n\n if (options.grid.circular) {\n const center = scale.getPointPositionForValue(0, start);\n return new simpleArc({\n x: center.x,\n y: center.y,\n radius: scale.getDistanceFromCenterForValue(value)\n });\n }\n\n for (let i = 0; i < length; ++i) {\n target.push(scale.getPointPositionForValue(i, value));\n }\n return target;\n}\n\n", "import {clipArea, unclipArea} from '../../helpers/index.js';\nimport {_findSegmentEnd, _getBounds, _segments} from './filler.segment.js';\nimport {_getTarget} from './filler.target.js';\n\nexport function _drawfill(ctx, source, area) {\n const target = _getTarget(source);\n const {line, scale, axis} = source;\n const lineOpts = line.options;\n const fillOption = lineOpts.fill;\n const color = lineOpts.backgroundColor;\n const {above = color, below = color} = fillOption || {};\n if (target && line.points.length) {\n clipArea(ctx, area);\n doFill(ctx, {line, target, above, below, area, scale, axis});\n unclipArea(ctx);\n }\n}\n\nfunction doFill(ctx, cfg) {\n const {line, target, above, below, area, scale} = cfg;\n const property = line._loop ? 'angle' : cfg.axis;\n\n ctx.save();\n\n if (property === 'x' && below !== above) {\n clipVertical(ctx, target, area.top);\n fill(ctx, {line, target, color: above, scale, property});\n ctx.restore();\n ctx.save();\n clipVertical(ctx, target, area.bottom);\n }\n fill(ctx, {line, target, color: below, scale, property});\n\n ctx.restore();\n}\n\nfunction clipVertical(ctx, target, clipY) {\n const {segments, points} = target;\n let first = true;\n let lineLoop = false;\n\n ctx.beginPath();\n for (const segment of segments) {\n const {start, end} = segment;\n const firstPoint = points[start];\n const lastPoint = points[_findSegmentEnd(start, end, points)];\n if (first) {\n ctx.moveTo(firstPoint.x, firstPoint.y);\n first = false;\n } else {\n ctx.lineTo(firstPoint.x, clipY);\n ctx.lineTo(firstPoint.x, firstPoint.y);\n }\n lineLoop = !!target.pathSegment(ctx, segment, {move: lineLoop});\n if (lineLoop) {\n ctx.closePath();\n } else {\n ctx.lineTo(lastPoint.x, clipY);\n }\n }\n\n ctx.lineTo(target.first().x, clipY);\n ctx.closePath();\n ctx.clip();\n}\n\nfunction fill(ctx, cfg) {\n const {line, target, property, color, scale} = cfg;\n const segments = _segments(line, target, property);\n\n for (const {source: src, target: tgt, start, end} of segments) {\n const {style: {backgroundColor = color} = {}} = src;\n const notShape = target !== true;\n\n ctx.save();\n ctx.fillStyle = backgroundColor;\n\n clipBounds(ctx, scale, notShape && _getBounds(property, start, end));\n\n ctx.beginPath();\n\n const lineLoop = !!line.pathSegment(ctx, src);\n\n let loop;\n if (notShape) {\n if (lineLoop) {\n ctx.closePath();\n } else {\n interpolatedLineTo(ctx, target, end, property);\n }\n\n const targetLoop = !!target.pathSegment(ctx, tgt, {move: lineLoop, reverse: true});\n loop = lineLoop && targetLoop;\n if (!loop) {\n interpolatedLineTo(ctx, target, start, property);\n }\n }\n\n ctx.closePath();\n ctx.fill(loop ? 'evenodd' : 'nonzero');\n\n ctx.restore();\n }\n}\n\nfunction clipBounds(ctx, scale, bounds) {\n const {top, bottom} = scale.chart.chartArea;\n const {property, start, end} = bounds || {};\n if (property === 'x') {\n ctx.beginPath();\n ctx.rect(start, top, end - start, bottom - top);\n ctx.clip();\n }\n}\n\nfunction interpolatedLineTo(ctx, target, point, property) {\n const interpolatedPoint = target.interpolate(point, property);\n if (interpolatedPoint) {\n ctx.lineTo(interpolatedPoint.x, interpolatedPoint.y);\n }\n}\n\n", "/**\n * Plugin based on discussion from the following Chart.js issues:\n * @see https://github.com/chartjs/Chart.js/issues/2380#issuecomment-279961569\n * @see https://github.com/chartjs/Chart.js/issues/2440#issuecomment-256461897\n */\n\nimport LineElement from '../../elements/element.line.js';\nimport {_drawfill} from './filler.drawing.js';\nimport {_shouldApplyFill} from './filler.helper.js';\nimport {_decodeFill, _resolveTarget} from './filler.options.js';\n\nexport default {\n id: 'filler',\n\n afterDatasetsUpdate(chart, _args, options) {\n const count = (chart.data.datasets || []).length;\n const sources = [];\n let meta, i, line, source;\n\n for (i = 0; i < count; ++i) {\n meta = chart.getDatasetMeta(i);\n line = meta.dataset;\n source = null;\n\n if (line && line.options && line instanceof LineElement) {\n source = {\n visible: chart.isDatasetVisible(i),\n index: i,\n fill: _decodeFill(line, i, count),\n chart,\n axis: meta.controller.options.indexAxis,\n scale: meta.vScale,\n line,\n };\n }\n\n meta.$filler = source;\n sources.push(source);\n }\n\n for (i = 0; i < count; ++i) {\n source = sources[i];\n if (!source || source.fill === false) {\n continue;\n }\n\n source.fill = _resolveTarget(sources, i, options.propagate);\n }\n },\n\n beforeDraw(chart, _args, options) {\n const draw = options.drawTime === 'beforeDraw';\n const metasets = chart.getSortedVisibleDatasetMetas();\n const area = chart.chartArea;\n for (let i = metasets.length - 1; i >= 0; --i) {\n const source = metasets[i].$filler;\n if (!source) {\n continue;\n }\n\n source.line.updateControlPoints(area, source.axis);\n if (draw && source.fill) {\n _drawfill(chart.ctx, source, area);\n }\n }\n },\n\n beforeDatasetsDraw(chart, _args, options) {\n if (options.drawTime !== 'beforeDatasetsDraw') {\n return;\n }\n\n const metasets = chart.getSortedVisibleDatasetMetas();\n for (let i = metasets.length - 1; i >= 0; --i) {\n const source = metasets[i].$filler;\n\n if (_shouldApplyFill(source)) {\n _drawfill(chart.ctx, source, chart.chartArea);\n }\n }\n },\n\n beforeDatasetDraw(chart, args, options) {\n const source = args.meta.$filler;\n\n if (!_shouldApplyFill(source) || options.drawTime !== 'beforeDatasetDraw') {\n return;\n }\n\n _drawfill(chart.ctx, source, chart.chartArea);\n },\n\n defaults: {\n propagate: true,\n drawTime: 'beforeDatasetDraw'\n }\n};\n", "import defaults from '../core/core.defaults.js';\nimport Element from '../core/core.element.js';\nimport layouts from '../core/core.layouts.js';\nimport {addRoundedRectPath, drawPointLegend, renderText} from '../helpers/helpers.canvas.js';\nimport {\n _isBetween,\n callback as call,\n clipArea,\n getRtlAdapter,\n overrideTextDirection,\n restoreTextDirection,\n toFont,\n toPadding,\n unclipArea,\n valueOrDefault,\n} from '../helpers/index.js';\nimport {_alignStartEnd, _textX, _toLeftRightCenter} from '../helpers/helpers.extras.js';\nimport {toTRBLCorners} from '../helpers/helpers.options.js';\n\n/**\n * @typedef { import('../types/index.js').ChartEvent } ChartEvent\n */\n\nconst getBoxSize = (labelOpts, fontSize) => {\n let {boxHeight = fontSize, boxWidth = fontSize} = labelOpts;\n\n if (labelOpts.usePointStyle) {\n boxHeight = Math.min(boxHeight, fontSize);\n boxWidth = labelOpts.pointStyleWidth || Math.min(boxWidth, fontSize);\n }\n\n return {\n boxWidth,\n boxHeight,\n itemHeight: Math.max(fontSize, boxHeight)\n };\n};\n\nconst itemsEqual = (a, b) => a !== null && b !== null && a.datasetIndex === b.datasetIndex && a.index === b.index;\n\nexport class Legend extends Element {\n\n /**\n\t * @param {{ ctx: any; options: any; chart: any; }} config\n\t */\n constructor(config) {\n super();\n\n this._added = false;\n\n // Contains hit boxes for each dataset (in dataset order)\n this.legendHitBoxes = [];\n\n /**\n \t\t * @private\n \t\t */\n this._hoveredItem = null;\n\n // Are we in doughnut mode which has a different data type\n this.doughnutMode = false;\n\n this.chart = config.chart;\n this.options = config.options;\n this.ctx = config.ctx;\n this.legendItems = undefined;\n this.columnSizes = undefined;\n this.lineWidths = undefined;\n this.maxHeight = undefined;\n this.maxWidth = undefined;\n this.top = undefined;\n this.bottom = undefined;\n this.left = undefined;\n this.right = undefined;\n this.height = undefined;\n this.width = undefined;\n this._margins = undefined;\n this.position = undefined;\n this.weight = undefined;\n this.fullSize = undefined;\n }\n\n update(maxWidth, maxHeight, margins) {\n this.maxWidth = maxWidth;\n this.maxHeight = maxHeight;\n this._margins = margins;\n\n this.setDimensions();\n this.buildLabels();\n this.fit();\n }\n\n setDimensions() {\n if (this.isHorizontal()) {\n this.width = this.maxWidth;\n this.left = this._margins.left;\n this.right = this.width;\n } else {\n this.height = this.maxHeight;\n this.top = this._margins.top;\n this.bottom = this.height;\n }\n }\n\n buildLabels() {\n const labelOpts = this.options.labels || {};\n let legendItems = call(labelOpts.generateLabels, [this.chart], this) || [];\n\n if (labelOpts.filter) {\n legendItems = legendItems.filter((item) => labelOpts.filter(item, this.chart.data));\n }\n\n if (labelOpts.sort) {\n legendItems = legendItems.sort((a, b) => labelOpts.sort(a, b, this.chart.data));\n }\n\n if (this.options.reverse) {\n legendItems.reverse();\n }\n\n this.legendItems = legendItems;\n }\n\n fit() {\n const {options, ctx} = this;\n\n // The legend may not be displayed for a variety of reasons including\n // the fact that the defaults got set to `false`.\n // When the legend is not displayed, there are no guarantees that the options\n // are correctly formatted so we need to bail out as early as possible.\n if (!options.display) {\n this.width = this.height = 0;\n return;\n }\n\n const labelOpts = options.labels;\n const labelFont = toFont(labelOpts.font);\n const fontSize = labelFont.size;\n const titleHeight = this._computeTitleHeight();\n const {boxWidth, itemHeight} = getBoxSize(labelOpts, fontSize);\n\n let width, height;\n\n ctx.font = labelFont.string;\n\n if (this.isHorizontal()) {\n width = this.maxWidth; // fill all the width\n height = this._fitRows(titleHeight, fontSize, boxWidth, itemHeight) + 10;\n } else {\n height = this.maxHeight; // fill all the height\n width = this._fitCols(titleHeight, labelFont, boxWidth, itemHeight) + 10;\n }\n\n this.width = Math.min(width, options.maxWidth || this.maxWidth);\n this.height = Math.min(height, options.maxHeight || this.maxHeight);\n }\n\n /**\n\t * @private\n\t */\n _fitRows(titleHeight, fontSize, boxWidth, itemHeight) {\n const {ctx, maxWidth, options: {labels: {padding}}} = this;\n const hitboxes = this.legendHitBoxes = [];\n // Width of each line of legend boxes. Labels wrap onto multiple lines when there are too many to fit on one\n const lineWidths = this.lineWidths = [0];\n const lineHeight = itemHeight + padding;\n let totalHeight = titleHeight;\n\n ctx.textAlign = 'left';\n ctx.textBaseline = 'middle';\n\n let row = -1;\n let top = -lineHeight;\n this.legendItems.forEach((legendItem, i) => {\n const itemWidth = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width;\n\n if (i === 0 || lineWidths[lineWidths.length - 1] + itemWidth + 2 * padding > maxWidth) {\n totalHeight += lineHeight;\n lineWidths[lineWidths.length - (i > 0 ? 0 : 1)] = 0;\n top += lineHeight;\n row++;\n }\n\n hitboxes[i] = {left: 0, top, row, width: itemWidth, height: itemHeight};\n\n lineWidths[lineWidths.length - 1] += itemWidth + padding;\n });\n\n return totalHeight;\n }\n\n _fitCols(titleHeight, labelFont, boxWidth, _itemHeight) {\n const {ctx, maxHeight, options: {labels: {padding}}} = this;\n const hitboxes = this.legendHitBoxes = [];\n const columnSizes = this.columnSizes = [];\n const heightLimit = maxHeight - titleHeight;\n\n let totalWidth = padding;\n let currentColWidth = 0;\n let currentColHeight = 0;\n\n let left = 0;\n let col = 0;\n\n this.legendItems.forEach((legendItem, i) => {\n const {itemWidth, itemHeight} = calculateItemSize(boxWidth, labelFont, ctx, legendItem, _itemHeight);\n\n // If too tall, go to new column\n if (i > 0 && currentColHeight + itemHeight + 2 * padding > heightLimit) {\n totalWidth += currentColWidth + padding;\n columnSizes.push({width: currentColWidth, height: currentColHeight}); // previous column size\n left += currentColWidth + padding;\n col++;\n currentColWidth = currentColHeight = 0;\n }\n\n // Store the hitbox width and height here. Final position will be updated in `draw`\n hitboxes[i] = {left, top: currentColHeight, col, width: itemWidth, height: itemHeight};\n\n // Get max width\n currentColWidth = Math.max(currentColWidth, itemWidth);\n currentColHeight += itemHeight + padding;\n });\n\n totalWidth += currentColWidth;\n columnSizes.push({width: currentColWidth, height: currentColHeight}); // previous column size\n\n return totalWidth;\n }\n\n adjustHitBoxes() {\n if (!this.options.display) {\n return;\n }\n const titleHeight = this._computeTitleHeight();\n const {legendHitBoxes: hitboxes, options: {align, labels: {padding}, rtl}} = this;\n const rtlHelper = getRtlAdapter(rtl, this.left, this.width);\n if (this.isHorizontal()) {\n let row = 0;\n let left = _alignStartEnd(align, this.left + padding, this.right - this.lineWidths[row]);\n for (const hitbox of hitboxes) {\n if (row !== hitbox.row) {\n row = hitbox.row;\n left = _alignStartEnd(align, this.left + padding, this.right - this.lineWidths[row]);\n }\n hitbox.top += this.top + titleHeight + padding;\n hitbox.left = rtlHelper.leftForLtr(rtlHelper.x(left), hitbox.width);\n left += hitbox.width + padding;\n }\n } else {\n let col = 0;\n let top = _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - this.columnSizes[col].height);\n for (const hitbox of hitboxes) {\n if (hitbox.col !== col) {\n col = hitbox.col;\n top = _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - this.columnSizes[col].height);\n }\n hitbox.top = top;\n hitbox.left += this.left + padding;\n hitbox.left = rtlHelper.leftForLtr(rtlHelper.x(hitbox.left), hitbox.width);\n top += hitbox.height + padding;\n }\n }\n }\n\n isHorizontal() {\n return this.options.position === 'top' || this.options.position === 'bottom';\n }\n\n draw() {\n if (this.options.display) {\n const ctx = this.ctx;\n clipArea(ctx, this);\n\n this._draw();\n\n unclipArea(ctx);\n }\n }\n\n /**\n\t * @private\n\t */\n _draw() {\n const {options: opts, columnSizes, lineWidths, ctx} = this;\n const {align, labels: labelOpts} = opts;\n const defaultColor = defaults.color;\n const rtlHelper = getRtlAdapter(opts.rtl, this.left, this.width);\n const labelFont = toFont(labelOpts.font);\n const {padding} = labelOpts;\n const fontSize = labelFont.size;\n const halfFontSize = fontSize / 2;\n let cursor;\n\n this.drawTitle();\n\n // Canvas setup\n ctx.textAlign = rtlHelper.textAlign('left');\n ctx.textBaseline = 'middle';\n ctx.lineWidth = 0.5;\n ctx.font = labelFont.string;\n\n const {boxWidth, boxHeight, itemHeight} = getBoxSize(labelOpts, fontSize);\n\n // current position\n const drawLegendBox = function(x, y, legendItem) {\n if (isNaN(boxWidth) || boxWidth <= 0 || isNaN(boxHeight) || boxHeight < 0) {\n return;\n }\n\n // Set the ctx for the box\n ctx.save();\n\n const lineWidth = valueOrDefault(legendItem.lineWidth, 1);\n ctx.fillStyle = valueOrDefault(legendItem.fillStyle, defaultColor);\n ctx.lineCap = valueOrDefault(legendItem.lineCap, 'butt');\n ctx.lineDashOffset = valueOrDefault(legendItem.lineDashOffset, 0);\n ctx.lineJoin = valueOrDefault(legendItem.lineJoin, 'miter');\n ctx.lineWidth = lineWidth;\n ctx.strokeStyle = valueOrDefault(legendItem.strokeStyle, defaultColor);\n\n ctx.setLineDash(valueOrDefault(legendItem.lineDash, []));\n\n if (labelOpts.usePointStyle) {\n // Recalculate x and y for drawPoint() because its expecting\n // x and y to be center of figure (instead of top left)\n const drawOptions = {\n radius: boxHeight * Math.SQRT2 / 2,\n pointStyle: legendItem.pointStyle,\n rotation: legendItem.rotation,\n borderWidth: lineWidth\n };\n const centerX = rtlHelper.xPlus(x, boxWidth / 2);\n const centerY = y + halfFontSize;\n\n // Draw pointStyle as legend symbol\n drawPointLegend(ctx, drawOptions, centerX, centerY, labelOpts.pointStyleWidth && boxWidth);\n } else {\n // Draw box as legend symbol\n // Adjust position when boxHeight < fontSize (want it centered)\n const yBoxTop = y + Math.max((fontSize - boxHeight) / 2, 0);\n const xBoxLeft = rtlHelper.leftForLtr(x, boxWidth);\n const borderRadius = toTRBLCorners(legendItem.borderRadius);\n\n ctx.beginPath();\n\n if (Object.values(borderRadius).some(v => v !== 0)) {\n addRoundedRectPath(ctx, {\n x: xBoxLeft,\n y: yBoxTop,\n w: boxWidth,\n h: boxHeight,\n radius: borderRadius,\n });\n } else {\n ctx.rect(xBoxLeft, yBoxTop, boxWidth, boxHeight);\n }\n\n ctx.fill();\n if (lineWidth !== 0) {\n ctx.stroke();\n }\n }\n\n ctx.restore();\n };\n\n const fillText = function(x, y, legendItem) {\n renderText(ctx, legendItem.text, x, y + (itemHeight / 2), labelFont, {\n strikethrough: legendItem.hidden,\n textAlign: rtlHelper.textAlign(legendItem.textAlign)\n });\n };\n\n // Horizontal\n const isHorizontal = this.isHorizontal();\n const titleHeight = this._computeTitleHeight();\n if (isHorizontal) {\n cursor = {\n x: _alignStartEnd(align, this.left + padding, this.right - lineWidths[0]),\n y: this.top + padding + titleHeight,\n line: 0\n };\n } else {\n cursor = {\n x: this.left + padding,\n y: _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - columnSizes[0].height),\n line: 0\n };\n }\n\n overrideTextDirection(this.ctx, opts.textDirection);\n\n const lineHeight = itemHeight + padding;\n this.legendItems.forEach((legendItem, i) => {\n ctx.strokeStyle = legendItem.fontColor; // for strikethrough effect\n ctx.fillStyle = legendItem.fontColor; // render in correct colour\n\n const textWidth = ctx.measureText(legendItem.text).width;\n const textAlign = rtlHelper.textAlign(legendItem.textAlign || (legendItem.textAlign = labelOpts.textAlign));\n const width = boxWidth + halfFontSize + textWidth;\n let x = cursor.x;\n let y = cursor.y;\n\n rtlHelper.setWidth(this.width);\n\n if (isHorizontal) {\n if (i > 0 && x + width + padding > this.right) {\n y = cursor.y += lineHeight;\n cursor.line++;\n x = cursor.x = _alignStartEnd(align, this.left + padding, this.right - lineWidths[cursor.line]);\n }\n } else if (i > 0 && y + lineHeight > this.bottom) {\n x = cursor.x = x + columnSizes[cursor.line].width + padding;\n cursor.line++;\n y = cursor.y = _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - columnSizes[cursor.line].height);\n }\n\n const realX = rtlHelper.x(x);\n\n drawLegendBox(realX, y, legendItem);\n\n x = _textX(textAlign, x + boxWidth + halfFontSize, isHorizontal ? x + width : this.right, opts.rtl);\n\n // Fill the actual label\n fillText(rtlHelper.x(x), y, legendItem);\n\n if (isHorizontal) {\n cursor.x += width + padding;\n } else if (typeof legendItem.text !== 'string') {\n const fontLineHeight = labelFont.lineHeight;\n cursor.y += calculateLegendItemHeight(legendItem, fontLineHeight) + padding;\n } else {\n cursor.y += lineHeight;\n }\n });\n\n restoreTextDirection(this.ctx, opts.textDirection);\n }\n\n /**\n\t * @protected\n\t */\n drawTitle() {\n const opts = this.options;\n const titleOpts = opts.title;\n const titleFont = toFont(titleOpts.font);\n const titlePadding = toPadding(titleOpts.padding);\n\n if (!titleOpts.display) {\n return;\n }\n\n const rtlHelper = getRtlAdapter(opts.rtl, this.left, this.width);\n const ctx = this.ctx;\n const position = titleOpts.position;\n const halfFontSize = titleFont.size / 2;\n const topPaddingPlusHalfFontSize = titlePadding.top + halfFontSize;\n let y;\n\n // These defaults are used when the legend is vertical.\n // When horizontal, they are computed below.\n let left = this.left;\n let maxWidth = this.width;\n\n if (this.isHorizontal()) {\n // Move left / right so that the title is above the legend lines\n maxWidth = Math.max(...this.lineWidths);\n y = this.top + topPaddingPlusHalfFontSize;\n left = _alignStartEnd(opts.align, left, this.right - maxWidth);\n } else {\n // Move down so that the title is above the legend stack in every alignment\n const maxHeight = this.columnSizes.reduce((acc, size) => Math.max(acc, size.height), 0);\n y = topPaddingPlusHalfFontSize + _alignStartEnd(opts.align, this.top, this.bottom - maxHeight - opts.labels.padding - this._computeTitleHeight());\n }\n\n // Now that we know the left edge of the inner legend box, compute the correct\n // X coordinate from the title alignment\n const x = _alignStartEnd(position, left, left + maxWidth);\n\n // Canvas setup\n ctx.textAlign = rtlHelper.textAlign(_toLeftRightCenter(position));\n ctx.textBaseline = 'middle';\n ctx.strokeStyle = titleOpts.color;\n ctx.fillStyle = titleOpts.color;\n ctx.font = titleFont.string;\n\n renderText(ctx, titleOpts.text, x, y, titleFont);\n }\n\n /**\n\t * @private\n\t */\n _computeTitleHeight() {\n const titleOpts = this.options.title;\n const titleFont = toFont(titleOpts.font);\n const titlePadding = toPadding(titleOpts.padding);\n return titleOpts.display ? titleFont.lineHeight + titlePadding.height : 0;\n }\n\n /**\n\t * @private\n\t */\n _getLegendItemAt(x, y) {\n let i, hitBox, lh;\n\n if (_isBetween(x, this.left, this.right)\n && _isBetween(y, this.top, this.bottom)) {\n // See if we are touching one of the dataset boxes\n lh = this.legendHitBoxes;\n for (i = 0; i < lh.length; ++i) {\n hitBox = lh[i];\n\n if (_isBetween(x, hitBox.left, hitBox.left + hitBox.width)\n && _isBetween(y, hitBox.top, hitBox.top + hitBox.height)) {\n // Touching an element\n return this.legendItems[i];\n }\n }\n }\n\n return null;\n }\n\n /**\n\t * Handle an event\n\t * @param {ChartEvent} e - The event to handle\n\t */\n handleEvent(e) {\n const opts = this.options;\n if (!isListened(e.type, opts)) {\n return;\n }\n\n // Chart event already has relative position in it\n const hoveredItem = this._getLegendItemAt(e.x, e.y);\n\n if (e.type === 'mousemove' || e.type === 'mouseout') {\n const previous = this._hoveredItem;\n const sameItem = itemsEqual(previous, hoveredItem);\n if (previous && !sameItem) {\n call(opts.onLeave, [e, previous, this], this);\n }\n\n this._hoveredItem = hoveredItem;\n\n if (hoveredItem && !sameItem) {\n call(opts.onHover, [e, hoveredItem, this], this);\n }\n } else if (hoveredItem) {\n call(opts.onClick, [e, hoveredItem, this], this);\n }\n }\n}\n\nfunction calculateItemSize(boxWidth, labelFont, ctx, legendItem, _itemHeight) {\n const itemWidth = calculateItemWidth(legendItem, boxWidth, labelFont, ctx);\n const itemHeight = calculateItemHeight(_itemHeight, legendItem, labelFont.lineHeight);\n return {itemWidth, itemHeight};\n}\n\nfunction calculateItemWidth(legendItem, boxWidth, labelFont, ctx) {\n let legendItemText = legendItem.text;\n if (legendItemText && typeof legendItemText !== 'string') {\n legendItemText = legendItemText.reduce((a, b) => a.length > b.length ? a : b);\n }\n return boxWidth + (labelFont.size / 2) + ctx.measureText(legendItemText).width;\n}\n\nfunction calculateItemHeight(_itemHeight, legendItem, fontLineHeight) {\n let itemHeight = _itemHeight;\n if (typeof legendItem.text !== 'string') {\n itemHeight = calculateLegendItemHeight(legendItem, fontLineHeight);\n }\n return itemHeight;\n}\n\nfunction calculateLegendItemHeight(legendItem, fontLineHeight) {\n const labelHeight = legendItem.text ? legendItem.text.length : 0;\n return fontLineHeight * labelHeight;\n}\n\nfunction isListened(type, opts) {\n if ((type === 'mousemove' || type === 'mouseout') && (opts.onHover || opts.onLeave)) {\n return true;\n }\n if (opts.onClick && (type === 'click' || type === 'mouseup')) {\n return true;\n }\n return false;\n}\n\nexport default {\n id: 'legend',\n\n /**\n\t * For tests\n\t * @private\n\t */\n _element: Legend,\n\n start(chart, _args, options) {\n const legend = chart.legend = new Legend({ctx: chart.ctx, options, chart});\n layouts.configure(chart, legend, options);\n layouts.addBox(chart, legend);\n },\n\n stop(chart) {\n layouts.removeBox(chart, chart.legend);\n delete chart.legend;\n },\n\n // During the beforeUpdate step, the layout configuration needs to run\n // This ensures that if the legend position changes (via an option update)\n // the layout system respects the change. See https://github.com/chartjs/Chart.js/issues/7527\n beforeUpdate(chart, _args, options) {\n const legend = chart.legend;\n layouts.configure(chart, legend, options);\n legend.options = options;\n },\n\n // The labels need to be built after datasets are updated to ensure that colors\n // and other styling are correct. See https://github.com/chartjs/Chart.js/issues/6968\n afterUpdate(chart) {\n const legend = chart.legend;\n legend.buildLabels();\n legend.adjustHitBoxes();\n },\n\n\n afterEvent(chart, args) {\n if (!args.replay) {\n chart.legend.handleEvent(args.event);\n }\n },\n\n defaults: {\n display: true,\n position: 'top',\n align: 'center',\n fullSize: true,\n reverse: false,\n weight: 1000,\n\n // a callback that will handle\n onClick(e, legendItem, legend) {\n const index = legendItem.datasetIndex;\n const ci = legend.chart;\n if (ci.isDatasetVisible(index)) {\n ci.hide(index);\n legendItem.hidden = true;\n } else {\n ci.show(index);\n legendItem.hidden = false;\n }\n },\n\n onHover: null,\n onLeave: null,\n\n labels: {\n color: (ctx) => ctx.chart.options.color,\n boxWidth: 40,\n padding: 10,\n // Generates labels shown in the legend\n // Valid properties to return:\n // text : text to display\n // fillStyle : fill of coloured box\n // strokeStyle: stroke of coloured box\n // hidden : if this legend item refers to a hidden item\n // lineCap : cap style for line\n // lineDash\n // lineDashOffset :\n // lineJoin :\n // lineWidth :\n generateLabels(chart) {\n const datasets = chart.data.datasets;\n const {labels: {usePointStyle, pointStyle, textAlign, color, useBorderRadius, borderRadius}} = chart.legend.options;\n\n return chart._getSortedDatasetMetas().map((meta) => {\n const style = meta.controller.getStyle(usePointStyle ? 0 : undefined);\n const borderWidth = toPadding(style.borderWidth);\n\n return {\n text: datasets[meta.index].label,\n fillStyle: style.backgroundColor,\n fontColor: color,\n hidden: !meta.visible,\n lineCap: style.borderCapStyle,\n lineDash: style.borderDash,\n lineDashOffset: style.borderDashOffset,\n lineJoin: style.borderJoinStyle,\n lineWidth: (borderWidth.width + borderWidth.height) / 4,\n strokeStyle: style.borderColor,\n pointStyle: pointStyle || style.pointStyle,\n rotation: style.rotation,\n textAlign: textAlign || style.textAlign,\n borderRadius: useBorderRadius && (borderRadius || style.borderRadius),\n\n // Below is extra data used for toggling the datasets\n datasetIndex: meta.index\n };\n }, this);\n }\n },\n\n title: {\n color: (ctx) => ctx.chart.options.color,\n display: false,\n position: 'center',\n text: '',\n }\n },\n\n descriptors: {\n _scriptable: (name) => !name.startsWith('on'),\n labels: {\n _scriptable: (name) => !['generateLabels', 'filter', 'sort'].includes(name),\n }\n },\n};\n", "import Element from '../core/core.element.js';\nimport layouts from '../core/core.layouts.js';\nimport {PI, isArray, toPadding, toFont} from '../helpers/index.js';\nimport {_toLeftRightCenter, _alignStartEnd} from '../helpers/helpers.extras.js';\nimport {renderText} from '../helpers/helpers.canvas.js';\n\nexport class Title extends Element {\n /**\n\t * @param {{ ctx: any; options: any; chart: any; }} config\n\t */\n constructor(config) {\n super();\n\n this.chart = config.chart;\n this.options = config.options;\n this.ctx = config.ctx;\n this._padding = undefined;\n this.top = undefined;\n this.bottom = undefined;\n this.left = undefined;\n this.right = undefined;\n this.width = undefined;\n this.height = undefined;\n this.position = undefined;\n this.weight = undefined;\n this.fullSize = undefined;\n }\n\n update(maxWidth, maxHeight) {\n const opts = this.options;\n\n this.left = 0;\n this.top = 0;\n\n if (!opts.display) {\n this.width = this.height = this.right = this.bottom = 0;\n return;\n }\n\n this.width = this.right = maxWidth;\n this.height = this.bottom = maxHeight;\n\n const lineCount = isArray(opts.text) ? opts.text.length : 1;\n this._padding = toPadding(opts.padding);\n const textSize = lineCount * toFont(opts.font).lineHeight + this._padding.height;\n\n if (this.isHorizontal()) {\n this.height = textSize;\n } else {\n this.width = textSize;\n }\n }\n\n isHorizontal() {\n const pos = this.options.position;\n return pos === 'top' || pos === 'bottom';\n }\n\n _drawArgs(offset) {\n const {top, left, bottom, right, options} = this;\n const align = options.align;\n let rotation = 0;\n let maxWidth, titleX, titleY;\n\n if (this.isHorizontal()) {\n titleX = _alignStartEnd(align, left, right);\n titleY = top + offset;\n maxWidth = right - left;\n } else {\n if (options.position === 'left') {\n titleX = left + offset;\n titleY = _alignStartEnd(align, bottom, top);\n rotation = PI * -0.5;\n } else {\n titleX = right - offset;\n titleY = _alignStartEnd(align, top, bottom);\n rotation = PI * 0.5;\n }\n maxWidth = bottom - top;\n }\n return {titleX, titleY, maxWidth, rotation};\n }\n\n draw() {\n const ctx = this.ctx;\n const opts = this.options;\n\n if (!opts.display) {\n return;\n }\n\n const fontOpts = toFont(opts.font);\n const lineHeight = fontOpts.lineHeight;\n const offset = lineHeight / 2 + this._padding.top;\n const {titleX, titleY, maxWidth, rotation} = this._drawArgs(offset);\n\n renderText(ctx, opts.text, 0, 0, fontOpts, {\n color: opts.color,\n maxWidth,\n rotation,\n textAlign: _toLeftRightCenter(opts.align),\n textBaseline: 'middle',\n translation: [titleX, titleY],\n });\n }\n}\n\nfunction createTitle(chart, titleOpts) {\n const title = new Title({\n ctx: chart.ctx,\n options: titleOpts,\n chart\n });\n\n layouts.configure(chart, title, titleOpts);\n layouts.addBox(chart, title);\n chart.titleBlock = title;\n}\n\nexport default {\n id: 'title',\n\n /**\n\t * For tests\n\t * @private\n\t */\n _element: Title,\n\n start(chart, _args, options) {\n createTitle(chart, options);\n },\n\n stop(chart) {\n const titleBlock = chart.titleBlock;\n layouts.removeBox(chart, titleBlock);\n delete chart.titleBlock;\n },\n\n beforeUpdate(chart, _args, options) {\n const title = chart.titleBlock;\n layouts.configure(chart, title, options);\n title.options = options;\n },\n\n defaults: {\n align: 'center',\n display: false,\n font: {\n weight: 'bold',\n },\n fullSize: true,\n padding: 10,\n position: 'top',\n text: '',\n weight: 2000 // by default greater than legend (1000) to be above\n },\n\n defaultRoutes: {\n color: 'color'\n },\n\n descriptors: {\n _scriptable: true,\n _indexable: false,\n },\n};\n", "import {Title} from './plugin.title.js';\nimport layouts from '../core/core.layouts.js';\n\nconst map = new WeakMap();\n\nexport default {\n id: 'subtitle',\n\n start(chart, _args, options) {\n const title = new Title({\n ctx: chart.ctx,\n options,\n chart\n });\n\n layouts.configure(chart, title, options);\n layouts.addBox(chart, title);\n map.set(chart, title);\n },\n\n stop(chart) {\n layouts.removeBox(chart, map.get(chart));\n map.delete(chart);\n },\n\n beforeUpdate(chart, _args, options) {\n const title = map.get(chart);\n layouts.configure(chart, title, options);\n title.options = options;\n },\n\n defaults: {\n align: 'center',\n display: false,\n font: {\n weight: 'normal',\n },\n fullSize: true,\n padding: 0,\n position: 'top',\n text: '',\n weight: 1500 // by default greater than legend (1000) and smaller than title (2000)\n },\n\n defaultRoutes: {\n color: 'color'\n },\n\n descriptors: {\n _scriptable: true,\n _indexable: false,\n },\n};\n", "import Animations from '../core/core.animations.js';\nimport Element from '../core/core.element.js';\nimport {addRoundedRectPath} from '../helpers/helpers.canvas.js';\nimport {each, noop, isNullOrUndef, isArray, _elementsEqual, isObject} from '../helpers/helpers.core.js';\nimport {toFont, toPadding, toTRBLCorners} from '../helpers/helpers.options.js';\nimport {getRtlAdapter, overrideTextDirection, restoreTextDirection} from '../helpers/helpers.rtl.js';\nimport {distanceBetweenPoints, _limitValue} from '../helpers/helpers.math.js';\nimport {createContext, drawPoint} from '../helpers/index.js';\n\n/**\n * @typedef { import('../platform/platform.base.js').Chart } Chart\n * @typedef { import('../types/index.js').ChartEvent } ChartEvent\n * @typedef { import('../types/index.js').ActiveElement } ActiveElement\n * @typedef { import('../core/core.interaction.js').InteractionItem } InteractionItem\n */\n\nconst positioners = {\n /**\n\t * Average mode places the tooltip at the average position of the elements shown\n\t */\n average(items) {\n if (!items.length) {\n return false;\n }\n\n let i, len;\n let xSet = new Set();\n let y = 0;\n let count = 0;\n\n for (i = 0, len = items.length; i < len; ++i) {\n const el = items[i].element;\n if (el && el.hasValue()) {\n const pos = el.tooltipPosition();\n xSet.add(pos.x);\n y += pos.y;\n ++count;\n }\n }\n\n // No visible items where found, return false so we don't have to divide by 0 which reduces in NaN\n if (count === 0 || xSet.size === 0) {\n return false;\n }\n\n const xAverage = [...xSet].reduce((a, b) => a + b) / xSet.size;\n\n return {\n x: xAverage,\n y: y / count\n };\n },\n\n /**\n\t * Gets the tooltip position nearest of the item nearest to the event position\n\t */\n nearest(items, eventPosition) {\n if (!items.length) {\n return false;\n }\n\n let x = eventPosition.x;\n let y = eventPosition.y;\n let minDistance = Number.POSITIVE_INFINITY;\n let i, len, nearestElement;\n\n for (i = 0, len = items.length; i < len; ++i) {\n const el = items[i].element;\n if (el && el.hasValue()) {\n const center = el.getCenterPoint();\n const d = distanceBetweenPoints(eventPosition, center);\n\n if (d < minDistance) {\n minDistance = d;\n nearestElement = el;\n }\n }\n }\n\n if (nearestElement) {\n const tp = nearestElement.tooltipPosition();\n x = tp.x;\n y = tp.y;\n }\n\n return {\n x,\n y\n };\n }\n};\n\n// Helper to push or concat based on if the 2nd parameter is an array or not\nfunction pushOrConcat(base, toPush) {\n if (toPush) {\n if (isArray(toPush)) {\n // base = base.concat(toPush);\n Array.prototype.push.apply(base, toPush);\n } else {\n base.push(toPush);\n }\n }\n\n return base;\n}\n\n/**\n * Returns array of strings split by newline\n * @param {*} str - The value to split by newline.\n * @returns {string|string[]} value if newline present - Returned from String split() method\n * @function\n */\nfunction splitNewlines(str) {\n if ((typeof str === 'string' || str instanceof String) && str.indexOf('\\n') > -1) {\n return str.split('\\n');\n }\n return str;\n}\n\n\n/**\n * Private helper to create a tooltip item model\n * @param {Chart} chart\n * @param {ActiveElement} item - {element, index, datasetIndex} to create the tooltip item for\n * @return new tooltip item\n */\nfunction createTooltipItem(chart, item) {\n const {element, datasetIndex, index} = item;\n const controller = chart.getDatasetMeta(datasetIndex).controller;\n const {label, value} = controller.getLabelAndValue(index);\n\n return {\n chart,\n label,\n parsed: controller.getParsed(index),\n raw: chart.data.datasets[datasetIndex].data[index],\n formattedValue: value,\n dataset: controller.getDataset(),\n dataIndex: index,\n datasetIndex,\n element\n };\n}\n\n/**\n * Get the size of the tooltip\n */\nfunction getTooltipSize(tooltip, options) {\n const ctx = tooltip.chart.ctx;\n const {body, footer, title} = tooltip;\n const {boxWidth, boxHeight} = options;\n const bodyFont = toFont(options.bodyFont);\n const titleFont = toFont(options.titleFont);\n const footerFont = toFont(options.footerFont);\n const titleLineCount = title.length;\n const footerLineCount = footer.length;\n const bodyLineItemCount = body.length;\n\n const padding = toPadding(options.padding);\n let height = padding.height;\n let width = 0;\n\n // Count of all lines in the body\n let combinedBodyLength = body.reduce((count, bodyItem) => count + bodyItem.before.length + bodyItem.lines.length + bodyItem.after.length, 0);\n combinedBodyLength += tooltip.beforeBody.length + tooltip.afterBody.length;\n\n if (titleLineCount) {\n height += titleLineCount * titleFont.lineHeight\n\t\t\t+ (titleLineCount - 1) * options.titleSpacing\n\t\t\t+ options.titleMarginBottom;\n }\n if (combinedBodyLength) {\n // Body lines may include some extra height depending on boxHeight\n const bodyLineHeight = options.displayColors ? Math.max(boxHeight, bodyFont.lineHeight) : bodyFont.lineHeight;\n height += bodyLineItemCount * bodyLineHeight\n\t\t\t+ (combinedBodyLength - bodyLineItemCount) * bodyFont.lineHeight\n\t\t\t+ (combinedBodyLength - 1) * options.bodySpacing;\n }\n if (footerLineCount) {\n height += options.footerMarginTop\n\t\t\t+ footerLineCount * footerFont.lineHeight\n\t\t\t+ (footerLineCount - 1) * options.footerSpacing;\n }\n\n // Title width\n let widthPadding = 0;\n const maxLineWidth = function(line) {\n width = Math.max(width, ctx.measureText(line).width + widthPadding);\n };\n\n ctx.save();\n\n ctx.font = titleFont.string;\n each(tooltip.title, maxLineWidth);\n\n // Body width\n ctx.font = bodyFont.string;\n each(tooltip.beforeBody.concat(tooltip.afterBody), maxLineWidth);\n\n // Body lines may include some extra width due to the color box\n widthPadding = options.displayColors ? (boxWidth + 2 + options.boxPadding) : 0;\n each(body, (bodyItem) => {\n each(bodyItem.before, maxLineWidth);\n each(bodyItem.lines, maxLineWidth);\n each(bodyItem.after, maxLineWidth);\n });\n\n // Reset back to 0\n widthPadding = 0;\n\n // Footer width\n ctx.font = footerFont.string;\n each(tooltip.footer, maxLineWidth);\n\n ctx.restore();\n\n // Add padding\n width += padding.width;\n\n return {width, height};\n}\n\nfunction determineYAlign(chart, size) {\n const {y, height} = size;\n\n if (y < height / 2) {\n return 'top';\n } else if (y > (chart.height - height / 2)) {\n return 'bottom';\n }\n return 'center';\n}\n\nfunction doesNotFitWithAlign(xAlign, chart, options, size) {\n const {x, width} = size;\n const caret = options.caretSize + options.caretPadding;\n if (xAlign === 'left' && x + width + caret > chart.width) {\n return true;\n }\n\n if (xAlign === 'right' && x - width - caret < 0) {\n return true;\n }\n}\n\nfunction determineXAlign(chart, options, size, yAlign) {\n const {x, width} = size;\n const {width: chartWidth, chartArea: {left, right}} = chart;\n let xAlign = 'center';\n\n if (yAlign === 'center') {\n xAlign = x <= (left + right) / 2 ? 'left' : 'right';\n } else if (x <= width / 2) {\n xAlign = 'left';\n } else if (x >= chartWidth - width / 2) {\n xAlign = 'right';\n }\n\n if (doesNotFitWithAlign(xAlign, chart, options, size)) {\n xAlign = 'center';\n }\n\n return xAlign;\n}\n\n/**\n * Helper to get the alignment of a tooltip given the size\n */\nfunction determineAlignment(chart, options, size) {\n const yAlign = size.yAlign || options.yAlign || determineYAlign(chart, size);\n\n return {\n xAlign: size.xAlign || options.xAlign || determineXAlign(chart, options, size, yAlign),\n yAlign\n };\n}\n\nfunction alignX(size, xAlign) {\n let {x, width} = size;\n if (xAlign === 'right') {\n x -= width;\n } else if (xAlign === 'center') {\n x -= (width / 2);\n }\n return x;\n}\n\nfunction alignY(size, yAlign, paddingAndSize) {\n // eslint-disable-next-line prefer-const\n let {y, height} = size;\n if (yAlign === 'top') {\n y += paddingAndSize;\n } else if (yAlign === 'bottom') {\n y -= height + paddingAndSize;\n } else {\n y -= (height / 2);\n }\n return y;\n}\n\n/**\n * Helper to get the location a tooltip needs to be placed at given the initial position (via the vm) and the size and alignment\n */\nfunction getBackgroundPoint(options, size, alignment, chart) {\n const {caretSize, caretPadding, cornerRadius} = options;\n const {xAlign, yAlign} = alignment;\n const paddingAndSize = caretSize + caretPadding;\n const {topLeft, topRight, bottomLeft, bottomRight} = toTRBLCorners(cornerRadius);\n\n let x = alignX(size, xAlign);\n const y = alignY(size, yAlign, paddingAndSize);\n\n if (yAlign === 'center') {\n if (xAlign === 'left') {\n x += paddingAndSize;\n } else if (xAlign === 'right') {\n x -= paddingAndSize;\n }\n } else if (xAlign === 'left') {\n x -= Math.max(topLeft, bottomLeft) + caretSize;\n } else if (xAlign === 'right') {\n x += Math.max(topRight, bottomRight) + caretSize;\n }\n\n return {\n x: _limitValue(x, 0, chart.width - size.width),\n y: _limitValue(y, 0, chart.height - size.height)\n };\n}\n\nfunction getAlignedX(tooltip, align, options) {\n const padding = toPadding(options.padding);\n\n return align === 'center'\n ? tooltip.x + tooltip.width / 2\n : align === 'right'\n ? tooltip.x + tooltip.width - padding.right\n : tooltip.x + padding.left;\n}\n\n/**\n * Helper to build before and after body lines\n */\nfunction getBeforeAfterBodyLines(callback) {\n return pushOrConcat([], splitNewlines(callback));\n}\n\nfunction createTooltipContext(parent, tooltip, tooltipItems) {\n return createContext(parent, {\n tooltip,\n tooltipItems,\n type: 'tooltip'\n });\n}\n\nfunction overrideCallbacks(callbacks, context) {\n const override = context && context.dataset && context.dataset.tooltip && context.dataset.tooltip.callbacks;\n return override ? callbacks.override(override) : callbacks;\n}\n\nconst defaultCallbacks = {\n // Args are: (tooltipItems, data)\n beforeTitle: noop,\n title(tooltipItems) {\n if (tooltipItems.length > 0) {\n const item = tooltipItems[0];\n const labels = item.chart.data.labels;\n const labelCount = labels ? labels.length : 0;\n\n if (this && this.options && this.options.mode === 'dataset') {\n return item.dataset.label || '';\n } else if (item.label) {\n return item.label;\n } else if (labelCount > 0 && item.dataIndex < labelCount) {\n return labels[item.dataIndex];\n }\n }\n\n return '';\n },\n afterTitle: noop,\n\n // Args are: (tooltipItems, data)\n beforeBody: noop,\n\n // Args are: (tooltipItem, data)\n beforeLabel: noop,\n label(tooltipItem) {\n if (this && this.options && this.options.mode === 'dataset') {\n return tooltipItem.label + ': ' + tooltipItem.formattedValue || tooltipItem.formattedValue;\n }\n\n let label = tooltipItem.dataset.label || '';\n\n if (label) {\n label += ': ';\n }\n const value = tooltipItem.formattedValue;\n if (!isNullOrUndef(value)) {\n label += value;\n }\n return label;\n },\n labelColor(tooltipItem) {\n const meta = tooltipItem.chart.getDatasetMeta(tooltipItem.datasetIndex);\n const options = meta.controller.getStyle(tooltipItem.dataIndex);\n return {\n borderColor: options.borderColor,\n backgroundColor: options.backgroundColor,\n borderWidth: options.borderWidth,\n borderDash: options.borderDash,\n borderDashOffset: options.borderDashOffset,\n borderRadius: 0,\n };\n },\n labelTextColor() {\n return this.options.bodyColor;\n },\n labelPointStyle(tooltipItem) {\n const meta = tooltipItem.chart.getDatasetMeta(tooltipItem.datasetIndex);\n const options = meta.controller.getStyle(tooltipItem.dataIndex);\n return {\n pointStyle: options.pointStyle,\n rotation: options.rotation,\n };\n },\n afterLabel: noop,\n\n // Args are: (tooltipItems, data)\n afterBody: noop,\n\n // Args are: (tooltipItems, data)\n beforeFooter: noop,\n footer: noop,\n afterFooter: noop\n};\n\n/**\n * Invoke callback from object with context and arguments.\n * If callback returns `undefined`, then will be invoked default callback.\n * @param {Record} callbacks\n * @param {keyof typeof defaultCallbacks} name\n * @param {*} ctx\n * @param {*} arg\n * @returns {any}\n */\nfunction invokeCallbackWithFallback(callbacks, name, ctx, arg) {\n const result = callbacks[name].call(ctx, arg);\n\n if (typeof result === 'undefined') {\n return defaultCallbacks[name].call(ctx, arg);\n }\n\n return result;\n}\n\nexport class Tooltip extends Element {\n\n /**\n * @namespace Chart.Tooltip.positioners\n */\n static positioners = positioners;\n\n constructor(config) {\n super();\n\n this.opacity = 0;\n this._active = [];\n this._eventPosition = undefined;\n this._size = undefined;\n this._cachedAnimations = undefined;\n this._tooltipItems = [];\n this.$animations = undefined;\n this.$context = undefined;\n this.chart = config.chart;\n this.options = config.options;\n this.dataPoints = undefined;\n this.title = undefined;\n this.beforeBody = undefined;\n this.body = undefined;\n this.afterBody = undefined;\n this.footer = undefined;\n this.xAlign = undefined;\n this.yAlign = undefined;\n this.x = undefined;\n this.y = undefined;\n this.height = undefined;\n this.width = undefined;\n this.caretX = undefined;\n this.caretY = undefined;\n // TODO: V4, make this private, rename to `_labelStyles`, and combine with `labelPointStyles`\n // and `labelTextColors` to create a single variable\n this.labelColors = undefined;\n this.labelPointStyles = undefined;\n this.labelTextColors = undefined;\n }\n\n initialize(options) {\n this.options = options;\n this._cachedAnimations = undefined;\n this.$context = undefined;\n }\n\n /**\n\t * @private\n\t */\n _resolveAnimations() {\n const cached = this._cachedAnimations;\n\n if (cached) {\n return cached;\n }\n\n const chart = this.chart;\n const options = this.options.setContext(this.getContext());\n const opts = options.enabled && chart.options.animation && options.animations;\n const animations = new Animations(this.chart, opts);\n if (opts._cacheable) {\n this._cachedAnimations = Object.freeze(animations);\n }\n\n return animations;\n }\n\n /**\n\t * @protected\n\t */\n getContext() {\n return this.$context ||\n\t\t\t(this.$context = createTooltipContext(this.chart.getContext(), this, this._tooltipItems));\n }\n\n getTitle(context, options) {\n const {callbacks} = options;\n\n const beforeTitle = invokeCallbackWithFallback(callbacks, 'beforeTitle', this, context);\n const title = invokeCallbackWithFallback(callbacks, 'title', this, context);\n const afterTitle = invokeCallbackWithFallback(callbacks, 'afterTitle', this, context);\n\n let lines = [];\n lines = pushOrConcat(lines, splitNewlines(beforeTitle));\n lines = pushOrConcat(lines, splitNewlines(title));\n lines = pushOrConcat(lines, splitNewlines(afterTitle));\n\n return lines;\n }\n\n getBeforeBody(tooltipItems, options) {\n return getBeforeAfterBodyLines(\n invokeCallbackWithFallback(options.callbacks, 'beforeBody', this, tooltipItems)\n );\n }\n\n getBody(tooltipItems, options) {\n const {callbacks} = options;\n const bodyItems = [];\n\n each(tooltipItems, (context) => {\n const bodyItem = {\n before: [],\n lines: [],\n after: []\n };\n const scoped = overrideCallbacks(callbacks, context);\n pushOrConcat(bodyItem.before, splitNewlines(invokeCallbackWithFallback(scoped, 'beforeLabel', this, context)));\n pushOrConcat(bodyItem.lines, invokeCallbackWithFallback(scoped, 'label', this, context));\n pushOrConcat(bodyItem.after, splitNewlines(invokeCallbackWithFallback(scoped, 'afterLabel', this, context)));\n\n bodyItems.push(bodyItem);\n });\n\n return bodyItems;\n }\n\n getAfterBody(tooltipItems, options) {\n return getBeforeAfterBodyLines(\n invokeCallbackWithFallback(options.callbacks, 'afterBody', this, tooltipItems)\n );\n }\n\n // Get the footer and beforeFooter and afterFooter lines\n getFooter(tooltipItems, options) {\n const {callbacks} = options;\n\n const beforeFooter = invokeCallbackWithFallback(callbacks, 'beforeFooter', this, tooltipItems);\n const footer = invokeCallbackWithFallback(callbacks, 'footer', this, tooltipItems);\n const afterFooter = invokeCallbackWithFallback(callbacks, 'afterFooter', this, tooltipItems);\n\n let lines = [];\n lines = pushOrConcat(lines, splitNewlines(beforeFooter));\n lines = pushOrConcat(lines, splitNewlines(footer));\n lines = pushOrConcat(lines, splitNewlines(afterFooter));\n\n return lines;\n }\n\n /**\n\t * @private\n\t */\n _createItems(options) {\n const active = this._active;\n const data = this.chart.data;\n const labelColors = [];\n const labelPointStyles = [];\n const labelTextColors = [];\n let tooltipItems = [];\n let i, len;\n\n for (i = 0, len = active.length; i < len; ++i) {\n tooltipItems.push(createTooltipItem(this.chart, active[i]));\n }\n\n // If the user provided a filter function, use it to modify the tooltip items\n if (options.filter) {\n tooltipItems = tooltipItems.filter((element, index, array) => options.filter(element, index, array, data));\n }\n\n // If the user provided a sorting function, use it to modify the tooltip items\n if (options.itemSort) {\n tooltipItems = tooltipItems.sort((a, b) => options.itemSort(a, b, data));\n }\n\n // Determine colors for boxes\n each(tooltipItems, (context) => {\n const scoped = overrideCallbacks(options.callbacks, context);\n labelColors.push(invokeCallbackWithFallback(scoped, 'labelColor', this, context));\n labelPointStyles.push(invokeCallbackWithFallback(scoped, 'labelPointStyle', this, context));\n labelTextColors.push(invokeCallbackWithFallback(scoped, 'labelTextColor', this, context));\n });\n\n this.labelColors = labelColors;\n this.labelPointStyles = labelPointStyles;\n this.labelTextColors = labelTextColors;\n this.dataPoints = tooltipItems;\n return tooltipItems;\n }\n\n update(changed, replay) {\n const options = this.options.setContext(this.getContext());\n const active = this._active;\n let properties;\n let tooltipItems = [];\n\n if (!active.length) {\n if (this.opacity !== 0) {\n properties = {\n opacity: 0\n };\n }\n } else {\n const position = positioners[options.position].call(this, active, this._eventPosition);\n tooltipItems = this._createItems(options);\n\n this.title = this.getTitle(tooltipItems, options);\n this.beforeBody = this.getBeforeBody(tooltipItems, options);\n this.body = this.getBody(tooltipItems, options);\n this.afterBody = this.getAfterBody(tooltipItems, options);\n this.footer = this.getFooter(tooltipItems, options);\n\n const size = this._size = getTooltipSize(this, options);\n const positionAndSize = Object.assign({}, position, size);\n const alignment = determineAlignment(this.chart, options, positionAndSize);\n const backgroundPoint = getBackgroundPoint(options, positionAndSize, alignment, this.chart);\n\n this.xAlign = alignment.xAlign;\n this.yAlign = alignment.yAlign;\n\n properties = {\n opacity: 1,\n x: backgroundPoint.x,\n y: backgroundPoint.y,\n width: size.width,\n height: size.height,\n caretX: position.x,\n caretY: position.y\n };\n }\n\n this._tooltipItems = tooltipItems;\n this.$context = undefined;\n\n if (properties) {\n this._resolveAnimations().update(this, properties);\n }\n\n if (changed && options.external) {\n options.external.call(this, {chart: this.chart, tooltip: this, replay});\n }\n }\n\n drawCaret(tooltipPoint, ctx, size, options) {\n const caretPosition = this.getCaretPosition(tooltipPoint, size, options);\n\n ctx.lineTo(caretPosition.x1, caretPosition.y1);\n ctx.lineTo(caretPosition.x2, caretPosition.y2);\n ctx.lineTo(caretPosition.x3, caretPosition.y3);\n }\n\n getCaretPosition(tooltipPoint, size, options) {\n const {xAlign, yAlign} = this;\n const {caretSize, cornerRadius} = options;\n const {topLeft, topRight, bottomLeft, bottomRight} = toTRBLCorners(cornerRadius);\n const {x: ptX, y: ptY} = tooltipPoint;\n const {width, height} = size;\n let x1, x2, x3, y1, y2, y3;\n\n if (yAlign === 'center') {\n y2 = ptY + (height / 2);\n\n if (xAlign === 'left') {\n x1 = ptX;\n x2 = x1 - caretSize;\n\n // Left draws bottom -> top, this y1 is on the bottom\n y1 = y2 + caretSize;\n y3 = y2 - caretSize;\n } else {\n x1 = ptX + width;\n x2 = x1 + caretSize;\n\n // Right draws top -> bottom, thus y1 is on the top\n y1 = y2 - caretSize;\n y3 = y2 + caretSize;\n }\n\n x3 = x1;\n } else {\n if (xAlign === 'left') {\n x2 = ptX + Math.max(topLeft, bottomLeft) + (caretSize);\n } else if (xAlign === 'right') {\n x2 = ptX + width - Math.max(topRight, bottomRight) - caretSize;\n } else {\n x2 = this.caretX;\n }\n\n if (yAlign === 'top') {\n y1 = ptY;\n y2 = y1 - caretSize;\n\n // Top draws left -> right, thus x1 is on the left\n x1 = x2 - caretSize;\n x3 = x2 + caretSize;\n } else {\n y1 = ptY + height;\n y2 = y1 + caretSize;\n\n // Bottom draws right -> left, thus x1 is on the right\n x1 = x2 + caretSize;\n x3 = x2 - caretSize;\n }\n y3 = y1;\n }\n return {x1, x2, x3, y1, y2, y3};\n }\n\n drawTitle(pt, ctx, options) {\n const title = this.title;\n const length = title.length;\n let titleFont, titleSpacing, i;\n\n if (length) {\n const rtlHelper = getRtlAdapter(options.rtl, this.x, this.width);\n\n pt.x = getAlignedX(this, options.titleAlign, options);\n\n ctx.textAlign = rtlHelper.textAlign(options.titleAlign);\n ctx.textBaseline = 'middle';\n\n titleFont = toFont(options.titleFont);\n titleSpacing = options.titleSpacing;\n\n ctx.fillStyle = options.titleColor;\n ctx.font = titleFont.string;\n\n for (i = 0; i < length; ++i) {\n ctx.fillText(title[i], rtlHelper.x(pt.x), pt.y + titleFont.lineHeight / 2);\n pt.y += titleFont.lineHeight + titleSpacing; // Line Height and spacing\n\n if (i + 1 === length) {\n pt.y += options.titleMarginBottom - titleSpacing; // If Last, add margin, remove spacing\n }\n }\n }\n }\n\n /**\n\t * @private\n\t */\n _drawColorBox(ctx, pt, i, rtlHelper, options) {\n const labelColor = this.labelColors[i];\n const labelPointStyle = this.labelPointStyles[i];\n const {boxHeight, boxWidth} = options;\n const bodyFont = toFont(options.bodyFont);\n const colorX = getAlignedX(this, 'left', options);\n const rtlColorX = rtlHelper.x(colorX);\n const yOffSet = boxHeight < bodyFont.lineHeight ? (bodyFont.lineHeight - boxHeight) / 2 : 0;\n const colorY = pt.y + yOffSet;\n\n if (options.usePointStyle) {\n const drawOptions = {\n radius: Math.min(boxWidth, boxHeight) / 2, // fit the circle in the box\n pointStyle: labelPointStyle.pointStyle,\n rotation: labelPointStyle.rotation,\n borderWidth: 1\n };\n // Recalculate x and y for drawPoint() because its expecting\n // x and y to be center of figure (instead of top left)\n const centerX = rtlHelper.leftForLtr(rtlColorX, boxWidth) + boxWidth / 2;\n const centerY = colorY + boxHeight / 2;\n\n // Fill the point with white so that colours merge nicely if the opacity is < 1\n ctx.strokeStyle = options.multiKeyBackground;\n ctx.fillStyle = options.multiKeyBackground;\n drawPoint(ctx, drawOptions, centerX, centerY);\n\n // Draw the point\n ctx.strokeStyle = labelColor.borderColor;\n ctx.fillStyle = labelColor.backgroundColor;\n drawPoint(ctx, drawOptions, centerX, centerY);\n } else {\n // Border\n ctx.lineWidth = isObject(labelColor.borderWidth) ? Math.max(...Object.values(labelColor.borderWidth)) : (labelColor.borderWidth || 1); // TODO, v4 remove fallback\n ctx.strokeStyle = labelColor.borderColor;\n ctx.setLineDash(labelColor.borderDash || []);\n ctx.lineDashOffset = labelColor.borderDashOffset || 0;\n\n // Fill a white rect so that colours merge nicely if the opacity is < 1\n const outerX = rtlHelper.leftForLtr(rtlColorX, boxWidth);\n const innerX = rtlHelper.leftForLtr(rtlHelper.xPlus(rtlColorX, 1), boxWidth - 2);\n const borderRadius = toTRBLCorners(labelColor.borderRadius);\n\n if (Object.values(borderRadius).some(v => v !== 0)) {\n ctx.beginPath();\n ctx.fillStyle = options.multiKeyBackground;\n addRoundedRectPath(ctx, {\n x: outerX,\n y: colorY,\n w: boxWidth,\n h: boxHeight,\n radius: borderRadius,\n });\n ctx.fill();\n ctx.stroke();\n\n // Inner square\n ctx.fillStyle = labelColor.backgroundColor;\n ctx.beginPath();\n addRoundedRectPath(ctx, {\n x: innerX,\n y: colorY + 1,\n w: boxWidth - 2,\n h: boxHeight - 2,\n radius: borderRadius,\n });\n ctx.fill();\n } else {\n // Normal rect\n ctx.fillStyle = options.multiKeyBackground;\n ctx.fillRect(outerX, colorY, boxWidth, boxHeight);\n ctx.strokeRect(outerX, colorY, boxWidth, boxHeight);\n // Inner square\n ctx.fillStyle = labelColor.backgroundColor;\n ctx.fillRect(innerX, colorY + 1, boxWidth - 2, boxHeight - 2);\n }\n }\n\n // restore fillStyle\n ctx.fillStyle = this.labelTextColors[i];\n }\n\n drawBody(pt, ctx, options) {\n const {body} = this;\n const {bodySpacing, bodyAlign, displayColors, boxHeight, boxWidth, boxPadding} = options;\n const bodyFont = toFont(options.bodyFont);\n let bodyLineHeight = bodyFont.lineHeight;\n let xLinePadding = 0;\n\n const rtlHelper = getRtlAdapter(options.rtl, this.x, this.width);\n\n const fillLineOfText = function(line) {\n ctx.fillText(line, rtlHelper.x(pt.x + xLinePadding), pt.y + bodyLineHeight / 2);\n pt.y += bodyLineHeight + bodySpacing;\n };\n\n const bodyAlignForCalculation = rtlHelper.textAlign(bodyAlign);\n let bodyItem, textColor, lines, i, j, ilen, jlen;\n\n ctx.textAlign = bodyAlign;\n ctx.textBaseline = 'middle';\n ctx.font = bodyFont.string;\n\n pt.x = getAlignedX(this, bodyAlignForCalculation, options);\n\n // Before body lines\n ctx.fillStyle = options.bodyColor;\n each(this.beforeBody, fillLineOfText);\n\n xLinePadding = displayColors && bodyAlignForCalculation !== 'right'\n ? bodyAlign === 'center' ? (boxWidth / 2 + boxPadding) : (boxWidth + 2 + boxPadding)\n : 0;\n\n // Draw body lines now\n for (i = 0, ilen = body.length; i < ilen; ++i) {\n bodyItem = body[i];\n textColor = this.labelTextColors[i];\n\n ctx.fillStyle = textColor;\n each(bodyItem.before, fillLineOfText);\n\n lines = bodyItem.lines;\n // Draw Legend-like boxes if needed\n if (displayColors && lines.length) {\n this._drawColorBox(ctx, pt, i, rtlHelper, options);\n bodyLineHeight = Math.max(bodyFont.lineHeight, boxHeight);\n }\n\n for (j = 0, jlen = lines.length; j < jlen; ++j) {\n fillLineOfText(lines[j]);\n // Reset for any lines that don't include colorbox\n bodyLineHeight = bodyFont.lineHeight;\n }\n\n each(bodyItem.after, fillLineOfText);\n }\n\n // Reset back to 0 for after body\n xLinePadding = 0;\n bodyLineHeight = bodyFont.lineHeight;\n\n // After body lines\n each(this.afterBody, fillLineOfText);\n pt.y -= bodySpacing; // Remove last body spacing\n }\n\n drawFooter(pt, ctx, options) {\n const footer = this.footer;\n const length = footer.length;\n let footerFont, i;\n\n if (length) {\n const rtlHelper = getRtlAdapter(options.rtl, this.x, this.width);\n\n pt.x = getAlignedX(this, options.footerAlign, options);\n pt.y += options.footerMarginTop;\n\n ctx.textAlign = rtlHelper.textAlign(options.footerAlign);\n ctx.textBaseline = 'middle';\n\n footerFont = toFont(options.footerFont);\n\n ctx.fillStyle = options.footerColor;\n ctx.font = footerFont.string;\n\n for (i = 0; i < length; ++i) {\n ctx.fillText(footer[i], rtlHelper.x(pt.x), pt.y + footerFont.lineHeight / 2);\n pt.y += footerFont.lineHeight + options.footerSpacing;\n }\n }\n }\n\n drawBackground(pt, ctx, tooltipSize, options) {\n const {xAlign, yAlign} = this;\n const {x, y} = pt;\n const {width, height} = tooltipSize;\n const {topLeft, topRight, bottomLeft, bottomRight} = toTRBLCorners(options.cornerRadius);\n\n ctx.fillStyle = options.backgroundColor;\n ctx.strokeStyle = options.borderColor;\n ctx.lineWidth = options.borderWidth;\n\n ctx.beginPath();\n ctx.moveTo(x + topLeft, y);\n if (yAlign === 'top') {\n this.drawCaret(pt, ctx, tooltipSize, options);\n }\n ctx.lineTo(x + width - topRight, y);\n ctx.quadraticCurveTo(x + width, y, x + width, y + topRight);\n if (yAlign === 'center' && xAlign === 'right') {\n this.drawCaret(pt, ctx, tooltipSize, options);\n }\n ctx.lineTo(x + width, y + height - bottomRight);\n ctx.quadraticCurveTo(x + width, y + height, x + width - bottomRight, y + height);\n if (yAlign === 'bottom') {\n this.drawCaret(pt, ctx, tooltipSize, options);\n }\n ctx.lineTo(x + bottomLeft, y + height);\n ctx.quadraticCurveTo(x, y + height, x, y + height - bottomLeft);\n if (yAlign === 'center' && xAlign === 'left') {\n this.drawCaret(pt, ctx, tooltipSize, options);\n }\n ctx.lineTo(x, y + topLeft);\n ctx.quadraticCurveTo(x, y, x + topLeft, y);\n ctx.closePath();\n\n ctx.fill();\n\n if (options.borderWidth > 0) {\n ctx.stroke();\n }\n }\n\n /**\n\t * Update x/y animation targets when _active elements are animating too\n\t * @private\n\t */\n _updateAnimationTarget(options) {\n const chart = this.chart;\n const anims = this.$animations;\n const animX = anims && anims.x;\n const animY = anims && anims.y;\n if (animX || animY) {\n const position = positioners[options.position].call(this, this._active, this._eventPosition);\n if (!position) {\n return;\n }\n const size = this._size = getTooltipSize(this, options);\n const positionAndSize = Object.assign({}, position, this._size);\n const alignment = determineAlignment(chart, options, positionAndSize);\n const point = getBackgroundPoint(options, positionAndSize, alignment, chart);\n if (animX._to !== point.x || animY._to !== point.y) {\n this.xAlign = alignment.xAlign;\n this.yAlign = alignment.yAlign;\n this.width = size.width;\n this.height = size.height;\n this.caretX = position.x;\n this.caretY = position.y;\n this._resolveAnimations().update(this, point);\n }\n }\n }\n\n /**\n * Determine if the tooltip will draw anything\n * @returns {boolean} True if the tooltip will render\n */\n _willRender() {\n return !!this.opacity;\n }\n\n draw(ctx) {\n const options = this.options.setContext(this.getContext());\n let opacity = this.opacity;\n\n if (!opacity) {\n return;\n }\n\n this._updateAnimationTarget(options);\n\n const tooltipSize = {\n width: this.width,\n height: this.height\n };\n const pt = {\n x: this.x,\n y: this.y\n };\n\n // IE11/Edge does not like very small opacities, so snap to 0\n opacity = Math.abs(opacity) < 1e-3 ? 0 : opacity;\n\n const padding = toPadding(options.padding);\n\n // Truthy/falsey value for empty tooltip\n const hasTooltipContent = this.title.length || this.beforeBody.length || this.body.length || this.afterBody.length || this.footer.length;\n\n if (options.enabled && hasTooltipContent) {\n ctx.save();\n ctx.globalAlpha = opacity;\n\n // Draw Background\n this.drawBackground(pt, ctx, tooltipSize, options);\n\n overrideTextDirection(ctx, options.textDirection);\n\n pt.y += padding.top;\n\n // Titles\n this.drawTitle(pt, ctx, options);\n\n // Body\n this.drawBody(pt, ctx, options);\n\n // Footer\n this.drawFooter(pt, ctx, options);\n\n restoreTextDirection(ctx, options.textDirection);\n\n ctx.restore();\n }\n }\n\n /**\n\t * Get active elements in the tooltip\n\t * @returns {Array} Array of elements that are active in the tooltip\n\t */\n getActiveElements() {\n return this._active || [];\n }\n\n /**\n\t * Set active elements in the tooltip\n\t * @param {array} activeElements Array of active datasetIndex/index pairs.\n\t * @param {object} eventPosition Synthetic event position used in positioning\n\t */\n setActiveElements(activeElements, eventPosition) {\n const lastActive = this._active;\n const active = activeElements.map(({datasetIndex, index}) => {\n const meta = this.chart.getDatasetMeta(datasetIndex);\n\n if (!meta) {\n throw new Error('Cannot find a dataset at index ' + datasetIndex);\n }\n\n return {\n datasetIndex,\n element: meta.data[index],\n index,\n };\n });\n const changed = !_elementsEqual(lastActive, active);\n const positionChanged = this._positionChanged(active, eventPosition);\n\n if (changed || positionChanged) {\n this._active = active;\n this._eventPosition = eventPosition;\n this._ignoreReplayEvents = true;\n this.update(true);\n }\n }\n\n /**\n\t * Handle an event\n\t * @param {ChartEvent} e - The event to handle\n\t * @param {boolean} [replay] - This is a replayed event (from update)\n\t * @param {boolean} [inChartArea] - The event is inside chartArea\n\t * @returns {boolean} true if the tooltip changed\n\t */\n handleEvent(e, replay, inChartArea = true) {\n if (replay && this._ignoreReplayEvents) {\n return false;\n }\n this._ignoreReplayEvents = false;\n\n const options = this.options;\n const lastActive = this._active || [];\n const active = this._getActiveElements(e, lastActive, replay, inChartArea);\n\n // When there are multiple items shown, but the tooltip position is nearest mode\n // an update may need to be made because our position may have changed even though\n // the items are the same as before.\n const positionChanged = this._positionChanged(active, e);\n\n // Remember Last Actives\n const changed = replay || !_elementsEqual(active, lastActive) || positionChanged;\n\n // Only handle target event on tooltip change\n if (changed) {\n this._active = active;\n\n if (options.enabled || options.external) {\n this._eventPosition = {\n x: e.x,\n y: e.y\n };\n\n this.update(true, replay);\n }\n }\n\n return changed;\n }\n\n /**\n\t * Helper for determining the active elements for event\n\t * @param {ChartEvent} e - The event to handle\n\t * @param {InteractionItem[]} lastActive - Previously active elements\n\t * @param {boolean} [replay] - This is a replayed event (from update)\n\t * @param {boolean} [inChartArea] - The event is inside chartArea\n\t * @returns {InteractionItem[]} - Active elements\n\t * @private\n\t */\n _getActiveElements(e, lastActive, replay, inChartArea) {\n const options = this.options;\n\n if (e.type === 'mouseout') {\n return [];\n }\n\n if (!inChartArea) {\n // Let user control the active elements outside chartArea. Eg. using Legend.\n // But make sure that active elements are still valid.\n return lastActive.filter(i =>\n this.chart.data.datasets[i.datasetIndex] &&\n this.chart.getDatasetMeta(i.datasetIndex).controller.getParsed(i.index) !== undefined\n );\n }\n\n // Find Active Elements for tooltips\n const active = this.chart.getElementsAtEventForMode(e, options.mode, options, replay);\n\n if (options.reverse) {\n active.reverse();\n }\n\n return active;\n }\n\n /**\n\t * Determine if the active elements + event combination changes the\n\t * tooltip position\n\t * @param {array} active - Active elements\n\t * @param {ChartEvent} e - Event that triggered the position change\n\t * @returns {boolean} True if the position has changed\n\t */\n _positionChanged(active, e) {\n const {caretX, caretY, options} = this;\n const position = positioners[options.position].call(this, active, e);\n return position !== false && (caretX !== position.x || caretY !== position.y);\n }\n}\n\nexport default {\n id: 'tooltip',\n _element: Tooltip,\n positioners,\n\n afterInit(chart, _args, options) {\n if (options) {\n chart.tooltip = new Tooltip({chart, options});\n }\n },\n\n beforeUpdate(chart, _args, options) {\n if (chart.tooltip) {\n chart.tooltip.initialize(options);\n }\n },\n\n reset(chart, _args, options) {\n if (chart.tooltip) {\n chart.tooltip.initialize(options);\n }\n },\n\n afterDraw(chart) {\n const tooltip = chart.tooltip;\n\n if (tooltip && tooltip._willRender()) {\n const args = {\n tooltip\n };\n\n if (chart.notifyPlugins('beforeTooltipDraw', {...args, cancelable: true}) === false) {\n return;\n }\n\n tooltip.draw(chart.ctx);\n\n chart.notifyPlugins('afterTooltipDraw', args);\n }\n },\n\n afterEvent(chart, args) {\n if (chart.tooltip) {\n // If the event is replayed from `update`, we should evaluate with the final positions.\n const useFinalPosition = args.replay;\n if (chart.tooltip.handleEvent(args.event, useFinalPosition, args.inChartArea)) {\n // notify chart about the change, so it will render\n args.changed = true;\n }\n }\n },\n\n defaults: {\n enabled: true,\n external: null,\n position: 'average',\n backgroundColor: 'rgba(0,0,0,0.8)',\n titleColor: '#fff',\n titleFont: {\n weight: 'bold',\n },\n titleSpacing: 2,\n titleMarginBottom: 6,\n titleAlign: 'left',\n bodyColor: '#fff',\n bodySpacing: 2,\n bodyFont: {\n },\n bodyAlign: 'left',\n footerColor: '#fff',\n footerSpacing: 2,\n footerMarginTop: 6,\n footerFont: {\n weight: 'bold',\n },\n footerAlign: 'left',\n padding: 6,\n caretPadding: 2,\n caretSize: 5,\n cornerRadius: 6,\n boxHeight: (ctx, opts) => opts.bodyFont.size,\n boxWidth: (ctx, opts) => opts.bodyFont.size,\n multiKeyBackground: '#fff',\n displayColors: true,\n boxPadding: 0,\n borderColor: 'rgba(0,0,0,0)',\n borderWidth: 0,\n animation: {\n duration: 400,\n easing: 'easeOutQuart',\n },\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'width', 'height', 'caretX', 'caretY'],\n },\n opacity: {\n easing: 'linear',\n duration: 200\n }\n },\n callbacks: defaultCallbacks\n },\n\n defaultRoutes: {\n bodyFont: 'font',\n footerFont: 'font',\n titleFont: 'font'\n },\n\n descriptors: {\n _scriptable: (name) => name !== 'filter' && name !== 'itemSort' && name !== 'external',\n _indexable: false,\n callbacks: {\n _scriptable: false,\n _indexable: false,\n },\n animation: {\n _fallback: false\n },\n animations: {\n _fallback: 'animation'\n }\n },\n\n // Resolve additionally from `interaction` options and defaults.\n additionalOptionScopes: ['interaction']\n};\n", "import Scale from '../core/core.scale.js';\nimport {isNullOrUndef, valueOrDefault, _limitValue} from '../helpers/index.js';\n\nconst addIfString = (labels, raw, index, addedLabels) => {\n if (typeof raw === 'string') {\n index = labels.push(raw) - 1;\n addedLabels.unshift({index, label: raw});\n } else if (isNaN(raw)) {\n index = null;\n }\n return index;\n};\n\nfunction findOrAddLabel(labels, raw, index, addedLabels) {\n const first = labels.indexOf(raw);\n if (first === -1) {\n return addIfString(labels, raw, index, addedLabels);\n }\n const last = labels.lastIndexOf(raw);\n return first !== last ? index : first;\n}\n\nconst validIndex = (index, max) => index === null ? null : _limitValue(Math.round(index), 0, max);\n\nfunction _getLabelForValue(value) {\n const labels = this.getLabels();\n\n if (value >= 0 && value < labels.length) {\n return labels[value];\n }\n return value;\n}\n\nexport default class CategoryScale extends Scale {\n\n static id = 'category';\n\n /**\n * @type {any}\n */\n static defaults = {\n ticks: {\n callback: _getLabelForValue\n }\n };\n\n constructor(cfg) {\n super(cfg);\n\n /** @type {number} */\n this._startValue = undefined;\n this._valueRange = 0;\n this._addedLabels = [];\n }\n\n init(scaleOptions) {\n const added = this._addedLabels;\n if (added.length) {\n const labels = this.getLabels();\n for (const {index, label} of added) {\n if (labels[index] === label) {\n labels.splice(index, 1);\n }\n }\n this._addedLabels = [];\n }\n super.init(scaleOptions);\n }\n\n parse(raw, index) {\n if (isNullOrUndef(raw)) {\n return null;\n }\n const labels = this.getLabels();\n index = isFinite(index) && labels[index] === raw ? index\n : findOrAddLabel(labels, raw, valueOrDefault(index, raw), this._addedLabels);\n return validIndex(index, labels.length - 1);\n }\n\n determineDataLimits() {\n const {minDefined, maxDefined} = this.getUserBounds();\n let {min, max} = this.getMinMax(true);\n\n if (this.options.bounds === 'ticks') {\n if (!minDefined) {\n min = 0;\n }\n if (!maxDefined) {\n max = this.getLabels().length - 1;\n }\n }\n\n this.min = min;\n this.max = max;\n }\n\n buildTicks() {\n const min = this.min;\n const max = this.max;\n const offset = this.options.offset;\n const ticks = [];\n let labels = this.getLabels();\n\n // If we are viewing some subset of labels, slice the original array\n labels = (min === 0 && max === labels.length - 1) ? labels : labels.slice(min, max + 1);\n\n this._valueRange = Math.max(labels.length - (offset ? 0 : 1), 1);\n this._startValue = this.min - (offset ? 0.5 : 0);\n\n for (let value = min; value <= max; value++) {\n ticks.push({value});\n }\n return ticks;\n }\n\n getLabelForValue(value) {\n return _getLabelForValue.call(this, value);\n }\n\n /**\n\t * @protected\n\t */\n configure() {\n super.configure();\n\n if (!this.isHorizontal()) {\n // For backward compatibility, vertical category scale reverse is inverted.\n this._reversePixels = !this._reversePixels;\n }\n }\n\n // Used to get data value locations. Value can either be an index or a numerical value\n getPixelForValue(value) {\n if (typeof value !== 'number') {\n value = this.parse(value);\n }\n\n return value === null ? NaN : this.getPixelForDecimal((value - this._startValue) / this._valueRange);\n }\n\n // Must override base implementation because it calls getPixelForValue\n // and category scale can have duplicate values\n getPixelForTick(index) {\n const ticks = this.ticks;\n if (index < 0 || index > ticks.length - 1) {\n return null;\n }\n return this.getPixelForValue(ticks[index].value);\n }\n\n getValueForPixel(pixel) {\n return Math.round(this._startValue + this.getDecimalForPixel(pixel) * this._valueRange);\n }\n\n getBasePixel() {\n return this.bottom;\n }\n}\n", "import {isNullOrUndef} from '../helpers/helpers.core.js';\nimport {almostEquals, almostWhole, niceNum, _decimalPlaces, _setMinAndMaxByKey, sign, toRadians} from '../helpers/helpers.math.js';\nimport Scale from '../core/core.scale.js';\nimport {formatNumber} from '../helpers/helpers.intl.js';\n\n/**\n * Generate a set of linear ticks for an axis\n * 1. If generationOptions.min, generationOptions.max, and generationOptions.step are defined:\n * if (max - min) / step is an integer, ticks are generated as [min, min + step, ..., max]\n * Note that the generationOptions.maxCount setting is respected in this scenario\n *\n * 2. If generationOptions.min, generationOptions.max, and generationOptions.count is defined\n * spacing = (max - min) / count\n * Ticks are generated as [min, min + spacing, ..., max]\n *\n * 3. If generationOptions.count is defined\n * spacing = (niceMax - niceMin) / count\n *\n * 4. Compute optimal spacing of ticks using niceNum algorithm\n *\n * @param generationOptions the options used to generate the ticks\n * @param dataRange the range of the data\n * @returns {object[]} array of tick objects\n */\nfunction generateTicks(generationOptions, dataRange) {\n const ticks = [];\n // To get a \"nice\" value for the tick spacing, we will use the appropriately named\n // \"nice number\" algorithm. See https://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks\n // for details.\n\n const MIN_SPACING = 1e-14;\n const {bounds, step, min, max, precision, count, maxTicks, maxDigits, includeBounds} = generationOptions;\n const unit = step || 1;\n const maxSpaces = maxTicks - 1;\n const {min: rmin, max: rmax} = dataRange;\n const minDefined = !isNullOrUndef(min);\n const maxDefined = !isNullOrUndef(max);\n const countDefined = !isNullOrUndef(count);\n const minSpacing = (rmax - rmin) / (maxDigits + 1);\n let spacing = niceNum((rmax - rmin) / maxSpaces / unit) * unit;\n let factor, niceMin, niceMax, numSpaces;\n\n // Beyond MIN_SPACING floating point numbers being to lose precision\n // such that we can't do the math necessary to generate ticks\n if (spacing < MIN_SPACING && !minDefined && !maxDefined) {\n return [{value: rmin}, {value: rmax}];\n }\n\n numSpaces = Math.ceil(rmax / spacing) - Math.floor(rmin / spacing);\n if (numSpaces > maxSpaces) {\n // If the calculated num of spaces exceeds maxNumSpaces, recalculate it\n spacing = niceNum(numSpaces * spacing / maxSpaces / unit) * unit;\n }\n\n if (!isNullOrUndef(precision)) {\n // If the user specified a precision, round to that number of decimal places\n factor = Math.pow(10, precision);\n spacing = Math.ceil(spacing * factor) / factor;\n }\n\n if (bounds === 'ticks') {\n niceMin = Math.floor(rmin / spacing) * spacing;\n niceMax = Math.ceil(rmax / spacing) * spacing;\n } else {\n niceMin = rmin;\n niceMax = rmax;\n }\n\n if (minDefined && maxDefined && step && almostWhole((max - min) / step, spacing / 1000)) {\n // Case 1: If min, max and stepSize are set and they make an evenly spaced scale use it.\n // spacing = step;\n // numSpaces = (max - min) / spacing;\n // Note that we round here to handle the case where almostWhole translated an FP error\n numSpaces = Math.round(Math.min((max - min) / spacing, maxTicks));\n spacing = (max - min) / numSpaces;\n niceMin = min;\n niceMax = max;\n } else if (countDefined) {\n // Cases 2 & 3, we have a count specified. Handle optional user defined edges to the range.\n // Sometimes these are no-ops, but it makes the code a lot clearer\n // and when a user defined range is specified, we want the correct ticks\n niceMin = minDefined ? min : niceMin;\n niceMax = maxDefined ? max : niceMax;\n numSpaces = count - 1;\n spacing = (niceMax - niceMin) / numSpaces;\n } else {\n // Case 4\n numSpaces = (niceMax - niceMin) / spacing;\n\n // If very close to our rounded value, use it.\n if (almostEquals(numSpaces, Math.round(numSpaces), spacing / 1000)) {\n numSpaces = Math.round(numSpaces);\n } else {\n numSpaces = Math.ceil(numSpaces);\n }\n }\n\n // The spacing will have changed in cases 1, 2, and 3 so the factor cannot be computed\n // until this point\n const decimalPlaces = Math.max(\n _decimalPlaces(spacing),\n _decimalPlaces(niceMin)\n );\n factor = Math.pow(10, isNullOrUndef(precision) ? decimalPlaces : precision);\n niceMin = Math.round(niceMin * factor) / factor;\n niceMax = Math.round(niceMax * factor) / factor;\n\n let j = 0;\n if (minDefined) {\n if (includeBounds && niceMin !== min) {\n ticks.push({value: min});\n\n if (niceMin < min) {\n j++; // Skip niceMin\n }\n // If the next nice tick is close to min, skip it\n if (almostEquals(Math.round((niceMin + j * spacing) * factor) / factor, min, relativeLabelSize(min, minSpacing, generationOptions))) {\n j++;\n }\n } else if (niceMin < min) {\n j++;\n }\n }\n\n for (; j < numSpaces; ++j) {\n const tickValue = Math.round((niceMin + j * spacing) * factor) / factor;\n if (maxDefined && tickValue > max) {\n break;\n }\n ticks.push({value: tickValue});\n }\n\n if (maxDefined && includeBounds && niceMax !== max) {\n // If the previous tick is too close to max, replace it with max, else add max\n if (ticks.length && almostEquals(ticks[ticks.length - 1].value, max, relativeLabelSize(max, minSpacing, generationOptions))) {\n ticks[ticks.length - 1].value = max;\n } else {\n ticks.push({value: max});\n }\n } else if (!maxDefined || niceMax === max) {\n ticks.push({value: niceMax});\n }\n\n return ticks;\n}\n\nfunction relativeLabelSize(value, minSpacing, {horizontal, minRotation}) {\n const rad = toRadians(minRotation);\n const ratio = (horizontal ? Math.sin(rad) : Math.cos(rad)) || 0.001;\n const length = 0.75 * minSpacing * ('' + value).length;\n return Math.min(minSpacing / ratio, length);\n}\n\nexport default class LinearScaleBase extends Scale {\n\n constructor(cfg) {\n super(cfg);\n\n /** @type {number} */\n this.start = undefined;\n /** @type {number} */\n this.end = undefined;\n /** @type {number} */\n this._startValue = undefined;\n /** @type {number} */\n this._endValue = undefined;\n this._valueRange = 0;\n }\n\n parse(raw, index) { // eslint-disable-line no-unused-vars\n if (isNullOrUndef(raw)) {\n return null;\n }\n if ((typeof raw === 'number' || raw instanceof Number) && !isFinite(+raw)) {\n return null;\n }\n\n return +raw;\n }\n\n handleTickRangeOptions() {\n const {beginAtZero} = this.options;\n const {minDefined, maxDefined} = this.getUserBounds();\n let {min, max} = this;\n\n const setMin = v => (min = minDefined ? min : v);\n const setMax = v => (max = maxDefined ? max : v);\n\n if (beginAtZero) {\n const minSign = sign(min);\n const maxSign = sign(max);\n\n if (minSign < 0 && maxSign < 0) {\n setMax(0);\n } else if (minSign > 0 && maxSign > 0) {\n setMin(0);\n }\n }\n\n if (min === max) {\n let offset = max === 0 ? 1 : Math.abs(max * 0.05);\n\n setMax(max + offset);\n\n if (!beginAtZero) {\n setMin(min - offset);\n }\n }\n this.min = min;\n this.max = max;\n }\n\n getTickLimit() {\n const tickOpts = this.options.ticks;\n // eslint-disable-next-line prefer-const\n let {maxTicksLimit, stepSize} = tickOpts;\n let maxTicks;\n\n if (stepSize) {\n maxTicks = Math.ceil(this.max / stepSize) - Math.floor(this.min / stepSize) + 1;\n if (maxTicks > 1000) {\n console.warn(`scales.${this.id}.ticks.stepSize: ${stepSize} would result generating up to ${maxTicks} ticks. Limiting to 1000.`);\n maxTicks = 1000;\n }\n } else {\n maxTicks = this.computeTickLimit();\n maxTicksLimit = maxTicksLimit || 11;\n }\n\n if (maxTicksLimit) {\n maxTicks = Math.min(maxTicksLimit, maxTicks);\n }\n\n return maxTicks;\n }\n\n /**\n\t * @protected\n\t */\n computeTickLimit() {\n return Number.POSITIVE_INFINITY;\n }\n\n buildTicks() {\n const opts = this.options;\n const tickOpts = opts.ticks;\n\n // Figure out what the max number of ticks we can support it is based on the size of\n // the axis area. For now, we say that the minimum tick spacing in pixels must be 40\n // We also limit the maximum number of ticks to 11 which gives a nice 10 squares on\n // the graph. Make sure we always have at least 2 ticks\n let maxTicks = this.getTickLimit();\n maxTicks = Math.max(2, maxTicks);\n\n const numericGeneratorOptions = {\n maxTicks,\n bounds: opts.bounds,\n min: opts.min,\n max: opts.max,\n precision: tickOpts.precision,\n step: tickOpts.stepSize,\n count: tickOpts.count,\n maxDigits: this._maxDigits(),\n horizontal: this.isHorizontal(),\n minRotation: tickOpts.minRotation || 0,\n includeBounds: tickOpts.includeBounds !== false\n };\n const dataRange = this._range || this;\n const ticks = generateTicks(numericGeneratorOptions, dataRange);\n\n // At this point, we need to update our max and min given the tick values,\n // since we probably have expanded the range of the scale\n if (opts.bounds === 'ticks') {\n _setMinAndMaxByKey(ticks, this, 'value');\n }\n\n if (opts.reverse) {\n ticks.reverse();\n\n this.start = this.max;\n this.end = this.min;\n } else {\n this.start = this.min;\n this.end = this.max;\n }\n\n return ticks;\n }\n\n /**\n\t * @protected\n\t */\n configure() {\n const ticks = this.ticks;\n let start = this.min;\n let end = this.max;\n\n super.configure();\n\n if (this.options.offset && ticks.length) {\n const offset = (end - start) / Math.max(ticks.length - 1, 1) / 2;\n start -= offset;\n end += offset;\n }\n this._startValue = start;\n this._endValue = end;\n this._valueRange = end - start;\n }\n\n getLabelForValue(value) {\n return formatNumber(value, this.chart.options.locale, this.options.ticks.format);\n }\n}\n", "import {isFinite} from '../helpers/helpers.core.js';\nimport LinearScaleBase from './scale.linearbase.js';\nimport Ticks from '../core/core.ticks.js';\nimport {toRadians} from '../helpers/index.js';\n\nexport default class LinearScale extends LinearScaleBase {\n\n static id = 'linear';\n\n /**\n * @type {any}\n */\n static defaults = {\n ticks: {\n callback: Ticks.formatters.numeric\n }\n };\n\n\n determineDataLimits() {\n const {min, max} = this.getMinMax(true);\n\n this.min = isFinite(min) ? min : 0;\n this.max = isFinite(max) ? max : 1;\n\n // Common base implementation to handle min, max, beginAtZero\n this.handleTickRangeOptions();\n }\n\n /**\n\t * Returns the maximum number of ticks based on the scale dimension\n\t * @protected\n \t */\n computeTickLimit() {\n const horizontal = this.isHorizontal();\n const length = horizontal ? this.width : this.height;\n const minRotation = toRadians(this.options.ticks.minRotation);\n const ratio = (horizontal ? Math.sin(minRotation) : Math.cos(minRotation)) || 0.001;\n const tickFont = this._resolveTickFontOptions(0);\n return Math.ceil(length / Math.min(40, tickFont.lineHeight / ratio));\n }\n\n // Utils\n getPixelForValue(value) {\n return value === null ? NaN : this.getPixelForDecimal((value - this._startValue) / this._valueRange);\n }\n\n getValueForPixel(pixel) {\n return this._startValue + this.getDecimalForPixel(pixel) * this._valueRange;\n }\n}\n", "import {finiteOrDefault, isFinite} from '../helpers/helpers.core.js';\nimport {formatNumber} from '../helpers/helpers.intl.js';\nimport {_setMinAndMaxByKey, log10} from '../helpers/helpers.math.js';\nimport Scale from '../core/core.scale.js';\nimport LinearScaleBase from './scale.linearbase.js';\nimport Ticks from '../core/core.ticks.js';\n\nconst log10Floor = v => Math.floor(log10(v));\nconst changeExponent = (v, m) => Math.pow(10, log10Floor(v) + m);\n\nfunction isMajor(tickVal) {\n const remain = tickVal / (Math.pow(10, log10Floor(tickVal)));\n return remain === 1;\n}\n\nfunction steps(min, max, rangeExp) {\n const rangeStep = Math.pow(10, rangeExp);\n const start = Math.floor(min / rangeStep);\n const end = Math.ceil(max / rangeStep);\n return end - start;\n}\n\nfunction startExp(min, max) {\n const range = max - min;\n let rangeExp = log10Floor(range);\n while (steps(min, max, rangeExp) > 10) {\n rangeExp++;\n }\n while (steps(min, max, rangeExp) < 10) {\n rangeExp--;\n }\n return Math.min(rangeExp, log10Floor(min));\n}\n\n\n/**\n * Generate a set of logarithmic ticks\n * @param generationOptions the options used to generate the ticks\n * @param dataRange the range of the data\n * @returns {object[]} array of tick objects\n */\nfunction generateTicks(generationOptions, {min, max}) {\n min = finiteOrDefault(generationOptions.min, min);\n const ticks = [];\n const minExp = log10Floor(min);\n let exp = startExp(min, max);\n let precision = exp < 0 ? Math.pow(10, Math.abs(exp)) : 1;\n const stepSize = Math.pow(10, exp);\n const base = minExp > exp ? Math.pow(10, minExp) : 0;\n const start = Math.round((min - base) * precision) / precision;\n const offset = Math.floor((min - base) / stepSize / 10) * stepSize * 10;\n let significand = Math.floor((start - offset) / Math.pow(10, exp));\n let value = finiteOrDefault(generationOptions.min, Math.round((base + offset + significand * Math.pow(10, exp)) * precision) / precision);\n while (value < max) {\n ticks.push({value, major: isMajor(value), significand});\n if (significand >= 10) {\n significand = significand < 15 ? 15 : 20;\n } else {\n significand++;\n }\n if (significand >= 20) {\n exp++;\n significand = 2;\n precision = exp >= 0 ? 1 : precision;\n }\n value = Math.round((base + offset + significand * Math.pow(10, exp)) * precision) / precision;\n }\n const lastTick = finiteOrDefault(generationOptions.max, value);\n ticks.push({value: lastTick, major: isMajor(lastTick), significand});\n\n return ticks;\n}\n\nexport default class LogarithmicScale extends Scale {\n\n static id = 'logarithmic';\n\n /**\n * @type {any}\n */\n static defaults = {\n ticks: {\n callback: Ticks.formatters.logarithmic,\n major: {\n enabled: true\n }\n }\n };\n\n\n constructor(cfg) {\n super(cfg);\n\n /** @type {number} */\n this.start = undefined;\n /** @type {number} */\n this.end = undefined;\n /** @type {number} */\n this._startValue = undefined;\n this._valueRange = 0;\n }\n\n parse(raw, index) {\n const value = LinearScaleBase.prototype.parse.apply(this, [raw, index]);\n if (value === 0) {\n this._zero = true;\n return undefined;\n }\n return isFinite(value) && value > 0 ? value : null;\n }\n\n determineDataLimits() {\n const {min, max} = this.getMinMax(true);\n\n this.min = isFinite(min) ? Math.max(0, min) : null;\n this.max = isFinite(max) ? Math.max(0, max) : null;\n\n if (this.options.beginAtZero) {\n this._zero = true;\n }\n\n // if data has `0` in it or `beginAtZero` is true, min (non zero) value is at bottom\n // of scale, and it does not equal suggestedMin, lower the min bound by one exp.\n if (this._zero && this.min !== this._suggestedMin && !isFinite(this._userMin)) {\n this.min = min === changeExponent(this.min, 0) ? changeExponent(this.min, -1) : changeExponent(this.min, 0);\n }\n\n this.handleTickRangeOptions();\n }\n\n handleTickRangeOptions() {\n const {minDefined, maxDefined} = this.getUserBounds();\n let min = this.min;\n let max = this.max;\n\n const setMin = v => (min = minDefined ? min : v);\n const setMax = v => (max = maxDefined ? max : v);\n\n if (min === max) {\n if (min <= 0) { // includes null\n setMin(1);\n setMax(10);\n } else {\n setMin(changeExponent(min, -1));\n setMax(changeExponent(max, +1));\n }\n }\n if (min <= 0) {\n setMin(changeExponent(max, -1));\n }\n if (max <= 0) {\n\n setMax(changeExponent(min, +1));\n }\n\n this.min = min;\n this.max = max;\n }\n\n buildTicks() {\n const opts = this.options;\n\n const generationOptions = {\n min: this._userMin,\n max: this._userMax\n };\n const ticks = generateTicks(generationOptions, this);\n\n // At this point, we need to update our max and min given the tick values,\n // since we probably have expanded the range of the scale\n if (opts.bounds === 'ticks') {\n _setMinAndMaxByKey(ticks, this, 'value');\n }\n\n if (opts.reverse) {\n ticks.reverse();\n\n this.start = this.max;\n this.end = this.min;\n } else {\n this.start = this.min;\n this.end = this.max;\n }\n\n return ticks;\n }\n\n /**\n\t * @param {number} value\n\t * @return {string}\n\t */\n getLabelForValue(value) {\n return value === undefined\n ? '0'\n : formatNumber(value, this.chart.options.locale, this.options.ticks.format);\n }\n\n /**\n\t * @protected\n\t */\n configure() {\n const start = this.min;\n\n super.configure();\n\n this._startValue = log10(start);\n this._valueRange = log10(this.max) - log10(start);\n }\n\n getPixelForValue(value) {\n if (value === undefined || value === 0) {\n value = this.min;\n }\n if (value === null || isNaN(value)) {\n return NaN;\n }\n return this.getPixelForDecimal(value === this.min\n ? 0\n : (log10(value) - this._startValue) / this._valueRange);\n }\n\n getValueForPixel(pixel) {\n const decimal = this.getDecimalForPixel(pixel);\n return Math.pow(10, this._startValue + decimal * this._valueRange);\n }\n}\n", "import defaults from '../core/core.defaults.js';\nimport {_longestText, addRoundedRectPath, renderText, _isPointInArea} from '../helpers/helpers.canvas.js';\nimport {HALF_PI, TAU, toDegrees, toRadians, _normalizeAngle, PI} from '../helpers/helpers.math.js';\nimport LinearScaleBase from './scale.linearbase.js';\nimport Ticks from '../core/core.ticks.js';\nimport {valueOrDefault, isArray, isFinite, callback as callCallback, isNullOrUndef} from '../helpers/helpers.core.js';\nimport {createContext, toFont, toPadding, toTRBLCorners} from '../helpers/helpers.options.js';\n\nfunction getTickBackdropHeight(opts) {\n const tickOpts = opts.ticks;\n\n if (tickOpts.display && opts.display) {\n const padding = toPadding(tickOpts.backdropPadding);\n return valueOrDefault(tickOpts.font && tickOpts.font.size, defaults.font.size) + padding.height;\n }\n return 0;\n}\n\nfunction measureLabelSize(ctx, font, label) {\n label = isArray(label) ? label : [label];\n return {\n w: _longestText(ctx, font.string, label),\n h: label.length * font.lineHeight\n };\n}\n\nfunction determineLimits(angle, pos, size, min, max) {\n if (angle === min || angle === max) {\n return {\n start: pos - (size / 2),\n end: pos + (size / 2)\n };\n } else if (angle < min || angle > max) {\n return {\n start: pos - size,\n end: pos\n };\n }\n\n return {\n start: pos,\n end: pos + size\n };\n}\n\n/**\n * Helper function to fit a radial linear scale with point labels\n */\nfunction fitWithPointLabels(scale) {\n\n // Right, this is really confusing and there is a lot of maths going on here\n // The gist of the problem is here: https://gist.github.com/nnnick/696cc9c55f4b0beb8fe9\n //\n // Reaction: https://dl.dropboxusercontent.com/u/34601363/toomuchscience.gif\n //\n // Solution:\n //\n // We assume the radius of the polygon is half the size of the canvas at first\n // at each index we check if the text overlaps.\n //\n // Where it does, we store that angle and that index.\n //\n // After finding the largest index and angle we calculate how much we need to remove\n // from the shape radius to move the point inwards by that x.\n //\n // We average the left and right distances to get the maximum shape radius that can fit in the box\n // along with labels.\n //\n // Once we have that, we can find the centre point for the chart, by taking the x text protrusion\n // on each side, removing that from the size, halving it and adding the left x protrusion width.\n //\n // This will mean we have a shape fitted to the canvas, as large as it can be with the labels\n // and position it in the most space efficient manner\n //\n // https://dl.dropboxusercontent.com/u/34601363/yeahscience.gif\n\n // Get maximum radius of the polygon. Either half the height (minus the text width) or half the width.\n // Use this to calculate the offset + change. - Make sure L/R protrusion is at least 0 to stop issues with centre points\n const orig = {\n l: scale.left + scale._padding.left,\n r: scale.right - scale._padding.right,\n t: scale.top + scale._padding.top,\n b: scale.bottom - scale._padding.bottom\n };\n const limits = Object.assign({}, orig);\n const labelSizes = [];\n const padding = [];\n const valueCount = scale._pointLabels.length;\n const pointLabelOpts = scale.options.pointLabels;\n const additionalAngle = pointLabelOpts.centerPointLabels ? PI / valueCount : 0;\n\n for (let i = 0; i < valueCount; i++) {\n const opts = pointLabelOpts.setContext(scale.getPointLabelContext(i));\n padding[i] = opts.padding;\n const pointPosition = scale.getPointPosition(i, scale.drawingArea + padding[i], additionalAngle);\n const plFont = toFont(opts.font);\n const textSize = measureLabelSize(scale.ctx, plFont, scale._pointLabels[i]);\n labelSizes[i] = textSize;\n\n const angleRadians = _normalizeAngle(scale.getIndexAngle(i) + additionalAngle);\n const angle = Math.round(toDegrees(angleRadians));\n const hLimits = determineLimits(angle, pointPosition.x, textSize.w, 0, 180);\n const vLimits = determineLimits(angle, pointPosition.y, textSize.h, 90, 270);\n updateLimits(limits, orig, angleRadians, hLimits, vLimits);\n }\n\n scale.setCenterPoint(\n orig.l - limits.l,\n limits.r - orig.r,\n orig.t - limits.t,\n limits.b - orig.b\n );\n\n // Now that text size is determined, compute the full positions\n scale._pointLabelItems = buildPointLabelItems(scale, labelSizes, padding);\n}\n\nfunction updateLimits(limits, orig, angle, hLimits, vLimits) {\n const sin = Math.abs(Math.sin(angle));\n const cos = Math.abs(Math.cos(angle));\n let x = 0;\n let y = 0;\n if (hLimits.start < orig.l) {\n x = (orig.l - hLimits.start) / sin;\n limits.l = Math.min(limits.l, orig.l - x);\n } else if (hLimits.end > orig.r) {\n x = (hLimits.end - orig.r) / sin;\n limits.r = Math.max(limits.r, orig.r + x);\n }\n if (vLimits.start < orig.t) {\n y = (orig.t - vLimits.start) / cos;\n limits.t = Math.min(limits.t, orig.t - y);\n } else if (vLimits.end > orig.b) {\n y = (vLimits.end - orig.b) / cos;\n limits.b = Math.max(limits.b, orig.b + y);\n }\n}\n\nfunction createPointLabelItem(scale, index, itemOpts) {\n const outerDistance = scale.drawingArea;\n const {extra, additionalAngle, padding, size} = itemOpts;\n const pointLabelPosition = scale.getPointPosition(index, outerDistance + extra + padding, additionalAngle);\n const angle = Math.round(toDegrees(_normalizeAngle(pointLabelPosition.angle + HALF_PI)));\n const y = yForAngle(pointLabelPosition.y, size.h, angle);\n const textAlign = getTextAlignForAngle(angle);\n const left = leftForTextAlign(pointLabelPosition.x, size.w, textAlign);\n return {\n // if to draw or overlapped\n visible: true,\n\n // Text position\n x: pointLabelPosition.x,\n y,\n\n // Text rendering data\n textAlign,\n\n // Bounding box\n left,\n top: y,\n right: left + size.w,\n bottom: y + size.h\n };\n}\n\nfunction isNotOverlapped(item, area) {\n if (!area) {\n return true;\n }\n const {left, top, right, bottom} = item;\n const apexesInArea = _isPointInArea({x: left, y: top}, area) || _isPointInArea({x: left, y: bottom}, area) ||\n _isPointInArea({x: right, y: top}, area) || _isPointInArea({x: right, y: bottom}, area);\n return !apexesInArea;\n}\n\nfunction buildPointLabelItems(scale, labelSizes, padding) {\n const items = [];\n const valueCount = scale._pointLabels.length;\n const opts = scale.options;\n const {centerPointLabels, display} = opts.pointLabels;\n const itemOpts = {\n extra: getTickBackdropHeight(opts) / 2,\n additionalAngle: centerPointLabels ? PI / valueCount : 0\n };\n let area;\n\n for (let i = 0; i < valueCount; i++) {\n itemOpts.padding = padding[i];\n itemOpts.size = labelSizes[i];\n\n const item = createPointLabelItem(scale, i, itemOpts);\n items.push(item);\n if (display === 'auto') {\n item.visible = isNotOverlapped(item, area);\n if (item.visible) {\n area = item;\n }\n }\n }\n return items;\n}\n\nfunction getTextAlignForAngle(angle) {\n if (angle === 0 || angle === 180) {\n return 'center';\n } else if (angle < 180) {\n return 'left';\n }\n\n return 'right';\n}\n\nfunction leftForTextAlign(x, w, align) {\n if (align === 'right') {\n x -= w;\n } else if (align === 'center') {\n x -= (w / 2);\n }\n return x;\n}\n\nfunction yForAngle(y, h, angle) {\n if (angle === 90 || angle === 270) {\n y -= (h / 2);\n } else if (angle > 270 || angle < 90) {\n y -= h;\n }\n return y;\n}\n\nfunction drawPointLabelBox(ctx, opts, item) {\n const {left, top, right, bottom} = item;\n const {backdropColor} = opts;\n\n if (!isNullOrUndef(backdropColor)) {\n const borderRadius = toTRBLCorners(opts.borderRadius);\n const padding = toPadding(opts.backdropPadding);\n ctx.fillStyle = backdropColor;\n\n const backdropLeft = left - padding.left;\n const backdropTop = top - padding.top;\n const backdropWidth = right - left + padding.width;\n const backdropHeight = bottom - top + padding.height;\n\n if (Object.values(borderRadius).some(v => v !== 0)) {\n ctx.beginPath();\n addRoundedRectPath(ctx, {\n x: backdropLeft,\n y: backdropTop,\n w: backdropWidth,\n h: backdropHeight,\n radius: borderRadius,\n });\n ctx.fill();\n } else {\n ctx.fillRect(backdropLeft, backdropTop, backdropWidth, backdropHeight);\n }\n }\n}\n\nfunction drawPointLabels(scale, labelCount) {\n const {ctx, options: {pointLabels}} = scale;\n\n for (let i = labelCount - 1; i >= 0; i--) {\n const item = scale._pointLabelItems[i];\n if (!item.visible) {\n // overlapping\n continue;\n }\n const optsAtIndex = pointLabels.setContext(scale.getPointLabelContext(i));\n drawPointLabelBox(ctx, optsAtIndex, item);\n const plFont = toFont(optsAtIndex.font);\n const {x, y, textAlign} = item;\n\n renderText(\n ctx,\n scale._pointLabels[i],\n x,\n y + (plFont.lineHeight / 2),\n plFont,\n {\n color: optsAtIndex.color,\n textAlign: textAlign,\n textBaseline: 'middle'\n }\n );\n }\n}\n\nfunction pathRadiusLine(scale, radius, circular, labelCount) {\n const {ctx} = scale;\n if (circular) {\n // Draw circular arcs between the points\n ctx.arc(scale.xCenter, scale.yCenter, radius, 0, TAU);\n } else {\n // Draw straight lines connecting each index\n let pointPosition = scale.getPointPosition(0, radius);\n ctx.moveTo(pointPosition.x, pointPosition.y);\n\n for (let i = 1; i < labelCount; i++) {\n pointPosition = scale.getPointPosition(i, radius);\n ctx.lineTo(pointPosition.x, pointPosition.y);\n }\n }\n}\n\nfunction drawRadiusLine(scale, gridLineOpts, radius, labelCount, borderOpts) {\n const ctx = scale.ctx;\n const circular = gridLineOpts.circular;\n\n const {color, lineWidth} = gridLineOpts;\n\n if ((!circular && !labelCount) || !color || !lineWidth || radius < 0) {\n return;\n }\n\n ctx.save();\n ctx.strokeStyle = color;\n ctx.lineWidth = lineWidth;\n ctx.setLineDash(borderOpts.dash || []);\n ctx.lineDashOffset = borderOpts.dashOffset;\n\n ctx.beginPath();\n pathRadiusLine(scale, radius, circular, labelCount);\n ctx.closePath();\n ctx.stroke();\n ctx.restore();\n}\n\nfunction createPointLabelContext(parent, index, label) {\n return createContext(parent, {\n label,\n index,\n type: 'pointLabel'\n });\n}\n\nexport default class RadialLinearScale extends LinearScaleBase {\n\n static id = 'radialLinear';\n\n /**\n * @type {any}\n */\n static defaults = {\n display: true,\n\n // Boolean - Whether to animate scaling the chart from the centre\n animate: true,\n position: 'chartArea',\n\n angleLines: {\n display: true,\n lineWidth: 1,\n borderDash: [],\n borderDashOffset: 0.0\n },\n\n grid: {\n circular: false\n },\n\n startAngle: 0,\n\n // label settings\n ticks: {\n // Boolean - Show a backdrop to the scale label\n showLabelBackdrop: true,\n\n callback: Ticks.formatters.numeric\n },\n\n pointLabels: {\n backdropColor: undefined,\n\n // Number - The backdrop padding above & below the label in pixels\n backdropPadding: 2,\n\n // Boolean - if true, show point labels\n display: true,\n\n // Number - Point label font size in pixels\n font: {\n size: 10\n },\n\n // Function - Used to convert point labels\n callback(label) {\n return label;\n },\n\n // Number - Additionl padding between scale and pointLabel\n padding: 5,\n\n // Boolean - if true, center point labels to slices in polar chart\n centerPointLabels: false\n }\n };\n\n static defaultRoutes = {\n 'angleLines.color': 'borderColor',\n 'pointLabels.color': 'color',\n 'ticks.color': 'color'\n };\n\n static descriptors = {\n angleLines: {\n _fallback: 'grid'\n }\n };\n\n constructor(cfg) {\n super(cfg);\n\n /** @type {number} */\n this.xCenter = undefined;\n /** @type {number} */\n this.yCenter = undefined;\n /** @type {number} */\n this.drawingArea = undefined;\n /** @type {string[]} */\n this._pointLabels = [];\n this._pointLabelItems = [];\n }\n\n setDimensions() {\n // Set the unconstrained dimension before label rotation\n const padding = this._padding = toPadding(getTickBackdropHeight(this.options) / 2);\n const w = this.width = this.maxWidth - padding.width;\n const h = this.height = this.maxHeight - padding.height;\n this.xCenter = Math.floor(this.left + w / 2 + padding.left);\n this.yCenter = Math.floor(this.top + h / 2 + padding.top);\n this.drawingArea = Math.floor(Math.min(w, h) / 2);\n }\n\n determineDataLimits() {\n const {min, max} = this.getMinMax(false);\n\n this.min = isFinite(min) && !isNaN(min) ? min : 0;\n this.max = isFinite(max) && !isNaN(max) ? max : 0;\n\n // Common base implementation to handle min, max, beginAtZero\n this.handleTickRangeOptions();\n }\n\n /**\n\t * Returns the maximum number of ticks based on the scale dimension\n\t * @protected\n\t */\n computeTickLimit() {\n return Math.ceil(this.drawingArea / getTickBackdropHeight(this.options));\n }\n\n generateTickLabels(ticks) {\n LinearScaleBase.prototype.generateTickLabels.call(this, ticks);\n\n // Point labels\n this._pointLabels = this.getLabels()\n .map((value, index) => {\n const label = callCallback(this.options.pointLabels.callback, [value, index], this);\n return label || label === 0 ? label : '';\n })\n .filter((v, i) => this.chart.getDataVisibility(i));\n }\n\n fit() {\n const opts = this.options;\n\n if (opts.display && opts.pointLabels.display) {\n fitWithPointLabels(this);\n } else {\n this.setCenterPoint(0, 0, 0, 0);\n }\n }\n\n setCenterPoint(leftMovement, rightMovement, topMovement, bottomMovement) {\n this.xCenter += Math.floor((leftMovement - rightMovement) / 2);\n this.yCenter += Math.floor((topMovement - bottomMovement) / 2);\n this.drawingArea -= Math.min(this.drawingArea / 2, Math.max(leftMovement, rightMovement, topMovement, bottomMovement));\n }\n\n getIndexAngle(index) {\n const angleMultiplier = TAU / (this._pointLabels.length || 1);\n const startAngle = this.options.startAngle || 0;\n\n return _normalizeAngle(index * angleMultiplier + toRadians(startAngle));\n }\n\n getDistanceFromCenterForValue(value) {\n if (isNullOrUndef(value)) {\n return NaN;\n }\n\n // Take into account half font size + the yPadding of the top value\n const scalingFactor = this.drawingArea / (this.max - this.min);\n if (this.options.reverse) {\n return (this.max - value) * scalingFactor;\n }\n return (value - this.min) * scalingFactor;\n }\n\n getValueForDistanceFromCenter(distance) {\n if (isNullOrUndef(distance)) {\n return NaN;\n }\n\n const scaledDistance = distance / (this.drawingArea / (this.max - this.min));\n return this.options.reverse ? this.max - scaledDistance : this.min + scaledDistance;\n }\n\n getPointLabelContext(index) {\n const pointLabels = this._pointLabels || [];\n\n if (index >= 0 && index < pointLabels.length) {\n const pointLabel = pointLabels[index];\n return createPointLabelContext(this.getContext(), index, pointLabel);\n }\n }\n\n getPointPosition(index, distanceFromCenter, additionalAngle = 0) {\n const angle = this.getIndexAngle(index) - HALF_PI + additionalAngle;\n return {\n x: Math.cos(angle) * distanceFromCenter + this.xCenter,\n y: Math.sin(angle) * distanceFromCenter + this.yCenter,\n angle\n };\n }\n\n getPointPositionForValue(index, value) {\n return this.getPointPosition(index, this.getDistanceFromCenterForValue(value));\n }\n\n getBasePosition(index) {\n return this.getPointPositionForValue(index || 0, this.getBaseValue());\n }\n\n getPointLabelPosition(index) {\n const {left, top, right, bottom} = this._pointLabelItems[index];\n return {\n left,\n top,\n right,\n bottom,\n };\n }\n\n /**\n\t * @protected\n\t */\n drawBackground() {\n const {backgroundColor, grid: {circular}} = this.options;\n if (backgroundColor) {\n const ctx = this.ctx;\n ctx.save();\n ctx.beginPath();\n pathRadiusLine(this, this.getDistanceFromCenterForValue(this._endValue), circular, this._pointLabels.length);\n ctx.closePath();\n ctx.fillStyle = backgroundColor;\n ctx.fill();\n ctx.restore();\n }\n }\n\n /**\n\t * @protected\n\t */\n drawGrid() {\n const ctx = this.ctx;\n const opts = this.options;\n const {angleLines, grid, border} = opts;\n const labelCount = this._pointLabels.length;\n\n let i, offset, position;\n\n if (opts.pointLabels.display) {\n drawPointLabels(this, labelCount);\n }\n\n if (grid.display) {\n this.ticks.forEach((tick, index) => {\n if (index !== 0 || (index === 0 && this.min < 0)) {\n offset = this.getDistanceFromCenterForValue(tick.value);\n const context = this.getContext(index);\n const optsAtIndex = grid.setContext(context);\n const optsAtIndexBorder = border.setContext(context);\n\n drawRadiusLine(this, optsAtIndex, offset, labelCount, optsAtIndexBorder);\n }\n });\n }\n\n if (angleLines.display) {\n ctx.save();\n\n for (i = labelCount - 1; i >= 0; i--) {\n const optsAtIndex = angleLines.setContext(this.getPointLabelContext(i));\n const {color, lineWidth} = optsAtIndex;\n\n if (!lineWidth || !color) {\n continue;\n }\n\n ctx.lineWidth = lineWidth;\n ctx.strokeStyle = color;\n\n ctx.setLineDash(optsAtIndex.borderDash);\n ctx.lineDashOffset = optsAtIndex.borderDashOffset;\n\n offset = this.getDistanceFromCenterForValue(opts.reverse ? this.min : this.max);\n position = this.getPointPosition(i, offset);\n ctx.beginPath();\n ctx.moveTo(this.xCenter, this.yCenter);\n ctx.lineTo(position.x, position.y);\n ctx.stroke();\n }\n\n ctx.restore();\n }\n }\n\n /**\n\t * @protected\n\t */\n drawBorder() {}\n\n /**\n\t * @protected\n\t */\n drawLabels() {\n const ctx = this.ctx;\n const opts = this.options;\n const tickOpts = opts.ticks;\n\n if (!tickOpts.display) {\n return;\n }\n\n const startAngle = this.getIndexAngle(0);\n let offset, width;\n\n ctx.save();\n ctx.translate(this.xCenter, this.yCenter);\n ctx.rotate(startAngle);\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n\n this.ticks.forEach((tick, index) => {\n if ((index === 0 && this.min >= 0) && !opts.reverse) {\n return;\n }\n\n const optsAtIndex = tickOpts.setContext(this.getContext(index));\n const tickFont = toFont(optsAtIndex.font);\n offset = this.getDistanceFromCenterForValue(this.ticks[index].value);\n\n if (optsAtIndex.showLabelBackdrop) {\n ctx.font = tickFont.string;\n width = ctx.measureText(tick.label).width;\n ctx.fillStyle = optsAtIndex.backdropColor;\n\n const padding = toPadding(optsAtIndex.backdropPadding);\n ctx.fillRect(\n -width / 2 - padding.left,\n -offset - tickFont.size / 2 - padding.top,\n width + padding.width,\n tickFont.size + padding.height\n );\n }\n\n renderText(ctx, tick.label, 0, -offset, tickFont, {\n color: optsAtIndex.color,\n strokeColor: optsAtIndex.textStrokeColor,\n strokeWidth: optsAtIndex.textStrokeWidth,\n });\n });\n\n ctx.restore();\n }\n\n /**\n\t * @protected\n\t */\n drawTitle() {}\n}\n", "import adapters from '../core/core.adapters.js';\nimport {callback as call, isFinite, isNullOrUndef, mergeIf, valueOrDefault} from '../helpers/helpers.core.js';\nimport {toRadians, isNumber, _limitValue} from '../helpers/helpers.math.js';\nimport Scale from '../core/core.scale.js';\nimport {_arrayUnique, _filterBetween, _lookup} from '../helpers/helpers.collection.js';\n\n/**\n * @typedef { import('../core/core.adapters.js').TimeUnit } Unit\n * @typedef {{common: boolean, size: number, steps?: number}} Interval\n * @typedef { import('../core/core.adapters.js').DateAdapter } DateAdapter\n */\n\n/**\n * @type {Object}\n */\nconst INTERVALS = {\n millisecond: {common: true, size: 1, steps: 1000},\n second: {common: true, size: 1000, steps: 60},\n minute: {common: true, size: 60000, steps: 60},\n hour: {common: true, size: 3600000, steps: 24},\n day: {common: true, size: 86400000, steps: 30},\n week: {common: false, size: 604800000, steps: 4},\n month: {common: true, size: 2.628e9, steps: 12},\n quarter: {common: false, size: 7.884e9, steps: 4},\n year: {common: true, size: 3.154e10}\n};\n\n/**\n * @type {Unit[]}\n */\nconst UNITS = /** @type Unit[] */ /* #__PURE__ */ (Object.keys(INTERVALS));\n\n/**\n * @param {number} a\n * @param {number} b\n */\nfunction sorter(a, b) {\n return a - b;\n}\n\n/**\n * @param {TimeScale} scale\n * @param {*} input\n * @return {number}\n */\nfunction parse(scale, input) {\n if (isNullOrUndef(input)) {\n return null;\n }\n\n const adapter = scale._adapter;\n const {parser, round, isoWeekday} = scale._parseOpts;\n let value = input;\n\n if (typeof parser === 'function') {\n value = parser(value);\n }\n\n // Only parse if it's not a timestamp already\n if (!isFinite(value)) {\n value = typeof parser === 'string'\n ? adapter.parse(value, parser)\n : adapter.parse(value);\n }\n\n if (value === null) {\n return null;\n }\n\n if (round) {\n value = round === 'week' && (isNumber(isoWeekday) || isoWeekday === true)\n ? adapter.startOf(value, 'isoWeek', isoWeekday)\n : adapter.startOf(value, round);\n }\n\n return +value;\n}\n\n/**\n * Figures out what unit results in an appropriate number of auto-generated ticks\n * @param {Unit} minUnit\n * @param {number} min\n * @param {number} max\n * @param {number} capacity\n * @return {object}\n */\nfunction determineUnitForAutoTicks(minUnit, min, max, capacity) {\n const ilen = UNITS.length;\n\n for (let i = UNITS.indexOf(minUnit); i < ilen - 1; ++i) {\n const interval = INTERVALS[UNITS[i]];\n const factor = interval.steps ? interval.steps : Number.MAX_SAFE_INTEGER;\n\n if (interval.common && Math.ceil((max - min) / (factor * interval.size)) <= capacity) {\n return UNITS[i];\n }\n }\n\n return UNITS[ilen - 1];\n}\n\n/**\n * Figures out what unit to format a set of ticks with\n * @param {TimeScale} scale\n * @param {number} numTicks\n * @param {Unit} minUnit\n * @param {number} min\n * @param {number} max\n * @return {Unit}\n */\nfunction determineUnitForFormatting(scale, numTicks, minUnit, min, max) {\n for (let i = UNITS.length - 1; i >= UNITS.indexOf(minUnit); i--) {\n const unit = UNITS[i];\n if (INTERVALS[unit].common && scale._adapter.diff(max, min, unit) >= numTicks - 1) {\n return unit;\n }\n }\n\n return UNITS[minUnit ? UNITS.indexOf(minUnit) : 0];\n}\n\n/**\n * @param {Unit} unit\n * @return {object}\n */\nfunction determineMajorUnit(unit) {\n for (let i = UNITS.indexOf(unit) + 1, ilen = UNITS.length; i < ilen; ++i) {\n if (INTERVALS[UNITS[i]].common) {\n return UNITS[i];\n }\n }\n}\n\n/**\n * @param {object} ticks\n * @param {number} time\n * @param {number[]} [timestamps] - if defined, snap to these timestamps\n */\nfunction addTick(ticks, time, timestamps) {\n if (!timestamps) {\n ticks[time] = true;\n } else if (timestamps.length) {\n const {lo, hi} = _lookup(timestamps, time);\n const timestamp = timestamps[lo] >= time ? timestamps[lo] : timestamps[hi];\n ticks[timestamp] = true;\n }\n}\n\n/**\n * @param {TimeScale} scale\n * @param {object[]} ticks\n * @param {object} map\n * @param {Unit} majorUnit\n * @return {object[]}\n */\nfunction setMajorTicks(scale, ticks, map, majorUnit) {\n const adapter = scale._adapter;\n const first = +adapter.startOf(ticks[0].value, majorUnit);\n const last = ticks[ticks.length - 1].value;\n let major, index;\n\n for (major = first; major <= last; major = +adapter.add(major, 1, majorUnit)) {\n index = map[major];\n if (index >= 0) {\n ticks[index].major = true;\n }\n }\n return ticks;\n}\n\n/**\n * @param {TimeScale} scale\n * @param {number[]} values\n * @param {Unit|undefined} [majorUnit]\n * @return {object[]}\n */\nfunction ticksFromTimestamps(scale, values, majorUnit) {\n const ticks = [];\n /** @type {Object} */\n const map = {};\n const ilen = values.length;\n let i, value;\n\n for (i = 0; i < ilen; ++i) {\n value = values[i];\n map[value] = i;\n\n ticks.push({\n value,\n major: false\n });\n }\n\n // We set the major ticks separately from the above loop because calling startOf for every tick\n // is expensive when there is a large number of ticks\n return (ilen === 0 || !majorUnit) ? ticks : setMajorTicks(scale, ticks, map, majorUnit);\n}\n\nexport default class TimeScale extends Scale {\n\n static id = 'time';\n\n /**\n * @type {any}\n */\n static defaults = {\n /**\n * Scale boundary strategy (bypassed by min/max time options)\n * - `data`: make sure data are fully visible, ticks outside are removed\n * - `ticks`: make sure ticks are fully visible, data outside are truncated\n * @see https://github.com/chartjs/Chart.js/pull/4556\n * @since 2.7.0\n */\n bounds: 'data',\n\n adapters: {},\n time: {\n parser: false, // false == a pattern string from or a custom callback that converts its argument to a timestamp\n unit: false, // false == automatic or override with week, month, year, etc.\n round: false, // none, or override with week, month, year, etc.\n isoWeekday: false, // override week start day\n minUnit: 'millisecond',\n displayFormats: {}\n },\n ticks: {\n /**\n * Ticks generation input values:\n * - 'auto': generates \"optimal\" ticks based on scale size and time options.\n * - 'data': generates ticks from data (including labels from data {t|x|y} objects).\n * - 'labels': generates ticks from user given `data.labels` values ONLY.\n * @see https://github.com/chartjs/Chart.js/pull/4507\n * @since 2.7.0\n */\n source: 'auto',\n\n callback: false,\n\n major: {\n enabled: false\n }\n }\n };\n\n /**\n\t * @param {object} props\n\t */\n constructor(props) {\n super(props);\n\n /** @type {{data: number[], labels: number[], all: number[]}} */\n this._cache = {\n data: [],\n labels: [],\n all: []\n };\n\n /** @type {Unit} */\n this._unit = 'day';\n /** @type {Unit=} */\n this._majorUnit = undefined;\n this._offsets = {};\n this._normalized = false;\n this._parseOpts = undefined;\n }\n\n init(scaleOpts, opts = {}) {\n const time = scaleOpts.time || (scaleOpts.time = {});\n /** @type {DateAdapter} */\n const adapter = this._adapter = new adapters._date(scaleOpts.adapters.date);\n\n adapter.init(opts);\n\n // Backward compatibility: before introducing adapter, `displayFormats` was\n // supposed to contain *all* unit/string pairs but this can't be resolved\n // when loading the scale (adapters are loaded afterward), so let's populate\n // missing formats on update\n mergeIf(time.displayFormats, adapter.formats());\n\n this._parseOpts = {\n parser: time.parser,\n round: time.round,\n isoWeekday: time.isoWeekday\n };\n\n super.init(scaleOpts);\n\n this._normalized = opts.normalized;\n }\n\n /**\n\t * @param {*} raw\n\t * @param {number?} [index]\n\t * @return {number}\n\t */\n parse(raw, index) { // eslint-disable-line no-unused-vars\n if (raw === undefined) {\n return null;\n }\n return parse(this, raw);\n }\n\n beforeLayout() {\n super.beforeLayout();\n this._cache = {\n data: [],\n labels: [],\n all: []\n };\n }\n\n determineDataLimits() {\n const options = this.options;\n const adapter = this._adapter;\n const unit = options.time.unit || 'day';\n // eslint-disable-next-line prefer-const\n let {min, max, minDefined, maxDefined} = this.getUserBounds();\n\n /**\n\t\t * @param {object} bounds\n\t\t */\n function _applyBounds(bounds) {\n if (!minDefined && !isNaN(bounds.min)) {\n min = Math.min(min, bounds.min);\n }\n if (!maxDefined && !isNaN(bounds.max)) {\n max = Math.max(max, bounds.max);\n }\n }\n\n // If we have user provided `min` and `max` labels / data bounds can be ignored\n if (!minDefined || !maxDefined) {\n // Labels are always considered, when user did not force bounds\n _applyBounds(this._getLabelBounds());\n\n // If `bounds` is `'ticks'` and `ticks.source` is `'labels'`,\n // data bounds are ignored (and don't need to be determined)\n if (options.bounds !== 'ticks' || options.ticks.source !== 'labels') {\n _applyBounds(this.getMinMax(false));\n }\n }\n\n min = isFinite(min) && !isNaN(min) ? min : +adapter.startOf(Date.now(), unit);\n max = isFinite(max) && !isNaN(max) ? max : +adapter.endOf(Date.now(), unit) + 1;\n\n // Make sure that max is strictly higher than min (required by the timeseries lookup table)\n this.min = Math.min(min, max - 1);\n this.max = Math.max(min + 1, max);\n }\n\n /**\n\t * @private\n\t */\n _getLabelBounds() {\n const arr = this.getLabelTimestamps();\n let min = Number.POSITIVE_INFINITY;\n let max = Number.NEGATIVE_INFINITY;\n\n if (arr.length) {\n min = arr[0];\n max = arr[arr.length - 1];\n }\n return {min, max};\n }\n\n /**\n\t * @return {object[]}\n\t */\n buildTicks() {\n const options = this.options;\n const timeOpts = options.time;\n const tickOpts = options.ticks;\n const timestamps = tickOpts.source === 'labels' ? this.getLabelTimestamps() : this._generate();\n\n if (options.bounds === 'ticks' && timestamps.length) {\n this.min = this._userMin || timestamps[0];\n this.max = this._userMax || timestamps[timestamps.length - 1];\n }\n\n const min = this.min;\n const max = this.max;\n\n const ticks = _filterBetween(timestamps, min, max);\n\n // PRIVATE\n // determineUnitForFormatting relies on the number of ticks so we don't use it when\n // autoSkip is enabled because we don't yet know what the final number of ticks will be\n this._unit = timeOpts.unit || (tickOpts.autoSkip\n ? determineUnitForAutoTicks(timeOpts.minUnit, this.min, this.max, this._getLabelCapacity(min))\n : determineUnitForFormatting(this, ticks.length, timeOpts.minUnit, this.min, this.max));\n this._majorUnit = !tickOpts.major.enabled || this._unit === 'year' ? undefined\n : determineMajorUnit(this._unit);\n this.initOffsets(timestamps);\n\n if (options.reverse) {\n ticks.reverse();\n }\n\n return ticksFromTimestamps(this, ticks, this._majorUnit);\n }\n\n afterAutoSkip() {\n // Offsets for bar charts need to be handled with the auto skipped\n // ticks. Once ticks have been skipped, we re-compute the offsets.\n if (this.options.offsetAfterAutoskip) {\n this.initOffsets(this.ticks.map(tick => +tick.value));\n }\n }\n\n /**\n\t * Returns the start and end offsets from edges in the form of {start, end}\n\t * where each value is a relative width to the scale and ranges between 0 and 1.\n\t * They add extra margins on the both sides by scaling down the original scale.\n\t * Offsets are added when the `offset` option is true.\n\t * @param {number[]} timestamps\n\t * @protected\n\t */\n initOffsets(timestamps = []) {\n let start = 0;\n let end = 0;\n let first, last;\n\n if (this.options.offset && timestamps.length) {\n first = this.getDecimalForValue(timestamps[0]);\n if (timestamps.length === 1) {\n start = 1 - first;\n } else {\n start = (this.getDecimalForValue(timestamps[1]) - first) / 2;\n }\n last = this.getDecimalForValue(timestamps[timestamps.length - 1]);\n if (timestamps.length === 1) {\n end = last;\n } else {\n end = (last - this.getDecimalForValue(timestamps[timestamps.length - 2])) / 2;\n }\n }\n const limit = timestamps.length < 3 ? 0.5 : 0.25;\n start = _limitValue(start, 0, limit);\n end = _limitValue(end, 0, limit);\n\n this._offsets = {start, end, factor: 1 / (start + 1 + end)};\n }\n\n /**\n\t * Generates a maximum of `capacity` timestamps between min and max, rounded to the\n\t * `minor` unit using the given scale time `options`.\n\t * Important: this method can return ticks outside the min and max range, it's the\n\t * responsibility of the calling code to clamp values if needed.\n\t * @protected\n\t */\n _generate() {\n const adapter = this._adapter;\n const min = this.min;\n const max = this.max;\n const options = this.options;\n const timeOpts = options.time;\n // @ts-ignore\n const minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, this._getLabelCapacity(min));\n const stepSize = valueOrDefault(options.ticks.stepSize, 1);\n const weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n const hasWeekday = isNumber(weekday) || weekday === true;\n const ticks = {};\n let first = min;\n let time, count;\n\n // For 'week' unit, handle the first day of week option\n if (hasWeekday) {\n first = +adapter.startOf(first, 'isoWeek', weekday);\n }\n\n // Align first ticks on unit\n first = +adapter.startOf(first, hasWeekday ? 'day' : minor);\n\n // Prevent browser from freezing in case user options request millions of milliseconds\n if (adapter.diff(max, min, minor) > 100000 * stepSize) {\n throw new Error(min + ' and ' + max + ' are too far apart with stepSize of ' + stepSize + ' ' + minor);\n }\n\n const timestamps = options.ticks.source === 'data' && this.getDataTimestamps();\n for (time = first, count = 0; time < max; time = +adapter.add(time, stepSize, minor), count++) {\n addTick(ticks, time, timestamps);\n }\n\n if (time === max || options.bounds === 'ticks' || count === 1) {\n addTick(ticks, time, timestamps);\n }\n\n // @ts-ignore\n return Object.keys(ticks).sort(sorter).map(x => +x);\n }\n\n /**\n\t * @param {number} value\n\t * @return {string}\n\t */\n getLabelForValue(value) {\n const adapter = this._adapter;\n const timeOpts = this.options.time;\n\n if (timeOpts.tooltipFormat) {\n return adapter.format(value, timeOpts.tooltipFormat);\n }\n return adapter.format(value, timeOpts.displayFormats.datetime);\n }\n\n /**\n\t * @param {number} value\n\t * @param {string|undefined} format\n\t * @return {string}\n\t */\n format(value, format) {\n const options = this.options;\n const formats = options.time.displayFormats;\n const unit = this._unit;\n const fmt = format || formats[unit];\n return this._adapter.format(value, fmt);\n }\n\n /**\n\t * Function to format an individual tick mark\n\t * @param {number} time\n\t * @param {number} index\n\t * @param {object[]} ticks\n\t * @param {string|undefined} [format]\n\t * @return {string}\n\t * @private\n\t */\n _tickFormatFunction(time, index, ticks, format) {\n const options = this.options;\n const formatter = options.ticks.callback;\n\n if (formatter) {\n return call(formatter, [time, index, ticks], this);\n }\n\n const formats = options.time.displayFormats;\n const unit = this._unit;\n const majorUnit = this._majorUnit;\n const minorFormat = unit && formats[unit];\n const majorFormat = majorUnit && formats[majorUnit];\n const tick = ticks[index];\n const major = majorUnit && majorFormat && tick && tick.major;\n\n return this._adapter.format(time, format || (major ? majorFormat : minorFormat));\n }\n\n /**\n\t * @param {object[]} ticks\n\t */\n generateTickLabels(ticks) {\n let i, ilen, tick;\n\n for (i = 0, ilen = ticks.length; i < ilen; ++i) {\n tick = ticks[i];\n tick.label = this._tickFormatFunction(tick.value, i, ticks);\n }\n }\n\n /**\n\t * @param {number} value - Milliseconds since epoch (1 January 1970 00:00:00 UTC)\n\t * @return {number}\n\t */\n getDecimalForValue(value) {\n return value === null ? NaN : (value - this.min) / (this.max - this.min);\n }\n\n /**\n\t * @param {number} value - Milliseconds since epoch (1 January 1970 00:00:00 UTC)\n\t * @return {number}\n\t */\n getPixelForValue(value) {\n const offsets = this._offsets;\n const pos = this.getDecimalForValue(value);\n return this.getPixelForDecimal((offsets.start + pos) * offsets.factor);\n }\n\n /**\n\t * @param {number} pixel\n\t * @return {number}\n\t */\n getValueForPixel(pixel) {\n const offsets = this._offsets;\n const pos = this.getDecimalForPixel(pixel) / offsets.factor - offsets.end;\n return this.min + pos * (this.max - this.min);\n }\n\n /**\n\t * @param {string} label\n\t * @return {{w:number, h:number}}\n\t * @private\n\t */\n _getLabelSize(label) {\n const ticksOpts = this.options.ticks;\n const tickLabelWidth = this.ctx.measureText(label).width;\n const angle = toRadians(this.isHorizontal() ? ticksOpts.maxRotation : ticksOpts.minRotation);\n const cosRotation = Math.cos(angle);\n const sinRotation = Math.sin(angle);\n const tickFontSize = this._resolveTickFontOptions(0).size;\n\n return {\n w: (tickLabelWidth * cosRotation) + (tickFontSize * sinRotation),\n h: (tickLabelWidth * sinRotation) + (tickFontSize * cosRotation)\n };\n }\n\n /**\n\t * @param {number} exampleTime\n\t * @return {number}\n\t * @private\n\t */\n _getLabelCapacity(exampleTime) {\n const timeOpts = this.options.time;\n const displayFormats = timeOpts.displayFormats;\n\n // pick the longest format (milliseconds) for guesstimation\n const format = displayFormats[timeOpts.unit] || displayFormats.millisecond;\n const exampleLabel = this._tickFormatFunction(exampleTime, 0, ticksFromTimestamps(this, [exampleTime], this._majorUnit), format);\n const size = this._getLabelSize(exampleLabel);\n // subtract 1 - if offset then there's one less label than tick\n // if not offset then one half label padding is added to each end leaving room for one less label\n const capacity = Math.floor(this.isHorizontal() ? this.width / size.w : this.height / size.h) - 1;\n return capacity > 0 ? capacity : 1;\n }\n\n /**\n\t * @protected\n\t */\n getDataTimestamps() {\n let timestamps = this._cache.data || [];\n let i, ilen;\n\n if (timestamps.length) {\n return timestamps;\n }\n\n const metas = this.getMatchingVisibleMetas();\n\n if (this._normalized && metas.length) {\n return (this._cache.data = metas[0].controller.getAllParsedValues(this));\n }\n\n for (i = 0, ilen = metas.length; i < ilen; ++i) {\n timestamps = timestamps.concat(metas[i].controller.getAllParsedValues(this));\n }\n\n return (this._cache.data = this.normalize(timestamps));\n }\n\n /**\n\t * @protected\n\t */\n getLabelTimestamps() {\n const timestamps = this._cache.labels || [];\n let i, ilen;\n\n if (timestamps.length) {\n return timestamps;\n }\n\n const labels = this.getLabels();\n for (i = 0, ilen = labels.length; i < ilen; ++i) {\n timestamps.push(parse(this, labels[i]));\n }\n\n return (this._cache.labels = this._normalized ? timestamps : this.normalize(timestamps));\n }\n\n /**\n\t * @param {number[]} values\n\t * @protected\n\t */\n normalize(values) {\n // It seems to be somewhat faster to do sorting first\n return _arrayUnique(values.sort(sorter));\n }\n}\n", "import TimeScale from './scale.time.js';\nimport {_lookupByKey} from '../helpers/helpers.collection.js';\n\n/**\n * Linearly interpolates the given source `val` using the table. If value is out of bounds, values\n * at edges are used for the interpolation.\n * @param {object} table\n * @param {number} val\n * @param {boolean} [reverse] lookup time based on position instead of vice versa\n * @return {object}\n */\nfunction interpolate(table, val, reverse) {\n let lo = 0;\n let hi = table.length - 1;\n let prevSource, nextSource, prevTarget, nextTarget;\n if (reverse) {\n if (val >= table[lo].pos && val <= table[hi].pos) {\n ({lo, hi} = _lookupByKey(table, 'pos', val));\n }\n ({pos: prevSource, time: prevTarget} = table[lo]);\n ({pos: nextSource, time: nextTarget} = table[hi]);\n } else {\n if (val >= table[lo].time && val <= table[hi].time) {\n ({lo, hi} = _lookupByKey(table, 'time', val));\n }\n ({time: prevSource, pos: prevTarget} = table[lo]);\n ({time: nextSource, pos: nextTarget} = table[hi]);\n }\n\n const span = nextSource - prevSource;\n return span ? prevTarget + (nextTarget - prevTarget) * (val - prevSource) / span : prevTarget;\n}\n\nclass TimeSeriesScale extends TimeScale {\n\n static id = 'timeseries';\n\n /**\n * @type {any}\n */\n static defaults = TimeScale.defaults;\n\n /**\n\t * @param {object} props\n\t */\n constructor(props) {\n super(props);\n\n /** @type {object[]} */\n this._table = [];\n /** @type {number} */\n this._minPos = undefined;\n /** @type {number} */\n this._tableRange = undefined;\n }\n\n /**\n\t * @protected\n\t */\n initOffsets() {\n const timestamps = this._getTimestampsForTable();\n const table = this._table = this.buildLookupTable(timestamps);\n this._minPos = interpolate(table, this.min);\n this._tableRange = interpolate(table, this.max) - this._minPos;\n super.initOffsets(timestamps);\n }\n\n /**\n\t * Returns an array of {time, pos} objects used to interpolate a specific `time` or position\n\t * (`pos`) on the scale, by searching entries before and after the requested value. `pos` is\n\t * a decimal between 0 and 1: 0 being the start of the scale (left or top) and 1 the other\n\t * extremity (left + width or top + height). Note that it would be more optimized to directly\n\t * store pre-computed pixels, but the scale dimensions are not guaranteed at the time we need\n\t * to create the lookup table. The table ALWAYS contains at least two items: min and max.\n\t * @param {number[]} timestamps\n\t * @return {object[]}\n\t * @protected\n\t */\n buildLookupTable(timestamps) {\n const {min, max} = this;\n const items = [];\n const table = [];\n let i, ilen, prev, curr, next;\n\n for (i = 0, ilen = timestamps.length; i < ilen; ++i) {\n curr = timestamps[i];\n if (curr >= min && curr <= max) {\n items.push(curr);\n }\n }\n\n if (items.length < 2) {\n // In case there is less that 2 timestamps between min and max, the scale is defined by min and max\n return [\n {time: min, pos: 0},\n {time: max, pos: 1}\n ];\n }\n\n for (i = 0, ilen = items.length; i < ilen; ++i) {\n next = items[i + 1];\n prev = items[i - 1];\n curr = items[i];\n\n // only add points that breaks the scale linearity\n if (Math.round((next + prev) / 2) !== curr) {\n table.push({time: curr, pos: i / (ilen - 1)});\n }\n }\n return table;\n }\n\n /**\n * Generates all timestamps defined in the data.\n * Important: this method can return ticks outside the min and max range, it's the\n * responsibility of the calling code to clamp values if needed.\n * @protected\n */\n _generate() {\n const min = this.min;\n const max = this.max;\n let timestamps = super.getDataTimestamps();\n if (!timestamps.includes(min) || !timestamps.length) {\n timestamps.splice(0, 0, min);\n }\n if (!timestamps.includes(max) || timestamps.length === 1) {\n timestamps.push(max);\n }\n return timestamps.sort((a, b) => a - b);\n }\n\n /**\n\t * Returns all timestamps\n\t * @return {number[]}\n\t * @private\n\t */\n _getTimestampsForTable() {\n let timestamps = this._cache.all || [];\n\n if (timestamps.length) {\n return timestamps;\n }\n\n const data = this.getDataTimestamps();\n const label = this.getLabelTimestamps();\n if (data.length && label.length) {\n // If combining labels and data (data might not contain all labels),\n // we need to recheck uniqueness and sort\n timestamps = this.normalize(data.concat(label));\n } else {\n timestamps = data.length ? data : label;\n }\n timestamps = this._cache.all = timestamps;\n\n return timestamps;\n }\n\n /**\n\t * @param {number} value - Milliseconds since epoch (1 January 1970 00:00:00 UTC)\n\t * @return {number}\n\t */\n getDecimalForValue(value) {\n return (interpolate(this._table, value) - this._minPos) / this._tableRange;\n }\n\n /**\n\t * @param {number} pixel\n\t * @return {number}\n\t */\n getValueForPixel(pixel) {\n const offsets = this._offsets;\n const decimal = this.getDecimalForPixel(pixel) / offsets.factor - offsets.end;\n return interpolate(this._table, decimal * this._tableRange + this._minPos, true);\n }\n}\n\nexport default TimeSeriesScale;\n", "export * from './controllers/index.js';\nexport * from './core/index.js';\nexport * from './elements/index.js';\nexport * from './platform/index.js';\nexport * from './plugins/index.js';\nexport * from './scales/index.js';\n\nimport * as controllers from './controllers/index.js';\nimport * as elements from './elements/index.js';\nimport * as plugins from './plugins/index.js';\nimport * as scales from './scales/index.js';\n\nexport {\n controllers,\n elements,\n plugins,\n scales,\n};\n\nexport const registerables = [\n controllers,\n elements,\n plugins,\n scales,\n];\n", "import {Chart, registerables} from '../dist/chart.js';\n\nChart.register(...registerables);\n\nexport * from '../dist/chart.js';\nexport default Chart;\n", "function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\nexport { _typeof as default };", "export default function toInteger(dirtyNumber) {\n if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {\n return NaN;\n }\n var number = Number(dirtyNumber);\n if (isNaN(number)) {\n return number;\n }\n return number < 0 ? Math.ceil(number) : Math.floor(number);\n}", "export default function requiredArgs(required, args) {\n if (args.length < required) {\n throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');\n }\n}", "import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @param {Date|Number} argument - the value to convert\n * @returns {Date} the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nexport default function toDate(argument) {\n requiredArgs(1, arguments);\n var argStr = Object.prototype.toString.call(argument);\n\n // Clone the date\n if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {\n // Prevent the date to lose the milliseconds when passed to new Date() in IE10\n return new Date(argument.getTime());\n } else if (typeof argument === 'number' || argStr === '[object Number]') {\n return new Date(argument);\n } else {\n if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(\"Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments\");\n // eslint-disable-next-line no-console\n console.warn(new Error().stack);\n }\n return new Date(NaN);\n }\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addDays\n * @category Day Helpers\n * @summary Add the specified number of days to the given date.\n *\n * @description\n * Add the specified number of days to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} - the new date with the days added\n * @throws {TypeError} - 2 arguments required\n *\n * @example\n * // Add 10 days to 1 September 2014:\n * const result = addDays(new Date(2014, 8, 1), 10)\n * //=> Thu Sep 11 2014 00:00:00\n */\nexport default function addDays(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var amount = toInteger(dirtyAmount);\n if (isNaN(amount)) {\n return new Date(NaN);\n }\n if (!amount) {\n // If 0 days, no-op to avoid changing times in the hour before end of DST\n return date;\n }\n date.setDate(date.getDate() + amount);\n return date;\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addMonths\n * @category Month Helpers\n * @summary Add the specified number of months to the given date.\n *\n * @description\n * Add the specified number of months to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the months added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 5 months to 1 September 2014:\n * const result = addMonths(new Date(2014, 8, 1), 5)\n * //=> Sun Feb 01 2015 00:00:00\n */\nexport default function addMonths(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var amount = toInteger(dirtyAmount);\n if (isNaN(amount)) {\n return new Date(NaN);\n }\n if (!amount) {\n // If 0 months, no-op to avoid changing times in the hour before end of DST\n return date;\n }\n var dayOfMonth = date.getDate();\n\n // The JS Date object supports date math by accepting out-of-bounds values for\n // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and\n // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we\n // want except that dates will wrap around the end of a month, meaning that\n // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So\n // we'll default to the end of the desired month by adding 1 to the desired\n // month and using a date of 0 to back up one day to the end of the desired\n // month.\n var endOfDesiredMonth = new Date(date.getTime());\n endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);\n var daysInMonth = endOfDesiredMonth.getDate();\n if (dayOfMonth >= daysInMonth) {\n // If we're already at the end of the month, then this is the correct date\n // and we're done.\n return endOfDesiredMonth;\n } else {\n // Otherwise, we now know that setting the original day-of-month value won't\n // cause an overflow, so set the desired day-of-month. Note that we can't\n // just set the date of `endOfDesiredMonth` because that object may have had\n // its time changed in the unusual case where where a DST transition was on\n // the last day of the month and its local time was in the hour skipped or\n // repeated next to a DST transition. So we use `date` instead which is\n // guaranteed to still have the original time.\n date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);\n return date;\n }\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addMilliseconds\n * @category Millisecond Helpers\n * @summary Add the specified number of milliseconds to the given date.\n *\n * @description\n * Add the specified number of milliseconds to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the milliseconds added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 750 milliseconds to 10 July 2014 12:45:30.000:\n * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:30.750\n */\nexport default function addMilliseconds(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var timestamp = toDate(dirtyDate).getTime();\n var amount = toInteger(dirtyAmount);\n return new Date(timestamp + amount);\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport addMilliseconds from \"../addMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar MILLISECONDS_IN_HOUR = 3600000;\n\n/**\n * @name addHours\n * @category Hour Helpers\n * @summary Add the specified number of hours to the given date.\n *\n * @description\n * Add the specified number of hours to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of hours to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the hours added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 2 hours to 10 July 2014 23:00:00:\n * const result = addHours(new Date(2014, 6, 10, 23, 0), 2)\n * //=> Fri Jul 11 2014 01:00:00\n */\nexport default function addHours(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMilliseconds(dirtyDate, amount * MILLISECONDS_IN_HOUR);\n}", "var defaultOptions = {};\nexport function getDefaultOptions() {\n return defaultOptions;\n}\nexport function setDefaultOptions(newOptions) {\n defaultOptions = newOptions;\n}", "import toDate from \"../toDate/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getDefaultOptions } from \"../_lib/defaultOptions/index.js\";\n/**\n * @name startOfWeek\n * @category Week Helpers\n * @summary Return the start of a week for the given date.\n *\n * @description\n * Return the start of a week for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @returns {Date} the start of a week\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n *\n * @example\n * // The start of a week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sun Aug 31 2014 00:00:00\n *\n * @example\n * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport default function startOfWeek(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n requiredArgs(1, arguments);\n var defaultOptions = getDefaultOptions();\n var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n var date = toDate(dirtyDate);\n var day = date.getDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n date.setDate(date.getDate() - diff);\n date.setHours(0, 0, 0, 0);\n return date;\n}", "/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport default function getTimezoneOffsetInMilliseconds(date) {\n var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));\n utcDate.setUTCFullYear(date.getFullYear());\n return date.getTime() - utcDate.getTime();\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name startOfDay\n * @category Day Helpers\n * @summary Return the start of a day for the given date.\n *\n * @description\n * Return the start of a day for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a day\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a day for 2 September 2014 11:55:00:\n * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 00:00:00\n */\nexport default function startOfDay(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setHours(0, 0, 0, 0);\n return date;\n}", "import getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport startOfDay from \"../startOfDay/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar MILLISECONDS_IN_DAY = 86400000;\n\n/**\n * @name differenceInCalendarDays\n * @category Day Helpers\n * @summary Get the number of calendar days between the given dates.\n *\n * @description\n * Get the number of calendar days between the given dates. This means that the times are removed\n * from the dates and then the difference in days is calculated.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar days\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * const result = differenceInCalendarDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 366\n * // How many calendar days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * const result = differenceInCalendarDays(\n * new Date(2011, 6, 3, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 1\n */\nexport default function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var startOfDayLeft = startOfDay(dirtyDateLeft);\n var startOfDayRight = startOfDay(dirtyDateRight);\n var timestampLeft = startOfDayLeft.getTime() - getTimezoneOffsetInMilliseconds(startOfDayLeft);\n var timestampRight = startOfDayRight.getTime() - getTimezoneOffsetInMilliseconds(startOfDayRight);\n\n // Round the number of days to the nearest integer\n // because the number of milliseconds in a day is not constant\n // (e.g. it's different in the day of the daylight saving time clock shift)\n return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY);\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport addMilliseconds from \"../addMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar MILLISECONDS_IN_MINUTE = 60000;\n\n/**\n * @name addMinutes\n * @category Minute Helpers\n * @summary Add the specified number of minutes to the given date.\n *\n * @description\n * Add the specified number of minutes to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of minutes to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the minutes added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 30 minutes to 10 July 2014 12:00:00:\n * const result = addMinutes(new Date(2014, 6, 10, 12, 0), 30)\n * //=> Thu Jul 10 2014 12:30:00\n */\nexport default function addMinutes(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMilliseconds(dirtyDate, amount * MILLISECONDS_IN_MINUTE);\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport addMonths from \"../addMonths/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addQuarters\n * @category Quarter Helpers\n * @summary Add the specified number of year quarters to the given date.\n *\n * @description\n * Add the specified number of year quarters to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of quarters to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the quarters added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 1 quarter to 1 September 2014:\n * const result = addQuarters(new Date(2014, 8, 1), 1)\n * //=> Mon Dec 01 2014 00:00:00\n */\nexport default function addQuarters(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n var months = amount * 3;\n return addMonths(dirtyDate, months);\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport addMilliseconds from \"../addMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addSeconds\n * @category Second Helpers\n * @summary Add the specified number of seconds to the given date.\n *\n * @description\n * Add the specified number of seconds to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of seconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the seconds added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 30 seconds to 10 July 2014 12:45:00:\n * const result = addSeconds(new Date(2014, 6, 10, 12, 45, 0), 30)\n * //=> Thu Jul 10 2014 12:45:30\n */\nexport default function addSeconds(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMilliseconds(dirtyDate, amount * 1000);\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport addDays from \"../addDays/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addWeeks\n * @category Week Helpers\n * @summary Add the specified number of weeks to the given date.\n *\n * @description\n * Add the specified number of week to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of weeks to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the weeks added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 4 weeks to 1 September 2014:\n * const result = addWeeks(new Date(2014, 8, 1), 4)\n * //=> Mon Sep 29 2014 00:00:00\n */\nexport default function addWeeks(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n var days = amount * 7;\n return addDays(dirtyDate, days);\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport addMonths from \"../addMonths/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addYears\n * @category Year Helpers\n * @summary Add the specified number of years to the given date.\n *\n * @description\n * Add the specified number of years to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of years to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the years added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 5 years to 1 September 2014:\n * const result = addYears(new Date(2014, 8, 1), 5)\n * //=> Sun Sep 01 2019 00:00:00\n */\nexport default function addYears(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMonths(dirtyDate, amount * 12);\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name compareAsc\n * @category Common Helpers\n * @summary Compare the two dates and return -1, 0 or 1.\n *\n * @description\n * Compare the two dates and return 1 if the first date is after the second,\n * -1 if the first date is before the second or 0 if dates are equal.\n *\n * @param {Date|Number} dateLeft - the first date to compare\n * @param {Date|Number} dateRight - the second date to compare\n * @returns {Number} the result of the comparison\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Compare 11 February 1987 and 10 July 1989:\n * const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))\n * //=> -1\n *\n * @example\n * // Sort the array of dates:\n * const result = [\n * new Date(1995, 6, 2),\n * new Date(1987, 1, 11),\n * new Date(1989, 6, 10)\n * ].sort(compareAsc)\n * //=> [\n * // Wed Feb 11 1987 00:00:00,\n * // Mon Jul 10 1989 00:00:00,\n * // Sun Jul 02 1995 00:00:00\n * // ]\n */\nexport default function compareAsc(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n var diff = dateLeft.getTime() - dateRight.getTime();\n if (diff < 0) {\n return -1;\n } else if (diff > 0) {\n return 1;\n // Return 0 if diff is 0; return NaN if diff is NaN\n } else {\n return diff;\n }\n}", "/**\n * Days in 1 week.\n *\n * @name daysInWeek\n * @constant\n * @type {number}\n * @default\n */\nexport var daysInWeek = 7;\n\n/**\n * Days in 1 year\n * One years equals 365.2425 days according to the formula:\n *\n * > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400.\n * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days\n *\n * @name daysInYear\n * @constant\n * @type {number}\n * @default\n */\nexport var daysInYear = 365.2425;\n\n/**\n * Maximum allowed time.\n *\n * @name maxTime\n * @constant\n * @type {number}\n * @default\n */\nexport var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;\n\n/**\n * Milliseconds in 1 minute\n *\n * @name millisecondsInMinute\n * @constant\n * @type {number}\n * @default\n */\nexport var millisecondsInMinute = 60000;\n\n/**\n * Milliseconds in 1 hour\n *\n * @name millisecondsInHour\n * @constant\n * @type {number}\n * @default\n */\nexport var millisecondsInHour = 3600000;\n\n/**\n * Milliseconds in 1 second\n *\n * @name millisecondsInSecond\n * @constant\n * @type {number}\n * @default\n */\nexport var millisecondsInSecond = 1000;\n\n/**\n * Minimum allowed time.\n *\n * @name minTime\n * @constant\n * @type {number}\n * @default\n */\nexport var minTime = -maxTime;\n\n/**\n * Minutes in 1 hour\n *\n * @name minutesInHour\n * @constant\n * @type {number}\n * @default\n */\nexport var minutesInHour = 60;\n\n/**\n * Months in 1 quarter\n *\n * @name monthsInQuarter\n * @constant\n * @type {number}\n * @default\n */\nexport var monthsInQuarter = 3;\n\n/**\n * Months in 1 year\n *\n * @name monthsInYear\n * @constant\n * @type {number}\n * @default\n */\nexport var monthsInYear = 12;\n\n/**\n * Quarters in 1 year\n *\n * @name quartersInYear\n * @constant\n * @type {number}\n * @default\n */\nexport var quartersInYear = 4;\n\n/**\n * Seconds in 1 hour\n *\n * @name secondsInHour\n * @constant\n * @type {number}\n * @default\n */\nexport var secondsInHour = 3600;\n\n/**\n * Seconds in 1 minute\n *\n * @name secondsInMinute\n * @constant\n * @type {number}\n * @default\n */\nexport var secondsInMinute = 60;\n\n/**\n * Seconds in 1 day\n *\n * @name secondsInDay\n * @constant\n * @type {number}\n * @default\n */\nexport var secondsInDay = secondsInHour * 24;\n\n/**\n * Seconds in 1 week\n *\n * @name secondsInWeek\n * @constant\n * @type {number}\n * @default\n */\nexport var secondsInWeek = secondsInDay * 7;\n\n/**\n * Seconds in 1 year\n *\n * @name secondsInYear\n * @constant\n * @type {number}\n * @default\n */\nexport var secondsInYear = secondsInDay * daysInYear;\n\n/**\n * Seconds in 1 month\n *\n * @name secondsInMonth\n * @constant\n * @type {number}\n * @default\n */\nexport var secondsInMonth = secondsInYear / 12;\n\n/**\n * Seconds in 1 quarter\n *\n * @name secondsInQuarter\n * @constant\n * @type {number}\n * @default\n */\nexport var secondsInQuarter = secondsInMonth * 3;", "import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isDate\n * @category Common Helpers\n * @summary Is the given value a date?\n *\n * @description\n * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.\n *\n * @param {*} value - the value to check\n * @returns {boolean} true if the given value is a date\n * @throws {TypeError} 1 arguments required\n *\n * @example\n * // For a valid date:\n * const result = isDate(new Date())\n * //=> true\n *\n * @example\n * // For an invalid date:\n * const result = isDate(new Date(NaN))\n * //=> true\n *\n * @example\n * // For some value:\n * const result = isDate('2014-02-31')\n * //=> false\n *\n * @example\n * // For an object:\n * const result = isDate({})\n * //=> false\n */\nexport default function isDate(value) {\n requiredArgs(1, arguments);\n return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';\n}", "import isDate from \"../isDate/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isValid\n * @category Common Helpers\n * @summary Is the given date valid?\n *\n * @description\n * Returns false if argument is Invalid Date and true otherwise.\n * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * Invalid Date is a Date, whose time value is NaN.\n *\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * @param {*} date - the date to check\n * @returns {Boolean} the date is valid\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // For the valid date:\n * const result = isValid(new Date(2014, 1, 31))\n * //=> true\n *\n * @example\n * // For the value, convertable into a date:\n * const result = isValid(1393804800000)\n * //=> true\n *\n * @example\n * // For the invalid date:\n * const result = isValid(new Date(''))\n * //=> false\n */\nexport default function isValid(dirtyDate) {\n requiredArgs(1, arguments);\n if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {\n return false;\n }\n var date = toDate(dirtyDate);\n return !isNaN(Number(date));\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInCalendarMonths\n * @category Month Helpers\n * @summary Get the number of calendar months between the given dates.\n *\n * @description\n * Get the number of calendar months between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar months\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar months are between 31 January 2014 and 1 September 2014?\n * const result = differenceInCalendarMonths(\n * new Date(2014, 8, 1),\n * new Date(2014, 0, 31)\n * )\n * //=> 8\n */\nexport default function differenceInCalendarMonths(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear();\n var monthDiff = dateLeft.getMonth() - dateRight.getMonth();\n return yearDiff * 12 + monthDiff;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInCalendarYears\n * @category Year Helpers\n * @summary Get the number of calendar years between the given dates.\n *\n * @description\n * Get the number of calendar years between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar years\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar years are between 31 December 2013 and 11 February 2015?\n * const result = differenceInCalendarYears(\n * new Date(2015, 1, 11),\n * new Date(2013, 11, 31)\n * )\n * //=> 2\n */\nexport default function differenceInCalendarYears(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n return dateLeft.getFullYear() - dateRight.getFullYear();\n}", "import toDate from \"../toDate/index.js\";\nimport differenceInCalendarDays from \"../differenceInCalendarDays/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\"; // Like `compareAsc` but uses local time not UTC, which is needed\n// for accurate equality comparisons of UTC timestamps that end up\n// having the same representation in local time, e.g. one hour before\n// DST ends vs. the instant that DST ends.\nfunction compareLocalAsc(dateLeft, dateRight) {\n var diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds();\n if (diff < 0) {\n return -1;\n } else if (diff > 0) {\n return 1;\n // Return 0 if diff is 0; return NaN if diff is NaN\n } else {\n return diff;\n }\n}\n\n/**\n * @name differenceInDays\n * @category Day Helpers\n * @summary Get the number of full days between the given dates.\n *\n * @description\n * Get the number of full day periods between two dates. Fractional days are\n * truncated towards zero.\n *\n * One \"full day\" is the distance between a local time in one day to the same\n * local time on the next or previous day. A full day can sometimes be less than\n * or more than 24 hours if a daylight savings change happens between two dates.\n *\n * To ignore DST and only measure exact 24-hour periods, use this instead:\n * `Math.floor(differenceInHours(dateLeft, dateRight)/24)|0`.\n *\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of full days according to the local timezone\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many full days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * const result = differenceInDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 365\n * // How many full days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * const result = differenceInDays(\n * new Date(2011, 6, 3, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 0\n * // How many full days are between\n * // 1 March 2020 0:00 and 1 June 2020 0:00 ?\n * // Note: because local time is used, the\n * // result will always be 92 days, even in\n * // time zones where DST starts and the\n * // period has only 92*24-1 hours.\n * const result = differenceInDays(\n * new Date(2020, 5, 1),\n * new Date(2020, 2, 1)\n * )\n//=> 92\n */\nexport default function differenceInDays(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n var sign = compareLocalAsc(dateLeft, dateRight);\n var difference = Math.abs(differenceInCalendarDays(dateLeft, dateRight));\n dateLeft.setDate(dateLeft.getDate() - sign * difference);\n\n // Math.abs(diff in full days - diff in calendar days) === 1 if last calendar day is not full\n // If so, result must be decreased by 1 in absolute value\n var isLastDayNotFull = Number(compareLocalAsc(dateLeft, dateRight) === -sign);\n var result = sign * (difference - isLastDayNotFull);\n // Prevent negative zero\n return result === 0 ? 0 : result;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInMilliseconds\n * @category Millisecond Helpers\n * @summary Get the number of milliseconds between the given dates.\n *\n * @description\n * Get the number of milliseconds between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of milliseconds\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many milliseconds are between\n * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?\n * const result = differenceInMilliseconds(\n * new Date(2014, 6, 2, 12, 30, 21, 700),\n * new Date(2014, 6, 2, 12, 30, 20, 600)\n * )\n * //=> 1100\n */\nexport default function differenceInMilliseconds(dateLeft, dateRight) {\n requiredArgs(2, arguments);\n return toDate(dateLeft).getTime() - toDate(dateRight).getTime();\n}", "var roundingMap = {\n ceil: Math.ceil,\n round: Math.round,\n floor: Math.floor,\n trunc: function trunc(value) {\n return value < 0 ? Math.ceil(value) : Math.floor(value);\n } // Math.trunc is not supported by IE\n};\n\nvar defaultRoundingMethod = 'trunc';\nexport function getRoundingMethod(method) {\n return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];\n}", "import { millisecondsInHour } from \"../constants/index.js\";\nimport differenceInMilliseconds from \"../differenceInMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getRoundingMethod } from \"../_lib/roundingMethods/index.js\";\n/**\n * @name differenceInHours\n * @category Hour Helpers\n * @summary Get the number of hours between the given dates.\n *\n * @description\n * Get the number of hours between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @param {Object} [options] - an object with options.\n * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)\n * @returns {Number} the number of hours\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many hours are between 2 July 2014 06:50:00 and 2 July 2014 19:00:00?\n * const result = differenceInHours(\n * new Date(2014, 6, 2, 19, 0),\n * new Date(2014, 6, 2, 6, 50)\n * )\n * //=> 12\n */\nexport default function differenceInHours(dateLeft, dateRight, options) {\n requiredArgs(2, arguments);\n var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInHour;\n return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);\n}", "import { millisecondsInMinute } from \"../constants/index.js\";\nimport differenceInMilliseconds from \"../differenceInMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getRoundingMethod } from \"../_lib/roundingMethods/index.js\";\n/**\n * @name differenceInMinutes\n * @category Minute Helpers\n * @summary Get the number of minutes between the given dates.\n *\n * @description\n * Get the signed number of full (rounded towards 0) minutes between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @param {Object} [options] - an object with options.\n * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)\n * @returns {Number} the number of minutes\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many minutes are between 2 July 2014 12:07:59 and 2 July 2014 12:20:00?\n * const result = differenceInMinutes(\n * new Date(2014, 6, 2, 12, 20, 0),\n * new Date(2014, 6, 2, 12, 7, 59)\n * )\n * //=> 12\n *\n * @example\n * // How many minutes are between 10:01:59 and 10:00:00\n * const result = differenceInMinutes(\n * new Date(2000, 0, 1, 10, 0, 0),\n * new Date(2000, 0, 1, 10, 1, 59)\n * )\n * //=> -1\n */\nexport default function differenceInMinutes(dateLeft, dateRight, options) {\n requiredArgs(2, arguments);\n var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInMinute;\n return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name endOfDay\n * @category Day Helpers\n * @summary Return the end of a day for the given date.\n *\n * @description\n * Return the end of a day for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a day\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a day for 2 September 2014 11:55:00:\n * const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 23:59:59.999\n */\nexport default function endOfDay(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setHours(23, 59, 59, 999);\n return date;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name endOfMonth\n * @category Month Helpers\n * @summary Return the end of a month for the given date.\n *\n * @description\n * Return the end of a month for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a month for 2 September 2014 11:55:00:\n * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 30 2014 23:59:59.999\n */\nexport default function endOfMonth(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var month = date.getMonth();\n date.setFullYear(date.getFullYear(), month + 1, 0);\n date.setHours(23, 59, 59, 999);\n return date;\n}", "import toDate from \"../toDate/index.js\";\nimport endOfDay from \"../endOfDay/index.js\";\nimport endOfMonth from \"../endOfMonth/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isLastDayOfMonth\n * @category Month Helpers\n * @summary Is the given date the last day of a month?\n *\n * @description\n * Is the given date the last day of a month?\n *\n * @param {Date|Number} date - the date to check\n * @returns {Boolean} the date is the last day of a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Is 28 February 2014 the last day of a month?\n * const result = isLastDayOfMonth(new Date(2014, 1, 28))\n * //=> true\n */\nexport default function isLastDayOfMonth(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n return endOfDay(date).getTime() === endOfMonth(date).getTime();\n}", "import toDate from \"../toDate/index.js\";\nimport differenceInCalendarMonths from \"../differenceInCalendarMonths/index.js\";\nimport compareAsc from \"../compareAsc/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport isLastDayOfMonth from \"../isLastDayOfMonth/index.js\";\n/**\n * @name differenceInMonths\n * @category Month Helpers\n * @summary Get the number of full months between the given dates.\n *\n * @description\n * Get the number of full months between the given dates using trunc as a default rounding method.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of full months\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many full months are between 31 January 2014 and 1 September 2014?\n * const result = differenceInMonths(new Date(2014, 8, 1), new Date(2014, 0, 31))\n * //=> 7\n */\nexport default function differenceInMonths(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n var sign = compareAsc(dateLeft, dateRight);\n var difference = Math.abs(differenceInCalendarMonths(dateLeft, dateRight));\n var result;\n\n // Check for the difference of less than month\n if (difference < 1) {\n result = 0;\n } else {\n if (dateLeft.getMonth() === 1 && dateLeft.getDate() > 27) {\n // This will check if the date is end of Feb and assign a higher end of month date\n // to compare it with Jan\n dateLeft.setDate(30);\n }\n dateLeft.setMonth(dateLeft.getMonth() - sign * difference);\n\n // Math.abs(diff in full months - diff in calendar months) === 1 if last calendar month is not full\n // If so, result must be decreased by 1 in absolute value\n var isLastMonthNotFull = compareAsc(dateLeft, dateRight) === -sign;\n\n // Check for cases of one full calendar month\n if (isLastDayOfMonth(toDate(dirtyDateLeft)) && difference === 1 && compareAsc(dirtyDateLeft, dateRight) === 1) {\n isLastMonthNotFull = false;\n }\n result = sign * (difference - Number(isLastMonthNotFull));\n }\n\n // Prevent negative zero\n return result === 0 ? 0 : result;\n}", "import differenceInMonths from \"../differenceInMonths/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getRoundingMethod } from \"../_lib/roundingMethods/index.js\";\n/**\n * @name differenceInQuarters\n * @category Quarter Helpers\n * @summary Get the number of quarters between the given dates.\n *\n * @description\n * Get the number of quarters between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @param {Object} [options] - an object with options.\n * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)\n * @returns {Number} the number of full quarters\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many full quarters are between 31 December 2013 and 2 July 2014?\n * const result = differenceInQuarters(new Date(2014, 6, 2), new Date(2013, 11, 31))\n * //=> 2\n */\nexport default function differenceInQuarters(dateLeft, dateRight, options) {\n requiredArgs(2, arguments);\n var diff = differenceInMonths(dateLeft, dateRight) / 3;\n return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);\n}", "import differenceInMilliseconds from \"../differenceInMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getRoundingMethod } from \"../_lib/roundingMethods/index.js\";\n/**\n * @name differenceInSeconds\n * @category Second Helpers\n * @summary Get the number of seconds between the given dates.\n *\n * @description\n * Get the number of seconds between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @param {Object} [options] - an object with options.\n * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)\n * @returns {Number} the number of seconds\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many seconds are between\n * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?\n * const result = differenceInSeconds(\n * new Date(2014, 6, 2, 12, 30, 20, 0),\n * new Date(2014, 6, 2, 12, 30, 7, 999)\n * )\n * //=> 12\n */\nexport default function differenceInSeconds(dateLeft, dateRight, options) {\n requiredArgs(2, arguments);\n var diff = differenceInMilliseconds(dateLeft, dateRight) / 1000;\n return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);\n}", "import differenceInDays from \"../differenceInDays/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getRoundingMethod } from \"../_lib/roundingMethods/index.js\";\n/**\n * @name differenceInWeeks\n * @category Week Helpers\n * @summary Get the number of full weeks between the given dates.\n *\n * @description\n * Get the number of full weeks between two dates. Fractional weeks are\n * truncated towards zero by default.\n *\n * One \"full week\" is the distance between a local time in one day to the same\n * local time 7 days earlier or later. A full week can sometimes be less than\n * or more than 7*24 hours if a daylight savings change happens between two dates.\n *\n * To ignore DST and only measure exact 7*24-hour periods, use this instead:\n * `Math.floor(differenceInHours(dateLeft, dateRight)/(7*24))|0`.\n *\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @param {Object} [options] - an object with options.\n * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)\n * @returns {Number} the number of full weeks\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many full weeks are between 5 July 2014 and 20 July 2014?\n * const result = differenceInWeeks(new Date(2014, 6, 20), new Date(2014, 6, 5))\n * //=> 2\n *\n * // How many full weeks are between\n * // 1 March 2020 0:00 and 6 June 2020 0:00 ?\n * // Note: because local time is used, the\n * // result will always be 8 weeks (54 days),\n * // even if DST starts and the period has\n * // only 54*24-1 hours.\n * const result = differenceInWeeks(\n * new Date(2020, 5, 1),\n * new Date(2020, 2, 6)\n * )\n * //=> 8\n */\nexport default function differenceInWeeks(dateLeft, dateRight, options) {\n requiredArgs(2, arguments);\n var diff = differenceInDays(dateLeft, dateRight) / 7;\n return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);\n}", "import toDate from \"../toDate/index.js\";\nimport differenceInCalendarYears from \"../differenceInCalendarYears/index.js\";\nimport compareAsc from \"../compareAsc/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInYears\n * @category Year Helpers\n * @summary Get the number of full years between the given dates.\n *\n * @description\n * Get the number of full years between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of full years\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many full years are between 31 December 2013 and 11 February 2015?\n * const result = differenceInYears(new Date(2015, 1, 11), new Date(2013, 11, 31))\n * //=> 1\n */\nexport default function differenceInYears(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n var sign = compareAsc(dateLeft, dateRight);\n var difference = Math.abs(differenceInCalendarYears(dateLeft, dateRight));\n\n // Set both dates to a valid leap year for accurate comparison when dealing\n // with leap days\n dateLeft.setFullYear(1584);\n dateRight.setFullYear(1584);\n\n // Math.abs(diff in full years - diff in calendar years) === 1 if last calendar year is not full\n // If so, result must be decreased by 1 in absolute value\n var isLastYearNotFull = compareAsc(dateLeft, dateRight) === -sign;\n var result = sign * (difference - Number(isLastYearNotFull));\n // Prevent negative zero\n return result === 0 ? 0 : result;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name startOfMinute\n * @category Minute Helpers\n * @summary Return the start of a minute for the given date.\n *\n * @description\n * Return the start of a minute for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a minute\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a minute for 1 December 2014 22:15:45.400:\n * const result = startOfMinute(new Date(2014, 11, 1, 22, 15, 45, 400))\n * //=> Mon Dec 01 2014 22:15:00\n */\nexport default function startOfMinute(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setSeconds(0, 0);\n return date;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name startOfQuarter\n * @category Quarter Helpers\n * @summary Return the start of a year quarter for the given date.\n *\n * @description\n * Return the start of a year quarter for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a quarter\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a quarter for 2 September 2014 11:55:00:\n * const result = startOfQuarter(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Jul 01 2014 00:00:00\n */\nexport default function startOfQuarter(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var currentMonth = date.getMonth();\n var month = currentMonth - currentMonth % 3;\n date.setMonth(month, 1);\n date.setHours(0, 0, 0, 0);\n return date;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name startOfMonth\n * @category Month Helpers\n * @summary Return the start of a month for the given date.\n *\n * @description\n * Return the start of a month for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a month for 2 September 2014 11:55:00:\n * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport default function startOfMonth(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n return date;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name endOfYear\n * @category Year Helpers\n * @summary Return the end of a year for the given date.\n *\n * @description\n * Return the end of a year for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a year for 2 September 2014 11:55:00:\n * const result = endOfYear(new Date(2014, 8, 2, 11, 55, 00))\n * //=> Wed Dec 31 2014 23:59:59.999\n */\nexport default function endOfYear(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var year = date.getFullYear();\n date.setFullYear(year + 1, 0, 0);\n date.setHours(23, 59, 59, 999);\n return date;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name startOfYear\n * @category Year Helpers\n * @summary Return the start of a year for the given date.\n *\n * @description\n * Return the start of a year for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a year for 2 September 2014 11:55:00:\n * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))\n * //=> Wed Jan 01 2014 00:00:00\n */\nexport default function startOfYear(dirtyDate) {\n requiredArgs(1, arguments);\n var cleanDate = toDate(dirtyDate);\n var date = new Date(0);\n date.setFullYear(cleanDate.getFullYear(), 0, 1);\n date.setHours(0, 0, 0, 0);\n return date;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name endOfHour\n * @category Hour Helpers\n * @summary Return the end of an hour for the given date.\n *\n * @description\n * Return the end of an hour for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of an hour\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of an hour for 2 September 2014 11:55:00:\n * const result = endOfHour(new Date(2014, 8, 2, 11, 55))\n * //=> Tue Sep 02 2014 11:59:59.999\n */\nexport default function endOfHour(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setMinutes(59, 59, 999);\n return date;\n}", "import { getDefaultOptions } from \"../_lib/defaultOptions/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name endOfWeek\n * @category Week Helpers\n * @summary Return the end of a week for the given date.\n *\n * @description\n * Return the end of a week for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @returns {Date} the end of a week\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n *\n * @example\n * // The end of a week for 2 September 2014 11:55:00:\n * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sat Sep 06 2014 23:59:59.999\n *\n * @example\n * // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:\n * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })\n * //=> Sun Sep 07 2014 23:59:59.999\n */\nexport default function endOfWeek(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n requiredArgs(1, arguments);\n var defaultOptions = getDefaultOptions();\n var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n var date = toDate(dirtyDate);\n var day = date.getDay();\n var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);\n date.setDate(date.getDate() + diff);\n date.setHours(23, 59, 59, 999);\n return date;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name endOfMinute\n * @category Minute Helpers\n * @summary Return the end of a minute for the given date.\n *\n * @description\n * Return the end of a minute for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a minute\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a minute for 1 December 2014 22:15:45.400:\n * const result = endOfMinute(new Date(2014, 11, 1, 22, 15, 45, 400))\n * //=> Mon Dec 01 2014 22:15:59.999\n */\nexport default function endOfMinute(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setSeconds(59, 999);\n return date;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name endOfQuarter\n * @category Quarter Helpers\n * @summary Return the end of a year quarter for the given date.\n *\n * @description\n * Return the end of a year quarter for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a quarter\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a quarter for 2 September 2014 11:55:00:\n * const result = endOfQuarter(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 30 2014 23:59:59.999\n */\nexport default function endOfQuarter(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var currentMonth = date.getMonth();\n var month = currentMonth - currentMonth % 3 + 3;\n date.setMonth(month, 0);\n date.setHours(23, 59, 59, 999);\n return date;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name endOfSecond\n * @category Second Helpers\n * @summary Return the end of a second for the given date.\n *\n * @description\n * Return the end of a second for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a second\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a second for 1 December 2014 22:15:45.400:\n * const result = endOfSecond(new Date(2014, 11, 1, 22, 15, 45, 400))\n * //=> Mon Dec 01 2014 22:15:45.999\n */\nexport default function endOfSecond(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setMilliseconds(999);\n return date;\n}", "import addMilliseconds from \"../addMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\n/**\n * @name subMilliseconds\n * @category Millisecond Helpers\n * @summary Subtract the specified number of milliseconds from the given date.\n *\n * @description\n * Subtract the specified number of milliseconds from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the milliseconds subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:\n * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:29.250\n */\nexport default function subMilliseconds(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMilliseconds(dirtyDate, -amount);\n}", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nvar MILLISECONDS_IN_DAY = 86400000;\nexport default function getUTCDayOfYear(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var timestamp = date.getTime();\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n var startOfYearTimestamp = date.getTime();\n var difference = timestamp - startOfYearTimestamp;\n return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;\n}", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nexport default function startOfUTCISOWeek(dirtyDate) {\n requiredArgs(1, arguments);\n var weekStartsOn = 1;\n var date = toDate(dirtyDate);\n var day = date.getUTCDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n date.setUTCDate(date.getUTCDate() - diff);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n}", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport startOfUTCISOWeek from \"../startOfUTCISOWeek/index.js\";\nexport default function getUTCISOWeekYear(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var year = date.getUTCFullYear();\n var fourthOfJanuaryOfNextYear = new Date(0);\n fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);\n fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);\n var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);\n var fourthOfJanuaryOfThisYear = new Date(0);\n fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);\n fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);\n var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1;\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year;\n } else {\n return year - 1;\n }\n}", "import getUTCISOWeekYear from \"../getUTCISOWeekYear/index.js\";\nimport startOfUTCISOWeek from \"../startOfUTCISOWeek/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nexport default function startOfUTCISOWeekYear(dirtyDate) {\n requiredArgs(1, arguments);\n var year = getUTCISOWeekYear(dirtyDate);\n var fourthOfJanuary = new Date(0);\n fourthOfJanuary.setUTCFullYear(year, 0, 4);\n fourthOfJanuary.setUTCHours(0, 0, 0, 0);\n var date = startOfUTCISOWeek(fourthOfJanuary);\n return date;\n}", "import toDate from \"../../toDate/index.js\";\nimport startOfUTCISOWeek from \"../startOfUTCISOWeek/index.js\";\nimport startOfUTCISOWeekYear from \"../startOfUTCISOWeekYear/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nvar MILLISECONDS_IN_WEEK = 604800000;\nexport default function getUTCISOWeek(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();\n\n // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;\n}", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nimport { getDefaultOptions } from \"../defaultOptions/index.js\";\nexport default function startOfUTCWeek(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n requiredArgs(1, arguments);\n var defaultOptions = getDefaultOptions();\n var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n var date = toDate(dirtyDate);\n var day = date.getUTCDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n date.setUTCDate(date.getUTCDate() - diff);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n}", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport startOfUTCWeek from \"../startOfUTCWeek/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nimport { getDefaultOptions } from \"../defaultOptions/index.js\";\nexport default function getUTCWeekYear(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var year = date.getUTCFullYear();\n var defaultOptions = getDefaultOptions();\n var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);\n\n // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n var firstWeekOfNextYear = new Date(0);\n firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);\n firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);\n var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);\n var firstWeekOfThisYear = new Date(0);\n firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);\n firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);\n var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1;\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year;\n } else {\n return year - 1;\n }\n}", "import getUTCWeekYear from \"../getUTCWeekYear/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport startOfUTCWeek from \"../startOfUTCWeek/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nimport { getDefaultOptions } from \"../defaultOptions/index.js\";\nexport default function startOfUTCWeekYear(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n requiredArgs(1, arguments);\n var defaultOptions = getDefaultOptions();\n var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);\n var year = getUTCWeekYear(dirtyDate, options);\n var firstWeek = new Date(0);\n firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);\n firstWeek.setUTCHours(0, 0, 0, 0);\n var date = startOfUTCWeek(firstWeek, options);\n return date;\n}", "import toDate from \"../../toDate/index.js\";\nimport startOfUTCWeek from \"../startOfUTCWeek/index.js\";\nimport startOfUTCWeekYear from \"../startOfUTCWeekYear/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nvar MILLISECONDS_IN_WEEK = 604800000;\nexport default function getUTCWeek(dirtyDate, options) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();\n\n // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;\n}", "export default function addLeadingZeros(number, targetLength) {\n var sign = number < 0 ? '-' : '';\n var output = Math.abs(number).toString();\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return sign + output;\n}", "import addLeadingZeros from \"../../addLeadingZeros/index.js\";\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | |\n * | d | Day of month | D | |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | m | Minute | M | Month |\n * | s | Second | S | Fraction of second |\n * | y | Year (abs) | Y | |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n */\nvar formatters = {\n // Year\n y: function y(date, token) {\n // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens\n // | Year | y | yy | yyy | yyyy | yyyyy |\n // |----------|-------|----|-------|-------|-------|\n // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\n\n var signedYear = date.getUTCFullYear();\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n var year = signedYear > 0 ? signedYear : 1 - signedYear;\n return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);\n },\n // Month\n M: function M(date, token) {\n var month = date.getUTCMonth();\n return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);\n },\n // Day of the month\n d: function d(date, token) {\n return addLeadingZeros(date.getUTCDate(), token.length);\n },\n // AM or PM\n a: function a(date, token) {\n var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';\n switch (token) {\n case 'a':\n case 'aa':\n return dayPeriodEnumValue.toUpperCase();\n case 'aaa':\n return dayPeriodEnumValue;\n case 'aaaaa':\n return dayPeriodEnumValue[0];\n case 'aaaa':\n default:\n return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';\n }\n },\n // Hour [1-12]\n h: function h(date, token) {\n return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);\n },\n // Hour [0-23]\n H: function H(date, token) {\n return addLeadingZeros(date.getUTCHours(), token.length);\n },\n // Minute\n m: function m(date, token) {\n return addLeadingZeros(date.getUTCMinutes(), token.length);\n },\n // Second\n s: function s(date, token) {\n return addLeadingZeros(date.getUTCSeconds(), token.length);\n },\n // Fraction of second\n S: function S(date, token) {\n var numberOfDigits = token.length;\n var milliseconds = date.getUTCMilliseconds();\n var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));\n return addLeadingZeros(fractionalSeconds, token.length);\n }\n};\nexport default formatters;", "import getUTCDayOfYear from \"../../../_lib/getUTCDayOfYear/index.js\";\nimport getUTCISOWeek from \"../../../_lib/getUTCISOWeek/index.js\";\nimport getUTCISOWeekYear from \"../../../_lib/getUTCISOWeekYear/index.js\";\nimport getUTCWeek from \"../../../_lib/getUTCWeek/index.js\";\nimport getUTCWeekYear from \"../../../_lib/getUTCWeekYear/index.js\";\nimport addLeadingZeros from \"../../addLeadingZeros/index.js\";\nimport lightFormatters from \"../lightFormatters/index.js\";\nvar dayPeriodEnum = {\n am: 'am',\n pm: 'pm',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n};\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O | Timezone (GMT) |\n * | p! | Long localized time | P! | Long localized date |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n * - `P` is long localized date format\n * - `p` is long localized time format\n */\n\nvar formatters = {\n // Era\n G: function G(date, token, localize) {\n var era = date.getUTCFullYear() > 0 ? 1 : 0;\n switch (token) {\n // AD, BC\n case 'G':\n case 'GG':\n case 'GGG':\n return localize.era(era, {\n width: 'abbreviated'\n });\n // A, B\n case 'GGGGG':\n return localize.era(era, {\n width: 'narrow'\n });\n // Anno Domini, Before Christ\n case 'GGGG':\n default:\n return localize.era(era, {\n width: 'wide'\n });\n }\n },\n // Year\n y: function y(date, token, localize) {\n // Ordinal number\n if (token === 'yo') {\n var signedYear = date.getUTCFullYear();\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n var year = signedYear > 0 ? signedYear : 1 - signedYear;\n return localize.ordinalNumber(year, {\n unit: 'year'\n });\n }\n return lightFormatters.y(date, token);\n },\n // Local week-numbering year\n Y: function Y(date, token, localize, options) {\n var signedWeekYear = getUTCWeekYear(date, options);\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;\n\n // Two digit year\n if (token === 'YY') {\n var twoDigitYear = weekYear % 100;\n return addLeadingZeros(twoDigitYear, 2);\n }\n\n // Ordinal number\n if (token === 'Yo') {\n return localize.ordinalNumber(weekYear, {\n unit: 'year'\n });\n }\n\n // Padding\n return addLeadingZeros(weekYear, token.length);\n },\n // ISO week-numbering year\n R: function R(date, token) {\n var isoWeekYear = getUTCISOWeekYear(date);\n\n // Padding\n return addLeadingZeros(isoWeekYear, token.length);\n },\n // Extended year. This is a single number designating the year of this calendar system.\n // The main difference between `y` and `u` localizers are B.C. years:\n // | Year | `y` | `u` |\n // |------|-----|-----|\n // | AC 1 | 1 | 1 |\n // | BC 1 | 1 | 0 |\n // | BC 2 | 2 | -1 |\n // Also `yy` always returns the last two digits of a year,\n // while `uu` pads single digit years to 2 characters and returns other years unchanged.\n u: function u(date, token) {\n var year = date.getUTCFullYear();\n return addLeadingZeros(year, token.length);\n },\n // Quarter\n Q: function Q(date, token, localize) {\n var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);\n switch (token) {\n // 1, 2, 3, 4\n case 'Q':\n return String(quarter);\n // 01, 02, 03, 04\n case 'QQ':\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n case 'Qo':\n return localize.ordinalNumber(quarter, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n case 'QQQ':\n return localize.quarter(quarter, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case 'QQQQQ':\n return localize.quarter(quarter, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1st quarter, 2nd quarter, ...\n case 'QQQQ':\n default:\n return localize.quarter(quarter, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone quarter\n q: function q(date, token, localize) {\n var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);\n switch (token) {\n // 1, 2, 3, 4\n case 'q':\n return String(quarter);\n // 01, 02, 03, 04\n case 'qq':\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n case 'qo':\n return localize.ordinalNumber(quarter, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n case 'qqq':\n return localize.quarter(quarter, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case 'qqqqq':\n return localize.quarter(quarter, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1st quarter, 2nd quarter, ...\n case 'qqqq':\n default:\n return localize.quarter(quarter, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // Month\n M: function M(date, token, localize) {\n var month = date.getUTCMonth();\n switch (token) {\n case 'M':\n case 'MM':\n return lightFormatters.M(date, token);\n // 1st, 2nd, ..., 12th\n case 'Mo':\n return localize.ordinalNumber(month + 1, {\n unit: 'month'\n });\n // Jan, Feb, ..., Dec\n case 'MMM':\n return localize.month(month, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // J, F, ..., D\n case 'MMMMM':\n return localize.month(month, {\n width: 'narrow',\n context: 'formatting'\n });\n // January, February, ..., December\n case 'MMMM':\n default:\n return localize.month(month, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone month\n L: function L(date, token, localize) {\n var month = date.getUTCMonth();\n switch (token) {\n // 1, 2, ..., 12\n case 'L':\n return String(month + 1);\n // 01, 02, ..., 12\n case 'LL':\n return addLeadingZeros(month + 1, 2);\n // 1st, 2nd, ..., 12th\n case 'Lo':\n return localize.ordinalNumber(month + 1, {\n unit: 'month'\n });\n // Jan, Feb, ..., Dec\n case 'LLL':\n return localize.month(month, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // J, F, ..., D\n case 'LLLLL':\n return localize.month(month, {\n width: 'narrow',\n context: 'standalone'\n });\n // January, February, ..., December\n case 'LLLL':\n default:\n return localize.month(month, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // Local week of year\n w: function w(date, token, localize, options) {\n var week = getUTCWeek(date, options);\n if (token === 'wo') {\n return localize.ordinalNumber(week, {\n unit: 'week'\n });\n }\n return addLeadingZeros(week, token.length);\n },\n // ISO week of year\n I: function I(date, token, localize) {\n var isoWeek = getUTCISOWeek(date);\n if (token === 'Io') {\n return localize.ordinalNumber(isoWeek, {\n unit: 'week'\n });\n }\n return addLeadingZeros(isoWeek, token.length);\n },\n // Day of the month\n d: function d(date, token, localize) {\n if (token === 'do') {\n return localize.ordinalNumber(date.getUTCDate(), {\n unit: 'date'\n });\n }\n return lightFormatters.d(date, token);\n },\n // Day of year\n D: function D(date, token, localize) {\n var dayOfYear = getUTCDayOfYear(date);\n if (token === 'Do') {\n return localize.ordinalNumber(dayOfYear, {\n unit: 'dayOfYear'\n });\n }\n return addLeadingZeros(dayOfYear, token.length);\n },\n // Day of week\n E: function E(date, token, localize) {\n var dayOfWeek = date.getUTCDay();\n switch (token) {\n // Tue\n case 'E':\n case 'EE':\n case 'EEE':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n case 'EEEEE':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n case 'EEEEEE':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n case 'EEEE':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Local day of week\n e: function e(date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n switch (token) {\n // Numerical value (Nth day of week with current locale or weekStartsOn)\n case 'e':\n return String(localDayOfWeek);\n // Padded numerical value\n case 'ee':\n return addLeadingZeros(localDayOfWeek, 2);\n // 1st, 2nd, ..., 7th\n case 'eo':\n return localize.ordinalNumber(localDayOfWeek, {\n unit: 'day'\n });\n case 'eee':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n case 'eeeee':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n case 'eeeeee':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n case 'eeee':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone local day of week\n c: function c(date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n switch (token) {\n // Numerical value (same as in `e`)\n case 'c':\n return String(localDayOfWeek);\n // Padded numerical value\n case 'cc':\n return addLeadingZeros(localDayOfWeek, token.length);\n // 1st, 2nd, ..., 7th\n case 'co':\n return localize.ordinalNumber(localDayOfWeek, {\n unit: 'day'\n });\n case 'ccc':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // T\n case 'ccccc':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tu\n case 'cccccc':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'standalone'\n });\n // Tuesday\n case 'cccc':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // ISO day of week\n i: function i(date, token, localize) {\n var dayOfWeek = date.getUTCDay();\n var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;\n switch (token) {\n // 2\n case 'i':\n return String(isoDayOfWeek);\n // 02\n case 'ii':\n return addLeadingZeros(isoDayOfWeek, token.length);\n // 2nd\n case 'io':\n return localize.ordinalNumber(isoDayOfWeek, {\n unit: 'day'\n });\n // Tue\n case 'iii':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n case 'iiiii':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n case 'iiiiii':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n case 'iiii':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // AM or PM\n a: function a(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';\n switch (token) {\n case 'a':\n case 'aa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n case 'aaa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n }).toLowerCase();\n case 'aaaaa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n case 'aaaa':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // AM, PM, midnight, noon\n b: function b(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue;\n if (hours === 12) {\n dayPeriodEnumValue = dayPeriodEnum.noon;\n } else if (hours === 0) {\n dayPeriodEnumValue = dayPeriodEnum.midnight;\n } else {\n dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';\n }\n switch (token) {\n case 'b':\n case 'bb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n case 'bbb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n }).toLowerCase();\n case 'bbbbb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n case 'bbbb':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // in the morning, in the afternoon, in the evening, at night\n B: function B(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue;\n if (hours >= 17) {\n dayPeriodEnumValue = dayPeriodEnum.evening;\n } else if (hours >= 12) {\n dayPeriodEnumValue = dayPeriodEnum.afternoon;\n } else if (hours >= 4) {\n dayPeriodEnumValue = dayPeriodEnum.morning;\n } else {\n dayPeriodEnumValue = dayPeriodEnum.night;\n }\n switch (token) {\n case 'B':\n case 'BB':\n case 'BBB':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n case 'BBBBB':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n case 'BBBB':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Hour [1-12]\n h: function h(date, token, localize) {\n if (token === 'ho') {\n var hours = date.getUTCHours() % 12;\n if (hours === 0) hours = 12;\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n return lightFormatters.h(date, token);\n },\n // Hour [0-23]\n H: function H(date, token, localize) {\n if (token === 'Ho') {\n return localize.ordinalNumber(date.getUTCHours(), {\n unit: 'hour'\n });\n }\n return lightFormatters.H(date, token);\n },\n // Hour [0-11]\n K: function K(date, token, localize) {\n var hours = date.getUTCHours() % 12;\n if (token === 'Ko') {\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n return addLeadingZeros(hours, token.length);\n },\n // Hour [1-24]\n k: function k(date, token, localize) {\n var hours = date.getUTCHours();\n if (hours === 0) hours = 24;\n if (token === 'ko') {\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n return addLeadingZeros(hours, token.length);\n },\n // Minute\n m: function m(date, token, localize) {\n if (token === 'mo') {\n return localize.ordinalNumber(date.getUTCMinutes(), {\n unit: 'minute'\n });\n }\n return lightFormatters.m(date, token);\n },\n // Second\n s: function s(date, token, localize) {\n if (token === 'so') {\n return localize.ordinalNumber(date.getUTCSeconds(), {\n unit: 'second'\n });\n }\n return lightFormatters.s(date, token);\n },\n // Fraction of second\n S: function S(date, token) {\n return lightFormatters.S(date, token);\n },\n // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)\n X: function X(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n if (timezoneOffset === 0) {\n return 'Z';\n }\n switch (token) {\n // Hours and optional minutes\n case 'X':\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XX`\n case 'XXXX':\n case 'XX':\n // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XXX`\n case 'XXXXX':\n case 'XXX': // Hours and minutes with `:` delimiter\n default:\n return formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)\n x: function x(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n switch (token) {\n // Hours and optional minutes\n case 'x':\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xx`\n case 'xxxx':\n case 'xx':\n // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xxx`\n case 'xxxxx':\n case 'xxx': // Hours and minutes with `:` delimiter\n default:\n return formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (GMT)\n O: function O(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n switch (token) {\n // Short\n case 'O':\n case 'OO':\n case 'OOO':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':');\n // Long\n case 'OOOO':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (specific non-location)\n z: function z(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n switch (token) {\n // Short\n case 'z':\n case 'zz':\n case 'zzz':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':');\n // Long\n case 'zzzz':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':');\n }\n },\n // Seconds timestamp\n t: function t(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timestamp = Math.floor(originalDate.getTime() / 1000);\n return addLeadingZeros(timestamp, token.length);\n },\n // Milliseconds timestamp\n T: function T(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timestamp = originalDate.getTime();\n return addLeadingZeros(timestamp, token.length);\n }\n};\nfunction formatTimezoneShort(offset, dirtyDelimiter) {\n var sign = offset > 0 ? '-' : '+';\n var absOffset = Math.abs(offset);\n var hours = Math.floor(absOffset / 60);\n var minutes = absOffset % 60;\n if (minutes === 0) {\n return sign + String(hours);\n }\n var delimiter = dirtyDelimiter || '';\n return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);\n}\nfunction formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {\n if (offset % 60 === 0) {\n var sign = offset > 0 ? '-' : '+';\n return sign + addLeadingZeros(Math.abs(offset) / 60, 2);\n }\n return formatTimezone(offset, dirtyDelimiter);\n}\nfunction formatTimezone(offset, dirtyDelimiter) {\n var delimiter = dirtyDelimiter || '';\n var sign = offset > 0 ? '-' : '+';\n var absOffset = Math.abs(offset);\n var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);\n var minutes = addLeadingZeros(absOffset % 60, 2);\n return sign + hours + delimiter + minutes;\n}\nexport default formatters;", "var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {\n switch (pattern) {\n case 'P':\n return formatLong.date({\n width: 'short'\n });\n case 'PP':\n return formatLong.date({\n width: 'medium'\n });\n case 'PPP':\n return formatLong.date({\n width: 'long'\n });\n case 'PPPP':\n default:\n return formatLong.date({\n width: 'full'\n });\n }\n};\nvar timeLongFormatter = function timeLongFormatter(pattern, formatLong) {\n switch (pattern) {\n case 'p':\n return formatLong.time({\n width: 'short'\n });\n case 'pp':\n return formatLong.time({\n width: 'medium'\n });\n case 'ppp':\n return formatLong.time({\n width: 'long'\n });\n case 'pppp':\n default:\n return formatLong.time({\n width: 'full'\n });\n }\n};\nvar dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {\n var matchResult = pattern.match(/(P+)(p+)?/) || [];\n var datePattern = matchResult[1];\n var timePattern = matchResult[2];\n if (!timePattern) {\n return dateLongFormatter(pattern, formatLong);\n }\n var dateTimeFormat;\n switch (datePattern) {\n case 'P':\n dateTimeFormat = formatLong.dateTime({\n width: 'short'\n });\n break;\n case 'PP':\n dateTimeFormat = formatLong.dateTime({\n width: 'medium'\n });\n break;\n case 'PPP':\n dateTimeFormat = formatLong.dateTime({\n width: 'long'\n });\n break;\n case 'PPPP':\n default:\n dateTimeFormat = formatLong.dateTime({\n width: 'full'\n });\n break;\n }\n return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));\n};\nvar longFormatters = {\n p: timeLongFormatter,\n P: dateTimeLongFormatter\n};\nexport default longFormatters;", "var protectedDayOfYearTokens = ['D', 'DD'];\nvar protectedWeekYearTokens = ['YY', 'YYYY'];\nexport function isProtectedDayOfYearToken(token) {\n return protectedDayOfYearTokens.indexOf(token) !== -1;\n}\nexport function isProtectedWeekYearToken(token) {\n return protectedWeekYearTokens.indexOf(token) !== -1;\n}\nexport function throwProtectedError(token, format, input) {\n if (token === 'YYYY') {\n throw new RangeError(\"Use `yyyy` instead of `YYYY` (in `\".concat(format, \"`) for formatting years to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n } else if (token === 'YY') {\n throw new RangeError(\"Use `yy` instead of `YY` (in `\".concat(format, \"`) for formatting years to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n } else if (token === 'D') {\n throw new RangeError(\"Use `d` instead of `D` (in `\".concat(format, \"`) for formatting days of the month to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n } else if (token === 'DD') {\n throw new RangeError(\"Use `dd` instead of `DD` (in `\".concat(format, \"`) for formatting days of the month to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n }\n}", "var formatDistanceLocale = {\n lessThanXSeconds: {\n one: 'less than a second',\n other: 'less than {{count}} seconds'\n },\n xSeconds: {\n one: '1 second',\n other: '{{count}} seconds'\n },\n halfAMinute: 'half a minute',\n lessThanXMinutes: {\n one: 'less than a minute',\n other: 'less than {{count}} minutes'\n },\n xMinutes: {\n one: '1 minute',\n other: '{{count}} minutes'\n },\n aboutXHours: {\n one: 'about 1 hour',\n other: 'about {{count}} hours'\n },\n xHours: {\n one: '1 hour',\n other: '{{count}} hours'\n },\n xDays: {\n one: '1 day',\n other: '{{count}} days'\n },\n aboutXWeeks: {\n one: 'about 1 week',\n other: 'about {{count}} weeks'\n },\n xWeeks: {\n one: '1 week',\n other: '{{count}} weeks'\n },\n aboutXMonths: {\n one: 'about 1 month',\n other: 'about {{count}} months'\n },\n xMonths: {\n one: '1 month',\n other: '{{count}} months'\n },\n aboutXYears: {\n one: 'about 1 year',\n other: 'about {{count}} years'\n },\n xYears: {\n one: '1 year',\n other: '{{count}} years'\n },\n overXYears: {\n one: 'over 1 year',\n other: 'over {{count}} years'\n },\n almostXYears: {\n one: 'almost 1 year',\n other: 'almost {{count}} years'\n }\n};\nvar formatDistance = function formatDistance(token, count, options) {\n var result;\n var tokenValue = formatDistanceLocale[token];\n if (typeof tokenValue === 'string') {\n result = tokenValue;\n } else if (count === 1) {\n result = tokenValue.one;\n } else {\n result = tokenValue.other.replace('{{count}}', count.toString());\n }\n if (options !== null && options !== void 0 && options.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return 'in ' + result;\n } else {\n return result + ' ago';\n }\n }\n return result;\n};\nexport default formatDistance;", "export default function buildFormatLongFn(args) {\n return function () {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n // TODO: Remove String()\n var width = options.width ? String(options.width) : args.defaultWidth;\n var format = args.formats[width] || args.formats[args.defaultWidth];\n return format;\n };\n}", "import buildFormatLongFn from \"../../../_lib/buildFormatLongFn/index.js\";\nvar dateFormats = {\n full: 'EEEE, MMMM do, y',\n long: 'MMMM do, y',\n medium: 'MMM d, y',\n short: 'MM/dd/yyyy'\n};\nvar timeFormats = {\n full: 'h:mm:ss a zzzz',\n long: 'h:mm:ss a z',\n medium: 'h:mm:ss a',\n short: 'h:mm a'\n};\nvar dateTimeFormats = {\n full: \"{{date}} 'at' {{time}}\",\n long: \"{{date}} 'at' {{time}}\",\n medium: '{{date}}, {{time}}',\n short: '{{date}}, {{time}}'\n};\nvar formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: 'full'\n }),\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: 'full'\n }),\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: 'full'\n })\n};\nexport default formatLong;", "var formatRelativeLocale = {\n lastWeek: \"'last' eeee 'at' p\",\n yesterday: \"'yesterday at' p\",\n today: \"'today at' p\",\n tomorrow: \"'tomorrow at' p\",\n nextWeek: \"eeee 'at' p\",\n other: 'P'\n};\nvar formatRelative = function formatRelative(token, _date, _baseDate, _options) {\n return formatRelativeLocale[token];\n};\nexport default formatRelative;", "export default function buildLocalizeFn(args) {\n return function (dirtyIndex, options) {\n var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';\n var valuesArray;\n if (context === 'formatting' && args.formattingValues) {\n var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;\n var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;\n valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];\n } else {\n var _defaultWidth = args.defaultWidth;\n var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;\n valuesArray = args.values[_width] || args.values[_defaultWidth];\n }\n var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;\n // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!\n return valuesArray[index];\n };\n}", "import buildLocalizeFn from \"../../../_lib/buildLocalizeFn/index.js\";\nvar eraValues = {\n narrow: ['B', 'A'],\n abbreviated: ['BC', 'AD'],\n wide: ['Before Christ', 'Anno Domini']\n};\nvar quarterValues = {\n narrow: ['1', '2', '3', '4'],\n abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],\n wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']\n};\n\n// Note: in English, the names of days of the week and months are capitalized.\n// If you are making a new locale based on this one, check if the same is true for the language you're working on.\n// Generally, formatted dates should look like they are in the middle of a sentence,\n// e.g. in Spanish language the weekdays and months should be in the lowercase.\nvar monthValues = {\n narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],\n abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n};\nvar dayValues = {\n narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],\n short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],\n abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']\n};\nvar dayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mi',\n noon: 'n',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n }\n};\nvar formattingDayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mi',\n noon: 'n',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n }\n};\nvar ordinalNumber = function ordinalNumber(dirtyNumber, _options) {\n var number = Number(dirtyNumber);\n\n // If ordinal numbers depend on context, for example,\n // if they are different for different grammatical genders,\n // use `options.unit`.\n //\n // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',\n // 'day', 'hour', 'minute', 'second'.\n\n var rem100 = number % 100;\n if (rem100 > 20 || rem100 < 10) {\n switch (rem100 % 10) {\n case 1:\n return number + 'st';\n case 2:\n return number + 'nd';\n case 3:\n return number + 'rd';\n }\n }\n return number + 'th';\n};\nvar localize = {\n ordinalNumber: ordinalNumber,\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: 'wide'\n }),\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: 'wide',\n argumentCallback: function argumentCallback(quarter) {\n return quarter - 1;\n }\n }),\n month: buildLocalizeFn({\n values: monthValues,\n defaultWidth: 'wide'\n }),\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: 'wide'\n }),\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: 'wide',\n formattingValues: formattingDayPeriodValues,\n defaultFormattingWidth: 'wide'\n })\n};\nexport default localize;", "export default function buildMatchFn(args) {\n return function (string) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var width = options.width;\n var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];\n var matchResult = string.match(matchPattern);\n if (!matchResult) {\n return null;\n }\n var matchedString = matchResult[0];\n var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];\n var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {\n return pattern.test(matchedString);\n }) : findKey(parsePatterns, function (pattern) {\n return pattern.test(matchedString);\n });\n var value;\n value = args.valueCallback ? args.valueCallback(key) : key;\n value = options.valueCallback ? options.valueCallback(value) : value;\n var rest = string.slice(matchedString.length);\n return {\n value: value,\n rest: rest\n };\n };\n}\nfunction findKey(object, predicate) {\n for (var key in object) {\n if (object.hasOwnProperty(key) && predicate(object[key])) {\n return key;\n }\n }\n return undefined;\n}\nfunction findIndex(array, predicate) {\n for (var key = 0; key < array.length; key++) {\n if (predicate(array[key])) {\n return key;\n }\n }\n return undefined;\n}", "export default function buildMatchPatternFn(args) {\n return function (string) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var matchResult = string.match(args.matchPattern);\n if (!matchResult) return null;\n var matchedString = matchResult[0];\n var parseResult = string.match(args.parsePattern);\n if (!parseResult) return null;\n var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];\n value = options.valueCallback ? options.valueCallback(value) : value;\n var rest = string.slice(matchedString.length);\n return {\n value: value,\n rest: rest\n };\n };\n}", "import buildMatchFn from \"../../../_lib/buildMatchFn/index.js\";\nimport buildMatchPatternFn from \"../../../_lib/buildMatchPatternFn/index.js\";\nvar matchOrdinalNumberPattern = /^(\\d+)(th|st|nd|rd)?/i;\nvar parseOrdinalNumberPattern = /\\d+/i;\nvar matchEraPatterns = {\n narrow: /^(b|a)/i,\n abbreviated: /^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,\n wide: /^(before christ|before common era|anno domini|common era)/i\n};\nvar parseEraPatterns = {\n any: [/^b/i, /^(a|c)/i]\n};\nvar matchQuarterPatterns = {\n narrow: /^[1234]/i,\n abbreviated: /^q[1234]/i,\n wide: /^[1234](th|st|nd|rd)? quarter/i\n};\nvar parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i]\n};\nvar matchMonthPatterns = {\n narrow: /^[jfmasond]/i,\n abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,\n wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i\n};\nvar parseMonthPatterns = {\n narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],\n any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]\n};\nvar matchDayPatterns = {\n narrow: /^[smtwf]/i,\n short: /^(su|mo|tu|we|th|fr|sa)/i,\n abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,\n wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i\n};\nvar parseDayPatterns = {\n narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],\n any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]\n};\nvar matchDayPeriodPatterns = {\n narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,\n any: /^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i\n};\nvar parseDayPeriodPatterns = {\n any: {\n am: /^a/i,\n pm: /^p/i,\n midnight: /^mi/i,\n noon: /^no/i,\n morning: /morning/i,\n afternoon: /afternoon/i,\n evening: /evening/i,\n night: /night/i\n }\n};\nvar match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: function valueCallback(value) {\n return parseInt(value, 10);\n }\n }),\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseEraPatterns,\n defaultParseWidth: 'any'\n }),\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: 'any',\n valueCallback: function valueCallback(index) {\n return index + 1;\n }\n }),\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: 'any'\n }),\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseDayPatterns,\n defaultParseWidth: 'any'\n }),\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: 'any',\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: 'any'\n })\n};\nexport default match;", "import formatDistance from \"./_lib/formatDistance/index.js\";\nimport formatLong from \"./_lib/formatLong/index.js\";\nimport formatRelative from \"./_lib/formatRelative/index.js\";\nimport localize from \"./_lib/localize/index.js\";\nimport match from \"./_lib/match/index.js\";\n/**\n * @type {Locale}\n * @category Locales\n * @summary English locale (United States).\n * @language English\n * @iso-639-2 eng\n * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}\n * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}\n */\nvar locale = {\n code: 'en-US',\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 0 /* Sunday */,\n firstWeekContainsDate: 1\n }\n};\nexport default locale;", "import defaultLocale from \"../../locale/en-US/index.js\";\nexport default defaultLocale;", "import isValid from \"../isValid/index.js\";\nimport subMilliseconds from \"../subMilliseconds/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport formatters from \"../_lib/format/formatters/index.js\";\nimport longFormatters from \"../_lib/format/longFormatters/index.js\";\nimport getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport { isProtectedDayOfYearToken, isProtectedWeekYearToken, throwProtectedError } from \"../_lib/protectedTokens/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getDefaultOptions } from \"../_lib/defaultOptions/index.js\";\nimport defaultLocale from \"../_lib/defaultLocale/index.js\"; // This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\nvar formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g;\n\n// This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\nvar longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\nvar escapedStringRegExp = /^'([^]*?)'?$/;\nvar doubleQuoteRegExp = /''/g;\nvar unescapedLatinCharacterRegExp = /[a-zA-Z]/;\n\n/**\n * @name format\n * @category Common Helpers\n * @summary Format the date.\n *\n * @description\n * Return the formatted date string in the given format. The result may vary by locale.\n *\n * > \u26A0\uFE0F Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * The characters wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n * (see the last example)\n *\n * Format of the string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 7 below the table).\n *\n * Accepted patterns:\n * | Unit | Pattern | Result examples | Notes |\n * |---------------------------------|---------|-----------------------------------|-------|\n * | Era | G..GGG | AD, BC | |\n * | | GGGG | Anno Domini, Before Christ | 2 |\n * | | GGGGG | A, B | |\n * | Calendar year | y | 44, 1, 1900, 2017 | 5 |\n * | | yo | 44th, 1st, 0th, 17th | 5,7 |\n * | | yy | 44, 01, 00, 17 | 5 |\n * | | yyy | 044, 001, 1900, 2017 | 5 |\n * | | yyyy | 0044, 0001, 1900, 2017 | 5 |\n * | | yyyyy | ... | 3,5 |\n * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |\n * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |\n * | | YY | 44, 01, 00, 17 | 5,8 |\n * | | YYY | 044, 001, 1900, 2017 | 5 |\n * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |\n * | | YYYYY | ... | 3,5 |\n * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |\n * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |\n * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |\n * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |\n * | | RRRRR | ... | 3,5,7 |\n * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |\n * | | uu | -43, 01, 1900, 2017 | 5 |\n * | | uuu | -043, 001, 1900, 2017 | 5 |\n * | | uuuu | -0043, 0001, 1900, 2017 | 5 |\n * | | uuuuu | ... | 3,5 |\n * | Quarter (formatting) | Q | 1, 2, 3, 4 | |\n * | | Qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | QQ | 01, 02, 03, 04 | |\n * | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |\n * | | qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | qq | 01, 02, 03, 04 | |\n * | | qqq | Q1, Q2, Q3, Q4 | |\n * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | qqqqq | 1, 2, 3, 4 | 4 |\n * | Month (formatting) | M | 1, 2, ..., 12 | |\n * | | Mo | 1st, 2nd, ..., 12th | 7 |\n * | | MM | 01, 02, ..., 12 | |\n * | | MMM | Jan, Feb, ..., Dec | |\n * | | MMMM | January, February, ..., December | 2 |\n * | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | L | 1, 2, ..., 12 | |\n * | | Lo | 1st, 2nd, ..., 12th | 7 |\n * | | LL | 01, 02, ..., 12 | |\n * | | LLL | Jan, Feb, ..., Dec | |\n * | | LLLL | January, February, ..., December | 2 |\n * | | LLLLL | J, F, ..., D | |\n * | Local week of year | w | 1, 2, ..., 53 | |\n * | | wo | 1st, 2nd, ..., 53th | 7 |\n * | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | I | 1, 2, ..., 53 | 7 |\n * | | Io | 1st, 2nd, ..., 53th | 7 |\n * | | II | 01, 02, ..., 53 | 7 |\n * | Day of month | d | 1, 2, ..., 31 | |\n * | | do | 1st, 2nd, ..., 31st | 7 |\n * | | dd | 01, 02, ..., 31 | |\n * | Day of year | D | 1, 2, ..., 365, 366 | 9 |\n * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |\n * | | DD | 01, 02, ..., 365, 366 | 9 |\n * | | DDD | 001, 002, ..., 365, 366 | |\n * | | DDDD | ... | 3 |\n * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |\n * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | EEEEE | M, T, W, T, F, S, S | |\n * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |\n * | | io | 1st, 2nd, ..., 7th | 7 |\n * | | ii | 01, 02, ..., 07 | 7 |\n * | | iii | Mon, Tue, Wed, ..., Sun | 7 |\n * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |\n * | | iiiii | M, T, W, T, F, S, S | 7 |\n * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |\n * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |\n * | | eo | 2nd, 3rd, ..., 1st | 7 |\n * | | ee | 02, 03, ..., 01 | |\n * | | eee | Mon, Tue, Wed, ..., Sun | |\n * | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | eeeee | M, T, W, T, F, S, S | |\n * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |\n * | | co | 2nd, 3rd, ..., 1st | 7 |\n * | | cc | 02, 03, ..., 01 | |\n * | | ccc | Mon, Tue, Wed, ..., Sun | |\n * | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | ccccc | M, T, W, T, F, S, S | |\n * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | AM, PM | a..aa | AM, PM | |\n * | | aaa | am, pm | |\n * | | aaaa | a.m., p.m. | 2 |\n * | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |\n * | | bbb | am, pm, noon, midnight | |\n * | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | bbbbb | a, p, n, mi | |\n * | Flexible day period | B..BBB | at night, in the morning, ... | |\n * | | BBBB | at night, in the morning, ... | 2 |\n * | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |\n * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |\n * | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |\n * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |\n * | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |\n * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |\n * | | KK | 01, 02, ..., 11, 00 | |\n * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |\n * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |\n * | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | m | 0, 1, ..., 59 | |\n * | | mo | 0th, 1st, ..., 59th | 7 |\n * | | mm | 00, 01, ..., 59 | |\n * | Second | s | 0, 1, ..., 59 | |\n * | | so | 0th, 1st, ..., 59th | 7 |\n * | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | S | 0, 1, ..., 9 | |\n * | | SS | 00, 01, ..., 99 | |\n * | | SSS | 000, 001, ..., 999 | |\n * | | SSSS | ... | 3 |\n * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |\n * | | XX | -0800, +0530, Z | |\n * | | XXX | -08:00, +05:30, Z | |\n * | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |\n * | | xx | -0800, +0530, +0000 | |\n * | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |\n * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |\n * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |\n * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |\n * | Seconds timestamp | t | 512969520 | 7 |\n * | | tt | ... | 3,7 |\n * | Milliseconds timestamp | T | 512969520900 | 7 |\n * | | TT | ... | 3,7 |\n * | Long localized date | P | 04/29/1453 | 7 |\n * | | PP | Apr 29, 1453 | 7 |\n * | | PPP | April 29th, 1453 | 7 |\n * | | PPPP | Friday, April 29th, 1453 | 2,7 |\n * | Long localized time | p | 12:00 AM | 7 |\n * | | pp | 12:00:00 AM | 7 |\n * | | ppp | 12:00:00 AM GMT+2 | 7 |\n * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |\n * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |\n * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |\n * | | PPPppp | April 29th, 1453 at ... | 7 |\n * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)\n * the output will be the same as default pattern for this unit, usually\n * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units\n * are marked with \"2\" in the last column of the table.\n *\n * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`\n *\n * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`\n *\n * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).\n * The output will be padded with zeros to match the length of the pattern.\n *\n * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`\n *\n * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 5. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` always returns the last two digits of a year,\n * while `uu` pads single digit years to 2 characters and returns other years unchanged:\n *\n * | Year | `yy` | `uu` |\n * |------|------|------|\n * | 1 | 01 | 01 |\n * | 14 | 14 | 14 |\n * | 376 | 76 | 376 |\n * | 1453 | 53 | 1453 |\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}\n * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).\n *\n * 6. Specific non-location timezones are currently unavailable in `date-fns`,\n * so right now these tokens fall back to GMT timezones.\n *\n * 7. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `t`: seconds timestamp\n * - `T`: milliseconds timestamp\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.\n * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.\n * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * @param {Date|Number} date - the original date\n * @param {String} format - the string of tokens\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is\n * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @returns {String} the formatted date string\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `date` must not be Invalid Date\n * @throws {RangeError} `options.locale` must contain `localize` property\n * @throws {RangeError} `options.locale` must contain `formatLong` property\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} format string contains an unescaped latin alphabet character\n *\n * @example\n * // Represent 11 February 2014 in middle-endian format:\n * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')\n * //=> '02/11/2014'\n *\n * @example\n * // Represent 2 July 2014 in Esperanto:\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = format(new Date(2014, 6, 2), \"do 'de' MMMM yyyy\", {\n * locale: eoLocale\n * })\n * //=> '2-a de julio 2014'\n *\n * @example\n * // Escape string by single quote characters:\n * const result = format(new Date(2014, 6, 2, 15), \"h 'o''clock'\")\n * //=> \"3 o'clock\"\n */\n\nexport default function format(dirtyDate, dirtyFormatStr, options) {\n var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;\n requiredArgs(2, arguments);\n var formatStr = String(dirtyFormatStr);\n var defaultOptions = getDefaultOptions();\n var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;\n var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1);\n\n // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0);\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n if (!locale.localize) {\n throw new RangeError('locale must contain localize property');\n }\n if (!locale.formatLong) {\n throw new RangeError('locale must contain formatLong property');\n }\n var originalDate = toDate(dirtyDate);\n if (!isValid(originalDate)) {\n throw new RangeError('Invalid time value');\n }\n\n // Convert the date in system timezone to the same date in UTC+00:00 timezone.\n // This ensures that when UTC functions will be implemented, locales will be compatible with them.\n // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376\n var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);\n var utcDate = subMilliseconds(originalDate, timezoneOffset);\n var formatterOptions = {\n firstWeekContainsDate: firstWeekContainsDate,\n weekStartsOn: weekStartsOn,\n locale: locale,\n _originalDate: originalDate\n };\n var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {\n var firstCharacter = substring[0];\n if (firstCharacter === 'p' || firstCharacter === 'P') {\n var longFormatter = longFormatters[firstCharacter];\n return longFormatter(substring, locale.formatLong);\n }\n return substring;\n }).join('').match(formattingTokensRegExp).map(function (substring) {\n // Replace two single quote characters with one single quote character\n if (substring === \"''\") {\n return \"'\";\n }\n var firstCharacter = substring[0];\n if (firstCharacter === \"'\") {\n return cleanEscapedString(substring);\n }\n var formatter = formatters[firstCharacter];\n if (formatter) {\n if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {\n throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));\n }\n if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {\n throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));\n }\n return formatter(utcDate, substring, locale.localize, formatterOptions);\n }\n if (firstCharacter.match(unescapedLatinCharacterRegExp)) {\n throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');\n }\n return substring;\n }).join('');\n return result;\n}\nfunction cleanEscapedString(input) {\n var matched = input.match(escapedStringRegExp);\n if (!matched) {\n return input;\n }\n return matched[1].replace(doubleQuoteRegExp, \"'\");\n}", "export default function assign(target, object) {\n if (target == null) {\n throw new TypeError('assign requires that input parameter not be null or undefined');\n }\n for (var property in object) {\n if (Object.prototype.hasOwnProperty.call(object, property)) {\n ;\n target[property] = object[property];\n }\n }\n return target;\n}", "function _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nexport { _arrayLikeToArray as default };", "import arrayLikeToArray from \"./arrayLikeToArray.js\";\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? arrayLikeToArray(r, a) : void 0;\n }\n}\nexport { _unsupportedIterableToArray as default };", "import unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nfunction _createForOfIteratorHelper(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (!t) {\n if (Array.isArray(r) || (t = unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var _n = 0,\n F = function F() {};\n return {\n s: F,\n n: function n() {\n return _n >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[_n++]\n };\n },\n e: function e(r) {\n throw r;\n },\n f: F\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n var o,\n a = !0,\n u = !1;\n return {\n s: function s() {\n t = t.call(r);\n },\n n: function n() {\n var r = t.next();\n return a = r.done, r;\n },\n e: function e(r) {\n u = !0, o = r;\n },\n f: function f() {\n try {\n a || null == t[\"return\"] || t[\"return\"]();\n } finally {\n if (u) throw o;\n }\n }\n };\n}\nexport { _createForOfIteratorHelper as default };", "function _assertThisInitialized(e) {\n if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return e;\n}\nexport { _assertThisInitialized as default };", "function _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nexport { _setPrototypeOf as default };", "import setPrototypeOf from \"./setPrototypeOf.js\";\nfunction _inherits(t, e) {\n if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\");\n t.prototype = Object.create(e && e.prototype, {\n constructor: {\n value: t,\n writable: !0,\n configurable: !0\n }\n }), Object.defineProperty(t, \"prototype\", {\n writable: !1\n }), e && setPrototypeOf(t, e);\n}\nexport { _inherits as default };", "function _getPrototypeOf(t) {\n return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {\n return t.__proto__ || Object.getPrototypeOf(t);\n }, _getPrototypeOf(t);\n}\nexport { _getPrototypeOf as default };", "function _isNativeReflectConstruct() {\n try {\n var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n } catch (t) {}\n return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {\n return !!t;\n })();\n}\nexport { _isNativeReflectConstruct as default };", "import _typeof from \"./typeof.js\";\nimport assertThisInitialized from \"./assertThisInitialized.js\";\nfunction _possibleConstructorReturn(t, e) {\n if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e;\n if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\");\n return assertThisInitialized(t);\n}\nexport { _possibleConstructorReturn as default };", "import getPrototypeOf from \"./getPrototypeOf.js\";\nimport isNativeReflectConstruct from \"./isNativeReflectConstruct.js\";\nimport possibleConstructorReturn from \"./possibleConstructorReturn.js\";\nfunction _createSuper(t) {\n var r = isNativeReflectConstruct();\n return function () {\n var e,\n o = getPrototypeOf(t);\n if (r) {\n var s = getPrototypeOf(this).constructor;\n e = Reflect.construct(o, arguments, s);\n } else e = o.apply(this, arguments);\n return possibleConstructorReturn(this, e);\n };\n}\nexport { _createSuper as default };", "function _classCallCheck(a, n) {\n if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\");\n}\nexport { _classCallCheck as default };", "import _typeof from \"./typeof.js\";\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nexport { toPrimitive as default };", "import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nexport { toPropertyKey as default };", "import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nexport { _createClass as default };", "import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperty(e, r, t) {\n return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nexport { _defineProperty as default };", "import _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nvar TIMEZONE_UNIT_PRIORITY = 10;\nexport var Setter = /*#__PURE__*/function () {\n function Setter() {\n _classCallCheck(this, Setter);\n _defineProperty(this, \"priority\", void 0);\n _defineProperty(this, \"subPriority\", 0);\n }\n _createClass(Setter, [{\n key: \"validate\",\n value: function validate(_utcDate, _options) {\n return true;\n }\n }]);\n return Setter;\n}();\nexport var ValueSetter = /*#__PURE__*/function (_Setter) {\n _inherits(ValueSetter, _Setter);\n var _super = _createSuper(ValueSetter);\n function ValueSetter(value, validateValue, setValue, priority, subPriority) {\n var _this;\n _classCallCheck(this, ValueSetter);\n _this = _super.call(this);\n _this.value = value;\n _this.validateValue = validateValue;\n _this.setValue = setValue;\n _this.priority = priority;\n if (subPriority) {\n _this.subPriority = subPriority;\n }\n return _this;\n }\n _createClass(ValueSetter, [{\n key: \"validate\",\n value: function validate(utcDate, options) {\n return this.validateValue(utcDate, this.value, options);\n }\n }, {\n key: \"set\",\n value: function set(utcDate, flags, options) {\n return this.setValue(utcDate, flags, this.value, options);\n }\n }]);\n return ValueSetter;\n}(Setter);\nexport var DateToSystemTimezoneSetter = /*#__PURE__*/function (_Setter2) {\n _inherits(DateToSystemTimezoneSetter, _Setter2);\n var _super2 = _createSuper(DateToSystemTimezoneSetter);\n function DateToSystemTimezoneSetter() {\n var _this2;\n _classCallCheck(this, DateToSystemTimezoneSetter);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this2 = _super2.call.apply(_super2, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this2), \"priority\", TIMEZONE_UNIT_PRIORITY);\n _defineProperty(_assertThisInitialized(_this2), \"subPriority\", -1);\n return _this2;\n }\n _createClass(DateToSystemTimezoneSetter, [{\n key: \"set\",\n value: function set(date, flags) {\n if (flags.timestampIsSet) {\n return date;\n }\n var convertedDate = new Date(0);\n convertedDate.setFullYear(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());\n convertedDate.setHours(date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());\n return convertedDate;\n }\n }]);\n return DateToSystemTimezoneSetter;\n}(Setter);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { ValueSetter } from \"./Setter.js\";\nexport var Parser = /*#__PURE__*/function () {\n function Parser() {\n _classCallCheck(this, Parser);\n _defineProperty(this, \"incompatibleTokens\", void 0);\n _defineProperty(this, \"priority\", void 0);\n _defineProperty(this, \"subPriority\", void 0);\n }\n _createClass(Parser, [{\n key: \"run\",\n value: function run(dateString, token, match, options) {\n var result = this.parse(dateString, token, match, options);\n if (!result) {\n return null;\n }\n return {\n setter: new ValueSetter(result.value, this.validate, this.set, this.priority, this.subPriority),\n rest: result.rest\n };\n }\n }, {\n key: \"validate\",\n value: function validate(_utcDate, _value, _options) {\n return true;\n }\n }]);\n return Parser;\n}();", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nexport var EraParser = /*#__PURE__*/function (_Parser) {\n _inherits(EraParser, _Parser);\n var _super = _createSuper(EraParser);\n function EraParser() {\n var _this;\n _classCallCheck(this, EraParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 140);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['R', 'u', 't', 'T']);\n return _this;\n }\n _createClass(EraParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n // AD, BC\n case 'G':\n case 'GG':\n case 'GGG':\n return match.era(dateString, {\n width: 'abbreviated'\n }) || match.era(dateString, {\n width: 'narrow'\n });\n // A, B\n case 'GGGGG':\n return match.era(dateString, {\n width: 'narrow'\n });\n // Anno Domini, Before Christ\n case 'GGGG':\n default:\n return match.era(dateString, {\n width: 'wide'\n }) || match.era(dateString, {\n width: 'abbreviated'\n }) || match.era(dateString, {\n width: 'narrow'\n });\n }\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value) {\n flags.era = value;\n date.setUTCFullYear(value, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n return EraParser;\n}(Parser);", "export var numericPatterns = {\n month: /^(1[0-2]|0?\\d)/,\n // 0 to 12\n date: /^(3[0-1]|[0-2]?\\d)/,\n // 0 to 31\n dayOfYear: /^(36[0-6]|3[0-5]\\d|[0-2]?\\d?\\d)/,\n // 0 to 366\n week: /^(5[0-3]|[0-4]?\\d)/,\n // 0 to 53\n hour23h: /^(2[0-3]|[0-1]?\\d)/,\n // 0 to 23\n hour24h: /^(2[0-4]|[0-1]?\\d)/,\n // 0 to 24\n hour11h: /^(1[0-1]|0?\\d)/,\n // 0 to 11\n hour12h: /^(1[0-2]|0?\\d)/,\n // 0 to 12\n minute: /^[0-5]?\\d/,\n // 0 to 59\n second: /^[0-5]?\\d/,\n // 0 to 59\n\n singleDigit: /^\\d/,\n // 0 to 9\n twoDigits: /^\\d{1,2}/,\n // 0 to 99\n threeDigits: /^\\d{1,3}/,\n // 0 to 999\n fourDigits: /^\\d{1,4}/,\n // 0 to 9999\n\n anyDigitsSigned: /^-?\\d+/,\n singleDigitSigned: /^-?\\d/,\n // 0 to 9, -0 to -9\n twoDigitsSigned: /^-?\\d{1,2}/,\n // 0 to 99, -0 to -99\n threeDigitsSigned: /^-?\\d{1,3}/,\n // 0 to 999, -0 to -999\n fourDigitsSigned: /^-?\\d{1,4}/ // 0 to 9999, -0 to -9999\n};\n\nexport var timezonePatterns = {\n basicOptionalMinutes: /^([+-])(\\d{2})(\\d{2})?|Z/,\n basic: /^([+-])(\\d{2})(\\d{2})|Z/,\n basicOptionalSeconds: /^([+-])(\\d{2})(\\d{2})((\\d{2}))?|Z/,\n extended: /^([+-])(\\d{2}):(\\d{2})|Z/,\n extendedOptionalSeconds: /^([+-])(\\d{2}):(\\d{2})(:(\\d{2}))?|Z/\n};", "import { millisecondsInHour, millisecondsInMinute, millisecondsInSecond } from \"../../constants/index.js\";\nimport { numericPatterns } from \"./constants.js\";\nexport function mapValue(parseFnResult, mapFn) {\n if (!parseFnResult) {\n return parseFnResult;\n }\n return {\n value: mapFn(parseFnResult.value),\n rest: parseFnResult.rest\n };\n}\nexport function parseNumericPattern(pattern, dateString) {\n var matchResult = dateString.match(pattern);\n if (!matchResult) {\n return null;\n }\n return {\n value: parseInt(matchResult[0], 10),\n rest: dateString.slice(matchResult[0].length)\n };\n}\nexport function parseTimezonePattern(pattern, dateString) {\n var matchResult = dateString.match(pattern);\n if (!matchResult) {\n return null;\n }\n\n // Input is 'Z'\n if (matchResult[0] === 'Z') {\n return {\n value: 0,\n rest: dateString.slice(1)\n };\n }\n var sign = matchResult[1] === '+' ? 1 : -1;\n var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;\n var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;\n var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;\n return {\n value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),\n rest: dateString.slice(matchResult[0].length)\n };\n}\nexport function parseAnyDigitsSigned(dateString) {\n return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);\n}\nexport function parseNDigits(n, dateString) {\n switch (n) {\n case 1:\n return parseNumericPattern(numericPatterns.singleDigit, dateString);\n case 2:\n return parseNumericPattern(numericPatterns.twoDigits, dateString);\n case 3:\n return parseNumericPattern(numericPatterns.threeDigits, dateString);\n case 4:\n return parseNumericPattern(numericPatterns.fourDigits, dateString);\n default:\n return parseNumericPattern(new RegExp('^\\\\d{1,' + n + '}'), dateString);\n }\n}\nexport function parseNDigitsSigned(n, dateString) {\n switch (n) {\n case 1:\n return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);\n case 2:\n return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);\n case 3:\n return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);\n case 4:\n return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);\n default:\n return parseNumericPattern(new RegExp('^-?\\\\d{1,' + n + '}'), dateString);\n }\n}\nexport function dayPeriodEnumToHours(dayPeriod) {\n switch (dayPeriod) {\n case 'morning':\n return 4;\n case 'evening':\n return 17;\n case 'pm':\n case 'noon':\n case 'afternoon':\n return 12;\n case 'am':\n case 'midnight':\n case 'night':\n default:\n return 0;\n }\n}\nexport function normalizeTwoDigitYear(twoDigitYear, currentYear) {\n var isCommonEra = currentYear > 0;\n // Absolute number of the current year:\n // 1 -> 1 AC\n // 0 -> 1 BC\n // -1 -> 2 BC\n var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;\n var result;\n if (absCurrentYear <= 50) {\n result = twoDigitYear || 100;\n } else {\n var rangeEnd = absCurrentYear + 50;\n var rangeEndCentury = Math.floor(rangeEnd / 100) * 100;\n var isPreviousCentury = twoDigitYear >= rangeEnd % 100;\n result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);\n }\n return isCommonEra ? result : 1 - result;\n}\nexport function isLeapYearIndex(year) {\n return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;\n}", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, normalizeTwoDigitYear, parseNDigits } from \"../utils.js\";\n// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns\n// | Year | y | yy | yyy | yyyy | yyyyy |\n// |----------|-------|----|-------|-------|-------|\n// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\nexport var YearParser = /*#__PURE__*/function (_Parser) {\n _inherits(YearParser, _Parser);\n var _super = _createSuper(YearParser);\n function YearParser() {\n var _this;\n _classCallCheck(this, YearParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 130);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'u', 'w', 'I', 'i', 'e', 'c', 't', 'T']);\n return _this;\n }\n _createClass(YearParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(year) {\n return {\n year: year,\n isTwoDigitYear: token === 'yy'\n };\n };\n switch (token) {\n case 'y':\n return mapValue(parseNDigits(4, dateString), valueCallback);\n case 'yo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'year'\n }), valueCallback);\n default:\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value.isTwoDigitYear || value.year > 0;\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value) {\n var currentYear = date.getUTCFullYear();\n if (value.isTwoDigitYear) {\n var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);\n date.setUTCFullYear(normalizedTwoDigitYear, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;\n date.setUTCFullYear(year, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n return YearParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigits, normalizeTwoDigitYear, mapValue } from \"../utils.js\";\nimport getUTCWeekYear from \"../../../_lib/getUTCWeekYear/index.js\";\nimport startOfUTCWeek from \"../../../_lib/startOfUTCWeek/index.js\";\n// Local week-numbering year\nexport var LocalWeekYearParser = /*#__PURE__*/function (_Parser) {\n _inherits(LocalWeekYearParser, _Parser);\n var _super = _createSuper(LocalWeekYearParser);\n function LocalWeekYearParser() {\n var _this;\n _classCallCheck(this, LocalWeekYearParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 130);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'R', 'u', 'Q', 'q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']);\n return _this;\n }\n _createClass(LocalWeekYearParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(year) {\n return {\n year: year,\n isTwoDigitYear: token === 'YY'\n };\n };\n switch (token) {\n case 'Y':\n return mapValue(parseNDigits(4, dateString), valueCallback);\n case 'Yo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'year'\n }), valueCallback);\n default:\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value.isTwoDigitYear || value.year > 0;\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value, options) {\n var currentYear = getUTCWeekYear(date, options);\n if (value.isTwoDigitYear) {\n var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);\n date.setUTCFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);\n date.setUTCHours(0, 0, 0, 0);\n return startOfUTCWeek(date, options);\n }\n var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;\n date.setUTCFullYear(year, 0, options.firstWeekContainsDate);\n date.setUTCHours(0, 0, 0, 0);\n return startOfUTCWeek(date, options);\n }\n }]);\n return LocalWeekYearParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigitsSigned } from \"../utils.js\";\nimport startOfUTCISOWeek from \"../../../_lib/startOfUTCISOWeek/index.js\"; // ISO week-numbering year\nexport var ISOWeekYearParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISOWeekYearParser, _Parser);\n var _super = _createSuper(ISOWeekYearParser);\n function ISOWeekYearParser() {\n var _this;\n _classCallCheck(this, ISOWeekYearParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 130);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['G', 'y', 'Y', 'u', 'Q', 'q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']);\n return _this;\n }\n _createClass(ISOWeekYearParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n if (token === 'R') {\n return parseNDigitsSigned(4, dateString);\n }\n return parseNDigitsSigned(token.length, dateString);\n }\n }, {\n key: \"set\",\n value: function set(_date, _flags, value) {\n var firstWeekOfYear = new Date(0);\n firstWeekOfYear.setUTCFullYear(value, 0, 4);\n firstWeekOfYear.setUTCHours(0, 0, 0, 0);\n return startOfUTCISOWeek(firstWeekOfYear);\n }\n }]);\n return ISOWeekYearParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigitsSigned } from \"../utils.js\";\nexport var ExtendedYearParser = /*#__PURE__*/function (_Parser) {\n _inherits(ExtendedYearParser, _Parser);\n var _super = _createSuper(ExtendedYearParser);\n function ExtendedYearParser() {\n var _this;\n _classCallCheck(this, ExtendedYearParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 130);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['G', 'y', 'Y', 'R', 'w', 'I', 'i', 'e', 'c', 't', 'T']);\n return _this;\n }\n _createClass(ExtendedYearParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n if (token === 'u') {\n return parseNDigitsSigned(4, dateString);\n }\n return parseNDigitsSigned(token.length, dateString);\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCFullYear(value, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n return ExtendedYearParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigits } from \"../utils.js\";\nexport var QuarterParser = /*#__PURE__*/function (_Parser) {\n _inherits(QuarterParser, _Parser);\n var _super = _createSuper(QuarterParser);\n function QuarterParser() {\n var _this;\n _classCallCheck(this, QuarterParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 120);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']);\n return _this;\n }\n _createClass(QuarterParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n // 1, 2, 3, 4\n case 'Q':\n case 'QQ':\n // 01, 02, 03, 04\n return parseNDigits(token.length, dateString);\n // 1st, 2nd, 3rd, 4th\n case 'Qo':\n return match.ordinalNumber(dateString, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n case 'QQQ':\n return match.quarter(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.quarter(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case 'QQQQQ':\n return match.quarter(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1st quarter, 2nd quarter, ...\n case 'QQQQ':\n default:\n return match.quarter(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.quarter(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.quarter(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 4;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth((value - 1) * 3, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n return QuarterParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigits } from \"../utils.js\";\nexport var StandAloneQuarterParser = /*#__PURE__*/function (_Parser) {\n _inherits(StandAloneQuarterParser, _Parser);\n var _super = _createSuper(StandAloneQuarterParser);\n function StandAloneQuarterParser() {\n var _this;\n _classCallCheck(this, StandAloneQuarterParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 120);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'Q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']);\n return _this;\n }\n _createClass(StandAloneQuarterParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n // 1, 2, 3, 4\n case 'q':\n case 'qq':\n // 01, 02, 03, 04\n return parseNDigits(token.length, dateString);\n // 1st, 2nd, 3rd, 4th\n case 'qo':\n return match.ordinalNumber(dateString, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n case 'qqq':\n return match.quarter(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.quarter(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case 'qqqqq':\n return match.quarter(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1st quarter, 2nd quarter, ...\n case 'qqqq':\n default:\n return match.quarter(dateString, {\n width: 'wide',\n context: 'standalone'\n }) || match.quarter(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.quarter(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 4;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth((value - 1) * 3, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n return StandAloneQuarterParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { mapValue, parseNDigits, parseNumericPattern } from \"../utils.js\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nexport var MonthParser = /*#__PURE__*/function (_Parser) {\n _inherits(MonthParser, _Parser);\n var _super = _createSuper(MonthParser);\n function MonthParser() {\n var _this;\n _classCallCheck(this, MonthParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'Q', 'L', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);\n _defineProperty(_assertThisInitialized(_this), \"priority\", 110);\n return _this;\n }\n _createClass(MonthParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(value) {\n return value - 1;\n };\n switch (token) {\n // 1, 2, ..., 12\n case 'M':\n return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);\n // 01, 02, ..., 12\n case 'MM':\n return mapValue(parseNDigits(2, dateString), valueCallback);\n // 1st, 2nd, ..., 12th\n case 'Mo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'month'\n }), valueCallback);\n // Jan, Feb, ..., Dec\n case 'MMM':\n return match.month(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.month(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // J, F, ..., D\n case 'MMMMM':\n return match.month(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // January, February, ..., December\n case 'MMMM':\n default:\n return match.month(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.month(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.month(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 11;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth(value, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n return MonthParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits, mapValue } from \"../utils.js\";\nexport var StandAloneMonthParser = /*#__PURE__*/function (_Parser) {\n _inherits(StandAloneMonthParser, _Parser);\n var _super = _createSuper(StandAloneMonthParser);\n function StandAloneMonthParser() {\n var _this;\n _classCallCheck(this, StandAloneMonthParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 110);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'Q', 'M', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);\n return _this;\n }\n _createClass(StandAloneMonthParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(value) {\n return value - 1;\n };\n switch (token) {\n // 1, 2, ..., 12\n case 'L':\n return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);\n // 01, 02, ..., 12\n case 'LL':\n return mapValue(parseNDigits(2, dateString), valueCallback);\n // 1st, 2nd, ..., 12th\n case 'Lo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'month'\n }), valueCallback);\n // Jan, Feb, ..., Dec\n case 'LLL':\n return match.month(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.month(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // J, F, ..., D\n case 'LLLLL':\n return match.month(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // January, February, ..., December\n case 'LLLL':\n default:\n return match.month(dateString, {\n width: 'wide',\n context: 'standalone'\n }) || match.month(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.month(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 11;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth(value, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n return StandAloneMonthParser;\n}(Parser);", "import toInteger from \"../toInteger/index.js\";\nimport toDate from \"../../toDate/index.js\";\nimport getUTCWeek from \"../getUTCWeek/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nexport default function setUTCWeek(dirtyDate, dirtyWeek, options) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var week = toInteger(dirtyWeek);\n var diff = getUTCWeek(date, options) - week;\n date.setUTCDate(date.getUTCDate() - diff * 7);\n return date;\n}", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nimport setUTCWeek from \"../../../_lib/setUTCWeek/index.js\";\nimport startOfUTCWeek from \"../../../_lib/startOfUTCWeek/index.js\"; // Local week of year\nexport var LocalWeekParser = /*#__PURE__*/function (_Parser) {\n _inherits(LocalWeekParser, _Parser);\n var _super = _createSuper(LocalWeekParser);\n function LocalWeekParser() {\n var _this;\n _classCallCheck(this, LocalWeekParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 100);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']);\n return _this;\n }\n _createClass(LocalWeekParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'w':\n return parseNumericPattern(numericPatterns.week, dateString);\n case 'wo':\n return match.ordinalNumber(dateString, {\n unit: 'week'\n });\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 53;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value, options) {\n return startOfUTCWeek(setUTCWeek(date, value, options), options);\n }\n }]);\n return LocalWeekParser;\n}(Parser);", "import toInteger from \"../toInteger/index.js\";\nimport toDate from \"../../toDate/index.js\";\nimport getUTCISOWeek from \"../getUTCISOWeek/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nexport default function setUTCISOWeek(dirtyDate, dirtyISOWeek) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var isoWeek = toInteger(dirtyISOWeek);\n var diff = getUTCISOWeek(date) - isoWeek;\n date.setUTCDate(date.getUTCDate() - diff * 7);\n return date;\n}", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nimport setUTCISOWeek from \"../../../_lib/setUTCISOWeek/index.js\";\nimport startOfUTCISOWeek from \"../../../_lib/startOfUTCISOWeek/index.js\"; // ISO week of year\nexport var ISOWeekParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISOWeekParser, _Parser);\n var _super = _createSuper(ISOWeekParser);\n function ISOWeekParser() {\n var _this;\n _classCallCheck(this, ISOWeekParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 100);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']);\n return _this;\n }\n _createClass(ISOWeekParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'I':\n return parseNumericPattern(numericPatterns.week, dateString);\n case 'Io':\n return match.ordinalNumber(dateString, {\n unit: 'week'\n });\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 53;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n return startOfUTCISOWeek(setUTCISOWeek(date, value));\n }\n }]);\n return ISOWeekParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { isLeapYearIndex, parseNDigits, parseNumericPattern } from \"../utils.js\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nvar DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nvar DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n\n// Day of the month\nexport var DateParser = /*#__PURE__*/function (_Parser) {\n _inherits(DateParser, _Parser);\n var _super = _createSuper(DateParser);\n function DateParser() {\n var _this;\n _classCallCheck(this, DateParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n _defineProperty(_assertThisInitialized(_this), \"subPriority\", 1);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'Q', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);\n return _this;\n }\n _createClass(DateParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'd':\n return parseNumericPattern(numericPatterns.date, dateString);\n case 'do':\n return match.ordinalNumber(dateString, {\n unit: 'date'\n });\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(date, value) {\n var year = date.getUTCFullYear();\n var isLeapYear = isLeapYearIndex(year);\n var month = date.getUTCMonth();\n if (isLeapYear) {\n return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];\n } else {\n return value >= 1 && value <= DAYS_IN_MONTH[month];\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCDate(value);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n return DateParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits, isLeapYearIndex } from \"../utils.js\";\nexport var DayOfYearParser = /*#__PURE__*/function (_Parser) {\n _inherits(DayOfYearParser, _Parser);\n var _super = _createSuper(DayOfYearParser);\n function DayOfYearParser() {\n var _this;\n _classCallCheck(this, DayOfYearParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n _defineProperty(_assertThisInitialized(_this), \"subpriority\", 1);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'Q', 'M', 'L', 'w', 'I', 'd', 'E', 'i', 'e', 'c', 't', 'T']);\n return _this;\n }\n _createClass(DayOfYearParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'D':\n case 'DD':\n return parseNumericPattern(numericPatterns.dayOfYear, dateString);\n case 'Do':\n return match.ordinalNumber(dateString, {\n unit: 'date'\n });\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(date, value) {\n var year = date.getUTCFullYear();\n var isLeapYear = isLeapYearIndex(year);\n if (isLeapYear) {\n return value >= 1 && value <= 366;\n } else {\n return value >= 1 && value <= 365;\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth(0, value);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n return DayOfYearParser;\n}(Parser);", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nimport { getDefaultOptions } from \"../defaultOptions/index.js\";\nexport default function setUTCDay(dirtyDate, dirtyDay, options) {\n var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n requiredArgs(2, arguments);\n var defaultOptions = getDefaultOptions();\n var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n var date = toDate(dirtyDate);\n var day = toInteger(dirtyDay);\n var currentDay = date.getUTCDay();\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n}", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport setUTCDay from \"../../../_lib/setUTCDay/index.js\"; // Day of week\nexport var DayParser = /*#__PURE__*/function (_Parser) {\n _inherits(DayParser, _Parser);\n var _super = _createSuper(DayParser);\n function DayParser() {\n var _this;\n _classCallCheck(this, DayParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['D', 'i', 'e', 'c', 't', 'T']);\n return _this;\n }\n _createClass(DayParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n // Tue\n case 'E':\n case 'EE':\n case 'EEE':\n return match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // T\n case 'EEEEE':\n return match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n case 'EEEEEE':\n return match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tuesday\n case 'EEEE':\n default:\n return match.day(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 6;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n return DayParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, parseNDigits } from \"../utils.js\";\nimport setUTCDay from \"../../../_lib/setUTCDay/index.js\"; // Local day of week\nexport var LocalDayParser = /*#__PURE__*/function (_Parser) {\n _inherits(LocalDayParser, _Parser);\n var _super = _createSuper(LocalDayParser);\n function LocalDayParser() {\n var _this;\n _classCallCheck(this, LocalDayParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'c', 't', 'T']);\n return _this;\n }\n _createClass(LocalDayParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match, options) {\n var valueCallback = function valueCallback(value) {\n var wholeWeekDays = Math.floor((value - 1) / 7) * 7;\n return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;\n };\n switch (token) {\n // 3\n case 'e':\n case 'ee':\n // 03\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n // 3rd\n case 'eo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'day'\n }), valueCallback);\n // Tue\n case 'eee':\n return match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // T\n case 'eeeee':\n return match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n case 'eeeeee':\n return match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tuesday\n case 'eeee':\n default:\n return match.day(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 6;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n return LocalDayParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, parseNDigits } from \"../utils.js\";\nimport setUTCDay from \"../../../_lib/setUTCDay/index.js\"; // Stand-alone local day of week\nexport var StandAloneLocalDayParser = /*#__PURE__*/function (_Parser) {\n _inherits(StandAloneLocalDayParser, _Parser);\n var _super = _createSuper(StandAloneLocalDayParser);\n function StandAloneLocalDayParser() {\n var _this;\n _classCallCheck(this, StandAloneLocalDayParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'e', 't', 'T']);\n return _this;\n }\n _createClass(StandAloneLocalDayParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match, options) {\n var valueCallback = function valueCallback(value) {\n var wholeWeekDays = Math.floor((value - 1) / 7) * 7;\n return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;\n };\n switch (token) {\n // 3\n case 'c':\n case 'cc':\n // 03\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n // 3rd\n case 'co':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'day'\n }), valueCallback);\n // Tue\n case 'ccc':\n return match.day(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'short',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // T\n case 'ccccc':\n return match.day(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tu\n case 'cccccc':\n return match.day(dateString, {\n width: 'short',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tuesday\n case 'cccc':\n default:\n return match.day(dateString, {\n width: 'wide',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'short',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 6;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n return StandAloneLocalDayParser;\n}(Parser);", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nexport default function setUTCISODay(dirtyDate, dirtyDay) {\n requiredArgs(2, arguments);\n var day = toInteger(dirtyDay);\n if (day % 7 === 0) {\n day = day - 7;\n }\n var weekStartsOn = 1;\n var date = toDate(dirtyDate);\n var currentDay = date.getUTCDay();\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n}", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, parseNDigits } from \"../utils.js\";\nimport setUTCISODay from \"../../../_lib/setUTCISODay/index.js\"; // ISO day of week\nexport var ISODayParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISODayParser, _Parser);\n var _super = _createSuper(ISODayParser);\n function ISODayParser() {\n var _this;\n _classCallCheck(this, ISODayParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'E', 'e', 'c', 't', 'T']);\n return _this;\n }\n _createClass(ISODayParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(value) {\n if (value === 0) {\n return 7;\n }\n return value;\n };\n switch (token) {\n // 2\n case 'i':\n case 'ii':\n // 02\n return parseNDigits(token.length, dateString);\n // 2nd\n case 'io':\n return match.ordinalNumber(dateString, {\n unit: 'day'\n });\n // Tue\n case 'iii':\n return mapValue(match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n }), valueCallback);\n // T\n case 'iiiii':\n return mapValue(match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n }), valueCallback);\n // Tu\n case 'iiiiii':\n return mapValue(match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n }), valueCallback);\n // Tuesday\n case 'iiii':\n default:\n return mapValue(match.day(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n }), valueCallback);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 7;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date = setUTCISODay(date, value);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n return ISODayParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { dayPeriodEnumToHours } from \"../utils.js\";\nexport var AMPMParser = /*#__PURE__*/function (_Parser) {\n _inherits(AMPMParser, _Parser);\n var _super = _createSuper(AMPMParser);\n function AMPMParser() {\n var _this;\n _classCallCheck(this, AMPMParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 80);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['b', 'B', 'H', 'k', 't', 'T']);\n return _this;\n }\n _createClass(AMPMParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'a':\n case 'aa':\n case 'aaa':\n return match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n case 'aaaaa':\n return match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n case 'aaaa':\n default:\n return match.dayPeriod(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n }\n }]);\n return AMPMParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { dayPeriodEnumToHours } from \"../utils.js\";\nexport var AMPMMidnightParser = /*#__PURE__*/function (_Parser) {\n _inherits(AMPMMidnightParser, _Parser);\n var _super = _createSuper(AMPMMidnightParser);\n function AMPMMidnightParser() {\n var _this;\n _classCallCheck(this, AMPMMidnightParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 80);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['a', 'B', 'H', 'k', 't', 'T']);\n return _this;\n }\n _createClass(AMPMMidnightParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'b':\n case 'bb':\n case 'bbb':\n return match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n case 'bbbbb':\n return match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n case 'bbbb':\n default:\n return match.dayPeriod(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n }\n }]);\n return AMPMMidnightParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { dayPeriodEnumToHours } from \"../utils.js\"; // in the morning, in the afternoon, in the evening, at night\nexport var DayPeriodParser = /*#__PURE__*/function (_Parser) {\n _inherits(DayPeriodParser, _Parser);\n var _super = _createSuper(DayPeriodParser);\n function DayPeriodParser() {\n var _this;\n _classCallCheck(this, DayPeriodParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 80);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['a', 'b', 't', 'T']);\n return _this;\n }\n _createClass(DayPeriodParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'B':\n case 'BB':\n case 'BBB':\n return match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n case 'BBBBB':\n return match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n case 'BBBB':\n default:\n return match.dayPeriod(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n }\n }]);\n return DayPeriodParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var Hour1to12Parser = /*#__PURE__*/function (_Parser) {\n _inherits(Hour1to12Parser, _Parser);\n var _super = _createSuper(Hour1to12Parser);\n function Hour1to12Parser() {\n var _this;\n _classCallCheck(this, Hour1to12Parser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 70);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['H', 'K', 'k', 't', 'T']);\n return _this;\n }\n _createClass(Hour1to12Parser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'h':\n return parseNumericPattern(numericPatterns.hour12h, dateString);\n case 'ho':\n return match.ordinalNumber(dateString, {\n unit: 'hour'\n });\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 12;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n var isPM = date.getUTCHours() >= 12;\n if (isPM && value < 12) {\n date.setUTCHours(value + 12, 0, 0, 0);\n } else if (!isPM && value === 12) {\n date.setUTCHours(0, 0, 0, 0);\n } else {\n date.setUTCHours(value, 0, 0, 0);\n }\n return date;\n }\n }]);\n return Hour1to12Parser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var Hour0to23Parser = /*#__PURE__*/function (_Parser) {\n _inherits(Hour0to23Parser, _Parser);\n var _super = _createSuper(Hour0to23Parser);\n function Hour0to23Parser() {\n var _this;\n _classCallCheck(this, Hour0to23Parser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 70);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['a', 'b', 'h', 'K', 'k', 't', 'T']);\n return _this;\n }\n _createClass(Hour0to23Parser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'H':\n return parseNumericPattern(numericPatterns.hour23h, dateString);\n case 'Ho':\n return match.ordinalNumber(dateString, {\n unit: 'hour'\n });\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 23;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCHours(value, 0, 0, 0);\n return date;\n }\n }]);\n return Hour0to23Parser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var Hour0To11Parser = /*#__PURE__*/function (_Parser) {\n _inherits(Hour0To11Parser, _Parser);\n var _super = _createSuper(Hour0To11Parser);\n function Hour0To11Parser() {\n var _this;\n _classCallCheck(this, Hour0To11Parser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 70);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['h', 'H', 'k', 't', 'T']);\n return _this;\n }\n _createClass(Hour0To11Parser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'K':\n return parseNumericPattern(numericPatterns.hour11h, dateString);\n case 'Ko':\n return match.ordinalNumber(dateString, {\n unit: 'hour'\n });\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 11;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n var isPM = date.getUTCHours() >= 12;\n if (isPM && value < 12) {\n date.setUTCHours(value + 12, 0, 0, 0);\n } else {\n date.setUTCHours(value, 0, 0, 0);\n }\n return date;\n }\n }]);\n return Hour0To11Parser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var Hour1To24Parser = /*#__PURE__*/function (_Parser) {\n _inherits(Hour1To24Parser, _Parser);\n var _super = _createSuper(Hour1To24Parser);\n function Hour1To24Parser() {\n var _this;\n _classCallCheck(this, Hour1To24Parser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 70);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['a', 'b', 'h', 'H', 'K', 't', 'T']);\n return _this;\n }\n _createClass(Hour1To24Parser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'k':\n return parseNumericPattern(numericPatterns.hour24h, dateString);\n case 'ko':\n return match.ordinalNumber(dateString, {\n unit: 'hour'\n });\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 24;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n var hours = value <= 24 ? value % 24 : value;\n date.setUTCHours(hours, 0, 0, 0);\n return date;\n }\n }]);\n return Hour1To24Parser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var MinuteParser = /*#__PURE__*/function (_Parser) {\n _inherits(MinuteParser, _Parser);\n var _super = _createSuper(MinuteParser);\n function MinuteParser() {\n var _this;\n _classCallCheck(this, MinuteParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 60);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T']);\n return _this;\n }\n _createClass(MinuteParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'm':\n return parseNumericPattern(numericPatterns.minute, dateString);\n case 'mo':\n return match.ordinalNumber(dateString, {\n unit: 'minute'\n });\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 59;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMinutes(value, 0, 0);\n return date;\n }\n }]);\n return MinuteParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var SecondParser = /*#__PURE__*/function (_Parser) {\n _inherits(SecondParser, _Parser);\n var _super = _createSuper(SecondParser);\n function SecondParser() {\n var _this;\n _classCallCheck(this, SecondParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 50);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T']);\n return _this;\n }\n _createClass(SecondParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 's':\n return parseNumericPattern(numericPatterns.second, dateString);\n case 'so':\n return match.ordinalNumber(dateString, {\n unit: 'second'\n });\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 59;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCSeconds(value, 0);\n return date;\n }\n }]);\n return SecondParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, parseNDigits } from \"../utils.js\";\nexport var FractionOfSecondParser = /*#__PURE__*/function (_Parser) {\n _inherits(FractionOfSecondParser, _Parser);\n var _super = _createSuper(FractionOfSecondParser);\n function FractionOfSecondParser() {\n var _this;\n _classCallCheck(this, FractionOfSecondParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 30);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T']);\n return _this;\n }\n _createClass(FractionOfSecondParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n var valueCallback = function valueCallback(value) {\n return Math.floor(value * Math.pow(10, -token.length + 3));\n };\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMilliseconds(value);\n return date;\n }\n }]);\n return FractionOfSecondParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { timezonePatterns } from \"../constants.js\";\nimport { parseTimezonePattern } from \"../utils.js\"; // Timezone (ISO-8601. +00:00 is `'Z'`)\nexport var ISOTimezoneWithZParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISOTimezoneWithZParser, _Parser);\n var _super = _createSuper(ISOTimezoneWithZParser);\n function ISOTimezoneWithZParser() {\n var _this;\n _classCallCheck(this, ISOTimezoneWithZParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 10);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T', 'x']);\n return _this;\n }\n _createClass(ISOTimezoneWithZParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n switch (token) {\n case 'X':\n return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);\n case 'XX':\n return parseTimezonePattern(timezonePatterns.basic, dateString);\n case 'XXXX':\n return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);\n case 'XXXXX':\n return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);\n case 'XXX':\n default:\n return parseTimezonePattern(timezonePatterns.extended, dateString);\n }\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value) {\n if (flags.timestampIsSet) {\n return date;\n }\n return new Date(date.getTime() - value);\n }\n }]);\n return ISOTimezoneWithZParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { timezonePatterns } from \"../constants.js\";\nimport { parseTimezonePattern } from \"../utils.js\"; // Timezone (ISO-8601)\nexport var ISOTimezoneParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISOTimezoneParser, _Parser);\n var _super = _createSuper(ISOTimezoneParser);\n function ISOTimezoneParser() {\n var _this;\n _classCallCheck(this, ISOTimezoneParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 10);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T', 'X']);\n return _this;\n }\n _createClass(ISOTimezoneParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n switch (token) {\n case 'x':\n return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);\n case 'xx':\n return parseTimezonePattern(timezonePatterns.basic, dateString);\n case 'xxxx':\n return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);\n case 'xxxxx':\n return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);\n case 'xxx':\n default:\n return parseTimezonePattern(timezonePatterns.extended, dateString);\n }\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value) {\n if (flags.timestampIsSet) {\n return date;\n }\n return new Date(date.getTime() - value);\n }\n }]);\n return ISOTimezoneParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { parseAnyDigitsSigned } from \"../utils.js\";\nexport var TimestampSecondsParser = /*#__PURE__*/function (_Parser) {\n _inherits(TimestampSecondsParser, _Parser);\n var _super = _createSuper(TimestampSecondsParser);\n function TimestampSecondsParser() {\n var _this;\n _classCallCheck(this, TimestampSecondsParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 40);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", '*');\n return _this;\n }\n _createClass(TimestampSecondsParser, [{\n key: \"parse\",\n value: function parse(dateString) {\n return parseAnyDigitsSigned(dateString);\n }\n }, {\n key: \"set\",\n value: function set(_date, _flags, value) {\n return [new Date(value * 1000), {\n timestampIsSet: true\n }];\n }\n }]);\n return TimestampSecondsParser;\n}(Parser);", "import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { Parser } from \"../Parser.js\";\nimport { parseAnyDigitsSigned } from \"../utils.js\";\nexport var TimestampMillisecondsParser = /*#__PURE__*/function (_Parser) {\n _inherits(TimestampMillisecondsParser, _Parser);\n var _super = _createSuper(TimestampMillisecondsParser);\n function TimestampMillisecondsParser() {\n var _this;\n _classCallCheck(this, TimestampMillisecondsParser);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"priority\", 20);\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", '*');\n return _this;\n }\n _createClass(TimestampMillisecondsParser, [{\n key: \"parse\",\n value: function parse(dateString) {\n return parseAnyDigitsSigned(dateString);\n }\n }, {\n key: \"set\",\n value: function set(_date, _flags, value) {\n return [new Date(value), {\n timestampIsSet: true\n }];\n }\n }]);\n return TimestampMillisecondsParser;\n}(Parser);", "import { EraParser } from \"./EraParser.js\";\nimport { YearParser } from \"./YearParser.js\";\nimport { LocalWeekYearParser } from \"./LocalWeekYearParser.js\";\nimport { ISOWeekYearParser } from \"./ISOWeekYearParser.js\";\nimport { ExtendedYearParser } from \"./ExtendedYearParser.js\";\nimport { QuarterParser } from \"./QuarterParser.js\";\nimport { StandAloneQuarterParser } from \"./StandAloneQuarterParser.js\";\nimport { MonthParser } from \"./MonthParser.js\";\nimport { StandAloneMonthParser } from \"./StandAloneMonthParser.js\";\nimport { LocalWeekParser } from \"./LocalWeekParser.js\";\nimport { ISOWeekParser } from \"./ISOWeekParser.js\";\nimport { DateParser } from \"./DateParser.js\";\nimport { DayOfYearParser } from \"./DayOfYearParser.js\";\nimport { DayParser } from \"./DayParser.js\";\nimport { LocalDayParser } from \"./LocalDayParser.js\";\nimport { StandAloneLocalDayParser } from \"./StandAloneLocalDayParser.js\";\nimport { ISODayParser } from \"./ISODayParser.js\";\nimport { AMPMParser } from \"./AMPMParser.js\";\nimport { AMPMMidnightParser } from \"./AMPMMidnightParser.js\";\nimport { DayPeriodParser } from \"./DayPeriodParser.js\";\nimport { Hour1to12Parser } from \"./Hour1to12Parser.js\";\nimport { Hour0to23Parser } from \"./Hour0to23Parser.js\";\nimport { Hour0To11Parser } from \"./Hour0To11Parser.js\";\nimport { Hour1To24Parser } from \"./Hour1To24Parser.js\";\nimport { MinuteParser } from \"./MinuteParser.js\";\nimport { SecondParser } from \"./SecondParser.js\";\nimport { FractionOfSecondParser } from \"./FractionOfSecondParser.js\";\nimport { ISOTimezoneWithZParser } from \"./ISOTimezoneWithZParser.js\";\nimport { ISOTimezoneParser } from \"./ISOTimezoneParser.js\";\nimport { TimestampSecondsParser } from \"./TimestampSecondsParser.js\";\nimport { TimestampMillisecondsParser } from \"./TimestampMillisecondsParser.js\";\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O* | Timezone (GMT) |\n * | p | | P | |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z* | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `parse` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n */\nexport var parsers = {\n G: new EraParser(),\n y: new YearParser(),\n Y: new LocalWeekYearParser(),\n R: new ISOWeekYearParser(),\n u: new ExtendedYearParser(),\n Q: new QuarterParser(),\n q: new StandAloneQuarterParser(),\n M: new MonthParser(),\n L: new StandAloneMonthParser(),\n w: new LocalWeekParser(),\n I: new ISOWeekParser(),\n d: new DateParser(),\n D: new DayOfYearParser(),\n E: new DayParser(),\n e: new LocalDayParser(),\n c: new StandAloneLocalDayParser(),\n i: new ISODayParser(),\n a: new AMPMParser(),\n b: new AMPMMidnightParser(),\n B: new DayPeriodParser(),\n h: new Hour1to12Parser(),\n H: new Hour0to23Parser(),\n K: new Hour0To11Parser(),\n k: new Hour1To24Parser(),\n m: new MinuteParser(),\n s: new SecondParser(),\n S: new FractionOfSecondParser(),\n X: new ISOTimezoneWithZParser(),\n x: new ISOTimezoneParser(),\n t: new TimestampSecondsParser(),\n T: new TimestampMillisecondsParser()\n};", "import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _createForOfIteratorHelper from \"@babel/runtime/helpers/esm/createForOfIteratorHelper\";\nimport defaultLocale from \"../_lib/defaultLocale/index.js\";\nimport subMilliseconds from \"../subMilliseconds/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport assign from \"../_lib/assign/index.js\";\nimport longFormatters from \"../_lib/format/longFormatters/index.js\";\nimport getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport { isProtectedDayOfYearToken, isProtectedWeekYearToken, throwProtectedError } from \"../_lib/protectedTokens/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { DateToSystemTimezoneSetter } from \"./_lib/Setter.js\";\nimport { parsers } from \"./_lib/parsers/index.js\";\nimport { getDefaultOptions } from \"../_lib/defaultOptions/index.js\"; // This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\nvar formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g;\n\n// This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\nvar longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\nvar escapedStringRegExp = /^'([^]*?)'?$/;\nvar doubleQuoteRegExp = /''/g;\nvar notWhitespaceRegExp = /\\S/;\nvar unescapedLatinCharacterRegExp = /[a-zA-Z]/;\n\n/**\n * @name parse\n * @category Common Helpers\n * @summary Parse the date.\n *\n * @description\n * Return the date parsed from string using the given format string.\n *\n * > \u26A0\uFE0F Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * The characters in the format string wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n *\n * Format of the format string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 5 below the table).\n *\n * Not all tokens are compatible. Combinations that don't make sense or could lead to bugs are prohibited\n * and will throw `RangeError`. For example usage of 24-hour format token with AM/PM token will throw an exception:\n *\n * ```javascript\n * parse('23 AM', 'HH a', new Date())\n * //=> RangeError: The format string mustn't contain `HH` and `a` at the same time\n * ```\n *\n * See the compatibility table: https://docs.google.com/spreadsheets/d/e/2PACX-1vQOPU3xUhplll6dyoMmVUXHKl_8CRDs6_ueLmex3SoqwhuolkuN3O05l4rqx5h1dKX8eb46Ul-CCSrq/pubhtml?gid=0&single=true\n *\n * Accepted format string patterns:\n * | Unit |Prior| Pattern | Result examples | Notes |\n * |---------------------------------|-----|---------|-----------------------------------|-------|\n * | Era | 140 | G..GGG | AD, BC | |\n * | | | GGGG | Anno Domini, Before Christ | 2 |\n * | | | GGGGG | A, B | |\n * | Calendar year | 130 | y | 44, 1, 1900, 2017, 9999 | 4 |\n * | | | yo | 44th, 1st, 1900th, 9999999th | 4,5 |\n * | | | yy | 44, 01, 00, 17 | 4 |\n * | | | yyy | 044, 001, 123, 999 | 4 |\n * | | | yyyy | 0044, 0001, 1900, 2017 | 4 |\n * | | | yyyyy | ... | 2,4 |\n * | Local week-numbering year | 130 | Y | 44, 1, 1900, 2017, 9000 | 4 |\n * | | | Yo | 44th, 1st, 1900th, 9999999th | 4,5 |\n * | | | YY | 44, 01, 00, 17 | 4,6 |\n * | | | YYY | 044, 001, 123, 999 | 4 |\n * | | | YYYY | 0044, 0001, 1900, 2017 | 4,6 |\n * | | | YYYYY | ... | 2,4 |\n * | ISO week-numbering year | 130 | R | -43, 1, 1900, 2017, 9999, -9999 | 4,5 |\n * | | | RR | -43, 01, 00, 17 | 4,5 |\n * | | | RRR | -043, 001, 123, 999, -999 | 4,5 |\n * | | | RRRR | -0043, 0001, 2017, 9999, -9999 | 4,5 |\n * | | | RRRRR | ... | 2,4,5 |\n * | Extended year | 130 | u | -43, 1, 1900, 2017, 9999, -999 | 4 |\n * | | | uu | -43, 01, 99, -99 | 4 |\n * | | | uuu | -043, 001, 123, 999, -999 | 4 |\n * | | | uuuu | -0043, 0001, 2017, 9999, -9999 | 4 |\n * | | | uuuuu | ... | 2,4 |\n * | Quarter (formatting) | 120 | Q | 1, 2, 3, 4 | |\n * | | | Qo | 1st, 2nd, 3rd, 4th | 5 |\n * | | | QQ | 01, 02, 03, 04 | |\n * | | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | 120 | q | 1, 2, 3, 4 | |\n * | | | qo | 1st, 2nd, 3rd, 4th | 5 |\n * | | | qq | 01, 02, 03, 04 | |\n * | | | qqq | Q1, Q2, Q3, Q4 | |\n * | | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | | qqqqq | 1, 2, 3, 4 | 3 |\n * | Month (formatting) | 110 | M | 1, 2, ..., 12 | |\n * | | | Mo | 1st, 2nd, ..., 12th | 5 |\n * | | | MM | 01, 02, ..., 12 | |\n * | | | MMM | Jan, Feb, ..., Dec | |\n * | | | MMMM | January, February, ..., December | 2 |\n * | | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | 110 | L | 1, 2, ..., 12 | |\n * | | | Lo | 1st, 2nd, ..., 12th | 5 |\n * | | | LL | 01, 02, ..., 12 | |\n * | | | LLL | Jan, Feb, ..., Dec | |\n * | | | LLLL | January, February, ..., December | 2 |\n * | | | LLLLL | J, F, ..., D | |\n * | Local week of year | 100 | w | 1, 2, ..., 53 | |\n * | | | wo | 1st, 2nd, ..., 53th | 5 |\n * | | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | 100 | I | 1, 2, ..., 53 | 5 |\n * | | | Io | 1st, 2nd, ..., 53th | 5 |\n * | | | II | 01, 02, ..., 53 | 5 |\n * | Day of month | 90 | d | 1, 2, ..., 31 | |\n * | | | do | 1st, 2nd, ..., 31st | 5 |\n * | | | dd | 01, 02, ..., 31 | |\n * | Day of year | 90 | D | 1, 2, ..., 365, 366 | 7 |\n * | | | Do | 1st, 2nd, ..., 365th, 366th | 5 |\n * | | | DD | 01, 02, ..., 365, 366 | 7 |\n * | | | DDD | 001, 002, ..., 365, 366 | |\n * | | | DDDD | ... | 2 |\n * | Day of week (formatting) | 90 | E..EEE | Mon, Tue, Wed, ..., Sun | |\n * | | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | | EEEEE | M, T, W, T, F, S, S | |\n * | | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | ISO day of week (formatting) | 90 | i | 1, 2, 3, ..., 7 | 5 |\n * | | | io | 1st, 2nd, ..., 7th | 5 |\n * | | | ii | 01, 02, ..., 07 | 5 |\n * | | | iii | Mon, Tue, Wed, ..., Sun | 5 |\n * | | | iiii | Monday, Tuesday, ..., Sunday | 2,5 |\n * | | | iiiii | M, T, W, T, F, S, S | 5 |\n * | | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 5 |\n * | Local day of week (formatting) | 90 | e | 2, 3, 4, ..., 1 | |\n * | | | eo | 2nd, 3rd, ..., 1st | 5 |\n * | | | ee | 02, 03, ..., 01 | |\n * | | | eee | Mon, Tue, Wed, ..., Sun | |\n * | | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | | eeeee | M, T, W, T, F, S, S | |\n * | | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | Local day of week (stand-alone) | 90 | c | 2, 3, 4, ..., 1 | |\n * | | | co | 2nd, 3rd, ..., 1st | 5 |\n * | | | cc | 02, 03, ..., 01 | |\n * | | | ccc | Mon, Tue, Wed, ..., Sun | |\n * | | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | | ccccc | M, T, W, T, F, S, S | |\n * | | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | AM, PM | 80 | a..aaa | AM, PM | |\n * | | | aaaa | a.m., p.m. | 2 |\n * | | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | 80 | b..bbb | AM, PM, noon, midnight | |\n * | | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | | bbbbb | a, p, n, mi | |\n * | Flexible day period | 80 | B..BBB | at night, in the morning, ... | |\n * | | | BBBB | at night, in the morning, ... | 2 |\n * | | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | 70 | h | 1, 2, ..., 11, 12 | |\n * | | | ho | 1st, 2nd, ..., 11th, 12th | 5 |\n * | | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | 70 | H | 0, 1, 2, ..., 23 | |\n * | | | Ho | 0th, 1st, 2nd, ..., 23rd | 5 |\n * | | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | 70 | K | 1, 2, ..., 11, 0 | |\n * | | | Ko | 1st, 2nd, ..., 11th, 0th | 5 |\n * | | | KK | 01, 02, ..., 11, 00 | |\n * | Hour [1-24] | 70 | k | 24, 1, 2, ..., 23 | |\n * | | | ko | 24th, 1st, 2nd, ..., 23rd | 5 |\n * | | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | 60 | m | 0, 1, ..., 59 | |\n * | | | mo | 0th, 1st, ..., 59th | 5 |\n * | | | mm | 00, 01, ..., 59 | |\n * | Second | 50 | s | 0, 1, ..., 59 | |\n * | | | so | 0th, 1st, ..., 59th | 5 |\n * | | | ss | 00, 01, ..., 59 | |\n * | Seconds timestamp | 40 | t | 512969520 | |\n * | | | tt | ... | 2 |\n * | Fraction of second | 30 | S | 0, 1, ..., 9 | |\n * | | | SS | 00, 01, ..., 99 | |\n * | | | SSS | 000, 001, ..., 999 | |\n * | | | SSSS | ... | 2 |\n * | Milliseconds timestamp | 20 | T | 512969520900 | |\n * | | | TT | ... | 2 |\n * | Timezone (ISO-8601 w/ Z) | 10 | X | -08, +0530, Z | |\n * | | | XX | -0800, +0530, Z | |\n * | | | XXX | -08:00, +05:30, Z | |\n * | | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | 10 | x | -08, +0530, +00 | |\n * | | | xx | -0800, +0530, +0000 | |\n * | | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Long localized date | NA | P | 05/29/1453 | 5,8 |\n * | | | PP | May 29, 1453 | |\n * | | | PPP | May 29th, 1453 | |\n * | | | PPPP | Sunday, May 29th, 1453 | 2,5,8 |\n * | Long localized time | NA | p | 12:00 AM | 5,8 |\n * | | | pp | 12:00:00 AM | |\n * | Combination of date and time | NA | Pp | 05/29/1453, 12:00 AM | |\n * | | | PPpp | May 29, 1453, 12:00:00 AM | |\n * | | | PPPpp | May 29th, 1453 at ... | |\n * | | | PPPPpp | Sunday, May 29th, 1453 at ... | 2,5,8 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular.\n * In `format` function, they will produce different result:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * `parse` will try to match both formatting and stand-alone units interchangably.\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table:\n * - for numerical units (`yyyyyyyy`) `parse` will try to match a number\n * as wide as the sequence\n * - for text units (`MMMMMMMM`) `parse` will try to match the widest variation of the unit.\n * These variations are marked with \"2\" in the last column of the table.\n *\n * 3. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 4. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` will try to guess the century of two digit year by proximity with `referenceDate`:\n *\n * `parse('50', 'yy', new Date(2018, 0, 1)) //=> Sat Jan 01 2050 00:00:00`\n *\n * `parse('75', 'yy', new Date(2018, 0, 1)) //=> Wed Jan 01 1975 00:00:00`\n *\n * while `uu` will just assign the year as is:\n *\n * `parse('50', 'uu', new Date(2018, 0, 1)) //=> Sat Jan 01 0050 00:00:00`\n *\n * `parse('75', 'uu', new Date(2018, 0, 1)) //=> Tue Jan 01 0075 00:00:00`\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [setISOWeekYear]{@link https://date-fns.org/docs/setISOWeekYear}\n * and [setWeekYear]{@link https://date-fns.org/docs/setWeekYear}).\n *\n * 5. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 6. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.\n * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 7. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.\n * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 8. `P+` tokens do not have a defined priority since they are merely aliases to other tokens based\n * on the given locale.\n *\n * using `en-US` locale: `P` => `MM/dd/yyyy`\n * using `en-US` locale: `p` => `hh:mm a`\n * using `pt-BR` locale: `P` => `dd/MM/yyyy`\n * using `pt-BR` locale: `p` => `HH:mm`\n *\n * Values will be assigned to the date in the descending order of its unit's priority.\n * Units of an equal priority overwrite each other in the order of appearance.\n *\n * If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year),\n * the values will be taken from 3rd argument `referenceDate` which works as a context of parsing.\n *\n * `referenceDate` must be passed for correct work of the function.\n * If you're not sure which `referenceDate` to supply, create a new instance of Date:\n * `parse('02/11/2014', 'MM/dd/yyyy', new Date())`\n * In this case parsing will be done in the context of the current date.\n * If `referenceDate` is `Invalid Date` or a value not convertible to valid `Date`,\n * then `Invalid Date` will be returned.\n *\n * The result may vary by locale.\n *\n * If `formatString` matches with `dateString` but does not provides tokens, `referenceDate` will be returned.\n *\n * If parsing failed, `Invalid Date` will be returned.\n * Invalid Date is a Date, whose time value is NaN.\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * @param {String} dateString - the string to parse\n * @param {String} formatString - the string of tokens\n * @param {Date|Number} referenceDate - defines values missing from the parsed dateString\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year\n * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @returns {Date} the parsed date\n * @throws {TypeError} 3 arguments required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} `options.locale` must contain `match` property\n * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} format string contains an unescaped latin alphabet character\n *\n * @example\n * // Parse 11 February 2014 from middle-endian format:\n * var result = parse('02/11/2014', 'MM/dd/yyyy', new Date())\n * //=> Tue Feb 11 2014 00:00:00\n *\n * @example\n * // Parse 28th of February in Esperanto locale in the context of 2010 year:\n * import eo from 'date-fns/locale/eo'\n * var result = parse('28-a de februaro', \"do 'de' MMMM\", new Date(2010, 0, 1), {\n * locale: eo\n * })\n * //=> Sun Feb 28 2010 00:00:00\n */\nexport default function parse(dirtyDateString, dirtyFormatString, dirtyReferenceDate, options) {\n var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;\n requiredArgs(3, arguments);\n var dateString = String(dirtyDateString);\n var formatString = String(dirtyFormatString);\n var defaultOptions = getDefaultOptions();\n var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;\n if (!locale.match) {\n throw new RangeError('locale must contain match property');\n }\n var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1);\n\n // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0);\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n if (formatString === '') {\n if (dateString === '') {\n return toDate(dirtyReferenceDate);\n } else {\n return new Date(NaN);\n }\n }\n var subFnOptions = {\n firstWeekContainsDate: firstWeekContainsDate,\n weekStartsOn: weekStartsOn,\n locale: locale\n };\n\n // If timezone isn't specified, it will be set to the system timezone\n var setters = [new DateToSystemTimezoneSetter()];\n var tokens = formatString.match(longFormattingTokensRegExp).map(function (substring) {\n var firstCharacter = substring[0];\n if (firstCharacter in longFormatters) {\n var longFormatter = longFormatters[firstCharacter];\n return longFormatter(substring, locale.formatLong);\n }\n return substring;\n }).join('').match(formattingTokensRegExp);\n var usedTokens = [];\n var _iterator = _createForOfIteratorHelper(tokens),\n _step;\n try {\n var _loop = function _loop() {\n var token = _step.value;\n if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(token)) {\n throwProtectedError(token, formatString, dirtyDateString);\n }\n if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(token)) {\n throwProtectedError(token, formatString, dirtyDateString);\n }\n var firstCharacter = token[0];\n var parser = parsers[firstCharacter];\n if (parser) {\n var incompatibleTokens = parser.incompatibleTokens;\n if (Array.isArray(incompatibleTokens)) {\n var incompatibleToken = usedTokens.find(function (usedToken) {\n return incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter;\n });\n if (incompatibleToken) {\n throw new RangeError(\"The format string mustn't contain `\".concat(incompatibleToken.fullToken, \"` and `\").concat(token, \"` at the same time\"));\n }\n } else if (parser.incompatibleTokens === '*' && usedTokens.length > 0) {\n throw new RangeError(\"The format string mustn't contain `\".concat(token, \"` and any other token at the same time\"));\n }\n usedTokens.push({\n token: firstCharacter,\n fullToken: token\n });\n var parseResult = parser.run(dateString, token, locale.match, subFnOptions);\n if (!parseResult) {\n return {\n v: new Date(NaN)\n };\n }\n setters.push(parseResult.setter);\n dateString = parseResult.rest;\n } else {\n if (firstCharacter.match(unescapedLatinCharacterRegExp)) {\n throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');\n }\n\n // Replace two single quote characters with one single quote character\n if (token === \"''\") {\n token = \"'\";\n } else if (firstCharacter === \"'\") {\n token = cleanEscapedString(token);\n }\n\n // Cut token from string, or, if string doesn't match the token, return Invalid Date\n if (dateString.indexOf(token) === 0) {\n dateString = dateString.slice(token.length);\n } else {\n return {\n v: new Date(NaN)\n };\n }\n }\n };\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var _ret = _loop();\n if (_typeof(_ret) === \"object\") return _ret.v;\n }\n\n // Check if the remaining input contains something other than whitespace\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n if (dateString.length > 0 && notWhitespaceRegExp.test(dateString)) {\n return new Date(NaN);\n }\n var uniquePrioritySetters = setters.map(function (setter) {\n return setter.priority;\n }).sort(function (a, b) {\n return b - a;\n }).filter(function (priority, index, array) {\n return array.indexOf(priority) === index;\n }).map(function (priority) {\n return setters.filter(function (setter) {\n return setter.priority === priority;\n }).sort(function (a, b) {\n return b.subPriority - a.subPriority;\n });\n }).map(function (setterArray) {\n return setterArray[0];\n });\n var date = toDate(dirtyReferenceDate);\n if (isNaN(date.getTime())) {\n return new Date(NaN);\n }\n\n // Convert the date in system timezone to the same date in UTC+00:00 timezone.\n var utcDate = subMilliseconds(date, getTimezoneOffsetInMilliseconds(date));\n var flags = {};\n var _iterator2 = _createForOfIteratorHelper(uniquePrioritySetters),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var setter = _step2.value;\n if (!setter.validate(utcDate, subFnOptions)) {\n return new Date(NaN);\n }\n var result = setter.set(utcDate, flags, subFnOptions);\n // Result is tuple (date, flags)\n if (Array.isArray(result)) {\n utcDate = result[0];\n assign(flags, result[1]);\n // Result is date\n } else {\n utcDate = result;\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n return utcDate;\n}\nfunction cleanEscapedString(input) {\n return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, \"'\");\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name startOfHour\n * @category Hour Helpers\n * @summary Return the start of an hour for the given date.\n *\n * @description\n * Return the start of an hour for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of an hour\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of an hour for 2 September 2014 11:55:00:\n * const result = startOfHour(new Date(2014, 8, 2, 11, 55))\n * //=> Tue Sep 02 2014 11:00:00\n */\nexport default function startOfHour(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setMinutes(0, 0, 0);\n return date;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name startOfSecond\n * @category Second Helpers\n * @summary Return the start of a second for the given date.\n *\n * @description\n * Return the start of a second for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a second\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a second for 1 December 2014 22:15:45.400:\n * const result = startOfSecond(new Date(2014, 11, 1, 22, 15, 45, 400))\n * //=> Mon Dec 01 2014 22:15:45.000\n */\nexport default function startOfSecond(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setMilliseconds(0);\n return date;\n}", "import { millisecondsInHour, millisecondsInMinute } from \"../constants/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\n/**\n * @name parseISO\n * @category Common Helpers\n * @summary Parse ISO string\n *\n * @description\n * Parse the given string in ISO 8601 format and return an instance of Date.\n *\n * Function accepts complete ISO 8601 formats as well as partial implementations.\n * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601\n *\n * If the argument isn't a string, the function cannot parse the string or\n * the values are invalid, it returns Invalid Date.\n *\n * @param {String} argument - the value to convert\n * @param {Object} [options] - an object with options.\n * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format\n * @returns {Date} the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Convert string '2014-02-11T11:30:30' to date:\n * const result = parseISO('2014-02-11T11:30:30')\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert string '+02014101' to date,\n * // if the additional number of digits in the extended year format is 1:\n * const result = parseISO('+02014101', { additionalDigits: 1 })\n * //=> Fri Apr 11 2014 00:00:00\n */\nexport default function parseISO(argument, options) {\n var _options$additionalDi;\n requiredArgs(1, arguments);\n var additionalDigits = toInteger((_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2);\n if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {\n throw new RangeError('additionalDigits must be 0, 1 or 2');\n }\n if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) {\n return new Date(NaN);\n }\n var dateStrings = splitDateString(argument);\n var date;\n if (dateStrings.date) {\n var parseYearResult = parseYear(dateStrings.date, additionalDigits);\n date = parseDate(parseYearResult.restDateString, parseYearResult.year);\n }\n if (!date || isNaN(date.getTime())) {\n return new Date(NaN);\n }\n var timestamp = date.getTime();\n var time = 0;\n var offset;\n if (dateStrings.time) {\n time = parseTime(dateStrings.time);\n if (isNaN(time)) {\n return new Date(NaN);\n }\n }\n if (dateStrings.timezone) {\n offset = parseTimezone(dateStrings.timezone);\n if (isNaN(offset)) {\n return new Date(NaN);\n }\n } else {\n var dirtyDate = new Date(timestamp + time);\n // js parsed string assuming it's in UTC timezone\n // but we need it to be parsed in our timezone\n // so we use utc values to build date in our timezone.\n // Year values from 0 to 99 map to the years 1900 to 1999\n // so set year explicitly with setFullYear.\n var result = new Date(0);\n result.setFullYear(dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate());\n result.setHours(dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds());\n return result;\n }\n return new Date(timestamp + time + offset);\n}\nvar patterns = {\n dateTimeDelimiter: /[T ]/,\n timeZoneDelimiter: /[Z ]/i,\n timezone: /([Z+-].*)$/\n};\nvar dateRegex = /^-?(?:(\\d{3})|(\\d{2})(?:-?(\\d{2}))?|W(\\d{2})(?:-?(\\d{1}))?|)$/;\nvar timeRegex = /^(\\d{2}(?:[.,]\\d*)?)(?::?(\\d{2}(?:[.,]\\d*)?))?(?::?(\\d{2}(?:[.,]\\d*)?))?$/;\nvar timezoneRegex = /^([+-])(\\d{2})(?::?(\\d{2}))?$/;\nfunction splitDateString(dateString) {\n var dateStrings = {};\n var array = dateString.split(patterns.dateTimeDelimiter);\n var timeString;\n\n // The regex match should only return at maximum two array elements.\n // [date], [time], or [date, time].\n if (array.length > 2) {\n return dateStrings;\n }\n if (/:/.test(array[0])) {\n timeString = array[0];\n } else {\n dateStrings.date = array[0];\n timeString = array[1];\n if (patterns.timeZoneDelimiter.test(dateStrings.date)) {\n dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];\n timeString = dateString.substr(dateStrings.date.length, dateString.length);\n }\n }\n if (timeString) {\n var token = patterns.timezone.exec(timeString);\n if (token) {\n dateStrings.time = timeString.replace(token[1], '');\n dateStrings.timezone = token[1];\n } else {\n dateStrings.time = timeString;\n }\n }\n return dateStrings;\n}\nfunction parseYear(dateString, additionalDigits) {\n var regex = new RegExp('^(?:(\\\\d{4}|[+-]\\\\d{' + (4 + additionalDigits) + '})|(\\\\d{2}|[+-]\\\\d{' + (2 + additionalDigits) + '})$)');\n var captures = dateString.match(regex);\n // Invalid ISO-formatted year\n if (!captures) return {\n year: NaN,\n restDateString: ''\n };\n var year = captures[1] ? parseInt(captures[1]) : null;\n var century = captures[2] ? parseInt(captures[2]) : null;\n\n // either year or century is null, not both\n return {\n year: century === null ? year : century * 100,\n restDateString: dateString.slice((captures[1] || captures[2]).length)\n };\n}\nfunction parseDate(dateString, year) {\n // Invalid ISO-formatted year\n if (year === null) return new Date(NaN);\n var captures = dateString.match(dateRegex);\n // Invalid ISO-formatted string\n if (!captures) return new Date(NaN);\n var isWeekDate = !!captures[4];\n var dayOfYear = parseDateUnit(captures[1]);\n var month = parseDateUnit(captures[2]) - 1;\n var day = parseDateUnit(captures[3]);\n var week = parseDateUnit(captures[4]);\n var dayOfWeek = parseDateUnit(captures[5]) - 1;\n if (isWeekDate) {\n if (!validateWeekDate(year, week, dayOfWeek)) {\n return new Date(NaN);\n }\n return dayOfISOWeekYear(year, week, dayOfWeek);\n } else {\n var date = new Date(0);\n if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {\n return new Date(NaN);\n }\n date.setUTCFullYear(year, month, Math.max(dayOfYear, day));\n return date;\n }\n}\nfunction parseDateUnit(value) {\n return value ? parseInt(value) : 1;\n}\nfunction parseTime(timeString) {\n var captures = timeString.match(timeRegex);\n if (!captures) return NaN; // Invalid ISO-formatted time\n\n var hours = parseTimeUnit(captures[1]);\n var minutes = parseTimeUnit(captures[2]);\n var seconds = parseTimeUnit(captures[3]);\n if (!validateTime(hours, minutes, seconds)) {\n return NaN;\n }\n return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000;\n}\nfunction parseTimeUnit(value) {\n return value && parseFloat(value.replace(',', '.')) || 0;\n}\nfunction parseTimezone(timezoneString) {\n if (timezoneString === 'Z') return 0;\n var captures = timezoneString.match(timezoneRegex);\n if (!captures) return 0;\n var sign = captures[1] === '+' ? -1 : 1;\n var hours = parseInt(captures[2]);\n var minutes = captures[3] && parseInt(captures[3]) || 0;\n if (!validateTimezone(hours, minutes)) {\n return NaN;\n }\n return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);\n}\nfunction dayOfISOWeekYear(isoWeekYear, week, day) {\n var date = new Date(0);\n date.setUTCFullYear(isoWeekYear, 0, 4);\n var fourthOfJanuaryDay = date.getUTCDay() || 7;\n var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n}\n\n// Validation functions\n\n// February is null to handle the leap year (using ||)\nvar daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nfunction isLeapYearIndex(year) {\n return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;\n}\nfunction validateDate(year, month, date) {\n return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));\n}\nfunction validateDayOfYearDate(year, dayOfYear) {\n return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);\n}\nfunction validateWeekDate(_year, week, day) {\n return week >= 1 && week <= 53 && day >= 0 && day <= 6;\n}\nfunction validateTime(hours, minutes, seconds) {\n if (hours === 24) {\n return minutes === 0 && seconds === 0;\n }\n return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;\n}\nfunction validateTimezone(_hours, minutes) {\n return minutes >= 0 && minutes <= 59;\n}", "// This file is generated automatically by `scripts/build/indices.ts`. Please, don't change it.\nexport { default as add } from \"./add/index.js\";\nexport { default as addBusinessDays } from \"./addBusinessDays/index.js\";\nexport { default as addDays } from \"./addDays/index.js\";\nexport { default as addHours } from \"./addHours/index.js\";\nexport { default as addISOWeekYears } from \"./addISOWeekYears/index.js\";\nexport { default as addMilliseconds } from \"./addMilliseconds/index.js\";\nexport { default as addMinutes } from \"./addMinutes/index.js\";\nexport { default as addMonths } from \"./addMonths/index.js\";\nexport { default as addQuarters } from \"./addQuarters/index.js\";\nexport { default as addSeconds } from \"./addSeconds/index.js\";\nexport { default as addWeeks } from \"./addWeeks/index.js\";\nexport { default as addYears } from \"./addYears/index.js\";\nexport { default as areIntervalsOverlapping } from \"./areIntervalsOverlapping/index.js\";\nexport { default as clamp } from \"./clamp/index.js\";\nexport { default as closestIndexTo } from \"./closestIndexTo/index.js\";\nexport { default as closestTo } from \"./closestTo/index.js\";\nexport { default as compareAsc } from \"./compareAsc/index.js\";\nexport { default as compareDesc } from \"./compareDesc/index.js\";\nexport { default as daysToWeeks } from \"./daysToWeeks/index.js\";\nexport { default as differenceInBusinessDays } from \"./differenceInBusinessDays/index.js\";\nexport { default as differenceInCalendarDays } from \"./differenceInCalendarDays/index.js\";\nexport { default as differenceInCalendarISOWeekYears } from \"./differenceInCalendarISOWeekYears/index.js\";\nexport { default as differenceInCalendarISOWeeks } from \"./differenceInCalendarISOWeeks/index.js\";\nexport { default as differenceInCalendarMonths } from \"./differenceInCalendarMonths/index.js\";\nexport { default as differenceInCalendarQuarters } from \"./differenceInCalendarQuarters/index.js\";\nexport { default as differenceInCalendarWeeks } from \"./differenceInCalendarWeeks/index.js\";\nexport { default as differenceInCalendarYears } from \"./differenceInCalendarYears/index.js\";\nexport { default as differenceInDays } from \"./differenceInDays/index.js\";\nexport { default as differenceInHours } from \"./differenceInHours/index.js\";\nexport { default as differenceInISOWeekYears } from \"./differenceInISOWeekYears/index.js\";\nexport { default as differenceInMilliseconds } from \"./differenceInMilliseconds/index.js\";\nexport { default as differenceInMinutes } from \"./differenceInMinutes/index.js\";\nexport { default as differenceInMonths } from \"./differenceInMonths/index.js\";\nexport { default as differenceInQuarters } from \"./differenceInQuarters/index.js\";\nexport { default as differenceInSeconds } from \"./differenceInSeconds/index.js\";\nexport { default as differenceInWeeks } from \"./differenceInWeeks/index.js\";\nexport { default as differenceInYears } from \"./differenceInYears/index.js\";\nexport { default as eachDayOfInterval } from \"./eachDayOfInterval/index.js\";\nexport { default as eachHourOfInterval } from \"./eachHourOfInterval/index.js\";\nexport { default as eachMinuteOfInterval } from \"./eachMinuteOfInterval/index.js\";\nexport { default as eachMonthOfInterval } from \"./eachMonthOfInterval/index.js\";\nexport { default as eachQuarterOfInterval } from \"./eachQuarterOfInterval/index.js\";\nexport { default as eachWeekOfInterval } from \"./eachWeekOfInterval/index.js\";\nexport { default as eachWeekendOfInterval } from \"./eachWeekendOfInterval/index.js\";\nexport { default as eachWeekendOfMonth } from \"./eachWeekendOfMonth/index.js\";\nexport { default as eachWeekendOfYear } from \"./eachWeekendOfYear/index.js\";\nexport { default as eachYearOfInterval } from \"./eachYearOfInterval/index.js\";\nexport { default as endOfDay } from \"./endOfDay/index.js\";\nexport { default as endOfDecade } from \"./endOfDecade/index.js\";\nexport { default as endOfHour } from \"./endOfHour/index.js\";\nexport { default as endOfISOWeek } from \"./endOfISOWeek/index.js\";\nexport { default as endOfISOWeekYear } from \"./endOfISOWeekYear/index.js\";\nexport { default as endOfMinute } from \"./endOfMinute/index.js\";\nexport { default as endOfMonth } from \"./endOfMonth/index.js\";\nexport { default as endOfQuarter } from \"./endOfQuarter/index.js\";\nexport { default as endOfSecond } from \"./endOfSecond/index.js\";\nexport { default as endOfToday } from \"./endOfToday/index.js\";\nexport { default as endOfTomorrow } from \"./endOfTomorrow/index.js\";\nexport { default as endOfWeek } from \"./endOfWeek/index.js\";\nexport { default as endOfYear } from \"./endOfYear/index.js\";\nexport { default as endOfYesterday } from \"./endOfYesterday/index.js\";\nexport { default as format } from \"./format/index.js\";\nexport { default as formatDistance } from \"./formatDistance/index.js\";\nexport { default as formatDistanceStrict } from \"./formatDistanceStrict/index.js\";\nexport { default as formatDistanceToNow } from \"./formatDistanceToNow/index.js\";\nexport { default as formatDistanceToNowStrict } from \"./formatDistanceToNowStrict/index.js\";\nexport { default as formatDuration } from \"./formatDuration/index.js\";\nexport { default as formatISO } from \"./formatISO/index.js\";\nexport { default as formatISO9075 } from \"./formatISO9075/index.js\";\nexport { default as formatISODuration } from \"./formatISODuration/index.js\";\nexport { default as formatRFC3339 } from \"./formatRFC3339/index.js\";\nexport { default as formatRFC7231 } from \"./formatRFC7231/index.js\";\nexport { default as formatRelative } from \"./formatRelative/index.js\";\nexport { default as fromUnixTime } from \"./fromUnixTime/index.js\";\nexport { default as getDate } from \"./getDate/index.js\";\nexport { default as getDay } from \"./getDay/index.js\";\nexport { default as getDayOfYear } from \"./getDayOfYear/index.js\";\nexport { default as getDaysInMonth } from \"./getDaysInMonth/index.js\";\nexport { default as getDaysInYear } from \"./getDaysInYear/index.js\";\nexport { default as getDecade } from \"./getDecade/index.js\";\nexport { default as getDefaultOptions } from \"./getDefaultOptions/index.js\";\nexport { default as getHours } from \"./getHours/index.js\";\nexport { default as getISODay } from \"./getISODay/index.js\";\nexport { default as getISOWeek } from \"./getISOWeek/index.js\";\nexport { default as getISOWeekYear } from \"./getISOWeekYear/index.js\";\nexport { default as getISOWeeksInYear } from \"./getISOWeeksInYear/index.js\";\nexport { default as getMilliseconds } from \"./getMilliseconds/index.js\";\nexport { default as getMinutes } from \"./getMinutes/index.js\";\nexport { default as getMonth } from \"./getMonth/index.js\";\nexport { default as getOverlappingDaysInIntervals } from \"./getOverlappingDaysInIntervals/index.js\";\nexport { default as getQuarter } from \"./getQuarter/index.js\";\nexport { default as getSeconds } from \"./getSeconds/index.js\";\nexport { default as getTime } from \"./getTime/index.js\";\nexport { default as getUnixTime } from \"./getUnixTime/index.js\";\nexport { default as getWeek } from \"./getWeek/index.js\";\nexport { default as getWeekOfMonth } from \"./getWeekOfMonth/index.js\";\nexport { default as getWeekYear } from \"./getWeekYear/index.js\";\nexport { default as getWeeksInMonth } from \"./getWeeksInMonth/index.js\";\nexport { default as getYear } from \"./getYear/index.js\";\nexport { default as hoursToMilliseconds } from \"./hoursToMilliseconds/index.js\";\nexport { default as hoursToMinutes } from \"./hoursToMinutes/index.js\";\nexport { default as hoursToSeconds } from \"./hoursToSeconds/index.js\";\nexport { default as intervalToDuration } from \"./intervalToDuration/index.js\";\nexport { default as intlFormat } from \"./intlFormat/index.js\";\nexport { default as intlFormatDistance } from \"./intlFormatDistance/index.js\";\nexport { default as isAfter } from \"./isAfter/index.js\";\nexport { default as isBefore } from \"./isBefore/index.js\";\nexport { default as isDate } from \"./isDate/index.js\";\nexport { default as isEqual } from \"./isEqual/index.js\";\nexport { default as isExists } from \"./isExists/index.js\";\nexport { default as isFirstDayOfMonth } from \"./isFirstDayOfMonth/index.js\";\nexport { default as isFriday } from \"./isFriday/index.js\";\nexport { default as isFuture } from \"./isFuture/index.js\";\nexport { default as isLastDayOfMonth } from \"./isLastDayOfMonth/index.js\";\nexport { default as isLeapYear } from \"./isLeapYear/index.js\";\nexport { default as isMatch } from \"./isMatch/index.js\";\nexport { default as isMonday } from \"./isMonday/index.js\";\nexport { default as isPast } from \"./isPast/index.js\";\nexport { default as isSameDay } from \"./isSameDay/index.js\";\nexport { default as isSameHour } from \"./isSameHour/index.js\";\nexport { default as isSameISOWeek } from \"./isSameISOWeek/index.js\";\nexport { default as isSameISOWeekYear } from \"./isSameISOWeekYear/index.js\";\nexport { default as isSameMinute } from \"./isSameMinute/index.js\";\nexport { default as isSameMonth } from \"./isSameMonth/index.js\";\nexport { default as isSameQuarter } from \"./isSameQuarter/index.js\";\nexport { default as isSameSecond } from \"./isSameSecond/index.js\";\nexport { default as isSameWeek } from \"./isSameWeek/index.js\";\nexport { default as isSameYear } from \"./isSameYear/index.js\";\nexport { default as isSaturday } from \"./isSaturday/index.js\";\nexport { default as isSunday } from \"./isSunday/index.js\";\nexport { default as isThisHour } from \"./isThisHour/index.js\";\nexport { default as isThisISOWeek } from \"./isThisISOWeek/index.js\";\nexport { default as isThisMinute } from \"./isThisMinute/index.js\";\nexport { default as isThisMonth } from \"./isThisMonth/index.js\";\nexport { default as isThisQuarter } from \"./isThisQuarter/index.js\";\nexport { default as isThisSecond } from \"./isThisSecond/index.js\";\nexport { default as isThisWeek } from \"./isThisWeek/index.js\";\nexport { default as isThisYear } from \"./isThisYear/index.js\";\nexport { default as isThursday } from \"./isThursday/index.js\";\nexport { default as isToday } from \"./isToday/index.js\";\nexport { default as isTomorrow } from \"./isTomorrow/index.js\";\nexport { default as isTuesday } from \"./isTuesday/index.js\";\nexport { default as isValid } from \"./isValid/index.js\";\nexport { default as isWednesday } from \"./isWednesday/index.js\";\nexport { default as isWeekend } from \"./isWeekend/index.js\";\nexport { default as isWithinInterval } from \"./isWithinInterval/index.js\";\nexport { default as isYesterday } from \"./isYesterday/index.js\";\nexport { default as lastDayOfDecade } from \"./lastDayOfDecade/index.js\";\nexport { default as lastDayOfISOWeek } from \"./lastDayOfISOWeek/index.js\";\nexport { default as lastDayOfISOWeekYear } from \"./lastDayOfISOWeekYear/index.js\";\nexport { default as lastDayOfMonth } from \"./lastDayOfMonth/index.js\";\nexport { default as lastDayOfQuarter } from \"./lastDayOfQuarter/index.js\";\nexport { default as lastDayOfWeek } from \"./lastDayOfWeek/index.js\";\nexport { default as lastDayOfYear } from \"./lastDayOfYear/index.js\";\nexport { default as lightFormat } from \"./lightFormat/index.js\";\nexport { default as max } from \"./max/index.js\";\nexport { default as milliseconds } from \"./milliseconds/index.js\";\nexport { default as millisecondsToHours } from \"./millisecondsToHours/index.js\";\nexport { default as millisecondsToMinutes } from \"./millisecondsToMinutes/index.js\";\nexport { default as millisecondsToSeconds } from \"./millisecondsToSeconds/index.js\";\nexport { default as min } from \"./min/index.js\";\nexport { default as minutesToHours } from \"./minutesToHours/index.js\";\nexport { default as minutesToMilliseconds } from \"./minutesToMilliseconds/index.js\";\nexport { default as minutesToSeconds } from \"./minutesToSeconds/index.js\";\nexport { default as monthsToQuarters } from \"./monthsToQuarters/index.js\";\nexport { default as monthsToYears } from \"./monthsToYears/index.js\";\nexport { default as nextDay } from \"./nextDay/index.js\";\nexport { default as nextFriday } from \"./nextFriday/index.js\";\nexport { default as nextMonday } from \"./nextMonday/index.js\";\nexport { default as nextSaturday } from \"./nextSaturday/index.js\";\nexport { default as nextSunday } from \"./nextSunday/index.js\";\nexport { default as nextThursday } from \"./nextThursday/index.js\";\nexport { default as nextTuesday } from \"./nextTuesday/index.js\";\nexport { default as nextWednesday } from \"./nextWednesday/index.js\";\nexport { default as parse } from \"./parse/index.js\";\nexport { default as parseISO } from \"./parseISO/index.js\";\nexport { default as parseJSON } from \"./parseJSON/index.js\";\nexport { default as previousDay } from \"./previousDay/index.js\";\nexport { default as previousFriday } from \"./previousFriday/index.js\";\nexport { default as previousMonday } from \"./previousMonday/index.js\";\nexport { default as previousSaturday } from \"./previousSaturday/index.js\";\nexport { default as previousSunday } from \"./previousSunday/index.js\";\nexport { default as previousThursday } from \"./previousThursday/index.js\";\nexport { default as previousTuesday } from \"./previousTuesday/index.js\";\nexport { default as previousWednesday } from \"./previousWednesday/index.js\";\nexport { default as quartersToMonths } from \"./quartersToMonths/index.js\";\nexport { default as quartersToYears } from \"./quartersToYears/index.js\";\nexport { default as roundToNearestMinutes } from \"./roundToNearestMinutes/index.js\";\nexport { default as secondsToHours } from \"./secondsToHours/index.js\";\nexport { default as secondsToMilliseconds } from \"./secondsToMilliseconds/index.js\";\nexport { default as secondsToMinutes } from \"./secondsToMinutes/index.js\";\nexport { default as set } from \"./set/index.js\";\nexport { default as setDate } from \"./setDate/index.js\";\nexport { default as setDay } from \"./setDay/index.js\";\nexport { default as setDayOfYear } from \"./setDayOfYear/index.js\";\nexport { default as setDefaultOptions } from \"./setDefaultOptions/index.js\";\nexport { default as setHours } from \"./setHours/index.js\";\nexport { default as setISODay } from \"./setISODay/index.js\";\nexport { default as setISOWeek } from \"./setISOWeek/index.js\";\nexport { default as setISOWeekYear } from \"./setISOWeekYear/index.js\";\nexport { default as setMilliseconds } from \"./setMilliseconds/index.js\";\nexport { default as setMinutes } from \"./setMinutes/index.js\";\nexport { default as setMonth } from \"./setMonth/index.js\";\nexport { default as setQuarter } from \"./setQuarter/index.js\";\nexport { default as setSeconds } from \"./setSeconds/index.js\";\nexport { default as setWeek } from \"./setWeek/index.js\";\nexport { default as setWeekYear } from \"./setWeekYear/index.js\";\nexport { default as setYear } from \"./setYear/index.js\";\nexport { default as startOfDay } from \"./startOfDay/index.js\";\nexport { default as startOfDecade } from \"./startOfDecade/index.js\";\nexport { default as startOfHour } from \"./startOfHour/index.js\";\nexport { default as startOfISOWeek } from \"./startOfISOWeek/index.js\";\nexport { default as startOfISOWeekYear } from \"./startOfISOWeekYear/index.js\";\nexport { default as startOfMinute } from \"./startOfMinute/index.js\";\nexport { default as startOfMonth } from \"./startOfMonth/index.js\";\nexport { default as startOfQuarter } from \"./startOfQuarter/index.js\";\nexport { default as startOfSecond } from \"./startOfSecond/index.js\";\nexport { default as startOfToday } from \"./startOfToday/index.js\";\nexport { default as startOfTomorrow } from \"./startOfTomorrow/index.js\";\nexport { default as startOfWeek } from \"./startOfWeek/index.js\";\nexport { default as startOfWeekYear } from \"./startOfWeekYear/index.js\";\nexport { default as startOfYear } from \"./startOfYear/index.js\";\nexport { default as startOfYesterday } from \"./startOfYesterday/index.js\";\nexport { default as sub } from \"./sub/index.js\";\nexport { default as subBusinessDays } from \"./subBusinessDays/index.js\";\nexport { default as subDays } from \"./subDays/index.js\";\nexport { default as subHours } from \"./subHours/index.js\";\nexport { default as subISOWeekYears } from \"./subISOWeekYears/index.js\";\nexport { default as subMilliseconds } from \"./subMilliseconds/index.js\";\nexport { default as subMinutes } from \"./subMinutes/index.js\";\nexport { default as subMonths } from \"./subMonths/index.js\";\nexport { default as subQuarters } from \"./subQuarters/index.js\";\nexport { default as subSeconds } from \"./subSeconds/index.js\";\nexport { default as subWeeks } from \"./subWeeks/index.js\";\nexport { default as subYears } from \"./subYears/index.js\";\nexport { default as toDate } from \"./toDate/index.js\";\nexport { default as weeksToDays } from \"./weeksToDays/index.js\";\nexport { default as yearsToMonths } from \"./yearsToMonths/index.js\";\nexport { default as yearsToQuarters } from \"./yearsToQuarters/index.js\";\nexport * from \"./constants/index.js\";", "/*!\n * chartjs-adapter-date-fns v3.0.0\n * https://www.chartjs.org\n * (c) 2022 chartjs-adapter-date-fns Contributors\n * Released under the MIT license\n */\nimport { _adapters } from 'chart.js';\nimport { toDate, parse, parseISO, isValid, format, addYears, addQuarters, addMonths, addWeeks, addDays, addHours, addMinutes, addSeconds, addMilliseconds, differenceInYears, differenceInQuarters, differenceInMonths, differenceInWeeks, differenceInDays, differenceInHours, differenceInMinutes, differenceInSeconds, differenceInMilliseconds, startOfYear, startOfQuarter, startOfMonth, startOfWeek, startOfDay, startOfHour, startOfMinute, startOfSecond, endOfYear, endOfQuarter, endOfMonth, endOfWeek, endOfDay, endOfHour, endOfMinute, endOfSecond } from 'date-fns';\n\nconst FORMATS = {\n datetime: 'MMM d, yyyy, h:mm:ss aaaa',\n millisecond: 'h:mm:ss.SSS aaaa',\n second: 'h:mm:ss aaaa',\n minute: 'h:mm aaaa',\n hour: 'ha',\n day: 'MMM d',\n week: 'PP',\n month: 'MMM yyyy',\n quarter: 'qqq - yyyy',\n year: 'yyyy'\n};\n\n_adapters._date.override({\n _id: 'date-fns', // DEBUG\n\n formats: function() {\n return FORMATS;\n },\n\n parse: function(value, fmt) {\n if (value === null || typeof value === 'undefined') {\n return null;\n }\n const type = typeof value;\n if (type === 'number' || value instanceof Date) {\n value = toDate(value);\n } else if (type === 'string') {\n if (typeof fmt === 'string') {\n value = parse(value, fmt, new Date(), this.options);\n } else {\n value = parseISO(value, this.options);\n }\n }\n return isValid(value) ? value.getTime() : null;\n },\n\n format: function(time, fmt) {\n return format(time, fmt, this.options);\n },\n\n add: function(time, amount, unit) {\n switch (unit) {\n case 'millisecond': return addMilliseconds(time, amount);\n case 'second': return addSeconds(time, amount);\n case 'minute': return addMinutes(time, amount);\n case 'hour': return addHours(time, amount);\n case 'day': return addDays(time, amount);\n case 'week': return addWeeks(time, amount);\n case 'month': return addMonths(time, amount);\n case 'quarter': return addQuarters(time, amount);\n case 'year': return addYears(time, amount);\n default: return time;\n }\n },\n\n diff: function(max, min, unit) {\n switch (unit) {\n case 'millisecond': return differenceInMilliseconds(max, min);\n case 'second': return differenceInSeconds(max, min);\n case 'minute': return differenceInMinutes(max, min);\n case 'hour': return differenceInHours(max, min);\n case 'day': return differenceInDays(max, min);\n case 'week': return differenceInWeeks(max, min);\n case 'month': return differenceInMonths(max, min);\n case 'quarter': return differenceInQuarters(max, min);\n case 'year': return differenceInYears(max, min);\n default: return 0;\n }\n },\n\n startOf: function(time, unit, weekday) {\n switch (unit) {\n case 'second': return startOfSecond(time);\n case 'minute': return startOfMinute(time);\n case 'hour': return startOfHour(time);\n case 'day': return startOfDay(time);\n case 'week': return startOfWeek(time);\n case 'isoWeek': return startOfWeek(time, {weekStartsOn: +weekday});\n case 'month': return startOfMonth(time);\n case 'quarter': return startOfQuarter(time);\n case 'year': return startOfYear(time);\n default: return time;\n }\n },\n\n endOf: function(time, unit) {\n switch (unit) {\n case 'second': return endOfSecond(time);\n case 'minute': return endOfMinute(time);\n case 'hour': return endOfHour(time);\n case 'day': return endOfDay(time);\n case 'week': return endOfWeek(time);\n case 'month': return endOfMonth(time);\n case 'quarter': return endOfQuarter(time);\n case 'year': return endOfYear(time);\n default: return time;\n }\n }\n});\n", "import Chartkick from \"chartkick\"\nimport Chart from \"chart.js/auto\"\nimport \"chartjs-adapter-date-fns\"\n\nChartkick.use(Chart)\n", "require(\"chartkick/chart.js\");\nimport Rails from \"rails-ujs\";\nwindow.Rails = Rails;\nRails.start();\n\nimport \"@hotwired/turbo-rails\";\n\nimport LocalTime from \"./lib/local_time\";\nwindow.LocalTime = LocalTime;\n\nimport \"./orgs/index\";\n", "/*!\nTurbo 8.0.13\nCopyright \u00A9 2025 37signals LLC\n */\n/**\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Javan Makhmali\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n(function (prototype) {\n if (typeof prototype.requestSubmit == \"function\") return\n\n prototype.requestSubmit = function (submitter) {\n if (submitter) {\n validateSubmitter(submitter, this);\n submitter.click();\n } else {\n submitter = document.createElement(\"input\");\n submitter.type = \"submit\";\n submitter.hidden = true;\n this.appendChild(submitter);\n submitter.click();\n this.removeChild(submitter);\n }\n };\n\n function validateSubmitter(submitter, form) {\n submitter instanceof HTMLElement || raise(TypeError, \"parameter 1 is not of type 'HTMLElement'\");\n submitter.type == \"submit\" || raise(TypeError, \"The specified element is not a submit button\");\n submitter.form == form ||\n raise(DOMException, \"The specified element is not owned by this form element\", \"NotFoundError\");\n }\n\n function raise(errorConstructor, message, name) {\n throw new errorConstructor(\"Failed to execute 'requestSubmit' on 'HTMLFormElement': \" + message + \".\", name)\n }\n})(HTMLFormElement.prototype);\n\nconst submittersByForm = new WeakMap();\n\nfunction findSubmitterFromClickTarget(target) {\n const element = target instanceof Element ? target : target instanceof Node ? target.parentElement : null;\n const candidate = element ? element.closest(\"input, button\") : null;\n return candidate?.type == \"submit\" ? candidate : null\n}\n\nfunction clickCaptured(event) {\n const submitter = findSubmitterFromClickTarget(event.target);\n\n if (submitter && submitter.form) {\n submittersByForm.set(submitter.form, submitter);\n }\n}\n\n(function () {\n if (\"submitter\" in Event.prototype) return\n\n let prototype = window.Event.prototype;\n // Certain versions of Safari 15 have a bug where they won't\n // populate the submitter. This hurts TurboDrive's enable/disable detection.\n // See https://bugs.webkit.org/show_bug.cgi?id=229660\n if (\"SubmitEvent\" in window) {\n const prototypeOfSubmitEvent = window.SubmitEvent.prototype;\n\n if (/Apple Computer/.test(navigator.vendor) && !(\"submitter\" in prototypeOfSubmitEvent)) {\n prototype = prototypeOfSubmitEvent;\n } else {\n return // polyfill not needed\n }\n }\n\n addEventListener(\"click\", clickCaptured, true);\n\n Object.defineProperty(prototype, \"submitter\", {\n get() {\n if (this.type == \"submit\" && this.target instanceof HTMLFormElement) {\n return submittersByForm.get(this.target)\n }\n }\n });\n})();\n\nconst FrameLoadingStyle = {\n eager: \"eager\",\n lazy: \"lazy\"\n};\n\n/**\n * Contains a fragment of HTML which is updated based on navigation within\n * it (e.g. via links or form submissions).\n *\n * @customElement turbo-frame\n * @example\n * \n * \n * Show all expanded messages in this frame.\n * \n *\n *

    \n * Show response from this form within this frame.\n *
    \n * \n */\nclass FrameElement extends HTMLElement {\n static delegateConstructor = undefined\n\n loaded = Promise.resolve()\n\n static get observedAttributes() {\n return [\"disabled\", \"loading\", \"src\"]\n }\n\n constructor() {\n super();\n this.delegate = new FrameElement.delegateConstructor(this);\n }\n\n connectedCallback() {\n this.delegate.connect();\n }\n\n disconnectedCallback() {\n this.delegate.disconnect();\n }\n\n reload() {\n return this.delegate.sourceURLReloaded()\n }\n\n attributeChangedCallback(name) {\n if (name == \"loading\") {\n this.delegate.loadingStyleChanged();\n } else if (name == \"src\") {\n this.delegate.sourceURLChanged();\n } else if (name == \"disabled\") {\n this.delegate.disabledChanged();\n }\n }\n\n /**\n * Gets the URL to lazily load source HTML from\n */\n get src() {\n return this.getAttribute(\"src\")\n }\n\n /**\n * Sets the URL to lazily load source HTML from\n */\n set src(value) {\n if (value) {\n this.setAttribute(\"src\", value);\n } else {\n this.removeAttribute(\"src\");\n }\n }\n\n /**\n * Gets the refresh mode for the frame.\n */\n get refresh() {\n return this.getAttribute(\"refresh\")\n }\n\n /**\n * Sets the refresh mode for the frame.\n */\n set refresh(value) {\n if (value) {\n this.setAttribute(\"refresh\", value);\n } else {\n this.removeAttribute(\"refresh\");\n }\n }\n\n get shouldReloadWithMorph() {\n return this.src && this.refresh === \"morph\"\n }\n\n /**\n * Determines if the element is loading\n */\n get loading() {\n return frameLoadingStyleFromString(this.getAttribute(\"loading\") || \"\")\n }\n\n /**\n * Sets the value of if the element is loading\n */\n set loading(value) {\n if (value) {\n this.setAttribute(\"loading\", value);\n } else {\n this.removeAttribute(\"loading\");\n }\n }\n\n /**\n * Gets the disabled state of the frame.\n *\n * If disabled, no requests will be intercepted by the frame.\n */\n get disabled() {\n return this.hasAttribute(\"disabled\")\n }\n\n /**\n * Sets the disabled state of the frame.\n *\n * If disabled, no requests will be intercepted by the frame.\n */\n set disabled(value) {\n if (value) {\n this.setAttribute(\"disabled\", \"\");\n } else {\n this.removeAttribute(\"disabled\");\n }\n }\n\n /**\n * Gets the autoscroll state of the frame.\n *\n * If true, the frame will be scrolled into view automatically on update.\n */\n get autoscroll() {\n return this.hasAttribute(\"autoscroll\")\n }\n\n /**\n * Sets the autoscroll state of the frame.\n *\n * If true, the frame will be scrolled into view automatically on update.\n */\n set autoscroll(value) {\n if (value) {\n this.setAttribute(\"autoscroll\", \"\");\n } else {\n this.removeAttribute(\"autoscroll\");\n }\n }\n\n /**\n * Determines if the element has finished loading\n */\n get complete() {\n return !this.delegate.isLoading\n }\n\n /**\n * Gets the active state of the frame.\n *\n * If inactive, source changes will not be observed.\n */\n get isActive() {\n return this.ownerDocument === document && !this.isPreview\n }\n\n /**\n * Sets the active state of the frame.\n *\n * If inactive, source changes will not be observed.\n */\n get isPreview() {\n return this.ownerDocument?.documentElement?.hasAttribute(\"data-turbo-preview\")\n }\n}\n\nfunction frameLoadingStyleFromString(style) {\n switch (style.toLowerCase()) {\n case \"lazy\":\n return FrameLoadingStyle.lazy\n default:\n return FrameLoadingStyle.eager\n }\n}\n\nconst drive = {\n enabled: true,\n progressBarDelay: 500,\n unvisitableExtensions: new Set(\n [\n \".7z\", \".aac\", \".apk\", \".avi\", \".bmp\", \".bz2\", \".css\", \".csv\", \".deb\", \".dmg\", \".doc\",\n \".docx\", \".exe\", \".gif\", \".gz\", \".heic\", \".heif\", \".ico\", \".iso\", \".jpeg\", \".jpg\",\n \".js\", \".json\", \".m4a\", \".mkv\", \".mov\", \".mp3\", \".mp4\", \".mpeg\", \".mpg\", \".msi\",\n \".ogg\", \".ogv\", \".pdf\", \".pkg\", \".png\", \".ppt\", \".pptx\", \".rar\", \".rtf\",\n \".svg\", \".tar\", \".tif\", \".tiff\", \".txt\", \".wav\", \".webm\", \".webp\", \".wma\", \".wmv\",\n \".xls\", \".xlsx\", \".xml\", \".zip\"\n ]\n )\n};\n\nfunction activateScriptElement(element) {\n if (element.getAttribute(\"data-turbo-eval\") == \"false\") {\n return element\n } else {\n const createdScriptElement = document.createElement(\"script\");\n const cspNonce = getCspNonce();\n if (cspNonce) {\n createdScriptElement.nonce = cspNonce;\n }\n createdScriptElement.textContent = element.textContent;\n createdScriptElement.async = false;\n copyElementAttributes(createdScriptElement, element);\n return createdScriptElement\n }\n}\n\nfunction copyElementAttributes(destinationElement, sourceElement) {\n for (const { name, value } of sourceElement.attributes) {\n destinationElement.setAttribute(name, value);\n }\n}\n\nfunction createDocumentFragment(html) {\n const template = document.createElement(\"template\");\n template.innerHTML = html;\n return template.content\n}\n\nfunction dispatch(eventName, { target, cancelable, detail } = {}) {\n const event = new CustomEvent(eventName, {\n cancelable,\n bubbles: true,\n composed: true,\n detail\n });\n\n if (target && target.isConnected) {\n target.dispatchEvent(event);\n } else {\n document.documentElement.dispatchEvent(event);\n }\n\n return event\n}\n\nfunction cancelEvent(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n}\n\nfunction nextRepaint() {\n if (document.visibilityState === \"hidden\") {\n return nextEventLoopTick()\n } else {\n return nextAnimationFrame()\n }\n}\n\nfunction nextAnimationFrame() {\n return new Promise((resolve) => requestAnimationFrame(() => resolve()))\n}\n\nfunction nextEventLoopTick() {\n return new Promise((resolve) => setTimeout(() => resolve(), 0))\n}\n\nfunction nextMicrotask() {\n return Promise.resolve()\n}\n\nfunction parseHTMLDocument(html = \"\") {\n return new DOMParser().parseFromString(html, \"text/html\")\n}\n\nfunction unindent(strings, ...values) {\n const lines = interpolate(strings, values).replace(/^\\n/, \"\").split(\"\\n\");\n const match = lines[0].match(/^\\s+/);\n const indent = match ? match[0].length : 0;\n return lines.map((line) => line.slice(indent)).join(\"\\n\")\n}\n\nfunction interpolate(strings, values) {\n return strings.reduce((result, string, i) => {\n const value = values[i] == undefined ? \"\" : values[i];\n return result + string + value\n }, \"\")\n}\n\nfunction uuid() {\n return Array.from({ length: 36 })\n .map((_, i) => {\n if (i == 8 || i == 13 || i == 18 || i == 23) {\n return \"-\"\n } else if (i == 14) {\n return \"4\"\n } else if (i == 19) {\n return (Math.floor(Math.random() * 4) + 8).toString(16)\n } else {\n return Math.floor(Math.random() * 15).toString(16)\n }\n })\n .join(\"\")\n}\n\nfunction getAttribute(attributeName, ...elements) {\n for (const value of elements.map((element) => element?.getAttribute(attributeName))) {\n if (typeof value == \"string\") return value\n }\n\n return null\n}\n\nfunction hasAttribute(attributeName, ...elements) {\n return elements.some((element) => element && element.hasAttribute(attributeName))\n}\n\nfunction markAsBusy(...elements) {\n for (const element of elements) {\n if (element.localName == \"turbo-frame\") {\n element.setAttribute(\"busy\", \"\");\n }\n element.setAttribute(\"aria-busy\", \"true\");\n }\n}\n\nfunction clearBusyState(...elements) {\n for (const element of elements) {\n if (element.localName == \"turbo-frame\") {\n element.removeAttribute(\"busy\");\n }\n\n element.removeAttribute(\"aria-busy\");\n }\n}\n\nfunction waitForLoad(element, timeoutInMilliseconds = 2000) {\n return new Promise((resolve) => {\n const onComplete = () => {\n element.removeEventListener(\"error\", onComplete);\n element.removeEventListener(\"load\", onComplete);\n resolve();\n };\n\n element.addEventListener(\"load\", onComplete, { once: true });\n element.addEventListener(\"error\", onComplete, { once: true });\n setTimeout(resolve, timeoutInMilliseconds);\n })\n}\n\nfunction getHistoryMethodForAction(action) {\n switch (action) {\n case \"replace\":\n return history.replaceState\n case \"advance\":\n case \"restore\":\n return history.pushState\n }\n}\n\nfunction isAction(action) {\n return action == \"advance\" || action == \"replace\" || action == \"restore\"\n}\n\nfunction getVisitAction(...elements) {\n const action = getAttribute(\"data-turbo-action\", ...elements);\n\n return isAction(action) ? action : null\n}\n\nfunction getMetaElement(name) {\n return document.querySelector(`meta[name=\"${name}\"]`)\n}\n\nfunction getMetaContent(name) {\n const element = getMetaElement(name);\n return element && element.content\n}\n\nfunction getCspNonce() {\n const element = getMetaElement(\"csp-nonce\");\n\n if (element) {\n const { nonce, content } = element;\n return nonce == \"\" ? content : nonce\n }\n}\n\nfunction setMetaContent(name, content) {\n let element = getMetaElement(name);\n\n if (!element) {\n element = document.createElement(\"meta\");\n element.setAttribute(\"name\", name);\n\n document.head.appendChild(element);\n }\n\n element.setAttribute(\"content\", content);\n\n return element\n}\n\nfunction findClosestRecursively(element, selector) {\n if (element instanceof Element) {\n return (\n element.closest(selector) || findClosestRecursively(element.assignedSlot || element.getRootNode()?.host, selector)\n )\n }\n}\n\nfunction elementIsFocusable(element) {\n const inertDisabledOrHidden = \"[inert], :disabled, [hidden], details:not([open]), dialog:not([open])\";\n\n return !!element && element.closest(inertDisabledOrHidden) == null && typeof element.focus == \"function\"\n}\n\nfunction queryAutofocusableElement(elementOrDocumentFragment) {\n return Array.from(elementOrDocumentFragment.querySelectorAll(\"[autofocus]\")).find(elementIsFocusable)\n}\n\nasync function around(callback, reader) {\n const before = reader();\n\n callback();\n\n await nextAnimationFrame();\n\n const after = reader();\n\n return [before, after]\n}\n\nfunction doesNotTargetIFrame(name) {\n if (name === \"_blank\") {\n return false\n } else if (name) {\n for (const element of document.getElementsByName(name)) {\n if (element instanceof HTMLIFrameElement) return false\n }\n\n return true\n } else {\n return true\n }\n}\n\nfunction findLinkFromClickTarget(target) {\n return findClosestRecursively(target, \"a[href]:not([target^=_]):not([download])\")\n}\n\nfunction getLocationForLink(link) {\n return expandURL(link.getAttribute(\"href\") || \"\")\n}\n\nfunction debounce(fn, delay) {\n let timeoutId = null;\n\n return (...args) => {\n const callback = () => fn.apply(this, args);\n clearTimeout(timeoutId);\n timeoutId = setTimeout(callback, delay);\n }\n}\n\nconst submitter = {\n \"aria-disabled\": {\n beforeSubmit: submitter => {\n submitter.setAttribute(\"aria-disabled\", \"true\");\n submitter.addEventListener(\"click\", cancelEvent);\n },\n\n afterSubmit: submitter => {\n submitter.removeAttribute(\"aria-disabled\");\n submitter.removeEventListener(\"click\", cancelEvent);\n }\n },\n\n \"disabled\": {\n beforeSubmit: submitter => submitter.disabled = true,\n afterSubmit: submitter => submitter.disabled = false\n }\n};\n\nclass Config {\n #submitter = null\n\n constructor(config) {\n Object.assign(this, config);\n }\n\n get submitter() {\n return this.#submitter\n }\n\n set submitter(value) {\n this.#submitter = submitter[value] || value;\n }\n}\n\nconst forms = new Config({\n mode: \"on\",\n submitter: \"disabled\"\n});\n\nconst config = {\n drive,\n forms\n};\n\nfunction expandURL(locatable) {\n return new URL(locatable.toString(), document.baseURI)\n}\n\nfunction getAnchor(url) {\n let anchorMatch;\n if (url.hash) {\n return url.hash.slice(1)\n // eslint-disable-next-line no-cond-assign\n } else if ((anchorMatch = url.href.match(/#(.*)$/))) {\n return anchorMatch[1]\n }\n}\n\nfunction getAction$1(form, submitter) {\n const action = submitter?.getAttribute(\"formaction\") || form.getAttribute(\"action\") || form.action;\n\n return expandURL(action)\n}\n\nfunction getExtension(url) {\n return (getLastPathComponent(url).match(/\\.[^.]*$/) || [])[0] || \"\"\n}\n\nfunction isPrefixedBy(baseURL, url) {\n const prefix = getPrefix(url);\n return baseURL.href === expandURL(prefix).href || baseURL.href.startsWith(prefix)\n}\n\nfunction locationIsVisitable(location, rootLocation) {\n return isPrefixedBy(location, rootLocation) && !config.drive.unvisitableExtensions.has(getExtension(location))\n}\n\nfunction getRequestURL(url) {\n const anchor = getAnchor(url);\n return anchor != null ? url.href.slice(0, -(anchor.length + 1)) : url.href\n}\n\nfunction toCacheKey(url) {\n return getRequestURL(url)\n}\n\nfunction urlsAreEqual(left, right) {\n return expandURL(left).href == expandURL(right).href\n}\n\nfunction getPathComponents(url) {\n return url.pathname.split(\"/\").slice(1)\n}\n\nfunction getLastPathComponent(url) {\n return getPathComponents(url).slice(-1)[0]\n}\n\nfunction getPrefix(url) {\n return addTrailingSlash(url.origin + url.pathname)\n}\n\nfunction addTrailingSlash(value) {\n return value.endsWith(\"/\") ? value : value + \"/\"\n}\n\nclass FetchResponse {\n constructor(response) {\n this.response = response;\n }\n\n get succeeded() {\n return this.response.ok\n }\n\n get failed() {\n return !this.succeeded\n }\n\n get clientError() {\n return this.statusCode >= 400 && this.statusCode <= 499\n }\n\n get serverError() {\n return this.statusCode >= 500 && this.statusCode <= 599\n }\n\n get redirected() {\n return this.response.redirected\n }\n\n get location() {\n return expandURL(this.response.url)\n }\n\n get isHTML() {\n return this.contentType && this.contentType.match(/^(?:text\\/([^\\s;,]+\\b)?html|application\\/xhtml\\+xml)\\b/)\n }\n\n get statusCode() {\n return this.response.status\n }\n\n get contentType() {\n return this.header(\"Content-Type\")\n }\n\n get responseText() {\n return this.response.clone().text()\n }\n\n get responseHTML() {\n if (this.isHTML) {\n return this.response.clone().text()\n } else {\n return Promise.resolve(undefined)\n }\n }\n\n header(name) {\n return this.response.headers.get(name)\n }\n}\n\nclass LimitedSet extends Set {\n constructor(maxSize) {\n super();\n this.maxSize = maxSize;\n }\n\n add(value) {\n if (this.size >= this.maxSize) {\n const iterator = this.values();\n const oldestValue = iterator.next().value;\n this.delete(oldestValue);\n }\n super.add(value);\n }\n}\n\nconst recentRequests = new LimitedSet(20);\n\nconst nativeFetch = window.fetch;\n\nfunction fetchWithTurboHeaders(url, options = {}) {\n const modifiedHeaders = new Headers(options.headers || {});\n const requestUID = uuid();\n recentRequests.add(requestUID);\n modifiedHeaders.append(\"X-Turbo-Request-Id\", requestUID);\n\n return nativeFetch(url, {\n ...options,\n headers: modifiedHeaders\n })\n}\n\nfunction fetchMethodFromString(method) {\n switch (method.toLowerCase()) {\n case \"get\":\n return FetchMethod.get\n case \"post\":\n return FetchMethod.post\n case \"put\":\n return FetchMethod.put\n case \"patch\":\n return FetchMethod.patch\n case \"delete\":\n return FetchMethod.delete\n }\n}\n\nconst FetchMethod = {\n get: \"get\",\n post: \"post\",\n put: \"put\",\n patch: \"patch\",\n delete: \"delete\"\n};\n\nfunction fetchEnctypeFromString(encoding) {\n switch (encoding.toLowerCase()) {\n case FetchEnctype.multipart:\n return FetchEnctype.multipart\n case FetchEnctype.plain:\n return FetchEnctype.plain\n default:\n return FetchEnctype.urlEncoded\n }\n}\n\nconst FetchEnctype = {\n urlEncoded: \"application/x-www-form-urlencoded\",\n multipart: \"multipart/form-data\",\n plain: \"text/plain\"\n};\n\nclass FetchRequest {\n abortController = new AbortController()\n #resolveRequestPromise = (_value) => {}\n\n constructor(delegate, method, location, requestBody = new URLSearchParams(), target = null, enctype = FetchEnctype.urlEncoded) {\n const [url, body] = buildResourceAndBody(expandURL(location), method, requestBody, enctype);\n\n this.delegate = delegate;\n this.url = url;\n this.target = target;\n this.fetchOptions = {\n credentials: \"same-origin\",\n redirect: \"follow\",\n method: method.toUpperCase(),\n headers: { ...this.defaultHeaders },\n body: body,\n signal: this.abortSignal,\n referrer: this.delegate.referrer?.href\n };\n this.enctype = enctype;\n }\n\n get method() {\n return this.fetchOptions.method\n }\n\n set method(value) {\n const fetchBody = this.isSafe ? this.url.searchParams : this.fetchOptions.body || new FormData();\n const fetchMethod = fetchMethodFromString(value) || FetchMethod.get;\n\n this.url.search = \"\";\n\n const [url, body] = buildResourceAndBody(this.url, fetchMethod, fetchBody, this.enctype);\n\n this.url = url;\n this.fetchOptions.body = body;\n this.fetchOptions.method = fetchMethod.toUpperCase();\n }\n\n get headers() {\n return this.fetchOptions.headers\n }\n\n set headers(value) {\n this.fetchOptions.headers = value;\n }\n\n get body() {\n if (this.isSafe) {\n return this.url.searchParams\n } else {\n return this.fetchOptions.body\n }\n }\n\n set body(value) {\n this.fetchOptions.body = value;\n }\n\n get location() {\n return this.url\n }\n\n get params() {\n return this.url.searchParams\n }\n\n get entries() {\n return this.body ? Array.from(this.body.entries()) : []\n }\n\n cancel() {\n this.abortController.abort();\n }\n\n async perform() {\n const { fetchOptions } = this;\n this.delegate.prepareRequest(this);\n const event = await this.#allowRequestToBeIntercepted(fetchOptions);\n try {\n this.delegate.requestStarted(this);\n\n if (event.detail.fetchRequest) {\n this.response = event.detail.fetchRequest.response;\n } else {\n this.response = fetchWithTurboHeaders(this.url.href, fetchOptions);\n }\n\n const response = await this.response;\n return await this.receive(response)\n } catch (error) {\n if (error.name !== \"AbortError\") {\n if (this.#willDelegateErrorHandling(error)) {\n this.delegate.requestErrored(this, error);\n }\n throw error\n }\n } finally {\n this.delegate.requestFinished(this);\n }\n }\n\n async receive(response) {\n const fetchResponse = new FetchResponse(response);\n const event = dispatch(\"turbo:before-fetch-response\", {\n cancelable: true,\n detail: { fetchResponse },\n target: this.target\n });\n if (event.defaultPrevented) {\n this.delegate.requestPreventedHandlingResponse(this, fetchResponse);\n } else if (fetchResponse.succeeded) {\n this.delegate.requestSucceededWithResponse(this, fetchResponse);\n } else {\n this.delegate.requestFailedWithResponse(this, fetchResponse);\n }\n return fetchResponse\n }\n\n get defaultHeaders() {\n return {\n Accept: \"text/html, application/xhtml+xml\"\n }\n }\n\n get isSafe() {\n return isSafe(this.method)\n }\n\n get abortSignal() {\n return this.abortController.signal\n }\n\n acceptResponseType(mimeType) {\n this.headers[\"Accept\"] = [mimeType, this.headers[\"Accept\"]].join(\", \");\n }\n\n async #allowRequestToBeIntercepted(fetchOptions) {\n const requestInterception = new Promise((resolve) => (this.#resolveRequestPromise = resolve));\n const event = dispatch(\"turbo:before-fetch-request\", {\n cancelable: true,\n detail: {\n fetchOptions,\n url: this.url,\n resume: this.#resolveRequestPromise\n },\n target: this.target\n });\n this.url = event.detail.url;\n if (event.defaultPrevented) await requestInterception;\n\n return event\n }\n\n #willDelegateErrorHandling(error) {\n const event = dispatch(\"turbo:fetch-request-error\", {\n target: this.target,\n cancelable: true,\n detail: { request: this, error: error }\n });\n\n return !event.defaultPrevented\n }\n}\n\nfunction isSafe(fetchMethod) {\n return fetchMethodFromString(fetchMethod) == FetchMethod.get\n}\n\nfunction buildResourceAndBody(resource, method, requestBody, enctype) {\n const searchParams =\n Array.from(requestBody).length > 0 ? new URLSearchParams(entriesExcludingFiles(requestBody)) : resource.searchParams;\n\n if (isSafe(method)) {\n return [mergeIntoURLSearchParams(resource, searchParams), null]\n } else if (enctype == FetchEnctype.urlEncoded) {\n return [resource, searchParams]\n } else {\n return [resource, requestBody]\n }\n}\n\nfunction entriesExcludingFiles(requestBody) {\n const entries = [];\n\n for (const [name, value] of requestBody) {\n if (value instanceof File) continue\n else entries.push([name, value]);\n }\n\n return entries\n}\n\nfunction mergeIntoURLSearchParams(url, requestBody) {\n const searchParams = new URLSearchParams(entriesExcludingFiles(requestBody));\n\n url.search = searchParams.toString();\n\n return url\n}\n\nclass AppearanceObserver {\n started = false\n\n constructor(delegate, element) {\n this.delegate = delegate;\n this.element = element;\n this.intersectionObserver = new IntersectionObserver(this.intersect);\n }\n\n start() {\n if (!this.started) {\n this.started = true;\n this.intersectionObserver.observe(this.element);\n }\n }\n\n stop() {\n if (this.started) {\n this.started = false;\n this.intersectionObserver.unobserve(this.element);\n }\n }\n\n intersect = (entries) => {\n const lastEntry = entries.slice(-1)[0];\n if (lastEntry?.isIntersecting) {\n this.delegate.elementAppearedInViewport(this.element);\n }\n }\n}\n\nclass StreamMessage {\n static contentType = \"text/vnd.turbo-stream.html\"\n\n static wrap(message) {\n if (typeof message == \"string\") {\n return new this(createDocumentFragment(message))\n } else {\n return message\n }\n }\n\n constructor(fragment) {\n this.fragment = importStreamElements(fragment);\n }\n}\n\nfunction importStreamElements(fragment) {\n for (const element of fragment.querySelectorAll(\"turbo-stream\")) {\n const streamElement = document.importNode(element, true);\n\n for (const inertScriptElement of streamElement.templateElement.content.querySelectorAll(\"script\")) {\n inertScriptElement.replaceWith(activateScriptElement(inertScriptElement));\n }\n\n element.replaceWith(streamElement);\n }\n\n return fragment\n}\n\nconst PREFETCH_DELAY = 100;\n\nclass PrefetchCache {\n #prefetchTimeout = null\n #prefetched = null\n\n get(url) {\n if (this.#prefetched && this.#prefetched.url === url && this.#prefetched.expire > Date.now()) {\n return this.#prefetched.request\n }\n }\n\n setLater(url, request, ttl) {\n this.clear();\n\n this.#prefetchTimeout = setTimeout(() => {\n request.perform();\n this.set(url, request, ttl);\n this.#prefetchTimeout = null;\n }, PREFETCH_DELAY);\n }\n\n set(url, request, ttl) {\n this.#prefetched = { url, request, expire: new Date(new Date().getTime() + ttl) };\n }\n\n clear() {\n if (this.#prefetchTimeout) clearTimeout(this.#prefetchTimeout);\n this.#prefetched = null;\n }\n}\n\nconst cacheTtl = 10 * 1000;\nconst prefetchCache = new PrefetchCache();\n\nconst FormSubmissionState = {\n initialized: \"initialized\",\n requesting: \"requesting\",\n waiting: \"waiting\",\n receiving: \"receiving\",\n stopping: \"stopping\",\n stopped: \"stopped\"\n};\n\nclass FormSubmission {\n state = FormSubmissionState.initialized\n\n static confirmMethod(message) {\n return Promise.resolve(confirm(message))\n }\n\n constructor(delegate, formElement, submitter, mustRedirect = false) {\n const method = getMethod(formElement, submitter);\n const action = getAction(getFormAction(formElement, submitter), method);\n const body = buildFormData(formElement, submitter);\n const enctype = getEnctype(formElement, submitter);\n\n this.delegate = delegate;\n this.formElement = formElement;\n this.submitter = submitter;\n this.fetchRequest = new FetchRequest(this, method, action, body, formElement, enctype);\n this.mustRedirect = mustRedirect;\n }\n\n get method() {\n return this.fetchRequest.method\n }\n\n set method(value) {\n this.fetchRequest.method = value;\n }\n\n get action() {\n return this.fetchRequest.url.toString()\n }\n\n set action(value) {\n this.fetchRequest.url = expandURL(value);\n }\n\n get body() {\n return this.fetchRequest.body\n }\n\n get enctype() {\n return this.fetchRequest.enctype\n }\n\n get isSafe() {\n return this.fetchRequest.isSafe\n }\n\n get location() {\n return this.fetchRequest.url\n }\n\n // The submission process\n\n async start() {\n const { initialized, requesting } = FormSubmissionState;\n const confirmationMessage = getAttribute(\"data-turbo-confirm\", this.submitter, this.formElement);\n\n if (typeof confirmationMessage === \"string\") {\n const confirmMethod = typeof config.forms.confirm === \"function\" ?\n config.forms.confirm :\n FormSubmission.confirmMethod;\n\n const answer = await confirmMethod(confirmationMessage, this.formElement, this.submitter);\n if (!answer) {\n return\n }\n }\n\n if (this.state == initialized) {\n this.state = requesting;\n return this.fetchRequest.perform()\n }\n }\n\n stop() {\n const { stopping, stopped } = FormSubmissionState;\n if (this.state != stopping && this.state != stopped) {\n this.state = stopping;\n this.fetchRequest.cancel();\n return true\n }\n }\n\n // Fetch request delegate\n\n prepareRequest(request) {\n if (!request.isSafe) {\n const token = getCookieValue(getMetaContent(\"csrf-param\")) || getMetaContent(\"csrf-token\");\n if (token) {\n request.headers[\"X-CSRF-Token\"] = token;\n }\n }\n\n if (this.requestAcceptsTurboStreamResponse(request)) {\n request.acceptResponseType(StreamMessage.contentType);\n }\n }\n\n requestStarted(_request) {\n this.state = FormSubmissionState.waiting;\n if (this.submitter) config.forms.submitter.beforeSubmit(this.submitter);\n this.setSubmitsWith();\n markAsBusy(this.formElement);\n dispatch(\"turbo:submit-start\", {\n target: this.formElement,\n detail: { formSubmission: this }\n });\n this.delegate.formSubmissionStarted(this);\n }\n\n requestPreventedHandlingResponse(request, response) {\n prefetchCache.clear();\n\n this.result = { success: response.succeeded, fetchResponse: response };\n }\n\n requestSucceededWithResponse(request, response) {\n if (response.clientError || response.serverError) {\n this.delegate.formSubmissionFailedWithResponse(this, response);\n return\n }\n\n prefetchCache.clear();\n\n if (this.requestMustRedirect(request) && responseSucceededWithoutRedirect(response)) {\n const error = new Error(\"Form responses must redirect to another location\");\n this.delegate.formSubmissionErrored(this, error);\n } else {\n this.state = FormSubmissionState.receiving;\n this.result = { success: true, fetchResponse: response };\n this.delegate.formSubmissionSucceededWithResponse(this, response);\n }\n }\n\n requestFailedWithResponse(request, response) {\n this.result = { success: false, fetchResponse: response };\n this.delegate.formSubmissionFailedWithResponse(this, response);\n }\n\n requestErrored(request, error) {\n this.result = { success: false, error };\n this.delegate.formSubmissionErrored(this, error);\n }\n\n requestFinished(_request) {\n this.state = FormSubmissionState.stopped;\n if (this.submitter) config.forms.submitter.afterSubmit(this.submitter);\n this.resetSubmitterText();\n clearBusyState(this.formElement);\n dispatch(\"turbo:submit-end\", {\n target: this.formElement,\n detail: { formSubmission: this, ...this.result }\n });\n this.delegate.formSubmissionFinished(this);\n }\n\n // Private\n\n setSubmitsWith() {\n if (!this.submitter || !this.submitsWith) return\n\n if (this.submitter.matches(\"button\")) {\n this.originalSubmitText = this.submitter.innerHTML;\n this.submitter.innerHTML = this.submitsWith;\n } else if (this.submitter.matches(\"input\")) {\n const input = this.submitter;\n this.originalSubmitText = input.value;\n input.value = this.submitsWith;\n }\n }\n\n resetSubmitterText() {\n if (!this.submitter || !this.originalSubmitText) return\n\n if (this.submitter.matches(\"button\")) {\n this.submitter.innerHTML = this.originalSubmitText;\n } else if (this.submitter.matches(\"input\")) {\n const input = this.submitter;\n input.value = this.originalSubmitText;\n }\n }\n\n requestMustRedirect(request) {\n return !request.isSafe && this.mustRedirect\n }\n\n requestAcceptsTurboStreamResponse(request) {\n return !request.isSafe || hasAttribute(\"data-turbo-stream\", this.submitter, this.formElement)\n }\n\n get submitsWith() {\n return this.submitter?.getAttribute(\"data-turbo-submits-with\")\n }\n}\n\nfunction buildFormData(formElement, submitter) {\n const formData = new FormData(formElement);\n const name = submitter?.getAttribute(\"name\");\n const value = submitter?.getAttribute(\"value\");\n\n if (name) {\n formData.append(name, value || \"\");\n }\n\n return formData\n}\n\nfunction getCookieValue(cookieName) {\n if (cookieName != null) {\n const cookies = document.cookie ? document.cookie.split(\"; \") : [];\n const cookie = cookies.find((cookie) => cookie.startsWith(cookieName));\n if (cookie) {\n const value = cookie.split(\"=\").slice(1).join(\"=\");\n return value ? decodeURIComponent(value) : undefined\n }\n }\n}\n\nfunction responseSucceededWithoutRedirect(response) {\n return response.statusCode == 200 && !response.redirected\n}\n\nfunction getFormAction(formElement, submitter) {\n const formElementAction = typeof formElement.action === \"string\" ? formElement.action : null;\n\n if (submitter?.hasAttribute(\"formaction\")) {\n return submitter.getAttribute(\"formaction\") || \"\"\n } else {\n return formElement.getAttribute(\"action\") || formElementAction || \"\"\n }\n}\n\nfunction getAction(formAction, fetchMethod) {\n const action = expandURL(formAction);\n\n if (isSafe(fetchMethod)) {\n action.search = \"\";\n }\n\n return action\n}\n\nfunction getMethod(formElement, submitter) {\n const method = submitter?.getAttribute(\"formmethod\") || formElement.getAttribute(\"method\") || \"\";\n return fetchMethodFromString(method.toLowerCase()) || FetchMethod.get\n}\n\nfunction getEnctype(formElement, submitter) {\n return fetchEnctypeFromString(submitter?.getAttribute(\"formenctype\") || formElement.enctype)\n}\n\nclass Snapshot {\n constructor(element) {\n this.element = element;\n }\n\n get activeElement() {\n return this.element.ownerDocument.activeElement\n }\n\n get children() {\n return [...this.element.children]\n }\n\n hasAnchor(anchor) {\n return this.getElementForAnchor(anchor) != null\n }\n\n getElementForAnchor(anchor) {\n return anchor ? this.element.querySelector(`[id='${anchor}'], a[name='${anchor}']`) : null\n }\n\n get isConnected() {\n return this.element.isConnected\n }\n\n get firstAutofocusableElement() {\n return queryAutofocusableElement(this.element)\n }\n\n get permanentElements() {\n return queryPermanentElementsAll(this.element)\n }\n\n getPermanentElementById(id) {\n return getPermanentElementById(this.element, id)\n }\n\n getPermanentElementMapForSnapshot(snapshot) {\n const permanentElementMap = {};\n\n for (const currentPermanentElement of this.permanentElements) {\n const { id } = currentPermanentElement;\n const newPermanentElement = snapshot.getPermanentElementById(id);\n if (newPermanentElement) {\n permanentElementMap[id] = [currentPermanentElement, newPermanentElement];\n }\n }\n\n return permanentElementMap\n }\n}\n\nfunction getPermanentElementById(node, id) {\n return node.querySelector(`#${id}[data-turbo-permanent]`)\n}\n\nfunction queryPermanentElementsAll(node) {\n return node.querySelectorAll(\"[id][data-turbo-permanent]\")\n}\n\nclass FormSubmitObserver {\n started = false\n\n constructor(delegate, eventTarget) {\n this.delegate = delegate;\n this.eventTarget = eventTarget;\n }\n\n start() {\n if (!this.started) {\n this.eventTarget.addEventListener(\"submit\", this.submitCaptured, true);\n this.started = true;\n }\n }\n\n stop() {\n if (this.started) {\n this.eventTarget.removeEventListener(\"submit\", this.submitCaptured, true);\n this.started = false;\n }\n }\n\n submitCaptured = () => {\n this.eventTarget.removeEventListener(\"submit\", this.submitBubbled, false);\n this.eventTarget.addEventListener(\"submit\", this.submitBubbled, false);\n }\n\n submitBubbled = (event) => {\n if (!event.defaultPrevented) {\n const form = event.target instanceof HTMLFormElement ? event.target : undefined;\n const submitter = event.submitter || undefined;\n\n if (\n form &&\n submissionDoesNotDismissDialog(form, submitter) &&\n submissionDoesNotTargetIFrame(form, submitter) &&\n this.delegate.willSubmitForm(form, submitter)\n ) {\n event.preventDefault();\n event.stopImmediatePropagation();\n this.delegate.formSubmitted(form, submitter);\n }\n }\n }\n}\n\nfunction submissionDoesNotDismissDialog(form, submitter) {\n const method = submitter?.getAttribute(\"formmethod\") || form.getAttribute(\"method\");\n\n return method != \"dialog\"\n}\n\nfunction submissionDoesNotTargetIFrame(form, submitter) {\n const target = submitter?.getAttribute(\"formtarget\") || form.getAttribute(\"target\");\n\n return doesNotTargetIFrame(target)\n}\n\nclass View {\n #resolveRenderPromise = (_value) => {}\n #resolveInterceptionPromise = (_value) => {}\n\n constructor(delegate, element) {\n this.delegate = delegate;\n this.element = element;\n }\n\n // Scrolling\n\n scrollToAnchor(anchor) {\n const element = this.snapshot.getElementForAnchor(anchor);\n if (element) {\n this.scrollToElement(element);\n this.focusElement(element);\n } else {\n this.scrollToPosition({ x: 0, y: 0 });\n }\n }\n\n scrollToAnchorFromLocation(location) {\n this.scrollToAnchor(getAnchor(location));\n }\n\n scrollToElement(element) {\n element.scrollIntoView();\n }\n\n focusElement(element) {\n if (element instanceof HTMLElement) {\n if (element.hasAttribute(\"tabindex\")) {\n element.focus();\n } else {\n element.setAttribute(\"tabindex\", \"-1\");\n element.focus();\n element.removeAttribute(\"tabindex\");\n }\n }\n }\n\n scrollToPosition({ x, y }) {\n this.scrollRoot.scrollTo(x, y);\n }\n\n scrollToTop() {\n this.scrollToPosition({ x: 0, y: 0 });\n }\n\n get scrollRoot() {\n return window\n }\n\n // Rendering\n\n async render(renderer) {\n const { isPreview, shouldRender, willRender, newSnapshot: snapshot } = renderer;\n\n // A workaround to ignore tracked element mismatch reloads when performing\n // a promoted Visit from a frame navigation\n const shouldInvalidate = willRender;\n\n if (shouldRender) {\n try {\n this.renderPromise = new Promise((resolve) => (this.#resolveRenderPromise = resolve));\n this.renderer = renderer;\n await this.prepareToRenderSnapshot(renderer);\n\n const renderInterception = new Promise((resolve) => (this.#resolveInterceptionPromise = resolve));\n const options = { resume: this.#resolveInterceptionPromise, render: this.renderer.renderElement, renderMethod: this.renderer.renderMethod };\n const immediateRender = this.delegate.allowsImmediateRender(snapshot, options);\n if (!immediateRender) await renderInterception;\n\n await this.renderSnapshot(renderer);\n this.delegate.viewRenderedSnapshot(snapshot, isPreview, this.renderer.renderMethod);\n this.delegate.preloadOnLoadLinksForView(this.element);\n this.finishRenderingSnapshot(renderer);\n } finally {\n delete this.renderer;\n this.#resolveRenderPromise(undefined);\n delete this.renderPromise;\n }\n } else if (shouldInvalidate) {\n this.invalidate(renderer.reloadReason);\n }\n }\n\n invalidate(reason) {\n this.delegate.viewInvalidated(reason);\n }\n\n async prepareToRenderSnapshot(renderer) {\n this.markAsPreview(renderer.isPreview);\n await renderer.prepareToRender();\n }\n\n markAsPreview(isPreview) {\n if (isPreview) {\n this.element.setAttribute(\"data-turbo-preview\", \"\");\n } else {\n this.element.removeAttribute(\"data-turbo-preview\");\n }\n }\n\n markVisitDirection(direction) {\n this.element.setAttribute(\"data-turbo-visit-direction\", direction);\n }\n\n unmarkVisitDirection() {\n this.element.removeAttribute(\"data-turbo-visit-direction\");\n }\n\n async renderSnapshot(renderer) {\n await renderer.render();\n }\n\n finishRenderingSnapshot(renderer) {\n renderer.finishRendering();\n }\n}\n\nclass FrameView extends View {\n missing() {\n this.element.innerHTML = `Content missing`;\n }\n\n get snapshot() {\n return new Snapshot(this.element)\n }\n}\n\nclass LinkInterceptor {\n constructor(delegate, element) {\n this.delegate = delegate;\n this.element = element;\n }\n\n start() {\n this.element.addEventListener(\"click\", this.clickBubbled);\n document.addEventListener(\"turbo:click\", this.linkClicked);\n document.addEventListener(\"turbo:before-visit\", this.willVisit);\n }\n\n stop() {\n this.element.removeEventListener(\"click\", this.clickBubbled);\n document.removeEventListener(\"turbo:click\", this.linkClicked);\n document.removeEventListener(\"turbo:before-visit\", this.willVisit);\n }\n\n clickBubbled = (event) => {\n if (this.clickEventIsSignificant(event)) {\n this.clickEvent = event;\n } else {\n delete this.clickEvent;\n }\n }\n\n linkClicked = (event) => {\n if (this.clickEvent && this.clickEventIsSignificant(event)) {\n if (this.delegate.shouldInterceptLinkClick(event.target, event.detail.url, event.detail.originalEvent)) {\n this.clickEvent.preventDefault();\n event.preventDefault();\n this.delegate.linkClickIntercepted(event.target, event.detail.url, event.detail.originalEvent);\n }\n }\n delete this.clickEvent;\n }\n\n willVisit = (_event) => {\n delete this.clickEvent;\n }\n\n clickEventIsSignificant(event) {\n const target = event.composed ? event.target?.parentElement : event.target;\n const element = findLinkFromClickTarget(target) || target;\n\n return element instanceof Element && element.closest(\"turbo-frame, html\") == this.element\n }\n}\n\nclass LinkClickObserver {\n started = false\n\n constructor(delegate, eventTarget) {\n this.delegate = delegate;\n this.eventTarget = eventTarget;\n }\n\n start() {\n if (!this.started) {\n this.eventTarget.addEventListener(\"click\", this.clickCaptured, true);\n this.started = true;\n }\n }\n\n stop() {\n if (this.started) {\n this.eventTarget.removeEventListener(\"click\", this.clickCaptured, true);\n this.started = false;\n }\n }\n\n clickCaptured = () => {\n this.eventTarget.removeEventListener(\"click\", this.clickBubbled, false);\n this.eventTarget.addEventListener(\"click\", this.clickBubbled, false);\n }\n\n clickBubbled = (event) => {\n if (event instanceof MouseEvent && this.clickEventIsSignificant(event)) {\n const target = (event.composedPath && event.composedPath()[0]) || event.target;\n const link = findLinkFromClickTarget(target);\n if (link && doesNotTargetIFrame(link.target)) {\n const location = getLocationForLink(link);\n if (this.delegate.willFollowLinkToLocation(link, location, event)) {\n event.preventDefault();\n this.delegate.followedLinkToLocation(link, location);\n }\n }\n }\n }\n\n clickEventIsSignificant(event) {\n return !(\n (event.target && event.target.isContentEditable) ||\n event.defaultPrevented ||\n event.which > 1 ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.shiftKey\n )\n }\n}\n\nclass FormLinkClickObserver {\n constructor(delegate, element) {\n this.delegate = delegate;\n this.linkInterceptor = new LinkClickObserver(this, element);\n }\n\n start() {\n this.linkInterceptor.start();\n }\n\n stop() {\n this.linkInterceptor.stop();\n }\n\n // Link hover observer delegate\n\n canPrefetchRequestToLocation(link, location) {\n return false\n }\n\n prefetchAndCacheRequestToLocation(link, location) {\n return\n }\n\n // Link click observer delegate\n\n willFollowLinkToLocation(link, location, originalEvent) {\n return (\n this.delegate.willSubmitFormLinkToLocation(link, location, originalEvent) &&\n (link.hasAttribute(\"data-turbo-method\") || link.hasAttribute(\"data-turbo-stream\"))\n )\n }\n\n followedLinkToLocation(link, location) {\n const form = document.createElement(\"form\");\n\n const type = \"hidden\";\n for (const [name, value] of location.searchParams) {\n form.append(Object.assign(document.createElement(\"input\"), { type, name, value }));\n }\n\n const action = Object.assign(location, { search: \"\" });\n form.setAttribute(\"data-turbo\", \"true\");\n form.setAttribute(\"action\", action.href);\n form.setAttribute(\"hidden\", \"\");\n\n const method = link.getAttribute(\"data-turbo-method\");\n if (method) form.setAttribute(\"method\", method);\n\n const turboFrame = link.getAttribute(\"data-turbo-frame\");\n if (turboFrame) form.setAttribute(\"data-turbo-frame\", turboFrame);\n\n const turboAction = getVisitAction(link);\n if (turboAction) form.setAttribute(\"data-turbo-action\", turboAction);\n\n const turboConfirm = link.getAttribute(\"data-turbo-confirm\");\n if (turboConfirm) form.setAttribute(\"data-turbo-confirm\", turboConfirm);\n\n const turboStream = link.hasAttribute(\"data-turbo-stream\");\n if (turboStream) form.setAttribute(\"data-turbo-stream\", \"\");\n\n this.delegate.submittedFormLinkToLocation(link, location, form);\n\n document.body.appendChild(form);\n form.addEventListener(\"turbo:submit-end\", () => form.remove(), { once: true });\n requestAnimationFrame(() => form.requestSubmit());\n }\n}\n\nclass Bardo {\n static async preservingPermanentElements(delegate, permanentElementMap, callback) {\n const bardo = new this(delegate, permanentElementMap);\n bardo.enter();\n await callback();\n bardo.leave();\n }\n\n constructor(delegate, permanentElementMap) {\n this.delegate = delegate;\n this.permanentElementMap = permanentElementMap;\n }\n\n enter() {\n for (const id in this.permanentElementMap) {\n const [currentPermanentElement, newPermanentElement] = this.permanentElementMap[id];\n this.delegate.enteringBardo(currentPermanentElement, newPermanentElement);\n this.replaceNewPermanentElementWithPlaceholder(newPermanentElement);\n }\n }\n\n leave() {\n for (const id in this.permanentElementMap) {\n const [currentPermanentElement] = this.permanentElementMap[id];\n this.replaceCurrentPermanentElementWithClone(currentPermanentElement);\n this.replacePlaceholderWithPermanentElement(currentPermanentElement);\n this.delegate.leavingBardo(currentPermanentElement);\n }\n }\n\n replaceNewPermanentElementWithPlaceholder(permanentElement) {\n const placeholder = createPlaceholderForPermanentElement(permanentElement);\n permanentElement.replaceWith(placeholder);\n }\n\n replaceCurrentPermanentElementWithClone(permanentElement) {\n const clone = permanentElement.cloneNode(true);\n permanentElement.replaceWith(clone);\n }\n\n replacePlaceholderWithPermanentElement(permanentElement) {\n const placeholder = this.getPlaceholderById(permanentElement.id);\n placeholder?.replaceWith(permanentElement);\n }\n\n getPlaceholderById(id) {\n return this.placeholders.find((element) => element.content == id)\n }\n\n get placeholders() {\n return [...document.querySelectorAll(\"meta[name=turbo-permanent-placeholder][content]\")]\n }\n}\n\nfunction createPlaceholderForPermanentElement(permanentElement) {\n const element = document.createElement(\"meta\");\n element.setAttribute(\"name\", \"turbo-permanent-placeholder\");\n element.setAttribute(\"content\", permanentElement.id);\n return element\n}\n\nclass Renderer {\n #activeElement = null\n\n static renderElement(currentElement, newElement) {\n // Abstract method\n }\n\n constructor(currentSnapshot, newSnapshot, isPreview, willRender = true) {\n this.currentSnapshot = currentSnapshot;\n this.newSnapshot = newSnapshot;\n this.isPreview = isPreview;\n this.willRender = willRender;\n this.renderElement = this.constructor.renderElement;\n this.promise = new Promise((resolve, reject) => (this.resolvingFunctions = { resolve, reject }));\n }\n\n get shouldRender() {\n return true\n }\n\n get shouldAutofocus() {\n return true\n }\n\n get reloadReason() {\n return\n }\n\n prepareToRender() {\n return\n }\n\n render() {\n // Abstract method\n }\n\n finishRendering() {\n if (this.resolvingFunctions) {\n this.resolvingFunctions.resolve();\n delete this.resolvingFunctions;\n }\n }\n\n async preservingPermanentElements(callback) {\n await Bardo.preservingPermanentElements(this, this.permanentElementMap, callback);\n }\n\n focusFirstAutofocusableElement() {\n if (this.shouldAutofocus) {\n const element = this.connectedSnapshot.firstAutofocusableElement;\n if (element) {\n element.focus();\n }\n }\n }\n\n // Bardo delegate\n\n enteringBardo(currentPermanentElement) {\n if (this.#activeElement) return\n\n if (currentPermanentElement.contains(this.currentSnapshot.activeElement)) {\n this.#activeElement = this.currentSnapshot.activeElement;\n }\n }\n\n leavingBardo(currentPermanentElement) {\n if (currentPermanentElement.contains(this.#activeElement) && this.#activeElement instanceof HTMLElement) {\n this.#activeElement.focus();\n\n this.#activeElement = null;\n }\n }\n\n get connectedSnapshot() {\n return this.newSnapshot.isConnected ? this.newSnapshot : this.currentSnapshot\n }\n\n get currentElement() {\n return this.currentSnapshot.element\n }\n\n get newElement() {\n return this.newSnapshot.element\n }\n\n get permanentElementMap() {\n return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)\n }\n\n get renderMethod() {\n return \"replace\"\n }\n}\n\nclass FrameRenderer extends Renderer {\n static renderElement(currentElement, newElement) {\n const destinationRange = document.createRange();\n destinationRange.selectNodeContents(currentElement);\n destinationRange.deleteContents();\n\n const frameElement = newElement;\n const sourceRange = frameElement.ownerDocument?.createRange();\n if (sourceRange) {\n sourceRange.selectNodeContents(frameElement);\n currentElement.appendChild(sourceRange.extractContents());\n }\n }\n\n constructor(delegate, currentSnapshot, newSnapshot, renderElement, isPreview, willRender = true) {\n super(currentSnapshot, newSnapshot, renderElement, isPreview, willRender);\n this.delegate = delegate;\n }\n\n get shouldRender() {\n return true\n }\n\n async render() {\n await nextRepaint();\n this.preservingPermanentElements(() => {\n this.loadFrameElement();\n });\n this.scrollFrameIntoView();\n await nextRepaint();\n this.focusFirstAutofocusableElement();\n await nextRepaint();\n this.activateScriptElements();\n }\n\n loadFrameElement() {\n this.delegate.willRenderFrame(this.currentElement, this.newElement);\n this.renderElement(this.currentElement, this.newElement);\n }\n\n scrollFrameIntoView() {\n if (this.currentElement.autoscroll || this.newElement.autoscroll) {\n const element = this.currentElement.firstElementChild;\n const block = readScrollLogicalPosition(this.currentElement.getAttribute(\"data-autoscroll-block\"), \"end\");\n const behavior = readScrollBehavior(this.currentElement.getAttribute(\"data-autoscroll-behavior\"), \"auto\");\n\n if (element) {\n element.scrollIntoView({ block, behavior });\n return true\n }\n }\n return false\n }\n\n activateScriptElements() {\n for (const inertScriptElement of this.newScriptElements) {\n const activatedScriptElement = activateScriptElement(inertScriptElement);\n inertScriptElement.replaceWith(activatedScriptElement);\n }\n }\n\n get newScriptElements() {\n return this.currentElement.querySelectorAll(\"script\")\n }\n}\n\nfunction readScrollLogicalPosition(value, defaultValue) {\n if (value == \"end\" || value == \"start\" || value == \"center\" || value == \"nearest\") {\n return value\n } else {\n return defaultValue\n }\n}\n\nfunction readScrollBehavior(value, defaultValue) {\n if (value == \"auto\" || value == \"smooth\") {\n return value\n } else {\n return defaultValue\n }\n}\n\n/**\n * @typedef {object} ConfigHead\n *\n * @property {'merge' | 'append' | 'morph' | 'none'} [style]\n * @property {boolean} [block]\n * @property {boolean} [ignore]\n * @property {function(Element): boolean} [shouldPreserve]\n * @property {function(Element): boolean} [shouldReAppend]\n * @property {function(Element): boolean} [shouldRemove]\n * @property {function(Element, {added: Node[], kept: Element[], removed: Element[]}): void} [afterHeadMorphed]\n */\n\n/**\n * @typedef {object} ConfigCallbacks\n *\n * @property {function(Node): boolean} [beforeNodeAdded]\n * @property {function(Node): void} [afterNodeAdded]\n * @property {function(Element, Node): boolean} [beforeNodeMorphed]\n * @property {function(Element, Node): void} [afterNodeMorphed]\n * @property {function(Element): boolean} [beforeNodeRemoved]\n * @property {function(Element): void} [afterNodeRemoved]\n * @property {function(string, Element, \"update\" | \"remove\"): boolean} [beforeAttributeUpdated]\n */\n\n/**\n * @typedef {object} Config\n *\n * @property {'outerHTML' | 'innerHTML'} [morphStyle]\n * @property {boolean} [ignoreActive]\n * @property {boolean} [ignoreActiveValue]\n * @property {boolean} [restoreFocus]\n * @property {ConfigCallbacks} [callbacks]\n * @property {ConfigHead} [head]\n */\n\n/**\n * @typedef {function} NoOp\n *\n * @returns {void}\n */\n\n/**\n * @typedef {object} ConfigHeadInternal\n *\n * @property {'merge' | 'append' | 'morph' | 'none'} style\n * @property {boolean} [block]\n * @property {boolean} [ignore]\n * @property {(function(Element): boolean) | NoOp} shouldPreserve\n * @property {(function(Element): boolean) | NoOp} shouldReAppend\n * @property {(function(Element): boolean) | NoOp} shouldRemove\n * @property {(function(Element, {added: Node[], kept: Element[], removed: Element[]}): void) | NoOp} afterHeadMorphed\n */\n\n/**\n * @typedef {object} ConfigCallbacksInternal\n *\n * @property {(function(Node): boolean) | NoOp} beforeNodeAdded\n * @property {(function(Node): void) | NoOp} afterNodeAdded\n * @property {(function(Node, Node): boolean) | NoOp} beforeNodeMorphed\n * @property {(function(Node, Node): void) | NoOp} afterNodeMorphed\n * @property {(function(Node): boolean) | NoOp} beforeNodeRemoved\n * @property {(function(Node): void) | NoOp} afterNodeRemoved\n * @property {(function(string, Element, \"update\" | \"remove\"): boolean) | NoOp} beforeAttributeUpdated\n */\n\n/**\n * @typedef {object} ConfigInternal\n *\n * @property {'outerHTML' | 'innerHTML'} morphStyle\n * @property {boolean} [ignoreActive]\n * @property {boolean} [ignoreActiveValue]\n * @property {boolean} [restoreFocus]\n * @property {ConfigCallbacksInternal} callbacks\n * @property {ConfigHeadInternal} head\n */\n\n/**\n * @typedef {Object} IdSets\n * @property {Set} persistentIds\n * @property {Map>} idMap\n */\n\n/**\n * @typedef {Function} Morph\n *\n * @param {Element | Document} oldNode\n * @param {Element | Node | HTMLCollection | Node[] | string | null} newContent\n * @param {Config} [config]\n * @returns {undefined | Node[]}\n */\n\n// base IIFE to define idiomorph\n/**\n *\n * @type {{defaults: ConfigInternal, morph: Morph}}\n */\nvar Idiomorph = (function () {\n\n /**\n * @typedef {object} MorphContext\n *\n * @property {Element} target\n * @property {Element} newContent\n * @property {ConfigInternal} config\n * @property {ConfigInternal['morphStyle']} morphStyle\n * @property {ConfigInternal['ignoreActive']} ignoreActive\n * @property {ConfigInternal['ignoreActiveValue']} ignoreActiveValue\n * @property {ConfigInternal['restoreFocus']} restoreFocus\n * @property {Map>} idMap\n * @property {Set} persistentIds\n * @property {ConfigInternal['callbacks']} callbacks\n * @property {ConfigInternal['head']} head\n * @property {HTMLDivElement} pantry\n */\n\n //=============================================================================\n // AND NOW IT BEGINS...\n //=============================================================================\n\n const noOp = () => {};\n /**\n * Default configuration values, updatable by users now\n * @type {ConfigInternal}\n */\n const defaults = {\n morphStyle: \"outerHTML\",\n callbacks: {\n beforeNodeAdded: noOp,\n afterNodeAdded: noOp,\n beforeNodeMorphed: noOp,\n afterNodeMorphed: noOp,\n beforeNodeRemoved: noOp,\n afterNodeRemoved: noOp,\n beforeAttributeUpdated: noOp,\n },\n head: {\n style: \"merge\",\n shouldPreserve: (elt) => elt.getAttribute(\"im-preserve\") === \"true\",\n shouldReAppend: (elt) => elt.getAttribute(\"im-re-append\") === \"true\",\n shouldRemove: noOp,\n afterHeadMorphed: noOp,\n },\n restoreFocus: true,\n };\n\n /**\n * Core idiomorph function for morphing one DOM tree to another\n *\n * @param {Element | Document} oldNode\n * @param {Element | Node | HTMLCollection | Node[] | string | null} newContent\n * @param {Config} [config]\n * @returns {Promise | Node[]}\n */\n function morph(oldNode, newContent, config = {}) {\n oldNode = normalizeElement(oldNode);\n const newNode = normalizeParent(newContent);\n const ctx = createMorphContext(oldNode, newNode, config);\n\n const morphedNodes = saveAndRestoreFocus(ctx, () => {\n return withHeadBlocking(\n ctx,\n oldNode,\n newNode,\n /** @param {MorphContext} ctx */ (ctx) => {\n if (ctx.morphStyle === \"innerHTML\") {\n morphChildren(ctx, oldNode, newNode);\n return Array.from(oldNode.childNodes);\n } else {\n return morphOuterHTML(ctx, oldNode, newNode);\n }\n },\n );\n });\n\n ctx.pantry.remove();\n return morphedNodes;\n }\n\n /**\n * Morph just the outerHTML of the oldNode to the newContent\n * We have to be careful because the oldNode could have siblings which need to be untouched\n * @param {MorphContext} ctx\n * @param {Element} oldNode\n * @param {Element} newNode\n * @returns {Node[]}\n */\n function morphOuterHTML(ctx, oldNode, newNode) {\n const oldParent = normalizeParent(oldNode);\n\n // basis for calulating which nodes were morphed\n // since there may be unmorphed sibling nodes\n let childNodes = Array.from(oldParent.childNodes);\n const index = childNodes.indexOf(oldNode);\n // how many elements are to the right of the oldNode\n const rightMargin = childNodes.length - (index + 1);\n\n morphChildren(\n ctx,\n oldParent,\n newNode,\n // these two optional params are the secret sauce\n oldNode, // start point for iteration\n oldNode.nextSibling, // end point for iteration\n );\n\n // return just the morphed nodes\n childNodes = Array.from(oldParent.childNodes);\n return childNodes.slice(index, childNodes.length - rightMargin);\n }\n\n /**\n * @param {MorphContext} ctx\n * @param {Function} fn\n * @returns {Promise | Node[]}\n */\n function saveAndRestoreFocus(ctx, fn) {\n if (!ctx.config.restoreFocus) return fn();\n let activeElement =\n /** @type {HTMLInputElement|HTMLTextAreaElement|null} */ (\n document.activeElement\n );\n\n // don't bother if the active element is not an input or textarea\n if (\n !(\n activeElement instanceof HTMLInputElement ||\n activeElement instanceof HTMLTextAreaElement\n )\n ) {\n return fn();\n }\n\n const { id: activeElementId, selectionStart, selectionEnd } = activeElement;\n\n const results = fn();\n\n if (activeElementId && activeElementId !== document.activeElement?.id) {\n activeElement = ctx.target.querySelector(`#${activeElementId}`);\n activeElement?.focus();\n }\n if (activeElement && !activeElement.selectionEnd && selectionEnd) {\n activeElement.setSelectionRange(selectionStart, selectionEnd);\n }\n\n return results;\n }\n\n const morphChildren = (function () {\n /**\n * This is the core algorithm for matching up children. The idea is to use id sets to try to match up\n * nodes as faithfully as possible. We greedily match, which allows us to keep the algorithm fast, but\n * by using id sets, we are able to better match up with content deeper in the DOM.\n *\n * Basic algorithm:\n * - for each node in the new content:\n * - search self and siblings for an id set match, falling back to a soft match\n * - if match found\n * - remove any nodes up to the match:\n * - pantry persistent nodes\n * - delete the rest\n * - morph the match\n * - elsif no match found, and node is persistent\n * - find its match by querying the old root (future) and pantry (past)\n * - move it and its children here\n * - morph it\n * - else\n * - create a new node from scratch as a last result\n *\n * @param {MorphContext} ctx the merge context\n * @param {Element} oldParent the old content that we are merging the new content into\n * @param {Element} newParent the parent element of the new content\n * @param {Node|null} [insertionPoint] the point in the DOM we start morphing at (defaults to first child)\n * @param {Node|null} [endPoint] the point in the DOM we stop morphing at (defaults to after last child)\n */\n function morphChildren(\n ctx,\n oldParent,\n newParent,\n insertionPoint = null,\n endPoint = null,\n ) {\n // normalize\n if (\n oldParent instanceof HTMLTemplateElement &&\n newParent instanceof HTMLTemplateElement\n ) {\n // @ts-ignore we can pretend the DocumentFragment is an Element\n oldParent = oldParent.content;\n // @ts-ignore ditto\n newParent = newParent.content;\n }\n insertionPoint ||= oldParent.firstChild;\n\n // run through all the new content\n for (const newChild of newParent.childNodes) {\n // once we reach the end of the old parent content skip to the end and insert the rest\n if (insertionPoint && insertionPoint != endPoint) {\n const bestMatch = findBestMatch(\n ctx,\n newChild,\n insertionPoint,\n endPoint,\n );\n if (bestMatch) {\n // if the node to morph is not at the insertion point then remove/move up to it\n if (bestMatch !== insertionPoint) {\n removeNodesBetween(ctx, insertionPoint, bestMatch);\n }\n morphNode(bestMatch, newChild, ctx);\n insertionPoint = bestMatch.nextSibling;\n continue;\n }\n }\n\n // if the matching node is elsewhere in the original content\n if (newChild instanceof Element && ctx.persistentIds.has(newChild.id)) {\n // move it and all its children here and morph\n const movedChild = moveBeforeById(\n oldParent,\n newChild.id,\n insertionPoint,\n ctx,\n );\n morphNode(movedChild, newChild, ctx);\n insertionPoint = movedChild.nextSibling;\n continue;\n }\n\n // last resort: insert the new node from scratch\n const insertedNode = createNode(\n oldParent,\n newChild,\n insertionPoint,\n ctx,\n );\n // could be null if beforeNodeAdded prevented insertion\n if (insertedNode) {\n insertionPoint = insertedNode.nextSibling;\n }\n }\n\n // remove any remaining old nodes that didn't match up with new content\n while (insertionPoint && insertionPoint != endPoint) {\n const tempNode = insertionPoint;\n insertionPoint = insertionPoint.nextSibling;\n removeNode(ctx, tempNode);\n }\n }\n\n /**\n * This performs the action of inserting a new node while handling situations where the node contains\n * elements with persistent ids and possible state info we can still preserve by moving in and then morphing\n *\n * @param {Element} oldParent\n * @param {Node} newChild\n * @param {Node|null} insertionPoint\n * @param {MorphContext} ctx\n * @returns {Node|null}\n */\n function createNode(oldParent, newChild, insertionPoint, ctx) {\n if (ctx.callbacks.beforeNodeAdded(newChild) === false) return null;\n if (ctx.idMap.has(newChild)) {\n // node has children with ids with possible state so create a dummy elt of same type and apply full morph algorithm\n const newEmptyChild = document.createElement(\n /** @type {Element} */ (newChild).tagName,\n );\n oldParent.insertBefore(newEmptyChild, insertionPoint);\n morphNode(newEmptyChild, newChild, ctx);\n ctx.callbacks.afterNodeAdded(newEmptyChild);\n return newEmptyChild;\n } else {\n // optimisation: no id state to preserve so we can just insert a clone of the newChild and its descendants\n const newClonedChild = document.importNode(newChild, true); // importNode to not mutate newParent\n oldParent.insertBefore(newClonedChild, insertionPoint);\n ctx.callbacks.afterNodeAdded(newClonedChild);\n return newClonedChild;\n }\n }\n\n //=============================================================================\n // Matching Functions\n //=============================================================================\n const findBestMatch = (function () {\n /**\n * Scans forward from the startPoint to the endPoint looking for a match\n * for the node. It looks for an id set match first, then a soft match.\n * We abort softmatching if we find two future soft matches, to reduce churn.\n * @param {Node} node\n * @param {MorphContext} ctx\n * @param {Node | null} startPoint\n * @param {Node | null} endPoint\n * @returns {Node | null}\n */\n function findBestMatch(ctx, node, startPoint, endPoint) {\n let softMatch = null;\n let nextSibling = node.nextSibling;\n let siblingSoftMatchCount = 0;\n\n let cursor = startPoint;\n while (cursor && cursor != endPoint) {\n // soft matching is a prerequisite for id set matching\n if (isSoftMatch(cursor, node)) {\n if (isIdSetMatch(ctx, cursor, node)) {\n return cursor; // found an id set match, we're done!\n }\n\n // we haven't yet saved a soft match fallback\n if (softMatch === null) {\n // the current soft match will hard match something else in the future, leave it\n if (!ctx.idMap.has(cursor)) {\n // save this as the fallback if we get through the loop without finding a hard match\n softMatch = cursor;\n }\n }\n }\n if (\n softMatch === null &&\n nextSibling &&\n isSoftMatch(cursor, nextSibling)\n ) {\n // The next new node has a soft match with this node, so\n // increment the count of future soft matches\n siblingSoftMatchCount++;\n nextSibling = nextSibling.nextSibling;\n\n // If there are two future soft matches, block soft matching for this node to allow\n // future siblings to soft match. This is to reduce churn in the DOM when an element\n // is prepended.\n if (siblingSoftMatchCount >= 2) {\n softMatch = undefined;\n }\n }\n\n // if the current node contains active element, stop looking for better future matches,\n // because if one is found, this node will be moved to the pantry, reparenting it and thus losing focus\n if (cursor.contains(document.activeElement)) break;\n\n cursor = cursor.nextSibling;\n }\n\n return softMatch || null;\n }\n\n /**\n *\n * @param {MorphContext} ctx\n * @param {Node} oldNode\n * @param {Node} newNode\n * @returns {boolean}\n */\n function isIdSetMatch(ctx, oldNode, newNode) {\n let oldSet = ctx.idMap.get(oldNode);\n let newSet = ctx.idMap.get(newNode);\n\n if (!newSet || !oldSet) return false;\n\n for (const id of oldSet) {\n // a potential match is an id in the new and old nodes that\n // has not already been merged into the DOM\n // But the newNode content we call this on has not been\n // merged yet and we don't allow duplicate IDs so it is simple\n if (newSet.has(id)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n *\n * @param {Node} oldNode\n * @param {Node} newNode\n * @returns {boolean}\n */\n function isSoftMatch(oldNode, newNode) {\n // ok to cast: if one is not element, `id` and `tagName` will be undefined and we'll just compare that.\n const oldElt = /** @type {Element} */ (oldNode);\n const newElt = /** @type {Element} */ (newNode);\n\n return (\n oldElt.nodeType === newElt.nodeType &&\n oldElt.tagName === newElt.tagName &&\n // If oldElt has an `id` with possible state and it doesn't match newElt.id then avoid morphing.\n // We'll still match an anonymous node with an IDed newElt, though, because if it got this far,\n // its not persistent, and new nodes can't have any hidden state.\n (!oldElt.id || oldElt.id === newElt.id)\n );\n }\n\n return findBestMatch;\n })();\n\n //=============================================================================\n // DOM Manipulation Functions\n //=============================================================================\n\n /**\n * Gets rid of an unwanted DOM node; strategy depends on nature of its reuse:\n * - Persistent nodes will be moved to the pantry for later reuse\n * - Other nodes will have their hooks called, and then are removed\n * @param {MorphContext} ctx\n * @param {Node} node\n */\n function removeNode(ctx, node) {\n // are we going to id set match this later?\n if (ctx.idMap.has(node)) {\n // skip callbacks and move to pantry\n moveBefore(ctx.pantry, node, null);\n } else {\n // remove for realsies\n if (ctx.callbacks.beforeNodeRemoved(node) === false) return;\n node.parentNode?.removeChild(node);\n ctx.callbacks.afterNodeRemoved(node);\n }\n }\n\n /**\n * Remove nodes between the start and end nodes\n * @param {MorphContext} ctx\n * @param {Node} startInclusive\n * @param {Node} endExclusive\n * @returns {Node|null}\n */\n function removeNodesBetween(ctx, startInclusive, endExclusive) {\n /** @type {Node | null} */\n let cursor = startInclusive;\n // remove nodes until the endExclusive node\n while (cursor && cursor !== endExclusive) {\n let tempNode = /** @type {Node} */ (cursor);\n cursor = cursor.nextSibling;\n removeNode(ctx, tempNode);\n }\n return cursor;\n }\n\n /**\n * Search for an element by id within the document and pantry, and move it using moveBefore.\n *\n * @param {Element} parentNode - The parent node to which the element will be moved.\n * @param {string} id - The ID of the element to be moved.\n * @param {Node | null} after - The reference node to insert the element before.\n * If `null`, the element is appended as the last child.\n * @param {MorphContext} ctx\n * @returns {Element} The found element\n */\n function moveBeforeById(parentNode, id, after, ctx) {\n const target =\n /** @type {Element} - will always be found */\n (\n ctx.target.querySelector(`#${id}`) ||\n ctx.pantry.querySelector(`#${id}`)\n );\n removeElementFromAncestorsIdMaps(target, ctx);\n moveBefore(parentNode, target, after);\n return target;\n }\n\n /**\n * Removes an element from its ancestors' id maps. This is needed when an element is moved from the\n * \"future\" via `moveBeforeId`. Otherwise, its erstwhile ancestors could be mistakenly moved to the\n * pantry rather than being deleted, preventing their removal hooks from being called.\n *\n * @param {Element} element - element to remove from its ancestors' id maps\n * @param {MorphContext} ctx\n */\n function removeElementFromAncestorsIdMaps(element, ctx) {\n const id = element.id;\n /** @ts-ignore - safe to loop in this way **/\n while ((element = element.parentNode)) {\n let idSet = ctx.idMap.get(element);\n if (idSet) {\n idSet.delete(id);\n if (!idSet.size) {\n ctx.idMap.delete(element);\n }\n }\n }\n }\n\n /**\n * Moves an element before another element within the same parent.\n * Uses the proposed `moveBefore` API if available (and working), otherwise falls back to `insertBefore`.\n * This is essentialy a forward-compat wrapper.\n *\n * @param {Element} parentNode - The parent node containing the after element.\n * @param {Node} element - The element to be moved.\n * @param {Node | null} after - The reference node to insert `element` before.\n * If `null`, `element` is appended as the last child.\n */\n function moveBefore(parentNode, element, after) {\n // @ts-ignore - use proposed moveBefore feature\n if (parentNode.moveBefore) {\n try {\n // @ts-ignore - use proposed moveBefore feature\n parentNode.moveBefore(element, after);\n } catch (e) {\n // fall back to insertBefore as some browsers may fail on moveBefore when trying to move Dom disconnected nodes to pantry\n parentNode.insertBefore(element, after);\n }\n } else {\n parentNode.insertBefore(element, after);\n }\n }\n\n return morphChildren;\n })();\n\n //=============================================================================\n // Single Node Morphing Code\n //=============================================================================\n const morphNode = (function () {\n /**\n * @param {Node} oldNode root node to merge content into\n * @param {Node} newContent new content to merge\n * @param {MorphContext} ctx the merge context\n * @returns {Node | null} the element that ended up in the DOM\n */\n function morphNode(oldNode, newContent, ctx) {\n if (ctx.ignoreActive && oldNode === document.activeElement) {\n // don't morph focused element\n return null;\n }\n\n if (ctx.callbacks.beforeNodeMorphed(oldNode, newContent) === false) {\n return oldNode;\n }\n\n if (oldNode instanceof HTMLHeadElement && ctx.head.ignore) ; else if (\n oldNode instanceof HTMLHeadElement &&\n ctx.head.style !== \"morph\"\n ) {\n // ok to cast: if newContent wasn't also a , it would've got caught in the `!isSoftMatch` branch above\n handleHeadElement(\n oldNode,\n /** @type {HTMLHeadElement} */ (newContent),\n ctx,\n );\n } else {\n morphAttributes(oldNode, newContent, ctx);\n if (!ignoreValueOfActiveElement(oldNode, ctx)) {\n // @ts-ignore newContent can be a node here because .firstChild will be null\n morphChildren(ctx, oldNode, newContent);\n }\n }\n ctx.callbacks.afterNodeMorphed(oldNode, newContent);\n return oldNode;\n }\n\n /**\n * syncs the oldNode to the newNode, copying over all attributes and\n * inner element state from the newNode to the oldNode\n *\n * @param {Node} oldNode the node to copy attributes & state to\n * @param {Node} newNode the node to copy attributes & state from\n * @param {MorphContext} ctx the merge context\n */\n function morphAttributes(oldNode, newNode, ctx) {\n let type = newNode.nodeType;\n\n // if is an element type, sync the attributes from the\n // new node into the new node\n if (type === 1 /* element type */) {\n const oldElt = /** @type {Element} */ (oldNode);\n const newElt = /** @type {Element} */ (newNode);\n\n const oldAttributes = oldElt.attributes;\n const newAttributes = newElt.attributes;\n for (const newAttribute of newAttributes) {\n if (ignoreAttribute(newAttribute.name, oldElt, \"update\", ctx)) {\n continue;\n }\n if (oldElt.getAttribute(newAttribute.name) !== newAttribute.value) {\n oldElt.setAttribute(newAttribute.name, newAttribute.value);\n }\n }\n // iterate backwards to avoid skipping over items when a delete occurs\n for (let i = oldAttributes.length - 1; 0 <= i; i--) {\n const oldAttribute = oldAttributes[i];\n\n // toAttributes is a live NamedNodeMap, so iteration+mutation is unsafe\n // e.g. custom element attribute callbacks can remove other attributes\n if (!oldAttribute) continue;\n\n if (!newElt.hasAttribute(oldAttribute.name)) {\n if (ignoreAttribute(oldAttribute.name, oldElt, \"remove\", ctx)) {\n continue;\n }\n oldElt.removeAttribute(oldAttribute.name);\n }\n }\n\n if (!ignoreValueOfActiveElement(oldElt, ctx)) {\n syncInputValue(oldElt, newElt, ctx);\n }\n }\n\n // sync text nodes\n if (type === 8 /* comment */ || type === 3 /* text */) {\n if (oldNode.nodeValue !== newNode.nodeValue) {\n oldNode.nodeValue = newNode.nodeValue;\n }\n }\n }\n\n /**\n * NB: many bothans died to bring us information:\n *\n * https://github.com/patrick-steele-idem/morphdom/blob/master/src/specialElHandlers.js\n * https://github.com/choojs/nanomorph/blob/master/lib/morph.jsL113\n *\n * @param {Element} oldElement the element to sync the input value to\n * @param {Element} newElement the element to sync the input value from\n * @param {MorphContext} ctx the merge context\n */\n function syncInputValue(oldElement, newElement, ctx) {\n if (\n oldElement instanceof HTMLInputElement &&\n newElement instanceof HTMLInputElement &&\n newElement.type !== \"file\"\n ) {\n let newValue = newElement.value;\n let oldValue = oldElement.value;\n\n // sync boolean attributes\n syncBooleanAttribute(oldElement, newElement, \"checked\", ctx);\n syncBooleanAttribute(oldElement, newElement, \"disabled\", ctx);\n\n if (!newElement.hasAttribute(\"value\")) {\n if (!ignoreAttribute(\"value\", oldElement, \"remove\", ctx)) {\n oldElement.value = \"\";\n oldElement.removeAttribute(\"value\");\n }\n } else if (oldValue !== newValue) {\n if (!ignoreAttribute(\"value\", oldElement, \"update\", ctx)) {\n oldElement.setAttribute(\"value\", newValue);\n oldElement.value = newValue;\n }\n }\n // TODO: QUESTION(1cg): this used to only check `newElement` unlike the other branches -- why?\n // did I break something?\n } else if (\n oldElement instanceof HTMLOptionElement &&\n newElement instanceof HTMLOptionElement\n ) {\n syncBooleanAttribute(oldElement, newElement, \"selected\", ctx);\n } else if (\n oldElement instanceof HTMLTextAreaElement &&\n newElement instanceof HTMLTextAreaElement\n ) {\n let newValue = newElement.value;\n let oldValue = oldElement.value;\n if (ignoreAttribute(\"value\", oldElement, \"update\", ctx)) {\n return;\n }\n if (newValue !== oldValue) {\n oldElement.value = newValue;\n }\n if (\n oldElement.firstChild &&\n oldElement.firstChild.nodeValue !== newValue\n ) {\n oldElement.firstChild.nodeValue = newValue;\n }\n }\n }\n\n /**\n * @param {Element} oldElement element to write the value to\n * @param {Element} newElement element to read the value from\n * @param {string} attributeName the attribute name\n * @param {MorphContext} ctx the merge context\n */\n function syncBooleanAttribute(oldElement, newElement, attributeName, ctx) {\n // @ts-ignore this function is only used on boolean attrs that are reflected as dom properties\n const newLiveValue = newElement[attributeName],\n // @ts-ignore ditto\n oldLiveValue = oldElement[attributeName];\n if (newLiveValue !== oldLiveValue) {\n const ignoreUpdate = ignoreAttribute(\n attributeName,\n oldElement,\n \"update\",\n ctx,\n );\n if (!ignoreUpdate) {\n // update attribute's associated DOM property\n // @ts-ignore this function is only used on boolean attrs that are reflected as dom properties\n oldElement[attributeName] = newElement[attributeName];\n }\n if (newLiveValue) {\n if (!ignoreUpdate) {\n // https://developer.mozilla.org/en-US/docs/Glossary/Boolean/HTML\n // this is the correct way to set a boolean attribute to \"true\"\n oldElement.setAttribute(attributeName, \"\");\n }\n } else {\n if (!ignoreAttribute(attributeName, oldElement, \"remove\", ctx)) {\n oldElement.removeAttribute(attributeName);\n }\n }\n }\n }\n\n /**\n * @param {string} attr the attribute to be mutated\n * @param {Element} element the element that is going to be updated\n * @param {\"update\" | \"remove\"} updateType\n * @param {MorphContext} ctx the merge context\n * @returns {boolean} true if the attribute should be ignored, false otherwise\n */\n function ignoreAttribute(attr, element, updateType, ctx) {\n if (\n attr === \"value\" &&\n ctx.ignoreActiveValue &&\n element === document.activeElement\n ) {\n return true;\n }\n return (\n ctx.callbacks.beforeAttributeUpdated(attr, element, updateType) ===\n false\n );\n }\n\n /**\n * @param {Node} possibleActiveElement\n * @param {MorphContext} ctx\n * @returns {boolean}\n */\n function ignoreValueOfActiveElement(possibleActiveElement, ctx) {\n return (\n !!ctx.ignoreActiveValue &&\n possibleActiveElement === document.activeElement &&\n possibleActiveElement !== document.body\n );\n }\n\n return morphNode;\n })();\n\n //=============================================================================\n // Head Management Functions\n //=============================================================================\n /**\n * @param {MorphContext} ctx\n * @param {Element} oldNode\n * @param {Element} newNode\n * @param {function} callback\n * @returns {Node[] | Promise}\n */\n function withHeadBlocking(ctx, oldNode, newNode, callback) {\n if (ctx.head.block) {\n const oldHead = oldNode.querySelector(\"head\");\n const newHead = newNode.querySelector(\"head\");\n if (oldHead && newHead) {\n const promises = handleHeadElement(oldHead, newHead, ctx);\n // when head promises resolve, proceed ignoring the head tag\n return Promise.all(promises).then(() => {\n const newCtx = Object.assign(ctx, {\n head: {\n block: false,\n ignore: true,\n },\n });\n return callback(newCtx);\n });\n }\n }\n // just proceed if we not head blocking\n return callback(ctx);\n }\n\n /**\n * The HEAD tag can be handled specially, either w/ a 'merge' or 'append' style\n *\n * @param {Element} oldHead\n * @param {Element} newHead\n * @param {MorphContext} ctx\n * @returns {Promise[]}\n */\n function handleHeadElement(oldHead, newHead, ctx) {\n let added = [];\n let removed = [];\n let preserved = [];\n let nodesToAppend = [];\n\n // put all new head elements into a Map, by their outerHTML\n let srcToNewHeadNodes = new Map();\n for (const newHeadChild of newHead.children) {\n srcToNewHeadNodes.set(newHeadChild.outerHTML, newHeadChild);\n }\n\n // for each elt in the current head\n for (const currentHeadElt of oldHead.children) {\n // If the current head element is in the map\n let inNewContent = srcToNewHeadNodes.has(currentHeadElt.outerHTML);\n let isReAppended = ctx.head.shouldReAppend(currentHeadElt);\n let isPreserved = ctx.head.shouldPreserve(currentHeadElt);\n if (inNewContent || isPreserved) {\n if (isReAppended) {\n // remove the current version and let the new version replace it and re-execute\n removed.push(currentHeadElt);\n } else {\n // this element already exists and should not be re-appended, so remove it from\n // the new content map, preserving it in the DOM\n srcToNewHeadNodes.delete(currentHeadElt.outerHTML);\n preserved.push(currentHeadElt);\n }\n } else {\n if (ctx.head.style === \"append\") {\n // we are appending and this existing element is not new content\n // so if and only if it is marked for re-append do we do anything\n if (isReAppended) {\n removed.push(currentHeadElt);\n nodesToAppend.push(currentHeadElt);\n }\n } else {\n // if this is a merge, we remove this content since it is not in the new head\n if (ctx.head.shouldRemove(currentHeadElt) !== false) {\n removed.push(currentHeadElt);\n }\n }\n }\n }\n\n // Push the remaining new head elements in the Map into the\n // nodes to append to the head tag\n nodesToAppend.push(...srcToNewHeadNodes.values());\n\n let promises = [];\n for (const newNode of nodesToAppend) {\n // TODO: This could theoretically be null, based on type\n let newElt = /** @type {ChildNode} */ (\n document.createRange().createContextualFragment(newNode.outerHTML)\n .firstChild\n );\n if (ctx.callbacks.beforeNodeAdded(newElt) !== false) {\n if (\n (\"href\" in newElt && newElt.href) ||\n (\"src\" in newElt && newElt.src)\n ) {\n /** @type {(result?: any) => void} */ let resolve;\n let promise = new Promise(function (_resolve) {\n resolve = _resolve;\n });\n newElt.addEventListener(\"load\", function () {\n resolve();\n });\n promises.push(promise);\n }\n oldHead.appendChild(newElt);\n ctx.callbacks.afterNodeAdded(newElt);\n added.push(newElt);\n }\n }\n\n // remove all removed elements, after we have appended the new elements to avoid\n // additional network requests for things like style sheets\n for (const removedElement of removed) {\n if (ctx.callbacks.beforeNodeRemoved(removedElement) !== false) {\n oldHead.removeChild(removedElement);\n ctx.callbacks.afterNodeRemoved(removedElement);\n }\n }\n\n ctx.head.afterHeadMorphed(oldHead, {\n added: added,\n kept: preserved,\n removed: removed,\n });\n return promises;\n }\n\n //=============================================================================\n // Create Morph Context Functions\n //=============================================================================\n const createMorphContext = (function () {\n /**\n *\n * @param {Element} oldNode\n * @param {Element} newContent\n * @param {Config} config\n * @returns {MorphContext}\n */\n function createMorphContext(oldNode, newContent, config) {\n const { persistentIds, idMap } = createIdMaps(oldNode, newContent);\n\n const mergedConfig = mergeDefaults(config);\n const morphStyle = mergedConfig.morphStyle || \"outerHTML\";\n if (![\"innerHTML\", \"outerHTML\"].includes(morphStyle)) {\n throw `Do not understand how to morph style ${morphStyle}`;\n }\n\n return {\n target: oldNode,\n newContent: newContent,\n config: mergedConfig,\n morphStyle: morphStyle,\n ignoreActive: mergedConfig.ignoreActive,\n ignoreActiveValue: mergedConfig.ignoreActiveValue,\n restoreFocus: mergedConfig.restoreFocus,\n idMap: idMap,\n persistentIds: persistentIds,\n pantry: createPantry(),\n callbacks: mergedConfig.callbacks,\n head: mergedConfig.head,\n };\n }\n\n /**\n * Deep merges the config object and the Idiomorph.defaults object to\n * produce a final configuration object\n * @param {Config} config\n * @returns {ConfigInternal}\n */\n function mergeDefaults(config) {\n let finalConfig = Object.assign({}, defaults);\n\n // copy top level stuff into final config\n Object.assign(finalConfig, config);\n\n // copy callbacks into final config (do this to deep merge the callbacks)\n finalConfig.callbacks = Object.assign(\n {},\n defaults.callbacks,\n config.callbacks,\n );\n\n // copy head config into final config (do this to deep merge the head)\n finalConfig.head = Object.assign({}, defaults.head, config.head);\n\n return finalConfig;\n }\n\n /**\n * @returns {HTMLDivElement}\n */\n function createPantry() {\n const pantry = document.createElement(\"div\");\n pantry.hidden = true;\n document.body.insertAdjacentElement(\"afterend\", pantry);\n return pantry;\n }\n\n /**\n * Returns all elements with an ID contained within the root element and its descendants\n *\n * @param {Element} root\n * @returns {Element[]}\n */\n function findIdElements(root) {\n let elements = Array.from(root.querySelectorAll(\"[id]\"));\n if (root.id) {\n elements.push(root);\n }\n return elements;\n }\n\n /**\n * A bottom-up algorithm that populates a map of Element -> IdSet.\n * The idSet for a given element is the set of all IDs contained within its subtree.\n * As an optimzation, we filter these IDs through the given list of persistent IDs,\n * because we don't need to bother considering IDed elements that won't be in the new content.\n *\n * @param {Map>} idMap\n * @param {Set} persistentIds\n * @param {Element} root\n * @param {Element[]} elements\n */\n function populateIdMapWithTree(idMap, persistentIds, root, elements) {\n for (const elt of elements) {\n if (persistentIds.has(elt.id)) {\n /** @type {Element|null} */\n let current = elt;\n // walk up the parent hierarchy of that element, adding the id\n // of element to the parent's id set\n while (current) {\n let idSet = idMap.get(current);\n // if the id set doesn't exist, create it and insert it in the map\n if (idSet == null) {\n idSet = new Set();\n idMap.set(current, idSet);\n }\n idSet.add(elt.id);\n\n if (current === root) break;\n current = current.parentElement;\n }\n }\n }\n }\n\n /**\n * This function computes a map of nodes to all ids contained within that node (inclusive of the\n * node). This map can be used to ask if two nodes have intersecting sets of ids, which allows\n * for a looser definition of \"matching\" than tradition id matching, and allows child nodes\n * to contribute to a parent nodes matching.\n *\n * @param {Element} oldContent the old content that will be morphed\n * @param {Element} newContent the new content to morph to\n * @returns {IdSets}\n */\n function createIdMaps(oldContent, newContent) {\n const oldIdElements = findIdElements(oldContent);\n const newIdElements = findIdElements(newContent);\n\n const persistentIds = createPersistentIds(oldIdElements, newIdElements);\n\n /** @type {Map>} */\n let idMap = new Map();\n populateIdMapWithTree(idMap, persistentIds, oldContent, oldIdElements);\n\n /** @ts-ignore - if newContent is a duck-typed parent, pass its single child node as the root to halt upwards iteration */\n const newRoot = newContent.__idiomorphRoot || newContent;\n populateIdMapWithTree(idMap, persistentIds, newRoot, newIdElements);\n\n return { persistentIds, idMap };\n }\n\n /**\n * This function computes the set of ids that persist between the two contents excluding duplicates\n *\n * @param {Element[]} oldIdElements\n * @param {Element[]} newIdElements\n * @returns {Set}\n */\n function createPersistentIds(oldIdElements, newIdElements) {\n let duplicateIds = new Set();\n\n /** @type {Map} */\n let oldIdTagNameMap = new Map();\n for (const { id, tagName } of oldIdElements) {\n if (oldIdTagNameMap.has(id)) {\n duplicateIds.add(id);\n } else {\n oldIdTagNameMap.set(id, tagName);\n }\n }\n\n let persistentIds = new Set();\n for (const { id, tagName } of newIdElements) {\n if (persistentIds.has(id)) {\n duplicateIds.add(id);\n } else if (oldIdTagNameMap.get(id) === tagName) {\n persistentIds.add(id);\n }\n // skip if tag types mismatch because its not possible to morph one tag into another\n }\n\n for (const id of duplicateIds) {\n persistentIds.delete(id);\n }\n return persistentIds;\n }\n\n return createMorphContext;\n })();\n\n //=============================================================================\n // HTML Normalization Functions\n //=============================================================================\n const { normalizeElement, normalizeParent } = (function () {\n /** @type {WeakSet} */\n const generatedByIdiomorph = new WeakSet();\n\n /**\n *\n * @param {Element | Document} content\n * @returns {Element}\n */\n function normalizeElement(content) {\n if (content instanceof Document) {\n return content.documentElement;\n } else {\n return content;\n }\n }\n\n /**\n *\n * @param {null | string | Node | HTMLCollection | Node[] | Document & {generatedByIdiomorph:boolean}} newContent\n * @returns {Element}\n */\n function normalizeParent(newContent) {\n if (newContent == null) {\n return document.createElement(\"div\"); // dummy parent element\n } else if (typeof newContent === \"string\") {\n return normalizeParent(parseContent(newContent));\n } else if (\n generatedByIdiomorph.has(/** @type {Element} */ (newContent))\n ) {\n // the template tag created by idiomorph parsing can serve as a dummy parent\n return /** @type {Element} */ (newContent);\n } else if (newContent instanceof Node) {\n if (newContent.parentNode) {\n // we can't use the parent directly because newContent may have siblings\n // that we don't want in the morph, and reparenting might be expensive (TODO is it?),\n // so we create a duck-typed parent node instead.\n return createDuckTypedParent(newContent);\n } else {\n // a single node is added as a child to a dummy parent\n const dummyParent = document.createElement(\"div\");\n dummyParent.append(newContent);\n return dummyParent;\n }\n } else {\n // all nodes in the array or HTMLElement collection are consolidated under\n // a single dummy parent element\n const dummyParent = document.createElement(\"div\");\n for (const elt of [...newContent]) {\n dummyParent.append(elt);\n }\n return dummyParent;\n }\n }\n\n /**\n * Creates a fake duck-typed parent element to wrap a single node, without actually reparenting it.\n * \"If it walks like a duck, and quacks like a duck, then it must be a duck!\" -- James Whitcomb Riley (1849\u20131916)\n *\n * @param {Node} newContent\n * @returns {Element}\n */\n function createDuckTypedParent(newContent) {\n return /** @type {Element} */ (\n /** @type {unknown} */ ({\n childNodes: [newContent],\n /** @ts-ignore - cover your eyes for a minute, tsc */\n querySelectorAll: (s) => {\n /** @ts-ignore */\n const elements = newContent.querySelectorAll(s);\n /** @ts-ignore */\n return newContent.matches(s) ? [newContent, ...elements] : elements;\n },\n /** @ts-ignore */\n insertBefore: (n, r) => newContent.parentNode.insertBefore(n, r),\n /** @ts-ignore */\n moveBefore: (n, r) => newContent.parentNode.moveBefore(n, r),\n // for later use with populateIdMapWithTree to halt upwards iteration\n get __idiomorphRoot() {\n return newContent;\n },\n })\n );\n }\n\n /**\n *\n * @param {string} newContent\n * @returns {Node | null | DocumentFragment}\n */\n function parseContent(newContent) {\n let parser = new DOMParser();\n\n // remove svgs to avoid false-positive matches on head, etc.\n let contentWithSvgsRemoved = newContent.replace(\n /]*>|>)([\\s\\S]*?)<\\/svg>/gim,\n \"\",\n );\n\n // if the newContent contains a html, head or body tag, we can simply parse it w/o wrapping\n if (\n contentWithSvgsRemoved.match(/<\\/html>/) ||\n contentWithSvgsRemoved.match(/<\\/head>/) ||\n contentWithSvgsRemoved.match(/<\\/body>/)\n ) {\n let content = parser.parseFromString(newContent, \"text/html\");\n // if it is a full HTML document, return the document itself as the parent container\n if (contentWithSvgsRemoved.match(/<\\/html>/)) {\n generatedByIdiomorph.add(content);\n return content;\n } else {\n // otherwise return the html element as the parent container\n let htmlElement = content.firstChild;\n if (htmlElement) {\n generatedByIdiomorph.add(htmlElement);\n }\n return htmlElement;\n }\n } else {\n // if it is partial HTML, wrap it in a template tag to provide a parent element and also to help\n // deal with touchy tags like tr, tbody, etc.\n let responseDoc = parser.parseFromString(\n \"\",\n \"text/html\",\n );\n let content = /** @type {HTMLTemplateElement} */ (\n responseDoc.body.querySelector(\"template\")\n ).content;\n generatedByIdiomorph.add(content);\n return content;\n }\n }\n\n return { normalizeElement, normalizeParent };\n })();\n\n //=============================================================================\n // This is what ends up becoming the Idiomorph global object\n //=============================================================================\n return {\n morph,\n defaults,\n };\n})();\n\nfunction morphElements(currentElement, newElement, { callbacks, ...options } = {}) {\n Idiomorph.morph(currentElement, newElement, {\n ...options,\n callbacks: new DefaultIdiomorphCallbacks(callbacks)\n });\n}\n\nfunction morphChildren(currentElement, newElement) {\n morphElements(currentElement, newElement.childNodes, {\n morphStyle: \"innerHTML\"\n });\n}\n\nclass DefaultIdiomorphCallbacks {\n #beforeNodeMorphed\n\n constructor({ beforeNodeMorphed } = {}) {\n this.#beforeNodeMorphed = beforeNodeMorphed || (() => true);\n }\n\n beforeNodeAdded = (node) => {\n return !(node.id && node.hasAttribute(\"data-turbo-permanent\") && document.getElementById(node.id))\n }\n\n beforeNodeMorphed = (currentElement, newElement) => {\n if (currentElement instanceof Element) {\n if (!currentElement.hasAttribute(\"data-turbo-permanent\") && this.#beforeNodeMorphed(currentElement, newElement)) {\n const event = dispatch(\"turbo:before-morph-element\", {\n cancelable: true,\n target: currentElement,\n detail: { currentElement, newElement }\n });\n\n return !event.defaultPrevented\n } else {\n return false\n }\n }\n }\n\n beforeAttributeUpdated = (attributeName, target, mutationType) => {\n const event = dispatch(\"turbo:before-morph-attribute\", {\n cancelable: true,\n target,\n detail: { attributeName, mutationType }\n });\n\n return !event.defaultPrevented\n }\n\n beforeNodeRemoved = (node) => {\n return this.beforeNodeMorphed(node)\n }\n\n afterNodeMorphed = (currentElement, newElement) => {\n if (currentElement instanceof Element) {\n dispatch(\"turbo:morph-element\", {\n target: currentElement,\n detail: { currentElement, newElement }\n });\n }\n }\n}\n\nclass MorphingFrameRenderer extends FrameRenderer {\n static renderElement(currentElement, newElement) {\n dispatch(\"turbo:before-frame-morph\", {\n target: currentElement,\n detail: { currentElement, newElement }\n });\n\n morphChildren(currentElement, newElement);\n }\n\n async preservingPermanentElements(callback) {\n return await callback()\n }\n}\n\nclass ProgressBar {\n static animationDuration = 300 /*ms*/\n\n static get defaultCSS() {\n return unindent`\n .turbo-progress-bar {\n position: fixed;\n display: block;\n top: 0;\n left: 0;\n height: 3px;\n background: #0076ff;\n z-index: 2147483647;\n transition:\n width ${ProgressBar.animationDuration}ms ease-out,\n opacity ${ProgressBar.animationDuration / 2}ms ${ProgressBar.animationDuration / 2}ms ease-in;\n transform: translate3d(0, 0, 0);\n }\n `\n }\n\n hiding = false\n value = 0\n visible = false\n\n constructor() {\n this.stylesheetElement = this.createStylesheetElement();\n this.progressElement = this.createProgressElement();\n this.installStylesheetElement();\n this.setValue(0);\n }\n\n show() {\n if (!this.visible) {\n this.visible = true;\n this.installProgressElement();\n this.startTrickling();\n }\n }\n\n hide() {\n if (this.visible && !this.hiding) {\n this.hiding = true;\n this.fadeProgressElement(() => {\n this.uninstallProgressElement();\n this.stopTrickling();\n this.visible = false;\n this.hiding = false;\n });\n }\n }\n\n setValue(value) {\n this.value = value;\n this.refresh();\n }\n\n // Private\n\n installStylesheetElement() {\n document.head.insertBefore(this.stylesheetElement, document.head.firstChild);\n }\n\n installProgressElement() {\n this.progressElement.style.width = \"0\";\n this.progressElement.style.opacity = \"1\";\n document.documentElement.insertBefore(this.progressElement, document.body);\n this.refresh();\n }\n\n fadeProgressElement(callback) {\n this.progressElement.style.opacity = \"0\";\n setTimeout(callback, ProgressBar.animationDuration * 1.5);\n }\n\n uninstallProgressElement() {\n if (this.progressElement.parentNode) {\n document.documentElement.removeChild(this.progressElement);\n }\n }\n\n startTrickling() {\n if (!this.trickleInterval) {\n this.trickleInterval = window.setInterval(this.trickle, ProgressBar.animationDuration);\n }\n }\n\n stopTrickling() {\n window.clearInterval(this.trickleInterval);\n delete this.trickleInterval;\n }\n\n trickle = () => {\n this.setValue(this.value + Math.random() / 100);\n }\n\n refresh() {\n requestAnimationFrame(() => {\n this.progressElement.style.width = `${10 + this.value * 90}%`;\n });\n }\n\n createStylesheetElement() {\n const element = document.createElement(\"style\");\n element.type = \"text/css\";\n element.textContent = ProgressBar.defaultCSS;\n const cspNonce = getCspNonce();\n if (cspNonce) {\n element.nonce = cspNonce;\n }\n return element\n }\n\n createProgressElement() {\n const element = document.createElement(\"div\");\n element.className = \"turbo-progress-bar\";\n return element\n }\n}\n\nclass HeadSnapshot extends Snapshot {\n detailsByOuterHTML = this.children\n .filter((element) => !elementIsNoscript(element))\n .map((element) => elementWithoutNonce(element))\n .reduce((result, element) => {\n const { outerHTML } = element;\n const details =\n outerHTML in result\n ? result[outerHTML]\n : {\n type: elementType(element),\n tracked: elementIsTracked(element),\n elements: []\n };\n return {\n ...result,\n [outerHTML]: {\n ...details,\n elements: [...details.elements, element]\n }\n }\n }, {})\n\n get trackedElementSignature() {\n return Object.keys(this.detailsByOuterHTML)\n .filter((outerHTML) => this.detailsByOuterHTML[outerHTML].tracked)\n .join(\"\")\n }\n\n getScriptElementsNotInSnapshot(snapshot) {\n return this.getElementsMatchingTypeNotInSnapshot(\"script\", snapshot)\n }\n\n getStylesheetElementsNotInSnapshot(snapshot) {\n return this.getElementsMatchingTypeNotInSnapshot(\"stylesheet\", snapshot)\n }\n\n getElementsMatchingTypeNotInSnapshot(matchedType, snapshot) {\n return Object.keys(this.detailsByOuterHTML)\n .filter((outerHTML) => !(outerHTML in snapshot.detailsByOuterHTML))\n .map((outerHTML) => this.detailsByOuterHTML[outerHTML])\n .filter(({ type }) => type == matchedType)\n .map(({ elements: [element] }) => element)\n }\n\n get provisionalElements() {\n return Object.keys(this.detailsByOuterHTML).reduce((result, outerHTML) => {\n const { type, tracked, elements } = this.detailsByOuterHTML[outerHTML];\n if (type == null && !tracked) {\n return [...result, ...elements]\n } else if (elements.length > 1) {\n return [...result, ...elements.slice(1)]\n } else {\n return result\n }\n }, [])\n }\n\n getMetaValue(name) {\n const element = this.findMetaElementByName(name);\n return element ? element.getAttribute(\"content\") : null\n }\n\n findMetaElementByName(name) {\n return Object.keys(this.detailsByOuterHTML).reduce((result, outerHTML) => {\n const {\n elements: [element]\n } = this.detailsByOuterHTML[outerHTML];\n return elementIsMetaElementWithName(element, name) ? element : result\n }, undefined | undefined)\n }\n}\n\nfunction elementType(element) {\n if (elementIsScript(element)) {\n return \"script\"\n } else if (elementIsStylesheet(element)) {\n return \"stylesheet\"\n }\n}\n\nfunction elementIsTracked(element) {\n return element.getAttribute(\"data-turbo-track\") == \"reload\"\n}\n\nfunction elementIsScript(element) {\n const tagName = element.localName;\n return tagName == \"script\"\n}\n\nfunction elementIsNoscript(element) {\n const tagName = element.localName;\n return tagName == \"noscript\"\n}\n\nfunction elementIsStylesheet(element) {\n const tagName = element.localName;\n return tagName == \"style\" || (tagName == \"link\" && element.getAttribute(\"rel\") == \"stylesheet\")\n}\n\nfunction elementIsMetaElementWithName(element, name) {\n const tagName = element.localName;\n return tagName == \"meta\" && element.getAttribute(\"name\") == name\n}\n\nfunction elementWithoutNonce(element) {\n if (element.hasAttribute(\"nonce\")) {\n element.setAttribute(\"nonce\", \"\");\n }\n\n return element\n}\n\nclass PageSnapshot extends Snapshot {\n static fromHTMLString(html = \"\") {\n return this.fromDocument(parseHTMLDocument(html))\n }\n\n static fromElement(element) {\n return this.fromDocument(element.ownerDocument)\n }\n\n static fromDocument({ documentElement, body, head }) {\n return new this(documentElement, body, new HeadSnapshot(head))\n }\n\n constructor(documentElement, body, headSnapshot) {\n super(body);\n this.documentElement = documentElement;\n this.headSnapshot = headSnapshot;\n }\n\n clone() {\n const clonedElement = this.element.cloneNode(true);\n\n const selectElements = this.element.querySelectorAll(\"select\");\n const clonedSelectElements = clonedElement.querySelectorAll(\"select\");\n\n for (const [index, source] of selectElements.entries()) {\n const clone = clonedSelectElements[index];\n for (const option of clone.selectedOptions) option.selected = false;\n for (const option of source.selectedOptions) clone.options[option.index].selected = true;\n }\n\n for (const clonedPasswordInput of clonedElement.querySelectorAll('input[type=\"password\"]')) {\n clonedPasswordInput.value = \"\";\n }\n\n return new PageSnapshot(this.documentElement, clonedElement, this.headSnapshot)\n }\n\n get lang() {\n return this.documentElement.getAttribute(\"lang\")\n }\n\n get headElement() {\n return this.headSnapshot.element\n }\n\n get rootLocation() {\n const root = this.getSetting(\"root\") ?? \"/\";\n return expandURL(root)\n }\n\n get cacheControlValue() {\n return this.getSetting(\"cache-control\")\n }\n\n get isPreviewable() {\n return this.cacheControlValue != \"no-preview\"\n }\n\n get isCacheable() {\n return this.cacheControlValue != \"no-cache\"\n }\n\n get isVisitable() {\n return this.getSetting(\"visit-control\") != \"reload\"\n }\n\n get prefersViewTransitions() {\n return this.headSnapshot.getMetaValue(\"view-transition\") === \"same-origin\"\n }\n\n get shouldMorphPage() {\n return this.getSetting(\"refresh-method\") === \"morph\"\n }\n\n get shouldPreserveScrollPosition() {\n return this.getSetting(\"refresh-scroll\") === \"preserve\"\n }\n\n // Private\n\n getSetting(name) {\n return this.headSnapshot.getMetaValue(`turbo-${name}`)\n }\n}\n\nclass ViewTransitioner {\n #viewTransitionStarted = false\n #lastOperation = Promise.resolve()\n\n renderChange(useViewTransition, render) {\n if (useViewTransition && this.viewTransitionsAvailable && !this.#viewTransitionStarted) {\n this.#viewTransitionStarted = true;\n this.#lastOperation = this.#lastOperation.then(async () => {\n await document.startViewTransition(render).finished;\n });\n } else {\n this.#lastOperation = this.#lastOperation.then(render);\n }\n\n return this.#lastOperation\n }\n\n get viewTransitionsAvailable() {\n return document.startViewTransition\n }\n}\n\nconst defaultOptions = {\n action: \"advance\",\n historyChanged: false,\n visitCachedSnapshot: () => {},\n willRender: true,\n updateHistory: true,\n shouldCacheSnapshot: true,\n acceptsStreamResponse: false\n};\n\nconst TimingMetric = {\n visitStart: \"visitStart\",\n requestStart: \"requestStart\",\n requestEnd: \"requestEnd\",\n visitEnd: \"visitEnd\"\n};\n\nconst VisitState = {\n initialized: \"initialized\",\n started: \"started\",\n canceled: \"canceled\",\n failed: \"failed\",\n completed: \"completed\"\n};\n\nconst SystemStatusCode = {\n networkFailure: 0,\n timeoutFailure: -1,\n contentTypeMismatch: -2\n};\n\nconst Direction = {\n advance: \"forward\",\n restore: \"back\",\n replace: \"none\"\n};\n\nclass Visit {\n identifier = uuid() // Required by turbo-ios\n timingMetrics = {}\n\n followedRedirect = false\n historyChanged = false\n scrolled = false\n shouldCacheSnapshot = true\n acceptsStreamResponse = false\n snapshotCached = false\n state = VisitState.initialized\n viewTransitioner = new ViewTransitioner()\n\n constructor(delegate, location, restorationIdentifier, options = {}) {\n this.delegate = delegate;\n this.location = location;\n this.restorationIdentifier = restorationIdentifier || uuid();\n\n const {\n action,\n historyChanged,\n referrer,\n snapshot,\n snapshotHTML,\n response,\n visitCachedSnapshot,\n willRender,\n updateHistory,\n shouldCacheSnapshot,\n acceptsStreamResponse,\n direction\n } = {\n ...defaultOptions,\n ...options\n };\n this.action = action;\n this.historyChanged = historyChanged;\n this.referrer = referrer;\n this.snapshot = snapshot;\n this.snapshotHTML = snapshotHTML;\n this.response = response;\n this.isSamePage = this.delegate.locationWithActionIsSamePage(this.location, this.action);\n this.isPageRefresh = this.view.isPageRefresh(this);\n this.visitCachedSnapshot = visitCachedSnapshot;\n this.willRender = willRender;\n this.updateHistory = updateHistory;\n this.scrolled = !willRender;\n this.shouldCacheSnapshot = shouldCacheSnapshot;\n this.acceptsStreamResponse = acceptsStreamResponse;\n this.direction = direction || Direction[action];\n }\n\n get adapter() {\n return this.delegate.adapter\n }\n\n get view() {\n return this.delegate.view\n }\n\n get history() {\n return this.delegate.history\n }\n\n get restorationData() {\n return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)\n }\n\n get silent() {\n return this.isSamePage\n }\n\n start() {\n if (this.state == VisitState.initialized) {\n this.recordTimingMetric(TimingMetric.visitStart);\n this.state = VisitState.started;\n this.adapter.visitStarted(this);\n this.delegate.visitStarted(this);\n }\n }\n\n cancel() {\n if (this.state == VisitState.started) {\n if (this.request) {\n this.request.cancel();\n }\n this.cancelRender();\n this.state = VisitState.canceled;\n }\n }\n\n complete() {\n if (this.state == VisitState.started) {\n this.recordTimingMetric(TimingMetric.visitEnd);\n this.adapter.visitCompleted(this);\n this.state = VisitState.completed;\n this.followRedirect();\n\n if (!this.followedRedirect) {\n this.delegate.visitCompleted(this);\n }\n }\n }\n\n fail() {\n if (this.state == VisitState.started) {\n this.state = VisitState.failed;\n this.adapter.visitFailed(this);\n this.delegate.visitCompleted(this);\n }\n }\n\n changeHistory() {\n if (!this.historyChanged && this.updateHistory) {\n const actionForHistory = this.location.href === this.referrer?.href ? \"replace\" : this.action;\n const method = getHistoryMethodForAction(actionForHistory);\n this.history.update(method, this.location, this.restorationIdentifier);\n this.historyChanged = true;\n }\n }\n\n issueRequest() {\n if (this.hasPreloadedResponse()) {\n this.simulateRequest();\n } else if (this.shouldIssueRequest() && !this.request) {\n this.request = new FetchRequest(this, FetchMethod.get, this.location);\n this.request.perform();\n }\n }\n\n simulateRequest() {\n if (this.response) {\n this.startRequest();\n this.recordResponse();\n this.finishRequest();\n }\n }\n\n startRequest() {\n this.recordTimingMetric(TimingMetric.requestStart);\n this.adapter.visitRequestStarted(this);\n }\n\n recordResponse(response = this.response) {\n this.response = response;\n if (response) {\n const { statusCode } = response;\n if (isSuccessful(statusCode)) {\n this.adapter.visitRequestCompleted(this);\n } else {\n this.adapter.visitRequestFailedWithStatusCode(this, statusCode);\n }\n }\n }\n\n finishRequest() {\n this.recordTimingMetric(TimingMetric.requestEnd);\n this.adapter.visitRequestFinished(this);\n }\n\n loadResponse() {\n if (this.response) {\n const { statusCode, responseHTML } = this.response;\n this.render(async () => {\n if (this.shouldCacheSnapshot) this.cacheSnapshot();\n if (this.view.renderPromise) await this.view.renderPromise;\n\n if (isSuccessful(statusCode) && responseHTML != null) {\n const snapshot = PageSnapshot.fromHTMLString(responseHTML);\n await this.renderPageSnapshot(snapshot, false);\n\n this.adapter.visitRendered(this);\n this.complete();\n } else {\n await this.view.renderError(PageSnapshot.fromHTMLString(responseHTML), this);\n this.adapter.visitRendered(this);\n this.fail();\n }\n });\n }\n }\n\n getCachedSnapshot() {\n const snapshot = this.view.getCachedSnapshotForLocation(this.location) || this.getPreloadedSnapshot();\n\n if (snapshot && (!getAnchor(this.location) || snapshot.hasAnchor(getAnchor(this.location)))) {\n if (this.action == \"restore\" || snapshot.isPreviewable) {\n return snapshot\n }\n }\n }\n\n getPreloadedSnapshot() {\n if (this.snapshotHTML) {\n return PageSnapshot.fromHTMLString(this.snapshotHTML)\n }\n }\n\n hasCachedSnapshot() {\n return this.getCachedSnapshot() != null\n }\n\n loadCachedSnapshot() {\n const snapshot = this.getCachedSnapshot();\n if (snapshot) {\n const isPreview = this.shouldIssueRequest();\n this.render(async () => {\n this.cacheSnapshot();\n if (this.isSamePage || this.isPageRefresh) {\n this.adapter.visitRendered(this);\n } else {\n if (this.view.renderPromise) await this.view.renderPromise;\n\n await this.renderPageSnapshot(snapshot, isPreview);\n\n this.adapter.visitRendered(this);\n if (!isPreview) {\n this.complete();\n }\n }\n });\n }\n }\n\n followRedirect() {\n if (this.redirectedToLocation && !this.followedRedirect && this.response?.redirected) {\n this.adapter.visitProposedToLocation(this.redirectedToLocation, {\n action: \"replace\",\n response: this.response,\n shouldCacheSnapshot: false,\n willRender: false\n });\n this.followedRedirect = true;\n }\n }\n\n goToSamePageAnchor() {\n if (this.isSamePage) {\n this.render(async () => {\n this.cacheSnapshot();\n this.performScroll();\n this.changeHistory();\n this.adapter.visitRendered(this);\n });\n }\n }\n\n // Fetch request delegate\n\n prepareRequest(request) {\n if (this.acceptsStreamResponse) {\n request.acceptResponseType(StreamMessage.contentType);\n }\n }\n\n requestStarted() {\n this.startRequest();\n }\n\n requestPreventedHandlingResponse(_request, _response) {}\n\n async requestSucceededWithResponse(request, response) {\n const responseHTML = await response.responseHTML;\n const { redirected, statusCode } = response;\n if (responseHTML == undefined) {\n this.recordResponse({\n statusCode: SystemStatusCode.contentTypeMismatch,\n redirected\n });\n } else {\n this.redirectedToLocation = response.redirected ? response.location : undefined;\n this.recordResponse({ statusCode: statusCode, responseHTML, redirected });\n }\n }\n\n async requestFailedWithResponse(request, response) {\n const responseHTML = await response.responseHTML;\n const { redirected, statusCode } = response;\n if (responseHTML == undefined) {\n this.recordResponse({\n statusCode: SystemStatusCode.contentTypeMismatch,\n redirected\n });\n } else {\n this.recordResponse({ statusCode: statusCode, responseHTML, redirected });\n }\n }\n\n requestErrored(_request, _error) {\n this.recordResponse({\n statusCode: SystemStatusCode.networkFailure,\n redirected: false\n });\n }\n\n requestFinished() {\n this.finishRequest();\n }\n\n // Scrolling\n\n performScroll() {\n if (!this.scrolled && !this.view.forceReloaded && !this.view.shouldPreserveScrollPosition(this)) {\n if (this.action == \"restore\") {\n this.scrollToRestoredPosition() || this.scrollToAnchor() || this.view.scrollToTop();\n } else {\n this.scrollToAnchor() || this.view.scrollToTop();\n }\n if (this.isSamePage) {\n this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation, this.location);\n }\n\n this.scrolled = true;\n }\n }\n\n scrollToRestoredPosition() {\n const { scrollPosition } = this.restorationData;\n if (scrollPosition) {\n this.view.scrollToPosition(scrollPosition);\n return true\n }\n }\n\n scrollToAnchor() {\n const anchor = getAnchor(this.location);\n if (anchor != null) {\n this.view.scrollToAnchor(anchor);\n return true\n }\n }\n\n // Instrumentation\n\n recordTimingMetric(metric) {\n this.timingMetrics[metric] = new Date().getTime();\n }\n\n getTimingMetrics() {\n return { ...this.timingMetrics }\n }\n\n // Private\n\n hasPreloadedResponse() {\n return typeof this.response == \"object\"\n }\n\n shouldIssueRequest() {\n if (this.isSamePage) {\n return false\n } else if (this.action == \"restore\") {\n return !this.hasCachedSnapshot()\n } else {\n return this.willRender\n }\n }\n\n cacheSnapshot() {\n if (!this.snapshotCached) {\n this.view.cacheSnapshot(this.snapshot).then((snapshot) => snapshot && this.visitCachedSnapshot(snapshot));\n this.snapshotCached = true;\n }\n }\n\n async render(callback) {\n this.cancelRender();\n await new Promise((resolve) => {\n this.frame =\n document.visibilityState === \"hidden\" ? setTimeout(() => resolve(), 0) : requestAnimationFrame(() => resolve());\n });\n await callback();\n delete this.frame;\n }\n\n async renderPageSnapshot(snapshot, isPreview) {\n await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(snapshot), async () => {\n await this.view.renderPage(snapshot, isPreview, this.willRender, this);\n this.performScroll();\n });\n }\n\n cancelRender() {\n if (this.frame) {\n cancelAnimationFrame(this.frame);\n delete this.frame;\n }\n }\n}\n\nfunction isSuccessful(statusCode) {\n return statusCode >= 200 && statusCode < 300\n}\n\nclass BrowserAdapter {\n progressBar = new ProgressBar()\n\n constructor(session) {\n this.session = session;\n }\n\n visitProposedToLocation(location, options) {\n if (locationIsVisitable(location, this.navigator.rootLocation)) {\n this.navigator.startVisit(location, options?.restorationIdentifier || uuid(), options);\n } else {\n window.location.href = location.toString();\n }\n }\n\n visitStarted(visit) {\n this.location = visit.location;\n visit.loadCachedSnapshot();\n visit.issueRequest();\n visit.goToSamePageAnchor();\n }\n\n visitRequestStarted(visit) {\n this.progressBar.setValue(0);\n if (visit.hasCachedSnapshot() || visit.action != \"restore\") {\n this.showVisitProgressBarAfterDelay();\n } else {\n this.showProgressBar();\n }\n }\n\n visitRequestCompleted(visit) {\n visit.loadResponse();\n }\n\n visitRequestFailedWithStatusCode(visit, statusCode) {\n switch (statusCode) {\n case SystemStatusCode.networkFailure:\n case SystemStatusCode.timeoutFailure:\n case SystemStatusCode.contentTypeMismatch:\n return this.reload({\n reason: \"request_failed\",\n context: {\n statusCode\n }\n })\n default:\n return visit.loadResponse()\n }\n }\n\n visitRequestFinished(_visit) {}\n\n visitCompleted(_visit) {\n this.progressBar.setValue(1);\n this.hideVisitProgressBar();\n }\n\n pageInvalidated(reason) {\n this.reload(reason);\n }\n\n visitFailed(_visit) {\n this.progressBar.setValue(1);\n this.hideVisitProgressBar();\n }\n\n visitRendered(_visit) {}\n\n // Link prefetching\n\n linkPrefetchingIsEnabledForLocation(location) {\n return true\n }\n\n // Form Submission Delegate\n\n formSubmissionStarted(_formSubmission) {\n this.progressBar.setValue(0);\n this.showFormProgressBarAfterDelay();\n }\n\n formSubmissionFinished(_formSubmission) {\n this.progressBar.setValue(1);\n this.hideFormProgressBar();\n }\n\n // Private\n\n showVisitProgressBarAfterDelay() {\n this.visitProgressBarTimeout = window.setTimeout(this.showProgressBar, this.session.progressBarDelay);\n }\n\n hideVisitProgressBar() {\n this.progressBar.hide();\n if (this.visitProgressBarTimeout != null) {\n window.clearTimeout(this.visitProgressBarTimeout);\n delete this.visitProgressBarTimeout;\n }\n }\n\n showFormProgressBarAfterDelay() {\n if (this.formProgressBarTimeout == null) {\n this.formProgressBarTimeout = window.setTimeout(this.showProgressBar, this.session.progressBarDelay);\n }\n }\n\n hideFormProgressBar() {\n this.progressBar.hide();\n if (this.formProgressBarTimeout != null) {\n window.clearTimeout(this.formProgressBarTimeout);\n delete this.formProgressBarTimeout;\n }\n }\n\n showProgressBar = () => {\n this.progressBar.show();\n }\n\n reload(reason) {\n dispatch(\"turbo:reload\", { detail: reason });\n\n window.location.href = this.location?.toString() || window.location.href;\n }\n\n get navigator() {\n return this.session.navigator\n }\n}\n\nclass CacheObserver {\n selector = \"[data-turbo-temporary]\"\n deprecatedSelector = \"[data-turbo-cache=false]\"\n\n started = false\n\n start() {\n if (!this.started) {\n this.started = true;\n addEventListener(\"turbo:before-cache\", this.removeTemporaryElements, false);\n }\n }\n\n stop() {\n if (this.started) {\n this.started = false;\n removeEventListener(\"turbo:before-cache\", this.removeTemporaryElements, false);\n }\n }\n\n removeTemporaryElements = (_event) => {\n for (const element of this.temporaryElements) {\n element.remove();\n }\n }\n\n get temporaryElements() {\n return [...document.querySelectorAll(this.selector), ...this.temporaryElementsWithDeprecation]\n }\n\n get temporaryElementsWithDeprecation() {\n const elements = document.querySelectorAll(this.deprecatedSelector);\n\n if (elements.length) {\n console.warn(\n `The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`\n );\n }\n\n return [...elements]\n }\n}\n\nclass FrameRedirector {\n constructor(session, element) {\n this.session = session;\n this.element = element;\n this.linkInterceptor = new LinkInterceptor(this, element);\n this.formSubmitObserver = new FormSubmitObserver(this, element);\n }\n\n start() {\n this.linkInterceptor.start();\n this.formSubmitObserver.start();\n }\n\n stop() {\n this.linkInterceptor.stop();\n this.formSubmitObserver.stop();\n }\n\n // Link interceptor delegate\n\n shouldInterceptLinkClick(element, _location, _event) {\n return this.#shouldRedirect(element)\n }\n\n linkClickIntercepted(element, url, event) {\n const frame = this.#findFrameElement(element);\n if (frame) {\n frame.delegate.linkClickIntercepted(element, url, event);\n }\n }\n\n // Form submit observer delegate\n\n willSubmitForm(element, submitter) {\n return (\n element.closest(\"turbo-frame\") == null &&\n this.#shouldSubmit(element, submitter) &&\n this.#shouldRedirect(element, submitter)\n )\n }\n\n formSubmitted(element, submitter) {\n const frame = this.#findFrameElement(element, submitter);\n if (frame) {\n frame.delegate.formSubmitted(element, submitter);\n }\n }\n\n #shouldSubmit(form, submitter) {\n const action = getAction$1(form, submitter);\n const meta = this.element.ownerDocument.querySelector(`meta[name=\"turbo-root\"]`);\n const rootLocation = expandURL(meta?.content ?? \"/\");\n\n return this.#shouldRedirect(form, submitter) && locationIsVisitable(action, rootLocation)\n }\n\n #shouldRedirect(element, submitter) {\n const isNavigatable =\n element instanceof HTMLFormElement\n ? this.session.submissionIsNavigatable(element, submitter)\n : this.session.elementIsNavigatable(element);\n\n if (isNavigatable) {\n const frame = this.#findFrameElement(element, submitter);\n return frame ? frame != element.closest(\"turbo-frame\") : false\n } else {\n return false\n }\n }\n\n #findFrameElement(element, submitter) {\n const id = submitter?.getAttribute(\"data-turbo-frame\") || element.getAttribute(\"data-turbo-frame\");\n if (id && id != \"_top\") {\n const frame = this.element.querySelector(`#${id}:not([disabled])`);\n if (frame instanceof FrameElement) {\n return frame\n }\n }\n }\n}\n\nclass History {\n location\n restorationIdentifier = uuid()\n restorationData = {}\n started = false\n pageLoaded = false\n currentIndex = 0\n\n constructor(delegate) {\n this.delegate = delegate;\n }\n\n start() {\n if (!this.started) {\n addEventListener(\"popstate\", this.onPopState, false);\n addEventListener(\"load\", this.onPageLoad, false);\n this.currentIndex = history.state?.turbo?.restorationIndex || 0;\n this.started = true;\n this.replace(new URL(window.location.href));\n }\n }\n\n stop() {\n if (this.started) {\n removeEventListener(\"popstate\", this.onPopState, false);\n removeEventListener(\"load\", this.onPageLoad, false);\n this.started = false;\n }\n }\n\n push(location, restorationIdentifier) {\n this.update(history.pushState, location, restorationIdentifier);\n }\n\n replace(location, restorationIdentifier) {\n this.update(history.replaceState, location, restorationIdentifier);\n }\n\n update(method, location, restorationIdentifier = uuid()) {\n if (method === history.pushState) ++this.currentIndex;\n\n const state = { turbo: { restorationIdentifier, restorationIndex: this.currentIndex } };\n method.call(history, state, \"\", location.href);\n this.location = location;\n this.restorationIdentifier = restorationIdentifier;\n }\n\n // Restoration data\n\n getRestorationDataForIdentifier(restorationIdentifier) {\n return this.restorationData[restorationIdentifier] || {}\n }\n\n updateRestorationData(additionalData) {\n const { restorationIdentifier } = this;\n const restorationData = this.restorationData[restorationIdentifier];\n this.restorationData[restorationIdentifier] = {\n ...restorationData,\n ...additionalData\n };\n }\n\n // Scroll restoration\n\n assumeControlOfScrollRestoration() {\n if (!this.previousScrollRestoration) {\n this.previousScrollRestoration = history.scrollRestoration ?? \"auto\";\n history.scrollRestoration = \"manual\";\n }\n }\n\n relinquishControlOfScrollRestoration() {\n if (this.previousScrollRestoration) {\n history.scrollRestoration = this.previousScrollRestoration;\n delete this.previousScrollRestoration;\n }\n }\n\n // Event handlers\n\n onPopState = (event) => {\n if (this.shouldHandlePopState()) {\n const { turbo } = event.state || {};\n if (turbo) {\n this.location = new URL(window.location.href);\n const { restorationIdentifier, restorationIndex } = turbo;\n this.restorationIdentifier = restorationIdentifier;\n const direction = restorationIndex > this.currentIndex ? \"forward\" : \"back\";\n this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location, restorationIdentifier, direction);\n this.currentIndex = restorationIndex;\n }\n }\n }\n\n onPageLoad = async (_event) => {\n await nextMicrotask();\n this.pageLoaded = true;\n }\n\n // Private\n\n shouldHandlePopState() {\n // Safari dispatches a popstate event after window's load event, ignore it\n return this.pageIsLoaded()\n }\n\n pageIsLoaded() {\n return this.pageLoaded || document.readyState == \"complete\"\n }\n}\n\nclass LinkPrefetchObserver {\n started = false\n #prefetchedLink = null\n\n constructor(delegate, eventTarget) {\n this.delegate = delegate;\n this.eventTarget = eventTarget;\n }\n\n start() {\n if (this.started) return\n\n if (this.eventTarget.readyState === \"loading\") {\n this.eventTarget.addEventListener(\"DOMContentLoaded\", this.#enable, { once: true });\n } else {\n this.#enable();\n }\n }\n\n stop() {\n if (!this.started) return\n\n this.eventTarget.removeEventListener(\"mouseenter\", this.#tryToPrefetchRequest, {\n capture: true,\n passive: true\n });\n this.eventTarget.removeEventListener(\"mouseleave\", this.#cancelRequestIfObsolete, {\n capture: true,\n passive: true\n });\n\n this.eventTarget.removeEventListener(\"turbo:before-fetch-request\", this.#tryToUsePrefetchedRequest, true);\n this.started = false;\n }\n\n #enable = () => {\n this.eventTarget.addEventListener(\"mouseenter\", this.#tryToPrefetchRequest, {\n capture: true,\n passive: true\n });\n this.eventTarget.addEventListener(\"mouseleave\", this.#cancelRequestIfObsolete, {\n capture: true,\n passive: true\n });\n\n this.eventTarget.addEventListener(\"turbo:before-fetch-request\", this.#tryToUsePrefetchedRequest, true);\n this.started = true;\n }\n\n #tryToPrefetchRequest = (event) => {\n if (getMetaContent(\"turbo-prefetch\") === \"false\") return\n\n const target = event.target;\n const isLink = target.matches && target.matches(\"a[href]:not([target^=_]):not([download])\");\n\n if (isLink && this.#isPrefetchable(target)) {\n const link = target;\n const location = getLocationForLink(link);\n\n if (this.delegate.canPrefetchRequestToLocation(link, location)) {\n this.#prefetchedLink = link;\n\n const fetchRequest = new FetchRequest(\n this,\n FetchMethod.get,\n location,\n new URLSearchParams(),\n target\n );\n\n prefetchCache.setLater(location.toString(), fetchRequest, this.#cacheTtl);\n }\n }\n }\n\n #cancelRequestIfObsolete = (event) => {\n if (event.target === this.#prefetchedLink) this.#cancelPrefetchRequest();\n }\n\n #cancelPrefetchRequest = () => {\n prefetchCache.clear();\n this.#prefetchedLink = null;\n }\n\n #tryToUsePrefetchedRequest = (event) => {\n if (event.target.tagName !== \"FORM\" && event.detail.fetchOptions.method === \"GET\") {\n const cached = prefetchCache.get(event.detail.url.toString());\n\n if (cached) {\n // User clicked link, use cache response\n event.detail.fetchRequest = cached;\n }\n\n prefetchCache.clear();\n }\n }\n\n prepareRequest(request) {\n const link = request.target;\n\n request.headers[\"X-Sec-Purpose\"] = \"prefetch\";\n\n const turboFrame = link.closest(\"turbo-frame\");\n const turboFrameTarget = link.getAttribute(\"data-turbo-frame\") || turboFrame?.getAttribute(\"target\") || turboFrame?.id;\n\n if (turboFrameTarget && turboFrameTarget !== \"_top\") {\n request.headers[\"Turbo-Frame\"] = turboFrameTarget;\n }\n }\n\n // Fetch request interface\n\n requestSucceededWithResponse() {}\n\n requestStarted(fetchRequest) {}\n\n requestErrored(fetchRequest) {}\n\n requestFinished(fetchRequest) {}\n\n requestPreventedHandlingResponse(fetchRequest, fetchResponse) {}\n\n requestFailedWithResponse(fetchRequest, fetchResponse) {}\n\n get #cacheTtl() {\n return Number(getMetaContent(\"turbo-prefetch-cache-time\")) || cacheTtl\n }\n\n #isPrefetchable(link) {\n const href = link.getAttribute(\"href\");\n\n if (!href) return false\n\n if (unfetchableLink(link)) return false\n if (linkToTheSamePage(link)) return false\n if (linkOptsOut(link)) return false\n if (nonSafeLink(link)) return false\n if (eventPrevented(link)) return false\n\n return true\n }\n}\n\nconst unfetchableLink = (link) => {\n return link.origin !== document.location.origin || ![\"http:\", \"https:\"].includes(link.protocol) || link.hasAttribute(\"target\")\n};\n\nconst linkToTheSamePage = (link) => {\n return (link.pathname + link.search === document.location.pathname + document.location.search) || link.href.startsWith(\"#\")\n};\n\nconst linkOptsOut = (link) => {\n if (link.getAttribute(\"data-turbo-prefetch\") === \"false\") return true\n if (link.getAttribute(\"data-turbo\") === \"false\") return true\n\n const turboPrefetchParent = findClosestRecursively(link, \"[data-turbo-prefetch]\");\n if (turboPrefetchParent && turboPrefetchParent.getAttribute(\"data-turbo-prefetch\") === \"false\") return true\n\n return false\n};\n\nconst nonSafeLink = (link) => {\n const turboMethod = link.getAttribute(\"data-turbo-method\");\n if (turboMethod && turboMethod.toLowerCase() !== \"get\") return true\n\n if (isUJS(link)) return true\n if (link.hasAttribute(\"data-turbo-confirm\")) return true\n if (link.hasAttribute(\"data-turbo-stream\")) return true\n\n return false\n};\n\nconst isUJS = (link) => {\n return link.hasAttribute(\"data-remote\") || link.hasAttribute(\"data-behavior\") || link.hasAttribute(\"data-confirm\") || link.hasAttribute(\"data-method\")\n};\n\nconst eventPrevented = (link) => {\n const event = dispatch(\"turbo:before-prefetch\", { target: link, cancelable: true });\n return event.defaultPrevented\n};\n\nclass Navigator {\n constructor(delegate) {\n this.delegate = delegate;\n }\n\n proposeVisit(location, options = {}) {\n if (this.delegate.allowsVisitingLocationWithAction(location, options.action)) {\n this.delegate.visitProposedToLocation(location, options);\n }\n }\n\n startVisit(locatable, restorationIdentifier, options = {}) {\n this.stop();\n this.currentVisit = new Visit(this, expandURL(locatable), restorationIdentifier, {\n referrer: this.location,\n ...options\n });\n this.currentVisit.start();\n }\n\n submitForm(form, submitter) {\n this.stop();\n this.formSubmission = new FormSubmission(this, form, submitter, true);\n\n this.formSubmission.start();\n }\n\n stop() {\n if (this.formSubmission) {\n this.formSubmission.stop();\n delete this.formSubmission;\n }\n\n if (this.currentVisit) {\n this.currentVisit.cancel();\n delete this.currentVisit;\n }\n }\n\n get adapter() {\n return this.delegate.adapter\n }\n\n get view() {\n return this.delegate.view\n }\n\n get rootLocation() {\n return this.view.snapshot.rootLocation\n }\n\n get history() {\n return this.delegate.history\n }\n\n // Form submission delegate\n\n formSubmissionStarted(formSubmission) {\n // Not all adapters implement formSubmissionStarted\n if (typeof this.adapter.formSubmissionStarted === \"function\") {\n this.adapter.formSubmissionStarted(formSubmission);\n }\n }\n\n async formSubmissionSucceededWithResponse(formSubmission, fetchResponse) {\n if (formSubmission == this.formSubmission) {\n const responseHTML = await fetchResponse.responseHTML;\n if (responseHTML) {\n const shouldCacheSnapshot = formSubmission.isSafe;\n if (!shouldCacheSnapshot) {\n this.view.clearSnapshotCache();\n }\n\n const { statusCode, redirected } = fetchResponse;\n const action = this.#getActionForFormSubmission(formSubmission, fetchResponse);\n const visitOptions = {\n action,\n shouldCacheSnapshot,\n response: { statusCode, responseHTML, redirected }\n };\n this.proposeVisit(fetchResponse.location, visitOptions);\n }\n }\n }\n\n async formSubmissionFailedWithResponse(formSubmission, fetchResponse) {\n const responseHTML = await fetchResponse.responseHTML;\n\n if (responseHTML) {\n const snapshot = PageSnapshot.fromHTMLString(responseHTML);\n if (fetchResponse.serverError) {\n await this.view.renderError(snapshot, this.currentVisit);\n } else {\n await this.view.renderPage(snapshot, false, true, this.currentVisit);\n }\n if(!snapshot.shouldPreserveScrollPosition) {\n this.view.scrollToTop();\n }\n this.view.clearSnapshotCache();\n }\n }\n\n formSubmissionErrored(formSubmission, error) {\n console.error(error);\n }\n\n formSubmissionFinished(formSubmission) {\n // Not all adapters implement formSubmissionFinished\n if (typeof this.adapter.formSubmissionFinished === \"function\") {\n this.adapter.formSubmissionFinished(formSubmission);\n }\n }\n\n // Link prefetching\n\n linkPrefetchingIsEnabledForLocation(location) {\n // Not all adapters implement linkPrefetchingIsEnabledForLocation\n if (typeof this.adapter.linkPrefetchingIsEnabledForLocation === \"function\") {\n return this.adapter.linkPrefetchingIsEnabledForLocation(location)\n }\n\n return true\n }\n\n // Visit delegate\n\n visitStarted(visit) {\n this.delegate.visitStarted(visit);\n }\n\n visitCompleted(visit) {\n this.delegate.visitCompleted(visit);\n delete this.currentVisit;\n }\n\n locationWithActionIsSamePage(location, action) {\n const anchor = getAnchor(location);\n const currentAnchor = getAnchor(this.view.lastRenderedLocation);\n const isRestorationToTop = action === \"restore\" && typeof anchor === \"undefined\";\n\n return (\n action !== \"replace\" &&\n getRequestURL(location) === getRequestURL(this.view.lastRenderedLocation) &&\n (isRestorationToTop || (anchor != null && anchor !== currentAnchor))\n )\n }\n\n visitScrolledToSamePageLocation(oldURL, newURL) {\n this.delegate.visitScrolledToSamePageLocation(oldURL, newURL);\n }\n\n // Visits\n\n get location() {\n return this.history.location\n }\n\n get restorationIdentifier() {\n return this.history.restorationIdentifier\n }\n\n #getActionForFormSubmission(formSubmission, fetchResponse) {\n const { submitter, formElement } = formSubmission;\n return getVisitAction(submitter, formElement) || this.#getDefaultAction(fetchResponse)\n }\n\n #getDefaultAction(fetchResponse) {\n const sameLocationRedirect = fetchResponse.redirected && fetchResponse.location.href === this.location?.href;\n return sameLocationRedirect ? \"replace\" : \"advance\"\n }\n}\n\nconst PageStage = {\n initial: 0,\n loading: 1,\n interactive: 2,\n complete: 3\n};\n\nclass PageObserver {\n stage = PageStage.initial\n started = false\n\n constructor(delegate) {\n this.delegate = delegate;\n }\n\n start() {\n if (!this.started) {\n if (this.stage == PageStage.initial) {\n this.stage = PageStage.loading;\n }\n document.addEventListener(\"readystatechange\", this.interpretReadyState, false);\n addEventListener(\"pagehide\", this.pageWillUnload, false);\n this.started = true;\n }\n }\n\n stop() {\n if (this.started) {\n document.removeEventListener(\"readystatechange\", this.interpretReadyState, false);\n removeEventListener(\"pagehide\", this.pageWillUnload, false);\n this.started = false;\n }\n }\n\n interpretReadyState = () => {\n const { readyState } = this;\n if (readyState == \"interactive\") {\n this.pageIsInteractive();\n } else if (readyState == \"complete\") {\n this.pageIsComplete();\n }\n }\n\n pageIsInteractive() {\n if (this.stage == PageStage.loading) {\n this.stage = PageStage.interactive;\n this.delegate.pageBecameInteractive();\n }\n }\n\n pageIsComplete() {\n this.pageIsInteractive();\n if (this.stage == PageStage.interactive) {\n this.stage = PageStage.complete;\n this.delegate.pageLoaded();\n }\n }\n\n pageWillUnload = () => {\n this.delegate.pageWillUnload();\n }\n\n get readyState() {\n return document.readyState\n }\n}\n\nclass ScrollObserver {\n started = false\n\n constructor(delegate) {\n this.delegate = delegate;\n }\n\n start() {\n if (!this.started) {\n addEventListener(\"scroll\", this.onScroll, false);\n this.onScroll();\n this.started = true;\n }\n }\n\n stop() {\n if (this.started) {\n removeEventListener(\"scroll\", this.onScroll, false);\n this.started = false;\n }\n }\n\n onScroll = () => {\n this.updatePosition({ x: window.pageXOffset, y: window.pageYOffset });\n }\n\n // Private\n\n updatePosition(position) {\n this.delegate.scrollPositionChanged(position);\n }\n}\n\nclass StreamMessageRenderer {\n render({ fragment }) {\n Bardo.preservingPermanentElements(this, getPermanentElementMapForFragment(fragment), () => {\n withAutofocusFromFragment(fragment, () => {\n withPreservedFocus(() => {\n document.documentElement.appendChild(fragment);\n });\n });\n });\n }\n\n // Bardo delegate\n\n enteringBardo(currentPermanentElement, newPermanentElement) {\n newPermanentElement.replaceWith(currentPermanentElement.cloneNode(true));\n }\n\n leavingBardo() {}\n}\n\nfunction getPermanentElementMapForFragment(fragment) {\n const permanentElementsInDocument = queryPermanentElementsAll(document.documentElement);\n const permanentElementMap = {};\n for (const permanentElementInDocument of permanentElementsInDocument) {\n const { id } = permanentElementInDocument;\n\n for (const streamElement of fragment.querySelectorAll(\"turbo-stream\")) {\n const elementInStream = getPermanentElementById(streamElement.templateElement.content, id);\n\n if (elementInStream) {\n permanentElementMap[id] = [permanentElementInDocument, elementInStream];\n }\n }\n }\n\n return permanentElementMap\n}\n\nasync function withAutofocusFromFragment(fragment, callback) {\n const generatedID = `turbo-stream-autofocus-${uuid()}`;\n const turboStreams = fragment.querySelectorAll(\"turbo-stream\");\n const elementWithAutofocus = firstAutofocusableElementInStreams(turboStreams);\n let willAutofocusId = null;\n\n if (elementWithAutofocus) {\n if (elementWithAutofocus.id) {\n willAutofocusId = elementWithAutofocus.id;\n } else {\n willAutofocusId = generatedID;\n }\n\n elementWithAutofocus.id = willAutofocusId;\n }\n\n callback();\n await nextRepaint();\n\n const hasNoActiveElement = document.activeElement == null || document.activeElement == document.body;\n\n if (hasNoActiveElement && willAutofocusId) {\n const elementToAutofocus = document.getElementById(willAutofocusId);\n\n if (elementIsFocusable(elementToAutofocus)) {\n elementToAutofocus.focus();\n }\n if (elementToAutofocus && elementToAutofocus.id == generatedID) {\n elementToAutofocus.removeAttribute(\"id\");\n }\n }\n}\n\nasync function withPreservedFocus(callback) {\n const [activeElementBeforeRender, activeElementAfterRender] = await around(callback, () => document.activeElement);\n\n const restoreFocusTo = activeElementBeforeRender && activeElementBeforeRender.id;\n\n if (restoreFocusTo) {\n const elementToFocus = document.getElementById(restoreFocusTo);\n\n if (elementIsFocusable(elementToFocus) && elementToFocus != activeElementAfterRender) {\n elementToFocus.focus();\n }\n }\n}\n\nfunction firstAutofocusableElementInStreams(nodeListOfStreamElements) {\n for (const streamElement of nodeListOfStreamElements) {\n const elementWithAutofocus = queryAutofocusableElement(streamElement.templateElement.content);\n\n if (elementWithAutofocus) return elementWithAutofocus\n }\n\n return null\n}\n\nclass StreamObserver {\n sources = new Set()\n #started = false\n\n constructor(delegate) {\n this.delegate = delegate;\n }\n\n start() {\n if (!this.#started) {\n this.#started = true;\n addEventListener(\"turbo:before-fetch-response\", this.inspectFetchResponse, false);\n }\n }\n\n stop() {\n if (this.#started) {\n this.#started = false;\n removeEventListener(\"turbo:before-fetch-response\", this.inspectFetchResponse, false);\n }\n }\n\n connectStreamSource(source) {\n if (!this.streamSourceIsConnected(source)) {\n this.sources.add(source);\n source.addEventListener(\"message\", this.receiveMessageEvent, false);\n }\n }\n\n disconnectStreamSource(source) {\n if (this.streamSourceIsConnected(source)) {\n this.sources.delete(source);\n source.removeEventListener(\"message\", this.receiveMessageEvent, false);\n }\n }\n\n streamSourceIsConnected(source) {\n return this.sources.has(source)\n }\n\n inspectFetchResponse = (event) => {\n const response = fetchResponseFromEvent(event);\n if (response && fetchResponseIsStream(response)) {\n event.preventDefault();\n this.receiveMessageResponse(response);\n }\n }\n\n receiveMessageEvent = (event) => {\n if (this.#started && typeof event.data == \"string\") {\n this.receiveMessageHTML(event.data);\n }\n }\n\n async receiveMessageResponse(response) {\n const html = await response.responseHTML;\n if (html) {\n this.receiveMessageHTML(html);\n }\n }\n\n receiveMessageHTML(html) {\n this.delegate.receivedMessageFromStream(StreamMessage.wrap(html));\n }\n}\n\nfunction fetchResponseFromEvent(event) {\n const fetchResponse = event.detail?.fetchResponse;\n if (fetchResponse instanceof FetchResponse) {\n return fetchResponse\n }\n}\n\nfunction fetchResponseIsStream(response) {\n const contentType = response.contentType ?? \"\";\n return contentType.startsWith(StreamMessage.contentType)\n}\n\nclass ErrorRenderer extends Renderer {\n static renderElement(currentElement, newElement) {\n const { documentElement, body } = document;\n\n documentElement.replaceChild(newElement, body);\n }\n\n async render() {\n this.replaceHeadAndBody();\n this.activateScriptElements();\n }\n\n replaceHeadAndBody() {\n const { documentElement, head } = document;\n documentElement.replaceChild(this.newHead, head);\n this.renderElement(this.currentElement, this.newElement);\n }\n\n activateScriptElements() {\n for (const replaceableElement of this.scriptElements) {\n const parentNode = replaceableElement.parentNode;\n if (parentNode) {\n const element = activateScriptElement(replaceableElement);\n parentNode.replaceChild(element, replaceableElement);\n }\n }\n }\n\n get newHead() {\n return this.newSnapshot.headSnapshot.element\n }\n\n get scriptElements() {\n return document.documentElement.querySelectorAll(\"script\")\n }\n}\n\nclass PageRenderer extends Renderer {\n static renderElement(currentElement, newElement) {\n if (document.body && newElement instanceof HTMLBodyElement) {\n document.body.replaceWith(newElement);\n } else {\n document.documentElement.appendChild(newElement);\n }\n }\n\n get shouldRender() {\n return this.newSnapshot.isVisitable && this.trackedElementsAreIdentical\n }\n\n get reloadReason() {\n if (!this.newSnapshot.isVisitable) {\n return {\n reason: \"turbo_visit_control_is_reload\"\n }\n }\n\n if (!this.trackedElementsAreIdentical) {\n return {\n reason: \"tracked_element_mismatch\"\n }\n }\n }\n\n async prepareToRender() {\n this.#setLanguage();\n await this.mergeHead();\n }\n\n async render() {\n if (this.willRender) {\n await this.replaceBody();\n }\n }\n\n finishRendering() {\n super.finishRendering();\n if (!this.isPreview) {\n this.focusFirstAutofocusableElement();\n }\n }\n\n get currentHeadSnapshot() {\n return this.currentSnapshot.headSnapshot\n }\n\n get newHeadSnapshot() {\n return this.newSnapshot.headSnapshot\n }\n\n get newElement() {\n return this.newSnapshot.element\n }\n\n #setLanguage() {\n const { documentElement } = this.currentSnapshot;\n const { lang } = this.newSnapshot;\n\n if (lang) {\n documentElement.setAttribute(\"lang\", lang);\n } else {\n documentElement.removeAttribute(\"lang\");\n }\n }\n\n async mergeHead() {\n const mergedHeadElements = this.mergeProvisionalElements();\n const newStylesheetElements = this.copyNewHeadStylesheetElements();\n this.copyNewHeadScriptElements();\n\n await mergedHeadElements;\n await newStylesheetElements;\n\n if (this.willRender) {\n this.removeUnusedDynamicStylesheetElements();\n }\n }\n\n async replaceBody() {\n await this.preservingPermanentElements(async () => {\n this.activateNewBody();\n await this.assignNewBody();\n });\n }\n\n get trackedElementsAreIdentical() {\n return this.currentHeadSnapshot.trackedElementSignature == this.newHeadSnapshot.trackedElementSignature\n }\n\n async copyNewHeadStylesheetElements() {\n const loadingElements = [];\n\n for (const element of this.newHeadStylesheetElements) {\n loadingElements.push(waitForLoad(element));\n\n document.head.appendChild(element);\n }\n\n await Promise.all(loadingElements);\n }\n\n copyNewHeadScriptElements() {\n for (const element of this.newHeadScriptElements) {\n document.head.appendChild(activateScriptElement(element));\n }\n }\n\n removeUnusedDynamicStylesheetElements() {\n for (const element of this.unusedDynamicStylesheetElements) {\n document.head.removeChild(element);\n }\n }\n\n async mergeProvisionalElements() {\n const newHeadElements = [...this.newHeadProvisionalElements];\n\n for (const element of this.currentHeadProvisionalElements) {\n if (!this.isCurrentElementInElementList(element, newHeadElements)) {\n document.head.removeChild(element);\n }\n }\n\n for (const element of newHeadElements) {\n document.head.appendChild(element);\n }\n }\n\n isCurrentElementInElementList(element, elementList) {\n for (const [index, newElement] of elementList.entries()) {\n // if title element...\n if (element.tagName == \"TITLE\") {\n if (newElement.tagName != \"TITLE\") {\n continue\n }\n if (element.innerHTML == newElement.innerHTML) {\n elementList.splice(index, 1);\n return true\n }\n }\n\n // if any other element...\n if (newElement.isEqualNode(element)) {\n elementList.splice(index, 1);\n return true\n }\n }\n\n return false\n }\n\n removeCurrentHeadProvisionalElements() {\n for (const element of this.currentHeadProvisionalElements) {\n document.head.removeChild(element);\n }\n }\n\n copyNewHeadProvisionalElements() {\n for (const element of this.newHeadProvisionalElements) {\n document.head.appendChild(element);\n }\n }\n\n activateNewBody() {\n document.adoptNode(this.newElement);\n this.activateNewBodyScriptElements();\n }\n\n activateNewBodyScriptElements() {\n for (const inertScriptElement of this.newBodyScriptElements) {\n const activatedScriptElement = activateScriptElement(inertScriptElement);\n inertScriptElement.replaceWith(activatedScriptElement);\n }\n }\n\n async assignNewBody() {\n await this.renderElement(this.currentElement, this.newElement);\n }\n\n get unusedDynamicStylesheetElements() {\n return this.oldHeadStylesheetElements.filter((element) => {\n return element.getAttribute(\"data-turbo-track\") === \"dynamic\"\n })\n }\n\n get oldHeadStylesheetElements() {\n return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)\n }\n\n get newHeadStylesheetElements() {\n return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)\n }\n\n get newHeadScriptElements() {\n return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)\n }\n\n get currentHeadProvisionalElements() {\n return this.currentHeadSnapshot.provisionalElements\n }\n\n get newHeadProvisionalElements() {\n return this.newHeadSnapshot.provisionalElements\n }\n\n get newBodyScriptElements() {\n return this.newElement.querySelectorAll(\"script\")\n }\n}\n\nclass MorphingPageRenderer extends PageRenderer {\n static renderElement(currentElement, newElement) {\n morphElements(currentElement, newElement, {\n callbacks: {\n beforeNodeMorphed: element => !canRefreshFrame(element)\n }\n });\n\n for (const frame of currentElement.querySelectorAll(\"turbo-frame\")) {\n if (canRefreshFrame(frame)) frame.reload();\n }\n\n dispatch(\"turbo:morph\", { detail: { currentElement, newElement } });\n }\n\n async preservingPermanentElements(callback) {\n return await callback()\n }\n\n get renderMethod() {\n return \"morph\"\n }\n\n get shouldAutofocus() {\n return false\n }\n}\n\nfunction canRefreshFrame(frame) {\n return frame instanceof FrameElement &&\n frame.src &&\n frame.refresh === \"morph\" &&\n !frame.closest(\"[data-turbo-permanent]\")\n}\n\nclass SnapshotCache {\n keys = []\n snapshots = {}\n\n constructor(size) {\n this.size = size;\n }\n\n has(location) {\n return toCacheKey(location) in this.snapshots\n }\n\n get(location) {\n if (this.has(location)) {\n const snapshot = this.read(location);\n this.touch(location);\n return snapshot\n }\n }\n\n put(location, snapshot) {\n this.write(location, snapshot);\n this.touch(location);\n return snapshot\n }\n\n clear() {\n this.snapshots = {};\n }\n\n // Private\n\n read(location) {\n return this.snapshots[toCacheKey(location)]\n }\n\n write(location, snapshot) {\n this.snapshots[toCacheKey(location)] = snapshot;\n }\n\n touch(location) {\n const key = toCacheKey(location);\n const index = this.keys.indexOf(key);\n if (index > -1) this.keys.splice(index, 1);\n this.keys.unshift(key);\n this.trim();\n }\n\n trim() {\n for (const key of this.keys.splice(this.size)) {\n delete this.snapshots[key];\n }\n }\n}\n\nclass PageView extends View {\n snapshotCache = new SnapshotCache(10)\n lastRenderedLocation = new URL(location.href)\n forceReloaded = false\n\n shouldTransitionTo(newSnapshot) {\n return this.snapshot.prefersViewTransitions && newSnapshot.prefersViewTransitions\n }\n\n renderPage(snapshot, isPreview = false, willRender = true, visit) {\n const shouldMorphPage = this.isPageRefresh(visit) && this.snapshot.shouldMorphPage;\n const rendererClass = shouldMorphPage ? MorphingPageRenderer : PageRenderer;\n\n const renderer = new rendererClass(this.snapshot, snapshot, isPreview, willRender);\n\n if (!renderer.shouldRender) {\n this.forceReloaded = true;\n } else {\n visit?.changeHistory();\n }\n\n return this.render(renderer)\n }\n\n renderError(snapshot, visit) {\n visit?.changeHistory();\n const renderer = new ErrorRenderer(this.snapshot, snapshot, false);\n return this.render(renderer)\n }\n\n clearSnapshotCache() {\n this.snapshotCache.clear();\n }\n\n async cacheSnapshot(snapshot = this.snapshot) {\n if (snapshot.isCacheable) {\n this.delegate.viewWillCacheSnapshot();\n const { lastRenderedLocation: location } = this;\n await nextEventLoopTick();\n const cachedSnapshot = snapshot.clone();\n this.snapshotCache.put(location, cachedSnapshot);\n return cachedSnapshot\n }\n }\n\n getCachedSnapshotForLocation(location) {\n return this.snapshotCache.get(location)\n }\n\n isPageRefresh(visit) {\n return !visit || (this.lastRenderedLocation.pathname === visit.location.pathname && visit.action === \"replace\")\n }\n\n shouldPreserveScrollPosition(visit) {\n return this.isPageRefresh(visit) && this.snapshot.shouldPreserveScrollPosition\n }\n\n get snapshot() {\n return PageSnapshot.fromElement(this.element)\n }\n}\n\nclass Preloader {\n selector = \"a[data-turbo-preload]\"\n\n constructor(delegate, snapshotCache) {\n this.delegate = delegate;\n this.snapshotCache = snapshotCache;\n }\n\n start() {\n if (document.readyState === \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", this.#preloadAll);\n } else {\n this.preloadOnLoadLinksForView(document.body);\n }\n }\n\n stop() {\n document.removeEventListener(\"DOMContentLoaded\", this.#preloadAll);\n }\n\n preloadOnLoadLinksForView(element) {\n for (const link of element.querySelectorAll(this.selector)) {\n if (this.delegate.shouldPreloadLink(link)) {\n this.preloadURL(link);\n }\n }\n }\n\n async preloadURL(link) {\n const location = new URL(link.href);\n\n if (this.snapshotCache.has(location)) {\n return\n }\n\n const fetchRequest = new FetchRequest(this, FetchMethod.get, location, new URLSearchParams(), link);\n await fetchRequest.perform();\n }\n\n // Fetch request delegate\n\n prepareRequest(fetchRequest) {\n fetchRequest.headers[\"X-Sec-Purpose\"] = \"prefetch\";\n }\n\n async requestSucceededWithResponse(fetchRequest, fetchResponse) {\n try {\n const responseHTML = await fetchResponse.responseHTML;\n const snapshot = PageSnapshot.fromHTMLString(responseHTML);\n\n this.snapshotCache.put(fetchRequest.url, snapshot);\n } catch (_) {\n // If we cannot preload that is ok!\n }\n }\n\n requestStarted(fetchRequest) {}\n\n requestErrored(fetchRequest) {}\n\n requestFinished(fetchRequest) {}\n\n requestPreventedHandlingResponse(fetchRequest, fetchResponse) {}\n\n requestFailedWithResponse(fetchRequest, fetchResponse) {}\n\n #preloadAll = () => {\n this.preloadOnLoadLinksForView(document.body);\n }\n}\n\nclass Cache {\n constructor(session) {\n this.session = session;\n }\n\n clear() {\n this.session.clearCache();\n }\n\n resetCacheControl() {\n this.#setCacheControl(\"\");\n }\n\n exemptPageFromCache() {\n this.#setCacheControl(\"no-cache\");\n }\n\n exemptPageFromPreview() {\n this.#setCacheControl(\"no-preview\");\n }\n\n #setCacheControl(value) {\n setMetaContent(\"turbo-cache-control\", value);\n }\n}\n\nclass Session {\n navigator = new Navigator(this)\n history = new History(this)\n view = new PageView(this, document.documentElement)\n adapter = new BrowserAdapter(this)\n\n pageObserver = new PageObserver(this)\n cacheObserver = new CacheObserver()\n linkPrefetchObserver = new LinkPrefetchObserver(this, document)\n linkClickObserver = new LinkClickObserver(this, window)\n formSubmitObserver = new FormSubmitObserver(this, document)\n scrollObserver = new ScrollObserver(this)\n streamObserver = new StreamObserver(this)\n formLinkClickObserver = new FormLinkClickObserver(this, document.documentElement)\n frameRedirector = new FrameRedirector(this, document.documentElement)\n streamMessageRenderer = new StreamMessageRenderer()\n cache = new Cache(this)\n\n enabled = true\n started = false\n #pageRefreshDebouncePeriod = 150\n\n constructor(recentRequests) {\n this.recentRequests = recentRequests;\n this.preloader = new Preloader(this, this.view.snapshotCache);\n this.debouncedRefresh = this.refresh;\n this.pageRefreshDebouncePeriod = this.pageRefreshDebouncePeriod;\n }\n\n start() {\n if (!this.started) {\n this.pageObserver.start();\n this.cacheObserver.start();\n this.linkPrefetchObserver.start();\n this.formLinkClickObserver.start();\n this.linkClickObserver.start();\n this.formSubmitObserver.start();\n this.scrollObserver.start();\n this.streamObserver.start();\n this.frameRedirector.start();\n this.history.start();\n this.preloader.start();\n this.started = true;\n this.enabled = true;\n }\n }\n\n disable() {\n this.enabled = false;\n }\n\n stop() {\n if (this.started) {\n this.pageObserver.stop();\n this.cacheObserver.stop();\n this.linkPrefetchObserver.stop();\n this.formLinkClickObserver.stop();\n this.linkClickObserver.stop();\n this.formSubmitObserver.stop();\n this.scrollObserver.stop();\n this.streamObserver.stop();\n this.frameRedirector.stop();\n this.history.stop();\n this.preloader.stop();\n this.started = false;\n }\n }\n\n registerAdapter(adapter) {\n this.adapter = adapter;\n }\n\n visit(location, options = {}) {\n const frameElement = options.frame ? document.getElementById(options.frame) : null;\n\n if (frameElement instanceof FrameElement) {\n const action = options.action || getVisitAction(frameElement);\n\n frameElement.delegate.proposeVisitIfNavigatedWithAction(frameElement, action);\n frameElement.src = location.toString();\n } else {\n this.navigator.proposeVisit(expandURL(location), options);\n }\n }\n\n refresh(url, requestId) {\n const isRecentRequest = requestId && this.recentRequests.has(requestId);\n const isCurrentUrl = url === document.baseURI;\n if (!isRecentRequest && !this.navigator.currentVisit && isCurrentUrl) {\n this.visit(url, { action: \"replace\", shouldCacheSnapshot: false });\n }\n }\n\n connectStreamSource(source) {\n this.streamObserver.connectStreamSource(source);\n }\n\n disconnectStreamSource(source) {\n this.streamObserver.disconnectStreamSource(source);\n }\n\n renderStreamMessage(message) {\n this.streamMessageRenderer.render(StreamMessage.wrap(message));\n }\n\n clearCache() {\n this.view.clearSnapshotCache();\n }\n\n setProgressBarDelay(delay) {\n console.warn(\n \"Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`\"\n );\n\n this.progressBarDelay = delay;\n }\n\n set progressBarDelay(delay) {\n config.drive.progressBarDelay = delay;\n }\n\n get progressBarDelay() {\n return config.drive.progressBarDelay\n }\n\n set drive(value) {\n config.drive.enabled = value;\n }\n\n get drive() {\n return config.drive.enabled\n }\n\n set formMode(value) {\n config.forms.mode = value;\n }\n\n get formMode() {\n return config.forms.mode\n }\n\n get location() {\n return this.history.location\n }\n\n get restorationIdentifier() {\n return this.history.restorationIdentifier\n }\n\n get pageRefreshDebouncePeriod() {\n return this.#pageRefreshDebouncePeriod\n }\n\n set pageRefreshDebouncePeriod(value) {\n this.refresh = debounce(this.debouncedRefresh.bind(this), value);\n this.#pageRefreshDebouncePeriod = value;\n }\n\n // Preloader delegate\n\n shouldPreloadLink(element) {\n const isUnsafe = element.hasAttribute(\"data-turbo-method\");\n const isStream = element.hasAttribute(\"data-turbo-stream\");\n const frameTarget = element.getAttribute(\"data-turbo-frame\");\n const frame = frameTarget == \"_top\" ?\n null :\n document.getElementById(frameTarget) || findClosestRecursively(element, \"turbo-frame:not([disabled])\");\n\n if (isUnsafe || isStream || frame instanceof FrameElement) {\n return false\n } else {\n const location = new URL(element.href);\n\n return this.elementIsNavigatable(element) && locationIsVisitable(location, this.snapshot.rootLocation)\n }\n }\n\n // History delegate\n\n historyPoppedToLocationWithRestorationIdentifierAndDirection(location, restorationIdentifier, direction) {\n if (this.enabled) {\n this.navigator.startVisit(location, restorationIdentifier, {\n action: \"restore\",\n historyChanged: true,\n direction\n });\n } else {\n this.adapter.pageInvalidated({\n reason: \"turbo_disabled\"\n });\n }\n }\n\n // Scroll observer delegate\n\n scrollPositionChanged(position) {\n this.history.updateRestorationData({ scrollPosition: position });\n }\n\n // Form click observer delegate\n\n willSubmitFormLinkToLocation(link, location) {\n return this.elementIsNavigatable(link) && locationIsVisitable(location, this.snapshot.rootLocation)\n }\n\n submittedFormLinkToLocation() {}\n\n // Link hover observer delegate\n\n canPrefetchRequestToLocation(link, location) {\n return (\n this.elementIsNavigatable(link) &&\n locationIsVisitable(location, this.snapshot.rootLocation) &&\n this.navigator.linkPrefetchingIsEnabledForLocation(location)\n )\n }\n\n // Link click observer delegate\n\n willFollowLinkToLocation(link, location, event) {\n return (\n this.elementIsNavigatable(link) &&\n locationIsVisitable(location, this.snapshot.rootLocation) &&\n this.applicationAllowsFollowingLinkToLocation(link, location, event)\n )\n }\n\n followedLinkToLocation(link, location) {\n const action = this.getActionForLink(link);\n const acceptsStreamResponse = link.hasAttribute(\"data-turbo-stream\");\n\n this.visit(location.href, { action, acceptsStreamResponse });\n }\n\n // Navigator delegate\n\n allowsVisitingLocationWithAction(location, action) {\n return this.locationWithActionIsSamePage(location, action) || this.applicationAllowsVisitingLocation(location)\n }\n\n visitProposedToLocation(location, options) {\n extendURLWithDeprecatedProperties(location);\n this.adapter.visitProposedToLocation(location, options);\n }\n\n // Visit delegate\n\n visitStarted(visit) {\n if (!visit.acceptsStreamResponse) {\n markAsBusy(document.documentElement);\n this.view.markVisitDirection(visit.direction);\n }\n extendURLWithDeprecatedProperties(visit.location);\n if (!visit.silent) {\n this.notifyApplicationAfterVisitingLocation(visit.location, visit.action);\n }\n }\n\n visitCompleted(visit) {\n this.view.unmarkVisitDirection();\n clearBusyState(document.documentElement);\n this.notifyApplicationAfterPageLoad(visit.getTimingMetrics());\n }\n\n locationWithActionIsSamePage(location, action) {\n return this.navigator.locationWithActionIsSamePage(location, action)\n }\n\n visitScrolledToSamePageLocation(oldURL, newURL) {\n this.notifyApplicationAfterVisitingSamePageLocation(oldURL, newURL);\n }\n\n // Form submit observer delegate\n\n willSubmitForm(form, submitter) {\n const action = getAction$1(form, submitter);\n\n return (\n this.submissionIsNavigatable(form, submitter) &&\n locationIsVisitable(expandURL(action), this.snapshot.rootLocation)\n )\n }\n\n formSubmitted(form, submitter) {\n this.navigator.submitForm(form, submitter);\n }\n\n // Page observer delegate\n\n pageBecameInteractive() {\n this.view.lastRenderedLocation = this.location;\n this.notifyApplicationAfterPageLoad();\n }\n\n pageLoaded() {\n this.history.assumeControlOfScrollRestoration();\n }\n\n pageWillUnload() {\n this.history.relinquishControlOfScrollRestoration();\n }\n\n // Stream observer delegate\n\n receivedMessageFromStream(message) {\n this.renderStreamMessage(message);\n }\n\n // Page view delegate\n\n viewWillCacheSnapshot() {\n if (!this.navigator.currentVisit?.silent) {\n this.notifyApplicationBeforeCachingSnapshot();\n }\n }\n\n allowsImmediateRender({ element }, options) {\n const event = this.notifyApplicationBeforeRender(element, options);\n const {\n defaultPrevented,\n detail: { render }\n } = event;\n\n if (this.view.renderer && render) {\n this.view.renderer.renderElement = render;\n }\n\n return !defaultPrevented\n }\n\n viewRenderedSnapshot(_snapshot, _isPreview, renderMethod) {\n this.view.lastRenderedLocation = this.history.location;\n this.notifyApplicationAfterRender(renderMethod);\n }\n\n preloadOnLoadLinksForView(element) {\n this.preloader.preloadOnLoadLinksForView(element);\n }\n\n viewInvalidated(reason) {\n this.adapter.pageInvalidated(reason);\n }\n\n // Frame element\n\n frameLoaded(frame) {\n this.notifyApplicationAfterFrameLoad(frame);\n }\n\n frameRendered(fetchResponse, frame) {\n this.notifyApplicationAfterFrameRender(fetchResponse, frame);\n }\n\n // Application events\n\n applicationAllowsFollowingLinkToLocation(link, location, ev) {\n const event = this.notifyApplicationAfterClickingLinkToLocation(link, location, ev);\n return !event.defaultPrevented\n }\n\n applicationAllowsVisitingLocation(location) {\n const event = this.notifyApplicationBeforeVisitingLocation(location);\n return !event.defaultPrevented\n }\n\n notifyApplicationAfterClickingLinkToLocation(link, location, event) {\n return dispatch(\"turbo:click\", {\n target: link,\n detail: { url: location.href, originalEvent: event },\n cancelable: true\n })\n }\n\n notifyApplicationBeforeVisitingLocation(location) {\n return dispatch(\"turbo:before-visit\", {\n detail: { url: location.href },\n cancelable: true\n })\n }\n\n notifyApplicationAfterVisitingLocation(location, action) {\n return dispatch(\"turbo:visit\", { detail: { url: location.href, action } })\n }\n\n notifyApplicationBeforeCachingSnapshot() {\n return dispatch(\"turbo:before-cache\")\n }\n\n notifyApplicationBeforeRender(newBody, options) {\n return dispatch(\"turbo:before-render\", {\n detail: { newBody, ...options },\n cancelable: true\n })\n }\n\n notifyApplicationAfterRender(renderMethod) {\n return dispatch(\"turbo:render\", { detail: { renderMethod } })\n }\n\n notifyApplicationAfterPageLoad(timing = {}) {\n return dispatch(\"turbo:load\", {\n detail: { url: this.location.href, timing }\n })\n }\n\n notifyApplicationAfterVisitingSamePageLocation(oldURL, newURL) {\n dispatchEvent(\n new HashChangeEvent(\"hashchange\", {\n oldURL: oldURL.toString(),\n newURL: newURL.toString()\n })\n );\n }\n\n notifyApplicationAfterFrameLoad(frame) {\n return dispatch(\"turbo:frame-load\", { target: frame })\n }\n\n notifyApplicationAfterFrameRender(fetchResponse, frame) {\n return dispatch(\"turbo:frame-render\", {\n detail: { fetchResponse },\n target: frame,\n cancelable: true\n })\n }\n\n // Helpers\n\n submissionIsNavigatable(form, submitter) {\n if (config.forms.mode == \"off\") {\n return false\n } else {\n const submitterIsNavigatable = submitter ? this.elementIsNavigatable(submitter) : true;\n\n if (config.forms.mode == \"optin\") {\n return submitterIsNavigatable && form.closest('[data-turbo=\"true\"]') != null\n } else {\n return submitterIsNavigatable && this.elementIsNavigatable(form)\n }\n }\n }\n\n elementIsNavigatable(element) {\n const container = findClosestRecursively(element, \"[data-turbo]\");\n const withinFrame = findClosestRecursively(element, \"turbo-frame\");\n\n // Check if Drive is enabled on the session or we're within a Frame.\n if (config.drive.enabled || withinFrame) {\n // Element is navigatable by default, unless `data-turbo=\"false\"`.\n if (container) {\n return container.getAttribute(\"data-turbo\") != \"false\"\n } else {\n return true\n }\n } else {\n // Element isn't navigatable by default, unless `data-turbo=\"true\"`.\n if (container) {\n return container.getAttribute(\"data-turbo\") == \"true\"\n } else {\n return false\n }\n }\n }\n\n // Private\n\n getActionForLink(link) {\n return getVisitAction(link) || \"advance\"\n }\n\n get snapshot() {\n return this.view.snapshot\n }\n}\n\n// Older versions of the Turbo Native adapters referenced the\n// `Location#absoluteURL` property in their implementations of\n// the `Adapter#visitProposedToLocation()` and `#visitStarted()`\n// methods. The Location class has since been removed in favor\n// of the DOM URL API, and accordingly all Adapter methods now\n// receive URL objects.\n//\n// We alias #absoluteURL to #toString() here to avoid crashing\n// older adapters which do not expect URL objects. We should\n// consider removing this support at some point in the future.\n\nfunction extendURLWithDeprecatedProperties(url) {\n Object.defineProperties(url, deprecatedLocationPropertyDescriptors);\n}\n\nconst deprecatedLocationPropertyDescriptors = {\n absoluteURL: {\n get() {\n return this.toString()\n }\n }\n};\n\nconst session = new Session(recentRequests);\nconst { cache, navigator: navigator$1 } = session;\n\n/**\n * Starts the main session.\n * This initialises any necessary observers such as those to monitor\n * link interactions.\n */\nfunction start() {\n session.start();\n}\n\n/**\n * Registers an adapter for the main session.\n *\n * @param adapter Adapter to register\n */\nfunction registerAdapter(adapter) {\n session.registerAdapter(adapter);\n}\n\n/**\n * Performs an application visit to the given location.\n *\n * @param location Location to visit (a URL or path)\n * @param options Options to apply\n * @param options.action Type of history navigation to apply (\"restore\",\n * \"replace\" or \"advance\")\n * @param options.historyChanged Specifies whether the browser history has\n * already been changed for this visit or not\n * @param options.referrer Specifies the referrer of this visit such that\n * navigations to the same page will not result in a new history entry.\n * @param options.snapshotHTML Cached snapshot to render\n * @param options.response Response of the specified location\n */\nfunction visit(location, options) {\n session.visit(location, options);\n}\n\n/**\n * Connects a stream source to the main session.\n *\n * @param source Stream source to connect\n */\nfunction connectStreamSource(source) {\n session.connectStreamSource(source);\n}\n\n/**\n * Disconnects a stream source from the main session.\n *\n * @param source Stream source to disconnect\n */\nfunction disconnectStreamSource(source) {\n session.disconnectStreamSource(source);\n}\n\n/**\n * Renders a stream message to the main session by appending it to the\n * current document.\n *\n * @param message Message to render\n */\nfunction renderStreamMessage(message) {\n session.renderStreamMessage(message);\n}\n\n/**\n * Removes all entries from the Turbo Drive page cache.\n * Call this when state has changed on the server that may affect cached pages.\n *\n * @deprecated since version 7.2.0 in favor of `Turbo.cache.clear()`\n */\nfunction clearCache() {\n console.warn(\n \"Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`\"\n );\n session.clearCache();\n}\n\n/**\n * Sets the delay after which the progress bar will appear during navigation.\n *\n * The progress bar appears after 500ms by default.\n *\n * Note that this method has no effect when used with the iOS or Android\n * adapters.\n *\n * @param delay Time to delay in milliseconds\n */\nfunction setProgressBarDelay(delay) {\n console.warn(\n \"Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`\"\n );\n config.drive.progressBarDelay = delay;\n}\n\nfunction setConfirmMethod(confirmMethod) {\n console.warn(\n \"Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`\"\n );\n config.forms.confirm = confirmMethod;\n}\n\nfunction setFormMode(mode) {\n console.warn(\n \"Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`\"\n );\n config.forms.mode = mode;\n}\n\nvar Turbo = /*#__PURE__*/Object.freeze({\n __proto__: null,\n navigator: navigator$1,\n session: session,\n cache: cache,\n PageRenderer: PageRenderer,\n PageSnapshot: PageSnapshot,\n FrameRenderer: FrameRenderer,\n fetch: fetchWithTurboHeaders,\n config: config,\n start: start,\n registerAdapter: registerAdapter,\n visit: visit,\n connectStreamSource: connectStreamSource,\n disconnectStreamSource: disconnectStreamSource,\n renderStreamMessage: renderStreamMessage,\n clearCache: clearCache,\n setProgressBarDelay: setProgressBarDelay,\n setConfirmMethod: setConfirmMethod,\n setFormMode: setFormMode\n});\n\nclass TurboFrameMissingError extends Error {}\n\nclass FrameController {\n fetchResponseLoaded = (_fetchResponse) => Promise.resolve()\n #currentFetchRequest = null\n #resolveVisitPromise = () => {}\n #connected = false\n #hasBeenLoaded = false\n #ignoredAttributes = new Set()\n #shouldMorphFrame = false\n action = null\n\n constructor(element) {\n this.element = element;\n this.view = new FrameView(this, this.element);\n this.appearanceObserver = new AppearanceObserver(this, this.element);\n this.formLinkClickObserver = new FormLinkClickObserver(this, this.element);\n this.linkInterceptor = new LinkInterceptor(this, this.element);\n this.restorationIdentifier = uuid();\n this.formSubmitObserver = new FormSubmitObserver(this, this.element);\n }\n\n // Frame delegate\n\n connect() {\n if (!this.#connected) {\n this.#connected = true;\n if (this.loadingStyle == FrameLoadingStyle.lazy) {\n this.appearanceObserver.start();\n } else {\n this.#loadSourceURL();\n }\n this.formLinkClickObserver.start();\n this.linkInterceptor.start();\n this.formSubmitObserver.start();\n }\n }\n\n disconnect() {\n if (this.#connected) {\n this.#connected = false;\n this.appearanceObserver.stop();\n this.formLinkClickObserver.stop();\n this.linkInterceptor.stop();\n this.formSubmitObserver.stop();\n }\n }\n\n disabledChanged() {\n if (this.loadingStyle == FrameLoadingStyle.eager) {\n this.#loadSourceURL();\n }\n }\n\n sourceURLChanged() {\n if (this.#isIgnoringChangesTo(\"src\")) return\n\n if (this.element.isConnected) {\n this.complete = false;\n }\n\n if (this.loadingStyle == FrameLoadingStyle.eager || this.#hasBeenLoaded) {\n this.#loadSourceURL();\n }\n }\n\n sourceURLReloaded() {\n const { refresh, src } = this.element;\n\n this.#shouldMorphFrame = src && refresh === \"morph\";\n\n this.element.removeAttribute(\"complete\");\n this.element.src = null;\n this.element.src = src;\n return this.element.loaded\n }\n\n loadingStyleChanged() {\n if (this.loadingStyle == FrameLoadingStyle.lazy) {\n this.appearanceObserver.start();\n } else {\n this.appearanceObserver.stop();\n this.#loadSourceURL();\n }\n }\n\n async #loadSourceURL() {\n if (this.enabled && this.isActive && !this.complete && this.sourceURL) {\n this.element.loaded = this.#visit(expandURL(this.sourceURL));\n this.appearanceObserver.stop();\n await this.element.loaded;\n this.#hasBeenLoaded = true;\n }\n }\n\n async loadResponse(fetchResponse) {\n if (fetchResponse.redirected || (fetchResponse.succeeded && fetchResponse.isHTML)) {\n this.sourceURL = fetchResponse.response.url;\n }\n\n try {\n const html = await fetchResponse.responseHTML;\n if (html) {\n const document = parseHTMLDocument(html);\n const pageSnapshot = PageSnapshot.fromDocument(document);\n\n if (pageSnapshot.isVisitable) {\n await this.#loadFrameResponse(fetchResponse, document);\n } else {\n await this.#handleUnvisitableFrameResponse(fetchResponse);\n }\n }\n } finally {\n this.#shouldMorphFrame = false;\n this.fetchResponseLoaded = () => Promise.resolve();\n }\n }\n\n // Appearance observer delegate\n\n elementAppearedInViewport(element) {\n this.proposeVisitIfNavigatedWithAction(element, getVisitAction(element));\n this.#loadSourceURL();\n }\n\n // Form link click observer delegate\n\n willSubmitFormLinkToLocation(link) {\n return this.#shouldInterceptNavigation(link)\n }\n\n submittedFormLinkToLocation(link, _location, form) {\n const frame = this.#findFrameElement(link);\n if (frame) form.setAttribute(\"data-turbo-frame\", frame.id);\n }\n\n // Link interceptor delegate\n\n shouldInterceptLinkClick(element, _location, _event) {\n return this.#shouldInterceptNavigation(element)\n }\n\n linkClickIntercepted(element, location) {\n this.#navigateFrame(element, location);\n }\n\n // Form submit observer delegate\n\n willSubmitForm(element, submitter) {\n return element.closest(\"turbo-frame\") == this.element && this.#shouldInterceptNavigation(element, submitter)\n }\n\n formSubmitted(element, submitter) {\n if (this.formSubmission) {\n this.formSubmission.stop();\n }\n\n this.formSubmission = new FormSubmission(this, element, submitter);\n const { fetchRequest } = this.formSubmission;\n this.prepareRequest(fetchRequest);\n this.formSubmission.start();\n }\n\n // Fetch request delegate\n\n prepareRequest(request) {\n request.headers[\"Turbo-Frame\"] = this.id;\n\n if (this.currentNavigationElement?.hasAttribute(\"data-turbo-stream\")) {\n request.acceptResponseType(StreamMessage.contentType);\n }\n }\n\n requestStarted(_request) {\n markAsBusy(this.element);\n }\n\n requestPreventedHandlingResponse(_request, _response) {\n this.#resolveVisitPromise();\n }\n\n async requestSucceededWithResponse(request, response) {\n await this.loadResponse(response);\n this.#resolveVisitPromise();\n }\n\n async requestFailedWithResponse(request, response) {\n await this.loadResponse(response);\n this.#resolveVisitPromise();\n }\n\n requestErrored(request, error) {\n console.error(error);\n this.#resolveVisitPromise();\n }\n\n requestFinished(_request) {\n clearBusyState(this.element);\n }\n\n // Form submission delegate\n\n formSubmissionStarted({ formElement }) {\n markAsBusy(formElement, this.#findFrameElement(formElement));\n }\n\n formSubmissionSucceededWithResponse(formSubmission, response) {\n const frame = this.#findFrameElement(formSubmission.formElement, formSubmission.submitter);\n\n frame.delegate.proposeVisitIfNavigatedWithAction(frame, getVisitAction(formSubmission.submitter, formSubmission.formElement, frame));\n frame.delegate.loadResponse(response);\n\n if (!formSubmission.isSafe) {\n session.clearCache();\n }\n }\n\n formSubmissionFailedWithResponse(formSubmission, fetchResponse) {\n this.element.delegate.loadResponse(fetchResponse);\n session.clearCache();\n }\n\n formSubmissionErrored(formSubmission, error) {\n console.error(error);\n }\n\n formSubmissionFinished({ formElement }) {\n clearBusyState(formElement, this.#findFrameElement(formElement));\n }\n\n // View delegate\n\n allowsImmediateRender({ element: newFrame }, options) {\n const event = dispatch(\"turbo:before-frame-render\", {\n target: this.element,\n detail: { newFrame, ...options },\n cancelable: true\n });\n\n const {\n defaultPrevented,\n detail: { render }\n } = event;\n\n if (this.view.renderer && render) {\n this.view.renderer.renderElement = render;\n }\n\n return !defaultPrevented\n }\n\n viewRenderedSnapshot(_snapshot, _isPreview, _renderMethod) {}\n\n preloadOnLoadLinksForView(element) {\n session.preloadOnLoadLinksForView(element);\n }\n\n viewInvalidated() {}\n\n // Frame renderer delegate\n\n willRenderFrame(currentElement, _newElement) {\n this.previousFrameElement = currentElement.cloneNode(true);\n }\n\n visitCachedSnapshot = ({ element }) => {\n const frame = element.querySelector(\"#\" + this.element.id);\n\n if (frame && this.previousFrameElement) {\n frame.replaceChildren(...this.previousFrameElement.children);\n }\n\n delete this.previousFrameElement;\n }\n\n // Private\n\n async #loadFrameResponse(fetchResponse, document) {\n const newFrameElement = await this.extractForeignFrameElement(document.body);\n const rendererClass = this.#shouldMorphFrame ? MorphingFrameRenderer : FrameRenderer;\n\n if (newFrameElement) {\n const snapshot = new Snapshot(newFrameElement);\n const renderer = new rendererClass(this, this.view.snapshot, snapshot, false, false);\n if (this.view.renderPromise) await this.view.renderPromise;\n this.changeHistory();\n\n await this.view.render(renderer);\n this.complete = true;\n session.frameRendered(fetchResponse, this.element);\n session.frameLoaded(this.element);\n await this.fetchResponseLoaded(fetchResponse);\n } else if (this.#willHandleFrameMissingFromResponse(fetchResponse)) {\n this.#handleFrameMissingFromResponse(fetchResponse);\n }\n }\n\n async #visit(url) {\n const request = new FetchRequest(this, FetchMethod.get, url, new URLSearchParams(), this.element);\n\n this.#currentFetchRequest?.cancel();\n this.#currentFetchRequest = request;\n\n return new Promise((resolve) => {\n this.#resolveVisitPromise = () => {\n this.#resolveVisitPromise = () => {};\n this.#currentFetchRequest = null;\n resolve();\n };\n request.perform();\n })\n }\n\n #navigateFrame(element, url, submitter) {\n const frame = this.#findFrameElement(element, submitter);\n\n frame.delegate.proposeVisitIfNavigatedWithAction(frame, getVisitAction(submitter, element, frame));\n\n this.#withCurrentNavigationElement(element, () => {\n frame.src = url;\n });\n }\n\n proposeVisitIfNavigatedWithAction(frame, action = null) {\n this.action = action;\n\n if (this.action) {\n const pageSnapshot = PageSnapshot.fromElement(frame).clone();\n const { visitCachedSnapshot } = frame.delegate;\n\n frame.delegate.fetchResponseLoaded = async (fetchResponse) => {\n if (frame.src) {\n const { statusCode, redirected } = fetchResponse;\n const responseHTML = await fetchResponse.responseHTML;\n const response = { statusCode, redirected, responseHTML };\n const options = {\n response,\n visitCachedSnapshot,\n willRender: false,\n updateHistory: false,\n restorationIdentifier: this.restorationIdentifier,\n snapshot: pageSnapshot\n };\n\n if (this.action) options.action = this.action;\n\n session.visit(frame.src, options);\n }\n };\n }\n }\n\n changeHistory() {\n if (this.action) {\n const method = getHistoryMethodForAction(this.action);\n session.history.update(method, expandURL(this.element.src || \"\"), this.restorationIdentifier);\n }\n }\n\n async #handleUnvisitableFrameResponse(fetchResponse) {\n console.warn(\n `The response (${fetchResponse.statusCode}) from is performing a full page visit due to turbo-visit-control.`\n );\n\n await this.#visitResponse(fetchResponse.response);\n }\n\n #willHandleFrameMissingFromResponse(fetchResponse) {\n this.element.setAttribute(\"complete\", \"\");\n\n const response = fetchResponse.response;\n const visit = async (url, options) => {\n if (url instanceof Response) {\n this.#visitResponse(url);\n } else {\n session.visit(url, options);\n }\n };\n\n const event = dispatch(\"turbo:frame-missing\", {\n target: this.element,\n detail: { response, visit },\n cancelable: true\n });\n\n return !event.defaultPrevented\n }\n\n #handleFrameMissingFromResponse(fetchResponse) {\n this.view.missing();\n this.#throwFrameMissingError(fetchResponse);\n }\n\n #throwFrameMissingError(fetchResponse) {\n const message = `The response (${fetchResponse.statusCode}) did not contain the expected and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;\n throw new TurboFrameMissingError(message)\n }\n\n async #visitResponse(response) {\n const wrapped = new FetchResponse(response);\n const responseHTML = await wrapped.responseHTML;\n const { location, redirected, statusCode } = wrapped;\n\n return session.visit(location, { response: { redirected, statusCode, responseHTML } })\n }\n\n #findFrameElement(element, submitter) {\n const id = getAttribute(\"data-turbo-frame\", submitter, element) || this.element.getAttribute(\"target\");\n return getFrameElementById(id) ?? this.element\n }\n\n async extractForeignFrameElement(container) {\n let element;\n const id = CSS.escape(this.id);\n\n try {\n element = activateElement(container.querySelector(`turbo-frame#${id}`), this.sourceURL);\n if (element) {\n return element\n }\n\n element = activateElement(container.querySelector(`turbo-frame[src][recurse~=${id}]`), this.sourceURL);\n if (element) {\n await element.loaded;\n return await this.extractForeignFrameElement(element)\n }\n } catch (error) {\n console.error(error);\n return new FrameElement()\n }\n\n return null\n }\n\n #formActionIsVisitable(form, submitter) {\n const action = getAction$1(form, submitter);\n\n return locationIsVisitable(expandURL(action), this.rootLocation)\n }\n\n #shouldInterceptNavigation(element, submitter) {\n const id = getAttribute(\"data-turbo-frame\", submitter, element) || this.element.getAttribute(\"target\");\n\n if (element instanceof HTMLFormElement && !this.#formActionIsVisitable(element, submitter)) {\n return false\n }\n\n if (!this.enabled || id == \"_top\") {\n return false\n }\n\n if (id) {\n const frameElement = getFrameElementById(id);\n if (frameElement) {\n return !frameElement.disabled\n }\n }\n\n if (!session.elementIsNavigatable(element)) {\n return false\n }\n\n if (submitter && !session.elementIsNavigatable(submitter)) {\n return false\n }\n\n return true\n }\n\n // Computed properties\n\n get id() {\n return this.element.id\n }\n\n get enabled() {\n return !this.element.disabled\n }\n\n get sourceURL() {\n if (this.element.src) {\n return this.element.src\n }\n }\n\n set sourceURL(sourceURL) {\n this.#ignoringChangesToAttribute(\"src\", () => {\n this.element.src = sourceURL ?? null;\n });\n }\n\n get loadingStyle() {\n return this.element.loading\n }\n\n get isLoading() {\n return this.formSubmission !== undefined || this.#resolveVisitPromise() !== undefined\n }\n\n get complete() {\n return this.element.hasAttribute(\"complete\")\n }\n\n set complete(value) {\n if (value) {\n this.element.setAttribute(\"complete\", \"\");\n } else {\n this.element.removeAttribute(\"complete\");\n }\n }\n\n get isActive() {\n return this.element.isActive && this.#connected\n }\n\n get rootLocation() {\n const meta = this.element.ownerDocument.querySelector(`meta[name=\"turbo-root\"]`);\n const root = meta?.content ?? \"/\";\n return expandURL(root)\n }\n\n #isIgnoringChangesTo(attributeName) {\n return this.#ignoredAttributes.has(attributeName)\n }\n\n #ignoringChangesToAttribute(attributeName, callback) {\n this.#ignoredAttributes.add(attributeName);\n callback();\n this.#ignoredAttributes.delete(attributeName);\n }\n\n #withCurrentNavigationElement(element, callback) {\n this.currentNavigationElement = element;\n callback();\n delete this.currentNavigationElement;\n }\n}\n\nfunction getFrameElementById(id) {\n if (id != null) {\n const element = document.getElementById(id);\n if (element instanceof FrameElement) {\n return element\n }\n }\n}\n\nfunction activateElement(element, currentURL) {\n if (element) {\n const src = element.getAttribute(\"src\");\n if (src != null && currentURL != null && urlsAreEqual(src, currentURL)) {\n throw new Error(`Matching element has a source URL which references itself`)\n }\n if (element.ownerDocument !== document) {\n element = document.importNode(element, true);\n }\n\n if (element instanceof FrameElement) {\n element.connectedCallback();\n element.disconnectedCallback();\n return element\n }\n }\n}\n\nconst StreamActions = {\n after() {\n this.targetElements.forEach((e) => e.parentElement?.insertBefore(this.templateContent, e.nextSibling));\n },\n\n append() {\n this.removeDuplicateTargetChildren();\n this.targetElements.forEach((e) => e.append(this.templateContent));\n },\n\n before() {\n this.targetElements.forEach((e) => e.parentElement?.insertBefore(this.templateContent, e));\n },\n\n prepend() {\n this.removeDuplicateTargetChildren();\n this.targetElements.forEach((e) => e.prepend(this.templateContent));\n },\n\n remove() {\n this.targetElements.forEach((e) => e.remove());\n },\n\n replace() {\n const method = this.getAttribute(\"method\");\n\n this.targetElements.forEach((targetElement) => {\n if (method === \"morph\") {\n morphElements(targetElement, this.templateContent);\n } else {\n targetElement.replaceWith(this.templateContent);\n }\n });\n },\n\n update() {\n const method = this.getAttribute(\"method\");\n\n this.targetElements.forEach((targetElement) => {\n if (method === \"morph\") {\n morphChildren(targetElement, this.templateContent);\n } else {\n targetElement.innerHTML = \"\";\n targetElement.append(this.templateContent);\n }\n });\n },\n\n refresh() {\n session.refresh(this.baseURI, this.requestId);\n }\n};\n\n//